From: Andrea Bianco Date: Mon, 26 Jul 2021 16:23:48 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.6.0 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=348f4998a270994f4fc2c377de677e0adf9ee2b5;p=motion2.git Built motion from commit (unavailable).|2.6.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 867e70e..b7ca8d2 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-22T20:54:17.192Z", + "time": "2021-07-26T16:16:30.348Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9110cb3..6e0d862 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-22T20:54:17.192Z", + "time": "2021-07-26T16:16:30.348Z", "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 7873102..0f392d6 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 _0x0c67=['getDataValue','action','STRING','contactManager','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports'];(function(_0x235fc5,_0xac5c59){var _0x43e315=function(_0x5b8d91){while(--_0x5b8d91){_0x235fc5['push'](_0x235fc5['shift']());}};_0x43e315(++_0xac5c59);}(_0x0c67,0xd7));var _0x70c6=function(_0x37c43c,_0x2bfc5b){_0x37c43c=_0x37c43c-0x0;var _0x5964b7=_0x0c67[_0x37c43c];return _0x5964b7;};'use strict';var Sequelize=require('sequelize');module[_0x70c6('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x35f429){return this[_0x70c6('0x1')](_0x70c6('0x2'));}},'action':{'type':Sequelize[_0x70c6('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x70c6('0x4'),'integration','motionbar',_0x70c6('0x5'),'urlForward',_0x70c6('0x6'),'bot',_0x70c6('0x7')]],'msg':_0x70c6('0x8')}},'comment':_0x70c6('0x8')},'data1':{'type':Sequelize[_0x70c6('0x3')](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[_0x70c6('0x3')](0x1000),'comment':_0x70c6('0x9')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x70c6('0xa')},'data4':{'type':Sequelize[_0x70c6('0x3')](0x1000)},'data5':{'type':Sequelize[_0x70c6('0x3')](0x1000)},'data6':{'type':Sequelize[_0x70c6('0x3')]},'data7':{'type':Sequelize[_0x70c6('0xb')]}}; \ No newline at end of file +var _0x6004=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','browser'];(function(_0x2e852e,_0x5150b2){var _0x4439a2=function(_0x28b482){while(--_0x28b482){_0x2e852e['push'](_0x2e852e['shift']());}};_0x4439a2(++_0x5150b2);}(_0x6004,0x9b));var _0x4600=function(_0x406459,_0x2a5eae){_0x406459=_0x406459-0x0;var _0x6895c3=_0x6004[_0x406459];return _0x6895c3;};'use strict';var Sequelize=require(_0x4600('0x0'));module[_0x4600('0x1')]={'name':{'type':Sequelize[_0x4600('0x2')],'get':function(_0x3ccc58){return this[_0x4600('0x3')](_0x4600('0x4'));}},'action':{'type':Sequelize[_0x4600('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4600('0x6'),_0x4600('0x7'),_0x4600('0x8'),'jscripty','urlForward',_0x4600('0x9'),_0x4600('0xa'),_0x4600('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x4600('0xc')},'data1':{'type':Sequelize[_0x4600('0x5')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x4600('0x5')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x4600('0xd')},'data4':{'type':Sequelize[_0x4600('0x5')](0x1000)},'data5':{'type':Sequelize[_0x4600('0x5')](0x1000)},'data6':{'type':Sequelize[_0x4600('0x5')]},'data7':{'type':Sequelize[_0x4600('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index ca9e85c..3351876 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 _0x861a=['undefined','offset','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit'];(function(_0x4f293a,_0x29666d){var _0x2a7f60=function(_0x2f8dcd){while(--_0x2f8dcd){_0x4f293a['push'](_0x4f293a['shift']());}};_0x2a7f60(++_0x29666d);}(_0x861a,0x194));var _0xa861=function(_0x2411f9,_0x39a0f5){_0x2411f9=_0x2411f9-0x0;var _0x5ab105=_0x861a[_0x2411f9];return _0x5ab105;};'use strict';var emlformat=require(_0xa861('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa861('0x1'));var jsonpatch=require(_0xa861('0x2'));var rp=require(_0xa861('0x3'));var moment=require(_0xa861('0x4'));var BPromise=require(_0xa861('0x5'));var Mustache=require(_0xa861('0x6'));var util=require('util');var path=require(_0xa861('0x7'));var sox=require(_0xa861('0x8'));var csv=require(_0xa861('0x9'));var ejs=require(_0xa861('0xa'));var fs=require('fs');var fs_extra=require(_0xa861('0xb'));var _=require('lodash');var squel=require(_0xa861('0xc'));var crypto=require(_0xa861('0xd'));var jsforce=require(_0xa861('0xe'));var deskjs=require(_0xa861('0xf'));var toCsv=require(_0xa861('0x9'));var querystring=require(_0xa861('0x10'));var Papa=require(_0xa861('0x11'));var Redis=require(_0xa861('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa861('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa861('0x14'));var utils=require(_0xa861('0x15'));var config=require(_0xa861('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa861('0x17'))['db'];function respondWithStatusCode(_0xf01095,_0x44c425){_0x44c425=_0x44c425||0xcc;return function(_0x35f59b){if(_0x35f59b){return _0xf01095[_0xa861('0x18')](_0x44c425);}return _0xf01095['status'](_0x44c425)['end']();};}function respondWithResult(_0x8b05bd,_0x4df9aa){_0x4df9aa=_0x4df9aa||0xc8;return function(_0x4a7f27){if(_0x4a7f27){return _0x8b05bd[_0xa861('0x19')](_0x4df9aa)[_0xa861('0x1a')](_0x4a7f27);}};}function respondWithFilteredResult(_0x405e23,_0xb5ce78){return function(_0x4792d3){if(_0x4792d3){var _0x2e69c1=typeof _0xb5ce78['offset']==='undefined'&&typeof _0xb5ce78[_0xa861('0x1b')]===_0xa861('0x1c');var _0x18c897=_0x4792d3['count'];var _0xc85eb3=_0x2e69c1?0x0:_0xb5ce78[_0xa861('0x1d')];var _0x2cbdae=_0x2e69c1?_0x4792d3[_0xa861('0x1e')]:_0xb5ce78[_0xa861('0x1d')]+_0xb5ce78['limit'];var _0x20e465;if(_0x2cbdae>=_0x18c897){_0x2cbdae=_0x18c897;_0x20e465=0xc8;}else{_0x20e465=0xce;}_0x405e23[_0xa861('0x19')](_0x20e465);return _0x405e23[_0xa861('0x1f')](_0xa861('0x20'),_0xc85eb3+'-'+_0x2cbdae+'/'+_0x18c897)[_0xa861('0x1a')](_0x4792d3);}return null;};}function patchUpdates(_0x52ca65){return function(_0x398e49){try{jsonpatch[_0xa861('0x21')](_0x398e49,_0x52ca65,!![]);}catch(_0x2437ad){return BPromise['reject'](_0x2437ad);}return _0x398e49[_0xa861('0x22')]();};}function saveUpdates(_0x353299,_0x58270d){return function(_0x24e305){if(_0x24e305){return _0x24e305[_0xa861('0x23')](_0x353299)[_0xa861('0x24')](function(_0x53d561){return _0x53d561;});}return null;};}function removeEntity(_0x3fd022,_0x225d1f){return function(_0x59bc73){if(_0x59bc73){return _0x59bc73[_0xa861('0x25')]()[_0xa861('0x24')](function(){_0x3fd022['status'](0xcc)[_0xa861('0x26')]();});}};}function handleEntityNotFound(_0x133c81,_0x1653a1){return function(_0x598b72){if(!_0x598b72){_0x133c81[_0xa861('0x18')](0x194);}return _0x598b72;};}function handleError(_0x358915,_0x364589){_0x364589=_0x364589||0x1f4;return function(_0x2176d3){logger[_0xa861('0x27')](_0x2176d3[_0xa861('0x28')]);if(_0x2176d3[_0xa861('0x29')]){delete _0x2176d3['name'];}_0x358915[_0xa861('0x19')](_0x364589)[_0xa861('0x2a')](_0x2176d3);};}exports[_0xa861('0x23')]=function(_0x58a58c,_0x332f41){if(_0x58a58c[_0xa861('0x2b')]['id']){delete _0x58a58c[_0xa861('0x2b')]['id'];}return db[_0xa861('0x2c')][_0xa861('0x2d')]({'where':{'id':_0x58a58c[_0xa861('0x2e')]['id']}})['then'](handleEntityNotFound(_0x332f41,null))['then'](saveUpdates(_0x58a58c['body'],null))[_0xa861('0x24')](respondWithResult(_0x332f41,null))['catch'](handleError(_0x332f41,null));};exports[_0xa861('0x25')]=function(_0x31481a,_0x22ae63){return db[_0xa861('0x2c')]['find']({'where':{'id':_0x31481a[_0xa861('0x2e')]['id']}})[_0xa861('0x24')](handleEntityNotFound(_0x22ae63,null))[_0xa861('0x24')](removeEntity(_0x22ae63,null))[_0xa861('0x2f')](handleError(_0x22ae63,null));}; \ No newline at end of file +var _0x43e4=['error','stack','name','send','body','Action','find','then','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x43e4,0x15a));var _0x443e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x43e4[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x443e('0x0'));var rimraf=require(_0x443e('0x1'));var zipdir=require(_0x443e('0x2'));var jsonpatch=require(_0x443e('0x3'));var rp=require(_0x443e('0x4'));var moment=require(_0x443e('0x5'));var BPromise=require(_0x443e('0x6'));var Mustache=require(_0x443e('0x7'));var util=require(_0x443e('0x8'));var path=require(_0x443e('0x9'));var sox=require(_0x443e('0xa'));var csv=require(_0x443e('0xb'));var ejs=require(_0x443e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x443e('0xd'));var squel=require(_0x443e('0xe'));var crypto=require(_0x443e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x443e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x443e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x443e('0x12'));var qs=require(_0x443e('0x13'));var as=require(_0x443e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x443e('0x15'));var utils=require(_0x443e('0x16'));var config=require(_0x443e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39503a,_0x54f36a){_0x54f36a=_0x54f36a||0xcc;return function(_0x35e86f){if(_0x35e86f){return _0x39503a['sendStatus'](_0x54f36a);}return _0x39503a['status'](_0x54f36a)[_0x443e('0x18')]();};}function respondWithResult(_0x5d929c,_0x3af126){_0x3af126=_0x3af126||0xc8;return function(_0xc02f11){if(_0xc02f11){return _0x5d929c[_0x443e('0x19')](_0x3af126)['json'](_0xc02f11);}};}function respondWithFilteredResult(_0x4fb024,_0x4f2c8a){return function(_0x1143e4){if(_0x1143e4){var _0x5e1160=typeof _0x4f2c8a[_0x443e('0x1a')]===_0x443e('0x1b')&&typeof _0x4f2c8a[_0x443e('0x1c')]===_0x443e('0x1b');var _0x13167f=_0x1143e4[_0x443e('0x1d')];var _0x53bc15=_0x5e1160?0x0:_0x4f2c8a[_0x443e('0x1a')];var _0x510247=_0x5e1160?_0x1143e4[_0x443e('0x1d')]:_0x4f2c8a['offset']+_0x4f2c8a[_0x443e('0x1c')];var _0x41aba0;if(_0x510247>=_0x13167f){_0x510247=_0x13167f;_0x41aba0=0xc8;}else{_0x41aba0=0xce;}_0x4fb024['status'](_0x41aba0);return _0x4fb024[_0x443e('0x1e')](_0x443e('0x1f'),_0x53bc15+'-'+_0x510247+'/'+_0x13167f)['json'](_0x1143e4);}return null;};}function patchUpdates(_0x267e9c){return function(_0x23e5cc){try{jsonpatch[_0x443e('0x20')](_0x23e5cc,_0x267e9c,!![]);}catch(_0x5f197f){return BPromise[_0x443e('0x21')](_0x5f197f);}return _0x23e5cc[_0x443e('0x22')]();};}function saveUpdates(_0x43a9c6,_0x464cd2){return function(_0x4f67f8){if(_0x4f67f8){return _0x4f67f8[_0x443e('0x23')](_0x43a9c6)['then'](function(_0x33cc04){return _0x33cc04;});}return null;};}function removeEntity(_0x50471a,_0x5bc94f){return function(_0x39aff7){if(_0x39aff7){return _0x39aff7[_0x443e('0x24')]()['then'](function(){_0x50471a[_0x443e('0x19')](0xcc)[_0x443e('0x18')]();});}};}function handleEntityNotFound(_0x3f45b1,_0x315ebe){return function(_0x4664b1){if(!_0x4664b1){_0x3f45b1[_0x443e('0x25')](0x194);}return _0x4664b1;};}function handleError(_0x4dfa7b,_0x195bbb){_0x195bbb=_0x195bbb||0x1f4;return function(_0x10525a){logger[_0x443e('0x26')](_0x10525a[_0x443e('0x27')]);if(_0x10525a[_0x443e('0x28')]){delete _0x10525a[_0x443e('0x28')];}_0x4dfa7b[_0x443e('0x19')](_0x195bbb)[_0x443e('0x29')](_0x10525a);};}exports[_0x443e('0x23')]=function(_0x30b6d0,_0x4d7882){if(_0x30b6d0['body']['id']){delete _0x30b6d0[_0x443e('0x2a')]['id'];}return db[_0x443e('0x2b')][_0x443e('0x2c')]({'where':{'id':_0x30b6d0['params']['id']}})[_0x443e('0x2d')](handleEntityNotFound(_0x4d7882,null))[_0x443e('0x2d')](saveUpdates(_0x30b6d0[_0x443e('0x2a')],null))[_0x443e('0x2d')](respondWithResult(_0x4d7882,null))[_0x443e('0x2e')](handleError(_0x4d7882,null));};exports[_0x443e('0x24')]=function(_0x2fe1f7,_0x2ab526){return db[_0x443e('0x2b')][_0x443e('0x2c')]({'where':{'id':_0x2fe1f7[_0x443e('0x2f')]['id']}})[_0x443e('0x2d')](handleEntityNotFound(_0x2ab526,null))[_0x443e('0x2d')](removeEntity(_0x2ab526,null))['catch'](handleError(_0x2ab526,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 438c51f..03d82f0 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 _0x29e5=['exports','define','Action','tools_actions','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x11a6c2,_0x501fdf){var _0x46f007=function(_0x59104e){while(--_0x59104e){_0x11a6c2['push'](_0x11a6c2['shift']());}};_0x46f007(++_0x501fdf);}(_0x29e5,0xb8));var _0x529e=function(_0x86d5c,_0x4f0973){_0x86d5c=_0x86d5c-0x0;var _0xf88676=_0x29e5[_0x86d5c];return _0xf88676;};'use strict';var _=require(_0x529e('0x0'));var util=require(_0x529e('0x1'));var logger=require('../../config/logger')(_0x529e('0x2'));var moment=require(_0x529e('0x3'));var BPromise=require('bluebird');var rp=require(_0x529e('0x4'));var fs=require('fs');var path=require(_0x529e('0x5'));var rimraf=require(_0x529e('0x6'));var config=require(_0x529e('0x7'));var attributes=require('./action.attributes');module[_0x529e('0x8')]=function(_0xa53f8f,_0x42c228){return _0xa53f8f[_0x529e('0x9')](_0x529e('0xa'),attributes,{'tableName':_0x529e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3941=['rimraf','../../config/environment','exports','define','Action','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x329c4b,_0x5a3104){var _0x410817=function(_0x175c1f){while(--_0x175c1f){_0x329c4b['push'](_0x329c4b['shift']());}};_0x410817(++_0x5a3104);}(_0x3941,0x165));var _0x1394=function(_0x2c8304,_0x4c2201){_0x2c8304=_0x2c8304-0x0;var _0x3d458a=_0x3941[_0x2c8304];return _0x3d458a;};'use strict';var _=require('lodash');var util=require(_0x1394('0x0'));var logger=require(_0x1394('0x1'))(_0x1394('0x2'));var moment=require(_0x1394('0x3'));var BPromise=require(_0x1394('0x4'));var rp=require(_0x1394('0x5'));var fs=require('fs');var path=require(_0x1394('0x6'));var rimraf=require(_0x1394('0x7'));var config=require(_0x1394('0x8'));var attributes=require('./action.attributes');module[_0x1394('0x9')]=function(_0x185371,_0x3ebaf5){return _0x185371[_0x1394('0xa')](_0x1394('0xb'),attributes,{'tableName':_0x1394('0xc'),'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 2a4ae5c..b7c1b1a 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 _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1249fe,_0x1d03b3){var _0x8e5a5c=function(_0x1f792c){while(--_0x1f792c){_0x1249fe['push'](_0x1249fe['shift']());}};_0x8e5a5c(++_0x1d03b3);}(_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')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\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')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x208af4,_0x363ee5){var _0x4b53c5=function(_0x27e40d){while(--_0x27e40d){_0x208af4['push'](_0x208af4['shift']());}};_0x4b53c5(++_0x363ee5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0xcb91[_0x5756c6];return _0x4b5806;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7832de4..e17365b 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 _0xbd5c=['../../config/environment','./action.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4193d2,_0x4a3447){var _0x53db9a=function(_0x170a9b){while(--_0x170a9b){_0x4193d2['push'](_0x4193d2['shift']());}};_0x53db9a(++_0x4a3447);}(_0xbd5c,0x19d));var _0xcbd5=function(_0x3b6c3a,_0x19ab5e){_0x3b6c3a=_0x3b6c3a-0x0;var _0x2d9586=_0xbd5c[_0x3b6c3a];return _0x2d9586;};'use strict';var multer=require(_0xcbd5('0x0'));var util=require(_0xcbd5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbd5('0x2'));var router=express[_0xcbd5('0x3')]();var fs_extra=require(_0xcbd5('0x4'));var auth=require(_0xcbd5('0x5'));var interaction=require(_0xcbd5('0x6'));var config=require(_0xcbd5('0x7'));var controller=require(_0xcbd5('0x8'));router[_0xcbd5('0x9')](_0xcbd5('0xa'),auth[_0xcbd5('0xb')](),controller['update']);router[_0xcbd5('0xc')](_0xcbd5('0xa'),auth[_0xcbd5('0xb')](),controller[_0xcbd5('0xd')]);module[_0xcbd5('0xe')]=router; \ No newline at end of file +var _0x71a6=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x2dffd7,_0x50e766){var _0x55e83f=function(_0x1cf727){while(--_0x1cf727){_0x2dffd7['push'](_0x2dffd7['shift']());}};_0x55e83f(++_0x50e766);}(_0x71a6,0xa8));var _0x671a=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x71a6[_0x470e67];return _0x28bbde;};'use strict';var multer=require(_0x671a('0x0'));var util=require(_0x671a('0x1'));var path=require(_0x671a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x671a('0x3')]();var fs_extra=require(_0x671a('0x4'));var auth=require(_0x671a('0x5'));var interaction=require(_0x671a('0x6'));var config=require('../../config/environment');var controller=require(_0x671a('0x7'));router[_0x671a('0x8')](_0x671a('0x9'),auth[_0x671a('0xa')](),controller[_0x671a('0xb')]);router[_0x671a('0xc')]('/:id',auth[_0x671a('0xa')](),controller[_0x671a('0xd')]);module[_0x671a('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index e5ed772..ff439be 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 _0x264c=['TEXT','sequelize','exports','STRING'];(function(_0x40ce01,_0x1e39c8){var _0xa0f16e=function(_0x2356ad){while(--_0x2356ad){_0x40ce01['push'](_0x40ce01['shift']());}};_0xa0f16e(++_0x1e39c8);}(_0x264c,0x9d));var _0xc264=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x264c[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0xc264('0x0'));module[_0xc264('0x1')]={'name':{'type':Sequelize[_0xc264('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc264('0x2')]},'parent':{'type':Sequelize[_0xc264('0x2')]},'table':{'type':Sequelize[_0xc264('0x2')]},'conditions':{'type':Sequelize[_0xc264('0x3')]},'joins':{'type':Sequelize[_0xc264('0x3')]}}; \ No newline at end of file +var _0x83a8=['exports','STRING','TEXT','sequelize'];(function(_0x438470,_0x2e1585){var _0x550434=function(_0x48dad5){while(--_0x48dad5){_0x438470['push'](_0x438470['shift']());}};_0x550434(++_0x2e1585);}(_0x83a8,0xb7));var _0x883a=function(_0x1c333d,_0x530ffc){_0x1c333d=_0x1c333d-0x0;var _0x2aa0ba=_0x83a8[_0x1c333d];return _0x2aa0ba;};'use strict';var Sequelize=require(_0x883a('0x0'));module[_0x883a('0x1')]={'name':{'type':Sequelize[_0x883a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x883a('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x883a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b5dee2e..2a28faa 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 _0xb10b=['offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','catch','params','keys','find','create','body','user','role','get','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','value','getFields','from','groupBy','fullPath','%s-%s.%s','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','select','findAll','debug','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','status','end','json'];(function(_0x267a2d,_0x4f46e9){var _0x42057c=function(_0x5a56c9){while(--_0x5a56c9){_0x267a2d['push'](_0x267a2d['shift']());}};_0x42057c(++_0x4f46e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1db153,_0x1ab5d){_0x1db153=_0x1db153-0x0;var _0x530cbe=_0xb10b[_0x1db153];return _0x530cbe;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];var dbH=require(_0xbb10('0x17'))[_0xbb10('0x18')];function respondWithStatusCode(_0x193a27,_0x442548){_0x442548=_0x442548||0xcc;return function(_0x147230){if(_0x147230){return _0x193a27['sendStatus'](_0x442548);}return _0x193a27[_0xbb10('0x19')](_0x442548)[_0xbb10('0x1a')]();};}function respondWithResult(_0x45b9d6,_0x17fd46){_0x17fd46=_0x17fd46||0xc8;return function(_0x3df17b){if(_0x3df17b){return _0x45b9d6[_0xbb10('0x19')](_0x17fd46)[_0xbb10('0x1b')](_0x3df17b);}};}function respondWithFilteredResult(_0x36b5e8,_0x3e26f4){return function(_0x2b184e){if(_0x2b184e){var _0x4a2bfc=typeof _0x3e26f4[_0xbb10('0x1c')]===_0xbb10('0x1d')&&typeof _0x3e26f4[_0xbb10('0x1e')]===_0xbb10('0x1d');var _0x378da8=_0x2b184e[_0xbb10('0x1f')];var _0x575cca=_0x4a2bfc?0x0:_0x3e26f4[_0xbb10('0x1c')];var _0xbf2906=_0x4a2bfc?_0x2b184e[_0xbb10('0x1f')]:_0x3e26f4['offset']+_0x3e26f4[_0xbb10('0x1e')];var _0x19f48d;if(_0xbf2906>=_0x378da8){_0xbf2906=_0x378da8;_0x19f48d=0xc8;}else{_0x19f48d=0xce;}_0x36b5e8[_0xbb10('0x19')](_0x19f48d);return _0x36b5e8[_0xbb10('0x20')](_0xbb10('0x21'),_0x575cca+'-'+_0xbf2906+'/'+_0x378da8)[_0xbb10('0x1b')](_0x2b184e);}return null;};}function patchUpdates(_0x4deb49){return function(_0x12f888){try{jsonpatch[_0xbb10('0x22')](_0x12f888,_0x4deb49,!![]);}catch(_0x50aea1){return BPromise['reject'](_0x50aea1);}return _0x12f888[_0xbb10('0x23')]();};}function saveUpdates(_0x311abe,_0x2e911d){return function(_0x317da4){if(_0x317da4){return _0x317da4[_0xbb10('0x24')](_0x311abe)[_0xbb10('0x25')](function(_0x407cb4){return _0x407cb4;});}return null;};}function removeEntity(_0x436104,_0x7f2377){return function(_0x395404){if(_0x395404){return _0x395404[_0xbb10('0x26')]()[_0xbb10('0x25')](function(){var _0x537898=_0x395404['get']({'plain':!![]});var _0x4fb5e0=_0xbb10('0x27');return db[_0xbb10('0x28')][_0xbb10('0x26')]({'where':{'type':_0x4fb5e0,'resourceId':_0x537898['id']}})['then'](function(){return _0x395404;});})[_0xbb10('0x25')](function(){_0x436104[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1d5e95,_0x1acce9){return function(_0x20d946){if(!_0x20d946){_0x1d5e95[_0xbb10('0x29')](0x194);}return _0x20d946;};}function handleError(_0x4aabb9,_0x3796c7){_0x3796c7=_0x3796c7||0x1f4;return function(_0x21ac54){logger[_0xbb10('0x2a')](_0x21ac54[_0xbb10('0x2b')]);if(_0x21ac54[_0xbb10('0x2c')]){delete _0x21ac54[_0xbb10('0x2c')];}_0x4aabb9['status'](_0x3796c7)[_0xbb10('0x2d')](_0x21ac54);};}exports['index']=function(_0x448d5c,_0x56f2da){var _0x16ad2a={},_0x1dcc9c={},_0x1b59f9={'count':0x0,'rows':[]};var _0x491db4=_['map'](db[_0xbb10('0x2e')][_0xbb10('0x2f')],function(_0x4f590d){return{'name':_0x4f590d[_0xbb10('0x30')],'type':_0x4f590d[_0xbb10('0x31')][_0xbb10('0x32')]};});_0x1dcc9c[_0xbb10('0x33')]=_[_0xbb10('0x34')](_0x491db4,_0xbb10('0x2c'));_0x1dcc9c[_0xbb10('0x35')]=_['keys'](_0x448d5c[_0xbb10('0x35')]);_0x1dcc9c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x1dcc9c[_0xbb10('0x33')],_0x1dcc9c[_0xbb10('0x35')]);_0x16ad2a[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x1dcc9c[_0xbb10('0x33')],qs[_0xbb10('0x39')](_0x448d5c['query'][_0xbb10('0x39')]));_0x16ad2a[_0xbb10('0x38')]=_0x16ad2a[_0xbb10('0x38')][_0xbb10('0x3a')]?_0x16ad2a['attributes']:_0x1dcc9c[_0xbb10('0x33')];if(!_0x448d5c['query']['hasOwnProperty'](_0xbb10('0x3b'))){_0x16ad2a[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x448d5c[_0xbb10('0x35')][_0xbb10('0x1e')]);_0x16ad2a[_0xbb10('0x1c')]=qs['offset'](_0x448d5c[_0xbb10('0x35')][_0xbb10('0x1c')]);}_0x16ad2a['order']=qs['sort'](_0x448d5c['query'][_0xbb10('0x3c')]);_0x16ad2a[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x448d5c[_0xbb10('0x35')],_0x1dcc9c[_0xbb10('0x36')]),_0x491db4);if(_0x448d5c[_0xbb10('0x35')]['filter']){_0x16ad2a[_0xbb10('0x3d')]=_[_0xbb10('0x3e')](_0x16ad2a[_0xbb10('0x3d')],{'$or':_[_0xbb10('0x34')](_0x491db4,function(_0x4f1cdd){if(_0x4f1cdd[_0xbb10('0x31')]!==_0xbb10('0x3f')){var _0x5835fd={};_0x5835fd[_0x4f1cdd[_0xbb10('0x2c')]]={'$like':'%'+_0x448d5c[_0xbb10('0x35')][_0xbb10('0x40')]+'%'};return _0x5835fd;}})});}_0x16ad2a=_[_0xbb10('0x3e')]({},_0x16ad2a,_0x448d5c[_0xbb10('0x41')]);var _0x185a52={'where':_0x16ad2a['where']};return db[_0xbb10('0x2e')][_0xbb10('0x1f')](_0x185a52)[_0xbb10('0x25')](function(_0x3d3c41){_0x1b59f9['count']=_0x3d3c41;if(_0x448d5c[_0xbb10('0x35')][_0xbb10('0x42')]){_0x16ad2a[_0xbb10('0x43')]=[{'all':!![]}];}return db[_0xbb10('0x2e')]['findAll'](_0x16ad2a);})[_0xbb10('0x25')](function(_0x202c60){_0x1b59f9['rows']=_0x202c60;return _0x1b59f9;})['then'](respondWithFilteredResult(_0x56f2da,_0x16ad2a))[_0xbb10('0x44')](handleError(_0x56f2da,null));};exports['show']=function(_0x318984,_0x180933){var _0x4c66d8={'raw':![],'where':{'id':_0x318984[_0xbb10('0x45')]['id']}},_0x366608={};_0x366608[_0xbb10('0x33')]=_['keys'](db[_0xbb10('0x2e')][_0xbb10('0x2f')]);_0x366608[_0xbb10('0x35')]=_[_0xbb10('0x46')](_0x318984[_0xbb10('0x35')]);_0x366608[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x366608[_0xbb10('0x33')],_0x366608[_0xbb10('0x35')]);_0x4c66d8[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x366608[_0xbb10('0x33')],qs['fields'](_0x318984[_0xbb10('0x35')][_0xbb10('0x39')]));_0x4c66d8['attributes']=_0x4c66d8[_0xbb10('0x38')][_0xbb10('0x3a')]?_0x4c66d8[_0xbb10('0x38')]:_0x366608[_0xbb10('0x33')];if(_0x318984[_0xbb10('0x35')][_0xbb10('0x42')]){_0x4c66d8[_0xbb10('0x43')]=[{'all':!![]}];}_0x4c66d8=_['merge']({},_0x4c66d8,_0x318984['options']);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x4c66d8)[_0xbb10('0x25')](handleEntityNotFound(_0x180933,null))['then'](respondWithResult(_0x180933,null))['catch'](handleError(_0x180933,null));};exports[_0xbb10('0x48')]=function(_0x34cf4e,_0x1bd054){return db[_0xbb10('0x2e')][_0xbb10('0x48')](_0x34cf4e[_0xbb10('0x49')],{})[_0xbb10('0x25')](function(_0x460788){var _0x2626d8=_0x34cf4e[_0xbb10('0x4a')]['get']({'plain':!![]});if(!_0x2626d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2626d8[_0xbb10('0x4b')]===_0xbb10('0x4a')){var _0x36ab7d=_0x460788[_0xbb10('0x4c')]({'plain':!![]});var _0x36aa7d=_0xbb10('0x4d');return db[_0xbb10('0x4e')][_0xbb10('0x47')]({'where':{'name':_0x36aa7d,'userProfileId':_0x2626d8[_0xbb10('0x4f')]},'raw':!![]})[_0xbb10('0x25')](function(_0x19ca3e){if(_0x19ca3e&&_0x19ca3e[_0xbb10('0x50')]===0x0){return db[_0xbb10('0x28')][_0xbb10('0x48')]({'name':_0x36ab7d[_0xbb10('0x2c')],'resourceId':_0x36ab7d['id'],'type':'CustomReports','sectionId':_0x19ca3e['id']},{})[_0xbb10('0x25')](function(){return _0x460788;});}else{return _0x460788;}})['catch'](function(_0x33d60a){logger[_0xbb10('0x2a')](_0xbb10('0x51'),_0x33d60a);throw _0x33d60a;});}return _0x460788;})[_0xbb10('0x25')](respondWithResult(_0x1bd054,0xc9))[_0xbb10('0x44')](handleError(_0x1bd054,null));};exports[_0xbb10('0x24')]=function(_0x2e3326,_0x44eec1){if(_0x2e3326[_0xbb10('0x49')]['id']){delete _0x2e3326[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2e')][_0xbb10('0x47')]({'where':{'id':_0x2e3326[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x44eec1,null))[_0xbb10('0x25')](saveUpdates(_0x2e3326['body'],null))[_0xbb10('0x25')](respondWithResult(_0x44eec1,null))[_0xbb10('0x44')](handleError(_0x44eec1,null));};exports[_0xbb10('0x26')]=function(_0x4ce8e7,_0xbffa3c){return db[_0xbb10('0x2e')]['find']({'where':{'id':_0x4ce8e7[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0xbffa3c,null))[_0xbb10('0x25')](removeEntity(_0xbffa3c,null))[_0xbb10('0x44')](handleError(_0xbffa3c,null));};exports[_0xbb10('0x52')]=function(_0x22de7f,_0x175872){var _0x12ec18=0xa;var _0x205e01=[_0xbb10('0x53'),_0xbb10('0x54'),_0xbb10('0x55'),_0xbb10('0x56')];var _0x4e7fac={'SUM':'SUM(%s)','COUNT':_0xbb10('0x57'),'COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbb10('0x5b'),'GROUP_CONCAT DESC':_0xbb10('0x5c')};var _0x410bef={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':_0xbb10('0x5f'),'ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x117e84=function(_0x216cff){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xbb10('0x61'),_0xbb10('0x62')],_0x216cff);};var _0x155dc5=function(_0x5bd1c0){if(!_0x5bd1c0||!_0x5bd1c0['rules']['length']){return'';}for(var _0x3ebc5f='(',_0x249b33=0x0;_0x249b33<_0x5bd1c0[_0xbb10('0x63')]['length'];_0x249b33+=0x1){_0x249b33>0x0&&(_0x3ebc5f+='\x20'+_0x5bd1c0[_0xbb10('0x64')]+'\x20');_0x3ebc5f+=_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['group']?_0x155dc5(_0x5bd1c0['rules'][_0x249b33][_0xbb10('0x65')]):_0x5bd1c0[_0xbb10('0x63')][_0x249b33][_0xbb10('0x66')]+'\x20'+_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['condition']+(_0x117e84(_0x5bd1c0[_0xbb10('0x63')][_0x249b33][_0xbb10('0x67')])?'\x20'+_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['value']:'');}return _0x3ebc5f+')';};var _0x402a01={'where':{'id':_0x22de7f[_0xbb10('0x45')]['id']}},_0x2f05bc,_0x3e3617,_0x5b2bd4,_0x2ca491,_0x31e85e;_0x402a01=_[_0xbb10('0x3e')]({},_0x402a01,_0x22de7f['options']);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x402a01)[_0xbb10('0x25')](function(_0x2d0f4b){if(_0x2d0f4b){_0x2f05bc=_0x2d0f4b;return _0x2d0f4b['getFields']();}return null;})[_0xbb10('0x25')](function(_0x277fe7){if(_0x277fe7){if(!_0x277fe7[_0xbb10('0x3a')]){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))](_0xbb10('0x6a'),0x193);}_0x3e3617=_0x277fe7;return db[_0xbb10('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5acd5e){if(_0x5acd5e){_0x5b2bd4=_[_0xbb10('0x6c')](_0x5acd5e,'id');var _0x9c672d;var _0x3eda96=squel['select']();_0x3eda96['from'](_0x2f05bc[_0xbb10('0x6d')]);for(var _0x1b11c0=0x0;_0x1b11c0<_0x3e3617[_0xbb10('0x3a')];_0x1b11c0+=0x1){_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x6e')]?_0x5b2bd4[_0x3e3617[_0x1b11c0][_0xbb10('0x6e')]][_0xbb10('0x6f')]:_0x3e3617[_0x1b11c0]['field'];_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x4e7fac[_0x3e3617[_0x1b11c0][_0xbb10('0x70')]],'%s',_0x9c672d):_0x9c672d;_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x72')]?_[_0xbb10('0x71')](_0x410bef[_0x3e3617[_0x1b11c0]['format']],'%s',_0x9c672d):_0x9c672d;if(_0x3e3617[_0x1b11c0]['groupBy']){_0x3eda96['group'](_0x9c672d);}_0x3e3617[_0x1b11c0][_0xbb10('0x73')]&&_0x3eda96[_0xbb10('0x74')](_0x9c672d,_0x3e3617[_0x1b11c0][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x3eda96[_0xbb10('0x66')](_0x9c672d,_0x3e3617[_0x1b11c0][_0xbb10('0x76')]||_0x9c672d);}if(_0x2f05bc['joins']){_0x2f05bc[_0xbb10('0x77')]=JSON['parse'](_0x2f05bc['joins']);for(var _0x519a54=0x0;_0x519a54<_0x2f05bc[_0xbb10('0x77')][_0xbb10('0x3a')];_0x519a54+=0x1){if(_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x31')]&&_['includes'](_0x205e01,_0x2f05bc[_0xbb10('0x77')][_0x519a54]['type'])&&_0x2f05bc['joins'][_0x519a54][_0xbb10('0x78')]&&_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')]&&_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x7a')]){_0x3eda96[_0x2f05bc['joins'][_0x519a54][_0xbb10('0x31')]](_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')],null,util[_0xbb10('0x72')](_0xbb10('0x7b'),_0x2f05bc[_0xbb10('0x6d')],_0x2f05bc[_0xbb10('0x77')][_0x519a54]['parentKey'],_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')],_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x7a')]));}}}if(_0x2f05bc[_0xbb10('0x7c')]){_0x2f05bc[_0xbb10('0x7c')]=JSON[_0xbb10('0x7d')](_0x2f05bc[_0xbb10('0x7c')]);_0x3eda96['where'](_0x155dc5(_0x2f05bc[_0xbb10('0x7c')][_0xbb10('0x65')]));}_0x31e85e=_0x3eda96[_0xbb10('0x7e')]();_0x3eda96['limit'](_0x12ec18);_0x3eda96['offset'](0x0);logger['debug'](_0xbb10('0x7f'),_0x3eda96['toString']());return dbH['sequelize'][_0xbb10('0x35')](_0x3eda96[_0xbb10('0x80')](),{'type':dbH[_0xbb10('0x81')][_0xbb10('0x82')][_0xbb10('0x83')]});}})[_0xbb10('0x25')](respondWithResult(_0x175872,null))[_0xbb10('0x44')](handleError(_0x175872,null));};function runReport(_0x417304,_0x188b97,_0x5206e1){var _0x318a14=_0x188b97[_0xbb10('0x2c')];var _0x46b6d2=0xa;var _0x35b811=['join','left_join',_0xbb10('0x55'),_0xbb10('0x56')];var _0x30f0a4={'SUM':_0xbb10('0x84'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':_0xbb10('0x85'),'GROUP_CONCAT':_0xbb10('0x86'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x372636={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':_0xbb10('0x87')};var _0x50bcc9=function(_0x5caa06){return!_[_0xbb10('0x88')]([_0xbb10('0x89'),_0xbb10('0x8a'),'IS\x20EMPTY',_0xbb10('0x62')],_0x5caa06);};var _0x3a17fc=function(_0xfbb365){if(!_0xfbb365||!_0xfbb365[_0xbb10('0x63')][_0xbb10('0x3a')]){return'';}for(var _0x5de006='(',_0x45bd4e=0x0;_0x45bd4e<_0xfbb365[_0xbb10('0x63')][_0xbb10('0x3a')];_0x45bd4e+=0x1){_0x45bd4e>0x0&&(_0x5de006+='\x20'+_0xfbb365['operator']+'\x20');_0x5de006+=_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x65')]?_0x3a17fc(_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x65')]):_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x66')]+'\x20'+_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x67')]+(_0x50bcc9(_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x67')])?'\x20'+_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x8b')]:'');}return _0x5de006+')';};var _0x59e985={'where':{'id':_0x417304['id']}},_0x51f106,_0xe1fc51,_0x3fa344,_0x458615,_0x3fd367;_0x59e985=_[_0xbb10('0x3e')]({},_0x59e985,_0x5206e1);return db['AnalyticCustomReport'][_0xbb10('0x47')](_0x59e985)[_0xbb10('0x25')](function(_0x3b4d0b){if(_0x3b4d0b){_0x51f106=_0x3b4d0b;return _0x3b4d0b[_0xbb10('0x8c')]();}return null;})[_0xbb10('0x25')](function(_0x379d49){if(_0x379d49){if(!_0x379d49['length']){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe1fc51=_0x379d49;return db[_0xbb10('0x6b')]['findAll']({'raw':!![]});}return null;})[_0xbb10('0x25')](function(_0x28bd76){if(_0x28bd76){_0x3fa344=_[_0xbb10('0x6c')](_0x28bd76,'id');var _0xa99bf5;var _0x3a4a6e=squel['select']();_0x3a4a6e[_0xbb10('0x8d')](_0x51f106['table']);for(var _0x3fcc55=0x0;_0x3fcc55<_0xe1fc51[_0xbb10('0x3a')];_0x3fcc55+=0x1){_0xa99bf5=_0xe1fc51[_0x3fcc55]['MetricId']?_0x3fa344[_0xe1fc51[_0x3fcc55]['MetricId']][_0xbb10('0x6f')]:_0xe1fc51[_0x3fcc55][_0xbb10('0x66')];_0xa99bf5=_0xe1fc51[_0x3fcc55][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x30f0a4[_0xe1fc51[_0x3fcc55][_0xbb10('0x70')]],'%s',_0xa99bf5):_0xa99bf5;_0xa99bf5=_0xe1fc51[_0x3fcc55][_0xbb10('0x72')]?_[_0xbb10('0x71')](_0x372636[_0xe1fc51[_0x3fcc55][_0xbb10('0x72')]],'%s',_0xa99bf5):_0xa99bf5;if(_0xe1fc51[_0x3fcc55][_0xbb10('0x8e')]){_0x3a4a6e[_0xbb10('0x65')](_0xa99bf5);}_0xe1fc51[_0x3fcc55][_0xbb10('0x73')]&&_0x3a4a6e['order'](_0xa99bf5,_0xe1fc51[_0x3fcc55][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x3a4a6e[_0xbb10('0x66')](_0xa99bf5,_0xe1fc51[_0x3fcc55][_0xbb10('0x76')]||_0xa99bf5);}if(_0x51f106[_0xbb10('0x77')]){_0x51f106[_0xbb10('0x77')]=JSON[_0xbb10('0x7d')](_0x51f106[_0xbb10('0x77')]);for(var _0x3e6fe2=0x0;_0x3e6fe2<_0x51f106[_0xbb10('0x77')][_0xbb10('0x3a')];_0x3e6fe2+=0x1){if(_0x51f106[_0xbb10('0x77')][_0x3e6fe2]['type']&&_[_0xbb10('0x88')](_0x35b811,_0x51f106['joins'][_0x3e6fe2][_0xbb10('0x31')])&&_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x78')]&&_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x79')]&&_0x51f106['joins'][_0x3e6fe2][_0xbb10('0x7a')]){_0x3a4a6e[_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x31')]](_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x79')],null,util[_0xbb10('0x72')]('%s.%s\x20=\x20%s.%s',_0x51f106['table'],_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x78')],_0x51f106[_0xbb10('0x77')][_0x3e6fe2]['foreignTable'],_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x7a')]));}}}if(_0x51f106['conditions']){_0x51f106[_0xbb10('0x7c')]=JSON[_0xbb10('0x7d')](_0x51f106['conditions']);_0x3a4a6e[_0xbb10('0x3d')](_0x3a17fc(_0x51f106['conditions'][_0xbb10('0x65')]));}_0x3fd367=_0x3a4a6e[_0xbb10('0x7e')]();_0x3a4a6e['limit'](_0x46b6d2);_0x3a4a6e[_0xbb10('0x1c')](0x0);return;}})[_0xbb10('0x25')](function(){if(_0x188b97['output']==='web'){return null;}var _0xea6bf2=_[_0xbb10('0x3e')](_0x188b97,{'name':_0x188b97[_0xbb10('0x8f')]||_0x188b97[_0xbb10('0x2c')]||_0x51f106[_0xbb10('0x2c')],'basename':_0x318a14,'savename':util['format'](_0xbb10('0x90'),_0x188b97[_0xbb10('0x2c')]||_0x51f106[_0xbb10('0x2c')],require('randomstring')[_0xbb10('0x91')](0x4),_0x188b97[_0xbb10('0x92')]||_0xbb10('0x93')),'reportId':_0x51f106['id'],'reportType':_0xbb10('0x94')});return db[_0xbb10('0x95')][_0xbb10('0x48')](_0xea6bf2,{'raw':!![]});})[_0xbb10('0x25')](function(_0x189f07){if(_0x51f106[_0xbb10('0x6d')]==='cdr'){_0x3fd367['where'](_0x51f106[_0xbb10('0x6d')]+_0xbb10('0x96'),_0x188b97[_0xbb10('0x97')],_0x188b97[_0xbb10('0x98')]);}else{_0x3fd367[_0xbb10('0x3d')](_0x51f106[_0xbb10('0x6d')]+_0xbb10('0x99'),_0x188b97[_0xbb10('0x97')],_0x188b97[_0xbb10('0x98')]);}if(_0x189f07){logger[_0xbb10('0x9a')](_0xbb10('0x9b'),_0x3fd367[_0xbb10('0x80')]());require(_0xbb10('0x9c'))['fork'](path[_0xbb10('0x53')](__dirname,_0xbb10('0x9d'),_0x189f07[_0xbb10('0x92')]),[_0x189f07['id'],_0x3fd367[_0xbb10('0x80')](),path[_0xbb10('0x53')](__dirname,_0xbb10('0x9e'),_0x189f07[_0xbb10('0x9f')]),_0x318a14]);return _0x189f07;}else{var _0x1421e2=squel[_0xbb10('0xa0')]();_0x1421e2[_0xbb10('0x8d')]('('+_0x3fd367[_0xbb10('0x80')]()+')','countTable');_0x1421e2[_0xbb10('0x66')]('COUNT(*)',_0xbb10('0x1f'));_0x3fd367[_0xbb10('0x1e')](_0x188b97[_0xbb10('0x1e')]||_0x46b6d2);_0x3fd367[_0xbb10('0x1c')](_0x188b97[_0xbb10('0x1c')]||0x0);return dbH[_0xbb10('0x81')]['query'](_0x1421e2[_0xbb10('0x80')](),{'type':dbH['sequelize'][_0xbb10('0x82')][_0xbb10('0x83')]})[_0xbb10('0x25')](function(_0x576bb6){if(!_0x576bb6[_0xbb10('0x3a')]){_0x458615=0x0;}else{_0x458615=_0x576bb6[0x0][_0xbb10('0x1f')]||0x0;}return dbH[_0xbb10('0x81')][_0xbb10('0x35')](_0x3fd367[_0xbb10('0x80')](),{'type':dbH[_0xbb10('0x81')][_0xbb10('0x82')][_0xbb10('0x83')]});})['then'](function(_0x3696b3){return{'rows':_0x3696b3||[],'count':_0x458615};});}});}exports['run']=function(_0xe70161,_0x36e9b0){return runReport(_0xe70161[_0xbb10('0x45')],_0xe70161[_0xbb10('0x35')],_0xe70161[_0xbb10('0x41')])[_0xbb10('0x25')](respondWithResult(_0x36e9b0,null))[_0xbb10('0x44')](handleError(_0x36e9b0,null));};exports['runReport']=runReport;exports[_0xbb10('0x35')]=function(_0x5ca9a0,_0x51063a){var _0x1513e0=0xa;var _0x35cbb9=[_0xbb10('0x53'),_0xbb10('0x54'),_0xbb10('0x55'),_0xbb10('0x56')];var _0x5d1077={'SUM':_0xbb10('0x84'),'COUNT':_0xbb10('0x57'),'COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':_0xbb10('0x85'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbb10('0x5b'),'GROUP_CONCAT DESC':_0xbb10('0x5c')};var _0xb7c454={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':_0xbb10('0x5f'),'ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x33a43e=function(_0x5e4ae9){return!_[_0xbb10('0x88')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xbb10('0x61'),_0xbb10('0x62')],_0x5e4ae9);};var _0x24edcb=function(_0x3b7552){if(!_0x3b7552||!_0x3b7552[_0xbb10('0x63')]['length']){return'';}for(var _0xa42b80='(',_0x565ddf=0x0;_0x565ddf<_0x3b7552['rules']['length'];_0x565ddf+=0x1){_0x565ddf>0x0&&(_0xa42b80+='\x20'+_0x3b7552[_0xbb10('0x64')]+'\x20');_0xa42b80+=_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x65')]?_0x24edcb(_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x65')]):_0x3b7552['rules'][_0x565ddf][_0xbb10('0x66')]+'\x20'+_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x67')]+(_0x33a43e(_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x67')])?'\x20'+_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x8b')]:'');}return _0xa42b80+')';};var _0x485c1a={'where':{'id':_0x5ca9a0[_0xbb10('0x45')]['id']}},_0x4c95c2,_0x584a62,_0x386eac,_0x1581ef,_0x2ae3c6;_0x485c1a=_[_0xbb10('0x3e')]({},_0x485c1a,_0x5ca9a0[_0xbb10('0x41')]);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x485c1a)[_0xbb10('0x25')](function(_0x3b1131){if(_0x3b1131){_0x4c95c2=_0x3b1131;return _0x3b1131['getFields']();}return null;})['then'](function(_0x4dce53){if(_0x4dce53){if(!_0x4dce53[_0xbb10('0x3a')]){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x584a62=_0x4dce53;return db[_0xbb10('0x6b')][_0xbb10('0xa1')]({'raw':!![]});}return null;})[_0xbb10('0x25')](function(_0x290280){if(_0x290280){_0x386eac=_[_0xbb10('0x6c')](_0x290280,'id');var _0x11279d;var _0x485f46=squel['select']();_0x485f46[_0xbb10('0x8d')](_0x4c95c2['table']);for(var _0x370215=0x0;_0x370215<_0x584a62[_0xbb10('0x3a')];_0x370215+=0x1){_0x11279d=_0x584a62[_0x370215][_0xbb10('0x6e')]?_0x386eac[_0x584a62[_0x370215][_0xbb10('0x6e')]][_0xbb10('0x6f')]:_0x584a62[_0x370215][_0xbb10('0x66')];_0x11279d=_0x584a62[_0x370215][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x5d1077[_0x584a62[_0x370215][_0xbb10('0x70')]],'%s',_0x11279d):_0x11279d;_0x11279d=_0x584a62[_0x370215][_0xbb10('0x72')]?_['replace'](_0xb7c454[_0x584a62[_0x370215][_0xbb10('0x72')]],'%s',_0x11279d):_0x11279d;if(_0x584a62[_0x370215]['groupBy']){_0x485f46[_0xbb10('0x65')](_0x11279d);}_0x584a62[_0x370215]['orderBy']&&_0x485f46[_0xbb10('0x74')](_0x11279d,_0x584a62[_0x370215][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x485f46[_0xbb10('0x66')](_0x11279d,_0x584a62[_0x370215]['alias']||_0x11279d);}if(_0x4c95c2[_0xbb10('0x77')]){_0x4c95c2['joins']=JSON[_0xbb10('0x7d')](_0x4c95c2[_0xbb10('0x77')]);for(var _0xcdaf04=0x0;_0xcdaf04<_0x4c95c2['joins'][_0xbb10('0x3a')];_0xcdaf04+=0x1){if(_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x31')]&&_[_0xbb10('0x88')](_0x35cbb9,_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x31')])&&_0x4c95c2['joins'][_0xcdaf04]['parentKey']&&_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x79')]&&_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x7a')]){_0x485f46[_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x31')]](_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x79')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4c95c2[_0xbb10('0x6d')],_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x78')],_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x79')],_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x7a')]));}}}if(_0x4c95c2['conditions']){_0x4c95c2['conditions']=JSON['parse'](_0x4c95c2[_0xbb10('0x7c')]);_0x485f46['where'](_0x24edcb(_0x4c95c2[_0xbb10('0x7c')][_0xbb10('0x65')]));}_0x2ae3c6=_0x485f46[_0xbb10('0x7e')]();_0x485f46[_0xbb10('0x1e')](_0x1513e0);_0x485f46[_0xbb10('0x1c')](0x0);logger[_0xbb10('0xa2')](_0xbb10('0x7f'),_0x485f46[_0xbb10('0x80')]());return dbH[_0xbb10('0x81')][_0xbb10('0x35')](_0x485f46[_0xbb10('0x80')](),{'type':dbH['sequelize'][_0xbb10('0x82')][_0xbb10('0x83')]});}})['then'](function(){return{'sql':_0x2ae3c6[_0xbb10('0x80')]()};})['then'](respondWithResult(_0x51063a,null))['catch'](handleError(_0x51063a,null));}; \ No newline at end of file +var _0xb10b=['offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','catch','params','keys','find','create','body','user','role','get','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','value','getFields','from','groupBy','fullPath','%s-%s.%s','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','select','findAll','debug','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','status','end','json'];(function(_0xd4ccbc,_0x34fd43){var _0x16576a=function(_0x4bfcfc){while(--_0x4bfcfc){_0xd4ccbc['push'](_0xd4ccbc['shift']());}};_0x16576a(++_0x34fd43);}(_0xb10b,0x12a));var _0xbb10=function(_0x789179,_0x455e5f){_0x789179=_0x789179-0x0;var _0x10878f=_0xb10b[_0x789179];return _0x10878f;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];var dbH=require(_0xbb10('0x17'))[_0xbb10('0x18')];function respondWithStatusCode(_0x193a27,_0x442548){_0x442548=_0x442548||0xcc;return function(_0x147230){if(_0x147230){return _0x193a27['sendStatus'](_0x442548);}return _0x193a27[_0xbb10('0x19')](_0x442548)[_0xbb10('0x1a')]();};}function respondWithResult(_0x45b9d6,_0x17fd46){_0x17fd46=_0x17fd46||0xc8;return function(_0x3df17b){if(_0x3df17b){return _0x45b9d6[_0xbb10('0x19')](_0x17fd46)[_0xbb10('0x1b')](_0x3df17b);}};}function respondWithFilteredResult(_0x36b5e8,_0x3e26f4){return function(_0x2b184e){if(_0x2b184e){var _0x4a2bfc=typeof _0x3e26f4[_0xbb10('0x1c')]===_0xbb10('0x1d')&&typeof _0x3e26f4[_0xbb10('0x1e')]===_0xbb10('0x1d');var _0x378da8=_0x2b184e[_0xbb10('0x1f')];var _0x575cca=_0x4a2bfc?0x0:_0x3e26f4[_0xbb10('0x1c')];var _0xbf2906=_0x4a2bfc?_0x2b184e[_0xbb10('0x1f')]:_0x3e26f4['offset']+_0x3e26f4[_0xbb10('0x1e')];var _0x19f48d;if(_0xbf2906>=_0x378da8){_0xbf2906=_0x378da8;_0x19f48d=0xc8;}else{_0x19f48d=0xce;}_0x36b5e8[_0xbb10('0x19')](_0x19f48d);return _0x36b5e8[_0xbb10('0x20')](_0xbb10('0x21'),_0x575cca+'-'+_0xbf2906+'/'+_0x378da8)[_0xbb10('0x1b')](_0x2b184e);}return null;};}function patchUpdates(_0x4deb49){return function(_0x12f888){try{jsonpatch[_0xbb10('0x22')](_0x12f888,_0x4deb49,!![]);}catch(_0x50aea1){return BPromise['reject'](_0x50aea1);}return _0x12f888[_0xbb10('0x23')]();};}function saveUpdates(_0x311abe,_0x2e911d){return function(_0x317da4){if(_0x317da4){return _0x317da4[_0xbb10('0x24')](_0x311abe)[_0xbb10('0x25')](function(_0x407cb4){return _0x407cb4;});}return null;};}function removeEntity(_0x436104,_0x7f2377){return function(_0x395404){if(_0x395404){return _0x395404[_0xbb10('0x26')]()[_0xbb10('0x25')](function(){var _0x537898=_0x395404['get']({'plain':!![]});var _0x4fb5e0=_0xbb10('0x27');return db[_0xbb10('0x28')][_0xbb10('0x26')]({'where':{'type':_0x4fb5e0,'resourceId':_0x537898['id']}})['then'](function(){return _0x395404;});})[_0xbb10('0x25')](function(){_0x436104[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1d5e95,_0x1acce9){return function(_0x20d946){if(!_0x20d946){_0x1d5e95[_0xbb10('0x29')](0x194);}return _0x20d946;};}function handleError(_0x4aabb9,_0x3796c7){_0x3796c7=_0x3796c7||0x1f4;return function(_0x21ac54){logger[_0xbb10('0x2a')](_0x21ac54[_0xbb10('0x2b')]);if(_0x21ac54[_0xbb10('0x2c')]){delete _0x21ac54[_0xbb10('0x2c')];}_0x4aabb9['status'](_0x3796c7)[_0xbb10('0x2d')](_0x21ac54);};}exports['index']=function(_0x448d5c,_0x56f2da){var _0x16ad2a={},_0x1dcc9c={},_0x1b59f9={'count':0x0,'rows':[]};var _0x491db4=_['map'](db[_0xbb10('0x2e')][_0xbb10('0x2f')],function(_0x4f590d){return{'name':_0x4f590d[_0xbb10('0x30')],'type':_0x4f590d[_0xbb10('0x31')][_0xbb10('0x32')]};});_0x1dcc9c[_0xbb10('0x33')]=_[_0xbb10('0x34')](_0x491db4,_0xbb10('0x2c'));_0x1dcc9c[_0xbb10('0x35')]=_['keys'](_0x448d5c[_0xbb10('0x35')]);_0x1dcc9c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x1dcc9c[_0xbb10('0x33')],_0x1dcc9c[_0xbb10('0x35')]);_0x16ad2a[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x1dcc9c[_0xbb10('0x33')],qs[_0xbb10('0x39')](_0x448d5c['query'][_0xbb10('0x39')]));_0x16ad2a[_0xbb10('0x38')]=_0x16ad2a[_0xbb10('0x38')][_0xbb10('0x3a')]?_0x16ad2a['attributes']:_0x1dcc9c[_0xbb10('0x33')];if(!_0x448d5c['query']['hasOwnProperty'](_0xbb10('0x3b'))){_0x16ad2a[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x448d5c[_0xbb10('0x35')][_0xbb10('0x1e')]);_0x16ad2a[_0xbb10('0x1c')]=qs['offset'](_0x448d5c[_0xbb10('0x35')][_0xbb10('0x1c')]);}_0x16ad2a['order']=qs['sort'](_0x448d5c['query'][_0xbb10('0x3c')]);_0x16ad2a[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x448d5c[_0xbb10('0x35')],_0x1dcc9c[_0xbb10('0x36')]),_0x491db4);if(_0x448d5c[_0xbb10('0x35')]['filter']){_0x16ad2a[_0xbb10('0x3d')]=_[_0xbb10('0x3e')](_0x16ad2a[_0xbb10('0x3d')],{'$or':_[_0xbb10('0x34')](_0x491db4,function(_0x4f1cdd){if(_0x4f1cdd[_0xbb10('0x31')]!==_0xbb10('0x3f')){var _0x5835fd={};_0x5835fd[_0x4f1cdd[_0xbb10('0x2c')]]={'$like':'%'+_0x448d5c[_0xbb10('0x35')][_0xbb10('0x40')]+'%'};return _0x5835fd;}})});}_0x16ad2a=_[_0xbb10('0x3e')]({},_0x16ad2a,_0x448d5c[_0xbb10('0x41')]);var _0x185a52={'where':_0x16ad2a['where']};return db[_0xbb10('0x2e')][_0xbb10('0x1f')](_0x185a52)[_0xbb10('0x25')](function(_0x3d3c41){_0x1b59f9['count']=_0x3d3c41;if(_0x448d5c[_0xbb10('0x35')][_0xbb10('0x42')]){_0x16ad2a[_0xbb10('0x43')]=[{'all':!![]}];}return db[_0xbb10('0x2e')]['findAll'](_0x16ad2a);})[_0xbb10('0x25')](function(_0x202c60){_0x1b59f9['rows']=_0x202c60;return _0x1b59f9;})['then'](respondWithFilteredResult(_0x56f2da,_0x16ad2a))[_0xbb10('0x44')](handleError(_0x56f2da,null));};exports['show']=function(_0x318984,_0x180933){var _0x4c66d8={'raw':![],'where':{'id':_0x318984[_0xbb10('0x45')]['id']}},_0x366608={};_0x366608[_0xbb10('0x33')]=_['keys'](db[_0xbb10('0x2e')][_0xbb10('0x2f')]);_0x366608[_0xbb10('0x35')]=_[_0xbb10('0x46')](_0x318984[_0xbb10('0x35')]);_0x366608[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x366608[_0xbb10('0x33')],_0x366608[_0xbb10('0x35')]);_0x4c66d8[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x366608[_0xbb10('0x33')],qs['fields'](_0x318984[_0xbb10('0x35')][_0xbb10('0x39')]));_0x4c66d8['attributes']=_0x4c66d8[_0xbb10('0x38')][_0xbb10('0x3a')]?_0x4c66d8[_0xbb10('0x38')]:_0x366608[_0xbb10('0x33')];if(_0x318984[_0xbb10('0x35')][_0xbb10('0x42')]){_0x4c66d8[_0xbb10('0x43')]=[{'all':!![]}];}_0x4c66d8=_['merge']({},_0x4c66d8,_0x318984['options']);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x4c66d8)[_0xbb10('0x25')](handleEntityNotFound(_0x180933,null))['then'](respondWithResult(_0x180933,null))['catch'](handleError(_0x180933,null));};exports[_0xbb10('0x48')]=function(_0x34cf4e,_0x1bd054){return db[_0xbb10('0x2e')][_0xbb10('0x48')](_0x34cf4e[_0xbb10('0x49')],{})[_0xbb10('0x25')](function(_0x460788){var _0x2626d8=_0x34cf4e[_0xbb10('0x4a')]['get']({'plain':!![]});if(!_0x2626d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2626d8[_0xbb10('0x4b')]===_0xbb10('0x4a')){var _0x36ab7d=_0x460788[_0xbb10('0x4c')]({'plain':!![]});var _0x36aa7d=_0xbb10('0x4d');return db[_0xbb10('0x4e')][_0xbb10('0x47')]({'where':{'name':_0x36aa7d,'userProfileId':_0x2626d8[_0xbb10('0x4f')]},'raw':!![]})[_0xbb10('0x25')](function(_0x19ca3e){if(_0x19ca3e&&_0x19ca3e[_0xbb10('0x50')]===0x0){return db[_0xbb10('0x28')][_0xbb10('0x48')]({'name':_0x36ab7d[_0xbb10('0x2c')],'resourceId':_0x36ab7d['id'],'type':'CustomReports','sectionId':_0x19ca3e['id']},{})[_0xbb10('0x25')](function(){return _0x460788;});}else{return _0x460788;}})['catch'](function(_0x33d60a){logger[_0xbb10('0x2a')](_0xbb10('0x51'),_0x33d60a);throw _0x33d60a;});}return _0x460788;})[_0xbb10('0x25')](respondWithResult(_0x1bd054,0xc9))[_0xbb10('0x44')](handleError(_0x1bd054,null));};exports[_0xbb10('0x24')]=function(_0x2e3326,_0x44eec1){if(_0x2e3326[_0xbb10('0x49')]['id']){delete _0x2e3326[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2e')][_0xbb10('0x47')]({'where':{'id':_0x2e3326[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x44eec1,null))[_0xbb10('0x25')](saveUpdates(_0x2e3326['body'],null))[_0xbb10('0x25')](respondWithResult(_0x44eec1,null))[_0xbb10('0x44')](handleError(_0x44eec1,null));};exports[_0xbb10('0x26')]=function(_0x4ce8e7,_0xbffa3c){return db[_0xbb10('0x2e')]['find']({'where':{'id':_0x4ce8e7[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0xbffa3c,null))[_0xbb10('0x25')](removeEntity(_0xbffa3c,null))[_0xbb10('0x44')](handleError(_0xbffa3c,null));};exports[_0xbb10('0x52')]=function(_0x22de7f,_0x175872){var _0x12ec18=0xa;var _0x205e01=[_0xbb10('0x53'),_0xbb10('0x54'),_0xbb10('0x55'),_0xbb10('0x56')];var _0x4e7fac={'SUM':'SUM(%s)','COUNT':_0xbb10('0x57'),'COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbb10('0x5b'),'GROUP_CONCAT DESC':_0xbb10('0x5c')};var _0x410bef={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':_0xbb10('0x5f'),'ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x117e84=function(_0x216cff){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xbb10('0x61'),_0xbb10('0x62')],_0x216cff);};var _0x155dc5=function(_0x5bd1c0){if(!_0x5bd1c0||!_0x5bd1c0['rules']['length']){return'';}for(var _0x3ebc5f='(',_0x249b33=0x0;_0x249b33<_0x5bd1c0[_0xbb10('0x63')]['length'];_0x249b33+=0x1){_0x249b33>0x0&&(_0x3ebc5f+='\x20'+_0x5bd1c0[_0xbb10('0x64')]+'\x20');_0x3ebc5f+=_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['group']?_0x155dc5(_0x5bd1c0['rules'][_0x249b33][_0xbb10('0x65')]):_0x5bd1c0[_0xbb10('0x63')][_0x249b33][_0xbb10('0x66')]+'\x20'+_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['condition']+(_0x117e84(_0x5bd1c0[_0xbb10('0x63')][_0x249b33][_0xbb10('0x67')])?'\x20'+_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['value']:'');}return _0x3ebc5f+')';};var _0x402a01={'where':{'id':_0x22de7f[_0xbb10('0x45')]['id']}},_0x2f05bc,_0x3e3617,_0x5b2bd4,_0x2ca491,_0x31e85e;_0x402a01=_[_0xbb10('0x3e')]({},_0x402a01,_0x22de7f['options']);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x402a01)[_0xbb10('0x25')](function(_0x2d0f4b){if(_0x2d0f4b){_0x2f05bc=_0x2d0f4b;return _0x2d0f4b['getFields']();}return null;})[_0xbb10('0x25')](function(_0x277fe7){if(_0x277fe7){if(!_0x277fe7[_0xbb10('0x3a')]){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))](_0xbb10('0x6a'),0x193);}_0x3e3617=_0x277fe7;return db[_0xbb10('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5acd5e){if(_0x5acd5e){_0x5b2bd4=_[_0xbb10('0x6c')](_0x5acd5e,'id');var _0x9c672d;var _0x3eda96=squel['select']();_0x3eda96['from'](_0x2f05bc[_0xbb10('0x6d')]);for(var _0x1b11c0=0x0;_0x1b11c0<_0x3e3617[_0xbb10('0x3a')];_0x1b11c0+=0x1){_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x6e')]?_0x5b2bd4[_0x3e3617[_0x1b11c0][_0xbb10('0x6e')]][_0xbb10('0x6f')]:_0x3e3617[_0x1b11c0]['field'];_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x4e7fac[_0x3e3617[_0x1b11c0][_0xbb10('0x70')]],'%s',_0x9c672d):_0x9c672d;_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x72')]?_[_0xbb10('0x71')](_0x410bef[_0x3e3617[_0x1b11c0]['format']],'%s',_0x9c672d):_0x9c672d;if(_0x3e3617[_0x1b11c0]['groupBy']){_0x3eda96['group'](_0x9c672d);}_0x3e3617[_0x1b11c0][_0xbb10('0x73')]&&_0x3eda96[_0xbb10('0x74')](_0x9c672d,_0x3e3617[_0x1b11c0][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x3eda96[_0xbb10('0x66')](_0x9c672d,_0x3e3617[_0x1b11c0][_0xbb10('0x76')]||_0x9c672d);}if(_0x2f05bc['joins']){_0x2f05bc[_0xbb10('0x77')]=JSON['parse'](_0x2f05bc['joins']);for(var _0x519a54=0x0;_0x519a54<_0x2f05bc[_0xbb10('0x77')][_0xbb10('0x3a')];_0x519a54+=0x1){if(_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x31')]&&_['includes'](_0x205e01,_0x2f05bc[_0xbb10('0x77')][_0x519a54]['type'])&&_0x2f05bc['joins'][_0x519a54][_0xbb10('0x78')]&&_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')]&&_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x7a')]){_0x3eda96[_0x2f05bc['joins'][_0x519a54][_0xbb10('0x31')]](_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')],null,util[_0xbb10('0x72')](_0xbb10('0x7b'),_0x2f05bc[_0xbb10('0x6d')],_0x2f05bc[_0xbb10('0x77')][_0x519a54]['parentKey'],_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')],_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x7a')]));}}}if(_0x2f05bc[_0xbb10('0x7c')]){_0x2f05bc[_0xbb10('0x7c')]=JSON[_0xbb10('0x7d')](_0x2f05bc[_0xbb10('0x7c')]);_0x3eda96['where'](_0x155dc5(_0x2f05bc[_0xbb10('0x7c')][_0xbb10('0x65')]));}_0x31e85e=_0x3eda96[_0xbb10('0x7e')]();_0x3eda96['limit'](_0x12ec18);_0x3eda96['offset'](0x0);logger['debug'](_0xbb10('0x7f'),_0x3eda96['toString']());return dbH['sequelize'][_0xbb10('0x35')](_0x3eda96[_0xbb10('0x80')](),{'type':dbH[_0xbb10('0x81')][_0xbb10('0x82')][_0xbb10('0x83')]});}})[_0xbb10('0x25')](respondWithResult(_0x175872,null))[_0xbb10('0x44')](handleError(_0x175872,null));};function runReport(_0x417304,_0x188b97,_0x5206e1){var _0x318a14=_0x188b97[_0xbb10('0x2c')];var _0x46b6d2=0xa;var _0x35b811=['join','left_join',_0xbb10('0x55'),_0xbb10('0x56')];var _0x30f0a4={'SUM':_0xbb10('0x84'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':_0xbb10('0x85'),'GROUP_CONCAT':_0xbb10('0x86'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x372636={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':_0xbb10('0x87')};var _0x50bcc9=function(_0x5caa06){return!_[_0xbb10('0x88')]([_0xbb10('0x89'),_0xbb10('0x8a'),'IS\x20EMPTY',_0xbb10('0x62')],_0x5caa06);};var _0x3a17fc=function(_0xfbb365){if(!_0xfbb365||!_0xfbb365[_0xbb10('0x63')][_0xbb10('0x3a')]){return'';}for(var _0x5de006='(',_0x45bd4e=0x0;_0x45bd4e<_0xfbb365[_0xbb10('0x63')][_0xbb10('0x3a')];_0x45bd4e+=0x1){_0x45bd4e>0x0&&(_0x5de006+='\x20'+_0xfbb365['operator']+'\x20');_0x5de006+=_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x65')]?_0x3a17fc(_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x65')]):_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x66')]+'\x20'+_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x67')]+(_0x50bcc9(_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x67')])?'\x20'+_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x8b')]:'');}return _0x5de006+')';};var _0x59e985={'where':{'id':_0x417304['id']}},_0x51f106,_0xe1fc51,_0x3fa344,_0x458615,_0x3fd367;_0x59e985=_[_0xbb10('0x3e')]({},_0x59e985,_0x5206e1);return db['AnalyticCustomReport'][_0xbb10('0x47')](_0x59e985)[_0xbb10('0x25')](function(_0x3b4d0b){if(_0x3b4d0b){_0x51f106=_0x3b4d0b;return _0x3b4d0b[_0xbb10('0x8c')]();}return null;})[_0xbb10('0x25')](function(_0x379d49){if(_0x379d49){if(!_0x379d49['length']){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe1fc51=_0x379d49;return db[_0xbb10('0x6b')]['findAll']({'raw':!![]});}return null;})[_0xbb10('0x25')](function(_0x28bd76){if(_0x28bd76){_0x3fa344=_[_0xbb10('0x6c')](_0x28bd76,'id');var _0xa99bf5;var _0x3a4a6e=squel['select']();_0x3a4a6e[_0xbb10('0x8d')](_0x51f106['table']);for(var _0x3fcc55=0x0;_0x3fcc55<_0xe1fc51[_0xbb10('0x3a')];_0x3fcc55+=0x1){_0xa99bf5=_0xe1fc51[_0x3fcc55]['MetricId']?_0x3fa344[_0xe1fc51[_0x3fcc55]['MetricId']][_0xbb10('0x6f')]:_0xe1fc51[_0x3fcc55][_0xbb10('0x66')];_0xa99bf5=_0xe1fc51[_0x3fcc55][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x30f0a4[_0xe1fc51[_0x3fcc55][_0xbb10('0x70')]],'%s',_0xa99bf5):_0xa99bf5;_0xa99bf5=_0xe1fc51[_0x3fcc55][_0xbb10('0x72')]?_[_0xbb10('0x71')](_0x372636[_0xe1fc51[_0x3fcc55][_0xbb10('0x72')]],'%s',_0xa99bf5):_0xa99bf5;if(_0xe1fc51[_0x3fcc55][_0xbb10('0x8e')]){_0x3a4a6e[_0xbb10('0x65')](_0xa99bf5);}_0xe1fc51[_0x3fcc55][_0xbb10('0x73')]&&_0x3a4a6e['order'](_0xa99bf5,_0xe1fc51[_0x3fcc55][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x3a4a6e[_0xbb10('0x66')](_0xa99bf5,_0xe1fc51[_0x3fcc55][_0xbb10('0x76')]||_0xa99bf5);}if(_0x51f106[_0xbb10('0x77')]){_0x51f106[_0xbb10('0x77')]=JSON[_0xbb10('0x7d')](_0x51f106[_0xbb10('0x77')]);for(var _0x3e6fe2=0x0;_0x3e6fe2<_0x51f106[_0xbb10('0x77')][_0xbb10('0x3a')];_0x3e6fe2+=0x1){if(_0x51f106[_0xbb10('0x77')][_0x3e6fe2]['type']&&_[_0xbb10('0x88')](_0x35b811,_0x51f106['joins'][_0x3e6fe2][_0xbb10('0x31')])&&_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x78')]&&_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x79')]&&_0x51f106['joins'][_0x3e6fe2][_0xbb10('0x7a')]){_0x3a4a6e[_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x31')]](_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x79')],null,util[_0xbb10('0x72')]('%s.%s\x20=\x20%s.%s',_0x51f106['table'],_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x78')],_0x51f106[_0xbb10('0x77')][_0x3e6fe2]['foreignTable'],_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x7a')]));}}}if(_0x51f106['conditions']){_0x51f106[_0xbb10('0x7c')]=JSON[_0xbb10('0x7d')](_0x51f106['conditions']);_0x3a4a6e[_0xbb10('0x3d')](_0x3a17fc(_0x51f106['conditions'][_0xbb10('0x65')]));}_0x3fd367=_0x3a4a6e[_0xbb10('0x7e')]();_0x3a4a6e['limit'](_0x46b6d2);_0x3a4a6e[_0xbb10('0x1c')](0x0);return;}})[_0xbb10('0x25')](function(){if(_0x188b97['output']==='web'){return null;}var _0xea6bf2=_[_0xbb10('0x3e')](_0x188b97,{'name':_0x188b97[_0xbb10('0x8f')]||_0x188b97[_0xbb10('0x2c')]||_0x51f106[_0xbb10('0x2c')],'basename':_0x318a14,'savename':util['format'](_0xbb10('0x90'),_0x188b97[_0xbb10('0x2c')]||_0x51f106[_0xbb10('0x2c')],require('randomstring')[_0xbb10('0x91')](0x4),_0x188b97[_0xbb10('0x92')]||_0xbb10('0x93')),'reportId':_0x51f106['id'],'reportType':_0xbb10('0x94')});return db[_0xbb10('0x95')][_0xbb10('0x48')](_0xea6bf2,{'raw':!![]});})[_0xbb10('0x25')](function(_0x189f07){if(_0x51f106[_0xbb10('0x6d')]==='cdr'){_0x3fd367['where'](_0x51f106[_0xbb10('0x6d')]+_0xbb10('0x96'),_0x188b97[_0xbb10('0x97')],_0x188b97[_0xbb10('0x98')]);}else{_0x3fd367[_0xbb10('0x3d')](_0x51f106[_0xbb10('0x6d')]+_0xbb10('0x99'),_0x188b97[_0xbb10('0x97')],_0x188b97[_0xbb10('0x98')]);}if(_0x189f07){logger[_0xbb10('0x9a')](_0xbb10('0x9b'),_0x3fd367[_0xbb10('0x80')]());require(_0xbb10('0x9c'))['fork'](path[_0xbb10('0x53')](__dirname,_0xbb10('0x9d'),_0x189f07[_0xbb10('0x92')]),[_0x189f07['id'],_0x3fd367[_0xbb10('0x80')](),path[_0xbb10('0x53')](__dirname,_0xbb10('0x9e'),_0x189f07[_0xbb10('0x9f')]),_0x318a14]);return _0x189f07;}else{var _0x1421e2=squel[_0xbb10('0xa0')]();_0x1421e2[_0xbb10('0x8d')]('('+_0x3fd367[_0xbb10('0x80')]()+')','countTable');_0x1421e2[_0xbb10('0x66')]('COUNT(*)',_0xbb10('0x1f'));_0x3fd367[_0xbb10('0x1e')](_0x188b97[_0xbb10('0x1e')]||_0x46b6d2);_0x3fd367[_0xbb10('0x1c')](_0x188b97[_0xbb10('0x1c')]||0x0);return dbH[_0xbb10('0x81')]['query'](_0x1421e2[_0xbb10('0x80')](),{'type':dbH['sequelize'][_0xbb10('0x82')][_0xbb10('0x83')]})[_0xbb10('0x25')](function(_0x576bb6){if(!_0x576bb6[_0xbb10('0x3a')]){_0x458615=0x0;}else{_0x458615=_0x576bb6[0x0][_0xbb10('0x1f')]||0x0;}return dbH[_0xbb10('0x81')][_0xbb10('0x35')](_0x3fd367[_0xbb10('0x80')](),{'type':dbH[_0xbb10('0x81')][_0xbb10('0x82')][_0xbb10('0x83')]});})['then'](function(_0x3696b3){return{'rows':_0x3696b3||[],'count':_0x458615};});}});}exports['run']=function(_0xe70161,_0x36e9b0){return runReport(_0xe70161[_0xbb10('0x45')],_0xe70161[_0xbb10('0x35')],_0xe70161[_0xbb10('0x41')])[_0xbb10('0x25')](respondWithResult(_0x36e9b0,null))[_0xbb10('0x44')](handleError(_0x36e9b0,null));};exports['runReport']=runReport;exports[_0xbb10('0x35')]=function(_0x5ca9a0,_0x51063a){var _0x1513e0=0xa;var _0x35cbb9=[_0xbb10('0x53'),_0xbb10('0x54'),_0xbb10('0x55'),_0xbb10('0x56')];var _0x5d1077={'SUM':_0xbb10('0x84'),'COUNT':_0xbb10('0x57'),'COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':_0xbb10('0x85'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbb10('0x5b'),'GROUP_CONCAT DESC':_0xbb10('0x5c')};var _0xb7c454={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':_0xbb10('0x5f'),'ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x33a43e=function(_0x5e4ae9){return!_[_0xbb10('0x88')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xbb10('0x61'),_0xbb10('0x62')],_0x5e4ae9);};var _0x24edcb=function(_0x3b7552){if(!_0x3b7552||!_0x3b7552[_0xbb10('0x63')]['length']){return'';}for(var _0xa42b80='(',_0x565ddf=0x0;_0x565ddf<_0x3b7552['rules']['length'];_0x565ddf+=0x1){_0x565ddf>0x0&&(_0xa42b80+='\x20'+_0x3b7552[_0xbb10('0x64')]+'\x20');_0xa42b80+=_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x65')]?_0x24edcb(_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x65')]):_0x3b7552['rules'][_0x565ddf][_0xbb10('0x66')]+'\x20'+_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x67')]+(_0x33a43e(_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x67')])?'\x20'+_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x8b')]:'');}return _0xa42b80+')';};var _0x485c1a={'where':{'id':_0x5ca9a0[_0xbb10('0x45')]['id']}},_0x4c95c2,_0x584a62,_0x386eac,_0x1581ef,_0x2ae3c6;_0x485c1a=_[_0xbb10('0x3e')]({},_0x485c1a,_0x5ca9a0[_0xbb10('0x41')]);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x485c1a)[_0xbb10('0x25')](function(_0x3b1131){if(_0x3b1131){_0x4c95c2=_0x3b1131;return _0x3b1131['getFields']();}return null;})['then'](function(_0x4dce53){if(_0x4dce53){if(!_0x4dce53[_0xbb10('0x3a')]){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x584a62=_0x4dce53;return db[_0xbb10('0x6b')][_0xbb10('0xa1')]({'raw':!![]});}return null;})[_0xbb10('0x25')](function(_0x290280){if(_0x290280){_0x386eac=_[_0xbb10('0x6c')](_0x290280,'id');var _0x11279d;var _0x485f46=squel['select']();_0x485f46[_0xbb10('0x8d')](_0x4c95c2['table']);for(var _0x370215=0x0;_0x370215<_0x584a62[_0xbb10('0x3a')];_0x370215+=0x1){_0x11279d=_0x584a62[_0x370215][_0xbb10('0x6e')]?_0x386eac[_0x584a62[_0x370215][_0xbb10('0x6e')]][_0xbb10('0x6f')]:_0x584a62[_0x370215][_0xbb10('0x66')];_0x11279d=_0x584a62[_0x370215][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x5d1077[_0x584a62[_0x370215][_0xbb10('0x70')]],'%s',_0x11279d):_0x11279d;_0x11279d=_0x584a62[_0x370215][_0xbb10('0x72')]?_['replace'](_0xb7c454[_0x584a62[_0x370215][_0xbb10('0x72')]],'%s',_0x11279d):_0x11279d;if(_0x584a62[_0x370215]['groupBy']){_0x485f46[_0xbb10('0x65')](_0x11279d);}_0x584a62[_0x370215]['orderBy']&&_0x485f46[_0xbb10('0x74')](_0x11279d,_0x584a62[_0x370215][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x485f46[_0xbb10('0x66')](_0x11279d,_0x584a62[_0x370215]['alias']||_0x11279d);}if(_0x4c95c2[_0xbb10('0x77')]){_0x4c95c2['joins']=JSON[_0xbb10('0x7d')](_0x4c95c2[_0xbb10('0x77')]);for(var _0xcdaf04=0x0;_0xcdaf04<_0x4c95c2['joins'][_0xbb10('0x3a')];_0xcdaf04+=0x1){if(_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x31')]&&_[_0xbb10('0x88')](_0x35cbb9,_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x31')])&&_0x4c95c2['joins'][_0xcdaf04]['parentKey']&&_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x79')]&&_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x7a')]){_0x485f46[_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x31')]](_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x79')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4c95c2[_0xbb10('0x6d')],_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x78')],_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x79')],_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x7a')]));}}}if(_0x4c95c2['conditions']){_0x4c95c2['conditions']=JSON['parse'](_0x4c95c2[_0xbb10('0x7c')]);_0x485f46['where'](_0x24edcb(_0x4c95c2[_0xbb10('0x7c')][_0xbb10('0x65')]));}_0x2ae3c6=_0x485f46[_0xbb10('0x7e')]();_0x485f46[_0xbb10('0x1e')](_0x1513e0);_0x485f46[_0xbb10('0x1c')](0x0);logger[_0xbb10('0xa2')](_0xbb10('0x7f'),_0x485f46[_0xbb10('0x80')]());return dbH[_0xbb10('0x81')][_0xbb10('0x35')](_0x485f46[_0xbb10('0x80')](),{'type':dbH['sequelize'][_0xbb10('0x82')][_0xbb10('0x83')]});}})['then'](function(){return{'sql':_0x2ae3c6[_0xbb10('0x80')]()};})['then'](respondWithResult(_0x51063a,null))['catch'](handleError(_0x51063a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 910969a..8a44d0a 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 _0x3913=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','moment','path','./analyticCustomReport.attributes','exports','define'];(function(_0x3601e8,_0x26e6c6){var _0x39382a=function(_0x2abaff){while(--_0x2abaff){_0x3601e8['push'](_0x3601e8['shift']());}};_0x39382a(++_0x26e6c6);}(_0x3913,0x110));var _0x3391=function(_0x54b5c1,_0x272a6e){_0x54b5c1=_0x54b5c1-0x0;var _0x51936c=_0x3913[_0x54b5c1];return _0x51936c;};'use strict';var _=require(_0x3391('0x0'));var util=require('util');var logger=require(_0x3391('0x1'))('api');var moment=require(_0x3391('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3391('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3391('0x4'));module[_0x3391('0x5')]=function(_0x301cea,_0x51fe5e){return _0x301cea[_0x3391('0x6')](_0x3391('0x7'),attributes,{'tableName':_0x3391('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0348=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0xd64ea1,_0x5a40d9){var _0x11a857=function(_0x32b046){while(--_0x32b046){_0xd64ea1['push'](_0xd64ea1['shift']());}};_0x11a857(++_0x5a40d9);}(_0x0348,0x1ed));var _0x8034=function(_0xe3025,_0x686182){_0xe3025=_0xe3025-0x0;var _0x592d0b=_0x0348[_0xe3025];return _0x592d0b;};'use strict';var _=require(_0x8034('0x0'));var util=require(_0x8034('0x1'));var logger=require(_0x8034('0x2'))(_0x8034('0x3'));var moment=require(_0x8034('0x4'));var BPromise=require(_0x8034('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8034('0x6'));var attributes=require(_0x8034('0x7'));module[_0x8034('0x8')]=function(_0x4e6f0e,_0x297990){return _0x4e6f0e[_0x8034('0x9')](_0x8034('0xa'),attributes,{'tableName':_0x8034('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 481be16..0167128 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 _0x1e3c=['then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x21cefb,_0x12aa66){var _0x1a7dc6=function(_0xa69318){while(--_0xa69318){_0x21cefb['push'](_0x21cefb['shift']());}};_0x1a7dc6(++_0x12aa66);}(_0x1e3c,0x73));var _0xc1e3=function(_0x7e142c,_0x1f24bb){_0x7e142c=_0x7e142c-0x0;var _0x3e7610=_0x1e3c[_0x7e142c];return _0x3e7610;};'use strict';var _=require('lodash');var util=require(_0xc1e3('0x0'));var moment=require(_0xc1e3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1e3('0x2'));var db=require(_0xc1e3('0x3'))['db'];var utils=require(_0xc1e3('0x4'));var logger=require(_0xc1e3('0x5'))('rpc');var config=require(_0xc1e3('0x6'));var jayson=require(_0xc1e3('0x7'));var client=jayson[_0xc1e3('0x8')][_0xc1e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3ee1,_0x2e09e6,_0x1b2b25){return new BPromise(function(_0xb0f69a,_0xc361b1){return client[_0xc1e3('0xa')](_0x4c3ee1,_0x1b2b25)[_0xc1e3('0xb')](function(_0x55c98e){logger[_0xc1e3('0xc')](_0xc1e3('0xd'),_0x2e09e6,_0xc1e3('0xe'));logger[_0xc1e3('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2e09e6,_0xc1e3('0xe'),JSON[_0xc1e3('0x10')](_0x55c98e));if(_0x55c98e[_0xc1e3('0x11')]){if(_0x55c98e['error']['code']===0x1f4){logger['error'](_0xc1e3('0xd'),_0x2e09e6,_0x55c98e[_0xc1e3('0x11')][_0xc1e3('0x12')]);return _0xc361b1(_0x55c98e[_0xc1e3('0x11')][_0xc1e3('0x12')]);}logger['error'](_0xc1e3('0xd'),_0x2e09e6,_0x55c98e[_0xc1e3('0x11')]['message']);return _0xb0f69a(_0x55c98e[_0xc1e3('0x11')][_0xc1e3('0x12')]);}else{logger['info'](_0xc1e3('0xd'),_0x2e09e6,_0xc1e3('0xe'));_0xb0f69a(_0x55c98e[_0xc1e3('0x13')][_0xc1e3('0x12')]);}})[_0xc1e3('0x14')](function(_0x155c4d){logger['error'](_0xc1e3('0xd'),_0x2e09e6,_0x155c4d);_0xc361b1(_0x155c4d);});});} \ No newline at end of file +var _0x9896=['jayson/promise','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x41c3a7,_0x181c60){var _0x4869b4=function(_0x5bbef1){while(--_0x5bbef1){_0x41c3a7['push'](_0x41c3a7['shift']());}};_0x4869b4(++_0x181c60);}(_0x9896,0xaf));var _0x6989=function(_0x40eedb,_0x490ce4){_0x40eedb=_0x40eedb-0x0;var _0x84b950=_0x9896[_0x40eedb];return _0x84b950;};'use strict';var _=require(_0x6989('0x0'));var util=require(_0x6989('0x1'));var moment=require(_0x6989('0x2'));var BPromise=require(_0x6989('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6989('0x4'));var db=require(_0x6989('0x5'))['db'];var utils=require(_0x6989('0x6'));var logger=require(_0x6989('0x7'))(_0x6989('0x8'));var config=require('../../config/environment');var jayson=require(_0x6989('0x9'));var client=jayson[_0x6989('0xa')][_0x6989('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x380482,_0x259497,_0x57a078){return new BPromise(function(_0x540a68,_0x4fdf66){return client[_0x6989('0xc')](_0x380482,_0x57a078)['then'](function(_0x2eff04){logger['info'](_0x6989('0xd'),_0x259497,_0x6989('0xe'));logger[_0x6989('0xf')](_0x6989('0x10'),_0x259497,'request\x20sent',JSON[_0x6989('0x11')](_0x2eff04));if(_0x2eff04[_0x6989('0x12')]){if(_0x2eff04['error'][_0x6989('0x13')]===0x1f4){logger[_0x6989('0x12')](_0x6989('0xd'),_0x259497,_0x2eff04[_0x6989('0x12')][_0x6989('0x14')]);return _0x4fdf66(_0x2eff04[_0x6989('0x12')][_0x6989('0x14')]);}logger[_0x6989('0x12')](_0x6989('0xd'),_0x259497,_0x2eff04[_0x6989('0x12')][_0x6989('0x14')]);return _0x540a68(_0x2eff04[_0x6989('0x12')]['message']);}else{logger['info'](_0x6989('0xd'),_0x259497,_0x6989('0xe'));_0x540a68(_0x2eff04[_0x6989('0x15')]['message']);}})[_0x6989('0x16')](function(_0x456f85){logger[_0x6989('0x12')](_0x6989('0xd'),_0x259497,_0x456f85);_0x4fdf66(_0x456f85);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5e532f9..8720cdf 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 _0x0a39=['isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x0a39,0x176));var _0x90a3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0a39[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x90a3('0x0'));var util=require('util');var path=require(_0x90a3('0x1'));var timeout=require(_0x90a3('0x2'));var express=require('express');var router=express[_0x90a3('0x3')]();var fs_extra=require(_0x90a3('0x4'));var auth=require(_0x90a3('0x5'));var interaction=require(_0x90a3('0x6'));var config=require(_0x90a3('0x7'));var controller=require(_0x90a3('0x8'));router[_0x90a3('0x9')]('/',auth[_0x90a3('0xa')](),controller[_0x90a3('0xb')]);router[_0x90a3('0x9')](_0x90a3('0xc'),auth[_0x90a3('0xa')](),controller[_0x90a3('0xd')]);router['get'](_0x90a3('0xe'),auth[_0x90a3('0xa')](),controller[_0x90a3('0xf')]);router[_0x90a3('0x9')](_0x90a3('0x10'),auth['isAuthenticated'](),controller['run']);router[_0x90a3('0x9')](_0x90a3('0x11'),auth[_0x90a3('0xa')](),controller['query']);router['post']('/',auth[_0x90a3('0xa')](),controller[_0x90a3('0x12')]);router[_0x90a3('0x13')](_0x90a3('0xc'),auth[_0x90a3('0xa')](),controller[_0x90a3('0x14')]);router[_0x90a3('0x15')](_0x90a3('0xc'),auth[_0x90a3('0xa')](),controller[_0x90a3('0x16')]);module[_0x90a3('0x17')]=router; \ No newline at end of file +var _0x40d2=['get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','query','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x51741b,_0x4968d6){var _0xa566c=function(_0x51acfd){while(--_0x51acfd){_0x51741b['push'](_0x51741b['shift']());}};_0xa566c(++_0x4968d6);}(_0x40d2,0x17d));var _0x240d=function(_0x156d7c,_0x3a24c4){_0x156d7c=_0x156d7c-0x0;var _0x11f755=_0x40d2[_0x156d7c];return _0x11f755;};'use strict';var multer=require(_0x240d('0x0'));var util=require('util');var path=require(_0x240d('0x1'));var timeout=require(_0x240d('0x2'));var express=require(_0x240d('0x3'));var router=express[_0x240d('0x4')]();var fs_extra=require(_0x240d('0x5'));var auth=require(_0x240d('0x6'));var interaction=require(_0x240d('0x7'));var config=require(_0x240d('0x8'));var controller=require(_0x240d('0x9'));router[_0x240d('0xa')]('/',auth[_0x240d('0xb')](),controller[_0x240d('0xc')]);router[_0x240d('0xa')](_0x240d('0xd'),auth[_0x240d('0xb')](),controller[_0x240d('0xe')]);router['get'](_0x240d('0xf'),auth['isAuthenticated'](),controller['preview']);router[_0x240d('0xa')](_0x240d('0x10'),auth[_0x240d('0xb')](),controller['run']);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x240d('0x11')]);router[_0x240d('0x12')]('/',auth[_0x240d('0xb')](),controller[_0x240d('0x13')]);router[_0x240d('0x14')]('/:id',auth[_0x240d('0xb')](),controller[_0x240d('0x15')]);router['delete'](_0x240d('0xd'),auth[_0x240d('0xb')](),controller['destroy']);module[_0x240d('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 9e383b0..2021f96 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 _0x53e0=['STRING','TEXT','sequelize'];(function(_0x709af9,_0x13238f){var _0x594410=function(_0x3bcffd){while(--_0x3bcffd){_0x709af9['push'](_0x709af9['shift']());}};_0x594410(++_0x13238f);}(_0x53e0,0x1a0));var _0x053e=function(_0x317cc5,_0x3b6179){_0x317cc5=_0x317cc5-0x0;var _0x44fe81=_0x53e0[_0x317cc5];return _0x44fe81;};'use strict';var Sequelize=require(_0x053e('0x0'));module['exports']={'name':{'type':Sequelize[_0x053e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x053e('0x1')]},'parent':{'type':Sequelize[_0x053e('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x053e('0x2')]}}; \ No newline at end of file +var _0x5353=['TEXT','sequelize','STRING'];(function(_0x3cc7e2,_0x1bb39c){var _0x15a6b7=function(_0x420ca5){while(--_0x420ca5){_0x3cc7e2['push'](_0x3cc7e2['shift']());}};_0x15a6b7(++_0x1bb39c);}(_0x5353,0x1e1));var _0x3535=function(_0x330fa2,_0x591ee0){_0x330fa2=_0x330fa2-0x0;var _0xe73cb6=_0x5353[_0x330fa2];return _0xe73cb6;};'use strict';var Sequelize=require(_0x3535('0x0'));module['exports']={'name':{'type':Sequelize[_0x3535('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3535('0x1')]},'parent':{'type':Sequelize[_0x3535('0x1')]},'table':{'type':Sequelize[_0x3535('0x1')]},'conditions':{'type':Sequelize[_0x3535('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 35cf045..7b927fe 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 _0xbd7f=['SUM(%s)','COUNT(%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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','from','table','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','cross_join','COUNT(DISTINCT\x20%s)','includes','AnalyticMetric','groupBy','%s.%s\x20=\x20%s.%s','clone','fullPath','%s-%s.%s','randomstring','generate','output','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','SELECT','run','SEC_TO_TIME(%s)','operator','keyBy','DESC','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','DefaultReports','UserProfileResource','then','sendStatus','error','stack','name','send','map','AnalyticDefaultReport','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join'];(function(_0x3a5bd5,_0xd52a42){var _0x3d7e7f=function(_0x50603a){while(--_0x50603a){_0x3a5bd5['push'](_0x3a5bd5['shift']());}};_0x3d7e7f(++_0xd52a42);}(_0xbd7f,0x1a7));var _0xfbd7=function(_0x2041ba,_0x449294){_0x2041ba=_0x2041ba-0x0;var _0x169e20=_0xbd7f[_0x2041ba];return _0x169e20;};'use strict';var emlformat=require(_0xfbd7('0x0'));var rimraf=require(_0xfbd7('0x1'));var zipdir=require(_0xfbd7('0x2'));var jsonpatch=require(_0xfbd7('0x3'));var rp=require(_0xfbd7('0x4'));var moment=require(_0xfbd7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbd7('0x6'));var util=require(_0xfbd7('0x7'));var path=require(_0xfbd7('0x8'));var sox=require(_0xfbd7('0x9'));var csv=require(_0xfbd7('0xa'));var ejs=require(_0xfbd7('0xb'));var fs=require('fs');var fs_extra=require(_0xfbd7('0xc'));var _=require(_0xfbd7('0xd'));var squel=require(_0xfbd7('0xe'));var crypto=require(_0xfbd7('0xf'));var jsforce=require(_0xfbd7('0x10'));var deskjs=require(_0xfbd7('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfbd7('0x12'));var Redis=require(_0xfbd7('0x13'));var authService=require(_0xfbd7('0x14'));var qs=require(_0xfbd7('0x15'));var as=require(_0xfbd7('0x16'));var hardwareService=require(_0xfbd7('0x17'));var logger=require(_0xfbd7('0x18'))(_0xfbd7('0x19'));var utils=require(_0xfbd7('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfbd7('0x1b'))['db'];var dbH=require(_0xfbd7('0x1b'))[_0xfbd7('0x1c')];function respondWithStatusCode(_0x16486e,_0x3682fc){_0x3682fc=_0x3682fc||0xcc;return function(_0x57f73c){if(_0x57f73c){return _0x16486e['sendStatus'](_0x3682fc);}return _0x16486e[_0xfbd7('0x1d')](_0x3682fc)[_0xfbd7('0x1e')]();};}function respondWithResult(_0xc0e741,_0x327206){_0x327206=_0x327206||0xc8;return function(_0x2ec439){if(_0x2ec439){return _0xc0e741[_0xfbd7('0x1d')](_0x327206)[_0xfbd7('0x1f')](_0x2ec439);}};}function respondWithFilteredResult(_0x277c9f,_0x3e9941){return function(_0x222a60){if(_0x222a60){var _0x3fb1fe=typeof _0x3e9941[_0xfbd7('0x20')]===_0xfbd7('0x21')&&typeof _0x3e9941[_0xfbd7('0x22')]==='undefined';var _0x4926c2=_0x222a60[_0xfbd7('0x23')];var _0x21471f=_0x3fb1fe?0x0:_0x3e9941[_0xfbd7('0x20')];var _0x51052c=_0x3fb1fe?_0x222a60[_0xfbd7('0x23')]:_0x3e9941['offset']+_0x3e9941[_0xfbd7('0x22')];var _0x8d135f;if(_0x51052c>=_0x4926c2){_0x51052c=_0x4926c2;_0x8d135f=0xc8;}else{_0x8d135f=0xce;}_0x277c9f[_0xfbd7('0x1d')](_0x8d135f);return _0x277c9f[_0xfbd7('0x24')](_0xfbd7('0x25'),_0x21471f+'-'+_0x51052c+'/'+_0x4926c2)[_0xfbd7('0x1f')](_0x222a60);}return null;};}function patchUpdates(_0x54e6c6){return function(_0x4ca4c7){try{jsonpatch[_0xfbd7('0x26')](_0x4ca4c7,_0x54e6c6,!![]);}catch(_0x103d8b){return BPromise[_0xfbd7('0x27')](_0x103d8b);}return _0x4ca4c7[_0xfbd7('0x28')]();};}function saveUpdates(_0x4386b8,_0x4ff740){return function(_0x471804){if(_0x471804){return _0x471804[_0xfbd7('0x29')](_0x4386b8)['then'](function(_0x1f5e02){return _0x1f5e02;});}return null;};}function removeEntity(_0x33db45,_0x5418fa){return function(_0x5aafb0){if(_0x5aafb0){return _0x5aafb0[_0xfbd7('0x2a')]()['then'](function(){var _0x2d9e4b=_0x5aafb0[_0xfbd7('0x2b')]({'plain':!![]});var _0x479fdd=_0xfbd7('0x2c');return db[_0xfbd7('0x2d')][_0xfbd7('0x2a')]({'where':{'type':_0x479fdd,'resourceId':_0x2d9e4b['id']}})[_0xfbd7('0x2e')](function(){return _0x5aafb0;});})[_0xfbd7('0x2e')](function(){_0x33db45[_0xfbd7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17be58,_0x57e708){return function(_0x30471c){if(!_0x30471c){_0x17be58[_0xfbd7('0x2f')](0x194);}return _0x30471c;};}function handleError(_0x3210ab,_0x330d51){_0x330d51=_0x330d51||0x1f4;return function(_0x16fdb8){logger[_0xfbd7('0x30')](_0x16fdb8[_0xfbd7('0x31')]);if(_0x16fdb8[_0xfbd7('0x32')]){delete _0x16fdb8[_0xfbd7('0x32')];}_0x3210ab['status'](_0x330d51)[_0xfbd7('0x33')](_0x16fdb8);};}exports['index']=function(_0x4b4761,_0x4529dd){var _0x1f24c9={},_0x37aa67={},_0x1a00b3={'count':0x0,'rows':[]};var _0x4795b6=_[_0xfbd7('0x34')](db[_0xfbd7('0x35')]['rawAttributes'],function(_0x4ff3e3){return{'name':_0x4ff3e3[_0xfbd7('0x36')],'type':_0x4ff3e3['type'][_0xfbd7('0x37')]};});_0x37aa67[_0xfbd7('0x38')]=_['map'](_0x4795b6,_0xfbd7('0x32'));_0x37aa67[_0xfbd7('0x39')]=_[_0xfbd7('0x3a')](_0x4b4761[_0xfbd7('0x39')]);_0x37aa67[_0xfbd7('0x3b')]=_[_0xfbd7('0x3c')](_0x37aa67['model'],_0x37aa67[_0xfbd7('0x39')]);_0x1f24c9[_0xfbd7('0x3d')]=_[_0xfbd7('0x3c')](_0x37aa67['model'],qs['fields'](_0x4b4761[_0xfbd7('0x39')]['fields']));_0x1f24c9['attributes']=_0x1f24c9[_0xfbd7('0x3d')][_0xfbd7('0x3e')]?_0x1f24c9[_0xfbd7('0x3d')]:_0x37aa67['model'];if(!_0x4b4761[_0xfbd7('0x39')][_0xfbd7('0x3f')](_0xfbd7('0x40'))){_0x1f24c9[_0xfbd7('0x22')]=qs[_0xfbd7('0x22')](_0x4b4761[_0xfbd7('0x39')][_0xfbd7('0x22')]);_0x1f24c9[_0xfbd7('0x20')]=qs[_0xfbd7('0x20')](_0x4b4761['query']['offset']);}_0x1f24c9[_0xfbd7('0x41')]=qs[_0xfbd7('0x42')](_0x4b4761[_0xfbd7('0x39')][_0xfbd7('0x42')]);_0x1f24c9[_0xfbd7('0x43')]=qs[_0xfbd7('0x3b')](_[_0xfbd7('0x44')](_0x4b4761[_0xfbd7('0x39')],_0x37aa67['filters']),_0x4795b6);if(_0x4b4761[_0xfbd7('0x39')][_0xfbd7('0x45')]){_0x1f24c9[_0xfbd7('0x43')]=_['merge'](_0x1f24c9['where'],{'$or':_[_0xfbd7('0x34')](_0x4795b6,function(_0x2b39ac){if(_0x2b39ac[_0xfbd7('0x46')]!==_0xfbd7('0x47')){var _0xebb764={};_0xebb764[_0x2b39ac[_0xfbd7('0x32')]]={'$like':'%'+_0x4b4761[_0xfbd7('0x39')][_0xfbd7('0x45')]+'%'};return _0xebb764;}})});}_0x1f24c9=_[_0xfbd7('0x48')]({},_0x1f24c9,_0x4b4761[_0xfbd7('0x49')]);var _0x3c266e={'where':_0x1f24c9[_0xfbd7('0x43')]};return db[_0xfbd7('0x35')]['count'](_0x3c266e)[_0xfbd7('0x2e')](function(_0xb4104d){_0x1a00b3[_0xfbd7('0x23')]=_0xb4104d;if(_0x4b4761[_0xfbd7('0x39')][_0xfbd7('0x4a')]){_0x1f24c9['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xfbd7('0x4b')](_0x1f24c9);})[_0xfbd7('0x2e')](function(_0x429ba5){_0x1a00b3[_0xfbd7('0x4c')]=_0x429ba5;return _0x1a00b3;})[_0xfbd7('0x2e')](respondWithFilteredResult(_0x4529dd,_0x1f24c9))[_0xfbd7('0x4d')](handleError(_0x4529dd,null));};exports[_0xfbd7('0x4e')]=function(_0x37ddd6,_0x4db891){var _0x586615={'raw':!![],'where':{'id':_0x37ddd6[_0xfbd7('0x4f')]['id']}},_0x3143ec={};_0x3143ec[_0xfbd7('0x38')]=_[_0xfbd7('0x3a')](db[_0xfbd7('0x35')][_0xfbd7('0x50')]);_0x3143ec[_0xfbd7('0x39')]=_[_0xfbd7('0x3a')](_0x37ddd6[_0xfbd7('0x39')]);_0x3143ec[_0xfbd7('0x3b')]=_[_0xfbd7('0x3c')](_0x3143ec[_0xfbd7('0x38')],_0x3143ec['query']);_0x586615[_0xfbd7('0x3d')]=_[_0xfbd7('0x3c')](_0x3143ec[_0xfbd7('0x38')],qs['fields'](_0x37ddd6[_0xfbd7('0x39')]['fields']));_0x586615[_0xfbd7('0x3d')]=_0x586615[_0xfbd7('0x3d')][_0xfbd7('0x3e')]?_0x586615[_0xfbd7('0x3d')]:_0x3143ec['model'];if(_0x37ddd6[_0xfbd7('0x39')][_0xfbd7('0x4a')]){_0x586615[_0xfbd7('0x51')]=[{'all':!![]}];}_0x586615=_['merge']({},_0x586615,_0x37ddd6[_0xfbd7('0x49')]);return db[_0xfbd7('0x35')][_0xfbd7('0x52')](_0x586615)[_0xfbd7('0x2e')](handleEntityNotFound(_0x4db891,null))[_0xfbd7('0x2e')](respondWithResult(_0x4db891,null))[_0xfbd7('0x4d')](handleError(_0x4db891,null));};exports[_0xfbd7('0x53')]=function(_0x30b3e0,_0x18d574){return db[_0xfbd7('0x35')][_0xfbd7('0x53')](_0x30b3e0['body'],{})[_0xfbd7('0x2e')](function(_0x5a4197){var _0x2a120d=_0x30b3e0[_0xfbd7('0x54')][_0xfbd7('0x2b')]({'plain':!![]});if(!_0x2a120d)throw new Error(_0xfbd7('0x55'));if(_0x2a120d[_0xfbd7('0x56')]===_0xfbd7('0x54')){var _0x50739e=_0x5a4197[_0xfbd7('0x2b')]({'plain':!![]});var _0x21dbe7=_0xfbd7('0x57');return db[_0xfbd7('0x58')][_0xfbd7('0x52')]({'where':{'name':_0x21dbe7,'userProfileId':_0x2a120d[_0xfbd7('0x59')]},'raw':!![]})['then'](function(_0x52ad75){if(_0x52ad75&&_0x52ad75[_0xfbd7('0x5a')]===0x0){return db[_0xfbd7('0x2d')]['create']({'name':_0x50739e[_0xfbd7('0x32')],'resourceId':_0x50739e['id'],'type':_0xfbd7('0x2c'),'sectionId':_0x52ad75['id']},{})['then'](function(){return _0x5a4197;});}else{return _0x5a4197;}})[_0xfbd7('0x4d')](function(_0x2fb0d6){logger[_0xfbd7('0x30')](_0xfbd7('0x5b'),_0x2fb0d6);throw _0x2fb0d6;});}return _0x5a4197;})[_0xfbd7('0x2e')](respondWithResult(_0x18d574,0xc9))[_0xfbd7('0x4d')](handleError(_0x18d574,null));};exports[_0xfbd7('0x29')]=function(_0x3f9a3b,_0x2cbf42){if(_0x3f9a3b[_0xfbd7('0x5c')]['id']){delete _0x3f9a3b['body']['id'];}return db[_0xfbd7('0x35')][_0xfbd7('0x52')]({'where':{'id':_0x3f9a3b[_0xfbd7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2cbf42,null))[_0xfbd7('0x2e')](saveUpdates(_0x3f9a3b[_0xfbd7('0x5c')],null))['then'](respondWithResult(_0x2cbf42,null))[_0xfbd7('0x4d')](handleError(_0x2cbf42,null));};exports['destroy']=function(_0x53322d,_0x5ef480){return db[_0xfbd7('0x35')]['find']({'where':{'id':_0x53322d[_0xfbd7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5ef480,null))[_0xfbd7('0x2e')](removeEntity(_0x5ef480,null))[_0xfbd7('0x4d')](handleError(_0x5ef480,null));};exports['preview']=function(_0x2a6c77,_0x3d301b){var _0x9c473b=0xa;var _0x9e0cea=[_0xfbd7('0x5d'),_0xfbd7('0x5e'),_0xfbd7('0x5f'),'cross_join'];var _0x4f446c={'SUM':_0xfbd7('0x60'),'COUNT':_0xfbd7('0x61'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfbd7('0x62'),'MIN':_0xfbd7('0x63'),'AVG':_0xfbd7('0x64'),'GROUP_CONCAT':_0xfbd7('0x65'),'GROUP_CONCAT ASC':_0xfbd7('0x66'),'GROUP_CONCAT DESC':_0xfbd7('0x67')};var _0x3fd6c4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfbd7('0x68'),'HOUR':_0xfbd7('0x69'),'ROUND':_0xfbd7('0x6a'),'UNIX_TIMESTAMP':_0xfbd7('0x6b')};var _0x2e576f=function(_0x268faa){return!_['includes']([_0xfbd7('0x6c'),_0xfbd7('0x6d'),_0xfbd7('0x6e'),_0xfbd7('0x6f')],_0x268faa);};var _0x15ed60=function(_0x5f2be1){if(!_0x5f2be1||!_0x5f2be1[_0xfbd7('0x70')][_0xfbd7('0x3e')]){return'';}for(var _0xcec721='(',_0x5106fd=0x0;_0x5106fd<_0x5f2be1[_0xfbd7('0x70')]['length'];_0x5106fd+=0x1){_0x5106fd>0x0&&(_0xcec721+='\x20'+_0x5f2be1['operator']+'\x20');_0xcec721+=_0x5f2be1[_0xfbd7('0x70')][_0x5106fd][_0xfbd7('0x71')]?_0x15ed60(_0x5f2be1[_0xfbd7('0x70')][_0x5106fd][_0xfbd7('0x71')]):_0x5f2be1[_0xfbd7('0x70')][_0x5106fd][_0xfbd7('0x72')]+'\x20'+_0x5f2be1[_0xfbd7('0x70')][_0x5106fd][_0xfbd7('0x73')]+(_0x2e576f(_0x5f2be1[_0xfbd7('0x70')][_0x5106fd][_0xfbd7('0x73')])?'\x20'+_0x5f2be1[_0xfbd7('0x70')][_0x5106fd][_0xfbd7('0x74')]:'');}return _0xcec721+')';};var _0x4cabbc={'where':{'id':_0x2a6c77[_0xfbd7('0x4f')]['id']}},_0xccf496,_0x3a62b7,_0x11388d,_0xc9e1bb,_0x5b5175;_0x4cabbc=_['merge']({},_0x4cabbc,_0x2a6c77[_0xfbd7('0x49')]);return db[_0xfbd7('0x35')][_0xfbd7('0x52')](_0x4cabbc)['then'](function(_0x3fa8be){if(_0x3fa8be){_0xccf496=_0x3fa8be;return _0x3fa8be[_0xfbd7('0x75')]();}return null;})['then'](function(_0x1256ee){if(_0x1256ee){if(!_0x1256ee[_0xfbd7('0x3e')]){throw new db[(_0xfbd7('0x76'))][(_0xfbd7('0x77'))](_0xfbd7('0x78'),0x193);}_0x3a62b7=_0x1256ee;return db['AnalyticMetric'][_0xfbd7('0x4b')]({'raw':!![]});}return null;})[_0xfbd7('0x2e')](function(_0x316bc3){if(_0x316bc3){_0x11388d=_['keyBy'](_0x316bc3,'id');var _0x29c3b4;var _0x22cddb=squel[_0xfbd7('0x79')]();_0x22cddb[_0xfbd7('0x7a')](_0xccf496[_0xfbd7('0x7b')]);for(var _0x3cea8d=0x0;_0x3cea8d<_0x3a62b7[_0xfbd7('0x3e')];_0x3cea8d+=0x1){_0x29c3b4=_0x3a62b7[_0x3cea8d]['MetricId']?_0x11388d[_0x3a62b7[_0x3cea8d][_0xfbd7('0x7c')]][_0xfbd7('0x7d')]:_0x3a62b7[_0x3cea8d][_0xfbd7('0x72')];_0x29c3b4=_0x3a62b7[_0x3cea8d][_0xfbd7('0x7e')]?_['replace'](_0x4f446c[_0x3a62b7[_0x3cea8d]['function']],'%s',_0x29c3b4):_0x29c3b4;_0x29c3b4=_0x3a62b7[_0x3cea8d]['format']?_[_0xfbd7('0x7f')](_0x3fd6c4[_0x3a62b7[_0x3cea8d][_0xfbd7('0x80')]],'%s',_0x29c3b4):_0x29c3b4;if(_0x3a62b7[_0x3cea8d]['groupBy']){_0x22cddb[_0xfbd7('0x71')](_0x29c3b4);}_0x3a62b7[_0x3cea8d]['orderBy']&&_0x22cddb['order'](_0x29c3b4,_0x3a62b7[_0x3cea8d][_0xfbd7('0x81')]==='DESC'?![]:!![]);_0x22cddb[_0xfbd7('0x72')](_0x29c3b4,_0x3a62b7[_0x3cea8d][_0xfbd7('0x82')]||_0x29c3b4);}if(_0xccf496['joins']){_0xccf496[_0xfbd7('0x83')]=JSON[_0xfbd7('0x84')](_0xccf496[_0xfbd7('0x83')]);for(var _0x81290f=0x0;_0x81290f<_0xccf496[_0xfbd7('0x83')][_0xfbd7('0x3e')];_0x81290f+=0x1){if(_0xccf496[_0xfbd7('0x83')][_0x81290f]['type']&&_['includes'](_0x9e0cea,_0xccf496[_0xfbd7('0x83')][_0x81290f][_0xfbd7('0x46')])&&_0xccf496[_0xfbd7('0x83')][_0x81290f][_0xfbd7('0x85')]&&_0xccf496['joins'][_0x81290f][_0xfbd7('0x86')]&&_0xccf496[_0xfbd7('0x83')][_0x81290f][_0xfbd7('0x87')]){_0x22cddb[_0xccf496[_0xfbd7('0x83')][_0x81290f][_0xfbd7('0x46')]](_0xccf496['joins'][_0x81290f][_0xfbd7('0x86')],null,util[_0xfbd7('0x80')]('%s.%s\x20=\x20%s.%s',_0xccf496['table'],_0xccf496[_0xfbd7('0x83')][_0x81290f][_0xfbd7('0x85')],_0xccf496[_0xfbd7('0x83')][_0x81290f]['foreignTable'],_0xccf496['joins'][_0x81290f][_0xfbd7('0x87')]));}}}if(_0xccf496['conditions']){_0xccf496[_0xfbd7('0x88')]=JSON[_0xfbd7('0x84')](_0xccf496[_0xfbd7('0x88')]);_0x22cddb[_0xfbd7('0x43')](_0x15ed60(_0xccf496[_0xfbd7('0x88')]['group']));}_0x5b5175=_0x22cddb['clone']();_0x22cddb['limit'](_0x9c473b);_0x22cddb[_0xfbd7('0x20')](0x0);logger[_0xfbd7('0x89')](_0xfbd7('0x8a'),_0x22cddb[_0xfbd7('0x8b')]());return dbH[_0xfbd7('0x8c')]['query'](_0x22cddb['toString'](),{'type':dbH[_0xfbd7('0x8c')][_0xfbd7('0x8d')]['SELECT']});}})[_0xfbd7('0x2e')](respondWithResult(_0x3d301b,null))[_0xfbd7('0x4d')](handleError(_0x3d301b,null));};function runReport(_0x459dbb,_0x283e63,_0x36cbf8){var _0x29bdb3=_0x283e63[_0xfbd7('0x32')];var _0x2474e2=0xa;var _0x16cfff=[_0xfbd7('0x5d'),'left_join',_0xfbd7('0x5f'),_0xfbd7('0x8e')];var _0x251b66={'SUM':_0xfbd7('0x60'),'COUNT':_0xfbd7('0x61'),'COUNT DISTINCT':_0xfbd7('0x8f'),'MAX':'MAX(%s)','MIN':_0xfbd7('0x63'),'AVG':_0xfbd7('0x64'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xfbd7('0x66'),'GROUP_CONCAT DESC':_0xfbd7('0x67')};var _0x1cdaa0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xfbd7('0x69'),'ROUND':_0xfbd7('0x6a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x8c89f2=function(_0x51a086){return!_[_0xfbd7('0x90')]([_0xfbd7('0x6c'),_0xfbd7('0x6d'),_0xfbd7('0x6e'),_0xfbd7('0x6f')],_0x51a086);};var _0x343061=function(_0x2aca90){if(!_0x2aca90||!_0x2aca90[_0xfbd7('0x70')][_0xfbd7('0x3e')]){return'';}for(var _0x18c341='(',_0x1cf8bc=0x0;_0x1cf8bc<_0x2aca90['rules'][_0xfbd7('0x3e')];_0x1cf8bc+=0x1){_0x1cf8bc>0x0&&(_0x18c341+='\x20'+_0x2aca90['operator']+'\x20');_0x18c341+=_0x2aca90[_0xfbd7('0x70')][_0x1cf8bc][_0xfbd7('0x71')]?_0x343061(_0x2aca90[_0xfbd7('0x70')][_0x1cf8bc]['group']):_0x2aca90[_0xfbd7('0x70')][_0x1cf8bc][_0xfbd7('0x72')]+'\x20'+_0x2aca90[_0xfbd7('0x70')][_0x1cf8bc]['condition']+(_0x8c89f2(_0x2aca90[_0xfbd7('0x70')][_0x1cf8bc]['condition'])?'\x20'+_0x2aca90[_0xfbd7('0x70')][_0x1cf8bc][_0xfbd7('0x74')]:'');}return _0x18c341+')';};var _0x121d28={'where':{'id':_0x459dbb['id']}},_0x2c592e,_0x1edc0c,_0x19affe,_0xc6ba85,_0x4be463;_0x121d28=_['merge']({},_0x121d28,_0x36cbf8);return db['AnalyticDefaultReport'][_0xfbd7('0x52')](_0x121d28)['then'](function(_0x67b7f){if(_0x67b7f){_0x2c592e=_0x67b7f;return _0x67b7f[_0xfbd7('0x75')]();}return null;})[_0xfbd7('0x2e')](function(_0x20b3ae){if(_0x20b3ae){if(!_0x20b3ae[_0xfbd7('0x3e')]){throw new db['Sequelize'][(_0xfbd7('0x77'))](_0xfbd7('0x78'),0x193);}_0x1edc0c=_0x20b3ae;return db[_0xfbd7('0x91')][_0xfbd7('0x4b')]({'raw':!![]});}return null;})['then'](function(_0x58cac2){if(_0x58cac2){_0x19affe=_['keyBy'](_0x58cac2,'id');var _0x54897a;var _0x563a0f=squel['select']();_0x563a0f[_0xfbd7('0x7a')](_0x2c592e[_0xfbd7('0x7b')]);for(var _0x1e89e3=0x0;_0x1e89e3<_0x1edc0c['length'];_0x1e89e3+=0x1){_0x54897a=_0x1edc0c[_0x1e89e3][_0xfbd7('0x7c')]?_0x19affe[_0x1edc0c[_0x1e89e3][_0xfbd7('0x7c')]][_0xfbd7('0x7d')]:_0x1edc0c[_0x1e89e3][_0xfbd7('0x72')];_0x54897a=_0x1edc0c[_0x1e89e3][_0xfbd7('0x7e')]?_[_0xfbd7('0x7f')](_0x251b66[_0x1edc0c[_0x1e89e3]['function']],'%s',_0x54897a):_0x54897a;_0x54897a=_0x1edc0c[_0x1e89e3][_0xfbd7('0x80')]?_[_0xfbd7('0x7f')](_0x1cdaa0[_0x1edc0c[_0x1e89e3][_0xfbd7('0x80')]],'%s',_0x54897a):_0x54897a;if(_0x1edc0c[_0x1e89e3][_0xfbd7('0x92')]){_0x563a0f[_0xfbd7('0x71')](_0x54897a);}_0x1edc0c[_0x1e89e3]['orderBy']&&_0x563a0f[_0xfbd7('0x41')](_0x54897a,_0x1edc0c[_0x1e89e3][_0xfbd7('0x81')]==='DESC'?![]:!![]);_0x563a0f[_0xfbd7('0x72')](_0x54897a,_0x1edc0c[_0x1e89e3][_0xfbd7('0x82')]||_0x54897a);}if(_0x2c592e[_0xfbd7('0x83')]){_0x2c592e[_0xfbd7('0x83')]=JSON[_0xfbd7('0x84')](_0x2c592e[_0xfbd7('0x83')]);for(var _0x5260cb=0x0;_0x5260cb<_0x2c592e['joins']['length'];_0x5260cb+=0x1){if(_0x2c592e[_0xfbd7('0x83')][_0x5260cb][_0xfbd7('0x46')]&&_[_0xfbd7('0x90')](_0x16cfff,_0x2c592e[_0xfbd7('0x83')][_0x5260cb]['type'])&&_0x2c592e['joins'][_0x5260cb][_0xfbd7('0x85')]&&_0x2c592e[_0xfbd7('0x83')][_0x5260cb]['foreignTable']&&_0x2c592e[_0xfbd7('0x83')][_0x5260cb][_0xfbd7('0x87')]){_0x563a0f[_0x2c592e[_0xfbd7('0x83')][_0x5260cb]['type']](_0x2c592e['joins'][_0x5260cb][_0xfbd7('0x86')],null,util[_0xfbd7('0x80')](_0xfbd7('0x93'),_0x2c592e[_0xfbd7('0x7b')],_0x2c592e[_0xfbd7('0x83')][_0x5260cb][_0xfbd7('0x85')],_0x2c592e[_0xfbd7('0x83')][_0x5260cb][_0xfbd7('0x86')],_0x2c592e['joins'][_0x5260cb][_0xfbd7('0x87')]));}}}if(_0x2c592e[_0xfbd7('0x88')]){_0x2c592e['conditions']=JSON[_0xfbd7('0x84')](_0x2c592e[_0xfbd7('0x88')]);_0x563a0f[_0xfbd7('0x43')](_0x343061(_0x2c592e[_0xfbd7('0x88')][_0xfbd7('0x71')]));}_0x4be463=_0x563a0f[_0xfbd7('0x94')]();_0x563a0f[_0xfbd7('0x22')](_0x2474e2);_0x563a0f[_0xfbd7('0x20')](0x0);return;}})['then'](function(){if(_0x283e63['output']==='web'){return null;}var _0xf033b5=_[_0xfbd7('0x48')](_0x283e63,{'name':_0x283e63[_0xfbd7('0x95')]||_0x283e63['name']||_0x2c592e['name'],'basename':_0x29bdb3,'savename':util[_0xfbd7('0x80')](_0xfbd7('0x96'),_0x283e63['name']||_0x2c592e[_0xfbd7('0x32')],require(_0xfbd7('0x97'))[_0xfbd7('0x98')](0x4),_0x283e63[_0xfbd7('0x99')]||'csv'),'reportId':_0x2c592e['id'],'reportType':_0xfbd7('0x9a')});return db['AnalyticExtractedReport'][_0xfbd7('0x53')](_0xf033b5,{'raw':!![]});})[_0xfbd7('0x2e')](function(_0xf5394){if(_0x2c592e[_0xfbd7('0x7b')]===_0xfbd7('0x9b')){_0x4be463[_0xfbd7('0x43')](_0x2c592e[_0xfbd7('0x7b')]+_0xfbd7('0x9c'),_0x283e63['startDate'],_0x283e63[_0xfbd7('0x9d')]);}else{_0x4be463[_0xfbd7('0x43')](_0x2c592e[_0xfbd7('0x7b')]+_0xfbd7('0x9e'),_0x283e63[_0xfbd7('0x9f')],_0x283e63[_0xfbd7('0x9d')]);}if(_0xf5394){logger['info'](_0xfbd7('0xa0'),_0x4be463[_0xfbd7('0x8b')]());require(_0xfbd7('0xa1'))[_0xfbd7('0xa2')](path[_0xfbd7('0x5d')](__dirname,_0xfbd7('0xa3'),_0xf5394[_0xfbd7('0x99')]),[_0xf5394['id'],_0x4be463[_0xfbd7('0x8b')](),path[_0xfbd7('0x5d')](__dirname,'../../files/reports',_0xf5394[_0xfbd7('0xa4')]),_0x29bdb3]);return _0xf5394;}else{var _0x23f61d=squel[_0xfbd7('0x79')]();_0x23f61d[_0xfbd7('0x7a')]('('+_0x4be463[_0xfbd7('0x8b')]()+')',_0xfbd7('0xa5'));_0x23f61d[_0xfbd7('0x72')](_0xfbd7('0xa6'),_0xfbd7('0x23'));_0x4be463[_0xfbd7('0x22')](_0x283e63[_0xfbd7('0x22')]||_0x2474e2);_0x4be463[_0xfbd7('0x20')](_0x283e63['offset']||0x0);return dbH[_0xfbd7('0x8c')][_0xfbd7('0x39')](_0x23f61d[_0xfbd7('0x8b')](),{'type':dbH[_0xfbd7('0x8c')][_0xfbd7('0x8d')][_0xfbd7('0xa7')]})[_0xfbd7('0x2e')](function(_0x155a5c){if(!_0x155a5c[_0xfbd7('0x3e')]){_0xc6ba85=0x0;}else{_0xc6ba85=_0x155a5c[0x0]['count']||0x0;}return dbH[_0xfbd7('0x8c')][_0xfbd7('0x39')](_0x4be463[_0xfbd7('0x8b')](),{'type':dbH[_0xfbd7('0x8c')]['QueryTypes'][_0xfbd7('0xa7')]});})[_0xfbd7('0x2e')](function(_0x4d271b){return{'rows':_0x4d271b||[],'count':_0xc6ba85};});}});}exports[_0xfbd7('0xa8')]=function(_0x13b7c3,_0x4ae5ca){return runReport(_0x13b7c3[_0xfbd7('0x4f')],_0x13b7c3[_0xfbd7('0x39')],_0x13b7c3['options'])[_0xfbd7('0x2e')](respondWithResult(_0x4ae5ca,null))[_0xfbd7('0x4d')](handleError(_0x4ae5ca,null));};exports['runReport']=runReport;exports['query']=function(_0x52b29c,_0x36eb59){var _0x201946=0xa;var _0x3ba007=[_0xfbd7('0x5d'),_0xfbd7('0x5e'),_0xfbd7('0x5f'),_0xfbd7('0x8e')];var _0x1e97a4={'SUM':_0xfbd7('0x60'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfbd7('0x8f'),'MAX':_0xfbd7('0x62'),'MIN':'MIN(%s)','AVG':_0xfbd7('0x64'),'GROUP_CONCAT':_0xfbd7('0x65'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xfbd7('0x67')};var _0x2363d2={'SEC_TO_TIME':_0xfbd7('0xa9'),'DATE':_0xfbd7('0x68'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4cffaf=function(_0x2d830c){return!_['includes']([_0xfbd7('0x6c'),_0xfbd7('0x6d'),_0xfbd7('0x6e'),'IS\x20NOT\x20EMPTY'],_0x2d830c);};var _0x5958be=function(_0x44d264){if(!_0x44d264||!_0x44d264['rules'][_0xfbd7('0x3e')]){return'';}for(var _0x416d86='(',_0x652ee6=0x0;_0x652ee6<_0x44d264[_0xfbd7('0x70')][_0xfbd7('0x3e')];_0x652ee6+=0x1){_0x652ee6>0x0&&(_0x416d86+='\x20'+_0x44d264[_0xfbd7('0xaa')]+'\x20');_0x416d86+=_0x44d264[_0xfbd7('0x70')][_0x652ee6][_0xfbd7('0x71')]?_0x5958be(_0x44d264[_0xfbd7('0x70')][_0x652ee6]['group']):_0x44d264[_0xfbd7('0x70')][_0x652ee6][_0xfbd7('0x72')]+'\x20'+_0x44d264[_0xfbd7('0x70')][_0x652ee6][_0xfbd7('0x73')]+(_0x4cffaf(_0x44d264[_0xfbd7('0x70')][_0x652ee6][_0xfbd7('0x73')])?'\x20'+_0x44d264[_0xfbd7('0x70')][_0x652ee6][_0xfbd7('0x74')]:'');}return _0x416d86+')';};var _0x1e334f={'where':{'id':_0x52b29c[_0xfbd7('0x4f')]['id']}},_0x506c3e,_0x28db38,_0x345ea5,_0x2b717c,_0x338de4;_0x1e334f=_[_0xfbd7('0x48')]({},_0x1e334f,_0x52b29c[_0xfbd7('0x49')]);return db['AnalyticDefaultReport']['find'](_0x1e334f)[_0xfbd7('0x2e')](function(_0x28d0b3){if(_0x28d0b3){_0x506c3e=_0x28d0b3;return _0x28d0b3[_0xfbd7('0x75')]();}return null;})[_0xfbd7('0x2e')](function(_0x222e9c){if(_0x222e9c){if(!_0x222e9c[_0xfbd7('0x3e')]){throw new db[(_0xfbd7('0x76'))]['ValidationErrorItem'](_0xfbd7('0x78'),0x193);}_0x28db38=_0x222e9c;return db[_0xfbd7('0x91')][_0xfbd7('0x4b')]({'raw':!![]});}return null;})[_0xfbd7('0x2e')](function(_0x1bb907){if(_0x1bb907){_0x345ea5=_[_0xfbd7('0xab')](_0x1bb907,'id');var _0x21d603;var _0x1167d5=squel[_0xfbd7('0x79')]();_0x1167d5[_0xfbd7('0x7a')](_0x506c3e['table']);for(var _0x19ffe9=0x0;_0x19ffe9<_0x28db38['length'];_0x19ffe9+=0x1){_0x21d603=_0x28db38[_0x19ffe9][_0xfbd7('0x7c')]?_0x345ea5[_0x28db38[_0x19ffe9][_0xfbd7('0x7c')]]['metric']:_0x28db38[_0x19ffe9][_0xfbd7('0x72')];_0x21d603=_0x28db38[_0x19ffe9][_0xfbd7('0x7e')]?_[_0xfbd7('0x7f')](_0x1e97a4[_0x28db38[_0x19ffe9][_0xfbd7('0x7e')]],'%s',_0x21d603):_0x21d603;_0x21d603=_0x28db38[_0x19ffe9][_0xfbd7('0x80')]?_[_0xfbd7('0x7f')](_0x2363d2[_0x28db38[_0x19ffe9][_0xfbd7('0x80')]],'%s',_0x21d603):_0x21d603;if(_0x28db38[_0x19ffe9][_0xfbd7('0x92')]){_0x1167d5[_0xfbd7('0x71')](_0x21d603);}_0x28db38[_0x19ffe9][_0xfbd7('0x81')]&&_0x1167d5[_0xfbd7('0x41')](_0x21d603,_0x28db38[_0x19ffe9][_0xfbd7('0x81')]===_0xfbd7('0xac')?![]:!![]);_0x1167d5[_0xfbd7('0x72')](_0x21d603,_0x28db38[_0x19ffe9][_0xfbd7('0x82')]||_0x21d603);}if(_0x506c3e['joins']){_0x506c3e[_0xfbd7('0x83')]=JSON[_0xfbd7('0x84')](_0x506c3e[_0xfbd7('0x83')]);for(var _0xe64b9f=0x0;_0xe64b9f<_0x506c3e[_0xfbd7('0x83')][_0xfbd7('0x3e')];_0xe64b9f+=0x1){if(_0x506c3e[_0xfbd7('0x83')][_0xe64b9f]['type']&&_[_0xfbd7('0x90')](_0x3ba007,_0x506c3e[_0xfbd7('0x83')][_0xe64b9f][_0xfbd7('0x46')])&&_0x506c3e[_0xfbd7('0x83')][_0xe64b9f][_0xfbd7('0x85')]&&_0x506c3e['joins'][_0xe64b9f][_0xfbd7('0x86')]&&_0x506c3e[_0xfbd7('0x83')][_0xe64b9f][_0xfbd7('0x87')]){_0x1167d5[_0x506c3e[_0xfbd7('0x83')][_0xe64b9f][_0xfbd7('0x46')]](_0x506c3e[_0xfbd7('0x83')][_0xe64b9f][_0xfbd7('0x86')],null,util[_0xfbd7('0x80')](_0xfbd7('0x93'),_0x506c3e['table'],_0x506c3e[_0xfbd7('0x83')][_0xe64b9f][_0xfbd7('0x85')],_0x506c3e[_0xfbd7('0x83')][_0xe64b9f][_0xfbd7('0x86')],_0x506c3e['joins'][_0xe64b9f][_0xfbd7('0x87')]));}}}if(_0x506c3e['conditions']){_0x506c3e[_0xfbd7('0x88')]=JSON[_0xfbd7('0x84')](_0x506c3e[_0xfbd7('0x88')]);_0x1167d5[_0xfbd7('0x43')](_0x5958be(_0x506c3e[_0xfbd7('0x88')][_0xfbd7('0x71')]));}_0x338de4=_0x1167d5[_0xfbd7('0x94')]();_0x1167d5[_0xfbd7('0x22')](_0x201946);_0x1167d5['offset'](0x0);logger[_0xfbd7('0x89')](_0xfbd7('0x8a'),_0x1167d5['toString']());return dbH['sequelize']['query'](_0x1167d5['toString'](),{'type':dbH[_0xfbd7('0x8c')]['QueryTypes'][_0xfbd7('0xa7')]});}})[_0xfbd7('0x2e')](function(){return{'sql':_0x338de4[_0xfbd7('0x8b')]()};})[_0xfbd7('0x2e')](respondWithResult(_0x36eb59,null))['catch'](handleError(_0x36eb59,null));}; \ No newline at end of file +var _0x86d8=['AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','AVG(%s)','metric','eml-format','rimraf','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','DefaultReports','UserProfileResource','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','AnalyticDefaultReport','findAll','catch','show','rawAttributes','options','find','create','body','user','Reports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','select','table','MetricId','function','format','groupBy','orderBy','DESC','field','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','IS\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','replace','alias','foreignKey','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','default'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x86d8,0xb8));var _0x886d=function(_0x126c0d,_0x1644a5){_0x126c0d=_0x126c0d-0x0;var _0x299c58=_0x86d8[_0x126c0d];return _0x299c58;};'use strict';var emlformat=require(_0x886d('0x0'));var rimraf=require(_0x886d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x886d('0x2'));var BPromise=require(_0x886d('0x3'));var Mustache=require('mustache');var util=require(_0x886d('0x4'));var path=require('path');var sox=require(_0x886d('0x5'));var csv=require(_0x886d('0x6'));var ejs=require(_0x886d('0x7'));var fs=require('fs');var fs_extra=require(_0x886d('0x8'));var _=require(_0x886d('0x9'));var squel=require('squel');var crypto=require(_0x886d('0xa'));var jsforce=require(_0x886d('0xb'));var deskjs=require(_0x886d('0xc'));var toCsv=require(_0x886d('0x6'));var querystring=require(_0x886d('0xd'));var Papa=require(_0x886d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x886d('0xf'));var as=require(_0x886d('0x10'));var hardwareService=require(_0x886d('0x11'));var logger=require(_0x886d('0x12'))('api');var utils=require(_0x886d('0x13'));var config=require(_0x886d('0x14'));var licenseUtil=require(_0x886d('0x15'));var db=require(_0x886d('0x16'))['db'];var dbH=require(_0x886d('0x16'))['dbH'];function respondWithStatusCode(_0x256dd3,_0x3792fb){_0x3792fb=_0x3792fb||0xcc;return function(_0xe2c474){if(_0xe2c474){return _0x256dd3[_0x886d('0x17')](_0x3792fb);}return _0x256dd3[_0x886d('0x18')](_0x3792fb)['end']();};}function respondWithResult(_0x27be85,_0x34a8ee){_0x34a8ee=_0x34a8ee||0xc8;return function(_0x57447f){if(_0x57447f){return _0x27be85[_0x886d('0x18')](_0x34a8ee)['json'](_0x57447f);}};}function respondWithFilteredResult(_0x5d5601,_0x5e590e){return function(_0x39d857){if(_0x39d857){var _0x2a2380=typeof _0x5e590e['offset']===_0x886d('0x19')&&typeof _0x5e590e[_0x886d('0x1a')]===_0x886d('0x19');var _0x4be275=_0x39d857[_0x886d('0x1b')];var _0x40fa6d=_0x2a2380?0x0:_0x5e590e['offset'];var _0x422207=_0x2a2380?_0x39d857[_0x886d('0x1b')]:_0x5e590e['offset']+_0x5e590e[_0x886d('0x1a')];var _0xef89ef;if(_0x422207>=_0x4be275){_0x422207=_0x4be275;_0xef89ef=0xc8;}else{_0xef89ef=0xce;}_0x5d5601[_0x886d('0x18')](_0xef89ef);return _0x5d5601[_0x886d('0x1c')](_0x886d('0x1d'),_0x40fa6d+'-'+_0x422207+'/'+_0x4be275)[_0x886d('0x1e')](_0x39d857);}return null;};}function patchUpdates(_0x1acee9){return function(_0x307e10){try{jsonpatch[_0x886d('0x1f')](_0x307e10,_0x1acee9,!![]);}catch(_0x508383){return BPromise[_0x886d('0x20')](_0x508383);}return _0x307e10[_0x886d('0x21')]();};}function saveUpdates(_0x2d10e3,_0x49a34b){return function(_0x27a9cc){if(_0x27a9cc){return _0x27a9cc[_0x886d('0x22')](_0x2d10e3)['then'](function(_0x31b433){return _0x31b433;});}return null;};}function removeEntity(_0x2824fb,_0x3c8d6f){return function(_0x311a34){if(_0x311a34){return _0x311a34[_0x886d('0x23')]()['then'](function(){var _0x4359bb=_0x311a34[_0x886d('0x24')]({'plain':!![]});var _0x8942df=_0x886d('0x25');return db[_0x886d('0x26')][_0x886d('0x23')]({'where':{'type':_0x8942df,'resourceId':_0x4359bb['id']}})[_0x886d('0x27')](function(){return _0x311a34;});})['then'](function(){_0x2824fb[_0x886d('0x18')](0xcc)[_0x886d('0x28')]();});}};}function handleEntityNotFound(_0x6eee28,_0xc65bb4){return function(_0x320596){if(!_0x320596){_0x6eee28[_0x886d('0x17')](0x194);}return _0x320596;};}function handleError(_0x5ef38d,_0x8cd3cc){_0x8cd3cc=_0x8cd3cc||0x1f4;return function(_0x1756cf){logger[_0x886d('0x29')](_0x1756cf[_0x886d('0x2a')]);if(_0x1756cf[_0x886d('0x2b')]){delete _0x1756cf['name'];}_0x5ef38d[_0x886d('0x18')](_0x8cd3cc)[_0x886d('0x2c')](_0x1756cf);};}exports[_0x886d('0x2d')]=function(_0x2682d7,_0x2b5cf3){var _0x2ece66={},_0x4161da={},_0x5d1620={'count':0x0,'rows':[]};var _0x54fb76=_[_0x886d('0x2e')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x331f74){return{'name':_0x331f74[_0x886d('0x2f')],'type':_0x331f74[_0x886d('0x30')][_0x886d('0x31')]};});_0x4161da[_0x886d('0x32')]=_[_0x886d('0x2e')](_0x54fb76,_0x886d('0x2b'));_0x4161da[_0x886d('0x33')]=_[_0x886d('0x34')](_0x2682d7['query']);_0x4161da[_0x886d('0x35')]=_['intersection'](_0x4161da['model'],_0x4161da[_0x886d('0x33')]);_0x2ece66[_0x886d('0x36')]=_[_0x886d('0x37')](_0x4161da[_0x886d('0x32')],qs[_0x886d('0x38')](_0x2682d7['query']['fields']));_0x2ece66[_0x886d('0x36')]=_0x2ece66[_0x886d('0x36')][_0x886d('0x39')]?_0x2ece66[_0x886d('0x36')]:_0x4161da[_0x886d('0x32')];if(!_0x2682d7[_0x886d('0x33')][_0x886d('0x3a')](_0x886d('0x3b'))){_0x2ece66[_0x886d('0x1a')]=qs[_0x886d('0x1a')](_0x2682d7[_0x886d('0x33')][_0x886d('0x1a')]);_0x2ece66[_0x886d('0x3c')]=qs['offset'](_0x2682d7[_0x886d('0x33')][_0x886d('0x3c')]);}_0x2ece66[_0x886d('0x3d')]=qs[_0x886d('0x3e')](_0x2682d7[_0x886d('0x33')]['sort']);_0x2ece66[_0x886d('0x3f')]=qs[_0x886d('0x35')](_[_0x886d('0x40')](_0x2682d7[_0x886d('0x33')],_0x4161da[_0x886d('0x35')]),_0x54fb76);if(_0x2682d7[_0x886d('0x33')][_0x886d('0x41')]){_0x2ece66[_0x886d('0x3f')]=_[_0x886d('0x42')](_0x2ece66[_0x886d('0x3f')],{'$or':_['map'](_0x54fb76,function(_0x1f75ee){if(_0x1f75ee[_0x886d('0x30')]!==_0x886d('0x43')){var _0x273be9={};_0x273be9[_0x1f75ee['name']]={'$like':'%'+_0x2682d7[_0x886d('0x33')][_0x886d('0x41')]+'%'};return _0x273be9;}})});}_0x2ece66=_[_0x886d('0x42')]({},_0x2ece66,_0x2682d7['options']);var _0x21e7e6={'where':_0x2ece66[_0x886d('0x3f')]};return db['AnalyticDefaultReport'][_0x886d('0x1b')](_0x21e7e6)['then'](function(_0x10ac69){_0x5d1620[_0x886d('0x1b')]=_0x10ac69;if(_0x2682d7['query'][_0x886d('0x44')]){_0x2ece66[_0x886d('0x45')]=[{'all':!![]}];}return db[_0x886d('0x46')][_0x886d('0x47')](_0x2ece66);})['then'](function(_0x2438a3){_0x5d1620['rows']=_0x2438a3;return _0x5d1620;})[_0x886d('0x27')](respondWithFilteredResult(_0x2b5cf3,_0x2ece66))[_0x886d('0x48')](handleError(_0x2b5cf3,null));};exports[_0x886d('0x49')]=function(_0x46fb73,_0x3b88aa){var _0x4292c7={'raw':!![],'where':{'id':_0x46fb73['params']['id']}},_0x3545bc={};_0x3545bc[_0x886d('0x32')]=_[_0x886d('0x34')](db[_0x886d('0x46')][_0x886d('0x4a')]);_0x3545bc[_0x886d('0x33')]=_[_0x886d('0x34')](_0x46fb73[_0x886d('0x33')]);_0x3545bc[_0x886d('0x35')]=_['intersection'](_0x3545bc[_0x886d('0x32')],_0x3545bc[_0x886d('0x33')]);_0x4292c7[_0x886d('0x36')]=_[_0x886d('0x37')](_0x3545bc['model'],qs['fields'](_0x46fb73[_0x886d('0x33')]['fields']));_0x4292c7['attributes']=_0x4292c7['attributes']['length']?_0x4292c7[_0x886d('0x36')]:_0x3545bc['model'];if(_0x46fb73[_0x886d('0x33')][_0x886d('0x44')]){_0x4292c7[_0x886d('0x45')]=[{'all':!![]}];}_0x4292c7=_[_0x886d('0x42')]({},_0x4292c7,_0x46fb73[_0x886d('0x4b')]);return db[_0x886d('0x46')][_0x886d('0x4c')](_0x4292c7)[_0x886d('0x27')](handleEntityNotFound(_0x3b88aa,null))[_0x886d('0x27')](respondWithResult(_0x3b88aa,null))[_0x886d('0x48')](handleError(_0x3b88aa,null));};exports['create']=function(_0x210c5c,_0x4b4471){return db[_0x886d('0x46')][_0x886d('0x4d')](_0x210c5c[_0x886d('0x4e')],{})[_0x886d('0x27')](function(_0x5c9000){var _0x209bc5=_0x210c5c[_0x886d('0x4f')][_0x886d('0x24')]({'plain':!![]});if(!_0x209bc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x209bc5['role']===_0x886d('0x4f')){var _0x14e8da=_0x5c9000[_0x886d('0x24')]({'plain':!![]});var _0x45d7f5=_0x886d('0x50');return db[_0x886d('0x51')][_0x886d('0x4c')]({'where':{'name':_0x45d7f5,'userProfileId':_0x209bc5['userProfileId']},'raw':!![]})['then'](function(_0x5b5309){if(_0x5b5309&&_0x5b5309['autoAssociation']===0x0){return db[_0x886d('0x26')][_0x886d('0x4d')]({'name':_0x14e8da['name'],'resourceId':_0x14e8da['id'],'type':_0x886d('0x25'),'sectionId':_0x5b5309['id']},{})[_0x886d('0x27')](function(){return _0x5c9000;});}else{return _0x5c9000;}})[_0x886d('0x48')](function(_0x1625c1){logger[_0x886d('0x29')](_0x886d('0x52'),_0x1625c1);throw _0x1625c1;});}return _0x5c9000;})[_0x886d('0x27')](respondWithResult(_0x4b4471,0xc9))[_0x886d('0x48')](handleError(_0x4b4471,null));};exports[_0x886d('0x22')]=function(_0x38dcc6,_0x1f8f2d){if(_0x38dcc6[_0x886d('0x4e')]['id']){delete _0x38dcc6[_0x886d('0x4e')]['id'];}return db[_0x886d('0x46')][_0x886d('0x4c')]({'where':{'id':_0x38dcc6[_0x886d('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f8f2d,null))[_0x886d('0x27')](saveUpdates(_0x38dcc6[_0x886d('0x4e')],null))['then'](respondWithResult(_0x1f8f2d,null))[_0x886d('0x48')](handleError(_0x1f8f2d,null));};exports['destroy']=function(_0x4b2073,_0x121c0c){return db[_0x886d('0x46')][_0x886d('0x4c')]({'where':{'id':_0x4b2073[_0x886d('0x53')]['id']}})[_0x886d('0x27')](handleEntityNotFound(_0x121c0c,null))[_0x886d('0x27')](removeEntity(_0x121c0c,null))[_0x886d('0x48')](handleError(_0x121c0c,null));};exports[_0x886d('0x54')]=function(_0x56580c,_0x59a06d){var _0x1591ee=0xa;var _0x41bf33=['join',_0x886d('0x55'),_0x886d('0x56'),_0x886d('0x57')];var _0x435c57={'SUM':_0x886d('0x58'),'COUNT':_0x886d('0x59'),'COUNT DISTINCT':_0x886d('0x5a'),'MAX':_0x886d('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x886d('0x5c'),'GROUP_CONCAT ASC':_0x886d('0x5d'),'GROUP_CONCAT DESC':_0x886d('0x5e')};var _0x33a86c={'SEC_TO_TIME':_0x886d('0x5f'),'DATE':_0x886d('0x60'),'HOUR':_0x886d('0x61'),'ROUND':_0x886d('0x62'),'UNIX_TIMESTAMP':_0x886d('0x63')};var _0x2ce82e=function(_0x11e847){return!_[_0x886d('0x64')](['IS\x20NULL',_0x886d('0x65'),_0x886d('0x66'),'IS\x20NOT\x20EMPTY'],_0x11e847);};var _0x1453e8=function(_0x42f455){if(!_0x42f455||!_0x42f455[_0x886d('0x67')][_0x886d('0x39')]){return'';}for(var _0x41fdd4='(',_0x399354=0x0;_0x399354<_0x42f455['rules'][_0x886d('0x39')];_0x399354+=0x1){_0x399354>0x0&&(_0x41fdd4+='\x20'+_0x42f455['operator']+'\x20');_0x41fdd4+=_0x42f455[_0x886d('0x67')][_0x399354][_0x886d('0x68')]?_0x1453e8(_0x42f455['rules'][_0x399354]['group']):_0x42f455[_0x886d('0x67')][_0x399354]['field']+'\x20'+_0x42f455[_0x886d('0x67')][_0x399354][_0x886d('0x69')]+(_0x2ce82e(_0x42f455[_0x886d('0x67')][_0x399354][_0x886d('0x69')])?'\x20'+_0x42f455['rules'][_0x399354][_0x886d('0x6a')]:'');}return _0x41fdd4+')';};var _0x474200={'where':{'id':_0x56580c[_0x886d('0x53')]['id']}},_0x38e758,_0x3a0804,_0x2f9600,_0x12bd96,_0x164932;_0x474200=_[_0x886d('0x42')]({},_0x474200,_0x56580c[_0x886d('0x4b')]);return db[_0x886d('0x46')][_0x886d('0x4c')](_0x474200)[_0x886d('0x27')](function(_0x3623cd){if(_0x3623cd){_0x38e758=_0x3623cd;return _0x3623cd[_0x886d('0x6b')]();}return null;})[_0x886d('0x27')](function(_0x68b4ec){if(_0x68b4ec){if(!_0x68b4ec['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x886d('0x6c'),0x193);}_0x3a0804=_0x68b4ec;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x886d('0x27')](function(_0x283708){if(_0x283708){_0x2f9600=_['keyBy'](_0x283708,'id');var _0x4deea8;var _0xaf6ace=squel[_0x886d('0x6d')]();_0xaf6ace['from'](_0x38e758[_0x886d('0x6e')]);for(var _0xf4a6bd=0x0;_0xf4a6bd<_0x3a0804[_0x886d('0x39')];_0xf4a6bd+=0x1){_0x4deea8=_0x3a0804[_0xf4a6bd][_0x886d('0x6f')]?_0x2f9600[_0x3a0804[_0xf4a6bd][_0x886d('0x6f')]]['metric']:_0x3a0804[_0xf4a6bd]['field'];_0x4deea8=_0x3a0804[_0xf4a6bd][_0x886d('0x70')]?_['replace'](_0x435c57[_0x3a0804[_0xf4a6bd][_0x886d('0x70')]],'%s',_0x4deea8):_0x4deea8;_0x4deea8=_0x3a0804[_0xf4a6bd][_0x886d('0x71')]?_['replace'](_0x33a86c[_0x3a0804[_0xf4a6bd][_0x886d('0x71')]],'%s',_0x4deea8):_0x4deea8;if(_0x3a0804[_0xf4a6bd][_0x886d('0x72')]){_0xaf6ace[_0x886d('0x68')](_0x4deea8);}_0x3a0804[_0xf4a6bd][_0x886d('0x73')]&&_0xaf6ace[_0x886d('0x3d')](_0x4deea8,_0x3a0804[_0xf4a6bd]['orderBy']===_0x886d('0x74')?![]:!![]);_0xaf6ace[_0x886d('0x75')](_0x4deea8,_0x3a0804[_0xf4a6bd]['alias']||_0x4deea8);}if(_0x38e758[_0x886d('0x76')]){_0x38e758[_0x886d('0x76')]=JSON[_0x886d('0x77')](_0x38e758[_0x886d('0x76')]);for(var _0x2349fb=0x0;_0x2349fb<_0x38e758[_0x886d('0x76')][_0x886d('0x39')];_0x2349fb+=0x1){if(_0x38e758[_0x886d('0x76')][_0x2349fb][_0x886d('0x30')]&&_[_0x886d('0x64')](_0x41bf33,_0x38e758[_0x886d('0x76')][_0x2349fb][_0x886d('0x30')])&&_0x38e758[_0x886d('0x76')][_0x2349fb][_0x886d('0x78')]&&_0x38e758['joins'][_0x2349fb][_0x886d('0x79')]&&_0x38e758[_0x886d('0x76')][_0x2349fb]['foreignKey']){_0xaf6ace[_0x38e758[_0x886d('0x76')][_0x2349fb][_0x886d('0x30')]](_0x38e758[_0x886d('0x76')][_0x2349fb][_0x886d('0x79')],null,util[_0x886d('0x71')](_0x886d('0x7a'),_0x38e758[_0x886d('0x6e')],_0x38e758[_0x886d('0x76')][_0x2349fb][_0x886d('0x78')],_0x38e758['joins'][_0x2349fb][_0x886d('0x79')],_0x38e758[_0x886d('0x76')][_0x2349fb]['foreignKey']));}}}if(_0x38e758['conditions']){_0x38e758[_0x886d('0x7b')]=JSON[_0x886d('0x77')](_0x38e758[_0x886d('0x7b')]);_0xaf6ace[_0x886d('0x3f')](_0x1453e8(_0x38e758[_0x886d('0x7b')][_0x886d('0x68')]));}_0x164932=_0xaf6ace[_0x886d('0x7c')]();_0xaf6ace[_0x886d('0x1a')](_0x1591ee);_0xaf6ace[_0x886d('0x3c')](0x0);logger[_0x886d('0x7d')](_0x886d('0x7e'),_0xaf6ace[_0x886d('0x7f')]());return dbH['sequelize'][_0x886d('0x33')](_0xaf6ace[_0x886d('0x7f')](),{'type':dbH[_0x886d('0x80')][_0x886d('0x81')][_0x886d('0x82')]});}})[_0x886d('0x27')](respondWithResult(_0x59a06d,null))[_0x886d('0x48')](handleError(_0x59a06d,null));};function runReport(_0x26ef7e,_0x24aef3,_0x849f99){var _0x3d486b=_0x24aef3[_0x886d('0x2b')];var _0x3cc5b6=0xa;var _0x27851c=[_0x886d('0x83'),_0x886d('0x55'),_0x886d('0x56'),'cross_join'];var _0x36f4d7={'SUM':_0x886d('0x58'),'COUNT':_0x886d('0x59'),'COUNT DISTINCT':_0x886d('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x886d('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x886d('0x5e')};var _0x2e91e1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x886d('0x60'),'HOUR':_0x886d('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x886d('0x63')};var _0x29f14b=function(_0x3617ba){return!_[_0x886d('0x64')]([_0x886d('0x84'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x886d('0x85')],_0x3617ba);};var _0x1cbbc8=function(_0x443dc6){if(!_0x443dc6||!_0x443dc6[_0x886d('0x67')]['length']){return'';}for(var _0x1da850='(',_0x403ffd=0x0;_0x403ffd<_0x443dc6[_0x886d('0x67')][_0x886d('0x39')];_0x403ffd+=0x1){_0x403ffd>0x0&&(_0x1da850+='\x20'+_0x443dc6['operator']+'\x20');_0x1da850+=_0x443dc6[_0x886d('0x67')][_0x403ffd][_0x886d('0x68')]?_0x1cbbc8(_0x443dc6[_0x886d('0x67')][_0x403ffd]['group']):_0x443dc6[_0x886d('0x67')][_0x403ffd][_0x886d('0x75')]+'\x20'+_0x443dc6[_0x886d('0x67')][_0x403ffd][_0x886d('0x69')]+(_0x29f14b(_0x443dc6['rules'][_0x403ffd][_0x886d('0x69')])?'\x20'+_0x443dc6[_0x886d('0x67')][_0x403ffd][_0x886d('0x6a')]:'');}return _0x1da850+')';};var _0x43bc3b={'where':{'id':_0x26ef7e['id']}},_0x19ebaa,_0x9169cf,_0x3bc680,_0x309fbc,_0x17f0ad;_0x43bc3b=_[_0x886d('0x42')]({},_0x43bc3b,_0x849f99);return db['AnalyticDefaultReport'][_0x886d('0x4c')](_0x43bc3b)[_0x886d('0x27')](function(_0x388a26){if(_0x388a26){_0x19ebaa=_0x388a26;return _0x388a26[_0x886d('0x6b')]();}return null;})['then'](function(_0xf210b){if(_0xf210b){if(!_0xf210b[_0x886d('0x39')]){throw new db[(_0x886d('0x86'))][(_0x886d('0x87'))](_0x886d('0x6c'),0x193);}_0x9169cf=_0xf210b;return db[_0x886d('0x88')][_0x886d('0x47')]({'raw':!![]});}return null;})['then'](function(_0x2e3e6a){if(_0x2e3e6a){_0x3bc680=_[_0x886d('0x89')](_0x2e3e6a,'id');var _0x4ded18;var _0x5d2a1c=squel[_0x886d('0x6d')]();_0x5d2a1c[_0x886d('0x8a')](_0x19ebaa[_0x886d('0x6e')]);for(var _0x4561aa=0x0;_0x4561aa<_0x9169cf[_0x886d('0x39')];_0x4561aa+=0x1){_0x4ded18=_0x9169cf[_0x4561aa][_0x886d('0x6f')]?_0x3bc680[_0x9169cf[_0x4561aa][_0x886d('0x6f')]]['metric']:_0x9169cf[_0x4561aa]['field'];_0x4ded18=_0x9169cf[_0x4561aa][_0x886d('0x70')]?_[_0x886d('0x8b')](_0x36f4d7[_0x9169cf[_0x4561aa]['function']],'%s',_0x4ded18):_0x4ded18;_0x4ded18=_0x9169cf[_0x4561aa]['format']?_[_0x886d('0x8b')](_0x2e91e1[_0x9169cf[_0x4561aa][_0x886d('0x71')]],'%s',_0x4ded18):_0x4ded18;if(_0x9169cf[_0x4561aa][_0x886d('0x72')]){_0x5d2a1c[_0x886d('0x68')](_0x4ded18);}_0x9169cf[_0x4561aa][_0x886d('0x73')]&&_0x5d2a1c[_0x886d('0x3d')](_0x4ded18,_0x9169cf[_0x4561aa][_0x886d('0x73')]===_0x886d('0x74')?![]:!![]);_0x5d2a1c['field'](_0x4ded18,_0x9169cf[_0x4561aa][_0x886d('0x8c')]||_0x4ded18);}if(_0x19ebaa['joins']){_0x19ebaa[_0x886d('0x76')]=JSON[_0x886d('0x77')](_0x19ebaa[_0x886d('0x76')]);for(var _0x1396b6=0x0;_0x1396b6<_0x19ebaa[_0x886d('0x76')]['length'];_0x1396b6+=0x1){if(_0x19ebaa['joins'][_0x1396b6][_0x886d('0x30')]&&_[_0x886d('0x64')](_0x27851c,_0x19ebaa[_0x886d('0x76')][_0x1396b6][_0x886d('0x30')])&&_0x19ebaa['joins'][_0x1396b6][_0x886d('0x78')]&&_0x19ebaa[_0x886d('0x76')][_0x1396b6]['foreignTable']&&_0x19ebaa['joins'][_0x1396b6][_0x886d('0x8d')]){_0x5d2a1c[_0x19ebaa[_0x886d('0x76')][_0x1396b6]['type']](_0x19ebaa['joins'][_0x1396b6]['foreignTable'],null,util[_0x886d('0x71')]('%s.%s\x20=\x20%s.%s',_0x19ebaa[_0x886d('0x6e')],_0x19ebaa[_0x886d('0x76')][_0x1396b6][_0x886d('0x78')],_0x19ebaa[_0x886d('0x76')][_0x1396b6][_0x886d('0x79')],_0x19ebaa['joins'][_0x1396b6][_0x886d('0x8d')]));}}}if(_0x19ebaa['conditions']){_0x19ebaa[_0x886d('0x7b')]=JSON['parse'](_0x19ebaa[_0x886d('0x7b')]);_0x5d2a1c[_0x886d('0x3f')](_0x1cbbc8(_0x19ebaa[_0x886d('0x7b')][_0x886d('0x68')]));}_0x17f0ad=_0x5d2a1c[_0x886d('0x7c')]();_0x5d2a1c['limit'](_0x3cc5b6);_0x5d2a1c[_0x886d('0x3c')](0x0);return;}})[_0x886d('0x27')](function(){if(_0x24aef3['output']===_0x886d('0x8e')){return null;}var _0x2f7a52=_[_0x886d('0x42')](_0x24aef3,{'name':_0x24aef3[_0x886d('0x8f')]||_0x24aef3['name']||_0x19ebaa[_0x886d('0x2b')],'basename':_0x3d486b,'savename':util[_0x886d('0x71')](_0x886d('0x90'),_0x24aef3[_0x886d('0x2b')]||_0x19ebaa[_0x886d('0x2b')],require(_0x886d('0x91'))[_0x886d('0x92')](0x4),_0x24aef3[_0x886d('0x93')]||_0x886d('0x94')),'reportId':_0x19ebaa['id'],'reportType':_0x886d('0x95')});return db[_0x886d('0x96')][_0x886d('0x4d')](_0x2f7a52,{'raw':!![]});})[_0x886d('0x27')](function(_0xa35a9c){if(_0x19ebaa[_0x886d('0x6e')]===_0x886d('0x97')){_0x17f0ad[_0x886d('0x3f')](_0x19ebaa['table']+_0x886d('0x98'),_0x24aef3[_0x886d('0x99')],_0x24aef3[_0x886d('0x9a')]);}else{_0x17f0ad[_0x886d('0x3f')](_0x19ebaa[_0x886d('0x6e')]+_0x886d('0x9b'),_0x24aef3[_0x886d('0x99')],_0x24aef3[_0x886d('0x9a')]);}if(_0xa35a9c){logger[_0x886d('0x9c')]('Run\x20Query:',_0x17f0ad[_0x886d('0x7f')]());require(_0x886d('0x9d'))[_0x886d('0x9e')](path[_0x886d('0x83')](__dirname,_0x886d('0x9f'),_0xa35a9c[_0x886d('0x93')]),[_0xa35a9c['id'],_0x17f0ad[_0x886d('0x7f')](),path[_0x886d('0x83')](__dirname,_0x886d('0xa0'),_0xa35a9c['savename']),_0x3d486b]);return _0xa35a9c;}else{var _0x2dc7cb=squel[_0x886d('0x6d')]();_0x2dc7cb[_0x886d('0x8a')]('('+_0x17f0ad[_0x886d('0x7f')]()+')',_0x886d('0xa1'));_0x2dc7cb[_0x886d('0x75')](_0x886d('0xa2'),_0x886d('0x1b'));_0x17f0ad[_0x886d('0x1a')](_0x24aef3[_0x886d('0x1a')]||_0x3cc5b6);_0x17f0ad[_0x886d('0x3c')](_0x24aef3['offset']||0x0);return dbH[_0x886d('0x80')][_0x886d('0x33')](_0x2dc7cb[_0x886d('0x7f')](),{'type':dbH[_0x886d('0x80')][_0x886d('0x81')]['SELECT']})['then'](function(_0x3c519a){if(!_0x3c519a[_0x886d('0x39')]){_0x309fbc=0x0;}else{_0x309fbc=_0x3c519a[0x0][_0x886d('0x1b')]||0x0;}return dbH[_0x886d('0x80')][_0x886d('0x33')](_0x17f0ad[_0x886d('0x7f')](),{'type':dbH['sequelize'][_0x886d('0x81')][_0x886d('0x82')]});})[_0x886d('0x27')](function(_0x5a3428){return{'rows':_0x5a3428||[],'count':_0x309fbc};});}});}exports[_0x886d('0xa3')]=function(_0x53f189,_0x171750){return runReport(_0x53f189['params'],_0x53f189[_0x886d('0x33')],_0x53f189[_0x886d('0x4b')])[_0x886d('0x27')](respondWithResult(_0x171750,null))[_0x886d('0x48')](handleError(_0x171750,null));};exports[_0x886d('0xa4')]=runReport;exports['query']=function(_0x3aac40,_0x27cf0f){var _0x256924=0xa;var _0x3584e7=['join','left_join',_0x886d('0x56'),_0x886d('0x57')];var _0x5a33fe={'SUM':'SUM(%s)','COUNT':_0x886d('0x59'),'COUNT DISTINCT':_0x886d('0x5a'),'MAX':_0x886d('0x5b'),'MIN':'MIN(%s)','AVG':_0x886d('0xa5'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x886d('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5684f8={'SEC_TO_TIME':_0x886d('0x5f'),'DATE':_0x886d('0x60'),'HOUR':_0x886d('0x61'),'ROUND':_0x886d('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x44f5b6=function(_0x1dde4e){return!_[_0x886d('0x64')]([_0x886d('0x84'),'IS\x20NOT\x20NULL',_0x886d('0x66'),'IS\x20NOT\x20EMPTY'],_0x1dde4e);};var _0x2ef3bf=function(_0x43ee02){if(!_0x43ee02||!_0x43ee02['rules'][_0x886d('0x39')]){return'';}for(var _0x1997da='(',_0x10f3d4=0x0;_0x10f3d4<_0x43ee02[_0x886d('0x67')]['length'];_0x10f3d4+=0x1){_0x10f3d4>0x0&&(_0x1997da+='\x20'+_0x43ee02['operator']+'\x20');_0x1997da+=_0x43ee02[_0x886d('0x67')][_0x10f3d4][_0x886d('0x68')]?_0x2ef3bf(_0x43ee02[_0x886d('0x67')][_0x10f3d4][_0x886d('0x68')]):_0x43ee02['rules'][_0x10f3d4][_0x886d('0x75')]+'\x20'+_0x43ee02[_0x886d('0x67')][_0x10f3d4][_0x886d('0x69')]+(_0x44f5b6(_0x43ee02[_0x886d('0x67')][_0x10f3d4]['condition'])?'\x20'+_0x43ee02[_0x886d('0x67')][_0x10f3d4][_0x886d('0x6a')]:'');}return _0x1997da+')';};var _0x20e239={'where':{'id':_0x3aac40[_0x886d('0x53')]['id']}},_0x4e21a5,_0xa23b3,_0x249dca,_0x2bb55e,_0x4014e2;_0x20e239=_['merge']({},_0x20e239,_0x3aac40[_0x886d('0x4b')]);return db[_0x886d('0x46')][_0x886d('0x4c')](_0x20e239)['then'](function(_0x1f106d){if(_0x1f106d){_0x4e21a5=_0x1f106d;return _0x1f106d['getFields']();}return null;})[_0x886d('0x27')](function(_0x1b376e){if(_0x1b376e){if(!_0x1b376e[_0x886d('0x39')]){throw new db[(_0x886d('0x86'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa23b3=_0x1b376e;return db[_0x886d('0x88')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3bd6f9){if(_0x3bd6f9){_0x249dca=_[_0x886d('0x89')](_0x3bd6f9,'id');var _0x4005de;var _0x3aa81a=squel[_0x886d('0x6d')]();_0x3aa81a[_0x886d('0x8a')](_0x4e21a5[_0x886d('0x6e')]);for(var _0x37fc35=0x0;_0x37fc35<_0xa23b3[_0x886d('0x39')];_0x37fc35+=0x1){_0x4005de=_0xa23b3[_0x37fc35][_0x886d('0x6f')]?_0x249dca[_0xa23b3[_0x37fc35][_0x886d('0x6f')]][_0x886d('0xa6')]:_0xa23b3[_0x37fc35][_0x886d('0x75')];_0x4005de=_0xa23b3[_0x37fc35]['function']?_[_0x886d('0x8b')](_0x5a33fe[_0xa23b3[_0x37fc35][_0x886d('0x70')]],'%s',_0x4005de):_0x4005de;_0x4005de=_0xa23b3[_0x37fc35][_0x886d('0x71')]?_[_0x886d('0x8b')](_0x5684f8[_0xa23b3[_0x37fc35][_0x886d('0x71')]],'%s',_0x4005de):_0x4005de;if(_0xa23b3[_0x37fc35][_0x886d('0x72')]){_0x3aa81a[_0x886d('0x68')](_0x4005de);}_0xa23b3[_0x37fc35][_0x886d('0x73')]&&_0x3aa81a[_0x886d('0x3d')](_0x4005de,_0xa23b3[_0x37fc35][_0x886d('0x73')]===_0x886d('0x74')?![]:!![]);_0x3aa81a[_0x886d('0x75')](_0x4005de,_0xa23b3[_0x37fc35][_0x886d('0x8c')]||_0x4005de);}if(_0x4e21a5[_0x886d('0x76')]){_0x4e21a5[_0x886d('0x76')]=JSON[_0x886d('0x77')](_0x4e21a5[_0x886d('0x76')]);for(var _0x4b3ba5=0x0;_0x4b3ba5<_0x4e21a5[_0x886d('0x76')][_0x886d('0x39')];_0x4b3ba5+=0x1){if(_0x4e21a5['joins'][_0x4b3ba5]['type']&&_[_0x886d('0x64')](_0x3584e7,_0x4e21a5[_0x886d('0x76')][_0x4b3ba5][_0x886d('0x30')])&&_0x4e21a5[_0x886d('0x76')][_0x4b3ba5]['parentKey']&&_0x4e21a5[_0x886d('0x76')][_0x4b3ba5][_0x886d('0x79')]&&_0x4e21a5[_0x886d('0x76')][_0x4b3ba5][_0x886d('0x8d')]){_0x3aa81a[_0x4e21a5[_0x886d('0x76')][_0x4b3ba5][_0x886d('0x30')]](_0x4e21a5['joins'][_0x4b3ba5][_0x886d('0x79')],null,util[_0x886d('0x71')](_0x886d('0x7a'),_0x4e21a5[_0x886d('0x6e')],_0x4e21a5['joins'][_0x4b3ba5][_0x886d('0x78')],_0x4e21a5[_0x886d('0x76')][_0x4b3ba5][_0x886d('0x79')],_0x4e21a5[_0x886d('0x76')][_0x4b3ba5][_0x886d('0x8d')]));}}}if(_0x4e21a5[_0x886d('0x7b')]){_0x4e21a5[_0x886d('0x7b')]=JSON[_0x886d('0x77')](_0x4e21a5[_0x886d('0x7b')]);_0x3aa81a[_0x886d('0x3f')](_0x2ef3bf(_0x4e21a5[_0x886d('0x7b')][_0x886d('0x68')]));}_0x4014e2=_0x3aa81a[_0x886d('0x7c')]();_0x3aa81a[_0x886d('0x1a')](_0x256924);_0x3aa81a[_0x886d('0x3c')](0x0);logger[_0x886d('0x7d')](_0x886d('0x7e'),_0x3aa81a[_0x886d('0x7f')]());return dbH[_0x886d('0x80')][_0x886d('0x33')](_0x3aa81a['toString'](),{'type':dbH[_0x886d('0x80')][_0x886d('0x81')][_0x886d('0x82')]});}})['then'](function(){return{'sql':_0x4014e2[_0x886d('0x7f')]()};})[_0x886d('0x27')](respondWithResult(_0x27cf0f,null))['catch'](handleError(_0x27cf0f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 17cadc1..06f7ecc 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 _0x34ab=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x11c331,_0x523ccf){var _0x1b89e1=function(_0x33d7b6){while(--_0x33d7b6){_0x11c331['push'](_0x11c331['shift']());}};_0x1b89e1(++_0x523ccf);}(_0x34ab,0xf1));var _0xb34a=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x34ab[_0xda464c];return _0x19e222;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var logger=require(_0xb34a('0x2'))(_0xb34a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb34a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb34a('0x5'));var config=require(_0xb34a('0x6'));var attributes=require(_0xb34a('0x7'));module['exports']=function(_0x6e669,_0x1f6df3){return _0x6e669[_0xb34a('0x8')](_0xb34a('0x9'),attributes,{'tableName':_0xb34a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddbb=['AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x1aa57b,_0x5c8b9b){var _0xfff9e5=function(_0x2f3527){while(--_0x2f3527){_0x1aa57b['push'](_0x1aa57b['shift']());}};_0xfff9e5(++_0x5c8b9b);}(_0xddbb,0xbf));var _0xbddb=function(_0x5e5fc7,_0x41c450){_0x5e5fc7=_0x5e5fc7-0x0;var _0x7e6791=_0xddbb[_0x5e5fc7];return _0x7e6791;};'use strict';var _=require(_0xbddb('0x0'));var util=require(_0xbddb('0x1'));var logger=require('../../config/logger')(_0xbddb('0x2'));var moment=require(_0xbddb('0x3'));var BPromise=require(_0xbddb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbddb('0x5'));var attributes=require(_0xbddb('0x6'));module['exports']=function(_0x3379a2,_0x2bc377){return _0x3379a2['define'](_0xbddb('0x7'),attributes,{'tableName':_0xbddb('0x8'),'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 b1a7aaa..7ac0f05 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 _0x195e=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x131be9,_0x5c8e73){var _0x4ed332=function(_0x179b05){while(--_0x179b05){_0x131be9['push'](_0x131be9['shift']());}};_0x4ed332(++_0x5c8e73);}(_0x195e,0xfb));var _0xe195=function(_0x30361e,_0x2c6205){_0x30361e=_0x30361e-0x0;var _0x35be38=_0x195e[_0x30361e];return _0x35be38;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1acc,_0x663106,_0x2ead59){return new BPromise(function(_0x28c1a9,_0x3164c3){return client['request'](_0x2a1acc,_0x2ead59)['then'](function(_0x5f333b){logger[_0xe195('0xd')](_0xe195('0xe'),_0x663106,_0xe195('0xf'));logger[_0xe195('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x663106,_0xe195('0xf'),JSON[_0xe195('0x11')](_0x5f333b));if(_0x5f333b[_0xe195('0x12')]){if(_0x5f333b['error'][_0xe195('0x13')]===0x1f4){logger[_0xe195('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x663106,_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);return _0x3164c3(_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);}logger['error'](_0xe195('0xe'),_0x663106,_0x5f333b[_0xe195('0x12')]['message']);return _0x28c1a9(_0x5f333b['error'][_0xe195('0x14')]);}else{logger['info'](_0xe195('0xe'),_0x663106,'request\x20sent');_0x28c1a9(_0x5f333b['result'][_0xe195('0x14')]);}})[_0xe195('0x15')](function(_0x277362){logger[_0xe195('0x12')](_0xe195('0xe'),_0x663106,_0x277362);_0x3164c3(_0x277362);});});} \ No newline at end of file +var _0x9efc=['http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9efc,0x19c));var _0xc9ef=function(_0x5cf3c0,_0x4363c1){_0x5cf3c0=_0x5cf3c0-0x0;var _0x39a680=_0x9efc[_0x5cf3c0];return _0x39a680;};'use strict';var _=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var moment=require(_0xc9ef('0x2'));var BPromise=require(_0xc9ef('0x3'));var rs=require(_0xc9ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9ef('0x5'));var logger=require('../../config/logger')(_0xc9ef('0x6'));var config=require('../../config/environment');var jayson=require(_0xc9ef('0x7'));var client=jayson['client'][_0xc9ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb3be8b,_0x99562e,_0xb1af3a){return new BPromise(function(_0x45cc54,_0x3a6fe6){return client[_0xc9ef('0x9')](_0xb3be8b,_0xb1af3a)[_0xc9ef('0xa')](function(_0x418b6b){logger[_0xc9ef('0xb')](_0xc9ef('0xc'),_0x99562e,'request\x20sent');logger['debug'](_0xc9ef('0xd'),_0x99562e,'request\x20sent',JSON[_0xc9ef('0xe')](_0x418b6b));if(_0x418b6b['error']){if(_0x418b6b[_0xc9ef('0xf')]['code']===0x1f4){logger['error'](_0xc9ef('0xc'),_0x99562e,_0x418b6b[_0xc9ef('0xf')][_0xc9ef('0x10')]);return _0x3a6fe6(_0x418b6b[_0xc9ef('0xf')][_0xc9ef('0x10')]);}logger[_0xc9ef('0xf')](_0xc9ef('0xc'),_0x99562e,_0x418b6b[_0xc9ef('0xf')][_0xc9ef('0x10')]);return _0x45cc54(_0x418b6b[_0xc9ef('0xf')][_0xc9ef('0x10')]);}else{logger['info'](_0xc9ef('0xc'),_0x99562e,_0xc9ef('0x11'));_0x45cc54(_0x418b6b[_0xc9ef('0x12')][_0xc9ef('0x10')]);}})[_0xc9ef('0x13')](function(_0x54e2c3){logger[_0xc9ef('0xf')](_0xc9ef('0xc'),_0x99562e,_0x54e2c3);_0x3a6fe6(_0x54e2c3);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ea9c30b..809c705 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 _0xcc4f=['get','isAuthenticated','index','/:id/preview','preview','run','/:id/query','query','put','update','delete','/:id','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x4e6444,_0x11cd1d){var _0x4cb105=function(_0x1b3778){while(--_0x1b3778){_0x4e6444['push'](_0x4e6444['shift']());}};_0x4cb105(++_0x11cd1d);}(_0xcc4f,0x90));var _0xfcc4=function(_0x7d8b5e,_0x6a7253){_0x7d8b5e=_0x7d8b5e-0x0;var _0x40c789=_0xcc4f[_0x7d8b5e];return _0x40c789;};'use strict';var multer=require(_0xfcc4('0x0'));var util=require(_0xfcc4('0x1'));var path=require(_0xfcc4('0x2'));var timeout=require(_0xfcc4('0x3'));var express=require(_0xfcc4('0x4'));var router=express[_0xfcc4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfcc4('0x6'));var interaction=require(_0xfcc4('0x7'));var config=require(_0xfcc4('0x8'));var controller=require(_0xfcc4('0x9'));router[_0xfcc4('0xa')]('/',auth[_0xfcc4('0xb')](),controller[_0xfcc4('0xc')]);router[_0xfcc4('0xa')]('/:id',auth[_0xfcc4('0xb')](),controller['show']);router[_0xfcc4('0xa')](_0xfcc4('0xd'),auth[_0xfcc4('0xb')](),controller[_0xfcc4('0xe')]);router[_0xfcc4('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0xfcc4('0xf')]);router[_0xfcc4('0xa')](_0xfcc4('0x10'),auth['isAuthenticated'](),controller[_0xfcc4('0x11')]);router['post']('/',auth[_0xfcc4('0xb')](),controller['create']);router[_0xfcc4('0x12')]('/:id',auth[_0xfcc4('0xb')](),controller[_0xfcc4('0x13')]);router[_0xfcc4('0x14')](_0xfcc4('0x15'),auth[_0xfcc4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3ec5=['put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/run','query','post','create'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x3ec5,0x192));var _0x53ec=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3ec5[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x53ec('0x0'));var util=require(_0x53ec('0x1'));var path=require(_0x53ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x53ec('0x3'));var router=express['Router']();var fs_extra=require(_0x53ec('0x4'));var auth=require(_0x53ec('0x5'));var interaction=require(_0x53ec('0x6'));var config=require('../../config/environment');var controller=require(_0x53ec('0x7'));router[_0x53ec('0x8')]('/',auth[_0x53ec('0x9')](),controller[_0x53ec('0xa')]);router[_0x53ec('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x53ec('0xb')]);router[_0x53ec('0x8')]('/:id/preview',auth[_0x53ec('0x9')](),controller['preview']);router[_0x53ec('0x8')](_0x53ec('0xc'),auth[_0x53ec('0x9')](),controller['run']);router[_0x53ec('0x8')]('/:id/query',auth[_0x53ec('0x9')](),controller[_0x53ec('0xd')]);router[_0x53ec('0xe')]('/',auth[_0x53ec('0x9')](),controller[_0x53ec('0xf')]);router[_0x53ec('0x10')](_0x53ec('0x11'),auth[_0x53ec('0x9')](),controller[_0x53ec('0x12')]);router[_0x53ec('0x13')](_0x53ec('0x11'),auth[_0x53ec('0x9')](),controller[_0x53ec('0x14')]);module[_0x53ec('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 56e3f5a..f0fb78b 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 _0x6b7d=['moment','exports','STRING','csv','DATE','ENUM','scheduled','manual','INTEGER','UNSIGNED'];(function(_0x5aaf8a,_0x11cb3f){var _0x12a226=function(_0x239b14){while(--_0x239b14){_0x5aaf8a['push'](_0x5aaf8a['shift']());}};_0x12a226(++_0x11cb3f);}(_0x6b7d,0xb4));var _0xd6b7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6b7d[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd6b7('0x0'));module[_0xd6b7('0x1')]={'name':{'type':Sequelize[_0xd6b7('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd6b7('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd6b7('0x3'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xd6b7('0x3')},'savename':{'type':Sequelize[_0xd6b7('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd6b7('0x4')]},'endDate':{'type':Sequelize[_0xd6b7('0x4')]},'status':{'type':Sequelize[_0xd6b7('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xd6b7('0x5')]('manual',_0xd6b7('0x6')),'allowNull':![],'defaultValue':_0xd6b7('0x7')},'reportId':{'type':Sequelize[_0xd6b7('0x8')](0xb)[_0xd6b7('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3373=['csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','pdf','xlsx'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3373,0xfe));var _0x3337=function(_0xad57d4,_0x3a8c8e){_0xad57d4=_0xad57d4-0x0;var _0x1a1a6e=_0x3373[_0xad57d4];return _0x1a1a6e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3337('0x0'));module[_0x3337('0x1')]={'name':{'type':Sequelize[_0x3337('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x3337('0x3')]('csv',_0x3337('0x4'),_0x3337('0x5')),'allowNull':![],'defaultValue':_0x3337('0x6')},'savename':{'type':Sequelize[_0x3337('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x3337('0x7')]},'status':{'type':Sequelize[_0x3337('0x2')],'defaultValue':_0x3337('0x8')},'type':{'type':Sequelize['ENUM'](_0x3337('0x9'),_0x3337('0xa')),'allowNull':![],'defaultValue':_0x3337('0x9')},'reportId':{'type':Sequelize[_0x3337('0xb')](0xb)[_0x3337('0xc')]},'reportType':{'type':Sequelize[_0x3337('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 76a7fa5..7ddf5d8 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 _0x9354=['get','ExtractedReports','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','map','VIRTUAL','filter','merge','options','AnalyticExtractedReport','include','findAll','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','format','%s.%s','toLowerCase','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy'];(function(_0x531e37,_0x4c86dd){var _0x2a48ab=function(_0x48f769){while(--_0x48f769){_0x531e37['push'](_0x531e37['shift']());}};_0x2a48ab(++_0x4c86dd);}(_0x9354,0x96));var _0x4935=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x9354[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){var _0x3786ff=_0x4dc1f5[_0x4935('0x24')]({'plain':!![]});var _0x344e51=_0x4935('0x25');return db[_0x4935('0x26')][_0x4935('0x23')]({'where':{'type':_0x344e51,'resourceId':_0x3786ff['id']}})[_0x4935('0x22')](function(){return _0x4dc1f5;});})[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x2c47ab,_0xbb00d6){return function(_0x359522){if(!_0x359522){_0x2c47ab['sendStatus'](0x194);}return _0x359522;};}function handleError(_0x5c3aaa,_0x5cec4d){_0x5cec4d=_0x5cec4d||0x1f4;return function(_0x1fc218){logger[_0x4935('0x27')](_0x1fc218['stack']);if(_0x1fc218[_0x4935('0x28')]){delete _0x1fc218[_0x4935('0x28')];}_0x5c3aaa[_0x4935('0x18')](_0x5cec4d)[_0x4935('0x29')](_0x1fc218);};}exports[_0x4935('0x2a')]=function(_0x24262e,_0x28afc2){var _0x2fe6da={},_0x5b3c8e={},_0xb7fe2a={'count':0x0,'rows':[]};var _0x2dcb0b=_['map'](db['AnalyticExtractedReport'][_0x4935('0x2b')],function(_0x479d28){return{'name':_0x479d28[_0x4935('0x2c')],'type':_0x479d28[_0x4935('0x2d')][_0x4935('0x2e')]};});_0x5b3c8e['model']=_['map'](_0x2dcb0b,_0x4935('0x28'));_0x5b3c8e[_0x4935('0x2f')]=_['keys'](_0x24262e[_0x4935('0x2f')]);_0x5b3c8e[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5b3c8e[_0x4935('0x32')],_0x5b3c8e[_0x4935('0x2f')]);_0x2fe6da['attributes']=_['intersection'](_0x5b3c8e[_0x4935('0x32')],qs[_0x4935('0x33')](_0x24262e['query']['fields']));_0x2fe6da[_0x4935('0x34')]=_0x2fe6da['attributes'][_0x4935('0x35')]?_0x2fe6da[_0x4935('0x34')]:_0x5b3c8e[_0x4935('0x32')];if(!_0x24262e[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x2fe6da['limit']=qs[_0x4935('0x1c')](_0x24262e['query'][_0x4935('0x1c')]);_0x2fe6da['offset']=qs[_0x4935('0x38')](_0x24262e['query'][_0x4935('0x38')]);}_0x2fe6da[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24262e[_0x4935('0x2f')][_0x4935('0x3a')]);_0x2fe6da[_0x4935('0x3b')]=qs[_0x4935('0x30')](_['pick'](_0x24262e['query'],_0x5b3c8e[_0x4935('0x30')]),_0x2dcb0b);if(_0x24262e['query']['filter']){_0x2fe6da[_0x4935('0x3b')]=_['merge'](_0x2fe6da[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x2dcb0b,function(_0x2d67e3){if(_0x2d67e3[_0x4935('0x2d')]!==_0x4935('0x3d')){var _0x53aac5={};_0x53aac5[_0x2d67e3['name']]={'$like':'%'+_0x24262e[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x53aac5;}})});}_0x2fe6da=_[_0x4935('0x3f')]({},_0x2fe6da,_0x24262e[_0x4935('0x40')]);var _0x4d9436={'where':_0x2fe6da[_0x4935('0x3b')]};return db[_0x4935('0x41')][_0x4935('0x1d')](_0x4d9436)['then'](function(_0x4e94f6){_0xb7fe2a[_0x4935('0x1d')]=_0x4e94f6;if(_0x24262e[_0x4935('0x2f')]['includeAll']){_0x2fe6da[_0x4935('0x42')]=[{'all':!![]}];}return db[_0x4935('0x41')][_0x4935('0x43')](_0x2fe6da);})[_0x4935('0x22')](function(_0x52ab0c){_0xb7fe2a['rows']=_0x52ab0c;return _0xb7fe2a;})[_0x4935('0x22')](respondWithFilteredResult(_0x28afc2,_0x2fe6da))[_0x4935('0x44')](handleError(_0x28afc2,null));};exports['show']=function(_0x1eaa47,_0x40f5ff){var _0x2195da={'raw':!![],'where':{'id':_0x1eaa47[_0x4935('0x45')]['id']}},_0x5135fd={};_0x5135fd[_0x4935('0x32')]=_[_0x4935('0x46')](db[_0x4935('0x41')][_0x4935('0x2b')]);_0x5135fd[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x1eaa47[_0x4935('0x2f')]);_0x5135fd[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],_0x5135fd[_0x4935('0x2f')]);_0x2195da[_0x4935('0x34')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],qs[_0x4935('0x33')](_0x1eaa47[_0x4935('0x2f')][_0x4935('0x33')]));_0x2195da['attributes']=_0x2195da[_0x4935('0x34')]['length']?_0x2195da[_0x4935('0x34')]:_0x5135fd[_0x4935('0x32')];if(_0x1eaa47[_0x4935('0x2f')][_0x4935('0x47')]){_0x2195da['include']=[{'all':!![]}];}_0x2195da=_[_0x4935('0x3f')]({},_0x2195da,_0x1eaa47[_0x4935('0x40')]);return db[_0x4935('0x41')][_0x4935('0x48')](_0x2195da)[_0x4935('0x22')](handleEntityNotFound(_0x40f5ff,null))[_0x4935('0x22')](respondWithResult(_0x40f5ff,null))[_0x4935('0x44')](handleError(_0x40f5ff,null));};exports[_0x4935('0x49')]=function(_0x29b932,_0x392cba){return db['AnalyticExtractedReport'][_0x4935('0x49')](_0x29b932[_0x4935('0x4a')],{})['then'](function(_0x447a64){var _0x2636f4=_0x29b932[_0x4935('0x4b')][_0x4935('0x24')]({'plain':!![]});if(!_0x2636f4)throw new Error(_0x4935('0x4c'));if(_0x2636f4[_0x4935('0x4d')]===_0x4935('0x4b')){var _0x471fb1=_0x447a64['get']({'plain':!![]});var _0x57d0d9='ExtractedReports';return db['UserProfileSection'][_0x4935('0x48')]({'where':{'name':_0x57d0d9,'userProfileId':_0x2636f4[_0x4935('0x4e')]},'raw':!![]})[_0x4935('0x22')](function(_0x2072df){if(_0x2072df&&_0x2072df[_0x4935('0x4f')]===0x0){return db['UserProfileResource'][_0x4935('0x49')]({'name':_0x471fb1[_0x4935('0x28')],'resourceId':_0x471fb1['id'],'type':_0x2072df[_0x4935('0x28')],'sectionId':_0x2072df['id']},{})[_0x4935('0x22')](function(){return _0x447a64;});}else{return _0x447a64;}})[_0x4935('0x44')](function(_0x8196b4){logger[_0x4935('0x27')](_0x4935('0x50'),_0x8196b4);throw _0x8196b4;});}return _0x447a64;})[_0x4935('0x22')](respondWithResult(_0x392cba,0xc9))[_0x4935('0x44')](handleError(_0x392cba,null));};exports['update']=function(_0x24b83b,_0x4e99bb){if(_0x24b83b[_0x4935('0x4a')]['id']){delete _0x24b83b[_0x4935('0x4a')]['id'];}return db['AnalyticExtractedReport'][_0x4935('0x48')]({'where':{'id':_0x24b83b['params']['id']}})['then'](handleEntityNotFound(_0x4e99bb,null))['then'](saveUpdates(_0x24b83b[_0x4935('0x4a')],null))[_0x4935('0x22')](respondWithResult(_0x4e99bb,null))[_0x4935('0x44')](handleError(_0x4e99bb,null));};exports[_0x4935('0x23')]=function(_0xd5a489,_0x56db7f){return db['AnalyticExtractedReport'][_0x4935('0x48')]({'where':{'id':_0xd5a489[_0x4935('0x45')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x56db7f,null))['then'](removeEntity(_0x56db7f,null))[_0x4935('0x44')](handleError(_0x56db7f,null));};exports[_0x4935('0x51')]=function(_0x24141a,_0xc92288,_0x5009c9){return db[_0x4935('0x41')]['find']({'where':{'id':_0x24141a['params']['id']},'attributes':['name',_0x4935('0x52'),_0x4935('0x53'),'output'],'raw':!![]})[_0x4935('0x22')](handleEntityNotFound(_0xc92288,null))[_0x4935('0x22')](function(_0x57b448){if(_0x57b448){if(!fs[_0x4935('0x54')](path[_0x4935('0x55')](config[_0x4935('0x56')],_0x4935('0x57'),_0x57b448[_0x4935('0x53')]))){throw new db[(_0x4935('0x58'))][(_0x4935('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x24141a[_0x4935('0x2f')]['exists']){return _0xc92288['sendStatus'](0xc8);}return _0xc92288[_0x4935('0x51')](path[_0x4935('0x55')](config['root'],'server/files/reports',_0x57b448[_0x4935('0x53')]),util[_0x4935('0x5a')](_0x4935('0x5b'),_0x57b448['basename']||_0x57b448[_0x4935('0x28')],_0x57b448['output'][_0x4935('0x5c')]()));}})[_0x4935('0x44')](handleError(_0xc92288,null));}; \ No newline at end of file +var _0x3423=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','basename','savename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','%s.%s','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','ExtractedReports','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','role','user','get','UserProfileSection','userProfileId','UserProfileResource'];(function(_0x268423,_0x1a5788){var _0x30ee05=function(_0x56df4d){while(--_0x56df4d){_0x268423['push'](_0x268423['shift']());}};_0x30ee05(++_0x1a5788);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x716d80,_0x36e1f4){_0x36e1f4=_0x36e1f4||0xcc;return function(_0x592ba8){if(_0x592ba8){return _0x716d80[_0x3342('0x16')](_0x36e1f4);}return _0x716d80[_0x3342('0x17')](_0x36e1f4)[_0x3342('0x18')]();};}function respondWithResult(_0xe4689e,_0x61fcc0){_0x61fcc0=_0x61fcc0||0xc8;return function(_0x104077){if(_0x104077){return _0xe4689e[_0x3342('0x17')](_0x61fcc0)['json'](_0x104077);}};}function respondWithFilteredResult(_0x3e44f3,_0x19bd71){return function(_0x49afe3){if(_0x49afe3){var _0x40d609=typeof _0x19bd71[_0x3342('0x19')]==='undefined'&&typeof _0x19bd71['limit']===_0x3342('0x1a');var _0x143cf1=_0x49afe3[_0x3342('0x1b')];var _0x2075cb=_0x40d609?0x0:_0x19bd71[_0x3342('0x19')];var _0x156c24=_0x40d609?_0x49afe3[_0x3342('0x1b')]:_0x19bd71[_0x3342('0x19')]+_0x19bd71[_0x3342('0x1c')];var _0x4f4c2a;if(_0x156c24>=_0x143cf1){_0x156c24=_0x143cf1;_0x4f4c2a=0xc8;}else{_0x4f4c2a=0xce;}_0x3e44f3[_0x3342('0x17')](_0x4f4c2a);return _0x3e44f3[_0x3342('0x1d')](_0x3342('0x1e'),_0x2075cb+'-'+_0x156c24+'/'+_0x143cf1)['json'](_0x49afe3);}return null;};}function patchUpdates(_0x3cb86f){return function(_0x463324){try{jsonpatch['apply'](_0x463324,_0x3cb86f,!![]);}catch(_0xe774b7){return BPromise[_0x3342('0x1f')](_0xe774b7);}return _0x463324['save']();};}function saveUpdates(_0x4e1b19,_0x5a0658){return function(_0x3f271c){if(_0x3f271c){return _0x3f271c[_0x3342('0x20')](_0x4e1b19)[_0x3342('0x21')](function(_0x2dbad1){return _0x2dbad1;});}return null;};}function removeEntity(_0xd2b87d,_0x2925a2){return function(_0x26eb87){if(_0x26eb87){return _0x26eb87[_0x3342('0x22')]()['then'](function(){var _0x30ffc9=_0x26eb87['get']({'plain':!![]});var _0x51cf45=_0x3342('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x51cf45,'resourceId':_0x30ffc9['id']}})[_0x3342('0x21')](function(){return _0x26eb87;});})['then'](function(){_0xd2b87d[_0x3342('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524286,_0x55cddd){return function(_0x1497d9){if(!_0x1497d9){_0x524286[_0x3342('0x16')](0x194);}return _0x1497d9;};}function handleError(_0x1dd607,_0x5eef2b){_0x5eef2b=_0x5eef2b||0x1f4;return function(_0xc275a1){logger[_0x3342('0x24')](_0xc275a1[_0x3342('0x25')]);if(_0xc275a1[_0x3342('0x26')]){delete _0xc275a1['name'];}_0x1dd607[_0x3342('0x17')](_0x5eef2b)[_0x3342('0x27')](_0xc275a1);};}exports[_0x3342('0x28')]=function(_0x301114,_0xf82530){var _0x2cc691={},_0x135760={},_0x47b2a0={'count':0x0,'rows':[]};var _0x2e0bde=_['map'](db[_0x3342('0x29')][_0x3342('0x2a')],function(_0x508f87){return{'name':_0x508f87[_0x3342('0x2b')],'type':_0x508f87[_0x3342('0x2c')][_0x3342('0x2d')]};});_0x135760[_0x3342('0x2e')]=_['map'](_0x2e0bde,_0x3342('0x26'));_0x135760[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x301114[_0x3342('0x2f')]);_0x135760[_0x3342('0x31')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],_0x135760[_0x3342('0x2f')]);_0x2cc691[_0x3342('0x33')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],qs[_0x3342('0x34')](_0x301114['query']['fields']));_0x2cc691[_0x3342('0x33')]=_0x2cc691['attributes'][_0x3342('0x35')]?_0x2cc691[_0x3342('0x33')]:_0x135760[_0x3342('0x2e')];if(!_0x301114[_0x3342('0x2f')][_0x3342('0x36')](_0x3342('0x37'))){_0x2cc691[_0x3342('0x1c')]=qs['limit'](_0x301114[_0x3342('0x2f')][_0x3342('0x1c')]);_0x2cc691[_0x3342('0x19')]=qs[_0x3342('0x19')](_0x301114[_0x3342('0x2f')]['offset']);}_0x2cc691[_0x3342('0x38')]=qs['sort'](_0x301114[_0x3342('0x2f')][_0x3342('0x39')]);_0x2cc691[_0x3342('0x3a')]=qs[_0x3342('0x31')](_['pick'](_0x301114[_0x3342('0x2f')],_0x135760['filters']),_0x2e0bde);if(_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]){_0x2cc691[_0x3342('0x3a')]=_[_0x3342('0x3c')](_0x2cc691[_0x3342('0x3a')],{'$or':_[_0x3342('0x3d')](_0x2e0bde,function(_0x32ef9a){if(_0x32ef9a['type']!==_0x3342('0x3e')){var _0x355e83={};_0x355e83[_0x32ef9a['name']]={'$like':'%'+_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]+'%'};return _0x355e83;}})});}_0x2cc691=_['merge']({},_0x2cc691,_0x301114[_0x3342('0x3f')]);var _0x29f0a0={'where':_0x2cc691['where']};return db['AnalyticExtractedReport']['count'](_0x29f0a0)[_0x3342('0x21')](function(_0x41e727){_0x47b2a0['count']=_0x41e727;if(_0x301114[_0x3342('0x2f')][_0x3342('0x40')]){_0x2cc691[_0x3342('0x41')]=[{'all':!![]}];}return db[_0x3342('0x29')][_0x3342('0x42')](_0x2cc691);})[_0x3342('0x21')](function(_0x34de7b){_0x47b2a0[_0x3342('0x43')]=_0x34de7b;return _0x47b2a0;})['then'](respondWithFilteredResult(_0xf82530,_0x2cc691))['catch'](handleError(_0xf82530,null));};exports[_0x3342('0x44')]=function(_0x7341fa,_0x474196){var _0xee717e={'raw':!![],'where':{'id':_0x7341fa[_0x3342('0x45')]['id']}},_0x717946={};_0x717946['model']=_[_0x3342('0x30')](db[_0x3342('0x29')][_0x3342('0x2a')]);_0x717946[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x7341fa[_0x3342('0x2f')]);_0x717946['filters']=_[_0x3342('0x32')](_0x717946['model'],_0x717946[_0x3342('0x2f')]);_0xee717e[_0x3342('0x33')]=_[_0x3342('0x32')](_0x717946[_0x3342('0x2e')],qs['fields'](_0x7341fa[_0x3342('0x2f')][_0x3342('0x34')]));_0xee717e['attributes']=_0xee717e[_0x3342('0x33')][_0x3342('0x35')]?_0xee717e[_0x3342('0x33')]:_0x717946[_0x3342('0x2e')];if(_0x7341fa['query'][_0x3342('0x40')]){_0xee717e[_0x3342('0x41')]=[{'all':!![]}];}_0xee717e=_['merge']({},_0xee717e,_0x7341fa[_0x3342('0x3f')]);return db['AnalyticExtractedReport']['find'](_0xee717e)[_0x3342('0x21')](handleEntityNotFound(_0x474196,null))[_0x3342('0x21')](respondWithResult(_0x474196,null))[_0x3342('0x46')](handleError(_0x474196,null));};exports[_0x3342('0x47')]=function(_0x23925e,_0x171387){return db[_0x3342('0x29')]['create'](_0x23925e['body'],{})[_0x3342('0x21')](function(_0x5a9e40){var _0x26251c=_0x23925e['user']['get']({'plain':!![]});if(!_0x26251c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26251c[_0x3342('0x48')]===_0x3342('0x49')){var _0x29ccb6=_0x5a9e40[_0x3342('0x4a')]({'plain':!![]});var _0x5176d7=_0x3342('0x23');return db[_0x3342('0x4b')]['find']({'where':{'name':_0x5176d7,'userProfileId':_0x26251c[_0x3342('0x4c')]},'raw':!![]})[_0x3342('0x21')](function(_0x43c27a){if(_0x43c27a&&_0x43c27a['autoAssociation']===0x0){return db[_0x3342('0x4d')][_0x3342('0x47')]({'name':_0x29ccb6[_0x3342('0x26')],'resourceId':_0x29ccb6['id'],'type':_0x43c27a[_0x3342('0x26')],'sectionId':_0x43c27a['id']},{})[_0x3342('0x21')](function(){return _0x5a9e40;});}else{return _0x5a9e40;}})['catch'](function(_0x2699d2){logger[_0x3342('0x24')](_0x3342('0x4e'),_0x2699d2);throw _0x2699d2;});}return _0x5a9e40;})[_0x3342('0x21')](respondWithResult(_0x171387,0xc9))[_0x3342('0x46')](handleError(_0x171387,null));};exports[_0x3342('0x20')]=function(_0x3db07c,_0x47cf76){if(_0x3db07c[_0x3342('0x4f')]['id']){delete _0x3db07c['body']['id'];}return db[_0x3342('0x29')]['find']({'where':{'id':_0x3db07c[_0x3342('0x45')]['id']}})['then'](handleEntityNotFound(_0x47cf76,null))['then'](saveUpdates(_0x3db07c['body'],null))['then'](respondWithResult(_0x47cf76,null))[_0x3342('0x46')](handleError(_0x47cf76,null));};exports[_0x3342('0x22')]=function(_0x3cd098,_0x476973){return db[_0x3342('0x29')][_0x3342('0x50')]({'where':{'id':_0x3cd098[_0x3342('0x45')]['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x476973,null))[_0x3342('0x21')](removeEntity(_0x476973,null))[_0x3342('0x46')](handleError(_0x476973,null));};exports[_0x3342('0x51')]=function(_0x561812,_0x47d138,_0x11719c){return db['AnalyticExtractedReport'][_0x3342('0x50')]({'where':{'id':_0x561812['params']['id']},'attributes':['name',_0x3342('0x52'),_0x3342('0x53'),_0x3342('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x47d138,null))['then'](function(_0x54b41d){if(_0x54b41d){if(!fs[_0x3342('0x55')](path['join'](config[_0x3342('0x56')],_0x3342('0x57'),_0x54b41d[_0x3342('0x53')]))){throw new db['Sequelize'][(_0x3342('0x58'))](_0x3342('0x59'));}if(_0x561812[_0x3342('0x2f')][_0x3342('0x5a')]){return _0x47d138[_0x3342('0x16')](0xc8);}return _0x47d138[_0x3342('0x51')](path[_0x3342('0x5b')](config['root'],'server/files/reports',_0x54b41d[_0x3342('0x53')]),util['format'](_0x3342('0x5c'),_0x54b41d[_0x3342('0x52')]||_0x54b41d[_0x3342('0x26')],_0x54b41d[_0x3342('0x54')][_0x3342('0x5d')]()));}})['catch'](handleError(_0x47d138,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7421095..033013a 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 _0x43c6=['util','../../config/logger','api','bluebird','rimraf','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x3ff204,_0x46a3c4){var _0x2afc80=function(_0x28a464){while(--_0x28a464){_0x3ff204['push'](_0x3ff204['shift']());}};_0x2afc80(++_0x46a3c4);}(_0x43c6,0xa1));var _0x643c=function(_0xe15ae0,_0x3ff30c){_0xe15ae0=_0xe15ae0-0x0;var _0x5c77ad=_0x43c6[_0xe15ae0];return _0x5c77ad;};'use strict';var _=require(_0x643c('0x0'));var util=require(_0x643c('0x1'));var logger=require(_0x643c('0x2'))(_0x643c('0x3'));var moment=require('moment');var BPromise=require(_0x643c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x643c('0x5'));var config=require('../../config/environment');var attributes=require(_0x643c('0x6'));module['exports']=function(_0x1dadc4,_0x4ebce3){return _0x1dadc4['define'](_0x643c('0x7'),attributes,{'tableName':_0x643c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x424a=['request-promise','path','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird'];(function(_0x311dc8,_0x21c4be){var _0x3daad5=function(_0x2dfd16){while(--_0x2dfd16){_0x311dc8['push'](_0x311dc8['shift']());}};_0x3daad5(++_0x21c4be);}(_0x424a,0x1f3));var _0xa424=function(_0x2ff56b,_0x5df44a){_0x2ff56b=_0x2ff56b-0x0;var _0x44a7d7=_0x424a[_0x2ff56b];return _0x44a7d7;};'use strict';var _=require(_0xa424('0x0'));var util=require(_0xa424('0x1'));var logger=require('../../config/logger')(_0xa424('0x2'));var moment=require(_0xa424('0x3'));var BPromise=require(_0xa424('0x4'));var rp=require(_0xa424('0x5'));var fs=require('fs');var path=require(_0xa424('0x6'));var rimraf=require('rimraf');var config=require(_0xa424('0x7'));var attributes=require(_0xa424('0x8'));module['exports']=function(_0x55e9b5,_0x5bce1c){return _0x55e9b5[_0xa424('0x9')](_0xa424('0xa'),attributes,{'tableName':_0xa424('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 038bf2d..759d8db 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 _0x436f=['lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5b8317,_0x5e89cb){var _0x5ed04f=function(_0x1fe5bb){while(--_0x1fe5bb){_0x5b8317['push'](_0x5b8317['shift']());}};_0x5ed04f(++_0x5e89cb);}(_0x436f,0xbd));var _0xf436=function(_0x5948b5,_0x39dd07){_0x5948b5=_0x5948b5-0x0;var _0x534f6e=_0x436f[_0x5948b5];return _0x534f6e;};'use strict';var _=require(_0xf436('0x0'));var util=require('util');var moment=require(_0xf436('0x1'));var BPromise=require('bluebird');var rs=require(_0xf436('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf436('0x3'))['db'];var utils=require(_0xf436('0x4'));var logger=require(_0xf436('0x5'))('rpc');var config=require(_0xf436('0x6'));var jayson=require(_0xf436('0x7'));var client=jayson['client'][_0xf436('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x298375,_0x268769,_0x591819){return new BPromise(function(_0x401dbb,_0x1b53ea){return client[_0xf436('0x9')](_0x298375,_0x591819)[_0xf436('0xa')](function(_0x5693ce){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x268769,_0xf436('0xb'));logger[_0xf436('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x268769,_0xf436('0xb'),JSON[_0xf436('0xd')](_0x5693ce));if(_0x5693ce['error']){if(_0x5693ce[_0xf436('0xe')][_0xf436('0xf')]===0x1f4){logger['error'](_0xf436('0x10'),_0x268769,_0x5693ce['error'][_0xf436('0x11')]);return _0x1b53ea(_0x5693ce[_0xf436('0xe')][_0xf436('0x11')]);}logger[_0xf436('0xe')](_0xf436('0x10'),_0x268769,_0x5693ce[_0xf436('0xe')][_0xf436('0x11')]);return _0x401dbb(_0x5693ce[_0xf436('0xe')][_0xf436('0x11')]);}else{logger[_0xf436('0x12')](_0xf436('0x10'),_0x268769,'request\x20sent');_0x401dbb(_0x5693ce[_0xf436('0x13')][_0xf436('0x11')]);}})[_0xf436('0x14')](function(_0x458648){logger[_0xf436('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x268769,_0x458648);_0x1b53ea(_0x458648);});});} \ No newline at end of file +var _0x9095=['util','bluebird','randomstring','../../mysqldb','../../config/logger','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x3f00b9,_0x7b6cf){var _0x3c7e2c=function(_0x3d3128){while(--_0x3d3128){_0x3f00b9['push'](_0x3f00b9['shift']());}};_0x3c7e2c(++_0x7b6cf);}(_0x9095,0x155));var _0x5909=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x9095[_0x35af23];return _0x340506;};'use strict';var _=require(_0x5909('0x0'));var util=require(_0x5909('0x1'));var moment=require('moment');var BPromise=require(_0x5909('0x2'));var rs=require(_0x5909('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5909('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5909('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5909('0x6')][_0x5909('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cdf1b,_0x39c728,_0x3cd72d){return new BPromise(function(_0xba7a2d,_0x73054d){return client[_0x5909('0x8')](_0x4cdf1b,_0x3cd72d)[_0x5909('0x9')](function(_0x1e869e){logger[_0x5909('0xa')](_0x5909('0xb'),_0x39c728,_0x5909('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x39c728,_0x5909('0xc'),JSON['stringify'](_0x1e869e));if(_0x1e869e['error']){if(_0x1e869e[_0x5909('0xd')][_0x5909('0xe')]===0x1f4){logger[_0x5909('0xd')](_0x5909('0xb'),_0x39c728,_0x1e869e[_0x5909('0xd')][_0x5909('0xf')]);return _0x73054d(_0x1e869e[_0x5909('0xd')][_0x5909('0xf')]);}logger[_0x5909('0xd')](_0x5909('0xb'),_0x39c728,_0x1e869e[_0x5909('0xd')][_0x5909('0xf')]);return _0xba7a2d(_0x1e869e[_0x5909('0xd')]['message']);}else{logger[_0x5909('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x39c728,_0x5909('0xc'));_0xba7a2d(_0x1e869e[_0x5909('0x10')]['message']);}})[_0x5909('0x11')](function(_0x4a520c){logger[_0x5909('0xd')](_0x5909('0xb'),_0x39c728,_0x4a520c);_0x73054d(_0x4a520c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 71b6154..5aed301 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 _0xaafc=['/:id','show','/:id/download','download','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index','get'];(function(_0x1b4b7b,_0x31ca72){var _0x40ca6a=function(_0x4a058c){while(--_0x4a058c){_0x1b4b7b['push'](_0x1b4b7b['shift']());}};_0x40ca6a(++_0x31ca72);}(_0xaafc,0xb4));var _0xcaaf=function(_0x14650b,_0x4e7e56){_0x14650b=_0x14650b-0x0;var _0x58bf19=_0xaafc[_0x14650b];return _0x58bf19;};'use strict';var multer=require(_0xcaaf('0x0'));var util=require(_0xcaaf('0x1'));var path=require(_0xcaaf('0x2'));var timeout=require(_0xcaaf('0x3'));var express=require(_0xcaaf('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcaaf('0x5'));var config=require('../../config/environment');var controller=require(_0xcaaf('0x6'));router['get']('/',auth[_0xcaaf('0x7')](),controller[_0xcaaf('0x8')]);router[_0xcaaf('0x9')](_0xcaaf('0xa'),auth[_0xcaaf('0x7')](),controller[_0xcaaf('0xb')]);router[_0xcaaf('0x9')](_0xcaaf('0xc'),auth[_0xcaaf('0x7')](),controller[_0xcaaf('0xd')]);router['post']('/',auth[_0xcaaf('0x7')](),controller[_0xcaaf('0xe')]);router[_0xcaaf('0xf')](_0xcaaf('0xa'),auth[_0xcaaf('0x7')](),controller[_0xcaaf('0x10')]);router['delete'](_0xcaaf('0xa'),auth[_0xcaaf('0x7')](),controller[_0xcaaf('0x11')]);module[_0xcaaf('0x12')]=router; \ No newline at end of file +var _0xeef2=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','post','create','update','delete','destroy','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xeef2,0xfc));var _0x2eef=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xeef2[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x2eef('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2eef('0x1'));var express=require(_0x2eef('0x2'));var router=express[_0x2eef('0x3')]();var fs_extra=require(_0x2eef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2eef('0x5'));var config=require(_0x2eef('0x6'));var controller=require(_0x2eef('0x7'));router[_0x2eef('0x8')]('/',auth['isAuthenticated'](),controller[_0x2eef('0x9')]);router[_0x2eef('0x8')](_0x2eef('0xa'),auth['isAuthenticated'](),controller[_0x2eef('0xb')]);router[_0x2eef('0x8')](_0x2eef('0xc'),auth[_0x2eef('0xd')](),controller[_0x2eef('0xe')]);router[_0x2eef('0xf')]('/',auth[_0x2eef('0xd')](),controller[_0x2eef('0x10')]);router['put'](_0x2eef('0xa'),auth[_0x2eef('0xd')](),controller[_0x2eef('0x11')]);router[_0x2eef('0x12')]('/:id',auth[_0x2eef('0xd')](),controller[_0x2eef('0x13')]);module[_0x2eef('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 116870c..cf40f85 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 _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x11bf38,_0x213d7f){var _0x202699=function(_0x33659f){while(--_0x33659f){_0x11bf38['push'](_0x11bf38['shift']());}};_0x202699(++_0x213d7f);}(_0x814b,0x1a2));var _0xb814=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x814b[_0x51d129];return _0x44c377;};'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 +var _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x11d253,_0x384676){var _0x5c1aa5=function(_0x2aa1e3){while(--_0x2aa1e3){_0x11d253['push'](_0x11d253['shift']());}};_0x5c1aa5(++_0x384676);}(_0x7a54,0x106));var _0x47a5=function(_0x460653,_0x2367ed){_0x460653=_0x460653-0x0;var _0x3aaddf=_0x7a54[_0x460653];return _0x3aaddf;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('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 152ad6e..5443115 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 _0xa9e0=['util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','eml-format','rimraf','zip-dir','moment','mustache'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x28')]['bulkCreate'](_0x45c845[_0x0a9e('0x44')],{'raw':![],'individualHooks':!![]})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x21')]=function(_0x409789,_0x992c77){if(_0x409789[_0x0a9e('0x44')]['id']){delete _0x409789[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x409789[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x992c77,null))['then'](saveUpdates(_0x409789['body'],null))['then'](respondWithResult(_0x992c77,null))[_0x0a9e('0x40')](handleError(_0x992c77,null));};exports[_0x0a9e('0x23')]=function(_0x37edaa,_0x11545a){return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x37edaa[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x11545a,null))['then'](removeEntity(_0x11545a,null))['catch'](handleError(_0x11545a,null));};exports['bulkDestroy']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x28')]['destroy']({'where':{'id':_0x39d77d[_0x0a9e('0x2e')][_0x0a9e('0x46')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x204173,0xcc))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x47')]=function(_0x59c6ff,_0x443e72,_0x4c3845){return db[_0x0a9e('0x48')][_0x0a9e('0x49')]({'where':{'id':_0x59c6ff[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x443e72,null))[_0x0a9e('0x22')](function(_0x1bf38a){if(_0x1bf38a){return db['sequelize']['transaction'](function(_0x128aa6){return db[_0x0a9e('0x28')]['destroy']({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']},'transaction':_0x128aa6})['then'](function(_0x211ef9){var _0x523cd2=_[_0x0a9e('0x2d')](_0x59c6ff['body'],function(_0x5da27d){delete _0x5da27d['id'];_0x5da27d['CustomReportId']=_0x59c6ff[_0x0a9e('0x42')]['id'];return _0x5da27d;});return db['AnalyticFieldReport'][_0x0a9e('0x45')](_0x523cd2,{'transaction':_0x128aa6});});})[_0x0a9e('0x22')](function(){return db[_0x0a9e('0x28')][_0x0a9e('0x3f')]({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']}});});}})[_0x0a9e('0x22')](respondWithResult(_0x443e72,null))[_0x0a9e('0x40')](handleError(_0x443e72,null));}; \ No newline at end of file +var _0xa9e0=['util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','eml-format','rimraf','zip-dir','moment','mustache'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x28')]['bulkCreate'](_0x45c845[_0x0a9e('0x44')],{'raw':![],'individualHooks':!![]})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x21')]=function(_0x409789,_0x992c77){if(_0x409789[_0x0a9e('0x44')]['id']){delete _0x409789[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x409789[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x992c77,null))['then'](saveUpdates(_0x409789['body'],null))['then'](respondWithResult(_0x992c77,null))[_0x0a9e('0x40')](handleError(_0x992c77,null));};exports[_0x0a9e('0x23')]=function(_0x37edaa,_0x11545a){return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x37edaa[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x11545a,null))['then'](removeEntity(_0x11545a,null))['catch'](handleError(_0x11545a,null));};exports['bulkDestroy']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x28')]['destroy']({'where':{'id':_0x39d77d[_0x0a9e('0x2e')][_0x0a9e('0x46')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x204173,0xcc))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x47')]=function(_0x59c6ff,_0x443e72,_0x4c3845){return db[_0x0a9e('0x48')][_0x0a9e('0x49')]({'where':{'id':_0x59c6ff[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x443e72,null))[_0x0a9e('0x22')](function(_0x1bf38a){if(_0x1bf38a){return db['sequelize']['transaction'](function(_0x128aa6){return db[_0x0a9e('0x28')]['destroy']({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']},'transaction':_0x128aa6})['then'](function(_0x211ef9){var _0x523cd2=_[_0x0a9e('0x2d')](_0x59c6ff['body'],function(_0x5da27d){delete _0x5da27d['id'];_0x5da27d['CustomReportId']=_0x59c6ff[_0x0a9e('0x42')]['id'];return _0x5da27d;});return db['AnalyticFieldReport'][_0x0a9e('0x45')](_0x523cd2,{'transaction':_0x128aa6});});})[_0x0a9e('0x22')](function(){return db[_0x0a9e('0x28')][_0x0a9e('0x3f')]({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']}});});}})[_0x0a9e('0x22')](respondWithResult(_0x443e72,null))[_0x0a9e('0x40')](handleError(_0x443e72,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 35ce82d..4926891 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 _0x769e=['AnalyticFieldReport','analytics_report_fields','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x4ca12c,_0x1dfdbb){var _0x2350b2=function(_0x13cc5f){while(--_0x13cc5f){_0x4ca12c['push'](_0x4ca12c['shift']());}};_0x2350b2(++_0x1dfdbb);}(_0x769e,0x1e2));var _0xe769=function(_0x40b329,_0x5ead1f){_0x40b329=_0x40b329-0x0;var _0x309a2b=_0x769e[_0x40b329];return _0x309a2b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe769('0x0'));var BPromise=require(_0xe769('0x1'));var rp=require(_0xe769('0x2'));var fs=require('fs');var path=require(_0xe769('0x3'));var rimraf=require('rimraf');var config=require(_0xe769('0x4'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x573489,_0x43210a){return _0x573489[_0xe769('0x5')](_0xe769('0x6'),attributes,{'tableName':_0xe769('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3dc=['AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define'];(function(_0x4eaec6,_0x1ce76c){var _0x292be7=function(_0x5c5d66){while(--_0x5c5d66){_0x4eaec6['push'](_0x4eaec6['shift']());}};_0x292be7(++_0x1ce76c);}(_0xa3dc,0xd3));var _0xca3d=function(_0x554e16,_0x38f6a3){_0x554e16=_0x554e16-0x0;var _0x494c86=_0xa3dc[_0x554e16];return _0x494c86;};'use strict';var _=require(_0xca3d('0x0'));var util=require('util');var logger=require(_0xca3d('0x1'))('api');var moment=require(_0xca3d('0x2'));var BPromise=require(_0xca3d('0x3'));var rp=require(_0xca3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca3d('0x5'));var config=require(_0xca3d('0x6'));var attributes=require(_0xca3d('0x7'));module['exports']=function(_0x329506,_0x32e69c){return _0x329506[_0xca3d('0x8')](_0xca3d('0x9'),attributes,{'tableName':_0xca3d('0xa'),'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 31f1a40..ce08290 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 _0x290a=['error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x370d15,_0x31ef09){var _0x2304d1=function(_0x14b7cc){while(--_0x14b7cc){_0x370d15['push'](_0x370d15['shift']());}};_0x2304d1(++_0x31ef09);}(_0x290a,0x1e6));var _0xa290=function(_0x5b8b31,_0x14b4c4){_0x5b8b31=_0x5b8b31-0x0;var _0x995533=_0x290a[_0x5b8b31];return _0x995533;};'use strict';var _=require('lodash');var util=require(_0xa290('0x0'));var moment=require(_0xa290('0x1'));var BPromise=require(_0xa290('0x2'));var rs=require(_0xa290('0x3'));var fs=require('fs');var Redis=require(_0xa290('0x4'));var db=require(_0xa290('0x5'))['db'];var utils=require(_0xa290('0x6'));var logger=require(_0xa290('0x7'))(_0xa290('0x8'));var config=require(_0xa290('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa290('0xa')][_0xa290('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5759bc,_0x321c7d,_0x2e3a76){return new BPromise(function(_0x55216c,_0xc2b41a){return client[_0xa290('0xc')](_0x5759bc,_0x2e3a76)[_0xa290('0xd')](function(_0x52f4ad){logger['info'](_0xa290('0xe'),_0x321c7d,_0xa290('0xf'));logger[_0xa290('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x321c7d,_0xa290('0xf'),JSON[_0xa290('0x11')](_0x52f4ad));if(_0x52f4ad[_0xa290('0x12')]){if(_0x52f4ad['error'][_0xa290('0x13')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x321c7d,_0x52f4ad['error'][_0xa290('0x14')]);return _0xc2b41a(_0x52f4ad[_0xa290('0x12')][_0xa290('0x14')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x321c7d,_0x52f4ad[_0xa290('0x12')][_0xa290('0x14')]);return _0x55216c(_0x52f4ad['error'][_0xa290('0x14')]);}else{logger[_0xa290('0x15')](_0xa290('0xe'),_0x321c7d,_0xa290('0xf'));_0x55216c(_0x52f4ad[_0xa290('0x16')][_0xa290('0x14')]);}})[_0xa290('0x17')](function(_0x106124){logger['error'](_0xa290('0xe'),_0x321c7d,_0x106124);_0xc2b41a(_0x106124);});});} \ No newline at end of file +var _0xbfe6=['message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3bd6e5,_0x247f2c){var _0x111da7=function(_0x41222c){while(--_0x41222c){_0x3bd6e5['push'](_0x3bd6e5['shift']());}};_0x111da7(++_0x247f2c);}(_0xbfe6,0x158));var _0x6bfe=function(_0x33ff0c,_0x448c2a){_0x33ff0c=_0x33ff0c-0x0;var _0x44bdc2=_0xbfe6[_0x33ff0c];return _0x44bdc2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6bfe('0x0'));var rs=require(_0x6bfe('0x1'));var fs=require('fs');var Redis=require(_0x6bfe('0x2'));var db=require(_0x6bfe('0x3'))['db'];var utils=require(_0x6bfe('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6bfe('0x5'));var jayson=require(_0x6bfe('0x6'));var client=jayson[_0x6bfe('0x7')][_0x6bfe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37ef92,_0x4fc926,_0x14689c){return new BPromise(function(_0x27e9f9,_0x11c0d6){return client[_0x6bfe('0x9')](_0x37ef92,_0x14689c)[_0x6bfe('0xa')](function(_0x2d2844){logger[_0x6bfe('0xb')](_0x6bfe('0xc'),_0x4fc926,_0x6bfe('0xd'));logger[_0x6bfe('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x4fc926,'request\x20sent',JSON[_0x6bfe('0xf')](_0x2d2844));if(_0x2d2844[_0x6bfe('0x10')]){if(_0x2d2844[_0x6bfe('0x10')]['code']===0x1f4){logger['error'](_0x6bfe('0xc'),_0x4fc926,_0x2d2844['error'][_0x6bfe('0x11')]);return _0x11c0d6(_0x2d2844[_0x6bfe('0x10')]['message']);}logger[_0x6bfe('0x10')](_0x6bfe('0xc'),_0x4fc926,_0x2d2844['error'][_0x6bfe('0x11')]);return _0x27e9f9(_0x2d2844[_0x6bfe('0x10')][_0x6bfe('0x11')]);}else{logger[_0x6bfe('0xb')](_0x6bfe('0xc'),_0x4fc926,_0x6bfe('0xd'));_0x27e9f9(_0x2d2844[_0x6bfe('0x12')][_0x6bfe('0x11')]);}})['catch'](function(_0x45684b){logger[_0x6bfe('0x10')](_0x6bfe('0xc'),_0x4fc926,_0x45684b);_0x11c0d6(_0x45684b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4d9344b..41ec6f4 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 _0xcca6=['update','delete','bulkDestroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','/create_many','bulkCreate','addFields'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xcca6,0xcc));var _0x6cca=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xcca6[_0x382c73];return _0x1dd0bf;};'use strict';var multer=require(_0x6cca('0x0'));var util=require(_0x6cca('0x1'));var path=require(_0x6cca('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cca('0x3'));var router=express[_0x6cca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6cca('0x6'));var controller=require('./analyticFieldReport.controller');router['get']('/',auth[_0x6cca('0x7')](),controller[_0x6cca('0x8')]);router[_0x6cca('0x9')](_0x6cca('0xa'),auth[_0x6cca('0x7')](),controller[_0x6cca('0xb')]);router['post']('/',auth[_0x6cca('0x7')](),controller[_0x6cca('0xc')]);router['post'](_0x6cca('0xd'),auth[_0x6cca('0x7')](),controller[_0x6cca('0xe')]);router['post']('/:id/create_many',auth['isAuthenticated'](),controller[_0x6cca('0xf')]);router['put'](_0x6cca('0xa'),auth[_0x6cca('0x7')](),controller[_0x6cca('0x10')]);router[_0x6cca('0x11')]('/destroy_many',auth['isAuthenticated'](),controller[_0x6cca('0x12')]);router[_0x6cca('0x11')](_0x6cca('0xa'),auth[_0x6cca('0x7')](),controller['destroy']);module[_0x6cca('0x13')]=router; \ No newline at end of file +var _0x3c94=['get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','put','/:id','bulkDestroy','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x4eb6a5,_0x2e9070){var _0x7e2ece=function(_0x43e10b){while(--_0x43e10b){_0x4eb6a5['push'](_0x4eb6a5['shift']());}};_0x7e2ece(++_0x2e9070);}(_0x3c94,0x19a));var _0x43c9=function(_0x2dd628,_0x3c22e4){_0x2dd628=_0x2dd628-0x0;var _0x2e138c=_0x3c94[_0x2dd628];return _0x2e138c;};'use strict';var multer=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var path=require(_0x43c9('0x2'));var timeout=require(_0x43c9('0x3'));var express=require(_0x43c9('0x4'));var router=express[_0x43c9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x43c9('0x6'));var config=require('../../config/environment');var controller=require(_0x43c9('0x7'));router[_0x43c9('0x8')]('/',auth[_0x43c9('0x9')](),controller[_0x43c9('0xa')]);router['get']('/:id',auth[_0x43c9('0x9')](),controller[_0x43c9('0xb')]);router[_0x43c9('0xc')]('/',auth[_0x43c9('0x9')](),controller[_0x43c9('0xd')]);router[_0x43c9('0xc')](_0x43c9('0xe'),auth[_0x43c9('0x9')](),controller['bulkCreate']);router[_0x43c9('0xc')](_0x43c9('0xf'),auth[_0x43c9('0x9')](),controller['addFields']);router[_0x43c9('0x10')](_0x43c9('0x11'),auth[_0x43c9('0x9')](),controller['update']);router['delete']('/destroy_many',auth['isAuthenticated'](),controller[_0x43c9('0x12')]);router[_0x43c9('0x13')](_0x43c9('0x11'),auth['isAuthenticated'](),controller[_0x43c9('0x14')]);module[_0x43c9('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 91b59b4..81e1482 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 _0xc771=['STRING','name','TEXT','sequelize','exports'];(function(_0x5ae642,_0x3bd071){var _0x29a019=function(_0xebe837){while(--_0xebe837){_0x5ae642['push'](_0x5ae642['shift']());}};_0x29a019(++_0x3bd071);}(_0xc771,0x1d9));var _0x1c77=function(_0xa33a79,_0xa8021e){_0xa33a79=_0xa33a79-0x0;var _0xcd2c61=_0xc771[_0xa33a79];return _0xcd2c61;};'use strict';var Sequelize=require(_0x1c77('0x0'));module[_0x1c77('0x1')]={'name':{'type':Sequelize[_0x1c77('0x2')],'allowNull':![],'unique':_0x1c77('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x1c77('0x4')]},'description':{'type':Sequelize[_0x1c77('0x2')]}}; \ No newline at end of file +var _0x854f=['STRING','name','TEXT','sequelize','exports'];(function(_0x5b731c,_0x14118b){var _0x3c3ae2=function(_0x402ad0){while(--_0x402ad0){_0x5b731c['push'](_0x5b731c['shift']());}};_0x3c3ae2(++_0x14118b);}(_0x854f,0xc1));var _0xf854=function(_0x1e1d87,_0x567a72){_0x1e1d87=_0x1e1d87-0x0;var _0x571e5b=_0x854f[_0x1e1d87];return _0x571e5b;};'use strict';var Sequelize=require(_0xf854('0x0'));module[_0xf854('0x1')]={'name':{'type':Sequelize[_0xf854('0x2')],'allowNull':![],'unique':_0xf854('0x3')},'table':{'type':Sequelize[_0xf854('0x2')]},'metric':{'type':Sequelize[_0xf854('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b138536..ce53ccc 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 _0x55e9=['error','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','keys','merge','create','body','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','get','Metrics','UserProfileResource'];(function(_0x373eaa,_0x24f131){var _0x5a1b12=function(_0x39eb52){while(--_0x39eb52){_0x373eaa['push'](_0x373eaa['shift']());}};_0x5a1b12(++_0x24f131);}(_0x55e9,0xcd));var _0x955e=function(_0x2d36a6,_0x2f8cd0){_0x2d36a6=_0x2d36a6-0x0;var _0x59cec0=_0x55e9[_0x2d36a6];return _0x59cec0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x955e('0x0'));var zipdir=require(_0x955e('0x1'));var jsonpatch=require(_0x955e('0x2'));var rp=require(_0x955e('0x3'));var moment=require(_0x955e('0x4'));var BPromise=require(_0x955e('0x5'));var Mustache=require(_0x955e('0x6'));var util=require(_0x955e('0x7'));var path=require(_0x955e('0x8'));var sox=require(_0x955e('0x9'));var csv=require('to-csv');var ejs=require(_0x955e('0xa'));var fs=require('fs');var fs_extra=require(_0x955e('0xb'));var _=require(_0x955e('0xc'));var squel=require('squel');var crypto=require(_0x955e('0xd'));var jsforce=require(_0x955e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x955e('0xf'));var querystring=require(_0x955e('0x10'));var Papa=require(_0x955e('0x11'));var Redis=require(_0x955e('0x12'));var authService=require(_0x955e('0x13'));var qs=require(_0x955e('0x14'));var as=require(_0x955e('0x15'));var hardwareService=require(_0x955e('0x16'));var logger=require(_0x955e('0x17'))(_0x955e('0x18'));var utils=require(_0x955e('0x19'));var config=require(_0x955e('0x1a'));var licenseUtil=require(_0x955e('0x1b'));var db=require(_0x955e('0x1c'))['db'];function respondWithStatusCode(_0x30d3c6,_0x301f48){_0x301f48=_0x301f48||0xcc;return function(_0xe8132){if(_0xe8132){return _0x30d3c6[_0x955e('0x1d')](_0x301f48);}return _0x30d3c6[_0x955e('0x1e')](_0x301f48)['end']();};}function respondWithResult(_0x588ac5,_0x5acfca){_0x5acfca=_0x5acfca||0xc8;return function(_0x683fa4){if(_0x683fa4){return _0x588ac5[_0x955e('0x1e')](_0x5acfca)[_0x955e('0x1f')](_0x683fa4);}};}function respondWithFilteredResult(_0xe8a9eb,_0x14b2bc){return function(_0xb24016){if(_0xb24016){var _0xc464d2=typeof _0x14b2bc[_0x955e('0x20')]===_0x955e('0x21')&&typeof _0x14b2bc['limit']===_0x955e('0x21');var _0x207ba2=_0xb24016[_0x955e('0x22')];var _0x53973a=_0xc464d2?0x0:_0x14b2bc[_0x955e('0x20')];var _0xdc8e5e=_0xc464d2?_0xb24016[_0x955e('0x22')]:_0x14b2bc[_0x955e('0x20')]+_0x14b2bc['limit'];var _0x598d12;if(_0xdc8e5e>=_0x207ba2){_0xdc8e5e=_0x207ba2;_0x598d12=0xc8;}else{_0x598d12=0xce;}_0xe8a9eb[_0x955e('0x1e')](_0x598d12);return _0xe8a9eb['set'](_0x955e('0x23'),_0x53973a+'-'+_0xdc8e5e+'/'+_0x207ba2)['json'](_0xb24016);}return null;};}function patchUpdates(_0x56f826){return function(_0x56c0ec){try{jsonpatch[_0x955e('0x24')](_0x56c0ec,_0x56f826,!![]);}catch(_0x109bd0){return BPromise[_0x955e('0x25')](_0x109bd0);}return _0x56c0ec[_0x955e('0x26')]();};}function saveUpdates(_0xb604e7,_0x1593bb){return function(_0x3add7e){if(_0x3add7e){return _0x3add7e['update'](_0xb604e7)[_0x955e('0x27')](function(_0x153389){return _0x153389;});}return null;};}function removeEntity(_0x226e57,_0x5743a3){return function(_0x53b382){if(_0x53b382){return _0x53b382[_0x955e('0x28')]()[_0x955e('0x27')](function(){var _0x1548cc=_0x53b382[_0x955e('0x29')]({'plain':!![]});var _0x3cc7b7=_0x955e('0x2a');return db[_0x955e('0x2b')][_0x955e('0x28')]({'where':{'type':_0x3cc7b7,'resourceId':_0x1548cc['id']}})[_0x955e('0x27')](function(){return _0x53b382;});})['then'](function(){_0x226e57[_0x955e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x574cb8,_0x233c51){return function(_0x33e992){if(!_0x33e992){_0x574cb8['sendStatus'](0x194);}return _0x33e992;};}function handleError(_0x400941,_0x27e25d){_0x27e25d=_0x27e25d||0x1f4;return function(_0xfd897c){logger[_0x955e('0x2c')](_0xfd897c['stack']);if(_0xfd897c[_0x955e('0x2d')]){delete _0xfd897c[_0x955e('0x2d')];}_0x400941[_0x955e('0x1e')](_0x27e25d)[_0x955e('0x2e')](_0xfd897c);};}exports[_0x955e('0x2f')]=function(_0x3c693d,_0x2cba54){var _0x467349={},_0x1fc846={},_0x305868={'count':0x0,'rows':[]};var _0x39490a=_[_0x955e('0x30')](db[_0x955e('0x31')][_0x955e('0x32')],function(_0x30d311){return{'name':_0x30d311[_0x955e('0x33')],'type':_0x30d311[_0x955e('0x34')][_0x955e('0x35')]};});_0x1fc846['model']=_[_0x955e('0x30')](_0x39490a,_0x955e('0x2d'));_0x1fc846[_0x955e('0x36')]=_['keys'](_0x3c693d[_0x955e('0x36')]);_0x1fc846[_0x955e('0x37')]=_[_0x955e('0x38')](_0x1fc846[_0x955e('0x39')],_0x1fc846[_0x955e('0x36')]);_0x467349[_0x955e('0x3a')]=_[_0x955e('0x38')](_0x1fc846[_0x955e('0x39')],qs[_0x955e('0x3b')](_0x3c693d[_0x955e('0x36')][_0x955e('0x3b')]));_0x467349['attributes']=_0x467349[_0x955e('0x3a')][_0x955e('0x3c')]?_0x467349[_0x955e('0x3a')]:_0x1fc846['model'];if(!_0x3c693d['query']['hasOwnProperty'](_0x955e('0x3d'))){_0x467349[_0x955e('0x3e')]=qs['limit'](_0x3c693d[_0x955e('0x36')][_0x955e('0x3e')]);_0x467349['offset']=qs[_0x955e('0x20')](_0x3c693d[_0x955e('0x36')]['offset']);}_0x467349['order']=qs['sort'](_0x3c693d[_0x955e('0x36')]['sort']);_0x467349[_0x955e('0x3f')]=qs[_0x955e('0x37')](_['pick'](_0x3c693d[_0x955e('0x36')],_0x1fc846['filters']),_0x39490a);if(_0x3c693d[_0x955e('0x36')][_0x955e('0x40')]){_0x467349[_0x955e('0x3f')]=_['merge'](_0x467349['where'],{'$or':_[_0x955e('0x30')](_0x39490a,function(_0x56aa01){if(_0x56aa01['type']!==_0x955e('0x41')){var _0x40ce5a={};_0x40ce5a[_0x56aa01[_0x955e('0x2d')]]={'$like':'%'+_0x3c693d['query'][_0x955e('0x40')]+'%'};return _0x40ce5a;}})});}_0x467349=_['merge']({},_0x467349,_0x3c693d[_0x955e('0x42')]);var _0x2f8382={'where':_0x467349[_0x955e('0x3f')]};return db[_0x955e('0x31')][_0x955e('0x22')](_0x2f8382)[_0x955e('0x27')](function(_0x93644d){_0x305868['count']=_0x93644d;if(_0x3c693d[_0x955e('0x36')][_0x955e('0x43')]){_0x467349[_0x955e('0x44')]=[{'all':!![]}];}return db[_0x955e('0x31')][_0x955e('0x45')](_0x467349);})['then'](function(_0xa6e85f){_0x305868['rows']=_0xa6e85f;return _0x305868;})[_0x955e('0x27')](respondWithFilteredResult(_0x2cba54,_0x467349))[_0x955e('0x46')](handleError(_0x2cba54,null));};exports['show']=function(_0x27a173,_0x4c8f74){var _0x59d887={'raw':!![],'where':{'id':_0x27a173['params']['id']}},_0x59be84={};_0x59be84[_0x955e('0x39')]=_[_0x955e('0x47')](db[_0x955e('0x31')][_0x955e('0x32')]);_0x59be84[_0x955e('0x36')]=_[_0x955e('0x47')](_0x27a173[_0x955e('0x36')]);_0x59be84[_0x955e('0x37')]=_[_0x955e('0x38')](_0x59be84[_0x955e('0x39')],_0x59be84[_0x955e('0x36')]);_0x59d887[_0x955e('0x3a')]=_[_0x955e('0x38')](_0x59be84[_0x955e('0x39')],qs[_0x955e('0x3b')](_0x27a173[_0x955e('0x36')]['fields']));_0x59d887['attributes']=_0x59d887[_0x955e('0x3a')][_0x955e('0x3c')]?_0x59d887[_0x955e('0x3a')]:_0x59be84[_0x955e('0x39')];if(_0x27a173[_0x955e('0x36')][_0x955e('0x43')]){_0x59d887[_0x955e('0x44')]=[{'all':!![]}];}_0x59d887=_[_0x955e('0x48')]({},_0x59d887,_0x27a173[_0x955e('0x42')]);return db[_0x955e('0x31')]['find'](_0x59d887)[_0x955e('0x27')](handleEntityNotFound(_0x4c8f74,null))[_0x955e('0x27')](respondWithResult(_0x4c8f74,null))['catch'](handleError(_0x4c8f74,null));};exports[_0x955e('0x49')]=function(_0x5d7f28,_0x738a9a){return db[_0x955e('0x31')][_0x955e('0x49')](_0x5d7f28[_0x955e('0x4a')],{})['then'](function(_0x2b2ec9){var _0x1dd30e=_0x5d7f28['user']['get']({'plain':!![]});if(!_0x1dd30e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1dd30e[_0x955e('0x4b')]==='user'){var _0x4864d8=_0x2b2ec9['get']({'plain':!![]});var _0xddc753=_0x955e('0x2a');return db[_0x955e('0x4c')][_0x955e('0x4d')]({'where':{'name':_0xddc753,'userProfileId':_0x1dd30e[_0x955e('0x4e')]},'raw':!![]})[_0x955e('0x27')](function(_0x537867){if(_0x537867&&_0x537867[_0x955e('0x4f')]===0x0){return db['UserProfileResource'][_0x955e('0x49')]({'name':_0x4864d8[_0x955e('0x2d')],'resourceId':_0x4864d8['id'],'type':_0x537867[_0x955e('0x2d')],'sectionId':_0x537867['id']},{})[_0x955e('0x27')](function(){return _0x2b2ec9;});}else{return _0x2b2ec9;}})['catch'](function(_0x2c5fa9){logger['error'](_0x955e('0x50'),_0x2c5fa9);throw _0x2c5fa9;});}return _0x2b2ec9;})[_0x955e('0x27')](respondWithResult(_0x738a9a,0xc9))[_0x955e('0x46')](handleError(_0x738a9a,null));};exports[_0x955e('0x51')]=function(_0x4ba5aa,_0x31bc32){if(_0x4ba5aa[_0x955e('0x4a')]['id']){delete _0x4ba5aa[_0x955e('0x4a')]['id'];}return db[_0x955e('0x31')][_0x955e('0x4d')]({'where':{'id':_0x4ba5aa[_0x955e('0x52')]['id']}})[_0x955e('0x27')](handleEntityNotFound(_0x31bc32,null))['then'](saveUpdates(_0x4ba5aa[_0x955e('0x4a')],null))[_0x955e('0x27')](respondWithResult(_0x31bc32,null))['catch'](handleError(_0x31bc32,null));};exports[_0x955e('0x28')]=function(_0x11609d,_0x3e897d){return db[_0x955e('0x31')][_0x955e('0x4d')]({'where':{'id':_0x11609d[_0x955e('0x52')]['id']}})[_0x955e('0x27')](handleEntityNotFound(_0x3e897d,null))[_0x955e('0x27')](removeEntity(_0x3e897d,null))[_0x955e('0x46')](handleError(_0x3e897d,null));}; \ No newline at end of file +var _0x3b61=['status','error','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','options','findAll','show','params','include','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','get','Metrics'];(function(_0x379b1f,_0x2bf2f8){var _0x4c663c=function(_0x21b99d){while(--_0x21b99d){_0x379b1f['push'](_0x379b1f['shift']());}};_0x4c663c(++_0x2bf2f8);}(_0x3b61,0xd2));var _0x13b6=function(_0x391c01,_0x8a4737){_0x391c01=_0x391c01-0x0;var _0x21b62a=_0x3b61[_0x391c01];return _0x21b62a;};'use strict';var emlformat=require(_0x13b6('0x0'));var rimraf=require(_0x13b6('0x1'));var zipdir=require(_0x13b6('0x2'));var jsonpatch=require(_0x13b6('0x3'));var rp=require(_0x13b6('0x4'));var moment=require(_0x13b6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x13b6('0x6'));var util=require(_0x13b6('0x7'));var path=require(_0x13b6('0x8'));var sox=require(_0x13b6('0x9'));var csv=require(_0x13b6('0xa'));var ejs=require(_0x13b6('0xb'));var fs=require('fs');var fs_extra=require(_0x13b6('0xc'));var _=require(_0x13b6('0xd'));var squel=require(_0x13b6('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x13b6('0xf'));var toCsv=require(_0x13b6('0xa'));var querystring=require(_0x13b6('0x10'));var Papa=require(_0x13b6('0x11'));var Redis=require('ioredis');var authService=require(_0x13b6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x13b6('0x13'));var hardwareService=require(_0x13b6('0x14'));var logger=require(_0x13b6('0x15'))(_0x13b6('0x16'));var utils=require(_0x13b6('0x17'));var config=require(_0x13b6('0x18'));var licenseUtil=require(_0x13b6('0x19'));var db=require(_0x13b6('0x1a'))['db'];function respondWithStatusCode(_0x1cebd1,_0x47f523){_0x47f523=_0x47f523||0xcc;return function(_0x507898){if(_0x507898){return _0x1cebd1[_0x13b6('0x1b')](_0x47f523);}return _0x1cebd1['status'](_0x47f523)[_0x13b6('0x1c')]();};}function respondWithResult(_0x33f9b9,_0x5e027b){_0x5e027b=_0x5e027b||0xc8;return function(_0x364791){if(_0x364791){return _0x33f9b9['status'](_0x5e027b)['json'](_0x364791);}};}function respondWithFilteredResult(_0x14b6c1,_0x1b7833){return function(_0x2c45f2){if(_0x2c45f2){var _0x2f6558=typeof _0x1b7833[_0x13b6('0x1d')]===_0x13b6('0x1e')&&typeof _0x1b7833[_0x13b6('0x1f')]==='undefined';var _0x390088=_0x2c45f2[_0x13b6('0x20')];var _0x514eb9=_0x2f6558?0x0:_0x1b7833[_0x13b6('0x1d')];var _0xc68255=_0x2f6558?_0x2c45f2[_0x13b6('0x20')]:_0x1b7833[_0x13b6('0x1d')]+_0x1b7833[_0x13b6('0x1f')];var _0x1e755a;if(_0xc68255>=_0x390088){_0xc68255=_0x390088;_0x1e755a=0xc8;}else{_0x1e755a=0xce;}_0x14b6c1['status'](_0x1e755a);return _0x14b6c1[_0x13b6('0x21')]('Content-Range',_0x514eb9+'-'+_0xc68255+'/'+_0x390088)[_0x13b6('0x22')](_0x2c45f2);}return null;};}function patchUpdates(_0x4567a5){return function(_0x44cc93){try{jsonpatch[_0x13b6('0x23')](_0x44cc93,_0x4567a5,!![]);}catch(_0x1c258a){return BPromise[_0x13b6('0x24')](_0x1c258a);}return _0x44cc93['save']();};}function saveUpdates(_0x5b4ce8,_0x2cf692){return function(_0x5618fa){if(_0x5618fa){return _0x5618fa[_0x13b6('0x25')](_0x5b4ce8)[_0x13b6('0x26')](function(_0x5bb90f){return _0x5bb90f;});}return null;};}function removeEntity(_0x53eb32,_0x18afc8){return function(_0x47ca44){if(_0x47ca44){return _0x47ca44[_0x13b6('0x27')]()['then'](function(){var _0x7f601c=_0x47ca44[_0x13b6('0x28')]({'plain':!![]});var _0x58543c=_0x13b6('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x58543c,'resourceId':_0x7f601c['id']}})[_0x13b6('0x26')](function(){return _0x47ca44;});})[_0x13b6('0x26')](function(){_0x53eb32[_0x13b6('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x536edb,_0x24ca47){return function(_0x2e78ee){if(!_0x2e78ee){_0x536edb[_0x13b6('0x1b')](0x194);}return _0x2e78ee;};}function handleError(_0x2fd32b,_0x48f91d){_0x48f91d=_0x48f91d||0x1f4;return function(_0x5d76d3){logger[_0x13b6('0x2b')](_0x5d76d3['stack']);if(_0x5d76d3[_0x13b6('0x2c')]){delete _0x5d76d3[_0x13b6('0x2c')];}_0x2fd32b[_0x13b6('0x2a')](_0x48f91d)[_0x13b6('0x2d')](_0x5d76d3);};}exports[_0x13b6('0x2e')]=function(_0x1d5a66,_0x17e39d){var _0x61cd2d={},_0x1f7208={},_0x1f0d95={'count':0x0,'rows':[]};var _0x2626e3=_['map'](db[_0x13b6('0x2f')][_0x13b6('0x30')],function(_0x2774d7){return{'name':_0x2774d7[_0x13b6('0x31')],'type':_0x2774d7[_0x13b6('0x32')][_0x13b6('0x33')]};});_0x1f7208[_0x13b6('0x34')]=_[_0x13b6('0x35')](_0x2626e3,_0x13b6('0x2c'));_0x1f7208[_0x13b6('0x36')]=_[_0x13b6('0x37')](_0x1d5a66[_0x13b6('0x36')]);_0x1f7208[_0x13b6('0x38')]=_[_0x13b6('0x39')](_0x1f7208[_0x13b6('0x34')],_0x1f7208[_0x13b6('0x36')]);_0x61cd2d[_0x13b6('0x3a')]=_[_0x13b6('0x39')](_0x1f7208[_0x13b6('0x34')],qs['fields'](_0x1d5a66[_0x13b6('0x36')][_0x13b6('0x3b')]));_0x61cd2d[_0x13b6('0x3a')]=_0x61cd2d[_0x13b6('0x3a')][_0x13b6('0x3c')]?_0x61cd2d['attributes']:_0x1f7208['model'];if(!_0x1d5a66[_0x13b6('0x36')]['hasOwnProperty'](_0x13b6('0x3d'))){_0x61cd2d[_0x13b6('0x1f')]=qs['limit'](_0x1d5a66['query'][_0x13b6('0x1f')]);_0x61cd2d['offset']=qs[_0x13b6('0x1d')](_0x1d5a66['query'][_0x13b6('0x1d')]);}_0x61cd2d[_0x13b6('0x3e')]=qs[_0x13b6('0x3f')](_0x1d5a66[_0x13b6('0x36')][_0x13b6('0x3f')]);_0x61cd2d['where']=qs['filters'](_['pick'](_0x1d5a66['query'],_0x1f7208[_0x13b6('0x38')]),_0x2626e3);if(_0x1d5a66[_0x13b6('0x36')][_0x13b6('0x40')]){_0x61cd2d['where']=_[_0x13b6('0x41')](_0x61cd2d[_0x13b6('0x42')],{'$or':_['map'](_0x2626e3,function(_0x5d27c6){if(_0x5d27c6[_0x13b6('0x32')]!==_0x13b6('0x43')){var _0x437231={};_0x437231[_0x5d27c6['name']]={'$like':'%'+_0x1d5a66[_0x13b6('0x36')][_0x13b6('0x40')]+'%'};return _0x437231;}})});}_0x61cd2d=_[_0x13b6('0x41')]({},_0x61cd2d,_0x1d5a66[_0x13b6('0x44')]);var _0x34c2a7={'where':_0x61cd2d[_0x13b6('0x42')]};return db[_0x13b6('0x2f')][_0x13b6('0x20')](_0x34c2a7)[_0x13b6('0x26')](function(_0x1b6483){_0x1f0d95[_0x13b6('0x20')]=_0x1b6483;if(_0x1d5a66[_0x13b6('0x36')]['includeAll']){_0x61cd2d['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0x13b6('0x45')](_0x61cd2d);})[_0x13b6('0x26')](function(_0x1ac257){_0x1f0d95['rows']=_0x1ac257;return _0x1f0d95;})[_0x13b6('0x26')](respondWithFilteredResult(_0x17e39d,_0x61cd2d))['catch'](handleError(_0x17e39d,null));};exports[_0x13b6('0x46')]=function(_0x1080eb,_0x287445){var _0x319039={'raw':!![],'where':{'id':_0x1080eb[_0x13b6('0x47')]['id']}},_0x305ddd={};_0x305ddd[_0x13b6('0x34')]=_[_0x13b6('0x37')](db[_0x13b6('0x2f')][_0x13b6('0x30')]);_0x305ddd[_0x13b6('0x36')]=_['keys'](_0x1080eb['query']);_0x305ddd[_0x13b6('0x38')]=_[_0x13b6('0x39')](_0x305ddd['model'],_0x305ddd[_0x13b6('0x36')]);_0x319039[_0x13b6('0x3a')]=_[_0x13b6('0x39')](_0x305ddd[_0x13b6('0x34')],qs['fields'](_0x1080eb[_0x13b6('0x36')][_0x13b6('0x3b')]));_0x319039[_0x13b6('0x3a')]=_0x319039['attributes'][_0x13b6('0x3c')]?_0x319039[_0x13b6('0x3a')]:_0x305ddd[_0x13b6('0x34')];if(_0x1080eb['query']['includeAll']){_0x319039[_0x13b6('0x48')]=[{'all':!![]}];}_0x319039=_[_0x13b6('0x41')]({},_0x319039,_0x1080eb['options']);return db['AnalyticMetric']['find'](_0x319039)['then'](handleEntityNotFound(_0x287445,null))[_0x13b6('0x26')](respondWithResult(_0x287445,null))[_0x13b6('0x49')](handleError(_0x287445,null));};exports['create']=function(_0x1b0bae,_0x4112d8){return db[_0x13b6('0x2f')]['create'](_0x1b0bae[_0x13b6('0x4a')],{})['then'](function(_0x567946){var _0x3d02da=_0x1b0bae['user'][_0x13b6('0x28')]({'plain':!![]});if(!_0x3d02da)throw new Error(_0x13b6('0x4b'));if(_0x3d02da[_0x13b6('0x4c')]===_0x13b6('0x4d')){var _0x5d3c88=_0x567946[_0x13b6('0x28')]({'plain':!![]});var _0x543c93=_0x13b6('0x29');return db[_0x13b6('0x4e')][_0x13b6('0x4f')]({'where':{'name':_0x543c93,'userProfileId':_0x3d02da[_0x13b6('0x50')]},'raw':!![]})[_0x13b6('0x26')](function(_0x5451db){if(_0x5451db&&_0x5451db[_0x13b6('0x51')]===0x0){return db['UserProfileResource'][_0x13b6('0x52')]({'name':_0x5d3c88[_0x13b6('0x2c')],'resourceId':_0x5d3c88['id'],'type':_0x5451db[_0x13b6('0x2c')],'sectionId':_0x5451db['id']},{})['then'](function(){return _0x567946;});}else{return _0x567946;}})[_0x13b6('0x49')](function(_0x4f1670){logger[_0x13b6('0x2b')](_0x13b6('0x53'),_0x4f1670);throw _0x4f1670;});}return _0x567946;})[_0x13b6('0x26')](respondWithResult(_0x4112d8,0xc9))[_0x13b6('0x49')](handleError(_0x4112d8,null));};exports[_0x13b6('0x25')]=function(_0x26ba0c,_0xb89e34){if(_0x26ba0c['body']['id']){delete _0x26ba0c[_0x13b6('0x4a')]['id'];}return db[_0x13b6('0x2f')][_0x13b6('0x4f')]({'where':{'id':_0x26ba0c['params']['id']}})[_0x13b6('0x26')](handleEntityNotFound(_0xb89e34,null))['then'](saveUpdates(_0x26ba0c[_0x13b6('0x4a')],null))[_0x13b6('0x26')](respondWithResult(_0xb89e34,null))[_0x13b6('0x49')](handleError(_0xb89e34,null));};exports[_0x13b6('0x27')]=function(_0x580e80,_0x203952){return db[_0x13b6('0x2f')][_0x13b6('0x4f')]({'where':{'id':_0x580e80[_0x13b6('0x47')]['id']}})[_0x13b6('0x26')](handleEntityNotFound(_0x203952,null))[_0x13b6('0x26')](removeEntity(_0x203952,null))[_0x13b6('0x49')](handleError(_0x203952,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 44e05c4..b54fa9a 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 _0x43b7=['request-promise','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','api','moment'];(function(_0x38a74f,_0x338460){var _0x346506=function(_0x1f4b03){while(--_0x1f4b03){_0x38a74f['push'](_0x38a74f['shift']());}};_0x346506(++_0x338460);}(_0x43b7,0x13c));var _0x743b=function(_0x13fe48,_0x437d73){_0x13fe48=_0x13fe48-0x0;var _0x160e83=_0x43b7[_0x13fe48];return _0x160e83;};'use strict';var _=require(_0x743b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x743b('0x1'));var moment=require(_0x743b('0x2'));var BPromise=require('bluebird');var rp=require(_0x743b('0x3'));var fs=require('fs');var path=require(_0x743b('0x4'));var rimraf=require(_0x743b('0x5'));var config=require('../../config/environment');var attributes=require(_0x743b('0x6'));module[_0x743b('0x7')]=function(_0x1eecd8,_0x559368){return _0x1eecd8[_0x743b('0x8')](_0x743b('0x9'),attributes,{'tableName':_0x743b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb785=['moment','bluebird','request-promise','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api'];(function(_0xd6e779,_0x16fdf6){var _0x1bf584=function(_0x318f65){while(--_0x318f65){_0xd6e779['push'](_0xd6e779['shift']());}};_0x1bf584(++_0x16fdf6);}(_0xb785,0x195));var _0x5b78=function(_0x2b5bd8,_0x2479e2){_0x2b5bd8=_0x2b5bd8-0x0;var _0x18b545=_0xb785[_0x2b5bd8];return _0x18b545;};'use strict';var _=require(_0x5b78('0x0'));var util=require('util');var logger=require(_0x5b78('0x1'))(_0x5b78('0x2'));var moment=require(_0x5b78('0x3'));var BPromise=require(_0x5b78('0x4'));var rp=require(_0x5b78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b78('0x6'));var config=require('../../config/environment');var attributes=require(_0x5b78('0x7'));module[_0x5b78('0x8')]=function(_0x4e2932,_0x334a7e){return _0x4e2932[_0x5b78('0x9')](_0x5b78('0xa'),attributes,{'tableName':_0x5b78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index a0513e9..fc0d805 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 _0xbaf3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xbaf3,0xd7));var _0x3baf=function(_0x4858b0,_0x9dea28){_0x4858b0=_0x4858b0-0x0;var _0x5b05b5=_0xbaf3[_0x4858b0];return _0x5b05b5;};'use strict';var _=require(_0x3baf('0x0'));var util=require('util');var moment=require(_0x3baf('0x1'));var BPromise=require(_0x3baf('0x2'));var rs=require(_0x3baf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3baf('0x4'))['db'];var utils=require(_0x3baf('0x5'));var logger=require(_0x3baf('0x6'))(_0x3baf('0x7'));var config=require(_0x3baf('0x8'));var jayson=require(_0x3baf('0x9'));var client=jayson[_0x3baf('0xa')][_0x3baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x92c93,_0x236365,_0x524aa7){return new BPromise(function(_0xc932c6,_0x49ae51){return client['request'](_0x92c93,_0x524aa7)[_0x3baf('0xc')](function(_0x172fdf){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x236365,_0x3baf('0xd'));logger[_0x3baf('0xe')](_0x3baf('0xf'),_0x236365,'request\x20sent',JSON['stringify'](_0x172fdf));if(_0x172fdf[_0x3baf('0x10')]){if(_0x172fdf['error'][_0x3baf('0x11')]===0x1f4){logger[_0x3baf('0x10')](_0x3baf('0x12'),_0x236365,_0x172fdf['error'][_0x3baf('0x13')]);return _0x49ae51(_0x172fdf['error'][_0x3baf('0x13')]);}logger[_0x3baf('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x236365,_0x172fdf['error'][_0x3baf('0x13')]);return _0xc932c6(_0x172fdf[_0x3baf('0x10')]['message']);}else{logger['info'](_0x3baf('0x12'),_0x236365,_0x3baf('0xd'));_0xc932c6(_0x172fdf[_0x3baf('0x14')][_0x3baf('0x13')]);}})[_0x3baf('0x15')](function(_0xa98715){logger[_0x3baf('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x236365,_0xa98715);_0x49ae51(_0xa98715);});});} \ No newline at end of file +var _0x43d3=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','info','result'];(function(_0x44dfb7,_0x70cde4){var _0x410fda=function(_0x364a0a){while(--_0x364a0a){_0x44dfb7['push'](_0x44dfb7['shift']());}};_0x410fda(++_0x70cde4);}(_0x43d3,0x181));var _0x343d=function(_0x30fbd1,_0x49cb8b){_0x30fbd1=_0x30fbd1-0x0;var _0x3492f5=_0x43d3[_0x30fbd1];return _0x3492f5;};'use strict';var _=require(_0x343d('0x0'));var util=require(_0x343d('0x1'));var moment=require('moment');var BPromise=require(_0x343d('0x2'));var rs=require(_0x343d('0x3'));var fs=require('fs');var Redis=require(_0x343d('0x4'));var db=require(_0x343d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x343d('0x6'))(_0x343d('0x7'));var config=require(_0x343d('0x8'));var jayson=require(_0x343d('0x9'));var client=jayson[_0x343d('0xa')][_0x343d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcea011,_0x45a58f,_0x5990ad){return new BPromise(function(_0x4b4355,_0x30a81b){return client[_0x343d('0xc')](_0xcea011,_0x5990ad)[_0x343d('0xd')](function(_0x156c47){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x45a58f,_0x343d('0xe'));logger[_0x343d('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x45a58f,_0x343d('0xe'),JSON[_0x343d('0x10')](_0x156c47));if(_0x156c47[_0x343d('0x11')]){if(_0x156c47[_0x343d('0x11')][_0x343d('0x12')]===0x1f4){logger['error'](_0x343d('0x13'),_0x45a58f,_0x156c47[_0x343d('0x11')]['message']);return _0x30a81b(_0x156c47[_0x343d('0x11')][_0x343d('0x14')]);}logger['error'](_0x343d('0x13'),_0x45a58f,_0x156c47[_0x343d('0x11')][_0x343d('0x14')]);return _0x4b4355(_0x156c47[_0x343d('0x11')][_0x343d('0x14')]);}else{logger[_0x343d('0x15')](_0x343d('0x13'),_0x45a58f,_0x343d('0xe'));_0x4b4355(_0x156c47[_0x343d('0x16')][_0x343d('0x14')]);}})[_0x343d('0x17')](function(_0x2b3966){logger[_0x343d('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x45a58f,_0x2b3966);_0x30a81b(_0x2b3966);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 1ed9c4d..ac31869 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 _0xbdb7=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','index','get','show','post','put','/:id','isAuthenticated','update'];(function(_0x5427c8,_0x18f384){var _0x33a129=function(_0x1940e8){while(--_0x1940e8){_0x5427c8['push'](_0x5427c8['shift']());}};_0x33a129(++_0x18f384);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xc8a02c,_0x4809d3){_0xc8a02c=_0xc8a02c-0x0;var _0x3d89da=_0xbdb7[_0xc8a02c];return _0x3d89da;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7bdb('0xe')](_0x7bdb('0xf'),auth[_0x7bdb('0x10')](),controller[_0x7bdb('0x11')]);router[_0x7bdb('0x12')](_0x7bdb('0xf'),auth[_0x7bdb('0x10')](),controller[_0x7bdb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea28,0x13a));var _0x8ea2=function(_0x17d94d,_0x1bc515){_0x17d94d=_0x17d94d-0x0;var _0x5c170d=_0xea28[_0x17d94d];return _0x5c170d;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index fb067f8..49e81bf 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 _0xf3ff=['sequelize','exports','TEXT'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xf3ff,0x10b));var _0xff3f=function(_0x541665,_0x334c41){_0x541665=_0x541665-0x0;var _0x3b6923=_0xf3ff[_0x541665];return _0x3b6923;};'use strict';var Sequelize=require(_0xff3f('0x0'));module[_0xff3f('0x1')]={'tree':{'type':Sequelize[_0xff3f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc9e1=['exports','TEXT','sequelize'];(function(_0xbfd9c3,_0xa9451d){var _0x3c2992=function(_0x2e24f1){while(--_0x2e24f1){_0xbfd9c3['push'](_0xbfd9c3['shift']());}};_0x3c2992(++_0xa9451d);}(_0xc9e1,0x74));var _0x1c9e=function(_0x225535,_0x16132c){_0x225535=_0x225535-0x0;var _0x1a7328=_0xc9e1[_0x225535];return _0x1a7328;};'use strict';var Sequelize=require(_0x1c9e('0x0'));module[_0x1c9e('0x1')]={'tree':{'type':Sequelize[_0x1c9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 64cedd0..1939e17 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 _0x67b1=['end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x67b1,0x15d));var _0x167b=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x67b1[_0x28e74e];return _0xb45ac1;};'use strict';var emlformat=require(_0x167b('0x0'));var rimraf=require(_0x167b('0x1'));var zipdir=require(_0x167b('0x2'));var jsonpatch=require(_0x167b('0x3'));var rp=require(_0x167b('0x4'));var moment=require(_0x167b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x167b('0x6'));var util=require(_0x167b('0x7'));var path=require(_0x167b('0x8'));var sox=require(_0x167b('0x9'));var csv=require(_0x167b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x167b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x167b('0xc'));var jsforce=require(_0x167b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x167b('0xa'));var querystring=require(_0x167b('0xe'));var Papa=require(_0x167b('0xf'));var Redis=require('ioredis');var authService=require(_0x167b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x167b('0x11'));var hardwareService=require(_0x167b('0x12'));var logger=require(_0x167b('0x13'))(_0x167b('0x14'));var utils=require(_0x167b('0x15'));var config=require(_0x167b('0x16'));var licenseUtil=require(_0x167b('0x17'));var db=require(_0x167b('0x18'))['db'];function respondWithStatusCode(_0x508988,_0x1c4c72){_0x1c4c72=_0x1c4c72||0xcc;return function(_0x557ed2){if(_0x557ed2){return _0x508988['sendStatus'](_0x1c4c72);}return _0x508988[_0x167b('0x19')](_0x1c4c72)[_0x167b('0x1a')]();};}function respondWithResult(_0x28f869,_0x59cc38){_0x59cc38=_0x59cc38||0xc8;return function(_0x441d52){if(_0x441d52){return _0x28f869['status'](_0x59cc38)[_0x167b('0x1b')](_0x441d52);}};}function respondWithFilteredResult(_0x52d387,_0x27dae6){return function(_0x4e6198){if(_0x4e6198){var _0x45b52e=typeof _0x27dae6[_0x167b('0x1c')]===_0x167b('0x1d')&&typeof _0x27dae6['limit']===_0x167b('0x1d');var _0x1133f2=_0x4e6198['count'];var _0x126300=_0x45b52e?0x0:_0x27dae6[_0x167b('0x1c')];var _0x377be5=_0x45b52e?_0x4e6198[_0x167b('0x1e')]:_0x27dae6['offset']+_0x27dae6[_0x167b('0x1f')];var _0x20a340;if(_0x377be5>=_0x1133f2){_0x377be5=_0x1133f2;_0x20a340=0xc8;}else{_0x20a340=0xce;}_0x52d387[_0x167b('0x19')](_0x20a340);return _0x52d387[_0x167b('0x20')](_0x167b('0x21'),_0x126300+'-'+_0x377be5+'/'+_0x1133f2)[_0x167b('0x1b')](_0x4e6198);}return null;};}function patchUpdates(_0x262806){return function(_0x732f43){try{jsonpatch[_0x167b('0x22')](_0x732f43,_0x262806,!![]);}catch(_0xcc14a5){return BPromise['reject'](_0xcc14a5);}return _0x732f43['save']();};}function saveUpdates(_0x14e381,_0x526289){return function(_0x3216a3){if(_0x3216a3){return _0x3216a3[_0x167b('0x23')](_0x14e381)[_0x167b('0x24')](function(_0x4f3160){return _0x4f3160;});}return null;};}function removeEntity(_0x254ab,_0x39a6bc){return function(_0xae0bc0){if(_0xae0bc0){return _0xae0bc0[_0x167b('0x25')]()[_0x167b('0x24')](function(){_0x254ab[_0x167b('0x19')](0xcc)[_0x167b('0x1a')]();});}};}function handleEntityNotFound(_0x4271fb,_0x4e279c){return function(_0xc7aba2){if(!_0xc7aba2){_0x4271fb['sendStatus'](0x194);}return _0xc7aba2;};}function handleError(_0x2589ee,_0x41bebc){_0x41bebc=_0x41bebc||0x1f4;return function(_0x25ce81){logger[_0x167b('0x26')](_0x25ce81[_0x167b('0x27')]);if(_0x25ce81[_0x167b('0x28')]){delete _0x25ce81[_0x167b('0x28')];}_0x2589ee[_0x167b('0x19')](_0x41bebc)[_0x167b('0x29')](_0x25ce81);};}exports[_0x167b('0x2a')]=function(_0x4ba2a2,_0x48aef4){var _0x18cc4c={},_0x593c77={},_0x3a4b70={'count':0x0,'rows':[]};var _0xf91dc7=_[_0x167b('0x2b')](db[_0x167b('0x2c')][_0x167b('0x2d')],function(_0x4f6c64){return{'name':_0x4f6c64[_0x167b('0x2e')],'type':_0x4f6c64['type'][_0x167b('0x2f')]};});_0x593c77[_0x167b('0x30')]=_[_0x167b('0x2b')](_0xf91dc7,'name');_0x593c77[_0x167b('0x31')]=_[_0x167b('0x32')](_0x4ba2a2[_0x167b('0x31')]);_0x593c77[_0x167b('0x33')]=_[_0x167b('0x34')](_0x593c77[_0x167b('0x30')],_0x593c77[_0x167b('0x31')]);_0x18cc4c[_0x167b('0x35')]=_[_0x167b('0x34')](_0x593c77[_0x167b('0x30')],qs[_0x167b('0x36')](_0x4ba2a2['query']['fields']));_0x18cc4c[_0x167b('0x35')]=_0x18cc4c[_0x167b('0x35')][_0x167b('0x37')]?_0x18cc4c[_0x167b('0x35')]:_0x593c77[_0x167b('0x30')];if(!_0x4ba2a2[_0x167b('0x31')][_0x167b('0x38')](_0x167b('0x39'))){_0x18cc4c['limit']=qs['limit'](_0x4ba2a2['query'][_0x167b('0x1f')]);_0x18cc4c['offset']=qs[_0x167b('0x1c')](_0x4ba2a2[_0x167b('0x31')]['offset']);}_0x18cc4c[_0x167b('0x3a')]=qs[_0x167b('0x3b')](_0x4ba2a2[_0x167b('0x31')][_0x167b('0x3b')]);_0x18cc4c[_0x167b('0x3c')]=qs[_0x167b('0x33')](_[_0x167b('0x3d')](_0x4ba2a2[_0x167b('0x31')],_0x593c77['filters']),_0xf91dc7);if(_0x4ba2a2[_0x167b('0x31')]['filter']){_0x18cc4c[_0x167b('0x3c')]=_[_0x167b('0x3e')](_0x18cc4c['where'],{'$or':_['map'](_0xf91dc7,function(_0x3484f4){if(_0x3484f4['type']!=='VIRTUAL'){var _0xa2c8dd={};_0xa2c8dd[_0x3484f4[_0x167b('0x28')]]={'$like':'%'+_0x4ba2a2[_0x167b('0x31')][_0x167b('0x3f')]+'%'};return _0xa2c8dd;}})});}_0x18cc4c=_[_0x167b('0x3e')]({},_0x18cc4c,_0x4ba2a2[_0x167b('0x40')]);var _0x400208={'where':_0x18cc4c[_0x167b('0x3c')]};return db['AnalyticTreeReport'][_0x167b('0x1e')](_0x400208)[_0x167b('0x24')](function(_0x35fea8){_0x3a4b70[_0x167b('0x1e')]=_0x35fea8;if(_0x4ba2a2[_0x167b('0x31')][_0x167b('0x41')]){_0x18cc4c[_0x167b('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x167b('0x43')](_0x18cc4c);})['then'](function(_0x22acc4){_0x3a4b70[_0x167b('0x44')]=_0x22acc4;return _0x3a4b70;})['then'](respondWithFilteredResult(_0x48aef4,_0x18cc4c))[_0x167b('0x45')](handleError(_0x48aef4,null));};exports[_0x167b('0x46')]=function(_0x53b046,_0x3e9456){var _0x26427e={'raw':!![],'where':{'id':_0x53b046['params']['id']}},_0x1647d2={};_0x1647d2['model']=_['keys'](db[_0x167b('0x2c')][_0x167b('0x2d')]);_0x1647d2['query']=_['keys'](_0x53b046['query']);_0x1647d2[_0x167b('0x33')]=_[_0x167b('0x34')](_0x1647d2[_0x167b('0x30')],_0x1647d2['query']);_0x26427e[_0x167b('0x35')]=_[_0x167b('0x34')](_0x1647d2[_0x167b('0x30')],qs['fields'](_0x53b046[_0x167b('0x31')][_0x167b('0x36')]));_0x26427e['attributes']=_0x26427e[_0x167b('0x35')][_0x167b('0x37')]?_0x26427e[_0x167b('0x35')]:_0x1647d2['model'];if(_0x53b046[_0x167b('0x31')][_0x167b('0x41')]){_0x26427e[_0x167b('0x42')]=[{'all':!![]}];}_0x26427e=_['merge']({},_0x26427e,_0x53b046[_0x167b('0x40')]);return db[_0x167b('0x2c')][_0x167b('0x47')](_0x26427e)[_0x167b('0x24')](handleEntityNotFound(_0x3e9456,null))[_0x167b('0x24')](respondWithResult(_0x3e9456,null))['catch'](handleError(_0x3e9456,null));};exports[_0x167b('0x48')]=function(_0x1e7671,_0x24e422){return db[_0x167b('0x2c')][_0x167b('0x48')](_0x1e7671[_0x167b('0x49')],{})[_0x167b('0x24')](respondWithResult(_0x24e422,0xc9))[_0x167b('0x45')](handleError(_0x24e422,null));};exports['update']=function(_0x2ce8e6,_0x2de1a8){if(_0x2ce8e6[_0x167b('0x49')]['id']){delete _0x2ce8e6[_0x167b('0x49')]['id'];}return db[_0x167b('0x2c')]['find']({'where':{'id':_0x2ce8e6['params']['id']}})[_0x167b('0x24')](handleEntityNotFound(_0x2de1a8,null))[_0x167b('0x24')](saveUpdates(_0x2ce8e6['body'],null))[_0x167b('0x24')](respondWithResult(_0x2de1a8,null))[_0x167b('0x45')](handleError(_0x2de1a8,null));};exports['destroy']=function(_0x310a9a,_0x56ae12){return db[_0x167b('0x2c')][_0x167b('0x47')]({'where':{'id':_0x310a9a[_0x167b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56ae12,null))[_0x167b('0x24')](removeEntity(_0x56ae12,null))[_0x167b('0x45')](handleError(_0x56ae12,null));}; \ No newline at end of file +var _0x45e1=['undefined','count','limit','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x118691,_0x55b350){var _0x389e3d=function(_0x48b649){while(--_0x48b649){_0x118691['push'](_0x118691['shift']());}};_0x389e3d(++_0x55b350);}(_0x45e1,0x1ee));var _0x145e=function(_0xded12b,_0xecfb8e){_0xded12b=_0xded12b-0x0;var _0x572384=_0x45e1[_0xded12b];return _0x572384;};'use strict';var emlformat=require(_0x145e('0x0'));var rimraf=require(_0x145e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x145e('0x2'));var rp=require(_0x145e('0x3'));var moment=require(_0x145e('0x4'));var BPromise=require(_0x145e('0x5'));var Mustache=require(_0x145e('0x6'));var util=require(_0x145e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x145e('0x8'));var ejs=require(_0x145e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x145e('0xa'));var squel=require(_0x145e('0xb'));var crypto=require(_0x145e('0xc'));var jsforce=require(_0x145e('0xd'));var deskjs=require(_0x145e('0xe'));var toCsv=require(_0x145e('0x8'));var querystring=require(_0x145e('0xf'));var Papa=require(_0x145e('0x10'));var Redis=require(_0x145e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x145e('0x12'));var as=require(_0x145e('0x13'));var hardwareService=require(_0x145e('0x14'));var logger=require(_0x145e('0x15'))('api');var utils=require(_0x145e('0x16'));var config=require(_0x145e('0x17'));var licenseUtil=require(_0x145e('0x18'));var db=require(_0x145e('0x19'))['db'];function respondWithStatusCode(_0x236137,_0x3d72f1){_0x3d72f1=_0x3d72f1||0xcc;return function(_0x25d135){if(_0x25d135){return _0x236137[_0x145e('0x1a')](_0x3d72f1);}return _0x236137[_0x145e('0x1b')](_0x3d72f1)[_0x145e('0x1c')]();};}function respondWithResult(_0x2298c2,_0x41ac3e){_0x41ac3e=_0x41ac3e||0xc8;return function(_0x251fb4){if(_0x251fb4){return _0x2298c2[_0x145e('0x1b')](_0x41ac3e)[_0x145e('0x1d')](_0x251fb4);}};}function respondWithFilteredResult(_0x2c48d3,_0x1a4544){return function(_0xd98314){if(_0xd98314){var _0x337d76=typeof _0x1a4544[_0x145e('0x1e')]==='undefined'&&typeof _0x1a4544['limit']===_0x145e('0x1f');var _0x2df9bf=_0xd98314[_0x145e('0x20')];var _0x5ac533=_0x337d76?0x0:_0x1a4544[_0x145e('0x1e')];var _0x5217f0=_0x337d76?_0xd98314['count']:_0x1a4544['offset']+_0x1a4544[_0x145e('0x21')];var _0x592977;if(_0x5217f0>=_0x2df9bf){_0x5217f0=_0x2df9bf;_0x592977=0xc8;}else{_0x592977=0xce;}_0x2c48d3[_0x145e('0x1b')](_0x592977);return _0x2c48d3['set']('Content-Range',_0x5ac533+'-'+_0x5217f0+'/'+_0x2df9bf)[_0x145e('0x1d')](_0xd98314);}return null;};}function patchUpdates(_0x5b82f6){return function(_0x475e27){try{jsonpatch[_0x145e('0x22')](_0x475e27,_0x5b82f6,!![]);}catch(_0x3e2b07){return BPromise[_0x145e('0x23')](_0x3e2b07);}return _0x475e27[_0x145e('0x24')]();};}function saveUpdates(_0x2ba20e,_0x350fd6){return function(_0xa97dba){if(_0xa97dba){return _0xa97dba[_0x145e('0x25')](_0x2ba20e)[_0x145e('0x26')](function(_0x53c0d8){return _0x53c0d8;});}return null;};}function removeEntity(_0x2ec0b7,_0x30c958){return function(_0x2bee79){if(_0x2bee79){return _0x2bee79[_0x145e('0x27')]()[_0x145e('0x26')](function(){_0x2ec0b7[_0x145e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bc92a,_0x44a0f8){return function(_0x1a21c0){if(!_0x1a21c0){_0x4bc92a[_0x145e('0x1a')](0x194);}return _0x1a21c0;};}function handleError(_0x109259,_0x3e79df){_0x3e79df=_0x3e79df||0x1f4;return function(_0x46fa62){logger[_0x145e('0x28')](_0x46fa62['stack']);if(_0x46fa62[_0x145e('0x29')]){delete _0x46fa62[_0x145e('0x29')];}_0x109259['status'](_0x3e79df)[_0x145e('0x2a')](_0x46fa62);};}exports[_0x145e('0x2b')]=function(_0x2c328b,_0x1883e1){var _0x363eba={},_0x43f238={},_0x2babee={'count':0x0,'rows':[]};var _0x446482=_[_0x145e('0x2c')](db[_0x145e('0x2d')]['rawAttributes'],function(_0x1f8715){return{'name':_0x1f8715[_0x145e('0x2e')],'type':_0x1f8715[_0x145e('0x2f')]['key']};});_0x43f238[_0x145e('0x30')]=_[_0x145e('0x2c')](_0x446482,'name');_0x43f238['query']=_[_0x145e('0x31')](_0x2c328b[_0x145e('0x32')]);_0x43f238['filters']=_[_0x145e('0x33')](_0x43f238[_0x145e('0x30')],_0x43f238[_0x145e('0x32')]);_0x363eba[_0x145e('0x34')]=_[_0x145e('0x33')](_0x43f238[_0x145e('0x30')],qs['fields'](_0x2c328b[_0x145e('0x32')][_0x145e('0x35')]));_0x363eba[_0x145e('0x34')]=_0x363eba[_0x145e('0x34')][_0x145e('0x36')]?_0x363eba['attributes']:_0x43f238['model'];if(!_0x2c328b[_0x145e('0x32')]['hasOwnProperty'](_0x145e('0x37'))){_0x363eba['limit']=qs['limit'](_0x2c328b[_0x145e('0x32')][_0x145e('0x21')]);_0x363eba['offset']=qs[_0x145e('0x1e')](_0x2c328b[_0x145e('0x32')][_0x145e('0x1e')]);}_0x363eba['order']=qs[_0x145e('0x38')](_0x2c328b[_0x145e('0x32')]['sort']);_0x363eba[_0x145e('0x39')]=qs['filters'](_[_0x145e('0x3a')](_0x2c328b['query'],_0x43f238[_0x145e('0x3b')]),_0x446482);if(_0x2c328b[_0x145e('0x32')][_0x145e('0x3c')]){_0x363eba['where']=_[_0x145e('0x3d')](_0x363eba[_0x145e('0x39')],{'$or':_[_0x145e('0x2c')](_0x446482,function(_0x17d8b5){if(_0x17d8b5[_0x145e('0x2f')]!==_0x145e('0x3e')){var _0x11a6b3={};_0x11a6b3[_0x17d8b5[_0x145e('0x29')]]={'$like':'%'+_0x2c328b[_0x145e('0x32')][_0x145e('0x3c')]+'%'};return _0x11a6b3;}})});}_0x363eba=_[_0x145e('0x3d')]({},_0x363eba,_0x2c328b[_0x145e('0x3f')]);var _0x53272d={'where':_0x363eba[_0x145e('0x39')]};return db[_0x145e('0x2d')][_0x145e('0x20')](_0x53272d)['then'](function(_0x3bc77e){_0x2babee[_0x145e('0x20')]=_0x3bc77e;if(_0x2c328b[_0x145e('0x32')]['includeAll']){_0x363eba[_0x145e('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x145e('0x41')](_0x363eba);})[_0x145e('0x26')](function(_0x1fde03){_0x2babee[_0x145e('0x42')]=_0x1fde03;return _0x2babee;})[_0x145e('0x26')](respondWithFilteredResult(_0x1883e1,_0x363eba))[_0x145e('0x43')](handleError(_0x1883e1,null));};exports[_0x145e('0x44')]=function(_0x502660,_0x5d39f0){var _0x1517d0={'raw':!![],'where':{'id':_0x502660[_0x145e('0x45')]['id']}},_0x238c91={};_0x238c91[_0x145e('0x30')]=_[_0x145e('0x31')](db[_0x145e('0x2d')][_0x145e('0x46')]);_0x238c91[_0x145e('0x32')]=_['keys'](_0x502660[_0x145e('0x32')]);_0x238c91[_0x145e('0x3b')]=_[_0x145e('0x33')](_0x238c91[_0x145e('0x30')],_0x238c91['query']);_0x1517d0[_0x145e('0x34')]=_[_0x145e('0x33')](_0x238c91[_0x145e('0x30')],qs[_0x145e('0x35')](_0x502660[_0x145e('0x32')][_0x145e('0x35')]));_0x1517d0['attributes']=_0x1517d0['attributes'][_0x145e('0x36')]?_0x1517d0[_0x145e('0x34')]:_0x238c91['model'];if(_0x502660[_0x145e('0x32')][_0x145e('0x47')]){_0x1517d0[_0x145e('0x40')]=[{'all':!![]}];}_0x1517d0=_[_0x145e('0x3d')]({},_0x1517d0,_0x502660[_0x145e('0x3f')]);return db[_0x145e('0x2d')][_0x145e('0x48')](_0x1517d0)[_0x145e('0x26')](handleEntityNotFound(_0x5d39f0,null))[_0x145e('0x26')](respondWithResult(_0x5d39f0,null))[_0x145e('0x43')](handleError(_0x5d39f0,null));};exports[_0x145e('0x49')]=function(_0x28f689,_0x511bb8){return db[_0x145e('0x2d')]['create'](_0x28f689['body'],{})[_0x145e('0x26')](respondWithResult(_0x511bb8,0xc9))[_0x145e('0x43')](handleError(_0x511bb8,null));};exports[_0x145e('0x25')]=function(_0x671abe,_0x2d0883){if(_0x671abe['body']['id']){delete _0x671abe['body']['id'];}return db[_0x145e('0x2d')][_0x145e('0x48')]({'where':{'id':_0x671abe[_0x145e('0x45')]['id']}})[_0x145e('0x26')](handleEntityNotFound(_0x2d0883,null))[_0x145e('0x26')](saveUpdates(_0x671abe[_0x145e('0x4a')],null))['then'](respondWithResult(_0x2d0883,null))['catch'](handleError(_0x2d0883,null));};exports['destroy']=function(_0x5cdf7f,_0xb3f0ee){return db[_0x145e('0x2d')]['find']({'where':{'id':_0x5cdf7f['params']['id']}})[_0x145e('0x26')](handleEntityNotFound(_0xb3f0ee,null))[_0x145e('0x26')](removeEntity(_0xb3f0ee,null))[_0x145e('0x43')](handleError(_0xb3f0ee,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index b024232..13e41b1 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 _0x0e56=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0x0e56,0xf5));var _0x60e5=function(_0x486f67,_0x31a5ba){_0x486f67=_0x486f67-0x0;var _0x51e075=_0x0e56[_0x486f67];return _0x51e075;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var logger=require('../../config/logger')(_0x60e5('0x2'));var moment=require(_0x60e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x60e5('0x4'));var fs=require('fs');var path=require(_0x60e5('0x5'));var rimraf=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var attributes=require(_0x60e5('0x8'));module[_0x60e5('0x9')]=function(_0x25b3a4,_0x54422a){return _0x25b3a4[_0x60e5('0xa')](_0x60e5('0xb'),attributes,{'tableName':_0x60e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0adf=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x50180c,_0x3fc232){var _0x5eaa41=function(_0x24fe64){while(--_0x24fe64){_0x50180c['push'](_0x50180c['shift']());}};_0x5eaa41(++_0x3fc232);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x9cd5e3,_0x2ce524){_0x9cd5e3=_0x9cd5e3-0x0;var _0x2bcf1d=_0x0adf[_0x9cd5e3];return _0x2bcf1d;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 128d19f..9548975 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 _0xeb85=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util'];(function(_0x76f5bd,_0xe83ddb){var _0x59c523=function(_0x71947c){while(--_0x71947c){_0x76f5bd['push'](_0x76f5bd['shift']());}};_0x59c523(++_0xe83ddb);}(_0xeb85,0xb6));var _0x5eb8=function(_0x387580,_0x4e8c53){_0x387580=_0x387580-0x0;var _0x244aa0=_0xeb85[_0x387580];return _0x244aa0;};'use strict';var _=require(_0x5eb8('0x0'));var util=require(_0x5eb8('0x1'));var moment=require(_0x5eb8('0x2'));var BPromise=require(_0x5eb8('0x3'));var rs=require(_0x5eb8('0x4'));var fs=require('fs');var Redis=require(_0x5eb8('0x5'));var db=require(_0x5eb8('0x6'))['db'];var utils=require(_0x5eb8('0x7'));var logger=require('../../config/logger')(_0x5eb8('0x8'));var config=require(_0x5eb8('0x9'));var jayson=require(_0x5eb8('0xa'));var client=jayson[_0x5eb8('0xb')][_0x5eb8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e5dd6,_0x2ca7c8,_0x377d45){return new BPromise(function(_0x395d00,_0x5e47ee){return client[_0x5eb8('0xd')](_0x1e5dd6,_0x377d45)['then'](function(_0x231bcc){logger['info'](_0x5eb8('0xe'),_0x2ca7c8,_0x5eb8('0xf'));logger[_0x5eb8('0x10')](_0x5eb8('0x11'),_0x2ca7c8,'request\x20sent',JSON[_0x5eb8('0x12')](_0x231bcc));if(_0x231bcc['error']){if(_0x231bcc['error'][_0x5eb8('0x13')]===0x1f4){logger['error'](_0x5eb8('0xe'),_0x2ca7c8,_0x231bcc[_0x5eb8('0x14')][_0x5eb8('0x15')]);return _0x5e47ee(_0x231bcc[_0x5eb8('0x14')][_0x5eb8('0x15')]);}logger[_0x5eb8('0x14')](_0x5eb8('0xe'),_0x2ca7c8,_0x231bcc['error'][_0x5eb8('0x15')]);return _0x395d00(_0x231bcc[_0x5eb8('0x14')]['message']);}else{logger['info'](_0x5eb8('0xe'),_0x2ca7c8,_0x5eb8('0xf'));_0x395d00(_0x231bcc['result'][_0x5eb8('0x15')]);}})[_0x5eb8('0x16')](function(_0x1568a9){logger[_0x5eb8('0x14')](_0x5eb8('0xe'),_0x2ca7c8,_0x1568a9);_0x5e47ee(_0x1568a9);});});} \ No newline at end of file +var _0xddac=['stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x24805a,_0x57dd68){var _0x30fb56=function(_0x4c9178){while(--_0x4c9178){_0x24805a['push'](_0x24805a['shift']());}};_0x30fb56(++_0x57dd68);}(_0xddac,0x19e));var _0xcdda=function(_0x24bfaf,_0x532a2c){_0x24bfaf=_0x24bfaf-0x0;var _0x195db3=_0xddac[_0x24bfaf];return _0x195db3;};'use strict';var _=require(_0xcdda('0x0'));var util=require(_0xcdda('0x1'));var moment=require(_0xcdda('0x2'));var BPromise=require(_0xcdda('0x3'));var rs=require(_0xcdda('0x4'));var fs=require('fs');var Redis=require(_0xcdda('0x5'));var db=require(_0xcdda('0x6'))['db'];var utils=require(_0xcdda('0x7'));var logger=require(_0xcdda('0x8'))('rpc');var config=require(_0xcdda('0x9'));var jayson=require(_0xcdda('0xa'));var client=jayson[_0xcdda('0xb')][_0xcdda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a0245,_0x25c898,_0x304f1e){return new BPromise(function(_0x3c7cff,_0x55fb32){return client[_0xcdda('0xd')](_0x3a0245,_0x304f1e)[_0xcdda('0xe')](function(_0x5a74e4){logger['info'](_0xcdda('0xf'),_0x25c898,_0xcdda('0x10'));logger['debug'](_0xcdda('0x11'),_0x25c898,_0xcdda('0x10'),JSON[_0xcdda('0x12')](_0x5a74e4));if(_0x5a74e4[_0xcdda('0x13')]){if(_0x5a74e4[_0xcdda('0x13')][_0xcdda('0x14')]===0x1f4){logger[_0xcdda('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x25c898,_0x5a74e4[_0xcdda('0x13')][_0xcdda('0x15')]);return _0x55fb32(_0x5a74e4[_0xcdda('0x13')][_0xcdda('0x15')]);}logger[_0xcdda('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x25c898,_0x5a74e4[_0xcdda('0x13')][_0xcdda('0x15')]);return _0x3c7cff(_0x5a74e4[_0xcdda('0x13')][_0xcdda('0x15')]);}else{logger[_0xcdda('0x16')](_0xcdda('0xf'),_0x25c898,_0xcdda('0x10'));_0x3c7cff(_0x5a74e4['result'][_0xcdda('0x15')]);}})[_0xcdda('0x17')](function(_0x1569b6){logger[_0xcdda('0x13')](_0xcdda('0xf'),_0x25c898,_0x1569b6);_0x55fb32(_0x1569b6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d24b06c..f76d1f2 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 _0x44d9=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44d9,0x155));var _0x944d=function(_0x531d65,_0x489f0a){_0x531d65=_0x531d65-0x0;var _0x3b65ce=_0x44d9[_0x531d65];return _0x3b65ce;};'use strict';var multer=require(_0x944d('0x0'));var util=require(_0x944d('0x1'));var path=require(_0x944d('0x2'));var timeout=require(_0x944d('0x3'));var express=require(_0x944d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x944d('0x5'));var interaction=require(_0x944d('0x6'));var config=require('../../config/environment');var controller=require(_0x944d('0x7'));router['get']('/',auth[_0x944d('0x8')](),controller[_0x944d('0x9')]);router[_0x944d('0xa')](_0x944d('0xb'),auth[_0x944d('0x8')](),controller[_0x944d('0xc')]);router[_0x944d('0xd')]('/',auth['isAuthenticated'](),controller[_0x944d('0xe')]);router[_0x944d('0xf')](_0x944d('0xb'),auth['isAuthenticated'](),controller[_0x944d('0x10')]);router[_0x944d('0x11')](_0x944d('0xb'),auth[_0x944d('0x8')](),controller[_0x944d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1c4d=['destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x31a8e2,_0x4b3edf){var _0x65ffbf=function(_0x1c7a53){while(--_0x1c7a53){_0x31a8e2['push'](_0x31a8e2['shift']());}};_0x65ffbf(++_0x4b3edf);}(_0x1c4d,0x19f));var _0xd1c4=function(_0x100984,_0xbdb18d){_0x100984=_0x100984-0x0;var _0x240a30=_0x1c4d[_0x100984];return _0x240a30;};'use strict';var multer=require(_0xd1c4('0x0'));var util=require(_0xd1c4('0x1'));var path=require('path');var timeout=require(_0xd1c4('0x2'));var express=require('express');var router=express[_0xd1c4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd1c4('0x4'));var interaction=require(_0xd1c4('0x5'));var config=require('../../config/environment');var controller=require(_0xd1c4('0x6'));router[_0xd1c4('0x7')]('/',auth['isAuthenticated'](),controller[_0xd1c4('0x8')]);router[_0xd1c4('0x7')](_0xd1c4('0x9'),auth[_0xd1c4('0xa')](),controller[_0xd1c4('0xb')]);router[_0xd1c4('0xc')]('/',auth['isAuthenticated'](),controller[_0xd1c4('0xd')]);router[_0xd1c4('0xe')](_0xd1c4('0x9'),auth[_0xd1c4('0xa')](),controller[_0xd1c4('0xf')]);router[_0xd1c4('0x10')]('/:id',auth[_0xd1c4('0xa')](),controller[_0xd1c4('0x11')]);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 f8777b6..d544cd1 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 _0x0cb1=['STRING','exports'];(function(_0xf59e56,_0x57960a){var _0x42e155=function(_0xbd1f91){while(--_0xbd1f91){_0xf59e56['push'](_0xf59e56['shift']());}};_0x42e155(++_0x57960a);}(_0x0cb1,0x18b));var _0x10cb=function(_0x41271c,_0x2e505b){_0x41271c=_0x41271c-0x0;var _0x22c7a0=_0x0cb1[_0x41271c];return _0x22c7a0;};'use strict';var Sequelize=require('sequelize');module[_0x10cb('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x10cb('0x1')]},'type':{'type':Sequelize[_0x10cb('0x1')]}}; \ No newline at end of file +var _0x3c97=['STRING','sequelize','exports'];(function(_0x1c0c50,_0xd5c125){var _0x2db011=function(_0x526e69){while(--_0x526e69){_0x1c0c50['push'](_0x1c0c50['shift']());}};_0x2db011(++_0xd5c125);}(_0x3c97,0x163));var _0x73c9=function(_0x2d1b30,_0x3e9eae){_0x2d1b30=_0x2d1b30-0x0;var _0x164d07=_0x3c97[_0x2d1b30];return _0x164d07;};'use strict';var Sequelize=require(_0x73c9('0x0'));module[_0x73c9('0x1')]={'name':{'type':Sequelize[_0x73c9('0x2')]},'basename':{'type':Sequelize[_0x73c9('0x2')]},'type':{'type':Sequelize[_0x73c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 74fe4d2..ef2f409 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 _0x37f8=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Attachment','includeAll','findAll','rows','params','include','find','catch','omit','updatedAt','body','createdAt','update','create','originalname','basename','file','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','reject','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','map','keys'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x37f8,0x1d2));var _0x837f=function(_0x43c92a,_0x7292bb){_0x43c92a=_0x43c92a-0x0;var _0x584e28=_0x37f8[_0x43c92a];return _0x584e28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x837f('0x0'));var zipdir=require(_0x837f('0x1'));var jsonpatch=require(_0x837f('0x2'));var rp=require(_0x837f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x837f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x837f('0x5'));var csv=require(_0x837f('0x6'));var ejs=require(_0x837f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x837f('0x8'));var squel=require(_0x837f('0x9'));var crypto=require(_0x837f('0xa'));var jsforce=require(_0x837f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x837f('0x6'));var querystring=require(_0x837f('0xc'));var Papa=require(_0x837f('0xd'));var Redis=require(_0x837f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x837f('0xf'));var hardwareService=require(_0x837f('0x10'));var logger=require(_0x837f('0x11'))('api');var utils=require(_0x837f('0x12'));var config=require(_0x837f('0x13'));var licenseUtil=require(_0x837f('0x14'));var db=require(_0x837f('0x15'))['db'];function respondWithStatusCode(_0x23df85,_0x278d16){_0x278d16=_0x278d16||0xcc;return function(_0x49b3d2){if(_0x49b3d2){return _0x23df85[_0x837f('0x16')](_0x278d16);}return _0x23df85['status'](_0x278d16)[_0x837f('0x17')]();};}function respondWithResult(_0x403df2,_0x4cd961){_0x4cd961=_0x4cd961||0xc8;return function(_0x155aff){if(_0x155aff){return _0x403df2[_0x837f('0x18')](_0x4cd961)[_0x837f('0x19')](_0x155aff);}};}function respondWithFilteredResult(_0x4ca7a0,_0x5cc388){return function(_0x4cc7db){if(_0x4cc7db){var _0x56c127=typeof _0x5cc388['offset']===_0x837f('0x1a')&&typeof _0x5cc388['limit']===_0x837f('0x1a');var _0x43061f=_0x4cc7db['count'];var _0x50ae29=_0x56c127?0x0:_0x5cc388['offset'];var _0x26d02e=_0x56c127?_0x4cc7db[_0x837f('0x1b')]:_0x5cc388[_0x837f('0x1c')]+_0x5cc388[_0x837f('0x1d')];var _0x597952;if(_0x26d02e>=_0x43061f){_0x26d02e=_0x43061f;_0x597952=0xc8;}else{_0x597952=0xce;}_0x4ca7a0[_0x837f('0x18')](_0x597952);return _0x4ca7a0[_0x837f('0x1e')](_0x837f('0x1f'),_0x50ae29+'-'+_0x26d02e+'/'+_0x43061f)[_0x837f('0x19')](_0x4cc7db);}return null;};}function patchUpdates(_0xda5609){return function(_0x2cdf4d){try{jsonpatch['apply'](_0x2cdf4d,_0xda5609,!![]);}catch(_0x302858){return BPromise[_0x837f('0x20')](_0x302858);}return _0x2cdf4d['save']();};}function saveUpdates(_0x3cd873,_0x1c699e){return function(_0x22c85c){if(_0x22c85c){return _0x22c85c['update'](_0x3cd873)[_0x837f('0x21')](function(_0x39b770){return _0x39b770;});}return null;};}function removeEntity(_0x510af3,_0x595ac3){return function(_0x12439d){if(_0x12439d){return _0x12439d[_0x837f('0x22')]()['then'](function(){_0x510af3[_0x837f('0x18')](0xcc)[_0x837f('0x17')]();});}};}function handleEntityNotFound(_0xe24b7d,_0xa9dd13){return function(_0x474028){if(!_0x474028){_0xe24b7d[_0x837f('0x16')](0x194);}return _0x474028;};}function handleError(_0x12bc75,_0x17d5fe){_0x17d5fe=_0x17d5fe||0x1f4;return function(_0x2df407){logger['error'](_0x2df407[_0x837f('0x23')]);if(_0x2df407['name']){delete _0x2df407[_0x837f('0x24')];}_0x12bc75[_0x837f('0x18')](_0x17d5fe)[_0x837f('0x25')](_0x2df407);};}exports[_0x837f('0x26')]=function(_0x435468,_0x43b35c){var _0xf19e0a={},_0x40a7e9={},_0x505559={'count':0x0,'rows':[]};var _0x47d3a9=_['map'](db['Attachment'][_0x837f('0x27')],function(_0x280776){return{'name':_0x280776[_0x837f('0x28')],'type':_0x280776['type'][_0x837f('0x29')]};});_0x40a7e9['model']=_[_0x837f('0x2a')](_0x47d3a9,_0x837f('0x24'));_0x40a7e9['query']=_[_0x837f('0x2b')](_0x435468[_0x837f('0x2c')]);_0x40a7e9[_0x837f('0x2d')]=_[_0x837f('0x2e')](_0x40a7e9[_0x837f('0x2f')],_0x40a7e9[_0x837f('0x2c')]);_0xf19e0a[_0x837f('0x30')]=_[_0x837f('0x2e')](_0x40a7e9[_0x837f('0x2f')],qs['fields'](_0x435468[_0x837f('0x2c')][_0x837f('0x31')]));_0xf19e0a[_0x837f('0x30')]=_0xf19e0a[_0x837f('0x30')][_0x837f('0x32')]?_0xf19e0a['attributes']:_0x40a7e9[_0x837f('0x2f')];if(!_0x435468[_0x837f('0x2c')][_0x837f('0x33')]('nolimit')){_0xf19e0a['limit']=qs['limit'](_0x435468[_0x837f('0x2c')][_0x837f('0x1d')]);_0xf19e0a[_0x837f('0x1c')]=qs['offset'](_0x435468[_0x837f('0x2c')][_0x837f('0x1c')]);}_0xf19e0a[_0x837f('0x34')]=qs['sort'](_0x435468[_0x837f('0x2c')][_0x837f('0x35')]);_0xf19e0a[_0x837f('0x36')]=qs['filters'](_[_0x837f('0x37')](_0x435468['query'],_0x40a7e9[_0x837f('0x2d')]),_0x47d3a9);if(_0x435468[_0x837f('0x2c')][_0x837f('0x38')]){_0xf19e0a[_0x837f('0x36')]=_[_0x837f('0x39')](_0xf19e0a[_0x837f('0x36')],{'$or':_[_0x837f('0x2a')](_0x47d3a9,function(_0x31dde0){if(_0x31dde0[_0x837f('0x3a')]!==_0x837f('0x3b')){var _0x10b5c7={};_0x10b5c7[_0x31dde0[_0x837f('0x24')]]={'$like':'%'+_0x435468[_0x837f('0x2c')][_0x837f('0x38')]+'%'};return _0x10b5c7;}})});}_0xf19e0a=_[_0x837f('0x39')]({},_0xf19e0a,_0x435468[_0x837f('0x3c')]);var _0x224c4b={'where':_0xf19e0a[_0x837f('0x36')]};return db[_0x837f('0x3d')][_0x837f('0x1b')](_0x224c4b)['then'](function(_0x591c9a){_0x505559[_0x837f('0x1b')]=_0x591c9a;if(_0x435468['query'][_0x837f('0x3e')]){_0xf19e0a['include']=[{'all':!![]}];}return db['Attachment'][_0x837f('0x3f')](_0xf19e0a);})['then'](function(_0xdf0b56){_0x505559[_0x837f('0x40')]=_0xdf0b56;return _0x505559;})['then'](respondWithFilteredResult(_0x43b35c,_0xf19e0a))['catch'](handleError(_0x43b35c,null));};exports['show']=function(_0x5f32cb,_0x50102d){var _0x279d52={'raw':!![],'where':{'id':_0x5f32cb[_0x837f('0x41')]['id']}},_0x22564b={};_0x22564b['model']=_[_0x837f('0x2b')](db['Attachment']['rawAttributes']);_0x22564b[_0x837f('0x2c')]=_[_0x837f('0x2b')](_0x5f32cb[_0x837f('0x2c')]);_0x22564b[_0x837f('0x2d')]=_[_0x837f('0x2e')](_0x22564b['model'],_0x22564b[_0x837f('0x2c')]);_0x279d52['attributes']=_[_0x837f('0x2e')](_0x22564b[_0x837f('0x2f')],qs[_0x837f('0x31')](_0x5f32cb[_0x837f('0x2c')][_0x837f('0x31')]));_0x279d52[_0x837f('0x30')]=_0x279d52[_0x837f('0x30')][_0x837f('0x32')]?_0x279d52[_0x837f('0x30')]:_0x22564b[_0x837f('0x2f')];if(_0x5f32cb['query'][_0x837f('0x3e')]){_0x279d52[_0x837f('0x42')]=[{'all':!![]}];}_0x279d52=_[_0x837f('0x39')]({},_0x279d52,_0x5f32cb[_0x837f('0x3c')]);return db[_0x837f('0x3d')][_0x837f('0x43')](_0x279d52)[_0x837f('0x21')](handleEntityNotFound(_0x50102d,null))[_0x837f('0x21')](respondWithResult(_0x50102d,null))[_0x837f('0x44')](handleError(_0x50102d,null));};exports['clone']=function(_0x272d9a,_0x54a312){var _0x4eafb9={'where':{'id':_0x272d9a[_0x837f('0x41')]['id']}},_0x2e1075={};_0x2e1075[_0x837f('0x2f')]=_[_0x837f('0x2b')](db[_0x837f('0x3d')][_0x837f('0x27')]);_0x4eafb9['attributes']=_[_0x837f('0x2e')](_0x2e1075[_0x837f('0x2f')],qs['fields'](_0x272d9a[_0x837f('0x2c')]['fields']));_0x4eafb9[_0x837f('0x30')]=_0x4eafb9[_0x837f('0x30')]['length']?_0x4eafb9[_0x837f('0x30')]:_0x2e1075[_0x837f('0x2f')];if(_0x272d9a['query'][_0x837f('0x3e')]){_0x4eafb9['include']=[{'all':!![]}];}_0x4eafb9=_[_0x837f('0x39')]({},_0x4eafb9,_0x272d9a[_0x837f('0x3c')]);return db[_0x837f('0x3d')][_0x837f('0x43')](_0x4eafb9)['then'](handleEntityNotFound(_0x54a312,null))['then'](function(_0x537d5b){if(_0x537d5b){var _0x141e4a=_0x537d5b['get']({'plain':!![]});_0x141e4a=qs[_0x837f('0x45')](_0x141e4a,['id','createdAt',_0x837f('0x46')]);_0x272d9a['body']=_[_0x837f('0x45')](_0x272d9a[_0x837f('0x47')],['id',_0x837f('0x48'),_0x837f('0x46')]);return db[_0x837f('0x3d')]['create'](_['merge'](_0x141e4a,_0x272d9a[_0x837f('0x47')]),{'include':_0x272d9a['query'][_0x837f('0x3e')]?[{'all':!![]}]:undefined});}})[_0x837f('0x21')](respondWithResult(_0x54a312,0xc9))['catch'](handleError(_0x54a312,null));};exports[_0x837f('0x49')]=function(_0x45b4f9,_0x260f63){if(_0x45b4f9[_0x837f('0x47')]['id']){delete _0x45b4f9[_0x837f('0x47')]['id'];}return db[_0x837f('0x3d')][_0x837f('0x43')]({'where':{'id':_0x45b4f9[_0x837f('0x41')]['id']}})[_0x837f('0x21')](handleEntityNotFound(_0x260f63,null))[_0x837f('0x21')](saveUpdates(_0x45b4f9[_0x837f('0x47')],null))['then'](respondWithResult(_0x260f63,null))['catch'](handleError(_0x260f63,null));};exports['destroy']=function(_0x4b403f,_0x12a79d){return db[_0x837f('0x3d')][_0x837f('0x43')]({'where':{'id':_0x4b403f[_0x837f('0x41')]['id']}})['then'](handleEntityNotFound(_0x12a79d,null))[_0x837f('0x21')](removeEntity(_0x12a79d,null))[_0x837f('0x44')](handleError(_0x12a79d,null));};exports[_0x837f('0x4a')]=function(_0x4ee8dd,_0x3e2eb6,_0x2b113f){_0x4ee8dd['body']['name']=_0x4ee8dd['file'][_0x837f('0x4b')];_0x4ee8dd[_0x837f('0x47')][_0x837f('0x4c')]=_0x4ee8dd[_0x837f('0x4d')][_0x837f('0x4e')];_0x4ee8dd[_0x837f('0x47')]['type']=_0x4ee8dd[_0x837f('0x4d')]['mimetype'];return db[_0x837f('0x3d')]['create'](_0x4ee8dd['body'])[_0x837f('0x21')](respondWithResult(_0x3e2eb6,0xc9))[_0x837f('0x44')](handleError(_0x3e2eb6,null));};exports['download']=function(_0x421f12,_0x22ee2e,_0x40cbe6){return db[_0x837f('0x3d')][_0x837f('0x4f')]({'where':{'id':_0x421f12[_0x837f('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x22ee2e,null))[_0x837f('0x21')](function(_0x2bd8d8){if(_0x2bd8d8){var _0x14b4a8=_0x2bd8d8[_0x837f('0x50')]!==null;var _0xdfabda=path[_0x837f('0x51')](config[_0x837f('0x52')],_0x837f('0x53'));if(_0x14b4a8){_0xdfabda=path[_0x837f('0x51')](_0xdfabda,_0x837f('0x54'));}var _0xf2a463=path[_0x837f('0x51')](_0xdfabda,_0x2bd8d8['basename']);return _0x22ee2e['download'](_0xf2a463);}})[_0x837f('0x44')](handleError(_0x22ee2e,null));}; \ No newline at end of file +var _0xf9da=['body','updatedAt','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','map','Attachment','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','clone','params','omit','createdAt'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0xf9da,0x1bc));var _0xaf9d=function(_0x505099,_0xb10ee1){_0x505099=_0x505099-0x0;var _0x577eba=_0xf9da[_0x505099];return _0x577eba;};'use strict';var emlformat=require(_0xaf9d('0x0'));var rimraf=require(_0xaf9d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf9d('0x2'));var rp=require(_0xaf9d('0x3'));var moment=require(_0xaf9d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf9d('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf9d('0x6'));var fs=require('fs');var fs_extra=require(_0xaf9d('0x7'));var _=require('lodash');var squel=require(_0xaf9d('0x8'));var crypto=require(_0xaf9d('0x9'));var jsforce=require(_0xaf9d('0xa'));var deskjs=require(_0xaf9d('0xb'));var toCsv=require(_0xaf9d('0xc'));var querystring=require('querystring');var Papa=require(_0xaf9d('0xd'));var Redis=require(_0xaf9d('0xe'));var authService=require(_0xaf9d('0xf'));var qs=require(_0xaf9d('0x10'));var as=require(_0xaf9d('0x11'));var hardwareService=require(_0xaf9d('0x12'));var logger=require(_0xaf9d('0x13'))(_0xaf9d('0x14'));var utils=require(_0xaf9d('0x15'));var config=require(_0xaf9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf9d('0x17'))['db'];function respondWithStatusCode(_0x4bfb02,_0x53102e){_0x53102e=_0x53102e||0xcc;return function(_0x116e61){if(_0x116e61){return _0x4bfb02[_0xaf9d('0x18')](_0x53102e);}return _0x4bfb02[_0xaf9d('0x19')](_0x53102e)[_0xaf9d('0x1a')]();};}function respondWithResult(_0x408e3c,_0xedb40b){_0xedb40b=_0xedb40b||0xc8;return function(_0x4c12dc){if(_0x4c12dc){return _0x408e3c[_0xaf9d('0x19')](_0xedb40b)[_0xaf9d('0x1b')](_0x4c12dc);}};}function respondWithFilteredResult(_0x297b81,_0x578a97){return function(_0x285f1d){if(_0x285f1d){var _0x1c6385=typeof _0x578a97[_0xaf9d('0x1c')]===_0xaf9d('0x1d')&&typeof _0x578a97[_0xaf9d('0x1e')]==='undefined';var _0xc3d085=_0x285f1d[_0xaf9d('0x1f')];var _0x2830ce=_0x1c6385?0x0:_0x578a97[_0xaf9d('0x1c')];var _0x1cbc0a=_0x1c6385?_0x285f1d['count']:_0x578a97['offset']+_0x578a97[_0xaf9d('0x1e')];var _0x2de5bb;if(_0x1cbc0a>=_0xc3d085){_0x1cbc0a=_0xc3d085;_0x2de5bb=0xc8;}else{_0x2de5bb=0xce;}_0x297b81[_0xaf9d('0x19')](_0x2de5bb);return _0x297b81[_0xaf9d('0x20')](_0xaf9d('0x21'),_0x2830ce+'-'+_0x1cbc0a+'/'+_0xc3d085)[_0xaf9d('0x1b')](_0x285f1d);}return null;};}function patchUpdates(_0x325a2d){return function(_0x41ffe4){try{jsonpatch['apply'](_0x41ffe4,_0x325a2d,!![]);}catch(_0x5f34bc){return BPromise[_0xaf9d('0x22')](_0x5f34bc);}return _0x41ffe4['save']();};}function saveUpdates(_0x10df00,_0x3b76c5){return function(_0x1273da){if(_0x1273da){return _0x1273da[_0xaf9d('0x23')](_0x10df00)['then'](function(_0x4388cd){return _0x4388cd;});}return null;};}function removeEntity(_0x1464a0,_0x12430f){return function(_0x858b1f){if(_0x858b1f){return _0x858b1f['destroy']()[_0xaf9d('0x24')](function(){_0x1464a0[_0xaf9d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a10b2,_0x3e22f1){return function(_0x120a99){if(!_0x120a99){_0x4a10b2[_0xaf9d('0x18')](0x194);}return _0x120a99;};}function handleError(_0x17ba70,_0x17ab74){_0x17ab74=_0x17ab74||0x1f4;return function(_0x534305){logger[_0xaf9d('0x25')](_0x534305[_0xaf9d('0x26')]);if(_0x534305[_0xaf9d('0x27')]){delete _0x534305[_0xaf9d('0x27')];}_0x17ba70[_0xaf9d('0x19')](_0x17ab74)['send'](_0x534305);};}exports['index']=function(_0x3853e3,_0x57ffe3){var _0x4d96ab={},_0xe9929d={},_0x50179c={'count':0x0,'rows':[]};var _0x51136d=_[_0xaf9d('0x28')](db[_0xaf9d('0x29')]['rawAttributes'],function(_0x28b116){return{'name':_0x28b116['fieldName'],'type':_0x28b116[_0xaf9d('0x2a')]['key']};});_0xe9929d[_0xaf9d('0x2b')]=_[_0xaf9d('0x28')](_0x51136d,_0xaf9d('0x27'));_0xe9929d[_0xaf9d('0x2c')]=_[_0xaf9d('0x2d')](_0x3853e3['query']);_0xe9929d[_0xaf9d('0x2e')]=_[_0xaf9d('0x2f')](_0xe9929d[_0xaf9d('0x2b')],_0xe9929d[_0xaf9d('0x2c')]);_0x4d96ab[_0xaf9d('0x30')]=_[_0xaf9d('0x2f')](_0xe9929d['model'],qs['fields'](_0x3853e3[_0xaf9d('0x2c')][_0xaf9d('0x31')]));_0x4d96ab[_0xaf9d('0x30')]=_0x4d96ab[_0xaf9d('0x30')][_0xaf9d('0x32')]?_0x4d96ab['attributes']:_0xe9929d[_0xaf9d('0x2b')];if(!_0x3853e3[_0xaf9d('0x2c')][_0xaf9d('0x33')](_0xaf9d('0x34'))){_0x4d96ab['limit']=qs[_0xaf9d('0x1e')](_0x3853e3[_0xaf9d('0x2c')][_0xaf9d('0x1e')]);_0x4d96ab['offset']=qs[_0xaf9d('0x1c')](_0x3853e3['query']['offset']);}_0x4d96ab[_0xaf9d('0x35')]=qs['sort'](_0x3853e3[_0xaf9d('0x2c')][_0xaf9d('0x36')]);_0x4d96ab[_0xaf9d('0x37')]=qs['filters'](_[_0xaf9d('0x38')](_0x3853e3[_0xaf9d('0x2c')],_0xe9929d[_0xaf9d('0x2e')]),_0x51136d);if(_0x3853e3[_0xaf9d('0x2c')][_0xaf9d('0x39')]){_0x4d96ab[_0xaf9d('0x37')]=_[_0xaf9d('0x3a')](_0x4d96ab['where'],{'$or':_['map'](_0x51136d,function(_0x24bed4){if(_0x24bed4[_0xaf9d('0x2a')]!==_0xaf9d('0x3b')){var _0x58c221={};_0x58c221[_0x24bed4[_0xaf9d('0x27')]]={'$like':'%'+_0x3853e3[_0xaf9d('0x2c')][_0xaf9d('0x39')]+'%'};return _0x58c221;}})});}_0x4d96ab=_['merge']({},_0x4d96ab,_0x3853e3[_0xaf9d('0x3c')]);var _0x47757a={'where':_0x4d96ab['where']};return db[_0xaf9d('0x29')][_0xaf9d('0x1f')](_0x47757a)[_0xaf9d('0x24')](function(_0x11fc72){_0x50179c[_0xaf9d('0x1f')]=_0x11fc72;if(_0x3853e3[_0xaf9d('0x2c')][_0xaf9d('0x3d')]){_0x4d96ab[_0xaf9d('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0xaf9d('0x3f')](_0x4d96ab);})[_0xaf9d('0x24')](function(_0x2b4c6a){_0x50179c[_0xaf9d('0x40')]=_0x2b4c6a;return _0x50179c;})[_0xaf9d('0x24')](respondWithFilteredResult(_0x57ffe3,_0x4d96ab))[_0xaf9d('0x41')](handleError(_0x57ffe3,null));};exports['show']=function(_0x5a88b1,_0x1975e8){var _0x24ead8={'raw':!![],'where':{'id':_0x5a88b1['params']['id']}},_0x5bc442={};_0x5bc442[_0xaf9d('0x2b')]=_[_0xaf9d('0x2d')](db[_0xaf9d('0x29')][_0xaf9d('0x42')]);_0x5bc442[_0xaf9d('0x2c')]=_['keys'](_0x5a88b1[_0xaf9d('0x2c')]);_0x5bc442[_0xaf9d('0x2e')]=_['intersection'](_0x5bc442[_0xaf9d('0x2b')],_0x5bc442['query']);_0x24ead8[_0xaf9d('0x30')]=_[_0xaf9d('0x2f')](_0x5bc442['model'],qs[_0xaf9d('0x31')](_0x5a88b1['query'][_0xaf9d('0x31')]));_0x24ead8['attributes']=_0x24ead8[_0xaf9d('0x30')][_0xaf9d('0x32')]?_0x24ead8['attributes']:_0x5bc442['model'];if(_0x5a88b1['query'][_0xaf9d('0x3d')]){_0x24ead8[_0xaf9d('0x3e')]=[{'all':!![]}];}_0x24ead8=_[_0xaf9d('0x3a')]({},_0x24ead8,_0x5a88b1[_0xaf9d('0x3c')]);return db[_0xaf9d('0x29')][_0xaf9d('0x43')](_0x24ead8)[_0xaf9d('0x24')](handleEntityNotFound(_0x1975e8,null))[_0xaf9d('0x24')](respondWithResult(_0x1975e8,null))[_0xaf9d('0x41')](handleError(_0x1975e8,null));};exports[_0xaf9d('0x44')]=function(_0xef4863,_0x4c148d){var _0x4bec8f={'where':{'id':_0xef4863[_0xaf9d('0x45')]['id']}},_0x3140dc={};_0x3140dc[_0xaf9d('0x2b')]=_['keys'](db[_0xaf9d('0x29')]['rawAttributes']);_0x4bec8f[_0xaf9d('0x30')]=_[_0xaf9d('0x2f')](_0x3140dc[_0xaf9d('0x2b')],qs[_0xaf9d('0x31')](_0xef4863[_0xaf9d('0x2c')][_0xaf9d('0x31')]));_0x4bec8f[_0xaf9d('0x30')]=_0x4bec8f[_0xaf9d('0x30')][_0xaf9d('0x32')]?_0x4bec8f[_0xaf9d('0x30')]:_0x3140dc[_0xaf9d('0x2b')];if(_0xef4863['query'][_0xaf9d('0x3d')]){_0x4bec8f[_0xaf9d('0x3e')]=[{'all':!![]}];}_0x4bec8f=_['merge']({},_0x4bec8f,_0xef4863[_0xaf9d('0x3c')]);return db[_0xaf9d('0x29')][_0xaf9d('0x43')](_0x4bec8f)['then'](handleEntityNotFound(_0x4c148d,null))[_0xaf9d('0x24')](function(_0x5121f9){if(_0x5121f9){var _0x4441cd=_0x5121f9['get']({'plain':!![]});_0x4441cd=qs[_0xaf9d('0x46')](_0x4441cd,['id',_0xaf9d('0x47'),'updatedAt']);_0xef4863[_0xaf9d('0x48')]=_['omit'](_0xef4863[_0xaf9d('0x48')],['id',_0xaf9d('0x47'),_0xaf9d('0x49')]);return db[_0xaf9d('0x29')]['create'](_['merge'](_0x4441cd,_0xef4863[_0xaf9d('0x48')]),{'include':_0xef4863[_0xaf9d('0x2c')][_0xaf9d('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4c148d,0xc9))['catch'](handleError(_0x4c148d,null));};exports[_0xaf9d('0x23')]=function(_0x3b4d3b,_0x4f3216){if(_0x3b4d3b[_0xaf9d('0x48')]['id']){delete _0x3b4d3b[_0xaf9d('0x48')]['id'];}return db[_0xaf9d('0x29')][_0xaf9d('0x43')]({'where':{'id':_0x3b4d3b[_0xaf9d('0x45')]['id']}})[_0xaf9d('0x24')](handleEntityNotFound(_0x4f3216,null))[_0xaf9d('0x24')](saveUpdates(_0x3b4d3b[_0xaf9d('0x48')],null))[_0xaf9d('0x24')](respondWithResult(_0x4f3216,null))[_0xaf9d('0x41')](handleError(_0x4f3216,null));};exports['destroy']=function(_0x36bfde,_0x4a7af0){return db[_0xaf9d('0x29')]['find']({'where':{'id':_0x36bfde['params']['id']}})[_0xaf9d('0x24')](handleEntityNotFound(_0x4a7af0,null))['then'](removeEntity(_0x4a7af0,null))[_0xaf9d('0x41')](handleError(_0x4a7af0,null));};exports[_0xaf9d('0x4a')]=function(_0x23fd0c,_0x326527,_0x39c37c){_0x23fd0c['body']['name']=_0x23fd0c[_0xaf9d('0x4b')][_0xaf9d('0x4c')];_0x23fd0c[_0xaf9d('0x48')][_0xaf9d('0x4d')]=_0x23fd0c[_0xaf9d('0x4b')][_0xaf9d('0x4e')];_0x23fd0c[_0xaf9d('0x48')][_0xaf9d('0x2a')]=_0x23fd0c[_0xaf9d('0x4b')][_0xaf9d('0x4f')];return db[_0xaf9d('0x29')]['create'](_0x23fd0c[_0xaf9d('0x48')])[_0xaf9d('0x24')](respondWithResult(_0x326527,0xc9))[_0xaf9d('0x41')](handleError(_0x326527,null));};exports[_0xaf9d('0x50')]=function(_0x1b2d0b,_0x4542c7,_0x48626b){return db[_0xaf9d('0x29')]['findOne']({'where':{'id':_0x1b2d0b[_0xaf9d('0x45')]['id']},'raw':!![]})[_0xaf9d('0x24')](handleEntityNotFound(_0x4542c7,null))[_0xaf9d('0x24')](function(_0x19141a){if(_0x19141a){var _0x5aafd5=_0x19141a[_0xaf9d('0x51')]!==null;var _0x4a4124=path[_0xaf9d('0x52')](config[_0xaf9d('0x53')],_0xaf9d('0x54'));if(_0x5aafd5){_0x4a4124=path[_0xaf9d('0x52')](_0x4a4124,_0xaf9d('0x55'));}var _0x34c52d=path[_0xaf9d('0x52')](_0x4a4124,_0x19141a[_0xaf9d('0x4d')]);return _0x4542c7[_0xaf9d('0x50')](_0x34c52d);}})['catch'](handleError(_0x4542c7,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5d1f514..b1cd34c 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 _0x6b72=['../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5ee4c1,_0x431ce9){var _0x5537e0=function(_0x42048a){while(--_0x42048a){_0x5ee4c1['push'](_0x5ee4c1['shift']());}};_0x5537e0(++_0x431ce9);}(_0x6b72,0x19d));var _0x26b7=function(_0x3bac35,_0x532607){_0x3bac35=_0x3bac35-0x0;var _0x3c956f=_0x6b72[_0x3bac35];return _0x3c956f;};'use strict';var _=require(_0x26b7('0x0'));var util=require('util');var logger=require(_0x26b7('0x1'))(_0x26b7('0x2'));var moment=require('moment');var BPromise=require(_0x26b7('0x3'));var rp=require(_0x26b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x26b7('0x5'));var attributes=require(_0x26b7('0x6'));module[_0x26b7('0x7')]=function(_0x5bf038,_0x26ac11){return _0x5bf038[_0x26b7('0x8')](_0x26b7('0x9'),attributes,{'tableName':_0x26b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ccd=['attachments','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0xca5e0d,_0x3348e1){var _0x44f445=function(_0x433937){while(--_0x433937){_0xca5e0d['push'](_0xca5e0d['shift']());}};_0x44f445(++_0x3348e1);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var logger=require(_0xd9cc('0x1'))(_0xd9cc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd9cc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9cc('0x4'));var config=require(_0xd9cc('0x5'));var attributes=require(_0xd9cc('0x6'));module[_0xd9cc('0x7')]=function(_0x126f77,_0x113744){return _0x126f77[_0xd9cc('0x8')](_0xd9cc('0x9'),attributes,{'tableName':_0xd9cc('0xa'),'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 3b1e2fd..bc17dce 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 _0xa964=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','Attachment,\x20%s,\x20%s','message','result','catch','Attachment','create','body','options','CreateAttachment','lodash'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0xa964,0x144));var _0x4a96=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0xa964[_0x568a61];return _0x334c3b;};'use strict';var _=require(_0x4a96('0x0'));var util=require('util');var moment=require(_0x4a96('0x1'));var BPromise=require('bluebird');var rs=require(_0x4a96('0x2'));var fs=require('fs');var Redis=require(_0x4a96('0x3'));var db=require(_0x4a96('0x4'))['db'];var utils=require(_0x4a96('0x5'));var logger=require('../../config/logger')(_0x4a96('0x6'));var config=require('../../config/environment');var jayson=require(_0x4a96('0x7'));var client=jayson[_0x4a96('0x8')][_0x4a96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4182b5,_0x2ae66e,_0x3a3b18){return new BPromise(function(_0x1079c6,_0x4cbc49){return client['request'](_0x4182b5,_0x3a3b18)[_0x4a96('0xa')](function(_0x188c4b){logger[_0x4a96('0xb')]('Attachment,\x20%s,\x20%s',_0x2ae66e,_0x4a96('0xc'));logger[_0x4a96('0xd')]('Attachment,\x20%s,\x20%s,\x20%s',_0x2ae66e,_0x4a96('0xc'),JSON[_0x4a96('0xe')](_0x188c4b));if(_0x188c4b['error']){if(_0x188c4b[_0x4a96('0xf')]['code']===0x1f4){logger[_0x4a96('0xf')](_0x4a96('0x10'),_0x2ae66e,_0x188c4b[_0x4a96('0xf')][_0x4a96('0x11')]);return _0x4cbc49(_0x188c4b[_0x4a96('0xf')][_0x4a96('0x11')]);}logger[_0x4a96('0xf')](_0x4a96('0x10'),_0x2ae66e,_0x188c4b[_0x4a96('0xf')]['message']);return _0x1079c6(_0x188c4b[_0x4a96('0xf')][_0x4a96('0x11')]);}else{logger[_0x4a96('0xb')](_0x4a96('0x10'),_0x2ae66e,_0x4a96('0xc'));_0x1079c6(_0x188c4b[_0x4a96('0x12')][_0x4a96('0x11')]);}})[_0x4a96('0x13')](function(_0x3b1c21){logger[_0x4a96('0xf')](_0x4a96('0x10'),_0x2ae66e,_0x3b1c21);_0x4cbc49(_0x3b1c21);});});}exports['CreateAttachment']=function(_0x59a128){var _0x4e6272=this;return new Promise(function(_0x31fef7,_0x10b05c){return db[_0x4a96('0x14')][_0x4a96('0x15')](_0x59a128[_0x4a96('0x16')],{'raw':_0x59a128[_0x4a96('0x17')]?_0x59a128[_0x4a96('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x4a96('0xa')](function(_0x2e6c5d){logger[_0x4a96('0xb')](_0x4a96('0x18'),_0x59a128);logger[_0x4a96('0xd')]('CreateAttachment',_0x59a128,JSON[_0x4a96('0xe')](_0x2e6c5d));_0x31fef7(_0x2e6c5d);})[_0x4a96('0x13')](function(_0x4e4b94){logger['error'](_0x4a96('0x18'),_0x4e4b94[_0x4a96('0x11')],_0x59a128);_0x10b05c(_0x4e6272[_0x4a96('0xf')](0x1f4,_0x4e4b94[_0x4a96('0x11')]));});});}; \ No newline at end of file +var _0x8763=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','request','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment,\x20%s,\x20%s','CreateAttachment','create','body','options','raw','then','info','lodash'];(function(_0x15306a,_0x5617d9){var _0x316f0c=function(_0x5a718a){while(--_0x5a718a){_0x15306a['push'](_0x15306a['shift']());}};_0x316f0c(++_0x5617d9);}(_0x8763,0x81));var _0x3876=function(_0x59e2a1,_0x37b2e7){_0x59e2a1=_0x59e2a1-0x0;var _0x383f36=_0x8763[_0x59e2a1];return _0x383f36;};'use strict';var _=require(_0x3876('0x0'));var util=require(_0x3876('0x1'));var moment=require('moment');var BPromise=require(_0x3876('0x2'));var rs=require(_0x3876('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3876('0x4'))['db'];var utils=require(_0x3876('0x5'));var logger=require('../../config/logger')(_0x3876('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3876('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x199660,_0x470869,_0x4bca69){return new BPromise(function(_0x1019bb,_0x4d4c09){return client[_0x3876('0x8')](_0x199660,_0x4bca69)['then'](function(_0x3d6192){logger['info']('Attachment,\x20%s,\x20%s',_0x470869,_0x3876('0x9'));logger[_0x3876('0xa')](_0x3876('0xb'),_0x470869,_0x3876('0x9'),JSON[_0x3876('0xc')](_0x3d6192));if(_0x3d6192[_0x3876('0xd')]){if(_0x3d6192[_0x3876('0xd')][_0x3876('0xe')]===0x1f4){logger[_0x3876('0xd')]('Attachment,\x20%s,\x20%s',_0x470869,_0x3d6192[_0x3876('0xd')][_0x3876('0xf')]);return _0x4d4c09(_0x3d6192['error'][_0x3876('0xf')]);}logger[_0x3876('0xd')]('Attachment,\x20%s,\x20%s',_0x470869,_0x3d6192['error'][_0x3876('0xf')]);return _0x1019bb(_0x3d6192[_0x3876('0xd')][_0x3876('0xf')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x470869,_0x3876('0x9'));_0x1019bb(_0x3d6192[_0x3876('0x10')][_0x3876('0xf')]);}})[_0x3876('0x11')](function(_0x1e9389){logger['error'](_0x3876('0x12'),_0x470869,_0x1e9389);_0x4d4c09(_0x1e9389);});});}exports[_0x3876('0x13')]=function(_0x461b07){var _0x24fd48=this;return new Promise(function(_0x46a2e3,_0x528c9f){return db['Attachment'][_0x3876('0x14')](_0x461b07[_0x3876('0x15')],{'raw':_0x461b07['options']?_0x461b07[_0x3876('0x16')][_0x3876('0x17')]===undefined?!![]:![]:!![]})[_0x3876('0x18')](function(_0x3fd7ae){logger[_0x3876('0x19')]('CreateAttachment',_0x461b07);logger['debug']('CreateAttachment',_0x461b07,JSON[_0x3876('0xc')](_0x3fd7ae));_0x46a2e3(_0x3fd7ae);})[_0x3876('0x11')](function(_0x3cdd51){logger[_0x3876('0xd')]('CreateAttachment',_0x3cdd51[_0x3876('0xf')],_0x461b07);_0x528c9f(_0x24fd48[_0x3876('0xd')](0x1f4,_0x3cdd51[_0x3876('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 42b0bdd..f64fc19 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 _0x9e6b=['update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','/:id/clone','clone','diskStorage','join','server/files/attachments/','%s-%s','now','single','file','create'];(function(_0xf8e76d,_0x12c182){var _0x2ee23e=function(_0x1092e9){while(--_0x1092e9){_0xf8e76d['push'](_0xf8e76d['shift']());}};_0x2ee23e(++_0x12c182);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9e6b[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var path=require('path');var timeout=require(_0xb9e6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb9e6('0x3'));var auth=require(_0xb9e6('0x4'));var interaction=require(_0xb9e6('0x5'));var config=require(_0xb9e6('0x6'));var controller=require('./attachment.controller');router[_0xb9e6('0x7')]('/',auth[_0xb9e6('0x8')](),controller[_0xb9e6('0x9')]);router['get'](_0xb9e6('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb9e6('0xb'),auth['isAuthenticated'](),controller[_0xb9e6('0xc')]);router[_0xb9e6('0xd')](_0xb9e6('0xe'),auth[_0xb9e6('0x8')](),controller[_0xb9e6('0xf')]);var upload=multer({'storage':multer[_0xb9e6('0x10')]({'destination':function(_0xe8c995,_0x2e0081,_0x165903){_0x165903(null,path[_0xb9e6('0x11')](config['root'],_0xb9e6('0x12')));},'filename':function(_0x21ee09,_0x1229a8,_0x1eac5e){_0x1eac5e(null,util['format'](_0xb9e6('0x13'),Date[_0xb9e6('0x14')](),_0x1229a8['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb9e6('0xd')]('/',upload[_0xb9e6('0x15')](_0xb9e6('0x16')),controller[_0xb9e6('0x17')]);router['put'](_0xb9e6('0xa'),auth[_0xb9e6('0x8')](),controller[_0xb9e6('0x18')]);router[_0xb9e6('0x19')](_0xb9e6('0xa'),auth[_0xb9e6('0x8')](),controller[_0xb9e6('0x1a')]);module[_0xb9e6('0x1b')]=router; \ No newline at end of file +var _0x49f8=['update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','./attachment.controller','isAuthenticated','index','get','/:id','show','download','post','/:id/clone','clone','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','file','put'];(function(_0x32ad2d,_0x188218){var _0x2e5aa2=function(_0x550366){while(--_0x550366){_0x32ad2d['push'](_0x32ad2d['shift']());}};_0x2e5aa2(++_0x188218);}(_0x49f8,0xff));var _0x849f=function(_0x298b53,_0x3f830d){_0x298b53=_0x298b53-0x0;var _0x370c14=_0x49f8[_0x298b53];return _0x370c14;};'use strict';var multer=require(_0x849f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x849f('0x1'));var express=require(_0x849f('0x2'));var router=express['Router']();var fs_extra=require(_0x849f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x849f('0x4'));var config=require('../../config/environment');var controller=require(_0x849f('0x5'));router['get']('/',auth[_0x849f('0x6')](),controller[_0x849f('0x7')]);router[_0x849f('0x8')](_0x849f('0x9'),auth[_0x849f('0x6')](),controller[_0x849f('0xa')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x849f('0xb')]);router[_0x849f('0xc')](_0x849f('0xd'),auth[_0x849f('0x6')](),controller[_0x849f('0xe')]);var upload=multer({'storage':multer[_0x849f('0xf')]({'destination':function(_0x415d08,_0x4c4467,_0x14976e){_0x14976e(null,path['join'](config[_0x849f('0x10')],_0x849f('0x11')));},'filename':function(_0x401480,_0x23c0ef,_0x58dede){_0x58dede(null,util[_0x849f('0x12')](_0x849f('0x13'),Date[_0x849f('0x14')](),_0x23c0ef[_0x849f('0x15')][_0x849f('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single'](_0x849f('0x17')),controller['create']);router[_0x849f('0x18')](_0x849f('0x9'),auth[_0x849f('0x6')](),controller[_0x849f('0x19')]);router[_0x849f('0x1a')](_0x849f('0x9'),auth[_0x849f('0x6')](),controller['destroy']);module[_0x849f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 12943bf..d2ca7a6 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 _0x757c=['../../components/auth/service','../../config/utils','login','authenticate','/login','profile','callback','google','use','clientID','secret','callbackURL','findOne','allowedLoginAttempts','User','find','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment'];(function(_0x1f92bb,_0x8fe53a){var _0x4678d2=function(_0x175fc2){while(--_0x175fc2){_0x1f92bb['push'](_0x1f92bb['shift']());}};_0x4678d2(++_0x8fe53a);}(_0x757c,0xf5));var _0xc757=function(_0x3d426d,_0x131f72){_0x3d426d=_0x3d426d-0x0;var _0x2e6d48=_0x757c[_0x3d426d];return _0x2e6d48;};'use strict';var _=require(_0xc757('0x0'));var passport=require(_0xc757('0x1'));var GoogleStrategy=require(_0xc757('0x2'))[_0xc757('0x3')];var moment=require(_0xc757('0x4'));var db=require(_0xc757('0x5'))['db'];var config=require(_0xc757('0x6'));var signToken=require(_0xc757('0x7'))['signToken'];var utils=require(_0xc757('0x8'));exports[_0xc757('0x9')]=passport[_0xc757('0xa')]('google',{'failureRedirect':_0xc757('0xb'),'scope':[_0xc757('0xc'),'email'],'session':![]});exports[_0xc757('0xd')]=passport[_0xc757('0xa')](_0xc757('0xe'),{'failureRedirect':_0xc757('0xb'),'session':![]});passport[_0xc757('0xf')](new GoogleStrategy({'clientID':config[_0xc757('0xe')]?config[_0xc757('0xe')][_0xc757('0x10')]:'id','clientSecret':config[_0xc757('0xe')]?config[_0xc757('0xe')]['clientSecret']:_0xc757('0x11'),'callbackURL':config[_0xc757('0xe')]?config[_0xc757('0xe')][_0xc757('0x12')]:''},function(_0x5b394f,_0x302d2b,_0x5818e0,_0x53e826){var _0x116519,_0x33617e;return db['Setting'][_0xc757('0x13')]({'where':{'id':0x1},'attributes':[_0xc757('0x14'),'blockDuration'],'raw':!![]})['then'](function(_0x17e5e6){_0x116519=_0x17e5e6;return db[_0xc757('0x15')][_0xc757('0x16')]({'where':{'email':_['map'](_0x5818e0['emails'],_0xc757('0x17')),'role':{'$or':[_0xc757('0x18'),_0xc757('0x19'),'agent']}}});})[_0xc757('0x1a')](function(_0x12c6f3){_0x33617e=_0x12c6f3;if(_0x33617e){if(_0x33617e[_0xc757('0x1b')]){return _0x53e826(_0xc757('0x1c'));}else if(_0x116519[_0xc757('0x1d')]>0x0){if(_0x33617e[_0xc757('0x1e')]){if(moment(_0x33617e['blockedAt'])[_0xc757('0x1f')](_0x116519['blockDuration'],_0xc757('0x20'))>moment()){return _0x53e826('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xc757('0x21')](_0x33617e,0x0,![],null)[_0xc757('0x1a')](function(){return utils['getLicense'](_0x33617e);})[_0xc757('0x1a')](function(){return _0x53e826(null,_0x33617e);});}}else{return utils[_0xc757('0x22')](_0x33617e)[_0xc757('0x1a')](function(){return _0x53e826(null,_0x33617e);});}}else{return utils[_0xc757('0x22')](_0x33617e)[_0xc757('0x1a')](function(){return _0x53e826(null,_0x33617e);});}}return _0x53e826(_0xc757('0x1c'));})[_0xc757('0x23')](function(_0x245a7c){_0x53e826(_0x245a7c);});})); \ No newline at end of file +var _0xd58e=['blocked','blockedAt','minutes','getLicense','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','/login','profile','email','callback','authenticate','google','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','disabled'];(function(_0x125135,_0x19736b){var _0x166e38=function(_0x47aada){while(--_0x47aada){_0x125135['push'](_0x125135['shift']());}};_0x166e38(++_0x19736b);}(_0xd58e,0x96));var _0xed58=function(_0x2d0fb3,_0x451981){_0x2d0fb3=_0x2d0fb3-0x0;var _0x1eab20=_0xd58e[_0x2d0fb3];return _0x1eab20;};'use strict';var _=require(_0xed58('0x0'));var passport=require(_0xed58('0x1'));var GoogleStrategy=require(_0xed58('0x2'))[_0xed58('0x3')];var moment=require(_0xed58('0x4'));var db=require(_0xed58('0x5'))['db'];var config=require('../../config/environment');var signToken=require(_0xed58('0x6'))['signToken'];var utils=require('../../config/utils');exports['login']=passport['authenticate']('google',{'failureRedirect':_0xed58('0x7'),'scope':[_0xed58('0x8'),_0xed58('0x9')],'session':![]});exports[_0xed58('0xa')]=passport[_0xed58('0xb')](_0xed58('0xc'),{'failureRedirect':_0xed58('0x7'),'session':![]});passport[_0xed58('0xd')](new GoogleStrategy({'clientID':config['google']?config['google'][_0xed58('0xe')]:'id','clientSecret':config[_0xed58('0xc')]?config[_0xed58('0xc')]['clientSecret']:_0xed58('0xf'),'callbackURL':config[_0xed58('0xc')]?config['google'][_0xed58('0x10')]:''},function(_0x333bab,_0x3e88c1,_0x3fbe82,_0x5c9bca){var _0x45a2a7,_0x29abbf;return db[_0xed58('0x11')][_0xed58('0x12')]({'where':{'id':0x1},'attributes':[_0xed58('0x13'),_0xed58('0x14')],'raw':!![]})[_0xed58('0x15')](function(_0x161f57){_0x45a2a7=_0x161f57;return db[_0xed58('0x16')][_0xed58('0x17')]({'where':{'email':_[_0xed58('0x18')](_0x3fbe82['emails'],_0xed58('0x19')),'role':{'$or':[_0xed58('0x1a'),_0xed58('0x1b'),_0xed58('0x1c')]}}});})[_0xed58('0x15')](function(_0x2b0a02){_0x29abbf=_0x2b0a02;if(_0x29abbf){if(_0x29abbf[_0xed58('0x1d')]){return _0x5c9bca('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x45a2a7[_0xed58('0x14')]>0x0){if(_0x29abbf[_0xed58('0x1e')]){if(moment(_0x29abbf[_0xed58('0x1f')])['add'](_0x45a2a7[_0xed58('0x14')],_0xed58('0x20'))>moment()){return _0x5c9bca('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x29abbf,0x0,![],null)[_0xed58('0x15')](function(){return utils[_0xed58('0x21')](_0x29abbf);})[_0xed58('0x15')](function(){return _0x5c9bca(null,_0x29abbf);});}}else{return utils[_0xed58('0x21')](_0x29abbf)[_0xed58('0x15')](function(){return _0x5c9bca(null,_0x29abbf);});}}else{return utils[_0xed58('0x21')](_0x29abbf)[_0xed58('0x15')](function(){return _0x5c9bca(null,_0x29abbf);});}}return _0x5c9bca(_0xed58('0x22'));})[_0xed58('0x23')](function(_0x581517){_0x5c9bca(_0x581517);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 09e5c11..f993453 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 _0x4c4e=['get','login','callback','setTokenCookie','exports','express','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x4a2de2,_0x4918fc){var _0x284bd0=function(_0x37c989){while(--_0x37c989){_0x4a2de2['push'](_0x4a2de2['shift']());}};_0x284bd0(++_0x4918fc);}(_0x4c4e,0x152));var _0xe4c4=function(_0x290bf7,_0x493301){_0x290bf7=_0x290bf7-0x0;var _0x475f0f=_0x4c4e[_0x290bf7];return _0x475f0f;};'use strict';var express=require(_0xe4c4('0x0'));var passport=require('passport');var router=express[_0xe4c4('0x1')]();var controller=require(_0xe4c4('0x2'));var userController=require(_0xe4c4('0x3'));var authService=require('../../components/auth/service');router[_0xe4c4('0x4')]('/',controller[_0xe4c4('0x5')]);router[_0xe4c4('0x4')]('/callback',controller[_0xe4c4('0x6')],authService['isMiddleware'],userController[_0xe4c4('0x5')],authService[_0xe4c4('0x7')]);module[_0xe4c4('0x8')]=router; \ No newline at end of file +var _0xa7dc=['login','/callback','callback','isMiddleware','setTokenCookie','express','passport','Router','../user/user.controller.js','get'];(function(_0x2b6176,_0x18f079){var _0x427d25=function(_0x46f75f){while(--_0x46f75f){_0x2b6176['push'](_0x2b6176['shift']());}};_0x427d25(++_0x18f079);}(_0xa7dc,0x11d));var _0xca7d=function(_0x4d3d04,_0x2a4139){_0x4d3d04=_0x4d3d04-0x0;var _0x4a6e8c=_0xa7dc[_0x4d3d04];return _0x4a6e8c;};'use strict';var express=require(_0xca7d('0x0'));var passport=require(_0xca7d('0x1'));var router=express[_0xca7d('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xca7d('0x3'));var authService=require('../../components/auth/service');router[_0xca7d('0x4')]('/',controller[_0xca7d('0x5')]);router[_0xca7d('0x4')](_0xca7d('0x6'),controller[_0xca7d('0x7')],authService[_0xca7d('0x8')],userController[_0xca7d('0x5')],authService[_0xca7d('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 3d8dadc..fb94e9a 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 _0x77d4=['passport','Strategy','lodash','randomstring','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','blockedAt','user','agent','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use'];(function(_0x2219a2,_0x37d194){var _0x3e4a29=function(_0x1da431){while(--_0x1da431){_0x2219a2['push'](_0x2219a2['shift']());}};_0x3e4a29(++_0x37d194);}(_0x77d4,0x108));var _0x477d=function(_0x49b446,_0x2e7a57){_0x49b446=_0x49b446-0x0;var _0x41875c=_0x77d4[_0x49b446];return _0x41875c;};'use strict';var util=require('util');var passport=require(_0x477d('0x0'));var LocalStrategy=require('passport-local')[_0x477d('0x1')];var jayson=require('jayson/promise');var _=require(_0x477d('0x2'));var rs=require(_0x477d('0x3'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x477d('0x4'));var utils=require(_0x477d('0x5'));var client=jayson[_0x477d('0x6')][_0x477d('0x7')]({'port':0x232b});function localAuthenticate(_0x2545e5,_0x45ca2d,_0x5153df,_0x4f4fb4){var _0x2dd5d2,_0x579859;return db['Setting'][_0x477d('0x8')]({'where':{'id':0x1},'attributes':[_0x477d('0x9'),_0x477d('0xa')],'raw':!![]})[_0x477d('0xb')](function(_0x1cef1c){_0x2dd5d2=_0x1cef1c;return _0x2545e5['findOne']({'attributes':['id',_0x477d('0xc'),'password',_0x477d('0xd'),_0x477d('0xe'),'disabled',_0x477d('0xf'),_0x477d('0x10'),'loginAttempts'],'where':{'name':_0x45ca2d,'role':{'$or':['admin',_0x477d('0x11'),_0x477d('0x12')]}}});})['then'](function(_0x290d46){if(!_0x290d46||_0x290d46&&_0x290d46[_0x477d('0xc')]!==_0x45ca2d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x579859=_0x290d46;return _0x579859;}})['then'](function(){_0x579859[_0x477d('0x13')](_0x5153df,function(_0x4bbfef,_0x30481f){var _0x234b99=_0x579859[_0x477d('0x14')]+0x1;if(_0x4bbfef){return _0x4f4fb4(_0x4bbfef);}else if(!_0x30481f){if(_0x579859['disabled']){return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});}else if(_0x2dd5d2[_0x477d('0x9')]>0x0){if(_0x579859[_0x477d('0xf')]){if(_0x2dd5d2[_0x477d('0xa')]>0x0){if(moment(_0x579859['blockedAt'])[_0x477d('0x16')](_0x2dd5d2['blockDuration'],_0x477d('0x17'))>moment()){return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});}else{return utils[_0x477d('0x18')](_0x579859,_0x234b99,![],null)[_0x477d('0xb')](function(){return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});});}}else{return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});}}else{if(_0x234b99>=_0x2dd5d2['allowedLoginAttempts']){return utils[_0x477d('0x18')](_0x579859,0x0,!![],moment())['then'](function(){return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});});}else{return utils[_0x477d('0x18')](_0x579859,_0x234b99,![],null)[_0x477d('0xb')](function(){return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});});}}}else{return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});}}else{if(_0x579859[_0x477d('0x19')]){return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});}else if(_0x2dd5d2[_0x477d('0x9')]>0x0){if(_0x579859[_0x477d('0xf')]){if(_0x2dd5d2[_0x477d('0xa')]>0x0){if(moment(_0x579859[_0x477d('0x10')])[_0x477d('0x16')](_0x2dd5d2[_0x477d('0xa')],_0x477d('0x17'))>moment()){return _0x4f4fb4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x477d('0x18')](_0x579859,0x0,![],null)['then'](function(){return utils[_0x477d('0x1a')](_0x579859);})[_0x477d('0xb')](function(){return _0x4f4fb4(null,_0x579859);});}}else{return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});}}else{return utils[_0x477d('0x18')](_0x579859,0x0,![],null)['then'](function(){return utils[_0x477d('0x1a')](_0x579859);})[_0x477d('0xb')](function(){return _0x4f4fb4(null,_0x579859);})[_0x477d('0x1b')](function(_0x48ee5e){return _0x4f4fb4(null,![],_0x48ee5e);});}}else{if(_0x579859['blocked']){return _0x4f4fb4(null,![],{'message':_0x477d('0x15')});}else{return utils[_0x477d('0x1a')](_0x579859)[_0x477d('0xb')](function(){return _0x4f4fb4(null,_0x579859);});}}}});})['catch'](function(_0x254141){return _0x4f4fb4(null,![],_0x254141);});}function sendServiceMail(_0x297d15){return db[_0x477d('0x1c')][_0x477d('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x477d('0xc'),'email'],'include':[{'model':db[_0x477d('0x1e')],'as':_0x477d('0x1f')}]})[_0x477d('0xb')](function(_0x25a329){if(!_0x25a329){throw new Error(_0x477d('0x20'));}var _0x385eb4={'tls':{'rejectUnauthorized':![]}};if(_0x25a329[_0x477d('0x1f')][_0x477d('0x21')]){_0x385eb4[_0x477d('0x21')]=_0x25a329[_0x477d('0x1f')][_0x477d('0x21')];}else{_0x385eb4[_0x477d('0x22')]=_0x25a329[_0x477d('0x1f')][_0x477d('0x22')];_0x385eb4[_0x477d('0x23')]=_0x25a329[_0x477d('0x1f')][_0x477d('0x23')];_0x385eb4[_0x477d('0x24')]=_0x25a329[_0x477d('0x1f')][_0x477d('0x24')];}if(_0x25a329['Smtp'][_0x477d('0x25')]){_0x385eb4['auth']={'user':_0x25a329[_0x477d('0x1f')][_0x477d('0x11')],'pass':_0x25a329[_0x477d('0x1f')]['pass']};}var _0x117c97={'account':_0x385eb4,'message':_[_0x477d('0x26')]({'from':util[_0x477d('0x27')](_0x477d('0x28'),_0x25a329[_0x477d('0xc')],_0x25a329[_0x477d('0x29')]||_0x25a329[_0x477d('0x1f')][_0x477d('0x11')])},_0x297d15)};return client[_0x477d('0x2a')](_0x477d('0x2b'),_0x117c97);})['then'](function(_0x36a247){if(_0x36a247[_0x477d('0x2c')]){throw new Error(util[_0x477d('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x36a247[_0x477d('0x2c')][_0x477d('0x2d')]||JSON[_0x477d('0x2e')](_0x36a247['error'])));}return!![];});}function handleError(_0x5ecbc3,_0x21de5c,_0x3f818d){return _0x5ecbc3[_0x477d('0x2f')](_0x21de5c||0x1f4)[_0x477d('0x30')]({'message':_0x3f818d?_0x3f818d[_0x477d('0x2d')]||_0x3f818d:''});}exports['login']=function(_0x304055,_0x59ad77,_0x7b73b9){passport[_0x477d('0x13')](_0x477d('0x31'),function(_0x54355a,_0x5170fe,_0x184d50){var _0x2c7089=_0x54355a||_0x184d50;if(_0x2c7089){return handleError(_0x59ad77,0x191,_0x2c7089);}if(!_0x5170fe){return handleError(_0x59ad77,0x194,{'message':_0x477d('0x32')});}else{var _0x4758a5={'payload':{'id':_0x5170fe['id'],'role':_0x5170fe['role']},'options':{'expiresIn':0x15180}};return authService[_0x477d('0x33')](_0x4758a5)[_0x477d('0xb')](function(_0x40fdc0){_0x59ad77[_0x477d('0x34')]({'id':_0x5170fe['id'],'token':_0x40fdc0,'statusCall':'','isAlreadyLogged':_0x5170fe[_0x477d('0x35')]});});}})(_0x304055,_0x59ad77,_0x7b73b9);};exports['forgot']=function(_0x472149,_0x3142d5,_0x4d1c8e){if(!_0x472149[_0x477d('0x36')]['email']){return handleError(_0x3142d5,0x1f4,{'message':_0x477d('0x37')});}var _0x7a5a47=rs[_0x477d('0x38')]();_0x472149[_0x477d('0x36')][_0x477d('0x29')]=_0x472149[_0x477d('0x36')][_0x477d('0x29')][_0x477d('0x39')]()[_0x477d('0x3a')]();var _0x4c22f5;return db[_0x477d('0x3b')][_0x477d('0x8')]({'where':{'id':0x1},'attributes':[_0x477d('0x9'),_0x477d('0xa')],'raw':!![]})['then'](function(_0x4e0db1){_0x4c22f5=_0x4e0db1;return db[_0x477d('0x3c')][_0x477d('0x1d')]({'where':{'email':_0x472149['body'][_0x477d('0x29')]}});})['then'](function(_0x51ec10){if(!_0x51ec10){throw new Error(_0x477d('0x3d'));}if(_0x51ec10[_0x477d('0x19')]){throw new Error(_0x477d('0x3e'));}if(_0x51ec10[_0x477d('0xf')]){if(moment(_0x51ec10[_0x477d('0x10')])[_0x477d('0x16')](_0x4c22f5['blockDuration'],_0x477d('0x17'))>moment()){throw new Error(_0x477d('0x3f'));}else{_0x51ec10[_0x477d('0xf')]=![];_0x51ec10[_0x477d('0x10')]=null;}}_0x51ec10[_0x477d('0x40')]=_0x7a5a47;_0x51ec10['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x51ec10[_0x477d('0x41')]();})[_0x477d('0xb')](function(){return sendServiceMail({'to':_0x472149[_0x477d('0x36')]['email'],'subject':_0x477d('0x42'),'text':_0x477d('0x43')+_0x477d('0x44')+_0x477d('0x45')+_0x472149[_0x477d('0x46')][_0x477d('0x22')]+_0x477d('0x47')+_0x7a5a47+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x477d('0xb')](function(){_0x3142d5[_0x477d('0x2f')](0xc8)[_0x477d('0x30')]({'message':_0x477d('0x48')});})[_0x477d('0x1b')](function(_0x32b430){return handleError(_0x3142d5,0x1f4,_0x32b430);});};exports[_0x477d('0x49')]=function(_0x30e474,_0x113162,_0x33df7f){return db[_0x477d('0x3c')][_0x477d('0x1d')]({'where':{'resetPasswordToken':_0x30e474[_0x477d('0x4a')][_0x477d('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x477d('0x4c')]()}}})['then'](function(_0xa20d0b){if(!_0xa20d0b){throw new Error(_0x477d('0x4d'));}return db['Setting']['findOne']({'attributes':['id','securePassword',_0x477d('0x4e'),_0x477d('0x4f')]})[_0x477d('0xb')](function(_0x6c7541){if(_0x6c7541[_0x477d('0x50')])authService[_0x477d('0x51')](_0x30e474[_0x477d('0x36')][_0x477d('0x52')]);if(!_0x6c7541['enforcePasswordHistory']||!_0xa20d0b[_0x477d('0x53')])return _0xa20d0b;authService[_0x477d('0x54')](_0x30e474[_0x477d('0x36')][_0x477d('0x52')],_0xa20d0b[_0x477d('0x53')],_0x6c7541[_0x477d('0x4f')]);return _0xa20d0b;})[_0x477d('0xb')](function(){_0xa20d0b[_0x477d('0x52')]=_0x30e474['body'][_0x477d('0x52')];_0xa20d0b[_0x477d('0x40')]=null;_0xa20d0b[_0x477d('0x55')]=null;return _0xa20d0b[_0x477d('0x41')]();});})[_0x477d('0xb')](function(){_0x113162['status'](0xc8)[_0x477d('0x30')]({'message':_0x477d('0x56')});})[_0x477d('0x1b')](function(_0x239ece){return handleError(_0x113162,0x1f4,_0x239ece);});};passport[_0x477d('0x57')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x3b287f,_0xb175d1,_0x95f9e0){return localAuthenticate(db[_0x477d('0x3c')],_0x3b287f,_0xb175d1,_0x95f9e0);})); \ No newline at end of file +var _0x326f=['user','request','error','stringify','send','message','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','find','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','util','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','allowedLoginAttempts','blockDuration','then','findOne','password','role','blocked','loginAttempts','admin','agent','name','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','blockedAt','getLicense','catch','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>'];(function(_0x4f9339,_0x257cd7){var _0x43d640=function(_0x29d9e9){while(--_0x29d9e9){_0x4f9339['push'](_0x4f9339['shift']());}};_0x43d640(++_0x257cd7);}(_0x326f,0xd1));var _0xf326=function(_0x271f9d,_0x23728c){_0x271f9d=_0x271f9d-0x0;var _0x82016e=_0x326f[_0x271f9d];return _0x82016e;};'use strict';var util=require(_0xf326('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xf326('0x1')];var jayson=require(_0xf326('0x2'));var _=require(_0xf326('0x3'));var rs=require(_0xf326('0x4'));var moment=require(_0xf326('0x5'));var db=require(_0xf326('0x6'))['db'];var authService=require(_0xf326('0x7'));var utils=require(_0xf326('0x8'));var client=jayson[_0xf326('0x9')][_0xf326('0xa')]({'port':0x232b});function localAuthenticate(_0x4c2249,_0x3c254d,_0x3851eb,_0x165f95){var _0x1e7b8a,_0x515bfa;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xf326('0xb'),_0xf326('0xc')],'raw':!![]})[_0xf326('0xd')](function(_0x2686e1){_0x1e7b8a=_0x2686e1;return _0x4c2249[_0xf326('0xe')]({'attributes':['id','name',_0xf326('0xf'),'salt',_0xf326('0x10'),'disabled',_0xf326('0x11'),'blockedAt',_0xf326('0x12')],'where':{'name':_0x3c254d,'role':{'$or':[_0xf326('0x13'),'user',_0xf326('0x14')]}}});})[_0xf326('0xd')](function(_0x3504eb){if(!_0x3504eb||_0x3504eb&&_0x3504eb[_0xf326('0x15')]!==_0x3c254d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x515bfa=_0x3504eb;return _0x515bfa;}})[_0xf326('0xd')](function(){_0x515bfa['authenticate'](_0x3851eb,function(_0x54bd1a,_0xdf21d9){var _0x11f6d2=_0x515bfa[_0xf326('0x12')]+0x1;if(_0x54bd1a){return _0x165f95(_0x54bd1a);}else if(!_0xdf21d9){if(_0x515bfa[_0xf326('0x16')]){return _0x165f95(null,![],{'message':_0xf326('0x17')});}else if(_0x1e7b8a[_0xf326('0xb')]>0x0){if(_0x515bfa[_0xf326('0x11')]){if(_0x1e7b8a[_0xf326('0xc')]>0x0){if(moment(_0x515bfa['blockedAt'])[_0xf326('0x18')](_0x1e7b8a[_0xf326('0xc')],_0xf326('0x19'))>moment()){return _0x165f95(null,![],{'message':_0xf326('0x17')});}else{return utils[_0xf326('0x1a')](_0x515bfa,_0x11f6d2,![],null)[_0xf326('0xd')](function(){return _0x165f95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x165f95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x11f6d2>=_0x1e7b8a['allowedLoginAttempts']){return utils[_0xf326('0x1a')](_0x515bfa,0x0,!![],moment())[_0xf326('0xd')](function(){return _0x165f95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x515bfa,_0x11f6d2,![],null)[_0xf326('0xd')](function(){return _0x165f95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x165f95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x515bfa[_0xf326('0x16')]){return _0x165f95(null,![],{'message':_0xf326('0x17')});}else if(_0x1e7b8a['allowedLoginAttempts']>0x0){if(_0x515bfa['blocked']){if(_0x1e7b8a[_0xf326('0xc')]>0x0){if(moment(_0x515bfa[_0xf326('0x1b')])['add'](_0x1e7b8a[_0xf326('0xc')],_0xf326('0x19'))>moment()){return _0x165f95(null,![],{'message':_0xf326('0x17')});}else{return utils[_0xf326('0x1a')](_0x515bfa,0x0,![],null)[_0xf326('0xd')](function(){return utils[_0xf326('0x1c')](_0x515bfa);})['then'](function(){return _0x165f95(null,_0x515bfa);});}}else{return _0x165f95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x515bfa,0x0,![],null)[_0xf326('0xd')](function(){return utils[_0xf326('0x1c')](_0x515bfa);})[_0xf326('0xd')](function(){return _0x165f95(null,_0x515bfa);})[_0xf326('0x1d')](function(_0x148953){return _0x165f95(null,![],_0x148953);});}}else{if(_0x515bfa[_0xf326('0x11')]){return _0x165f95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf326('0x1c')](_0x515bfa)[_0xf326('0xd')](function(){return _0x165f95(null,_0x515bfa);});}}}});})[_0xf326('0x1d')](function(_0x581531){return _0x165f95(null,![],_0x581531);});}function sendServiceMail(_0x1617d2){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0xf326('0x15'),_0xf326('0x1e')],'include':[{'model':db[_0xf326('0x1f')],'as':'Smtp'}]})[_0xf326('0xd')](function(_0x292500){if(!_0x292500){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x225776={'tls':{'rejectUnauthorized':![]}};if(_0x292500[_0xf326('0x20')][_0xf326('0x21')]){_0x225776[_0xf326('0x21')]=_0x292500[_0xf326('0x20')][_0xf326('0x21')];}else{_0x225776[_0xf326('0x22')]=_0x292500[_0xf326('0x20')][_0xf326('0x22')];_0x225776[_0xf326('0x23')]=_0x292500['Smtp'][_0xf326('0x23')];_0x225776[_0xf326('0x24')]=_0x292500[_0xf326('0x20')]['secure'];}if(_0x292500[_0xf326('0x20')][_0xf326('0x25')]){_0x225776[_0xf326('0x26')]={'user':_0x292500['Smtp']['user'],'pass':_0x292500[_0xf326('0x20')][_0xf326('0x27')]};}var _0x9c3039={'account':_0x225776,'message':_[_0xf326('0x28')]({'from':util[_0xf326('0x29')](_0xf326('0x2a'),_0x292500[_0xf326('0x15')],_0x292500[_0xf326('0x1e')]||_0x292500['Smtp'][_0xf326('0x2b')])},_0x1617d2)};return client[_0xf326('0x2c')]('SendMail',_0x9c3039);})[_0xf326('0xd')](function(_0x4e5d7c){if(_0x4e5d7c[_0xf326('0x2d')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4e5d7c[_0xf326('0x2d')]['message']||JSON[_0xf326('0x2e')](_0x4e5d7c['error'])));}return!![];});}function handleError(_0x310dbb,_0x409260,_0x2750ae){return _0x310dbb['status'](_0x409260||0x1f4)[_0xf326('0x2f')]({'message':_0x2750ae?_0x2750ae[_0xf326('0x30')]||_0x2750ae:''});}exports['login']=function(_0x13932b,_0xf64dd0,_0x40fa7a){passport[_0xf326('0x31')]('local',function(_0x2c4416,_0xb1ef35,_0x1e69b1){var _0x47188b=_0x2c4416||_0x1e69b1;if(_0x47188b){return handleError(_0xf64dd0,0x191,_0x47188b);}if(!_0xb1ef35){return handleError(_0xf64dd0,0x194,{'message':_0xf326('0x32')});}else{var _0x5f02b5={'payload':{'id':_0xb1ef35['id'],'role':_0xb1ef35[_0xf326('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xf326('0x33')](_0x5f02b5)['then'](function(_0x4dd361){_0xf64dd0[_0xf326('0x34')]({'id':_0xb1ef35['id'],'token':_0x4dd361,'statusCall':'','isAlreadyLogged':_0xb1ef35['online']});});}})(_0x13932b,_0xf64dd0,_0x40fa7a);};exports['forgot']=function(_0x22d462,_0x5d6ae2,_0x3e1e8c){if(!_0x22d462[_0xf326('0x35')][_0xf326('0x1e')]){return handleError(_0x5d6ae2,0x1f4,{'message':_0xf326('0x36')});}var _0x49112d=rs[_0xf326('0x37')]();_0x22d462[_0xf326('0x35')][_0xf326('0x1e')]=_0x22d462[_0xf326('0x35')][_0xf326('0x1e')][_0xf326('0x38')]()[_0xf326('0x39')]();var _0x224a32;return db[_0xf326('0x3a')][_0xf326('0xe')]({'where':{'id':0x1},'attributes':[_0xf326('0xb'),_0xf326('0xc')],'raw':!![]})['then'](function(_0x1b6126){_0x224a32=_0x1b6126;return db[_0xf326('0x3b')][_0xf326('0x3c')]({'where':{'email':_0x22d462[_0xf326('0x35')][_0xf326('0x1e')]}});})[_0xf326('0xd')](function(_0x4f4c51){if(!_0x4f4c51){throw new Error(_0xf326('0x3d'));}if(_0x4f4c51[_0xf326('0x16')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x4f4c51[_0xf326('0x11')]){if(moment(_0x4f4c51[_0xf326('0x1b')])[_0xf326('0x18')](_0x224a32[_0xf326('0xc')],_0xf326('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4f4c51['blocked']=![];_0x4f4c51[_0xf326('0x1b')]=null;}}_0x4f4c51[_0xf326('0x3e')]=_0x49112d;_0x4f4c51['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x4f4c51[_0xf326('0x3f')]();})[_0xf326('0xd')](function(){return sendServiceMail({'to':_0x22d462[_0xf326('0x35')]['email'],'subject':_0xf326('0x40'),'text':_0xf326('0x41')+_0xf326('0x42')+_0xf326('0x43')+_0x22d462[_0xf326('0x44')][_0xf326('0x22')]+_0xf326('0x45')+_0x49112d+'\x0a\x0a'+_0xf326('0x46')});})[_0xf326('0xd')](function(){_0x5d6ae2[_0xf326('0x47')](0xc8)[_0xf326('0x2f')]({'message':_0xf326('0x48')});})[_0xf326('0x1d')](function(_0x395b1e){return handleError(_0x5d6ae2,0x1f4,_0x395b1e);});};exports[_0xf326('0x49')]=function(_0x59f9a7,_0x199f8b,_0x1b0e03){return db[_0xf326('0x3b')][_0xf326('0x3c')]({'where':{'resetPasswordToken':_0x59f9a7['params'][_0xf326('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xf326('0x4b')]()}}})[_0xf326('0xd')](function(_0x46fe85){if(!_0x46fe85){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xf326('0x3a')][_0xf326('0xe')]({'attributes':['id',_0xf326('0x4c'),_0xf326('0x4d'),_0xf326('0x4e')]})['then'](function(_0x5d312d){if(_0x5d312d[_0xf326('0x4c')])authService[_0xf326('0x4f')](_0x59f9a7[_0xf326('0x35')]['password']);if(!_0x5d312d[_0xf326('0x4d')]||!_0x46fe85[_0xf326('0x50')])return _0x46fe85;authService[_0xf326('0x51')](_0x59f9a7['body']['password'],_0x46fe85[_0xf326('0x50')],_0x5d312d['passwordHistoryLimit']);return _0x46fe85;})[_0xf326('0xd')](function(){_0x46fe85['password']=_0x59f9a7[_0xf326('0x35')][_0xf326('0xf')];_0x46fe85[_0xf326('0x3e')]=null;_0x46fe85[_0xf326('0x52')]=null;return _0x46fe85[_0xf326('0x3f')]();});})[_0xf326('0xd')](function(){_0x199f8b[_0xf326('0x47')](0xc8)['send']({'message':_0xf326('0x53')});})[_0xf326('0x1d')](function(_0x424d24){return handleError(_0x199f8b,0x1f4,_0x424d24);});};passport['use'](new LocalStrategy({'usernameField':_0xf326('0x15'),'passwordField':_0xf326('0xf')},function(_0x3b8635,_0x16c578,_0x1159e){return localAuthenticate(db['User'],_0x3b8635,_0x16c578,_0x1159e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a71be82..9b0bab9 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 _0x9380=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0xcb5438,_0x56cc82){var _0x2f8738=function(_0x5e0c2f){while(--_0x5e0c2f){_0xcb5438['push'](_0xcb5438['shift']());}};_0x2f8738(++_0x56cc82);}(_0x9380,0x117));var _0x0938=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9380[_0x1203f];return _0x365f0a;};'use strict';var express=require(_0x0938('0x0'));var router=express[_0x0938('0x1')]();var controller=require(_0x0938('0x2'));router[_0x0938('0x3')]('/',controller[_0x0938('0x4')]);router[_0x0938('0x3')](_0x0938('0x5'),controller[_0x0938('0x6')]);router[_0x0938('0x3')](_0x0938('0x7'),controller[_0x0938('0x8')]);module[_0x0938('0x9')]=router; \ No newline at end of file +var _0x7ca5=['exports','express','Router','post','login','/forgot','reset'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7ca5,0x1f2));var _0x57ca=function(_0x43f5a3,_0x58ed44){_0x43f5a3=_0x43f5a3-0x0;var _0x3c5e13=_0x7ca5[_0x43f5a3];return _0x3c5e13;};'use strict';var express=require(_0x57ca('0x0'));var router=express[_0x57ca('0x1')]();var controller=require('./authLocal.controller');router[_0x57ca('0x2')]('/',controller[_0x57ca('0x3')]);router['post'](_0x57ca('0x4'),controller['forgot']);router[_0x57ca('0x2')]('/reset/:token',controller[_0x57ca('0x5')]);module[_0x57ca('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c8dc609..440f4f9 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 _0x7c30=['BOOLEAN','INTEGER','STRING'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7c30,0x125));var _0x07c3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7c30[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x07c3('0x0')]},'status':{'type':Sequelize[_0x07c3('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x07c3('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x372e=['exports','STRING','INTEGER'];(function(_0x165e7e,_0x5bcf8e){var _0x38a1ff=function(_0x468f7e){while(--_0x468f7e){_0x165e7e['push'](_0x165e7e['shift']());}};_0x38a1ff(++_0x5bcf8e);}(_0x372e,0x117));var _0xe372=function(_0x50d199,_0x29e353){_0x50d199=_0x50d199-0x0;var _0x57c7d5=_0x372e[_0x50d199];return _0x57c7d5;};'use strict';var Sequelize=require('sequelize');module[_0xe372('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xe372('0x1')]},'description':{'type':Sequelize[_0xe372('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe372('0x2')],'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 61b0c8c..005b859 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 _0xbe26=['length','options','create','body','catch','find','addConditions','Condition','ids','order','getConditions','addActions','Action','omit','getActions','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','includeAll','include','rows','show','params','fields'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbe26,0x175));var _0x6be2=function(_0x12c93d,_0xf99032){_0x12c93d=_0x12c93d-0x0;var _0x21eadb=_0xbe26[_0x12c93d];return _0x21eadb;};'use strict';var emlformat=require(_0x6be2('0x0'));var rimraf=require(_0x6be2('0x1'));var zipdir=require(_0x6be2('0x2'));var jsonpatch=require(_0x6be2('0x3'));var rp=require(_0x6be2('0x4'));var moment=require(_0x6be2('0x5'));var BPromise=require(_0x6be2('0x6'));var Mustache=require(_0x6be2('0x7'));var util=require(_0x6be2('0x8'));var path=require(_0x6be2('0x9'));var sox=require(_0x6be2('0xa'));var csv=require(_0x6be2('0xb'));var ejs=require(_0x6be2('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6be2('0xd'));var squel=require(_0x6be2('0xe'));var crypto=require(_0x6be2('0xf'));var jsforce=require(_0x6be2('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6be2('0xb'));var querystring=require('querystring');var Papa=require(_0x6be2('0x11'));var Redis=require(_0x6be2('0x12'));var authService=require(_0x6be2('0x13'));var qs=require(_0x6be2('0x14'));var as=require(_0x6be2('0x15'));var hardwareService=require(_0x6be2('0x16'));var logger=require(_0x6be2('0x17'))(_0x6be2('0x18'));var utils=require(_0x6be2('0x19'));var config=require(_0x6be2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6be2('0x1b'))['db'];function respondWithStatusCode(_0x2e8b69,_0x26cc31){_0x26cc31=_0x26cc31||0xcc;return function(_0x51462d){if(_0x51462d){return _0x2e8b69[_0x6be2('0x1c')](_0x26cc31);}return _0x2e8b69[_0x6be2('0x1d')](_0x26cc31)[_0x6be2('0x1e')]();};}function respondWithResult(_0x8f4829,_0x2a9697){_0x2a9697=_0x2a9697||0xc8;return function(_0x558d96){if(_0x558d96){return _0x8f4829[_0x6be2('0x1d')](_0x2a9697)[_0x6be2('0x1f')](_0x558d96);}};}function respondWithFilteredResult(_0x51f509,_0x2c20ef){return function(_0x2a09a6){if(_0x2a09a6){var _0x4474f1=typeof _0x2c20ef[_0x6be2('0x20')]===_0x6be2('0x21')&&typeof _0x2c20ef[_0x6be2('0x22')]==='undefined';var _0x3282fa=_0x2a09a6[_0x6be2('0x23')];var _0x2e886a=_0x4474f1?0x0:_0x2c20ef['offset'];var _0x12a399=_0x4474f1?_0x2a09a6[_0x6be2('0x23')]:_0x2c20ef[_0x6be2('0x20')]+_0x2c20ef['limit'];var _0x20e01b;if(_0x12a399>=_0x3282fa){_0x12a399=_0x3282fa;_0x20e01b=0xc8;}else{_0x20e01b=0xce;}_0x51f509['status'](_0x20e01b);return _0x51f509[_0x6be2('0x24')](_0x6be2('0x25'),_0x2e886a+'-'+_0x12a399+'/'+_0x3282fa)[_0x6be2('0x1f')](_0x2a09a6);}return null;};}function patchUpdates(_0x5da352){return function(_0x5d6402){try{jsonpatch[_0x6be2('0x26')](_0x5d6402,_0x5da352,!![]);}catch(_0x26a7b8){return BPromise[_0x6be2('0x27')](_0x26a7b8);}return _0x5d6402['save']();};}function saveUpdates(_0x4ef9f8,_0x493bd3){return function(_0x1af414){if(_0x1af414){return _0x1af414['update'](_0x4ef9f8)[_0x6be2('0x28')](function(_0x1103ba){return _0x1103ba;});}return null;};}function removeEntity(_0x59e79e,_0x260e53){return function(_0x20588d){if(_0x20588d){return _0x20588d[_0x6be2('0x29')]()[_0x6be2('0x28')](function(){_0x59e79e[_0x6be2('0x1d')](0xcc)[_0x6be2('0x1e')]();});}};}function handleEntityNotFound(_0x387336,_0x1ab724){return function(_0x2ecdd8){if(!_0x2ecdd8){_0x387336[_0x6be2('0x1c')](0x194);}return _0x2ecdd8;};}function handleError(_0x1a0b3a,_0x45de49){_0x45de49=_0x45de49||0x1f4;return function(_0x34204b){logger[_0x6be2('0x2a')](_0x34204b[_0x6be2('0x2b')]);if(_0x34204b[_0x6be2('0x2c')]){delete _0x34204b[_0x6be2('0x2c')];}_0x1a0b3a['status'](_0x45de49)[_0x6be2('0x2d')](_0x34204b);};}exports[_0x6be2('0x2e')]=function(_0x45449f,_0xe8e21){var _0x4f3900={},_0x357fa4={},_0x1467a8={'count':0x0,'rows':[]};var _0x534740=_[_0x6be2('0x2f')](db[_0x6be2('0x30')][_0x6be2('0x31')],function(_0x1c8678){return{'name':_0x1c8678[_0x6be2('0x32')],'type':_0x1c8678['type'][_0x6be2('0x33')]};});_0x357fa4[_0x6be2('0x34')]=_[_0x6be2('0x2f')](_0x534740,'name');_0x357fa4[_0x6be2('0x35')]=_[_0x6be2('0x36')](_0x45449f[_0x6be2('0x35')]);_0x357fa4[_0x6be2('0x37')]=_[_0x6be2('0x38')](_0x357fa4[_0x6be2('0x34')],_0x357fa4[_0x6be2('0x35')]);_0x4f3900['attributes']=_[_0x6be2('0x38')](_0x357fa4[_0x6be2('0x34')],qs['fields'](_0x45449f[_0x6be2('0x35')]['fields']));_0x4f3900[_0x6be2('0x39')]=_0x4f3900[_0x6be2('0x39')]['length']?_0x4f3900[_0x6be2('0x39')]:_0x357fa4[_0x6be2('0x34')];if(!_0x45449f[_0x6be2('0x35')][_0x6be2('0x3a')](_0x6be2('0x3b'))){_0x4f3900[_0x6be2('0x22')]=qs[_0x6be2('0x22')](_0x45449f['query'][_0x6be2('0x22')]);_0x4f3900['offset']=qs[_0x6be2('0x20')](_0x45449f[_0x6be2('0x35')][_0x6be2('0x20')]);}_0x4f3900['order']=qs[_0x6be2('0x3c')](_0x45449f[_0x6be2('0x35')]['sort']);_0x4f3900[_0x6be2('0x3d')]=qs['filters'](_['pick'](_0x45449f[_0x6be2('0x35')],_0x357fa4['filters']),_0x534740);if(_0x45449f[_0x6be2('0x35')][_0x6be2('0x3e')]){_0x4f3900[_0x6be2('0x3d')]=_['merge'](_0x4f3900[_0x6be2('0x3d')],{'$or':_['map'](_0x534740,function(_0x234452){if(_0x234452[_0x6be2('0x3f')]!==_0x6be2('0x40')){var _0x174325={};_0x174325[_0x234452[_0x6be2('0x2c')]]={'$like':'%'+_0x45449f[_0x6be2('0x35')]['filter']+'%'};return _0x174325;}})});}_0x4f3900=_[_0x6be2('0x41')]({},_0x4f3900,_0x45449f['options']);var _0x50ef20={'where':_0x4f3900['where']};return db[_0x6be2('0x30')]['count'](_0x50ef20)[_0x6be2('0x28')](function(_0x33b2d4){_0x1467a8[_0x6be2('0x23')]=_0x33b2d4;if(_0x45449f[_0x6be2('0x35')][_0x6be2('0x42')]){_0x4f3900[_0x6be2('0x43')]=[{'all':!![]}];}return db[_0x6be2('0x30')]['findAll'](_0x4f3900);})[_0x6be2('0x28')](function(_0x43f494){_0x1467a8[_0x6be2('0x44')]=_0x43f494;return _0x1467a8;})['then'](respondWithFilteredResult(_0xe8e21,_0x4f3900))['catch'](handleError(_0xe8e21,null));};exports[_0x6be2('0x45')]=function(_0x510bb7,_0xe23509){var _0x2e90ba={'raw':![],'where':{'id':_0x510bb7[_0x6be2('0x46')]['id']}},_0xf8c504={};_0xf8c504['model']=_[_0x6be2('0x36')](db[_0x6be2('0x30')][_0x6be2('0x31')]);_0xf8c504['query']=_[_0x6be2('0x36')](_0x510bb7[_0x6be2('0x35')]);_0xf8c504[_0x6be2('0x37')]=_[_0x6be2('0x38')](_0xf8c504[_0x6be2('0x34')],_0xf8c504[_0x6be2('0x35')]);_0x2e90ba['attributes']=_[_0x6be2('0x38')](_0xf8c504[_0x6be2('0x34')],qs[_0x6be2('0x47')](_0x510bb7[_0x6be2('0x35')][_0x6be2('0x47')]));_0x2e90ba[_0x6be2('0x39')]=_0x2e90ba[_0x6be2('0x39')][_0x6be2('0x48')]?_0x2e90ba[_0x6be2('0x39')]:_0xf8c504[_0x6be2('0x34')];if(_0x510bb7[_0x6be2('0x35')][_0x6be2('0x42')]){_0x2e90ba[_0x6be2('0x43')]=[{'all':!![]}];}_0x2e90ba=_['merge']({},_0x2e90ba,_0x510bb7[_0x6be2('0x49')]);return db['Automation']['find'](_0x2e90ba)[_0x6be2('0x28')](handleEntityNotFound(_0xe23509,null))[_0x6be2('0x28')](respondWithResult(_0xe23509,null))['catch'](handleError(_0xe23509,null));};exports['create']=function(_0x27ed4e,_0x2b95db){return db[_0x6be2('0x30')][_0x6be2('0x4a')](_0x27ed4e[_0x6be2('0x4b')],{})[_0x6be2('0x28')](respondWithResult(_0x2b95db,0xc9))[_0x6be2('0x4c')](handleError(_0x2b95db,null));};exports['update']=function(_0x4dd29b,_0x5eef99){if(_0x4dd29b[_0x6be2('0x4b')]['id']){delete _0x4dd29b[_0x6be2('0x4b')]['id'];}return db[_0x6be2('0x30')][_0x6be2('0x4d')]({'where':{'id':_0x4dd29b[_0x6be2('0x46')]['id']}})[_0x6be2('0x28')](handleEntityNotFound(_0x5eef99,null))[_0x6be2('0x28')](saveUpdates(_0x4dd29b[_0x6be2('0x4b')],null))['then'](respondWithResult(_0x5eef99,null))[_0x6be2('0x4c')](handleError(_0x5eef99,null));};exports[_0x6be2('0x29')]=function(_0x4dae47,_0x2ed683){return db['Automation'][_0x6be2('0x4d')]({'where':{'id':_0x4dae47[_0x6be2('0x46')]['id']}})[_0x6be2('0x28')](handleEntityNotFound(_0x2ed683,null))['then'](removeEntity(_0x2ed683,null))['catch'](handleError(_0x2ed683,null));};exports[_0x6be2('0x4e')]=function(_0x4baa3c,_0x57b4ef,_0x4a6687){return db[_0x6be2('0x4f')][_0x6be2('0x4d')]({'where':{'id':_0x4baa3c[_0x6be2('0x46')]['id']}})[_0x6be2('0x28')](handleEntityNotFound(_0x57b4ef,null))[_0x6be2('0x28')](function(_0x280c9f){if(_0x280c9f){return _0x280c9f[_0x6be2('0x4e')](_0x4baa3c[_0x6be2('0x4b')][_0x6be2('0x50')],_['omit'](_0x4baa3c['body'],[_0x6be2('0x50'),'id'])||{});}})[_0x6be2('0x28')](respondWithResult(_0x57b4ef,null))[_0x6be2('0x4c')](handleError(_0x57b4ef,null));};exports['getConditions']=function(_0x21ddc6,_0x164622,_0x236cb7){var _0x27b0df={};var _0x4fec25={};var _0x3e3f73;var _0x4b2f59;return db['Automation']['findOne']({'where':{'id':_0x21ddc6[_0x6be2('0x46')]['id']}})[_0x6be2('0x28')](handleEntityNotFound(_0x164622,null))[_0x6be2('0x28')](function(_0x83569){if(_0x83569){_0x3e3f73=_0x83569;_0x4fec25[_0x6be2('0x34')]=_[_0x6be2('0x36')](db['Condition'][_0x6be2('0x31')]);_0x4fec25['query']=_[_0x6be2('0x36')](_0x21ddc6[_0x6be2('0x35')]);_0x4fec25[_0x6be2('0x37')]=_[_0x6be2('0x38')](_0x4fec25[_0x6be2('0x34')],_0x4fec25[_0x6be2('0x35')]);_0x27b0df[_0x6be2('0x39')]=_[_0x6be2('0x38')](_0x4fec25['model'],qs['fields'](_0x21ddc6[_0x6be2('0x35')][_0x6be2('0x47')]));_0x27b0df['attributes']=_0x27b0df[_0x6be2('0x39')]['length']?_0x27b0df[_0x6be2('0x39')]:_0x4fec25[_0x6be2('0x34')];_0x27b0df[_0x6be2('0x51')]=qs[_0x6be2('0x3c')](_0x21ddc6['query'][_0x6be2('0x3c')]);_0x27b0df['where']=qs[_0x6be2('0x37')](_['pick'](_0x21ddc6[_0x6be2('0x35')],_0x4fec25[_0x6be2('0x37')]));if(_0x21ddc6[_0x6be2('0x35')][_0x6be2('0x3e')]){_0x27b0df[_0x6be2('0x3d')]=_[_0x6be2('0x41')](_0x27b0df[_0x6be2('0x3d')],{'$or':_[_0x6be2('0x2f')](_0x27b0df[_0x6be2('0x39')],function(_0x2a05ee){var _0x4787c7={};_0x4787c7[_0x2a05ee]={'$like':'%'+_0x21ddc6[_0x6be2('0x35')]['filter']+'%'};return _0x4787c7;})});}_0x27b0df=_[_0x6be2('0x41')]({},_0x27b0df,_0x21ddc6[_0x6be2('0x49')]);return _0x3e3f73[_0x6be2('0x52')](_0x27b0df);}})[_0x6be2('0x28')](function(_0x191749){if(_0x191749){_0x4b2f59=_0x191749[_0x6be2('0x48')];if(!_0x21ddc6[_0x6be2('0x35')][_0x6be2('0x3a')]('nolimit')){_0x27b0df[_0x6be2('0x22')]=qs[_0x6be2('0x22')](_0x21ddc6['query'][_0x6be2('0x22')]);_0x27b0df[_0x6be2('0x20')]=qs[_0x6be2('0x20')](_0x21ddc6[_0x6be2('0x35')][_0x6be2('0x20')]);}return _0x3e3f73[_0x6be2('0x52')](_0x27b0df);}})['then'](function(_0x396632){if(_0x396632){return _0x396632?{'count':_0x4b2f59,'rows':_0x396632}:null;}})['then'](respondWithResult(_0x164622,null))[_0x6be2('0x4c')](handleError(_0x164622,null));};exports[_0x6be2('0x53')]=function(_0x5e9a5f,_0x2f3180,_0x4e572e){return db[_0x6be2('0x54')][_0x6be2('0x4d')]({'where':{'id':_0x5e9a5f[_0x6be2('0x46')]['id']}})[_0x6be2('0x28')](handleEntityNotFound(_0x2f3180,null))[_0x6be2('0x28')](function(_0x14442f){if(_0x14442f){return _0x14442f['addActions'](_0x5e9a5f[_0x6be2('0x4b')][_0x6be2('0x50')],_[_0x6be2('0x55')](_0x5e9a5f[_0x6be2('0x4b')],[_0x6be2('0x50'),'id'])||{});}})['then'](respondWithResult(_0x2f3180,null))[_0x6be2('0x4c')](handleError(_0x2f3180,null));};exports[_0x6be2('0x56')]=function(_0x50caab,_0x388024,_0x5d1cb9){var _0x893a31={};var _0x39eded={};var _0x9f514e;var _0x2af0b3;return db[_0x6be2('0x30')][_0x6be2('0x57')]({'where':{'id':_0x50caab[_0x6be2('0x46')]['id']}})['then'](handleEntityNotFound(_0x388024,null))[_0x6be2('0x28')](function(_0x3f368e){if(_0x3f368e){_0x9f514e=_0x3f368e;_0x39eded['model']=_['keys'](db[_0x6be2('0x54')][_0x6be2('0x31')]);_0x39eded[_0x6be2('0x35')]=_[_0x6be2('0x36')](_0x50caab['query']);_0x39eded[_0x6be2('0x37')]=_[_0x6be2('0x38')](_0x39eded[_0x6be2('0x34')],_0x39eded[_0x6be2('0x35')]);_0x893a31[_0x6be2('0x39')]=_['intersection'](_0x39eded['model'],qs[_0x6be2('0x47')](_0x50caab['query'][_0x6be2('0x47')]));_0x893a31[_0x6be2('0x39')]=_0x893a31['attributes'][_0x6be2('0x48')]?_0x893a31[_0x6be2('0x39')]:_0x39eded[_0x6be2('0x34')];_0x893a31[_0x6be2('0x51')]=qs[_0x6be2('0x3c')](_0x50caab['query'][_0x6be2('0x3c')]);_0x893a31[_0x6be2('0x3d')]=qs[_0x6be2('0x37')](_[_0x6be2('0x58')](_0x50caab[_0x6be2('0x35')],_0x39eded[_0x6be2('0x37')]));if(_0x50caab['query'][_0x6be2('0x3e')]){_0x893a31['where']=_[_0x6be2('0x41')](_0x893a31[_0x6be2('0x3d')],{'$or':_[_0x6be2('0x2f')](_0x893a31['attributes'],function(_0x67ac24){var _0x25a55c={};_0x25a55c[_0x67ac24]={'$like':'%'+_0x50caab[_0x6be2('0x35')]['filter']+'%'};return _0x25a55c;})});}_0x893a31=_['merge']({},_0x893a31,_0x50caab[_0x6be2('0x49')]);return _0x9f514e[_0x6be2('0x56')](_0x893a31);}})['then'](function(_0xaedc){if(_0xaedc){_0x2af0b3=_0xaedc['length'];if(!_0x50caab[_0x6be2('0x35')]['hasOwnProperty'](_0x6be2('0x3b'))){_0x893a31[_0x6be2('0x22')]=qs[_0x6be2('0x22')](_0x50caab[_0x6be2('0x35')][_0x6be2('0x22')]);_0x893a31[_0x6be2('0x20')]=qs[_0x6be2('0x20')](_0x50caab[_0x6be2('0x35')][_0x6be2('0x20')]);}return _0x9f514e[_0x6be2('0x56')](_0x893a31);}})['then'](function(_0x1620f8){if(_0x1620f8){return _0x1620f8?{'count':_0x2af0b3,'rows':_0x1620f8}:null;}})[_0x6be2('0x28')](respondWithResult(_0x388024,null))[_0x6be2('0x4c')](handleError(_0x388024,null));}; \ No newline at end of file +var _0x8876=['addConditions','Condition','omit','ids','sort','getConditions','hasOwnProperty','Action','addActions','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','apply','then','destroy','end','error','stack','name','send','index','Automation','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','update','find'];(function(_0x3eee4d,_0x4a63dd){var _0x249144=function(_0x15051b){while(--_0x15051b){_0x3eee4d['push'](_0x3eee4d['shift']());}};_0x249144(++_0x4a63dd);}(_0x8876,0x196));var _0x6887=function(_0x22eff9,_0x4cf231){_0x22eff9=_0x22eff9-0x0;var _0x439892=_0x8876[_0x22eff9];return _0x439892;};'use strict';var emlformat=require(_0x6887('0x0'));var rimraf=require(_0x6887('0x1'));var zipdir=require(_0x6887('0x2'));var jsonpatch=require(_0x6887('0x3'));var rp=require(_0x6887('0x4'));var moment=require('moment');var BPromise=require(_0x6887('0x5'));var Mustache=require(_0x6887('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6887('0x7'));var csv=require(_0x6887('0x8'));var ejs=require(_0x6887('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6887('0xa'));var squel=require(_0x6887('0xb'));var crypto=require(_0x6887('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6887('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6887('0xe'));var Papa=require(_0x6887('0xf'));var Redis=require(_0x6887('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6887('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6887('0x12'));var utils=require('../../config/utils');var config=require(_0x6887('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6887('0x14'))['db'];function respondWithStatusCode(_0x2bb80c,_0xfde742){_0xfde742=_0xfde742||0xcc;return function(_0x36c283){if(_0x36c283){return _0x2bb80c[_0x6887('0x15')](_0xfde742);}return _0x2bb80c[_0x6887('0x16')](_0xfde742)['end']();};}function respondWithResult(_0x324dd4,_0x49b2c4){_0x49b2c4=_0x49b2c4||0xc8;return function(_0x4594cd){if(_0x4594cd){return _0x324dd4[_0x6887('0x16')](_0x49b2c4)['json'](_0x4594cd);}};}function respondWithFilteredResult(_0x117d6d,_0x551ce7){return function(_0x20f785){if(_0x20f785){var _0x4fbc26=typeof _0x551ce7['offset']===_0x6887('0x17')&&typeof _0x551ce7[_0x6887('0x18')]==='undefined';var _0x4ff47a=_0x20f785[_0x6887('0x19')];var _0x117762=_0x4fbc26?0x0:_0x551ce7[_0x6887('0x1a')];var _0x3fe277=_0x4fbc26?_0x20f785[_0x6887('0x19')]:_0x551ce7['offset']+_0x551ce7[_0x6887('0x18')];var _0x4b74ad;if(_0x3fe277>=_0x4ff47a){_0x3fe277=_0x4ff47a;_0x4b74ad=0xc8;}else{_0x4b74ad=0xce;}_0x117d6d['status'](_0x4b74ad);return _0x117d6d[_0x6887('0x1b')]('Content-Range',_0x117762+'-'+_0x3fe277+'/'+_0x4ff47a)['json'](_0x20f785);}return null;};}function patchUpdates(_0x152e3f){return function(_0x3cae93){try{jsonpatch[_0x6887('0x1c')](_0x3cae93,_0x152e3f,!![]);}catch(_0x3f44e7){return BPromise['reject'](_0x3f44e7);}return _0x3cae93['save']();};}function saveUpdates(_0x5d5670,_0x5bac45){return function(_0x36d7f5){if(_0x36d7f5){return _0x36d7f5['update'](_0x5d5670)[_0x6887('0x1d')](function(_0x87f04b){return _0x87f04b;});}return null;};}function removeEntity(_0x533f93,_0x415418){return function(_0x348dab){if(_0x348dab){return _0x348dab[_0x6887('0x1e')]()[_0x6887('0x1d')](function(){_0x533f93['status'](0xcc)[_0x6887('0x1f')]();});}};}function handleEntityNotFound(_0x4e56a7,_0x15126f){return function(_0x3712d5){if(!_0x3712d5){_0x4e56a7[_0x6887('0x15')](0x194);}return _0x3712d5;};}function handleError(_0x2ccb90,_0x491b11){_0x491b11=_0x491b11||0x1f4;return function(_0x2cd1eb){logger[_0x6887('0x20')](_0x2cd1eb[_0x6887('0x21')]);if(_0x2cd1eb[_0x6887('0x22')]){delete _0x2cd1eb[_0x6887('0x22')];}_0x2ccb90[_0x6887('0x16')](_0x491b11)[_0x6887('0x23')](_0x2cd1eb);};}exports[_0x6887('0x24')]=function(_0x60c1d3,_0x976032){var _0x55cbca={},_0x575399={},_0x3816f1={'count':0x0,'rows':[]};var _0x299b86=_['map'](db[_0x6887('0x25')]['rawAttributes'],function(_0x353d21){return{'name':_0x353d21[_0x6887('0x26')],'type':_0x353d21[_0x6887('0x27')]['key']};});_0x575399['model']=_[_0x6887('0x28')](_0x299b86,_0x6887('0x22'));_0x575399[_0x6887('0x29')]=_[_0x6887('0x2a')](_0x60c1d3['query']);_0x575399[_0x6887('0x2b')]=_[_0x6887('0x2c')](_0x575399[_0x6887('0x2d')],_0x575399['query']);_0x55cbca[_0x6887('0x2e')]=_[_0x6887('0x2c')](_0x575399[_0x6887('0x2d')],qs[_0x6887('0x2f')](_0x60c1d3[_0x6887('0x29')]['fields']));_0x55cbca[_0x6887('0x2e')]=_0x55cbca['attributes'][_0x6887('0x30')]?_0x55cbca[_0x6887('0x2e')]:_0x575399[_0x6887('0x2d')];if(!_0x60c1d3[_0x6887('0x29')]['hasOwnProperty'](_0x6887('0x31'))){_0x55cbca[_0x6887('0x18')]=qs['limit'](_0x60c1d3[_0x6887('0x29')][_0x6887('0x18')]);_0x55cbca[_0x6887('0x1a')]=qs[_0x6887('0x1a')](_0x60c1d3['query']['offset']);}_0x55cbca[_0x6887('0x32')]=qs['sort'](_0x60c1d3[_0x6887('0x29')]['sort']);_0x55cbca[_0x6887('0x33')]=qs[_0x6887('0x2b')](_[_0x6887('0x34')](_0x60c1d3[_0x6887('0x29')],_0x575399[_0x6887('0x2b')]),_0x299b86);if(_0x60c1d3['query'][_0x6887('0x35')]){_0x55cbca[_0x6887('0x33')]=_['merge'](_0x55cbca[_0x6887('0x33')],{'$or':_[_0x6887('0x28')](_0x299b86,function(_0x87f2b4){if(_0x87f2b4[_0x6887('0x27')]!==_0x6887('0x36')){var _0x5d4744={};_0x5d4744[_0x87f2b4[_0x6887('0x22')]]={'$like':'%'+_0x60c1d3[_0x6887('0x29')][_0x6887('0x35')]+'%'};return _0x5d4744;}})});}_0x55cbca=_[_0x6887('0x37')]({},_0x55cbca,_0x60c1d3[_0x6887('0x38')]);var _0xf04b31={'where':_0x55cbca[_0x6887('0x33')]};return db[_0x6887('0x25')][_0x6887('0x19')](_0xf04b31)['then'](function(_0x1d222c){_0x3816f1[_0x6887('0x19')]=_0x1d222c;if(_0x60c1d3[_0x6887('0x29')][_0x6887('0x39')]){_0x55cbca[_0x6887('0x3a')]=[{'all':!![]}];}return db[_0x6887('0x25')][_0x6887('0x3b')](_0x55cbca);})[_0x6887('0x1d')](function(_0x55e03d){_0x3816f1['rows']=_0x55e03d;return _0x3816f1;})[_0x6887('0x1d')](respondWithFilteredResult(_0x976032,_0x55cbca))[_0x6887('0x3c')](handleError(_0x976032,null));};exports[_0x6887('0x3d')]=function(_0xb7b1df,_0x37d16f){var _0x4bad0d={'raw':![],'where':{'id':_0xb7b1df[_0x6887('0x3e')]['id']}},_0x409b91={};_0x409b91[_0x6887('0x2d')]=_['keys'](db[_0x6887('0x25')][_0x6887('0x3f')]);_0x409b91['query']=_[_0x6887('0x2a')](_0xb7b1df[_0x6887('0x29')]);_0x409b91[_0x6887('0x2b')]=_[_0x6887('0x2c')](_0x409b91['model'],_0x409b91['query']);_0x4bad0d[_0x6887('0x2e')]=_[_0x6887('0x2c')](_0x409b91[_0x6887('0x2d')],qs[_0x6887('0x2f')](_0xb7b1df[_0x6887('0x29')][_0x6887('0x2f')]));_0x4bad0d[_0x6887('0x2e')]=_0x4bad0d['attributes'][_0x6887('0x30')]?_0x4bad0d[_0x6887('0x2e')]:_0x409b91[_0x6887('0x2d')];if(_0xb7b1df[_0x6887('0x29')][_0x6887('0x39')]){_0x4bad0d[_0x6887('0x3a')]=[{'all':!![]}];}_0x4bad0d=_[_0x6887('0x37')]({},_0x4bad0d,_0xb7b1df['options']);return db['Automation']['find'](_0x4bad0d)['then'](handleEntityNotFound(_0x37d16f,null))[_0x6887('0x1d')](respondWithResult(_0x37d16f,null))[_0x6887('0x3c')](handleError(_0x37d16f,null));};exports[_0x6887('0x40')]=function(_0x141c90,_0x3c3d73){return db[_0x6887('0x25')][_0x6887('0x40')](_0x141c90[_0x6887('0x41')],{})['then'](respondWithResult(_0x3c3d73,0xc9))['catch'](handleError(_0x3c3d73,null));};exports[_0x6887('0x42')]=function(_0x482b97,_0xa511ba){if(_0x482b97[_0x6887('0x41')]['id']){delete _0x482b97[_0x6887('0x41')]['id'];}return db[_0x6887('0x25')][_0x6887('0x43')]({'where':{'id':_0x482b97[_0x6887('0x3e')]['id']}})['then'](handleEntityNotFound(_0xa511ba,null))['then'](saveUpdates(_0x482b97['body'],null))[_0x6887('0x1d')](respondWithResult(_0xa511ba,null))[_0x6887('0x3c')](handleError(_0xa511ba,null));};exports['destroy']=function(_0x228a98,_0x396a70){return db['Automation'][_0x6887('0x43')]({'where':{'id':_0x228a98[_0x6887('0x3e')]['id']}})['then'](handleEntityNotFound(_0x396a70,null))[_0x6887('0x1d')](removeEntity(_0x396a70,null))[_0x6887('0x3c')](handleError(_0x396a70,null));};exports[_0x6887('0x44')]=function(_0x98763c,_0x159daf,_0x276938){return db[_0x6887('0x45')]['find']({'where':{'id':_0x98763c[_0x6887('0x3e')]['id']}})[_0x6887('0x1d')](handleEntityNotFound(_0x159daf,null))[_0x6887('0x1d')](function(_0x3708f8){if(_0x3708f8){return _0x3708f8[_0x6887('0x44')](_0x98763c['body']['ids'],_[_0x6887('0x46')](_0x98763c[_0x6887('0x41')],[_0x6887('0x47'),'id'])||{});}})[_0x6887('0x1d')](respondWithResult(_0x159daf,null))[_0x6887('0x3c')](handleError(_0x159daf,null));};exports['getConditions']=function(_0x3fac47,_0x2f9894,_0x57c5fc){var _0x4c67bc={};var _0x5bb4d4={};var _0x56003a;var _0x2dc370;return db[_0x6887('0x25')]['findOne']({'where':{'id':_0x3fac47[_0x6887('0x3e')]['id']}})[_0x6887('0x1d')](handleEntityNotFound(_0x2f9894,null))[_0x6887('0x1d')](function(_0x201224){if(_0x201224){_0x56003a=_0x201224;_0x5bb4d4['model']=_['keys'](db[_0x6887('0x45')]['rawAttributes']);_0x5bb4d4[_0x6887('0x29')]=_['keys'](_0x3fac47[_0x6887('0x29')]);_0x5bb4d4[_0x6887('0x2b')]=_['intersection'](_0x5bb4d4['model'],_0x5bb4d4['query']);_0x4c67bc['attributes']=_['intersection'](_0x5bb4d4[_0x6887('0x2d')],qs[_0x6887('0x2f')](_0x3fac47['query'][_0x6887('0x2f')]));_0x4c67bc['attributes']=_0x4c67bc[_0x6887('0x2e')][_0x6887('0x30')]?_0x4c67bc[_0x6887('0x2e')]:_0x5bb4d4[_0x6887('0x2d')];_0x4c67bc[_0x6887('0x32')]=qs[_0x6887('0x48')](_0x3fac47[_0x6887('0x29')]['sort']);_0x4c67bc[_0x6887('0x33')]=qs[_0x6887('0x2b')](_[_0x6887('0x34')](_0x3fac47[_0x6887('0x29')],_0x5bb4d4[_0x6887('0x2b')]));if(_0x3fac47[_0x6887('0x29')][_0x6887('0x35')]){_0x4c67bc['where']=_['merge'](_0x4c67bc[_0x6887('0x33')],{'$or':_['map'](_0x4c67bc[_0x6887('0x2e')],function(_0x468560){var _0x1c4f21={};_0x1c4f21[_0x468560]={'$like':'%'+_0x3fac47['query'][_0x6887('0x35')]+'%'};return _0x1c4f21;})});}_0x4c67bc=_[_0x6887('0x37')]({},_0x4c67bc,_0x3fac47[_0x6887('0x38')]);return _0x56003a[_0x6887('0x49')](_0x4c67bc);}})[_0x6887('0x1d')](function(_0x230ed1){if(_0x230ed1){_0x2dc370=_0x230ed1[_0x6887('0x30')];if(!_0x3fac47[_0x6887('0x29')][_0x6887('0x4a')](_0x6887('0x31'))){_0x4c67bc[_0x6887('0x18')]=qs[_0x6887('0x18')](_0x3fac47[_0x6887('0x29')]['limit']);_0x4c67bc['offset']=qs[_0x6887('0x1a')](_0x3fac47[_0x6887('0x29')][_0x6887('0x1a')]);}return _0x56003a[_0x6887('0x49')](_0x4c67bc);}})[_0x6887('0x1d')](function(_0x297b0d){if(_0x297b0d){return _0x297b0d?{'count':_0x2dc370,'rows':_0x297b0d}:null;}})[_0x6887('0x1d')](respondWithResult(_0x2f9894,null))[_0x6887('0x3c')](handleError(_0x2f9894,null));};exports['addActions']=function(_0x28912a,_0x1cc5aa,_0x2279c8){return db[_0x6887('0x4b')][_0x6887('0x43')]({'where':{'id':_0x28912a[_0x6887('0x3e')]['id']}})[_0x6887('0x1d')](handleEntityNotFound(_0x1cc5aa,null))[_0x6887('0x1d')](function(_0x2251d8){if(_0x2251d8){return _0x2251d8[_0x6887('0x4c')](_0x28912a[_0x6887('0x41')][_0x6887('0x47')],_['omit'](_0x28912a[_0x6887('0x41')],[_0x6887('0x47'),'id'])||{});}})[_0x6887('0x1d')](respondWithResult(_0x1cc5aa,null))[_0x6887('0x3c')](handleError(_0x1cc5aa,null));};exports[_0x6887('0x4d')]=function(_0x1111ac,_0x43babe,_0x5eab19){var _0x441106={};var _0x1378ef={};var _0x238f79;var _0x3f9ea1;return db[_0x6887('0x25')][_0x6887('0x4e')]({'where':{'id':_0x1111ac[_0x6887('0x3e')]['id']}})[_0x6887('0x1d')](handleEntityNotFound(_0x43babe,null))[_0x6887('0x1d')](function(_0xf2ace){if(_0xf2ace){_0x238f79=_0xf2ace;_0x1378ef[_0x6887('0x2d')]=_[_0x6887('0x2a')](db['Action'][_0x6887('0x3f')]);_0x1378ef[_0x6887('0x29')]=_[_0x6887('0x2a')](_0x1111ac[_0x6887('0x29')]);_0x1378ef['filters']=_['intersection'](_0x1378ef[_0x6887('0x2d')],_0x1378ef[_0x6887('0x29')]);_0x441106['attributes']=_['intersection'](_0x1378ef['model'],qs[_0x6887('0x2f')](_0x1111ac[_0x6887('0x29')][_0x6887('0x2f')]));_0x441106[_0x6887('0x2e')]=_0x441106[_0x6887('0x2e')][_0x6887('0x30')]?_0x441106[_0x6887('0x2e')]:_0x1378ef[_0x6887('0x2d')];_0x441106[_0x6887('0x32')]=qs[_0x6887('0x48')](_0x1111ac[_0x6887('0x29')][_0x6887('0x48')]);_0x441106[_0x6887('0x33')]=qs['filters'](_[_0x6887('0x34')](_0x1111ac[_0x6887('0x29')],_0x1378ef[_0x6887('0x2b')]));if(_0x1111ac[_0x6887('0x29')][_0x6887('0x35')]){_0x441106[_0x6887('0x33')]=_[_0x6887('0x37')](_0x441106[_0x6887('0x33')],{'$or':_[_0x6887('0x28')](_0x441106['attributes'],function(_0x50a69f){var _0x2692e9={};_0x2692e9[_0x50a69f]={'$like':'%'+_0x1111ac[_0x6887('0x29')][_0x6887('0x35')]+'%'};return _0x2692e9;})});}_0x441106=_[_0x6887('0x37')]({},_0x441106,_0x1111ac[_0x6887('0x38')]);return _0x238f79[_0x6887('0x4d')](_0x441106);}})[_0x6887('0x1d')](function(_0x56c6a3){if(_0x56c6a3){_0x3f9ea1=_0x56c6a3['length'];if(!_0x1111ac[_0x6887('0x29')][_0x6887('0x4a')](_0x6887('0x31'))){_0x441106[_0x6887('0x18')]=qs[_0x6887('0x18')](_0x1111ac[_0x6887('0x29')][_0x6887('0x18')]);_0x441106[_0x6887('0x1a')]=qs[_0x6887('0x1a')](_0x1111ac['query'][_0x6887('0x1a')]);}return _0x238f79[_0x6887('0x4d')](_0x441106);}})['then'](function(_0x5247c0){if(_0x5247c0){return _0x5247c0?{'count':_0x3f9ea1,'rows':_0x5247c0}:null;}})[_0x6887('0x1d')](respondWithResult(_0x43babe,null))[_0x6887('0x3c')](handleError(_0x43babe,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 9934e4b..b4714ae 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 _0xd8fb=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xd8fb,0x79));var _0xbd8f=function(_0x42d98d,_0x147db9){_0x42d98d=_0x42d98d-0x0;var _0x295ce9=_0xd8fb[_0x42d98d];return _0x295ce9;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require('../../config/logger')(_0xbd8f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd8f('0x3'));var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require(_0xbd8f('0x6'));var attributes=require(_0xbd8f('0x7'));module[_0xbd8f('0x8')]=function(_0x2a0d0e,_0x5a8676){return _0x2a0d0e['define'](_0xbd8f('0x9'),attributes,{'tableName':_0xbd8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8d0=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x482c55,_0x1fb933){var _0x1c6691=function(_0x14be4c){while(--_0x14be4c){_0x482c55['push'](_0x482c55['shift']());}};_0x1c6691(++_0x1fb933);}(_0xf8d0,0x199));var _0x0f8d=function(_0x192f1b,_0x537544){_0x192f1b=_0x192f1b-0x0;var _0x568a41=_0xf8d0[_0x192f1b];return _0x568a41;};'use strict';var _=require(_0x0f8d('0x0'));var util=require(_0x0f8d('0x1'));var logger=require('../../config/logger')(_0x0f8d('0x2'));var moment=require(_0x0f8d('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f8d('0x4'));var fs=require('fs');var path=require(_0x0f8d('0x5'));var rimraf=require(_0x0f8d('0x6'));var config=require(_0x0f8d('0x7'));var attributes=require(_0x0f8d('0x8'));module[_0x0f8d('0x9')]=function(_0x3bcad3,_0x1a26b7){return _0x3bcad3[_0x0f8d('0xa')](_0x0f8d('0xb'),attributes,{'tableName':_0x0f8d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index d84693f..dd782b3 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 _0x8733=['code','Automation,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','error'];(function(_0x40b909,_0x11f814){var _0x5e220f=function(_0x3d87e8){while(--_0x3d87e8){_0x40b909['push'](_0x40b909['shift']());}};_0x5e220f(++_0x11f814);}(_0x8733,0xd7));var _0x3873=function(_0x5e7692,_0x1caa40){_0x5e7692=_0x5e7692-0x0;var _0x120367=_0x8733[_0x5e7692];return _0x120367;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3873('0x0'));var BPromise=require(_0x3873('0x1'));var rs=require(_0x3873('0x2'));var fs=require('fs');var Redis=require(_0x3873('0x3'));var db=require(_0x3873('0x4'))['db'];var utils=require(_0x3873('0x5'));var logger=require(_0x3873('0x6'))(_0x3873('0x7'));var config=require('../../config/environment');var jayson=require(_0x3873('0x8'));var client=jayson[_0x3873('0x9')][_0x3873('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c37e1,_0x2b303a,_0x2fa708){return new BPromise(function(_0x37af67,_0x3fba92){return client[_0x3873('0xb')](_0x4c37e1,_0x2fa708)[_0x3873('0xc')](function(_0x3b9423){logger[_0x3873('0xd')]('Automation,\x20%s,\x20%s',_0x2b303a,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x2b303a,_0x3873('0xe'),JSON['stringify'](_0x3b9423));if(_0x3b9423[_0x3873('0xf')]){if(_0x3b9423['error'][_0x3873('0x10')]===0x1f4){logger[_0x3873('0xf')](_0x3873('0x11'),_0x2b303a,_0x3b9423['error'][_0x3873('0x12')]);return _0x3fba92(_0x3b9423[_0x3873('0xf')]['message']);}logger[_0x3873('0xf')]('Automation,\x20%s,\x20%s',_0x2b303a,_0x3b9423['error']['message']);return _0x37af67(_0x3b9423[_0x3873('0xf')]['message']);}else{logger[_0x3873('0xd')]('Automation,\x20%s,\x20%s',_0x2b303a,_0x3873('0xe'));_0x37af67(_0x3b9423[_0x3873('0x13')][_0x3873('0x12')]);}})[_0x3873('0x14')](function(_0x58c5d6){logger[_0x3873('0xf')]('Automation,\x20%s,\x20%s',_0x2b303a,_0x58c5d6);_0x3fba92(_0x58c5d6);});});} \ No newline at end of file +var _0xb1f7=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0xb1f7,0xba));var _0x7b1f=function(_0x4b25bd,_0x581088){_0x4b25bd=_0x4b25bd-0x0;var _0x29a4d9=_0xb1f7[_0x4b25bd];return _0x29a4d9;};'use strict';var _=require('lodash');var util=require(_0x7b1f('0x0'));var moment=require(_0x7b1f('0x1'));var BPromise=require(_0x7b1f('0x2'));var rs=require(_0x7b1f('0x3'));var fs=require('fs');var Redis=require(_0x7b1f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b1f('0x5'));var logger=require(_0x7b1f('0x6'))(_0x7b1f('0x7'));var config=require(_0x7b1f('0x8'));var jayson=require(_0x7b1f('0x9'));var client=jayson[_0x7b1f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3f94,_0x2bfa33,_0x30dd32){return new BPromise(function(_0x3904f4,_0x17c587){return client[_0x7b1f('0xb')](_0x4c3f94,_0x30dd32)['then'](function(_0x3278b2){logger[_0x7b1f('0xc')](_0x7b1f('0xd'),_0x2bfa33,_0x7b1f('0xe'));logger[_0x7b1f('0xf')](_0x7b1f('0x10'),_0x2bfa33,_0x7b1f('0xe'),JSON[_0x7b1f('0x11')](_0x3278b2));if(_0x3278b2[_0x7b1f('0x12')]){if(_0x3278b2['error'][_0x7b1f('0x13')]===0x1f4){logger[_0x7b1f('0x12')](_0x7b1f('0xd'),_0x2bfa33,_0x3278b2[_0x7b1f('0x12')]['message']);return _0x17c587(_0x3278b2['error'][_0x7b1f('0x14')]);}logger['error'](_0x7b1f('0xd'),_0x2bfa33,_0x3278b2['error'][_0x7b1f('0x14')]);return _0x3904f4(_0x3278b2[_0x7b1f('0x12')][_0x7b1f('0x14')]);}else{logger['info'](_0x7b1f('0xd'),_0x2bfa33,'request\x20sent');_0x3904f4(_0x3278b2[_0x7b1f('0x15')][_0x7b1f('0x14')]);}})[_0x7b1f('0x16')](function(_0x176bc8){logger[_0x7b1f('0x12')]('Automation,\x20%s,\x20%s',_0x2bfa33,_0x176bc8);_0x17c587(_0x176bc8);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0855455..b0ab233 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 _0x84ec=['/:id/actions','getActions','post','create','addConditions','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions'];(function(_0x36cd80,_0x41e617){var _0x3ac5a1=function(_0x2c06b2){while(--_0x2c06b2){_0x36cd80['push'](_0x36cd80['shift']());}};_0x3ac5a1(++_0x41e617);}(_0x84ec,0xe4));var _0xc84e=function(_0x8199b8,_0x124bbe){_0x8199b8=_0x8199b8-0x0;var _0x2a3185=_0x84ec[_0x8199b8];return _0x2a3185;};'use strict';var multer=require(_0xc84e('0x0'));var util=require(_0xc84e('0x1'));var path=require(_0xc84e('0x2'));var timeout=require(_0xc84e('0x3'));var express=require('express');var router=express[_0xc84e('0x4')]();var fs_extra=require(_0xc84e('0x5'));var auth=require(_0xc84e('0x6'));var interaction=require(_0xc84e('0x7'));var config=require('../../config/environment');var controller=require(_0xc84e('0x8'));router[_0xc84e('0x9')]('/',auth[_0xc84e('0xa')](),controller['index']);router[_0xc84e('0x9')](_0xc84e('0xb'),auth[_0xc84e('0xa')](),controller[_0xc84e('0xc')]);router[_0xc84e('0x9')](_0xc84e('0xd'),auth['isAuthenticated'](),controller['getConditions']);router['get'](_0xc84e('0xe'),auth[_0xc84e('0xa')](),controller[_0xc84e('0xf')]);router[_0xc84e('0x10')]('/',auth['isAuthenticated'](),controller[_0xc84e('0x11')]);router[_0xc84e('0x10')](_0xc84e('0xd'),auth['isAuthenticated'](),controller[_0xc84e('0x12')]);router[_0xc84e('0x10')](_0xc84e('0xe'),auth[_0xc84e('0xa')](),controller['addActions']);router[_0xc84e('0x13')](_0xc84e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc84e('0x14')](_0xc84e('0xb'),auth[_0xc84e('0xa')](),controller[_0xc84e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8073=['../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','show','/:id/conditions','isAuthenticated','getConditions','/:id/actions','getActions','post','create','addActions','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x12e306,_0x2f0806){var _0x4c8b1e=function(_0x8765fd){while(--_0x8765fd){_0x12e306['push'](_0x12e306['shift']());}};_0x4c8b1e(++_0x2f0806);}(_0x8073,0x7c));var _0x3807=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8073[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require(_0x3807('0x0'));var path=require(_0x3807('0x1'));var timeout=require(_0x3807('0x2'));var express=require(_0x3807('0x3'));var router=express['Router']();var fs_extra=require(_0x3807('0x4'));var auth=require(_0x3807('0x5'));var interaction=require(_0x3807('0x6'));var config=require(_0x3807('0x7'));var controller=require(_0x3807('0x8'));router[_0x3807('0x9')]('/',auth['isAuthenticated'](),controller[_0x3807('0xa')]);router[_0x3807('0x9')](_0x3807('0xb'),auth['isAuthenticated'](),controller[_0x3807('0xc')]);router[_0x3807('0x9')](_0x3807('0xd'),auth[_0x3807('0xe')](),controller[_0x3807('0xf')]);router['get'](_0x3807('0x10'),auth[_0x3807('0xe')](),controller[_0x3807('0x11')]);router[_0x3807('0x12')]('/',auth[_0x3807('0xe')](),controller[_0x3807('0x13')]);router[_0x3807('0x12')](_0x3807('0xd'),auth[_0x3807('0xe')](),controller['addConditions']);router[_0x3807('0x12')](_0x3807('0x10'),auth[_0x3807('0xe')](),controller[_0x3807('0x14')]);router[_0x3807('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x3807('0x16')]);router[_0x3807('0x17')](_0x3807('0xb'),auth[_0x3807('0xe')](),controller[_0x3807('0x18')]);module[_0x3807('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 223dde9..c9d4556 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 _0x517c=['never','onlyIfOpen','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','#Congestion\x20Retry\x20(min:1,\x20max:999)','#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'];(function(_0x7eecb4,_0x38dbc7){var _0x10bddf=function(_0x539133){while(--_0x539133){_0x7eecb4['push'](_0x7eecb4['shift']());}};_0x10bddf(++_0x38dbc7);}(_0x517c,0x187));var _0xc517=function(_0x313903,_0x338dc6){_0x313903=_0x313903-0x0;var _0x4c6d4b=_0x517c[_0x313903];return _0x4c6d4b;};'use strict';var Sequelize=require(_0xc517('0x0'));module[_0xc517('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc517('0x2')]('ivr'),'allowNull':![],'defaultValue':_0xc517('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc517('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xc517('0x5')](0x4)[_0xc517('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc517('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc517('0x8')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xc517('0x5')](0x3)[_0xc517('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xc517('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc517('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc517('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc517('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc517('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc517('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc517('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc517('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc517('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc517('0x5')](0x5)[_0xc517('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc517('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc517('0x5')](0x3)[_0xc517('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc517('0xe')},'dialTimezone':{'type':Sequelize[_0xc517('0x8')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc517('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xc517('0x2')](_0xc517('0x10'),_0xc517('0x11'),_0xc517('0x12')),'defaultValue':_0xc517('0x10')},'dialAMDActive':{'type':Sequelize[_0xc517('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc517('0x5')](0x9)[_0xc517('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc517('0x5')](0x9)[_0xc517('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc517('0x5')](0x9)[_0xc517('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc517('0x5')](0x9)[_0xc517('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc517('0x5')](0x9)[_0xc517('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc517('0x5')](0x9)[_0xc517('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc517('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc517('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc517('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc517('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc517('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc517('0x5')](0x9)[_0xc517('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc517('0x2')](_0xc517('0x16'),_0xc517('0x17')),'defaultValue':_0xc517('0x16')},'dialPrefix':{'type':Sequelize[_0xc517('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc517('0x5')](0x3)[_0xc517('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc517('0x18')},'dialCutDigit':{'type':Sequelize[_0xc517('0x5')](0x3)[_0xc517('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc517('0x5')](0x3)[_0xc517('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc517('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc517('0x5')](0x5)[_0xc517('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc517('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0xc517('0x5')](0x3)[_0xc517('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc517('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0xc517('0x5')](0x5)[_0xc517('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc517('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc517('0x5')](0x3)[_0xc517('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc517('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc517('0x5')](0x5)[_0xc517('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc517('0x1e')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc517('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc517('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc517('0x5')](0x5)[_0xc517('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc517('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc517('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc517('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc517('0x5')](0x5)[_0xc517('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x0721=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3c5d8c,_0x1c7b6c){var _0x5e382a=function(_0x54b058){while(--_0x54b058){_0x3c5d8c['push'](_0x3c5d8c['shift']());}};_0x5e382a(++_0x1c7b6c);}(_0x0721,0x9d));var _0x1072=function(_0x42b8f5,_0x4b9730){_0x42b8f5=_0x42b8f5-0x0;var _0x31ca50=_0x0721[_0x42b8f5];return _0x31ca50;};'use strict';var Sequelize=require('sequelize');module[_0x1072('0x0')]={'name':{'type':Sequelize[_0x1072('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1072('0x2')](_0x1072('0x3')),'allowNull':![],'defaultValue':_0x1072('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1072('0x4')],'defaultValue':0x0,'comment':_0x1072('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x1072('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1072('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1072('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1072('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1072('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1072('0x8')](0x3)[_0x1072('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1072('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1072('0x8')](0x5)[_0x1072('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1072('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x1072('0x8')](0x3)[_0x1072('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1072('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1072('0x8')](0x5)[_0x1072('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1072('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1072('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1072('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1072('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1072('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1072('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1072('0xf')},'dialTimezone':{'type':Sequelize[_0x1072('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1072('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1072('0x2')]('always',_0x1072('0x10'),_0x1072('0x11')),'defaultValue':_0x1072('0x12')},'dialAMDActive':{'type':Sequelize[_0x1072('0x4')],'defaultValue':0x0,'comment':_0x1072('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x1072('0x8')](0x9)[_0x1072('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1072('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1072('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1072('0x8')](0x9)[_0x1072('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1072('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1072('0x8')](0x9)[_0x1072('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1072('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x1072('0x8')](0x9)[_0x1072('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1072('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1072('0x8')](0x9)[_0x1072('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1072('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1072('0x8')](0x5)[_0x1072('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1072('0x8')](0x9)[_0x1072('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1072('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1072('0x2')](_0x1072('0x1a'),_0x1072('0x1b')),'defaultValue':_0x1072('0x1a')},'dialPrefix':{'type':Sequelize[_0x1072('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1072('0x8')](0x3)[_0x1072('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1072('0x1c')},'dialCutDigit':{'type':Sequelize[_0x1072('0x8')](0x3)[_0x1072('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1072('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1072('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1072('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1072('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1072('0x8')](0x3)[_0x1072('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1072('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x1072('0x8')](0x5)[_0x1072('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1072('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1072('0x8')](0x3)[_0x1072('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1072('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1072('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1072('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x1072('0x8')](0x3)[_0x1072('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1072('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1072('0x8')](0x5)[_0x1072('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1072('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1072('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1072('0x8')](0x5)[_0x1072('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1072('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4de41c4..10118e2 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 _0xdca3=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','order','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','NOW()','field','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','cm_contacts','COALESCE(phone,\x27\x27)','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','fieldName','key','model','query'];(function(_0x4987ca,_0x521560){var _0x18dca4=function(_0x9a579f){while(--_0x9a579f){_0x4987ca['push'](_0x4987ca['shift']());}};_0x18dca4(++_0x521560);}(_0xdca3,0x64));var _0x3dca=function(_0x2a69c3,_0x2ac376){_0x2a69c3=_0x2a69c3-0x0;var _0x5eb837=_0xdca3[_0x2a69c3];return _0x5eb837;};'use strict';var emlformat=require(_0x3dca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dca('0x1'));var jsonpatch=require(_0x3dca('0x2'));var rp=require(_0x3dca('0x3'));var moment=require(_0x3dca('0x4'));var BPromise=require(_0x3dca('0x5'));var Mustache=require(_0x3dca('0x6'));var util=require(_0x3dca('0x7'));var path=require(_0x3dca('0x8'));var sox=require(_0x3dca('0x9'));var csv=require(_0x3dca('0xa'));var ejs=require(_0x3dca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3dca('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3dca('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3dca('0xa'));var querystring=require(_0x3dca('0xe'));var Papa=require(_0x3dca('0xf'));var Redis=require(_0x3dca('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3dca('0x11'));var as=require(_0x3dca('0x12'));var hardwareService=require(_0x3dca('0x13'));var logger=require(_0x3dca('0x14'))(_0x3dca('0x15'));var utils=require(_0x3dca('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3dca('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bfeda,_0x24c6c9){_0x24c6c9=_0x24c6c9||0xcc;return function(_0x11f54e){if(_0x11f54e){return _0x5bfeda[_0x3dca('0x18')](_0x24c6c9);}return _0x5bfeda[_0x3dca('0x19')](_0x24c6c9)[_0x3dca('0x1a')]();};}function respondWithResult(_0x344892,_0xa4149a){_0xa4149a=_0xa4149a||0xc8;return function(_0xf1350d){if(_0xf1350d){return _0x344892[_0x3dca('0x19')](_0xa4149a)[_0x3dca('0x1b')](_0xf1350d);}};}function respondWithFilteredResult(_0x3d1154,_0x911042){return function(_0x1b5906){if(_0x1b5906){var _0x5dc428=typeof _0x911042['offset']===_0x3dca('0x1c')&&typeof _0x911042[_0x3dca('0x1d')]===_0x3dca('0x1c');var _0x1a4ee=_0x1b5906[_0x3dca('0x1e')];var _0x8c046c=_0x5dc428?0x0:_0x911042['offset'];var _0x3a16b4=_0x5dc428?_0x1b5906[_0x3dca('0x1e')]:_0x911042[_0x3dca('0x1f')]+_0x911042[_0x3dca('0x1d')];var _0x4a3cd1;if(_0x3a16b4>=_0x1a4ee){_0x3a16b4=_0x1a4ee;_0x4a3cd1=0xc8;}else{_0x4a3cd1=0xce;}_0x3d1154[_0x3dca('0x19')](_0x4a3cd1);return _0x3d1154[_0x3dca('0x20')](_0x3dca('0x21'),_0x8c046c+'-'+_0x3a16b4+'/'+_0x1a4ee)['json'](_0x1b5906);}return null;};}function patchUpdates(_0x501201){return function(_0x4399ba){try{jsonpatch['apply'](_0x4399ba,_0x501201,!![]);}catch(_0x5f1ad3){return BPromise[_0x3dca('0x22')](_0x5f1ad3);}return _0x4399ba['save']();};}function saveUpdates(_0x4316b7,_0x592459){return function(_0x5b0dee){if(_0x5b0dee){return _0x5b0dee[_0x3dca('0x23')](_0x4316b7)[_0x3dca('0x24')](function(_0x439b6a){return _0x439b6a;});}return null;};}function removeEntity(_0x25f8e7,_0x59be49){return function(_0x18a452){if(_0x18a452){return _0x18a452[_0x3dca('0x25')]()[_0x3dca('0x24')](function(){var _0x4ab095=_0x18a452[_0x3dca('0x26')]({'plain':!![]});var _0x3148ce='IvrCampaigns';return db[_0x3dca('0x27')][_0x3dca('0x25')]({'where':{'type':_0x3148ce,'resourceId':_0x4ab095['id']}})[_0x3dca('0x24')](function(){return _0x18a452;});})[_0x3dca('0x24')](function(){_0x25f8e7[_0x3dca('0x19')](0xcc)[_0x3dca('0x1a')]();});}};}function handleEntityNotFound(_0x212be2,_0x218a56){return function(_0x21973a){if(!_0x21973a){_0x212be2[_0x3dca('0x18')](0x194);}return _0x21973a;};}function handleError(_0x1e277f,_0x225a40){_0x225a40=_0x225a40||0x1f4;return function(_0xa14500){logger[_0x3dca('0x28')](_0xa14500[_0x3dca('0x29')]);if(_0xa14500[_0x3dca('0x2a')]){delete _0xa14500[_0x3dca('0x2a')];}_0x1e277f[_0x3dca('0x19')](_0x225a40)[_0x3dca('0x2b')](_0xa14500);};}exports['index']=function(_0x2cddce,_0x3f064a){var _0x424c41={},_0x2b07c4={},_0x420367={'count':0x0,'rows':[]};var _0x45f346=_[_0x3dca('0x2c')](db['Campaign']['rawAttributes'],function(_0x59b102){return{'name':_0x59b102[_0x3dca('0x2d')],'type':_0x59b102['type'][_0x3dca('0x2e')]};});_0x2b07c4[_0x3dca('0x2f')]=_[_0x3dca('0x2c')](_0x45f346,_0x3dca('0x2a'));_0x2b07c4[_0x3dca('0x30')]=_[_0x3dca('0x31')](_0x2cddce[_0x3dca('0x30')]);_0x2b07c4[_0x3dca('0x32')]=_[_0x3dca('0x33')](_0x2b07c4[_0x3dca('0x2f')],_0x2b07c4[_0x3dca('0x30')]);_0x424c41['attributes']=_[_0x3dca('0x33')](_0x2b07c4[_0x3dca('0x2f')],qs[_0x3dca('0x34')](_0x2cddce[_0x3dca('0x30')]['fields']));_0x424c41[_0x3dca('0x35')]=_0x424c41['attributes'][_0x3dca('0x36')]?_0x424c41[_0x3dca('0x35')]:_0x2b07c4[_0x3dca('0x2f')];if(!_0x2cddce[_0x3dca('0x30')][_0x3dca('0x37')](_0x3dca('0x38'))){_0x424c41[_0x3dca('0x1d')]=qs['limit'](_0x2cddce[_0x3dca('0x30')][_0x3dca('0x1d')]);_0x424c41[_0x3dca('0x1f')]=qs[_0x3dca('0x1f')](_0x2cddce[_0x3dca('0x30')][_0x3dca('0x1f')]);}_0x424c41['order']=qs[_0x3dca('0x39')](_0x2cddce[_0x3dca('0x30')][_0x3dca('0x39')]);_0x424c41[_0x3dca('0x3a')]=qs[_0x3dca('0x32')](_[_0x3dca('0x3b')](_0x2cddce['query'],_0x2b07c4[_0x3dca('0x32')]),_0x45f346);if(_0x2cddce[_0x3dca('0x30')][_0x3dca('0x3c')]){_0x424c41[_0x3dca('0x3a')]=_[_0x3dca('0x3d')](_0x424c41[_0x3dca('0x3a')],{'$or':_[_0x3dca('0x2c')](_0x45f346,function(_0xa20ef4){if(_0xa20ef4[_0x3dca('0x3e')]!==_0x3dca('0x3f')){var _0x232b77={};_0x232b77[_0xa20ef4[_0x3dca('0x2a')]]={'$like':'%'+_0x2cddce[_0x3dca('0x30')][_0x3dca('0x3c')]+'%'};return _0x232b77;}})});}_0x424c41=_[_0x3dca('0x3d')]({},_0x424c41,_0x2cddce[_0x3dca('0x40')]);var _0x27e241={'where':_0x424c41['where']};return db[_0x3dca('0x41')][_0x3dca('0x1e')](_0x27e241)['then'](function(_0x184588){_0x420367[_0x3dca('0x1e')]=_0x184588;if(_0x2cddce[_0x3dca('0x30')][_0x3dca('0x42')]){_0x424c41[_0x3dca('0x43')]=[{'all':!![]}];}return db[_0x3dca('0x41')][_0x3dca('0x44')](_0x424c41);})[_0x3dca('0x24')](function(_0x299567){_0x420367[_0x3dca('0x45')]=_0x299567;return _0x420367;})['then'](respondWithFilteredResult(_0x3f064a,_0x424c41))[_0x3dca('0x46')](handleError(_0x3f064a,null));};exports[_0x3dca('0x47')]=function(_0x3d9c9c,_0x4060ab){var _0x1f9012={'raw':![],'where':{'id':_0x3d9c9c[_0x3dca('0x48')]['id']}},_0x57b2e7={};_0x57b2e7['model']=_['keys'](db['Campaign']['rawAttributes']);_0x57b2e7[_0x3dca('0x30')]=_[_0x3dca('0x31')](_0x3d9c9c[_0x3dca('0x30')]);_0x57b2e7[_0x3dca('0x32')]=_['intersection'](_0x57b2e7[_0x3dca('0x2f')],_0x57b2e7[_0x3dca('0x30')]);_0x1f9012[_0x3dca('0x35')]=_[_0x3dca('0x33')](_0x57b2e7['model'],qs[_0x3dca('0x34')](_0x3d9c9c[_0x3dca('0x30')][_0x3dca('0x34')]));_0x1f9012['attributes']=_0x1f9012[_0x3dca('0x35')][_0x3dca('0x36')]?_0x1f9012[_0x3dca('0x35')]:_0x57b2e7[_0x3dca('0x2f')];if(_0x3d9c9c[_0x3dca('0x30')][_0x3dca('0x42')]){_0x1f9012[_0x3dca('0x43')]=[{'all':!![]}];}_0x1f9012=_['merge']({},_0x1f9012,_0x3d9c9c['options']);return db['Campaign']['find'](_0x1f9012)[_0x3dca('0x24')](handleEntityNotFound(_0x4060ab,null))[_0x3dca('0x24')](respondWithResult(_0x4060ab,null))[_0x3dca('0x46')](handleError(_0x4060ab,null));};exports[_0x3dca('0x49')]=function(_0x1ea5ac,_0x5af8cd){return db[_0x3dca('0x41')][_0x3dca('0x49')](_0x1ea5ac[_0x3dca('0x4a')],{})[_0x3dca('0x24')](function(_0x4252b6){var _0x3fe52f=_0x1ea5ac[_0x3dca('0x4b')][_0x3dca('0x26')]({'plain':!![]});if(!_0x3fe52f)throw new Error(_0x3dca('0x4c'));if(_0x3fe52f[_0x3dca('0x4d')]==='user'){var _0x212544=_0x4252b6[_0x3dca('0x26')]({'plain':!![]});var _0x1c1ef9=_0x3dca('0x4e');return db[_0x3dca('0x4f')][_0x3dca('0x50')]({'where':{'name':_0x1c1ef9,'userProfileId':_0x3fe52f[_0x3dca('0x51')]},'raw':!![]})[_0x3dca('0x24')](function(_0x31831f){if(_0x31831f&&_0x31831f[_0x3dca('0x52')]===0x0){return db['UserProfileResource'][_0x3dca('0x49')]({'name':_0x212544[_0x3dca('0x2a')],'resourceId':_0x212544['id'],'type':_0x31831f[_0x3dca('0x2a')],'sectionId':_0x31831f['id']},{})[_0x3dca('0x24')](function(){return _0x4252b6;});}else{return _0x4252b6;}})[_0x3dca('0x46')](function(_0x24d58f){logger['error'](_0x3dca('0x53'),_0x24d58f);throw _0x24d58f;});}return _0x4252b6;})[_0x3dca('0x24')](respondWithResult(_0x5af8cd,0xc9))['catch'](handleError(_0x5af8cd,null));};exports[_0x3dca('0x54')]=function(_0x32f3f1,_0x5ee396){var _0x47ab1e={'where':{'id':_0x32f3f1[_0x3dca('0x48')]['id']}},_0x5ad335={};_0x5ad335[_0x3dca('0x2f')]=_[_0x3dca('0x31')](db[_0x3dca('0x41')][_0x3dca('0x55')]);_0x47ab1e[_0x3dca('0x35')]=_[_0x3dca('0x33')](_0x5ad335[_0x3dca('0x2f')],qs['fields'](_0x32f3f1[_0x3dca('0x30')][_0x3dca('0x34')]));_0x47ab1e[_0x3dca('0x35')]=_0x47ab1e[_0x3dca('0x35')][_0x3dca('0x36')]?_0x47ab1e[_0x3dca('0x35')]:_0x5ad335['model'];if(_0x32f3f1[_0x3dca('0x30')][_0x3dca('0x42')]){_0x47ab1e[_0x3dca('0x43')]=[{'all':!![]}];}_0x47ab1e=_[_0x3dca('0x3d')]({},_0x47ab1e,_0x32f3f1[_0x3dca('0x40')]);return db[_0x3dca('0x41')][_0x3dca('0x50')](_0x47ab1e)[_0x3dca('0x24')](handleEntityNotFound(_0x5ee396,null))[_0x3dca('0x24')](function(_0x380cd9){if(_0x380cd9){var _0x2d100e=_0x380cd9[_0x3dca('0x26')]({'plain':!![]});_0x2d100e=qs[_0x3dca('0x56')](_0x2d100e,['id','createdAt','updatedAt']);_0x32f3f1['body']=_[_0x3dca('0x56')](_0x32f3f1[_0x3dca('0x4a')],['id',_0x3dca('0x57'),_0x3dca('0x58')]);return db[_0x3dca('0x41')][_0x3dca('0x49')](_[_0x3dca('0x3d')](_0x2d100e,_0x32f3f1[_0x3dca('0x4a')]),{'include':_0x32f3f1[_0x3dca('0x30')][_0x3dca('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x2063a4){var _0x468a9b=_0x32f3f1[_0x3dca('0x4b')][_0x3dca('0x26')]({'plain':!![]});if(!_0x468a9b)throw new Error(_0x3dca('0x4c'));if(_0x468a9b[_0x3dca('0x4d')]===_0x3dca('0x4b')){var _0x45e010=_0x2063a4[_0x3dca('0x26')]({'plain':!![]});var _0xf14197=_0x3dca('0x4e');return db[_0x3dca('0x4f')][_0x3dca('0x50')]({'where':{'name':_0xf14197,'userProfileId':_0x468a9b[_0x3dca('0x51')]},'raw':!![]})['then'](function(_0x40e717){if(_0x40e717&&_0x40e717['autoAssociation']===0x0){return db[_0x3dca('0x27')]['create']({'name':_0x45e010['name'],'resourceId':_0x45e010['id'],'type':_0x40e717[_0x3dca('0x2a')],'sectionId':_0x40e717['id']},{})['then'](function(){return _0x2063a4;});}else{return _0x2063a4;}})[_0x3dca('0x46')](function(_0x2f4189){logger[_0x3dca('0x28')](_0x3dca('0x53'),_0x2f4189);throw _0x2f4189;});}return _0x2063a4;});}})['then'](respondWithResult(_0x5ee396,0xc9))[_0x3dca('0x46')](handleError(_0x5ee396,null));};exports[_0x3dca('0x23')]=function(_0x51c7ec,_0x53aacf){if(_0x51c7ec['body']['id']){delete _0x51c7ec[_0x3dca('0x4a')]['id'];}return db[_0x3dca('0x41')][_0x3dca('0x50')]({'where':{'id':_0x51c7ec[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x53aacf,null))[_0x3dca('0x24')](saveUpdates(_0x51c7ec['body'],null))[_0x3dca('0x24')](respondWithResult(_0x53aacf,null))[_0x3dca('0x46')](handleError(_0x53aacf,null));};exports['destroy']=function(_0x4af7c4,_0x25cd75){return db[_0x3dca('0x41')][_0x3dca('0x50')]({'where':{'id':_0x4af7c4[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x25cd75,null))[_0x3dca('0x24')](removeEntity(_0x25cd75,null))[_0x3dca('0x46')](handleError(_0x25cd75,null));};exports[_0x3dca('0x59')]=function(_0x2020a3,_0x40551d,_0xf4c30){var _0x2a5b45={'raw':!![],'where':{}};var _0x450c8b={};var _0x44f216={'count':0x0,'rows':[]};return db['Campaign'][_0x3dca('0x5a')]({'where':{'id':_0x2020a3[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x40551d,null))['then'](function(_0x104a0e){if(_0x104a0e){_0x450c8b['model']=_[_0x3dca('0x31')](db[_0x3dca('0x5b')][_0x3dca('0x55')]);_0x450c8b[_0x3dca('0x30')]=_[_0x3dca('0x31')](_0x2020a3['query']);_0x450c8b[_0x3dca('0x32')]=_[_0x3dca('0x33')](_0x450c8b[_0x3dca('0x2f')],_0x450c8b[_0x3dca('0x30')]);_0x2a5b45[_0x3dca('0x35')]=_['intersection'](_0x450c8b[_0x3dca('0x2f')],qs['fields'](_0x2020a3[_0x3dca('0x30')][_0x3dca('0x34')]));_0x2a5b45[_0x3dca('0x35')]=_0x2a5b45[_0x3dca('0x35')][_0x3dca('0x36')]?_0x2a5b45[_0x3dca('0x35')]:_0x450c8b[_0x3dca('0x2f')];if(!_0x2020a3['query']['hasOwnProperty'](_0x3dca('0x38'))){_0x2a5b45[_0x3dca('0x1d')]=qs[_0x3dca('0x1d')](_0x2020a3[_0x3dca('0x30')][_0x3dca('0x1d')]);_0x2a5b45[_0x3dca('0x1f')]=qs['offset'](_0x2020a3['query'][_0x3dca('0x1f')]);}_0x2a5b45[_0x3dca('0x5c')]=qs[_0x3dca('0x39')](_0x2020a3[_0x3dca('0x30')][_0x3dca('0x39')]);_0x2a5b45[_0x3dca('0x3a')]=qs['filters'](_[_0x3dca('0x3b')](_0x2020a3['query'],_0x450c8b['filters']));_0x2a5b45[_0x3dca('0x3a')][_0x3dca('0x5d')]=_0x104a0e['id'];if(_0x2020a3[_0x3dca('0x30')][_0x3dca('0x3c')]){_0x2a5b45[_0x3dca('0x3a')]=_[_0x3dca('0x3d')](_0x2a5b45[_0x3dca('0x3a')],{'$or':_['map'](_0x2a5b45['attributes'],function(_0x4fe483){var _0x3dfae0={};_0x3dfae0[_0x4fe483]={'$like':'%'+_0x2020a3[_0x3dca('0x30')][_0x3dca('0x3c')]+'%'};return _0x3dfae0;})});}_0x2a5b45=_[_0x3dca('0x3d')]({},_0x2a5b45,_0x2020a3[_0x3dca('0x40')]);return db[_0x3dca('0x5b')][_0x3dca('0x1e')]({'where':_0x2a5b45[_0x3dca('0x3a')]})[_0x3dca('0x24')](function(_0x2acdbd){_0x44f216[_0x3dca('0x1e')]=_0x2acdbd;if(_0x2020a3['query'][_0x3dca('0x42')]){_0x2a5b45[_0x3dca('0x43')]=[{'all':!![]}];}return db[_0x3dca('0x5b')][_0x3dca('0x44')](_0x2a5b45);})[_0x3dca('0x24')](function(_0x5650f7){_0x44f216[_0x3dca('0x45')]=_0x5650f7;return _0x44f216;});}})[_0x3dca('0x24')](respondWithFilteredResult(_0x40551d,_0x2a5b45))[_0x3dca('0x46')](handleError(_0x40551d,null));};exports[_0x3dca('0x5e')]=function(_0x298b94,_0x5647eb,_0x109dbf){var _0x2f631d={'raw':!![],'where':{}};var _0x1f3390={};var _0x16f946={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x298b94['params']['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x5647eb,null))[_0x3dca('0x24')](function(_0x6b6b41){if(_0x6b6b41){_0x1f3390['model']=_[_0x3dca('0x31')](db[_0x3dca('0x5f')][_0x3dca('0x55')]);_0x1f3390[_0x3dca('0x30')]=_[_0x3dca('0x31')](_0x298b94[_0x3dca('0x30')]);_0x1f3390[_0x3dca('0x32')]=_[_0x3dca('0x33')](_0x1f3390[_0x3dca('0x2f')],_0x1f3390[_0x3dca('0x30')]);_0x2f631d['attributes']=_[_0x3dca('0x33')](_0x1f3390[_0x3dca('0x2f')],qs[_0x3dca('0x34')](_0x298b94[_0x3dca('0x30')][_0x3dca('0x34')]));_0x2f631d['attributes']=_0x2f631d[_0x3dca('0x35')][_0x3dca('0x36')]?_0x2f631d[_0x3dca('0x35')]:_0x1f3390[_0x3dca('0x2f')];if(!_0x298b94['query'][_0x3dca('0x37')](_0x3dca('0x38'))){_0x2f631d[_0x3dca('0x1d')]=qs[_0x3dca('0x1d')](_0x298b94[_0x3dca('0x30')][_0x3dca('0x1d')]);_0x2f631d[_0x3dca('0x1f')]=qs[_0x3dca('0x1f')](_0x298b94[_0x3dca('0x30')]['offset']);}_0x2f631d['order']=qs[_0x3dca('0x39')](_0x298b94[_0x3dca('0x30')][_0x3dca('0x39')]);_0x2f631d[_0x3dca('0x3a')]=qs['filters'](_[_0x3dca('0x3b')](_0x298b94[_0x3dca('0x30')],_0x1f3390['filters']));_0x2f631d[_0x3dca('0x3a')][_0x3dca('0x5d')]=_0x6b6b41['id'];if(_0x298b94[_0x3dca('0x30')][_0x3dca('0x3c')]){_0x2f631d[_0x3dca('0x3a')]=_[_0x3dca('0x3d')](_0x2f631d[_0x3dca('0x3a')],{'$or':_[_0x3dca('0x2c')](_0x2f631d['attributes'],function(_0x2ded82){var _0x510b21={};_0x510b21[_0x2ded82]={'$like':'%'+_0x298b94[_0x3dca('0x30')][_0x3dca('0x3c')]+'%'};return _0x510b21;})});}_0x2f631d=_[_0x3dca('0x3d')]({},_0x2f631d,_0x298b94[_0x3dca('0x40')]);return db['CmHopperHistory'][_0x3dca('0x1e')]({'where':_0x2f631d['where']})[_0x3dca('0x24')](function(_0x933518){_0x16f946[_0x3dca('0x1e')]=_0x933518;if(_0x298b94[_0x3dca('0x30')][_0x3dca('0x42')]){_0x2f631d[_0x3dca('0x43')]=[{'all':!![]}];}return db[_0x3dca('0x5f')][_0x3dca('0x44')](_0x2f631d);})[_0x3dca('0x24')](function(_0x659e94){_0x16f946['rows']=_0x659e94;return _0x16f946;});}})['then'](respondWithFilteredResult(_0x5647eb,_0x2f631d))[_0x3dca('0x46')](handleError(_0x5647eb,null));};exports[_0x3dca('0x60')]=function(_0x57dd8b,_0x4fd410,_0x18d6c1){var _0x4688cf={'raw':!![],'where':{}};var _0x22bd9e={};var _0x1b354d={'count':0x0,'rows':[]};return db[_0x3dca('0x41')][_0x3dca('0x5a')]({'where':{'id':_0x57dd8b['params']['id']}})['then'](handleEntityNotFound(_0x4fd410,null))[_0x3dca('0x24')](function(_0x116ca9){if(_0x116ca9){_0x22bd9e[_0x3dca('0x2f')]=_[_0x3dca('0x31')](db[_0x3dca('0x61')][_0x3dca('0x55')]);_0x22bd9e['query']=_[_0x3dca('0x31')](_0x57dd8b[_0x3dca('0x30')]);_0x22bd9e[_0x3dca('0x32')]=_[_0x3dca('0x33')](_0x22bd9e[_0x3dca('0x2f')],_0x22bd9e[_0x3dca('0x30')]);_0x4688cf[_0x3dca('0x35')]=_['intersection'](_0x22bd9e['model'],qs[_0x3dca('0x34')](_0x57dd8b[_0x3dca('0x30')][_0x3dca('0x34')]));_0x4688cf[_0x3dca('0x35')]=_0x4688cf[_0x3dca('0x35')][_0x3dca('0x36')]?_0x4688cf[_0x3dca('0x35')]:_0x22bd9e[_0x3dca('0x2f')];if(!_0x57dd8b[_0x3dca('0x30')][_0x3dca('0x37')](_0x3dca('0x38'))){_0x4688cf[_0x3dca('0x1d')]=qs[_0x3dca('0x1d')](_0x57dd8b['query']['limit']);_0x4688cf[_0x3dca('0x1f')]=qs[_0x3dca('0x1f')](_0x57dd8b[_0x3dca('0x30')][_0x3dca('0x1f')]);}_0x4688cf[_0x3dca('0x5c')]=qs['sort'](_0x57dd8b[_0x3dca('0x30')][_0x3dca('0x39')]);_0x4688cf[_0x3dca('0x3a')]=qs[_0x3dca('0x32')](_[_0x3dca('0x3b')](_0x57dd8b[_0x3dca('0x30')],_0x22bd9e[_0x3dca('0x32')]));_0x4688cf['where']['CampaignId']=_0x116ca9['id'];if(_0x57dd8b[_0x3dca('0x30')][_0x3dca('0x3c')]){_0x4688cf[_0x3dca('0x3a')]=_[_0x3dca('0x3d')](_0x4688cf['where'],{'$or':_[_0x3dca('0x2c')](_0x4688cf['attributes'],function(_0x5d1361){var _0x5dc558={};_0x5dc558[_0x5d1361]={'$like':'%'+_0x57dd8b[_0x3dca('0x30')][_0x3dca('0x3c')]+'%'};return _0x5dc558;})});}_0x4688cf=_['merge']({},_0x4688cf,_0x57dd8b[_0x3dca('0x40')]);return db[_0x3dca('0x61')][_0x3dca('0x1e')]({'where':_0x4688cf[_0x3dca('0x3a')]})['then'](function(_0x5069d7){_0x1b354d[_0x3dca('0x1e')]=_0x5069d7;if(_0x57dd8b[_0x3dca('0x30')][_0x3dca('0x42')]){_0x4688cf[_0x3dca('0x43')]=[{'all':!![]}];}return db[_0x3dca('0x61')][_0x3dca('0x44')](_0x4688cf);})[_0x3dca('0x24')](function(_0x5914d4){_0x1b354d[_0x3dca('0x45')]=_0x5914d4;return _0x1b354d;});}})['then'](respondWithFilteredResult(_0x4fd410,_0x4688cf))['catch'](handleError(_0x4fd410,null));};exports['getHopperBlacks']=function(_0x320c87,_0x5641fe,_0x4eb2ad){var _0x3b4b51={'raw':!![],'where':{}};var _0x2e8d04={};var _0x3289e8={'count':0x0,'rows':[]};return db['Campaign'][_0x3dca('0x5a')]({'where':{'id':_0x320c87[_0x3dca('0x48')]['id']}})['then'](handleEntityNotFound(_0x5641fe,null))['then'](function(_0x4325a7){if(_0x4325a7){_0x2e8d04[_0x3dca('0x2f')]=_['keys'](db['CmHopperBlack'][_0x3dca('0x55')]);_0x2e8d04['query']=_[_0x3dca('0x31')](_0x320c87[_0x3dca('0x30')]);_0x2e8d04[_0x3dca('0x32')]=_[_0x3dca('0x33')](_0x2e8d04['model'],_0x2e8d04['query']);_0x3b4b51[_0x3dca('0x35')]=_['intersection'](_0x2e8d04[_0x3dca('0x2f')],qs[_0x3dca('0x34')](_0x320c87[_0x3dca('0x30')]['fields']));_0x3b4b51['attributes']=_0x3b4b51['attributes'][_0x3dca('0x36')]?_0x3b4b51[_0x3dca('0x35')]:_0x2e8d04[_0x3dca('0x2f')];if(!_0x320c87['query']['hasOwnProperty']('nolimit')){_0x3b4b51[_0x3dca('0x1d')]=qs[_0x3dca('0x1d')](_0x320c87[_0x3dca('0x30')][_0x3dca('0x1d')]);_0x3b4b51[_0x3dca('0x1f')]=qs[_0x3dca('0x1f')](_0x320c87[_0x3dca('0x30')][_0x3dca('0x1f')]);}_0x3b4b51[_0x3dca('0x5c')]=qs['sort'](_0x320c87[_0x3dca('0x30')][_0x3dca('0x39')]);_0x3b4b51['where']=qs['filters'](_[_0x3dca('0x3b')](_0x320c87[_0x3dca('0x30')],_0x2e8d04[_0x3dca('0x32')]));_0x3b4b51[_0x3dca('0x3a')]['CampaignId']=_0x4325a7['id'];if(_0x320c87[_0x3dca('0x30')]['filter']){_0x3b4b51[_0x3dca('0x3a')]=_[_0x3dca('0x3d')](_0x3b4b51[_0x3dca('0x3a')],{'$or':_['map'](_0x3b4b51['attributes'],function(_0x450a14){var _0x347c36={};_0x347c36[_0x450a14]={'$like':'%'+_0x320c87[_0x3dca('0x30')][_0x3dca('0x3c')]+'%'};return _0x347c36;})});}_0x3b4b51=_[_0x3dca('0x3d')]({},_0x3b4b51,_0x320c87['options']);return db[_0x3dca('0x62')][_0x3dca('0x1e')]({'where':_0x3b4b51['where']})['then'](function(_0x1b927f){_0x3289e8[_0x3dca('0x1e')]=_0x1b927f;if(_0x320c87['query'][_0x3dca('0x42')]){_0x3b4b51[_0x3dca('0x43')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3b4b51);})[_0x3dca('0x24')](function(_0x12fa9b){_0x3289e8['rows']=_0x12fa9b;return _0x3289e8;});}})[_0x3dca('0x24')](respondWithFilteredResult(_0x5641fe,_0x3b4b51))[_0x3dca('0x46')](handleError(_0x5641fe,null));};exports[_0x3dca('0x63')]=function(_0x1f4dde,_0x485c16,_0x2528b2){var _0x145094={};var _0x583668={};var _0x5b514f;var _0x480b1e;return db[_0x3dca('0x41')][_0x3dca('0x5a')]({'where':{'id':_0x1f4dde[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x485c16,null))[_0x3dca('0x24')](function(_0xc1c26f){if(_0xc1c26f){_0x5b514f=_0xc1c26f;_0x583668[_0x3dca('0x2f')]=_[_0x3dca('0x31')](db[_0x3dca('0x64')][_0x3dca('0x55')]);_0x583668['query']=_['keys'](_0x1f4dde['query']);_0x583668[_0x3dca('0x32')]=_['intersection'](_0x583668['model'],_0x583668[_0x3dca('0x30')]);_0x145094['attributes']=_[_0x3dca('0x33')](_0x583668['model'],qs[_0x3dca('0x34')](_0x1f4dde[_0x3dca('0x30')]['fields']));_0x145094[_0x3dca('0x35')]=_0x145094[_0x3dca('0x35')][_0x3dca('0x36')]?_0x145094['attributes']:_0x583668[_0x3dca('0x2f')];_0x145094['order']=qs['sort'](_0x1f4dde['query'][_0x3dca('0x39')]);_0x145094[_0x3dca('0x3a')]=qs['filters'](_['pick'](_0x1f4dde['query'],_0x583668[_0x3dca('0x32')]));if(_0x1f4dde[_0x3dca('0x30')][_0x3dca('0x3c')]){_0x145094[_0x3dca('0x3a')]=_['merge'](_0x145094['where'],{'$or':_[_0x3dca('0x2c')](_0x145094[_0x3dca('0x35')],function(_0x9c01fc){var _0x428081={};_0x428081[_0x9c01fc]={'$like':'%'+_0x1f4dde[_0x3dca('0x30')]['filter']+'%'};return _0x428081;})});}_0x145094=_[_0x3dca('0x3d')]({},_0x145094,_0x1f4dde['options']);return _0x5b514f[_0x3dca('0x63')](_0x145094);}})['then'](function(_0x2e38d4){if(_0x2e38d4){_0x480b1e=_0x2e38d4[_0x3dca('0x36')];if(!_0x1f4dde['query'][_0x3dca('0x37')](_0x3dca('0x38'))){_0x145094[_0x3dca('0x1d')]=qs[_0x3dca('0x1d')](_0x1f4dde[_0x3dca('0x30')][_0x3dca('0x1d')]);_0x145094[_0x3dca('0x1f')]=qs['offset'](_0x1f4dde[_0x3dca('0x30')]['offset']);}return _0x5b514f[_0x3dca('0x63')](_0x145094);}})[_0x3dca('0x24')](function(_0x304e65){if(_0x304e65){return _0x304e65?{'count':_0x480b1e,'rows':_0x304e65}:null;}})['then'](respondWithResult(_0x485c16,null))[_0x3dca('0x46')](handleError(_0x485c16,null));};exports[_0x3dca('0x65')]=function(_0x2e4f2c,_0x460820,_0x240dd4){var _0xa2dca0,_0x1db782;var _0x155884=[];var _0x476188=moment()['format'](_0x3dca('0x66'));return db[_0x3dca('0x41')][_0x3dca('0x50')]({'where':{'id':_0x2e4f2c[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x460820,null))[_0x3dca('0x24')](function(_0x5681e5){if(_0x5681e5){_0x1db782=_0x5681e5;return _0x5681e5[_0x3dca('0x65')](_0x2e4f2c[_0x3dca('0x4a')][_0x3dca('0x67')],_[_0x3dca('0x56')](_0x2e4f2c['body'],[_0x3dca('0x67'),'id'])||{});}return null;})[_0x3dca('0x68')](function(_0xa440c4){var _0x44f882;var _0x542293;_0xa2dca0=_0xa440c4||[];var _0x4f7768=[];if(_0xa440c4){for(var _0x34e4cb=0x0;_0x34e4cb<_0xa440c4['length'];_0x34e4cb+=0x1){var _0x592be8=_0xa440c4[_0x34e4cb][_0x3dca('0x26')]({'plain':!![]});_0x1db782[_0x3dca('0x69')]=_0x2e4f2c[_0x3dca('0x4a')][_0x3dca('0x69')]?_0x2e4f2c[_0x3dca('0x4a')][_0x3dca('0x69')]:_0x1db782['dialCheckDuplicateType'];switch(_0x1db782[_0x3dca('0x69')]){case _0x3dca('0x6a'):_0x44f882=squel[_0x3dca('0x6b')]()[_0x3dca('0x6c')](_0x3dca('0x6d'))['fromQuery']([_0x3dca('0x6e'),_0x3dca('0x6f'),_0x3dca('0x70'),_0x3dca('0x71'),_0x3dca('0x5d'),_0x3dca('0x57'),_0x3dca('0x58')],squel[_0x3dca('0x72')]()['field']('phone',_0x3dca('0x6e'))['field'](_0x3dca('0x73'),_0x3dca('0x6f'))[_0x3dca('0x74')]('id','ContactId')[_0x3dca('0x74')](_0x592be8[_0x3dca('0x75')]['toString'](),_0x3dca('0x71'))[_0x3dca('0x74')](_0x2e4f2c[_0x3dca('0x48')]['id'][_0x3dca('0x76')](),_0x3dca('0x5d'))['field']('\x27'+_0x476188+'\x27',_0x3dca('0x57'))[_0x3dca('0x74')]('\x27'+_0x476188+'\x27',_0x3dca('0x58'))[_0x3dca('0x77')]('cm_contacts')['where'](_0x3dca('0x78'))[_0x3dca('0x3a')](_0x3dca('0x79'),_0x592be8['CmListId'][_0x3dca('0x76')]())['where'](_0x3dca('0x7a'))[_0x3dca('0x3a')](_0x3dca('0x7b'),squel['select']()[_0x3dca('0x74')](_0x3dca('0x7c'))['from']('cm_hopper_final')[_0x3dca('0x3a')](_0x3dca('0x7d'),_0x2e4f2c[_0x3dca('0x48')]['id']['toString']()))[_0x3dca('0x3a')](_0x3dca('0x7b'),squel[_0x3dca('0x72')]()[_0x3dca('0x74')]('COALESCE(phone,\x27\x27)')[_0x3dca('0x77')](_0x3dca('0x6d'))[_0x3dca('0x3a')](_0x3dca('0x7d'),_0x2e4f2c[_0x3dca('0x48')]['id'][_0x3dca('0x76')]())))['toString']();break;case _0x3dca('0x7e'):_0x44f882=squel[_0x3dca('0x6b')]()[_0x3dca('0x6c')](_0x3dca('0x6d'))[_0x3dca('0x7f')](['phone',_0x3dca('0x6f'),_0x3dca('0x70'),_0x3dca('0x71'),_0x3dca('0x5d'),_0x3dca('0x57'),_0x3dca('0x58')],squel[_0x3dca('0x72')]()[_0x3dca('0x74')](_0x3dca('0x6e'),'phone')[_0x3dca('0x74')](_0x3dca('0x73'),'scheduledAt')[_0x3dca('0x74')]('id',_0x3dca('0x70'))[_0x3dca('0x74')](_0x592be8[_0x3dca('0x75')][_0x3dca('0x76')](),_0x3dca('0x71'))[_0x3dca('0x74')](_0x2e4f2c[_0x3dca('0x48')]['id']['toString'](),_0x3dca('0x5d'))[_0x3dca('0x74')]('\x27'+_0x476188+'\x27',_0x3dca('0x57'))['field']('\x27'+_0x476188+'\x27',_0x3dca('0x58'))[_0x3dca('0x77')](_0x3dca('0x80'))[_0x3dca('0x3a')](_0x3dca('0x78'))[_0x3dca('0x3a')](_0x3dca('0x79'),_0x592be8[_0x3dca('0x75')][_0x3dca('0x76')]())[_0x3dca('0x3a')](_0x3dca('0x7a'))['where'](_0x3dca('0x7b'),squel['select']()['field'](_0x3dca('0x81'))[_0x3dca('0x77')]('cm_hopper')[_0x3dca('0x3a')](_0x3dca('0x7d'),_0x2e4f2c[_0x3dca('0x48')]['id'][_0x3dca('0x76')]())))[_0x3dca('0x76')]();break;default:_0x44f882=squel[_0x3dca('0x6b')]()[_0x3dca('0x6c')](_0x3dca('0x6d'))[_0x3dca('0x7f')](['phone',_0x3dca('0x6f'),_0x3dca('0x70'),_0x3dca('0x71'),_0x3dca('0x5d'),'createdAt',_0x3dca('0x58')],squel[_0x3dca('0x72')]()['field'](_0x3dca('0x6e'),_0x3dca('0x6e'))[_0x3dca('0x74')](_0x3dca('0x73'),_0x3dca('0x6f'))[_0x3dca('0x74')]('id',_0x3dca('0x70'))[_0x3dca('0x74')](_0x592be8['CmListId']['toString'](),'ListId')[_0x3dca('0x74')](_0x2e4f2c[_0x3dca('0x48')]['id'][_0x3dca('0x76')](),_0x3dca('0x5d'))[_0x3dca('0x74')]('\x27'+_0x476188+'\x27','createdAt')['field']('\x27'+_0x476188+'\x27',_0x3dca('0x58'))[_0x3dca('0x77')](_0x3dca('0x80'))[_0x3dca('0x3a')](_0x3dca('0x78'))[_0x3dca('0x3a')]('ListId\x20=\x20?',_0x592be8[_0x3dca('0x75')]['toString']())[_0x3dca('0x3a')](_0x3dca('0x7a')))['toString']();}_0x542293=squel[_0x3dca('0x6b')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x3dca('0x82'),_0x3dca('0x6f'),'phone',_0x3dca('0x83'),_0x3dca('0x57'),_0x3dca('0x58')],squel[_0x3dca('0x72')]()[_0x3dca('0x74')](_0x3dca('0x84'),'id')[_0x3dca('0x74')](_0x3dca('0x73'),_0x3dca('0x6f'))[_0x3dca('0x74')](_0x3dca('0x85'),_0x3dca('0x6e'))[_0x3dca('0x74')](_0x3dca('0x86'),'OrderBy')[_0x3dca('0x74')]('\x27'+_0x476188+'\x27','createdAt')[_0x3dca('0x74')]('\x27'+_0x476188+'\x27',_0x3dca('0x58'))['from'](_0x3dca('0x87'),'ci')[_0x3dca('0x88')](_0x3dca('0x6d'),'h',_0x3dca('0x89'))[_0x3dca('0x3a')]('h.ListId\x20=\x20?',_0x592be8['CmListId'][_0x3dca('0x76')]())[_0x3dca('0x3a')](_0x3dca('0x8a'),_0x2e4f2c['params']['id']['toString']())[_0x3dca('0x3a')](_0x3dca('0x8b'),_0x476188))[_0x3dca('0x76')]();_0x4f7768[_0x3dca('0x8c')](db[_0x3dca('0x8d')][_0x3dca('0x30')](_0x44f882));_0x155884['push'](db[_0x3dca('0x8d')][_0x3dca('0x30')](_0x542293));}return BPromise['all'](_0x4f7768);}})[_0x3dca('0x24')](function(){return BPromise[_0x3dca('0x8e')](_0x155884);})[_0x3dca('0x24')](function(){return _0xa2dca0;})[_0x3dca('0x24')](respondWithResult(_0x460820,null))[_0x3dca('0x46')](handleError(_0x460820,null));};exports[_0x3dca('0x8f')]=function(_0x1424c5,_0x49806e,_0x1689d6){return db['Campaign']['find']({'where':{'id':_0x1424c5[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x49806e,null))[_0x3dca('0x24')](function(_0x3c2a75){if(_0x3c2a75){return _0x3c2a75[_0x3dca('0x8f')](_0x1424c5['query'][_0x3dca('0x67')]);}})[_0x3dca('0x24')](function(_0x32685f){if(_0x32685f){return db[_0x3dca('0x5b')][_0x3dca('0x25')]({'where':{'ListId':_0x1424c5[_0x3dca('0x30')][_0x3dca('0x67')],'CampaignId':_0x1424c5['params']['id']}})['then'](function(){return _0x32685f;});}})[_0x3dca('0x24')](respondWithStatusCode(_0x49806e,null))[_0x3dca('0x46')](handleError(_0x49806e,null));};exports['getBlackLists']=function(_0x30e788,_0x32a051,_0x4cf13a){var _0x581ca8={};var _0x183bca={};var _0x5bcc67;var _0x2e387f;return db[_0x3dca('0x41')][_0x3dca('0x5a')]({'where':{'id':_0x30e788['params']['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x32a051,null))[_0x3dca('0x24')](function(_0x599cfc){if(_0x599cfc){_0x5bcc67=_0x599cfc;_0x183bca['model']=_['keys'](db['CmList'][_0x3dca('0x55')]);_0x183bca[_0x3dca('0x30')]=_[_0x3dca('0x31')](_0x30e788['query']);_0x183bca['filters']=_[_0x3dca('0x33')](_0x183bca[_0x3dca('0x2f')],_0x183bca[_0x3dca('0x30')]);_0x581ca8['attributes']=_[_0x3dca('0x33')](_0x183bca[_0x3dca('0x2f')],qs['fields'](_0x30e788['query'][_0x3dca('0x34')]));_0x581ca8['attributes']=_0x581ca8[_0x3dca('0x35')][_0x3dca('0x36')]?_0x581ca8[_0x3dca('0x35')]:_0x183bca['model'];_0x581ca8['order']=qs['sort'](_0x30e788[_0x3dca('0x30')][_0x3dca('0x39')]);_0x581ca8[_0x3dca('0x3a')]=qs[_0x3dca('0x32')](_[_0x3dca('0x3b')](_0x30e788['query'],_0x183bca[_0x3dca('0x32')]));if(_0x30e788[_0x3dca('0x30')]['filter']){_0x581ca8[_0x3dca('0x3a')]=_[_0x3dca('0x3d')](_0x581ca8[_0x3dca('0x3a')],{'$or':_['map'](_0x581ca8['attributes'],function(_0x2c2406){var _0x37fab5={};_0x37fab5[_0x2c2406]={'$like':'%'+_0x30e788[_0x3dca('0x30')][_0x3dca('0x3c')]+'%'};return _0x37fab5;})});}_0x581ca8=_[_0x3dca('0x3d')]({},_0x581ca8,_0x30e788[_0x3dca('0x40')]);return _0x5bcc67[_0x3dca('0x90')](_0x581ca8);}})[_0x3dca('0x24')](function(_0x283d21){if(_0x283d21){_0x2e387f=_0x283d21['length'];if(!_0x30e788['query'][_0x3dca('0x37')](_0x3dca('0x38'))){_0x581ca8[_0x3dca('0x1d')]=qs[_0x3dca('0x1d')](_0x30e788['query']['limit']);_0x581ca8[_0x3dca('0x1f')]=qs['offset'](_0x30e788[_0x3dca('0x30')]['offset']);}return _0x5bcc67['getBlackLists'](_0x581ca8);}})[_0x3dca('0x24')](function(_0x48edb2){if(_0x48edb2){return _0x48edb2?{'count':_0x2e387f,'rows':_0x48edb2}:null;}})['then'](respondWithResult(_0x32a051,null))[_0x3dca('0x46')](handleError(_0x32a051,null));};exports[_0x3dca('0x91')]=function(_0xb29b5,_0x5c701e,_0x1f4515){var _0x4be4f9,_0x2ee861;var _0x454a6e=[];var _0x591bbf=moment()[_0x3dca('0x92')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x3dca('0x41')][_0x3dca('0x50')]({'where':{'id':_0xb29b5['params']['id']}})['then'](handleEntityNotFound(_0x5c701e,null))[_0x3dca('0x24')](function(_0x552c11){if(_0x552c11){_0x2ee861=_0x552c11;return _0x552c11[_0x3dca('0x91')](_0xb29b5[_0x3dca('0x4a')]['ids'],_['omit'](_0xb29b5['body'],[_0x3dca('0x67'),'id'])||{});}return null;})['spread'](function(_0x1ad506){var _0xa421cf;var _0x511153;_0x4be4f9=_0x1ad506||[];var _0x525ece=[];if(_0x1ad506){for(var _0x3d2e5a=0x0;_0x3d2e5a<_0x1ad506[_0x3dca('0x36')];_0x3d2e5a+=0x1){var _0x1229a5=_0x1ad506[_0x3d2e5a][_0x3dca('0x26')]({'plain':!![]});_0xa421cf=squel[_0x3dca('0x6b')]()['into'](_0x3dca('0x93'))['fromQuery']([_0x3dca('0x6e'),_0x3dca('0x70'),_0x3dca('0x71'),_0x3dca('0x5d'),'createdAt',_0x3dca('0x58')],squel[_0x3dca('0x72')]()[_0x3dca('0x74')](_0x3dca('0x6e'),'phone')['field']('id',_0x3dca('0x70'))[_0x3dca('0x74')](_0x1229a5[_0x3dca('0x75')]['toString'](),_0x3dca('0x71'))[_0x3dca('0x74')](_0xb29b5[_0x3dca('0x48')]['id']['toString'](),_0x3dca('0x5d'))[_0x3dca('0x74')]('NOW()',_0x3dca('0x57'))['field']('NOW()',_0x3dca('0x58'))[_0x3dca('0x77')]('cm_contacts')[_0x3dca('0x3a')]('deletedAt\x20IS\x20NULL')[_0x3dca('0x3a')](_0x3dca('0x79'),_0x1229a5[_0x3dca('0x75')][_0x3dca('0x76')]())[_0x3dca('0x3a')](_0x3dca('0x7a')))[_0x3dca('0x76')]();_0x525ece[_0x3dca('0x8c')](db[_0x3dca('0x8d')][_0x3dca('0x30')](_0xa421cf));}return BPromise['all'](_0x525ece);}})[_0x3dca('0x24')](function(){return _0x4be4f9;})['then'](respondWithResult(_0x5c701e,null))[_0x3dca('0x46')](handleError(_0x5c701e,null));};exports[_0x3dca('0x94')]=function(_0x2e1aa0,_0x5a05e6,_0x273843){return db['Campaign'][_0x3dca('0x50')]({'where':{'id':_0x2e1aa0[_0x3dca('0x48')]['id']}})[_0x3dca('0x24')](handleEntityNotFound(_0x5a05e6,null))[_0x3dca('0x24')](function(_0x16176b){if(_0x16176b){return _0x16176b[_0x3dca('0x94')](_0x2e1aa0[_0x3dca('0x30')][_0x3dca('0x67')]);}})[_0x3dca('0x24')](function(_0x1ac89a){if(_0x1ac89a){return db['CmHopperBlack'][_0x3dca('0x25')]({'where':{'ListId':_0x2e1aa0[_0x3dca('0x30')][_0x3dca('0x67')],'CampaignId':_0x2e1aa0[_0x3dca('0x48')]['id']}})['then'](function(){return _0x1ac89a;});}})['then'](respondWithStatusCode(_0x5a05e6,null))[_0x3dca('0x46')](handleError(_0x5a05e6,null));}; \ No newline at end of file +var _0x66d3=['status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','get','IvrCampaigns','then','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Campaign','includeAll','include','findAll','rows','show','find','catch','create','body','user','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','params','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','fromQuery','cm_hopper_additional_phones','ci.OrderBY','OrderBy','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x4db0e2,_0xcb988f){var _0x288567=function(_0x845b53){while(--_0x845b53){_0x4db0e2['push'](_0x4db0e2['shift']());}};_0x288567(++_0xcb988f);}(_0x66d3,0x10f));var _0x366d=function(_0x37c146,_0x2e05ef){_0x37c146=_0x37c146-0x0;var _0x485e66=_0x66d3[_0x37c146];return _0x485e66;};'use strict';var emlformat=require(_0x366d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x366d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x366d('0x2'));var moment=require(_0x366d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x366d('0x4'));var util=require('util');var path=require(_0x366d('0x5'));var sox=require('sox');var csv=require(_0x366d('0x6'));var ejs=require(_0x366d('0x7'));var fs=require('fs');var fs_extra=require(_0x366d('0x8'));var _=require(_0x366d('0x9'));var squel=require(_0x366d('0xa'));var crypto=require(_0x366d('0xb'));var jsforce=require(_0x366d('0xc'));var deskjs=require(_0x366d('0xd'));var toCsv=require(_0x366d('0x6'));var querystring=require(_0x366d('0xe'));var Papa=require(_0x366d('0xf'));var Redis=require('ioredis');var authService=require(_0x366d('0x10'));var qs=require(_0x366d('0x11'));var as=require(_0x366d('0x12'));var hardwareService=require(_0x366d('0x13'));var logger=require(_0x366d('0x14'))(_0x366d('0x15'));var utils=require(_0x366d('0x16'));var config=require(_0x366d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x210ed0,_0x797ee){_0x797ee=_0x797ee||0xcc;return function(_0x3dd776){if(_0x3dd776){return _0x210ed0[_0x366d('0x18')](_0x797ee);}return _0x210ed0[_0x366d('0x19')](_0x797ee)[_0x366d('0x1a')]();};}function respondWithResult(_0x4fa003,_0x265292){_0x265292=_0x265292||0xc8;return function(_0x2a3fdb){if(_0x2a3fdb){return _0x4fa003['status'](_0x265292)[_0x366d('0x1b')](_0x2a3fdb);}};}function respondWithFilteredResult(_0x287d17,_0x54a1bb){return function(_0x3da66f){if(_0x3da66f){var _0x309dc6=typeof _0x54a1bb[_0x366d('0x1c')]==='undefined'&&typeof _0x54a1bb[_0x366d('0x1d')]==='undefined';var _0xbc2286=_0x3da66f[_0x366d('0x1e')];var _0x5a1c0a=_0x309dc6?0x0:_0x54a1bb[_0x366d('0x1c')];var _0x235ff2=_0x309dc6?_0x3da66f[_0x366d('0x1e')]:_0x54a1bb[_0x366d('0x1c')]+_0x54a1bb[_0x366d('0x1d')];var _0x4ce0c6;if(_0x235ff2>=_0xbc2286){_0x235ff2=_0xbc2286;_0x4ce0c6=0xc8;}else{_0x4ce0c6=0xce;}_0x287d17[_0x366d('0x19')](_0x4ce0c6);return _0x287d17['set'](_0x366d('0x1f'),_0x5a1c0a+'-'+_0x235ff2+'/'+_0xbc2286)['json'](_0x3da66f);}return null;};}function patchUpdates(_0x5cbe3b){return function(_0x219106){try{jsonpatch[_0x366d('0x20')](_0x219106,_0x5cbe3b,!![]);}catch(_0x5a4a75){return BPromise[_0x366d('0x21')](_0x5a4a75);}return _0x219106[_0x366d('0x22')]();};}function saveUpdates(_0x1ed99c,_0x58d16f){return function(_0x3b5c89){if(_0x3b5c89){return _0x3b5c89[_0x366d('0x23')](_0x1ed99c)['then'](function(_0x3d4941){return _0x3d4941;});}return null;};}function removeEntity(_0x47ebf4,_0x1c9ee9){return function(_0x1326c9){if(_0x1326c9){return _0x1326c9[_0x366d('0x24')]()['then'](function(){var _0x3d3d12=_0x1326c9[_0x366d('0x25')]({'plain':!![]});var _0x2a1d96=_0x366d('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2a1d96,'resourceId':_0x3d3d12['id']}})[_0x366d('0x27')](function(){return _0x1326c9;});})[_0x366d('0x27')](function(){_0x47ebf4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10628b,_0x1a593e){return function(_0x31957c){if(!_0x31957c){_0x10628b[_0x366d('0x18')](0x194);}return _0x31957c;};}function handleError(_0x552c86,_0x413307){_0x413307=_0x413307||0x1f4;return function(_0x5dc954){logger[_0x366d('0x28')](_0x5dc954[_0x366d('0x29')]);if(_0x5dc954['name']){delete _0x5dc954['name'];}_0x552c86[_0x366d('0x19')](_0x413307)[_0x366d('0x2a')](_0x5dc954);};}exports[_0x366d('0x2b')]=function(_0x53ea53,_0x2c2517){var _0x2cb209={},_0x460e4c={},_0x2474a2={'count':0x0,'rows':[]};var _0x2950db=_[_0x366d('0x2c')](db['Campaign'][_0x366d('0x2d')],function(_0x546a3e){return{'name':_0x546a3e[_0x366d('0x2e')],'type':_0x546a3e['type'][_0x366d('0x2f')]};});_0x460e4c[_0x366d('0x30')]=_[_0x366d('0x2c')](_0x2950db,_0x366d('0x31'));_0x460e4c['query']=_[_0x366d('0x32')](_0x53ea53[_0x366d('0x33')]);_0x460e4c[_0x366d('0x34')]=_[_0x366d('0x35')](_0x460e4c[_0x366d('0x30')],_0x460e4c[_0x366d('0x33')]);_0x2cb209['attributes']=_['intersection'](_0x460e4c[_0x366d('0x30')],qs[_0x366d('0x36')](_0x53ea53[_0x366d('0x33')][_0x366d('0x36')]));_0x2cb209['attributes']=_0x2cb209[_0x366d('0x37')][_0x366d('0x38')]?_0x2cb209[_0x366d('0x37')]:_0x460e4c[_0x366d('0x30')];if(!_0x53ea53[_0x366d('0x33')][_0x366d('0x39')](_0x366d('0x3a'))){_0x2cb209[_0x366d('0x1d')]=qs[_0x366d('0x1d')](_0x53ea53['query'][_0x366d('0x1d')]);_0x2cb209[_0x366d('0x1c')]=qs[_0x366d('0x1c')](_0x53ea53['query'][_0x366d('0x1c')]);}_0x2cb209[_0x366d('0x3b')]=qs[_0x366d('0x3c')](_0x53ea53[_0x366d('0x33')][_0x366d('0x3c')]);_0x2cb209[_0x366d('0x3d')]=qs['filters'](_[_0x366d('0x3e')](_0x53ea53[_0x366d('0x33')],_0x460e4c[_0x366d('0x34')]),_0x2950db);if(_0x53ea53[_0x366d('0x33')]['filter']){_0x2cb209[_0x366d('0x3d')]=_[_0x366d('0x3f')](_0x2cb209[_0x366d('0x3d')],{'$or':_[_0x366d('0x2c')](_0x2950db,function(_0xe0a188){if(_0xe0a188['type']!==_0x366d('0x40')){var _0x193726={};_0x193726[_0xe0a188[_0x366d('0x31')]]={'$like':'%'+_0x53ea53[_0x366d('0x33')][_0x366d('0x41')]+'%'};return _0x193726;}})});}_0x2cb209=_[_0x366d('0x3f')]({},_0x2cb209,_0x53ea53[_0x366d('0x42')]);var _0x4814b5={'where':_0x2cb209[_0x366d('0x3d')]};return db[_0x366d('0x43')][_0x366d('0x1e')](_0x4814b5)[_0x366d('0x27')](function(_0x1e1081){_0x2474a2[_0x366d('0x1e')]=_0x1e1081;if(_0x53ea53[_0x366d('0x33')][_0x366d('0x44')]){_0x2cb209[_0x366d('0x45')]=[{'all':!![]}];}return db[_0x366d('0x43')][_0x366d('0x46')](_0x2cb209);})[_0x366d('0x27')](function(_0x53c654){_0x2474a2[_0x366d('0x47')]=_0x53c654;return _0x2474a2;})[_0x366d('0x27')](respondWithFilteredResult(_0x2c2517,_0x2cb209))['catch'](handleError(_0x2c2517,null));};exports[_0x366d('0x48')]=function(_0x585a72,_0x1373cb){var _0x5f212e={'raw':![],'where':{'id':_0x585a72['params']['id']}},_0x619931={};_0x619931[_0x366d('0x30')]=_[_0x366d('0x32')](db[_0x366d('0x43')][_0x366d('0x2d')]);_0x619931[_0x366d('0x33')]=_[_0x366d('0x32')](_0x585a72[_0x366d('0x33')]);_0x619931['filters']=_[_0x366d('0x35')](_0x619931[_0x366d('0x30')],_0x619931[_0x366d('0x33')]);_0x5f212e[_0x366d('0x37')]=_[_0x366d('0x35')](_0x619931[_0x366d('0x30')],qs[_0x366d('0x36')](_0x585a72[_0x366d('0x33')][_0x366d('0x36')]));_0x5f212e[_0x366d('0x37')]=_0x5f212e[_0x366d('0x37')]['length']?_0x5f212e[_0x366d('0x37')]:_0x619931[_0x366d('0x30')];if(_0x585a72[_0x366d('0x33')]['includeAll']){_0x5f212e[_0x366d('0x45')]=[{'all':!![]}];}_0x5f212e=_['merge']({},_0x5f212e,_0x585a72[_0x366d('0x42')]);return db[_0x366d('0x43')][_0x366d('0x49')](_0x5f212e)['then'](handleEntityNotFound(_0x1373cb,null))['then'](respondWithResult(_0x1373cb,null))[_0x366d('0x4a')](handleError(_0x1373cb,null));};exports[_0x366d('0x4b')]=function(_0x21a5b4,_0x68ba99){return db[_0x366d('0x43')][_0x366d('0x4b')](_0x21a5b4[_0x366d('0x4c')],{})['then'](function(_0x18f82a){var _0x26153c=_0x21a5b4[_0x366d('0x4d')]['get']({'plain':!![]});if(!_0x26153c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26153c[_0x366d('0x4e')]===_0x366d('0x4d')){var _0x18e206=_0x18f82a[_0x366d('0x25')]({'plain':!![]});var _0xfffa10=_0x366d('0x26');return db[_0x366d('0x4f')]['find']({'where':{'name':_0xfffa10,'userProfileId':_0x26153c[_0x366d('0x50')]},'raw':!![]})[_0x366d('0x27')](function(_0x3b92a8){if(_0x3b92a8&&_0x3b92a8[_0x366d('0x51')]===0x0){return db[_0x366d('0x52')][_0x366d('0x4b')]({'name':_0x18e206[_0x366d('0x31')],'resourceId':_0x18e206['id'],'type':_0x3b92a8[_0x366d('0x31')],'sectionId':_0x3b92a8['id']},{})[_0x366d('0x27')](function(){return _0x18f82a;});}else{return _0x18f82a;}})[_0x366d('0x4a')](function(_0x39d546){logger['error'](_0x366d('0x53'),_0x39d546);throw _0x39d546;});}return _0x18f82a;})[_0x366d('0x27')](respondWithResult(_0x68ba99,0xc9))['catch'](handleError(_0x68ba99,null));};exports[_0x366d('0x54')]=function(_0x207afe,_0x5d02a0){var _0x3c1a44={'where':{'id':_0x207afe['params']['id']}},_0x129654={};_0x129654[_0x366d('0x30')]=_[_0x366d('0x32')](db[_0x366d('0x43')][_0x366d('0x2d')]);_0x3c1a44['attributes']=_[_0x366d('0x35')](_0x129654['model'],qs[_0x366d('0x36')](_0x207afe[_0x366d('0x33')]['fields']));_0x3c1a44[_0x366d('0x37')]=_0x3c1a44['attributes'][_0x366d('0x38')]?_0x3c1a44[_0x366d('0x37')]:_0x129654[_0x366d('0x30')];if(_0x207afe['query'][_0x366d('0x44')]){_0x3c1a44[_0x366d('0x45')]=[{'all':!![]}];}_0x3c1a44=_[_0x366d('0x3f')]({},_0x3c1a44,_0x207afe[_0x366d('0x42')]);return db['Campaign'][_0x366d('0x49')](_0x3c1a44)[_0x366d('0x27')](handleEntityNotFound(_0x5d02a0,null))[_0x366d('0x27')](function(_0x11b3ef){if(_0x11b3ef){var _0x340705=_0x11b3ef[_0x366d('0x25')]({'plain':!![]});_0x340705=qs[_0x366d('0x55')](_0x340705,['id',_0x366d('0x56'),_0x366d('0x57')]);_0x207afe[_0x366d('0x4c')]=_['omit'](_0x207afe[_0x366d('0x4c')],['id',_0x366d('0x56'),_0x366d('0x57')]);return db[_0x366d('0x43')][_0x366d('0x4b')](_[_0x366d('0x3f')](_0x340705,_0x207afe[_0x366d('0x4c')]),{'include':_0x207afe['query'][_0x366d('0x44')]?[{'all':!![]}]:undefined})[_0x366d('0x27')](function(_0x1da9a1){var _0x3505d7=_0x207afe[_0x366d('0x4d')][_0x366d('0x25')]({'plain':!![]});if(!_0x3505d7)throw new Error(_0x366d('0x58'));if(_0x3505d7[_0x366d('0x4e')]===_0x366d('0x4d')){var _0x4e36ba=_0x1da9a1[_0x366d('0x25')]({'plain':!![]});var _0x398f15='IvrCampaigns';return db[_0x366d('0x4f')][_0x366d('0x49')]({'where':{'name':_0x398f15,'userProfileId':_0x3505d7[_0x366d('0x50')]},'raw':!![]})[_0x366d('0x27')](function(_0x2ac178){if(_0x2ac178&&_0x2ac178[_0x366d('0x51')]===0x0){return db[_0x366d('0x52')][_0x366d('0x4b')]({'name':_0x4e36ba[_0x366d('0x31')],'resourceId':_0x4e36ba['id'],'type':_0x2ac178[_0x366d('0x31')],'sectionId':_0x2ac178['id']},{})['then'](function(){return _0x1da9a1;});}else{return _0x1da9a1;}})[_0x366d('0x4a')](function(_0x55f363){logger[_0x366d('0x28')](_0x366d('0x53'),_0x55f363);throw _0x55f363;});}return _0x1da9a1;});}})['then'](respondWithResult(_0x5d02a0,0xc9))[_0x366d('0x4a')](handleError(_0x5d02a0,null));};exports[_0x366d('0x23')]=function(_0x278ca2,_0x3acf63){if(_0x278ca2['body']['id']){delete _0x278ca2[_0x366d('0x4c')]['id'];}return db[_0x366d('0x43')][_0x366d('0x49')]({'where':{'id':_0x278ca2[_0x366d('0x59')]['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x3acf63,null))['then'](saveUpdates(_0x278ca2[_0x366d('0x4c')],null))[_0x366d('0x27')](respondWithResult(_0x3acf63,null))[_0x366d('0x4a')](handleError(_0x3acf63,null));};exports[_0x366d('0x24')]=function(_0x32f95e,_0x363861){return db[_0x366d('0x43')][_0x366d('0x49')]({'where':{'id':_0x32f95e[_0x366d('0x59')]['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x363861,null))[_0x366d('0x27')](removeEntity(_0x363861,null))['catch'](handleError(_0x363861,null));};exports[_0x366d('0x5a')]=function(_0x3fa363,_0x3122f2,_0x559df7){var _0x4e932b={'raw':!![],'where':{}};var _0x3c0a7f={};var _0x15d796={'count':0x0,'rows':[]};return db[_0x366d('0x43')][_0x366d('0x5b')]({'where':{'id':_0x3fa363[_0x366d('0x59')]['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x3122f2,null))[_0x366d('0x27')](function(_0x49944d){if(_0x49944d){_0x3c0a7f[_0x366d('0x30')]=_['keys'](db[_0x366d('0x5c')][_0x366d('0x2d')]);_0x3c0a7f[_0x366d('0x33')]=_[_0x366d('0x32')](_0x3fa363['query']);_0x3c0a7f['filters']=_[_0x366d('0x35')](_0x3c0a7f[_0x366d('0x30')],_0x3c0a7f[_0x366d('0x33')]);_0x4e932b[_0x366d('0x37')]=_['intersection'](_0x3c0a7f[_0x366d('0x30')],qs[_0x366d('0x36')](_0x3fa363[_0x366d('0x33')][_0x366d('0x36')]));_0x4e932b[_0x366d('0x37')]=_0x4e932b['attributes'][_0x366d('0x38')]?_0x4e932b[_0x366d('0x37')]:_0x3c0a7f[_0x366d('0x30')];if(!_0x3fa363['query'][_0x366d('0x39')](_0x366d('0x3a'))){_0x4e932b[_0x366d('0x1d')]=qs['limit'](_0x3fa363[_0x366d('0x33')][_0x366d('0x1d')]);_0x4e932b['offset']=qs[_0x366d('0x1c')](_0x3fa363[_0x366d('0x33')][_0x366d('0x1c')]);}_0x4e932b[_0x366d('0x3b')]=qs[_0x366d('0x3c')](_0x3fa363[_0x366d('0x33')][_0x366d('0x3c')]);_0x4e932b[_0x366d('0x3d')]=qs[_0x366d('0x34')](_['pick'](_0x3fa363[_0x366d('0x33')],_0x3c0a7f[_0x366d('0x34')]));_0x4e932b[_0x366d('0x3d')]['CampaignId']=_0x49944d['id'];if(_0x3fa363[_0x366d('0x33')][_0x366d('0x41')]){_0x4e932b[_0x366d('0x3d')]=_[_0x366d('0x3f')](_0x4e932b[_0x366d('0x3d')],{'$or':_[_0x366d('0x2c')](_0x4e932b[_0x366d('0x37')],function(_0x358543){var _0xb01d1a={};_0xb01d1a[_0x358543]={'$like':'%'+_0x3fa363[_0x366d('0x33')]['filter']+'%'};return _0xb01d1a;})});}_0x4e932b=_['merge']({},_0x4e932b,_0x3fa363['options']);return db[_0x366d('0x5c')][_0x366d('0x1e')]({'where':_0x4e932b[_0x366d('0x3d')]})[_0x366d('0x27')](function(_0x97595f){_0x15d796[_0x366d('0x1e')]=_0x97595f;if(_0x3fa363[_0x366d('0x33')][_0x366d('0x44')]){_0x4e932b[_0x366d('0x45')]=[{'all':!![]}];}return db[_0x366d('0x5c')][_0x366d('0x46')](_0x4e932b);})[_0x366d('0x27')](function(_0x398b7f){_0x15d796[_0x366d('0x47')]=_0x398b7f;return _0x15d796;});}})[_0x366d('0x27')](respondWithFilteredResult(_0x3122f2,_0x4e932b))[_0x366d('0x4a')](handleError(_0x3122f2,null));};exports[_0x366d('0x5d')]=function(_0x8e991d,_0x171647,_0x356ae5){var _0x1defa8={'raw':!![],'where':{}};var _0x48c84f={};var _0x190a73={'count':0x0,'rows':[]};return db[_0x366d('0x43')]['findOne']({'where':{'id':_0x8e991d[_0x366d('0x59')]['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x171647,null))[_0x366d('0x27')](function(_0x3dba73){if(_0x3dba73){_0x48c84f['model']=_[_0x366d('0x32')](db[_0x366d('0x5e')]['rawAttributes']);_0x48c84f[_0x366d('0x33')]=_[_0x366d('0x32')](_0x8e991d[_0x366d('0x33')]);_0x48c84f[_0x366d('0x34')]=_[_0x366d('0x35')](_0x48c84f[_0x366d('0x30')],_0x48c84f[_0x366d('0x33')]);_0x1defa8[_0x366d('0x37')]=_[_0x366d('0x35')](_0x48c84f[_0x366d('0x30')],qs[_0x366d('0x36')](_0x8e991d['query']['fields']));_0x1defa8[_0x366d('0x37')]=_0x1defa8['attributes'][_0x366d('0x38')]?_0x1defa8[_0x366d('0x37')]:_0x48c84f['model'];if(!_0x8e991d[_0x366d('0x33')][_0x366d('0x39')](_0x366d('0x3a'))){_0x1defa8['limit']=qs[_0x366d('0x1d')](_0x8e991d[_0x366d('0x33')][_0x366d('0x1d')]);_0x1defa8[_0x366d('0x1c')]=qs[_0x366d('0x1c')](_0x8e991d[_0x366d('0x33')][_0x366d('0x1c')]);}_0x1defa8[_0x366d('0x3b')]=qs[_0x366d('0x3c')](_0x8e991d[_0x366d('0x33')][_0x366d('0x3c')]);_0x1defa8['where']=qs[_0x366d('0x34')](_[_0x366d('0x3e')](_0x8e991d[_0x366d('0x33')],_0x48c84f[_0x366d('0x34')]));_0x1defa8[_0x366d('0x3d')][_0x366d('0x5f')]=_0x3dba73['id'];if(_0x8e991d[_0x366d('0x33')][_0x366d('0x41')]){_0x1defa8['where']=_[_0x366d('0x3f')](_0x1defa8[_0x366d('0x3d')],{'$or':_[_0x366d('0x2c')](_0x1defa8[_0x366d('0x37')],function(_0x19bafd){var _0x52e563={};_0x52e563[_0x19bafd]={'$like':'%'+_0x8e991d['query'][_0x366d('0x41')]+'%'};return _0x52e563;})});}_0x1defa8=_[_0x366d('0x3f')]({},_0x1defa8,_0x8e991d[_0x366d('0x42')]);return db['CmHopperHistory'][_0x366d('0x1e')]({'where':_0x1defa8[_0x366d('0x3d')]})['then'](function(_0x4b9986){_0x190a73['count']=_0x4b9986;if(_0x8e991d[_0x366d('0x33')][_0x366d('0x44')]){_0x1defa8[_0x366d('0x45')]=[{'all':!![]}];}return db[_0x366d('0x5e')][_0x366d('0x46')](_0x1defa8);})[_0x366d('0x27')](function(_0x1cec0c){_0x190a73['rows']=_0x1cec0c;return _0x190a73;});}})[_0x366d('0x27')](respondWithFilteredResult(_0x171647,_0x1defa8))[_0x366d('0x4a')](handleError(_0x171647,null));};exports[_0x366d('0x60')]=function(_0x4e19d5,_0x425124,_0x590aef){var _0x4f1b7b={'raw':!![],'where':{}};var _0x389543={};var _0x3d7962={'count':0x0,'rows':[]};return db[_0x366d('0x43')]['findOne']({'where':{'id':_0x4e19d5['params']['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x425124,null))['then'](function(_0x4563a0){if(_0x4563a0){_0x389543[_0x366d('0x30')]=_['keys'](db[_0x366d('0x61')][_0x366d('0x2d')]);_0x389543[_0x366d('0x33')]=_[_0x366d('0x32')](_0x4e19d5[_0x366d('0x33')]);_0x389543[_0x366d('0x34')]=_[_0x366d('0x35')](_0x389543[_0x366d('0x30')],_0x389543['query']);_0x4f1b7b[_0x366d('0x37')]=_[_0x366d('0x35')](_0x389543[_0x366d('0x30')],qs[_0x366d('0x36')](_0x4e19d5['query'][_0x366d('0x36')]));_0x4f1b7b[_0x366d('0x37')]=_0x4f1b7b[_0x366d('0x37')][_0x366d('0x38')]?_0x4f1b7b['attributes']:_0x389543[_0x366d('0x30')];if(!_0x4e19d5[_0x366d('0x33')][_0x366d('0x39')](_0x366d('0x3a'))){_0x4f1b7b[_0x366d('0x1d')]=qs['limit'](_0x4e19d5[_0x366d('0x33')][_0x366d('0x1d')]);_0x4f1b7b[_0x366d('0x1c')]=qs[_0x366d('0x1c')](_0x4e19d5[_0x366d('0x33')][_0x366d('0x1c')]);}_0x4f1b7b[_0x366d('0x3b')]=qs[_0x366d('0x3c')](_0x4e19d5[_0x366d('0x33')][_0x366d('0x3c')]);_0x4f1b7b[_0x366d('0x3d')]=qs[_0x366d('0x34')](_[_0x366d('0x3e')](_0x4e19d5[_0x366d('0x33')],_0x389543[_0x366d('0x34')]));_0x4f1b7b[_0x366d('0x3d')][_0x366d('0x5f')]=_0x4563a0['id'];if(_0x4e19d5[_0x366d('0x33')][_0x366d('0x41')]){_0x4f1b7b[_0x366d('0x3d')]=_[_0x366d('0x3f')](_0x4f1b7b['where'],{'$or':_['map'](_0x4f1b7b[_0x366d('0x37')],function(_0x505066){var _0xb86ee9={};_0xb86ee9[_0x505066]={'$like':'%'+_0x4e19d5[_0x366d('0x33')][_0x366d('0x41')]+'%'};return _0xb86ee9;})});}_0x4f1b7b=_[_0x366d('0x3f')]({},_0x4f1b7b,_0x4e19d5['options']);return db[_0x366d('0x61')][_0x366d('0x1e')]({'where':_0x4f1b7b[_0x366d('0x3d')]})[_0x366d('0x27')](function(_0x341cc8){_0x3d7962['count']=_0x341cc8;if(_0x4e19d5[_0x366d('0x33')][_0x366d('0x44')]){_0x4f1b7b[_0x366d('0x45')]=[{'all':!![]}];}return db[_0x366d('0x61')][_0x366d('0x46')](_0x4f1b7b);})[_0x366d('0x27')](function(_0x3aec2a){_0x3d7962['rows']=_0x3aec2a;return _0x3d7962;});}})[_0x366d('0x27')](respondWithFilteredResult(_0x425124,_0x4f1b7b))[_0x366d('0x4a')](handleError(_0x425124,null));};exports[_0x366d('0x62')]=function(_0x2e8973,_0xe0010d,_0x3efcae){var _0x19e5f8={'raw':!![],'where':{}};var _0x23e1bf={};var _0x293f51={'count':0x0,'rows':[]};return db[_0x366d('0x43')][_0x366d('0x5b')]({'where':{'id':_0x2e8973[_0x366d('0x59')]['id']}})[_0x366d('0x27')](handleEntityNotFound(_0xe0010d,null))['then'](function(_0x3f3ff8){if(_0x3f3ff8){_0x23e1bf['model']=_['keys'](db[_0x366d('0x63')]['rawAttributes']);_0x23e1bf['query']=_[_0x366d('0x32')](_0x2e8973[_0x366d('0x33')]);_0x23e1bf[_0x366d('0x34')]=_[_0x366d('0x35')](_0x23e1bf[_0x366d('0x30')],_0x23e1bf['query']);_0x19e5f8[_0x366d('0x37')]=_['intersection'](_0x23e1bf['model'],qs[_0x366d('0x36')](_0x2e8973[_0x366d('0x33')][_0x366d('0x36')]));_0x19e5f8[_0x366d('0x37')]=_0x19e5f8['attributes'][_0x366d('0x38')]?_0x19e5f8[_0x366d('0x37')]:_0x23e1bf[_0x366d('0x30')];if(!_0x2e8973[_0x366d('0x33')][_0x366d('0x39')](_0x366d('0x3a'))){_0x19e5f8[_0x366d('0x1d')]=qs[_0x366d('0x1d')](_0x2e8973[_0x366d('0x33')][_0x366d('0x1d')]);_0x19e5f8['offset']=qs[_0x366d('0x1c')](_0x2e8973[_0x366d('0x33')]['offset']);}_0x19e5f8['order']=qs[_0x366d('0x3c')](_0x2e8973[_0x366d('0x33')][_0x366d('0x3c')]);_0x19e5f8[_0x366d('0x3d')]=qs[_0x366d('0x34')](_[_0x366d('0x3e')](_0x2e8973[_0x366d('0x33')],_0x23e1bf[_0x366d('0x34')]));_0x19e5f8[_0x366d('0x3d')][_0x366d('0x5f')]=_0x3f3ff8['id'];if(_0x2e8973['query'][_0x366d('0x41')]){_0x19e5f8[_0x366d('0x3d')]=_[_0x366d('0x3f')](_0x19e5f8[_0x366d('0x3d')],{'$or':_[_0x366d('0x2c')](_0x19e5f8[_0x366d('0x37')],function(_0x3980a1){var _0x143ca1={};_0x143ca1[_0x3980a1]={'$like':'%'+_0x2e8973[_0x366d('0x33')][_0x366d('0x41')]+'%'};return _0x143ca1;})});}_0x19e5f8=_[_0x366d('0x3f')]({},_0x19e5f8,_0x2e8973[_0x366d('0x42')]);return db[_0x366d('0x63')][_0x366d('0x1e')]({'where':_0x19e5f8[_0x366d('0x3d')]})[_0x366d('0x27')](function(_0x1bbf92){_0x293f51[_0x366d('0x1e')]=_0x1bbf92;if(_0x2e8973['query'][_0x366d('0x44')]){_0x19e5f8[_0x366d('0x45')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x19e5f8);})[_0x366d('0x27')](function(_0xa423d8){_0x293f51[_0x366d('0x47')]=_0xa423d8;return _0x293f51;});}})[_0x366d('0x27')](respondWithFilteredResult(_0xe0010d,_0x19e5f8))[_0x366d('0x4a')](handleError(_0xe0010d,null));};exports['getLists']=function(_0x216d7e,_0x10686e,_0x5098b4){var _0x3ab5ac={};var _0x1e2b6d={};var _0xe79563;var _0x3eee42;return db[_0x366d('0x43')][_0x366d('0x5b')]({'where':{'id':_0x216d7e[_0x366d('0x59')]['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x10686e,null))[_0x366d('0x27')](function(_0x252551){if(_0x252551){_0xe79563=_0x252551;_0x1e2b6d[_0x366d('0x30')]=_[_0x366d('0x32')](db[_0x366d('0x64')][_0x366d('0x2d')]);_0x1e2b6d['query']=_['keys'](_0x216d7e['query']);_0x1e2b6d[_0x366d('0x34')]=_['intersection'](_0x1e2b6d[_0x366d('0x30')],_0x1e2b6d[_0x366d('0x33')]);_0x3ab5ac[_0x366d('0x37')]=_[_0x366d('0x35')](_0x1e2b6d[_0x366d('0x30')],qs[_0x366d('0x36')](_0x216d7e[_0x366d('0x33')][_0x366d('0x36')]));_0x3ab5ac[_0x366d('0x37')]=_0x3ab5ac[_0x366d('0x37')][_0x366d('0x38')]?_0x3ab5ac[_0x366d('0x37')]:_0x1e2b6d[_0x366d('0x30')];_0x3ab5ac[_0x366d('0x3b')]=qs[_0x366d('0x3c')](_0x216d7e['query'][_0x366d('0x3c')]);_0x3ab5ac[_0x366d('0x3d')]=qs[_0x366d('0x34')](_[_0x366d('0x3e')](_0x216d7e[_0x366d('0x33')],_0x1e2b6d[_0x366d('0x34')]));if(_0x216d7e[_0x366d('0x33')][_0x366d('0x41')]){_0x3ab5ac[_0x366d('0x3d')]=_[_0x366d('0x3f')](_0x3ab5ac['where'],{'$or':_[_0x366d('0x2c')](_0x3ab5ac[_0x366d('0x37')],function(_0x393904){var _0x58f559={};_0x58f559[_0x393904]={'$like':'%'+_0x216d7e[_0x366d('0x33')][_0x366d('0x41')]+'%'};return _0x58f559;})});}_0x3ab5ac=_[_0x366d('0x3f')]({},_0x3ab5ac,_0x216d7e[_0x366d('0x42')]);return _0xe79563[_0x366d('0x65')](_0x3ab5ac);}})[_0x366d('0x27')](function(_0x20e6d0){if(_0x20e6d0){_0x3eee42=_0x20e6d0[_0x366d('0x38')];if(!_0x216d7e[_0x366d('0x33')]['hasOwnProperty'](_0x366d('0x3a'))){_0x3ab5ac['limit']=qs['limit'](_0x216d7e[_0x366d('0x33')][_0x366d('0x1d')]);_0x3ab5ac[_0x366d('0x1c')]=qs[_0x366d('0x1c')](_0x216d7e[_0x366d('0x33')][_0x366d('0x1c')]);}return _0xe79563[_0x366d('0x65')](_0x3ab5ac);}})[_0x366d('0x27')](function(_0x1165d6){if(_0x1165d6){return _0x1165d6?{'count':_0x3eee42,'rows':_0x1165d6}:null;}})[_0x366d('0x27')](respondWithResult(_0x10686e,null))[_0x366d('0x4a')](handleError(_0x10686e,null));};exports[_0x366d('0x66')]=function(_0x247747,_0xa127fc,_0x5016d3){var _0x1ea00e,_0x4d30dc;var _0x44ae83=[];var _0x5e7576=moment()['format'](_0x366d('0x67'));return db[_0x366d('0x43')][_0x366d('0x49')]({'where':{'id':_0x247747['params']['id']}})['then'](handleEntityNotFound(_0xa127fc,null))['then'](function(_0x2a3f9e){if(_0x2a3f9e){_0x4d30dc=_0x2a3f9e;return _0x2a3f9e[_0x366d('0x66')](_0x247747[_0x366d('0x4c')][_0x366d('0x68')],_[_0x366d('0x55')](_0x247747[_0x366d('0x4c')],['ids','id'])||{});}return null;})[_0x366d('0x69')](function(_0x3074d5){var _0xb7f9b2;var _0x30bbd2;_0x1ea00e=_0x3074d5||[];var _0xf87baa=[];if(_0x3074d5){for(var _0x11da0f=0x0;_0x11da0f<_0x3074d5['length'];_0x11da0f+=0x1){var _0x198056=_0x3074d5[_0x11da0f][_0x366d('0x25')]({'plain':!![]});_0x4d30dc[_0x366d('0x6a')]=_0x247747['body'][_0x366d('0x6a')]?_0x247747[_0x366d('0x4c')][_0x366d('0x6a')]:_0x4d30dc['dialCheckDuplicateType'];switch(_0x4d30dc[_0x366d('0x6a')]){case'always':_0xb7f9b2=squel[_0x366d('0x6b')]()['into']('cm_hopper')['fromQuery']([_0x366d('0x6c'),_0x366d('0x6d'),'ContactId',_0x366d('0x6e'),_0x366d('0x5f'),'createdAt','updatedAt'],squel[_0x366d('0x6f')]()[_0x366d('0x70')](_0x366d('0x6c'),'phone')[_0x366d('0x70')](_0x366d('0x71'),'scheduledAt')[_0x366d('0x70')]('id',_0x366d('0x72'))[_0x366d('0x70')](_0x198056[_0x366d('0x73')][_0x366d('0x74')](),_0x366d('0x6e'))[_0x366d('0x70')](_0x247747[_0x366d('0x59')]['id'][_0x366d('0x74')](),_0x366d('0x5f'))[_0x366d('0x70')]('\x27'+_0x5e7576+'\x27',_0x366d('0x56'))[_0x366d('0x70')]('\x27'+_0x5e7576+'\x27',_0x366d('0x57'))[_0x366d('0x75')](_0x366d('0x76'))[_0x366d('0x3d')](_0x366d('0x77'))[_0x366d('0x3d')](_0x366d('0x78'),_0x198056[_0x366d('0x73')][_0x366d('0x74')]())[_0x366d('0x3d')](_0x366d('0x79'))[_0x366d('0x3d')](_0x366d('0x7a'),squel['select']()['field'](_0x366d('0x7b'))[_0x366d('0x75')](_0x366d('0x7c'))[_0x366d('0x3d')](_0x366d('0x7d'),_0x247747[_0x366d('0x59')]['id'][_0x366d('0x74')]()))[_0x366d('0x3d')](_0x366d('0x7a'),squel[_0x366d('0x6f')]()[_0x366d('0x70')](_0x366d('0x7e'))['from'](_0x366d('0x7f'))['where'](_0x366d('0x7d'),_0x247747['params']['id'][_0x366d('0x74')]())))[_0x366d('0x74')]();break;case _0x366d('0x80'):_0xb7f9b2=squel[_0x366d('0x6b')]()[_0x366d('0x81')](_0x366d('0x7f'))[_0x366d('0x82')]([_0x366d('0x6c'),_0x366d('0x6d'),_0x366d('0x72'),_0x366d('0x6e'),'CampaignId','createdAt','updatedAt'],squel[_0x366d('0x6f')]()[_0x366d('0x70')]('phone',_0x366d('0x6c'))[_0x366d('0x70')]('NOW()',_0x366d('0x6d'))[_0x366d('0x70')]('id','ContactId')[_0x366d('0x70')](_0x198056['CmListId'][_0x366d('0x74')](),'ListId')[_0x366d('0x70')](_0x247747['params']['id'][_0x366d('0x74')](),_0x366d('0x5f'))['field']('\x27'+_0x5e7576+'\x27',_0x366d('0x56'))['field']('\x27'+_0x5e7576+'\x27',_0x366d('0x57'))['from'](_0x366d('0x76'))['where'](_0x366d('0x77'))[_0x366d('0x3d')](_0x366d('0x78'),_0x198056['CmListId'][_0x366d('0x74')]())[_0x366d('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x366d('0x3d')](_0x366d('0x7a'),squel['select']()[_0x366d('0x70')](_0x366d('0x7e'))[_0x366d('0x75')](_0x366d('0x7f'))[_0x366d('0x3d')](_0x366d('0x7d'),_0x247747[_0x366d('0x59')]['id']['toString']())))[_0x366d('0x74')]();break;default:_0xb7f9b2=squel[_0x366d('0x6b')]()[_0x366d('0x81')]('cm_hopper')[_0x366d('0x82')]([_0x366d('0x6c'),_0x366d('0x6d'),_0x366d('0x72'),_0x366d('0x6e'),_0x366d('0x5f'),'createdAt',_0x366d('0x57')],squel[_0x366d('0x6f')]()[_0x366d('0x70')](_0x366d('0x6c'),'phone')[_0x366d('0x70')](_0x366d('0x71'),'scheduledAt')[_0x366d('0x70')]('id',_0x366d('0x72'))['field'](_0x198056['CmListId'][_0x366d('0x74')](),_0x366d('0x6e'))[_0x366d('0x70')](_0x247747[_0x366d('0x59')]['id'][_0x366d('0x74')](),'CampaignId')['field']('\x27'+_0x5e7576+'\x27',_0x366d('0x56'))[_0x366d('0x70')]('\x27'+_0x5e7576+'\x27',_0x366d('0x57'))[_0x366d('0x75')]('cm_contacts')[_0x366d('0x3d')](_0x366d('0x77'))[_0x366d('0x3d')](_0x366d('0x78'),_0x198056[_0x366d('0x73')][_0x366d('0x74')]())[_0x366d('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x366d('0x74')]();}_0x30bbd2=squel[_0x366d('0x6b')]()[_0x366d('0x81')](_0x366d('0x83'))[_0x366d('0x82')](['cmHopperId',_0x366d('0x6d'),_0x366d('0x6c'),'OrderBy',_0x366d('0x56'),_0x366d('0x57')],squel[_0x366d('0x6f')]()[_0x366d('0x70')]('h.id','id')[_0x366d('0x70')](_0x366d('0x71'),_0x366d('0x6d'))['field']('ci.item','phone')[_0x366d('0x70')](_0x366d('0x84'),_0x366d('0x85'))[_0x366d('0x70')]('\x27'+_0x5e7576+'\x27',_0x366d('0x56'))[_0x366d('0x70')]('\x27'+_0x5e7576+'\x27',_0x366d('0x57'))['from'](_0x366d('0x86'),'ci')['join'](_0x366d('0x7f'),'h',_0x366d('0x87'))[_0x366d('0x3d')](_0x366d('0x88'),_0x198056[_0x366d('0x73')][_0x366d('0x74')]())[_0x366d('0x3d')](_0x366d('0x89'),_0x247747[_0x366d('0x59')]['id'][_0x366d('0x74')]())[_0x366d('0x3d')](_0x366d('0x8a'),_0x5e7576))[_0x366d('0x74')]();_0xf87baa['push'](db[_0x366d('0x8b')][_0x366d('0x33')](_0xb7f9b2));_0x44ae83[_0x366d('0x8c')](db[_0x366d('0x8b')][_0x366d('0x33')](_0x30bbd2));}return BPromise['all'](_0xf87baa);}})[_0x366d('0x27')](function(){return BPromise[_0x366d('0x8d')](_0x44ae83);})['then'](function(){return _0x1ea00e;})[_0x366d('0x27')](respondWithResult(_0xa127fc,null))['catch'](handleError(_0xa127fc,null));};exports['removeLists']=function(_0x1b1c86,_0x5a20e1,_0x3ed328){return db[_0x366d('0x43')][_0x366d('0x49')]({'where':{'id':_0x1b1c86[_0x366d('0x59')]['id']}})['then'](handleEntityNotFound(_0x5a20e1,null))['then'](function(_0x511f96){if(_0x511f96){return _0x511f96[_0x366d('0x8e')](_0x1b1c86['query'][_0x366d('0x68')]);}})[_0x366d('0x27')](function(_0x24dfb7){if(_0x24dfb7){return db['CmHopper']['destroy']({'where':{'ListId':_0x1b1c86[_0x366d('0x33')][_0x366d('0x68')],'CampaignId':_0x1b1c86[_0x366d('0x59')]['id']}})[_0x366d('0x27')](function(){return _0x24dfb7;});}})[_0x366d('0x27')](respondWithStatusCode(_0x5a20e1,null))[_0x366d('0x4a')](handleError(_0x5a20e1,null));};exports[_0x366d('0x8f')]=function(_0x3681a1,_0x1978b6,_0x398dc8){var _0x5d75c4={};var _0x49d5cc={};var _0x57d8fc;var _0x27a519;return db[_0x366d('0x43')][_0x366d('0x5b')]({'where':{'id':_0x3681a1['params']['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x1978b6,null))[_0x366d('0x27')](function(_0x18bc04){if(_0x18bc04){_0x57d8fc=_0x18bc04;_0x49d5cc['model']=_[_0x366d('0x32')](db['CmList'][_0x366d('0x2d')]);_0x49d5cc[_0x366d('0x33')]=_[_0x366d('0x32')](_0x3681a1[_0x366d('0x33')]);_0x49d5cc[_0x366d('0x34')]=_['intersection'](_0x49d5cc['model'],_0x49d5cc[_0x366d('0x33')]);_0x5d75c4[_0x366d('0x37')]=_[_0x366d('0x35')](_0x49d5cc[_0x366d('0x30')],qs[_0x366d('0x36')](_0x3681a1[_0x366d('0x33')]['fields']));_0x5d75c4[_0x366d('0x37')]=_0x5d75c4[_0x366d('0x37')][_0x366d('0x38')]?_0x5d75c4[_0x366d('0x37')]:_0x49d5cc[_0x366d('0x30')];_0x5d75c4[_0x366d('0x3b')]=qs[_0x366d('0x3c')](_0x3681a1['query']['sort']);_0x5d75c4['where']=qs[_0x366d('0x34')](_['pick'](_0x3681a1[_0x366d('0x33')],_0x49d5cc['filters']));if(_0x3681a1[_0x366d('0x33')][_0x366d('0x41')]){_0x5d75c4[_0x366d('0x3d')]=_[_0x366d('0x3f')](_0x5d75c4[_0x366d('0x3d')],{'$or':_[_0x366d('0x2c')](_0x5d75c4[_0x366d('0x37')],function(_0x30df27){var _0x4d34d9={};_0x4d34d9[_0x30df27]={'$like':'%'+_0x3681a1[_0x366d('0x33')][_0x366d('0x41')]+'%'};return _0x4d34d9;})});}_0x5d75c4=_[_0x366d('0x3f')]({},_0x5d75c4,_0x3681a1['options']);return _0x57d8fc[_0x366d('0x8f')](_0x5d75c4);}})['then'](function(_0x319c30){if(_0x319c30){_0x27a519=_0x319c30[_0x366d('0x38')];if(!_0x3681a1['query'][_0x366d('0x39')](_0x366d('0x3a'))){_0x5d75c4['limit']=qs['limit'](_0x3681a1[_0x366d('0x33')][_0x366d('0x1d')]);_0x5d75c4[_0x366d('0x1c')]=qs[_0x366d('0x1c')](_0x3681a1[_0x366d('0x33')][_0x366d('0x1c')]);}return _0x57d8fc['getBlackLists'](_0x5d75c4);}})[_0x366d('0x27')](function(_0x64bcc6){if(_0x64bcc6){return _0x64bcc6?{'count':_0x27a519,'rows':_0x64bcc6}:null;}})[_0x366d('0x27')](respondWithResult(_0x1978b6,null))['catch'](handleError(_0x1978b6,null));};exports[_0x366d('0x90')]=function(_0x4b76c1,_0x396603,_0x2faacc){var _0x392576,_0x41a73d;var _0x206e35=[];var _0x1f450a=moment()[_0x366d('0x91')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x366d('0x43')][_0x366d('0x49')]({'where':{'id':_0x4b76c1[_0x366d('0x59')]['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x396603,null))['then'](function(_0x18bd29){if(_0x18bd29){_0x41a73d=_0x18bd29;return _0x18bd29['addBlackLists'](_0x4b76c1[_0x366d('0x4c')][_0x366d('0x68')],_[_0x366d('0x55')](_0x4b76c1[_0x366d('0x4c')],[_0x366d('0x68'),'id'])||{});}return null;})['spread'](function(_0x4f4707){var _0x57f69f;var _0x4c0dc7;_0x392576=_0x4f4707||[];var _0x425447=[];if(_0x4f4707){for(var _0x23bddf=0x0;_0x23bddf<_0x4f4707[_0x366d('0x38')];_0x23bddf+=0x1){var _0x4e2d85=_0x4f4707[_0x23bddf][_0x366d('0x25')]({'plain':!![]});_0x57f69f=squel[_0x366d('0x6b')]()[_0x366d('0x81')](_0x366d('0x92'))[_0x366d('0x82')]([_0x366d('0x6c'),_0x366d('0x72'),_0x366d('0x6e'),_0x366d('0x5f'),_0x366d('0x56'),'updatedAt'],squel[_0x366d('0x6f')]()[_0x366d('0x70')](_0x366d('0x6c'),_0x366d('0x6c'))[_0x366d('0x70')]('id',_0x366d('0x72'))['field'](_0x4e2d85['CmListId'][_0x366d('0x74')](),_0x366d('0x6e'))['field'](_0x4b76c1[_0x366d('0x59')]['id'][_0x366d('0x74')](),_0x366d('0x5f'))[_0x366d('0x70')](_0x366d('0x71'),_0x366d('0x56'))[_0x366d('0x70')](_0x366d('0x71'),_0x366d('0x57'))[_0x366d('0x75')]('cm_contacts')['where'](_0x366d('0x77'))[_0x366d('0x3d')]('ListId\x20=\x20?',_0x4e2d85[_0x366d('0x73')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x366d('0x74')]();_0x425447[_0x366d('0x8c')](db[_0x366d('0x8b')][_0x366d('0x33')](_0x57f69f));}return BPromise[_0x366d('0x8d')](_0x425447);}})[_0x366d('0x27')](function(){return _0x392576;})[_0x366d('0x27')](respondWithResult(_0x396603,null))['catch'](handleError(_0x396603,null));};exports[_0x366d('0x93')]=function(_0x49b7e8,_0x279b98,_0x5aa334){return db['Campaign'][_0x366d('0x49')]({'where':{'id':_0x49b7e8[_0x366d('0x59')]['id']}})[_0x366d('0x27')](handleEntityNotFound(_0x279b98,null))[_0x366d('0x27')](function(_0x5ce27d){if(_0x5ce27d){return _0x5ce27d['removeBlackLists'](_0x49b7e8[_0x366d('0x33')][_0x366d('0x68')]);}})[_0x366d('0x27')](function(_0x349cfa){if(_0x349cfa){return db[_0x366d('0x63')][_0x366d('0x24')]({'where':{'ListId':_0x49b7e8[_0x366d('0x33')][_0x366d('0x68')],'CampaignId':_0x49b7e8[_0x366d('0x59')]['id']}})[_0x366d('0x27')](function(){return _0x349cfa;});}})[_0x366d('0x27')](respondWithStatusCode(_0x279b98,null))[_0x366d('0x4a')](handleError(_0x279b98,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 858891b..0bfde30 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 _0x7c97=['./campaign.attributes','exports','define','Campaign','campaigns','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3f19ff,_0x28033e){var _0x261c33=function(_0x11feac){while(--_0x11feac){_0x3f19ff['push'](_0x3f19ff['shift']());}};_0x261c33(++_0x28033e);}(_0x7c97,0x17e));var _0x77c9=function(_0x1328de,_0x3a1f2d){_0x1328de=_0x1328de-0x0;var _0x535a22=_0x7c97[_0x1328de];return _0x535a22;};'use strict';var _=require('lodash');var util=require(_0x77c9('0x0'));var logger=require(_0x77c9('0x1'))(_0x77c9('0x2'));var moment=require('moment');var BPromise=require(_0x77c9('0x3'));var rp=require(_0x77c9('0x4'));var fs=require('fs');var path=require(_0x77c9('0x5'));var rimraf=require(_0x77c9('0x6'));var config=require(_0x77c9('0x7'));var attributes=require(_0x77c9('0x8'));module[_0x77c9('0x9')]=function(_0xf0586,_0x3a93b5){return _0xf0586[_0x77c9('0xa')](_0x77c9('0xb'),attributes,{'tableName':_0x77c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa020=['moment','bluebird','path','rimraf','../../config/environment','exports','campaigns','lodash','util','../../config/logger','api'];(function(_0x102efb,_0x55f73b){var _0x445892=function(_0x20c108){while(--_0x20c108){_0x102efb['push'](_0x102efb['shift']());}};_0x445892(++_0x55f73b);}(_0xa020,0x80));var _0x0a02=function(_0x18964b,_0x1470a2){_0x18964b=_0x18964b-0x0;var _0x52aceb=_0xa020[_0x18964b];return _0x52aceb;};'use strict';var _=require(_0x0a02('0x0'));var util=require(_0x0a02('0x1'));var logger=require(_0x0a02('0x2'))(_0x0a02('0x3'));var moment=require(_0x0a02('0x4'));var BPromise=require(_0x0a02('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a02('0x6'));var rimraf=require(_0x0a02('0x7'));var config=require(_0x0a02('0x8'));var attributes=require('./campaign.attributes');module[_0x0a02('0x9')]=function(_0x64a323,_0x5474e9){return _0x64a323['define']('Campaign',attributes,{'tableName':_0x0a02('0xa'),'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 d38efa4..62c8927 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 _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(_0x5ec354,_0x4a0d56){var _0xbbaf7f=function(_0xf3f7aa){while(--_0xf3f7aa){_0x5ec354['push'](_0x5ec354['shift']());}};_0xbbaf7f(++_0x4a0d56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 +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(_0x35b5c4,_0xea8588){var _0x50551f=function(_0x59741a){while(--_0x59741a){_0x35b5c4['push'](_0x35b5c4['shift']());}};_0x50551f(++_0xea8588);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 9ac5ff5..b93bb96 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 _0xf410=['delete','destroy','removeLists','removeBlackLists','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','/:id/blacklists','addBlackLists','update'];(function(_0x45b9b3,_0x509426){var _0x313cff=function(_0xbff450){while(--_0xbff450){_0x45b9b3['push'](_0x45b9b3['shift']());}};_0x313cff(++_0x509426);}(_0xf410,0x8c));var _0x0f41=function(_0x2aa818,_0x53b9ce){_0x2aa818=_0x2aa818-0x0;var _0x284a5b=_0xf410[_0x2aa818];return _0x284a5b;};'use strict';var multer=require(_0x0f41('0x0'));var util=require(_0x0f41('0x1'));var path=require('path');var timeout=require(_0x0f41('0x2'));var express=require(_0x0f41('0x3'));var router=express['Router']();var fs_extra=require(_0x0f41('0x4'));var auth=require(_0x0f41('0x5'));var interaction=require(_0x0f41('0x6'));var config=require(_0x0f41('0x7'));var controller=require(_0x0f41('0x8'));router[_0x0f41('0x9')]('/',auth[_0x0f41('0xa')](),controller[_0x0f41('0xb')]);router[_0x0f41('0x9')](_0x0f41('0xc'),auth[_0x0f41('0xa')](),controller[_0x0f41('0xd')]);router['get'](_0x0f41('0xe'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x0f41('0x9')](_0x0f41('0xf'),auth[_0x0f41('0xa')](),controller[_0x0f41('0x10')]);router[_0x0f41('0x9')](_0x0f41('0x11'),auth[_0x0f41('0xa')](),controller['getHopperFinals']);router['get'](_0x0f41('0x12'),auth['isAuthenticated'](),controller[_0x0f41('0x13')]);router[_0x0f41('0x9')](_0x0f41('0x14'),auth[_0x0f41('0xa')](),controller[_0x0f41('0x15')]);router[_0x0f41('0x9')]('/:id/blacklists',auth[_0x0f41('0xa')](),controller[_0x0f41('0x16')]);router[_0x0f41('0x17')]('/',auth[_0x0f41('0xa')](),controller[_0x0f41('0x18')]);router['post'](_0x0f41('0x19'),auth['isAuthenticated'](),controller[_0x0f41('0x1a')]);router[_0x0f41('0x17')](_0x0f41('0x14'),auth[_0x0f41('0xa')](),controller['addLists']);router[_0x0f41('0x17')](_0x0f41('0x1b'),auth[_0x0f41('0xa')](),controller[_0x0f41('0x1c')]);router['put'](_0x0f41('0xc'),auth['isAuthenticated'](),controller[_0x0f41('0x1d')]);router[_0x0f41('0x1e')]('/:id',auth[_0x0f41('0xa')](),controller[_0x0f41('0x1f')]);router[_0x0f41('0x1e')](_0x0f41('0x14'),auth[_0x0f41('0xa')](),controller[_0x0f41('0x20')]);router[_0x0f41('0x1e')](_0x0f41('0x1b'),auth['isAuthenticated'](),controller[_0x0f41('0x21')]);module['exports']=router; \ No newline at end of file +var _0xb641=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id','show','getHoppers','getHopperHistories'];(function(_0x232965,_0x21fcfc){var _0x8567ab=function(_0x1640ee){while(--_0x1640ee){_0x232965['push'](_0x232965['shift']());}};_0x8567ab(++_0x21fcfc);}(_0xb641,0x116));var _0x1b64=function(_0x3d7e8e,_0x5a396a){_0x3d7e8e=_0x3d7e8e-0x0;var _0x22ae39=_0xb641[_0x3d7e8e];return _0x22ae39;};'use strict';var multer=require(_0x1b64('0x0'));var util=require(_0x1b64('0x1'));var path=require('path');var timeout=require(_0x1b64('0x2'));var express=require(_0x1b64('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b64('0x4'));var config=require('../../config/environment');var controller=require(_0x1b64('0x5'));router[_0x1b64('0x6')]('/',auth[_0x1b64('0x7')](),controller['index']);router[_0x1b64('0x6')](_0x1b64('0x8'),auth[_0x1b64('0x7')](),controller[_0x1b64('0x9')]);router['get']('/:id/hoppers',auth[_0x1b64('0x7')](),controller[_0x1b64('0xa')]);router['get']('/:id/hopper_histories',auth[_0x1b64('0x7')](),controller[_0x1b64('0xb')]);router[_0x1b64('0x6')]('/:id/hopper_finals',auth[_0x1b64('0x7')](),controller[_0x1b64('0xc')]);router['get'](_0x1b64('0xd'),auth['isAuthenticated'](),controller[_0x1b64('0xe')]);router['get'](_0x1b64('0xf'),auth['isAuthenticated'](),controller[_0x1b64('0x10')]);router[_0x1b64('0x6')](_0x1b64('0x11'),auth[_0x1b64('0x7')](),controller['getBlackLists']);router[_0x1b64('0x12')]('/',auth[_0x1b64('0x7')](),controller['create']);router[_0x1b64('0x12')](_0x1b64('0x13'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/lists',auth[_0x1b64('0x7')](),controller[_0x1b64('0x14')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x1b64('0x15')]);router[_0x1b64('0x16')](_0x1b64('0x8'),auth[_0x1b64('0x7')](),controller[_0x1b64('0x17')]);router[_0x1b64('0x18')](_0x1b64('0x8'),auth['isAuthenticated'](),controller[_0x1b64('0x19')]);router[_0x1b64('0x18')](_0x1b64('0xf'),auth[_0x1b64('0x7')](),controller[_0x1b64('0x1a')]);router[_0x1b64('0x18')](_0x1b64('0x11'),auth[_0x1b64('0x7')](),controller[_0x1b64('0x1b')]);module[_0x1b64('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3d770c4..4165bf7 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 _0xcff0=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xcff0,0x1dd));var _0x0cff=function(_0x21311f,_0x29dc32){_0x21311f=_0x21311f-0x0;var _0x5b0e1e=_0xcff0[_0x21311f];return _0x5b0e1e;};'use strict';var Sequelize=require(_0x0cff('0x0'));module['exports']={'key':{'type':Sequelize[_0x0cff('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x0cff('0x1')]},'name':{'type':Sequelize[_0x0cff('0x2')],'get':function(){return this[_0x0cff('0x3')]('key');}}}; \ No newline at end of file +var _0xf7a8=['sequelize','exports','STRING','TEXT','getDataValue','key'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xf7a8,0x1c2));var _0x8f7a=function(_0x431cd3,_0x64ef51){_0x431cd3=_0x431cd3-0x0;var _0x1d1851=_0xf7a8[_0x431cd3];return _0x1d1851;};'use strict';var Sequelize=require(_0x8f7a('0x0'));module[_0x8f7a('0x1')]={'key':{'type':Sequelize[_0x8f7a('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x8f7a('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8f7a('0x4')](_0x8f7a('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ab486b2..caf9c2a 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 _0x287f=['attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','options','CannedAnswer','includeAll','include','rows','catch','params','body','find','create','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','CannedAnswers','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query'];(function(_0x120b1e,_0x4d2bec){var _0x186859=function(_0xed22d){while(--_0xed22d){_0x120b1e['push'](_0x120b1e['shift']());}};_0x186859(++_0x4d2bec);}(_0x287f,0xc7));var _0xf287=function(_0xc0af27,_0x506cbb){_0xc0af27=_0xc0af27-0x0;var _0x2b224c=_0x287f[_0xc0af27];return _0x2b224c;};'use strict';var emlformat=require(_0xf287('0x0'));var rimraf=require(_0xf287('0x1'));var zipdir=require(_0xf287('0x2'));var jsonpatch=require(_0xf287('0x3'));var rp=require(_0xf287('0x4'));var moment=require(_0xf287('0x5'));var BPromise=require(_0xf287('0x6'));var Mustache=require(_0xf287('0x7'));var util=require('util');var path=require(_0xf287('0x8'));var sox=require(_0xf287('0x9'));var csv=require(_0xf287('0xa'));var ejs=require(_0xf287('0xb'));var fs=require('fs');var fs_extra=require(_0xf287('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf287('0xd'));var jsforce=require(_0xf287('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf287('0xf'));var authService=require(_0xf287('0x10'));var qs=require(_0xf287('0x11'));var as=require(_0xf287('0x12'));var hardwareService=require(_0xf287('0x13'));var logger=require(_0xf287('0x14'))(_0xf287('0x15'));var utils=require(_0xf287('0x16'));var config=require(_0xf287('0x17'));var licenseUtil=require(_0xf287('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57335b,_0x523a59){_0x523a59=_0x523a59||0xcc;return function(_0x5bd95d){if(_0x5bd95d){return _0x57335b[_0xf287('0x19')](_0x523a59);}return _0x57335b[_0xf287('0x1a')](_0x523a59)[_0xf287('0x1b')]();};}function respondWithResult(_0x1320ff,_0x46ad0e){_0x46ad0e=_0x46ad0e||0xc8;return function(_0x501c3f){if(_0x501c3f){return _0x1320ff[_0xf287('0x1a')](_0x46ad0e)['json'](_0x501c3f);}};}function respondWithFilteredResult(_0x14ac1d,_0x4292d3){return function(_0x3b52ee){if(_0x3b52ee){var _0x143769=typeof _0x4292d3['offset']===_0xf287('0x1c')&&typeof _0x4292d3['limit']===_0xf287('0x1c');var _0x1dc8e3=_0x3b52ee[_0xf287('0x1d')];var _0x144a8e=_0x143769?0x0:_0x4292d3[_0xf287('0x1e')];var _0x3e78e6=_0x143769?_0x3b52ee['count']:_0x4292d3[_0xf287('0x1e')]+_0x4292d3[_0xf287('0x1f')];var _0x34857e;if(_0x3e78e6>=_0x1dc8e3){_0x3e78e6=_0x1dc8e3;_0x34857e=0xc8;}else{_0x34857e=0xce;}_0x14ac1d['status'](_0x34857e);return _0x14ac1d[_0xf287('0x20')](_0xf287('0x21'),_0x144a8e+'-'+_0x3e78e6+'/'+_0x1dc8e3)[_0xf287('0x22')](_0x3b52ee);}return null;};}function patchUpdates(_0x3f844c){return function(_0x4879eb){try{jsonpatch[_0xf287('0x23')](_0x4879eb,_0x3f844c,!![]);}catch(_0x3e3289){return BPromise[_0xf287('0x24')](_0x3e3289);}return _0x4879eb[_0xf287('0x25')]();};}function saveUpdates(_0x3461cc,_0x20855f){return function(_0x77d199){if(_0x77d199){return _0x77d199[_0xf287('0x26')](_0x3461cc)[_0xf287('0x27')](function(_0xb360de){return _0xb360de;});}return null;};}function removeEntity(_0x3c9cfd,_0x3501d2){return function(_0x18ee11){if(_0x18ee11){return _0x18ee11['destroy']()[_0xf287('0x27')](function(){var _0x55fe79=_0x18ee11['get']({'plain':!![]});var _0x42b4d8=_0xf287('0x28');return db[_0xf287('0x29')]['destroy']({'where':{'type':_0x42b4d8,'resourceId':_0x55fe79['id']}})[_0xf287('0x27')](function(){return _0x18ee11;});})[_0xf287('0x27')](function(){_0x3c9cfd[_0xf287('0x1a')](0xcc)[_0xf287('0x1b')]();});}};}function handleEntityNotFound(_0x45af85,_0x590721){return function(_0x55e04d){if(!_0x55e04d){_0x45af85[_0xf287('0x19')](0x194);}return _0x55e04d;};}function handleError(_0x2cab99,_0x3b91b7){_0x3b91b7=_0x3b91b7||0x1f4;return function(_0x15ad7d){logger[_0xf287('0x2a')](_0x15ad7d[_0xf287('0x2b')]);if(_0x15ad7d['name']){delete _0x15ad7d[_0xf287('0x2c')];}_0x2cab99[_0xf287('0x1a')](_0x3b91b7)['send'](_0x15ad7d);};}exports[_0xf287('0x2d')]=function(_0x71e850,_0x211002){var _0x2c3d92={},_0x2ddff4={},_0x586c77={'count':0x0,'rows':[]};var _0x528052=_[_0xf287('0x2e')](db['CannedAnswer'][_0xf287('0x2f')],function(_0x5e3206){return{'name':_0x5e3206[_0xf287('0x30')],'type':_0x5e3206[_0xf287('0x31')][_0xf287('0x32')]};});_0x2ddff4['model']=_[_0xf287('0x2e')](_0x528052,_0xf287('0x2c'));_0x2ddff4['query']=_[_0xf287('0x33')](_0x71e850['query']);_0x2ddff4[_0xf287('0x34')]=_[_0xf287('0x35')](_0x2ddff4[_0xf287('0x36')],_0x2ddff4[_0xf287('0x37')]);_0x2c3d92[_0xf287('0x38')]=_[_0xf287('0x35')](_0x2ddff4[_0xf287('0x36')],qs['fields'](_0x71e850[_0xf287('0x37')][_0xf287('0x39')]));_0x2c3d92['attributes']=_0x2c3d92['attributes'][_0xf287('0x3a')]?_0x2c3d92['attributes']:_0x2ddff4[_0xf287('0x36')];if(!_0x71e850[_0xf287('0x37')][_0xf287('0x3b')]('nolimit')){_0x2c3d92[_0xf287('0x1f')]=qs['limit'](_0x71e850[_0xf287('0x37')][_0xf287('0x1f')]);_0x2c3d92[_0xf287('0x1e')]=qs[_0xf287('0x1e')](_0x71e850['query'][_0xf287('0x1e')]);}_0x2c3d92['order']=qs[_0xf287('0x3c')](_0x71e850[_0xf287('0x37')][_0xf287('0x3c')]);_0x2c3d92['where']=qs[_0xf287('0x34')](_[_0xf287('0x3d')](_0x71e850[_0xf287('0x37')],_0x2ddff4[_0xf287('0x34')]),_0x528052);if(_0x71e850['query'][_0xf287('0x3e')]){_0x2c3d92['where']=_[_0xf287('0x3f')](_0x2c3d92[_0xf287('0x40')],{'$or':[{'key':{'$like':'%'+_0x71e850['query'][_0xf287('0x3e')]+'%'}},{'value':{'$like':'%'+_0x71e850['query'][_0xf287('0x3e')]+'%'}}]});}_0x2c3d92=_['merge']({},_0x2c3d92,_0x71e850[_0xf287('0x41')]);var _0x35662d={'where':_0x2c3d92[_0xf287('0x40')]};return db[_0xf287('0x42')][_0xf287('0x1d')](_0x35662d)['then'](function(_0x4754b9){_0x586c77['count']=_0x4754b9;if(_0x71e850[_0xf287('0x37')][_0xf287('0x43')]){_0x2c3d92[_0xf287('0x44')]=[{'all':!![]}];}return db[_0xf287('0x42')]['findAll'](_0x2c3d92);})['then'](function(_0x1aafdc){_0x586c77[_0xf287('0x45')]=_0x1aafdc;return _0x586c77;})[_0xf287('0x27')](respondWithFilteredResult(_0x211002,_0x2c3d92))[_0xf287('0x46')](handleError(_0x211002,null));};exports['show']=function(_0x52e2cf,_0x3a1889){var _0x57441e={'raw':!![],'where':{'id':_0x52e2cf[_0xf287('0x47')]['id']}},_0x433952={};_0x433952[_0xf287('0x36')]=_[_0xf287('0x33')](db['CannedAnswer'][_0xf287('0x2f')]);_0x433952[_0xf287('0x37')]=_[_0xf287('0x33')](_0x52e2cf[_0xf287('0x37')]);_0x433952['filters']=_[_0xf287('0x35')](_0x433952[_0xf287('0x36')],_0x433952['query']);_0x57441e['attributes']=_['intersection'](_0x433952[_0xf287('0x36')],qs[_0xf287('0x39')](_0x52e2cf[_0xf287('0x37')][_0xf287('0x39')]));_0x57441e[_0xf287('0x38')]=_0x57441e['attributes'][_0xf287('0x3a')]?_0x57441e[_0xf287('0x38')]:_0x433952[_0xf287('0x36')];if(_0x52e2cf[_0xf287('0x37')][_0xf287('0x43')]){_0x57441e[_0xf287('0x44')]=[{'all':!![]}];}_0x57441e=_[_0xf287('0x3f')]({},_0x57441e,_0x52e2cf[_0xf287('0x41')]);return db[_0xf287('0x42')]['find'](_0x57441e)[_0xf287('0x27')](handleEntityNotFound(_0x3a1889,null))[_0xf287('0x27')](respondWithResult(_0x3a1889,null))['catch'](handleError(_0x3a1889,null));};exports['update']=function(_0x24cf7b,_0x445b75){if(_0x24cf7b[_0xf287('0x48')]['id']){delete _0x24cf7b['body']['id'];}return db[_0xf287('0x42')][_0xf287('0x49')]({'where':{'id':_0x24cf7b['params']['id']}})[_0xf287('0x27')](handleEntityNotFound(_0x445b75,null))[_0xf287('0x27')](saveUpdates(_0x24cf7b[_0xf287('0x48')],null))['then'](respondWithResult(_0x445b75,null))[_0xf287('0x46')](handleError(_0x445b75,null));};exports['destroy']=function(_0x3668e5,_0x2ad7c7){return db[_0xf287('0x42')][_0xf287('0x49')]({'where':{'id':_0x3668e5[_0xf287('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ad7c7,null))[_0xf287('0x27')](removeEntity(_0x2ad7c7,null))[_0xf287('0x46')](handleError(_0x2ad7c7,null));};exports[_0xf287('0x4a')]=function(_0x6837f0,_0x3f1df5){var _0x3593fa={'key':_0x6837f0['body'][_0xf287('0x32')]};if(_0x6837f0[_0xf287('0x48')]['MailAccountId']){_0x3593fa['MailAccountId']=_0x6837f0['body']['MailAccountId'];}else if(_0x6837f0[_0xf287('0x48')][_0xf287('0x4b')]){_0x3593fa[_0xf287('0x4b')]=_0x6837f0[_0xf287('0x48')][_0xf287('0x4b')];}else if(_0x6837f0['body'][_0xf287('0x4c')]){_0x3593fa[_0xf287('0x4c')]=_0x6837f0[_0xf287('0x48')][_0xf287('0x4c')];}else if(_0x6837f0[_0xf287('0x48')][_0xf287('0x4d')]){_0x3593fa[_0xf287('0x4d')]=_0x6837f0[_0xf287('0x48')][_0xf287('0x4d')];}return db[_0xf287('0x42')]['find']({'where':_0x3593fa})['then'](function(_0x580bc3){if(_0x580bc3){throw new db['Sequelize'][(_0xf287('0x4e'))](_0xf287('0x4f'));}return db[_0xf287('0x42')][_0xf287('0x4a')](_0x6837f0['body']);})[_0xf287('0x27')](function(_0x51eaa7){var _0x49724b=_0x6837f0[_0xf287('0x50')]['get']({'plain':!![]});if(!_0x49724b)throw new Error(_0xf287('0x51'));if(_0x49724b['role']===_0xf287('0x50')){var _0xd25a12=_0x51eaa7[_0xf287('0x52')]({'plain':!![]});return db[_0xf287('0x53')][_0xf287('0x49')]({'where':{'name':_0xf287('0x28'),'userProfileId':_0x49724b['userProfileId']},'raw':!![]})['then'](function(_0x5a3b7d){if(_0x5a3b7d&&_0x5a3b7d[_0xf287('0x54')]===0x0){return db[_0xf287('0x29')]['create']({'name':_0xd25a12['name'],'resourceId':_0xd25a12['id'],'type':_0x5a3b7d['name'],'sectionId':_0x5a3b7d['id']},{})[_0xf287('0x27')](function(){return _0x51eaa7;});}else{return _0x51eaa7;}})[_0xf287('0x46')](function(_0x142e60){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x142e60);throw _0x142e60;});}return _0x51eaa7;})[_0xf287('0x27')](respondWithResult(_0x3f1df5,0xc9))['catch'](handleError(_0x3f1df5,null));}; \ No newline at end of file +var _0x8ae2=['find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','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','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x25bd47,_0x463f2a){var _0x636690=function(_0x11c096){while(--_0x11c096){_0x25bd47['push'](_0x25bd47['shift']());}};_0x636690(++_0x463f2a);}(_0x8ae2,0x121));var _0x28ae=function(_0x50bb58,_0xd8849e){_0x50bb58=_0x50bb58-0x0;var _0x34798c=_0x8ae2[_0x50bb58];return _0x34798c;};'use strict';var emlformat=require(_0x28ae('0x0'));var rimraf=require(_0x28ae('0x1'));var zipdir=require(_0x28ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28ae('0x3'));var moment=require('moment');var BPromise=require(_0x28ae('0x4'));var Mustache=require(_0x28ae('0x5'));var util=require(_0x28ae('0x6'));var path=require(_0x28ae('0x7'));var sox=require(_0x28ae('0x8'));var csv=require(_0x28ae('0x9'));var ejs=require(_0x28ae('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28ae('0xb'));var squel=require(_0x28ae('0xc'));var crypto=require(_0x28ae('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x28ae('0xe'));var toCsv=require(_0x28ae('0x9'));var querystring=require(_0x28ae('0xf'));var Papa=require(_0x28ae('0x10'));var Redis=require(_0x28ae('0x11'));var authService=require(_0x28ae('0x12'));var qs=require(_0x28ae('0x13'));var as=require(_0x28ae('0x14'));var hardwareService=require(_0x28ae('0x15'));var logger=require(_0x28ae('0x16'))(_0x28ae('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x28ae('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c29f7,_0x135676){_0x135676=_0x135676||0xcc;return function(_0x2b7a6a){if(_0x2b7a6a){return _0x2c29f7[_0x28ae('0x19')](_0x135676);}return _0x2c29f7['status'](_0x135676)[_0x28ae('0x1a')]();};}function respondWithResult(_0x3acb99,_0x2ace5e){_0x2ace5e=_0x2ace5e||0xc8;return function(_0x46ad23){if(_0x46ad23){return _0x3acb99[_0x28ae('0x1b')](_0x2ace5e)[_0x28ae('0x1c')](_0x46ad23);}};}function respondWithFilteredResult(_0x1425c4,_0x3c7788){return function(_0x3871e7){if(_0x3871e7){var _0x5d4f9b=typeof _0x3c7788['offset']===_0x28ae('0x1d')&&typeof _0x3c7788[_0x28ae('0x1e')]===_0x28ae('0x1d');var _0x40ed17=_0x3871e7[_0x28ae('0x1f')];var _0x5e6927=_0x5d4f9b?0x0:_0x3c7788[_0x28ae('0x20')];var _0x43e0d1=_0x5d4f9b?_0x3871e7[_0x28ae('0x1f')]:_0x3c7788[_0x28ae('0x20')]+_0x3c7788[_0x28ae('0x1e')];var _0x23e690;if(_0x43e0d1>=_0x40ed17){_0x43e0d1=_0x40ed17;_0x23e690=0xc8;}else{_0x23e690=0xce;}_0x1425c4['status'](_0x23e690);return _0x1425c4[_0x28ae('0x21')](_0x28ae('0x22'),_0x5e6927+'-'+_0x43e0d1+'/'+_0x40ed17)[_0x28ae('0x1c')](_0x3871e7);}return null;};}function patchUpdates(_0xc3ed9c){return function(_0x3ff6bc){try{jsonpatch[_0x28ae('0x23')](_0x3ff6bc,_0xc3ed9c,!![]);}catch(_0x1ab61f){return BPromise[_0x28ae('0x24')](_0x1ab61f);}return _0x3ff6bc[_0x28ae('0x25')]();};}function saveUpdates(_0x28dd4e,_0x2bd125){return function(_0x582db1){if(_0x582db1){return _0x582db1[_0x28ae('0x26')](_0x28dd4e)[_0x28ae('0x27')](function(_0x1bd2d6){return _0x1bd2d6;});}return null;};}function removeEntity(_0x5550d7,_0x4f6c1d){return function(_0x3b70a6){if(_0x3b70a6){return _0x3b70a6[_0x28ae('0x28')]()[_0x28ae('0x27')](function(){var _0x1e5607=_0x3b70a6[_0x28ae('0x29')]({'plain':!![]});var _0x22a48a=_0x28ae('0x2a');return db[_0x28ae('0x2b')][_0x28ae('0x28')]({'where':{'type':_0x22a48a,'resourceId':_0x1e5607['id']}})[_0x28ae('0x27')](function(){return _0x3b70a6;});})[_0x28ae('0x27')](function(){_0x5550d7[_0x28ae('0x1b')](0xcc)[_0x28ae('0x1a')]();});}};}function handleEntityNotFound(_0x2eef56,_0x5c42e2){return function(_0x505298){if(!_0x505298){_0x2eef56[_0x28ae('0x19')](0x194);}return _0x505298;};}function handleError(_0x5afd82,_0x4c0672){_0x4c0672=_0x4c0672||0x1f4;return function(_0x306df3){logger[_0x28ae('0x2c')](_0x306df3[_0x28ae('0x2d')]);if(_0x306df3['name']){delete _0x306df3[_0x28ae('0x2e')];}_0x5afd82['status'](_0x4c0672)[_0x28ae('0x2f')](_0x306df3);};}exports[_0x28ae('0x30')]=function(_0x143bec,_0x518ec8){var _0x30cb9e={},_0x91fac8={},_0x469913={'count':0x0,'rows':[]};var _0x509f23=_[_0x28ae('0x31')](db[_0x28ae('0x32')][_0x28ae('0x33')],function(_0x122659){return{'name':_0x122659[_0x28ae('0x34')],'type':_0x122659['type']['key']};});_0x91fac8[_0x28ae('0x35')]=_[_0x28ae('0x31')](_0x509f23,_0x28ae('0x2e'));_0x91fac8[_0x28ae('0x36')]=_[_0x28ae('0x37')](_0x143bec[_0x28ae('0x36')]);_0x91fac8[_0x28ae('0x38')]=_[_0x28ae('0x39')](_0x91fac8[_0x28ae('0x35')],_0x91fac8[_0x28ae('0x36')]);_0x30cb9e[_0x28ae('0x3a')]=_[_0x28ae('0x39')](_0x91fac8['model'],qs[_0x28ae('0x3b')](_0x143bec['query'][_0x28ae('0x3b')]));_0x30cb9e['attributes']=_0x30cb9e[_0x28ae('0x3a')]['length']?_0x30cb9e[_0x28ae('0x3a')]:_0x91fac8['model'];if(!_0x143bec[_0x28ae('0x36')][_0x28ae('0x3c')](_0x28ae('0x3d'))){_0x30cb9e['limit']=qs[_0x28ae('0x1e')](_0x143bec[_0x28ae('0x36')][_0x28ae('0x1e')]);_0x30cb9e[_0x28ae('0x20')]=qs[_0x28ae('0x20')](_0x143bec['query'][_0x28ae('0x20')]);}_0x30cb9e[_0x28ae('0x3e')]=qs['sort'](_0x143bec[_0x28ae('0x36')]['sort']);_0x30cb9e['where']=qs[_0x28ae('0x38')](_['pick'](_0x143bec[_0x28ae('0x36')],_0x91fac8['filters']),_0x509f23);if(_0x143bec['query'][_0x28ae('0x3f')]){_0x30cb9e['where']=_[_0x28ae('0x40')](_0x30cb9e[_0x28ae('0x41')],{'$or':[{'key':{'$like':'%'+_0x143bec[_0x28ae('0x36')][_0x28ae('0x3f')]+'%'}},{'value':{'$like':'%'+_0x143bec[_0x28ae('0x36')][_0x28ae('0x3f')]+'%'}}]});}_0x30cb9e=_[_0x28ae('0x40')]({},_0x30cb9e,_0x143bec[_0x28ae('0x42')]);var _0x3d4d4d={'where':_0x30cb9e[_0x28ae('0x41')]};return db[_0x28ae('0x32')][_0x28ae('0x1f')](_0x3d4d4d)[_0x28ae('0x27')](function(_0x510608){_0x469913['count']=_0x510608;if(_0x143bec['query'][_0x28ae('0x43')]){_0x30cb9e[_0x28ae('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x28ae('0x45')](_0x30cb9e);})[_0x28ae('0x27')](function(_0x327b31){_0x469913[_0x28ae('0x46')]=_0x327b31;return _0x469913;})['then'](respondWithFilteredResult(_0x518ec8,_0x30cb9e))[_0x28ae('0x47')](handleError(_0x518ec8,null));};exports[_0x28ae('0x48')]=function(_0x2d81d6,_0x6a7a27){var _0x59588d={'raw':!![],'where':{'id':_0x2d81d6[_0x28ae('0x49')]['id']}},_0x19e722={};_0x19e722[_0x28ae('0x35')]=_[_0x28ae('0x37')](db['CannedAnswer'][_0x28ae('0x33')]);_0x19e722[_0x28ae('0x36')]=_['keys'](_0x2d81d6[_0x28ae('0x36')]);_0x19e722[_0x28ae('0x38')]=_['intersection'](_0x19e722['model'],_0x19e722[_0x28ae('0x36')]);_0x59588d[_0x28ae('0x3a')]=_[_0x28ae('0x39')](_0x19e722[_0x28ae('0x35')],qs['fields'](_0x2d81d6[_0x28ae('0x36')][_0x28ae('0x3b')]));_0x59588d[_0x28ae('0x3a')]=_0x59588d[_0x28ae('0x3a')][_0x28ae('0x4a')]?_0x59588d[_0x28ae('0x3a')]:_0x19e722[_0x28ae('0x35')];if(_0x2d81d6['query'][_0x28ae('0x43')]){_0x59588d['include']=[{'all':!![]}];}_0x59588d=_['merge']({},_0x59588d,_0x2d81d6[_0x28ae('0x42')]);return db[_0x28ae('0x32')][_0x28ae('0x4b')](_0x59588d)[_0x28ae('0x27')](handleEntityNotFound(_0x6a7a27,null))[_0x28ae('0x27')](respondWithResult(_0x6a7a27,null))[_0x28ae('0x47')](handleError(_0x6a7a27,null));};exports[_0x28ae('0x26')]=function(_0xc2011,_0x5a4e39){if(_0xc2011[_0x28ae('0x4c')]['id']){delete _0xc2011[_0x28ae('0x4c')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0xc2011[_0x28ae('0x49')]['id']}})[_0x28ae('0x27')](handleEntityNotFound(_0x5a4e39,null))[_0x28ae('0x27')](saveUpdates(_0xc2011[_0x28ae('0x4c')],null))[_0x28ae('0x27')](respondWithResult(_0x5a4e39,null))['catch'](handleError(_0x5a4e39,null));};exports['destroy']=function(_0x5268a3,_0x17f523){return db[_0x28ae('0x32')][_0x28ae('0x4b')]({'where':{'id':_0x5268a3[_0x28ae('0x49')]['id']}})[_0x28ae('0x27')](handleEntityNotFound(_0x17f523,null))[_0x28ae('0x27')](removeEntity(_0x17f523,null))[_0x28ae('0x47')](handleError(_0x17f523,null));};exports[_0x28ae('0x4d')]=function(_0x1e118b,_0x2e4bbd){var _0x5db9c8={'key':_0x1e118b['body']['key']};if(_0x1e118b[_0x28ae('0x4c')][_0x28ae('0x4e')]){_0x5db9c8[_0x28ae('0x4e')]=_0x1e118b['body'][_0x28ae('0x4e')];}else if(_0x1e118b[_0x28ae('0x4c')][_0x28ae('0x4f')]){_0x5db9c8[_0x28ae('0x4f')]=_0x1e118b[_0x28ae('0x4c')][_0x28ae('0x4f')];}else if(_0x1e118b[_0x28ae('0x4c')][_0x28ae('0x50')]){_0x5db9c8['OpenchannelAccountId']=_0x1e118b[_0x28ae('0x4c')][_0x28ae('0x50')];}else if(_0x1e118b[_0x28ae('0x4c')][_0x28ae('0x51')]){_0x5db9c8[_0x28ae('0x51')]=_0x1e118b['body'][_0x28ae('0x51')];}return db[_0x28ae('0x32')][_0x28ae('0x4b')]({'where':_0x5db9c8})[_0x28ae('0x27')](function(_0x1715bc){if(_0x1715bc){throw new db[(_0x28ae('0x52'))][(_0x28ae('0x53'))](_0x28ae('0x54'));}return db[_0x28ae('0x32')][_0x28ae('0x4d')](_0x1e118b[_0x28ae('0x4c')]);})['then'](function(_0x29a172){var _0x26e836=_0x1e118b['user'][_0x28ae('0x29')]({'plain':!![]});if(!_0x26e836)throw new Error(_0x28ae('0x55'));if(_0x26e836[_0x28ae('0x56')]===_0x28ae('0x57')){var _0x1c0f69=_0x29a172[_0x28ae('0x29')]({'plain':!![]});return db[_0x28ae('0x58')][_0x28ae('0x4b')]({'where':{'name':_0x28ae('0x2a'),'userProfileId':_0x26e836['userProfileId']},'raw':!![]})[_0x28ae('0x27')](function(_0x2141bc){if(_0x2141bc&&_0x2141bc[_0x28ae('0x59')]===0x0){return db[_0x28ae('0x2b')][_0x28ae('0x4d')]({'name':_0x1c0f69[_0x28ae('0x2e')],'resourceId':_0x1c0f69['id'],'type':_0x2141bc[_0x28ae('0x2e')],'sectionId':_0x2141bc['id']},{})[_0x28ae('0x27')](function(){return _0x29a172;});}else{return _0x29a172;}})[_0x28ae('0x47')](function(_0x1d91ca){logger[_0x28ae('0x2c')](_0x28ae('0x5a'),_0x1d91ca);throw _0x1d91ca;});}return _0x29a172;})[_0x28ae('0x27')](respondWithResult(_0x2e4bbd,0xc9))[_0x28ae('0x47')](handleError(_0x2e4bbd,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f36ed34..78ca424 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 _0xa4e3=['CannedAnswer','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xa4e3,0x17c));var _0x3a4e=function(_0x5637ab,_0x38755b){_0x5637ab=_0x5637ab-0x0;var _0x50b5a7=_0xa4e3[_0x5637ab];return _0x50b5a7;};'use strict';var _=require(_0x3a4e('0x0'));var util=require(_0x3a4e('0x1'));var logger=require('../../config/logger')(_0x3a4e('0x2'));var moment=require(_0x3a4e('0x3'));var BPromise=require(_0x3a4e('0x4'));var rp=require(_0x3a4e('0x5'));var fs=require('fs');var path=require(_0x3a4e('0x6'));var rimraf=require(_0x3a4e('0x7'));var config=require(_0x3a4e('0x8'));var attributes=require(_0x3a4e('0x9'));module[_0x3a4e('0xa')]=function(_0xfbe0e5,_0x1f26be){return _0xfbe0e5[_0x3a4e('0xb')](_0x3a4e('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3a4e('0xd')});}; \ No newline at end of file +var _0x74ce=['util','../../config/logger','moment','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4b75e4,_0x2d5621){var _0x3e2178=function(_0x492872){while(--_0x492872){_0x4b75e4['push'](_0x4b75e4['shift']());}};_0x3e2178(++_0x2d5621);}(_0x74ce,0x8e));var _0xe74c=function(_0x103c0d,_0x2c37d0){_0x103c0d=_0x103c0d-0x0;var _0x1b2578=_0x74ce[_0x103c0d];return _0x1b2578;};'use strict';var _=require(_0xe74c('0x0'));var util=require(_0xe74c('0x1'));var logger=require(_0xe74c('0x2'))('api');var moment=require(_0xe74c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe74c('0x4'));var fs=require('fs');var path=require(_0xe74c('0x5'));var rimraf=require('rimraf');var config=require(_0xe74c('0x6'));var attributes=require(_0xe74c('0x7'));module[_0xe74c('0x8')]=function(_0x5a19f8,_0x1d436b){return _0x5a19f8[_0xe74c('0x9')]('CannedAnswer',attributes,{'tableName':_0xe74c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe74c('0xb'),'collate':_0xe74c('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 6d5326f..1cc2011 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 _0xdb62=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','moment'];(function(_0x43466a,_0x7d42ef){var _0x4a7f49=function(_0xbfa96b){while(--_0xbfa96b){_0x43466a['push'](_0x43466a['shift']());}};_0x4a7f49(++_0x7d42ef);}(_0xdb62,0x83));var _0x2db6=function(_0x37de50,_0x27f82a){_0x37de50=_0x37de50-0x0;var _0x2c37dc=_0xdb62[_0x37de50];return _0x2c37dc;};'use strict';var _=require(_0x2db6('0x0'));var util=require('util');var moment=require(_0x2db6('0x1'));var BPromise=require('bluebird');var rs=require(_0x2db6('0x2'));var fs=require('fs');var Redis=require(_0x2db6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2db6('0x4'));var logger=require(_0x2db6('0x5'))(_0x2db6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2db6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc3e21f,_0x3f8e06,_0x588f8c){return new BPromise(function(_0x20bf52,_0x1aa213){return client[_0x2db6('0x8')](_0xc3e21f,_0x588f8c)[_0x2db6('0x9')](function(_0x3c08a4){logger['info'](_0x2db6('0xa'),_0x3f8e06,'request\x20sent');logger[_0x2db6('0xb')](_0x2db6('0xc'),_0x3f8e06,_0x2db6('0xd'),JSON[_0x2db6('0xe')](_0x3c08a4));if(_0x3c08a4[_0x2db6('0xf')]){if(_0x3c08a4['error'][_0x2db6('0x10')]===0x1f4){logger[_0x2db6('0xf')](_0x2db6('0xa'),_0x3f8e06,_0x3c08a4['error'][_0x2db6('0x11')]);return _0x1aa213(_0x3c08a4[_0x2db6('0xf')][_0x2db6('0x11')]);}logger['error'](_0x2db6('0xa'),_0x3f8e06,_0x3c08a4[_0x2db6('0xf')]['message']);return _0x20bf52(_0x3c08a4[_0x2db6('0xf')]['message']);}else{logger[_0x2db6('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x3f8e06,_0x2db6('0xd'));_0x20bf52(_0x3c08a4['result'][_0x2db6('0x11')]);}})['catch'](function(_0x59a20b){logger[_0x2db6('0xf')](_0x2db6('0xa'),_0x3f8e06,_0x59a20b);_0x1aa213(_0x59a20b);});});} \ No newline at end of file +var _0xdcb1=['client','http','request','then','info','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5767ef,_0x5cb686){var _0x17f376=function(_0x249cb6){while(--_0x249cb6){_0x5767ef['push'](_0x5767ef['shift']());}};_0x17f376(++_0x5cb686);}(_0xdcb1,0x1c6));var _0x1dcb=function(_0x391415,_0x342c56){_0x391415=_0x391415-0x0;var _0x229fa4=_0xdcb1[_0x391415];return _0x229fa4;};'use strict';var _=require(_0x1dcb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1dcb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dcb('0x2'));var db=require(_0x1dcb('0x3'))['db'];var utils=require(_0x1dcb('0x4'));var logger=require('../../config/logger')(_0x1dcb('0x5'));var config=require(_0x1dcb('0x6'));var jayson=require(_0x1dcb('0x7'));var client=jayson[_0x1dcb('0x8')][_0x1dcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x109372,_0x48f7c3,_0x2261f2){return new BPromise(function(_0x45df2a,_0x4ed973){return client[_0x1dcb('0xa')](_0x109372,_0x2261f2)[_0x1dcb('0xb')](function(_0x245314){logger[_0x1dcb('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x48f7c3,'request\x20sent');logger[_0x1dcb('0xd')](_0x1dcb('0xe'),_0x48f7c3,'request\x20sent',JSON[_0x1dcb('0xf')](_0x245314));if(_0x245314[_0x1dcb('0x10')]){if(_0x245314[_0x1dcb('0x10')][_0x1dcb('0x11')]===0x1f4){logger[_0x1dcb('0x10')](_0x1dcb('0x12'),_0x48f7c3,_0x245314[_0x1dcb('0x10')]['message']);return _0x4ed973(_0x245314[_0x1dcb('0x10')][_0x1dcb('0x13')]);}logger[_0x1dcb('0x10')](_0x1dcb('0x12'),_0x48f7c3,_0x245314[_0x1dcb('0x10')][_0x1dcb('0x13')]);return _0x45df2a(_0x245314[_0x1dcb('0x10')][_0x1dcb('0x13')]);}else{logger[_0x1dcb('0xc')](_0x1dcb('0x12'),_0x48f7c3,'request\x20sent');_0x45df2a(_0x245314[_0x1dcb('0x14')][_0x1dcb('0x13')]);}})[_0x1dcb('0x15')](function(_0x2ee89b){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x48f7c3,_0x2ee89b);_0x4ed973(_0x2ee89b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index d33d4ee..9a6fa6b 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 _0xc872=['delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xc872,0x1f2));var _0x2c87=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0xc872[_0xe15270];return _0x1e813b;};'use strict';var multer=require('multer');var util=require(_0x2c87('0x0'));var path=require(_0x2c87('0x1'));var timeout=require('connect-timeout');var express=require(_0x2c87('0x2'));var router=express['Router']();var fs_extra=require(_0x2c87('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2c87('0x4'));var config=require(_0x2c87('0x5'));var controller=require(_0x2c87('0x6'));router[_0x2c87('0x7')]('/',auth[_0x2c87('0x8')](),controller['index']);router[_0x2c87('0x7')](_0x2c87('0x9'),auth['isAuthenticated'](),controller[_0x2c87('0xa')]);router[_0x2c87('0xb')]('/',auth[_0x2c87('0x8')](),controller['create']);router['put'](_0x2c87('0x9'),auth[_0x2c87('0x8')](),controller['update']);router[_0x2c87('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x2c87('0xd')]);module[_0x2c87('0xe')]=router; \ No newline at end of file +var _0xa13a=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','update','delete'];(function(_0x5332a8,_0x2643a3){var _0x3b03f1=function(_0x334b38){while(--_0x334b38){_0x5332a8['push'](_0x5332a8['shift']());}};_0x3b03f1(++_0x2643a3);}(_0xa13a,0x80));var _0xaa13=function(_0x35f8e0,_0x77f00d){_0x35f8e0=_0x35f8e0-0x0;var _0x94c4f9=_0xa13a[_0x35f8e0];return _0x94c4f9;};'use strict';var multer=require(_0xaa13('0x0'));var util=require(_0xaa13('0x1'));var path=require(_0xaa13('0x2'));var timeout=require(_0xaa13('0x3'));var express=require('express');var router=express[_0xaa13('0x4')]();var fs_extra=require(_0xaa13('0x5'));var auth=require(_0xaa13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaa13('0x7'));var controller=require('./cannedAnswer.controller');router[_0xaa13('0x8')]('/',auth[_0xaa13('0x9')](),controller['index']);router[_0xaa13('0x8')]('/:id',auth[_0xaa13('0x9')](),controller[_0xaa13('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaa13('0xb')]);router[_0xaa13('0xc')](_0xaa13('0xd'),auth[_0xaa13('0x9')](),controller[_0xaa13('0xe')]);router[_0xaa13('0xf')]('/:id',auth[_0xaa13('0x9')](),controller[_0xaa13('0x10')]);module[_0xaa13('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index a5dfa01..9e2386a 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 _0x5c26=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x56bad9,_0x32f618){var _0x296e15=function(_0x32214d){while(--_0x32214d){_0x56bad9['push'](_0x56bad9['shift']());}};_0x296e15(++_0x32f618);}(_0x5c26,0xf0));var _0x65c2=function(_0x38c62a,_0x30022c){_0x38c62a=_0x38c62a-0x0;var _0xe4f41f=_0x5c26[_0x38c62a];return _0xe4f41f;};'use strict';var Sequelize=require('sequelize');module[_0x65c2('0x0')]={'calldate':{'type':Sequelize[_0x65c2('0x1')],'allowNull':![],'defaultValue':_0x65c2('0x2')},'clid':{'type':Sequelize[_0x65c2('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x65c2('0x3')]},'channel':{'type':Sequelize[_0x65c2('0x3')]},'dstchannel':{'type':Sequelize[_0x65c2('0x3')]},'lastapp':{'type':Sequelize[_0x65c2('0x3')]},'lastdata':{'type':Sequelize[_0x65c2('0x3')]},'duration':{'type':Sequelize[_0x65c2('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x65c2('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x65c2('0x3')]},'amaflags':{'type':Sequelize[_0x65c2('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x65c2('0x3')]},'userfield':{'type':Sequelize[_0x65c2('0x3')]},'uniqueid':{'type':Sequelize[_0x65c2('0x3')]},'linkedid':{'type':Sequelize[_0x65c2('0x3')]},'sequence':{'type':Sequelize[_0x65c2('0x3')]},'peeraccount':{'type':Sequelize[_0x65c2('0x3')]},'type':{'type':Sequelize[_0x65c2('0x3')]},'tag':{'type':Sequelize[_0x65c2('0x3')]}}; \ No newline at end of file +var _0x6260=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x43a979,_0x1fdec3){var _0xb5001=function(_0x3b32c1){while(--_0x3b32c1){_0x43a979['push'](_0x43a979['shift']());}};_0xb5001(++_0x1fdec3);}(_0x6260,0xce));var _0x0626=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0x6260[_0xd02bb];return _0x1cdf23;};'use strict';var Sequelize=require(_0x0626('0x0'));module[_0x0626('0x1')]={'calldate':{'type':Sequelize[_0x0626('0x2')],'allowNull':![],'defaultValue':_0x0626('0x3')},'clid':{'type':Sequelize[_0x0626('0x4')]},'src':{'type':Sequelize[_0x0626('0x4')]},'dst':{'type':Sequelize[_0x0626('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x0626('0x4')]},'lastapp':{'type':Sequelize[_0x0626('0x4')]},'lastdata':{'type':Sequelize[_0x0626('0x4')]},'duration':{'type':Sequelize[_0x0626('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0626('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0626('0x4')]},'amaflags':{'type':Sequelize[_0x0626('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x0626('0x4')]},'uniqueid':{'type':Sequelize[_0x0626('0x4')]},'linkedid':{'type':Sequelize[_0x0626('0x4')]},'sequence':{'type':Sequelize[_0x0626('0x4')]},'peeraccount':{'type':Sequelize[_0x0626('0x4')]},'type':{'type':Sequelize[_0x0626('0x4')]},'tag':{'type':Sequelize[_0x0626('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f18786a..4888708 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 _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','Cdr','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x201fac,_0x197176){var _0x435913=function(_0x33d9ad){while(--_0x33d9ad){_0x201fac['push'](_0x201fac['shift']());}};_0x435913(++_0x197176);}(_0xb10b,0x12a));var _0xbb10=function(_0x65f140,_0x45cbc7){_0x65f140=_0x65f140-0x0;var _0x18fbda=_0xb10b[_0x65f140];return _0x18fbda;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['Cdr'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x1c7fae){_0x2e0249[_0xbb10('0x43')]=_0x1c7fae;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x44')]=function(_0x331751,_0x23dc18){var _0x403beb={'raw':!![],'where':{'id':_0x331751[_0xbb10('0x45')]['id']}},_0x5e2cfa={};_0x5e2cfa[_0xbb10('0x2f')]=_['keys'](db['Cdr'][_0xbb10('0x2c')]);_0x5e2cfa['query']=_[_0xbb10('0x30')](_0x331751[_0xbb10('0x31')]);_0x5e2cfa['filters']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],_0x5e2cfa[_0xbb10('0x31')]);_0x403beb['attributes']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x331751[_0xbb10('0x31')][_0xbb10('0x34')]));_0x403beb[_0xbb10('0x33')]=_0x403beb[_0xbb10('0x33')][_0xbb10('0x35')]?_0x403beb[_0xbb10('0x33')]:_0x5e2cfa[_0xbb10('0x2f')];if(_0x331751[_0xbb10('0x31')][_0xbb10('0x41')]){_0x403beb['include']=[{'all':!![]}];}_0x403beb=_[_0xbb10('0x3e')]({},_0x403beb,_0x331751[_0xbb10('0x3f')]);return db['Cdr'][_0xbb10('0x46')](_0x403beb)[_0xbb10('0x23')](handleEntityNotFound(_0x23dc18,null))[_0xbb10('0x23')](respondWithResult(_0x23dc18,null))[_0xbb10('0x47')](handleError(_0x23dc18,null));};exports[_0xbb10('0x48')]=function(_0x39f0de,_0x3e06b0){return db['Cdr']['create'](_0x39f0de[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x3e06b0,0xc9))[_0xbb10('0x47')](handleError(_0x3e06b0,null));};exports['update']=function(_0x5f0c12,_0x3cd6f3){if(_0x5f0c12[_0xbb10('0x49')]['id']){delete _0x5f0c12[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x5f0c12[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x23')](saveUpdates(_0x5f0c12[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,null))['catch'](handleError(_0x3cd6f3,null));};exports['destroy']=function(_0x412e13,_0x467dba){return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x412e13[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x467dba,null))[_0xbb10('0x23')](removeEntity(_0x467dba,null))[_0xbb10('0x47')](handleError(_0x467dba,null));};exports[_0xbb10('0x4a')]=function(_0x1214f7,_0x19ca3e){return db[_0xbb10('0x40')][_0xbb10('0x4a')]()[_0xbb10('0x23')](respondWithResult(_0x19ca3e,null))[_0xbb10('0x47')](handleError(_0x19ca3e,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['Cdr'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':!![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 69dc8a6..0577450 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 _0xf494=['disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','accountcode','calldate'];(function(_0x559060,_0x38a41c){var _0x9b469e=function(_0x1ed735){while(--_0x1ed735){_0x559060['push'](_0x559060['shift']());}};_0x9b469e(++_0x38a41c);}(_0xf494,0x1c6));var _0x4f49=function(_0x4daa0e,_0x31698c){_0x4daa0e=_0x4daa0e-0x0;var _0x384c04=_0xf494[_0x4daa0e];return _0x384c04;};'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')]('Cdr',attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]},{'name':_0x4f49('0xd'),'fields':[_0x4f49('0xd')]},{'name':_0x4f49('0xe'),'fields':[_0x4f49('0xe')]},{'name':_0x4f49('0xf'),'fields':[_0x4f49('0xf')]},{'name':'src','fields':[_0x4f49('0x10')]},{'name':_0x4f49('0x11'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0x7c09=['accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','define','Cdr','cdr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c09,0x102));var _0x97c0=function(_0x4a9dcf,_0x2c4627){_0x4a9dcf=_0x4a9dcf-0x0;var _0xc9ee5d=_0x7c09[_0x4a9dcf];return _0xc9ee5d;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'calldate','fields':[_0x97c0('0xd')]},{'name':'disposition','fields':[_0x97c0('0xe')]},{'name':_0x97c0('0xf'),'fields':['dst']},{'name':'src','fields':[_0x97c0('0x10')]},{'name':_0x97c0('0x11'),'fields':[_0x97c0('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 179fbd3..4904b51 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 _0xe159=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xe159,0x16f));var _0x9e15=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe159[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x9e15('0x0'));var util=require(_0x9e15('0x1'));var moment=require(_0x9e15('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e15('0x3'))['db'];var utils=require(_0x9e15('0x4'));var logger=require(_0x9e15('0x5'))(_0x9e15('0x6'));var config=require(_0x9e15('0x7'));var jayson=require(_0x9e15('0x8'));var client=jayson[_0x9e15('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1595d1,_0x251158,_0x64d057){return new BPromise(function(_0xc55082,_0x16ad3a){return client[_0x9e15('0xa')](_0x1595d1,_0x64d057)['then'](function(_0xd938a){logger[_0x9e15('0xb')](_0x9e15('0xc'),_0x251158,_0x9e15('0xd'));logger[_0x9e15('0xe')](_0x9e15('0xf'),_0x251158,_0x9e15('0xd'),JSON[_0x9e15('0x10')](_0xd938a));if(_0xd938a[_0x9e15('0x11')]){if(_0xd938a['error'][_0x9e15('0x12')]===0x1f4){logger[_0x9e15('0x11')]('Cdr,\x20%s,\x20%s',_0x251158,_0xd938a[_0x9e15('0x11')][_0x9e15('0x13')]);return _0x16ad3a(_0xd938a[_0x9e15('0x11')][_0x9e15('0x13')]);}logger['error'](_0x9e15('0xc'),_0x251158,_0xd938a[_0x9e15('0x11')][_0x9e15('0x13')]);return _0xc55082(_0xd938a[_0x9e15('0x11')][_0x9e15('0x13')]);}else{logger['info'](_0x9e15('0xc'),_0x251158,_0x9e15('0xd'));_0xc55082(_0xd938a['result'][_0x9e15('0x13')]);}})[_0x9e15('0x14')](function(_0x58b15d){logger['error']('Cdr,\x20%s,\x20%s',_0x251158,_0x58b15d);_0x16ad3a(_0x58b15d);});});} \ No newline at end of file +var _0xe43f=['message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s'];(function(_0x4500ad,_0x43cc22){var _0x1c5add=function(_0xdd5f99){while(--_0xdd5f99){_0x4500ad['push'](_0x4500ad['shift']());}};_0x1c5add(++_0x43cc22);}(_0xe43f,0x17c));var _0xfe43=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0xe43f[_0x16b992];return _0x385c78;};'use strict';var _=require('lodash');var util=require(_0xfe43('0x0'));var moment=require('moment');var BPromise=require(_0xfe43('0x1'));var rs=require(_0xfe43('0x2'));var fs=require('fs');var Redis=require(_0xfe43('0x3'));var db=require(_0xfe43('0x4'))['db'];var utils=require(_0xfe43('0x5'));var logger=require(_0xfe43('0x6'))('rpc');var config=require(_0xfe43('0x7'));var jayson=require(_0xfe43('0x8'));var client=jayson[_0xfe43('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c76ca,_0x3b98c6,_0xb45177){return new BPromise(function(_0x5b22c0,_0x26b6f5){return client[_0xfe43('0xa')](_0x4c76ca,_0xb45177)['then'](function(_0x44c80d){logger[_0xfe43('0xb')]('Cdr,\x20%s,\x20%s',_0x3b98c6,_0xfe43('0xc'));logger[_0xfe43('0xd')](_0xfe43('0xe'),_0x3b98c6,_0xfe43('0xc'),JSON[_0xfe43('0xf')](_0x44c80d));if(_0x44c80d[_0xfe43('0x10')]){if(_0x44c80d['error'][_0xfe43('0x11')]===0x1f4){logger[_0xfe43('0x10')](_0xfe43('0x12'),_0x3b98c6,_0x44c80d[_0xfe43('0x10')][_0xfe43('0x13')]);return _0x26b6f5(_0x44c80d['error'][_0xfe43('0x13')]);}logger[_0xfe43('0x10')](_0xfe43('0x12'),_0x3b98c6,_0x44c80d[_0xfe43('0x10')][_0xfe43('0x13')]);return _0x5b22c0(_0x44c80d[_0xfe43('0x10')][_0xfe43('0x13')]);}else{logger[_0xfe43('0xb')](_0xfe43('0x12'),_0x3b98c6,_0xfe43('0xc'));_0x5b22c0(_0x44c80d[_0xfe43('0x14')]['message']);}})['catch'](function(_0x38e38){logger['error'](_0xfe43('0x12'),_0x3b98c6,_0x38e38);_0x26b6f5(_0x38e38);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 302c471..67c911f 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 _0x5f7b=['create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x4d421c,_0x84ccf0){var _0x28bb3d=function(_0x32df55){while(--_0x32df55){_0x4d421c['push'](_0x4d421c['shift']());}};_0x28bb3d(++_0x84ccf0);}(_0x5f7b,0x1b9));var _0xb5f7=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x5f7b[_0x819464];return _0x49dcc0;};'use strict';var multer=require(_0xb5f7('0x0'));var util=require(_0xb5f7('0x1'));var path=require(_0xb5f7('0x2'));var timeout=require(_0xb5f7('0x3'));var express=require(_0xb5f7('0x4'));var router=express[_0xb5f7('0x5')]();var fs_extra=require(_0xb5f7('0x6'));var auth=require(_0xb5f7('0x7'));var interaction=require(_0xb5f7('0x8'));var config=require('../../config/environment');var controller=require(_0xb5f7('0x9'));router[_0xb5f7('0xa')]('/',auth[_0xb5f7('0xb')](),controller['index']);router[_0xb5f7('0xa')]('/describe',auth[_0xb5f7('0xb')](),controller[_0xb5f7('0xc')]);router[_0xb5f7('0xa')](_0xb5f7('0xd'),auth[_0xb5f7('0xb')](),controller[_0xb5f7('0xe')]);router['post']('/',auth[_0xb5f7('0xb')](),controller[_0xb5f7('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb5f7('0x10')]);router[_0xb5f7('0x11')](_0xb5f7('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xb5f7('0x12')]=router; \ No newline at end of file +var _0x3d5d=['../../components/auth/service','get','isAuthenticated','/describe','describe','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3d5d,0x173));var _0xd3d5=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x3d5d[_0xcd0918];return _0x250704;};'use strict';var multer=require(_0xd3d5('0x0'));var util=require(_0xd3d5('0x1'));var path=require(_0xd3d5('0x2'));var timeout=require(_0xd3d5('0x3'));var express=require(_0xd3d5('0x4'));var router=express[_0xd3d5('0x5')]();var fs_extra=require(_0xd3d5('0x6'));var auth=require(_0xd3d5('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cdr.controller');router[_0xd3d5('0x8')]('/',auth[_0xd3d5('0x9')](),controller['index']);router[_0xd3d5('0x8')](_0xd3d5('0xa'),auth[_0xd3d5('0x9')](),controller[_0xd3d5('0xb')]);router[_0xd3d5('0x8')]('/:id',auth[_0xd3d5('0x9')](),controller[_0xd3d5('0xc')]);router[_0xd3d5('0xd')]('/',auth[_0xd3d5('0x9')](),controller[_0xd3d5('0xe')]);router[_0xd3d5('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd3d5('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd3d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 939983b..b0850c1 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 _0xfebd=['TEXT','exports','INTEGER','STRING'];(function(_0x276c01,_0x32fad2){var _0x3e87f7=function(_0x4680cc){while(--_0x4680cc){_0x276c01['push'](_0x276c01['shift']());}};_0x3e87f7(++_0x32fad2);}(_0xfebd,0xb5));var _0xdfeb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfebd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xdfeb('0x0')]={'priority':{'type':Sequelize[_0xdfeb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdfeb('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdfeb('0x3')]()},'description':{'type':Sequelize[_0xdfeb('0x2')]},'interval':{'type':Sequelize[_0xdfeb('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x93d8=['noop','TEXT','*,*,*,*','INTEGER','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x93d8,0x8f));var _0x893d=function(_0x1b2232,_0x52f48f){_0x1b2232=_0x1b2232-0x0;var _0xa97379=_0x93d8[_0x1b2232];return _0xa97379;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x893d('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x893d('0x1')],'allowNull':![],'defaultValue':_0x893d('0x2')},'appdata':{'type':Sequelize[_0x893d('0x3')]()},'description':{'type':Sequelize[_0x893d('0x1')]},'interval':{'type':Sequelize[_0x893d('0x1')],'defaultValue':_0x893d('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e6569a2..934fb61 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 _0xaa10=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x4e1c00,_0x4418ea){var _0x45ae12=function(_0xce8803){while(--_0xce8803){_0x4e1c00['push'](_0x4e1c00['shift']());}};_0x45ae12(++_0x4418ea);}(_0xaa10,0xd9));var _0x0aa1=function(_0xcc3e08,_0x50407e){_0xcc3e08=_0xcc3e08-0x0;var _0xc9ca9e=_0xaa10[_0xcc3e08];return _0xc9ca9e;};'use strict';var emlformat=require(_0x0aa1('0x0'));var rimraf=require(_0x0aa1('0x1'));var zipdir=require(_0x0aa1('0x2'));var jsonpatch=require(_0x0aa1('0x3'));var rp=require(_0x0aa1('0x4'));var moment=require(_0x0aa1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0aa1('0x6'));var util=require('util');var path=require(_0x0aa1('0x7'));var sox=require(_0x0aa1('0x8'));var csv=require(_0x0aa1('0x9'));var ejs=require(_0x0aa1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0aa1('0xb'));var squel=require(_0x0aa1('0xc'));var crypto=require(_0x0aa1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0aa1('0xe'));var toCsv=require(_0x0aa1('0x9'));var querystring=require(_0x0aa1('0xf'));var Papa=require(_0x0aa1('0x10'));var Redis=require('ioredis');var authService=require(_0x0aa1('0x11'));var qs=require(_0x0aa1('0x12'));var as=require(_0x0aa1('0x13'));var hardwareService=require(_0x0aa1('0x14'));var logger=require(_0x0aa1('0x15'))(_0x0aa1('0x16'));var utils=require(_0x0aa1('0x17'));var config=require(_0x0aa1('0x18'));var licenseUtil=require(_0x0aa1('0x19'));var db=require(_0x0aa1('0x1a'))['db'];function respondWithStatusCode(_0x2a828d,_0x3bc50a){_0x3bc50a=_0x3bc50a||0xcc;return function(_0x264d8b){if(_0x264d8b){return _0x2a828d[_0x0aa1('0x1b')](_0x3bc50a);}return _0x2a828d[_0x0aa1('0x1c')](_0x3bc50a)[_0x0aa1('0x1d')]();};}function respondWithResult(_0x2318b0,_0x89e590){_0x89e590=_0x89e590||0xc8;return function(_0x3b2d97){if(_0x3b2d97){return _0x2318b0[_0x0aa1('0x1c')](_0x89e590)[_0x0aa1('0x1e')](_0x3b2d97);}};}function respondWithFilteredResult(_0x33a7a0,_0x2894d7){return function(_0xda6b55){if(_0xda6b55){var _0x574490=typeof _0x2894d7[_0x0aa1('0x1f')]===_0x0aa1('0x20')&&typeof _0x2894d7[_0x0aa1('0x21')]===_0x0aa1('0x20');var _0x1b11df=_0xda6b55[_0x0aa1('0x22')];var _0x34a191=_0x574490?0x0:_0x2894d7[_0x0aa1('0x1f')];var _0x1dd3c3=_0x574490?_0xda6b55[_0x0aa1('0x22')]:_0x2894d7[_0x0aa1('0x1f')]+_0x2894d7['limit'];var _0x56777e;if(_0x1dd3c3>=_0x1b11df){_0x1dd3c3=_0x1b11df;_0x56777e=0xc8;}else{_0x56777e=0xce;}_0x33a7a0[_0x0aa1('0x1c')](_0x56777e);return _0x33a7a0['set'](_0x0aa1('0x23'),_0x34a191+'-'+_0x1dd3c3+'/'+_0x1b11df)[_0x0aa1('0x1e')](_0xda6b55);}return null;};}function patchUpdates(_0x5a83b1){return function(_0x41e454){try{jsonpatch[_0x0aa1('0x24')](_0x41e454,_0x5a83b1,!![]);}catch(_0x59441c){return BPromise[_0x0aa1('0x25')](_0x59441c);}return _0x41e454[_0x0aa1('0x26')]();};}function saveUpdates(_0x5d55ee,_0x45d13f){return function(_0x39a6b8){if(_0x39a6b8){return _0x39a6b8[_0x0aa1('0x27')](_0x5d55ee)[_0x0aa1('0x28')](function(_0x5963a6){return _0x5963a6;});}return null;};}function removeEntity(_0x76dcc0,_0x2d90a5){return function(_0x193d2c){if(_0x193d2c){return _0x193d2c[_0x0aa1('0x29')]()[_0x0aa1('0x28')](function(){_0x76dcc0[_0x0aa1('0x1c')](0xcc)[_0x0aa1('0x1d')]();});}};}function handleEntityNotFound(_0x2fb783,_0x34a5d6){return function(_0x3cb2a9){if(!_0x3cb2a9){_0x2fb783['sendStatus'](0x194);}return _0x3cb2a9;};}function handleError(_0x3558f3,_0x30a17b){_0x30a17b=_0x30a17b||0x1f4;return function(_0x1d76ad){logger[_0x0aa1('0x2a')](_0x1d76ad[_0x0aa1('0x2b')]);if(_0x1d76ad[_0x0aa1('0x2c')]){delete _0x1d76ad[_0x0aa1('0x2c')];}_0x3558f3[_0x0aa1('0x1c')](_0x30a17b)['send'](_0x1d76ad);};}exports['show']=function(_0x4a6260,_0x41d199){var _0x40d605={'raw':!![],'where':{'id':_0x4a6260[_0x0aa1('0x2d')]['id']}},_0x6281b9={};_0x6281b9[_0x0aa1('0x2e')]=_[_0x0aa1('0x2f')](db[_0x0aa1('0x30')][_0x0aa1('0x31')]);_0x6281b9[_0x0aa1('0x32')]=_[_0x0aa1('0x2f')](_0x4a6260[_0x0aa1('0x32')]);_0x6281b9[_0x0aa1('0x33')]=_[_0x0aa1('0x34')](_0x6281b9['model'],_0x6281b9[_0x0aa1('0x32')]);_0x40d605[_0x0aa1('0x35')]=_[_0x0aa1('0x34')](_0x6281b9[_0x0aa1('0x2e')],qs[_0x0aa1('0x36')](_0x4a6260[_0x0aa1('0x32')][_0x0aa1('0x36')]));_0x40d605['attributes']=_0x40d605[_0x0aa1('0x35')][_0x0aa1('0x37')]?_0x40d605[_0x0aa1('0x35')]:_0x6281b9[_0x0aa1('0x2e')];if(_0x4a6260[_0x0aa1('0x32')][_0x0aa1('0x38')]){_0x40d605[_0x0aa1('0x39')]=[{'all':!![]}];}_0x40d605=_[_0x0aa1('0x3a')]({},_0x40d605,_0x4a6260[_0x0aa1('0x3b')]);return db[_0x0aa1('0x30')][_0x0aa1('0x3c')](_0x40d605)[_0x0aa1('0x28')](handleEntityNotFound(_0x41d199,null))[_0x0aa1('0x28')](respondWithResult(_0x41d199,null))[_0x0aa1('0x3d')](handleError(_0x41d199,null));};exports[_0x0aa1('0x27')]=function(_0x5be116,_0x281785){if(_0x5be116[_0x0aa1('0x3e')]['id']){delete _0x5be116[_0x0aa1('0x3e')]['id'];}return db[_0x0aa1('0x30')][_0x0aa1('0x3c')]({'where':{'id':_0x5be116[_0x0aa1('0x2d')]['id']}})[_0x0aa1('0x28')](handleEntityNotFound(_0x281785,null))[_0x0aa1('0x28')](saveUpdates(_0x5be116[_0x0aa1('0x3e')],null))[_0x0aa1('0x28')](respondWithResult(_0x281785,null))[_0x0aa1('0x3d')](handleError(_0x281785,null));};exports[_0x0aa1('0x29')]=function(_0x5ac938,_0x140f76){return db[_0x0aa1('0x30')][_0x0aa1('0x3c')]({'where':{'id':_0x5ac938[_0x0aa1('0x2d')]['id']}})[_0x0aa1('0x28')](handleEntityNotFound(_0x140f76,null))[_0x0aa1('0x28')](removeEntity(_0x140f76,null))[_0x0aa1('0x3d')](handleError(_0x140f76,null));}; \ No newline at end of file +var _0x585f=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','intersection','query','attributes','fields','length','includeAll','include','merge','options','find','body','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x28a245,_0x1d817a){var _0x1bfce6=function(_0x41558a){while(--_0x41558a){_0x28a245['push'](_0x28a245['shift']());}};_0x1bfce6(++_0x1d817a);}(_0x585f,0x96));var _0xf585=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x585f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf585('0x0'));var rimraf=require(_0xf585('0x1'));var zipdir=require(_0xf585('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf585('0x3'));var moment=require('moment');var BPromise=require(_0xf585('0x4'));var Mustache=require(_0xf585('0x5'));var util=require(_0xf585('0x6'));var path=require(_0xf585('0x7'));var sox=require('sox');var csv=require(_0xf585('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf585('0x9'));var _=require('lodash');var squel=require(_0xf585('0xa'));var crypto=require(_0xf585('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf585('0xc'));var toCsv=require(_0xf585('0x8'));var querystring=require(_0xf585('0xd'));var Papa=require(_0xf585('0xe'));var Redis=require(_0xf585('0xf'));var authService=require(_0xf585('0x10'));var qs=require(_0xf585('0x11'));var as=require(_0xf585('0x12'));var hardwareService=require(_0xf585('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf585('0x14'));var db=require(_0xf585('0x15'))['db'];function respondWithStatusCode(_0x3b8587,_0x363eab){_0x363eab=_0x363eab||0xcc;return function(_0x445d3f){if(_0x445d3f){return _0x3b8587[_0xf585('0x16')](_0x363eab);}return _0x3b8587[_0xf585('0x17')](_0x363eab)['end']();};}function respondWithResult(_0x352c4c,_0x522783){_0x522783=_0x522783||0xc8;return function(_0x34ff75){if(_0x34ff75){return _0x352c4c[_0xf585('0x17')](_0x522783)[_0xf585('0x18')](_0x34ff75);}};}function respondWithFilteredResult(_0x2dc83e,_0x2eab7b){return function(_0xe55866){if(_0xe55866){var _0xdb7e30=typeof _0x2eab7b[_0xf585('0x19')]===_0xf585('0x1a')&&typeof _0x2eab7b[_0xf585('0x1b')]==='undefined';var _0x147393=_0xe55866[_0xf585('0x1c')];var _0x515944=_0xdb7e30?0x0:_0x2eab7b[_0xf585('0x19')];var _0x10d044=_0xdb7e30?_0xe55866[_0xf585('0x1c')]:_0x2eab7b['offset']+_0x2eab7b[_0xf585('0x1b')];var _0x3c151e;if(_0x10d044>=_0x147393){_0x10d044=_0x147393;_0x3c151e=0xc8;}else{_0x3c151e=0xce;}_0x2dc83e[_0xf585('0x17')](_0x3c151e);return _0x2dc83e[_0xf585('0x1d')](_0xf585('0x1e'),_0x515944+'-'+_0x10d044+'/'+_0x147393)[_0xf585('0x18')](_0xe55866);}return null;};}function patchUpdates(_0x255d2f){return function(_0x1e290f){try{jsonpatch[_0xf585('0x1f')](_0x1e290f,_0x255d2f,!![]);}catch(_0x59b81c){return BPromise[_0xf585('0x20')](_0x59b81c);}return _0x1e290f[_0xf585('0x21')]();};}function saveUpdates(_0x4199f6,_0x750e5f){return function(_0x1b65b7){if(_0x1b65b7){return _0x1b65b7[_0xf585('0x22')](_0x4199f6)[_0xf585('0x23')](function(_0x3f7f6a){return _0x3f7f6a;});}return null;};}function removeEntity(_0x56e1ca,_0x28477e){return function(_0x107ad3){if(_0x107ad3){return _0x107ad3['destroy']()[_0xf585('0x23')](function(){_0x56e1ca[_0xf585('0x17')](0xcc)[_0xf585('0x24')]();});}};}function handleEntityNotFound(_0xaa2629,_0x393ad3){return function(_0x56f301){if(!_0x56f301){_0xaa2629[_0xf585('0x16')](0x194);}return _0x56f301;};}function handleError(_0x2008eb,_0x1c3aed){_0x1c3aed=_0x1c3aed||0x1f4;return function(_0x38b43a){logger[_0xf585('0x25')](_0x38b43a[_0xf585('0x26')]);if(_0x38b43a[_0xf585('0x27')]){delete _0x38b43a[_0xf585('0x27')];}_0x2008eb[_0xf585('0x17')](_0x1c3aed)['send'](_0x38b43a);};}exports[_0xf585('0x28')]=function(_0x4f4d2c,_0x1ba99b){var _0x4f75e4={'raw':!![],'where':{'id':_0x4f4d2c[_0xf585('0x29')]['id']}},_0x20a66e={};_0x20a66e[_0xf585('0x2a')]=_[_0xf585('0x2b')](db[_0xf585('0x2c')][_0xf585('0x2d')]);_0x20a66e['query']=_[_0xf585('0x2b')](_0x4f4d2c['query']);_0x20a66e['filters']=_[_0xf585('0x2e')](_0x20a66e[_0xf585('0x2a')],_0x20a66e[_0xf585('0x2f')]);_0x4f75e4[_0xf585('0x30')]=_['intersection'](_0x20a66e[_0xf585('0x2a')],qs['fields'](_0x4f4d2c[_0xf585('0x2f')][_0xf585('0x31')]));_0x4f75e4[_0xf585('0x30')]=_0x4f75e4[_0xf585('0x30')][_0xf585('0x32')]?_0x4f75e4['attributes']:_0x20a66e['model'];if(_0x4f4d2c['query'][_0xf585('0x33')]){_0x4f75e4[_0xf585('0x34')]=[{'all':!![]}];}_0x4f75e4=_[_0xf585('0x35')]({},_0x4f75e4,_0x4f4d2c[_0xf585('0x36')]);return db[_0xf585('0x2c')][_0xf585('0x37')](_0x4f75e4)[_0xf585('0x23')](handleEntityNotFound(_0x1ba99b,null))[_0xf585('0x23')](respondWithResult(_0x1ba99b,null))['catch'](handleError(_0x1ba99b,null));};exports[_0xf585('0x22')]=function(_0x586f82,_0x5a3d2f){if(_0x586f82[_0xf585('0x38')]['id']){delete _0x586f82[_0xf585('0x38')]['id'];}return db[_0xf585('0x2c')][_0xf585('0x37')]({'where':{'id':_0x586f82['params']['id']}})[_0xf585('0x23')](handleEntityNotFound(_0x5a3d2f,null))[_0xf585('0x23')](saveUpdates(_0x586f82[_0xf585('0x38')],null))[_0xf585('0x23')](respondWithResult(_0x5a3d2f,null))['catch'](handleError(_0x5a3d2f,null));};exports[_0xf585('0x39')]=function(_0x3a8dbe,_0xb73eec){return db[_0xf585('0x2c')]['find']({'where':{'id':_0x3a8dbe[_0xf585('0x29')]['id']}})['then'](handleEntityNotFound(_0xb73eec,null))[_0xf585('0x23')](removeEntity(_0xb73eec,null))['catch'](handleError(_0xb73eec,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1ba7c1b..ec641f9 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(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 02dd22f..bf3c30a 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 _0x858e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x4df1e3,_0x2d211a){var _0x4b7236=function(_0x404339){while(--_0x404339){_0x4df1e3['push'](_0x4df1e3['shift']());}};_0x4b7236(++_0x2d211a);}(_0x858e,0x1c8));var _0xe858=function(_0x322752,_0x1ab149){_0x322752=_0x322752-0x0;var _0x2a6840=_0x858e[_0x322752];return _0x2a6840;};'use strict';var _=require(_0xe858('0x0'));var util=require(_0xe858('0x1'));var moment=require(_0xe858('0x2'));var BPromise=require(_0xe858('0x3'));var rs=require(_0xe858('0x4'));var fs=require('fs');var Redis=require(_0xe858('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe858('0x6'));var logger=require(_0xe858('0x7'))(_0xe858('0x8'));var config=require(_0xe858('0x9'));var jayson=require(_0xe858('0xa'));var client=jayson[_0xe858('0xb')][_0xe858('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22a553,_0x263875,_0x147627){return new BPromise(function(_0x107e52,_0x45d31f){return client[_0xe858('0xd')](_0x22a553,_0x147627)[_0xe858('0xe')](function(_0x1e9634){logger[_0xe858('0xf')](_0xe858('0x10'),_0x263875,_0xe858('0x11'));logger[_0xe858('0x12')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x263875,_0xe858('0x11'),JSON[_0xe858('0x13')](_0x1e9634));if(_0x1e9634[_0xe858('0x14')]){if(_0x1e9634[_0xe858('0x14')]['code']===0x1f4){logger[_0xe858('0x14')]('ChatApplication,\x20%s,\x20%s',_0x263875,_0x1e9634[_0xe858('0x14')][_0xe858('0x15')]);return _0x45d31f(_0x1e9634['error'][_0xe858('0x15')]);}logger[_0xe858('0x14')](_0xe858('0x10'),_0x263875,_0x1e9634[_0xe858('0x14')][_0xe858('0x15')]);return _0x107e52(_0x1e9634['error'][_0xe858('0x15')]);}else{logger[_0xe858('0xf')](_0xe858('0x10'),_0x263875,'request\x20sent');_0x107e52(_0x1e9634[_0xe858('0x16')][_0xe858('0x15')]);}})[_0xe858('0x17')](function(_0xccf10b){logger[_0xe858('0x14')](_0xe858('0x10'),_0x263875,_0xccf10b);_0x45d31f(_0xccf10b);});});} \ No newline at end of file +var _0x4a93=['request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x4a93,0xc9));var _0x34a9=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4a93[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x34a9('0x0'));var rs=require(_0x34a9('0x1'));var fs=require('fs');var Redis=require(_0x34a9('0x2'));var db=require(_0x34a9('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x34a9('0x4'));var config=require(_0x34a9('0x5'));var jayson=require(_0x34a9('0x6'));var client=jayson['client'][_0x34a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d9a2a,_0x2d364f,_0xe70f60){return new BPromise(function(_0x26e7db,_0x29c1d3){return client[_0x34a9('0x8')](_0x2d9a2a,_0xe70f60)[_0x34a9('0x9')](function(_0x260562){logger[_0x34a9('0xa')](_0x34a9('0xb'),_0x2d364f,_0x34a9('0xc'));logger[_0x34a9('0xd')](_0x34a9('0xe'),_0x2d364f,_0x34a9('0xc'),JSON[_0x34a9('0xf')](_0x260562));if(_0x260562[_0x34a9('0x10')]){if(_0x260562[_0x34a9('0x10')]['code']===0x1f4){logger[_0x34a9('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2d364f,_0x260562[_0x34a9('0x10')]['message']);return _0x29c1d3(_0x260562[_0x34a9('0x10')][_0x34a9('0x11')]);}logger[_0x34a9('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2d364f,_0x260562['error'][_0x34a9('0x11')]);return _0x26e7db(_0x260562[_0x34a9('0x10')][_0x34a9('0x11')]);}else{logger['info'](_0x34a9('0xb'),_0x2d364f,'request\x20sent');_0x26e7db(_0x260562[_0x34a9('0x12')]['message']);}})['catch'](function(_0x33075f){logger['error'](_0x34a9('0xb'),_0x2d364f,_0x33075f);_0x29c1d3(_0x33075f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9300718..cc5b5a6 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 _0xda1d=['./chatApplication.controller','/:id','isAuthenticated','show','put','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5c89a3,_0x501c9f){var _0x17a382=function(_0x313f2b){while(--_0x313f2b){_0x5c89a3['push'](_0x5c89a3['shift']());}};_0x17a382(++_0x501c9f);}(_0xda1d,0x1f2));var _0xdda1=function(_0x4788ca,_0x5cda70){_0x4788ca=_0x4788ca-0x0;var _0x28a6f5=_0xda1d[_0x4788ca];return _0x28a6f5;};'use strict';var multer=require(_0xdda1('0x0'));var util=require('util');var path=require(_0xdda1('0x1'));var timeout=require('connect-timeout');var express=require(_0xdda1('0x2'));var router=express['Router']();var fs_extra=require(_0xdda1('0x3'));var auth=require(_0xdda1('0x4'));var interaction=require(_0xdda1('0x5'));var config=require('../../config/environment');var controller=require(_0xdda1('0x6'));router['get'](_0xdda1('0x7'),auth[_0xdda1('0x8')](),controller[_0xdda1('0x9')]);router[_0xdda1('0xa')](_0xdda1('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdda1('0x7'),auth[_0xdda1('0x8')](),controller['destroy']);module[_0xdda1('0xb')]=router; \ No newline at end of file +var _0x1c41=['../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4d6bfa,_0x55fb07){var _0xb95789=function(_0x264726){while(--_0x264726){_0x4d6bfa['push'](_0x4d6bfa['shift']());}};_0xb95789(++_0x55fb07);}(_0x1c41,0x81));var _0x11c4=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x1c41[_0x587fb5];return _0x551105;};'use strict';var multer=require(_0x11c4('0x0'));var util=require(_0x11c4('0x1'));var path=require(_0x11c4('0x2'));var timeout=require(_0x11c4('0x3'));var express=require(_0x11c4('0x4'));var router=express[_0x11c4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x11c4('0x6'));var interaction=require(_0x11c4('0x7'));var config=require(_0x11c4('0x8'));var controller=require(_0x11c4('0x9'));router['get'](_0x11c4('0xa'),auth[_0x11c4('0xb')](),controller[_0x11c4('0xc')]);router[_0x11c4('0xd')](_0x11c4('0xa'),auth[_0x11c4('0xb')](),controller[_0x11c4('0xe')]);router[_0x11c4('0xf')](_0x11c4('0xa'),auth[_0x11c4('0xb')](),controller[_0x11c4('0x10')]);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 d462bd2..50136e3 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 _0x4ff6=['BOOLEAN','sequelize','exports','STRING'];(function(_0x36fe2e,_0x3f47c0){var _0x4d5f3e=function(_0x474a92){while(--_0x474a92){_0x36fe2e['push'](_0x36fe2e['shift']());}};_0x4d5f3e(++_0x3f47c0);}(_0x4ff6,0xe9));var _0x64ff=function(_0x2088e6,_0x40bb23){_0x2088e6=_0x2088e6-0x0;var _0x22819f=_0x4ff6[_0x2088e6];return _0x22819f;};'use strict';var Sequelize=require(_0x64ff('0x0'));module[_0x64ff('0x1')]={'name':{'type':Sequelize[_0x64ff('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x64ff('0x2')]},'write':{'type':Sequelize[_0x64ff('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0772=['sequelize','STRING','BOOLEAN'];(function(_0x326863,_0x48bc96){var _0x3cc1e9=function(_0x54cd54){while(--_0x54cd54){_0x326863['push'](_0x326863['shift']());}};_0x3cc1e9(++_0x48bc96);}(_0x0772,0x66));var _0x2077=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0772[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x2077('0x0'));module['exports']={'name':{'type':Sequelize[_0x2077('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2077('0x1')]},'write':{'type':Sequelize[_0x2077('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 82aa7f7..d8ded48 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 _0xe0fd=['options','ChatGroup','includeAll','include','findAll','rows','params','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','nolimit','getMembers','removeMembers','addMessage','ChatGroupId','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./chatGroup.socket','jayson/promise','client','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL'];(function(_0x3d060f,_0x107628){var _0x50dfd3=function(_0x13c656){while(--_0x13c656){_0x3d060f['push'](_0x3d060f['shift']());}};_0x50dfd3(++_0x107628);}(_0xe0fd,0x15e));var _0xde0f=function(_0x33722e,_0xb4360){_0x33722e=_0x33722e-0x0;var _0x42878b=_0xe0fd[_0x33722e];return _0x42878b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xde0f('0x0'));var jsonpatch=require(_0xde0f('0x1'));var rp=require(_0xde0f('0x2'));var moment=require(_0xde0f('0x3'));var BPromise=require(_0xde0f('0x4'));var Mustache=require(_0xde0f('0x5'));var util=require(_0xde0f('0x6'));var path=require(_0xde0f('0x7'));var sox=require(_0xde0f('0x8'));var csv=require(_0xde0f('0x9'));var ejs=require(_0xde0f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde0f('0xb'));var squel=require('squel');var crypto=require(_0xde0f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xde0f('0xd'));var toCsv=require(_0xde0f('0x9'));var querystring=require('querystring');var Papa=require(_0xde0f('0xe'));var Redis=require(_0xde0f('0xf'));var authService=require(_0xde0f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xde0f('0x11'));var hardwareService=require(_0xde0f('0x12'));var logger=require(_0xde0f('0x13'))(_0xde0f('0x14'));var utils=require(_0xde0f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xde0f('0x16'));var db=require('../../mysqldb')['db'];config[_0xde0f('0x17')]=_['defaults'](config[_0xde0f('0x17')],{'host':_0xde0f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde0f('0x17')]));require(_0xde0f('0x19'))['register'](socket);var jayson=require(_0xde0f('0x1a'));var client=jayson[_0xde0f('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b4ff,_0x3e0c52,_0x5ad970,_0x1463ad){return new BPromise(function(_0x36455f,_0xc448d8){var _0x524cf3=_0x1463ad||client;return _0x524cf3[_0xde0f('0x1c')](_0x33b4ff,_0x5ad970)[_0xde0f('0x1d')](function(_0x2c0b1f){logger[_0xde0f('0x1e')](_0xde0f('0x1f'),_0x3e0c52,_0xde0f('0x20'));logger['debug'](_0xde0f('0x21'),_0x3e0c52,_0xde0f('0x20'),JSON[_0xde0f('0x22')](_0x2c0b1f));if(_0x2c0b1f[_0xde0f('0x23')]){if(_0x2c0b1f['error'][_0xde0f('0x24')]===0x1f4){logger[_0xde0f('0x23')](_0xde0f('0x1f'),_0x3e0c52,_0x2c0b1f['error'][_0xde0f('0x25')]);return _0xc448d8(_0x2c0b1f[_0xde0f('0x23')][_0xde0f('0x25')]);}logger[_0xde0f('0x23')]('ChatGroup,\x20%s,\x20%s',_0x3e0c52,_0x2c0b1f[_0xde0f('0x23')][_0xde0f('0x25')]);return _0x36455f(_0x2c0b1f[_0xde0f('0x23')]['message']);}else{logger[_0xde0f('0x1e')](_0xde0f('0x1f'),_0x3e0c52,'request\x20sent');_0x36455f(_0x2c0b1f[_0xde0f('0x26')]['message']);}})['catch'](function(_0x2b59a1){logger[_0xde0f('0x23')](_0xde0f('0x1f'),_0x3e0c52,_0x2b59a1);_0xc448d8(_0x2b59a1);});});}function respondWithStatusCode(_0x22dfb1,_0x364a8d){_0x364a8d=_0x364a8d||0xcc;return function(_0x2ef0bd){if(_0x2ef0bd){return _0x22dfb1[_0xde0f('0x27')](_0x364a8d);}return _0x22dfb1[_0xde0f('0x28')](_0x364a8d)[_0xde0f('0x29')]();};}function respondWithResult(_0x5c427d,_0x444f78){_0x444f78=_0x444f78||0xc8;return function(_0x2981b6){if(_0x2981b6){return _0x5c427d['status'](_0x444f78)['json'](_0x2981b6);}};}function respondWithFilteredResult(_0x33e288,_0x55f501){return function(_0x20fee1){if(_0x20fee1){var _0x198db7=typeof _0x55f501[_0xde0f('0x2a')]==='undefined'&&typeof _0x55f501[_0xde0f('0x2b')]==='undefined';var _0x211f2a=_0x20fee1[_0xde0f('0x2c')];var _0x2b4d87=_0x198db7?0x0:_0x55f501[_0xde0f('0x2a')];var _0x1a257d=_0x198db7?_0x20fee1['count']:_0x55f501[_0xde0f('0x2a')]+_0x55f501[_0xde0f('0x2b')];var _0x360dc1;if(_0x1a257d>=_0x211f2a){_0x1a257d=_0x211f2a;_0x360dc1=0xc8;}else{_0x360dc1=0xce;}_0x33e288[_0xde0f('0x28')](_0x360dc1);return _0x33e288[_0xde0f('0x2d')](_0xde0f('0x2e'),_0x2b4d87+'-'+_0x1a257d+'/'+_0x211f2a)[_0xde0f('0x2f')](_0x20fee1);}return null;};}function patchUpdates(_0x5ae8fb){return function(_0x28e6a4){try{jsonpatch[_0xde0f('0x30')](_0x28e6a4,_0x5ae8fb,!![]);}catch(_0x4a5746){return BPromise[_0xde0f('0x31')](_0x4a5746);}return _0x28e6a4[_0xde0f('0x32')]();};}function saveUpdates(_0x3e5c59,_0x64a02e){return function(_0x10f97a){if(_0x10f97a){return _0x10f97a[_0xde0f('0x33')](_0x3e5c59)[_0xde0f('0x1d')](function(_0x49676a){return _0x49676a;});}return null;};}function removeEntity(_0x16e547,_0x1e196a){return function(_0x4044e4){if(_0x4044e4){return _0x4044e4[_0xde0f('0x34')]()[_0xde0f('0x1d')](function(){_0x16e547[_0xde0f('0x28')](0xcc)[_0xde0f('0x29')]();});}};}function handleEntityNotFound(_0x4f4c5d,_0x21af0a){return function(_0x1c113b){if(!_0x1c113b){_0x4f4c5d['sendStatus'](0x194);}return _0x1c113b;};}function handleError(_0x4c736b,_0x59b171){_0x59b171=_0x59b171||0x1f4;return function(_0x892962){logger[_0xde0f('0x23')](_0x892962[_0xde0f('0x35')]);if(_0x892962[_0xde0f('0x36')]){delete _0x892962[_0xde0f('0x36')];}_0x4c736b[_0xde0f('0x28')](_0x59b171)[_0xde0f('0x37')](_0x892962);};}exports[_0xde0f('0x38')]=function(_0x5d5788,_0x408b86){var _0x40a629={},_0x30d8da={},_0x5d0bb0={'count':0x0,'rows':[]};var _0x14e936=_[_0xde0f('0x39')](db['ChatGroup'][_0xde0f('0x3a')],function(_0x2cd343){return{'name':_0x2cd343[_0xde0f('0x3b')],'type':_0x2cd343[_0xde0f('0x3c')][_0xde0f('0x3d')]};});_0x30d8da[_0xde0f('0x3e')]=_[_0xde0f('0x39')](_0x14e936,_0xde0f('0x36'));_0x30d8da['query']=_[_0xde0f('0x3f')](_0x5d5788[_0xde0f('0x40')]);_0x30d8da['filters']=_[_0xde0f('0x41')](_0x30d8da[_0xde0f('0x3e')],_0x30d8da[_0xde0f('0x40')]);_0x40a629[_0xde0f('0x42')]=_[_0xde0f('0x41')](_0x30d8da['model'],qs[_0xde0f('0x43')](_0x5d5788[_0xde0f('0x40')][_0xde0f('0x43')]));_0x40a629[_0xde0f('0x42')]=_0x40a629['attributes'][_0xde0f('0x44')]?_0x40a629['attributes']:_0x30d8da[_0xde0f('0x3e')];if(!_0x5d5788['query'][_0xde0f('0x45')]('nolimit')){_0x40a629['limit']=qs['limit'](_0x5d5788[_0xde0f('0x40')]['limit']);_0x40a629[_0xde0f('0x2a')]=qs['offset'](_0x5d5788['query']['offset']);}_0x40a629[_0xde0f('0x46')]=qs[_0xde0f('0x47')](_0x5d5788[_0xde0f('0x40')][_0xde0f('0x47')]);_0x40a629[_0xde0f('0x48')]=qs['filters'](_[_0xde0f('0x49')](_0x5d5788[_0xde0f('0x40')],_0x30d8da[_0xde0f('0x4a')]),_0x14e936);if(_0x5d5788[_0xde0f('0x40')][_0xde0f('0x4b')]){_0x40a629[_0xde0f('0x48')]=_[_0xde0f('0x4c')](_0x40a629[_0xde0f('0x48')],{'$or':_[_0xde0f('0x39')](_0x14e936,function(_0x155140){if(_0x155140['type']!==_0xde0f('0x4d')){var _0xa037b9={};_0xa037b9[_0x155140[_0xde0f('0x36')]]={'$like':'%'+_0x5d5788[_0xde0f('0x40')][_0xde0f('0x4b')]+'%'};return _0xa037b9;}})});}_0x40a629=_[_0xde0f('0x4c')]({},_0x40a629,_0x5d5788[_0xde0f('0x4e')]);var _0x3f6d59={'where':_0x40a629[_0xde0f('0x48')]};return db[_0xde0f('0x4f')][_0xde0f('0x2c')](_0x3f6d59)[_0xde0f('0x1d')](function(_0x5456bb){_0x5d0bb0[_0xde0f('0x2c')]=_0x5456bb;if(_0x5d5788['query'][_0xde0f('0x50')]){_0x40a629[_0xde0f('0x51')]=[{'all':!![]}];}return db[_0xde0f('0x4f')][_0xde0f('0x52')](_0x40a629);})[_0xde0f('0x1d')](function(_0x1bd9a1){_0x5d0bb0[_0xde0f('0x53')]=_0x1bd9a1;return _0x5d0bb0;})[_0xde0f('0x1d')](respondWithFilteredResult(_0x408b86,_0x40a629))['catch'](handleError(_0x408b86,null));};exports['show']=function(_0x3a6ae9,_0x12df8f){var _0x3ea14c={'raw':!![],'where':{'id':_0x3a6ae9[_0xde0f('0x54')]['id']}},_0x1c262b={};_0x1c262b['model']=_[_0xde0f('0x3f')](db[_0xde0f('0x4f')][_0xde0f('0x3a')]);_0x1c262b[_0xde0f('0x40')]=_[_0xde0f('0x3f')](_0x3a6ae9[_0xde0f('0x40')]);_0x1c262b['filters']=_[_0xde0f('0x41')](_0x1c262b['model'],_0x1c262b[_0xde0f('0x40')]);_0x3ea14c[_0xde0f('0x42')]=_[_0xde0f('0x41')](_0x1c262b['model'],qs[_0xde0f('0x43')](_0x3a6ae9[_0xde0f('0x40')]['fields']));_0x3ea14c['attributes']=_0x3ea14c[_0xde0f('0x42')]['length']?_0x3ea14c[_0xde0f('0x42')]:_0x1c262b['model'];if(_0x3a6ae9[_0xde0f('0x40')][_0xde0f('0x50')]){_0x3ea14c['include']=[{'all':!![]}];}_0x3ea14c=_[_0xde0f('0x4c')]({},_0x3ea14c,_0x3a6ae9[_0xde0f('0x4e')]);return db[_0xde0f('0x4f')][_0xde0f('0x55')](_0x3ea14c)[_0xde0f('0x1d')](handleEntityNotFound(_0x12df8f,null))['then'](respondWithResult(_0x12df8f,null))[_0xde0f('0x56')](handleError(_0x12df8f,null));};exports[_0xde0f('0x57')]=function(_0x489fce,_0x6887e3){return db['ChatGroup']['create'](_0x489fce[_0xde0f('0x58')],{})[_0xde0f('0x1d')](respondWithResult(_0x6887e3,0xc9))[_0xde0f('0x56')](handleError(_0x6887e3,null));};exports[_0xde0f('0x33')]=function(_0x47627c,_0x40c48f){if(_0x47627c['body']['id']){delete _0x47627c[_0xde0f('0x58')]['id'];}return db[_0xde0f('0x4f')][_0xde0f('0x55')]({'where':{'id':_0x47627c[_0xde0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x40c48f,null))[_0xde0f('0x1d')](saveUpdates(_0x47627c[_0xde0f('0x58')],null))[_0xde0f('0x1d')](respondWithResult(_0x40c48f,null))[_0xde0f('0x56')](handleError(_0x40c48f,null));};exports[_0xde0f('0x34')]=function(_0x1280b5,_0x6bfdad){return db['ChatGroup']['find']({'where':{'id':_0x1280b5[_0xde0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x6bfdad,null))[_0xde0f('0x1d')](removeEntity(_0x6bfdad,null))[_0xde0f('0x56')](handleError(_0x6bfdad,null));};exports[_0xde0f('0x59')]=function(_0x490ec7,_0x45b064){return db[_0xde0f('0x4f')][_0xde0f('0x59')]()[_0xde0f('0x1d')](respondWithResult(_0x45b064,null))['catch'](handleError(_0x45b064,null));};exports[_0xde0f('0x5a')]=function(_0x3632e0,_0x3b637c,_0x5f1d07){return db[_0xde0f('0x5b')][_0xde0f('0x2c')]({'where':{'ChatGroupId':_0x3632e0[_0xde0f('0x54')]['id'],'ToId':_0x3632e0[_0xde0f('0x5c')]['id'],'read':![]}})[_0xde0f('0x1d')](function(_0x58366d){return{'id':_['toInteger'](_0x3632e0[_0xde0f('0x54')]['id']),'count':_0x58366d};})['then'](respondWithResult(_0x3b637c,null))['catch'](handleError(_0x3b637c,null));};exports[_0xde0f('0x5d')]=function(_0x1703dd,_0x540c52,_0x110a19){return db[_0xde0f('0x4f')][_0xde0f('0x55')]({'where':{'id':_0x1703dd[_0xde0f('0x54')]['id']}})[_0xde0f('0x1d')](handleEntityNotFound(_0x540c52,null))[_0xde0f('0x1d')](function(_0x295e26){if(_0x295e26){return _0x295e26['addMembers'](_0x1703dd['body'][_0xde0f('0x5e')],_[_0xde0f('0x5f')](_0x1703dd['body'],[_0xde0f('0x5e'),'id'])||{});}})[_0xde0f('0x1d')](respondWithResult(_0x540c52,null))[_0xde0f('0x56')](handleError(_0x540c52,null));};exports['getMembers']=function(_0x2d4870,_0x466ad3,_0x383c45){var _0x543fcd={};var _0x4e477a={};var _0xcef59e;var _0x309780;return db[_0xde0f('0x4f')]['findOne']({'where':{'id':_0x2d4870[_0xde0f('0x54')]['id']}})[_0xde0f('0x1d')](handleEntityNotFound(_0x466ad3,null))['then'](function(_0x59f56d){if(_0x59f56d){_0xcef59e=_0x59f56d;_0x4e477a[_0xde0f('0x3e')]=_['keys'](db['User'][_0xde0f('0x3a')]);_0x4e477a[_0xde0f('0x40')]=_[_0xde0f('0x3f')](_0x2d4870[_0xde0f('0x40')]);_0x4e477a[_0xde0f('0x4a')]=_[_0xde0f('0x41')](_0x4e477a['model'],_0x4e477a[_0xde0f('0x40')]);_0x543fcd[_0xde0f('0x42')]=_['intersection'](_0x4e477a[_0xde0f('0x3e')],qs[_0xde0f('0x43')](_0x2d4870['query'][_0xde0f('0x43')]));_0x543fcd['attributes']=_0x543fcd[_0xde0f('0x42')][_0xde0f('0x44')]?_0x543fcd[_0xde0f('0x42')]:_0x4e477a[_0xde0f('0x3e')];_0x543fcd['order']=qs['sort'](_0x2d4870['query'][_0xde0f('0x47')]);_0x543fcd[_0xde0f('0x48')]=qs['filters'](_['pick'](_0x2d4870[_0xde0f('0x40')],_0x4e477a[_0xde0f('0x4a')]));if(_0x2d4870[_0xde0f('0x40')][_0xde0f('0x4b')]){_0x543fcd[_0xde0f('0x48')]=_[_0xde0f('0x4c')](_0x543fcd['where'],{'$or':_[_0xde0f('0x39')](_0x543fcd[_0xde0f('0x42')],function(_0x16f08b){var _0x361f8a={};_0x361f8a[_0x16f08b]={'$like':'%'+_0x2d4870[_0xde0f('0x40')]['filter']+'%'};return _0x361f8a;})});}_0x543fcd=_[_0xde0f('0x4c')]({},_0x543fcd,_0x2d4870['options']);return _0xcef59e['getMembers'](_0x543fcd);}})[_0xde0f('0x1d')](function(_0x2561e5){if(_0x2561e5){_0x309780=_0x2561e5[_0xde0f('0x44')];if(!_0x2d4870[_0xde0f('0x40')][_0xde0f('0x45')](_0xde0f('0x60'))){_0x543fcd[_0xde0f('0x2b')]=qs[_0xde0f('0x2b')](_0x2d4870[_0xde0f('0x40')][_0xde0f('0x2b')]);_0x543fcd[_0xde0f('0x2a')]=qs[_0xde0f('0x2a')](_0x2d4870[_0xde0f('0x40')]['offset']);}return _0xcef59e[_0xde0f('0x61')](_0x543fcd);}})[_0xde0f('0x1d')](function(_0x96113a){if(_0x96113a){return _0x96113a?{'count':_0x309780,'rows':_0x96113a}:null;}})[_0xde0f('0x1d')](respondWithResult(_0x466ad3,null))[_0xde0f('0x56')](handleError(_0x466ad3,null));};exports[_0xde0f('0x62')]=function(_0x29725b,_0x49f888,_0x59e6fb){return db[_0xde0f('0x4f')]['find']({'where':{'id':_0x29725b[_0xde0f('0x54')]['id']}})[_0xde0f('0x1d')](handleEntityNotFound(_0x49f888,null))[_0xde0f('0x1d')](function(_0x42db09){if(_0x42db09){return _0x42db09[_0xde0f('0x62')](_0x29725b[_0xde0f('0x40')][_0xde0f('0x5e')]);}})['then'](respondWithStatusCode(_0x49f888,null))['catch'](handleError(_0x49f888,null));};exports[_0xde0f('0x63')]=function(_0x5f1067,_0x4a42f8,_0x1bca7f){if(_0x5f1067[_0xde0f('0x58')]['id']){delete _0x5f1067[_0xde0f('0x58')]['id'];}return db[_0xde0f('0x4f')][_0xde0f('0x55')]({'where':{'id':_0x5f1067[_0xde0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x4a42f8,null))[_0xde0f('0x1d')](function(_0x43f613){if(_0x43f613){_0x5f1067[_0xde0f('0x58')][_0xde0f('0x64')]=_0x43f613['id'];return db['ChatInternalMessage'][_0xde0f('0x57')](_0x5f1067[_0xde0f('0x58')]);}})['then'](respondWithResult(_0x4a42f8,null))[_0xde0f('0x56')](handleError(_0x4a42f8,null));};exports['getMessages']=function(_0xb9ed1,_0x54cdc6,_0x289edf){var _0xe8495a={};var _0x30c174={};var _0x1106eb;var _0x4cd728;return db[_0xde0f('0x4f')][_0xde0f('0x65')]({'where':{'id':_0xb9ed1[_0xde0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x54cdc6,null))[_0xde0f('0x1d')](function(_0x252d08){if(_0x252d08){_0x1106eb=_0x252d08;_0x30c174[_0xde0f('0x3e')]=_[_0xde0f('0x3f')](db[_0xde0f('0x5b')]['rawAttributes']);_0x30c174[_0xde0f('0x40')]=_[_0xde0f('0x3f')](_0xb9ed1[_0xde0f('0x40')]);_0x30c174[_0xde0f('0x4a')]=_['intersection'](_0x30c174[_0xde0f('0x3e')],_0x30c174[_0xde0f('0x40')]);_0xe8495a['attributes']=_[_0xde0f('0x41')](_0x30c174[_0xde0f('0x3e')],qs[_0xde0f('0x43')](_0xb9ed1[_0xde0f('0x40')][_0xde0f('0x43')]));_0xe8495a[_0xde0f('0x42')]=_0xe8495a[_0xde0f('0x42')][_0xde0f('0x44')]?_0xe8495a['attributes']:_0x30c174[_0xde0f('0x3e')];_0xe8495a[_0xde0f('0x46')]=qs[_0xde0f('0x47')](_0xb9ed1[_0xde0f('0x40')][_0xde0f('0x47')]);_0xe8495a[_0xde0f('0x48')]=qs[_0xde0f('0x4a')](_['pick'](_0xb9ed1['query'],_0x30c174['filters']));if(_0xb9ed1[_0xde0f('0x40')][_0xde0f('0x4b')]){_0xe8495a[_0xde0f('0x48')]=_[_0xde0f('0x4c')](_0xe8495a[_0xde0f('0x48')],{'$or':_['map'](_0xe8495a[_0xde0f('0x42')],function(_0x12649c){var _0x1ccca4={};_0x1ccca4[_0x12649c]={'$like':'%'+_0xb9ed1[_0xde0f('0x40')][_0xde0f('0x4b')]+'%'};return _0x1ccca4;})});}if(_0xb9ed1[_0xde0f('0x40')][_0xde0f('0x66')]){var _0x24eb0b=_0xb9ed1['query'][_0xde0f('0x66')][_0xde0f('0x67')](',');var _0x571c53={};_0x571c53[_0x24eb0b[0x0]]={'$gte':moment(_0x24eb0b[0x1])[_0xde0f('0x68')](_0xde0f('0x69'))};_0xe8495a[_0xde0f('0x48')]=_[_0xde0f('0x4c')](_0xe8495a[_0xde0f('0x48')],_0x571c53);}_0xe8495a=_[_0xde0f('0x4c')]({},_0xe8495a,_0xb9ed1[_0xde0f('0x4e')]);return _0x1106eb[_0xde0f('0x6a')](_0xe8495a);}})[_0xde0f('0x1d')](function(_0x1e5933){if(_0x1e5933){_0x4cd728=_0x1e5933['length'];if(!_0xb9ed1['query'][_0xde0f('0x45')](_0xde0f('0x60'))){_0xe8495a['limit']=qs[_0xde0f('0x2b')](_0xb9ed1[_0xde0f('0x40')][_0xde0f('0x2b')]);_0xe8495a[_0xde0f('0x2a')]=qs['offset'](_0xb9ed1[_0xde0f('0x40')][_0xde0f('0x2a')]);}return _0x1106eb[_0xde0f('0x6a')](_0xe8495a);}})['then'](function(_0x5d2566){if(_0x5d2566){return _0x5d2566?{'count':_0x4cd728,'rows':_0x5d2566}:null;}})['then'](respondWithResult(_0x54cdc6,null))['catch'](handleError(_0x54cdc6,null));}; \ No newline at end of file +var _0x0e23=['query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','options','includeAll','findAll','rows','catch','show','params','keys','merge','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','findOne','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','error','code','ChatGroup,\x20%s,\x20%s','message','result','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map'];(function(_0x149902,_0x544173){var _0x5a41a0=function(_0x3ec8cd){while(--_0x3ec8cd){_0x149902['push'](_0x149902['shift']());}};_0x5a41a0(++_0x544173);}(_0x0e23,0xfd));var _0x30e2=function(_0x3b330e,_0x350e11){_0x3b330e=_0x3b330e-0x0;var _0xa61a79=_0x0e23[_0x3b330e];return _0xa61a79;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x30e2('0x0'));var jsonpatch=require(_0x30e2('0x1'));var rp=require(_0x30e2('0x2'));var moment=require(_0x30e2('0x3'));var BPromise=require(_0x30e2('0x4'));var Mustache=require(_0x30e2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x30e2('0x6'));var csv=require('to-csv');var ejs=require(_0x30e2('0x7'));var fs=require('fs');var fs_extra=require(_0x30e2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x30e2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x30e2('0xa'));var toCsv=require(_0x30e2('0xb'));var querystring=require(_0x30e2('0xc'));var Papa=require(_0x30e2('0xd'));var Redis=require(_0x30e2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x30e2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30e2('0x10'))(_0x30e2('0x11'));var utils=require(_0x30e2('0x12'));var config=require(_0x30e2('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x30e2('0x14')]=_[_0x30e2('0x15')](config[_0x30e2('0x14')],{'host':_0x30e2('0x16'),'port':0x18eb});var socket=require(_0x30e2('0x17'))(new Redis(config[_0x30e2('0x14')]));require(_0x30e2('0x18'))[_0x30e2('0x19')](socket);var jayson=require(_0x30e2('0x1a'));var client=jayson[_0x30e2('0x1b')][_0x30e2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3c6058,_0x3094ea,_0x37c657,_0x57207e){return new BPromise(function(_0x5d8e5b,_0xcea097){var _0xf61f6c=_0x57207e||client;return _0xf61f6c[_0x30e2('0x1d')](_0x3c6058,_0x37c657)[_0x30e2('0x1e')](function(_0x565a3e){logger[_0x30e2('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x3094ea,_0x30e2('0x20'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3094ea,_0x30e2('0x20'),JSON['stringify'](_0x565a3e));if(_0x565a3e[_0x30e2('0x21')]){if(_0x565a3e[_0x30e2('0x21')][_0x30e2('0x22')]===0x1f4){logger[_0x30e2('0x21')](_0x30e2('0x23'),_0x3094ea,_0x565a3e[_0x30e2('0x21')]['message']);return _0xcea097(_0x565a3e[_0x30e2('0x21')][_0x30e2('0x24')]);}logger['error'](_0x30e2('0x23'),_0x3094ea,_0x565a3e[_0x30e2('0x21')][_0x30e2('0x24')]);return _0x5d8e5b(_0x565a3e[_0x30e2('0x21')][_0x30e2('0x24')]);}else{logger[_0x30e2('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x3094ea,_0x30e2('0x20'));_0x5d8e5b(_0x565a3e[_0x30e2('0x25')][_0x30e2('0x24')]);}})['catch'](function(_0x488eb9){logger[_0x30e2('0x21')](_0x30e2('0x23'),_0x3094ea,_0x488eb9);_0xcea097(_0x488eb9);});});}function respondWithStatusCode(_0xa992b5,_0xc30703){_0xc30703=_0xc30703||0xcc;return function(_0x5809a5){if(_0x5809a5){return _0xa992b5['sendStatus'](_0xc30703);}return _0xa992b5[_0x30e2('0x26')](_0xc30703)[_0x30e2('0x27')]();};}function respondWithResult(_0x393241,_0x2d84d0){_0x2d84d0=_0x2d84d0||0xc8;return function(_0x4196de){if(_0x4196de){return _0x393241[_0x30e2('0x26')](_0x2d84d0)['json'](_0x4196de);}};}function respondWithFilteredResult(_0x5821e6,_0xbd8671){return function(_0x2a3c2d){if(_0x2a3c2d){var _0x5d596b=typeof _0xbd8671[_0x30e2('0x28')]===_0x30e2('0x29')&&typeof _0xbd8671['limit']===_0x30e2('0x29');var _0x50879e=_0x2a3c2d[_0x30e2('0x2a')];var _0x538045=_0x5d596b?0x0:_0xbd8671['offset'];var _0x561627=_0x5d596b?_0x2a3c2d[_0x30e2('0x2a')]:_0xbd8671[_0x30e2('0x28')]+_0xbd8671[_0x30e2('0x2b')];var _0xa3c94e;if(_0x561627>=_0x50879e){_0x561627=_0x50879e;_0xa3c94e=0xc8;}else{_0xa3c94e=0xce;}_0x5821e6[_0x30e2('0x26')](_0xa3c94e);return _0x5821e6['set'](_0x30e2('0x2c'),_0x538045+'-'+_0x561627+'/'+_0x50879e)['json'](_0x2a3c2d);}return null;};}function patchUpdates(_0x20f89d){return function(_0x244138){try{jsonpatch[_0x30e2('0x2d')](_0x244138,_0x20f89d,!![]);}catch(_0x1f3dab){return BPromise[_0x30e2('0x2e')](_0x1f3dab);}return _0x244138[_0x30e2('0x2f')]();};}function saveUpdates(_0x383327,_0x50aa26){return function(_0x557c23){if(_0x557c23){return _0x557c23[_0x30e2('0x30')](_0x383327)[_0x30e2('0x1e')](function(_0x1db543){return _0x1db543;});}return null;};}function removeEntity(_0x56cf62,_0xfdd003){return function(_0xe486b9){if(_0xe486b9){return _0xe486b9[_0x30e2('0x31')]()[_0x30e2('0x1e')](function(){_0x56cf62['status'](0xcc)[_0x30e2('0x27')]();});}};}function handleEntityNotFound(_0x5dfdf8,_0x19496e){return function(_0x96433c){if(!_0x96433c){_0x5dfdf8[_0x30e2('0x32')](0x194);}return _0x96433c;};}function handleError(_0x34f500,_0x6b0b10){_0x6b0b10=_0x6b0b10||0x1f4;return function(_0x2678b8){logger[_0x30e2('0x21')](_0x2678b8[_0x30e2('0x33')]);if(_0x2678b8[_0x30e2('0x34')]){delete _0x2678b8[_0x30e2('0x34')];}_0x34f500[_0x30e2('0x26')](_0x6b0b10)[_0x30e2('0x35')](_0x2678b8);};}exports[_0x30e2('0x36')]=function(_0x4ad25d,_0x5d1816){var _0x2ea1a={},_0x10c231={},_0x1c943a={'count':0x0,'rows':[]};var _0x3114e8=_['map'](db[_0x30e2('0x37')][_0x30e2('0x38')],function(_0x2b24a8){return{'name':_0x2b24a8[_0x30e2('0x39')],'type':_0x2b24a8[_0x30e2('0x3a')][_0x30e2('0x3b')]};});_0x10c231[_0x30e2('0x3c')]=_[_0x30e2('0x3d')](_0x3114e8,_0x30e2('0x34'));_0x10c231[_0x30e2('0x3e')]=_['keys'](_0x4ad25d['query']);_0x10c231[_0x30e2('0x3f')]=_[_0x30e2('0x40')](_0x10c231[_0x30e2('0x3c')],_0x10c231['query']);_0x2ea1a[_0x30e2('0x41')]=_[_0x30e2('0x40')](_0x10c231[_0x30e2('0x3c')],qs[_0x30e2('0x42')](_0x4ad25d['query']['fields']));_0x2ea1a[_0x30e2('0x41')]=_0x2ea1a['attributes'][_0x30e2('0x43')]?_0x2ea1a[_0x30e2('0x41')]:_0x10c231[_0x30e2('0x3c')];if(!_0x4ad25d[_0x30e2('0x3e')]['hasOwnProperty'](_0x30e2('0x44'))){_0x2ea1a[_0x30e2('0x2b')]=qs['limit'](_0x4ad25d['query'][_0x30e2('0x2b')]);_0x2ea1a['offset']=qs[_0x30e2('0x28')](_0x4ad25d['query'][_0x30e2('0x28')]);}_0x2ea1a['order']=qs[_0x30e2('0x45')](_0x4ad25d['query'][_0x30e2('0x45')]);_0x2ea1a[_0x30e2('0x46')]=qs[_0x30e2('0x3f')](_[_0x30e2('0x47')](_0x4ad25d[_0x30e2('0x3e')],_0x10c231[_0x30e2('0x3f')]),_0x3114e8);if(_0x4ad25d[_0x30e2('0x3e')][_0x30e2('0x48')]){_0x2ea1a['where']=_['merge'](_0x2ea1a[_0x30e2('0x46')],{'$or':_[_0x30e2('0x3d')](_0x3114e8,function(_0x18f167){if(_0x18f167[_0x30e2('0x3a')]!=='VIRTUAL'){var _0x3345ef={};_0x3345ef[_0x18f167['name']]={'$like':'%'+_0x4ad25d[_0x30e2('0x3e')]['filter']+'%'};return _0x3345ef;}})});}_0x2ea1a=_['merge']({},_0x2ea1a,_0x4ad25d[_0x30e2('0x49')]);var _0xd5b4f={'where':_0x2ea1a[_0x30e2('0x46')]};return db['ChatGroup']['count'](_0xd5b4f)[_0x30e2('0x1e')](function(_0x58b594){_0x1c943a['count']=_0x58b594;if(_0x4ad25d[_0x30e2('0x3e')][_0x30e2('0x4a')]){_0x2ea1a['include']=[{'all':!![]}];}return db[_0x30e2('0x37')][_0x30e2('0x4b')](_0x2ea1a);})['then'](function(_0x5eee06){_0x1c943a[_0x30e2('0x4c')]=_0x5eee06;return _0x1c943a;})[_0x30e2('0x1e')](respondWithFilteredResult(_0x5d1816,_0x2ea1a))[_0x30e2('0x4d')](handleError(_0x5d1816,null));};exports[_0x30e2('0x4e')]=function(_0x5b9eab,_0x349361){var _0x3957e5={'raw':!![],'where':{'id':_0x5b9eab[_0x30e2('0x4f')]['id']}},_0x173cbf={};_0x173cbf[_0x30e2('0x3c')]=_['keys'](db[_0x30e2('0x37')]['rawAttributes']);_0x173cbf['query']=_[_0x30e2('0x50')](_0x5b9eab['query']);_0x173cbf[_0x30e2('0x3f')]=_[_0x30e2('0x40')](_0x173cbf[_0x30e2('0x3c')],_0x173cbf[_0x30e2('0x3e')]);_0x3957e5['attributes']=_[_0x30e2('0x40')](_0x173cbf[_0x30e2('0x3c')],qs[_0x30e2('0x42')](_0x5b9eab[_0x30e2('0x3e')][_0x30e2('0x42')]));_0x3957e5[_0x30e2('0x41')]=_0x3957e5[_0x30e2('0x41')][_0x30e2('0x43')]?_0x3957e5[_0x30e2('0x41')]:_0x173cbf[_0x30e2('0x3c')];if(_0x5b9eab[_0x30e2('0x3e')]['includeAll']){_0x3957e5['include']=[{'all':!![]}];}_0x3957e5=_[_0x30e2('0x51')]({},_0x3957e5,_0x5b9eab[_0x30e2('0x49')]);return db[_0x30e2('0x37')]['find'](_0x3957e5)[_0x30e2('0x1e')](handleEntityNotFound(_0x349361,null))[_0x30e2('0x1e')](respondWithResult(_0x349361,null))[_0x30e2('0x4d')](handleError(_0x349361,null));};exports[_0x30e2('0x52')]=function(_0x1f3a46,_0x202997){return db[_0x30e2('0x37')][_0x30e2('0x52')](_0x1f3a46[_0x30e2('0x53')],{})['then'](respondWithResult(_0x202997,0xc9))[_0x30e2('0x4d')](handleError(_0x202997,null));};exports[_0x30e2('0x30')]=function(_0x2978e4,_0x5ddd54){if(_0x2978e4[_0x30e2('0x53')]['id']){delete _0x2978e4['body']['id'];}return db['ChatGroup'][_0x30e2('0x54')]({'where':{'id':_0x2978e4['params']['id']}})[_0x30e2('0x1e')](handleEntityNotFound(_0x5ddd54,null))[_0x30e2('0x1e')](saveUpdates(_0x2978e4['body'],null))[_0x30e2('0x1e')](respondWithResult(_0x5ddd54,null))['catch'](handleError(_0x5ddd54,null));};exports[_0x30e2('0x31')]=function(_0x4a499e,_0xc00fb7){return db['ChatGroup'][_0x30e2('0x54')]({'where':{'id':_0x4a499e[_0x30e2('0x4f')]['id']}})['then'](handleEntityNotFound(_0xc00fb7,null))[_0x30e2('0x1e')](removeEntity(_0xc00fb7,null))['catch'](handleError(_0xc00fb7,null));};exports['describe']=function(_0x5955e4,_0x5ced8a){return db[_0x30e2('0x37')][_0x30e2('0x55')]()[_0x30e2('0x1e')](respondWithResult(_0x5ced8a,null))[_0x30e2('0x4d')](handleError(_0x5ced8a,null));};exports[_0x30e2('0x56')]=function(_0x52f203,_0x28ba10,_0x473806){return db[_0x30e2('0x57')]['count']({'where':{'ChatGroupId':_0x52f203[_0x30e2('0x4f')]['id'],'ToId':_0x52f203['user']['id'],'read':![]}})[_0x30e2('0x1e')](function(_0x4d8025){return{'id':_[_0x30e2('0x58')](_0x52f203[_0x30e2('0x4f')]['id']),'count':_0x4d8025};})[_0x30e2('0x1e')](respondWithResult(_0x28ba10,null))[_0x30e2('0x4d')](handleError(_0x28ba10,null));};exports[_0x30e2('0x59')]=function(_0x17376b,_0x44b05c,_0x615ab0){return db[_0x30e2('0x37')]['find']({'where':{'id':_0x17376b['params']['id']}})[_0x30e2('0x1e')](handleEntityNotFound(_0x44b05c,null))['then'](function(_0x2d104e){if(_0x2d104e){return _0x2d104e[_0x30e2('0x59')](_0x17376b[_0x30e2('0x53')][_0x30e2('0x5a')],_[_0x30e2('0x5b')](_0x17376b[_0x30e2('0x53')],[_0x30e2('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x44b05c,null))[_0x30e2('0x4d')](handleError(_0x44b05c,null));};exports[_0x30e2('0x5c')]=function(_0x243924,_0xee50bd,_0x5837c7){var _0x1dd359={};var _0x2638a7={};var _0x511d0c;var _0x43d2cf;return db[_0x30e2('0x37')]['findOne']({'where':{'id':_0x243924[_0x30e2('0x4f')]['id']}})[_0x30e2('0x1e')](handleEntityNotFound(_0xee50bd,null))[_0x30e2('0x1e')](function(_0xaf46ce){if(_0xaf46ce){_0x511d0c=_0xaf46ce;_0x2638a7[_0x30e2('0x3c')]=_[_0x30e2('0x50')](db[_0x30e2('0x5d')][_0x30e2('0x38')]);_0x2638a7[_0x30e2('0x3e')]=_[_0x30e2('0x50')](_0x243924[_0x30e2('0x3e')]);_0x2638a7[_0x30e2('0x3f')]=_['intersection'](_0x2638a7[_0x30e2('0x3c')],_0x2638a7[_0x30e2('0x3e')]);_0x1dd359[_0x30e2('0x41')]=_[_0x30e2('0x40')](_0x2638a7[_0x30e2('0x3c')],qs['fields'](_0x243924[_0x30e2('0x3e')][_0x30e2('0x42')]));_0x1dd359[_0x30e2('0x41')]=_0x1dd359['attributes']['length']?_0x1dd359[_0x30e2('0x41')]:_0x2638a7['model'];_0x1dd359['order']=qs['sort'](_0x243924[_0x30e2('0x3e')][_0x30e2('0x45')]);_0x1dd359[_0x30e2('0x46')]=qs['filters'](_[_0x30e2('0x47')](_0x243924[_0x30e2('0x3e')],_0x2638a7[_0x30e2('0x3f')]));if(_0x243924['query']['filter']){_0x1dd359[_0x30e2('0x46')]=_[_0x30e2('0x51')](_0x1dd359[_0x30e2('0x46')],{'$or':_[_0x30e2('0x3d')](_0x1dd359[_0x30e2('0x41')],function(_0x3aec9b){var _0x41d5d5={};_0x41d5d5[_0x3aec9b]={'$like':'%'+_0x243924['query']['filter']+'%'};return _0x41d5d5;})});}_0x1dd359=_[_0x30e2('0x51')]({},_0x1dd359,_0x243924['options']);return _0x511d0c[_0x30e2('0x5c')](_0x1dd359);}})[_0x30e2('0x1e')](function(_0x411f63){if(_0x411f63){_0x43d2cf=_0x411f63['length'];if(!_0x243924['query'][_0x30e2('0x5e')]('nolimit')){_0x1dd359[_0x30e2('0x2b')]=qs[_0x30e2('0x2b')](_0x243924[_0x30e2('0x3e')][_0x30e2('0x2b')]);_0x1dd359[_0x30e2('0x28')]=qs['offset'](_0x243924['query']['offset']);}return _0x511d0c[_0x30e2('0x5c')](_0x1dd359);}})[_0x30e2('0x1e')](function(_0x52aee2){if(_0x52aee2){return _0x52aee2?{'count':_0x43d2cf,'rows':_0x52aee2}:null;}})[_0x30e2('0x1e')](respondWithResult(_0xee50bd,null))['catch'](handleError(_0xee50bd,null));};exports[_0x30e2('0x5f')]=function(_0x2b6d79,_0x29251c,_0x252370){return db['ChatGroup'][_0x30e2('0x54')]({'where':{'id':_0x2b6d79[_0x30e2('0x4f')]['id']}})[_0x30e2('0x1e')](handleEntityNotFound(_0x29251c,null))['then'](function(_0x275ed3){if(_0x275ed3){return _0x275ed3[_0x30e2('0x5f')](_0x2b6d79['query'][_0x30e2('0x5a')]);}})[_0x30e2('0x1e')](respondWithStatusCode(_0x29251c,null))[_0x30e2('0x4d')](handleError(_0x29251c,null));};exports[_0x30e2('0x60')]=function(_0x406974,_0x281959,_0x555c01){if(_0x406974['body']['id']){delete _0x406974[_0x30e2('0x53')]['id'];}return db['ChatGroup'][_0x30e2('0x54')]({'where':{'id':_0x406974['params']['id']}})[_0x30e2('0x1e')](handleEntityNotFound(_0x281959,null))[_0x30e2('0x1e')](function(_0xcadd43){if(_0xcadd43){_0x406974[_0x30e2('0x53')][_0x30e2('0x61')]=_0xcadd43['id'];return db[_0x30e2('0x57')]['create'](_0x406974['body']);}})[_0x30e2('0x1e')](respondWithResult(_0x281959,null))[_0x30e2('0x4d')](handleError(_0x281959,null));};exports['getMessages']=function(_0x5c515e,_0x53056c,_0x6f0c48){var _0x519cd5={};var _0x6b1077={};var _0x49771d;var _0x15b9e0;return db[_0x30e2('0x37')][_0x30e2('0x62')]({'where':{'id':_0x5c515e['params']['id']}})[_0x30e2('0x1e')](handleEntityNotFound(_0x53056c,null))[_0x30e2('0x1e')](function(_0x47c93b){if(_0x47c93b){_0x49771d=_0x47c93b;_0x6b1077['model']=_[_0x30e2('0x50')](db[_0x30e2('0x57')][_0x30e2('0x38')]);_0x6b1077[_0x30e2('0x3e')]=_[_0x30e2('0x50')](_0x5c515e[_0x30e2('0x3e')]);_0x6b1077[_0x30e2('0x3f')]=_['intersection'](_0x6b1077[_0x30e2('0x3c')],_0x6b1077[_0x30e2('0x3e')]);_0x519cd5['attributes']=_[_0x30e2('0x40')](_0x6b1077['model'],qs[_0x30e2('0x42')](_0x5c515e[_0x30e2('0x3e')][_0x30e2('0x42')]));_0x519cd5[_0x30e2('0x41')]=_0x519cd5['attributes'][_0x30e2('0x43')]?_0x519cd5[_0x30e2('0x41')]:_0x6b1077[_0x30e2('0x3c')];_0x519cd5[_0x30e2('0x63')]=qs[_0x30e2('0x45')](_0x5c515e['query']['sort']);_0x519cd5[_0x30e2('0x46')]=qs[_0x30e2('0x3f')](_[_0x30e2('0x47')](_0x5c515e['query'],_0x6b1077['filters']));if(_0x5c515e[_0x30e2('0x3e')]['filter']){_0x519cd5[_0x30e2('0x46')]=_[_0x30e2('0x51')](_0x519cd5[_0x30e2('0x46')],{'$or':_['map'](_0x519cd5[_0x30e2('0x41')],function(_0x170b8a){var _0x59e687={};_0x59e687[_0x170b8a]={'$like':'%'+_0x5c515e[_0x30e2('0x3e')][_0x30e2('0x48')]+'%'};return _0x59e687;})});}if(_0x5c515e[_0x30e2('0x3e')]['$gte']){var _0x2fa785=_0x5c515e[_0x30e2('0x3e')][_0x30e2('0x64')][_0x30e2('0x65')](',');var _0x546483={};_0x546483[_0x2fa785[0x0]]={'$gte':moment(_0x2fa785[0x1])[_0x30e2('0x66')](_0x30e2('0x67'))};_0x519cd5['where']=_[_0x30e2('0x51')](_0x519cd5[_0x30e2('0x46')],_0x546483);}_0x519cd5=_['merge']({},_0x519cd5,_0x5c515e['options']);return _0x49771d['getMessages'](_0x519cd5);}})[_0x30e2('0x1e')](function(_0x5616d6){if(_0x5616d6){_0x15b9e0=_0x5616d6['length'];if(!_0x5c515e['query'][_0x30e2('0x5e')](_0x30e2('0x44'))){_0x519cd5['limit']=qs[_0x30e2('0x2b')](_0x5c515e[_0x30e2('0x3e')]['limit']);_0x519cd5[_0x30e2('0x28')]=qs['offset'](_0x5c515e[_0x30e2('0x3e')][_0x30e2('0x28')]);}return _0x49771d[_0x30e2('0x68')](_0x519cd5);}})['then'](function(_0x22066d){if(_0x22066d){return _0x22066d?{'count':_0x15b9e0,'rows':_0x22066d}:null;}})[_0x30e2('0x1e')](respondWithResult(_0x53056c,null))[_0x30e2('0x4d')](handleError(_0x53056c,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index eb77c1c..37f4bb6 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x32ea4c,_0x2d84a1){var _0x1861b4=function(_0x310ab4){while(--_0x310ab4){_0x32ea4c['push'](_0x32ea4c['shift']());}};_0x1861b4(++_0x2d84a1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x39d532,_0x4a561e){_0x39d532=_0x39d532-0x0;var _0x56cdf8=_0x5f2f[_0x39d532];return _0x56cdf8;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x5d02c4,_0x1bbd82){var _0x1e74ba=function(_0x36325){while(--_0x36325){_0x5d02c4['push'](_0x5d02c4['shift']());}};_0x1e74ba(++_0x1bbd82);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x0b0e[_0x5b5cde];return _0x364ad2;};'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 84e3c89..3c45168 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 _0x9485=['request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','util','../../config/logger','api','bluebird'];(function(_0x1defa0,_0x373af5){var _0x36798c=function(_0x296b33){while(--_0x296b33){_0x1defa0['push'](_0x1defa0['shift']());}};_0x36798c(++_0x373af5);}(_0x9485,0x8b));var _0x5948=function(_0x3ddfd5,_0x56c373){_0x3ddfd5=_0x3ddfd5-0x0;var _0x44855e=_0x9485[_0x3ddfd5];return _0x44855e;};'use strict';var _=require(_0x5948('0x0'));var util=require(_0x5948('0x1'));var logger=require(_0x5948('0x2'))(_0x5948('0x3'));var moment=require('moment');var BPromise=require(_0x5948('0x4'));var rp=require(_0x5948('0x5'));var fs=require('fs');var path=require(_0x5948('0x6'));var rimraf=require('rimraf');var config=require(_0x5948('0x7'));var attributes=require(_0x5948('0x8'));module[_0x5948('0x9')]=function(_0x4312a8,_0x19ccdd){return _0x4312a8[_0x5948('0xa')]('ChatGroup',attributes,{'tableName':_0x5948('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f75=['ChatGroup','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x1efd69,_0x3c925f){var _0x257a69=function(_0x5a2279){while(--_0x5a2279){_0x1efd69['push'](_0x1efd69['shift']());}};_0x257a69(++_0x3c925f);}(_0x1f75,0x12c));var _0x51f7=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x1f75[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x51f7('0x0'));var util=require(_0x51f7('0x1'));var logger=require(_0x51f7('0x2'))('api');var moment=require(_0x51f7('0x3'));var BPromise=require(_0x51f7('0x4'));var rp=require(_0x51f7('0x5'));var fs=require('fs');var path=require(_0x51f7('0x6'));var rimraf=require(_0x51f7('0x7'));var config=require(_0x51f7('0x8'));var attributes=require(_0x51f7('0x9'));module[_0x51f7('0xa')]=function(_0x292480,_0x22fc29){return _0x292480[_0x51f7('0xb')](_0x51f7('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5241ba4..141f565 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 _0xf25e=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./chatGroup.socket','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3ffcb2,_0x35e65f){var _0xe5182d=function(_0x56e779){while(--_0x56e779){_0x3ffcb2['push'](_0x3ffcb2['shift']());}};_0xe5182d(++_0x35e65f);}(_0xf25e,0xf6));var _0xef25=function(_0x3a2777,_0x4f1968){_0x3a2777=_0x3a2777-0x0;var _0x173fff=_0xf25e[_0x3a2777];return _0x173fff;};'use strict';var _=require(_0xef25('0x0'));var util=require(_0xef25('0x1'));var moment=require('moment');var BPromise=require(_0xef25('0x2'));var rs=require(_0xef25('0x3'));var fs=require('fs');var Redis=require(_0xef25('0x4'));var db=require(_0xef25('0x5'))['db'];var utils=require(_0xef25('0x6'));var logger=require('../../config/logger')(_0xef25('0x7'));var config=require(_0xef25('0x8'));var jayson=require(_0xef25('0x9'));var client=jayson[_0xef25('0xa')][_0xef25('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xef25('0xc'),'port':0x18eb});var socket=require(_0xef25('0xd'))(new Redis(config[_0xef25('0xe')]));require(_0xef25('0xf'))[_0xef25('0x10')](socket);function respondWithRpcPromise(_0x34fe9a,_0x3fbc59,_0x2565b0){return new BPromise(function(_0x150145,_0x317882){return client[_0xef25('0x11')](_0x34fe9a,_0x2565b0)['then'](function(_0x31ea2e){logger[_0xef25('0x12')]('ChatGroup,\x20%s,\x20%s',_0x3fbc59,_0xef25('0x13'));logger[_0xef25('0x14')](_0xef25('0x15'),_0x3fbc59,_0xef25('0x13'),JSON[_0xef25('0x16')](_0x31ea2e));if(_0x31ea2e['error']){if(_0x31ea2e[_0xef25('0x17')]['code']===0x1f4){logger['error'](_0xef25('0x18'),_0x3fbc59,_0x31ea2e[_0xef25('0x17')]['message']);return _0x317882(_0x31ea2e[_0xef25('0x17')][_0xef25('0x19')]);}logger['error'](_0xef25('0x18'),_0x3fbc59,_0x31ea2e['error'][_0xef25('0x19')]);return _0x150145(_0x31ea2e['error'][_0xef25('0x19')]);}else{logger[_0xef25('0x12')](_0xef25('0x18'),_0x3fbc59,_0xef25('0x13'));_0x150145(_0x31ea2e[_0xef25('0x1a')][_0xef25('0x19')]);}})[_0xef25('0x1b')](function(_0x541369){logger['error']('ChatGroup,\x20%s,\x20%s',_0x3fbc59,_0x541369);_0x317882(_0x541369);});});} \ No newline at end of file +var _0xe5d3=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','localhost','redis','./chatGroup.socket','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xe5d3,0x1ad));var _0x3e5d=function(_0x515f78,_0x3b69be){_0x515f78=_0x515f78-0x0;var _0x506f6c=_0xe5d3[_0x515f78];return _0x506f6c;};'use strict';var _=require(_0x3e5d('0x0'));var util=require(_0x3e5d('0x1'));var moment=require(_0x3e5d('0x2'));var BPromise=require(_0x3e5d('0x3'));var rs=require(_0x3e5d('0x4'));var fs=require('fs');var Redis=require(_0x3e5d('0x5'));var db=require(_0x3e5d('0x6'))['db'];var utils=require(_0x3e5d('0x7'));var logger=require(_0x3e5d('0x8'))(_0x3e5d('0x9'));var config=require('../../config/environment');var jayson=require(_0x3e5d('0xa'));var client=jayson['client'][_0x3e5d('0xb')]({'port':0x232a});config['redis']=_[_0x3e5d('0xc')](config['redis'],{'host':_0x3e5d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e5d('0xe')]));require(_0x3e5d('0xf'))['register'](socket);function respondWithRpcPromise(_0x15b7f8,_0x1c4af4,_0x581419){return new BPromise(function(_0x23f528,_0x2d116c){return client[_0x3e5d('0x10')](_0x15b7f8,_0x581419)[_0x3e5d('0x11')](function(_0x766299){logger['info']('ChatGroup,\x20%s,\x20%s',_0x1c4af4,_0x3e5d('0x12'));logger[_0x3e5d('0x13')](_0x3e5d('0x14'),_0x1c4af4,_0x3e5d('0x12'),JSON[_0x3e5d('0x15')](_0x766299));if(_0x766299[_0x3e5d('0x16')]){if(_0x766299['error'][_0x3e5d('0x17')]===0x1f4){logger['error'](_0x3e5d('0x18'),_0x1c4af4,_0x766299[_0x3e5d('0x16')][_0x3e5d('0x19')]);return _0x2d116c(_0x766299[_0x3e5d('0x16')][_0x3e5d('0x19')]);}logger[_0x3e5d('0x16')](_0x3e5d('0x18'),_0x1c4af4,_0x766299['error']['message']);return _0x23f528(_0x766299['error']['message']);}else{logger[_0x3e5d('0x1a')](_0x3e5d('0x18'),_0x1c4af4,_0x3e5d('0x12'));_0x23f528(_0x766299[_0x3e5d('0x1b')][_0x3e5d('0x19')]);}})[_0x3e5d('0x1c')](function(_0x5d3b00){logger[_0x3e5d('0x16')](_0x3e5d('0x18'),_0x1c4af4,_0x5d3b00);_0x2d116c(_0x5d3b00);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 60b10d1..e3e7390 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 _0x29bb=['length','chatGroup:','remove','update','emit','removeListener','register'];(function(_0x6b7c2f,_0x293d2a){var _0x3cef8d=function(_0xd2ab1){while(--_0xd2ab1){_0x6b7c2f['push'](_0x6b7c2f['shift']());}};_0x3cef8d(++_0x293d2a);}(_0x29bb,0x113));var _0xb29b=function(_0x112bd0,_0x210742){_0x112bd0=_0x112bd0-0x0;var _0xcf89bf=_0x29bb[_0x112bd0];return _0xcf89bf;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0xb29b('0x0'),_0xb29b('0x1')];function createListener(_0x2a51fe,_0x2728c8){return function(_0x30dcbf){_0x2728c8[_0xb29b('0x2')](_0x2a51fe,_0x30dcbf);};}function removeListener(_0x173ee4,_0x5594e4){return function(){ChatGroupEvents[_0xb29b('0x3')](_0x173ee4,_0x5594e4);};}exports[_0xb29b('0x4')]=function(_0x5892f0){for(var _0x34fc91=0x0,_0xe77214=events[_0xb29b('0x5')];_0x34fc91<_0xe77214;_0x34fc91++){var _0x143990=events[_0x34fc91];var _0x40925e=createListener(_0xb29b('0x6')+_0x143990,_0x5892f0);ChatGroupEvents['on'](_0x143990,_0x40925e);}}; \ No newline at end of file +var _0x9587=['save','remove','update','emit','register','length','chatGroup:'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9587,0x1d5));var _0x7958=function(_0x1d4eb5,_0xa3107b){_0x1d4eb5=_0x1d4eb5-0x0;var _0x395c26=_0x9587[_0x1d4eb5];return _0x395c26;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x7958('0x0'),_0x7958('0x1'),_0x7958('0x2')];function createListener(_0x5c11d5,_0x3c0e48){return function(_0x19b0ba){_0x3c0e48[_0x7958('0x3')](_0x5c11d5,_0x19b0ba);};}function removeListener(_0x5e75e8,_0x197075){return function(){ChatGroupEvents['removeListener'](_0x5e75e8,_0x197075);};}exports[_0x7958('0x4')]=function(_0x2aa691){for(var _0x44b4e0=0x0,_0x156e68=events[_0x7958('0x5')];_0x44b4e0<_0x156e68;_0x44b4e0++){var _0x66fc17=events[_0x44b4e0];var _0x4c1e63=createListener(_0x7958('0x6')+_0x66fc17,_0x2aa691);ChatGroupEvents['on'](_0x66fc17,_0x4c1e63);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 52e48b7..369481e 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 _0x68a5=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getUnread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','removeMembers','exports'];(function(_0x58a09c,_0x1548ba){var _0x4bfc32=function(_0x2aaec1){while(--_0x2aaec1){_0x58a09c['push'](_0x58a09c['shift']());}};_0x4bfc32(++_0x1548ba);}(_0x68a5,0xfc));var _0x568a=function(_0x231dcb,_0x55410){_0x231dcb=_0x231dcb-0x0;var _0x1867ef=_0x68a5[_0x231dcb];return _0x1867ef;};'use strict';var multer=require(_0x568a('0x0'));var util=require('util');var path=require(_0x568a('0x1'));var timeout=require(_0x568a('0x2'));var express=require('express');var router=express[_0x568a('0x3')]();var fs_extra=require(_0x568a('0x4'));var auth=require(_0x568a('0x5'));var interaction=require(_0x568a('0x6'));var config=require('../../config/environment');var controller=require(_0x568a('0x7'));router['get']('/',auth[_0x568a('0x8')](),controller[_0x568a('0x9')]);router[_0x568a('0xa')](_0x568a('0xb'),auth['isAuthenticated'](),controller[_0x568a('0xc')]);router['get'](_0x568a('0xd'),auth[_0x568a('0x8')](),controller[_0x568a('0xe')]);router[_0x568a('0xa')]('/:id/unread',auth['isAuthenticated'](),controller[_0x568a('0xf')]);router[_0x568a('0xa')]('/:id/members',auth[_0x568a('0x8')](),controller['getMembers']);router[_0x568a('0xa')](_0x568a('0x10'),auth[_0x568a('0x8')](),controller[_0x568a('0x11')]);router[_0x568a('0x12')]('/',auth[_0x568a('0x8')](),controller[_0x568a('0x13')]);router[_0x568a('0x12')](_0x568a('0x14'),auth[_0x568a('0x8')](),controller[_0x568a('0x15')]);router[_0x568a('0x12')](_0x568a('0x10'),auth[_0x568a('0x8')](),controller[_0x568a('0x16')]);router[_0x568a('0x17')](_0x568a('0xd'),auth['isAuthenticated'](),controller[_0x568a('0x18')]);router['delete'](_0x568a('0xd'),auth[_0x568a('0x8')](),controller['destroy']);router[_0x568a('0x19')]('/:id/members',auth[_0x568a('0x8')](),controller[_0x568a('0x1a')]);module[_0x568a('0x1b')]=router; \ No newline at end of file +var _0x4213=['addMembers','addMessage','put','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/messages','post','create'];(function(_0x388f1b,_0x1b6254){var _0x36ac35=function(_0x18a203){while(--_0x18a203){_0x388f1b['push'](_0x388f1b['shift']());}};_0x36ac35(++_0x1b6254);}(_0x4213,0x77));var _0x3421=function(_0x14e010,_0x220f30){_0x14e010=_0x14e010-0x0;var _0x322072=_0x4213[_0x14e010];return _0x322072;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/unread',auth[_0x3421('0xa')](),controller['getUnread']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x9')](_0x3421('0x12'),auth[_0x3421('0xa')](),controller['getMessages']);router[_0x3421('0x13')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0x14')]);router[_0x3421('0x13')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x15')]);router['post'](_0x3421('0x12'),auth['isAuthenticated'](),controller[_0x3421('0x16')]);router[_0x3421('0x17')]('/:id',auth[_0x3421('0xa')](),controller['update']);router[_0x3421('0x18')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0x19')]);router[_0x3421('0x18')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x1a')]);module[_0x3421('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 63dc671..ba421f8 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 _0x775d=['ENUM','star','thumb','TEXT','STRING','DATE','long','out','exports','INTEGER'];(function(_0x3d26da,_0x57e7f0){var _0x3dfb46=function(_0x452fdd){while(--_0x452fdd){_0x3d26da['push'](_0x3d26da['shift']());}};_0x3dfb46(++_0x57e7f0);}(_0x775d,0x18e));var _0xd775=function(_0x5c593f,_0x46358e){_0x5c593f=_0x5c593f-0x0;var _0x1d5b52=_0x775d[_0x5c593f];return _0x1d5b52;};'use strict';var Sequelize=require('sequelize');module[_0xd775('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd775('0x1')]},'ratingType':{'type':Sequelize[_0xd775('0x2')](_0xd775('0x3'),_0xd775('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xd775('0x5')]},'pathTranscript':{'type':Sequelize[_0xd775('0x5')]},'mailTranscript':{'type':Sequelize[_0xd775('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd775('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd775('0x6')]},'thirdDisposition':{'type':Sequelize[_0xd775('0x6')]},'note':{'type':Sequelize[_0xd775('0x6')]},'browserName':{'type':Sequelize[_0xd775('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xd775('0x6')]},'osVersion':{'type':Sequelize[_0xd775('0x6')]},'deviceModel':{'type':Sequelize[_0xd775('0x6')]},'deviceVendor':{'type':Sequelize[_0xd775('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xd775('0x5')]},'customerIp':{'type':Sequelize[_0xd775('0x6')]},'formData':{'type':Sequelize[_0xd775('0x5')](_0xd775('0x8'))},'read1stAt':{'type':Sequelize[_0xd775('0x7')]},'lastMsgAt':{'type':Sequelize[_0xd775('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xd775('0x2')]('in',_0xd775('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd775('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xd775('0x5')]}}; \ No newline at end of file +var _0x7956=['DATE','TEXT','long','sequelize','exports','INTEGER','ENUM','star','STRING'];(function(_0x4b1012,_0x1415eb){var _0x23d715=function(_0x25f330){while(--_0x25f330){_0x4b1012['push'](_0x4b1012['shift']());}};_0x23d715(++_0x1415eb);}(_0x7956,0x1bc));var _0x6795=function(_0xac6ab7,_0x514106){_0xac6ab7=_0xac6ab7-0x0;var _0x1ed1c4=_0x7956[_0xac6ab7];return _0x1ed1c4;};'use strict';var Sequelize=require(_0x6795('0x0'));module[_0x6795('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6795('0x2')]},'ratingType':{'type':Sequelize[_0x6795('0x3')](_0x6795('0x4'),'thumb'),'defaultValue':_0x6795('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x6795('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6795('0x6')]},'disposition':{'type':Sequelize[_0x6795('0x5')]},'secondDisposition':{'type':Sequelize[_0x6795('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6795('0x5')]},'note':{'type':Sequelize[_0x6795('0x5')]},'browserName':{'type':Sequelize[_0x6795('0x5')]},'browserVersion':{'type':Sequelize[_0x6795('0x5')]},'osName':{'type':Sequelize[_0x6795('0x5')]},'osVersion':{'type':Sequelize[_0x6795('0x5')]},'deviceModel':{'type':Sequelize[_0x6795('0x5')]},'deviceVendor':{'type':Sequelize[_0x6795('0x5')]},'deviceType':{'type':Sequelize[_0x6795('0x5')]},'referer':{'type':Sequelize[_0x6795('0x7')]},'customerIp':{'type':Sequelize[_0x6795('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x6795('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x6795('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x6795('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6795('0x5')]},'customerPort':{'type':Sequelize[_0x6795('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x6795('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index eb0adc6..9f393a2 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 _0xbc53=['alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','secret','includeAgent','includeAll','findAll','setTags','omit','chatInteractionTags:save','removeTags','unix','server','files','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','set','apply','reject','save','update','sendStatus','stack','name','merge','body','contact','agent','interaction','account','map','Tags','TagIds','split','forEach','push','index','ChatInteraction','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','some','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','$gte','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','count','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.email','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ChatInteractionId','all','rows','params','rawAttributes','include','options','create','destroy','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','ChatWebsite','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias'];(function(_0x2c9e03,_0x3f8cc1){var _0x36c756=function(_0x53116a){while(--_0x53116a){_0x2c9e03['push'](_0x2c9e03['shift']());}};_0x36c756(++_0x3f8cc1);}(_0xbc53,0x180));var _0x3bc5=function(_0x52dcbc,_0x19e173){_0x52dcbc=_0x52dcbc-0x0;var _0x39b16a=_0xbc53[_0x52dcbc];return _0x39b16a;};'use strict';var emlformat=require(_0x3bc5('0x0'));var rimraf=require(_0x3bc5('0x1'));var zipdir=require(_0x3bc5('0x2'));var jsonpatch=require(_0x3bc5('0x3'));var rp=require(_0x3bc5('0x4'));var moment=require(_0x3bc5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3bc5('0x6'));var util=require(_0x3bc5('0x7'));var path=require(_0x3bc5('0x8'));var sox=require(_0x3bc5('0x9'));var csv=require(_0x3bc5('0xa'));var ejs=require(_0x3bc5('0xb'));var fs=require('fs');var fs_extra=require(_0x3bc5('0xc'));var _=require(_0x3bc5('0xd'));var squel=require(_0x3bc5('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3bc5('0xf'));var Papa=require(_0x3bc5('0x10'));var Redis=require(_0x3bc5('0x11'));var authService=require(_0x3bc5('0x12'));var qs=require(_0x3bc5('0x13'));var as=require(_0x3bc5('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x3bc5('0x15'));var logger=require(_0x3bc5('0x16'))(_0x3bc5('0x17'));var utils=require(_0x3bc5('0x18'));var config=require(_0x3bc5('0x19'));var licenseUtil=require(_0x3bc5('0x1a'));var db=require('../../mysqldb')['db'];config[_0x3bc5('0x1b')]=_[_0x3bc5('0x1c')](config[_0x3bc5('0x1b')],{'host':_0x3bc5('0x1d'),'port':0x18eb});var socket=require(_0x3bc5('0x1e'))(new Redis(config['redis']));require(_0x3bc5('0x1f'))[_0x3bc5('0x20')](socket);var jayson=require(_0x3bc5('0x21'));var client=jayson[_0x3bc5('0x22')][_0x3bc5('0x23')]({'port':0x232b});var client9004=jayson[_0x3bc5('0x22')][_0x3bc5('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x4110e5,_0x59ac99,_0x26b648,_0x1cf18){return new BPromise(function(_0x11dff1,_0x266875){var _0x346e1a=_0x1cf18||client;return _0x346e1a[_0x3bc5('0x24')](_0x4110e5,_0x26b648)[_0x3bc5('0x25')](function(_0x3c9c1e){logger[_0x3bc5('0x26')](_0x3bc5('0x27'),_0x59ac99,_0x3bc5('0x28'));logger[_0x3bc5('0x29')](_0x3bc5('0x2a'),_0x59ac99,'request\x20sent',JSON[_0x3bc5('0x2b')](_0x3c9c1e));if(_0x3c9c1e['error']){if(_0x3c9c1e[_0x3bc5('0x2c')][_0x3bc5('0x2d')]===0x1f4){logger[_0x3bc5('0x2c')](_0x3bc5('0x27'),_0x59ac99,_0x3c9c1e[_0x3bc5('0x2c')][_0x3bc5('0x2e')]);return _0x266875(_0x3c9c1e['error']['message']);}logger['error'](_0x3bc5('0x27'),_0x59ac99,_0x3c9c1e['error'][_0x3bc5('0x2e')]);return _0x11dff1(_0x3c9c1e[_0x3bc5('0x2c')][_0x3bc5('0x2e')]);}else{logger[_0x3bc5('0x26')](_0x3bc5('0x27'),_0x59ac99,'request\x20sent');_0x11dff1(_0x3c9c1e[_0x3bc5('0x2f')][_0x3bc5('0x2e')]);}})[_0x3bc5('0x30')](function(_0x1627f7){logger['error'](_0x3bc5('0x27'),_0x59ac99,_0x1627f7);_0x266875(_0x1627f7);});});}function respondWithStatusCode(_0x441866,_0x30f611){_0x30f611=_0x30f611||0xcc;return function(_0x3bbcd6){if(_0x3bbcd6){return _0x441866['sendStatus'](_0x30f611);}return _0x441866[_0x3bc5('0x31')](_0x30f611)[_0x3bc5('0x32')]();};}function respondWithResult(_0x5e0b64,_0x191822){_0x191822=_0x191822||0xc8;return function(_0x2c5307){if(_0x2c5307){return _0x5e0b64[_0x3bc5('0x31')](_0x191822)[_0x3bc5('0x33')](_0x2c5307);}};}function respondWithFilteredResult(_0x1cf02a,_0x5b6590){return function(_0x209479){if(_0x209479){var _0x429681=typeof _0x5b6590[_0x3bc5('0x34')]===_0x3bc5('0x35')&&typeof _0x5b6590[_0x3bc5('0x36')]===_0x3bc5('0x35');var _0x9a2c9c=_0x209479['count'];var _0x24b7f8=_0x429681?0x0:_0x5b6590[_0x3bc5('0x34')];var _0x1ef2e9=_0x429681?_0x209479['count']:_0x5b6590[_0x3bc5('0x34')]+_0x5b6590['limit'];var _0x12a896;if(_0x1ef2e9>=_0x9a2c9c){_0x1ef2e9=_0x9a2c9c;_0x12a896=0xc8;}else{_0x12a896=0xce;}_0x1cf02a[_0x3bc5('0x31')](_0x12a896);return _0x1cf02a[_0x3bc5('0x37')]('Content-Range',_0x24b7f8+'-'+_0x1ef2e9+'/'+_0x9a2c9c)[_0x3bc5('0x33')](_0x209479);}return null;};}function patchUpdates(_0x154eb8){return function(_0x101476){try{jsonpatch[_0x3bc5('0x38')](_0x101476,_0x154eb8,!![]);}catch(_0x20ca4e){return BPromise[_0x3bc5('0x39')](_0x20ca4e);}return _0x101476[_0x3bc5('0x3a')]();};}function saveUpdates(_0x3abf8e,_0x1f3356){return function(_0x4576a5){if(_0x4576a5){return _0x4576a5[_0x3bc5('0x3b')](_0x3abf8e)['then'](function(_0x566db7){return _0x566db7;});}return null;};}function removeEntity(_0x2168ca,_0x29f8fe){return function(_0x39df21){if(_0x39df21){return _0x39df21['destroy']()['then'](function(){_0x2168ca[_0x3bc5('0x31')](0xcc)[_0x3bc5('0x32')]();});}};}function handleEntityNotFound(_0x33aaef,_0x2ac9c8){return function(_0x206eb2){if(!_0x206eb2){_0x33aaef[_0x3bc5('0x3c')](0x194);}return _0x206eb2;};}function handleError(_0x13a56f,_0xf0f0d4){_0xf0f0d4=_0xf0f0d4||0x1f4;return function(_0x2d5eed){logger['error'](_0x2d5eed[_0x3bc5('0x3d')]);if(_0x2d5eed['name']){delete _0x2d5eed[_0x3bc5('0x3e')];}_0x13a56f['status'](_0xf0f0d4)['send'](_0x2d5eed);};}function getMustacheRender(_0x2278b3,_0x49800d){return Mustache['render'](_0x2278b3,_[_0x3bc5('0x3f')](_0x49800d[_0x3bc5('0x40')],{'contact':_0x49800d[_0x3bc5('0x41')],'message':_0x49800d['message'],'agent':_0x49800d[_0x3bc5('0x42')],'interaction':_0x49800d[_0x3bc5('0x43')],'account':_0x49800d[_0x3bc5('0x44')]}))||'';}function getInteractionUsers(_0x148cd8,_0x1f38aa){return new BPromise(function(_0x2f8b5a,_0x3ac30c){try{if(_0x1f38aa[_0x148cd8['id']]){_0x148cd8['Users']=_[_0x3bc5('0x45')](_0x1f38aa[_0x148cd8['id']],function(_0x686b0f){return{'id':_0x686b0f['id'],'fullname':_0x686b0f['fullname']};});}}catch(_0x159c3f){_0x3ac30c(_0x159c3f);}_0x2f8b5a(_0x148cd8);});}function getInteractionTags(_0x2f967c,_0x4b6ad3){return new BPromise(function(_0x1ce7bc,_0x4932c8){try{if(_0x2f967c['TagIds']){_0x2f967c[_0x3bc5('0x46')]=[];_0x2f967c[_0x3bc5('0x47')][_0x3bc5('0x48')](',')[_0x3bc5('0x49')](function(_0x261919){_0x2f967c[_0x3bc5('0x46')][_0x3bc5('0x4a')](_0x4b6ad3[_0x261919]);});}delete _0x2f967c[_0x3bc5('0x47')];}catch(_0x5457a4){_0x4932c8(_0x5457a4);}_0x1ce7bc(_0x2f967c);});}function updateChatInteraction(_0x16e8a0,_0x28432c,_0xa955e){return new BPromise(function(_0xe84986,_0x489af3){return getInteractionUsers(_0x16e8a0,_0xa955e)[_0x3bc5('0x25')](function(_0x4bc361){return getInteractionTags(_0x4bc361,_0x28432c);})[_0x3bc5('0x25')](function(_0x2c090b){_0xe84986(_0x2c090b);})['catch'](function(_0x351c71){_0x489af3(_0x351c71);});});}exports[_0x3bc5('0x4b')]=function(_0x5e8be3,_0x43f4a4){var _0x521e93={},_0x38ad75={},_0xec2117={'count':0x0,'rows':[]};var _0x5e69d0=_['map'](db[_0x3bc5('0x4c')]['rawAttributes'],function(_0x48834b){return{'name':_0x48834b[_0x3bc5('0x4d')],'type':_0x48834b[_0x3bc5('0x4e')]['key']};});_0x38ad75['model']=_['map'](_0x5e69d0,'name');_0x38ad75[_0x3bc5('0x4f')]=_[_0x3bc5('0x50')](_0x5e8be3[_0x3bc5('0x4f')]);_0x38ad75[_0x3bc5('0x51')]=_[_0x3bc5('0x52')](_0x38ad75[_0x3bc5('0x53')],_0x38ad75['query']);_0x521e93[_0x3bc5('0x54')]=_[_0x3bc5('0x52')](_0x38ad75[_0x3bc5('0x53')],qs[_0x3bc5('0x55')](_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x55')]));_0x521e93[_0x3bc5('0x54')]=_0x521e93[_0x3bc5('0x54')][_0x3bc5('0x56')]?_0x521e93[_0x3bc5('0x54')]:_0x38ad75['model'];if(!_0x5e8be3[_0x3bc5('0x4f')]['hasOwnProperty'](_0x3bc5('0x57'))){_0x521e93['limit']=qs[_0x3bc5('0x36')](_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x36')]);_0x521e93[_0x3bc5('0x34')]=qs['offset'](_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x34')]);}_0x521e93[_0x3bc5('0x58')]=qs['sort'](_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x59')]);_0x521e93['where']=qs[_0x3bc5('0x51')](_[_0x3bc5('0x5a')](_0x5e8be3[_0x3bc5('0x4f')],_0x38ad75['filters']),_0x5e69d0);var _0x677036=[];var _0x4184d7=squel[_0x3bc5('0x5b')]()[_0x3bc5('0x5c')]('id')[_0x3bc5('0x5c')](_0x3bc5('0x3e'))['field'](_0x3bc5('0x5d'))[_0x3bc5('0x5e')]('tools_tags');var _0x54d46b=squel[_0x3bc5('0x5b')]()[_0x3bc5('0x5c')](_0x3bc5('0x5f'))[_0x3bc5('0x5c')](_0x3bc5('0x60'))[_0x3bc5('0x5c')](_0x3bc5('0x61'))[_0x3bc5('0x5e')](_0x3bc5('0x62'),'ui')[_0x3bc5('0x63')](_0x3bc5('0x64'),'u',_0x3bc5('0x65'));var _0xdba4ca=squel['select']()[_0x3bc5('0x5e')](_0x3bc5('0x66'),'i')[_0x3bc5('0x63')](_0x3bc5('0x67'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3bc5('0x63')]('users','o',_0x3bc5('0x68'))[_0x3bc5('0x63')](_0x3bc5('0x69'),'a',_0x3bc5('0x6a'))[_0x3bc5('0x63')](_0x3bc5('0x6b'),'me',_0x3bc5('0x6c'))[_0x3bc5('0x63')](_0x3bc5('0x6d'),'it',_0x3bc5('0x6e'))[_0x3bc5('0x63')](_0x3bc5('0x6f'),'t',_0x3bc5('0x70'));var _0x4c9946=squel[_0x3bc5('0x71')]();var _0x50a42c=[];var _0x1ac212=squel[_0x3bc5('0x71')]();var _0x3001c2;if(_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x72')]){_0x3001c2=as[_0x3bc5('0x73')](_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x72')]);var _0x2b5b21=_0x3001c2[_0x3bc5('0x74')];for(var _0x33bb80=0x0;_0x33bb80<_0x3001c2[_0x3bc5('0x75')]['length'];_0x33bb80++){var _0x3dd7cf=_0x3001c2['conditions'][_0x33bb80];var _0x583cfb='i';var _0x4cfcba=_[_0x3bc5('0x76')](_0x5e69d0,[_0x3bc5('0x3e'),_0x3dd7cf[_0x3bc5('0x5c')]]);if(!_0x4cfcba){switch(_0x3dd7cf[_0x3bc5('0x5c')]){case _0x3bc5('0x77'):if(_0x3dd7cf[_0x3bc5('0x78')]==0x1){_0xdba4ca[_0x3bc5('0x79')]('`'+_0x3dd7cf[_0x3bc5('0x5c')]+_0x3bc5('0x7a'));}else{_0xdba4ca[_0x3bc5('0x79')]('`'+_0x3dd7cf[_0x3bc5('0x5c')]+'`\x20>\x200');}break;case _0x3bc5('0x7b'):if(_0x3dd7cf[_0x3bc5('0x7c')]===_0x3bc5('0x7d')){if(_0x3dd7cf[_0x3bc5('0x78')][_0x3bc5('0x48')]('\x20')[_0x3bc5('0x56')]>0x1){_0x4c9946[_0x2b5b21](_0x3bc5('0x7e'),qs[_0x3bc5('0x7f')](_0x3dd7cf[_0x3bc5('0x78')]),null);}else{var _0x395b31='%'+_0x3dd7cf['value']+'%';_0x4c9946[_0x2b5b21](_0x3bc5('0x80'),_0x395b31,_0x395b31,_0x395b31);}}else{_0x4cfcba=_['find'](_0x5e69d0,[_0x3bc5('0x3e'),_0x3bc5('0x81')]);_0x3dd7cf[_0x3bc5('0x5c')]=_0x3bc5('0x81');_0x51699e=as['buildExpression'](_0x583cfb,_0x4cfcba[_0x3bc5('0x4e')],_0x3dd7cf);_0x4c9946[_0x2b5b21](_0x51699e[_0x3bc5('0x82')],_0x51699e[_0x3bc5('0x78')]['start'],_0x51699e[_0x3bc5('0x78')]['end']);}break;case _0x3bc5('0x83'):var _0x40f0ac=_0x3dd7cf[_0x3bc5('0x78')][_0x3bc5('0x48')](',')['map'](function(_0x4a2fe9){return Number(_0x4a2fe9);});_0x40f0ac[_0x3bc5('0x49')](function(_0x400166){_0x1ac212['or'](_0x3bc5('0x84'),'%,'+_0x400166+',%');});_0x50a42c=_[_0x3bc5('0x85')](_0x50a42c,_0x40f0ac);break;case _0x3bc5('0x86'):if(_0x3dd7cf[_0x3bc5('0x7c')]===_0x3bc5('0x7d')){_0x4c9946[_0x2b5b21](_0x3bc5('0x87'),'%'+_0x3dd7cf[_0x3bc5('0x78')]+'%',null);}else{_0x4cfcba=_['find'](_0x5e69d0,[_0x3bc5('0x3e'),_0x3bc5('0x88')]);_0x3dd7cf[_0x3bc5('0x5c')]='UserId';_0x51699e=as[_0x3bc5('0x89')](_0x583cfb,_0x4cfcba[_0x3bc5('0x4e')],_0x3dd7cf);_0x4c9946[_0x2b5b21](_0x51699e[_0x3bc5('0x82')],_0x51699e[_0x3bc5('0x78')][_0x3bc5('0x8a')],_0x51699e[_0x3bc5('0x78')][_0x3bc5('0x32')]);}break;case'body':_0x51699e=as[_0x3bc5('0x89')]('me',null,_0x3dd7cf);_0x4c9946[_0x2b5b21](_0x51699e[_0x3bc5('0x82')],_0x51699e[_0x3bc5('0x78')][_0x3bc5('0x8a')],_0x51699e[_0x3bc5('0x78')]['end']);break;}}else{var _0x51699e=as['buildExpression'](_0x583cfb,_0x4cfcba[_0x3bc5('0x4e')],_0x3dd7cf);_0x4c9946[_0x2b5b21](_0x51699e[_0x3bc5('0x82')],_0x51699e[_0x3bc5('0x78')][_0x3bc5('0x8a')],_0x51699e[_0x3bc5('0x78')][_0x3bc5('0x32')]);}}}else{var _0x2b8c9e=_(_0x5e8be3[_0x3bc5('0x4f')])[_0x3bc5('0x50')]()[_0x3bc5('0x45')](function(_0x76fc0){return _[_0x3bc5('0x8b')](_0x5e69d0,['name',_0x76fc0])?_0x76fc0:undefined;})['compact']()[_0x3bc5('0x78')]();if(!_[_0x3bc5('0x8c')](_0x2b8c9e)){_0x2b8c9e[_0x3bc5('0x49')](function(_0x4e1cd1){if(_0x4e1cd1==='ChatWebsiteId'){_0xdba4ca['where'](_0x3bc5('0x8d'),[][_0x3bc5('0x8e')](_0x5e8be3[_0x3bc5('0x4f')][_0x4e1cd1]));}else if(_0x4e1cd1==='createdAt'){var _0x40e284=JSON['parse'](_0x5e8be3['query'][_0x4e1cd1])[_0x3bc5('0x8f')];var _0x41d385=JSON[_0x3bc5('0x90')](_0x5e8be3['query'][_0x4e1cd1])[_0x3bc5('0x91')];_0xdba4ca[_0x3bc5('0x92')](_0x3bc5('0x93'),_0x40e284,_0x41d385);}else{if(_0x5e8be3['query'][_0x4e1cd1]===_0x3bc5('0x94')){_0xdba4ca[_0x3bc5('0x92')]('i.'+_0x4e1cd1+_0x3bc5('0x95'));}else{_0xdba4ca['where']('i.'+_0x4e1cd1+_0x3bc5('0x96'),_0x5e8be3['query'][_0x4e1cd1]);}}});}if(_0x5e8be3['query'][_0x3bc5('0x97')]){if(_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x97')]==0x1){_0xdba4ca[_0x3bc5('0x79')]('`unreadMessages`\x20=\x200');}else{_0xdba4ca[_0x3bc5('0x79')](_0x3bc5('0x98'));}}if(_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x99')]){_0x50a42c=_[_0x3bc5('0x9a')](_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x99')])?_0x5e8be3['query'][_0x3bc5('0x99')]:new Array(_0x5e8be3[_0x3bc5('0x4f')]['tag']);_0x50a42c['forEach'](function(_0xac2bea){_0x1ac212['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xac2bea+',%');});}if(_0x5e8be3['query']['filter']){var _0x469f49=_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x9b')]['replace']('\x5c','\x5c\x5c')[_0x3bc5('0x9c')](/'/g,'\x27\x27');if(qs[_0x3bc5('0x9d')](_0x469f49)){_0x4c9946['or'](_0x3bc5('0x9e'),_0x469f49+'%');}else{_0x4c9946['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3bc5('0x7f')](_0x469f49))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x469f49+'%');}}}_0xdba4ca[_0x3bc5('0x92')](_0x4c9946);_0xdba4ca['group'](_0x3bc5('0x9f'));var _0x367436={'type':db[_0x3bc5('0xa0')][_0x3bc5('0xa1')][_0x3bc5('0xa2')],'raw':!![]};var _0x51e8b5=_0xdba4ca['clone']();_0x51e8b5[_0x3bc5('0x5c')](_0x3bc5('0x9f'));_0x51e8b5[_0x3bc5('0x5c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3bc5('0x77'));if(_0x521e93[_0x3bc5('0x58')]){_0x521e93[_0x3bc5('0x58')][_0x3bc5('0x49')](function(_0x17f6f7){var _0x11a4e2=_0x17f6f7[0x0]===_0x3bc5('0xa3')?_0x17f6f7[0x0]:'i.'+_0x17f6f7[0x0];_0xdba4ca[_0x3bc5('0x58')](_0x11a4e2,_0x17f6f7[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x50a42c)){_0xdba4ca[_0x3bc5('0x79')](_0x1ac212);_0x51e8b5[_0x3bc5('0x92')](_0x3bc5('0xa4'),_0x50a42c);}BPromise[_0x3bc5('0xa5')]()['then'](function(){if(!_0x3001c2){if(_0x5e8be3[_0x3bc5('0x4f')]['ChatWebsiteId'])return;_0x51e8b5[_0x3bc5('0x92')](_0x3bc5('0xa6'));_0xdba4ca[_0x3bc5('0x92')](_0x3bc5('0xa6'));return;}if(_0x5e8be3[_0x3bc5('0xa7')]['role']!==_0x3bc5('0x42'))return;return _0x5e8be3[_0x3bc5('0xa7')][_0x3bc5('0xa8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x306079){if(_[_0x3bc5('0x8c')](_0x306079)){_0x51e8b5['where'](_0x3bc5('0xa9'));_0xdba4ca[_0x3bc5('0x92')](_0x3bc5('0xa9'));}else{_0x51e8b5[_0x3bc5('0x92')](_0x3bc5('0x8d'),_[_0x3bc5('0x45')](_0x306079,'id'));_0xdba4ca[_0x3bc5('0x92')](_0x3bc5('0x8d'),_[_0x3bc5('0x45')](_0x306079,'id'));}});})[_0x3bc5('0x25')](function(){if(_0x5e8be3[_0x3bc5('0xa7')][_0x3bc5('0xaa')]==='agent'&&!_0x3001c2&&!_0x5e8be3[_0x3bc5('0x4f')]['ChatWebsiteId'])return[];return db[_0x3bc5('0xab')]['query'](_0x51e8b5['toString'](),_0x367436);})[_0x3bc5('0x25')](function(_0x1a90f2){_0xec2117[_0x3bc5('0xac')]=_0x1a90f2[_0x3bc5('0x56')];if(_0xec2117[_0x3bc5('0xac')]===0x0)return[];return db[_0x3bc5('0xab')][_0x3bc5('0x4f')](_0x4184d7[_0x3bc5('0xad')](),_0x367436)[_0x3bc5('0x25')](function(_0x1f3154){_0x677036=_[_0x3bc5('0xae')](_0x1f3154,'id');_0x367436=_[_0x3bc5('0x3f')](_0x367436,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e8be3[_0x3bc5('0x4f')][_0x3bc5('0x55')]){_0x521e93[_0x3bc5('0x54')]['forEach'](function(_0x23da13){_0xdba4ca[_0x3bc5('0x5c')]('i.'+_0x23da13);});}else{_0xdba4ca[_0x3bc5('0x5c')](_0x3bc5('0xaf'),_0x3bc5('0x77'));_0xdba4ca['field']('a.key','Account.key');_0xdba4ca[_0x3bc5('0x5c')](_0x3bc5('0xb0'),_0x3bc5('0xb1'));_0xdba4ca[_0x3bc5('0x5c')](_0x3bc5('0xb2'),_0x3bc5('0xa3'));_0xdba4ca[_0x3bc5('0x5c')]('i.*');_0xdba4ca['field'](_0x3bc5('0xb3'),_0x3bc5('0xb4'));_0xdba4ca['field'](_0x3bc5('0xb5'),'Contact.lastName');_0xdba4ca['field']('c.email',_0x3bc5('0xb6'));_0xdba4ca[_0x3bc5('0x5c')]('c.phone','Contact.phone');_0xdba4ca[_0x3bc5('0x5c')](_0x3bc5('0xb7'),_0x3bc5('0xb8'));_0xdba4ca[_0x3bc5('0x5c')]('c.fax','Contact.fax');_0xdba4ca[_0x3bc5('0x5c')](_0x3bc5('0xb9'),_0x3bc5('0xba'));_0xdba4ca[_0x3bc5('0x5c')](_0x3bc5('0xbb'),_0x3bc5('0xbc'));_0xdba4ca[_0x3bc5('0x5c')](_0x3bc5('0xbd'),'TagIds');}if(_0x521e93['limit'])_0xdba4ca['limit'](_0x521e93[_0x3bc5('0x36')]);if(_0x521e93[_0x3bc5('0x34')])_0xdba4ca[_0x3bc5('0x34')](_0x521e93[_0x3bc5('0x34')]);return db[_0x3bc5('0xab')][_0x3bc5('0x4f')](_0xdba4ca[_0x3bc5('0xad')](),_0x367436);})[_0x3bc5('0x25')](function(_0x50ce64){if(_0x50ce64[_0x3bc5('0x56')]>0x0)_0x54d46b[_0x3bc5('0x92')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x50ce64,'id'));return db['sequelize']['query'](_0x54d46b[_0x3bc5('0xad')](),_0x367436)[_0x3bc5('0x25')](function(_0x5a59fb){var _0x10c9c5=_['groupBy'](_0x5a59fb,_0x3bc5('0xbe'));var _0x254c27=[];_0x50ce64[_0x3bc5('0x49')](function(_0x35d9a5){_0x254c27[_0x3bc5('0x4a')](updateChatInteraction(_0x35d9a5,_0x677036,_0x10c9c5));});return BPromise[_0x3bc5('0xbf')](_0x254c27);});});})['then'](function(_0x5a8141){_0xec2117[_0x3bc5('0xc0')]=_0x5a8141;return _0xec2117;})[_0x3bc5('0x25')](respondWithFilteredResult(_0x43f4a4,_0x521e93))[_0x3bc5('0x30')](handleError(_0x43f4a4,null));};exports['show']=function(_0x11dbd5,_0x3c0cbf){var _0x11c6f6={'raw':![],'where':{'id':_0x11dbd5[_0x3bc5('0xc1')]['id']}},_0x434035={};_0x434035['model']=_[_0x3bc5('0x50')](db[_0x3bc5('0x4c')][_0x3bc5('0xc2')]);_0x434035['query']=_[_0x3bc5('0x50')](_0x11dbd5['query']);_0x434035[_0x3bc5('0x51')]=_[_0x3bc5('0x52')](_0x434035[_0x3bc5('0x53')],_0x434035['query']);_0x11c6f6['attributes']=_['intersection'](_0x434035[_0x3bc5('0x53')],qs[_0x3bc5('0x55')](_0x11dbd5[_0x3bc5('0x4f')][_0x3bc5('0x55')]));_0x11c6f6[_0x3bc5('0x54')]=_0x11c6f6[_0x3bc5('0x54')][_0x3bc5('0x56')]?_0x11c6f6[_0x3bc5('0x54')]:_0x434035[_0x3bc5('0x53')];if(_0x11dbd5['query']['includeAll']){_0x11c6f6[_0x3bc5('0xc3')]=[{'all':!![]}];}_0x11c6f6=_[_0x3bc5('0x3f')]({},_0x11c6f6,_0x11dbd5[_0x3bc5('0xc4')]);return db[_0x3bc5('0x4c')][_0x3bc5('0x76')](_0x11c6f6)[_0x3bc5('0x25')](handleEntityNotFound(_0x3c0cbf,null))['then'](respondWithResult(_0x3c0cbf,null))[_0x3bc5('0x30')](handleError(_0x3c0cbf,null));};exports[_0x3bc5('0xc5')]=function(_0x32d4cc,_0x29add5){return db[_0x3bc5('0x4c')][_0x3bc5('0xc5')](_0x32d4cc[_0x3bc5('0x40')],{})[_0x3bc5('0x25')](respondWithResult(_0x29add5,0xc9))['catch'](handleError(_0x29add5,null));};exports[_0x3bc5('0x3b')]=function(_0x52991d,_0x243d8f){if(_0x52991d[_0x3bc5('0x40')]['id']){delete _0x52991d[_0x3bc5('0x40')]['id'];}return db[_0x3bc5('0x4c')]['find']({'where':{'id':_0x52991d[_0x3bc5('0xc1')]['id']}})[_0x3bc5('0x25')](handleEntityNotFound(_0x243d8f,null))['then'](saveUpdates(_0x52991d[_0x3bc5('0x40')],null))[_0x3bc5('0x25')](respondWithResult(_0x243d8f,null))[_0x3bc5('0x30')](handleError(_0x243d8f,null));};exports[_0x3bc5('0xc6')]=function(_0x776df1,_0x24fb86){return db[_0x3bc5('0x4c')][_0x3bc5('0x76')]({'where':{'id':_0x776df1['params']['id']}})[_0x3bc5('0x25')](handleEntityNotFound(_0x24fb86,null))[_0x3bc5('0x25')](removeEntity(_0x24fb86,null))['catch'](handleError(_0x24fb86,null));};exports[_0x3bc5('0xc7')]=function(_0x1e6e5f,_0x41e335){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x41e335,null))[_0x3bc5('0x30')](handleError(_0x41e335,null));};exports[_0x3bc5('0xc8')]=function(_0x7a12cf,_0xc32eb0){var _0x380cb5=_0x7a12cf[_0x3bc5('0xc1')]['id'];var _0x137593;var _0xaeb537;var _0x5b607f;return db[_0x3bc5('0x4c')][_0x3bc5('0xc9')]({'where':{'id':_0x380cb5}})[_0x3bc5('0x25')](function(_0x57baec){_0x137593=_0x57baec;return db['ChatWebsite'][_0x3bc5('0xc9')]({'where':{'id':_0x57baec[_0x3bc5('0xca')]},'attributes':['id',_0x3bc5('0xcb'),_0x3bc5('0xcc'),_0x3bc5('0xcd'),_0x3bc5('0xce'),_0x3bc5('0xcf')],'raw':!![]});})['then'](function(_0x33183c){if(_0x33183c&&_0x33183c[_0x3bc5('0xcb')]&&_0x33183c[_0x3bc5('0xcc')]){_0xaeb537=_0x33183c;var _0x477cae={'interaction':{'id':_0x380cb5},'agent':{'id':_0x7a12cf[_0x3bc5('0xa7')]['id'],'name':_0x7a12cf[_0x3bc5('0xa7')][_0x3bc5('0x3e')],'fullname':_0x7a12cf[_0x3bc5('0xa7')][_0x3bc5('0xd0')],'email':_0x7a12cf[_0x3bc5('0xa7')][_0x3bc5('0xd1')]},'contact':_0x7a12cf['body'][_0x3bc5('0x41')],'account':_0x7a12cf[_0x3bc5('0x40')][_0x3bc5('0x44')]};var _0x161cb7={'rejectUnauthorized':![],'method':'POST','url':_0x3bc5('0xd2'),'headers':{'X-APIKEY':_0x33183c[_0x3bc5('0xcb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x7a12cf[_0x3bc5('0xa7')][_0x3bc5('0xd1')]],'buttons':null,'topic':_0xaeb537[_0x3bc5('0xcd')],'note':_[_0x3bc5('0xd3')](_0xaeb537[_0x3bc5('0xce')])?null:getMustacheRender(_0xaeb537[_0x3bc5('0xce')],_0x477cae),'metadata':null},'redirect':_0x3bc5('0xd4'),'json':!![]};try{if(!_[_0x3bc5('0xd3')](_0xaeb537['vidaooMetadata'])){var _0x3e3bc6=getMustacheRender(_0xaeb537[_0x3bc5('0xcf')],_0x477cae);var _0x59f816=JSON[_0x3bc5('0x90')](_0x3e3bc6);_0x161cb7['body'][_0x3bc5('0xd5')]=_0x59f816;}}catch(_0x2b5fa0){throw new db[(_0x3bc5('0xa0'))][(_0x3bc5('0xd6'))](_0x3bc5('0xd7'));}return rp(_0x161cb7);}else{throw new db['Sequelize'][(_0x3bc5('0xd6'))](_0x3bc5('0xd8'));}})[_0x3bc5('0x25')](function(_0x2393e3){_0x5b607f=_0x2393e3;if(_0x5b607f['id']){var _0x2a951d={'body':_0x5b607f[_0x3bc5('0xd9')],'ChatWebsiteId':_0xaeb537['id'],'ChatInteractionId':_0x137593['id'],'direction':_0x3bc5('0xda'),'UserId':_0x7a12cf[_0x3bc5('0xa7')]['id']};return db[_0x3bc5('0xdb')][_0x3bc5('0xc5')](_0x2a951d,{});}else{throw new db['Sequelize'][(_0x3bc5('0xd6'))](_0x3bc5('0xdc'));}})['then'](function(){return _0x137593[_0x3bc5('0xdd')]({'vidaooSessionId':_0x5b607f['id']});})['then'](respondWithResult(_0xc32eb0,null))[_0x3bc5('0x30')](handleError(_0xc32eb0,null));};exports[_0x3bc5('0xde')]=function(_0x4d65af,_0x44206f){if(_0x4d65af[_0x3bc5('0x40')]['id']){delete _0x4d65af[_0x3bc5('0x40')]['id'];}return db[_0x3bc5('0x4c')][_0x3bc5('0x76')]({'where':{'id':_0x4d65af[_0x3bc5('0xc1')]['id']},'include':[{'model':db[_0x3bc5('0xdf')],'as':_0x3bc5('0x7b')}]})[_0x3bc5('0x25')](handleEntityNotFound(_0x44206f,null))[_0x3bc5('0x25')](saveUpdates(_0x4d65af[_0x3bc5('0x40')],null))[_0x3bc5('0x25')](respondWithResult(_0x44206f,null))[_0x3bc5('0x30')](handleError(_0x44206f,null));};exports[_0x3bc5('0xe0')]=function(_0x1edbf0,_0x382a1a,_0x5e6a43){if(_0x1edbf0[_0x3bc5('0x40')]['id']){delete _0x1edbf0[_0x3bc5('0x40')]['id'];}return db[_0x3bc5('0x4c')][_0x3bc5('0x76')]({'where':{'id':_0x1edbf0[_0x3bc5('0xc1')]['id']}})[_0x3bc5('0x25')](function(_0x117665){if(!_0x117665){logger[_0x3bc5('0x2c')](_0x3bc5('0xe1'),_0x3bc5('0xe0'),0x194,_0x3bc5('0xe2'));_0x382a1a[_0x3bc5('0x3c')](0x194);}else{if(_0x117665[_0x3bc5('0x88')]){throw new db['Sequelize'][(_0x3bc5('0xd6'))]('Interaction\x20already\x20assigned');}}return _0x117665;})[_0x3bc5('0x25')](function(_0x20ee63){if(_0x20ee63){return _0x20ee63[_0x3bc5('0x3b')]({'closed':_0x1edbf0[_0x3bc5('0x40')]['closed'],'disposition':_0x1edbf0[_0x3bc5('0x40')][_0x3bc5('0xe3')]})[_0x3bc5('0x25')](function(_0x1413c8){return _0x1413c8;});}})[_0x3bc5('0x25')](function(_0x17a0de){return respondWithRpcPromise(_0x3bc5('0xe4'),_0x3bc5('0xe0'),_0x1edbf0[_0x3bc5('0x40')],client9004);})[_0x3bc5('0x25')](respondWithResult(_0x382a1a,null))[_0x3bc5('0x30')](handleError(_0x382a1a,null));};exports[_0x3bc5('0xe5')]=function(_0x280341,_0x3e7793,_0x14f0af){_0x280341['body']['name']=_0x280341[_0x3bc5('0xe6')][_0x3bc5('0xe7')];_0x280341[_0x3bc5('0x40')][_0x3bc5('0xe8')]=_0x280341['file'][_0x3bc5('0xe9')];_0x280341[_0x3bc5('0x40')][_0x3bc5('0x4e')]=_0x280341[_0x3bc5('0xe6')][_0x3bc5('0xea')];return db[_0x3bc5('0xeb')][_0x3bc5('0xc5')](_0x280341[_0x3bc5('0x40')])[_0x3bc5('0x25')](respondWithResult(_0x3e7793,0xc9))[_0x3bc5('0x30')](handleError(_0x3e7793,null));};exports[_0x3bc5('0xec')]=function(_0x21bae9,_0x5cf5da,_0x36d903){return db['ChatInteraction'][_0x3bc5('0xc9')]({'where':{'id':_0x21bae9[_0x3bc5('0xc1')]['id']},'raw':!![]})[_0x3bc5('0x25')](handleEntityNotFound(_0x5cf5da,null))[_0x3bc5('0x25')](function(_0xddb16f){if(_0xddb16f){if(_0xddb16f[_0x3bc5('0xed')]){return _0x5cf5da['status'](0x193)[_0x3bc5('0x33')]({'status':0x193,'message':_0x3bc5('0xee')});}return db['Attachment']['findOne']({'where':{'id':_0x21bae9['query'][_0x3bc5('0xef')]},'raw':!![]})[_0x3bc5('0x25')](handleEntityNotFound(_0x5cf5da,null));}})[_0x3bc5('0x25')](function(_0x376dae){if(_0x376dae){var _0x3b6977=_0x376dae[_0x3bc5('0xf0')]!==null;var _0x3ad93b=path['join'](config[_0x3bc5('0xf1')],_0x3bc5('0xf2'));if(_0x3b6977){_0x3ad93b=path[_0x3bc5('0xf3')](_0x3ad93b,_0x3bc5('0xf4'));}var _0x5820da=path['join'](_0x3ad93b,_0x376dae[_0x3bc5('0xe8')]);return _0x5cf5da[_0x3bc5('0xf5')](_0x5820da);}})[_0x3bc5('0x30')](handleError(_0x5cf5da,null));};exports[_0x3bc5('0xf6')]=function(_0x46017f,_0x189118){var _0x3f29b3=null;var _0x464a2a=null;var _0x464c50=null;var _0x49873d=null;if(_0x46017f['body']['id']){delete _0x46017f[_0x3bc5('0x40')]['id'];}if(_0x46017f[_0x3bc5('0x40')]['mailTranscript']){_0x49873d=path[_0x3bc5('0xf3')](config['root'],_0x3bc5('0xf7'),util[_0x3bc5('0xf8')](_0x3bc5('0xf9'),Date[_0x3bc5('0xfa')]()));_0x46017f[_0x3bc5('0x40')]['pathTranscript']=_0x49873d;}return db[_0x3bc5('0x4c')][_0x3bc5('0x76')]({'where':{'id':_0x46017f[_0x3bc5('0xc1')]['id']},'include':[{'model':db[_0x3bc5('0xdb')],'as':_0x3bc5('0xfb'),'include':[{'model':db[_0x3bc5('0x86')],'as':'User'}]}]})[_0x3bc5('0x25')](handleEntityNotFound(_0x189118,null))[_0x3bc5('0x25')](saveUpdates(_0x46017f[_0x3bc5('0x40')],null))[_0x3bc5('0x25')](function(_0x4f2039){if(_0x4f2039){_0x3f29b3=_0x4f2039;return db[_0x3bc5('0xfc')][_0x3bc5('0x76')]({'where':{'id':_0x3f29b3['ChatWebsiteId']}});}})[_0x3bc5('0x25')](function(_0x5ce872){if(_0x5ce872){_0x464c50=_0x5ce872;return db['CmContact'][_0x3bc5('0x76')]({'where':{'id':_0x3f29b3[_0x3bc5('0x81')]}});}})[_0x3bc5('0x25')](function(_0x515dd9){if(_0x515dd9){_0x464a2a=_0x515dd9;if(_0x49873d){var _0x340673=null;for(var _0xfea989=0x1;_0xfea989<_0x3f29b3[_0x3bc5('0xfb')][_0x3bc5('0x56')];++_0xfea989){_0x340673=_0x3f29b3['Messages'][_0xfea989];var _0x491326=_0x340673['UserId']?util[_0x3bc5('0xf8')](_0x3bc5('0xfd'),_0x464c50[_0x3bc5('0xfe')],_0x340673['UserId']):_0x3bc5('0xff');var _0x6a38c5=_0x46017f['body'][_0x3bc5('0x100')]||util[_0x3bc5('0xf8')](_0x3bc5('0xfd'),_0x3bc5('0x101'),_0x340673['ContactId']);switch(_0x464c50[_0x3bc5('0x102')]){case _0x3bc5('0x103'):_0x491326=_0x340673['UserId']?util[_0x3bc5('0xf8')](_0x3bc5('0xfd'),_0x464c50[_0x3bc5('0xfe')],_0x340673[_0x3bc5('0x88')]):_0x3bc5('0xff');break;case'agent_alias':_0x491326=_0x340673[_0x3bc5('0x88')]?_0x340673[_0x3bc5('0x86')][_0x3bc5('0x104')]||_0x340673['User'][_0x3bc5('0xd0')]:_0x3bc5('0xff');break;case _0x3bc5('0x105'):_0x491326=_0x340673[_0x3bc5('0x88')]?_0x340673[_0x3bc5('0x86')][_0x3bc5('0xd0')]:_0x3bc5('0xff');break;default:_0x491326=_0x340673['UserId']?util[_0x3bc5('0xf8')](_0x3bc5('0xfd'),_0x464c50[_0x3bc5('0xfe')],_0x340673[_0x3bc5('0x88')]):_0x3bc5('0xff');}var _0x4aa51f=util['format'](_0x3bc5('0x106'),moment(_0x340673[_0x3bc5('0x107')])[_0x3bc5('0xf8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x340673[_0x3bc5('0x108')]==='in'?_0x6a38c5:_0x491326,_0x340673['body']);if(!_0x340673['secret']){fs[_0x3bc5('0x109')](_0x49873d,_0x4aa51f);}}return db['MailAccount'][_0x3bc5('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0x3bc5('0x10a')],'as':_0x3bc5('0x10b'),'raw':!![]}]});}}})[_0x3bc5('0x25')](function(_0x313875){if(_0x313875&&_0x313875['Smtp']&&_0x46017f[_0x3bc5('0x40')]){var _0x19266a={'tls':{'rejectUnauthorized':![]}};if(_0x313875[_0x3bc5('0x10b')]['service']){_0x19266a[_0x3bc5('0x10c')]=_0x313875[_0x3bc5('0x10b')][_0x3bc5('0x10c')];}else{_0x19266a[_0x3bc5('0x10d')]=_0x313875[_0x3bc5('0x10b')][_0x3bc5('0x10d')];_0x19266a[_0x3bc5('0x10e')]=_0x313875['Smtp']['port'];_0x19266a[_0x3bc5('0x10f')]=_0x313875[_0x3bc5('0x10b')][_0x3bc5('0x10f')];}if(_0x313875[_0x3bc5('0x10b')][_0x3bc5('0x110')]){_0x19266a[_0x3bc5('0x111')]={'user':_0x313875[_0x3bc5('0x10b')][_0x3bc5('0xa7')],'pass':_0x313875[_0x3bc5('0x10b')]['pass']};}return respondWithRpcPromise(_0x3bc5('0x112'),_0x3bc5('0x113'),{'account':_0x19266a,'message':{'from':util[_0x3bc5('0xf8')](_0x3bc5('0x114'),_0x313875[_0x3bc5('0x3e')],_0x313875[_0x3bc5('0xd1')]||_0x313875[_0x3bc5('0x10b')]['user']),'to':_0x46017f['body'][_0x3bc5('0x115')],'subject':'Mail\x20Transcript','text':util['format'](_0x3bc5('0x116'),_0x46017f[_0x3bc5('0x40')][_0x3bc5('0x115')]),'attachments':[{'path':_0x49873d}]}})['then'](function(){return _0x3f29b3;})[_0x3bc5('0x30')](function(_0x3a7d6a){console['error'](_0x3a7d6a);});}else{return _0x3f29b3;}})[_0x3bc5('0x25')](respondWithStatusCode(_0x189118,0xc8))['catch'](handleError(_0x189118,null));};exports[_0x3bc5('0x117')]=function(_0x25a7cb,_0x33f858,_0x3557){return db['ChatMessage'][_0x3bc5('0x76')]({'where':{'id':_0x25a7cb['params']['id']}})[_0x3bc5('0x25')](handleEntityNotFound(_0x33f858,null))[_0x3bc5('0x25')](function(_0x14a154){if(_0x14a154){return _0x14a154[_0x3bc5('0x117')](_0x25a7cb[_0x3bc5('0x40')][_0x3bc5('0x118')],_['omit'](_0x25a7cb['body'],[_0x3bc5('0x118'),'id'])||{});}})[_0x3bc5('0x25')](respondWithResult(_0x33f858,null))[_0x3bc5('0x30')](handleError(_0x33f858,null));};exports[_0x3bc5('0x119')]=function(_0x1f71fc,_0x1d1ed5,_0x3005a3){var _0x178bf6={'raw':![],'where':{}};var _0xa52da5={};var _0x103c4d={'count':0x0,'rows':[]};return db[_0x3bc5('0x4c')][_0x3bc5('0xc9')]({'where':{'id':_0x1f71fc['params']['id']}})[_0x3bc5('0x25')](handleEntityNotFound(_0x1d1ed5,null))[_0x3bc5('0x25')](function(_0x435ab0){if(_0x435ab0){_0xa52da5[_0x3bc5('0x53')]=_['keys'](db['ChatMessage'][_0x3bc5('0xc2')]);_0xa52da5[_0x3bc5('0x4f')]=_['keys'](_0x1f71fc[_0x3bc5('0x4f')]);_0xa52da5['filters']=_['intersection'](_0xa52da5[_0x3bc5('0x53')],_0xa52da5['query']);_0x178bf6[_0x3bc5('0x54')]=_['intersection'](_0xa52da5['model'],qs[_0x3bc5('0x55')](_0x1f71fc['query']['fields']));_0x178bf6[_0x3bc5('0x54')]=_0x178bf6[_0x3bc5('0x54')]['length']?_0x178bf6[_0x3bc5('0x54')]:_0xa52da5[_0x3bc5('0x53')];if(!_0x1f71fc[_0x3bc5('0x4f')][_0x3bc5('0x11a')](_0x3bc5('0x57'))){_0x178bf6[_0x3bc5('0x36')]=qs['limit'](_0x1f71fc[_0x3bc5('0x4f')][_0x3bc5('0x36')]);_0x178bf6[_0x3bc5('0x34')]=qs[_0x3bc5('0x34')](_0x1f71fc[_0x3bc5('0x4f')][_0x3bc5('0x34')]);}_0x178bf6[_0x3bc5('0x58')]=qs[_0x3bc5('0x59')](_0x1f71fc['query'][_0x3bc5('0x59')]);_0x178bf6[_0x3bc5('0x92')]=qs['filters'](_[_0x3bc5('0x5a')](_0x1f71fc[_0x3bc5('0x4f')],_0xa52da5[_0x3bc5('0x51')]));_0x178bf6['where'][_0x3bc5('0xbe')]=_0x435ab0['id'];if(_0x1f71fc[_0x3bc5('0x4f')][_0x3bc5('0x9b')]){_0x178bf6[_0x3bc5('0x92')]=_['merge'](_0x178bf6[_0x3bc5('0x92')],{'$or':_[_0x3bc5('0x45')](_0x178bf6['attributes'],function(_0x1de556){var _0x25e305={};_0x25e305[_0x1de556]={'$like':'%'+_0x1f71fc['query'][_0x3bc5('0x9b')]+'%'};return _0x25e305;})});}if(_0x1f71fc[_0x3bc5('0x4f')][_0x3bc5('0x8f')]){var _0x612909=_0x1f71fc[_0x3bc5('0x4f')][_0x3bc5('0x8f')]['split'](',');var _0x1fa9b6={};_0x1fa9b6[_0x612909[0x0]]={'$gte':moment(_0x612909[0x1])[_0x3bc5('0xf8')](_0x3bc5('0x11b'))};_0x178bf6['where']=_[_0x3bc5('0x3f')](_0x178bf6[_0x3bc5('0x92')],_0x1fa9b6);}_0x178bf6=_[_0x3bc5('0x3f')]({},_0x178bf6,_0x1f71fc[_0x3bc5('0xc4')]);return db[_0x3bc5('0xdb')][_0x3bc5('0xac')]({'where':_0x178bf6[_0x3bc5('0x92')]})['then'](function(_0xb7b3d){_0x103c4d['count']=_0xb7b3d;if(_0x1f71fc[_0x3bc5('0x4f')]['includeAll']){_0x178bf6[_0x3bc5('0xc3')]=[{'all':!![]}];}return db[_0x3bc5('0xdb')]['findAll'](_0x178bf6);})[_0x3bc5('0x25')](function(_0x318196){_0x103c4d['rows']=_0x318196;return _0x103c4d;});}})['then'](respondWithFilteredResult(_0x1d1ed5,_0x178bf6))[_0x3bc5('0x30')](handleError(_0x1d1ed5,null));};exports[_0x3bc5('0x11c')]=function(_0x19ab6f,_0x217b20,_0x551774){var _0x1d4bd1={'where':{}},_0x206e5e={},_0x12f78c={'count':0x0,'rows':[]};return db[_0x3bc5('0x4c')][_0x3bc5('0xc9')]({'where':{'id':_0x19ab6f[_0x3bc5('0xc1')]['id']}})['then'](handleEntityNotFound(_0x217b20,null))['then'](function(_0x51ec25){if(_0x51ec25){_0x206e5e['model']=_['keys'](db[_0x3bc5('0xdb')][_0x3bc5('0xc2')]);_0x206e5e['query']=_[_0x3bc5('0x50')](_0x19ab6f['query']);_0x206e5e[_0x3bc5('0x51')]=_['intersection'](_0x206e5e[_0x3bc5('0x53')],_0x206e5e[_0x3bc5('0x4f')]);_0x1d4bd1[_0x3bc5('0x54')]=_[_0x3bc5('0x52')](_0x206e5e[_0x3bc5('0x53')],qs[_0x3bc5('0x55')](_0x19ab6f[_0x3bc5('0x4f')][_0x3bc5('0x55')]));_0x1d4bd1[_0x3bc5('0x54')]=_0x1d4bd1[_0x3bc5('0x54')]['length']?_0x1d4bd1[_0x3bc5('0x54')]:_0x206e5e[_0x3bc5('0x53')];if(!_0x19ab6f[_0x3bc5('0x4f')][_0x3bc5('0x11a')]('nolimit')){_0x1d4bd1[_0x3bc5('0x36')]=qs['limit'](_0x19ab6f[_0x3bc5('0x4f')]['limit']);_0x1d4bd1['offset']=qs[_0x3bc5('0x34')](_0x19ab6f[_0x3bc5('0x4f')][_0x3bc5('0x34')]);}_0x1d4bd1[_0x3bc5('0x58')]=qs[_0x3bc5('0x59')](_0x19ab6f['query'][_0x3bc5('0x59')]);_0x1d4bd1[_0x3bc5('0x92')]=qs[_0x3bc5('0x51')](_[_0x3bc5('0x5a')](_0x19ab6f[_0x3bc5('0x4f')],_0x206e5e[_0x3bc5('0x51')]));_0x1d4bd1[_0x3bc5('0x92')]['ChatInteractionId']=_0x51ec25['id'];if(_0x19ab6f[_0x3bc5('0x4f')][_0x3bc5('0x9b')]){_0x1d4bd1[_0x3bc5('0x92')]=_[_0x3bc5('0x3f')](_0x1d4bd1[_0x3bc5('0x92')],{'$or':_[_0x3bc5('0x45')](_0x1d4bd1[_0x3bc5('0x54')],function(_0x89858e){var _0x2d2847={};_0x2d2847[_0x89858e]={'$like':'%'+_0x19ab6f[_0x3bc5('0x4f')]['filter']+'%'};return _0x2d2847;})});}_0x1d4bd1[_0x3bc5('0x92')][_0x3bc5('0x11d')]=![];if(_0x19ab6f[_0x3bc5('0x4f')]['id']){_0x1d4bd1[_0x3bc5('0x92')]['id']={'$gt':_0x19ab6f[_0x3bc5('0x4f')]['id']};}_0x1d4bd1=_[_0x3bc5('0x3f')]({},_0x1d4bd1,_0x19ab6f[_0x3bc5('0xc4')]);return db[_0x3bc5('0xdb')][_0x3bc5('0xac')]({'where':_0x1d4bd1['where']})['then'](function(_0x3767f4){_0x12f78c['count']=_0x3767f4;_0x1d4bd1[_0x3bc5('0xc3')]=[];if(_0x19ab6f[_0x3bc5('0x4f')][_0x3bc5('0x11e')]){_0x1d4bd1['include'][_0x3bc5('0x4a')]({'model':db[_0x3bc5('0x86')],'as':'User','attributes':['id','fullname',_0x3bc5('0x104')]});}if(_0x19ab6f[_0x3bc5('0x4f')][_0x3bc5('0x11f')]){_0x1d4bd1[_0x3bc5('0xc3')]=[{'all':!![]}];}return db[_0x3bc5('0xdb')][_0x3bc5('0x120')](_0x1d4bd1);})[_0x3bc5('0x25')](function(_0x5241eb){_0x12f78c[_0x3bc5('0xc0')]=_0x5241eb;return _0x12f78c;});}})[_0x3bc5('0x25')](respondWithFilteredResult(_0x217b20,_0x1d4bd1))[_0x3bc5('0x30')](handleError(_0x217b20,null));};exports['addTags']=function(_0x438d93,_0x53986e,_0x165d92){return db[_0x3bc5('0x4c')][_0x3bc5('0x76')]({'where':{'id':_0x438d93[_0x3bc5('0xc1')]['id']}})['then'](handleEntityNotFound(_0x53986e,null))['then'](function(_0x3162f3){if(_0x3162f3){return _0x3162f3[_0x3bc5('0x121')](_0x438d93[_0x3bc5('0x40')]['ids'],_[_0x3bc5('0x122')](_0x438d93[_0x3bc5('0x40')],[_0x3bc5('0x118'),'id'])||{})['spread'](function(){return db[_0x3bc5('0x83')][_0x3bc5('0x120')]({'attributes':['id','name',_0x3bc5('0x5d')],'where':{'id':_0x438d93[_0x3bc5('0x40')][_0x3bc5('0x118')]}});})[_0x3bc5('0x25')](function(_0x2662aa){socket['emit'](_0x3bc5('0x123'),{'id':Number(_0x438d93['params']['id']),'tags':_0x2662aa||[]});return{'id':Number(_0x438d93[_0x3bc5('0xc1')]['id']),'tags':_0x2662aa||[]};});}})['then'](respondWithResult(_0x53986e,null))['catch'](handleError(_0x53986e,null));};exports[_0x3bc5('0x124')]=function(_0x4ae836,_0x542d5f,_0x120e90){return db['ChatInteraction']['find']({'where':{'id':_0x4ae836['params']['id']}})[_0x3bc5('0x25')](handleEntityNotFound(_0x542d5f,null))[_0x3bc5('0x25')](function(_0x1faf0f){if(_0x1faf0f){return _0x1faf0f[_0x3bc5('0x124')](_0x4ae836[_0x3bc5('0x4f')]['ids']);}})['then'](respondWithStatusCode(_0x542d5f,null))[_0x3bc5('0x30')](handleError(_0x542d5f,null));};exports[_0x3bc5('0xf5')]=function(_0xa30e1,_0x49191b){var _0xf70245=moment()[_0x3bc5('0x125')]()['toString']();var _0x21df41=path[_0x3bc5('0xf3')](config[_0x3bc5('0xf1')],_0x3bc5('0x126'),_0x3bc5('0x127'),'tmp');var _0x1d00c6=path['join'](config[_0x3bc5('0xf1')],'server','files','attachments');var _0x2250bd=path[_0x3bc5('0xf3')](_0x21df41,_0xf70245);var _0x1fa948=util[_0x3bc5('0xf8')](_0x3bc5('0x128'),_0xa30e1[_0x3bc5('0xc1')]['id'],_0xf70245);var _0x2f88c3=path[_0x3bc5('0xf3')](_0x21df41,_0x1fa948);var _0x4a5519=[];_0x4a5519[_0x3bc5('0x4a')]({'model':db[_0x3bc5('0x86')],'as':_0x3bc5('0x86'),'attributes':['id','fullname'],'raw':!![]});_0x4a5519[_0x3bc5('0x4a')]({'model':db[_0x3bc5('0xdf')],'as':'Contact','attributes':['id',_0x3bc5('0x129'),_0x3bc5('0x12a')],'raw':!![]});if(_0xa30e1[_0x3bc5('0x4f')][_0x3bc5('0x12b')]){_0x4a5519[_0x3bc5('0x4a')]({'model':db[_0x3bc5('0xeb')],'as':_0x3bc5('0xeb'),'raw':!![]});}var _0x17f2ea=[{'model':db[_0x3bc5('0xdb')],'as':'Messages','attributes':['id',_0x3bc5('0x40'),_0x3bc5('0x107'),_0x3bc5('0x108'),_0x3bc5('0x11d'),_0x3bc5('0x97')],'include':_0x4a5519}];_0x17f2ea[_0x3bc5('0x4a')]({'model':db[_0x3bc5('0xfc')],'as':_0x3bc5('0x12c'),'attributes':['id',_0x3bc5('0x3e')]});_0x17f2ea[_0x3bc5('0x4a')]({'model':db[_0x3bc5('0x86')],'as':_0x3bc5('0x12d'),'attributes':['id',_0x3bc5('0xd0')]});return db[_0x3bc5('0x4c')][_0x3bc5('0x76')]({'where':{'id':_0xa30e1[_0x3bc5('0xc1')]['id']},'include':_0x17f2ea})[_0x3bc5('0x25')](handleEntityNotFound(_0x49191b,null))[_0x3bc5('0x25')](function(_0x584fdd){if(_0x584fdd){var _0x5114ed=_0x584fdd['get']({'plain':!![]});fs[_0x3bc5('0x12e')](_0x2250bd);var _0x5ed469={'channel':_0x3bc5('0x12f'),'account':_0x5114ed[_0x3bc5('0x12c')][_0x3bc5('0x3e')],'agent':_0x5114ed[_0x3bc5('0x12d')]?_0x5114ed[_0x3bc5('0x12d')][_0x3bc5('0xd0')]:_0x3bc5('0x130'),'createdAt':moment(_0x5114ed[_0x3bc5('0x107')])[_0x3bc5('0xf8')](_0x3bc5('0x11b'))[_0x3bc5('0xad')](),'closedAt':_0x5114ed[_0x3bc5('0xed')]?moment(_0x5114ed[_0x3bc5('0x131')])[_0x3bc5('0xf8')](_0x3bc5('0x11b'))[_0x3bc5('0xad')]():'','disposition':_0x5114ed[_0x3bc5('0xe3')],'chatInfo':{'browser':_0x5114ed[_0x3bc5('0x132')],'os':_0x5114ed[_0x3bc5('0x133')],'referer':_0x5114ed[_0x3bc5('0x134')],'customerIp':_0x5114ed[_0x3bc5('0x135')],'customerPort':_0x5114ed[_0x3bc5('0x136')]?_0x5114ed[_0x3bc5('0x136')]:'N.A.'},'messages':_(_0x5114ed[_0x3bc5('0xfb')])[_0x3bc5('0x137')]()['filter']({'secret':![]})[_0x3bc5('0x45')](function(_0x16e01a){if(_0x16e01a['Attachment']){var _0x284eac=path[_0x3bc5('0xf3')](_0x1d00c6,_0x16e01a[_0x3bc5('0xeb')][_0x3bc5('0xe8')]);if(fs[_0x3bc5('0x138')](_0x284eac)){fs[_0x3bc5('0x139')](_0x284eac)[_0x3bc5('0x13a')](fs[_0x3bc5('0x13b')](path[_0x3bc5('0xf3')](_0x2250bd,_0x16e01a[_0x3bc5('0xeb')][_0x3bc5('0xe8')])));}}return{'date':moment(_0x16e01a[_0x3bc5('0x107')])['format'](_0x3bc5('0x11b'))['toString'](),'sender':_0x16e01a[_0x3bc5('0x108')]===_0x3bc5('0xda')?_0x16e01a['User']?_0x16e01a[_0x3bc5('0x86')][_0x3bc5('0xd0')]:'System':_0x16e01a['Contact'][_0x3bc5('0x129')]+(_0x16e01a[_0x3bc5('0x7b')][_0x3bc5('0x12a')]?'\x20'+_0x16e01a[_0x3bc5('0x7b')][_0x3bc5('0x12a')]:''),'body':_0x16e01a[_0x3bc5('0xeb')]?_0x16e01a['Attachment']['basename']:_0x16e01a['body'],'direction':_0x16e01a[_0x3bc5('0x108')]===_0x3bc5('0xda')?'A':'C','secret':_0x16e01a[_0x3bc5('0x11d')],'read':_0x16e01a['read'],'attachment':_0x16e01a[_0x3bc5('0xeb')]};})['value']()};return ejs[_0x3bc5('0x13c')](path[_0x3bc5('0xf3')](config[_0x3bc5('0xf1')],_0x3bc5('0x126'),_0x3bc5('0x13d'),_0x3bc5('0x13e')),{'interaction':_0x5ed469})['then'](function(_0x2da83f){var _0xa25286=path[_0x3bc5('0xf3')](_0x2250bd,'transcript-'+_0x5114ed['id']+'-'+_0xf70245+_0x3bc5('0x13f'));var _0x1b202c={'path':_0xa25286,'channel':_0x3bc5('0x12f'),'interactionId':_0x5114ed['id']};return pdf[_0x3bc5('0x140')](_0x2da83f,_0x1b202c);})[_0x3bc5('0x25')](function(){return new BPromise(function(_0x5a7fb8,_0x4c5916){zipdir(_0x2250bd,{'saveTo':_0x2f88c3},function(_0x523083,_0x5da0b1){if(_0x523083)return _0x4c5916(_0x523083);return _0x5a7fb8(_0x5da0b1);});})['then'](function(){return new BPromise(function(_0x421a29,_0x445e70){rimraf(_0x2250bd,function(_0x380a75){if(_0x380a75)_0x445e70(_0x380a75);return _0x421a29();});});})[_0x3bc5('0x25')](function(){return _0x49191b['download'](_0x2f88c3,_0x1fa948,function(_0x377c8c){if(_0x377c8c){console['log']('err',_0x377c8c);}else{fs[_0x3bc5('0x141')](_0x2f88c3);}});});});}else{return _0x49191b[_0x3bc5('0x3c')](0xc8);}})[_0x3bc5('0x30')](handleError(_0x49191b,null));}; \ No newline at end of file +var _0x9ad5=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','show','include','options','ChatInteraction','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','closed','disposition','attachmentUpload','file','originalname','basename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','agentAlias','System','customer','%s%d','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','alias','findAll','addTags','setTags','omit','spread','emit','removeTags','unix','server','tmp','files','transcript-%d-%s.zip','lastName','attachments','Account','Owner','get','mkdirSync','N.A.','closedAt','browserName','osName','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','firstName','renderFile','views','downloadInteraction.html','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','name','send','render','merge','body','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','index','rawAttributes','fieldName','key','model','query','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','length','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','type','buildExpression','keys','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','attributes','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax'];(function(_0x2af1eb,_0x48f350){var _0x17a509=function(_0x35844b){while(--_0x35844b){_0x2af1eb['push'](_0x2af1eb['shift']());}};_0x17a509(++_0x48f350);}(_0x9ad5,0x7f));var _0x59ad=function(_0x3a6813,_0x51b88d){_0x3a6813=_0x3a6813-0x0;var _0x137ca6=_0x9ad5[_0x3a6813];return _0x137ca6;};'use strict';var emlformat=require(_0x59ad('0x0'));var rimraf=require(_0x59ad('0x1'));var zipdir=require(_0x59ad('0x2'));var jsonpatch=require(_0x59ad('0x3'));var rp=require('request-promise');var moment=require(_0x59ad('0x4'));var BPromise=require(_0x59ad('0x5'));var Mustache=require(_0x59ad('0x6'));var util=require('util');var path=require(_0x59ad('0x7'));var sox=require('sox');var csv=require(_0x59ad('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x59ad('0x9'));var jsforce=require(_0x59ad('0xa'));var deskjs=require(_0x59ad('0xb'));var toCsv=require(_0x59ad('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x59ad('0xc'));var qs=require(_0x59ad('0xd'));var as=require(_0x59ad('0xe'));var pdf=require(_0x59ad('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59ad('0x10'))(_0x59ad('0x11'));var utils=require(_0x59ad('0x12'));var config=require(_0x59ad('0x13'));var licenseUtil=require(_0x59ad('0x14'));var db=require(_0x59ad('0x15'))['db'];config['redis']=_[_0x59ad('0x16')](config[_0x59ad('0x17')],{'host':_0x59ad('0x18'),'port':0x18eb});var socket=require(_0x59ad('0x19'))(new Redis(config['redis']));require(_0x59ad('0x1a'))[_0x59ad('0x1b')](socket);var jayson=require(_0x59ad('0x1c'));var client=jayson['client'][_0x59ad('0x1d')]({'port':0x232b});var client9004=jayson[_0x59ad('0x1e')][_0x59ad('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x24a873,_0x7a6256,_0x332344,_0x2efac0){return new BPromise(function(_0x195d93,_0x14e2bc){var _0x38645a=_0x2efac0||client;return _0x38645a[_0x59ad('0x1f')](_0x24a873,_0x332344)[_0x59ad('0x20')](function(_0x5103c1){logger['info'](_0x59ad('0x21'),_0x7a6256,_0x59ad('0x22'));logger[_0x59ad('0x23')](_0x59ad('0x24'),_0x7a6256,'request\x20sent',JSON[_0x59ad('0x25')](_0x5103c1));if(_0x5103c1[_0x59ad('0x26')]){if(_0x5103c1[_0x59ad('0x26')][_0x59ad('0x27')]===0x1f4){logger[_0x59ad('0x26')](_0x59ad('0x21'),_0x7a6256,_0x5103c1[_0x59ad('0x26')][_0x59ad('0x28')]);return _0x14e2bc(_0x5103c1[_0x59ad('0x26')][_0x59ad('0x28')]);}logger[_0x59ad('0x26')](_0x59ad('0x21'),_0x7a6256,_0x5103c1[_0x59ad('0x26')][_0x59ad('0x28')]);return _0x195d93(_0x5103c1[_0x59ad('0x26')][_0x59ad('0x28')]);}else{logger[_0x59ad('0x29')](_0x59ad('0x21'),_0x7a6256,_0x59ad('0x22'));_0x195d93(_0x5103c1[_0x59ad('0x2a')][_0x59ad('0x28')]);}})[_0x59ad('0x2b')](function(_0x4f8249){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x7a6256,_0x4f8249);_0x14e2bc(_0x4f8249);});});}function respondWithStatusCode(_0x4ace6a,_0x1bdd08){_0x1bdd08=_0x1bdd08||0xcc;return function(_0x20651d){if(_0x20651d){return _0x4ace6a[_0x59ad('0x2c')](_0x1bdd08);}return _0x4ace6a[_0x59ad('0x2d')](_0x1bdd08)[_0x59ad('0x2e')]();};}function respondWithResult(_0x4c9b58,_0x24058f){_0x24058f=_0x24058f||0xc8;return function(_0x42cbab){if(_0x42cbab){return _0x4c9b58['status'](_0x24058f)[_0x59ad('0x2f')](_0x42cbab);}};}function respondWithFilteredResult(_0x553287,_0x5ed25d){return function(_0xda5fc9){if(_0xda5fc9){var _0x12f035=typeof _0x5ed25d['offset']===_0x59ad('0x30')&&typeof _0x5ed25d['limit']==='undefined';var _0x4fafb1=_0xda5fc9[_0x59ad('0x31')];var _0x3693d6=_0x12f035?0x0:_0x5ed25d[_0x59ad('0x32')];var _0x17b559=_0x12f035?_0xda5fc9[_0x59ad('0x31')]:_0x5ed25d[_0x59ad('0x32')]+_0x5ed25d[_0x59ad('0x33')];var _0x399267;if(_0x17b559>=_0x4fafb1){_0x17b559=_0x4fafb1;_0x399267=0xc8;}else{_0x399267=0xce;}_0x553287[_0x59ad('0x2d')](_0x399267);return _0x553287['set'](_0x59ad('0x34'),_0x3693d6+'-'+_0x17b559+'/'+_0x4fafb1)[_0x59ad('0x2f')](_0xda5fc9);}return null;};}function patchUpdates(_0x207f8a){return function(_0x512767){try{jsonpatch[_0x59ad('0x35')](_0x512767,_0x207f8a,!![]);}catch(_0x54e326){return BPromise['reject'](_0x54e326);}return _0x512767[_0x59ad('0x36')]();};}function saveUpdates(_0x488307,_0xa1d797){return function(_0x5458e6){if(_0x5458e6){return _0x5458e6[_0x59ad('0x37')](_0x488307)[_0x59ad('0x20')](function(_0x3d4800){return _0x3d4800;});}return null;};}function removeEntity(_0x549c3f,_0x4f2b8b){return function(_0x53279b){if(_0x53279b){return _0x53279b[_0x59ad('0x38')]()[_0x59ad('0x20')](function(){_0x549c3f[_0x59ad('0x2d')](0xcc)[_0x59ad('0x2e')]();});}};}function handleEntityNotFound(_0x3e7c12,_0x3e61d1){return function(_0xb881ea){if(!_0xb881ea){_0x3e7c12['sendStatus'](0x194);}return _0xb881ea;};}function handleError(_0x5ca634,_0x596809){_0x596809=_0x596809||0x1f4;return function(_0x1bd45c){logger[_0x59ad('0x26')](_0x1bd45c['stack']);if(_0x1bd45c[_0x59ad('0x39')]){delete _0x1bd45c['name'];}_0x5ca634[_0x59ad('0x2d')](_0x596809)[_0x59ad('0x3a')](_0x1bd45c);};}function getMustacheRender(_0x1a11fb,_0x1e39e1){return Mustache[_0x59ad('0x3b')](_0x1a11fb,_[_0x59ad('0x3c')](_0x1e39e1[_0x59ad('0x3d')],{'contact':_0x1e39e1[_0x59ad('0x3e')],'message':_0x1e39e1['message'],'agent':_0x1e39e1[_0x59ad('0x3f')],'interaction':_0x1e39e1[_0x59ad('0x40')],'account':_0x1e39e1[_0x59ad('0x41')]}))||'';}function getInteractionUsers(_0x3b191a,_0x1cc0b6){return new BPromise(function(_0x438292,_0x24d419){try{if(_0x1cc0b6[_0x3b191a['id']]){_0x3b191a['Users']=_[_0x59ad('0x42')](_0x1cc0b6[_0x3b191a['id']],function(_0x288a0b){return{'id':_0x288a0b['id'],'fullname':_0x288a0b[_0x59ad('0x43')]};});}}catch(_0x4e893b){_0x24d419(_0x4e893b);}_0x438292(_0x3b191a);});}function getInteractionTags(_0x1f7dac,_0xc2a823){return new BPromise(function(_0x1b1a67,_0x47b8a1){try{if(_0x1f7dac[_0x59ad('0x44')]){_0x1f7dac[_0x59ad('0x45')]=[];_0x1f7dac['TagIds'][_0x59ad('0x46')](',')[_0x59ad('0x47')](function(_0x3a4543){_0x1f7dac['Tags'][_0x59ad('0x48')](_0xc2a823[_0x3a4543]);});}delete _0x1f7dac['TagIds'];}catch(_0x447dea){_0x47b8a1(_0x447dea);}_0x1b1a67(_0x1f7dac);});}function updateChatInteraction(_0x257336,_0x5e8c1f,_0x2a4cad){return new BPromise(function(_0x4aca8a,_0x4d1120){return getInteractionUsers(_0x257336,_0x2a4cad)[_0x59ad('0x20')](function(_0x1a31c5){return getInteractionTags(_0x1a31c5,_0x5e8c1f);})[_0x59ad('0x20')](function(_0x56a34b){_0x4aca8a(_0x56a34b);})[_0x59ad('0x2b')](function(_0x5ca871){_0x4d1120(_0x5ca871);});});}exports[_0x59ad('0x49')]=function(_0x3355d4,_0x5b7c08){var _0x470b7a={},_0x44ca79={},_0x3c10f1={'count':0x0,'rows':[]};var _0x51b34e=_[_0x59ad('0x42')](db['ChatInteraction'][_0x59ad('0x4a')],function(_0x59b01b){return{'name':_0x59b01b[_0x59ad('0x4b')],'type':_0x59b01b['type'][_0x59ad('0x4c')]};});_0x44ca79[_0x59ad('0x4d')]=_[_0x59ad('0x42')](_0x51b34e,_0x59ad('0x39'));_0x44ca79['query']=_['keys'](_0x3355d4[_0x59ad('0x4e')]);_0x44ca79[_0x59ad('0x4f')]=_[_0x59ad('0x50')](_0x44ca79['model'],_0x44ca79[_0x59ad('0x4e')]);_0x470b7a['attributes']=_[_0x59ad('0x50')](_0x44ca79[_0x59ad('0x4d')],qs[_0x59ad('0x51')](_0x3355d4['query'][_0x59ad('0x51')]));_0x470b7a['attributes']=_0x470b7a['attributes']['length']?_0x470b7a['attributes']:_0x44ca79['model'];if(!_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x52')](_0x59ad('0x53'))){_0x470b7a[_0x59ad('0x33')]=qs[_0x59ad('0x33')](_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x33')]);_0x470b7a['offset']=qs[_0x59ad('0x32')](_0x3355d4['query'][_0x59ad('0x32')]);}_0x470b7a[_0x59ad('0x54')]=qs[_0x59ad('0x55')](_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x55')]);_0x470b7a[_0x59ad('0x56')]=qs[_0x59ad('0x4f')](_[_0x59ad('0x57')](_0x3355d4[_0x59ad('0x4e')],_0x44ca79[_0x59ad('0x4f')]),_0x51b34e);var _0xdf5240=[];var _0x3cc7e0=squel[_0x59ad('0x58')]()[_0x59ad('0x59')]('id')[_0x59ad('0x59')](_0x59ad('0x39'))[_0x59ad('0x59')](_0x59ad('0x5a'))[_0x59ad('0x5b')]('tools_tags');var _0x38caaf=squel['select']()[_0x59ad('0x59')]('u.id')[_0x59ad('0x59')]('u.fullname')[_0x59ad('0x59')](_0x59ad('0x5c'))[_0x59ad('0x5b')](_0x59ad('0x5d'),'ui')[_0x59ad('0x5e')](_0x59ad('0x5f'),'u',_0x59ad('0x60'));var _0x12f061=squel[_0x59ad('0x58')]()[_0x59ad('0x5b')](_0x59ad('0x61'),'i')[_0x59ad('0x5e')]('cm_contacts','c',_0x59ad('0x62'))['left_join'](_0x59ad('0x5f'),'o','o.id\x20=\x20i.UserId')[_0x59ad('0x5e')](_0x59ad('0x63'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x59ad('0x5e')](_0x59ad('0x64'),'me','me.ChatInteractionId\x20=\x20i.id')['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x59ad('0x65'),'t',_0x59ad('0x66'));var _0x51b03c=squel['expr']();var _0x22258c=[];var _0x2f4394=squel['expr']();var _0x2d64f9;if(_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x67')]){_0x2d64f9=as[_0x59ad('0x68')](_0x3355d4[_0x59ad('0x4e')]['search']);var _0x34142b=_0x2d64f9[_0x59ad('0x69')];for(var _0x31c421=0x0;_0x31c421<_0x2d64f9[_0x59ad('0x6a')][_0x59ad('0x6b')];_0x31c421++){var _0x1f4118=_0x2d64f9[_0x59ad('0x6a')][_0x31c421];var _0x6d90e8='i';var _0x87d16=_['find'](_0x51b34e,[_0x59ad('0x39'),_0x1f4118[_0x59ad('0x59')]]);if(!_0x87d16){switch(_0x1f4118[_0x59ad('0x59')]){case _0x59ad('0x6c'):if(_0x1f4118['value']==0x1){_0x12f061['having']('`'+_0x1f4118['field']+_0x59ad('0x6d'));}else{_0x12f061[_0x59ad('0x6e')]('`'+_0x1f4118[_0x59ad('0x59')]+_0x59ad('0x6f'));}break;case _0x59ad('0x70'):if(_0x1f4118['operator']===_0x59ad('0x71')){if(_0x1f4118[_0x59ad('0x72')][_0x59ad('0x46')]('\x20')['length']>0x1){_0x51b03c[_0x34142b](_0x59ad('0x73'),qs[_0x59ad('0x74')](_0x1f4118[_0x59ad('0x72')]),null);}else{var _0x501358='%'+_0x1f4118[_0x59ad('0x72')]+'%';_0x51b03c[_0x34142b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x501358,_0x501358,_0x501358);}}else{_0x87d16=_['find'](_0x51b34e,['name',_0x59ad('0x75')]);_0x1f4118[_0x59ad('0x59')]=_0x59ad('0x75');_0x52c036=as['buildExpression'](_0x6d90e8,_0x87d16['type'],_0x1f4118);_0x51b03c[_0x34142b](_0x52c036[_0x59ad('0x76')],_0x52c036[_0x59ad('0x72')][_0x59ad('0x77')],_0x52c036[_0x59ad('0x72')][_0x59ad('0x2e')]);}break;case _0x59ad('0x78'):var _0x2f2971=_0x1f4118[_0x59ad('0x72')][_0x59ad('0x46')](',')[_0x59ad('0x42')](function(_0x756460){return Number(_0x756460);});_0x2f2971[_0x59ad('0x47')](function(_0x2b6482){_0x2f4394['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b6482+',%');});_0x22258c=_[_0x59ad('0x79')](_0x22258c,_0x2f2971);break;case _0x59ad('0x7a'):if(_0x1f4118[_0x59ad('0x7b')]===_0x59ad('0x71')){_0x51b03c[_0x34142b](_0x59ad('0x7c'),'%'+_0x1f4118[_0x59ad('0x72')]+'%',null);}else{_0x87d16=_[_0x59ad('0x7d')](_0x51b34e,[_0x59ad('0x39'),_0x59ad('0x7e')]);_0x1f4118[_0x59ad('0x59')]='UserId';_0x52c036=as['buildExpression'](_0x6d90e8,_0x87d16[_0x59ad('0x7f')],_0x1f4118);_0x51b03c[_0x34142b](_0x52c036[_0x59ad('0x76')],_0x52c036[_0x59ad('0x72')]['start'],_0x52c036[_0x59ad('0x72')][_0x59ad('0x2e')]);}break;case'body':_0x52c036=as['buildExpression']('me',null,_0x1f4118);_0x51b03c[_0x34142b](_0x52c036[_0x59ad('0x76')],_0x52c036[_0x59ad('0x72')]['start'],_0x52c036[_0x59ad('0x72')][_0x59ad('0x2e')]);break;}}else{var _0x52c036=as[_0x59ad('0x80')](_0x6d90e8,_0x87d16[_0x59ad('0x7f')],_0x1f4118);_0x51b03c[_0x34142b](_0x52c036['text'],_0x52c036[_0x59ad('0x72')][_0x59ad('0x77')],_0x52c036[_0x59ad('0x72')][_0x59ad('0x2e')]);}}}else{var _0xcc0c1c=_(_0x3355d4[_0x59ad('0x4e')])[_0x59ad('0x81')]()['map'](function(_0x581419){return _[_0x59ad('0x82')](_0x51b34e,['name',_0x581419])?_0x581419:undefined;})[_0x59ad('0x83')]()['value']();if(!_['isEmpty'](_0xcc0c1c)){_0xcc0c1c['forEach'](function(_0x2863a6){if(_0x2863a6===_0x59ad('0x84')){_0x12f061[_0x59ad('0x56')](_0x59ad('0x85'),[][_0x59ad('0x86')](_0x3355d4[_0x59ad('0x4e')][_0x2863a6]));}else if(_0x2863a6===_0x59ad('0x87')){var _0x9944f=JSON[_0x59ad('0x88')](_0x3355d4[_0x59ad('0x4e')][_0x2863a6])[_0x59ad('0x89')];var _0x5343a0=JSON['parse'](_0x3355d4['query'][_0x2863a6])[_0x59ad('0x8a')];_0x12f061[_0x59ad('0x56')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x9944f,_0x5343a0);}else{if(_0x3355d4[_0x59ad('0x4e')][_0x2863a6]==='null'){_0x12f061['where']('i.'+_0x2863a6+_0x59ad('0x8b'));}else{_0x12f061[_0x59ad('0x56')]('i.'+_0x2863a6+_0x59ad('0x8c'),_0x3355d4['query'][_0x2863a6]);}}});}if(_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x8d')]){if(_0x3355d4['query'][_0x59ad('0x8d')]==0x1){_0x12f061['having'](_0x59ad('0x8e'));}else{_0x12f061['having']('`unreadMessages`\x20>\x200');}}if(_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x8f')]){_0x22258c=_['isArray'](_0x3355d4['query'][_0x59ad('0x8f')])?_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x8f')]:new Array(_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x8f')]);_0x22258c[_0x59ad('0x47')](function(_0x1ded16){_0x2f4394['or'](_0x59ad('0x90'),'%,'+_0x1ded16+',%');});}if(_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x91')]){var _0x3373d1=_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x91')]['replace']('\x5c','\x5c\x5c')[_0x59ad('0x92')](/'/g,'\x27\x27');if(qs[_0x59ad('0x93')](_0x3373d1)){_0x51b03c['or'](_0x59ad('0x94'),_0x3373d1+'%');}else{_0x51b03c['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x59ad('0x74')](_0x3373d1))['or'](_0x59ad('0x95'),_0x3373d1+'%');}}}_0x12f061[_0x59ad('0x56')](_0x51b03c);_0x12f061['group'](_0x59ad('0x96'));var _0x55a282={'type':db['Sequelize'][_0x59ad('0x97')][_0x59ad('0x98')],'raw':!![]};var _0x4029ce=_0x12f061[_0x59ad('0x99')]();_0x4029ce[_0x59ad('0x59')](_0x59ad('0x96'));_0x4029ce[_0x59ad('0x59')](_0x59ad('0x9a'),'unreadMessages');if(_0x470b7a['order']){_0x470b7a[_0x59ad('0x54')]['forEach'](function(_0x43825d){var _0x2a05dc=_0x43825d[0x0]==='contactName'?_0x43825d[0x0]:'i.'+_0x43825d[0x0];_0x12f061[_0x59ad('0x54')](_0x2a05dc,_0x43825d[0x1]===_0x59ad('0x9b')?![]:!![]);});}if(!_['isEmpty'](_0x22258c)){_0x12f061[_0x59ad('0x6e')](_0x2f4394);_0x4029ce['where']('t.id\x20IN\x20?',_0x22258c);}BPromise[_0x59ad('0x9c')]()[_0x59ad('0x20')](function(){if(!_0x2d64f9){if(_0x3355d4['query'][_0x59ad('0x84')])return;_0x4029ce[_0x59ad('0x56')](_0x59ad('0x9d'));_0x12f061[_0x59ad('0x56')](_0x59ad('0x9d'));return;}if(_0x3355d4[_0x59ad('0x9e')][_0x59ad('0x9f')]!==_0x59ad('0x3f'))return;return _0x3355d4[_0x59ad('0x9e')][_0x59ad('0xa0')]({'attributes':['id'],'raw':!![]})[_0x59ad('0x20')](function(_0x69f4c2){if(_[_0x59ad('0xa1')](_0x69f4c2)){_0x4029ce[_0x59ad('0x56')](_0x59ad('0xa2'));_0x12f061[_0x59ad('0x56')](_0x59ad('0xa2'));}else{_0x4029ce[_0x59ad('0x56')](_0x59ad('0x85'),_[_0x59ad('0x42')](_0x69f4c2,'id'));_0x12f061[_0x59ad('0x56')]('i.ChatWebsiteId\x20IN\x20?',_[_0x59ad('0x42')](_0x69f4c2,'id'));}});})['then'](function(){if(_0x3355d4[_0x59ad('0x9e')]['role']===_0x59ad('0x3f')&&!_0x2d64f9&&!_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x84')])return[];return db[_0x59ad('0xa3')][_0x59ad('0x4e')](_0x4029ce[_0x59ad('0xa4')](),_0x55a282);})[_0x59ad('0x20')](function(_0x37eae9){_0x3c10f1['count']=_0x37eae9[_0x59ad('0x6b')];if(_0x3c10f1[_0x59ad('0x31')]===0x0)return[];return db[_0x59ad('0xa3')][_0x59ad('0x4e')](_0x3cc7e0[_0x59ad('0xa4')](),_0x55a282)['then'](function(_0x4899cb){_0xdf5240=_[_0x59ad('0xa5')](_0x4899cb,'id');_0x55a282=_['merge'](_0x55a282,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3355d4[_0x59ad('0x4e')][_0x59ad('0x51')]){_0x470b7a[_0x59ad('0xa6')]['forEach'](function(_0x1f4c0c){_0x12f061['field']('i.'+_0x1f4c0c);});}else{_0x12f061[_0x59ad('0x59')](_0x59ad('0x9a'),_0x59ad('0x6c'));_0x12f061[_0x59ad('0x59')](_0x59ad('0xa7'),_0x59ad('0xa8'));_0x12f061[_0x59ad('0x59')]('a.mandatoryDisposition',_0x59ad('0xa9'));_0x12f061[_0x59ad('0x59')](_0x59ad('0xaa'),_0x59ad('0xab'));_0x12f061[_0x59ad('0x59')](_0x59ad('0xac'));_0x12f061[_0x59ad('0x59')]('c.firstName',_0x59ad('0xad'));_0x12f061[_0x59ad('0x59')](_0x59ad('0xae'),'Contact.lastName');_0x12f061[_0x59ad('0x59')](_0x59ad('0xaf'),_0x59ad('0xb0'));_0x12f061[_0x59ad('0x59')](_0x59ad('0xb1'),_0x59ad('0xb2'));_0x12f061[_0x59ad('0x59')](_0x59ad('0xb3'),'Contact.mobile');_0x12f061[_0x59ad('0x59')](_0x59ad('0xb4'),_0x59ad('0xb5'));_0x12f061[_0x59ad('0x59')]('o.fullname','Owner.fullname');_0x12f061['field'](_0x59ad('0xb6'),_0x59ad('0xb7'));_0x12f061[_0x59ad('0x59')](_0x59ad('0xb8'),_0x59ad('0x44'));}if(_0x470b7a[_0x59ad('0x33')])_0x12f061['limit'](_0x470b7a[_0x59ad('0x33')]);if(_0x470b7a[_0x59ad('0x32')])_0x12f061[_0x59ad('0x32')](_0x470b7a[_0x59ad('0x32')]);return db[_0x59ad('0xa3')][_0x59ad('0x4e')](_0x12f061['toString'](),_0x55a282);})[_0x59ad('0x20')](function(_0xf57e00){if(_0xf57e00[_0x59ad('0x6b')]>0x0)_0x38caaf[_0x59ad('0x56')](_0x59ad('0xb9'),_[_0x59ad('0x42')](_0xf57e00,'id'));return db[_0x59ad('0xa3')]['query'](_0x38caaf[_0x59ad('0xa4')](),_0x55a282)[_0x59ad('0x20')](function(_0x4d7b54){var _0x44190b=_['groupBy'](_0x4d7b54,_0x59ad('0xba'));var _0x7ce2d6=[];_0xf57e00[_0x59ad('0x47')](function(_0x33fa4e){_0x7ce2d6[_0x59ad('0x48')](updateChatInteraction(_0x33fa4e,_0xdf5240,_0x44190b));});return BPromise['all'](_0x7ce2d6);});});})[_0x59ad('0x20')](function(_0x3c1abc){_0x3c10f1['rows']=_0x3c1abc;return _0x3c10f1;})[_0x59ad('0x20')](respondWithFilteredResult(_0x5b7c08,_0x470b7a))['catch'](handleError(_0x5b7c08,null));};exports[_0x59ad('0xbb')]=function(_0x80505a,_0x41a645){var _0x1c711f={'raw':![],'where':{'id':_0x80505a['params']['id']}},_0x220798={};_0x220798[_0x59ad('0x4d')]=_[_0x59ad('0x81')](db['ChatInteraction'][_0x59ad('0x4a')]);_0x220798[_0x59ad('0x4e')]=_['keys'](_0x80505a[_0x59ad('0x4e')]);_0x220798[_0x59ad('0x4f')]=_['intersection'](_0x220798[_0x59ad('0x4d')],_0x220798['query']);_0x1c711f[_0x59ad('0xa6')]=_[_0x59ad('0x50')](_0x220798[_0x59ad('0x4d')],qs[_0x59ad('0x51')](_0x80505a[_0x59ad('0x4e')]['fields']));_0x1c711f['attributes']=_0x1c711f[_0x59ad('0xa6')][_0x59ad('0x6b')]?_0x1c711f[_0x59ad('0xa6')]:_0x220798['model'];if(_0x80505a['query']['includeAll']){_0x1c711f[_0x59ad('0xbc')]=[{'all':!![]}];}_0x1c711f=_[_0x59ad('0x3c')]({},_0x1c711f,_0x80505a[_0x59ad('0xbd')]);return db[_0x59ad('0xbe')][_0x59ad('0x7d')](_0x1c711f)['then'](handleEntityNotFound(_0x41a645,null))[_0x59ad('0x20')](respondWithResult(_0x41a645,null))[_0x59ad('0x2b')](handleError(_0x41a645,null));};exports[_0x59ad('0xbf')]=function(_0x4ebd1d,_0x819409){return db[_0x59ad('0xbe')][_0x59ad('0xbf')](_0x4ebd1d[_0x59ad('0x3d')],{})[_0x59ad('0x20')](respondWithResult(_0x819409,0xc9))[_0x59ad('0x2b')](handleError(_0x819409,null));};exports[_0x59ad('0x37')]=function(_0x430641,_0x41e50b){if(_0x430641[_0x59ad('0x3d')]['id']){delete _0x430641[_0x59ad('0x3d')]['id'];}return db[_0x59ad('0xbe')][_0x59ad('0x7d')]({'where':{'id':_0x430641[_0x59ad('0xc0')]['id']}})[_0x59ad('0x20')](handleEntityNotFound(_0x41e50b,null))[_0x59ad('0x20')](saveUpdates(_0x430641[_0x59ad('0x3d')],null))['then'](respondWithResult(_0x41e50b,null))[_0x59ad('0x2b')](handleError(_0x41e50b,null));};exports[_0x59ad('0x38')]=function(_0x3d43bd,_0xc852a6){return db[_0x59ad('0xbe')][_0x59ad('0x7d')]({'where':{'id':_0x3d43bd['params']['id']}})[_0x59ad('0x20')](handleEntityNotFound(_0xc852a6,null))['then'](removeEntity(_0xc852a6,null))['catch'](handleError(_0xc852a6,null));};exports[_0x59ad('0xc1')]=function(_0x387965,_0x283e7b){return db[_0x59ad('0xbe')][_0x59ad('0xc1')]()[_0x59ad('0x20')](respondWithResult(_0x283e7b,null))[_0x59ad('0x2b')](handleError(_0x283e7b,null));};exports[_0x59ad('0xc2')]=function(_0xb9763c,_0x405b02){var _0x525b2f=_0xb9763c[_0x59ad('0xc0')]['id'];var _0x460f4f;var _0x56711d;var _0x5d504a;return db[_0x59ad('0xbe')][_0x59ad('0xc3')]({'where':{'id':_0x525b2f}})[_0x59ad('0x20')](function(_0x4e0cae){_0x460f4f=_0x4e0cae;return db[_0x59ad('0xc4')][_0x59ad('0xc3')]({'where':{'id':_0x4e0cae['ChatWebsiteId']},'attributes':['id',_0x59ad('0xc5'),'vidaooEscalation',_0x59ad('0xc6'),_0x59ad('0xc7'),_0x59ad('0xc8')],'raw':!![]});})[_0x59ad('0x20')](function(_0x55b05f){if(_0x55b05f&&_0x55b05f[_0x59ad('0xc5')]&&_0x55b05f[_0x59ad('0xc9')]){_0x56711d=_0x55b05f;var _0xbfddb5={'interaction':{'id':_0x525b2f},'agent':{'id':_0xb9763c['user']['id'],'name':_0xb9763c[_0x59ad('0x9e')][_0x59ad('0x39')],'fullname':_0xb9763c[_0x59ad('0x9e')][_0x59ad('0x43')],'email':_0xb9763c[_0x59ad('0x9e')][_0x59ad('0xca')]},'contact':_0xb9763c[_0x59ad('0x3d')][_0x59ad('0x3e')],'account':_0xb9763c[_0x59ad('0x3d')][_0x59ad('0x41')]};var _0x3e00a9={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x55b05f[_0x59ad('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xb9763c[_0x59ad('0x9e')][_0x59ad('0xca')]],'buttons':null,'topic':_0x56711d['vidaooTopic'],'note':_[_0x59ad('0xcb')](_0x56711d[_0x59ad('0xc7')])?null:getMustacheRender(_0x56711d[_0x59ad('0xc7')],_0xbfddb5),'metadata':null},'redirect':_0x59ad('0xcc'),'json':!![]};try{if(!_['isNull'](_0x56711d[_0x59ad('0xc8')])){var _0x46ec3c=getMustacheRender(_0x56711d[_0x59ad('0xc8')],_0xbfddb5);var _0x49d9b4=JSON[_0x59ad('0x88')](_0x46ec3c);_0x3e00a9['body'][_0x59ad('0xcd')]=_0x49d9b4;}}catch(_0x2aa1bc){throw new db['Sequelize']['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x3e00a9);}else{throw new db[(_0x59ad('0xce'))][(_0x59ad('0xcf'))](_0x59ad('0xd0'));}})[_0x59ad('0x20')](function(_0x412354){_0x5d504a=_0x412354;if(_0x5d504a['id']){var _0x2ea9de={'body':_0x5d504a[_0x59ad('0xd1')],'ChatWebsiteId':_0x56711d['id'],'ChatInteractionId':_0x460f4f['id'],'direction':_0x59ad('0xd2'),'UserId':_0xb9763c[_0x59ad('0x9e')]['id']};return db[_0x59ad('0xd3')][_0x59ad('0xbf')](_0x2ea9de,{});}else{throw new db['Sequelize']['ValidationError'](_0x59ad('0xd4'));}})[_0x59ad('0x20')](function(){return _0x460f4f[_0x59ad('0xd5')]({'vidaooSessionId':_0x5d504a['id']});})[_0x59ad('0x20')](respondWithResult(_0x405b02,null))[_0x59ad('0x2b')](handleError(_0x405b02,null));};exports[_0x59ad('0xd6')]=function(_0x37d4a8,_0x26120c){if(_0x37d4a8[_0x59ad('0x3d')]['id']){delete _0x37d4a8['body']['id'];}return db[_0x59ad('0xbe')][_0x59ad('0x7d')]({'where':{'id':_0x37d4a8[_0x59ad('0xc0')]['id']},'include':[{'model':db[_0x59ad('0xd7')],'as':_0x59ad('0x70')}]})[_0x59ad('0x20')](handleEntityNotFound(_0x26120c,null))[_0x59ad('0x20')](saveUpdates(_0x37d4a8[_0x59ad('0x3d')],null))[_0x59ad('0x20')](respondWithResult(_0x26120c,null))[_0x59ad('0x2b')](handleError(_0x26120c,null));};exports[_0x59ad('0xd8')]=function(_0x3cb1ba,_0x2f7f6a,_0x359623){if(_0x3cb1ba[_0x59ad('0x3d')]['id']){delete _0x3cb1ba[_0x59ad('0x3d')]['id'];}return db[_0x59ad('0xbe')][_0x59ad('0x7d')]({'where':{'id':_0x3cb1ba[_0x59ad('0xc0')]['id']}})['then'](function(_0x31a947){if(!_0x31a947){logger[_0x59ad('0x26')](_0x59ad('0xd9'),_0x59ad('0xd8'),0x194,'entity\x20not\x20found');_0x2f7f6a[_0x59ad('0x2c')](0x194);}else{if(_0x31a947[_0x59ad('0x7e')]){throw new db['Sequelize'][(_0x59ad('0xcf'))]('Interaction\x20already\x20assigned');}}return _0x31a947;})['then'](function(_0x269266){if(_0x269266){return _0x269266['update']({'closed':_0x3cb1ba[_0x59ad('0x3d')][_0x59ad('0xda')],'disposition':_0x3cb1ba[_0x59ad('0x3d')][_0x59ad('0xdb')]})['then'](function(_0x454ce8){return _0x454ce8;});}})[_0x59ad('0x20')](function(_0x26b4c9){return respondWithRpcPromise('AbandonInteraction',_0x59ad('0xd8'),_0x3cb1ba['body'],client9004);})[_0x59ad('0x20')](respondWithResult(_0x2f7f6a,null))[_0x59ad('0x2b')](handleError(_0x2f7f6a,null));};exports[_0x59ad('0xdc')]=function(_0xcb5685,_0x778177,_0x3bf8bc){_0xcb5685[_0x59ad('0x3d')][_0x59ad('0x39')]=_0xcb5685[_0x59ad('0xdd')][_0x59ad('0xde')];_0xcb5685[_0x59ad('0x3d')][_0x59ad('0xdf')]=_0xcb5685[_0x59ad('0xdd')]['filename'];_0xcb5685[_0x59ad('0x3d')][_0x59ad('0x7f')]=_0xcb5685['file'][_0x59ad('0xe0')];return db['Attachment'][_0x59ad('0xbf')](_0xcb5685[_0x59ad('0x3d')])[_0x59ad('0x20')](respondWithResult(_0x778177,0xc9))[_0x59ad('0x2b')](handleError(_0x778177,null));};exports[_0x59ad('0xe1')]=function(_0x1af6ad,_0x596c77,_0xd323b3){return db[_0x59ad('0xbe')][_0x59ad('0xc3')]({'where':{'id':_0x1af6ad['params']['id']},'raw':!![]})[_0x59ad('0x20')](handleEntityNotFound(_0x596c77,null))[_0x59ad('0x20')](function(_0x521a2f){if(_0x521a2f){if(_0x521a2f[_0x59ad('0xda')]){return _0x596c77['status'](0x193)['json']({'status':0x193,'message':_0x59ad('0xe2')});}return db[_0x59ad('0xe3')][_0x59ad('0xc3')]({'where':{'id':_0x1af6ad[_0x59ad('0x4e')][_0x59ad('0xe4')]},'raw':!![]})[_0x59ad('0x20')](handleEntityNotFound(_0x596c77,null));}})[_0x59ad('0x20')](function(_0x4d7991){if(_0x4d7991){var _0x5c66ed=_0x4d7991[_0x59ad('0xe5')]!==null;var _0x587f08=path[_0x59ad('0xe6')](config[_0x59ad('0xe7')],_0x59ad('0xe8'));if(_0x5c66ed){_0x587f08=path[_0x59ad('0xe6')](_0x587f08,_0x59ad('0xe9'));}var _0x28334c=path[_0x59ad('0xe6')](_0x587f08,_0x4d7991[_0x59ad('0xdf')]);return _0x596c77[_0x59ad('0xea')](_0x28334c);}})[_0x59ad('0x2b')](handleError(_0x596c77,null));};exports[_0x59ad('0xeb')]=function(_0x5d4d32,_0x179148){var _0x48fa61=null;var _0x363e1f=null;var _0xd4eabb=null;var _0x1d82cd=null;if(_0x5d4d32[_0x59ad('0x3d')]['id']){delete _0x5d4d32[_0x59ad('0x3d')]['id'];}if(_0x5d4d32[_0x59ad('0x3d')][_0x59ad('0xec')]){_0x1d82cd=path[_0x59ad('0xe6')](config['root'],_0x59ad('0xed'),util[_0x59ad('0xee')]('transcript-%s.txt',Date[_0x59ad('0xef')]()));_0x5d4d32[_0x59ad('0x3d')][_0x59ad('0xf0')]=_0x1d82cd;}return db['ChatInteraction']['find']({'where':{'id':_0x5d4d32[_0x59ad('0xc0')]['id']},'include':[{'model':db[_0x59ad('0xd3')],'as':_0x59ad('0xf1'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x59ad('0x20')](handleEntityNotFound(_0x179148,null))[_0x59ad('0x20')](saveUpdates(_0x5d4d32[_0x59ad('0x3d')],null))[_0x59ad('0x20')](function(_0x12bfd7){if(_0x12bfd7){_0x48fa61=_0x12bfd7;return db[_0x59ad('0xc4')][_0x59ad('0x7d')]({'where':{'id':_0x48fa61['ChatWebsiteId']}});}})['then'](function(_0x18dbac){if(_0x18dbac){_0xd4eabb=_0x18dbac;return db[_0x59ad('0xd7')][_0x59ad('0x7d')]({'where':{'id':_0x48fa61['ContactId']}});}})['then'](function(_0x20308c){if(_0x20308c){_0x363e1f=_0x20308c;if(_0x1d82cd){var _0x55a713=null;for(var _0x19786b=0x1;_0x19786b<_0x48fa61[_0x59ad('0xf1')][_0x59ad('0x6b')];++_0x19786b){_0x55a713=_0x48fa61['Messages'][_0x19786b];var _0x119c7f=_0x55a713['UserId']?util[_0x59ad('0xee')]('%s%d',_0xd4eabb[_0x59ad('0xf2')],_0x55a713[_0x59ad('0x7e')]):_0x59ad('0xf3');var _0x305611=_0x5d4d32[_0x59ad('0x3d')][_0x59ad('0xf4')]||util[_0x59ad('0xee')](_0x59ad('0xf5'),'Visitor',_0x55a713[_0x59ad('0x75')]);switch(_0xd4eabb[_0x59ad('0xf6')]){case _0x59ad('0xf7'):_0x119c7f=_0x55a713[_0x59ad('0x7e')]?util[_0x59ad('0xee')](_0x59ad('0xf5'),_0xd4eabb[_0x59ad('0xf2')],_0x55a713[_0x59ad('0x7e')]):_0x59ad('0xf3');break;case _0x59ad('0xf8'):_0x119c7f=_0x55a713['UserId']?_0x55a713['User']['alias']||_0x55a713['User'][_0x59ad('0x43')]:'System';break;case _0x59ad('0xf9'):_0x119c7f=_0x55a713['UserId']?_0x55a713['User'][_0x59ad('0x43')]:_0x59ad('0xf3');break;default:_0x119c7f=_0x55a713[_0x59ad('0x7e')]?util[_0x59ad('0xee')]('%s%d',_0xd4eabb['agentAlias'],_0x55a713[_0x59ad('0x7e')]):_0x59ad('0xf3');}var _0x12a231=util[_0x59ad('0xee')](_0x59ad('0xfa'),moment(_0x55a713[_0x59ad('0x87')])[_0x59ad('0xee')]('MM/DD/YYYY\x20HH:mm:ss'),_0x55a713[_0x59ad('0xfb')]==='in'?_0x305611:_0x119c7f,_0x55a713[_0x59ad('0x3d')]);if(!_0x55a713[_0x59ad('0xfc')]){fs['appendFileSync'](_0x1d82cd,_0x12a231);}}return db[_0x59ad('0xfd')][_0x59ad('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0x59ad('0xfe')],'as':'Smtp','raw':!![]}]});}}})[_0x59ad('0x20')](function(_0x1170db){if(_0x1170db&&_0x1170db[_0x59ad('0xff')]&&_0x5d4d32['body']){var _0x272de7={'tls':{'rejectUnauthorized':![]}};if(_0x1170db[_0x59ad('0xff')]['service']){_0x272de7[_0x59ad('0x100')]=_0x1170db[_0x59ad('0xff')][_0x59ad('0x100')];}else{_0x272de7[_0x59ad('0x101')]=_0x1170db[_0x59ad('0xff')][_0x59ad('0x101')];_0x272de7[_0x59ad('0x102')]=_0x1170db[_0x59ad('0xff')][_0x59ad('0x102')];_0x272de7[_0x59ad('0x103')]=_0x1170db['Smtp'][_0x59ad('0x103')];}if(_0x1170db['Smtp'][_0x59ad('0x104')]){_0x272de7[_0x59ad('0x105')]={'user':_0x1170db[_0x59ad('0xff')][_0x59ad('0x9e')],'pass':_0x1170db[_0x59ad('0xff')][_0x59ad('0x106')]};}return respondWithRpcPromise(_0x59ad('0x107'),'sendMail',{'account':_0x272de7,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1170db[_0x59ad('0x39')],_0x1170db[_0x59ad('0xca')]||_0x1170db[_0x59ad('0xff')][_0x59ad('0x9e')]),'to':_0x5d4d32[_0x59ad('0x3d')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x59ad('0xee')](_0x59ad('0x108'),_0x5d4d32['body'][_0x59ad('0xec')]),'attachments':[{'path':_0x1d82cd}]}})[_0x59ad('0x20')](function(){return _0x48fa61;})[_0x59ad('0x2b')](function(_0x24c80d){console[_0x59ad('0x26')](_0x24c80d);});}else{return _0x48fa61;}})[_0x59ad('0x20')](respondWithStatusCode(_0x179148,0xc8))[_0x59ad('0x2b')](handleError(_0x179148,null));};exports[_0x59ad('0x109')]=function(_0x3b49b,_0x2a421b,_0x42c191){return db[_0x59ad('0xd3')]['find']({'where':{'id':_0x3b49b['params']['id']}})[_0x59ad('0x20')](handleEntityNotFound(_0x2a421b,null))[_0x59ad('0x20')](function(_0x3339b6){if(_0x3339b6){return _0x3339b6[_0x59ad('0x109')](_0x3b49b[_0x59ad('0x3d')][_0x59ad('0x10a')],_['omit'](_0x3b49b['body'],[_0x59ad('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x2a421b,null))[_0x59ad('0x2b')](handleError(_0x2a421b,null));};exports['getMessages']=function(_0x2fd591,_0xe8c6c,_0x6334a2){var _0x4eb360={'raw':![],'where':{}};var _0xcbab48={};var _0x2d5bb0={'count':0x0,'rows':[]};return db[_0x59ad('0xbe')][_0x59ad('0xc3')]({'where':{'id':_0x2fd591[_0x59ad('0xc0')]['id']}})[_0x59ad('0x20')](handleEntityNotFound(_0xe8c6c,null))[_0x59ad('0x20')](function(_0x110f1e){if(_0x110f1e){_0xcbab48[_0x59ad('0x4d')]=_[_0x59ad('0x81')](db['ChatMessage'][_0x59ad('0x4a')]);_0xcbab48[_0x59ad('0x4e')]=_[_0x59ad('0x81')](_0x2fd591[_0x59ad('0x4e')]);_0xcbab48['filters']=_['intersection'](_0xcbab48[_0x59ad('0x4d')],_0xcbab48[_0x59ad('0x4e')]);_0x4eb360[_0x59ad('0xa6')]=_[_0x59ad('0x50')](_0xcbab48[_0x59ad('0x4d')],qs[_0x59ad('0x51')](_0x2fd591[_0x59ad('0x4e')][_0x59ad('0x51')]));_0x4eb360[_0x59ad('0xa6')]=_0x4eb360['attributes']['length']?_0x4eb360[_0x59ad('0xa6')]:_0xcbab48[_0x59ad('0x4d')];if(!_0x2fd591[_0x59ad('0x4e')][_0x59ad('0x52')](_0x59ad('0x53'))){_0x4eb360[_0x59ad('0x33')]=qs[_0x59ad('0x33')](_0x2fd591['query']['limit']);_0x4eb360[_0x59ad('0x32')]=qs['offset'](_0x2fd591[_0x59ad('0x4e')]['offset']);}_0x4eb360[_0x59ad('0x54')]=qs['sort'](_0x2fd591['query'][_0x59ad('0x55')]);_0x4eb360[_0x59ad('0x56')]=qs[_0x59ad('0x4f')](_[_0x59ad('0x57')](_0x2fd591['query'],_0xcbab48['filters']));_0x4eb360[_0x59ad('0x56')]['ChatInteractionId']=_0x110f1e['id'];if(_0x2fd591[_0x59ad('0x4e')][_0x59ad('0x91')]){_0x4eb360['where']=_[_0x59ad('0x3c')](_0x4eb360[_0x59ad('0x56')],{'$or':_[_0x59ad('0x42')](_0x4eb360[_0x59ad('0xa6')],function(_0x57e4dd){var _0x5f21e7={};_0x5f21e7[_0x57e4dd]={'$like':'%'+_0x2fd591['query'][_0x59ad('0x91')]+'%'};return _0x5f21e7;})});}if(_0x2fd591[_0x59ad('0x4e')][_0x59ad('0x89')]){var _0x269ba8=_0x2fd591[_0x59ad('0x4e')]['$gte'][_0x59ad('0x46')](',');var _0x460cd3={};_0x460cd3[_0x269ba8[0x0]]={'$gte':moment(_0x269ba8[0x1])[_0x59ad('0xee')](_0x59ad('0x10b'))};_0x4eb360[_0x59ad('0x56')]=_[_0x59ad('0x3c')](_0x4eb360[_0x59ad('0x56')],_0x460cd3);}_0x4eb360=_[_0x59ad('0x3c')]({},_0x4eb360,_0x2fd591['options']);return db[_0x59ad('0xd3')][_0x59ad('0x31')]({'where':_0x4eb360[_0x59ad('0x56')]})[_0x59ad('0x20')](function(_0x2689fd){_0x2d5bb0[_0x59ad('0x31')]=_0x2689fd;if(_0x2fd591['query'][_0x59ad('0x10c')]){_0x4eb360['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4eb360);})['then'](function(_0x240b9c){_0x2d5bb0[_0x59ad('0x10d')]=_0x240b9c;return _0x2d5bb0;});}})['then'](respondWithFilteredResult(_0xe8c6c,_0x4eb360))[_0x59ad('0x2b')](handleError(_0xe8c6c,null));};exports[_0x59ad('0x10e')]=function(_0x51c03b,_0x5e29cd,_0x375d7b){var _0x49dbdf={'where':{}},_0xbcca5a={},_0x247481={'count':0x0,'rows':[]};return db[_0x59ad('0xbe')][_0x59ad('0xc3')]({'where':{'id':_0x51c03b[_0x59ad('0xc0')]['id']}})[_0x59ad('0x20')](handleEntityNotFound(_0x5e29cd,null))[_0x59ad('0x20')](function(_0x28745a){if(_0x28745a){_0xbcca5a[_0x59ad('0x4d')]=_['keys'](db[_0x59ad('0xd3')][_0x59ad('0x4a')]);_0xbcca5a[_0x59ad('0x4e')]=_['keys'](_0x51c03b['query']);_0xbcca5a['filters']=_[_0x59ad('0x50')](_0xbcca5a[_0x59ad('0x4d')],_0xbcca5a[_0x59ad('0x4e')]);_0x49dbdf['attributes']=_[_0x59ad('0x50')](_0xbcca5a[_0x59ad('0x4d')],qs[_0x59ad('0x51')](_0x51c03b['query'][_0x59ad('0x51')]));_0x49dbdf[_0x59ad('0xa6')]=_0x49dbdf[_0x59ad('0xa6')][_0x59ad('0x6b')]?_0x49dbdf[_0x59ad('0xa6')]:_0xbcca5a['model'];if(!_0x51c03b['query'][_0x59ad('0x52')](_0x59ad('0x53'))){_0x49dbdf[_0x59ad('0x33')]=qs[_0x59ad('0x33')](_0x51c03b[_0x59ad('0x4e')]['limit']);_0x49dbdf[_0x59ad('0x32')]=qs[_0x59ad('0x32')](_0x51c03b[_0x59ad('0x4e')][_0x59ad('0x32')]);}_0x49dbdf[_0x59ad('0x54')]=qs[_0x59ad('0x55')](_0x51c03b[_0x59ad('0x4e')]['sort']);_0x49dbdf['where']=qs[_0x59ad('0x4f')](_['pick'](_0x51c03b[_0x59ad('0x4e')],_0xbcca5a[_0x59ad('0x4f')]));_0x49dbdf[_0x59ad('0x56')][_0x59ad('0xba')]=_0x28745a['id'];if(_0x51c03b['query']['filter']){_0x49dbdf['where']=_[_0x59ad('0x3c')](_0x49dbdf[_0x59ad('0x56')],{'$or':_[_0x59ad('0x42')](_0x49dbdf[_0x59ad('0xa6')],function(_0x225978){var _0x3bf9f2={};_0x3bf9f2[_0x225978]={'$like':'%'+_0x51c03b[_0x59ad('0x4e')][_0x59ad('0x91')]+'%'};return _0x3bf9f2;})});}_0x49dbdf['where'][_0x59ad('0xfc')]=![];if(_0x51c03b[_0x59ad('0x4e')]['id']){_0x49dbdf['where']['id']={'$gt':_0x51c03b[_0x59ad('0x4e')]['id']};}_0x49dbdf=_[_0x59ad('0x3c')]({},_0x49dbdf,_0x51c03b['options']);return db[_0x59ad('0xd3')][_0x59ad('0x31')]({'where':_0x49dbdf['where']})['then'](function(_0x2218cd){_0x247481[_0x59ad('0x31')]=_0x2218cd;_0x49dbdf['include']=[];if(_0x51c03b[_0x59ad('0x4e')]['includeAgent']){_0x49dbdf['include'][_0x59ad('0x48')]({'model':db[_0x59ad('0x7a')],'as':'User','attributes':['id',_0x59ad('0x43'),_0x59ad('0x10f')]});}if(_0x51c03b['query'][_0x59ad('0x10c')]){_0x49dbdf[_0x59ad('0xbc')]=[{'all':!![]}];}return db[_0x59ad('0xd3')][_0x59ad('0x110')](_0x49dbdf);})[_0x59ad('0x20')](function(_0x152f78){_0x247481['rows']=_0x152f78;return _0x247481;});}})['then'](respondWithFilteredResult(_0x5e29cd,_0x49dbdf))['catch'](handleError(_0x5e29cd,null));};exports[_0x59ad('0x111')]=function(_0x3917c3,_0x3ffc5a,_0x15042a){return db[_0x59ad('0xbe')]['find']({'where':{'id':_0x3917c3['params']['id']}})[_0x59ad('0x20')](handleEntityNotFound(_0x3ffc5a,null))[_0x59ad('0x20')](function(_0x46b709){if(_0x46b709){return _0x46b709[_0x59ad('0x112')](_0x3917c3['body']['ids'],_[_0x59ad('0x113')](_0x3917c3[_0x59ad('0x3d')],[_0x59ad('0x10a'),'id'])||{})[_0x59ad('0x114')](function(){return db[_0x59ad('0x78')][_0x59ad('0x110')]({'attributes':['id',_0x59ad('0x39'),'color'],'where':{'id':_0x3917c3[_0x59ad('0x3d')][_0x59ad('0x10a')]}});})[_0x59ad('0x20')](function(_0x36a70d){socket[_0x59ad('0x115')]('chatInteractionTags:save',{'id':Number(_0x3917c3['params']['id']),'tags':_0x36a70d||[]});return{'id':Number(_0x3917c3['params']['id']),'tags':_0x36a70d||[]};});}})['then'](respondWithResult(_0x3ffc5a,null))[_0x59ad('0x2b')](handleError(_0x3ffc5a,null));};exports[_0x59ad('0x116')]=function(_0x144fd4,_0x5b0801,_0x692a2e){return db[_0x59ad('0xbe')][_0x59ad('0x7d')]({'where':{'id':_0x144fd4['params']['id']}})['then'](handleEntityNotFound(_0x5b0801,null))[_0x59ad('0x20')](function(_0x42f584){if(_0x42f584){return _0x42f584[_0x59ad('0x116')](_0x144fd4['query'][_0x59ad('0x10a')]);}})['then'](respondWithStatusCode(_0x5b0801,null))[_0x59ad('0x2b')](handleError(_0x5b0801,null));};exports[_0x59ad('0xea')]=function(_0x5722da,_0x5835bd){var _0x405744=moment()[_0x59ad('0x117')]()[_0x59ad('0xa4')]();var _0x9e2ed6=path['join'](config[_0x59ad('0xe7')],_0x59ad('0x118'),'files',_0x59ad('0x119'));var _0x387db2=path[_0x59ad('0xe6')](config[_0x59ad('0xe7')],_0x59ad('0x118'),_0x59ad('0x11a'),'attachments');var _0x574131=path['join'](_0x9e2ed6,_0x405744);var _0x1ce472=util[_0x59ad('0xee')](_0x59ad('0x11b'),_0x5722da[_0x59ad('0xc0')]['id'],_0x405744);var _0x2bcd12=path['join'](_0x9e2ed6,_0x1ce472);var _0x4d38c1=[];_0x4d38c1[_0x59ad('0x48')]({'model':db[_0x59ad('0x7a')],'as':'User','attributes':['id',_0x59ad('0x43')],'raw':!![]});_0x4d38c1[_0x59ad('0x48')]({'model':db[_0x59ad('0xd7')],'as':_0x59ad('0x70'),'attributes':['id','firstName',_0x59ad('0x11c')],'raw':!![]});if(_0x5722da[_0x59ad('0x4e')][_0x59ad('0x11d')]){_0x4d38c1[_0x59ad('0x48')]({'model':db[_0x59ad('0xe3')],'as':_0x59ad('0xe3'),'raw':!![]});}var _0x4869f4=[{'model':db[_0x59ad('0xd3')],'as':'Messages','attributes':['id',_0x59ad('0x3d'),_0x59ad('0x87'),_0x59ad('0xfb'),_0x59ad('0xfc'),'read'],'include':_0x4d38c1}];_0x4869f4['push']({'model':db[_0x59ad('0xc4')],'as':_0x59ad('0x11e'),'attributes':['id',_0x59ad('0x39')]});_0x4869f4[_0x59ad('0x48')]({'model':db[_0x59ad('0x7a')],'as':_0x59ad('0x11f'),'attributes':['id',_0x59ad('0x43')]});return db[_0x59ad('0xbe')][_0x59ad('0x7d')]({'where':{'id':_0x5722da[_0x59ad('0xc0')]['id']},'include':_0x4869f4})[_0x59ad('0x20')](handleEntityNotFound(_0x5835bd,null))[_0x59ad('0x20')](function(_0x23542a){if(_0x23542a){var _0x1e66a8=_0x23542a[_0x59ad('0x120')]({'plain':!![]});fs[_0x59ad('0x121')](_0x574131);var _0x532b73={'channel':'Chat','account':_0x1e66a8[_0x59ad('0x11e')][_0x59ad('0x39')],'agent':_0x1e66a8[_0x59ad('0x11f')]?_0x1e66a8[_0x59ad('0x11f')]['fullname']:_0x59ad('0x122'),'createdAt':moment(_0x1e66a8['createdAt'])[_0x59ad('0xee')](_0x59ad('0x10b'))['toString'](),'closedAt':_0x1e66a8[_0x59ad('0xda')]?moment(_0x1e66a8[_0x59ad('0x123')])[_0x59ad('0xee')]('YYYY-MM-DD\x20HH:mm:ss')[_0x59ad('0xa4')]():'','disposition':_0x1e66a8[_0x59ad('0xdb')],'chatInfo':{'browser':_0x1e66a8[_0x59ad('0x124')],'os':_0x1e66a8[_0x59ad('0x125')],'referer':_0x1e66a8['referer'],'customerIp':_0x1e66a8[_0x59ad('0x126')],'customerPort':_0x1e66a8[_0x59ad('0x127')]?_0x1e66a8['customerPort']:_0x59ad('0x122')},'messages':_(_0x1e66a8['Messages'])['tail']()[_0x59ad('0x91')]({'secret':![]})['map'](function(_0x1a57dd){if(_0x1a57dd[_0x59ad('0xe3')]){var _0x258765=path[_0x59ad('0xe6')](_0x387db2,_0x1a57dd[_0x59ad('0xe3')][_0x59ad('0xdf')]);if(fs[_0x59ad('0x128')](_0x258765)){fs[_0x59ad('0x129')](_0x258765)[_0x59ad('0x12a')](fs[_0x59ad('0x12b')](path[_0x59ad('0xe6')](_0x574131,_0x1a57dd[_0x59ad('0xe3')]['basename'])));}}return{'date':moment(_0x1a57dd[_0x59ad('0x87')])[_0x59ad('0xee')](_0x59ad('0x10b'))[_0x59ad('0xa4')](),'sender':_0x1a57dd[_0x59ad('0xfb')]==='out'?_0x1a57dd['User']?_0x1a57dd[_0x59ad('0x7a')][_0x59ad('0x43')]:'System':_0x1a57dd[_0x59ad('0x70')][_0x59ad('0x12c')]+(_0x1a57dd['Contact'][_0x59ad('0x11c')]?'\x20'+_0x1a57dd[_0x59ad('0x70')][_0x59ad('0x11c')]:''),'body':_0x1a57dd[_0x59ad('0xe3')]?_0x1a57dd[_0x59ad('0xe3')][_0x59ad('0xdf')]:_0x1a57dd[_0x59ad('0x3d')],'direction':_0x1a57dd[_0x59ad('0xfb')]===_0x59ad('0xd2')?'A':'C','secret':_0x1a57dd[_0x59ad('0xfc')],'read':_0x1a57dd[_0x59ad('0x8d')],'attachment':_0x1a57dd['Attachment']};})[_0x59ad('0x72')]()};return ejs[_0x59ad('0x12d')](path[_0x59ad('0xe6')](config['root'],'server',_0x59ad('0x12e'),_0x59ad('0x12f')),{'interaction':_0x532b73})[_0x59ad('0x20')](function(_0x636456){var _0x4367d2=path[_0x59ad('0xe6')](_0x574131,_0x59ad('0x130')+_0x1e66a8['id']+'-'+_0x405744+'.pdf');var _0x3807dd={'path':_0x4367d2,'channel':'Chat','interactionId':_0x1e66a8['id']};return pdf[_0x59ad('0x131')](_0x636456,_0x3807dd);})['then'](function(){return new BPromise(function(_0x2016da,_0x3c5b13){zipdir(_0x574131,{'saveTo':_0x2bcd12},function(_0x580524,_0x1dd057){if(_0x580524)return _0x3c5b13(_0x580524);return _0x2016da(_0x1dd057);});})[_0x59ad('0x20')](function(){return new BPromise(function(_0x4444b5,_0x5b83b5){rimraf(_0x574131,function(_0x3f40cd){if(_0x3f40cd)_0x5b83b5(_0x3f40cd);return _0x4444b5();});});})[_0x59ad('0x20')](function(){return _0x5835bd['download'](_0x2bcd12,_0x1ce472,function(_0x4fd43e){if(_0x4fd43e){console[_0x59ad('0x132')](_0x59ad('0x133'),_0x4fd43e);}else{fs[_0x59ad('0x134')](_0x2bcd12);}});});});}else{return _0x5835bd['sendStatus'](0xc8);}})['catch'](handleError(_0x5835bd,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8f64b22..e582a16 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 _0xf198=['ChatMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','length','emit','catch','hook','exports','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf198,0xd1));var _0x8f19=function(_0x506565,_0x1cb75b){_0x506565=_0x506565-0x0;var _0x372967=_0xf198[_0x506565];return _0x372967;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x8f19('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x8f19('0x0'))['db'][_0x8f19('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8f19('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8f19('0x3'),'afterDestroy':_0x8f19('0x4')};function emitEvent(_0x3a7997){return function(_0x3d85ab,_0x38eb84,_0x2892e9){_0x3d85ab['getUsers']({'attributes':['id'],'raw':!![]})[_0x8f19('0x5')](function(_0x202eb1){_0x3d85ab[_0x8f19('0x6')](_0x8f19('0x7'),_0x202eb1[_0x8f19('0x8')](function(_0x1b5be2){return{'id':_0x1b5be2['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3d85ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8f19('0x5')](function(_0x26171d){_0x3d85ab[_0x8f19('0x6')]('unreadMessages',_0x26171d[_0x8f19('0x9')]);ChatInteractionEvents[_0x8f19('0xa')](_0x3a7997+':'+_0x3d85ab['id'],_0x3d85ab);ChatInteractionEvents[_0x8f19('0xa')](_0x3a7997,_0x3d85ab);_0x2892e9(null);})[_0x8f19('0xb')](_0x2892e9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x8f19('0xc')](e,emitEvent(event));}}module[_0x8f19('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0x9dbf=['map','findAll','length','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','save','remove','getUsers','then','setDataValue','Users'];(function(_0xdd8e36,_0x49d8ce){var _0x8fbbbd=function(_0x2c82e7){while(--_0x2c82e7){_0xdd8e36['push'](_0xdd8e36['shift']());}};_0x8fbbbd(++_0x49d8ce);}(_0x9dbf,0x1ab));var _0xf9db=function(_0x1b68f1,_0x5d58a6){_0x1b68f1=_0x1b68f1-0x0;var _0xad3c27=_0x9dbf[_0x1b68f1];return _0xad3c27;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xf9db('0x0'))['db'][_0xf9db('0x1')];var ChatMessage=require(_0xf9db('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf9db('0x2'),'afterUpdate':'update','afterDestroy':_0xf9db('0x3')};function emitEvent(_0x18a572){return function(_0x56f58c,_0x280518,_0x243935){_0x56f58c[_0xf9db('0x4')]({'attributes':['id'],'raw':!![]})[_0xf9db('0x5')](function(_0x6d3c3b){_0x56f58c[_0xf9db('0x6')](_0xf9db('0x7'),_0x6d3c3b[_0xf9db('0x8')](function(_0x31a2d5){return{'id':_0x31a2d5['id']};}));return ChatMessage[_0xf9db('0x9')]({'where':{'ChatInteractionId':_0x56f58c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x349139){_0x56f58c[_0xf9db('0x6')]('unreadMessages',_0x349139[_0xf9db('0xa')]);ChatInteractionEvents['emit'](_0x18a572+':'+_0x56f58c['id'],_0x56f58c);ChatInteractionEvents[_0xf9db('0xb')](_0x18a572,_0x56f58c);_0x243935(null);})['catch'](_0x243935(null));};}for(var e in events){if(events[_0xf9db('0xc')](e)){var event=events[e];ChatInteraction[_0xf9db('0xd')](e,emitEvent(event));}}module[_0xf9db('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b0a2ba7..8851241 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 _0xbe78=['../../config/logger','api','bluebird','request-promise','path','rimraf','define','ChatInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4e54a7,_0x3b444e){var _0x3ad0d2=function(_0x4b0dde){while(--_0x4b0dde){_0x4e54a7['push'](_0x4e54a7['shift']());}};_0x3ad0d2(++_0x3b444e);}(_0xbe78,0xee));var _0x8be7=function(_0x2a4a61,_0x3c3cae){_0x2a4a61=_0x2a4a61-0x0;var _0x308182=_0xbe78[_0x2a4a61];return _0x308182;};'use strict';var _=require(_0x8be7('0x0'));var util=require(_0x8be7('0x1'));var logger=require(_0x8be7('0x2'))(_0x8be7('0x3'));var moment=require('moment');var BPromise=require(_0x8be7('0x4'));var rp=require(_0x8be7('0x5'));var fs=require('fs');var path=require(_0x8be7('0x6'));var rimraf=require(_0x8be7('0x7'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x59f313,_0x2bdb8a){return _0x59f313[_0x8be7('0x8')](_0x8be7('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b4de0,_0x55123e,_0x2fca1a){if(_0x2b4de0[_0x8be7('0xa')](_0x8be7('0xb'))){_0x2b4de0['closedAt']=moment()[_0x8be7('0xc')](_0x8be7('0xd'));}_0x2fca1a(null,_0x2b4de0);}},'charset':_0x8be7('0xe'),'collate':_0x8be7('0xf')});}; \ No newline at end of file +var _0x5ea3=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1f96b9,_0x2b4cae){var _0x15f12d=function(_0xcd47ff){while(--_0xcd47ff){_0x1f96b9['push'](_0x1f96b9['shift']());}};_0x15f12d(++_0x2b4cae);}(_0x5ea3,0x88));var _0x35ea=function(_0x263ecd,_0x4caef2){_0x263ecd=_0x263ecd-0x0;var _0x44d823=_0x5ea3[_0x263ecd];return _0x44d823;};'use strict';var _=require('lodash');var util=require(_0x35ea('0x0'));var logger=require(_0x35ea('0x1'))(_0x35ea('0x2'));var moment=require(_0x35ea('0x3'));var BPromise=require(_0x35ea('0x4'));var rp=require(_0x35ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35ea('0x6'));var config=require(_0x35ea('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x35ea('0x8')]=function(_0x49dca9,_0x5789d9){return _0x49dca9[_0x35ea('0x9')](_0x35ea('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x370e60,_0x4c35be,_0x28de0d){if(_0x370e60['changed'](_0x35ea('0xb'))){_0x370e60[_0x35ea('0xc')]=moment()[_0x35ea('0xd')](_0x35ea('0xe'));}_0x28de0d(null,_0x370e60);}},'charset':_0x35ea('0xf'),'collate':_0x35ea('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index f359f90..ff9b265 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 _0x9bd0=['find','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction'];(function(_0x5c711f,_0x222826){var _0x1300be=function(_0x4daa3c){while(--_0x4daa3c){_0x5c711f['push'](_0x5c711f['shift']());}};_0x1300be(++_0x222826);}(_0x9bd0,0x165));var _0x09bd=function(_0x24de1f,_0x437c83){_0x24de1f=_0x24de1f-0x0;var _0x15a3f=_0x9bd0[_0x24de1f];return _0x15a3f;};'use strict';var _=require('lodash');var util=require(_0x09bd('0x0'));var moment=require(_0x09bd('0x1'));var BPromise=require(_0x09bd('0x2'));var rs=require(_0x09bd('0x3'));var fs=require('fs');var Redis=require(_0x09bd('0x4'));var db=require(_0x09bd('0x5'))['db'];var utils=require(_0x09bd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x09bd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x09bd('0x8')][_0x09bd('0x9')]({'port':0x232a});config[_0x09bd('0xa')]=_[_0x09bd('0xb')](config['redis'],{'host':_0x09bd('0xc'),'port':0x18eb});var socket=require(_0x09bd('0xd'))(new Redis(config['redis']));require(_0x09bd('0xe'))[_0x09bd('0xf')](socket);function respondWithRpcPromise(_0x1b13c1,_0x72391a,_0x212a8b){return new BPromise(function(_0x26dc4f,_0x17b476){return client[_0x09bd('0x10')](_0x1b13c1,_0x212a8b)[_0x09bd('0x11')](function(_0x3c9409){logger[_0x09bd('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x72391a,_0x09bd('0x13'));logger[_0x09bd('0x14')](_0x09bd('0x15'),_0x72391a,'request\x20sent',JSON[_0x09bd('0x16')](_0x3c9409));if(_0x3c9409[_0x09bd('0x17')]){if(_0x3c9409['error'][_0x09bd('0x18')]===0x1f4){logger[_0x09bd('0x17')](_0x09bd('0x19'),_0x72391a,_0x3c9409[_0x09bd('0x17')][_0x09bd('0x1a')]);return _0x17b476(_0x3c9409[_0x09bd('0x17')][_0x09bd('0x1a')]);}logger['error'](_0x09bd('0x19'),_0x72391a,_0x3c9409['error'][_0x09bd('0x1a')]);return _0x26dc4f(_0x3c9409[_0x09bd('0x17')][_0x09bd('0x1a')]);}else{logger[_0x09bd('0x12')](_0x09bd('0x19'),_0x72391a,_0x09bd('0x13'));_0x26dc4f(_0x3c9409[_0x09bd('0x1b')][_0x09bd('0x1a')]);}})[_0x09bd('0x1c')](function(_0x3df100){logger[_0x09bd('0x17')](_0x09bd('0x19'),_0x72391a,_0x3df100);_0x17b476(_0x3df100);});});}exports[_0x09bd('0x1d')]=function(_0x44704c){var _0x5d0867=this;return new Promise(function(_0x52a2b9,_0x3e5504){return db[_0x09bd('0x1e')][_0x09bd('0x1f')](_0x44704c[_0x09bd('0x20')],{'raw':_0x44704c['options']?_0x44704c[_0x09bd('0x21')][_0x09bd('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44704c['options']?_0x44704c[_0x09bd('0x21')][_0x09bd('0x23')]||null:null,'attributes':_0x44704c[_0x09bd('0x21')]?_0x44704c['options'][_0x09bd('0x24')]||null:null,'limit':_0x44704c[_0x09bd('0x21')]?_0x44704c['options'][_0x09bd('0x25')]||null:null})[_0x09bd('0x11')](function(_0x49a21b){logger[_0x09bd('0x12')](_0x09bd('0x1d'),_0x44704c);logger['debug']('UpdateChatInteraction',_0x44704c,JSON[_0x09bd('0x16')](_0x49a21b));_0x52a2b9(_0x49a21b);})[_0x09bd('0x1c')](function(_0x45ed9c){logger[_0x09bd('0x17')](_0x09bd('0x1d'),_0x45ed9c[_0x09bd('0x1a')],_0x44704c);_0x3e5504(_0x5d0867[_0x09bd('0x17')](0x1f4,_0x45ed9c[_0x09bd('0x1a')]));});});};exports[_0x09bd('0x26')]=function(_0x40b54c){return new Promise(function(_0x5df107,_0x23e454){return db[_0x09bd('0x1e')][_0x09bd('0x27')]({'where':_0x40b54c[_0x09bd('0x21')]?_0x40b54c[_0x09bd('0x21')]['where']||null:null})[_0x09bd('0x11')](function(_0x306ffe){if(_0x306ffe){return _0x306ffe['addTags'](_0x40b54c[_0x09bd('0x20')][_0x09bd('0x28')],_[_0x09bd('0x29')](_0x40b54c[_0x09bd('0x20')],[_0x09bd('0x28'),'id'])||{});}})[_0x09bd('0x2a')](function(_0x550505){logger[_0x09bd('0x12')](_0x09bd('0x2b'),_0x40b54c);logger[_0x09bd('0x14')](_0x09bd('0x2b'),_0x40b54c,JSON[_0x09bd('0x16')](_0x550505));_0x5df107(_0x550505);})[_0x09bd('0x1c')](function(_0x1ab2c5){logger[_0x09bd('0x17')](_0x09bd('0x2b'),_0x1ab2c5['message'],_0x40b54c);_0x23e454(_this[_0x09bd('0x17')](0x1f4,_0x1ab2c5[_0x09bd('0x1a')]));});});}; \ No newline at end of file +var _0x44c5=['jayson/promise','client','http','defaults','redis','localhost','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','UpdateChatInteraction','ChatInteraction','update','body','raw','options','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x4ef40e,_0x55ff27){var _0x49a80e=function(_0x37d14){while(--_0x37d14){_0x4ef40e['push'](_0x4ef40e['shift']());}};_0x49a80e(++_0x55ff27);}(_0x44c5,0x1e4));var _0x544c=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x44c5[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x544c('0x0'));var util=require(_0x544c('0x1'));var moment=require(_0x544c('0x2'));var BPromise=require(_0x544c('0x3'));var rs=require(_0x544c('0x4'));var fs=require('fs');var Redis=require(_0x544c('0x5'));var db=require(_0x544c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x544c('0x7'));var config=require('../../config/environment');var jayson=require(_0x544c('0x8'));var client=jayson[_0x544c('0x9')][_0x544c('0xa')]({'port':0x232a});config['redis']=_[_0x544c('0xb')](config[_0x544c('0xc')],{'host':_0x544c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x544c('0xe'))[_0x544c('0xf')](socket);function respondWithRpcPromise(_0x3702c5,_0x320dd4,_0x5e4a72){return new BPromise(function(_0x10e2aa,_0x3596f8){return client[_0x544c('0x10')](_0x3702c5,_0x5e4a72)[_0x544c('0x11')](function(_0x3bca12){logger['info'](_0x544c('0x12'),_0x320dd4,_0x544c('0x13'));logger[_0x544c('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x320dd4,'request\x20sent',JSON[_0x544c('0x15')](_0x3bca12));if(_0x3bca12['error']){if(_0x3bca12[_0x544c('0x16')]['code']===0x1f4){logger[_0x544c('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x320dd4,_0x3bca12[_0x544c('0x16')][_0x544c('0x17')]);return _0x3596f8(_0x3bca12[_0x544c('0x16')]['message']);}logger[_0x544c('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x320dd4,_0x3bca12[_0x544c('0x16')][_0x544c('0x17')]);return _0x10e2aa(_0x3bca12['error'][_0x544c('0x17')]);}else{logger[_0x544c('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x320dd4,_0x544c('0x13'));_0x10e2aa(_0x3bca12['result'][_0x544c('0x17')]);}})[_0x544c('0x19')](function(_0x3efecd){logger['error'](_0x544c('0x12'),_0x320dd4,_0x3efecd);_0x3596f8(_0x3efecd);});});}exports[_0x544c('0x1a')]=function(_0x26eb18){var _0x15db2f=this;return new Promise(function(_0x17573d,_0x43254b){return db[_0x544c('0x1b')][_0x544c('0x1c')](_0x26eb18[_0x544c('0x1d')],{'raw':_0x26eb18['options']?_0x26eb18['options'][_0x544c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26eb18[_0x544c('0x1f')]?_0x26eb18['options'][_0x544c('0x20')]||null:null,'attributes':_0x26eb18[_0x544c('0x1f')]?_0x26eb18[_0x544c('0x1f')][_0x544c('0x21')]||null:null,'limit':_0x26eb18['options']?_0x26eb18[_0x544c('0x1f')][_0x544c('0x22')]||null:null})[_0x544c('0x11')](function(_0x293eb2){logger['info'](_0x544c('0x1a'),_0x26eb18);logger[_0x544c('0x14')](_0x544c('0x1a'),_0x26eb18,JSON['stringify'](_0x293eb2));_0x17573d(_0x293eb2);})[_0x544c('0x19')](function(_0x2aa56c){logger[_0x544c('0x16')](_0x544c('0x1a'),_0x2aa56c[_0x544c('0x17')],_0x26eb18);_0x43254b(_0x15db2f[_0x544c('0x16')](0x1f4,_0x2aa56c[_0x544c('0x17')]));});});};exports[_0x544c('0x23')]=function(_0x424bf8){return new Promise(function(_0x275b1c,_0x49c44a){return db[_0x544c('0x1b')][_0x544c('0x24')]({'where':_0x424bf8[_0x544c('0x1f')]?_0x424bf8[_0x544c('0x1f')][_0x544c('0x20')]||null:null})[_0x544c('0x11')](function(_0x301f53){if(_0x301f53){return _0x301f53[_0x544c('0x25')](_0x424bf8[_0x544c('0x1d')][_0x544c('0x26')],_['omit'](_0x424bf8[_0x544c('0x1d')],[_0x544c('0x26'),'id'])||{});}})[_0x544c('0x27')](function(_0x9714fc){logger[_0x544c('0x18')](_0x544c('0x28'),_0x424bf8);logger[_0x544c('0x14')]('AddTags',_0x424bf8,JSON[_0x544c('0x15')](_0x9714fc));_0x275b1c(_0x9714fc);})[_0x544c('0x19')](function(_0x441494){logger[_0x544c('0x16')](_0x544c('0x28'),_0x441494['message'],_0x424bf8);_0x49c44a(_this[_0x544c('0x16')](0x1f4,_0x441494[_0x544c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0085efb..0013fa8 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 _0xa4e3=['./chatInteraction.events','save','remove','update','emit','removeListener','length','chatInteraction:'];(function(_0x42bf0b,_0x465c08){var _0x3e333f=function(_0xcc97b8){while(--_0xcc97b8){_0x42bf0b['push'](_0x42bf0b['shift']());}};_0x3e333f(++_0x465c08);}(_0xa4e3,0x1b0));var _0x3a4e=function(_0x10f344,_0x814dcd){_0x10f344=_0x10f344-0x0;var _0xcdf71f=_0xa4e3[_0x10f344];return _0xcdf71f;};'use strict';var ChatInteractionEvents=require(_0x3a4e('0x0'));var events=[_0x3a4e('0x1'),_0x3a4e('0x2'),_0x3a4e('0x3')];function createListener(_0x31d08e,_0x1a3e8f){return function(_0x1848a1){_0x1a3e8f[_0x3a4e('0x4')](_0x31d08e,_0x1848a1);};}function removeListener(_0x345993,_0x331847){return function(){ChatInteractionEvents[_0x3a4e('0x5')](_0x345993,_0x331847);};}exports['register']=function(_0x50559d){for(var _0x5a993c=0x0,_0x23d353=events[_0x3a4e('0x6')];_0x5a993c<_0x23d353;_0x5a993c++){var _0x14ae53=events[_0x5a993c];var _0x3b5196=createListener(_0x3a4e('0x7')+_0x14ae53,_0x50559d);ChatInteractionEvents['on'](_0x14ae53,_0x3b5196);}}; \ No newline at end of file +var _0xdd8e=['removeListener','register','length','chatInteraction:','./chatInteraction.events','remove','update','emit'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0xdd8e,0x1f4));var _0xedd8=function(_0x3c8e36,_0x422420){_0x3c8e36=_0x3c8e36-0x0;var _0x31d8a5=_0xdd8e[_0x3c8e36];return _0x31d8a5;};'use strict';var ChatInteractionEvents=require(_0xedd8('0x0'));var events=['save',_0xedd8('0x1'),_0xedd8('0x2')];function createListener(_0x3414ea,_0x44e2c5){return function(_0x376cd9){_0x44e2c5[_0xedd8('0x3')](_0x3414ea,_0x376cd9);};}function removeListener(_0x367f69,_0x2213cd){return function(){ChatInteractionEvents[_0xedd8('0x4')](_0x367f69,_0x2213cd);};}exports[_0xedd8('0x5')]=function(_0x31da81){for(var _0x3d28bc=0x0,_0x11e499=events[_0xedd8('0x6')];_0x3d28bc<_0x11e499;_0x3d28bc++){var _0x5a9fdb=events[_0x3d28bc];var _0x1295c0=createListener(_0xedd8('0x7')+_0x5a9fdb,_0x31da81);ChatInteractionEvents['on'](_0x5a9fdb,_0x1295c0);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 034fd0a..5cbdf50 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 _0xe836=['single','file','attachmentUpload','/:id/messages','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload'];(function(_0x3dc9c3,_0x460eef){var _0x5b669e=function(_0x129e97){while(--_0x129e97){_0x3dc9c3['push'](_0x3dc9c3['shift']());}};_0x5b669e(++_0x460eef);}(_0xe836,0x10b));var _0x6e83=function(_0x37e967,_0xb3c159){_0x37e967=_0x37e967-0x0;var _0x259861=_0xe836[_0x37e967];return _0x259861;};'use strict';var multer=require(_0x6e83('0x0'));var util=require(_0x6e83('0x1'));var path=require(_0x6e83('0x2'));var timeout=require(_0x6e83('0x3'));var express=require(_0x6e83('0x4'));var router=express[_0x6e83('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6e83('0x6'));var config=require(_0x6e83('0x7'));var controller=require('./chatInteraction.controller');router[_0x6e83('0x8')]('/',auth[_0x6e83('0x9')](),controller[_0x6e83('0xa')]);router[_0x6e83('0x8')](_0x6e83('0xb'),auth[_0x6e83('0x9')](),controller[_0x6e83('0xc')]);router['get'](_0x6e83('0xd'),auth[_0x6e83('0xe')](),controller[_0x6e83('0xf')]);router['get']('/:id/attachment_download',auth[_0x6e83('0xe')](),controller[_0x6e83('0x10')]);router[_0x6e83('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6e83('0x11')]);router[_0x6e83('0x8')](_0x6e83('0x12'),auth[_0x6e83('0xe')](),controller[_0x6e83('0x13')]);router[_0x6e83('0x8')](_0x6e83('0x14'),auth[_0x6e83('0x9')](),controller[_0x6e83('0x15')]);router['post']('/',auth[_0x6e83('0x9')](),controller[_0x6e83('0x16')]);router[_0x6e83('0x17')](_0x6e83('0x18'),auth[_0x6e83('0x9')](),controller[_0x6e83('0x19')]);var upload=multer({'storage':multer[_0x6e83('0x1a')]({'destination':function(_0xbbef31,_0x1c85ae,_0x406f04){_0x406f04(null,path['join'](config['root'],_0x6e83('0x1b')));},'filename':function(_0x3d7ab5,_0x35e8b6,_0x333ece){_0x333ece(null,util[_0x6e83('0x1c')](_0x6e83('0x1d'),Date['now'](),_0x35e8b6[_0x6e83('0x1e')][_0x6e83('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6e83('0x17')](_0x6e83('0x20'),upload[_0x6e83('0x21')](_0x6e83('0x22')),controller[_0x6e83('0x23')]);router[_0x6e83('0x17')](_0x6e83('0x24'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x6e83('0x17')](_0x6e83('0x25'),auth[_0x6e83('0x9')](),interaction[_0x6e83('0x26')](_0x6e83('0x27'),_0x6e83('0x28')),controller[_0x6e83('0x29')]);router[_0x6e83('0x2a')]('/:id',auth[_0x6e83('0x9')](),interaction[_0x6e83('0x26')]('chat',_0x6e83('0x2b')),controller['update']);router[_0x6e83('0x2a')]('/:id/custom_update',controller[_0x6e83('0x2c')]);router[_0x6e83('0x2a')]('/:id/abandon',auth[_0x6e83('0xe')](),controller[_0x6e83('0x2d')]);router[_0x6e83('0x2a')](_0x6e83('0x2e'),controller[_0x6e83('0x2f')]);router[_0x6e83('0x30')](_0x6e83('0xd'),auth[_0x6e83('0x9')](),interaction[_0x6e83('0x26')](_0x6e83('0x27'),_0x6e83('0x31')),controller['destroy']);router[_0x6e83('0x30')](_0x6e83('0x25'),auth[_0x6e83('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xd936=['download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','abandon','close','delete','chatinteraction:destroy','removeTags','multer','util','connect-timeout','express','fs-extra','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download'];(function(_0x4855ce,_0x3fbf65){var _0x150377=function(_0x21555b){while(--_0x21555b){_0x4855ce['push'](_0x4855ce['shift']());}};_0x150377(++_0x3fbf65);}(_0xd936,0x7d));var _0x6d93=function(_0x5d6baf,_0xc44ec4){_0x5d6baf=_0x5d6baf-0x0;var _0x8d76ae=_0xd936[_0x5d6baf];return _0x8d76ae;};'use strict';var multer=require(_0x6d93('0x0'));var util=require(_0x6d93('0x1'));var path=require('path');var timeout=require(_0x6d93('0x2'));var express=require(_0x6d93('0x3'));var router=express['Router']();var fs_extra=require(_0x6d93('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d93('0x5'));router[_0x6d93('0x6')]('/',auth[_0x6d93('0x7')](),controller['index']);router[_0x6d93('0x6')](_0x6d93('0x8'),auth[_0x6d93('0x7')](),controller[_0x6d93('0x9')]);router[_0x6d93('0x6')](_0x6d93('0xa'),auth[_0x6d93('0xb')](),controller[_0x6d93('0xc')]);router[_0x6d93('0x6')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x6d93('0xd')]);router['get'](_0x6d93('0xe'),auth['isAuthenticated'](),controller[_0x6d93('0xf')]);router[_0x6d93('0x6')](_0x6d93('0x10'),auth[_0x6d93('0xb')](),controller[_0x6d93('0x11')]);router[_0x6d93('0x6')](_0x6d93('0x12'),auth[_0x6d93('0x7')](),controller[_0x6d93('0x13')]);router['post']('/',auth[_0x6d93('0x7')](),controller[_0x6d93('0x14')]);router[_0x6d93('0x15')](_0x6d93('0x16'),auth[_0x6d93('0x7')](),controller[_0x6d93('0x17')]);var upload=multer({'storage':multer[_0x6d93('0x18')]({'destination':function(_0x176f9c,_0x4581c5,_0x1dbe6e){_0x1dbe6e(null,path[_0x6d93('0x19')](config[_0x6d93('0x1a')],_0x6d93('0x1b')));},'filename':function(_0x38c0aa,_0x2338bc,_0x2dac7e){_0x2dac7e(null,util[_0x6d93('0x1c')]('%s-%s',Date['now'](),_0x2338bc[_0x6d93('0x1d')][_0x6d93('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6d93('0x15')](_0x6d93('0x1f'),upload[_0x6d93('0x20')](_0x6d93('0x21')),controller[_0x6d93('0x22')]);router['post']('/:id/messages',auth[_0x6d93('0xb')](),controller[_0x6d93('0x23')]);router['post'](_0x6d93('0x24'),auth[_0x6d93('0x7')](),interaction[_0x6d93('0x25')](_0x6d93('0x26'),_0x6d93('0x27')),controller['addTags']);router[_0x6d93('0x28')](_0x6d93('0xa'),auth['isAuthenticated'](),interaction[_0x6d93('0x25')](_0x6d93('0x26'),_0x6d93('0x29')),controller['update']);router[_0x6d93('0x28')](_0x6d93('0x2a'),controller['customUpdate']);router[_0x6d93('0x28')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x6d93('0x2b')]);router['put']('/:id/close',controller[_0x6d93('0x2c')]);router[_0x6d93('0x2d')](_0x6d93('0xa'),auth[_0x6d93('0x7')](),interaction[_0x6d93('0x25')](_0x6d93('0x26'),_0x6d93('0x2e')),controller['destroy']);router[_0x6d93('0x2d')](_0x6d93('0x24'),auth[_0x6d93('0x7')](),controller[_0x6d93('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 17c4c43..8f5de0e 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 _0x14a0=['BOOLEAN','INTEGER','exports','TEXT','medium'];(function(_0x4824f7,_0x56c0bb){var _0x2f56b7=function(_0x5452e7){while(--_0x5452e7){_0x4824f7['push'](_0x4824f7['shift']());}};_0x2f56b7(++_0x56c0bb);}(_0x14a0,0x8e));var _0x014a=function(_0x9f4785,_0x43fd4c){_0x9f4785=_0x9f4785-0x0;var _0x279349=_0x14a0[_0x9f4785];return _0x279349;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'body':{'type':Sequelize[_0x014a('0x1')](_0x014a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x014a('0x4')]}}; \ No newline at end of file +var _0x14a0=['BOOLEAN','INTEGER','exports','TEXT','medium'];(function(_0xe3b6a3,_0x43d8fd){var _0xe1adf9=function(_0x4a4f40){while(--_0x4a4f40){_0xe3b6a3['push'](_0xe3b6a3['shift']());}};_0xe1adf9(++_0x43d8fd);}(_0x14a0,0x8e));var _0x014a=function(_0x20b82f,_0x1e15bb){_0x20b82f=_0x20b82f-0x0;var _0x8813c1=_0x14a0[_0x20b82f];return _0x8813c1;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'body':{'type':Sequelize[_0x014a('0x1')](_0x014a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x014a('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1313927..b3caf77 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 _0xa6ed=['query','keys','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','user','role','userpic','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model'];(function(_0x4eac2f,_0x19eda1){var _0x739a1c=function(_0x240d08){while(--_0x240d08){_0x4eac2f['push'](_0x4eac2f['shift']());}};_0x739a1c(++_0x19eda1);}(_0xa6ed,0x111));var _0xda6e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa6ed[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0xda6e('0x0'));var rimraf=require(_0xda6e('0x1'));var zipdir=require(_0xda6e('0x2'));var jsonpatch=require(_0xda6e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xda6e('0x4'));var Mustache=require(_0xda6e('0x5'));var util=require(_0xda6e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xda6e('0x7'));var ejs=require(_0xda6e('0x8'));var fs=require('fs');var fs_extra=require(_0xda6e('0x9'));var _=require('lodash');var squel=require(_0xda6e('0xa'));var crypto=require(_0xda6e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xda6e('0xc'));var toCsv=require(_0xda6e('0x7'));var querystring=require(_0xda6e('0xd'));var Papa=require(_0xda6e('0xe'));var Redis=require(_0xda6e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xda6e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda6e('0x11'));var logger=require(_0xda6e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xda6e('0x13'));var licenseUtil=require(_0xda6e('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xda6e('0x15')](config[_0xda6e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xda6e('0x17'))(new Redis(config[_0xda6e('0x16')]));require(_0xda6e('0x18'))[_0xda6e('0x19')](socket);function respondWithStatusCode(_0x203b02,_0x2a3c6e){_0x2a3c6e=_0x2a3c6e||0xcc;return function(_0x55f160){if(_0x55f160){return _0x203b02['sendStatus'](_0x2a3c6e);}return _0x203b02[_0xda6e('0x1a')](_0x2a3c6e)[_0xda6e('0x1b')]();};}function respondWithResult(_0x11ff98,_0x197543){_0x197543=_0x197543||0xc8;return function(_0x152564){if(_0x152564){return _0x11ff98[_0xda6e('0x1a')](_0x197543)[_0xda6e('0x1c')](_0x152564);}};}function respondWithFilteredResult(_0x2d6486,_0x4c9603){return function(_0x2c031e){if(_0x2c031e){var _0x2f18d5=typeof _0x4c9603[_0xda6e('0x1d')]===_0xda6e('0x1e')&&typeof _0x4c9603['limit']===_0xda6e('0x1e');var _0x2d4baf=_0x2c031e[_0xda6e('0x1f')];var _0x4e0c2e=_0x2f18d5?0x0:_0x4c9603[_0xda6e('0x1d')];var _0x13c6f4=_0x2f18d5?_0x2c031e['count']:_0x4c9603[_0xda6e('0x1d')]+_0x4c9603['limit'];var _0x4b5cd5;if(_0x13c6f4>=_0x2d4baf){_0x13c6f4=_0x2d4baf;_0x4b5cd5=0xc8;}else{_0x4b5cd5=0xce;}_0x2d6486[_0xda6e('0x1a')](_0x4b5cd5);return _0x2d6486[_0xda6e('0x20')](_0xda6e('0x21'),_0x4e0c2e+'-'+_0x13c6f4+'/'+_0x2d4baf)[_0xda6e('0x1c')](_0x2c031e);}return null;};}function patchUpdates(_0x5917b9){return function(_0xaccf9){try{jsonpatch[_0xda6e('0x22')](_0xaccf9,_0x5917b9,!![]);}catch(_0x43ceaa){return BPromise[_0xda6e('0x23')](_0x43ceaa);}return _0xaccf9['save']();};}function saveUpdates(_0x43cf4e,_0xcc213e){return function(_0x18d26e){if(_0x18d26e){return _0x18d26e[_0xda6e('0x24')](_0x43cf4e)[_0xda6e('0x25')](function(_0x4d9a81){return _0x4d9a81;});}return null;};}function removeEntity(_0x3de347,_0x495983){return function(_0x5b738a){if(_0x5b738a){return _0x5b738a[_0xda6e('0x26')]()[_0xda6e('0x25')](function(){_0x3de347[_0xda6e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c2f8,_0x27eb2a){return function(_0x2b83a3){if(!_0x2b83a3){_0x51c2f8[_0xda6e('0x27')](0x194);}return _0x2b83a3;};}function handleError(_0x5d1085,_0x2d3804){_0x2d3804=_0x2d3804||0x1f4;return function(_0x5d8c0c){logger[_0xda6e('0x28')](_0x5d8c0c[_0xda6e('0x29')]);if(_0x5d8c0c[_0xda6e('0x2a')]){delete _0x5d8c0c['name'];}_0x5d1085['status'](_0x2d3804)['send'](_0x5d8c0c);};}exports[_0xda6e('0x2b')]=function(_0x562e6f,_0x557470){var _0x96461d={},_0x56e00e={},_0x138ee9={'count':0x0,'rows':[]};var _0x5bfbd2=_[_0xda6e('0x2c')](db[_0xda6e('0x2d')][_0xda6e('0x2e')],function(_0x5a36a0){return{'name':_0x5a36a0[_0xda6e('0x2f')],'type':_0x5a36a0[_0xda6e('0x30')][_0xda6e('0x31')]};});_0x56e00e[_0xda6e('0x32')]=_[_0xda6e('0x2c')](_0x5bfbd2,_0xda6e('0x2a'));_0x56e00e[_0xda6e('0x33')]=_[_0xda6e('0x34')](_0x562e6f['query']);_0x56e00e[_0xda6e('0x35')]=_['intersection'](_0x56e00e[_0xda6e('0x32')],_0x56e00e['query']);_0x96461d[_0xda6e('0x36')]=_[_0xda6e('0x37')](_0x56e00e[_0xda6e('0x32')],qs[_0xda6e('0x38')](_0x562e6f['query'][_0xda6e('0x38')]));_0x96461d[_0xda6e('0x36')]=_0x96461d[_0xda6e('0x36')][_0xda6e('0x39')]?_0x96461d[_0xda6e('0x36')]:_0x56e00e['model'];if(!_0x562e6f['query']['hasOwnProperty'](_0xda6e('0x3a'))){_0x96461d[_0xda6e('0x3b')]=qs[_0xda6e('0x3b')](_0x562e6f[_0xda6e('0x33')][_0xda6e('0x3b')]);_0x96461d[_0xda6e('0x1d')]=qs[_0xda6e('0x1d')](_0x562e6f[_0xda6e('0x33')][_0xda6e('0x1d')]);}_0x96461d['order']=qs[_0xda6e('0x3c')](_0x562e6f[_0xda6e('0x33')][_0xda6e('0x3c')]);_0x96461d[_0xda6e('0x3d')]=qs[_0xda6e('0x35')](_[_0xda6e('0x3e')](_0x562e6f['query'],_0x56e00e[_0xda6e('0x35')]),_0x5bfbd2);if(_0x562e6f['query'][_0xda6e('0x3f')]){_0x96461d['where']=_[_0xda6e('0x40')](_0x96461d[_0xda6e('0x3d')],{'$or':_[_0xda6e('0x2c')](_0x5bfbd2,function(_0x8b34be){if(_0x8b34be[_0xda6e('0x30')]!==_0xda6e('0x41')){var _0x111c1f={};_0x111c1f[_0x8b34be[_0xda6e('0x2a')]]={'$like':'%'+_0x562e6f[_0xda6e('0x33')][_0xda6e('0x3f')]+'%'};return _0x111c1f;}})});}_0x96461d=_['merge']({},_0x96461d,_0x562e6f[_0xda6e('0x42')]);var _0x218ca5={'where':_0x96461d[_0xda6e('0x3d')]};return db[_0xda6e('0x2d')][_0xda6e('0x1f')](_0x218ca5)[_0xda6e('0x25')](function(_0x22b9f5){_0x138ee9[_0xda6e('0x1f')]=_0x22b9f5;if(_0x562e6f[_0xda6e('0x33')][_0xda6e('0x43')]){_0x96461d[_0xda6e('0x44')]=[{'all':!![]}];}return db[_0xda6e('0x2d')]['findAll'](_0x96461d);})['then'](function(_0x126c9e){_0x138ee9[_0xda6e('0x45')]=_0x126c9e;return _0x138ee9;})[_0xda6e('0x25')](respondWithFilteredResult(_0x557470,_0x96461d))[_0xda6e('0x46')](handleError(_0x557470,null));};exports[_0xda6e('0x47')]=function(_0x20c35c,_0x26a4e7){var _0x20fb9d={'raw':!![],'where':{'id':_0x20c35c['params']['id']}},_0x22c093={};_0x22c093['model']=_[_0xda6e('0x34')](db[_0xda6e('0x2d')]['rawAttributes']);_0x22c093[_0xda6e('0x33')]=_[_0xda6e('0x34')](_0x20c35c[_0xda6e('0x33')]);_0x22c093[_0xda6e('0x35')]=_[_0xda6e('0x37')](_0x22c093[_0xda6e('0x32')],_0x22c093[_0xda6e('0x33')]);_0x20fb9d[_0xda6e('0x36')]=_[_0xda6e('0x37')](_0x22c093[_0xda6e('0x32')],qs['fields'](_0x20c35c[_0xda6e('0x33')][_0xda6e('0x38')]));_0x20fb9d[_0xda6e('0x36')]=_0x20fb9d[_0xda6e('0x36')]['length']?_0x20fb9d[_0xda6e('0x36')]:_0x22c093['model'];if(_0x20c35c[_0xda6e('0x33')][_0xda6e('0x43')]){_0x20fb9d[_0xda6e('0x44')]=[{'all':!![]}];}_0x20fb9d=_[_0xda6e('0x40')]({},_0x20fb9d,_0x20c35c[_0xda6e('0x42')]);return db['ChatInternalMessage'][_0xda6e('0x48')](_0x20fb9d)['then'](handleEntityNotFound(_0x26a4e7,null))['then'](respondWithResult(_0x26a4e7,null))['catch'](handleError(_0x26a4e7,null));};exports[_0xda6e('0x49')]=function(_0x1732cf,_0x5c342d){return db['ChatInternalMessage'][_0xda6e('0x49')](_0x1732cf[_0xda6e('0x4a')],{})[_0xda6e('0x25')](respondWithResult(_0x5c342d,0xc9))[_0xda6e('0x46')](handleError(_0x5c342d,null));};exports[_0xda6e('0x24')]=function(_0x3764ad,_0x282fa3){if(_0x3764ad[_0xda6e('0x4a')]['id']){delete _0x3764ad['body']['id'];}return db[_0xda6e('0x2d')][_0xda6e('0x48')]({'where':{'id':_0x3764ad[_0xda6e('0x4b')]['id']}})[_0xda6e('0x25')](handleEntityNotFound(_0x282fa3,null))['then'](saveUpdates(_0x3764ad[_0xda6e('0x4a')],null))['then'](respondWithResult(_0x282fa3,null))[_0xda6e('0x46')](handleError(_0x282fa3,null));};exports['destroy']=function(_0xce9d97,_0x3a01ba){return db[_0xda6e('0x2d')][_0xda6e('0x48')]({'where':{'id':_0xce9d97['params']['id']}})[_0xda6e('0x25')](handleEntityNotFound(_0x3a01ba,null))[_0xda6e('0x25')](removeEntity(_0x3a01ba,null))[_0xda6e('0x46')](handleError(_0x3a01ba,null));};exports[_0xda6e('0x4c')]=function(_0x3fa49e,_0x3b4d79){return db['ChatInternalMessage'][_0xda6e('0x4c')]()[_0xda6e('0x25')](respondWithResult(_0x3b4d79,null))[_0xda6e('0x46')](handleError(_0x3b4d79,null));};function wrapUser(_0x45c36c){return function(_0x5eb94e){var _0x49cb92=_0x45c36c[_0xda6e('0x4d')]({'plain':!![]});_0x49cb92[_0xda6e('0x4e')]=[];if(_0x5eb94e){_0x49cb92['lastMessageAt']=_0x5eb94e[_0xda6e('0x4f')];_0x49cb92[_0xda6e('0x50')]=_0x5eb94e;}else{_0x49cb92[_0xda6e('0x51')]=moment(0x0)[_0xda6e('0x52')](_0xda6e('0x53'));_0x49cb92[_0xda6e('0x50')]={};}return _0x49cb92;};}exports[_0xda6e('0x54')]=function(_0x3ade11,_0x46f0fc,_0x16c5f4){var _0x57ac34=[];return db[_0xda6e('0x55')][_0xda6e('0x56')]({'where':{'role':[_0xda6e('0x57'),_0xda6e('0x58'),_0xda6e('0x59')]},'attributes':['id','fullname','name',_0xda6e('0x5a'),_0xda6e('0x5b'),'internal','online','lastLoginAt',_0xda6e('0x5c'),_0xda6e('0x5d')],'order':qs[_0xda6e('0x3c')]('-online'),'include':[{'model':db[_0xda6e('0x5e')],'as':_0xda6e('0x5f'),'attributes':['id',_0xda6e('0x2a'),_0xda6e('0x30')],'through':{'attributes':[]}}]})[_0xda6e('0x25')](function(_0xe2dde9){if(_0xe2dde9){var _0x1711b7=_0x3ade11[_0xda6e('0x59')][_0xda6e('0x4d')]({'plain':!![]});if(!_0x1711b7)throw new Error(_0xda6e('0x60'));if(_0x1711b7['role']===_0xda6e('0x59')){return db[_0xda6e('0x61')][_0xda6e('0x48')]({'where':{'name':'Agents','userProfileId':_0x1711b7[_0xda6e('0x62')]},'raw':!![]})[_0xda6e('0x25')](function(_0x13ae06){if(_0x13ae06){if(_0x13ae06[_0xda6e('0x63')]===0x0){return db[_0xda6e('0x64')][_0xda6e('0x56')]({'where':{'sectionId':_0x13ae06['id']},'raw':!![]})[_0xda6e('0x25')](function(_0x460139){var _0xaee8b2=[];if(_['isEmpty'](_0x460139)){_0xaee8b2=_[_0xda6e('0x3f')](_0xe2dde9,function(_0xffd7dd){if(_0xffd7dd[_0xda6e('0x5a')]!=='agent'){return _0xffd7dd;}});return _0xaee8b2;}else{for(var _0x27195a=0x0;_0x27195a<_0xe2dde9[_0xda6e('0x39')];_0x27195a++){var _0x3cf7ff=_0xe2dde9[_0x27195a];if(_0x3cf7ff[_0xda6e('0x5a')]===_0xda6e('0x57')){var _0x4133cd=_[_0xda6e('0x48')](_0x460139,function(_0x3461f8){return _0x3461f8[_0xda6e('0x65')]===_0x3cf7ff['id'];});if(_0x4133cd)_0xaee8b2[_0xda6e('0x66')](_0x3cf7ff);}else{_0xaee8b2[_0xda6e('0x66')](_0x3cf7ff);}}return _0xaee8b2;}});}else{return _0xe2dde9;}}else{var _0x11df34=_[_0xda6e('0x3f')](_0xe2dde9,function(_0x185deb){if(_0x185deb[_0xda6e('0x5a')]!==_0xda6e('0x57')){return _0x185deb;}});return _0x11df34;}});}else{return _0xe2dde9;}}})[_0xda6e('0x25')](function(_0x30dfac){var _0x5d4440=[];if(_0x30dfac){_0x57ac34=_0x30dfac;for(var _0x252ef3=0x0;_0x252ef3<_0x30dfac['length'];_0x252ef3+=0x1){_0x57ac34[_0x252ef3][_0xda6e('0x4e')]=[];_0x5d4440[_0xda6e('0x66')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x3ade11[_0xda6e('0x59')]['id'],_0x30dfac[_0x252ef3]['id']],'ToId':[_0x3ade11['user']['id'],_0x30dfac[_0x252ef3]['id']],'ChatGroupId':null},'attributes':['id',_0xda6e('0x4f'),_0xda6e('0x67'),_0xda6e('0x68'),_0xda6e('0x69'),_0xda6e('0x4a')],'order':qs[_0xda6e('0x3c')](_0xda6e('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xda6e('0x25')](wrapUser(_0x30dfac[_0x252ef3])));}return BPromise[_0xda6e('0x6b')](_0x5d4440);}return[];})[_0xda6e('0x25')](function(_0x506685){return{'rows':_0x506685,'count':_0x506685[_0xda6e('0x39')]};})[_0xda6e('0x25')](respondWithResult(_0x46f0fc,null))[_0xda6e('0x46')](handleError(_0x46f0fc,null));}; \ No newline at end of file +var _0xd821=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','getUsers','User','agent','admin','user','fullname','lastLoginAt','allowmessenger','-online','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3d4ec7,_0x268b16){var _0x610cb8=function(_0x14ed84){while(--_0x14ed84){_0x3d4ec7['push'](_0x3d4ec7['shift']());}};_0x610cb8(++_0x268b16);}(_0xd821,0xcb));var _0x1d82=function(_0x3d8a7d,_0x73e707){_0x3d8a7d=_0x3d8a7d-0x0;var _0x538358=_0xd821[_0x3d8a7d];return _0x538358;};'use strict';var emlformat=require(_0x1d82('0x0'));var rimraf=require(_0x1d82('0x1'));var zipdir=require(_0x1d82('0x2'));var jsonpatch=require(_0x1d82('0x3'));var rp=require(_0x1d82('0x4'));var moment=require('moment');var BPromise=require(_0x1d82('0x5'));var Mustache=require(_0x1d82('0x6'));var util=require(_0x1d82('0x7'));var path=require(_0x1d82('0x8'));var sox=require(_0x1d82('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d82('0xa'));var squel=require(_0x1d82('0xb'));var crypto=require(_0x1d82('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1d82('0xd'));var toCsv=require(_0x1d82('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1d82('0xf'));var authService=require(_0x1d82('0x10'));var qs=require(_0x1d82('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d82('0x12'));var logger=require(_0x1d82('0x13'))('api');var utils=require(_0x1d82('0x14'));var config=require(_0x1d82('0x15'));var licenseUtil=require(_0x1d82('0x16'));var db=require(_0x1d82('0x17'))['db'];config[_0x1d82('0x18')]=_[_0x1d82('0x19')](config[_0x1d82('0x18')],{'host':_0x1d82('0x1a'),'port':0x18eb});var socket=require(_0x1d82('0x1b'))(new Redis(config['redis']));require(_0x1d82('0x1c'))[_0x1d82('0x1d')](socket);function respondWithStatusCode(_0x5d85ff,_0x17d0fc){_0x17d0fc=_0x17d0fc||0xcc;return function(_0xc43935){if(_0xc43935){return _0x5d85ff[_0x1d82('0x1e')](_0x17d0fc);}return _0x5d85ff[_0x1d82('0x1f')](_0x17d0fc)['end']();};}function respondWithResult(_0x4df473,_0x29bda5){_0x29bda5=_0x29bda5||0xc8;return function(_0xbcfd34){if(_0xbcfd34){return _0x4df473[_0x1d82('0x1f')](_0x29bda5)['json'](_0xbcfd34);}};}function respondWithFilteredResult(_0x54eacf,_0x7e0b05){return function(_0x531993){if(_0x531993){var _0x465d58=typeof _0x7e0b05[_0x1d82('0x20')]==='undefined'&&typeof _0x7e0b05[_0x1d82('0x21')]===_0x1d82('0x22');var _0x5f44ce=_0x531993[_0x1d82('0x23')];var _0x415a82=_0x465d58?0x0:_0x7e0b05[_0x1d82('0x20')];var _0x35be34=_0x465d58?_0x531993[_0x1d82('0x23')]:_0x7e0b05[_0x1d82('0x20')]+_0x7e0b05[_0x1d82('0x21')];var _0x8dc20c;if(_0x35be34>=_0x5f44ce){_0x35be34=_0x5f44ce;_0x8dc20c=0xc8;}else{_0x8dc20c=0xce;}_0x54eacf['status'](_0x8dc20c);return _0x54eacf[_0x1d82('0x24')](_0x1d82('0x25'),_0x415a82+'-'+_0x35be34+'/'+_0x5f44ce)[_0x1d82('0x26')](_0x531993);}return null;};}function patchUpdates(_0x1d1453){return function(_0x20ec49){try{jsonpatch['apply'](_0x20ec49,_0x1d1453,!![]);}catch(_0x360b02){return BPromise[_0x1d82('0x27')](_0x360b02);}return _0x20ec49[_0x1d82('0x28')]();};}function saveUpdates(_0x159db4,_0x5108a3){return function(_0x1a4952){if(_0x1a4952){return _0x1a4952[_0x1d82('0x29')](_0x159db4)['then'](function(_0x3c888a){return _0x3c888a;});}return null;};}function removeEntity(_0x11b3ac,_0x40f5a9){return function(_0x105fd3){if(_0x105fd3){return _0x105fd3[_0x1d82('0x2a')]()[_0x1d82('0x2b')](function(){_0x11b3ac[_0x1d82('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9a93,_0x553dd7){return function(_0x2f4c76){if(!_0x2f4c76){_0x4a9a93[_0x1d82('0x1e')](0x194);}return _0x2f4c76;};}function handleError(_0x44e2fb,_0x3aea2a){_0x3aea2a=_0x3aea2a||0x1f4;return function(_0x8a9c9d){logger[_0x1d82('0x2c')](_0x8a9c9d[_0x1d82('0x2d')]);if(_0x8a9c9d[_0x1d82('0x2e')]){delete _0x8a9c9d[_0x1d82('0x2e')];}_0x44e2fb[_0x1d82('0x1f')](_0x3aea2a)[_0x1d82('0x2f')](_0x8a9c9d);};}exports[_0x1d82('0x30')]=function(_0x1b9407,_0x18ce53){var _0x1c43ec={},_0x3058a1={},_0x3da57c={'count':0x0,'rows':[]};var _0x3179a3=_[_0x1d82('0x31')](db[_0x1d82('0x32')][_0x1d82('0x33')],function(_0x121dbc){return{'name':_0x121dbc[_0x1d82('0x34')],'type':_0x121dbc[_0x1d82('0x35')][_0x1d82('0x36')]};});_0x3058a1[_0x1d82('0x37')]=_[_0x1d82('0x31')](_0x3179a3,_0x1d82('0x2e'));_0x3058a1[_0x1d82('0x38')]=_[_0x1d82('0x39')](_0x1b9407[_0x1d82('0x38')]);_0x3058a1[_0x1d82('0x3a')]=_[_0x1d82('0x3b')](_0x3058a1[_0x1d82('0x37')],_0x3058a1[_0x1d82('0x38')]);_0x1c43ec[_0x1d82('0x3c')]=_[_0x1d82('0x3b')](_0x3058a1[_0x1d82('0x37')],qs[_0x1d82('0x3d')](_0x1b9407[_0x1d82('0x38')][_0x1d82('0x3d')]));_0x1c43ec[_0x1d82('0x3c')]=_0x1c43ec['attributes'][_0x1d82('0x3e')]?_0x1c43ec[_0x1d82('0x3c')]:_0x3058a1['model'];if(!_0x1b9407['query'][_0x1d82('0x3f')](_0x1d82('0x40'))){_0x1c43ec[_0x1d82('0x21')]=qs[_0x1d82('0x21')](_0x1b9407[_0x1d82('0x38')][_0x1d82('0x21')]);_0x1c43ec['offset']=qs[_0x1d82('0x20')](_0x1b9407[_0x1d82('0x38')][_0x1d82('0x20')]);}_0x1c43ec[_0x1d82('0x41')]=qs[_0x1d82('0x42')](_0x1b9407[_0x1d82('0x38')][_0x1d82('0x42')]);_0x1c43ec['where']=qs[_0x1d82('0x3a')](_[_0x1d82('0x43')](_0x1b9407['query'],_0x3058a1[_0x1d82('0x3a')]),_0x3179a3);if(_0x1b9407[_0x1d82('0x38')][_0x1d82('0x44')]){_0x1c43ec['where']=_[_0x1d82('0x45')](_0x1c43ec['where'],{'$or':_[_0x1d82('0x31')](_0x3179a3,function(_0x442e12){if(_0x442e12['type']!==_0x1d82('0x46')){var _0x1bea8d={};_0x1bea8d[_0x442e12[_0x1d82('0x2e')]]={'$like':'%'+_0x1b9407[_0x1d82('0x38')][_0x1d82('0x44')]+'%'};return _0x1bea8d;}})});}_0x1c43ec=_[_0x1d82('0x45')]({},_0x1c43ec,_0x1b9407[_0x1d82('0x47')]);var _0x4facdb={'where':_0x1c43ec['where']};return db[_0x1d82('0x32')][_0x1d82('0x23')](_0x4facdb)[_0x1d82('0x2b')](function(_0x3b563a){_0x3da57c[_0x1d82('0x23')]=_0x3b563a;if(_0x1b9407[_0x1d82('0x38')][_0x1d82('0x48')]){_0x1c43ec[_0x1d82('0x49')]=[{'all':!![]}];}return db[_0x1d82('0x32')][_0x1d82('0x4a')](_0x1c43ec);})[_0x1d82('0x2b')](function(_0x342ac2){_0x3da57c[_0x1d82('0x4b')]=_0x342ac2;return _0x3da57c;})[_0x1d82('0x2b')](respondWithFilteredResult(_0x18ce53,_0x1c43ec))[_0x1d82('0x4c')](handleError(_0x18ce53,null));};exports[_0x1d82('0x4d')]=function(_0x21925a,_0x2aa806){var _0x283db4={'raw':!![],'where':{'id':_0x21925a[_0x1d82('0x4e')]['id']}},_0x1a1190={};_0x1a1190[_0x1d82('0x37')]=_[_0x1d82('0x39')](db[_0x1d82('0x32')][_0x1d82('0x33')]);_0x1a1190[_0x1d82('0x38')]=_['keys'](_0x21925a[_0x1d82('0x38')]);_0x1a1190[_0x1d82('0x3a')]=_[_0x1d82('0x3b')](_0x1a1190[_0x1d82('0x37')],_0x1a1190['query']);_0x283db4[_0x1d82('0x3c')]=_[_0x1d82('0x3b')](_0x1a1190[_0x1d82('0x37')],qs[_0x1d82('0x3d')](_0x21925a[_0x1d82('0x38')][_0x1d82('0x3d')]));_0x283db4[_0x1d82('0x3c')]=_0x283db4['attributes'][_0x1d82('0x3e')]?_0x283db4[_0x1d82('0x3c')]:_0x1a1190[_0x1d82('0x37')];if(_0x21925a['query'][_0x1d82('0x48')]){_0x283db4[_0x1d82('0x49')]=[{'all':!![]}];}_0x283db4=_['merge']({},_0x283db4,_0x21925a[_0x1d82('0x47')]);return db['ChatInternalMessage'][_0x1d82('0x4f')](_0x283db4)[_0x1d82('0x2b')](handleEntityNotFound(_0x2aa806,null))[_0x1d82('0x2b')](respondWithResult(_0x2aa806,null))[_0x1d82('0x4c')](handleError(_0x2aa806,null));};exports[_0x1d82('0x50')]=function(_0x15e7e8,_0x9a29e1){return db[_0x1d82('0x32')][_0x1d82('0x50')](_0x15e7e8[_0x1d82('0x51')],{})[_0x1d82('0x2b')](respondWithResult(_0x9a29e1,0xc9))['catch'](handleError(_0x9a29e1,null));};exports[_0x1d82('0x29')]=function(_0x173119,_0x29ebfe){if(_0x173119[_0x1d82('0x51')]['id']){delete _0x173119[_0x1d82('0x51')]['id'];}return db['ChatInternalMessage'][_0x1d82('0x4f')]({'where':{'id':_0x173119[_0x1d82('0x4e')]['id']}})['then'](handleEntityNotFound(_0x29ebfe,null))[_0x1d82('0x2b')](saveUpdates(_0x173119['body'],null))['then'](respondWithResult(_0x29ebfe,null))[_0x1d82('0x4c')](handleError(_0x29ebfe,null));};exports[_0x1d82('0x2a')]=function(_0x1de462,_0x27a597){return db[_0x1d82('0x32')][_0x1d82('0x4f')]({'where':{'id':_0x1de462[_0x1d82('0x4e')]['id']}})[_0x1d82('0x2b')](handleEntityNotFound(_0x27a597,null))['then'](removeEntity(_0x27a597,null))['catch'](handleError(_0x27a597,null));};exports[_0x1d82('0x52')]=function(_0x253dce,_0x3a492e){return db[_0x1d82('0x32')]['describe']()[_0x1d82('0x2b')](respondWithResult(_0x3a492e,null))[_0x1d82('0x4c')](handleError(_0x3a492e,null));};function wrapUser(_0x20cac7){return function(_0x1a1c34){var _0x5989f4=_0x20cac7[_0x1d82('0x53')]({'plain':!![]});_0x5989f4[_0x1d82('0x54')]=[];if(_0x1a1c34){_0x5989f4[_0x1d82('0x55')]=_0x1a1c34[_0x1d82('0x56')];_0x5989f4['lastMessage']=_0x1a1c34;}else{_0x5989f4[_0x1d82('0x55')]=moment(0x0)[_0x1d82('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x5989f4['lastMessage']={};}return _0x5989f4;};}exports[_0x1d82('0x58')]=function(_0x5ac1d9,_0x5420f5,_0x1e4fb9){var _0x16b50a=[];return db[_0x1d82('0x59')][_0x1d82('0x4a')]({'where':{'role':[_0x1d82('0x5a'),_0x1d82('0x5b'),_0x1d82('0x5c')]},'attributes':['id',_0x1d82('0x5d'),_0x1d82('0x2e'),'role','userpic','internal','online',_0x1d82('0x5e'),_0x1d82('0x5f'),'showWebBar'],'order':qs['sort'](_0x1d82('0x60')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x1d82('0x2e'),_0x1d82('0x35')],'through':{'attributes':[]}}]})[_0x1d82('0x2b')](function(_0x3fe7ab){if(_0x3fe7ab){var _0x33ffc5=_0x5ac1d9[_0x1d82('0x5c')][_0x1d82('0x53')]({'plain':!![]});if(!_0x33ffc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33ffc5[_0x1d82('0x61')]===_0x1d82('0x5c')){return db[_0x1d82('0x62')][_0x1d82('0x4f')]({'where':{'name':_0x1d82('0x63'),'userProfileId':_0x33ffc5[_0x1d82('0x64')]},'raw':!![]})[_0x1d82('0x2b')](function(_0x4ba64c){if(_0x4ba64c){if(_0x4ba64c[_0x1d82('0x65')]===0x0){return db[_0x1d82('0x66')][_0x1d82('0x4a')]({'where':{'sectionId':_0x4ba64c['id']},'raw':!![]})[_0x1d82('0x2b')](function(_0x22ae3e){var _0x4ec797=[];if(_[_0x1d82('0x67')](_0x22ae3e)){_0x4ec797=_[_0x1d82('0x44')](_0x3fe7ab,function(_0x240aa9){if(_0x240aa9[_0x1d82('0x61')]!==_0x1d82('0x5a')){return _0x240aa9;}});return _0x4ec797;}else{for(var _0x231735=0x0;_0x231735<_0x3fe7ab['length'];_0x231735++){var _0x31b7bd=_0x3fe7ab[_0x231735];if(_0x31b7bd[_0x1d82('0x61')]===_0x1d82('0x5a')){var _0x40eeb1=_[_0x1d82('0x4f')](_0x22ae3e,function(_0x26a180){return _0x26a180[_0x1d82('0x68')]===_0x31b7bd['id'];});if(_0x40eeb1)_0x4ec797[_0x1d82('0x69')](_0x31b7bd);}else{_0x4ec797[_0x1d82('0x69')](_0x31b7bd);}}return _0x4ec797;}});}else{return _0x3fe7ab;}}else{var _0x52a74a=_['filter'](_0x3fe7ab,function(_0x5a76d7){if(_0x5a76d7[_0x1d82('0x61')]!==_0x1d82('0x5a')){return _0x5a76d7;}});return _0x52a74a;}});}else{return _0x3fe7ab;}}})[_0x1d82('0x2b')](function(_0x3fa56d){var _0x291603=[];if(_0x3fa56d){_0x16b50a=_0x3fa56d;for(var _0x362dc5=0x0;_0x362dc5<_0x3fa56d[_0x1d82('0x3e')];_0x362dc5+=0x1){_0x16b50a[_0x362dc5]['messages']=[];_0x291603['push'](db['ChatInternalMessage'][_0x1d82('0x4f')]({'where':{'FromId':[_0x5ac1d9['user']['id'],_0x3fa56d[_0x362dc5]['id']],'ToId':[_0x5ac1d9[_0x1d82('0x5c')]['id'],_0x3fa56d[_0x362dc5]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x1d82('0x6a'),_0x1d82('0x6b'),_0x1d82('0x6c'),_0x1d82('0x51')],'order':qs[_0x1d82('0x42')](_0x1d82('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3fa56d[_0x362dc5])));}return BPromise[_0x1d82('0x6e')](_0x291603);}return[];})[_0x1d82('0x2b')](function(_0x1655d5){return{'rows':_0x1655d5,'count':_0x1655d5[_0x1d82('0x3e')]};})['then'](respondWithResult(_0x5420f5,null))['catch'](handleError(_0x5420f5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 6b4e8e4..24344a9 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 _0xb2b5=['emit','hasOwnProperty','hook','save','update'];(function(_0x443b26,_0x198bff){var _0x277c86=function(_0x341176){while(--_0x341176){_0x443b26['push'](_0x443b26['shift']());}};_0x277c86(++_0x198bff);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xb2b5[_0x13e741];return _0x3f8bb3;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b2b('0x0'),'afterUpdate':_0x5b2b('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4eee87){return function(_0x31784d,_0x11fae1,_0x51e747){ChatInternalMessageEvents[_0x5b2b('0x2')](_0x4eee87+':'+_0x31784d['id'],_0x31784d);ChatInternalMessageEvents['emit'](_0x4eee87,_0x31784d);_0x51e747(null);};}for(var e in events){if(events[_0x5b2b('0x3')](e)){var event=events[e];ChatInternalMessage[_0x5b2b('0x4')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x5ad3=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x46d626,_0x492ea3){var _0x44af26=function(_0x4e25ee){while(--_0x4e25ee){_0x46d626['push'](_0x46d626['shift']());}};_0x44af26(++_0x492ea3);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4b3300,_0x1137f1){_0x4b3300=_0x4b3300-0x0;var _0x2d26d3=_0x5ad3[_0x4b3300];return _0x2d26d3;};'use strict';var EventEmitter=require(_0x35ad('0x0'));var ChatInternalMessage=require(_0x35ad('0x1'))['db'][_0x35ad('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x35ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ad('0x4'),'afterDestroy':_0x35ad('0x5')};function emitEvent(_0xc77352){return function(_0x69a0b3,_0x450f55,_0x1fed0d){ChatInternalMessageEvents[_0x35ad('0x6')](_0xc77352+':'+_0x69a0b3['id'],_0x69a0b3);ChatInternalMessageEvents[_0x35ad('0x6')](_0xc77352,_0x69a0b3);_0x1fed0d(null);};}for(var e in events){if(events[_0x35ad('0x7')](e)){var event=events[e];ChatInternalMessage[_0x35ad('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f6adc2b..51270e7 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 _0xda3f=['../../config/environment','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','rimraf'];(function(_0x409a1,_0x2742ca){var _0x7dcf8c=function(_0x519b45){while(--_0x519b45){_0x409a1['push'](_0x409a1['shift']());}};_0x7dcf8c(++_0x2742ca);}(_0xda3f,0xec));var _0xfda3=function(_0x43b583,_0x519b92){_0x43b583=_0x43b583-0x0;var _0x24104f=_0xda3f[_0x43b583];return _0x24104f;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./chatInternalMessage.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfda3('0x8'),'collate':_0xfda3('0x9')});}; \ 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(_0x372a5f,_0x460270){var _0x456617=function(_0x9a63b7){while(--_0x9a63b7){_0x372a5f['push'](_0x372a5f['shift']());}};_0x456617(++_0x460270);}(_0x4fc2,0x111));var _0x24fc=function(_0x3130be,_0x54990e){_0x3130be=_0x3130be-0x0;var _0x484c5b=_0x4fc2[_0x3130be];return _0x484c5b;};'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 cb6e0d0..e6c20a7 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 _0xf680=['../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xce201f,_0x3a0737){var _0xb052f4=function(_0x43fbee){while(--_0x43fbee){_0xce201f['push'](_0xce201f['shift']());}};_0xb052f4(++_0x3a0737);}(_0xf680,0xd7));var _0x0f68=function(_0x6dae5d,_0x204649){_0x6dae5d=_0x6dae5d-0x0;var _0x2350c9=_0xf680[_0x6dae5d];return _0x2350c9;};'use strict';var _=require(_0x0f68('0x0'));var util=require(_0x0f68('0x1'));var moment=require(_0x0f68('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f68('0x3'));var fs=require('fs');var Redis=require(_0x0f68('0x4'));var db=require(_0x0f68('0x5'))['db'];var utils=require(_0x0f68('0x6'));var logger=require(_0x0f68('0x7'))(_0x0f68('0x8'));var config=require(_0x0f68('0x9'));var jayson=require(_0x0f68('0xa'));var client=jayson[_0x0f68('0xb')]['http']({'port':0x232a});config[_0x0f68('0xc')]=_[_0x0f68('0xd')](config[_0x0f68('0xc')],{'host':_0x0f68('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f68('0xc')]));require(_0x0f68('0xf'))[_0x0f68('0x10')](socket);function respondWithRpcPromise(_0x577d27,_0x464bfa,_0x24da84){return new BPromise(function(_0x4856b5,_0x2993c4){return client[_0x0f68('0x11')](_0x577d27,_0x24da84)[_0x0f68('0x12')](function(_0x7136f2){logger[_0x0f68('0x13')](_0x0f68('0x14'),_0x464bfa,_0x0f68('0x15'));logger[_0x0f68('0x16')](_0x0f68('0x17'),_0x464bfa,_0x0f68('0x15'),JSON['stringify'](_0x7136f2));if(_0x7136f2[_0x0f68('0x18')]){if(_0x7136f2[_0x0f68('0x18')]['code']===0x1f4){logger[_0x0f68('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x464bfa,_0x7136f2[_0x0f68('0x18')][_0x0f68('0x19')]);return _0x2993c4(_0x7136f2[_0x0f68('0x18')]['message']);}logger[_0x0f68('0x18')](_0x0f68('0x14'),_0x464bfa,_0x7136f2[_0x0f68('0x18')][_0x0f68('0x19')]);return _0x4856b5(_0x7136f2['error'][_0x0f68('0x19')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x464bfa,_0x0f68('0x15'));_0x4856b5(_0x7136f2[_0x0f68('0x1a')]['message']);}})[_0x0f68('0x1b')](function(_0x24dac9){logger['error'](_0x0f68('0x14'),_0x464bfa,_0x24dac9);_0x2993c4(_0x24dac9);});});} \ No newline at end of file +var _0x3715=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3715,0x1c2));var _0x5371=function(_0x7fe935,_0xcc8046){_0x7fe935=_0x7fe935-0x0;var _0x488b08=_0x3715[_0x7fe935];return _0x488b08;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var moment=require(_0x5371('0x2'));var BPromise=require('bluebird');var rs=require(_0x5371('0x3'));var fs=require('fs');var Redis=require(_0x5371('0x4'));var db=require(_0x5371('0x5'))['db'];var utils=require(_0x5371('0x6'));var logger=require(_0x5371('0x7'))('rpc');var config=require(_0x5371('0x8'));var jayson=require(_0x5371('0x9'));var client=jayson[_0x5371('0xa')]['http']({'port':0x232a});config['redis']=_[_0x5371('0xb')](config[_0x5371('0xc')],{'host':_0x5371('0xd'),'port':0x18eb});var socket=require(_0x5371('0xe'))(new Redis(config[_0x5371('0xc')]));require(_0x5371('0xf'))[_0x5371('0x10')](socket);function respondWithRpcPromise(_0x4081e3,_0x30d422,_0x1d3fee){return new BPromise(function(_0x22cfc3,_0x42c84c){return client[_0x5371('0x11')](_0x4081e3,_0x1d3fee)['then'](function(_0x300cc7){logger[_0x5371('0x12')](_0x5371('0x13'),_0x30d422,_0x5371('0x14'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x30d422,_0x5371('0x14'),JSON[_0x5371('0x15')](_0x300cc7));if(_0x300cc7[_0x5371('0x16')]){if(_0x300cc7[_0x5371('0x16')][_0x5371('0x17')]===0x1f4){logger[_0x5371('0x16')](_0x5371('0x13'),_0x30d422,_0x300cc7['error']['message']);return _0x42c84c(_0x300cc7['error'][_0x5371('0x18')]);}logger[_0x5371('0x16')](_0x5371('0x13'),_0x30d422,_0x300cc7[_0x5371('0x16')][_0x5371('0x18')]);return _0x22cfc3(_0x300cc7[_0x5371('0x16')][_0x5371('0x18')]);}else{logger['info'](_0x5371('0x13'),_0x30d422,_0x5371('0x14'));_0x22cfc3(_0x300cc7['result']['message']);}})['catch'](function(_0x20d3e5){logger[_0x5371('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x30d422,_0x20d3e5);_0x42c84c(_0x20d3e5);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0c57c03..20be14e 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 _0x1306=['./chatInternalMessage.events','save','remove','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x9b8e79,_0x197724){var _0x17341f=function(_0x4e74d5){while(--_0x4e74d5){_0x9b8e79['push'](_0x9b8e79['shift']());}};_0x17341f(++_0x197724);}(_0x1306,0x17a));var _0x6130=function(_0x52d226,_0xe40310){_0x52d226=_0x52d226-0x0;var _0x16bc17=_0x1306[_0x52d226];return _0x16bc17;};'use strict';var ChatInternalMessageEvents=require(_0x6130('0x0'));var events=[_0x6130('0x1'),_0x6130('0x2'),_0x6130('0x3')];function createListener(_0x193b62,_0x31415c){return function(_0xdfa9cd){_0x31415c[_0x6130('0x4')](_0x193b62,_0xdfa9cd);};}function removeListener(_0x1c10f4,_0x33f042){return function(){ChatInternalMessageEvents[_0x6130('0x5')](_0x1c10f4,_0x33f042);};}exports[_0x6130('0x6')]=function(_0x213e6a){for(var _0x2b965d=0x0,_0x1db089=events[_0x6130('0x7')];_0x2b965d<_0x1db089;_0x2b965d++){var _0x354501=events[_0x2b965d];var _0x288b1d=createListener(_0x6130('0x8')+_0x354501,_0x213e6a);ChatInternalMessageEvents['on'](_0x354501,_0x288b1d);}}; \ No newline at end of file +var _0x562d=['./chatInternalMessage.events','save','remove','emit','length'];(function(_0x5e0f59,_0x5d054f){var _0x28bf68=function(_0x33b05d){while(--_0x33b05d){_0x5e0f59['push'](_0x5e0f59['shift']());}};_0x28bf68(++_0x5d054f);}(_0x562d,0xe1));var _0xd562=function(_0x47de1c,_0x22e27d){_0x47de1c=_0x47de1c-0x0;var _0x129312=_0x562d[_0x47de1c];return _0x129312;};'use strict';var ChatInternalMessageEvents=require(_0xd562('0x0'));var events=[_0xd562('0x1'),_0xd562('0x2'),'update'];function createListener(_0x517c30,_0x3ea08c){return function(_0x29f939){_0x3ea08c[_0xd562('0x3')](_0x517c30,_0x29f939);};}function removeListener(_0x4c6430,_0xf71ee1){return function(){ChatInternalMessageEvents['removeListener'](_0x4c6430,_0xf71ee1);};}exports['register']=function(_0x1d05e9){for(var _0x46bf9b=0x0,_0x3e6465=events[_0xd562('0x4')];_0x46bf9b<_0x3e6465;_0x46bf9b++){var _0x21f82a=events[_0x46bf9b];var _0x38e1a7=createListener('chatInternalMessage:'+_0x21f82a,_0x1d05e9);ChatInternalMessageEvents['on'](_0x21f82a,_0x38e1a7);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index cec77be..2bc701c 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 _0xfaf0=['show','post','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','/:id'];(function(_0x2e7eed,_0x3e5943){var _0x532742=function(_0x51fc51){while(--_0x51fc51){_0x2e7eed['push'](_0x2e7eed['shift']());}};_0x532742(++_0x3e5943);}(_0xfaf0,0x6a));var _0x0faf=function(_0x1d6690,_0x1b7247){_0x1d6690=_0x1d6690-0x0;var _0x3cf294=_0xfaf0[_0x1d6690];return _0x3cf294;};'use strict';var multer=require(_0x0faf('0x0'));var util=require(_0x0faf('0x1'));var path=require('path');var timeout=require(_0x0faf('0x2'));var express=require(_0x0faf('0x3'));var router=express['Router']();var fs_extra=require(_0x0faf('0x4'));var auth=require(_0x0faf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0faf('0x6'));router['get']('/',auth[_0x0faf('0x7')](),controller[_0x0faf('0x8')]);router[_0x0faf('0x9')](_0x0faf('0xa'),auth['isAuthenticated'](),controller[_0x0faf('0xb')]);router[_0x0faf('0x9')](_0x0faf('0xc'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0faf('0x9')](_0x0faf('0xd'),auth[_0x0faf('0x7')](),controller[_0x0faf('0xe')]);router[_0x0faf('0xf')]('/',auth[_0x0faf('0x7')](),controller['create']);router[_0x0faf('0x10')](_0x0faf('0xd'),controller[_0x0faf('0x11')]);router['delete'](_0x0faf('0xd'),auth['isAuthenticated'](),controller[_0x0faf('0x12')]);module[_0x0faf('0x13')]=router; \ No newline at end of file +var _0x4e83=['connect-timeout','express','Router','fs-extra','get','isAuthenticated','/describe','/users','/:id','show','post','create','put','delete','destroy','exports','multer','path'];(function(_0x514c5e,_0x8c0875){var _0x34c3e6=function(_0x3d78d2){while(--_0x3d78d2){_0x514c5e['push'](_0x514c5e['shift']());}};_0x34c3e6(++_0x8c0875);}(_0x4e83,0x1ae));var _0x34e8=function(_0x6e51f1,_0x11371a){_0x6e51f1=_0x6e51f1-0x0;var _0x141b4c=_0x4e83[_0x6e51f1];return _0x141b4c;};'use strict';var multer=require(_0x34e8('0x0'));var util=require('util');var path=require(_0x34e8('0x1'));var timeout=require(_0x34e8('0x2'));var express=require(_0x34e8('0x3'));var router=express[_0x34e8('0x4')]();var fs_extra=require(_0x34e8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0x34e8('0x6')]('/',auth[_0x34e8('0x7')](),controller['index']);router[_0x34e8('0x6')](_0x34e8('0x8'),auth[_0x34e8('0x7')](),controller['describe']);router[_0x34e8('0x6')](_0x34e8('0x9'),auth[_0x34e8('0x7')](),controller['getUsers']);router[_0x34e8('0x6')](_0x34e8('0xa'),auth[_0x34e8('0x7')](),controller[_0x34e8('0xb')]);router[_0x34e8('0xc')]('/',auth[_0x34e8('0x7')](),controller[_0x34e8('0xd')]);router[_0x34e8('0xe')](_0x34e8('0xa'),controller['update']);router[_0x34e8('0xf')](_0x34e8('0xa'),auth['isAuthenticated'](),controller[_0x34e8('0x10')]);module[_0x34e8('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6187b92..43cb3fe 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 _0x3c38=['DATE','STRING','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3c38,0x8a));var _0x83c3=function(_0x558958,_0x98f5ca){_0x558958=_0x558958-0x0;var _0xef3c17=_0x3c38[_0x558958];return _0xef3c17;};'use strict';var Sequelize=require(_0x83c3('0x0'));module[_0x83c3('0x1')]={'body':{'type':Sequelize[_0x83c3('0x2')](_0x83c3('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x83c3('0x4')]('in',_0x83c3('0x5')),'defaultValue':_0x83c3('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x83c3('0x6')]},'providerName':{'type':Sequelize[_0x83c3('0x7')]},'providerResponse':{'type':Sequelize[_0x83c3('0x2')]}}; \ No newline at end of file +var _0xe52f=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x4bd4c5,_0x376640){var _0x200e5e=function(_0xc99aec){while(--_0xc99aec){_0x4bd4c5['push'](_0x4bd4c5['shift']());}};_0x200e5e(++_0x376640);}(_0xe52f,0x170));var _0xfe52=function(_0xc11207,_0x19fbd0){_0xc11207=_0xc11207-0x0;var _0x6072e9=_0xe52f[_0xc11207];return _0x6072e9;};'use strict';var Sequelize=require(_0xfe52('0x0'));module[_0xfe52('0x1')]={'body':{'type':Sequelize[_0xfe52('0x2')](_0xfe52('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfe52('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfe52('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfe52('0x5')]('in',_0xfe52('0x6')),'defaultValue':_0xfe52('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xfe52('0x7')]},'providerResponse':{'type':Sequelize[_0xfe52('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6d669d4..095c257 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 _0xd71e=['findAll','rows','show','params','include','find','create','body','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','get','role','null','AcceptMessage','acceptMessage','startsWith','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','manual','SIP/%s','channel','EventManager','parse','formData','info','RejectMessage','rejectMessage','CmContact','Sequelize','interface','event','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','send','index','ChatMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll'];(function(_0x32b773,_0x543dd8){var _0x554d59=function(_0x28e434){while(--_0x28e434){_0x32b773['push'](_0x32b773['shift']());}};_0x554d59(++_0x543dd8);}(_0xd71e,0x1c9));var _0xed71=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xd71e[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed71('0x0'));var zipdir=require(_0xed71('0x1'));var jsonpatch=require(_0xed71('0x2'));var rp=require(_0xed71('0x3'));var moment=require(_0xed71('0x4'));var BPromise=require(_0xed71('0x5'));var Mustache=require(_0xed71('0x6'));var util=require(_0xed71('0x7'));var path=require(_0xed71('0x8'));var sox=require(_0xed71('0x9'));var csv=require(_0xed71('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed71('0xb'));var crypto=require(_0xed71('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xed71('0xd'));var toCsv=require(_0xed71('0xa'));var querystring=require(_0xed71('0xe'));var Papa=require(_0xed71('0xf'));var Redis=require(_0xed71('0x10'));var authService=require(_0xed71('0x11'));var qs=require(_0xed71('0x12'));var as=require(_0xed71('0x13'));var hardwareService=require(_0xed71('0x14'));var logger=require(_0xed71('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xed71('0x16'));var licenseUtil=require(_0xed71('0x17'));var db=require(_0xed71('0x18'))['db'];config[_0xed71('0x19')]=_[_0xed71('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xed71('0x1b'))(new Redis(config[_0xed71('0x19')]));require(_0xed71('0x1c'))[_0xed71('0x1d')](socket);var jayson=require(_0xed71('0x1e'));var client=jayson[_0xed71('0x1f')][_0xed71('0x20')]({'port':0x232c});var client9002=jayson[_0xed71('0x1f')][_0xed71('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x21bff6,_0x30e93d,_0x462b25,_0x3b813f){return new BPromise(function(_0x30dc17,_0x360bce){var _0x3181db=_0x3b813f||client;return _0x3181db[_0xed71('0x21')](_0x21bff6,_0x462b25)[_0xed71('0x22')](function(_0x210e1c){logger['info'](_0xed71('0x23'),_0x30e93d,_0xed71('0x24'));logger['debug'](_0xed71('0x25'),_0x30e93d,_0xed71('0x24'),JSON[_0xed71('0x26')](_0x210e1c));if(_0x210e1c[_0xed71('0x27')]){if(_0x210e1c['error'][_0xed71('0x28')]===0x1f4){logger['error'](_0xed71('0x23'),_0x30e93d,_0x210e1c['error'][_0xed71('0x29')]);return _0x360bce(_0x210e1c['error']['message']);}logger[_0xed71('0x27')](_0xed71('0x23'),_0x30e93d,_0x210e1c[_0xed71('0x27')]['message']);return _0x30dc17(_0x210e1c[_0xed71('0x27')][_0xed71('0x29')]);}else{logger['info'](_0xed71('0x23'),_0x30e93d,_0xed71('0x24'));_0x30dc17(_0x210e1c[_0xed71('0x2a')][_0xed71('0x29')]);}})[_0xed71('0x2b')](function(_0x4b3d24){logger[_0xed71('0x27')](_0xed71('0x23'),_0x30e93d,_0x4b3d24);_0x360bce(_0x4b3d24);});});}function respondWithStatusCode(_0x29ffa,_0x223704){_0x223704=_0x223704||0xcc;return function(_0x117bf9){if(_0x117bf9){return _0x29ffa[_0xed71('0x2c')](_0x223704);}return _0x29ffa[_0xed71('0x2d')](_0x223704)[_0xed71('0x2e')]();};}function respondWithResult(_0x592c50,_0x3af03e){_0x3af03e=_0x3af03e||0xc8;return function(_0x1844e5){if(_0x1844e5){return _0x592c50[_0xed71('0x2d')](_0x3af03e)[_0xed71('0x2f')](_0x1844e5);}};}function respondWithFilteredResult(_0xfc6130,_0x5af9f3){return function(_0x296daf){if(_0x296daf){var _0xae50fb=typeof _0x5af9f3[_0xed71('0x30')]===_0xed71('0x31')&&typeof _0x5af9f3[_0xed71('0x32')]===_0xed71('0x31');var _0x1fc439=_0x296daf[_0xed71('0x33')];var _0x4c610e=_0xae50fb?0x0:_0x5af9f3[_0xed71('0x30')];var _0x2d2ca0=_0xae50fb?_0x296daf[_0xed71('0x33')]:_0x5af9f3[_0xed71('0x30')]+_0x5af9f3[_0xed71('0x32')];var _0x337fdd;if(_0x2d2ca0>=_0x1fc439){_0x2d2ca0=_0x1fc439;_0x337fdd=0xc8;}else{_0x337fdd=0xce;}_0xfc6130[_0xed71('0x2d')](_0x337fdd);return _0xfc6130['set'](_0xed71('0x34'),_0x4c610e+'-'+_0x2d2ca0+'/'+_0x1fc439)[_0xed71('0x2f')](_0x296daf);}return null;};}function patchUpdates(_0x5cc24e){return function(_0x5656a9){try{jsonpatch[_0xed71('0x35')](_0x5656a9,_0x5cc24e,!![]);}catch(_0x1a918b){return BPromise[_0xed71('0x36')](_0x1a918b);}return _0x5656a9[_0xed71('0x37')]();};}function saveUpdates(_0x4479da,_0x3e44c5){return function(_0x53274){if(_0x53274){return _0x53274[_0xed71('0x38')](_0x4479da)[_0xed71('0x22')](function(_0x3d5a9f){return _0x3d5a9f;});}return null;};}function removeEntity(_0x156a08,_0x2b0593){return function(_0x1e9588){if(_0x1e9588){return _0x1e9588[_0xed71('0x39')]()[_0xed71('0x22')](function(){_0x156a08[_0xed71('0x2d')](0xcc)[_0xed71('0x2e')]();});}};}function handleEntityNotFound(_0x4f86df,_0x115b2f){return function(_0x13ab0d){if(!_0x13ab0d){_0x4f86df[_0xed71('0x2c')](0x194);}return _0x13ab0d;};}function handleError(_0x3a29f8,_0x3d0d87){_0x3d0d87=_0x3d0d87||0x1f4;return function(_0x4a5498){logger[_0xed71('0x27')](_0x4a5498['stack']);if(_0x4a5498[_0xed71('0x3a')]){delete _0x4a5498[_0xed71('0x3a')];}_0x3a29f8[_0xed71('0x2d')](_0x3d0d87)[_0xed71('0x3b')](_0x4a5498);};}exports[_0xed71('0x3c')]=function(_0x2e82cc,_0xb29b44){var _0x5207cc={},_0x3d7b58={},_0x17c239={'count':0x0,'rows':[]};var _0x841e48=_['map'](db[_0xed71('0x3d')][_0xed71('0x3e')],function(_0x115f58){return{'name':_0x115f58[_0xed71('0x3f')],'type':_0x115f58['type'][_0xed71('0x40')]};});_0x3d7b58[_0xed71('0x41')]=_['map'](_0x841e48,'name');_0x3d7b58['query']=_[_0xed71('0x42')](_0x2e82cc[_0xed71('0x43')]);_0x3d7b58[_0xed71('0x44')]=_[_0xed71('0x45')](_0x3d7b58[_0xed71('0x41')],_0x3d7b58[_0xed71('0x43')]);_0x5207cc[_0xed71('0x46')]=_[_0xed71('0x45')](_0x3d7b58[_0xed71('0x41')],qs['fields'](_0x2e82cc['query'][_0xed71('0x47')]));_0x5207cc[_0xed71('0x46')]=_0x5207cc['attributes'][_0xed71('0x48')]?_0x5207cc[_0xed71('0x46')]:_0x3d7b58[_0xed71('0x41')];if(!_0x2e82cc[_0xed71('0x43')][_0xed71('0x49')]('nolimit')){_0x5207cc['limit']=qs[_0xed71('0x32')](_0x2e82cc[_0xed71('0x43')][_0xed71('0x32')]);_0x5207cc[_0xed71('0x30')]=qs[_0xed71('0x30')](_0x2e82cc[_0xed71('0x43')][_0xed71('0x30')]);}_0x5207cc[_0xed71('0x4a')]=qs[_0xed71('0x4b')](_0x2e82cc[_0xed71('0x43')]['sort']);_0x5207cc[_0xed71('0x4c')]=qs[_0xed71('0x44')](_[_0xed71('0x4d')](_0x2e82cc[_0xed71('0x43')],_0x3d7b58[_0xed71('0x44')]),_0x841e48);if(_0x2e82cc[_0xed71('0x43')][_0xed71('0x4e')]){_0x5207cc[_0xed71('0x4c')]=_[_0xed71('0x4f')](_0x5207cc[_0xed71('0x4c')],{'$or':_[_0xed71('0x50')](_0x841e48,function(_0x2bf9e9){if(_0x2bf9e9['type']!==_0xed71('0x51')){var _0x533223={};_0x533223[_0x2bf9e9['name']]={'$like':'%'+_0x2e82cc[_0xed71('0x43')][_0xed71('0x4e')]+'%'};return _0x533223;}})});}_0x5207cc=_[_0xed71('0x4f')]({},_0x5207cc,_0x2e82cc['options']);var _0x388d8b={'where':_0x5207cc[_0xed71('0x4c')]};return db[_0xed71('0x3d')][_0xed71('0x33')](_0x388d8b)[_0xed71('0x22')](function(_0x2e1be1){_0x17c239[_0xed71('0x33')]=_0x2e1be1;if(_0x2e82cc['query'][_0xed71('0x52')]){_0x5207cc['include']=[{'all':!![]}];}return db[_0xed71('0x3d')][_0xed71('0x53')](_0x5207cc);})[_0xed71('0x22')](function(_0xe436e0){_0x17c239[_0xed71('0x54')]=_0xe436e0;return _0x17c239;})[_0xed71('0x22')](respondWithFilteredResult(_0xb29b44,_0x5207cc))['catch'](handleError(_0xb29b44,null));};exports[_0xed71('0x55')]=function(_0x369b6a,_0x138ee1){var _0x1f3b53={'raw':!![],'where':{'id':_0x369b6a[_0xed71('0x56')]['id']}},_0xc5a87={};_0xc5a87[_0xed71('0x41')]=_[_0xed71('0x42')](db[_0xed71('0x3d')][_0xed71('0x3e')]);_0xc5a87[_0xed71('0x43')]=_[_0xed71('0x42')](_0x369b6a[_0xed71('0x43')]);_0xc5a87[_0xed71('0x44')]=_[_0xed71('0x45')](_0xc5a87[_0xed71('0x41')],_0xc5a87['query']);_0x1f3b53[_0xed71('0x46')]=_[_0xed71('0x45')](_0xc5a87[_0xed71('0x41')],qs[_0xed71('0x47')](_0x369b6a[_0xed71('0x43')][_0xed71('0x47')]));_0x1f3b53[_0xed71('0x46')]=_0x1f3b53[_0xed71('0x46')][_0xed71('0x48')]?_0x1f3b53['attributes']:_0xc5a87['model'];if(_0x369b6a['query'][_0xed71('0x52')]){_0x1f3b53[_0xed71('0x57')]=[{'all':!![]}];}_0x1f3b53=_['merge']({},_0x1f3b53,_0x369b6a['options']);return db[_0xed71('0x3d')][_0xed71('0x58')](_0x1f3b53)[_0xed71('0x22')](handleEntityNotFound(_0x138ee1,null))[_0xed71('0x22')](respondWithResult(_0x138ee1,null))['catch'](handleError(_0x138ee1,null));};exports[_0xed71('0x59')]=function(_0x2248d9,_0x1b8d32){return db[_0xed71('0x3d')][_0xed71('0x59')](_0x2248d9[_0xed71('0x5a')],{})[_0xed71('0x22')](respondWithResult(_0x1b8d32,0xc9))[_0xed71('0x2b')](handleError(_0x1b8d32,null));};exports[_0xed71('0x38')]=function(_0x1d5f99,_0x4bf3f1){if(_0x1d5f99[_0xed71('0x5a')]['id']){delete _0x1d5f99[_0xed71('0x5a')]['id'];}return db[_0xed71('0x3d')][_0xed71('0x58')]({'where':{'id':_0x1d5f99['params']['id']}})['then'](handleEntityNotFound(_0x4bf3f1,null))[_0xed71('0x22')](saveUpdates(_0x1d5f99[_0xed71('0x5a')],null))['then'](respondWithResult(_0x4bf3f1,null))[_0xed71('0x2b')](handleError(_0x4bf3f1,null));};exports[_0xed71('0x39')]=function(_0x566846,_0x579a4b){return db[_0xed71('0x3d')][_0xed71('0x58')]({'where':{'id':_0x566846[_0xed71('0x56')]['id']}})['then'](handleEntityNotFound(_0x579a4b,null))[_0xed71('0x22')](removeEntity(_0x579a4b,null))[_0xed71('0x2b')](handleError(_0x579a4b,null));};exports[_0xed71('0x5b')]=function(_0x4dca18,_0x97dc40){return db[_0xed71('0x3d')][_0xed71('0x5b')]()[_0xed71('0x22')](respondWithResult(_0x97dc40,null))['catch'](handleError(_0x97dc40,null));};var interaction_log=require(_0xed71('0x15'))(_0xed71('0x5c'));exports[_0xed71('0x5d')]=function(_0xa6ec89,_0x598b71,_0x66ab60){var _0x5279e9={'agent':{},'channel':_0xed71('0x5e')};if(_0xa6ec89[_0xed71('0x5a')]['id']){delete _0xa6ec89[_0xed71('0x5a')]['id'];}_0xa6ec89[_0xed71('0x5a')][_0xed71('0x5f')]=!![];_0xa6ec89[_0xed71('0x5a')][_0xed71('0x60')]=moment()['format'](_0xed71('0x61'));_0xa6ec89[_0xed71('0x5a')][_0xed71('0x62')]=_0xa6ec89[_0xed71('0x5a')]['UserId']||_0xa6ec89[_0xed71('0x63')]['id'];_0x5279e9[_0xed71('0x64')]['id']=_0xa6ec89[_0xed71('0x5a')][_0xed71('0x62')];return db['ChatMessage']['find']({'where':{'id':_0xa6ec89['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xed71('0x65')}]})[_0xed71('0x22')](handleEntityNotFound(_0x598b71,null))[_0xed71('0x22')](saveUpdates(_0xa6ec89[_0xed71('0x5a')],null))[_0xed71('0x22')](function(_0x7e7be1){if(_0x7e7be1){_0x5279e9['message']=_0x7e7be1['get']({'plain':!![]});return db[_0xed71('0x66')][_0xed71('0x58')]({'where':{'id':_0x7e7be1[_0xed71('0x67')]}});}return null;})[_0xed71('0x22')](handleEntityNotFound(_0x598b71,null))[_0xed71('0x22')](function(_0x233b4a){if(_0x233b4a){return _0x233b4a['update']({'UserId':_0xa6ec89[_0xed71('0x5a')][_0xed71('0x62')],'read1stAt':_[_0xed71('0x68')](_0x233b4a[_0xed71('0x69')])?moment()[_0xed71('0x6a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2b8250){if(_0x2b8250){_0x5279e9[_0xed71('0x6b')]=_0x2b8250[_0xed71('0x6c')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa6ec89[_0xed71('0x63')]['id'],_0xa6ec89[_0xed71('0x63')][_0xed71('0x3a')],_0xa6ec89[_0xed71('0x63')][_0xed71('0x6d')],_0x5279e9['interaction']['id'],_0xa6ec89[_0xed71('0x5a')]?JSON[_0xed71('0x26')](_0xa6ec89[_0xed71('0x5a')]):_0xed71('0x6e'));return respondWithRpcPromise(_0xed71('0x6f'),_0xed71('0x70'),_0x5279e9);}return null;})[_0xed71('0x22')](function(_0x1df1b9){return db['CmContact'][_0xed71('0x5b')]()[_0xed71('0x22')](function(_0x1e8872){var _0x1ad5f1=[];for(var _0x2bcd3c=0x0;_0x2bcd3c=_0x19dd44){_0x3657fa=_0x19dd44;_0x465e96=0xc8;}else{_0x465e96=0xce;}_0xcdaa5[_0x59e2('0x2d')](_0x465e96);return _0xcdaa5[_0x59e2('0x34')](_0x59e2('0x35'),_0x28f0a6+'-'+_0x3657fa+'/'+_0x19dd44)[_0x59e2('0x2f')](_0x25f965);}return null;};}function patchUpdates(_0x197ef5){return function(_0x44ac3f){try{jsonpatch[_0x59e2('0x36')](_0x44ac3f,_0x197ef5,!![]);}catch(_0x2a6b8b){return BPromise[_0x59e2('0x37')](_0x2a6b8b);}return _0x44ac3f[_0x59e2('0x38')]();};}function saveUpdates(_0x489e28,_0x22600c){return function(_0x1edb10){if(_0x1edb10){return _0x1edb10[_0x59e2('0x39')](_0x489e28)[_0x59e2('0x3a')](function(_0x8a5049){return _0x8a5049;});}return null;};}function removeEntity(_0x165619,_0x48de4c){return function(_0x5c4327){if(_0x5c4327){return _0x5c4327[_0x59e2('0x3b')]()['then'](function(){_0x165619[_0x59e2('0x2d')](0xcc)[_0x59e2('0x2e')]();});}};}function handleEntityNotFound(_0x136be2,_0x31bf32){return function(_0x2023eb){if(!_0x2023eb){_0x136be2['sendStatus'](0x194);}return _0x2023eb;};}function handleError(_0x24c076,_0xcf7800){_0xcf7800=_0xcf7800||0x1f4;return function(_0x3c00ca){logger[_0x59e2('0x27')](_0x3c00ca['stack']);if(_0x3c00ca['name']){delete _0x3c00ca[_0x59e2('0x3c')];}_0x24c076['status'](_0xcf7800)[_0x59e2('0x3d')](_0x3c00ca);};}exports['index']=function(_0x56e1d2,_0x354550){var _0x20ddb4={},_0x34d05f={},_0x1e7330={'count':0x0,'rows':[]};var _0x193768=_['map'](db['ChatMessage'][_0x59e2('0x3e')],function(_0x242ebb){return{'name':_0x242ebb[_0x59e2('0x3f')],'type':_0x242ebb[_0x59e2('0x40')]['key']};});_0x34d05f[_0x59e2('0x41')]=_[_0x59e2('0x42')](_0x193768,_0x59e2('0x3c'));_0x34d05f[_0x59e2('0x43')]=_['keys'](_0x56e1d2[_0x59e2('0x43')]);_0x34d05f[_0x59e2('0x44')]=_[_0x59e2('0x45')](_0x34d05f[_0x59e2('0x41')],_0x34d05f['query']);_0x20ddb4['attributes']=_[_0x59e2('0x45')](_0x34d05f[_0x59e2('0x41')],qs[_0x59e2('0x46')](_0x56e1d2[_0x59e2('0x43')][_0x59e2('0x46')]));_0x20ddb4[_0x59e2('0x47')]=_0x20ddb4[_0x59e2('0x47')][_0x59e2('0x48')]?_0x20ddb4[_0x59e2('0x47')]:_0x34d05f[_0x59e2('0x41')];if(!_0x56e1d2['query'][_0x59e2('0x49')](_0x59e2('0x4a'))){_0x20ddb4[_0x59e2('0x31')]=qs[_0x59e2('0x31')](_0x56e1d2[_0x59e2('0x43')][_0x59e2('0x31')]);_0x20ddb4[_0x59e2('0x32')]=qs[_0x59e2('0x32')](_0x56e1d2['query']['offset']);}_0x20ddb4[_0x59e2('0x4b')]=qs[_0x59e2('0x4c')](_0x56e1d2[_0x59e2('0x43')]['sort']);_0x20ddb4['where']=qs['filters'](_[_0x59e2('0x4d')](_0x56e1d2['query'],_0x34d05f[_0x59e2('0x44')]),_0x193768);if(_0x56e1d2[_0x59e2('0x43')]['filter']){_0x20ddb4[_0x59e2('0x4e')]=_['merge'](_0x20ddb4[_0x59e2('0x4e')],{'$or':_[_0x59e2('0x42')](_0x193768,function(_0x2e7087){if(_0x2e7087[_0x59e2('0x40')]!=='VIRTUAL'){var _0x3fd777={};_0x3fd777[_0x2e7087[_0x59e2('0x3c')]]={'$like':'%'+_0x56e1d2[_0x59e2('0x43')][_0x59e2('0x4f')]+'%'};return _0x3fd777;}})});}_0x20ddb4=_['merge']({},_0x20ddb4,_0x56e1d2[_0x59e2('0x50')]);var _0x3bf8a4={'where':_0x20ddb4[_0x59e2('0x4e')]};return db[_0x59e2('0x51')][_0x59e2('0x33')](_0x3bf8a4)['then'](function(_0x2a70c3){_0x1e7330['count']=_0x2a70c3;if(_0x56e1d2[_0x59e2('0x43')]['includeAll']){_0x20ddb4['include']=[{'all':!![]}];}return db['ChatMessage'][_0x59e2('0x52')](_0x20ddb4);})[_0x59e2('0x3a')](function(_0x4932e1){_0x1e7330[_0x59e2('0x53')]=_0x4932e1;return _0x1e7330;})['then'](respondWithFilteredResult(_0x354550,_0x20ddb4))[_0x59e2('0x2c')](handleError(_0x354550,null));};exports[_0x59e2('0x54')]=function(_0x166333,_0x3c6273){var _0x265f9e={'raw':!![],'where':{'id':_0x166333[_0x59e2('0x55')]['id']}},_0x57a1e1={};_0x57a1e1[_0x59e2('0x41')]=_[_0x59e2('0x56')](db[_0x59e2('0x51')]['rawAttributes']);_0x57a1e1['query']=_[_0x59e2('0x56')](_0x166333[_0x59e2('0x43')]);_0x57a1e1[_0x59e2('0x44')]=_[_0x59e2('0x45')](_0x57a1e1[_0x59e2('0x41')],_0x57a1e1[_0x59e2('0x43')]);_0x265f9e[_0x59e2('0x47')]=_[_0x59e2('0x45')](_0x57a1e1[_0x59e2('0x41')],qs[_0x59e2('0x46')](_0x166333[_0x59e2('0x43')][_0x59e2('0x46')]));_0x265f9e[_0x59e2('0x47')]=_0x265f9e[_0x59e2('0x47')]['length']?_0x265f9e[_0x59e2('0x47')]:_0x57a1e1['model'];if(_0x166333[_0x59e2('0x43')][_0x59e2('0x57')]){_0x265f9e[_0x59e2('0x58')]=[{'all':!![]}];}_0x265f9e=_[_0x59e2('0x59')]({},_0x265f9e,_0x166333[_0x59e2('0x50')]);return db['ChatMessage'][_0x59e2('0x5a')](_0x265f9e)['then'](handleEntityNotFound(_0x3c6273,null))[_0x59e2('0x3a')](respondWithResult(_0x3c6273,null))[_0x59e2('0x2c')](handleError(_0x3c6273,null));};exports[_0x59e2('0x5b')]=function(_0x1ce6a3,_0x6b1ace){return db[_0x59e2('0x51')][_0x59e2('0x5b')](_0x1ce6a3[_0x59e2('0x5c')],{})['then'](respondWithResult(_0x6b1ace,0xc9))['catch'](handleError(_0x6b1ace,null));};exports['update']=function(_0x3d561e,_0x11e108){if(_0x3d561e[_0x59e2('0x5c')]['id']){delete _0x3d561e[_0x59e2('0x5c')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x3d561e['params']['id']}})[_0x59e2('0x3a')](handleEntityNotFound(_0x11e108,null))[_0x59e2('0x3a')](saveUpdates(_0x3d561e[_0x59e2('0x5c')],null))[_0x59e2('0x3a')](respondWithResult(_0x11e108,null))[_0x59e2('0x2c')](handleError(_0x11e108,null));};exports['destroy']=function(_0x6f10bc,_0x77eaea){return db[_0x59e2('0x51')][_0x59e2('0x5a')]({'where':{'id':_0x6f10bc['params']['id']}})['then'](handleEntityNotFound(_0x77eaea,null))[_0x59e2('0x3a')](removeEntity(_0x77eaea,null))[_0x59e2('0x2c')](handleError(_0x77eaea,null));};exports['describe']=function(_0x2b3ca3,_0x4fd800){return db[_0x59e2('0x51')]['describe']()[_0x59e2('0x3a')](respondWithResult(_0x4fd800,null))[_0x59e2('0x2c')](handleError(_0x4fd800,null));};var interaction_log=require('../../config/logger')(_0x59e2('0x5d'));exports[_0x59e2('0x5e')]=function(_0x732d36,_0x4f140d,_0x44b6a5){var _0x3d2bfb={'agent':{},'channel':_0x59e2('0x5f')};if(_0x732d36[_0x59e2('0x5c')]['id']){delete _0x732d36[_0x59e2('0x5c')]['id'];}_0x732d36['body'][_0x59e2('0x60')]=!![];_0x732d36[_0x59e2('0x5c')]['readAt']=moment()[_0x59e2('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x732d36[_0x59e2('0x5c')]['UserId']=_0x732d36['body']['UserId']||_0x732d36[_0x59e2('0x62')]['id'];_0x3d2bfb[_0x59e2('0x63')]['id']=_0x732d36['body'][_0x59e2('0x64')];return db['ChatMessage']['find']({'where':{'id':_0x732d36[_0x59e2('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x59e2('0x65')],'as':_0x59e2('0x66')}]})['then'](handleEntityNotFound(_0x4f140d,null))[_0x59e2('0x3a')](saveUpdates(_0x732d36[_0x59e2('0x5c')],null))[_0x59e2('0x3a')](function(_0x106d01){if(_0x106d01){_0x3d2bfb[_0x59e2('0x29')]=_0x106d01[_0x59e2('0x67')]({'plain':!![]});return db[_0x59e2('0x68')][_0x59e2('0x5a')]({'where':{'id':_0x106d01[_0x59e2('0x69')]}});}return null;})[_0x59e2('0x3a')](handleEntityNotFound(_0x4f140d,null))[_0x59e2('0x3a')](function(_0x54e611){if(_0x54e611){return _0x54e611[_0x59e2('0x39')]({'UserId':_0x732d36[_0x59e2('0x5c')][_0x59e2('0x64')],'read1stAt':_[_0x59e2('0x6a')](_0x54e611['read1stAt'])?moment()[_0x59e2('0x61')](_0x59e2('0x6b')):undefined});}return null;})[_0x59e2('0x3a')](function(_0x4f692d){if(_0x4f692d){_0x3d2bfb[_0x59e2('0x6c')]=_0x4f692d[_0x59e2('0x67')]({'plain':!![]});interaction_log[_0x59e2('0x2a')](_0x59e2('0x6d'),_0x732d36['user']['id'],_0x732d36['user']['name'],_0x732d36[_0x59e2('0x62')][_0x59e2('0x6e')],_0x3d2bfb[_0x59e2('0x6c')]['id'],_0x732d36[_0x59e2('0x5c')]?JSON[_0x59e2('0x26')](_0x732d36[_0x59e2('0x5c')]):_0x59e2('0x6f'));return respondWithRpcPromise(_0x59e2('0x70'),_0x59e2('0x71'),_0x3d2bfb);}return null;})[_0x59e2('0x3a')](function(_0x1046a6){return db[_0x59e2('0x65')][_0x59e2('0x72')]()[_0x59e2('0x3a')](function(_0x19206d){var _0x375665=[];for(var _0x11d1e=0x0;_0x11d1e=_0x4fb352){_0x38814e=_0x4fb352;_0x3aa805=0xc8;}else{_0x3aa805=0xce;}_0x4c14ff[_0x0ee8('0x1a')](_0x3aa805);return _0x4c14ff['set'](_0x0ee8('0x1f'),_0xe616dc+'-'+_0x38814e+'/'+_0x4fb352)['json'](_0x151579);}return null;};}function patchUpdates(_0x20ecba){return function(_0x4c84b0){try{jsonpatch[_0x0ee8('0x20')](_0x4c84b0,_0x20ecba,!![]);}catch(_0x497a38){return BPromise[_0x0ee8('0x21')](_0x497a38);}return _0x4c84b0[_0x0ee8('0x22')]();};}function saveUpdates(_0x155a34,_0x1e20d1){return function(_0x1f6e64){if(_0x1f6e64){return _0x1f6e64['update'](_0x155a34)[_0x0ee8('0x23')](function(_0x47f6cb){return _0x47f6cb;});}return null;};}function removeEntity(_0x36bed0,_0xb61956){return function(_0x599187){if(_0x599187){return _0x599187[_0x0ee8('0x24')]()['then'](function(){_0x36bed0[_0x0ee8('0x1a')](0xcc)[_0x0ee8('0x1b')]();});}};}function handleEntityNotFound(_0x506a32,_0x1aab4b){return function(_0x176217){if(!_0x176217){_0x506a32['sendStatus'](0x194);}return _0x176217;};}function handleError(_0x3f07ee,_0x55d6e6){_0x55d6e6=_0x55d6e6||0x1f4;return function(_0x5dab56){logger[_0x0ee8('0x25')](_0x5dab56['stack']);if(_0x5dab56[_0x0ee8('0x26')]){delete _0x5dab56[_0x0ee8('0x26')];}_0x3f07ee[_0x0ee8('0x1a')](_0x55d6e6)[_0x0ee8('0x27')](_0x5dab56);};}exports[_0x0ee8('0x28')]=function(_0x3e3373,_0x2fd1dc){var _0xd7940c={},_0x33af28={},_0x13898c={'count':0x0,'rows':[]};var _0x38447e=_[_0x0ee8('0x29')](db['ChatOfflineMessage'][_0x0ee8('0x2a')],function(_0x510add){return{'name':_0x510add['fieldName'],'type':_0x510add['type'][_0x0ee8('0x2b')]};});_0x33af28[_0x0ee8('0x2c')]=_[_0x0ee8('0x29')](_0x38447e,'name');_0x33af28['query']=_['keys'](_0x3e3373['query']);_0x33af28['filters']=_[_0x0ee8('0x2d')](_0x33af28[_0x0ee8('0x2c')],_0x33af28[_0x0ee8('0x2e')]);_0xd7940c['attributes']=_[_0x0ee8('0x2d')](_0x33af28['model'],qs[_0x0ee8('0x2f')](_0x3e3373[_0x0ee8('0x2e')][_0x0ee8('0x2f')]));_0xd7940c[_0x0ee8('0x30')]=_0xd7940c[_0x0ee8('0x30')][_0x0ee8('0x31')]?_0xd7940c[_0x0ee8('0x30')]:_0x33af28[_0x0ee8('0x2c')];if(!_0x3e3373[_0x0ee8('0x2e')][_0x0ee8('0x32')](_0x0ee8('0x33'))){_0xd7940c[_0x0ee8('0x1d')]=qs[_0x0ee8('0x1d')](_0x3e3373['query'][_0x0ee8('0x1d')]);_0xd7940c[_0x0ee8('0x1e')]=qs[_0x0ee8('0x1e')](_0x3e3373['query']['offset']);}_0xd7940c[_0x0ee8('0x34')]=qs[_0x0ee8('0x35')](_0x3e3373['query'][_0x0ee8('0x35')]);_0xd7940c['where']=qs[_0x0ee8('0x36')](_[_0x0ee8('0x37')](_0x3e3373[_0x0ee8('0x2e')],_0x33af28[_0x0ee8('0x36')]),_0x38447e);if(_0x3e3373[_0x0ee8('0x2e')]['filter']){_0xd7940c[_0x0ee8('0x38')]=_[_0x0ee8('0x39')](_0xd7940c['where'],{'$or':_[_0x0ee8('0x29')](_0x38447e,function(_0xf51b39){if(_0xf51b39['type']!==_0x0ee8('0x3a')){var _0x3d7ba1={};_0x3d7ba1[_0xf51b39[_0x0ee8('0x26')]]={'$like':'%'+_0x3e3373[_0x0ee8('0x2e')][_0x0ee8('0x3b')]+'%'};return _0x3d7ba1;}})});}_0xd7940c=_[_0x0ee8('0x39')]({},_0xd7940c,_0x3e3373[_0x0ee8('0x3c')]);var _0x4a96d7={'where':_0xd7940c[_0x0ee8('0x38')]};return db[_0x0ee8('0x3d')][_0x0ee8('0x3e')](_0x4a96d7)[_0x0ee8('0x23')](function(_0x432f44){_0x13898c[_0x0ee8('0x3e')]=_0x432f44;if(_0x3e3373[_0x0ee8('0x2e')][_0x0ee8('0x3f')]){_0xd7940c[_0x0ee8('0x40')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0xd7940c);})[_0x0ee8('0x23')](function(_0x1accb1){_0x13898c[_0x0ee8('0x41')]=_0x1accb1;return _0x13898c;})[_0x0ee8('0x23')](respondWithFilteredResult(_0x2fd1dc,_0xd7940c))[_0x0ee8('0x42')](handleError(_0x2fd1dc,null));};exports[_0x0ee8('0x43')]=function(_0x56a404,_0x303259){var _0x418d71={'raw':!![],'where':{'id':_0x56a404[_0x0ee8('0x44')]['id']}},_0x18c535={};_0x18c535[_0x0ee8('0x2c')]=_[_0x0ee8('0x45')](db[_0x0ee8('0x3d')][_0x0ee8('0x2a')]);_0x18c535[_0x0ee8('0x2e')]=_['keys'](_0x56a404[_0x0ee8('0x2e')]);_0x18c535['filters']=_['intersection'](_0x18c535[_0x0ee8('0x2c')],_0x18c535['query']);_0x418d71['attributes']=_[_0x0ee8('0x2d')](_0x18c535['model'],qs['fields'](_0x56a404[_0x0ee8('0x2e')][_0x0ee8('0x2f')]));_0x418d71[_0x0ee8('0x30')]=_0x418d71[_0x0ee8('0x30')]['length']?_0x418d71[_0x0ee8('0x30')]:_0x18c535[_0x0ee8('0x2c')];if(_0x56a404[_0x0ee8('0x2e')][_0x0ee8('0x3f')]){_0x418d71[_0x0ee8('0x40')]=[{'all':!![]}];}_0x418d71=_[_0x0ee8('0x39')]({},_0x418d71,_0x56a404[_0x0ee8('0x3c')]);return db[_0x0ee8('0x3d')]['find'](_0x418d71)[_0x0ee8('0x23')](handleEntityNotFound(_0x303259,null))['then'](respondWithResult(_0x303259,null))[_0x0ee8('0x42')](handleError(_0x303259,null));};exports[_0x0ee8('0x46')]=function(_0x4fe295,_0x510bff){return db[_0x0ee8('0x3d')][_0x0ee8('0x46')](_0x4fe295['body'],{})['then'](respondWithResult(_0x510bff,0xc9))[_0x0ee8('0x42')](handleError(_0x510bff,null));};exports['update']=function(_0x337f85,_0xa81d66){if(_0x337f85[_0x0ee8('0x47')]['id']){delete _0x337f85[_0x0ee8('0x47')]['id'];}return db[_0x0ee8('0x3d')][_0x0ee8('0x48')]({'where':{'id':_0x337f85[_0x0ee8('0x44')]['id']}})[_0x0ee8('0x23')](handleEntityNotFound(_0xa81d66,null))['then'](saveUpdates(_0x337f85[_0x0ee8('0x47')],null))[_0x0ee8('0x23')](respondWithResult(_0xa81d66,null))[_0x0ee8('0x42')](handleError(_0xa81d66,null));};exports[_0x0ee8('0x24')]=function(_0x2dde4a,_0x3fb8e7){return db['Attachment']['findAll']({'where':{'ChatOfflineMessageId':_0x2dde4a[_0x0ee8('0x44')]['id']},'raw':!![]})[_0x0ee8('0x23')](function(_0x4a954a){_0x4a954a[_0x0ee8('0x49')](function(_0x327457){var _0x4f0969=path[_0x0ee8('0x4a')](config[_0x0ee8('0x4b')],_0x0ee8('0x4c'),_0x0ee8('0x4d'),_0x0ee8('0x4e'),'offline-chat',_0x327457[_0x0ee8('0x4f')]);var _0x4cea25=fs[_0x0ee8('0x50')](_0x4f0969);if(_0x4cea25)fs_extra[_0x0ee8('0x51')](_0x4f0969);});})[_0x0ee8('0x23')](function(){return db[_0x0ee8('0x3d')][_0x0ee8('0x48')]({'where':{'id':_0x2dde4a[_0x0ee8('0x44')]['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x3fb8e7,null))[_0x0ee8('0x23')](removeEntity(_0x3fb8e7,null))[_0x0ee8('0x42')](handleError(_0x3fb8e7,null));};exports[_0x0ee8('0x52')]=function(_0x485aae,_0x149b25){return db[_0x0ee8('0x3d')][_0x0ee8('0x52')]()['then'](respondWithResult(_0x149b25,null))[_0x0ee8('0x42')](handleError(_0x149b25,null));}; \ No newline at end of file +var _0x24c4=['intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','destroy','forEach','join','files','offline-chat','basename','existsSync','remove','describe','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','key','model','keys','query','filters'];(function(_0xe73146,_0x552442){var _0x1e44ae=function(_0x4a8dd1){while(--_0x4a8dd1){_0xe73146['push'](_0xe73146['shift']());}};_0x1e44ae(++_0x552442);}(_0x24c4,0xc1));var _0x424c=function(_0x1fef32,_0x1f0069){_0x1fef32=_0x1fef32-0x0;var _0x411e03=_0x24c4[_0x1fef32];return _0x411e03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x424c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x424c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x424c('0x2'));var Mustache=require(_0x424c('0x3'));var util=require('util');var path=require(_0x424c('0x4'));var sox=require('sox');var csv=require(_0x424c('0x5'));var ejs=require(_0x424c('0x6'));var fs=require('fs');var fs_extra=require(_0x424c('0x7'));var _=require(_0x424c('0x8'));var squel=require(_0x424c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x424c('0xa'));var toCsv=require(_0x424c('0x5'));var querystring=require(_0x424c('0xb'));var Papa=require(_0x424c('0xc'));var Redis=require(_0x424c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x424c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x424c('0xf'));var logger=require(_0x424c('0x10'))('api');var utils=require(_0x424c('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x424c('0x12'))['db'];function respondWithStatusCode(_0xb145,_0x23950e){_0x23950e=_0x23950e||0xcc;return function(_0x440b2a){if(_0x440b2a){return _0xb145[_0x424c('0x13')](_0x23950e);}return _0xb145['status'](_0x23950e)['end']();};}function respondWithResult(_0x524362,_0x205138){_0x205138=_0x205138||0xc8;return function(_0x4693c0){if(_0x4693c0){return _0x524362[_0x424c('0x14')](_0x205138)[_0x424c('0x15')](_0x4693c0);}};}function respondWithFilteredResult(_0x43a4f9,_0x3439ed){return function(_0x2494dd){if(_0x2494dd){var _0xf909f8=typeof _0x3439ed[_0x424c('0x16')]===_0x424c('0x17')&&typeof _0x3439ed['limit']==='undefined';var _0x409041=_0x2494dd[_0x424c('0x18')];var _0x55c93b=_0xf909f8?0x0:_0x3439ed[_0x424c('0x16')];var _0x1e7f81=_0xf909f8?_0x2494dd['count']:_0x3439ed['offset']+_0x3439ed[_0x424c('0x19')];var _0x3e722e;if(_0x1e7f81>=_0x409041){_0x1e7f81=_0x409041;_0x3e722e=0xc8;}else{_0x3e722e=0xce;}_0x43a4f9[_0x424c('0x14')](_0x3e722e);return _0x43a4f9[_0x424c('0x1a')](_0x424c('0x1b'),_0x55c93b+'-'+_0x1e7f81+'/'+_0x409041)['json'](_0x2494dd);}return null;};}function patchUpdates(_0xcaae75){return function(_0x8346d8){try{jsonpatch['apply'](_0x8346d8,_0xcaae75,!![]);}catch(_0x399384){return BPromise[_0x424c('0x1c')](_0x399384);}return _0x8346d8[_0x424c('0x1d')]();};}function saveUpdates(_0x4286ee,_0xc9d71f){return function(_0x2d2ba1){if(_0x2d2ba1){return _0x2d2ba1[_0x424c('0x1e')](_0x4286ee)['then'](function(_0x1f4ff2){return _0x1f4ff2;});}return null;};}function removeEntity(_0x501075,_0x50b39b){return function(_0x3b5c90){if(_0x3b5c90){return _0x3b5c90['destroy']()[_0x424c('0x1f')](function(){_0x501075[_0x424c('0x14')](0xcc)[_0x424c('0x20')]();});}};}function handleEntityNotFound(_0x3aaf4d,_0x21d2c1){return function(_0x35de1c){if(!_0x35de1c){_0x3aaf4d['sendStatus'](0x194);}return _0x35de1c;};}function handleError(_0xaf0aae,_0x18b4e5){_0x18b4e5=_0x18b4e5||0x1f4;return function(_0x20506d){logger[_0x424c('0x21')](_0x20506d[_0x424c('0x22')]);if(_0x20506d[_0x424c('0x23')]){delete _0x20506d['name'];}_0xaf0aae[_0x424c('0x14')](_0x18b4e5)[_0x424c('0x24')](_0x20506d);};}exports[_0x424c('0x25')]=function(_0x102f7c,_0x289f12){var _0x4f5e2d={},_0x4a67d0={},_0x215e44={'count':0x0,'rows':[]};var _0x5df171=_[_0x424c('0x26')](db[_0x424c('0x27')][_0x424c('0x28')],function(_0x44ae0b){return{'name':_0x44ae0b[_0x424c('0x29')],'type':_0x44ae0b['type'][_0x424c('0x2a')]};});_0x4a67d0[_0x424c('0x2b')]=_[_0x424c('0x26')](_0x5df171,'name');_0x4a67d0['query']=_[_0x424c('0x2c')](_0x102f7c[_0x424c('0x2d')]);_0x4a67d0[_0x424c('0x2e')]=_[_0x424c('0x2f')](_0x4a67d0[_0x424c('0x2b')],_0x4a67d0['query']);_0x4f5e2d[_0x424c('0x30')]=_['intersection'](_0x4a67d0[_0x424c('0x2b')],qs['fields'](_0x102f7c[_0x424c('0x2d')]['fields']));_0x4f5e2d[_0x424c('0x30')]=_0x4f5e2d['attributes'][_0x424c('0x31')]?_0x4f5e2d[_0x424c('0x30')]:_0x4a67d0[_0x424c('0x2b')];if(!_0x102f7c['query'][_0x424c('0x32')](_0x424c('0x33'))){_0x4f5e2d[_0x424c('0x19')]=qs[_0x424c('0x19')](_0x102f7c[_0x424c('0x2d')][_0x424c('0x19')]);_0x4f5e2d[_0x424c('0x16')]=qs[_0x424c('0x16')](_0x102f7c[_0x424c('0x2d')][_0x424c('0x16')]);}_0x4f5e2d['order']=qs['sort'](_0x102f7c['query'][_0x424c('0x34')]);_0x4f5e2d[_0x424c('0x35')]=qs[_0x424c('0x2e')](_[_0x424c('0x36')](_0x102f7c[_0x424c('0x2d')],_0x4a67d0[_0x424c('0x2e')]),_0x5df171);if(_0x102f7c['query'][_0x424c('0x37')]){_0x4f5e2d[_0x424c('0x35')]=_[_0x424c('0x38')](_0x4f5e2d['where'],{'$or':_[_0x424c('0x26')](_0x5df171,function(_0x2b8261){if(_0x2b8261[_0x424c('0x39')]!==_0x424c('0x3a')){var _0x484cd1={};_0x484cd1[_0x2b8261['name']]={'$like':'%'+_0x102f7c[_0x424c('0x2d')][_0x424c('0x37')]+'%'};return _0x484cd1;}})});}_0x4f5e2d=_[_0x424c('0x38')]({},_0x4f5e2d,_0x102f7c[_0x424c('0x3b')]);var _0x53082e={'where':_0x4f5e2d['where']};return db[_0x424c('0x27')][_0x424c('0x18')](_0x53082e)[_0x424c('0x1f')](function(_0x199c6a){_0x215e44['count']=_0x199c6a;if(_0x102f7c[_0x424c('0x2d')][_0x424c('0x3c')]){_0x4f5e2d[_0x424c('0x3d')]=[{'all':!![]}];}return db[_0x424c('0x27')][_0x424c('0x3e')](_0x4f5e2d);})[_0x424c('0x1f')](function(_0x344f4b){_0x215e44[_0x424c('0x3f')]=_0x344f4b;return _0x215e44;})['then'](respondWithFilteredResult(_0x289f12,_0x4f5e2d))[_0x424c('0x40')](handleError(_0x289f12,null));};exports[_0x424c('0x41')]=function(_0x5d6202,_0x1e1be3){var _0x37b7d8={'raw':!![],'where':{'id':_0x5d6202[_0x424c('0x42')]['id']}},_0x2ce1ff={};_0x2ce1ff[_0x424c('0x2b')]=_[_0x424c('0x2c')](db[_0x424c('0x27')][_0x424c('0x28')]);_0x2ce1ff[_0x424c('0x2d')]=_[_0x424c('0x2c')](_0x5d6202[_0x424c('0x2d')]);_0x2ce1ff[_0x424c('0x2e')]=_[_0x424c('0x2f')](_0x2ce1ff[_0x424c('0x2b')],_0x2ce1ff['query']);_0x37b7d8[_0x424c('0x30')]=_['intersection'](_0x2ce1ff[_0x424c('0x2b')],qs['fields'](_0x5d6202[_0x424c('0x2d')][_0x424c('0x43')]));_0x37b7d8[_0x424c('0x30')]=_0x37b7d8[_0x424c('0x30')][_0x424c('0x31')]?_0x37b7d8[_0x424c('0x30')]:_0x2ce1ff[_0x424c('0x2b')];if(_0x5d6202[_0x424c('0x2d')][_0x424c('0x3c')]){_0x37b7d8[_0x424c('0x3d')]=[{'all':!![]}];}_0x37b7d8=_['merge']({},_0x37b7d8,_0x5d6202['options']);return db[_0x424c('0x27')][_0x424c('0x44')](_0x37b7d8)[_0x424c('0x1f')](handleEntityNotFound(_0x1e1be3,null))[_0x424c('0x1f')](respondWithResult(_0x1e1be3,null))[_0x424c('0x40')](handleError(_0x1e1be3,null));};exports[_0x424c('0x45')]=function(_0x29f20e,_0x6cacc4){return db[_0x424c('0x27')][_0x424c('0x45')](_0x29f20e[_0x424c('0x46')],{})[_0x424c('0x1f')](respondWithResult(_0x6cacc4,0xc9))[_0x424c('0x40')](handleError(_0x6cacc4,null));};exports[_0x424c('0x1e')]=function(_0x1c84c0,_0x2c8926){if(_0x1c84c0['body']['id']){delete _0x1c84c0['body']['id'];}return db[_0x424c('0x27')]['find']({'where':{'id':_0x1c84c0[_0x424c('0x42')]['id']}})[_0x424c('0x1f')](handleEntityNotFound(_0x2c8926,null))[_0x424c('0x1f')](saveUpdates(_0x1c84c0[_0x424c('0x46')],null))['then'](respondWithResult(_0x2c8926,null))[_0x424c('0x40')](handleError(_0x2c8926,null));};exports[_0x424c('0x47')]=function(_0x576b2d,_0x576223){return db['Attachment']['findAll']({'where':{'ChatOfflineMessageId':_0x576b2d[_0x424c('0x42')]['id']},'raw':!![]})[_0x424c('0x1f')](function(_0x4c0e54){_0x4c0e54[_0x424c('0x48')](function(_0x6322ba){var _0x411ace=path[_0x424c('0x49')](config['root'],'server',_0x424c('0x4a'),'attachments',_0x424c('0x4b'),_0x6322ba[_0x424c('0x4c')]);var _0x3aa5b3=fs[_0x424c('0x4d')](_0x411ace);if(_0x3aa5b3)fs_extra[_0x424c('0x4e')](_0x411ace);});})[_0x424c('0x1f')](function(){return db['ChatOfflineMessage'][_0x424c('0x44')]({'where':{'id':_0x576b2d[_0x424c('0x42')]['id']},'individualHooks':!![]});})[_0x424c('0x1f')](handleEntityNotFound(_0x576223,null))[_0x424c('0x1f')](removeEntity(_0x576223,null))[_0x424c('0x40')](handleError(_0x576223,null));};exports[_0x424c('0x4f')]=function(_0x5759c3,_0x31f51f){return db[_0x424c('0x27')][_0x424c('0x4f')]()[_0x424c('0x1f')](respondWithResult(_0x31f51f,null))['catch'](handleError(_0x31f51f,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4fc5fbe..bbc750b 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 _0xb66c=['rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xb66c,0x175));var _0xcb66=function(_0x85cf5c,_0x126429){_0x85cf5c=_0x85cf5c-0x0;var _0xaf04db=_0xb66c[_0x85cf5c];return _0xaf04db;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb66('0xc'),'collate':_0xcb66('0xd')});}; \ No newline at end of file +var _0x22fb=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x48a441,_0x1c4546){var _0x42d672=function(_0x25b336){while(--_0x25b336){_0x48a441['push'](_0x48a441['shift']());}};_0x42d672(++_0x1c4546);}(_0x22fb,0x192));var _0xb22f=function(_0x73ccc,_0x1d061c){_0x73ccc=_0x73ccc-0x0;var _0xa76c32=_0x22fb[_0x73ccc];return _0xa76c32;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb22f('0xa'),'collate':_0xb22f('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 5723e0e..dc3d93a 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 _0x28bc=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2a6d76,_0x4ab61c){var _0x20a712=function(_0x9b6de){while(--_0x9b6de){_0x2a6d76['push'](_0x2a6d76['shift']());}};_0x20a712(++_0x4ab61c);}(_0x28bc,0x97));var _0xc28b=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x28bc[_0x34eb31];return _0x254994;};'use strict';var _=require(_0xc28b('0x0'));var util=require(_0xc28b('0x1'));var moment=require(_0xc28b('0x2'));var BPromise=require(_0xc28b('0x3'));var rs=require(_0xc28b('0x4'));var fs=require('fs');var Redis=require(_0xc28b('0x5'));var db=require(_0xc28b('0x6'))['db'];var utils=require(_0xc28b('0x7'));var logger=require('../../config/logger')(_0xc28b('0x8'));var config=require(_0xc28b('0x9'));var jayson=require(_0xc28b('0xa'));var client=jayson['client'][_0xc28b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55b12d,_0x2d91e5,_0x3543f2){return new BPromise(function(_0x1e573b,_0x112534){return client[_0xc28b('0xc')](_0x55b12d,_0x3543f2)['then'](function(_0x42f71a){logger[_0xc28b('0xd')](_0xc28b('0xe'),_0x2d91e5,_0xc28b('0xf'));logger[_0xc28b('0x10')](_0xc28b('0x11'),_0x2d91e5,'request\x20sent',JSON[_0xc28b('0x12')](_0x42f71a));if(_0x42f71a[_0xc28b('0x13')]){if(_0x42f71a[_0xc28b('0x13')][_0xc28b('0x14')]===0x1f4){logger[_0xc28b('0x13')](_0xc28b('0xe'),_0x2d91e5,_0x42f71a['error'][_0xc28b('0x15')]);return _0x112534(_0x42f71a[_0xc28b('0x13')][_0xc28b('0x15')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2d91e5,_0x42f71a['error']['message']);return _0x1e573b(_0x42f71a[_0xc28b('0x13')][_0xc28b('0x15')]);}else{logger[_0xc28b('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d91e5,_0xc28b('0xf'));_0x1e573b(_0x42f71a[_0xc28b('0x16')][_0xc28b('0x15')]);}})[_0xc28b('0x17')](function(_0x2fcf6e){logger[_0xc28b('0x13')](_0xc28b('0xe'),_0x2d91e5,_0x2fcf6e);_0x112534(_0x2fcf6e);});});} \ No newline at end of file +var _0x8c4d=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x175ac0,_0x724739){var _0x4f2eb4=function(_0x49299a){while(--_0x49299a){_0x175ac0['push'](_0x175ac0['shift']());}};_0x4f2eb4(++_0x724739);}(_0x8c4d,0xcf));var _0xd8c4=function(_0xa09242,_0x13dfdc){_0xa09242=_0xa09242-0x0;var _0x411cd0=_0x8c4d[_0xa09242];return _0x411cd0;};'use strict';var _=require(_0xd8c4('0x0'));var util=require(_0xd8c4('0x1'));var moment=require('moment');var BPromise=require(_0xd8c4('0x2'));var rs=require(_0xd8c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd8c4('0x4'))(_0xd8c4('0x5'));var config=require(_0xd8c4('0x6'));var jayson=require(_0xd8c4('0x7'));var client=jayson[_0xd8c4('0x8')][_0xd8c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52a461,_0x45d2d1,_0x9929b4){return new BPromise(function(_0x812cce,_0x1e2194){return client[_0xd8c4('0xa')](_0x52a461,_0x9929b4)[_0xd8c4('0xb')](function(_0x2826e4){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x45d2d1,_0xd8c4('0xc'));logger[_0xd8c4('0xd')](_0xd8c4('0xe'),_0x45d2d1,_0xd8c4('0xc'),JSON[_0xd8c4('0xf')](_0x2826e4));if(_0x2826e4[_0xd8c4('0x10')]){if(_0x2826e4[_0xd8c4('0x10')]['code']===0x1f4){logger[_0xd8c4('0x10')](_0xd8c4('0x11'),_0x45d2d1,_0x2826e4[_0xd8c4('0x10')]['message']);return _0x1e2194(_0x2826e4[_0xd8c4('0x10')][_0xd8c4('0x12')]);}logger[_0xd8c4('0x10')](_0xd8c4('0x11'),_0x45d2d1,_0x2826e4['error'][_0xd8c4('0x12')]);return _0x812cce(_0x2826e4[_0xd8c4('0x10')][_0xd8c4('0x12')]);}else{logger[_0xd8c4('0x13')](_0xd8c4('0x11'),_0x45d2d1,_0xd8c4('0xc'));_0x812cce(_0x2826e4[_0xd8c4('0x14')][_0xd8c4('0x12')]);}})[_0xd8c4('0x15')](function(_0x5c0a4c){logger[_0xd8c4('0x10')](_0xd8c4('0x11'),_0x45d2d1,_0x5c0a4c);_0x1e2194(_0x5c0a4c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 1a2bea3..bebbd2e 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 _0x8b59=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8b59,0x1dd));var _0x98b5=function(_0x38dc61,_0x5a6b7c){_0x38dc61=_0x38dc61-0x0;var _0x1a318d=_0x8b59[_0x38dc61];return _0x1a318d;};'use strict';var multer=require(_0x98b5('0x0'));var util=require(_0x98b5('0x1'));var path=require(_0x98b5('0x2'));var timeout=require(_0x98b5('0x3'));var express=require(_0x98b5('0x4'));var router=express[_0x98b5('0x5')]();var fs_extra=require(_0x98b5('0x6'));var auth=require(_0x98b5('0x7'));var interaction=require(_0x98b5('0x8'));var config=require(_0x98b5('0x9'));var controller=require(_0x98b5('0xa'));router['get']('/',auth[_0x98b5('0xb')](),controller[_0x98b5('0xc')]);router['get'](_0x98b5('0xd'),auth[_0x98b5('0xb')](),controller['describe']);router['get'](_0x98b5('0xe'),auth[_0x98b5('0xb')](),controller[_0x98b5('0xf')]);router[_0x98b5('0x10')]('/',auth['isAuthenticated'](),controller[_0x98b5('0x11')]);router['put'](_0x98b5('0xe'),auth[_0x98b5('0xb')](),controller[_0x98b5('0x12')]);router[_0x98b5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x98b5('0x14')]);module[_0x98b5('0x15')]=router; \ No newline at end of file +var _0x460a=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller'];(function(_0x48ec03,_0x465346){var _0x2839c4=function(_0x4fbf8d){while(--_0x4fbf8d){_0x48ec03['push'](_0x48ec03['shift']());}};_0x2839c4(++_0x465346);}(_0x460a,0x10f));var _0xa460=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0x460a[_0x350258];return _0x3714b3;};'use strict';var multer=require('multer');var util=require(_0xa460('0x0'));var path=require(_0xa460('0x1'));var timeout=require(_0xa460('0x2'));var express=require(_0xa460('0x3'));var router=express[_0xa460('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa460('0x5'));var interaction=require(_0xa460('0x6'));var config=require(_0xa460('0x7'));var controller=require(_0xa460('0x8'));router[_0xa460('0x9')]('/',auth[_0xa460('0xa')](),controller['index']);router['get']('/describe',auth[_0xa460('0xa')](),controller['describe']);router[_0xa460('0x9')](_0xa460('0xb'),auth[_0xa460('0xa')](),controller[_0xa460('0xc')]);router[_0xa460('0xd')]('/',auth['isAuthenticated'](),controller[_0xa460('0xe')]);router[_0xa460('0xf')](_0xa460('0xb'),auth['isAuthenticated'](),controller[_0xa460('0x10')]);router[_0xa460('0x11')](_0xa460('0xb'),auth[_0xa460('0xa')](),controller[_0xa460('0x12')]);module[_0xa460('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 72b8c34..bf5ba70 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 _0x6867=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM','timeout'];(function(_0x171bef,_0x4cba08){var _0x28828a=function(_0x19d85c){while(--_0x19d85c){_0x171bef['push'](_0x171bef['shift']());}};_0x28828a(++_0x4cba08);}(_0x6867,0x167));var _0x7686=function(_0x36d1af,_0x38cc9a){_0x36d1af=_0x36d1af-0x0;var _0x476db9=_0x6867[_0x36d1af];return _0x476db9;};'use strict';var Sequelize=require(_0x7686('0x0'));module[_0x7686('0x1')]={'name':{'type':Sequelize[_0x7686('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7686('0x3')]('mouseOver',_0x7686('0x4')),'defaultValue':_0x7686('0x5')},'selector':{'type':Sequelize[_0x7686('0x2')]},'timeout':{'type':Sequelize[_0x7686('0x6')]}}; \ No newline at end of file +var _0xbc76=['STRING','ENUM','mouseOver','INTEGER','sequelize'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0xbc76,0x86));var _0x6bc7=function(_0x8364b7,_0x5c8b1d){_0x8364b7=_0x8364b7-0x0;var _0x21960f=_0xbc76[_0x8364b7];return _0x21960f;};'use strict';var Sequelize=require(_0x6bc7('0x0'));module['exports']={'name':{'type':Sequelize[_0x6bc7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6bc7('0x2')](_0x6bc7('0x3'),'timeout'),'defaultValue':_0x6bc7('0x3')},'selector':{'type':Sequelize[_0x6bc7('0x1')]},'timeout':{'type':Sequelize[_0x6bc7('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c77fdea..6cdb20e 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 _0xb10b=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','show','params','model','keys','rawAttributes','filters','intersection','query','fields','attributes','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x23642f,_0x2c6953){var _0x20e1b6=function(_0x5f2079){while(--_0x5f2079){_0x23642f['push'](_0x23642f['shift']());}};_0x20e1b6(++_0x2c6953);}(_0xb10b,0x12a));var _0xbb10=function(_0x47c902,_0x220fd2){_0x47c902=_0x47c902-0x0;var _0x1ad6a0=_0xb10b[_0x47c902];return _0x1ad6a0;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={'raw':!![],'where':{'id':_0x4aabb9[_0xbb10('0x2b')]['id']}},_0xfc3595={};_0xfc3595[_0xbb10('0x2c')]=_[_0xbb10('0x2d')](db['ChatProactiveAction'][_0xbb10('0x2e')]);_0xfc3595['query']=_[_0xbb10('0x2d')](_0x4aabb9['query']);_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0xfc3595[_0xbb10('0x2c')],_0xfc3595['query']);_0x21ac54['attributes']=_[_0xbb10('0x30')](_0xfc3595[_0xbb10('0x2c')],qs['fields'](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x32')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x34')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2c')];if(_0x4aabb9['query'][_0xbb10('0x35')]){_0x21ac54[_0xbb10('0x36')]=[{'all':!![]}];}_0x21ac54=_[_0xbb10('0x37')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x38')]);return db[_0xbb10('0x39')][_0xbb10('0x3a')](_0x21ac54)[_0xbb10('0x23')](handleEntityNotFound(_0x3796c7,null))[_0xbb10('0x23')](respondWithResult(_0x3796c7,null))[_0xbb10('0x3b')](handleError(_0x3796c7,null));};exports['create']=function(_0x2b5352,_0x150107){return db[_0xbb10('0x39')][_0xbb10('0x3c')](_0x2b5352['body'],{})[_0xbb10('0x23')](respondWithResult(_0x150107,0xc9))['catch'](handleError(_0x150107,null));};exports['update']=function(_0x3eb3cc,_0x40c164){if(_0x3eb3cc[_0xbb10('0x3d')]['id']){delete _0x3eb3cc[_0xbb10('0x3d')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x3a')]({'where':{'id':_0x3eb3cc['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x40c164,null))[_0xbb10('0x23')](saveUpdates(_0x3eb3cc['body'],null))['then'](respondWithResult(_0x40c164,null))['catch'](handleError(_0x40c164,null));};exports[_0xbb10('0x24')]=function(_0x2b0b45,_0x2b658a){return db['ChatProactiveAction'][_0xbb10('0x3a')]({'where':{'id':_0x2b0b45[_0xbb10('0x2b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x2b658a,null))['then'](removeEntity(_0x2b658a,null))[_0xbb10('0x3b')](handleError(_0x2b658a,null));}; \ No newline at end of file +var _0xb10b=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','show','params','model','keys','rawAttributes','filters','intersection','query','fields','attributes','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x4aee55,_0x27bc5e){var _0x140c00=function(_0x39a5a5){while(--_0x39a5a5){_0x4aee55['push'](_0x4aee55['shift']());}};_0x140c00(++_0x27bc5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x33a73b,_0x2d367f){_0x33a73b=_0x33a73b-0x0;var _0x30527e=_0xb10b[_0x33a73b];return _0x30527e;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={'raw':!![],'where':{'id':_0x4aabb9[_0xbb10('0x2b')]['id']}},_0xfc3595={};_0xfc3595[_0xbb10('0x2c')]=_[_0xbb10('0x2d')](db['ChatProactiveAction'][_0xbb10('0x2e')]);_0xfc3595['query']=_[_0xbb10('0x2d')](_0x4aabb9['query']);_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0xfc3595[_0xbb10('0x2c')],_0xfc3595['query']);_0x21ac54['attributes']=_[_0xbb10('0x30')](_0xfc3595[_0xbb10('0x2c')],qs['fields'](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x32')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x34')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2c')];if(_0x4aabb9['query'][_0xbb10('0x35')]){_0x21ac54[_0xbb10('0x36')]=[{'all':!![]}];}_0x21ac54=_[_0xbb10('0x37')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x38')]);return db[_0xbb10('0x39')][_0xbb10('0x3a')](_0x21ac54)[_0xbb10('0x23')](handleEntityNotFound(_0x3796c7,null))[_0xbb10('0x23')](respondWithResult(_0x3796c7,null))[_0xbb10('0x3b')](handleError(_0x3796c7,null));};exports['create']=function(_0x2b5352,_0x150107){return db[_0xbb10('0x39')][_0xbb10('0x3c')](_0x2b5352['body'],{})[_0xbb10('0x23')](respondWithResult(_0x150107,0xc9))['catch'](handleError(_0x150107,null));};exports['update']=function(_0x3eb3cc,_0x40c164){if(_0x3eb3cc[_0xbb10('0x3d')]['id']){delete _0x3eb3cc[_0xbb10('0x3d')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x3a')]({'where':{'id':_0x3eb3cc['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x40c164,null))[_0xbb10('0x23')](saveUpdates(_0x3eb3cc['body'],null))['then'](respondWithResult(_0x40c164,null))['catch'](handleError(_0x40c164,null));};exports[_0xbb10('0x24')]=function(_0x2b0b45,_0x2b658a){return db['ChatProactiveAction'][_0xbb10('0x3a')]({'where':{'id':_0x2b0b45[_0xbb10('0x2b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x2b658a,null))['then'](removeEntity(_0x2b658a,null))[_0xbb10('0x3b')](handleError(_0x2b658a,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 5e1256c..65939ea 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 _0x9d8f=['lodash','util','../../config/logger','api','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','chat_proactive_actions'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x9d8f,0x1e6));var _0xf9d8=function(_0x2664da,_0x3ce139){_0x2664da=_0x2664da-0x0;var _0x541f04=_0x9d8f[_0x2664da];return _0x541f04;};'use strict';var _=require(_0xf9d8('0x0'));var util=require(_0xf9d8('0x1'));var logger=require(_0xf9d8('0x2'))(_0xf9d8('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(_0xf9d8('0x4'));var config=require(_0xf9d8('0x5'));var attributes=require(_0xf9d8('0x6'));module[_0xf9d8('0x7')]=function(_0x185b58,_0x2d71a5){return _0x185b58['define']('ChatProactiveAction',attributes,{'tableName':_0xf9d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31cc=['bluebird','path','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x162246,_0x4e5038){var _0x32ac95=function(_0x22270b){while(--_0x22270b){_0x162246['push'](_0x162246['shift']());}};_0x32ac95(++_0x4e5038);}(_0x31cc,0x19f));var _0xc31c=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x31cc[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xc31c('0x0'));var util=require(_0xc31c('0x1'));var logger=require(_0xc31c('0x2'))(_0xc31c('0x3'));var moment=require(_0xc31c('0x4'));var BPromise=require(_0xc31c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc31c('0x6'));var rimraf=require('rimraf');var config=require(_0xc31c('0x7'));var attributes=require(_0xc31c('0x8'));module[_0xc31c('0x9')]=function(_0x55e5bf,_0x1f7146){return _0x55e5bf['define'](_0xc31c('0xa'),attributes,{'tableName':_0xc31c('0xb'),'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 acfb506..a9442f4 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 _0xa213=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result'];(function(_0x5a30d0,_0x205574){var _0x415371=function(_0xcea570){while(--_0xcea570){_0x5a30d0['push'](_0x5a30d0['shift']());}};_0x415371(++_0x205574);}(_0xa213,0x1a3));var _0x3a21=function(_0x48ab64,_0xc30f22){_0x48ab64=_0x48ab64-0x0;var _0x40e1dc=_0xa213[_0x48ab64];return _0x40e1dc;};'use strict';var _=require(_0x3a21('0x0'));var util=require(_0x3a21('0x1'));var moment=require(_0x3a21('0x2'));var BPromise=require(_0x3a21('0x3'));var rs=require(_0x3a21('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a21('0x5'))['db'];var utils=require(_0x3a21('0x6'));var logger=require(_0x3a21('0x7'))(_0x3a21('0x8'));var config=require(_0x3a21('0x9'));var jayson=require(_0x3a21('0xa'));var client=jayson['client'][_0x3a21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x94f61b,_0x143fe9,_0x106e0e){return new BPromise(function(_0x32820e,_0x19d428){return client['request'](_0x94f61b,_0x106e0e)['then'](function(_0x60335a){logger[_0x3a21('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x143fe9,_0x3a21('0xd'));logger['debug'](_0x3a21('0xe'),_0x143fe9,_0x3a21('0xd'),JSON[_0x3a21('0xf')](_0x60335a));if(_0x60335a[_0x3a21('0x10')]){if(_0x60335a[_0x3a21('0x10')][_0x3a21('0x11')]===0x1f4){logger[_0x3a21('0x10')](_0x3a21('0x12'),_0x143fe9,_0x60335a[_0x3a21('0x10')][_0x3a21('0x13')]);return _0x19d428(_0x60335a[_0x3a21('0x10')][_0x3a21('0x13')]);}logger[_0x3a21('0x10')](_0x3a21('0x12'),_0x143fe9,_0x60335a[_0x3a21('0x10')][_0x3a21('0x13')]);return _0x32820e(_0x60335a[_0x3a21('0x10')][_0x3a21('0x13')]);}else{logger['info'](_0x3a21('0x12'),_0x143fe9,_0x3a21('0xd'));_0x32820e(_0x60335a[_0x3a21('0x14')]['message']);}})[_0x3a21('0x15')](function(_0x4bfab5){logger[_0x3a21('0x10')](_0x3a21('0x12'),_0x143fe9,_0x4bfab5);_0x19d428(_0x4bfab5);});});} \ No newline at end of file +var _0xf510=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x194adf,_0x220258){var _0x2242e3=function(_0x42afcd){while(--_0x42afcd){_0x194adf['push'](_0x194adf['shift']());}};_0x2242e3(++_0x220258);}(_0xf510,0xde));var _0x0f51=function(_0xe8ffd,_0x2954b2){_0xe8ffd=_0xe8ffd-0x0;var _0x59d496=_0xf510[_0xe8ffd];return _0x59d496;};'use strict';var _=require(_0x0f51('0x0'));var util=require(_0x0f51('0x1'));var moment=require('moment');var BPromise=require(_0x0f51('0x2'));var rs=require(_0x0f51('0x3'));var fs=require('fs');var Redis=require(_0x0f51('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f51('0x5'))('rpc');var config=require(_0x0f51('0x6'));var jayson=require(_0x0f51('0x7'));var client=jayson[_0x0f51('0x8')][_0x0f51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44b641,_0x2ba47f,_0x391b83){return new BPromise(function(_0x3ac169,_0x50f061){return client[_0x0f51('0xa')](_0x44b641,_0x391b83)[_0x0f51('0xb')](function(_0x125d11){logger[_0x0f51('0xc')](_0x0f51('0xd'),_0x2ba47f,_0x0f51('0xe'));logger[_0x0f51('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2ba47f,_0x0f51('0xe'),JSON[_0x0f51('0x10')](_0x125d11));if(_0x125d11[_0x0f51('0x11')]){if(_0x125d11[_0x0f51('0x11')]['code']===0x1f4){logger[_0x0f51('0x11')](_0x0f51('0xd'),_0x2ba47f,_0x125d11[_0x0f51('0x11')][_0x0f51('0x12')]);return _0x50f061(_0x125d11[_0x0f51('0x11')]['message']);}logger['error'](_0x0f51('0xd'),_0x2ba47f,_0x125d11[_0x0f51('0x11')]['message']);return _0x3ac169(_0x125d11['error'][_0x0f51('0x12')]);}else{logger[_0x0f51('0xc')](_0x0f51('0xd'),_0x2ba47f,'request\x20sent');_0x3ac169(_0x125d11[_0x0f51('0x13')][_0x0f51('0x12')]);}})[_0x0f51('0x14')](function(_0x5df7dc){logger[_0x0f51('0x11')](_0x0f51('0xd'),_0x2ba47f,_0x5df7dc);_0x50f061(_0x5df7dc);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 60c694a..a84c588 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 _0x0ef8=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0x0ef8,0x10b));var _0x80ef=function(_0x5c43f0,_0x8f72ed){_0x5c43f0=_0x5c43f0-0x0;var _0x2ccbad=_0x0ef8[_0x5c43f0];return _0x2ccbad;};'use strict';var multer=require(_0x80ef('0x0'));var util=require('util');var path=require(_0x80ef('0x1'));var timeout=require(_0x80ef('0x2'));var express=require('express');var router=express[_0x80ef('0x3')]();var fs_extra=require(_0x80ef('0x4'));var auth=require(_0x80ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x80ef('0x6'));var controller=require(_0x80ef('0x7'));router[_0x80ef('0x8')](_0x80ef('0x9'),auth[_0x80ef('0xa')](),controller[_0x80ef('0xb')]);router[_0x80ef('0xc')]('/',auth[_0x80ef('0xa')](),controller[_0x80ef('0xd')]);router[_0x80ef('0xe')]('/:id',auth[_0x80ef('0xa')](),controller[_0x80ef('0xf')]);router[_0x80ef('0x10')](_0x80ef('0x9'),auth['isAuthenticated'](),controller[_0x80ef('0x11')]);module[_0x80ef('0x12')]=router; \ No newline at end of file +var _0x2040=['show','post','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x3d2cb6,_0x415623){var _0xc09226=function(_0x2a2f08){while(--_0x2a2f08){_0x3d2cb6['push'](_0x3d2cb6['shift']());}};_0xc09226(++_0x415623);}(_0x2040,0x1b8));var _0x0204=function(_0x1c557a,_0x554e3b){_0x1c557a=_0x1c557a-0x0;var _0x30fc54=_0x2040[_0x1c557a];return _0x30fc54;};'use strict';var multer=require('multer');var util=require(_0x0204('0x0'));var path=require('path');var timeout=require(_0x0204('0x1'));var express=require(_0x0204('0x2'));var router=express[_0x0204('0x3')]();var fs_extra=require(_0x0204('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0204('0x5'));var config=require(_0x0204('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x0204('0x7')](_0x0204('0x8'),auth[_0x0204('0x9')](),controller[_0x0204('0xa')]);router[_0x0204('0xb')]('/',auth[_0x0204('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0204('0xc')]);router[_0x0204('0xd')](_0x0204('0x8'),auth[_0x0204('0x9')](),controller[_0x0204('0xe')]);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 5f98f72..7d1f244 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 _0xcd00=['exports','STRING','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x562c6c,_0x4321f9){var _0x2d69f0=function(_0x17cbb3){while(--_0x17cbb3){_0x562c6c['push'](_0x562c6c['shift']());}};_0x2d69f0(++_0x4321f9);}(_0xcd00,0x109));var _0x0cd0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcd00[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x0cd0('0x0'));module[_0x0cd0('0x1')]={'name':{'type':Sequelize[_0x0cd0('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0cd0('0x3')](_0x0cd0('0x4'),_0x0cd0('0x5'),_0x0cd0('0x6'))}}; \ No newline at end of file +var _0xd581=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd581,0xaf));var _0x1d58=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xd581[_0x44946b];return _0x249bc4;};'use strict';var Sequelize=require(_0x1d58('0x0'));module[_0x1d58('0x1')]={'name':{'type':Sequelize[_0x1d58('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1d58('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1d58('0x4')](_0x1d58('0x5'),'beepall',_0x1d58('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 44b22d0..b75d3a5 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 _0xe0e8=['model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','show','params','keys','ChatQueue','includeAll','include','create','user','get','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','order','ChatQueueId','UserChatQueue','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','emit','userChatQueue:save','removeTeams','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','all','union','value','transaction','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','reject','save','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','query','intersection'];(function(_0x27c0f8,_0xd1bd2f){var _0x426b4e=function(_0x1d3f4b){while(--_0x1d3f4b){_0x27c0f8['push'](_0x27c0f8['shift']());}};_0x426b4e(++_0xd1bd2f);}(_0xe0e8,0xe9));var _0x8e0e=function(_0x28fe8c,_0xe91932){_0x28fe8c=_0x28fe8c-0x0;var _0x39285a=_0xe0e8[_0x28fe8c];return _0x39285a;};'use strict';var emlformat=require(_0x8e0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e0e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e0e('0x2'));var moment=require(_0x8e0e('0x3'));var BPromise=require(_0x8e0e('0x4'));var Mustache=require('mustache');var util=require(_0x8e0e('0x5'));var path=require(_0x8e0e('0x6'));var sox=require(_0x8e0e('0x7'));var csv=require(_0x8e0e('0x8'));var ejs=require(_0x8e0e('0x9'));var fs=require('fs');var fs_extra=require(_0x8e0e('0xa'));var _=require(_0x8e0e('0xb'));var squel=require('squel');var crypto=require(_0x8e0e('0xc'));var jsforce=require(_0x8e0e('0xd'));var deskjs=require(_0x8e0e('0xe'));var toCsv=require(_0x8e0e('0x8'));var querystring=require('querystring');var Papa=require(_0x8e0e('0xf'));var Redis=require(_0x8e0e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8e0e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e0e('0x12'));var logger=require(_0x8e0e('0x13'))(_0x8e0e('0x14'));var utils=require('../../config/utils');var config=require(_0x8e0e('0x15'));var licenseUtil=require(_0x8e0e('0x16'));var db=require(_0x8e0e('0x17'))['db'];config[_0x8e0e('0x18')]=_[_0x8e0e('0x19')](config[_0x8e0e('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e0e('0x1a'))(new Redis(config[_0x8e0e('0x18')]));require(_0x8e0e('0x1b'))['register'](socket);var jayson=require(_0x8e0e('0x1c'));var client=jayson[_0x8e0e('0x1d')][_0x8e0e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x15b1b0,_0x52c5d0,_0x3a994c,_0x3b4f40){return new BPromise(function(_0x387a12,_0x136160){var _0x12b59e=_0x3b4f40||client;return _0x12b59e[_0x8e0e('0x1f')](_0x15b1b0,_0x3a994c)[_0x8e0e('0x20')](function(_0x39fde6){logger[_0x8e0e('0x21')](_0x8e0e('0x22'),_0x52c5d0,_0x8e0e('0x23'));logger[_0x8e0e('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x52c5d0,_0x8e0e('0x23'),JSON['stringify'](_0x39fde6));if(_0x39fde6['error']){if(_0x39fde6[_0x8e0e('0x25')][_0x8e0e('0x26')]===0x1f4){logger[_0x8e0e('0x25')]('ChatQueue,\x20%s,\x20%s',_0x52c5d0,_0x39fde6[_0x8e0e('0x25')][_0x8e0e('0x27')]);return _0x136160(_0x39fde6[_0x8e0e('0x25')][_0x8e0e('0x27')]);}logger[_0x8e0e('0x25')](_0x8e0e('0x22'),_0x52c5d0,_0x39fde6[_0x8e0e('0x25')][_0x8e0e('0x27')]);return _0x387a12(_0x39fde6[_0x8e0e('0x25')][_0x8e0e('0x27')]);}else{logger[_0x8e0e('0x21')](_0x8e0e('0x22'),_0x52c5d0,_0x8e0e('0x23'));_0x387a12(_0x39fde6[_0x8e0e('0x28')][_0x8e0e('0x27')]);}})[_0x8e0e('0x29')](function(_0x5c7505){logger[_0x8e0e('0x25')]('ChatQueue,\x20%s,\x20%s',_0x52c5d0,_0x5c7505);_0x136160(_0x5c7505);});});}function respondWithStatusCode(_0x11e599,_0x103c9d){_0x103c9d=_0x103c9d||0xcc;return function(_0x163f91){if(_0x163f91){return _0x11e599['sendStatus'](_0x103c9d);}return _0x11e599[_0x8e0e('0x2a')](_0x103c9d)['end']();};}function respondWithResult(_0x4e765d,_0xf9f0ee){_0xf9f0ee=_0xf9f0ee||0xc8;return function(_0x1c7e2a){if(_0x1c7e2a){return _0x4e765d[_0x8e0e('0x2a')](_0xf9f0ee)[_0x8e0e('0x2b')](_0x1c7e2a);}};}function respondWithFilteredResult(_0x2a02e3,_0x19505c){return function(_0x44b895){if(_0x44b895){var _0x5e7f4d=typeof _0x19505c[_0x8e0e('0x2c')]==='undefined'&&typeof _0x19505c[_0x8e0e('0x2d')]===_0x8e0e('0x2e');var _0x968655=_0x44b895[_0x8e0e('0x2f')];var _0x3a4eb0=_0x5e7f4d?0x0:_0x19505c[_0x8e0e('0x2c')];var _0x443080=_0x5e7f4d?_0x44b895[_0x8e0e('0x2f')]:_0x19505c[_0x8e0e('0x2c')]+_0x19505c[_0x8e0e('0x2d')];var _0x333b00;if(_0x443080>=_0x968655){_0x443080=_0x968655;_0x333b00=0xc8;}else{_0x333b00=0xce;}_0x2a02e3[_0x8e0e('0x2a')](_0x333b00);return _0x2a02e3[_0x8e0e('0x30')]('Content-Range',_0x3a4eb0+'-'+_0x443080+'/'+_0x968655)[_0x8e0e('0x2b')](_0x44b895);}return null;};}function patchUpdates(_0x2371e6){return function(_0x422b06){try{jsonpatch['apply'](_0x422b06,_0x2371e6,!![]);}catch(_0x2e62ef){return BPromise[_0x8e0e('0x31')](_0x2e62ef);}return _0x422b06[_0x8e0e('0x32')]();};}function saveUpdates(_0x2e6f3d,_0x193103){return function(_0x394acc){if(_0x394acc){return _0x394acc['update'](_0x2e6f3d)[_0x8e0e('0x20')](function(_0x18ab5e){return _0x18ab5e;});}return null;};}function removeEntity(_0x124950,_0x449f04){return function(_0x186c57){if(_0x186c57){return _0x186c57['destroy']()[_0x8e0e('0x20')](function(){var _0x1ae405=_0x186c57['get']({'plain':!![]});var _0x5e6ef9=_0x8e0e('0x33');return db[_0x8e0e('0x34')][_0x8e0e('0x35')]({'where':{'type':_0x5e6ef9,'resourceId':_0x1ae405['id']}})[_0x8e0e('0x20')](function(){return _0x186c57;});})[_0x8e0e('0x20')](function(){_0x124950[_0x8e0e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d25a3,_0x1ba614){return function(_0x59968f){if(!_0x59968f){_0x1d25a3[_0x8e0e('0x36')](0x194);}return _0x59968f;};}function handleError(_0x19a9b7,_0x4fd8f0){_0x4fd8f0=_0x4fd8f0||0x1f4;return function(_0x4aa12d){logger[_0x8e0e('0x25')](_0x4aa12d[_0x8e0e('0x37')]);if(_0x4aa12d['name']){delete _0x4aa12d[_0x8e0e('0x38')];}_0x19a9b7[_0x8e0e('0x2a')](_0x4fd8f0)[_0x8e0e('0x39')](_0x4aa12d);};}exports[_0x8e0e('0x3a')]=function(_0xe074c2,_0x991ae0){var _0x1aefbb={},_0x518d10={},_0x8ebff0={'count':0x0,'rows':[]};var _0x21552d=_[_0x8e0e('0x3b')](db['ChatQueue'][_0x8e0e('0x3c')],function(_0x8de3c){return{'name':_0x8de3c[_0x8e0e('0x3d')],'type':_0x8de3c['type'][_0x8e0e('0x3e')]};});_0x518d10['model']=_[_0x8e0e('0x3b')](_0x21552d,_0x8e0e('0x38'));_0x518d10[_0x8e0e('0x3f')]=_['keys'](_0xe074c2['query']);_0x518d10['filters']=_['intersection'](_0x518d10['model'],_0x518d10[_0x8e0e('0x3f')]);_0x1aefbb['attributes']=_[_0x8e0e('0x40')](_0x518d10[_0x8e0e('0x41')],qs[_0x8e0e('0x42')](_0xe074c2[_0x8e0e('0x3f')]['fields']));_0x1aefbb['attributes']=_0x1aefbb[_0x8e0e('0x43')][_0x8e0e('0x44')]?_0x1aefbb['attributes']:_0x518d10[_0x8e0e('0x41')];if(!_0xe074c2[_0x8e0e('0x3f')][_0x8e0e('0x45')](_0x8e0e('0x46'))){_0x1aefbb[_0x8e0e('0x2d')]=qs['limit'](_0xe074c2[_0x8e0e('0x3f')][_0x8e0e('0x2d')]);_0x1aefbb[_0x8e0e('0x2c')]=qs['offset'](_0xe074c2[_0x8e0e('0x3f')]['offset']);}_0x1aefbb['order']=qs[_0x8e0e('0x47')](_0xe074c2['query'][_0x8e0e('0x47')]);_0x1aefbb[_0x8e0e('0x48')]=qs[_0x8e0e('0x49')](_[_0x8e0e('0x4a')](_0xe074c2['query'],_0x518d10[_0x8e0e('0x49')]),_0x21552d);if(_0xe074c2[_0x8e0e('0x3f')][_0x8e0e('0x4b')]){_0x1aefbb[_0x8e0e('0x48')]=_[_0x8e0e('0x4c')](_0x1aefbb[_0x8e0e('0x48')],{'$or':_['map'](_0x21552d,function(_0x41f8e4){if(_0x41f8e4[_0x8e0e('0x4d')]!==_0x8e0e('0x4e')){var _0x26df27={};_0x26df27[_0x41f8e4[_0x8e0e('0x38')]]={'$like':'%'+_0xe074c2['query'][_0x8e0e('0x4b')]+'%'};return _0x26df27;}})});}_0x1aefbb=_[_0x8e0e('0x4c')]({},_0x1aefbb,_0xe074c2[_0x8e0e('0x4f')]);var _0x2e3288={'where':_0x1aefbb[_0x8e0e('0x48')]};return db['ChatQueue'][_0x8e0e('0x2f')](_0x2e3288)[_0x8e0e('0x20')](function(_0x5747ea){_0x8ebff0['count']=_0x5747ea;if(_0xe074c2[_0x8e0e('0x3f')]['includeAll']){_0x1aefbb['include']=[{'all':!![]}];}return db['ChatQueue'][_0x8e0e('0x50')](_0x1aefbb);})[_0x8e0e('0x20')](function(_0x2d48ec){_0x8ebff0['rows']=_0x2d48ec;return _0x8ebff0;})[_0x8e0e('0x20')](respondWithFilteredResult(_0x991ae0,_0x1aefbb))['catch'](handleError(_0x991ae0,null));};exports[_0x8e0e('0x51')]=function(_0x40003c,_0x2725f9){var _0x3aa046={'raw':!![],'where':{'id':_0x40003c[_0x8e0e('0x52')]['id']}},_0x243105={};_0x243105[_0x8e0e('0x41')]=_[_0x8e0e('0x53')](db[_0x8e0e('0x54')]['rawAttributes']);_0x243105[_0x8e0e('0x3f')]=_[_0x8e0e('0x53')](_0x40003c[_0x8e0e('0x3f')]);_0x243105['filters']=_[_0x8e0e('0x40')](_0x243105[_0x8e0e('0x41')],_0x243105['query']);_0x3aa046[_0x8e0e('0x43')]=_[_0x8e0e('0x40')](_0x243105[_0x8e0e('0x41')],qs['fields'](_0x40003c[_0x8e0e('0x3f')][_0x8e0e('0x42')]));_0x3aa046[_0x8e0e('0x43')]=_0x3aa046[_0x8e0e('0x43')][_0x8e0e('0x44')]?_0x3aa046['attributes']:_0x243105[_0x8e0e('0x41')];if(_0x40003c[_0x8e0e('0x3f')][_0x8e0e('0x55')]){_0x3aa046[_0x8e0e('0x56')]=[{'all':!![]}];}_0x3aa046=_[_0x8e0e('0x4c')]({},_0x3aa046,_0x40003c[_0x8e0e('0x4f')]);return db[_0x8e0e('0x54')]['find'](_0x3aa046)[_0x8e0e('0x20')](handleEntityNotFound(_0x2725f9,null))[_0x8e0e('0x20')](respondWithResult(_0x2725f9,null))[_0x8e0e('0x29')](handleError(_0x2725f9,null));};exports[_0x8e0e('0x57')]=function(_0x40f7a6,_0x3eb3d6){return db['ChatQueue'][_0x8e0e('0x57')](_0x40f7a6['body'],{})[_0x8e0e('0x20')](function(_0x3fb155){var _0x55f5ef=_0x40f7a6[_0x8e0e('0x58')][_0x8e0e('0x59')]({'plain':!![]});if(!_0x55f5ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55f5ef[_0x8e0e('0x5a')]===_0x8e0e('0x58')){var _0x40a22a=_0x3fb155[_0x8e0e('0x59')]({'plain':!![]});var _0x22cb92='ChatQueues';return db[_0x8e0e('0x5b')][_0x8e0e('0x5c')]({'where':{'name':_0x22cb92,'userProfileId':_0x55f5ef['userProfileId']},'raw':!![]})[_0x8e0e('0x20')](function(_0x57ceeb){if(_0x57ceeb&&_0x57ceeb[_0x8e0e('0x5d')]===0x0){return db[_0x8e0e('0x34')][_0x8e0e('0x57')]({'name':_0x40a22a[_0x8e0e('0x38')],'resourceId':_0x40a22a['id'],'type':_0x57ceeb[_0x8e0e('0x38')],'sectionId':_0x57ceeb['id']},{})[_0x8e0e('0x20')](function(){return _0x3fb155;});}else{return _0x3fb155;}})[_0x8e0e('0x29')](function(_0x174dcc){logger[_0x8e0e('0x25')](_0x8e0e('0x5e'),_0x174dcc);throw _0x174dcc;});}return _0x3fb155;})[_0x8e0e('0x20')](respondWithResult(_0x3eb3d6,0xc9))[_0x8e0e('0x29')](handleError(_0x3eb3d6,null));};exports[_0x8e0e('0x5f')]=function(_0x6541c9,_0x1e165f){if(_0x6541c9[_0x8e0e('0x60')]['id']){delete _0x6541c9['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x6541c9[_0x8e0e('0x52')]['id']}})[_0x8e0e('0x20')](handleEntityNotFound(_0x1e165f,null))['then'](saveUpdates(_0x6541c9[_0x8e0e('0x60')],null))[_0x8e0e('0x20')](respondWithResult(_0x1e165f,null))[_0x8e0e('0x29')](handleError(_0x1e165f,null));};exports['destroy']=function(_0x24cc85,_0x7ea471){return db[_0x8e0e('0x54')]['find']({'where':{'id':_0x24cc85[_0x8e0e('0x52')]['id']}})['then'](handleEntityNotFound(_0x7ea471,null))['then'](removeEntity(_0x7ea471,null))['catch'](handleError(_0x7ea471,null));};exports[_0x8e0e('0x61')]=function(_0x41c564,_0x1145ad){return db[_0x8e0e('0x54')][_0x8e0e('0x61')]()[_0x8e0e('0x20')](respondWithResult(_0x1145ad,null))['catch'](handleError(_0x1145ad,null));};exports[_0x8e0e('0x62')]=function(_0x4e1c8d,_0x344cea,_0x1ec971){var _0x1f7508={'raw':!![],'where':{}},_0x11e1fe={},_0x34f5fc;return db[_0x8e0e('0x54')][_0x8e0e('0x63')]({'where':{'id':_0x4e1c8d[_0x8e0e('0x52')]['id']}})[_0x8e0e('0x20')](handleEntityNotFound(_0x344cea,null))[_0x8e0e('0x20')](function(_0x77492d){if(_0x77492d){_0x34f5fc=_0x77492d[_0x8e0e('0x59')]({'plain':!![]});_0x11e1fe[_0x8e0e('0x41')]=_[_0x8e0e('0x53')](db['UserChatQueue'][_0x8e0e('0x3c')]);_0x11e1fe['query']=_[_0x8e0e('0x53')](_0x4e1c8d[_0x8e0e('0x3f')]);_0x11e1fe[_0x8e0e('0x49')]=_['intersection'](_0x11e1fe[_0x8e0e('0x41')],_0x11e1fe[_0x8e0e('0x3f')]);_0x1f7508['attributes']=_[_0x8e0e('0x40')](_0x11e1fe['model'],qs['fields'](_0x4e1c8d[_0x8e0e('0x3f')][_0x8e0e('0x42')]));_0x1f7508['attributes']=_0x1f7508[_0x8e0e('0x43')][_0x8e0e('0x44')]?_0x1f7508['attributes']:_0x11e1fe['model'];if(!_0x4e1c8d[_0x8e0e('0x3f')][_0x8e0e('0x45')](_0x8e0e('0x46'))){_0x1f7508[_0x8e0e('0x2d')]=qs[_0x8e0e('0x2d')](_0x4e1c8d[_0x8e0e('0x3f')]['limit']);_0x1f7508[_0x8e0e('0x2c')]=qs[_0x8e0e('0x2c')](_0x4e1c8d[_0x8e0e('0x3f')][_0x8e0e('0x2c')]);}_0x1f7508[_0x8e0e('0x64')]=qs[_0x8e0e('0x47')](_0x4e1c8d[_0x8e0e('0x3f')][_0x8e0e('0x47')]);_0x1f7508['where']=qs['filters'](_[_0x8e0e('0x4a')](_0x4e1c8d[_0x8e0e('0x3f')],_0x11e1fe['filters']));_0x1f7508['where'][_0x8e0e('0x65')]=_0x77492d['id'];if(_0x4e1c8d[_0x8e0e('0x3f')][_0x8e0e('0x4b')]){_0x1f7508['where']=_[_0x8e0e('0x4c')](_0x1f7508[_0x8e0e('0x48')],{'$or':_[_0x8e0e('0x3b')](_0x1f7508[_0x8e0e('0x43')],function(_0x159ec3){var _0x19c862={};_0x19c862[_0x159ec3]={'$like':'%'+_0x4e1c8d[_0x8e0e('0x3f')][_0x8e0e('0x4b')]+'%'};return _0x19c862;})});}_0x1f7508=_[_0x8e0e('0x4c')]({},_0x1f7508,_0x4e1c8d[_0x8e0e('0x4f')]);return db[_0x8e0e('0x66')]['findAll'](_0x1f7508);}})['then'](function(_0x1bfe66){if(_0x1bfe66){return db[_0x8e0e('0x67')][_0x8e0e('0x68')]({'where':{'id':_[_0x8e0e('0x3b')](_0x1bfe66,'UserId'),'role':_0x8e0e('0x69')},'attributes':['id',_0x8e0e('0x38'),_0x8e0e('0x6a'),_0x8e0e('0x6b'),_0x8e0e('0x6c')]});}})[_0x8e0e('0x20')](function(_0x5d65c9){if(_0x5d65c9){return{'count':_0x5d65c9['count'],'rows':_['map'](_0x5d65c9[_0x8e0e('0x6d')],function(_0x3beedb){return{'membername':_0x3beedb[_0x8e0e('0x38')],'UserId':_0x3beedb['id'],'queue_name':_0x34f5fc['name'],'ChatQueueId':_0x34f5fc['id'],'interface':util[_0x8e0e('0x6e')](_0x8e0e('0x6f'),_0x8e0e('0x70'),_0x3beedb[_0x8e0e('0x38')]),'penalty':0x0,'paused':_0x3beedb[_0x8e0e('0x6a')],'createdAt':_0x3beedb[_0x8e0e('0x6c')],'updatedAt':_0x3beedb[_0x8e0e('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8e0e('0x20')](respondWithFilteredResult(_0x344cea,_0x1f7508))['catch'](handleError(_0x344cea,null));};exports[_0x8e0e('0x71')]=function(_0x434c97,_0x45f471,_0x34c1e8){var _0x544ce7={};var _0x4bda98={};var _0x318036;var _0x1f4d06;return db[_0x8e0e('0x54')][_0x8e0e('0x63')]({'where':{'id':_0x434c97[_0x8e0e('0x52')]['id']}})[_0x8e0e('0x20')](handleEntityNotFound(_0x45f471,null))[_0x8e0e('0x20')](function(_0x91c0a6){if(_0x91c0a6){_0x318036=_0x91c0a6;_0x4bda98['model']=_[_0x8e0e('0x53')](db[_0x8e0e('0x72')][_0x8e0e('0x3c')]);_0x4bda98[_0x8e0e('0x3f')]=_[_0x8e0e('0x53')](_0x434c97['query']);_0x4bda98[_0x8e0e('0x49')]=_['intersection'](_0x4bda98['model'],_0x4bda98[_0x8e0e('0x3f')]);_0x544ce7[_0x8e0e('0x43')]=_[_0x8e0e('0x40')](_0x4bda98[_0x8e0e('0x41')],qs[_0x8e0e('0x42')](_0x434c97['query'][_0x8e0e('0x42')]));_0x544ce7['attributes']=_0x544ce7[_0x8e0e('0x43')][_0x8e0e('0x44')]?_0x544ce7[_0x8e0e('0x43')]:_0x4bda98[_0x8e0e('0x41')];_0x544ce7[_0x8e0e('0x64')]=qs[_0x8e0e('0x47')](_0x434c97[_0x8e0e('0x3f')][_0x8e0e('0x47')]);_0x544ce7[_0x8e0e('0x48')]=qs[_0x8e0e('0x49')](_['pick'](_0x434c97['query'],_0x4bda98[_0x8e0e('0x49')]));if(_0x434c97[_0x8e0e('0x3f')][_0x8e0e('0x4b')]){_0x544ce7[_0x8e0e('0x48')]=_[_0x8e0e('0x4c')](_0x544ce7[_0x8e0e('0x48')],{'$or':_['map'](_0x544ce7['attributes'],function(_0x72304a){var _0x208723={};_0x208723[_0x72304a]={'$like':'%'+_0x434c97['query'][_0x8e0e('0x4b')]+'%'};return _0x208723;})});}_0x544ce7=_['merge']({},_0x544ce7,_0x434c97[_0x8e0e('0x4f')]);return _0x318036[_0x8e0e('0x71')](_0x544ce7);}})['then'](function(_0x356794){if(_0x356794){_0x1f4d06=_0x356794[_0x8e0e('0x44')];if(!_0x434c97['query'][_0x8e0e('0x45')](_0x8e0e('0x46'))){_0x544ce7[_0x8e0e('0x2d')]=qs[_0x8e0e('0x2d')](_0x434c97[_0x8e0e('0x3f')][_0x8e0e('0x2d')]);_0x544ce7[_0x8e0e('0x2c')]=qs[_0x8e0e('0x2c')](_0x434c97[_0x8e0e('0x3f')][_0x8e0e('0x2c')]);}return _0x318036['getTeams'](_0x544ce7);}})[_0x8e0e('0x20')](function(_0x4c3df1){if(_0x4c3df1){return _0x4c3df1?{'count':_0x1f4d06,'rows':_0x4c3df1}:null;}})[_0x8e0e('0x20')](respondWithResult(_0x45f471,null))[_0x8e0e('0x29')](handleError(_0x45f471,null));};exports[_0x8e0e('0x73')]=function(_0x3c7a58,_0x1c6923,_0x555b47){var _0xd986e5=_0x3c7a58[_0x8e0e('0x60')][_0x8e0e('0x74')];return db['Team'][_0x8e0e('0x50')]({'where':{'id':_0xd986e5},'attributes':['id'],'include':[{'model':db[_0x8e0e('0x67')],'as':'Agents','attributes':['id',_0x8e0e('0x38'),_0x8e0e('0x75'),_0x8e0e('0x76'),_0x8e0e('0x77')],'raw':!![]}]})[_0x8e0e('0x20')](function(_0x27bde6){if(_0x27bde6){var _0x10240e=_[_0x8e0e('0x78')](_0x27bde6,function(_0x18c60c){var _0x5e7a56=_0x18c60c['get']({'plain':!![]});return _0x5e7a56[_0x8e0e('0x79')];});return db[_0x8e0e('0x54')][_0x8e0e('0x5c')]({'where':{'id':_0x3c7a58['params']['id']}})[_0x8e0e('0x20')](function(_0x32b93a){return db[_0x8e0e('0x7a')]['transaction'](function(_0x6aae29){return _0x32b93a[_0x8e0e('0x73')](_0xd986e5,{'transaction':_0x6aae29})[_0x8e0e('0x20')](function(){return BPromise[_0x8e0e('0x7b')](_0x10240e,function(_0x19ab52){return db[_0x8e0e('0x66')]['findOrCreate']({'where':{'UserId':_0x19ab52['id'],'ChatQueueId':_0x3c7a58[_0x8e0e('0x52')]['id']},'transaction':_0x6aae29});});})['then'](function(){_0x10240e['forEach'](function(_0x421439){socket[_0x8e0e('0x7c')](_0x8e0e('0x7d'),{'UserId':_0x421439['id'],'ChatQueueId':_0x32b93a['id']});});});});});}})[_0x8e0e('0x20')](respondWithStatusCode(_0x1c6923,null))[_0x8e0e('0x29')](handleError(_0x1c6923,null));};exports[_0x8e0e('0x7e')]=function(_0x589ab9,_0x826ce0,_0x1d8b92){return db[_0x8e0e('0x72')]['findAll']({'where':{'id':_0x589ab9['query'][_0x8e0e('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8e0e('0x67')],'as':_0x8e0e('0x79'),'attributes':['id'],'raw':!![]}]})[_0x8e0e('0x20')](handleEntityNotFound(_0x826ce0,null))['then'](function(_0x33f764){var _0x56be50=_[_0x8e0e('0x3b')](_0x33f764,'id');var _0x31559d=[];var _0x1b871c=[];var _0x493400=squel['select']();_0x493400['field'](_0x8e0e('0x7f'))[_0x8e0e('0x80')]('team_has_chat_queues','tq')['join'](_0x8e0e('0x81'),'ut',_0x8e0e('0x82'))[_0x8e0e('0x48')](_0x8e0e('0x83'),_0x589ab9[_0x8e0e('0x52')]['id']);for(var _0x1a8b8a=0x0;_0x1a8b8a<_0x33f764['length'];_0x1a8b8a+=0x1){let _0x210fa5=_0x33f764[_0x1a8b8a];for(var _0x406066=0x0;_0x406066<_0x210fa5[_0x8e0e('0x79')][_0x8e0e('0x44')];_0x406066+=0x1){let _0x38df43=_0x210fa5[_0x8e0e('0x79')][_0x406066];var _0x20c996=_0x493400[_0x8e0e('0x84')]();_0x20c996[_0x8e0e('0x48')]('ut.UserId\x20=\x20?',_0x38df43['id']);_0x1b871c[_0x8e0e('0x85')](db['sequelize'][_0x8e0e('0x3f')](_0x20c996[_0x8e0e('0x86')](),{'type':db[_0x8e0e('0x7a')][_0x8e0e('0x87')][_0x8e0e('0x88')]})[_0x8e0e('0x20')](function(_0x1a70a8){if(_0x1a70a8[_0x8e0e('0x44')]===0x1){return _0x38df43['id'];}else{var _0x2ba115=_[_0x8e0e('0x89')](_[_0x8e0e('0x3b')](_0x1a70a8,'TeamId'),function(_0x306722){return _['includes'](_0x56be50,_0x306722);});if(_0x2ba115){return _0x38df43['id'];}}}));}}return BPromise[_0x8e0e('0x8a')](_0x1b871c)[_0x8e0e('0x20')](function(_0x171fde){_0x31559d=_(_0x31559d)[_0x8e0e('0x8b')](_0x171fde)['compact']()[_0x8e0e('0x8c')]();return db[_0x8e0e('0x54')]['find']({'where':{'id':_0x589ab9[_0x8e0e('0x52')]['id']}})[_0x8e0e('0x20')](function(_0x3642b1){return db[_0x8e0e('0x7a')][_0x8e0e('0x8d')](function(_0x34ba45){return _0x3642b1[_0x8e0e('0x7e')](_0x589ab9[_0x8e0e('0x3f')][_0x8e0e('0x74')],{'transaction':_0x34ba45})[_0x8e0e('0x20')](function(){if(!_['isEmpty'](_0x31559d)){return _0x3642b1[_0x8e0e('0x8e')](_0x31559d,{'transaction':_0x34ba45});}})['then'](function(){_0x31559d['forEach'](function(_0x37aaf3){socket[_0x8e0e('0x7c')](_0x8e0e('0x8f'),{'UserId':_0x37aaf3,'ChatQueueId':_0x3642b1['id']});});});});});});})[_0x8e0e('0x20')](respondWithStatusCode(_0x826ce0,null))[_0x8e0e('0x29')](handleError(_0x826ce0,null));};exports['addAgents']=function(_0x5ba4bb,_0x174160,_0x20b1a6){return db[_0x8e0e('0x54')][_0x8e0e('0x5c')]({'where':{'id':_0x5ba4bb['params']['id']}})[_0x8e0e('0x20')](handleEntityNotFound(_0x174160,null))[_0x8e0e('0x20')](function(_0x15712a){if(_0x15712a){return _0x15712a[_0x8e0e('0x90')](_0x5ba4bb[_0x8e0e('0x60')][_0x8e0e('0x74')],_[_0x8e0e('0x91')](_0x5ba4bb[_0x8e0e('0x60')],['ids','id'])||{})[_0x8e0e('0x92')](function(_0x305f74){for(var _0x4df317=0x0;_0x4df317<_0x5ba4bb['body'][_0x8e0e('0x74')][_0x8e0e('0x44')];_0x4df317+=0x1){socket[_0x8e0e('0x7c')](_0x8e0e('0x7d'),{'UserId':_0x5ba4bb[_0x8e0e('0x60')][_0x8e0e('0x74')][_0x4df317],'ChatQueueId':_0x5ba4bb[_0x8e0e('0x52')]['id']});}return _0x305f74;});}})[_0x8e0e('0x20')](respondWithResult(_0x174160,null))['catch'](handleError(_0x174160,null));};exports[_0x8e0e('0x8e')]=function(_0x58865e,_0x102103,_0x2e89e9){return db[_0x8e0e('0x54')][_0x8e0e('0x5c')]({'where':{'id':_0x58865e[_0x8e0e('0x52')]['id']}})[_0x8e0e('0x20')](handleEntityNotFound(_0x102103,null))[_0x8e0e('0x20')](function(_0x977626){if(_0x977626){return _0x977626[_0x8e0e('0x8e')](_0x58865e['query'][_0x8e0e('0x74')])[_0x8e0e('0x20')](function(){if(_[_0x8e0e('0x93')](_0x58865e[_0x8e0e('0x3f')][_0x8e0e('0x74')])){for(var _0x5c5bb4=0x0;_0x5c5bb4<_0x58865e[_0x8e0e('0x3f')][_0x8e0e('0x74')][_0x8e0e('0x44')];_0x5c5bb4+=0x1){socket[_0x8e0e('0x7c')](_0x8e0e('0x8f'),{'UserId':Number(_0x58865e[_0x8e0e('0x3f')][_0x8e0e('0x74')][_0x5c5bb4]),'ChatQueueId':Number(_0x58865e[_0x8e0e('0x52')]['id'])});}}else{socket[_0x8e0e('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x58865e['query'][_0x8e0e('0x74')]),'ChatQueueId':Number(_0x58865e[_0x8e0e('0x52')]['id'])});}});}})[_0x8e0e('0x20')](respondWithStatusCode(_0x102103,null))[_0x8e0e('0x29')](handleError(_0x102103,null));};exports[_0x8e0e('0x94')]=function(_0x1d02d1,_0x1d331b,_0x401239){var _0x2b2ac9={};var _0x1b448c={};var _0x13cbe8;var _0x4de161;return db[_0x8e0e('0x54')]['findOne']({'where':{'id':_0x1d02d1[_0x8e0e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1d331b,null))[_0x8e0e('0x20')](function(_0x4c64b3){if(_0x4c64b3){_0x13cbe8=_0x4c64b3;_0x1b448c[_0x8e0e('0x41')]=_[_0x8e0e('0x53')](db[_0x8e0e('0x67')]['rawAttributes']);_0x1b448c['query']=_['keys'](_0x1d02d1[_0x8e0e('0x3f')]);_0x1b448c['filters']=_[_0x8e0e('0x40')](_0x1b448c[_0x8e0e('0x41')],_0x1b448c[_0x8e0e('0x3f')]);_0x2b2ac9[_0x8e0e('0x43')]=_[_0x8e0e('0x40')](_0x1b448c[_0x8e0e('0x41')],qs[_0x8e0e('0x42')](_0x1d02d1['query']['fields']));_0x2b2ac9['attributes']=_0x2b2ac9[_0x8e0e('0x43')][_0x8e0e('0x44')]?_0x2b2ac9['attributes']:_0x1b448c[_0x8e0e('0x41')];_0x2b2ac9[_0x8e0e('0x64')]=qs['sort'](_0x1d02d1['query'][_0x8e0e('0x47')]);_0x2b2ac9[_0x8e0e('0x48')]=qs[_0x8e0e('0x49')](_[_0x8e0e('0x4a')](_0x1d02d1[_0x8e0e('0x3f')],_0x1b448c['filters']));if(_0x1d02d1['query']['filter']){_0x2b2ac9['where']=_[_0x8e0e('0x4c')](_0x2b2ac9[_0x8e0e('0x48')],{'$or':_[_0x8e0e('0x3b')](_0x2b2ac9[_0x8e0e('0x43')],function(_0x3a9113){var _0x39bb29={};_0x39bb29[_0x3a9113]={'$like':'%'+_0x1d02d1[_0x8e0e('0x3f')][_0x8e0e('0x4b')]+'%'};return _0x39bb29;})});}_0x2b2ac9=_[_0x8e0e('0x4c')]({},_0x2b2ac9,_0x1d02d1[_0x8e0e('0x4f')]);return _0x13cbe8[_0x8e0e('0x94')](_0x2b2ac9);}})['then'](function(_0x5f3683){if(_0x5f3683){_0x4de161=_0x5f3683[_0x8e0e('0x44')];if(!_0x1d02d1[_0x8e0e('0x3f')]['hasOwnProperty'](_0x8e0e('0x46'))){_0x2b2ac9['limit']=qs[_0x8e0e('0x2d')](_0x1d02d1[_0x8e0e('0x3f')][_0x8e0e('0x2d')]);_0x2b2ac9['offset']=qs[_0x8e0e('0x2c')](_0x1d02d1[_0x8e0e('0x3f')][_0x8e0e('0x2c')]);}return _0x13cbe8[_0x8e0e('0x94')](_0x2b2ac9);}})[_0x8e0e('0x20')](function(_0x4d235a){if(_0x4d235a){return _0x4d235a?{'count':_0x4de161,'rows':_0x4d235a}:null;}})[_0x8e0e('0x20')](respondWithResult(_0x1d331b,null))[_0x8e0e('0x29')](handleError(_0x1d331b,null));}; \ No newline at end of file +var _0x2432=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','get','ChatQueues','end','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','where','pick','filters','filter','merge','options','includeAll','findAll','rows','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','UserChatQueue','order','sort','ChatQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','chatPause','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','sequelize','transaction','each','removeTeams','select','field','tq.TeamId','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','emit','addAgents','omit','userChatQueue:save','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x2432,0x7a));var _0x2243=function(_0x5d60f3,_0x282d73){_0x5d60f3=_0x5d60f3-0x0;var _0x10819e=_0x2432[_0x5d60f3];return _0x10819e;};'use strict';var emlformat=require(_0x2243('0x0'));var rimraf=require(_0x2243('0x1'));var zipdir=require(_0x2243('0x2'));var jsonpatch=require(_0x2243('0x3'));var rp=require('request-promise');var moment=require(_0x2243('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2243('0x5'));var util=require(_0x2243('0x6'));var path=require(_0x2243('0x7'));var sox=require(_0x2243('0x8'));var csv=require(_0x2243('0x9'));var ejs=require(_0x2243('0xa'));var fs=require('fs');var fs_extra=require(_0x2243('0xb'));var _=require(_0x2243('0xc'));var squel=require(_0x2243('0xd'));var crypto=require('crypto');var jsforce=require(_0x2243('0xe'));var deskjs=require(_0x2243('0xf'));var toCsv=require(_0x2243('0x9'));var querystring=require(_0x2243('0x10'));var Papa=require(_0x2243('0x11'));var Redis=require(_0x2243('0x12'));var authService=require(_0x2243('0x13'));var qs=require(_0x2243('0x14'));var as=require(_0x2243('0x15'));var hardwareService=require(_0x2243('0x16'));var logger=require(_0x2243('0x17'))(_0x2243('0x18'));var utils=require(_0x2243('0x19'));var config=require(_0x2243('0x1a'));var licenseUtil=require(_0x2243('0x1b'));var db=require(_0x2243('0x1c'))['db'];config['redis']=_[_0x2243('0x1d')](config[_0x2243('0x1e')],{'host':_0x2243('0x1f'),'port':0x18eb});var socket=require(_0x2243('0x20'))(new Redis(config['redis']));require(_0x2243('0x21'))['register'](socket);var jayson=require(_0x2243('0x22'));var client=jayson['client'][_0x2243('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x6da2e2,_0x20e2cf,_0x3388bc,_0x4ebd4a){return new BPromise(function(_0x532445,_0x4086a3){var _0x31ca17=_0x4ebd4a||client;return _0x31ca17[_0x2243('0x24')](_0x6da2e2,_0x3388bc)[_0x2243('0x25')](function(_0x2e1416){logger[_0x2243('0x26')](_0x2243('0x27'),_0x20e2cf,_0x2243('0x28'));logger[_0x2243('0x29')](_0x2243('0x2a'),_0x20e2cf,_0x2243('0x28'),JSON['stringify'](_0x2e1416));if(_0x2e1416[_0x2243('0x2b')]){if(_0x2e1416[_0x2243('0x2b')][_0x2243('0x2c')]===0x1f4){logger['error'](_0x2243('0x27'),_0x20e2cf,_0x2e1416[_0x2243('0x2b')][_0x2243('0x2d')]);return _0x4086a3(_0x2e1416[_0x2243('0x2b')][_0x2243('0x2d')]);}logger[_0x2243('0x2b')]('ChatQueue,\x20%s,\x20%s',_0x20e2cf,_0x2e1416[_0x2243('0x2b')][_0x2243('0x2d')]);return _0x532445(_0x2e1416[_0x2243('0x2b')][_0x2243('0x2d')]);}else{logger[_0x2243('0x26')](_0x2243('0x27'),_0x20e2cf,'request\x20sent');_0x532445(_0x2e1416[_0x2243('0x2e')][_0x2243('0x2d')]);}})[_0x2243('0x2f')](function(_0x13dee1){logger[_0x2243('0x2b')]('ChatQueue,\x20%s,\x20%s',_0x20e2cf,_0x13dee1);_0x4086a3(_0x13dee1);});});}function respondWithStatusCode(_0xedbc67,_0x4d5935){_0x4d5935=_0x4d5935||0xcc;return function(_0x5dbcc6){if(_0x5dbcc6){return _0xedbc67[_0x2243('0x30')](_0x4d5935);}return _0xedbc67[_0x2243('0x31')](_0x4d5935)['end']();};}function respondWithResult(_0x1f6a00,_0xc31bc2){_0xc31bc2=_0xc31bc2||0xc8;return function(_0x4d6518){if(_0x4d6518){return _0x1f6a00[_0x2243('0x31')](_0xc31bc2)[_0x2243('0x32')](_0x4d6518);}};}function respondWithFilteredResult(_0x1db2d1,_0x38248a){return function(_0x4e3acf){if(_0x4e3acf){var _0x21b3e0=typeof _0x38248a[_0x2243('0x33')]===_0x2243('0x34')&&typeof _0x38248a[_0x2243('0x35')]===_0x2243('0x34');var _0x3a9cb6=_0x4e3acf[_0x2243('0x36')];var _0x18a2ae=_0x21b3e0?0x0:_0x38248a[_0x2243('0x33')];var _0x50a9d0=_0x21b3e0?_0x4e3acf[_0x2243('0x36')]:_0x38248a['offset']+_0x38248a['limit'];var _0x1dac45;if(_0x50a9d0>=_0x3a9cb6){_0x50a9d0=_0x3a9cb6;_0x1dac45=0xc8;}else{_0x1dac45=0xce;}_0x1db2d1[_0x2243('0x31')](_0x1dac45);return _0x1db2d1[_0x2243('0x37')]('Content-Range',_0x18a2ae+'-'+_0x50a9d0+'/'+_0x3a9cb6)[_0x2243('0x32')](_0x4e3acf);}return null;};}function patchUpdates(_0x1617d7){return function(_0x41acde){try{jsonpatch['apply'](_0x41acde,_0x1617d7,!![]);}catch(_0x2da77){return BPromise[_0x2243('0x38')](_0x2da77);}return _0x41acde[_0x2243('0x39')]();};}function saveUpdates(_0x4d0e1e,_0x541d76){return function(_0x124e95){if(_0x124e95){return _0x124e95[_0x2243('0x3a')](_0x4d0e1e)[_0x2243('0x25')](function(_0x267ab6){return _0x267ab6;});}return null;};}function removeEntity(_0x5dca2d,_0x3fabed){return function(_0x29d5db){if(_0x29d5db){return _0x29d5db[_0x2243('0x3b')]()['then'](function(){var _0x107f79=_0x29d5db[_0x2243('0x3c')]({'plain':!![]});var _0x14d498=_0x2243('0x3d');return db['UserProfileResource'][_0x2243('0x3b')]({'where':{'type':_0x14d498,'resourceId':_0x107f79['id']}})[_0x2243('0x25')](function(){return _0x29d5db;});})[_0x2243('0x25')](function(){_0x5dca2d[_0x2243('0x31')](0xcc)[_0x2243('0x3e')]();});}};}function handleEntityNotFound(_0x51e98b,_0x1ea79e){return function(_0x244519){if(!_0x244519){_0x51e98b[_0x2243('0x30')](0x194);}return _0x244519;};}function handleError(_0x3573da,_0x4735f3){_0x4735f3=_0x4735f3||0x1f4;return function(_0x1960e6){logger[_0x2243('0x2b')](_0x1960e6[_0x2243('0x3f')]);if(_0x1960e6[_0x2243('0x40')]){delete _0x1960e6[_0x2243('0x40')];}_0x3573da['status'](_0x4735f3)[_0x2243('0x41')](_0x1960e6);};}exports['index']=function(_0x27ccba,_0x2487a8){var _0x14152e={},_0x49482a={},_0x57140d={'count':0x0,'rows':[]};var _0x2fb7ec=_[_0x2243('0x42')](db[_0x2243('0x43')][_0x2243('0x44')],function(_0x21240b){return{'name':_0x21240b[_0x2243('0x45')],'type':_0x21240b[_0x2243('0x46')][_0x2243('0x47')]};});_0x49482a[_0x2243('0x48')]=_[_0x2243('0x42')](_0x2fb7ec,_0x2243('0x40'));_0x49482a['query']=_[_0x2243('0x49')](_0x27ccba[_0x2243('0x4a')]);_0x49482a['filters']=_[_0x2243('0x4b')](_0x49482a['model'],_0x49482a[_0x2243('0x4a')]);_0x14152e[_0x2243('0x4c')]=_[_0x2243('0x4b')](_0x49482a[_0x2243('0x48')],qs[_0x2243('0x4d')](_0x27ccba[_0x2243('0x4a')]['fields']));_0x14152e[_0x2243('0x4c')]=_0x14152e[_0x2243('0x4c')][_0x2243('0x4e')]?_0x14152e[_0x2243('0x4c')]:_0x49482a[_0x2243('0x48')];if(!_0x27ccba[_0x2243('0x4a')]['hasOwnProperty'](_0x2243('0x4f'))){_0x14152e[_0x2243('0x35')]=qs[_0x2243('0x35')](_0x27ccba[_0x2243('0x4a')]['limit']);_0x14152e[_0x2243('0x33')]=qs['offset'](_0x27ccba[_0x2243('0x4a')][_0x2243('0x33')]);}_0x14152e['order']=qs['sort'](_0x27ccba['query']['sort']);_0x14152e[_0x2243('0x50')]=qs['filters'](_[_0x2243('0x51')](_0x27ccba[_0x2243('0x4a')],_0x49482a[_0x2243('0x52')]),_0x2fb7ec);if(_0x27ccba[_0x2243('0x4a')][_0x2243('0x53')]){_0x14152e[_0x2243('0x50')]=_[_0x2243('0x54')](_0x14152e['where'],{'$or':_[_0x2243('0x42')](_0x2fb7ec,function(_0x2fd58b){if(_0x2fd58b[_0x2243('0x46')]!=='VIRTUAL'){var _0x3afc7e={};_0x3afc7e[_0x2fd58b[_0x2243('0x40')]]={'$like':'%'+_0x27ccba[_0x2243('0x4a')][_0x2243('0x53')]+'%'};return _0x3afc7e;}})});}_0x14152e=_[_0x2243('0x54')]({},_0x14152e,_0x27ccba[_0x2243('0x55')]);var _0x45c9fc={'where':_0x14152e[_0x2243('0x50')]};return db[_0x2243('0x43')][_0x2243('0x36')](_0x45c9fc)[_0x2243('0x25')](function(_0x490fb2){_0x57140d[_0x2243('0x36')]=_0x490fb2;if(_0x27ccba['query'][_0x2243('0x56')]){_0x14152e['include']=[{'all':!![]}];}return db[_0x2243('0x43')][_0x2243('0x57')](_0x14152e);})['then'](function(_0x5a3835){_0x57140d[_0x2243('0x58')]=_0x5a3835;return _0x57140d;})[_0x2243('0x25')](respondWithFilteredResult(_0x2487a8,_0x14152e))[_0x2243('0x2f')](handleError(_0x2487a8,null));};exports['show']=function(_0x25a25a,_0x281a6a){var _0x5c419c={'raw':!![],'where':{'id':_0x25a25a['params']['id']}},_0x1f825b={};_0x1f825b[_0x2243('0x48')]=_['keys'](db['ChatQueue'][_0x2243('0x44')]);_0x1f825b['query']=_[_0x2243('0x49')](_0x25a25a[_0x2243('0x4a')]);_0x1f825b[_0x2243('0x52')]=_[_0x2243('0x4b')](_0x1f825b['model'],_0x1f825b[_0x2243('0x4a')]);_0x5c419c[_0x2243('0x4c')]=_[_0x2243('0x4b')](_0x1f825b['model'],qs[_0x2243('0x4d')](_0x25a25a[_0x2243('0x4a')][_0x2243('0x4d')]));_0x5c419c[_0x2243('0x4c')]=_0x5c419c[_0x2243('0x4c')][_0x2243('0x4e')]?_0x5c419c['attributes']:_0x1f825b[_0x2243('0x48')];if(_0x25a25a[_0x2243('0x4a')][_0x2243('0x56')]){_0x5c419c[_0x2243('0x59')]=[{'all':!![]}];}_0x5c419c=_[_0x2243('0x54')]({},_0x5c419c,_0x25a25a['options']);return db[_0x2243('0x43')][_0x2243('0x5a')](_0x5c419c)[_0x2243('0x25')](handleEntityNotFound(_0x281a6a,null))['then'](respondWithResult(_0x281a6a,null))[_0x2243('0x2f')](handleError(_0x281a6a,null));};exports[_0x2243('0x5b')]=function(_0x250104,_0x2569d0){return db[_0x2243('0x43')][_0x2243('0x5b')](_0x250104[_0x2243('0x5c')],{})[_0x2243('0x25')](function(_0x10f59a){var _0x31e49e=_0x250104['user'][_0x2243('0x3c')]({'plain':!![]});if(!_0x31e49e)throw new Error(_0x2243('0x5d'));if(_0x31e49e['role']==='user'){var _0x32ffe3=_0x10f59a['get']({'plain':!![]});var _0x2b1390='ChatQueues';return db[_0x2243('0x5e')]['find']({'where':{'name':_0x2b1390,'userProfileId':_0x31e49e[_0x2243('0x5f')]},'raw':!![]})[_0x2243('0x25')](function(_0x17c567){if(_0x17c567&&_0x17c567[_0x2243('0x60')]===0x0){return db[_0x2243('0x61')][_0x2243('0x5b')]({'name':_0x32ffe3['name'],'resourceId':_0x32ffe3['id'],'type':_0x17c567[_0x2243('0x40')],'sectionId':_0x17c567['id']},{})[_0x2243('0x25')](function(){return _0x10f59a;});}else{return _0x10f59a;}})['catch'](function(_0x1d1cf2){logger[_0x2243('0x2b')](_0x2243('0x62'),_0x1d1cf2);throw _0x1d1cf2;});}return _0x10f59a;})[_0x2243('0x25')](respondWithResult(_0x2569d0,0xc9))[_0x2243('0x2f')](handleError(_0x2569d0,null));};exports[_0x2243('0x3a')]=function(_0x15ccac,_0x5e694b){if(_0x15ccac[_0x2243('0x5c')]['id']){delete _0x15ccac[_0x2243('0x5c')]['id'];}return db[_0x2243('0x43')]['find']({'where':{'id':_0x15ccac[_0x2243('0x63')]['id']}})[_0x2243('0x25')](handleEntityNotFound(_0x5e694b,null))[_0x2243('0x25')](saveUpdates(_0x15ccac[_0x2243('0x5c')],null))['then'](respondWithResult(_0x5e694b,null))[_0x2243('0x2f')](handleError(_0x5e694b,null));};exports[_0x2243('0x3b')]=function(_0x2abb2d,_0x3c57a9){return db[_0x2243('0x43')][_0x2243('0x5a')]({'where':{'id':_0x2abb2d[_0x2243('0x63')]['id']}})[_0x2243('0x25')](handleEntityNotFound(_0x3c57a9,null))['then'](removeEntity(_0x3c57a9,null))[_0x2243('0x2f')](handleError(_0x3c57a9,null));};exports['describe']=function(_0x49c81d,_0x112af0){return db['ChatQueue']['describe']()[_0x2243('0x25')](respondWithResult(_0x112af0,null))[_0x2243('0x2f')](handleError(_0x112af0,null));};exports[_0x2243('0x64')]=function(_0x294cba,_0xdfe489,_0x37140b){var _0x3c8705={'raw':!![],'where':{}},_0x3c8334={},_0x1fff58;return db['ChatQueue'][_0x2243('0x65')]({'where':{'id':_0x294cba[_0x2243('0x63')]['id']}})[_0x2243('0x25')](handleEntityNotFound(_0xdfe489,null))['then'](function(_0x370382){if(_0x370382){_0x1fff58=_0x370382[_0x2243('0x3c')]({'plain':!![]});_0x3c8334['model']=_['keys'](db[_0x2243('0x66')][_0x2243('0x44')]);_0x3c8334[_0x2243('0x4a')]=_[_0x2243('0x49')](_0x294cba['query']);_0x3c8334['filters']=_['intersection'](_0x3c8334[_0x2243('0x48')],_0x3c8334['query']);_0x3c8705[_0x2243('0x4c')]=_[_0x2243('0x4b')](_0x3c8334[_0x2243('0x48')],qs['fields'](_0x294cba[_0x2243('0x4a')][_0x2243('0x4d')]));_0x3c8705[_0x2243('0x4c')]=_0x3c8705[_0x2243('0x4c')][_0x2243('0x4e')]?_0x3c8705[_0x2243('0x4c')]:_0x3c8334[_0x2243('0x48')];if(!_0x294cba[_0x2243('0x4a')]['hasOwnProperty'](_0x2243('0x4f'))){_0x3c8705[_0x2243('0x35')]=qs[_0x2243('0x35')](_0x294cba[_0x2243('0x4a')][_0x2243('0x35')]);_0x3c8705[_0x2243('0x33')]=qs[_0x2243('0x33')](_0x294cba[_0x2243('0x4a')]['offset']);}_0x3c8705[_0x2243('0x67')]=qs[_0x2243('0x68')](_0x294cba[_0x2243('0x4a')][_0x2243('0x68')]);_0x3c8705[_0x2243('0x50')]=qs[_0x2243('0x52')](_[_0x2243('0x51')](_0x294cba[_0x2243('0x4a')],_0x3c8334[_0x2243('0x52')]));_0x3c8705['where'][_0x2243('0x69')]=_0x370382['id'];if(_0x294cba[_0x2243('0x4a')][_0x2243('0x53')]){_0x3c8705[_0x2243('0x50')]=_[_0x2243('0x54')](_0x3c8705[_0x2243('0x50')],{'$or':_[_0x2243('0x42')](_0x3c8705[_0x2243('0x4c')],function(_0x1dc952){var _0x373862={};_0x373862[_0x1dc952]={'$like':'%'+_0x294cba['query'][_0x2243('0x53')]+'%'};return _0x373862;})});}_0x3c8705=_[_0x2243('0x54')]({},_0x3c8705,_0x294cba[_0x2243('0x55')]);return db[_0x2243('0x66')][_0x2243('0x57')](_0x3c8705);}})[_0x2243('0x25')](function(_0x2ec48b){if(_0x2ec48b){return db[_0x2243('0x6a')][_0x2243('0x6b')]({'where':{'id':_[_0x2243('0x42')](_0x2ec48b,_0x2243('0x6c')),'role':_0x2243('0x6d')},'attributes':['id',_0x2243('0x40'),'chatPause',_0x2243('0x6e'),_0x2243('0x6f')]});}})[_0x2243('0x25')](function(_0x2911c0){if(_0x2911c0){return{'count':_0x2911c0[_0x2243('0x36')],'rows':_['map'](_0x2911c0[_0x2243('0x58')],function(_0x25522b){return{'membername':_0x25522b[_0x2243('0x40')],'UserId':_0x25522b['id'],'queue_name':_0x1fff58[_0x2243('0x40')],'ChatQueueId':_0x1fff58['id'],'interface':util['format']('%s/%s','SIP',_0x25522b[_0x2243('0x40')]),'penalty':0x0,'paused':_0x25522b[_0x2243('0x70')],'createdAt':_0x25522b[_0x2243('0x6f')],'updatedAt':_0x25522b[_0x2243('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2243('0x25')](respondWithFilteredResult(_0xdfe489,_0x3c8705))[_0x2243('0x2f')](handleError(_0xdfe489,null));};exports[_0x2243('0x71')]=function(_0x29fd5f,_0x3e9e09,_0x1a51ee){var _0x1cca58={};var _0x829a7={};var _0x1f4fff;var _0x50741d;return db[_0x2243('0x43')][_0x2243('0x65')]({'where':{'id':_0x29fd5f['params']['id']}})['then'](handleEntityNotFound(_0x3e9e09,null))[_0x2243('0x25')](function(_0x1c1659){if(_0x1c1659){_0x1f4fff=_0x1c1659;_0x829a7[_0x2243('0x48')]=_['keys'](db[_0x2243('0x72')]['rawAttributes']);_0x829a7['query']=_[_0x2243('0x49')](_0x29fd5f[_0x2243('0x4a')]);_0x829a7[_0x2243('0x52')]=_[_0x2243('0x4b')](_0x829a7[_0x2243('0x48')],_0x829a7[_0x2243('0x4a')]);_0x1cca58[_0x2243('0x4c')]=_[_0x2243('0x4b')](_0x829a7[_0x2243('0x48')],qs[_0x2243('0x4d')](_0x29fd5f[_0x2243('0x4a')]['fields']));_0x1cca58['attributes']=_0x1cca58[_0x2243('0x4c')][_0x2243('0x4e')]?_0x1cca58['attributes']:_0x829a7[_0x2243('0x48')];_0x1cca58[_0x2243('0x67')]=qs['sort'](_0x29fd5f[_0x2243('0x4a')][_0x2243('0x68')]);_0x1cca58['where']=qs[_0x2243('0x52')](_[_0x2243('0x51')](_0x29fd5f['query'],_0x829a7['filters']));if(_0x29fd5f['query']['filter']){_0x1cca58[_0x2243('0x50')]=_[_0x2243('0x54')](_0x1cca58[_0x2243('0x50')],{'$or':_[_0x2243('0x42')](_0x1cca58['attributes'],function(_0x2eb493){var _0x39a479={};_0x39a479[_0x2eb493]={'$like':'%'+_0x29fd5f['query'][_0x2243('0x53')]+'%'};return _0x39a479;})});}_0x1cca58=_['merge']({},_0x1cca58,_0x29fd5f[_0x2243('0x55')]);return _0x1f4fff['getTeams'](_0x1cca58);}})[_0x2243('0x25')](function(_0x2140ec){if(_0x2140ec){_0x50741d=_0x2140ec['length'];if(!_0x29fd5f[_0x2243('0x4a')][_0x2243('0x73')](_0x2243('0x4f'))){_0x1cca58[_0x2243('0x35')]=qs[_0x2243('0x35')](_0x29fd5f[_0x2243('0x4a')][_0x2243('0x35')]);_0x1cca58[_0x2243('0x33')]=qs[_0x2243('0x33')](_0x29fd5f[_0x2243('0x4a')][_0x2243('0x33')]);}return _0x1f4fff[_0x2243('0x71')](_0x1cca58);}})[_0x2243('0x25')](function(_0x212cd4){if(_0x212cd4){return _0x212cd4?{'count':_0x50741d,'rows':_0x212cd4}:null;}})[_0x2243('0x25')](respondWithResult(_0x3e9e09,null))[_0x2243('0x2f')](handleError(_0x3e9e09,null));};exports[_0x2243('0x74')]=function(_0x3daeac,_0x125bc7,_0x42712e){var _0x47e365=_0x3daeac[_0x2243('0x5c')][_0x2243('0x75')];return db[_0x2243('0x72')][_0x2243('0x57')]({'where':{'id':_0x47e365},'attributes':['id'],'include':[{'model':db[_0x2243('0x6a')],'as':_0x2243('0x76'),'attributes':['id',_0x2243('0x40'),_0x2243('0x77'),'voicePause',_0x2243('0x78')],'raw':!![]}]})[_0x2243('0x25')](function(_0x4eb26d){if(_0x4eb26d){var _0x2796b3=_['flatMap'](_0x4eb26d,function(_0x1ecc5c){var _0x8da855=_0x1ecc5c[_0x2243('0x3c')]({'plain':!![]});return _0x8da855['Agents'];});return db[_0x2243('0x43')][_0x2243('0x5a')]({'where':{'id':_0x3daeac[_0x2243('0x63')]['id']}})['then'](function(_0x432adf){return db[_0x2243('0x79')][_0x2243('0x7a')](function(_0x4723f8){return _0x432adf[_0x2243('0x74')](_0x47e365,{'transaction':_0x4723f8})[_0x2243('0x25')](function(){return BPromise[_0x2243('0x7b')](_0x2796b3,function(_0x4c0b5a){return db[_0x2243('0x66')]['findOrCreate']({'where':{'UserId':_0x4c0b5a['id'],'ChatQueueId':_0x3daeac['params']['id']},'transaction':_0x4723f8});});})[_0x2243('0x25')](function(){_0x2796b3['forEach'](function(_0x35901b){socket['emit']('userChatQueue:save',{'UserId':_0x35901b['id'],'ChatQueueId':_0x432adf['id']});});});});});}})['then'](respondWithStatusCode(_0x125bc7,null))[_0x2243('0x2f')](handleError(_0x125bc7,null));};exports[_0x2243('0x7c')]=function(_0x36b4b9,_0x6c728c,_0x5dccd9){return db[_0x2243('0x72')][_0x2243('0x57')]({'where':{'id':_0x36b4b9[_0x2243('0x4a')][_0x2243('0x75')]},'attributes':['id'],'include':[{'model':db[_0x2243('0x6a')],'as':_0x2243('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2243('0x25')](handleEntityNotFound(_0x6c728c,null))[_0x2243('0x25')](function(_0xdae91c){var _0x37e9f5=_['map'](_0xdae91c,'id');var _0x5c46dd=[];var _0x4aadb9=[];var _0x32c761=squel[_0x2243('0x7d')]();_0x32c761[_0x2243('0x7e')](_0x2243('0x7f'))['from'](_0x2243('0x80'),'tq')['join'](_0x2243('0x81'),'ut',_0x2243('0x82'))[_0x2243('0x50')](_0x2243('0x83'),_0x36b4b9['params']['id']);for(var _0x27e41f=0x0;_0x27e41f<_0xdae91c[_0x2243('0x4e')];_0x27e41f+=0x1){let _0xb9b9a2=_0xdae91c[_0x27e41f];for(var _0x43ad3f=0x0;_0x43ad3f<_0xb9b9a2[_0x2243('0x76')][_0x2243('0x4e')];_0x43ad3f+=0x1){let _0x243027=_0xb9b9a2[_0x2243('0x76')][_0x43ad3f];var _0x2dd2b5=_0x32c761[_0x2243('0x84')]();_0x2dd2b5['where']('ut.UserId\x20=\x20?',_0x243027['id']);_0x4aadb9['push'](db['sequelize'][_0x2243('0x4a')](_0x2dd2b5[_0x2243('0x85')](),{'type':db['sequelize'][_0x2243('0x86')][_0x2243('0x87')]})[_0x2243('0x25')](function(_0x145644){if(_0x145644['length']===0x1){return _0x243027['id'];}else{var _0x21ad4d=_['every'](_['map'](_0x145644,_0x2243('0x88')),function(_0x1004b4){return _['includes'](_0x37e9f5,_0x1004b4);});if(_0x21ad4d){return _0x243027['id'];}}}));}}return BPromise[_0x2243('0x89')](_0x4aadb9)[_0x2243('0x25')](function(_0x154e38){_0x5c46dd=_(_0x5c46dd)[_0x2243('0x8a')](_0x154e38)[_0x2243('0x8b')]()[_0x2243('0x8c')]();return db[_0x2243('0x43')][_0x2243('0x5a')]({'where':{'id':_0x36b4b9[_0x2243('0x63')]['id']}})[_0x2243('0x25')](function(_0x243558){return db['sequelize'][_0x2243('0x7a')](function(_0x288c36){return _0x243558[_0x2243('0x7c')](_0x36b4b9[_0x2243('0x4a')][_0x2243('0x75')],{'transaction':_0x288c36})[_0x2243('0x25')](function(){if(!_[_0x2243('0x8d')](_0x5c46dd)){return _0x243558[_0x2243('0x8e')](_0x5c46dd,{'transaction':_0x288c36});}})[_0x2243('0x25')](function(){_0x5c46dd[_0x2243('0x8f')](function(_0x40f595){socket[_0x2243('0x90')]('userChatQueue:remove',{'UserId':_0x40f595,'ChatQueueId':_0x243558['id']});});});});});});})[_0x2243('0x25')](respondWithStatusCode(_0x6c728c,null))[_0x2243('0x2f')](handleError(_0x6c728c,null));};exports[_0x2243('0x91')]=function(_0x3ec838,_0x5efe7f,_0x2f9b1e){return db[_0x2243('0x43')][_0x2243('0x5a')]({'where':{'id':_0x3ec838['params']['id']}})[_0x2243('0x25')](handleEntityNotFound(_0x5efe7f,null))[_0x2243('0x25')](function(_0x830356){if(_0x830356){return _0x830356[_0x2243('0x91')](_0x3ec838[_0x2243('0x5c')]['ids'],_[_0x2243('0x92')](_0x3ec838[_0x2243('0x5c')],['ids','id'])||{})['spread'](function(_0x4f5e7a){for(var _0x2a193c=0x0;_0x2a193c<_0x3ec838['body']['ids'][_0x2243('0x4e')];_0x2a193c+=0x1){socket[_0x2243('0x90')](_0x2243('0x93'),{'UserId':_0x3ec838[_0x2243('0x5c')]['ids'][_0x2a193c],'ChatQueueId':_0x3ec838[_0x2243('0x63')]['id']});}return _0x4f5e7a;});}})['then'](respondWithResult(_0x5efe7f,null))['catch'](handleError(_0x5efe7f,null));};exports['removeAgents']=function(_0x39b6ba,_0x35e364,_0x3f3e5c){return db[_0x2243('0x43')][_0x2243('0x5a')]({'where':{'id':_0x39b6ba['params']['id']}})['then'](handleEntityNotFound(_0x35e364,null))[_0x2243('0x25')](function(_0x47854b){if(_0x47854b){return _0x47854b[_0x2243('0x8e')](_0x39b6ba['query'][_0x2243('0x75')])[_0x2243('0x25')](function(){if(_['isArray'](_0x39b6ba['query']['ids'])){for(var _0x3a07fa=0x0;_0x3a07fa<_0x39b6ba['query'][_0x2243('0x75')][_0x2243('0x4e')];_0x3a07fa+=0x1){socket['emit'](_0x2243('0x94'),{'UserId':Number(_0x39b6ba['query']['ids'][_0x3a07fa]),'ChatQueueId':Number(_0x39b6ba[_0x2243('0x63')]['id'])});}}else{socket[_0x2243('0x90')](_0x2243('0x94'),{'UserId':Number(_0x39b6ba[_0x2243('0x4a')][_0x2243('0x75')]),'ChatQueueId':Number(_0x39b6ba[_0x2243('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x35e364,null))[_0x2243('0x2f')](handleError(_0x35e364,null));};exports[_0x2243('0x95')]=function(_0x31bc7b,_0x59db0c,_0x2dab9e){var _0x558c50={};var _0x2850cb={};var _0x3b8f8b;var _0x21639c;return db[_0x2243('0x43')][_0x2243('0x65')]({'where':{'id':_0x31bc7b[_0x2243('0x63')]['id']}})[_0x2243('0x25')](handleEntityNotFound(_0x59db0c,null))['then'](function(_0x1c6b79){if(_0x1c6b79){_0x3b8f8b=_0x1c6b79;_0x2850cb[_0x2243('0x48')]=_[_0x2243('0x49')](db[_0x2243('0x6a')][_0x2243('0x44')]);_0x2850cb[_0x2243('0x4a')]=_[_0x2243('0x49')](_0x31bc7b[_0x2243('0x4a')]);_0x2850cb[_0x2243('0x52')]=_[_0x2243('0x4b')](_0x2850cb['model'],_0x2850cb['query']);_0x558c50[_0x2243('0x4c')]=_[_0x2243('0x4b')](_0x2850cb[_0x2243('0x48')],qs[_0x2243('0x4d')](_0x31bc7b['query'][_0x2243('0x4d')]));_0x558c50['attributes']=_0x558c50['attributes']['length']?_0x558c50[_0x2243('0x4c')]:_0x2850cb['model'];_0x558c50[_0x2243('0x67')]=qs[_0x2243('0x68')](_0x31bc7b[_0x2243('0x4a')]['sort']);_0x558c50[_0x2243('0x50')]=qs['filters'](_[_0x2243('0x51')](_0x31bc7b['query'],_0x2850cb[_0x2243('0x52')]));if(_0x31bc7b[_0x2243('0x4a')][_0x2243('0x53')]){_0x558c50[_0x2243('0x50')]=_[_0x2243('0x54')](_0x558c50[_0x2243('0x50')],{'$or':_['map'](_0x558c50[_0x2243('0x4c')],function(_0x8fcb2c){var _0x88202={};_0x88202[_0x8fcb2c]={'$like':'%'+_0x31bc7b[_0x2243('0x4a')]['filter']+'%'};return _0x88202;})});}_0x558c50=_['merge']({},_0x558c50,_0x31bc7b[_0x2243('0x55')]);return _0x3b8f8b[_0x2243('0x95')](_0x558c50);}})[_0x2243('0x25')](function(_0x959747){if(_0x959747){_0x21639c=_0x959747[_0x2243('0x4e')];if(!_0x31bc7b[_0x2243('0x4a')][_0x2243('0x73')](_0x2243('0x4f'))){_0x558c50[_0x2243('0x35')]=qs[_0x2243('0x35')](_0x31bc7b[_0x2243('0x4a')][_0x2243('0x35')]);_0x558c50[_0x2243('0x33')]=qs[_0x2243('0x33')](_0x31bc7b[_0x2243('0x4a')]['offset']);}return _0x3b8f8b[_0x2243('0x95')](_0x558c50);}})['then'](function(_0x23120f){if(_0x23120f){return _0x23120f?{'count':_0x21639c,'rows':_0x23120f}:null;}})['then'](respondWithResult(_0x59db0c,null))[_0x2243('0x2f')](handleError(_0x59db0c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 285e324..f30c3d5 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(_0x2ee46c,_0x27af4f){var _0x829f33=function(_0x31d4bf){while(--_0x31d4bf){_0x2ee46c['push'](_0x2ee46c['shift']());}};_0x829f33(++_0x27af4f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c2ade,_0x1cd24d){_0x1c2ade=_0x1c2ade-0x0;var _0x166ee7=_0x5f2f[_0x1c2ade];return _0x166ee7;};'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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x778cfe,_0x1b0991){var _0x5f070f=function(_0x334ef7){while(--_0x334ef7){_0x778cfe['push'](_0x778cfe['shift']());}};_0x5f070f(++_0x1b0991);}(_0x0b0e,0x187));var _0xe0b0=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x0b0e[_0x171fdc];return _0x3782ea;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('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 f78b566..69fc992 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 _0x643e=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','lodash'];(function(_0x247aab,_0x6d308){var _0x198cd0=function(_0x2bf3a4){while(--_0x2bf3a4){_0x247aab['push'](_0x247aab['shift']());}};_0x198cd0(++_0x6d308);}(_0x643e,0x13a));var _0xe643=function(_0x4ea27,_0x54c12b){_0x4ea27=_0x4ea27-0x0;var _0x532384=_0x643e[_0x4ea27];return _0x532384;};'use strict';var _=require(_0xe643('0x0'));var util=require('util');var logger=require(_0xe643('0x1'))(_0xe643('0x2'));var moment=require(_0xe643('0x3'));var BPromise=require('bluebird');var rp=require(_0xe643('0x4'));var fs=require('fs');var path=require(_0xe643('0x5'));var rimraf=require(_0xe643('0x6'));var config=require(_0xe643('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x13f6ad,_0x1eb33a){return _0x13f6ad[_0xe643('0x8')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7806=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues'];(function(_0x516044,_0x3677f7){var _0x31684b=function(_0x80be21){while(--_0x80be21){_0x516044['push'](_0x516044['shift']());}};_0x31684b(++_0x3677f7);}(_0x7806,0x9c));var _0x6780=function(_0x530d99,_0x393949){_0x530d99=_0x530d99-0x0;var _0x58a60a=_0x7806[_0x530d99];return _0x58a60a;};'use strict';var _=require(_0x6780('0x0'));var util=require('util');var logger=require(_0x6780('0x1'))(_0x6780('0x2'));var moment=require(_0x6780('0x3'));var BPromise=require(_0x6780('0x4'));var rp=require(_0x6780('0x5'));var fs=require('fs');var path=require(_0x6780('0x6'));var rimraf=require('rimraf');var config=require(_0x6780('0x7'));var attributes=require(_0x6780('0x8'));module[_0x6780('0x9')]=function(_0x2fde9b,_0x3e2bc9){return _0x2fde9b['define'](_0x6780('0xa'),attributes,{'tableName':_0x6780('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 e677183..29d052f 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 _0xa0a3=['ChatQueue','findAll','options','where','attributes','limit','include','map','model','ShowChatQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatQueue.socket','register','then','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','catch','GetChatQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x9fb47,_0x2aa792){_0x9fb47=_0x9fb47-0x0;var _0x4973c9=_0xa0a3[_0x9fb47];return _0x4973c9;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require(_0x3a0a('0x4'))['db'];var utils=require(_0x3a0a('0x5'));var logger=require(_0x3a0a('0x6'))(_0x3a0a('0x7'));var config=require(_0x3a0a('0x8'));var jayson=require(_0x3a0a('0x9'));var client=jayson[_0x3a0a('0xa')][_0x3a0a('0xb')]({'port':0x232a});config[_0x3a0a('0xc')]=_[_0x3a0a('0xd')](config[_0x3a0a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a0a('0xc')]));require(_0x3a0a('0xe'))[_0x3a0a('0xf')](socket);function respondWithRpcPromise(_0x3460be,_0x43e9ec,_0x272435){return new BPromise(function(_0x42235e,_0x53f366){return client['request'](_0x3460be,_0x272435)[_0x3a0a('0x10')](function(_0x3b1003){logger['info']('ChatQueue,\x20%s,\x20%s',_0x43e9ec,_0x3a0a('0x11'));logger[_0x3a0a('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x43e9ec,_0x3a0a('0x11'),JSON[_0x3a0a('0x13')](_0x3b1003));if(_0x3b1003[_0x3a0a('0x14')]){if(_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x15')]===0x1f4){logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x17')]);return _0x53f366(_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x17')]);}logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x3b1003[_0x3a0a('0x14')]['message']);return _0x42235e(_0x3b1003[_0x3a0a('0x14')]['message']);}else{logger[_0x3a0a('0x18')](_0x3a0a('0x16'),_0x43e9ec,_0x3a0a('0x11'));_0x42235e(_0x3b1003['result'][_0x3a0a('0x17')]);}})[_0x3a0a('0x19')](function(_0x4f0372){logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x4f0372);_0x53f366(_0x4f0372);});});}exports[_0x3a0a('0x1a')]=function(_0x36ca41){var _0x91d764=this;return new Promise(function(_0x423990,_0x3e99f9){return db[_0x3a0a('0x1b')][_0x3a0a('0x1c')]({'raw':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41['options']['raw']===undefined?!![]:![]:!![],'where':_0x36ca41['options']?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x1e')]||null:null,'attributes':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x1f')]||null:null,'limit':_0x36ca41['options']?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x20')]||null:null,'include':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41['options'][_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x36ca41['options']['include'],function(_0x16e93d){return{'model':db[_0x16e93d[_0x3a0a('0x23')]],'as':_0x16e93d['as'],'attributes':_0x16e93d[_0x3a0a('0x1f')],'include':_0x16e93d['include']?_[_0x3a0a('0x22')](_0x16e93d[_0x3a0a('0x21')],function(_0x130ca6){return{'model':db[_0x130ca6[_0x3a0a('0x23')]],'as':_0x130ca6['as'],'attributes':_0x130ca6[_0x3a0a('0x1f')],'include':_0x130ca6['include']?_['map'](_0x130ca6[_0x3a0a('0x21')],function(_0x3d01d8){return{'model':db[_0x3d01d8['model']],'as':_0x3d01d8['as'],'attributes':_0x3d01d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a0a('0x10')](function(_0x2e7481){logger[_0x3a0a('0x18')](_0x3a0a('0x1a'),_0x36ca41);logger['debug']('GetChatQueue',_0x36ca41,JSON[_0x3a0a('0x13')](_0x2e7481));_0x423990(_0x2e7481);})[_0x3a0a('0x19')](function(_0x177181){logger['error'](_0x3a0a('0x1a'),_0x177181[_0x3a0a('0x17')],_0x36ca41);_0x3e99f9(_0x91d764[_0x3a0a('0x14')](0x1f4,_0x177181[_0x3a0a('0x17')]));});});};exports[_0x3a0a('0x24')]=function(_0x3184cb){var _0x26ff5d=this;return new Promise(function(_0x1218fd,_0x21be1c){return db['ChatQueue'][_0x3a0a('0x25')]({'raw':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x26')]===undefined?!![]:![]:!![],'where':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb['options'][_0x3a0a('0x1e')]||null:null,'attributes':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x1f')]||null:null,'include':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')]['include']?_[_0x3a0a('0x22')](_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x21')],function(_0x32c2e1){return{'model':db[_0x32c2e1[_0x3a0a('0x23')]],'as':_0x32c2e1['as'],'attributes':_0x32c2e1[_0x3a0a('0x1f')],'include':_0x32c2e1[_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x32c2e1['include'],function(_0x2301be){return{'model':db[_0x2301be[_0x3a0a('0x23')]],'as':_0x2301be['as'],'attributes':_0x2301be[_0x3a0a('0x1f')],'include':_0x2301be[_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x2301be[_0x3a0a('0x21')],function(_0x2ab6d2){return{'model':db[_0x2ab6d2[_0x3a0a('0x23')]],'as':_0x2ab6d2['as'],'attributes':_0x2ab6d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a0a('0x10')](function(_0x143696){logger[_0x3a0a('0x18')](_0x3a0a('0x24'),_0x3184cb);logger[_0x3a0a('0x12')](_0x3a0a('0x24'),_0x3184cb,JSON[_0x3a0a('0x13')](_0x143696));_0x1218fd(_0x143696);})[_0x3a0a('0x19')](function(_0xea232d){logger['error'](_0x3a0a('0x24'),_0xea232d['message'],_0x3184cb);_0x21be1c(_0x26ff5d[_0x3a0a('0x14')](0x1f4,_0xea232d[_0x3a0a('0x17')]));});});}; \ No newline at end of file +var _0x77ff=['options','where','attributes','limit','include','map','model','ChatQueue','raw','ShowChatQueue','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','info','result','catch','GetChatQueue'];(function(_0x190797,_0x280a34){var _0x564a8c=function(_0x397076){while(--_0x397076){_0x190797['push'](_0x190797['shift']());}};_0x564a8c(++_0x280a34);}(_0x77ff,0x168));var _0xf77f=function(_0x8db656,_0x5784b1){_0x8db656=_0x8db656-0x0;var _0x5ed99f=_0x77ff[_0x8db656];return _0x5ed99f;};'use strict';var _=require('lodash');var util=require(_0xf77f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf77f('0x1'))['db'];var utils=require(_0xf77f('0x2'));var logger=require(_0xf77f('0x3'))('rpc');var config=require(_0xf77f('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf77f('0x5')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf77f('0x6')],{'host':_0xf77f('0x7'),'port':0x18eb});var socket=require(_0xf77f('0x8'))(new Redis(config['redis']));require(_0xf77f('0x9'))[_0xf77f('0xa')](socket);function respondWithRpcPromise(_0x53aead,_0x27412c,_0x41dcee){return new BPromise(function(_0x66def4,_0x257499){return client[_0xf77f('0xb')](_0x53aead,_0x41dcee)[_0xf77f('0xc')](function(_0x1d8bca){logger['info']('ChatQueue,\x20%s,\x20%s',_0x27412c,_0xf77f('0xd'));logger[_0xf77f('0xe')](_0xf77f('0xf'),_0x27412c,_0xf77f('0xd'),JSON[_0xf77f('0x10')](_0x1d8bca));if(_0x1d8bca[_0xf77f('0x11')]){if(_0x1d8bca['error'][_0xf77f('0x12')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x27412c,_0x1d8bca[_0xf77f('0x11')][_0xf77f('0x13')]);return _0x257499(_0x1d8bca[_0xf77f('0x11')][_0xf77f('0x13')]);}logger[_0xf77f('0x11')](_0xf77f('0x14'),_0x27412c,_0x1d8bca[_0xf77f('0x11')][_0xf77f('0x13')]);return _0x66def4(_0x1d8bca[_0xf77f('0x11')]['message']);}else{logger[_0xf77f('0x15')]('ChatQueue,\x20%s,\x20%s',_0x27412c,_0xf77f('0xd'));_0x66def4(_0x1d8bca[_0xf77f('0x16')][_0xf77f('0x13')]);}})[_0xf77f('0x17')](function(_0x31a99f){logger[_0xf77f('0x11')](_0xf77f('0x14'),_0x27412c,_0x31a99f);_0x257499(_0x31a99f);});});}exports[_0xf77f('0x18')]=function(_0x28fc63){var _0x220606=this;return new Promise(function(_0x331db7,_0x4db2c2){return db['ChatQueue']['findAll']({'raw':_0x28fc63[_0xf77f('0x19')]?_0x28fc63[_0xf77f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x28fc63[_0xf77f('0x19')]?_0x28fc63['options'][_0xf77f('0x1a')]||null:null,'attributes':_0x28fc63['options']?_0x28fc63[_0xf77f('0x19')][_0xf77f('0x1b')]||null:null,'limit':_0x28fc63[_0xf77f('0x19')]?_0x28fc63[_0xf77f('0x19')][_0xf77f('0x1c')]||null:null,'include':_0x28fc63[_0xf77f('0x19')]?_0x28fc63['options'][_0xf77f('0x1d')]?_[_0xf77f('0x1e')](_0x28fc63[_0xf77f('0x19')]['include'],function(_0x45bbe6){return{'model':db[_0x45bbe6['model']],'as':_0x45bbe6['as'],'attributes':_0x45bbe6[_0xf77f('0x1b')],'include':_0x45bbe6['include']?_['map'](_0x45bbe6['include'],function(_0x53aa0c){return{'model':db[_0x53aa0c[_0xf77f('0x1f')]],'as':_0x53aa0c['as'],'attributes':_0x53aa0c[_0xf77f('0x1b')],'include':_0x53aa0c['include']?_[_0xf77f('0x1e')](_0x53aa0c[_0xf77f('0x1d')],function(_0x534fee){return{'model':db[_0x534fee['model']],'as':_0x534fee['as'],'attributes':_0x534fee[_0xf77f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xba82b){logger['info'](_0xf77f('0x18'),_0x28fc63);logger[_0xf77f('0xe')](_0xf77f('0x18'),_0x28fc63,JSON[_0xf77f('0x10')](_0xba82b));_0x331db7(_0xba82b);})['catch'](function(_0x5cd804){logger[_0xf77f('0x11')]('GetChatQueue',_0x5cd804[_0xf77f('0x13')],_0x28fc63);_0x4db2c2(_0x220606[_0xf77f('0x11')](0x1f4,_0x5cd804[_0xf77f('0x13')]));});});};exports['ShowChatQueue']=function(_0xd49582){var _0x1fd637=this;return new Promise(function(_0x418a94,_0x275daf){return db[_0xf77f('0x20')]['find']({'raw':_0xd49582[_0xf77f('0x19')]?_0xd49582['options'][_0xf77f('0x21')]===undefined?!![]:![]:!![],'where':_0xd49582[_0xf77f('0x19')]?_0xd49582[_0xf77f('0x19')]['where']||null:null,'attributes':_0xd49582[_0xf77f('0x19')]?_0xd49582[_0xf77f('0x19')][_0xf77f('0x1b')]||null:null,'include':_0xd49582[_0xf77f('0x19')]?_0xd49582[_0xf77f('0x19')][_0xf77f('0x1d')]?_[_0xf77f('0x1e')](_0xd49582[_0xf77f('0x19')][_0xf77f('0x1d')],function(_0x4f3ae2){return{'model':db[_0x4f3ae2['model']],'as':_0x4f3ae2['as'],'attributes':_0x4f3ae2[_0xf77f('0x1b')],'include':_0x4f3ae2[_0xf77f('0x1d')]?_[_0xf77f('0x1e')](_0x4f3ae2['include'],function(_0x4cf629){return{'model':db[_0x4cf629[_0xf77f('0x1f')]],'as':_0x4cf629['as'],'attributes':_0x4cf629[_0xf77f('0x1b')],'include':_0x4cf629['include']?_[_0xf77f('0x1e')](_0x4cf629[_0xf77f('0x1d')],function(_0x3c369a){return{'model':db[_0x3c369a[_0xf77f('0x1f')]],'as':_0x3c369a['as'],'attributes':_0x3c369a[_0xf77f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a8959){logger[_0xf77f('0x15')]('ShowChatQueue',_0xd49582);logger[_0xf77f('0xe')](_0xf77f('0x22'),_0xd49582,JSON[_0xf77f('0x10')](_0x1a8959));_0x418a94(_0x1a8959);})['catch'](function(_0x10a289){logger[_0xf77f('0x11')](_0xf77f('0x22'),_0x10a289[_0xf77f('0x13')],_0xd49582);_0x275daf(_0x1fd637[_0xf77f('0x11')](0x1f4,_0x10a289[_0xf77f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 15f410c..a4ee468 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(_0x258874,_0x44e5fa){var _0x29a74a=function(_0x3df241){while(--_0x3df241){_0x258874['push'](_0x258874['shift']());}};_0x29a74a(++_0x44e5fa);}(_0xadb5,0xad));var _0x5adb=function(_0x50f8aa,_0x3cb8c1){_0x50f8aa=_0x50f8aa-0x0;var _0x569c26=_0xadb5[_0x50f8aa];return _0x569c26;};'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 _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x1d6064,_0x12988){var _0x4ae81c=function(_0x691669){while(--_0x691669){_0x1d6064['push'](_0x1d6064['shift']());}};_0x4ae81c(++_0x12988);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1376ece..8e85b59 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 _0x89e5=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x43b2f3,_0x248b7f){var _0x56650c=function(_0x4b68b9){while(--_0x4b68b9){_0x43b2f3['push'](_0x43b2f3['shift']());}};_0x56650c(++_0x248b7f);}(_0x89e5,0x186));var _0x589e=function(_0x4e0950,_0x109075){_0x4e0950=_0x4e0950-0x0;var _0x39524d=_0x89e5[_0x4e0950];return _0x39524d;};'use strict';var multer=require(_0x589e('0x0'));var util=require(_0x589e('0x1'));var path=require(_0x589e('0x2'));var timeout=require(_0x589e('0x3'));var express=require(_0x589e('0x4'));var router=express[_0x589e('0x5')]();var fs_extra=require(_0x589e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x589e('0x7'));var config=require(_0x589e('0x8'));var controller=require(_0x589e('0x9'));router[_0x589e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x589e('0xa')](_0x589e('0xb'),auth[_0x589e('0xc')](),controller['describe']);router[_0x589e('0xa')](_0x589e('0xd'),auth['isAuthenticated'](),controller[_0x589e('0xe')]);router[_0x589e('0xa')]('/:id/members',auth[_0x589e('0xc')](),controller[_0x589e('0xf')]);router[_0x589e('0xa')](_0x589e('0x10'),auth[_0x589e('0xc')](),controller[_0x589e('0x11')]);router['get'](_0x589e('0x12'),auth[_0x589e('0xc')](),controller[_0x589e('0x13')]);router[_0x589e('0x14')]('/',auth[_0x589e('0xc')](),controller[_0x589e('0x15')]);router[_0x589e('0x14')](_0x589e('0x10'),auth[_0x589e('0xc')](),controller[_0x589e('0x16')]);router[_0x589e('0x14')](_0x589e('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x589e('0xd'),auth[_0x589e('0xc')](),controller[_0x589e('0x17')]);router['delete'](_0x589e('0xd'),auth[_0x589e('0xc')](),controller[_0x589e('0x18')]);router['delete'](_0x589e('0x10'),auth[_0x589e('0xc')](),controller[_0x589e('0x19')]);router['delete'](_0x589e('0x12'),auth[_0x589e('0xc')](),controller[_0x589e('0x1a')]);module[_0x589e('0x1b')]=router; \ No newline at end of file +var _0x78b3=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x3e410c,_0x3675c0){var _0x48605a=function(_0x3c7007){while(--_0x3c7007){_0x3e410c['push'](_0x3e410c['shift']());}};_0x48605a(++_0x3675c0);}(_0x78b3,0x151));var _0x378b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78b3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x378b('0x0'));var util=require(_0x378b('0x1'));var path=require(_0x378b('0x2'));var timeout=require(_0x378b('0x3'));var express=require(_0x378b('0x4'));var router=express['Router']();var fs_extra=require(_0x378b('0x5'));var auth=require(_0x378b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x378b('0x7'));var controller=require(_0x378b('0x8'));router[_0x378b('0x9')]('/',auth[_0x378b('0xa')](),controller['index']);router[_0x378b('0x9')](_0x378b('0xb'),auth[_0x378b('0xa')](),controller['describe']);router['get'](_0x378b('0xc'),auth['isAuthenticated'](),controller[_0x378b('0xd')]);router[_0x378b('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x378b('0x9')](_0x378b('0xe'),auth[_0x378b('0xa')](),controller[_0x378b('0xf')]);router[_0x378b('0x9')](_0x378b('0x10'),auth[_0x378b('0xa')](),controller[_0x378b('0x11')]);router[_0x378b('0x12')]('/',auth[_0x378b('0xa')](),controller[_0x378b('0x13')]);router[_0x378b('0x12')](_0x378b('0xe'),auth[_0x378b('0xa')](),controller[_0x378b('0x14')]);router[_0x378b('0x12')](_0x378b('0x10'),auth['isAuthenticated'](),controller[_0x378b('0x15')]);router[_0x378b('0x16')](_0x378b('0xc'),auth[_0x378b('0xa')](),controller[_0x378b('0x17')]);router[_0x378b('0x18')](_0x378b('0xc'),auth[_0x378b('0xa')](),controller[_0x378b('0x19')]);router[_0x378b('0x18')](_0x378b('0xe'),auth[_0x378b('0xa')](),controller[_0x378b('0x1a')]);router['delete'](_0x378b('0x10'),auth[_0x378b('0xa')](),controller['removeAgents']);module[_0x378b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 866ba40..24f47c5 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 _0x22c6=['moment','STRING','DATE'];(function(_0x4b7c1b,_0x55f8ee){var _0x184800=function(_0x3ce0e7){while(--_0x3ce0e7){_0x4b7c1b['push'](_0x4b7c1b['shift']());}};_0x184800(++_0x55f8ee);}(_0x22c6,0x126));var _0x622c=function(_0x40579d,_0x5e007d){_0x40579d=_0x40579d-0x0;var _0xbd53e2=_0x22c6[_0x40579d];return _0xbd53e2;};'use strict';var moment=require(_0x622c('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x622c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x622c('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x622c('0x2')]},'acceptAt':{'type':Sequelize[_0x622c('0x2')]},'exitAt':{'type':Sequelize[_0x622c('0x2')]},'reason':{'type':Sequelize[_0x622c('0x1')]}}; \ No newline at end of file +var _0xd61b=['STRING','DATE','moment','sequelize','exports'];(function(_0x59a513,_0x46054f){var _0x4d1397=function(_0x6bcd89){while(--_0x6bcd89){_0x59a513['push'](_0x59a513['shift']());}};_0x4d1397(++_0x46054f);}(_0xd61b,0x192));var _0xbd61=function(_0x3eceb2,_0x509ff8){_0x3eceb2=_0x3eceb2-0x0;var _0x818bc4=_0xd61b[_0x3eceb2];return _0x818bc4;};'use strict';var moment=require(_0xbd61('0x0'));var Sequelize=require(_0xbd61('0x1'));module[_0xbd61('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbd61('0x3')]},'joinAt':{'type':Sequelize[_0xbd61('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbd61('0x4')]},'exitAt':{'type':Sequelize[_0xbd61('0x4')]},'reason':{'type':Sequelize[_0xbd61('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 85ee252..ab08f8c 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 _0xc57b=['filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4a7794,_0xba2116){var _0x13e343=function(_0x33f927){while(--_0x33f927){_0x4a7794['push'](_0x4a7794['shift']());}};_0x13e343(++_0xba2116);}(_0xc57b,0x19c));var _0xbc57=function(_0x4df8c2,_0x553f19){_0x4df8c2=_0x4df8c2-0x0;var _0x49ed23=_0xc57b[_0x4df8c2];return _0x49ed23;};'use strict';var emlformat=require(_0xbc57('0x0'));var rimraf=require(_0xbc57('0x1'));var zipdir=require(_0xbc57('0x2'));var jsonpatch=require(_0xbc57('0x3'));var rp=require(_0xbc57('0x4'));var moment=require(_0xbc57('0x5'));var BPromise=require(_0xbc57('0x6'));var Mustache=require(_0xbc57('0x7'));var util=require(_0xbc57('0x8'));var path=require(_0xbc57('0x9'));var sox=require(_0xbc57('0xa'));var csv=require('to-csv');var ejs=require(_0xbc57('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbc57('0xc'));var crypto=require('crypto');var jsforce=require(_0xbc57('0xd'));var deskjs=require(_0xbc57('0xe'));var toCsv=require(_0xbc57('0xf'));var querystring=require(_0xbc57('0x10'));var Papa=require(_0xbc57('0x11'));var Redis=require('ioredis');var authService=require(_0xbc57('0x12'));var qs=require(_0xbc57('0x13'));var as=require(_0xbc57('0x14'));var hardwareService=require(_0xbc57('0x15'));var logger=require(_0xbc57('0x16'))(_0xbc57('0x17'));var utils=require(_0xbc57('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbc57('0x19'));var db=require(_0xbc57('0x1a'))['db'];function respondWithStatusCode(_0x3407e3,_0x5fcd8f){_0x5fcd8f=_0x5fcd8f||0xcc;return function(_0x478e65){if(_0x478e65){return _0x3407e3[_0xbc57('0x1b')](_0x5fcd8f);}return _0x3407e3[_0xbc57('0x1c')](_0x5fcd8f)[_0xbc57('0x1d')]();};}function respondWithResult(_0x2d9b3c,_0x10f5f7){_0x10f5f7=_0x10f5f7||0xc8;return function(_0x34dd03){if(_0x34dd03){return _0x2d9b3c[_0xbc57('0x1c')](_0x10f5f7)[_0xbc57('0x1e')](_0x34dd03);}};}function respondWithFilteredResult(_0x227240,_0x214f3b){return function(_0x6db744){if(_0x6db744){var _0x1cb1d7=typeof _0x214f3b[_0xbc57('0x1f')]===_0xbc57('0x20')&&typeof _0x214f3b[_0xbc57('0x21')]==='undefined';var _0x1af972=_0x6db744[_0xbc57('0x22')];var _0x586db7=_0x1cb1d7?0x0:_0x214f3b[_0xbc57('0x1f')];var _0x19e1fa=_0x1cb1d7?_0x6db744['count']:_0x214f3b['offset']+_0x214f3b[_0xbc57('0x21')];var _0x513d3f;if(_0x19e1fa>=_0x1af972){_0x19e1fa=_0x1af972;_0x513d3f=0xc8;}else{_0x513d3f=0xce;}_0x227240[_0xbc57('0x1c')](_0x513d3f);return _0x227240[_0xbc57('0x23')](_0xbc57('0x24'),_0x586db7+'-'+_0x19e1fa+'/'+_0x1af972)['json'](_0x6db744);}return null;};}function patchUpdates(_0x276b5f){return function(_0x684e6f){try{jsonpatch['apply'](_0x684e6f,_0x276b5f,!![]);}catch(_0x1e6055){return BPromise['reject'](_0x1e6055);}return _0x684e6f[_0xbc57('0x25')]();};}function saveUpdates(_0x2a9366,_0x4f339b){return function(_0x1bb0ed){if(_0x1bb0ed){return _0x1bb0ed['update'](_0x2a9366)[_0xbc57('0x26')](function(_0x6cd9c6){return _0x6cd9c6;});}return null;};}function removeEntity(_0x1e1772,_0x1e597c){return function(_0x459d87){if(_0x459d87){return _0x459d87[_0xbc57('0x27')]()['then'](function(){_0x1e1772['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ccbb0,_0x1f5d21){return function(_0x2a8c4e){if(!_0x2a8c4e){_0x3ccbb0['sendStatus'](0x194);}return _0x2a8c4e;};}function handleError(_0x36a99b,_0x486294){_0x486294=_0x486294||0x1f4;return function(_0x5d4a73){logger[_0xbc57('0x28')](_0x5d4a73[_0xbc57('0x29')]);if(_0x5d4a73['name']){delete _0x5d4a73[_0xbc57('0x2a')];}_0x36a99b['status'](_0x486294)[_0xbc57('0x2b')](_0x5d4a73);};}exports[_0xbc57('0x2c')]=function(_0x139dd0,_0x28b963){var _0x26d5fc={},_0x5f1b13={},_0x31d896={'count':0x0,'rows':[]};var _0x111a21=_[_0xbc57('0x2d')](db[_0xbc57('0x2e')]['rawAttributes'],function(_0x4778d7){return{'name':_0x4778d7[_0xbc57('0x2f')],'type':_0x4778d7[_0xbc57('0x30')][_0xbc57('0x31')]};});_0x5f1b13[_0xbc57('0x32')]=_[_0xbc57('0x2d')](_0x111a21,_0xbc57('0x2a'));_0x5f1b13[_0xbc57('0x33')]=_[_0xbc57('0x34')](_0x139dd0[_0xbc57('0x33')]);_0x5f1b13['filters']=_[_0xbc57('0x35')](_0x5f1b13[_0xbc57('0x32')],_0x5f1b13[_0xbc57('0x33')]);_0x26d5fc[_0xbc57('0x36')]=_['intersection'](_0x5f1b13[_0xbc57('0x32')],qs[_0xbc57('0x37')](_0x139dd0[_0xbc57('0x33')]['fields']));_0x26d5fc[_0xbc57('0x36')]=_0x26d5fc[_0xbc57('0x36')][_0xbc57('0x38')]?_0x26d5fc['attributes']:_0x5f1b13[_0xbc57('0x32')];if(!_0x139dd0['query'][_0xbc57('0x39')](_0xbc57('0x3a'))){_0x26d5fc['limit']=qs[_0xbc57('0x21')](_0x139dd0[_0xbc57('0x33')]['limit']);_0x26d5fc['offset']=qs[_0xbc57('0x1f')](_0x139dd0['query']['offset']);}_0x26d5fc[_0xbc57('0x3b')]=qs[_0xbc57('0x3c')](_0x139dd0[_0xbc57('0x33')]['sort']);_0x26d5fc[_0xbc57('0x3d')]=qs[_0xbc57('0x3e')](_['pick'](_0x139dd0[_0xbc57('0x33')],_0x5f1b13[_0xbc57('0x3e')]),_0x111a21);if(_0x139dd0[_0xbc57('0x33')][_0xbc57('0x3f')]){_0x26d5fc[_0xbc57('0x3d')]=_['merge'](_0x26d5fc[_0xbc57('0x3d')],{'$or':_[_0xbc57('0x2d')](_0x111a21,function(_0x46ff72){if(_0x46ff72[_0xbc57('0x30')]!==_0xbc57('0x40')){var _0x246776={};_0x246776[_0x46ff72['name']]={'$like':'%'+_0x139dd0[_0xbc57('0x33')][_0xbc57('0x3f')]+'%'};return _0x246776;}})});}_0x26d5fc=_[_0xbc57('0x41')]({},_0x26d5fc,_0x139dd0[_0xbc57('0x42')]);var _0x28aa33={'where':_0x26d5fc[_0xbc57('0x3d')]};return db[_0xbc57('0x2e')][_0xbc57('0x22')](_0x28aa33)[_0xbc57('0x26')](function(_0x528545){_0x31d896['count']=_0x528545;if(_0x139dd0['query']['includeAll']){_0x26d5fc[_0xbc57('0x43')]=[{'all':!![]}];}return db[_0xbc57('0x2e')][_0xbc57('0x44')](_0x26d5fc);})[_0xbc57('0x26')](function(_0x5597d7){_0x31d896[_0xbc57('0x45')]=_0x5597d7;return _0x31d896;})[_0xbc57('0x26')](respondWithFilteredResult(_0x28b963,_0x26d5fc))[_0xbc57('0x46')](handleError(_0x28b963,null));};exports[_0xbc57('0x47')]=function(_0x30bf8c,_0x57ce87){var _0x2b8674={'raw':!![],'where':{'id':_0x30bf8c[_0xbc57('0x48')]['id']}},_0x92d278={};_0x92d278[_0xbc57('0x32')]=_[_0xbc57('0x34')](db[_0xbc57('0x2e')][_0xbc57('0x49')]);_0x92d278['query']=_[_0xbc57('0x34')](_0x30bf8c[_0xbc57('0x33')]);_0x92d278[_0xbc57('0x3e')]=_['intersection'](_0x92d278[_0xbc57('0x32')],_0x92d278[_0xbc57('0x33')]);_0x2b8674[_0xbc57('0x36')]=_[_0xbc57('0x35')](_0x92d278[_0xbc57('0x32')],qs[_0xbc57('0x37')](_0x30bf8c['query'][_0xbc57('0x37')]));_0x2b8674[_0xbc57('0x36')]=_0x2b8674[_0xbc57('0x36')][_0xbc57('0x38')]?_0x2b8674['attributes']:_0x92d278[_0xbc57('0x32')];if(_0x30bf8c[_0xbc57('0x33')][_0xbc57('0x4a')]){_0x2b8674['include']=[{'all':!![]}];}_0x2b8674=_[_0xbc57('0x41')]({},_0x2b8674,_0x30bf8c[_0xbc57('0x42')]);return db[_0xbc57('0x2e')]['find'](_0x2b8674)[_0xbc57('0x26')](handleEntityNotFound(_0x57ce87,null))[_0xbc57('0x26')](respondWithResult(_0x57ce87,null))[_0xbc57('0x46')](handleError(_0x57ce87,null));};exports[_0xbc57('0x4b')]=function(_0x5d6ca8,_0x29a448){return db['ChatQueueReport'][_0xbc57('0x4b')](_0x5d6ca8[_0xbc57('0x4c')],{})['then'](respondWithResult(_0x29a448,0xc9))[_0xbc57('0x46')](handleError(_0x29a448,null));};exports['update']=function(_0x4cc19e,_0x4c9df8){if(_0x4cc19e['body']['id']){delete _0x4cc19e['body']['id'];}return db[_0xbc57('0x2e')][_0xbc57('0x4d')]({'where':{'id':_0x4cc19e[_0xbc57('0x48')]['id']}})[_0xbc57('0x26')](handleEntityNotFound(_0x4c9df8,null))[_0xbc57('0x26')](saveUpdates(_0x4cc19e[_0xbc57('0x4c')],null))[_0xbc57('0x26')](respondWithResult(_0x4c9df8,null))[_0xbc57('0x46')](handleError(_0x4c9df8,null));};exports['destroy']=function(_0x3b1944,_0x279cef){return db[_0xbc57('0x2e')]['find']({'where':{'id':_0x3b1944['params']['id']}})['then'](handleEntityNotFound(_0x279cef,null))['then'](removeEntity(_0x279cef,null))['catch'](handleError(_0x279cef,null));};exports[_0xbc57('0x4e')]=function(_0x32bd90,_0x3f8b99){return db[_0xbc57('0x2e')][_0xbc57('0x4e')]()[_0xbc57('0x26')](respondWithResult(_0x3f8b99,null))[_0xbc57('0x46')](handleError(_0x3f8b99,null));}; \ No newline at end of file +var _0x8946=['sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','show','params','includeAll','include','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','order'];(function(_0x3e2723,_0x5224fc){var _0xf7f1d2=function(_0x4d06fb){while(--_0x4d06fb){_0x3e2723['push'](_0x3e2723['shift']());}};_0xf7f1d2(++_0x5224fc);}(_0x8946,0x143));var _0x6894=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x8946[_0x39c734];return _0xb2a2f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6894('0x0'));var zipdir=require(_0x6894('0x1'));var jsonpatch=require(_0x6894('0x2'));var rp=require('request-promise');var moment=require(_0x6894('0x3'));var BPromise=require(_0x6894('0x4'));var Mustache=require(_0x6894('0x5'));var util=require(_0x6894('0x6'));var path=require(_0x6894('0x7'));var sox=require(_0x6894('0x8'));var csv=require(_0x6894('0x9'));var ejs=require(_0x6894('0xa'));var fs=require('fs');var fs_extra=require(_0x6894('0xb'));var _=require(_0x6894('0xc'));var squel=require(_0x6894('0xd'));var crypto=require(_0x6894('0xe'));var jsforce=require(_0x6894('0xf'));var deskjs=require(_0x6894('0x10'));var toCsv=require(_0x6894('0x9'));var querystring=require(_0x6894('0x11'));var Papa=require(_0x6894('0x12'));var Redis=require(_0x6894('0x13'));var authService=require(_0x6894('0x14'));var qs=require(_0x6894('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6894('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x6894('0x17'));var licenseUtil=require(_0x6894('0x18'));var db=require(_0x6894('0x19'))['db'];function respondWithStatusCode(_0x3ea154,_0x26b319){_0x26b319=_0x26b319||0xcc;return function(_0x1a7f89){if(_0x1a7f89){return _0x3ea154[_0x6894('0x1a')](_0x26b319);}return _0x3ea154[_0x6894('0x1b')](_0x26b319)[_0x6894('0x1c')]();};}function respondWithResult(_0x3aa02c,_0x4d52ed){_0x4d52ed=_0x4d52ed||0xc8;return function(_0x34a6f1){if(_0x34a6f1){return _0x3aa02c[_0x6894('0x1b')](_0x4d52ed)[_0x6894('0x1d')](_0x34a6f1);}};}function respondWithFilteredResult(_0x58c473,_0x1ea22f){return function(_0x3cef2d){if(_0x3cef2d){var _0x17064b=typeof _0x1ea22f['offset']==='undefined'&&typeof _0x1ea22f['limit']==='undefined';var _0x116e97=_0x3cef2d['count'];var _0x28f107=_0x17064b?0x0:_0x1ea22f[_0x6894('0x1e')];var _0x51e706=_0x17064b?_0x3cef2d[_0x6894('0x1f')]:_0x1ea22f['offset']+_0x1ea22f[_0x6894('0x20')];var _0x532bfc;if(_0x51e706>=_0x116e97){_0x51e706=_0x116e97;_0x532bfc=0xc8;}else{_0x532bfc=0xce;}_0x58c473[_0x6894('0x1b')](_0x532bfc);return _0x58c473[_0x6894('0x21')]('Content-Range',_0x28f107+'-'+_0x51e706+'/'+_0x116e97)[_0x6894('0x1d')](_0x3cef2d);}return null;};}function patchUpdates(_0x2ad430){return function(_0xfa4209){try{jsonpatch[_0x6894('0x22')](_0xfa4209,_0x2ad430,!![]);}catch(_0x4522a1){return BPromise['reject'](_0x4522a1);}return _0xfa4209[_0x6894('0x23')]();};}function saveUpdates(_0x2c5b8f,_0x1d8f6a){return function(_0xa22790){if(_0xa22790){return _0xa22790[_0x6894('0x24')](_0x2c5b8f)[_0x6894('0x25')](function(_0x1d33a8){return _0x1d33a8;});}return null;};}function removeEntity(_0x481077,_0x3cbcb9){return function(_0x46b032){if(_0x46b032){return _0x46b032[_0x6894('0x26')]()[_0x6894('0x25')](function(){_0x481077['status'](0xcc)[_0x6894('0x1c')]();});}};}function handleEntityNotFound(_0x51273a,_0x470067){return function(_0x5bdac1){if(!_0x5bdac1){_0x51273a[_0x6894('0x1a')](0x194);}return _0x5bdac1;};}function handleError(_0x26d64d,_0x2ae13a){_0x2ae13a=_0x2ae13a||0x1f4;return function(_0x665492){logger[_0x6894('0x27')](_0x665492[_0x6894('0x28')]);if(_0x665492['name']){delete _0x665492[_0x6894('0x29')];}_0x26d64d[_0x6894('0x1b')](_0x2ae13a)['send'](_0x665492);};}exports[_0x6894('0x2a')]=function(_0x1da611,_0x548c34){var _0x5f599e={},_0x475421={},_0x19f2eb={'count':0x0,'rows':[]};var _0x517da3=_[_0x6894('0x2b')](db[_0x6894('0x2c')][_0x6894('0x2d')],function(_0x23813e){return{'name':_0x23813e[_0x6894('0x2e')],'type':_0x23813e['type'][_0x6894('0x2f')]};});_0x475421['model']=_['map'](_0x517da3,_0x6894('0x29'));_0x475421[_0x6894('0x30')]=_[_0x6894('0x31')](_0x1da611['query']);_0x475421[_0x6894('0x32')]=_[_0x6894('0x33')](_0x475421[_0x6894('0x34')],_0x475421[_0x6894('0x30')]);_0x5f599e['attributes']=_['intersection'](_0x475421['model'],qs[_0x6894('0x35')](_0x1da611[_0x6894('0x30')][_0x6894('0x35')]));_0x5f599e[_0x6894('0x36')]=_0x5f599e[_0x6894('0x36')][_0x6894('0x37')]?_0x5f599e['attributes']:_0x475421[_0x6894('0x34')];if(!_0x1da611[_0x6894('0x30')]['hasOwnProperty']('nolimit')){_0x5f599e[_0x6894('0x20')]=qs[_0x6894('0x20')](_0x1da611[_0x6894('0x30')][_0x6894('0x20')]);_0x5f599e[_0x6894('0x1e')]=qs[_0x6894('0x1e')](_0x1da611[_0x6894('0x30')][_0x6894('0x1e')]);}_0x5f599e[_0x6894('0x38')]=qs[_0x6894('0x39')](_0x1da611[_0x6894('0x30')][_0x6894('0x39')]);_0x5f599e['where']=qs[_0x6894('0x32')](_[_0x6894('0x3a')](_0x1da611[_0x6894('0x30')],_0x475421[_0x6894('0x32')]),_0x517da3);if(_0x1da611['query'][_0x6894('0x3b')]){_0x5f599e[_0x6894('0x3c')]=_[_0x6894('0x3d')](_0x5f599e['where'],{'$or':_[_0x6894('0x2b')](_0x517da3,function(_0x339dc5){if(_0x339dc5[_0x6894('0x3e')]!==_0x6894('0x3f')){var _0x5a6c5f={};_0x5a6c5f[_0x339dc5['name']]={'$like':'%'+_0x1da611[_0x6894('0x30')][_0x6894('0x3b')]+'%'};return _0x5a6c5f;}})});}_0x5f599e=_[_0x6894('0x3d')]({},_0x5f599e,_0x1da611[_0x6894('0x40')]);var _0x2b1c1b={'where':_0x5f599e[_0x6894('0x3c')]};return db['ChatQueueReport'][_0x6894('0x1f')](_0x2b1c1b)['then'](function(_0x387500){_0x19f2eb[_0x6894('0x1f')]=_0x387500;if(_0x1da611[_0x6894('0x30')]['includeAll']){_0x5f599e['include']=[{'all':!![]}];}return db[_0x6894('0x2c')][_0x6894('0x41')](_0x5f599e);})[_0x6894('0x25')](function(_0x55294d){_0x19f2eb[_0x6894('0x42')]=_0x55294d;return _0x19f2eb;})[_0x6894('0x25')](respondWithFilteredResult(_0x548c34,_0x5f599e))['catch'](handleError(_0x548c34,null));};exports[_0x6894('0x43')]=function(_0x4a4de4,_0x1f3f2e){var _0x48881b={'raw':!![],'where':{'id':_0x4a4de4[_0x6894('0x44')]['id']}},_0x5b55cc={};_0x5b55cc[_0x6894('0x34')]=_[_0x6894('0x31')](db['ChatQueueReport'][_0x6894('0x2d')]);_0x5b55cc[_0x6894('0x30')]=_[_0x6894('0x31')](_0x4a4de4[_0x6894('0x30')]);_0x5b55cc[_0x6894('0x32')]=_[_0x6894('0x33')](_0x5b55cc['model'],_0x5b55cc['query']);_0x48881b[_0x6894('0x36')]=_[_0x6894('0x33')](_0x5b55cc['model'],qs[_0x6894('0x35')](_0x4a4de4[_0x6894('0x30')]['fields']));_0x48881b[_0x6894('0x36')]=_0x48881b[_0x6894('0x36')][_0x6894('0x37')]?_0x48881b[_0x6894('0x36')]:_0x5b55cc[_0x6894('0x34')];if(_0x4a4de4[_0x6894('0x30')][_0x6894('0x45')]){_0x48881b[_0x6894('0x46')]=[{'all':!![]}];}_0x48881b=_[_0x6894('0x3d')]({},_0x48881b,_0x4a4de4[_0x6894('0x40')]);return db['ChatQueueReport']['find'](_0x48881b)['then'](handleEntityNotFound(_0x1f3f2e,null))['then'](respondWithResult(_0x1f3f2e,null))[_0x6894('0x47')](handleError(_0x1f3f2e,null));};exports[_0x6894('0x48')]=function(_0x4ebde2,_0x25f09c){return db[_0x6894('0x2c')]['create'](_0x4ebde2[_0x6894('0x49')],{})['then'](respondWithResult(_0x25f09c,0xc9))['catch'](handleError(_0x25f09c,null));};exports['update']=function(_0x245866,_0x11508f){if(_0x245866['body']['id']){delete _0x245866[_0x6894('0x49')]['id'];}return db[_0x6894('0x2c')]['find']({'where':{'id':_0x245866[_0x6894('0x44')]['id']}})[_0x6894('0x25')](handleEntityNotFound(_0x11508f,null))[_0x6894('0x25')](saveUpdates(_0x245866['body'],null))['then'](respondWithResult(_0x11508f,null))[_0x6894('0x47')](handleError(_0x11508f,null));};exports['destroy']=function(_0x3dce20,_0xa957aa){return db[_0x6894('0x2c')][_0x6894('0x4a')]({'where':{'id':_0x3dce20[_0x6894('0x44')]['id']}})[_0x6894('0x25')](handleEntityNotFound(_0xa957aa,null))[_0x6894('0x25')](removeEntity(_0xa957aa,null))['catch'](handleError(_0xa957aa,null));};exports[_0x6894('0x4b')]=function(_0x43ff6d,_0x3c1c17){return db['ChatQueueReport']['describe']()['then'](respondWithResult(_0x3c1c17,null))[_0x6894('0x47')](handleError(_0x3c1c17,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ee67847..6be6c87 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 _0xfee3=['report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','ChatQueueReport'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfee3,0xc5));var _0x3fee=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0xfee3[_0x393d69];return _0x3cee37;};'use strict';var _=require('lodash');var util=require(_0x3fee('0x0'));var logger=require(_0x3fee('0x1'))(_0x3fee('0x2'));var moment=require(_0x3fee('0x3'));var BPromise=require(_0x3fee('0x4'));var rp=require(_0x3fee('0x5'));var fs=require('fs');var path=require(_0x3fee('0x6'));var rimraf=require(_0x3fee('0x7'));var config=require(_0x3fee('0x8'));var attributes=require(_0x3fee('0x9'));module['exports']=function(_0x5e2fdf,_0xa09b5c){return _0x5e2fdf['define'](_0x3fee('0xa'),attributes,{'tableName':_0x3fee('0xb'),'paranoid':![],'indexes':[{'name':_0x3fee('0xc'),'fields':[_0x3fee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f27=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','define','report_chat_queue','uniqueid','lodash'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0x0f27,0x1eb));var _0x70f2=function(_0x20ff64,_0x5c3677){_0x20ff64=_0x20ff64-0x0;var _0x5580db=_0x0f27[_0x20ff64];return _0x5580db;};'use strict';var _=require(_0x70f2('0x0'));var util=require(_0x70f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x70f2('0x2'));var BPromise=require(_0x70f2('0x3'));var rp=require(_0x70f2('0x4'));var fs=require('fs');var path=require(_0x70f2('0x5'));var rimraf=require(_0x70f2('0x6'));var config=require(_0x70f2('0x7'));var attributes=require(_0x70f2('0x8'));module['exports']=function(_0x5bd91d,_0x295fd5){return _0x5bd91d[_0x70f2('0x9')]('ChatQueueReport',attributes,{'tableName':_0x70f2('0xa'),'paranoid':![],'indexes':[{'name':_0x70f2('0xb'),'fields':[_0x70f2('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 b926ff4..5811e50 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 _0xaa88=['create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','debug','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0xaa88,0xea));var _0x8aa8=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0xaa88[_0x75ce5b];return _0x22195e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8aa8('0x0'));var fs=require('fs');var Redis=require(_0x8aa8('0x1'));var db=require(_0x8aa8('0x2'))['db'];var utils=require(_0x8aa8('0x3'));var logger=require(_0x8aa8('0x4'))(_0x8aa8('0x5'));var config=require(_0x8aa8('0x6'));var jayson=require(_0x8aa8('0x7'));var client=jayson[_0x8aa8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126683,_0x201ee6,_0x151a66){return new BPromise(function(_0x36e99d,_0x510df2){return client[_0x8aa8('0x9')](_0x126683,_0x151a66)[_0x8aa8('0xa')](function(_0xefdc33){logger[_0x8aa8('0xb')](_0x8aa8('0xc'),_0x201ee6,_0x8aa8('0xd'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x201ee6,_0x8aa8('0xd'),JSON[_0x8aa8('0xe')](_0xefdc33));if(_0xefdc33[_0x8aa8('0xf')]){if(_0xefdc33['error'][_0x8aa8('0x10')]===0x1f4){logger[_0x8aa8('0xf')](_0x8aa8('0xc'),_0x201ee6,_0xefdc33[_0x8aa8('0xf')][_0x8aa8('0x11')]);return _0x510df2(_0xefdc33[_0x8aa8('0xf')]['message']);}logger[_0x8aa8('0xf')](_0x8aa8('0xc'),_0x201ee6,_0xefdc33[_0x8aa8('0xf')]['message']);return _0x36e99d(_0xefdc33[_0x8aa8('0xf')][_0x8aa8('0x11')]);}else{logger[_0x8aa8('0xb')](_0x8aa8('0xc'),_0x201ee6,_0x8aa8('0xd'));_0x36e99d(_0xefdc33[_0x8aa8('0x12')][_0x8aa8('0x11')]);}})[_0x8aa8('0x13')](function(_0x60cef){logger[_0x8aa8('0xf')](_0x8aa8('0xc'),_0x201ee6,_0x60cef);_0x510df2(_0x60cef);});});}exports[_0x8aa8('0x14')]=function(_0x4dfc08){var _0x20c87d=this;return new Promise(function(_0x1ecce7,_0x54c39f){return db[_0x8aa8('0x15')][_0x8aa8('0x16')](_0x4dfc08[_0x8aa8('0x17')],{'raw':_0x4dfc08[_0x8aa8('0x18')]?_0x4dfc08[_0x8aa8('0x18')][_0x8aa8('0x19')]===undefined?!![]:![]:!![]})[_0x8aa8('0xa')](function(_0x54ba8b){logger[_0x8aa8('0xb')](_0x8aa8('0x14'),_0x4dfc08);logger['debug']('CreateChatQueueReport',_0x4dfc08,JSON[_0x8aa8('0xe')](_0x54ba8b));_0x1ecce7(_0x54ba8b);})[_0x8aa8('0x13')](function(_0x561e51){logger[_0x8aa8('0xf')](_0x8aa8('0x14'),_0x561e51['message'],_0x4dfc08);_0x54c39f(_0x20c87d[_0x8aa8('0xf')](0x1f4,_0x561e51[_0x8aa8('0x11')]));});});};exports[_0x8aa8('0x1a')]=function(_0x51624d){var _0x1cb77a=this;return new Promise(function(_0x51ae5e,_0x264c68){return db[_0x8aa8('0x15')][_0x8aa8('0x1b')](_0x51624d[_0x8aa8('0x17')],{'raw':_0x51624d[_0x8aa8('0x18')]?_0x51624d[_0x8aa8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51624d[_0x8aa8('0x18')]?_0x51624d[_0x8aa8('0x18')][_0x8aa8('0x1c')]||null:null,'attributes':_0x51624d[_0x8aa8('0x18')]?_0x51624d[_0x8aa8('0x18')][_0x8aa8('0x1d')]||null:null,'limit':_0x51624d['options']?_0x51624d[_0x8aa8('0x18')][_0x8aa8('0x1e')]||null:null})[_0x8aa8('0xa')](function(_0x2864bd){logger[_0x8aa8('0xb')](_0x8aa8('0x1a'),_0x51624d);logger[_0x8aa8('0x1f')]('UpdateChatQueueReport',_0x51624d,JSON[_0x8aa8('0xe')](_0x2864bd));_0x51ae5e(_0x2864bd);})[_0x8aa8('0x13')](function(_0x50253b){logger[_0x8aa8('0xf')](_0x8aa8('0x1a'),_0x50253b[_0x8aa8('0x11')],_0x51624d);_0x264c68(_0x1cb77a[_0x8aa8('0xf')](0x1f4,_0x50253b[_0x8aa8('0x11')]));});});}; \ No newline at end of file +var _0x0a17=['rpc','client','http','request','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','then','info','UpdateChatQueueReport','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x59a8e6,_0x3e38ae){var _0xb59477=function(_0x72cd70){while(--_0x72cd70){_0x59a8e6['push'](_0x59a8e6['shift']());}};_0xb59477(++_0x3e38ae);}(_0x0a17,0x156));var _0x70a1=function(_0x28ac3f,_0x31c929){_0x28ac3f=_0x28ac3f-0x0;var _0x2fdb62=_0x0a17[_0x28ac3f];return _0x2fdb62;};'use strict';var _=require(_0x70a1('0x0'));var util=require('util');var moment=require(_0x70a1('0x1'));var BPromise=require(_0x70a1('0x2'));var rs=require(_0x70a1('0x3'));var fs=require('fs');var Redis=require(_0x70a1('0x4'));var db=require(_0x70a1('0x5'))['db'];var utils=require(_0x70a1('0x6'));var logger=require(_0x70a1('0x7'))(_0x70a1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x70a1('0x9')][_0x70a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cd8b0,_0x57a911,_0x44b55c){return new BPromise(function(_0x1affd0,_0x2a6e10){return client[_0x70a1('0xb')](_0x4cd8b0,_0x44b55c)['then'](function(_0x502bcc){logger['info'](_0x70a1('0xc'),_0x57a911,'request\x20sent');logger[_0x70a1('0xd')](_0x70a1('0xe'),_0x57a911,_0x70a1('0xf'),JSON[_0x70a1('0x10')](_0x502bcc));if(_0x502bcc[_0x70a1('0x11')]){if(_0x502bcc[_0x70a1('0x11')][_0x70a1('0x12')]===0x1f4){logger['error'](_0x70a1('0xc'),_0x57a911,_0x502bcc[_0x70a1('0x11')][_0x70a1('0x13')]);return _0x2a6e10(_0x502bcc['error'][_0x70a1('0x13')]);}logger[_0x70a1('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x57a911,_0x502bcc[_0x70a1('0x11')][_0x70a1('0x13')]);return _0x1affd0(_0x502bcc[_0x70a1('0x11')]['message']);}else{logger['info'](_0x70a1('0xc'),_0x57a911,'request\x20sent');_0x1affd0(_0x502bcc[_0x70a1('0x14')][_0x70a1('0x13')]);}})[_0x70a1('0x15')](function(_0x19935e){logger[_0x70a1('0x11')](_0x70a1('0xc'),_0x57a911,_0x19935e);_0x2a6e10(_0x19935e);});});}exports[_0x70a1('0x16')]=function(_0x190b60){var _0x55f78d=this;return new Promise(function(_0x672581,_0x5d5dde){return db[_0x70a1('0x17')][_0x70a1('0x18')](_0x190b60[_0x70a1('0x19')],{'raw':_0x190b60[_0x70a1('0x1a')]?_0x190b60[_0x70a1('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x70a1('0x1b')](function(_0x24ef5e){logger[_0x70a1('0x1c')]('CreateChatQueueReport',_0x190b60);logger[_0x70a1('0xd')]('CreateChatQueueReport',_0x190b60,JSON[_0x70a1('0x10')](_0x24ef5e));_0x672581(_0x24ef5e);})[_0x70a1('0x15')](function(_0x3fcd68){logger[_0x70a1('0x11')](_0x70a1('0x16'),_0x3fcd68['message'],_0x190b60);_0x5d5dde(_0x55f78d['error'](0x1f4,_0x3fcd68['message']));});});};exports[_0x70a1('0x1d')]=function(_0x261d18){var _0x24e14b=this;return new Promise(function(_0x335083,_0x182e0b){return db[_0x70a1('0x17')][_0x70a1('0x1e')](_0x261d18[_0x70a1('0x19')],{'raw':_0x261d18[_0x70a1('0x1a')]?_0x261d18[_0x70a1('0x1a')][_0x70a1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x261d18[_0x70a1('0x1a')]?_0x261d18[_0x70a1('0x1a')][_0x70a1('0x20')]||null:null,'attributes':_0x261d18['options']?_0x261d18['options'][_0x70a1('0x21')]||null:null,'limit':_0x261d18[_0x70a1('0x1a')]?_0x261d18[_0x70a1('0x1a')][_0x70a1('0x22')]||null:null})[_0x70a1('0x1b')](function(_0x585b24){logger['info'](_0x70a1('0x1d'),_0x261d18);logger[_0x70a1('0xd')]('UpdateChatQueueReport',_0x261d18,JSON[_0x70a1('0x10')](_0x585b24));_0x335083(_0x585b24);})[_0x70a1('0x15')](function(_0x503984){logger[_0x70a1('0x11')]('UpdateChatQueueReport',_0x503984[_0x70a1('0x13')],_0x261d18);_0x182e0b(_0x24e14b['error'](0x1f4,_0x503984[_0x70a1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8ac8931..acda30a 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x389d1f,_0x3b1cdc){var _0x56d107=function(_0xb77af7){while(--_0xb77af7){_0x389d1f['push'](_0x389d1f['shift']());}};_0x56d107(++_0x3b1cdc);}(_0x7a54,0x106));var _0x47a5=function(_0x43a446,_0x36227e){_0x43a446=_0x43a446-0x0;var _0x5569c6=_0x7a54[_0x43a446];return _0x5569c6;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x34a7ce,_0x31bf97){var _0x4fa7fd=function(_0x4ba165){while(--_0x4ba165){_0x34a7ce['push'](_0x34a7ce['shift']());}};_0x4fa7fd(++_0x31bf97);}(_0x1261,0x144));var _0x1126=function(_0x54d5c8,_0x344ce5){_0x54d5c8=_0x54d5c8-0x0;var _0x525e2e=_0x1261[_0x54d5c8];return _0x525e2e;};'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 fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index efe4d49..15d1f1e 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 _0x905e=['DATE','moment','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x905e,0x1de));var _0xe905=function(_0x22a83d,_0x23cda6){_0x22a83d=_0x22a83d-0x0;var _0x18c41c=_0x905e[_0x22a83d];return _0x18c41c;};'use strict';var moment=require(_0xe905('0x0'));var Sequelize=require(_0xe905('0x1'));module[_0xe905('0x2')]={'uniqueid':{'type':Sequelize[_0xe905('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe905('0x4')](_0xe905('0x5'),_0xe905('0x6'),_0xe905('0x7')),'allowNull':![],'defaultValue':_0xe905('0x7')},'transferredAt':{'type':Sequelize[_0xe905('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xba02=['sequelize','exports','account','agent','queue','DATE','moment'];(function(_0x29ceed,_0x404d13){var _0x55a901=function(_0x39c254){while(--_0x39c254){_0x29ceed['push'](_0x29ceed['shift']());}};_0x55a901(++_0x404d13);}(_0xba02,0x13a));var _0x2ba0=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xba02[_0x307d86];return _0x361745;};'use strict';var moment=require(_0x2ba0('0x0'));var Sequelize=require(_0x2ba0('0x1'));module[_0x2ba0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2ba0('0x3'),_0x2ba0('0x4'),_0x2ba0('0x5')),'allowNull':![],'defaultValue':_0x2ba0('0x5')},'transferredAt':{'type':Sequelize[_0x2ba0('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 67bcced..de7846c 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 _0x3e67=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','send','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto'];(function(_0x51b15c,_0x2e6246){var _0x4bd87d=function(_0x16ff5c){while(--_0x16ff5c){_0x51b15c['push'](_0x51b15c['shift']());}};_0x4bd87d(++_0x2e6246);}(_0x3e67,0x179));var _0x73e6=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0x3e67[_0x56608c];return _0x3c7fb0;};'use strict';var emlformat=require(_0x73e6('0x0'));var rimraf=require(_0x73e6('0x1'));var zipdir=require(_0x73e6('0x2'));var jsonpatch=require(_0x73e6('0x3'));var rp=require(_0x73e6('0x4'));var moment=require(_0x73e6('0x5'));var BPromise=require(_0x73e6('0x6'));var Mustache=require('mustache');var util=require(_0x73e6('0x7'));var path=require('path');var sox=require(_0x73e6('0x8'));var csv=require('to-csv');var ejs=require(_0x73e6('0x9'));var fs=require('fs');var fs_extra=require(_0x73e6('0xa'));var _=require('lodash');var squel=require(_0x73e6('0xb'));var crypto=require(_0x73e6('0xc'));var jsforce=require(_0x73e6('0xd'));var deskjs=require(_0x73e6('0xe'));var toCsv=require(_0x73e6('0xf'));var querystring=require(_0x73e6('0x10'));var Papa=require(_0x73e6('0x11'));var Redis=require(_0x73e6('0x12'));var authService=require(_0x73e6('0x13'));var qs=require(_0x73e6('0x14'));var as=require(_0x73e6('0x15'));var hardwareService=require(_0x73e6('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x73e6('0x17'));var config=require(_0x73e6('0x18'));var licenseUtil=require(_0x73e6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x293a3f,_0x19c66d){_0x19c66d=_0x19c66d||0xcc;return function(_0x22bd76){if(_0x22bd76){return _0x293a3f[_0x73e6('0x1a')](_0x19c66d);}return _0x293a3f[_0x73e6('0x1b')](_0x19c66d)[_0x73e6('0x1c')]();};}function respondWithResult(_0x558b50,_0x424be7){_0x424be7=_0x424be7||0xc8;return function(_0x4d8d02){if(_0x4d8d02){return _0x558b50[_0x73e6('0x1b')](_0x424be7)[_0x73e6('0x1d')](_0x4d8d02);}};}function respondWithFilteredResult(_0x13aa65,_0x993957){return function(_0x1cdee1){if(_0x1cdee1){var _0x8af51c=typeof _0x993957[_0x73e6('0x1e')]==='undefined'&&typeof _0x993957['limit']===_0x73e6('0x1f');var _0x10d7c7=_0x1cdee1[_0x73e6('0x20')];var _0x18c54c=_0x8af51c?0x0:_0x993957[_0x73e6('0x1e')];var _0xfdbfc=_0x8af51c?_0x1cdee1[_0x73e6('0x20')]:_0x993957[_0x73e6('0x1e')]+_0x993957[_0x73e6('0x21')];var _0x47192b;if(_0xfdbfc>=_0x10d7c7){_0xfdbfc=_0x10d7c7;_0x47192b=0xc8;}else{_0x47192b=0xce;}_0x13aa65[_0x73e6('0x1b')](_0x47192b);return _0x13aa65[_0x73e6('0x22')](_0x73e6('0x23'),_0x18c54c+'-'+_0xfdbfc+'/'+_0x10d7c7)[_0x73e6('0x1d')](_0x1cdee1);}return null;};}function patchUpdates(_0x55c843){return function(_0x974b71){try{jsonpatch[_0x73e6('0x24')](_0x974b71,_0x55c843,!![]);}catch(_0x3b935f){return BPromise[_0x73e6('0x25')](_0x3b935f);}return _0x974b71[_0x73e6('0x26')]();};}function saveUpdates(_0x277e8c,_0x57623e){return function(_0x4cdf57){if(_0x4cdf57){return _0x4cdf57['update'](_0x277e8c)[_0x73e6('0x27')](function(_0x19885b){return _0x19885b;});}return null;};}function removeEntity(_0x474b95,_0x2101f3){return function(_0x56714d){if(_0x56714d){return _0x56714d['destroy']()[_0x73e6('0x27')](function(){_0x474b95[_0x73e6('0x1b')](0xcc)[_0x73e6('0x1c')]();});}};}function handleEntityNotFound(_0x57cf78,_0x39e84){return function(_0x439594){if(!_0x439594){_0x57cf78[_0x73e6('0x1a')](0x194);}return _0x439594;};}function handleError(_0x4ee40f,_0x19e665){_0x19e665=_0x19e665||0x1f4;return function(_0xf3baf){logger[_0x73e6('0x28')](_0xf3baf[_0x73e6('0x29')]);if(_0xf3baf['name']){delete _0xf3baf['name'];}_0x4ee40f[_0x73e6('0x1b')](_0x19e665)[_0x73e6('0x2a')](_0xf3baf);};}exports['index']=function(_0x2e3d7c,_0x93a9ae){var _0x50da32={},_0x5b64de={},_0x896020={'count':0x0,'rows':[]};var _0x1a90d1=_['map'](db['ChatTransferReport'][_0x73e6('0x2b')],function(_0x1ccb44){return{'name':_0x1ccb44[_0x73e6('0x2c')],'type':_0x1ccb44['type'][_0x73e6('0x2d')]};});_0x5b64de[_0x73e6('0x2e')]=_['map'](_0x1a90d1,_0x73e6('0x2f'));_0x5b64de['query']=_[_0x73e6('0x30')](_0x2e3d7c[_0x73e6('0x31')]);_0x5b64de[_0x73e6('0x32')]=_['intersection'](_0x5b64de['model'],_0x5b64de[_0x73e6('0x31')]);_0x50da32['attributes']=_[_0x73e6('0x33')](_0x5b64de['model'],qs[_0x73e6('0x34')](_0x2e3d7c[_0x73e6('0x31')][_0x73e6('0x34')]));_0x50da32['attributes']=_0x50da32[_0x73e6('0x35')][_0x73e6('0x36')]?_0x50da32[_0x73e6('0x35')]:_0x5b64de[_0x73e6('0x2e')];if(!_0x2e3d7c[_0x73e6('0x31')][_0x73e6('0x37')]('nolimit')){_0x50da32[_0x73e6('0x21')]=qs['limit'](_0x2e3d7c[_0x73e6('0x31')][_0x73e6('0x21')]);_0x50da32[_0x73e6('0x1e')]=qs[_0x73e6('0x1e')](_0x2e3d7c[_0x73e6('0x31')]['offset']);}_0x50da32[_0x73e6('0x38')]=qs[_0x73e6('0x39')](_0x2e3d7c[_0x73e6('0x31')][_0x73e6('0x39')]);_0x50da32['where']=qs['filters'](_[_0x73e6('0x3a')](_0x2e3d7c[_0x73e6('0x31')],_0x5b64de[_0x73e6('0x32')]),_0x1a90d1);if(_0x2e3d7c[_0x73e6('0x31')][_0x73e6('0x3b')]){_0x50da32[_0x73e6('0x3c')]=_[_0x73e6('0x3d')](_0x50da32[_0x73e6('0x3c')],{'$or':_[_0x73e6('0x3e')](_0x1a90d1,function(_0x4c7b6c){if(_0x4c7b6c[_0x73e6('0x3f')]!==_0x73e6('0x40')){var _0x25a9a8={};_0x25a9a8[_0x4c7b6c[_0x73e6('0x2f')]]={'$like':'%'+_0x2e3d7c[_0x73e6('0x31')][_0x73e6('0x3b')]+'%'};return _0x25a9a8;}})});}_0x50da32=_[_0x73e6('0x3d')]({},_0x50da32,_0x2e3d7c[_0x73e6('0x41')]);var _0x32e032={'where':_0x50da32['where']};return db[_0x73e6('0x42')]['count'](_0x32e032)['then'](function(_0x2958ed){_0x896020['count']=_0x2958ed;if(_0x2e3d7c[_0x73e6('0x31')][_0x73e6('0x43')]){_0x50da32[_0x73e6('0x44')]=[{'all':!![]}];}return db[_0x73e6('0x42')][_0x73e6('0x45')](_0x50da32);})[_0x73e6('0x27')](function(_0x2555e5){_0x896020[_0x73e6('0x46')]=_0x2555e5;return _0x896020;})[_0x73e6('0x27')](respondWithFilteredResult(_0x93a9ae,_0x50da32))[_0x73e6('0x47')](handleError(_0x93a9ae,null));};exports['show']=function(_0x52844d,_0xa69c6e){var _0x5ba5bb={'raw':!![],'where':{'id':_0x52844d[_0x73e6('0x48')]['id']}},_0x562b2b={};_0x562b2b[_0x73e6('0x2e')]=_[_0x73e6('0x30')](db['ChatTransferReport'][_0x73e6('0x2b')]);_0x562b2b[_0x73e6('0x31')]=_[_0x73e6('0x30')](_0x52844d['query']);_0x562b2b[_0x73e6('0x32')]=_[_0x73e6('0x33')](_0x562b2b[_0x73e6('0x2e')],_0x562b2b[_0x73e6('0x31')]);_0x5ba5bb[_0x73e6('0x35')]=_[_0x73e6('0x33')](_0x562b2b[_0x73e6('0x2e')],qs[_0x73e6('0x34')](_0x52844d['query'][_0x73e6('0x34')]));_0x5ba5bb[_0x73e6('0x35')]=_0x5ba5bb[_0x73e6('0x35')][_0x73e6('0x36')]?_0x5ba5bb['attributes']:_0x562b2b[_0x73e6('0x2e')];if(_0x52844d['query'][_0x73e6('0x43')]){_0x5ba5bb[_0x73e6('0x44')]=[{'all':!![]}];}_0x5ba5bb=_[_0x73e6('0x3d')]({},_0x5ba5bb,_0x52844d[_0x73e6('0x41')]);return db[_0x73e6('0x42')][_0x73e6('0x49')](_0x5ba5bb)[_0x73e6('0x27')](handleEntityNotFound(_0xa69c6e,null))[_0x73e6('0x27')](respondWithResult(_0xa69c6e,null))[_0x73e6('0x47')](handleError(_0xa69c6e,null));};exports[_0x73e6('0x4a')]=function(_0x51a588,_0x2f8c32){return db[_0x73e6('0x42')][_0x73e6('0x4a')](_0x51a588[_0x73e6('0x4b')],{})[_0x73e6('0x27')](respondWithResult(_0x2f8c32,0xc9))[_0x73e6('0x47')](handleError(_0x2f8c32,null));};exports[_0x73e6('0x4c')]=function(_0x1c07c0,_0x22f700){if(_0x1c07c0[_0x73e6('0x4b')]['id']){delete _0x1c07c0[_0x73e6('0x4b')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x1c07c0[_0x73e6('0x48')]['id']}})['then'](handleEntityNotFound(_0x22f700,null))[_0x73e6('0x27')](saveUpdates(_0x1c07c0['body'],null))['then'](respondWithResult(_0x22f700,null))[_0x73e6('0x47')](handleError(_0x22f700,null));};exports['destroy']=function(_0x3957de,_0x4fd26a){return db[_0x73e6('0x42')][_0x73e6('0x49')]({'where':{'id':_0x3957de[_0x73e6('0x48')]['id']}})[_0x73e6('0x27')](handleEntityNotFound(_0x4fd26a,null))[_0x73e6('0x27')](removeEntity(_0x4fd26a,null))[_0x73e6('0x47')](handleError(_0x4fd26a,null));};exports[_0x73e6('0x4d')]=function(_0xb0335c,_0x3d7821){return db[_0x73e6('0x42')][_0x73e6('0x4d')]()[_0x73e6('0x27')](respondWithResult(_0x3d7821,null))[_0x73e6('0x47')](handleError(_0x3d7821,null));}; \ No newline at end of file +var _0x086a=['reject','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatTransferReport','findAll','rows','catch','show','length','include','create','body','params','destroy','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x99b902,_0x37da84){var _0x2aff76=function(_0x3cd7df){while(--_0x3cd7df){_0x99b902['push'](_0x99b902['shift']());}};_0x2aff76(++_0x37da84);}(_0x086a,0xc4));var _0xa086=function(_0x765565,_0x132e25){_0x765565=_0x765565-0x0;var _0x670821=_0x086a[_0x765565];return _0x670821;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa086('0x0'));var zipdir=require(_0xa086('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa086('0x2'));var moment=require(_0xa086('0x3'));var BPromise=require(_0xa086('0x4'));var Mustache=require(_0xa086('0x5'));var util=require(_0xa086('0x6'));var path=require('path');var sox=require(_0xa086('0x7'));var csv=require(_0xa086('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa086('0x9'));var _=require(_0xa086('0xa'));var squel=require(_0xa086('0xb'));var crypto=require(_0xa086('0xc'));var jsforce=require(_0xa086('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa086('0x8'));var querystring=require(_0xa086('0xe'));var Papa=require(_0xa086('0xf'));var Redis=require(_0xa086('0x10'));var authService=require(_0xa086('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa086('0x12'));var hardwareService=require(_0xa086('0x13'));var logger=require(_0xa086('0x14'))(_0xa086('0x15'));var utils=require(_0xa086('0x16'));var config=require(_0xa086('0x17'));var licenseUtil=require(_0xa086('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a7734,_0x13814d){_0x13814d=_0x13814d||0xcc;return function(_0x578afc){if(_0x578afc){return _0x5a7734[_0xa086('0x19')](_0x13814d);}return _0x5a7734[_0xa086('0x1a')](_0x13814d)[_0xa086('0x1b')]();};}function respondWithResult(_0x3a9d8b,_0x26e719){_0x26e719=_0x26e719||0xc8;return function(_0xe02459){if(_0xe02459){return _0x3a9d8b[_0xa086('0x1a')](_0x26e719)[_0xa086('0x1c')](_0xe02459);}};}function respondWithFilteredResult(_0x3f0d0e,_0x3034f6){return function(_0x50f042){if(_0x50f042){var _0x389aca=typeof _0x3034f6[_0xa086('0x1d')]===_0xa086('0x1e')&&typeof _0x3034f6[_0xa086('0x1f')]===_0xa086('0x1e');var _0x145e85=_0x50f042[_0xa086('0x20')];var _0x13d978=_0x389aca?0x0:_0x3034f6[_0xa086('0x1d')];var _0x4694f5=_0x389aca?_0x50f042[_0xa086('0x20')]:_0x3034f6[_0xa086('0x1d')]+_0x3034f6[_0xa086('0x1f')];var _0x4e4031;if(_0x4694f5>=_0x145e85){_0x4694f5=_0x145e85;_0x4e4031=0xc8;}else{_0x4e4031=0xce;}_0x3f0d0e[_0xa086('0x1a')](_0x4e4031);return _0x3f0d0e[_0xa086('0x21')]('Content-Range',_0x13d978+'-'+_0x4694f5+'/'+_0x145e85)[_0xa086('0x1c')](_0x50f042);}return null;};}function patchUpdates(_0x70d626){return function(_0x14aa5f){try{jsonpatch[_0xa086('0x22')](_0x14aa5f,_0x70d626,!![]);}catch(_0x5e9c45){return BPromise[_0xa086('0x23')](_0x5e9c45);}return _0x14aa5f['save']();};}function saveUpdates(_0x221040,_0x58415f){return function(_0x19b70f){if(_0x19b70f){return _0x19b70f['update'](_0x221040)['then'](function(_0x5dbc42){return _0x5dbc42;});}return null;};}function removeEntity(_0x1fe899,_0x4f4b22){return function(_0x21455d){if(_0x21455d){return _0x21455d['destroy']()[_0xa086('0x24')](function(){_0x1fe899['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa8f1,_0x2cb1a2){return function(_0x25044b){if(!_0x25044b){_0x3fa8f1[_0xa086('0x19')](0x194);}return _0x25044b;};}function handleError(_0x159859,_0x6e43e9){_0x6e43e9=_0x6e43e9||0x1f4;return function(_0x140471){logger[_0xa086('0x25')](_0x140471[_0xa086('0x26')]);if(_0x140471['name']){delete _0x140471['name'];}_0x159859[_0xa086('0x1a')](_0x6e43e9)[_0xa086('0x27')](_0x140471);};}exports[_0xa086('0x28')]=function(_0x40ed23,_0x125538){var _0x352c10={},_0x20c1f0={},_0x4fb92a={'count':0x0,'rows':[]};var _0x5460f7=_[_0xa086('0x29')](db['ChatTransferReport'][_0xa086('0x2a')],function(_0x160597){return{'name':_0x160597[_0xa086('0x2b')],'type':_0x160597[_0xa086('0x2c')][_0xa086('0x2d')]};});_0x20c1f0['model']=_[_0xa086('0x29')](_0x5460f7,_0xa086('0x2e'));_0x20c1f0['query']=_[_0xa086('0x2f')](_0x40ed23[_0xa086('0x30')]);_0x20c1f0[_0xa086('0x31')]=_[_0xa086('0x32')](_0x20c1f0[_0xa086('0x33')],_0x20c1f0[_0xa086('0x30')]);_0x352c10[_0xa086('0x34')]=_[_0xa086('0x32')](_0x20c1f0[_0xa086('0x33')],qs[_0xa086('0x35')](_0x40ed23[_0xa086('0x30')][_0xa086('0x35')]));_0x352c10[_0xa086('0x34')]=_0x352c10[_0xa086('0x34')]['length']?_0x352c10[_0xa086('0x34')]:_0x20c1f0['model'];if(!_0x40ed23['query'][_0xa086('0x36')](_0xa086('0x37'))){_0x352c10[_0xa086('0x1f')]=qs[_0xa086('0x1f')](_0x40ed23['query'][_0xa086('0x1f')]);_0x352c10[_0xa086('0x1d')]=qs[_0xa086('0x1d')](_0x40ed23['query'][_0xa086('0x1d')]);}_0x352c10[_0xa086('0x38')]=qs['sort'](_0x40ed23[_0xa086('0x30')][_0xa086('0x39')]);_0x352c10[_0xa086('0x3a')]=qs[_0xa086('0x31')](_[_0xa086('0x3b')](_0x40ed23[_0xa086('0x30')],_0x20c1f0[_0xa086('0x31')]),_0x5460f7);if(_0x40ed23[_0xa086('0x30')]['filter']){_0x352c10[_0xa086('0x3a')]=_[_0xa086('0x3c')](_0x352c10[_0xa086('0x3a')],{'$or':_[_0xa086('0x29')](_0x5460f7,function(_0x20587c){if(_0x20587c[_0xa086('0x2c')]!==_0xa086('0x3d')){var _0xbe61ad={};_0xbe61ad[_0x20587c[_0xa086('0x2e')]]={'$like':'%'+_0x40ed23[_0xa086('0x30')][_0xa086('0x3e')]+'%'};return _0xbe61ad;}})});}_0x352c10=_[_0xa086('0x3c')]({},_0x352c10,_0x40ed23[_0xa086('0x3f')]);var _0x4000cf={'where':_0x352c10['where']};return db[_0xa086('0x40')]['count'](_0x4000cf)[_0xa086('0x24')](function(_0x2ef113){_0x4fb92a[_0xa086('0x20')]=_0x2ef113;if(_0x40ed23['query']['includeAll']){_0x352c10['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xa086('0x41')](_0x352c10);})[_0xa086('0x24')](function(_0x140407){_0x4fb92a[_0xa086('0x42')]=_0x140407;return _0x4fb92a;})[_0xa086('0x24')](respondWithFilteredResult(_0x125538,_0x352c10))[_0xa086('0x43')](handleError(_0x125538,null));};exports[_0xa086('0x44')]=function(_0x3a047d,_0x5ed43c){var _0x4c25d1={'raw':!![],'where':{'id':_0x3a047d['params']['id']}},_0x4ab8f8={};_0x4ab8f8[_0xa086('0x33')]=_['keys'](db[_0xa086('0x40')][_0xa086('0x2a')]);_0x4ab8f8['query']=_[_0xa086('0x2f')](_0x3a047d['query']);_0x4ab8f8['filters']=_[_0xa086('0x32')](_0x4ab8f8['model'],_0x4ab8f8[_0xa086('0x30')]);_0x4c25d1[_0xa086('0x34')]=_[_0xa086('0x32')](_0x4ab8f8[_0xa086('0x33')],qs[_0xa086('0x35')](_0x3a047d[_0xa086('0x30')][_0xa086('0x35')]));_0x4c25d1[_0xa086('0x34')]=_0x4c25d1['attributes'][_0xa086('0x45')]?_0x4c25d1[_0xa086('0x34')]:_0x4ab8f8[_0xa086('0x33')];if(_0x3a047d[_0xa086('0x30')]['includeAll']){_0x4c25d1[_0xa086('0x46')]=[{'all':!![]}];}_0x4c25d1=_[_0xa086('0x3c')]({},_0x4c25d1,_0x3a047d[_0xa086('0x3f')]);return db['ChatTransferReport']['find'](_0x4c25d1)[_0xa086('0x24')](handleEntityNotFound(_0x5ed43c,null))['then'](respondWithResult(_0x5ed43c,null))['catch'](handleError(_0x5ed43c,null));};exports[_0xa086('0x47')]=function(_0x50d057,_0x5b0297){return db['ChatTransferReport'][_0xa086('0x47')](_0x50d057[_0xa086('0x48')],{})[_0xa086('0x24')](respondWithResult(_0x5b0297,0xc9))['catch'](handleError(_0x5b0297,null));};exports['update']=function(_0x4b7fe4,_0x313398){if(_0x4b7fe4[_0xa086('0x48')]['id']){delete _0x4b7fe4[_0xa086('0x48')]['id'];}return db[_0xa086('0x40')]['find']({'where':{'id':_0x4b7fe4[_0xa086('0x49')]['id']}})[_0xa086('0x24')](handleEntityNotFound(_0x313398,null))['then'](saveUpdates(_0x4b7fe4[_0xa086('0x48')],null))[_0xa086('0x24')](respondWithResult(_0x313398,null))['catch'](handleError(_0x313398,null));};exports[_0xa086('0x4a')]=function(_0x36d6c9,_0x55b19e){return db['ChatTransferReport'][_0xa086('0x4b')]({'where':{'id':_0x36d6c9[_0xa086('0x49')]['id']}})[_0xa086('0x24')](handleEntityNotFound(_0x55b19e,null))['then'](removeEntity(_0x55b19e,null))[_0xa086('0x43')](handleError(_0x55b19e,null));};exports[_0xa086('0x4c')]=function(_0x2e785e,_0x216e96){return db['ChatTransferReport'][_0xa086('0x4c')]()[_0xa086('0x24')](respondWithResult(_0x216e96,null))[_0xa086('0x43')](handleError(_0x216e96,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c37c59e..fe9ed2d 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 _0xa8d3=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatTransferReport.attributes','define'];(function(_0x4913df,_0x358237){var _0x2f9ba2=function(_0x4fcd50){while(--_0x4fcd50){_0x4913df['push'](_0x4913df['shift']());}};_0x2f9ba2(++_0x358237);}(_0xa8d3,0x121));var _0x3a8d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa8d3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x3a8d('0x0'));var util=require(_0x3a8d('0x1'));var logger=require(_0x3a8d('0x2'))(_0x3a8d('0x3'));var moment=require(_0x3a8d('0x4'));var BPromise=require(_0x3a8d('0x5'));var rp=require(_0x3a8d('0x6'));var fs=require('fs');var path=require(_0x3a8d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a8d('0x8'));module['exports']=function(_0x2fe788,_0x520fc9){return _0x2fe788[_0x3a8d('0x9')](_0x3a8d('0xa'),attributes,{'tableName':_0x3a8d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3a8d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa363=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x4a0c64,_0x273c0a){var _0x55365f=function(_0x147629){while(--_0x147629){_0x4a0c64['push'](_0x4a0c64['shift']());}};_0x55365f(++_0x273c0a);}(_0xa363,0x1a1));var _0x3a36=function(_0x48c2ff,_0x5da59c){_0x48c2ff=_0x48c2ff-0x0;var _0x33585b=_0xa363[_0x48c2ff];return _0x33585b;};'use strict';var _=require(_0x3a36('0x0'));var util=require(_0x3a36('0x1'));var logger=require(_0x3a36('0x2'))(_0x3a36('0x3'));var moment=require(_0x3a36('0x4'));var BPromise=require(_0x3a36('0x5'));var rp=require(_0x3a36('0x6'));var fs=require('fs');var path=require(_0x3a36('0x7'));var rimraf=require(_0x3a36('0x8'));var config=require(_0x3a36('0x9'));var attributes=require(_0x3a36('0xa'));module[_0x3a36('0xb')]=function(_0x1c1539,_0x14c9d1){return _0x1c1539[_0x3a36('0xc')](_0x3a36('0xd'),attributes,{'tableName':_0x3a36('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3a36('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 7e5fa02..b8bc02c 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 _0x85f1=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4d4df6,_0x42fe2a){var _0x3d24dd=function(_0x1ef303){while(--_0x1ef303){_0x4d4df6['push'](_0x4d4df6['shift']());}};_0x3d24dd(++_0x42fe2a);}(_0x85f1,0x8f));var _0x185f=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x85f1[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x185f('0x0'));var util=require(_0x185f('0x1'));var moment=require(_0x185f('0x2'));var BPromise=require(_0x185f('0x3'));var rs=require(_0x185f('0x4'));var fs=require('fs');var Redis=require(_0x185f('0x5'));var db=require(_0x185f('0x6'))['db'];var utils=require(_0x185f('0x7'));var logger=require(_0x185f('0x8'))(_0x185f('0x9'));var config=require(_0x185f('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x185f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4be68c,_0x1e8550,_0x1ed928){return new BPromise(function(_0xbd5a00,_0x23da5e){return client[_0x185f('0xc')](_0x4be68c,_0x1ed928)[_0x185f('0xd')](function(_0x236fa9){logger[_0x185f('0xe')](_0x185f('0xf'),_0x1e8550,_0x185f('0x10'));logger[_0x185f('0x11')](_0x185f('0x12'),_0x1e8550,_0x185f('0x10'),JSON[_0x185f('0x13')](_0x236fa9));if(_0x236fa9[_0x185f('0x14')]){if(_0x236fa9[_0x185f('0x14')][_0x185f('0x15')]===0x1f4){logger[_0x185f('0x14')](_0x185f('0xf'),_0x1e8550,_0x236fa9[_0x185f('0x14')][_0x185f('0x16')]);return _0x23da5e(_0x236fa9[_0x185f('0x14')][_0x185f('0x16')]);}logger[_0x185f('0x14')](_0x185f('0xf'),_0x1e8550,_0x236fa9[_0x185f('0x14')][_0x185f('0x16')]);return _0xbd5a00(_0x236fa9[_0x185f('0x14')][_0x185f('0x16')]);}else{logger[_0x185f('0xe')](_0x185f('0xf'),_0x1e8550,_0x185f('0x10'));_0xbd5a00(_0x236fa9[_0x185f('0x17')][_0x185f('0x16')]);}})[_0x185f('0x18')](function(_0x501b18){logger[_0x185f('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x1e8550,_0x501b18);_0x23da5e(_0x501b18);});});} \ No newline at end of file +var _0x14f1=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','ChatTransferReport,\x20%s,\x20%s','message','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x14f1,0x15b));var _0x114f=function(_0x3efdc1,_0xef6c70){_0x3efdc1=_0x3efdc1-0x0;var _0xa84920=_0x14f1[_0x3efdc1];return _0xa84920;};'use strict';var _=require('lodash');var util=require(_0x114f('0x0'));var moment=require(_0x114f('0x1'));var BPromise=require(_0x114f('0x2'));var rs=require(_0x114f('0x3'));var fs=require('fs');var Redis=require(_0x114f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x114f('0x5'));var logger=require(_0x114f('0x6'))(_0x114f('0x7'));var config=require(_0x114f('0x8'));var jayson=require(_0x114f('0x9'));var client=jayson[_0x114f('0xa')][_0x114f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49cb08,_0x3a3985,_0x402873){return new BPromise(function(_0x538262,_0xe7fb20){return client['request'](_0x49cb08,_0x402873)['then'](function(_0xd73293){logger[_0x114f('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x3a3985,_0x114f('0xd'));logger[_0x114f('0xe')](_0x114f('0xf'),_0x3a3985,_0x114f('0xd'),JSON[_0x114f('0x10')](_0xd73293));if(_0xd73293['error']){if(_0xd73293['error'][_0x114f('0x11')]===0x1f4){logger['error'](_0x114f('0x12'),_0x3a3985,_0xd73293['error'][_0x114f('0x13')]);return _0xe7fb20(_0xd73293['error'][_0x114f('0x13')]);}logger[_0x114f('0x14')](_0x114f('0x12'),_0x3a3985,_0xd73293[_0x114f('0x14')][_0x114f('0x13')]);return _0x538262(_0xd73293[_0x114f('0x14')][_0x114f('0x13')]);}else{logger[_0x114f('0xc')](_0x114f('0x12'),_0x3a3985,_0x114f('0xd'));_0x538262(_0xd73293[_0x114f('0x15')]['message']);}})[_0x114f('0x16')](function(_0x1e0a2b){logger[_0x114f('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x3a3985,_0x1e0a2b);_0xe7fb20(_0x1e0a2b);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9942bdb..5482cad 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 _0xd485=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x54ba5b,_0x5b7508){var _0x5e16ac=function(_0x131aed){while(--_0x131aed){_0x54ba5b['push'](_0x54ba5b['shift']());}};_0x5e16ac(++_0x5b7508);}(_0xd485,0x1e6));var _0x5d48=function(_0x11172b,_0x485571){_0x11172b=_0x11172b-0x0;var _0x4bb6ae=_0xd485[_0x11172b];return _0x4bb6ae;};'use strict';var multer=require('multer');var util=require(_0x5d48('0x0'));var path=require(_0x5d48('0x1'));var timeout=require(_0x5d48('0x2'));var express=require(_0x5d48('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5d48('0x4'));var config=require(_0x5d48('0x5'));var controller=require('./chatTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5d48('0x6')](_0x5d48('0x7'),auth[_0x5d48('0x8')](),controller[_0x5d48('0x9')]);router[_0x5d48('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5d48('0xa')]('/',auth[_0x5d48('0x8')](),controller[_0x5d48('0xb')]);router[_0x5d48('0xc')](_0x5d48('0xd'),auth[_0x5d48('0x8')](),controller[_0x5d48('0xe')]);router[_0x5d48('0xf')]('/:id',auth[_0x5d48('0x8')](),controller[_0x5d48('0x10')]);module[_0x5d48('0x11')]=router; \ No newline at end of file +var _0x6149=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','exports','multer'];(function(_0x193bec,_0x5bbea3){var _0x3aea83=function(_0x2d9baa){while(--_0x2d9baa){_0x193bec['push'](_0x193bec['shift']());}};_0x3aea83(++_0x5bbea3);}(_0x6149,0xaa));var _0x9614=function(_0x36e88b,_0x1aff1b){_0x36e88b=_0x36e88b-0x0;var _0x5df45c=_0x6149[_0x36e88b];return _0x5df45c;};'use strict';var multer=require(_0x9614('0x0'));var util=require(_0x9614('0x1'));var path=require(_0x9614('0x2'));var timeout=require(_0x9614('0x3'));var express=require(_0x9614('0x4'));var router=express[_0x9614('0x5')]();var fs_extra=require(_0x9614('0x6'));var auth=require(_0x9614('0x7'));var interaction=require(_0x9614('0x8'));var config=require('../../config/environment');var controller=require(_0x9614('0x9'));router[_0x9614('0xa')]('/',auth[_0x9614('0xb')](),controller[_0x9614('0xc')]);router[_0x9614('0xa')](_0x9614('0xd'),auth[_0x9614('0xb')](),controller['describe']);router['get'](_0x9614('0xe'),auth[_0x9614('0xb')](),controller['show']);router[_0x9614('0xf')]('/',auth[_0x9614('0xb')](),controller[_0x9614('0x10')]);router[_0x9614('0x11')](_0x9614('0xe'),auth[_0x9614('0xb')](),controller['update']);router['delete'](_0x9614('0xe'),auth[_0x9614('0xb')](),controller['destroy']);module[_0x9614('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 c1397b5..1b9c988 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 _0xe769=['rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','BOOLEAN','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe769,0x6a));var _0x9e76=function(_0x142be6,_0x55f613){_0x142be6=_0x142be6-0x0;var _0x3630d9=_0xe769[_0x142be6];return _0x3630d9;};'use strict';var Sequelize=require(_0x9e76('0x0'));var rs=require(_0x9e76('0x1'));module[_0x9e76('0x2')]={'name':{'type':Sequelize[_0x9e76('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x9e76('0x3')],'allowNull':![],'unique':_0x9e76('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x5')},'mapKeyOffline':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x9e76('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9e76('0x3')],'allowNull':![],'defaultValue':_0x9e76('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9e76('0x3')],'allowNull':![],'defaultValue':_0x9e76('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9e76('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9e76('0x3')]},'animation':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9e76('0x9')](_0x9e76('0xa'),_0x9e76('0xb')),'defaultValue':_0x9e76('0xa')},'header_online':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0xc')},'start_chat_button':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0xd')},'offline_chat_button':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x9e76('0xe')},'download_transcript':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9e76('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x9e76('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9e76('0x13')},'noteTitle':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x14')},'placeholderMessage':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x15')},'closingMessage':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x16')},'closingMessageButton':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x17')},'skipMessageButton':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x18')},'conditionAgreement':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x9e76('0x19')},'ratingType':{'type':Sequelize[_0x9e76('0x9')](_0x9e76('0x1a'),_0x9e76('0x1b')),'defaultValue':_0x9e76('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x9e76('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9e76('0x1c')],'defaultValue':function(){return JSON[_0x9e76('0x1d')]({'items':[{'type':_0x9e76('0x1e'),'variable':null,'config':{'placeholder':_0x9e76('0x1f'),'type':_0x9e76('0x20'),'required':!![]},'props':{'title':_0x9e76('0x1f'),'helpText':''}},{'type':_0x9e76('0x1e'),'props':{'title':_0x9e76('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x9e76('0x5'),'type':_0x9e76('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9e76('0x21')](_0x9e76('0x22'))?JSON[_0x9e76('0x23')](this[_0x9e76('0x21')](_0x9e76('0x22'))):{};},'set':function(_0x1c5dbd){return this['setDataValue'](_0x9e76('0x22'),JSON[_0x9e76('0x1d')](_0x1c5dbd));}},'offlineForm':{'type':Sequelize[_0x9e76('0x1c')],'defaultValue':function(){return JSON[_0x9e76('0x1d')]({'items':[{'type':'input','props':{'title':_0x9e76('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x9e76('0x5'),'type':'email'},'variable':null},{'type':_0x9e76('0x24'),'config':{'placeholder':_0x9e76('0x25')},'props':{'title':_0x9e76('0x25'),'helpText':_0x9e76('0x26')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x9e76('0x27'))?JSON[_0x9e76('0x23')](this[_0x9e76('0x21')](_0x9e76('0x27'))):{};},'set':function(_0x108458){return this[_0x9e76('0x28')](_0x9e76('0x27'),JSON[_0x9e76('0x1d')](_0x108458));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9e76('0x29')]();}},'autoclose':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9e76('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9e76('0x3')]},'waitingTitle':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x2a')},'waitingMessage':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x2b')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x9e76('0x2c')},'offlineMessageBody':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x2d')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9e76('0x2e')},'skipUnmanaged':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x17')},'enableCustomerAttachment':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9e76('0x1c')]},'showAgentAvatar':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9e76('0x2f');}},'notificationSound':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':_0x9e76('0x30')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9e76('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x9e76('0x31')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x9e76('0x3')]},'customerAvatar':{'type':Sequelize[_0x9e76('0x1c')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9e76('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9e76('0x32'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9e76('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x9e76('0x33')},'systemAvatar':{'type':Sequelize[_0x9e76('0x1c')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9e76('0xf')],'comment':_0x9e76('0x34')},'mandatoryDisposition':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![],'comment':_0x9e76('0x35'),'set':function(_0x2cd0bf){if(!_0x2cd0bf)this[_0x9e76('0x28')](_0x9e76('0x36'),null);this[_0x9e76('0x28')](_0x9e76('0x37'),_0x2cd0bf);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x9e76('0x3')],'allowNull':![],'defaultValue':_0x9e76('0x38')},'vidaooNote':{'type':Sequelize[_0x9e76('0x3')],'defaultValue':function(){return _0x9e76('0x39');}},'vidaooMetadata':{'type':Sequelize[_0x9e76('0x1c')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9e76('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9e76('0x1c')]}}; \ No newline at end of file +var _0xf68b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','System','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','ENUM','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Skip'];(function(_0x38d8be,_0x13ba38){var _0x9b3bc6=function(_0x45519a){while(--_0x45519a){_0x38d8be['push'](_0x38d8be['shift']());}};_0x9b3bc6(++_0x13ba38);}(_0xf68b,0x7e));var _0xbf68=function(_0x4d53bd,_0x55ac70){_0x4d53bd=_0x4d53bd-0x0;var _0x2c3770=_0xf68b[_0x4d53bd];return _0x2c3770;};'use strict';var Sequelize=require(_0xbf68('0x0'));var rs=require(_0xbf68('0x1'));module[_0xbf68('0x2')]={'name':{'type':Sequelize[_0xbf68('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xbf68('0x3')],'allowNull':![],'unique':_0xbf68('0x4')},'description':{'type':Sequelize[_0xbf68('0x3')]},'mapKey':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xbf68('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbf68('0x3')],'allowNull':![],'defaultValue':_0xbf68('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbf68('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':_0xbf68('0xa')},'header_online':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0xb')},'start_chat_button':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0xc')},'header_offline':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0xd')},'download_transcript':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbf68('0xe')]},'closingQuestion':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xbf68('0x11')},'placeholderMessage':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0x12')},'closingMessage':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xbf68('0xc')},'skipMessageButton':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0x13')},'ratingType':{'type':Sequelize[_0xbf68('0x14')](_0xbf68('0x15'),_0xbf68('0x16')),'defaultValue':_0xbf68('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xbf68('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbf68('0xe')],'defaultValue':function(){return JSON[_0xbf68('0x17')]({'items':[{'type':_0xbf68('0x18'),'variable':null,'config':{'placeholder':'name','type':_0xbf68('0x19'),'required':!![]},'props':{'title':_0xbf68('0x1a'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xbf68('0x5'),'type':_0xbf68('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbf68('0x1b')](_0xbf68('0x1c'))?JSON[_0xbf68('0x1d')](this['getDataValue']('onlineForm')):{};},'set':function(_0x368cdd){return this[_0xbf68('0x1e')](_0xbf68('0x1c'),JSON[_0xbf68('0x17')](_0x368cdd));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xbf68('0x18'),'props':{'title':_0xbf68('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xbf68('0x5')},'variable':null},{'type':_0xbf68('0x1f'),'config':{'placeholder':_0xbf68('0x20')},'props':{'title':_0xbf68('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xbf68('0x1b')]('offlineForm')?JSON['parse'](this[_0xbf68('0x1b')](_0xbf68('0x21'))):{};},'set':function(_0x2445b5){return this[_0xbf68('0x1e')]('offlineForm',JSON[_0xbf68('0x17')](_0x2445b5));}},'token':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':function(){return rs[_0xbf68('0x22')]();}},'autoclose':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbf68('0x3')]},'forwardOffline':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbf68('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':_0xbf68('0x24')},'offlineMessageBody':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbf68('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbf68('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbf68('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbf68('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbf68('0xe')],'defaultValue':function(){return _0xbf68('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xbf68('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xbf68('0x3')]},'customerAvatar':{'type':Sequelize[_0xbf68('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbf68('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbf68('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf68('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf68('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbf68('0x27')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf68('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x64bc85){if(!_0x64bc85)this[_0xbf68('0x1e')]('mandatoryDispositionPauseId',null);this[_0xbf68('0x1e')](_0xbf68('0x28'),_0x64bc85);}},'vidaooEscalation':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbf68('0x3')]},'vidaooTopic':{'type':Sequelize[_0xbf68('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xbf68('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xbf68('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbf68('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xbf68('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 09c5815..ce5477f 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 _0xf3cd=['rawAttributes','fieldName','model','name','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','merge','find','catch','create','body','user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','ChatWebsiteId','Disposition','findOne','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addLogo','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','sitepic','getLicense','isNil','existsSync','server/files/images/logos/','getAvatar','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','notify','setUA','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','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','CmContact','DESC','ChatApplication','Applications','applications','asc','account','List','Contacts','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','originalname','mimetype','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','custom','License','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','x-real-ip','connection','virtual','replace','alignment','verticalAlignment','color','textColor','color_button','backgroundColor','addApplications','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','get','ChatWebsites','sendStatus','stack','index','Pause','mandatoryDispositionPause','map','ChatWebsite'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0xf3cd[_0x92713a];return _0x1893e1;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x1a')]=_[_0xdf3c('0x1b')](config[_0xdf3c('0x1a')],{'host':_0xdf3c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf3c('0x1a')]));require(_0xdf3c('0x1d'))[_0xdf3c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdf3c('0x1f')][_0xdf3c('0x20')]({'port':0x232c});var client9002=jayson[_0xdf3c('0x1f')][_0xdf3c('0x20')]({'port':0x232a});var client9003=jayson[_0xdf3c('0x1f')][_0xdf3c('0x20')]({'port':0x232b});var client9001=jayson[_0xdf3c('0x1f')][_0xdf3c('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x2986d0,_0x5d3991,_0x54cdd4,_0x13b0e6){return new BPromise(function(_0x465e7d,_0xf1da1f){var _0x18d4ec=_0x13b0e6||client;return _0x18d4ec[_0xdf3c('0x21')](_0x2986d0,_0x54cdd4)[_0xdf3c('0x22')](function(_0x16b02b){logger[_0xdf3c('0x23')](_0xdf3c('0x24'),_0x5d3991,_0xdf3c('0x25'));logger[_0xdf3c('0x26')](_0xdf3c('0x27'),_0x5d3991,_0xdf3c('0x25'),JSON['stringify'](_0x16b02b));if(_0x16b02b['error']){if(_0x16b02b[_0xdf3c('0x28')]['code']===0x1f4){logger[_0xdf3c('0x28')](_0xdf3c('0x24'),_0x5d3991,_0x16b02b[_0xdf3c('0x28')][_0xdf3c('0x29')]);return _0xf1da1f(_0x16b02b[_0xdf3c('0x28')][_0xdf3c('0x29')]);}logger['error'](_0xdf3c('0x24'),_0x5d3991,_0x16b02b[_0xdf3c('0x28')][_0xdf3c('0x29')]);return _0x465e7d(_0x16b02b[_0xdf3c('0x28')][_0xdf3c('0x29')]);}else{logger[_0xdf3c('0x23')](_0xdf3c('0x24'),_0x5d3991,_0xdf3c('0x25'));_0x465e7d(_0x16b02b[_0xdf3c('0x2a')][_0xdf3c('0x29')]);}})['catch'](function(_0xd284d7){logger[_0xdf3c('0x28')]('ChatWebsite,\x20%s,\x20%s',_0x5d3991,_0xd284d7);_0xf1da1f(_0xd284d7);});});}function respondWithStatusCode(_0xdc8962,_0x59659e){_0x59659e=_0x59659e||0xcc;return function(_0x4eaced){if(_0x4eaced){return _0xdc8962['sendStatus'](_0x59659e);}return _0xdc8962[_0xdf3c('0x2b')](_0x59659e)[_0xdf3c('0x2c')]();};}function respondWithResult(_0x52b8f6,_0x5c3b5a){_0x5c3b5a=_0x5c3b5a||0xc8;return function(_0x37ecfd){if(_0x37ecfd){return _0x52b8f6[_0xdf3c('0x2b')](_0x5c3b5a)[_0xdf3c('0x2d')](_0x37ecfd);}};}function respondWithFilteredResult(_0x1ccdd4,_0x5c98a2){return function(_0x43ce06){if(_0x43ce06){var _0x2a2d94=typeof _0x5c98a2['offset']==='undefined'&&typeof _0x5c98a2[_0xdf3c('0x2e')]===_0xdf3c('0x2f');var _0x36937e=_0x43ce06['count'];var _0x2355f6=_0x2a2d94?0x0:_0x5c98a2[_0xdf3c('0x30')];var _0x21e7b8=_0x2a2d94?_0x43ce06[_0xdf3c('0x31')]:_0x5c98a2['offset']+_0x5c98a2[_0xdf3c('0x2e')];var _0x46b445;if(_0x21e7b8>=_0x36937e){_0x21e7b8=_0x36937e;_0x46b445=0xc8;}else{_0x46b445=0xce;}_0x1ccdd4['status'](_0x46b445);return _0x1ccdd4[_0xdf3c('0x32')](_0xdf3c('0x33'),_0x2355f6+'-'+_0x21e7b8+'/'+_0x36937e)[_0xdf3c('0x2d')](_0x43ce06);}return null;};}function patchUpdates(_0x2287f){return function(_0x5d705d){try{jsonpatch[_0xdf3c('0x34')](_0x5d705d,_0x2287f,!![]);}catch(_0x360d5c){return BPromise[_0xdf3c('0x35')](_0x360d5c);}return _0x5d705d[_0xdf3c('0x36')]();};}function saveUpdates(_0x4c1f49,_0x474564){return function(_0x3e7a4b){if(_0x3e7a4b){return _0x3e7a4b['update'](_0x4c1f49)['then'](function(_0x12cc19){return _0x12cc19;});}return null;};}function removeEntity(_0x588d02,_0x216115){return function(_0x5e8130){if(_0x5e8130){return _0x5e8130['destroy']()['then'](function(){var _0x44a478=_0x5e8130[_0xdf3c('0x37')]({'plain':!![]});var _0x1d0b8a=_0xdf3c('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d0b8a,'resourceId':_0x44a478['id']}})[_0xdf3c('0x22')](function(){return _0x5e8130;});})['then'](function(){_0x588d02[_0xdf3c('0x2b')](0xcc)[_0xdf3c('0x2c')]();});}};}function handleEntityNotFound(_0x3628ae,_0xcdd731){return function(_0x1004e9){if(!_0x1004e9){_0x3628ae[_0xdf3c('0x39')](0x194);}return _0x1004e9;};}function handleError(_0x1c7335,_0x809f3d){_0x809f3d=_0x809f3d||0x1f4;return function(_0x398c76){logger['error'](_0x398c76[_0xdf3c('0x3a')]);if(_0x398c76['name']){delete _0x398c76['name'];}_0x1c7335[_0xdf3c('0x2b')](_0x809f3d)['send'](_0x398c76);};}exports[_0xdf3c('0x3b')]=function(_0x4f93d5,_0x2a94c3){var _0x27ee91={'include':[{'model':db[_0xdf3c('0x3c')],'as':_0xdf3c('0x3d')}]},_0x1c6dee={},_0x1349a4={'count':0x0,'rows':[]};var _0x736ef5=_[_0xdf3c('0x3e')](db[_0xdf3c('0x3f')][_0xdf3c('0x40')],function(_0x424acf){return{'name':_0x424acf[_0xdf3c('0x41')],'type':_0x424acf['type']['key']};});_0x1c6dee[_0xdf3c('0x42')]=_['map'](_0x736ef5,_0xdf3c('0x43'));_0x1c6dee[_0xdf3c('0x44')]=_[_0xdf3c('0x45')](_0x4f93d5[_0xdf3c('0x44')]);_0x1c6dee['filters']=_['intersection'](_0x1c6dee[_0xdf3c('0x42')],_0x1c6dee[_0xdf3c('0x44')]);_0x27ee91[_0xdf3c('0x46')]=_['intersection'](_0x1c6dee[_0xdf3c('0x42')],qs[_0xdf3c('0x47')](_0x4f93d5[_0xdf3c('0x44')][_0xdf3c('0x47')]));_0x27ee91['attributes']=_0x27ee91[_0xdf3c('0x46')][_0xdf3c('0x48')]?_0x27ee91[_0xdf3c('0x46')]:_0x1c6dee[_0xdf3c('0x42')];if(!_0x4f93d5[_0xdf3c('0x44')]['hasOwnProperty'](_0xdf3c('0x49'))){_0x27ee91[_0xdf3c('0x2e')]=qs[_0xdf3c('0x2e')](_0x4f93d5[_0xdf3c('0x44')][_0xdf3c('0x2e')]);_0x27ee91[_0xdf3c('0x30')]=qs['offset'](_0x4f93d5['query'][_0xdf3c('0x30')]);}_0x27ee91[_0xdf3c('0x4a')]=qs['sort'](_0x4f93d5['query'][_0xdf3c('0x4b')]);_0x27ee91[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_[_0xdf3c('0x4e')](_0x4f93d5[_0xdf3c('0x44')],_0x1c6dee[_0xdf3c('0x4d')]),_0x736ef5);if(_0x4f93d5[_0xdf3c('0x44')][_0xdf3c('0x4f')]){_0x27ee91[_0xdf3c('0x4c')]=_['merge'](_0x27ee91[_0xdf3c('0x4c')],{'$or':_[_0xdf3c('0x3e')](_0x736ef5,function(_0x1c293d){if(_0x1c293d[_0xdf3c('0x50')]!==_0xdf3c('0x51')){var _0x385824={};_0x385824[_0x1c293d[_0xdf3c('0x43')]]={'$like':'%'+_0x4f93d5['query'][_0xdf3c('0x4f')]+'%'};return _0x385824;}})});}_0x27ee91=_['merge']({},_0x27ee91,_0x4f93d5[_0xdf3c('0x52')]);var _0x47b101={'where':_0x27ee91[_0xdf3c('0x4c')]};return db[_0xdf3c('0x3f')][_0xdf3c('0x31')](_0x47b101)[_0xdf3c('0x22')](function(_0x5eef94){_0x1349a4['count']=_0x5eef94;if(_0x4f93d5['query'][_0xdf3c('0x53')]){_0x27ee91['include']=[{'all':!![]}];}return db[_0xdf3c('0x3f')][_0xdf3c('0x54')](_0x27ee91);})[_0xdf3c('0x22')](function(_0x1901c4){_0x1349a4[_0xdf3c('0x55')]=_0x1901c4;return _0x1349a4;})['then'](respondWithFilteredResult(_0x2a94c3,_0x27ee91))['catch'](handleError(_0x2a94c3,null));};exports[_0xdf3c('0x56')]=function(_0x27a541,_0x591018){var _0x3b215d={'raw':![],'where':{'id':_0x27a541[_0xdf3c('0x57')]['id']},'include':[{'model':db[_0xdf3c('0x3c')],'as':_0xdf3c('0x3d')}]},_0x9864ec={};_0x9864ec[_0xdf3c('0x42')]=_[_0xdf3c('0x45')](db['ChatWebsite']['rawAttributes']);_0x9864ec[_0xdf3c('0x44')]=_[_0xdf3c('0x45')](_0x27a541[_0xdf3c('0x44')]);_0x9864ec[_0xdf3c('0x4d')]=_[_0xdf3c('0x58')](_0x9864ec[_0xdf3c('0x42')],_0x9864ec[_0xdf3c('0x44')]);_0x3b215d[_0xdf3c('0x46')]=_[_0xdf3c('0x58')](_0x9864ec[_0xdf3c('0x42')],qs[_0xdf3c('0x47')](_0x27a541['query'][_0xdf3c('0x47')]));_0x3b215d['attributes']=_0x3b215d['attributes']['length']?_0x3b215d['attributes']:_0x9864ec['model'];if(_0x27a541[_0xdf3c('0x44')][_0xdf3c('0x53')]){_0x3b215d['include']=[{'all':!![]}];}_0x3b215d=_[_0xdf3c('0x59')]({},_0x3b215d,_0x27a541[_0xdf3c('0x52')]);return db['ChatWebsite'][_0xdf3c('0x5a')](_0x3b215d)[_0xdf3c('0x22')](handleEntityNotFound(_0x591018,null))[_0xdf3c('0x22')](respondWithResult(_0x591018,null))[_0xdf3c('0x5b')](handleError(_0x591018,null));};exports[_0xdf3c('0x5c')]=function(_0x28f387,_0xb54629){return db[_0xdf3c('0x3f')][_0xdf3c('0x5c')](_0x28f387[_0xdf3c('0x5d')],{})[_0xdf3c('0x22')](function(_0x503d94){var _0x1ed898=_0x28f387[_0xdf3c('0x5e')][_0xdf3c('0x37')]({'plain':!![]});if(!_0x1ed898)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ed898[_0xdf3c('0x5f')]===_0xdf3c('0x5e')){var _0x235d6c=_0x503d94['get']({'plain':!![]});var _0x1effdb=_0xdf3c('0x38');return db['UserProfileSection'][_0xdf3c('0x5a')]({'where':{'name':_0x1effdb,'userProfileId':_0x1ed898['userProfileId']},'raw':!![]})[_0xdf3c('0x22')](function(_0x1b03e7){if(_0x1b03e7&&_0x1b03e7[_0xdf3c('0x60')]===0x0){return db[_0xdf3c('0x61')][_0xdf3c('0x5c')]({'name':_0x235d6c[_0xdf3c('0x43')],'resourceId':_0x235d6c['id'],'type':_0x1b03e7[_0xdf3c('0x43')],'sectionId':_0x1b03e7['id']},{})[_0xdf3c('0x22')](function(){return _0x503d94;});}else{return _0x503d94;}})[_0xdf3c('0x5b')](function(_0x330730){logger[_0xdf3c('0x28')](_0xdf3c('0x62'),_0x330730);throw _0x330730;});}return _0x503d94;})[_0xdf3c('0x22')](respondWithResult(_0xb54629,0xc9))[_0xdf3c('0x5b')](handleError(_0xb54629,null));};exports[_0xdf3c('0x63')]=function(_0xe42432,_0xd7fb2d){if(_0xe42432['body']['id']){delete _0xe42432['body']['id'];}return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0xe42432[_0xdf3c('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xdf3c('0x3d')}]})['then'](handleEntityNotFound(_0xd7fb2d,null))['then'](saveUpdates(_0xe42432[_0xdf3c('0x5d')],null))[_0xdf3c('0x22')](respondWithResult(_0xd7fb2d,null))[_0xdf3c('0x5b')](handleError(_0xd7fb2d,null));};exports[_0xdf3c('0x64')]=function(_0x68f487,_0x9b7034){return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x68f487[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x9b7034,null))[_0xdf3c('0x22')](removeEntity(_0x9b7034,null))[_0xdf3c('0x5b')](handleError(_0x9b7034,null));};exports[_0xdf3c('0x65')]=function(_0x4be79a,_0x3febac){return db[_0xdf3c('0x3f')][_0xdf3c('0x65')]()[_0xdf3c('0x22')](respondWithResult(_0x3febac,null))[_0xdf3c('0x5b')](handleError(_0x3febac,null));};exports['addDisposition']=function(_0x18bf4f,_0x1c3355,_0x163666){if(_0x18bf4f[_0xdf3c('0x5d')]['id']){delete _0x18bf4f[_0xdf3c('0x5d')]['id'];}return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x18bf4f[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x1c3355,null))[_0xdf3c('0x22')](function(_0x55010b){if(_0x55010b){_0x18bf4f[_0xdf3c('0x5d')][_0xdf3c('0x66')]=_0x55010b['id'];return db[_0xdf3c('0x67')][_0xdf3c('0x5c')](_0x18bf4f[_0xdf3c('0x5d')]);}})[_0xdf3c('0x22')](respondWithResult(_0x1c3355,null))[_0xdf3c('0x5b')](handleError(_0x1c3355,null));};exports['getDispositions']=function(_0x2b6069,_0x662fd5,_0x4e1b77){var _0x52a2e1={'raw':![],'where':{}};var _0x12893d={};var _0x3c79c0={'count':0x0,'rows':[]};return db[_0xdf3c('0x3f')][_0xdf3c('0x68')]({'where':{'id':_0x2b6069[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x662fd5,null))[_0xdf3c('0x22')](function(_0x38af90){if(_0x38af90){_0x12893d['model']=_[_0xdf3c('0x45')](db[_0xdf3c('0x67')][_0xdf3c('0x40')]);_0x12893d['query']=_[_0xdf3c('0x45')](_0x2b6069[_0xdf3c('0x44')]);_0x12893d[_0xdf3c('0x4d')]=_['intersection'](_0x12893d[_0xdf3c('0x42')],_0x12893d[_0xdf3c('0x44')]);_0x52a2e1[_0xdf3c('0x46')]=_[_0xdf3c('0x58')](_0x12893d[_0xdf3c('0x42')],qs[_0xdf3c('0x47')](_0x2b6069['query']['fields']));_0x52a2e1['attributes']=_0x52a2e1['attributes']['length']?_0x52a2e1[_0xdf3c('0x46')]:_0x12893d[_0xdf3c('0x42')];if(!_0x2b6069[_0xdf3c('0x44')]['hasOwnProperty'](_0xdf3c('0x49'))){_0x52a2e1[_0xdf3c('0x2e')]=qs[_0xdf3c('0x2e')](_0x2b6069['query']['limit']);_0x52a2e1[_0xdf3c('0x30')]=qs['offset'](_0x2b6069[_0xdf3c('0x44')]['offset']);}_0x52a2e1[_0xdf3c('0x4a')]=qs[_0xdf3c('0x4b')](_0x2b6069[_0xdf3c('0x44')][_0xdf3c('0x4b')]);_0x52a2e1['where']=qs['filters'](_[_0xdf3c('0x4e')](_0x2b6069[_0xdf3c('0x44')],_0x12893d[_0xdf3c('0x4d')]));_0x52a2e1[_0xdf3c('0x4c')][_0xdf3c('0x66')]=_0x38af90['id'];if(_0x2b6069[_0xdf3c('0x44')]['filter']){_0x52a2e1[_0xdf3c('0x4c')]=_['merge'](_0x52a2e1[_0xdf3c('0x4c')],{'$or':_[_0xdf3c('0x3e')](_0x52a2e1[_0xdf3c('0x46')],function(_0x5398ba){var _0xe9a21b={};_0xe9a21b[_0x5398ba]={'$like':'%'+_0x2b6069['query'][_0xdf3c('0x4f')]+'%'};return _0xe9a21b;})});}_0x52a2e1=_[_0xdf3c('0x59')]({},_0x52a2e1,_0x2b6069[_0xdf3c('0x52')]);return db['Disposition']['count']({'where':_0x52a2e1['where']})['then'](function(_0x41861e){_0x3c79c0[_0xdf3c('0x31')]=_0x41861e;if(_0x2b6069[_0xdf3c('0x44')][_0xdf3c('0x53')]){_0x52a2e1[_0xdf3c('0x69')]=[{'all':!![]}];}return db[_0xdf3c('0x67')]['findAll'](_0x52a2e1);})[_0xdf3c('0x22')](function(_0x585871){_0x3c79c0[_0xdf3c('0x55')]=_0x585871;return _0x3c79c0;});}})[_0xdf3c('0x22')](respondWithFilteredResult(_0x662fd5,_0x52a2e1))[_0xdf3c('0x5b')](handleError(_0x662fd5,null));};exports[_0xdf3c('0x6a')]=function(_0x320452,_0x3a221d,_0x2f7002){return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x320452[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x3a221d,null))[_0xdf3c('0x22')](function(_0x161219){if(_0x161219){return _0x161219[_0xdf3c('0x6a')](_0x320452['query'][_0xdf3c('0x6b')]);}})[_0xdf3c('0x22')](respondWithStatusCode(_0x3a221d,null))[_0xdf3c('0x5b')](handleError(_0x3a221d,null));};exports[_0xdf3c('0x6c')]=function(_0x5bbe5c,_0x9c7bdd,_0x1c8fe4){if(_0x5bbe5c['body']['id']){delete _0x5bbe5c['body']['id'];}return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x5bbe5c[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x9c7bdd,null))[_0xdf3c('0x22')](function(_0x56fc77){if(_0x56fc77){_0x5bbe5c[_0xdf3c('0x5d')][_0xdf3c('0x66')]=_0x56fc77['id'];return db[_0xdf3c('0x6d')][_0xdf3c('0x5c')](_0x5bbe5c[_0xdf3c('0x5d')]);}})[_0xdf3c('0x22')](respondWithResult(_0x9c7bdd,null))['catch'](handleError(_0x9c7bdd,null));};exports[_0xdf3c('0x6e')]=function(_0x3581ef,_0x18f13f,_0x1b8d64){var _0x3d0e45={'raw':![],'where':{}};var _0x5dfb3f={};var _0x4bedde={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdf3c('0x68')]({'where':{'id':_0x3581ef[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x18f13f,null))[_0xdf3c('0x22')](function(_0x115f11){if(_0x115f11){_0x5dfb3f[_0xdf3c('0x42')]=_[_0xdf3c('0x45')](db[_0xdf3c('0x6d')]['rawAttributes']);_0x5dfb3f[_0xdf3c('0x44')]=_[_0xdf3c('0x45')](_0x3581ef[_0xdf3c('0x44')]);_0x5dfb3f[_0xdf3c('0x4d')]=_[_0xdf3c('0x58')](_0x5dfb3f[_0xdf3c('0x42')],_0x5dfb3f['query']);_0x3d0e45[_0xdf3c('0x46')]=_[_0xdf3c('0x58')](_0x5dfb3f['model'],qs['fields'](_0x3581ef[_0xdf3c('0x44')]['fields']));_0x3d0e45[_0xdf3c('0x46')]=_0x3d0e45[_0xdf3c('0x46')]['length']?_0x3d0e45[_0xdf3c('0x46')]:_0x5dfb3f[_0xdf3c('0x42')];if(!_0x3581ef[_0xdf3c('0x44')][_0xdf3c('0x6f')](_0xdf3c('0x49'))){_0x3d0e45[_0xdf3c('0x2e')]=qs['limit'](_0x3581ef[_0xdf3c('0x44')][_0xdf3c('0x2e')]);_0x3d0e45[_0xdf3c('0x30')]=qs[_0xdf3c('0x30')](_0x3581ef[_0xdf3c('0x44')][_0xdf3c('0x30')]);}_0x3d0e45[_0xdf3c('0x4a')]=qs['sort'](_0x3581ef['query'][_0xdf3c('0x4b')]);_0x3d0e45[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_['pick'](_0x3581ef[_0xdf3c('0x44')],_0x5dfb3f['filters']));_0x3d0e45['where'][_0xdf3c('0x66')]=_0x115f11['id'];if(_0x3581ef[_0xdf3c('0x44')]['filter']){_0x3d0e45[_0xdf3c('0x4c')]=_['merge'](_0x3d0e45[_0xdf3c('0x4c')],{'$or':_['map'](_0x3d0e45[_0xdf3c('0x46')],function(_0x3676a2){var _0x284635={};_0x284635[_0x3676a2]={'$like':'%'+_0x3581ef[_0xdf3c('0x44')][_0xdf3c('0x4f')]+'%'};return _0x284635;})});}_0x3d0e45=_[_0xdf3c('0x59')]({},_0x3d0e45,_0x3581ef[_0xdf3c('0x52')]);return db[_0xdf3c('0x6d')][_0xdf3c('0x31')]({'where':_0x3d0e45[_0xdf3c('0x4c')]})[_0xdf3c('0x22')](function(_0x404761){_0x4bedde[_0xdf3c('0x31')]=_0x404761;if(_0x3581ef[_0xdf3c('0x44')]['includeAll']){_0x3d0e45[_0xdf3c('0x69')]=[{'all':!![]}];}return db[_0xdf3c('0x6d')][_0xdf3c('0x54')](_0x3d0e45);})['then'](function(_0x2cdf93){_0x4bedde[_0xdf3c('0x55')]=_0x2cdf93;return _0x4bedde;});}})[_0xdf3c('0x22')](respondWithFilteredResult(_0x18f13f,_0x3d0e45))[_0xdf3c('0x5b')](handleError(_0x18f13f,null));};exports[_0xdf3c('0x70')]=function(_0x29df40,_0x43f2a1,_0x1f83af){return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x29df40[_0xdf3c('0x57')]['id']}})['then'](handleEntityNotFound(_0x43f2a1,null))[_0xdf3c('0x22')](function(_0x85ec3e){if(_0x85ec3e){return _0x85ec3e[_0xdf3c('0x70')](_0x29df40[_0xdf3c('0x44')][_0xdf3c('0x6b')]);}})[_0xdf3c('0x22')](respondWithStatusCode(_0x43f2a1,null))[_0xdf3c('0x5b')](handleError(_0x43f2a1,null));};exports[_0xdf3c('0x71')]=function(_0x467ffd,_0x260c63,_0x119abc){_0x467ffd[_0xdf3c('0x5d')]['sitepic']=_0x467ffd[_0xdf3c('0x72')][_0xdf3c('0x73')];return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x467ffd[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x260c63,null))[_0xdf3c('0x22')](saveUpdates(_0x467ffd['body'],null))[_0xdf3c('0x22')](respondWithResult(_0x260c63,null))[_0xdf3c('0x5b')](handleError(_0x260c63,null));};exports[_0xdf3c('0x74')]=function(_0x131eb8,_0x4ea2ba,_0x4265cb){_0x131eb8[_0xdf3c('0x5d')]['agentAvatar']=_0x131eb8[_0xdf3c('0x72')]['filename'];return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x131eb8['params']['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x4ea2ba,null))[_0xdf3c('0x22')](saveUpdates(_0x131eb8[_0xdf3c('0x5d')],null))['then'](respondWithResult(_0x4ea2ba,null))['catch'](handleError(_0x4ea2ba,null));};exports[_0xdf3c('0x75')]=function(_0x5ea218,_0x182380,_0x82225d){_0x5ea218[_0xdf3c('0x5d')][_0xdf3c('0x76')]=_0x5ea218['file'][_0xdf3c('0x73')];return db[_0xdf3c('0x3f')]['find']({'where':{'id':_0x5ea218[_0xdf3c('0x57')]['id']}})['then'](handleEntityNotFound(_0x182380,null))[_0xdf3c('0x22')](saveUpdates(_0x5ea218[_0xdf3c('0x5d')],null))['then'](respondWithResult(_0x182380,null))['catch'](handleError(_0x182380,null));};exports[_0xdf3c('0x77')]=function(_0x4e01ca,_0x37ed69,_0x306930){_0x4e01ca[_0xdf3c('0x5d')][_0xdf3c('0x78')]=_0x4e01ca[_0xdf3c('0x72')][_0xdf3c('0x73')];return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x4e01ca[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x37ed69,null))[_0xdf3c('0x22')](saveUpdates(_0x4e01ca['body'],null))[_0xdf3c('0x22')](respondWithResult(_0x37ed69,null))[_0xdf3c('0x5b')](handleError(_0x37ed69,null));};exports['getLogo']=function(_0x164d11,_0x367e4d,_0x21c508){var _0x307179=path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],'server/files/images/logos/default_logo.svg');var _0x19796f={'where':{'id':_0x164d11['params']['id']},'attributes':['id',_0xdf3c('0x7b')],'raw':!![]};var _0x13683e=![];return require(_0xdf3c('0x19'))[_0xdf3c('0x7c')]()[_0xdf3c('0x22')](function(_0x117949){if(_0x117949){_0x13683e=_0x117949['custom'];}})[_0xdf3c('0x22')](function(){return db[_0xdf3c('0x3f')]['find'](_0x19796f);})[_0xdf3c('0x22')](handleEntityNotFound(_0x367e4d,null))[_0xdf3c('0x22')](function(_0x204b5a){if(_0x204b5a){if(!_[_0xdf3c('0x7d')](_0x204b5a[_0xdf3c('0x7b')])){if(fs[_0xdf3c('0x7e')](path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],'server/files/images/logos/',_0x204b5a['sitepic']))&&_0x13683e){_0x307179=path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],_0xdf3c('0x7f'),_0x204b5a[_0xdf3c('0x7b')]);}}return _0x367e4d['download'](_0x307179);}})['catch'](handleError(_0x367e4d,null));};exports[_0xdf3c('0x80')]=function(_0x5c15d3,_0x1a8e1f,_0x5a7c04){var _0x3d8d09=path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],'server/files/images/avatars/default_avatar.png');var _0x292798={'where':{'id':_0x5c15d3[_0xdf3c('0x57')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xdf3c('0x5a')](_0x292798)[_0xdf3c('0x22')](handleEntityNotFound(_0x1a8e1f,null))[_0xdf3c('0x22')](function(_0x1a1c13){if(_0x1a1c13){if(!_[_0xdf3c('0x7d')](_0x1a1c13[_0xdf3c('0x81')])){if(fs[_0xdf3c('0x7e')](path['join'](config['root'],_0xdf3c('0x82'),_0x1a1c13[_0xdf3c('0x81')]))){_0x3d8d09=path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],_0xdf3c('0x82'),_0x1a1c13[_0xdf3c('0x81')]);}}return _0x1a8e1f[_0xdf3c('0x83')](_0x3d8d09);}})[_0xdf3c('0x5b')](handleError(_0x1a8e1f,null));};exports[_0xdf3c('0x84')]=function(_0x354deb,_0x3e4a0e,_0x322cf5){var _0x10f2bf=path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],_0xdf3c('0x85'));var _0x244bf0={'where':{'id':_0x354deb[_0xdf3c('0x57')]['id']},'attributes':['id',_0xdf3c('0x76'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xdf3c('0x5a')](_0x244bf0)['then'](handleEntityNotFound(_0x3e4a0e,null))['then'](function(_0x20f3f5){if(_0x20f3f5){if(!_['isNil'](_0x20f3f5[_0xdf3c('0x76')])){if(fs[_0xdf3c('0x7e')](path['join'](config['root'],'server/files/images/avatars/',_0x20f3f5[_0xdf3c('0x76')]))&&_0x20f3f5[_0xdf3c('0x86')]){_0x10f2bf=path[_0xdf3c('0x79')](config['root'],_0xdf3c('0x82'),_0x20f3f5['customerAvatar']);}}return _0x3e4a0e[_0xdf3c('0x83')](_0x10f2bf);}})['catch'](handleError(_0x3e4a0e,null));};exports['getSystemAvatar']=function(_0xc2a38c,_0x35c941,_0x3ff959){var _0x1aa490=path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],'server/files/images/avatars/system_avatar.png');var _0x4f017c={'where':{'id':_0xc2a38c[_0xdf3c('0x57')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')](_0x4f017c)[_0xdf3c('0x22')](handleEntityNotFound(_0x35c941,null))[_0xdf3c('0x22')](function(_0x2d3f44){if(_0x2d3f44){if(!_[_0xdf3c('0x7d')](_0x2d3f44[_0xdf3c('0x78')])){if(fs['existsSync'](path['join'](config[_0xdf3c('0x7a')],_0xdf3c('0x82'),_0x2d3f44[_0xdf3c('0x78')]))){_0x1aa490=path[_0xdf3c('0x79')](config['root'],_0xdf3c('0x82'),_0x2d3f44[_0xdf3c('0x78')]);}}return _0x35c941[_0xdf3c('0x83')](_0x1aa490);}})[_0xdf3c('0x5b')](handleError(_0x35c941,null));};exports[_0xdf3c('0x87')]=function(_0x4363f6,_0x524482,_0x38ed5d){var _0x4545ce=require('user-agent-parser');var _0x242327=new _0x4545ce();var _0x32e7f7=_0x242327[_0xdf3c('0x88')](_0x4363f6['headers'][_0xdf3c('0x89')])[_0xdf3c('0x8a')]();var _0x3487cf={'body':_0x4363f6[_0xdf3c('0x5d')],'channel':_0xdf3c('0x8b')};var _0x147769=[];var _0x3c91ba=[];var _0x12ffd3={};var _0x1bfa83=![];return db['CmContact'][_0xdf3c('0x65')]()['then'](function(_0x24dd51){if(!_0x24dd51){throw new db[(_0xdf3c('0x8c'))][(_0xdf3c('0x8d'))](_0xdf3c('0x8e'));}_0x147769=_[_0xdf3c('0x8f')](_[_0xdf3c('0x45')](_0x24dd51),[_0xdf3c('0x90'),_0xdf3c('0x91')]);_0x3c91ba=_[_0xdf3c('0x8f')](_[_0xdf3c('0x45')](_0x24dd51),[_0xdf3c('0x90'),'updatedAt',_0xdf3c('0x92'),_0xdf3c('0x93')]);if(_0x4363f6['body']['id']){delete _0x4363f6[_0xdf3c('0x5d')]['id'];}if(_[_0xdf3c('0x7d')](_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0x94')])){throw new db['Sequelize'][(_0xdf3c('0x8d'))](_0xdf3c('0x95'));}if(_[_0xdf3c('0x7d')](_0x4363f6['body']['body'])||_0x4363f6['body'][_0xdf3c('0x5d')]===''){throw new db[(_0xdf3c('0x8c'))][(_0xdf3c('0x8d'))](_0xdf3c('0x96'));}if(_[_0xdf3c('0x7d')](_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0x97')])){throw new db[(_0xdf3c('0x8c'))]['ValidationError'](_0xdf3c('0x98')+_0x3c91ba);}if(!_['includes'](_0x3c91ba,_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0x97')])){throw new db[(_0xdf3c('0x8c'))][(_0xdf3c('0x8d'))](_0xdf3c('0x99')+_0x3c91ba);}_0x12ffd3[_0x4363f6[_0xdf3c('0x5d')]['mapKey']]=_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0x94')];})['then'](function(){return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x4363f6[_0xdf3c('0x57')]['id']},'include':[{'model':db[_0xdf3c('0x9a')],'as':'List','include':[{'model':db[_0xdf3c('0x9b')],'as':'Contacts','where':_0x12ffd3,'limit':0x1,'order':[[_0xdf3c('0x91'),_0xdf3c('0x9c')]]}]},{'model':db[_0xdf3c('0x9d')],'as':_0xdf3c('0x9e')}]});})[_0xdf3c('0x22')](handleEntityNotFound(_0x524482,null))[_0xdf3c('0x22')](function(_0x5be97e){if(_0x5be97e&&_0x5be97e['List']){_0x3487cf['account']=_0x5be97e;_0x3487cf[_0xdf3c('0x9f')]=_0x5be97e[_0xdf3c('0x9e')];_0x3487cf['list']=_0x5be97e['List'];_0x3487cf[_0xdf3c('0x9f')]=_['orderBy'](_0x3487cf['applications'],['priority'],[_0xdf3c('0xa0')]);if(_0x3487cf[_0xdf3c('0xa1')][_0xdf3c('0x9e')]){delete _0x3487cf['account'][_0xdf3c('0x9e')];}if(_0x3487cf['account'][_0xdf3c('0xa2')]&&_0x3487cf[_0xdf3c('0xa1')][_0xdf3c('0xa2')][_0xdf3c('0xa3')][_0xdf3c('0x48')]){return _0x3487cf[_0xdf3c('0xa1')][_0xdf3c('0xa2')][_0xdf3c('0xa3')][0x0];}var _0x2c4ba2=_['defaults'](_0x4363f6[_0xdf3c('0x5d')],{'firstName':_0x4363f6[_0xdf3c('0x5d')]['from'],'ListId':_0x5be97e[_0xdf3c('0x93')]});_0x2c4ba2[_0x4363f6[_0xdf3c('0x5d')]['mapKey']]=_0x4363f6[_0xdf3c('0x5d')]['from'];return db[_0xdf3c('0x9b')][_0xdf3c('0x5c')](_0x2c4ba2,{'fields':_0x147769,'raw':!![]});}})[_0xdf3c('0x22')](handleEntityNotFound(_0x524482,null))[_0xdf3c('0x22')](function(_0x2d1ae3){_0x3487cf[_0xdf3c('0xa4')]=_0x2d1ae3;var _0x232b34=_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xa5')];if(_0x4363f6[_0xdf3c('0xa6')][_0xdf3c('0xa7')]){_0x232b34=_0x4363f6[_0xdf3c('0xa6')][_0xdf3c('0xa7')];}else if(_0x4363f6[_0xdf3c('0xa6')][_0xdf3c('0xa8')]){_0x232b34=_[_0xdf3c('0xa9')](_0x4363f6['headers'][_0xdf3c('0xa8')][_0xdf3c('0xaa')](','));}if(_0x2d1ae3){var _0x4a8e6e={'ContactId':_0x2d1ae3['id'],'ChatWebsiteId':_0x4363f6[_0xdf3c('0x57')]['id'],'from':(_0x2d1ae3[_0xdf3c('0xab')]||'')+'\x20'+(_0x2d1ae3[_0xdf3c('0xac')]||''),'customerIp':_0x232b34,'customerPort':_0x4363f6[_0xdf3c('0xa6')]['x-real-port']?_0x4363f6[_0xdf3c('0xa6')][_0xdf3c('0xad')]:null,'referer':_0x4363f6['body'][_0xdf3c('0xae')],'browserName':_0x32e7f7[_0xdf3c('0xaf')]['name']&&_0x32e7f7['browser'][_0xdf3c('0xb0')]?util[_0xdf3c('0xb1')](_0xdf3c('0xb2'),_0x32e7f7['browser'][_0xdf3c('0x43')],_0x32e7f7['browser'][_0xdf3c('0xb0')]):_0xdf3c('0xb3'),'browserVersion':_0x32e7f7[_0xdf3c('0xaf')][_0xdf3c('0xb0')]||_0xdf3c('0xb3'),'osName':util[_0xdf3c('0xb1')]('%s\x20%s',_0x32e7f7['os'][_0xdf3c('0x43')],_0x32e7f7['os']['version']),'osVersion':_0x32e7f7['os'][_0xdf3c('0xb0')],'deviceModel':_0x32e7f7[_0xdf3c('0xb4')][_0xdf3c('0x42')]&&_0x32e7f7['device'][_0xdf3c('0xb5')]?util['format'](_0xdf3c('0xb6'),_0x32e7f7[_0xdf3c('0xb4')]['model'],_0x32e7f7[_0xdf3c('0xb4')][_0xdf3c('0xb5')],_0x32e7f7[_0xdf3c('0xb4')][_0xdf3c('0x50')]):null,'deviceVendor':_0x32e7f7['device'][_0xdf3c('0xb5')],'deviceType':_0x32e7f7[_0xdf3c('0xb4')][_0xdf3c('0x50')],'formData':JSON[_0xdf3c('0xb7')](_0x4363f6[_0xdf3c('0x5d')])};var _0x2be582={'ChatWebsiteId':_0x4363f6[_0xdf3c('0x57')]['id'],'closed':![]};if(_0x4363f6['body'][_0xdf3c('0xb8')]){_0x2be582[_0xdf3c('0xb8')]=_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xb8')];return db[_0xdf3c('0xb9')][_0xdf3c('0x5a')]({'where':_0x2be582})[_0xdf3c('0x22')](function(_0x6e0498){if(_0x6e0498){return[_0x6e0498,![]];}_0x4a8e6e[_0xdf3c('0xb8')]=_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xb8')];_0x4a8e6e['externalUrl']=_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xba')];return db[_0xdf3c('0xb9')]['create'](_0x4a8e6e)[_0xdf3c('0x22')](function(_0x109153){return[_0x109153,!![]];});});}_0x2be582[_0xdf3c('0xbb')]=_0x2d1ae3['id'];if(_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xbc')]&&_0x4363f6['body'][_0xdf3c('0xbc')]['id']){_0x2be582['id']=_0x4363f6[_0xdf3c('0x5d')]['interaction']['id'];return db[_0xdf3c('0xb9')][_0xdf3c('0x5a')]({'where':_0x2be582})[_0xdf3c('0x22')](function(_0xb39cc){if(_0xb39cc){return[_0xb39cc,![]];}return db[_0xdf3c('0xb9')][_0xdf3c('0x5c')](_0x4a8e6e)[_0xdf3c('0x22')](function(_0x3d9041){return[_0x3d9041,!![]];});});}return db[_0xdf3c('0xb9')]['create'](_0x4a8e6e)[_0xdf3c('0x22')](function(_0x1e1134){return[_0x1e1134,!![]];});}})['spread'](function(_0x39bc51,_0x3e599a){if(_0x39bc51){_0x1bfa83=_0x3e599a;if(!_0x3e599a){var _0x52679b={'from':(_0x3487cf['contact'][_0xdf3c('0xab')]||'')+'\x20'+(_0x3487cf[_0xdf3c('0xa4')][_0xdf3c('0xac')]||'')};if(_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xb8')]&&_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xbd')]&&_0x4363f6[_0xdf3c('0x5d')]['threadId']!=_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xbd')]){_0x52679b[_0xdf3c('0xb8')]=_0x4363f6[_0xdf3c('0x5d')]['messageId'];}return _0x39bc51[_0xdf3c('0x63')](_0x52679b);}else{return _0x39bc51;}}})[_0xdf3c('0x22')](function(_0x137d99){_0x3487cf[_0xdf3c('0xbc')]=_0x137d99['get']({'plain':!![]});_0x3487cf[_0xdf3c('0xbc')][_0xdf3c('0xbe')]=_0x1bfa83;if(_0x3487cf[_0xdf3c('0xbc')]['created']){if(_0x3487cf['account'][_0xdf3c('0xbf')]){_0x3487cf[_0xdf3c('0x9f')][_0xdf3c('0xc0')]({'id':0x0,'priority':_0x3487cf['applications'][_0xdf3c('0x48')]+0x1,'app':_0xdf3c('0xc1'),'appdata':_0xdf3c('0xc2'),'interval':_0xdf3c('0xc3')});}}return db[_0xdf3c('0xc4')]['create']({'body':_0x4363f6['body'][_0xdf3c('0x5d')],'ChatWebsiteId':_0x4363f6['params']['id'],'ChatInteractionId':_0x137d99['id'],'direction':'in','ContactId':_0x3487cf[_0xdf3c('0xa4')]['id'],'AttachmentId':_0x4363f6[_0xdf3c('0x5d')][_0xdf3c('0xc5')]});})[_0xdf3c('0x22')](function(_0x3b55c2){_0x3487cf[_0xdf3c('0x29')]=_0x3b55c2;if(_0x3487cf['interaction'][_0xdf3c('0xc6')]){return db[_0xdf3c('0xc7')][_0xdf3c('0x5a')]({'attributes':['id',_0xdf3c('0x43')],'where':{'id':_0x3487cf['interaction'][_0xdf3c('0xc6')]}})[_0xdf3c('0x22')](function(_0x234c08){if(_0x234c08){_0x3487cf['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xdf3c('0xc8'),'appdata':_0x234c08[_0xdf3c('0x43')]+','+(_0x3487cf['account'][_0xdf3c('0xc9')]||0xa),'interval':'*,*,*,*'});_0x3487cf[_0xdf3c('0xca')]=!![];}return respondWithRpcPromise(_0xdf3c('0xcb'),_0xdf3c('0xcc'),_0x3487cf);});}return respondWithRpcPromise(_0xdf3c('0xcb'),_0xdf3c('0xcc'),_0x3487cf);})[_0xdf3c('0x22')](function(_0x5e5dad){respondWithRpcPromise(_0xdf3c('0xcd'),_0xdf3c('0xcd'),{'event':_0xdf3c('0x87'),'message':_0x5e5dad},client9002);return _0x5e5dad;})[_0xdf3c('0x22')](respondWithResult(_0x524482,null))[_0xdf3c('0x5b')](handleError(_0x524482,null));};exports[_0xdf3c('0xce')]=function(_0x34332b,_0x1dee13,_0x43ce1f){var _0x127bfb,_0x340107,_0x4ac0c8;var _0x29b303=[];var _0x17fb63=[];var _0x5a14cd={};var _0x17b6fe=_0x34332b[_0xdf3c('0xcf')]||[];var _0x2accb4=[];var _0x31ec26;return db[_0xdf3c('0x9b')]['describe']()[_0xdf3c('0x22')](function(_0xa89529){if(!_0xa89529){throw new db[(_0xdf3c('0x8c'))][(_0xdf3c('0x8d'))](_0xdf3c('0x8e'));}_0x17fb63=_[_0xdf3c('0x8f')](_[_0xdf3c('0x45')](_0xa89529),[_0xdf3c('0x90'),_0xdf3c('0x91')]);_0x29b303=_[_0xdf3c('0x8f')](_[_0xdf3c('0x45')](_0xa89529),[_0xdf3c('0x90'),_0xdf3c('0x91'),'CompanyId',_0xdf3c('0x93')]);if(_0x34332b[_0xdf3c('0x5d')]['id']){delete _0x34332b['body']['id'];}if(_[_0xdf3c('0x7d')](_0x34332b[_0xdf3c('0x5d')][_0xdf3c('0x94')])){throw _0x1dee13[_0xdf3c('0x2b')](0x1f4)[_0xdf3c('0xd0')](new db[(_0xdf3c('0x8c'))][(_0xdf3c('0x8d'))](_0xdf3c('0x95')));}if(_[_0xdf3c('0x7d')](_0x34332b[_0xdf3c('0x5d')]['body'])||_0x34332b[_0xdf3c('0x5d')][_0xdf3c('0x5d')]===''){throw _0x1dee13['status'](0x1f4)[_0xdf3c('0xd0')](new db['Sequelize'][(_0xdf3c('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xdf3c('0x7d')](_0x34332b['body'][_0xdf3c('0xd1')])){throw _0x1dee13[_0xdf3c('0x2b')](0x1f4)[_0xdf3c('0xd0')](new db[(_0xdf3c('0x8c'))][(_0xdf3c('0x8d'))](_0xdf3c('0xd2')+_0x29b303));}if(!_[_0xdf3c('0xd3')](_0x29b303,_0x34332b[_0xdf3c('0x5d')]['mapKeyOffline'])){throw _0x1dee13[_0xdf3c('0x2b')](0x1f4)[_0xdf3c('0xd0')](new db[(_0xdf3c('0x8c'))]['ValidationError'](_0xdf3c('0xd4')+_0x29b303));}_0x5a14cd[_0x34332b[_0xdf3c('0x5d')][_0xdf3c('0xd1')]]=_0x34332b[_0xdf3c('0x5d')]['from'];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x34332b[_0xdf3c('0x57')]['id']},'include':[{'model':db[_0xdf3c('0x9a')],'as':_0xdf3c('0xa2')},{'model':db[_0xdf3c('0xd5')],'as':_0xdf3c('0xd5')}]});})[_0xdf3c('0x22')](handleEntityNotFound(_0x1dee13,null))[_0xdf3c('0x22')](function(_0x56e307){if(_0x56e307&&_0x56e307[_0xdf3c('0xa2')]){_0x340107=_0x56e307;var _0x53d331=_[_0xdf3c('0x1b')](_0x34332b[_0xdf3c('0x5d')],{'firstName':_0x34332b[_0xdf3c('0x5d')][_0xdf3c('0x94')],'phone':_0x34332b[_0xdf3c('0x5d')][_0xdf3c('0x94')],'ListId':_0x56e307[_0xdf3c('0x93')]});_0x53d331[_0x34332b[_0xdf3c('0x5d')]['mapKeyOffline']]=_0x34332b[_0xdf3c('0x5d')][_0xdf3c('0x94')];return db[_0xdf3c('0x9b')][_0xdf3c('0xd6')]({'where':_0x5a14cd,'defaults':_0x53d331});}})[_0xdf3c('0xd7')](function(_0x5489e7){if(_0x5489e7){_0x4ac0c8=_0x5489e7;var _0x59f580=fs[_0xdf3c('0xd8')](path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],_0xdf3c('0xd9')),_0xdf3c('0xda'));var _0x10b160=ejs[_0xdf3c('0xdb')](_0x59f580,{'body':_[_0xdf3c('0xdc')](_0x34332b[_0xdf3c('0x5d')][_0xdf3c('0x5d')]),'bodyTitle':_0x340107[_0xdf3c('0xdd')]});return db['ChatOfflineMessage'][_0xdf3c('0x5c')]({'body':_0x10b160,'ContactId':_0x5489e7['id'],'ChatWebsiteId':_0x340107['id']});}})[_0xdf3c('0x22')](function(_0xc27d02){_0x31ec26=_0xc27d02;if(_0x17b6fe[_0xdf3c('0x48')]){var _0x2f451b=_0x17b6fe[_0xdf3c('0x3e')](function(_0x184a55){return{'name':_0x184a55['originalname'],'basename':_0x184a55[_0xdf3c('0x73')],'type':_0x184a55['mimetype'],'ChatOfflineMessageId':_0xc27d02['id']};});_0x2accb4=_0x2f451b[_0xdf3c('0x3e')](_0x4c208c=>{var _0x14b7fc={'filename':_0x4c208c[_0xdf3c('0x43')],'path':path['join'](config['root'],_0xdf3c('0xde'),_0xdf3c('0xcf'),_0xdf3c('0xdf'),_0xdf3c('0xe0'),_0x4c208c[_0xdf3c('0xe1')])};return _0x14b7fc;});if(!_0x340107['openNewInteraction']){return db[_0xdf3c('0xe2')][_0xdf3c('0xe3')](function(_0x3d1e8b){return db[_0xdf3c('0xe4')][_0xdf3c('0xe5')](_0x2f451b,{'transaction':_0x3d1e8b});});}}})['then'](function(){if(_0x31ec26){_0x127bfb=_0x31ec26;return db[_0xdf3c('0xd5')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xdf3c('0xe6')],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x42d720){if(_0x42d720&&_0x42d720[_0xdf3c('0xe7')]&&_0x340107[_0xdf3c('0xe8')]&&_0x340107[_0xdf3c('0xe9')]){var _0x14ac0a={'tls':{'rejectUnauthorized':![]}};if(_0x42d720['Smtp'][_0xdf3c('0xea')]){_0x14ac0a[_0xdf3c('0xea')]=_0x42d720['Smtp'][_0xdf3c('0xea')];}else{_0x14ac0a[_0xdf3c('0xeb')]=_0x42d720[_0xdf3c('0xe7')][_0xdf3c('0xeb')];_0x14ac0a[_0xdf3c('0xec')]=_0x42d720['Smtp'][_0xdf3c('0xec')];_0x14ac0a[_0xdf3c('0xed')]=_0x42d720[_0xdf3c('0xe7')][_0xdf3c('0xed')];}if(_0x42d720[_0xdf3c('0xe7')]['authentication']){_0x14ac0a[_0xdf3c('0xee')]={'user':_0x42d720[_0xdf3c('0xe7')][_0xdf3c('0x5e')],'pass':_0x42d720[_0xdf3c('0xe7')][_0xdf3c('0xef')]};}return respondWithRpcPromise(_0xdf3c('0xf0'),_0xdf3c('0xf1'),{'account':_0x14ac0a,'message':{'from':util[_0xdf3c('0xb1')](_0xdf3c('0xf2'),_0x42d720[_0xdf3c('0x43')],_0x42d720[_0xdf3c('0xf3')]||_0x42d720[_0xdf3c('0xe7')][_0xdf3c('0x5e')]),'to':_0x340107[_0xdf3c('0xe9')],'subject':_0x340107[_0xdf3c('0xf4')],'html':_0x127bfb[_0xdf3c('0x5d')],'attachments':_0x2accb4}},client9003)[_0xdf3c('0x22')](function(){return _0x127bfb;})[_0xdf3c('0x5b')](function(_0x5e4089){console[_0xdf3c('0x28')](_0x5e4089);});}})[_0xdf3c('0x22')](function(){if(_0x340107&&_0x340107[_0xdf3c('0xf5')]&&_0x340107['MailAccountId']){var _0xb9f71c=[];if(_0x17b6fe['length']){_0xb9f71c=_0x17b6fe[_0xdf3c('0x3e')](function(_0x4ac3d7){return{'name':_0x4ac3d7[_0xdf3c('0xf6')],'basename':_0x4ac3d7[_0xdf3c('0x73')],'type':_0x4ac3d7[_0xdf3c('0xf7')],'ChatOfflineMessageId':_0x31ec26['id']};});}var _0xd9aaa5;if(!_[_0xdf3c('0x7d')](_0x340107[_0xdf3c('0xf8')])){var _0xd8be1=_[_0xdf3c('0x3e')](_0x34332b[_0xdf3c('0x5d')],function(_0x4e3a41){return _0x4e3a41;});var _0x3ef6db=_[_0xdf3c('0xf9')](_0xd8be1)[0x0];var _0x341b5e=_[_0xdf3c('0xfa')](_0x3ef6db,function(_0x4e9752){return _0x4e9752;});_0xd9aaa5=_0x341b5e[0x1][_0x340107['subjectOffline']];}var _0x7f1dee={'from':_0x4ac0c8[_0xdf3c('0xf3')],'firstName':_0x4ac0c8[_0xdf3c('0xab')],'lastName':_0x4ac0c8[_0xdf3c('0xac')],'mapKey':'email','message':{'from':_0x4ac0c8[_0xdf3c('0xf3')],'to':_0x340107['MailAccount']['email'],'cc':'','subject':_[_0xdf3c('0x7d')](_0xd9aaa5)?_0x340107[_0xdf3c('0xf4')]:_0xd9aaa5,'messageId':'','sentAt':new Date(),'attach':_0xb9f71c['length'],'attachments':_0xb9f71c,'originChannel':_0xdf3c('0xfb'),'ChatWebsiteId':_0x340107['id'],'ChatOfflineMessageId':_0x127bfb['id'],'originTo':_0x340107[_0xdf3c('0xd5')]['email']},'body':_0x127bfb[_0xdf3c('0x5d')]};var _0x5f3dfa={'account':{'id':_0x340107['MailAccountId']},'body':_0x7f1dee,'log':_0xdf3c('0xfc')};return respondWithRpcPromise(_0xdf3c('0xfc'),_0xdf3c('0xfd'),_0x5f3dfa,client9001)[_0xdf3c('0x22')](function(){return _0x127bfb;})[_0xdf3c('0x5b')](function(_0x2923a7){console['error'](_0x2923a7);});}return;})['then'](function(){if(_0x127bfb){return _0x127bfb;}})[_0xdf3c('0x22')](respondWithResult(_0x1dee13,null))[_0xdf3c('0x5b')](function(_0x1e95b4){console[_0xdf3c('0x28')](_0xdf3c('0x5b'),_0x1e95b4);for(var _0x43feef of _0x17b6fe){var _0x5173b5=path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],_0xdf3c('0xde'),_0xdf3c('0xcf'),'attachments',_0xdf3c('0xe0'),_0x43feef[_0xdf3c('0x73')]);fs_extra['remove'](_0x5173b5)[_0xdf3c('0x5b')](function(_0x34ef43){console[_0xdf3c('0x28')](_0xdf3c('0xfe'),_0x5173b5,_0x34ef43);});}});};exports['addInteraction']=function(_0x486ddb,_0xcb362a,_0x43cff2){return db[_0xdf3c('0xb9')]['find']({'where':{'id':_0x486ddb['params']['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0xcb362a,null))[_0xdf3c('0x22')](function(_0x8709b5){if(_0x8709b5){return _0x8709b5[_0xdf3c('0xff')](_0x486ddb[_0xdf3c('0x5d')][_0xdf3c('0x6b')],_[_0xdf3c('0x100')](_0x486ddb[_0xdf3c('0x5d')],['ids','id'])||{});}})[_0xdf3c('0x22')](respondWithResult(_0xcb362a,null))[_0xdf3c('0x5b')](handleError(_0xcb362a,null));};exports['getInteractions']=function(_0x1eece0,_0x197b3e,_0x5bddc6){var _0x3d497d={'raw':![],'where':{}};var _0x52585f={};var _0x3c572d={'count':0x0,'rows':[]};return db[_0xdf3c('0x3f')][_0xdf3c('0x68')]({'where':{'id':_0x1eece0[_0xdf3c('0x57')]['id']}})['then'](handleEntityNotFound(_0x197b3e,null))['then'](function(_0x515d88){if(_0x515d88){_0x52585f[_0xdf3c('0x42')]=_[_0xdf3c('0x45')](db[_0xdf3c('0xb9')][_0xdf3c('0x40')]);_0x52585f[_0xdf3c('0x44')]=_[_0xdf3c('0x45')](_0x1eece0[_0xdf3c('0x44')]);_0x52585f['filters']=_[_0xdf3c('0x58')](_0x52585f[_0xdf3c('0x42')],_0x52585f['query']);_0x3d497d[_0xdf3c('0x46')]=_['intersection'](_0x52585f[_0xdf3c('0x42')],qs[_0xdf3c('0x47')](_0x1eece0[_0xdf3c('0x44')]['fields']));_0x3d497d[_0xdf3c('0x46')]=_0x3d497d[_0xdf3c('0x46')][_0xdf3c('0x48')]?_0x3d497d[_0xdf3c('0x46')]:_0x52585f[_0xdf3c('0x42')];if(!_0x1eece0['query'][_0xdf3c('0x6f')](_0xdf3c('0x49'))){_0x3d497d[_0xdf3c('0x2e')]=qs[_0xdf3c('0x2e')](_0x1eece0[_0xdf3c('0x44')][_0xdf3c('0x2e')]);_0x3d497d[_0xdf3c('0x30')]=qs['offset'](_0x1eece0[_0xdf3c('0x44')][_0xdf3c('0x30')]);}_0x3d497d[_0xdf3c('0x4a')]=qs['sort'](_0x1eece0[_0xdf3c('0x44')]['sort']);_0x3d497d[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_['pick'](_0x1eece0[_0xdf3c('0x44')],_0x52585f[_0xdf3c('0x4d')]));_0x3d497d[_0xdf3c('0x4c')][_0xdf3c('0x66')]=_0x515d88['id'];if(_0x1eece0[_0xdf3c('0x44')][_0xdf3c('0x4f')]){_0x3d497d[_0xdf3c('0x4c')]=_[_0xdf3c('0x59')](_0x3d497d[_0xdf3c('0x4c')],{'$or':_[_0xdf3c('0x3e')](_0x3d497d[_0xdf3c('0x46')],function(_0x265d99){var _0x59d1db={};_0x59d1db[_0x265d99]={'$like':'%'+_0x1eece0[_0xdf3c('0x44')]['filter']+'%'};return _0x59d1db;})});}_0x3d497d=_['merge']({},_0x3d497d,_0x1eece0['options']);return db['ChatInteraction'][_0xdf3c('0x31')]({'where':_0x3d497d[_0xdf3c('0x4c')]})[_0xdf3c('0x22')](function(_0x1eb736){_0x3c572d[_0xdf3c('0x31')]=_0x1eb736;if(_0x1eece0[_0xdf3c('0x44')]['includeAll']){_0x3d497d[_0xdf3c('0x69')]=[{'model':db['CmContact'],'as':_0xdf3c('0x101'),'required':![]},{'model':db[_0xdf3c('0xc7')],'as':_0xdf3c('0x102'),'attributes':[_0xdf3c('0x43'),_0xdf3c('0x103'),_0xdf3c('0x104')],'required':![]},{'model':db[_0xdf3c('0x105')],'as':_0xdf3c('0x106'),'attributes':['id',_0xdf3c('0x43'),'color'],'where':_0x1eece0[_0xdf3c('0x44')][_0xdf3c('0x107')]?{'id':_0x1eece0[_0xdf3c('0x44')][_0xdf3c('0x107')]}:undefined,'required':_0x1eece0['query']['tag']?!![]:![]}];}return db[_0xdf3c('0xb9')][_0xdf3c('0x54')](_0x3d497d);})[_0xdf3c('0x22')](function(_0x5f557c){_0x3c572d['rows']=_0x5f557c;return _0x3c572d;});}})[_0xdf3c('0x22')](respondWithFilteredResult(_0x197b3e,_0x3d497d))[_0xdf3c('0x5b')](handleError(_0x197b3e,null));};function iftimePromise(_0x1cc94d,_0x3a2347){return respondWithRpcPromise(_0xdf3c('0x108'),_0xdf3c('0x109'),{'command':_0x3a2347[_0xdf3c('0x10a')]?util['format'](_0xdf3c('0x10b'),_0x1cc94d[_0xdf3c('0x10c')],_0x3a2347[_0xdf3c('0x10a')]):util[_0xdf3c('0xb1')](_0xdf3c('0x10d'),_0x1cc94d[_0xdf3c('0x10c')])},client9002)['then'](function(_0x4cfc67){var _0xf24286=_0x4cfc67&&_0x4cfc67[_0xdf3c('0x10e')](_0xdf3c('0x10f'))>=0x0?!![]:![];logger[_0xdf3c('0x23')](_0xdf3c('0x110'),_0x3a2347['id'],_0x1cc94d['id'],_0x1cc94d['interval'],_0xf24286?_0xdf3c('0x111'):_0xdf3c('0x112'),_0x3a2347[_0xdf3c('0x10a')]?_0x3a2347[_0xdf3c('0x10a')]:_0xdf3c('0x113'));return _0xf24286;})[_0xdf3c('0x5b')](function(_0x55bd8f){logger[_0xdf3c('0x28')](_0xdf3c('0x110'),_0x3a2347['id'],_0x1cc94d['id'],_0x1cc94d['interval'],util[_0xdf3c('0x114')](_0x55bd8f,{'showHidden':![],'depth':null}),_0x3a2347['timezone']?_0x3a2347[_0xdf3c('0x10a')]:_0xdf3c('0x113'));return![];});}exports[_0xdf3c('0x109')]=function(_0x16b173,_0x578e41,_0x4815ee){var _0xa523c8=0x0;var _0x52ae27=0x0;var _0xe4ea87=![];var _0x176f4d;var _0x29d64d;return db['ChatWebsite'][_0xdf3c('0x5a')]({'where':{'id':_0x16b173[_0xdf3c('0x57')]['id']},'include':[{'model':db[_0xdf3c('0x115')],'as':_0xdf3c('0x115'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xdf3c('0x10c')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x578e41,null))[_0xdf3c('0x22')](function(_0x2d6308){if(_0x2d6308){_0x176f4d=_0x2d6308;return _0x2d6308[_0xdf3c('0x116')]({'raw':!![]});}})[_0xdf3c('0x22')](function(_0x3f5455){if(_0x176f4d){if(_0x3f5455){_0x29d64d=_0x3f5455;}}return require('../../config/license/util')[_0xdf3c('0x7c')]();})[_0xdf3c('0x22')](function(_0x21aade){if(_0x21aade){_0x52ae27=_0x21aade['virtual'];_0xe4ea87=_0x21aade[_0xdf3c('0x117')];}})[_0xdf3c('0x22')](function(){return db[_0xdf3c('0xb9')][_0xdf3c('0x31')]({'where':{'closed':![]}});})[_0xdf3c('0x22')](function(_0xc2306c){_0xa523c8=_0xc2306c;if(_0x52ae27&&_0xc2306c>_0x52ae27){return db[_0xdf3c('0x118')]['findOne']({'where':{'id':0x1}})['then'](function(_0x112caa){if(_0x112caa){_0x112caa['increment'](_0xdf3c('0x119'));}});}})[_0xdf3c('0x22')](function(){if(_0x176f4d[_0xdf3c('0x115')]&&_0x176f4d[_0xdf3c('0x115')]['Intervals']){var _0x1bf0ec=[];for(var _0x4fe805=0x0;_0x4fe805<_0x176f4d[_0xdf3c('0x115')]['Intervals'][_0xdf3c('0x48')];_0x4fe805++){var _0x46b908=_0x176f4d[_0xdf3c('0x115')][_0xdf3c('0x11a')][_0x4fe805][_0xdf3c('0x37')]({'plain':!![]});_0x1bf0ec[_0xdf3c('0xc0')](iftimePromise(_0x46b908,_0x176f4d));}return BPromise[_0xdf3c('0x11b')](_0x1bf0ec)['then'](function(_0x318357){return _[_0xdf3c('0x11c')](_0x318357);});}else{return!![];}})[_0xdf3c('0x22')](function(_0xf8ab05){var _0x5bccce=fs[_0xdf3c('0xd8')](path[_0xdf3c('0x79')](config[_0xdf3c('0x7a')],_0xdf3c('0x11d')),_0xdf3c('0xda'));var _0x526533={'remote':_0x176f4d['remote'],'query':querystring['stringify'](_[_0xdf3c('0x59')](_0x176f4d['get']({'plain':!![]}),{'customerIp':_0x16b173[_0xdf3c('0xa6')]['x-forwarded-for']||_0x16b173[_0xdf3c('0xa6')][_0xdf3c('0x11e')]||_0x16b173[_0xdf3c('0x11f')]['remoteAddress']||_0x16b173['ip'],'referer':_0x16b173['headers']['referer'],'openedInteractions':_0xa523c8,'maxInteractions':_0x52ae27,'virtual':_0xe4ea87[_0xdf3c('0x120')],'online':_0xf8ab05,'custom':_0xe4ea87}))[_0xdf3c('0x121')](/'/g,'\x5c\x27')};_0x578e41['send'](ejs[_0xdf3c('0xdb')](Mustache[_0xdf3c('0xdb')](_0x5bccce,_0x526533),{'proactiveActions':_0x29d64d,'alignment':_0x176f4d[_0xdf3c('0x122')],'verticalAlignment':_0x176f4d[_0xdf3c('0x123')],'div_color':_0x176f4d[_0xdf3c('0x124')],'text_color':_0x176f4d[_0xdf3c('0x125')],'button_color':_0x176f4d[_0xdf3c('0x126')],'background_color':_0x176f4d[_0xdf3c('0x127')]}));})['catch'](handleError(_0x578e41,null));};exports[_0xdf3c('0x128')]=function(_0x300680,_0x37e578,_0x11436f){return db[_0xdf3c('0x3f')]['findOne']({'where':{'id':_0x300680[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x37e578,null))[_0xdf3c('0x22')](function(_0x1be5e3){if(_0x1be5e3){return db[_0xdf3c('0xe2')][_0xdf3c('0xe3')](function(_0x48093a){return db[_0xdf3c('0x9d')]['destroy']({'where':{'ChatWebsiteId':_0x300680[_0xdf3c('0x57')]['id']},'transaction':_0x48093a})[_0xdf3c('0x22')](function(_0x393dc9){var _0x1094d0=_[_0xdf3c('0x3e')](_0x300680[_0xdf3c('0x5d')],function(_0x3c1a8a){_0x3c1a8a[_0xdf3c('0x66')]=_0x300680[_0xdf3c('0x57')]['id'];return _0x3c1a8a;});return db['ChatApplication'][_0xdf3c('0xe5')](_0x1094d0,{'transaction':_0x48093a});});})[_0xdf3c('0x22')](function(){return db[_0xdf3c('0x9d')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x300680[_0xdf3c('0x57')]['id']},'order':'priority'});});}})[_0xdf3c('0x22')](respondWithResult(_0x37e578,null))[_0xdf3c('0x5b')](handleError(_0x37e578,null));};exports[_0xdf3c('0x129')]=function(_0x129f20,_0x44abeb,_0xb1c654){var _0x311098={};var _0x260d6f={};var _0x26645e;var _0x33230c;return db[_0xdf3c('0x3f')][_0xdf3c('0x68')]({'where':{'id':_0x129f20['params']['id']}})['then'](handleEntityNotFound(_0x44abeb,null))['then'](function(_0x374ac7){if(_0x374ac7){_0x26645e=_0x374ac7;_0x260d6f[_0xdf3c('0x42')]=_[_0xdf3c('0x45')](db[_0xdf3c('0x9d')][_0xdf3c('0x40')]);_0x260d6f[_0xdf3c('0x44')]=_[_0xdf3c('0x45')](_0x129f20[_0xdf3c('0x44')]);_0x260d6f[_0xdf3c('0x4d')]=_[_0xdf3c('0x58')](_0x260d6f[_0xdf3c('0x42')],_0x260d6f[_0xdf3c('0x44')]);_0x311098[_0xdf3c('0x46')]=_['intersection'](_0x260d6f['model'],qs[_0xdf3c('0x47')](_0x129f20[_0xdf3c('0x44')][_0xdf3c('0x47')]));_0x311098['attributes']=_0x311098[_0xdf3c('0x46')]['length']?_0x311098[_0xdf3c('0x46')]:_0x260d6f[_0xdf3c('0x42')];_0x311098['order']=qs[_0xdf3c('0x4b')](_0x129f20[_0xdf3c('0x44')][_0xdf3c('0x4b')]);_0x311098[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_[_0xdf3c('0x4e')](_0x129f20[_0xdf3c('0x44')],_0x260d6f[_0xdf3c('0x4d')]));if(_0x129f20['query'][_0xdf3c('0x4f')]){_0x311098[_0xdf3c('0x4c')]=_[_0xdf3c('0x59')](_0x311098[_0xdf3c('0x4c')],{'$or':_['map'](_0x311098['attributes'],function(_0x3aca0b){var _0x375297={};_0x375297[_0x3aca0b]={'$like':'%'+_0x129f20[_0xdf3c('0x44')][_0xdf3c('0x4f')]+'%'};return _0x375297;})});}_0x311098=_['merge']({},_0x311098,_0x129f20['options']);return _0x26645e[_0xdf3c('0x129')](_0x311098);}})[_0xdf3c('0x22')](function(_0x381d88){if(_0x381d88){_0x33230c=_0x381d88['length'];if(!_0x129f20[_0xdf3c('0x44')]['hasOwnProperty'](_0xdf3c('0x49'))){_0x311098[_0xdf3c('0x2e')]=qs[_0xdf3c('0x2e')](_0x129f20['query']['limit']);_0x311098[_0xdf3c('0x30')]=qs[_0xdf3c('0x30')](_0x129f20[_0xdf3c('0x44')]['offset']);}return _0x26645e[_0xdf3c('0x129')](_0x311098);}})[_0xdf3c('0x22')](function(_0x4b16d8){if(_0x4b16d8){return _0x4b16d8?{'count':_0x33230c,'rows':_0x4b16d8}:null;}})[_0xdf3c('0x22')](respondWithResult(_0x44abeb,null))[_0xdf3c('0x5b')](handleError(_0x44abeb,null));};exports[_0xdf3c('0x12a')]=function(_0x3886f8,_0x2f1979,_0x3e8060){return db[_0xdf3c('0x12b')][_0xdf3c('0x5a')]({'where':{'id':_0x3886f8[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x2f1979,null))[_0xdf3c('0x22')](function(_0x544131){if(_0x544131){return _0x544131[_0xdf3c('0x12a')](_0x3886f8[_0xdf3c('0x5d')][_0xdf3c('0x6b')],_['omit'](_0x3886f8[_0xdf3c('0x5d')],[_0xdf3c('0x6b'),'id'])||{});}})[_0xdf3c('0x22')](respondWithResult(_0x2f1979,null))[_0xdf3c('0x5b')](handleError(_0x2f1979,null));};exports['getProactiveActions']=function(_0x3a163f,_0x33266f,_0x317d42){var _0xe89ca2={};var _0x1b21cd={};var _0x3ee81b;var _0x59b3f2;return db[_0xdf3c('0x3f')]['findOne']({'where':{'id':_0x3a163f[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x33266f,null))[_0xdf3c('0x22')](function(_0x3221e1){if(_0x3221e1){_0x3ee81b=_0x3221e1;_0x1b21cd[_0xdf3c('0x42')]=_[_0xdf3c('0x45')](db[_0xdf3c('0x12c')][_0xdf3c('0x40')]);_0x1b21cd['query']=_[_0xdf3c('0x45')](_0x3a163f['query']);_0x1b21cd[_0xdf3c('0x4d')]=_['intersection'](_0x1b21cd['model'],_0x1b21cd[_0xdf3c('0x44')]);_0xe89ca2[_0xdf3c('0x46')]=_['intersection'](_0x1b21cd[_0xdf3c('0x42')],qs['fields'](_0x3a163f['query'][_0xdf3c('0x47')]));_0xe89ca2[_0xdf3c('0x46')]=_0xe89ca2[_0xdf3c('0x46')][_0xdf3c('0x48')]?_0xe89ca2[_0xdf3c('0x46')]:_0x1b21cd[_0xdf3c('0x42')];_0xe89ca2[_0xdf3c('0x4a')]=qs[_0xdf3c('0x4b')](_0x3a163f['query'][_0xdf3c('0x4b')]);_0xe89ca2[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_[_0xdf3c('0x4e')](_0x3a163f[_0xdf3c('0x44')],_0x1b21cd[_0xdf3c('0x4d')]));if(_0x3a163f['query'][_0xdf3c('0x4f')]){_0xe89ca2[_0xdf3c('0x4c')]=_[_0xdf3c('0x59')](_0xe89ca2[_0xdf3c('0x4c')],{'$or':_['map'](_0xe89ca2['attributes'],function(_0x418076){var _0x4971b9={};_0x4971b9[_0x418076]={'$like':'%'+_0x3a163f[_0xdf3c('0x44')]['filter']+'%'};return _0x4971b9;})});}_0xe89ca2=_[_0xdf3c('0x59')]({},_0xe89ca2,_0x3a163f[_0xdf3c('0x52')]);return _0x3ee81b['getProactiveActions'](_0xe89ca2);}})[_0xdf3c('0x22')](function(_0x2a37bc){if(_0x2a37bc){_0x59b3f2=_0x2a37bc[_0xdf3c('0x48')];if(!_0x3a163f[_0xdf3c('0x44')][_0xdf3c('0x6f')](_0xdf3c('0x49'))){_0xe89ca2['limit']=qs['limit'](_0x3a163f[_0xdf3c('0x44')]['limit']);_0xe89ca2[_0xdf3c('0x30')]=qs[_0xdf3c('0x30')](_0x3a163f[_0xdf3c('0x44')][_0xdf3c('0x30')]);}return _0x3ee81b[_0xdf3c('0x116')](_0xe89ca2);}})[_0xdf3c('0x22')](function(_0x5ef7a6){if(_0x5ef7a6){return _0x5ef7a6?{'count':_0x59b3f2,'rows':_0x5ef7a6}:null;}})['then'](respondWithResult(_0x33266f,null))['catch'](handleError(_0x33266f,null));};exports[_0xdf3c('0x12d')]=function(_0x4a053a,_0x2b95a7,_0x2efa8d){var _0x5ddb69=_0x4a053a[_0xdf3c('0x44')][_0xdf3c('0x12e')]===_0xdf3c('0x12f')?_0xdf3c('0x130'):_0xdf3c('0x131');return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'attributes':['id',_0x5ddb69],'where':{'id':_0x4a053a[_0xdf3c('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b95a7,null))[_0xdf3c('0x22')](function(_0x2de97b){if(_0x2de97b){var _0x1c625f=_0x2de97b[_0x5ddb69];var _0x123213=_0x1c625f&&_0x1c625f[_0xdf3c('0x132')]?_0x1c625f[_0xdf3c('0x132')]:[];_0x2b95a7[_0xdf3c('0xd0')]({'fromKey':_[_0xdf3c('0x7d')](_0x1c625f[_0xdf3c('0x133')])?undefined:_0x1c625f[_0xdf3c('0x133')],'count':_0x123213[_0xdf3c('0x48')],'rows':_0x123213});}})[_0xdf3c('0x5b')](handleError(_0x2b95a7,null));};exports[_0xdf3c('0x134')]=function(_0x6df8b5,_0x201309,_0x516aa3){var _0x3a2125={'raw':![],'where':{}};var _0x4b9ff8={};var _0x3bfd59={'count':0x0,'rows':[]};return db[_0xdf3c('0x3f')]['findOne']({'where':{'id':_0x6df8b5[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x201309,null))['then'](function(_0x1fa049){if(_0x1fa049){_0x4b9ff8[_0xdf3c('0x42')]=_[_0xdf3c('0x45')](db[_0xdf3c('0x135')]['rawAttributes']);_0x4b9ff8['query']=_[_0xdf3c('0x45')](_0x6df8b5[_0xdf3c('0x44')]);_0x4b9ff8['filters']=_[_0xdf3c('0x58')](_0x4b9ff8[_0xdf3c('0x42')],_0x4b9ff8[_0xdf3c('0x44')]);_0x3a2125[_0xdf3c('0x46')]=_[_0xdf3c('0x58')](_0x4b9ff8[_0xdf3c('0x42')],qs[_0xdf3c('0x47')](_0x6df8b5[_0xdf3c('0x44')]['fields']));_0x3a2125[_0xdf3c('0x46')]=_0x3a2125[_0xdf3c('0x46')][_0xdf3c('0x48')]?_0x3a2125[_0xdf3c('0x46')]:_0x4b9ff8[_0xdf3c('0x42')];if(!_0x6df8b5[_0xdf3c('0x44')][_0xdf3c('0x6f')]('nolimit')){_0x3a2125[_0xdf3c('0x2e')]=qs[_0xdf3c('0x2e')](_0x6df8b5[_0xdf3c('0x44')][_0xdf3c('0x2e')]);_0x3a2125[_0xdf3c('0x30')]=qs[_0xdf3c('0x30')](_0x6df8b5[_0xdf3c('0x44')][_0xdf3c('0x30')]);}_0x3a2125[_0xdf3c('0x4a')]=qs[_0xdf3c('0x4b')](_0x6df8b5['query'][_0xdf3c('0x4b')]);_0x3a2125[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_[_0xdf3c('0x4e')](_0x6df8b5[_0xdf3c('0x44')],_0x4b9ff8[_0xdf3c('0x4d')]));_0x3a2125[_0xdf3c('0x4c')][_0xdf3c('0x66')]=_0x1fa049['id'];if(_0x6df8b5['query']['filter']){_0x3a2125[_0xdf3c('0x4c')]=_['merge'](_0x3a2125[_0xdf3c('0x4c')],{'$or':_[_0xdf3c('0x3e')](_0x3a2125[_0xdf3c('0x46')],function(_0x2ae851){var _0x15a1f1={};_0x15a1f1[_0x2ae851]={'$like':'%'+_0x6df8b5['query'][_0xdf3c('0x4f')]+'%'};return _0x15a1f1;})});}_0x3a2125=_[_0xdf3c('0x59')]({},_0x3a2125,_0x6df8b5[_0xdf3c('0x52')]);return db[_0xdf3c('0x135')][_0xdf3c('0x31')]({'where':_0x3a2125['where']})['then'](function(_0x471f69){_0x3bfd59[_0xdf3c('0x31')]=_0x471f69;if(_0x6df8b5[_0xdf3c('0x44')][_0xdf3c('0x53')]){_0x3a2125[_0xdf3c('0x69')]=[{'all':!![]}];}else{_0x3a2125[_0xdf3c('0x69')]=[{'model':db['CmContact'],'as':_0xdf3c('0x101'),'required':![]},{'model':db[_0xdf3c('0xe4')],'as':_0xdf3c('0x136'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x3a2125);})[_0xdf3c('0x22')](function(_0x584fbb){_0x3bfd59['rows']=_0x584fbb;return _0x3bfd59;});}})[_0xdf3c('0x22')](respondWithFilteredResult(_0x201309,_0x3a2125))[_0xdf3c('0x5b')](handleError(_0x201309,null));};exports['addAgents']=function(_0x34fa27,_0x1a27f3,_0xc23548){return db[_0xdf3c('0x3f')][_0xdf3c('0x5a')]({'where':{'id':_0x34fa27[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x1a27f3,null))['then'](function(_0x4a8c32){if(_0x4a8c32){return _0x4a8c32[_0xdf3c('0x137')](_0x34fa27[_0xdf3c('0x5d')][_0xdf3c('0x6b')],_[_0xdf3c('0x100')](_0x34fa27[_0xdf3c('0x5d')],[_0xdf3c('0x6b'),'id'])||{})[_0xdf3c('0xd7')](function(_0x20e6b0){for(var _0x197cd9=0x0;_0x197cd9<_0x34fa27[_0xdf3c('0x5d')][_0xdf3c('0x6b')][_0xdf3c('0x48')];_0x197cd9+=0x1){socket['emit'](_0xdf3c('0x138'),{'UserId':_0x34fa27[_0xdf3c('0x5d')][_0xdf3c('0x6b')][_0x197cd9],'ChatWebsiteId':_0x34fa27[_0xdf3c('0x57')]['id']});}return _0x20e6b0;});}})[_0xdf3c('0x22')](respondWithResult(_0x1a27f3,null))[_0xdf3c('0x5b')](handleError(_0x1a27f3,null));};exports[_0xdf3c('0x139')]=function(_0x3c67b6,_0x426c7d,_0x243447){return db['ChatWebsite'][_0xdf3c('0x5a')]({'where':{'id':_0x3c67b6[_0xdf3c('0x57')]['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x426c7d,null))['then'](function(_0x3ca5b2){if(_0x3ca5b2){return _0x3ca5b2[_0xdf3c('0x139')](_0x3c67b6[_0xdf3c('0x44')][_0xdf3c('0x6b')])['then'](function(){if(_[_0xdf3c('0x13a')](_0x3c67b6['query'][_0xdf3c('0x6b')])){for(var _0x2af066=0x0;_0x2af066<_0x3c67b6['query'][_0xdf3c('0x6b')][_0xdf3c('0x48')];_0x2af066+=0x1){socket[_0xdf3c('0x13b')](_0xdf3c('0x13c'),{'UserId':Number(_0x3c67b6['query'][_0xdf3c('0x6b')][_0x2af066]),'ChatWebsiteId':Number(_0x3c67b6[_0xdf3c('0x57')]['id'])});}}else{socket['emit'](_0xdf3c('0x13c'),{'UserId':Number(_0x3c67b6['query'][_0xdf3c('0x6b')]),'ChatWebsiteId':Number(_0x3c67b6['params']['id'])});}});}})[_0xdf3c('0x22')](respondWithStatusCode(_0x426c7d,null))[_0xdf3c('0x5b')](handleError(_0x426c7d,null));};exports['getAgents']=function(_0x32d80c,_0x5c8dcc,_0x399564){var _0xe21bfd={};var _0x46b7ad={};var _0x336678;var _0xf1fea2;return db[_0xdf3c('0x3f')]['findOne']({'where':{'id':_0x32d80c['params']['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x5c8dcc,null))['then'](function(_0x31fe92){if(_0x31fe92){_0x336678=_0x31fe92;_0x46b7ad[_0xdf3c('0x42')]=_[_0xdf3c('0x45')](db['User'][_0xdf3c('0x40')]);_0x46b7ad[_0xdf3c('0x44')]=_['keys'](_0x32d80c['query']);_0x46b7ad[_0xdf3c('0x4d')]=_['intersection'](_0x46b7ad[_0xdf3c('0x42')],_0x46b7ad[_0xdf3c('0x44')]);_0xe21bfd[_0xdf3c('0x46')]=_[_0xdf3c('0x58')](_0x46b7ad['model'],qs['fields'](_0x32d80c[_0xdf3c('0x44')][_0xdf3c('0x47')]));_0xe21bfd[_0xdf3c('0x46')]=_0xe21bfd[_0xdf3c('0x46')][_0xdf3c('0x48')]?_0xe21bfd['attributes']:_0x46b7ad[_0xdf3c('0x42')];_0xe21bfd[_0xdf3c('0x4a')]=qs[_0xdf3c('0x4b')](_0x32d80c[_0xdf3c('0x44')][_0xdf3c('0x4b')]);_0xe21bfd[_0xdf3c('0x4c')]=qs['filters'](_[_0xdf3c('0x4e')](_0x32d80c['query'],_0x46b7ad[_0xdf3c('0x4d')]));if(_0x32d80c['query'][_0xdf3c('0x4f')]){_0xe21bfd[_0xdf3c('0x4c')]=_['merge'](_0xe21bfd[_0xdf3c('0x4c')],{'$or':_['map'](_0xe21bfd[_0xdf3c('0x46')],function(_0x123166){var _0x241f9d={};_0x241f9d[_0x123166]={'$like':'%'+_0x32d80c[_0xdf3c('0x44')][_0xdf3c('0x4f')]+'%'};return _0x241f9d;})});}_0xe21bfd=_[_0xdf3c('0x59')]({},_0xe21bfd,_0x32d80c[_0xdf3c('0x52')]);return _0x336678[_0xdf3c('0x13d')](_0xe21bfd);}})[_0xdf3c('0x22')](function(_0xfa1485){if(_0xfa1485){_0xf1fea2=_0xfa1485[_0xdf3c('0x48')];if(!_0x32d80c[_0xdf3c('0x44')][_0xdf3c('0x6f')]('nolimit')){_0xe21bfd[_0xdf3c('0x2e')]=qs[_0xdf3c('0x2e')](_0x32d80c[_0xdf3c('0x44')][_0xdf3c('0x2e')]);_0xe21bfd[_0xdf3c('0x30')]=qs[_0xdf3c('0x30')](_0x32d80c['query']['offset']);}return _0x336678[_0xdf3c('0x13d')](_0xe21bfd);}})[_0xdf3c('0x22')](function(_0x2fe4b1){if(_0x2fe4b1){return _0x2fe4b1?{'count':_0xf1fea2,'rows':_0x2fe4b1}:null;}})[_0xdf3c('0x22')](respondWithResult(_0x5c8dcc,null))['catch'](handleError(_0x5c8dcc,null));}; \ No newline at end of file +var _0x9957=['list','orderBy','priority','asc','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','originalname','server','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','email','Chat','notifyMail','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','getInteractions','Owner','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','offlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','rows','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','save','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','query','filters','intersection','fields','attributes','model','hasOwnProperty','offset','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','show','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','find','userProfileId','update','describe','addDisposition','Disposition','getDispositions','findOne','keys','nolimit','pick','ChatWebsiteId','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','agentAvatar','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','DESC','ChatApplication','Applications','account','applications'];(function(_0x1ec137,_0x2ca81c){var _0x3bd09=function(_0x5e7798){while(--_0x5e7798){_0x1ec137['push'](_0x1ec137['shift']());}};_0x3bd09(++_0x2ca81c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];config[_0x7995('0x1b')]=_[_0x7995('0x1c')](config[_0x7995('0x1b')],{'host':_0x7995('0x1d'),'port':0x18eb});var socket=require(_0x7995('0x1e'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x7995('0x1f')](socket);var jayson=require(_0x7995('0x20'));var client=jayson[_0x7995('0x21')][_0x7995('0x22')]({'port':0x232c});var client9002=jayson[_0x7995('0x21')][_0x7995('0x22')]({'port':0x232a});var client9003=jayson[_0x7995('0x21')][_0x7995('0x22')]({'port':0x232b});var client9001=jayson['client'][_0x7995('0x22')]({'port':0x2329});function respondWithRpcPromise(_0x565d97,_0x2f832e,_0x37f297,_0x43d4b8){return new BPromise(function(_0x291317,_0x1e1415){var _0x37a7d4=_0x43d4b8||client;return _0x37a7d4['request'](_0x565d97,_0x37f297)['then'](function(_0x2536c8){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2f832e,_0x7995('0x23'));logger[_0x7995('0x24')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2f832e,_0x7995('0x23'),JSON['stringify'](_0x2536c8));if(_0x2536c8['error']){if(_0x2536c8[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')](_0x7995('0x27'),_0x2f832e,_0x2536c8[_0x7995('0x25')][_0x7995('0x28')]);return _0x1e1415(_0x2536c8['error'][_0x7995('0x28')]);}logger[_0x7995('0x25')](_0x7995('0x27'),_0x2f832e,_0x2536c8[_0x7995('0x25')][_0x7995('0x28')]);return _0x291317(_0x2536c8[_0x7995('0x25')][_0x7995('0x28')]);}else{logger[_0x7995('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x2f832e,_0x7995('0x23'));_0x291317(_0x2536c8[_0x7995('0x2a')][_0x7995('0x28')]);}})[_0x7995('0x2b')](function(_0x3a3fcf){logger[_0x7995('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x2f832e,_0x3a3fcf);_0x1e1415(_0x3a3fcf);});});}function respondWithStatusCode(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0xcc;return function(_0x229742){if(_0x229742){return _0x47625f[_0x7995('0x2c')](_0x5911c3);}return _0x47625f[_0x7995('0x2d')](_0x5911c3)[_0x7995('0x2e')]();};}function respondWithResult(_0x11c1eb,_0x4b6f99){_0x4b6f99=_0x4b6f99||0xc8;return function(_0x9b2a15){if(_0x9b2a15){return _0x11c1eb['status'](_0x4b6f99)[_0x7995('0x2f')](_0x9b2a15);}};}function respondWithFilteredResult(_0x3250e0,_0x4253e5){return function(_0x574574){if(_0x574574){var _0x530611=typeof _0x4253e5['offset']===_0x7995('0x30')&&typeof _0x4253e5[_0x7995('0x31')]===_0x7995('0x30');var _0x2b874d=_0x574574[_0x7995('0x32')];var _0x1ca460=_0x530611?0x0:_0x4253e5['offset'];var _0x481c74=_0x530611?_0x574574[_0x7995('0x32')]:_0x4253e5['offset']+_0x4253e5[_0x7995('0x31')];var _0x3eb566;if(_0x481c74>=_0x2b874d){_0x481c74=_0x2b874d;_0x3eb566=0xc8;}else{_0x3eb566=0xce;}_0x3250e0[_0x7995('0x2d')](_0x3eb566);return _0x3250e0[_0x7995('0x33')](_0x7995('0x34'),_0x1ca460+'-'+_0x481c74+'/'+_0x2b874d)['json'](_0x574574);}return null;};}function patchUpdates(_0x44309d){return function(_0x33e24e){try{jsonpatch['apply'](_0x33e24e,_0x44309d,!![]);}catch(_0x48db25){return BPromise['reject'](_0x48db25);}return _0x33e24e[_0x7995('0x35')]();};}function saveUpdates(_0x3acfc3,_0x4a176f){return function(_0x3e7020){if(_0x3e7020){return _0x3e7020['update'](_0x3acfc3)[_0x7995('0x36')](function(_0x1cb058){return _0x1cb058;});}return null;};}function removeEntity(_0x177cb4,_0x5014d2){return function(_0x52d76d){if(_0x52d76d){return _0x52d76d[_0x7995('0x37')]()['then'](function(){var _0x5d2428=_0x52d76d[_0x7995('0x38')]({'plain':!![]});var _0xe328b1='ChatWebsites';return db[_0x7995('0x39')][_0x7995('0x37')]({'where':{'type':_0xe328b1,'resourceId':_0x5d2428['id']}})[_0x7995('0x36')](function(){return _0x52d76d;});})[_0x7995('0x36')](function(){_0x177cb4[_0x7995('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d4285,_0x242713){return function(_0xf612e6){if(!_0xf612e6){_0x2d4285[_0x7995('0x2c')](0x194);}return _0xf612e6;};}function handleError(_0x4b1541,_0x2be2c0){_0x2be2c0=_0x2be2c0||0x1f4;return function(_0x235df7){logger[_0x7995('0x25')](_0x235df7[_0x7995('0x3a')]);if(_0x235df7[_0x7995('0x3b')]){delete _0x235df7[_0x7995('0x3b')];}_0x4b1541['status'](_0x2be2c0)[_0x7995('0x3c')](_0x235df7);};}exports[_0x7995('0x3d')]=function(_0x8a1be0,_0x2ea47f){var _0x2e04cd={'include':[{'model':db[_0x7995('0x3e')],'as':_0x7995('0x3f')}]},_0x298fc2={},_0x14d638={'count':0x0,'rows':[]};var _0x447981=_[_0x7995('0x40')](db[_0x7995('0x41')][_0x7995('0x42')],function(_0x53cda2){return{'name':_0x53cda2['fieldName'],'type':_0x53cda2[_0x7995('0x43')][_0x7995('0x44')]};});_0x298fc2['model']=_['map'](_0x447981,_0x7995('0x3b'));_0x298fc2['query']=_['keys'](_0x8a1be0[_0x7995('0x45')]);_0x298fc2[_0x7995('0x46')]=_[_0x7995('0x47')](_0x298fc2['model'],_0x298fc2[_0x7995('0x45')]);_0x2e04cd['attributes']=_[_0x7995('0x47')](_0x298fc2['model'],qs['fields'](_0x8a1be0[_0x7995('0x45')][_0x7995('0x48')]));_0x2e04cd[_0x7995('0x49')]=_0x2e04cd[_0x7995('0x49')]['length']?_0x2e04cd[_0x7995('0x49')]:_0x298fc2[_0x7995('0x4a')];if(!_0x8a1be0[_0x7995('0x45')][_0x7995('0x4b')]('nolimit')){_0x2e04cd['limit']=qs[_0x7995('0x31')](_0x8a1be0['query'][_0x7995('0x31')]);_0x2e04cd['offset']=qs[_0x7995('0x4c')](_0x8a1be0['query'][_0x7995('0x4c')]);}_0x2e04cd[_0x7995('0x4d')]=qs['sort'](_0x8a1be0[_0x7995('0x45')][_0x7995('0x4e')]);_0x2e04cd[_0x7995('0x4f')]=qs[_0x7995('0x46')](_['pick'](_0x8a1be0[_0x7995('0x45')],_0x298fc2[_0x7995('0x46')]),_0x447981);if(_0x8a1be0[_0x7995('0x45')]['filter']){_0x2e04cd[_0x7995('0x4f')]=_[_0x7995('0x50')](_0x2e04cd[_0x7995('0x4f')],{'$or':_[_0x7995('0x40')](_0x447981,function(_0x255313){if(_0x255313['type']!==_0x7995('0x51')){var _0xfb72b2={};_0xfb72b2[_0x255313['name']]={'$like':'%'+_0x8a1be0[_0x7995('0x45')]['filter']+'%'};return _0xfb72b2;}})});}_0x2e04cd=_[_0x7995('0x50')]({},_0x2e04cd,_0x8a1be0[_0x7995('0x52')]);var _0x1afab4={'where':_0x2e04cd[_0x7995('0x4f')]};return db[_0x7995('0x41')][_0x7995('0x32')](_0x1afab4)[_0x7995('0x36')](function(_0x4d46bc){_0x14d638[_0x7995('0x32')]=_0x4d46bc;if(_0x8a1be0[_0x7995('0x45')][_0x7995('0x53')]){_0x2e04cd['include']=[{'all':!![]}];}return db[_0x7995('0x41')][_0x7995('0x54')](_0x2e04cd);})[_0x7995('0x36')](function(_0x47d1d8){_0x14d638['rows']=_0x47d1d8;return _0x14d638;})['then'](respondWithFilteredResult(_0x2ea47f,_0x2e04cd))[_0x7995('0x2b')](handleError(_0x2ea47f,null));};exports[_0x7995('0x55')]=function(_0x4cf5db,_0x1cd85){var _0x29f300={'raw':![],'where':{'id':_0x4cf5db[_0x7995('0x56')]['id']},'include':[{'model':db[_0x7995('0x3e')],'as':'mandatoryDispositionPause'}]},_0x31f27c={};_0x31f27c[_0x7995('0x4a')]=_['keys'](db[_0x7995('0x41')][_0x7995('0x42')]);_0x31f27c[_0x7995('0x45')]=_['keys'](_0x4cf5db['query']);_0x31f27c['filters']=_['intersection'](_0x31f27c[_0x7995('0x4a')],_0x31f27c[_0x7995('0x45')]);_0x29f300[_0x7995('0x49')]=_[_0x7995('0x47')](_0x31f27c[_0x7995('0x4a')],qs[_0x7995('0x48')](_0x4cf5db[_0x7995('0x45')][_0x7995('0x48')]));_0x29f300[_0x7995('0x49')]=_0x29f300[_0x7995('0x49')][_0x7995('0x57')]?_0x29f300[_0x7995('0x49')]:_0x31f27c[_0x7995('0x4a')];if(_0x4cf5db[_0x7995('0x45')][_0x7995('0x53')]){_0x29f300[_0x7995('0x58')]=[{'all':!![]}];}_0x29f300=_[_0x7995('0x50')]({},_0x29f300,_0x4cf5db[_0x7995('0x52')]);return db[_0x7995('0x41')]['find'](_0x29f300)[_0x7995('0x36')](handleEntityNotFound(_0x1cd85,null))[_0x7995('0x36')](respondWithResult(_0x1cd85,null))[_0x7995('0x2b')](handleError(_0x1cd85,null));};exports[_0x7995('0x59')]=function(_0x5d160d,_0x53125a){return db[_0x7995('0x41')][_0x7995('0x59')](_0x5d160d[_0x7995('0x5a')],{})[_0x7995('0x36')](function(_0x51c50b){var _0x13cd7b=_0x5d160d[_0x7995('0x5b')][_0x7995('0x38')]({'plain':!![]});if(!_0x13cd7b)throw new Error(_0x7995('0x5c'));if(_0x13cd7b['role']==='user'){var _0x40e5fc=_0x51c50b[_0x7995('0x38')]({'plain':!![]});var _0x6c0221=_0x7995('0x5d');return db[_0x7995('0x5e')][_0x7995('0x5f')]({'where':{'name':_0x6c0221,'userProfileId':_0x13cd7b[_0x7995('0x60')]},'raw':!![]})[_0x7995('0x36')](function(_0x984c23){if(_0x984c23&&_0x984c23['autoAssociation']===0x0){return db[_0x7995('0x39')][_0x7995('0x59')]({'name':_0x40e5fc[_0x7995('0x3b')],'resourceId':_0x40e5fc['id'],'type':_0x984c23[_0x7995('0x3b')],'sectionId':_0x984c23['id']},{})['then'](function(){return _0x51c50b;});}else{return _0x51c50b;}})['catch'](function(_0x3053fd){logger[_0x7995('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3053fd);throw _0x3053fd;});}return _0x51c50b;})[_0x7995('0x36')](respondWithResult(_0x53125a,0xc9))[_0x7995('0x2b')](handleError(_0x53125a,null));};exports[_0x7995('0x61')]=function(_0x57727e,_0x32cb04){if(_0x57727e['body']['id']){delete _0x57727e[_0x7995('0x5a')]['id'];}return db['ChatWebsite'][_0x7995('0x5f')]({'where':{'id':_0x57727e[_0x7995('0x56')]['id']},'include':[{'model':db[_0x7995('0x3e')],'as':_0x7995('0x3f')}]})[_0x7995('0x36')](handleEntityNotFound(_0x32cb04,null))[_0x7995('0x36')](saveUpdates(_0x57727e[_0x7995('0x5a')],null))[_0x7995('0x36')](respondWithResult(_0x32cb04,null))[_0x7995('0x2b')](handleError(_0x32cb04,null));};exports[_0x7995('0x37')]=function(_0x2618c4,_0x234d8d){return db['ChatWebsite'][_0x7995('0x5f')]({'where':{'id':_0x2618c4[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x234d8d,null))[_0x7995('0x36')](removeEntity(_0x234d8d,null))[_0x7995('0x2b')](handleError(_0x234d8d,null));};exports['describe']=function(_0x4b54f2,_0x268fde){return db[_0x7995('0x41')][_0x7995('0x62')]()[_0x7995('0x36')](respondWithResult(_0x268fde,null))['catch'](handleError(_0x268fde,null));};exports[_0x7995('0x63')]=function(_0x50a12e,_0x5df621,_0xca8238){if(_0x50a12e[_0x7995('0x5a')]['id']){delete _0x50a12e[_0x7995('0x5a')]['id'];}return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x50a12e[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x5df621,null))[_0x7995('0x36')](function(_0x3fde86){if(_0x3fde86){_0x50a12e[_0x7995('0x5a')]['ChatWebsiteId']=_0x3fde86['id'];return db[_0x7995('0x64')][_0x7995('0x59')](_0x50a12e[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x5df621,null))[_0x7995('0x2b')](handleError(_0x5df621,null));};exports[_0x7995('0x65')]=function(_0x705f0,_0x3a7d9d,_0x3b0d30){var _0x51ab1e={'raw':![],'where':{}};var _0x550a10={};var _0x3adfd2={'count':0x0,'rows':[]};return db[_0x7995('0x41')][_0x7995('0x66')]({'where':{'id':_0x705f0[_0x7995('0x56')]['id']}})['then'](handleEntityNotFound(_0x3a7d9d,null))['then'](function(_0xd07c1c){if(_0xd07c1c){_0x550a10[_0x7995('0x4a')]=_[_0x7995('0x67')](db[_0x7995('0x64')]['rawAttributes']);_0x550a10[_0x7995('0x45')]=_[_0x7995('0x67')](_0x705f0['query']);_0x550a10['filters']=_[_0x7995('0x47')](_0x550a10[_0x7995('0x4a')],_0x550a10['query']);_0x51ab1e[_0x7995('0x49')]=_['intersection'](_0x550a10[_0x7995('0x4a')],qs[_0x7995('0x48')](_0x705f0['query']['fields']));_0x51ab1e[_0x7995('0x49')]=_0x51ab1e['attributes'][_0x7995('0x57')]?_0x51ab1e[_0x7995('0x49')]:_0x550a10[_0x7995('0x4a')];if(!_0x705f0[_0x7995('0x45')][_0x7995('0x4b')](_0x7995('0x68'))){_0x51ab1e[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x705f0[_0x7995('0x45')][_0x7995('0x31')]);_0x51ab1e[_0x7995('0x4c')]=qs[_0x7995('0x4c')](_0x705f0[_0x7995('0x45')][_0x7995('0x4c')]);}_0x51ab1e[_0x7995('0x4d')]=qs[_0x7995('0x4e')](_0x705f0[_0x7995('0x45')][_0x7995('0x4e')]);_0x51ab1e[_0x7995('0x4f')]=qs[_0x7995('0x46')](_[_0x7995('0x69')](_0x705f0[_0x7995('0x45')],_0x550a10[_0x7995('0x46')]));_0x51ab1e[_0x7995('0x4f')][_0x7995('0x6a')]=_0xd07c1c['id'];if(_0x705f0[_0x7995('0x45')][_0x7995('0x6b')]){_0x51ab1e[_0x7995('0x4f')]=_['merge'](_0x51ab1e[_0x7995('0x4f')],{'$or':_[_0x7995('0x40')](_0x51ab1e['attributes'],function(_0x4c85cb){var _0x15e8d1={};_0x15e8d1[_0x4c85cb]={'$like':'%'+_0x705f0[_0x7995('0x45')][_0x7995('0x6b')]+'%'};return _0x15e8d1;})});}_0x51ab1e=_[_0x7995('0x50')]({},_0x51ab1e,_0x705f0[_0x7995('0x52')]);return db[_0x7995('0x64')]['count']({'where':_0x51ab1e[_0x7995('0x4f')]})[_0x7995('0x36')](function(_0x3fea6a){_0x3adfd2[_0x7995('0x32')]=_0x3fea6a;if(_0x705f0[_0x7995('0x45')][_0x7995('0x53')]){_0x51ab1e[_0x7995('0x58')]=[{'all':!![]}];}return db[_0x7995('0x64')]['findAll'](_0x51ab1e);})[_0x7995('0x36')](function(_0x2b8217){_0x3adfd2['rows']=_0x2b8217;return _0x3adfd2;});}})['then'](respondWithFilteredResult(_0x3a7d9d,_0x51ab1e))[_0x7995('0x2b')](handleError(_0x3a7d9d,null));};exports[_0x7995('0x6c')]=function(_0x18e1a2,_0x3db7a9,_0xe42797){return db['ChatWebsite'][_0x7995('0x5f')]({'where':{'id':_0x18e1a2[_0x7995('0x56')]['id']}})['then'](handleEntityNotFound(_0x3db7a9,null))[_0x7995('0x36')](function(_0x30b41f){if(_0x30b41f){return _0x30b41f['removeDispositions'](_0x18e1a2[_0x7995('0x45')]['ids']);}})[_0x7995('0x36')](respondWithStatusCode(_0x3db7a9,null))[_0x7995('0x2b')](handleError(_0x3db7a9,null));};exports[_0x7995('0x6d')]=function(_0x428a1b,_0x460fa6,_0x5d16da){if(_0x428a1b[_0x7995('0x5a')]['id']){delete _0x428a1b[_0x7995('0x5a')]['id'];}return db[_0x7995('0x41')]['find']({'where':{'id':_0x428a1b[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x460fa6,null))[_0x7995('0x36')](function(_0x308a26){if(_0x308a26){_0x428a1b['body'][_0x7995('0x6a')]=_0x308a26['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x428a1b['body']);}})['then'](respondWithResult(_0x460fa6,null))[_0x7995('0x2b')](handleError(_0x460fa6,null));};exports[_0x7995('0x6f')]=function(_0x4800a8,_0x590373,_0x2e3dfe){var _0x1e50b1={'raw':![],'where':{}};var _0xcdbd2a={};var _0x2384c1={'count':0x0,'rows':[]};return db[_0x7995('0x41')]['findOne']({'where':{'id':_0x4800a8['params']['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x590373,null))['then'](function(_0x588df7){if(_0x588df7){_0xcdbd2a[_0x7995('0x4a')]=_[_0x7995('0x67')](db[_0x7995('0x6e')]['rawAttributes']);_0xcdbd2a[_0x7995('0x45')]=_[_0x7995('0x67')](_0x4800a8[_0x7995('0x45')]);_0xcdbd2a[_0x7995('0x46')]=_[_0x7995('0x47')](_0xcdbd2a['model'],_0xcdbd2a[_0x7995('0x45')]);_0x1e50b1[_0x7995('0x49')]=_[_0x7995('0x47')](_0xcdbd2a[_0x7995('0x4a')],qs['fields'](_0x4800a8[_0x7995('0x45')][_0x7995('0x48')]));_0x1e50b1['attributes']=_0x1e50b1[_0x7995('0x49')][_0x7995('0x57')]?_0x1e50b1['attributes']:_0xcdbd2a[_0x7995('0x4a')];if(!_0x4800a8['query'][_0x7995('0x4b')]('nolimit')){_0x1e50b1[_0x7995('0x31')]=qs['limit'](_0x4800a8[_0x7995('0x45')][_0x7995('0x31')]);_0x1e50b1['offset']=qs[_0x7995('0x4c')](_0x4800a8['query']['offset']);}_0x1e50b1[_0x7995('0x4d')]=qs[_0x7995('0x4e')](_0x4800a8[_0x7995('0x45')][_0x7995('0x4e')]);_0x1e50b1['where']=qs[_0x7995('0x46')](_[_0x7995('0x69')](_0x4800a8['query'],_0xcdbd2a['filters']));_0x1e50b1[_0x7995('0x4f')]['ChatWebsiteId']=_0x588df7['id'];if(_0x4800a8[_0x7995('0x45')][_0x7995('0x6b')]){_0x1e50b1[_0x7995('0x4f')]=_['merge'](_0x1e50b1['where'],{'$or':_[_0x7995('0x40')](_0x1e50b1['attributes'],function(_0x12e9d9){var _0x44891e={};_0x44891e[_0x12e9d9]={'$like':'%'+_0x4800a8[_0x7995('0x45')][_0x7995('0x6b')]+'%'};return _0x44891e;})});}_0x1e50b1=_['merge']({},_0x1e50b1,_0x4800a8['options']);return db['CannedAnswer'][_0x7995('0x32')]({'where':_0x1e50b1[_0x7995('0x4f')]})[_0x7995('0x36')](function(_0x2df7d3){_0x2384c1[_0x7995('0x32')]=_0x2df7d3;if(_0x4800a8[_0x7995('0x45')]['includeAll']){_0x1e50b1['include']=[{'all':!![]}];}return db[_0x7995('0x6e')]['findAll'](_0x1e50b1);})['then'](function(_0x17d00f){_0x2384c1['rows']=_0x17d00f;return _0x2384c1;});}})['then'](respondWithFilteredResult(_0x590373,_0x1e50b1))[_0x7995('0x2b')](handleError(_0x590373,null));};exports[_0x7995('0x70')]=function(_0x3873f3,_0x5cef2e,_0x21b2db){return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x3873f3[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x5cef2e,null))[_0x7995('0x36')](function(_0x41e3aa){if(_0x41e3aa){return _0x41e3aa[_0x7995('0x70')](_0x3873f3[_0x7995('0x45')]['ids']);}})[_0x7995('0x36')](respondWithStatusCode(_0x5cef2e,null))[_0x7995('0x2b')](handleError(_0x5cef2e,null));};exports[_0x7995('0x71')]=function(_0x2056da,_0x2a01d4,_0x5a4695){_0x2056da[_0x7995('0x5a')][_0x7995('0x72')]=_0x2056da[_0x7995('0x73')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x2056da[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x2a01d4,null))[_0x7995('0x36')](saveUpdates(_0x2056da[_0x7995('0x5a')],null))[_0x7995('0x36')](respondWithResult(_0x2a01d4,null))[_0x7995('0x2b')](handleError(_0x2a01d4,null));};exports['addAvatar']=function(_0x46d263,_0x554cf8,_0x40a151){_0x46d263[_0x7995('0x5a')][_0x7995('0x74')]=_0x46d263[_0x7995('0x73')][_0x7995('0x75')];return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x46d263[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x554cf8,null))[_0x7995('0x36')](saveUpdates(_0x46d263[_0x7995('0x5a')],null))['then'](respondWithResult(_0x554cf8,null))[_0x7995('0x2b')](handleError(_0x554cf8,null));};exports['addCustomerAvatar']=function(_0x422d1f,_0x3d1298,_0x592ae3){_0x422d1f['body'][_0x7995('0x76')]=_0x422d1f[_0x7995('0x73')][_0x7995('0x75')];return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x422d1f[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x3d1298,null))[_0x7995('0x36')](saveUpdates(_0x422d1f[_0x7995('0x5a')],null))[_0x7995('0x36')](respondWithResult(_0x3d1298,null))[_0x7995('0x2b')](handleError(_0x3d1298,null));};exports[_0x7995('0x77')]=function(_0x5eb2d9,_0x5380e6,_0x41b0d5){_0x5eb2d9[_0x7995('0x5a')][_0x7995('0x78')]=_0x5eb2d9[_0x7995('0x73')][_0x7995('0x75')];return db['ChatWebsite'][_0x7995('0x5f')]({'where':{'id':_0x5eb2d9[_0x7995('0x56')]['id']}})['then'](handleEntityNotFound(_0x5380e6,null))[_0x7995('0x36')](saveUpdates(_0x5eb2d9['body'],null))[_0x7995('0x36')](respondWithResult(_0x5380e6,null))[_0x7995('0x2b')](handleError(_0x5380e6,null));};exports[_0x7995('0x79')]=function(_0x5860d4,_0x3501ac,_0x1cd9a0){var _0x29dcaf=path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0x7c'));var _0x3c03d6={'where':{'id':_0x5860d4['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5aee3b=![];return require(_0x7995('0x19'))[_0x7995('0x7d')]()['then'](function(_0x4eb988){if(_0x4eb988){_0x5aee3b=_0x4eb988[_0x7995('0x7e')];}})[_0x7995('0x36')](function(){return db['ChatWebsite']['find'](_0x3c03d6);})['then'](handleEntityNotFound(_0x3501ac,null))['then'](function(_0x1c4af5){if(_0x1c4af5){if(!_[_0x7995('0x7f')](_0x1c4af5[_0x7995('0x72')])){if(fs[_0x7995('0x80')](path['join'](config[_0x7995('0x7b')],_0x7995('0x81'),_0x1c4af5['sitepic']))&&_0x5aee3b){_0x29dcaf=path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0x81'),_0x1c4af5['sitepic']);}}return _0x3501ac[_0x7995('0x82')](_0x29dcaf);}})[_0x7995('0x2b')](handleError(_0x3501ac,null));};exports['getAvatar']=function(_0x3615ac,_0x3fc60f,_0x1fc75e){var _0x6b9ae0=path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0x83'));var _0x114f3c={'where':{'id':_0x3615ac[_0x7995('0x56')]['id']},'attributes':['id',_0x7995('0x74')],'raw':!![]};return db[_0x7995('0x41')][_0x7995('0x5f')](_0x114f3c)[_0x7995('0x36')](handleEntityNotFound(_0x3fc60f,null))['then'](function(_0x154eff){if(_0x154eff){if(!_[_0x7995('0x7f')](_0x154eff[_0x7995('0x74')])){if(fs[_0x7995('0x80')](path['join'](config[_0x7995('0x7b')],_0x7995('0x84'),_0x154eff[_0x7995('0x74')]))){_0x6b9ae0=path['join'](config[_0x7995('0x7b')],_0x7995('0x84'),_0x154eff[_0x7995('0x74')]);}}return _0x3fc60f[_0x7995('0x82')](_0x6b9ae0);}})[_0x7995('0x2b')](handleError(_0x3fc60f,null));};exports[_0x7995('0x85')]=function(_0x20f641,_0x4f9d58,_0x35dbd7){var _0x4efc7f=path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0x86'));var _0x4cae1c={'where':{'id':_0x20f641[_0x7995('0x56')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x4cae1c)[_0x7995('0x36')](handleEntityNotFound(_0x4f9d58,null))[_0x7995('0x36')](function(_0x5d2973){if(_0x5d2973){if(!_[_0x7995('0x7f')](_0x5d2973[_0x7995('0x76')])){if(fs['existsSync'](path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0x84'),_0x5d2973[_0x7995('0x76')]))&&_0x5d2973[_0x7995('0x87')]){_0x4efc7f=path['join'](config[_0x7995('0x7b')],_0x7995('0x84'),_0x5d2973[_0x7995('0x76')]);}}return _0x4f9d58[_0x7995('0x82')](_0x4efc7f);}})['catch'](handleError(_0x4f9d58,null));};exports[_0x7995('0x88')]=function(_0x217ed4,_0x2fde1f,_0x3ca281){var _0x370bd9=path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0x89'));var _0x1c3074={'where':{'id':_0x217ed4[_0x7995('0x56')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x7995('0x41')]['find'](_0x1c3074)[_0x7995('0x36')](handleEntityNotFound(_0x2fde1f,null))[_0x7995('0x36')](function(_0x2a9264){if(_0x2a9264){if(!_['isNil'](_0x2a9264['systemAvatar'])){if(fs[_0x7995('0x80')](path[_0x7995('0x7a')](config['root'],_0x7995('0x84'),_0x2a9264['systemAvatar']))){_0x370bd9=path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0x84'),_0x2a9264[_0x7995('0x78')]);}}return _0x2fde1f['download'](_0x370bd9);}})['catch'](handleError(_0x2fde1f,null));};exports[_0x7995('0x8a')]=function(_0x1dee3f,_0x365318,_0x27cb4c){var _0x5e7f82=require(_0x7995('0x8b'));var _0x382951=new _0x5e7f82();var _0x8b820b=_0x382951[_0x7995('0x8c')](_0x1dee3f[_0x7995('0x8d')]['user-agent'])['getResult']();var _0x47989f={'body':_0x1dee3f[_0x7995('0x5a')],'channel':_0x7995('0x8e')};var _0x5972d4=[];var _0x1889a1=[];var _0x5635d6={};var _0x29c0f4=![];return db[_0x7995('0x8f')][_0x7995('0x62')]()[_0x7995('0x36')](function(_0x4f145e){if(!_0x4f145e){throw new db[(_0x7995('0x90'))][(_0x7995('0x91'))](_0x7995('0x92'));}_0x5972d4=_[_0x7995('0x93')](_[_0x7995('0x67')](_0x4f145e),[_0x7995('0x94'),_0x7995('0x95')]);_0x1889a1=_[_0x7995('0x93')](_[_0x7995('0x67')](_0x4f145e),[_0x7995('0x94'),_0x7995('0x95'),_0x7995('0x96'),_0x7995('0x97')]);if(_0x1dee3f[_0x7995('0x5a')]['id']){delete _0x1dee3f['body']['id'];}if(_[_0x7995('0x7f')](_0x1dee3f['body'][_0x7995('0x98')])){throw new db[(_0x7995('0x90'))]['ValidationError'](_0x7995('0x99'));}if(_['isNil'](_0x1dee3f[_0x7995('0x5a')][_0x7995('0x5a')])||_0x1dee3f['body']['body']===''){throw new db['Sequelize'][(_0x7995('0x91'))](_0x7995('0x9a'));}if(_[_0x7995('0x7f')](_0x1dee3f[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x90'))][(_0x7995('0x91'))](_0x7995('0x9b')+_0x1889a1);}if(!_[_0x7995('0x9c')](_0x1889a1,_0x1dee3f[_0x7995('0x5a')][_0x7995('0x9d')])){throw new db[(_0x7995('0x90'))][(_0x7995('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1889a1);}_0x5635d6[_0x1dee3f[_0x7995('0x5a')][_0x7995('0x9d')]]=_0x1dee3f[_0x7995('0x5a')][_0x7995('0x98')];})['then'](function(){return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x1dee3f[_0x7995('0x56')]['id']},'include':[{'model':db[_0x7995('0x9e')],'as':_0x7995('0x9f'),'include':[{'model':db[_0x7995('0x8f')],'as':'Contacts','where':_0x5635d6,'limit':0x1,'order':[[_0x7995('0x95'),_0x7995('0xa0')]]}]},{'model':db[_0x7995('0xa1')],'as':_0x7995('0xa2')}]});})[_0x7995('0x36')](handleEntityNotFound(_0x365318,null))[_0x7995('0x36')](function(_0x2401b3){if(_0x2401b3&&_0x2401b3[_0x7995('0x9f')]){_0x47989f[_0x7995('0xa3')]=_0x2401b3;_0x47989f[_0x7995('0xa4')]=_0x2401b3[_0x7995('0xa2')];_0x47989f[_0x7995('0xa5')]=_0x2401b3[_0x7995('0x9f')];_0x47989f[_0x7995('0xa4')]=_[_0x7995('0xa6')](_0x47989f[_0x7995('0xa4')],[_0x7995('0xa7')],[_0x7995('0xa8')]);if(_0x47989f[_0x7995('0xa3')][_0x7995('0xa2')]){delete _0x47989f[_0x7995('0xa3')]['Applications'];}if(_0x47989f['account'][_0x7995('0x9f')]&&_0x47989f[_0x7995('0xa3')]['List'][_0x7995('0xa9')]['length']){return _0x47989f[_0x7995('0xa3')]['List'][_0x7995('0xa9')][0x0];}var _0x2615b3=_[_0x7995('0x1c')](_0x1dee3f[_0x7995('0x5a')],{'firstName':_0x1dee3f[_0x7995('0x5a')][_0x7995('0x98')],'ListId':_0x2401b3[_0x7995('0x97')]});_0x2615b3[_0x1dee3f[_0x7995('0x5a')][_0x7995('0x9d')]]=_0x1dee3f[_0x7995('0x5a')]['from'];return db[_0x7995('0x8f')][_0x7995('0x59')](_0x2615b3,{'fields':_0x5972d4,'raw':!![]});}})[_0x7995('0x36')](handleEntityNotFound(_0x365318,null))[_0x7995('0x36')](function(_0x54b803){_0x47989f[_0x7995('0xaa')]=_0x54b803;var _0x1d2afe=_0x1dee3f[_0x7995('0x5a')][_0x7995('0xab')];if(_0x1dee3f['headers'][_0x7995('0xac')]){_0x1d2afe=_0x1dee3f[_0x7995('0x8d')][_0x7995('0xac')];}else if(_0x1dee3f[_0x7995('0x8d')][_0x7995('0xad')]){_0x1d2afe=_[_0x7995('0xae')](_0x1dee3f[_0x7995('0x8d')][_0x7995('0xad')][_0x7995('0xaf')](','));}if(_0x54b803){var _0x50e526={'ContactId':_0x54b803['id'],'ChatWebsiteId':_0x1dee3f[_0x7995('0x56')]['id'],'from':(_0x54b803['firstName']||'')+'\x20'+(_0x54b803[_0x7995('0xb0')]||''),'customerIp':_0x1d2afe,'customerPort':_0x1dee3f[_0x7995('0x8d')][_0x7995('0xb1')]?_0x1dee3f[_0x7995('0x8d')]['x-real-port']:null,'referer':_0x1dee3f[_0x7995('0x5a')][_0x7995('0xb2')],'browserName':_0x8b820b[_0x7995('0xb3')][_0x7995('0x3b')]&&_0x8b820b[_0x7995('0xb3')][_0x7995('0xb4')]?util[_0x7995('0xb5')](_0x7995('0xb6'),_0x8b820b[_0x7995('0xb3')][_0x7995('0x3b')],_0x8b820b[_0x7995('0xb3')][_0x7995('0xb4')]):_0x7995('0xb7'),'browserVersion':_0x8b820b[_0x7995('0xb3')]['version']||'unknown','osName':util[_0x7995('0xb5')](_0x7995('0xb6'),_0x8b820b['os'][_0x7995('0x3b')],_0x8b820b['os']['version']),'osVersion':_0x8b820b['os'][_0x7995('0xb4')],'deviceModel':_0x8b820b[_0x7995('0xb8')][_0x7995('0x4a')]&&_0x8b820b['device'][_0x7995('0xb9')]?util[_0x7995('0xb5')](_0x7995('0xba'),_0x8b820b[_0x7995('0xb8')][_0x7995('0x4a')],_0x8b820b[_0x7995('0xb8')][_0x7995('0xb9')],_0x8b820b[_0x7995('0xb8')][_0x7995('0x43')]):null,'deviceVendor':_0x8b820b[_0x7995('0xb8')][_0x7995('0xb9')],'deviceType':_0x8b820b['device']['type'],'formData':JSON[_0x7995('0xbb')](_0x1dee3f['body'])};var _0x220c6e={'ChatWebsiteId':_0x1dee3f[_0x7995('0x56')]['id'],'closed':![]};if(_0x1dee3f[_0x7995('0x5a')][_0x7995('0xbc')]){_0x220c6e[_0x7995('0xbc')]=_0x1dee3f['body']['threadId'];return db[_0x7995('0xbd')][_0x7995('0x5f')]({'where':_0x220c6e})[_0x7995('0x36')](function(_0x1eacbf){if(_0x1eacbf){return[_0x1eacbf,![]];}_0x50e526[_0x7995('0xbc')]=_0x1dee3f[_0x7995('0x5a')][_0x7995('0xbc')];_0x50e526[_0x7995('0xbe')]=_0x1dee3f[_0x7995('0x5a')][_0x7995('0xbe')];return db['ChatInteraction'][_0x7995('0x59')](_0x50e526)[_0x7995('0x36')](function(_0x38e67a){return[_0x38e67a,!![]];});});}_0x220c6e[_0x7995('0xbf')]=_0x54b803['id'];if(_0x1dee3f['body']['interaction']&&_0x1dee3f['body']['interaction']['id']){_0x220c6e['id']=_0x1dee3f['body'][_0x7995('0xc0')]['id'];return db['ChatInteraction']['find']({'where':_0x220c6e})[_0x7995('0x36')](function(_0x44dbb8){if(_0x44dbb8){return[_0x44dbb8,![]];}return db[_0x7995('0xbd')]['create'](_0x50e526)[_0x7995('0x36')](function(_0x4f008a){return[_0x4f008a,!![]];});});}return db[_0x7995('0xbd')][_0x7995('0x59')](_0x50e526)[_0x7995('0x36')](function(_0x5c50b7){return[_0x5c50b7,!![]];});}})[_0x7995('0xc1')](function(_0x14be06,_0x1b5b5b){if(_0x14be06){_0x29c0f4=_0x1b5b5b;if(!_0x1b5b5b){var _0x4abb5f={'from':(_0x47989f[_0x7995('0xaa')][_0x7995('0xc2')]||'')+'\x20'+(_0x47989f[_0x7995('0xaa')][_0x7995('0xb0')]||'')};if(_0x1dee3f[_0x7995('0x5a')]['threadId']&&_0x1dee3f[_0x7995('0x5a')][_0x7995('0xc3')]&&_0x1dee3f[_0x7995('0x5a')]['threadId']!=_0x1dee3f[_0x7995('0x5a')][_0x7995('0xc3')]){_0x4abb5f[_0x7995('0xbc')]=_0x1dee3f[_0x7995('0x5a')][_0x7995('0xc3')];}return _0x14be06['update'](_0x4abb5f);}else{return _0x14be06;}}})[_0x7995('0x36')](function(_0x193f29){_0x47989f[_0x7995('0xc0')]=_0x193f29[_0x7995('0x38')]({'plain':!![]});_0x47989f[_0x7995('0xc0')][_0x7995('0xc4')]=_0x29c0f4;if(_0x47989f[_0x7995('0xc0')]['created']){if(_0x47989f['account'][_0x7995('0xc5')]){_0x47989f[_0x7995('0xa4')]['push']({'id':0x0,'priority':_0x47989f['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xc6'),'appdata':_0x7995('0xc7'),'interval':_0x7995('0xc8')});}}return db[_0x7995('0xc9')][_0x7995('0x59')]({'body':_0x1dee3f[_0x7995('0x5a')]['body'],'ChatWebsiteId':_0x1dee3f[_0x7995('0x56')]['id'],'ChatInteractionId':_0x193f29['id'],'direction':'in','ContactId':_0x47989f[_0x7995('0xaa')]['id'],'AttachmentId':_0x1dee3f[_0x7995('0x5a')][_0x7995('0xca')]});})[_0x7995('0x36')](function(_0x3b017b){_0x47989f['message']=_0x3b017b;if(_0x47989f[_0x7995('0xc0')][_0x7995('0xcb')]){return db[_0x7995('0xcc')][_0x7995('0x5f')]({'attributes':['id',_0x7995('0x3b')],'where':{'id':_0x47989f[_0x7995('0xc0')][_0x7995('0xcb')]}})['then'](function(_0x8c33c0){if(_0x8c33c0){_0x47989f[_0x7995('0xa4')][_0x7995('0xcd')]({'id':0x0,'priority':0x0,'app':_0x7995('0xce'),'appdata':_0x8c33c0['name']+','+(_0x47989f[_0x7995('0xa3')]['waitForTheAssignedAgent']||0xa),'interval':_0x7995('0xc8')});_0x47989f[_0x7995('0xcf')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x47989f);});}return respondWithRpcPromise('Start',_0x7995('0xd0'),_0x47989f);})[_0x7995('0x36')](function(_0x7d2ccf){respondWithRpcPromise(_0x7995('0xd1'),_0x7995('0xd1'),{'event':_0x7995('0x8a'),'message':_0x7d2ccf},client9002);return _0x7d2ccf;})[_0x7995('0x36')](respondWithResult(_0x365318,null))[_0x7995('0x2b')](handleError(_0x365318,null));};exports[_0x7995('0xd2')]=function(_0x36c4e9,_0x1fa484,_0x233f44){var _0x5dccc8,_0x5264dc,_0x2695eb;var _0x4c66ad=[];var _0x58a2e8=[];var _0x1a786e={};var _0x363250=_0x36c4e9[_0x7995('0xd3')]||[];var _0x45c69c=[];var _0x2b5475;return db[_0x7995('0x8f')][_0x7995('0x62')]()[_0x7995('0x36')](function(_0x38ef8b){if(!_0x38ef8b){throw new db[(_0x7995('0x90'))][(_0x7995('0x91'))](_0x7995('0x92'));}_0x58a2e8=_['difference'](_[_0x7995('0x67')](_0x38ef8b),[_0x7995('0x94'),_0x7995('0x95')]);_0x4c66ad=_[_0x7995('0x93')](_[_0x7995('0x67')](_0x38ef8b),[_0x7995('0x94'),_0x7995('0x95'),'CompanyId',_0x7995('0x97')]);if(_0x36c4e9[_0x7995('0x5a')]['id']){delete _0x36c4e9[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x7f')](_0x36c4e9[_0x7995('0x5a')]['from'])){throw _0x1fa484[_0x7995('0x2d')](0x1f4)['send'](new db[(_0x7995('0x90'))][(_0x7995('0x91'))](_0x7995('0x99')));}if(_['isNil'](_0x36c4e9[_0x7995('0x5a')][_0x7995('0x5a')])||_0x36c4e9[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw _0x1fa484[_0x7995('0x2d')](0x1f4)[_0x7995('0x3c')](new db[(_0x7995('0x90'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x7995('0x7f')](_0x36c4e9[_0x7995('0x5a')][_0x7995('0xd4')])){throw _0x1fa484[_0x7995('0x2d')](0x1f4)[_0x7995('0x3c')](new db[(_0x7995('0x90'))]['ValidationError'](_0x7995('0xd5')+_0x4c66ad));}if(!_[_0x7995('0x9c')](_0x4c66ad,_0x36c4e9[_0x7995('0x5a')][_0x7995('0xd4')])){throw _0x1fa484['status'](0x1f4)['send'](new db[(_0x7995('0x90'))][(_0x7995('0x91'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c66ad));}_0x1a786e[_0x36c4e9[_0x7995('0x5a')][_0x7995('0xd4')]]=_0x36c4e9['body'][_0x7995('0x98')];})[_0x7995('0x36')](function(){return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x36c4e9[_0x7995('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x7995('0xd6')],'as':_0x7995('0xd6')}]});})[_0x7995('0x36')](handleEntityNotFound(_0x1fa484,null))[_0x7995('0x36')](function(_0x37fd9b){if(_0x37fd9b&&_0x37fd9b['List']){_0x5264dc=_0x37fd9b;var _0xd0da6e=_[_0x7995('0x1c')](_0x36c4e9[_0x7995('0x5a')],{'firstName':_0x36c4e9[_0x7995('0x5a')][_0x7995('0x98')],'phone':_0x36c4e9['body']['from'],'ListId':_0x37fd9b['ListId']});_0xd0da6e[_0x36c4e9['body'][_0x7995('0xd4')]]=_0x36c4e9[_0x7995('0x5a')]['from'];return db[_0x7995('0x8f')][_0x7995('0xd7')]({'where':_0x1a786e,'defaults':_0xd0da6e});}})['spread'](function(_0x53dc2d){if(_0x53dc2d){_0x2695eb=_0x53dc2d;var _0x1f4b2f=fs[_0x7995('0xd8')](path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0xd9')),_0x7995('0xda'));var _0x2aa426=ejs['render'](_0x1f4b2f,{'body':_['toPairs'](_0x36c4e9[_0x7995('0x5a')][_0x7995('0x5a')]),'bodyTitle':_0x5264dc[_0x7995('0xdb')]});return db['ChatOfflineMessage'][_0x7995('0x59')]({'body':_0x2aa426,'ContactId':_0x53dc2d['id'],'ChatWebsiteId':_0x5264dc['id']});}})[_0x7995('0x36')](function(_0x24eaf9){_0x2b5475=_0x24eaf9;if(_0x363250[_0x7995('0x57')]){var _0xed2a38=_0x363250[_0x7995('0x40')](function(_0x28ac7c){return{'name':_0x28ac7c[_0x7995('0xdc')],'basename':_0x28ac7c[_0x7995('0x75')],'type':_0x28ac7c['mimetype'],'ChatOfflineMessageId':_0x24eaf9['id']};});_0x45c69c=_0xed2a38['map'](_0x1161f2=>{var _0x4bd222={'filename':_0x1161f2[_0x7995('0x3b')],'path':path['join'](config[_0x7995('0x7b')],_0x7995('0xdd'),_0x7995('0xd3'),'attachments','offline-chat',_0x1161f2[_0x7995('0xde')])};return _0x4bd222;});if(!_0x5264dc[_0x7995('0xdf')]){return db[_0x7995('0xe0')][_0x7995('0xe1')](function(_0xc6d48c){return db[_0x7995('0xe2')][_0x7995('0xe3')](_0xed2a38,{'transaction':_0xc6d48c});});}}})[_0x7995('0x36')](function(){if(_0x2b5475){_0x5dccc8=_0x2b5475;return db[_0x7995('0xd6')][_0x7995('0x66')]({'where':{'active':!![]},'include':[{'model':db[_0x7995('0xe4')],'as':'Smtp','raw':!![]}]});}})[_0x7995('0x36')](function(_0xe43c99){if(_0xe43c99&&_0xe43c99[_0x7995('0xe5')]&&_0x5264dc[_0x7995('0xe6')]&&_0x5264dc[_0x7995('0xe7')]){var _0x478a3c={'tls':{'rejectUnauthorized':![]}};if(_0xe43c99[_0x7995('0xe5')][_0x7995('0xe8')]){_0x478a3c[_0x7995('0xe8')]=_0xe43c99[_0x7995('0xe5')][_0x7995('0xe8')];}else{_0x478a3c[_0x7995('0xe9')]=_0xe43c99[_0x7995('0xe5')][_0x7995('0xe9')];_0x478a3c[_0x7995('0xea')]=_0xe43c99['Smtp']['port'];_0x478a3c[_0x7995('0xeb')]=_0xe43c99[_0x7995('0xe5')][_0x7995('0xeb')];}if(_0xe43c99[_0x7995('0xe5')][_0x7995('0xec')]){_0x478a3c['auth']={'user':_0xe43c99[_0x7995('0xe5')][_0x7995('0x5b')],'pass':_0xe43c99[_0x7995('0xe5')][_0x7995('0xed')]};}return respondWithRpcPromise(_0x7995('0xee'),_0x7995('0xef'),{'account':_0x478a3c,'message':{'from':util[_0x7995('0xb5')](_0x7995('0xf0'),_0xe43c99[_0x7995('0x3b')],_0xe43c99['email']||_0xe43c99['Smtp'][_0x7995('0x5b')]),'to':_0x5264dc[_0x7995('0xe7')],'subject':_0x5264dc[_0x7995('0xf1')],'html':_0x5dccc8[_0x7995('0x5a')],'attachments':_0x45c69c}},client9003)[_0x7995('0x36')](function(){return _0x5dccc8;})[_0x7995('0x2b')](function(_0x3b4eb5){console[_0x7995('0x25')](_0x3b4eb5);});}})['then'](function(){if(_0x5264dc&&_0x5264dc['openNewInteraction']&&_0x5264dc[_0x7995('0xf2')]){var _0x386081=[];if(_0x363250[_0x7995('0x57')]){_0x386081=_0x363250[_0x7995('0x40')](function(_0x53289d){return{'name':_0x53289d['originalname'],'basename':_0x53289d[_0x7995('0x75')],'type':_0x53289d[_0x7995('0xf3')],'ChatOfflineMessageId':_0x2b5475['id']};});}var _0x2c8cd6;if(!_[_0x7995('0x7f')](_0x5264dc[_0x7995('0xf4')])){var _0x166566=_[_0x7995('0x40')](_0x36c4e9[_0x7995('0x5a')],function(_0x273283){return _0x273283;});var _0x2c3179=_[_0x7995('0xf5')](_0x166566)[0x0];var _0x3c62ad=_['mapValues'](_0x2c3179,function(_0x49c348){return _0x49c348;});_0x2c8cd6=_0x3c62ad[0x1][_0x5264dc[_0x7995('0xf4')]];}var _0x3df500={'from':_0x2695eb[_0x7995('0xf6')],'firstName':_0x2695eb[_0x7995('0xc2')],'lastName':_0x2695eb['lastName'],'mapKey':_0x7995('0xf6'),'message':{'from':_0x2695eb['email'],'to':_0x5264dc[_0x7995('0xd6')][_0x7995('0xf6')],'cc':'','subject':_[_0x7995('0x7f')](_0x2c8cd6)?_0x5264dc[_0x7995('0xf1')]:_0x2c8cd6,'messageId':'','sentAt':new Date(),'attach':_0x386081[_0x7995('0x57')],'attachments':_0x386081,'originChannel':_0x7995('0xf7'),'ChatWebsiteId':_0x5264dc['id'],'ChatOfflineMessageId':_0x5dccc8['id'],'originTo':_0x5264dc['MailAccount'][_0x7995('0xf6')]},'body':_0x5dccc8[_0x7995('0x5a')]};var _0x2d82cf={'account':{'id':_0x5264dc[_0x7995('0xf2')]},'body':_0x3df500,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x7995('0xf8'),_0x2d82cf,client9001)[_0x7995('0x36')](function(){return _0x5dccc8;})[_0x7995('0x2b')](function(_0x1cda2e){console['error'](_0x1cda2e);});}return;})[_0x7995('0x36')](function(){if(_0x5dccc8){return _0x5dccc8;}})[_0x7995('0x36')](respondWithResult(_0x1fa484,null))[_0x7995('0x2b')](function(_0x56eed1){console[_0x7995('0x25')](_0x7995('0x2b'),_0x56eed1);for(var _0xc7375c of _0x363250){var _0x527279=path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0xdd'),_0x7995('0xd3'),_0x7995('0xf9'),_0x7995('0xfa'),_0xc7375c[_0x7995('0x75')]);fs_extra[_0x7995('0xfb')](_0x527279)[_0x7995('0x2b')](function(_0x57fdc0){console[_0x7995('0x25')](_0x7995('0xfc'),_0x527279,_0x57fdc0);});}});};exports[_0x7995('0xfd')]=function(_0x100c5b,_0x5eb18f,_0x3136b9){return db[_0x7995('0xbd')][_0x7995('0x5f')]({'where':{'id':_0x100c5b[_0x7995('0x56')]['id']}})['then'](handleEntityNotFound(_0x5eb18f,null))[_0x7995('0x36')](function(_0x39b8d8){if(_0x39b8d8){return _0x39b8d8[_0x7995('0xfd')](_0x100c5b[_0x7995('0x5a')][_0x7995('0xfe')],_[_0x7995('0xff')](_0x100c5b[_0x7995('0x5a')],['ids','id'])||{});}})[_0x7995('0x36')](respondWithResult(_0x5eb18f,null))[_0x7995('0x2b')](handleError(_0x5eb18f,null));};exports[_0x7995('0x100')]=function(_0x1996e2,_0x2fe071,_0x4b14a6){var _0x1f915b={'raw':![],'where':{}};var _0x4f1941={};var _0xb33681={'count':0x0,'rows':[]};return db[_0x7995('0x41')][_0x7995('0x66')]({'where':{'id':_0x1996e2['params']['id']}})['then'](handleEntityNotFound(_0x2fe071,null))['then'](function(_0x21ff84){if(_0x21ff84){_0x4f1941[_0x7995('0x4a')]=_[_0x7995('0x67')](db[_0x7995('0xbd')][_0x7995('0x42')]);_0x4f1941[_0x7995('0x45')]=_['keys'](_0x1996e2[_0x7995('0x45')]);_0x4f1941[_0x7995('0x46')]=_[_0x7995('0x47')](_0x4f1941[_0x7995('0x4a')],_0x4f1941['query']);_0x1f915b[_0x7995('0x49')]=_[_0x7995('0x47')](_0x4f1941['model'],qs[_0x7995('0x48')](_0x1996e2['query'][_0x7995('0x48')]));_0x1f915b[_0x7995('0x49')]=_0x1f915b[_0x7995('0x49')]['length']?_0x1f915b['attributes']:_0x4f1941[_0x7995('0x4a')];if(!_0x1996e2[_0x7995('0x45')][_0x7995('0x4b')](_0x7995('0x68'))){_0x1f915b[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x1996e2[_0x7995('0x45')][_0x7995('0x31')]);_0x1f915b[_0x7995('0x4c')]=qs[_0x7995('0x4c')](_0x1996e2[_0x7995('0x45')]['offset']);}_0x1f915b['order']=qs[_0x7995('0x4e')](_0x1996e2[_0x7995('0x45')][_0x7995('0x4e')]);_0x1f915b[_0x7995('0x4f')]=qs['filters'](_['pick'](_0x1996e2[_0x7995('0x45')],_0x4f1941[_0x7995('0x46')]));_0x1f915b['where']['ChatWebsiteId']=_0x21ff84['id'];if(_0x1996e2[_0x7995('0x45')][_0x7995('0x6b')]){_0x1f915b[_0x7995('0x4f')]=_[_0x7995('0x50')](_0x1f915b[_0x7995('0x4f')],{'$or':_['map'](_0x1f915b[_0x7995('0x49')],function(_0x2c3554){var _0x4d085c={};_0x4d085c[_0x2c3554]={'$like':'%'+_0x1996e2[_0x7995('0x45')][_0x7995('0x6b')]+'%'};return _0x4d085c;})});}_0x1f915b=_[_0x7995('0x50')]({},_0x1f915b,_0x1996e2['options']);return db[_0x7995('0xbd')][_0x7995('0x32')]({'where':_0x1f915b[_0x7995('0x4f')]})[_0x7995('0x36')](function(_0x113e03){_0xb33681['count']=_0x113e03;if(_0x1996e2['query'][_0x7995('0x53')]){_0x1f915b['include']=[{'model':db[_0x7995('0x8f')],'as':'Contact','required':![]},{'model':db[_0x7995('0xcc')],'as':_0x7995('0x101'),'attributes':[_0x7995('0x3b'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x7995('0x102'),'attributes':['id',_0x7995('0x3b'),_0x7995('0x103')],'where':_0x1996e2['query'][_0x7995('0x104')]?{'id':_0x1996e2[_0x7995('0x45')]['tag']}:undefined,'required':_0x1996e2[_0x7995('0x45')][_0x7995('0x104')]?!![]:![]}];}return db[_0x7995('0xbd')][_0x7995('0x54')](_0x1f915b);})[_0x7995('0x36')](function(_0x4b3aa3){_0xb33681['rows']=_0x4b3aa3;return _0xb33681;});}})[_0x7995('0x36')](respondWithFilteredResult(_0x2fe071,_0x1f915b))[_0x7995('0x2b')](handleError(_0x2fe071,null));};function iftimePromise(_0x134da2,_0xc0f1fa){return respondWithRpcPromise(_0x7995('0x105'),_0x7995('0x106'),{'command':_0xc0f1fa[_0x7995('0x107')]?util[_0x7995('0xb5')](_0x7995('0x108'),_0x134da2[_0x7995('0x109')],_0xc0f1fa['timezone']):util[_0x7995('0xb5')](_0x7995('0x10a'),_0x134da2[_0x7995('0x109')])},client9002)[_0x7995('0x36')](function(_0x39ee00){var _0x45f9d8=_0x39ee00&&_0x39ee00[_0x7995('0x10b')]('true')>=0x0?!![]:![];logger['info'](_0x7995('0x10c'),_0xc0f1fa['id'],_0x134da2['id'],_0x134da2[_0x7995('0x109')],_0x45f9d8?_0x7995('0x10d'):_0x7995('0x10e'),_0xc0f1fa['timezone']?_0xc0f1fa['timezone']:'No\x20timezone');return _0x45f9d8;})[_0x7995('0x2b')](function(_0x272d06){logger['error'](_0x7995('0x10c'),_0xc0f1fa['id'],_0x134da2['id'],_0x134da2[_0x7995('0x109')],util[_0x7995('0x10f')](_0x272d06,{'showHidden':![],'depth':null}),_0xc0f1fa[_0x7995('0x107')]?_0xc0f1fa[_0x7995('0x107')]:_0x7995('0x110'));return![];});}exports[_0x7995('0x106')]=function(_0x22d392,_0x57438e,_0x463c25){var _0x13d525=0x0;var _0x37b7e7=0x0;var _0x4a839b=![];var _0x4cd032;var _0x529fd6;return db['ChatWebsite']['find']({'where':{'id':_0x22d392['params']['id']},'include':[{'model':db[_0x7995('0x111')],'as':'Interval','include':[{'model':db[_0x7995('0x111')],'as':_0x7995('0x112'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x7995('0x36')](handleEntityNotFound(_0x57438e,null))[_0x7995('0x36')](function(_0x3b382b){if(_0x3b382b){_0x4cd032=_0x3b382b;return _0x3b382b[_0x7995('0x113')]({'raw':!![]});}})['then'](function(_0x1c78f3){if(_0x4cd032){if(_0x1c78f3){_0x529fd6=_0x1c78f3;}}return require('../../config/license/util')[_0x7995('0x7d')]();})[_0x7995('0x36')](function(_0x10670c){if(_0x10670c){_0x37b7e7=_0x10670c[_0x7995('0x114')];_0x4a839b=_0x10670c[_0x7995('0x7e')];}})[_0x7995('0x36')](function(){return db[_0x7995('0xbd')][_0x7995('0x32')]({'where':{'closed':![]}});})[_0x7995('0x36')](function(_0x281839){_0x13d525=_0x281839;if(_0x37b7e7&&_0x281839>_0x37b7e7){return db['License'][_0x7995('0x66')]({'where':{'id':0x1}})[_0x7995('0x36')](function(_0x57234d){if(_0x57234d){_0x57234d[_0x7995('0x115')](_0x7995('0x116'));}});}})[_0x7995('0x36')](function(){if(_0x4cd032[_0x7995('0x111')]&&_0x4cd032[_0x7995('0x111')][_0x7995('0x112')]){var _0x5dc3ed=[];for(var _0x462896=0x0;_0x462896<_0x4cd032['Interval'][_0x7995('0x112')][_0x7995('0x57')];_0x462896++){var _0x1e18dd=_0x4cd032[_0x7995('0x111')][_0x7995('0x112')][_0x462896][_0x7995('0x38')]({'plain':!![]});_0x5dc3ed['push'](iftimePromise(_0x1e18dd,_0x4cd032));}return BPromise[_0x7995('0x117')](_0x5dc3ed)[_0x7995('0x36')](function(_0x7c46c1){return _['some'](_0x7c46c1);});}else{return!![];}})[_0x7995('0x36')](function(_0x170c33){var _0x39056c=fs[_0x7995('0xd8')](path[_0x7995('0x7a')](config[_0x7995('0x7b')],_0x7995('0x118')),_0x7995('0xda'));var _0x2c10fd={'remote':_0x4cd032[_0x7995('0x119')],'query':querystring[_0x7995('0xbb')](_['merge'](_0x4cd032[_0x7995('0x38')]({'plain':!![]}),{'customerIp':_0x22d392[_0x7995('0x8d')]['x-forwarded-for']||_0x22d392[_0x7995('0x8d')][_0x7995('0x11a')]||_0x22d392[_0x7995('0x11b')][_0x7995('0x11c')]||_0x22d392['ip'],'referer':_0x22d392[_0x7995('0x8d')]['referer'],'openedInteractions':_0x13d525,'maxInteractions':_0x37b7e7,'virtual':_0x4a839b[_0x7995('0x114')],'online':_0x170c33,'custom':_0x4a839b}))[_0x7995('0x11d')](/'/g,'\x5c\x27')};_0x57438e[_0x7995('0x3c')](ejs[_0x7995('0x11e')](Mustache[_0x7995('0x11e')](_0x39056c,_0x2c10fd),{'proactiveActions':_0x529fd6,'alignment':_0x4cd032[_0x7995('0x11f')],'verticalAlignment':_0x4cd032[_0x7995('0x120')],'div_color':_0x4cd032[_0x7995('0x103')],'text_color':_0x4cd032[_0x7995('0x121')],'button_color':_0x4cd032[_0x7995('0x122')],'background_color':_0x4cd032[_0x7995('0x123')]}));})[_0x7995('0x2b')](handleError(_0x57438e,null));};exports[_0x7995('0x124')]=function(_0x5476bd,_0x247b71,_0x1ecb6f){return db[_0x7995('0x41')][_0x7995('0x66')]({'where':{'id':_0x5476bd['params']['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x247b71,null))[_0x7995('0x36')](function(_0x3fffda){if(_0x3fffda){return db[_0x7995('0xe0')][_0x7995('0xe1')](function(_0x3fb61b){return db[_0x7995('0xa1')]['destroy']({'where':{'ChatWebsiteId':_0x5476bd[_0x7995('0x56')]['id']},'transaction':_0x3fb61b})['then'](function(_0x400bc7){var _0x65d2a8=_[_0x7995('0x40')](_0x5476bd['body'],function(_0x4d13c0){_0x4d13c0[_0x7995('0x6a')]=_0x5476bd[_0x7995('0x56')]['id'];return _0x4d13c0;});return db[_0x7995('0xa1')]['bulkCreate'](_0x65d2a8,{'transaction':_0x3fb61b});});})[_0x7995('0x36')](function(){return db['ChatApplication'][_0x7995('0x125')]({'where':{'ChatWebsiteId':_0x5476bd[_0x7995('0x56')]['id']},'order':_0x7995('0xa7')});});}})[_0x7995('0x36')](respondWithResult(_0x247b71,null))[_0x7995('0x2b')](handleError(_0x247b71,null));};exports[_0x7995('0x126')]=function(_0x57290e,_0x3f9ca2,_0x1d3267){var _0x51b607={};var _0xec5a3a={};var _0x34bed6;var _0x46fbd5;return db[_0x7995('0x41')][_0x7995('0x66')]({'where':{'id':_0x57290e[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x3f9ca2,null))[_0x7995('0x36')](function(_0x2027bd){if(_0x2027bd){_0x34bed6=_0x2027bd;_0xec5a3a[_0x7995('0x4a')]=_[_0x7995('0x67')](db[_0x7995('0xa1')][_0x7995('0x42')]);_0xec5a3a[_0x7995('0x45')]=_[_0x7995('0x67')](_0x57290e[_0x7995('0x45')]);_0xec5a3a[_0x7995('0x46')]=_['intersection'](_0xec5a3a['model'],_0xec5a3a[_0x7995('0x45')]);_0x51b607[_0x7995('0x49')]=_['intersection'](_0xec5a3a[_0x7995('0x4a')],qs[_0x7995('0x48')](_0x57290e['query']['fields']));_0x51b607[_0x7995('0x49')]=_0x51b607[_0x7995('0x49')][_0x7995('0x57')]?_0x51b607[_0x7995('0x49')]:_0xec5a3a[_0x7995('0x4a')];_0x51b607[_0x7995('0x4d')]=qs[_0x7995('0x4e')](_0x57290e[_0x7995('0x45')][_0x7995('0x4e')]);_0x51b607[_0x7995('0x4f')]=qs['filters'](_[_0x7995('0x69')](_0x57290e[_0x7995('0x45')],_0xec5a3a[_0x7995('0x46')]));if(_0x57290e[_0x7995('0x45')][_0x7995('0x6b')]){_0x51b607[_0x7995('0x4f')]=_[_0x7995('0x50')](_0x51b607['where'],{'$or':_[_0x7995('0x40')](_0x51b607[_0x7995('0x49')],function(_0x4425e4){var _0x4eb539={};_0x4eb539[_0x4425e4]={'$like':'%'+_0x57290e[_0x7995('0x45')][_0x7995('0x6b')]+'%'};return _0x4eb539;})});}_0x51b607=_[_0x7995('0x50')]({},_0x51b607,_0x57290e[_0x7995('0x52')]);return _0x34bed6[_0x7995('0x126')](_0x51b607);}})[_0x7995('0x36')](function(_0x5dc448){if(_0x5dc448){_0x46fbd5=_0x5dc448[_0x7995('0x57')];if(!_0x57290e['query'][_0x7995('0x4b')](_0x7995('0x68'))){_0x51b607[_0x7995('0x31')]=qs['limit'](_0x57290e['query'][_0x7995('0x31')]);_0x51b607[_0x7995('0x4c')]=qs[_0x7995('0x4c')](_0x57290e['query'][_0x7995('0x4c')]);}return _0x34bed6[_0x7995('0x126')](_0x51b607);}})[_0x7995('0x36')](function(_0x324668){if(_0x324668){return _0x324668?{'count':_0x46fbd5,'rows':_0x324668}:null;}})[_0x7995('0x36')](respondWithResult(_0x3f9ca2,null))['catch'](handleError(_0x3f9ca2,null));};exports[_0x7995('0x127')]=function(_0x23fd5c,_0x2a7e05,_0x24d374){return db[_0x7995('0x128')][_0x7995('0x5f')]({'where':{'id':_0x23fd5c[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x2a7e05,null))['then'](function(_0x48dbc2){if(_0x48dbc2){return _0x48dbc2[_0x7995('0x127')](_0x23fd5c['body'][_0x7995('0xfe')],_[_0x7995('0xff')](_0x23fd5c[_0x7995('0x5a')],['ids','id'])||{});}})['then'](respondWithResult(_0x2a7e05,null))['catch'](handleError(_0x2a7e05,null));};exports[_0x7995('0x113')]=function(_0x3caff2,_0x4077a7,_0x298b49){var _0x40f279={};var _0x1f9b93={};var _0x24e89f;var _0x3d6d4f;return db['ChatWebsite']['findOne']({'where':{'id':_0x3caff2['params']['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x4077a7,null))['then'](function(_0x5dd5b4){if(_0x5dd5b4){_0x24e89f=_0x5dd5b4;_0x1f9b93['model']=_[_0x7995('0x67')](db[_0x7995('0x129')][_0x7995('0x42')]);_0x1f9b93[_0x7995('0x45')]=_[_0x7995('0x67')](_0x3caff2['query']);_0x1f9b93[_0x7995('0x46')]=_['intersection'](_0x1f9b93[_0x7995('0x4a')],_0x1f9b93[_0x7995('0x45')]);_0x40f279[_0x7995('0x49')]=_[_0x7995('0x47')](_0x1f9b93[_0x7995('0x4a')],qs[_0x7995('0x48')](_0x3caff2[_0x7995('0x45')][_0x7995('0x48')]));_0x40f279['attributes']=_0x40f279[_0x7995('0x49')][_0x7995('0x57')]?_0x40f279['attributes']:_0x1f9b93[_0x7995('0x4a')];_0x40f279[_0x7995('0x4d')]=qs[_0x7995('0x4e')](_0x3caff2[_0x7995('0x45')][_0x7995('0x4e')]);_0x40f279[_0x7995('0x4f')]=qs[_0x7995('0x46')](_[_0x7995('0x69')](_0x3caff2[_0x7995('0x45')],_0x1f9b93['filters']));if(_0x3caff2['query']['filter']){_0x40f279[_0x7995('0x4f')]=_[_0x7995('0x50')](_0x40f279['where'],{'$or':_['map'](_0x40f279['attributes'],function(_0x2c0ef7){var _0x3e0827={};_0x3e0827[_0x2c0ef7]={'$like':'%'+_0x3caff2['query'][_0x7995('0x6b')]+'%'};return _0x3e0827;})});}_0x40f279=_[_0x7995('0x50')]({},_0x40f279,_0x3caff2[_0x7995('0x52')]);return _0x24e89f[_0x7995('0x113')](_0x40f279);}})['then'](function(_0x3ef225){if(_0x3ef225){_0x3d6d4f=_0x3ef225['length'];if(!_0x3caff2[_0x7995('0x45')]['hasOwnProperty'](_0x7995('0x68'))){_0x40f279[_0x7995('0x31')]=qs['limit'](_0x3caff2[_0x7995('0x45')]['limit']);_0x40f279[_0x7995('0x4c')]=qs[_0x7995('0x4c')](_0x3caff2[_0x7995('0x45')][_0x7995('0x4c')]);}return _0x24e89f[_0x7995('0x113')](_0x40f279);}})[_0x7995('0x36')](function(_0x4a27e7){if(_0x4a27e7){return _0x4a27e7?{'count':_0x3d6d4f,'rows':_0x4a27e7}:null;}})['then'](respondWithResult(_0x4077a7,null))['catch'](handleError(_0x4077a7,null));};exports['getFields']=function(_0x1414b2,_0x56dc92,_0x2af1ca){var _0x3bd4e0=_0x1414b2['query'][_0x7995('0x12a')]==='false'?_0x7995('0x12b'):'onlineForm';return db[_0x7995('0x41')][_0x7995('0x5f')]({'attributes':['id',_0x3bd4e0],'where':{'id':_0x1414b2[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x56dc92,null))[_0x7995('0x36')](function(_0x1d5a34){if(_0x1d5a34){var _0x2a2678=_0x1d5a34[_0x3bd4e0];var _0x1771cf=_0x2a2678&&_0x2a2678[_0x7995('0x12c')]?_0x2a2678[_0x7995('0x12c')]:[];_0x56dc92[_0x7995('0x3c')]({'fromKey':_[_0x7995('0x7f')](_0x2a2678[_0x7995('0x12d')])?undefined:_0x2a2678[_0x7995('0x12d')],'count':_0x1771cf[_0x7995('0x57')],'rows':_0x1771cf});}})[_0x7995('0x2b')](handleError(_0x56dc92,null));};exports[_0x7995('0x12e')]=function(_0x596beb,_0x31e5f1,_0x3603f5){var _0x19be70={'raw':![],'where':{}};var _0x4e18e1={};var _0x12afe8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7995('0x66')]({'where':{'id':_0x596beb[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x31e5f1,null))[_0x7995('0x36')](function(_0x47ba20){if(_0x47ba20){_0x4e18e1[_0x7995('0x4a')]=_[_0x7995('0x67')](db['ChatOfflineMessage']['rawAttributes']);_0x4e18e1['query']=_[_0x7995('0x67')](_0x596beb[_0x7995('0x45')]);_0x4e18e1['filters']=_[_0x7995('0x47')](_0x4e18e1['model'],_0x4e18e1[_0x7995('0x45')]);_0x19be70['attributes']=_[_0x7995('0x47')](_0x4e18e1[_0x7995('0x4a')],qs['fields'](_0x596beb['query'][_0x7995('0x48')]));_0x19be70[_0x7995('0x49')]=_0x19be70[_0x7995('0x49')]['length']?_0x19be70[_0x7995('0x49')]:_0x4e18e1[_0x7995('0x4a')];if(!_0x596beb[_0x7995('0x45')][_0x7995('0x4b')](_0x7995('0x68'))){_0x19be70[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x596beb[_0x7995('0x45')][_0x7995('0x31')]);_0x19be70['offset']=qs[_0x7995('0x4c')](_0x596beb[_0x7995('0x45')][_0x7995('0x4c')]);}_0x19be70['order']=qs[_0x7995('0x4e')](_0x596beb[_0x7995('0x45')]['sort']);_0x19be70['where']=qs[_0x7995('0x46')](_[_0x7995('0x69')](_0x596beb['query'],_0x4e18e1[_0x7995('0x46')]));_0x19be70[_0x7995('0x4f')]['ChatWebsiteId']=_0x47ba20['id'];if(_0x596beb[_0x7995('0x45')][_0x7995('0x6b')]){_0x19be70['where']=_[_0x7995('0x50')](_0x19be70[_0x7995('0x4f')],{'$or':_[_0x7995('0x40')](_0x19be70[_0x7995('0x49')],function(_0x714328){var _0x2aa083={};_0x2aa083[_0x714328]={'$like':'%'+_0x596beb[_0x7995('0x45')][_0x7995('0x6b')]+'%'};return _0x2aa083;})});}_0x19be70=_[_0x7995('0x50')]({},_0x19be70,_0x596beb[_0x7995('0x52')]);return db[_0x7995('0x12f')]['count']({'where':_0x19be70[_0x7995('0x4f')]})[_0x7995('0x36')](function(_0x80caf9){_0x12afe8[_0x7995('0x32')]=_0x80caf9;if(_0x596beb[_0x7995('0x45')][_0x7995('0x53')]){_0x19be70[_0x7995('0x58')]=[{'all':!![]}];}else{_0x19be70[_0x7995('0x58')]=[{'model':db[_0x7995('0x8f')],'as':_0x7995('0x130'),'required':![]},{'model':db[_0x7995('0xe2')],'as':'Attachments','required':![]}];}return db[_0x7995('0x12f')]['findAll'](_0x19be70);})['then'](function(_0x1b8a2b){_0x12afe8[_0x7995('0x131')]=_0x1b8a2b;return _0x12afe8;});}})[_0x7995('0x36')](respondWithFilteredResult(_0x31e5f1,_0x19be70))['catch'](handleError(_0x31e5f1,null));};exports[_0x7995('0x132')]=function(_0x5348e2,_0x141f71,_0x201bd0){return db[_0x7995('0x41')]['find']({'where':{'id':_0x5348e2[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x141f71,null))['then'](function(_0x50c07e){if(_0x50c07e){return _0x50c07e[_0x7995('0x132')](_0x5348e2[_0x7995('0x5a')][_0x7995('0xfe')],_[_0x7995('0xff')](_0x5348e2[_0x7995('0x5a')],[_0x7995('0xfe'),'id'])||{})[_0x7995('0xc1')](function(_0x456dc7){for(var _0x407b44=0x0;_0x407b44<_0x5348e2['body']['ids']['length'];_0x407b44+=0x1){socket[_0x7995('0x133')](_0x7995('0x134'),{'UserId':_0x5348e2['body'][_0x7995('0xfe')][_0x407b44],'ChatWebsiteId':_0x5348e2[_0x7995('0x56')]['id']});}return _0x456dc7;});}})[_0x7995('0x36')](respondWithResult(_0x141f71,null))[_0x7995('0x2b')](handleError(_0x141f71,null));};exports[_0x7995('0x135')]=function(_0x2dfd2b,_0xbbf182,_0x3d52af){return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x2dfd2b[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0xbbf182,null))[_0x7995('0x36')](function(_0x4b0ad9){if(_0x4b0ad9){return _0x4b0ad9['removeAgents'](_0x2dfd2b[_0x7995('0x45')]['ids'])['then'](function(){if(_['isArray'](_0x2dfd2b[_0x7995('0x45')][_0x7995('0xfe')])){for(var _0x52c6ce=0x0;_0x52c6ce<_0x2dfd2b[_0x7995('0x45')][_0x7995('0xfe')][_0x7995('0x57')];_0x52c6ce+=0x1){socket['emit'](_0x7995('0x136'),{'UserId':Number(_0x2dfd2b[_0x7995('0x45')]['ids'][_0x52c6ce]),'ChatWebsiteId':Number(_0x2dfd2b['params']['id'])});}}else{socket[_0x7995('0x133')](_0x7995('0x136'),{'UserId':Number(_0x2dfd2b['query'][_0x7995('0xfe')]),'ChatWebsiteId':Number(_0x2dfd2b[_0x7995('0x56')]['id'])});}});}})[_0x7995('0x36')](respondWithStatusCode(_0xbbf182,null))[_0x7995('0x2b')](handleError(_0xbbf182,null));};exports['getAgents']=function(_0x2ab4c2,_0x224d43,_0x47f884){var _0x2a1882={};var _0x374987={};var _0x560b66;var _0x1fc27e;return db[_0x7995('0x41')][_0x7995('0x66')]({'where':{'id':_0x2ab4c2[_0x7995('0x56')]['id']}})[_0x7995('0x36')](handleEntityNotFound(_0x224d43,null))[_0x7995('0x36')](function(_0x5a2769){if(_0x5a2769){_0x560b66=_0x5a2769;_0x374987[_0x7995('0x4a')]=_['keys'](db[_0x7995('0xcc')][_0x7995('0x42')]);_0x374987[_0x7995('0x45')]=_[_0x7995('0x67')](_0x2ab4c2[_0x7995('0x45')]);_0x374987[_0x7995('0x46')]=_['intersection'](_0x374987[_0x7995('0x4a')],_0x374987[_0x7995('0x45')]);_0x2a1882[_0x7995('0x49')]=_[_0x7995('0x47')](_0x374987['model'],qs[_0x7995('0x48')](_0x2ab4c2[_0x7995('0x45')][_0x7995('0x48')]));_0x2a1882[_0x7995('0x49')]=_0x2a1882[_0x7995('0x49')][_0x7995('0x57')]?_0x2a1882[_0x7995('0x49')]:_0x374987[_0x7995('0x4a')];_0x2a1882[_0x7995('0x4d')]=qs[_0x7995('0x4e')](_0x2ab4c2['query'][_0x7995('0x4e')]);_0x2a1882[_0x7995('0x4f')]=qs['filters'](_[_0x7995('0x69')](_0x2ab4c2[_0x7995('0x45')],_0x374987[_0x7995('0x46')]));if(_0x2ab4c2[_0x7995('0x45')][_0x7995('0x6b')]){_0x2a1882[_0x7995('0x4f')]=_[_0x7995('0x50')](_0x2a1882['where'],{'$or':_['map'](_0x2a1882[_0x7995('0x49')],function(_0x2b6d4c){var _0x2097f0={};_0x2097f0[_0x2b6d4c]={'$like':'%'+_0x2ab4c2[_0x7995('0x45')][_0x7995('0x6b')]+'%'};return _0x2097f0;})});}_0x2a1882=_[_0x7995('0x50')]({},_0x2a1882,_0x2ab4c2[_0x7995('0x52')]);return _0x560b66['getAgents'](_0x2a1882);}})[_0x7995('0x36')](function(_0x444c63){if(_0x444c63){_0x1fc27e=_0x444c63[_0x7995('0x57')];if(!_0x2ab4c2[_0x7995('0x45')]['hasOwnProperty'](_0x7995('0x68'))){_0x2a1882[_0x7995('0x31')]=qs['limit'](_0x2ab4c2[_0x7995('0x45')]['limit']);_0x2a1882['offset']=qs['offset'](_0x2ab4c2[_0x7995('0x45')][_0x7995('0x4c')]);}return _0x560b66[_0x7995('0x137')](_0x2a1882);}})[_0x7995('0x36')](function(_0x16bb2a){if(_0x16bb2a){return _0x16bb2a?{'count':_0x1fc27e,'rows':_0x16bb2a}:null;}})['then'](respondWithResult(_0x224d43,null))[_0x7995('0x2b')](handleError(_0x224d43,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 5a994a2..66a5085 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 _0x535f=['hook','../../mysqldb','ChatWebsite','save','update','remove','emit','hasOwnProperty'];(function(_0x42fffb,_0x34cad6){var _0x5ce507=function(_0x3b3850){while(--_0x3b3850){_0x42fffb['push'](_0x42fffb['shift']());}};_0x5ce507(++_0x34cad6);}(_0x535f,0x111));var _0xf535=function(_0x20a070,_0x2f0ff9){_0x20a070=_0x20a070-0x0;var _0x433d80=_0x535f[_0x20a070];return _0x433d80;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xf535('0x0'))['db'][_0xf535('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf535('0x2'),'afterUpdate':_0xf535('0x3'),'afterDestroy':_0xf535('0x4')};function emitEvent(_0x19ec32){return function(_0x4ff0b3,_0xd1ee93,_0x24a323){ChatWebsiteEvents[_0xf535('0x5')](_0x19ec32+':'+_0x4ff0b3['id'],_0x4ff0b3);ChatWebsiteEvents[_0xf535('0x5')](_0x19ec32,_0x4ff0b3);_0x24a323(null);};}for(var e in events){if(events[_0xf535('0x6')](e)){var event=events[e];ChatWebsite[_0xf535('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x635c=['exports','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit','hook'];(function(_0x5705ba,_0x50c3dc){var _0x53d6e5=function(_0x401334){while(--_0x401334){_0x5705ba['push'](_0x5705ba['shift']());}};_0x53d6e5(++_0x50c3dc);}(_0x635c,0xa1));var _0xc635=function(_0x4d84ab,_0x1c1abe){_0x4d84ab=_0x4d84ab-0x0;var _0x50de80=_0x635c[_0x4d84ab];return _0x50de80;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xc635('0x0'))['db'][_0xc635('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc635('0x2')](0x0);var events={'afterCreate':_0xc635('0x3'),'afterUpdate':'update','afterDestroy':_0xc635('0x4')};function emitEvent(_0x3c1e8c){return function(_0x326256,_0xfa846a,_0x421372){ChatWebsiteEvents[_0xc635('0x5')](_0x3c1e8c+':'+_0x326256['id'],_0x326256);ChatWebsiteEvents[_0xc635('0x5')](_0x3c1e8c,_0x326256);_0x421372(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xc635('0x6')](e,emitEvent(event));}}module[_0xc635('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 77f6bae..55ebd60 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 _0x0490=['exports','define','chat_websites','util','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x1e1831,_0x3d5cd3){var _0x46b204=function(_0x588627){while(--_0x588627){_0x1e1831['push'](_0x1e1831['shift']());}};_0x46b204(++_0x3d5cd3);}(_0x0490,0x147));var _0x0049=function(_0x38ee7c,_0x2df4be){_0x38ee7c=_0x38ee7c-0x0;var _0x52706a=_0x0490[_0x38ee7c];return _0x52706a;};'use strict';var _=require('lodash');var util=require(_0x0049('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0049('0x1'));var fs=require('fs');var path=require(_0x0049('0x2'));var rimraf=require(_0x0049('0x3'));var config=require(_0x0049('0x4'));var attributes=require(_0x0049('0x5'));module[_0x0049('0x6')]=function(_0x2957b6,_0x4dde1){return _0x2957b6[_0x0049('0x7')]('ChatWebsite',attributes,{'tableName':_0x0049('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b87=['define','ChatWebsite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x3ad62c,_0x465700){var _0x18e4f3=function(_0x2ae3c3){while(--_0x2ae3c3){_0x3ad62c['push'](_0x3ad62c['shift']());}};_0x18e4f3(++_0x465700);}(_0x9b87,0x8e));var _0x79b8=function(_0x128274,_0x12a3b4){_0x128274=_0x128274-0x0;var _0x5b6a9e=_0x9b87[_0x128274];return _0x5b6a9e;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var logger=require(_0x79b8('0x2'))(_0x79b8('0x3'));var moment=require(_0x79b8('0x4'));var BPromise=require(_0x79b8('0x5'));var rp=require(_0x79b8('0x6'));var fs=require('fs');var path=require(_0x79b8('0x7'));var rimraf=require(_0x79b8('0x8'));var config=require(_0x79b8('0x9'));var attributes=require(_0x79b8('0xa'));module[_0x79b8('0xb')]=function(_0x3ccc53,_0x2e21b9){return _0x3ccc53[_0x79b8('0xc')](_0x79b8('0xd'),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 aded157..3059001 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 _0x4888=['../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x15e0a3,_0x3da4b5){var _0x261c01=function(_0x427cff){while(--_0x427cff){_0x15e0a3['push'](_0x15e0a3['shift']());}};_0x261c01(++_0x3da4b5);}(_0x4888,0x198));var _0x8488=function(_0x3818c0,_0x542521){_0x3818c0=_0x3818c0-0x0;var _0x55ec33=_0x4888[_0x3818c0];return _0x55ec33;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});config[_0x8488('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0xc')]));require(_0x8488('0xd'))['register'](socket);function respondWithRpcPromise(_0x19c994,_0x1334fe,_0x98223){return new BPromise(function(_0x19a2ee,_0x515ea8){return client[_0x8488('0xe')](_0x19c994,_0x98223)[_0x8488('0xf')](function(_0x468896){logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,'request\x20sent');logger[_0x8488('0x12')](_0x8488('0x13'),_0x1334fe,'request\x20sent',JSON['stringify'](_0x468896));if(_0x468896[_0x8488('0x14')]){if(_0x468896['error'][_0x8488('0x15')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1334fe,_0x468896[_0x8488('0x14')][_0x8488('0x16')]);return _0x515ea8(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x468896[_0x8488('0x14')]['message']);return _0x19a2ee(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}else{logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,_0x8488('0x17'));_0x19a2ee(_0x468896[_0x8488('0x18')][_0x8488('0x16')]);}})[_0x8488('0x19')](function(_0x514c31){logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x514c31);_0x515ea8(_0x514c31);});});} \ No newline at end of file +var _0xc1c6=['./chatWebsite.socket','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x10fe9a,_0x151bcd){var _0x16a8d6=function(_0x4da9fe){while(--_0x4da9fe){_0x10fe9a['push'](_0x10fe9a['shift']());}};_0x16a8d6(++_0x151bcd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xee0fd,_0xc3635f){_0xee0fd=_0xee0fd-0x0;var _0x32eecd=_0xc1c6[_0xee0fd];return _0x32eecd;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});config['redis']=_[_0x6c1c('0x9')](config[_0x6c1c('0xa')],{'host':_0x6c1c('0xb'),'port':0x18eb});var socket=require(_0x6c1c('0xc'))(new Redis(config['redis']));require(_0x6c1c('0xd'))[_0x6c1c('0xe')](socket);function respondWithRpcPromise(_0x524d21,_0x147c7b,_0x36275f){return new BPromise(function(_0xb3bd12,_0x1137e8){return client['request'](_0x524d21,_0x36275f)[_0x6c1c('0xf')](function(_0x2a4fd4){logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));logger[_0x6c1c('0x12')](_0x6c1c('0x13'),_0x147c7b,'request\x20sent',JSON[_0x6c1c('0x14')](_0x2a4fd4));if(_0x2a4fd4['error']){if(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x16')]===0x1f4){logger[_0x6c1c('0x15')](_0x6c1c('0x17'),_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0x1137e8(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);}logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0xb3bd12(_0x2a4fd4['error'][_0x6c1c('0x18')]);}else{logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));_0xb3bd12(_0x2a4fd4['result'][_0x6c1c('0x18')]);}})[_0x6c1c('0x19')](function(_0x5a3bb7){logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x5a3bb7);_0x1137e8(_0x5a3bb7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 9f96345..af678b4 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34e2c1,_0x31e287){_0x34e2c1=_0x34e2c1-0x0;var _0xb3d893=_0x5f2f[_0x34e2c1];return _0xb3d893;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x55a76a,_0x2d0203){var _0x45885a=function(_0x4348d5){while(--_0x4348d5){_0x55a76a['push'](_0x55a76a['shift']());}};_0x45885a(++_0x2d0203);}(_0xb10b,0x12a));var _0xbb10=function(_0x161cb1,_0x7930a){_0x161cb1=_0x161cb1-0x0;var _0x36dd92=_0xb10b[_0x161cb1];return _0x36dd92;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 6e7b8b4..e4e8460 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 _0x32cf=['getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','originalname','/:id/logo','single','join','server/files/images/avatars/','file','addAvatar','now','addSystemAvatar','notify','attachments','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getLogo','/:id/avatar','/:id/customer_avatar'];(function(_0x51b665,_0x39ba8e){var _0x5bef86=function(_0x3dd7d5){while(--_0x3dd7d5){_0x51b665['push'](_0x51b665['shift']());}};_0x5bef86(++_0x39ba8e);}(_0x32cf,0xc5));var _0xf32c=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x32cf[_0x310504];return _0x5b36d0;};'use strict';var multer=require(_0xf32c('0x0'));var util=require(_0xf32c('0x1'));var path=require('path');var timeout=require(_0xf32c('0x2'));var express=require(_0xf32c('0x3'));var router=express[_0xf32c('0x4')]();var fs_extra=require(_0xf32c('0x5'));var auth=require(_0xf32c('0x6'));var interaction=require(_0xf32c('0x7'));var config=require(_0xf32c('0x8'));var controller=require(_0xf32c('0x9'));router[_0xf32c('0xa')]('/',auth['isAuthenticated'](),controller[_0xf32c('0xb')]);router[_0xf32c('0xa')](_0xf32c('0xc'),auth[_0xf32c('0xd')](),controller[_0xf32c('0xe')]);router[_0xf32c('0xa')](_0xf32c('0xf'),auth['isAuthenticated'](),controller[_0xf32c('0x10')]);router[_0xf32c('0xa')](_0xf32c('0x11'),auth[_0xf32c('0xd')](),controller[_0xf32c('0x12')]);router[_0xf32c('0xa')]('/:id/canned_answers',auth[_0xf32c('0xd')](),controller['getAnswers']);router[_0xf32c('0xa')]('/:id/logo',controller[_0xf32c('0x13')]);router[_0xf32c('0xa')](_0xf32c('0x14'),controller['getAvatar']);router['get'](_0xf32c('0x15'),controller[_0xf32c('0x16')]);router[_0xf32c('0xa')](_0xf32c('0x17'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0xf32c('0xd')](),controller[_0xf32c('0x18')]);router[_0xf32c('0xa')](_0xf32c('0x19'),controller[_0xf32c('0x1a')]);router[_0xf32c('0xa')](_0xf32c('0x1b'),auth['isAuthenticated'](),controller[_0xf32c('0x1c')]);router['get'](_0xf32c('0x1d'),auth[_0xf32c('0xd')](),controller[_0xf32c('0x1e')]);router[_0xf32c('0xa')](_0xf32c('0x1f'),controller[_0xf32c('0x20')]);router['get'](_0xf32c('0x21'),auth[_0xf32c('0xd')](),controller[_0xf32c('0x22')]);router[_0xf32c('0xa')](_0xf32c('0x23'),auth['isAuthenticated'](),controller['getAgents']);router[_0xf32c('0x24')]('/',auth[_0xf32c('0xd')](),controller[_0xf32c('0x25')]);router[_0xf32c('0x24')](_0xf32c('0x11'),auth['isAuthenticated'](),controller[_0xf32c('0x26')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf32c('0x27')]);var upload=multer({'storage':multer[_0xf32c('0x28')]({'destination':function(_0x47fdcf,_0x29604e,_0x2b33d6){_0x2b33d6(null,path['join'](config[_0xf32c('0x29')],_0xf32c('0x2a')));},'filename':function(_0x49d861,_0x587684,_0x20ddfd){_0x20ddfd(null,util[_0xf32c('0x2b')](_0xf32c('0x2c'),Date['now'](),_0x587684[_0xf32c('0x2d')]));}})});router[_0xf32c('0x24')](_0xf32c('0x2e'),upload[_0xf32c('0x2f')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf0dfcb,_0x320a16,_0x39b18e){_0x39b18e(null,path[_0xf32c('0x30')](config[_0xf32c('0x29')],_0xf32c('0x31')));},'filename':function(_0x4714b6,_0x1b95a1,_0x3d17ff){_0x3d17ff(null,util[_0xf32c('0x2b')](_0xf32c('0x2c'),Date['now'](),_0x1b95a1['originalname']));}})});router[_0xf32c('0x24')]('/:id/avatar',upload[_0xf32c('0x2f')](_0xf32c('0x32')),controller[_0xf32c('0x33')]);var upload=multer({'storage':multer[_0xf32c('0x28')]({'destination':function(_0x3f01da,_0x557955,_0x306069){_0x306069(null,path['join'](config['root'],_0xf32c('0x31')));},'filename':function(_0x238898,_0x2e21ba,_0x25c6cf){_0x25c6cf(null,util[_0xf32c('0x2b')](_0xf32c('0x2c'),Date[_0xf32c('0x34')](),_0x2e21ba['originalname']));}})});router[_0xf32c('0x24')]('/:id/customer_avatar',upload[_0xf32c('0x2f')](_0xf32c('0x32')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xf32c('0x28')]({'destination':function(_0x2e9710,_0x38c738,_0x26c704){_0x26c704(null,path['join'](config[_0xf32c('0x29')],_0xf32c('0x31')));},'filename':function(_0x5f32f9,_0x2d7aaa,_0x2cf5ca){_0x2cf5ca(null,util['format'](_0xf32c('0x2c'),Date[_0xf32c('0x34')](),_0x2d7aaa[_0xf32c('0x2d')]));}})});router[_0xf32c('0x24')](_0xf32c('0x17'),upload['single']('file'),controller[_0xf32c('0x35')]);router[_0xf32c('0x24')]('/:id/notify',controller[_0xf32c('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3b6533,_0x4a2a38,_0x48f2c5){const _0x45a306=path[_0xf32c('0x30')](config[_0xf32c('0x29')],'server/files',_0xf32c('0x37'),'offline-chat');fs_extra[_0xf32c('0x38')](_0x45a306,function(){_0x48f2c5(null,_0x45a306);});},'filename':function(_0x224deb,_0x52736d,_0x514176){const _0x310a12=_0x52736d[_0xf32c('0x2d')][_0xf32c('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x53c20d=path[_0xf32c('0x3a')](_0x310a12);const _0x22a442=Date[_0xf32c('0x34')]()+'-'+_0x310a12['replace'](_0x53c20d,'')+_0x53c20d;_0x514176(null,_0x22a442);}})});router['post'](_0xf32c('0x3b'),offlineUploadMulter[_0xf32c('0x3c')](),controller[_0xf32c('0x3d')]);router[_0xf32c('0x24')]('/:id/interactions',auth[_0xf32c('0xd')](),controller[_0xf32c('0x3e')]);router[_0xf32c('0x24')]('/:id/applications',auth[_0xf32c('0xd')](),controller['addApplications']);router[_0xf32c('0x24')](_0xf32c('0x1d'),auth[_0xf32c('0xd')](),controller[_0xf32c('0x3f')]);router['post'](_0xf32c('0x23'),auth[_0xf32c('0xd')](),controller[_0xf32c('0x40')]);router[_0xf32c('0x41')](_0xf32c('0xf'),auth[_0xf32c('0xd')](),controller[_0xf32c('0x42')]);router[_0xf32c('0x43')](_0xf32c('0xf'),auth['isAuthenticated'](),controller[_0xf32c('0x44')]);router['delete'](_0xf32c('0x11'),auth[_0xf32c('0xd')](),controller[_0xf32c('0x45')]);router[_0xf32c('0x43')](_0xf32c('0x46'),auth[_0xf32c('0xd')](),controller[_0xf32c('0x47')]);router[_0xf32c('0x43')]('/:id/users',auth[_0xf32c('0xd')](),controller['removeAgents']);module[_0xf32c('0x48')]=router; \ No newline at end of file +var _0x5969=['originalname','single','file','addLogo','format','addAvatar','server/files/images/avatars/','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','ensureDir','replace','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/users','getAgents','post','create','diskStorage','join','root','server/files/images/logos/','%s-%s','now'];(function(_0x65392a,_0x1b505e){var _0x54cf55=function(_0x38b016){while(--_0x38b016){_0x65392a['push'](_0x65392a['shift']());}};_0x54cf55(++_0x1b505e);}(_0x5969,0x17a));var _0x9596=function(_0x213de2,_0x565ad2){_0x213de2=_0x213de2-0x0;var _0x88c99c=_0x5969[_0x213de2];return _0x88c99c;};'use strict';var multer=require(_0x9596('0x0'));var util=require(_0x9596('0x1'));var path=require(_0x9596('0x2'));var timeout=require(_0x9596('0x3'));var express=require(_0x9596('0x4'));var router=express[_0x9596('0x5')]();var fs_extra=require(_0x9596('0x6'));var auth=require(_0x9596('0x7'));var interaction=require(_0x9596('0x8'));var config=require('../../config/environment');var controller=require(_0x9596('0x9'));router[_0x9596('0xa')]('/',auth[_0x9596('0xb')](),controller['index']);router[_0x9596('0xa')]('/describe',auth[_0x9596('0xb')](),controller[_0x9596('0xc')]);router[_0x9596('0xa')](_0x9596('0xd'),auth[_0x9596('0xb')](),controller[_0x9596('0xe')]);router[_0x9596('0xa')](_0x9596('0xf'),auth[_0x9596('0xb')](),controller[_0x9596('0x10')]);router[_0x9596('0xa')](_0x9596('0x11'),auth[_0x9596('0xb')](),controller[_0x9596('0x12')]);router[_0x9596('0xa')](_0x9596('0x13'),controller[_0x9596('0x14')]);router[_0x9596('0xa')](_0x9596('0x15'),controller[_0x9596('0x16')]);router[_0x9596('0xa')](_0x9596('0x17'),controller[_0x9596('0x18')]);router[_0x9596('0xa')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x9596('0xa')]('/:id/interactions',auth[_0x9596('0xb')](),controller['getInteractions']);router[_0x9596('0xa')]('/:id/snippet',controller[_0x9596('0x19')]);router[_0x9596('0xa')](_0x9596('0x1a'),auth[_0x9596('0xb')](),controller[_0x9596('0x1b')]);router[_0x9596('0xa')](_0x9596('0x1c'),auth[_0x9596('0xb')](),controller[_0x9596('0x1d')]);router[_0x9596('0xa')](_0x9596('0x1e'),controller[_0x9596('0x1f')]);router[_0x9596('0xa')]('/:id/offline_messages',auth[_0x9596('0xb')](),controller['getOfflineMessages']);router[_0x9596('0xa')](_0x9596('0x20'),auth[_0x9596('0xb')](),controller[_0x9596('0x21')]);router[_0x9596('0x22')]('/',auth[_0x9596('0xb')](),controller[_0x9596('0x23')]);router[_0x9596('0x22')](_0x9596('0xf'),auth[_0x9596('0xb')](),controller['addDisposition']);router[_0x9596('0x22')](_0x9596('0x11'),auth[_0x9596('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x9596('0x24')]({'destination':function(_0xb0a49b,_0x58299d,_0x1e9c90){_0x1e9c90(null,path[_0x9596('0x25')](config[_0x9596('0x26')],_0x9596('0x27')));},'filename':function(_0x1f377d,_0x2cfbb2,_0x56822a){_0x56822a(null,util['format'](_0x9596('0x28'),Date[_0x9596('0x29')](),_0x2cfbb2[_0x9596('0x2a')]));}})});router['post'](_0x9596('0x13'),upload[_0x9596('0x2b')](_0x9596('0x2c')),controller[_0x9596('0x2d')]);var upload=multer({'storage':multer[_0x9596('0x24')]({'destination':function(_0x23061c,_0xdc4b81,_0x471e1b){_0x471e1b(null,path[_0x9596('0x25')](config[_0x9596('0x26')],'server/files/images/avatars/'));},'filename':function(_0x52e0bc,_0x36e280,_0x2f35f7){_0x2f35f7(null,util[_0x9596('0x2e')]('%s-%s',Date[_0x9596('0x29')](),_0x36e280['originalname']));}})});router['post']('/:id/avatar',upload['single'](_0x9596('0x2c')),controller[_0x9596('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x165507,_0x109f79,_0x40f2d1){_0x40f2d1(null,path[_0x9596('0x25')](config['root'],_0x9596('0x30')));},'filename':function(_0x3134b0,_0x41530c,_0x3b984d){_0x3b984d(null,util[_0x9596('0x2e')](_0x9596('0x28'),Date[_0x9596('0x29')](),_0x41530c[_0x9596('0x2a')]));}})});router[_0x9596('0x22')]('/:id/customer_avatar',upload[_0x9596('0x2b')](_0x9596('0x2c')),controller[_0x9596('0x31')]);var upload=multer({'storage':multer[_0x9596('0x24')]({'destination':function(_0x32f3b7,_0x1b490d,_0x4a737d){_0x4a737d(null,path[_0x9596('0x25')](config['root'],_0x9596('0x30')));},'filename':function(_0x4ac878,_0x8d0b42,_0x2e46ec){_0x2e46ec(null,util[_0x9596('0x2e')](_0x9596('0x28'),Date[_0x9596('0x29')](),_0x8d0b42[_0x9596('0x2a')]));}})});router[_0x9596('0x22')](_0x9596('0x32'),upload[_0x9596('0x2b')]('file'),controller[_0x9596('0x33')]);router[_0x9596('0x22')](_0x9596('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x9596('0x24')]({'destination':function(_0x19b3c1,_0x24cf48,_0xf75386){const _0x418e0a=path['join'](config[_0x9596('0x26')],_0x9596('0x35'),'attachments','offline-chat');fs_extra[_0x9596('0x36')](_0x418e0a,function(){_0xf75386(null,_0x418e0a);});},'filename':function(_0x44cef5,_0x361857,_0x3b8d43){const _0x29d65f=_0x361857[_0x9596('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xce6b7f=path['extname'](_0x29d65f);const _0x4d5cbc=Date['now']()+'-'+_0x29d65f[_0x9596('0x37')](_0xce6b7f,'')+_0xce6b7f;_0x3b8d43(null,_0x4d5cbc);}})});router[_0x9596('0x22')](_0x9596('0x38'),offlineUploadMulter[_0x9596('0x39')](),controller[_0x9596('0x3a')]);router['post']('/:id/interactions',auth[_0x9596('0xb')](),controller[_0x9596('0x3b')]);router[_0x9596('0x22')](_0x9596('0x1a'),auth[_0x9596('0xb')](),controller[_0x9596('0x3c')]);router[_0x9596('0x22')](_0x9596('0x1c'),auth[_0x9596('0xb')](),controller[_0x9596('0x3d')]);router[_0x9596('0x22')](_0x9596('0x20'),auth[_0x9596('0xb')](),controller[_0x9596('0x3e')]);router[_0x9596('0x3f')](_0x9596('0xd'),auth['isAuthenticated'](),controller[_0x9596('0x40')]);router['delete']('/:id',auth[_0x9596('0xb')](),controller[_0x9596('0x41')]);router[_0x9596('0x42')](_0x9596('0xf'),auth[_0x9596('0xb')](),controller[_0x9596('0x43')]);router[_0x9596('0x42')](_0x9596('0x11'),auth[_0x9596('0xb')](),controller[_0x9596('0x44')]);router[_0x9596('0x42')](_0x9596('0x20'),auth[_0x9596('0xb')](),controller[_0x9596('0x45')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index ccae7a1..aaba2b3 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 _0x7b27=['sequelize','STRING','ENUM','AmazonAWS','Google'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x7b27,0x186));var _0x77b2=function(_0x153e46,_0x250111){_0x153e46=_0x153e46-0x0;var _0x456c36=_0x7b27[_0x153e46];return _0x456c36;};'use strict';var Sequelize=require(_0x77b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x77b2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x77b2('0x2')](_0x77b2('0x3'),_0x77b2('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x77b2('0x1')]}}; \ No newline at end of file +var _0x7edb=['STRING','ENUM','AmazonAWS','Google','exports'];(function(_0xfbdc66,_0x9fa334){var _0x37a251=function(_0x1e0895){while(--_0x1e0895){_0xfbdc66['push'](_0xfbdc66['shift']());}};_0x37a251(++_0x9fa334);}(_0x7edb,0x158));var _0xb7ed=function(_0x588259,_0x8deaf6){_0x588259=_0x588259-0x0;var _0x41d5a5=_0x7edb[_0x588259];return _0x41d5a5;};'use strict';var Sequelize=require('sequelize');module[_0xb7ed('0x0')]={'name':{'type':Sequelize[_0xb7ed('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb7ed('0x2')](_0xb7ed('0x3'),_0xb7ed('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xb7ed('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ddf59a4..bbb3beb 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 _0x1dc4=['end','status','json','offset','limit','undefined','count','set','apply','update','destroy','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','CloudProvider','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x24e543,_0x176a21){var _0x1fe2e4=function(_0x5d32fd){while(--_0x5d32fd){_0x24e543['push'](_0x24e543['shift']());}};_0x1fe2e4(++_0x176a21);}(_0x1dc4,0x15f));var _0x41dc=function(_0xc00012,_0x3b9858){_0xc00012=_0xc00012-0x0;var _0x38b822=_0x1dc4[_0xc00012];return _0x38b822;};'use strict';var emlformat=require(_0x41dc('0x0'));var rimraf=require(_0x41dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41dc('0x2'));var rp=require(_0x41dc('0x3'));var moment=require(_0x41dc('0x4'));var BPromise=require(_0x41dc('0x5'));var Mustache=require(_0x41dc('0x6'));var util=require(_0x41dc('0x7'));var path=require('path');var sox=require(_0x41dc('0x8'));var csv=require(_0x41dc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41dc('0xa'));var _=require(_0x41dc('0xb'));var squel=require(_0x41dc('0xc'));var crypto=require(_0x41dc('0xd'));var jsforce=require(_0x41dc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x41dc('0xf'));var Redis=require(_0x41dc('0x10'));var authService=require(_0x41dc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x41dc('0x12'));var hardwareService=require(_0x41dc('0x13'));var logger=require(_0x41dc('0x14'))('api');var utils=require(_0x41dc('0x15'));var config=require(_0x41dc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x41dc('0x17'))['db'];function respondWithStatusCode(_0x5d2299,_0x1646d4){_0x1646d4=_0x1646d4||0xcc;return function(_0x422a57){if(_0x422a57){return _0x5d2299['sendStatus'](_0x1646d4);}return _0x5d2299['status'](_0x1646d4)[_0x41dc('0x18')]();};}function respondWithResult(_0x1d23d8,_0x3825ed){_0x3825ed=_0x3825ed||0xc8;return function(_0x4ede27){if(_0x4ede27){return _0x1d23d8[_0x41dc('0x19')](_0x3825ed)[_0x41dc('0x1a')](_0x4ede27);}};}function respondWithFilteredResult(_0x4b865a,_0x585f5c){return function(_0x5b3323){if(_0x5b3323){var _0x306462=typeof _0x585f5c[_0x41dc('0x1b')]==='undefined'&&typeof _0x585f5c[_0x41dc('0x1c')]===_0x41dc('0x1d');var _0x40f237=_0x5b3323[_0x41dc('0x1e')];var _0x4867cd=_0x306462?0x0:_0x585f5c['offset'];var _0x135b73=_0x306462?_0x5b3323[_0x41dc('0x1e')]:_0x585f5c[_0x41dc('0x1b')]+_0x585f5c[_0x41dc('0x1c')];var _0x402d70;if(_0x135b73>=_0x40f237){_0x135b73=_0x40f237;_0x402d70=0xc8;}else{_0x402d70=0xce;}_0x4b865a[_0x41dc('0x19')](_0x402d70);return _0x4b865a[_0x41dc('0x1f')]('Content-Range',_0x4867cd+'-'+_0x135b73+'/'+_0x40f237)[_0x41dc('0x1a')](_0x5b3323);}return null;};}function patchUpdates(_0x296906){return function(_0x44c285){try{jsonpatch[_0x41dc('0x20')](_0x44c285,_0x296906,!![]);}catch(_0x16615f){return BPromise['reject'](_0x16615f);}return _0x44c285['save']();};}function saveUpdates(_0x40bbe8,_0x40b567){return function(_0x49a506){if(_0x49a506){return _0x49a506[_0x41dc('0x21')](_0x40bbe8)['then'](function(_0x22d4d4){return _0x22d4d4;});}return null;};}function removeEntity(_0x522e00,_0x38f71b){return function(_0x5ee010){if(_0x5ee010){return _0x5ee010[_0x41dc('0x22')]()[_0x41dc('0x23')](function(){_0x522e00[_0x41dc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x229f2d,_0xd892ce){return function(_0x2e36ba){if(!_0x2e36ba){_0x229f2d[_0x41dc('0x24')](0x194);}return _0x2e36ba;};}function handleError(_0x4f5c4a,_0x3d85ca){_0x3d85ca=_0x3d85ca||0x1f4;return function(_0x51991a){logger['error'](_0x51991a[_0x41dc('0x25')]);if(_0x51991a[_0x41dc('0x26')]){delete _0x51991a[_0x41dc('0x26')];}_0x4f5c4a[_0x41dc('0x19')](_0x3d85ca)[_0x41dc('0x27')](_0x51991a);};}exports[_0x41dc('0x28')]=function(_0xe89f4a,_0x4ca605){var _0x2e4e3a={},_0x2e67da={},_0xc6b1c1={'count':0x0,'rows':[]};var _0x1d41ff=_['map'](db['CloudProvider'][_0x41dc('0x29')],function(_0x478bfc){return{'name':_0x478bfc[_0x41dc('0x2a')],'type':_0x478bfc[_0x41dc('0x2b')][_0x41dc('0x2c')]};});_0x2e67da[_0x41dc('0x2d')]=_['map'](_0x1d41ff,'name');_0x2e67da['query']=_[_0x41dc('0x2e')](_0xe89f4a[_0x41dc('0x2f')]);_0x2e67da[_0x41dc('0x30')]=_[_0x41dc('0x31')](_0x2e67da[_0x41dc('0x2d')],_0x2e67da[_0x41dc('0x2f')]);_0x2e4e3a[_0x41dc('0x32')]=_[_0x41dc('0x31')](_0x2e67da[_0x41dc('0x2d')],qs['fields'](_0xe89f4a['query']['fields']));_0x2e4e3a[_0x41dc('0x32')]=_0x2e4e3a[_0x41dc('0x32')]['length']?_0x2e4e3a['attributes']:_0x2e67da[_0x41dc('0x2d')];if(!_0xe89f4a[_0x41dc('0x2f')][_0x41dc('0x33')](_0x41dc('0x34'))){_0x2e4e3a[_0x41dc('0x1c')]=qs[_0x41dc('0x1c')](_0xe89f4a[_0x41dc('0x2f')][_0x41dc('0x1c')]);_0x2e4e3a[_0x41dc('0x1b')]=qs[_0x41dc('0x1b')](_0xe89f4a[_0x41dc('0x2f')][_0x41dc('0x1b')]);}_0x2e4e3a[_0x41dc('0x35')]=qs[_0x41dc('0x36')](_0xe89f4a[_0x41dc('0x2f')][_0x41dc('0x36')]);_0x2e4e3a[_0x41dc('0x37')]=qs[_0x41dc('0x30')](_[_0x41dc('0x38')](_0xe89f4a[_0x41dc('0x2f')],_0x2e67da[_0x41dc('0x30')]),_0x1d41ff);if(_0xe89f4a[_0x41dc('0x2f')][_0x41dc('0x39')]){_0x2e4e3a['where']=_['merge'](_0x2e4e3a['where'],{'$or':_[_0x41dc('0x3a')](_0x1d41ff,function(_0x1c545c){if(_0x1c545c['type']!==_0x41dc('0x3b')){var _0x379d12={};_0x379d12[_0x1c545c[_0x41dc('0x26')]]={'$like':'%'+_0xe89f4a['query'][_0x41dc('0x39')]+'%'};return _0x379d12;}})});}_0x2e4e3a=_[_0x41dc('0x3c')]({},_0x2e4e3a,_0xe89f4a[_0x41dc('0x3d')]);var _0x2cf57c={'where':_0x2e4e3a[_0x41dc('0x37')]};return db[_0x41dc('0x3e')]['count'](_0x2cf57c)[_0x41dc('0x23')](function(_0x522b94){_0xc6b1c1[_0x41dc('0x1e')]=_0x522b94;if(_0xe89f4a[_0x41dc('0x2f')][_0x41dc('0x3f')]){_0x2e4e3a[_0x41dc('0x40')]=[{'all':!![]}];}return db['CloudProvider'][_0x41dc('0x41')](_0x2e4e3a);})[_0x41dc('0x23')](function(_0x485c2c){_0xc6b1c1[_0x41dc('0x42')]=_0x485c2c;return _0xc6b1c1;})[_0x41dc('0x23')](respondWithFilteredResult(_0x4ca605,_0x2e4e3a))[_0x41dc('0x43')](handleError(_0x4ca605,null));};exports[_0x41dc('0x44')]=function(_0x425221,_0x1e079a){var _0x583faa={'raw':!![],'where':{'id':_0x425221[_0x41dc('0x45')]['id']}},_0x1557ba={};_0x1557ba['model']=_['keys'](db[_0x41dc('0x3e')][_0x41dc('0x29')]);_0x1557ba['query']=_[_0x41dc('0x2e')](_0x425221['query']);_0x1557ba[_0x41dc('0x30')]=_[_0x41dc('0x31')](_0x1557ba['model'],_0x1557ba[_0x41dc('0x2f')]);_0x583faa['attributes']=_[_0x41dc('0x31')](_0x1557ba['model'],qs[_0x41dc('0x46')](_0x425221[_0x41dc('0x2f')][_0x41dc('0x46')]));_0x583faa[_0x41dc('0x32')]=_0x583faa['attributes'][_0x41dc('0x47')]?_0x583faa[_0x41dc('0x32')]:_0x1557ba[_0x41dc('0x2d')];if(_0x425221[_0x41dc('0x2f')][_0x41dc('0x3f')]){_0x583faa[_0x41dc('0x40')]=[{'all':!![]}];}_0x583faa=_[_0x41dc('0x3c')]({},_0x583faa,_0x425221[_0x41dc('0x3d')]);return db['CloudProvider'][_0x41dc('0x48')](_0x583faa)['then'](handleEntityNotFound(_0x1e079a,null))[_0x41dc('0x23')](respondWithResult(_0x1e079a,null))[_0x41dc('0x43')](handleError(_0x1e079a,null));};exports[_0x41dc('0x49')]=function(_0x2cdbcd,_0xe036ce){return db[_0x41dc('0x3e')][_0x41dc('0x49')](_0x2cdbcd[_0x41dc('0x4a')],{})['then'](respondWithResult(_0xe036ce,0xc9))[_0x41dc('0x43')](handleError(_0xe036ce,null));};exports[_0x41dc('0x21')]=function(_0x10f9ec,_0x304cfe){if(_0x10f9ec[_0x41dc('0x4a')]['id']){delete _0x10f9ec[_0x41dc('0x4a')]['id'];}return db[_0x41dc('0x3e')][_0x41dc('0x48')]({'where':{'id':_0x10f9ec[_0x41dc('0x45')]['id']}})[_0x41dc('0x23')](handleEntityNotFound(_0x304cfe,null))['then'](saveUpdates(_0x10f9ec[_0x41dc('0x4a')],null))[_0x41dc('0x23')](respondWithResult(_0x304cfe,null))['catch'](handleError(_0x304cfe,null));};exports['destroy']=function(_0x1e5ea5,_0x42c3c9){return db[_0x41dc('0x3e')]['find']({'where':{'id':_0x1e5ea5[_0x41dc('0x45')]['id']}})[_0x41dc('0x23')](handleEntityNotFound(_0x42c3c9,null))[_0x41dc('0x23')](removeEntity(_0x42c3c9,null))[_0x41dc('0x43')](handleError(_0x42c3c9,null));}; \ No newline at end of file +var _0x701c=['include','findAll','rows','catch','show','length','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','map','CloudProvider','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll'];(function(_0x370b67,_0x26faab){var _0x53e115=function(_0x157d3b){while(--_0x157d3b){_0x370b67['push'](_0x370b67['shift']());}};_0x53e115(++_0x26faab);}(_0x701c,0x1d9));var _0xc701=function(_0x2bfb31,_0xdd9aae){_0x2bfb31=_0x2bfb31-0x0;var _0x2b00ce=_0x701c[_0x2bfb31];return _0x2b00ce;};'use strict';var emlformat=require(_0xc701('0x0'));var rimraf=require(_0xc701('0x1'));var zipdir=require(_0xc701('0x2'));var jsonpatch=require(_0xc701('0x3'));var rp=require(_0xc701('0x4'));var moment=require('moment');var BPromise=require(_0xc701('0x5'));var Mustache=require('mustache');var util=require(_0xc701('0x6'));var path=require(_0xc701('0x7'));var sox=require(_0xc701('0x8'));var csv=require(_0xc701('0x9'));var ejs=require(_0xc701('0xa'));var fs=require('fs');var fs_extra=require(_0xc701('0xb'));var _=require(_0xc701('0xc'));var squel=require(_0xc701('0xd'));var crypto=require(_0xc701('0xe'));var jsforce=require(_0xc701('0xf'));var deskjs=require(_0xc701('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc701('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc701('0x12'));var qs=require(_0xc701('0x13'));var as=require(_0xc701('0x14'));var hardwareService=require(_0xc701('0x15'));var logger=require(_0xc701('0x16'))(_0xc701('0x17'));var utils=require(_0xc701('0x18'));var config=require(_0xc701('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c6e51,_0x5ba3e3){_0x5ba3e3=_0x5ba3e3||0xcc;return function(_0x3d8f6a){if(_0x3d8f6a){return _0x1c6e51[_0xc701('0x1a')](_0x5ba3e3);}return _0x1c6e51[_0xc701('0x1b')](_0x5ba3e3)[_0xc701('0x1c')]();};}function respondWithResult(_0x340f9c,_0x452211){_0x452211=_0x452211||0xc8;return function(_0x1e8f82){if(_0x1e8f82){return _0x340f9c['status'](_0x452211)[_0xc701('0x1d')](_0x1e8f82);}};}function respondWithFilteredResult(_0x2592fd,_0x4d779f){return function(_0x35467d){if(_0x35467d){var _0x13f8ae=typeof _0x4d779f[_0xc701('0x1e')]==='undefined'&&typeof _0x4d779f[_0xc701('0x1f')]===_0xc701('0x20');var _0x4e5d89=_0x35467d[_0xc701('0x21')];var _0x44b04f=_0x13f8ae?0x0:_0x4d779f[_0xc701('0x1e')];var _0x578a82=_0x13f8ae?_0x35467d[_0xc701('0x21')]:_0x4d779f['offset']+_0x4d779f[_0xc701('0x1f')];var _0x4f05cc;if(_0x578a82>=_0x4e5d89){_0x578a82=_0x4e5d89;_0x4f05cc=0xc8;}else{_0x4f05cc=0xce;}_0x2592fd['status'](_0x4f05cc);return _0x2592fd[_0xc701('0x22')](_0xc701('0x23'),_0x44b04f+'-'+_0x578a82+'/'+_0x4e5d89)[_0xc701('0x1d')](_0x35467d);}return null;};}function patchUpdates(_0xb3c45f){return function(_0x32bed1){try{jsonpatch[_0xc701('0x24')](_0x32bed1,_0xb3c45f,!![]);}catch(_0x550ff3){return BPromise[_0xc701('0x25')](_0x550ff3);}return _0x32bed1[_0xc701('0x26')]();};}function saveUpdates(_0x1c0759,_0x47fa9a){return function(_0x53278c){if(_0x53278c){return _0x53278c['update'](_0x1c0759)[_0xc701('0x27')](function(_0x309c65){return _0x309c65;});}return null;};}function removeEntity(_0x128d0e,_0x47199b){return function(_0x5af99d){if(_0x5af99d){return _0x5af99d[_0xc701('0x28')]()['then'](function(){_0x128d0e[_0xc701('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x281f52,_0x3eb0d4){return function(_0x4f6a2d){if(!_0x4f6a2d){_0x281f52[_0xc701('0x1a')](0x194);}return _0x4f6a2d;};}function handleError(_0x4fbf5e,_0x4aaaa9){_0x4aaaa9=_0x4aaaa9||0x1f4;return function(_0x3563de){logger[_0xc701('0x29')](_0x3563de[_0xc701('0x2a')]);if(_0x3563de['name']){delete _0x3563de['name'];}_0x4fbf5e[_0xc701('0x1b')](_0x4aaaa9)[_0xc701('0x2b')](_0x3563de);};}exports['index']=function(_0x2568f1,_0x50dbdf){var _0x3e4bcf={},_0x2ebf76={},_0x2110f7={'count':0x0,'rows':[]};var _0xe390aa=_[_0xc701('0x2c')](db[_0xc701('0x2d')][_0xc701('0x2e')],function(_0x2fdfd2){return{'name':_0x2fdfd2[_0xc701('0x2f')],'type':_0x2fdfd2[_0xc701('0x30')][_0xc701('0x31')]};});_0x2ebf76['model']=_[_0xc701('0x2c')](_0xe390aa,'name');_0x2ebf76['query']=_[_0xc701('0x32')](_0x2568f1[_0xc701('0x33')]);_0x2ebf76['filters']=_[_0xc701('0x34')](_0x2ebf76[_0xc701('0x35')],_0x2ebf76[_0xc701('0x33')]);_0x3e4bcf[_0xc701('0x36')]=_[_0xc701('0x34')](_0x2ebf76[_0xc701('0x35')],qs[_0xc701('0x37')](_0x2568f1[_0xc701('0x33')][_0xc701('0x37')]));_0x3e4bcf[_0xc701('0x36')]=_0x3e4bcf['attributes']['length']?_0x3e4bcf['attributes']:_0x2ebf76['model'];if(!_0x2568f1[_0xc701('0x33')]['hasOwnProperty'](_0xc701('0x38'))){_0x3e4bcf[_0xc701('0x1f')]=qs['limit'](_0x2568f1[_0xc701('0x33')][_0xc701('0x1f')]);_0x3e4bcf[_0xc701('0x1e')]=qs[_0xc701('0x1e')](_0x2568f1[_0xc701('0x33')][_0xc701('0x1e')]);}_0x3e4bcf[_0xc701('0x39')]=qs[_0xc701('0x3a')](_0x2568f1[_0xc701('0x33')][_0xc701('0x3a')]);_0x3e4bcf[_0xc701('0x3b')]=qs[_0xc701('0x3c')](_[_0xc701('0x3d')](_0x2568f1['query'],_0x2ebf76[_0xc701('0x3c')]),_0xe390aa);if(_0x2568f1[_0xc701('0x33')][_0xc701('0x3e')]){_0x3e4bcf['where']=_['merge'](_0x3e4bcf['where'],{'$or':_[_0xc701('0x2c')](_0xe390aa,function(_0x57b5f7){if(_0x57b5f7[_0xc701('0x30')]!==_0xc701('0x3f')){var _0xa82853={};_0xa82853[_0x57b5f7['name']]={'$like':'%'+_0x2568f1[_0xc701('0x33')][_0xc701('0x3e')]+'%'};return _0xa82853;}})});}_0x3e4bcf=_['merge']({},_0x3e4bcf,_0x2568f1[_0xc701('0x40')]);var _0x3287b0={'where':_0x3e4bcf[_0xc701('0x3b')]};return db[_0xc701('0x2d')][_0xc701('0x21')](_0x3287b0)[_0xc701('0x27')](function(_0x58a175){_0x2110f7['count']=_0x58a175;if(_0x2568f1['query'][_0xc701('0x41')]){_0x3e4bcf[_0xc701('0x42')]=[{'all':!![]}];}return db[_0xc701('0x2d')][_0xc701('0x43')](_0x3e4bcf);})[_0xc701('0x27')](function(_0x364ccd){_0x2110f7[_0xc701('0x44')]=_0x364ccd;return _0x2110f7;})['then'](respondWithFilteredResult(_0x50dbdf,_0x3e4bcf))[_0xc701('0x45')](handleError(_0x50dbdf,null));};exports[_0xc701('0x46')]=function(_0x642e86,_0x1f363d){var _0x3ebf67={'raw':!![],'where':{'id':_0x642e86['params']['id']}},_0x12eb36={};_0x12eb36['model']=_[_0xc701('0x32')](db[_0xc701('0x2d')][_0xc701('0x2e')]);_0x12eb36[_0xc701('0x33')]=_['keys'](_0x642e86['query']);_0x12eb36[_0xc701('0x3c')]=_['intersection'](_0x12eb36[_0xc701('0x35')],_0x12eb36[_0xc701('0x33')]);_0x3ebf67['attributes']=_[_0xc701('0x34')](_0x12eb36['model'],qs[_0xc701('0x37')](_0x642e86[_0xc701('0x33')][_0xc701('0x37')]));_0x3ebf67[_0xc701('0x36')]=_0x3ebf67[_0xc701('0x36')][_0xc701('0x47')]?_0x3ebf67['attributes']:_0x12eb36['model'];if(_0x642e86[_0xc701('0x33')][_0xc701('0x41')]){_0x3ebf67[_0xc701('0x42')]=[{'all':!![]}];}_0x3ebf67=_['merge']({},_0x3ebf67,_0x642e86['options']);return db[_0xc701('0x2d')]['find'](_0x3ebf67)[_0xc701('0x27')](handleEntityNotFound(_0x1f363d,null))[_0xc701('0x27')](respondWithResult(_0x1f363d,null))[_0xc701('0x45')](handleError(_0x1f363d,null));};exports[_0xc701('0x48')]=function(_0x2448d4,_0x4f4151){return db[_0xc701('0x2d')]['create'](_0x2448d4[_0xc701('0x49')],{})[_0xc701('0x27')](respondWithResult(_0x4f4151,0xc9))['catch'](handleError(_0x4f4151,null));};exports[_0xc701('0x4a')]=function(_0x3ed6b5,_0x4cba33){if(_0x3ed6b5[_0xc701('0x49')]['id']){delete _0x3ed6b5[_0xc701('0x49')]['id'];}return db[_0xc701('0x2d')][_0xc701('0x4b')]({'where':{'id':_0x3ed6b5[_0xc701('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4cba33,null))[_0xc701('0x27')](saveUpdates(_0x3ed6b5['body'],null))['then'](respondWithResult(_0x4cba33,null))['catch'](handleError(_0x4cba33,null));};exports[_0xc701('0x28')]=function(_0x35abfc,_0x4e149c){return db['CloudProvider'][_0xc701('0x4b')]({'where':{'id':_0x35abfc[_0xc701('0x4c')]['id']}})[_0xc701('0x27')](handleEntityNotFound(_0x4e149c,null))[_0xc701('0x27')](removeEntity(_0x4e149c,null))['catch'](handleError(_0x4e149c,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3cf4bf1..49409b1 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 _0x3670=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x33caa4,_0x32a082){var _0x2a7e75=function(_0x1cc036){while(--_0x1cc036){_0x33caa4['push'](_0x33caa4['shift']());}};_0x2a7e75(++_0x32a082);}(_0x3670,0xcc));var _0x0367=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3670[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0367('0x0'));var util=require(_0x0367('0x1'));var logger=require(_0x0367('0x2'))('api');var moment=require(_0x0367('0x3'));var BPromise=require(_0x0367('0x4'));var rp=require(_0x0367('0x5'));var fs=require('fs');var path=require(_0x0367('0x6'));var rimraf=require(_0x0367('0x7'));var config=require(_0x0367('0x8'));var attributes=require(_0x0367('0x9'));module[_0x0367('0xa')]=function(_0x4f61ab,_0x538512){return _0x4f61ab[_0x0367('0xb')](_0x0367('0xc'),attributes,{'tableName':_0x0367('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fe6=['moment','request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger'];(function(_0x56bfd4,_0x4bcb55){var _0x96cf4f=function(_0x52e714){while(--_0x52e714){_0x56bfd4['push'](_0x56bfd4['shift']());}};_0x96cf4f(++_0x4bcb55);}(_0x0fe6,0x1b9));var _0x60fe=function(_0x1ce505,_0x5d51ab){_0x1ce505=_0x1ce505-0x0;var _0x17dc97=_0x0fe6[_0x1ce505];return _0x17dc97;};'use strict';var _=require(_0x60fe('0x0'));var util=require(_0x60fe('0x1'));var logger=require(_0x60fe('0x2'))('api');var moment=require(_0x60fe('0x3'));var BPromise=require('bluebird');var rp=require(_0x60fe('0x4'));var fs=require('fs');var path=require(_0x60fe('0x5'));var rimraf=require(_0x60fe('0x6'));var config=require(_0x60fe('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x60fe('0x8')]=function(_0x5dd3e,_0x35b510){return _0x5dd3e[_0x60fe('0x9')](_0x60fe('0xa'),attributes,{'tableName':_0x60fe('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 b916d54..85b9a74 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 _0x8911=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x413562,_0x54a96d){var _0x59565c=function(_0x396616){while(--_0x396616){_0x413562['push'](_0x413562['shift']());}};_0x59565c(++_0x54a96d);}(_0x8911,0xf6));var _0x1891=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8911[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1891('0x0'));var util=require(_0x1891('0x1'));var moment=require(_0x1891('0x2'));var BPromise=require(_0x1891('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1891('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1891('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1891('0x6'));var jayson=require(_0x1891('0x7'));var client=jayson[_0x1891('0x8')][_0x1891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21155b,_0x121eca,_0x325313){return new BPromise(function(_0x13d0b8,_0x3af78a){return client[_0x1891('0xa')](_0x21155b,_0x325313)[_0x1891('0xb')](function(_0x4515ad){logger[_0x1891('0xc')]('CloudProvider,\x20%s,\x20%s',_0x121eca,_0x1891('0xd'));logger[_0x1891('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x121eca,_0x1891('0xd'),JSON[_0x1891('0xf')](_0x4515ad));if(_0x4515ad['error']){if(_0x4515ad[_0x1891('0x10')]['code']===0x1f4){logger[_0x1891('0x10')](_0x1891('0x11'),_0x121eca,_0x4515ad[_0x1891('0x10')][_0x1891('0x12')]);return _0x3af78a(_0x4515ad[_0x1891('0x10')][_0x1891('0x12')]);}logger[_0x1891('0x10')](_0x1891('0x11'),_0x121eca,_0x4515ad['error'][_0x1891('0x12')]);return _0x13d0b8(_0x4515ad[_0x1891('0x10')][_0x1891('0x12')]);}else{logger[_0x1891('0xc')]('CloudProvider,\x20%s,\x20%s',_0x121eca,'request\x20sent');_0x13d0b8(_0x4515ad[_0x1891('0x13')][_0x1891('0x12')]);}})[_0x1891('0x14')](function(_0x457489){logger[_0x1891('0x10')](_0x1891('0x11'),_0x121eca,_0x457489);_0x3af78a(_0x457489);});});} \ No newline at end of file +var _0x83b9=['result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x27488f,_0x58085d){var _0x3a0d9d=function(_0x4e62a8){while(--_0x4e62a8){_0x27488f['push'](_0x27488f['shift']());}};_0x3a0d9d(++_0x58085d);}(_0x83b9,0x152));var _0x983b=function(_0x3ad93e,_0x2888b7){_0x3ad93e=_0x3ad93e-0x0;var _0xac1b20=_0x83b9[_0x3ad93e];return _0xac1b20;};'use strict';var _=require(_0x983b('0x0'));var util=require('util');var moment=require(_0x983b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x983b('0x2'));var db=require(_0x983b('0x3'))['db'];var utils=require(_0x983b('0x4'));var logger=require(_0x983b('0x5'))(_0x983b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x983b('0x7')][_0x983b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x346043,_0x25baae,_0x3044c6){return new BPromise(function(_0x402797,_0xf0e4e4){return client[_0x983b('0x9')](_0x346043,_0x3044c6)['then'](function(_0x225130){logger[_0x983b('0xa')](_0x983b('0xb'),_0x25baae,_0x983b('0xc'));logger[_0x983b('0xd')](_0x983b('0xe'),_0x25baae,_0x983b('0xc'),JSON[_0x983b('0xf')](_0x225130));if(_0x225130[_0x983b('0x10')]){if(_0x225130[_0x983b('0x10')][_0x983b('0x11')]===0x1f4){logger[_0x983b('0x10')]('CloudProvider,\x20%s,\x20%s',_0x25baae,_0x225130[_0x983b('0x10')][_0x983b('0x12')]);return _0xf0e4e4(_0x225130[_0x983b('0x10')][_0x983b('0x12')]);}logger[_0x983b('0x10')](_0x983b('0xb'),_0x25baae,_0x225130['error'][_0x983b('0x12')]);return _0x402797(_0x225130[_0x983b('0x10')][_0x983b('0x12')]);}else{logger[_0x983b('0xa')](_0x983b('0xb'),_0x25baae,'request\x20sent');_0x402797(_0x225130[_0x983b('0x13')][_0x983b('0x12')]);}})[_0x983b('0x14')](function(_0x570f48){logger[_0x983b('0x10')](_0x983b('0xb'),_0x25baae,_0x570f48);_0xf0e4e4(_0x570f48);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c578efe..9f15736 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 _0xfbe4=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','post','create','/:id','update','delete','exports'];(function(_0x2962e4,_0xc25e04){var _0x38a4a9=function(_0x5b0570){while(--_0x5b0570){_0x2962e4['push'](_0x2962e4['shift']());}};_0x38a4a9(++_0xc25e04);}(_0xfbe4,0xdd));var _0x4fbe=function(_0x3f6f0f,_0xa4c916){_0x3f6f0f=_0x3f6f0f-0x0;var _0x47a325=_0xfbe4[_0x3f6f0f];return _0x47a325;};'use strict';var multer=require(_0x4fbe('0x0'));var util=require(_0x4fbe('0x1'));var path=require(_0x4fbe('0x2'));var timeout=require(_0x4fbe('0x3'));var express=require(_0x4fbe('0x4'));var router=express[_0x4fbe('0x5')]();var fs_extra=require(_0x4fbe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4fbe('0x7'));var config=require(_0x4fbe('0x8'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0x4fbe('0x9')](),controller[_0x4fbe('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4fbe('0xb')]('/',auth['isAuthenticated'](),controller[_0x4fbe('0xc')]);router['put'](_0x4fbe('0xd'),auth[_0x4fbe('0x9')](),controller[_0x4fbe('0xe')]);router[_0x4fbe('0xf')](_0x4fbe('0xd'),auth[_0x4fbe('0x9')](),controller['destroy']);module[_0x4fbe('0x10')]=router; \ No newline at end of file +var _0x4f03=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','isAuthenticated','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x17488b,_0x821a97){var _0x25f09d=function(_0x329e5){while(--_0x329e5){_0x17488b['push'](_0x17488b['shift']());}};_0x25f09d(++_0x821a97);}(_0x4f03,0xb9));var _0x34f0=function(_0x4dba2b,_0x4f2f25){_0x4dba2b=_0x4dba2b-0x0;var _0x4a3f5c=_0x4f03[_0x4dba2b];return _0x4a3f5c;};'use strict';var multer=require('multer');var util=require(_0x34f0('0x0'));var path=require(_0x34f0('0x1'));var timeout=require(_0x34f0('0x2'));var express=require(_0x34f0('0x3'));var router=express['Router']();var fs_extra=require(_0x34f0('0x4'));var auth=require(_0x34f0('0x5'));var interaction=require(_0x34f0('0x6'));var config=require(_0x34f0('0x7'));var controller=require(_0x34f0('0x8'));router[_0x34f0('0x9')]('/',auth['isAuthenticated'](),controller[_0x34f0('0xa')]);router[_0x34f0('0x9')]('/:id',auth[_0x34f0('0xb')](),controller['show']);router[_0x34f0('0xc')]('/',auth[_0x34f0('0xb')](),controller[_0x34f0('0xd')]);router[_0x34f0('0xe')](_0x34f0('0xf'),auth[_0x34f0('0xb')](),controller['update']);router[_0x34f0('0x10')](_0x34f0('0xf'),auth[_0x34f0('0xb')](),controller[_0x34f0('0x11')]);module[_0x34f0('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 2ab145f..4b5c78a 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 _0x2faa=['name','sequelize','exports','STRING'];(function(_0x9fc76c,_0x1daf20){var _0xcd6ded=function(_0x374343){while(--_0x374343){_0x9fc76c['push'](_0x9fc76c['shift']());}};_0xcd6ded(++_0x1daf20);}(_0x2faa,0x115));var _0xa2fa=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2faa[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa2fa('0x0'));module[_0xa2fa('0x1')]={'name':{'type':Sequelize[_0xa2fa('0x2')],'unique':_0xa2fa('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xa2fa('0x2')]},'website':{'type':Sequelize[_0xa2fa('0x2')]},'phone':{'type':Sequelize[_0xa2fa('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa2fa('0x2')]},'postalCode':{'type':Sequelize[_0xa2fa('0x2')]},'city':{'type':Sequelize[_0xa2fa('0x2')]},'country':{'type':Sequelize[_0xa2fa('0x2')]},'email':{'type':Sequelize[_0xa2fa('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa2fa('0x2')]},'sStreet':{'type':Sequelize[_0xa2fa('0x2')]},'sPostalCode':{'type':Sequelize[_0xa2fa('0x2')]},'sCity':{'type':Sequelize[_0xa2fa('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa2fa('0x2')]}}; \ No newline at end of file +var _0xad29=['STRING','exports','name'];(function(_0x411d1b,_0xb6111b){var _0xbc6419=function(_0x135c26){while(--_0x135c26){_0x411d1b['push'](_0x411d1b['shift']());}};_0xbc6419(++_0xb6111b);}(_0xad29,0x133));var _0x9ad2=function(_0x175a46,_0x467177){_0x175a46=_0x175a46-0x0;var _0x4050a7=_0xad29[_0x175a46];return _0x4050a7;};'use strict';var Sequelize=require('sequelize');module[_0x9ad2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9ad2('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9ad2('0x2')]},'companyId':{'type':Sequelize[_0x9ad2('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9ad2('0x2')]},'fax':{'type':Sequelize[_0x9ad2('0x2')]},'type':{'type':Sequelize[_0x9ad2('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9ad2('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9ad2('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9ad2('0x2')]},'sStreet':{'type':Sequelize[_0x9ad2('0x2')]},'sPostalCode':{'type':Sequelize[_0x9ad2('0x2')]},'sCity':{'type':Sequelize[_0x9ad2('0x2')]},'sCountry':{'type':Sequelize[_0x9ad2('0x2')]},'description':{'type':Sequelize[_0x9ad2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a29ba7f..372b7b7 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 _0x5f66=['nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','Companies','UserProfileResource','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','fields','hasOwnProperty','where','pick','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addContacts','CmContact','ids','getContacts','order','sort'];(function(_0x49ddc0,_0x39c3b5){var _0x3f5302=function(_0x580734){while(--_0x580734){_0x49ddc0['push'](_0x49ddc0['shift']());}};_0x3f5302(++_0x39c3b5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){var _0x2774a1=_0x1eeaaa['get']({'plain':!![]});var _0x9d7bb0=_0x65f6('0x22');return db[_0x65f6('0x23')]['destroy']({'where':{'type':_0x9d7bb0,'resourceId':_0x2774a1['id']}})['then'](function(){return _0x1eeaaa;});})['then'](function(){_0xd173f4[_0x65f6('0x15')](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0x4b2292,_0x296cd9){return function(_0x28f710){if(!_0x28f710){_0x4b2292['sendStatus'](0x194);}return _0x28f710;};}function handleError(_0x325cb4,_0x2bff2b){_0x2bff2b=_0x2bff2b||0x1f4;return function(_0x28d0df){logger['error'](_0x28d0df['stack']);if(_0x28d0df['name']){delete _0x28d0df[_0x65f6('0x24')];}_0x325cb4[_0x65f6('0x15')](_0x2bff2b)[_0x65f6('0x25')](_0x28d0df);};}exports[_0x65f6('0x26')]=function(_0x518cac,_0x14a387){var _0x144e55={},_0x4ace4c={},_0x4ea23d={'count':0x0,'rows':[]};return db[_0x65f6('0x27')][_0x65f6('0x28')]()['then'](function(_0x4e50c0){_0x4ace4c[_0x65f6('0x29')]=_[_0x65f6('0x2a')](_0x4e50c0);_0x4ace4c[_0x65f6('0x2b')]=_[_0x65f6('0x2a')](_0x518cac[_0x65f6('0x2b')]);_0x4ace4c[_0x65f6('0x2c')]=_['intersection'](_0x4ace4c[_0x65f6('0x29')],_0x4ace4c[_0x65f6('0x2b')]);_0x144e55[_0x65f6('0x2d')]=_['intersection'](_0x4ace4c[_0x65f6('0x29')],qs[_0x65f6('0x2e')](_0x518cac[_0x65f6('0x2b')][_0x65f6('0x2e')]));_0x144e55[_0x65f6('0x2d')]=_0x144e55[_0x65f6('0x2d')]['length']?_0x144e55[_0x65f6('0x2d')]:_0x4ace4c[_0x65f6('0x29')];if(!_0x518cac['query'][_0x65f6('0x2f')]('nolimit')){_0x144e55[_0x65f6('0x19')]=qs['limit'](_0x518cac[_0x65f6('0x2b')][_0x65f6('0x19')]);_0x144e55['offset']=qs[_0x65f6('0x1b')](_0x518cac[_0x65f6('0x2b')][_0x65f6('0x1b')]);}_0x144e55['order']=qs['sort'](_0x518cac[_0x65f6('0x2b')]['sort']);_0x144e55[_0x65f6('0x30')]=qs['filters'](_[_0x65f6('0x31')](_0x518cac[_0x65f6('0x2b')],_0x4ace4c['filters']),_0x4e50c0);if(_0x518cac[_0x65f6('0x2b')]['filter']){_0x144e55['where']=_[_0x65f6('0x32')](_0x144e55[_0x65f6('0x30')],{'$or':_[_0x65f6('0x33')](_0x144e55[_0x65f6('0x2d')],function(_0xbe54fe){var _0x28845a={};_0x28845a[_0xbe54fe]={'$like':'%'+_0x518cac[_0x65f6('0x2b')][_0x65f6('0x34')]+'%'};return _0x28845a;})});}_0x144e55=_['merge']({},_0x144e55,_0x518cac[_0x65f6('0x35')]);var _0x49d8ee={'where':_0x144e55[_0x65f6('0x30')]};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x49d8ee)[_0x65f6('0x21')](function(_0x5ef5c2){_0x4ea23d[_0x65f6('0x1a')]=_0x5ef5c2;if(_0x518cac[_0x65f6('0x2b')][_0x65f6('0x36')]){_0x144e55[_0x65f6('0x37')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x38')](_0x144e55);})[_0x65f6('0x21')](function(_0x2acca5){_0x4ea23d[_0x65f6('0x39')]=_0x2acca5;return _0x4ea23d;})['then'](respondWithFilteredResult(_0x14a387,_0x144e55))[_0x65f6('0x3a')](handleError(_0x14a387,null));})[_0x65f6('0x3a')](handleError(_0x14a387,null));};exports[_0x65f6('0x3b')]=function(_0x181798,_0x83e2d9){var _0x1ac040={'raw':![],'where':{'id':_0x181798[_0x65f6('0x3c')]['id']}},_0xe0b72d={};_0xe0b72d[_0x65f6('0x29')]=_[_0x65f6('0x2a')](db[_0x65f6('0x27')][_0x65f6('0x3d')]);_0xe0b72d[_0x65f6('0x2b')]=_[_0x65f6('0x2a')](_0x181798[_0x65f6('0x2b')]);_0xe0b72d[_0x65f6('0x2c')]=_['intersection'](_0xe0b72d[_0x65f6('0x29')],_0xe0b72d[_0x65f6('0x2b')]);_0x1ac040[_0x65f6('0x2d')]=_[_0x65f6('0x3e')](_0xe0b72d['model'],qs[_0x65f6('0x2e')](_0x181798[_0x65f6('0x2b')][_0x65f6('0x2e')]));_0x1ac040['attributes']=_0x1ac040[_0x65f6('0x2d')][_0x65f6('0x3f')]?_0x1ac040[_0x65f6('0x2d')]:_0xe0b72d[_0x65f6('0x29')];if(_0x181798['query'][_0x65f6('0x36')]){_0x1ac040['include']=[{'all':!![]}];}_0x1ac040=_[_0x65f6('0x32')]({},_0x1ac040,_0x181798[_0x65f6('0x35')]);return db['CmCompany'][_0x65f6('0x40')](_0x1ac040)['then'](handleEntityNotFound(_0x83e2d9,null))[_0x65f6('0x21')](respondWithResult(_0x83e2d9,null))[_0x65f6('0x3a')](handleError(_0x83e2d9,null));};exports[_0x65f6('0x41')]=function(_0xc0db01,_0x3ec18f){return db[_0x65f6('0x27')]['create'](_0xc0db01['body'],{})[_0x65f6('0x21')](function(_0x15d3ba){var _0x3b647a=_0xc0db01[_0x65f6('0x42')][_0x65f6('0x43')]({'plain':!![]});if(!_0x3b647a)throw new Error(_0x65f6('0x44'));if(_0x3b647a[_0x65f6('0x45')]===_0x65f6('0x42')){var _0x414f49=_0x15d3ba['get']({'plain':!![]});var _0x1f16cf=_0x65f6('0x22');return db[_0x65f6('0x46')]['find']({'where':{'name':_0x1f16cf,'userProfileId':_0x3b647a[_0x65f6('0x47')]},'raw':!![]})[_0x65f6('0x21')](function(_0x49ba5a){if(_0x49ba5a&&_0x49ba5a[_0x65f6('0x48')]===0x0){return db[_0x65f6('0x23')]['create']({'name':_0x414f49[_0x65f6('0x24')],'resourceId':_0x414f49['id'],'type':_0x49ba5a['name'],'sectionId':_0x49ba5a['id']},{})[_0x65f6('0x21')](function(){return _0x15d3ba;});}else{return _0x15d3ba;}})[_0x65f6('0x3a')](function(_0x1ca67e){logger['error'](_0x65f6('0x49'),_0x1ca67e);throw _0x1ca67e;});}return _0x15d3ba;})[_0x65f6('0x21')](respondWithResult(_0x3ec18f,0xc9))['catch'](handleError(_0x3ec18f,null));};exports[_0x65f6('0x4a')]=function(_0x34312c,_0x48a2ed){if(_0x34312c[_0x65f6('0x4b')]['id']){delete _0x34312c[_0x65f6('0x4b')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x34312c[_0x65f6('0x3c')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x48a2ed,null))[_0x65f6('0x21')](saveUpdates(_0x34312c[_0x65f6('0x4b')],null))['then'](respondWithResult(_0x48a2ed,null))['catch'](handleError(_0x48a2ed,null));};exports['destroy']=function(_0x19f40c,_0x2091f1){return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x19f40c['params']['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x2091f1,null))[_0x65f6('0x21')](removeEntity(_0x2091f1,null))[_0x65f6('0x3a')](handleError(_0x2091f1,null));};exports['describe']=function(_0x19c5fa,_0x2eb08f){return db[_0x65f6('0x27')]['describe']()['then'](respondWithResult(_0x2eb08f,null))[_0x65f6('0x3a')](handleError(_0x2eb08f,null));};exports[_0x65f6('0x4c')]=function(_0x4125cb,_0x39364f,_0x2a76b3){return db[_0x65f6('0x4d')][_0x65f6('0x40')]({'where':{'id':_0x4125cb[_0x65f6('0x3c')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x39364f,null))[_0x65f6('0x21')](function(_0xa7eee9){if(_0xa7eee9){return _0xa7eee9[_0x65f6('0x4c')](_0x4125cb[_0x65f6('0x4b')][_0x65f6('0x4e')],_['omit'](_0x4125cb[_0x65f6('0x4b')],[_0x65f6('0x4e'),'id'])||{});}})[_0x65f6('0x21')](respondWithResult(_0x39364f,null))['catch'](handleError(_0x39364f,null));};exports[_0x65f6('0x4f')]=function(_0x16dec0,_0x4638c9,_0x3096b8){var _0x4ef333={};var _0x12a5c9={};var _0x4227f5;var _0xe5fc65;return db[_0x65f6('0x27')]['findOne']({'where':{'id':_0x16dec0[_0x65f6('0x3c')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x4638c9,null))['then'](function(_0x28682b){if(_0x28682b){_0x4227f5=_0x28682b;_0x12a5c9[_0x65f6('0x29')]=_[_0x65f6('0x2a')](db['CmContact'][_0x65f6('0x3d')]);_0x12a5c9[_0x65f6('0x2b')]=_[_0x65f6('0x2a')](_0x16dec0[_0x65f6('0x2b')]);_0x12a5c9[_0x65f6('0x2c')]=_[_0x65f6('0x3e')](_0x12a5c9['model'],_0x12a5c9['query']);_0x4ef333['attributes']=_[_0x65f6('0x3e')](_0x12a5c9[_0x65f6('0x29')],qs[_0x65f6('0x2e')](_0x16dec0[_0x65f6('0x2b')][_0x65f6('0x2e')]));_0x4ef333[_0x65f6('0x2d')]=_0x4ef333['attributes'][_0x65f6('0x3f')]?_0x4ef333[_0x65f6('0x2d')]:_0x12a5c9['model'];_0x4ef333[_0x65f6('0x50')]=qs[_0x65f6('0x51')](_0x16dec0[_0x65f6('0x2b')]['sort']);_0x4ef333[_0x65f6('0x30')]=qs[_0x65f6('0x2c')](_['pick'](_0x16dec0[_0x65f6('0x2b')],_0x12a5c9[_0x65f6('0x2c')]));if(_0x16dec0[_0x65f6('0x2b')][_0x65f6('0x34')]){_0x4ef333[_0x65f6('0x30')]=_[_0x65f6('0x32')](_0x4ef333[_0x65f6('0x30')],{'$or':_['map'](_0x4ef333['attributes'],function(_0x3eb33e){var _0x3da139={};_0x3da139[_0x3eb33e]={'$like':'%'+_0x16dec0['query'][_0x65f6('0x34')]+'%'};return _0x3da139;})});}_0x4ef333=_['merge']({},_0x4ef333,_0x16dec0[_0x65f6('0x35')]);return _0x4227f5['getContacts'](_0x4ef333);}})[_0x65f6('0x21')](function(_0xdc8989){if(_0xdc8989){_0xe5fc65=_0xdc8989[_0x65f6('0x3f')];if(!_0x16dec0[_0x65f6('0x2b')][_0x65f6('0x2f')](_0x65f6('0x52'))){_0x4ef333[_0x65f6('0x19')]=qs[_0x65f6('0x19')](_0x16dec0[_0x65f6('0x2b')]['limit']);_0x4ef333['offset']=qs[_0x65f6('0x1b')](_0x16dec0[_0x65f6('0x2b')][_0x65f6('0x1b')]);}return _0x4227f5['getContacts'](_0x4ef333);}})['then'](function(_0x2dbec2){if(_0x2dbec2){return _0x2dbec2?{'count':_0xe5fc65,'rows':_0x2dbec2}:null;}})[_0x65f6('0x21')](respondWithResult(_0x4638c9,null))[_0x65f6('0x3a')](handleError(_0x4638c9,null));}; \ No newline at end of file +var _0x757a=['../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','get','Companies','UserProfileResource','destroy','end','error','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','addContacts','CmContact','omit','ids','getContacts','findOne','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x142ce8,_0x2b9e70){var _0x4f21f2=function(_0x24d840){while(--_0x24d840){_0x142ce8['push'](_0x142ce8['shift']());}};_0x4f21f2(++_0x2b9e70);}(_0x757a,0xde));var _0xa757=function(_0x228ac3,_0x445864){_0x228ac3=_0x228ac3-0x0;var _0xc5ffc2=_0x757a[_0x228ac3];return _0xc5ffc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){var _0x59e9d4=_0x2bf276[_0xa757('0x1f')]({'plain':!![]});var _0x47903b=_0xa757('0x20');return db[_0xa757('0x21')][_0xa757('0x22')]({'where':{'type':_0x47903b,'resourceId':_0x59e9d4['id']}})['then'](function(){return _0x2bf276;});})[_0xa757('0x1e')](function(){_0x2ca10d[_0xa757('0x15')](0xcc)[_0xa757('0x23')]();});}};}function handleEntityNotFound(_0x3bf7f3,_0x5b4779){return function(_0x449a7d){if(!_0x449a7d){_0x3bf7f3['sendStatus'](0x194);}return _0x449a7d;};}function handleError(_0x5a5664,_0x54b75e){_0x54b75e=_0x54b75e||0x1f4;return function(_0x4f8de2){logger[_0xa757('0x24')](_0x4f8de2['stack']);if(_0x4f8de2[_0xa757('0x25')]){delete _0x4f8de2[_0xa757('0x25')];}_0x5a5664['status'](_0x54b75e)[_0xa757('0x26')](_0x4f8de2);};}exports['index']=function(_0x2c4823,_0xa6d0f6){var _0x5307c3={},_0x235e54={},_0x5ade7b={'count':0x0,'rows':[]};return db[_0xa757('0x27')][_0xa757('0x28')]()[_0xa757('0x1e')](function(_0x300dc4){_0x235e54[_0xa757('0x29')]=_[_0xa757('0x2a')](_0x300dc4);_0x235e54[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x2c4823[_0xa757('0x2b')]);_0x235e54[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x235e54[_0xa757('0x29')],_0x235e54[_0xa757('0x2b')]);_0x5307c3[_0xa757('0x2e')]=_[_0xa757('0x2d')](_0x235e54[_0xa757('0x29')],qs[_0xa757('0x2f')](_0x2c4823[_0xa757('0x2b')][_0xa757('0x2f')]));_0x5307c3[_0xa757('0x2e')]=_0x5307c3[_0xa757('0x2e')][_0xa757('0x30')]?_0x5307c3[_0xa757('0x2e')]:_0x235e54[_0xa757('0x29')];if(!_0x2c4823['query'][_0xa757('0x31')](_0xa757('0x32'))){_0x5307c3[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x2c4823[_0xa757('0x2b')]['limit']);_0x5307c3[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x2c4823[_0xa757('0x2b')][_0xa757('0x17')]);}_0x5307c3[_0xa757('0x33')]=qs[_0xa757('0x34')](_0x2c4823['query'][_0xa757('0x34')]);_0x5307c3[_0xa757('0x35')]=qs[_0xa757('0x2c')](_[_0xa757('0x36')](_0x2c4823[_0xa757('0x2b')],_0x235e54[_0xa757('0x2c')]),_0x300dc4);if(_0x2c4823[_0xa757('0x2b')][_0xa757('0x37')]){_0x5307c3[_0xa757('0x35')]=_['merge'](_0x5307c3[_0xa757('0x35')],{'$or':_[_0xa757('0x38')](_0x5307c3[_0xa757('0x2e')],function(_0x35c15a){var _0x2531be={};_0x2531be[_0x35c15a]={'$like':'%'+_0x2c4823[_0xa757('0x2b')]['filter']+'%'};return _0x2531be;})});}_0x5307c3=_[_0xa757('0x39')]({},_0x5307c3,_0x2c4823[_0xa757('0x3a')]);var _0x48cde9={'where':_0x5307c3['where']};return db[_0xa757('0x27')][_0xa757('0x19')](_0x48cde9)['then'](function(_0x51c3d1){_0x5ade7b[_0xa757('0x19')]=_0x51c3d1;if(_0x2c4823[_0xa757('0x2b')][_0xa757('0x3b')]){_0x5307c3['include']=[{'all':!![]}];}return db[_0xa757('0x27')][_0xa757('0x3c')](_0x5307c3);})[_0xa757('0x1e')](function(_0x1ba399){_0x5ade7b[_0xa757('0x3d')]=_0x1ba399;return _0x5ade7b;})['then'](respondWithFilteredResult(_0xa6d0f6,_0x5307c3))[_0xa757('0x3e')](handleError(_0xa6d0f6,null));})['catch'](handleError(_0xa6d0f6,null));};exports['show']=function(_0x43329c,_0x57298b){var _0x373747={'raw':![],'where':{'id':_0x43329c[_0xa757('0x3f')]['id']}},_0x626b1f={};_0x626b1f['model']=_['keys'](db[_0xa757('0x27')][_0xa757('0x40')]);_0x626b1f[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x43329c[_0xa757('0x2b')]);_0x626b1f[_0xa757('0x2c')]=_['intersection'](_0x626b1f[_0xa757('0x29')],_0x626b1f[_0xa757('0x2b')]);_0x373747['attributes']=_[_0xa757('0x2d')](_0x626b1f['model'],qs[_0xa757('0x2f')](_0x43329c[_0xa757('0x2b')]['fields']));_0x373747[_0xa757('0x2e')]=_0x373747[_0xa757('0x2e')]['length']?_0x373747[_0xa757('0x2e')]:_0x626b1f[_0xa757('0x29')];if(_0x43329c[_0xa757('0x2b')][_0xa757('0x3b')]){_0x373747['include']=[{'all':!![]}];}_0x373747=_[_0xa757('0x39')]({},_0x373747,_0x43329c[_0xa757('0x3a')]);return db[_0xa757('0x27')][_0xa757('0x41')](_0x373747)['then'](handleEntityNotFound(_0x57298b,null))[_0xa757('0x1e')](respondWithResult(_0x57298b,null))['catch'](handleError(_0x57298b,null));};exports['create']=function(_0x2acf88,_0x3c039d){return db[_0xa757('0x27')]['create'](_0x2acf88[_0xa757('0x42')],{})['then'](function(_0x2ed63f){var _0x151cc3=_0x2acf88[_0xa757('0x43')][_0xa757('0x1f')]({'plain':!![]});if(!_0x151cc3)throw new Error(_0xa757('0x44'));if(_0x151cc3[_0xa757('0x45')]===_0xa757('0x43')){var _0x505cd=_0x2ed63f['get']({'plain':!![]});var _0x2de226=_0xa757('0x20');return db[_0xa757('0x46')][_0xa757('0x41')]({'where':{'name':_0x2de226,'userProfileId':_0x151cc3[_0xa757('0x47')]},'raw':!![]})[_0xa757('0x1e')](function(_0x15bad7){if(_0x15bad7&&_0x15bad7[_0xa757('0x48')]===0x0){return db[_0xa757('0x21')][_0xa757('0x49')]({'name':_0x505cd[_0xa757('0x25')],'resourceId':_0x505cd['id'],'type':_0x15bad7[_0xa757('0x25')],'sectionId':_0x15bad7['id']},{})[_0xa757('0x1e')](function(){return _0x2ed63f;});}else{return _0x2ed63f;}})[_0xa757('0x3e')](function(_0x388573){logger[_0xa757('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x388573);throw _0x388573;});}return _0x2ed63f;})[_0xa757('0x1e')](respondWithResult(_0x3c039d,0xc9))['catch'](handleError(_0x3c039d,null));};exports[_0xa757('0x1d')]=function(_0x311c25,_0xa89d24){if(_0x311c25[_0xa757('0x42')]['id']){delete _0x311c25['body']['id'];}return db[_0xa757('0x27')][_0xa757('0x41')]({'where':{'id':_0x311c25[_0xa757('0x3f')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0xa89d24,null))['then'](saveUpdates(_0x311c25[_0xa757('0x42')],null))[_0xa757('0x1e')](respondWithResult(_0xa89d24,null))[_0xa757('0x3e')](handleError(_0xa89d24,null));};exports[_0xa757('0x22')]=function(_0x33666d,_0x291b26){return db['CmCompany']['find']({'where':{'id':_0x33666d['params']['id']}})['then'](handleEntityNotFound(_0x291b26,null))[_0xa757('0x1e')](removeEntity(_0x291b26,null))[_0xa757('0x3e')](handleError(_0x291b26,null));};exports[_0xa757('0x28')]=function(_0x32313b,_0x1e31ef){return db[_0xa757('0x27')]['describe']()[_0xa757('0x1e')](respondWithResult(_0x1e31ef,null))[_0xa757('0x3e')](handleError(_0x1e31ef,null));};exports[_0xa757('0x4a')]=function(_0x29b2f5,_0x48b578,_0x26c74e){return db[_0xa757('0x4b')]['find']({'where':{'id':_0x29b2f5[_0xa757('0x3f')]['id']}})['then'](handleEntityNotFound(_0x48b578,null))[_0xa757('0x1e')](function(_0x5d375c){if(_0x5d375c){return _0x5d375c[_0xa757('0x4a')](_0x29b2f5['body']['ids'],_[_0xa757('0x4c')](_0x29b2f5[_0xa757('0x42')],[_0xa757('0x4d'),'id'])||{});}})[_0xa757('0x1e')](respondWithResult(_0x48b578,null))[_0xa757('0x3e')](handleError(_0x48b578,null));};exports[_0xa757('0x4e')]=function(_0x4c19a6,_0x4f0d7b,_0x201557){var _0x3afa56={};var _0x3ca1ef={};var _0x4a5ad5;var _0x55a7d2;return db[_0xa757('0x27')][_0xa757('0x4f')]({'where':{'id':_0x4c19a6[_0xa757('0x3f')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x4f0d7b,null))[_0xa757('0x1e')](function(_0x3e6d40){if(_0x3e6d40){_0x4a5ad5=_0x3e6d40;_0x3ca1ef['model']=_[_0xa757('0x2a')](db[_0xa757('0x4b')][_0xa757('0x40')]);_0x3ca1ef[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x4c19a6[_0xa757('0x2b')]);_0x3ca1ef[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x3ca1ef[_0xa757('0x29')],_0x3ca1ef[_0xa757('0x2b')]);_0x3afa56['attributes']=_[_0xa757('0x2d')](_0x3ca1ef['model'],qs['fields'](_0x4c19a6[_0xa757('0x2b')][_0xa757('0x2f')]));_0x3afa56[_0xa757('0x2e')]=_0x3afa56[_0xa757('0x2e')][_0xa757('0x30')]?_0x3afa56[_0xa757('0x2e')]:_0x3ca1ef[_0xa757('0x29')];_0x3afa56[_0xa757('0x33')]=qs[_0xa757('0x34')](_0x4c19a6[_0xa757('0x2b')][_0xa757('0x34')]);_0x3afa56['where']=qs[_0xa757('0x2c')](_[_0xa757('0x36')](_0x4c19a6['query'],_0x3ca1ef[_0xa757('0x2c')]));if(_0x4c19a6[_0xa757('0x2b')][_0xa757('0x37')]){_0x3afa56[_0xa757('0x35')]=_[_0xa757('0x39')](_0x3afa56[_0xa757('0x35')],{'$or':_['map'](_0x3afa56[_0xa757('0x2e')],function(_0x4ab31d){var _0xee5b78={};_0xee5b78[_0x4ab31d]={'$like':'%'+_0x4c19a6[_0xa757('0x2b')][_0xa757('0x37')]+'%'};return _0xee5b78;})});}_0x3afa56=_[_0xa757('0x39')]({},_0x3afa56,_0x4c19a6[_0xa757('0x3a')]);return _0x4a5ad5['getContacts'](_0x3afa56);}})['then'](function(_0x1c8807){if(_0x1c8807){_0x55a7d2=_0x1c8807[_0xa757('0x30')];if(!_0x4c19a6[_0xa757('0x2b')]['hasOwnProperty'](_0xa757('0x32'))){_0x3afa56['limit']=qs[_0xa757('0x1a')](_0x4c19a6[_0xa757('0x2b')][_0xa757('0x1a')]);_0x3afa56[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x4c19a6[_0xa757('0x2b')]['offset']);}return _0x4a5ad5[_0xa757('0x4e')](_0x3afa56);}})[_0xa757('0x1e')](function(_0x1e15ee){if(_0x1e15ee){return _0x1e15ee?{'count':_0x55a7d2,'rows':_0x1e15ee}:null;}})[_0xa757('0x1e')](respondWithResult(_0x4f0d7b,null))[_0xa757('0x3e')](handleError(_0x4f0d7b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c810a92..3a7d2d1 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 _0xc6ab=['rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','path'];(function(_0x12c0b1,_0x1b5fb8){var _0x10b2ec=function(_0x3ce764){while(--_0x3ce764){_0x12c0b1['push'](_0x12c0b1['shift']());}};_0x10b2ec(++_0x1b5fb8);}(_0xc6ab,0x96));var _0xbc6a=function(_0x229ec8,_0x1b05ef){_0x229ec8=_0x229ec8-0x0;var _0x16ad37=_0xc6ab[_0x229ec8];return _0x16ad37;};'use strict';var _=require(_0xbc6a('0x0'));var util=require(_0xbc6a('0x1'));var logger=require(_0xbc6a('0x2'))(_0xbc6a('0x3'));var moment=require(_0xbc6a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc6a('0x5'));var rimraf=require(_0xbc6a('0x6'));var config=require(_0xbc6a('0x7'));var attributes=require(_0xbc6a('0x8'));module[_0xbc6a('0x9')]=function(_0x4ccd07,_0x45ed96){return _0x4ccd07[_0xbc6a('0xa')](_0xbc6a('0xb'),attributes,{'tableName':_0xbc6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31af=['define','CmCompany','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x4f50f1,_0x5a2cc4){var _0x4f285f=function(_0x93a500){while(--_0x93a500){_0x4f50f1['push'](_0x4f50f1['shift']());}};_0x4f285f(++_0x5a2cc4);}(_0x31af,0xde));var _0xf31a=function(_0x4dfbc3,_0x329ac7){_0x4dfbc3=_0x4dfbc3-0x0;var _0xb17aff=_0x31af[_0x4dfbc3];return _0xb17aff;};'use strict';var _=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var logger=require(_0xf31a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf31a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf31a('0x4'));var rimraf=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var attributes=require(_0xf31a('0x7'));module['exports']=function(_0x8d7853,_0x209fcc){return _0x8d7853[_0xf31a('0x8')](_0xf31a('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index e301d8f..414c09b 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 _0x5077=['info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5077,0x1ba));var _0x7507=function(_0x5c0afc,_0x4308ff){_0x5c0afc=_0x5c0afc-0x0;var _0x1d91bd=_0x5077[_0x5c0afc];return _0x1d91bd;};'use strict';var _=require(_0x7507('0x0'));var util=require(_0x7507('0x1'));var moment=require(_0x7507('0x2'));var BPromise=require(_0x7507('0x3'));var rs=require(_0x7507('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7507('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7507('0x6'))(_0x7507('0x7'));var config=require(_0x7507('0x8'));var jayson=require(_0x7507('0x9'));var client=jayson[_0x7507('0xa')][_0x7507('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50e8c4,_0x16ed91,_0x498746){return new BPromise(function(_0x28d586,_0x504bfa){return client[_0x7507('0xc')](_0x50e8c4,_0x498746)[_0x7507('0xd')](function(_0x41ff8e){logger[_0x7507('0xe')]('CmCompany,\x20%s,\x20%s',_0x16ed91,_0x7507('0xf'));logger[_0x7507('0x10')](_0x7507('0x11'),_0x16ed91,_0x7507('0xf'),JSON[_0x7507('0x12')](_0x41ff8e));if(_0x41ff8e[_0x7507('0x13')]){if(_0x41ff8e[_0x7507('0x13')][_0x7507('0x14')]===0x1f4){logger[_0x7507('0x13')]('CmCompany,\x20%s,\x20%s',_0x16ed91,_0x41ff8e[_0x7507('0x13')]['message']);return _0x504bfa(_0x41ff8e[_0x7507('0x13')][_0x7507('0x15')]);}logger[_0x7507('0x13')](_0x7507('0x16'),_0x16ed91,_0x41ff8e[_0x7507('0x13')]['message']);return _0x28d586(_0x41ff8e[_0x7507('0x13')][_0x7507('0x15')]);}else{logger['info'](_0x7507('0x16'),_0x16ed91,_0x7507('0xf'));_0x28d586(_0x41ff8e['result'][_0x7507('0x15')]);}})[_0x7507('0x17')](function(_0x19676f){logger['error'](_0x7507('0x16'),_0x16ed91,_0x19676f);_0x504bfa(_0x19676f);});});} \ No newline at end of file +var _0x2bfe=['error','code','message','CmCompany,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x19b0cf,_0x1fcd3b){var _0x47b140=function(_0x116469){while(--_0x116469){_0x19b0cf['push'](_0x19b0cf['shift']());}};_0x47b140(++_0x1fcd3b);}(_0x2bfe,0x15c));var _0xe2bf=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2bfe[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0xe2bf('0x0'));var moment=require(_0xe2bf('0x1'));var BPromise=require(_0xe2bf('0x2'));var rs=require(_0xe2bf('0x3'));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('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe2bf('0x4')][_0xe2bf('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x6fd47f,_0x1dd16a,_0xb6ef9){return new BPromise(function(_0x1990dc,_0x4ae48a){return client[_0xe2bf('0x6')](_0x6fd47f,_0xb6ef9)[_0xe2bf('0x7')](function(_0x598f9f){logger[_0xe2bf('0x8')]('CmCompany,\x20%s,\x20%s',_0x1dd16a,_0xe2bf('0x9'));logger[_0xe2bf('0xa')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1dd16a,_0xe2bf('0x9'),JSON[_0xe2bf('0xb')](_0x598f9f));if(_0x598f9f[_0xe2bf('0xc')]){if(_0x598f9f[_0xe2bf('0xc')][_0xe2bf('0xd')]===0x1f4){logger[_0xe2bf('0xc')]('CmCompany,\x20%s,\x20%s',_0x1dd16a,_0x598f9f['error'][_0xe2bf('0xe')]);return _0x4ae48a(_0x598f9f['error'][_0xe2bf('0xe')]);}logger[_0xe2bf('0xc')](_0xe2bf('0xf'),_0x1dd16a,_0x598f9f[_0xe2bf('0xc')][_0xe2bf('0xe')]);return _0x1990dc(_0x598f9f['error'][_0xe2bf('0xe')]);}else{logger[_0xe2bf('0x8')]('CmCompany,\x20%s,\x20%s',_0x1dd16a,'request\x20sent');_0x1990dc(_0x598f9f[_0xe2bf('0x10')][_0xe2bf('0xe')]);}})[_0xe2bf('0x11')](function(_0x5d4029){logger['error'](_0xe2bf('0xf'),_0x1dd16a,_0x5d4029);_0x4ae48a(_0x5d4029);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8837549..7b406f3 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 _0x15f0=['/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated'];(function(_0x5e897d,_0x408f10){var _0x2079d2=function(_0x2ad944){while(--_0x2ad944){_0x5e897d['push'](_0x5e897d['shift']());}};_0x2079d2(++_0x408f10);}(_0x15f0,0x14d));var _0x015f=function(_0x1ba6ee,_0x34a71d){_0x1ba6ee=_0x1ba6ee-0x0;var _0x166117=_0x15f0[_0x1ba6ee];return _0x166117;};'use strict';var multer=require(_0x015f('0x0'));var util=require(_0x015f('0x1'));var path=require(_0x015f('0x2'));var timeout=require('connect-timeout');var express=require(_0x015f('0x3'));var router=express[_0x015f('0x4')]();var fs_extra=require(_0x015f('0x5'));var auth=require(_0x015f('0x6'));var interaction=require(_0x015f('0x7'));var config=require(_0x015f('0x8'));var controller=require(_0x015f('0x9'));router[_0x015f('0xa')]('/',auth[_0x015f('0xb')](),controller['index']);router[_0x015f('0xa')](_0x015f('0xc'),auth[_0x015f('0xb')](),controller[_0x015f('0xd')]);router['get'](_0x015f('0xe'),auth[_0x015f('0xb')](),controller[_0x015f('0xf')]);router[_0x015f('0xa')](_0x015f('0x10'),auth['isAuthenticated'](),controller[_0x015f('0x11')]);router[_0x015f('0x12')]('/',auth['isAuthenticated'](),controller[_0x015f('0x13')]);router['post'](_0x015f('0x10'),auth[_0x015f('0xb')](),controller[_0x015f('0x14')]);router['put'](_0x015f('0xe'),auth['isAuthenticated'](),controller[_0x015f('0x15')]);router['delete'](_0x015f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x015f('0x16')]=router; \ No newline at end of file +var _0x0fc1=['fs-extra','../../config/environment','./cmCompany.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x1f4712,_0x15487f){var _0xe15202=function(_0x2881d5){while(--_0x2881d5){_0x1f4712['push'](_0x1f4712['shift']());}};_0xe15202(++_0x15487f);}(_0x0fc1,0x14b));var _0x10fc=function(_0x9b8f80,_0x266a93){_0x9b8f80=_0x9b8f80-0x0;var _0x518d42=_0x0fc1[_0x9b8f80];return _0x518d42;};'use strict';var multer=require(_0x10fc('0x0'));var util=require(_0x10fc('0x1'));var path=require(_0x10fc('0x2'));var timeout=require(_0x10fc('0x3'));var express=require('express');var router=express[_0x10fc('0x4')]();var fs_extra=require(_0x10fc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x10fc('0x6'));var controller=require(_0x10fc('0x7'));router[_0x10fc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x10fc('0x9'),auth[_0x10fc('0xa')](),controller[_0x10fc('0xb')]);router['get'](_0x10fc('0xc'),auth[_0x10fc('0xa')](),controller[_0x10fc('0xd')]);router[_0x10fc('0x8')](_0x10fc('0xe'),auth['isAuthenticated'](),controller['getContacts']);router[_0x10fc('0xf')]('/',auth['isAuthenticated'](),controller[_0x10fc('0x10')]);router[_0x10fc('0xf')](_0x10fc('0xe'),auth[_0x10fc('0xa')](),controller['addContacts']);router[_0x10fc('0x11')]('/:id',auth[_0x10fc('0xa')](),controller[_0x10fc('0x12')]);router[_0x10fc('0x13')]('/:id',auth[_0x10fc('0xa')](),controller[_0x10fc('0x14')]);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 c49f826..8610cbb 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 _0xccb8=['sequelize','exports','STRING','TEXT','UNSIGNED','DATE','NOW','lodash'];(function(_0x1ee9e3,_0x2dd132){var _0x3138b1=function(_0x9530f8){while(--_0x9530f8){_0x1ee9e3['push'](_0x1ee9e3['shift']());}};_0x3138b1(++_0x2dd132);}(_0xccb8,0x19f));var _0x8ccb=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xccb8[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x8ccb('0x0'));var Sequelize=require(_0x8ccb('0x1'));module[_0x8ccb('0x2')]={'firstName':{'type':Sequelize[_0x8ccb('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8ccb('0x3')]},'postalCode':{'type':Sequelize[_0x8ccb('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8ccb('0x3')]},'dateOfBirth':{'type':Sequelize[_0x8ccb('0x3')]},'description':{'type':Sequelize[_0x8ccb('0x4')]},'phone':{'type':Sequelize[_0x8ccb('0x3')]},'mobile':{'type':Sequelize[_0x8ccb('0x3')]},'fax':{'type':Sequelize[_0x8ccb('0x3')]},'email':{'type':Sequelize[_0x8ccb('0x3')]},'url':{'type':Sequelize[_0x8ccb('0x3')]},'facebook':{'type':Sequelize[_0x8ccb('0x3')]},'fb_data':{'type':Sequelize[_0x8ccb('0x3')]},'twitter':{'type':Sequelize[_0x8ccb('0x3')]},'skype':{'type':Sequelize[_0x8ccb('0x3')]},'teams':{'type':Sequelize[_0x8ccb('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x8ccb('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x8ccb('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x8ccb('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8ccb('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8ccb('0x6')],'defaultValue':Sequelize[_0x8ccb('0x7')]}}; \ No newline at end of file +var _0x9e70=['TEXT','INTEGER','UNSIGNED','sequelize','STRING'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0x9e70,0x111));var _0x09e7=function(_0x69b99a,_0x2e58d2){_0x69b99a=_0x69b99a-0x0;var _0x3bb5a3=_0x9e70[_0x69b99a];return _0x3bb5a3;};'use strict';var _=require('lodash');var Sequelize=require(_0x09e7('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x09e7('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x09e7('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x09e7('0x1')]},'country':{'type':Sequelize[_0x09e7('0x1')]},'dateOfBirth':{'type':Sequelize[_0x09e7('0x1')]},'description':{'type':Sequelize[_0x09e7('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x09e7('0x1')]},'email':{'type':Sequelize[_0x09e7('0x1')]},'url':{'type':Sequelize[_0x09e7('0x1')]},'facebook':{'type':Sequelize[_0x09e7('0x1')]},'fb_data':{'type':Sequelize[_0x09e7('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x09e7('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x09e7('0x1')]},'line':{'type':Sequelize[_0x09e7('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x09e7('0x1')]},'UserId':{'type':Sequelize[_0x09e7('0x3')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x09e7('0x3')](0x2)[_0x09e7('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'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 77f39d6..99d8d58 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 _0xa9e0=['status','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','CmContact','describe','keys','length','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','castTo','DATE','buildExpression','text','start','filter','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','some','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','sequelize','toString','c.firstName','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','rows','find','startsWith','displayName','columnName','custom','catch','body','findAll','get','mergeWith','tags','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','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','Phones','params','ContactItemType','ItemType','literal','`Phones.ItemType`.OrderBy','log','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','values','phone','getTags','rawAttributes','pick','merge','options','setTags','ids','setAdditionalPhones','items','item_types','isNil','ItemTypeId','description','CmHopperAdditionalPhone','item','OrderBy','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','PHONE','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','send','upload','file','parse','json','meta','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','message','mail','chat','sms','fax','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','alias','Website','closed','closedAt','disposition','secondDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','startCase','flatten','sortBy','slice','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register'];(function(_0x26fe78,_0x2d59f3){var _0x2b92f1=function(_0x2bb367){while(--_0x2bb367){_0x26fe78['push'](_0x26fe78['shift']());}};_0x2b92f1(++_0x2d59f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x1a')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x58b06f){var _0x563b45=[];for(var _0x296f41=0x0;_0x296f410x1){_0x10b040['or'](_0x0a9e('0x66'),qs['getFullTextValue'](_0x121cef),null);}else{if(qs[_0x0a9e('0x67')](_0x121cef)){_0x10b040['or']('c.id\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x68'),_0x121cef+'%');_0x10b040['or']('c.mobile\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or']('c.fax\x20LIKE\x20?',_0x121cef+'%');}else if(qs['isEmail'](_0x121cef)){_0x10b040['or'](_0x0a9e('0x69'),_0x121cef+'%');}else{_0x10b040['or']('c.firstName\x20LIKE\x20?','%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x6a'),'%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x69'),'%'+_0x121cef+'%');}}}}_0x23b089[_0x0a9e('0x3e')](_0x10b040);_0x23b089[_0x0a9e('0x6b')](_0x0a9e('0x6c'));var _0x26d7db={'type':db['Sequelize'][_0x0a9e('0x6d')]['SELECT'],'raw':!![]};var _0xca4ade=_0x23b089[_0x0a9e('0x6e')]()[_0x0a9e('0x40')]('c.id');if(_0x2ec755[_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3c')][_0x0a9e('0x53')](function(_0x32e134){_0x23b089['order']('c.'+_0x32e134[0x0],_0x32e134[0x1]===_0x0a9e('0x6f')?![]:!![]);});}if(!_[_0x0a9e('0x5f')](_0x432fcc)){_0x23b089['having'](_0x25c6e6);_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x70'),_0x432fcc);}BPromise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(!_0x35ed4a)return;if(_0x468813[_0x0a9e('0x72')]['role']!==_0x0a9e('0x73'))return;if(!_[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0x4f')],['field',_0x0a9e('0x56')])){return _0x468813['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x23')](function(_0x4556c5){if(_[_0x0a9e('0x5f')](_0x4556c5)){_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x75'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x75'));}else{_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));}});}})[_0x0a9e('0x23')](function(){if(_0x468813[_0x0a9e('0x72')][_0x0a9e('0x77')]===_0x0a9e('0x73')&&!_0x35ed4a&&!_0x468813[_0x0a9e('0x35')]['ListId'])return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0xca4ade[_0x0a9e('0x79')](),_0x26d7db);})['then'](function(_0x1148a1){_0x15b200[_0x0a9e('0x1e')]=_0x1148a1['length'];if(_0x15b200[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x5b4f5e[_0x0a9e('0x79')](),_0x26d7db)[_0x0a9e('0x23')](function(_0x4a43a8){_0x1459bb=_['keyBy'](_0x4a43a8,'id');_0x26d7db=_['merge'](_0x26d7db,{'model':db[_0x0a9e('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468813[_0x0a9e('0x35')][_0x0a9e('0x38')]){_0x2ec755[_0x0a9e('0x39')][_0x0a9e('0x53')](function(_0x380ab3){_0x23b089[_0x0a9e('0x40')]('c.'+_0x380ab3);});}else{_0x23b089[_0x0a9e('0x40')]('c.id');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7a'));_0x23b089[_0x0a9e('0x40')]('c.lastName');_0x23b089[_0x0a9e('0x40')]('c.phone');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7b'));_0x23b089['field'](_0x0a9e('0x7c'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7d'));_0x23b089[_0x0a9e('0x40')]('c.ListId');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7e'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7f'));_0x23b089['field'](_0x0a9e('0x80'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x81'),_0x0a9e('0x82'));}if(_0x2ec755['limit'])_0x23b089[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x1d')]);if(_0x2ec755[_0x0a9e('0x1b')])_0x23b089[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x1b')]);return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x23b089[_0x0a9e('0x79')](),_0x26d7db);});})[_0x0a9e('0x23')](function(_0x336dc3){_0x336dc3[_0x0a9e('0x53')](function(_0x1f10ef){if(_0x1f10ef[_0x0a9e('0x82')]){_0x1f10ef[_0x0a9e('0x83')]=[];_0x1f10ef['TagIds'][_0x0a9e('0x84')](',')[_0x0a9e('0x53')](function(_0xc599b3){_0x1f10ef['Tags'][_0x0a9e('0x2e')](_0x1459bb[_0xc599b3]);});}delete _0x1f10ef[_0x0a9e('0x82')];});_0x15b200[_0x0a9e('0x85')]=_0x336dc3;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755));})['catch'](handleError(_0x2b1f27,null));};exports['destroy']=function(_0x7ebea8,_0x2bbdb5){return db['CmContact'][_0x0a9e('0x86')]({'where':{'id':_0x7ebea8['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x23')](removeEntity(_0x2bbdb5,null))['catch'](handleError(_0x2bbdb5,null));};exports[_0x0a9e('0x2a')]=function(_0x41cf12,_0x2d2286){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x444f1f){delete _0x444f1f['tags'];for(var _0x2973d3=0x0;_0x2973d30x0){return new Promise(function(_0x4a70ce,_0x55f91a){var _0x183244=[];for(var _0x1f78b4=0x0;_0x1f78b4<_0x5c4be0[_0x0a9e('0x2c')];_0x1f78b4++){_0x183244['push'](insertAdditionalPhones(_0x5c4be0[_0x1f78b4][_0x0a9e('0xb6')],_0x5c4be0[_0x1f78b4][_0x0a9e('0xaf')]));}Promise[_0x0a9e('0x32')](_0x183244)[_0x0a9e('0x23')](function(){_0x4a70ce(0x1);});})[_0x0a9e('0x23')](function(){return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};});}else{return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};}}})[_0x0a9e('0x23')](respondWithResult(_0x98c62c,0xc9))[_0x0a9e('0x8b')](handleError(_0x98c62c,null));};exports[_0x0a9e('0xb7')]=function(_0x3b5bda,_0x5a1848,_0x43c397){var _0x5526a7;return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x3cf222){return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x3b5bda['params']['id']},'include':[{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x41')],'required':_0x3b5bda['query'][_0x0a9e('0x64')]?!![]:![]},{'model':db[_0x0a9e('0xa3')],'as':_0x0a9e('0xb8'),'where':{'CmContactId':_0x3b5bda[_0x0a9e('0xb9')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0xba')],'as':_0x0a9e('0xbb')}]}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xbd'))],'logging':console[_0x0a9e('0xbe')],'attributes':_['keys'](_0x3cf222)});})[_0x0a9e('0x23')](function(_0x88b25f){_0x5526a7=_0x88b25f[_0x0a9e('0x8e')]({'plain':!![]});var _0x26b826={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x88b25f&&_0x88b25f[_0x0a9e('0x60')]){if(_0x88b25f[_0x0a9e('0x60')]){_0x26b826[_0x0a9e('0x3e')][_0x0a9e('0xbf')]['push']({'ListId':{'$ne':_0x88b25f[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x26b826);})['then'](function(_0x1402c7){return _[_0x0a9e('0xc0')](_0x5526a7,_[_0x0a9e('0x52')](_0x1402c7,function(_0x97d5b5){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x97d5b5['id']);}));})[_0x0a9e('0x23')](handleEntityNotFound(_0x5a1848,null))[_0x0a9e('0x23')](respondWithResult(_0x5a1848,null))[_0x0a9e('0x8b')](handleError(_0x5a1848,null));};exports[_0x0a9e('0x22')]=function(_0x5a7dad,_0x251753){var _0x446e6;if(_0x5a7dad[_0x0a9e('0x8c')]['id']){delete _0x5a7dad[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x5a7dad['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x251753,null))['then'](saveUpdates(_0x5a7dad['body'],null))['then'](function(_0x19e4e6){_0x446e6=_0x19e4e6;var _0x3fa3f2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19e4e6&&_0x19e4e6[_0x0a9e('0x60')]){if(_0x19e4e6[_0x0a9e('0x60')]){_0x3fa3f2['where'][_0x0a9e('0xbf')][_0x0a9e('0x2e')]({'ListId':{'$ne':_0x19e4e6[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x3fa3f2);})['then'](function(_0x57b1b1){if(_0x57b1b1){return _[_0x0a9e('0xc0')](_[_0x0a9e('0xc3')](_0x5a7dad[_0x0a9e('0x8c')],function(_0x5e85d0,_0x319752){return _[_0x0a9e('0x87')](_0x319752,_0x0a9e('0x2d'));}),_['map'](_0x57b1b1,function(_0x8ad1c0){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x8ad1c0['id']);}));}})['then'](function(_0x272291){if(_0x272291&&!_[_0x0a9e('0x5f')](_0x272291)){var _0x3b7213=squel['update']()['table']('cm_contacts')[_0x0a9e('0xc4')](_0x272291)[_0x0a9e('0x3e')](_0x0a9e('0xc5'),_0x5a7dad[_0x0a9e('0xb9')]['id'])['toParam']();return db[_0x0a9e('0x78')]['query'](_0x3b7213[_0x0a9e('0x5b')],{'replacements':_0x3b7213[_0x0a9e('0xc6')]});}})[_0x0a9e('0x23')](function(){if(_0x5a7dad['body'][_0x0a9e('0xc7')]&&_0x446e6){return db[_0x0a9e('0x94')][_0x0a9e('0x22')]({'phone':_0x5a7dad['body'][_0x0a9e('0xc7')]},{'where':{'ContactId':_0x446e6['id']}});}})['then'](function(){return _0x446e6;})[_0x0a9e('0x23')](respondWithResult(_0x251753,null))['catch'](handleError(_0x251753,null));};exports[_0x0a9e('0xc8')]=function(_0x57b7d4,_0xb14971,_0x37215d){var _0xa288e4={};var _0x10ace8={};var _0x1e306c;var _0x251dd9;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x57b7d4[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb14971,null))['then'](function(_0xf4fb77){if(_0xf4fb77){_0x1e306c=_0xf4fb77;_0x10ace8[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x50')][_0x0a9e('0xc9')]);_0x10ace8[_0x0a9e('0x35')]=_['keys'](_0x57b7d4[_0x0a9e('0x35')]);_0x10ace8[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],_0x10ace8[_0x0a9e('0x35')]);_0xa288e4[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x57b7d4[_0x0a9e('0x35')]['fields']));_0xa288e4[_0x0a9e('0x39')]=_0xa288e4['attributes'][_0x0a9e('0x2c')]?_0xa288e4[_0x0a9e('0x39')]:_0x10ace8[_0x0a9e('0x34')];_0xa288e4[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x57b7d4[_0x0a9e('0x35')]['sort']);_0xa288e4[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x57b7d4['query'],_0x10ace8[_0x0a9e('0x36')]));if(_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]){_0xa288e4[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0xa288e4[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xa288e4['attributes'],function(_0x4e1b3){var _0x228c10={};_0x228c10[_0x4e1b3]={'$like':'%'+_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x228c10;})});}_0xa288e4=_[_0x0a9e('0xcb')]({},_0xa288e4,_0x57b7d4[_0x0a9e('0xcc')]);return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})['then'](function(_0x5c8720){if(_0x5c8720){_0x251dd9=_0x5c8720[_0x0a9e('0x2c')];if(!_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xa288e4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x57b7d4[_0x0a9e('0x35')]['limit']);_0xa288e4[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})[_0x0a9e('0x23')](function(_0x16be7e){if(_0x16be7e){return _0x16be7e?{'count':_0x251dd9,'rows':_0x16be7e}:null;}})['then'](respondWithResult(_0xb14971,null))[_0x0a9e('0x8b')](handleError(_0xb14971,null));};exports[_0x0a9e('0xcd')]=function(_0x231826,_0x5885c3,_0x2b8ad4){if(_0x231826[_0x0a9e('0x8c')]['id']){delete _0x231826[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x231826[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5885c3,null))[_0x0a9e('0x23')](function(_0x93d953){if(_0x93d953){return _0x93d953[_0x0a9e('0xcd')](_0x231826[_0x0a9e('0x8c')][_0x0a9e('0xce')]||[]);}return null;})[_0x0a9e('0x23')](respondWithResult(_0x5885c3,null))['catch'](handleError(_0x5885c3,null));};exports[_0x0a9e('0xcf')]=function(_0x266aa1,_0x25e41f){var _0x397771=[];_0x397771['push'](addAdditionalPhones(_0x266aa1['body']));Promise[_0x0a9e('0x32')](_0x397771)[_0x0a9e('0x23')](function(){_0x397771=[];_0x397771[_0x0a9e('0x2e')](deleteCmHopperPhones(_0x266aa1['body']['id']));_0x397771[_0x0a9e('0x2e')](addCmHopperPhones(_0x266aa1[_0x0a9e('0x8c')]['id']));Promise['all'](_0x397771)[_0x0a9e('0x23')](function(){return[0x1];})['then'](respondWithResult(_0x25e41f,null));});};function addAdditionalPhones(_0x35cc2a){return new Promise(function(_0x54dbbf,_0x5b42b9){return db['CmContactHasItem'][_0x0a9e('0x24')]({'where':{'CmContactId':_0x35cc2a['id']}})[_0x0a9e('0x23')](function(){var _0x19f800=[];for(var _0x20007e=0x0;_0x20007e<_0x35cc2a[_0x0a9e('0xd0')][_0x0a9e('0x2c')];_0x20007e++){_0x19f800['push'](addAdditionalPhone(_0x35cc2a['id'],_0x35cc2a[_0x0a9e('0xd0')][_0x20007e][_0x0a9e('0xc7')],_0x35cc2a[_0x0a9e('0xd1')]?_[_0x0a9e('0xd2')](_0x35cc2a[_0x0a9e('0xd1')][_0x20007e])?null:_0x35cc2a[_0x0a9e('0xd1')][_0x20007e]:_0x35cc2a[_0x0a9e('0xd0')][_0x20007e]['ItemTypeId']?_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd3')]:null,_0x20007e,_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd4')]));}Promise[_0x0a9e('0x32')](_0x19f800)[_0x0a9e('0x23')](function(){_0x54dbbf(0x1);});});});}function addAdditionalPhone(_0xa3695f,_0x37a448,_0x383dd8,_0x594f25,_0x4716d1){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0xa3695f,'item':_0x37a448}})[_0x0a9e('0x23')](function(_0x593f9e){if(_0x593f9e)logger[_0x0a9e('0x92')]('contact\x20phone\x20exists',_0x593f9e);else{db['CmContactHasItem'][_0x0a9e('0x98')]({'CmContactId':_0xa3695f,'item':_0x37a448,'ItemTypeId':_0x383dd8,'OrderBy':_0x594f25,'ItemClass':'PHONE','description':_0x4716d1});}});}function deletePhones(_0x24470a){return db[_0x0a9e('0xa3')][_0x0a9e('0x24')]({'where':{'CmContactId':_0x24470a}});}function deleteCmHopperPhones(_0x48f532){return new Promise(function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0x94')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48f532}})['then'](function(_0xdc77d){db[_0x0a9e('0xd5')][_0x0a9e('0x24')]({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x52')](_0xdc77d,'id')}}});})[_0x0a9e('0x23')](function(){_0x4152cd(0x1);});});}function addCmHopperPhones(_0x376b97){return new Promise(function(_0x247a6c,_0x170b3d){return db[_0x0a9e('0x94')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x376b97}})['then'](function(_0x51fa33){var _0x558171=[];_[_0x0a9e('0x52')](_0x51fa33,function(_0x19dcc2){_0x558171[_0x0a9e('0x2e')](createCmHopperPhone(_0x376b97,_0x19dcc2['id']));});Promise[_0x0a9e('0x32')](_0x558171)[_0x0a9e('0x23')](function(){_0x247a6c(0x1);});});});}function createCmHopperPhone(_0x2dc202,_0x2b97fc){return new Promise(function(_0x307d13,_0x5d74e9){db['CmContactHasItem'][_0x0a9e('0x8d')]({'raw':!![],'attributes':[_0x0a9e('0xd6')],'where':{'CmContactId':_0x2dc202,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0xba')],'attributes':[_0x0a9e('0xd7')],'as':_0x0a9e('0xbb')}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xd8'))]})[_0x0a9e('0x23')](function(_0x262281){var _0x59f8f7=0x1;var _0x400800=_[_0x0a9e('0x52')](_0x262281,function(_0x20e191){_0x20e191['CmHopperId']=_0x2b97fc;_0x20e191[_0x0a9e('0xc7')]=_0x20e191[_0x0a9e('0xd6')];_0x20e191[_0x0a9e('0xd7')]=_0x20e191[_0x0a9e('0xd9')]||_0x59f8f7;delete _0x20e191[_0x0a9e('0xd9')];_0x59f8f7=_0x59f8f7+0x1;return _0x20e191;});return db[_0x0a9e('0xd5')][_0x0a9e('0xb0')](_0x400800,{});})[_0x0a9e('0x23')](function(){_0x307d13(0x1);});});}function insertAdditionalPhones(_0x3a9c0f,_0x3f1959){return new Promise(function(_0x6b048e,_0x3ba472){var _0x4e6eb9=[];for(var _0x572a72=0x0;_0x572a72<_0x3f1959[_0x0a9e('0x2c')];_0x572a72++){var _0x401207=_0x3f1959[_0x572a72];_0x4e6eb9[_0x0a9e('0x2e')](parseContactItemType(_0x401207));}Promise[_0x0a9e('0x32')](_0x4e6eb9)[_0x0a9e('0x23')](function(){var _0x1e29e2={'id':_0x3a9c0f['id'],'items':_0x3f1959};return addAdditionalPhones(_0x1e29e2)[_0x0a9e('0x23')](function(_0x4f7907){return addCmHopperPhones(_0x3a9c0f['id']);});})[_0x0a9e('0x23')](function(){_0x6b048e(_0x3a9c0f);});});}function parseContactItemType(_0x49fd0e){return new Promise(function(_0x26aa44,_0x1ad1d7){if(_0x49fd0e[_0x0a9e('0x3a')](_0x0a9e('0xd3'))){_0x26aa44(_0x49fd0e);}else{return db[_0x0a9e('0xba')][_0x0a9e('0x86')]({'where':{'name':_0x49fd0e[_0x0a9e('0xbb')]}})[_0x0a9e('0x23')](function(_0xa7a754){if(_[_0x0a9e('0xd2')](_0xa7a754))_0x49fd0e[_0x0a9e('0xd3')]=null;else _0x49fd0e[_0x0a9e('0xd3')]=_0xa7a754['id'];_0x26aa44(_0x49fd0e);});}});}exports[_0x0a9e('0xda')]=function(_0x3f7cb6,_0x3c8a9a){return db[_0x0a9e('0xa3')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3f7cb6['params']['id'],'ItemClass':_0x0a9e('0xdb')},'include':[{'model':db[_0x0a9e('0xba')],'as':'ItemType'}],'order':[[db['sequelize'][_0x0a9e('0xbc')](_0x0a9e('0xd8'))],[_0x0a9e('0xd7')]]})['then'](function(_0x268eae){return _0x268eae;})['then'](respondWithResult(_0x3c8a9a,null))[_0x0a9e('0x8b')](handleError(_0x3c8a9a,null));};exports['duplicateAdditionalPhones']=function(_0x22d31f,_0x5e9c92){return db[_0x0a9e('0xa3')][_0x0a9e('0x8d')]({'raw':!![],'where':{'CmContactId':_0x22d31f[_0x0a9e('0x8c')]['fromContactId']}})[_0x0a9e('0x23')](function(_0x497fda){var _0x505ffd=_[_0x0a9e('0x52')](_0x497fda,function(_0x23993f){_0x23993f[_0x0a9e('0xdc')]=_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')];return _0x23993f;});return db[_0x0a9e('0xa3')][_0x0a9e('0xb0')](_0x505ffd,{});})[_0x0a9e('0x23')](function(_0x1a3143){return addCmHopperPhones(_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')]);})[_0x0a9e('0x23')](function(_0x26361f){return['ok'];})[_0x0a9e('0x23')](respondWithResult(_0x5e9c92,null))[_0x0a9e('0x8b')](handleError(_0x5e9c92,null));};exports[_0x0a9e('0xde')]=function(_0x310026,_0x643f66){var _0x153de1=[];_0x153de1['push'](createCmHopperPhone(_0x310026[_0x0a9e('0x8c')]['id'],_0x310026[_0x0a9e('0x8c')][_0x0a9e('0xdf')]));Promise[_0x0a9e('0x32')](_0x153de1)['then'](function(){return[0x1];})['then'](respondWithResult(_0x643f66,null));};exports['getHoppers']=function(_0x2b8823,_0x55926d,_0xea26ca){var _0x1fafc2={'raw':![],'where':{}};var _0x130ae8={};var _0x43fe24={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2b8823[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x55926d,null))[_0x0a9e('0x23')](function(_0x6b948a){if(_0x6b948a){_0x130ae8['model']=_[_0x0a9e('0x2b')](db['CmHopper'][_0x0a9e('0xc9')]);_0x130ae8['query']=_[_0x0a9e('0x2b')](_0x2b8823[_0x0a9e('0x35')]);_0x130ae8[_0x0a9e('0x36')]=_['intersection'](_0x130ae8[_0x0a9e('0x34')],_0x130ae8[_0x0a9e('0x35')]);_0x1fafc2['attributes']=_['intersection'](_0x130ae8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2b8823[_0x0a9e('0x35')]['fields']));_0x1fafc2['attributes']=_0x1fafc2['attributes'][_0x0a9e('0x2c')]?_0x1fafc2[_0x0a9e('0x39')]:_0x130ae8[_0x0a9e('0x34')];if(!_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x1fafc2[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x1fafc2[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x1fafc2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x1fafc2['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2b8823[_0x0a9e('0x35')],_0x130ae8[_0x0a9e('0x36')]));_0x1fafc2[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x6b948a['id'];if(_0x2b8823['query'][_0x0a9e('0x5d')]){_0x1fafc2[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x1fafc2[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x1fafc2[_0x0a9e('0x39')],function(_0x103ad9){var _0x7c4ce2={};_0x7c4ce2[_0x103ad9]={'$like':'%'+_0x2b8823[_0x0a9e('0x35')]['filter']+'%'};return _0x7c4ce2;})});}_0x1fafc2=_['merge']({},_0x1fafc2,_0x2b8823[_0x0a9e('0xcc')]);return db[_0x0a9e('0x94')]['count']({'where':_0x1fafc2[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x4c8d75){_0x43fe24[_0x0a9e('0x1e')]=_0x4c8d75;if(_0x2b8823['query'][_0x0a9e('0xe1')]){_0x1fafc2[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x8d')](_0x1fafc2);})[_0x0a9e('0x23')](function(_0x5952c8){_0x43fe24[_0x0a9e('0x85')]=_0x5952c8;return _0x43fe24;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x55926d,_0x1fafc2))['catch'](handleError(_0x55926d,null));};exports[_0x0a9e('0xe3')]=function(_0x237994,_0x28a078,_0x24361){var _0x8f68ec={'raw':!![],'where':{}};var _0x17a0d5={};var _0x5d525f={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x237994['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x28a078,null))[_0x0a9e('0x23')](function(_0x22c390){if(_0x22c390){_0x17a0d5[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xa5')][_0x0a9e('0xc9')]);_0x17a0d5['query']=_['keys'](_0x237994['query']);_0x17a0d5['filters']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],_0x17a0d5[_0x0a9e('0x35')]);_0x8f68ec['attributes']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],qs['fields'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x38')]));_0x8f68ec[_0x0a9e('0x39')]=_0x8f68ec[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x8f68ec[_0x0a9e('0x39')]:_0x17a0d5['model'];if(!_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x8f68ec[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x8f68ec[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x237994[_0x0a9e('0x35')]['offset']);}_0x8f68ec[_0x0a9e('0x3c')]=qs['sort'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x8f68ec['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x237994['query'],_0x17a0d5[_0x0a9e('0x36')]));_0x8f68ec['where'][_0x0a9e('0xe0')]=_0x22c390['id'];if(_0x237994[_0x0a9e('0x35')]['filter']){_0x8f68ec[_0x0a9e('0x3e')]=_['merge'](_0x8f68ec[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x8f68ec[_0x0a9e('0x39')],function(_0x37ef45){var _0x288127={};_0x288127[_0x37ef45]={'$like':'%'+_0x237994[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x288127;})});}_0x8f68ec=_['merge']({},_0x8f68ec,_0x237994[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa5')][_0x0a9e('0x1e')]({'where':_0x8f68ec[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x5932ad){_0x5d525f[_0x0a9e('0x1e')]=_0x5932ad;if(_0x237994['query']['includeAll']){_0x8f68ec[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x8d')](_0x8f68ec);})[_0x0a9e('0x23')](function(_0x58d5fd){_0x5d525f[_0x0a9e('0x85')]=_0x58d5fd;return _0x5d525f;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x28a078,_0x8f68ec))[_0x0a9e('0x8b')](handleError(_0x28a078,null));};exports[_0x0a9e('0xe4')]=function(_0x2e1adc,_0x25eb44,_0x3d2bb0){var _0xb8c15={'raw':!![],'where':{}};var _0x3d02ae={};var _0x5871d7={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2e1adc[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x25eb44,null))['then'](function(_0x38d95a){if(_0x38d95a){_0x3d02ae[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db['CmHopperFinal'][_0x0a9e('0xc9')]);_0x3d02ae[_0x0a9e('0x35')]=_[_0x0a9e('0x2b')](_0x2e1adc['query']);_0x3d02ae[_0x0a9e('0x36')]=_['intersection'](_0x3d02ae[_0x0a9e('0x34')],_0x3d02ae[_0x0a9e('0x35')]);_0xb8c15[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x3d02ae[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2e1adc[_0x0a9e('0x35')]['fields']));_0xb8c15[_0x0a9e('0x39')]=_0xb8c15[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0xb8c15[_0x0a9e('0x39')]:_0x3d02ae[_0x0a9e('0x34')];if(!_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xb8c15[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0xb8c15[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0xb8c15[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0xb8c15[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2e1adc['query'],_0x3d02ae[_0x0a9e('0x36')]));_0xb8c15[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x38d95a['id'];if(_0x2e1adc['query'][_0x0a9e('0x5d')]){_0xb8c15['where']=_[_0x0a9e('0xcb')](_0xb8c15[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xb8c15[_0x0a9e('0x39')],function(_0x455bca){var _0xb09ef6={};_0xb09ef6[_0x455bca]={'$like':'%'+_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0xb09ef6;})});}_0xb8c15=_['merge']({},_0xb8c15,_0x2e1adc[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa4')]['count']({'where':_0xb8c15[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x579bb0){_0x5871d7['count']=_0x579bb0;if(_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0xb8c15[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xa4')]['findAll'](_0xb8c15);})[_0x0a9e('0x23')](function(_0x31648e){_0x5871d7[_0x0a9e('0x85')]=_0x31648e;return _0x5871d7;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x25eb44,_0xb8c15))[_0x0a9e('0x8b')](handleError(_0x25eb44,null));};exports['getJscriptySessions']=function(_0xa3ba12,_0x3fc431,_0x4df303){var _0x34112c={'raw':!![],'where':{}};var _0x2d20a0={};var _0x38284a={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xa3ba12[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x3fc431,null))[_0x0a9e('0x23')](function(_0x283bbb){if(_0x283bbb){_0x2d20a0[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xab')][_0x0a9e('0xc9')]);_0x2d20a0['query']=_['keys'](_0xa3ba12[_0x0a9e('0x35')]);_0x2d20a0['filters']=_[_0x0a9e('0x37')](_0x2d20a0[_0x0a9e('0x34')],_0x2d20a0[_0x0a9e('0x35')]);_0x34112c[_0x0a9e('0x39')]=_['intersection'](_0x2d20a0[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0xa3ba12['query'][_0x0a9e('0x38')]));_0x34112c['attributes']=_0x34112c[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x34112c[_0x0a9e('0x39')]:_0x2d20a0[_0x0a9e('0x34')];if(!_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x34112c[_0x0a9e('0x1d')]=qs['limit'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x34112c[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x34112c[_0x0a9e('0x3c')]=qs['sort'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x34112c[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0xa3ba12['query'],_0x2d20a0[_0x0a9e('0x36')]));_0x34112c[_0x0a9e('0x3e')]['ContactId']=_0x283bbb['id'];if(_0xa3ba12['query'][_0x0a9e('0x5d')]){_0x34112c[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x34112c[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x34112c[_0x0a9e('0x39')],function(_0x4d35ed){var _0x1e31c2={};_0x1e31c2[_0x4d35ed]={'$like':'%'+_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x1e31c2;})});}_0x34112c=_['merge']({},_0x34112c,_0xa3ba12[_0x0a9e('0xcc')]);return db[_0x0a9e('0xab')][_0x0a9e('0x1e')]({'where':_0x34112c[_0x0a9e('0x3e')]})['then'](function(_0x5d4935){_0x38284a[_0x0a9e('0x1e')]=_0x5d4935;if(_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0x34112c[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xab')][_0x0a9e('0x8d')](_0x34112c);})[_0x0a9e('0x23')](function(_0x23dd12){_0x38284a['rows']=_0x23dd12;return _0x38284a;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x3fc431,_0x34112c))['catch'](handleError(_0x3fc431,null));};exports[_0x0a9e('0xe5')]=function(_0x20dcfd,_0x3fd399,_0x4984b1){try{if(!_0x20dcfd['body'][_0x0a9e('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x20dcfd[_0x0a9e('0x8c')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]){throw new Error(_0x0a9e('0xe7'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2f64ef=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')][_0x0a9e('0x84')](',');var _0x81f495=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]['split'](',');if(!_0x2f64ef['length']||!_0x81f495[_0x0a9e('0x2c')]||_0x2f64ef['length']!==_0x81f495[_0x0a9e('0x2c')]){throw new Error(_0x0a9e('0xeb'));}_0x20dcfd[_0x0a9e('0x8c')]['fields']=_['zipObject'](_0x2f64ef,_0x81f495);if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xed')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x12984a=path['join'](config[_0x0a9e('0xee')],_0x0a9e('0xef'),_0x20dcfd['file'][_0x0a9e('0xf0')]);fs[_0x0a9e('0xf1')](_0x12984a,parseInt(_0x0a9e('0xf2'),0x8));var _0x4524b8=require(_0x0a9e('0xf3'))[_0x0a9e('0xf4')](path['join'](__dirname,_0x0a9e('0xf5')),[_0x12984a,_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')],_0x20dcfd['body'][_0x0a9e('0xe6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x60')],_0x20dcfd['body'][_0x0a9e('0xf6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xb2')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]]);return _0x3fd399[_0x0a9e('0x1a')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x4524b8[_0x0a9e('0xf7')]});}catch(_0x1e01af){return _0x3fd399['status'](0x1f4)[_0x0a9e('0xf8')](_0x1e01af);}};exports[_0x0a9e('0xf9')]=function(_0x315735,_0x35dadd,_0x2e413d){var _0x4e3983=fs['createReadStream'](_0x315735[_0x0a9e('0xfa')][_0x0a9e('0x6')]);Papa[_0x0a9e('0xfb')](_0x4e3983,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4edb79){return _0x35dadd[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'file':_0x315735[_0x0a9e('0xfa')],'fields':_0x4edb79[_0x0a9e('0xfd')]['fields']});}});};exports['import']=function(_0x46b143,_0x14b098,_0x16b4ae){return db['User'][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x1fc545){var _0x45616c=![];if(!_0x46b143[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x46b143['body']['binding'][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x46b143['body'][_0x0a9e('0xff')]['firstName']){throw new Error(_0x0a9e('0x100'));}if(!_0x46b143[_0x0a9e('0x8c')]['socket_timestamp']){throw new Error(_0x0a9e('0xe9'));}var _0xd6570f=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x101')),[_0x46b143[_0x0a9e('0xb9')]['id'],JSON[_0x0a9e('0x102')](_0x46b143[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x1fc545)]);_0xd6570f['on']('message',function(_0x1da68c){_0x45616c=!![];return _0x14b098[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'message':_0x0a9e('0x103'),'pid':_0xd6570f[_0x0a9e('0xf7')]});});_0xd6570f['on'](_0x0a9e('0x104'),function(_0x456884){if(_0x456884&&!_0x45616c){return _0x14b098['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0xd6570f[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0x14b098,null));};exports['importUpdates']=function(_0x5cf1ba,_0xf7ddca,_0x55075d){return db[_0x0a9e('0x56')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x20f4cb){var _0x13c6df=![];if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x5cf1ba['body']['binding'][_0x0a9e('0xc7')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0xff')][_0x0a9e('0xed')]){throw new Error(_0x0a9e('0x100'));}if(!_0x5cf1ba['body'][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2bc6a3=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x106')),[_0x5cf1ba['params']['id'],JSON[_0x0a9e('0x102')](_0x5cf1ba[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x20f4cb)]);_0x2bc6a3['on'](_0x0a9e('0x107'),function(_0x69b4d6){_0x13c6df=!![];return _0xf7ddca[_0x0a9e('0x1a')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x2bc6a3[_0x0a9e('0xf7')]});});_0x2bc6a3['on'](_0x0a9e('0x104'),function(_0x10d713){if(_0x10d713&&!_0x13c6df){return _0xf7ddca['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0x2bc6a3[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0xf7ddca,null));};exports['getJourney']=function(_0x4b51ff,_0x12d1dd){var _0x2c8d95=[_0x0a9e('0x108'),_0x0a9e('0x109'),_0x0a9e('0x10a'),'openchannel',_0x0a9e('0x10b'),'whatsapp',_0x0a9e('0x10c')];var _0x311e40={'offset':0x0,'order':qs[_0x0a9e('0x3d')]('-createdAt')},_0x57e719={'count':0x0,'rows':[]};Promise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x10d')]){if(!_[_0x0a9e('0x10e')](_0x2c8d95,_0x4b51ff['query'][_0x0a9e('0x10d')][_0x0a9e('0x10f')]())){throw new Error(_0x0a9e('0x110'));}_0x2c8d95=[_0x4b51ff['query'][_0x0a9e('0x10d')]['toLowerCase']()];}if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){try{var _0x2777fe=JSON['parse'](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]);if(!moment(_0x2777fe[_0x0a9e('0x42')])[_0x0a9e('0x112')]()){throw new Error(_0x0a9e('0x113'));}if(!moment(_0x2777fe['to'])[_0x0a9e('0x112')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3057c9){throw new Error(_0x0a9e('0x114'));}}if(!_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x311e40[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x4b51ff[_0x0a9e('0x35')]['limit']||0xa);_0x311e40[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}var _0x55a300=_0x2c8d95[_0x0a9e('0x52')](function(_0x57c3c4){if(_0x57c3c4===_0x0a9e('0x10c')){var _0x22ef0f={'attributes':['id',_0x0a9e('0x115'),'type',_0x0a9e('0x116'),_0x0a9e('0x117'),_0x0a9e('0x118'),_0x0a9e('0x119'),'endtime',_0x0a9e('0x11a'),_0x0a9e('0x11b'),_0x0a9e('0x11c'),_0x0a9e('0x11d'),_0x0a9e('0x11e'),_0x0a9e('0x11f'),_0x0a9e('0x120')],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x56'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x121'),'alias']}],'order':[[_0x0a9e('0x11c'),'DESC']]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0x22ef0f[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}return db[_0x0a9e('0xa6')][_0x0a9e('0x122')](_0x22ef0f)['then'](function(_0x173f03){_0x57e719['count']+=_0x173f03[_0x0a9e('0x1e')];return _[_0x0a9e('0x52')](_0x173f03['rows'],function(_0x2ebed3){var _0x167f89=_0x2ebed3[_0x0a9e('0x8e')]({'plain':!![]});_0x167f89[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x167f89['User']){_0x167f89[_0x0a9e('0x56')]={'id':_0x167f89[_0x0a9e('0x56')]['id'],'name':_0x167f89['User'][_0x0a9e('0x27')],'fullname':_0x167f89['User']['fullname'],'alias':_0x167f89['User'][_0x0a9e('0x123')]};}return _0x167f89;});});}else{var _0x2ec662=_['startCase'](_0x57c3c4)+(_0x57c3c4===_0x0a9e('0x109')?_0x0a9e('0x124'):'Account');var _0xc48226={'attributes':['id',_0x0a9e('0x125'),_0x0a9e('0x126'),_0x0a9e('0x11c'),_0x0a9e('0x11b'),_0x0a9e('0x127'),_0x0a9e('0x128'),'thirdDisposition',_0x0a9e('0x120'),_0x2ec662+'Id'],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x2ec662],'as':_0x0a9e('0x129'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x12a')]},{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x12b'),'attributes':['id',_0x0a9e('0x27'),'fullname']},{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),'color'],'through':{'attributes':[]}}],'order':[[_0x0a9e('0x11c'),_0x0a9e('0x6f')]]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0xc48226[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}switch(_0x57c3c4){case _0x0a9e('0x109'):_0xc48226[_0x0a9e('0x39')][_0x0a9e('0x2e')](_0x0a9e('0x12c'),_0x0a9e('0x12d'),_0x0a9e('0x12e'),_0x0a9e('0x12f'),_0x0a9e('0x130'),_0x0a9e('0x131'),'ratingType',_0x0a9e('0x132'),_0x0a9e('0x133'));break;case _0x0a9e('0x108'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x134'),_0x0a9e('0x135'));break;case _0x0a9e('0x136'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x137'),_0x0a9e('0x138'));break;}return db[_[_0x0a9e('0x139')](_0x57c3c4)+'Interaction'][_0x0a9e('0x122')](_0xc48226)[_0x0a9e('0x23')](function(_0x132455){_0x57e719[_0x0a9e('0x1e')]+=_0x132455['count'];return _['map'](_0x132455[_0x0a9e('0x85')],function(_0x44343f){var _0x2de997=_0x44343f[_0x0a9e('0x8e')]({'plain':!![]});_0x2de997[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x2de997[_0x0a9e('0x12b')]){_0x2de997[_0x0a9e('0x12b')]={'id':_0x2de997[_0x0a9e('0x12b')]['id'],'name':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x27')],'fullname':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x121')]};}return _0x2de997;});});}});return Promise[_0x0a9e('0x32')](_0x55a300);})[_0x0a9e('0x23')](function(_0x4f5ebd){return _(_0x4f5ebd)[_0x0a9e('0x13a')]()[_0x0a9e('0x13b')](_0x0a9e('0x11c'))['reverse']()['value']();})[_0x0a9e('0x23')](function(_0x51ec16){_0x57e719[_0x0a9e('0x85')]=_0x311e40[_0x0a9e('0x1d')]?_0x51ec16[_0x0a9e('0x13c')](_0x311e40[_0x0a9e('0x1b')],_0x311e40['offset']+_0x311e40['limit']):_0x51ec16;return _0x57e719;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x12d1dd,_0x311e40))[_0x0a9e('0x8b')](handleError(_0x12d1dd,null));}; \ No newline at end of file +var _0xa9e0=['status','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','CmContact','describe','keys','length','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','castTo','DATE','buildExpression','text','start','filter','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','some','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','sequelize','toString','c.firstName','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','rows','find','startsWith','displayName','columnName','custom','catch','body','findAll','get','mergeWith','tags','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','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','Phones','params','ContactItemType','ItemType','literal','`Phones.ItemType`.OrderBy','log','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','values','phone','getTags','rawAttributes','pick','merge','options','setTags','ids','setAdditionalPhones','items','item_types','isNil','ItemTypeId','description','CmHopperAdditionalPhone','item','OrderBy','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','PHONE','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','send','upload','file','parse','json','meta','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','message','mail','chat','sms','fax','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','alias','Website','closed','closedAt','disposition','secondDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','startCase','flatten','sortBy','slice','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register'];(function(_0xc88b98,_0x3d9851){var _0x47c681=function(_0xa3ecce){while(--_0xa3ecce){_0xc88b98['push'](_0xc88b98['shift']());}};_0x47c681(++_0x3d9851);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x1a')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x58b06f){var _0x563b45=[];for(var _0x296f41=0x0;_0x296f410x1){_0x10b040['or'](_0x0a9e('0x66'),qs['getFullTextValue'](_0x121cef),null);}else{if(qs[_0x0a9e('0x67')](_0x121cef)){_0x10b040['or']('c.id\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x68'),_0x121cef+'%');_0x10b040['or']('c.mobile\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or']('c.fax\x20LIKE\x20?',_0x121cef+'%');}else if(qs['isEmail'](_0x121cef)){_0x10b040['or'](_0x0a9e('0x69'),_0x121cef+'%');}else{_0x10b040['or']('c.firstName\x20LIKE\x20?','%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x6a'),'%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x69'),'%'+_0x121cef+'%');}}}}_0x23b089[_0x0a9e('0x3e')](_0x10b040);_0x23b089[_0x0a9e('0x6b')](_0x0a9e('0x6c'));var _0x26d7db={'type':db['Sequelize'][_0x0a9e('0x6d')]['SELECT'],'raw':!![]};var _0xca4ade=_0x23b089[_0x0a9e('0x6e')]()[_0x0a9e('0x40')]('c.id');if(_0x2ec755[_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3c')][_0x0a9e('0x53')](function(_0x32e134){_0x23b089['order']('c.'+_0x32e134[0x0],_0x32e134[0x1]===_0x0a9e('0x6f')?![]:!![]);});}if(!_[_0x0a9e('0x5f')](_0x432fcc)){_0x23b089['having'](_0x25c6e6);_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x70'),_0x432fcc);}BPromise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(!_0x35ed4a)return;if(_0x468813[_0x0a9e('0x72')]['role']!==_0x0a9e('0x73'))return;if(!_[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0x4f')],['field',_0x0a9e('0x56')])){return _0x468813['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x23')](function(_0x4556c5){if(_[_0x0a9e('0x5f')](_0x4556c5)){_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x75'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x75'));}else{_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));}});}})[_0x0a9e('0x23')](function(){if(_0x468813[_0x0a9e('0x72')][_0x0a9e('0x77')]===_0x0a9e('0x73')&&!_0x35ed4a&&!_0x468813[_0x0a9e('0x35')]['ListId'])return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0xca4ade[_0x0a9e('0x79')](),_0x26d7db);})['then'](function(_0x1148a1){_0x15b200[_0x0a9e('0x1e')]=_0x1148a1['length'];if(_0x15b200[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x5b4f5e[_0x0a9e('0x79')](),_0x26d7db)[_0x0a9e('0x23')](function(_0x4a43a8){_0x1459bb=_['keyBy'](_0x4a43a8,'id');_0x26d7db=_['merge'](_0x26d7db,{'model':db[_0x0a9e('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468813[_0x0a9e('0x35')][_0x0a9e('0x38')]){_0x2ec755[_0x0a9e('0x39')][_0x0a9e('0x53')](function(_0x380ab3){_0x23b089[_0x0a9e('0x40')]('c.'+_0x380ab3);});}else{_0x23b089[_0x0a9e('0x40')]('c.id');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7a'));_0x23b089[_0x0a9e('0x40')]('c.lastName');_0x23b089[_0x0a9e('0x40')]('c.phone');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7b'));_0x23b089['field'](_0x0a9e('0x7c'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7d'));_0x23b089[_0x0a9e('0x40')]('c.ListId');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7e'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7f'));_0x23b089['field'](_0x0a9e('0x80'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x81'),_0x0a9e('0x82'));}if(_0x2ec755['limit'])_0x23b089[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x1d')]);if(_0x2ec755[_0x0a9e('0x1b')])_0x23b089[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x1b')]);return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x23b089[_0x0a9e('0x79')](),_0x26d7db);});})[_0x0a9e('0x23')](function(_0x336dc3){_0x336dc3[_0x0a9e('0x53')](function(_0x1f10ef){if(_0x1f10ef[_0x0a9e('0x82')]){_0x1f10ef[_0x0a9e('0x83')]=[];_0x1f10ef['TagIds'][_0x0a9e('0x84')](',')[_0x0a9e('0x53')](function(_0xc599b3){_0x1f10ef['Tags'][_0x0a9e('0x2e')](_0x1459bb[_0xc599b3]);});}delete _0x1f10ef[_0x0a9e('0x82')];});_0x15b200[_0x0a9e('0x85')]=_0x336dc3;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755));})['catch'](handleError(_0x2b1f27,null));};exports['destroy']=function(_0x7ebea8,_0x2bbdb5){return db['CmContact'][_0x0a9e('0x86')]({'where':{'id':_0x7ebea8['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x23')](removeEntity(_0x2bbdb5,null))['catch'](handleError(_0x2bbdb5,null));};exports[_0x0a9e('0x2a')]=function(_0x41cf12,_0x2d2286){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x444f1f){delete _0x444f1f['tags'];for(var _0x2973d3=0x0;_0x2973d30x0){return new Promise(function(_0x4a70ce,_0x55f91a){var _0x183244=[];for(var _0x1f78b4=0x0;_0x1f78b4<_0x5c4be0[_0x0a9e('0x2c')];_0x1f78b4++){_0x183244['push'](insertAdditionalPhones(_0x5c4be0[_0x1f78b4][_0x0a9e('0xb6')],_0x5c4be0[_0x1f78b4][_0x0a9e('0xaf')]));}Promise[_0x0a9e('0x32')](_0x183244)[_0x0a9e('0x23')](function(){_0x4a70ce(0x1);});})[_0x0a9e('0x23')](function(){return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};});}else{return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};}}})[_0x0a9e('0x23')](respondWithResult(_0x98c62c,0xc9))[_0x0a9e('0x8b')](handleError(_0x98c62c,null));};exports[_0x0a9e('0xb7')]=function(_0x3b5bda,_0x5a1848,_0x43c397){var _0x5526a7;return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x3cf222){return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x3b5bda['params']['id']},'include':[{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x41')],'required':_0x3b5bda['query'][_0x0a9e('0x64')]?!![]:![]},{'model':db[_0x0a9e('0xa3')],'as':_0x0a9e('0xb8'),'where':{'CmContactId':_0x3b5bda[_0x0a9e('0xb9')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0xba')],'as':_0x0a9e('0xbb')}]}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xbd'))],'logging':console[_0x0a9e('0xbe')],'attributes':_['keys'](_0x3cf222)});})[_0x0a9e('0x23')](function(_0x88b25f){_0x5526a7=_0x88b25f[_0x0a9e('0x8e')]({'plain':!![]});var _0x26b826={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x88b25f&&_0x88b25f[_0x0a9e('0x60')]){if(_0x88b25f[_0x0a9e('0x60')]){_0x26b826[_0x0a9e('0x3e')][_0x0a9e('0xbf')]['push']({'ListId':{'$ne':_0x88b25f[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x26b826);})['then'](function(_0x1402c7){return _[_0x0a9e('0xc0')](_0x5526a7,_[_0x0a9e('0x52')](_0x1402c7,function(_0x97d5b5){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x97d5b5['id']);}));})[_0x0a9e('0x23')](handleEntityNotFound(_0x5a1848,null))[_0x0a9e('0x23')](respondWithResult(_0x5a1848,null))[_0x0a9e('0x8b')](handleError(_0x5a1848,null));};exports[_0x0a9e('0x22')]=function(_0x5a7dad,_0x251753){var _0x446e6;if(_0x5a7dad[_0x0a9e('0x8c')]['id']){delete _0x5a7dad[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x5a7dad['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x251753,null))['then'](saveUpdates(_0x5a7dad['body'],null))['then'](function(_0x19e4e6){_0x446e6=_0x19e4e6;var _0x3fa3f2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19e4e6&&_0x19e4e6[_0x0a9e('0x60')]){if(_0x19e4e6[_0x0a9e('0x60')]){_0x3fa3f2['where'][_0x0a9e('0xbf')][_0x0a9e('0x2e')]({'ListId':{'$ne':_0x19e4e6[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x3fa3f2);})['then'](function(_0x57b1b1){if(_0x57b1b1){return _[_0x0a9e('0xc0')](_[_0x0a9e('0xc3')](_0x5a7dad[_0x0a9e('0x8c')],function(_0x5e85d0,_0x319752){return _[_0x0a9e('0x87')](_0x319752,_0x0a9e('0x2d'));}),_['map'](_0x57b1b1,function(_0x8ad1c0){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x8ad1c0['id']);}));}})['then'](function(_0x272291){if(_0x272291&&!_[_0x0a9e('0x5f')](_0x272291)){var _0x3b7213=squel['update']()['table']('cm_contacts')[_0x0a9e('0xc4')](_0x272291)[_0x0a9e('0x3e')](_0x0a9e('0xc5'),_0x5a7dad[_0x0a9e('0xb9')]['id'])['toParam']();return db[_0x0a9e('0x78')]['query'](_0x3b7213[_0x0a9e('0x5b')],{'replacements':_0x3b7213[_0x0a9e('0xc6')]});}})[_0x0a9e('0x23')](function(){if(_0x5a7dad['body'][_0x0a9e('0xc7')]&&_0x446e6){return db[_0x0a9e('0x94')][_0x0a9e('0x22')]({'phone':_0x5a7dad['body'][_0x0a9e('0xc7')]},{'where':{'ContactId':_0x446e6['id']}});}})['then'](function(){return _0x446e6;})[_0x0a9e('0x23')](respondWithResult(_0x251753,null))['catch'](handleError(_0x251753,null));};exports[_0x0a9e('0xc8')]=function(_0x57b7d4,_0xb14971,_0x37215d){var _0xa288e4={};var _0x10ace8={};var _0x1e306c;var _0x251dd9;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x57b7d4[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb14971,null))['then'](function(_0xf4fb77){if(_0xf4fb77){_0x1e306c=_0xf4fb77;_0x10ace8[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x50')][_0x0a9e('0xc9')]);_0x10ace8[_0x0a9e('0x35')]=_['keys'](_0x57b7d4[_0x0a9e('0x35')]);_0x10ace8[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],_0x10ace8[_0x0a9e('0x35')]);_0xa288e4[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x57b7d4[_0x0a9e('0x35')]['fields']));_0xa288e4[_0x0a9e('0x39')]=_0xa288e4['attributes'][_0x0a9e('0x2c')]?_0xa288e4[_0x0a9e('0x39')]:_0x10ace8[_0x0a9e('0x34')];_0xa288e4[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x57b7d4[_0x0a9e('0x35')]['sort']);_0xa288e4[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x57b7d4['query'],_0x10ace8[_0x0a9e('0x36')]));if(_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]){_0xa288e4[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0xa288e4[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xa288e4['attributes'],function(_0x4e1b3){var _0x228c10={};_0x228c10[_0x4e1b3]={'$like':'%'+_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x228c10;})});}_0xa288e4=_[_0x0a9e('0xcb')]({},_0xa288e4,_0x57b7d4[_0x0a9e('0xcc')]);return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})['then'](function(_0x5c8720){if(_0x5c8720){_0x251dd9=_0x5c8720[_0x0a9e('0x2c')];if(!_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xa288e4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x57b7d4[_0x0a9e('0x35')]['limit']);_0xa288e4[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})[_0x0a9e('0x23')](function(_0x16be7e){if(_0x16be7e){return _0x16be7e?{'count':_0x251dd9,'rows':_0x16be7e}:null;}})['then'](respondWithResult(_0xb14971,null))[_0x0a9e('0x8b')](handleError(_0xb14971,null));};exports[_0x0a9e('0xcd')]=function(_0x231826,_0x5885c3,_0x2b8ad4){if(_0x231826[_0x0a9e('0x8c')]['id']){delete _0x231826[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x231826[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5885c3,null))[_0x0a9e('0x23')](function(_0x93d953){if(_0x93d953){return _0x93d953[_0x0a9e('0xcd')](_0x231826[_0x0a9e('0x8c')][_0x0a9e('0xce')]||[]);}return null;})[_0x0a9e('0x23')](respondWithResult(_0x5885c3,null))['catch'](handleError(_0x5885c3,null));};exports[_0x0a9e('0xcf')]=function(_0x266aa1,_0x25e41f){var _0x397771=[];_0x397771['push'](addAdditionalPhones(_0x266aa1['body']));Promise[_0x0a9e('0x32')](_0x397771)[_0x0a9e('0x23')](function(){_0x397771=[];_0x397771[_0x0a9e('0x2e')](deleteCmHopperPhones(_0x266aa1['body']['id']));_0x397771[_0x0a9e('0x2e')](addCmHopperPhones(_0x266aa1[_0x0a9e('0x8c')]['id']));Promise['all'](_0x397771)[_0x0a9e('0x23')](function(){return[0x1];})['then'](respondWithResult(_0x25e41f,null));});};function addAdditionalPhones(_0x35cc2a){return new Promise(function(_0x54dbbf,_0x5b42b9){return db['CmContactHasItem'][_0x0a9e('0x24')]({'where':{'CmContactId':_0x35cc2a['id']}})[_0x0a9e('0x23')](function(){var _0x19f800=[];for(var _0x20007e=0x0;_0x20007e<_0x35cc2a[_0x0a9e('0xd0')][_0x0a9e('0x2c')];_0x20007e++){_0x19f800['push'](addAdditionalPhone(_0x35cc2a['id'],_0x35cc2a[_0x0a9e('0xd0')][_0x20007e][_0x0a9e('0xc7')],_0x35cc2a[_0x0a9e('0xd1')]?_[_0x0a9e('0xd2')](_0x35cc2a[_0x0a9e('0xd1')][_0x20007e])?null:_0x35cc2a[_0x0a9e('0xd1')][_0x20007e]:_0x35cc2a[_0x0a9e('0xd0')][_0x20007e]['ItemTypeId']?_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd3')]:null,_0x20007e,_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd4')]));}Promise[_0x0a9e('0x32')](_0x19f800)[_0x0a9e('0x23')](function(){_0x54dbbf(0x1);});});});}function addAdditionalPhone(_0xa3695f,_0x37a448,_0x383dd8,_0x594f25,_0x4716d1){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0xa3695f,'item':_0x37a448}})[_0x0a9e('0x23')](function(_0x593f9e){if(_0x593f9e)logger[_0x0a9e('0x92')]('contact\x20phone\x20exists',_0x593f9e);else{db['CmContactHasItem'][_0x0a9e('0x98')]({'CmContactId':_0xa3695f,'item':_0x37a448,'ItemTypeId':_0x383dd8,'OrderBy':_0x594f25,'ItemClass':'PHONE','description':_0x4716d1});}});}function deletePhones(_0x24470a){return db[_0x0a9e('0xa3')][_0x0a9e('0x24')]({'where':{'CmContactId':_0x24470a}});}function deleteCmHopperPhones(_0x48f532){return new Promise(function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0x94')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48f532}})['then'](function(_0xdc77d){db[_0x0a9e('0xd5')][_0x0a9e('0x24')]({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x52')](_0xdc77d,'id')}}});})[_0x0a9e('0x23')](function(){_0x4152cd(0x1);});});}function addCmHopperPhones(_0x376b97){return new Promise(function(_0x247a6c,_0x170b3d){return db[_0x0a9e('0x94')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x376b97}})['then'](function(_0x51fa33){var _0x558171=[];_[_0x0a9e('0x52')](_0x51fa33,function(_0x19dcc2){_0x558171[_0x0a9e('0x2e')](createCmHopperPhone(_0x376b97,_0x19dcc2['id']));});Promise[_0x0a9e('0x32')](_0x558171)[_0x0a9e('0x23')](function(){_0x247a6c(0x1);});});});}function createCmHopperPhone(_0x2dc202,_0x2b97fc){return new Promise(function(_0x307d13,_0x5d74e9){db['CmContactHasItem'][_0x0a9e('0x8d')]({'raw':!![],'attributes':[_0x0a9e('0xd6')],'where':{'CmContactId':_0x2dc202,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0xba')],'attributes':[_0x0a9e('0xd7')],'as':_0x0a9e('0xbb')}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xd8'))]})[_0x0a9e('0x23')](function(_0x262281){var _0x59f8f7=0x1;var _0x400800=_[_0x0a9e('0x52')](_0x262281,function(_0x20e191){_0x20e191['CmHopperId']=_0x2b97fc;_0x20e191[_0x0a9e('0xc7')]=_0x20e191[_0x0a9e('0xd6')];_0x20e191[_0x0a9e('0xd7')]=_0x20e191[_0x0a9e('0xd9')]||_0x59f8f7;delete _0x20e191[_0x0a9e('0xd9')];_0x59f8f7=_0x59f8f7+0x1;return _0x20e191;});return db[_0x0a9e('0xd5')][_0x0a9e('0xb0')](_0x400800,{});})[_0x0a9e('0x23')](function(){_0x307d13(0x1);});});}function insertAdditionalPhones(_0x3a9c0f,_0x3f1959){return new Promise(function(_0x6b048e,_0x3ba472){var _0x4e6eb9=[];for(var _0x572a72=0x0;_0x572a72<_0x3f1959[_0x0a9e('0x2c')];_0x572a72++){var _0x401207=_0x3f1959[_0x572a72];_0x4e6eb9[_0x0a9e('0x2e')](parseContactItemType(_0x401207));}Promise[_0x0a9e('0x32')](_0x4e6eb9)[_0x0a9e('0x23')](function(){var _0x1e29e2={'id':_0x3a9c0f['id'],'items':_0x3f1959};return addAdditionalPhones(_0x1e29e2)[_0x0a9e('0x23')](function(_0x4f7907){return addCmHopperPhones(_0x3a9c0f['id']);});})[_0x0a9e('0x23')](function(){_0x6b048e(_0x3a9c0f);});});}function parseContactItemType(_0x49fd0e){return new Promise(function(_0x26aa44,_0x1ad1d7){if(_0x49fd0e[_0x0a9e('0x3a')](_0x0a9e('0xd3'))){_0x26aa44(_0x49fd0e);}else{return db[_0x0a9e('0xba')][_0x0a9e('0x86')]({'where':{'name':_0x49fd0e[_0x0a9e('0xbb')]}})[_0x0a9e('0x23')](function(_0xa7a754){if(_[_0x0a9e('0xd2')](_0xa7a754))_0x49fd0e[_0x0a9e('0xd3')]=null;else _0x49fd0e[_0x0a9e('0xd3')]=_0xa7a754['id'];_0x26aa44(_0x49fd0e);});}});}exports[_0x0a9e('0xda')]=function(_0x3f7cb6,_0x3c8a9a){return db[_0x0a9e('0xa3')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3f7cb6['params']['id'],'ItemClass':_0x0a9e('0xdb')},'include':[{'model':db[_0x0a9e('0xba')],'as':'ItemType'}],'order':[[db['sequelize'][_0x0a9e('0xbc')](_0x0a9e('0xd8'))],[_0x0a9e('0xd7')]]})['then'](function(_0x268eae){return _0x268eae;})['then'](respondWithResult(_0x3c8a9a,null))[_0x0a9e('0x8b')](handleError(_0x3c8a9a,null));};exports['duplicateAdditionalPhones']=function(_0x22d31f,_0x5e9c92){return db[_0x0a9e('0xa3')][_0x0a9e('0x8d')]({'raw':!![],'where':{'CmContactId':_0x22d31f[_0x0a9e('0x8c')]['fromContactId']}})[_0x0a9e('0x23')](function(_0x497fda){var _0x505ffd=_[_0x0a9e('0x52')](_0x497fda,function(_0x23993f){_0x23993f[_0x0a9e('0xdc')]=_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')];return _0x23993f;});return db[_0x0a9e('0xa3')][_0x0a9e('0xb0')](_0x505ffd,{});})[_0x0a9e('0x23')](function(_0x1a3143){return addCmHopperPhones(_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')]);})[_0x0a9e('0x23')](function(_0x26361f){return['ok'];})[_0x0a9e('0x23')](respondWithResult(_0x5e9c92,null))[_0x0a9e('0x8b')](handleError(_0x5e9c92,null));};exports[_0x0a9e('0xde')]=function(_0x310026,_0x643f66){var _0x153de1=[];_0x153de1['push'](createCmHopperPhone(_0x310026[_0x0a9e('0x8c')]['id'],_0x310026[_0x0a9e('0x8c')][_0x0a9e('0xdf')]));Promise[_0x0a9e('0x32')](_0x153de1)['then'](function(){return[0x1];})['then'](respondWithResult(_0x643f66,null));};exports['getHoppers']=function(_0x2b8823,_0x55926d,_0xea26ca){var _0x1fafc2={'raw':![],'where':{}};var _0x130ae8={};var _0x43fe24={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2b8823[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x55926d,null))[_0x0a9e('0x23')](function(_0x6b948a){if(_0x6b948a){_0x130ae8['model']=_[_0x0a9e('0x2b')](db['CmHopper'][_0x0a9e('0xc9')]);_0x130ae8['query']=_[_0x0a9e('0x2b')](_0x2b8823[_0x0a9e('0x35')]);_0x130ae8[_0x0a9e('0x36')]=_['intersection'](_0x130ae8[_0x0a9e('0x34')],_0x130ae8[_0x0a9e('0x35')]);_0x1fafc2['attributes']=_['intersection'](_0x130ae8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2b8823[_0x0a9e('0x35')]['fields']));_0x1fafc2['attributes']=_0x1fafc2['attributes'][_0x0a9e('0x2c')]?_0x1fafc2[_0x0a9e('0x39')]:_0x130ae8[_0x0a9e('0x34')];if(!_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x1fafc2[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x1fafc2[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x1fafc2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x1fafc2['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2b8823[_0x0a9e('0x35')],_0x130ae8[_0x0a9e('0x36')]));_0x1fafc2[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x6b948a['id'];if(_0x2b8823['query'][_0x0a9e('0x5d')]){_0x1fafc2[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x1fafc2[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x1fafc2[_0x0a9e('0x39')],function(_0x103ad9){var _0x7c4ce2={};_0x7c4ce2[_0x103ad9]={'$like':'%'+_0x2b8823[_0x0a9e('0x35')]['filter']+'%'};return _0x7c4ce2;})});}_0x1fafc2=_['merge']({},_0x1fafc2,_0x2b8823[_0x0a9e('0xcc')]);return db[_0x0a9e('0x94')]['count']({'where':_0x1fafc2[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x4c8d75){_0x43fe24[_0x0a9e('0x1e')]=_0x4c8d75;if(_0x2b8823['query'][_0x0a9e('0xe1')]){_0x1fafc2[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x8d')](_0x1fafc2);})[_0x0a9e('0x23')](function(_0x5952c8){_0x43fe24[_0x0a9e('0x85')]=_0x5952c8;return _0x43fe24;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x55926d,_0x1fafc2))['catch'](handleError(_0x55926d,null));};exports[_0x0a9e('0xe3')]=function(_0x237994,_0x28a078,_0x24361){var _0x8f68ec={'raw':!![],'where':{}};var _0x17a0d5={};var _0x5d525f={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x237994['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x28a078,null))[_0x0a9e('0x23')](function(_0x22c390){if(_0x22c390){_0x17a0d5[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xa5')][_0x0a9e('0xc9')]);_0x17a0d5['query']=_['keys'](_0x237994['query']);_0x17a0d5['filters']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],_0x17a0d5[_0x0a9e('0x35')]);_0x8f68ec['attributes']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],qs['fields'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x38')]));_0x8f68ec[_0x0a9e('0x39')]=_0x8f68ec[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x8f68ec[_0x0a9e('0x39')]:_0x17a0d5['model'];if(!_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x8f68ec[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x8f68ec[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x237994[_0x0a9e('0x35')]['offset']);}_0x8f68ec[_0x0a9e('0x3c')]=qs['sort'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x8f68ec['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x237994['query'],_0x17a0d5[_0x0a9e('0x36')]));_0x8f68ec['where'][_0x0a9e('0xe0')]=_0x22c390['id'];if(_0x237994[_0x0a9e('0x35')]['filter']){_0x8f68ec[_0x0a9e('0x3e')]=_['merge'](_0x8f68ec[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x8f68ec[_0x0a9e('0x39')],function(_0x37ef45){var _0x288127={};_0x288127[_0x37ef45]={'$like':'%'+_0x237994[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x288127;})});}_0x8f68ec=_['merge']({},_0x8f68ec,_0x237994[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa5')][_0x0a9e('0x1e')]({'where':_0x8f68ec[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x5932ad){_0x5d525f[_0x0a9e('0x1e')]=_0x5932ad;if(_0x237994['query']['includeAll']){_0x8f68ec[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x8d')](_0x8f68ec);})[_0x0a9e('0x23')](function(_0x58d5fd){_0x5d525f[_0x0a9e('0x85')]=_0x58d5fd;return _0x5d525f;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x28a078,_0x8f68ec))[_0x0a9e('0x8b')](handleError(_0x28a078,null));};exports[_0x0a9e('0xe4')]=function(_0x2e1adc,_0x25eb44,_0x3d2bb0){var _0xb8c15={'raw':!![],'where':{}};var _0x3d02ae={};var _0x5871d7={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2e1adc[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x25eb44,null))['then'](function(_0x38d95a){if(_0x38d95a){_0x3d02ae[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db['CmHopperFinal'][_0x0a9e('0xc9')]);_0x3d02ae[_0x0a9e('0x35')]=_[_0x0a9e('0x2b')](_0x2e1adc['query']);_0x3d02ae[_0x0a9e('0x36')]=_['intersection'](_0x3d02ae[_0x0a9e('0x34')],_0x3d02ae[_0x0a9e('0x35')]);_0xb8c15[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x3d02ae[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2e1adc[_0x0a9e('0x35')]['fields']));_0xb8c15[_0x0a9e('0x39')]=_0xb8c15[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0xb8c15[_0x0a9e('0x39')]:_0x3d02ae[_0x0a9e('0x34')];if(!_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xb8c15[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0xb8c15[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0xb8c15[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0xb8c15[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2e1adc['query'],_0x3d02ae[_0x0a9e('0x36')]));_0xb8c15[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x38d95a['id'];if(_0x2e1adc['query'][_0x0a9e('0x5d')]){_0xb8c15['where']=_[_0x0a9e('0xcb')](_0xb8c15[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xb8c15[_0x0a9e('0x39')],function(_0x455bca){var _0xb09ef6={};_0xb09ef6[_0x455bca]={'$like':'%'+_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0xb09ef6;})});}_0xb8c15=_['merge']({},_0xb8c15,_0x2e1adc[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa4')]['count']({'where':_0xb8c15[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x579bb0){_0x5871d7['count']=_0x579bb0;if(_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0xb8c15[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xa4')]['findAll'](_0xb8c15);})[_0x0a9e('0x23')](function(_0x31648e){_0x5871d7[_0x0a9e('0x85')]=_0x31648e;return _0x5871d7;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x25eb44,_0xb8c15))[_0x0a9e('0x8b')](handleError(_0x25eb44,null));};exports['getJscriptySessions']=function(_0xa3ba12,_0x3fc431,_0x4df303){var _0x34112c={'raw':!![],'where':{}};var _0x2d20a0={};var _0x38284a={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xa3ba12[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x3fc431,null))[_0x0a9e('0x23')](function(_0x283bbb){if(_0x283bbb){_0x2d20a0[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xab')][_0x0a9e('0xc9')]);_0x2d20a0['query']=_['keys'](_0xa3ba12[_0x0a9e('0x35')]);_0x2d20a0['filters']=_[_0x0a9e('0x37')](_0x2d20a0[_0x0a9e('0x34')],_0x2d20a0[_0x0a9e('0x35')]);_0x34112c[_0x0a9e('0x39')]=_['intersection'](_0x2d20a0[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0xa3ba12['query'][_0x0a9e('0x38')]));_0x34112c['attributes']=_0x34112c[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x34112c[_0x0a9e('0x39')]:_0x2d20a0[_0x0a9e('0x34')];if(!_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x34112c[_0x0a9e('0x1d')]=qs['limit'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x34112c[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x34112c[_0x0a9e('0x3c')]=qs['sort'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x34112c[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0xa3ba12['query'],_0x2d20a0[_0x0a9e('0x36')]));_0x34112c[_0x0a9e('0x3e')]['ContactId']=_0x283bbb['id'];if(_0xa3ba12['query'][_0x0a9e('0x5d')]){_0x34112c[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x34112c[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x34112c[_0x0a9e('0x39')],function(_0x4d35ed){var _0x1e31c2={};_0x1e31c2[_0x4d35ed]={'$like':'%'+_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x1e31c2;})});}_0x34112c=_['merge']({},_0x34112c,_0xa3ba12[_0x0a9e('0xcc')]);return db[_0x0a9e('0xab')][_0x0a9e('0x1e')]({'where':_0x34112c[_0x0a9e('0x3e')]})['then'](function(_0x5d4935){_0x38284a[_0x0a9e('0x1e')]=_0x5d4935;if(_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0x34112c[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xab')][_0x0a9e('0x8d')](_0x34112c);})[_0x0a9e('0x23')](function(_0x23dd12){_0x38284a['rows']=_0x23dd12;return _0x38284a;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x3fc431,_0x34112c))['catch'](handleError(_0x3fc431,null));};exports[_0x0a9e('0xe5')]=function(_0x20dcfd,_0x3fd399,_0x4984b1){try{if(!_0x20dcfd['body'][_0x0a9e('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x20dcfd[_0x0a9e('0x8c')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]){throw new Error(_0x0a9e('0xe7'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2f64ef=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')][_0x0a9e('0x84')](',');var _0x81f495=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]['split'](',');if(!_0x2f64ef['length']||!_0x81f495[_0x0a9e('0x2c')]||_0x2f64ef['length']!==_0x81f495[_0x0a9e('0x2c')]){throw new Error(_0x0a9e('0xeb'));}_0x20dcfd[_0x0a9e('0x8c')]['fields']=_['zipObject'](_0x2f64ef,_0x81f495);if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xed')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x12984a=path['join'](config[_0x0a9e('0xee')],_0x0a9e('0xef'),_0x20dcfd['file'][_0x0a9e('0xf0')]);fs[_0x0a9e('0xf1')](_0x12984a,parseInt(_0x0a9e('0xf2'),0x8));var _0x4524b8=require(_0x0a9e('0xf3'))[_0x0a9e('0xf4')](path['join'](__dirname,_0x0a9e('0xf5')),[_0x12984a,_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')],_0x20dcfd['body'][_0x0a9e('0xe6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x60')],_0x20dcfd['body'][_0x0a9e('0xf6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xb2')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]]);return _0x3fd399[_0x0a9e('0x1a')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x4524b8[_0x0a9e('0xf7')]});}catch(_0x1e01af){return _0x3fd399['status'](0x1f4)[_0x0a9e('0xf8')](_0x1e01af);}};exports[_0x0a9e('0xf9')]=function(_0x315735,_0x35dadd,_0x2e413d){var _0x4e3983=fs['createReadStream'](_0x315735[_0x0a9e('0xfa')][_0x0a9e('0x6')]);Papa[_0x0a9e('0xfb')](_0x4e3983,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4edb79){return _0x35dadd[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'file':_0x315735[_0x0a9e('0xfa')],'fields':_0x4edb79[_0x0a9e('0xfd')]['fields']});}});};exports['import']=function(_0x46b143,_0x14b098,_0x16b4ae){return db['User'][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x1fc545){var _0x45616c=![];if(!_0x46b143[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x46b143['body']['binding'][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x46b143['body'][_0x0a9e('0xff')]['firstName']){throw new Error(_0x0a9e('0x100'));}if(!_0x46b143[_0x0a9e('0x8c')]['socket_timestamp']){throw new Error(_0x0a9e('0xe9'));}var _0xd6570f=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x101')),[_0x46b143[_0x0a9e('0xb9')]['id'],JSON[_0x0a9e('0x102')](_0x46b143[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x1fc545)]);_0xd6570f['on']('message',function(_0x1da68c){_0x45616c=!![];return _0x14b098[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'message':_0x0a9e('0x103'),'pid':_0xd6570f[_0x0a9e('0xf7')]});});_0xd6570f['on'](_0x0a9e('0x104'),function(_0x456884){if(_0x456884&&!_0x45616c){return _0x14b098['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0xd6570f[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0x14b098,null));};exports['importUpdates']=function(_0x5cf1ba,_0xf7ddca,_0x55075d){return db[_0x0a9e('0x56')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x20f4cb){var _0x13c6df=![];if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x5cf1ba['body']['binding'][_0x0a9e('0xc7')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0xff')][_0x0a9e('0xed')]){throw new Error(_0x0a9e('0x100'));}if(!_0x5cf1ba['body'][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2bc6a3=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x106')),[_0x5cf1ba['params']['id'],JSON[_0x0a9e('0x102')](_0x5cf1ba[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x20f4cb)]);_0x2bc6a3['on'](_0x0a9e('0x107'),function(_0x69b4d6){_0x13c6df=!![];return _0xf7ddca[_0x0a9e('0x1a')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x2bc6a3[_0x0a9e('0xf7')]});});_0x2bc6a3['on'](_0x0a9e('0x104'),function(_0x10d713){if(_0x10d713&&!_0x13c6df){return _0xf7ddca['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0x2bc6a3[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0xf7ddca,null));};exports['getJourney']=function(_0x4b51ff,_0x12d1dd){var _0x2c8d95=[_0x0a9e('0x108'),_0x0a9e('0x109'),_0x0a9e('0x10a'),'openchannel',_0x0a9e('0x10b'),'whatsapp',_0x0a9e('0x10c')];var _0x311e40={'offset':0x0,'order':qs[_0x0a9e('0x3d')]('-createdAt')},_0x57e719={'count':0x0,'rows':[]};Promise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x10d')]){if(!_[_0x0a9e('0x10e')](_0x2c8d95,_0x4b51ff['query'][_0x0a9e('0x10d')][_0x0a9e('0x10f')]())){throw new Error(_0x0a9e('0x110'));}_0x2c8d95=[_0x4b51ff['query'][_0x0a9e('0x10d')]['toLowerCase']()];}if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){try{var _0x2777fe=JSON['parse'](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]);if(!moment(_0x2777fe[_0x0a9e('0x42')])[_0x0a9e('0x112')]()){throw new Error(_0x0a9e('0x113'));}if(!moment(_0x2777fe['to'])[_0x0a9e('0x112')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3057c9){throw new Error(_0x0a9e('0x114'));}}if(!_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x311e40[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x4b51ff[_0x0a9e('0x35')]['limit']||0xa);_0x311e40[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}var _0x55a300=_0x2c8d95[_0x0a9e('0x52')](function(_0x57c3c4){if(_0x57c3c4===_0x0a9e('0x10c')){var _0x22ef0f={'attributes':['id',_0x0a9e('0x115'),'type',_0x0a9e('0x116'),_0x0a9e('0x117'),_0x0a9e('0x118'),_0x0a9e('0x119'),'endtime',_0x0a9e('0x11a'),_0x0a9e('0x11b'),_0x0a9e('0x11c'),_0x0a9e('0x11d'),_0x0a9e('0x11e'),_0x0a9e('0x11f'),_0x0a9e('0x120')],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x56'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x121'),'alias']}],'order':[[_0x0a9e('0x11c'),'DESC']]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0x22ef0f[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}return db[_0x0a9e('0xa6')][_0x0a9e('0x122')](_0x22ef0f)['then'](function(_0x173f03){_0x57e719['count']+=_0x173f03[_0x0a9e('0x1e')];return _[_0x0a9e('0x52')](_0x173f03['rows'],function(_0x2ebed3){var _0x167f89=_0x2ebed3[_0x0a9e('0x8e')]({'plain':!![]});_0x167f89[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x167f89['User']){_0x167f89[_0x0a9e('0x56')]={'id':_0x167f89[_0x0a9e('0x56')]['id'],'name':_0x167f89['User'][_0x0a9e('0x27')],'fullname':_0x167f89['User']['fullname'],'alias':_0x167f89['User'][_0x0a9e('0x123')]};}return _0x167f89;});});}else{var _0x2ec662=_['startCase'](_0x57c3c4)+(_0x57c3c4===_0x0a9e('0x109')?_0x0a9e('0x124'):'Account');var _0xc48226={'attributes':['id',_0x0a9e('0x125'),_0x0a9e('0x126'),_0x0a9e('0x11c'),_0x0a9e('0x11b'),_0x0a9e('0x127'),_0x0a9e('0x128'),'thirdDisposition',_0x0a9e('0x120'),_0x2ec662+'Id'],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x2ec662],'as':_0x0a9e('0x129'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x12a')]},{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x12b'),'attributes':['id',_0x0a9e('0x27'),'fullname']},{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),'color'],'through':{'attributes':[]}}],'order':[[_0x0a9e('0x11c'),_0x0a9e('0x6f')]]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0xc48226[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}switch(_0x57c3c4){case _0x0a9e('0x109'):_0xc48226[_0x0a9e('0x39')][_0x0a9e('0x2e')](_0x0a9e('0x12c'),_0x0a9e('0x12d'),_0x0a9e('0x12e'),_0x0a9e('0x12f'),_0x0a9e('0x130'),_0x0a9e('0x131'),'ratingType',_0x0a9e('0x132'),_0x0a9e('0x133'));break;case _0x0a9e('0x108'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x134'),_0x0a9e('0x135'));break;case _0x0a9e('0x136'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x137'),_0x0a9e('0x138'));break;}return db[_[_0x0a9e('0x139')](_0x57c3c4)+'Interaction'][_0x0a9e('0x122')](_0xc48226)[_0x0a9e('0x23')](function(_0x132455){_0x57e719[_0x0a9e('0x1e')]+=_0x132455['count'];return _['map'](_0x132455[_0x0a9e('0x85')],function(_0x44343f){var _0x2de997=_0x44343f[_0x0a9e('0x8e')]({'plain':!![]});_0x2de997[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x2de997[_0x0a9e('0x12b')]){_0x2de997[_0x0a9e('0x12b')]={'id':_0x2de997[_0x0a9e('0x12b')]['id'],'name':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x27')],'fullname':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x121')]};}return _0x2de997;});});}});return Promise[_0x0a9e('0x32')](_0x55a300);})[_0x0a9e('0x23')](function(_0x4f5ebd){return _(_0x4f5ebd)[_0x0a9e('0x13a')]()[_0x0a9e('0x13b')](_0x0a9e('0x11c'))['reverse']()['value']();})[_0x0a9e('0x23')](function(_0x51ec16){_0x57e719[_0x0a9e('0x85')]=_0x311e40[_0x0a9e('0x1d')]?_0x51ec16[_0x0a9e('0x13c')](_0x311e40[_0x0a9e('0x1b')],_0x311e40['offset']+_0x311e40['limit']):_0x51ec16;return _0x57e719;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x12d1dd,_0x311e40))[_0x0a9e('0x8b')](handleError(_0x12d1dd,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 4b41425..243d15d 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x803c=['CmContact','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x803c,0x128));var _0xc803=function(_0x59d0bf,_0xa83590){_0x59d0bf=_0x59d0bf-0x0;var _0x2e5cf2=_0x803c[_0x59d0bf];return _0x2e5cf2;};'use strict';var EventEmitter=require(_0xc803('0x0'));var CmContact=require('../../mysqldb')['db'][_0xc803('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc803('0x2')](0x0);var events={'afterCreate':_0xc803('0x3'),'afterUpdate':'update','afterDestroy':_0xc803('0x4')};function emitEvent(_0x15beda){return function(_0x23e2f4,_0x45775a,_0x36f68d){CmContactEvents[_0xc803('0x5')](_0x15beda+':'+_0x23e2f4['id'],_0x23e2f4);CmContactEvents[_0xc803('0x5')](_0x15beda,_0x23e2f4);_0x36f68d(null);};}for(var e in events){if(events[_0xc803('0x6')](e)){var event=events[e];CmContact[_0xc803('0x7')](e,emitEvent(event));}}module[_0xc803('0x8')]=CmContactEvents; \ No newline at end of file +var _0xe3b5=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x2bfe52,_0x43946e){var _0x1cf649=function(_0xc8300c){while(--_0xc8300c){_0x2bfe52['push'](_0x2bfe52['shift']());}};_0x1cf649(++_0x43946e);}(_0xe3b5,0x127));var _0x5e3b=function(_0x38c95a,_0x351d6a){_0x38c95a=_0x38c95a-0x0;var _0x176bf5=_0xe3b5[_0x38c95a];return _0x176bf5;};'use strict';var EventEmitter=require(_0x5e3b('0x0'));var CmContact=require(_0x5e3b('0x1'))['db'][_0x5e3b('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5e3b('0x3')](0x0);var events={'afterCreate':_0x5e3b('0x4'),'afterUpdate':_0x5e3b('0x5'),'afterDestroy':_0x5e3b('0x6')};function emitEvent(_0x25929f){return function(_0x3e8859,_0x41bf92,_0x1f9e8c){CmContactEvents[_0x5e3b('0x7')](_0x25929f+':'+_0x3e8859['id'],_0x3e8859);CmContactEvents[_0x5e3b('0x7')](_0x25929f,_0x3e8859);_0x1f9e8c(null);};}for(var e in events){if(events[_0x5e3b('0x8')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x5e3b('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 3be2f4b..c018b79 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdded=['path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','mobile','email','models','get','error','cmContact','afterCreate','inspect','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','scheduledat','callbackUniqueid','format','YYYY-MM-DD\x20HH:mm:ss','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','then','cmContact,\x20afterCreate,\x20','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','dialCheckDuplicateType','Lists','always','onlyIfOpen','outbound','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','length','BlackLists','isEmpty','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xdded,0x17a));var _0xddde=function(_0x39c4bb,_0x2e7841){_0x39c4bb=_0x39c4bb-0x0;var _0x13b9ad=_0xdded[_0x39c4bb];return _0x13b9ad;};'use strict';var _=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var logger=require(_0xddde('0x2'))(_0xddde('0x3'));var moment=require(_0xddde('0x4'));var BPromise=require(_0xddde('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddde('0x6'));var rimraf=require(_0xddde('0x7'));var config=require(_0xddde('0x8'));var attributes=require(_0xddde('0x9'));module[_0xddde('0xa')]=function(_0x39fd85,_0x3c3021){return _0x39fd85[_0xddde('0xb')](_0xddde('0xc'),attributes,{'tableName':_0xddde('0xd'),'paranoid':!![],'indexes':[{'name':_0xddde('0xe'),'fields':['phone']},{'name':_0xddde('0xf'),'fields':['firstName','lastName','phone',_0xddde('0x10'),'fax',_0xddde('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x473781,_0x2880de,_0xaaed0c){var _0x27a882=_0x39fd85[_0xddde('0x12')];var _0xb8ed21=_0x473781[_0xddde('0x13')]({'plain':!![]});function _0x35172e(){return function(_0x57e121){logger[_0xddde('0x14')](_0xddde('0x15'),_0xddde('0x16'),util[_0xddde('0x17')](_0x57e121,{'showHidden':![],'depth':null}));};}var _0x7cbcee=function(_0x31c111){return new BPromise(function(_0x491be5,_0x20b440){_0x27a882[_0xddde('0x18')][_0xddde('0x19')]({'where':{'phone':_0xb8ed21['phone'],'VoiceQueueId':_0x31c111['id']}})['then'](function(_0xadd497){if(!_['isNil'](_0xadd497)){throw new Error(_0xddde('0x1a')+_0xb8ed21[_0xddde('0xe')]+_0xddde('0x1b')+_0x31c111['id']);}return _0x27a882[_0xddde('0x18')][_0xddde('0x1c')]({'phone':_0xb8ed21['phone'],'ContactId':_0xb8ed21['id'],'ListId':_0xb8ed21[_0xddde('0x1d')],'priority':_0xb8ed21[_0xddde('0x1e')]?_0xb8ed21['priority']:0x2,'scheduledat':_0xb8ed21[_0xddde('0x1f')]?_0xb8ed21[_0xddde('0x1f')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xb8ed21[_0xddde('0x20')]?!![]:![],'callbackuniqueid':_0xb8ed21['callbackUniqueid']?_0xb8ed21[_0xddde('0x20')]:undefined,'callbackat':_0xb8ed21['callbackUniqueid']?moment()[_0xddde('0x21')](_0xddde('0x22')):undefined,'VoiceQueueId':_0x31c111['id']});})['catch'](function(_0x4ae0a8){_0x20b440(_0x4ae0a8);});});};var _0x3cfd91=function(_0x107bca){return new BPromise(function(_0x97bb0f,_0x275f76){_0x27a882[_0xddde('0x18')][_0xddde('0x19')]({'where':{'phone':_0xb8ed21[_0xddde('0xe')],'VoiceQueueId':_0x107bca['id']}})['then'](function(_0x59320f){if(!_[_0xddde('0x23')](_0x59320f)){throw new Error(_0xddde('0x1a')+_0xb8ed21[_0xddde('0xe')]+_0xddde('0x24')+_0x107bca['id']);}return _0x27a882[_0xddde('0x25')]['findOne']({'where':{'calleridnum':_0xb8ed21[_0xddde('0xe')],'VoiceQueueId':_0x107bca['id']}});})[_0xddde('0x26')](function(_0x4ca351){if(!_['isNil'](_0x4ca351)){throw new Error(_0xddde('0x27')+_0xb8ed21[_0xddde('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x107bca['id']);}return _0x27a882[_0xddde('0x18')][_0xddde('0x1c')]({'phone':_0xb8ed21['phone'],'ContactId':_0xb8ed21['id'],'ListId':_0xb8ed21[_0xddde('0x1d')],'priority':_0xb8ed21[_0xddde('0x1e')]?_0xb8ed21[_0xddde('0x1e')]:0x2,'scheduledat':_0xb8ed21[_0xddde('0x1f')]?_0xb8ed21[_0xddde('0x1f')]:moment()[_0xddde('0x21')](_0xddde('0x22')),'callback':_0xb8ed21[_0xddde('0x20')]?!![]:![],'callbackuniqueid':_0xb8ed21[_0xddde('0x20')]?_0xb8ed21[_0xddde('0x20')]:undefined,'callbackat':_0xb8ed21[_0xddde('0x20')]?moment()[_0xddde('0x21')](_0xddde('0x22')):undefined,'VoiceQueueId':_0x107bca['id']});})[_0xddde('0x28')](function(_0x5e04d6){_0x275f76(_0x5e04d6);});});};function _0x380acb(){return function(_0x5312bb){logger[_0xddde('0x14')](_0xddde('0x15'),_0xddde('0x16'),util['inspect'](_0x5312bb,{'showHidden':![],'depth':null}));};}var _0x49b18c=function(_0x973fc9){return new BPromise(function(_0x3be6ea,_0x45c3b8){_0x27a882['CmHopper']['findOne']({'where':{'phone':_0xb8ed21[_0xddde('0xe')],'CampaignId':_0x973fc9['id']}})[_0xddde('0x26')](function(_0x2ba559){if(!_[_0xddde('0x23')](_0x2ba559)){throw new Error('cmContact,\x20afterCreate\x20'+_0xb8ed21[_0xddde('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x973fc9['id']);}return _0x27a882[_0xddde('0x18')][_0xddde('0x1c')]({'phone':_0xb8ed21[_0xddde('0xe')],'ContactId':_0xb8ed21['id'],'ListId':_0xb8ed21[_0xddde('0x1d')],'priority':_0xb8ed21[_0xddde('0x1e')]?_0xb8ed21[_0xddde('0x1e')]:0x2,'scheduledat':_0xb8ed21[_0xddde('0x1f')]?_0xb8ed21[_0xddde('0x1f')]:moment()[_0xddde('0x21')](_0xddde('0x22')),'callback':_0xb8ed21[_0xddde('0x20')]?!![]:![],'callbackuniqueid':_0xb8ed21[_0xddde('0x20')]?_0xb8ed21['callbackUniqueid']:undefined,'callbackat':_0xb8ed21[_0xddde('0x20')]?moment()[_0xddde('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x973fc9['id']});})['catch'](function(_0x49c0ab){_0x45c3b8(_0x49c0ab);});});};var _0x143c85=function(_0x384d48){return new BPromise(function(_0x4570ee,_0x12431d){_0x27a882[_0xddde('0x18')][_0xddde('0x19')]({'where':{'phone':_0xb8ed21[_0xddde('0xe')],'CampaignId':_0x384d48['id']}})['then'](function(_0x554724){if(!_[_0xddde('0x23')](_0x554724)){throw new Error('cmContact,\x20afterCreate\x20'+_0xb8ed21[_0xddde('0xe')]+_0xddde('0x29')+_0x384d48['id']);}return _0x27a882['CmHopperFinal'][_0xddde('0x19')]({'where':{'calleridnum':_0xb8ed21[_0xddde('0xe')],'CampaignId':_0x384d48['id']}});})[_0xddde('0x26')](function(_0x535e82){if(!_['isNil'](_0x535e82)){throw new Error(_0xddde('0x27')+_0xb8ed21['phone']+_0xddde('0x2a')+_0x384d48['id']);}return _0x27a882[_0xddde('0x18')][_0xddde('0x1c')]({'phone':_0xb8ed21[_0xddde('0xe')],'ContactId':_0xb8ed21['id'],'ListId':_0xb8ed21[_0xddde('0x1d')],'priority':_0xb8ed21[_0xddde('0x1e')]?_0xb8ed21['priority']:0x2,'scheduledat':_0xb8ed21[_0xddde('0x1f')]?_0xb8ed21[_0xddde('0x1f')]:moment()[_0xddde('0x21')](_0xddde('0x22')),'callback':_0xb8ed21[_0xddde('0x20')]?!![]:![],'callbackuniqueid':_0xb8ed21['callbackUniqueid']?_0xb8ed21[_0xddde('0x20')]:undefined,'callbackat':_0xb8ed21[_0xddde('0x20')]?moment()[_0xddde('0x21')](_0xddde('0x22')):undefined,'CampaignId':_0x384d48['id']});})[_0xddde('0x28')](function(_0xb0c016){_0x12431d(_0xb0c016);});});};if(_0xb8ed21[_0xddde('0x1d')]){_0x27a882[_0xddde('0x2b')][_0xddde('0x2c')]({'where':{'type':'outbound'},'attributes':['id',_0xddde('0x2d')],'include':[{'model':_0x27a882['CmList'],'as':_0xddde('0x2e'),'where':{'id':_0xb8ed21[_0xddde('0x1d')]}}]})['then'](function(_0x28069c){if(_0x28069c){var _0x3e7667=[];for(var _0x3b154b=0x0,_0x4c70ae;_0x3b154b<_0x28069c['length'];_0x3b154b+=0x1){_0x4c70ae=_0x28069c[_0x3b154b]['get']({'plain':!![]});switch(_0x4c70ae[_0xddde('0x2d')]){case _0xddde('0x2f'):_0x3cfd91(_0x4c70ae)[_0xddde('0x28')](_0x35172e());break;case _0xddde('0x30'):_0x7cbcee(_0x4c70ae)['catch'](_0x35172e());break;default:_0x27a882[_0xddde('0x18')][_0xddde('0x1c')]({'phone':_0xb8ed21[_0xddde('0xe')],'ContactId':_0xb8ed21['id'],'ListId':_0xb8ed21['ListId'],'scheduledat':_0xb8ed21[_0xddde('0x1f')]?_0xb8ed21[_0xddde('0x1f')]:moment()[_0xddde('0x21')](_0xddde('0x22')),'priority':_0xb8ed21[_0xddde('0x1e')]?_0xb8ed21['priority']:0x2,'callback':_0xb8ed21[_0xddde('0x20')]?!![]:![],'callbackuniqueid':_0xb8ed21['callbackUniqueid']?_0xb8ed21[_0xddde('0x20')]:undefined,'callbackat':_0xb8ed21['callbackUniqueid']?moment()[_0xddde('0x21')](_0xddde('0x22')):undefined,'VoiceQueueId':_0x4c70ae['id']})[_0xddde('0x28')](_0x35172e());}}}})[_0xddde('0x26')](function(){return _0x27a882[_0xddde('0x2b')][_0xddde('0x2c')]({'where':{'type':_0xddde('0x31')},'attributes':['id'],'include':[{'model':_0x27a882[_0xddde('0x32')],'as':'BlackLists','where':{'id':_0xb8ed21[_0xddde('0x1d')]}}]})[_0xddde('0x26')](function(_0x26133a){if(_0x26133a){var _0xe9610e=[];for(var _0x37ff35=0x0,_0x409485;_0x37ff35<_0x26133a['length'];_0x37ff35+=0x1){_0x409485=_0x26133a[_0x37ff35][_0xddde('0x13')]({'plain':!![]});_0x27a882[_0xddde('0x33')][_0xddde('0x1c')]({'phone':_0xb8ed21[_0xddde('0xe')],'ContactId':_0xb8ed21['id'],'ListId':_0xb8ed21[_0xddde('0x1d')],'VoiceQueueId':_0x409485['id']})['catch'](function(_0x2a8537){logger[_0xddde('0x14')](_0xddde('0x34'),_0xddde('0x16'),_0x2a8537[_0xddde('0x35')]);});}}});})[_0xddde('0x26')](function(){return _0x27a882[_0xddde('0x36')][_0xddde('0x2c')]({'attributes':['id',_0xddde('0x2d')],'include':[{'model':_0x27a882[_0xddde('0x32')],'as':_0xddde('0x2e'),'where':{'id':_0xb8ed21[_0xddde('0x1d')]}}]})[_0xddde('0x26')](function(_0x1966dc){if(_0x1966dc){var _0x3947ee=[];for(var _0xd58937=0x0,_0x34ccf1;_0xd58937<_0x1966dc[_0xddde('0x37')];_0xd58937+=0x1){_0x34ccf1=_0x1966dc[_0xd58937]['get']({'plain':!![]});switch(_0x34ccf1['dialCheckDuplicateType']){case _0xddde('0x2f'):_0x143c85(_0x34ccf1)[_0xddde('0x28')](_0x380acb());break;case _0xddde('0x30'):_0x49b18c(_0x34ccf1)[_0xddde('0x28')](_0x380acb());break;default:_0x27a882[_0xddde('0x18')]['create']({'phone':_0xb8ed21[_0xddde('0xe')],'ContactId':_0xb8ed21['id'],'ListId':_0xb8ed21[_0xddde('0x1d')],'scheduledat':_0xb8ed21[_0xddde('0x1f')]?_0xb8ed21[_0xddde('0x1f')]:moment()[_0xddde('0x21')](_0xddde('0x22')),'priority':_0xb8ed21['priority']?_0xb8ed21[_0xddde('0x1e')]:0x2,'callback':_0xb8ed21[_0xddde('0x20')]?!![]:![],'callbackuniqueid':_0xb8ed21[_0xddde('0x20')]?_0xb8ed21['callbackUniqueid']:undefined,'callbackat':_0xb8ed21[_0xddde('0x20')]?moment()[_0xddde('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x34ccf1['id']})['catch'](_0x380acb());}}}});})['then'](function(){return _0x27a882[_0xddde('0x36')]['findAll']({'attributes':['id'],'include':[{'model':_0x27a882[_0xddde('0x32')],'as':_0xddde('0x38'),'where':{'id':_0xb8ed21[_0xddde('0x1d')]}}]})[_0xddde('0x26')](function(_0x44b52c){if(_0x44b52c){var _0x58d4bc=[];for(var _0x5cdc94=0x0,_0x4775b4;_0x5cdc94<_0x44b52c[_0xddde('0x37')];_0x5cdc94+=0x1){_0x4775b4=_0x44b52c[_0x5cdc94]['get']({'plain':!![]});_0x27a882[_0xddde('0x33')][_0xddde('0x1c')]({'phone':_0xb8ed21[_0xddde('0xe')],'ContactId':_0xb8ed21['id'],'ListId':_0xb8ed21[_0xddde('0x1d')],'CampaignId':_0x4775b4['id']})[_0xddde('0x28')](function(_0x2f2f0c){logger[_0xddde('0x14')](_0xddde('0x34'),_0xddde('0x16'),_0x2f2f0c[_0xddde('0x35')]);});}}});})['then'](function(){_0xaaed0c();})[_0xddde('0x28')](function(_0x4f92fa){logger[_0xddde('0x14')](_0xddde('0x34'),'afterCreate',_0x4f92fa['message']);_0xaaed0c(_0x4f92fa);});}else{_0xaaed0c(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x1430bb,_0x51589c,_0x31eb36){var _0x20f512=_0x39fd85[_0xddde('0x12')];var _0x4ea2ad=_0x1430bb[_0xddde('0x13')]({'plain':!![]});return _0x20f512[_0xddde('0x18')][_0xddde('0x2c')]({'raw':!![],'where':{'ListId':_0x4ea2ad['ListId'],'ContactId':_0x4ea2ad['id']}})[_0xddde('0x26')](function(_0x195d06){if(!_[_0xddde('0x39')](_0x195d06)){var _0x98c824=[];for(var _0xa89ab2=0x0;_0xa89ab2<_0x195d06['length'];_0xa89ab2+=0x1){var _0x2d06b7=_0x20f512['CmHopper'][_0xddde('0x3a')]({'where':{'ListId':_0x195d06[_0xa89ab2][_0xddde('0x1d')],'ContactId':_0x195d06[_0xa89ab2][_0xddde('0x3b')],'VoiceQueueId':_0x195d06[_0xa89ab2]['VoiceQueueId'],'CampaignId':_0x195d06[_0xa89ab2]['CampaignId']}});_0x98c824[_0xddde('0x3c')](_0x2d06b7);}return BPromise['all'](_0x98c824);}})[_0xddde('0x26')](function(_0x14a71f){logger[_0xddde('0x3d')](_0xddde('0x3e'),util[_0xddde('0x17')](_0x14a71f,{'showHidden':![],'depth':null}));_0x31eb36();})[_0xddde('0x28')](function(_0x29b5b1){logger[_0xddde('0x14')](_0xddde('0x3f'),util['inspect'](_0x29b5b1,{'showHidden':![],'depth':null}));_0x31eb36(_0x29b5b1);});}}});}; \ No newline at end of file +var _0xa3eb=['info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','models','get','afterCreate','inspect','findOne','then','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','cmContact','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','VoiceQueue','findAll','dialCheckDuplicateType','length','always','onlyIfOpen','outbound','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Campaign','message','List\x20not\x20found','destroy','ContactId','VoiceQueueId','CampaignId','push','all'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa3eb[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var logger=require(_0xba3e('0x2'))('api');var moment=require(_0xba3e('0x3'));var BPromise=require(_0xba3e('0x4'));var rp=require(_0xba3e('0x5'));var fs=require('fs');var path=require(_0xba3e('0x6'));var rimraf=require(_0xba3e('0x7'));var config=require(_0xba3e('0x8'));var attributes=require(_0xba3e('0x9'));module[_0xba3e('0xa')]=function(_0x259b23,_0x298ece){return _0x259b23[_0xba3e('0xb')](_0xba3e('0xc'),attributes,{'tableName':_0xba3e('0xd'),'paranoid':!![],'indexes':[{'name':_0xba3e('0xe'),'fields':[_0xba3e('0xe')]},{'name':_0xba3e('0xf'),'fields':[_0xba3e('0x10'),_0xba3e('0x11'),_0xba3e('0xe'),'mobile',_0xba3e('0x12'),_0xba3e('0x13')],'type':_0xba3e('0x14')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5aabd0,_0x39c76a,_0x1dd004){var _0x2c8294=_0x259b23[_0xba3e('0x15')];var _0x29e0b1=_0x5aabd0[_0xba3e('0x16')]({'plain':!![]});function _0x730291(){return function(_0x159739){logger['error']('cmContact',_0xba3e('0x17'),util[_0xba3e('0x18')](_0x159739,{'showHidden':![],'depth':null}));};}var _0x1a9cd2=function(_0x4ac37d){return new BPromise(function(_0x2b66db,_0x435ef8){_0x2c8294['CmHopper'][_0xba3e('0x19')]({'where':{'phone':_0x29e0b1[_0xba3e('0xe')],'VoiceQueueId':_0x4ac37d['id']}})[_0xba3e('0x1a')](function(_0x59afa4){if(!_['isNil'](_0x59afa4)){throw new Error(_0xba3e('0x1b')+_0x29e0b1['phone']+_0xba3e('0x1c')+_0x4ac37d['id']);}return _0x2c8294[_0xba3e('0x1d')][_0xba3e('0x1e')]({'phone':_0x29e0b1[_0xba3e('0xe')],'ContactId':_0x29e0b1['id'],'ListId':_0x29e0b1[_0xba3e('0x1f')],'priority':_0x29e0b1[_0xba3e('0x20')]?_0x29e0b1[_0xba3e('0x20')]:0x2,'scheduledat':_0x29e0b1[_0xba3e('0x21')]?_0x29e0b1['scheduledat']:moment()[_0xba3e('0x22')](_0xba3e('0x23')),'callback':_0x29e0b1[_0xba3e('0x24')]?!![]:![],'callbackuniqueid':_0x29e0b1[_0xba3e('0x24')]?_0x29e0b1[_0xba3e('0x24')]:undefined,'callbackat':_0x29e0b1[_0xba3e('0x24')]?moment()[_0xba3e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4ac37d['id']});})[_0xba3e('0x25')](function(_0x5e1c9){_0x435ef8(_0x5e1c9);});});};var _0x51607e=function(_0x5ed12e){return new BPromise(function(_0x519c3e,_0x292437){_0x2c8294[_0xba3e('0x1d')]['findOne']({'where':{'phone':_0x29e0b1[_0xba3e('0xe')],'VoiceQueueId':_0x5ed12e['id']}})[_0xba3e('0x1a')](function(_0x1c261f){if(!_[_0xba3e('0x26')](_0x1c261f)){throw new Error(_0xba3e('0x1b')+_0x29e0b1[_0xba3e('0xe')]+_0xba3e('0x27')+_0x5ed12e['id']);}return _0x2c8294[_0xba3e('0x28')][_0xba3e('0x19')]({'where':{'calleridnum':_0x29e0b1[_0xba3e('0xe')],'VoiceQueueId':_0x5ed12e['id']}});})[_0xba3e('0x1a')](function(_0x328aaf){if(!_[_0xba3e('0x26')](_0x328aaf)){throw new Error(_0xba3e('0x29')+_0x29e0b1['phone']+_0xba3e('0x2a')+_0x5ed12e['id']);}return _0x2c8294[_0xba3e('0x1d')][_0xba3e('0x1e')]({'phone':_0x29e0b1['phone'],'ContactId':_0x29e0b1['id'],'ListId':_0x29e0b1[_0xba3e('0x1f')],'priority':_0x29e0b1['priority']?_0x29e0b1['priority']:0x2,'scheduledat':_0x29e0b1[_0xba3e('0x21')]?_0x29e0b1[_0xba3e('0x21')]:moment()[_0xba3e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x29e0b1[_0xba3e('0x24')]?!![]:![],'callbackuniqueid':_0x29e0b1[_0xba3e('0x24')]?_0x29e0b1[_0xba3e('0x24')]:undefined,'callbackat':_0x29e0b1[_0xba3e('0x24')]?moment()[_0xba3e('0x22')](_0xba3e('0x23')):undefined,'VoiceQueueId':_0x5ed12e['id']});})[_0xba3e('0x25')](function(_0x6f0abb){_0x292437(_0x6f0abb);});});};function _0x266041(){return function(_0x2cc136){logger[_0xba3e('0x2b')](_0xba3e('0x2c'),_0xba3e('0x17'),util['inspect'](_0x2cc136,{'showHidden':![],'depth':null}));};}var _0x352af6=function(_0x3a87bd){return new BPromise(function(_0x73e5e,_0x4fc5c4){_0x2c8294[_0xba3e('0x1d')]['findOne']({'where':{'phone':_0x29e0b1[_0xba3e('0xe')],'CampaignId':_0x3a87bd['id']}})[_0xba3e('0x1a')](function(_0x564709){if(!_[_0xba3e('0x26')](_0x564709)){throw new Error(_0xba3e('0x1b')+_0x29e0b1[_0xba3e('0xe')]+_0xba3e('0x2d')+_0x3a87bd['id']);}return _0x2c8294['CmHopper'][_0xba3e('0x1e')]({'phone':_0x29e0b1['phone'],'ContactId':_0x29e0b1['id'],'ListId':_0x29e0b1['ListId'],'priority':_0x29e0b1['priority']?_0x29e0b1[_0xba3e('0x20')]:0x2,'scheduledat':_0x29e0b1['scheduledat']?_0x29e0b1[_0xba3e('0x21')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x29e0b1['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x29e0b1[_0xba3e('0x24')]?_0x29e0b1['callbackUniqueid']:undefined,'callbackat':_0x29e0b1['callbackUniqueid']?moment()[_0xba3e('0x22')](_0xba3e('0x23')):undefined,'CampaignId':_0x3a87bd['id']});})[_0xba3e('0x25')](function(_0x491392){_0x4fc5c4(_0x491392);});});};var _0x356630=function(_0x3825c7){return new BPromise(function(_0x5477d8,_0x132215){_0x2c8294[_0xba3e('0x1d')][_0xba3e('0x19')]({'where':{'phone':_0x29e0b1[_0xba3e('0xe')],'CampaignId':_0x3825c7['id']}})[_0xba3e('0x1a')](function(_0x2e84e0){if(!_[_0xba3e('0x26')](_0x2e84e0)){throw new Error('cmContact,\x20afterCreate\x20'+_0x29e0b1[_0xba3e('0xe')]+_0xba3e('0x2e')+_0x3825c7['id']);}return _0x2c8294['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x29e0b1[_0xba3e('0xe')],'CampaignId':_0x3825c7['id']}});})[_0xba3e('0x1a')](function(_0x1b893e){if(!_[_0xba3e('0x26')](_0x1b893e)){throw new Error(_0xba3e('0x29')+_0x29e0b1['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x3825c7['id']);}return _0x2c8294[_0xba3e('0x1d')][_0xba3e('0x1e')]({'phone':_0x29e0b1['phone'],'ContactId':_0x29e0b1['id'],'ListId':_0x29e0b1['ListId'],'priority':_0x29e0b1[_0xba3e('0x20')]?_0x29e0b1[_0xba3e('0x20')]:0x2,'scheduledat':_0x29e0b1[_0xba3e('0x21')]?_0x29e0b1['scheduledat']:moment()[_0xba3e('0x22')](_0xba3e('0x23')),'callback':_0x29e0b1[_0xba3e('0x24')]?!![]:![],'callbackuniqueid':_0x29e0b1['callbackUniqueid']?_0x29e0b1[_0xba3e('0x24')]:undefined,'callbackat':_0x29e0b1['callbackUniqueid']?moment()[_0xba3e('0x22')](_0xba3e('0x23')):undefined,'CampaignId':_0x3825c7['id']});})['catch'](function(_0x2ef22f){_0x132215(_0x2ef22f);});});};if(_0x29e0b1[_0xba3e('0x1f')]){_0x2c8294[_0xba3e('0x2f')][_0xba3e('0x30')]({'where':{'type':'outbound'},'attributes':['id',_0xba3e('0x31')],'include':[{'model':_0x2c8294['CmList'],'as':'Lists','where':{'id':_0x29e0b1[_0xba3e('0x1f')]}}]})[_0xba3e('0x1a')](function(_0x4fe3d2){if(_0x4fe3d2){var _0xbb87d1=[];for(var _0x4b598b=0x0,_0x196ffc;_0x4b598b<_0x4fe3d2[_0xba3e('0x32')];_0x4b598b+=0x1){_0x196ffc=_0x4fe3d2[_0x4b598b]['get']({'plain':!![]});switch(_0x196ffc[_0xba3e('0x31')]){case _0xba3e('0x33'):_0x51607e(_0x196ffc)[_0xba3e('0x25')](_0x730291());break;case _0xba3e('0x34'):_0x1a9cd2(_0x196ffc)['catch'](_0x730291());break;default:_0x2c8294[_0xba3e('0x1d')][_0xba3e('0x1e')]({'phone':_0x29e0b1[_0xba3e('0xe')],'ContactId':_0x29e0b1['id'],'ListId':_0x29e0b1[_0xba3e('0x1f')],'scheduledat':_0x29e0b1[_0xba3e('0x21')]?_0x29e0b1[_0xba3e('0x21')]:moment()[_0xba3e('0x22')](_0xba3e('0x23')),'priority':_0x29e0b1[_0xba3e('0x20')]?_0x29e0b1[_0xba3e('0x20')]:0x2,'callback':_0x29e0b1['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x29e0b1[_0xba3e('0x24')]?_0x29e0b1[_0xba3e('0x24')]:undefined,'callbackat':_0x29e0b1[_0xba3e('0x24')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x196ffc['id']})[_0xba3e('0x25')](_0x730291());}}}})['then'](function(){return _0x2c8294['VoiceQueue'][_0xba3e('0x30')]({'where':{'type':_0xba3e('0x35')},'attributes':['id'],'include':[{'model':_0x2c8294[_0xba3e('0x36')],'as':_0xba3e('0x37'),'where':{'id':_0x29e0b1[_0xba3e('0x1f')]}}]})['then'](function(_0x42f672){if(_0x42f672){var _0x58c25e=[];for(var _0x4d10e6=0x0,_0xc85c7c;_0x4d10e6<_0x42f672[_0xba3e('0x32')];_0x4d10e6+=0x1){_0xc85c7c=_0x42f672[_0x4d10e6][_0xba3e('0x16')]({'plain':!![]});_0x2c8294[_0xba3e('0x38')][_0xba3e('0x1e')]({'phone':_0x29e0b1['phone'],'ContactId':_0x29e0b1['id'],'ListId':_0x29e0b1[_0xba3e('0x1f')],'VoiceQueueId':_0xc85c7c['id']})[_0xba3e('0x25')](function(_0x22aa22){logger[_0xba3e('0x2b')](_0xba3e('0x39'),_0xba3e('0x17'),_0x22aa22['message']);});}}});})[_0xba3e('0x1a')](function(){return _0x2c8294[_0xba3e('0x3a')][_0xba3e('0x30')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x2c8294['CmList'],'as':'Lists','where':{'id':_0x29e0b1[_0xba3e('0x1f')]}}]})[_0xba3e('0x1a')](function(_0xbe45a3){if(_0xbe45a3){var _0x269db6=[];for(var _0x1252c0=0x0,_0x27012b;_0x1252c0<_0xbe45a3[_0xba3e('0x32')];_0x1252c0+=0x1){_0x27012b=_0xbe45a3[_0x1252c0][_0xba3e('0x16')]({'plain':!![]});switch(_0x27012b[_0xba3e('0x31')]){case'always':_0x356630(_0x27012b)['catch'](_0x266041());break;case _0xba3e('0x34'):_0x352af6(_0x27012b)['catch'](_0x266041());break;default:_0x2c8294[_0xba3e('0x1d')][_0xba3e('0x1e')]({'phone':_0x29e0b1[_0xba3e('0xe')],'ContactId':_0x29e0b1['id'],'ListId':_0x29e0b1['ListId'],'scheduledat':_0x29e0b1[_0xba3e('0x21')]?_0x29e0b1[_0xba3e('0x21')]:moment()[_0xba3e('0x22')](_0xba3e('0x23')),'priority':_0x29e0b1[_0xba3e('0x20')]?_0x29e0b1['priority']:0x2,'callback':_0x29e0b1[_0xba3e('0x24')]?!![]:![],'callbackuniqueid':_0x29e0b1[_0xba3e('0x24')]?_0x29e0b1[_0xba3e('0x24')]:undefined,'callbackat':_0x29e0b1['callbackUniqueid']?moment()[_0xba3e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x27012b['id']})['catch'](_0x266041());}}}});})[_0xba3e('0x1a')](function(){return _0x2c8294['Campaign'][_0xba3e('0x30')]({'attributes':['id'],'include':[{'model':_0x2c8294[_0xba3e('0x36')],'as':'BlackLists','where':{'id':_0x29e0b1['ListId']}}]})[_0xba3e('0x1a')](function(_0x438be8){if(_0x438be8){var _0x465ae1=[];for(var _0xe7dfb8=0x0,_0x3846da;_0xe7dfb8<_0x438be8[_0xba3e('0x32')];_0xe7dfb8+=0x1){_0x3846da=_0x438be8[_0xe7dfb8][_0xba3e('0x16')]({'plain':!![]});_0x2c8294[_0xba3e('0x38')][_0xba3e('0x1e')]({'phone':_0x29e0b1[_0xba3e('0xe')],'ContactId':_0x29e0b1['id'],'ListId':_0x29e0b1[_0xba3e('0x1f')],'CampaignId':_0x3846da['id']})[_0xba3e('0x25')](function(_0x3ac06e){logger['error']('cmContact,\x20%s,\x20%s',_0xba3e('0x17'),_0x3ac06e[_0xba3e('0x3b')]);});}}});})['then'](function(){_0x1dd004();})[_0xba3e('0x25')](function(_0xfb788b){logger[_0xba3e('0x2b')]('cmContact,\x20%s,\x20%s',_0xba3e('0x17'),_0xfb788b[_0xba3e('0x3b')]);_0x1dd004(_0xfb788b);});}else{_0x1dd004(new Error(_0xba3e('0x3c')));}},'afterDestroy':function(_0x42eb63,_0x4c5d09,_0x36d0bb){var _0xa53621=_0x259b23['models'];var _0x45deb5=_0x42eb63[_0xba3e('0x16')]({'plain':!![]});return _0xa53621[_0xba3e('0x1d')][_0xba3e('0x30')]({'raw':!![],'where':{'ListId':_0x45deb5['ListId'],'ContactId':_0x45deb5['id']}})[_0xba3e('0x1a')](function(_0x4dd38a){if(!_['isEmpty'](_0x4dd38a)){var _0x3717c=[];for(var _0x1db164=0x0;_0x1db164<_0x4dd38a[_0xba3e('0x32')];_0x1db164+=0x1){var _0x6b4f03=_0xa53621[_0xba3e('0x1d')][_0xba3e('0x3d')]({'where':{'ListId':_0x4dd38a[_0x1db164][_0xba3e('0x1f')],'ContactId':_0x4dd38a[_0x1db164][_0xba3e('0x3e')],'VoiceQueueId':_0x4dd38a[_0x1db164][_0xba3e('0x3f')],'CampaignId':_0x4dd38a[_0x1db164][_0xba3e('0x40')]}});_0x3717c[_0xba3e('0x41')](_0x6b4f03);}return BPromise[_0xba3e('0x42')](_0x3717c);}})['then'](function(_0x37b0bb){logger[_0xba3e('0x43')](_0xba3e('0x44'),util[_0xba3e('0x18')](_0x37b0bb,{'showHidden':![],'depth':null}));_0x36d0bb();})[_0xba3e('0x25')](function(_0x2f15ac){logger[_0xba3e('0x2b')](_0xba3e('0x45'),util[_0xba3e('0x18')](_0x2f15ac,{'showHidden':![],'depth':null}));_0x36d0bb(_0x2f15ac);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index c0595a3..17f417e 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6a8=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CmContact','findAll','options','raw','attributes','limit','include','map','model','GetCmContact','catch','CreateCmContact','create','body','length','keys','cf_','update','table','cm_contacts','set','toString','sequelize','query','lodash','util','moment','bluebird','randomstring','ioredis','squel','../../mysqldb'];(function(_0x4ca1b8,_0x9faad5){var _0x49b9e4=function(_0x360bcd){while(--_0x360bcd){_0x4ca1b8['push'](_0x4ca1b8['shift']());}};_0x49b9e4(++_0x9faad5);}(_0xe6a8,0x13c));var _0x8e6a=function(_0x171807,_0x541cc5){_0x171807=_0x171807-0x0;var _0x13ab8a=_0xe6a8[_0x171807];return _0x13ab8a;};'use strict';var _=require(_0x8e6a('0x0'));var util=require(_0x8e6a('0x1'));var moment=require(_0x8e6a('0x2'));var BPromise=require(_0x8e6a('0x3'));var rs=require(_0x8e6a('0x4'));var fs=require('fs');var Redis=require(_0x8e6a('0x5'));var squel=require(_0x8e6a('0x6'));var db=require(_0x8e6a('0x7'))['db'];var utils=require(_0x8e6a('0x8'));var logger=require(_0x8e6a('0x9'))('rpc');var config=require(_0x8e6a('0xa'));var jayson=require(_0x8e6a('0xb'));var client=jayson[_0x8e6a('0xc')][_0x8e6a('0xd')]({'port':0x232a});config[_0x8e6a('0xe')]=_['defaults'](config[_0x8e6a('0xe')],{'host':_0x8e6a('0xf'),'port':0x18eb});var socket=require(_0x8e6a('0x10'))(new Redis(config[_0x8e6a('0xe')]));require(_0x8e6a('0x11'))[_0x8e6a('0x12')](socket);function respondWithRpcPromise(_0x1aaa21,_0xc3355c,_0x29cd3c){return new BPromise(function(_0x20361b,_0x4fee07){return client[_0x8e6a('0x13')](_0x1aaa21,_0x29cd3c)[_0x8e6a('0x14')](function(_0x5bfa1d){logger[_0x8e6a('0x15')](_0x8e6a('0x16'),_0xc3355c,_0x8e6a('0x17'));logger[_0x8e6a('0x18')](_0x8e6a('0x19'),_0xc3355c,'request\x20sent',JSON[_0x8e6a('0x1a')](_0x5bfa1d));if(_0x5bfa1d[_0x8e6a('0x1b')]){if(_0x5bfa1d['error']['code']===0x1f4){logger[_0x8e6a('0x1b')](_0x8e6a('0x16'),_0xc3355c,_0x5bfa1d[_0x8e6a('0x1b')][_0x8e6a('0x1c')]);return _0x4fee07(_0x5bfa1d[_0x8e6a('0x1b')][_0x8e6a('0x1c')]);}logger['error']('CmContact,\x20%s,\x20%s',_0xc3355c,_0x5bfa1d[_0x8e6a('0x1b')][_0x8e6a('0x1c')]);return _0x20361b(_0x5bfa1d[_0x8e6a('0x1b')]['message']);}else{logger[_0x8e6a('0x15')](_0x8e6a('0x16'),_0xc3355c,'request\x20sent');_0x20361b(_0x5bfa1d[_0x8e6a('0x1d')][_0x8e6a('0x1c')]);}})['catch'](function(_0x21b9d2){logger[_0x8e6a('0x1b')]('CmContact,\x20%s,\x20%s',_0xc3355c,_0x21b9d2);_0x4fee07(_0x21b9d2);});});}exports['GetCmContact']=function(_0x16b37b){var _0x49fe06=this;return new Promise(function(_0x387a38,_0x3e40e8){return db[_0x8e6a('0x1e')][_0x8e6a('0x1f')]({'raw':_0x16b37b['options']?_0x16b37b[_0x8e6a('0x20')][_0x8e6a('0x21')]===undefined?!![]:![]:!![],'where':_0x16b37b[_0x8e6a('0x20')]?_0x16b37b[_0x8e6a('0x20')]['where']||null:null,'attributes':_0x16b37b[_0x8e6a('0x20')]?_0x16b37b[_0x8e6a('0x20')][_0x8e6a('0x22')]||null:null,'limit':_0x16b37b[_0x8e6a('0x20')]?_0x16b37b[_0x8e6a('0x20')][_0x8e6a('0x23')]||null:null,'include':_0x16b37b[_0x8e6a('0x20')]?_0x16b37b[_0x8e6a('0x20')][_0x8e6a('0x24')]?_[_0x8e6a('0x25')](_0x16b37b['options']['include'],function(_0x3485d9){return{'model':db[_0x3485d9[_0x8e6a('0x26')]],'as':_0x3485d9['as'],'attributes':_0x3485d9[_0x8e6a('0x22')],'include':_0x3485d9['include']?_[_0x8e6a('0x25')](_0x3485d9[_0x8e6a('0x24')],function(_0x4860f2){return{'model':db[_0x4860f2[_0x8e6a('0x26')]],'as':_0x4860f2['as'],'attributes':_0x4860f2[_0x8e6a('0x22')],'include':_0x4860f2[_0x8e6a('0x24')]?_[_0x8e6a('0x25')](_0x4860f2[_0x8e6a('0x24')],function(_0x40cbd7){return{'model':db[_0x40cbd7['model']],'as':_0x40cbd7['as'],'attributes':_0x40cbd7[_0x8e6a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8e6a('0x14')](function(_0x4bb319){logger[_0x8e6a('0x15')]('GetCmContact',_0x16b37b);logger[_0x8e6a('0x18')](_0x8e6a('0x27'),_0x16b37b,JSON['stringify'](_0x4bb319));_0x387a38(_0x4bb319);})[_0x8e6a('0x28')](function(_0x56f088){logger[_0x8e6a('0x1b')]('GetCmContact',_0x56f088['message'],_0x16b37b);_0x3e40e8(_0x49fe06[_0x8e6a('0x1b')](0x1f4,_0x56f088[_0x8e6a('0x1c')]));});});};exports[_0x8e6a('0x29')]=function(_0x52015a){var _0x352603=this;return new Promise(function(_0x164ec6,_0x484f3e){return db['CmContact'][_0x8e6a('0x2a')](_0x52015a[_0x8e6a('0x2b')],{'raw':_0x52015a[_0x8e6a('0x20')]?_0x52015a[_0x8e6a('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x8e6a('0x14')](function(_0x45b56f){var _0x452c60;for(var _0x3b250f=0x0;_0x3b250f{}\s\\|]/g,'-');_0x39c2a2(null,util['format'](_0x812c('0x27'),path['basename'](_0x325e14[_0x812c('0x25')],path[_0x812c('0x28')](_0x325e14[_0x812c('0x25')])),Date[_0x812c('0x29')](),path[_0x812c('0x28')](_0x325e14[_0x812c('0x25')])));}})});router[_0x812c('0x19')]('/csv',upload[_0x812c('0x2a')](_0x812c('0x2b')),controller[_0x812c('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x507077,_0x28e94f,_0x504007){_0x504007(null,path[_0x812c('0x2d')](config[_0x812c('0x23')],_0x812c('0x24')));},'filename':function(_0x740d7e,_0x186f0a,_0x426e86){_0x186f0a[_0x812c('0x25')]=_0x186f0a[_0x812c('0x25')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x426e86(null,util[_0x812c('0x2e')]('%s-%s%s',path[_0x812c('0x2f')](_0x186f0a[_0x812c('0x25')],path[_0x812c('0x28')](_0x186f0a['originalname'])),Date[_0x812c('0x29')](),path['extname'](_0x186f0a[_0x812c('0x25')])));}})});router[_0x812c('0x19')](_0x812c('0x30'),upload[_0x812c('0x2a')](_0x812c('0x2b')),controller[_0x812c('0x31')]);router[_0x812c('0x19')]('/upload/:id',auth[_0x812c('0xb')](),controller['import']);router[_0x812c('0x19')](_0x812c('0x32'),auth[_0x812c('0xb')](),controller[_0x812c('0x33')]);router[_0x812c('0x34')](_0x812c('0x35'),auth[_0x812c('0xb')](),controller['update']);router[_0x812c('0x36')]('/:id',auth[_0x812c('0xb')](),controller[_0x812c('0x37')]);module[_0x812c('0x38')]=router; \ No newline at end of file +var _0xccd1=['isAuthenticated','index','/describe','describe','/:id','/:id/tags','getTags','getAdditionalPhones','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','getJourney','post','/merge','merge','create','bulkCreate','/:id/phones','setAdditionalPhones','duplicateAdditionalPhones','diskStorage','root','server/files/tmp','originalname','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','join','replace','upload','/upload/:id','import','/uploadUpdates/:id','put','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get'];(function(_0x27fcf0,_0x2abcbe){var _0x47ab65=function(_0x1b76e5){while(--_0x1b76e5){_0x27fcf0['push'](_0x27fcf0['shift']());}};_0x47ab65(++_0x2abcbe);}(_0xccd1,0x140));var _0x1ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1ccd('0x0'));var path=require(_0x1ccd('0x1'));var timeout=require(_0x1ccd('0x2'));var express=require(_0x1ccd('0x3'));var router=express[_0x1ccd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1ccd('0x5'));var interaction=require(_0x1ccd('0x6'));var config=require(_0x1ccd('0x7'));var controller=require(_0x1ccd('0x8'));router[_0x1ccd('0x9')]('/',auth[_0x1ccd('0xa')](),controller[_0x1ccd('0xb')]);router['get'](_0x1ccd('0xc'),auth[_0x1ccd('0xa')](),controller[_0x1ccd('0xd')]);router['get'](_0x1ccd('0xe'),auth[_0x1ccd('0xa')](),controller['show']);router[_0x1ccd('0x9')](_0x1ccd('0xf'),auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x10')]);router['get']('/:id/phones',auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x11')]);router[_0x1ccd('0x9')](_0x1ccd('0x12'),auth[_0x1ccd('0xa')](),controller['getHoppers']);router[_0x1ccd('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x1ccd('0x13')]);router[_0x1ccd('0x9')](_0x1ccd('0x14'),auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x15')]);router[_0x1ccd('0x9')](_0x1ccd('0x16'),auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x17')]);router[_0x1ccd('0x9')]('/:id/journey',auth['isAuthenticated'](),controller[_0x1ccd('0x18')]);router[_0x1ccd('0x19')](_0x1ccd('0x1a'),auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x1b')]);router[_0x1ccd('0x19')]('/',auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x1c')]);router[_0x1ccd('0x19')]('/create_many',auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x1d')]);router[_0x1ccd('0x19')](_0x1ccd('0xf'),auth[_0x1ccd('0xa')](),controller['setTags']);router[_0x1ccd('0x19')](_0x1ccd('0x1e'),auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x1f')]);router[_0x1ccd('0x19')]('/:id/duplicateAdditionalPhones',auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x20')]);router[_0x1ccd('0x19')]('/:id/rescheduleAdditionalPhones',auth[_0x1ccd('0xa')](),controller['rescheduleAdditionalPhones']);var upload=multer({'storage':multer[_0x1ccd('0x21')]({'destination':function(_0xbf2361,_0x17a7e1,_0x38c0bf){_0x38c0bf(null,path['join'](config[_0x1ccd('0x22')],_0x1ccd('0x23')));},'filename':function(_0x5a9f88,_0x787c68,_0x42b540){_0x787c68[_0x1ccd('0x24')]=_0x787c68[_0x1ccd('0x24')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42b540(null,util[_0x1ccd('0x25')](_0x1ccd('0x26'),path[_0x1ccd('0x27')](_0x787c68[_0x1ccd('0x24')],path[_0x1ccd('0x28')](_0x787c68[_0x1ccd('0x24')])),Date[_0x1ccd('0x29')](),path[_0x1ccd('0x28')](_0x787c68[_0x1ccd('0x24')])));}})});router[_0x1ccd('0x19')](_0x1ccd('0x2a'),upload[_0x1ccd('0x2b')](_0x1ccd('0x2c')),controller[_0x1ccd('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xde5ba6,_0x2ef380,_0x4d1a28){_0x4d1a28(null,path[_0x1ccd('0x2e')](config[_0x1ccd('0x22')],'server/files/tmp'));},'filename':function(_0xb5a13,_0x4f3d31,_0x46f6e3){_0x4f3d31[_0x1ccd('0x24')]=_0x4f3d31[_0x1ccd('0x24')][_0x1ccd('0x2f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x46f6e3(null,util[_0x1ccd('0x25')](_0x1ccd('0x26'),path['basename'](_0x4f3d31[_0x1ccd('0x24')],path[_0x1ccd('0x28')](_0x4f3d31['originalname'])),Date[_0x1ccd('0x29')](),path[_0x1ccd('0x28')](_0x4f3d31[_0x1ccd('0x24')])));}})});router[_0x1ccd('0x19')]('/upload',upload[_0x1ccd('0x2b')](_0x1ccd('0x2c')),controller[_0x1ccd('0x30')]);router[_0x1ccd('0x19')](_0x1ccd('0x31'),auth[_0x1ccd('0xa')](),controller[_0x1ccd('0x32')]);router[_0x1ccd('0x19')](_0x1ccd('0x33'),auth[_0x1ccd('0xa')](),controller['importUpdates']);router[_0x1ccd('0x34')](_0x1ccd('0xe'),auth[_0x1ccd('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1ccd('0x35')]);module[_0x1ccd('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index bab01e7..5264fb2 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x505c=['STRING','PHONE','sequelize','INTEGER'];(function(_0x38dd73,_0x4f2717){var _0x24fb4a=function(_0x5e48d3){while(--_0x5e48d3){_0x38dd73['push'](_0x38dd73['shift']());}};_0x24fb4a(++_0x4f2717);}(_0x505c,0x8e));var _0xc505=function(_0x280a97,_0x1c3a99){_0x280a97=_0x280a97-0x0;var _0x54e2a2=_0x505c[_0x280a97];return _0x54e2a2;};'use strict';var Sequelize=require(_0xc505('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xc505('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xc505('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc505('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xc505('0x3')},'OrderBy':{'type':Sequelize[_0xc505('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xc505('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x32b6=['INTEGER','sequelize','exports','STRING'];(function(_0xc0f10a,_0x3a2702){var _0x2c8ab6=function(_0x1ac234){while(--_0x1ac234){_0xc0f10a['push'](_0xc0f10a['shift']());}};_0x2c8ab6(++_0x3a2702);}(_0x32b6,0x81));var _0x632b=function(_0xda0931,_0xfdc067){_0xda0931=_0xda0931-0x0;var _0x4bc3bc=_0x32b6[_0xda0931];return _0x4bc3bc;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x632b('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x632b('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x632b('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x632b('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x632b('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 2ad8311..b31aaf1 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80b6=['merge','includeAll','include','findAll','rows','catch','show','length','options','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','create','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0x80b6,0x162));var _0x680b=function(_0x5b320e,_0x4c182d){_0x5b320e=_0x5b320e-0x0;var _0x22a7c4=_0x80b6[_0x5b320e];return _0x22a7c4;};'use strict';var emlformat=require(_0x680b('0x0'));var rimraf=require(_0x680b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x680b('0x2'));var rp=require(_0x680b('0x3'));var moment=require(_0x680b('0x4'));var BPromise=require(_0x680b('0x5'));var Mustache=require(_0x680b('0x6'));var util=require('util');var path=require(_0x680b('0x7'));var sox=require(_0x680b('0x8'));var csv=require(_0x680b('0x9'));var ejs=require(_0x680b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x680b('0xb'));var squel=require('squel');var crypto=require(_0x680b('0xc'));var jsforce=require(_0x680b('0xd'));var deskjs=require(_0x680b('0xe'));var toCsv=require(_0x680b('0x9'));var querystring=require(_0x680b('0xf'));var Papa=require(_0x680b('0x10'));var Redis=require(_0x680b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x680b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x680b('0x13'))(_0x680b('0x14'));var utils=require(_0x680b('0x15'));var config=require(_0x680b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x680b('0x17'))['db'];function respondWithStatusCode(_0x3d409e,_0x40abd5){_0x40abd5=_0x40abd5||0xcc;return function(_0x139953){if(_0x139953){return _0x3d409e['sendStatus'](_0x40abd5);}return _0x3d409e[_0x680b('0x18')](_0x40abd5)[_0x680b('0x19')]();};}function respondWithResult(_0x3dd58d,_0x20ea7d){_0x20ea7d=_0x20ea7d||0xc8;return function(_0x3f6450){if(_0x3f6450){return _0x3dd58d[_0x680b('0x18')](_0x20ea7d)[_0x680b('0x1a')](_0x3f6450);}};}function respondWithFilteredResult(_0x1e09ca,_0x457075){return function(_0x5d4aad){if(_0x5d4aad){var _0xdaaa0f=typeof _0x457075['offset']===_0x680b('0x1b')&&typeof _0x457075[_0x680b('0x1c')]===_0x680b('0x1b');var _0x5f4101=_0x5d4aad[_0x680b('0x1d')];var _0x573760=_0xdaaa0f?0x0:_0x457075[_0x680b('0x1e')];var _0x398e26=_0xdaaa0f?_0x5d4aad['count']:_0x457075[_0x680b('0x1e')]+_0x457075[_0x680b('0x1c')];var _0x2f4437;if(_0x398e26>=_0x5f4101){_0x398e26=_0x5f4101;_0x2f4437=0xc8;}else{_0x2f4437=0xce;}_0x1e09ca[_0x680b('0x18')](_0x2f4437);return _0x1e09ca[_0x680b('0x1f')](_0x680b('0x20'),_0x573760+'-'+_0x398e26+'/'+_0x5f4101)['json'](_0x5d4aad);}return null;};}function patchUpdates(_0x1d7a43){return function(_0x89fcc6){try{jsonpatch[_0x680b('0x21')](_0x89fcc6,_0x1d7a43,!![]);}catch(_0x153431){return BPromise[_0x680b('0x22')](_0x153431);}return _0x89fcc6[_0x680b('0x23')]();};}function saveUpdates(_0x402d99,_0x8fe28f){return function(_0x4c1430){if(_0x4c1430){return _0x4c1430[_0x680b('0x24')](_0x402d99)[_0x680b('0x25')](function(_0x4e507d){return _0x4e507d;});}return null;};}function removeEntity(_0x1a5dea,_0x1657c1){return function(_0x9ff5ec){if(_0x9ff5ec){return _0x9ff5ec[_0x680b('0x26')]()[_0x680b('0x25')](function(){var _0x50024f=_0x9ff5ec['get']({'plain':!![]});var _0x4a95cc=_0x680b('0x27');return db[_0x680b('0x28')][_0x680b('0x26')]({'where':{'type':_0x4a95cc,'resourceId':_0x50024f['id']}})['then'](function(){return _0x9ff5ec;});})[_0x680b('0x25')](function(){_0x1a5dea[_0x680b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x344312,_0x87a337){return function(_0x112d48){if(!_0x112d48){_0x344312[_0x680b('0x29')](0x194);}return _0x112d48;};}function handleError(_0x31145f,_0x530f6c){_0x530f6c=_0x530f6c||0x1f4;return function(_0x5ef0b6){logger[_0x680b('0x2a')](_0x5ef0b6[_0x680b('0x2b')]);if(_0x5ef0b6['name']){delete _0x5ef0b6[_0x680b('0x2c')];}_0x31145f[_0x680b('0x18')](_0x530f6c)[_0x680b('0x2d')](_0x5ef0b6);};}exports[_0x680b('0x2e')]=function(_0x3885c9,_0x3b6a3a){var _0x1119c2={},_0x5a543f={},_0x1246a0={'count':0x0,'rows':[]};var _0x37a7f2=_[_0x680b('0x2f')](db[_0x680b('0x30')][_0x680b('0x31')],function(_0x13d42e){return{'name':_0x13d42e[_0x680b('0x32')],'type':_0x13d42e[_0x680b('0x33')][_0x680b('0x34')]};});_0x5a543f['model']=_[_0x680b('0x2f')](_0x37a7f2,_0x680b('0x2c'));_0x5a543f[_0x680b('0x35')]=_[_0x680b('0x36')](_0x3885c9[_0x680b('0x35')]);_0x5a543f[_0x680b('0x37')]=_[_0x680b('0x38')](_0x5a543f[_0x680b('0x39')],_0x5a543f[_0x680b('0x35')]);_0x1119c2[_0x680b('0x3a')]=_[_0x680b('0x38')](_0x5a543f['model'],qs[_0x680b('0x3b')](_0x3885c9['query'][_0x680b('0x3b')]));_0x1119c2[_0x680b('0x3a')]=_0x1119c2['attributes']['length']?_0x1119c2[_0x680b('0x3a')]:_0x5a543f[_0x680b('0x39')];if(!_0x3885c9[_0x680b('0x35')][_0x680b('0x3c')](_0x680b('0x3d'))){_0x1119c2[_0x680b('0x1c')]=qs[_0x680b('0x1c')](_0x3885c9[_0x680b('0x35')][_0x680b('0x1c')]);_0x1119c2[_0x680b('0x1e')]=qs[_0x680b('0x1e')](_0x3885c9[_0x680b('0x35')][_0x680b('0x1e')]);}_0x1119c2[_0x680b('0x3e')]=qs[_0x680b('0x3f')](_0x3885c9['query'][_0x680b('0x3f')]);_0x1119c2[_0x680b('0x40')]=qs[_0x680b('0x37')](_['pick'](_0x3885c9['query'],_0x5a543f[_0x680b('0x37')]),_0x37a7f2);if(_0x3885c9[_0x680b('0x35')][_0x680b('0x41')]){_0x1119c2['where']=_[_0x680b('0x42')](_0x1119c2['where'],{'$or':_['map'](_0x37a7f2,function(_0x1325a2){if(_0x1325a2[_0x680b('0x33')]!=='VIRTUAL'){var _0x1ae2c9={};_0x1ae2c9[_0x1325a2[_0x680b('0x2c')]]={'$like':'%'+_0x3885c9[_0x680b('0x35')][_0x680b('0x41')]+'%'};return _0x1ae2c9;}})});}_0x1119c2=_[_0x680b('0x42')]({},_0x1119c2,_0x3885c9['options']);var _0x29eeae={'where':_0x1119c2[_0x680b('0x40')]};return db['CmContactHasItem'][_0x680b('0x1d')](_0x29eeae)['then'](function(_0x1273fa){_0x1246a0[_0x680b('0x1d')]=_0x1273fa;if(_0x3885c9[_0x680b('0x35')][_0x680b('0x43')]){_0x1119c2[_0x680b('0x44')]=[{'all':!![]}];}return db[_0x680b('0x30')][_0x680b('0x45')](_0x1119c2);})[_0x680b('0x25')](function(_0x271ca8){_0x1246a0[_0x680b('0x46')]=_0x271ca8;return _0x1246a0;})[_0x680b('0x25')](respondWithFilteredResult(_0x3b6a3a,_0x1119c2))[_0x680b('0x47')](handleError(_0x3b6a3a,null));};exports[_0x680b('0x48')]=function(_0x55fb3d,_0x631930){var _0x4fa6b8={'raw':!![],'where':{'id':_0x55fb3d['params']['id']}},_0x145fee={};_0x145fee[_0x680b('0x39')]=_[_0x680b('0x36')](db[_0x680b('0x30')]['rawAttributes']);_0x145fee['query']=_[_0x680b('0x36')](_0x55fb3d[_0x680b('0x35')]);_0x145fee[_0x680b('0x37')]=_['intersection'](_0x145fee[_0x680b('0x39')],_0x145fee[_0x680b('0x35')]);_0x4fa6b8['attributes']=_[_0x680b('0x38')](_0x145fee[_0x680b('0x39')],qs[_0x680b('0x3b')](_0x55fb3d[_0x680b('0x35')]['fields']));_0x4fa6b8[_0x680b('0x3a')]=_0x4fa6b8['attributes'][_0x680b('0x49')]?_0x4fa6b8[_0x680b('0x3a')]:_0x145fee[_0x680b('0x39')];if(_0x55fb3d[_0x680b('0x35')][_0x680b('0x43')]){_0x4fa6b8[_0x680b('0x44')]=[{'all':!![]}];}_0x4fa6b8=_[_0x680b('0x42')]({},_0x4fa6b8,_0x55fb3d[_0x680b('0x4a')]);return db[_0x680b('0x30')]['find'](_0x4fa6b8)['then'](handleEntityNotFound(_0x631930,null))[_0x680b('0x25')](respondWithResult(_0x631930,null))[_0x680b('0x47')](handleError(_0x631930,null));};exports['create']=function(_0xea6f68,_0x2ca079){return db[_0x680b('0x30')]['create'](_0xea6f68[_0x680b('0x4b')],{})[_0x680b('0x25')](function(_0x40aeac){var _0x20e51d=_0xea6f68['user'][_0x680b('0x4c')]({'plain':!![]});if(!_0x20e51d)throw new Error(_0x680b('0x4d'));if(_0x20e51d[_0x680b('0x4e')]==='user'){var _0x3dd71f=_0x40aeac[_0x680b('0x4c')]({'plain':!![]});var _0x130bf6=_0x680b('0x27');return db[_0x680b('0x4f')][_0x680b('0x50')]({'where':{'name':_0x130bf6,'userProfileId':_0x20e51d['userProfileId']},'raw':!![]})[_0x680b('0x25')](function(_0x16dfff){if(_0x16dfff&&_0x16dfff[_0x680b('0x51')]===0x0){return db[_0x680b('0x28')][_0x680b('0x52')]({'name':_0x3dd71f[_0x680b('0x2c')],'resourceId':_0x3dd71f['id'],'type':_0x16dfff[_0x680b('0x2c')],'sectionId':_0x16dfff['id']},{})[_0x680b('0x25')](function(){return _0x40aeac;});}else{return _0x40aeac;}})[_0x680b('0x47')](function(_0x349df4){logger[_0x680b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x349df4);throw _0x349df4;});}return _0x40aeac;})[_0x680b('0x25')](respondWithResult(_0x2ca079,0xc9))['catch'](handleError(_0x2ca079,null));};exports[_0x680b('0x24')]=function(_0x1bbe21,_0x18f338){if(_0x1bbe21[_0x680b('0x4b')]['id']){delete _0x1bbe21[_0x680b('0x4b')]['id'];}return db[_0x680b('0x30')]['find']({'where':{'id':_0x1bbe21['params']['id']}})[_0x680b('0x25')](handleEntityNotFound(_0x18f338,null))[_0x680b('0x25')](saveUpdates(_0x1bbe21[_0x680b('0x4b')],null))[_0x680b('0x25')](respondWithResult(_0x18f338,null))[_0x680b('0x47')](handleError(_0x18f338,null));};exports[_0x680b('0x26')]=function(_0x3e6f16,_0x41db29){return db[_0x680b('0x30')][_0x680b('0x50')]({'where':{'id':_0x3e6f16[_0x680b('0x53')]['id']}})[_0x680b('0x25')](handleEntityNotFound(_0x41db29,null))[_0x680b('0x25')](removeEntity(_0x41db29,null))[_0x680b('0x47')](handleError(_0x41db29,null));}; \ No newline at end of file +var _0x6e09=['name','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','rows','catch','show','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','mustache','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','../../config/logger','api','../../mysqldb','end','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','stack'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6e09,0x76));var _0x96e0=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x6e09[_0x1ae5ab];return _0x1ce001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x96e0('0x0'));var zipdir=require(_0x96e0('0x1'));var jsonpatch=require(_0x96e0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x96e0('0x3'));var util=require('util');var path=require(_0x96e0('0x4'));var sox=require(_0x96e0('0x5'));var csv=require(_0x96e0('0x6'));var ejs=require(_0x96e0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96e0('0x8'));var squel=require(_0x96e0('0x9'));var crypto=require(_0x96e0('0xa'));var jsforce=require(_0x96e0('0xb'));var deskjs=require(_0x96e0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x96e0('0xd'));var Redis=require(_0x96e0('0xe'));var authService=require(_0x96e0('0xf'));var qs=require(_0x96e0('0x10'));var as=require(_0x96e0('0x11'));var hardwareService=require(_0x96e0('0x12'));var logger=require(_0x96e0('0x13'))(_0x96e0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x96e0('0x15'))['db'];function respondWithStatusCode(_0x58fa38,_0x3eb8aa){_0x3eb8aa=_0x3eb8aa||0xcc;return function(_0x3c2785){if(_0x3c2785){return _0x58fa38['sendStatus'](_0x3eb8aa);}return _0x58fa38['status'](_0x3eb8aa)[_0x96e0('0x16')]();};}function respondWithResult(_0x1dd5f0,_0x29db39){_0x29db39=_0x29db39||0xc8;return function(_0x2b0a15){if(_0x2b0a15){return _0x1dd5f0[_0x96e0('0x17')](_0x29db39)[_0x96e0('0x18')](_0x2b0a15);}};}function respondWithFilteredResult(_0x6dbf10,_0x1dff65){return function(_0x529fe8){if(_0x529fe8){var _0x54c61f=typeof _0x1dff65['offset']===_0x96e0('0x19')&&typeof _0x1dff65[_0x96e0('0x1a')]===_0x96e0('0x19');var _0x374c50=_0x529fe8[_0x96e0('0x1b')];var _0xff6cc0=_0x54c61f?0x0:_0x1dff65[_0x96e0('0x1c')];var _0xdcdd37=_0x54c61f?_0x529fe8[_0x96e0('0x1b')]:_0x1dff65[_0x96e0('0x1c')]+_0x1dff65[_0x96e0('0x1a')];var _0x1d4721;if(_0xdcdd37>=_0x374c50){_0xdcdd37=_0x374c50;_0x1d4721=0xc8;}else{_0x1d4721=0xce;}_0x6dbf10[_0x96e0('0x17')](_0x1d4721);return _0x6dbf10[_0x96e0('0x1d')]('Content-Range',_0xff6cc0+'-'+_0xdcdd37+'/'+_0x374c50)[_0x96e0('0x18')](_0x529fe8);}return null;};}function patchUpdates(_0x25caf9){return function(_0x3cc7a2){try{jsonpatch[_0x96e0('0x1e')](_0x3cc7a2,_0x25caf9,!![]);}catch(_0x454fdc){return BPromise['reject'](_0x454fdc);}return _0x3cc7a2[_0x96e0('0x1f')]();};}function saveUpdates(_0x1301bc,_0x5120ad){return function(_0x36b5a7){if(_0x36b5a7){return _0x36b5a7[_0x96e0('0x20')](_0x1301bc)[_0x96e0('0x21')](function(_0x4c20c7){return _0x4c20c7;});}return null;};}function removeEntity(_0x5d6915,_0x4d61ab){return function(_0x5d876a){if(_0x5d876a){return _0x5d876a[_0x96e0('0x22')]()[_0x96e0('0x21')](function(){var _0x37fd49=_0x5d876a[_0x96e0('0x23')]({'plain':!![]});var _0x4ed991=_0x96e0('0x24');return db[_0x96e0('0x25')]['destroy']({'where':{'type':_0x4ed991,'resourceId':_0x37fd49['id']}})[_0x96e0('0x21')](function(){return _0x5d876a;});})['then'](function(){_0x5d6915['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x287509,_0x1abea7){return function(_0xd3803e){if(!_0xd3803e){_0x287509[_0x96e0('0x26')](0x194);}return _0xd3803e;};}function handleError(_0x334ca3,_0x15d7b7){_0x15d7b7=_0x15d7b7||0x1f4;return function(_0x506da8){logger['error'](_0x506da8[_0x96e0('0x27')]);if(_0x506da8[_0x96e0('0x28')]){delete _0x506da8[_0x96e0('0x28')];}_0x334ca3[_0x96e0('0x17')](_0x15d7b7)['send'](_0x506da8);};}exports[_0x96e0('0x29')]=function(_0x4cf567,_0x474ee0){var _0x4cf698={},_0x3b666c={},_0x2c403c={'count':0x0,'rows':[]};var _0x4fd51e=_[_0x96e0('0x2a')](db[_0x96e0('0x2b')][_0x96e0('0x2c')],function(_0x440534){return{'name':_0x440534[_0x96e0('0x2d')],'type':_0x440534['type'][_0x96e0('0x2e')]};});_0x3b666c[_0x96e0('0x2f')]=_[_0x96e0('0x2a')](_0x4fd51e,_0x96e0('0x28'));_0x3b666c[_0x96e0('0x30')]=_[_0x96e0('0x31')](_0x4cf567[_0x96e0('0x30')]);_0x3b666c['filters']=_['intersection'](_0x3b666c[_0x96e0('0x2f')],_0x3b666c[_0x96e0('0x30')]);_0x4cf698['attributes']=_[_0x96e0('0x32')](_0x3b666c[_0x96e0('0x2f')],qs['fields'](_0x4cf567[_0x96e0('0x30')][_0x96e0('0x33')]));_0x4cf698[_0x96e0('0x34')]=_0x4cf698[_0x96e0('0x34')][_0x96e0('0x35')]?_0x4cf698[_0x96e0('0x34')]:_0x3b666c['model'];if(!_0x4cf567['query'][_0x96e0('0x36')](_0x96e0('0x37'))){_0x4cf698[_0x96e0('0x1a')]=qs[_0x96e0('0x1a')](_0x4cf567[_0x96e0('0x30')]['limit']);_0x4cf698[_0x96e0('0x1c')]=qs[_0x96e0('0x1c')](_0x4cf567[_0x96e0('0x30')][_0x96e0('0x1c')]);}_0x4cf698[_0x96e0('0x38')]=qs[_0x96e0('0x39')](_0x4cf567['query'][_0x96e0('0x39')]);_0x4cf698[_0x96e0('0x3a')]=qs[_0x96e0('0x3b')](_[_0x96e0('0x3c')](_0x4cf567['query'],_0x3b666c[_0x96e0('0x3b')]),_0x4fd51e);if(_0x4cf567[_0x96e0('0x30')][_0x96e0('0x3d')]){_0x4cf698[_0x96e0('0x3a')]=_['merge'](_0x4cf698[_0x96e0('0x3a')],{'$or':_[_0x96e0('0x2a')](_0x4fd51e,function(_0x48bec4){if(_0x48bec4['type']!==_0x96e0('0x3e')){var _0x1954c1={};_0x1954c1[_0x48bec4[_0x96e0('0x28')]]={'$like':'%'+_0x4cf567[_0x96e0('0x30')][_0x96e0('0x3d')]+'%'};return _0x1954c1;}})});}_0x4cf698=_['merge']({},_0x4cf698,_0x4cf567[_0x96e0('0x3f')]);var _0x562801={'where':_0x4cf698[_0x96e0('0x3a')]};return db[_0x96e0('0x2b')]['count'](_0x562801)[_0x96e0('0x21')](function(_0x397904){_0x2c403c[_0x96e0('0x1b')]=_0x397904;if(_0x4cf567[_0x96e0('0x30')][_0x96e0('0x40')]){_0x4cf698['include']=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x4cf698);})[_0x96e0('0x21')](function(_0x4ca848){_0x2c403c[_0x96e0('0x41')]=_0x4ca848;return _0x2c403c;})[_0x96e0('0x21')](respondWithFilteredResult(_0x474ee0,_0x4cf698))[_0x96e0('0x42')](handleError(_0x474ee0,null));};exports[_0x96e0('0x43')]=function(_0x17d4bd,_0x277cd4){var _0x410b1f={'raw':!![],'where':{'id':_0x17d4bd['params']['id']}},_0x5ab83f={};_0x5ab83f[_0x96e0('0x2f')]=_['keys'](db[_0x96e0('0x2b')][_0x96e0('0x2c')]);_0x5ab83f['query']=_[_0x96e0('0x31')](_0x17d4bd[_0x96e0('0x30')]);_0x5ab83f[_0x96e0('0x3b')]=_[_0x96e0('0x32')](_0x5ab83f[_0x96e0('0x2f')],_0x5ab83f[_0x96e0('0x30')]);_0x410b1f['attributes']=_[_0x96e0('0x32')](_0x5ab83f['model'],qs[_0x96e0('0x33')](_0x17d4bd[_0x96e0('0x30')][_0x96e0('0x33')]));_0x410b1f[_0x96e0('0x34')]=_0x410b1f[_0x96e0('0x34')][_0x96e0('0x35')]?_0x410b1f[_0x96e0('0x34')]:_0x5ab83f[_0x96e0('0x2f')];if(_0x17d4bd[_0x96e0('0x30')][_0x96e0('0x40')]){_0x410b1f['include']=[{'all':!![]}];}_0x410b1f=_[_0x96e0('0x44')]({},_0x410b1f,_0x17d4bd[_0x96e0('0x3f')]);return db[_0x96e0('0x2b')]['find'](_0x410b1f)['then'](handleEntityNotFound(_0x277cd4,null))[_0x96e0('0x21')](respondWithResult(_0x277cd4,null))['catch'](handleError(_0x277cd4,null));};exports[_0x96e0('0x45')]=function(_0x56c202,_0x4ce2ef){return db[_0x96e0('0x2b')][_0x96e0('0x45')](_0x56c202[_0x96e0('0x46')],{})[_0x96e0('0x21')](function(_0x401f9c){var _0x39953d=_0x56c202[_0x96e0('0x47')][_0x96e0('0x23')]({'plain':!![]});if(!_0x39953d)throw new Error(_0x96e0('0x48'));if(_0x39953d[_0x96e0('0x49')]===_0x96e0('0x47')){var _0xf348a6=_0x401f9c[_0x96e0('0x23')]({'plain':!![]});var _0x1e19e1=_0x96e0('0x24');return db[_0x96e0('0x4a')][_0x96e0('0x4b')]({'where':{'name':_0x1e19e1,'userProfileId':_0x39953d[_0x96e0('0x4c')]},'raw':!![]})[_0x96e0('0x21')](function(_0x4a10c1){if(_0x4a10c1&&_0x4a10c1['autoAssociation']===0x0){return db[_0x96e0('0x25')][_0x96e0('0x45')]({'name':_0xf348a6[_0x96e0('0x28')],'resourceId':_0xf348a6['id'],'type':_0x4a10c1['name'],'sectionId':_0x4a10c1['id']},{})[_0x96e0('0x21')](function(){return _0x401f9c;});}else{return _0x401f9c;}})[_0x96e0('0x42')](function(_0x15ce8d){logger['error'](_0x96e0('0x4d'),_0x15ce8d);throw _0x15ce8d;});}return _0x401f9c;})[_0x96e0('0x21')](respondWithResult(_0x4ce2ef,0xc9))[_0x96e0('0x42')](handleError(_0x4ce2ef,null));};exports[_0x96e0('0x20')]=function(_0x9d2951,_0xa8c5ca){if(_0x9d2951['body']['id']){delete _0x9d2951[_0x96e0('0x46')]['id'];}return db[_0x96e0('0x2b')][_0x96e0('0x4b')]({'where':{'id':_0x9d2951[_0x96e0('0x4e')]['id']}})[_0x96e0('0x21')](handleEntityNotFound(_0xa8c5ca,null))[_0x96e0('0x21')](saveUpdates(_0x9d2951['body'],null))[_0x96e0('0x21')](respondWithResult(_0xa8c5ca,null))[_0x96e0('0x42')](handleError(_0xa8c5ca,null));};exports[_0x96e0('0x22')]=function(_0x2fa907,_0x116c29){return db[_0x96e0('0x2b')]['find']({'where':{'id':_0x2fa907[_0x96e0('0x4e')]['id']}})[_0x96e0('0x21')](handleEntityNotFound(_0x116c29,null))[_0x96e0('0x21')](removeEntity(_0x116c29,null))['catch'](handleError(_0x116c29,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e2406a3..930d269 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','util'];(function(_0x285426,_0x30d8be){var _0x101dd5=function(_0x3b8340){while(--_0x3b8340){_0x285426['push'](_0x285426['shift']());}};_0x101dd5(++_0x30d8be);}(_0x6f47,0xc7));var _0x76f4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6f47[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','util','../../config/logger','api','moment'];(function(_0x2f5bbc,_0x277b93){var _0x2f6675=function(_0x216530){while(--_0x216530){_0x2f5bbc['push'](_0x2f5bbc['shift']());}};_0x2f6675(++_0x277b93);}(_0xba34,0x119));var _0x4ba3=function(_0xccb5d6,_0x540a06){_0xccb5d6=_0xccb5d6-0x0;var _0x49b89c=_0xba34[_0xccb5d6];return _0x49b89c;};'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')]('CmContactHasItem',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 7c6d56e..c2ad370 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa92e=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x46920d,_0x1b30c9){var _0x4f5814=function(_0xe5c891){while(--_0xe5c891){_0x46920d['push'](_0x46920d['shift']());}};_0x4f5814(++_0x1b30c9);}(_0xa92e,0x1e5));var _0xea92=function(_0x464225,_0x5133ff){_0x464225=_0x464225-0x0;var _0x302494=_0xa92e[_0x464225];return _0x302494;};'use strict';var _=require(_0xea92('0x0'));var util=require('util');var moment=require(_0xea92('0x1'));var BPromise=require(_0xea92('0x2'));var rs=require(_0xea92('0x3'));var fs=require('fs');var Redis=require(_0xea92('0x4'));var db=require(_0xea92('0x5'))['db'];var utils=require(_0xea92('0x6'));var logger=require(_0xea92('0x7'))(_0xea92('0x8'));var config=require('../../config/environment');var jayson=require(_0xea92('0x9'));var client=jayson[_0xea92('0xa')][_0xea92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fd307,_0x154cd2,_0x1da756){return new BPromise(function(_0x1fd59d,_0x564a22){return client[_0xea92('0xc')](_0x1fd307,_0x1da756)['then'](function(_0x2647a5){logger['info'](_0xea92('0xd'),_0x154cd2,_0xea92('0xe'));logger['debug'](_0xea92('0xf'),_0x154cd2,'request\x20sent',JSON['stringify'](_0x2647a5));if(_0x2647a5[_0xea92('0x10')]){if(_0x2647a5[_0xea92('0x10')]['code']===0x1f4){logger[_0xea92('0x10')](_0xea92('0xd'),_0x154cd2,_0x2647a5[_0xea92('0x10')][_0xea92('0x11')]);return _0x564a22(_0x2647a5[_0xea92('0x10')][_0xea92('0x11')]);}logger[_0xea92('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x154cd2,_0x2647a5[_0xea92('0x10')]['message']);return _0x1fd59d(_0x2647a5[_0xea92('0x10')][_0xea92('0x11')]);}else{logger[_0xea92('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x154cd2,_0xea92('0xe'));_0x1fd59d(_0x2647a5[_0xea92('0x13')][_0xea92('0x11')]);}})[_0xea92('0x14')](function(_0x1b9e1a){logger[_0xea92('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x154cd2,_0x1b9e1a);_0x564a22(_0x1b9e1a);});});} \ No newline at end of file +var _0x943c=['stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0xe6ef55,_0x268163){var _0x257f87=function(_0x46551f){while(--_0x46551f){_0xe6ef55['push'](_0xe6ef55['shift']());}};_0x257f87(++_0x268163);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var moment=require(_0xc943('0x2'));var BPromise=require(_0xc943('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc943('0x4'))['db'];var utils=require(_0xc943('0x5'));var logger=require(_0xc943('0x6'))('rpc');var config=require(_0xc943('0x7'));var jayson=require(_0xc943('0x8'));var client=jayson[_0xc943('0x9')][_0xc943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b73ad,_0x4091fd,_0x3f718f){return new BPromise(function(_0x56e665,_0x3ec7da){return client[_0xc943('0xb')](_0x1b73ad,_0x3f718f)[_0xc943('0xc')](function(_0x455eed){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));logger[_0xc943('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4091fd,'request\x20sent',JSON[_0xc943('0xf')](_0x455eed));if(_0x455eed[_0xc943('0x10')]){if(_0x455eed[_0xc943('0x10')][_0xc943('0x11')]===0x1f4){logger[_0xc943('0x10')](_0xc943('0x12'),_0x4091fd,_0x455eed['error'][_0xc943('0x13')]);return _0x3ec7da(_0x455eed[_0xc943('0x10')]['message']);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4091fd,_0x455eed[_0xc943('0x10')][_0xc943('0x13')]);return _0x56e665(_0x455eed['error'][_0xc943('0x13')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));_0x56e665(_0x455eed['result'][_0xc943('0x13')]);}})[_0xc943('0x14')](function(_0x1eb50a){logger[_0xc943('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x4091fd,_0x1eb50a);_0x3ec7da(_0x1eb50a);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b1e3fd2..0eae49e 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3feb=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','show','post','create','put','/:id','destroy'];(function(_0x1cb2e6,_0x2ccaf8){var _0x15f8c0=function(_0x41726a){while(--_0x41726a){_0x1cb2e6['push'](_0x1cb2e6['shift']());}};_0x15f8c0(++_0x2ccaf8);}(_0x3feb,0x1c3));var _0xb3fe=function(_0x391a4f,_0x591b29){_0x391a4f=_0x391a4f-0x0;var _0x172065=_0x3feb[_0x391a4f];return _0x172065;};'use strict';var multer=require('multer');var util=require(_0xb3fe('0x0'));var path=require(_0xb3fe('0x1'));var timeout=require(_0xb3fe('0x2'));var express=require('express');var router=express[_0xb3fe('0x3')]();var fs_extra=require(_0xb3fe('0x4'));var auth=require(_0xb3fe('0x5'));var interaction=require(_0xb3fe('0x6'));var config=require(_0xb3fe('0x7'));var controller=require(_0xb3fe('0x8'));router[_0xb3fe('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb3fe('0x9')]('/:id',auth[_0xb3fe('0xa')](),controller[_0xb3fe('0xb')]);router[_0xb3fe('0xc')]('/',auth[_0xb3fe('0xa')](),controller[_0xb3fe('0xd')]);router[_0xb3fe('0xe')]('/:id',auth[_0xb3fe('0xa')](),controller['update']);router['delete'](_0xb3fe('0xf'),auth[_0xb3fe('0xa')](),controller[_0xb3fe('0x10')]);module[_0xb3fe('0x11')]=router; \ No newline at end of file +var _0x1131=['index','/:id','post','put','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated'];(function(_0x713d84,_0x17e3ae){var _0x4e170e=function(_0x4adb4b){while(--_0x4adb4b){_0x713d84['push'](_0x713d84['shift']());}};_0x4e170e(++_0x17e3ae);}(_0x1131,0x14e));var _0x1113=function(_0x58edae,_0xc498f5){_0x58edae=_0x58edae-0x0;var _0x58e85d=_0x1131[_0x58edae];return _0x58e85d;};'use strict';var multer=require(_0x1113('0x0'));var util=require(_0x1113('0x1'));var path=require('path');var timeout=require(_0x1113('0x2'));var express=require(_0x1113('0x3'));var router=express[_0x1113('0x4')]();var fs_extra=require(_0x1113('0x5'));var auth=require(_0x1113('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1113('0x7'));var controller=require(_0x1113('0x8'));router[_0x1113('0x9')]('/',auth[_0x1113('0xa')](),controller[_0x1113('0xb')]);router[_0x1113('0x9')](_0x1113('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1113('0xd')]('/',auth[_0x1113('0xa')](),controller['create']);router[_0x1113('0xe')](_0x1113('0xc'),auth[_0x1113('0xa')](),controller['update']);router['delete'](_0x1113('0xc'),auth[_0x1113('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index c267b94..b41e2bf 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 _0x5301=['stringify','BOOLEAN','voice','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','type','select','parse','values','isArray'];(function(_0x5900f6,_0x1ff746){var _0x3bb4ab=function(_0x1c49ec){while(--_0x1c49ec){_0x5900f6['push'](_0x5900f6['shift']());}};_0x3bb4ab(++_0x1ff746);}(_0x5301,0x157));var _0x1530=function(_0xebb8b1,_0x24c462){_0xebb8b1=_0xebb8b1-0x0;var _0x44ff13=_0x5301[_0xebb8b1];return _0x44ff13;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1530('0x0'));module[_0x1530('0x1')]={'name':{'type':Sequelize[_0x1530('0x2')],'get':function(_0x126400){return this[_0x1530('0x3')]('alias');}},'alias':{'type':Sequelize[_0x1530('0x4')],'allowNull':![],'set':function(_0x639c58){this[_0x1530('0x5')](_0x1530('0x6'),_0x639c58?_0x639c58:this['getDataValue'](_0x1530('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x1530('0x8')]('long'),'get':function(){if(this[_0x1530('0x3')](_0x1530('0x9'))===_0x1530('0xa')){return JSON[_0x1530('0xb')](this[_0x1530('0x3')]('values'));}else{return this['getDataValue'](_0x1530('0xc'));}},'set':function(_0x46fc58){if(Array[_0x1530('0xd')](_0x46fc58)){this[_0x1530('0x5')]('values',JSON[_0x1530('0xe')](_0x46fc58));}else{this[_0x1530('0x5')](_0x1530('0xc'),_0x46fc58);}}},'required':{'type':Sequelize[_0x1530('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x1530('0x10'))}}; \ No newline at end of file +var _0x29d4=['ENUM','sequelize','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','parse','values','stringify','BOOLEAN'];(function(_0x259ce8,_0x798276){var _0x5ef5c2=function(_0x1bb84e){while(--_0x1bb84e){_0x259ce8['push'](_0x259ce8['shift']());}};_0x5ef5c2(++_0x798276);}(_0x29d4,0x1a1));var _0x429d=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x29d4[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x429d('0x0'));var _=require('lodash');module[_0x429d('0x1')]={'name':{'type':Sequelize[_0x429d('0x2')],'get':function(_0x16ce75){return this[_0x429d('0x3')](_0x429d('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xc3989d){this[_0x429d('0x5')](_0x429d('0x4'),_0xc3989d?_0xc3989d:this[_0x429d('0x3')](_0x429d('0x6')));}},'type':{'type':Sequelize[_0x429d('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x429d('0x8')](_0x429d('0x9')),'get':function(){if(this['getDataValue'](_0x429d('0xa'))==='select'){return JSON[_0x429d('0xb')](this[_0x429d('0x3')](_0x429d('0xc')));}else{return this['getDataValue'](_0x429d('0xc'));}},'set':function(_0x8c7cb6){if(Array['isArray'](_0x8c7cb6)){this[_0x429d('0x5')](_0x429d('0xc'),JSON[_0x429d('0xd')](_0x8c7cb6));}else{this['setDataValue'](_0x429d('0xc'),_0x8c7cb6);}}},'required':{'type':Sequelize[_0x429d('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x429d('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x429d('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a5f0e70..ac8e4c9 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 _0xf19c=['fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','CmCustomField','rawAttributes','fieldName','model','differenceBy','map','query','keys','filters','intersection','attributes'];(function(_0x1b42ff,_0x1e5564){var _0x186aef=function(_0x3b4218){while(--_0x3b4218){_0x1b42ff['push'](_0x1b42ff['shift']());}};_0x186aef(++_0x1e5564);}(_0xf19c,0x12a));var _0xcf19=function(_0x424c92,_0x19635c){_0x424c92=_0x424c92-0x0;var _0x21d904=_0xf19c[_0x424c92];return _0x21d904;};'use strict';var emlformat=require(_0xcf19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf19('0x1'));var jsonpatch=require(_0xcf19('0x2'));var rp=require(_0xcf19('0x3'));var moment=require(_0xcf19('0x4'));var BPromise=require(_0xcf19('0x5'));var Mustache=require(_0xcf19('0x6'));var util=require(_0xcf19('0x7'));var path=require(_0xcf19('0x8'));var sox=require(_0xcf19('0x9'));var csv=require(_0xcf19('0xa'));var ejs=require(_0xcf19('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcf19('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcf19('0xd'));var toCsv=require(_0xcf19('0xa'));var querystring=require('querystring');var Papa=require(_0xcf19('0xe'));var Redis=require('ioredis');var authService=require(_0xcf19('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcf19('0x10'));var hardwareService=require(_0xcf19('0x11'));var logger=require(_0xcf19('0x12'))(_0xcf19('0x13'));var utils=require(_0xcf19('0x14'));var config=require(_0xcf19('0x15'));var licenseUtil=require(_0xcf19('0x16'));var db=require(_0xcf19('0x17'))['db'];function respondWithStatusCode(_0xba7295,_0x1d8f7d){_0x1d8f7d=_0x1d8f7d||0xcc;return function(_0x516d92){if(_0x516d92){return _0xba7295[_0xcf19('0x18')](_0x1d8f7d);}return _0xba7295[_0xcf19('0x19')](_0x1d8f7d)[_0xcf19('0x1a')]();};}function respondWithResult(_0x42a346,_0x15a5a0){_0x15a5a0=_0x15a5a0||0xc8;return function(_0x18dc9e){if(_0x18dc9e){return _0x42a346[_0xcf19('0x19')](_0x15a5a0)['json'](_0x18dc9e);}};}function respondWithFilteredResult(_0x3591e6,_0xac2680){return function(_0x3846e9){if(_0x3846e9){var _0x3c3f0c=typeof _0xac2680[_0xcf19('0x1b')]===_0xcf19('0x1c')&&typeof _0xac2680[_0xcf19('0x1d')]===_0xcf19('0x1c');var _0x6cb90d=_0x3846e9['count'];var _0x4aebbc=_0x3c3f0c?0x0:_0xac2680[_0xcf19('0x1b')];var _0x5afb5e=_0x3c3f0c?_0x3846e9[_0xcf19('0x1e')]:_0xac2680[_0xcf19('0x1b')]+_0xac2680[_0xcf19('0x1d')];var _0x36af31;if(_0x5afb5e>=_0x6cb90d){_0x5afb5e=_0x6cb90d;_0x36af31=0xc8;}else{_0x36af31=0xce;}_0x3591e6['status'](_0x36af31);return _0x3591e6[_0xcf19('0x1f')](_0xcf19('0x20'),_0x4aebbc+'-'+_0x5afb5e+'/'+_0x6cb90d)[_0xcf19('0x21')](_0x3846e9);}return null;};}function patchUpdates(_0xdf8b36){return function(_0x5b1b74){try{jsonpatch[_0xcf19('0x22')](_0x5b1b74,_0xdf8b36,!![]);}catch(_0x541651){return BPromise[_0xcf19('0x23')](_0x541651);}return _0x5b1b74[_0xcf19('0x24')]();};}function saveUpdates(_0x5b3a9a,_0x463ff1){return function(_0x541a37){if(_0x541a37){return _0x541a37[_0xcf19('0x25')](_0x5b3a9a)[_0xcf19('0x26')](function(_0x33c6a9){return _0x33c6a9;});}return null;};}function removeEntity(_0x3084c8,_0x6b865){return function(_0x31edce){if(_0x31edce){return _0x31edce['destroy']()[_0xcf19('0x26')](function(){_0x3084c8[_0xcf19('0x19')](0xcc)[_0xcf19('0x1a')]();});}};}function handleEntityNotFound(_0xe7d512,_0x15fb0a){return function(_0x53d2fc){if(!_0x53d2fc){_0xe7d512['sendStatus'](0x194);}return _0x53d2fc;};}function handleError(_0x4e3ce8,_0x250a12){_0x250a12=_0x250a12||0x1f4;return function(_0xe27697){logger['error'](_0xe27697[_0xcf19('0x27')]);if(_0xe27697[_0xcf19('0x28')]){delete _0xe27697[_0xcf19('0x28')];}_0x4e3ce8['status'](_0x250a12)[_0xcf19('0x29')](_0xe27697);};}exports[_0xcf19('0x2a')]=function(_0x33e83d,_0x10722e){var _0x35b896={},_0x470618={},_0x4704b1={'count':0x0,'rows':[]};var _0x154d0e=_['map'](db[_0xcf19('0x2b')][_0xcf19('0x2c')],function(_0x2845db){return{'name':_0x2845db[_0xcf19('0x2d')],'type':_0x2845db['type']['key']};});_0x470618[_0xcf19('0x2e')]=_[_0xcf19('0x2f')](_[_0xcf19('0x30')](_0x154d0e,_0xcf19('0x28')),['name']);_0x470618[_0xcf19('0x31')]=_[_0xcf19('0x32')](_0x33e83d[_0xcf19('0x31')]);_0x470618[_0xcf19('0x33')]=_[_0xcf19('0x34')](_0x470618[_0xcf19('0x2e')],_0x470618[_0xcf19('0x31')]);_0x35b896[_0xcf19('0x35')]=_[_0xcf19('0x34')](_0x470618[_0xcf19('0x2e')],qs[_0xcf19('0x36')](_0x33e83d[_0xcf19('0x31')][_0xcf19('0x36')]));_0x35b896[_0xcf19('0x35')]=_0x35b896[_0xcf19('0x35')]['length']?_0x35b896[_0xcf19('0x35')]:_0x470618[_0xcf19('0x2e')];if(!_0x33e83d[_0xcf19('0x31')][_0xcf19('0x37')](_0xcf19('0x38'))){_0x35b896[_0xcf19('0x1d')]=qs['limit'](_0x33e83d[_0xcf19('0x31')][_0xcf19('0x1d')]);_0x35b896[_0xcf19('0x1b')]=qs[_0xcf19('0x1b')](_0x33e83d[_0xcf19('0x31')]['offset']);}_0x35b896['order']=qs[_0xcf19('0x39')](_0x33e83d[_0xcf19('0x31')][_0xcf19('0x39')]);_0x35b896[_0xcf19('0x3a')]=qs['filters'](_[_0xcf19('0x3b')](_0x33e83d[_0xcf19('0x31')],_0x470618[_0xcf19('0x33')]),_0x154d0e);if(_0x33e83d[_0xcf19('0x31')]['filter']){_0x35b896[_0xcf19('0x3a')]=_[_0xcf19('0x3c')](_0x35b896[_0xcf19('0x3a')],{'$or':_['map'](_0x154d0e,function(_0x4e77ef){if(_0x4e77ef[_0xcf19('0x3d')]!==_0xcf19('0x3e')){var _0x5b17d0={};_0x5b17d0[_0x4e77ef['name']]={'$like':'%'+_0x33e83d[_0xcf19('0x31')]['filter']+'%'};return _0x5b17d0;}})});}_0x35b896=_['merge']({},_0x35b896,_0x33e83d['options']);var _0x1caf6e={'where':_0x35b896['where']};return db[_0xcf19('0x2b')]['count'](_0x1caf6e)[_0xcf19('0x26')](function(_0x4aa301){_0x4704b1[_0xcf19('0x1e')]=_0x4aa301;if(_0x33e83d[_0xcf19('0x31')][_0xcf19('0x3f')]){_0x35b896[_0xcf19('0x40')]=[{'all':!![]}];}return db[_0xcf19('0x2b')][_0xcf19('0x41')](_0x35b896);})['then'](function(_0x416f28){_0x4704b1[_0xcf19('0x42')]=_0x416f28;return _0x4704b1;})[_0xcf19('0x26')](respondWithFilteredResult(_0x10722e,_0x35b896))[_0xcf19('0x43')](handleError(_0x10722e,null));};exports[_0xcf19('0x44')]=function(_0x5d5344,_0x4a9ab1){var _0x124a77={'raw':!![],'where':{'id':_0x5d5344[_0xcf19('0x45')]['id']}},_0x136818={};_0x136818[_0xcf19('0x2e')]=_[_0xcf19('0x32')](db[_0xcf19('0x2b')][_0xcf19('0x2c')]);_0x136818[_0xcf19('0x31')]=_['keys'](_0x5d5344[_0xcf19('0x31')]);_0x136818[_0xcf19('0x33')]=_[_0xcf19('0x34')](_0x136818[_0xcf19('0x2e')],_0x136818['query']);_0x124a77[_0xcf19('0x35')]=_[_0xcf19('0x34')](_0x136818[_0xcf19('0x2e')],qs['fields'](_0x5d5344[_0xcf19('0x31')][_0xcf19('0x36')]));_0x124a77[_0xcf19('0x35')]=_0x124a77[_0xcf19('0x35')]['length']?_0x124a77[_0xcf19('0x35')]:_0x136818[_0xcf19('0x2e')];if(_0x5d5344[_0xcf19('0x31')][_0xcf19('0x3f')]){_0x124a77[_0xcf19('0x40')]=[{'all':!![]}];}_0x124a77=_['merge']({},_0x124a77,_0x5d5344[_0xcf19('0x46')]);return db['CmCustomField'][_0xcf19('0x47')](_0x124a77)[_0xcf19('0x26')](handleEntityNotFound(_0x4a9ab1,null))[_0xcf19('0x26')](respondWithResult(_0x4a9ab1,null))['catch'](handleError(_0x4a9ab1,null));};exports[_0xcf19('0x25')]=function(_0xbd341c,_0x1ef33c){if(_0xbd341c[_0xcf19('0x48')]['id']){delete _0xbd341c['body']['id'];}return db[_0xcf19('0x2b')][_0xcf19('0x47')]({'where':{'id':_0xbd341c[_0xcf19('0x45')]['id']}})[_0xcf19('0x26')](handleEntityNotFound(_0x1ef33c,null))['then'](saveUpdates(_0xbd341c[_0xcf19('0x48')],null))['then'](respondWithResult(_0x1ef33c,null))['catch'](handleError(_0x1ef33c,null));};exports[_0xcf19('0x49')]=function(_0x51f58e,_0x5aab42){return db[_0xcf19('0x2b')][_0xcf19('0x47')]({'where':{'id':_0x51f58e[_0xcf19('0x45')]['id']}})[_0xcf19('0x26')](handleEntityNotFound(_0x5aab42,null))['then'](removeEntity(_0x5aab42,null))[_0xcf19('0x43')](handleError(_0x5aab42,null));};exports[_0xcf19('0x4a')]=function(_0x1b1f0a,_0x310627){var _0x2207a5;return db[_0xcf19('0x4b')][_0xcf19('0x4c')](function(_0x52b8e6){return db['CmCustomField'][_0xcf19('0x4a')](_0x1b1f0a[_0xcf19('0x48')],{'transaction':_0x52b8e6})[_0xcf19('0x26')](function(_0x329564){_0x2207a5=_0x329564;var _0x2a50d0={'type':db[_0xcf19('0x4d')]['TEXT'],'transaction':_0x52b8e6};switch(_0x1b1f0a[_0xcf19('0x48')][_0xcf19('0x3d')]){case'text':_0x2a50d0['type']=db[_0xcf19('0x4d')][_0xcf19('0x4e')];break;case _0xcf19('0x4f'):_0x2a50d0[_0xcf19('0x3d')]=db[_0xcf19('0x4d')][_0xcf19('0x50')];break;case'switch':_0x2a50d0['type']=db[_0xcf19('0x4d')][_0xcf19('0x51')];_0x2a50d0[_0xcf19('0x52')]=![];break;default:}return db[_0xcf19('0x4b')][_0xcf19('0x53')][_0xcf19('0x54')](_0xcf19('0x55'),util[_0xcf19('0x56')](_0xcf19('0x57'),_0x2207a5['id']),_0x2a50d0);})[_0xcf19('0x26')](function(){return _0x2207a5;});})[_0xcf19('0x26')](respondWithResult(_0x310627,0xc9))[_0xcf19('0x43')](handleError(_0x310627,null));}; \ No newline at end of file +var _0x720c=['switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','params','keys','include','find','body','catch','create','transaction','Sequelize','text','number','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x720c,0x102));var _0xc720=function(_0x961b28,_0x1fdbaa){_0x961b28=_0x961b28-0x0;var _0x477083=_0x720c[_0x961b28];return _0x477083;};'use strict';var emlformat=require(_0xc720('0x0'));var rimraf=require(_0xc720('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc720('0x2'));var moment=require(_0xc720('0x3'));var BPromise=require(_0xc720('0x4'));var Mustache=require('mustache');var util=require(_0xc720('0x5'));var path=require(_0xc720('0x6'));var sox=require(_0xc720('0x7'));var csv=require(_0xc720('0x8'));var ejs=require(_0xc720('0x9'));var fs=require('fs');var fs_extra=require(_0xc720('0xa'));var _=require(_0xc720('0xb'));var squel=require(_0xc720('0xc'));var crypto=require(_0xc720('0xd'));var jsforce=require(_0xc720('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc720('0x8'));var querystring=require(_0xc720('0xf'));var Papa=require(_0xc720('0x10'));var Redis=require(_0xc720('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc720('0x12'));var logger=require('../../config/logger')(_0xc720('0x13'));var utils=require('../../config/utils');var config=require(_0xc720('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x360206,_0x5824cf){_0x5824cf=_0x5824cf||0xcc;return function(_0x4188ed){if(_0x4188ed){return _0x360206[_0xc720('0x15')](_0x5824cf);}return _0x360206[_0xc720('0x16')](_0x5824cf)[_0xc720('0x17')]();};}function respondWithResult(_0x21da68,_0x1f26f7){_0x1f26f7=_0x1f26f7||0xc8;return function(_0x10ce3c){if(_0x10ce3c){return _0x21da68[_0xc720('0x16')](_0x1f26f7)[_0xc720('0x18')](_0x10ce3c);}};}function respondWithFilteredResult(_0xc557a,_0x4a515a){return function(_0x55df28){if(_0x55df28){var _0x119e07=typeof _0x4a515a[_0xc720('0x19')]===_0xc720('0x1a')&&typeof _0x4a515a[_0xc720('0x1b')]===_0xc720('0x1a');var _0x185a3f=_0x55df28[_0xc720('0x1c')];var _0x5f0fe6=_0x119e07?0x0:_0x4a515a[_0xc720('0x19')];var _0x3d1ba1=_0x119e07?_0x55df28[_0xc720('0x1c')]:_0x4a515a['offset']+_0x4a515a[_0xc720('0x1b')];var _0x448309;if(_0x3d1ba1>=_0x185a3f){_0x3d1ba1=_0x185a3f;_0x448309=0xc8;}else{_0x448309=0xce;}_0xc557a[_0xc720('0x16')](_0x448309);return _0xc557a['set'](_0xc720('0x1d'),_0x5f0fe6+'-'+_0x3d1ba1+'/'+_0x185a3f)['json'](_0x55df28);}return null;};}function patchUpdates(_0x348c66){return function(_0x286497){try{jsonpatch[_0xc720('0x1e')](_0x286497,_0x348c66,!![]);}catch(_0x28bead){return BPromise[_0xc720('0x1f')](_0x28bead);}return _0x286497[_0xc720('0x20')]();};}function saveUpdates(_0x14dc09,_0x121bf6){return function(_0x5151c5){if(_0x5151c5){return _0x5151c5[_0xc720('0x21')](_0x14dc09)[_0xc720('0x22')](function(_0x1c7110){return _0x1c7110;});}return null;};}function removeEntity(_0x205e95,_0xacf152){return function(_0x2412a2){if(_0x2412a2){return _0x2412a2['destroy']()['then'](function(){_0x205e95[_0xc720('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7032,_0x195c87){return function(_0x4cee74){if(!_0x4cee74){_0x5c7032[_0xc720('0x15')](0x194);}return _0x4cee74;};}function handleError(_0x33a7ea,_0x5a3ae7){_0x5a3ae7=_0x5a3ae7||0x1f4;return function(_0x260b77){logger[_0xc720('0x23')](_0x260b77[_0xc720('0x24')]);if(_0x260b77[_0xc720('0x25')]){delete _0x260b77[_0xc720('0x25')];}_0x33a7ea['status'](_0x5a3ae7)[_0xc720('0x26')](_0x260b77);};}exports[_0xc720('0x27')]=function(_0x1a012c,_0x2699c2){var _0x1d2d05={},_0x4ebf24={},_0x32ba05={'count':0x0,'rows':[]};var _0x1e9e69=_[_0xc720('0x28')](db[_0xc720('0x29')][_0xc720('0x2a')],function(_0x2eb0d3){return{'name':_0x2eb0d3['fieldName'],'type':_0x2eb0d3['type'][_0xc720('0x2b')]};});_0x4ebf24['model']=_[_0xc720('0x2c')](_[_0xc720('0x28')](_0x1e9e69,_0xc720('0x25')),['name']);_0x4ebf24[_0xc720('0x2d')]=_['keys'](_0x1a012c['query']);_0x4ebf24[_0xc720('0x2e')]=_[_0xc720('0x2f')](_0x4ebf24[_0xc720('0x30')],_0x4ebf24[_0xc720('0x2d')]);_0x1d2d05[_0xc720('0x31')]=_['intersection'](_0x4ebf24['model'],qs['fields'](_0x1a012c['query'][_0xc720('0x32')]));_0x1d2d05['attributes']=_0x1d2d05[_0xc720('0x31')][_0xc720('0x33')]?_0x1d2d05[_0xc720('0x31')]:_0x4ebf24['model'];if(!_0x1a012c[_0xc720('0x2d')][_0xc720('0x34')](_0xc720('0x35'))){_0x1d2d05[_0xc720('0x1b')]=qs[_0xc720('0x1b')](_0x1a012c['query'][_0xc720('0x1b')]);_0x1d2d05['offset']=qs[_0xc720('0x19')](_0x1a012c['query']['offset']);}_0x1d2d05[_0xc720('0x36')]=qs[_0xc720('0x37')](_0x1a012c[_0xc720('0x2d')][_0xc720('0x37')]);_0x1d2d05[_0xc720('0x38')]=qs['filters'](_[_0xc720('0x39')](_0x1a012c[_0xc720('0x2d')],_0x4ebf24[_0xc720('0x2e')]),_0x1e9e69);if(_0x1a012c[_0xc720('0x2d')][_0xc720('0x3a')]){_0x1d2d05['where']=_[_0xc720('0x3b')](_0x1d2d05[_0xc720('0x38')],{'$or':_['map'](_0x1e9e69,function(_0x22bf92){if(_0x22bf92[_0xc720('0x3c')]!=='VIRTUAL'){var _0x2aba78={};_0x2aba78[_0x22bf92['name']]={'$like':'%'+_0x1a012c[_0xc720('0x2d')][_0xc720('0x3a')]+'%'};return _0x2aba78;}})});}_0x1d2d05=_[_0xc720('0x3b')]({},_0x1d2d05,_0x1a012c[_0xc720('0x3d')]);var _0x1f7316={'where':_0x1d2d05['where']};return db['CmCustomField'][_0xc720('0x1c')](_0x1f7316)[_0xc720('0x22')](function(_0x3d7a38){_0x32ba05[_0xc720('0x1c')]=_0x3d7a38;if(_0x1a012c[_0xc720('0x2d')][_0xc720('0x3e')]){_0x1d2d05['include']=[{'all':!![]}];}return db[_0xc720('0x29')][_0xc720('0x3f')](_0x1d2d05);})[_0xc720('0x22')](function(_0x15b9dd){_0x32ba05[_0xc720('0x40')]=_0x15b9dd;return _0x32ba05;})['then'](respondWithFilteredResult(_0x2699c2,_0x1d2d05))['catch'](handleError(_0x2699c2,null));};exports[_0xc720('0x41')]=function(_0x371424,_0xb4ec27){var _0x4b6dd3={'raw':!![],'where':{'id':_0x371424[_0xc720('0x42')]['id']}},_0x555087={};_0x555087[_0xc720('0x30')]=_[_0xc720('0x43')](db[_0xc720('0x29')][_0xc720('0x2a')]);_0x555087[_0xc720('0x2d')]=_[_0xc720('0x43')](_0x371424[_0xc720('0x2d')]);_0x555087[_0xc720('0x2e')]=_[_0xc720('0x2f')](_0x555087[_0xc720('0x30')],_0x555087['query']);_0x4b6dd3[_0xc720('0x31')]=_[_0xc720('0x2f')](_0x555087[_0xc720('0x30')],qs[_0xc720('0x32')](_0x371424['query'][_0xc720('0x32')]));_0x4b6dd3[_0xc720('0x31')]=_0x4b6dd3['attributes'][_0xc720('0x33')]?_0x4b6dd3[_0xc720('0x31')]:_0x555087[_0xc720('0x30')];if(_0x371424[_0xc720('0x2d')][_0xc720('0x3e')]){_0x4b6dd3[_0xc720('0x44')]=[{'all':!![]}];}_0x4b6dd3=_['merge']({},_0x4b6dd3,_0x371424[_0xc720('0x3d')]);return db[_0xc720('0x29')][_0xc720('0x45')](_0x4b6dd3)[_0xc720('0x22')](handleEntityNotFound(_0xb4ec27,null))[_0xc720('0x22')](respondWithResult(_0xb4ec27,null))['catch'](handleError(_0xb4ec27,null));};exports[_0xc720('0x21')]=function(_0x41c2f8,_0x25a069){if(_0x41c2f8[_0xc720('0x46')]['id']){delete _0x41c2f8[_0xc720('0x46')]['id'];}return db[_0xc720('0x29')][_0xc720('0x45')]({'where':{'id':_0x41c2f8['params']['id']}})[_0xc720('0x22')](handleEntityNotFound(_0x25a069,null))['then'](saveUpdates(_0x41c2f8[_0xc720('0x46')],null))['then'](respondWithResult(_0x25a069,null))[_0xc720('0x47')](handleError(_0x25a069,null));};exports['destroy']=function(_0x33c52f,_0x435f1e){return db[_0xc720('0x29')]['find']({'where':{'id':_0x33c52f[_0xc720('0x42')]['id']}})['then'](handleEntityNotFound(_0x435f1e,null))[_0xc720('0x22')](removeEntity(_0x435f1e,null))[_0xc720('0x47')](handleError(_0x435f1e,null));};exports[_0xc720('0x48')]=function(_0x3b1afe,_0x10ef67){var _0x300094;return db['sequelize'][_0xc720('0x49')](function(_0xcdd118){return db[_0xc720('0x29')][_0xc720('0x48')](_0x3b1afe['body'],{'transaction':_0xcdd118})[_0xc720('0x22')](function(_0x222a08){_0x300094=_0x222a08;var _0x201ea3={'type':db[_0xc720('0x4a')]['TEXT'],'transaction':_0xcdd118};switch(_0x3b1afe['body']['type']){case _0xc720('0x4b'):_0x201ea3[_0xc720('0x3c')]=db[_0xc720('0x4a')]['TEXT'];break;case _0xc720('0x4c'):_0x201ea3[_0xc720('0x3c')]=db[_0xc720('0x4a')][_0xc720('0x4d')];break;case _0xc720('0x4e'):_0x201ea3[_0xc720('0x3c')]=db[_0xc720('0x4a')][_0xc720('0x4f')];_0x201ea3['defaultValue']=![];break;default:}return db['sequelize'][_0xc720('0x50')][_0xc720('0x51')](_0xc720('0x52'),util['format'](_0xc720('0x53'),_0x300094['id']),_0x201ea3);})['then'](function(){return _0x300094;});})[_0xc720('0x22')](respondWithResult(_0x10ef67,0xc9))['catch'](handleError(_0x10ef67,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 18688d2..ed88065 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 _0x954c=['cm_custom_fields','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmCustomField.attributes','CmCustomField'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x954c,0x155));var _0xc954=function(_0x1cfd37,_0x207cb3){_0x1cfd37=_0x1cfd37-0x0;var _0x7e436c=_0x954c[_0x1cfd37];return _0x7e436c;};'use strict';var _=require('lodash');var util=require(_0xc954('0x0'));var logger=require(_0xc954('0x1'))(_0xc954('0x2'));var moment=require(_0xc954('0x3'));var BPromise=require('bluebird');var rp=require(_0xc954('0x4'));var fs=require('fs');var path=require(_0xc954('0x5'));var rimraf=require('rimraf');var config=require(_0xc954('0x6'));var attributes=require(_0xc954('0x7'));module['exports']=function(_0x3596b1,_0x2e0410){return _0x3596b1['define'](_0xc954('0x8'),attributes,{'tableName':_0xc954('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc04a=['exports','cm_custom_fields','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac04('0x0'));var util=require('util');var logger=require(_0xac04('0x1'))('api');var moment=require(_0xac04('0x2'));var BPromise=require(_0xac04('0x3'));var rp=require(_0xac04('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac04('0x5'));var config=require(_0xac04('0x6'));var attributes=require(_0xac04('0x7'));module[_0xac04('0x8')]=function(_0x5add53,_0x5c6f52){return _0x5add53['define']('CmCustomField',attributes,{'tableName':_0xac04('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 b2fd56d..b1d3bc2 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(_0x42d4c3,_0x58eaef){var _0x2e02d1=function(_0x1e0e22){while(--_0x1e0e22){_0x42d4c3['push'](_0x42d4c3['shift']());}};_0x2e02d1(++_0x58eaef);}(_0xadb8,0x1d0));var _0x8adb=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0xadb8[_0x5400b];return _0x36a39b;};'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 _0xa9e0=['http','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\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(_0x1ffb1c,_0x2e1d6c){var _0x58882f=function(_0x1b20ff){while(--_0x1b20ff){_0x1ffb1c['push'](_0x1ffb1c['shift']());}};_0x58882f(++_0x2e1d6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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/cmCustomField/index.js b/server/api/cmCustomField/index.js index 9ef1b0a..386d583 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 _0xca60=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x517648,_0x3e4708){var _0xb5372a=function(_0x4b0628){while(--_0x4b0628){_0x517648['push'](_0x517648['shift']());}};_0xb5372a(++_0x3e4708);}(_0xca60,0x1c4));var _0x0ca6=function(_0x32c98a,_0x5e6eb0){_0x32c98a=_0x32c98a-0x0;var _0x1796d3=_0xca60[_0x32c98a];return _0x1796d3;};'use strict';var multer=require('multer');var util=require(_0x0ca6('0x0'));var path=require(_0x0ca6('0x1'));var timeout=require(_0x0ca6('0x2'));var express=require(_0x0ca6('0x3'));var router=express[_0x0ca6('0x4')]();var fs_extra=require(_0x0ca6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ca6('0x6'));var config=require(_0x0ca6('0x7'));var controller=require(_0x0ca6('0x8'));router[_0x0ca6('0x9')]('/',auth[_0x0ca6('0xa')](),controller['index']);router[_0x0ca6('0x9')](_0x0ca6('0xb'),auth[_0x0ca6('0xa')](),controller[_0x0ca6('0xc')]);router[_0x0ca6('0xd')]('/',auth[_0x0ca6('0xa')](),controller[_0x0ca6('0xe')]);router['put'](_0x0ca6('0xb'),auth[_0x0ca6('0xa')](),controller[_0x0ca6('0xf')]);router[_0x0ca6('0x10')]('/:id',auth[_0x0ca6('0xa')](),controller[_0x0ca6('0x11')]);module[_0x0ca6('0x12')]=router; \ No newline at end of file +var _0xfd5d=['put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','/:id','show','post','isAuthenticated','create'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xfd5d,0x124));var _0xdfd5=function(_0x406d39,_0xd3c8f1){_0x406d39=_0x406d39-0x0;var _0x2eb792=_0xfd5d[_0x406d39];return _0x2eb792;};'use strict';var multer=require(_0xdfd5('0x0'));var util=require('util');var path=require(_0xdfd5('0x1'));var timeout=require(_0xdfd5('0x2'));var express=require(_0xdfd5('0x3'));var router=express[_0xdfd5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdfd5('0x5'));var interaction=require(_0xdfd5('0x6'));var config=require('../../config/environment');var controller=require(_0xdfd5('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdfd5('0x8')](_0xdfd5('0x9'),auth['isAuthenticated'](),controller[_0xdfd5('0xa')]);router[_0xdfd5('0xb')]('/',auth[_0xdfd5('0xc')](),controller[_0xdfd5('0xd')]);router[_0xdfd5('0xe')](_0xdfd5('0x9'),auth['isAuthenticated'](),controller[_0xdfd5('0xf')]);router['delete'](_0xdfd5('0x9'),auth[_0xdfd5('0xc')](),controller['destroy']);module[_0xdfd5('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index d98131f..af207cb 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 _0xb43b=['UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4a4d53,_0x37b9bb){_0x4a4d53=_0x4a4d53-0x0;var _0x4e358e=_0xb43b[_0x4a4d53];return _0x4e358e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'phone':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xbb43('0x4')],'defaultValue':moment()['format'](_0xbb43('0x5'))},'countbusyretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbb43('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xbb43('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbb43('0x6')],'unique':_0xbb43('0x8')},'ListId':{'type':Sequelize[_0xbb43('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xbb43('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xbb43('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xbb43('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x5ebdc5,_0x5fbba2){var _0x383096=function(_0x302298){while(--_0x302298){_0x5ebdc5['push'](_0x5ebdc5['shift']());}};_0x383096(++_0x5fbba2);}(_0xe706,0xa3));var _0x6e70=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0xe706[_0x3e0763];return _0x351ca2;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':moment()[_0x6e70('0x5')](_0x6e70('0x6'))},'countbusyretry':{'type':Sequelize[_0x6e70('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6e70('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6e70('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6e70('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6e70('0x4')]},'priority':{'type':Sequelize[_0x6e70('0x7')](0x2)[_0x6e70('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6e70('0x7')],'unique':_0x6e70('0xa')},'ListId':{'type':Sequelize[_0x6e70('0x7')],'unique':_0x6e70('0xa')},'UserId':{'type':Sequelize[_0x6e70('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x6e70('0x7')],'unique':_0x6e70('0xa')},'CampaignId':{'type':Sequelize[_0x6e70('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x6e70('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6e70('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6e70('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6e70('0x7')],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index bc8c01e..9b99acc 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 _0x4e51=['statedesc','deleted','campaign','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','preview','isNumber','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','CmHopper','rawAttributes','fieldName','key','query','keys','filters','model','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$notILike','$contained','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','map','type','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state'];(function(_0x37545c,_0x9906f5){var _0x4cd312=function(_0x21536b){while(--_0x21536b){_0x37545c['push'](_0x37545c['shift']());}};_0x4cd312(++_0x9906f5);}(_0x4e51,0xc7));var _0x14e5=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x4e51[_0xfd9b19];return _0x514918;};'use strict';var emlformat=require(_0x14e5('0x0'));var rimraf=require(_0x14e5('0x1'));var zipdir=require(_0x14e5('0x2'));var jsonpatch=require(_0x14e5('0x3'));var rp=require(_0x14e5('0x4'));var moment=require(_0x14e5('0x5'));var BPromise=require(_0x14e5('0x6'));var Mustache=require(_0x14e5('0x7'));var util=require(_0x14e5('0x8'));var path=require('path');var sox=require(_0x14e5('0x9'));var csv=require(_0x14e5('0xa'));var ejs=require(_0x14e5('0xb'));var fs=require('fs');var fs_extra=require(_0x14e5('0xc'));var _=require(_0x14e5('0xd'));var squel=require('squel');var crypto=require(_0x14e5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x14e5('0xa'));var querystring=require(_0x14e5('0xf'));var Papa=require(_0x14e5('0x10'));var Redis=require(_0x14e5('0x11'));var authService=require(_0x14e5('0x12'));var qs=require(_0x14e5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14e5('0x14'));var logger=require(_0x14e5('0x15'))(_0x14e5('0x16'));var utils=require('../../config/utils');var config=require(_0x14e5('0x17'));var licenseUtil=require(_0x14e5('0x18'));var db=require(_0x14e5('0x19'))['db'];function respondWithStatusCode(_0xe12d8c,_0x2760a3){_0x2760a3=_0x2760a3||0xcc;return function(_0x353b73){if(_0x353b73){return _0xe12d8c['sendStatus'](_0x2760a3);}return _0xe12d8c[_0x14e5('0x1a')](_0x2760a3)[_0x14e5('0x1b')]();};}function respondWithResult(_0x432a6a,_0x22ebc1){_0x22ebc1=_0x22ebc1||0xc8;return function(_0x363117){if(_0x363117){return _0x432a6a[_0x14e5('0x1a')](_0x22ebc1)[_0x14e5('0x1c')](_0x363117);}};}function respondWithFilteredResult(_0x4c02bf,_0xbae96e){return function(_0x5182c9){if(_0x5182c9){var _0x2882d9=typeof _0xbae96e['offset']===_0x14e5('0x1d')&&typeof _0xbae96e[_0x14e5('0x1e')]===_0x14e5('0x1d');var _0x439b11=_0x5182c9[_0x14e5('0x1f')];var _0x36b536=_0x2882d9?0x0:_0xbae96e[_0x14e5('0x20')];var _0x330c3b=_0x2882d9?_0x5182c9['count']:_0xbae96e[_0x14e5('0x20')]+_0xbae96e[_0x14e5('0x1e')];var _0x381907;if(_0x330c3b>=_0x439b11){_0x330c3b=_0x439b11;_0x381907=0xc8;}else{_0x381907=0xce;}_0x4c02bf[_0x14e5('0x1a')](_0x381907);return _0x4c02bf['set'](_0x14e5('0x21'),_0x36b536+'-'+_0x330c3b+'/'+_0x439b11)[_0x14e5('0x1c')](_0x5182c9);}return null;};}function patchUpdates(_0x5b3c09){return function(_0x464493){try{jsonpatch[_0x14e5('0x22')](_0x464493,_0x5b3c09,!![]);}catch(_0x6c2904){return BPromise[_0x14e5('0x23')](_0x6c2904);}return _0x464493[_0x14e5('0x24')]();};}function saveUpdates(_0x1216a7,_0x12486c){return function(_0x3d22a4){if(_0x3d22a4){return _0x3d22a4[_0x14e5('0x25')](_0x1216a7)[_0x14e5('0x26')](function(_0x3cc8c7){return _0x3cc8c7;});}return null;};}function removeEntity(_0x3145c3,_0x33b5c5){return function(_0x15feb6){if(_0x15feb6){return _0x15feb6['destroy']()[_0x14e5('0x26')](function(){_0x3145c3[_0x14e5('0x1a')](0xcc)[_0x14e5('0x1b')]();});}};}function handleEntityNotFound(_0x55f839,_0x6cbf82){return function(_0x3bf01f){if(!_0x3bf01f){_0x55f839['sendStatus'](0x194);}return _0x3bf01f;};}function handleError(_0x5f4e27,_0x567dce){_0x567dce=_0x567dce||0x1f4;return function(_0x1e5e0e){logger[_0x14e5('0x27')](_0x1e5e0e[_0x14e5('0x28')]);if(_0x1e5e0e['name']){delete _0x1e5e0e[_0x14e5('0x29')];}_0x5f4e27[_0x14e5('0x1a')](_0x567dce)[_0x14e5('0x2a')](_0x1e5e0e);};}exports['index']=function(_0x4410ea,_0x487a79){var _0x2334af={},_0xc95421={},_0x590029={'count':0x0,'rows':[]};var _0x5a1439=_['map'](db[_0x14e5('0x2b')][_0x14e5('0x2c')],function(_0x1aec6e){return{'name':_0x1aec6e[_0x14e5('0x2d')],'type':_0x1aec6e['type'][_0x14e5('0x2e')]};});_0xc95421['model']=_['map'](_0x5a1439,_0x14e5('0x29'));_0xc95421[_0x14e5('0x2f')]=_[_0x14e5('0x30')](_0x4410ea['query']);_0xc95421[_0x14e5('0x31')]=_['intersection'](_0xc95421[_0x14e5('0x32')],_0xc95421['query']);_0xc95421[_0x14e5('0x31')]=_[_0x14e5('0x33')](_0xc95421[_0x14e5('0x31')],[_0x14e5('0x34'),_0x14e5('0x35'),'$gt',_0x14e5('0x36'),_0x14e5('0x37'),_0x14e5('0x38'),_0x14e5('0x39'),_0x14e5('0x3a'),'$not',_0x14e5('0x3b'),_0x14e5('0x3c'),_0x14e5('0x3d'),'$notIn',_0x14e5('0x3e'),_0x14e5('0x3f'),'$iLike',_0x14e5('0x40'),_0x14e5('0x3e'),'$overlap','$contains',_0x14e5('0x41'),_0x14e5('0x42')]);_0x2334af['attributes']=_[_0x14e5('0x43')](_0xc95421[_0x14e5('0x32')],qs[_0x14e5('0x44')](_0x4410ea[_0x14e5('0x2f')][_0x14e5('0x44')]));_0x2334af['attributes']=_0x2334af[_0x14e5('0x45')][_0x14e5('0x46')]?_0x2334af[_0x14e5('0x45')]:_0xc95421[_0x14e5('0x32')];if(!_0x4410ea[_0x14e5('0x2f')][_0x14e5('0x47')](_0x14e5('0x48'))){_0x2334af[_0x14e5('0x1e')]=qs[_0x14e5('0x1e')](_0x4410ea[_0x14e5('0x2f')][_0x14e5('0x1e')]);_0x2334af[_0x14e5('0x20')]=qs[_0x14e5('0x20')](_0x4410ea['query'][_0x14e5('0x20')]);}_0x2334af[_0x14e5('0x49')]=qs[_0x14e5('0x4a')](_0x4410ea[_0x14e5('0x2f')][_0x14e5('0x4a')]);_0x2334af['where']=qs[_0x14e5('0x31')](_[_0x14e5('0x4b')](_0x4410ea['query'],_0xc95421[_0x14e5('0x31')]),_0x5a1439);if(_0x4410ea['query'][_0x14e5('0x4c')]){_0x2334af['where']=_[_0x14e5('0x4d')](_0x2334af['where'],{'$or':_[_0x14e5('0x4e')](_0x5a1439,function(_0x53b312){if(_0x53b312[_0x14e5('0x4f')]!==_0x14e5('0x50')){var _0x2d427a={};_0x2d427a[_0x53b312[_0x14e5('0x29')]]={'$like':'%'+_0x4410ea[_0x14e5('0x2f')][_0x14e5('0x4c')]+'%'};return _0x2d427a;}})});}_0x2334af=_[_0x14e5('0x4d')]({},_0x2334af,_0x4410ea[_0x14e5('0x51')]);var _0x47acfd={'where':_0x2334af[_0x14e5('0x52')]};return db['CmHopper'][_0x14e5('0x1f')](_0x47acfd)['then'](function(_0x588058){_0x590029['count']=_0x588058;if(_0x4410ea[_0x14e5('0x2f')][_0x14e5('0x53')]){_0x2334af[_0x14e5('0x54')]=[{'all':!![]}];}return db[_0x14e5('0x2b')][_0x14e5('0x55')](_0x2334af);})[_0x14e5('0x26')](function(_0x5f016d){_0x590029[_0x14e5('0x56')]=_0x5f016d;return _0x590029;})[_0x14e5('0x26')](respondWithFilteredResult(_0x487a79,_0x2334af))[_0x14e5('0x57')](handleError(_0x487a79,null));};exports[_0x14e5('0x58')]=function(_0x4a502e,_0x12537c){var _0x246c1f={'raw':!![],'where':{'id':_0x4a502e[_0x14e5('0x59')]['id']}},_0x259eb4={};_0x259eb4[_0x14e5('0x32')]=_[_0x14e5('0x30')](db[_0x14e5('0x2b')][_0x14e5('0x2c')]);_0x259eb4['query']=_[_0x14e5('0x30')](_0x4a502e[_0x14e5('0x2f')]);_0x259eb4['filters']=_[_0x14e5('0x43')](_0x259eb4['model'],_0x259eb4[_0x14e5('0x2f')]);_0x246c1f[_0x14e5('0x45')]=_[_0x14e5('0x43')](_0x259eb4[_0x14e5('0x32')],qs['fields'](_0x4a502e[_0x14e5('0x2f')]['fields']));_0x246c1f[_0x14e5('0x45')]=_0x246c1f['attributes'][_0x14e5('0x46')]?_0x246c1f['attributes']:_0x259eb4[_0x14e5('0x32')];if(_0x4a502e['query'][_0x14e5('0x53')]){_0x246c1f['include']=[{'all':!![]}];}_0x246c1f=_['merge']({},_0x246c1f,_0x4a502e[_0x14e5('0x51')]);return db[_0x14e5('0x2b')][_0x14e5('0x5a')](_0x246c1f)[_0x14e5('0x26')](handleEntityNotFound(_0x12537c,null))[_0x14e5('0x26')](respondWithResult(_0x12537c,null))[_0x14e5('0x57')](handleError(_0x12537c,null));};exports['create']=function(_0x5f2584,_0x2f0699){return db[_0x14e5('0x2b')][_0x14e5('0x5b')](_0x5f2584[_0x14e5('0x5c')],{})[_0x14e5('0x26')](respondWithResult(_0x2f0699,0xc9))[_0x14e5('0x57')](handleError(_0x2f0699,null));};exports['update']=function(_0x3afe52,_0x24ef5f){if(_0x3afe52[_0x14e5('0x5c')]['id']){delete _0x3afe52['body']['id'];}return db['CmHopper'][_0x14e5('0x5a')]({'where':{'id':_0x3afe52[_0x14e5('0x59')]['id']}})[_0x14e5('0x26')](handleEntityNotFound(_0x24ef5f,null))[_0x14e5('0x26')](saveUpdates(_0x3afe52[_0x14e5('0x5c')],null))['then'](respondWithResult(_0x24ef5f,null))[_0x14e5('0x57')](handleError(_0x24ef5f,null));};exports['describe']=function(_0x5252d1,_0x26c898){return db[_0x14e5('0x2b')][_0x14e5('0x5d')]()[_0x14e5('0x26')](respondWithResult(_0x26c898,null))['catch'](handleError(_0x26c898,null));};exports[_0x14e5('0x5e')]=function(_0x3f5709,_0x5f3493){var _0x49803c;var _0x5c7ed1=_0x3f5709['params']['id'];return db['CmHopper'][_0x14e5('0x5a')]({'where':{'id':_0x3f5709['params']['id']}})['then'](handleEntityNotFound(_0x5f3493,null))[_0x14e5('0x26')](function(_0x3013a1){if(_0x3013a1){return _0x3013a1[_0x14e5('0x5e')]()[_0x14e5('0x26')](function(_0x55d038){return _0x55d038;});}})[_0x14e5('0x26')](function(_0x5dd766){_0x49803c=_0x5dd766;if(_0x5dd766){if(_0x5dd766['VoiceQueueId']||_0x5dd766[_0x14e5('0x5f')]){return db[_0x5dd766[_0x14e5('0x60')]?_0x14e5('0x61'):'Campaign'][_0x14e5('0x5a')]({'where':{'id':_0x5dd766[_0x14e5('0x60')]?_0x5dd766[_0x14e5('0x60')]:_0x5dd766['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x14e5('0x26')](function(_0xda3ff8){var _0x1556c9={};if(_0xda3ff8){_[_0x14e5('0x4d')](_0x1556c9,_[_0x14e5('0x62')](_0x49803c[_0x14e5('0x63')],[_0x14e5('0x64'),_0x14e5('0x65'),'id']));_0x1556c9[_0x14e5('0x66')]=0x15;_0x1556c9[_0x14e5('0x67')]=_0x14e5('0x68');_0x1556c9[_0x14e5('0x69')]=_0xda3ff8[_0x14e5('0x29')];_0x1556c9['membername']=_0x3f5709[_0x14e5('0x6a')][_0x14e5('0x29')];_0x1556c9['UserId']=_0x3f5709[_0x14e5('0x6a')]['id'];_0x1556c9[_0x14e5('0x68')]=!![];_0x1556c9[_0x14e5('0x6b')]=moment()[_0x14e5('0x6c')](_0x14e5('0x6d'));_0x1556c9[_0x14e5('0x6e')]=_0x49803c[_0x14e5('0x6f')];_0x1556c9[_0x14e5('0x70')]=_0x49803c['VoiceQueueId']?_0x14e5('0x71'):_0x14e5('0x72');return db[_0x14e5('0x73')][_0x14e5('0x5a')]({'where':{'id':_0x1556c9[_0x14e5('0x74')]},'attributes':[_0x14e5('0x75'),'lastName']})[_0x14e5('0x26')](function(_0x3d0120){if(!_[_0x14e5('0x76')](_0x5f3493)&&!_['isNil'](_0x3d0120[_0x14e5('0x75')])){_0x1556c9[_0x14e5('0x77')]=_0x3d0120[_0x14e5('0x75')];if(!_['isNil'](_0x3d0120['lastName'])){_0x1556c9[_0x14e5('0x77')]+='\x20'+_0x3d0120[_0x14e5('0x78')];}}})[_0x14e5('0x79')](function(){return db[_0x14e5('0x7a')]['create'](_0x1556c9);});}})['then'](function(_0x1690da){return db[_0x14e5('0x7b')][_0x14e5('0x5e')]({'where':{'CmHopperId':_0x5c7ed1}});})['then'](function(){return _0x5f3493['status'](0xcc)['end']();})['catch'](handleError(_0x5f3493,null));};exports[_0x14e5('0x7c')]=function(_0x50d398,_0x4949d7,_0x5a5d81){var _0x472c88=[];return db[_0x14e5('0x73')][_0x14e5('0x5d')]()[_0x14e5('0x26')](function(_0x160898){_0x472c88=_[_0x14e5('0x30')](_0x160898);return _0x50d398[_0x14e5('0x6a')][_0x14e5('0x7d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x14e5('0x7e')],'raw':!![]});})[_0x14e5('0x26')](function(_0x3a11d0){if(_0x3a11d0&&_0x3a11d0['length']){return db[_0x14e5('0x7f')][_0x14e5('0x80')](function(_0x2c4821){var _0x2ad3ae={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x14e5('0x6c')](_0x14e5('0x6d'))},'VoiceQueueId':{'$in':_[_0x14e5('0x4e')](_0x3a11d0,'id')},'$or':[{'UserId':null},{'UserId':_0x50d398[_0x14e5('0x6a')]['id']}]};var _0x2742af=[];if(_0x50d398[_0x14e5('0x5c')][_0x14e5('0x81')]&&_0x50d398['body']['direction']===_0x14e5('0x82')){if(!_[_0x14e5('0x83')](_0x50d398[_0x14e5('0x5c')][_0x14e5('0x84')])){_0x2ad3ae['id']={'$in':_0x50d398[_0x14e5('0x5c')][_0x14e5('0x84')]};}_0x2742af=[['priority',_0x14e5('0x85')],[_0x14e5('0x86'),_0x3a11d0[0x0][_0x14e5('0x7e')]===_0x14e5('0x85')?_0x14e5('0x87'):_0x14e5('0x85')],db[_0x14e5('0x7f')][_0x14e5('0x88')](_0x14e5('0x89')),['id',_0x14e5('0x87')]];}else{if(!_[_0x14e5('0x83')](_0x50d398[_0x14e5('0x5c')][_0x14e5('0x84')])){_0x2ad3ae['id']={'$notIn':_0x50d398[_0x14e5('0x5c')][_0x14e5('0x84')]};}_0x2742af=[['priority',_0x14e5('0x87')],[_0x14e5('0x86'),_0x3a11d0[0x0]['dialOrderByScheduledAt']],db[_0x14e5('0x7f')][_0x14e5('0x88')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x14e5('0x85')]];}return db['CmHopper']['findOne']({'attributes':['id','scheduledat','phone'],'where':_0x2ad3ae,'order':_0x2742af,'transaction':_0x2c4821,'lock':_0x2c4821[_0x14e5('0x8a')][_0x14e5('0x8b')],'include':[{'model':db[_0x14e5('0x73')],'as':_0x14e5('0x8c'),'attributes':_0x472c88,'include':[{'model':db[_0x14e5('0x8d')],'as':_0x14e5('0x8e'),'attributes':['id',_0x14e5('0x29')]}]},{'model':db[_0x14e5('0x8f')],'as':_0x14e5('0x90'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x14e5('0x91'),'attributes':['id',_0x14e5('0x29'),_0x14e5('0x92')]}]})['then'](function(_0x195b63){if(_0x195b63){return _0x195b63['update']({'UserId':_0x50d398[_0x14e5('0x6a')]['id']},{'transaction':_0x2c4821});}});});}})[_0x14e5('0x26')](handleEntityNotFound(_0x4949d7,null))[_0x14e5('0x26')](respondWithResult(_0x4949d7,null))[_0x14e5('0x57')](handleError(_0x4949d7,null));};exports[_0x14e5('0x93')]=function(_0x428ba0,_0x4deb20,_0x4cd387){return _0x428ba0['user'][_0x14e5('0x7d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x14e5('0x94')},'attributes':['id'],'raw':!![]})[_0x14e5('0x26')](function(_0x48fc1){if(_0x48fc1&&_0x48fc1[_0x14e5('0x46')]){return db[_0x14e5('0x2b')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x14e5('0x6c')](_0x14e5('0x6d'))},'VoiceQueueId':{'$in':_[_0x14e5('0x4e')](_0x48fc1,'id')},'$or':[{'UserId':null},{'UserId':_0x428ba0[_0x14e5('0x6a')]['id']}]}});}return 0x0;})[_0x14e5('0x26')](function(_0xdc114a){if(!_[_0x14e5('0x76')](_0xdc114a)&&_[_0x14e5('0x95')](_0xdc114a)){return _0x4deb20['status'](0xc8)[_0x14e5('0x1c')]({'contacts':_0xdc114a});}else{logger[_0x14e5('0x27')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x14e5('0x93'),0x194,_0x14e5('0x96'));_0x4deb20['sendStatus'](0x194);}})[_0x14e5('0x57')](handleError(_0x4deb20,null));}; \ No newline at end of file +var _0x5d06=['priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getVoiceQueues','preview','isNumber','getOpenContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','CmHopper','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','finally','CmHopperFinal','getPreview','outbound','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','scheduledAt','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC'];(function(_0x3f23f7,_0x19212e){var _0x5c1326=function(_0x494380){while(--_0x494380){_0x3f23f7['push'](_0x3f23f7['shift']());}};_0x5c1326(++_0x19212e);}(_0x5d06,0x13a));var _0x65d0=function(_0x4f9d7e,_0x30c8e3){_0x4f9d7e=_0x4f9d7e-0x0;var _0x29a327=_0x5d06[_0x4f9d7e];return _0x29a327;};'use strict';var emlformat=require(_0x65d0('0x0'));var rimraf=require(_0x65d0('0x1'));var zipdir=require(_0x65d0('0x2'));var jsonpatch=require(_0x65d0('0x3'));var rp=require(_0x65d0('0x4'));var moment=require(_0x65d0('0x5'));var BPromise=require(_0x65d0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x65d0('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65d0('0x8'));var _=require(_0x65d0('0x9'));var squel=require(_0x65d0('0xa'));var crypto=require(_0x65d0('0xb'));var jsforce=require(_0x65d0('0xc'));var deskjs=require(_0x65d0('0xd'));var toCsv=require(_0x65d0('0xe'));var querystring=require(_0x65d0('0xf'));var Papa=require(_0x65d0('0x10'));var Redis=require('ioredis');var authService=require(_0x65d0('0x11'));var qs=require(_0x65d0('0x12'));var as=require(_0x65d0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65d0('0x14'))(_0x65d0('0x15'));var utils=require(_0x65d0('0x16'));var config=require(_0x65d0('0x17'));var licenseUtil=require(_0x65d0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5160f3,_0x3118fb){_0x3118fb=_0x3118fb||0xcc;return function(_0x2e6261){if(_0x2e6261){return _0x5160f3[_0x65d0('0x19')](_0x3118fb);}return _0x5160f3[_0x65d0('0x1a')](_0x3118fb)[_0x65d0('0x1b')]();};}function respondWithResult(_0xdebb14,_0x4b2a91){_0x4b2a91=_0x4b2a91||0xc8;return function(_0x32f918){if(_0x32f918){return _0xdebb14[_0x65d0('0x1a')](_0x4b2a91)['json'](_0x32f918);}};}function respondWithFilteredResult(_0x3117e4,_0x5efe80){return function(_0x41a97d){if(_0x41a97d){var _0x4f6ab2=typeof _0x5efe80[_0x65d0('0x1c')]===_0x65d0('0x1d')&&typeof _0x5efe80[_0x65d0('0x1e')]===_0x65d0('0x1d');var _0xb5bde3=_0x41a97d[_0x65d0('0x1f')];var _0xf38122=_0x4f6ab2?0x0:_0x5efe80[_0x65d0('0x1c')];var _0x4dae3b=_0x4f6ab2?_0x41a97d[_0x65d0('0x1f')]:_0x5efe80['offset']+_0x5efe80[_0x65d0('0x1e')];var _0x11e575;if(_0x4dae3b>=_0xb5bde3){_0x4dae3b=_0xb5bde3;_0x11e575=0xc8;}else{_0x11e575=0xce;}_0x3117e4['status'](_0x11e575);return _0x3117e4[_0x65d0('0x20')](_0x65d0('0x21'),_0xf38122+'-'+_0x4dae3b+'/'+_0xb5bde3)[_0x65d0('0x22')](_0x41a97d);}return null;};}function patchUpdates(_0x1b0285){return function(_0x4d022e){try{jsonpatch[_0x65d0('0x23')](_0x4d022e,_0x1b0285,!![]);}catch(_0x478224){return BPromise[_0x65d0('0x24')](_0x478224);}return _0x4d022e['save']();};}function saveUpdates(_0x189744,_0x3059da){return function(_0x24c6dc){if(_0x24c6dc){return _0x24c6dc[_0x65d0('0x25')](_0x189744)[_0x65d0('0x26')](function(_0x5f3ac4){return _0x5f3ac4;});}return null;};}function removeEntity(_0x3d8a2e,_0x2c2f95){return function(_0x596923){if(_0x596923){return _0x596923[_0x65d0('0x27')]()['then'](function(){_0x3d8a2e['status'](0xcc)[_0x65d0('0x1b')]();});}};}function handleEntityNotFound(_0x43b447,_0x500b51){return function(_0x95a908){if(!_0x95a908){_0x43b447['sendStatus'](0x194);}return _0x95a908;};}function handleError(_0x5813b3,_0x3e44d3){_0x3e44d3=_0x3e44d3||0x1f4;return function(_0x13ca0e){logger[_0x65d0('0x28')](_0x13ca0e['stack']);if(_0x13ca0e['name']){delete _0x13ca0e[_0x65d0('0x29')];}_0x5813b3[_0x65d0('0x1a')](_0x3e44d3)[_0x65d0('0x2a')](_0x13ca0e);};}exports[_0x65d0('0x2b')]=function(_0x1b4a0f,_0x41a480){var _0x14bdfb={},_0x3a3313={},_0x46b8fd={'count':0x0,'rows':[]};var _0xa74623=_['map'](db[_0x65d0('0x2c')][_0x65d0('0x2d')],function(_0x4d66d0){return{'name':_0x4d66d0[_0x65d0('0x2e')],'type':_0x4d66d0[_0x65d0('0x2f')][_0x65d0('0x30')]};});_0x3a3313['model']=_[_0x65d0('0x31')](_0xa74623,_0x65d0('0x29'));_0x3a3313[_0x65d0('0x32')]=_[_0x65d0('0x33')](_0x1b4a0f['query']);_0x3a3313['filters']=_[_0x65d0('0x34')](_0x3a3313[_0x65d0('0x35')],_0x3a3313[_0x65d0('0x32')]);_0x3a3313[_0x65d0('0x36')]=_[_0x65d0('0x37')](_0x3a3313[_0x65d0('0x36')],[_0x65d0('0x38'),_0x65d0('0x39'),'$gt',_0x65d0('0x3a'),_0x65d0('0x3b'),_0x65d0('0x3c'),_0x65d0('0x3d'),_0x65d0('0x3e'),'$not',_0x65d0('0x3f'),_0x65d0('0x40'),'$in',_0x65d0('0x41'),_0x65d0('0x42'),_0x65d0('0x43'),'$iLike',_0x65d0('0x44'),'$like',_0x65d0('0x45'),_0x65d0('0x46'),_0x65d0('0x47'),_0x65d0('0x48')]);_0x14bdfb['attributes']=_[_0x65d0('0x34')](_0x3a3313[_0x65d0('0x35')],qs[_0x65d0('0x49')](_0x1b4a0f[_0x65d0('0x32')][_0x65d0('0x49')]));_0x14bdfb[_0x65d0('0x4a')]=_0x14bdfb[_0x65d0('0x4a')]['length']?_0x14bdfb[_0x65d0('0x4a')]:_0x3a3313[_0x65d0('0x35')];if(!_0x1b4a0f[_0x65d0('0x32')]['hasOwnProperty']('nolimit')){_0x14bdfb[_0x65d0('0x1e')]=qs[_0x65d0('0x1e')](_0x1b4a0f['query']['limit']);_0x14bdfb['offset']=qs[_0x65d0('0x1c')](_0x1b4a0f[_0x65d0('0x32')]['offset']);}_0x14bdfb[_0x65d0('0x4b')]=qs[_0x65d0('0x4c')](_0x1b4a0f[_0x65d0('0x32')][_0x65d0('0x4c')]);_0x14bdfb[_0x65d0('0x4d')]=qs[_0x65d0('0x36')](_['pick'](_0x1b4a0f['query'],_0x3a3313['filters']),_0xa74623);if(_0x1b4a0f[_0x65d0('0x32')][_0x65d0('0x4e')]){_0x14bdfb[_0x65d0('0x4d')]=_[_0x65d0('0x4f')](_0x14bdfb[_0x65d0('0x4d')],{'$or':_[_0x65d0('0x31')](_0xa74623,function(_0x130593){if(_0x130593['type']!==_0x65d0('0x50')){var _0x22b796={};_0x22b796[_0x130593[_0x65d0('0x29')]]={'$like':'%'+_0x1b4a0f['query'][_0x65d0('0x4e')]+'%'};return _0x22b796;}})});}_0x14bdfb=_[_0x65d0('0x4f')]({},_0x14bdfb,_0x1b4a0f[_0x65d0('0x51')]);var _0x220f9d={'where':_0x14bdfb[_0x65d0('0x4d')]};return db['CmHopper']['count'](_0x220f9d)[_0x65d0('0x26')](function(_0x1e2f8b){_0x46b8fd[_0x65d0('0x1f')]=_0x1e2f8b;if(_0x1b4a0f[_0x65d0('0x32')][_0x65d0('0x52')]){_0x14bdfb[_0x65d0('0x53')]=[{'all':!![]}];}return db[_0x65d0('0x2c')][_0x65d0('0x54')](_0x14bdfb);})[_0x65d0('0x26')](function(_0x21cd46){_0x46b8fd['rows']=_0x21cd46;return _0x46b8fd;})[_0x65d0('0x26')](respondWithFilteredResult(_0x41a480,_0x14bdfb))[_0x65d0('0x55')](handleError(_0x41a480,null));};exports[_0x65d0('0x56')]=function(_0x3a9add,_0x461910){var _0x171ced={'raw':!![],'where':{'id':_0x3a9add[_0x65d0('0x57')]['id']}},_0x2ac7ca={};_0x2ac7ca[_0x65d0('0x35')]=_['keys'](db[_0x65d0('0x2c')][_0x65d0('0x2d')]);_0x2ac7ca[_0x65d0('0x32')]=_[_0x65d0('0x33')](_0x3a9add[_0x65d0('0x32')]);_0x2ac7ca[_0x65d0('0x36')]=_['intersection'](_0x2ac7ca[_0x65d0('0x35')],_0x2ac7ca[_0x65d0('0x32')]);_0x171ced[_0x65d0('0x4a')]=_[_0x65d0('0x34')](_0x2ac7ca[_0x65d0('0x35')],qs[_0x65d0('0x49')](_0x3a9add[_0x65d0('0x32')][_0x65d0('0x49')]));_0x171ced['attributes']=_0x171ced[_0x65d0('0x4a')][_0x65d0('0x58')]?_0x171ced[_0x65d0('0x4a')]:_0x2ac7ca['model'];if(_0x3a9add[_0x65d0('0x32')]['includeAll']){_0x171ced[_0x65d0('0x53')]=[{'all':!![]}];}_0x171ced=_[_0x65d0('0x4f')]({},_0x171ced,_0x3a9add[_0x65d0('0x51')]);return db[_0x65d0('0x2c')]['find'](_0x171ced)['then'](handleEntityNotFound(_0x461910,null))[_0x65d0('0x26')](respondWithResult(_0x461910,null))[_0x65d0('0x55')](handleError(_0x461910,null));};exports[_0x65d0('0x59')]=function(_0x437b23,_0x5dc41e){return db['CmHopper'][_0x65d0('0x59')](_0x437b23[_0x65d0('0x5a')],{})[_0x65d0('0x26')](respondWithResult(_0x5dc41e,0xc9))[_0x65d0('0x55')](handleError(_0x5dc41e,null));};exports['update']=function(_0x36f981,_0x4ab4b7){if(_0x36f981[_0x65d0('0x5a')]['id']){delete _0x36f981[_0x65d0('0x5a')]['id'];}return db['CmHopper'][_0x65d0('0x5b')]({'where':{'id':_0x36f981[_0x65d0('0x57')]['id']}})[_0x65d0('0x26')](handleEntityNotFound(_0x4ab4b7,null))[_0x65d0('0x26')](saveUpdates(_0x36f981['body'],null))[_0x65d0('0x26')](respondWithResult(_0x4ab4b7,null))[_0x65d0('0x55')](handleError(_0x4ab4b7,null));};exports[_0x65d0('0x5c')]=function(_0x4f05d8,_0x241397){return db[_0x65d0('0x2c')][_0x65d0('0x5c')]()['then'](respondWithResult(_0x241397,null))[_0x65d0('0x55')](handleError(_0x241397,null));};exports[_0x65d0('0x27')]=function(_0x20a4f2,_0x4f15e8){var _0x46fd9d;var _0x58bd13=_0x20a4f2[_0x65d0('0x57')]['id'];return db[_0x65d0('0x2c')][_0x65d0('0x5b')]({'where':{'id':_0x20a4f2[_0x65d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x4f15e8,null))[_0x65d0('0x26')](function(_0x199769){if(_0x199769){return _0x199769[_0x65d0('0x27')]()[_0x65d0('0x26')](function(_0x22a6eb){return _0x22a6eb;});}})['then'](function(_0x4d3a69){_0x46fd9d=_0x4d3a69;if(_0x4d3a69){if(_0x4d3a69[_0x65d0('0x5d')]||_0x4d3a69[_0x65d0('0x5e')]){return db[_0x4d3a69[_0x65d0('0x5d')]?_0x65d0('0x5f'):_0x65d0('0x60')]['find']({'where':{'id':_0x4d3a69[_0x65d0('0x5d')]?_0x4d3a69[_0x65d0('0x5d')]:_0x4d3a69[_0x65d0('0x5e')]},'attributes':['id',_0x65d0('0x29')],'raw':!![]});}}})[_0x65d0('0x26')](function(_0xf3339a){var _0x38e109={};if(_0xf3339a){_[_0x65d0('0x4f')](_0x38e109,_[_0x65d0('0x61')](_0x46fd9d['dataValues'],[_0x65d0('0x62'),_0x65d0('0x63'),'id']));_0x38e109[_0x65d0('0x64')]=0x15;_0x38e109['statedesc']=_0x65d0('0x65');_0x38e109[_0x65d0('0x66')]=_0xf3339a[_0x65d0('0x29')];_0x38e109['membername']=_0x20a4f2[_0x65d0('0x67')]['name'];_0x38e109[_0x65d0('0x68')]=_0x20a4f2[_0x65d0('0x67')]['id'];_0x38e109[_0x65d0('0x65')]=!![];_0x38e109[_0x65d0('0x69')]=moment()[_0x65d0('0x6a')](_0x65d0('0x6b'));_0x38e109['calleridnum']=_0x46fd9d[_0x65d0('0x6c')];_0x38e109[_0x65d0('0x6d')]=_0x46fd9d[_0x65d0('0x5d')]?_0x65d0('0x6e'):_0x65d0('0x6f');return db[_0x65d0('0x70')][_0x65d0('0x5b')]({'where':{'id':_0x38e109[_0x65d0('0x71')]},'attributes':[_0x65d0('0x72'),_0x65d0('0x73')]})['then'](function(_0x3b0fbf){if(!_['isNil'](_0x4f15e8)&&!_[_0x65d0('0x74')](_0x3b0fbf[_0x65d0('0x72')])){_0x38e109['calleridname']=_0x3b0fbf['firstName'];if(!_[_0x65d0('0x74')](_0x3b0fbf[_0x65d0('0x73')])){_0x38e109['calleridname']+='\x20'+_0x3b0fbf[_0x65d0('0x73')];}}})[_0x65d0('0x75')](function(){return db[_0x65d0('0x76')][_0x65d0('0x59')](_0x38e109);});}})[_0x65d0('0x26')](function(_0x15a5cf){return db['CmHopperAdditionalPhone'][_0x65d0('0x27')]({'where':{'CmHopperId':_0x58bd13}});})[_0x65d0('0x26')](function(){return _0x4f15e8[_0x65d0('0x1a')](0xcc)[_0x65d0('0x1b')]();})['catch'](handleError(_0x4f15e8,null));};exports[_0x65d0('0x77')]=function(_0x5d4c96,_0x2be263,_0x1c129c){var _0x399f0c=[];return db[_0x65d0('0x70')][_0x65d0('0x5c')]()[_0x65d0('0x26')](function(_0x64c3c3){_0x399f0c=_[_0x65d0('0x33')](_0x64c3c3);return _0x5d4c96[_0x65d0('0x67')]['getVoiceQueues']({'where':{'type':_0x65d0('0x78'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x65d0('0x79')],'raw':!![]});})[_0x65d0('0x26')](function(_0xd7b5ab){if(_0xd7b5ab&&_0xd7b5ab[_0x65d0('0x58')]){return db[_0x65d0('0x7a')][_0x65d0('0x7b')](function(_0x19fc70){var _0x151365={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x65d0('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x65d0('0x31')](_0xd7b5ab,'id')},'$or':[{'UserId':null},{'UserId':_0x5d4c96[_0x65d0('0x67')]['id']}]};var _0x2fdd6f=[];if(_0x5d4c96[_0x65d0('0x5a')][_0x65d0('0x7c')]&&_0x5d4c96[_0x65d0('0x5a')][_0x65d0('0x7c')]===_0x65d0('0x7d')){if(!_[_0x65d0('0x7e')](_0x5d4c96[_0x65d0('0x5a')][_0x65d0('0x7f')])){_0x151365['id']={'$in':_0x5d4c96[_0x65d0('0x5a')][_0x65d0('0x7f')]};}_0x2fdd6f=[['priority','ASC'],[_0x65d0('0x80'),_0xd7b5ab[0x0][_0x65d0('0x79')]==='ASC'?_0x65d0('0x81'):_0x65d0('0x82')],db[_0x65d0('0x7a')][_0x65d0('0x83')](_0x65d0('0x84')),['id',_0x65d0('0x81')]];}else{if(!_[_0x65d0('0x7e')](_0x5d4c96['body'][_0x65d0('0x7f')])){_0x151365['id']={'$notIn':_0x5d4c96[_0x65d0('0x5a')][_0x65d0('0x7f')]};}_0x2fdd6f=[[_0x65d0('0x85'),_0x65d0('0x81')],[_0x65d0('0x80'),_0xd7b5ab[0x0]['dialOrderByScheduledAt']],db[_0x65d0('0x7a')][_0x65d0('0x83')](_0x65d0('0x86')),['id',_0x65d0('0x82')]];}return db[_0x65d0('0x2c')][_0x65d0('0x87')]({'attributes':['id',_0x65d0('0x88'),_0x65d0('0x6c')],'where':_0x151365,'order':_0x2fdd6f,'transaction':_0x19fc70,'lock':_0x19fc70[_0x65d0('0x89')][_0x65d0('0x8a')],'include':[{'model':db['CmContact'],'as':_0x65d0('0x8b'),'attributes':_0x399f0c,'include':[{'model':db[_0x65d0('0x8c')],'as':'Company','attributes':['id',_0x65d0('0x29')]}]},{'model':db[_0x65d0('0x8d')],'as':_0x65d0('0x8e'),'attributes':['id',_0x65d0('0x29')]},{'model':db[_0x65d0('0x5f')],'as':_0x65d0('0x8f'),'attributes':['id',_0x65d0('0x29'),_0x65d0('0x90')]}]})[_0x65d0('0x26')](function(_0x456d69){if(_0x456d69){return _0x456d69[_0x65d0('0x25')]({'UserId':_0x5d4c96['user']['id']},{'transaction':_0x19fc70});}});});}})[_0x65d0('0x26')](handleEntityNotFound(_0x2be263,null))['then'](respondWithResult(_0x2be263,null))[_0x65d0('0x55')](handleError(_0x2be263,null));};exports['getOpenContacts']=function(_0x3ec8b3,_0x52bb00,_0x236b1d){return _0x3ec8b3[_0x65d0('0x67')][_0x65d0('0x91')]({'where':{'type':_0x65d0('0x78'),'dialActive':!![],'dialMethod':_0x65d0('0x92')},'attributes':['id'],'raw':!![]})[_0x65d0('0x26')](function(_0x1cac40){if(_0x1cac40&&_0x1cac40['length']){return db['CmHopper'][_0x65d0('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x65d0('0x6a')](_0x65d0('0x6b'))},'VoiceQueueId':{'$in':_[_0x65d0('0x31')](_0x1cac40,'id')},'$or':[{'UserId':null},{'UserId':_0x3ec8b3[_0x65d0('0x67')]['id']}]}});}return 0x0;})[_0x65d0('0x26')](function(_0x45e8e2){if(!_[_0x65d0('0x74')](_0x45e8e2)&&_[_0x65d0('0x93')](_0x45e8e2)){return _0x52bb00[_0x65d0('0x1a')](0xc8)[_0x65d0('0x22')]({'contacts':_0x45e8e2});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x65d0('0x94'),0x194,'entity\x20not\x20found');_0x52bb00[_0x65d0('0x19')](0x194);}})[_0x65d0('0x55')](handleError(_0x52bb00,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index cb29cba..96da5dc 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 _0x5c0e=['rimraf','../../config/environment','./cmHopper.attributes','cm_hopper','scheduledat','phone','../../config/logger','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c0e,0x1ad));var _0xe5c0=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x5c0e[_0x466af7];return _0x348c96;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe5c0('0x0'))('api');var moment=require(_0xe5c0('0x1'));var BPromise=require('bluebird');var rp=require(_0xe5c0('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5c0('0x3'));var config=require(_0xe5c0('0x4'));var attributes=require(_0xe5c0('0x5'));module['exports']=function(_0x34a66e,_0x4f183b){return _0x34a66e['define']('CmHopper',attributes,{'tableName':_0xe5c0('0x6'),'paranoid':![],'indexes':[{'name':_0xe5c0('0x7'),'fields':[_0xe5c0('0x7')]},{'name':_0xe5c0('0x8'),'fields':[_0xe5c0('0x8')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x263e=['request-promise','path','../../config/environment','./cmHopper.attributes','exports','define','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x161935,_0x1d53a0){var _0xf2b8b8=function(_0x32bb0c){while(--_0x32bb0c){_0x161935['push'](_0x161935['shift']());}};_0xf2b8b8(++_0x1d53a0);}(_0x263e,0x126));var _0xe263=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0x263e[_0x7880d2];return _0x35ebbe;};'use strict';var _=require(_0xe263('0x0'));var util=require(_0xe263('0x1'));var logger=require(_0xe263('0x2'))(_0xe263('0x3'));var moment=require(_0xe263('0x4'));var BPromise=require(_0xe263('0x5'));var rp=require(_0xe263('0x6'));var fs=require('fs');var path=require(_0xe263('0x7'));var rimraf=require('rimraf');var config=require(_0xe263('0x8'));var attributes=require(_0xe263('0x9'));module[_0xe263('0xa')]=function(_0xf26b41,_0x15e4e7){return _0xf26b41[_0xe263('0xb')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xe263('0xc'),'fields':['scheduledat']},{'name':_0xe263('0xd'),'fields':[_0xe263('0xd')]},{'name':_0xe263('0xe'),'fields':[_0xe263('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 5f6bdc2..45feeb1 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 _0xfb46=['update','all','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','literal','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','LOCK','length','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','CmHopper,\x20%s,\x20%s','message','info','result','catch','CmHopper','findAll','options','raw','where','attributes','limit','map','model','include','GetCmHopper','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','Contact','keys','User','Agent','name','voicePause','UserId','push'];(function(_0x5913f0,_0x310d5a){var _0xd8a93a=function(_0x36ba9d){while(--_0x36ba9d){_0x5913f0['push'](_0x5913f0['shift']());}};_0xd8a93a(++_0x310d5a);}(_0xfb46,0x1ae));var _0x6fb4=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0xfb46[_0x151334];return _0x3d03da;};'use strict';var _=require('lodash');var util=require(_0x6fb4('0x0'));var moment=require('moment');var BPromise=require(_0x6fb4('0x1'));var rs=require(_0x6fb4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fb4('0x3'))['db'];var utils=require(_0x6fb4('0x4'));var logger=require(_0x6fb4('0x5'))(_0x6fb4('0x6'));var config=require('../../config/environment');var jayson=require(_0x6fb4('0x7'));var client=jayson['client'][_0x6fb4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33633e,_0x1ca16f,_0x6ab633){return new BPromise(function(_0x81631,_0x56f895){return client[_0x6fb4('0x9')](_0x33633e,_0x6ab633)[_0x6fb4('0xa')](function(_0x1e67bd){logger['info']('CmHopper,\x20%s,\x20%s',_0x1ca16f,_0x6fb4('0xb'));logger[_0x6fb4('0xc')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x1ca16f,_0x6fb4('0xb'),JSON[_0x6fb4('0xd')](_0x1e67bd));if(_0x1e67bd[_0x6fb4('0xe')]){if(_0x1e67bd[_0x6fb4('0xe')][_0x6fb4('0xf')]===0x1f4){logger[_0x6fb4('0xe')](_0x6fb4('0x10'),_0x1ca16f,_0x1e67bd['error'][_0x6fb4('0x11')]);return _0x56f895(_0x1e67bd[_0x6fb4('0xe')][_0x6fb4('0x11')]);}logger[_0x6fb4('0xe')](_0x6fb4('0x10'),_0x1ca16f,_0x1e67bd[_0x6fb4('0xe')]['message']);return _0x81631(_0x1e67bd[_0x6fb4('0xe')]['message']);}else{logger[_0x6fb4('0x12')](_0x6fb4('0x10'),_0x1ca16f,_0x6fb4('0xb'));_0x81631(_0x1e67bd[_0x6fb4('0x13')][_0x6fb4('0x11')]);}})[_0x6fb4('0x14')](function(_0x1b3cd9){logger[_0x6fb4('0xe')](_0x6fb4('0x10'),_0x1ca16f,_0x1b3cd9);_0x56f895(_0x1b3cd9);});});}exports['GetCmHopper']=function(_0xf8dd14){var _0x465b56=this;return new Promise(function(_0x4cafb8,_0xd13d44){return db[_0x6fb4('0x15')][_0x6fb4('0x16')]({'raw':_0xf8dd14[_0x6fb4('0x17')]?_0xf8dd14[_0x6fb4('0x17')][_0x6fb4('0x18')]===undefined?!![]:![]:!![],'where':_0xf8dd14[_0x6fb4('0x17')]?_0xf8dd14[_0x6fb4('0x17')][_0x6fb4('0x19')]||null:null,'attributes':_0xf8dd14[_0x6fb4('0x17')]?_0xf8dd14[_0x6fb4('0x17')][_0x6fb4('0x1a')]||null:null,'limit':_0xf8dd14[_0x6fb4('0x17')]?_0xf8dd14['options'][_0x6fb4('0x1b')]||null:null,'include':_0xf8dd14[_0x6fb4('0x17')]?_0xf8dd14[_0x6fb4('0x17')]['include']?_[_0x6fb4('0x1c')](_0xf8dd14[_0x6fb4('0x17')]['include'],function(_0x8d58c){return{'model':db[_0x8d58c[_0x6fb4('0x1d')]],'as':_0x8d58c['as'],'attributes':_0x8d58c[_0x6fb4('0x1a')],'include':_0x8d58c['include']?_['map'](_0x8d58c[_0x6fb4('0x1e')],function(_0x3229b1){return{'model':db[_0x3229b1[_0x6fb4('0x1d')]],'as':_0x3229b1['as'],'attributes':_0x3229b1[_0x6fb4('0x1a')],'include':_0x3229b1[_0x6fb4('0x1e')]?_[_0x6fb4('0x1c')](_0x3229b1[_0x6fb4('0x1e')],function(_0x440a6c){return{'model':db[_0x440a6c['model']],'as':_0x440a6c['as'],'attributes':_0x440a6c[_0x6fb4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6fb4('0xa')](function(_0x434113){logger['info'](_0x6fb4('0x1f'),_0xf8dd14);logger[_0x6fb4('0xc')]('GetCmHopper',_0xf8dd14,JSON['stringify'](_0x434113));_0x4cafb8(_0x434113);})[_0x6fb4('0x14')](function(_0x1b53f1){logger[_0x6fb4('0xe')]('GetCmHopper',_0x1b53f1[_0x6fb4('0x11')],_0xf8dd14);_0xd13d44(_0x465b56[_0x6fb4('0xe')](0x1f4,_0x1b53f1[_0x6fb4('0x11')]));});});};exports[_0x6fb4('0x20')]=function(_0x3e7ae9){var _0x17d6c7=this;return new Promise(function(_0x8f121d,_0x4717d2){return db['CmHopper'][_0x6fb4('0x21')]({'raw':_0x3e7ae9['options']?_0x3e7ae9[_0x6fb4('0x17')][_0x6fb4('0x18')]===undefined?!![]:![]:!![],'where':_0x3e7ae9[_0x6fb4('0x17')]?_0x3e7ae9[_0x6fb4('0x17')][_0x6fb4('0x19')]||null:null,'attributes':_0x3e7ae9[_0x6fb4('0x17')]?_0x3e7ae9[_0x6fb4('0x17')]['attributes']||null:null,'include':_0x3e7ae9[_0x6fb4('0x17')]?_0x3e7ae9[_0x6fb4('0x17')][_0x6fb4('0x1e')]?_[_0x6fb4('0x1c')](_0x3e7ae9[_0x6fb4('0x17')][_0x6fb4('0x1e')],function(_0x44bd6f){return{'model':db[_0x44bd6f[_0x6fb4('0x1d')]],'as':_0x44bd6f['as'],'attributes':_0x44bd6f[_0x6fb4('0x1a')],'include':_0x44bd6f['include']?_[_0x6fb4('0x1c')](_0x44bd6f[_0x6fb4('0x1e')],function(_0x575cd8){return{'model':db[_0x575cd8[_0x6fb4('0x1d')]],'as':_0x575cd8['as'],'attributes':_0x575cd8['attributes'],'include':_0x575cd8[_0x6fb4('0x1e')]?_['map'](_0x575cd8[_0x6fb4('0x1e')],function(_0x3d1cda){return{'model':db[_0x3d1cda[_0x6fb4('0x1d')]],'as':_0x3d1cda['as'],'attributes':_0x3d1cda[_0x6fb4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6fb4('0xa')](function(_0x44563e){logger[_0x6fb4('0x12')]('ShowCmHopper',_0x3e7ae9);logger[_0x6fb4('0xc')](_0x6fb4('0x20'),_0x3e7ae9,JSON[_0x6fb4('0xd')](_0x44563e));_0x8f121d(_0x44563e);})[_0x6fb4('0x14')](function(_0x15b894){logger['error']('ShowCmHopper',_0x15b894['message'],_0x3e7ae9);_0x4717d2(_0x17d6c7[_0x6fb4('0xe')](0x1f4,_0x15b894[_0x6fb4('0x11')]));});});};exports[_0x6fb4('0x22')]=function(_0x360ecb){var _0x305fbc=this;return new Promise(function(_0x41b96b,_0x33e803){return db[_0x6fb4('0x15')]['create'](_0x360ecb[_0x6fb4('0x23')],{'raw':_0x360ecb['options']?_0x360ecb[_0x6fb4('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x6fb4('0xa')](function(_0x268c30){logger[_0x6fb4('0x12')](_0x6fb4('0x22'),_0x360ecb);logger[_0x6fb4('0xc')](_0x6fb4('0x22'),_0x360ecb,JSON[_0x6fb4('0xd')](_0x268c30));_0x41b96b(_0x268c30);})[_0x6fb4('0x14')](function(_0x15ac45){logger[_0x6fb4('0xe')](_0x6fb4('0x22'),_0x15ac45[_0x6fb4('0x11')],_0x360ecb);_0x33e803(_0x305fbc[_0x6fb4('0xe')](0x1f4,_0x15ac45['message']));});});};exports[_0x6fb4('0x24')]=function(_0x59d719){var _0x407bbb=this;return new Promise(function(_0x453423,_0x5c51b9){return db[_0x6fb4('0x15')]['update'](_0x59d719[_0x6fb4('0x23')],{'raw':_0x59d719[_0x6fb4('0x17')]?_0x59d719[_0x6fb4('0x17')][_0x6fb4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d719[_0x6fb4('0x17')]?_0x59d719[_0x6fb4('0x17')][_0x6fb4('0x19')]||null:null,'attributes':_0x59d719['options']?_0x59d719['options'][_0x6fb4('0x1a')]||null:null,'limit':_0x59d719[_0x6fb4('0x17')]?_0x59d719[_0x6fb4('0x17')][_0x6fb4('0x1b')]||null:null})[_0x6fb4('0xa')](function(_0x1160a5){logger[_0x6fb4('0x12')](_0x6fb4('0x24'),_0x59d719);logger[_0x6fb4('0xc')](_0x6fb4('0x24'),_0x59d719,JSON[_0x6fb4('0xd')](_0x1160a5));_0x453423(_0x1160a5);})['catch'](function(_0x1ba211){logger[_0x6fb4('0xe')](_0x6fb4('0x24'),_0x1ba211['message'],_0x59d719);_0x5c51b9(_0x407bbb[_0x6fb4('0xe')](0x1f4,_0x1ba211[_0x6fb4('0x11')]));});});};exports[_0x6fb4('0x25')]=function(_0x22b0e8){var _0x1e135d=this;return new Promise(function(_0x56922f,_0x544c27){return db[_0x6fb4('0x15')][_0x6fb4('0x26')]({'where':_0x22b0e8[_0x6fb4('0x17')]?_0x22b0e8[_0x6fb4('0x17')][_0x6fb4('0x19')]||null:null})[_0x6fb4('0xa')](function(_0x34667b){logger['info']('DestroyCmHopper',_0x22b0e8);logger[_0x6fb4('0xc')](_0x6fb4('0x25'),_0x22b0e8,JSON[_0x6fb4('0xd')](_0x34667b));_0x56922f(_0x34667b);})[_0x6fb4('0x14')](function(_0x34e10f){logger[_0x6fb4('0xe')](_0x6fb4('0x25'),_0x34e10f['message'],_0x22b0e8);_0x544c27(_0x1e135d[_0x6fb4('0xe')](0x1f4,_0x34e10f[_0x6fb4('0x11')]));});});};exports[_0x6fb4('0x27')]=function(_0x5b9658){var _0x591019=this;return new Promise(function(_0x2a115,_0x280ac0){return db[_0x6fb4('0x28')][_0x6fb4('0x29')]()[_0x6fb4('0xa')](function(_0x5d58d7){return db[_0x6fb4('0x2a')][_0x6fb4('0x2b')](function(_0x21e2e7){return db[_0x6fb4('0x15')][_0x6fb4('0x16')]({'where':_0x5b9658[_0x6fb4('0x17')]?_0x5b9658['options'][_0x6fb4('0x19')]||null:null,'attributes':_0x5b9658[_0x6fb4('0x17')]?_0x5b9658['options'][_0x6fb4('0x1a')]||null:null,'limit':_0x5b9658[_0x6fb4('0x17')]?_0x5b9658[_0x6fb4('0x17')][_0x6fb4('0x1b')]||null:null,'order':_0x5b9658[_0x6fb4('0x17')]?_0x5b9658[_0x6fb4('0x17')]['order']||null:null,'transaction':_0x21e2e7,'lock':_0x21e2e7['LOCK'][_0x6fb4('0x2c')],'include':[{'model':db[_0x6fb4('0x28')],'as':_0x6fb4('0x2d'),'attributes':_[_0x6fb4('0x2e')](_0x5d58d7)},{'model':db[_0x6fb4('0x2f')],'as':_0x6fb4('0x30'),'attributes':['id',_0x6fb4('0x31'),_0x6fb4('0x32')]}]})['then'](function(_0x206831){var _0x5091a1=[];var _0x23c448=[];for(var _0x13e647=0x0;_0x13e647<_0x206831['length'];_0x13e647+=0x1){var _0x4cb48a=_0x206831[_0x13e647][_0x6fb4('0x33')];if(_0x4cb48a===null){_0x5091a1[_0x6fb4('0x34')](_0x206831[_0x13e647][_0x6fb4('0x35')](_0x5b9658[_0x6fb4('0x23')],{'transaction':_0x21e2e7}));}else if(!_0x23c448['includes'](_0x4cb48a)){_0x23c448[_0x6fb4('0x34')](_0x4cb48a);_0x5091a1[_0x6fb4('0x34')](_0x206831[_0x13e647]['update'](_0x5b9658[_0x6fb4('0x23')],{'transaction':_0x21e2e7}));}}return BPromise[_0x6fb4('0x36')](_0x5091a1);});})[_0x6fb4('0xa')](function(_0x36f39b){logger['info'](_0x6fb4('0x27'),_0x5b9658);logger[_0x6fb4('0xc')](_0x6fb4('0x27'),_0x5b9658,JSON['stringify'](_0x36f39b));_0x2a115(_0x36f39b);})[_0x6fb4('0x14')](function(_0x496799){logger[_0x6fb4('0xe')](_0x6fb4('0x27'),_0x496799[_0x6fb4('0x11')],_0x5b9658);_0x280ac0(_0x591019[_0x6fb4('0xe')](0x1f4,_0x496799[_0x6fb4('0x11')]));});});});};exports[_0x6fb4('0x37')]=function(_0x1bf290){var _0x39367b=this;return new Promise(function(_0x3a14d9,_0x1aa849){return db['sequelize'][_0x6fb4('0x2b')](function(_0x5409ba){return db[_0x6fb4('0x38')][_0x6fb4('0x39')](_0x1bf290['body'],{'raw':_0x1bf290[_0x6fb4('0x17')]?_0x1bf290[_0x6fb4('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x5409ba})[_0x6fb4('0xa')](function(){return db[_0x6fb4('0x15')][_0x6fb4('0x26')]({'where':_0x1bf290['options']?_0x1bf290[_0x6fb4('0x17')][_0x6fb4('0x19')]||null:null,'transaction':_0x5409ba});});})[_0x6fb4('0xa')](function(_0x5df274){logger['info'](_0x6fb4('0x37'),_0x1bf290);logger['debug'](_0x6fb4('0x37'),_0x1bf290,JSON['stringify'](_0x5df274));_0x3a14d9(_0x5df274);})[_0x6fb4('0x14')](function(_0x5daead){logger['error'](_0x6fb4('0x37'),_0x5daead[_0x6fb4('0x11')],_0x1bf290);_0x1aa849(_0x39367b[_0x6fb4('0xe')](0x1f4,_0x5daead[_0x6fb4('0x11')]));});});};exports[_0x6fb4('0x3a')]=function(_0x2dc0f5){var _0x4303f7=this;return new Promise(function(_0x264a7,_0x5633b5){return db['CmHopper'][_0x6fb4('0x16')]({'raw':_0x2dc0f5[_0x6fb4('0x17')]?_0x2dc0f5['options'][_0x6fb4('0x18')]===undefined?!![]:![]:!![],'where':_0x2dc0f5['options']?_0x2dc0f5[_0x6fb4('0x17')][_0x6fb4('0x19')]||null:null,'attributes':[[db[_0x6fb4('0x2a')]['fn'](_0x6fb4('0x3b'),db[_0x6fb4('0x2a')]['fn']('IF',db[_0x6fb4('0x2a')][_0x6fb4('0x3c')]('`scheduledat`\x20>=\x20'+util['format'](_0x6fb4('0x3d'),moment()[_0x6fb4('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x6fb4('0x3f')))),_0x6fb4('0x40')]]})[_0x6fb4('0xa')](function(_0x5b0d82){logger[_0x6fb4('0x12')](_0x6fb4('0x3a'),_0x2dc0f5);logger[_0x6fb4('0xc')](_0x6fb4('0x3a'),_0x2dc0f5,JSON[_0x6fb4('0xd')](_0x5b0d82));_0x264a7(_0x5b0d82);})[_0x6fb4('0x14')](function(_0x34793c){logger['error']('CountReScheduled',_0x34793c['message'],_0x2dc0f5);_0x5633b5(_0x4303f7[_0x6fb4('0xe')](0x1f4,_0x34793c[_0x6fb4('0x11')]));});});};exports[_0x6fb4('0x41')]=function(_0x1e043e){var _0x4508f9=this;return new Promise(function(_0x9d082d,_0x13ec3b){return db[_0x6fb4('0x28')][_0x6fb4('0x29')]()[_0x6fb4('0xa')](function(_0xb9f151){return db[_0x6fb4('0x2a')][_0x6fb4('0x2b')](function(_0x4ccecd){return db[_0x6fb4('0x15')]['findAll']({'where':_0x1e043e['options']?_0x1e043e[_0x6fb4('0x17')][_0x6fb4('0x19')]||null:null,'attributes':_0x1e043e[_0x6fb4('0x17')]?_0x1e043e['options'][_0x6fb4('0x1a')]||null:null,'limit':0x1,'order':_0x1e043e[_0x6fb4('0x17')]?_0x1e043e[_0x6fb4('0x17')][_0x6fb4('0x42')]||null:null,'group':db[_0x6fb4('0x15')]['UserId'],'transaction':_0x4ccecd,'lock':_0x4ccecd[_0x6fb4('0x43')][_0x6fb4('0x2c')],'include':_0x1e043e[_0x6fb4('0x17')]?_0x1e043e[_0x6fb4('0x17')][_0x6fb4('0x1e')]?_['map'](_0x1e043e[_0x6fb4('0x17')][_0x6fb4('0x1e')],function(_0x22efbb){return{'model':db[_0x22efbb[_0x6fb4('0x1d')]],'as':_0x22efbb['as'],'attributes':_0x22efbb[_0x6fb4('0x1a')],'include':_0x22efbb[_0x6fb4('0x1e')]?_[_0x6fb4('0x1c')](_0x22efbb[_0x6fb4('0x1e')],function(_0x53a45b){return{'model':db[_0x53a45b[_0x6fb4('0x1d')]],'as':_0x53a45b['as'],'attributes':_0x53a45b[_0x6fb4('0x1a')],'include':_0x53a45b['include']?_[_0x6fb4('0x1c')](_0x53a45b[_0x6fb4('0x1e')],function(_0x25e3ab){return{'model':db[_0x25e3ab[_0x6fb4('0x1d')]],'as':_0x25e3ab['as'],'attributes':_0x25e3ab[_0x6fb4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6fb4('0xa')](function(_0x43ed76){var _0x2a6edb=[];for(var _0x4e4546=0x0;_0x4e4546<_0x43ed76[_0x6fb4('0x44')];_0x4e4546+=0x1){_0x2a6edb[_0x6fb4('0x34')](_0x43ed76[_0x4e4546]['update'](_0x1e043e[_0x6fb4('0x23')],{'transaction':_0x4ccecd}));}return BPromise[_0x6fb4('0x36')](_0x2a6edb);});})[_0x6fb4('0xa')](function(_0x3dc1ab){logger['info'](_0x6fb4('0x41'),_0x1e043e);logger[_0x6fb4('0xc')](_0x6fb4('0x41'),_0x1e043e,JSON[_0x6fb4('0xd')](_0x3dc1ab));_0x9d082d(_0x3dc1ab);})['catch'](function(_0x1f8551){logger[_0x6fb4('0xe')](_0x6fb4('0x41'),_0x1f8551[_0x6fb4('0x11')],_0x1e043e);_0x13ec3b(_0x4508f9['error'](0x1f4,_0x1f8551['message']));});});});};exports['GetCmHopperPreview']=function(_0x584b88){var _0x3306ed=this;return new Promise(function(_0x557365,_0x10184e){db['CmContact'][_0x6fb4('0x29')]()[_0x6fb4('0xa')](function(_0x5d9e2a){return db[_0x6fb4('0x15')][_0x6fb4('0x16')]({'raw':_0x584b88['options']?_0x584b88['options'][_0x6fb4('0x18')]===undefined?!![]:![]:!![],'where':_0x584b88[_0x6fb4('0x17')]?_0x584b88['options'][_0x6fb4('0x19')]||null:null,'attributes':_0x584b88[_0x6fb4('0x17')]?_0x584b88[_0x6fb4('0x17')]['attributes']||null:null,'limit':_0x584b88[_0x6fb4('0x17')]?_0x584b88[_0x6fb4('0x17')][_0x6fb4('0x1b')]||null:null,'include':_0x584b88[_0x6fb4('0x17')]?_0x584b88[_0x6fb4('0x17')][_0x6fb4('0x1e')]?_['map'](_0x584b88[_0x6fb4('0x17')][_0x6fb4('0x1e')],function(_0x4220d4){return{'model':db[_0x4220d4[_0x6fb4('0x1d')]],'as':_0x4220d4['as'],'attributes':_0x4220d4['as']===_0x6fb4('0x2d')?_['keys'](_0x5d9e2a):_0x4220d4[_0x6fb4('0x1a')],'include':_0x4220d4[_0x6fb4('0x1e')]?_[_0x6fb4('0x1c')](_0x4220d4[_0x6fb4('0x1e')],function(_0x3151ef){return{'model':db[_0x3151ef[_0x6fb4('0x1d')]],'as':_0x3151ef['as'],'attributes':_0x3151ef[_0x6fb4('0x1a')],'include':_0x3151ef[_0x6fb4('0x1e')]?_[_0x6fb4('0x1c')](_0x3151ef[_0x6fb4('0x1e')],function(_0x19ec9d){return{'model':db[_0x19ec9d[_0x6fb4('0x1d')]],'as':_0x19ec9d['as'],'attributes':_0x19ec9d[_0x6fb4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6fb4('0xa')](function(_0x164f2a){logger['info'](_0x6fb4('0x1f'),_0x584b88);logger[_0x6fb4('0xc')](_0x6fb4('0x1f'),_0x584b88,JSON[_0x6fb4('0xd')](_0x164f2a));_0x557365(_0x164f2a);})[_0x6fb4('0x14')](function(_0xaf3221){logger['error'](_0x6fb4('0x1f'),_0xaf3221[_0x6fb4('0x11')],_0x584b88);_0x10184e(_0x3306ed[_0x6fb4('0xe')](0x1f4,_0xaf3221[_0x6fb4('0x11')]));});});});}; \ No newline at end of file +var _0xf4ed=['DestroyCmHopper','destroy','CmContact','describe','transaction','order','LOCK','UPDATE','Agent','voicePause','length','UserId','includes','push','all','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','Contact','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CmHopper','findAll','options','where','attributes','limit','map','model','include','then','GetCmHopper','ShowCmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','update'];(function(_0x9d75c4,_0x10f484){var _0x258ba5=function(_0x4908c5){while(--_0x4908c5){_0x9d75c4['push'](_0x9d75c4['shift']());}};_0x258ba5(++_0x10f484);}(_0xf4ed,0x1a8));var _0xdf4e=function(_0x28e424,_0x4d6508){_0x28e424=_0x28e424-0x0;var _0x25ab59=_0xf4ed[_0x28e424];return _0x25ab59;};'use strict';var _=require(_0xdf4e('0x0'));var util=require(_0xdf4e('0x1'));var moment=require(_0xdf4e('0x2'));var BPromise=require(_0xdf4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf4e('0x4'))['db'];var utils=require(_0xdf4e('0x5'));var logger=require(_0xdf4e('0x6'))('rpc');var config=require(_0xdf4e('0x7'));var jayson=require(_0xdf4e('0x8'));var client=jayson[_0xdf4e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59ee6e,_0x4956f0,_0x15af95){return new BPromise(function(_0x3937c6,_0x5d77c2){return client['request'](_0x59ee6e,_0x15af95)['then'](function(_0x4850ba){logger[_0xdf4e('0xa')](_0xdf4e('0xb'),_0x4956f0,_0xdf4e('0xc'));logger[_0xdf4e('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x4956f0,_0xdf4e('0xc'),JSON[_0xdf4e('0xe')](_0x4850ba));if(_0x4850ba[_0xdf4e('0xf')]){if(_0x4850ba['error']['code']===0x1f4){logger[_0xdf4e('0xf')](_0xdf4e('0xb'),_0x4956f0,_0x4850ba[_0xdf4e('0xf')][_0xdf4e('0x10')]);return _0x5d77c2(_0x4850ba[_0xdf4e('0xf')][_0xdf4e('0x10')]);}logger[_0xdf4e('0xf')](_0xdf4e('0xb'),_0x4956f0,_0x4850ba[_0xdf4e('0xf')][_0xdf4e('0x10')]);return _0x3937c6(_0x4850ba[_0xdf4e('0xf')][_0xdf4e('0x10')]);}else{logger[_0xdf4e('0xa')](_0xdf4e('0xb'),_0x4956f0,'request\x20sent');_0x3937c6(_0x4850ba[_0xdf4e('0x11')][_0xdf4e('0x10')]);}})[_0xdf4e('0x12')](function(_0x462042){logger[_0xdf4e('0xf')]('CmHopper,\x20%s,\x20%s',_0x4956f0,_0x462042);_0x5d77c2(_0x462042);});});}exports['GetCmHopper']=function(_0x3792d8){var _0x58735c=this;return new Promise(function(_0x3487c4,_0x4c19c0){return db[_0xdf4e('0x13')][_0xdf4e('0x14')]({'raw':_0x3792d8[_0xdf4e('0x15')]?_0x3792d8[_0xdf4e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3792d8['options']?_0x3792d8['options'][_0xdf4e('0x16')]||null:null,'attributes':_0x3792d8[_0xdf4e('0x15')]?_0x3792d8[_0xdf4e('0x15')][_0xdf4e('0x17')]||null:null,'limit':_0x3792d8[_0xdf4e('0x15')]?_0x3792d8[_0xdf4e('0x15')][_0xdf4e('0x18')]||null:null,'include':_0x3792d8[_0xdf4e('0x15')]?_0x3792d8['options']['include']?_[_0xdf4e('0x19')](_0x3792d8['options']['include'],function(_0x306585){return{'model':db[_0x306585[_0xdf4e('0x1a')]],'as':_0x306585['as'],'attributes':_0x306585[_0xdf4e('0x17')],'include':_0x306585[_0xdf4e('0x1b')]?_['map'](_0x306585[_0xdf4e('0x1b')],function(_0x4ee21e){return{'model':db[_0x4ee21e[_0xdf4e('0x1a')]],'as':_0x4ee21e['as'],'attributes':_0x4ee21e[_0xdf4e('0x17')],'include':_0x4ee21e[_0xdf4e('0x1b')]?_[_0xdf4e('0x19')](_0x4ee21e[_0xdf4e('0x1b')],function(_0x1b6184){return{'model':db[_0x1b6184[_0xdf4e('0x1a')]],'as':_0x1b6184['as'],'attributes':_0x1b6184[_0xdf4e('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdf4e('0x1c')](function(_0x4f3cbd){logger[_0xdf4e('0xa')](_0xdf4e('0x1d'),_0x3792d8);logger[_0xdf4e('0xd')](_0xdf4e('0x1d'),_0x3792d8,JSON[_0xdf4e('0xe')](_0x4f3cbd));_0x3487c4(_0x4f3cbd);})[_0xdf4e('0x12')](function(_0xf95cc){logger['error']('GetCmHopper',_0xf95cc['message'],_0x3792d8);_0x4c19c0(_0x58735c[_0xdf4e('0xf')](0x1f4,_0xf95cc[_0xdf4e('0x10')]));});});};exports[_0xdf4e('0x1e')]=function(_0x29d0fd){var _0x272b3c=this;return new Promise(function(_0xa8560a,_0x3b572e){return db['CmHopper'][_0xdf4e('0x1f')]({'raw':_0x29d0fd[_0xdf4e('0x15')]?_0x29d0fd['options'][_0xdf4e('0x20')]===undefined?!![]:![]:!![],'where':_0x29d0fd[_0xdf4e('0x15')]?_0x29d0fd[_0xdf4e('0x15')][_0xdf4e('0x16')]||null:null,'attributes':_0x29d0fd[_0xdf4e('0x15')]?_0x29d0fd[_0xdf4e('0x15')]['attributes']||null:null,'include':_0x29d0fd[_0xdf4e('0x15')]?_0x29d0fd[_0xdf4e('0x15')]['include']?_[_0xdf4e('0x19')](_0x29d0fd['options'][_0xdf4e('0x1b')],function(_0x5be3f0){return{'model':db[_0x5be3f0[_0xdf4e('0x1a')]],'as':_0x5be3f0['as'],'attributes':_0x5be3f0['attributes'],'include':_0x5be3f0[_0xdf4e('0x1b')]?_[_0xdf4e('0x19')](_0x5be3f0[_0xdf4e('0x1b')],function(_0x48e954){return{'model':db[_0x48e954[_0xdf4e('0x1a')]],'as':_0x48e954['as'],'attributes':_0x48e954[_0xdf4e('0x17')],'include':_0x48e954['include']?_[_0xdf4e('0x19')](_0x48e954[_0xdf4e('0x1b')],function(_0x2f0550){return{'model':db[_0x2f0550[_0xdf4e('0x1a')]],'as':_0x2f0550['as'],'attributes':_0x2f0550[_0xdf4e('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdf4e('0x1c')](function(_0x22feee){logger['info'](_0xdf4e('0x1e'),_0x29d0fd);logger['debug'](_0xdf4e('0x1e'),_0x29d0fd,JSON['stringify'](_0x22feee));_0xa8560a(_0x22feee);})[_0xdf4e('0x12')](function(_0x595e7a){logger[_0xdf4e('0xf')](_0xdf4e('0x1e'),_0x595e7a[_0xdf4e('0x10')],_0x29d0fd);_0x3b572e(_0x272b3c['error'](0x1f4,_0x595e7a[_0xdf4e('0x10')]));});});};exports[_0xdf4e('0x21')]=function(_0xa31b07){var _0xc1687=this;return new Promise(function(_0x2f56de,_0x90d002){return db['CmHopper'][_0xdf4e('0x22')](_0xa31b07[_0xdf4e('0x23')],{'raw':_0xa31b07[_0xdf4e('0x15')]?_0xa31b07[_0xdf4e('0x15')][_0xdf4e('0x20')]===undefined?!![]:![]:!![]})[_0xdf4e('0x1c')](function(_0x25b32){logger['info'](_0xdf4e('0x21'),_0xa31b07);logger['debug']('CreateCmHopper',_0xa31b07,JSON['stringify'](_0x25b32));_0x2f56de(_0x25b32);})[_0xdf4e('0x12')](function(_0x1569b5){logger[_0xdf4e('0xf')](_0xdf4e('0x21'),_0x1569b5[_0xdf4e('0x10')],_0xa31b07);_0x90d002(_0xc1687[_0xdf4e('0xf')](0x1f4,_0x1569b5[_0xdf4e('0x10')]));});});};exports[_0xdf4e('0x24')]=function(_0x489aef){var _0x1d5a54=this;return new Promise(function(_0x348857,_0x2015af){return db[_0xdf4e('0x13')][_0xdf4e('0x25')](_0x489aef[_0xdf4e('0x23')],{'raw':_0x489aef[_0xdf4e('0x15')]?_0x489aef['options'][_0xdf4e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x489aef['options']?_0x489aef[_0xdf4e('0x15')][_0xdf4e('0x16')]||null:null,'attributes':_0x489aef[_0xdf4e('0x15')]?_0x489aef[_0xdf4e('0x15')][_0xdf4e('0x17')]||null:null,'limit':_0x489aef[_0xdf4e('0x15')]?_0x489aef[_0xdf4e('0x15')]['limit']||null:null})[_0xdf4e('0x1c')](function(_0x569512){logger['info'](_0xdf4e('0x24'),_0x489aef);logger[_0xdf4e('0xd')](_0xdf4e('0x24'),_0x489aef,JSON[_0xdf4e('0xe')](_0x569512));_0x348857(_0x569512);})['catch'](function(_0x30f1dc){logger[_0xdf4e('0xf')]('UpdateCmHopper',_0x30f1dc['message'],_0x489aef);_0x2015af(_0x1d5a54[_0xdf4e('0xf')](0x1f4,_0x30f1dc[_0xdf4e('0x10')]));});});};exports[_0xdf4e('0x26')]=function(_0xb51379){var _0x1d2115=this;return new Promise(function(_0x35d874,_0x11aa2d){return db['CmHopper'][_0xdf4e('0x27')]({'where':_0xb51379[_0xdf4e('0x15')]?_0xb51379[_0xdf4e('0x15')][_0xdf4e('0x16')]||null:null})[_0xdf4e('0x1c')](function(_0xddd76a){logger[_0xdf4e('0xa')](_0xdf4e('0x26'),_0xb51379);logger[_0xdf4e('0xd')](_0xdf4e('0x26'),_0xb51379,JSON[_0xdf4e('0xe')](_0xddd76a));_0x35d874(_0xddd76a);})[_0xdf4e('0x12')](function(_0x2152f8){logger[_0xdf4e('0xf')](_0xdf4e('0x26'),_0x2152f8['message'],_0xb51379);_0x11aa2d(_0x1d2115[_0xdf4e('0xf')](0x1f4,_0x2152f8[_0xdf4e('0x10')]));});});};exports['GetContactDialer']=function(_0x371e40){var _0x164853=this;return new Promise(function(_0x2260bb,_0x17fdb6){return db[_0xdf4e('0x28')][_0xdf4e('0x29')]()[_0xdf4e('0x1c')](function(_0xa4ebdd){return db['sequelize'][_0xdf4e('0x2a')](function(_0x47e306){return db[_0xdf4e('0x13')][_0xdf4e('0x14')]({'where':_0x371e40[_0xdf4e('0x15')]?_0x371e40[_0xdf4e('0x15')][_0xdf4e('0x16')]||null:null,'attributes':_0x371e40[_0xdf4e('0x15')]?_0x371e40['options'][_0xdf4e('0x17')]||null:null,'limit':_0x371e40[_0xdf4e('0x15')]?_0x371e40[_0xdf4e('0x15')][_0xdf4e('0x18')]||null:null,'order':_0x371e40['options']?_0x371e40[_0xdf4e('0x15')][_0xdf4e('0x2b')]||null:null,'transaction':_0x47e306,'lock':_0x47e306[_0xdf4e('0x2c')][_0xdf4e('0x2d')],'include':[{'model':db[_0xdf4e('0x28')],'as':'Contact','attributes':_['keys'](_0xa4ebdd)},{'model':db['User'],'as':_0xdf4e('0x2e'),'attributes':['id','name',_0xdf4e('0x2f')]}]})[_0xdf4e('0x1c')](function(_0x3f3db1){var _0x4cdd67=[];var _0x5b7908=[];for(var _0x190d26=0x0;_0x190d26<_0x3f3db1[_0xdf4e('0x30')];_0x190d26+=0x1){var _0x11ad99=_0x3f3db1[_0x190d26][_0xdf4e('0x31')];if(_0x11ad99===null){_0x4cdd67['push'](_0x3f3db1[_0x190d26][_0xdf4e('0x25')](_0x371e40[_0xdf4e('0x23')],{'transaction':_0x47e306}));}else if(!_0x5b7908[_0xdf4e('0x32')](_0x11ad99)){_0x5b7908[_0xdf4e('0x33')](_0x11ad99);_0x4cdd67[_0xdf4e('0x33')](_0x3f3db1[_0x190d26][_0xdf4e('0x25')](_0x371e40[_0xdf4e('0x23')],{'transaction':_0x47e306}));}}return BPromise[_0xdf4e('0x34')](_0x4cdd67);});})[_0xdf4e('0x1c')](function(_0xcca602){logger[_0xdf4e('0xa')](_0xdf4e('0x35'),_0x371e40);logger[_0xdf4e('0xd')](_0xdf4e('0x35'),_0x371e40,JSON[_0xdf4e('0xe')](_0xcca602));_0x2260bb(_0xcca602);})[_0xdf4e('0x12')](function(_0x442281){logger['error'](_0xdf4e('0x35'),_0x442281[_0xdf4e('0x10')],_0x371e40);_0x17fdb6(_0x164853['error'](0x1f4,_0x442281[_0xdf4e('0x10')]));});});});};exports[_0xdf4e('0x36')]=function(_0x339014){var _0x1c38a6=this;return new Promise(function(_0x436ebd,_0xb877cc){return db[_0xdf4e('0x37')][_0xdf4e('0x2a')](function(_0x16f625){return db[_0xdf4e('0x38')][_0xdf4e('0x22')](_0x339014[_0xdf4e('0x23')],{'raw':_0x339014[_0xdf4e('0x15')]?_0x339014[_0xdf4e('0x15')][_0xdf4e('0x20')]===undefined?!![]:![]:!![],'transaction':_0x16f625})[_0xdf4e('0x1c')](function(){return db[_0xdf4e('0x13')]['destroy']({'where':_0x339014[_0xdf4e('0x15')]?_0x339014['options'][_0xdf4e('0x16')]||null:null,'transaction':_0x16f625});});})[_0xdf4e('0x1c')](function(_0x52676a){logger[_0xdf4e('0xa')]('MoveContactManagedDialer',_0x339014);logger['debug']('MoveContactManagedDialer',_0x339014,JSON[_0xdf4e('0xe')](_0x52676a));_0x436ebd(_0x52676a);})['catch'](function(_0x277d9a){logger[_0xdf4e('0xf')](_0xdf4e('0x36'),_0x277d9a[_0xdf4e('0x10')],_0x339014);_0xb877cc(_0x1c38a6[_0xdf4e('0xf')](0x1f4,_0x277d9a['message']));});});};exports[_0xdf4e('0x39')]=function(_0x17bae5){var _0x56f5a0=this;return new Promise(function(_0x3d051e,_0x157a88){return db['CmHopper'][_0xdf4e('0x14')]({'raw':_0x17bae5[_0xdf4e('0x15')]?_0x17bae5['options'][_0xdf4e('0x20')]===undefined?!![]:![]:!![],'where':_0x17bae5[_0xdf4e('0x15')]?_0x17bae5[_0xdf4e('0x15')][_0xdf4e('0x16')]||null:null,'attributes':[[db[_0xdf4e('0x37')]['fn']('COUNT',db[_0xdf4e('0x37')]['fn']('IF',db[_0xdf4e('0x37')]['literal'](_0xdf4e('0x3a')+util[_0xdf4e('0x3b')](_0xdf4e('0x3c'),moment()[_0xdf4e('0x3b')](_0xdf4e('0x3d')))+_0xdf4e('0x3e')))),_0xdf4e('0x3f')]]})[_0xdf4e('0x1c')](function(_0x400825){logger[_0xdf4e('0xa')](_0xdf4e('0x39'),_0x17bae5);logger[_0xdf4e('0xd')](_0xdf4e('0x39'),_0x17bae5,JSON[_0xdf4e('0xe')](_0x400825));_0x3d051e(_0x400825);})[_0xdf4e('0x12')](function(_0x4a6ba0){logger[_0xdf4e('0xf')](_0xdf4e('0x39'),_0x4a6ba0[_0xdf4e('0x10')],_0x17bae5);_0x157a88(_0x56f5a0[_0xdf4e('0xf')](0x1f4,_0x4a6ba0[_0xdf4e('0x10')]));});});};exports[_0xdf4e('0x40')]=function(_0x4652fa){var _0x3e582b=this;return new Promise(function(_0x308489,_0x2d235e){return db[_0xdf4e('0x28')][_0xdf4e('0x29')]()[_0xdf4e('0x1c')](function(_0xd4675d){return db[_0xdf4e('0x37')][_0xdf4e('0x2a')](function(_0x20d1c7){return db[_0xdf4e('0x13')][_0xdf4e('0x14')]({'where':_0x4652fa[_0xdf4e('0x15')]?_0x4652fa['options']['where']||null:null,'attributes':_0x4652fa[_0xdf4e('0x15')]?_0x4652fa['options'][_0xdf4e('0x17')]||null:null,'limit':0x1,'order':_0x4652fa[_0xdf4e('0x15')]?_0x4652fa['options'][_0xdf4e('0x2b')]||null:null,'group':db[_0xdf4e('0x13')][_0xdf4e('0x31')],'transaction':_0x20d1c7,'lock':_0x20d1c7[_0xdf4e('0x2c')][_0xdf4e('0x2d')],'include':_0x4652fa['options']?_0x4652fa[_0xdf4e('0x15')][_0xdf4e('0x1b')]?_[_0xdf4e('0x19')](_0x4652fa[_0xdf4e('0x15')][_0xdf4e('0x1b')],function(_0x50fc9b){return{'model':db[_0x50fc9b[_0xdf4e('0x1a')]],'as':_0x50fc9b['as'],'attributes':_0x50fc9b[_0xdf4e('0x17')],'include':_0x50fc9b[_0xdf4e('0x1b')]?_[_0xdf4e('0x19')](_0x50fc9b[_0xdf4e('0x1b')],function(_0x2ff034){return{'model':db[_0x2ff034['model']],'as':_0x2ff034['as'],'attributes':_0x2ff034[_0xdf4e('0x17')],'include':_0x2ff034[_0xdf4e('0x1b')]?_['map'](_0x2ff034[_0xdf4e('0x1b')],function(_0x5220a3){return{'model':db[_0x5220a3[_0xdf4e('0x1a')]],'as':_0x5220a3['as'],'attributes':_0x5220a3[_0xdf4e('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdf4e('0x1c')](function(_0x21756c){var _0x46505d=[];for(var _0xb74e43=0x0;_0xb74e43<_0x21756c[_0xdf4e('0x30')];_0xb74e43+=0x1){_0x46505d[_0xdf4e('0x33')](_0x21756c[_0xb74e43][_0xdf4e('0x25')](_0x4652fa[_0xdf4e('0x23')],{'transaction':_0x20d1c7}));}return BPromise[_0xdf4e('0x34')](_0x46505d);});})[_0xdf4e('0x1c')](function(_0x404991){logger[_0xdf4e('0xa')](_0xdf4e('0x40'),_0x4652fa);logger[_0xdf4e('0xd')](_0xdf4e('0x40'),_0x4652fa,JSON[_0xdf4e('0xe')](_0x404991));_0x308489(_0x404991);})['catch'](function(_0x203ecc){logger['error'](_0xdf4e('0x40'),_0x203ecc[_0xdf4e('0x10')],_0x4652fa);_0x2d235e(_0x3e582b[_0xdf4e('0xf')](0x1f4,_0x203ecc['message']));});});});};exports['GetCmHopperPreview']=function(_0x3461b9){var _0x5205b1=this;return new Promise(function(_0x4f0931,_0x590ec0){db['CmContact'][_0xdf4e('0x29')]()['then'](function(_0x4d2754){return db[_0xdf4e('0x13')][_0xdf4e('0x14')]({'raw':_0x3461b9[_0xdf4e('0x15')]?_0x3461b9[_0xdf4e('0x15')][_0xdf4e('0x20')]===undefined?!![]:![]:!![],'where':_0x3461b9[_0xdf4e('0x15')]?_0x3461b9[_0xdf4e('0x15')][_0xdf4e('0x16')]||null:null,'attributes':_0x3461b9[_0xdf4e('0x15')]?_0x3461b9['options'][_0xdf4e('0x17')]||null:null,'limit':_0x3461b9[_0xdf4e('0x15')]?_0x3461b9[_0xdf4e('0x15')]['limit']||null:null,'include':_0x3461b9[_0xdf4e('0x15')]?_0x3461b9[_0xdf4e('0x15')][_0xdf4e('0x1b')]?_[_0xdf4e('0x19')](_0x3461b9[_0xdf4e('0x15')][_0xdf4e('0x1b')],function(_0x1a9690){return{'model':db[_0x1a9690[_0xdf4e('0x1a')]],'as':_0x1a9690['as'],'attributes':_0x1a9690['as']===_0xdf4e('0x41')?_['keys'](_0x4d2754):_0x1a9690[_0xdf4e('0x17')],'include':_0x1a9690[_0xdf4e('0x1b')]?_[_0xdf4e('0x19')](_0x1a9690[_0xdf4e('0x1b')],function(_0x1c98d7){return{'model':db[_0x1c98d7[_0xdf4e('0x1a')]],'as':_0x1c98d7['as'],'attributes':_0x1c98d7[_0xdf4e('0x17')],'include':_0x1c98d7['include']?_[_0xdf4e('0x19')](_0x1c98d7[_0xdf4e('0x1b')],function(_0x3f006a){return{'model':db[_0x3f006a[_0xdf4e('0x1a')]],'as':_0x3f006a['as'],'attributes':_0x3f006a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf4e('0x1c')](function(_0x4c6f0c){logger[_0xdf4e('0xa')](_0xdf4e('0x1d'),_0x3461b9);logger[_0xdf4e('0xd')](_0xdf4e('0x1d'),_0x3461b9,JSON[_0xdf4e('0xe')](_0x4c6f0c));_0x4f0931(_0x4c6f0c);})['catch'](function(_0xd02ce0){logger[_0xdf4e('0xf')]('GetCmHopper',_0xd02ce0[_0xdf4e('0x10')],_0x3461b9);_0x590ec0(_0x5205b1[_0xdf4e('0xf')](0x1f4,_0xd02ce0['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7783000..066b4b6 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 _0x73bd=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','show','post','create','/preview','getPreview','put','update','delete','/:id','exports','multer'];(function(_0x2762ce,_0x4505a0){var _0x444b75=function(_0xad562a){while(--_0xad562a){_0x2762ce['push'](_0x2762ce['shift']());}};_0x444b75(++_0x4505a0);}(_0x73bd,0xf9));var _0xd73b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x73bd[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xd73b('0x0'));var util=require(_0xd73b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd73b('0x2'));var router=express[_0xd73b('0x3')]();var fs_extra=require(_0xd73b('0x4'));var auth=require(_0xd73b('0x5'));var interaction=require(_0xd73b('0x6'));var config=require(_0xd73b('0x7'));var controller=require(_0xd73b('0x8'));router[_0xd73b('0x9')]('/',auth[_0xd73b('0xa')](),controller[_0xd73b('0xb')]);router['get'](_0xd73b('0xc'),auth[_0xd73b('0xa')](),controller[_0xd73b('0xd')]);router[_0xd73b('0x9')](_0xd73b('0xe'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xd73b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd73b('0xf')]);router[_0xd73b('0x10')]('/',auth[_0xd73b('0xa')](),controller[_0xd73b('0x11')]);router[_0xd73b('0x10')](_0xd73b('0x12'),auth[_0xd73b('0xa')](),controller[_0xd73b('0x13')]);router[_0xd73b('0x14')]('/:id',auth[_0xd73b('0xa')](),controller[_0xd73b('0x15')]);router[_0xd73b('0x16')](_0xd73b('0x17'),auth[_0xd73b('0xa')](),controller['destroy']);module[_0xd73b('0x18')]=router; \ No newline at end of file +var _0xe831=['../../components/interaction/service','../../config/environment','./cmHopper.controller','index','get','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/:id','post','create','/preview','getPreview','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x45508e,_0x59708d){var _0xeea413=function(_0x57ec46){while(--_0x57ec46){_0x45508e['push'](_0x45508e['shift']());}};_0xeea413(++_0x59708d);}(_0xe831,0x1a3));var _0x1e83=function(_0xd4c1ba,_0x59c9a6){_0xd4c1ba=_0xd4c1ba-0x0;var _0x360a69=_0xe831[_0xd4c1ba];return _0x360a69;};'use strict';var multer=require(_0x1e83('0x0'));var util=require(_0x1e83('0x1'));var path=require(_0x1e83('0x2'));var timeout=require(_0x1e83('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e83('0x4'));var auth=require(_0x1e83('0x5'));var interaction=require(_0x1e83('0x6'));var config=require(_0x1e83('0x7'));var controller=require(_0x1e83('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e83('0x9')]);router[_0x1e83('0xa')](_0x1e83('0xb'),auth[_0x1e83('0xc')](),controller[_0x1e83('0xd')]);router[_0x1e83('0xa')](_0x1e83('0xe'),auth[_0x1e83('0xc')](),controller[_0x1e83('0xf')]);router[_0x1e83('0xa')](_0x1e83('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x1e83('0x11')]('/',auth[_0x1e83('0xc')](),controller[_0x1e83('0x12')]);router['post'](_0x1e83('0x13'),auth['isAuthenticated'](),controller[_0x1e83('0x14')]);router[_0x1e83('0x15')]('/:id',auth[_0x1e83('0xc')](),controller[_0x1e83('0x16')]);router['delete'](_0x1e83('0x10'),auth[_0x1e83('0xc')](),controller[_0x1e83('0x17')]);module[_0x1e83('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index d25e0b9..b097779 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdde4=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','STRING','INTEGER'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdde4,0xdb));var _0x4dde=function(_0x20724c,_0x2c72cc){_0x20724c=_0x20724c-0x0;var _0x50fe4c=_0xdde4[_0x20724c];return _0x50fe4c;};'use strict';var moment=require(_0x4dde('0x0'));var Sequelize=require(_0x4dde('0x1'));module[_0x4dde('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x4dde('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4dde('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4dde('0x5')],'defaultValue':moment()[_0x4dde('0x6')](_0x4dde('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4dde('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4dde('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4dde('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4dde('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4dde('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4dde('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4dde('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8172=['sequelize','exports','INTEGER','STRING','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x8172,0x119));var _0x2817=function(_0x396819,_0x19e2b3){_0x396819=_0x396819-0x0;var _0x1c3c07=_0x8172[_0x396819];return _0x1c3c07;};'use strict';var moment=require(_0x2817('0x0'));var Sequelize=require(_0x2817('0x1'));module[_0x2817('0x2')]={'CmHopperId':{'type':Sequelize[_0x2817('0x3')]},'phone':{'type':Sequelize[_0x2817('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x2817('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x2817('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2817('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2817('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2817('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2817('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2817('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 6bd60f0..4a83568 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eb2=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','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/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','name','CmHopperAdditionalPhone'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0eb2,0x11c));var _0x20eb=function(_0x3a00cb,_0x407ba5){_0x3a00cb=_0x3a00cb-0x0;var _0x2cf4c2=_0x0eb2[_0x3a00cb];return _0x2cf4c2;};'use strict';var emlformat=require(_0x20eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20eb('0x1'));var jsonpatch=require(_0x20eb('0x2'));var rp=require(_0x20eb('0x3'));var moment=require(_0x20eb('0x4'));var BPromise=require(_0x20eb('0x5'));var Mustache=require('mustache');var util=require(_0x20eb('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x20eb('0x7'));var fs=require('fs');var fs_extra=require(_0x20eb('0x8'));var _=require(_0x20eb('0x9'));var squel=require('squel');var crypto=require(_0x20eb('0xa'));var jsforce=require(_0x20eb('0xb'));var deskjs=require(_0x20eb('0xc'));var toCsv=require(_0x20eb('0xd'));var querystring=require(_0x20eb('0xe'));var Papa=require(_0x20eb('0xf'));var Redis=require(_0x20eb('0x10'));var authService=require(_0x20eb('0x11'));var qs=require(_0x20eb('0x12'));var as=require(_0x20eb('0x13'));var hardwareService=require(_0x20eb('0x14'));var logger=require(_0x20eb('0x15'))(_0x20eb('0x16'));var utils=require(_0x20eb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x20eb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120651,_0x5371a8){_0x5371a8=_0x5371a8||0xcc;return function(_0x2ffef9){if(_0x2ffef9){return _0x120651[_0x20eb('0x19')](_0x5371a8);}return _0x120651[_0x20eb('0x1a')](_0x5371a8)[_0x20eb('0x1b')]();};}function respondWithResult(_0xfee98d,_0xa548eb){_0xa548eb=_0xa548eb||0xc8;return function(_0x4160b2){if(_0x4160b2){return _0xfee98d[_0x20eb('0x1a')](_0xa548eb)[_0x20eb('0x1c')](_0x4160b2);}};}function respondWithFilteredResult(_0x45473f,_0x155545){return function(_0x11b1cc){if(_0x11b1cc){var _0x150704=typeof _0x155545[_0x20eb('0x1d')]===_0x20eb('0x1e')&&typeof _0x155545['limit']===_0x20eb('0x1e');var _0x579270=_0x11b1cc[_0x20eb('0x1f')];var _0x21765e=_0x150704?0x0:_0x155545[_0x20eb('0x1d')];var _0x3c083a=_0x150704?_0x11b1cc[_0x20eb('0x1f')]:_0x155545[_0x20eb('0x1d')]+_0x155545[_0x20eb('0x20')];var _0x51eb8d;if(_0x3c083a>=_0x579270){_0x3c083a=_0x579270;_0x51eb8d=0xc8;}else{_0x51eb8d=0xce;}_0x45473f[_0x20eb('0x1a')](_0x51eb8d);return _0x45473f[_0x20eb('0x21')]('Content-Range',_0x21765e+'-'+_0x3c083a+'/'+_0x579270)[_0x20eb('0x1c')](_0x11b1cc);}return null;};}function patchUpdates(_0x3eb2be){return function(_0x5d5d8d){try{jsonpatch[_0x20eb('0x22')](_0x5d5d8d,_0x3eb2be,!![]);}catch(_0x1c7853){return BPromise[_0x20eb('0x23')](_0x1c7853);}return _0x5d5d8d['save']();};}function saveUpdates(_0x989b4,_0x258a64){return function(_0x431f82){if(_0x431f82){return _0x431f82['update'](_0x989b4)[_0x20eb('0x24')](function(_0x15bac3){return _0x15bac3;});}return null;};}function removeEntity(_0x22350d,_0x5dc978){return function(_0x2a1b56){if(_0x2a1b56){return _0x2a1b56['destroy']()[_0x20eb('0x24')](function(){var _0x363ece=_0x2a1b56[_0x20eb('0x25')]({'plain':!![]});var _0x3b88b3=_0x20eb('0x26');return db[_0x20eb('0x27')][_0x20eb('0x28')]({'where':{'type':_0x3b88b3,'resourceId':_0x363ece['id']}})[_0x20eb('0x24')](function(){return _0x2a1b56;});})[_0x20eb('0x24')](function(){_0x22350d['status'](0xcc)[_0x20eb('0x1b')]();});}};}function handleEntityNotFound(_0x33a365,_0x25a523){return function(_0x5117c7){if(!_0x5117c7){_0x33a365['sendStatus'](0x194);}return _0x5117c7;};}function handleError(_0x5ef0b0,_0x55f1e8){_0x55f1e8=_0x55f1e8||0x1f4;return function(_0x42455f){logger[_0x20eb('0x29')](_0x42455f['stack']);if(_0x42455f[_0x20eb('0x2a')]){delete _0x42455f['name'];}_0x5ef0b0[_0x20eb('0x1a')](_0x55f1e8)['send'](_0x42455f);};}exports['index']=function(_0x125a23,_0x3999ec){var _0x4fb803={},_0x5abe40={},_0xfa014d={'count':0x0,'rows':[]};var _0x3ae2b0=_['map'](db[_0x20eb('0x2b')][_0x20eb('0x2c')],function(_0x58e0b5){return{'name':_0x58e0b5[_0x20eb('0x2d')],'type':_0x58e0b5[_0x20eb('0x2e')]['key']};});_0x5abe40[_0x20eb('0x2f')]=_['map'](_0x3ae2b0,_0x20eb('0x2a'));_0x5abe40[_0x20eb('0x30')]=_[_0x20eb('0x31')](_0x125a23['query']);_0x5abe40[_0x20eb('0x32')]=_[_0x20eb('0x33')](_0x5abe40[_0x20eb('0x2f')],_0x5abe40[_0x20eb('0x30')]);_0x4fb803['attributes']=_[_0x20eb('0x33')](_0x5abe40[_0x20eb('0x2f')],qs[_0x20eb('0x34')](_0x125a23[_0x20eb('0x30')][_0x20eb('0x34')]));_0x4fb803[_0x20eb('0x35')]=_0x4fb803[_0x20eb('0x35')][_0x20eb('0x36')]?_0x4fb803[_0x20eb('0x35')]:_0x5abe40[_0x20eb('0x2f')];if(!_0x125a23[_0x20eb('0x30')]['hasOwnProperty'](_0x20eb('0x37'))){_0x4fb803[_0x20eb('0x20')]=qs[_0x20eb('0x20')](_0x125a23[_0x20eb('0x30')]['limit']);_0x4fb803[_0x20eb('0x1d')]=qs[_0x20eb('0x1d')](_0x125a23[_0x20eb('0x30')]['offset']);}_0x4fb803[_0x20eb('0x38')]=qs[_0x20eb('0x39')](_0x125a23[_0x20eb('0x30')][_0x20eb('0x39')]);_0x4fb803[_0x20eb('0x3a')]=qs[_0x20eb('0x32')](_[_0x20eb('0x3b')](_0x125a23[_0x20eb('0x30')],_0x5abe40[_0x20eb('0x32')]),_0x3ae2b0);if(_0x125a23[_0x20eb('0x30')]['filter']){_0x4fb803[_0x20eb('0x3a')]=_['merge'](_0x4fb803[_0x20eb('0x3a')],{'$or':_[_0x20eb('0x3c')](_0x3ae2b0,function(_0x279a34){if(_0x279a34[_0x20eb('0x2e')]!==_0x20eb('0x3d')){var _0x2b8d14={};_0x2b8d14[_0x279a34[_0x20eb('0x2a')]]={'$like':'%'+_0x125a23[_0x20eb('0x30')][_0x20eb('0x3e')]+'%'};return _0x2b8d14;}})});}_0x4fb803=_['merge']({},_0x4fb803,_0x125a23[_0x20eb('0x3f')]);var _0x4cba6e={'where':_0x4fb803[_0x20eb('0x3a')]};return db['CmHopperAdditionalPhone'][_0x20eb('0x1f')](_0x4cba6e)[_0x20eb('0x24')](function(_0x565f6b){_0xfa014d[_0x20eb('0x1f')]=_0x565f6b;if(_0x125a23[_0x20eb('0x30')][_0x20eb('0x40')]){_0x4fb803[_0x20eb('0x41')]=[{'all':!![]}];}return db[_0x20eb('0x2b')][_0x20eb('0x42')](_0x4fb803);})[_0x20eb('0x24')](function(_0x8fb3af){_0xfa014d[_0x20eb('0x43')]=_0x8fb3af;return _0xfa014d;})[_0x20eb('0x24')](respondWithFilteredResult(_0x3999ec,_0x4fb803))[_0x20eb('0x44')](handleError(_0x3999ec,null));};exports[_0x20eb('0x45')]=function(_0xeb74d2,_0x265b02){var _0x212092={'raw':!![],'where':{'id':_0xeb74d2[_0x20eb('0x46')]['id']}},_0xa59e81={};_0xa59e81[_0x20eb('0x2f')]=_[_0x20eb('0x31')](db['CmHopperAdditionalPhone'][_0x20eb('0x2c')]);_0xa59e81[_0x20eb('0x30')]=_[_0x20eb('0x31')](_0xeb74d2[_0x20eb('0x30')]);_0xa59e81[_0x20eb('0x32')]=_['intersection'](_0xa59e81[_0x20eb('0x2f')],_0xa59e81[_0x20eb('0x30')]);_0x212092['attributes']=_[_0x20eb('0x33')](_0xa59e81['model'],qs[_0x20eb('0x34')](_0xeb74d2[_0x20eb('0x30')][_0x20eb('0x34')]));_0x212092[_0x20eb('0x35')]=_0x212092['attributes'][_0x20eb('0x36')]?_0x212092[_0x20eb('0x35')]:_0xa59e81[_0x20eb('0x2f')];if(_0xeb74d2['query'][_0x20eb('0x40')]){_0x212092['include']=[{'all':!![]}];}_0x212092=_[_0x20eb('0x47')]({},_0x212092,_0xeb74d2[_0x20eb('0x3f')]);return db[_0x20eb('0x2b')]['find'](_0x212092)[_0x20eb('0x24')](handleEntityNotFound(_0x265b02,null))[_0x20eb('0x24')](respondWithResult(_0x265b02,null))[_0x20eb('0x44')](handleError(_0x265b02,null));};exports[_0x20eb('0x48')]=function(_0x4aa040,_0xcd25ff){return db[_0x20eb('0x2b')][_0x20eb('0x48')](_0x4aa040[_0x20eb('0x49')],{})[_0x20eb('0x24')](function(_0x4ab8d3){var _0x2d4247=_0x4aa040[_0x20eb('0x4a')][_0x20eb('0x25')]({'plain':!![]});if(!_0x2d4247)throw new Error(_0x20eb('0x4b'));if(_0x2d4247[_0x20eb('0x4c')]==='user'){var _0x1ffce3=_0x4ab8d3[_0x20eb('0x25')]({'plain':!![]});var _0x37a1fb='CmHopperAdditionalPhones';return db[_0x20eb('0x4d')][_0x20eb('0x4e')]({'where':{'name':_0x37a1fb,'userProfileId':_0x2d4247[_0x20eb('0x4f')]},'raw':!![]})[_0x20eb('0x24')](function(_0x21683e){if(_0x21683e&&_0x21683e[_0x20eb('0x50')]===0x0){return db['UserProfileResource'][_0x20eb('0x48')]({'name':_0x1ffce3[_0x20eb('0x2a')],'resourceId':_0x1ffce3['id'],'type':_0x21683e['name'],'sectionId':_0x21683e['id']},{})[_0x20eb('0x24')](function(){return _0x4ab8d3;});}else{return _0x4ab8d3;}})[_0x20eb('0x44')](function(_0x2d4b0d){logger[_0x20eb('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d4b0d);throw _0x2d4b0d;});}return _0x4ab8d3;})[_0x20eb('0x24')](respondWithResult(_0xcd25ff,0xc9))['catch'](handleError(_0xcd25ff,null));};exports[_0x20eb('0x51')]=function(_0x210a65,_0x23a5da){if(_0x210a65[_0x20eb('0x49')]['id']){delete _0x210a65[_0x20eb('0x49')]['id'];}return db[_0x20eb('0x2b')]['find']({'where':{'id':_0x210a65[_0x20eb('0x46')]['id']}})[_0x20eb('0x24')](handleEntityNotFound(_0x23a5da,null))[_0x20eb('0x24')](saveUpdates(_0x210a65['body'],null))['then'](respondWithResult(_0x23a5da,null))[_0x20eb('0x44')](handleError(_0x23a5da,null));};exports[_0x20eb('0x28')]=function(_0x145c95,_0x2117c2){return db[_0x20eb('0x2b')]['find']({'where':{'id':_0x145c95[_0x20eb('0x46')]['id']}})[_0x20eb('0x24')](handleEntityNotFound(_0x2117c2,null))[_0x20eb('0x24')](removeEntity(_0x2117c2,null))['catch'](handleError(_0x2117c2,null));}; \ No newline at end of file +var _0x4e06=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','findAll','rows','catch','include','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x10f28c,_0x286c94){var _0x103835=function(_0x248451){while(--_0x248451){_0x10f28c['push'](_0x10f28c['shift']());}};_0x103835(++_0x286c94);}(_0x4e06,0x1d2));var _0x64e0=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x4e06[_0x48d6a3];return _0x38bfa0;};'use strict';var emlformat=require(_0x64e0('0x0'));var rimraf=require(_0x64e0('0x1'));var zipdir=require(_0x64e0('0x2'));var jsonpatch=require(_0x64e0('0x3'));var rp=require('request-promise');var moment=require(_0x64e0('0x4'));var BPromise=require(_0x64e0('0x5'));var Mustache=require(_0x64e0('0x6'));var util=require(_0x64e0('0x7'));var path=require(_0x64e0('0x8'));var sox=require('sox');var csv=require(_0x64e0('0x9'));var ejs=require(_0x64e0('0xa'));var fs=require('fs');var fs_extra=require(_0x64e0('0xb'));var _=require(_0x64e0('0xc'));var squel=require(_0x64e0('0xd'));var crypto=require(_0x64e0('0xe'));var jsforce=require(_0x64e0('0xf'));var deskjs=require(_0x64e0('0x10'));var toCsv=require(_0x64e0('0x9'));var querystring=require(_0x64e0('0x11'));var Papa=require(_0x64e0('0x12'));var Redis=require(_0x64e0('0x13'));var authService=require(_0x64e0('0x14'));var qs=require(_0x64e0('0x15'));var as=require(_0x64e0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64e0('0x17'))(_0x64e0('0x18'));var utils=require(_0x64e0('0x19'));var config=require(_0x64e0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x64e0('0x1b'))['db'];function respondWithStatusCode(_0x438ea3,_0x2b2525){_0x2b2525=_0x2b2525||0xcc;return function(_0x40ad35){if(_0x40ad35){return _0x438ea3[_0x64e0('0x1c')](_0x2b2525);}return _0x438ea3[_0x64e0('0x1d')](_0x2b2525)['end']();};}function respondWithResult(_0x4b04b8,_0x25b854){_0x25b854=_0x25b854||0xc8;return function(_0x566c7e){if(_0x566c7e){return _0x4b04b8[_0x64e0('0x1d')](_0x25b854)[_0x64e0('0x1e')](_0x566c7e);}};}function respondWithFilteredResult(_0x3ffeb5,_0x32fdd4){return function(_0x5bb25e){if(_0x5bb25e){var _0x528693=typeof _0x32fdd4[_0x64e0('0x1f')]===_0x64e0('0x20')&&typeof _0x32fdd4[_0x64e0('0x21')]===_0x64e0('0x20');var _0x19ac5f=_0x5bb25e[_0x64e0('0x22')];var _0x3ad6fb=_0x528693?0x0:_0x32fdd4[_0x64e0('0x1f')];var _0x56a743=_0x528693?_0x5bb25e[_0x64e0('0x22')]:_0x32fdd4[_0x64e0('0x1f')]+_0x32fdd4[_0x64e0('0x21')];var _0x4ccdfd;if(_0x56a743>=_0x19ac5f){_0x56a743=_0x19ac5f;_0x4ccdfd=0xc8;}else{_0x4ccdfd=0xce;}_0x3ffeb5[_0x64e0('0x1d')](_0x4ccdfd);return _0x3ffeb5['set'](_0x64e0('0x23'),_0x3ad6fb+'-'+_0x56a743+'/'+_0x19ac5f)[_0x64e0('0x1e')](_0x5bb25e);}return null;};}function patchUpdates(_0xe1e945){return function(_0x39a915){try{jsonpatch[_0x64e0('0x24')](_0x39a915,_0xe1e945,!![]);}catch(_0x578b14){return BPromise[_0x64e0('0x25')](_0x578b14);}return _0x39a915[_0x64e0('0x26')]();};}function saveUpdates(_0x5a604c,_0xf18fac){return function(_0x4257){if(_0x4257){return _0x4257[_0x64e0('0x27')](_0x5a604c)['then'](function(_0x5bcab5){return _0x5bcab5;});}return null;};}function removeEntity(_0x465844,_0x39a4be){return function(_0x530216){if(_0x530216){return _0x530216[_0x64e0('0x28')]()[_0x64e0('0x29')](function(){var _0x175a02=_0x530216[_0x64e0('0x2a')]({'plain':!![]});var _0x41c5b7=_0x64e0('0x2b');return db[_0x64e0('0x2c')]['destroy']({'where':{'type':_0x41c5b7,'resourceId':_0x175a02['id']}})['then'](function(){return _0x530216;});})[_0x64e0('0x29')](function(){_0x465844[_0x64e0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x593e7b,_0x1e8bc0){return function(_0x43aebd){if(!_0x43aebd){_0x593e7b['sendStatus'](0x194);}return _0x43aebd;};}function handleError(_0x5ebb16,_0x29bbab){_0x29bbab=_0x29bbab||0x1f4;return function(_0x385fd2){logger[_0x64e0('0x2d')](_0x385fd2['stack']);if(_0x385fd2['name']){delete _0x385fd2[_0x64e0('0x2e')];}_0x5ebb16[_0x64e0('0x1d')](_0x29bbab)[_0x64e0('0x2f')](_0x385fd2);};}exports[_0x64e0('0x30')]=function(_0x176617,_0x10c622){var _0x2ab576={},_0xef6ed={},_0x418562={'count':0x0,'rows':[]};var _0x83d5e2=_[_0x64e0('0x31')](db['CmHopperAdditionalPhone'][_0x64e0('0x32')],function(_0x141883){return{'name':_0x141883[_0x64e0('0x33')],'type':_0x141883[_0x64e0('0x34')][_0x64e0('0x35')]};});_0xef6ed[_0x64e0('0x36')]=_[_0x64e0('0x31')](_0x83d5e2,_0x64e0('0x2e'));_0xef6ed[_0x64e0('0x37')]=_[_0x64e0('0x38')](_0x176617[_0x64e0('0x37')]);_0xef6ed[_0x64e0('0x39')]=_[_0x64e0('0x3a')](_0xef6ed[_0x64e0('0x36')],_0xef6ed[_0x64e0('0x37')]);_0x2ab576[_0x64e0('0x3b')]=_['intersection'](_0xef6ed[_0x64e0('0x36')],qs[_0x64e0('0x3c')](_0x176617[_0x64e0('0x37')]['fields']));_0x2ab576['attributes']=_0x2ab576['attributes'][_0x64e0('0x3d')]?_0x2ab576['attributes']:_0xef6ed['model'];if(!_0x176617[_0x64e0('0x37')][_0x64e0('0x3e')](_0x64e0('0x3f'))){_0x2ab576[_0x64e0('0x21')]=qs[_0x64e0('0x21')](_0x176617[_0x64e0('0x37')][_0x64e0('0x21')]);_0x2ab576[_0x64e0('0x1f')]=qs[_0x64e0('0x1f')](_0x176617[_0x64e0('0x37')][_0x64e0('0x1f')]);}_0x2ab576[_0x64e0('0x40')]=qs[_0x64e0('0x41')](_0x176617[_0x64e0('0x37')][_0x64e0('0x41')]);_0x2ab576[_0x64e0('0x42')]=qs[_0x64e0('0x39')](_[_0x64e0('0x43')](_0x176617[_0x64e0('0x37')],_0xef6ed[_0x64e0('0x39')]),_0x83d5e2);if(_0x176617[_0x64e0('0x37')][_0x64e0('0x44')]){_0x2ab576[_0x64e0('0x42')]=_[_0x64e0('0x45')](_0x2ab576[_0x64e0('0x42')],{'$or':_[_0x64e0('0x31')](_0x83d5e2,function(_0x43db57){if(_0x43db57[_0x64e0('0x34')]!==_0x64e0('0x46')){var _0xdec233={};_0xdec233[_0x43db57['name']]={'$like':'%'+_0x176617[_0x64e0('0x37')][_0x64e0('0x44')]+'%'};return _0xdec233;}})});}_0x2ab576=_[_0x64e0('0x45')]({},_0x2ab576,_0x176617[_0x64e0('0x47')]);var _0x27abfc={'where':_0x2ab576[_0x64e0('0x42')]};return db[_0x64e0('0x48')][_0x64e0('0x22')](_0x27abfc)[_0x64e0('0x29')](function(_0x294b2e){_0x418562['count']=_0x294b2e;if(_0x176617[_0x64e0('0x37')][_0x64e0('0x49')]){_0x2ab576['include']=[{'all':!![]}];}return db[_0x64e0('0x48')][_0x64e0('0x4a')](_0x2ab576);})[_0x64e0('0x29')](function(_0x1d5ddc){_0x418562[_0x64e0('0x4b')]=_0x1d5ddc;return _0x418562;})[_0x64e0('0x29')](respondWithFilteredResult(_0x10c622,_0x2ab576))[_0x64e0('0x4c')](handleError(_0x10c622,null));};exports['show']=function(_0x5ae0c6,_0x288f48){var _0x44d99e={'raw':!![],'where':{'id':_0x5ae0c6['params']['id']}},_0x41c696={};_0x41c696[_0x64e0('0x36')]=_[_0x64e0('0x38')](db[_0x64e0('0x48')][_0x64e0('0x32')]);_0x41c696[_0x64e0('0x37')]=_['keys'](_0x5ae0c6['query']);_0x41c696[_0x64e0('0x39')]=_[_0x64e0('0x3a')](_0x41c696[_0x64e0('0x36')],_0x41c696[_0x64e0('0x37')]);_0x44d99e[_0x64e0('0x3b')]=_[_0x64e0('0x3a')](_0x41c696[_0x64e0('0x36')],qs[_0x64e0('0x3c')](_0x5ae0c6['query']['fields']));_0x44d99e[_0x64e0('0x3b')]=_0x44d99e[_0x64e0('0x3b')][_0x64e0('0x3d')]?_0x44d99e[_0x64e0('0x3b')]:_0x41c696['model'];if(_0x5ae0c6[_0x64e0('0x37')]['includeAll']){_0x44d99e[_0x64e0('0x4d')]=[{'all':!![]}];}_0x44d99e=_[_0x64e0('0x45')]({},_0x44d99e,_0x5ae0c6[_0x64e0('0x47')]);return db[_0x64e0('0x48')]['find'](_0x44d99e)['then'](handleEntityNotFound(_0x288f48,null))[_0x64e0('0x29')](respondWithResult(_0x288f48,null))[_0x64e0('0x4c')](handleError(_0x288f48,null));};exports['create']=function(_0x33a68a,_0x56433f){return db[_0x64e0('0x48')][_0x64e0('0x4e')](_0x33a68a[_0x64e0('0x4f')],{})[_0x64e0('0x29')](function(_0x39ccf0){var _0xeb8ca9=_0x33a68a[_0x64e0('0x50')]['get']({'plain':!![]});if(!_0xeb8ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeb8ca9[_0x64e0('0x51')]===_0x64e0('0x50')){var _0x162645=_0x39ccf0['get']({'plain':!![]});var _0x15623d=_0x64e0('0x2b');return db[_0x64e0('0x52')]['find']({'where':{'name':_0x15623d,'userProfileId':_0xeb8ca9[_0x64e0('0x53')]},'raw':!![]})[_0x64e0('0x29')](function(_0x3c9e92){if(_0x3c9e92&&_0x3c9e92[_0x64e0('0x54')]===0x0){return db[_0x64e0('0x2c')][_0x64e0('0x4e')]({'name':_0x162645['name'],'resourceId':_0x162645['id'],'type':_0x3c9e92[_0x64e0('0x2e')],'sectionId':_0x3c9e92['id']},{})[_0x64e0('0x29')](function(){return _0x39ccf0;});}else{return _0x39ccf0;}})[_0x64e0('0x4c')](function(_0x3e5d8c){logger[_0x64e0('0x2d')](_0x64e0('0x55'),_0x3e5d8c);throw _0x3e5d8c;});}return _0x39ccf0;})['then'](respondWithResult(_0x56433f,0xc9))['catch'](handleError(_0x56433f,null));};exports[_0x64e0('0x27')]=function(_0x376483,_0x6f9de6){if(_0x376483['body']['id']){delete _0x376483['body']['id'];}return db[_0x64e0('0x48')][_0x64e0('0x56')]({'where':{'id':_0x376483[_0x64e0('0x57')]['id']}})[_0x64e0('0x29')](handleEntityNotFound(_0x6f9de6,null))['then'](saveUpdates(_0x376483[_0x64e0('0x4f')],null))[_0x64e0('0x29')](respondWithResult(_0x6f9de6,null))[_0x64e0('0x4c')](handleError(_0x6f9de6,null));};exports[_0x64e0('0x28')]=function(_0x5b9c5b,_0x2a8403){return db['CmHopperAdditionalPhone'][_0x64e0('0x56')]({'where':{'id':_0x5b9c5b[_0x64e0('0x57')]['id']}})[_0x64e0('0x29')](handleEntityNotFound(_0x2a8403,null))[_0x64e0('0x29')](removeEntity(_0x2a8403,null))['catch'](handleError(_0x2a8403,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 74c64b8..c8789dd 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fde=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5a9017,_0x4312fc){var _0x596e52=function(_0x35843d){while(--_0x35843d){_0x5a9017['push'](_0x5a9017['shift']());}};_0x596e52(++_0x4312fc);}(_0x0fde,0x1a9));var _0xe0fd=function(_0x447191,_0x4b3214){_0x447191=_0x447191-0x0;var _0x34e552=_0x0fde[_0x447191];return _0x34e552;};'use strict';var _=require(_0xe0fd('0x0'));var util=require(_0xe0fd('0x1'));var logger=require(_0xe0fd('0x2'))(_0xe0fd('0x3'));var moment=require(_0xe0fd('0x4'));var BPromise=require('bluebird');var rp=require(_0xe0fd('0x5'));var fs=require('fs');var path=require(_0xe0fd('0x6'));var rimraf=require(_0xe0fd('0x7'));var config=require(_0xe0fd('0x8'));var attributes=require(_0xe0fd('0x9'));module[_0xe0fd('0xa')]=function(_0x4aa096,_0x35eed4){return _0x4aa096[_0xe0fd('0xb')](_0xe0fd('0xc'),attributes,{'tableName':_0xe0fd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8c7=['define','CmHopperAdditionalPhone','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xb8c7,0xff));var _0x7b8c=function(_0x41a01f,_0x4dab39){_0x41a01f=_0x41a01f-0x0;var _0x5efc7a=_0xb8c7[_0x41a01f];return _0x5efc7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b8c('0x0'))(_0x7b8c('0x1'));var moment=require(_0x7b8c('0x2'));var BPromise=require(_0x7b8c('0x3'));var rp=require(_0x7b8c('0x4'));var fs=require('fs');var path=require(_0x7b8c('0x5'));var rimraf=require(_0x7b8c('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b8c('0x7'));module[_0x7b8c('0x8')]=function(_0x425697,_0x38e99c){return _0x425697[_0x7b8c('0x9')](_0x7b8c('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 544a382..087c11f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeec6=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countmachineretry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5b8a7d,_0x5a59be){var _0x5c2a42=function(_0x368624){while(--_0x368624){_0x5b8a7d['push'](_0x5b8a7d['shift']());}};_0x5c2a42(++_0x5a59be);}(_0xeec6,0x1c2));var _0x6eec=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xeec6[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});}exports['VerifyAdditionalPhones']=function(_0x3ee353){var _0x80736b=this;return new Promise(function(_0xb1eab7,_0x56c78b){return db[_0x6eec('0x15')][_0x6eec('0x16')]({'raw':!![],'where':{'ContactId':_0x3ee353[_0x6eec('0x17')][_0x6eec('0x18')],'ListId':_0x3ee353[_0x6eec('0x17')][_0x6eec('0x19')],'VoiceQueueId':_0x3ee353['body'][_0x6eec('0x1a')]===undefined?null:_0x3ee353[_0x6eec('0x17')][_0x6eec('0x1a')],'CampaignId':_0x3ee353[_0x6eec('0x17')][_0x6eec('0x1b')]===undefined?null:_0x3ee353[_0x6eec('0x17')]['CampaignId']}})[_0x6eec('0xc')](function(_0x852d08){if(_0x852d08!=null){return db[_0x6eec('0x1c')][_0x6eec('0x16')]({'raw':!![],'where':{'CmHopperId':_0x852d08['id'],'OrderBy':{'$gt':_0x852d08[_0x6eec('0x1d')]}},'order':[[_0x6eec('0x1d'),'ASC']]})[_0x6eec('0xc')](function(_0x2ad14b){var _0xd664f5=0x0;if(_0x2ad14b){if(_0x2ad14b[_0x6eec('0x1e')]+_0x2ad14b[_0x6eec('0x1f')]+_0x2ad14b[_0x6eec('0x20')]+_0x2ad14b[_0x6eec('0x21')]+_0x2ad14b[_0x6eec('0x22')]+_0x2ad14b[_0x6eec('0x23')]+_0x2ad14b['countmachineretry']+_0x2ad14b[_0x6eec('0x24')]<_0x3ee353[_0x6eec('0x25')][_0x6eec('0x26')])_0xd664f5=0x1;_0xb1eab7({'additional':_0xd664f5});}else{return db[_0x6eec('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x852d08['id']},'order':[[_0x6eec('0x1d'),_0x6eec('0x27')]]})['then'](function(_0x54b446){var _0x3240c3=0x0;if(_0x54b446){if(_0x54b446['countbusyretry']+_0x54b446[_0x6eec('0x1f')]+_0x54b446[_0x6eec('0x20')]+_0x54b446[_0x6eec('0x21')]+_0x54b446[_0x6eec('0x22')]+_0x54b446[_0x6eec('0x23')]+_0x54b446[_0x6eec('0x28')]+_0x54b446[_0x6eec('0x24')]<_0x3ee353[_0x6eec('0x25')][_0x6eec('0x26')])_0x3240c3=0x1;_0xb1eab7({'additional':_0x3240c3});}else{_0xb1eab7({'additional':0x0});}})[_0x6eec('0x14')](function(_0x48f66f){logger[_0x6eec('0x10')]('VerifyAdditionalPhones',_0x48f66f[_0x6eec('0x12')],_0x3ee353);_0x56c78b(_0x80736b[_0x6eec('0x10')](0x1f4,_0x48f66f[_0x6eec('0x12')]));});}})['catch'](function(_0x57b40b){logger['error'](_0x6eec('0x29'),_0x57b40b[_0x6eec('0x12')],_0x3ee353);_0x56c78b(_0x80736b[_0x6eec('0x10')](0x1f4,_0x57b40b[_0x6eec('0x12')]));});}else _0xb1eab7({'additional':0x0});});});};exports[_0x6eec('0x2a')]=function(_0x23547d){var _0x22e0cb=this;return new Promise(function(_0x167c8d,_0x2bc106){return db[_0x6eec('0x15')][_0x6eec('0x16')]({'raw':!![],'where':{'ContactId':_0x23547d[_0x6eec('0x17')]['ContactId'],'ListId':_0x23547d[_0x6eec('0x17')][_0x6eec('0x19')],'VoiceQueueId':_0x23547d[_0x6eec('0x17')]['VoiceQueueId']===undefined?null:_0x23547d[_0x6eec('0x17')][_0x6eec('0x1a')],'CampaignId':_0x23547d[_0x6eec('0x17')][_0x6eec('0x1b')]===undefined?null:_0x23547d[_0x6eec('0x17')][_0x6eec('0x1b')]}})['then'](function(_0x45cfb6){if(_0x45cfb6!=null){return db[_0x6eec('0x1c')][_0x6eec('0x16')]({'raw':!![],'where':{'CmHopperId':_0x45cfb6['id'],'OrderBy':{'$gte':_0x45cfb6['OrderBy']}},'order':[['OrderBy',_0x6eec('0x27')]]})[_0x6eec('0xc')](function(_0x10960b){if(_0x10960b)return activateAdditionalPhone(_0x45cfb6,_0x23547d[_0x6eec('0x17')],_0x10960b,_0x23547d[_0x6eec('0x2b')],_0x23547d['waitTime'])[_0x6eec('0xc')](function(_0x2c3b14){_0x167c8d(_0x2c3b14);});else{return db[_0x6eec('0x1c')][_0x6eec('0x16')]({'raw':!![],'where':{'CmHopperId':_0x45cfb6['id']},'order':[[_0x6eec('0x1d'),_0x6eec('0x27')]]})[_0x6eec('0xc')](function(_0x1deed2){if(_0x1deed2)return activateAdditionalPhone(_0x45cfb6,_0x23547d['body'],_0x1deed2,_0x23547d[_0x6eec('0x2b')],_0x23547d[_0x6eec('0x2c')])['then'](function(_0x5b3283){_0x167c8d(_0x5b3283);});else{_0x167c8d({'id':_0x45cfb6['id'],'phone':''});}})[_0x6eec('0x14')](function(_0x66f786){logger[_0x6eec('0x10')](_0x6eec('0x29'),_0x66f786['message'],_0x23547d);_0x2bc106(_0x22e0cb['error'](0x1f4,_0x66f786[_0x6eec('0x12')]));});}})['catch'](function(_0x5ac8b2){logger[_0x6eec('0x10')](_0x6eec('0x29'),_0x5ac8b2[_0x6eec('0x12')],_0x23547d);_0x2bc106(_0x22e0cb[_0x6eec('0x10')](0x1f4,_0x5ac8b2[_0x6eec('0x12')]));});}else _0x167c8d(0x1);});});};function activateAdditionalPhone(_0x58dfe7,_0x931bcf,_0x3a4d25,_0x4e0709,_0x2fd444){return new Promise(function(_0x241512,_0x5028a2){logger[_0x6eec('0xd')](_0x6eec('0x29'),_0x3a4d25);var _0x4e3b1e;if(moment()>moment(_0x3a4d25[_0x6eec('0x2d')])){_0x4e3b1e=moment()[_0x6eec('0x2e')](_0x2fd444||0x3,_0x6eec('0x2f'));}else{if(_0x3a4d25[_0x6eec('0x1d')]==0x0){_0x4e3b1e=moment(_0x3a4d25['scheduledat']);}else{_0x4e3b1e=moment()[_0x6eec('0x2e')](_0x2fd444||0x3,_0x6eec('0x2f'));}}var _0x45e22a={'phone':_0x58dfe7[_0x6eec('0x30')],'active':0x0,'OrderBy':_[_0x6eec('0x31')](_0x58dfe7['OrderBy'])?0x0:_0x58dfe7['OrderBy'],'scheduledat':moment()[_0x6eec('0x2e')](_0x4e0709||0x1,_0x6eec('0x2f')),'countbusyretry':_0x931bcf[_0x6eec('0x1e')],'countcongestionretry':_0x931bcf[_0x6eec('0x1f')],'countnoanswerretry':_0x931bcf[_0x6eec('0x20')],'countnosuchnumberretry':_0x931bcf['countnosuchnumberretry'],'countdropretry':_0x931bcf[_0x6eec('0x22')],'countabandonedretry':_0x931bcf['countabandonedretry'],'countmachineretry':_0x931bcf[_0x6eec('0x28')],'countagentrejectretry':_0x931bcf[_0x6eec('0x24')],'createdAt':_0x931bcf[_0x6eec('0x32')],'updatedAt':_0x931bcf['updatedAt']};var _0x2b83f2={'CmHopperId':_0x58dfe7['id'],'phone':_0x3a4d25[_0x6eec('0x30')],'active':0x0,'OrderBy':_[_0x6eec('0x31')](_0x3a4d25[_0x6eec('0x1d')])?0x0:_0x3a4d25[_0x6eec('0x1d')],'scheduledat':_0x4e3b1e,'countbusyretry':_0x3a4d25['countbusyretry'],'countcongestionretry':_0x3a4d25[_0x6eec('0x1f')],'countnoanswerretry':_0x3a4d25['countnoanswerretry'],'countnosuchnumberretry':_0x3a4d25['countnosuchnumberretry'],'countdropretry':_0x3a4d25[_0x6eec('0x22')],'countabandonedretry':_0x3a4d25['countabandonedretry'],'countmachineretry':_0x3a4d25[_0x6eec('0x28')],'countagentrejectretry':_0x3a4d25[_0x6eec('0x24')],'createdAt':_0x3a4d25[_0x6eec('0x32')],'updatedAt':_0x3a4d25['updatedAt']};logger['info'](_0x6eec('0x33'),_0x45e22a);logger[_0x6eec('0xd')](_0x6eec('0x34'),_0x2b83f2);return db[_0x6eec('0x35')][_0x6eec('0x36')](function(_0x2c9650){return db[_0x6eec('0x1c')][_0x6eec('0x37')](_0x45e22a,{'where':{'id':_0x3a4d25['id']}},{'transaction':_0x2c9650})[_0x6eec('0xc')](function(){return db[_0x6eec('0x15')]['update'](_0x2b83f2,{'where':{'id':_0x58dfe7['id']}},{'transaction':_0x2c9650});});})['then'](function(_0x1a8cf6){_0x241512({'id':_0x58dfe7['id'],'phone':_0x3a4d25[_0x6eec('0x30')]});})[_0x6eec('0x14')](function(_0x577fb6){logger[_0x6eec('0x10')](_0x6eec('0x29'),_0x577fb6[_0x6eec('0x12')],req);_0x5028a2(_this[_0x6eec('0x10')](0x1f4,_0x577fb6[_0x6eec('0x12')]));});});}exports[_0x6eec('0x38')]=function(_0x10c10a){var _0x413de9=this;return new Promise(function(_0x5a6e05,_0xdf888d){return db[_0x6eec('0x15')][_0x6eec('0x37')](_0x10c10a[_0x6eec('0x17')]['field'],{'where':{'id':_0x10c10a['body']['id']}})['then'](function(_0x36c49b){_0x5a6e05(_0x36c49b);})[_0x6eec('0x14')](function(_0x8e903b){logger[_0x6eec('0x10')]('IncrementPreviewCounters',_0x8e903b['message'],_0x10c10a);_0xdf888d(_0x413de9[_0x6eec('0x10')](0x1f4,_0x8e903b[_0x6eec('0x12')]));});});}; \ No newline at end of file +var _0x3435=['SwapAdditionalPhones','waitTime','scheduledat','minutes','add','phone','countdropretry','countagentrejectretry','createdAt','updatedAt','isNil','info','hopperToAdd','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','entity','countbusyretry','countabandonedretry','dialGlobalMaxRetry','VerifyAdditionalPhones'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x3435,0xfa));var _0x5343=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x3435[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));var BPromise=require(_0x5343('0x3'));var rs=require(_0x5343('0x4'));var fs=require('fs');var Redis=require(_0x5343('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5343('0x6'));var logger=require(_0x5343('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5343('0x8'));var client=jayson[_0x5343('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x544b29,_0x13641f,_0x1e1911){return new BPromise(function(_0x9ea9b6,_0x245034){return client[_0x5343('0xa')](_0x544b29,_0x1e1911)['then'](function(_0x44421c){logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));logger[_0x5343('0xd')](_0x5343('0xe'),_0x13641f,_0x5343('0xc'),JSON['stringify'](_0x44421c));if(_0x44421c[_0x5343('0xf')]){if(_0x44421c[_0x5343('0xf')][_0x5343('0x10')]===0x1f4){logger['error'](_0x5343('0xb'),_0x13641f,_0x44421c['error'][_0x5343('0x11')]);return _0x245034(_0x44421c[_0x5343('0xf')]['message']);}logger[_0x5343('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x13641f,_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);return _0x9ea9b6(_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);}else{logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));_0x9ea9b6(_0x44421c[_0x5343('0x12')][_0x5343('0x11')]);}})[_0x5343('0x13')](function(_0x2913e8){logger[_0x5343('0xf')](_0x5343('0xb'),_0x13641f,_0x2913e8);_0x245034(_0x2913e8);});});}exports['VerifyAdditionalPhones']=function(_0x432992){var _0xec1ba0=this;return new Promise(function(_0x1f5098,_0x489e1c){return db[_0x5343('0x14')][_0x5343('0x15')]({'raw':!![],'where':{'ContactId':_0x432992[_0x5343('0x16')][_0x5343('0x17')],'ListId':_0x432992[_0x5343('0x16')][_0x5343('0x18')],'VoiceQueueId':_0x432992[_0x5343('0x16')][_0x5343('0x19')]===undefined?null:_0x432992[_0x5343('0x16')]['VoiceQueueId'],'CampaignId':_0x432992[_0x5343('0x16')][_0x5343('0x1a')]===undefined?null:_0x432992[_0x5343('0x16')][_0x5343('0x1a')]}})[_0x5343('0x1b')](function(_0x4e7c0f){if(_0x4e7c0f!=null){return db[_0x5343('0x1c')][_0x5343('0x15')]({'raw':!![],'where':{'CmHopperId':_0x4e7c0f['id'],'OrderBy':{'$gt':_0x4e7c0f[_0x5343('0x1d')]}},'order':[[_0x5343('0x1d'),_0x5343('0x1e')]]})['then'](function(_0x3822f1){var _0x17b88a=0x0;if(_0x3822f1){if(_0x3822f1['countbusyretry']+_0x3822f1[_0x5343('0x1f')]+_0x3822f1[_0x5343('0x20')]+_0x3822f1[_0x5343('0x21')]+_0x3822f1['countdropretry']+_0x3822f1['countabandonedretry']+_0x3822f1[_0x5343('0x22')]+_0x3822f1['countagentrejectretry']<_0x432992[_0x5343('0x23')]['dialGlobalMaxRetry'])_0x17b88a=0x1;_0x1f5098({'additional':_0x17b88a});}else{return db[_0x5343('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4e7c0f['id']},'order':[['OrderBy',_0x5343('0x1e')]]})[_0x5343('0x1b')](function(_0x551bf4){var _0x5d597e=0x0;if(_0x551bf4){if(_0x551bf4[_0x5343('0x24')]+_0x551bf4['countcongestionretry']+_0x551bf4[_0x5343('0x20')]+_0x551bf4['countnosuchnumberretry']+_0x551bf4['countdropretry']+_0x551bf4[_0x5343('0x25')]+_0x551bf4['countmachineretry']+_0x551bf4['countagentrejectretry']<_0x432992[_0x5343('0x23')][_0x5343('0x26')])_0x5d597e=0x1;_0x1f5098({'additional':_0x5d597e});}else{_0x1f5098({'additional':0x0});}})[_0x5343('0x13')](function(_0x249059){logger['error']('VerifyAdditionalPhones',_0x249059[_0x5343('0x11')],_0x432992);_0x489e1c(_0xec1ba0[_0x5343('0xf')](0x1f4,_0x249059[_0x5343('0x11')]));});}})[_0x5343('0x13')](function(_0x473c59){logger[_0x5343('0xf')](_0x5343('0x27'),_0x473c59[_0x5343('0x11')],_0x432992);_0x489e1c(_0xec1ba0[_0x5343('0xf')](0x1f4,_0x473c59[_0x5343('0x11')]));});}else _0x1f5098({'additional':0x0});});});};exports[_0x5343('0x28')]=function(_0xe9ce25){var _0x55f558=this;return new Promise(function(_0x510e0b,_0x235a10){return db[_0x5343('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0xe9ce25[_0x5343('0x16')]['ContactId'],'ListId':_0xe9ce25[_0x5343('0x16')][_0x5343('0x18')],'VoiceQueueId':_0xe9ce25[_0x5343('0x16')][_0x5343('0x19')]===undefined?null:_0xe9ce25['body']['VoiceQueueId'],'CampaignId':_0xe9ce25[_0x5343('0x16')]['CampaignId']===undefined?null:_0xe9ce25[_0x5343('0x16')][_0x5343('0x1a')]}})['then'](function(_0x1a8d12){if(_0x1a8d12!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1a8d12['id'],'OrderBy':{'$gte':_0x1a8d12[_0x5343('0x1d')]}},'order':[[_0x5343('0x1d'),_0x5343('0x1e')]]})[_0x5343('0x1b')](function(_0x4a63ec){if(_0x4a63ec)return activateAdditionalPhone(_0x1a8d12,_0xe9ce25['body'],_0x4a63ec,_0xe9ce25['duration'],_0xe9ce25['waitTime'])[_0x5343('0x1b')](function(_0xc195c1){_0x510e0b(_0xc195c1);});else{return db[_0x5343('0x1c')][_0x5343('0x15')]({'raw':!![],'where':{'CmHopperId':_0x1a8d12['id']},'order':[[_0x5343('0x1d'),_0x5343('0x1e')]]})[_0x5343('0x1b')](function(_0x4d2951){if(_0x4d2951)return activateAdditionalPhone(_0x1a8d12,_0xe9ce25[_0x5343('0x16')],_0x4d2951,_0xe9ce25['duration'],_0xe9ce25[_0x5343('0x29')])[_0x5343('0x1b')](function(_0x35511b){_0x510e0b(_0x35511b);});else{_0x510e0b({'id':_0x1a8d12['id'],'phone':''});}})[_0x5343('0x13')](function(_0x849368){logger[_0x5343('0xf')](_0x5343('0x27'),_0x849368['message'],_0xe9ce25);_0x235a10(_0x55f558[_0x5343('0xf')](0x1f4,_0x849368['message']));});}})[_0x5343('0x13')](function(_0x46f97d){logger[_0x5343('0xf')](_0x5343('0x27'),_0x46f97d[_0x5343('0x11')],_0xe9ce25);_0x235a10(_0x55f558[_0x5343('0xf')](0x1f4,_0x46f97d[_0x5343('0x11')]));});}else _0x510e0b(0x1);});});};function activateAdditionalPhone(_0x4fcbd8,_0x22ef23,_0x3d9066,_0x48c624,_0x41df61){return new Promise(function(_0x16c880,_0x4c576d){logger['info'](_0x5343('0x27'),_0x3d9066);var _0x2749ff;if(moment()>moment(_0x3d9066[_0x5343('0x2a')])){_0x2749ff=moment()['add'](_0x41df61||0x3,_0x5343('0x2b'));}else{if(_0x3d9066[_0x5343('0x1d')]==0x0){_0x2749ff=moment(_0x3d9066[_0x5343('0x2a')]);}else{_0x2749ff=moment()[_0x5343('0x2c')](_0x41df61||0x3,_0x5343('0x2b'));}}var _0x40ec60={'phone':_0x4fcbd8[_0x5343('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x4fcbd8[_0x5343('0x1d')])?0x0:_0x4fcbd8[_0x5343('0x1d')],'scheduledat':moment()[_0x5343('0x2c')](_0x48c624||0x1,_0x5343('0x2b')),'countbusyretry':_0x22ef23[_0x5343('0x24')],'countcongestionretry':_0x22ef23[_0x5343('0x1f')],'countnoanswerretry':_0x22ef23[_0x5343('0x20')],'countnosuchnumberretry':_0x22ef23[_0x5343('0x21')],'countdropretry':_0x22ef23[_0x5343('0x2e')],'countabandonedretry':_0x22ef23[_0x5343('0x25')],'countmachineretry':_0x22ef23[_0x5343('0x22')],'countagentrejectretry':_0x22ef23[_0x5343('0x2f')],'createdAt':_0x22ef23[_0x5343('0x30')],'updatedAt':_0x22ef23[_0x5343('0x31')]};var _0x2a3073={'CmHopperId':_0x4fcbd8['id'],'phone':_0x3d9066['phone'],'active':0x0,'OrderBy':_[_0x5343('0x32')](_0x3d9066[_0x5343('0x1d')])?0x0:_0x3d9066['OrderBy'],'scheduledat':_0x2749ff,'countbusyretry':_0x3d9066[_0x5343('0x24')],'countcongestionretry':_0x3d9066[_0x5343('0x1f')],'countnoanswerretry':_0x3d9066[_0x5343('0x20')],'countnosuchnumberretry':_0x3d9066[_0x5343('0x21')],'countdropretry':_0x3d9066[_0x5343('0x2e')],'countabandonedretry':_0x3d9066['countabandonedretry'],'countmachineretry':_0x3d9066[_0x5343('0x22')],'countagentrejectretry':_0x3d9066['countagentrejectretry'],'createdAt':_0x3d9066['createdAt'],'updatedAt':_0x3d9066[_0x5343('0x31')]};logger[_0x5343('0x33')](_0x5343('0x34'),_0x40ec60);logger[_0x5343('0x33')]('additionalToHop',_0x2a3073);return db[_0x5343('0x35')][_0x5343('0x36')](function(_0x3c35ee){return db[_0x5343('0x1c')][_0x5343('0x37')](_0x40ec60,{'where':{'id':_0x3d9066['id']}},{'transaction':_0x3c35ee})[_0x5343('0x1b')](function(){return db[_0x5343('0x14')][_0x5343('0x37')](_0x2a3073,{'where':{'id':_0x4fcbd8['id']}},{'transaction':_0x3c35ee});});})[_0x5343('0x1b')](function(_0x3e155c){_0x16c880({'id':_0x4fcbd8['id'],'phone':_0x3d9066['phone']});})[_0x5343('0x13')](function(_0x2184e9){logger[_0x5343('0xf')](_0x5343('0x27'),_0x2184e9[_0x5343('0x11')],req);_0x4c576d(_this[_0x5343('0xf')](0x1f4,_0x2184e9[_0x5343('0x11')]));});});}exports[_0x5343('0x38')]=function(_0x3b3c64){var _0xad51f4=this;return new Promise(function(_0x4ff799,_0x1440a3){return db['CmHopper']['update'](_0x3b3c64[_0x5343('0x16')][_0x5343('0x39')],{'where':{'id':_0x3b3c64[_0x5343('0x16')]['id']}})[_0x5343('0x1b')](function(_0x2bf61b){_0x4ff799(_0x2bf61b);})['catch'](function(_0xe6fa3d){logger['error'](_0x5343('0x38'),_0xe6fa3d['message'],_0x3b3c64);_0x1440a3(_0xad51f4[_0x5343('0xf')](0x1f4,_0xe6fa3d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index d19b56d..eacf078 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ba2=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x108de9,_0x59c896){var _0x3038af=function(_0x417e23){while(--_0x417e23){_0x108de9['push'](_0x108de9['shift']());}};_0x3038af(++_0x59c896);}(_0x0ba2,0x11c));var _0x20ba=function(_0x4d33d9,_0x5e25cf){_0x4d33d9=_0x4d33d9-0x0;var _0x399baf=_0x0ba2[_0x4d33d9];return _0x399baf;};'use strict';var multer=require(_0x20ba('0x0'));var util=require(_0x20ba('0x1'));var path=require(_0x20ba('0x2'));var timeout=require(_0x20ba('0x3'));var express=require('express');var router=express[_0x20ba('0x4')]();var fs_extra=require(_0x20ba('0x5'));var auth=require(_0x20ba('0x6'));var interaction=require(_0x20ba('0x7'));var config=require(_0x20ba('0x8'));var controller=require(_0x20ba('0x9'));router['get']('/',auth[_0x20ba('0xa')](),controller[_0x20ba('0xb')]);router[_0x20ba('0xc')](_0x20ba('0xd'),auth[_0x20ba('0xa')](),controller[_0x20ba('0xe')]);router[_0x20ba('0xf')]('/',auth[_0x20ba('0xa')](),controller['create']);router[_0x20ba('0x10')](_0x20ba('0xd'),auth[_0x20ba('0xa')](),controller[_0x20ba('0x11')]);router['delete'](_0x20ba('0xd'),auth[_0x20ba('0xa')](),controller[_0x20ba('0x12')]);module[_0x20ba('0x13')]=router; \ No newline at end of file +var _0x810f=['post','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4859b2,_0xf6b94e){var _0x15e624=function(_0x146d97){while(--_0x146d97){_0x4859b2['push'](_0x4859b2['shift']());}};_0x15e624(++_0xf6b94e);}(_0x810f,0x114));var _0xf810=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x810f[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0xf810('0x0'));var util=require(_0xf810('0x1'));var path=require(_0xf810('0x2'));var timeout=require('connect-timeout');var express=require(_0xf810('0x3'));var router=express[_0xf810('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf810('0x5'));var interaction=require(_0xf810('0x6'));var config=require(_0xf810('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xf810('0x8')]('/',auth[_0xf810('0x9')](),controller[_0xf810('0xa')]);router['get'](_0xf810('0xb'),auth[_0xf810('0x9')](),controller['show']);router[_0xf810('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf810('0xd')](_0xf810('0xb'),auth[_0xf810('0x9')](),controller['update']);router[_0xf810('0xe')](_0xf810('0xb'),auth[_0xf810('0x9')](),controller[_0xf810('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 844780c..c4f18c2 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 _0xd07c=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x565130,_0x27cfde){var _0x38de76=function(_0x344725){while(--_0x344725){_0x565130['push'](_0x565130['shift']());}};_0x38de76(++_0x27cfde);}(_0xd07c,0xbe));var _0xcd07=function(_0x56b07a,_0x4de01c){_0x56b07a=_0x56b07a-0x0;var _0x3cdb49=_0xd07c[_0x56b07a];return _0x3cdb49;};'use strict';var moment=require(_0xcd07('0x0'));var Sequelize=require('sequelize');module[_0xcd07('0x1')]={'phone':{'type':Sequelize[_0xcd07('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcd07('0x3')],'unique':_0xcd07('0x4')},'ListId':{'type':Sequelize[_0xcd07('0x3')],'unique':_0xcd07('0x4')},'VoiceQueueId':{'type':Sequelize[_0xcd07('0x3')],'unique':_0xcd07('0x4')}}; \ No newline at end of file +var _0x7ed3=['contactListQueue','moment','STRING','INTEGER'];(function(_0x27fe0d,_0x40f1cb){var _0x1507f2=function(_0x1c1222){while(--_0x1c1222){_0x27fe0d['push'](_0x27fe0d['shift']());}};_0x1507f2(++_0x40f1cb);}(_0x7ed3,0x149));var _0x37ed=function(_0x86522,_0x5b34fd){_0x86522=_0x86522-0x0;var _0x5f4459=_0x7ed3[_0x86522];return _0x5f4459;};'use strict';var moment=require(_0x37ed('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x37ed('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x37ed('0x2')],'unique':_0x37ed('0x3')},'ListId':{'type':Sequelize[_0x37ed('0x2')],'unique':_0x37ed('0x3')},'VoiceQueueId':{'type':Sequelize[_0x37ed('0x2')],'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 76e2edb..5dfc52c 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 _0x781c=['name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','length','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','destroy','end','error','stack'];(function(_0x1d6b17,_0x36587){var _0x370b62=function(_0x402b13){while(--_0x402b13){_0x1d6b17['push'](_0x1d6b17['shift']());}};_0x370b62(++_0x36587);}(_0x781c,0x105));var _0xc781=function(_0x958715,_0xdf1601){_0x958715=_0x958715-0x0;var _0x23e11e=_0x781c[_0x958715];return _0x23e11e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc781('0x0'));var zipdir=require(_0xc781('0x1'));var jsonpatch=require(_0xc781('0x2'));var rp=require(_0xc781('0x3'));var moment=require(_0xc781('0x4'));var BPromise=require(_0xc781('0x5'));var Mustache=require(_0xc781('0x6'));var util=require(_0xc781('0x7'));var path=require(_0xc781('0x8'));var sox=require(_0xc781('0x9'));var csv=require(_0xc781('0xa'));var ejs=require(_0xc781('0xb'));var fs=require('fs');var fs_extra=require(_0xc781('0xc'));var _=require(_0xc781('0xd'));var squel=require(_0xc781('0xe'));var crypto=require(_0xc781('0xf'));var jsforce=require(_0xc781('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc781('0xa'));var querystring=require(_0xc781('0x11'));var Papa=require('papaparse');var Redis=require(_0xc781('0x12'));var authService=require(_0xc781('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc781('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc781('0x15'));var db=require(_0xc781('0x16'))['db'];function respondWithStatusCode(_0x4b4c6c,_0x24ab70){_0x24ab70=_0x24ab70||0xcc;return function(_0x21414e){if(_0x21414e){return _0x4b4c6c[_0xc781('0x17')](_0x24ab70);}return _0x4b4c6c[_0xc781('0x18')](_0x24ab70)['end']();};}function respondWithResult(_0x29e613,_0x43a7b7){_0x43a7b7=_0x43a7b7||0xc8;return function(_0x27bb73){if(_0x27bb73){return _0x29e613[_0xc781('0x18')](_0x43a7b7)['json'](_0x27bb73);}};}function respondWithFilteredResult(_0x16ff12,_0x1f68c2){return function(_0x43572d){if(_0x43572d){var _0xd89fa8=typeof _0x1f68c2[_0xc781('0x19')]===_0xc781('0x1a')&&typeof _0x1f68c2['limit']==='undefined';var _0x455077=_0x43572d[_0xc781('0x1b')];var _0x3bbbbd=_0xd89fa8?0x0:_0x1f68c2[_0xc781('0x19')];var _0x3109e1=_0xd89fa8?_0x43572d[_0xc781('0x1b')]:_0x1f68c2[_0xc781('0x19')]+_0x1f68c2[_0xc781('0x1c')];var _0x1ad690;if(_0x3109e1>=_0x455077){_0x3109e1=_0x455077;_0x1ad690=0xc8;}else{_0x1ad690=0xce;}_0x16ff12['status'](_0x1ad690);return _0x16ff12[_0xc781('0x1d')]('Content-Range',_0x3bbbbd+'-'+_0x3109e1+'/'+_0x455077)[_0xc781('0x1e')](_0x43572d);}return null;};}function patchUpdates(_0x1f6393){return function(_0xc141da){try{jsonpatch[_0xc781('0x1f')](_0xc141da,_0x1f6393,!![]);}catch(_0x330aaf){return BPromise[_0xc781('0x20')](_0x330aaf);}return _0xc141da['save']();};}function saveUpdates(_0x54515c,_0x857639){return function(_0x2b9689){if(_0x2b9689){return _0x2b9689[_0xc781('0x21')](_0x54515c)[_0xc781('0x22')](function(_0x44a3ba){return _0x44a3ba;});}return null;};}function removeEntity(_0xf85c6e,_0x306b8e){return function(_0x13df86){if(_0x13df86){return _0x13df86[_0xc781('0x23')]()[_0xc781('0x22')](function(){_0xf85c6e[_0xc781('0x18')](0xcc)[_0xc781('0x24')]();});}};}function handleEntityNotFound(_0x6d1d52,_0x44cd23){return function(_0x15fc5a){if(!_0x15fc5a){_0x6d1d52[_0xc781('0x17')](0x194);}return _0x15fc5a;};}function handleError(_0x1f78f2,_0x3fa666){_0x3fa666=_0x3fa666||0x1f4;return function(_0x175402){logger[_0xc781('0x25')](_0x175402[_0xc781('0x26')]);if(_0x175402[_0xc781('0x27')]){delete _0x175402['name'];}_0x1f78f2[_0xc781('0x18')](_0x3fa666)[_0xc781('0x28')](_0x175402);};}exports[_0xc781('0x29')]=function(_0x343fb6,_0x406565){var _0x412870={},_0x14219f={},_0x15b831={'count':0x0,'rows':[]};var _0x161611=_[_0xc781('0x2a')](db[_0xc781('0x2b')][_0xc781('0x2c')],function(_0x2346ce){return{'name':_0x2346ce[_0xc781('0x2d')],'type':_0x2346ce[_0xc781('0x2e')][_0xc781('0x2f')]};});_0x14219f[_0xc781('0x30')]=_[_0xc781('0x2a')](_0x161611,_0xc781('0x27'));_0x14219f[_0xc781('0x31')]=_['keys'](_0x343fb6[_0xc781('0x31')]);_0x14219f[_0xc781('0x32')]=_['intersection'](_0x14219f[_0xc781('0x30')],_0x14219f[_0xc781('0x31')]);_0x412870['attributes']=_[_0xc781('0x33')](_0x14219f['model'],qs[_0xc781('0x34')](_0x343fb6['query']['fields']));_0x412870[_0xc781('0x35')]=_0x412870[_0xc781('0x35')]['length']?_0x412870[_0xc781('0x35')]:_0x14219f[_0xc781('0x30')];if(!_0x343fb6['query'][_0xc781('0x36')](_0xc781('0x37'))){_0x412870[_0xc781('0x1c')]=qs[_0xc781('0x1c')](_0x343fb6[_0xc781('0x31')][_0xc781('0x1c')]);_0x412870[_0xc781('0x19')]=qs[_0xc781('0x19')](_0x343fb6[_0xc781('0x31')][_0xc781('0x19')]);}_0x412870[_0xc781('0x38')]=qs[_0xc781('0x39')](_0x343fb6['query']['sort']);_0x412870[_0xc781('0x3a')]=qs[_0xc781('0x32')](_[_0xc781('0x3b')](_0x343fb6[_0xc781('0x31')],_0x14219f[_0xc781('0x32')]),_0x161611);if(_0x343fb6['query'][_0xc781('0x3c')]){_0x412870[_0xc781('0x3a')]=_['merge'](_0x412870[_0xc781('0x3a')],{'$or':_[_0xc781('0x2a')](_0x161611,function(_0x3ca494){if(_0x3ca494['type']!==_0xc781('0x3d')){var _0x1803a8={};_0x1803a8[_0x3ca494[_0xc781('0x27')]]={'$like':'%'+_0x343fb6['query'][_0xc781('0x3c')]+'%'};return _0x1803a8;}})});}_0x412870=_[_0xc781('0x3e')]({},_0x412870,_0x343fb6[_0xc781('0x3f')]);var _0x330bba={'where':_0x412870[_0xc781('0x3a')]};return db[_0xc781('0x2b')][_0xc781('0x1b')](_0x330bba)[_0xc781('0x22')](function(_0x404bed){_0x15b831[_0xc781('0x1b')]=_0x404bed;if(_0x343fb6[_0xc781('0x31')][_0xc781('0x40')]){_0x412870[_0xc781('0x41')]=[{'all':!![]}];}return db[_0xc781('0x2b')]['findAll'](_0x412870);})['then'](function(_0xaadfab){_0x15b831[_0xc781('0x42')]=_0xaadfab;return _0x15b831;})[_0xc781('0x22')](respondWithFilteredResult(_0x406565,_0x412870))[_0xc781('0x43')](handleError(_0x406565,null));};exports[_0xc781('0x44')]=function(_0x1712b8,_0x3bc949){var _0x589e98={'raw':!![],'where':{'id':_0x1712b8[_0xc781('0x45')]['id']}},_0x27ed7a={};_0x27ed7a['model']=_[_0xc781('0x46')](db['CmHopperBlack'][_0xc781('0x2c')]);_0x27ed7a['query']=_[_0xc781('0x46')](_0x1712b8['query']);_0x27ed7a[_0xc781('0x32')]=_[_0xc781('0x33')](_0x27ed7a[_0xc781('0x30')],_0x27ed7a[_0xc781('0x31')]);_0x589e98[_0xc781('0x35')]=_[_0xc781('0x33')](_0x27ed7a[_0xc781('0x30')],qs['fields'](_0x1712b8['query']['fields']));_0x589e98[_0xc781('0x35')]=_0x589e98[_0xc781('0x35')][_0xc781('0x47')]?_0x589e98[_0xc781('0x35')]:_0x27ed7a[_0xc781('0x30')];if(_0x1712b8[_0xc781('0x31')][_0xc781('0x40')]){_0x589e98['include']=[{'all':!![]}];}_0x589e98=_[_0xc781('0x3e')]({},_0x589e98,_0x1712b8[_0xc781('0x3f')]);return db['CmHopperBlack']['find'](_0x589e98)[_0xc781('0x22')](handleEntityNotFound(_0x3bc949,null))[_0xc781('0x22')](respondWithResult(_0x3bc949,null))['catch'](handleError(_0x3bc949,null));};exports[_0xc781('0x21')]=function(_0x5c7d86,_0x1d5d55){if(_0x5c7d86[_0xc781('0x48')]['id']){delete _0x5c7d86['body']['id'];}return db[_0xc781('0x2b')]['find']({'where':{'id':_0x5c7d86[_0xc781('0x45')]['id']}})[_0xc781('0x22')](handleEntityNotFound(_0x1d5d55,null))[_0xc781('0x22')](saveUpdates(_0x5c7d86['body'],null))[_0xc781('0x22')](respondWithResult(_0x1d5d55,null))[_0xc781('0x43')](handleError(_0x1d5d55,null));};exports[_0xc781('0x23')]=function(_0x951136,_0x45a623){return db['CmHopperBlack'][_0xc781('0x49')]({'where':{'id':_0x951136[_0xc781('0x45')]['id']}})[_0xc781('0x22')](handleEntityNotFound(_0x45a623,null))[_0xc781('0x22')](removeEntity(_0x45a623,null))[_0xc781('0x43')](handleError(_0x45a623,null));};exports[_0xc781('0x4a')]=function(_0x45887f,_0x1cef23){return db[_0xc781('0x2b')]['describe']()['then'](respondWithResult(_0x1cef23,null))[_0xc781('0x43')](handleError(_0x1cef23,null));}; \ No newline at end of file +var _0x81d2=['lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','params','keys','find','update','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs'];(function(_0x225023,_0x31f2d7){var _0x4c97a1=function(_0x96ff1e){while(--_0x96ff1e){_0x225023['push'](_0x225023['shift']());}};_0x4c97a1(++_0x31f2d7);}(_0x81d2,0x86));var _0x281d=function(_0x115879,_0x2baa74){_0x115879=_0x115879-0x0;var _0x52d6ed=_0x81d2[_0x115879];return _0x52d6ed;};'use strict';var emlformat=require(_0x281d('0x0'));var rimraf=require(_0x281d('0x1'));var zipdir=require(_0x281d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x281d('0x3'));var moment=require('moment');var BPromise=require(_0x281d('0x4'));var Mustache=require(_0x281d('0x5'));var util=require(_0x281d('0x6'));var path=require(_0x281d('0x7'));var sox=require(_0x281d('0x8'));var csv=require('to-csv');var ejs=require(_0x281d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x281d('0xa'));var squel=require(_0x281d('0xb'));var crypto=require(_0x281d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x281d('0xd'));var toCsv=require(_0x281d('0xe'));var querystring=require('querystring');var Papa=require(_0x281d('0xf'));var Redis=require(_0x281d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x281d('0x11'));var as=require(_0x281d('0x12'));var hardwareService=require(_0x281d('0x13'));var logger=require(_0x281d('0x14'))(_0x281d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x281d('0x16'));var db=require(_0x281d('0x17'))['db'];function respondWithStatusCode(_0x14e9fe,_0x1a0b22){_0x1a0b22=_0x1a0b22||0xcc;return function(_0x2e7835){if(_0x2e7835){return _0x14e9fe[_0x281d('0x18')](_0x1a0b22);}return _0x14e9fe['status'](_0x1a0b22)[_0x281d('0x19')]();};}function respondWithResult(_0x154501,_0x28f40c){_0x28f40c=_0x28f40c||0xc8;return function(_0x530874){if(_0x530874){return _0x154501[_0x281d('0x1a')](_0x28f40c)[_0x281d('0x1b')](_0x530874);}};}function respondWithFilteredResult(_0x3add26,_0x38310b){return function(_0x4f3d49){if(_0x4f3d49){var _0x488365=typeof _0x38310b[_0x281d('0x1c')]==='undefined'&&typeof _0x38310b[_0x281d('0x1d')]===_0x281d('0x1e');var _0x88977f=_0x4f3d49[_0x281d('0x1f')];var _0x13086f=_0x488365?0x0:_0x38310b['offset'];var _0x3defb7=_0x488365?_0x4f3d49[_0x281d('0x1f')]:_0x38310b[_0x281d('0x1c')]+_0x38310b[_0x281d('0x1d')];var _0xdc0049;if(_0x3defb7>=_0x88977f){_0x3defb7=_0x88977f;_0xdc0049=0xc8;}else{_0xdc0049=0xce;}_0x3add26[_0x281d('0x1a')](_0xdc0049);return _0x3add26[_0x281d('0x20')](_0x281d('0x21'),_0x13086f+'-'+_0x3defb7+'/'+_0x88977f)[_0x281d('0x1b')](_0x4f3d49);}return null;};}function patchUpdates(_0x5574bd){return function(_0x195e80){try{jsonpatch['apply'](_0x195e80,_0x5574bd,!![]);}catch(_0x4b5c5e){return BPromise[_0x281d('0x22')](_0x4b5c5e);}return _0x195e80[_0x281d('0x23')]();};}function saveUpdates(_0x1c14b5,_0x803955){return function(_0x1290db){if(_0x1290db){return _0x1290db['update'](_0x1c14b5)[_0x281d('0x24')](function(_0x563ac5){return _0x563ac5;});}return null;};}function removeEntity(_0x4083ff,_0x2b5913){return function(_0xbcfe2d){if(_0xbcfe2d){return _0xbcfe2d['destroy']()[_0x281d('0x24')](function(){_0x4083ff[_0x281d('0x1a')](0xcc)[_0x281d('0x19')]();});}};}function handleEntityNotFound(_0xa25ca5,_0xf73412){return function(_0x2123f3){if(!_0x2123f3){_0xa25ca5[_0x281d('0x18')](0x194);}return _0x2123f3;};}function handleError(_0x33b0ce,_0x42b8a2){_0x42b8a2=_0x42b8a2||0x1f4;return function(_0x585fa0){logger[_0x281d('0x25')](_0x585fa0['stack']);if(_0x585fa0[_0x281d('0x26')]){delete _0x585fa0['name'];}_0x33b0ce[_0x281d('0x1a')](_0x42b8a2)[_0x281d('0x27')](_0x585fa0);};}exports[_0x281d('0x28')]=function(_0x3d55a7,_0x3ed04b){var _0x398d5c={},_0x355ac5={},_0x3cc2bd={'count':0x0,'rows':[]};var _0x5909ae=_[_0x281d('0x29')](db[_0x281d('0x2a')][_0x281d('0x2b')],function(_0x3924ca){return{'name':_0x3924ca[_0x281d('0x2c')],'type':_0x3924ca['type'][_0x281d('0x2d')]};});_0x355ac5[_0x281d('0x2e')]=_[_0x281d('0x29')](_0x5909ae,'name');_0x355ac5[_0x281d('0x2f')]=_['keys'](_0x3d55a7[_0x281d('0x2f')]);_0x355ac5[_0x281d('0x30')]=_[_0x281d('0x31')](_0x355ac5[_0x281d('0x2e')],_0x355ac5[_0x281d('0x2f')]);_0x398d5c['attributes']=_[_0x281d('0x31')](_0x355ac5[_0x281d('0x2e')],qs[_0x281d('0x32')](_0x3d55a7[_0x281d('0x2f')][_0x281d('0x32')]));_0x398d5c[_0x281d('0x33')]=_0x398d5c[_0x281d('0x33')][_0x281d('0x34')]?_0x398d5c[_0x281d('0x33')]:_0x355ac5[_0x281d('0x2e')];if(!_0x3d55a7[_0x281d('0x2f')][_0x281d('0x35')](_0x281d('0x36'))){_0x398d5c[_0x281d('0x1d')]=qs['limit'](_0x3d55a7[_0x281d('0x2f')]['limit']);_0x398d5c[_0x281d('0x1c')]=qs['offset'](_0x3d55a7[_0x281d('0x2f')][_0x281d('0x1c')]);}_0x398d5c[_0x281d('0x37')]=qs[_0x281d('0x38')](_0x3d55a7[_0x281d('0x2f')][_0x281d('0x38')]);_0x398d5c['where']=qs[_0x281d('0x30')](_[_0x281d('0x39')](_0x3d55a7['query'],_0x355ac5[_0x281d('0x30')]),_0x5909ae);if(_0x3d55a7[_0x281d('0x2f')][_0x281d('0x3a')]){_0x398d5c[_0x281d('0x3b')]=_[_0x281d('0x3c')](_0x398d5c[_0x281d('0x3b')],{'$or':_[_0x281d('0x29')](_0x5909ae,function(_0x15767e){if(_0x15767e['type']!=='VIRTUAL'){var _0x1f209f={};_0x1f209f[_0x15767e[_0x281d('0x26')]]={'$like':'%'+_0x3d55a7[_0x281d('0x2f')]['filter']+'%'};return _0x1f209f;}})});}_0x398d5c=_[_0x281d('0x3c')]({},_0x398d5c,_0x3d55a7[_0x281d('0x3d')]);var _0x51c6b0={'where':_0x398d5c['where']};return db[_0x281d('0x2a')][_0x281d('0x1f')](_0x51c6b0)[_0x281d('0x24')](function(_0x357bd3){_0x3cc2bd[_0x281d('0x1f')]=_0x357bd3;if(_0x3d55a7[_0x281d('0x2f')]['includeAll']){_0x398d5c[_0x281d('0x3e')]=[{'all':!![]}];}return db[_0x281d('0x2a')][_0x281d('0x3f')](_0x398d5c);})[_0x281d('0x24')](function(_0x405f4a){_0x3cc2bd['rows']=_0x405f4a;return _0x3cc2bd;})[_0x281d('0x24')](respondWithFilteredResult(_0x3ed04b,_0x398d5c))['catch'](handleError(_0x3ed04b,null));};exports['show']=function(_0x11f306,_0x157d42){var _0x238c1e={'raw':!![],'where':{'id':_0x11f306[_0x281d('0x40')]['id']}},_0x1703c3={};_0x1703c3[_0x281d('0x2e')]=_[_0x281d('0x41')](db[_0x281d('0x2a')][_0x281d('0x2b')]);_0x1703c3[_0x281d('0x2f')]=_[_0x281d('0x41')](_0x11f306[_0x281d('0x2f')]);_0x1703c3[_0x281d('0x30')]=_['intersection'](_0x1703c3[_0x281d('0x2e')],_0x1703c3[_0x281d('0x2f')]);_0x238c1e[_0x281d('0x33')]=_[_0x281d('0x31')](_0x1703c3[_0x281d('0x2e')],qs['fields'](_0x11f306[_0x281d('0x2f')][_0x281d('0x32')]));_0x238c1e[_0x281d('0x33')]=_0x238c1e[_0x281d('0x33')]['length']?_0x238c1e[_0x281d('0x33')]:_0x1703c3[_0x281d('0x2e')];if(_0x11f306[_0x281d('0x2f')]['includeAll']){_0x238c1e[_0x281d('0x3e')]=[{'all':!![]}];}_0x238c1e=_[_0x281d('0x3c')]({},_0x238c1e,_0x11f306[_0x281d('0x3d')]);return db[_0x281d('0x2a')][_0x281d('0x42')](_0x238c1e)[_0x281d('0x24')](handleEntityNotFound(_0x157d42,null))['then'](respondWithResult(_0x157d42,null))['catch'](handleError(_0x157d42,null));};exports[_0x281d('0x43')]=function(_0x16fb57,_0x1a8603){if(_0x16fb57[_0x281d('0x44')]['id']){delete _0x16fb57[_0x281d('0x44')]['id'];}return db[_0x281d('0x2a')][_0x281d('0x42')]({'where':{'id':_0x16fb57[_0x281d('0x40')]['id']}})[_0x281d('0x24')](handleEntityNotFound(_0x1a8603,null))['then'](saveUpdates(_0x16fb57[_0x281d('0x44')],null))[_0x281d('0x24')](respondWithResult(_0x1a8603,null))[_0x281d('0x45')](handleError(_0x1a8603,null));};exports[_0x281d('0x46')]=function(_0x4e24d3,_0x4ab756){return db['CmHopperBlack'][_0x281d('0x42')]({'where':{'id':_0x4e24d3[_0x281d('0x40')]['id']}})[_0x281d('0x24')](handleEntityNotFound(_0x4ab756,null))[_0x281d('0x24')](removeEntity(_0x4ab756,null))[_0x281d('0x45')](handleError(_0x4ab756,null));};exports[_0x281d('0x47')]=function(_0x4bceb6,_0x4f9f12){return db[_0x281d('0x2a')][_0x281d('0x47')]()['then'](respondWithResult(_0x4f9f12,null))[_0x281d('0x45')](handleError(_0x4f9f12,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3a3b368..fa8ed25 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 _0x35b4=['define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x355c9b,_0x53dffe){var _0x1b904e=function(_0x31f744){while(--_0x31f744){_0x355c9b['push'](_0x355c9b['shift']());}};_0x1b904e(++_0x53dffe);}(_0x35b4,0xc6));var _0x435b=function(_0xbee93e,_0x2bee60){_0xbee93e=_0xbee93e-0x0;var _0x554df8=_0x35b4[_0xbee93e];return _0x554df8;};'use strict';var _=require(_0x435b('0x0'));var util=require(_0x435b('0x1'));var logger=require(_0x435b('0x2'))(_0x435b('0x3'));var moment=require(_0x435b('0x4'));var BPromise=require(_0x435b('0x5'));var rp=require(_0x435b('0x6'));var fs=require('fs');var path=require(_0x435b('0x7'));var rimraf=require(_0x435b('0x8'));var config=require(_0x435b('0x9'));var attributes=require(_0x435b('0xa'));module[_0x435b('0xb')]=function(_0x4f6e4f,_0x5946dd){return _0x4f6e4f[_0x435b('0xc')](_0x435b('0xd'),attributes,{'tableName':_0x435b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x636b=['moment','bluebird','request-promise','path','exports','define','cm_hopper_black','util','../../config/logger','api'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x636b,0x15b));var _0xb636=function(_0x54456d,_0x1a8ad1){_0x54456d=_0x54456d-0x0;var _0x557b70=_0x636b[_0x54456d];return _0x557b70;};'use strict';var _=require('lodash');var util=require(_0xb636('0x0'));var logger=require(_0xb636('0x1'))(_0xb636('0x2'));var moment=require(_0xb636('0x3'));var BPromise=require(_0xb636('0x4'));var rp=require(_0xb636('0x5'));var fs=require('fs');var path=require(_0xb636('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xb636('0x7')]=function(_0x276454,_0x34ebca){return _0x276454[_0xb636('0x8')]('CmHopperBlack',attributes,{'tableName':_0xb636('0x9'),'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 b34ee1e..42036a1 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 _0x4581=['../../mysqldb','../../config/utils','../../config/logger','client','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','code','error','message','result','GetCmHopperBlack','findAll','options','raw','where','include','model','map','attributes','stringify','catch','UpdateCmHopperBlack','CmHopperBlack','body','destroy','info','DestroyCmHopperBlack','moment','bluebird','randomstring','ioredis'];(function(_0x1cf9c5,_0x2e7562){var _0x367892=function(_0x34fd54){while(--_0x34fd54){_0x1cf9c5['push'](_0x1cf9c5['shift']());}};_0x367892(++_0x2e7562);}(_0x4581,0x1e6));var _0x1458=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4581[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1458('0x0'));var BPromise=require(_0x1458('0x1'));var rs=require(_0x1458('0x2'));var fs=require('fs');var Redis=require(_0x1458('0x3'));var db=require(_0x1458('0x4'))['db'];var utils=require(_0x1458('0x5'));var logger=require(_0x1458('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1458('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x191a7d,_0x5262ee,_0x5d72cf){return new BPromise(function(_0x494e9f,_0x94a013){return client[_0x1458('0x8')](_0x191a7d,_0x5d72cf)[_0x1458('0x9')](function(_0x125401){logger['info'](_0x1458('0xa'),_0x5262ee,_0x1458('0xb'));logger[_0x1458('0xc')](_0x1458('0xd'),_0x5262ee,_0x1458('0xb'),JSON['stringify'](_0x125401));if(_0x125401['error']){if(_0x125401['error'][_0x1458('0xe')]===0x1f4){logger['error'](_0x1458('0xa'),_0x5262ee,_0x125401[_0x1458('0xf')][_0x1458('0x10')]);return _0x94a013(_0x125401[_0x1458('0xf')][_0x1458('0x10')]);}logger[_0x1458('0xf')](_0x1458('0xa'),_0x5262ee,_0x125401['error'][_0x1458('0x10')]);return _0x494e9f(_0x125401[_0x1458('0xf')][_0x1458('0x10')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x5262ee,'request\x20sent');_0x494e9f(_0x125401[_0x1458('0x11')][_0x1458('0x10')]);}})['catch'](function(_0x4e1ffe){logger[_0x1458('0xf')](_0x1458('0xa'),_0x5262ee,_0x4e1ffe);_0x94a013(_0x4e1ffe);});});}exports[_0x1458('0x12')]=function(_0x1ebfa2){var _0x3d7549=this;return new Promise(function(_0x3fac29,_0x5e592f){return db['CmHopperBlack'][_0x1458('0x13')]({'raw':_0x1ebfa2[_0x1458('0x14')]?_0x1ebfa2[_0x1458('0x14')][_0x1458('0x15')]===undefined?!![]:![]:!![],'where':_0x1ebfa2[_0x1458('0x14')]?_0x1ebfa2[_0x1458('0x14')][_0x1458('0x16')]||null:null,'attributes':_0x1ebfa2[_0x1458('0x14')]?_0x1ebfa2[_0x1458('0x14')]['attributes']||null:null,'limit':_0x1ebfa2['options']?_0x1ebfa2['options']['limit']||null:null,'include':_0x1ebfa2[_0x1458('0x14')]?_0x1ebfa2['options'][_0x1458('0x17')]?_['map'](_0x1ebfa2[_0x1458('0x14')][_0x1458('0x17')],function(_0x396b24){return{'model':db[_0x396b24[_0x1458('0x18')]],'as':_0x396b24['as'],'attributes':_0x396b24['attributes'],'include':_0x396b24[_0x1458('0x17')]?_[_0x1458('0x19')](_0x396b24[_0x1458('0x17')],function(_0xe6abc8){return{'model':db[_0xe6abc8['model']],'as':_0xe6abc8['as'],'attributes':_0xe6abc8['attributes'],'include':_0xe6abc8[_0x1458('0x17')]?_[_0x1458('0x19')](_0xe6abc8['include'],function(_0x3eccf6){return{'model':db[_0x3eccf6[_0x1458('0x18')]],'as':_0x3eccf6['as'],'attributes':_0x3eccf6[_0x1458('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a4c79){logger['info'](_0x1458('0x12'),_0x1ebfa2);logger[_0x1458('0xc')](_0x1458('0x12'),_0x1ebfa2,JSON[_0x1458('0x1b')](_0x4a4c79));_0x3fac29(_0x4a4c79);})[_0x1458('0x1c')](function(_0x508cbe){logger[_0x1458('0xf')]('GetCmHopperBlack',_0x508cbe[_0x1458('0x10')],_0x1ebfa2);_0x5e592f(_0x3d7549[_0x1458('0xf')](0x1f4,_0x508cbe['message']));});});};exports[_0x1458('0x1d')]=function(_0x40be5b){var _0x439a99=this;return new Promise(function(_0x2e55d0,_0x5576af){return db[_0x1458('0x1e')]['update'](_0x40be5b[_0x1458('0x1f')],{'raw':_0x40be5b[_0x1458('0x14')]?_0x40be5b[_0x1458('0x14')][_0x1458('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40be5b[_0x1458('0x14')]?_0x40be5b[_0x1458('0x14')]['where']||null:null,'attributes':_0x40be5b['options']?_0x40be5b['options'][_0x1458('0x1a')]||null:null,'limit':_0x40be5b[_0x1458('0x14')]?_0x40be5b[_0x1458('0x14')]['limit']||null:null})[_0x1458('0x9')](function(_0x5329f6){logger['info']('UpdateCmHopperBlack',_0x40be5b);logger[_0x1458('0xc')]('UpdateCmHopperBlack',_0x40be5b,JSON['stringify'](_0x5329f6));_0x2e55d0(_0x5329f6);})[_0x1458('0x1c')](function(_0x213a18){logger[_0x1458('0xf')](_0x1458('0x1d'),_0x213a18['message'],_0x40be5b);_0x5576af(_0x439a99[_0x1458('0xf')](0x1f4,_0x213a18[_0x1458('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x263d47){var _0x2bb2d7=this;return new Promise(function(_0x15d26d,_0x2476f1){return db[_0x1458('0x1e')][_0x1458('0x20')]({'where':_0x263d47[_0x1458('0x14')]?_0x263d47[_0x1458('0x14')][_0x1458('0x16')]||null:null})[_0x1458('0x9')](function(_0x3130ac){logger[_0x1458('0x21')](_0x1458('0x22'),_0x263d47);logger[_0x1458('0xc')](_0x1458('0x22'),_0x263d47,JSON['stringify'](_0x3130ac));_0x15d26d(_0x3130ac);})['catch'](function(_0x57084f){logger[_0x1458('0xf')]('DestroyCmHopperBlack',_0x57084f['message'],_0x263d47);_0x2476f1(_0x2bb2d7[_0x1458('0xf')](0x1f4,_0x57084f[_0x1458('0x10')]));});});}; \ No newline at end of file +var _0xcaf8=['request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','include','map','model','attributes','then','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcaf8,0x1e3));var _0x8caf=function(_0x2fd2f6,_0x16dccc){_0x2fd2f6=_0x2fd2f6-0x0;var _0x5eeefb=_0xcaf8[_0x2fd2f6];return _0x5eeefb;};'use strict';var _=require(_0x8caf('0x0'));var util=require(_0x8caf('0x1'));var moment=require(_0x8caf('0x2'));var BPromise=require(_0x8caf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8caf('0x4'));var db=require(_0x8caf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8caf('0x6'))(_0x8caf('0x7'));var config=require('../../config/environment');var jayson=require(_0x8caf('0x8'));var client=jayson[_0x8caf('0x9')][_0x8caf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fc451,_0x1bb876,_0x2bf708){return new BPromise(function(_0x2332c1,_0x1cd210){return client[_0x8caf('0xb')](_0x3fc451,_0x2bf708)['then'](function(_0xfb1c58){logger[_0x8caf('0xc')](_0x8caf('0xd'),_0x1bb876,_0x8caf('0xe'));logger[_0x8caf('0xf')](_0x8caf('0x10'),_0x1bb876,_0x8caf('0xe'),JSON[_0x8caf('0x11')](_0xfb1c58));if(_0xfb1c58['error']){if(_0xfb1c58[_0x8caf('0x12')][_0x8caf('0x13')]===0x1f4){logger[_0x8caf('0x12')](_0x8caf('0xd'),_0x1bb876,_0xfb1c58['error']['message']);return _0x1cd210(_0xfb1c58[_0x8caf('0x12')][_0x8caf('0x14')]);}logger[_0x8caf('0x12')](_0x8caf('0xd'),_0x1bb876,_0xfb1c58[_0x8caf('0x12')][_0x8caf('0x14')]);return _0x2332c1(_0xfb1c58['error'][_0x8caf('0x14')]);}else{logger[_0x8caf('0xc')](_0x8caf('0xd'),_0x1bb876,_0x8caf('0xe'));_0x2332c1(_0xfb1c58[_0x8caf('0x15')][_0x8caf('0x14')]);}})[_0x8caf('0x16')](function(_0x6f48e){logger[_0x8caf('0x12')](_0x8caf('0xd'),_0x1bb876,_0x6f48e);_0x1cd210(_0x6f48e);});});}exports[_0x8caf('0x17')]=function(_0x5cda07){var _0x50fa01=this;return new Promise(function(_0x485347,_0x161026){return db[_0x8caf('0x18')][_0x8caf('0x19')]({'raw':_0x5cda07[_0x8caf('0x1a')]?_0x5cda07[_0x8caf('0x1a')][_0x8caf('0x1b')]===undefined?!![]:![]:!![],'where':_0x5cda07['options']?_0x5cda07[_0x8caf('0x1a')]['where']||null:null,'attributes':_0x5cda07[_0x8caf('0x1a')]?_0x5cda07[_0x8caf('0x1a')]['attributes']||null:null,'limit':_0x5cda07[_0x8caf('0x1a')]?_0x5cda07[_0x8caf('0x1a')]['limit']||null:null,'include':_0x5cda07[_0x8caf('0x1a')]?_0x5cda07[_0x8caf('0x1a')][_0x8caf('0x1c')]?_[_0x8caf('0x1d')](_0x5cda07[_0x8caf('0x1a')][_0x8caf('0x1c')],function(_0x5e9532){return{'model':db[_0x5e9532[_0x8caf('0x1e')]],'as':_0x5e9532['as'],'attributes':_0x5e9532[_0x8caf('0x1f')],'include':_0x5e9532[_0x8caf('0x1c')]?_['map'](_0x5e9532['include'],function(_0x29c76f){return{'model':db[_0x29c76f[_0x8caf('0x1e')]],'as':_0x29c76f['as'],'attributes':_0x29c76f[_0x8caf('0x1f')],'include':_0x29c76f[_0x8caf('0x1c')]?_[_0x8caf('0x1d')](_0x29c76f['include'],function(_0x4a1390){return{'model':db[_0x4a1390[_0x8caf('0x1e')]],'as':_0x4a1390['as'],'attributes':_0x4a1390[_0x8caf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8caf('0x20')](function(_0x259411){logger['info'](_0x8caf('0x17'),_0x5cda07);logger[_0x8caf('0xf')](_0x8caf('0x17'),_0x5cda07,JSON[_0x8caf('0x11')](_0x259411));_0x485347(_0x259411);})['catch'](function(_0x46cb28){logger['error']('GetCmHopperBlack',_0x46cb28['message'],_0x5cda07);_0x161026(_0x50fa01['error'](0x1f4,_0x46cb28['message']));});});};exports['UpdateCmHopperBlack']=function(_0x11d2f2){var _0x3adc75=this;return new Promise(function(_0x1ce265,_0x41e10b){return db['CmHopperBlack'][_0x8caf('0x21')](_0x11d2f2[_0x8caf('0x22')],{'raw':_0x11d2f2[_0x8caf('0x1a')]?_0x11d2f2['options'][_0x8caf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d2f2['options']?_0x11d2f2[_0x8caf('0x1a')]['where']||null:null,'attributes':_0x11d2f2[_0x8caf('0x1a')]?_0x11d2f2[_0x8caf('0x1a')][_0x8caf('0x1f')]||null:null,'limit':_0x11d2f2['options']?_0x11d2f2['options']['limit']||null:null})[_0x8caf('0x20')](function(_0x297928){logger[_0x8caf('0xc')](_0x8caf('0x23'),_0x11d2f2);logger[_0x8caf('0xf')](_0x8caf('0x23'),_0x11d2f2,JSON['stringify'](_0x297928));_0x1ce265(_0x297928);})[_0x8caf('0x16')](function(_0x5a5273){logger[_0x8caf('0x12')](_0x8caf('0x23'),_0x5a5273[_0x8caf('0x14')],_0x11d2f2);_0x41e10b(_0x3adc75['error'](0x1f4,_0x5a5273[_0x8caf('0x14')]));});});};exports[_0x8caf('0x24')]=function(_0x42983c){var _0x133f6e=this;return new Promise(function(_0x94ff1,_0x3e2c23){return db[_0x8caf('0x18')][_0x8caf('0x25')]({'where':_0x42983c[_0x8caf('0x1a')]?_0x42983c[_0x8caf('0x1a')]['where']||null:null})[_0x8caf('0x20')](function(_0x1055bd){logger[_0x8caf('0xc')](_0x8caf('0x24'),_0x42983c);logger[_0x8caf('0xf')](_0x8caf('0x24'),_0x42983c,JSON[_0x8caf('0x11')](_0x1055bd));_0x94ff1(_0x1055bd);})[_0x8caf('0x16')](function(_0x54b07d){logger[_0x8caf('0x12')](_0x8caf('0x24'),_0x54b07d[_0x8caf('0x14')],_0x42983c);_0x3e2c23(_0x133f6e[_0x8caf('0x12')](0x1f4,_0x54b07d[_0x8caf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 163c601..3b7642d 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 _0x687b=['isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x28fca4,_0x11e78b){var _0x42fd01=function(_0x33a97e){while(--_0x33a97e){_0x28fca4['push'](_0x28fca4['shift']());}};_0x42fd01(++_0x11e78b);}(_0x687b,0x14a));var _0xb687=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0x687b[_0x30b159];return _0x23c3f9;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller['destroy']);module[_0xb687('0x13')]=router; \ No newline at end of file +var _0x236d=['index','describe','show','/:id','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd236('0x0'));var util=require(_0xd236('0x1'));var path=require('path');var timeout=require(_0xd236('0x2'));var express=require('express');var router=express[_0xd236('0x3')]();var fs_extra=require(_0xd236('0x4'));var auth=require(_0xd236('0x5'));var interaction=require(_0xd236('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0xd236('0x7')]('/',auth[_0xd236('0x8')](),controller[_0xd236('0x9')]);router[_0xd236('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd236('0xa')]);router[_0xd236('0x7')]('/:id',auth[_0xd236('0x8')](),controller[_0xd236('0xb')]);router['put'](_0xd236('0xc'),auth[_0xd236('0x8')](),controller[_0xd236('0xd')]);router['delete'](_0xd236('0xc'),auth[_0xd236('0x8')](),controller[_0xd236('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 15acbcf..89a4cfa 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 _0xbbf6=['exports','INTEGER','STRING','DATE','getDataValue','setDataValue','diff','BOOLEAN','sequelize'];(function(_0x3bbba6,_0x1b66f4){var _0x1a6895=function(_0x473c0a){while(--_0x473c0a){_0x3bbba6['push'](_0x3bbba6['shift']());}};_0x1a6895(++_0x1b66f4);}(_0xbbf6,0x143));var _0x6bbf=function(_0x3087d5,_0x5af83c){_0x3087d5=_0x3087d5-0x0;var _0x2f400c=_0xbbf6[_0x3087d5];return _0x2f400c;};'use strict';var Sequelize=require(_0x6bbf('0x0'));var moment=require('moment');module[_0x6bbf('0x1')]={'state':{'type':Sequelize[_0x6bbf('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6bbf('0x3')]},'scheduledat':{'type':Sequelize[_0x6bbf('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6bbf('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6bbf('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6bbf('0x3')]},'calleridnum':{'type':Sequelize[_0x6bbf('0x3')]},'calleridname':{'type':Sequelize[_0x6bbf('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6bbf('0x4')]},'answertime':{'type':Sequelize[_0x6bbf('0x4')]},'droptime':{'type':Sequelize[_0x6bbf('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6bbf('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6bbf('0x3')]},'reason':{'type':Sequelize[_0x6bbf('0x3')]},'disposition':{'type':Sequelize[_0x6bbf('0x3')]},'secondDisposition':{'type':Sequelize[_0x6bbf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6bbf('0x3')]},'dispositionat':{'type':Sequelize[_0x6bbf('0x4')],'set':function(_0x3e2a3a){var _0x2d0030=this[_0x6bbf('0x5')]('endtime');if(_0x2d0030&&_0x3e2a3a){this[_0x6bbf('0x6')]('followuptime',moment(_0x3e2a3a)[_0x6bbf('0x7')](moment(_0x2d0030),'seconds'));}}},'amd':{'type':Sequelize[_0x6bbf('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6bbf('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6bbf('0x4')]},'callback':{'type':Sequelize[_0x6bbf('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6bbf('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6bbf('0x4')]},'deleted':{'type':Sequelize[_0x6bbf('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6bbf('0x4')]},'recallme':{'type':Sequelize[_0x6bbf('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6bbf('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6bbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7896=['exports','INTEGER','STRING','DATE','getDataValue','followuptime','diff','seconds','BOOLEAN'];(function(_0x3111ca,_0x4258a0){var _0x2c8bf5=function(_0x57024f){while(--_0x57024f){_0x3111ca['push'](_0x3111ca['shift']());}};_0x2c8bf5(++_0x4258a0);}(_0x7896,0x1ef));var _0x6789=function(_0x397157,_0x495686){_0x397157=_0x397157-0x0;var _0x5a038e=_0x7896[_0x397157];return _0x5a038e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6789('0x0')]={'state':{'type':Sequelize[_0x6789('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6789('0x2')]},'scheduledat':{'type':Sequelize[_0x6789('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6789('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6789('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6789('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6789('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6789('0x2')]},'calleridnum':{'type':Sequelize[_0x6789('0x2')]},'calleridname':{'type':Sequelize[_0x6789('0x2')]},'starttime':{'type':Sequelize[_0x6789('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6789('0x3')]},'ringtime':{'type':Sequelize[_0x6789('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6789('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6789('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6789('0x2')]},'campaigntype':{'type':Sequelize[_0x6789('0x2')]},'membername':{'type':Sequelize[_0x6789('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6789('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6789('0x2')]},'dispositionat':{'type':Sequelize[_0x6789('0x3')],'set':function(_0x5d0544){var _0x36ae61=this[_0x6789('0x4')]('endtime');if(_0x36ae61&&_0x5d0544){this['setDataValue'](_0x6789('0x5'),moment(_0x5d0544)[_0x6789('0x6')](moment(_0x36ae61),_0x6789('0x7')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6789('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6789('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6789('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x6789('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6789('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6789('0x3')]},'deleted':{'type':Sequelize[_0x6789('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6789('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x6789('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6789('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6789('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6789('0x1')],'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 7c84bfc..9ce7541 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 _0xbf7a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','keys','CmHopperFinal','describe','uniqueid','find','params','body','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','toString','calleridnum','VoiceQueueId\x20=\x20?','group','ContactId','moveContactsIvrCampaignHopperFinal','into','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','state','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs'];(function(_0x1bed23,_0x394e7e){var _0x21dbe1=function(_0x5806dd){while(--_0x5806dd){_0x1bed23['push'](_0x1bed23['shift']());}};_0x21dbe1(++_0x394e7e);}(_0xbf7a,0x16e));var _0xabf7=function(_0x3892af,_0xa41575){_0x3892af=_0x3892af-0x0;var _0x39917d=_0xbf7a[_0x3892af];return _0x39917d;};'use strict';var emlformat=require(_0xabf7('0x0'));var rimraf=require(_0xabf7('0x1'));var zipdir=require(_0xabf7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabf7('0x3'));var moment=require(_0xabf7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xabf7('0x5'));var util=require(_0xabf7('0x6'));var path=require('path');var sox=require(_0xabf7('0x7'));var csv=require(_0xabf7('0x8'));var ejs=require(_0xabf7('0x9'));var fs=require('fs');var fs_extra=require(_0xabf7('0xa'));var _=require(_0xabf7('0xb'));var squel=require(_0xabf7('0xc'));var crypto=require(_0xabf7('0xd'));var jsforce=require(_0xabf7('0xe'));var deskjs=require(_0xabf7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabf7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabf7('0x11'));var as=require(_0xabf7('0x12'));var hardwareService=require(_0xabf7('0x13'));var logger=require(_0xabf7('0x14'))(_0xabf7('0x15'));var utils=require('../../config/utils');var config=require(_0xabf7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xabf7('0x17'))['db'];function respondWithStatusCode(_0x255aae,_0x2d3519){_0x2d3519=_0x2d3519||0xcc;return function(_0x3aa2b6){if(_0x3aa2b6){return _0x255aae['sendStatus'](_0x2d3519);}return _0x255aae[_0xabf7('0x18')](_0x2d3519)[_0xabf7('0x19')]();};}function respondWithResult(_0x12bf67,_0x5a9ec1){_0x5a9ec1=_0x5a9ec1||0xc8;return function(_0x28f7d0){if(_0x28f7d0){return _0x12bf67[_0xabf7('0x18')](_0x5a9ec1)['json'](_0x28f7d0);}};}function respondWithFilteredResult(_0x329ad7,_0x5db44e){return function(_0x1f2332){if(_0x1f2332){var _0x46f37f=typeof _0x5db44e['offset']===_0xabf7('0x1a')&&typeof _0x5db44e['limit']===_0xabf7('0x1a');var _0x446b38=_0x1f2332['count'];var _0x2047ae=_0x46f37f?0x0:_0x5db44e['offset'];var _0xc79d46=_0x46f37f?_0x1f2332[_0xabf7('0x1b')]:_0x5db44e[_0xabf7('0x1c')]+_0x5db44e[_0xabf7('0x1d')];var _0x341588;if(_0xc79d46>=_0x446b38){_0xc79d46=_0x446b38;_0x341588=0xc8;}else{_0x341588=0xce;}_0x329ad7[_0xabf7('0x18')](_0x341588);return _0x329ad7[_0xabf7('0x1e')]('Content-Range',_0x2047ae+'-'+_0xc79d46+'/'+_0x446b38)[_0xabf7('0x1f')](_0x1f2332);}return null;};}function patchUpdates(_0x2eb961){return function(_0x2a38d1){try{jsonpatch[_0xabf7('0x20')](_0x2a38d1,_0x2eb961,!![]);}catch(_0x3fd95e){return BPromise[_0xabf7('0x21')](_0x3fd95e);}return _0x2a38d1[_0xabf7('0x22')]();};}function saveUpdates(_0x281658,_0x2fa861){return function(_0x5b3f3e){if(_0x5b3f3e){return _0x5b3f3e[_0xabf7('0x23')](_0x281658)['then'](function(_0x1866c4){return _0x1866c4;});}return null;};}function removeEntity(_0x2f576d,_0x4846fa){return function(_0x2e87a9){if(_0x2e87a9){return _0x2e87a9['destroy']()[_0xabf7('0x24')](function(){_0x2f576d[_0xabf7('0x18')](0xcc)[_0xabf7('0x19')]();});}};}function handleEntityNotFound(_0x3cb173,_0x35c95f){return function(_0xc32aa2){if(!_0xc32aa2){_0x3cb173['sendStatus'](0x194);}return _0xc32aa2;};}function handleError(_0x193f73,_0x46d395){_0x46d395=_0x46d395||0x1f4;return function(_0xf6dd87){logger[_0xabf7('0x25')](_0xf6dd87['stack']);if(_0xf6dd87[_0xabf7('0x26')]){delete _0xf6dd87[_0xabf7('0x26')];}_0x193f73[_0xabf7('0x18')](_0x46d395)[_0xabf7('0x27')](_0xf6dd87);};}exports[_0xabf7('0x28')]=function(_0x76b150,_0x5b0d63){var _0xaf88a2={},_0x15be60={},_0x1f1709={'count':0x0,'rows':[]};var _0x13cac0=_[_0xabf7('0x29')](db['CmHopperFinal'][_0xabf7('0x2a')],function(_0x127af7){return{'name':_0x127af7[_0xabf7('0x2b')],'type':_0x127af7[_0xabf7('0x2c')][_0xabf7('0x2d')]};});_0x15be60[_0xabf7('0x2e')]=_['map'](_0x13cac0,_0xabf7('0x26'));_0x15be60[_0xabf7('0x2f')]=_['keys'](_0x76b150[_0xabf7('0x2f')]);_0x15be60[_0xabf7('0x30')]=_[_0xabf7('0x31')](_0x15be60[_0xabf7('0x2e')],_0x15be60['query']);_0xaf88a2[_0xabf7('0x32')]=_[_0xabf7('0x31')](_0x15be60['model'],qs[_0xabf7('0x33')](_0x76b150[_0xabf7('0x2f')][_0xabf7('0x33')]));_0xaf88a2[_0xabf7('0x32')]=_0xaf88a2[_0xabf7('0x32')][_0xabf7('0x34')]?_0xaf88a2[_0xabf7('0x32')]:_0x15be60[_0xabf7('0x2e')];if(!_0x76b150[_0xabf7('0x2f')][_0xabf7('0x35')]('nolimit')){_0xaf88a2[_0xabf7('0x1d')]=qs[_0xabf7('0x1d')](_0x76b150[_0xabf7('0x2f')]['limit']);_0xaf88a2[_0xabf7('0x1c')]=qs[_0xabf7('0x1c')](_0x76b150[_0xabf7('0x2f')][_0xabf7('0x1c')]);}_0xaf88a2[_0xabf7('0x36')]=qs[_0xabf7('0x37')](_0x76b150['query'][_0xabf7('0x37')]);_0xaf88a2[_0xabf7('0x38')]=qs[_0xabf7('0x30')](_[_0xabf7('0x39')](_0x76b150[_0xabf7('0x2f')],_0x15be60['filters']),_0x13cac0);if(_0x76b150[_0xabf7('0x2f')][_0xabf7('0x3a')]){_0xaf88a2[_0xabf7('0x38')]=_[_0xabf7('0x3b')](_0xaf88a2[_0xabf7('0x38')],{'$or':_[_0xabf7('0x29')](_0x13cac0,function(_0x524112){if(_0x524112['type']!=='VIRTUAL'){var _0x19ea83={};_0x19ea83[_0x524112[_0xabf7('0x26')]]={'$like':'%'+_0x76b150[_0xabf7('0x2f')]['filter']+'%'};return _0x19ea83;}})});}_0xaf88a2=_[_0xabf7('0x3b')]({},_0xaf88a2,_0x76b150[_0xabf7('0x3c')]);var _0x30c047={'where':_0xaf88a2['where']};return db['CmHopperFinal'][_0xabf7('0x1b')](_0x30c047)[_0xabf7('0x24')](function(_0x2778cf){_0x1f1709[_0xabf7('0x1b')]=_0x2778cf;if(_0x76b150[_0xabf7('0x2f')][_0xabf7('0x3d')]){_0xaf88a2[_0xabf7('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0xaf88a2);})[_0xabf7('0x24')](function(_0x160f47){_0x1f1709[_0xabf7('0x3f')]=_0x160f47;return _0x1f1709;})[_0xabf7('0x24')](respondWithFilteredResult(_0x5b0d63,_0xaf88a2))[_0xabf7('0x40')](handleError(_0x5b0d63,null));};exports['show']=function(_0x47917d,_0x3eb9b1){var _0x4c5d1f={'raw':!![],'where':{'id':_0x47917d['params']['id']}},_0x486468={};_0x486468[_0xabf7('0x2e')]=_[_0xabf7('0x41')](db[_0xabf7('0x42')]['rawAttributes']);_0x486468[_0xabf7('0x2f')]=_[_0xabf7('0x41')](_0x47917d[_0xabf7('0x2f')]);_0x486468[_0xabf7('0x30')]=_[_0xabf7('0x31')](_0x486468[_0xabf7('0x2e')],_0x486468[_0xabf7('0x2f')]);_0x4c5d1f[_0xabf7('0x32')]=_[_0xabf7('0x31')](_0x486468['model'],qs[_0xabf7('0x33')](_0x47917d[_0xabf7('0x2f')][_0xabf7('0x33')]));_0x4c5d1f[_0xabf7('0x32')]=_0x4c5d1f['attributes'][_0xabf7('0x34')]?_0x4c5d1f['attributes']:_0x486468[_0xabf7('0x2e')];if(_0x47917d[_0xabf7('0x2f')][_0xabf7('0x3d')]){_0x4c5d1f[_0xabf7('0x3e')]=[{'all':!![]}];}_0x4c5d1f=_[_0xabf7('0x3b')]({},_0x4c5d1f,_0x47917d[_0xabf7('0x3c')]);return db[_0xabf7('0x42')]['find'](_0x4c5d1f)[_0xabf7('0x24')](handleEntityNotFound(_0x3eb9b1,null))[_0xabf7('0x24')](respondWithResult(_0x3eb9b1,null))['catch'](handleError(_0x3eb9b1,null));};exports[_0xabf7('0x43')]=function(_0x3ba277,_0x33b880){return db[_0xabf7('0x42')][_0xabf7('0x43')]()[_0xabf7('0x24')](respondWithResult(_0x33b880,null))['catch'](handleError(_0x33b880,null));};exports[_0xabf7('0x23')]=function(_0x4dca31,_0x333bef){if(_0x4dca31['body']['uniqueid']){delete _0x4dca31['body'][_0xabf7('0x44')];}return db['CmHopperFinal'][_0xabf7('0x45')]({'where':{'uniqueid':_0x4dca31[_0xabf7('0x46')]['id']}})[_0xabf7('0x24')](handleEntityNotFound(_0x333bef,null))[_0xabf7('0x24')](saveUpdates(_0x4dca31[_0xabf7('0x47')],null))[_0xabf7('0x24')](respondWithResult(_0x333bef,null))[_0xabf7('0x40')](handleError(_0x333bef,null));};exports[_0xabf7('0x48')]=function(_0x56a3ba,_0x5f36b4,_0x3c009f){return db[_0xabf7('0x42')][_0xabf7('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x56a3ba[_0xabf7('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db['sequelize'][_0xabf7('0x4c')](_0xabf7('0x4d')))),'noSuchContacts'],[db['sequelize']['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')][_0xabf7('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0xabf7('0x4e')],[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db['sequelize'][_0xabf7('0x4c')](_0xabf7('0x4f')))),'congestionContacts'],[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xabf7('0x50')],[db['sequelize']['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db['sequelize'][_0xabf7('0x4c')](_0xabf7('0x51')))),'abandonedContacts'],[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')][_0xabf7('0x4c')](_0xabf7('0x52')))),_0xabf7('0x53')],[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db['sequelize']['fn']('IF',db[_0xabf7('0x4b')][_0xabf7('0x4c')](_0xabf7('0x54')))),_0xabf7('0x55')]]})[_0xabf7('0x24')](handleEntityNotFound(_0x5f36b4,null))['then'](respondWithResult(_0x5f36b4,null))[_0xabf7('0x40')](handleError(_0x5f36b4,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5d2000,_0x49c5bc,_0x5b6fc2){return db['CmHopperFinal'][_0xabf7('0x49')]({'raw':![],'where':{'CampaignId':_0x5d2000['params']['id']},'attributes':[[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')][_0xabf7('0x4c')](_0xabf7('0x4d')))),_0xabf7('0x56')],[db[_0xabf7('0x4b')]['fn']('COUNT',db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')][_0xabf7('0x4c')](_0xabf7('0x57')))),_0xabf7('0x58')],[db['sequelize']['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')][_0xabf7('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0xabf7('0x4e')],[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')][_0xabf7('0x4c')](_0xabf7('0x4f')))),_0xabf7('0x59')],[db['sequelize']['fn']('COUNT',db[_0xabf7('0x4b')]['fn']('IF',db['sequelize'][_0xabf7('0x4c')](_0xabf7('0x5a')))),_0xabf7('0x50')],[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')]['literal'](_0xabf7('0x51')))),_0xabf7('0x5b')],[db['sequelize']['fn'](_0xabf7('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0xabf7('0x4c')](_0xabf7('0x52')))),_0xabf7('0x53')],[db[_0xabf7('0x4b')]['fn'](_0xabf7('0x4a'),db[_0xabf7('0x4b')]['fn']('IF',db[_0xabf7('0x4b')]['literal'](_0xabf7('0x54')))),'answeringMachine']]})[_0xabf7('0x24')](handleEntityNotFound(_0x49c5bc,null))['then'](respondWithResult(_0x49c5bc,null))[_0xabf7('0x40')](handleError(_0x49c5bc,null));};exports[_0xabf7('0x5c')]=function(_0xad2d53,_0x1fb0bf,_0x237e19){return db[_0xabf7('0x5d')]['find']({'where':{'id':_0xad2d53['params']['id']}})[_0xabf7('0x24')](handleEntityNotFound(_0x1fb0bf,null))[_0xabf7('0x24')](function(_0x30678a){var _0x1e39cd;if(_0x30678a){_0x1e39cd=squel[_0xabf7('0x5e')]()['into'](_0xabf7('0x5f'))[_0xabf7('0x60')]([_0xabf7('0x61'),_0xabf7('0x62'),'ContactId',_0xabf7('0x63'),_0xabf7('0x64'),_0xabf7('0x65'),_0xabf7('0x66')],squel[_0xabf7('0x67')]()[_0xabf7('0x68')](_0xabf7('0x69'),_0xabf7('0x61'))[_0xabf7('0x68')](_0xabf7('0x6a'),'scheduledAt')['field'](_0xabf7('0x6b'),'ContactId')[_0xabf7('0x68')]('ANY_VALUE(ListId)',_0xabf7('0x63'))[_0xabf7('0x68')]('ANY_VALUE(VoiceQueueId)',_0xabf7('0x64'))[_0xabf7('0x68')](_0xabf7('0x6a'),'createdAt')['field'](_0xabf7('0x6a'),_0xabf7('0x66'))[_0xabf7('0x6c')](_0xabf7('0x6d'))['where']('VoiceQueueId\x20=\x20?',_0xad2d53[_0xabf7('0x46')]['id']['toString']())[_0xabf7('0x38')](_0xabf7('0x6e'),_0xad2d53[_0xabf7('0x47')]['state']['toString']())[_0xabf7('0x38')](_0xabf7('0x6f'))[_0xabf7('0x38')](_0xabf7('0x70'),squel[_0xabf7('0x67')]()[_0xabf7('0x68')](_0xabf7('0x61'))[_0xabf7('0x6c')](_0xabf7('0x5f'))['where']('VoiceQueueId\x20=\x20?',_0xad2d53[_0xabf7('0x46')]['id'][_0xabf7('0x71')]()))[_0xabf7('0x38')](_0xabf7('0x70'),squel[_0xabf7('0x67')]()['field'](_0xabf7('0x72'))[_0xabf7('0x6c')]('cm_hopper_final')['where'](_0xabf7('0x73'),_0xad2d53[_0xabf7('0x46')]['id']['toString']())['where']('state\x20=\x204'))[_0xabf7('0x74')](_0xabf7('0x75')))[_0xabf7('0x71')]();return db[_0xabf7('0x4b')][_0xabf7('0x2f')](_0x1e39cd);}return[];})[_0xabf7('0x24')](respondWithResult(_0x1fb0bf,null))[_0xabf7('0x40')](handleError(_0x1fb0bf,null));};exports[_0xabf7('0x76')]=function(_0x387e91,_0x3f1e8b,_0x450084){return db['Campaign'][_0xabf7('0x45')]({'where':{'id':_0x387e91[_0xabf7('0x46')]['id']}})[_0xabf7('0x24')](handleEntityNotFound(_0x3f1e8b,null))[_0xabf7('0x24')](function(_0xa3045){var _0x58fbe9;if(_0xa3045){_0x58fbe9=squel[_0xabf7('0x5e')]()[_0xabf7('0x77')](_0xabf7('0x5f'))['fromQuery']([_0xabf7('0x61'),_0xabf7('0x62'),'ContactId',_0xabf7('0x63'),'CampaignId',_0xabf7('0x65'),_0xabf7('0x66')],squel[_0xabf7('0x67')]()[_0xabf7('0x68')]('ANY_VALUE(calleridnum)',_0xabf7('0x61'))[_0xabf7('0x68')](_0xabf7('0x6a'),_0xabf7('0x62'))['field'](_0xabf7('0x6b'),'ContactId')['field'](_0xabf7('0x78'),_0xabf7('0x63'))[_0xabf7('0x68')](_0xabf7('0x79'),_0xabf7('0x7a'))['field'](_0xabf7('0x6a'),_0xabf7('0x65'))['field'](_0xabf7('0x6a'),_0xabf7('0x66'))['from']('cm_hopper_final')[_0xabf7('0x38')]('CampaignId\x20=\x20?',_0x387e91[_0xabf7('0x46')]['id'][_0xabf7('0x71')]())['where'](_0xabf7('0x6e'),_0x387e91[_0xabf7('0x47')][_0xabf7('0x7b')][_0xabf7('0x71')]())[_0xabf7('0x38')](_0xabf7('0x6f'))[_0xabf7('0x38')](_0xabf7('0x70'),squel[_0xabf7('0x67')]()['field'](_0xabf7('0x61'))[_0xabf7('0x6c')]('cm_hopper')[_0xabf7('0x38')]('CampaignId\x20=\x20?',_0x387e91['params']['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xabf7('0x67')]()[_0xabf7('0x68')](_0xabf7('0x72'))[_0xabf7('0x6c')]('cm_hopper_final')[_0xabf7('0x38')](_0xabf7('0x7c'),_0x387e91[_0xabf7('0x46')]['id'][_0xabf7('0x71')]())['where']('state\x20=\x204'))['group'](_0xabf7('0x75')))['toString']();return db[_0xabf7('0x4b')][_0xabf7('0x2f')](_0x58fbe9);}return[];})[_0xabf7('0x24')](respondWithResult(_0x3f1e8b,null))[_0xabf7('0x40')](handleError(_0x3f1e8b,null));};exports[_0xabf7('0x7d')]=function(_0x53c95c,_0x3e7168,_0x75a5d4){return db[_0xabf7('0x7e')][_0xabf7('0x7f')]({'where':{'VoiceQueueId':_0x53c95c['body']['VoiceQueueId'],'CampaignId':_0x53c95c[_0xabf7('0x47')][_0xabf7('0x7a')],'ContactId':_0x53c95c[_0xabf7('0x47')][_0xabf7('0x75')]}})['then'](handleEntityNotFound(_0x3e7168,null))[_0xabf7('0x24')](function(_0x63ba48){if(_0x63ba48){return _0x63ba48;}return null;})['then'](respondWithResult(_0x3e7168,null))['catch'](handleError(_0x3e7168,null));}; \ No newline at end of file +var _0x6944=['dropContacts','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','into','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','scheduledAt','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','find','insert','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','findOne','CampaignId','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','catch','describe','uniqueid','body','sequelize','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts'];(function(_0x2c1d3b,_0x584d85){var _0x214b93=function(_0x4509c3){while(--_0x4509c3){_0x2c1d3b['push'](_0x2c1d3b['shift']());}};_0x214b93(++_0x584d85);}(_0x6944,0x19c));var _0x4694=function(_0x514864,_0x97505){_0x514864=_0x514864-0x0;var _0x5ea784=_0x6944[_0x514864];return _0x5ea784;};'use strict';var emlformat=require(_0x4694('0x0'));var rimraf=require(_0x4694('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4694('0x2'));var moment=require(_0x4694('0x3'));var BPromise=require(_0x4694('0x4'));var Mustache=require(_0x4694('0x5'));var util=require(_0x4694('0x6'));var path=require(_0x4694('0x7'));var sox=require(_0x4694('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4694('0x9'));var _=require('lodash');var squel=require(_0x4694('0xa'));var crypto=require(_0x4694('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4694('0xc'));var toCsv=require(_0x4694('0xd'));var querystring=require('querystring');var Papa=require(_0x4694('0xe'));var Redis=require(_0x4694('0xf'));var authService=require(_0x4694('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4694('0x11'));var hardwareService=require(_0x4694('0x12'));var logger=require(_0x4694('0x13'))(_0x4694('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4694('0x15'))['db'];function respondWithStatusCode(_0x5c6681,_0x1a4869){_0x1a4869=_0x1a4869||0xcc;return function(_0x5e9b6a){if(_0x5e9b6a){return _0x5c6681[_0x4694('0x16')](_0x1a4869);}return _0x5c6681[_0x4694('0x17')](_0x1a4869)[_0x4694('0x18')]();};}function respondWithResult(_0x366782,_0x3c8310){_0x3c8310=_0x3c8310||0xc8;return function(_0x487c11){if(_0x487c11){return _0x366782[_0x4694('0x17')](_0x3c8310)[_0x4694('0x19')](_0x487c11);}};}function respondWithFilteredResult(_0x428f1f,_0x31df21){return function(_0x30bc8e){if(_0x30bc8e){var _0x5db263=typeof _0x31df21[_0x4694('0x1a')]===_0x4694('0x1b')&&typeof _0x31df21['limit']===_0x4694('0x1b');var _0x4339e5=_0x30bc8e['count'];var _0x4b04a2=_0x5db263?0x0:_0x31df21['offset'];var _0x19bdba=_0x5db263?_0x30bc8e[_0x4694('0x1c')]:_0x31df21['offset']+_0x31df21[_0x4694('0x1d')];var _0x100f3d;if(_0x19bdba>=_0x4339e5){_0x19bdba=_0x4339e5;_0x100f3d=0xc8;}else{_0x100f3d=0xce;}_0x428f1f['status'](_0x100f3d);return _0x428f1f[_0x4694('0x1e')](_0x4694('0x1f'),_0x4b04a2+'-'+_0x19bdba+'/'+_0x4339e5)[_0x4694('0x19')](_0x30bc8e);}return null;};}function patchUpdates(_0x38e5bf){return function(_0x9a412b){try{jsonpatch['apply'](_0x9a412b,_0x38e5bf,!![]);}catch(_0xcdfe0a){return BPromise[_0x4694('0x20')](_0xcdfe0a);}return _0x9a412b['save']();};}function saveUpdates(_0x403d67,_0x11bbd8){return function(_0x43e4f0){if(_0x43e4f0){return _0x43e4f0[_0x4694('0x21')](_0x403d67)['then'](function(_0x48726d){return _0x48726d;});}return null;};}function removeEntity(_0x3ba792,_0x129112){return function(_0xc17386){if(_0xc17386){return _0xc17386['destroy']()[_0x4694('0x22')](function(){_0x3ba792[_0x4694('0x17')](0xcc)[_0x4694('0x18')]();});}};}function handleEntityNotFound(_0x108516,_0x2b63e0){return function(_0x300d23){if(!_0x300d23){_0x108516[_0x4694('0x16')](0x194);}return _0x300d23;};}function handleError(_0x143c6e,_0x151adf){_0x151adf=_0x151adf||0x1f4;return function(_0x298f11){logger['error'](_0x298f11['stack']);if(_0x298f11[_0x4694('0x23')]){delete _0x298f11['name'];}_0x143c6e[_0x4694('0x17')](_0x151adf)[_0x4694('0x24')](_0x298f11);};}exports[_0x4694('0x25')]=function(_0x59ac53,_0x469155){var _0xefbcda={},_0x26a36e={},_0x23b22c={'count':0x0,'rows':[]};var _0x590335=_[_0x4694('0x26')](db[_0x4694('0x27')][_0x4694('0x28')],function(_0x5c1c81){return{'name':_0x5c1c81[_0x4694('0x29')],'type':_0x5c1c81['type']['key']};});_0x26a36e[_0x4694('0x2a')]=_['map'](_0x590335,'name');_0x26a36e[_0x4694('0x2b')]=_[_0x4694('0x2c')](_0x59ac53[_0x4694('0x2b')]);_0x26a36e[_0x4694('0x2d')]=_[_0x4694('0x2e')](_0x26a36e[_0x4694('0x2a')],_0x26a36e[_0x4694('0x2b')]);_0xefbcda[_0x4694('0x2f')]=_['intersection'](_0x26a36e[_0x4694('0x2a')],qs[_0x4694('0x30')](_0x59ac53[_0x4694('0x2b')]['fields']));_0xefbcda[_0x4694('0x2f')]=_0xefbcda[_0x4694('0x2f')][_0x4694('0x31')]?_0xefbcda[_0x4694('0x2f')]:_0x26a36e[_0x4694('0x2a')];if(!_0x59ac53['query'][_0x4694('0x32')]('nolimit')){_0xefbcda[_0x4694('0x1d')]=qs[_0x4694('0x1d')](_0x59ac53[_0x4694('0x2b')][_0x4694('0x1d')]);_0xefbcda[_0x4694('0x1a')]=qs[_0x4694('0x1a')](_0x59ac53[_0x4694('0x2b')]['offset']);}_0xefbcda[_0x4694('0x33')]=qs[_0x4694('0x34')](_0x59ac53[_0x4694('0x2b')][_0x4694('0x34')]);_0xefbcda[_0x4694('0x35')]=qs['filters'](_[_0x4694('0x36')](_0x59ac53[_0x4694('0x2b')],_0x26a36e['filters']),_0x590335);if(_0x59ac53[_0x4694('0x2b')][_0x4694('0x37')]){_0xefbcda[_0x4694('0x35')]=_[_0x4694('0x38')](_0xefbcda[_0x4694('0x35')],{'$or':_['map'](_0x590335,function(_0x47e9ca){if(_0x47e9ca[_0x4694('0x39')]!==_0x4694('0x3a')){var _0x420b83={};_0x420b83[_0x47e9ca[_0x4694('0x23')]]={'$like':'%'+_0x59ac53[_0x4694('0x2b')][_0x4694('0x37')]+'%'};return _0x420b83;}})});}_0xefbcda=_[_0x4694('0x38')]({},_0xefbcda,_0x59ac53[_0x4694('0x3b')]);var _0x53eb40={'where':_0xefbcda['where']};return db[_0x4694('0x27')]['count'](_0x53eb40)[_0x4694('0x22')](function(_0x55ad3c){_0x23b22c['count']=_0x55ad3c;if(_0x59ac53[_0x4694('0x2b')][_0x4694('0x3c')]){_0xefbcda['include']=[{'all':!![]}];}return db[_0x4694('0x27')][_0x4694('0x3d')](_0xefbcda);})['then'](function(_0x52aded){_0x23b22c[_0x4694('0x3e')]=_0x52aded;return _0x23b22c;})['then'](respondWithFilteredResult(_0x469155,_0xefbcda))['catch'](handleError(_0x469155,null));};exports[_0x4694('0x3f')]=function(_0x45c515,_0x2b5a61){var _0x50c4e2={'raw':!![],'where':{'id':_0x45c515[_0x4694('0x40')]['id']}},_0x265fa9={};_0x265fa9[_0x4694('0x2a')]=_[_0x4694('0x2c')](db['CmHopperFinal']['rawAttributes']);_0x265fa9[_0x4694('0x2b')]=_[_0x4694('0x2c')](_0x45c515[_0x4694('0x2b')]);_0x265fa9['filters']=_['intersection'](_0x265fa9['model'],_0x265fa9[_0x4694('0x2b')]);_0x50c4e2['attributes']=_[_0x4694('0x2e')](_0x265fa9['model'],qs[_0x4694('0x30')](_0x45c515[_0x4694('0x2b')][_0x4694('0x30')]));_0x50c4e2[_0x4694('0x2f')]=_0x50c4e2[_0x4694('0x2f')]['length']?_0x50c4e2[_0x4694('0x2f')]:_0x265fa9['model'];if(_0x45c515[_0x4694('0x2b')]['includeAll']){_0x50c4e2[_0x4694('0x41')]=[{'all':!![]}];}_0x50c4e2=_[_0x4694('0x38')]({},_0x50c4e2,_0x45c515[_0x4694('0x3b')]);return db[_0x4694('0x27')]['find'](_0x50c4e2)[_0x4694('0x22')](handleEntityNotFound(_0x2b5a61,null))[_0x4694('0x22')](respondWithResult(_0x2b5a61,null))[_0x4694('0x42')](handleError(_0x2b5a61,null));};exports[_0x4694('0x43')]=function(_0x5a0a0d,_0x3338fc){return db[_0x4694('0x27')][_0x4694('0x43')]()[_0x4694('0x22')](respondWithResult(_0x3338fc,null))['catch'](handleError(_0x3338fc,null));};exports[_0x4694('0x21')]=function(_0x39babc,_0x3565b5){if(_0x39babc['body'][_0x4694('0x44')]){delete _0x39babc[_0x4694('0x45')][_0x4694('0x44')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x39babc[_0x4694('0x40')]['id']}})['then'](handleEntityNotFound(_0x3565b5,null))['then'](saveUpdates(_0x39babc[_0x4694('0x45')],null))[_0x4694('0x22')](respondWithResult(_0x3565b5,null))[_0x4694('0x42')](handleError(_0x3565b5,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x191b93,_0x2986eb,_0x4660fe){return db[_0x4694('0x27')][_0x4694('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x191b93[_0x4694('0x40')]['id']},'attributes':[[db[_0x4694('0x46')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4694('0x46')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x4694('0x47')],[db[_0x4694('0x46')]['fn'](_0x4694('0x48'),db[_0x4694('0x46')]['fn']('IF',db['sequelize'][_0x4694('0x49')](_0x4694('0x4a')))),_0x4694('0x4b')],[db['sequelize']['fn'](_0x4694('0x48'),db[_0x4694('0x46')]['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')](_0x4694('0x4c')))),_0x4694('0x4d')],[db[_0x4694('0x46')]['fn'](_0x4694('0x48'),db[_0x4694('0x46')]['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')](_0x4694('0x4e')))),_0x4694('0x4f')],[db[_0x4694('0x46')]['fn']('COUNT',db[_0x4694('0x46')]['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')](_0x4694('0x50')))),'dropContacts'],[db[_0x4694('0x46')]['fn']('COUNT',db[_0x4694('0x46')]['fn']('IF',db['sequelize'][_0x4694('0x49')](_0x4694('0x51')))),'abandonedContacts'],[db[_0x4694('0x46')]['fn'](_0x4694('0x48'),db[_0x4694('0x46')]['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')](_0x4694('0x52')))),_0x4694('0x53')],[db[_0x4694('0x46')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x4694('0x49')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x4694('0x22')](handleEntityNotFound(_0x2986eb,null))[_0x4694('0x22')](respondWithResult(_0x2986eb,null))[_0x4694('0x42')](handleError(_0x2986eb,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x199e3a,_0x896fbe,_0x5ea692){return db[_0x4694('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0x199e3a['params']['id']},'attributes':[[db[_0x4694('0x46')]['fn']('COUNT',db[_0x4694('0x46')]['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x4694('0x47')],[db['sequelize']['fn']('COUNT',db[_0x4694('0x46')]['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')](_0x4694('0x4a')))),'noAnswerContacts'],[db[_0x4694('0x46')]['fn'](_0x4694('0x48'),db['sequelize']['fn']('IF',db[_0x4694('0x46')]['literal'](_0x4694('0x4c')))),'busyContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4694('0x46')]['literal'](_0x4694('0x4e')))),_0x4694('0x4f')],[db[_0x4694('0x46')]['fn'](_0x4694('0x48'),db['sequelize']['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')](_0x4694('0x50')))),_0x4694('0x54')],[db[_0x4694('0x46')]['fn'](_0x4694('0x48'),db['sequelize']['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')](_0x4694('0x51')))),_0x4694('0x55')],[db[_0x4694('0x46')]['fn']('COUNT',db[_0x4694('0x46')]['fn']('IF',db['sequelize'][_0x4694('0x49')](_0x4694('0x52')))),'reCallContacts'],[db[_0x4694('0x46')]['fn']('COUNT',db[_0x4694('0x46')]['fn']('IF',db[_0x4694('0x46')][_0x4694('0x49')](_0x4694('0x56')))),'answeringMachine']]})[_0x4694('0x22')](handleEntityNotFound(_0x896fbe,null))['then'](respondWithResult(_0x896fbe,null))['catch'](handleError(_0x896fbe,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3f3215,_0x3bef24,_0x577ae5){return db[_0x4694('0x57')]['find']({'where':{'id':_0x3f3215['params']['id']}})[_0x4694('0x22')](handleEntityNotFound(_0x3bef24,null))[_0x4694('0x22')](function(_0x5dc1b7){var _0x1b6b01;if(_0x5dc1b7){_0x1b6b01=squel['insert']()[_0x4694('0x58')](_0x4694('0x59'))[_0x4694('0x5a')]([_0x4694('0x5b'),'scheduledAt',_0x4694('0x5c'),_0x4694('0x5d'),'VoiceQueueId',_0x4694('0x5e'),_0x4694('0x5f')],squel[_0x4694('0x60')]()['field'](_0x4694('0x61'),_0x4694('0x5b'))['field']('NOW()',_0x4694('0x62'))[_0x4694('0x63')](_0x4694('0x64'),_0x4694('0x5c'))[_0x4694('0x63')](_0x4694('0x65'),'ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x4694('0x66'))[_0x4694('0x63')](_0x4694('0x67'),_0x4694('0x5e'))[_0x4694('0x63')]('NOW()','updatedAt')[_0x4694('0x68')](_0x4694('0x69'))['where'](_0x4694('0x6a'),_0x3f3215['params']['id']['toString']())[_0x4694('0x35')](_0x4694('0x6b'),_0x3f3215[_0x4694('0x45')][_0x4694('0x6c')][_0x4694('0x6d')]())[_0x4694('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x4694('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4694('0x60')]()[_0x4694('0x63')](_0x4694('0x5b'))[_0x4694('0x68')](_0x4694('0x59'))['where'](_0x4694('0x6a'),_0x3f3215[_0x4694('0x40')]['id'][_0x4694('0x6d')]()))[_0x4694('0x35')](_0x4694('0x6e'),squel[_0x4694('0x60')]()['field'](_0x4694('0x6f'))[_0x4694('0x68')](_0x4694('0x69'))['where'](_0x4694('0x6a'),_0x3f3215[_0x4694('0x40')]['id'][_0x4694('0x6d')]())[_0x4694('0x35')]('state\x20=\x204'))[_0x4694('0x70')]('ContactId'))[_0x4694('0x6d')]();return db[_0x4694('0x46')][_0x4694('0x2b')](_0x1b6b01);}return[];})[_0x4694('0x22')](respondWithResult(_0x3bef24,null))[_0x4694('0x42')](handleError(_0x3bef24,null));};exports[_0x4694('0x71')]=function(_0x5518a8,_0x4b4cde,_0x319cc8){return db[_0x4694('0x72')][_0x4694('0x73')]({'where':{'id':_0x5518a8[_0x4694('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b4cde,null))[_0x4694('0x22')](function(_0x464e44){var _0x5811b7;if(_0x464e44){_0x5811b7=squel[_0x4694('0x74')]()[_0x4694('0x58')](_0x4694('0x59'))['fromQuery']([_0x4694('0x5b'),_0x4694('0x62'),_0x4694('0x5c'),_0x4694('0x5d'),'CampaignId',_0x4694('0x5e'),_0x4694('0x5f')],squel[_0x4694('0x60')]()[_0x4694('0x63')](_0x4694('0x61'),_0x4694('0x5b'))['field'](_0x4694('0x67'),'scheduledAt')[_0x4694('0x63')](_0x4694('0x64'),_0x4694('0x5c'))[_0x4694('0x63')](_0x4694('0x65'),_0x4694('0x5d'))[_0x4694('0x63')](_0x4694('0x75'),'CampaignId')['field'](_0x4694('0x67'),'createdAt')[_0x4694('0x63')](_0x4694('0x67'),_0x4694('0x5f'))[_0x4694('0x68')](_0x4694('0x69'))[_0x4694('0x35')](_0x4694('0x76'),_0x5518a8[_0x4694('0x40')]['id'][_0x4694('0x6d')]())[_0x4694('0x35')](_0x4694('0x6b'),_0x5518a8[_0x4694('0x45')]['state'][_0x4694('0x6d')]())[_0x4694('0x35')](_0x4694('0x77'))[_0x4694('0x35')](_0x4694('0x6e'),squel[_0x4694('0x60')]()[_0x4694('0x63')](_0x4694('0x5b'))['from']('cm_hopper')[_0x4694('0x35')](_0x4694('0x76'),_0x5518a8['params']['id'][_0x4694('0x6d')]()))[_0x4694('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4694('0x60')]()[_0x4694('0x63')](_0x4694('0x6f'))[_0x4694('0x68')](_0x4694('0x69'))[_0x4694('0x35')](_0x4694('0x76'),_0x5518a8[_0x4694('0x40')]['id'][_0x4694('0x6d')]())['where']('state\x20=\x204'))[_0x4694('0x70')](_0x4694('0x5c')))[_0x4694('0x6d')]();return db[_0x4694('0x46')]['query'](_0x5811b7);}return[];})[_0x4694('0x22')](respondWithResult(_0x4b4cde,null))['catch'](handleError(_0x4b4cde,null));};exports[_0x4694('0x78')]=function(_0x4ef98a,_0x4bf078,_0x2ed837){return db[_0x4694('0x79')][_0x4694('0x7a')]({'where':{'VoiceQueueId':_0x4ef98a[_0x4694('0x45')]['VoiceQueueId'],'CampaignId':_0x4ef98a[_0x4694('0x45')][_0x4694('0x7b')],'ContactId':_0x4ef98a['body'][_0x4694('0x5c')]}})[_0x4694('0x22')](handleEntityNotFound(_0x4bf078,null))[_0x4694('0x22')](function(_0x324a2a){if(_0x324a2a){return _0x324a2a;}return null;})[_0x4694('0x22')](respondWithResult(_0x4bf078,null))[_0x4694('0x42')](handleError(_0x4bf078,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3766795..ee99bac 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 _0xc283=['calleridnum','uniqueid','util','../../config/logger','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0xc283,0xa4));var _0x3c28=function(_0x591b48,_0xc7fd90){_0x591b48=_0x591b48-0x0;var _0x5785ea=_0xc283[_0x591b48];return _0x5785ea;};'use strict';var _=require('lodash');var util=require(_0x3c28('0x0'));var logger=require(_0x3c28('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3c28('0x2'));var config=require(_0x3c28('0x3'));var attributes=require('./cmHopperFinal.attributes');module[_0x3c28('0x4')]=function(_0x1ccf17,_0x534c02){return _0x1ccf17['define'](_0x3c28('0x5'),attributes,{'tableName':_0x3c28('0x6'),'paranoid':![],'indexes':[{'name':_0x3c28('0x7'),'fields':[_0x3c28('0x7')]},{'name':_0x3c28('0x8'),'fields':[_0x3c28('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf714=['lodash','util','../../config/logger','api','moment','path','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x57ff9f,_0x43f627){var _0x14be3d=function(_0x2a21eb){while(--_0x2a21eb){_0x57ff9f['push'](_0x57ff9f['shift']());}};_0x14be3d(++_0x43f627);}(_0xf714,0x1d4));var _0x4f71=function(_0x7dfb21,_0x54cbb5){_0x7dfb21=_0x7dfb21-0x0;var _0x544f45=_0xf714[_0x7dfb21];return _0x544f45;};'use strict';var _=require(_0x4f71('0x0'));var util=require(_0x4f71('0x1'));var logger=require(_0x4f71('0x2'))(_0x4f71('0x3'));var moment=require(_0x4f71('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f71('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4f71('0x6'));module[_0x4f71('0x7')]=function(_0x3c22b9,_0x3ee97e){return _0x3c22b9[_0x4f71('0x8')](_0x4f71('0x9'),attributes,{'tableName':_0x4f71('0xa'),'paranoid':![],'indexes':[{'name':_0x4f71('0xb'),'fields':[_0x4f71('0xb')]},{'name':_0x4f71('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 326d962..d4bd1a0 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 _0x0f1f=['then','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x51ba79,_0x43bba6){var _0x2e2aab=function(_0x47abff){while(--_0x47abff){_0x51ba79['push'](_0x51ba79['shift']());}};_0x2e2aab(++_0x43bba6);}(_0x0f1f,0x1d6));var _0xf0f1=function(_0x1b7ab6,_0x4323b0){_0x1b7ab6=_0x1b7ab6-0x0;var _0x3d1e62=_0x0f1f[_0x1b7ab6];return _0x3d1e62;};'use strict';var _=require(_0xf0f1('0x0'));var util=require(_0xf0f1('0x1'));var moment=require(_0xf0f1('0x2'));var BPromise=require(_0xf0f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0f1('0x5'));var logger=require(_0xf0f1('0x6'))(_0xf0f1('0x7'));var config=require(_0xf0f1('0x8'));var jayson=require(_0xf0f1('0x9'));var client=jayson[_0xf0f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25dd14,_0xc2b63b,_0x4015ec){return new BPromise(function(_0x6033c,_0x259cc9){return client['request'](_0x25dd14,_0x4015ec)['then'](function(_0x25714e){logger[_0xf0f1('0xb')](_0xf0f1('0xc'),_0xc2b63b,_0xf0f1('0xd'));logger['debug'](_0xf0f1('0xe'),_0xc2b63b,_0xf0f1('0xd'),JSON['stringify'](_0x25714e));if(_0x25714e[_0xf0f1('0xf')]){if(_0x25714e['error'][_0xf0f1('0x10')]===0x1f4){logger['error'](_0xf0f1('0xc'),_0xc2b63b,_0x25714e[_0xf0f1('0xf')][_0xf0f1('0x11')]);return _0x259cc9(_0x25714e[_0xf0f1('0xf')][_0xf0f1('0x11')]);}logger[_0xf0f1('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0xc2b63b,_0x25714e['error'][_0xf0f1('0x11')]);return _0x6033c(_0x25714e[_0xf0f1('0xf')]['message']);}else{logger['info'](_0xf0f1('0xc'),_0xc2b63b,_0xf0f1('0xd'));_0x6033c(_0x25714e['result'][_0xf0f1('0x11')]);}})[_0xf0f1('0x12')](function(_0x5ca5d1){logger[_0xf0f1('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0xc2b63b,_0x5ca5d1);_0x259cc9(_0x5ca5d1);});});}exports[_0xf0f1('0x13')]=function(_0x596765){var _0x1a85d9=this;return new Promise(function(_0x28e96b,_0x29cd66){return db[_0xf0f1('0x14')][_0xf0f1('0x15')](_0x596765['body'],{'raw':_0x596765[_0xf0f1('0x16')]?_0x596765[_0xf0f1('0x16')][_0xf0f1('0x17')]===undefined?!![]:![]:!![]})[_0xf0f1('0x18')](function(_0x4c95cb){logger[_0xf0f1('0xb')](_0xf0f1('0x13'),_0x596765);logger['debug']('CreateCmHopperFinal',_0x596765,JSON[_0xf0f1('0x19')](_0x4c95cb));_0x28e96b(_0x4c95cb);})[_0xf0f1('0x12')](function(_0x3eef78){logger['error']('CreateCmHopperFinal',_0x3eef78[_0xf0f1('0x11')],_0x596765);_0x29cd66(_0x1a85d9[_0xf0f1('0xf')](0x1f4,_0x3eef78[_0xf0f1('0x11')]));});});}; \ No newline at end of file +var _0x4a9d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','lodash','util','bluebird'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x4a9d,0x1ad));var _0xd4a9=function(_0x2ee391,_0x5d3419){_0x2ee391=_0x2ee391-0x0;var _0x4303a3=_0x4a9d[_0x2ee391];return _0x4303a3;};'use strict';var _=require(_0xd4a9('0x0'));var util=require(_0xd4a9('0x1'));var moment=require('moment');var BPromise=require(_0xd4a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4a9('0x3'))['db'];var utils=require(_0xd4a9('0x4'));var logger=require(_0xd4a9('0x5'))(_0xd4a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xd4a9('0x7'));var client=jayson[_0xd4a9('0x8')][_0xd4a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41da55,_0x1d4da4,_0x1c8264){return new BPromise(function(_0x5e2467,_0x30d172){return client[_0xd4a9('0xa')](_0x41da55,_0x1c8264)[_0xd4a9('0xb')](function(_0xa8b220){logger[_0xd4a9('0xc')](_0xd4a9('0xd'),_0x1d4da4,_0xd4a9('0xe'));logger[_0xd4a9('0xf')](_0xd4a9('0x10'),_0x1d4da4,_0xd4a9('0xe'),JSON[_0xd4a9('0x11')](_0xa8b220));if(_0xa8b220[_0xd4a9('0x12')]){if(_0xa8b220[_0xd4a9('0x12')]['code']===0x1f4){logger[_0xd4a9('0x12')](_0xd4a9('0xd'),_0x1d4da4,_0xa8b220['error'][_0xd4a9('0x13')]);return _0x30d172(_0xa8b220[_0xd4a9('0x12')][_0xd4a9('0x13')]);}logger[_0xd4a9('0x12')](_0xd4a9('0xd'),_0x1d4da4,_0xa8b220['error']['message']);return _0x5e2467(_0xa8b220[_0xd4a9('0x12')][_0xd4a9('0x13')]);}else{logger[_0xd4a9('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x1d4da4,_0xd4a9('0xe'));_0x5e2467(_0xa8b220[_0xd4a9('0x14')][_0xd4a9('0x13')]);}})[_0xd4a9('0x15')](function(_0x13cf7a){logger['error'](_0xd4a9('0xd'),_0x1d4da4,_0x13cf7a);_0x30d172(_0x13cf7a);});});}exports[_0xd4a9('0x16')]=function(_0x9a2099){var _0x3b2d3d=this;return new Promise(function(_0x467573,_0x279d7a){return db[_0xd4a9('0x17')][_0xd4a9('0x18')](_0x9a2099[_0xd4a9('0x19')],{'raw':_0x9a2099[_0xd4a9('0x1a')]?_0x9a2099[_0xd4a9('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd4a9('0xb')](function(_0x237784){logger[_0xd4a9('0xc')](_0xd4a9('0x16'),_0x9a2099);logger[_0xd4a9('0xf')](_0xd4a9('0x16'),_0x9a2099,JSON['stringify'](_0x237784));_0x467573(_0x237784);})[_0xd4a9('0x15')](function(_0x4f1ee9){logger[_0xd4a9('0x12')](_0xd4a9('0x16'),_0x4f1ee9[_0xd4a9('0x13')],_0x9a2099);_0x279d7a(_0x3b2d3d[_0xd4a9('0x12')](0x1f4,_0x4f1ee9['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 9190fea..c679d8b 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 _0xcb8a=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xcb8a,0x1ed));var _0xacb8=function(_0x5adf2f,_0x5c0f21){_0x5adf2f=_0x5adf2f-0x0;var _0x28ca04=_0xcb8a[_0x5adf2f];return _0x28ca04;};'use strict';var multer=require(_0xacb8('0x0'));var util=require('util');var path=require(_0xacb8('0x1'));var timeout=require('connect-timeout');var express=require(_0xacb8('0x2'));var router=express[_0xacb8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xacb8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xacb8('0x5'));var controller=require(_0xacb8('0x6'));router[_0xacb8('0x7')]('/',auth[_0xacb8('0x8')](),controller[_0xacb8('0x9')]);router[_0xacb8('0x7')](_0xacb8('0xa'),auth[_0xacb8('0x8')](),controller['describe']);router[_0xacb8('0x7')](_0xacb8('0xb'),auth[_0xacb8('0x8')](),controller[_0xacb8('0xc')]);router[_0xacb8('0x7')]('/voice/queue/countAttributes/:id',auth[_0xacb8('0x8')](),controller[_0xacb8('0xd')]);router['get'](_0xacb8('0xe'),auth[_0xacb8('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xacb8('0xf')]('/voice/queue/moveContacts/:id',auth[_0xacb8('0x8')](),controller[_0xacb8('0x10')]);router[_0xacb8('0xf')](_0xacb8('0x11'),auth[_0xacb8('0x8')](),controller[_0xacb8('0x12')]);router[_0xacb8('0xf')](_0xacb8('0x13'),auth[_0xacb8('0x8')](),controller[_0xacb8('0x14')]);router[_0xacb8('0x15')](_0xacb8('0xb'),auth[_0xacb8('0x8')](),controller['update']);module[_0xacb8('0x16')]=router; \ No newline at end of file +var _0x19b8=['moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id'];(function(_0x26da48,_0x545f6a){var _0x330289=function(_0x5eda14){while(--_0x5eda14){_0x26da48['push'](_0x26da48['shift']());}};_0x330289(++_0x545f6a);}(_0x19b8,0x10e));var _0x819b=function(_0x1f1dbe,_0x143082){_0x1f1dbe=_0x1f1dbe-0x0;var _0x265cd6=_0x19b8[_0x1f1dbe];return _0x265cd6;};'use strict';var multer=require(_0x819b('0x0'));var util=require('util');var path=require(_0x819b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x819b('0x2')]();var fs_extra=require(_0x819b('0x3'));var auth=require(_0x819b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x819b('0x5'));var controller=require(_0x819b('0x6'));router[_0x819b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x819b('0x7')](_0x819b('0x8'),auth[_0x819b('0x9')](),controller['describe']);router[_0x819b('0x7')](_0x819b('0xa'),auth[_0x819b('0x9')](),controller['show']);router[_0x819b('0x7')](_0x819b('0xb'),auth['isAuthenticated'](),controller[_0x819b('0xc')]);router[_0x819b('0x7')](_0x819b('0xd'),auth[_0x819b('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x819b('0xe')](_0x819b('0xf'),auth['isAuthenticated'](),controller[_0x819b('0x10')]);router[_0x819b('0xe')]('/voice/campaign/moveContacts/:id',auth[_0x819b('0x9')](),controller[_0x819b('0x11')]);router['post'](_0x819b('0x12'),auth[_0x819b('0x9')](),controller[_0x819b('0x13')]);router['put'](_0x819b('0xa'),auth[_0x819b('0x9')](),controller[_0x819b('0x14')]);module[_0x819b('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d4eb40b..73076e7 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 _0x20c0=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x19fae8,_0x287951){var _0xe2b0e8=function(_0x3f40b0){while(--_0x3f40b0){_0x19fae8['push'](_0x19fae8['shift']());}};_0xe2b0e8(++_0x287951);}(_0x20c0,0x135));var _0x020c=function(_0x1a72f7,_0x294718){_0x1a72f7=_0x1a72f7-0x0;var _0x2204fd=_0x20c0[_0x1a72f7];return _0x2204fd;};'use strict';var Sequelize=require(_0x020c('0x0'));module[_0x020c('0x1')]={'state':{'type':Sequelize[_0x020c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x020c('0x3')]},'scheduledat':{'type':Sequelize[_0x020c('0x4')]},'countbusyretry':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x020c('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x020c('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x020c('0x3')]},'starttime':{'type':Sequelize[_0x020c('0x4')]},'responsetime':{'type':Sequelize[_0x020c('0x4')]},'answertime':{'type':Sequelize[_0x020c('0x4')]},'droptime':{'type':Sequelize[_0x020c('0x4')]},'endtime':{'type':Sequelize[_0x020c('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x020c('0x3')]},'campaign':{'type':Sequelize[_0x020c('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x020c('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x020c('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x020c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x020c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x020c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x020c('0x4')]},'recallme':{'type':Sequelize[_0x020c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x020c('0x4')]},'edited':{'type':Sequelize[_0x020c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x020c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb32b=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3ffe2e,_0x4020aa){var _0xef9b67=function(_0x388f7e){while(--_0x388f7e){_0x3ffe2e['push'](_0x3ffe2e['shift']());}};_0xef9b67(++_0x4020aa);}(_0xb32b,0xc4));var _0xbb32=function(_0x5c2a70,_0x45ea0a){_0x5c2a70=_0x5c2a70-0x0;var _0x534c26=_0xb32b[_0x5c2a70];return _0x534c26;};'use strict';var Sequelize=require(_0xbb32('0x0'));module[_0xbb32('0x1')]={'state':{'type':Sequelize[_0xbb32('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbb32('0x3')]},'scheduledat':{'type':Sequelize[_0xbb32('0x4')]},'countbusyretry':{'type':Sequelize[_0xbb32('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbb32('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbb32('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbb32('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xbb32('0x3')]},'calleridnum':{'type':Sequelize[_0xbb32('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xbb32('0x4')]},'responsetime':{'type':Sequelize[_0xbb32('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbb32('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbb32('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbb32('0x3')]},'campaign':{'type':Sequelize[_0xbb32('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xbb32('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xbb32('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbb32('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xbb32('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbb32('0x4')]},'recallme':{'type':Sequelize[_0xbb32('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbb32('0x4')]},'edited':{'type':Sequelize[_0xbb32('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbb32('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbb32('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbb32('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbb32('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a1981cf..e8f1435 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 _0xc05e=['rows','show','params','find','create','body','catch','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc05e,0x18f));var _0xec05=function(_0x4c6436,_0x2aec52){_0x4c6436=_0x4c6436-0x0;var _0x1219a2=_0xc05e[_0x4c6436];return _0x1219a2;};'use strict';var emlformat=require(_0xec05('0x0'));var rimraf=require(_0xec05('0x1'));var zipdir=require(_0xec05('0x2'));var jsonpatch=require(_0xec05('0x3'));var rp=require(_0xec05('0x4'));var moment=require('moment');var BPromise=require(_0xec05('0x5'));var Mustache=require('mustache');var util=require(_0xec05('0x6'));var path=require(_0xec05('0x7'));var sox=require(_0xec05('0x8'));var csv=require('to-csv');var ejs=require(_0xec05('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec05('0xa'));var squel=require(_0xec05('0xb'));var crypto=require(_0xec05('0xc'));var jsforce=require(_0xec05('0xd'));var deskjs=require(_0xec05('0xe'));var toCsv=require(_0xec05('0xf'));var querystring=require(_0xec05('0x10'));var Papa=require(_0xec05('0x11'));var Redis=require(_0xec05('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xec05('0x13'));var as=require(_0xec05('0x14'));var hardwareService=require(_0xec05('0x15'));var logger=require('../../config/logger')(_0xec05('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xec05('0x17'))['db'];function respondWithStatusCode(_0x4c7f61,_0x46335e){_0x46335e=_0x46335e||0xcc;return function(_0x21d778){if(_0x21d778){return _0x4c7f61[_0xec05('0x18')](_0x46335e);}return _0x4c7f61[_0xec05('0x19')](_0x46335e)[_0xec05('0x1a')]();};}function respondWithResult(_0x39ba11,_0x3002b5){_0x3002b5=_0x3002b5||0xc8;return function(_0x1342b8){if(_0x1342b8){return _0x39ba11['status'](_0x3002b5)['json'](_0x1342b8);}};}function respondWithFilteredResult(_0x226209,_0x24f6ae){return function(_0xe676a8){if(_0xe676a8){var _0x16c64e=typeof _0x24f6ae[_0xec05('0x1b')]==='undefined'&&typeof _0x24f6ae[_0xec05('0x1c')]===_0xec05('0x1d');var _0x2171c4=_0xe676a8[_0xec05('0x1e')];var _0x419928=_0x16c64e?0x0:_0x24f6ae[_0xec05('0x1b')];var _0x3c708a=_0x16c64e?_0xe676a8[_0xec05('0x1e')]:_0x24f6ae[_0xec05('0x1b')]+_0x24f6ae['limit'];var _0x149adc;if(_0x3c708a>=_0x2171c4){_0x3c708a=_0x2171c4;_0x149adc=0xc8;}else{_0x149adc=0xce;}_0x226209['status'](_0x149adc);return _0x226209[_0xec05('0x1f')](_0xec05('0x20'),_0x419928+'-'+_0x3c708a+'/'+_0x2171c4)[_0xec05('0x21')](_0xe676a8);}return null;};}function patchUpdates(_0x33eda0){return function(_0x1b6121){try{jsonpatch[_0xec05('0x22')](_0x1b6121,_0x33eda0,!![]);}catch(_0x169e9c){return BPromise[_0xec05('0x23')](_0x169e9c);}return _0x1b6121[_0xec05('0x24')]();};}function saveUpdates(_0x3d1ec0,_0x502149){return function(_0x5c13fd){if(_0x5c13fd){return _0x5c13fd[_0xec05('0x25')](_0x3d1ec0)[_0xec05('0x26')](function(_0x573741){return _0x573741;});}return null;};}function removeEntity(_0x1dbdff,_0x13ba81){return function(_0x4b34cb){if(_0x4b34cb){return _0x4b34cb['destroy']()[_0xec05('0x26')](function(){_0x1dbdff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x363c5a,_0x52620e){return function(_0x357afb){if(!_0x357afb){_0x363c5a['sendStatus'](0x194);}return _0x357afb;};}function handleError(_0x27d332,_0x148299){_0x148299=_0x148299||0x1f4;return function(_0x2d2ad0){logger[_0xec05('0x27')](_0x2d2ad0[_0xec05('0x28')]);if(_0x2d2ad0[_0xec05('0x29')]){delete _0x2d2ad0[_0xec05('0x29')];}_0x27d332[_0xec05('0x19')](_0x148299)[_0xec05('0x2a')](_0x2d2ad0);};}exports[_0xec05('0x2b')]=function(_0x2e01d7,_0x417df5){var _0x16c9db={},_0x1916ad={},_0x40588b={'count':0x0,'rows':[]};var _0x5634f=_[_0xec05('0x2c')](db[_0xec05('0x2d')][_0xec05('0x2e')],function(_0x421829){return{'name':_0x421829[_0xec05('0x2f')],'type':_0x421829[_0xec05('0x30')][_0xec05('0x31')]};});_0x1916ad[_0xec05('0x32')]=_[_0xec05('0x2c')](_0x5634f,'name');_0x1916ad['query']=_[_0xec05('0x33')](_0x2e01d7[_0xec05('0x34')]);_0x1916ad[_0xec05('0x35')]=_['intersection'](_0x1916ad['model'],_0x1916ad[_0xec05('0x34')]);_0x16c9db[_0xec05('0x36')]=_[_0xec05('0x37')](_0x1916ad[_0xec05('0x32')],qs[_0xec05('0x38')](_0x2e01d7[_0xec05('0x34')][_0xec05('0x38')]));_0x16c9db[_0xec05('0x36')]=_0x16c9db[_0xec05('0x36')][_0xec05('0x39')]?_0x16c9db[_0xec05('0x36')]:_0x1916ad[_0xec05('0x32')];if(!_0x2e01d7[_0xec05('0x34')][_0xec05('0x3a')]('nolimit')){_0x16c9db['limit']=qs[_0xec05('0x1c')](_0x2e01d7[_0xec05('0x34')][_0xec05('0x1c')]);_0x16c9db['offset']=qs[_0xec05('0x1b')](_0x2e01d7['query'][_0xec05('0x1b')]);}_0x16c9db[_0xec05('0x3b')]=qs[_0xec05('0x3c')](_0x2e01d7[_0xec05('0x34')]['sort']);_0x16c9db['where']=qs[_0xec05('0x35')](_['pick'](_0x2e01d7[_0xec05('0x34')],_0x1916ad[_0xec05('0x35')]),_0x5634f);if(_0x2e01d7['query'][_0xec05('0x3d')]){_0x16c9db[_0xec05('0x3e')]=_[_0xec05('0x3f')](_0x16c9db[_0xec05('0x3e')],{'$or':_[_0xec05('0x2c')](_0x5634f,function(_0x323397){if(_0x323397[_0xec05('0x30')]!==_0xec05('0x40')){var _0x24de31={};_0x24de31[_0x323397['name']]={'$like':'%'+_0x2e01d7[_0xec05('0x34')][_0xec05('0x3d')]+'%'};return _0x24de31;}})});}_0x16c9db=_[_0xec05('0x3f')]({},_0x16c9db,_0x2e01d7[_0xec05('0x41')]);var _0x361fe3={'where':_0x16c9db[_0xec05('0x3e')]};return db[_0xec05('0x2d')][_0xec05('0x1e')](_0x361fe3)[_0xec05('0x26')](function(_0x3c13ae){_0x40588b[_0xec05('0x1e')]=_0x3c13ae;if(_0x2e01d7[_0xec05('0x34')][_0xec05('0x42')]){_0x16c9db[_0xec05('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xec05('0x44')](_0x16c9db);})[_0xec05('0x26')](function(_0xbbb0bf){_0x40588b[_0xec05('0x45')]=_0xbbb0bf;return _0x40588b;})[_0xec05('0x26')](respondWithFilteredResult(_0x417df5,_0x16c9db))['catch'](handleError(_0x417df5,null));};exports[_0xec05('0x46')]=function(_0x3c2134,_0x47156b){var _0x1ec25f={'raw':!![],'where':{'id':_0x3c2134[_0xec05('0x47')]['id']}},_0xf80245={};_0xf80245['model']=_[_0xec05('0x33')](db[_0xec05('0x2d')][_0xec05('0x2e')]);_0xf80245['query']=_[_0xec05('0x33')](_0x3c2134[_0xec05('0x34')]);_0xf80245['filters']=_[_0xec05('0x37')](_0xf80245[_0xec05('0x32')],_0xf80245['query']);_0x1ec25f[_0xec05('0x36')]=_[_0xec05('0x37')](_0xf80245[_0xec05('0x32')],qs[_0xec05('0x38')](_0x3c2134['query'][_0xec05('0x38')]));_0x1ec25f['attributes']=_0x1ec25f['attributes'][_0xec05('0x39')]?_0x1ec25f[_0xec05('0x36')]:_0xf80245[_0xec05('0x32')];if(_0x3c2134[_0xec05('0x34')][_0xec05('0x42')]){_0x1ec25f[_0xec05('0x43')]=[{'all':!![]}];}_0x1ec25f=_['merge']({},_0x1ec25f,_0x3c2134[_0xec05('0x41')]);return db[_0xec05('0x2d')][_0xec05('0x48')](_0x1ec25f)[_0xec05('0x26')](handleEntityNotFound(_0x47156b,null))[_0xec05('0x26')](respondWithResult(_0x47156b,null))['catch'](handleError(_0x47156b,null));};exports[_0xec05('0x49')]=function(_0x57d665,_0x586b16){return db[_0xec05('0x2d')][_0xec05('0x49')](_0x57d665[_0xec05('0x4a')],{})[_0xec05('0x26')](respondWithResult(_0x586b16,0xc9))[_0xec05('0x4b')](handleError(_0x586b16,null));};exports[_0xec05('0x4c')]=function(_0x3f5db0,_0x8da94d){return db[_0xec05('0x2d')]['describe']()[_0xec05('0x26')](respondWithResult(_0x8da94d,null))[_0xec05('0x4b')](handleError(_0x8da94d,null));};exports[_0xec05('0x25')]=function(_0x4029b6,_0x28adaf){if(_0x4029b6[_0xec05('0x4a')][_0xec05('0x4d')]){delete _0x4029b6[_0xec05('0x4a')][_0xec05('0x4d')];}return db[_0xec05('0x2d')][_0xec05('0x48')]({'where':{'uniqueid':_0x4029b6['params']['id']}})[_0xec05('0x26')](handleEntityNotFound(_0x28adaf,null))[_0xec05('0x26')](saveUpdates(_0x4029b6['body'],null))[_0xec05('0x26')](respondWithResult(_0x28adaf,null))[_0xec05('0x4b')](handleError(_0x28adaf,null));}; \ No newline at end of file +var _0x1993=['nolimit','order','sort','where','pick','merge','type','options','CmHopperHistory','include','findAll','rows','catch','show','params','length','includeAll','find','create','describe','update','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x44ca30,_0x5a6720){var _0x5483a0=function(_0x436c0e){while(--_0x436c0e){_0x44ca30['push'](_0x44ca30['shift']());}};_0x5483a0(++_0x5a6720);}(_0x1993,0xb3));var _0x3199=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1993[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x3199('0x0'));var rimraf=require(_0x3199('0x1'));var zipdir=require(_0x3199('0x2'));var jsonpatch=require(_0x3199('0x3'));var rp=require(_0x3199('0x4'));var moment=require(_0x3199('0x5'));var BPromise=require(_0x3199('0x6'));var Mustache=require('mustache');var util=require(_0x3199('0x7'));var path=require(_0x3199('0x8'));var sox=require(_0x3199('0x9'));var csv=require(_0x3199('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3199('0xb'));var _=require('lodash');var squel=require(_0x3199('0xc'));var crypto=require(_0x3199('0xd'));var jsforce=require(_0x3199('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3199('0xa'));var querystring=require(_0x3199('0xf'));var Papa=require(_0x3199('0x10'));var Redis=require(_0x3199('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3199('0x12'));var as=require(_0x3199('0x13'));var hardwareService=require(_0x3199('0x14'));var logger=require(_0x3199('0x15'))(_0x3199('0x16'));var utils=require(_0x3199('0x17'));var config=require(_0x3199('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3199('0x19'))['db'];function respondWithStatusCode(_0x137e5e,_0x14c084){_0x14c084=_0x14c084||0xcc;return function(_0x1ed284){if(_0x1ed284){return _0x137e5e[_0x3199('0x1a')](_0x14c084);}return _0x137e5e[_0x3199('0x1b')](_0x14c084)[_0x3199('0x1c')]();};}function respondWithResult(_0x27c7df,_0x4b3a71){_0x4b3a71=_0x4b3a71||0xc8;return function(_0x2a45eb){if(_0x2a45eb){return _0x27c7df['status'](_0x4b3a71)['json'](_0x2a45eb);}};}function respondWithFilteredResult(_0x3490df,_0x1bed26){return function(_0x47a34e){if(_0x47a34e){var _0x41e6ad=typeof _0x1bed26[_0x3199('0x1d')]===_0x3199('0x1e')&&typeof _0x1bed26[_0x3199('0x1f')]===_0x3199('0x1e');var _0x1f6ad6=_0x47a34e[_0x3199('0x20')];var _0x46ef14=_0x41e6ad?0x0:_0x1bed26['offset'];var _0x2b1f5c=_0x41e6ad?_0x47a34e[_0x3199('0x20')]:_0x1bed26[_0x3199('0x1d')]+_0x1bed26['limit'];var _0x445d51;if(_0x2b1f5c>=_0x1f6ad6){_0x2b1f5c=_0x1f6ad6;_0x445d51=0xc8;}else{_0x445d51=0xce;}_0x3490df[_0x3199('0x1b')](_0x445d51);return _0x3490df[_0x3199('0x21')](_0x3199('0x22'),_0x46ef14+'-'+_0x2b1f5c+'/'+_0x1f6ad6)[_0x3199('0x23')](_0x47a34e);}return null;};}function patchUpdates(_0x5a0e8f){return function(_0x4f715b){try{jsonpatch[_0x3199('0x24')](_0x4f715b,_0x5a0e8f,!![]);}catch(_0x240cf2){return BPromise[_0x3199('0x25')](_0x240cf2);}return _0x4f715b[_0x3199('0x26')]();};}function saveUpdates(_0x54fdf6,_0x64cd34){return function(_0x348fc6){if(_0x348fc6){return _0x348fc6['update'](_0x54fdf6)[_0x3199('0x27')](function(_0x403bdb){return _0x403bdb;});}return null;};}function removeEntity(_0x5abc96,_0x160c09){return function(_0x40e6e2){if(_0x40e6e2){return _0x40e6e2[_0x3199('0x28')]()['then'](function(){_0x5abc96[_0x3199('0x1b')](0xcc)[_0x3199('0x1c')]();});}};}function handleEntityNotFound(_0x12f07b,_0x535871){return function(_0x61ddbb){if(!_0x61ddbb){_0x12f07b[_0x3199('0x1a')](0x194);}return _0x61ddbb;};}function handleError(_0x30a496,_0x403a0c){_0x403a0c=_0x403a0c||0x1f4;return function(_0x358669){logger[_0x3199('0x29')](_0x358669[_0x3199('0x2a')]);if(_0x358669['name']){delete _0x358669[_0x3199('0x2b')];}_0x30a496[_0x3199('0x1b')](_0x403a0c)['send'](_0x358669);};}exports['index']=function(_0x837846,_0x22b336){var _0x11962e={},_0x4fd594={},_0x102976={'count':0x0,'rows':[]};var _0x23199d=_[_0x3199('0x2c')](db['CmHopperHistory'][_0x3199('0x2d')],function(_0x2cda2b){return{'name':_0x2cda2b[_0x3199('0x2e')],'type':_0x2cda2b['type'][_0x3199('0x2f')]};});_0x4fd594[_0x3199('0x30')]=_['map'](_0x23199d,_0x3199('0x2b'));_0x4fd594[_0x3199('0x31')]=_[_0x3199('0x32')](_0x837846['query']);_0x4fd594[_0x3199('0x33')]=_[_0x3199('0x34')](_0x4fd594[_0x3199('0x30')],_0x4fd594[_0x3199('0x31')]);_0x11962e[_0x3199('0x35')]=_['intersection'](_0x4fd594[_0x3199('0x30')],qs[_0x3199('0x36')](_0x837846[_0x3199('0x31')][_0x3199('0x36')]));_0x11962e['attributes']=_0x11962e[_0x3199('0x35')]['length']?_0x11962e[_0x3199('0x35')]:_0x4fd594[_0x3199('0x30')];if(!_0x837846[_0x3199('0x31')]['hasOwnProperty'](_0x3199('0x37'))){_0x11962e['limit']=qs[_0x3199('0x1f')](_0x837846[_0x3199('0x31')]['limit']);_0x11962e['offset']=qs['offset'](_0x837846[_0x3199('0x31')][_0x3199('0x1d')]);}_0x11962e[_0x3199('0x38')]=qs['sort'](_0x837846[_0x3199('0x31')][_0x3199('0x39')]);_0x11962e[_0x3199('0x3a')]=qs[_0x3199('0x33')](_[_0x3199('0x3b')](_0x837846[_0x3199('0x31')],_0x4fd594[_0x3199('0x33')]),_0x23199d);if(_0x837846[_0x3199('0x31')]['filter']){_0x11962e['where']=_[_0x3199('0x3c')](_0x11962e[_0x3199('0x3a')],{'$or':_[_0x3199('0x2c')](_0x23199d,function(_0x13cbb1){if(_0x13cbb1[_0x3199('0x3d')]!=='VIRTUAL'){var _0x125508={};_0x125508[_0x13cbb1[_0x3199('0x2b')]]={'$like':'%'+_0x837846[_0x3199('0x31')]['filter']+'%'};return _0x125508;}})});}_0x11962e=_[_0x3199('0x3c')]({},_0x11962e,_0x837846[_0x3199('0x3e')]);var _0x17e742={'where':_0x11962e[_0x3199('0x3a')]};return db[_0x3199('0x3f')]['count'](_0x17e742)[_0x3199('0x27')](function(_0x6ded54){_0x102976[_0x3199('0x20')]=_0x6ded54;if(_0x837846[_0x3199('0x31')]['includeAll']){_0x11962e[_0x3199('0x40')]=[{'all':!![]}];}return db[_0x3199('0x3f')][_0x3199('0x41')](_0x11962e);})['then'](function(_0x40debc){_0x102976[_0x3199('0x42')]=_0x40debc;return _0x102976;})['then'](respondWithFilteredResult(_0x22b336,_0x11962e))[_0x3199('0x43')](handleError(_0x22b336,null));};exports[_0x3199('0x44')]=function(_0x1e18ba,_0x19f629){var _0x41e587={'raw':!![],'where':{'id':_0x1e18ba[_0x3199('0x45')]['id']}},_0x42d6c6={};_0x42d6c6['model']=_[_0x3199('0x32')](db[_0x3199('0x3f')][_0x3199('0x2d')]);_0x42d6c6[_0x3199('0x31')]=_[_0x3199('0x32')](_0x1e18ba['query']);_0x42d6c6[_0x3199('0x33')]=_[_0x3199('0x34')](_0x42d6c6['model'],_0x42d6c6[_0x3199('0x31')]);_0x41e587[_0x3199('0x35')]=_['intersection'](_0x42d6c6[_0x3199('0x30')],qs[_0x3199('0x36')](_0x1e18ba['query'][_0x3199('0x36')]));_0x41e587[_0x3199('0x35')]=_0x41e587[_0x3199('0x35')][_0x3199('0x46')]?_0x41e587[_0x3199('0x35')]:_0x42d6c6[_0x3199('0x30')];if(_0x1e18ba[_0x3199('0x31')][_0x3199('0x47')]){_0x41e587[_0x3199('0x40')]=[{'all':!![]}];}_0x41e587=_['merge']({},_0x41e587,_0x1e18ba['options']);return db['CmHopperHistory'][_0x3199('0x48')](_0x41e587)['then'](handleEntityNotFound(_0x19f629,null))[_0x3199('0x27')](respondWithResult(_0x19f629,null))[_0x3199('0x43')](handleError(_0x19f629,null));};exports[_0x3199('0x49')]=function(_0x313545,_0x29bf8b){return db[_0x3199('0x3f')][_0x3199('0x49')](_0x313545['body'],{})[_0x3199('0x27')](respondWithResult(_0x29bf8b,0xc9))[_0x3199('0x43')](handleError(_0x29bf8b,null));};exports[_0x3199('0x4a')]=function(_0x5bfcdb,_0x160549){return db[_0x3199('0x3f')][_0x3199('0x4a')]()[_0x3199('0x27')](respondWithResult(_0x160549,null))[_0x3199('0x43')](handleError(_0x160549,null));};exports[_0x3199('0x4b')]=function(_0x1ea2c6,_0x34bf33){if(_0x1ea2c6[_0x3199('0x4c')][_0x3199('0x4d')]){delete _0x1ea2c6['body'][_0x3199('0x4d')];}return db[_0x3199('0x3f')][_0x3199('0x48')]({'where':{'uniqueid':_0x1ea2c6[_0x3199('0x45')]['id']}})[_0x3199('0x27')](handleEntityNotFound(_0x34bf33,null))[_0x3199('0x27')](saveUpdates(_0x1ea2c6[_0x3199('0x4c')],null))[_0x3199('0x27')](respondWithResult(_0x34bf33,null))[_0x3199('0x43')](handleError(_0x34bf33,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b4f0731..f5295b6 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 _0x0b00=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x5cdc79,_0x24beb1){var _0x22ddcf=function(_0x1f92bf){while(--_0x1f92bf){_0x5cdc79['push'](_0x5cdc79['shift']());}};_0x22ddcf(++_0x24beb1);}(_0x0b00,0x1a4));var _0x00b0=function(_0x5b62ae,_0x2ad7ea){_0x5b62ae=_0x5b62ae-0x0;var _0x56db8f=_0x0b00[_0x5b62ae];return _0x56db8f;};'use strict';var _=require(_0x00b0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x00b0('0x1'));var moment=require(_0x00b0('0x2'));var BPromise=require('bluebird');var rp=require(_0x00b0('0x3'));var fs=require('fs');var path=require(_0x00b0('0x4'));var rimraf=require(_0x00b0('0x5'));var config=require(_0x00b0('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x15547d,_0x49842a){return _0x15547d[_0x00b0('0x7')](_0x00b0('0x8'),attributes,{'tableName':_0x00b0('0x9'),'paranoid':![],'indexes':[{'name':_0x00b0('0xa'),'fields':[_0x00b0('0xa')]},{'name':_0x00b0('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3bb=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x385c7c,_0x24f293){var _0x3aed6b=function(_0x284cd3){while(--_0x284cd3){_0x385c7c['push'](_0x385c7c['shift']());}};_0x3aed6b(++_0x24f293);}(_0xd3bb,0xba));var _0xbd3b=function(_0xf3d1ea,_0x373574){_0xf3d1ea=_0xf3d1ea-0x0;var _0x3a90c3=_0xd3bb[_0xf3d1ea];return _0x3a90c3;};'use strict';var _=require('lodash');var util=require(_0xbd3b('0x0'));var logger=require('../../config/logger')(_0xbd3b('0x1'));var moment=require(_0xbd3b('0x2'));var BPromise=require(_0xbd3b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd3b('0x4'));var rimraf=require(_0xbd3b('0x5'));var config=require(_0xbd3b('0x6'));var attributes=require(_0xbd3b('0x7'));module[_0xbd3b('0x8')]=function(_0x5d104f,_0x113e25){return _0x5d104f[_0xbd3b('0x9')](_0xbd3b('0xa'),attributes,{'tableName':_0xbd3b('0xb'),'paranoid':![],'indexes':[{'name':_0xbd3b('0xc'),'fields':[_0xbd3b('0xc')]},{'name':_0xbd3b('0xd'),'fields':[_0xbd3b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 563f823..522101c 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 _0x33d7=['`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay'];(function(_0x57a536,_0x2daac9){var _0x1758c4=function(_0x381257){while(--_0x381257){_0x57a536['push'](_0x57a536['shift']());}};_0x1758c4(++_0x2daac9);}(_0x33d7,0x117));var _0x733d=function(_0x4031f8,_0x27dbcf){_0x4031f8=_0x4031f8-0x0;var _0x262189=_0x33d7[_0x4031f8];return _0x262189;};'use strict';var _=require('lodash');var util=require(_0x733d('0x0'));var moment=require(_0x733d('0x1'));var BPromise=require(_0x733d('0x2'));var rs=require(_0x733d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x733d('0x4'))(_0x733d('0x5'));var config=require(_0x733d('0x6'));var jayson=require(_0x733d('0x7'));var client=jayson['client'][_0x733d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42560b,_0x43d5d1,_0x55faec){return new BPromise(function(_0x1c48ee,_0x74af68){return client[_0x733d('0x9')](_0x42560b,_0x55faec)[_0x733d('0xa')](function(_0x183d09){logger[_0x733d('0xb')](_0x733d('0xc'),_0x43d5d1,_0x733d('0xd'));logger[_0x733d('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x43d5d1,'request\x20sent',JSON[_0x733d('0xf')](_0x183d09));if(_0x183d09[_0x733d('0x10')]){if(_0x183d09[_0x733d('0x10')][_0x733d('0x11')]===0x1f4){logger['error'](_0x733d('0xc'),_0x43d5d1,_0x183d09[_0x733d('0x10')][_0x733d('0x12')]);return _0x74af68(_0x183d09[_0x733d('0x10')][_0x733d('0x12')]);}logger[_0x733d('0x10')](_0x733d('0xc'),_0x43d5d1,_0x183d09['error'][_0x733d('0x12')]);return _0x1c48ee(_0x183d09[_0x733d('0x10')][_0x733d('0x12')]);}else{logger[_0x733d('0xb')](_0x733d('0xc'),_0x43d5d1,'request\x20sent');_0x1c48ee(_0x183d09[_0x733d('0x13')][_0x733d('0x12')]);}})[_0x733d('0x14')](function(_0x5dfa76){logger['error'](_0x733d('0xc'),_0x43d5d1,_0x5dfa76);_0x74af68(_0x5dfa76);});});}exports[_0x733d('0x15')]=function(_0x27caad){var _0x301feb=this;return new Promise(function(_0xea35b8,_0x589f9d){return db[_0x733d('0x16')][_0x733d('0x17')](_0x27caad[_0x733d('0x18')],{'raw':_0x27caad[_0x733d('0x19')]?_0x27caad[_0x733d('0x19')][_0x733d('0x1a')]===undefined?!![]:![]:!![]})[_0x733d('0xa')](function(_0x38034f){logger[_0x733d('0xb')](_0x733d('0x15'),_0x27caad);logger[_0x733d('0xe')](_0x733d('0x15'),_0x27caad,JSON[_0x733d('0xf')](_0x38034f));_0xea35b8(_0x38034f);})['catch'](function(_0x8072ff){logger[_0x733d('0x10')]('CreateCmHopperHistory',_0x8072ff[_0x733d('0x12')],_0x27caad);_0x589f9d(_0x301feb[_0x733d('0x10')](0x1f4,_0x8072ff['message']));});});};exports[_0x733d('0x1b')]=function(_0x1b9881){var _0xd8cfa3=this;return new Promise(function(_0x30d452,_0x41cbac){return db[_0x733d('0x16')][_0x733d('0x1c')]({'raw':_0x1b9881[_0x733d('0x19')]?_0x1b9881[_0x733d('0x19')][_0x733d('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b9881[_0x733d('0x19')]?_0x1b9881[_0x733d('0x19')]['where']||null:null,'attributes':[[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db['sequelize'][_0x733d('0x1f')]('id')),_0x733d('0x20')],[db[_0x733d('0x1d')]['fn']('COUNT',db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x22')))),_0x733d('0x23')],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')]['literal'](_0x733d('0x24')))),_0x733d('0x25')],[db[_0x733d('0x1d')]['fn'](_0x733d('0x26'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x733d('0x1d')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize'][_0x733d('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x733d('0xa')](function(_0x60dfbd){logger[_0x733d('0xb')](_0x733d('0x1b'),_0x1b9881);logger[_0x733d('0xe')](_0x733d('0x1b'),_0x1b9881,JSON['stringify'](_0x60dfbd));_0x30d452(_0x60dfbd);})[_0x733d('0x14')](function(_0x56d259){logger[_0x733d('0x10')](_0x733d('0x1b'),_0x56d259[_0x733d('0x12')],_0x1b9881);_0x41cbac(_0xd8cfa3[_0x733d('0x10')](0x1f4,_0x56d259[_0x733d('0x12')]));});});};exports[_0x733d('0x28')]=function(_0x547449){var _0x326729=this;return new Promise(function(_0x3f471a,_0x2400ab){return db[_0x733d('0x16')][_0x733d('0x1c')]({'raw':_0x547449[_0x733d('0x19')]?_0x547449[_0x733d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x547449[_0x733d('0x19')]?_0x547449['options'][_0x733d('0x29')]||null:null,'attributes':[[_0x733d('0x2a'),_0x733d('0x2b')],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x2c')))),_0x733d('0x2d')],[db[_0x733d('0x1d')]['fn']('COUNT',db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x2e')))),_0x733d('0x2f')],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db['sequelize'][_0x733d('0x21')](_0x733d('0x30')))),_0x733d('0x31')],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x733d('0x1d')]['fn']('COUNT',db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x32')))),'outboundDropCallsDayTimeout'],[db[_0x733d('0x1d')]['fn']('COUNT',db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x33')))),_0x733d('0x34')],[db['sequelize']['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x35')))),_0x733d('0x36')],[db['sequelize']['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x37')))),'outboundBlacklistCallsDay'],[db[_0x733d('0x1d')]['fn']('COUNT',db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db['sequelize'][_0x733d('0x21')](_0x733d('0x38')))),_0x733d('0x39')],[db[_0x733d('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x733d('0x3a')],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x3b')))),_0x733d('0x39')],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')](_0x733d('0x3c')))),_0x733d('0x3d')]],'group':['campaign']})[_0x733d('0xa')](function(_0x419a79){logger[_0x733d('0xb')](_0x733d('0x28'),_0x547449);logger[_0x733d('0xe')](_0x733d('0x28'),_0x547449,JSON[_0x733d('0xf')](_0x419a79));_0x3f471a(_0x419a79);})[_0x733d('0x14')](function(_0x43d4c2){logger[_0x733d('0x10')](_0x733d('0x28'),_0x43d4c2[_0x733d('0x12')],_0x547449);_0x2400ab(_0x326729['error'](0x1f4,_0x43d4c2[_0x733d('0x12')]));});});};exports[_0x733d('0x3e')]=function(_0x7da578){var _0x1d4b61=this;return new Promise(function(_0x457e65,_0x53a540){return db[_0x733d('0x16')][_0x733d('0x1c')]({'raw':_0x7da578[_0x733d('0x19')]?_0x7da578[_0x733d('0x19')][_0x733d('0x1a')]===undefined?!![]:![]:!![],'where':_0x7da578[_0x733d('0x19')]?_0x7da578['options'][_0x733d('0x29')]||null:null,'attributes':[[_0x733d('0x2a'),'name'],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')][_0x733d('0x1f')]('id')),_0x733d('0x3f')],[db[_0x733d('0x1d')]['fn'](_0x733d('0x1e'),db[_0x733d('0x1d')]['fn']('IF',db[_0x733d('0x1d')][_0x733d('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x733d('0x40')]],'group':[_0x733d('0x2a')]})[_0x733d('0xa')](function(_0x33d6c5){logger[_0x733d('0xb')](_0x733d('0x3e'),_0x7da578);logger['debug'](_0x733d('0x3e'),_0x7da578,JSON[_0x733d('0xf')](_0x33d6c5));_0x457e65(_0x33d6c5);})[_0x733d('0x14')](function(_0x4e8ed3){logger[_0x733d('0x10')](_0x733d('0x3e'),_0x4e8ed3[_0x733d('0x12')],_0x7da578);_0x53a540(_0x1d4b61[_0x733d('0x10')](0x1f4,_0x4e8ed3[_0x733d('0x12')]));});});}; \ No newline at end of file +var _0x3afd=['raw','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','info','GetVoiceQueueHopperHistory','CmHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','create','body','options','debug','AvgHandleTime','findAll'];(function(_0x10920f,_0x1e89e0){var _0x8edae2=function(_0x31e5a2){while(--_0x31e5a2){_0x10920f['push'](_0x10920f['shift']());}};_0x8edae2(++_0x1e89e0);}(_0x3afd,0x1ab));var _0xd3af=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0x3afd[_0x101802];return _0x5d61ce;};'use strict';var _=require(_0xd3af('0x0'));var util=require(_0xd3af('0x1'));var moment=require(_0xd3af('0x2'));var BPromise=require(_0xd3af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3af('0x5'));var logger=require(_0xd3af('0x6'))(_0xd3af('0x7'));var config=require(_0xd3af('0x8'));var jayson=require(_0xd3af('0x9'));var client=jayson[_0xd3af('0xa')][_0xd3af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21d878,_0x4174d0,_0x30cd5c){return new BPromise(function(_0x35b70a,_0xbbe486){return client['request'](_0x21d878,_0x30cd5c)[_0xd3af('0xc')](function(_0xda5ed0){logger['info'](_0xd3af('0xd'),_0x4174d0,_0xd3af('0xe'));logger['debug'](_0xd3af('0xf'),_0x4174d0,_0xd3af('0xe'),JSON[_0xd3af('0x10')](_0xda5ed0));if(_0xda5ed0['error']){if(_0xda5ed0[_0xd3af('0x11')][_0xd3af('0x12')]===0x1f4){logger['error'](_0xd3af('0xd'),_0x4174d0,_0xda5ed0[_0xd3af('0x11')][_0xd3af('0x13')]);return _0xbbe486(_0xda5ed0['error'][_0xd3af('0x13')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4174d0,_0xda5ed0[_0xd3af('0x11')][_0xd3af('0x13')]);return _0x35b70a(_0xda5ed0[_0xd3af('0x11')][_0xd3af('0x13')]);}else{logger['info'](_0xd3af('0xd'),_0x4174d0,_0xd3af('0xe'));_0x35b70a(_0xda5ed0[_0xd3af('0x14')]['message']);}})[_0xd3af('0x15')](function(_0xd3bea5){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4174d0,_0xd3bea5);_0xbbe486(_0xd3bea5);});});}exports[_0xd3af('0x16')]=function(_0x7b722b){var _0x24b260=this;return new Promise(function(_0x16db63,_0x404031){return db['CmHopperHistory'][_0xd3af('0x17')](_0x7b722b[_0xd3af('0x18')],{'raw':_0x7b722b[_0xd3af('0x19')]?_0x7b722b[_0xd3af('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4d3d46){logger['info'](_0xd3af('0x16'),_0x7b722b);logger[_0xd3af('0x1a')](_0xd3af('0x16'),_0x7b722b,JSON[_0xd3af('0x10')](_0x4d3d46));_0x16db63(_0x4d3d46);})[_0xd3af('0x15')](function(_0x5c9949){logger[_0xd3af('0x11')]('CreateCmHopperHistory',_0x5c9949[_0xd3af('0x13')],_0x7b722b);_0x404031(_0x24b260['error'](0x1f4,_0x5c9949[_0xd3af('0x13')]));});});};exports[_0xd3af('0x1b')]=function(_0x2ad4cc){var _0x5c82dd=this;return new Promise(function(_0x28732f,_0x35721a){return db['CmHopperHistory'][_0xd3af('0x1c')]({'raw':_0x2ad4cc[_0xd3af('0x19')]?_0x2ad4cc['options'][_0xd3af('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ad4cc[_0xd3af('0x19')]?_0x2ad4cc[_0xd3af('0x19')]['where']||null:null,'attributes':[[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')][_0xd3af('0x20')]('id')),_0xd3af('0x21')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x23')))),_0xd3af('0x24')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x25')))),_0xd3af('0x26')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db['sequelize']['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x27')))),_0xd3af('0x28')],[db['sequelize']['fn'](_0xd3af('0x29'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')]['literal'](_0xd3af('0x2a')))),_0xd3af('0x2b')],[db['sequelize']['fn'](_0xd3af('0x29'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')]['literal'](_0xd3af('0x2c')))),_0xd3af('0x2d')]]})[_0xd3af('0xc')](function(_0x46e3df){logger[_0xd3af('0x2e')](_0xd3af('0x1b'),_0x2ad4cc);logger[_0xd3af('0x1a')](_0xd3af('0x1b'),_0x2ad4cc,JSON[_0xd3af('0x10')](_0x46e3df));_0x28732f(_0x46e3df);})[_0xd3af('0x15')](function(_0x2070c2){logger['error'](_0xd3af('0x1b'),_0x2070c2[_0xd3af('0x13')],_0x2ad4cc);_0x35721a(_0x5c82dd[_0xd3af('0x11')](0x1f4,_0x2070c2[_0xd3af('0x13')]));});});};exports[_0xd3af('0x2f')]=function(_0x2df30a){var _0x1e58cf=this;return new Promise(function(_0x480856,_0x4c0055){return db[_0xd3af('0x30')][_0xd3af('0x1c')]({'raw':_0x2df30a[_0xd3af('0x19')]?_0x2df30a[_0xd3af('0x19')][_0xd3af('0x1d')]===undefined?!![]:![]:!![],'where':_0x2df30a['options']?_0x2df30a[_0xd3af('0x19')][_0xd3af('0x31')]||null:null,'attributes':[[_0xd3af('0x32'),_0xd3af('0x33')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')]['literal'](_0xd3af('0x34')))),_0xd3af('0x35')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db['sequelize']['fn']('IF',db[_0xd3af('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xd3af('0x1f'),db['sequelize']['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x23')))),_0xd3af('0x36')],[db['sequelize']['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x37')))),_0xd3af('0x38')],[db['sequelize']['fn'](_0xd3af('0x1f'),db['sequelize']['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x39')))),'outboundCongestionCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x3a')))),_0xd3af('0x3b')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x3c')))),_0xd3af('0x3d')],[db['sequelize']['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')]['literal'](_0xd3af('0x3e')))),_0xd3af('0x3f')],[db[_0xd3af('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xd3af('0x22')](_0xd3af('0x40')))),_0xd3af('0x41')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')]['literal'](_0xd3af('0x42')))),_0xd3af('0x43')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db[_0xd3af('0x1e')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0xd3af('0x44')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db['sequelize']['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x45')))),'outboundAnswerAgiCallsDay'],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')]['fn']('IF',db['sequelize'][_0xd3af('0x22')](_0xd3af('0x46')))),'outboundRejectCallsDay'],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db['sequelize']['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')](_0xd3af('0x47')))),_0xd3af('0x48')]],'group':['campaign']})[_0xd3af('0xc')](function(_0x9d6ba){logger[_0xd3af('0x2e')](_0xd3af('0x2f'),_0x2df30a);logger['debug']('GetVoiceQueueHopperHistory',_0x2df30a,JSON[_0xd3af('0x10')](_0x9d6ba));_0x480856(_0x9d6ba);})['catch'](function(_0x2ce6e1){logger['error'](_0xd3af('0x2f'),_0x2ce6e1[_0xd3af('0x13')],_0x2df30a);_0x4c0055(_0x1e58cf[_0xd3af('0x11')](0x1f4,_0x2ce6e1['message']));});});};exports[_0xd3af('0x49')]=function(_0x1ff434){var _0xb896d3=this;return new Promise(function(_0x268444,_0x30f34f){return db[_0xd3af('0x30')][_0xd3af('0x1c')]({'raw':_0x1ff434[_0xd3af('0x19')]?_0x1ff434[_0xd3af('0x19')][_0xd3af('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ff434[_0xd3af('0x19')]?_0x1ff434['options'][_0xd3af('0x31')]||null:null,'attributes':[[_0xd3af('0x32'),'name'],[db['sequelize']['fn'](_0xd3af('0x1f'),db[_0xd3af('0x1e')][_0xd3af('0x20')]('id')),_0xd3af('0x4a')],[db[_0xd3af('0x1e')]['fn'](_0xd3af('0x1f'),db['sequelize']['fn']('IF',db[_0xd3af('0x1e')][_0xd3af('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xd3af('0x4b')]],'group':[_0xd3af('0x32')]})[_0xd3af('0xc')](function(_0x57f598){logger['info']('GetCampaignHopperHistory',_0x1ff434);logger[_0xd3af('0x1a')](_0xd3af('0x49'),_0x1ff434,JSON[_0xd3af('0x10')](_0x57f598));_0x268444(_0x57f598);})[_0xd3af('0x15')](function(_0xbfef04){logger[_0xd3af('0x11')](_0xd3af('0x49'),_0xbfef04[_0xd3af('0x13')],_0x1ff434);_0x30f34f(_0xb896d3[_0xd3af('0x11')](0x1f4,_0xbfef04[_0xd3af('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0cb2682..9fbd483 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 _0x1165=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express'];(function(_0x16c0b1,_0x58962f){var _0x43a670=function(_0x38ff63){while(--_0x38ff63){_0x16c0b1['push'](_0x16c0b1['shift']());}};_0x43a670(++_0x58962f);}(_0x1165,0xab));var _0x5116=function(_0x435d3a,_0x206efd){_0x435d3a=_0x435d3a-0x0;var _0x5a53ef=_0x1165[_0x435d3a];return _0x5a53ef;};'use strict';var multer=require(_0x5116('0x0'));var util=require(_0x5116('0x1'));var path=require(_0x5116('0x2'));var timeout=require(_0x5116('0x3'));var express=require(_0x5116('0x4'));var router=express[_0x5116('0x5')]();var fs_extra=require(_0x5116('0x6'));var auth=require(_0x5116('0x7'));var interaction=require(_0x5116('0x8'));var config=require(_0x5116('0x9'));var controller=require(_0x5116('0xa'));router[_0x5116('0xb')]('/',auth[_0x5116('0xc')](),controller[_0x5116('0xd')]);router[_0x5116('0xb')](_0x5116('0xe'),auth[_0x5116('0xc')](),controller[_0x5116('0xf')]);router[_0x5116('0xb')](_0x5116('0x10'),auth[_0x5116('0xc')](),controller[_0x5116('0x11')]);router[_0x5116('0x12')]('/',auth[_0x5116('0xc')](),controller[_0x5116('0x13')]);router[_0x5116('0x14')](_0x5116('0x10'),auth['isAuthenticated'](),controller['update']);module[_0x5116('0x15')]=router; \ No newline at end of file +var _0x2b89=['index','/describe','describe','show','post','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x3b55e6,_0x16ee6b){var _0x4e25a8=function(_0x5d2ac1){while(--_0x5d2ac1){_0x3b55e6['push'](_0x3b55e6['shift']());}};_0x4e25a8(++_0x16ee6b);}(_0x2b89,0x7e));var _0x92b8=function(_0x21d4c8,_0x1b19ce){_0x21d4c8=_0x21d4c8-0x0;var _0x4cd71d=_0x2b89[_0x21d4c8];return _0x4cd71d;};'use strict';var multer=require(_0x92b8('0x0'));var util=require('util');var path=require(_0x92b8('0x1'));var timeout=require(_0x92b8('0x2'));var express=require(_0x92b8('0x3'));var router=express[_0x92b8('0x4')]();var fs_extra=require(_0x92b8('0x5'));var auth=require(_0x92b8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92b8('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x92b8('0x8')]('/',auth[_0x92b8('0x9')](),controller[_0x92b8('0xa')]);router[_0x92b8('0x8')](_0x92b8('0xb'),auth[_0x92b8('0x9')](),controller[_0x92b8('0xc')]);router[_0x92b8('0x8')]('/:id',auth[_0x92b8('0x9')](),controller[_0x92b8('0xd')]);router[_0x92b8('0xe')]('/',auth[_0x92b8('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x92b8('0xf')]);module[_0x92b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1926406..7261d64 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 _0xf440=['exports','STRING','name'];(function(_0x3a3377,_0x16d56f){var _0x2cd17e=function(_0x58409d){while(--_0x58409d){_0x3a3377['push'](_0x3a3377['shift']());}};_0x2cd17e(++_0x16d56f);}(_0xf440,0x174));var _0x0f44=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf440[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x0f44('0x0')]={'name':{'type':Sequelize[_0x0f44('0x1')],'unique':_0x0f44('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0f44('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c33=['name','sequelize','exports','STRING'];(function(_0x35f5cd,_0x1ff69f){var _0x5eee6d=function(_0x404b3e){while(--_0x404b3e){_0x35f5cd['push'](_0x35f5cd['shift']());}};_0x5eee6d(++_0x1ff69f);}(_0x9c33,0x149));var _0x39c3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x9c33[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x39c3('0x0'));module[_0x39c3('0x1')]={'name':{'type':Sequelize[_0x39c3('0x2')],'unique':_0x39c3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x39c3('0x2')]},'dialPrefix':{'type':Sequelize[_0x39c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 90ffd9e..99e18cc 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 _0x5286=['INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','eml-format','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','CmList','includeAll','include','findAll','rows','catch','params','find','create','body','user','Lists','UserProfileSection','autoAssociation','describe','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number'];(function(_0x40bfa1,_0x524a77){var _0x1e0515=function(_0x2379e8){while(--_0x2379e8){_0x40bfa1['push'](_0x40bfa1['shift']());}};_0x1e0515(++_0x524a77);}(_0x5286,0x123));var _0x6528=function(_0x4b935a,_0x327ee3){_0x4b935a=_0x4b935a-0x0;var _0xa298f0=_0x5286[_0x4b935a];return _0xa298f0;};'use strict';var emlformat=require(_0x6528('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6528('0x1'));var rp=require('request-promise');var moment=require(_0x6528('0x2'));var BPromise=require(_0x6528('0x3'));var Mustache=require('mustache');var util=require(_0x6528('0x4'));var path=require(_0x6528('0x5'));var sox=require('sox');var csv=require(_0x6528('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6528('0x7'));var _=require(_0x6528('0x8'));var squel=require(_0x6528('0x9'));var crypto=require(_0x6528('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6528('0xb'));var toCsv=require(_0x6528('0x6'));var querystring=require(_0x6528('0xc'));var Papa=require(_0x6528('0xd'));var Redis=require(_0x6528('0xe'));var authService=require(_0x6528('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6528('0x10'));var hardwareService=require(_0x6528('0x11'));var logger=require(_0x6528('0x12'))(_0x6528('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6528('0x14'));var db=require(_0x6528('0x15'))['db'];config[_0x6528('0x16')]=_[_0x6528('0x17')](config[_0x6528('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x6528('0x18'))(new Redis(config[_0x6528('0x16')]));require(_0x6528('0x19'))[_0x6528('0x1a')](socket);function respondWithStatusCode(_0x4f9dbe,_0x4e888e){_0x4e888e=_0x4e888e||0xcc;return function(_0x4d4a1e){if(_0x4d4a1e){return _0x4f9dbe[_0x6528('0x1b')](_0x4e888e);}return _0x4f9dbe[_0x6528('0x1c')](_0x4e888e)[_0x6528('0x1d')]();};}function respondWithResult(_0x3707af,_0x58fd2d){_0x58fd2d=_0x58fd2d||0xc8;return function(_0x32492f){if(_0x32492f){return _0x3707af['status'](_0x58fd2d)[_0x6528('0x1e')](_0x32492f);}};}function respondWithFilteredResult(_0x2d4a1d,_0x5a0325){return function(_0x2790d1){if(_0x2790d1){var _0x156680=typeof _0x5a0325[_0x6528('0x1f')]==='undefined'&&typeof _0x5a0325[_0x6528('0x20')]===_0x6528('0x21');var _0x473107=_0x2790d1[_0x6528('0x22')];var _0x1d2e2f=_0x156680?0x0:_0x5a0325[_0x6528('0x1f')];var _0x501b4d=_0x156680?_0x2790d1['count']:_0x5a0325[_0x6528('0x1f')]+_0x5a0325[_0x6528('0x20')];var _0x5978cc;if(_0x501b4d>=_0x473107){_0x501b4d=_0x473107;_0x5978cc=0xc8;}else{_0x5978cc=0xce;}_0x2d4a1d[_0x6528('0x1c')](_0x5978cc);return _0x2d4a1d[_0x6528('0x23')](_0x6528('0x24'),_0x1d2e2f+'-'+_0x501b4d+'/'+_0x473107)['json'](_0x2790d1);}return null;};}function patchUpdates(_0xeab291){return function(_0x2becda){try{jsonpatch[_0x6528('0x25')](_0x2becda,_0xeab291,!![]);}catch(_0xbf961f){return BPromise[_0x6528('0x26')](_0xbf961f);}return _0x2becda[_0x6528('0x27')]();};}function saveUpdates(_0x2b5c43,_0x288f8e){return function(_0x36bdcd){if(_0x36bdcd){return _0x36bdcd[_0x6528('0x28')](_0x2b5c43)[_0x6528('0x29')](function(_0x447e73){return _0x447e73;});}return null;};}function removeEntity(_0x4002b3,_0x364d64){return function(_0x1f7afc){if(_0x1f7afc){return _0x1f7afc[_0x6528('0x2a')]()[_0x6528('0x29')](function(){var _0x58014c=_0x1f7afc[_0x6528('0x2b')]({'plain':!![]});var _0x31d5f5='Lists';return db[_0x6528('0x2c')]['destroy']({'where':{'type':_0x31d5f5,'resourceId':_0x58014c['id']}})[_0x6528('0x29')](function(){return _0x1f7afc;});})['then'](function(){_0x4002b3[_0x6528('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1040b2,_0x2cbcba){return function(_0x1d5fcd){if(!_0x1d5fcd){_0x1040b2[_0x6528('0x1b')](0x194);}return _0x1d5fcd;};}function handleError(_0x14a1aa,_0x2bf76b){_0x2bf76b=_0x2bf76b||0x1f4;return function(_0x97550f){logger[_0x6528('0x2d')](_0x97550f[_0x6528('0x2e')]);if(_0x97550f['name']){delete _0x97550f['name'];}_0x14a1aa[_0x6528('0x1c')](_0x2bf76b)[_0x6528('0x2f')](_0x97550f);};}exports[_0x6528('0x30')]=function(_0x1cee6e,_0x1cb43a){var _0x45d855={},_0xa20506={},_0x38078d={'count':0x0,'rows':[]};var _0x5b3b4a=_[_0x6528('0x31')](db['CmList'][_0x6528('0x32')],function(_0x4b585f){return{'name':_0x4b585f[_0x6528('0x33')],'type':_0x4b585f[_0x6528('0x34')][_0x6528('0x35')]};});_0xa20506[_0x6528('0x36')]=_[_0x6528('0x31')](_0x5b3b4a,'name');_0xa20506['query']=_[_0x6528('0x37')](_0x1cee6e['query']);_0xa20506[_0x6528('0x38')]=_[_0x6528('0x39')](_0xa20506['model'],_0xa20506[_0x6528('0x3a')]);_0x45d855[_0x6528('0x3b')]=_[_0x6528('0x39')](_0xa20506['model'],qs[_0x6528('0x3c')](_0x1cee6e[_0x6528('0x3a')][_0x6528('0x3c')]));_0x45d855[_0x6528('0x3b')]=_0x45d855[_0x6528('0x3b')][_0x6528('0x3d')]?_0x45d855['attributes']:_0xa20506[_0x6528('0x36')];if(!_0x1cee6e[_0x6528('0x3a')]['hasOwnProperty'](_0x6528('0x3e'))){_0x45d855['limit']=qs[_0x6528('0x20')](_0x1cee6e[_0x6528('0x3a')][_0x6528('0x20')]);_0x45d855[_0x6528('0x1f')]=qs[_0x6528('0x1f')](_0x1cee6e[_0x6528('0x3a')][_0x6528('0x1f')]);}_0x45d855[_0x6528('0x3f')]=qs[_0x6528('0x40')](_0x1cee6e[_0x6528('0x3a')][_0x6528('0x40')]);_0x45d855[_0x6528('0x41')]=qs[_0x6528('0x38')](_[_0x6528('0x42')](_0x1cee6e[_0x6528('0x3a')],_0xa20506[_0x6528('0x38')]),_0x5b3b4a);if(_0x1cee6e[_0x6528('0x3a')][_0x6528('0x43')]){_0x45d855[_0x6528('0x41')]=_['merge'](_0x45d855['where'],{'$or':_[_0x6528('0x31')](_0x5b3b4a,function(_0x37c7fb){if(_0x37c7fb[_0x6528('0x34')]!==_0x6528('0x44')){var _0x2341d8={};_0x2341d8[_0x37c7fb[_0x6528('0x45')]]={'$like':'%'+_0x1cee6e[_0x6528('0x3a')][_0x6528('0x43')]+'%'};return _0x2341d8;}})});}_0x45d855=_[_0x6528('0x46')]({},_0x45d855,_0x1cee6e[_0x6528('0x47')]);var _0x457480={'where':_0x45d855[_0x6528('0x41')]};return db[_0x6528('0x48')]['count'](_0x457480)['then'](function(_0x30809c){_0x38078d['count']=_0x30809c;if(_0x1cee6e['query'][_0x6528('0x49')]){_0x45d855[_0x6528('0x4a')]=[{'all':!![]}];}return db[_0x6528('0x48')][_0x6528('0x4b')](_0x45d855);})[_0x6528('0x29')](function(_0x2949fc){_0x38078d[_0x6528('0x4c')]=_0x2949fc;return _0x38078d;})[_0x6528('0x29')](respondWithFilteredResult(_0x1cb43a,_0x45d855))[_0x6528('0x4d')](handleError(_0x1cb43a,null));};exports['show']=function(_0x2fbab4,_0x1f9fd5){var _0x4f6c73={'raw':![],'where':{'id':_0x2fbab4[_0x6528('0x4e')]['id']}},_0x452c70={};_0x452c70['model']=_[_0x6528('0x37')](db['CmList'][_0x6528('0x32')]);_0x452c70[_0x6528('0x3a')]=_[_0x6528('0x37')](_0x2fbab4[_0x6528('0x3a')]);_0x452c70[_0x6528('0x38')]=_['intersection'](_0x452c70[_0x6528('0x36')],_0x452c70[_0x6528('0x3a')]);_0x4f6c73['attributes']=_['intersection'](_0x452c70[_0x6528('0x36')],qs[_0x6528('0x3c')](_0x2fbab4[_0x6528('0x3a')]['fields']));_0x4f6c73['attributes']=_0x4f6c73[_0x6528('0x3b')][_0x6528('0x3d')]?_0x4f6c73[_0x6528('0x3b')]:_0x452c70['model'];if(_0x2fbab4[_0x6528('0x3a')][_0x6528('0x49')]){_0x4f6c73[_0x6528('0x4a')]=[{'all':!![]}];}_0x4f6c73=_[_0x6528('0x46')]({},_0x4f6c73,_0x2fbab4[_0x6528('0x47')]);return db[_0x6528('0x48')][_0x6528('0x4f')](_0x4f6c73)[_0x6528('0x29')](handleEntityNotFound(_0x1f9fd5,null))[_0x6528('0x29')](respondWithResult(_0x1f9fd5,null))[_0x6528('0x4d')](handleError(_0x1f9fd5,null));};exports['create']=function(_0x34ba57,_0x5b1cf8){return db[_0x6528('0x48')][_0x6528('0x50')](_0x34ba57[_0x6528('0x51')],{})[_0x6528('0x29')](function(_0x5784e6){var _0x47bdd8=_0x34ba57[_0x6528('0x52')][_0x6528('0x2b')]({'plain':!![]});if(!_0x47bdd8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47bdd8['role']===_0x6528('0x52')){var _0x4a8bd3=_0x5784e6[_0x6528('0x2b')]({'plain':!![]});var _0x287131=_0x6528('0x53');return db[_0x6528('0x54')]['find']({'where':{'name':_0x287131,'userProfileId':_0x47bdd8['userProfileId']},'raw':!![]})[_0x6528('0x29')](function(_0x485073){if(_0x485073&&_0x485073[_0x6528('0x55')]===0x0){return db[_0x6528('0x2c')][_0x6528('0x50')]({'name':_0x4a8bd3[_0x6528('0x45')],'resourceId':_0x4a8bd3['id'],'type':_0x485073[_0x6528('0x45')],'sectionId':_0x485073['id']},{})[_0x6528('0x29')](function(){return _0x5784e6;});}else{return _0x5784e6;}})['catch'](function(_0x25b4bd){logger[_0x6528('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25b4bd);throw _0x25b4bd;});}return _0x5784e6;})[_0x6528('0x29')](respondWithResult(_0x5b1cf8,0xc9))[_0x6528('0x4d')](handleError(_0x5b1cf8,null));};exports['update']=function(_0x46ab85,_0x2b3ac6){if(_0x46ab85[_0x6528('0x51')]['id']){delete _0x46ab85['body']['id'];}return db['CmList'][_0x6528('0x4f')]({'where':{'id':_0x46ab85[_0x6528('0x4e')]['id']}})[_0x6528('0x29')](handleEntityNotFound(_0x2b3ac6,null))['then'](saveUpdates(_0x46ab85[_0x6528('0x51')],null))[_0x6528('0x29')](respondWithResult(_0x2b3ac6,null))[_0x6528('0x4d')](handleError(_0x2b3ac6,null));};exports[_0x6528('0x2a')]=function(_0x4cd491,_0x32082e){return db[_0x6528('0x48')][_0x6528('0x4f')]({'where':{'id':_0x4cd491[_0x6528('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32082e,null))[_0x6528('0x29')](removeEntity(_0x32082e,null))['catch'](handleError(_0x32082e,null));};exports['describe']=function(_0x3d4f72,_0x9363ec){return db[_0x6528('0x48')][_0x6528('0x56')]()['then'](respondWithResult(_0x9363ec,null))[_0x6528('0x4d')](handleError(_0x9363ec,null));};exports['addDisposition']=function(_0xfaddb5,_0x3d5e1c,_0x5df40c){if(_0xfaddb5[_0x6528('0x51')]['id']){delete _0xfaddb5['body']['id'];}return db[_0x6528('0x48')]['find']({'where':{'id':_0xfaddb5[_0x6528('0x4e')]['id']}})[_0x6528('0x29')](handleEntityNotFound(_0x3d5e1c,null))[_0x6528('0x29')](function(_0x225790){if(_0x225790){_0xfaddb5['body']['ListId']=_0x225790['id'];return db[_0x6528('0x57')][_0x6528('0x50')](_0xfaddb5[_0x6528('0x51')]);}})['then'](respondWithResult(_0x3d5e1c,null))[_0x6528('0x4d')](handleError(_0x3d5e1c,null));};exports[_0x6528('0x58')]=function(_0x59378d,_0x51c6b6,_0x4d1dbc){var _0xe53d02={'raw':![],'where':{}};var _0x2240b7={};var _0x13ed3d={'count':0x0,'rows':[]};return db[_0x6528('0x48')]['findOne']({'where':{'id':_0x59378d[_0x6528('0x4e')]['id']}})[_0x6528('0x29')](handleEntityNotFound(_0x51c6b6,null))[_0x6528('0x29')](function(_0x4c14de){if(_0x4c14de){_0x2240b7[_0x6528('0x36')]=_['keys'](db[_0x6528('0x57')][_0x6528('0x32')]);_0x2240b7['query']=_[_0x6528('0x37')](_0x59378d[_0x6528('0x3a')]);_0x2240b7[_0x6528('0x38')]=_[_0x6528('0x39')](_0x2240b7[_0x6528('0x36')],_0x2240b7[_0x6528('0x3a')]);_0xe53d02[_0x6528('0x3b')]=_[_0x6528('0x39')](_0x2240b7[_0x6528('0x36')],qs[_0x6528('0x3c')](_0x59378d[_0x6528('0x3a')]['fields']));_0xe53d02['attributes']=_0xe53d02[_0x6528('0x3b')][_0x6528('0x3d')]?_0xe53d02[_0x6528('0x3b')]:_0x2240b7[_0x6528('0x36')];if(!_0x59378d[_0x6528('0x3a')][_0x6528('0x59')](_0x6528('0x3e'))){_0xe53d02['limit']=qs[_0x6528('0x20')](_0x59378d[_0x6528('0x3a')]['limit']);_0xe53d02['offset']=qs[_0x6528('0x1f')](_0x59378d[_0x6528('0x3a')][_0x6528('0x1f')]);}_0xe53d02['order']=qs[_0x6528('0x40')](_0x59378d[_0x6528('0x3a')][_0x6528('0x40')]);_0xe53d02['where']=qs['filters'](_[_0x6528('0x42')](_0x59378d[_0x6528('0x3a')],_0x2240b7[_0x6528('0x38')]));_0xe53d02[_0x6528('0x41')]['ListId']=_0x4c14de['id'];if(_0x59378d['query'][_0x6528('0x43')]){_0xe53d02[_0x6528('0x41')]=_['merge'](_0xe53d02[_0x6528('0x41')],{'$or':_[_0x6528('0x31')](_0xe53d02[_0x6528('0x3b')],function(_0x3da059){var _0x3517c1={};_0x3517c1[_0x3da059]={'$like':'%'+_0x59378d[_0x6528('0x3a')][_0x6528('0x43')]+'%'};return _0x3517c1;})});}_0xe53d02=_[_0x6528('0x46')]({},_0xe53d02,_0x59378d[_0x6528('0x47')]);return db[_0x6528('0x57')][_0x6528('0x22')]({'where':_0xe53d02['where']})[_0x6528('0x29')](function(_0xfc538b){_0x13ed3d['count']=_0xfc538b;if(_0x59378d['query'][_0x6528('0x49')]){_0xe53d02[_0x6528('0x4a')]=[{'all':!![]}];}return db[_0x6528('0x57')][_0x6528('0x4b')](_0xe53d02);})[_0x6528('0x29')](function(_0x1f9255){_0x13ed3d['rows']=_0x1f9255;return _0x13ed3d;});}})[_0x6528('0x29')](respondWithFilteredResult(_0x51c6b6,_0xe53d02))[_0x6528('0x4d')](handleError(_0x51c6b6,null));};exports[_0x6528('0x5a')]=function(_0x24bed9,_0xd808ee,_0x34a89d){return db['CmList'][_0x6528('0x4f')]({'where':{'id':_0x24bed9['params']['id']}})[_0x6528('0x29')](handleEntityNotFound(_0xd808ee,null))[_0x6528('0x29')](function(_0x398dab){if(_0x398dab){return _0x398dab[_0x6528('0x5a')](_0x24bed9[_0x6528('0x3a')][_0x6528('0x5b')]);}})[_0x6528('0x29')](respondWithStatusCode(_0xd808ee,null))[_0x6528('0x4d')](handleError(_0xd808ee,null));};exports[_0x6528('0x5c')]=function(_0x24e226,_0x3a0f8b,_0x52d2e1){return db[_0x6528('0x48')][_0x6528('0x4f')]({'where':{'id':_0x24e226[_0x6528('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a0f8b,null))[_0x6528('0x29')](function(_0x4062e8){if(_0x4062e8){var _0x5208eb=[];var _0x28993c={'success':[],'errors':[]};return db[_0x6528('0x5d')][_0x6528('0x56')]()['then'](function(_0x234c7d){if(_0x24e226[_0x6528('0x51')][_0x6528('0x5e')]&&_[_0x6528('0x5f')](_0x24e226[_0x6528('0x51')][_0x6528('0x5e')])){if(_0x24e226[_0x6528('0x51')]['tags'][_0x6528('0x3d')]){_0x24e226[_0x6528('0x51')][_0x6528('0x5e')]=_0x24e226['body'][_0x6528('0x5e')][_0x6528('0x60')](';')+';';}else{_0x24e226['body'][_0x6528('0x5e')]=null;}}else{_0x24e226['body'][_0x6528('0x5e')]=null;}if(_0x24e226['body']&&_['isArray'](_0x24e226[_0x6528('0x51')])){for(var _0x3ec789=0x0;_0x3ec789<_0x24e226[_0x6528('0x51')][_0x6528('0x3d')];_0x3ec789+=0x1){_0x24e226[_0x6528('0x51')][_0x3ec789]['ListId']=_0x24e226[_0x6528('0x4e')]['id'];_0x5208eb[_0x6528('0x61')](_0x24e226['body'][_0x3ec789]);}return BPromise[_0x6528('0x62')](_0x5208eb,function(_0xd17a78){return db[_0x6528('0x5d')]['create'](_[_0x6528('0x63')](_0xd17a78,[_0x6528('0x5b'),'id'])||{},{'fields':_[_0x6528('0x37')](_0x234c7d),'raw':!![]})[_0x6528('0x29')](function(_0x223d06){_0x28993c[_0x6528('0x64')]['push'](_0x223d06['dataValues']);})[_0x6528('0x4d')](function(_0x3f7e4f){_0x28993c['errors'][_0x6528('0x61')]({'data':_0xd17a78,'error':_0x3f7e4f['message']});});})['then'](function(_0x58b6c7){return _0x28993c;})[_0x6528('0x4d')](function(_0x588cfe){return _0x588cfe;});}else{_0x3a0f8b[_0x6528('0x1c')](0x190)[_0x6528('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x6528('0x29')](respondWithResult(_0x3a0f8b,null))[_0x6528('0x4d')](handleError(_0x3a0f8b,null));};exports[_0x6528('0x65')]=function(_0x11b4e0,_0x47642b,_0x3448c3){var _0x17d483;return db[_0x6528('0x48')][_0x6528('0x4f')]({'where':{'id':_0x11b4e0[_0x6528('0x4e')]['id']},'include':[{'model':db[_0x6528('0x66')],'as':_0x6528('0x67')}]})['then'](handleEntityNotFound(_0x47642b,null))[_0x6528('0x29')](function(_0x292548){if(_0x292548){_0x17d483=_0x292548;return db[_0x6528('0x5d')][_0x6528('0x32')];}})[_0x6528('0x29')](function(_0x51b653){if(_0x51b653){var _0x41893a={};var _0x5aeb52={};_0x5aeb52[_0x6528('0x36')]=_[_0x6528('0x68')](_[_0x6528('0x37')](_0x51b653),_[_0x6528('0x31')](_0x17d483[_0x6528('0x67')],function(_0x4e3529){return util[_0x6528('0x69')](_0x6528('0x6a'),_0x4e3529['id']);}));_0x5aeb52['query']=_[_0x6528('0x37')](_0x11b4e0[_0x6528('0x3a')]);_0x5aeb52[_0x6528('0x38')]=_[_0x6528('0x39')](_0x5aeb52[_0x6528('0x36')],_0x5aeb52[_0x6528('0x3a')]);_0x41893a[_0x6528('0x3b')]=_['intersection'](_0x5aeb52[_0x6528('0x36')],qs['fields'](_0x11b4e0[_0x6528('0x3a')][_0x6528('0x3c')]));_0x41893a[_0x6528('0x3b')]=_0x41893a[_0x6528('0x3b')][_0x6528('0x3d')]?_0x41893a[_0x6528('0x3b')]:_0x5aeb52[_0x6528('0x36')];if(!_0x11b4e0[_0x6528('0x3a')][_0x6528('0x59')](_0x6528('0x3e'))){_0x41893a['limit']=qs[_0x6528('0x20')](_0x11b4e0['query'][_0x6528('0x20')]);_0x41893a['offset']=qs[_0x6528('0x1f')](_0x11b4e0[_0x6528('0x3a')][_0x6528('0x1f')]);}_0x41893a[_0x6528('0x3f')]=qs[_0x6528('0x40')](_0x11b4e0[_0x6528('0x3a')][_0x6528('0x40')]);_0x41893a[_0x6528('0x41')]=qs['filters'](_[_0x6528('0x42')](_0x11b4e0['query'],_0x5aeb52[_0x6528('0x38')]));_0x41893a['raw']=!![];if(_0x11b4e0[_0x6528('0x3a')][_0x6528('0x43')]){_0x41893a['where']=_[_0x6528('0x46')](_0x41893a[_0x6528('0x41')],{'$or':_[_0x6528('0x31')](_0x41893a[_0x6528('0x3b')],function(_0x40e13e){var _0x515b83={};_0x515b83[_0x40e13e]={'$like':'%'+_0x11b4e0[_0x6528('0x3a')][_0x6528('0x43')]+'%'};return _0x515b83;})});}_0x41893a=_['merge']({},_0x41893a,_0x11b4e0[_0x6528('0x47')]);return _0x17d483['getContacts'](_0x41893a);}})[_0x6528('0x29')](respondWithResult(_0x47642b,null))[_0x6528('0x4d')](handleError(_0x47642b,null));};exports['getContactsCsv']=function(_0x524640,_0x444971,_0x4c122d){var _0x3dae57;return db[_0x6528('0x48')]['find']({'where':{'id':_0x524640[_0x6528('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x6528('0x67')}]})[_0x6528('0x29')](handleEntityNotFound(_0x444971,null))[_0x6528('0x29')](function(_0x1b2955){if(_0x1b2955){_0x3dae57=_0x1b2955;return db[_0x6528('0x5d')]['rawAttributes'];}})[_0x6528('0x29')](function(_0x430824){if(_0x430824){var _0x4897cd={};var _0x351e0e={};_0x351e0e[_0x6528('0x36')]=_[_0x6528('0x68')](_[_0x6528('0x37')](_0x430824),_['map'](_0x3dae57[_0x6528('0x67')],function(_0x3e8222){return util[_0x6528('0x69')](_0x6528('0x6a'),_0x3e8222['id']);}));_0x351e0e[_0x6528('0x3a')]=_[_0x6528('0x37')](_0x524640[_0x6528('0x3a')]);_0x351e0e[_0x6528('0x38')]=_[_0x6528('0x39')](_0x351e0e['model'],_0x351e0e[_0x6528('0x3a')]);_0x4897cd[_0x6528('0x3b')]=_[_0x6528('0x39')](_0x351e0e['model'],qs['fields'](_0x524640[_0x6528('0x3a')][_0x6528('0x3c')]));_0x4897cd[_0x6528('0x3b')]=_0x4897cd['attributes'][_0x6528('0x3d')]?_0x4897cd[_0x6528('0x3b')]:_0x351e0e[_0x6528('0x36')];if(!_0x524640[_0x6528('0x3a')][_0x6528('0x59')]('nolimit')){_0x4897cd[_0x6528('0x20')]=qs['limit'](_0x524640[_0x6528('0x3a')][_0x6528('0x20')]);_0x4897cd[_0x6528('0x1f')]=qs[_0x6528('0x1f')](_0x524640[_0x6528('0x3a')][_0x6528('0x1f')]);}_0x4897cd[_0x6528('0x3f')]=qs[_0x6528('0x40')](_0x524640[_0x6528('0x3a')]['sort']);_0x4897cd[_0x6528('0x41')]=qs[_0x6528('0x38')](_[_0x6528('0x42')](_0x524640[_0x6528('0x3a')],_0x351e0e[_0x6528('0x38')]));_0x4897cd[_0x6528('0x6b')]=!![];if(_0x524640[_0x6528('0x3a')]['filter']){_0x4897cd[_0x6528('0x41')]=_['merge'](_0x4897cd['where'],{'$or':_[_0x6528('0x31')](_0x4897cd[_0x6528('0x3b')],function(_0x481553){var _0x5581b6={};_0x5581b6[_0x481553]={'$like':'%'+_0x524640[_0x6528('0x3a')][_0x6528('0x43')]+'%'};return _0x5581b6;})});}_0x4897cd=_[_0x6528('0x46')]({},_0x4897cd,_0x524640[_0x6528('0x47')]);return _0x3dae57[_0x6528('0x65')](_0x4897cd);}})[_0x6528('0x29')](function(_0x578afc){if(!_[_0x6528('0x6c')](_0x578afc)){var _0x3055c8=toCsv(_0x578afc);var _0x36ab86=Date[_0x6528('0x6d')]();fs[_0x6528('0x6e')](util[_0x6528('0x69')](_0x6528('0x6f'),_0x3dae57['id'],_0x36ab86),_0x3055c8);_0x444971['setHeader'](_0x6528('0x70'),_0x6528('0x71')+util[_0x6528('0x69')](_0x6528('0x72'),_0x3dae57['id'],_0x36ab86));_0x444971['setHeader'](_0x6528('0x73'),_0x6528('0x74'));return _0x444971['download'](util[_0x6528('0x69')]('/tmp/list_%d_%s.csv',_0x3dae57['id'],_0x36ab86));}else{return _0x444971[_0x6528('0x1b')](0xcc);}})['catch'](handleError(_0x444971,null));};exports[_0x6528('0x75')]=function(_0x4f5bbe,_0x58c759,_0x46fb44){var _0x257770;delete _0x4f5bbe[_0x6528('0x51')]['id'];return db[_0x6528('0x48')][_0x6528('0x76')]({'where':{'id':_0x4f5bbe['params']['id']}})[_0x6528('0x29')](handleEntityNotFound(_0x58c759,null))[_0x6528('0x29')](function(_0x3abf07){if(_0x3abf07){return db[_0x6528('0x77')][_0x6528('0x78')](function(_0x4a02d0){return db[_0x6528('0x66')][_0x6528('0x50')](_0x4f5bbe[_0x6528('0x51')],{'transaction':_0x4a02d0})[_0x6528('0x29')](function(_0x2dff7a){_0x257770=_0x2dff7a;return _0x3abf07[_0x6528('0x79')](_0x2dff7a,{'transaction':_0x4a02d0});})[_0x6528('0x29')](function(){var _0x4a37fa={'type':db[_0x6528('0x7a')][_0x6528('0x7b')],'transaction':_0x4a02d0};switch(_0x4f5bbe[_0x6528('0x51')][_0x6528('0x34')]){case _0x6528('0x7c'):_0x4a37fa[_0x6528('0x34')]=db['Sequelize'][_0x6528('0x7b')];break;case _0x6528('0x7d'):_0x4a37fa[_0x6528('0x34')]=db[_0x6528('0x7a')][_0x6528('0x7e')];break;case _0x6528('0x7f'):_0x4a37fa['type']=db[_0x6528('0x7a')][_0x6528('0x80')];_0x4a37fa[_0x6528('0x81')]=![];break;default:}return db['sequelize']['queryInterface'][_0x6528('0x82')]('cm_contacts',util[_0x6528('0x69')](_0x6528('0x83'),_0x257770['id']),_0x4a37fa);})[_0x6528('0x29')](function(){return _0x257770;});});}})[_0x6528('0x29')](respondWithResult(_0x58c759,null))[_0x6528('0x4d')](handleError(_0x58c759,null));};exports['getCustomFields']=function(_0x5bf989,_0x3ee6a4,_0x365dd0){var _0x1af560={};var _0x3fc6a7={};var _0x2edd58;var _0x516c36;return db['CmList'][_0x6528('0x76')]({'where':{'id':_0x5bf989[_0x6528('0x4e')]['id']}})[_0x6528('0x29')](handleEntityNotFound(_0x3ee6a4,null))['then'](function(_0x797aec){if(_0x797aec){_0x2edd58=_0x797aec;_0x3fc6a7['model']=_['keys'](db['CmCustomField'][_0x6528('0x32')]);_0x3fc6a7[_0x6528('0x3a')]=_[_0x6528('0x37')](_0x5bf989[_0x6528('0x3a')]);_0x3fc6a7[_0x6528('0x38')]=_[_0x6528('0x39')](_0x3fc6a7['model'],_0x3fc6a7[_0x6528('0x3a')]);_0x1af560[_0x6528('0x3b')]=_[_0x6528('0x39')](_0x3fc6a7['model'],qs[_0x6528('0x3c')](_0x5bf989['query']['fields']));_0x1af560[_0x6528('0x3b')]=_0x1af560[_0x6528('0x3b')][_0x6528('0x3d')]?_0x1af560[_0x6528('0x3b')]:_0x3fc6a7[_0x6528('0x36')];_0x1af560[_0x6528('0x3f')]=qs[_0x6528('0x40')](_0x5bf989[_0x6528('0x3a')]['sort']);_0x1af560[_0x6528('0x41')]=qs[_0x6528('0x38')](_['pick'](_0x5bf989[_0x6528('0x3a')],_0x3fc6a7['filters']));_0x1af560[_0x6528('0x41')]=_['merge'](_0x1af560[_0x6528('0x41')],{'$or':[{'ListId':_0x797aec['id']},{'ListId':null}]});if(_0x5bf989[_0x6528('0x3a')][_0x6528('0x43')]){_0x1af560['where']=_[_0x6528('0x46')](_0x1af560[_0x6528('0x41')],{'$or':_[_0x6528('0x31')](_0x1af560[_0x6528('0x3b')],function(_0x1dc465){var _0x4cd382={};_0x4cd382[_0x1dc465]={'$like':'%'+_0x5bf989[_0x6528('0x3a')]['filter']+'%'};return _0x4cd382;})});}_0x1af560=_[_0x6528('0x46')]({},_0x1af560,_0x5bf989['options']);return db[_0x6528('0x66')][_0x6528('0x84')](_0x1af560);}})[_0x6528('0x29')](respondWithResult(_0x3ee6a4,null))[_0x6528('0x4d')](handleError(_0x3ee6a4,null));};exports[_0x6528('0x85')]=function(_0x4b3487,_0x57dbe6,_0x1a05ce){return db[_0x6528('0x48')][_0x6528('0x4f')]({'where':{'id':_0x4b3487['params']['id']}})[_0x6528('0x29')](handleEntityNotFound(_0x57dbe6,null))[_0x6528('0x29')](function(_0x5c340f){if(_0x5c340f){return _0x5c340f[_0x6528('0x85')](_0x4b3487[_0x6528('0x51')][_0x6528('0x5b')],_[_0x6528('0x63')](_0x4b3487['body'],['ids','id'])||{})[_0x6528('0x86')](function(_0x2db482){for(var _0x42f520=0x0;_0x42f520<_0x4b3487[_0x6528('0x51')][_0x6528('0x5b')][_0x6528('0x3d')];_0x42f520+=0x1){socket[_0x6528('0x87')](_0x6528('0x88'),{'UserId':_0x4b3487[_0x6528('0x51')][_0x6528('0x5b')][_0x42f520],'CmListId':_0x4b3487[_0x6528('0x4e')]['id']});}return _0x2db482;});}})[_0x6528('0x29')](respondWithResult(_0x57dbe6,null))[_0x6528('0x4d')](handleError(_0x57dbe6,null));};exports[_0x6528('0x89')]=function(_0x1e34df,_0x388158,_0x21d3aa){return db[_0x6528('0x48')]['find']({'where':{'id':_0x1e34df['params']['id']}})[_0x6528('0x29')](handleEntityNotFound(_0x388158,null))[_0x6528('0x29')](function(_0x343b42){if(_0x343b42){return _0x343b42[_0x6528('0x89')](_0x1e34df['query'][_0x6528('0x5b')])[_0x6528('0x29')](function(){if(_['isArray'](_0x1e34df[_0x6528('0x3a')][_0x6528('0x5b')])){for(var _0x4a8d92=0x0;_0x4a8d92<_0x1e34df[_0x6528('0x3a')][_0x6528('0x5b')][_0x6528('0x3d')];_0x4a8d92+=0x1){socket[_0x6528('0x87')](_0x6528('0x8a'),{'UserId':Number(_0x1e34df[_0x6528('0x3a')][_0x6528('0x5b')][_0x4a8d92]),'CmListId':Number(_0x1e34df[_0x6528('0x4e')]['id'])});}}else{socket[_0x6528('0x87')](_0x6528('0x8a'),{'UserId':Number(_0x1e34df[_0x6528('0x3a')][_0x6528('0x5b')]),'CmListId':Number(_0x1e34df['params']['id'])});}});}})[_0x6528('0x29')](respondWithStatusCode(_0x388158,null))[_0x6528('0x4d')](handleError(_0x388158,null));};exports['getAgents']=function(_0x1a06c2,_0xa74414,_0x22b7bd){var _0x496f1b={};var _0x3f7c98={};var _0x4976b9;var _0x9b7216;return db[_0x6528('0x48')][_0x6528('0x76')]({'where':{'id':_0x1a06c2[_0x6528('0x4e')]['id']}})[_0x6528('0x29')](handleEntityNotFound(_0xa74414,null))[_0x6528('0x29')](function(_0x34dced){if(_0x34dced){_0x4976b9=_0x34dced;_0x3f7c98['model']=_['keys'](db['User'][_0x6528('0x32')]);_0x3f7c98[_0x6528('0x3a')]=_[_0x6528('0x37')](_0x1a06c2[_0x6528('0x3a')]);_0x3f7c98[_0x6528('0x38')]=_[_0x6528('0x39')](_0x3f7c98[_0x6528('0x36')],_0x3f7c98[_0x6528('0x3a')]);_0x496f1b['attributes']=_[_0x6528('0x39')](_0x3f7c98[_0x6528('0x36')],qs[_0x6528('0x3c')](_0x1a06c2[_0x6528('0x3a')][_0x6528('0x3c')]));_0x496f1b['attributes']=_0x496f1b[_0x6528('0x3b')][_0x6528('0x3d')]?_0x496f1b[_0x6528('0x3b')]:_0x3f7c98[_0x6528('0x36')];_0x496f1b[_0x6528('0x3f')]=qs[_0x6528('0x40')](_0x1a06c2[_0x6528('0x3a')][_0x6528('0x40')]);_0x496f1b['where']=qs[_0x6528('0x38')](_['pick'](_0x1a06c2[_0x6528('0x3a')],_0x3f7c98[_0x6528('0x38')]));if(_0x1a06c2[_0x6528('0x3a')][_0x6528('0x43')]){_0x496f1b['where']=_['merge'](_0x496f1b[_0x6528('0x41')],{'$or':_[_0x6528('0x31')](_0x496f1b[_0x6528('0x3b')],function(_0x3a73a0){var _0x1bcf8b={};_0x1bcf8b[_0x3a73a0]={'$like':'%'+_0x1a06c2[_0x6528('0x3a')]['filter']+'%'};return _0x1bcf8b;})});}_0x496f1b=_[_0x6528('0x46')]({},_0x496f1b,_0x1a06c2[_0x6528('0x47')]);return _0x4976b9['getAgents'](_0x496f1b);}})['then'](function(_0x1785c7){if(_0x1785c7){_0x9b7216=_0x1785c7[_0x6528('0x3d')];if(!_0x1a06c2[_0x6528('0x3a')][_0x6528('0x59')]('nolimit')){_0x496f1b[_0x6528('0x20')]=qs[_0x6528('0x20')](_0x1a06c2['query'][_0x6528('0x20')]);_0x496f1b[_0x6528('0x1f')]=qs[_0x6528('0x1f')](_0x1a06c2[_0x6528('0x3a')]['offset']);}return _0x4976b9['getAgents'](_0x496f1b);}})['then'](function(_0x296327){if(_0x296327){return _0x296327?{'count':_0x9b7216,'rows':_0x296327}:null;}})[_0x6528('0x29')](respondWithResult(_0xa74414,null))['catch'](handleError(_0xa74414,null));}; \ No newline at end of file +var _0x82d1=['VIRTUAL','options','CmList','includeAll','include','findAll','rows','catch','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','isArray','tags','length','join','push','each','CmContact','omit','success','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','getContactsCsv','concat','raw','isEmpty','now','Content-disposition','attachment;\x20filename=','setHeader','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','status','end','json','offset','count','limit','set','Content-Range','reject','update','then','destroy','Lists','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x5d8665,_0x38e7fb){var _0xbd253e=function(_0x1e8dcc){while(--_0x1e8dcc){_0x5d8665['push'](_0x5d8665['shift']());}};_0xbd253e(++_0x38e7fb);}(_0x82d1,0x16a));var _0x182d=function(_0x18d426,_0x36b0ef){_0x18d426=_0x18d426-0x0;var _0x22e5db=_0x82d1[_0x18d426];return _0x22e5db;};'use strict';var emlformat=require(_0x182d('0x0'));var rimraf=require(_0x182d('0x1'));var zipdir=require(_0x182d('0x2'));var jsonpatch=require(_0x182d('0x3'));var rp=require('request-promise');var moment=require(_0x182d('0x4'));var BPromise=require(_0x182d('0x5'));var Mustache=require(_0x182d('0x6'));var util=require('util');var path=require(_0x182d('0x7'));var sox=require(_0x182d('0x8'));var csv=require(_0x182d('0x9'));var ejs=require(_0x182d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x182d('0xb'));var squel=require(_0x182d('0xc'));var crypto=require(_0x182d('0xd'));var jsforce=require(_0x182d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x182d('0xf'));var authService=require(_0x182d('0x10'));var qs=require(_0x182d('0x11'));var as=require(_0x182d('0x12'));var hardwareService=require(_0x182d('0x13'));var logger=require(_0x182d('0x14'))(_0x182d('0x15'));var utils=require(_0x182d('0x16'));var config=require(_0x182d('0x17'));var licenseUtil=require(_0x182d('0x18'));var db=require(_0x182d('0x19'))['db'];config[_0x182d('0x1a')]=_['defaults'](config[_0x182d('0x1a')],{'host':_0x182d('0x1b'),'port':0x18eb});var socket=require(_0x182d('0x1c'))(new Redis(config[_0x182d('0x1a')]));require(_0x182d('0x1d'))['register'](socket);function respondWithStatusCode(_0x13d3f0,_0x1e4179){_0x1e4179=_0x1e4179||0xcc;return function(_0x2c333c){if(_0x2c333c){return _0x13d3f0['sendStatus'](_0x1e4179);}return _0x13d3f0[_0x182d('0x1e')](_0x1e4179)[_0x182d('0x1f')]();};}function respondWithResult(_0x25f22f,_0x362473){_0x362473=_0x362473||0xc8;return function(_0x3b25b3){if(_0x3b25b3){return _0x25f22f[_0x182d('0x1e')](_0x362473)[_0x182d('0x20')](_0x3b25b3);}};}function respondWithFilteredResult(_0x451ba8,_0x24b79c){return function(_0x4f62ca){if(_0x4f62ca){var _0x3434e7=typeof _0x24b79c[_0x182d('0x21')]==='undefined'&&typeof _0x24b79c['limit']==='undefined';var _0x5c4af3=_0x4f62ca['count'];var _0x251859=_0x3434e7?0x0:_0x24b79c[_0x182d('0x21')];var _0x4e1286=_0x3434e7?_0x4f62ca[_0x182d('0x22')]:_0x24b79c['offset']+_0x24b79c[_0x182d('0x23')];var _0xb9e5c5;if(_0x4e1286>=_0x5c4af3){_0x4e1286=_0x5c4af3;_0xb9e5c5=0xc8;}else{_0xb9e5c5=0xce;}_0x451ba8[_0x182d('0x1e')](_0xb9e5c5);return _0x451ba8[_0x182d('0x24')](_0x182d('0x25'),_0x251859+'-'+_0x4e1286+'/'+_0x5c4af3)[_0x182d('0x20')](_0x4f62ca);}return null;};}function patchUpdates(_0x3f0f23){return function(_0x4ecdf1){try{jsonpatch['apply'](_0x4ecdf1,_0x3f0f23,!![]);}catch(_0x257e4f){return BPromise[_0x182d('0x26')](_0x257e4f);}return _0x4ecdf1['save']();};}function saveUpdates(_0x430cdd,_0x516c56){return function(_0x3e0645){if(_0x3e0645){return _0x3e0645[_0x182d('0x27')](_0x430cdd)[_0x182d('0x28')](function(_0x2ce068){return _0x2ce068;});}return null;};}function removeEntity(_0x3e3b74,_0x28afd7){return function(_0x2961bb){if(_0x2961bb){return _0x2961bb[_0x182d('0x29')]()[_0x182d('0x28')](function(){var _0x1d43ed=_0x2961bb['get']({'plain':!![]});var _0x75f962=_0x182d('0x2a');return db[_0x182d('0x2b')]['destroy']({'where':{'type':_0x75f962,'resourceId':_0x1d43ed['id']}})[_0x182d('0x28')](function(){return _0x2961bb;});})[_0x182d('0x28')](function(){_0x3e3b74[_0x182d('0x1e')](0xcc)[_0x182d('0x1f')]();});}};}function handleEntityNotFound(_0x4f3a96,_0x5201c4){return function(_0x20595e){if(!_0x20595e){_0x4f3a96[_0x182d('0x2c')](0x194);}return _0x20595e;};}function handleError(_0x1b51a4,_0x949758){_0x949758=_0x949758||0x1f4;return function(_0x28dee1){logger[_0x182d('0x2d')](_0x28dee1[_0x182d('0x2e')]);if(_0x28dee1[_0x182d('0x2f')]){delete _0x28dee1['name'];}_0x1b51a4[_0x182d('0x1e')](_0x949758)['send'](_0x28dee1);};}exports['index']=function(_0x296244,_0x3f11f0){var _0x43925c={},_0xa6302b={},_0x3064e3={'count':0x0,'rows':[]};var _0x55e1dd=_[_0x182d('0x30')](db['CmList'][_0x182d('0x31')],function(_0x3ba7b5){return{'name':_0x3ba7b5[_0x182d('0x32')],'type':_0x3ba7b5[_0x182d('0x33')][_0x182d('0x34')]};});_0xa6302b[_0x182d('0x35')]=_[_0x182d('0x30')](_0x55e1dd,'name');_0xa6302b[_0x182d('0x36')]=_[_0x182d('0x37')](_0x296244[_0x182d('0x36')]);_0xa6302b[_0x182d('0x38')]=_[_0x182d('0x39')](_0xa6302b[_0x182d('0x35')],_0xa6302b[_0x182d('0x36')]);_0x43925c[_0x182d('0x3a')]=_[_0x182d('0x39')](_0xa6302b[_0x182d('0x35')],qs[_0x182d('0x3b')](_0x296244[_0x182d('0x36')][_0x182d('0x3b')]));_0x43925c['attributes']=_0x43925c['attributes']['length']?_0x43925c['attributes']:_0xa6302b['model'];if(!_0x296244[_0x182d('0x36')][_0x182d('0x3c')]('nolimit')){_0x43925c[_0x182d('0x23')]=qs[_0x182d('0x23')](_0x296244[_0x182d('0x36')][_0x182d('0x23')]);_0x43925c[_0x182d('0x21')]=qs[_0x182d('0x21')](_0x296244[_0x182d('0x36')][_0x182d('0x21')]);}_0x43925c[_0x182d('0x3d')]=qs['sort'](_0x296244[_0x182d('0x36')][_0x182d('0x3e')]);_0x43925c[_0x182d('0x3f')]=qs[_0x182d('0x38')](_[_0x182d('0x40')](_0x296244[_0x182d('0x36')],_0xa6302b[_0x182d('0x38')]),_0x55e1dd);if(_0x296244[_0x182d('0x36')][_0x182d('0x41')]){_0x43925c[_0x182d('0x3f')]=_[_0x182d('0x42')](_0x43925c[_0x182d('0x3f')],{'$or':_[_0x182d('0x30')](_0x55e1dd,function(_0x109efd){if(_0x109efd[_0x182d('0x33')]!==_0x182d('0x43')){var _0x33cccc={};_0x33cccc[_0x109efd[_0x182d('0x2f')]]={'$like':'%'+_0x296244[_0x182d('0x36')][_0x182d('0x41')]+'%'};return _0x33cccc;}})});}_0x43925c=_['merge']({},_0x43925c,_0x296244[_0x182d('0x44')]);var _0x2a40cf={'where':_0x43925c[_0x182d('0x3f')]};return db[_0x182d('0x45')]['count'](_0x2a40cf)[_0x182d('0x28')](function(_0x1c5079){_0x3064e3[_0x182d('0x22')]=_0x1c5079;if(_0x296244[_0x182d('0x36')][_0x182d('0x46')]){_0x43925c[_0x182d('0x47')]=[{'all':!![]}];}return db[_0x182d('0x45')][_0x182d('0x48')](_0x43925c);})[_0x182d('0x28')](function(_0xe605cb){_0x3064e3[_0x182d('0x49')]=_0xe605cb;return _0x3064e3;})[_0x182d('0x28')](respondWithFilteredResult(_0x3f11f0,_0x43925c))[_0x182d('0x4a')](handleError(_0x3f11f0,null));};exports['show']=function(_0x4c983c,_0x8afc28){var _0x2d90d6={'raw':![],'where':{'id':_0x4c983c[_0x182d('0x4b')]['id']}},_0x55fc98={};_0x55fc98['model']=_[_0x182d('0x37')](db[_0x182d('0x45')][_0x182d('0x31')]);_0x55fc98[_0x182d('0x36')]=_[_0x182d('0x37')](_0x4c983c[_0x182d('0x36')]);_0x55fc98['filters']=_[_0x182d('0x39')](_0x55fc98[_0x182d('0x35')],_0x55fc98[_0x182d('0x36')]);_0x2d90d6[_0x182d('0x3a')]=_['intersection'](_0x55fc98[_0x182d('0x35')],qs[_0x182d('0x3b')](_0x4c983c[_0x182d('0x36')]['fields']));_0x2d90d6[_0x182d('0x3a')]=_0x2d90d6['attributes']['length']?_0x2d90d6[_0x182d('0x3a')]:_0x55fc98['model'];if(_0x4c983c[_0x182d('0x36')][_0x182d('0x46')]){_0x2d90d6[_0x182d('0x47')]=[{'all':!![]}];}_0x2d90d6=_[_0x182d('0x42')]({},_0x2d90d6,_0x4c983c[_0x182d('0x44')]);return db['CmList']['find'](_0x2d90d6)['then'](handleEntityNotFound(_0x8afc28,null))[_0x182d('0x28')](respondWithResult(_0x8afc28,null))[_0x182d('0x4a')](handleError(_0x8afc28,null));};exports[_0x182d('0x4c')]=function(_0x36472d,_0x4903a7){return db['CmList'][_0x182d('0x4c')](_0x36472d[_0x182d('0x4d')],{})[_0x182d('0x28')](function(_0x47beed){var _0x167ce6=_0x36472d['user'][_0x182d('0x4e')]({'plain':!![]});if(!_0x167ce6)throw new Error(_0x182d('0x4f'));if(_0x167ce6[_0x182d('0x50')]===_0x182d('0x51')){var _0x2b504d=_0x47beed['get']({'plain':!![]});var _0x2ebb70=_0x182d('0x2a');return db[_0x182d('0x52')][_0x182d('0x53')]({'where':{'name':_0x2ebb70,'userProfileId':_0x167ce6[_0x182d('0x54')]},'raw':!![]})[_0x182d('0x28')](function(_0x4d35a3){if(_0x4d35a3&&_0x4d35a3[_0x182d('0x55')]===0x0){return db[_0x182d('0x2b')][_0x182d('0x4c')]({'name':_0x2b504d[_0x182d('0x2f')],'resourceId':_0x2b504d['id'],'type':_0x4d35a3[_0x182d('0x2f')],'sectionId':_0x4d35a3['id']},{})[_0x182d('0x28')](function(){return _0x47beed;});}else{return _0x47beed;}})[_0x182d('0x4a')](function(_0x4bed3d){logger['error'](_0x182d('0x56'),_0x4bed3d);throw _0x4bed3d;});}return _0x47beed;})['then'](respondWithResult(_0x4903a7,0xc9))[_0x182d('0x4a')](handleError(_0x4903a7,null));};exports['update']=function(_0x2d1b30,_0x3c3e1f){if(_0x2d1b30[_0x182d('0x4d')]['id']){delete _0x2d1b30['body']['id'];}return db[_0x182d('0x45')][_0x182d('0x53')]({'where':{'id':_0x2d1b30[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x3c3e1f,null))[_0x182d('0x28')](saveUpdates(_0x2d1b30[_0x182d('0x4d')],null))[_0x182d('0x28')](respondWithResult(_0x3c3e1f,null))[_0x182d('0x4a')](handleError(_0x3c3e1f,null));};exports['destroy']=function(_0x28b090,_0x419dce){return db[_0x182d('0x45')]['find']({'where':{'id':_0x28b090[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x419dce,null))[_0x182d('0x28')](removeEntity(_0x419dce,null))[_0x182d('0x4a')](handleError(_0x419dce,null));};exports['describe']=function(_0x59e7a8,_0x1874c9){return db[_0x182d('0x45')][_0x182d('0x57')]()[_0x182d('0x28')](respondWithResult(_0x1874c9,null))[_0x182d('0x4a')](handleError(_0x1874c9,null));};exports['addDisposition']=function(_0x3c0746,_0x3acbbc,_0x14179c){if(_0x3c0746[_0x182d('0x4d')]['id']){delete _0x3c0746[_0x182d('0x4d')]['id'];}return db[_0x182d('0x45')][_0x182d('0x53')]({'where':{'id':_0x3c0746[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x3acbbc,null))[_0x182d('0x28')](function(_0xb9aec4){if(_0xb9aec4){_0x3c0746[_0x182d('0x4d')][_0x182d('0x58')]=_0xb9aec4['id'];return db[_0x182d('0x59')][_0x182d('0x4c')](_0x3c0746[_0x182d('0x4d')]);}})[_0x182d('0x28')](respondWithResult(_0x3acbbc,null))['catch'](handleError(_0x3acbbc,null));};exports[_0x182d('0x5a')]=function(_0x118155,_0x40e90b,_0x1c2423){var _0x313363={'raw':![],'where':{}};var _0x270fb4={};var _0x226cd8={'count':0x0,'rows':[]};return db[_0x182d('0x45')][_0x182d('0x5b')]({'where':{'id':_0x118155[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x40e90b,null))[_0x182d('0x28')](function(_0x51c88b){if(_0x51c88b){_0x270fb4[_0x182d('0x35')]=_[_0x182d('0x37')](db['Disposition'][_0x182d('0x31')]);_0x270fb4[_0x182d('0x36')]=_[_0x182d('0x37')](_0x118155['query']);_0x270fb4['filters']=_[_0x182d('0x39')](_0x270fb4['model'],_0x270fb4['query']);_0x313363['attributes']=_[_0x182d('0x39')](_0x270fb4[_0x182d('0x35')],qs['fields'](_0x118155['query'][_0x182d('0x3b')]));_0x313363[_0x182d('0x3a')]=_0x313363['attributes']['length']?_0x313363[_0x182d('0x3a')]:_0x270fb4[_0x182d('0x35')];if(!_0x118155[_0x182d('0x36')]['hasOwnProperty'](_0x182d('0x5c'))){_0x313363[_0x182d('0x23')]=qs['limit'](_0x118155['query']['limit']);_0x313363[_0x182d('0x21')]=qs['offset'](_0x118155[_0x182d('0x36')][_0x182d('0x21')]);}_0x313363[_0x182d('0x3d')]=qs['sort'](_0x118155['query'][_0x182d('0x3e')]);_0x313363['where']=qs['filters'](_[_0x182d('0x40')](_0x118155['query'],_0x270fb4[_0x182d('0x38')]));_0x313363[_0x182d('0x3f')][_0x182d('0x58')]=_0x51c88b['id'];if(_0x118155[_0x182d('0x36')]['filter']){_0x313363[_0x182d('0x3f')]=_[_0x182d('0x42')](_0x313363[_0x182d('0x3f')],{'$or':_['map'](_0x313363[_0x182d('0x3a')],function(_0x4fda09){var _0x3e2762={};_0x3e2762[_0x4fda09]={'$like':'%'+_0x118155['query'][_0x182d('0x41')]+'%'};return _0x3e2762;})});}_0x313363=_['merge']({},_0x313363,_0x118155[_0x182d('0x44')]);return db[_0x182d('0x59')][_0x182d('0x22')]({'where':_0x313363['where']})[_0x182d('0x28')](function(_0x540e41){_0x226cd8[_0x182d('0x22')]=_0x540e41;if(_0x118155[_0x182d('0x36')][_0x182d('0x46')]){_0x313363[_0x182d('0x47')]=[{'all':!![]}];}return db[_0x182d('0x59')]['findAll'](_0x313363);})[_0x182d('0x28')](function(_0x1a4ea3){_0x226cd8[_0x182d('0x49')]=_0x1a4ea3;return _0x226cd8;});}})['then'](respondWithFilteredResult(_0x40e90b,_0x313363))[_0x182d('0x4a')](handleError(_0x40e90b,null));};exports[_0x182d('0x5d')]=function(_0x15991a,_0x50c866,_0x4a0e7a){return db[_0x182d('0x45')][_0x182d('0x53')]({'where':{'id':_0x15991a[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x50c866,null))['then'](function(_0x179adf){if(_0x179adf){return _0x179adf[_0x182d('0x5d')](_0x15991a[_0x182d('0x36')][_0x182d('0x5e')]);}})[_0x182d('0x28')](respondWithStatusCode(_0x50c866,null))[_0x182d('0x4a')](handleError(_0x50c866,null));};exports['addContacts']=function(_0x4e62d8,_0x2b4e62,_0x2251b8){return db[_0x182d('0x45')][_0x182d('0x53')]({'where':{'id':_0x4e62d8[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x2b4e62,null))['then'](function(_0x110a55){if(_0x110a55){var _0xec6691=[];var _0x474cdd={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x4126ec){if(_0x4e62d8[_0x182d('0x4d')]['tags']&&_[_0x182d('0x5f')](_0x4e62d8[_0x182d('0x4d')][_0x182d('0x60')])){if(_0x4e62d8[_0x182d('0x4d')][_0x182d('0x60')][_0x182d('0x61')]){_0x4e62d8[_0x182d('0x4d')]['tags']=_0x4e62d8[_0x182d('0x4d')]['tags'][_0x182d('0x62')](';')+';';}else{_0x4e62d8['body'][_0x182d('0x60')]=null;}}else{_0x4e62d8[_0x182d('0x4d')][_0x182d('0x60')]=null;}if(_0x4e62d8[_0x182d('0x4d')]&&_[_0x182d('0x5f')](_0x4e62d8['body'])){for(var _0x498794=0x0;_0x498794<_0x4e62d8[_0x182d('0x4d')][_0x182d('0x61')];_0x498794+=0x1){_0x4e62d8['body'][_0x498794][_0x182d('0x58')]=_0x4e62d8[_0x182d('0x4b')]['id'];_0xec6691[_0x182d('0x63')](_0x4e62d8[_0x182d('0x4d')][_0x498794]);}return BPromise[_0x182d('0x64')](_0xec6691,function(_0x13061f){return db[_0x182d('0x65')][_0x182d('0x4c')](_[_0x182d('0x66')](_0x13061f,['ids','id'])||{},{'fields':_[_0x182d('0x37')](_0x4126ec),'raw':!![]})[_0x182d('0x28')](function(_0x2b0971){_0x474cdd[_0x182d('0x67')][_0x182d('0x63')](_0x2b0971['dataValues']);})[_0x182d('0x4a')](function(_0x1a3634){_0x474cdd['errors'][_0x182d('0x63')]({'data':_0x13061f,'error':_0x1a3634[_0x182d('0x68')]});});})[_0x182d('0x28')](function(_0x1609b7){return _0x474cdd;})[_0x182d('0x4a')](function(_0x198048){return _0x198048;});}else{_0x2b4e62[_0x182d('0x1e')](0x190)['json']({'message':_0x182d('0x69')});}});}})[_0x182d('0x28')](respondWithResult(_0x2b4e62,null))[_0x182d('0x4a')](handleError(_0x2b4e62,null));};exports[_0x182d('0x6a')]=function(_0x4ddb9b,_0x10adfa,_0x86be63){var _0x29936e;return db[_0x182d('0x45')][_0x182d('0x53')]({'where':{'id':_0x4ddb9b[_0x182d('0x4b')]['id']},'include':[{'model':db[_0x182d('0x6b')],'as':_0x182d('0x6c')}]})[_0x182d('0x28')](handleEntityNotFound(_0x10adfa,null))[_0x182d('0x28')](function(_0x23a547){if(_0x23a547){_0x29936e=_0x23a547;return db[_0x182d('0x65')]['rawAttributes'];}})[_0x182d('0x28')](function(_0x335e4b){if(_0x335e4b){var _0x9b836c={};var _0x45ab16={};_0x45ab16[_0x182d('0x35')]=_['concat'](_[_0x182d('0x37')](_0x335e4b),_[_0x182d('0x30')](_0x29936e['CustomFields'],function(_0x5a71c2){return util[_0x182d('0x6d')](_0x182d('0x6e'),_0x5a71c2['id']);}));_0x45ab16[_0x182d('0x36')]=_[_0x182d('0x37')](_0x4ddb9b['query']);_0x45ab16[_0x182d('0x38')]=_['intersection'](_0x45ab16['model'],_0x45ab16['query']);_0x9b836c[_0x182d('0x3a')]=_['intersection'](_0x45ab16[_0x182d('0x35')],qs[_0x182d('0x3b')](_0x4ddb9b[_0x182d('0x36')][_0x182d('0x3b')]));_0x9b836c[_0x182d('0x3a')]=_0x9b836c[_0x182d('0x3a')][_0x182d('0x61')]?_0x9b836c['attributes']:_0x45ab16[_0x182d('0x35')];if(!_0x4ddb9b[_0x182d('0x36')][_0x182d('0x3c')](_0x182d('0x5c'))){_0x9b836c[_0x182d('0x23')]=qs[_0x182d('0x23')](_0x4ddb9b[_0x182d('0x36')][_0x182d('0x23')]);_0x9b836c[_0x182d('0x21')]=qs[_0x182d('0x21')](_0x4ddb9b[_0x182d('0x36')]['offset']);}_0x9b836c['order']=qs[_0x182d('0x3e')](_0x4ddb9b[_0x182d('0x36')][_0x182d('0x3e')]);_0x9b836c['where']=qs[_0x182d('0x38')](_[_0x182d('0x40')](_0x4ddb9b['query'],_0x45ab16[_0x182d('0x38')]));_0x9b836c['raw']=!![];if(_0x4ddb9b[_0x182d('0x36')][_0x182d('0x41')]){_0x9b836c[_0x182d('0x3f')]=_[_0x182d('0x42')](_0x9b836c[_0x182d('0x3f')],{'$or':_['map'](_0x9b836c[_0x182d('0x3a')],function(_0x302e8d){var _0x46c09d={};_0x46c09d[_0x302e8d]={'$like':'%'+_0x4ddb9b[_0x182d('0x36')][_0x182d('0x41')]+'%'};return _0x46c09d;})});}_0x9b836c=_['merge']({},_0x9b836c,_0x4ddb9b[_0x182d('0x44')]);return _0x29936e['getContacts'](_0x9b836c);}})[_0x182d('0x28')](respondWithResult(_0x10adfa,null))[_0x182d('0x4a')](handleError(_0x10adfa,null));};exports[_0x182d('0x6f')]=function(_0x43a625,_0xc0868d,_0x2bbebe){var _0x4a741f;return db[_0x182d('0x45')][_0x182d('0x53')]({'where':{'id':_0x43a625[_0x182d('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x182d('0x6c')}]})[_0x182d('0x28')](handleEntityNotFound(_0xc0868d,null))[_0x182d('0x28')](function(_0x2e2505){if(_0x2e2505){_0x4a741f=_0x2e2505;return db['CmContact'][_0x182d('0x31')];}})[_0x182d('0x28')](function(_0x4906bc){if(_0x4906bc){var _0x314bcb={};var _0x335aa3={};_0x335aa3[_0x182d('0x35')]=_[_0x182d('0x70')](_['keys'](_0x4906bc),_[_0x182d('0x30')](_0x4a741f['CustomFields'],function(_0x164681){return util[_0x182d('0x6d')](_0x182d('0x6e'),_0x164681['id']);}));_0x335aa3[_0x182d('0x36')]=_[_0x182d('0x37')](_0x43a625[_0x182d('0x36')]);_0x335aa3[_0x182d('0x38')]=_[_0x182d('0x39')](_0x335aa3['model'],_0x335aa3[_0x182d('0x36')]);_0x314bcb[_0x182d('0x3a')]=_[_0x182d('0x39')](_0x335aa3[_0x182d('0x35')],qs['fields'](_0x43a625[_0x182d('0x36')][_0x182d('0x3b')]));_0x314bcb[_0x182d('0x3a')]=_0x314bcb[_0x182d('0x3a')][_0x182d('0x61')]?_0x314bcb[_0x182d('0x3a')]:_0x335aa3[_0x182d('0x35')];if(!_0x43a625[_0x182d('0x36')][_0x182d('0x3c')](_0x182d('0x5c'))){_0x314bcb[_0x182d('0x23')]=qs['limit'](_0x43a625[_0x182d('0x36')][_0x182d('0x23')]);_0x314bcb[_0x182d('0x21')]=qs[_0x182d('0x21')](_0x43a625[_0x182d('0x36')]['offset']);}_0x314bcb[_0x182d('0x3d')]=qs[_0x182d('0x3e')](_0x43a625[_0x182d('0x36')][_0x182d('0x3e')]);_0x314bcb[_0x182d('0x3f')]=qs['filters'](_['pick'](_0x43a625[_0x182d('0x36')],_0x335aa3['filters']));_0x314bcb[_0x182d('0x71')]=!![];if(_0x43a625[_0x182d('0x36')][_0x182d('0x41')]){_0x314bcb['where']=_[_0x182d('0x42')](_0x314bcb[_0x182d('0x3f')],{'$or':_['map'](_0x314bcb['attributes'],function(_0x2173c2){var _0x10e9e6={};_0x10e9e6[_0x2173c2]={'$like':'%'+_0x43a625[_0x182d('0x36')]['filter']+'%'};return _0x10e9e6;})});}_0x314bcb=_['merge']({},_0x314bcb,_0x43a625[_0x182d('0x44')]);return _0x4a741f[_0x182d('0x6a')](_0x314bcb);}})[_0x182d('0x28')](function(_0x5ee585){if(!_[_0x182d('0x72')](_0x5ee585)){var _0x1ee4bc=toCsv(_0x5ee585);var _0x3ce1dd=Date[_0x182d('0x73')]();fs['writeFileSync'](util[_0x182d('0x6d')]('/tmp/list_%d_%s.csv',_0x4a741f['id'],_0x3ce1dd),_0x1ee4bc);_0xc0868d['setHeader'](_0x182d('0x74'),_0x182d('0x75')+util[_0x182d('0x6d')]('list_%d_%s.csv',_0x4a741f['id'],_0x3ce1dd));_0xc0868d[_0x182d('0x76')]('Content-type',_0x182d('0x77'));return _0xc0868d[_0x182d('0x78')](util[_0x182d('0x6d')]('/tmp/list_%d_%s.csv',_0x4a741f['id'],_0x3ce1dd));}else{return _0xc0868d[_0x182d('0x2c')](0xcc);}})[_0x182d('0x4a')](handleError(_0xc0868d,null));};exports[_0x182d('0x79')]=function(_0x3da513,_0x195ff5,_0x2bbb81){var _0x140ea7;delete _0x3da513['body']['id'];return db[_0x182d('0x45')]['findOne']({'where':{'id':_0x3da513[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x195ff5,null))['then'](function(_0x24c78e){if(_0x24c78e){return db[_0x182d('0x7a')][_0x182d('0x7b')](function(_0x23ddab){return db['CmCustomField']['create'](_0x3da513[_0x182d('0x4d')],{'transaction':_0x23ddab})['then'](function(_0x37a61e){_0x140ea7=_0x37a61e;return _0x24c78e[_0x182d('0x7c')](_0x37a61e,{'transaction':_0x23ddab});})[_0x182d('0x28')](function(){var _0x447049={'type':db[_0x182d('0x7d')]['TEXT'],'transaction':_0x23ddab};switch(_0x3da513[_0x182d('0x4d')][_0x182d('0x33')]){case'text':_0x447049[_0x182d('0x33')]=db[_0x182d('0x7d')][_0x182d('0x7e')];break;case _0x182d('0x7f'):_0x447049[_0x182d('0x33')]=db[_0x182d('0x7d')][_0x182d('0x80')];break;case _0x182d('0x81'):_0x447049[_0x182d('0x33')]=db[_0x182d('0x7d')][_0x182d('0x82')];_0x447049[_0x182d('0x83')]=![];break;default:}return db[_0x182d('0x7a')][_0x182d('0x84')][_0x182d('0x85')]('cm_contacts',util[_0x182d('0x6d')](_0x182d('0x86'),_0x140ea7['id']),_0x447049);})[_0x182d('0x28')](function(){return _0x140ea7;});});}})[_0x182d('0x28')](respondWithResult(_0x195ff5,null))['catch'](handleError(_0x195ff5,null));};exports[_0x182d('0x87')]=function(_0x1de99a,_0x483679,_0x15c922){var _0x47a59b={};var _0x3da0db={};var _0x41130c;var _0x1cc260;return db[_0x182d('0x45')][_0x182d('0x5b')]({'where':{'id':_0x1de99a['params']['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x483679,null))[_0x182d('0x28')](function(_0x4e4d96){if(_0x4e4d96){_0x41130c=_0x4e4d96;_0x3da0db[_0x182d('0x35')]=_['keys'](db['CmCustomField'][_0x182d('0x31')]);_0x3da0db[_0x182d('0x36')]=_[_0x182d('0x37')](_0x1de99a['query']);_0x3da0db[_0x182d('0x38')]=_[_0x182d('0x39')](_0x3da0db[_0x182d('0x35')],_0x3da0db[_0x182d('0x36')]);_0x47a59b['attributes']=_[_0x182d('0x39')](_0x3da0db[_0x182d('0x35')],qs[_0x182d('0x3b')](_0x1de99a['query'][_0x182d('0x3b')]));_0x47a59b['attributes']=_0x47a59b[_0x182d('0x3a')][_0x182d('0x61')]?_0x47a59b[_0x182d('0x3a')]:_0x3da0db['model'];_0x47a59b[_0x182d('0x3d')]=qs['sort'](_0x1de99a['query'][_0x182d('0x3e')]);_0x47a59b[_0x182d('0x3f')]=qs['filters'](_['pick'](_0x1de99a[_0x182d('0x36')],_0x3da0db[_0x182d('0x38')]));_0x47a59b[_0x182d('0x3f')]=_['merge'](_0x47a59b[_0x182d('0x3f')],{'$or':[{'ListId':_0x4e4d96['id']},{'ListId':null}]});if(_0x1de99a[_0x182d('0x36')]['filter']){_0x47a59b[_0x182d('0x3f')]=_[_0x182d('0x42')](_0x47a59b['where'],{'$or':_[_0x182d('0x30')](_0x47a59b['attributes'],function(_0x5b0a4d){var _0x320e5e={};_0x320e5e[_0x5b0a4d]={'$like':'%'+_0x1de99a[_0x182d('0x36')]['filter']+'%'};return _0x320e5e;})});}_0x47a59b=_[_0x182d('0x42')]({},_0x47a59b,_0x1de99a[_0x182d('0x44')]);return db[_0x182d('0x6b')][_0x182d('0x88')](_0x47a59b);}})[_0x182d('0x28')](respondWithResult(_0x483679,null))[_0x182d('0x4a')](handleError(_0x483679,null));};exports[_0x182d('0x89')]=function(_0x1a89af,_0x1a9032,_0x231a50){return db[_0x182d('0x45')][_0x182d('0x53')]({'where':{'id':_0x1a89af[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x1a9032,null))['then'](function(_0x43ae3f){if(_0x43ae3f){return _0x43ae3f['addAgents'](_0x1a89af['body']['ids'],_[_0x182d('0x66')](_0x1a89af[_0x182d('0x4d')],[_0x182d('0x5e'),'id'])||{})['spread'](function(_0x4a6c91){for(var _0x45659c=0x0;_0x45659c<_0x1a89af[_0x182d('0x4d')][_0x182d('0x5e')][_0x182d('0x61')];_0x45659c+=0x1){socket[_0x182d('0x8a')](_0x182d('0x8b'),{'UserId':_0x1a89af[_0x182d('0x4d')][_0x182d('0x5e')][_0x45659c],'CmListId':_0x1a89af[_0x182d('0x4b')]['id']});}return _0x4a6c91;});}})[_0x182d('0x28')](respondWithResult(_0x1a9032,null))[_0x182d('0x4a')](handleError(_0x1a9032,null));};exports[_0x182d('0x8c')]=function(_0x48a33e,_0x17c532,_0x470565){return db[_0x182d('0x45')][_0x182d('0x53')]({'where':{'id':_0x48a33e[_0x182d('0x4b')]['id']}})[_0x182d('0x28')](handleEntityNotFound(_0x17c532,null))[_0x182d('0x28')](function(_0xda4933){if(_0xda4933){return _0xda4933[_0x182d('0x8c')](_0x48a33e['query']['ids'])['then'](function(){if(_['isArray'](_0x48a33e['query'][_0x182d('0x5e')])){for(var _0x352fc3=0x0;_0x352fc3<_0x48a33e['query'][_0x182d('0x5e')][_0x182d('0x61')];_0x352fc3+=0x1){socket['emit'](_0x182d('0x8d'),{'UserId':Number(_0x48a33e[_0x182d('0x36')][_0x182d('0x5e')][_0x352fc3]),'CmListId':Number(_0x48a33e[_0x182d('0x4b')]['id'])});}}else{socket[_0x182d('0x8a')]('userCmList:remove',{'UserId':Number(_0x48a33e[_0x182d('0x36')][_0x182d('0x5e')]),'CmListId':Number(_0x48a33e[_0x182d('0x4b')]['id'])});}});}})[_0x182d('0x28')](respondWithStatusCode(_0x17c532,null))[_0x182d('0x4a')](handleError(_0x17c532,null));};exports[_0x182d('0x8e')]=function(_0x124659,_0x4257d5,_0x441598){var _0x2cab66={};var _0x3c68da={};var _0x23b055;var _0x290b5e;return db[_0x182d('0x45')][_0x182d('0x5b')]({'where':{'id':_0x124659[_0x182d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4257d5,null))[_0x182d('0x28')](function(_0x1aa561){if(_0x1aa561){_0x23b055=_0x1aa561;_0x3c68da[_0x182d('0x35')]=_[_0x182d('0x37')](db['User'][_0x182d('0x31')]);_0x3c68da[_0x182d('0x36')]=_[_0x182d('0x37')](_0x124659['query']);_0x3c68da[_0x182d('0x38')]=_[_0x182d('0x39')](_0x3c68da['model'],_0x3c68da['query']);_0x2cab66[_0x182d('0x3a')]=_[_0x182d('0x39')](_0x3c68da['model'],qs[_0x182d('0x3b')](_0x124659[_0x182d('0x36')][_0x182d('0x3b')]));_0x2cab66[_0x182d('0x3a')]=_0x2cab66['attributes']['length']?_0x2cab66[_0x182d('0x3a')]:_0x3c68da[_0x182d('0x35')];_0x2cab66[_0x182d('0x3d')]=qs[_0x182d('0x3e')](_0x124659[_0x182d('0x36')][_0x182d('0x3e')]);_0x2cab66[_0x182d('0x3f')]=qs['filters'](_[_0x182d('0x40')](_0x124659[_0x182d('0x36')],_0x3c68da[_0x182d('0x38')]));if(_0x124659['query']['filter']){_0x2cab66['where']=_[_0x182d('0x42')](_0x2cab66[_0x182d('0x3f')],{'$or':_['map'](_0x2cab66['attributes'],function(_0x5c7248){var _0x466a71={};_0x466a71[_0x5c7248]={'$like':'%'+_0x124659[_0x182d('0x36')][_0x182d('0x41')]+'%'};return _0x466a71;})});}_0x2cab66=_['merge']({},_0x2cab66,_0x124659['options']);return _0x23b055[_0x182d('0x8e')](_0x2cab66);}})['then'](function(_0x5ad40c){if(_0x5ad40c){_0x290b5e=_0x5ad40c[_0x182d('0x61')];if(!_0x124659[_0x182d('0x36')][_0x182d('0x3c')](_0x182d('0x5c'))){_0x2cab66[_0x182d('0x23')]=qs[_0x182d('0x23')](_0x124659[_0x182d('0x36')][_0x182d('0x23')]);_0x2cab66[_0x182d('0x21')]=qs['offset'](_0x124659[_0x182d('0x36')][_0x182d('0x21')]);}return _0x23b055[_0x182d('0x8e')](_0x2cab66);}})['then'](function(_0x41897f){if(_0x41897f){return _0x41897f?{'count':_0x290b5e,'rows':_0x41897f}:null;}})[_0x182d('0x28')](respondWithResult(_0x4257d5,null))[_0x182d('0x4a')](handleError(_0x4257d5,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0ab8d9f..14d08a8 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 _0x255d=['update','emit','hasOwnProperty','exports','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x336595,_0x413e3d){var _0x600f95=function(_0x33a9f9){while(--_0x33a9f9){_0x336595['push'](_0x336595['shift']());}};_0x600f95(++_0x413e3d);}(_0x255d,0xbc));var _0xd255=function(_0x22d822,_0x3b4f9f){_0x22d822=_0x22d822-0x0;var _0x4c345f=_0x255d[_0x22d822];return _0x4c345f;};'use strict';var EventEmitter=require('events');var CmList=require(_0xd255('0x0'))['db'][_0xd255('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0xd255('0x2')](0x0);var events={'afterCreate':_0xd255('0x3'),'afterUpdate':_0xd255('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4e8aa9){return function(_0x57c5ce,_0x37c8ef,_0xe6d417){CmListEvents['emit'](_0x4e8aa9+':'+_0x57c5ce['id'],_0x57c5ce);CmListEvents[_0xd255('0x5')](_0x4e8aa9,_0x57c5ce);_0xe6d417(null);};}for(var e in events){if(events[_0xd255('0x6')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xd255('0x7')]=CmListEvents; \ No newline at end of file +var _0xc670=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','CmList','setMaxListeners'];(function(_0x37dc7d,_0x23e9f3){var _0x2c5cee=function(_0x2013e7){while(--_0x2013e7){_0x37dc7d['push'](_0x37dc7d['shift']());}};_0x2c5cee(++_0x23e9f3);}(_0xc670,0x1d2));var _0x0c67=function(_0x3ae86f,_0x2432d9){_0x3ae86f=_0x3ae86f-0x0;var _0x454f90=_0xc670[_0x3ae86f];return _0x454f90;};'use strict';var EventEmitter=require(_0x0c67('0x0'));var CmList=require(_0x0c67('0x1'))['db'][_0x0c67('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x0c67('0x3')](0x0);var events={'afterCreate':_0x0c67('0x4'),'afterUpdate':_0x0c67('0x5'),'afterDestroy':_0x0c67('0x6')};function emitEvent(_0x47e277){return function(_0x492562,_0x270751,_0x3e2301){CmListEvents[_0x0c67('0x7')](_0x47e277+':'+_0x492562['id'],_0x492562);CmListEvents[_0x0c67('0x7')](_0x47e277,_0x492562);_0x3e2301(null);};}for(var e in events){if(events[_0x0c67('0x8')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x0c67('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 9909c57..b39ea47 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 _0x0ffa=['define','CmList','cm_lists','../../config/logger','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x0ffa,0x81));var _0xa0ff=function(_0x3af9de,_0xd8bc4f){_0x3af9de=_0x3af9de-0x0;var _0x1ed3d6=_0x0ffa[_0x3af9de];return _0x1ed3d6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0ff('0x0'))('api');var moment=require('moment');var BPromise=require(_0xa0ff('0x1'));var rp=require(_0xa0ff('0x2'));var fs=require('fs');var path=require(_0xa0ff('0x3'));var rimraf=require('rimraf');var config=require(_0xa0ff('0x4'));var attributes=require('./cmList.attributes');module[_0xa0ff('0x5')]=function(_0x1af716,_0x228a92){return _0x1af716[_0xa0ff('0x6')](_0xa0ff('0x7'),attributes,{'tableName':_0xa0ff('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a3d=['./cmList.attributes','exports','define','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x511521,_0x48fbc1){var _0x29f0f8=function(_0x344c0d){while(--_0x344c0d){_0x511521['push'](_0x511521['shift']());}};_0x29f0f8(++_0x48fbc1);}(_0x1a3d,0xc4));var _0xd1a3=function(_0x46bddd,_0x142783){_0x46bddd=_0x46bddd-0x0;var _0x20975f=_0x1a3d[_0x46bddd];return _0x20975f;};'use strict';var _=require(_0xd1a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd1a3('0x1'));var moment=require(_0xd1a3('0x2'));var BPromise=require(_0xd1a3('0x3'));var rp=require(_0xd1a3('0x4'));var fs=require('fs');var path=require(_0xd1a3('0x5'));var rimraf=require(_0xd1a3('0x6'));var config=require(_0xd1a3('0x7'));var attributes=require(_0xd1a3('0x8'));module[_0xd1a3('0x9')]=function(_0x2511fd,_0x3464d1){return _0x2511fd[_0xd1a3('0xa')]('CmList',attributes,{'tableName':_0xd1a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 89d8f30..97da3ff 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 _0x86b6=['error','message','CmList,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','debug','stringify'];(function(_0x1f7a00,_0x341591){var _0x4b151c=function(_0x51fceb){while(--_0x51fceb){_0x1f7a00['push'](_0x1f7a00['shift']());}};_0x4b151c(++_0x341591);}(_0x86b6,0x157));var _0x686b=function(_0x11b3f4,_0x371c17){_0x11b3f4=_0x11b3f4-0x0;var _0x47af1d=_0x86b6[_0x11b3f4];return _0x47af1d;};'use strict';var _=require(_0x686b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x686b('0x1'));var rs=require(_0x686b('0x2'));var fs=require('fs');var Redis=require(_0x686b('0x3'));var db=require(_0x686b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x686b('0x5'))(_0x686b('0x6'));var config=require(_0x686b('0x7'));var jayson=require(_0x686b('0x8'));var client=jayson['client'][_0x686b('0x9')]({'port':0x232a});config[_0x686b('0xa')]=_[_0x686b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x686b('0xc'))(new Redis(config[_0x686b('0xa')]));require(_0x686b('0xd'))[_0x686b('0xe')](socket);function respondWithRpcPromise(_0x3df923,_0x47330f,_0x6602b9){return new BPromise(function(_0x47ab5a,_0x3132ea){return client[_0x686b('0xf')](_0x3df923,_0x6602b9)[_0x686b('0x10')](function(_0x288da3){logger[_0x686b('0x11')]('CmList,\x20%s,\x20%s',_0x47330f,_0x686b('0x12'));logger[_0x686b('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x47330f,_0x686b('0x12'),JSON[_0x686b('0x14')](_0x288da3));if(_0x288da3['error']){if(_0x288da3[_0x686b('0x15')]['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x47330f,_0x288da3[_0x686b('0x15')][_0x686b('0x16')]);return _0x3132ea(_0x288da3[_0x686b('0x15')][_0x686b('0x16')]);}logger[_0x686b('0x15')]('CmList,\x20%s,\x20%s',_0x47330f,_0x288da3[_0x686b('0x15')][_0x686b('0x16')]);return _0x47ab5a(_0x288da3[_0x686b('0x15')][_0x686b('0x16')]);}else{logger[_0x686b('0x11')](_0x686b('0x17'),_0x47330f,_0x686b('0x12'));_0x47ab5a(_0x288da3[_0x686b('0x18')][_0x686b('0x16')]);}})[_0x686b('0x19')](function(_0x2d1384){logger[_0x686b('0x15')](_0x686b('0x17'),_0x47330f,_0x2d1384);_0x3132ea(_0x2d1384);});});} \ No newline at end of file +var _0x72f1=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x586c72,_0x389dba){var _0x497e29=function(_0x44baa7){while(--_0x44baa7){_0x586c72['push'](_0x586c72['shift']());}};_0x497e29(++_0x389dba);}(_0x72f1,0x139));var _0x172f=function(_0x32b470,_0x54ca7f){_0x32b470=_0x32b470-0x0;var _0x5dc272=_0x72f1[_0x32b470];return _0x5dc272;};'use strict';var _=require(_0x172f('0x0'));var util=require(_0x172f('0x1'));var moment=require(_0x172f('0x2'));var BPromise=require('bluebird');var rs=require(_0x172f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x172f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x172f('0x5'))(_0x172f('0x6'));var config=require(_0x172f('0x7'));var jayson=require(_0x172f('0x8'));var client=jayson[_0x172f('0x9')][_0x172f('0xa')]({'port':0x232a});config[_0x172f('0xb')]=_[_0x172f('0xc')](config[_0x172f('0xb')],{'host':_0x172f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x172f('0xb')]));require(_0x172f('0xe'))[_0x172f('0xf')](socket);function respondWithRpcPromise(_0x3cc163,_0x3b9c36,_0x1b1598){return new BPromise(function(_0x37481f,_0x3d12b6){return client[_0x172f('0x10')](_0x3cc163,_0x1b1598)[_0x172f('0x11')](function(_0x370d41){logger['info'](_0x172f('0x12'),_0x3b9c36,_0x172f('0x13'));logger[_0x172f('0x14')](_0x172f('0x15'),_0x3b9c36,'request\x20sent',JSON[_0x172f('0x16')](_0x370d41));if(_0x370d41['error']){if(_0x370d41[_0x172f('0x17')][_0x172f('0x18')]===0x1f4){logger[_0x172f('0x17')]('CmList,\x20%s,\x20%s',_0x3b9c36,_0x370d41[_0x172f('0x17')][_0x172f('0x19')]);return _0x3d12b6(_0x370d41[_0x172f('0x17')]['message']);}logger['error'](_0x172f('0x12'),_0x3b9c36,_0x370d41[_0x172f('0x17')][_0x172f('0x19')]);return _0x37481f(_0x370d41[_0x172f('0x17')][_0x172f('0x19')]);}else{logger[_0x172f('0x1a')](_0x172f('0x12'),_0x3b9c36,_0x172f('0x13'));_0x37481f(_0x370d41[_0x172f('0x1b')][_0x172f('0x19')]);}})[_0x172f('0x1c')](function(_0x483bfe){logger['error'](_0x172f('0x12'),_0x3b9c36,_0x483bfe);_0x3d12b6(_0x483bfe);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 87e8bc8..7172b3a 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 _0x975b=['register','cmList:','./cmList.events','save','remove','update','removeListener'];(function(_0x549d0e,_0x2c1a68){var _0x613cfb=function(_0x556070){while(--_0x556070){_0x549d0e['push'](_0x549d0e['shift']());}};_0x613cfb(++_0x2c1a68);}(_0x975b,0x1c9));var _0xb975=function(_0x1d9314,_0x1c27a2){_0x1d9314=_0x1d9314-0x0;var _0xa4b6c4=_0x975b[_0x1d9314];return _0xa4b6c4;};'use strict';var CmListEvents=require(_0xb975('0x0'));var events=[_0xb975('0x1'),_0xb975('0x2'),_0xb975('0x3')];function createListener(_0x2b8e95,_0x152d0d){return function(_0x45fa5f){_0x152d0d['emit'](_0x2b8e95,_0x45fa5f);};}function removeListener(_0xa92c72,_0xfb173){return function(){CmListEvents[_0xb975('0x4')](_0xa92c72,_0xfb173);};}exports[_0xb975('0x5')]=function(_0x599d95){for(var _0x1729fe=0x0,_0x3d84f1=events['length'];_0x1729fe<_0x3d84f1;_0x1729fe++){var _0x4178ee=events[_0x1729fe];var _0x550f78=createListener(_0xb975('0x6')+_0x4178ee,_0x599d95);CmListEvents['on'](_0x4178ee,_0x550f78);}}; \ No newline at end of file +var _0xd307=['./cmList.events','save','remove','update','emit','removeListener','length','cmList:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd307,0x110));var _0x7d30=function(_0x3e4335,_0x6f64a0){_0x3e4335=_0x3e4335-0x0;var _0x53cf67=_0xd307[_0x3e4335];return _0x53cf67;};'use strict';var CmListEvents=require(_0x7d30('0x0'));var events=[_0x7d30('0x1'),_0x7d30('0x2'),_0x7d30('0x3')];function createListener(_0x2917cd,_0x3c6f99){return function(_0x359ef3){_0x3c6f99[_0x7d30('0x4')](_0x2917cd,_0x359ef3);};}function removeListener(_0x57cf6e,_0x2a0bb8){return function(){CmListEvents[_0x7d30('0x5')](_0x57cf6e,_0x2a0bb8);};}exports['register']=function(_0x400916){for(var _0x449938=0x0,_0x9451ed=events[_0x7d30('0x6')];_0x449938<_0x9451ed;_0x449938++){var _0x43b35e=events[_0x449938];var _0x1ef3e7=createListener(_0x7d30('0x7')+_0x43b35e,_0x400916);CmListEvents['on'](_0x43b35e,_0x1ef3e7);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index cd6173d..4a698da 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 _0xbd50=['get','/describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','addDisposition','addContacts','addCustomField','addAgents','put','delete','removeDispositions','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x2f999a,_0x15fbe0){var _0x102dc9=function(_0x3f7b09){while(--_0x3f7b09){_0x2f999a['push'](_0x2f999a['shift']());}};_0x102dc9(++_0x15fbe0);}(_0xbd50,0x196));var _0x0bd5=function(_0x5e93be,_0xf4e717){_0x5e93be=_0x5e93be-0x0;var _0x44bf05=_0xbd50[_0x5e93be];return _0x44bf05;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['get'](_0x0bd5('0xe'),auth[_0x0bd5('0x8')](),controller['getDispositions']);router[_0x0bd5('0xa')](_0x0bd5('0xf'),auth['isAuthenticated'](),controller[_0x0bd5('0x10')]);router[_0x0bd5('0xa')](_0x0bd5('0x11'),auth['isAuthenticated'](),controller[_0x0bd5('0x12')]);router[_0x0bd5('0xa')](_0x0bd5('0x13'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x14')]);router[_0x0bd5('0xa')](_0x0bd5('0x15'),auth[_0x0bd5('0x8')](),controller['getAgents']);router[_0x0bd5('0x16')]('/',auth[_0x0bd5('0x8')](),controller['create']);router[_0x0bd5('0x16')](_0x0bd5('0xe'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x17')]);router['post'](_0x0bd5('0xf'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x18')]);router[_0x0bd5('0x16')](_0x0bd5('0x13'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x19')]);router[_0x0bd5('0x16')](_0x0bd5('0x15'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1a')]);router[_0x0bd5('0x1b')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x0bd5('0x1c')](_0x0bd5('0xe'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1d')]);router[_0x0bd5('0x1c')]('/:id/users',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1e')]);module[_0x0bd5('0x1f')]=router; \ No newline at end of file +var _0xe5b3=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','post','create','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','/:id/users','removeAgents'];(function(_0x130452,_0x2656e1){var _0x4f9183=function(_0x2cb61c){while(--_0x2cb61c){_0x130452['push'](_0x130452['shift']());}};_0x4f9183(++_0x2656e1);}(_0xe5b3,0x133));var _0x3e5b=function(_0x39e884,_0x4a01e6){_0x39e884=_0x39e884-0x0;var _0x26358e=_0xe5b3[_0x39e884];return _0x26358e;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xa')](_0x3e5b('0xf'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0xa')]('/:id/contacts',auth[_0x3e5b('0xc')](),controller['getContacts']);router[_0x3e5b('0xa')](_0x3e5b('0x11'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x12')]);router[_0x3e5b('0xa')](_0x3e5b('0x13'),auth[_0x3e5b('0xc')](),controller['getCustomFields']);router[_0x3e5b('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x3e5b('0x14')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x15')]);router['post'](_0x3e5b('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x3e5b('0x14')](_0x3e5b('0x16'),auth['isAuthenticated'](),controller[_0x3e5b('0x17')]);router[_0x3e5b('0x14')]('/:id/fields',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x18')]);router['post']('/:id/users',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x19')]);router[_0x3e5b('0x1a')](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x1b')]);router[_0x3e5b('0x1c')](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x1d')]);router[_0x3e5b('0x1c')](_0x3e5b('0xf'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x1e')]);router['delete'](_0x3e5b('0x1f'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x20')]);module[_0x3e5b('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 27dd04d..105b4fe 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x65b130,_0x51590e){var _0x3d8fce=function(_0x2a19c4){while(--_0x2a19c4){_0x65b130['push'](_0x65b130['shift']());}};_0x3d8fce(++_0x51590e);}(_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')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x30e98a,_0x19d940){var _0x52ba02=function(_0x291fc4){while(--_0x291fc4){_0x30e98a['push'](_0x30e98a['shift']());}};_0x52ba02(++_0x19d940);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7bfa241..ccb23c3 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 _0x0c02=['params','catch','Condition','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','body','find'];(function(_0x5f30c3,_0x400752){var _0x26e964=function(_0x188d9c){while(--_0x188d9c){_0x5f30c3['push'](_0x5f30c3['shift']());}};_0x26e964(++_0x400752);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20c0('0x0'));var zipdir=require(_0x20c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20c0('0x2'));var moment=require(_0x20c0('0x3'));var BPromise=require(_0x20c0('0x4'));var Mustache=require(_0x20c0('0x5'));var util=require(_0x20c0('0x6'));var path=require(_0x20c0('0x7'));var sox=require(_0x20c0('0x8'));var csv=require(_0x20c0('0x9'));var ejs=require(_0x20c0('0xa'));var fs=require('fs');var fs_extra=require(_0x20c0('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x20c0('0xc'));var toCsv=require(_0x20c0('0x9'));var querystring=require(_0x20c0('0xd'));var Papa=require(_0x20c0('0xe'));var Redis=require(_0x20c0('0xf'));var authService=require(_0x20c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x20c0('0x11'));var config=require(_0x20c0('0x12'));var licenseUtil=require(_0x20c0('0x13'));var db=require(_0x20c0('0x14'))['db'];function respondWithStatusCode(_0x4ed79e,_0x56fa09){_0x56fa09=_0x56fa09||0xcc;return function(_0x55854e){if(_0x55854e){return _0x4ed79e['sendStatus'](_0x56fa09);}return _0x4ed79e[_0x20c0('0x15')](_0x56fa09)[_0x20c0('0x16')]();};}function respondWithResult(_0x42161f,_0x3b2bba){_0x3b2bba=_0x3b2bba||0xc8;return function(_0x37f4e0){if(_0x37f4e0){return _0x42161f[_0x20c0('0x15')](_0x3b2bba)[_0x20c0('0x17')](_0x37f4e0);}};}function respondWithFilteredResult(_0x105839,_0x280aff){return function(_0x5a5e25){if(_0x5a5e25){var _0xd80b64=typeof _0x280aff[_0x20c0('0x18')]===_0x20c0('0x19')&&typeof _0x280aff[_0x20c0('0x1a')]===_0x20c0('0x19');var _0xeff5b9=_0x5a5e25['count'];var _0x55de3b=_0xd80b64?0x0:_0x280aff['offset'];var _0x10a921=_0xd80b64?_0x5a5e25[_0x20c0('0x1b')]:_0x280aff[_0x20c0('0x18')]+_0x280aff[_0x20c0('0x1a')];var _0x5b3725;if(_0x10a921>=_0xeff5b9){_0x10a921=_0xeff5b9;_0x5b3725=0xc8;}else{_0x5b3725=0xce;}_0x105839[_0x20c0('0x15')](_0x5b3725);return _0x105839[_0x20c0('0x1c')](_0x20c0('0x1d'),_0x55de3b+'-'+_0x10a921+'/'+_0xeff5b9)['json'](_0x5a5e25);}return null;};}function patchUpdates(_0x54bd1e){return function(_0x343db7){try{jsonpatch[_0x20c0('0x1e')](_0x343db7,_0x54bd1e,!![]);}catch(_0x1407d3){return BPromise[_0x20c0('0x1f')](_0x1407d3);}return _0x343db7[_0x20c0('0x20')]();};}function saveUpdates(_0x53d8e8,_0x2213f5){return function(_0x28959a){if(_0x28959a){return _0x28959a[_0x20c0('0x21')](_0x53d8e8)[_0x20c0('0x22')](function(_0x52b8b8){return _0x52b8b8;});}return null;};}function removeEntity(_0xfea1eb,_0x3e545c){return function(_0x2447e6){if(_0x2447e6){return _0x2447e6[_0x20c0('0x23')]()[_0x20c0('0x22')](function(){_0xfea1eb[_0x20c0('0x15')](0xcc)[_0x20c0('0x16')]();});}};}function handleEntityNotFound(_0x55b129,_0x45c08c){return function(_0x595d94){if(!_0x595d94){_0x55b129[_0x20c0('0x24')](0x194);}return _0x595d94;};}function handleError(_0x31565b,_0x11da5a){_0x11da5a=_0x11da5a||0x1f4;return function(_0x14dac3){logger['error'](_0x14dac3['stack']);if(_0x14dac3[_0x20c0('0x25')]){delete _0x14dac3[_0x20c0('0x25')];}_0x31565b[_0x20c0('0x15')](_0x11da5a)['send'](_0x14dac3);};}exports[_0x20c0('0x21')]=function(_0x25592b,_0x1bcfaf){if(_0x25592b[_0x20c0('0x26')]['id']){delete _0x25592b['body']['id'];}return db['Condition'][_0x20c0('0x27')]({'where':{'id':_0x25592b[_0x20c0('0x28')]['id']}})[_0x20c0('0x22')](handleEntityNotFound(_0x1bcfaf,null))[_0x20c0('0x22')](saveUpdates(_0x25592b[_0x20c0('0x26')],null))[_0x20c0('0x22')](respondWithResult(_0x1bcfaf,null))[_0x20c0('0x29')](handleError(_0x1bcfaf,null));};exports[_0x20c0('0x23')]=function(_0x3ac0a4,_0x191ad8){return db[_0x20c0('0x2a')][_0x20c0('0x27')]({'where':{'id':_0x3ac0a4[_0x20c0('0x28')]['id']}})[_0x20c0('0x22')](handleEntityNotFound(_0x191ad8,null))['then'](removeEntity(_0x191ad8,null))[_0x20c0('0x29')](handleError(_0x191ad8,null));}; \ No newline at end of file +var _0xe706=['then','end','name','send','body','Condition','find','params','destroy','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update'];(function(_0x172fb8,_0x1faf7b){var _0x540372=function(_0x45e156){while(--_0x45e156){_0x172fb8['push'](_0x172fb8['shift']());}};_0x540372(++_0x1faf7b);}(_0xe706,0xa3));var _0x6e70=function(_0x41a025,_0x10712a){_0x41a025=_0x41a025-0x0;var _0x2a5245=_0xe706[_0x41a025];return _0x2a5245;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x28')]=function(_0x5d772a,_0x1952ea){if(_0x5d772a[_0x6e70('0x2d')]['id']){delete _0x5d772a[_0x6e70('0x2d')]['id'];}return db[_0x6e70('0x2e')][_0x6e70('0x2f')]({'where':{'id':_0x5d772a[_0x6e70('0x30')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](saveUpdates(_0x5d772a[_0x6e70('0x2d')],null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x31')]=function(_0x50d60b,_0x259486){return db['Condition'][_0x6e70('0x2f')]({'where':{'id':_0x50d60b[_0x6e70('0x30')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x259486,null))['then'](removeEntity(_0x259486,null))[_0x6e70('0x32')](handleError(_0x259486,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 1c3ebeb..431bdc4 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 _0xf4e3=['path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x705b7e,_0x409ae1){var _0x479da5=function(_0x136e8b){while(--_0x136e8b){_0x705b7e['push'](_0x705b7e['shift']());}};_0x479da5(++_0x409ae1);}(_0xf4e3,0x1ca));var _0x3f4e=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0xf4e3[_0x485201];return _0x9ca98a;};'use strict';var _=require(_0x3f4e('0x0'));var util=require(_0x3f4e('0x1'));var logger=require(_0x3f4e('0x2'))(_0x3f4e('0x3'));var moment=require(_0x3f4e('0x4'));var BPromise=require(_0x3f4e('0x5'));var rp=require(_0x3f4e('0x6'));var fs=require('fs');var path=require(_0x3f4e('0x7'));var rimraf=require(_0x3f4e('0x8'));var config=require(_0x3f4e('0x9'));var attributes=require(_0x3f4e('0xa'));module[_0x3f4e('0xb')]=function(_0x32cb61,_0x2df5d9){return _0x32cb61[_0x3f4e('0xc')](_0x3f4e('0xd'),attributes,{'tableName':_0x3f4e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc216=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash'];(function(_0x40ab7a,_0x1a2edf){var _0x2f2790=function(_0x1c1118){while(--_0x1c1118){_0x40ab7a['push'](_0x40ab7a['shift']());}};_0x2f2790(++_0x1a2edf);}(_0xc216,0x192));var _0x6c21=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xc216[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x6c21('0x0'));var util=require(_0x6c21('0x1'));var logger=require(_0x6c21('0x2'))(_0x6c21('0x3'));var moment=require(_0x6c21('0x4'));var BPromise=require(_0x6c21('0x5'));var rp=require(_0x6c21('0x6'));var fs=require('fs');var path=require(_0x6c21('0x7'));var rimraf=require('rimraf');var config=require(_0x6c21('0x8'));var attributes=require(_0x6c21('0x9'));module[_0x6c21('0xa')]=function(_0x47e19a,_0x286c4b){return _0x47e19a['define'](_0x6c21('0xb'),attributes,{'tableName':_0x6c21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index a6c9b48..ee614fe 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 _0x4bb7=['request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x4bb7,0x114));var _0x74bb=function(_0x54581c,_0x278379){_0x54581c=_0x54581c-0x0;var _0x115c83=_0x4bb7[_0x54581c];return _0x115c83;};'use strict';var _=require(_0x74bb('0x0'));var util=require(_0x74bb('0x1'));var moment=require(_0x74bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x74bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x74bb('0x4'));var logger=require(_0x74bb('0x5'))(_0x74bb('0x6'));var config=require('../../config/environment');var jayson=require(_0x74bb('0x7'));var client=jayson[_0x74bb('0x8')][_0x74bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f77a2,_0x327444,_0x331b8a){return new BPromise(function(_0x35bc67,_0x3f7a78){return client[_0x74bb('0xa')](_0x2f77a2,_0x331b8a)[_0x74bb('0xb')](function(_0x3e383b){logger[_0x74bb('0xc')]('Condition,\x20%s,\x20%s',_0x327444,_0x74bb('0xd'));logger[_0x74bb('0xe')](_0x74bb('0xf'),_0x327444,_0x74bb('0xd'),JSON[_0x74bb('0x10')](_0x3e383b));if(_0x3e383b[_0x74bb('0x11')]){if(_0x3e383b[_0x74bb('0x11')][_0x74bb('0x12')]===0x1f4){logger[_0x74bb('0x11')](_0x74bb('0x13'),_0x327444,_0x3e383b[_0x74bb('0x11')][_0x74bb('0x14')]);return _0x3f7a78(_0x3e383b[_0x74bb('0x11')][_0x74bb('0x14')]);}logger[_0x74bb('0x11')]('Condition,\x20%s,\x20%s',_0x327444,_0x3e383b[_0x74bb('0x11')]['message']);return _0x35bc67(_0x3e383b['error'][_0x74bb('0x14')]);}else{logger[_0x74bb('0xc')](_0x74bb('0x13'),_0x327444,_0x74bb('0xd'));_0x35bc67(_0x3e383b[_0x74bb('0x15')][_0x74bb('0x14')]);}})['catch'](function(_0x5a97d1){logger[_0x74bb('0x11')](_0x74bb('0x13'),_0x327444,_0x5a97d1);_0x3f7a78(_0x5a97d1);});});} \ No newline at end of file +var _0x3905=['stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','request','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3905,0xd2));var _0x5390=function(_0x43073b,_0x26cd7c){_0x43073b=_0x43073b-0x0;var _0x5210e3=_0x3905[_0x43073b];return _0x5210e3;};'use strict';var _=require(_0x5390('0x0'));var util=require(_0x5390('0x1'));var moment=require('moment');var BPromise=require(_0x5390('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5390('0x3'))['db'];var utils=require(_0x5390('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5390('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55702c,_0x1042ee,_0x1a4d3d){return new BPromise(function(_0x3bf683,_0x2b76ef){return client[_0x5390('0x6')](_0x55702c,_0x1a4d3d)['then'](function(_0x26d257){logger[_0x5390('0x7')](_0x5390('0x8'),_0x1042ee,_0x5390('0x9'));logger['debug'](_0x5390('0xa'),_0x1042ee,'request\x20sent',JSON[_0x5390('0xb')](_0x26d257));if(_0x26d257['error']){if(_0x26d257[_0x5390('0xc')][_0x5390('0xd')]===0x1f4){logger[_0x5390('0xc')](_0x5390('0x8'),_0x1042ee,_0x26d257[_0x5390('0xc')][_0x5390('0xe')]);return _0x2b76ef(_0x26d257['error']['message']);}logger[_0x5390('0xc')](_0x5390('0x8'),_0x1042ee,_0x26d257[_0x5390('0xc')][_0x5390('0xe')]);return _0x3bf683(_0x26d257[_0x5390('0xc')][_0x5390('0xe')]);}else{logger[_0x5390('0x7')](_0x5390('0x8'),_0x1042ee,_0x5390('0x9'));_0x3bf683(_0x26d257[_0x5390('0xf')]['message']);}})[_0x5390('0x10')](function(_0x1c03b7){logger[_0x5390('0xc')](_0x5390('0x8'),_0x1042ee,_0x1c03b7);_0x2b76ef(_0x1c03b7);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index cf580a5..bb0e87b 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','/:id','destroy','multer','util','path','express'];(function(_0x53458f,_0x25da3e){var _0x5c852f=function(_0x5da602){while(--_0x5da602){_0x53458f['push'](_0x53458f['shift']());}};_0x5c852f(++_0x25da3e);}(_0x7a54,0x106));var _0x47a5=function(_0xb5ac99,_0x37b032){_0xb5ac99=_0xb5ac99-0x0;var _0x503536=_0x7a54[_0xb5ac99];return _0x503536;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/:id',auth[_0x47a5('0xa')](),controller['update']);router[_0x47a5('0xb')](_0x47a5('0xc'),auth['isAuthenticated'](),controller[_0x47a5('0xd')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index f3b3391..47e3f0f 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94b1=['INTEGER','STRING','exports','name'];(function(_0x5019f5,_0x442d61){var _0x2dbe2d=function(_0x908d18){while(--_0x908d18){_0x5019f5['push'](_0x5019f5['shift']());}};_0x2dbe2d(++_0x442d61);}(_0x94b1,0x102));var _0x194b=function(_0x319c97,_0x28914c){_0x319c97=_0x319c97-0x0;var _0xc91fa8=_0x94b1[_0x319c97];return _0xc91fa8;};'use strict';var Sequelize=require('sequelize');module[_0x194b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x194b('0x1')},'OrderBy':{'type':Sequelize[_0x194b('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x194b('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x7119=['name','STRING','exports'];(function(_0x5e6ebe,_0x373752){var _0x5d80a0=function(_0x145677){while(--_0x145677){_0x5e6ebe['push'](_0x5e6ebe['shift']());}};_0x5d80a0(++_0x373752);}(_0x7119,0x1c7));var _0x9711=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x7119[_0x359377];return _0x8be18a;};'use strict';var Sequelize=require('sequelize');module[_0x9711('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9711('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9711('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 32fbffd..49bd4e2 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a7f=['save','update','then','destroy','ContactItemTypes','UserProfileResource','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','catch','show','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','limit','undefined','count','status','Content-Range','apply'];(function(_0x4327e4,_0x1e662c){var _0x482b14=function(_0x515bea){while(--_0x515bea){_0x4327e4['push'](_0x4327e4['shift']());}};_0x482b14(++_0x1e662c);}(_0x7a7f,0x139));var _0xf7a7=function(_0x158c04,_0x2443c2){_0x158c04=_0x158c04-0x0;var _0x470fbe=_0x7a7f[_0x158c04];return _0x470fbe;};'use strict';var emlformat=require(_0xf7a7('0x0'));var rimraf=require(_0xf7a7('0x1'));var zipdir=require(_0xf7a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7a7('0x3'));var moment=require('moment');var BPromise=require(_0xf7a7('0x4'));var Mustache=require(_0xf7a7('0x5'));var util=require(_0xf7a7('0x6'));var path=require(_0xf7a7('0x7'));var sox=require(_0xf7a7('0x8'));var csv=require(_0xf7a7('0x9'));var ejs=require(_0xf7a7('0xa'));var fs=require('fs');var fs_extra=require(_0xf7a7('0xb'));var _=require(_0xf7a7('0xc'));var squel=require(_0xf7a7('0xd'));var crypto=require(_0xf7a7('0xe'));var jsforce=require(_0xf7a7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf7a7('0x10'));var Papa=require(_0xf7a7('0x11'));var Redis=require(_0xf7a7('0x12'));var authService=require(_0xf7a7('0x13'));var qs=require(_0xf7a7('0x14'));var as=require(_0xf7a7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf7a7('0x16'));var utils=require(_0xf7a7('0x17'));var config=require(_0xf7a7('0x18'));var licenseUtil=require(_0xf7a7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27c04d,_0x105b5c){_0x105b5c=_0x105b5c||0xcc;return function(_0x868723){if(_0x868723){return _0x27c04d['sendStatus'](_0x105b5c);}return _0x27c04d['status'](_0x105b5c)[_0xf7a7('0x1a')]();};}function respondWithResult(_0x5e43a7,_0x731ebd){_0x731ebd=_0x731ebd||0xc8;return function(_0x4e7a63){if(_0x4e7a63){return _0x5e43a7['status'](_0x731ebd)[_0xf7a7('0x1b')](_0x4e7a63);}};}function respondWithFilteredResult(_0xc1821d,_0x1c5067){return function(_0x56c42f){if(_0x56c42f){var _0x491ca5=typeof _0x1c5067[_0xf7a7('0x1c')]==='undefined'&&typeof _0x1c5067[_0xf7a7('0x1d')]===_0xf7a7('0x1e');var _0x430a68=_0x56c42f[_0xf7a7('0x1f')];var _0x385b70=_0x491ca5?0x0:_0x1c5067[_0xf7a7('0x1c')];var _0x203342=_0x491ca5?_0x56c42f[_0xf7a7('0x1f')]:_0x1c5067[_0xf7a7('0x1c')]+_0x1c5067[_0xf7a7('0x1d')];var _0x25f34d;if(_0x203342>=_0x430a68){_0x203342=_0x430a68;_0x25f34d=0xc8;}else{_0x25f34d=0xce;}_0xc1821d[_0xf7a7('0x20')](_0x25f34d);return _0xc1821d['set'](_0xf7a7('0x21'),_0x385b70+'-'+_0x203342+'/'+_0x430a68)[_0xf7a7('0x1b')](_0x56c42f);}return null;};}function patchUpdates(_0x180697){return function(_0x5e2f6c){try{jsonpatch[_0xf7a7('0x22')](_0x5e2f6c,_0x180697,!![]);}catch(_0xa0037){return BPromise['reject'](_0xa0037);}return _0x5e2f6c[_0xf7a7('0x23')]();};}function saveUpdates(_0x3bc60d,_0x1df40f){return function(_0x4b46d9){if(_0x4b46d9){return _0x4b46d9[_0xf7a7('0x24')](_0x3bc60d)[_0xf7a7('0x25')](function(_0x3f0da2){return _0x3f0da2;});}return null;};}function removeEntity(_0x52541d,_0x1bd94c){return function(_0x1deec4){if(_0x1deec4){return _0x1deec4[_0xf7a7('0x26')]()[_0xf7a7('0x25')](function(){var _0x311fd0=_0x1deec4['get']({'plain':!![]});var _0x54373c=_0xf7a7('0x27');return db[_0xf7a7('0x28')][_0xf7a7('0x26')]({'where':{'type':_0x54373c,'resourceId':_0x311fd0['id']}})[_0xf7a7('0x25')](function(){return _0x1deec4;});})[_0xf7a7('0x25')](function(){_0x52541d[_0xf7a7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250b0f,_0x4a1a50){return function(_0x6d4f91){if(!_0x6d4f91){_0x250b0f[_0xf7a7('0x29')](0x194);}return _0x6d4f91;};}function handleError(_0x416cda,_0x28fc3e){_0x28fc3e=_0x28fc3e||0x1f4;return function(_0x3d27a0){logger['error'](_0x3d27a0[_0xf7a7('0x2a')]);if(_0x3d27a0['name']){delete _0x3d27a0[_0xf7a7('0x2b')];}_0x416cda[_0xf7a7('0x20')](_0x28fc3e)[_0xf7a7('0x2c')](_0x3d27a0);};}exports[_0xf7a7('0x2d')]=function(_0x40b365,_0x1a298b){var _0x1c0128={},_0x922dea={},_0x385b5b={'count':0x0,'rows':[]};var _0x11a7d7=_[_0xf7a7('0x2e')](db[_0xf7a7('0x2f')][_0xf7a7('0x30')],function(_0x50c376){return{'name':_0x50c376[_0xf7a7('0x31')],'type':_0x50c376[_0xf7a7('0x32')][_0xf7a7('0x33')]};});_0x922dea[_0xf7a7('0x34')]=_['map'](_0x11a7d7,_0xf7a7('0x2b'));_0x922dea[_0xf7a7('0x35')]=_[_0xf7a7('0x36')](_0x40b365['query']);_0x922dea[_0xf7a7('0x37')]=_[_0xf7a7('0x38')](_0x922dea['model'],_0x922dea[_0xf7a7('0x35')]);_0x1c0128[_0xf7a7('0x39')]=_[_0xf7a7('0x38')](_0x922dea[_0xf7a7('0x34')],qs[_0xf7a7('0x3a')](_0x40b365[_0xf7a7('0x35')][_0xf7a7('0x3a')]));_0x1c0128[_0xf7a7('0x39')]=_0x1c0128['attributes'][_0xf7a7('0x3b')]?_0x1c0128[_0xf7a7('0x39')]:_0x922dea[_0xf7a7('0x34')];if(!_0x40b365[_0xf7a7('0x35')][_0xf7a7('0x3c')](_0xf7a7('0x3d'))){_0x1c0128['limit']=qs[_0xf7a7('0x1d')](_0x40b365[_0xf7a7('0x35')]['limit']);_0x1c0128[_0xf7a7('0x1c')]=qs[_0xf7a7('0x1c')](_0x40b365[_0xf7a7('0x35')][_0xf7a7('0x1c')]);}_0x1c0128[_0xf7a7('0x3e')]=qs[_0xf7a7('0x3f')](_0x40b365[_0xf7a7('0x35')][_0xf7a7('0x3f')]);_0x1c0128[_0xf7a7('0x40')]=qs[_0xf7a7('0x37')](_[_0xf7a7('0x41')](_0x40b365[_0xf7a7('0x35')],_0x922dea['filters']),_0x11a7d7);if(_0x40b365[_0xf7a7('0x35')]['filter']){_0x1c0128[_0xf7a7('0x40')]=_['merge'](_0x1c0128['where'],{'$or':_['map'](_0x11a7d7,function(_0x12364e){if(_0x12364e[_0xf7a7('0x32')]!==_0xf7a7('0x42')){var _0x6c7205={};_0x6c7205[_0x12364e['name']]={'$like':'%'+_0x40b365[_0xf7a7('0x35')][_0xf7a7('0x43')]+'%'};return _0x6c7205;}})});}_0x1c0128=_['merge']({},_0x1c0128,_0x40b365[_0xf7a7('0x44')]);var _0x24c24c={'where':_0x1c0128[_0xf7a7('0x40')]};return db[_0xf7a7('0x2f')][_0xf7a7('0x1f')](_0x24c24c)[_0xf7a7('0x25')](function(_0x978d0a){_0x385b5b['count']=_0x978d0a;if(_0x40b365[_0xf7a7('0x35')][_0xf7a7('0x45')]){_0x1c0128['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x1c0128);})[_0xf7a7('0x25')](function(_0x2dcbbd){_0x385b5b['rows']=_0x2dcbbd;return _0x385b5b;})[_0xf7a7('0x25')](respondWithFilteredResult(_0x1a298b,_0x1c0128))[_0xf7a7('0x46')](handleError(_0x1a298b,null));};exports[_0xf7a7('0x47')]=function(_0x192612,_0x33134d){var _0x1c6b8b={'raw':!![],'where':{'id':_0x192612['params']['id']}},_0x11fe37={};_0x11fe37[_0xf7a7('0x34')]=_['keys'](db[_0xf7a7('0x2f')][_0xf7a7('0x30')]);_0x11fe37[_0xf7a7('0x35')]=_['keys'](_0x192612[_0xf7a7('0x35')]);_0x11fe37[_0xf7a7('0x37')]=_[_0xf7a7('0x38')](_0x11fe37[_0xf7a7('0x34')],_0x11fe37[_0xf7a7('0x35')]);_0x1c6b8b[_0xf7a7('0x39')]=_[_0xf7a7('0x38')](_0x11fe37[_0xf7a7('0x34')],qs[_0xf7a7('0x3a')](_0x192612[_0xf7a7('0x35')][_0xf7a7('0x3a')]));_0x1c6b8b['attributes']=_0x1c6b8b['attributes']['length']?_0x1c6b8b[_0xf7a7('0x39')]:_0x11fe37[_0xf7a7('0x34')];if(_0x192612[_0xf7a7('0x35')]['includeAll']){_0x1c6b8b[_0xf7a7('0x48')]=[{'all':!![]}];}_0x1c6b8b=_[_0xf7a7('0x49')]({},_0x1c6b8b,_0x192612['options']);return db[_0xf7a7('0x2f')][_0xf7a7('0x4a')](_0x1c6b8b)['then'](handleEntityNotFound(_0x33134d,null))['then'](respondWithResult(_0x33134d,null))[_0xf7a7('0x46')](handleError(_0x33134d,null));};exports[_0xf7a7('0x4b')]=function(_0x49a959,_0x31a50a){return db[_0xf7a7('0x2f')]['create'](_0x49a959[_0xf7a7('0x4c')],{})[_0xf7a7('0x25')](function(_0x4ed60a){var _0x225bc1=_0x49a959[_0xf7a7('0x4d')][_0xf7a7('0x4e')]({'plain':!![]});if(!_0x225bc1)throw new Error(_0xf7a7('0x4f'));if(_0x225bc1[_0xf7a7('0x50')]==='user'){var _0x363a3d=_0x4ed60a[_0xf7a7('0x4e')]({'plain':!![]});var _0x50f259=_0xf7a7('0x27');return db[_0xf7a7('0x51')][_0xf7a7('0x4a')]({'where':{'name':_0x50f259,'userProfileId':_0x225bc1[_0xf7a7('0x52')]},'raw':!![]})[_0xf7a7('0x25')](function(_0x444acd){if(_0x444acd&&_0x444acd[_0xf7a7('0x53')]===0x0){return db[_0xf7a7('0x28')][_0xf7a7('0x4b')]({'name':_0x363a3d[_0xf7a7('0x2b')],'resourceId':_0x363a3d['id'],'type':_0x444acd['name'],'sectionId':_0x444acd['id']},{})[_0xf7a7('0x25')](function(){return _0x4ed60a;});}else{return _0x4ed60a;}})[_0xf7a7('0x46')](function(_0x2f9678){logger[_0xf7a7('0x54')](_0xf7a7('0x55'),_0x2f9678);throw _0x2f9678;});}return _0x4ed60a;})[_0xf7a7('0x25')](respondWithResult(_0x31a50a,0xc9))['catch'](handleError(_0x31a50a,null));};exports[_0xf7a7('0x24')]=function(_0x46a98e,_0x1b0ea7){if(_0x46a98e[_0xf7a7('0x4c')]['id']){delete _0x46a98e['body']['id'];}return db[_0xf7a7('0x2f')][_0xf7a7('0x4a')]({'where':{'id':_0x46a98e[_0xf7a7('0x56')]['id']}})[_0xf7a7('0x25')](handleEntityNotFound(_0x1b0ea7,null))[_0xf7a7('0x25')](saveUpdates(_0x46a98e[_0xf7a7('0x4c')],null))[_0xf7a7('0x25')](respondWithResult(_0x1b0ea7,null))[_0xf7a7('0x46')](handleError(_0x1b0ea7,null));};exports[_0xf7a7('0x26')]=function(_0x24597c,_0x10c0a4){return db[_0xf7a7('0x2f')][_0xf7a7('0x4a')]({'where':{'id':_0x24597c['params']['id']}})[_0xf7a7('0x25')](handleEntityNotFound(_0x10c0a4,null))['then'](removeEntity(_0x10c0a4,null))[_0xf7a7('0x46')](handleError(_0x10c0a4,null));}; \ No newline at end of file +var _0x4d26=['rimraf','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','ContactItemType','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','params','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','catch','eml-format'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4d26,0x1e5));var _0x64d2=function(_0x5f29f4,_0x57b9dd){_0x5f29f4=_0x5f29f4-0x0;var _0x25ecac=_0x4d26[_0x5f29f4];return _0x25ecac;};'use strict';var emlformat=require(_0x64d2('0x0'));var rimraf=require(_0x64d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x64d2('0x2'));var Mustache=require('mustache');var util=require(_0x64d2('0x3'));var path=require(_0x64d2('0x4'));var sox=require(_0x64d2('0x5'));var csv=require(_0x64d2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64d2('0x7'));var _=require(_0x64d2('0x8'));var squel=require(_0x64d2('0x9'));var crypto=require(_0x64d2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x64d2('0xb'));var toCsv=require(_0x64d2('0x6'));var querystring=require(_0x64d2('0xc'));var Papa=require(_0x64d2('0xd'));var Redis=require(_0x64d2('0xe'));var authService=require(_0x64d2('0xf'));var qs=require(_0x64d2('0x10'));var as=require(_0x64d2('0x11'));var hardwareService=require(_0x64d2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x64d2('0x13'));var config=require(_0x64d2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x64d2('0x15'))['db'];function respondWithStatusCode(_0x48bfa1,_0x4d6695){_0x4d6695=_0x4d6695||0xcc;return function(_0x27f636){if(_0x27f636){return _0x48bfa1[_0x64d2('0x16')](_0x4d6695);}return _0x48bfa1['status'](_0x4d6695)[_0x64d2('0x17')]();};}function respondWithResult(_0x182556,_0x4b7e59){_0x4b7e59=_0x4b7e59||0xc8;return function(_0x3c12d0){if(_0x3c12d0){return _0x182556[_0x64d2('0x18')](_0x4b7e59)[_0x64d2('0x19')](_0x3c12d0);}};}function respondWithFilteredResult(_0x16329b,_0x2a62d9){return function(_0x44b5b9){if(_0x44b5b9){var _0x22de94=typeof _0x2a62d9['offset']==='undefined'&&typeof _0x2a62d9[_0x64d2('0x1a')]===_0x64d2('0x1b');var _0x1bbc4c=_0x44b5b9[_0x64d2('0x1c')];var _0x9e2b0d=_0x22de94?0x0:_0x2a62d9[_0x64d2('0x1d')];var _0x2c7d18=_0x22de94?_0x44b5b9['count']:_0x2a62d9[_0x64d2('0x1d')]+_0x2a62d9[_0x64d2('0x1a')];var _0x7bc738;if(_0x2c7d18>=_0x1bbc4c){_0x2c7d18=_0x1bbc4c;_0x7bc738=0xc8;}else{_0x7bc738=0xce;}_0x16329b[_0x64d2('0x18')](_0x7bc738);return _0x16329b[_0x64d2('0x1e')](_0x64d2('0x1f'),_0x9e2b0d+'-'+_0x2c7d18+'/'+_0x1bbc4c)['json'](_0x44b5b9);}return null;};}function patchUpdates(_0x5d7800){return function(_0x391b80){try{jsonpatch[_0x64d2('0x20')](_0x391b80,_0x5d7800,!![]);}catch(_0x30ebfa){return BPromise[_0x64d2('0x21')](_0x30ebfa);}return _0x391b80[_0x64d2('0x22')]();};}function saveUpdates(_0x15cfc5,_0x40955e){return function(_0xbe979d){if(_0xbe979d){return _0xbe979d[_0x64d2('0x23')](_0x15cfc5)[_0x64d2('0x24')](function(_0x279302){return _0x279302;});}return null;};}function removeEntity(_0x161418,_0x4d0794){return function(_0x28666b){if(_0x28666b){return _0x28666b[_0x64d2('0x25')]()[_0x64d2('0x24')](function(){var _0x4a4fc9=_0x28666b[_0x64d2('0x26')]({'plain':!![]});var _0x2941cb=_0x64d2('0x27');return db[_0x64d2('0x28')][_0x64d2('0x25')]({'where':{'type':_0x2941cb,'resourceId':_0x4a4fc9['id']}})[_0x64d2('0x24')](function(){return _0x28666b;});})['then'](function(){_0x161418[_0x64d2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c90e3,_0x5c6ffa){return function(_0x14aa6c){if(!_0x14aa6c){_0x4c90e3['sendStatus'](0x194);}return _0x14aa6c;};}function handleError(_0x374aa3,_0x105cde){_0x105cde=_0x105cde||0x1f4;return function(_0x566210){logger[_0x64d2('0x29')](_0x566210[_0x64d2('0x2a')]);if(_0x566210[_0x64d2('0x2b')]){delete _0x566210['name'];}_0x374aa3[_0x64d2('0x18')](_0x105cde)['send'](_0x566210);};}exports['index']=function(_0x3dbbff,_0xe58288){var _0x18e43a={},_0x5405d4={},_0x462e3d={'count':0x0,'rows':[]};var _0x2c6783=_['map'](db[_0x64d2('0x2c')][_0x64d2('0x2d')],function(_0x24630b){return{'name':_0x24630b[_0x64d2('0x2e')],'type':_0x24630b['type'][_0x64d2('0x2f')]};});_0x5405d4[_0x64d2('0x30')]=_[_0x64d2('0x31')](_0x2c6783,_0x64d2('0x2b'));_0x5405d4[_0x64d2('0x32')]=_[_0x64d2('0x33')](_0x3dbbff[_0x64d2('0x32')]);_0x5405d4[_0x64d2('0x34')]=_['intersection'](_0x5405d4[_0x64d2('0x30')],_0x5405d4[_0x64d2('0x32')]);_0x18e43a[_0x64d2('0x35')]=_[_0x64d2('0x36')](_0x5405d4['model'],qs[_0x64d2('0x37')](_0x3dbbff[_0x64d2('0x32')]['fields']));_0x18e43a[_0x64d2('0x35')]=_0x18e43a[_0x64d2('0x35')]['length']?_0x18e43a[_0x64d2('0x35')]:_0x5405d4[_0x64d2('0x30')];if(!_0x3dbbff['query'][_0x64d2('0x38')](_0x64d2('0x39'))){_0x18e43a[_0x64d2('0x1a')]=qs[_0x64d2('0x1a')](_0x3dbbff[_0x64d2('0x32')][_0x64d2('0x1a')]);_0x18e43a[_0x64d2('0x1d')]=qs[_0x64d2('0x1d')](_0x3dbbff[_0x64d2('0x32')]['offset']);}_0x18e43a['order']=qs[_0x64d2('0x3a')](_0x3dbbff[_0x64d2('0x32')][_0x64d2('0x3a')]);_0x18e43a[_0x64d2('0x3b')]=qs[_0x64d2('0x34')](_[_0x64d2('0x3c')](_0x3dbbff[_0x64d2('0x32')],_0x5405d4[_0x64d2('0x34')]),_0x2c6783);if(_0x3dbbff[_0x64d2('0x32')][_0x64d2('0x3d')]){_0x18e43a[_0x64d2('0x3b')]=_[_0x64d2('0x3e')](_0x18e43a[_0x64d2('0x3b')],{'$or':_[_0x64d2('0x31')](_0x2c6783,function(_0x211c65){if(_0x211c65[_0x64d2('0x3f')]!==_0x64d2('0x40')){var _0x24a953={};_0x24a953[_0x211c65['name']]={'$like':'%'+_0x3dbbff[_0x64d2('0x32')][_0x64d2('0x3d')]+'%'};return _0x24a953;}})});}_0x18e43a=_[_0x64d2('0x3e')]({},_0x18e43a,_0x3dbbff[_0x64d2('0x41')]);var _0x482b09={'where':_0x18e43a[_0x64d2('0x3b')]};return db['ContactItemType'][_0x64d2('0x1c')](_0x482b09)['then'](function(_0xc7c40){_0x462e3d[_0x64d2('0x1c')]=_0xc7c40;if(_0x3dbbff['query']['includeAll']){_0x18e43a[_0x64d2('0x42')]=[{'all':!![]}];}return db[_0x64d2('0x2c')][_0x64d2('0x43')](_0x18e43a);})[_0x64d2('0x24')](function(_0x4e23bd){_0x462e3d['rows']=_0x4e23bd;return _0x462e3d;})[_0x64d2('0x24')](respondWithFilteredResult(_0xe58288,_0x18e43a))['catch'](handleError(_0xe58288,null));};exports['show']=function(_0x5276c4,_0x5705f6){var _0x735fb9={'raw':!![],'where':{'id':_0x5276c4[_0x64d2('0x44')]['id']}},_0x984f1e={};_0x984f1e[_0x64d2('0x30')]=_['keys'](db['ContactItemType'][_0x64d2('0x2d')]);_0x984f1e[_0x64d2('0x32')]=_[_0x64d2('0x33')](_0x5276c4[_0x64d2('0x32')]);_0x984f1e['filters']=_[_0x64d2('0x36')](_0x984f1e[_0x64d2('0x30')],_0x984f1e[_0x64d2('0x32')]);_0x735fb9['attributes']=_['intersection'](_0x984f1e['model'],qs[_0x64d2('0x37')](_0x5276c4[_0x64d2('0x32')][_0x64d2('0x37')]));_0x735fb9[_0x64d2('0x35')]=_0x735fb9[_0x64d2('0x35')]['length']?_0x735fb9[_0x64d2('0x35')]:_0x984f1e[_0x64d2('0x30')];if(_0x5276c4[_0x64d2('0x32')][_0x64d2('0x45')]){_0x735fb9[_0x64d2('0x42')]=[{'all':!![]}];}_0x735fb9=_[_0x64d2('0x3e')]({},_0x735fb9,_0x5276c4[_0x64d2('0x41')]);return db[_0x64d2('0x2c')][_0x64d2('0x46')](_0x735fb9)[_0x64d2('0x24')](handleEntityNotFound(_0x5705f6,null))[_0x64d2('0x24')](respondWithResult(_0x5705f6,null))['catch'](handleError(_0x5705f6,null));};exports['create']=function(_0x4ba76a,_0x3c068f){return db['ContactItemType'][_0x64d2('0x47')](_0x4ba76a[_0x64d2('0x48')],{})[_0x64d2('0x24')](function(_0xbec566){var _0x1ae93a=_0x4ba76a[_0x64d2('0x49')][_0x64d2('0x26')]({'plain':!![]});if(!_0x1ae93a)throw new Error(_0x64d2('0x4a'));if(_0x1ae93a[_0x64d2('0x4b')]===_0x64d2('0x49')){var _0x5d2a8f=_0xbec566[_0x64d2('0x26')]({'plain':!![]});var _0x3f3f3d='ContactItemTypes';return db[_0x64d2('0x4c')]['find']({'where':{'name':_0x3f3f3d,'userProfileId':_0x1ae93a[_0x64d2('0x4d')]},'raw':!![]})['then'](function(_0xcacff5){if(_0xcacff5&&_0xcacff5[_0x64d2('0x4e')]===0x0){return db[_0x64d2('0x28')]['create']({'name':_0x5d2a8f['name'],'resourceId':_0x5d2a8f['id'],'type':_0xcacff5[_0x64d2('0x2b')],'sectionId':_0xcacff5['id']},{})[_0x64d2('0x24')](function(){return _0xbec566;});}else{return _0xbec566;}})['catch'](function(_0x4eb37b){logger[_0x64d2('0x29')](_0x64d2('0x4f'),_0x4eb37b);throw _0x4eb37b;});}return _0xbec566;})[_0x64d2('0x24')](respondWithResult(_0x3c068f,0xc9))[_0x64d2('0x50')](handleError(_0x3c068f,null));};exports['update']=function(_0x2f0a41,_0x34dd06){if(_0x2f0a41[_0x64d2('0x48')]['id']){delete _0x2f0a41['body']['id'];}return db[_0x64d2('0x2c')]['find']({'where':{'id':_0x2f0a41['params']['id']}})['then'](handleEntityNotFound(_0x34dd06,null))['then'](saveUpdates(_0x2f0a41[_0x64d2('0x48')],null))[_0x64d2('0x24')](respondWithResult(_0x34dd06,null))[_0x64d2('0x50')](handleError(_0x34dd06,null));};exports[_0x64d2('0x25')]=function(_0x26f163,_0x3e4289){return db['ContactItemType'][_0x64d2('0x46')]({'where':{'id':_0x26f163[_0x64d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e4289,null))[_0x64d2('0x24')](removeEntity(_0x3e4289,null))[_0x64d2('0x50')](handleError(_0x3e4289,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index cc66b73..d9aa557 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x029b=['define','tools_contact_item_types','lodash','util','api','moment','request-promise','path','./contactItemType.attributes','exports'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x029b,0x66));var _0xb029=function(_0x5bf019,_0x3dd881){_0x5bf019=_0x5bf019-0x0;var _0x5a7e36=_0x029b[_0x5bf019];return _0x5a7e36;};'use strict';var _=require(_0xb029('0x0'));var util=require(_0xb029('0x1'));var logger=require('../../config/logger')(_0xb029('0x2'));var moment=require(_0xb029('0x3'));var BPromise=require('bluebird');var rp=require(_0xb029('0x4'));var fs=require('fs');var path=require(_0xb029('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb029('0x6'));module[_0xb029('0x7')]=function(_0x7836f0,_0x448fc5){return _0x7836f0[_0xb029('0x8')]('ContactItemType',attributes,{'tableName':_0xb029('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8a5=['tools_contact_item_types','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType'];(function(_0x14cedd,_0x3a140d){var _0x538193=function(_0x47138d){while(--_0x47138d){_0x14cedd['push'](_0x14cedd['shift']());}};_0x538193(++_0x3a140d);}(_0xd8a5,0x160));var _0x5d8a=function(_0x147821,_0x2a0e02){_0x147821=_0x147821-0x0;var _0x397a33=_0xd8a5[_0x147821];return _0x397a33;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var logger=require(_0x5d8a('0x1'))(_0x5d8a('0x2'));var moment=require('moment');var BPromise=require(_0x5d8a('0x3'));var rp=require(_0x5d8a('0x4'));var fs=require('fs');var path=require(_0x5d8a('0x5'));var rimraf=require(_0x5d8a('0x6'));var config=require(_0x5d8a('0x7'));var attributes=require(_0x5d8a('0x8'));module[_0x5d8a('0x9')]=function(_0x38eaa5,_0x1ef405){return _0x38eaa5[_0x5d8a('0xa')](_0x5d8a('0xb'),attributes,{'tableName':_0x5d8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 40b6cec..c335eaf 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e54=['rpc','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0x2e54,0x1dd));var _0x42e5=function(_0x202c1c,_0x387180){_0x202c1c=_0x202c1c-0x0;var _0x39c337=_0x2e54[_0x202c1c];return _0x39c337;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});} \ No newline at end of file +var _0x1752=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird'];(function(_0xabc97f,_0x3516d8){var _0x62c64e=function(_0x5a7a3b){while(--_0x5a7a3b){_0xabc97f['push'](_0xabc97f['shift']());}};_0x62c64e(++_0x3516d8);}(_0x1752,0xa5));var _0x2175=function(_0x1fe591,_0x25824e){_0x1fe591=_0x1fe591-0x0;var _0x20851a=_0x1752[_0x1fe591];return _0x20851a;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var moment=require(_0x2175('0x1'));var BPromise=require(_0x2175('0x2'));var rs=require(_0x2175('0x3'));var fs=require('fs');var Redis=require(_0x2175('0x4'));var db=require(_0x2175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2175('0x6'))(_0x2175('0x7'));var config=require(_0x2175('0x8'));var jayson=require(_0x2175('0x9'));var client=jayson[_0x2175('0xa')][_0x2175('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19ca87,_0x1bd937,_0x339e4d){return new BPromise(function(_0x672ff1,_0x516ccc){return client[_0x2175('0xc')](_0x19ca87,_0x339e4d)[_0x2175('0xd')](function(_0x407a71){logger[_0x2175('0xe')](_0x2175('0xf'),_0x1bd937,'request\x20sent');logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1bd937,_0x2175('0x10'),JSON['stringify'](_0x407a71));if(_0x407a71['error']){if(_0x407a71['error']['code']===0x1f4){logger[_0x2175('0x11')]('ContactItemType,\x20%s,\x20%s',_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x516ccc(_0x407a71['error'][_0x2175('0x12')]);}logger[_0x2175('0x11')](_0x2175('0xf'),_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x672ff1(_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);}else{logger[_0x2175('0xe')]('ContactItemType,\x20%s,\x20%s',_0x1bd937,'request\x20sent');_0x672ff1(_0x407a71[_0x2175('0x13')][_0x2175('0x12')]);}})[_0x2175('0x14')](function(_0x4e7cf1){logger['error']('ContactItemType,\x20%s,\x20%s',_0x1bd937,_0x4e7cf1);_0x516ccc(_0x4e7cf1);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6e0574f..d5340da 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x742b=['index','isAuthenticated','show','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x464bf4,_0xad3695){var _0x3bc2ca=function(_0x15f906){while(--_0x15f906){_0x464bf4['push'](_0x464bf4['shift']());}};_0x3bc2ca(++_0xad3695);}(_0x742b,0x13b));var _0xb742=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x742b[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xb742('0x0'));var util=require(_0xb742('0x1'));var path=require(_0xb742('0x2'));var timeout=require(_0xb742('0x3'));var express=require(_0xb742('0x4'));var router=express[_0xb742('0x5')]();var fs_extra=require(_0xb742('0x6'));var auth=require(_0xb742('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xb742('0x8')]('/',auth['isAuthenticated'](),controller[_0xb742('0x9')]);router[_0xb742('0x8')]('/:id',auth[_0xb742('0xa')](),controller[_0xb742('0xb')]);router[_0xb742('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb742('0xd')](_0xb742('0xe'),auth[_0xb742('0xa')](),controller[_0xb742('0xf')]);router['delete'](_0xb742('0xe'),auth[_0xb742('0xa')](),controller[_0xb742('0x10')]);module[_0xb742('0x11')]=router; \ No newline at end of file +var _0x904b=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','/:id','isAuthenticated','show','create','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x904b,0x1b7));var _0xb904=function(_0x30a7db,_0x792028){_0x30a7db=_0x30a7db-0x0;var _0x372054=_0x904b[_0x30a7db];return _0x372054;};'use strict';var multer=require(_0xb904('0x0'));var util=require(_0xb904('0x1'));var path=require('path');var timeout=require(_0xb904('0x2'));var express=require(_0xb904('0x3'));var router=express[_0xb904('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb904('0x5'));var interaction=require(_0xb904('0x6'));var config=require(_0xb904('0x7'));var controller=require(_0xb904('0x8'));router[_0xb904('0x9')]('/',auth['isAuthenticated'](),controller[_0xb904('0xa')]);router['get'](_0xb904('0xb'),auth[_0xb904('0xc')](),controller[_0xb904('0xd')]);router['post']('/',auth[_0xb904('0xc')](),controller[_0xb904('0xe')]);router['put'](_0xb904('0xb'),auth[_0xb904('0xc')](),controller[_0xb904('0xf')]);router[_0xb904('0x10')](_0xb904('0xb'),auth['isAuthenticated'](),controller[_0xb904('0x11')]);module[_0xb904('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 40c8887..e6685b4 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 _0x7edb=['STRING','name','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7edb,0x158));var _0xb7ed=function(_0xd0d9ab,_0x45da3a){_0xd0d9ab=_0xd0d9ab-0x0;var _0x20795b=_0x7edb[_0xd0d9ab];return _0x20795b;};'use strict';var Sequelize=require('sequelize');module[_0xb7ed('0x0')]={'name':{'type':Sequelize[_0xb7ed('0x1')],'allowNull':![],'unique':_0xb7ed('0x2')},'description':{'type':Sequelize[_0xb7ed('0x1')]}}; \ No newline at end of file +var _0x3cdc=['STRING','name','exports'];(function(_0x47eb47,_0x662f71){var _0x3876db=function(_0x50f2ae){while(--_0x50f2ae){_0x47eb47['push'](_0x47eb47['shift']());}};_0x3876db(++_0x662f71);}(_0x3cdc,0x18b));var _0xc3cd=function(_0x13b948,_0x2a5a86){_0x13b948=_0x13b948-0x0;var _0x2f0044=_0x3cdc[_0x13b948];return _0x2f0044;};'use strict';var Sequelize=require('sequelize');module[_0xc3cd('0x0')]={'name':{'type':Sequelize[_0xc3cd('0x1')],'allowNull':![],'unique':_0xc3cd('0x2')},'description':{'type':Sequelize[_0xc3cd('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index e760ae4..0708d39 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 _0xc661=['set','Content-Range','apply','reject','save','then','CustomDashboards','UserProfileResource','destroy','sendStatus','error','name','send','index','Dashboard','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','end','offset','undefined','limit','count','status'];(function(_0x1b3f52,_0x4f5b13){var _0x36bf2c=function(_0x2c8426){while(--_0x2c8426){_0x1b3f52['push'](_0x1b3f52['shift']());}};_0x36bf2c(++_0x4f5b13);}(_0xc661,0x1a5));var _0x1c66=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xc661[_0x62c958];return _0x57ec61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c66('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c66('0x1'));var rp=require(_0x1c66('0x2'));var moment=require(_0x1c66('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1c66('0x4'));var util=require(_0x1c66('0x5'));var path=require(_0x1c66('0x6'));var sox=require(_0x1c66('0x7'));var csv=require('to-csv');var ejs=require(_0x1c66('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c66('0x9'));var squel=require(_0x1c66('0xa'));var crypto=require(_0x1c66('0xb'));var jsforce=require(_0x1c66('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c66('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c66('0xe'));var authService=require(_0x1c66('0xf'));var qs=require(_0x1c66('0x10'));var as=require(_0x1c66('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1c66('0x12'));var utils=require(_0x1c66('0x13'));var config=require(_0x1c66('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c66('0x15'))['db'];config[_0x1c66('0x16')]=_[_0x1c66('0x17')](config[_0x1c66('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c66('0x18'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x4d1ed4,_0x1a315a){_0x1a315a=_0x1a315a||0xcc;return function(_0x5aa2e8){if(_0x5aa2e8){return _0x4d1ed4['sendStatus'](_0x1a315a);}return _0x4d1ed4['status'](_0x1a315a)[_0x1c66('0x19')]();};}function respondWithResult(_0x54970a,_0x23b761){_0x23b761=_0x23b761||0xc8;return function(_0x2a852f){if(_0x2a852f){return _0x54970a['status'](_0x23b761)['json'](_0x2a852f);}};}function respondWithFilteredResult(_0x29c0cc,_0x11d9c9){return function(_0x370919){if(_0x370919){var _0x171de2=typeof _0x11d9c9[_0x1c66('0x1a')]===_0x1c66('0x1b')&&typeof _0x11d9c9[_0x1c66('0x1c')]===_0x1c66('0x1b');var _0x3692c3=_0x370919[_0x1c66('0x1d')];var _0x46efc4=_0x171de2?0x0:_0x11d9c9['offset'];var _0x1c8e1a=_0x171de2?_0x370919[_0x1c66('0x1d')]:_0x11d9c9[_0x1c66('0x1a')]+_0x11d9c9['limit'];var _0x6e17a0;if(_0x1c8e1a>=_0x3692c3){_0x1c8e1a=_0x3692c3;_0x6e17a0=0xc8;}else{_0x6e17a0=0xce;}_0x29c0cc[_0x1c66('0x1e')](_0x6e17a0);return _0x29c0cc[_0x1c66('0x1f')](_0x1c66('0x20'),_0x46efc4+'-'+_0x1c8e1a+'/'+_0x3692c3)['json'](_0x370919);}return null;};}function patchUpdates(_0x49f292){return function(_0x3ea94e){try{jsonpatch[_0x1c66('0x21')](_0x3ea94e,_0x49f292,!![]);}catch(_0x49ddf8){return BPromise[_0x1c66('0x22')](_0x49ddf8);}return _0x3ea94e[_0x1c66('0x23')]();};}function saveUpdates(_0x547123,_0x57dbf4){return function(_0x48d767){if(_0x48d767){return _0x48d767['update'](_0x547123)[_0x1c66('0x24')](function(_0x1ded22){return _0x1ded22;});}return null;};}function removeEntity(_0x59926f,_0x587782){return function(_0x4e6325){if(_0x4e6325){return _0x4e6325['destroy']()[_0x1c66('0x24')](function(){var _0x40b516=_0x4e6325['get']({'plain':!![]});var _0x7bf486=_0x1c66('0x25');return db[_0x1c66('0x26')][_0x1c66('0x27')]({'where':{'type':_0x7bf486,'resourceId':_0x40b516['id']}})[_0x1c66('0x24')](function(){return _0x4e6325;});})['then'](function(){_0x59926f[_0x1c66('0x1e')](0xcc)[_0x1c66('0x19')]();});}};}function handleEntityNotFound(_0x477811,_0x19a4ce){return function(_0x470d7c){if(!_0x470d7c){_0x477811[_0x1c66('0x28')](0x194);}return _0x470d7c;};}function handleError(_0x5da24b,_0xc0d6f0){_0xc0d6f0=_0xc0d6f0||0x1f4;return function(_0x95327){logger[_0x1c66('0x29')](_0x95327['stack']);if(_0x95327['name']){delete _0x95327[_0x1c66('0x2a')];}_0x5da24b['status'](_0xc0d6f0)[_0x1c66('0x2b')](_0x95327);};}exports[_0x1c66('0x2c')]=function(_0x1a09fa,_0x5e0400){var _0x18aaf9={},_0x4aaf24={},_0x223a7d={'count':0x0,'rows':[]};var _0x387793=_['map'](db[_0x1c66('0x2d')][_0x1c66('0x2e')],function(_0x286518){return{'name':_0x286518[_0x1c66('0x2f')],'type':_0x286518[_0x1c66('0x30')]['key']};});_0x4aaf24['model']=_[_0x1c66('0x31')](_0x387793,_0x1c66('0x2a'));_0x4aaf24[_0x1c66('0x32')]=_[_0x1c66('0x33')](_0x1a09fa[_0x1c66('0x32')]);_0x4aaf24[_0x1c66('0x34')]=_[_0x1c66('0x35')](_0x4aaf24[_0x1c66('0x36')],_0x4aaf24[_0x1c66('0x32')]);_0x18aaf9[_0x1c66('0x37')]=_[_0x1c66('0x35')](_0x4aaf24['model'],qs[_0x1c66('0x38')](_0x1a09fa['query'][_0x1c66('0x38')]));_0x18aaf9['attributes']=_0x18aaf9[_0x1c66('0x37')][_0x1c66('0x39')]?_0x18aaf9[_0x1c66('0x37')]:_0x4aaf24['model'];if(!_0x1a09fa['query']['hasOwnProperty'](_0x1c66('0x3a'))){_0x18aaf9[_0x1c66('0x1c')]=qs['limit'](_0x1a09fa[_0x1c66('0x32')][_0x1c66('0x1c')]);_0x18aaf9[_0x1c66('0x1a')]=qs['offset'](_0x1a09fa[_0x1c66('0x32')][_0x1c66('0x1a')]);}_0x18aaf9[_0x1c66('0x3b')]=qs[_0x1c66('0x3c')](_0x1a09fa[_0x1c66('0x32')]['sort']);_0x18aaf9[_0x1c66('0x3d')]=qs[_0x1c66('0x34')](_[_0x1c66('0x3e')](_0x1a09fa[_0x1c66('0x32')],_0x4aaf24[_0x1c66('0x34')]),_0x387793);if(_0x1a09fa[_0x1c66('0x32')][_0x1c66('0x3f')]){_0x18aaf9['where']=_[_0x1c66('0x40')](_0x18aaf9[_0x1c66('0x3d')],{'$or':_[_0x1c66('0x31')](_0x387793,function(_0x1fe262){if(_0x1fe262[_0x1c66('0x30')]!==_0x1c66('0x41')){var _0x440908={};_0x440908[_0x1fe262['name']]={'$like':'%'+_0x1a09fa[_0x1c66('0x32')]['filter']+'%'};return _0x440908;}})});}_0x18aaf9=_[_0x1c66('0x40')]({},_0x18aaf9,_0x1a09fa[_0x1c66('0x42')]);var _0x2a6983={'where':_0x18aaf9['where']};return db[_0x1c66('0x2d')][_0x1c66('0x1d')](_0x2a6983)[_0x1c66('0x24')](function(_0x54a799){_0x223a7d[_0x1c66('0x1d')]=_0x54a799;if(_0x1a09fa[_0x1c66('0x32')][_0x1c66('0x43')]){_0x18aaf9[_0x1c66('0x44')]=[{'all':!![]}];}return db[_0x1c66('0x2d')]['findAll'](_0x18aaf9);})[_0x1c66('0x24')](function(_0x35b229){_0x223a7d[_0x1c66('0x45')]=_0x35b229;return _0x223a7d;})[_0x1c66('0x24')](respondWithFilteredResult(_0x5e0400,_0x18aaf9))['catch'](handleError(_0x5e0400,null));};exports[_0x1c66('0x46')]=function(_0x3829e6,_0x54d075){var _0x51ce0a={'raw':![],'where':{'id':_0x3829e6[_0x1c66('0x47')]['id']}},_0x27306b={};_0x27306b[_0x1c66('0x36')]=_[_0x1c66('0x33')](db[_0x1c66('0x2d')]['rawAttributes']);_0x27306b[_0x1c66('0x32')]=_['keys'](_0x3829e6[_0x1c66('0x32')]);_0x27306b[_0x1c66('0x34')]=_[_0x1c66('0x35')](_0x27306b[_0x1c66('0x36')],_0x27306b[_0x1c66('0x32')]);_0x51ce0a[_0x1c66('0x37')]=_['intersection'](_0x27306b['model'],qs[_0x1c66('0x38')](_0x3829e6[_0x1c66('0x32')][_0x1c66('0x38')]));_0x51ce0a[_0x1c66('0x37')]=_0x51ce0a[_0x1c66('0x37')][_0x1c66('0x39')]?_0x51ce0a['attributes']:_0x27306b[_0x1c66('0x36')];if(_0x3829e6[_0x1c66('0x32')][_0x1c66('0x43')]){_0x51ce0a[_0x1c66('0x44')]=[{'all':!![]}];}_0x51ce0a=_[_0x1c66('0x40')]({},_0x51ce0a,_0x3829e6[_0x1c66('0x42')]);return db[_0x1c66('0x2d')][_0x1c66('0x48')](_0x51ce0a)['then'](handleEntityNotFound(_0x54d075,null))[_0x1c66('0x24')](respondWithResult(_0x54d075,null))[_0x1c66('0x49')](handleError(_0x54d075,null));};exports[_0x1c66('0x4a')]=function(_0x4bca49,_0x33dcf1){return db['Dashboard'][_0x1c66('0x4a')](_0x4bca49[_0x1c66('0x4b')],{})[_0x1c66('0x24')](function(_0x9769e9){var _0x433ffe=_0x4bca49[_0x1c66('0x4c')]['get']({'plain':!![]});if(!_0x433ffe)throw new Error(_0x1c66('0x4d'));if(_0x433ffe['role']===_0x1c66('0x4c')){var _0x5a439c=_0x9769e9[_0x1c66('0x4e')]({'plain':!![]});var _0x3689b9='CustomDashboards';return db[_0x1c66('0x4f')][_0x1c66('0x48')]({'where':{'name':_0x3689b9,'userProfileId':_0x433ffe[_0x1c66('0x50')]},'raw':!![]})[_0x1c66('0x24')](function(_0x301f7c){if(_0x301f7c&&_0x301f7c[_0x1c66('0x51')]===0x0){return db[_0x1c66('0x26')][_0x1c66('0x4a')]({'name':_0x5a439c[_0x1c66('0x2a')],'resourceId':_0x5a439c['id'],'type':_0x301f7c['name'],'sectionId':_0x301f7c['id']},{})[_0x1c66('0x24')](function(){return _0x9769e9;});}else{return _0x9769e9;}})[_0x1c66('0x49')](function(_0x5d0ca1){logger[_0x1c66('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d0ca1);throw _0x5d0ca1;});}return _0x9769e9;})[_0x1c66('0x24')](respondWithResult(_0x33dcf1,0xc9))[_0x1c66('0x49')](handleError(_0x33dcf1,null));};exports[_0x1c66('0x52')]=function(_0x4b57e,_0x2299b6){var _0x489d99={'where':{'id':_0x4b57e[_0x1c66('0x47')]['id']}},_0x2a26dd={};_0x2a26dd[_0x1c66('0x36')]=_[_0x1c66('0x33')](db[_0x1c66('0x2d')][_0x1c66('0x2e')]);_0x489d99[_0x1c66('0x37')]=_[_0x1c66('0x35')](_0x2a26dd[_0x1c66('0x36')],qs['fields'](_0x4b57e[_0x1c66('0x32')]['fields']));_0x489d99[_0x1c66('0x37')]=_0x489d99[_0x1c66('0x37')][_0x1c66('0x39')]?_0x489d99[_0x1c66('0x37')]:_0x2a26dd['model'];if(_0x4b57e['query']['includeAll']){_0x489d99[_0x1c66('0x44')]=[{'all':!![]}];}_0x489d99=_[_0x1c66('0x40')]({},_0x489d99,_0x4b57e[_0x1c66('0x42')]);return db['Dashboard']['find'](_0x489d99)[_0x1c66('0x24')](handleEntityNotFound(_0x2299b6,null))[_0x1c66('0x24')](function(_0x1ca6f6){if(_0x1ca6f6){var _0x4eb893=_0x1ca6f6[_0x1c66('0x4e')]({'plain':!![]});_0x4eb893=qs[_0x1c66('0x53')](_0x4eb893,['id',_0x1c66('0x54'),'updatedAt']);_0x4b57e[_0x1c66('0x4b')]=_[_0x1c66('0x53')](_0x4b57e['body'],['id',_0x1c66('0x54'),_0x1c66('0x55')]);return db[_0x1c66('0x2d')][_0x1c66('0x4a')](_[_0x1c66('0x40')](_0x4eb893,_0x4b57e['body']),{'include':_0x4b57e[_0x1c66('0x32')][_0x1c66('0x43')]?[{'all':!![]}]:undefined})[_0x1c66('0x24')](function(_0x114bd6){var _0x1f4ad4=_0x4b57e['user'][_0x1c66('0x4e')]({'plain':!![]});if(!_0x1f4ad4)throw new Error(_0x1c66('0x4d'));if(_0x1f4ad4['role']==='user'){var _0x28685e=_0x114bd6[_0x1c66('0x4e')]({'plain':!![]});var _0x45f89b=_0x1c66('0x25');return db[_0x1c66('0x4f')][_0x1c66('0x48')]({'where':{'name':_0x45f89b,'userProfileId':_0x1f4ad4[_0x1c66('0x50')]},'raw':!![]})[_0x1c66('0x24')](function(_0xd05fc){if(_0xd05fc&&_0xd05fc[_0x1c66('0x51')]===0x0){return db['UserProfileResource'][_0x1c66('0x4a')]({'name':_0x28685e[_0x1c66('0x2a')],'resourceId':_0x28685e['id'],'type':_0xd05fc[_0x1c66('0x2a')],'sectionId':_0xd05fc['id']},{})[_0x1c66('0x24')](function(){return _0x114bd6;});}else{return _0x114bd6;}})['catch'](function(_0x521f89){logger[_0x1c66('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x521f89);throw _0x521f89;});}return _0x114bd6;});}})[_0x1c66('0x24')](respondWithResult(_0x2299b6,0xc9))['catch'](handleError(_0x2299b6,null));};exports['update']=function(_0xd8a55f,_0xf5d6ae){if(_0xd8a55f[_0x1c66('0x4b')]['id']){delete _0xd8a55f[_0x1c66('0x4b')]['id'];}return db[_0x1c66('0x2d')][_0x1c66('0x48')]({'where':{'id':_0xd8a55f[_0x1c66('0x47')]['id']}})[_0x1c66('0x24')](handleEntityNotFound(_0xf5d6ae,null))[_0x1c66('0x24')](saveUpdates(_0xd8a55f[_0x1c66('0x4b')],null))['then'](respondWithResult(_0xf5d6ae,null))[_0x1c66('0x49')](handleError(_0xf5d6ae,null));};exports['destroy']=function(_0x161d55,_0x34010c){return db['Dashboard'][_0x1c66('0x48')]({'where':{'id':_0x161d55['params']['id']}})[_0x1c66('0x24')](handleEntityNotFound(_0x34010c,null))['then'](removeEntity(_0x34010c,null))['catch'](handleError(_0x34010c,null));};function widgetAttributes(_0x48a945){try{switch(_0x48a945[_0x1c66('0x30')]){case _0x1c66('0x56'):return[{'name':'attrUrl','value':_0x48a945[_0x1c66('0x57')]||(_0x48a945[_0x1c66('0x58')]&&_0x48a945['attrs'][0x0]?_0x48a945[_0x1c66('0x58')][0x0][_0x1c66('0x59')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x48a945[_0x1c66('0x5a')]||(_0x48a945['attrs']&&_0x48a945['attrs'][0x0]?_0x48a945[_0x1c66('0x58')][0x0][_0x1c66('0x59')]:undefined)||''}];case _0x1c66('0x5b'):return[{'name':'attrHourFormat','value':_0x48a945[_0x1c66('0x5c')]||(_0x48a945['attrs']&&_0x48a945[_0x1c66('0x58')][0x0]?_0x48a945[_0x1c66('0x58')][0x0][_0x1c66('0x59')]:undefined)||'HH:mm:ss'},{'name':_0x1c66('0x5d'),'value':_0x48a945[_0x1c66('0x5d')]||(_0x48a945[_0x1c66('0x58')]&&_0x48a945[_0x1c66('0x58')][0x1]?_0x48a945[_0x1c66('0x58')][0x1][_0x1c66('0x59')]:undefined)||_0x1c66('0x5e')},{'name':'attrFontSize','value':_0x48a945[_0x1c66('0x5f')]||(_0x48a945['attrs']&&_0x48a945[_0x1c66('0x58')][0x2]?_0x48a945[_0x1c66('0x58')][0x2][_0x1c66('0x59')]:undefined)||0xc}];case _0x1c66('0x60'):return[{'name':'attrMetric','value':_0x48a945[_0x1c66('0x61')]||(_0x48a945[_0x1c66('0x58')]&&_0x48a945['attrs'][0x0]?_0x48a945['attrs'][0x0][_0x1c66('0x59')]:undefined)||_0x1c66('0x62')},{'name':_0x1c66('0x63'),'value':_0x48a945['attrVoiceQueues']||(_0x48a945['attrs']&&_0x48a945['attrs'][0x1]?_0x48a945['attrs'][0x1]['value']:undefined)||[]},{'name':_0x1c66('0x5f'),'value':_0x48a945[_0x1c66('0x5f')]||(_0x48a945[_0x1c66('0x58')]&&_0x48a945[_0x1c66('0x58')][0x2]?_0x48a945[_0x1c66('0x58')][0x2][_0x1c66('0x59')]:undefined)||0x14}];case _0x1c66('0x64'):case'pie-chart':return[{'name':_0x1c66('0x65'),'value':_0x48a945[_0x1c66('0x65')]||(_0x48a945[_0x1c66('0x58')]&&_0x48a945['attrs'][0x0]?_0x48a945[_0x1c66('0x58')][0x0]['value']:undefined)||_0x1c66('0x62')},{'name':_0x1c66('0x66'),'value':_0x48a945[_0x1c66('0x66')]||(_0x48a945['attrs']&&_0x48a945[_0x1c66('0x58')][0x1]?_0x48a945['attrs'][0x1][_0x1c66('0x59')]:undefined)||null},{'name':_0x1c66('0x67'),'value':_0x48a945['attrSerie3']||(_0x48a945[_0x1c66('0x58')]&&_0x48a945[_0x1c66('0x58')][0x2]?_0x48a945[_0x1c66('0x58')][0x2][_0x1c66('0x59')]:undefined)||null},{'name':_0x1c66('0x63'),'value':_0x48a945[_0x1c66('0x63')]||(_0x48a945[_0x1c66('0x58')]&&_0x48a945[_0x1c66('0x58')][0x3]?_0x48a945[_0x1c66('0x58')][0x3]['value']:undefined)||[]}];case _0x1c66('0x68'):return[{'name':_0x1c66('0x69'),'type':_0x48a945[_0x1c66('0x6a')]||(_0x48a945['attrs']&&_0x48a945[_0x1c66('0x58')][0x0]?_0x48a945[_0x1c66('0x58')][0x0][_0x1c66('0x30')]:undefined)||null,'value':_0x48a945[_0x1c66('0x69')]||(_0x48a945[_0x1c66('0x58')]&&_0x48a945['attrs'][0x0]?_0x48a945[_0x1c66('0x58')][0x0][_0x1c66('0x59')]:undefined)||null},{'name':_0x1c66('0x6b'),'value':_0x48a945[_0x1c66('0x6b')]||(_0x48a945[_0x1c66('0x58')]&&_0x48a945['attrs'][0x1]?_0x48a945[_0x1c66('0x58')][0x1][_0x1c66('0x59')]:undefined)||0x0}];default:return[];}}catch(_0xabf6db){logger['error']('widgetAttributes:\x20%s',JSON[_0x1c66('0x6c')](_0xabf6db));return[];}}exports[_0x1c66('0x6d')]=function(_0x238080,_0x17f7a5,_0x1495b9){if(_0x238080[_0x1c66('0x4b')]['id']){delete _0x238080[_0x1c66('0x4b')]['id'];}return db[_0x1c66('0x2d')][_0x1c66('0x48')]({'where':{'id':_0x238080[_0x1c66('0x47')]['id']}})[_0x1c66('0x24')](handleEntityNotFound(_0x17f7a5,null))[_0x1c66('0x24')](function(_0x5bdbe8){if(_0x5bdbe8){_0x238080['body'][_0x1c66('0x6e')]=_0x5bdbe8['id'];_0x238080[_0x1c66('0x4b')][_0x1c66('0x58')]=widgetAttributes(_0x238080['body']);return db['DashboardItem'][_0x1c66('0x4a')](_0x238080[_0x1c66('0x4b')]);}})[_0x1c66('0x24')](respondWithResult(_0x17f7a5,null))[_0x1c66('0x49')](handleError(_0x17f7a5,null));};exports['getItems']=function(_0x24aae4,_0x40b642,_0x3f1ff2){var _0x10d101={};var _0x54e5b4={};var _0x3931ae;var _0x27eb9b;return db[_0x1c66('0x2d')]['findOne']({'where':{'id':_0x24aae4[_0x1c66('0x47')]['id']}})[_0x1c66('0x24')](handleEntityNotFound(_0x40b642,null))[_0x1c66('0x24')](function(_0x4ceb8d){if(_0x4ceb8d){_0x3931ae=_0x4ceb8d;_0x54e5b4['model']=_[_0x1c66('0x33')](db[_0x1c66('0x6f')][_0x1c66('0x2e')]);_0x54e5b4[_0x1c66('0x32')]=_[_0x1c66('0x33')](_0x24aae4[_0x1c66('0x32')]);_0x54e5b4[_0x1c66('0x34')]=_['intersection'](_0x54e5b4[_0x1c66('0x36')],_0x54e5b4[_0x1c66('0x32')]);_0x10d101['attributes']=_[_0x1c66('0x35')](_0x54e5b4[_0x1c66('0x36')],qs[_0x1c66('0x38')](_0x24aae4[_0x1c66('0x32')][_0x1c66('0x38')]));_0x10d101[_0x1c66('0x37')]=_0x10d101[_0x1c66('0x37')][_0x1c66('0x39')]?_0x10d101[_0x1c66('0x37')]:_0x54e5b4['model'];_0x10d101[_0x1c66('0x3b')]=qs[_0x1c66('0x3c')](_0x24aae4[_0x1c66('0x32')][_0x1c66('0x3c')]);_0x10d101['where']=qs[_0x1c66('0x34')](_[_0x1c66('0x3e')](_0x24aae4[_0x1c66('0x32')],_0x54e5b4[_0x1c66('0x34')]));if(_0x24aae4[_0x1c66('0x32')][_0x1c66('0x3f')]){_0x10d101[_0x1c66('0x3d')]=_[_0x1c66('0x40')](_0x10d101['where'],{'$or':_[_0x1c66('0x31')](_0x10d101[_0x1c66('0x37')],function(_0x199615){var _0x4afca3={};_0x4afca3[_0x199615]={'$like':'%'+_0x24aae4['query']['filter']+'%'};return _0x4afca3;})});}_0x10d101=_[_0x1c66('0x40')]({},_0x10d101,_0x24aae4[_0x1c66('0x42')]);return _0x3931ae[_0x1c66('0x70')](_0x10d101);}})['then'](function(_0x4fcb21){if(_0x4fcb21){_0x27eb9b=_0x4fcb21[_0x1c66('0x39')];if(!_0x24aae4[_0x1c66('0x32')]['hasOwnProperty'](_0x1c66('0x3a'))){_0x10d101[_0x1c66('0x1c')]=qs[_0x1c66('0x1c')](_0x24aae4[_0x1c66('0x32')][_0x1c66('0x1c')]);_0x10d101[_0x1c66('0x1a')]=qs[_0x1c66('0x1a')](_0x24aae4[_0x1c66('0x32')][_0x1c66('0x1a')]);}return _0x3931ae[_0x1c66('0x70')](_0x10d101);}})[_0x1c66('0x24')](function(_0x5a504b){if(_0x5a504b){return _0x5a504b?{'count':_0x27eb9b,'rows':_0x5a504b}:null;}})[_0x1c66('0x24')](respondWithResult(_0x40b642,null))[_0x1c66('0x49')](handleError(_0x40b642,null));}; \ No newline at end of file +var _0xc887=['filters','pick','filter','where','merge','options','Dashboard','includeAll','include','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','order','getItems','hasOwnProperty','eml-format','zip-dir','moment','bluebird','util','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','sort'];(function(_0x5940cf,_0x439ece){var _0x36f080=function(_0x4acc65){while(--_0x4acc65){_0x5940cf['push'](_0x5940cf['shift']());}};_0x36f080(++_0x439ece);}(_0xc887,0x12c));var _0x7c88=function(_0x386c1b,_0x18e106){_0x386c1b=_0x386c1b-0x0;var _0x18be06=_0xc887[_0x386c1b];return _0x18be06;};'use strict';var emlformat=require(_0x7c88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7c88('0x2'));var BPromise=require(_0x7c88('0x3'));var Mustache=require('mustache');var util=require(_0x7c88('0x4'));var path=require('path');var sox=require(_0x7c88('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c88('0x6'));var squel=require(_0x7c88('0x7'));var crypto=require(_0x7c88('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x7c88('0x9'));var toCsv=require(_0x7c88('0xa'));var querystring=require('querystring');var Papa=require(_0x7c88('0xb'));var Redis=require(_0x7c88('0xc'));var authService=require(_0x7c88('0xd'));var qs=require(_0x7c88('0xe'));var as=require(_0x7c88('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c88('0x10'))('api');var utils=require(_0x7c88('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7c88('0x12'));var db=require(_0x7c88('0x13'))['db'];config['redis']=_[_0x7c88('0x14')](config[_0x7c88('0x15')],{'host':_0x7c88('0x16'),'port':0x18eb});var socket=require(_0x7c88('0x17'))(new Redis(config[_0x7c88('0x15')]));require(_0x7c88('0x18'))[_0x7c88('0x19')](socket);function respondWithStatusCode(_0x233b54,_0xb715af){_0xb715af=_0xb715af||0xcc;return function(_0x3cc19f){if(_0x3cc19f){return _0x233b54[_0x7c88('0x1a')](_0xb715af);}return _0x233b54[_0x7c88('0x1b')](_0xb715af)[_0x7c88('0x1c')]();};}function respondWithResult(_0x1d69f2,_0x145185){_0x145185=_0x145185||0xc8;return function(_0x589207){if(_0x589207){return _0x1d69f2[_0x7c88('0x1b')](_0x145185)[_0x7c88('0x1d')](_0x589207);}};}function respondWithFilteredResult(_0x3f7e06,_0x215690){return function(_0x4251ab){if(_0x4251ab){var _0x2adcf4=typeof _0x215690[_0x7c88('0x1e')]===_0x7c88('0x1f')&&typeof _0x215690[_0x7c88('0x20')]===_0x7c88('0x1f');var _0x27363f=_0x4251ab[_0x7c88('0x21')];var _0x4dd4fa=_0x2adcf4?0x0:_0x215690[_0x7c88('0x1e')];var _0x405198=_0x2adcf4?_0x4251ab[_0x7c88('0x21')]:_0x215690['offset']+_0x215690[_0x7c88('0x20')];var _0x623121;if(_0x405198>=_0x27363f){_0x405198=_0x27363f;_0x623121=0xc8;}else{_0x623121=0xce;}_0x3f7e06[_0x7c88('0x1b')](_0x623121);return _0x3f7e06[_0x7c88('0x22')](_0x7c88('0x23'),_0x4dd4fa+'-'+_0x405198+'/'+_0x27363f)[_0x7c88('0x1d')](_0x4251ab);}return null;};}function patchUpdates(_0x3f2dd4){return function(_0x5ae9b4){try{jsonpatch[_0x7c88('0x24')](_0x5ae9b4,_0x3f2dd4,!![]);}catch(_0x1da7b2){return BPromise[_0x7c88('0x25')](_0x1da7b2);}return _0x5ae9b4[_0x7c88('0x26')]();};}function saveUpdates(_0x1ce5db,_0x1ed2e9){return function(_0xeb8c6f){if(_0xeb8c6f){return _0xeb8c6f[_0x7c88('0x27')](_0x1ce5db)[_0x7c88('0x28')](function(_0x1f3b9d){return _0x1f3b9d;});}return null;};}function removeEntity(_0x51a66a,_0x56be7d){return function(_0x108f6a){if(_0x108f6a){return _0x108f6a[_0x7c88('0x29')]()[_0x7c88('0x28')](function(){var _0x414772=_0x108f6a[_0x7c88('0x2a')]({'plain':!![]});var _0x2232f5='CustomDashboards';return db[_0x7c88('0x2b')][_0x7c88('0x29')]({'where':{'type':_0x2232f5,'resourceId':_0x414772['id']}})[_0x7c88('0x28')](function(){return _0x108f6a;});})['then'](function(){_0x51a66a[_0x7c88('0x1b')](0xcc)[_0x7c88('0x1c')]();});}};}function handleEntityNotFound(_0xcb4c40,_0x28bf5a){return function(_0xf1707a){if(!_0xf1707a){_0xcb4c40[_0x7c88('0x1a')](0x194);}return _0xf1707a;};}function handleError(_0x22f902,_0x25f679){_0x25f679=_0x25f679||0x1f4;return function(_0x3ec6ff){logger[_0x7c88('0x2c')](_0x3ec6ff['stack']);if(_0x3ec6ff[_0x7c88('0x2d')]){delete _0x3ec6ff[_0x7c88('0x2d')];}_0x22f902['status'](_0x25f679)[_0x7c88('0x2e')](_0x3ec6ff);};}exports[_0x7c88('0x2f')]=function(_0x5152cc,_0x542b42){var _0x2adbd2={},_0x3b906f={},_0xdbc97c={'count':0x0,'rows':[]};var _0x1007aa=_[_0x7c88('0x30')](db['Dashboard'][_0x7c88('0x31')],function(_0x39f6a1){return{'name':_0x39f6a1['fieldName'],'type':_0x39f6a1[_0x7c88('0x32')][_0x7c88('0x33')]};});_0x3b906f[_0x7c88('0x34')]=_[_0x7c88('0x30')](_0x1007aa,_0x7c88('0x2d'));_0x3b906f[_0x7c88('0x35')]=_['keys'](_0x5152cc[_0x7c88('0x35')]);_0x3b906f['filters']=_[_0x7c88('0x36')](_0x3b906f[_0x7c88('0x34')],_0x3b906f[_0x7c88('0x35')]);_0x2adbd2[_0x7c88('0x37')]=_[_0x7c88('0x36')](_0x3b906f[_0x7c88('0x34')],qs[_0x7c88('0x38')](_0x5152cc['query'][_0x7c88('0x38')]));_0x2adbd2[_0x7c88('0x37')]=_0x2adbd2[_0x7c88('0x37')][_0x7c88('0x39')]?_0x2adbd2[_0x7c88('0x37')]:_0x3b906f[_0x7c88('0x34')];if(!_0x5152cc[_0x7c88('0x35')]['hasOwnProperty'](_0x7c88('0x3a'))){_0x2adbd2[_0x7c88('0x20')]=qs[_0x7c88('0x20')](_0x5152cc[_0x7c88('0x35')][_0x7c88('0x20')]);_0x2adbd2['offset']=qs[_0x7c88('0x1e')](_0x5152cc[_0x7c88('0x35')][_0x7c88('0x1e')]);}_0x2adbd2['order']=qs[_0x7c88('0x3b')](_0x5152cc[_0x7c88('0x35')][_0x7c88('0x3b')]);_0x2adbd2['where']=qs[_0x7c88('0x3c')](_[_0x7c88('0x3d')](_0x5152cc['query'],_0x3b906f['filters']),_0x1007aa);if(_0x5152cc[_0x7c88('0x35')][_0x7c88('0x3e')]){_0x2adbd2[_0x7c88('0x3f')]=_[_0x7c88('0x40')](_0x2adbd2[_0x7c88('0x3f')],{'$or':_[_0x7c88('0x30')](_0x1007aa,function(_0x2a6749){if(_0x2a6749[_0x7c88('0x32')]!=='VIRTUAL'){var _0x37bb67={};_0x37bb67[_0x2a6749['name']]={'$like':'%'+_0x5152cc['query'][_0x7c88('0x3e')]+'%'};return _0x37bb67;}})});}_0x2adbd2=_[_0x7c88('0x40')]({},_0x2adbd2,_0x5152cc[_0x7c88('0x41')]);var _0x18e12e={'where':_0x2adbd2[_0x7c88('0x3f')]};return db[_0x7c88('0x42')]['count'](_0x18e12e)['then'](function(_0x2f0ea0){_0xdbc97c[_0x7c88('0x21')]=_0x2f0ea0;if(_0x5152cc[_0x7c88('0x35')][_0x7c88('0x43')]){_0x2adbd2[_0x7c88('0x44')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x2adbd2);})[_0x7c88('0x28')](function(_0x2c21a9){_0xdbc97c[_0x7c88('0x45')]=_0x2c21a9;return _0xdbc97c;})[_0x7c88('0x28')](respondWithFilteredResult(_0x542b42,_0x2adbd2))[_0x7c88('0x46')](handleError(_0x542b42,null));};exports['show']=function(_0x44f496,_0x28f73d){var _0x512c32={'raw':![],'where':{'id':_0x44f496[_0x7c88('0x47')]['id']}},_0x2ad423={};_0x2ad423[_0x7c88('0x34')]=_[_0x7c88('0x48')](db[_0x7c88('0x42')][_0x7c88('0x31')]);_0x2ad423[_0x7c88('0x35')]=_['keys'](_0x44f496[_0x7c88('0x35')]);_0x2ad423[_0x7c88('0x3c')]=_[_0x7c88('0x36')](_0x2ad423[_0x7c88('0x34')],_0x2ad423[_0x7c88('0x35')]);_0x512c32[_0x7c88('0x37')]=_['intersection'](_0x2ad423[_0x7c88('0x34')],qs['fields'](_0x44f496[_0x7c88('0x35')][_0x7c88('0x38')]));_0x512c32['attributes']=_0x512c32[_0x7c88('0x37')][_0x7c88('0x39')]?_0x512c32['attributes']:_0x2ad423['model'];if(_0x44f496['query']['includeAll']){_0x512c32[_0x7c88('0x44')]=[{'all':!![]}];}_0x512c32=_[_0x7c88('0x40')]({},_0x512c32,_0x44f496[_0x7c88('0x41')]);return db[_0x7c88('0x42')][_0x7c88('0x49')](_0x512c32)[_0x7c88('0x28')](handleEntityNotFound(_0x28f73d,null))['then'](respondWithResult(_0x28f73d,null))[_0x7c88('0x46')](handleError(_0x28f73d,null));};exports[_0x7c88('0x4a')]=function(_0x207c63,_0x517e6b){return db[_0x7c88('0x42')][_0x7c88('0x4a')](_0x207c63[_0x7c88('0x4b')],{})[_0x7c88('0x28')](function(_0x3c1488){var _0x27e771=_0x207c63['user'][_0x7c88('0x2a')]({'plain':!![]});if(!_0x27e771)throw new Error(_0x7c88('0x4c'));if(_0x27e771[_0x7c88('0x4d')]===_0x7c88('0x4e')){var _0x151ea2=_0x3c1488[_0x7c88('0x2a')]({'plain':!![]});var _0x4fb7a6=_0x7c88('0x4f');return db[_0x7c88('0x50')]['find']({'where':{'name':_0x4fb7a6,'userProfileId':_0x27e771[_0x7c88('0x51')]},'raw':!![]})['then'](function(_0x59522d){if(_0x59522d&&_0x59522d[_0x7c88('0x52')]===0x0){return db[_0x7c88('0x2b')][_0x7c88('0x4a')]({'name':_0x151ea2[_0x7c88('0x2d')],'resourceId':_0x151ea2['id'],'type':_0x59522d['name'],'sectionId':_0x59522d['id']},{})[_0x7c88('0x28')](function(){return _0x3c1488;});}else{return _0x3c1488;}})[_0x7c88('0x46')](function(_0x2a06e3){logger['error'](_0x7c88('0x53'),_0x2a06e3);throw _0x2a06e3;});}return _0x3c1488;})['then'](respondWithResult(_0x517e6b,0xc9))['catch'](handleError(_0x517e6b,null));};exports[_0x7c88('0x54')]=function(_0x29bef5,_0x477ec5){var _0x47be1b={'where':{'id':_0x29bef5[_0x7c88('0x47')]['id']}},_0x46107c={};_0x46107c[_0x7c88('0x34')]=_[_0x7c88('0x48')](db['Dashboard'][_0x7c88('0x31')]);_0x47be1b[_0x7c88('0x37')]=_[_0x7c88('0x36')](_0x46107c['model'],qs['fields'](_0x29bef5[_0x7c88('0x35')][_0x7c88('0x38')]));_0x47be1b[_0x7c88('0x37')]=_0x47be1b['attributes'][_0x7c88('0x39')]?_0x47be1b['attributes']:_0x46107c['model'];if(_0x29bef5[_0x7c88('0x35')]['includeAll']){_0x47be1b[_0x7c88('0x44')]=[{'all':!![]}];}_0x47be1b=_[_0x7c88('0x40')]({},_0x47be1b,_0x29bef5[_0x7c88('0x41')]);return db[_0x7c88('0x42')][_0x7c88('0x49')](_0x47be1b)[_0x7c88('0x28')](handleEntityNotFound(_0x477ec5,null))['then'](function(_0x4adb78){if(_0x4adb78){var _0x16ff04=_0x4adb78[_0x7c88('0x2a')]({'plain':!![]});_0x16ff04=qs['omit'](_0x16ff04,['id',_0x7c88('0x55'),'updatedAt']);_0x29bef5[_0x7c88('0x4b')]=_['omit'](_0x29bef5[_0x7c88('0x4b')],['id',_0x7c88('0x55'),_0x7c88('0x56')]);return db[_0x7c88('0x42')]['create'](_[_0x7c88('0x40')](_0x16ff04,_0x29bef5[_0x7c88('0x4b')]),{'include':_0x29bef5['query'][_0x7c88('0x43')]?[{'all':!![]}]:undefined})[_0x7c88('0x28')](function(_0x1978d3){var _0x4e9e39=_0x29bef5[_0x7c88('0x4e')][_0x7c88('0x2a')]({'plain':!![]});if(!_0x4e9e39)throw new Error(_0x7c88('0x4c'));if(_0x4e9e39[_0x7c88('0x4d')]===_0x7c88('0x4e')){var _0x70c8f4=_0x1978d3['get']({'plain':!![]});var _0x2399c6=_0x7c88('0x4f');return db[_0x7c88('0x50')]['find']({'where':{'name':_0x2399c6,'userProfileId':_0x4e9e39[_0x7c88('0x51')]},'raw':!![]})[_0x7c88('0x28')](function(_0x8d626a){if(_0x8d626a&&_0x8d626a['autoAssociation']===0x0){return db[_0x7c88('0x2b')][_0x7c88('0x4a')]({'name':_0x70c8f4[_0x7c88('0x2d')],'resourceId':_0x70c8f4['id'],'type':_0x8d626a[_0x7c88('0x2d')],'sectionId':_0x8d626a['id']},{})['then'](function(){return _0x1978d3;});}else{return _0x1978d3;}})['catch'](function(_0x5bdb3e){logger[_0x7c88('0x2c')](_0x7c88('0x53'),_0x5bdb3e);throw _0x5bdb3e;});}return _0x1978d3;});}})[_0x7c88('0x28')](respondWithResult(_0x477ec5,0xc9))[_0x7c88('0x46')](handleError(_0x477ec5,null));};exports[_0x7c88('0x27')]=function(_0x802a96,_0x1b1a25){if(_0x802a96[_0x7c88('0x4b')]['id']){delete _0x802a96[_0x7c88('0x4b')]['id'];}return db[_0x7c88('0x42')][_0x7c88('0x49')]({'where':{'id':_0x802a96[_0x7c88('0x47')]['id']}})[_0x7c88('0x28')](handleEntityNotFound(_0x1b1a25,null))[_0x7c88('0x28')](saveUpdates(_0x802a96[_0x7c88('0x4b')],null))['then'](respondWithResult(_0x1b1a25,null))['catch'](handleError(_0x1b1a25,null));};exports[_0x7c88('0x29')]=function(_0x2c7d61,_0x47c47c){return db['Dashboard'][_0x7c88('0x49')]({'where':{'id':_0x2c7d61['params']['id']}})[_0x7c88('0x28')](handleEntityNotFound(_0x47c47c,null))[_0x7c88('0x28')](removeEntity(_0x47c47c,null))[_0x7c88('0x46')](handleError(_0x47c47c,null));};function widgetAttributes(_0x4ab736){try{switch(_0x4ab736[_0x7c88('0x32')]){case _0x7c88('0x57'):return[{'name':_0x7c88('0x58'),'value':_0x4ab736[_0x7c88('0x58')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736[_0x7c88('0x59')][0x0]?_0x4ab736[_0x7c88('0x59')][0x0]['value']:undefined)||_0x7c88('0x5a')}];case _0x7c88('0x5b'):return[{'name':_0x7c88('0x5c'),'value':_0x4ab736[_0x7c88('0x5c')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736[_0x7c88('0x59')][0x0]?_0x4ab736['attrs'][0x0][_0x7c88('0x5d')]:undefined)||''}];case _0x7c88('0x5e'):return[{'name':_0x7c88('0x5f'),'value':_0x4ab736[_0x7c88('0x5f')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736[_0x7c88('0x59')][0x0]?_0x4ab736[_0x7c88('0x59')][0x0][_0x7c88('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x7c88('0x60'),'value':_0x4ab736[_0x7c88('0x60')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736[_0x7c88('0x59')][0x1]?_0x4ab736[_0x7c88('0x59')][0x1][_0x7c88('0x5d')]:undefined)||_0x7c88('0x61')},{'name':_0x7c88('0x62'),'value':_0x4ab736[_0x7c88('0x62')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736['attrs'][0x2]?_0x4ab736[_0x7c88('0x59')][0x2][_0x7c88('0x5d')]:undefined)||0xc}];case _0x7c88('0x63'):return[{'name':_0x7c88('0x64'),'value':_0x4ab736[_0x7c88('0x64')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736[_0x7c88('0x59')][0x0]?_0x4ab736[_0x7c88('0x59')][0x0][_0x7c88('0x5d')]:undefined)||_0x7c88('0x65')},{'name':_0x7c88('0x66'),'value':_0x4ab736[_0x7c88('0x66')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736['attrs'][0x1]?_0x4ab736[_0x7c88('0x59')][0x1][_0x7c88('0x5d')]:undefined)||[]},{'name':_0x7c88('0x62'),'value':_0x4ab736[_0x7c88('0x62')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736['attrs'][0x2]?_0x4ab736['attrs'][0x2]['value']:undefined)||0x14}];case _0x7c88('0x67'):case _0x7c88('0x68'):return[{'name':'attrSerie1','value':_0x4ab736[_0x7c88('0x69')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736[_0x7c88('0x59')][0x0]?_0x4ab736['attrs'][0x0][_0x7c88('0x5d')]:undefined)||_0x7c88('0x65')},{'name':'attrSerie2','value':_0x4ab736[_0x7c88('0x6a')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736['attrs'][0x1]?_0x4ab736[_0x7c88('0x59')][0x1][_0x7c88('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x4ab736[_0x7c88('0x6b')]||(_0x4ab736['attrs']&&_0x4ab736[_0x7c88('0x59')][0x2]?_0x4ab736[_0x7c88('0x59')][0x2][_0x7c88('0x5d')]:undefined)||null},{'name':_0x7c88('0x66'),'value':_0x4ab736[_0x7c88('0x66')]||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736[_0x7c88('0x59')][0x3]?_0x4ab736[_0x7c88('0x59')][0x3][_0x7c88('0x5d')]:undefined)||[]}];case'web-report':return[{'name':_0x7c88('0x6c'),'type':_0x4ab736[_0x7c88('0x6d')]||(_0x4ab736['attrs']&&_0x4ab736[_0x7c88('0x59')][0x0]?_0x4ab736[_0x7c88('0x59')][0x0][_0x7c88('0x32')]:undefined)||null,'value':_0x4ab736['attrReport']||(_0x4ab736[_0x7c88('0x59')]&&_0x4ab736[_0x7c88('0x59')][0x0]?_0x4ab736[_0x7c88('0x59')][0x0][_0x7c88('0x5d')]:undefined)||null},{'name':_0x7c88('0x6e'),'value':_0x4ab736[_0x7c88('0x6e')]||(_0x4ab736['attrs']&&_0x4ab736[_0x7c88('0x59')][0x1]?_0x4ab736['attrs'][0x1][_0x7c88('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x5b1da5){logger[_0x7c88('0x2c')](_0x7c88('0x6f'),JSON[_0x7c88('0x70')](_0x5b1da5));return[];}}exports[_0x7c88('0x71')]=function(_0x4b8687,_0x154463,_0x534b53){if(_0x4b8687['body']['id']){delete _0x4b8687[_0x7c88('0x4b')]['id'];}return db[_0x7c88('0x42')][_0x7c88('0x49')]({'where':{'id':_0x4b8687[_0x7c88('0x47')]['id']}})[_0x7c88('0x28')](handleEntityNotFound(_0x154463,null))[_0x7c88('0x28')](function(_0x2b3ac6){if(_0x2b3ac6){_0x4b8687[_0x7c88('0x4b')][_0x7c88('0x72')]=_0x2b3ac6['id'];_0x4b8687['body'][_0x7c88('0x59')]=widgetAttributes(_0x4b8687[_0x7c88('0x4b')]);return db[_0x7c88('0x73')][_0x7c88('0x4a')](_0x4b8687[_0x7c88('0x4b')]);}})[_0x7c88('0x28')](respondWithResult(_0x154463,null))[_0x7c88('0x46')](handleError(_0x154463,null));};exports['getItems']=function(_0xfe6604,_0x40a6f3,_0x358d15){var _0x480ac7={};var _0x59c113={};var _0x15e1a8;var _0x50ed21;return db['Dashboard'][_0x7c88('0x74')]({'where':{'id':_0xfe6604['params']['id']}})['then'](handleEntityNotFound(_0x40a6f3,null))[_0x7c88('0x28')](function(_0x2a8670){if(_0x2a8670){_0x15e1a8=_0x2a8670;_0x59c113[_0x7c88('0x34')]=_['keys'](db[_0x7c88('0x73')]['rawAttributes']);_0x59c113['query']=_[_0x7c88('0x48')](_0xfe6604[_0x7c88('0x35')]);_0x59c113['filters']=_['intersection'](_0x59c113[_0x7c88('0x34')],_0x59c113[_0x7c88('0x35')]);_0x480ac7['attributes']=_[_0x7c88('0x36')](_0x59c113[_0x7c88('0x34')],qs[_0x7c88('0x38')](_0xfe6604[_0x7c88('0x35')]['fields']));_0x480ac7['attributes']=_0x480ac7[_0x7c88('0x37')][_0x7c88('0x39')]?_0x480ac7[_0x7c88('0x37')]:_0x59c113[_0x7c88('0x34')];_0x480ac7[_0x7c88('0x75')]=qs[_0x7c88('0x3b')](_0xfe6604[_0x7c88('0x35')][_0x7c88('0x3b')]);_0x480ac7['where']=qs['filters'](_[_0x7c88('0x3d')](_0xfe6604[_0x7c88('0x35')],_0x59c113[_0x7c88('0x3c')]));if(_0xfe6604[_0x7c88('0x35')][_0x7c88('0x3e')]){_0x480ac7[_0x7c88('0x3f')]=_[_0x7c88('0x40')](_0x480ac7[_0x7c88('0x3f')],{'$or':_[_0x7c88('0x30')](_0x480ac7['attributes'],function(_0x123c65){var _0x1e76ba={};_0x1e76ba[_0x123c65]={'$like':'%'+_0xfe6604['query'][_0x7c88('0x3e')]+'%'};return _0x1e76ba;})});}_0x480ac7=_[_0x7c88('0x40')]({},_0x480ac7,_0xfe6604[_0x7c88('0x41')]);return _0x15e1a8[_0x7c88('0x76')](_0x480ac7);}})[_0x7c88('0x28')](function(_0x18bb54){if(_0x18bb54){_0x50ed21=_0x18bb54['length'];if(!_0xfe6604[_0x7c88('0x35')][_0x7c88('0x77')](_0x7c88('0x3a'))){_0x480ac7['limit']=qs[_0x7c88('0x20')](_0xfe6604[_0x7c88('0x35')][_0x7c88('0x20')]);_0x480ac7[_0x7c88('0x1e')]=qs[_0x7c88('0x1e')](_0xfe6604[_0x7c88('0x35')][_0x7c88('0x1e')]);}return _0x15e1a8[_0x7c88('0x76')](_0x480ac7);}})[_0x7c88('0x28')](function(_0x3dd281){if(_0x3dd281){return _0x3dd281?{'count':_0x50ed21,'rows':_0x3dd281}:null;}})[_0x7c88('0x28')](respondWithResult(_0x40a6f3,null))[_0x7c88('0x46')](handleError(_0x40a6f3,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 57f225b..b0d10d3 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 _0xac26=['events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x5f2098,_0x47308b){var _0x18af32=function(_0xa53c8e){while(--_0xa53c8e){_0x5f2098['push'](_0x5f2098['shift']());}};_0x18af32(++_0x47308b);}(_0xac26,0x70));var _0x6ac2=function(_0x2b321d,_0x1fcf98){_0x2b321d=_0x2b321d-0x0;var _0x4e530=_0xac26[_0x2b321d];return _0x4e530;};'use strict';var EventEmitter=require(_0x6ac2('0x0'));var Dashboard=require(_0x6ac2('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6ac2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ac2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x44a33a){return function(_0x14154f,_0x51cd8d,_0x35a2f9){DashboardEvents[_0x6ac2('0x4')](_0x44a33a+':'+_0x14154f['id'],_0x14154f);DashboardEvents[_0x6ac2('0x4')](_0x44a33a,_0x14154f);_0x35a2f9(null);};}for(var e in events){if(events[_0x6ac2('0x5')](e)){var event=events[e];Dashboard[_0x6ac2('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x6f70=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x6f70,0x8d));var _0x06f7=function(_0x4092c9,_0x501542){_0x4092c9=_0x4092c9-0x0;var _0x5cf57d=_0x6f70[_0x4092c9];return _0x5cf57d;};'use strict';var EventEmitter=require(_0x06f7('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x06f7('0x1')](0x0);var events={'afterCreate':_0x06f7('0x2'),'afterUpdate':_0x06f7('0x3'),'afterDestroy':_0x06f7('0x4')};function emitEvent(_0x356128){return function(_0x54dbb9,_0x33ce45,_0x52ce08){DashboardEvents['emit'](_0x356128+':'+_0x54dbb9['id'],_0x54dbb9);DashboardEvents[_0x06f7('0x5')](_0x356128,_0x54dbb9);_0x52ce08(null);};}for(var e in events){if(events[_0x06f7('0x6')](e)){var event=events[e];Dashboard[_0x06f7('0x7')](e,emitEvent(event));}}module[_0x06f7('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ac4489c..3cebf47 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 _0x1e86=['../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x1ec0eb,_0x43ee23){var _0x46cb5d=function(_0x2d7b84){while(--_0x2d7b84){_0x1ec0eb['push'](_0x1ec0eb['shift']());}};_0x46cb5d(++_0x43ee23);}(_0x1e86,0x94));var _0x61e8=function(_0x5148d5,_0x1a9f22){_0x5148d5=_0x5148d5-0x0;var _0x3a63c9=_0x1e86[_0x5148d5];return _0x3a63c9;};'use strict';var _=require(_0x61e8('0x0'));var util=require(_0x61e8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x61e8('0x2'));var BPromise=require(_0x61e8('0x3'));var rp=require(_0x61e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61e8('0x5'));var config=require(_0x61e8('0x6'));var attributes=require(_0x61e8('0x7'));module[_0x61e8('0x8')]=function(_0x13f0a8,_0x5315d3){return _0x13f0a8[_0x61e8('0x9')]('Dashboard',attributes,{'tableName':_0x61e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d38=['bluebird','path','rimraf','../../config/environment','exports','define','Dashboard','lodash','util','../../config/logger','api'];(function(_0x56601c,_0x6a4bbb){var _0x42b076=function(_0x4efcd8){while(--_0x4efcd8){_0x56601c['push'](_0x56601c['shift']());}};_0x42b076(++_0x6a4bbb);}(_0x7d38,0x8b));var _0x87d3=function(_0x38cc45,_0x5ec4d0){_0x38cc45=_0x38cc45-0x0;var _0x19e92f=_0x7d38[_0x38cc45];return _0x19e92f;};'use strict';var _=require(_0x87d3('0x0'));var util=require(_0x87d3('0x1'));var logger=require(_0x87d3('0x2'))(_0x87d3('0x3'));var moment=require('moment');var BPromise=require(_0x87d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87d3('0x5'));var rimraf=require(_0x87d3('0x6'));var config=require(_0x87d3('0x7'));var attributes=require('./dashboard.attributes');module[_0x87d3('0x8')]=function(_0x5197f4,_0x24e3c3){return _0x5197f4[_0x87d3('0x9')](_0x87d3('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8e44ed0..4996412 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 _0x8c62=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8c62,0x66));var _0x28c6=function(_0x20d767,_0x35f167){_0x20d767=_0x20d767-0x0;var _0x564265=_0x8c62[_0x20d767];return _0x564265;};'use strict';var _=require('lodash');var util=require(_0x28c6('0x0'));var moment=require(_0x28c6('0x1'));var BPromise=require(_0x28c6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28c6('0x3'));var db=require(_0x28c6('0x4'))['db'];var utils=require(_0x28c6('0x5'));var logger=require(_0x28c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x28c6('0x7'));var client=jayson[_0x28c6('0x8')][_0x28c6('0x9')]({'port':0x232a});config[_0x28c6('0xa')]=_['defaults'](config[_0x28c6('0xa')],{'host':_0x28c6('0xb'),'port':0x18eb});var socket=require(_0x28c6('0xc'))(new Redis(config[_0x28c6('0xa')]));require(_0x28c6('0xd'))[_0x28c6('0xe')](socket);function respondWithRpcPromise(_0x330c4d,_0x5c7ecf,_0x4dc6a7){return new BPromise(function(_0x53aa7d,_0x52eda2){return client['request'](_0x330c4d,_0x4dc6a7)['then'](function(_0x223436){logger[_0x28c6('0xf')](_0x28c6('0x10'),_0x5c7ecf,_0x28c6('0x11'));logger[_0x28c6('0x12')](_0x28c6('0x13'),_0x5c7ecf,'request\x20sent',JSON[_0x28c6('0x14')](_0x223436));if(_0x223436[_0x28c6('0x15')]){if(_0x223436[_0x28c6('0x15')]['code']===0x1f4){logger[_0x28c6('0x15')](_0x28c6('0x10'),_0x5c7ecf,_0x223436[_0x28c6('0x15')]['message']);return _0x52eda2(_0x223436[_0x28c6('0x15')]['message']);}logger['error'](_0x28c6('0x10'),_0x5c7ecf,_0x223436[_0x28c6('0x15')][_0x28c6('0x16')]);return _0x53aa7d(_0x223436['error']['message']);}else{logger['info'](_0x28c6('0x10'),_0x5c7ecf,'request\x20sent');_0x53aa7d(_0x223436[_0x28c6('0x17')][_0x28c6('0x16')]);}})[_0x28c6('0x18')](function(_0x3f57c5){logger[_0x28c6('0x15')](_0x28c6('0x10'),_0x5c7ecf,_0x3f57c5);_0x52eda2(_0x3f57c5);});});} \ No newline at end of file +var _0x2b8a=['../../config/environment','client','redis','localhost','socket.io-emitter','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x2b8a,0x13c));var _0xa2b8=function(_0x3dec58,_0x2fb4bb){_0x3dec58=_0x3dec58-0x0;var _0x25360c=_0x2b8a[_0x3dec58];return _0x25360c;};'use strict';var _=require(_0xa2b8('0x0'));var util=require(_0xa2b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2b8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2b8('0x3'));var logger=require(_0xa2b8('0x4'))(_0xa2b8('0x5'));var config=require(_0xa2b8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa2b8('0x7')]['http']({'port':0x232a});config[_0xa2b8('0x8')]=_['defaults'](config['redis'],{'host':_0xa2b8('0x9'),'port':0x18eb});var socket=require(_0xa2b8('0xa'))(new Redis(config[_0xa2b8('0x8')]));require(_0xa2b8('0xb'))['register'](socket);function respondWithRpcPromise(_0x1eb41e,_0x374370,_0x27143d){return new BPromise(function(_0x4fa664,_0x3d3630){return client[_0xa2b8('0xc')](_0x1eb41e,_0x27143d)['then'](function(_0x3969a3){logger[_0xa2b8('0xd')](_0xa2b8('0xe'),_0x374370,_0xa2b8('0xf'));logger[_0xa2b8('0x10')](_0xa2b8('0x11'),_0x374370,'request\x20sent',JSON[_0xa2b8('0x12')](_0x3969a3));if(_0x3969a3[_0xa2b8('0x13')]){if(_0x3969a3[_0xa2b8('0x13')][_0xa2b8('0x14')]===0x1f4){logger['error'](_0xa2b8('0xe'),_0x374370,_0x3969a3[_0xa2b8('0x13')]['message']);return _0x3d3630(_0x3969a3['error'][_0xa2b8('0x15')]);}logger[_0xa2b8('0x13')](_0xa2b8('0xe'),_0x374370,_0x3969a3[_0xa2b8('0x13')][_0xa2b8('0x15')]);return _0x4fa664(_0x3969a3[_0xa2b8('0x13')][_0xa2b8('0x15')]);}else{logger[_0xa2b8('0xd')](_0xa2b8('0xe'),_0x374370,'request\x20sent');_0x4fa664(_0x3969a3[_0xa2b8('0x16')][_0xa2b8('0x15')]);}})['catch'](function(_0x69432d){logger[_0xa2b8('0x13')]('Dashboard,\x20%s,\x20%s',_0x374370,_0x69432d);_0x3d3630(_0x69432d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4881726..ab1ccd5 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 _0x452a=['removeListener','register','length','dashboard:','./dashboard.events','save','update','emit'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0x452a,0x18c));var _0xa452=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x452a[_0x53e3de];return _0x7b905b;};'use strict';var DashboardEvents=require(_0xa452('0x0'));var events=[_0xa452('0x1'),'remove',_0xa452('0x2')];function createListener(_0x310ad7,_0xceccd5){return function(_0x1ead1d){_0xceccd5[_0xa452('0x3')](_0x310ad7,_0x1ead1d);};}function removeListener(_0x4f6375,_0x15fa22){return function(){DashboardEvents[_0xa452('0x4')](_0x4f6375,_0x15fa22);};}exports[_0xa452('0x5')]=function(_0x536c35){for(var _0x56b57c=0x0,_0x276d37=events[_0xa452('0x6')];_0x56b57c<_0x276d37;_0x56b57c++){var _0x35bf1d=events[_0x56b57c];var _0x137c7e=createListener(_0xa452('0x7')+_0x35bf1d,_0x536c35);DashboardEvents['on'](_0x35bf1d,_0x137c7e);}}; \ No newline at end of file +var _0x6a66=['update','emit','removeListener','length','dashboard:','remove'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x6a66,0xad));var _0x66a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a66[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x66a6('0x0'),_0x66a6('0x1')];function createListener(_0x15362e,_0x43b635){return function(_0x2f7754){_0x43b635[_0x66a6('0x2')](_0x15362e,_0x2f7754);};}function removeListener(_0x1abfaf,_0x5982e2){return function(){DashboardEvents[_0x66a6('0x3')](_0x1abfaf,_0x5982e2);};}exports['register']=function(_0x4c4dba){for(var _0x1d797a=0x0,_0x4c404d=events[_0x66a6('0x4')];_0x1d797a<_0x4c404d;_0x1d797a++){var _0x46861c=events[_0x1d797a];var _0x3a18b6=createListener(_0x66a6('0x5')+_0x46861c,_0x4c4dba);DashboardEvents['on'](_0x46861c,_0x3a18b6);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 9dce22f..47cc284 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 _0xd0bb=['post','clone','addItem','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create'];(function(_0x179a18,_0x1383b0){var _0x65d02e=function(_0x1eca91){while(--_0x1eca91){_0x179a18['push'](_0x179a18['shift']());}};_0x65d02e(++_0x1383b0);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xd0bb[_0x5a7e3c];return _0x59252b;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./dashboard.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id/clone',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['post'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);router[_0xbd0b('0x12')](_0xbd0b('0xa'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x13')]);router[_0xbd0b('0x14')](_0xbd0b('0xa'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbd50=['create','/:id/clone','post','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','/:id/items','getItems'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbd50,0x196));var _0x0bd5=function(_0x488e1e,_0x188d9e){_0x488e1e=_0x488e1e-0x0;var _0x55200c=_0xbd50[_0x488e1e];return _0x55200c;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['show']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['post'](_0x0bd5('0xf'),auth[_0x0bd5('0x8')](),controller['clone']);router[_0x0bd5('0x10')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['addItem']);router[_0x0bd5('0x11')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x12')]);router[_0x0bd5('0x13')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 851c830..09e5819 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 _0x3120=['stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','STRING','TEXT','parse','attrs','setDataValue'];(function(_0x17e651,_0x5b9d5a){var _0x48a900=function(_0x2c9a07){while(--_0x2c9a07){_0x17e651['push'](_0x17e651['shift']());}};_0x48a900(++_0x5b9d5a);}(_0x3120,0x101));var _0x0312=function(_0x2340e4,_0x26f13c){_0x2340e4=_0x2340e4-0x0;var _0x16c5d0=_0x3120[_0x2340e4];return _0x16c5d0;};'use strict';var Sequelize=require(_0x0312('0x0'));var squel=require('squel');var _=require(_0x0312('0x1'));module['exports']={'title':{'type':Sequelize[_0x0312('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0312('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0312('0x3')]('long'),'get':function(){try{return JSON[_0x0312('0x4')](this['getDataValue'](_0x0312('0x5')));}catch(_0x509afd){return[];}},'set':function(_0x29df82){try{this[_0x0312('0x6')](_0x0312('0x5'),JSON[_0x0312('0x7')](_0x29df82));}catch(_0x3f667d){this['setDataValue'](_0x0312('0x5'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x0312('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0312('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0312('0x8')]},'col':{'type':Sequelize[_0x0312('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0312('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x0312('0x2')],'allowNull':![],'defaultValue':_0x0312('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0312('0x2')]},'titleFontSize':{'type':Sequelize[_0x0312('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0xd781=['#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x51f9b4,_0x231658){var _0x5e115d=function(_0x5a0504){while(--_0x5a0504){_0x51f9b4['push'](_0x51f9b4['shift']());}};_0x5e115d(++_0x231658);}(_0xd781,0x1bb));var _0x1d78=function(_0x4d604c,_0x434792){_0x4d604c=_0x4d604c-0x0;var _0x66c4f=_0xd781[_0x4d604c];return _0x66c4f;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1d78('0x0'));var _=require('lodash');module[_0x1d78('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1d78('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1d78('0x3')](_0x1d78('0x4')),'get':function(){try{return JSON[_0x1d78('0x5')](this[_0x1d78('0x6')](_0x1d78('0x7')));}catch(_0x47184b){return[];}},'set':function(_0x21fe81){try{this[_0x1d78('0x8')](_0x1d78('0x7'),JSON[_0x1d78('0x9')](_0x21fe81));}catch(_0x1ee56d){this[_0x1d78('0x8')]('attrs',JSON[_0x1d78('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1d78('0xa')]},'col':{'type':Sequelize[_0x1d78('0xa')]},'background':{'type':Sequelize[_0x1d78('0x2')],'allowNull':![],'defaultValue':_0x1d78('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1d78('0x2')],'allowNull':![],'defaultValue':_0x1d78('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x1d78('0x2')]},'titleFontSize':{'type':Sequelize[_0x1d78('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ccb0dcd..bc43bd3 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 _0x3472=['socket.io-emitter','./dashboardItem.socket','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x141826,_0x425274){var _0x295c5f=function(_0x55d356){while(--_0x55d356){_0x141826['push'](_0x141826['shift']());}};_0x295c5f(++_0x425274);}(_0x3472,0xf2));var _0x2347=function(_0x5e3ebf,_0x53c12f){_0x5e3ebf=_0x5e3ebf-0x0;var _0x2ad81f=_0x3472[_0x5e3ebf];return _0x2ad81f;};'use strict';var emlformat=require(_0x2347('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2347('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2347('0x2'));var moment=require(_0x2347('0x3'));var BPromise=require(_0x2347('0x4'));var Mustache=require(_0x2347('0x5'));var util=require(_0x2347('0x6'));var path=require(_0x2347('0x7'));var sox=require(_0x2347('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2347('0x9'));var _=require(_0x2347('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2347('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2347('0xc'));var Papa=require(_0x2347('0xd'));var Redis=require(_0x2347('0xe'));var authService=require(_0x2347('0xf'));var qs=require(_0x2347('0x10'));var as=require(_0x2347('0x11'));var hardwareService=require(_0x2347('0x12'));var logger=require('../../config/logger')(_0x2347('0x13'));var utils=require('../../config/utils');var config=require(_0x2347('0x14'));var licenseUtil=require(_0x2347('0x15'));var db=require(_0x2347('0x16'))['db'];config[_0x2347('0x17')]=_[_0x2347('0x18')](config[_0x2347('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2347('0x19'))(new Redis(config[_0x2347('0x17')]));require(_0x2347('0x1a'))['register'](socket);function respondWithStatusCode(_0x7f5637,_0x3a6e71){_0x3a6e71=_0x3a6e71||0xcc;return function(_0x24dd53){if(_0x24dd53){return _0x7f5637['sendStatus'](_0x3a6e71);}return _0x7f5637[_0x2347('0x1b')](_0x3a6e71)[_0x2347('0x1c')]();};}function respondWithResult(_0xca1d53,_0x34f529){_0x34f529=_0x34f529||0xc8;return function(_0x129dbb){if(_0x129dbb){return _0xca1d53[_0x2347('0x1b')](_0x34f529)[_0x2347('0x1d')](_0x129dbb);}};}function respondWithFilteredResult(_0x22057d,_0x3cdae7){return function(_0x4d9ea7){if(_0x4d9ea7){var _0x234888=typeof _0x3cdae7[_0x2347('0x1e')]===_0x2347('0x1f')&&typeof _0x3cdae7['limit']===_0x2347('0x1f');var _0x3f2a6e=_0x4d9ea7['count'];var _0xe96f28=_0x234888?0x0:_0x3cdae7['offset'];var _0x57f73e=_0x234888?_0x4d9ea7['count']:_0x3cdae7[_0x2347('0x1e')]+_0x3cdae7['limit'];var _0x13c9a8;if(_0x57f73e>=_0x3f2a6e){_0x57f73e=_0x3f2a6e;_0x13c9a8=0xc8;}else{_0x13c9a8=0xce;}_0x22057d[_0x2347('0x1b')](_0x13c9a8);return _0x22057d[_0x2347('0x20')](_0x2347('0x21'),_0xe96f28+'-'+_0x57f73e+'/'+_0x3f2a6e)['json'](_0x4d9ea7);}return null;};}function patchUpdates(_0x55871d){return function(_0x1151af){try{jsonpatch[_0x2347('0x22')](_0x1151af,_0x55871d,!![]);}catch(_0x5356cc){return BPromise[_0x2347('0x23')](_0x5356cc);}return _0x1151af[_0x2347('0x24')]();};}function saveUpdates(_0x402c34,_0x1a9a59){return function(_0x3a84be){if(_0x3a84be){return _0x3a84be[_0x2347('0x25')](_0x402c34)[_0x2347('0x26')](function(_0x496b3f){return _0x496b3f;});}return null;};}function removeEntity(_0x2f67b3,_0x5ad8e1){return function(_0x22dcee){if(_0x22dcee){return _0x22dcee[_0x2347('0x27')]()['then'](function(){_0x2f67b3['status'](0xcc)[_0x2347('0x1c')]();});}};}function handleEntityNotFound(_0x24a37d,_0x33331c){return function(_0x4bc2e5){if(!_0x4bc2e5){_0x24a37d[_0x2347('0x28')](0x194);}return _0x4bc2e5;};}function handleError(_0x1131f1,_0x4bcb33){_0x4bcb33=_0x4bcb33||0x1f4;return function(_0x43250b){logger[_0x2347('0x29')](_0x43250b[_0x2347('0x2a')]);if(_0x43250b['name']){delete _0x43250b['name'];}_0x1131f1[_0x2347('0x1b')](_0x4bcb33)[_0x2347('0x2b')](_0x43250b);};}exports[_0x2347('0x2c')]=function(_0x4fe588,_0x10ebcf){var _0xd7df1a={'raw':![],'where':{'id':_0x4fe588[_0x2347('0x2d')]['id']}},_0x29ae8b={};_0x29ae8b[_0x2347('0x2e')]=_[_0x2347('0x2f')](db['DashboardItem'][_0x2347('0x30')]);_0x29ae8b[_0x2347('0x31')]=_['keys'](_0x4fe588[_0x2347('0x31')]);_0x29ae8b['filters']=_[_0x2347('0x32')](_0x29ae8b[_0x2347('0x2e')],_0x29ae8b[_0x2347('0x31')]);_0xd7df1a[_0x2347('0x33')]=_[_0x2347('0x32')](_0x29ae8b['model'],qs[_0x2347('0x34')](_0x4fe588['query']['fields']));_0xd7df1a[_0x2347('0x33')]=_0xd7df1a[_0x2347('0x33')][_0x2347('0x35')]?_0xd7df1a[_0x2347('0x33')]:_0x29ae8b[_0x2347('0x2e')];if(_0x4fe588[_0x2347('0x31')][_0x2347('0x36')]){_0xd7df1a[_0x2347('0x37')]=[{'all':!![]}];}_0xd7df1a=_[_0x2347('0x38')]({},_0xd7df1a,_0x4fe588[_0x2347('0x39')]);return db[_0x2347('0x3a')]['find'](_0xd7df1a)[_0x2347('0x26')](handleEntityNotFound(_0x10ebcf,null))[_0x2347('0x26')](respondWithResult(_0x10ebcf,null))[_0x2347('0x3b')](handleError(_0x10ebcf,null));};exports[_0x2347('0x27')]=function(_0x4aa8a3,_0x54d3ee){return db[_0x2347('0x3a')][_0x2347('0x3c')]({'where':{'id':_0x4aa8a3[_0x2347('0x2d')]['id']}})[_0x2347('0x26')](handleEntityNotFound(_0x54d3ee,null))[_0x2347('0x26')](removeEntity(_0x54d3ee,null))['catch'](handleError(_0x54d3ee,null));};function widgetAttributes(_0x150704){try{switch(_0x150704[_0x2347('0x3d')]){case _0x2347('0x3e'):return[{'name':_0x2347('0x3f'),'value':_0x150704['attrUrl']||(_0x150704['attrs']&&_0x150704[_0x2347('0x40')][0x0]?_0x150704['attrs'][0x0][_0x2347('0x41')]:undefined)||_0x2347('0x42')}];case _0x2347('0x43'):return[{'name':'attrPath','value':_0x150704[_0x2347('0x44')]||(_0x150704['attrs']&&_0x150704['attrs'][0x0]?_0x150704[_0x2347('0x40')][0x0][_0x2347('0x41')]:undefined)||''}];case _0x2347('0x45'):return[{'name':_0x2347('0x46'),'value':_0x150704['attrHourFormat']||(_0x150704['attrs']&&_0x150704['attrs'][0x0]?_0x150704[_0x2347('0x40')][0x0][_0x2347('0x41')]:undefined)||_0x2347('0x47')},{'name':_0x2347('0x48'),'value':_0x150704[_0x2347('0x48')]||(_0x150704['attrs']&&_0x150704[_0x2347('0x40')][0x1]?_0x150704[_0x2347('0x40')][0x1][_0x2347('0x41')]:undefined)||_0x2347('0x49')},{'name':'attrFontSize','value':_0x150704[_0x2347('0x4a')]||(_0x150704['attrs']&&_0x150704[_0x2347('0x40')][0x2]?_0x150704[_0x2347('0x40')][0x2][_0x2347('0x41')]:undefined)||0xc}];case _0x2347('0x4b'):return[{'name':_0x2347('0x4c'),'value':_0x150704['attrMetric']||(_0x150704[_0x2347('0x40')]&&_0x150704['attrs'][0x0]?_0x150704[_0x2347('0x40')][0x0][_0x2347('0x41')]:undefined)||_0x2347('0x4d')},{'name':_0x2347('0x4e'),'value':_0x150704['attrVoiceQueues']||(_0x150704['attrs']&&_0x150704['attrs'][0x1]?_0x150704[_0x2347('0x40')][0x1][_0x2347('0x41')]:undefined)||[]},{'name':_0x2347('0x4a'),'value':_0x150704['attrFontSize']||(_0x150704[_0x2347('0x40')]&&_0x150704['attrs'][0x2]?_0x150704['attrs'][0x2][_0x2347('0x41')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x150704[_0x2347('0x4f')]||(_0x150704['attrs']&&_0x150704[_0x2347('0x40')][0x0]?_0x150704[_0x2347('0x40')][0x0][_0x2347('0x41')]:undefined)||'total'},{'name':_0x2347('0x50'),'value':_0x150704[_0x2347('0x50')]||(_0x150704[_0x2347('0x40')]&&_0x150704[_0x2347('0x40')][0x1]?_0x150704[_0x2347('0x40')][0x1][_0x2347('0x41')]:undefined)||null},{'name':'attrSerie3','value':_0x150704[_0x2347('0x51')]||(_0x150704['attrs']&&_0x150704[_0x2347('0x40')][0x2]?_0x150704[_0x2347('0x40')][0x2][_0x2347('0x41')]:undefined)||null},{'name':_0x2347('0x4e'),'value':_0x150704[_0x2347('0x4e')]||(_0x150704[_0x2347('0x40')]&&_0x150704[_0x2347('0x40')][0x3]?_0x150704[_0x2347('0x40')][0x3][_0x2347('0x41')]:undefined)||[]}];case _0x2347('0x52'):return[{'name':_0x2347('0x53'),'type':_0x150704[_0x2347('0x54')]||(_0x150704[_0x2347('0x40')]&&_0x150704[_0x2347('0x40')][0x0]?_0x150704[_0x2347('0x40')][0x0][_0x2347('0x3d')]:undefined)||null,'value':_0x150704[_0x2347('0x53')]||(_0x150704[_0x2347('0x40')]&&_0x150704[_0x2347('0x40')][0x0]?_0x150704[_0x2347('0x40')][0x0][_0x2347('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x150704[_0x2347('0x55')]||(_0x150704['attrs']&&_0x150704[_0x2347('0x40')][0x1]?_0x150704[_0x2347('0x40')][0x1][_0x2347('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x4318c4){logger[_0x2347('0x29')]('widgetAttributes:\x20%s',JSON[_0x2347('0x56')](_0x4318c4));return[];}}exports[_0x2347('0x57')]=function(_0x30c250,_0x6d519a){if(_0x30c250[_0x2347('0x58')]){_0x30c250[_0x2347('0x58')][_0x2347('0x40')]=widgetAttributes(_0x30c250[_0x2347('0x58')]);}return db['DashboardItem'][_0x2347('0x57')](_0x30c250[_0x2347('0x58')],{})[_0x2347('0x26')](respondWithResult(_0x6d519a,0xc9))[_0x2347('0x3b')](handleError(_0x6d519a,null));};exports['update']=function(_0x342ae8,_0x27c83b){if(_0x342ae8[_0x2347('0x58')]['id']){delete _0x342ae8['body']['id'];}_0x342ae8[_0x2347('0x58')]['attrs']=widgetAttributes(_0x342ae8[_0x2347('0x58')]);return db['DashboardItem']['find']({'where':{'id':_0x342ae8[_0x2347('0x2d')]['id']}})[_0x2347('0x26')](handleEntityNotFound(_0x27c83b,null))[_0x2347('0x26')](saveUpdates(_0x342ae8[_0x2347('0x58')],null))[_0x2347('0x26')](respondWithResult(_0x27c83b,null))['catch'](handleError(_0x27c83b,null));}; \ No newline at end of file +var _0x778e=['end','error','stack','name','send','show','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','params','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x778e,0x8f));var _0xe778=function(_0x17eb33,_0x3fab48){_0x17eb33=_0x17eb33-0x0;var _0x204290=_0x778e[_0x17eb33];return _0x204290;};'use strict';var emlformat=require(_0xe778('0x0'));var rimraf=require(_0xe778('0x1'));var zipdir=require(_0xe778('0x2'));var jsonpatch=require(_0xe778('0x3'));var rp=require(_0xe778('0x4'));var moment=require(_0xe778('0x5'));var BPromise=require(_0xe778('0x6'));var Mustache=require('mustache');var util=require(_0xe778('0x7'));var path=require('path');var sox=require(_0xe778('0x8'));var csv=require(_0xe778('0x9'));var ejs=require(_0xe778('0xa'));var fs=require('fs');var fs_extra=require(_0xe778('0xb'));var _=require(_0xe778('0xc'));var squel=require(_0xe778('0xd'));var crypto=require(_0xe778('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe778('0xf'));var toCsv=require(_0xe778('0x9'));var querystring=require(_0xe778('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe778('0x11'));var qs=require(_0xe778('0x12'));var as=require(_0xe778('0x13'));var hardwareService=require(_0xe778('0x14'));var logger=require(_0xe778('0x15'))(_0xe778('0x16'));var utils=require(_0xe778('0x17'));var config=require(_0xe778('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe778('0x19'))['db'];config[_0xe778('0x1a')]=_[_0xe778('0x1b')](config[_0xe778('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe778('0x1c'))(new Redis(config[_0xe778('0x1a')]));require(_0xe778('0x1d'))[_0xe778('0x1e')](socket);function respondWithStatusCode(_0x4cdf0f,_0x32c74b){_0x32c74b=_0x32c74b||0xcc;return function(_0x1ad980){if(_0x1ad980){return _0x4cdf0f[_0xe778('0x1f')](_0x32c74b);}return _0x4cdf0f[_0xe778('0x20')](_0x32c74b)['end']();};}function respondWithResult(_0x2af57f,_0x49fc9c){_0x49fc9c=_0x49fc9c||0xc8;return function(_0xd1404a){if(_0xd1404a){return _0x2af57f[_0xe778('0x20')](_0x49fc9c)[_0xe778('0x21')](_0xd1404a);}};}function respondWithFilteredResult(_0x524609,_0x44d5c7){return function(_0x31042f){if(_0x31042f){var _0x501f74=typeof _0x44d5c7[_0xe778('0x22')]===_0xe778('0x23')&&typeof _0x44d5c7[_0xe778('0x24')]===_0xe778('0x23');var _0x313ebd=_0x31042f[_0xe778('0x25')];var _0x3830a6=_0x501f74?0x0:_0x44d5c7['offset'];var _0x5a9c58=_0x501f74?_0x31042f['count']:_0x44d5c7['offset']+_0x44d5c7['limit'];var _0x413e68;if(_0x5a9c58>=_0x313ebd){_0x5a9c58=_0x313ebd;_0x413e68=0xc8;}else{_0x413e68=0xce;}_0x524609['status'](_0x413e68);return _0x524609[_0xe778('0x26')](_0xe778('0x27'),_0x3830a6+'-'+_0x5a9c58+'/'+_0x313ebd)[_0xe778('0x21')](_0x31042f);}return null;};}function patchUpdates(_0x544774){return function(_0x336cb9){try{jsonpatch[_0xe778('0x28')](_0x336cb9,_0x544774,!![]);}catch(_0x5f1d31){return BPromise[_0xe778('0x29')](_0x5f1d31);}return _0x336cb9['save']();};}function saveUpdates(_0xb73284,_0x523c3b){return function(_0x2ac18e){if(_0x2ac18e){return _0x2ac18e[_0xe778('0x2a')](_0xb73284)[_0xe778('0x2b')](function(_0x75bd5e){return _0x75bd5e;});}return null;};}function removeEntity(_0x53ec1f,_0x434b9a){return function(_0x334712){if(_0x334712){return _0x334712[_0xe778('0x2c')]()['then'](function(){_0x53ec1f[_0xe778('0x20')](0xcc)[_0xe778('0x2d')]();});}};}function handleEntityNotFound(_0x228ade,_0x4b2f31){return function(_0x34b7fc){if(!_0x34b7fc){_0x228ade['sendStatus'](0x194);}return _0x34b7fc;};}function handleError(_0x1af7c1,_0x395c3e){_0x395c3e=_0x395c3e||0x1f4;return function(_0x49d9c4){logger[_0xe778('0x2e')](_0x49d9c4[_0xe778('0x2f')]);if(_0x49d9c4['name']){delete _0x49d9c4[_0xe778('0x30')];}_0x1af7c1[_0xe778('0x20')](_0x395c3e)[_0xe778('0x31')](_0x49d9c4);};}exports[_0xe778('0x32')]=function(_0x197940,_0x130191){var _0x173db5={'raw':![],'where':{'id':_0x197940['params']['id']}},_0x56f0a2={};_0x56f0a2['model']=_['keys'](db[_0xe778('0x33')][_0xe778('0x34')]);_0x56f0a2['query']=_['keys'](_0x197940[_0xe778('0x35')]);_0x56f0a2[_0xe778('0x36')]=_[_0xe778('0x37')](_0x56f0a2[_0xe778('0x38')],_0x56f0a2[_0xe778('0x35')]);_0x173db5[_0xe778('0x39')]=_[_0xe778('0x37')](_0x56f0a2[_0xe778('0x38')],qs['fields'](_0x197940['query'][_0xe778('0x3a')]));_0x173db5[_0xe778('0x39')]=_0x173db5['attributes'][_0xe778('0x3b')]?_0x173db5[_0xe778('0x39')]:_0x56f0a2[_0xe778('0x38')];if(_0x197940[_0xe778('0x35')][_0xe778('0x3c')]){_0x173db5[_0xe778('0x3d')]=[{'all':!![]}];}_0x173db5=_[_0xe778('0x3e')]({},_0x173db5,_0x197940[_0xe778('0x3f')]);return db[_0xe778('0x33')][_0xe778('0x40')](_0x173db5)[_0xe778('0x2b')](handleEntityNotFound(_0x130191,null))[_0xe778('0x2b')](respondWithResult(_0x130191,null))['catch'](handleError(_0x130191,null));};exports[_0xe778('0x2c')]=function(_0x168d46,_0x282b7f){return db[_0xe778('0x33')][_0xe778('0x40')]({'where':{'id':_0x168d46[_0xe778('0x41')]['id']}})[_0xe778('0x2b')](handleEntityNotFound(_0x282b7f,null))[_0xe778('0x2b')](removeEntity(_0x282b7f,null))[_0xe778('0x42')](handleError(_0x282b7f,null));};function widgetAttributes(_0x2041e9){try{switch(_0x2041e9[_0xe778('0x43')]){case _0xe778('0x44'):return[{'name':_0xe778('0x45'),'value':_0x2041e9[_0xe778('0x45')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x0]?_0x2041e9[_0xe778('0x46')][0x0]['value']:undefined)||_0xe778('0x47')}];case _0xe778('0x48'):return[{'name':_0xe778('0x49'),'value':_0x2041e9['attrPath']||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x0]?_0x2041e9[_0xe778('0x46')][0x0][_0xe778('0x4a')]:undefined)||''}];case _0xe778('0x4b'):return[{'name':_0xe778('0x4c'),'value':_0x2041e9[_0xe778('0x4c')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x0]?_0x2041e9[_0xe778('0x46')][0x0][_0xe778('0x4a')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2041e9[_0xe778('0x4d')]||(_0x2041e9['attrs']&&_0x2041e9[_0xe778('0x46')][0x1]?_0x2041e9[_0xe778('0x46')][0x1]['value']:undefined)||'0.00'},{'name':_0xe778('0x4e'),'value':_0x2041e9[_0xe778('0x4e')]||(_0x2041e9['attrs']&&_0x2041e9['attrs'][0x2]?_0x2041e9[_0xe778('0x46')][0x2]['value']:undefined)||0xc}];case _0xe778('0x4f'):return[{'name':_0xe778('0x50'),'value':_0x2041e9[_0xe778('0x50')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x0]?_0x2041e9[_0xe778('0x46')][0x0][_0xe778('0x4a')]:undefined)||'total'},{'name':_0xe778('0x51'),'value':_0x2041e9[_0xe778('0x51')]||(_0x2041e9['attrs']&&_0x2041e9[_0xe778('0x46')][0x1]?_0x2041e9[_0xe778('0x46')][0x1][_0xe778('0x4a')]:undefined)||[]},{'name':_0xe778('0x4e'),'value':_0x2041e9[_0xe778('0x4e')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x2]?_0x2041e9[_0xe778('0x46')][0x2][_0xe778('0x4a')]:undefined)||0x14}];case _0xe778('0x52'):case'pie-chart':return[{'name':_0xe778('0x53'),'value':_0x2041e9[_0xe778('0x53')]||(_0x2041e9['attrs']&&_0x2041e9['attrs'][0x0]?_0x2041e9['attrs'][0x0][_0xe778('0x4a')]:undefined)||_0xe778('0x54')},{'name':_0xe778('0x55'),'value':_0x2041e9[_0xe778('0x55')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9['attrs'][0x1]?_0x2041e9[_0xe778('0x46')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2041e9[_0xe778('0x56')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x2]?_0x2041e9['attrs'][0x2][_0xe778('0x4a')]:undefined)||null},{'name':_0xe778('0x51'),'value':_0x2041e9[_0xe778('0x51')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x3]?_0x2041e9['attrs'][0x3]['value']:undefined)||[]}];case _0xe778('0x57'):return[{'name':_0xe778('0x58'),'type':_0x2041e9[_0xe778('0x59')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x0]?_0x2041e9[_0xe778('0x46')][0x0][_0xe778('0x43')]:undefined)||null,'value':_0x2041e9['attrReport']||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9[_0xe778('0x46')][0x0]?_0x2041e9['attrs'][0x0][_0xe778('0x4a')]:undefined)||null},{'name':_0xe778('0x5a'),'value':_0x2041e9[_0xe778('0x5a')]||(_0x2041e9[_0xe778('0x46')]&&_0x2041e9['attrs'][0x1]?_0x2041e9[_0xe778('0x46')][0x1][_0xe778('0x4a')]:undefined)||0x0}];default:return[];}}catch(_0x50c6f8){logger['error'](_0xe778('0x5b'),JSON[_0xe778('0x5c')](_0x50c6f8));return[];}}exports['create']=function(_0x399843,_0x579bd0){if(_0x399843[_0xe778('0x5d')]){_0x399843[_0xe778('0x5d')]['attrs']=widgetAttributes(_0x399843['body']);}return db[_0xe778('0x33')]['create'](_0x399843[_0xe778('0x5d')],{})[_0xe778('0x2b')](respondWithResult(_0x579bd0,0xc9))[_0xe778('0x42')](handleError(_0x579bd0,null));};exports['update']=function(_0xcce77f,_0x5adc80){if(_0xcce77f[_0xe778('0x5d')]['id']){delete _0xcce77f[_0xe778('0x5d')]['id'];}_0xcce77f[_0xe778('0x5d')][_0xe778('0x46')]=widgetAttributes(_0xcce77f[_0xe778('0x5d')]);return db['DashboardItem'][_0xe778('0x40')]({'where':{'id':_0xcce77f[_0xe778('0x41')]['id']}})[_0xe778('0x2b')](handleEntityNotFound(_0x5adc80,null))[_0xe778('0x2b')](saveUpdates(_0xcce77f['body'],null))[_0xe778('0x2b')](respondWithResult(_0x5adc80,null))[_0xe778('0x42')](handleError(_0x5adc80,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 42b1520..ad0f3bd 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 _0x5ec3=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x121919,_0x605f6f){var _0x6fe5bc=function(_0x23b061){while(--_0x23b061){_0x121919['push'](_0x121919['shift']());}};_0x6fe5bc(++_0x605f6f);}(_0x5ec3,0xa1));var _0x35ec=function(_0x337b3b,_0x2ac4b3){_0x337b3b=_0x337b3b-0x0;var _0x486e45=_0x5ec3[_0x337b3b];return _0x486e45;};'use strict';var EventEmitter=require(_0x35ec('0x0'));var DashboardItem=require(_0x35ec('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x35ec('0x2')](0x0);var events={'afterCreate':_0x35ec('0x3'),'afterUpdate':_0x35ec('0x4'),'afterDestroy':_0x35ec('0x5')};function emitEvent(_0x4c712b){return function(_0x3d7560,_0x3310d4,_0x43189c){DashboardItemEvents[_0x35ec('0x6')](_0x4c712b+':'+_0x3d7560['id'],_0x3d7560);DashboardItemEvents[_0x35ec('0x6')](_0x4c712b,_0x3d7560);_0x43189c(null);};}for(var e in events){if(events[_0x35ec('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x35ec('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xa6d1=['remove','emit','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa6d1,0xcc));var _0x1a6d=function(_0x49710d,_0x561fb5){_0x49710d=_0x49710d-0x0;var _0x464572=_0xa6d1[_0x49710d];return _0x464572;};'use strict';var EventEmitter=require(_0x1a6d('0x0'));var DashboardItem=require(_0x1a6d('0x1'))['db'][_0x1a6d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1a6d('0x3')](0x0);var events={'afterCreate':_0x1a6d('0x4'),'afterUpdate':_0x1a6d('0x5'),'afterDestroy':_0x1a6d('0x6')};function emitEvent(_0x5433bc){return function(_0x229691,_0xc192d0,_0x12a489){DashboardItemEvents['emit'](_0x5433bc+':'+_0x229691['id'],_0x229691);DashboardItemEvents[_0x1a6d('0x7')](_0x5433bc,_0x229691);_0x12a489(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x1a6d('0x8')](e,emitEvent(event));}}module[_0x1a6d('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 71b2e4a..dc2899c 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 _0xc406=['moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc406,0x135));var _0x6c40=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc406[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6c40('0x0'));var util=require('util');var logger=require(_0x6c40('0x1'))(_0x6c40('0x2'));var moment=require(_0x6c40('0x3'));var BPromise=require(_0x6c40('0x4'));var rp=require(_0x6c40('0x5'));var fs=require('fs');var path=require(_0x6c40('0x6'));var rimraf=require(_0x6c40('0x7'));var config=require('../../config/environment');var attributes=require(_0x6c40('0x8'));module[_0x6c40('0x9')]=function(_0x386b3b,_0x51ff14){return _0x386b3b[_0x6c40('0xa')](_0x6c40('0xb'),attributes,{'tableName':_0x6c40('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6821=['bluebird','rimraf','./dashboardItem.attributes','exports','define','dashboard_items','util','api','moment'];(function(_0x1b8a01,_0x1580a7){var _0x3c2762=function(_0x3a58fe){while(--_0x3a58fe){_0x1b8a01['push'](_0x1b8a01['shift']());}};_0x3c2762(++_0x1580a7);}(_0x6821,0x1d1));var _0x1682=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x6821[_0x38537f];return _0x141e23;};'use strict';var _=require('lodash');var util=require(_0x1682('0x0'));var logger=require('../../config/logger')(_0x1682('0x1'));var moment=require(_0x1682('0x2'));var BPromise=require(_0x1682('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1682('0x4'));var config=require('../../config/environment');var attributes=require(_0x1682('0x5'));module[_0x1682('0x6')]=function(_0x13c21c,_0x5f48a3){return _0x13c21c[_0x1682('0x7')]('DashboardItem',attributes,{'tableName':_0x1682('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 e26cbee..3872d0e 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 _0x18ea=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','info','result','message'];(function(_0x13ac69,_0x5d7dda){var _0x82d483=function(_0xac301){while(--_0xac301){_0x13ac69['push'](_0x13ac69['shift']());}};_0x82d483(++_0x5d7dda);}(_0x18ea,0x15d));var _0xa18e=function(_0x3f5e55,_0x32e285){_0x3f5e55=_0x3f5e55-0x0;var _0x1ae471=_0x18ea[_0x3f5e55];return _0x1ae471;};'use strict';var _=require(_0xa18e('0x0'));var util=require(_0xa18e('0x1'));var moment=require(_0xa18e('0x2'));var BPromise=require(_0xa18e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa18e('0x4'));var db=require(_0xa18e('0x5'))['db'];var utils=require(_0xa18e('0x6'));var logger=require(_0xa18e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa18e('0x8'));var client=jayson['client'][_0xa18e('0x9')]({'port':0x232a});config[_0xa18e('0xa')]=_[_0xa18e('0xb')](config[_0xa18e('0xa')],{'host':_0xa18e('0xc'),'port':0x18eb});var socket=require(_0xa18e('0xd'))(new Redis(config[_0xa18e('0xa')]));require(_0xa18e('0xe'))[_0xa18e('0xf')](socket);function respondWithRpcPromise(_0x54a9bb,_0x341194,_0x208898){return new BPromise(function(_0x3ce088,_0x45509d){return client[_0xa18e('0x10')](_0x54a9bb,_0x208898)[_0xa18e('0x11')](function(_0x48f870){logger['info'](_0xa18e('0x12'),_0x341194,_0xa18e('0x13'));logger[_0xa18e('0x14')](_0xa18e('0x15'),_0x341194,_0xa18e('0x13'),JSON[_0xa18e('0x16')](_0x48f870));if(_0x48f870[_0xa18e('0x17')]){if(_0x48f870['error'][_0xa18e('0x18')]===0x1f4){logger[_0xa18e('0x17')](_0xa18e('0x12'),_0x341194,_0x48f870[_0xa18e('0x17')]['message']);return _0x45509d(_0x48f870['error']['message']);}logger[_0xa18e('0x17')](_0xa18e('0x12'),_0x341194,_0x48f870[_0xa18e('0x17')]['message']);return _0x3ce088(_0x48f870[_0xa18e('0x17')]['message']);}else{logger[_0xa18e('0x19')](_0xa18e('0x12'),_0x341194,_0xa18e('0x13'));_0x3ce088(_0x48f870[_0xa18e('0x1a')][_0xa18e('0x1b')]);}})[_0xa18e('0x1c')](function(_0x510b5c){logger[_0xa18e('0x17')](_0xa18e('0x12'),_0x341194,_0x510b5c);_0x45509d(_0x510b5c);});});} \ No newline at end of file +var _0xa2a5=['http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','debug','error','code','DashboardItem,\x20%s,\x20%s','message','request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x555b1b,_0x742fe1){var _0x3f4bd4=function(_0x5c851d){while(--_0x5c851d){_0x555b1b['push'](_0x555b1b['shift']());}};_0x3f4bd4(++_0x742fe1);}(_0xa2a5,0xa7));var _0x5a2a=function(_0x2ff5ae,_0xe0d973){_0x2ff5ae=_0x2ff5ae-0x0;var _0x2b85ca=_0xa2a5[_0x2ff5ae];return _0x2b85ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a2a('0x0'));var BPromise=require(_0x5a2a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a2a('0x2'));var db=require(_0x5a2a('0x3'))['db'];var utils=require(_0x5a2a('0x4'));var logger=require('../../config/logger')(_0x5a2a('0x5'));var config=require(_0x5a2a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5a2a('0x7')][_0x5a2a('0x8')]({'port':0x232a});config[_0x5a2a('0x9')]=_[_0x5a2a('0xa')](config[_0x5a2a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5a2a('0xb'))(new Redis(config[_0x5a2a('0x9')]));require(_0x5a2a('0xc'))[_0x5a2a('0xd')](socket);function respondWithRpcPromise(_0x4933c4,_0x364108,_0x6d6083){return new BPromise(function(_0x39fd5a,_0x2174e0){return client[_0x5a2a('0xe')](_0x4933c4,_0x6d6083)[_0x5a2a('0xf')](function(_0x583a41){logger[_0x5a2a('0x10')]('DashboardItem,\x20%s,\x20%s',_0x364108,'request\x20sent');logger[_0x5a2a('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x364108,'request\x20sent',JSON['stringify'](_0x583a41));if(_0x583a41[_0x5a2a('0x12')]){if(_0x583a41[_0x5a2a('0x12')][_0x5a2a('0x13')]===0x1f4){logger[_0x5a2a('0x12')](_0x5a2a('0x14'),_0x364108,_0x583a41[_0x5a2a('0x12')][_0x5a2a('0x15')]);return _0x2174e0(_0x583a41[_0x5a2a('0x12')][_0x5a2a('0x15')]);}logger[_0x5a2a('0x12')](_0x5a2a('0x14'),_0x364108,_0x583a41[_0x5a2a('0x12')][_0x5a2a('0x15')]);return _0x39fd5a(_0x583a41[_0x5a2a('0x12')]['message']);}else{logger[_0x5a2a('0x10')](_0x5a2a('0x14'),_0x364108,_0x5a2a('0x16'));_0x39fd5a(_0x583a41[_0x5a2a('0x17')][_0x5a2a('0x15')]);}})[_0x5a2a('0x18')](function(_0x11fbd7){logger[_0x5a2a('0x12')](_0x5a2a('0x14'),_0x364108,_0x11fbd7);_0x2174e0(_0x11fbd7);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d41aa2f..5c1ff4b 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 _0xd5f9=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','length'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x9f9ed5,_0x56f438){_0x9f9ed5=_0x9f9ed5-0x0;var _0xbc71e3=_0xd5f9[_0x9f9ed5];return _0xbc71e3;};'use strict';var DashboardItemEvents=require(_0x9d5f('0x0'));var events=[_0x9d5f('0x1'),_0x9d5f('0x2'),_0x9d5f('0x3')];function createListener(_0x4ed934,_0x3f3bb1){return function(_0x3e73bf){_0x3f3bb1[_0x9d5f('0x4')](_0x4ed934,_0x3e73bf);};}function removeListener(_0x42d201,_0x216344){return function(){DashboardItemEvents[_0x9d5f('0x5')](_0x42d201,_0x216344);};}exports['register']=function(_0x546c04){for(var _0x58edae=0x0,_0x1dca4b=events[_0x9d5f('0x6')];_0x58edae<_0x1dca4b;_0x58edae++){var _0x4ac60a=events[_0x58edae];var _0x402a35=createListener(_0x9d5f('0x7')+_0x4ac60a,_0x546c04);DashboardItemEvents['on'](_0x4ac60a,_0x402a35);}}; \ No newline at end of file +var _0x287d=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove'];(function(_0x216318,_0x556322){var _0xc2ef30=function(_0x5cc563){while(--_0x5cc563){_0x216318['push'](_0x216318['shift']());}};_0xc2ef30(++_0x556322);}(_0x287d,0x1ce));var _0xd287=function(_0x565dc8,_0x4261e5){_0x565dc8=_0x565dc8-0x0;var _0x46d643=_0x287d[_0x565dc8];return _0x46d643;};'use strict';var DashboardItemEvents=require(_0xd287('0x0'));var events=['save',_0xd287('0x1'),_0xd287('0x2')];function createListener(_0x6c17ec,_0x4dd326){return function(_0x15df64){_0x4dd326[_0xd287('0x3')](_0x6c17ec,_0x15df64);};}function removeListener(_0x1648a2,_0x1afb93){return function(){DashboardItemEvents[_0xd287('0x4')](_0x1648a2,_0x1afb93);};}exports[_0xd287('0x5')]=function(_0x4acee8){for(var _0x18ab61=0x0,_0x4983ce=events[_0xd287('0x6')];_0x18ab61<_0x4983ce;_0x18ab61++){var _0x2f7356=events[_0x18ab61];var _0x1638e2=createListener(_0xd287('0x7')+_0x2f7356,_0x4acee8);DashboardItemEvents['on'](_0x2f7356,_0x1638e2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 95c9c67..90d6cbe 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 _0x05cd=['path','connect-timeout','Router','fs-extra','get','/:id','isAuthenticated','show','post','put','update','destroy','exports'];(function(_0x25251f,_0x3daefd){var _0x407213=function(_0x19a5ed){while(--_0x19a5ed){_0x25251f['push'](_0x25251f['shift']());}};_0x407213(++_0x3daefd);}(_0x05cd,0x145));var _0xd05c=function(_0x24a56a,_0x550eb7){_0x24a56a=_0x24a56a-0x0;var _0x4175c0=_0x05cd[_0x24a56a];return _0x4175c0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd05c('0x0'));var timeout=require(_0xd05c('0x1'));var express=require('express');var router=express[_0xd05c('0x2')]();var fs_extra=require(_0xd05c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xd05c('0x4')](_0xd05c('0x5'),auth[_0xd05c('0x6')](),controller[_0xd05c('0x7')]);router[_0xd05c('0x8')]('/',auth[_0xd05c('0x6')](),controller['create']);router[_0xd05c('0x9')]('/:id',auth[_0xd05c('0x6')](),controller[_0xd05c('0xa')]);router['delete'](_0xd05c('0x5'),auth['isAuthenticated'](),controller[_0xd05c('0xb')]);module[_0xd05c('0xc')]=router; \ No newline at end of file +var _0xafda=['../../config/environment','/:id','isAuthenticated','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x125250,_0x4802a4){var _0x17f377=function(_0x9046c7){while(--_0x9046c7){_0x125250['push'](_0x125250['shift']());}};_0x17f377(++_0x4802a4);}(_0xafda,0xe8));var _0xaafd=function(_0x1c0f3d,_0x55a9e2){_0x1c0f3d=_0x1c0f3d-0x0;var _0x4d71a8=_0xafda[_0x1c0f3d];return _0x4d71a8;};'use strict';var multer=require(_0xaafd('0x0'));var util=require(_0xaafd('0x1'));var path=require(_0xaafd('0x2'));var timeout=require(_0xaafd('0x3'));var express=require(_0xaafd('0x4'));var router=express[_0xaafd('0x5')]();var fs_extra=require(_0xaafd('0x6'));var auth=require(_0xaafd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xaafd('0x8'));var controller=require('./dashboardItem.controller');router['get'](_0xaafd('0x9'),auth[_0xaafd('0xa')](),controller['show']);router[_0xaafd('0xb')]('/',auth['isAuthenticated'](),controller[_0xaafd('0xc')]);router[_0xaafd('0xd')](_0xaafd('0x9'),auth['isAuthenticated'](),controller[_0xaafd('0xe')]);router['delete'](_0xaafd('0x9'),auth['isAuthenticated'](),controller[_0xaafd('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f33d547..f5c724c 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 _0x4366=['exports','STRING','ENUM','first','second','sequelize'];(function(_0x90659e,_0x25f1c3){var _0x5c1d0a=function(_0x86f5dd){while(--_0x86f5dd){_0x90659e['push'](_0x90659e['shift']());}};_0x5c1d0a(++_0x25f1c3);}(_0x4366,0xd7));var _0x6436=function(_0x2ad955,_0xeae897){_0x2ad955=_0x2ad955-0x0;var _0x21a6db=_0x4366[_0x2ad955];return _0x21a6db;};'use strict';var Sequelize=require(_0x6436('0x0'));module[_0x6436('0x1')]={'name':{'type':Sequelize[_0x6436('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x6436('0x3')](_0x6436('0x4'),_0x6436('0x5'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x6436('0x2')]}}; \ No newline at end of file +var _0xfada=['STRING','sequelize','exports','first','second','third'];(function(_0x149d08,_0x3ced48){var _0x2adf45=function(_0x429602){while(--_0x429602){_0x149d08['push'](_0x149d08['shift']());}};_0x2adf45(++_0x3ced48);}(_0xfada,0x139));var _0xafad=function(_0x558c96,_0x2eb045){_0x558c96=_0x558c96-0x0;var _0xbfb507=_0xfada[_0x558c96];return _0xbfb507;};'use strict';var Sequelize=require(_0xafad('0x0'));module[_0xafad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xafad('0x2'),_0xafad('0x3'),_0xafad('0x4')),'allowNull':![],'defaultValue':_0xafad('0x2')},'description':{'type':Sequelize[_0xafad('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d02815f..59251ba 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 _0xf6c1=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0xf6c1,0x99));var _0x1f6c=function(_0x3815cf,_0x267f39){_0x3815cf=_0x3815cf-0x0;var _0x13e7ac=_0xf6c1[_0x3815cf];return _0x13e7ac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f6c('0x0'));var jsonpatch=require(_0x1f6c('0x1'));var rp=require(_0x1f6c('0x2'));var moment=require('moment');var BPromise=require(_0x1f6c('0x3'));var Mustache=require('mustache');var util=require(_0x1f6c('0x4'));var path=require(_0x1f6c('0x5'));var sox=require(_0x1f6c('0x6'));var csv=require(_0x1f6c('0x7'));var ejs=require(_0x1f6c('0x8'));var fs=require('fs');var fs_extra=require(_0x1f6c('0x9'));var _=require('lodash');var squel=require(_0x1f6c('0xa'));var crypto=require(_0x1f6c('0xb'));var jsforce=require(_0x1f6c('0xc'));var deskjs=require(_0x1f6c('0xd'));var toCsv=require(_0x1f6c('0x7'));var querystring=require(_0x1f6c('0xe'));var Papa=require(_0x1f6c('0xf'));var Redis=require(_0x1f6c('0x10'));var authService=require(_0x1f6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f6c('0x12'))(_0x1f6c('0x13'));var utils=require(_0x1f6c('0x14'));var config=require(_0x1f6c('0x15'));var licenseUtil=require(_0x1f6c('0x16'));var db=require(_0x1f6c('0x17'))['db'];function respondWithStatusCode(_0x507a06,_0x7963a9){_0x7963a9=_0x7963a9||0xcc;return function(_0x1e7060){if(_0x1e7060){return _0x507a06[_0x1f6c('0x18')](_0x7963a9);}return _0x507a06[_0x1f6c('0x19')](_0x7963a9)[_0x1f6c('0x1a')]();};}function respondWithResult(_0x1315b7,_0x31fc67){_0x31fc67=_0x31fc67||0xc8;return function(_0x147c01){if(_0x147c01){return _0x1315b7['status'](_0x31fc67)[_0x1f6c('0x1b')](_0x147c01);}};}function respondWithFilteredResult(_0x302026,_0x26652b){return function(_0x43ce04){if(_0x43ce04){var _0xc8b6f2=typeof _0x26652b[_0x1f6c('0x1c')]==='undefined'&&typeof _0x26652b['limit']===_0x1f6c('0x1d');var _0x30a8dc=_0x43ce04['count'];var _0x2328f2=_0xc8b6f2?0x0:_0x26652b['offset'];var _0x31c887=_0xc8b6f2?_0x43ce04[_0x1f6c('0x1e')]:_0x26652b[_0x1f6c('0x1c')]+_0x26652b[_0x1f6c('0x1f')];var _0xd71b77;if(_0x31c887>=_0x30a8dc){_0x31c887=_0x30a8dc;_0xd71b77=0xc8;}else{_0xd71b77=0xce;}_0x302026[_0x1f6c('0x19')](_0xd71b77);return _0x302026[_0x1f6c('0x20')](_0x1f6c('0x21'),_0x2328f2+'-'+_0x31c887+'/'+_0x30a8dc)[_0x1f6c('0x1b')](_0x43ce04);}return null;};}function patchUpdates(_0x459944){return function(_0x44b1c5){try{jsonpatch[_0x1f6c('0x22')](_0x44b1c5,_0x459944,!![]);}catch(_0x196356){return BPromise[_0x1f6c('0x23')](_0x196356);}return _0x44b1c5[_0x1f6c('0x24')]();};}function saveUpdates(_0x55881f,_0x2644e9){return function(_0x511191){if(_0x511191){return _0x511191[_0x1f6c('0x25')](_0x55881f)[_0x1f6c('0x26')](function(_0x536eb6){return _0x536eb6;});}return null;};}function removeEntity(_0x1aa1f6,_0x4ef92a){return function(_0x32a812){if(_0x32a812){return _0x32a812[_0x1f6c('0x27')]()[_0x1f6c('0x26')](function(){var _0x185eb0=_0x32a812[_0x1f6c('0x28')]({'plain':!![]});var _0x386016=_0x1f6c('0x29');return db[_0x1f6c('0x2a')][_0x1f6c('0x27')]({'where':{'type':_0x386016,'resourceId':_0x185eb0['id']}})[_0x1f6c('0x26')](function(){return _0x32a812;});})['then'](function(){_0x1aa1f6[_0x1f6c('0x19')](0xcc)[_0x1f6c('0x1a')]();});}};}function handleEntityNotFound(_0x2b59b8,_0x5389e5){return function(_0x3374dc){if(!_0x3374dc){_0x2b59b8[_0x1f6c('0x18')](0x194);}return _0x3374dc;};}function handleError(_0x2ce9df,_0x30fdea){_0x30fdea=_0x30fdea||0x1f4;return function(_0xeaeccd){logger[_0x1f6c('0x2b')](_0xeaeccd['stack']);if(_0xeaeccd[_0x1f6c('0x2c')]){delete _0xeaeccd['name'];}_0x2ce9df[_0x1f6c('0x19')](_0x30fdea)[_0x1f6c('0x2d')](_0xeaeccd);};}exports[_0x1f6c('0x2e')]=function(_0x463543,_0xe574ac){var _0x497d8c={},_0x7a927a={},_0x47db8b={'count':0x0,'rows':[]};var _0x4ed20c=_[_0x1f6c('0x2f')](db[_0x1f6c('0x30')][_0x1f6c('0x31')],function(_0x29ad8d){return{'name':_0x29ad8d['fieldName'],'type':_0x29ad8d[_0x1f6c('0x32')][_0x1f6c('0x33')]};});_0x7a927a[_0x1f6c('0x34')]=_[_0x1f6c('0x2f')](_0x4ed20c,_0x1f6c('0x2c'));_0x7a927a['query']=_['keys'](_0x463543[_0x1f6c('0x35')]);_0x7a927a[_0x1f6c('0x36')]=_[_0x1f6c('0x37')](_0x7a927a[_0x1f6c('0x34')],_0x7a927a['query']);_0x497d8c[_0x1f6c('0x38')]=_['intersection'](_0x7a927a['model'],qs[_0x1f6c('0x39')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x39')]));_0x497d8c[_0x1f6c('0x38')]=_0x497d8c[_0x1f6c('0x38')][_0x1f6c('0x3a')]?_0x497d8c[_0x1f6c('0x38')]:_0x7a927a[_0x1f6c('0x34')];if(!_0x463543[_0x1f6c('0x35')][_0x1f6c('0x3b')](_0x1f6c('0x3c'))){_0x497d8c[_0x1f6c('0x1f')]=qs[_0x1f6c('0x1f')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x1f')]);_0x497d8c[_0x1f6c('0x1c')]=qs[_0x1f6c('0x1c')](_0x463543['query'][_0x1f6c('0x1c')]);}_0x497d8c[_0x1f6c('0x3d')]=qs[_0x1f6c('0x3e')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x3e')]);_0x497d8c['where']=qs['filters'](_[_0x1f6c('0x3f')](_0x463543[_0x1f6c('0x35')],_0x7a927a[_0x1f6c('0x36')]),_0x4ed20c);if(_0x463543[_0x1f6c('0x35')][_0x1f6c('0x40')]){_0x497d8c[_0x1f6c('0x41')]=_['merge'](_0x497d8c[_0x1f6c('0x41')],{'$or':_[_0x1f6c('0x2f')](_0x4ed20c,function(_0x23f4bd){if(_0x23f4bd[_0x1f6c('0x32')]!==_0x1f6c('0x42')){var _0x74d4a6={};_0x74d4a6[_0x23f4bd[_0x1f6c('0x2c')]]={'$like':'%'+_0x463543[_0x1f6c('0x35')]['filter']+'%'};return _0x74d4a6;}})});}_0x497d8c=_['merge']({},_0x497d8c,_0x463543[_0x1f6c('0x43')]);var _0x48c2a1={'where':_0x497d8c['where']};return db[_0x1f6c('0x30')][_0x1f6c('0x1e')](_0x48c2a1)[_0x1f6c('0x26')](function(_0x1a2fff){_0x47db8b[_0x1f6c('0x1e')]=_0x1a2fff;if(_0x463543[_0x1f6c('0x35')][_0x1f6c('0x44')]){_0x497d8c[_0x1f6c('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x1f6c('0x46')](_0x497d8c);})['then'](function(_0x4b92ac){_0x47db8b[_0x1f6c('0x47')]=_0x4b92ac;return _0x47db8b;})[_0x1f6c('0x26')](respondWithFilteredResult(_0xe574ac,_0x497d8c))[_0x1f6c('0x48')](handleError(_0xe574ac,null));};exports['show']=function(_0x13034d,_0x4e2cdb){var _0x42ae1d={'raw':!![],'where':{'id':_0x13034d['params']['id']}},_0x2c7f71={};_0x2c7f71[_0x1f6c('0x34')]=_['keys'](db[_0x1f6c('0x30')][_0x1f6c('0x31')]);_0x2c7f71['query']=_[_0x1f6c('0x49')](_0x13034d['query']);_0x2c7f71['filters']=_[_0x1f6c('0x37')](_0x2c7f71['model'],_0x2c7f71[_0x1f6c('0x35')]);_0x42ae1d['attributes']=_[_0x1f6c('0x37')](_0x2c7f71[_0x1f6c('0x34')],qs[_0x1f6c('0x39')](_0x13034d['query'][_0x1f6c('0x39')]));_0x42ae1d[_0x1f6c('0x38')]=_0x42ae1d[_0x1f6c('0x38')]['length']?_0x42ae1d['attributes']:_0x2c7f71['model'];if(_0x13034d['query'][_0x1f6c('0x44')]){_0x42ae1d[_0x1f6c('0x45')]=[{'all':!![]}];}_0x42ae1d=_['merge']({},_0x42ae1d,_0x13034d['options']);return db[_0x1f6c('0x30')][_0x1f6c('0x4a')](_0x42ae1d)[_0x1f6c('0x26')](handleEntityNotFound(_0x4e2cdb,null))[_0x1f6c('0x26')](respondWithResult(_0x4e2cdb,null))[_0x1f6c('0x48')](handleError(_0x4e2cdb,null));};exports[_0x1f6c('0x4b')]=function(_0x508fdb,_0x303c50){return db[_0x1f6c('0x30')]['create'](_0x508fdb[_0x1f6c('0x4c')],{})[_0x1f6c('0x26')](function(_0x4bd86d){var _0x28a02a=_0x508fdb['user'][_0x1f6c('0x28')]({'plain':!![]});if(!_0x28a02a)throw new Error(_0x1f6c('0x4d'));if(_0x28a02a[_0x1f6c('0x4e')]==='user'){var _0xd4d0b1=_0x4bd86d[_0x1f6c('0x28')]({'plain':!![]});var _0x4b4621=_0x1f6c('0x29');return db['UserProfileSection'][_0x1f6c('0x4a')]({'where':{'name':_0x4b4621,'userProfileId':_0x28a02a[_0x1f6c('0x4f')]},'raw':!![]})[_0x1f6c('0x26')](function(_0x48f713){if(_0x48f713&&_0x48f713[_0x1f6c('0x50')]===0x0){return db[_0x1f6c('0x2a')]['create']({'name':_0xd4d0b1[_0x1f6c('0x2c')],'resourceId':_0xd4d0b1['id'],'type':_0x48f713['name'],'sectionId':_0x48f713['id']},{})[_0x1f6c('0x26')](function(){return _0x4bd86d;});}else{return _0x4bd86d;}})[_0x1f6c('0x48')](function(_0xd4d119){logger[_0x1f6c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd4d119);throw _0xd4d119;});}return _0x4bd86d;})['then'](respondWithResult(_0x303c50,0xc9))['catch'](handleError(_0x303c50,null));};exports[_0x1f6c('0x25')]=function(_0x426761,_0x335974){if(_0x426761[_0x1f6c('0x4c')]['id']){delete _0x426761[_0x1f6c('0x4c')]['id'];}return db[_0x1f6c('0x30')][_0x1f6c('0x4a')]({'where':{'id':_0x426761[_0x1f6c('0x51')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x335974,null))[_0x1f6c('0x26')](saveUpdates(_0x426761[_0x1f6c('0x4c')],null))[_0x1f6c('0x26')](respondWithResult(_0x335974,null))[_0x1f6c('0x48')](handleError(_0x335974,null));};exports[_0x1f6c('0x27')]=function(_0xc76c51,_0x38a288){return db[_0x1f6c('0x30')][_0x1f6c('0x4a')]({'where':{'id':_0xc76c51[_0x1f6c('0x51')]['id']}})['then'](handleEntityNotFound(_0x38a288,null))[_0x1f6c('0x26')](removeEntity(_0x38a288,null))['catch'](handleError(_0x38a288,null));}; \ No newline at end of file +var _0x5fd1=['where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','create','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','set','Content-Range','apply','update','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','filter'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x5fd1,0x155));var _0x15fd=function(_0x4614e2,_0x1abf74){_0x4614e2=_0x4614e2-0x0;var _0x34ac4d=_0x5fd1[_0x4614e2];return _0x34ac4d;};'use strict';var emlformat=require(_0x15fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15fd('0x1'));var jsonpatch=require(_0x15fd('0x2'));var rp=require(_0x15fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15fd('0x4'));var util=require(_0x15fd('0x5'));var path=require(_0x15fd('0x6'));var sox=require('sox');var csv=require(_0x15fd('0x7'));var ejs=require(_0x15fd('0x8'));var fs=require('fs');var fs_extra=require(_0x15fd('0x9'));var _=require(_0x15fd('0xa'));var squel=require(_0x15fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x15fd('0xc'));var deskjs=require(_0x15fd('0xd'));var toCsv=require(_0x15fd('0x7'));var querystring=require('querystring');var Papa=require(_0x15fd('0xe'));var Redis=require('ioredis');var authService=require(_0x15fd('0xf'));var qs=require(_0x15fd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15fd('0x11'));var utils=require(_0x15fd('0x12'));var config=require(_0x15fd('0x13'));var licenseUtil=require(_0x15fd('0x14'));var db=require(_0x15fd('0x15'))['db'];function respondWithStatusCode(_0x2e18ec,_0x346ab1){_0x346ab1=_0x346ab1||0xcc;return function(_0x2660db){if(_0x2660db){return _0x2e18ec[_0x15fd('0x16')](_0x346ab1);}return _0x2e18ec['status'](_0x346ab1)['end']();};}function respondWithResult(_0x5784a3,_0x3fda60){_0x3fda60=_0x3fda60||0xc8;return function(_0x135a15){if(_0x135a15){return _0x5784a3[_0x15fd('0x17')](_0x3fda60)[_0x15fd('0x18')](_0x135a15);}};}function respondWithFilteredResult(_0x44eae6,_0x2ffa03){return function(_0x2c5375){if(_0x2c5375){var _0x44a63a=typeof _0x2ffa03['offset']==='undefined'&&typeof _0x2ffa03[_0x15fd('0x19')]==='undefined';var _0x7afe9c=_0x2c5375['count'];var _0x917fe4=_0x44a63a?0x0:_0x2ffa03[_0x15fd('0x1a')];var _0x855bae=_0x44a63a?_0x2c5375['count']:_0x2ffa03[_0x15fd('0x1a')]+_0x2ffa03[_0x15fd('0x19')];var _0x8b7b9e;if(_0x855bae>=_0x7afe9c){_0x855bae=_0x7afe9c;_0x8b7b9e=0xc8;}else{_0x8b7b9e=0xce;}_0x44eae6[_0x15fd('0x17')](_0x8b7b9e);return _0x44eae6[_0x15fd('0x1b')](_0x15fd('0x1c'),_0x917fe4+'-'+_0x855bae+'/'+_0x7afe9c)[_0x15fd('0x18')](_0x2c5375);}return null;};}function patchUpdates(_0x2f46f1){return function(_0x1b8b9f){try{jsonpatch[_0x15fd('0x1d')](_0x1b8b9f,_0x2f46f1,!![]);}catch(_0x3ff307){return BPromise['reject'](_0x3ff307);}return _0x1b8b9f['save']();};}function saveUpdates(_0x293d7b,_0x36b21e){return function(_0x252a1c){if(_0x252a1c){return _0x252a1c[_0x15fd('0x1e')](_0x293d7b)[_0x15fd('0x1f')](function(_0x11496a){return _0x11496a;});}return null;};}function removeEntity(_0x2073da,_0x50d493){return function(_0x40d43){if(_0x40d43){return _0x40d43[_0x15fd('0x20')]()[_0x15fd('0x1f')](function(){var _0x5c7aa9=_0x40d43[_0x15fd('0x21')]({'plain':!![]});var _0x49062f=_0x15fd('0x22');return db[_0x15fd('0x23')][_0x15fd('0x20')]({'where':{'type':_0x49062f,'resourceId':_0x5c7aa9['id']}})['then'](function(){return _0x40d43;});})[_0x15fd('0x1f')](function(){_0x2073da[_0x15fd('0x17')](0xcc)[_0x15fd('0x24')]();});}};}function handleEntityNotFound(_0x5d4789,_0x44e8c8){return function(_0x544685){if(!_0x544685){_0x5d4789[_0x15fd('0x16')](0x194);}return _0x544685;};}function handleError(_0x7e70d6,_0x2e9886){_0x2e9886=_0x2e9886||0x1f4;return function(_0x27d2c4){logger[_0x15fd('0x25')](_0x27d2c4[_0x15fd('0x26')]);if(_0x27d2c4[_0x15fd('0x27')]){delete _0x27d2c4[_0x15fd('0x27')];}_0x7e70d6[_0x15fd('0x17')](_0x2e9886)[_0x15fd('0x28')](_0x27d2c4);};}exports[_0x15fd('0x29')]=function(_0x5ca676,_0x47c22c){var _0x2fe61e={},_0x50381a={},_0x39e744={'count':0x0,'rows':[]};var _0xf6ddbe=_['map'](db[_0x15fd('0x2a')][_0x15fd('0x2b')],function(_0x5dc5fe){return{'name':_0x5dc5fe[_0x15fd('0x2c')],'type':_0x5dc5fe[_0x15fd('0x2d')][_0x15fd('0x2e')]};});_0x50381a[_0x15fd('0x2f')]=_[_0x15fd('0x30')](_0xf6ddbe,_0x15fd('0x27'));_0x50381a['query']=_[_0x15fd('0x31')](_0x5ca676[_0x15fd('0x32')]);_0x50381a[_0x15fd('0x33')]=_[_0x15fd('0x34')](_0x50381a['model'],_0x50381a[_0x15fd('0x32')]);_0x2fe61e[_0x15fd('0x35')]=_[_0x15fd('0x34')](_0x50381a[_0x15fd('0x2f')],qs[_0x15fd('0x36')](_0x5ca676[_0x15fd('0x32')]['fields']));_0x2fe61e[_0x15fd('0x35')]=_0x2fe61e[_0x15fd('0x35')]['length']?_0x2fe61e[_0x15fd('0x35')]:_0x50381a[_0x15fd('0x2f')];if(!_0x5ca676[_0x15fd('0x32')]['hasOwnProperty'](_0x15fd('0x37'))){_0x2fe61e[_0x15fd('0x19')]=qs[_0x15fd('0x19')](_0x5ca676[_0x15fd('0x32')][_0x15fd('0x19')]);_0x2fe61e[_0x15fd('0x1a')]=qs['offset'](_0x5ca676['query']['offset']);}_0x2fe61e[_0x15fd('0x38')]=qs[_0x15fd('0x39')](_0x5ca676[_0x15fd('0x32')]['sort']);_0x2fe61e['where']=qs[_0x15fd('0x33')](_['pick'](_0x5ca676['query'],_0x50381a['filters']),_0xf6ddbe);if(_0x5ca676[_0x15fd('0x32')][_0x15fd('0x3a')]){_0x2fe61e[_0x15fd('0x3b')]=_['merge'](_0x2fe61e[_0x15fd('0x3b')],{'$or':_[_0x15fd('0x30')](_0xf6ddbe,function(_0xd85d3e){if(_0xd85d3e['type']!==_0x15fd('0x3c')){var _0x1c4d40={};_0x1c4d40[_0xd85d3e[_0x15fd('0x27')]]={'$like':'%'+_0x5ca676[_0x15fd('0x32')][_0x15fd('0x3a')]+'%'};return _0x1c4d40;}})});}_0x2fe61e=_[_0x15fd('0x3d')]({},_0x2fe61e,_0x5ca676[_0x15fd('0x3e')]);var _0x12a894={'where':_0x2fe61e[_0x15fd('0x3b')]};return db['Disposition'][_0x15fd('0x3f')](_0x12a894)[_0x15fd('0x1f')](function(_0x180433){_0x39e744[_0x15fd('0x3f')]=_0x180433;if(_0x5ca676[_0x15fd('0x32')][_0x15fd('0x40')]){_0x2fe61e[_0x15fd('0x41')]=[{'all':!![]}];}return db[_0x15fd('0x2a')][_0x15fd('0x42')](_0x2fe61e);})[_0x15fd('0x1f')](function(_0x2eb6b6){_0x39e744[_0x15fd('0x43')]=_0x2eb6b6;return _0x39e744;})[_0x15fd('0x1f')](respondWithFilteredResult(_0x47c22c,_0x2fe61e))[_0x15fd('0x44')](handleError(_0x47c22c,null));};exports[_0x15fd('0x45')]=function(_0x497e21,_0x330bca){var _0x39fbd4={'raw':!![],'where':{'id':_0x497e21[_0x15fd('0x46')]['id']}},_0x26a86a={};_0x26a86a[_0x15fd('0x2f')]=_[_0x15fd('0x31')](db[_0x15fd('0x2a')][_0x15fd('0x2b')]);_0x26a86a['query']=_['keys'](_0x497e21[_0x15fd('0x32')]);_0x26a86a['filters']=_[_0x15fd('0x34')](_0x26a86a[_0x15fd('0x2f')],_0x26a86a['query']);_0x39fbd4[_0x15fd('0x35')]=_[_0x15fd('0x34')](_0x26a86a[_0x15fd('0x2f')],qs[_0x15fd('0x36')](_0x497e21[_0x15fd('0x32')][_0x15fd('0x36')]));_0x39fbd4['attributes']=_0x39fbd4[_0x15fd('0x35')][_0x15fd('0x47')]?_0x39fbd4[_0x15fd('0x35')]:_0x26a86a[_0x15fd('0x2f')];if(_0x497e21[_0x15fd('0x32')][_0x15fd('0x40')]){_0x39fbd4[_0x15fd('0x41')]=[{'all':!![]}];}_0x39fbd4=_[_0x15fd('0x3d')]({},_0x39fbd4,_0x497e21[_0x15fd('0x3e')]);return db[_0x15fd('0x2a')][_0x15fd('0x48')](_0x39fbd4)[_0x15fd('0x1f')](handleEntityNotFound(_0x330bca,null))['then'](respondWithResult(_0x330bca,null))[_0x15fd('0x44')](handleError(_0x330bca,null));};exports['create']=function(_0x284f51,_0x34c250){return db[_0x15fd('0x2a')]['create'](_0x284f51[_0x15fd('0x49')],{})[_0x15fd('0x1f')](function(_0x1db639){var _0x155102=_0x284f51['user'][_0x15fd('0x21')]({'plain':!![]});if(!_0x155102)throw new Error(_0x15fd('0x4a'));if(_0x155102[_0x15fd('0x4b')]===_0x15fd('0x4c')){var _0x4b6827=_0x1db639[_0x15fd('0x21')]({'plain':!![]});var _0x322623='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x322623,'userProfileId':_0x155102[_0x15fd('0x4d')]},'raw':!![]})[_0x15fd('0x1f')](function(_0x366c49){if(_0x366c49&&_0x366c49[_0x15fd('0x4e')]===0x0){return db[_0x15fd('0x23')][_0x15fd('0x4f')]({'name':_0x4b6827['name'],'resourceId':_0x4b6827['id'],'type':_0x366c49[_0x15fd('0x27')],'sectionId':_0x366c49['id']},{})[_0x15fd('0x1f')](function(){return _0x1db639;});}else{return _0x1db639;}})[_0x15fd('0x44')](function(_0x516b25){logger[_0x15fd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x516b25);throw _0x516b25;});}return _0x1db639;})[_0x15fd('0x1f')](respondWithResult(_0x34c250,0xc9))[_0x15fd('0x44')](handleError(_0x34c250,null));};exports[_0x15fd('0x1e')]=function(_0x42d4de,_0x332df7){if(_0x42d4de[_0x15fd('0x49')]['id']){delete _0x42d4de[_0x15fd('0x49')]['id'];}return db[_0x15fd('0x2a')][_0x15fd('0x48')]({'where':{'id':_0x42d4de[_0x15fd('0x46')]['id']}})[_0x15fd('0x1f')](handleEntityNotFound(_0x332df7,null))[_0x15fd('0x1f')](saveUpdates(_0x42d4de[_0x15fd('0x49')],null))['then'](respondWithResult(_0x332df7,null))[_0x15fd('0x44')](handleError(_0x332df7,null));};exports['destroy']=function(_0x341c3e,_0x509aef){return db[_0x15fd('0x2a')][_0x15fd('0x48')]({'where':{'id':_0x341c3e[_0x15fd('0x46')]['id']}})['then'](handleEntityNotFound(_0x509aef,null))['then'](removeEntity(_0x509aef,null))[_0x15fd('0x44')](handleError(_0x509aef,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ca44913..bb63253 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 _0xef8b=['Disposition','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define'];(function(_0x3e05d6,_0x4a1c4d){var _0x18c9c3=function(_0x2d99b3){while(--_0x2d99b3){_0x3e05d6['push'](_0x3e05d6['shift']());}};_0x18c9c3(++_0x4a1c4d);}(_0xef8b,0x192));var _0xbef8=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xef8b[_0x49d19d];return _0x4ebef1;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require(_0xbef8('0x6'));var rimraf=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var attributes=require(_0xbef8('0x9'));module[_0xbef8('0xa')]=function(_0x550cb1,_0x1dd4a3){return _0x550cb1[_0xbef8('0xb')](_0xbef8('0xc'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xbef8('0xd'),'fields':[_0xbef8('0xe'),'ListId']},{'unique':!![],'name':'name_chat','fields':['name',_0xbef8('0xf')]},{'unique':!![],'name':_0xbef8('0x10'),'fields':[_0xbef8('0xe'),_0xbef8('0x11')]},{'unique':!![],'name':_0xbef8('0x12'),'fields':[_0xbef8('0xe'),_0xbef8('0x13')]},{'unique':!![],'name':_0xbef8('0x14'),'fields':[_0xbef8('0xe'),'FaxAccountId']},{'unique':!![],'name':_0xbef8('0x15'),'fields':[_0xbef8('0xe'),_0xbef8('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['exports','Disposition','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','path','rimraf','./disposition.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3b75c6,_0x1d14b1){_0x3b75c6=_0x3b75c6-0x0;var _0x2ba186=_0xd8fb[_0x3b75c6];return _0x2ba186;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0xa'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xbd8f('0xa'),_0xbd8f('0xb')]},{'unique':!![],'name':_0xbd8f('0xc'),'fields':['name',_0xbd8f('0xd')]},{'unique':!![],'name':_0xbd8f('0xe'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xbd8f('0xf'),'fields':[_0xbd8f('0xa'),_0xbd8f('0x10')]},{'unique':!![],'name':'name_openchannel','fields':[_0xbd8f('0xa'),_0xbd8f('0x11')]},{'unique':!![],'name':_0xbd8f('0x12'),'fields':[_0xbd8f('0xa'),_0xbd8f('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7a2e017..5d98f8b 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 _0xbf80=['jayson/promise','client','http','request','Disposition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2e5a8c,_0x35f4bf){var _0x5816ec=function(_0x27cf55){while(--_0x27cf55){_0x2e5a8c['push'](_0x2e5a8c['shift']());}};_0x5816ec(++_0x35f4bf);}(_0xbf80,0x13d));var _0x0bf8=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xbf80[_0x254d9f];return _0x1eedb9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0bf8('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bf8('0x1'));var db=require(_0x0bf8('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bf8('0x3'))(_0x0bf8('0x4'));var config=require(_0x0bf8('0x5'));var jayson=require(_0x0bf8('0x6'));var client=jayson[_0x0bf8('0x7')][_0x0bf8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14f7c4,_0x4261e8,_0x2b1a70){return new BPromise(function(_0x5a54dc,_0xbce7ce){return client[_0x0bf8('0x9')](_0x14f7c4,_0x2b1a70)['then'](function(_0x2a1a15){logger['info'](_0x0bf8('0xa'),_0x4261e8,'request\x20sent');logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x4261e8,_0x0bf8('0xb'),JSON[_0x0bf8('0xc')](_0x2a1a15));if(_0x2a1a15['error']){if(_0x2a1a15[_0x0bf8('0xd')][_0x0bf8('0xe')]===0x1f4){logger[_0x0bf8('0xd')]('Disposition,\x20%s,\x20%s',_0x4261e8,_0x2a1a15['error'][_0x0bf8('0xf')]);return _0xbce7ce(_0x2a1a15[_0x0bf8('0xd')][_0x0bf8('0xf')]);}logger[_0x0bf8('0xd')]('Disposition,\x20%s,\x20%s',_0x4261e8,_0x2a1a15[_0x0bf8('0xd')][_0x0bf8('0xf')]);return _0x5a54dc(_0x2a1a15[_0x0bf8('0xd')][_0x0bf8('0xf')]);}else{logger['info'](_0x0bf8('0xa'),_0x4261e8,_0x0bf8('0xb'));_0x5a54dc(_0x2a1a15[_0x0bf8('0x10')][_0x0bf8('0xf')]);}})['catch'](function(_0x418106){logger['error'](_0x0bf8('0xa'),_0x4261e8,_0x418106);_0xbce7ce(_0x418106);});});} \ No newline at end of file +var _0xeb98=['client','http','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeb98,0xe0));var _0x8eb9=function(_0x13ca63,_0x31882a){_0x13ca63=_0x13ca63-0x0;var _0xbf36a9=_0xeb98[_0x13ca63];return _0xbf36a9;};'use strict';var _=require('lodash');var util=require(_0x8eb9('0x0'));var moment=require(_0x8eb9('0x1'));var BPromise=require(_0x8eb9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8eb9('0x3'));var logger=require(_0x8eb9('0x4'))(_0x8eb9('0x5'));var config=require(_0x8eb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8eb9('0x7')][_0x8eb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3957cf,_0x5b3b93,_0xe524d7){return new BPromise(function(_0x44d3fa,_0x3859c0){return client[_0x8eb9('0x9')](_0x3957cf,_0xe524d7)[_0x8eb9('0xa')](function(_0x45b5b8){logger[_0x8eb9('0xb')](_0x8eb9('0xc'),_0x5b3b93,'request\x20sent');logger[_0x8eb9('0xd')](_0x8eb9('0xe'),_0x5b3b93,_0x8eb9('0xf'),JSON['stringify'](_0x45b5b8));if(_0x45b5b8[_0x8eb9('0x10')]){if(_0x45b5b8[_0x8eb9('0x10')][_0x8eb9('0x11')]===0x1f4){logger[_0x8eb9('0x10')](_0x8eb9('0xc'),_0x5b3b93,_0x45b5b8['error'][_0x8eb9('0x12')]);return _0x3859c0(_0x45b5b8[_0x8eb9('0x10')]['message']);}logger[_0x8eb9('0x10')](_0x8eb9('0xc'),_0x5b3b93,_0x45b5b8[_0x8eb9('0x10')][_0x8eb9('0x12')]);return _0x44d3fa(_0x45b5b8[_0x8eb9('0x10')][_0x8eb9('0x12')]);}else{logger[_0x8eb9('0xb')]('Disposition,\x20%s,\x20%s',_0x5b3b93,_0x8eb9('0xf'));_0x44d3fa(_0x45b5b8[_0x8eb9('0x13')]['message']);}})[_0x8eb9('0x14')](function(_0x242930){logger[_0x8eb9('0x10')]('Disposition,\x20%s,\x20%s',_0x5b3b93,_0x242930);_0x3859c0(_0x242930);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index da33ec8..1b63037 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 _0x917d=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./disposition.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy'];(function(_0x1dad80,_0x8c40e1){var _0x26fc90=function(_0x388fc6){while(--_0x388fc6){_0x1dad80['push'](_0x1dad80['shift']());}};_0x26fc90(++_0x8c40e1);}(_0x917d,0x1d5));var _0xd917=function(_0x2ff359,_0x173237){_0x2ff359=_0x2ff359-0x0;var _0x15df72=_0x917d[_0x2ff359];return _0x15df72;};'use strict';var multer=require(_0xd917('0x0'));var util=require(_0xd917('0x1'));var path=require('path');var timeout=require(_0xd917('0x2'));var express=require(_0xd917('0x3'));var router=express[_0xd917('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd917('0x5'));var config=require('../../config/environment');var controller=require(_0xd917('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd917('0x7')]);router[_0xd917('0x8')](_0xd917('0x9'),auth[_0xd917('0xa')](),controller[_0xd917('0xb')]);router[_0xd917('0xc')]('/',auth[_0xd917('0xa')](),controller[_0xd917('0xd')]);router[_0xd917('0xe')](_0xd917('0x9'),auth['isAuthenticated'](),controller[_0xd917('0xf')]);router['delete'](_0xd917('0x9'),auth[_0xd917('0xa')](),controller[_0xd917('0x10')]);module[_0xd917('0x11')]=router; \ No newline at end of file +var _0x162d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','update','destroy','multer','util','connect-timeout','express'];(function(_0x45c44b,_0x288803){var _0x1fa4d8=function(_0x21faf3){while(--_0x21faf3){_0x45c44b['push'](_0x45c44b['shift']());}};_0x1fa4d8(++_0x288803);}(_0x162d,0x1ac));var _0xd162=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x162d[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xd162('0x0'));var util=require(_0xd162('0x1'));var path=require('path');var timeout=require(_0xd162('0x2'));var express=require(_0xd162('0x3'));var router=express[_0xd162('0x4')]();var fs_extra=require(_0xd162('0x5'));var auth=require(_0xd162('0x6'));var interaction=require(_0xd162('0x7'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xd162('0x8')]('/',auth[_0xd162('0x9')](),controller[_0xd162('0xa')]);router[_0xd162('0x8')](_0xd162('0xb'),auth[_0xd162('0x9')](),controller[_0xd162('0xc')]);router['post']('/',auth[_0xd162('0x9')](),controller[_0xd162('0xd')]);router['put'](_0xd162('0xb'),auth[_0xd162('0x9')](),controller[_0xd162('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd162('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 2b09177..3886ac1 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 _0x050b=['2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x050b,0xb9));var _0xb050=function(_0x5925e8,_0x224c3e){_0x5925e8=_0x5925e8-0x0;var _0x459b02=_0x050b[_0x5925e8];return _0x459b02;};'use strict';var Sequelize=require(_0xb050('0x0'));module[_0xb050('0x1')]={'name':{'type':Sequelize[_0xb050('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb050('0x2')]},'ecm':{'type':Sequelize[_0xb050('0x3')](_0xb050('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xb050('0x2')],'defaultValue':_0xb050('0x5')},'localstationid':{'type':Sequelize[_0xb050('0x2')],'unique':_0xb050('0x6')},'minrate':{'type':Sequelize[_0xb050('0x3')](_0xb050('0x7'),_0xb050('0x8'),_0xb050('0x9'),_0xb050('0xa'),_0xb050('0xb'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0xb050('0x7'),_0xb050('0x8'),'7200',_0xb050('0xa'),'12000',_0xb050('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xb050('0x2')],'defaultValue':_0xb050('0xd')},'gateway':{'type':Sequelize[_0xb050('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb050('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb050('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb050('0x3')](_0xb050('0xf'),_0xb050('0x10'),'DADHI',_0xb050('0x11')),'defaultValue':_0xb050('0xf')},'key':{'type':Sequelize[_0xb050('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb050('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb050('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb050('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb050('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb050('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb050('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb050('0x13')],'defaultValue':![],'comment':_0xb050('0x14'),'set':function(_0x3546d8){if(!_0x3546d8)this[_0xb050('0x15')](_0xb050('0x16'),null);this[_0xb050('0x15')](_0xb050('0x17'),_0x3546d8);}}}; \ No newline at end of file +var _0x6ffb=['mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','9600','12000','14400','4800','7200','v17,v27,v29','SIP','IAX','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x474ee2,_0x47e60a){var _0x20d0f2=function(_0x3e2f0b){while(--_0x3e2f0b){_0x474ee2['push'](_0x474ee2['shift']());}};_0x20d0f2(++_0x47e60a);}(_0x6ffb,0x75));var _0xb6ff=function(_0x51d43c,_0x8cff73){_0x51d43c=_0x51d43c-0x0;var _0x180db5=_0x6ffb[_0x51d43c];return _0x180db5;};'use strict';var Sequelize=require('sequelize');module[_0xb6ff('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6ff('0x1')]},'ecm':{'type':Sequelize[_0xb6ff('0x2')](_0xb6ff('0x3'),'no'),'defaultValue':_0xb6ff('0x3')},'headerinfo':{'type':Sequelize[_0xb6ff('0x1')],'defaultValue':_0xb6ff('0x4')},'localstationid':{'type':Sequelize[_0xb6ff('0x1')],'unique':_0xb6ff('0x5')},'minrate':{'type':Sequelize[_0xb6ff('0x2')](_0xb6ff('0x6'),'4800','7200',_0xb6ff('0x7'),_0xb6ff('0x8'),_0xb6ff('0x9')),'defaultValue':_0xb6ff('0xa')},'maxrate':{'type':Sequelize[_0xb6ff('0x2')](_0xb6ff('0x6'),_0xb6ff('0xa'),_0xb6ff('0xb'),_0xb6ff('0x7'),_0xb6ff('0x8'),_0xb6ff('0x9')),'defaultValue':_0xb6ff('0x9')},'modem':{'type':Sequelize[_0xb6ff('0x1')],'defaultValue':_0xb6ff('0xc')},'gateway':{'type':Sequelize[_0xb6ff('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['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb6ff('0x2')](_0xb6ff('0xd'),_0xb6ff('0xe'),_0xb6ff('0xf'),'KHOMP'),'defaultValue':_0xb6ff('0xd')},'key':{'type':Sequelize[_0xb6ff('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb6ff('0x10');}},'notificationSound':{'type':Sequelize[_0xb6ff('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb6ff('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb6ff('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb6ff('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb6ff('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb6ff('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb6ff('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb6ff('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb6ff('0x13'),'set':function(_0x2dc1a6){if(!_0x2dc1a6)this[_0xb6ff('0x14')](_0xb6ff('0x15'),null);this[_0xb6ff('0x14')](_0xb6ff('0x16'),_0x2dc1a6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 37a5a6f..1255f8e 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 _0x04be=['mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','pick','removeDispositions','ids','getAnswers','CannedAnswer','addInteraction','omit','getInteractions','findOne','FaxInteraction','CmContact','User','Owner','fullname','internal','Tag','tag','addApplications','sequelize','FaxApplication','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','bulkCreate','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x04be,0x8b));var _0xe04b=function(_0x225fc9,_0x59ac38){_0x225fc9=_0x225fc9-0x0;var _0x127ae1=_0x04be[_0x225fc9];return _0x127ae1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe04b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe04b('0x1'));var rp=require(_0xe04b('0x2'));var moment=require(_0xe04b('0x3'));var BPromise=require(_0xe04b('0x4'));var Mustache=require(_0xe04b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe04b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe04b('0x7'));var _=require(_0xe04b('0x8'));var squel=require('squel');var crypto=require(_0xe04b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe04b('0xa'));var toCsv=require(_0xe04b('0xb'));var querystring=require(_0xe04b('0xc'));var Papa=require(_0xe04b('0xd'));var Redis=require(_0xe04b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe04b('0xf'));var hardwareService=require(_0xe04b('0x10'));var logger=require('../../config/logger')(_0xe04b('0x11'));var utils=require(_0xe04b('0x12'));var config=require(_0xe04b('0x13'));var licenseUtil=require(_0xe04b('0x14'));var db=require(_0xe04b('0x15'))['db'];config[_0xe04b('0x16')]=_['defaults'](config['redis'],{'host':_0xe04b('0x17'),'port':0x18eb});var socket=require(_0xe04b('0x18'))(new Redis(config[_0xe04b('0x16')]));require(_0xe04b('0x19'))[_0xe04b('0x1a')](socket);var jayson=require(_0xe04b('0x1b'));var client=jayson[_0xe04b('0x1c')][_0xe04b('0x1d')]({'port':0x232c});var client9002=jayson[_0xe04b('0x1c')][_0xe04b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x138e43,_0x1e81f4,_0x125853,_0xe5cdb0){return new BPromise(function(_0x557e01,_0x16b800){var _0x4770df=_0xe5cdb0||client;return _0x4770df['request'](_0x138e43,_0x125853)[_0xe04b('0x1e')](function(_0x5c6d22){logger[_0xe04b('0x1f')](_0xe04b('0x20'),_0x1e81f4,_0xe04b('0x21'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1e81f4,_0xe04b('0x21'),JSON['stringify'](_0x5c6d22));if(_0x5c6d22['error']){if(_0x5c6d22[_0xe04b('0x22')][_0xe04b('0x23')]===0x1f4){logger['error'](_0xe04b('0x20'),_0x1e81f4,_0x5c6d22['error']['message']);return _0x16b800(_0x5c6d22['error'][_0xe04b('0x24')]);}logger['error'](_0xe04b('0x20'),_0x1e81f4,_0x5c6d22[_0xe04b('0x22')][_0xe04b('0x24')]);return _0x557e01(_0x5c6d22[_0xe04b('0x22')]['message']);}else{logger['info'](_0xe04b('0x20'),_0x1e81f4,_0xe04b('0x21'));_0x557e01(_0x5c6d22[_0xe04b('0x25')][_0xe04b('0x24')]);}})[_0xe04b('0x26')](function(_0x40d84a){logger[_0xe04b('0x22')](_0xe04b('0x20'),_0x1e81f4,_0x40d84a);_0x16b800(_0x40d84a);});});}function respondWithStatusCode(_0x2523d0,_0x11b976){_0x11b976=_0x11b976||0xcc;return function(_0x4c9498){if(_0x4c9498){return _0x2523d0[_0xe04b('0x27')](_0x11b976);}return _0x2523d0['status'](_0x11b976)[_0xe04b('0x28')]();};}function respondWithResult(_0x27e64a,_0xeabc35){_0xeabc35=_0xeabc35||0xc8;return function(_0x1a6c6b){if(_0x1a6c6b){return _0x27e64a[_0xe04b('0x29')](_0xeabc35)[_0xe04b('0x2a')](_0x1a6c6b);}};}function respondWithFilteredResult(_0x595eb0,_0x98fd20){return function(_0x3e7b2d){if(_0x3e7b2d){var _0x21c549=typeof _0x98fd20[_0xe04b('0x2b')]===_0xe04b('0x2c')&&typeof _0x98fd20['limit']===_0xe04b('0x2c');var _0x206a21=_0x3e7b2d[_0xe04b('0x2d')];var _0x278110=_0x21c549?0x0:_0x98fd20[_0xe04b('0x2b')];var _0x338356=_0x21c549?_0x3e7b2d[_0xe04b('0x2d')]:_0x98fd20['offset']+_0x98fd20[_0xe04b('0x2e')];var _0x52d224;if(_0x338356>=_0x206a21){_0x338356=_0x206a21;_0x52d224=0xc8;}else{_0x52d224=0xce;}_0x595eb0['status'](_0x52d224);return _0x595eb0[_0xe04b('0x2f')](_0xe04b('0x30'),_0x278110+'-'+_0x338356+'/'+_0x206a21)[_0xe04b('0x2a')](_0x3e7b2d);}return null;};}function patchUpdates(_0x3e606f){return function(_0x3304f9){try{jsonpatch['apply'](_0x3304f9,_0x3e606f,!![]);}catch(_0x5b58a5){return BPromise[_0xe04b('0x31')](_0x5b58a5);}return _0x3304f9['save']();};}function saveUpdates(_0x1c67b6,_0x1eb025){return function(_0x2eb9cd){if(_0x2eb9cd){return _0x2eb9cd[_0xe04b('0x32')](_0x1c67b6)['then'](function(_0xced16){return _0xced16;});}return null;};}function removeEntity(_0x86b93d,_0x385e07){return function(_0x2c9f24){if(_0x2c9f24){return _0x2c9f24[_0xe04b('0x33')]()[_0xe04b('0x1e')](function(){var _0x46d425=_0x2c9f24[_0xe04b('0x34')]({'plain':!![]});var _0x3a1ce2='FaxAccounts';return db[_0xe04b('0x35')]['destroy']({'where':{'type':_0x3a1ce2,'resourceId':_0x46d425['id']}})['then'](function(){return _0x2c9f24;});})[_0xe04b('0x1e')](function(){_0x86b93d[_0xe04b('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x224bc9,_0x151059){return function(_0xf1567c){if(!_0xf1567c){_0x224bc9[_0xe04b('0x27')](0x194);}return _0xf1567c;};}function handleError(_0x789923,_0x35b1ca){_0x35b1ca=_0x35b1ca||0x1f4;return function(_0x38c2b8){logger[_0xe04b('0x22')](_0x38c2b8[_0xe04b('0x36')]);if(_0x38c2b8[_0xe04b('0x37')]){delete _0x38c2b8[_0xe04b('0x37')];}_0x789923[_0xe04b('0x29')](_0x35b1ca)[_0xe04b('0x38')](_0x38c2b8);};}exports[_0xe04b('0x39')]=function(_0x46fa13,_0x301c8a){var _0x725dfe={'include':[{'model':db[_0xe04b('0x3a')],'as':_0xe04b('0x3b')}]},_0x33c012={},_0x39fda7={'count':0x0,'rows':[]};var _0x55770e=_[_0xe04b('0x3c')](db[_0xe04b('0x3d')][_0xe04b('0x3e')],function(_0x5663ea){return{'name':_0x5663ea[_0xe04b('0x3f')],'type':_0x5663ea[_0xe04b('0x40')]['key']};});_0x33c012[_0xe04b('0x41')]=_[_0xe04b('0x3c')](_0x55770e,_0xe04b('0x37'));_0x33c012['query']=_[_0xe04b('0x42')](_0x46fa13[_0xe04b('0x43')]);_0x33c012[_0xe04b('0x44')]=_[_0xe04b('0x45')](_0x33c012[_0xe04b('0x41')],_0x33c012[_0xe04b('0x43')]);_0x725dfe[_0xe04b('0x46')]=_[_0xe04b('0x45')](_0x33c012[_0xe04b('0x41')],qs[_0xe04b('0x47')](_0x46fa13[_0xe04b('0x43')][_0xe04b('0x47')]));_0x725dfe[_0xe04b('0x46')]=_0x725dfe[_0xe04b('0x46')]['length']?_0x725dfe[_0xe04b('0x46')]:_0x33c012[_0xe04b('0x41')];if(!_0x46fa13[_0xe04b('0x43')][_0xe04b('0x48')](_0xe04b('0x49'))){_0x725dfe['limit']=qs[_0xe04b('0x2e')](_0x46fa13[_0xe04b('0x43')]['limit']);_0x725dfe[_0xe04b('0x2b')]=qs[_0xe04b('0x2b')](_0x46fa13[_0xe04b('0x43')][_0xe04b('0x2b')]);}_0x725dfe[_0xe04b('0x4a')]=qs[_0xe04b('0x4b')](_0x46fa13[_0xe04b('0x43')]['sort']);_0x725dfe[_0xe04b('0x4c')]=qs[_0xe04b('0x44')](_['pick'](_0x46fa13[_0xe04b('0x43')],_0x33c012['filters']),_0x55770e);if(_0x46fa13[_0xe04b('0x43')][_0xe04b('0x4d')]){_0x725dfe[_0xe04b('0x4c')]=_[_0xe04b('0x4e')](_0x725dfe[_0xe04b('0x4c')],{'$or':_[_0xe04b('0x3c')](_0x55770e,function(_0x36ad46){if(_0x36ad46[_0xe04b('0x40')]!==_0xe04b('0x4f')){var _0x1b1afd={};_0x1b1afd[_0x36ad46[_0xe04b('0x37')]]={'$like':'%'+_0x46fa13[_0xe04b('0x43')][_0xe04b('0x4d')]+'%'};return _0x1b1afd;}})});}_0x725dfe=_[_0xe04b('0x4e')]({},_0x725dfe,_0x46fa13[_0xe04b('0x50')]);var _0x4e01e4={'where':_0x725dfe[_0xe04b('0x4c')]};return db[_0xe04b('0x3d')]['count'](_0x4e01e4)['then'](function(_0x5655f2){_0x39fda7['count']=_0x5655f2;if(_0x46fa13[_0xe04b('0x43')][_0xe04b('0x51')]){_0x725dfe[_0xe04b('0x52')]=[{'all':!![]}];}return db[_0xe04b('0x3d')][_0xe04b('0x53')](_0x725dfe);})[_0xe04b('0x1e')](function(_0x15753a){_0x39fda7[_0xe04b('0x54')]=_0x15753a;return _0x39fda7;})['then'](respondWithFilteredResult(_0x301c8a,_0x725dfe))[_0xe04b('0x26')](handleError(_0x301c8a,null));};exports[_0xe04b('0x55')]=function(_0x36efdd,_0xe109ca){var _0x2e104f={'raw':![],'where':{'id':_0x36efdd[_0xe04b('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xe04b('0x3b')}]},_0x29d0e9={};_0x29d0e9['model']=_[_0xe04b('0x42')](db[_0xe04b('0x3d')][_0xe04b('0x3e')]);_0x29d0e9[_0xe04b('0x43')]=_[_0xe04b('0x42')](_0x36efdd[_0xe04b('0x43')]);_0x29d0e9['filters']=_[_0xe04b('0x45')](_0x29d0e9['model'],_0x29d0e9[_0xe04b('0x43')]);_0x2e104f['attributes']=_['intersection'](_0x29d0e9[_0xe04b('0x41')],qs[_0xe04b('0x47')](_0x36efdd[_0xe04b('0x43')][_0xe04b('0x47')]));_0x2e104f[_0xe04b('0x46')]=_0x2e104f['attributes'][_0xe04b('0x57')]?_0x2e104f[_0xe04b('0x46')]:_0x29d0e9[_0xe04b('0x41')];if(_0x36efdd['query'][_0xe04b('0x51')]){_0x2e104f[_0xe04b('0x52')]=[{'all':!![]}];}_0x2e104f=_[_0xe04b('0x4e')]({},_0x2e104f,_0x36efdd[_0xe04b('0x50')]);return db[_0xe04b('0x3d')][_0xe04b('0x58')](_0x2e104f)['then'](handleEntityNotFound(_0xe109ca,null))[_0xe04b('0x1e')](respondWithResult(_0xe109ca,null))[_0xe04b('0x26')](handleError(_0xe109ca,null));};exports['create']=function(_0x515bdb,_0x445969){return db[_0xe04b('0x3d')][_0xe04b('0x59')](_0x515bdb[_0xe04b('0x5a')],{})['then'](function(_0xe85a98){var _0x4c8628=_0x515bdb[_0xe04b('0x5b')][_0xe04b('0x34')]({'plain':!![]});if(!_0x4c8628)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c8628[_0xe04b('0x5c')]===_0xe04b('0x5b')){var _0x1d538f=_0xe85a98['get']({'plain':!![]});var _0x2ba1cf='FaxAccounts';return db[_0xe04b('0x5d')][_0xe04b('0x58')]({'where':{'name':_0x2ba1cf,'userProfileId':_0x4c8628[_0xe04b('0x5e')]},'raw':!![]})[_0xe04b('0x1e')](function(_0x378f45){if(_0x378f45&&_0x378f45[_0xe04b('0x5f')]===0x0){return db['UserProfileResource'][_0xe04b('0x59')]({'name':_0x1d538f[_0xe04b('0x37')],'resourceId':_0x1d538f['id'],'type':_0x378f45[_0xe04b('0x37')],'sectionId':_0x378f45['id']},{})[_0xe04b('0x1e')](function(){return _0xe85a98;});}else{return _0xe85a98;}})[_0xe04b('0x26')](function(_0xc2565a){logger[_0xe04b('0x22')](_0xe04b('0x60'),_0xc2565a);throw _0xc2565a;});}return _0xe85a98;})[_0xe04b('0x1e')](respondWithResult(_0x445969,0xc9))[_0xe04b('0x26')](handleError(_0x445969,null));};exports[_0xe04b('0x32')]=function(_0x411b41,_0xd9f6d8){if(_0x411b41['body']['id']){delete _0x411b41[_0xe04b('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x411b41['params']['id']},'include':[{'model':db[_0xe04b('0x3a')],'as':_0xe04b('0x3b')}]})[_0xe04b('0x1e')](handleEntityNotFound(_0xd9f6d8,null))['then'](saveUpdates(_0x411b41[_0xe04b('0x5a')],null))[_0xe04b('0x1e')](respondWithResult(_0xd9f6d8,null))[_0xe04b('0x26')](handleError(_0xd9f6d8,null));};exports['destroy']=function(_0x35468b,_0x4cc877){return db[_0xe04b('0x3d')]['find']({'where':{'id':_0x35468b['params']['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x4cc877,null))[_0xe04b('0x1e')](removeEntity(_0x4cc877,null))[_0xe04b('0x26')](handleError(_0x4cc877,null));};exports[_0xe04b('0x61')]=function(_0x314eec,_0x55a576){return db[_0xe04b('0x3d')][_0xe04b('0x61')]()['then'](respondWithResult(_0x55a576,null))[_0xe04b('0x26')](handleError(_0x55a576,null));};exports[_0xe04b('0x62')]=function(_0x3307a8,_0x112709,_0x771cc6){if(_0x3307a8[_0xe04b('0x5a')]['id']){delete _0x3307a8[_0xe04b('0x5a')]['id'];}return db[_0xe04b('0x3d')][_0xe04b('0x58')]({'where':{'id':_0x3307a8[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x112709,null))[_0xe04b('0x1e')](function(_0x236478){if(_0x236478){_0x3307a8[_0xe04b('0x5a')][_0xe04b('0x63')]=_0x236478['id'];return db[_0xe04b('0x64')][_0xe04b('0x59')](_0x3307a8[_0xe04b('0x5a')]);}})[_0xe04b('0x1e')](respondWithResult(_0x112709,null))[_0xe04b('0x26')](handleError(_0x112709,null));};exports[_0xe04b('0x65')]=function(_0x5d5f75,_0x139cfb,_0x56d605){var _0x3bdf5d={'raw':![],'where':{}};var _0xd69f31={};var _0x4802be={'count':0x0,'rows':[]};return db[_0xe04b('0x3d')]['findOne']({'where':{'id':_0x5d5f75[_0xe04b('0x56')]['id']}})['then'](handleEntityNotFound(_0x139cfb,null))[_0xe04b('0x1e')](function(_0x43ac9a){if(_0x43ac9a){_0xd69f31[_0xe04b('0x41')]=_[_0xe04b('0x42')](db[_0xe04b('0x64')][_0xe04b('0x3e')]);_0xd69f31[_0xe04b('0x43')]=_[_0xe04b('0x42')](_0x5d5f75[_0xe04b('0x43')]);_0xd69f31[_0xe04b('0x44')]=_[_0xe04b('0x45')](_0xd69f31[_0xe04b('0x41')],_0xd69f31[_0xe04b('0x43')]);_0x3bdf5d[_0xe04b('0x46')]=_['intersection'](_0xd69f31[_0xe04b('0x41')],qs['fields'](_0x5d5f75[_0xe04b('0x43')][_0xe04b('0x47')]));_0x3bdf5d['attributes']=_0x3bdf5d['attributes'][_0xe04b('0x57')]?_0x3bdf5d[_0xe04b('0x46')]:_0xd69f31['model'];if(!_0x5d5f75[_0xe04b('0x43')][_0xe04b('0x48')](_0xe04b('0x49'))){_0x3bdf5d[_0xe04b('0x2e')]=qs[_0xe04b('0x2e')](_0x5d5f75['query'][_0xe04b('0x2e')]);_0x3bdf5d[_0xe04b('0x2b')]=qs[_0xe04b('0x2b')](_0x5d5f75['query'][_0xe04b('0x2b')]);}_0x3bdf5d['order']=qs[_0xe04b('0x4b')](_0x5d5f75[_0xe04b('0x43')][_0xe04b('0x4b')]);_0x3bdf5d[_0xe04b('0x4c')]=qs[_0xe04b('0x44')](_[_0xe04b('0x66')](_0x5d5f75[_0xe04b('0x43')],_0xd69f31[_0xe04b('0x44')]));_0x3bdf5d[_0xe04b('0x4c')][_0xe04b('0x63')]=_0x43ac9a['id'];if(_0x5d5f75['query'][_0xe04b('0x4d')]){_0x3bdf5d['where']=_['merge'](_0x3bdf5d[_0xe04b('0x4c')],{'$or':_[_0xe04b('0x3c')](_0x3bdf5d[_0xe04b('0x46')],function(_0x54a5ff){var _0x10b011={};_0x10b011[_0x54a5ff]={'$like':'%'+_0x5d5f75[_0xe04b('0x43')][_0xe04b('0x4d')]+'%'};return _0x10b011;})});}_0x3bdf5d=_[_0xe04b('0x4e')]({},_0x3bdf5d,_0x5d5f75[_0xe04b('0x50')]);return db[_0xe04b('0x64')]['count']({'where':_0x3bdf5d[_0xe04b('0x4c')]})[_0xe04b('0x1e')](function(_0x11c4d6){_0x4802be[_0xe04b('0x2d')]=_0x11c4d6;if(_0x5d5f75['query'][_0xe04b('0x51')]){_0x3bdf5d[_0xe04b('0x52')]=[{'all':!![]}];}return db[_0xe04b('0x64')][_0xe04b('0x53')](_0x3bdf5d);})[_0xe04b('0x1e')](function(_0x351c67){_0x4802be[_0xe04b('0x54')]=_0x351c67;return _0x4802be;});}})[_0xe04b('0x1e')](respondWithFilteredResult(_0x139cfb,_0x3bdf5d))[_0xe04b('0x26')](handleError(_0x139cfb,null));};exports[_0xe04b('0x67')]=function(_0x48aff5,_0x10c617,_0x586609){return db[_0xe04b('0x3d')]['find']({'where':{'id':_0x48aff5[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x10c617,null))[_0xe04b('0x1e')](function(_0x5636c5){if(_0x5636c5){return _0x5636c5[_0xe04b('0x67')](_0x48aff5['query'][_0xe04b('0x68')]);}})[_0xe04b('0x1e')](respondWithStatusCode(_0x10c617,null))[_0xe04b('0x26')](handleError(_0x10c617,null));};exports['addAnswer']=function(_0x43e3c0,_0x442bf0,_0x32f835){if(_0x43e3c0[_0xe04b('0x5a')]['id']){delete _0x43e3c0[_0xe04b('0x5a')]['id'];}return db[_0xe04b('0x3d')]['find']({'where':{'id':_0x43e3c0[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x442bf0,null))[_0xe04b('0x1e')](function(_0x2ce97e){if(_0x2ce97e){_0x43e3c0['body'][_0xe04b('0x63')]=_0x2ce97e['id'];return db['CannedAnswer'][_0xe04b('0x59')](_0x43e3c0[_0xe04b('0x5a')]);}})['then'](respondWithResult(_0x442bf0,null))[_0xe04b('0x26')](handleError(_0x442bf0,null));};exports[_0xe04b('0x69')]=function(_0x477269,_0x2f8cad,_0x2884fb){var _0x303ac1={'raw':![],'where':{}};var _0x113a3e={};var _0x393eed={'count':0x0,'rows':[]};return db[_0xe04b('0x3d')]['findOne']({'where':{'id':_0x477269[_0xe04b('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f8cad,null))[_0xe04b('0x1e')](function(_0x833954){if(_0x833954){_0x113a3e[_0xe04b('0x41')]=_[_0xe04b('0x42')](db[_0xe04b('0x6a')]['rawAttributes']);_0x113a3e[_0xe04b('0x43')]=_[_0xe04b('0x42')](_0x477269[_0xe04b('0x43')]);_0x113a3e[_0xe04b('0x44')]=_['intersection'](_0x113a3e[_0xe04b('0x41')],_0x113a3e[_0xe04b('0x43')]);_0x303ac1['attributes']=_['intersection'](_0x113a3e['model'],qs[_0xe04b('0x47')](_0x477269[_0xe04b('0x43')][_0xe04b('0x47')]));_0x303ac1['attributes']=_0x303ac1[_0xe04b('0x46')][_0xe04b('0x57')]?_0x303ac1[_0xe04b('0x46')]:_0x113a3e[_0xe04b('0x41')];if(!_0x477269['query'][_0xe04b('0x48')](_0xe04b('0x49'))){_0x303ac1[_0xe04b('0x2e')]=qs[_0xe04b('0x2e')](_0x477269[_0xe04b('0x43')][_0xe04b('0x2e')]);_0x303ac1['offset']=qs[_0xe04b('0x2b')](_0x477269[_0xe04b('0x43')][_0xe04b('0x2b')]);}_0x303ac1[_0xe04b('0x4a')]=qs[_0xe04b('0x4b')](_0x477269[_0xe04b('0x43')][_0xe04b('0x4b')]);_0x303ac1[_0xe04b('0x4c')]=qs[_0xe04b('0x44')](_[_0xe04b('0x66')](_0x477269[_0xe04b('0x43')],_0x113a3e['filters']));_0x303ac1['where'][_0xe04b('0x63')]=_0x833954['id'];if(_0x477269[_0xe04b('0x43')][_0xe04b('0x4d')]){_0x303ac1[_0xe04b('0x4c')]=_['merge'](_0x303ac1[_0xe04b('0x4c')],{'$or':_[_0xe04b('0x3c')](_0x303ac1[_0xe04b('0x46')],function(_0x1e79e5){var _0x4d2927={};_0x4d2927[_0x1e79e5]={'$like':'%'+_0x477269[_0xe04b('0x43')][_0xe04b('0x4d')]+'%'};return _0x4d2927;})});}_0x303ac1=_['merge']({},_0x303ac1,_0x477269[_0xe04b('0x50')]);return db[_0xe04b('0x6a')][_0xe04b('0x2d')]({'where':_0x303ac1[_0xe04b('0x4c')]})[_0xe04b('0x1e')](function(_0x15fb52){_0x393eed[_0xe04b('0x2d')]=_0x15fb52;if(_0x477269[_0xe04b('0x43')]['includeAll']){_0x303ac1['include']=[{'all':!![]}];}return db[_0xe04b('0x6a')][_0xe04b('0x53')](_0x303ac1);})[_0xe04b('0x1e')](function(_0x36e949){_0x393eed[_0xe04b('0x54')]=_0x36e949;return _0x393eed;});}})['then'](respondWithFilteredResult(_0x2f8cad,_0x303ac1))[_0xe04b('0x26')](handleError(_0x2f8cad,null));};exports['removeAnswers']=function(_0x1bb300,_0x36ada3,_0x42493c){return db[_0xe04b('0x3d')][_0xe04b('0x58')]({'where':{'id':_0x1bb300[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x36ada3,null))[_0xe04b('0x1e')](function(_0x50d5e4){if(_0x50d5e4){return _0x50d5e4['removeAnswers'](_0x1bb300[_0xe04b('0x43')][_0xe04b('0x68')]);}})['then'](respondWithStatusCode(_0x36ada3,null))[_0xe04b('0x26')](handleError(_0x36ada3,null));};exports[_0xe04b('0x6b')]=function(_0x2db7f9,_0x343866,_0x37e867){return db['FaxInteraction'][_0xe04b('0x58')]({'where':{'id':_0x2db7f9[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x343866,null))['then'](function(_0x237e30){if(_0x237e30){return _0x237e30[_0xe04b('0x6b')](_0x2db7f9[_0xe04b('0x5a')][_0xe04b('0x68')],_[_0xe04b('0x6c')](_0x2db7f9[_0xe04b('0x5a')],[_0xe04b('0x68'),'id'])||{});}})[_0xe04b('0x1e')](respondWithResult(_0x343866,null))['catch'](handleError(_0x343866,null));};exports[_0xe04b('0x6d')]=function(_0x47c357,_0x287f3d,_0x46fed5){var _0xb50003={'raw':![],'where':{}};var _0x23e640={};var _0x19cffa={'count':0x0,'rows':[]};return db[_0xe04b('0x3d')][_0xe04b('0x6e')]({'where':{'id':_0x47c357[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x287f3d,null))[_0xe04b('0x1e')](function(_0x46957b){if(_0x46957b){_0x23e640[_0xe04b('0x41')]=_[_0xe04b('0x42')](db[_0xe04b('0x6f')][_0xe04b('0x3e')]);_0x23e640[_0xe04b('0x43')]=_[_0xe04b('0x42')](_0x47c357[_0xe04b('0x43')]);_0x23e640[_0xe04b('0x44')]=_[_0xe04b('0x45')](_0x23e640[_0xe04b('0x41')],_0x23e640[_0xe04b('0x43')]);_0xb50003[_0xe04b('0x46')]=_[_0xe04b('0x45')](_0x23e640[_0xe04b('0x41')],qs['fields'](_0x47c357[_0xe04b('0x43')][_0xe04b('0x47')]));_0xb50003[_0xe04b('0x46')]=_0xb50003[_0xe04b('0x46')][_0xe04b('0x57')]?_0xb50003[_0xe04b('0x46')]:_0x23e640[_0xe04b('0x41')];if(!_0x47c357[_0xe04b('0x43')][_0xe04b('0x48')](_0xe04b('0x49'))){_0xb50003[_0xe04b('0x2e')]=qs['limit'](_0x47c357[_0xe04b('0x43')]['limit']);_0xb50003['offset']=qs['offset'](_0x47c357[_0xe04b('0x43')][_0xe04b('0x2b')]);}_0xb50003['order']=qs[_0xe04b('0x4b')](_0x47c357[_0xe04b('0x43')][_0xe04b('0x4b')]);_0xb50003[_0xe04b('0x4c')]=qs[_0xe04b('0x44')](_[_0xe04b('0x66')](_0x47c357['query'],_0x23e640['filters']));_0xb50003[_0xe04b('0x4c')][_0xe04b('0x63')]=_0x46957b['id'];if(_0x47c357[_0xe04b('0x43')][_0xe04b('0x4d')]){_0xb50003[_0xe04b('0x4c')]=_[_0xe04b('0x4e')](_0xb50003[_0xe04b('0x4c')],{'$or':_[_0xe04b('0x3c')](_0xb50003[_0xe04b('0x46')],function(_0x36e75a){var _0x413c9a={};_0x413c9a[_0x36e75a]={'$like':'%'+_0x47c357[_0xe04b('0x43')][_0xe04b('0x4d')]+'%'};return _0x413c9a;})});}_0xb50003=_[_0xe04b('0x4e')]({},_0xb50003,_0x47c357[_0xe04b('0x50')]);return db[_0xe04b('0x6f')][_0xe04b('0x2d')]({'where':_0xb50003['where']})[_0xe04b('0x1e')](function(_0xc5385e){_0x19cffa[_0xe04b('0x2d')]=_0xc5385e;if(_0x47c357['query'][_0xe04b('0x51')]){_0xb50003[_0xe04b('0x52')]=[{'model':db[_0xe04b('0x70')],'as':'Contact','required':![]},{'model':db[_0xe04b('0x71')],'as':_0xe04b('0x72'),'attributes':['name',_0xe04b('0x73'),_0xe04b('0x74')],'required':![]},{'model':db[_0xe04b('0x75')],'as':'Tags','attributes':['id',_0xe04b('0x37'),'color'],'where':_0x47c357['query']['tag']?{'id':_0x47c357[_0xe04b('0x43')][_0xe04b('0x76')]}:undefined,'required':_0x47c357[_0xe04b('0x43')][_0xe04b('0x76')]?!![]:![]}];}return db['FaxInteraction'][_0xe04b('0x53')](_0xb50003);})[_0xe04b('0x1e')](function(_0x2bda61){_0x19cffa[_0xe04b('0x54')]=_0x2bda61;return _0x19cffa;});}})[_0xe04b('0x1e')](respondWithFilteredResult(_0x287f3d,_0xb50003))[_0xe04b('0x26')](handleError(_0x287f3d,null));};exports[_0xe04b('0x77')]=function(_0x3dfa26,_0x5c80f8,_0x275b51){return db['FaxAccount'][_0xe04b('0x6e')]({'where':{'id':_0x3dfa26['params']['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x5c80f8,null))['then'](function(_0x3a8f50){if(_0x3a8f50){return db[_0xe04b('0x78')]['transaction'](function(_0x2ee26f){return db[_0xe04b('0x79')][_0xe04b('0x33')]({'where':{'FaxAccountId':_0x3dfa26[_0xe04b('0x56')]['id']},'transaction':_0x2ee26f})[_0xe04b('0x1e')](function(_0x32a210){var _0x5d0296=_[_0xe04b('0x3c')](_0x3dfa26[_0xe04b('0x5a')],function(_0x4aafab){_0x4aafab['FaxAccountId']=_0x3dfa26[_0xe04b('0x56')]['id'];return _0x4aafab;});return db[_0xe04b('0x79')]['bulkCreate'](_0x5d0296,{'transaction':_0x2ee26f});});})[_0xe04b('0x1e')](function(){return db[_0xe04b('0x79')]['findAndCountAll']({'where':{'FaxAccountId':_0x3dfa26['params']['id']},'order':'priority'});});}})[_0xe04b('0x1e')](respondWithResult(_0x5c80f8,null))[_0xe04b('0x26')](handleError(_0x5c80f8,null));};exports[_0xe04b('0x7a')]=function(_0x10f3bb,_0x133c09,_0x466f96){var _0x32d8e6={};var _0x3813f2={};var _0x1a832c;var _0xd30756;return db[_0xe04b('0x3d')][_0xe04b('0x6e')]({'where':{'id':_0x10f3bb[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x133c09,null))['then'](function(_0x382f90){if(_0x382f90){_0x1a832c=_0x382f90;_0x3813f2['model']=_['keys'](db['FaxApplication'][_0xe04b('0x3e')]);_0x3813f2[_0xe04b('0x43')]=_['keys'](_0x10f3bb[_0xe04b('0x43')]);_0x3813f2[_0xe04b('0x44')]=_['intersection'](_0x3813f2['model'],_0x3813f2['query']);_0x32d8e6[_0xe04b('0x46')]=_[_0xe04b('0x45')](_0x3813f2['model'],qs[_0xe04b('0x47')](_0x10f3bb['query'][_0xe04b('0x47')]));_0x32d8e6['attributes']=_0x32d8e6[_0xe04b('0x46')][_0xe04b('0x57')]?_0x32d8e6['attributes']:_0x3813f2[_0xe04b('0x41')];_0x32d8e6[_0xe04b('0x4a')]=qs[_0xe04b('0x4b')](_0x10f3bb[_0xe04b('0x43')][_0xe04b('0x4b')]);_0x32d8e6['where']=qs[_0xe04b('0x44')](_[_0xe04b('0x66')](_0x10f3bb[_0xe04b('0x43')],_0x3813f2[_0xe04b('0x44')]));if(_0x10f3bb[_0xe04b('0x43')][_0xe04b('0x4d')]){_0x32d8e6['where']=_[_0xe04b('0x4e')](_0x32d8e6[_0xe04b('0x4c')],{'$or':_['map'](_0x32d8e6[_0xe04b('0x46')],function(_0x2d3501){var _0x2b504={};_0x2b504[_0x2d3501]={'$like':'%'+_0x10f3bb[_0xe04b('0x43')]['filter']+'%'};return _0x2b504;})});}_0x32d8e6=_[_0xe04b('0x4e')]({},_0x32d8e6,_0x10f3bb[_0xe04b('0x50')]);return _0x1a832c['getApplications'](_0x32d8e6);}})[_0xe04b('0x1e')](function(_0x11d502){if(_0x11d502){_0xd30756=_0x11d502[_0xe04b('0x57')];if(!_0x10f3bb[_0xe04b('0x43')]['hasOwnProperty'](_0xe04b('0x49'))){_0x32d8e6[_0xe04b('0x2e')]=qs['limit'](_0x10f3bb['query']['limit']);_0x32d8e6[_0xe04b('0x2b')]=qs[_0xe04b('0x2b')](_0x10f3bb[_0xe04b('0x43')]['offset']);}return _0x1a832c['getApplications'](_0x32d8e6);}})[_0xe04b('0x1e')](function(_0x3acc50){if(_0x3acc50){return _0x3acc50?{'count':_0xd30756,'rows':_0x3acc50}:null;}})[_0xe04b('0x1e')](respondWithResult(_0x133c09,null))[_0xe04b('0x26')](handleError(_0x133c09,null));};function Extension(_0x2f894e,_0x4698d4,_0x54385a,_0x58a37e){this[_0xe04b('0x7b')]='from-voip-provider';this[_0xe04b('0x7c')]=_0x2f894e[_0xe04b('0x7d')];this[_0xe04b('0x7e')]=_0x58a37e;this[_0xe04b('0x40')]=_0xe04b('0x7f');this[_0xe04b('0x80')]=_0xe04b('0x81');this[_0xe04b('0x63')]=_0x2f894e['id'];this[_0xe04b('0x82')]=_0x4698d4;this[_0xe04b('0x83')]=_0x54385a;}function createExtensionsReciveFax(_0x5bf220){var _0xac6bb2=0x1;var _0x116430=[];_0x116430[_0xe04b('0x84')](new Extension(_0x5bf220,_0xac6bb2,'',_0xe04b('0x85')));_0xac6bb2+=0x1;_0x116430[_0xe04b('0x84')](new Extension(_0x5bf220,_0xac6bb2,_0xe04b('0x86'),_0xe04b('0x87')));_0xac6bb2+=0x1;for(var _0x13baba in _0x5bf220){if(_0x5bf220[_0xe04b('0x48')](_0x13baba)&&(_0x13baba===_0xe04b('0x88')||_0x13baba===_0xe04b('0x7d')||_0x13baba===_0xe04b('0x89')||_0x13baba===_0xe04b('0x8a')||_0x13baba===_0xe04b('0x8b')||_0x13baba===_0xe04b('0x8c')||_0x13baba===_0xe04b('0x8d')||_0x13baba===_0xe04b('0x8e')||_0x13baba===_0xe04b('0x8f'))){_0x116430[_0xe04b('0x84')](new Extension(_0x5bf220,_0xac6bb2,_0xe04b('0x90')+_0x13baba+')='+_0x5bf220[_0x13baba],_0xe04b('0x87')));_0xac6bb2+=0x1;}}_0x116430[_0xe04b('0x84')](new Extension(_0x5bf220,_0xac6bb2,'6',_0xe04b('0x91')));_0xac6bb2+=0x1;_0x116430[_0xe04b('0x84')](new Extension(_0x5bf220,_0xac6bb2,_0xe04b('0x92'),_0xe04b('0x93')));_0xac6bb2=0x0;return _0x116430;}exports[_0xe04b('0x94')]=function(_0xbac1ab,_0x1928fd,_0x480bd1){var _0x10e8bb;return db[_0xe04b('0x78')][_0xe04b('0x95')](function(_0x50b66a){return db[_0xe04b('0x3d')][_0xe04b('0x59')](_0xbac1ab['body'],{'transaction':_0x50b66a})[_0xe04b('0x1e')](function(_0x57450b){_0x10e8bb=_0x57450b[_0xe04b('0x34')]({'plain':!![]});return db['VoiceExtension'][_0xe04b('0x96')](createExtensionsReciveFax(_0x10e8bb),{'transaction':_0x50b66a});});})[_0xe04b('0x1e')](function(){return _0x10e8bb;})[_0xe04b('0x1e')](respondWithResult(_0x1928fd,null))['catch'](handleError(_0x1928fd,null));};exports['updateAccountApplications']=function(_0x5209fe,_0x5715e3,_0x49ea51){var _0x429200;return db[_0xe04b('0x78')][_0xe04b('0x95')](function(_0xa068e3){return db[_0xe04b('0x3d')][_0xe04b('0x32')](_0x5209fe[_0xe04b('0x5a')],{'where':{'id':_0x5209fe[_0xe04b('0x5a')]['id']},'transaction':_0xa068e3})[_0xe04b('0x1e')](function(_0xc3b13b){return db[_0xe04b('0x97')][_0xe04b('0x33')]({'where':{'FaxAccountId':_0x5209fe[_0xe04b('0x5a')]['id']},'transaction':_0xa068e3})[_0xe04b('0x1e')](function(_0x3b5504){return db['VoiceExtension'][_0xe04b('0x96')](createExtensionsReciveFax(_[_0xe04b('0x6c')](_0x5209fe[_0xe04b('0x5a')],[_0xe04b('0x98'),_0xe04b('0x99'),_0xe04b('0x9a'),_0xe04b('0x9b'),_0xe04b('0x9c'),_0xe04b('0x9d')])),{'transaction':_0xa068e3});});});})['then'](function(){return db[_0xe04b('0x3d')][_0xe04b('0x9e')](_0x5209fe[_0xe04b('0x5a')]['id']);})['then'](respondWithResult(_0x5715e3,null))['catch'](handleError(_0x5715e3,null));};exports['getMessages']=function(_0x520d95,_0x140a1,_0x180571){var _0x44a4bd={'raw':!![],'where':{}};var _0x4664de={};var _0x2b2543={'count':0x0,'rows':[]};return db[_0xe04b('0x3d')][_0xe04b('0x6e')]({'where':{'id':_0x520d95[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x140a1,null))[_0xe04b('0x1e')](function(_0x463e6c){if(_0x463e6c){_0x4664de[_0xe04b('0x41')]=_['keys'](db[_0xe04b('0x9f')][_0xe04b('0x3e')]);_0x4664de[_0xe04b('0x43')]=_['keys'](_0x520d95['query']);_0x4664de['filters']=_[_0xe04b('0x45')](_0x4664de[_0xe04b('0x41')],_0x4664de['query']);_0x44a4bd[_0xe04b('0x46')]=_[_0xe04b('0x45')](_0x4664de[_0xe04b('0x41')],qs[_0xe04b('0x47')](_0x520d95['query']['fields']));_0x44a4bd[_0xe04b('0x46')]=_0x44a4bd[_0xe04b('0x46')][_0xe04b('0x57')]?_0x44a4bd[_0xe04b('0x46')]:_0x4664de[_0xe04b('0x41')];if(!_0x520d95[_0xe04b('0x43')][_0xe04b('0x48')](_0xe04b('0x49'))){_0x44a4bd[_0xe04b('0x2e')]=qs[_0xe04b('0x2e')](_0x520d95[_0xe04b('0x43')][_0xe04b('0x2e')]);_0x44a4bd[_0xe04b('0x2b')]=qs[_0xe04b('0x2b')](_0x520d95[_0xe04b('0x43')][_0xe04b('0x2b')]);}_0x44a4bd[_0xe04b('0x4a')]=qs['sort'](_0x520d95[_0xe04b('0x43')][_0xe04b('0x4b')]);_0x44a4bd[_0xe04b('0x4c')]=qs[_0xe04b('0x44')](_[_0xe04b('0x66')](_0x520d95[_0xe04b('0x43')],_0x4664de[_0xe04b('0x44')]));_0x44a4bd[_0xe04b('0x4c')][_0xe04b('0x63')]=_0x463e6c['id'];if(_0x520d95[_0xe04b('0x43')][_0xe04b('0x4d')]){_0x44a4bd[_0xe04b('0x4c')]=_[_0xe04b('0x4e')](_0x44a4bd['where'],{'$or':_[_0xe04b('0x3c')](_0x44a4bd[_0xe04b('0x46')],function(_0x21be95){var _0x44ab20={};_0x44ab20[_0x21be95]={'$like':'%'+_0x520d95[_0xe04b('0x43')][_0xe04b('0x4d')]+'%'};return _0x44ab20;})});}if(_0x520d95[_0xe04b('0x43')][_0xe04b('0xa0')]){var _0x518e06=_0x520d95[_0xe04b('0x43')][_0xe04b('0xa0')][_0xe04b('0xa1')](',');var _0x59ead={};_0x59ead[_0x518e06[0x0]]={'$gte':moment(_0x518e06[0x1])[_0xe04b('0xa2')](_0xe04b('0xa3'))};_0x44a4bd[_0xe04b('0x4c')]=_['merge'](_0x44a4bd[_0xe04b('0x4c')],_0x59ead);}_0x44a4bd=_[_0xe04b('0x4e')]({},_0x44a4bd,_0x520d95[_0xe04b('0x50')]);return db[_0xe04b('0x9f')]['count']({'where':_0x44a4bd[_0xe04b('0x4c')]})[_0xe04b('0x1e')](function(_0x12c3e2){_0x2b2543[_0xe04b('0x2d')]=_0x12c3e2;if(_0x520d95[_0xe04b('0x43')]['includeAll']){_0x44a4bd[_0xe04b('0x52')]=[{'all':!![]}];}return db[_0xe04b('0x9f')][_0xe04b('0x53')](_0x44a4bd);})['then'](function(_0xb51c7f){_0x2b2543[_0xe04b('0x54')]=_0xb51c7f;return _0x2b2543;});}})['then'](respondWithFilteredResult(_0x140a1,_0x44a4bd))[_0xe04b('0x26')](handleError(_0x140a1,null));};exports[_0xe04b('0x38')]=function(_0x25e217,_0x2bed0a,_0x473d10){var _0x17b6be,_0xdedab7={},_0x508de3;if(_0x25e217['body']['to']){_0x508de3=_0x25e217['body']['to'][0x0];}return db[_0xe04b('0x3d')][_0xe04b('0x58')]({'where':{'id':_0x25e217[_0xe04b('0x56')]['id']},'include':[{'model':db[_0xe04b('0xa4')],'as':'List','include':[{'model':db[_0xe04b('0x70')],'as':_0xe04b('0xa5'),'where':{'fax':_0x508de3},'limit':0x1,'order':[['updatedAt',_0xe04b('0xa6')]]}]}]})[_0xe04b('0x1e')](handleEntityNotFound(_0x2bed0a,null))[_0xe04b('0x1e')](function(_0x4ae381){_0x17b6be=_0x4ae381;if(_0x25e217['body'][_0xe04b('0xa7')]&&_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][_0xe04b('0x57')]){for(var _0xbbdd2c=0x0;_0xbbdd2c<_0x25e217[_0xe04b('0x5a')]['attachments'][_0xe04b('0x57')];_0xbbdd2c+=0x1){_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][_0xbbdd2c]={'filename':_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][_0xbbdd2c][_0xe04b('0x37')],'id':_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][_0xbbdd2c]['id'],'path':path[_0xe04b('0xa8')](config[_0xe04b('0xa9')],_0xe04b('0xaa'),_0x25e217[_0xe04b('0x5a')]['attachments'][_0xbbdd2c][_0xe04b('0xab')])};}}return respondWithRpcPromise(_0xe04b('0xac'),_0xe04b('0xac'),{'FaxAccountId':_[_0xe04b('0xad')](_0x25e217[_0xe04b('0x56')]['id'])?undefined:_0x25e217['params']['id'],'path':_['isNil'](_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][0x0][_0xe04b('0xae')])?undefined:_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][0x0][_0xe04b('0xae')],'fax':_[_0xe04b('0xad')](_0x25e217[_0xe04b('0x5a')]['to'][0x0])?undefined:_0x25e217[_0xe04b('0x5a')]['to'][0x0]},client9002);})[_0xe04b('0x1e')](function(){if(_0x17b6be){if(_[_0xe04b('0xad')](_0x25e217[_0xe04b('0x5a')][_0xe04b('0xaf')])){_0x25e217[_0xe04b('0x5a')]['from']=util[_0xe04b('0xa2')](_0xe04b('0xb0'),_0x17b6be[_0xe04b('0x37')],_0x17b6be[_0xe04b('0xb1')]);}if(_0x17b6be[_0xe04b('0xb2')]){if(_0x17b6be[_0xe04b('0xb2')]['Contacts'][_0xe04b('0x57')]){return _0x17b6be['List'][_0xe04b('0xa5')][0x0];}else{return db[_0xe04b('0x70')][_0xe04b('0x59')](_[_0xe04b('0xb3')](_0x25e217['body'],{'firstName':_0x25e217['body']['to'][0x0],'phone':_0x25e217[_0xe04b('0x5a')]['to'][0x0],'fax':_0x25e217[_0xe04b('0x5a')]['to'][0x0],'ListId':_0x17b6be[_0xe04b('0x9d')]}));}}else{throw new Error(_0xe04b('0xb4'));}}else{throw new Error(_0xe04b('0xb5'));}})[_0xe04b('0x1e')](function(_0x453998){if(_0x453998){return db[_0xe04b('0x6f')][_0xe04b('0x58')]({'where':{'ContactId':_0x453998['id'],'closed':![],'FaxAccountId':_0x17b6be['id']}})[_0xe04b('0x1e')](function(_0x3aa653){if(_0x3aa653){return[_0x3aa653,![]];}return db[_0xe04b('0x6f')][_0xe04b('0x59')]({'UserId':_0x25e217[_0xe04b('0x5b')]['id'],'ContactId':_0x453998['id'],'FaxAccountId':_0x17b6be['id'],'fax':_0x25e217['body']['to'][0x0],'firstMsgDirection':_0xe04b('0xb6'),'Messages':[_[_0xe04b('0x4e')](_0x25e217[_0xe04b('0x5a')],{'read':![],'body':_0x25e217['body'][_0xe04b('0xa7')][0x0][_0xe04b('0xb7')],'FaxAccountId':_0x17b6be['id'],'UserId':_0x25e217[_0xe04b('0x5b')]['id'],'ContactId':_0x453998['id'],'AttachmentId':_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xe04b('0x9f')],'as':_0xe04b('0xb8')}]})[_0xe04b('0x1e')](function(_0x28f3b0){return[_0x28f3b0,!![]];});});}else{throw new Error(_0xe04b('0xb9'));}})['spread'](function(_0xd9c2f6,_0x52ee28){if(_0x52ee28){return _0xd9c2f6;}return db[_0xe04b('0x9f')][_0xe04b('0x59')]({'direction':'out','read':![],'body':_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][0x0][_0xe04b('0xb7')],'FaxAccountId':_0x17b6be['id'],'FaxInteractionId':_0xd9c2f6['id'],'UserId':_0x25e217[_0xe04b('0x5b')]['id'],'ContactId':_0xd9c2f6[_0xe04b('0xba')],'AttachmentId':_0x25e217['body'][_0xe04b('0xa7')][0x0]['id']})['then'](function(_0x3f6c33){_0xd9c2f6[_0xe04b('0xbb')][_0xe04b('0xb8')]=[];_0xd9c2f6['dataValues'][_0xe04b('0xb8')][_0xe04b('0x84')](_0x3f6c33['dataValues']);return _0xd9c2f6;});})[_0xe04b('0x1e')](function(_0x372cc0){respondWithRpcPromise(_0xe04b('0xbc'),_0xe04b('0xbc'),{'FaxAccountId':_[_0xe04b('0xad')](_0x25e217[_0xe04b('0x56')]['id'])?undefined:_0x25e217['params']['id'],'path':_[_0xe04b('0xad')](_0x25e217[_0xe04b('0x5a')]['attachments'][0x0]['path'])?undefined:_0x25e217[_0xe04b('0x5a')][_0xe04b('0xa7')][0x0][_0xe04b('0xae')],'fax':_['isNil'](_0x25e217[_0xe04b('0x5a')]['to'][0x0])?undefined:_0x25e217[_0xe04b('0x5a')]['to'][0x0],'AttachmentId':_0x25e217['body'][_0xe04b('0xa7')][0x0]['id']},client9002)['then'](function(_0x2a2a18){logger[_0xe04b('0x1f')](_0xe04b('0xbd'),_0x2a2a18);})[_0xe04b('0x26')](function(_0x38784a){logger['info'](_0xe04b('0xbd'),_0x38784a);});return _0x372cc0;})[_0xe04b('0x1e')](respondWithResult(_0x2bed0a,null))[_0xe04b('0x26')](handleError(_0x2bed0a,null));};exports[_0xe04b('0xbe')]=function(_0x4784b9,_0x2df1b7,_0x458614){return db[_0xe04b('0x3d')][_0xe04b('0x58')]({'where':{'id':_0x4784b9[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x2df1b7,null))['then'](function(_0x3d1561){if(_0x3d1561){return _0x3d1561[_0xe04b('0xbe')](_0x4784b9['body'][_0xe04b('0x68')],_[_0xe04b('0x6c')](_0x4784b9[_0xe04b('0x5a')],[_0xe04b('0x68'),'id'])||{})[_0xe04b('0xbf')](function(_0x54c834){for(var _0x3994aa=0x0;_0x3994aa<_0x4784b9[_0xe04b('0x5a')][_0xe04b('0x68')][_0xe04b('0x57')];_0x3994aa+=0x1){socket[_0xe04b('0xc0')](_0xe04b('0xc1'),{'UserId':_0x4784b9['body'][_0xe04b('0x68')][_0x3994aa],'FaxAccountId':_0x4784b9[_0xe04b('0x56')]['id']});}return _0x54c834;});}})['then'](respondWithResult(_0x2df1b7,null))[_0xe04b('0x26')](handleError(_0x2df1b7,null));};exports[_0xe04b('0xc2')]=function(_0x1d4a7f,_0x1b8282,_0x4c4d16){return db[_0xe04b('0x3d')][_0xe04b('0x58')]({'where':{'id':_0x1d4a7f[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x1b8282,null))[_0xe04b('0x1e')](function(_0x5b1ba7){if(_0x5b1ba7){return _0x5b1ba7['removeAgents'](_0x1d4a7f[_0xe04b('0x43')][_0xe04b('0x68')])[_0xe04b('0x1e')](function(){if(_[_0xe04b('0xc3')](_0x1d4a7f['query'][_0xe04b('0x68')])){for(var _0x21f941=0x0;_0x21f941<_0x1d4a7f[_0xe04b('0x43')][_0xe04b('0x68')]['length'];_0x21f941+=0x1){socket[_0xe04b('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x1d4a7f['query']['ids'][_0x21f941]),'FaxAccountId':Number(_0x1d4a7f[_0xe04b('0x56')]['id'])});}}else{socket[_0xe04b('0xc0')](_0xe04b('0xc4'),{'UserId':Number(_0x1d4a7f[_0xe04b('0x43')][_0xe04b('0x68')]),'FaxAccountId':Number(_0x1d4a7f[_0xe04b('0x56')]['id'])});}});}})[_0xe04b('0x1e')](respondWithStatusCode(_0x1b8282,null))[_0xe04b('0x26')](handleError(_0x1b8282,null));};exports[_0xe04b('0xc5')]=function(_0x5479db,_0x2f0104,_0x327361){var _0x452ecd={};var _0x23e37d={};var _0x55cc47;var _0x422dc5;return db[_0xe04b('0x3d')][_0xe04b('0x6e')]({'where':{'id':_0x5479db[_0xe04b('0x56')]['id']}})[_0xe04b('0x1e')](handleEntityNotFound(_0x2f0104,null))[_0xe04b('0x1e')](function(_0x2c72fb){if(_0x2c72fb){_0x55cc47=_0x2c72fb;_0x23e37d[_0xe04b('0x41')]=_[_0xe04b('0x42')](db['User'][_0xe04b('0x3e')]);_0x23e37d[_0xe04b('0x43')]=_['keys'](_0x5479db[_0xe04b('0x43')]);_0x23e37d[_0xe04b('0x44')]=_[_0xe04b('0x45')](_0x23e37d[_0xe04b('0x41')],_0x23e37d[_0xe04b('0x43')]);_0x452ecd[_0xe04b('0x46')]=_[_0xe04b('0x45')](_0x23e37d[_0xe04b('0x41')],qs['fields'](_0x5479db[_0xe04b('0x43')][_0xe04b('0x47')]));_0x452ecd['attributes']=_0x452ecd['attributes']['length']?_0x452ecd[_0xe04b('0x46')]:_0x23e37d[_0xe04b('0x41')];_0x452ecd[_0xe04b('0x4a')]=qs[_0xe04b('0x4b')](_0x5479db[_0xe04b('0x43')][_0xe04b('0x4b')]);_0x452ecd[_0xe04b('0x4c')]=qs[_0xe04b('0x44')](_[_0xe04b('0x66')](_0x5479db[_0xe04b('0x43')],_0x23e37d[_0xe04b('0x44')]));if(_0x5479db[_0xe04b('0x43')][_0xe04b('0x4d')]){_0x452ecd[_0xe04b('0x4c')]=_[_0xe04b('0x4e')](_0x452ecd['where'],{'$or':_[_0xe04b('0x3c')](_0x452ecd['attributes'],function(_0x1fd891){var _0x5e57dd={};_0x5e57dd[_0x1fd891]={'$like':'%'+_0x5479db['query'][_0xe04b('0x4d')]+'%'};return _0x5e57dd;})});}_0x452ecd=_['merge']({},_0x452ecd,_0x5479db['options']);return _0x55cc47[_0xe04b('0xc5')](_0x452ecd);}})[_0xe04b('0x1e')](function(_0x16773a){if(_0x16773a){_0x422dc5=_0x16773a['length'];if(!_0x5479db[_0xe04b('0x43')][_0xe04b('0x48')](_0xe04b('0x49'))){_0x452ecd[_0xe04b('0x2e')]=qs['limit'](_0x5479db[_0xe04b('0x43')][_0xe04b('0x2e')]);_0x452ecd[_0xe04b('0x2b')]=qs[_0xe04b('0x2b')](_0x5479db[_0xe04b('0x43')]['offset']);}return _0x55cc47[_0xe04b('0xc5')](_0x452ecd);}})[_0xe04b('0x1e')](function(_0x4cec1a){if(_0x4cec1a){return _0x4cec1a?{'count':_0x422dc5,'rows':_0x4cec1a}:null;}})[_0xe04b('0x1e')](respondWithResult(_0x2f0104,null))[_0xe04b('0x26')](handleError(_0x2f0104,null));}; \ No newline at end of file +var _0xfc17=['CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','filters','intersection','query','attributes','model','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','Pause','keys','fields','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','FaxAccountId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','exten','app','type','system','description','Fax\x20Extension','push','Set','ecm','localstationid','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','attachments','join','root','server/files/attachments','basename'];(function(_0x227a76,_0x2bd04f){var _0x461f7b=function(_0xe81cf2){while(--_0xe81cf2){_0x227a76['push'](_0x227a76['shift']());}};_0x461f7b(++_0x2bd04f);}(_0xfc17,0xd4));var _0x7fc1=function(_0x5aea28,_0x41150a){_0x5aea28=_0x5aea28-0x0;var _0x5b0394=_0xfc17[_0x5aea28];return _0x5b0394;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fc1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fc1('0x1'));var rp=require(_0x7fc1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7fc1('0x3'));var path=require(_0x7fc1('0x4'));var sox=require(_0x7fc1('0x5'));var csv=require(_0x7fc1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fc1('0x7'));var _=require(_0x7fc1('0x8'));var squel=require(_0x7fc1('0x9'));var crypto=require('crypto');var jsforce=require(_0x7fc1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7fc1('0x6'));var querystring=require(_0x7fc1('0xb'));var Papa=require(_0x7fc1('0xc'));var Redis=require(_0x7fc1('0xd'));var authService=require(_0x7fc1('0xe'));var qs=require(_0x7fc1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc1('0x10'))(_0x7fc1('0x11'));var utils=require(_0x7fc1('0x12'));var config=require(_0x7fc1('0x13'));var licenseUtil=require(_0x7fc1('0x14'));var db=require(_0x7fc1('0x15'))['db'];config[_0x7fc1('0x16')]=_[_0x7fc1('0x17')](config['redis'],{'host':_0x7fc1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7fc1('0x19'))[_0x7fc1('0x1a')](socket);var jayson=require(_0x7fc1('0x1b'));var client=jayson[_0x7fc1('0x1c')][_0x7fc1('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x7fc1('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x8ca1d2,_0x2e2fbe,_0x2397f2,_0x66c2d5){return new BPromise(function(_0x309726,_0x3ff8c0){var _0x4171d3=_0x66c2d5||client;return _0x4171d3['request'](_0x8ca1d2,_0x2397f2)[_0x7fc1('0x1e')](function(_0xfebd48){logger[_0x7fc1('0x1f')](_0x7fc1('0x20'),_0x2e2fbe,_0x7fc1('0x21'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2e2fbe,'request\x20sent',JSON[_0x7fc1('0x22')](_0xfebd48));if(_0xfebd48[_0x7fc1('0x23')]){if(_0xfebd48[_0x7fc1('0x23')][_0x7fc1('0x24')]===0x1f4){logger[_0x7fc1('0x23')](_0x7fc1('0x20'),_0x2e2fbe,_0xfebd48[_0x7fc1('0x23')]['message']);return _0x3ff8c0(_0xfebd48[_0x7fc1('0x23')]['message']);}logger[_0x7fc1('0x23')](_0x7fc1('0x20'),_0x2e2fbe,_0xfebd48['error']['message']);return _0x309726(_0xfebd48['error'][_0x7fc1('0x25')]);}else{logger[_0x7fc1('0x1f')](_0x7fc1('0x20'),_0x2e2fbe,'request\x20sent');_0x309726(_0xfebd48[_0x7fc1('0x26')][_0x7fc1('0x25')]);}})[_0x7fc1('0x27')](function(_0x2e2d67){logger[_0x7fc1('0x23')]('FaxAccount,\x20%s,\x20%s',_0x2e2fbe,_0x2e2d67);_0x3ff8c0(_0x2e2d67);});});}function respondWithStatusCode(_0x218866,_0x51988d){_0x51988d=_0x51988d||0xcc;return function(_0x808f1b){if(_0x808f1b){return _0x218866[_0x7fc1('0x28')](_0x51988d);}return _0x218866[_0x7fc1('0x29')](_0x51988d)[_0x7fc1('0x2a')]();};}function respondWithResult(_0x241a2c,_0x5bb547){_0x5bb547=_0x5bb547||0xc8;return function(_0x432757){if(_0x432757){return _0x241a2c[_0x7fc1('0x29')](_0x5bb547)[_0x7fc1('0x2b')](_0x432757);}};}function respondWithFilteredResult(_0x4e3db1,_0x530784){return function(_0x37de23){if(_0x37de23){var _0x164949=typeof _0x530784[_0x7fc1('0x2c')]===_0x7fc1('0x2d')&&typeof _0x530784['limit']===_0x7fc1('0x2d');var _0x21fb31=_0x37de23[_0x7fc1('0x2e')];var _0x158906=_0x164949?0x0:_0x530784[_0x7fc1('0x2c')];var _0x5dfdb4=_0x164949?_0x37de23['count']:_0x530784[_0x7fc1('0x2c')]+_0x530784[_0x7fc1('0x2f')];var _0x35c297;if(_0x5dfdb4>=_0x21fb31){_0x5dfdb4=_0x21fb31;_0x35c297=0xc8;}else{_0x35c297=0xce;}_0x4e3db1[_0x7fc1('0x29')](_0x35c297);return _0x4e3db1['set'](_0x7fc1('0x30'),_0x158906+'-'+_0x5dfdb4+'/'+_0x21fb31)[_0x7fc1('0x2b')](_0x37de23);}return null;};}function patchUpdates(_0x41bc86){return function(_0x2a10d2){try{jsonpatch[_0x7fc1('0x31')](_0x2a10d2,_0x41bc86,!![]);}catch(_0x304ac1){return BPromise[_0x7fc1('0x32')](_0x304ac1);}return _0x2a10d2[_0x7fc1('0x33')]();};}function saveUpdates(_0x5c610c,_0x365b37){return function(_0x28917d){if(_0x28917d){return _0x28917d[_0x7fc1('0x34')](_0x5c610c)[_0x7fc1('0x1e')](function(_0x1389c2){return _0x1389c2;});}return null;};}function removeEntity(_0xf17c08,_0x3b30a2){return function(_0x407508){if(_0x407508){return _0x407508[_0x7fc1('0x35')]()[_0x7fc1('0x1e')](function(){var _0x3ee9a6=_0x407508[_0x7fc1('0x36')]({'plain':!![]});var _0x9a217c=_0x7fc1('0x37');return db[_0x7fc1('0x38')][_0x7fc1('0x35')]({'where':{'type':_0x9a217c,'resourceId':_0x3ee9a6['id']}})[_0x7fc1('0x1e')](function(){return _0x407508;});})[_0x7fc1('0x1e')](function(){_0xf17c08[_0x7fc1('0x29')](0xcc)[_0x7fc1('0x2a')]();});}};}function handleEntityNotFound(_0x2a7388,_0x55d863){return function(_0xd1ed8c){if(!_0xd1ed8c){_0x2a7388[_0x7fc1('0x28')](0x194);}return _0xd1ed8c;};}function handleError(_0x77dfef,_0x32bfb2){_0x32bfb2=_0x32bfb2||0x1f4;return function(_0x2a60ab){logger[_0x7fc1('0x23')](_0x2a60ab[_0x7fc1('0x39')]);if(_0x2a60ab[_0x7fc1('0x3a')]){delete _0x2a60ab['name'];}_0x77dfef['status'](_0x32bfb2)[_0x7fc1('0x3b')](_0x2a60ab);};}exports['index']=function(_0x56a26a,_0x2e49c1){var _0x49ce6e={'include':[{'model':db['Pause'],'as':_0x7fc1('0x3c')}]},_0x55b5a4={},_0x52db3d={'count':0x0,'rows':[]};var _0x3ec5c0=_[_0x7fc1('0x3d')](db[_0x7fc1('0x3e')][_0x7fc1('0x3f')],function(_0x26b103){return{'name':_0x26b103[_0x7fc1('0x40')],'type':_0x26b103['type'][_0x7fc1('0x41')]};});_0x55b5a4['model']=_[_0x7fc1('0x3d')](_0x3ec5c0,_0x7fc1('0x3a'));_0x55b5a4['query']=_['keys'](_0x56a26a['query']);_0x55b5a4[_0x7fc1('0x42')]=_[_0x7fc1('0x43')](_0x55b5a4['model'],_0x55b5a4[_0x7fc1('0x44')]);_0x49ce6e[_0x7fc1('0x45')]=_['intersection'](_0x55b5a4[_0x7fc1('0x46')],qs['fields'](_0x56a26a['query']['fields']));_0x49ce6e[_0x7fc1('0x45')]=_0x49ce6e[_0x7fc1('0x45')]['length']?_0x49ce6e['attributes']:_0x55b5a4['model'];if(!_0x56a26a[_0x7fc1('0x44')][_0x7fc1('0x47')](_0x7fc1('0x48'))){_0x49ce6e[_0x7fc1('0x2f')]=qs['limit'](_0x56a26a[_0x7fc1('0x44')][_0x7fc1('0x2f')]);_0x49ce6e[_0x7fc1('0x2c')]=qs[_0x7fc1('0x2c')](_0x56a26a[_0x7fc1('0x44')][_0x7fc1('0x2c')]);}_0x49ce6e[_0x7fc1('0x49')]=qs[_0x7fc1('0x4a')](_0x56a26a['query'][_0x7fc1('0x4a')]);_0x49ce6e[_0x7fc1('0x4b')]=qs[_0x7fc1('0x42')](_['pick'](_0x56a26a['query'],_0x55b5a4[_0x7fc1('0x42')]),_0x3ec5c0);if(_0x56a26a[_0x7fc1('0x44')]['filter']){_0x49ce6e[_0x7fc1('0x4b')]=_[_0x7fc1('0x4c')](_0x49ce6e['where'],{'$or':_[_0x7fc1('0x3d')](_0x3ec5c0,function(_0x2a33b5){if(_0x2a33b5['type']!==_0x7fc1('0x4d')){var _0x45d28b={};_0x45d28b[_0x2a33b5[_0x7fc1('0x3a')]]={'$like':'%'+_0x56a26a['query'][_0x7fc1('0x4e')]+'%'};return _0x45d28b;}})});}_0x49ce6e=_[_0x7fc1('0x4c')]({},_0x49ce6e,_0x56a26a['options']);var _0x153051={'where':_0x49ce6e[_0x7fc1('0x4b')]};return db['FaxAccount']['count'](_0x153051)['then'](function(_0x1806f3){_0x52db3d['count']=_0x1806f3;if(_0x56a26a[_0x7fc1('0x44')][_0x7fc1('0x4f')]){_0x49ce6e[_0x7fc1('0x50')]=[{'all':!![]}];}return db['FaxAccount'][_0x7fc1('0x51')](_0x49ce6e);})[_0x7fc1('0x1e')](function(_0x193748){_0x52db3d['rows']=_0x193748;return _0x52db3d;})[_0x7fc1('0x1e')](respondWithFilteredResult(_0x2e49c1,_0x49ce6e))[_0x7fc1('0x27')](handleError(_0x2e49c1,null));};exports[_0x7fc1('0x52')]=function(_0x45d1b6,_0x243555){var _0x265926={'raw':![],'where':{'id':_0x45d1b6['params']['id']},'include':[{'model':db[_0x7fc1('0x53')],'as':_0x7fc1('0x3c')}]},_0xe88140={};_0xe88140[_0x7fc1('0x46')]=_[_0x7fc1('0x54')](db[_0x7fc1('0x3e')][_0x7fc1('0x3f')]);_0xe88140[_0x7fc1('0x44')]=_[_0x7fc1('0x54')](_0x45d1b6[_0x7fc1('0x44')]);_0xe88140[_0x7fc1('0x42')]=_[_0x7fc1('0x43')](_0xe88140[_0x7fc1('0x46')],_0xe88140['query']);_0x265926[_0x7fc1('0x45')]=_['intersection'](_0xe88140['model'],qs[_0x7fc1('0x55')](_0x45d1b6[_0x7fc1('0x44')][_0x7fc1('0x55')]));_0x265926[_0x7fc1('0x45')]=_0x265926[_0x7fc1('0x45')][_0x7fc1('0x56')]?_0x265926['attributes']:_0xe88140['model'];if(_0x45d1b6[_0x7fc1('0x44')][_0x7fc1('0x4f')]){_0x265926[_0x7fc1('0x50')]=[{'all':!![]}];}_0x265926=_[_0x7fc1('0x4c')]({},_0x265926,_0x45d1b6[_0x7fc1('0x57')]);return db[_0x7fc1('0x3e')][_0x7fc1('0x58')](_0x265926)[_0x7fc1('0x1e')](handleEntityNotFound(_0x243555,null))[_0x7fc1('0x1e')](respondWithResult(_0x243555,null))[_0x7fc1('0x27')](handleError(_0x243555,null));};exports[_0x7fc1('0x59')]=function(_0x2f4006,_0x5988c8){return db[_0x7fc1('0x3e')][_0x7fc1('0x59')](_0x2f4006[_0x7fc1('0x5a')],{})[_0x7fc1('0x1e')](function(_0x1739d0){var _0x4931c8=_0x2f4006[_0x7fc1('0x5b')][_0x7fc1('0x36')]({'plain':!![]});if(!_0x4931c8)throw new Error(_0x7fc1('0x5c'));if(_0x4931c8['role']==='user'){var _0x11cd6b=_0x1739d0[_0x7fc1('0x36')]({'plain':!![]});var _0x3c791e=_0x7fc1('0x37');return db[_0x7fc1('0x5d')]['find']({'where':{'name':_0x3c791e,'userProfileId':_0x4931c8['userProfileId']},'raw':!![]})['then'](function(_0x160a2f){if(_0x160a2f&&_0x160a2f[_0x7fc1('0x5e')]===0x0){return db['UserProfileResource'][_0x7fc1('0x59')]({'name':_0x11cd6b[_0x7fc1('0x3a')],'resourceId':_0x11cd6b['id'],'type':_0x160a2f[_0x7fc1('0x3a')],'sectionId':_0x160a2f['id']},{})[_0x7fc1('0x1e')](function(){return _0x1739d0;});}else{return _0x1739d0;}})[_0x7fc1('0x27')](function(_0x5cb10e){logger[_0x7fc1('0x23')](_0x7fc1('0x5f'),_0x5cb10e);throw _0x5cb10e;});}return _0x1739d0;})[_0x7fc1('0x1e')](respondWithResult(_0x5988c8,0xc9))['catch'](handleError(_0x5988c8,null));};exports[_0x7fc1('0x34')]=function(_0x29ca95,_0x5643a4){if(_0x29ca95[_0x7fc1('0x5a')]['id']){delete _0x29ca95[_0x7fc1('0x5a')]['id'];}return db['FaxAccount'][_0x7fc1('0x58')]({'where':{'id':_0x29ca95[_0x7fc1('0x60')]['id']},'include':[{'model':db[_0x7fc1('0x53')],'as':_0x7fc1('0x3c')}]})[_0x7fc1('0x1e')](handleEntityNotFound(_0x5643a4,null))['then'](saveUpdates(_0x29ca95[_0x7fc1('0x5a')],null))[_0x7fc1('0x1e')](respondWithResult(_0x5643a4,null))['catch'](handleError(_0x5643a4,null));};exports['destroy']=function(_0x458609,_0x13d303){return db[_0x7fc1('0x3e')][_0x7fc1('0x58')]({'where':{'id':_0x458609[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x13d303,null))['then'](removeEntity(_0x13d303,null))[_0x7fc1('0x27')](handleError(_0x13d303,null));};exports[_0x7fc1('0x61')]=function(_0x3eb31f,_0x490407){return db[_0x7fc1('0x3e')][_0x7fc1('0x61')]()[_0x7fc1('0x1e')](respondWithResult(_0x490407,null))['catch'](handleError(_0x490407,null));};exports['addDisposition']=function(_0x4f7127,_0x176f7e,_0x4465c2){if(_0x4f7127[_0x7fc1('0x5a')]['id']){delete _0x4f7127[_0x7fc1('0x5a')]['id'];}return db['FaxAccount'][_0x7fc1('0x58')]({'where':{'id':_0x4f7127[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x176f7e,null))[_0x7fc1('0x1e')](function(_0x39a886){if(_0x39a886){_0x4f7127[_0x7fc1('0x5a')][_0x7fc1('0x62')]=_0x39a886['id'];return db[_0x7fc1('0x63')][_0x7fc1('0x59')](_0x4f7127[_0x7fc1('0x5a')]);}})[_0x7fc1('0x1e')](respondWithResult(_0x176f7e,null))[_0x7fc1('0x27')](handleError(_0x176f7e,null));};exports[_0x7fc1('0x64')]=function(_0x3dcc4f,_0x1c70b3,_0x212cff){var _0x1d06c6={'raw':![],'where':{}};var _0x469be0={};var _0x3f5aba={'count':0x0,'rows':[]};return db[_0x7fc1('0x3e')][_0x7fc1('0x65')]({'where':{'id':_0x3dcc4f['params']['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x1c70b3,null))[_0x7fc1('0x1e')](function(_0x5b27e6){if(_0x5b27e6){_0x469be0[_0x7fc1('0x46')]=_[_0x7fc1('0x54')](db[_0x7fc1('0x63')][_0x7fc1('0x3f')]);_0x469be0['query']=_[_0x7fc1('0x54')](_0x3dcc4f['query']);_0x469be0[_0x7fc1('0x42')]=_[_0x7fc1('0x43')](_0x469be0[_0x7fc1('0x46')],_0x469be0['query']);_0x1d06c6[_0x7fc1('0x45')]=_[_0x7fc1('0x43')](_0x469be0[_0x7fc1('0x46')],qs[_0x7fc1('0x55')](_0x3dcc4f['query'][_0x7fc1('0x55')]));_0x1d06c6[_0x7fc1('0x45')]=_0x1d06c6[_0x7fc1('0x45')]['length']?_0x1d06c6[_0x7fc1('0x45')]:_0x469be0[_0x7fc1('0x46')];if(!_0x3dcc4f[_0x7fc1('0x44')]['hasOwnProperty'](_0x7fc1('0x48'))){_0x1d06c6[_0x7fc1('0x2f')]=qs['limit'](_0x3dcc4f[_0x7fc1('0x44')]['limit']);_0x1d06c6[_0x7fc1('0x2c')]=qs[_0x7fc1('0x2c')](_0x3dcc4f[_0x7fc1('0x44')][_0x7fc1('0x2c')]);}_0x1d06c6[_0x7fc1('0x49')]=qs['sort'](_0x3dcc4f[_0x7fc1('0x44')][_0x7fc1('0x4a')]);_0x1d06c6[_0x7fc1('0x4b')]=qs[_0x7fc1('0x42')](_[_0x7fc1('0x66')](_0x3dcc4f[_0x7fc1('0x44')],_0x469be0['filters']));_0x1d06c6[_0x7fc1('0x4b')][_0x7fc1('0x62')]=_0x5b27e6['id'];if(_0x3dcc4f[_0x7fc1('0x44')][_0x7fc1('0x4e')]){_0x1d06c6['where']=_[_0x7fc1('0x4c')](_0x1d06c6[_0x7fc1('0x4b')],{'$or':_[_0x7fc1('0x3d')](_0x1d06c6['attributes'],function(_0x541486){var _0x47c4e={};_0x47c4e[_0x541486]={'$like':'%'+_0x3dcc4f[_0x7fc1('0x44')][_0x7fc1('0x4e')]+'%'};return _0x47c4e;})});}_0x1d06c6=_[_0x7fc1('0x4c')]({},_0x1d06c6,_0x3dcc4f[_0x7fc1('0x57')]);return db[_0x7fc1('0x63')][_0x7fc1('0x2e')]({'where':_0x1d06c6['where']})['then'](function(_0x5cf81a){_0x3f5aba[_0x7fc1('0x2e')]=_0x5cf81a;if(_0x3dcc4f[_0x7fc1('0x44')][_0x7fc1('0x4f')]){_0x1d06c6[_0x7fc1('0x50')]=[{'all':!![]}];}return db[_0x7fc1('0x63')][_0x7fc1('0x51')](_0x1d06c6);})[_0x7fc1('0x1e')](function(_0x75f1f9){_0x3f5aba[_0x7fc1('0x67')]=_0x75f1f9;return _0x3f5aba;});}})[_0x7fc1('0x1e')](respondWithFilteredResult(_0x1c70b3,_0x1d06c6))[_0x7fc1('0x27')](handleError(_0x1c70b3,null));};exports[_0x7fc1('0x68')]=function(_0x69d184,_0x2ea95a,_0x4c0dc0){return db['FaxAccount']['find']({'where':{'id':_0x69d184[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x2ea95a,null))[_0x7fc1('0x1e')](function(_0x1cf4f8){if(_0x1cf4f8){return _0x1cf4f8[_0x7fc1('0x68')](_0x69d184[_0x7fc1('0x44')][_0x7fc1('0x69')]);}})[_0x7fc1('0x1e')](respondWithStatusCode(_0x2ea95a,null))[_0x7fc1('0x27')](handleError(_0x2ea95a,null));};exports[_0x7fc1('0x6a')]=function(_0x2d48f4,_0x121916,_0x4731b7){if(_0x2d48f4[_0x7fc1('0x5a')]['id']){delete _0x2d48f4[_0x7fc1('0x5a')]['id'];}return db[_0x7fc1('0x3e')][_0x7fc1('0x58')]({'where':{'id':_0x2d48f4[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x121916,null))[_0x7fc1('0x1e')](function(_0xb5d410){if(_0xb5d410){_0x2d48f4[_0x7fc1('0x5a')]['FaxAccountId']=_0xb5d410['id'];return db[_0x7fc1('0x6b')][_0x7fc1('0x59')](_0x2d48f4[_0x7fc1('0x5a')]);}})[_0x7fc1('0x1e')](respondWithResult(_0x121916,null))[_0x7fc1('0x27')](handleError(_0x121916,null));};exports['getAnswers']=function(_0xfc696c,_0x4a195e,_0x3cbdc5){var _0x2bb979={'raw':![],'where':{}};var _0x2008be={};var _0x552264={'count':0x0,'rows':[]};return db[_0x7fc1('0x3e')][_0x7fc1('0x65')]({'where':{'id':_0xfc696c[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x4a195e,null))[_0x7fc1('0x1e')](function(_0x3d503f){if(_0x3d503f){_0x2008be[_0x7fc1('0x46')]=_[_0x7fc1('0x54')](db[_0x7fc1('0x6b')][_0x7fc1('0x3f')]);_0x2008be[_0x7fc1('0x44')]=_[_0x7fc1('0x54')](_0xfc696c['query']);_0x2008be[_0x7fc1('0x42')]=_[_0x7fc1('0x43')](_0x2008be[_0x7fc1('0x46')],_0x2008be['query']);_0x2bb979['attributes']=_['intersection'](_0x2008be['model'],qs['fields'](_0xfc696c[_0x7fc1('0x44')][_0x7fc1('0x55')]));_0x2bb979['attributes']=_0x2bb979[_0x7fc1('0x45')][_0x7fc1('0x56')]?_0x2bb979['attributes']:_0x2008be[_0x7fc1('0x46')];if(!_0xfc696c[_0x7fc1('0x44')][_0x7fc1('0x47')](_0x7fc1('0x48'))){_0x2bb979['limit']=qs[_0x7fc1('0x2f')](_0xfc696c[_0x7fc1('0x44')][_0x7fc1('0x2f')]);_0x2bb979[_0x7fc1('0x2c')]=qs[_0x7fc1('0x2c')](_0xfc696c[_0x7fc1('0x44')][_0x7fc1('0x2c')]);}_0x2bb979['order']=qs[_0x7fc1('0x4a')](_0xfc696c[_0x7fc1('0x44')][_0x7fc1('0x4a')]);_0x2bb979[_0x7fc1('0x4b')]=qs['filters'](_[_0x7fc1('0x66')](_0xfc696c['query'],_0x2008be['filters']));_0x2bb979[_0x7fc1('0x4b')]['FaxAccountId']=_0x3d503f['id'];if(_0xfc696c['query']['filter']){_0x2bb979[_0x7fc1('0x4b')]=_[_0x7fc1('0x4c')](_0x2bb979[_0x7fc1('0x4b')],{'$or':_[_0x7fc1('0x3d')](_0x2bb979[_0x7fc1('0x45')],function(_0x282dc8){var _0xbfebf3={};_0xbfebf3[_0x282dc8]={'$like':'%'+_0xfc696c[_0x7fc1('0x44')][_0x7fc1('0x4e')]+'%'};return _0xbfebf3;})});}_0x2bb979=_[_0x7fc1('0x4c')]({},_0x2bb979,_0xfc696c[_0x7fc1('0x57')]);return db['CannedAnswer'][_0x7fc1('0x2e')]({'where':_0x2bb979[_0x7fc1('0x4b')]})['then'](function(_0x1431ac){_0x552264[_0x7fc1('0x2e')]=_0x1431ac;if(_0xfc696c[_0x7fc1('0x44')]['includeAll']){_0x2bb979['include']=[{'all':!![]}];}return db[_0x7fc1('0x6b')][_0x7fc1('0x51')](_0x2bb979);})[_0x7fc1('0x1e')](function(_0x517e5c){_0x552264[_0x7fc1('0x67')]=_0x517e5c;return _0x552264;});}})['then'](respondWithFilteredResult(_0x4a195e,_0x2bb979))[_0x7fc1('0x27')](handleError(_0x4a195e,null));};exports[_0x7fc1('0x6c')]=function(_0x498350,_0x214c4c,_0x442b90){return db[_0x7fc1('0x3e')][_0x7fc1('0x58')]({'where':{'id':_0x498350[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x214c4c,null))[_0x7fc1('0x1e')](function(_0x2d2601){if(_0x2d2601){return _0x2d2601[_0x7fc1('0x6c')](_0x498350[_0x7fc1('0x44')][_0x7fc1('0x69')]);}})[_0x7fc1('0x1e')](respondWithStatusCode(_0x214c4c,null))[_0x7fc1('0x27')](handleError(_0x214c4c,null));};exports[_0x7fc1('0x6d')]=function(_0x227470,_0x52e18d,_0x8dd428){return db[_0x7fc1('0x6e')]['find']({'where':{'id':_0x227470[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x52e18d,null))[_0x7fc1('0x1e')](function(_0x4c6749){if(_0x4c6749){return _0x4c6749['addInteraction'](_0x227470[_0x7fc1('0x5a')][_0x7fc1('0x69')],_[_0x7fc1('0x6f')](_0x227470['body'],[_0x7fc1('0x69'),'id'])||{});}})[_0x7fc1('0x1e')](respondWithResult(_0x52e18d,null))[_0x7fc1('0x27')](handleError(_0x52e18d,null));};exports['getInteractions']=function(_0xb17a33,_0x1ae038,_0x1254c2){var _0x5d144c={'raw':![],'where':{}};var _0xe94ef0={};var _0x45ed44={'count':0x0,'rows':[]};return db[_0x7fc1('0x3e')][_0x7fc1('0x65')]({'where':{'id':_0xb17a33['params']['id']}})['then'](handleEntityNotFound(_0x1ae038,null))[_0x7fc1('0x1e')](function(_0x12ca7f){if(_0x12ca7f){_0xe94ef0[_0x7fc1('0x46')]=_['keys'](db['FaxInteraction'][_0x7fc1('0x3f')]);_0xe94ef0[_0x7fc1('0x44')]=_[_0x7fc1('0x54')](_0xb17a33[_0x7fc1('0x44')]);_0xe94ef0[_0x7fc1('0x42')]=_[_0x7fc1('0x43')](_0xe94ef0['model'],_0xe94ef0[_0x7fc1('0x44')]);_0x5d144c['attributes']=_[_0x7fc1('0x43')](_0xe94ef0[_0x7fc1('0x46')],qs[_0x7fc1('0x55')](_0xb17a33['query'][_0x7fc1('0x55')]));_0x5d144c['attributes']=_0x5d144c['attributes'][_0x7fc1('0x56')]?_0x5d144c[_0x7fc1('0x45')]:_0xe94ef0[_0x7fc1('0x46')];if(!_0xb17a33[_0x7fc1('0x44')][_0x7fc1('0x47')](_0x7fc1('0x48'))){_0x5d144c['limit']=qs[_0x7fc1('0x2f')](_0xb17a33[_0x7fc1('0x44')][_0x7fc1('0x2f')]);_0x5d144c[_0x7fc1('0x2c')]=qs['offset'](_0xb17a33[_0x7fc1('0x44')][_0x7fc1('0x2c')]);}_0x5d144c[_0x7fc1('0x49')]=qs[_0x7fc1('0x4a')](_0xb17a33['query'][_0x7fc1('0x4a')]);_0x5d144c['where']=qs[_0x7fc1('0x42')](_[_0x7fc1('0x66')](_0xb17a33[_0x7fc1('0x44')],_0xe94ef0[_0x7fc1('0x42')]));_0x5d144c['where'][_0x7fc1('0x62')]=_0x12ca7f['id'];if(_0xb17a33['query'][_0x7fc1('0x4e')]){_0x5d144c[_0x7fc1('0x4b')]=_['merge'](_0x5d144c[_0x7fc1('0x4b')],{'$or':_[_0x7fc1('0x3d')](_0x5d144c[_0x7fc1('0x45')],function(_0x404b32){var _0x14d3e4={};_0x14d3e4[_0x404b32]={'$like':'%'+_0xb17a33[_0x7fc1('0x44')][_0x7fc1('0x4e')]+'%'};return _0x14d3e4;})});}_0x5d144c=_[_0x7fc1('0x4c')]({},_0x5d144c,_0xb17a33[_0x7fc1('0x57')]);return db[_0x7fc1('0x6e')][_0x7fc1('0x2e')]({'where':_0x5d144c[_0x7fc1('0x4b')]})[_0x7fc1('0x1e')](function(_0x3a465c){_0x45ed44[_0x7fc1('0x2e')]=_0x3a465c;if(_0xb17a33['query'][_0x7fc1('0x4f')]){_0x5d144c[_0x7fc1('0x50')]=[{'model':db[_0x7fc1('0x70')],'as':_0x7fc1('0x71'),'required':![]},{'model':db[_0x7fc1('0x72')],'as':_0x7fc1('0x73'),'attributes':[_0x7fc1('0x3a'),_0x7fc1('0x74'),_0x7fc1('0x75')],'required':![]},{'model':db[_0x7fc1('0x76')],'as':_0x7fc1('0x77'),'attributes':['id',_0x7fc1('0x3a'),_0x7fc1('0x78')],'where':_0xb17a33[_0x7fc1('0x44')][_0x7fc1('0x79')]?{'id':_0xb17a33[_0x7fc1('0x44')][_0x7fc1('0x79')]}:undefined,'required':_0xb17a33[_0x7fc1('0x44')][_0x7fc1('0x79')]?!![]:![]}];}return db[_0x7fc1('0x6e')]['findAll'](_0x5d144c);})[_0x7fc1('0x1e')](function(_0x4f26a3){_0x45ed44[_0x7fc1('0x67')]=_0x4f26a3;return _0x45ed44;});}})[_0x7fc1('0x1e')](respondWithFilteredResult(_0x1ae038,_0x5d144c))[_0x7fc1('0x27')](handleError(_0x1ae038,null));};exports['addApplications']=function(_0x41c8a0,_0x7d29d0,_0x38401f){return db[_0x7fc1('0x3e')][_0x7fc1('0x65')]({'where':{'id':_0x41c8a0[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x7d29d0,null))[_0x7fc1('0x1e')](function(_0x3c32b1){if(_0x3c32b1){return db[_0x7fc1('0x7a')][_0x7fc1('0x7b')](function(_0x1918d9){return db[_0x7fc1('0x7c')][_0x7fc1('0x35')]({'where':{'FaxAccountId':_0x41c8a0[_0x7fc1('0x60')]['id']},'transaction':_0x1918d9})['then'](function(_0x1d31ed){var _0x440845=_['map'](_0x41c8a0['body'],function(_0xfb70c){_0xfb70c[_0x7fc1('0x62')]=_0x41c8a0[_0x7fc1('0x60')]['id'];return _0xfb70c;});return db['FaxApplication'][_0x7fc1('0x7d')](_0x440845,{'transaction':_0x1918d9});});})[_0x7fc1('0x1e')](function(){return db[_0x7fc1('0x7c')][_0x7fc1('0x7e')]({'where':{'FaxAccountId':_0x41c8a0[_0x7fc1('0x60')]['id']},'order':_0x7fc1('0x7f')});});}})[_0x7fc1('0x1e')](respondWithResult(_0x7d29d0,null))[_0x7fc1('0x27')](handleError(_0x7d29d0,null));};exports['getApplications']=function(_0x2965f7,_0x12783a,_0x5d94ca){var _0x37d67a={};var _0x32bf88={};var _0x2485fb;var _0x39714;return db[_0x7fc1('0x3e')][_0x7fc1('0x65')]({'where':{'id':_0x2965f7['params']['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x12783a,null))[_0x7fc1('0x1e')](function(_0x232b40){if(_0x232b40){_0x2485fb=_0x232b40;_0x32bf88[_0x7fc1('0x46')]=_[_0x7fc1('0x54')](db[_0x7fc1('0x7c')][_0x7fc1('0x3f')]);_0x32bf88[_0x7fc1('0x44')]=_[_0x7fc1('0x54')](_0x2965f7[_0x7fc1('0x44')]);_0x32bf88[_0x7fc1('0x42')]=_[_0x7fc1('0x43')](_0x32bf88['model'],_0x32bf88[_0x7fc1('0x44')]);_0x37d67a[_0x7fc1('0x45')]=_['intersection'](_0x32bf88[_0x7fc1('0x46')],qs[_0x7fc1('0x55')](_0x2965f7[_0x7fc1('0x44')][_0x7fc1('0x55')]));_0x37d67a[_0x7fc1('0x45')]=_0x37d67a['attributes'][_0x7fc1('0x56')]?_0x37d67a[_0x7fc1('0x45')]:_0x32bf88[_0x7fc1('0x46')];_0x37d67a[_0x7fc1('0x49')]=qs[_0x7fc1('0x4a')](_0x2965f7['query'][_0x7fc1('0x4a')]);_0x37d67a[_0x7fc1('0x4b')]=qs['filters'](_[_0x7fc1('0x66')](_0x2965f7[_0x7fc1('0x44')],_0x32bf88['filters']));if(_0x2965f7[_0x7fc1('0x44')][_0x7fc1('0x4e')]){_0x37d67a[_0x7fc1('0x4b')]=_[_0x7fc1('0x4c')](_0x37d67a[_0x7fc1('0x4b')],{'$or':_['map'](_0x37d67a['attributes'],function(_0x5aac63){var _0x294e36={};_0x294e36[_0x5aac63]={'$like':'%'+_0x2965f7[_0x7fc1('0x44')][_0x7fc1('0x4e')]+'%'};return _0x294e36;})});}_0x37d67a=_[_0x7fc1('0x4c')]({},_0x37d67a,_0x2965f7[_0x7fc1('0x57')]);return _0x2485fb[_0x7fc1('0x80')](_0x37d67a);}})[_0x7fc1('0x1e')](function(_0x5b70b8){if(_0x5b70b8){_0x39714=_0x5b70b8[_0x7fc1('0x56')];if(!_0x2965f7['query'][_0x7fc1('0x47')](_0x7fc1('0x48'))){_0x37d67a['limit']=qs[_0x7fc1('0x2f')](_0x2965f7['query'][_0x7fc1('0x2f')]);_0x37d67a['offset']=qs['offset'](_0x2965f7['query'][_0x7fc1('0x2c')]);}return _0x2485fb[_0x7fc1('0x80')](_0x37d67a);}})[_0x7fc1('0x1e')](function(_0x534056){if(_0x534056){return _0x534056?{'count':_0x39714,'rows':_0x534056}:null;}})['then'](respondWithResult(_0x12783a,null))[_0x7fc1('0x27')](handleError(_0x12783a,null));};function Extension(_0x1c10f0,_0x330b68,_0x16fa16,_0x469bc3){this['context']='from-voip-provider';this[_0x7fc1('0x81')]=_0x1c10f0['localstationid'];this[_0x7fc1('0x82')]=_0x469bc3;this[_0x7fc1('0x83')]=_0x7fc1('0x84');this[_0x7fc1('0x85')]=_0x7fc1('0x86');this[_0x7fc1('0x62')]=_0x1c10f0['id'];this[_0x7fc1('0x7f')]=_0x330b68;this['appdata']=_0x16fa16;}function createExtensionsReciveFax(_0x22fb49){var _0x330803=0x1;var _0x573289=[];_0x573289[_0x7fc1('0x87')](new Extension(_0x22fb49,_0x330803,'','Answer'));_0x330803+=0x1;_0x573289[_0x7fc1('0x87')](new Extension(_0x22fb49,_0x330803,'CDR(type)=inbound-fax',_0x7fc1('0x88')));_0x330803+=0x1;for(var _0x334d5b in _0x22fb49){if(_0x22fb49[_0x7fc1('0x47')](_0x334d5b)&&(_0x334d5b===_0x7fc1('0x89')||_0x334d5b===_0x7fc1('0x8a')||_0x334d5b==='gateway'||_0x334d5b===_0x7fc1('0x8b')||_0x334d5b===_0x7fc1('0x8c')||_0x334d5b==='maxrate'||_0x334d5b===_0x7fc1('0x8d')||_0x334d5b==='modem'||_0x334d5b===_0x7fc1('0x8e'))){_0x573289[_0x7fc1('0x87')](new Extension(_0x22fb49,_0x330803,_0x7fc1('0x8f')+_0x334d5b+')='+_0x22fb49[_0x334d5b],'Set'));_0x330803+=0x1;}}_0x573289['push'](new Extension(_0x22fb49,_0x330803,'6',_0x7fc1('0x90')));_0x330803+=0x1;_0x573289[_0x7fc1('0x87')](new Extension(_0x22fb49,_0x330803,'/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',_0x7fc1('0x91')));_0x330803=0x0;return _0x573289;}exports[_0x7fc1('0x92')]=function(_0x1b7ba2,_0x17a168,_0x512970){var _0x47fd25;return db[_0x7fc1('0x7a')]['transaction'](function(_0x108f21){return db['FaxAccount'][_0x7fc1('0x59')](_0x1b7ba2[_0x7fc1('0x5a')],{'transaction':_0x108f21})[_0x7fc1('0x1e')](function(_0x5e8b55){_0x47fd25=_0x5e8b55['get']({'plain':!![]});return db[_0x7fc1('0x93')][_0x7fc1('0x7d')](createExtensionsReciveFax(_0x47fd25),{'transaction':_0x108f21});});})['then'](function(){return _0x47fd25;})[_0x7fc1('0x1e')](respondWithResult(_0x17a168,null))[_0x7fc1('0x27')](handleError(_0x17a168,null));};exports[_0x7fc1('0x94')]=function(_0x3e8bd1,_0xa403f8,_0x3ca269){var _0x1dfc21;return db[_0x7fc1('0x7a')][_0x7fc1('0x7b')](function(_0x4cebb9){return db[_0x7fc1('0x3e')][_0x7fc1('0x34')](_0x3e8bd1['body'],{'where':{'id':_0x3e8bd1['body']['id']},'transaction':_0x4cebb9})[_0x7fc1('0x1e')](function(_0x4a2fa2){return db[_0x7fc1('0x93')][_0x7fc1('0x35')]({'where':{'FaxAccountId':_0x3e8bd1['body']['id']},'transaction':_0x4cebb9})['then'](function(_0x568cb3){return db[_0x7fc1('0x93')][_0x7fc1('0x7d')](createExtensionsReciveFax(_[_0x7fc1('0x6f')](_0x3e8bd1['body'],['tech','key',_0x7fc1('0x95'),_0x7fc1('0x96'),_0x7fc1('0x97'),_0x7fc1('0x98')])),{'transaction':_0x4cebb9});});});})[_0x7fc1('0x1e')](function(){return db[_0x7fc1('0x3e')]['findById'](_0x3e8bd1['body']['id']);})[_0x7fc1('0x1e')](respondWithResult(_0xa403f8,null))['catch'](handleError(_0xa403f8,null));};exports['getMessages']=function(_0x42aa42,_0x35d830,_0x47ded6){var _0x502b38={'raw':!![],'where':{}};var _0x599c6e={};var _0x42233c={'count':0x0,'rows':[]};return db[_0x7fc1('0x3e')]['findOne']({'where':{'id':_0x42aa42[_0x7fc1('0x60')]['id']}})['then'](handleEntityNotFound(_0x35d830,null))[_0x7fc1('0x1e')](function(_0x51dfab){if(_0x51dfab){_0x599c6e[_0x7fc1('0x46')]=_['keys'](db[_0x7fc1('0x99')][_0x7fc1('0x3f')]);_0x599c6e[_0x7fc1('0x44')]=_['keys'](_0x42aa42[_0x7fc1('0x44')]);_0x599c6e[_0x7fc1('0x42')]=_[_0x7fc1('0x43')](_0x599c6e[_0x7fc1('0x46')],_0x599c6e['query']);_0x502b38[_0x7fc1('0x45')]=_[_0x7fc1('0x43')](_0x599c6e[_0x7fc1('0x46')],qs[_0x7fc1('0x55')](_0x42aa42[_0x7fc1('0x44')][_0x7fc1('0x55')]));_0x502b38[_0x7fc1('0x45')]=_0x502b38[_0x7fc1('0x45')][_0x7fc1('0x56')]?_0x502b38['attributes']:_0x599c6e[_0x7fc1('0x46')];if(!_0x42aa42['query'][_0x7fc1('0x47')](_0x7fc1('0x48'))){_0x502b38[_0x7fc1('0x2f')]=qs[_0x7fc1('0x2f')](_0x42aa42[_0x7fc1('0x44')]['limit']);_0x502b38['offset']=qs[_0x7fc1('0x2c')](_0x42aa42[_0x7fc1('0x44')][_0x7fc1('0x2c')]);}_0x502b38[_0x7fc1('0x49')]=qs[_0x7fc1('0x4a')](_0x42aa42[_0x7fc1('0x44')][_0x7fc1('0x4a')]);_0x502b38[_0x7fc1('0x4b')]=qs[_0x7fc1('0x42')](_[_0x7fc1('0x66')](_0x42aa42['query'],_0x599c6e['filters']));_0x502b38['where'][_0x7fc1('0x62')]=_0x51dfab['id'];if(_0x42aa42[_0x7fc1('0x44')][_0x7fc1('0x4e')]){_0x502b38['where']=_[_0x7fc1('0x4c')](_0x502b38[_0x7fc1('0x4b')],{'$or':_[_0x7fc1('0x3d')](_0x502b38[_0x7fc1('0x45')],function(_0x28bb27){var _0x3b5938={};_0x3b5938[_0x28bb27]={'$like':'%'+_0x42aa42['query']['filter']+'%'};return _0x3b5938;})});}if(_0x42aa42[_0x7fc1('0x44')][_0x7fc1('0x9a')]){var _0x86a20f=_0x42aa42[_0x7fc1('0x44')][_0x7fc1('0x9a')]['split'](',');var _0x502ccc={};_0x502ccc[_0x86a20f[0x0]]={'$gte':moment(_0x86a20f[0x1])[_0x7fc1('0x9b')](_0x7fc1('0x9c'))};_0x502b38[_0x7fc1('0x4b')]=_[_0x7fc1('0x4c')](_0x502b38[_0x7fc1('0x4b')],_0x502ccc);}_0x502b38=_['merge']({},_0x502b38,_0x42aa42[_0x7fc1('0x57')]);return db['FaxMessage']['count']({'where':_0x502b38['where']})['then'](function(_0x36a651){_0x42233c[_0x7fc1('0x2e')]=_0x36a651;if(_0x42aa42[_0x7fc1('0x44')][_0x7fc1('0x4f')]){_0x502b38[_0x7fc1('0x50')]=[{'all':!![]}];}return db[_0x7fc1('0x99')][_0x7fc1('0x51')](_0x502b38);})[_0x7fc1('0x1e')](function(_0x2bcc94){_0x42233c[_0x7fc1('0x67')]=_0x2bcc94;return _0x42233c;});}})[_0x7fc1('0x1e')](respondWithFilteredResult(_0x35d830,_0x502b38))['catch'](handleError(_0x35d830,null));};exports[_0x7fc1('0x3b')]=function(_0xfad78b,_0x4032db,_0x16c13c){var _0x4dacc7,_0x1a7439={},_0x5a01fb;if(_0xfad78b[_0x7fc1('0x5a')]['to']){_0x5a01fb=_0xfad78b[_0x7fc1('0x5a')]['to'][0x0];}return db[_0x7fc1('0x3e')][_0x7fc1('0x58')]({'where':{'id':_0xfad78b['params']['id']},'include':[{'model':db[_0x7fc1('0x9d')],'as':_0x7fc1('0x9e'),'include':[{'model':db[_0x7fc1('0x70')],'as':'Contacts','where':{'fax':_0x5a01fb},'limit':0x1,'order':[[_0x7fc1('0x96'),'DESC']]}]}]})[_0x7fc1('0x1e')](handleEntityNotFound(_0x4032db,null))['then'](function(_0x36863c){_0x4dacc7=_0x36863c;if(_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')]&&_0xfad78b[_0x7fc1('0x5a')]['attachments']['length']){for(var _0x50f088=0x0;_0x50f088<_0xfad78b[_0x7fc1('0x5a')]['attachments'][_0x7fc1('0x56')];_0x50f088+=0x1){_0xfad78b['body'][_0x7fc1('0x9f')][_0x50f088]={'filename':_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')][_0x50f088][_0x7fc1('0x3a')],'id':_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')][_0x50f088]['id'],'path':path[_0x7fc1('0xa0')](config[_0x7fc1('0xa1')],_0x7fc1('0xa2'),_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')][_0x50f088][_0x7fc1('0xa3')])};}}return respondWithRpcPromise(_0x7fc1('0xa4'),_0x7fc1('0xa4'),{'FaxAccountId':_[_0x7fc1('0xa5')](_0xfad78b[_0x7fc1('0x60')]['id'])?undefined:_0xfad78b[_0x7fc1('0x60')]['id'],'path':_[_0x7fc1('0xa5')](_0xfad78b[_0x7fc1('0x5a')]['attachments'][0x0]['path'])?undefined:_0xfad78b['body'][_0x7fc1('0x9f')][0x0]['path'],'fax':_['isNil'](_0xfad78b[_0x7fc1('0x5a')]['to'][0x0])?undefined:_0xfad78b['body']['to'][0x0]},client9002);})[_0x7fc1('0x1e')](function(){if(_0x4dacc7){if(_[_0x7fc1('0xa5')](_0xfad78b['body'][_0x7fc1('0xa6')])){_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0xa6')]=util[_0x7fc1('0x9b')](_0x7fc1('0xa7'),_0x4dacc7[_0x7fc1('0x3a')],_0x4dacc7[_0x7fc1('0xa8')]);}if(_0x4dacc7[_0x7fc1('0x9e')]){if(_0x4dacc7[_0x7fc1('0x9e')][_0x7fc1('0xa9')][_0x7fc1('0x56')]){return _0x4dacc7[_0x7fc1('0x9e')][_0x7fc1('0xa9')][0x0];}else{return db['CmContact'][_0x7fc1('0x59')](_[_0x7fc1('0x17')](_0xfad78b[_0x7fc1('0x5a')],{'firstName':_0xfad78b[_0x7fc1('0x5a')]['to'][0x0],'phone':_0xfad78b[_0x7fc1('0x5a')]['to'][0x0],'fax':_0xfad78b[_0x7fc1('0x5a')]['to'][0x0],'ListId':_0x4dacc7[_0x7fc1('0x98')]}));}}else{throw new Error(_0x7fc1('0xaa'));}}else{throw new Error(_0x7fc1('0xab'));}})[_0x7fc1('0x1e')](function(_0x31890e){if(_0x31890e){return db[_0x7fc1('0x6e')][_0x7fc1('0x58')]({'where':{'ContactId':_0x31890e['id'],'closed':![],'FaxAccountId':_0x4dacc7['id']}})[_0x7fc1('0x1e')](function(_0x58c8c6){if(_0x58c8c6){return[_0x58c8c6,![]];}return db[_0x7fc1('0x6e')][_0x7fc1('0x59')]({'UserId':_0xfad78b['user']['id'],'ContactId':_0x31890e['id'],'FaxAccountId':_0x4dacc7['id'],'fax':_0xfad78b[_0x7fc1('0x5a')]['to'][0x0],'firstMsgDirection':_0x7fc1('0xac'),'Messages':[_['merge'](_0xfad78b[_0x7fc1('0x5a')],{'read':![],'body':_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')][0x0][_0x7fc1('0xad')],'FaxAccountId':_0x4dacc7['id'],'UserId':_0xfad78b[_0x7fc1('0x5b')]['id'],'ContactId':_0x31890e['id'],'AttachmentId':_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')][0x0]['id']})]},{'include':[{'model':db[_0x7fc1('0x99')],'as':_0x7fc1('0xae')}]})[_0x7fc1('0x1e')](function(_0x455cf9){return[_0x455cf9,!![]];});});}else{throw new Error(_0x7fc1('0xaf'));}})[_0x7fc1('0xb0')](function(_0x297882,_0x27884a){if(_0x27884a){return _0x297882;}return db[_0x7fc1('0x99')]['create']({'direction':_0x7fc1('0xac'),'read':![],'body':_0xfad78b['body'][_0x7fc1('0x9f')][0x0][_0x7fc1('0xad')],'FaxAccountId':_0x4dacc7['id'],'FaxInteractionId':_0x297882['id'],'UserId':_0xfad78b['user']['id'],'ContactId':_0x297882[_0x7fc1('0xb1')],'AttachmentId':_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')][0x0]['id']})[_0x7fc1('0x1e')](function(_0x19db7e){_0x297882[_0x7fc1('0xb2')][_0x7fc1('0xae')]=[];_0x297882['dataValues'][_0x7fc1('0xae')][_0x7fc1('0x87')](_0x19db7e[_0x7fc1('0xb2')]);return _0x297882;});})[_0x7fc1('0x1e')](function(_0x17ff0e){respondWithRpcPromise(_0x7fc1('0xb3'),_0x7fc1('0xb3'),{'FaxAccountId':_[_0x7fc1('0xa5')](_0xfad78b[_0x7fc1('0x60')]['id'])?undefined:_0xfad78b['params']['id'],'path':_[_0x7fc1('0xa5')](_0xfad78b[_0x7fc1('0x5a')]['attachments'][0x0]['path'])?undefined:_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')][0x0][_0x7fc1('0x4')],'fax':_[_0x7fc1('0xa5')](_0xfad78b[_0x7fc1('0x5a')]['to'][0x0])?undefined:_0xfad78b['body']['to'][0x0],'AttachmentId':_0xfad78b[_0x7fc1('0x5a')][_0x7fc1('0x9f')][0x0]['id']},client9002)[_0x7fc1('0x1e')](function(_0xe2ec32){logger[_0x7fc1('0x1f')](_0x7fc1('0xb4'),_0xe2ec32);})[_0x7fc1('0x27')](function(_0x3fe8c1){logger[_0x7fc1('0x1f')](_0x7fc1('0xb4'),_0x3fe8c1);});return _0x17ff0e;})[_0x7fc1('0x1e')](respondWithResult(_0x4032db,null))['catch'](handleError(_0x4032db,null));};exports[_0x7fc1('0xb5')]=function(_0x1c63e1,_0x513194,_0x3b5813){return db[_0x7fc1('0x3e')][_0x7fc1('0x58')]({'where':{'id':_0x1c63e1[_0x7fc1('0x60')]['id']}})['then'](handleEntityNotFound(_0x513194,null))[_0x7fc1('0x1e')](function(_0x437552){if(_0x437552){return _0x437552[_0x7fc1('0xb5')](_0x1c63e1[_0x7fc1('0x5a')][_0x7fc1('0x69')],_['omit'](_0x1c63e1['body'],[_0x7fc1('0x69'),'id'])||{})[_0x7fc1('0xb0')](function(_0x4e453d){for(var _0x23073f=0x0;_0x23073f<_0x1c63e1[_0x7fc1('0x5a')][_0x7fc1('0x69')]['length'];_0x23073f+=0x1){socket['emit'](_0x7fc1('0xb6'),{'UserId':_0x1c63e1[_0x7fc1('0x5a')][_0x7fc1('0x69')][_0x23073f],'FaxAccountId':_0x1c63e1['params']['id']});}return _0x4e453d;});}})[_0x7fc1('0x1e')](respondWithResult(_0x513194,null))[_0x7fc1('0x27')](handleError(_0x513194,null));};exports[_0x7fc1('0xb7')]=function(_0x1bf123,_0x5969e1,_0x143ea9){return db['FaxAccount']['find']({'where':{'id':_0x1bf123[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x5969e1,null))['then'](function(_0x58ebbc){if(_0x58ebbc){return _0x58ebbc[_0x7fc1('0xb7')](_0x1bf123[_0x7fc1('0x44')][_0x7fc1('0x69')])[_0x7fc1('0x1e')](function(){if(_[_0x7fc1('0xb8')](_0x1bf123[_0x7fc1('0x44')]['ids'])){for(var _0x3216c6=0x0;_0x3216c6<_0x1bf123[_0x7fc1('0x44')][_0x7fc1('0x69')]['length'];_0x3216c6+=0x1){socket[_0x7fc1('0xb9')](_0x7fc1('0xba'),{'UserId':Number(_0x1bf123['query'][_0x7fc1('0x69')][_0x3216c6]),'FaxAccountId':Number(_0x1bf123[_0x7fc1('0x60')]['id'])});}}else{socket[_0x7fc1('0xb9')](_0x7fc1('0xba'),{'UserId':Number(_0x1bf123[_0x7fc1('0x44')][_0x7fc1('0x69')]),'FaxAccountId':Number(_0x1bf123[_0x7fc1('0x60')]['id'])});}});}})[_0x7fc1('0x1e')](respondWithStatusCode(_0x5969e1,null))[_0x7fc1('0x27')](handleError(_0x5969e1,null));};exports[_0x7fc1('0xbb')]=function(_0x584564,_0x4b7774,_0x494fa7){var _0x4ab0cc={};var _0x3799e0={};var _0x268ea8;var _0xd4384f;return db['FaxAccount'][_0x7fc1('0x65')]({'where':{'id':_0x584564[_0x7fc1('0x60')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x4b7774,null))['then'](function(_0x3a158a){if(_0x3a158a){_0x268ea8=_0x3a158a;_0x3799e0[_0x7fc1('0x46')]=_[_0x7fc1('0x54')](db[_0x7fc1('0x72')][_0x7fc1('0x3f')]);_0x3799e0['query']=_['keys'](_0x584564[_0x7fc1('0x44')]);_0x3799e0[_0x7fc1('0x42')]=_[_0x7fc1('0x43')](_0x3799e0[_0x7fc1('0x46')],_0x3799e0[_0x7fc1('0x44')]);_0x4ab0cc[_0x7fc1('0x45')]=_[_0x7fc1('0x43')](_0x3799e0[_0x7fc1('0x46')],qs[_0x7fc1('0x55')](_0x584564[_0x7fc1('0x44')]['fields']));_0x4ab0cc[_0x7fc1('0x45')]=_0x4ab0cc['attributes'][_0x7fc1('0x56')]?_0x4ab0cc[_0x7fc1('0x45')]:_0x3799e0[_0x7fc1('0x46')];_0x4ab0cc[_0x7fc1('0x49')]=qs[_0x7fc1('0x4a')](_0x584564['query'][_0x7fc1('0x4a')]);_0x4ab0cc[_0x7fc1('0x4b')]=qs[_0x7fc1('0x42')](_[_0x7fc1('0x66')](_0x584564[_0x7fc1('0x44')],_0x3799e0[_0x7fc1('0x42')]));if(_0x584564[_0x7fc1('0x44')][_0x7fc1('0x4e')]){_0x4ab0cc[_0x7fc1('0x4b')]=_[_0x7fc1('0x4c')](_0x4ab0cc['where'],{'$or':_[_0x7fc1('0x3d')](_0x4ab0cc[_0x7fc1('0x45')],function(_0x7957e1){var _0x13e5e4={};_0x13e5e4[_0x7957e1]={'$like':'%'+_0x584564[_0x7fc1('0x44')][_0x7fc1('0x4e')]+'%'};return _0x13e5e4;})});}_0x4ab0cc=_['merge']({},_0x4ab0cc,_0x584564['options']);return _0x268ea8[_0x7fc1('0xbb')](_0x4ab0cc);}})[_0x7fc1('0x1e')](function(_0x228c10){if(_0x228c10){_0xd4384f=_0x228c10['length'];if(!_0x584564[_0x7fc1('0x44')]['hasOwnProperty'](_0x7fc1('0x48'))){_0x4ab0cc[_0x7fc1('0x2f')]=qs[_0x7fc1('0x2f')](_0x584564['query'][_0x7fc1('0x2f')]);_0x4ab0cc[_0x7fc1('0x2c')]=qs['offset'](_0x584564[_0x7fc1('0x44')]['offset']);}return _0x268ea8['getAgents'](_0x4ab0cc);}})[_0x7fc1('0x1e')](function(_0x41c097){if(_0x41c097){return _0x41c097?{'count':_0xd4384f,'rows':_0x41c097}:null;}})[_0x7fc1('0x1e')](respondWithResult(_0x4b7774,null))['catch'](handleError(_0x4b7774,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 30c3f3b..3fc17be 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 _0xad6b=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1ae48b,_0x14f335){var _0x24a0c6=function(_0x3cf4a0){while(--_0x3cf4a0){_0x1ae48b['push'](_0x1ae48b['shift']());}};_0x24a0c6(++_0x14f335);}(_0xad6b,0x1f0));var _0xbad6=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xad6b[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require(_0xbad6('0x0'));var FaxAccount=require(_0xbad6('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xbad6('0x2')](0x0);var events={'afterCreate':_0xbad6('0x3'),'afterUpdate':_0xbad6('0x4'),'afterDestroy':_0xbad6('0x5')};function emitEvent(_0x26e865){return function(_0x3cb8a9,_0x4d9cd3,_0x133c57){FaxAccountEvents[_0xbad6('0x6')](_0x26e865+':'+_0x3cb8a9['id'],_0x3cb8a9);FaxAccountEvents['emit'](_0x26e865,_0x3cb8a9);_0x133c57(null);};}for(var e in events){if(events[_0xbad6('0x7')](e)){var event=events[e];FaxAccount[_0xbad6('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xd3b0=['emit','exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xd3b0,0x1da));var _0x0d3b=function(_0x2568f2,_0x2c2833){_0x2568f2=_0x2568f2-0x0;var _0x5c0331=_0xd3b0[_0x2568f2];return _0x5c0331;};'use strict';var EventEmitter=require(_0x0d3b('0x0'));var FaxAccount=require(_0x0d3b('0x1'))['db'][_0x0d3b('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0d3b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d3b('0x4'),'afterDestroy':_0x0d3b('0x5')};function emitEvent(_0xae1520){return function(_0x3c72e6,_0x440416,_0x22e1bd){FaxAccountEvents[_0x0d3b('0x6')](_0xae1520+':'+_0x3c72e6['id'],_0x3c72e6);FaxAccountEvents[_0x0d3b('0x6')](_0xae1520,_0x3c72e6);_0x22e1bd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x0d3b('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c233933..0efa68b 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 _0x217b=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxAccount.attributes','FaxAccount','fax_accounts','lodash'];(function(_0x2c12b7,_0x5508f4){var _0x5f3224=function(_0x3f1a92){while(--_0x3f1a92){_0x2c12b7['push'](_0x2c12b7['shift']());}};_0x5f3224(++_0x5508f4);}(_0x217b,0x11d));var _0xb217=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x217b[_0x57d13b];return _0x467696;};'use strict';var _=require(_0xb217('0x0'));var util=require(_0xb217('0x1'));var logger=require(_0xb217('0x2'))(_0xb217('0x3'));var moment=require(_0xb217('0x4'));var BPromise=require(_0xb217('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb217('0x6'));var config=require(_0xb217('0x7'));var attributes=require(_0xb217('0x8'));module['exports']=function(_0x3fa8fb,_0x467c7c){return _0x3fa8fb['define'](_0xb217('0x9'),attributes,{'tableName':_0xb217('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x580b=['fax_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x3a756b,_0x261a19){var _0x20db56=function(_0x14f6fe){while(--_0x14f6fe){_0x3a756b['push'](_0x3a756b['shift']());}};_0x20db56(++_0x261a19);}(_0x580b,0x145));var _0xb580=function(_0x433aa3,_0x13ccab){_0x433aa3=_0x433aa3-0x0;var _0x31d7ca=_0x580b[_0x433aa3];return _0x31d7ca;};'use strict';var _=require(_0xb580('0x0'));var util=require(_0xb580('0x1'));var logger=require('../../config/logger')(_0xb580('0x2'));var moment=require(_0xb580('0x3'));var BPromise=require(_0xb580('0x4'));var rp=require(_0xb580('0x5'));var fs=require('fs');var path=require(_0xb580('0x6'));var rimraf=require('rimraf');var config=require(_0xb580('0x7'));var attributes=require(_0xb580('0x8'));module[_0xb580('0x9')]=function(_0xba1fa2,_0x3dbfd5){return _0xba1fa2[_0xb580('0xa')]('FaxAccount',attributes,{'tableName':_0xb580('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 3297adb..318d960 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 _0xcd41=['describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','CmContact','Contacts','DESC','FaxApplication','get','account','orderBy','applications','Applications','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','length','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FaxAccount','findAll','options','attributes','limit','include','map','model','GetFaxAccount','body','fax'];(function(_0x4a290d,_0x19b70b){var _0x4f7b5b=function(_0x3b994e){while(--_0x3b994e){_0x4a290d['push'](_0x4a290d['shift']());}};_0x4f7b5b(++_0x19b70b);}(_0xcd41,0x142));var _0x1cd4=function(_0x2b93da,_0x1aa1a0){_0x2b93da=_0x2b93da-0x0;var _0x10d473=_0xcd41[_0x2b93da];return _0x10d473;};'use strict';var _=require('lodash');var util=require(_0x1cd4('0x0'));var moment=require(_0x1cd4('0x1'));var BPromise=require(_0x1cd4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd4('0x3'));var db=require(_0x1cd4('0x4'))['db'];var utils=require(_0x1cd4('0x5'));var logger=require(_0x1cd4('0x6'))(_0x1cd4('0x7'));var config=require(_0x1cd4('0x8'));var jayson=require(_0x1cd4('0x9'));var client=jayson['client'][_0x1cd4('0xa')]({'port':0x232c});config[_0x1cd4('0xb')]=_[_0x1cd4('0xc')](config['redis'],{'host':_0x1cd4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1cd4('0xe'))[_0x1cd4('0xf')](socket);function respondWithRpcPromise(_0x351f36,_0x5e154d,_0x5f14bd){return new BPromise(function(_0x3274ee,_0x375863){return client['request'](_0x351f36,_0x5f14bd)[_0x1cd4('0x10')](function(_0x234d76){logger[_0x1cd4('0x11')](_0x1cd4('0x12'),_0x5e154d,'request\x20sent');logger[_0x1cd4('0x13')](_0x1cd4('0x14'),_0x5e154d,_0x1cd4('0x15'),JSON[_0x1cd4('0x16')](_0x234d76));if(_0x234d76['error']){if(_0x234d76[_0x1cd4('0x17')]['code']===0x1f4){logger[_0x1cd4('0x17')](_0x1cd4('0x12'),_0x5e154d,_0x234d76['error']['message']);return _0x375863(_0x234d76[_0x1cd4('0x17')][_0x1cd4('0x18')]);}logger[_0x1cd4('0x17')](_0x1cd4('0x12'),_0x5e154d,_0x234d76[_0x1cd4('0x17')][_0x1cd4('0x18')]);return _0x3274ee(_0x234d76[_0x1cd4('0x17')]['message']);}else{logger[_0x1cd4('0x11')](_0x1cd4('0x12'),_0x5e154d,'request\x20sent');_0x3274ee(_0x234d76[_0x1cd4('0x19')]['message']);}})[_0x1cd4('0x1a')](function(_0x4432c9){logger[_0x1cd4('0x17')]('FaxAccount,\x20%s,\x20%s',_0x5e154d,_0x4432c9);_0x375863(_0x4432c9);});});}exports['GetFaxAccount']=function(_0x4ebcd3){var _0x4a56ff=this;return new Promise(function(_0x420d43,_0x3a7c2b){return db[_0x1cd4('0x1b')][_0x1cd4('0x1c')]({'raw':_0x4ebcd3[_0x1cd4('0x1d')]?_0x4ebcd3[_0x1cd4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4ebcd3[_0x1cd4('0x1d')]?_0x4ebcd3[_0x1cd4('0x1d')]['where']||null:null,'attributes':_0x4ebcd3[_0x1cd4('0x1d')]?_0x4ebcd3['options'][_0x1cd4('0x1e')]||null:null,'limit':_0x4ebcd3['options']?_0x4ebcd3[_0x1cd4('0x1d')][_0x1cd4('0x1f')]||null:null,'include':_0x4ebcd3[_0x1cd4('0x1d')]?_0x4ebcd3[_0x1cd4('0x1d')][_0x1cd4('0x20')]?_[_0x1cd4('0x21')](_0x4ebcd3['options'][_0x1cd4('0x20')],function(_0x1f6dce){return{'model':db[_0x1f6dce[_0x1cd4('0x22')]],'as':_0x1f6dce['as'],'attributes':_0x1f6dce[_0x1cd4('0x1e')],'include':_0x1f6dce[_0x1cd4('0x20')]?_['map'](_0x1f6dce[_0x1cd4('0x20')],function(_0xb935b1){return{'model':db[_0xb935b1['model']],'as':_0xb935b1['as'],'attributes':_0xb935b1[_0x1cd4('0x1e')],'include':_0xb935b1[_0x1cd4('0x20')]?_['map'](_0xb935b1['include'],function(_0x508bb2){return{'model':db[_0x508bb2[_0x1cd4('0x22')]],'as':_0x508bb2['as'],'attributes':_0x508bb2[_0x1cd4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1cd4('0x10')](function(_0xce9c08){logger[_0x1cd4('0x11')](_0x1cd4('0x23'),_0x4ebcd3);logger[_0x1cd4('0x13')](_0x1cd4('0x23'),_0x4ebcd3,JSON[_0x1cd4('0x16')](_0xce9c08));_0x420d43(_0xce9c08);})['catch'](function(_0x2f7f7a){logger['error']('GetFaxAccount',_0x2f7f7a[_0x1cd4('0x18')],_0x4ebcd3);_0x3a7c2b(_0x4a56ff[_0x1cd4('0x17')](0x1f4,_0x2f7f7a['message']));});});};exports['NotifyFaxAccount']=function(_0x16d965,_0x1ef1e7,_0x52769b){var _0x54ae18=this;return new Promise(function(_0x472ef9,_0x189eb8){var _0x3235ea={'body':_0x16d965[_0x1cd4('0x24')],'channel':_0x1cd4('0x25')};var _0x4943cc=[];var _0x44274d=[];var _0xf04b36={};return db['CmContact'][_0x1cd4('0x26')]()[_0x1cd4('0x10')](function(_0x1e1879){if(!_0x1e1879){throw new db[(_0x1cd4('0x27'))][(_0x1cd4('0x28'))](_0x1cd4('0x29'));}_0x4943cc=_['difference'](_[_0x1cd4('0x2a')](_0x1e1879),[_0x1cd4('0x2b'),_0x1cd4('0x2c')]);_0x44274d=_[_0x1cd4('0x2d')](_[_0x1cd4('0x2a')](_0x1e1879),[_0x1cd4('0x2b'),_0x1cd4('0x2c'),'CompanyId',_0x1cd4('0x2e')]);if(_0x16d965[_0x1cd4('0x24')]['id']){delete _0x16d965[_0x1cd4('0x24')]['id'];}if(_[_0x1cd4('0x2f')](_0x16d965[_0x1cd4('0x24')][_0x1cd4('0x30')])){throw new db[(_0x1cd4('0x27'))][(_0x1cd4('0x28'))](_0x1cd4('0x31'));}if(_['isNil'](_0x16d965[_0x1cd4('0x24')][_0x1cd4('0x24')])||_0x16d965[_0x1cd4('0x24')][_0x1cd4('0x24')]===''){throw new db[(_0x1cd4('0x27'))][(_0x1cd4('0x28'))](_0x1cd4('0x32'));}if(_['isNil'](_0x16d965[_0x1cd4('0x24')][_0x1cd4('0x33')])){throw new db[(_0x1cd4('0x27'))]['ValidationError'](_0x1cd4('0x34')+_0x44274d);}if(!_[_0x1cd4('0x35')](_0x44274d,_0x16d965[_0x1cd4('0x24')][_0x1cd4('0x33')])){throw new db[(_0x1cd4('0x27'))][(_0x1cd4('0x28'))](_0x1cd4('0x36')+_0x44274d);}_0xf04b36[_0x16d965[_0x1cd4('0x24')][_0x1cd4('0x33')]]=_0x16d965[_0x1cd4('0x24')]['from'];})[_0x1cd4('0x10')](function(){return db['FaxAccount'][_0x1cd4('0x37')]({'where':{'id':_0x16d965['account']['id']},'include':[{'model':db[_0x1cd4('0x38')],'as':_0x1cd4('0x39'),'include':[{'model':db[_0x1cd4('0x3a')],'as':_0x1cd4('0x3b'),'where':_0xf04b36,'limit':0x1,'order':[[_0x1cd4('0x2c'),_0x1cd4('0x3c')]]}]},{'model':db[_0x1cd4('0x3d')],'as':'Applications'}]});})['then'](function(_0x5b08f8){if(_0x5b08f8&&_0x5b08f8[_0x1cd4('0x39')]){var _0x35b7b0=_0x5b08f8[_0x1cd4('0x3e')]({'plain':!![]});_0x3235ea[_0x1cd4('0x3f')]=_0x35b7b0;_0x3235ea['applications']=_0x35b7b0['Applications'];_0x3235ea['list']=_0x35b7b0[_0x1cd4('0x39')];_0x3235ea['applications']=_[_0x1cd4('0x40')](_0x3235ea[_0x1cd4('0x41')],['priority'],['asc']);if(_0x3235ea['account'][_0x1cd4('0x42')]){delete _0x3235ea[_0x1cd4('0x3f')][_0x1cd4('0x42')];}if(_0x3235ea[_0x1cd4('0x3f')]['List']&&_0x3235ea[_0x1cd4('0x3f')][_0x1cd4('0x39')]['Contacts']['length']){return _0x3235ea[_0x1cd4('0x3f')][_0x1cd4('0x39')][_0x1cd4('0x3b')][0x0];}var _0x44a627=_[_0x1cd4('0xc')](_0x16d965[_0x1cd4('0x24')],{'firstName':_0x16d965[_0x1cd4('0x24')][_0x1cd4('0x30')],'ListId':_0x35b7b0['ListId']});_0x44a627[_0x16d965[_0x1cd4('0x24')][_0x1cd4('0x33')]]=_0x16d965[_0x1cd4('0x24')]['from'];return db[_0x1cd4('0x3a')][_0x1cd4('0x43')](_0x44a627,{'fields':_0x4943cc,'raw':!![]});}})['then'](function(_0x5ee751){_0x3235ea[_0x1cd4('0x44')]=_0x5ee751;if(_0x5ee751){var _0x5d33dc={'ContactId':_0x5ee751['id'],'FaxAccountId':_0x16d965['account']['id'],'fax':_0x5ee751[_0x1cd4('0x25')]};return db[_0x1cd4('0x45')]['find']({'where':{'ContactId':_0x5ee751['id'],'closed':![],'FaxAccountId':_0x16d965[_0x1cd4('0x3f')]['id']}})['then'](function(_0x74e626){if(_0x74e626){return[_0x74e626,![]];}return db[_0x1cd4('0x45')][_0x1cd4('0x43')](_0x5d33dc)[_0x1cd4('0x10')](function(_0xddf165){return[_0xddf165,!![]];});});}else{throw new Error(_0x1cd4('0x46'));}})[_0x1cd4('0x47')](function(_0x18ceeb,_0x640ce6){var _0x5b0a91=_0x18ceeb[_0x1cd4('0x3e')]({'plain':!![]});if(_0x640ce6){if(_0x3235ea['account']['autoclose']){_0x3235ea[_0x1cd4('0x41')][_0x1cd4('0x48')]({'id':0x0,'priority':_0x3235ea[_0x1cd4('0x41')][_0x1cd4('0x49')]+0x1,'app':_0x1cd4('0x4a'),'appdata':_0x1cd4('0x4b'),'interval':_0x1cd4('0x4c')});}_0x5b0a91[_0x1cd4('0x4d')]=!![];}else{_0x5b0a91[_0x1cd4('0x4d')]=![];}_0x3235ea['interaction']=_0x5b0a91;return db[_0x1cd4('0x4e')][_0x1cd4('0x43')]({'body':_0x16d965['body'][_0x1cd4('0x24')],'FaxAccountId':_0x16d965[_0x1cd4('0x3f')]['id'],'FaxInteractionId':_0x18ceeb['id'],'direction':'in','ContactId':_0x18ceeb[_0x1cd4('0x4f')],'AttachmentId':_0x16d965['body'][_0x1cd4('0x50')]});})['then'](function(_0x160bc6){_0x3235ea[_0x1cd4('0x18')]=_0x160bc6;if(_0x3235ea[_0x1cd4('0x51')][_0x1cd4('0x52')]){return db[_0x1cd4('0x53')][_0x1cd4('0x37')]({'attributes':['id',_0x1cd4('0x54')],'where':{'id':_0x3235ea[_0x1cd4('0x51')][_0x1cd4('0x52')]}})['then'](function(_0x5af42c){if(_0x5af42c){_0x3235ea['applications'][_0x1cd4('0x55')]({'id':0x0,'priority':0x0,'app':_0x1cd4('0x56'),'appdata':_0x5af42c[_0x1cd4('0x54')]+','+(_0x3235ea[_0x1cd4('0x3f')][_0x1cd4('0x57')]||0xa),'interval':_0x1cd4('0x4c')});}return respondWithRpcPromise(_0x1cd4('0x58'),_0x1cd4('0x59'),_0x3235ea);});}return respondWithRpcPromise('Start','startRouting',_0x3235ea);})[_0x1cd4('0x10')](function(_0x3b6166){_0x472ef9(_0x3b6166);})[_0x1cd4('0x1a')](function(_0x2348f7){_0x189eb8(_0x54ae18[_0x1cd4('0x17')](0x1f4,_0x2348f7[_0x1cd4('0x18')]));});});}; \ No newline at end of file +var _0x5df5=['priority','asc','account','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','raw','options','attributes','limit','include','model','map','then','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','keys','createdAt','difference','updatedAt','CompanyId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x5df5,0x72));var _0x55df=function(_0x38176f,_0x2262f5){_0x38176f=_0x38176f-0x0;var _0xf2716=_0x5df5[_0x38176f];return _0xf2716;};'use strict';var _=require(_0x55df('0x0'));var util=require('util');var moment=require(_0x55df('0x1'));var BPromise=require(_0x55df('0x2'));var rs=require(_0x55df('0x3'));var fs=require('fs');var Redis=require(_0x55df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x55df('0x5'));var logger=require(_0x55df('0x6'))(_0x55df('0x7'));var config=require(_0x55df('0x8'));var jayson=require(_0x55df('0x9'));var client=jayson[_0x55df('0xa')][_0x55df('0xb')]({'port':0x232c});config['redis']=_[_0x55df('0xc')](config['redis'],{'host':_0x55df('0xd'),'port':0x18eb});var socket=require(_0x55df('0xe'))(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5571b2,_0x51f16c,_0x33e6f0){return new BPromise(function(_0x4676a9,_0x5778bc){return client[_0x55df('0xf')](_0x5571b2,_0x33e6f0)['then'](function(_0x408c9c){logger[_0x55df('0x10')](_0x55df('0x11'),_0x51f16c,_0x55df('0x12'));logger[_0x55df('0x13')](_0x55df('0x14'),_0x51f16c,_0x55df('0x12'),JSON['stringify'](_0x408c9c));if(_0x408c9c[_0x55df('0x15')]){if(_0x408c9c[_0x55df('0x15')][_0x55df('0x16')]===0x1f4){logger[_0x55df('0x15')](_0x55df('0x11'),_0x51f16c,_0x408c9c[_0x55df('0x15')][_0x55df('0x17')]);return _0x5778bc(_0x408c9c['error'][_0x55df('0x17')]);}logger['error'](_0x55df('0x11'),_0x51f16c,_0x408c9c[_0x55df('0x15')][_0x55df('0x17')]);return _0x4676a9(_0x408c9c[_0x55df('0x15')][_0x55df('0x17')]);}else{logger[_0x55df('0x10')](_0x55df('0x11'),_0x51f16c,_0x55df('0x12'));_0x4676a9(_0x408c9c[_0x55df('0x18')][_0x55df('0x17')]);}})[_0x55df('0x19')](function(_0x42dc12){logger[_0x55df('0x15')](_0x55df('0x11'),_0x51f16c,_0x42dc12);_0x5778bc(_0x42dc12);});});}exports[_0x55df('0x1a')]=function(_0x4835de){var _0x40796b=this;return new Promise(function(_0x17d6c6,_0x3eac32){return db[_0x55df('0x1b')][_0x55df('0x1c')]({'raw':_0x4835de['options']?_0x4835de['options'][_0x55df('0x1d')]===undefined?!![]:![]:!![],'where':_0x4835de[_0x55df('0x1e')]?_0x4835de[_0x55df('0x1e')]['where']||null:null,'attributes':_0x4835de['options']?_0x4835de[_0x55df('0x1e')][_0x55df('0x1f')]||null:null,'limit':_0x4835de[_0x55df('0x1e')]?_0x4835de[_0x55df('0x1e')][_0x55df('0x20')]||null:null,'include':_0x4835de[_0x55df('0x1e')]?_0x4835de[_0x55df('0x1e')][_0x55df('0x21')]?_['map'](_0x4835de[_0x55df('0x1e')][_0x55df('0x21')],function(_0x5f0a0c){return{'model':db[_0x5f0a0c[_0x55df('0x22')]],'as':_0x5f0a0c['as'],'attributes':_0x5f0a0c['attributes'],'include':_0x5f0a0c[_0x55df('0x21')]?_['map'](_0x5f0a0c['include'],function(_0x2d023e){return{'model':db[_0x2d023e[_0x55df('0x22')]],'as':_0x2d023e['as'],'attributes':_0x2d023e[_0x55df('0x1f')],'include':_0x2d023e['include']?_[_0x55df('0x23')](_0x2d023e[_0x55df('0x21')],function(_0x2c8d5c){return{'model':db[_0x2c8d5c[_0x55df('0x22')]],'as':_0x2c8d5c['as'],'attributes':_0x2c8d5c['attributes']};}):[]};}):[]};}):[]:[]})[_0x55df('0x24')](function(_0x199da5){logger[_0x55df('0x10')]('GetFaxAccount',_0x4835de);logger['debug']('GetFaxAccount',_0x4835de,JSON[_0x55df('0x25')](_0x199da5));_0x17d6c6(_0x199da5);})['catch'](function(_0x5948ef){logger['error'](_0x55df('0x1a'),_0x5948ef[_0x55df('0x17')],_0x4835de);_0x3eac32(_0x40796b['error'](0x1f4,_0x5948ef[_0x55df('0x17')]));});});};exports[_0x55df('0x26')]=function(_0x20fced,_0x3e14be,_0x24852f){var _0x1c7d09=this;return new Promise(function(_0x47d7da,_0x584255){var _0x504c9d={'body':_0x20fced['body'],'channel':_0x55df('0x27')};var _0x28712b=[];var _0x456f20=[];var _0x1d2355={};return db[_0x55df('0x28')][_0x55df('0x29')]()[_0x55df('0x24')](function(_0x41439f){if(!_0x41439f){throw new db[(_0x55df('0x2a'))][(_0x55df('0x2b'))]('no\x20available\x20attributes');}_0x28712b=_['difference'](_[_0x55df('0x2c')](_0x41439f),[_0x55df('0x2d'),'updatedAt']);_0x456f20=_[_0x55df('0x2e')](_[_0x55df('0x2c')](_0x41439f),[_0x55df('0x2d'),_0x55df('0x2f'),_0x55df('0x30'),'ListId']);if(_0x20fced[_0x55df('0x31')]['id']){delete _0x20fced[_0x55df('0x31')]['id'];}if(_[_0x55df('0x32')](_0x20fced[_0x55df('0x31')][_0x55df('0x33')])){throw new db[(_0x55df('0x2a'))][(_0x55df('0x2b'))](_0x55df('0x34'));}if(_[_0x55df('0x32')](_0x20fced[_0x55df('0x31')][_0x55df('0x31')])||_0x20fced[_0x55df('0x31')][_0x55df('0x31')]===''){throw new db[(_0x55df('0x2a'))]['ValidationError'](_0x55df('0x35'));}if(_[_0x55df('0x32')](_0x20fced[_0x55df('0x31')][_0x55df('0x36')])){throw new db[(_0x55df('0x2a'))]['ValidationError'](_0x55df('0x37')+_0x456f20);}if(!_[_0x55df('0x38')](_0x456f20,_0x20fced[_0x55df('0x31')][_0x55df('0x36')])){throw new db['Sequelize'][(_0x55df('0x2b'))](_0x55df('0x39')+_0x456f20);}_0x1d2355[_0x20fced[_0x55df('0x31')][_0x55df('0x36')]]=_0x20fced['body']['from'];})[_0x55df('0x24')](function(){return db[_0x55df('0x1b')][_0x55df('0x3a')]({'where':{'id':_0x20fced['account']['id']},'include':[{'model':db[_0x55df('0x3b')],'as':_0x55df('0x3c'),'include':[{'model':db[_0x55df('0x28')],'as':_0x55df('0x3d'),'where':_0x1d2355,'limit':0x1,'order':[['updatedAt',_0x55df('0x3e')]]}]},{'model':db[_0x55df('0x3f')],'as':_0x55df('0x40')}]});})[_0x55df('0x24')](function(_0x2f99f2){if(_0x2f99f2&&_0x2f99f2[_0x55df('0x3c')]){var _0x435554=_0x2f99f2[_0x55df('0x41')]({'plain':!![]});_0x504c9d['account']=_0x435554;_0x504c9d[_0x55df('0x42')]=_0x435554[_0x55df('0x40')];_0x504c9d['list']=_0x435554['List'];_0x504c9d[_0x55df('0x42')]=_[_0x55df('0x43')](_0x504c9d['applications'],[_0x55df('0x44')],[_0x55df('0x45')]);if(_0x504c9d['account'][_0x55df('0x40')]){delete _0x504c9d[_0x55df('0x46')][_0x55df('0x40')];}if(_0x504c9d[_0x55df('0x46')]['List']&&_0x504c9d[_0x55df('0x46')]['List'][_0x55df('0x3d')][_0x55df('0x47')]){return _0x504c9d[_0x55df('0x46')][_0x55df('0x3c')]['Contacts'][0x0];}var _0x477b03=_[_0x55df('0xc')](_0x20fced[_0x55df('0x31')],{'firstName':_0x20fced[_0x55df('0x31')]['from'],'ListId':_0x435554[_0x55df('0x48')]});_0x477b03[_0x20fced[_0x55df('0x31')][_0x55df('0x36')]]=_0x20fced[_0x55df('0x31')][_0x55df('0x33')];return db[_0x55df('0x28')][_0x55df('0x49')](_0x477b03,{'fields':_0x28712b,'raw':!![]});}})[_0x55df('0x24')](function(_0x53962d){_0x504c9d[_0x55df('0x4a')]=_0x53962d;if(_0x53962d){var _0x37e7ac={'ContactId':_0x53962d['id'],'FaxAccountId':_0x20fced[_0x55df('0x46')]['id'],'fax':_0x53962d['fax']};return db['FaxInteraction']['find']({'where':{'ContactId':_0x53962d['id'],'closed':![],'FaxAccountId':_0x20fced[_0x55df('0x46')]['id']}})[_0x55df('0x24')](function(_0x152d7a){if(_0x152d7a){return[_0x152d7a,![]];}return db[_0x55df('0x4b')][_0x55df('0x49')](_0x37e7ac)[_0x55df('0x24')](function(_0x56cb8e){return[_0x56cb8e,!![]];});});}else{throw new Error(_0x55df('0x4c'));}})['spread'](function(_0x590a20,_0x57d794){var _0x310369=_0x590a20[_0x55df('0x41')]({'plain':!![]});if(_0x57d794){if(_0x504c9d[_0x55df('0x46')][_0x55df('0x4d')]){_0x504c9d['applications']['push']({'id':0x0,'priority':_0x504c9d[_0x55df('0x42')][_0x55df('0x47')]+0x1,'app':'close','appdata':_0x55df('0x4e'),'interval':_0x55df('0x4f')});}_0x310369[_0x55df('0x50')]=!![];}else{_0x310369[_0x55df('0x50')]=![];}_0x504c9d['interaction']=_0x310369;return db[_0x55df('0x51')][_0x55df('0x49')]({'body':_0x20fced[_0x55df('0x31')][_0x55df('0x31')],'FaxAccountId':_0x20fced[_0x55df('0x46')]['id'],'FaxInteractionId':_0x590a20['id'],'direction':'in','ContactId':_0x590a20[_0x55df('0x52')],'AttachmentId':_0x20fced['body'][_0x55df('0x53')]});})[_0x55df('0x24')](function(_0x94e14c){_0x504c9d[_0x55df('0x17')]=_0x94e14c;if(_0x504c9d[_0x55df('0x54')]['UserId']){return db[_0x55df('0x55')]['find']({'attributes':['id',_0x55df('0x56')],'where':{'id':_0x504c9d[_0x55df('0x54')]['UserId']}})[_0x55df('0x24')](function(_0x3d4cf4){if(_0x3d4cf4){_0x504c9d[_0x55df('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x55df('0x57'),'appdata':_0x3d4cf4[_0x55df('0x56')]+','+(_0x504c9d[_0x55df('0x46')][_0x55df('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x55df('0x59'),_0x55df('0x5a'),_0x504c9d);});}return respondWithRpcPromise(_0x55df('0x59'),_0x55df('0x5a'),_0x504c9d);})[_0x55df('0x24')](function(_0x1dd2f8){_0x47d7da(_0x1dd2f8);})[_0x55df('0x19')](function(_0x3fe817){_0x584255(_0x1c7d09[_0x55df('0x15')](0x1f4,_0x3fe817['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 29e7210..253ca03 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 _0xffd6=['save','remove','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x23c02b,_0x411b4d){var _0x25efc5=function(_0x50e9e4){while(--_0x50e9e4){_0x23c02b['push'](_0x23c02b['shift']());}};_0x25efc5(++_0x411b4d);}(_0xffd6,0x97));var _0x6ffd=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xffd6[_0x5b27da];return _0x3254f4;};'use strict';var FaxAccountEvents=require(_0x6ffd('0x0'));var events=[_0x6ffd('0x1'),_0x6ffd('0x2'),'update'];function createListener(_0x589640,_0x305b6b){return function(_0x400c43){_0x305b6b[_0x6ffd('0x3')](_0x589640,_0x400c43);};}function removeListener(_0x560afa,_0x1d12e3){return function(){FaxAccountEvents[_0x6ffd('0x4')](_0x560afa,_0x1d12e3);};}exports[_0x6ffd('0x5')]=function(_0x2949a4){for(var _0x561055=0x0,_0x122b71=events[_0x6ffd('0x6')];_0x561055<_0x122b71;_0x561055++){var _0x2445a0=events[_0x561055];var _0x1fbbe6=createListener(_0x6ffd('0x7')+_0x2445a0,_0x2949a4);FaxAccountEvents['on'](_0x2445a0,_0x1fbbe6);}}; \ No newline at end of file +var _0x958a=['register','length','./faxAccount.events','save','update','emit'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x958a,0x128));var _0xa958=function(_0x2bda4a,_0x56c512){_0x2bda4a=_0x2bda4a-0x0;var _0x110633=_0x958a[_0x2bda4a];return _0x110633;};'use strict';var FaxAccountEvents=require(_0xa958('0x0'));var events=[_0xa958('0x1'),'remove',_0xa958('0x2')];function createListener(_0x24e669,_0xa48257){return function(_0x3079b4){_0xa48257[_0xa958('0x3')](_0x24e669,_0x3079b4);};}function removeListener(_0x5194f8,_0x3424b0){return function(){FaxAccountEvents['removeListener'](_0x5194f8,_0x3424b0);};}exports[_0xa958('0x4')]=function(_0x9b7d9e){for(var _0x2692d6=0x0,_0x3ddaa9=events[_0xa958('0x5')];_0x2692d6<_0x3ddaa9;_0x2692d6++){var _0x3b2693=events[_0x2692d6];var _0x1895da=createListener('faxAccount:'+_0x3b2693,_0x9b7d9e);FaxAccountEvents['on'](_0x3b2693,_0x1895da);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b2edee7..88e5bcb 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 _0x70b3=['/:id/dispositions','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','addAgents','put','/:id','delete','removeAnswers','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','create','post'];(function(_0x189dbd,_0x1d3cad){var _0x7861fb=function(_0x1a8738){while(--_0x1a8738){_0x189dbd['push'](_0x189dbd['shift']());}};_0x7861fb(++_0x1d3cad);}(_0x70b3,0x19c));var _0x370b=function(_0x1abf5e,_0x545344){_0x1abf5e=_0x1abf5e-0x0;var _0x489fb3=_0x70b3[_0x1abf5e];return _0x489fb3;};'use strict';var multer=require(_0x370b('0x0'));var util=require(_0x370b('0x1'));var path=require(_0x370b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x370b('0x3')]();var fs_extra=require(_0x370b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x370b('0x5'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x370b('0x6')]('/',auth[_0x370b('0x7')](),controller[_0x370b('0x8')]);router[_0x370b('0x6')]('/describe',auth[_0x370b('0x7')](),controller[_0x370b('0x9')]);router[_0x370b('0x6')]('/:id',auth[_0x370b('0x7')](),controller['show']);router[_0x370b('0x6')]('/:id/dispositions',auth[_0x370b('0x7')](),controller['getDispositions']);router[_0x370b('0x6')](_0x370b('0xa'),auth[_0x370b('0x7')](),controller[_0x370b('0xb')]);router[_0x370b('0x6')](_0x370b('0xc'),auth[_0x370b('0x7')](),controller['getInteractions']);router[_0x370b('0x6')](_0x370b('0xd'),auth[_0x370b('0x7')](),controller[_0x370b('0xe')]);router[_0x370b('0x6')](_0x370b('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x370b('0x6')](_0x370b('0x10'),auth['isAuthenticated'](),controller[_0x370b('0x11')]);router['post']('/',auth[_0x370b('0x7')](),controller[_0x370b('0x12')]);router[_0x370b('0x13')](_0x370b('0x14'),auth['isAuthenticated'](),controller[_0x370b('0x15')]);router['post'](_0x370b('0xa'),auth[_0x370b('0x7')](),controller[_0x370b('0x16')]);router['post']('/:id/interactions',auth[_0x370b('0x7')](),controller[_0x370b('0x17')]);router[_0x370b('0x13')](_0x370b('0xd'),auth[_0x370b('0x7')](),controller[_0x370b('0x18')]);router[_0x370b('0x13')](_0x370b('0x19'),auth['isAuthenticated'](),controller[_0x370b('0x1a')]);router[_0x370b('0x13')]('/updateaccountapplications',auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x370b('0x13')](_0x370b('0x1b'),auth[_0x370b('0x7')](),controller[_0x370b('0x1c')]);router[_0x370b('0x13')]('/:id/users',auth[_0x370b('0x7')](),controller[_0x370b('0x1d')]);router[_0x370b('0x1e')](_0x370b('0x1f'),auth[_0x370b('0x7')](),controller['update']);router[_0x370b('0x20')]('/:id',auth[_0x370b('0x7')](),controller['destroy']);router[_0x370b('0x20')](_0x370b('0x14'),auth[_0x370b('0x7')](),controller['removeDispositions']);router[_0x370b('0x20')]('/:id/canned_answers',auth[_0x370b('0x7')](),controller[_0x370b('0x21')]);router[_0x370b('0x20')](_0x370b('0x10'),auth[_0x370b('0x7')](),controller[_0x370b('0x22')]);module[_0x370b('0x23')]=router; \ No newline at end of file +var _0xa549=['getAnswers','/:id/interactions','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','getDispositions'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xa549,0x16a));var _0x9a54=function(_0x64a46c,_0x3b0e68){_0x64a46c=_0x64a46c-0x0;var _0x3d768f=_0xa549[_0x64a46c];return _0x3d768f;};'use strict';var multer=require(_0x9a54('0x0'));var util=require(_0x9a54('0x1'));var path=require(_0x9a54('0x2'));var timeout=require(_0x9a54('0x3'));var express=require(_0x9a54('0x4'));var router=express[_0x9a54('0x5')]();var fs_extra=require(_0x9a54('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9a54('0x7'));var config=require(_0x9a54('0x8'));var controller=require(_0x9a54('0x9'));router[_0x9a54('0xa')]('/',auth[_0x9a54('0xb')](),controller[_0x9a54('0xc')]);router[_0x9a54('0xa')](_0x9a54('0xd'),auth[_0x9a54('0xb')](),controller['describe']);router[_0x9a54('0xa')](_0x9a54('0xe'),auth[_0x9a54('0xb')](),controller['show']);router[_0x9a54('0xa')]('/:id/dispositions',auth[_0x9a54('0xb')](),controller[_0x9a54('0xf')]);router[_0x9a54('0xa')]('/:id/canned_answers',auth[_0x9a54('0xb')](),controller[_0x9a54('0x10')]);router[_0x9a54('0xa')](_0x9a54('0x11'),auth[_0x9a54('0xb')](),controller['getInteractions']);router['get']('/:id/applications',auth[_0x9a54('0xb')](),controller[_0x9a54('0x12')]);router[_0x9a54('0xa')](_0x9a54('0x13'),auth[_0x9a54('0xb')](),controller[_0x9a54('0x14')]);router[_0x9a54('0xa')](_0x9a54('0x15'),auth[_0x9a54('0xb')](),controller['getAgents']);router[_0x9a54('0x16')]('/',auth[_0x9a54('0xb')](),controller[_0x9a54('0x17')]);router['post']('/:id/dispositions',auth[_0x9a54('0xb')](),controller[_0x9a54('0x18')]);router['post'](_0x9a54('0x19'),auth[_0x9a54('0xb')](),controller[_0x9a54('0x1a')]);router[_0x9a54('0x16')](_0x9a54('0x11'),auth[_0x9a54('0xb')](),controller[_0x9a54('0x1b')]);router[_0x9a54('0x16')]('/:id/applications',auth[_0x9a54('0xb')](),controller['addApplications']);router[_0x9a54('0x16')](_0x9a54('0x1c'),auth['isAuthenticated'](),controller[_0x9a54('0x1d')]);router[_0x9a54('0x16')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x9a54('0x1e')]);router['post'](_0x9a54('0x1f'),auth[_0x9a54('0xb')](),controller[_0x9a54('0x20')]);router[_0x9a54('0x16')]('/:id/users',auth[_0x9a54('0xb')](),controller['addAgents']);router[_0x9a54('0x21')]('/:id',auth[_0x9a54('0xb')](),controller[_0x9a54('0x22')]);router[_0x9a54('0x23')](_0x9a54('0xe'),auth[_0x9a54('0xb')](),controller[_0x9a54('0x24')]);router[_0x9a54('0x23')](_0x9a54('0x25'),auth['isAuthenticated'](),controller[_0x9a54('0x26')]);router[_0x9a54('0x23')]('/:id/canned_answers',auth[_0x9a54('0xb')](),controller[_0x9a54('0x27')]);router['delete'](_0x9a54('0x15'),auth[_0x9a54('0xb')](),controller[_0x9a54('0x28')]);module[_0x9a54('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 df67c47..ef55b8b 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 _0xd98a=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd98a,0xfc));var _0xad98=function(_0x7206b8,_0x2212ff){_0x7206b8=_0x7206b8-0x0;var _0x46011e=_0xd98a[_0x7206b8];return _0x46011e;};'use strict';var Sequelize=require(_0xad98('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xad98('0x1')],'allowNull':![],'defaultValue':_0xad98('0x2')},'appdata':{'type':Sequelize[_0xad98('0x3')]()},'description':{'type':Sequelize[_0xad98('0x1')]},'interval':{'type':Sequelize[_0xad98('0x1')],'defaultValue':_0xad98('0x4')}}; \ No newline at end of file +var _0xd26f=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x30e6ec,_0x240a89){var _0x37f646=function(_0x363533){while(--_0x363533){_0x30e6ec['push'](_0x30e6ec['shift']());}};_0x37f646(++_0x240a89);}(_0xd26f,0x113));var _0xfd26=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd26f[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xfd26('0x0'));module[_0xfd26('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd26('0x2')},'appdata':{'type':Sequelize[_0xfd26('0x3')]()},'description':{'type':Sequelize[_0xfd26('0x4')]},'interval':{'type':Sequelize[_0xfd26('0x4')],'defaultValue':_0xfd26('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 61ca7f1..085c673 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 _0x1215=['keys','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','apply','reject','save','then','destroy','end','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params'];(function(_0x580a57,_0xe9121a){var _0x8a8a34=function(_0x45f167){while(--_0x45f167){_0x580a57['push'](_0x580a57['shift']());}};_0x8a8a34(++_0xe9121a);}(_0x1215,0x17d));var _0x5121=function(_0x35be1c,_0x45a7ef){_0x35be1c=_0x35be1c-0x0;var _0x1d99e1=_0x1215[_0x35be1c];return _0x1d99e1;};'use strict';var emlformat=require(_0x5121('0x0'));var rimraf=require(_0x5121('0x1'));var zipdir=require(_0x5121('0x2'));var jsonpatch=require(_0x5121('0x3'));var rp=require(_0x5121('0x4'));var moment=require(_0x5121('0x5'));var BPromise=require(_0x5121('0x6'));var Mustache=require('mustache');var util=require(_0x5121('0x7'));var path=require(_0x5121('0x8'));var sox=require(_0x5121('0x9'));var csv=require(_0x5121('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5121('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5121('0xc'));var jsforce=require(_0x5121('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5121('0xa'));var querystring=require('querystring');var Papa=require(_0x5121('0xe'));var Redis=require(_0x5121('0xf'));var authService=require(_0x5121('0x10'));var qs=require(_0x5121('0x11'));var as=require(_0x5121('0x12'));var hardwareService=require(_0x5121('0x13'));var logger=require(_0x5121('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5121('0x15'));var db=require(_0x5121('0x16'))['db'];function respondWithStatusCode(_0x50089f,_0x4dd7f1){_0x4dd7f1=_0x4dd7f1||0xcc;return function(_0x1ba5c1){if(_0x1ba5c1){return _0x50089f[_0x5121('0x17')](_0x4dd7f1);}return _0x50089f[_0x5121('0x18')](_0x4dd7f1)['end']();};}function respondWithResult(_0x53a507,_0x3ad98d){_0x3ad98d=_0x3ad98d||0xc8;return function(_0x399cf7){if(_0x399cf7){return _0x53a507[_0x5121('0x18')](_0x3ad98d)['json'](_0x399cf7);}};}function respondWithFilteredResult(_0x18d9df,_0x4f8584){return function(_0x49d031){if(_0x49d031){var _0x3ddf03=typeof _0x4f8584['offset']===_0x5121('0x19')&&typeof _0x4f8584[_0x5121('0x1a')]==='undefined';var _0x55524e=_0x49d031['count'];var _0x489a18=_0x3ddf03?0x0:_0x4f8584[_0x5121('0x1b')];var _0x7acd5b=_0x3ddf03?_0x49d031[_0x5121('0x1c')]:_0x4f8584[_0x5121('0x1b')]+_0x4f8584['limit'];var _0x556871;if(_0x7acd5b>=_0x55524e){_0x7acd5b=_0x55524e;_0x556871=0xc8;}else{_0x556871=0xce;}_0x18d9df[_0x5121('0x18')](_0x556871);return _0x18d9df['set']('Content-Range',_0x489a18+'-'+_0x7acd5b+'/'+_0x55524e)['json'](_0x49d031);}return null;};}function patchUpdates(_0x45f349){return function(_0x750281){try{jsonpatch[_0x5121('0x1d')](_0x750281,_0x45f349,!![]);}catch(_0x48414e){return BPromise[_0x5121('0x1e')](_0x48414e);}return _0x750281[_0x5121('0x1f')]();};}function saveUpdates(_0x24e123,_0x5bce43){return function(_0x34f280){if(_0x34f280){return _0x34f280['update'](_0x24e123)[_0x5121('0x20')](function(_0x25636f){return _0x25636f;});}return null;};}function removeEntity(_0x41660e,_0x3abd40){return function(_0x111d41){if(_0x111d41){return _0x111d41[_0x5121('0x21')]()['then'](function(){_0x41660e[_0x5121('0x18')](0xcc)[_0x5121('0x22')]();});}};}function handleEntityNotFound(_0x1f20fa,_0x19865e){return function(_0x56f677){if(!_0x56f677){_0x1f20fa[_0x5121('0x17')](0x194);}return _0x56f677;};}function handleError(_0x29cad2,_0x43b8f5){_0x43b8f5=_0x43b8f5||0x1f4;return function(_0x160207){logger[_0x5121('0x23')](_0x160207[_0x5121('0x24')]);if(_0x160207[_0x5121('0x25')]){delete _0x160207[_0x5121('0x25')];}_0x29cad2[_0x5121('0x18')](_0x43b8f5)[_0x5121('0x26')](_0x160207);};}exports[_0x5121('0x27')]=function(_0x15f920,_0x2f999b){var _0x413815={},_0x2eb108={},_0xb3a076={'count':0x0,'rows':[]};var _0x7888c1=_['map'](db[_0x5121('0x28')][_0x5121('0x29')],function(_0x32cb0b){return{'name':_0x32cb0b[_0x5121('0x2a')],'type':_0x32cb0b[_0x5121('0x2b')][_0x5121('0x2c')]};});_0x2eb108['model']=_[_0x5121('0x2d')](_0x7888c1,_0x5121('0x25'));_0x2eb108[_0x5121('0x2e')]=_['keys'](_0x15f920[_0x5121('0x2e')]);_0x2eb108[_0x5121('0x2f')]=_[_0x5121('0x30')](_0x2eb108['model'],_0x2eb108[_0x5121('0x2e')]);_0x413815['attributes']=_[_0x5121('0x30')](_0x2eb108[_0x5121('0x31')],qs[_0x5121('0x32')](_0x15f920[_0x5121('0x2e')][_0x5121('0x32')]));_0x413815[_0x5121('0x33')]=_0x413815[_0x5121('0x33')][_0x5121('0x34')]?_0x413815[_0x5121('0x33')]:_0x2eb108['model'];if(!_0x15f920['query'][_0x5121('0x35')](_0x5121('0x36'))){_0x413815[_0x5121('0x1a')]=qs[_0x5121('0x1a')](_0x15f920[_0x5121('0x2e')][_0x5121('0x1a')]);_0x413815[_0x5121('0x1b')]=qs[_0x5121('0x1b')](_0x15f920['query']['offset']);}_0x413815[_0x5121('0x37')]=qs[_0x5121('0x38')](_0x15f920[_0x5121('0x2e')][_0x5121('0x38')]);_0x413815['where']=qs[_0x5121('0x2f')](_[_0x5121('0x39')](_0x15f920[_0x5121('0x2e')],_0x2eb108[_0x5121('0x2f')]),_0x7888c1);if(_0x15f920[_0x5121('0x2e')][_0x5121('0x3a')]){_0x413815['where']=_[_0x5121('0x3b')](_0x413815[_0x5121('0x3c')],{'$or':_[_0x5121('0x2d')](_0x7888c1,function(_0x5c5a8a){if(_0x5c5a8a[_0x5121('0x2b')]!==_0x5121('0x3d')){var _0xda05b0={};_0xda05b0[_0x5c5a8a[_0x5121('0x25')]]={'$like':'%'+_0x15f920['query'][_0x5121('0x3a')]+'%'};return _0xda05b0;}})});}_0x413815=_[_0x5121('0x3b')]({},_0x413815,_0x15f920['options']);var _0x34d015={'where':_0x413815[_0x5121('0x3c')]};return db[_0x5121('0x28')][_0x5121('0x1c')](_0x34d015)[_0x5121('0x20')](function(_0x575912){_0xb3a076[_0x5121('0x1c')]=_0x575912;if(_0x15f920[_0x5121('0x2e')][_0x5121('0x3e')]){_0x413815[_0x5121('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x5121('0x40')](_0x413815);})['then'](function(_0x36ca53){_0xb3a076[_0x5121('0x41')]=_0x36ca53;return _0xb3a076;})['then'](respondWithFilteredResult(_0x2f999b,_0x413815))[_0x5121('0x42')](handleError(_0x2f999b,null));};exports[_0x5121('0x43')]=function(_0x5ac04a,_0x347d42){var _0x577c72={'raw':!![],'where':{'id':_0x5ac04a[_0x5121('0x44')]['id']}},_0x5e00ff={};_0x5e00ff[_0x5121('0x31')]=_[_0x5121('0x45')](db[_0x5121('0x28')][_0x5121('0x29')]);_0x5e00ff[_0x5121('0x2e')]=_[_0x5121('0x45')](_0x5ac04a[_0x5121('0x2e')]);_0x5e00ff[_0x5121('0x2f')]=_[_0x5121('0x30')](_0x5e00ff[_0x5121('0x31')],_0x5e00ff[_0x5121('0x2e')]);_0x577c72[_0x5121('0x33')]=_['intersection'](_0x5e00ff[_0x5121('0x31')],qs['fields'](_0x5ac04a[_0x5121('0x2e')][_0x5121('0x32')]));_0x577c72['attributes']=_0x577c72['attributes'][_0x5121('0x34')]?_0x577c72[_0x5121('0x33')]:_0x5e00ff[_0x5121('0x31')];if(_0x5ac04a[_0x5121('0x2e')][_0x5121('0x3e')]){_0x577c72[_0x5121('0x3f')]=[{'all':!![]}];}_0x577c72=_[_0x5121('0x3b')]({},_0x577c72,_0x5ac04a[_0x5121('0x46')]);return db[_0x5121('0x28')][_0x5121('0x47')](_0x577c72)[_0x5121('0x20')](handleEntityNotFound(_0x347d42,null))[_0x5121('0x20')](respondWithResult(_0x347d42,null))[_0x5121('0x42')](handleError(_0x347d42,null));};exports['create']=function(_0x2c2d82,_0x3c91d8){return db['FaxApplication'][_0x5121('0x48')](_0x2c2d82[_0x5121('0x49')],{})[_0x5121('0x20')](respondWithResult(_0x3c91d8,0xc9))[_0x5121('0x42')](handleError(_0x3c91d8,null));};exports[_0x5121('0x4a')]=function(_0xacd4fb,_0x9b0956){if(_0xacd4fb[_0x5121('0x49')]['id']){delete _0xacd4fb[_0x5121('0x49')]['id'];}return db[_0x5121('0x28')][_0x5121('0x47')]({'where':{'id':_0xacd4fb[_0x5121('0x44')]['id']}})['then'](handleEntityNotFound(_0x9b0956,null))[_0x5121('0x20')](saveUpdates(_0xacd4fb[_0x5121('0x49')],null))['then'](respondWithResult(_0x9b0956,null))[_0x5121('0x42')](handleError(_0x9b0956,null));};exports[_0x5121('0x21')]=function(_0x21c6d1,_0x16d151){return db[_0x5121('0x28')][_0x5121('0x47')]({'where':{'id':_0x21c6d1[_0x5121('0x44')]['id']}})[_0x5121('0x20')](handleEntityNotFound(_0x16d151,null))[_0x5121('0x20')](removeEntity(_0x16d151,null))[_0x5121('0x42')](handleError(_0x16d151,null));}; \ No newline at end of file +var _0x6d15=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','FaxApplication','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','merge','options','find','create','params','body','eml-format','rimraf','zip-dir'];(function(_0x146044,_0x1398eb){var _0x15855c=function(_0x557a3c){while(--_0x557a3c){_0x146044['push'](_0x146044['shift']());}};_0x15855c(++_0x1398eb);}(_0x6d15,0x1c5));var _0x56d1=function(_0x469f30,_0x1c9d41){_0x469f30=_0x469f30-0x0;var _0x5b131d=_0x6d15[_0x469f30];return _0x5b131d;};'use strict';var emlformat=require(_0x56d1('0x0'));var rimraf=require(_0x56d1('0x1'));var zipdir=require(_0x56d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56d1('0x3'));var moment=require(_0x56d1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x56d1('0x5'));var util=require(_0x56d1('0x6'));var path=require(_0x56d1('0x7'));var sox=require(_0x56d1('0x8'));var csv=require(_0x56d1('0x9'));var ejs=require(_0x56d1('0xa'));var fs=require('fs');var fs_extra=require(_0x56d1('0xb'));var _=require(_0x56d1('0xc'));var squel=require(_0x56d1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x56d1('0x9'));var querystring=require(_0x56d1('0xe'));var Papa=require(_0x56d1('0xf'));var Redis=require('ioredis');var authService=require(_0x56d1('0x10'));var qs=require(_0x56d1('0x11'));var as=require(_0x56d1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56d1('0x13'))('api');var utils=require(_0x56d1('0x14'));var config=require(_0x56d1('0x15'));var licenseUtil=require(_0x56d1('0x16'));var db=require(_0x56d1('0x17'))['db'];function respondWithStatusCode(_0x9262ca,_0x36b69f){_0x36b69f=_0x36b69f||0xcc;return function(_0xe5e264){if(_0xe5e264){return _0x9262ca['sendStatus'](_0x36b69f);}return _0x9262ca[_0x56d1('0x18')](_0x36b69f)[_0x56d1('0x19')]();};}function respondWithResult(_0x4f9358,_0x236143){_0x236143=_0x236143||0xc8;return function(_0x2ea9b3){if(_0x2ea9b3){return _0x4f9358[_0x56d1('0x18')](_0x236143)[_0x56d1('0x1a')](_0x2ea9b3);}};}function respondWithFilteredResult(_0x1a020e,_0x566e7d){return function(_0x1d0667){if(_0x1d0667){var _0x410c4f=typeof _0x566e7d[_0x56d1('0x1b')]==='undefined'&&typeof _0x566e7d[_0x56d1('0x1c')]===_0x56d1('0x1d');var _0x32888f=_0x1d0667[_0x56d1('0x1e')];var _0x9cf716=_0x410c4f?0x0:_0x566e7d[_0x56d1('0x1b')];var _0x5b2306=_0x410c4f?_0x1d0667[_0x56d1('0x1e')]:_0x566e7d[_0x56d1('0x1b')]+_0x566e7d['limit'];var _0x47c031;if(_0x5b2306>=_0x32888f){_0x5b2306=_0x32888f;_0x47c031=0xc8;}else{_0x47c031=0xce;}_0x1a020e[_0x56d1('0x18')](_0x47c031);return _0x1a020e[_0x56d1('0x1f')]('Content-Range',_0x9cf716+'-'+_0x5b2306+'/'+_0x32888f)[_0x56d1('0x1a')](_0x1d0667);}return null;};}function patchUpdates(_0xefa11f){return function(_0x17ecf9){try{jsonpatch[_0x56d1('0x20')](_0x17ecf9,_0xefa11f,!![]);}catch(_0x9eef8){return BPromise[_0x56d1('0x21')](_0x9eef8);}return _0x17ecf9[_0x56d1('0x22')]();};}function saveUpdates(_0x1ccc78,_0x23ebbe){return function(_0x5ea517){if(_0x5ea517){return _0x5ea517[_0x56d1('0x23')](_0x1ccc78)[_0x56d1('0x24')](function(_0x392717){return _0x392717;});}return null;};}function removeEntity(_0x43d246,_0x58e665){return function(_0x4f6013){if(_0x4f6013){return _0x4f6013[_0x56d1('0x25')]()[_0x56d1('0x24')](function(){_0x43d246[_0x56d1('0x18')](0xcc)[_0x56d1('0x19')]();});}};}function handleEntityNotFound(_0x17af07,_0x11bc6f){return function(_0x59743e){if(!_0x59743e){_0x17af07[_0x56d1('0x26')](0x194);}return _0x59743e;};}function handleError(_0x340891,_0x56cef8){_0x56cef8=_0x56cef8||0x1f4;return function(_0xe661c2){logger[_0x56d1('0x27')](_0xe661c2[_0x56d1('0x28')]);if(_0xe661c2[_0x56d1('0x29')]){delete _0xe661c2[_0x56d1('0x29')];}_0x340891[_0x56d1('0x18')](_0x56cef8)['send'](_0xe661c2);};}exports[_0x56d1('0x2a')]=function(_0x236d4a,_0x3fc3fb){var _0x30347c={},_0x45facb={},_0x1accd0={'count':0x0,'rows':[]};var _0x571f9c=_[_0x56d1('0x2b')](db[_0x56d1('0x2c')][_0x56d1('0x2d')],function(_0xe442ad){return{'name':_0xe442ad['fieldName'],'type':_0xe442ad[_0x56d1('0x2e')][_0x56d1('0x2f')]};});_0x45facb['model']=_[_0x56d1('0x2b')](_0x571f9c,_0x56d1('0x29'));_0x45facb[_0x56d1('0x30')]=_[_0x56d1('0x31')](_0x236d4a[_0x56d1('0x30')]);_0x45facb['filters']=_[_0x56d1('0x32')](_0x45facb['model'],_0x45facb[_0x56d1('0x30')]);_0x30347c[_0x56d1('0x33')]=_[_0x56d1('0x32')](_0x45facb[_0x56d1('0x34')],qs[_0x56d1('0x35')](_0x236d4a['query'][_0x56d1('0x35')]));_0x30347c[_0x56d1('0x33')]=_0x30347c[_0x56d1('0x33')][_0x56d1('0x36')]?_0x30347c[_0x56d1('0x33')]:_0x45facb[_0x56d1('0x34')];if(!_0x236d4a[_0x56d1('0x30')][_0x56d1('0x37')](_0x56d1('0x38'))){_0x30347c[_0x56d1('0x1c')]=qs[_0x56d1('0x1c')](_0x236d4a[_0x56d1('0x30')][_0x56d1('0x1c')]);_0x30347c[_0x56d1('0x1b')]=qs[_0x56d1('0x1b')](_0x236d4a[_0x56d1('0x30')][_0x56d1('0x1b')]);}_0x30347c[_0x56d1('0x39')]=qs[_0x56d1('0x3a')](_0x236d4a['query'][_0x56d1('0x3a')]);_0x30347c[_0x56d1('0x3b')]=qs[_0x56d1('0x3c')](_[_0x56d1('0x3d')](_0x236d4a['query'],_0x45facb['filters']),_0x571f9c);if(_0x236d4a['query'][_0x56d1('0x3e')]){_0x30347c[_0x56d1('0x3b')]=_['merge'](_0x30347c[_0x56d1('0x3b')],{'$or':_['map'](_0x571f9c,function(_0x35848){if(_0x35848[_0x56d1('0x2e')]!==_0x56d1('0x3f')){var _0x449afd={};_0x449afd[_0x35848['name']]={'$like':'%'+_0x236d4a[_0x56d1('0x30')][_0x56d1('0x3e')]+'%'};return _0x449afd;}})});}_0x30347c=_['merge']({},_0x30347c,_0x236d4a['options']);var _0x389e59={'where':_0x30347c[_0x56d1('0x3b')]};return db[_0x56d1('0x2c')]['count'](_0x389e59)[_0x56d1('0x24')](function(_0x2dc5d6){_0x1accd0[_0x56d1('0x1e')]=_0x2dc5d6;if(_0x236d4a['query'][_0x56d1('0x40')]){_0x30347c[_0x56d1('0x41')]=[{'all':!![]}];}return db[_0x56d1('0x2c')][_0x56d1('0x42')](_0x30347c);})[_0x56d1('0x24')](function(_0x23a377){_0x1accd0[_0x56d1('0x43')]=_0x23a377;return _0x1accd0;})[_0x56d1('0x24')](respondWithFilteredResult(_0x3fc3fb,_0x30347c))[_0x56d1('0x44')](handleError(_0x3fc3fb,null));};exports[_0x56d1('0x45')]=function(_0x38da23,_0x368968){var _0x35af27={'raw':!![],'where':{'id':_0x38da23['params']['id']}},_0x8b1da2={};_0x8b1da2['model']=_[_0x56d1('0x31')](db[_0x56d1('0x2c')][_0x56d1('0x2d')]);_0x8b1da2[_0x56d1('0x30')]=_[_0x56d1('0x31')](_0x38da23[_0x56d1('0x30')]);_0x8b1da2['filters']=_[_0x56d1('0x32')](_0x8b1da2[_0x56d1('0x34')],_0x8b1da2[_0x56d1('0x30')]);_0x35af27[_0x56d1('0x33')]=_[_0x56d1('0x32')](_0x8b1da2[_0x56d1('0x34')],qs[_0x56d1('0x35')](_0x38da23['query'][_0x56d1('0x35')]));_0x35af27[_0x56d1('0x33')]=_0x35af27[_0x56d1('0x33')][_0x56d1('0x36')]?_0x35af27[_0x56d1('0x33')]:_0x8b1da2['model'];if(_0x38da23[_0x56d1('0x30')][_0x56d1('0x40')]){_0x35af27[_0x56d1('0x41')]=[{'all':!![]}];}_0x35af27=_[_0x56d1('0x46')]({},_0x35af27,_0x38da23[_0x56d1('0x47')]);return db[_0x56d1('0x2c')][_0x56d1('0x48')](_0x35af27)['then'](handleEntityNotFound(_0x368968,null))[_0x56d1('0x24')](respondWithResult(_0x368968,null))[_0x56d1('0x44')](handleError(_0x368968,null));};exports[_0x56d1('0x49')]=function(_0x1e71bd,_0x11fcd2){return db['FaxApplication'][_0x56d1('0x49')](_0x1e71bd['body'],{})[_0x56d1('0x24')](respondWithResult(_0x11fcd2,0xc9))[_0x56d1('0x44')](handleError(_0x11fcd2,null));};exports[_0x56d1('0x23')]=function(_0x1eec71,_0x26f8fc){if(_0x1eec71['body']['id']){delete _0x1eec71['body']['id'];}return db[_0x56d1('0x2c')][_0x56d1('0x48')]({'where':{'id':_0x1eec71[_0x56d1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26f8fc,null))[_0x56d1('0x24')](saveUpdates(_0x1eec71[_0x56d1('0x4b')],null))['then'](respondWithResult(_0x26f8fc,null))[_0x56d1('0x44')](handleError(_0x26f8fc,null));};exports[_0x56d1('0x25')]=function(_0x5480e2,_0x2190a6){return db[_0x56d1('0x2c')][_0x56d1('0x48')]({'where':{'id':_0x5480e2[_0x56d1('0x4a')]['id']}})[_0x56d1('0x24')](handleEntityNotFound(_0x2190a6,null))['then'](removeEntity(_0x2190a6,null))[_0x56d1('0x44')](handleError(_0x2190a6,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b77a573..9a9b520 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 _0x3e49=['./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0x3e49,0x166));var _0x93e4=function(_0x30da4d,_0x54286e){_0x30da4d=_0x30da4d-0x0;var _0xe5269c=_0x3e49[_0x30da4d];return _0xe5269c;};'use strict';var _=require(_0x93e4('0x0'));var util=require('util');var logger=require(_0x93e4('0x1'))(_0x93e4('0x2'));var moment=require('moment');var BPromise=require(_0x93e4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93e4('0x4'));var rimraf=require(_0x93e4('0x5'));var config=require('../../config/environment');var attributes=require(_0x93e4('0x6'));module[_0x93e4('0x7')]=function(_0x9a1351,_0x4324d6){return _0x9a1351[_0x93e4('0x8')](_0x93e4('0x9'),attributes,{'tableName':_0x93e4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x93e4('0xb'),'collate':_0x93e4('0xc')});}; \ No newline at end of file +var _0x2165=['rimraf','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x58891e,_0x3c70ac){var _0x551309=function(_0x356823){while(--_0x356823){_0x58891e['push'](_0x58891e['shift']());}};_0x551309(++_0x3c70ac);}(_0x2165,0x118));var _0x5216=function(_0x2ad5ac,_0x3ce592){_0x2ad5ac=_0x2ad5ac-0x0;var _0x5151d0=_0x2165[_0x2ad5ac];return _0x5151d0;};'use strict';var _=require(_0x5216('0x0'));var util=require('util');var logger=require(_0x5216('0x1'))('api');var moment=require(_0x5216('0x2'));var BPromise=require(_0x5216('0x3'));var rp=require(_0x5216('0x4'));var fs=require('fs');var path=require(_0x5216('0x5'));var rimraf=require(_0x5216('0x6'));var config=require('../../config/environment');var attributes=require(_0x5216('0x7'));module[_0x5216('0x8')]=function(_0x10fc9b,_0x390c25){return _0x10fc9b[_0x5216('0x9')](_0x5216('0xa'),attributes,{'tableName':_0x5216('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5216('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4f155f5..e1c500b 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 _0xc3a9=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxApplication','FaxApplication','update','body','options','attributes','limit','catch','lodash'];(function(_0x46743b,_0xcb5ed3){var _0x8ab6c0=function(_0x3e89b4){while(--_0x3e89b4){_0x46743b['push'](_0x46743b['shift']());}};_0x8ab6c0(++_0xcb5ed3);}(_0xc3a9,0x104));var _0x9c3a=function(_0x2a0753,_0x169edf){_0x2a0753=_0x2a0753-0x0;var _0xccbbf6=_0xc3a9[_0x2a0753];return _0xccbbf6;};'use strict';var _=require(_0x9c3a('0x0'));var util=require(_0x9c3a('0x1'));var moment=require('moment');var BPromise=require(_0x9c3a('0x2'));var rs=require(_0x9c3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c3a('0x4'))['db'];var utils=require(_0x9c3a('0x5'));var logger=require(_0x9c3a('0x6'))('rpc');var config=require(_0x9c3a('0x7'));var jayson=require(_0x9c3a('0x8'));var client=jayson[_0x9c3a('0x9')][_0x9c3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1be9b6,_0x593128,_0x4f153c){return new BPromise(function(_0x3b9997,_0x1fa3d4){return client[_0x9c3a('0xb')](_0x1be9b6,_0x4f153c)['then'](function(_0x19bd80){logger[_0x9c3a('0xc')](_0x9c3a('0xd'),_0x593128,'request\x20sent');logger[_0x9c3a('0xe')](_0x9c3a('0xf'),_0x593128,_0x9c3a('0x10'),JSON[_0x9c3a('0x11')](_0x19bd80));if(_0x19bd80[_0x9c3a('0x12')]){if(_0x19bd80[_0x9c3a('0x12')]['code']===0x1f4){logger[_0x9c3a('0x12')](_0x9c3a('0xd'),_0x593128,_0x19bd80[_0x9c3a('0x12')]['message']);return _0x1fa3d4(_0x19bd80[_0x9c3a('0x12')]['message']);}logger[_0x9c3a('0x12')](_0x9c3a('0xd'),_0x593128,_0x19bd80[_0x9c3a('0x12')][_0x9c3a('0x13')]);return _0x3b9997(_0x19bd80[_0x9c3a('0x12')][_0x9c3a('0x13')]);}else{logger[_0x9c3a('0xc')](_0x9c3a('0xd'),_0x593128,_0x9c3a('0x10'));_0x3b9997(_0x19bd80[_0x9c3a('0x14')]['message']);}})['catch'](function(_0x1879e9){logger[_0x9c3a('0x12')](_0x9c3a('0xd'),_0x593128,_0x1879e9);_0x1fa3d4(_0x1879e9);});});}exports[_0x9c3a('0x15')]=function(_0x1d98be){var _0x1f7ada=this;return new Promise(function(_0x52edee,_0xafe378){return db[_0x9c3a('0x16')][_0x9c3a('0x17')](_0x1d98be[_0x9c3a('0x18')],{'raw':_0x1d98be['options']?_0x1d98be['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d98be[_0x9c3a('0x19')]?_0x1d98be[_0x9c3a('0x19')]['where']||null:null,'attributes':_0x1d98be[_0x9c3a('0x19')]?_0x1d98be['options'][_0x9c3a('0x1a')]||null:null,'limit':_0x1d98be[_0x9c3a('0x19')]?_0x1d98be[_0x9c3a('0x19')][_0x9c3a('0x1b')]||null:null})['then'](function(_0x3b9dba){logger[_0x9c3a('0xc')]('UpdateFaxApplication',_0x1d98be);logger['debug'](_0x9c3a('0x15'),_0x1d98be,JSON[_0x9c3a('0x11')](_0x3b9dba));_0x52edee(_0x3b9dba);})[_0x9c3a('0x1c')](function(_0x58d294){logger[_0x9c3a('0x12')](_0x9c3a('0x15'),_0x58d294[_0x9c3a('0x13')],_0x1d98be);_0xafe378(_0x1f7ada['error'](0x1f4,_0x58d294[_0x9c3a('0x13')]));});});}; \ No newline at end of file +var _0x1424=['update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxApplication'];(function(_0x2415a8,_0x831567){var _0x417f82=function(_0x2963f6){while(--_0x2963f6){_0x2415a8['push'](_0x2415a8['shift']());}};_0x417f82(++_0x831567);}(_0x1424,0x10d));var _0x4142=function(_0x25a6a7,_0x1986cb){_0x25a6a7=_0x25a6a7-0x0;var _0x20cfd1=_0x1424[_0x25a6a7];return _0x20cfd1;};'use strict';var _=require(_0x4142('0x0'));var util=require(_0x4142('0x1'));var moment=require(_0x4142('0x2'));var BPromise=require(_0x4142('0x3'));var rs=require(_0x4142('0x4'));var fs=require('fs');var Redis=require(_0x4142('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4142('0x6'));var config=require('../../config/environment');var jayson=require(_0x4142('0x7'));var client=jayson['client'][_0x4142('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57d1b8,_0x14b2ce,_0x13a868){return new BPromise(function(_0x21feaa,_0x36447c){return client['request'](_0x57d1b8,_0x13a868)[_0x4142('0x9')](function(_0x396f11){logger[_0x4142('0xa')](_0x4142('0xb'),_0x14b2ce,_0x4142('0xc'));logger[_0x4142('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x14b2ce,'request\x20sent',JSON[_0x4142('0xe')](_0x396f11));if(_0x396f11[_0x4142('0xf')]){if(_0x396f11['error'][_0x4142('0x10')]===0x1f4){logger['error'](_0x4142('0xb'),_0x14b2ce,_0x396f11['error']['message']);return _0x36447c(_0x396f11[_0x4142('0xf')][_0x4142('0x11')]);}logger[_0x4142('0xf')](_0x4142('0xb'),_0x14b2ce,_0x396f11[_0x4142('0xf')]['message']);return _0x21feaa(_0x396f11[_0x4142('0xf')][_0x4142('0x11')]);}else{logger['info'](_0x4142('0xb'),_0x14b2ce,_0x4142('0xc'));_0x21feaa(_0x396f11[_0x4142('0x12')][_0x4142('0x11')]);}})[_0x4142('0x13')](function(_0x1fbaf8){logger['error'](_0x4142('0xb'),_0x14b2ce,_0x1fbaf8);_0x36447c(_0x1fbaf8);});});}exports['UpdateFaxApplication']=function(_0x408c7b){var _0x46d41b=this;return new Promise(function(_0x4d2cfd,_0x4c6186){return db[_0x4142('0x14')][_0x4142('0x15')](_0x408c7b[_0x4142('0x16')],{'raw':_0x408c7b[_0x4142('0x17')]?_0x408c7b['options'][_0x4142('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408c7b[_0x4142('0x17')]?_0x408c7b['options'][_0x4142('0x19')]||null:null,'attributes':_0x408c7b['options']?_0x408c7b[_0x4142('0x17')][_0x4142('0x1a')]||null:null,'limit':_0x408c7b[_0x4142('0x17')]?_0x408c7b['options'][_0x4142('0x1b')]||null:null})[_0x4142('0x9')](function(_0xff028c){logger[_0x4142('0xa')](_0x4142('0x1c'),_0x408c7b);logger[_0x4142('0xd')](_0x4142('0x1c'),_0x408c7b,JSON[_0x4142('0xe')](_0xff028c));_0x4d2cfd(_0xff028c);})[_0x4142('0x13')](function(_0x8b6a56){logger[_0x4142('0xf')](_0x4142('0x1c'),_0x8b6a56[_0x4142('0x11')],_0x408c7b);_0x4c6186(_0x46d41b[_0x4142('0xf')](0x1f4,_0x8b6a56[_0x4142('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index cffb3c1..6f95320 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 _0x0cf9=['put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xc65834,_0x5df6fb){var _0x5da298=function(_0x30fbc2){while(--_0x30fbc2){_0xc65834['push'](_0xc65834['shift']());}};_0x5da298(++_0x5df6fb);}(_0x0cf9,0x76));var _0x90cf=function(_0x4baac8,_0x5f1dc7){_0x4baac8=_0x4baac8-0x0;var _0x56ebc5=_0x0cf9[_0x4baac8];return _0x56ebc5;};'use strict';var multer=require(_0x90cf('0x0'));var util=require(_0x90cf('0x1'));var path=require('path');var timeout=require(_0x90cf('0x2'));var express=require(_0x90cf('0x3'));var router=express[_0x90cf('0x4')]();var fs_extra=require(_0x90cf('0x5'));var auth=require(_0x90cf('0x6'));var interaction=require(_0x90cf('0x7'));var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x90cf('0x8')]('/',auth[_0x90cf('0x9')](),controller[_0x90cf('0xa')]);router[_0x90cf('0x8')](_0x90cf('0xb'),auth[_0x90cf('0x9')](),controller[_0x90cf('0xc')]);router[_0x90cf('0xd')]('/',auth[_0x90cf('0x9')](),controller[_0x90cf('0xe')]);router[_0x90cf('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x90cf('0x10')]);router[_0x90cf('0x11')](_0x90cf('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x90cf('0x12')]=router; \ No newline at end of file +var _0x957e=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x37c7ab,_0x2f81af){var _0x2067ad=function(_0x27ffbf){while(--_0x27ffbf){_0x37c7ab['push'](_0x37c7ab['shift']());}};_0x2067ad(++_0x2f81af);}(_0x957e,0xb6));var _0xe957=function(_0x468be0,_0x50b945){_0x468be0=_0x468be0-0x0;var _0x3c71ec=_0x957e[_0x468be0];return _0x3c71ec;};'use strict';var multer=require(_0xe957('0x0'));var util=require(_0xe957('0x1'));var path=require('path');var timeout=require(_0xe957('0x2'));var express=require(_0xe957('0x3'));var router=express[_0xe957('0x4')]();var fs_extra=require(_0xe957('0x5'));var auth=require(_0xe957('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe957('0x7'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0xe957('0x8')](),controller[_0xe957('0x9')]);router[_0xe957('0xa')](_0xe957('0xb'),auth[_0xe957('0x8')](),controller[_0xe957('0xc')]);router[_0xe957('0xd')]('/',auth[_0xe957('0x8')](),controller[_0xe957('0xe')]);router[_0xe957('0xf')](_0xe957('0xb'),auth[_0xe957('0x8')](),controller[_0xe957('0x10')]);router['delete'](_0xe957('0xb'),auth[_0xe957('0x8')](),controller[_0xe957('0x11')]);module[_0xe957('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b9a54f8..2fcd9cf 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 _0x36bb=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x5931df,_0x8b8342){var _0x544194=function(_0x141ff0){while(--_0x141ff0){_0x5931df['push'](_0x5931df['shift']());}};_0x544194(++_0x8b8342);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb36b('0x0'));module[_0xb36b('0x1')]={'closed':{'type':Sequelize[_0xb36b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb36b('0x3')]},'secondDisposition':{'type':Sequelize[_0xb36b('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb36b('0x3')]},'note':{'type':Sequelize[_0xb36b('0x3')]},'read1stAt':{'type':Sequelize[_0xb36b('0x4')]},'fax':{'type':Sequelize[_0xb36b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb36b('0x5')]('in',_0xb36b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb36b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb36b('0x5')]('in',_0xb36b('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xedf2=['DATE','STRING','ENUM','exports','BOOLEAN'];(function(_0x243a39,_0x4c9b51){var _0x5620a2=function(_0x16a997){while(--_0x16a997){_0x243a39['push'](_0x243a39['shift']());}};_0x5620a2(++_0x4c9b51);}(_0xedf2,0x1ac));var _0x2edf=function(_0x546ca4,_0x2f0016){_0x546ca4=_0x546ca4-0x0;var _0x47e1bd=_0xedf2[_0x546ca4];return _0x47e1bd;};'use strict';var Sequelize=require('sequelize');module[_0x2edf('0x0')]={'closed':{'type':Sequelize[_0x2edf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2edf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2edf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2edf('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2edf('0x2')]},'fax':{'type':Sequelize[_0x2edf('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2edf('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2edf('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 1233e00..faa1778 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 _0x36cb=['QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','params','includeAll','create','describe','addMessage','FaxMessage','ids','hasOwnProperty','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','tmp','root','attachments','transcript-%d-%s.zip','Attachment','createdAt','get','mkdirSync','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','sort','where','select','field','color','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x36cb,0x123));var _0xb36c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x36cb[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0xb36c('0x0'));var rimraf=require(_0xb36c('0x1'));var zipdir=require(_0xb36c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb36c('0x3'));var moment=require(_0xb36c('0x4'));var BPromise=require(_0xb36c('0x5'));var Mustache=require(_0xb36c('0x6'));var util=require(_0xb36c('0x7'));var path=require(_0xb36c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb36c('0x9'));var _=require('lodash');var squel=require(_0xb36c('0xa'));var crypto=require(_0xb36c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb36c('0xc'));var querystring=require(_0xb36c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb36c('0xe'));var qs=require(_0xb36c('0xf'));var as=require(_0xb36c('0x10'));var hardwareService=require(_0xb36c('0x11'));var logger=require(_0xb36c('0x12'))(_0xb36c('0x13'));var utils=require(_0xb36c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb36c('0x15'));var db=require(_0xb36c('0x16'))['db'];config[_0xb36c('0x17')]=_[_0xb36c('0x18')](config[_0xb36c('0x17')],{'host':_0xb36c('0x19'),'port':0x18eb});var socket=require(_0xb36c('0x1a'))(new Redis(config[_0xb36c('0x17')]));require(_0xb36c('0x1b'))[_0xb36c('0x1c')](socket);function respondWithStatusCode(_0x5747ba,_0x562e29){_0x562e29=_0x562e29||0xcc;return function(_0x4078de){if(_0x4078de){return _0x5747ba[_0xb36c('0x1d')](_0x562e29);}return _0x5747ba[_0xb36c('0x1e')](_0x562e29)[_0xb36c('0x1f')]();};}function respondWithResult(_0x466c8f,_0x3b8359){_0x3b8359=_0x3b8359||0xc8;return function(_0x5361d2){if(_0x5361d2){return _0x466c8f[_0xb36c('0x1e')](_0x3b8359)[_0xb36c('0x20')](_0x5361d2);}};}function respondWithFilteredResult(_0x556cbc,_0x119d28){return function(_0x43c677){if(_0x43c677){var _0x407105=typeof _0x119d28[_0xb36c('0x21')]==='undefined'&&typeof _0x119d28['limit']===_0xb36c('0x22');var _0x5502dc=_0x43c677[_0xb36c('0x23')];var _0x1a5eae=_0x407105?0x0:_0x119d28[_0xb36c('0x21')];var _0xcecdcf=_0x407105?_0x43c677['count']:_0x119d28[_0xb36c('0x21')]+_0x119d28[_0xb36c('0x24')];var _0x382eab;if(_0xcecdcf>=_0x5502dc){_0xcecdcf=_0x5502dc;_0x382eab=0xc8;}else{_0x382eab=0xce;}_0x556cbc[_0xb36c('0x1e')](_0x382eab);return _0x556cbc[_0xb36c('0x25')]('Content-Range',_0x1a5eae+'-'+_0xcecdcf+'/'+_0x5502dc)['json'](_0x43c677);}return null;};}function patchUpdates(_0x245750){return function(_0x55d1a3){try{jsonpatch[_0xb36c('0x26')](_0x55d1a3,_0x245750,!![]);}catch(_0x615b6f){return BPromise[_0xb36c('0x27')](_0x615b6f);}return _0x55d1a3[_0xb36c('0x28')]();};}function saveUpdates(_0x1b0c3c,_0x1cb93b){return function(_0x3f16ce){if(_0x3f16ce){return _0x3f16ce[_0xb36c('0x29')](_0x1b0c3c)[_0xb36c('0x2a')](function(_0x2835c2){return _0x2835c2;});}return null;};}function removeEntity(_0x22878f,_0xe0b068){return function(_0x3d88ac){if(_0x3d88ac){return _0x3d88ac['destroy']()[_0xb36c('0x2a')](function(){_0x22878f[_0xb36c('0x1e')](0xcc)[_0xb36c('0x1f')]();});}};}function handleEntityNotFound(_0x543af8,_0x1c1f95){return function(_0x25d17c){if(!_0x25d17c){_0x543af8[_0xb36c('0x1d')](0x194);}return _0x25d17c;};}function handleError(_0x15f7ed,_0x4c0008){_0x4c0008=_0x4c0008||0x1f4;return function(_0x2030c9){logger[_0xb36c('0x2b')](_0x2030c9[_0xb36c('0x2c')]);if(_0x2030c9[_0xb36c('0x2d')]){delete _0x2030c9[_0xb36c('0x2d')];}_0x15f7ed[_0xb36c('0x1e')](_0x4c0008)[_0xb36c('0x2e')](_0x2030c9);};}function getInteractionUsers(_0x467a56,_0x54c4f1){return new BPromise(function(_0x1caa41,_0x138e87){try{if(_0x54c4f1[_0x467a56['id']]){_0x467a56[_0xb36c('0x2f')]=_[_0xb36c('0x30')](_0x54c4f1[_0x467a56['id']],function(_0xa4db8c){return{'id':_0xa4db8c['id'],'fullname':_0xa4db8c[_0xb36c('0x31')]};});}}catch(_0x168aad){_0x138e87(_0x168aad);}_0x1caa41(_0x467a56);});}function getInteractionTags(_0x39de54,_0x1a9d45){return new BPromise(function(_0x901e1,_0x61068f){try{if(_0x39de54[_0xb36c('0x32')]){_0x39de54[_0xb36c('0x33')]=[];_0x39de54[_0xb36c('0x32')][_0xb36c('0x34')](',')[_0xb36c('0x35')](function(_0x5ed27a){_0x39de54[_0xb36c('0x33')][_0xb36c('0x36')](_0x1a9d45[_0x5ed27a]);});}delete _0x39de54[_0xb36c('0x32')];}catch(_0x53a53c){_0x61068f(_0x53a53c);}_0x901e1(_0x39de54);});}function updateFaxInteraction(_0x1105e9,_0x280dcd,_0x46c228){return new BPromise(function(_0x127ebc,_0x2db58c){return getInteractionUsers(_0x1105e9,_0x46c228)['then'](function(_0x283671){return getInteractionTags(_0x283671,_0x280dcd);})[_0xb36c('0x2a')](function(_0x1bb175){_0x127ebc(_0x1bb175);})[_0xb36c('0x37')](function(_0x4872ce){_0x2db58c(_0x4872ce);});});}exports[_0xb36c('0x38')]=function(_0x5810ef,_0x21c4c8){var _0x50b971={},_0x546a00={},_0x284541={'count':0x0,'rows':[]};var _0x5aaa89=_[_0xb36c('0x30')](db[_0xb36c('0x39')][_0xb36c('0x3a')],function(_0x448e04){return{'name':_0x448e04[_0xb36c('0x3b')],'type':_0x448e04[_0xb36c('0x3c')][_0xb36c('0x3d')]};});_0x546a00[_0xb36c('0x3e')]=_[_0xb36c('0x30')](_0x5aaa89,_0xb36c('0x2d'));_0x546a00['query']=_[_0xb36c('0x3f')](_0x5810ef[_0xb36c('0x40')]);_0x546a00[_0xb36c('0x41')]=_[_0xb36c('0x42')](_0x546a00['model'],_0x546a00['query']);_0x50b971['attributes']=_[_0xb36c('0x42')](_0x546a00[_0xb36c('0x3e')],qs[_0xb36c('0x43')](_0x5810ef[_0xb36c('0x40')]['fields']));_0x50b971['attributes']=_0x50b971[_0xb36c('0x44')]['length']?_0x50b971[_0xb36c('0x44')]:_0x546a00['model'];if(!_0x5810ef[_0xb36c('0x40')]['hasOwnProperty']('nolimit')){_0x50b971['limit']=qs[_0xb36c('0x24')](_0x5810ef['query']['limit']);_0x50b971[_0xb36c('0x21')]=qs[_0xb36c('0x21')](_0x5810ef['query'][_0xb36c('0x21')]);}_0x50b971['order']=qs['sort'](_0x5810ef[_0xb36c('0x40')][_0xb36c('0x45')]);_0x50b971[_0xb36c('0x46')]=qs[_0xb36c('0x41')](_['pick'](_0x5810ef[_0xb36c('0x40')],_0x546a00[_0xb36c('0x41')]),_0x5aaa89);var _0x526dc1=[];var _0x280066=squel[_0xb36c('0x47')]()[_0xb36c('0x48')]('id')[_0xb36c('0x48')](_0xb36c('0x2d'))[_0xb36c('0x48')](_0xb36c('0x49'))['from'](_0xb36c('0x4a'));var _0x1c859b=squel[_0xb36c('0x47')]()[_0xb36c('0x48')]('u.id')[_0xb36c('0x48')](_0xb36c('0x4b'))['field'](_0xb36c('0x4c'))['from'](_0xb36c('0x4d'),'ui')[_0xb36c('0x4e')](_0xb36c('0x4f'),'u',_0xb36c('0x50'));var _0x5de9cc=squel[_0xb36c('0x47')]()[_0xb36c('0x51')](_0xb36c('0x52'),'i')[_0xb36c('0x4e')]('cm_contacts','c',_0xb36c('0x53'))[_0xb36c('0x4e')](_0xb36c('0x4f'),'o',_0xb36c('0x54'))[_0xb36c('0x4e')]('fax_accounts','a',_0xb36c('0x55'))[_0xb36c('0x4e')](_0xb36c('0x56'),'me',_0xb36c('0x57'))[_0xb36c('0x4e')](_0xb36c('0x58'),'it',_0xb36c('0x59'))[_0xb36c('0x4e')]('tools_tags','t',_0xb36c('0x5a'));var _0x229969=squel[_0xb36c('0x5b')]();var _0x509076=[];var _0x1f3fe6=squel[_0xb36c('0x5b')]();var _0x5b6997;if(_0x5810ef[_0xb36c('0x40')][_0xb36c('0x5c')]){_0x5b6997=as[_0xb36c('0x5d')](_0x5810ef[_0xb36c('0x40')]['search']);var _0x15d1b9=_0x5b6997[_0xb36c('0x5e')];for(var _0xd519b2=0x0;_0xd519b2<_0x5b6997[_0xb36c('0x5f')][_0xb36c('0x60')];_0xd519b2++){var _0x58229b=_0x5b6997[_0xb36c('0x5f')][_0xd519b2];var _0x2f9fac='i';var _0x31df7b=_[_0xb36c('0x61')](_0x5aaa89,[_0xb36c('0x2d'),_0x58229b[_0xb36c('0x48')]]);if(!_0x31df7b){switch(_0x58229b[_0xb36c('0x48')]){case _0xb36c('0x62'):if(_0x58229b[_0xb36c('0x63')]==0x1){_0x5de9cc[_0xb36c('0x64')]('`'+_0x58229b[_0xb36c('0x48')]+_0xb36c('0x65'));}else{_0x5de9cc[_0xb36c('0x64')]('`'+_0x58229b[_0xb36c('0x48')]+_0xb36c('0x66'));}break;case _0xb36c('0x67'):if(_0x58229b['operator']===_0xb36c('0x68')){if(_0x58229b[_0xb36c('0x63')]['split']('\x20')[_0xb36c('0x60')]>0x1){_0x229969[_0x15d1b9](_0xb36c('0x69'),qs['getFullTextValue'](_0x58229b['value']),null);}else{var _0x443b65='%'+_0x58229b[_0xb36c('0x63')]+'%';_0x229969[_0x15d1b9]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x443b65,_0x443b65,_0x443b65);}}else{_0x31df7b=_[_0xb36c('0x61')](_0x5aaa89,[_0xb36c('0x2d'),_0xb36c('0x6a')]);_0x58229b['field']=_0xb36c('0x6a');_0x5263eb=as['buildExpression'](_0x2f9fac,_0x31df7b[_0xb36c('0x3c')],_0x58229b);_0x229969[_0x15d1b9](_0x5263eb[_0xb36c('0x6b')],_0x5263eb[_0xb36c('0x63')]['start'],_0x5263eb[_0xb36c('0x63')]['end']);}break;case _0xb36c('0x6c'):var _0x38b016=_0x58229b[_0xb36c('0x63')][_0xb36c('0x34')](',')['map'](function(_0x4408de){return Number(_0x4408de);});_0x38b016[_0xb36c('0x35')](function(_0x4c20ee){_0x1f3fe6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4c20ee+',%');});_0x509076=_[_0xb36c('0x6d')](_0x509076,_0x38b016);break;case'User':if(_0x58229b[_0xb36c('0x6e')]===_0xb36c('0x68')){_0x229969[_0x15d1b9](_0xb36c('0x6f'),'%'+_0x58229b['value']+'%',null);}else{_0x31df7b=_[_0xb36c('0x61')](_0x5aaa89,[_0xb36c('0x2d'),_0xb36c('0x70')]);_0x58229b[_0xb36c('0x48')]=_0xb36c('0x70');_0x5263eb=as[_0xb36c('0x71')](_0x2f9fac,_0x31df7b[_0xb36c('0x3c')],_0x58229b);_0x229969[_0x15d1b9](_0x5263eb[_0xb36c('0x6b')],_0x5263eb[_0xb36c('0x63')][_0xb36c('0x72')],_0x5263eb[_0xb36c('0x63')][_0xb36c('0x1f')]);}break;case _0xb36c('0x73'):_0x5263eb=as[_0xb36c('0x71')]('me',null,_0x58229b);_0x229969[_0x15d1b9](_0x5263eb[_0xb36c('0x6b')],_0x5263eb['value'][_0xb36c('0x72')],_0x5263eb[_0xb36c('0x63')]['end']);break;}}else{var _0x5263eb=as[_0xb36c('0x71')](_0x2f9fac,_0x31df7b['type'],_0x58229b);_0x229969[_0x15d1b9](_0x5263eb[_0xb36c('0x6b')],_0x5263eb['value']['start'],_0x5263eb[_0xb36c('0x63')]['end']);}}}else{var _0x1b0426=_(_0x5810ef['query'])[_0xb36c('0x3f')]()['map'](function(_0x2780f5){return _[_0xb36c('0x74')](_0x5aaa89,['name',_0x2780f5])?_0x2780f5:undefined;})['compact']()[_0xb36c('0x63')]();if(!_[_0xb36c('0x75')](_0x1b0426)){_0x1b0426[_0xb36c('0x35')](function(_0x9ff60f){if(_0x9ff60f===_0xb36c('0x76')){_0x5de9cc[_0xb36c('0x46')](_0xb36c('0x77'),[]['concat'](_0x5810ef[_0xb36c('0x40')][_0x9ff60f]));}else if(_0x9ff60f==='createdAt'){var _0x350807=JSON[_0xb36c('0x78')](_0x5810ef[_0xb36c('0x40')][_0x9ff60f])[_0xb36c('0x79')];var _0x541e2f=JSON[_0xb36c('0x78')](_0x5810ef[_0xb36c('0x40')][_0x9ff60f])['$lte'];_0x5de9cc[_0xb36c('0x46')](_0xb36c('0x7a'),_0x350807,_0x541e2f);}else{if(_0x5810ef[_0xb36c('0x40')][_0x9ff60f]===_0xb36c('0x7b')){_0x5de9cc[_0xb36c('0x46')]('i.'+_0x9ff60f+_0xb36c('0x7c'));}else{_0x5de9cc[_0xb36c('0x46')]('i.'+_0x9ff60f+_0xb36c('0x7d'),_0x5810ef[_0xb36c('0x40')][_0x9ff60f]);}}});}if(_0x5810ef[_0xb36c('0x40')][_0xb36c('0x7e')]){if(_0x5810ef[_0xb36c('0x40')]['read']==0x1){_0x5de9cc[_0xb36c('0x64')]('`unreadMessages`\x20=\x200');}else{_0x5de9cc['having']('`unreadMessages`\x20>\x200');}}if(_0x5810ef[_0xb36c('0x40')][_0xb36c('0x7f')]){_0x509076=_[_0xb36c('0x80')](_0x5810ef[_0xb36c('0x40')][_0xb36c('0x7f')])?_0x5810ef[_0xb36c('0x40')][_0xb36c('0x7f')]:new Array(_0x5810ef[_0xb36c('0x40')][_0xb36c('0x7f')]);_0x509076[_0xb36c('0x35')](function(_0x1365aa){_0x1f3fe6['or'](_0xb36c('0x81'),'%,'+_0x1365aa+',%');});}if(_0x5810ef['query'][_0xb36c('0x82')]){var _0x552494=_0x5810ef[_0xb36c('0x40')]['filter']['replace']('\x5c','\x5c\x5c')[_0xb36c('0x83')](/'/g,'\x27\x27');if(qs[_0xb36c('0x84')](_0x552494)){_0x229969['or']('i.id\x20LIKE\x20?',_0x552494+'%')['or'](_0xb36c('0x85'),_0x552494+'%');}_0x229969['or'](_0xb36c('0x86'),_0x552494+'%');}}_0x5de9cc[_0xb36c('0x46')](_0x229969);_0x5de9cc[_0xb36c('0x87')]('i.id');var _0x5db430={'type':db[_0xb36c('0x88')][_0xb36c('0x89')][_0xb36c('0x8a')],'raw':!![]};var _0x44ab38=_0x5de9cc[_0xb36c('0x8b')]();_0x44ab38[_0xb36c('0x48')]('i.id');_0x44ab38['field'](_0xb36c('0x8c'),_0xb36c('0x62'));if(_0x50b971['order']){_0x50b971[_0xb36c('0x8d')][_0xb36c('0x35')](function(_0x45161b){var _0x140bce=_0x45161b[0x0]==='contactName'?_0x45161b[0x0]:'i.'+_0x45161b[0x0];_0x5de9cc[_0xb36c('0x8d')](_0x140bce,_0x45161b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb36c('0x75')](_0x509076)){_0x5de9cc[_0xb36c('0x64')](_0x1f3fe6);_0x44ab38['where']('t.id\x20IN\x20?',_0x509076);}BPromise[_0xb36c('0x8e')]()[_0xb36c('0x2a')](function(){if(!_0x5b6997){if(_0x5810ef['query']['FaxAccountId'])return;_0x44ab38[_0xb36c('0x46')](_0xb36c('0x8f'));_0x5de9cc['where'](_0xb36c('0x8f'));return;}if(_0x5810ef['user'][_0xb36c('0x90')]!==_0xb36c('0x91'))return;return _0x5810ef[_0xb36c('0x92')][_0xb36c('0x93')]({'attributes':['id'],'raw':!![]})[_0xb36c('0x2a')](function(_0x5818a3){if(_[_0xb36c('0x75')](_0x5818a3)){_0x44ab38[_0xb36c('0x46')](_0xb36c('0x94'));_0x5de9cc[_0xb36c('0x46')](_0xb36c('0x94'));}else{_0x44ab38[_0xb36c('0x46')](_0xb36c('0x77'),_['map'](_0x5818a3,'id'));_0x5de9cc[_0xb36c('0x46')](_0xb36c('0x77'),_[_0xb36c('0x30')](_0x5818a3,'id'));}});})[_0xb36c('0x2a')](function(){if(_0x5810ef[_0xb36c('0x92')][_0xb36c('0x90')]===_0xb36c('0x91')&&!_0x5b6997&&!_0x5810ef['query']['FaxAccountId'])return[];return db[_0xb36c('0x95')][_0xb36c('0x40')](_0x44ab38[_0xb36c('0x96')](),_0x5db430);})[_0xb36c('0x2a')](function(_0x5b8ba0){_0x284541['count']=_0x5b8ba0['length'];if(_0x284541[_0xb36c('0x23')]===0x0)return[];return db[_0xb36c('0x95')]['query'](_0x280066['toString'](),_0x5db430)[_0xb36c('0x2a')](function(_0x35d5b8){_0x526dc1=_[_0xb36c('0x97')](_0x35d5b8,'id');_0x5db430=_[_0xb36c('0x98')](_0x5db430,{'model':db[_0xb36c('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5810ef['query'][_0xb36c('0x43')]){_0x50b971[_0xb36c('0x44')]['forEach'](function(_0x1226a7){_0x5de9cc['field']('i.'+_0x1226a7);});}else{_0x5de9cc[_0xb36c('0x48')](_0xb36c('0x8c'),_0xb36c('0x62'));_0x5de9cc['field']('a.key',_0xb36c('0x99'));_0x5de9cc[_0xb36c('0x48')](_0xb36c('0x9a'),'Account.mandatoryDisposition');_0x5de9cc[_0xb36c('0x48')](_0xb36c('0x9b'),_0xb36c('0x9c'));_0x5de9cc[_0xb36c('0x48')](_0xb36c('0x9d'));_0x5de9cc['field'](_0xb36c('0x9e'),'Contact.firstName');_0x5de9cc[_0xb36c('0x48')](_0xb36c('0x9f'),_0xb36c('0xa0'));_0x5de9cc['field'](_0xb36c('0xa1'),_0xb36c('0xa2'));_0x5de9cc['field']('c.phone','Contact.phone');_0x5de9cc['field']('c.mobile',_0xb36c('0xa3'));_0x5de9cc['field'](_0xb36c('0xa4'),_0xb36c('0xa5'));_0x5de9cc[_0xb36c('0x48')](_0xb36c('0xa6'),'Owner.fullname');_0x5de9cc[_0xb36c('0x48')]('o.internal',_0xb36c('0xa7'));_0x5de9cc[_0xb36c('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb36c('0x32'));}if(_0x50b971[_0xb36c('0x24')])_0x5de9cc[_0xb36c('0x24')](_0x50b971[_0xb36c('0x24')]);if(_0x50b971[_0xb36c('0x21')])_0x5de9cc[_0xb36c('0x21')](_0x50b971[_0xb36c('0x21')]);return db['sequelize'][_0xb36c('0x40')](_0x5de9cc[_0xb36c('0x96')](),_0x5db430);})[_0xb36c('0x2a')](function(_0x411901){if(_0x411901['length']>0x0)_0x1c859b[_0xb36c('0x46')](_0xb36c('0xa8'),_[_0xb36c('0x30')](_0x411901,'id'));return db[_0xb36c('0x95')][_0xb36c('0x40')](_0x1c859b['toString'](),_0x5db430)[_0xb36c('0x2a')](function(_0x44bda3){var _0x32ef7e=_[_0xb36c('0xa9')](_0x44bda3,_0xb36c('0xaa'));var _0x812fec=[];_0x411901[_0xb36c('0x35')](function(_0x27984d){_0x812fec[_0xb36c('0x36')](updateFaxInteraction(_0x27984d,_0x526dc1,_0x32ef7e));});return BPromise[_0xb36c('0xab')](_0x812fec);});});})[_0xb36c('0x2a')](function(_0x542a3e){_0x284541['rows']=_0x542a3e;return _0x284541;})[_0xb36c('0x2a')](respondWithFilteredResult(_0x21c4c8,_0x50b971))['catch'](handleError(_0x21c4c8,null));};exports['show']=function(_0x55492b,_0x3072e5){var _0x3d2eb1={'raw':![],'where':{'id':_0x55492b[_0xb36c('0xac')]['id']}},_0x385a46={};_0x385a46[_0xb36c('0x3e')]=_[_0xb36c('0x3f')](db[_0xb36c('0x39')]['rawAttributes']);_0x385a46[_0xb36c('0x40')]=_['keys'](_0x55492b[_0xb36c('0x40')]);_0x385a46[_0xb36c('0x41')]=_[_0xb36c('0x42')](_0x385a46['model'],_0x385a46['query']);_0x3d2eb1['attributes']=_[_0xb36c('0x42')](_0x385a46[_0xb36c('0x3e')],qs['fields'](_0x55492b[_0xb36c('0x40')][_0xb36c('0x43')]));_0x3d2eb1[_0xb36c('0x44')]=_0x3d2eb1[_0xb36c('0x44')][_0xb36c('0x60')]?_0x3d2eb1['attributes']:_0x385a46[_0xb36c('0x3e')];if(_0x55492b[_0xb36c('0x40')][_0xb36c('0xad')]){_0x3d2eb1['include']=[{'all':!![]}];}_0x3d2eb1=_[_0xb36c('0x98')]({},_0x3d2eb1,_0x55492b['options']);return db[_0xb36c('0x39')][_0xb36c('0x61')](_0x3d2eb1)[_0xb36c('0x2a')](handleEntityNotFound(_0x3072e5,null))[_0xb36c('0x2a')](respondWithResult(_0x3072e5,null))[_0xb36c('0x37')](handleError(_0x3072e5,null));};exports[_0xb36c('0xae')]=function(_0xdbf7a1,_0x4567f8){return db[_0xb36c('0x39')][_0xb36c('0xae')](_0xdbf7a1['body'],{})[_0xb36c('0x2a')](respondWithResult(_0x4567f8,0xc9))[_0xb36c('0x37')](handleError(_0x4567f8,null));};exports[_0xb36c('0x29')]=function(_0x246a8e,_0x58325b){if(_0x246a8e[_0xb36c('0x73')]['id']){delete _0x246a8e[_0xb36c('0x73')]['id'];}return db[_0xb36c('0x39')][_0xb36c('0x61')]({'where':{'id':_0x246a8e[_0xb36c('0xac')]['id']}})[_0xb36c('0x2a')](handleEntityNotFound(_0x58325b,null))[_0xb36c('0x2a')](saveUpdates(_0x246a8e[_0xb36c('0x73')],null))[_0xb36c('0x2a')](respondWithResult(_0x58325b,null))['catch'](handleError(_0x58325b,null));};exports['destroy']=function(_0x4825bb,_0x1bb200){return db[_0xb36c('0x39')][_0xb36c('0x61')]({'where':{'id':_0x4825bb[_0xb36c('0xac')]['id']}})[_0xb36c('0x2a')](handleEntityNotFound(_0x1bb200,null))[_0xb36c('0x2a')](removeEntity(_0x1bb200,null))[_0xb36c('0x37')](handleError(_0x1bb200,null));};exports['describe']=function(_0x3c2cb4,_0x5248ab){return db[_0xb36c('0x39')][_0xb36c('0xaf')]()[_0xb36c('0x2a')](respondWithResult(_0x5248ab,null))['catch'](handleError(_0x5248ab,null));};exports[_0xb36c('0xb0')]=function(_0x24ed1e,_0x4d04d3,_0x13f689){return db[_0xb36c('0xb1')][_0xb36c('0x61')]({'where':{'id':_0x24ed1e[_0xb36c('0xac')]['id']}})[_0xb36c('0x2a')](handleEntityNotFound(_0x4d04d3,null))['then'](function(_0x388072){if(_0x388072){return _0x388072[_0xb36c('0xb0')](_0x24ed1e[_0xb36c('0x73')][_0xb36c('0xb2')],_['omit'](_0x24ed1e[_0xb36c('0x73')],['ids','id'])||{});}})[_0xb36c('0x2a')](respondWithResult(_0x4d04d3,null))[_0xb36c('0x37')](handleError(_0x4d04d3,null));};exports['getMessages']=function(_0x574a85,_0x744fd5,_0x3fe889){var _0x5016fd={'raw':![],'where':{}};var _0x392f05={};var _0x594c34={'count':0x0,'rows':[]};return db[_0xb36c('0x39')]['findOne']({'where':{'id':_0x574a85['params']['id']}})[_0xb36c('0x2a')](handleEntityNotFound(_0x744fd5,null))[_0xb36c('0x2a')](function(_0x271805){if(_0x271805){_0x392f05[_0xb36c('0x3e')]=_[_0xb36c('0x3f')](db[_0xb36c('0xb1')][_0xb36c('0x3a')]);_0x392f05[_0xb36c('0x40')]=_[_0xb36c('0x3f')](_0x574a85[_0xb36c('0x40')]);_0x392f05[_0xb36c('0x41')]=_['intersection'](_0x392f05['model'],_0x392f05[_0xb36c('0x40')]);_0x5016fd[_0xb36c('0x44')]=_[_0xb36c('0x42')](_0x392f05[_0xb36c('0x3e')],qs['fields'](_0x574a85[_0xb36c('0x40')][_0xb36c('0x43')]));_0x5016fd[_0xb36c('0x44')]=_0x5016fd[_0xb36c('0x44')]['length']?_0x5016fd[_0xb36c('0x44')]:_0x392f05['model'];if(!_0x574a85[_0xb36c('0x40')][_0xb36c('0xb3')](_0xb36c('0xb4'))){_0x5016fd[_0xb36c('0x24')]=qs['limit'](_0x574a85[_0xb36c('0x40')]['limit']);_0x5016fd[_0xb36c('0x21')]=qs[_0xb36c('0x21')](_0x574a85[_0xb36c('0x40')][_0xb36c('0x21')]);}_0x5016fd[_0xb36c('0x8d')]=qs[_0xb36c('0x45')](_0x574a85[_0xb36c('0x40')][_0xb36c('0x45')]);_0x5016fd[_0xb36c('0x46')]=qs[_0xb36c('0x41')](_[_0xb36c('0xb5')](_0x574a85[_0xb36c('0x40')],_0x392f05[_0xb36c('0x41')]));_0x5016fd[_0xb36c('0x46')][_0xb36c('0xaa')]=_0x271805['id'];if(_0x574a85['query']['filter']){_0x5016fd[_0xb36c('0x46')]=_[_0xb36c('0x98')](_0x5016fd[_0xb36c('0x46')],{'$or':_[_0xb36c('0x30')](_0x5016fd[_0xb36c('0x44')],function(_0x60c1f8){var _0x5dbbc0={};_0x5dbbc0[_0x60c1f8]={'$like':'%'+_0x574a85[_0xb36c('0x40')][_0xb36c('0x82')]+'%'};return _0x5dbbc0;})});}if(_0x574a85[_0xb36c('0x40')][_0xb36c('0x79')]){var _0x32f23a=_0x574a85[_0xb36c('0x40')][_0xb36c('0x79')][_0xb36c('0x34')](',');var _0x1d7a95={};_0x1d7a95[_0x32f23a[0x0]]={'$gte':moment(_0x32f23a[0x1])[_0xb36c('0xb6')](_0xb36c('0xb7'))};_0x5016fd[_0xb36c('0x46')]=_[_0xb36c('0x98')](_0x5016fd['where'],_0x1d7a95);}_0x5016fd=_['merge']({},_0x5016fd,_0x574a85['options']);return db[_0xb36c('0xb1')][_0xb36c('0x23')]({'where':_0x5016fd['where']})[_0xb36c('0x2a')](function(_0x33cbd8){_0x594c34[_0xb36c('0x23')]=_0x33cbd8;if(_0x574a85[_0xb36c('0x40')][_0xb36c('0xad')]){_0x5016fd[_0xb36c('0xb8')]=[{'all':!![]}];}return db[_0xb36c('0xb1')][_0xb36c('0xb9')](_0x5016fd);})[_0xb36c('0x2a')](function(_0x2cad66){_0x594c34[_0xb36c('0xba')]=_0x2cad66;return _0x594c34;});}})[_0xb36c('0x2a')](respondWithFilteredResult(_0x744fd5,_0x5016fd))[_0xb36c('0x37')](handleError(_0x744fd5,null));};exports[_0xb36c('0xbb')]=function(_0x5f1b1d,_0x422ee6,_0x2b8cca){return db[_0xb36c('0x39')]['find']({'where':{'id':_0x5f1b1d['params']['id']}})[_0xb36c('0x2a')](handleEntityNotFound(_0x422ee6,null))[_0xb36c('0x2a')](function(_0x12e60c){if(_0x12e60c){return _0x12e60c['setTags'](_0x5f1b1d[_0xb36c('0x73')][_0xb36c('0xb2')],_[_0xb36c('0xbc')](_0x5f1b1d['body'],[_0xb36c('0xb2'),'id'])||{})[_0xb36c('0xbd')](function(){return db[_0xb36c('0x6c')][_0xb36c('0xb9')]({'attributes':['id',_0xb36c('0x2d'),_0xb36c('0x49')],'where':{'id':_0x5f1b1d[_0xb36c('0x73')][_0xb36c('0xb2')]}});})[_0xb36c('0x2a')](function(_0x3314e2){socket[_0xb36c('0xbe')](_0xb36c('0xbf'),{'id':Number(_0x5f1b1d[_0xb36c('0xac')]['id']),'tags':_0x3314e2||[]});return{'id':Number(_0x5f1b1d['params']['id']),'tags':_0x3314e2||[]};});}})[_0xb36c('0x2a')](respondWithResult(_0x422ee6,null))['catch'](handleError(_0x422ee6,null));};exports['removeTags']=function(_0x4d3ac8,_0x45cbb9,_0x28823f){return db[_0xb36c('0x39')][_0xb36c('0x61')]({'where':{'id':_0x4d3ac8[_0xb36c('0xac')]['id']}})[_0xb36c('0x2a')](handleEntityNotFound(_0x45cbb9,null))[_0xb36c('0x2a')](function(_0x1bdf88){if(_0x1bdf88){return _0x1bdf88[_0xb36c('0xc0')](_0x4d3ac8[_0xb36c('0x40')][_0xb36c('0xb2')]);}})[_0xb36c('0x2a')](respondWithStatusCode(_0x45cbb9,null))['catch'](handleError(_0x45cbb9,null));};exports[_0xb36c('0xc1')]=function(_0x160559,_0x8d55c8){var _0x290bff=moment()[_0xb36c('0xc2')]()[_0xb36c('0x96')]();var _0x138fe7=path[_0xb36c('0xc3')](config['root'],_0xb36c('0xc4'),'files',_0xb36c('0xc5'));var _0x2102f5=path[_0xb36c('0xc3')](config[_0xb36c('0xc6')],_0xb36c('0xc4'),'files',_0xb36c('0xc7'));var _0x46b0fc=path['join'](_0x138fe7,_0x290bff);var _0x5b08f3=util[_0xb36c('0xb6')](_0xb36c('0xc8'),_0x160559[_0xb36c('0xac')]['id'],_0x290bff);var _0x358f89=path[_0xb36c('0xc3')](_0x138fe7,_0x5b08f3);var _0x508576=[];_0x508576[_0xb36c('0x36')]({'model':db[_0xb36c('0xc9')],'as':_0xb36c('0xc9'),'raw':!![]});var _0x76332a=[{'model':db[_0xb36c('0xb1')],'as':'Messages','attributes':['id',_0xb36c('0x73'),_0xb36c('0xca')],'include':_0x508576}];return db[_0xb36c('0x39')][_0xb36c('0x61')]({'where':{'id':_0x160559[_0xb36c('0xac')]['id']},'include':_0x76332a})['then'](handleEntityNotFound(_0x8d55c8,null))[_0xb36c('0x2a')](function(_0x51c4e9){if(_0x51c4e9&&_0x51c4e9['Messages']){var _0x170105=_0x51c4e9[_0xb36c('0xcb')]({'plain':!![]});fs[_0xb36c('0xcc')](_0x46b0fc);for(var _0x40f0d5=0x0;_0x40f0d5<_0x170105[_0xb36c('0xcd')][_0xb36c('0x60')];_0x40f0d5++){var _0x21596f=_0x170105[_0xb36c('0xcd')][_0x40f0d5]['Attachment'];if(_0x21596f){var _0x134569=path['join'](_0x2102f5,_0x21596f[_0xb36c('0xce')]);if(fs[_0xb36c('0xcf')](_0x134569)){fs[_0xb36c('0xd0')](_0x134569)[_0xb36c('0xd1')](fs[_0xb36c('0xd2')](path[_0xb36c('0xc3')](_0x46b0fc,_0x21596f[_0xb36c('0xce')])));}}}return BPromise[_0xb36c('0x8e')]()[_0xb36c('0x2a')](function(){return new BPromise(function(_0x553664,_0x3ad2ff){zipdir(_0x46b0fc,{'saveTo':_0x358f89},function(_0x5b92fe,_0x5b23ee){if(_0x5b92fe)return _0x3ad2ff(_0x5b92fe);return _0x553664(_0x5b23ee);});})['then'](function(){return new BPromise(function(_0x73dd42,_0x3967ae){rimraf(_0x46b0fc,function(_0x2d04a2){if(_0x2d04a2)_0x3967ae(_0x2d04a2);return _0x73dd42();});});})['then'](function(){return _0x8d55c8['download'](_0x358f89,_0x5b08f3,function(_0xd15c4b){if(_0xd15c4b){console[_0xb36c('0xd3')](_0xb36c('0xd4'),_0xd15c4b);}else{fs[_0xb36c('0xd5')](_0x358f89);}});});});}else{return _0x8d55c8['sendStatus'](0xc8);}})[_0xb36c('0x37')](handleError(_0x8d55c8,null));}; \ No newline at end of file +var _0xabc2=['existsSync','createReadStream','pipe','createWriteStream','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','error','name','send','Users','map','TagIds','Tags','push','then','catch','index','FaxInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','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','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','\x20IS\x20NULL','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','includeAll','include','params','addMessage','FaxMessage','ids','omit','getMessages','options','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','files','tmp','join','attachments','format','Attachment','Messages','get','basename'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0xabc2,0x1b0));var _0x2abc=function(_0x25c88d,_0x48dcc7){_0x25c88d=_0x25c88d-0x0;var _0x2a2456=_0xabc2[_0x25c88d];return _0x2a2456;};'use strict';var emlformat=require(_0x2abc('0x0'));var rimraf=require(_0x2abc('0x1'));var zipdir=require(_0x2abc('0x2'));var jsonpatch=require(_0x2abc('0x3'));var rp=require(_0x2abc('0x4'));var moment=require(_0x2abc('0x5'));var BPromise=require(_0x2abc('0x6'));var Mustache=require(_0x2abc('0x7'));var util=require(_0x2abc('0x8'));var path=require(_0x2abc('0x9'));var sox=require('sox');var csv=require(_0x2abc('0xa'));var ejs=require(_0x2abc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2abc('0xc'));var crypto=require('crypto');var jsforce=require(_0x2abc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2abc('0xa'));var querystring=require(_0x2abc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2abc('0xf'));var qs=require(_0x2abc('0x10'));var as=require(_0x2abc('0x11'));var hardwareService=require(_0x2abc('0x12'));var logger=require(_0x2abc('0x13'))(_0x2abc('0x14'));var utils=require('../../config/utils');var config=require(_0x2abc('0x15'));var licenseUtil=require(_0x2abc('0x16'));var db=require(_0x2abc('0x17'))['db'];config['redis']=_[_0x2abc('0x18')](config[_0x2abc('0x19')],{'host':_0x2abc('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2abc('0x19')]));require(_0x2abc('0x1b'))['register'](socket);function respondWithStatusCode(_0x535bfa,_0x28e54d){_0x28e54d=_0x28e54d||0xcc;return function(_0x340eb1){if(_0x340eb1){return _0x535bfa[_0x2abc('0x1c')](_0x28e54d);}return _0x535bfa[_0x2abc('0x1d')](_0x28e54d)[_0x2abc('0x1e')]();};}function respondWithResult(_0x1d27be,_0x21dea1){_0x21dea1=_0x21dea1||0xc8;return function(_0x3e43b1){if(_0x3e43b1){return _0x1d27be['status'](_0x21dea1)['json'](_0x3e43b1);}};}function respondWithFilteredResult(_0x95ecba,_0x407ece){return function(_0xe88630){if(_0xe88630){var _0x2acad7=typeof _0x407ece[_0x2abc('0x1f')]===_0x2abc('0x20')&&typeof _0x407ece[_0x2abc('0x21')]===_0x2abc('0x20');var _0x2ae79d=_0xe88630[_0x2abc('0x22')];var _0x5c42fe=_0x2acad7?0x0:_0x407ece[_0x2abc('0x1f')];var _0x1e9c9f=_0x2acad7?_0xe88630[_0x2abc('0x22')]:_0x407ece[_0x2abc('0x1f')]+_0x407ece['limit'];var _0x7678b8;if(_0x1e9c9f>=_0x2ae79d){_0x1e9c9f=_0x2ae79d;_0x7678b8=0xc8;}else{_0x7678b8=0xce;}_0x95ecba[_0x2abc('0x1d')](_0x7678b8);return _0x95ecba[_0x2abc('0x23')]('Content-Range',_0x5c42fe+'-'+_0x1e9c9f+'/'+_0x2ae79d)[_0x2abc('0x24')](_0xe88630);}return null;};}function patchUpdates(_0x4c2500){return function(_0x3cb8cc){try{jsonpatch[_0x2abc('0x25')](_0x3cb8cc,_0x4c2500,!![]);}catch(_0x251f29){return BPromise[_0x2abc('0x26')](_0x251f29);}return _0x3cb8cc[_0x2abc('0x27')]();};}function saveUpdates(_0x2de641,_0x41bf28){return function(_0x324bae){if(_0x324bae){return _0x324bae[_0x2abc('0x28')](_0x2de641)['then'](function(_0x5244c7){return _0x5244c7;});}return null;};}function removeEntity(_0x4a5f11,_0x20a9f5){return function(_0xf7907b){if(_0xf7907b){return _0xf7907b[_0x2abc('0x29')]()['then'](function(){_0x4a5f11[_0x2abc('0x1d')](0xcc)[_0x2abc('0x1e')]();});}};}function handleEntityNotFound(_0x472310,_0x43a116){return function(_0x4c5863){if(!_0x4c5863){_0x472310[_0x2abc('0x1c')](0x194);}return _0x4c5863;};}function handleError(_0x345a68,_0x141f73){_0x141f73=_0x141f73||0x1f4;return function(_0x497b82){logger[_0x2abc('0x2a')](_0x497b82['stack']);if(_0x497b82['name']){delete _0x497b82[_0x2abc('0x2b')];}_0x345a68['status'](_0x141f73)[_0x2abc('0x2c')](_0x497b82);};}function getInteractionUsers(_0x959b66,_0x118154){return new BPromise(function(_0x227941,_0x4edb01){try{if(_0x118154[_0x959b66['id']]){_0x959b66[_0x2abc('0x2d')]=_[_0x2abc('0x2e')](_0x118154[_0x959b66['id']],function(_0x6713b8){return{'id':_0x6713b8['id'],'fullname':_0x6713b8['fullname']};});}}catch(_0x4be41a){_0x4edb01(_0x4be41a);}_0x227941(_0x959b66);});}function getInteractionTags(_0x3134cd,_0x3d51ab){return new BPromise(function(_0x194011,_0x47845c){try{if(_0x3134cd[_0x2abc('0x2f')]){_0x3134cd[_0x2abc('0x30')]=[];_0x3134cd[_0x2abc('0x2f')]['split'](',')['forEach'](function(_0x5a4c1f){_0x3134cd['Tags'][_0x2abc('0x31')](_0x3d51ab[_0x5a4c1f]);});}delete _0x3134cd[_0x2abc('0x2f')];}catch(_0x51c697){_0x47845c(_0x51c697);}_0x194011(_0x3134cd);});}function updateFaxInteraction(_0x31295b,_0x6f9fb8,_0x58dc90){return new BPromise(function(_0x2d7a4f,_0x4996e0){return getInteractionUsers(_0x31295b,_0x58dc90)[_0x2abc('0x32')](function(_0x5b8c5f){return getInteractionTags(_0x5b8c5f,_0x6f9fb8);})[_0x2abc('0x32')](function(_0x3bbde3){_0x2d7a4f(_0x3bbde3);})[_0x2abc('0x33')](function(_0x3cc639){_0x4996e0(_0x3cc639);});});}exports[_0x2abc('0x34')]=function(_0x18fb63,_0x8b3b8e){var _0x22e6fc={},_0x3131c7={},_0x28f95f={'count':0x0,'rows':[]};var _0x45d18d=_[_0x2abc('0x2e')](db[_0x2abc('0x35')][_0x2abc('0x36')],function(_0x543263){return{'name':_0x543263[_0x2abc('0x37')],'type':_0x543263[_0x2abc('0x38')]['key']};});_0x3131c7[_0x2abc('0x39')]=_['map'](_0x45d18d,'name');_0x3131c7[_0x2abc('0x3a')]=_['keys'](_0x18fb63[_0x2abc('0x3a')]);_0x3131c7[_0x2abc('0x3b')]=_[_0x2abc('0x3c')](_0x3131c7[_0x2abc('0x39')],_0x3131c7[_0x2abc('0x3a')]);_0x22e6fc[_0x2abc('0x3d')]=_[_0x2abc('0x3c')](_0x3131c7[_0x2abc('0x39')],qs['fields'](_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x3e')]));_0x22e6fc[_0x2abc('0x3d')]=_0x22e6fc[_0x2abc('0x3d')][_0x2abc('0x3f')]?_0x22e6fc[_0x2abc('0x3d')]:_0x3131c7[_0x2abc('0x39')];if(!_0x18fb63['query'][_0x2abc('0x40')](_0x2abc('0x41'))){_0x22e6fc['limit']=qs[_0x2abc('0x21')](_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x21')]);_0x22e6fc['offset']=qs['offset'](_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x1f')]);}_0x22e6fc[_0x2abc('0x42')]=qs[_0x2abc('0x43')](_0x18fb63[_0x2abc('0x3a')]['sort']);_0x22e6fc[_0x2abc('0x44')]=qs[_0x2abc('0x3b')](_[_0x2abc('0x45')](_0x18fb63[_0x2abc('0x3a')],_0x3131c7[_0x2abc('0x3b')]),_0x45d18d);var _0x2ea0f8=[];var _0x51dc3f=squel[_0x2abc('0x46')]()['field']('id')[_0x2abc('0x47')](_0x2abc('0x2b'))[_0x2abc('0x47')](_0x2abc('0x48'))[_0x2abc('0x49')](_0x2abc('0x4a'));var _0x5a80dd=squel[_0x2abc('0x46')]()['field'](_0x2abc('0x4b'))[_0x2abc('0x47')](_0x2abc('0x4c'))[_0x2abc('0x47')](_0x2abc('0x4d'))['from'](_0x2abc('0x4e'),'ui')[_0x2abc('0x4f')](_0x2abc('0x50'),'u',_0x2abc('0x51'));var _0x13efe3=squel[_0x2abc('0x46')]()[_0x2abc('0x49')](_0x2abc('0x52'),'i')[_0x2abc('0x4f')](_0x2abc('0x53'),'c',_0x2abc('0x54'))[_0x2abc('0x4f')](_0x2abc('0x50'),'o',_0x2abc('0x55'))['left_join'](_0x2abc('0x56'),'a',_0x2abc('0x57'))[_0x2abc('0x4f')](_0x2abc('0x58'),'me',_0x2abc('0x59'))[_0x2abc('0x4f')](_0x2abc('0x5a'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x2abc('0x4a'),'t',_0x2abc('0x5b'));var _0xa28860=squel[_0x2abc('0x5c')]();var _0x4aeafa=[];var _0x34b4ca=squel[_0x2abc('0x5c')]();var _0x3c31be;if(_0x18fb63['query'][_0x2abc('0x5d')]){_0x3c31be=as[_0x2abc('0x5e')](_0x18fb63[_0x2abc('0x3a')]['search']);var _0x3cc26f=_0x3c31be[_0x2abc('0x5f')];for(var _0x398ea4=0x0;_0x398ea4<_0x3c31be['conditions'][_0x2abc('0x3f')];_0x398ea4++){var _0x54de22=_0x3c31be[_0x2abc('0x60')][_0x398ea4];var _0x27a4bd='i';var _0x5a51c7=_[_0x2abc('0x61')](_0x45d18d,['name',_0x54de22[_0x2abc('0x47')]]);if(!_0x5a51c7){switch(_0x54de22['field']){case _0x2abc('0x62'):if(_0x54de22[_0x2abc('0x63')]==0x1){_0x13efe3['having']('`'+_0x54de22[_0x2abc('0x47')]+_0x2abc('0x64'));}else{_0x13efe3[_0x2abc('0x65')]('`'+_0x54de22[_0x2abc('0x47')]+'`\x20>\x200');}break;case _0x2abc('0x66'):if(_0x54de22['operator']===_0x2abc('0x67')){if(_0x54de22[_0x2abc('0x63')]['split']('\x20')[_0x2abc('0x3f')]>0x1){_0xa28860[_0x3cc26f](_0x2abc('0x68'),qs[_0x2abc('0x69')](_0x54de22[_0x2abc('0x63')]),null);}else{var _0x398d70='%'+_0x54de22[_0x2abc('0x63')]+'%';_0xa28860[_0x3cc26f](_0x2abc('0x6a'),_0x398d70,_0x398d70,_0x398d70);}}else{_0x5a51c7=_['find'](_0x45d18d,[_0x2abc('0x2b'),_0x2abc('0x6b')]);_0x54de22[_0x2abc('0x47')]=_0x2abc('0x6b');_0x263122=as[_0x2abc('0x6c')](_0x27a4bd,_0x5a51c7[_0x2abc('0x38')],_0x54de22);_0xa28860[_0x3cc26f](_0x263122[_0x2abc('0x6d')],_0x263122[_0x2abc('0x63')][_0x2abc('0x6e')],_0x263122[_0x2abc('0x63')][_0x2abc('0x1e')]);}break;case _0x2abc('0x6f'):var _0x4d3145=_0x54de22[_0x2abc('0x63')][_0x2abc('0x70')](',')['map'](function(_0xaa12ae){return Number(_0xaa12ae);});_0x4d3145['forEach'](function(_0x572363){_0x34b4ca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x572363+',%');});_0x4aeafa=_[_0x2abc('0x71')](_0x4aeafa,_0x4d3145);break;case'User':if(_0x54de22[_0x2abc('0x72')]===_0x2abc('0x67')){_0xa28860[_0x3cc26f](_0x2abc('0x73'),'%'+_0x54de22['value']+'%',null);}else{_0x5a51c7=_[_0x2abc('0x61')](_0x45d18d,[_0x2abc('0x2b'),_0x2abc('0x74')]);_0x54de22['field']=_0x2abc('0x74');_0x263122=as[_0x2abc('0x6c')](_0x27a4bd,_0x5a51c7['type'],_0x54de22);_0xa28860[_0x3cc26f](_0x263122['text'],_0x263122[_0x2abc('0x63')][_0x2abc('0x6e')],_0x263122[_0x2abc('0x63')][_0x2abc('0x1e')]);}break;case _0x2abc('0x75'):_0x263122=as[_0x2abc('0x6c')]('me',null,_0x54de22);_0xa28860[_0x3cc26f](_0x263122[_0x2abc('0x6d')],_0x263122[_0x2abc('0x63')][_0x2abc('0x6e')],_0x263122['value'][_0x2abc('0x1e')]);break;}}else{var _0x263122=as['buildExpression'](_0x27a4bd,_0x5a51c7['type'],_0x54de22);_0xa28860[_0x3cc26f](_0x263122[_0x2abc('0x6d')],_0x263122[_0x2abc('0x63')][_0x2abc('0x6e')],_0x263122[_0x2abc('0x63')][_0x2abc('0x1e')]);}}}else{var _0x6fcd14=_(_0x18fb63[_0x2abc('0x3a')])[_0x2abc('0x76')]()[_0x2abc('0x2e')](function(_0xafa5f7){return _[_0x2abc('0x77')](_0x45d18d,[_0x2abc('0x2b'),_0xafa5f7])?_0xafa5f7:undefined;})[_0x2abc('0x78')]()[_0x2abc('0x63')]();if(!_[_0x2abc('0x79')](_0x6fcd14)){_0x6fcd14[_0x2abc('0x7a')](function(_0x433baf){if(_0x433baf===_0x2abc('0x7b')){_0x13efe3[_0x2abc('0x44')](_0x2abc('0x7c'),[]['concat'](_0x18fb63[_0x2abc('0x3a')][_0x433baf]));}else if(_0x433baf===_0x2abc('0x7d')){var _0xab0dff=JSON[_0x2abc('0x7e')](_0x18fb63['query'][_0x433baf])[_0x2abc('0x7f')];var _0x1b29ab=JSON['parse'](_0x18fb63['query'][_0x433baf])[_0x2abc('0x80')];_0x13efe3[_0x2abc('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xab0dff,_0x1b29ab);}else{if(_0x18fb63['query'][_0x433baf]==='null'){_0x13efe3[_0x2abc('0x44')]('i.'+_0x433baf+_0x2abc('0x81'));}else{_0x13efe3['where']('i.'+_0x433baf+'\x20=\x20?',_0x18fb63[_0x2abc('0x3a')][_0x433baf]);}}});}if(_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x82')]){if(_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x82')]==0x1){_0x13efe3[_0x2abc('0x65')]('`unreadMessages`\x20=\x200');}else{_0x13efe3['having']('`unreadMessages`\x20>\x200');}}if(_0x18fb63['query'][_0x2abc('0x83')]){_0x4aeafa=_[_0x2abc('0x84')](_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x83')])?_0x18fb63['query'][_0x2abc('0x83')]:new Array(_0x18fb63[_0x2abc('0x3a')]['tag']);_0x4aeafa[_0x2abc('0x7a')](function(_0xf70f1a){_0x34b4ca['or'](_0x2abc('0x85'),'%,'+_0xf70f1a+',%');});}if(_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x86')]){var _0x5c5cc4=_0x18fb63['query'][_0x2abc('0x86')][_0x2abc('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5c5cc4)){_0xa28860['or'](_0x2abc('0x88'),_0x5c5cc4+'%')['or'](_0x2abc('0x89'),_0x5c5cc4+'%');}_0xa28860['or'](_0x2abc('0x8a'),_0x5c5cc4+'%');}}_0x13efe3[_0x2abc('0x44')](_0xa28860);_0x13efe3['group'](_0x2abc('0x8b'));var _0x3eca10={'type':db[_0x2abc('0x8c')][_0x2abc('0x8d')][_0x2abc('0x8e')],'raw':!![]};var _0x131a88=_0x13efe3[_0x2abc('0x8f')]();_0x131a88[_0x2abc('0x47')](_0x2abc('0x8b'));_0x131a88['field'](_0x2abc('0x90'),_0x2abc('0x62'));if(_0x22e6fc['order']){_0x22e6fc[_0x2abc('0x42')][_0x2abc('0x7a')](function(_0x4619e1){var _0x315913=_0x4619e1[0x0]===_0x2abc('0x91')?_0x4619e1[0x0]:'i.'+_0x4619e1[0x0];_0x13efe3['order'](_0x315913,_0x4619e1[0x1]===_0x2abc('0x92')?![]:!![]);});}if(!_[_0x2abc('0x79')](_0x4aeafa)){_0x13efe3[_0x2abc('0x65')](_0x34b4ca);_0x131a88[_0x2abc('0x44')](_0x2abc('0x93'),_0x4aeafa);}BPromise[_0x2abc('0x94')]()[_0x2abc('0x32')](function(){if(!_0x3c31be){if(_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x7b')])return;_0x131a88[_0x2abc('0x44')](_0x2abc('0x95'));_0x13efe3[_0x2abc('0x44')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x18fb63[_0x2abc('0x96')][_0x2abc('0x97')]!==_0x2abc('0x98'))return;return _0x18fb63[_0x2abc('0x96')][_0x2abc('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5be8fe){if(_[_0x2abc('0x79')](_0x5be8fe)){_0x131a88[_0x2abc('0x44')](_0x2abc('0x9a'));_0x13efe3['where'](_0x2abc('0x9a'));}else{_0x131a88[_0x2abc('0x44')]('i.FaxAccountId\x20IN\x20?',_[_0x2abc('0x2e')](_0x5be8fe,'id'));_0x13efe3['where'](_0x2abc('0x7c'),_[_0x2abc('0x2e')](_0x5be8fe,'id'));}});})[_0x2abc('0x32')](function(){if(_0x18fb63[_0x2abc('0x96')][_0x2abc('0x97')]==='agent'&&!_0x3c31be&&!_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x7b')])return[];return db[_0x2abc('0x9b')]['query'](_0x131a88['toString'](),_0x3eca10);})[_0x2abc('0x32')](function(_0x3b2fd8){_0x28f95f[_0x2abc('0x22')]=_0x3b2fd8[_0x2abc('0x3f')];if(_0x28f95f[_0x2abc('0x22')]===0x0)return[];return db['sequelize'][_0x2abc('0x3a')](_0x51dc3f[_0x2abc('0x9c')](),_0x3eca10)['then'](function(_0x2eeced){_0x2ea0f8=_[_0x2abc('0x9d')](_0x2eeced,'id');_0x3eca10=_[_0x2abc('0x9e')](_0x3eca10,{'model':db[_0x2abc('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18fb63[_0x2abc('0x3a')][_0x2abc('0x3e')]){_0x22e6fc[_0x2abc('0x3d')]['forEach'](function(_0x3c8dff){_0x13efe3[_0x2abc('0x47')]('i.'+_0x3c8dff);});}else{_0x13efe3[_0x2abc('0x47')](_0x2abc('0x90'),'unreadMessages');_0x13efe3[_0x2abc('0x47')]('a.key','Account.key');_0x13efe3[_0x2abc('0x47')](_0x2abc('0x9f'),'Account.mandatoryDisposition');_0x13efe3['field'](_0x2abc('0xa0'),'contactName');_0x13efe3['field'](_0x2abc('0xa1'));_0x13efe3[_0x2abc('0x47')](_0x2abc('0xa2'),'Contact.firstName');_0x13efe3[_0x2abc('0x47')](_0x2abc('0xa3'),_0x2abc('0xa4'));_0x13efe3[_0x2abc('0x47')](_0x2abc('0xa5'),_0x2abc('0xa6'));_0x13efe3[_0x2abc('0x47')]('c.phone',_0x2abc('0xa7'));_0x13efe3[_0x2abc('0x47')](_0x2abc('0xa8'),_0x2abc('0xa9'));_0x13efe3[_0x2abc('0x47')]('c.fax','Contact.fax');_0x13efe3[_0x2abc('0x47')](_0x2abc('0xaa'),_0x2abc('0xab'));_0x13efe3['field'](_0x2abc('0xac'),'Owner.internal');_0x13efe3['field'](_0x2abc('0xad'),'TagIds');}if(_0x22e6fc['limit'])_0x13efe3[_0x2abc('0x21')](_0x22e6fc['limit']);if(_0x22e6fc[_0x2abc('0x1f')])_0x13efe3[_0x2abc('0x1f')](_0x22e6fc[_0x2abc('0x1f')]);return db[_0x2abc('0x9b')][_0x2abc('0x3a')](_0x13efe3[_0x2abc('0x9c')](),_0x3eca10);})['then'](function(_0x529408){if(_0x529408[_0x2abc('0x3f')]>0x0)_0x5a80dd[_0x2abc('0x44')](_0x2abc('0xae'),_['map'](_0x529408,'id'));return db[_0x2abc('0x9b')]['query'](_0x5a80dd['toString'](),_0x3eca10)[_0x2abc('0x32')](function(_0x575da7){var _0x58eb7f=_[_0x2abc('0xaf')](_0x575da7,_0x2abc('0xb0'));var _0x35ea3c=[];_0x529408[_0x2abc('0x7a')](function(_0x3ed9be){_0x35ea3c['push'](updateFaxInteraction(_0x3ed9be,_0x2ea0f8,_0x58eb7f));});return BPromise[_0x2abc('0xb1')](_0x35ea3c);});});})[_0x2abc('0x32')](function(_0x568cdc){_0x28f95f[_0x2abc('0xb2')]=_0x568cdc;return _0x28f95f;})[_0x2abc('0x32')](respondWithFilteredResult(_0x8b3b8e,_0x22e6fc))[_0x2abc('0x33')](handleError(_0x8b3b8e,null));};exports[_0x2abc('0xb3')]=function(_0x51101f,_0x416cd5){var _0xece589={'raw':![],'where':{'id':_0x51101f['params']['id']}},_0x5a0984={};_0x5a0984[_0x2abc('0x39')]=_[_0x2abc('0x76')](db[_0x2abc('0x35')]['rawAttributes']);_0x5a0984[_0x2abc('0x3a')]=_[_0x2abc('0x76')](_0x51101f[_0x2abc('0x3a')]);_0x5a0984[_0x2abc('0x3b')]=_['intersection'](_0x5a0984['model'],_0x5a0984['query']);_0xece589['attributes']=_[_0x2abc('0x3c')](_0x5a0984[_0x2abc('0x39')],qs[_0x2abc('0x3e')](_0x51101f[_0x2abc('0x3a')][_0x2abc('0x3e')]));_0xece589[_0x2abc('0x3d')]=_0xece589['attributes'][_0x2abc('0x3f')]?_0xece589['attributes']:_0x5a0984[_0x2abc('0x39')];if(_0x51101f['query'][_0x2abc('0xb4')]){_0xece589[_0x2abc('0xb5')]=[{'all':!![]}];}_0xece589=_['merge']({},_0xece589,_0x51101f['options']);return db[_0x2abc('0x35')][_0x2abc('0x61')](_0xece589)[_0x2abc('0x32')](handleEntityNotFound(_0x416cd5,null))['then'](respondWithResult(_0x416cd5,null))['catch'](handleError(_0x416cd5,null));};exports['create']=function(_0x459395,_0x367ff3){return db['FaxInteraction']['create'](_0x459395[_0x2abc('0x75')],{})[_0x2abc('0x32')](respondWithResult(_0x367ff3,0xc9))[_0x2abc('0x33')](handleError(_0x367ff3,null));};exports['update']=function(_0x4b0e63,_0x3c6432){if(_0x4b0e63[_0x2abc('0x75')]['id']){delete _0x4b0e63[_0x2abc('0x75')]['id'];}return db[_0x2abc('0x35')][_0x2abc('0x61')]({'where':{'id':_0x4b0e63[_0x2abc('0xb6')]['id']}})[_0x2abc('0x32')](handleEntityNotFound(_0x3c6432,null))['then'](saveUpdates(_0x4b0e63[_0x2abc('0x75')],null))[_0x2abc('0x32')](respondWithResult(_0x3c6432,null))[_0x2abc('0x33')](handleError(_0x3c6432,null));};exports[_0x2abc('0x29')]=function(_0x209074,_0x55d5f2){return db[_0x2abc('0x35')][_0x2abc('0x61')]({'where':{'id':_0x209074[_0x2abc('0xb6')]['id']}})[_0x2abc('0x32')](handleEntityNotFound(_0x55d5f2,null))[_0x2abc('0x32')](removeEntity(_0x55d5f2,null))['catch'](handleError(_0x55d5f2,null));};exports['describe']=function(_0x2edb8e,_0x4f814c){return db[_0x2abc('0x35')]['describe']()[_0x2abc('0x32')](respondWithResult(_0x4f814c,null))['catch'](handleError(_0x4f814c,null));};exports[_0x2abc('0xb7')]=function(_0x4f0013,_0x542c3d,_0x19e5fa){return db[_0x2abc('0xb8')][_0x2abc('0x61')]({'where':{'id':_0x4f0013[_0x2abc('0xb6')]['id']}})[_0x2abc('0x32')](handleEntityNotFound(_0x542c3d,null))['then'](function(_0x3108dc){if(_0x3108dc){return _0x3108dc[_0x2abc('0xb7')](_0x4f0013['body'][_0x2abc('0xb9')],_[_0x2abc('0xba')](_0x4f0013['body'],[_0x2abc('0xb9'),'id'])||{});}})[_0x2abc('0x32')](respondWithResult(_0x542c3d,null))['catch'](handleError(_0x542c3d,null));};exports[_0x2abc('0xbb')]=function(_0x203353,_0xa89832,_0x341503){var _0x510922={'raw':![],'where':{}};var _0x595888={};var _0x2e00d6={'count':0x0,'rows':[]};return db[_0x2abc('0x35')]['findOne']({'where':{'id':_0x203353[_0x2abc('0xb6')]['id']}})[_0x2abc('0x32')](handleEntityNotFound(_0xa89832,null))[_0x2abc('0x32')](function(_0xed5865){if(_0xed5865){_0x595888[_0x2abc('0x39')]=_[_0x2abc('0x76')](db[_0x2abc('0xb8')][_0x2abc('0x36')]);_0x595888[_0x2abc('0x3a')]=_[_0x2abc('0x76')](_0x203353[_0x2abc('0x3a')]);_0x595888[_0x2abc('0x3b')]=_[_0x2abc('0x3c')](_0x595888[_0x2abc('0x39')],_0x595888[_0x2abc('0x3a')]);_0x510922[_0x2abc('0x3d')]=_[_0x2abc('0x3c')](_0x595888[_0x2abc('0x39')],qs[_0x2abc('0x3e')](_0x203353[_0x2abc('0x3a')][_0x2abc('0x3e')]));_0x510922[_0x2abc('0x3d')]=_0x510922[_0x2abc('0x3d')][_0x2abc('0x3f')]?_0x510922['attributes']:_0x595888[_0x2abc('0x39')];if(!_0x203353[_0x2abc('0x3a')][_0x2abc('0x40')](_0x2abc('0x41'))){_0x510922[_0x2abc('0x21')]=qs[_0x2abc('0x21')](_0x203353['query'][_0x2abc('0x21')]);_0x510922[_0x2abc('0x1f')]=qs['offset'](_0x203353['query']['offset']);}_0x510922[_0x2abc('0x42')]=qs[_0x2abc('0x43')](_0x203353[_0x2abc('0x3a')][_0x2abc('0x43')]);_0x510922[_0x2abc('0x44')]=qs[_0x2abc('0x3b')](_[_0x2abc('0x45')](_0x203353[_0x2abc('0x3a')],_0x595888[_0x2abc('0x3b')]));_0x510922[_0x2abc('0x44')][_0x2abc('0xb0')]=_0xed5865['id'];if(_0x203353['query'][_0x2abc('0x86')]){_0x510922[_0x2abc('0x44')]=_[_0x2abc('0x9e')](_0x510922[_0x2abc('0x44')],{'$or':_[_0x2abc('0x2e')](_0x510922[_0x2abc('0x3d')],function(_0x2c4c92){var _0x111e9e={};_0x111e9e[_0x2c4c92]={'$like':'%'+_0x203353['query']['filter']+'%'};return _0x111e9e;})});}if(_0x203353[_0x2abc('0x3a')][_0x2abc('0x7f')]){var _0x3193a0=_0x203353['query'][_0x2abc('0x7f')][_0x2abc('0x70')](',');var _0x36cc22={};_0x36cc22[_0x3193a0[0x0]]={'$gte':moment(_0x3193a0[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x510922[_0x2abc('0x44')]=_[_0x2abc('0x9e')](_0x510922[_0x2abc('0x44')],_0x36cc22);}_0x510922=_[_0x2abc('0x9e')]({},_0x510922,_0x203353[_0x2abc('0xbc')]);return db['FaxMessage'][_0x2abc('0x22')]({'where':_0x510922[_0x2abc('0x44')]})['then'](function(_0x19c210){_0x2e00d6[_0x2abc('0x22')]=_0x19c210;if(_0x203353[_0x2abc('0x3a')]['includeAll']){_0x510922['include']=[{'all':!![]}];}return db[_0x2abc('0xb8')][_0x2abc('0xbd')](_0x510922);})[_0x2abc('0x32')](function(_0x444895){_0x2e00d6[_0x2abc('0xb2')]=_0x444895;return _0x2e00d6;});}})[_0x2abc('0x32')](respondWithFilteredResult(_0xa89832,_0x510922))[_0x2abc('0x33')](handleError(_0xa89832,null));};exports[_0x2abc('0xbe')]=function(_0x4056c2,_0x284644,_0x3d6ce7){return db[_0x2abc('0x35')][_0x2abc('0x61')]({'where':{'id':_0x4056c2[_0x2abc('0xb6')]['id']}})[_0x2abc('0x32')](handleEntityNotFound(_0x284644,null))['then'](function(_0x5984c5){if(_0x5984c5){return _0x5984c5[_0x2abc('0xbf')](_0x4056c2['body'][_0x2abc('0xb9')],_[_0x2abc('0xba')](_0x4056c2[_0x2abc('0x75')],['ids','id'])||{})[_0x2abc('0xc0')](function(){return db[_0x2abc('0x6f')][_0x2abc('0xbd')]({'attributes':['id',_0x2abc('0x2b'),_0x2abc('0x48')],'where':{'id':_0x4056c2['body'][_0x2abc('0xb9')]}});})[_0x2abc('0x32')](function(_0x476194){socket[_0x2abc('0xc1')](_0x2abc('0xc2'),{'id':Number(_0x4056c2[_0x2abc('0xb6')]['id']),'tags':_0x476194||[]});return{'id':Number(_0x4056c2[_0x2abc('0xb6')]['id']),'tags':_0x476194||[]};});}})[_0x2abc('0x32')](respondWithResult(_0x284644,null))['catch'](handleError(_0x284644,null));};exports[_0x2abc('0xc3')]=function(_0x1d2445,_0x345ba2,_0x3d5414){return db['FaxInteraction'][_0x2abc('0x61')]({'where':{'id':_0x1d2445[_0x2abc('0xb6')]['id']}})[_0x2abc('0x32')](handleEntityNotFound(_0x345ba2,null))['then'](function(_0x1abd8e){if(_0x1abd8e){return _0x1abd8e['removeTags'](_0x1d2445['query'][_0x2abc('0xb9')]);}})[_0x2abc('0x32')](respondWithStatusCode(_0x345ba2,null))[_0x2abc('0x33')](handleError(_0x345ba2,null));};exports[_0x2abc('0xc4')]=function(_0x3f2c28,_0x2543e9){var _0x4de1af=moment()[_0x2abc('0xc5')]()[_0x2abc('0x9c')]();var _0x199676=path['join'](config['root'],'server',_0x2abc('0xc6'),_0x2abc('0xc7'));var _0x9414e0=path[_0x2abc('0xc8')](config['root'],'server',_0x2abc('0xc6'),_0x2abc('0xc9'));var _0x5c3aa9=path['join'](_0x199676,_0x4de1af);var _0x222b34=util[_0x2abc('0xca')]('transcript-%d-%s.zip',_0x3f2c28['params']['id'],_0x4de1af);var _0x4d9e6b=path[_0x2abc('0xc8')](_0x199676,_0x222b34);var _0x16a504=[];_0x16a504[_0x2abc('0x31')]({'model':db[_0x2abc('0xcb')],'as':'Attachment','raw':!![]});var _0x27c29c=[{'model':db[_0x2abc('0xb8')],'as':_0x2abc('0xcc'),'attributes':['id',_0x2abc('0x75'),'createdAt'],'include':_0x16a504}];return db[_0x2abc('0x35')][_0x2abc('0x61')]({'where':{'id':_0x3f2c28['params']['id']},'include':_0x27c29c})[_0x2abc('0x32')](handleEntityNotFound(_0x2543e9,null))[_0x2abc('0x32')](function(_0x3be3a6){if(_0x3be3a6&&_0x3be3a6[_0x2abc('0xcc')]){var _0xc82dce=_0x3be3a6[_0x2abc('0xcd')]({'plain':!![]});fs['mkdirSync'](_0x5c3aa9);for(var _0x4f682b=0x0;_0x4f682b<_0xc82dce['Messages'][_0x2abc('0x3f')];_0x4f682b++){var _0x2fecd6=_0xc82dce['Messages'][_0x4f682b]['Attachment'];if(_0x2fecd6){var _0x108f83=path['join'](_0x9414e0,_0x2fecd6[_0x2abc('0xce')]);if(fs[_0x2abc('0xcf')](_0x108f83)){fs[_0x2abc('0xd0')](_0x108f83)[_0x2abc('0xd1')](fs[_0x2abc('0xd2')](path[_0x2abc('0xc8')](_0x5c3aa9,_0x2fecd6[_0x2abc('0xce')])));}}}return BPromise[_0x2abc('0x94')]()[_0x2abc('0x32')](function(){return new BPromise(function(_0x411bd8,_0x40e9ea){zipdir(_0x5c3aa9,{'saveTo':_0x4d9e6b},function(_0xe4059d,_0x2a5d8f){if(_0xe4059d)return _0x40e9ea(_0xe4059d);return _0x411bd8(_0x2a5d8f);});})[_0x2abc('0x32')](function(){return new BPromise(function(_0x39f8e5,_0x22ebb7){rimraf(_0x5c3aa9,function(_0x388b27){if(_0x388b27)_0x22ebb7(_0x388b27);return _0x39f8e5();});});})[_0x2abc('0x32')](function(){return _0x2543e9[_0x2abc('0xc4')](_0x4d9e6b,_0x222b34,function(_0x2264fd){if(_0x2264fd){console[_0x2abc('0xd3')]('err',_0x2264fd);}else{fs[_0x2abc('0xd4')](_0x4d9e6b);}});});});}else{return _0x2543e9[_0x2abc('0x1c')](0xc8);}})[_0x2abc('0x33')](handleError(_0x2543e9,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b912e0c..f752854 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 _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x12f7fc,_0x4a036b){_0x12f7fc=_0x12f7fc-0x0;var _0xa92018=_0x2ef3[_0x12f7fc];return _0xa92018;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0xea8d00,_0x489e7d){var _0x18971b=function(_0x992eab){while(--_0x992eab){_0xea8d00['push'](_0xea8d00['shift']());}};_0x18971b(++_0x489e7d);}(_0x326f,0xd1));var _0xf326=function(_0x180c7f,_0x29b44f){_0x180c7f=_0x180c7f-0x0;var _0x283e5d=_0x326f[_0x180c7f];return _0x283e5d;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index cc8f315..47070fc 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 _0x6b37=['bluebird','path','rimraf','../../config/environment','exports','define','FaxInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0xc2d7e3,_0x574c35){var _0x489bbf=function(_0x20e236){while(--_0x20e236){_0xc2d7e3['push'](_0xc2d7e3['shift']());}};_0x489bbf(++_0x574c35);}(_0x6b37,0x137));var _0x76b3=function(_0x3f53fc,_0x2c4f7f){_0x3f53fc=_0x3f53fc-0x0;var _0x3b6f27=_0x6b37[_0x3f53fc];return _0x3b6f27;};'use strict';var _=require(_0x76b3('0x0'));var util=require(_0x76b3('0x1'));var logger=require(_0x76b3('0x2'))(_0x76b3('0x3'));var moment=require('moment');var BPromise=require(_0x76b3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76b3('0x5'));var rimraf=require(_0x76b3('0x6'));var config=require(_0x76b3('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x76b3('0x8')]=function(_0x978676,_0x1a3d39){return _0x978676[_0x76b3('0x9')](_0x76b3('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21c689,_0xb7c660,_0x2a1ebf){if(_0x21c689[_0x76b3('0xb')](_0x76b3('0xc'))){_0x21c689['closedAt']=moment()[_0x76b3('0xd')](_0x76b3('0xe'));}_0x2a1ebf(null,_0x21c689);}}});}; \ No newline at end of file +var _0x9d4b=['moment','request-promise','rimraf','../../config/environment','exports','define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x5ddba5,_0x28c93a){var _0x2ef219=function(_0x728447){while(--_0x728447){_0x5ddba5['push'](_0x5ddba5['shift']());}};_0x2ef219(++_0x28c93a);}(_0x9d4b,0xde));var _0xb9d4=function(_0x1c13da,_0x39f969){_0x1c13da=_0x1c13da-0x0;var _0x552cef=_0x9d4b[_0x1c13da];return _0x552cef;};'use strict';var _=require(_0xb9d4('0x0'));var util=require(_0xb9d4('0x1'));var logger=require('../../config/logger')(_0xb9d4('0x2'));var moment=require(_0xb9d4('0x3'));var BPromise=require('bluebird');var rp=require(_0xb9d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb9d4('0x5'));var config=require(_0xb9d4('0x6'));var attributes=require('./faxInteraction.attributes');module[_0xb9d4('0x7')]=function(_0x473fc9,_0xe25150){return _0x473fc9[_0xb9d4('0x8')](_0xb9d4('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47a16d,_0x5beec6,_0x391326){if(_0x47a16d[_0xb9d4('0xa')](_0xb9d4('0xb'))){_0x47a16d[_0xb9d4('0xc')]=moment()[_0xb9d4('0xd')](_0xb9d4('0xe'));}_0x391326(null,_0x47a16d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index ef228db..75b7190 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 _0x8d90=['stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug'];(function(_0x391364,_0x40cf10){var _0x4a261b=function(_0x1c3271){while(--_0x1c3271){_0x391364['push'](_0x391364['shift']());}};_0x4a261b(++_0x40cf10);}(_0x8d90,0xbc));var _0x08d9=function(_0x3ed105,_0x233827){_0x3ed105=_0x3ed105-0x0;var _0x3b9631=_0x8d90[_0x3ed105];return _0x3b9631;};'use strict';var _=require(_0x08d9('0x0'));var util=require(_0x08d9('0x1'));var moment=require(_0x08d9('0x2'));var BPromise=require(_0x08d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08d9('0x4'));var db=require(_0x08d9('0x5'))['db'];var utils=require(_0x08d9('0x6'));var logger=require(_0x08d9('0x7'))(_0x08d9('0x8'));var config=require(_0x08d9('0x9'));var jayson=require(_0x08d9('0xa'));var client=jayson['client'][_0x08d9('0xb')]({'port':0x232a});config[_0x08d9('0xc')]=_[_0x08d9('0xd')](config['redis'],{'host':_0x08d9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08d9('0xc')]));require(_0x08d9('0xf'))[_0x08d9('0x10')](socket);function respondWithRpcPromise(_0x3762c7,_0x2fb0da,_0x5cc1e9){return new BPromise(function(_0x38e55b,_0x41ab63){return client[_0x08d9('0x11')](_0x3762c7,_0x5cc1e9)[_0x08d9('0x12')](function(_0x3e39c2){logger[_0x08d9('0x13')](_0x08d9('0x14'),_0x2fb0da,'request\x20sent');logger[_0x08d9('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2fb0da,'request\x20sent',JSON[_0x08d9('0x16')](_0x3e39c2));if(_0x3e39c2['error']){if(_0x3e39c2[_0x08d9('0x17')][_0x08d9('0x18')]===0x1f4){logger[_0x08d9('0x17')](_0x08d9('0x14'),_0x2fb0da,_0x3e39c2[_0x08d9('0x17')][_0x08d9('0x19')]);return _0x41ab63(_0x3e39c2[_0x08d9('0x17')][_0x08d9('0x19')]);}logger[_0x08d9('0x17')](_0x08d9('0x14'),_0x2fb0da,_0x3e39c2[_0x08d9('0x17')]['message']);return _0x38e55b(_0x3e39c2[_0x08d9('0x17')][_0x08d9('0x19')]);}else{logger[_0x08d9('0x13')](_0x08d9('0x14'),_0x2fb0da,'request\x20sent');_0x38e55b(_0x3e39c2[_0x08d9('0x1a')][_0x08d9('0x19')]);}})[_0x08d9('0x1b')](function(_0x4b04ef){logger[_0x08d9('0x17')](_0x08d9('0x14'),_0x2fb0da,_0x4b04ef);_0x41ab63(_0x4b04ef);});});}exports[_0x08d9('0x1c')]=function(_0x5c4e5b){var _0x4c748d=this;return new Promise(function(_0x1ac7d1,_0x1a6a1f){return db[_0x08d9('0x1d')][_0x08d9('0x1e')](_0x5c4e5b['body'],{'raw':_0x5c4e5b[_0x08d9('0x1f')]?_0x5c4e5b['options'][_0x08d9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c4e5b[_0x08d9('0x1f')]?_0x5c4e5b[_0x08d9('0x1f')][_0x08d9('0x21')]||null:null,'attributes':_0x5c4e5b[_0x08d9('0x1f')]?_0x5c4e5b['options'][_0x08d9('0x22')]||null:null,'limit':_0x5c4e5b[_0x08d9('0x1f')]?_0x5c4e5b[_0x08d9('0x1f')]['limit']||null:null})['then'](function(_0x245f17){logger[_0x08d9('0x13')](_0x08d9('0x1c'),_0x5c4e5b);logger['debug']('UpdateFaxInteraction',_0x5c4e5b,JSON[_0x08d9('0x16')](_0x245f17));_0x1ac7d1(_0x245f17);})[_0x08d9('0x1b')](function(_0xc8cce4){logger[_0x08d9('0x17')](_0x08d9('0x1c'),_0xc8cce4[_0x08d9('0x19')],_0x5c4e5b);_0x1a6a1f(_0x4c748d[_0x08d9('0x17')](0x1f4,_0xc8cce4['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x21a758){return new Promise(function(_0x4b43c2,_0x139b72){return db[_0x08d9('0x1d')][_0x08d9('0x23')]({'where':_0x21a758[_0x08d9('0x1f')]?_0x21a758[_0x08d9('0x1f')]['where']||null:null})[_0x08d9('0x12')](function(_0x5e628b){if(_0x5e628b){return _0x5e628b[_0x08d9('0x24')](_0x21a758[_0x08d9('0x25')][_0x08d9('0x26')],_[_0x08d9('0x27')](_0x21a758['body'],[_0x08d9('0x26'),'id'])||{});}})[_0x08d9('0x28')](function(_0x477161){logger['info']('AddTags',_0x21a758);logger[_0x08d9('0x15')]('AddTags',_0x21a758,JSON[_0x08d9('0x16')](_0x477161));_0x4b43c2(_0x477161);})[_0x08d9('0x1b')](function(_0x333e35){logger[_0x08d9('0x17')](_0x08d9('0x29'),_0x333e35[_0x08d9('0x19')],_0x21a758);_0x139b72(_this['error'](0x1f4,_0x333e35[_0x08d9('0x19')]));});});}; \ No newline at end of file +var _0x392c=['debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','stringify','catch','AddTagsToFaxInteraction','find','ids','body','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','FaxInteraction,\x20%s,\x20%s'];(function(_0x1b046f,_0x8e5fa6){var _0x1f6c8f=function(_0x4a2f64){while(--_0x4a2f64){_0x1b046f['push'](_0x1b046f['shift']());}};_0x1f6c8f(++_0x8e5fa6);}(_0x392c,0x10d));var _0xc392=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x392c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc392('0x0'));var moment=require(_0xc392('0x1'));var BPromise=require(_0xc392('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc392('0x3'));var db=require(_0xc392('0x4'))['db'];var utils=require(_0xc392('0x5'));var logger=require(_0xc392('0x6'))('rpc');var config=require(_0xc392('0x7'));var jayson=require(_0xc392('0x8'));var client=jayson[_0xc392('0x9')][_0xc392('0xa')]({'port':0x232a});config[_0xc392('0xb')]=_[_0xc392('0xc')](config['redis'],{'host':_0xc392('0xd'),'port':0x18eb});var socket=require(_0xc392('0xe'))(new Redis(config[_0xc392('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x584c8f,_0x78149a,_0x5b1f9d){return new BPromise(function(_0x5d4f01,_0x4f128f){return client['request'](_0x584c8f,_0x5b1f9d)[_0xc392('0xf')](function(_0x5e5cc1){logger[_0xc392('0x10')](_0xc392('0x11'),_0x78149a,'request\x20sent');logger[_0xc392('0x12')](_0xc392('0x13'),_0x78149a,_0xc392('0x14'),JSON['stringify'](_0x5e5cc1));if(_0x5e5cc1[_0xc392('0x15')]){if(_0x5e5cc1[_0xc392('0x15')][_0xc392('0x16')]===0x1f4){logger[_0xc392('0x15')](_0xc392('0x11'),_0x78149a,_0x5e5cc1['error'][_0xc392('0x17')]);return _0x4f128f(_0x5e5cc1[_0xc392('0x15')]['message']);}logger[_0xc392('0x15')](_0xc392('0x11'),_0x78149a,_0x5e5cc1[_0xc392('0x15')]['message']);return _0x5d4f01(_0x5e5cc1[_0xc392('0x15')][_0xc392('0x17')]);}else{logger['info'](_0xc392('0x11'),_0x78149a,_0xc392('0x14'));_0x5d4f01(_0x5e5cc1[_0xc392('0x18')][_0xc392('0x17')]);}})['catch'](function(_0xc54bf9){logger[_0xc392('0x15')](_0xc392('0x11'),_0x78149a,_0xc54bf9);_0x4f128f(_0xc54bf9);});});}exports[_0xc392('0x19')]=function(_0x407ced){var _0x41694e=this;return new Promise(function(_0x4746ea,_0x1fb9dd){return db[_0xc392('0x1a')][_0xc392('0x1b')](_0x407ced['body'],{'raw':_0x407ced[_0xc392('0x1c')]?_0x407ced[_0xc392('0x1c')][_0xc392('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407ced[_0xc392('0x1c')]?_0x407ced[_0xc392('0x1c')][_0xc392('0x1e')]||null:null,'attributes':_0x407ced[_0xc392('0x1c')]?_0x407ced['options'][_0xc392('0x1f')]||null:null,'limit':_0x407ced[_0xc392('0x1c')]?_0x407ced['options'][_0xc392('0x20')]||null:null})[_0xc392('0xf')](function(_0x2478b0){logger['info']('UpdateFaxInteraction',_0x407ced);logger[_0xc392('0x12')](_0xc392('0x19'),_0x407ced,JSON[_0xc392('0x21')](_0x2478b0));_0x4746ea(_0x2478b0);})[_0xc392('0x22')](function(_0x1637d9){logger['error']('UpdateFaxInteraction',_0x1637d9[_0xc392('0x17')],_0x407ced);_0x1fb9dd(_0x41694e[_0xc392('0x15')](0x1f4,_0x1637d9[_0xc392('0x17')]));});});};exports[_0xc392('0x23')]=function(_0x49dd96){return new Promise(function(_0x33f780,_0x50e1c9){return db[_0xc392('0x1a')][_0xc392('0x24')]({'where':_0x49dd96['options']?_0x49dd96[_0xc392('0x1c')][_0xc392('0x1e')]||null:null})[_0xc392('0xf')](function(_0x1f554a){if(_0x1f554a){return _0x1f554a['addTags'](_0x49dd96['body'][_0xc392('0x25')],_['omit'](_0x49dd96[_0xc392('0x26')],['ids','id'])||{});}})[_0xc392('0x27')](function(_0x3a0929){logger[_0xc392('0x10')](_0xc392('0x28'),_0x49dd96);logger[_0xc392('0x12')](_0xc392('0x28'),_0x49dd96,JSON[_0xc392('0x21')](_0x3a0929));_0x33f780(_0x3a0929);})[_0xc392('0x22')](function(_0x1a0fd2){logger['error'](_0xc392('0x28'),_0x1a0fd2[_0xc392('0x17')],_0x49dd96);_0x50e1c9(_this['error'](0x1f4,_0x1a0fd2[_0xc392('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1003400..acafc36 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 _0x9541=['save','remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x4777cf,_0x2b2f23){var _0x3fdb90=function(_0x19fc1a){while(--_0x19fc1a){_0x4777cf['push'](_0x4777cf['shift']());}};_0x3fdb90(++_0x2b2f23);}(_0x9541,0x8f));var _0x1954=function(_0x14f9de,_0x19e5a0){_0x14f9de=_0x14f9de-0x0;var _0x3beaa9=_0x9541[_0x14f9de];return _0x3beaa9;};'use strict';var FaxInteractionEvents=require(_0x1954('0x0'));var events=[_0x1954('0x1'),_0x1954('0x2'),_0x1954('0x3')];function createListener(_0x366549,_0x51ed0b){return function(_0x50c440){_0x51ed0b[_0x1954('0x4')](_0x366549,_0x50c440);};}function removeListener(_0x1e4814,_0x2e0c68){return function(){FaxInteractionEvents[_0x1954('0x5')](_0x1e4814,_0x2e0c68);};}exports[_0x1954('0x6')]=function(_0x55ab4d){for(var _0x3d258d=0x0,_0x5748dd=events[_0x1954('0x7')];_0x3d258d<_0x5748dd;_0x3d258d++){var _0x1e34fc=events[_0x3d258d];var _0xdefb0=createListener(_0x1954('0x8')+_0x1e34fc,_0x55ab4d);FaxInteractionEvents['on'](_0x1e34fc,_0xdefb0);}}; \ No newline at end of file +var _0x8220=['faxInteraction:','./faxInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x260d17,_0x41db16){var _0x11dc8d=function(_0x1f0492){while(--_0x1f0492){_0x260d17['push'](_0x260d17['shift']());}};_0x11dc8d(++_0x41db16);}(_0x8220,0x171));var _0x0822=function(_0x48564d,_0x2c1c8c){_0x48564d=_0x48564d-0x0;var _0x2ad779=_0x8220[_0x48564d];return _0x2ad779;};'use strict';var FaxInteractionEvents=require(_0x0822('0x0'));var events=[_0x0822('0x1'),_0x0822('0x2'),_0x0822('0x3')];function createListener(_0x40cc90,_0x3f6bf1){return function(_0x5608af){_0x3f6bf1['emit'](_0x40cc90,_0x5608af);};}function removeListener(_0x3d3668,_0x3d1302){return function(){FaxInteractionEvents[_0x0822('0x4')](_0x3d3668,_0x3d1302);};}exports[_0x0822('0x5')]=function(_0x22e705){for(var _0x5de203=0x0,_0x1d7287=events[_0x0822('0x6')];_0x5de203<_0x1d7287;_0x5de203++){var _0x530069=events[_0x5de203];var _0x2b20dc=createListener(_0x0822('0x7')+_0x530069,_0x22e705);FaxInteractionEvents['on'](_0x530069,_0x2b20dc);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 81d1063..69d347d 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 _0x21ed=['delete','faxinteraction:destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','addTags','fax','faxinteraction:update','update'];(function(_0x1a3b1f,_0x5adda9){var _0x451118=function(_0x1556b4){while(--_0x1556b4){_0x1a3b1f['push'](_0x1a3b1f['shift']());}};_0x451118(++_0x5adda9);}(_0x21ed,0x1c3));var _0xd21e=function(_0x55eec9,_0x42e46a){_0x55eec9=_0x55eec9-0x0;var _0x536ec8=_0x21ed[_0x55eec9];return _0x536ec8;};'use strict';var multer=require(_0xd21e('0x0'));var util=require('util');var path=require(_0xd21e('0x1'));var timeout=require(_0xd21e('0x2'));var express=require(_0xd21e('0x3'));var router=express[_0xd21e('0x4')]();var fs_extra=require(_0xd21e('0x5'));var auth=require(_0xd21e('0x6'));var interaction=require(_0xd21e('0x7'));var config=require(_0xd21e('0x8'));var controller=require(_0xd21e('0x9'));router[_0xd21e('0xa')]('/',auth[_0xd21e('0xb')](),controller[_0xd21e('0xc')]);router[_0xd21e('0xa')](_0xd21e('0xd'),auth['isAuthenticated'](),controller[_0xd21e('0xe')]);router[_0xd21e('0xa')](_0xd21e('0xf'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x10')]);router[_0xd21e('0xa')](_0xd21e('0x11'),auth['isAuthenticated'](),controller[_0xd21e('0x12')]);router[_0xd21e('0xa')](_0xd21e('0x13'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x14')]);router[_0xd21e('0x15')]('/',auth[_0xd21e('0xb')](),controller['create']);router[_0xd21e('0x15')](_0xd21e('0x11'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x16')]);router['post'](_0xd21e('0x17'),auth[_0xd21e('0xb')](),interaction[_0xd21e('0x18')]('fax','faxinteraction:addtags'),controller[_0xd21e('0x19')]);router['put'](_0xd21e('0xf'),auth[_0xd21e('0xb')](),interaction[_0xd21e('0x18')](_0xd21e('0x1a'),_0xd21e('0x1b')),controller[_0xd21e('0x1c')]);router[_0xd21e('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0xd21e('0x18')](_0xd21e('0x1a'),_0xd21e('0x1e')),controller['destroy']);router[_0xd21e('0x1d')](_0xd21e('0x17'),auth['isAuthenticated'](),controller[_0xd21e('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xf4c0=['post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x2f0018,_0x575ead){var _0x533925=function(_0x39edf2){while(--_0x39edf2){_0x2f0018['push'](_0x2f0018['shift']());}};_0x533925(++_0x575ead);}(_0xf4c0,0x188));var _0x0f4c=function(_0x1c89c0,_0xdda8e8){_0x1c89c0=_0x1c89c0-0x0;var _0x10c840=_0xf4c0[_0x1c89c0];return _0x10c840;};'use strict';var multer=require(_0x0f4c('0x0'));var util=require('util');var path=require(_0x0f4c('0x1'));var timeout=require(_0x0f4c('0x2'));var express=require(_0x0f4c('0x3'));var router=express['Router']();var fs_extra=require(_0x0f4c('0x4'));var auth=require(_0x0f4c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f4c('0x6'));var controller=require('./faxInteraction.controller');router[_0x0f4c('0x7')]('/',auth[_0x0f4c('0x8')](),controller['index']);router[_0x0f4c('0x7')](_0x0f4c('0x9'),auth[_0x0f4c('0x8')](),controller[_0x0f4c('0xa')]);router['get'](_0x0f4c('0xb'),auth[_0x0f4c('0x8')](),controller[_0x0f4c('0xc')]);router[_0x0f4c('0x7')]('/:id/messages',auth[_0x0f4c('0x8')](),controller['getMessages']);router[_0x0f4c('0x7')]('/:id/download',auth[_0x0f4c('0x8')](),controller['download']);router[_0x0f4c('0xd')]('/',auth[_0x0f4c('0x8')](),controller[_0x0f4c('0xe')]);router[_0x0f4c('0xd')](_0x0f4c('0xf'),auth[_0x0f4c('0x8')](),controller[_0x0f4c('0x10')]);router[_0x0f4c('0xd')](_0x0f4c('0x11'),auth['isAuthenticated'](),interaction[_0x0f4c('0x12')](_0x0f4c('0x13'),_0x0f4c('0x14')),controller[_0x0f4c('0x15')]);router[_0x0f4c('0x16')](_0x0f4c('0xb'),auth['isAuthenticated'](),interaction[_0x0f4c('0x12')](_0x0f4c('0x13'),_0x0f4c('0x17')),controller[_0x0f4c('0x18')]);router['delete']('/:id',auth[_0x0f4c('0x8')](),interaction[_0x0f4c('0x12')](_0x0f4c('0x13'),'faxinteraction:destroy'),controller[_0x0f4c('0x19')]);router['delete'](_0x0f4c('0x11'),auth[_0x0f4c('0x8')](),controller['removeTags']);module[_0x0f4c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5998e20..fb4e8b5 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 _0x6264=['out','TEXT','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x231c5f,_0x10f3a5){var _0xd762ee=function(_0x5918de){while(--_0x5918de){_0x231c5f['push'](_0x231c5f['shift']());}};_0xd762ee(++_0x10f3a5);}(_0x6264,0x83));var _0x4626=function(_0x4f832f,_0x9a0d4){_0x4f832f=_0x4f832f-0x0;var _0x37ca5a=_0x6264[_0x4f832f];return _0x37ca5a;};'use strict';var Sequelize=require(_0x4626('0x0'));module[_0x4626('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4626('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4626('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4626('0x4')]('in',_0x4626('0x5')),'defaultValue':_0x4626('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4626('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4626('0x7')]}}; \ No newline at end of file +var _0xfa72=['DATE','exports','TEXT','medium','BOOLEAN','out'];(function(_0x121815,_0x46509f){var _0x559a27=function(_0x4a6cb0){while(--_0x4a6cb0){_0x121815['push'](_0x121815['shift']());}};_0x559a27(++_0x46509f);}(_0xfa72,0xa3));var _0x2fa7=function(_0x34acb2,_0x4d8b76){_0x34acb2=_0x34acb2-0x0;var _0x4df3ae=_0xfa72[_0x34acb2];return _0x4df3ae;};'use strict';var Sequelize=require('sequelize');module[_0x2fa7('0x0')]={'body':{'type':Sequelize[_0x2fa7('0x1')](_0x2fa7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2fa7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2fa7('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x2fa7('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2fa7('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8884b20..30fcb60 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 _0xf278=['map','FaxMessage','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','update','body','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','CmContact','Contact','get','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','startsWith','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','manual','interface','SIP/%s','event','EventManager','acceptmessage','reject','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','cf_','channel','rejectmessage','create','isNil','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','status'];(function(_0x2534a0,_0xda89db){var _0x3209c0=function(_0x1342c3){while(--_0x1342c3){_0x2534a0['push'](_0x2534a0['shift']());}};_0x3209c0(++_0xda89db);}(_0xf278,0xeb));var _0x8f27=function(_0x43b21d,_0x5d5677){_0x43b21d=_0x43b21d-0x0;var _0x1de400=_0xf278[_0x43b21d];return _0x1de400;};'use strict';var emlformat=require(_0x8f27('0x0'));var rimraf=require(_0x8f27('0x1'));var zipdir=require(_0x8f27('0x2'));var jsonpatch=require(_0x8f27('0x3'));var rp=require(_0x8f27('0x4'));var moment=require(_0x8f27('0x5'));var BPromise=require(_0x8f27('0x6'));var Mustache=require(_0x8f27('0x7'));var util=require('util');var path=require(_0x8f27('0x8'));var sox=require(_0x8f27('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f27('0xa'));var _=require(_0x8f27('0xb'));var squel=require(_0x8f27('0xc'));var crypto=require(_0x8f27('0xd'));var jsforce=require(_0x8f27('0xe'));var deskjs=require(_0x8f27('0xf'));var toCsv=require(_0x8f27('0x10'));var querystring=require(_0x8f27('0x11'));var Papa=require(_0x8f27('0x12'));var Redis=require(_0x8f27('0x13'));var authService=require(_0x8f27('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8f27('0x15'));var hardwareService=require(_0x8f27('0x16'));var logger=require(_0x8f27('0x17'))(_0x8f27('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8f27('0x19'));var db=require(_0x8f27('0x1a'))['db'];config[_0x8f27('0x1b')]=_[_0x8f27('0x1c')](config[_0x8f27('0x1b')],{'host':_0x8f27('0x1d'),'port':0x18eb});var socket=require(_0x8f27('0x1e'))(new Redis(config[_0x8f27('0x1b')]));require(_0x8f27('0x1f'))[_0x8f27('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8f27('0x21')][_0x8f27('0x22')]({'port':0x232c});var client9002=jayson[_0x8f27('0x21')][_0x8f27('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x9dfe9f,_0x3b11b5,_0xc9a6a1,_0x7ab57f){return new BPromise(function(_0x16ed10,_0x1ec0bf){var _0x43da99=_0x7ab57f||client;return _0x43da99[_0x8f27('0x23')](_0x9dfe9f,_0xc9a6a1)[_0x8f27('0x24')](function(_0x1b6c50){logger['info'](_0x8f27('0x25'),_0x3b11b5,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3b11b5,_0x8f27('0x26'),JSON[_0x8f27('0x27')](_0x1b6c50));if(_0x1b6c50[_0x8f27('0x28')]){if(_0x1b6c50[_0x8f27('0x28')][_0x8f27('0x29')]===0x1f4){logger[_0x8f27('0x28')](_0x8f27('0x25'),_0x3b11b5,_0x1b6c50[_0x8f27('0x28')][_0x8f27('0x2a')]);return _0x1ec0bf(_0x1b6c50[_0x8f27('0x28')][_0x8f27('0x2a')]);}logger[_0x8f27('0x28')](_0x8f27('0x25'),_0x3b11b5,_0x1b6c50[_0x8f27('0x28')]['message']);return _0x16ed10(_0x1b6c50['error']['message']);}else{logger[_0x8f27('0x2b')](_0x8f27('0x25'),_0x3b11b5,_0x8f27('0x26'));_0x16ed10(_0x1b6c50[_0x8f27('0x2c')][_0x8f27('0x2a')]);}})[_0x8f27('0x2d')](function(_0x10fee2){logger['error'](_0x8f27('0x25'),_0x3b11b5,_0x10fee2);_0x1ec0bf(_0x10fee2);});});}function respondWithStatusCode(_0x181824,_0x21d790){_0x21d790=_0x21d790||0xcc;return function(_0x52dfc4){if(_0x52dfc4){return _0x181824[_0x8f27('0x2e')](_0x21d790);}return _0x181824['status'](_0x21d790)[_0x8f27('0x2f')]();};}function respondWithResult(_0x1c79f0,_0x4c84df){_0x4c84df=_0x4c84df||0xc8;return function(_0xc4a0de){if(_0xc4a0de){return _0x1c79f0['status'](_0x4c84df)[_0x8f27('0x30')](_0xc4a0de);}};}function respondWithFilteredResult(_0x8ecac1,_0x10b16b){return function(_0x2b5b23){if(_0x2b5b23){var _0x309e90=typeof _0x10b16b['offset']==='undefined'&&typeof _0x10b16b['limit']===_0x8f27('0x31');var _0x49494a=_0x2b5b23[_0x8f27('0x32')];var _0x3484cf=_0x309e90?0x0:_0x10b16b[_0x8f27('0x33')];var _0x443a91=_0x309e90?_0x2b5b23[_0x8f27('0x32')]:_0x10b16b[_0x8f27('0x33')]+_0x10b16b[_0x8f27('0x34')];var _0x150501;if(_0x443a91>=_0x49494a){_0x443a91=_0x49494a;_0x150501=0xc8;}else{_0x150501=0xce;}_0x8ecac1['status'](_0x150501);return _0x8ecac1[_0x8f27('0x35')](_0x8f27('0x36'),_0x3484cf+'-'+_0x443a91+'/'+_0x49494a)[_0x8f27('0x30')](_0x2b5b23);}return null;};}function patchUpdates(_0x821a90){return function(_0x454a8e){try{jsonpatch[_0x8f27('0x37')](_0x454a8e,_0x821a90,!![]);}catch(_0x23b087){return BPromise['reject'](_0x23b087);}return _0x454a8e[_0x8f27('0x38')]();};}function saveUpdates(_0x5c44ee,_0x59554f){return function(_0x371afb){if(_0x371afb){return _0x371afb['update'](_0x5c44ee)['then'](function(_0x361fbc){return _0x361fbc;});}return null;};}function removeEntity(_0x54ecb0,_0x2c868f){return function(_0x41e9f3){if(_0x41e9f3){return _0x41e9f3[_0x8f27('0x39')]()['then'](function(){_0x54ecb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fea8e,_0xfce48a){return function(_0xa40d5a){if(!_0xa40d5a){_0x4fea8e['sendStatus'](0x194);}return _0xa40d5a;};}function handleError(_0x3737b0,_0xb3162d){_0xb3162d=_0xb3162d||0x1f4;return function(_0x400066){logger[_0x8f27('0x28')](_0x400066[_0x8f27('0x3a')]);if(_0x400066['name']){delete _0x400066[_0x8f27('0x3b')];}_0x3737b0[_0x8f27('0x3c')](_0xb3162d)['send'](_0x400066);};}exports['index']=function(_0x475f28,_0x5d7ecf){var _0x5d6a5f={},_0x1de6b8={},_0x29f5ab={'count':0x0,'rows':[]};var _0xf31391=_[_0x8f27('0x3d')](db[_0x8f27('0x3e')][_0x8f27('0x3f')],function(_0x1165e8){return{'name':_0x1165e8['fieldName'],'type':_0x1165e8['type'][_0x8f27('0x40')]};});_0x1de6b8['model']=_[_0x8f27('0x3d')](_0xf31391,_0x8f27('0x3b'));_0x1de6b8[_0x8f27('0x41')]=_[_0x8f27('0x42')](_0x475f28[_0x8f27('0x41')]);_0x1de6b8[_0x8f27('0x43')]=_[_0x8f27('0x44')](_0x1de6b8['model'],_0x1de6b8[_0x8f27('0x41')]);_0x5d6a5f['attributes']=_[_0x8f27('0x44')](_0x1de6b8[_0x8f27('0x45')],qs['fields'](_0x475f28[_0x8f27('0x41')][_0x8f27('0x46')]));_0x5d6a5f[_0x8f27('0x47')]=_0x5d6a5f[_0x8f27('0x47')][_0x8f27('0x48')]?_0x5d6a5f[_0x8f27('0x47')]:_0x1de6b8[_0x8f27('0x45')];if(!_0x475f28[_0x8f27('0x41')][_0x8f27('0x49')](_0x8f27('0x4a'))){_0x5d6a5f[_0x8f27('0x34')]=qs[_0x8f27('0x34')](_0x475f28['query'][_0x8f27('0x34')]);_0x5d6a5f[_0x8f27('0x33')]=qs[_0x8f27('0x33')](_0x475f28['query']['offset']);}_0x5d6a5f[_0x8f27('0x4b')]=qs[_0x8f27('0x4c')](_0x475f28['query'][_0x8f27('0x4c')]);_0x5d6a5f[_0x8f27('0x4d')]=qs['filters'](_[_0x8f27('0x4e')](_0x475f28[_0x8f27('0x41')],_0x1de6b8[_0x8f27('0x43')]),_0xf31391);if(_0x475f28[_0x8f27('0x41')][_0x8f27('0x4f')]){_0x5d6a5f[_0x8f27('0x4d')]=_[_0x8f27('0x50')](_0x5d6a5f[_0x8f27('0x4d')],{'$or':_[_0x8f27('0x3d')](_0xf31391,function(_0x7774ca){if(_0x7774ca['type']!==_0x8f27('0x51')){var _0x271c3e={};_0x271c3e[_0x7774ca[_0x8f27('0x3b')]]={'$like':'%'+_0x475f28[_0x8f27('0x41')][_0x8f27('0x4f')]+'%'};return _0x271c3e;}})});}_0x5d6a5f=_[_0x8f27('0x50')]({},_0x5d6a5f,_0x475f28[_0x8f27('0x52')]);var _0x3e78d6={'where':_0x5d6a5f[_0x8f27('0x4d')]};return db[_0x8f27('0x3e')][_0x8f27('0x32')](_0x3e78d6)[_0x8f27('0x24')](function(_0x140a05){_0x29f5ab['count']=_0x140a05;if(_0x475f28[_0x8f27('0x41')]['includeAll']){_0x5d6a5f[_0x8f27('0x53')]=[{'all':!![]}];}return db[_0x8f27('0x3e')][_0x8f27('0x54')](_0x5d6a5f);})[_0x8f27('0x24')](function(_0x4595ff){_0x29f5ab[_0x8f27('0x55')]=_0x4595ff;return _0x29f5ab;})[_0x8f27('0x24')](respondWithFilteredResult(_0x5d7ecf,_0x5d6a5f))[_0x8f27('0x2d')](handleError(_0x5d7ecf,null));};exports[_0x8f27('0x56')]=function(_0x379afd,_0x416b76){var _0xe489e1={'raw':!![],'where':{'id':_0x379afd[_0x8f27('0x57')]['id']}},_0x543973={};_0x543973[_0x8f27('0x45')]=_[_0x8f27('0x42')](db['FaxMessage'][_0x8f27('0x3f')]);_0x543973['query']=_[_0x8f27('0x42')](_0x379afd['query']);_0x543973[_0x8f27('0x43')]=_[_0x8f27('0x44')](_0x543973[_0x8f27('0x45')],_0x543973['query']);_0xe489e1[_0x8f27('0x47')]=_[_0x8f27('0x44')](_0x543973[_0x8f27('0x45')],qs[_0x8f27('0x46')](_0x379afd[_0x8f27('0x41')][_0x8f27('0x46')]));_0xe489e1[_0x8f27('0x47')]=_0xe489e1[_0x8f27('0x47')][_0x8f27('0x48')]?_0xe489e1[_0x8f27('0x47')]:_0x543973[_0x8f27('0x45')];if(_0x379afd[_0x8f27('0x41')][_0x8f27('0x58')]){_0xe489e1[_0x8f27('0x53')]=[{'all':!![]}];}_0xe489e1=_[_0x8f27('0x50')]({},_0xe489e1,_0x379afd[_0x8f27('0x52')]);return db[_0x8f27('0x3e')][_0x8f27('0x59')](_0xe489e1)['then'](handleEntityNotFound(_0x416b76,null))[_0x8f27('0x24')](respondWithResult(_0x416b76,null))[_0x8f27('0x2d')](handleError(_0x416b76,null));};exports[_0x8f27('0x5a')]=function(_0x18b5f4,_0x2cc840){if(_0x18b5f4[_0x8f27('0x5b')]['id']){delete _0x18b5f4[_0x8f27('0x5b')]['id'];}return db[_0x8f27('0x3e')][_0x8f27('0x59')]({'where':{'id':_0x18b5f4[_0x8f27('0x57')]['id']}})[_0x8f27('0x24')](handleEntityNotFound(_0x2cc840,null))[_0x8f27('0x24')](saveUpdates(_0x18b5f4[_0x8f27('0x5b')],null))[_0x8f27('0x24')](respondWithResult(_0x2cc840,null))['catch'](handleError(_0x2cc840,null));};exports['destroy']=function(_0x3b01b5,_0x3dc54e){return db[_0x8f27('0x3e')]['find']({'where':{'id':_0x3b01b5[_0x8f27('0x57')]['id']}})[_0x8f27('0x24')](handleEntityNotFound(_0x3dc54e,null))[_0x8f27('0x24')](removeEntity(_0x3dc54e,null))[_0x8f27('0x2d')](handleError(_0x3dc54e,null));};exports['describe']=function(_0x4fff1c,_0x256c41){return db['FaxMessage'][_0x8f27('0x5c')]()[_0x8f27('0x24')](respondWithResult(_0x256c41,null))[_0x8f27('0x2d')](handleError(_0x256c41,null));};var interaction_log=require(_0x8f27('0x17'))(_0x8f27('0x5d'));exports[_0x8f27('0x5e')]=function(_0x3411db,_0x4d8ab2,_0x4bd506){var _0x14a52b={'agent':{},'channel':_0x8f27('0x5f')};if(_0x3411db[_0x8f27('0x5b')]['id']){delete _0x3411db[_0x8f27('0x5b')]['id'];}_0x3411db[_0x8f27('0x5b')][_0x8f27('0x60')]=!![];_0x3411db[_0x8f27('0x5b')][_0x8f27('0x61')]=moment()[_0x8f27('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x3411db['body'][_0x8f27('0x63')]=_0x3411db[_0x8f27('0x5b')]['UserId']||_0x3411db[_0x8f27('0x64')]['id'];_0x14a52b[_0x8f27('0x65')]['id']=_0x3411db[_0x8f27('0x5b')][_0x8f27('0x63')];return db['FaxMessage']['find']({'where':{'id':_0x3411db[_0x8f27('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x8f27('0x66')],'as':_0x8f27('0x67')}]})[_0x8f27('0x24')](handleEntityNotFound(_0x4d8ab2,null))[_0x8f27('0x24')](saveUpdates(_0x3411db[_0x8f27('0x5b')],null))[_0x8f27('0x24')](function(_0x39b7b8){if(_0x39b7b8){_0x14a52b[_0x8f27('0x2a')]=_0x39b7b8[_0x8f27('0x68')]({'plain':!![]});return db['FaxInteraction'][_0x8f27('0x59')]({'where':{'id':_0x39b7b8[_0x8f27('0x69')]}});}return null;})[_0x8f27('0x24')](handleEntityNotFound(_0x4d8ab2,null))[_0x8f27('0x24')](function(_0x4ce3ce){if(_0x4ce3ce){return _0x4ce3ce[_0x8f27('0x5a')]({'UserId':_0x3411db[_0x8f27('0x5b')]['UserId'],'read1stAt':_['isNil'](_0x4ce3ce[_0x8f27('0x6a')])?moment()[_0x8f27('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8f27('0x24')](function(_0x5c80a9){if(_0x5c80a9){_0x14a52b[_0x8f27('0x6b')]=_0x5c80a9[_0x8f27('0x68')]({'plain':!![]});interaction_log[_0x8f27('0x2b')](_0x8f27('0x6c'),_0x3411db['user']['id'],_0x3411db['user'][_0x8f27('0x3b')],_0x3411db[_0x8f27('0x64')][_0x8f27('0x6d')],_0x14a52b['interaction']['id'],_0x3411db[_0x8f27('0x5b')]?JSON[_0x8f27('0x27')](_0x3411db[_0x8f27('0x5b')]):'null');return respondWithRpcPromise(_0x8f27('0x6e'),_0x8f27('0x6f'),_0x14a52b);}return null;})[_0x8f27('0x24')](function(_0x18eddc){return db['CmContact']['describe']()[_0x8f27('0x24')](function(_0x444b08){var _0x510d39=[];for(var _0x58c333=0x0;_0x58c333=_0x5c0413){_0x3477b5=_0x5c0413;_0x55db24=0xc8;}else{_0x55db24=0xce;}_0x17dd14['status'](_0x55db24);return _0x17dd14[_0xb285('0x33')](_0xb285('0x34'),_0x1077d9+'-'+_0x3477b5+'/'+_0x5c0413)[_0xb285('0x2e')](_0x356f71);}return null;};}function patchUpdates(_0x318b12){return function(_0x2d4c8f){try{jsonpatch[_0xb285('0x35')](_0x2d4c8f,_0x318b12,!![]);}catch(_0x40192b){return BPromise[_0xb285('0x36')](_0x40192b);}return _0x2d4c8f[_0xb285('0x37')]();};}function saveUpdates(_0x4d0b54,_0x31e260){return function(_0x38fcd9){if(_0x38fcd9){return _0x38fcd9[_0xb285('0x38')](_0x4d0b54)[_0xb285('0x22')](function(_0x463d85){return _0x463d85;});}return null;};}function removeEntity(_0x50ecf6,_0x4516bb){return function(_0x3212eb){if(_0x3212eb){return _0x3212eb['destroy']()[_0xb285('0x22')](function(){_0x50ecf6[_0xb285('0x2c')](0xcc)[_0xb285('0x2d')]();});}};}function handleEntityNotFound(_0x20cf6c,_0x40564c){return function(_0x300afa){if(!_0x300afa){_0x20cf6c[_0xb285('0x39')](0x194);}return _0x300afa;};}function handleError(_0x2b48d0,_0x412377){_0x412377=_0x412377||0x1f4;return function(_0x33bbda){logger[_0xb285('0x29')](_0x33bbda[_0xb285('0x3a')]);if(_0x33bbda[_0xb285('0x3b')]){delete _0x33bbda[_0xb285('0x3b')];}_0x2b48d0[_0xb285('0x2c')](_0x412377)[_0xb285('0x3c')](_0x33bbda);};}exports[_0xb285('0x3d')]=function(_0x529262,_0x1e93c4){var _0x5d2b88={},_0x2fee04={},_0x1fab2e={'count':0x0,'rows':[]};var _0x26975b=_[_0xb285('0x3e')](db[_0xb285('0x3f')][_0xb285('0x40')],function(_0x1d7b65){return{'name':_0x1d7b65['fieldName'],'type':_0x1d7b65[_0xb285('0x41')][_0xb285('0x42')]};});_0x2fee04[_0xb285('0x43')]=_[_0xb285('0x3e')](_0x26975b,_0xb285('0x3b'));_0x2fee04[_0xb285('0x44')]=_[_0xb285('0x45')](_0x529262['query']);_0x2fee04[_0xb285('0x46')]=_['intersection'](_0x2fee04[_0xb285('0x43')],_0x2fee04[_0xb285('0x44')]);_0x5d2b88[_0xb285('0x47')]=_['intersection'](_0x2fee04[_0xb285('0x43')],qs[_0xb285('0x48')](_0x529262[_0xb285('0x44')][_0xb285('0x48')]));_0x5d2b88[_0xb285('0x47')]=_0x5d2b88[_0xb285('0x47')][_0xb285('0x49')]?_0x5d2b88[_0xb285('0x47')]:_0x2fee04[_0xb285('0x43')];if(!_0x529262[_0xb285('0x44')][_0xb285('0x4a')](_0xb285('0x4b'))){_0x5d2b88[_0xb285('0x31')]=qs['limit'](_0x529262[_0xb285('0x44')][_0xb285('0x31')]);_0x5d2b88[_0xb285('0x2f')]=qs[_0xb285('0x2f')](_0x529262[_0xb285('0x44')]['offset']);}_0x5d2b88['order']=qs[_0xb285('0x4c')](_0x529262[_0xb285('0x44')][_0xb285('0x4c')]);_0x5d2b88[_0xb285('0x4d')]=qs['filters'](_[_0xb285('0x4e')](_0x529262[_0xb285('0x44')],_0x2fee04['filters']),_0x26975b);if(_0x529262[_0xb285('0x44')]['filter']){_0x5d2b88[_0xb285('0x4d')]=_[_0xb285('0x4f')](_0x5d2b88['where'],{'$or':_['map'](_0x26975b,function(_0x16a938){if(_0x16a938['type']!=='VIRTUAL'){var _0x31d962={};_0x31d962[_0x16a938[_0xb285('0x3b')]]={'$like':'%'+_0x529262['query'][_0xb285('0x50')]+'%'};return _0x31d962;}})});}_0x5d2b88=_[_0xb285('0x4f')]({},_0x5d2b88,_0x529262['options']);var _0x8aa940={'where':_0x5d2b88[_0xb285('0x4d')]};return db[_0xb285('0x3f')]['count'](_0x8aa940)[_0xb285('0x22')](function(_0x3fe9f4){_0x1fab2e['count']=_0x3fe9f4;if(_0x529262[_0xb285('0x44')]['includeAll']){_0x5d2b88['include']=[{'all':!![]}];}return db['FaxMessage'][_0xb285('0x51')](_0x5d2b88);})['then'](function(_0x309dde){_0x1fab2e[_0xb285('0x52')]=_0x309dde;return _0x1fab2e;})[_0xb285('0x22')](respondWithFilteredResult(_0x1e93c4,_0x5d2b88))['catch'](handleError(_0x1e93c4,null));};exports['show']=function(_0x3f7575,_0x5894ec){var _0x136a54={'raw':!![],'where':{'id':_0x3f7575[_0xb285('0x53')]['id']}},_0x11c6cd={};_0x11c6cd[_0xb285('0x43')]=_[_0xb285('0x45')](db[_0xb285('0x3f')][_0xb285('0x40')]);_0x11c6cd['query']=_['keys'](_0x3f7575[_0xb285('0x44')]);_0x11c6cd['filters']=_[_0xb285('0x54')](_0x11c6cd[_0xb285('0x43')],_0x11c6cd[_0xb285('0x44')]);_0x136a54['attributes']=_[_0xb285('0x54')](_0x11c6cd[_0xb285('0x43')],qs[_0xb285('0x48')](_0x3f7575[_0xb285('0x44')][_0xb285('0x48')]));_0x136a54[_0xb285('0x47')]=_0x136a54[_0xb285('0x47')][_0xb285('0x49')]?_0x136a54['attributes']:_0x11c6cd[_0xb285('0x43')];if(_0x3f7575[_0xb285('0x44')][_0xb285('0x55')]){_0x136a54['include']=[{'all':!![]}];}_0x136a54=_[_0xb285('0x4f')]({},_0x136a54,_0x3f7575[_0xb285('0x56')]);return db[_0xb285('0x3f')]['find'](_0x136a54)[_0xb285('0x22')](handleEntityNotFound(_0x5894ec,null))[_0xb285('0x22')](respondWithResult(_0x5894ec,null))['catch'](handleError(_0x5894ec,null));};exports['update']=function(_0x22a121,_0x1b7f73){if(_0x22a121[_0xb285('0x57')]['id']){delete _0x22a121[_0xb285('0x57')]['id'];}return db[_0xb285('0x3f')][_0xb285('0x58')]({'where':{'id':_0x22a121[_0xb285('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b7f73,null))[_0xb285('0x22')](saveUpdates(_0x22a121[_0xb285('0x57')],null))['then'](respondWithResult(_0x1b7f73,null))[_0xb285('0x59')](handleError(_0x1b7f73,null));};exports[_0xb285('0x5a')]=function(_0x56819a,_0x3cfcb2){return db[_0xb285('0x3f')][_0xb285('0x58')]({'where':{'id':_0x56819a[_0xb285('0x53')]['id']}})[_0xb285('0x22')](handleEntityNotFound(_0x3cfcb2,null))[_0xb285('0x22')](removeEntity(_0x3cfcb2,null))[_0xb285('0x59')](handleError(_0x3cfcb2,null));};exports[_0xb285('0x5b')]=function(_0x217c2a,_0x31d41c){return db[_0xb285('0x3f')][_0xb285('0x5b')]()[_0xb285('0x22')](respondWithResult(_0x31d41c,null))['catch'](handleError(_0x31d41c,null));};var interaction_log=require(_0xb285('0x13'))(_0xb285('0x5c'));exports[_0xb285('0x5d')]=function(_0x3ffa26,_0x500b43,_0x23f35e){var _0x33c8a8={'agent':{},'channel':'fax'};if(_0x3ffa26[_0xb285('0x57')]['id']){delete _0x3ffa26[_0xb285('0x57')]['id'];}_0x3ffa26[_0xb285('0x57')][_0xb285('0x5e')]=!![];_0x3ffa26[_0xb285('0x57')][_0xb285('0x5f')]=moment()['format'](_0xb285('0x60'));_0x3ffa26[_0xb285('0x57')][_0xb285('0x61')]=_0x3ffa26[_0xb285('0x57')][_0xb285('0x61')]||_0x3ffa26[_0xb285('0x62')]['id'];_0x33c8a8[_0xb285('0x63')]['id']=_0x3ffa26[_0xb285('0x57')][_0xb285('0x61')];return db[_0xb285('0x3f')][_0xb285('0x58')]({'where':{'id':_0x3ffa26['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xb285('0x64')}]})[_0xb285('0x22')](handleEntityNotFound(_0x500b43,null))[_0xb285('0x22')](saveUpdates(_0x3ffa26[_0xb285('0x57')],null))[_0xb285('0x22')](function(_0x19f4ec){if(_0x19f4ec){_0x33c8a8[_0xb285('0x2b')]=_0x19f4ec[_0xb285('0x65')]({'plain':!![]});return db['FaxInteraction'][_0xb285('0x58')]({'where':{'id':_0x19f4ec['FaxInteractionId']}});}return null;})[_0xb285('0x22')](handleEntityNotFound(_0x500b43,null))[_0xb285('0x22')](function(_0x295e1c){if(_0x295e1c){return _0x295e1c[_0xb285('0x38')]({'UserId':_0x3ffa26[_0xb285('0x57')][_0xb285('0x61')],'read1stAt':_[_0xb285('0x66')](_0x295e1c[_0xb285('0x67')])?moment()[_0xb285('0x68')](_0xb285('0x60')):undefined});}return null;})[_0xb285('0x22')](function(_0x481253){if(_0x481253){_0x33c8a8[_0xb285('0x69')]=_0x481253[_0xb285('0x65')]({'plain':!![]});interaction_log[_0xb285('0x23')](_0xb285('0x6a'),_0x3ffa26[_0xb285('0x62')]['id'],_0x3ffa26[_0xb285('0x62')][_0xb285('0x3b')],_0x3ffa26[_0xb285('0x62')]['role'],_0x33c8a8['interaction']['id'],_0x3ffa26[_0xb285('0x57')]?JSON[_0xb285('0x28')](_0x3ffa26['body']):'null');return respondWithRpcPromise(_0xb285('0x6b'),'acceptMessage',_0x33c8a8);}return null;})[_0xb285('0x22')](function(_0x55851c){return db[_0xb285('0x6c')]['describe']()[_0xb285('0x22')](function(_0x3dd7e4){var _0x5beeb6=[];for(var _0x503789=0x0;_0x503789=_0x220a63){_0x3103fe=_0x220a63;_0x6ee0b1=0xc8;}else{_0x6ee0b1=0xce;}_0x34cf20[_0x2250('0x1c')](_0x6ee0b1);return _0x34cf20[_0x2250('0x22')](_0x2250('0x23'),_0x58245a+'-'+_0x3103fe+'/'+_0x220a63)['json'](_0x48aa3c);}return null;};}function patchUpdates(_0x4aef9f){return function(_0x4c96be){try{jsonpatch[_0x2250('0x24')](_0x4c96be,_0x4aef9f,!![]);}catch(_0x54fef6){return BPromise[_0x2250('0x25')](_0x54fef6);}return _0x4c96be[_0x2250('0x26')]();};}function saveUpdates(_0x4238e9,_0x31c08b){return function(_0x56f9f1){if(_0x56f9f1){return _0x56f9f1[_0x2250('0x27')](_0x4238e9)[_0x2250('0x28')](function(_0x29cd38){return _0x29cd38;});}return null;};}function removeEntity(_0x52d1dd,_0x298bc1){return function(_0x2e2c14){if(_0x2e2c14){return _0x2e2c14[_0x2250('0x29')]()['then'](function(){var _0x20de71=_0x2e2c14[_0x2250('0x2a')]({'plain':!![]});var _0x12a9a4=_0x2250('0x2b');return db['UserProfileResource'][_0x2250('0x29')]({'where':{'type':_0x12a9a4,'resourceId':_0x20de71['id']}})[_0x2250('0x28')](function(){return _0x2e2c14;});})[_0x2250('0x28')](function(){_0x52d1dd[_0x2250('0x1c')](0xcc)[_0x2250('0x1d')]();});}};}function handleEntityNotFound(_0x279edc,_0x1bd31d){return function(_0x32c091){if(!_0x32c091){_0x279edc[_0x2250('0x2c')](0x194);}return _0x32c091;};}function handleError(_0x20cbe2,_0x4f90e7){_0x4f90e7=_0x4f90e7||0x1f4;return function(_0x388786){logger[_0x2250('0x2d')](_0x388786[_0x2250('0x2e')]);if(_0x388786[_0x2250('0x2f')]){delete _0x388786['name'];}_0x20cbe2[_0x2250('0x1c')](_0x4f90e7)['send'](_0x388786);};}exports[_0x2250('0x30')]=function(_0x405e1a,_0x593f9f){var _0x3fc7f1={},_0x51daa3={},_0x158835={'count':0x0,'rows':[]};var _0x458cb5=_[_0x2250('0x31')](db[_0x2250('0x32')]['rawAttributes'],function(_0x5bec11){return{'name':_0x5bec11['fieldName'],'type':_0x5bec11[_0x2250('0x33')][_0x2250('0x34')]};});_0x51daa3['model']=_[_0x2250('0x31')](_0x458cb5,'name');_0x51daa3[_0x2250('0x35')]=_[_0x2250('0x36')](_0x405e1a['query']);_0x51daa3[_0x2250('0x37')]=_['intersection'](_0x51daa3[_0x2250('0x38')],_0x51daa3['query']);_0x3fc7f1[_0x2250('0x39')]=_[_0x2250('0x3a')](_0x51daa3[_0x2250('0x38')],qs[_0x2250('0x3b')](_0x405e1a['query'][_0x2250('0x3b')]));_0x3fc7f1[_0x2250('0x39')]=_0x3fc7f1['attributes'][_0x2250('0x3c')]?_0x3fc7f1[_0x2250('0x39')]:_0x51daa3['model'];if(!_0x405e1a[_0x2250('0x35')]['hasOwnProperty'](_0x2250('0x3d'))){_0x3fc7f1[_0x2250('0x3e')]=qs['limit'](_0x405e1a[_0x2250('0x35')][_0x2250('0x3e')]);_0x3fc7f1[_0x2250('0x1f')]=qs[_0x2250('0x1f')](_0x405e1a[_0x2250('0x35')][_0x2250('0x1f')]);}_0x3fc7f1[_0x2250('0x3f')]=qs[_0x2250('0x40')](_0x405e1a[_0x2250('0x35')]['sort']);_0x3fc7f1['where']=qs[_0x2250('0x37')](_[_0x2250('0x41')](_0x405e1a[_0x2250('0x35')],_0x51daa3['filters']),_0x458cb5);if(_0x405e1a[_0x2250('0x35')][_0x2250('0x42')]){_0x3fc7f1[_0x2250('0x43')]=_['merge'](_0x3fc7f1[_0x2250('0x43')],{'$or':_[_0x2250('0x31')](_0x458cb5,function(_0x2053b7){if(_0x2053b7[_0x2250('0x33')]!==_0x2250('0x44')){var _0x542a80={};_0x542a80[_0x2053b7['name']]={'$like':'%'+_0x405e1a[_0x2250('0x35')]['filter']+'%'};return _0x542a80;}})});}_0x3fc7f1=_[_0x2250('0x45')]({},_0x3fc7f1,_0x405e1a['options']);var _0x273c52={'where':_0x3fc7f1['where']};return db[_0x2250('0x32')][_0x2250('0x21')](_0x273c52)[_0x2250('0x28')](function(_0x1b9fbb){_0x158835[_0x2250('0x21')]=_0x1b9fbb;if(_0x405e1a[_0x2250('0x35')][_0x2250('0x46')]){_0x3fc7f1[_0x2250('0x47')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x3fc7f1);})[_0x2250('0x28')](function(_0x7aaf98){_0x158835['rows']=_0x7aaf98;return _0x158835;})['then'](respondWithFilteredResult(_0x593f9f,_0x3fc7f1))[_0x2250('0x48')](handleError(_0x593f9f,null));};exports['show']=function(_0x2fb66e,_0x3dabf1){var _0x5886ed={'raw':!![],'where':{'id':_0x2fb66e[_0x2250('0x49')]['id']}},_0x4ebeb0={};_0x4ebeb0[_0x2250('0x38')]=_[_0x2250('0x36')](db[_0x2250('0x32')][_0x2250('0x4a')]);_0x4ebeb0[_0x2250('0x35')]=_[_0x2250('0x36')](_0x2fb66e['query']);_0x4ebeb0[_0x2250('0x37')]=_[_0x2250('0x3a')](_0x4ebeb0[_0x2250('0x38')],_0x4ebeb0[_0x2250('0x35')]);_0x5886ed[_0x2250('0x39')]=_[_0x2250('0x3a')](_0x4ebeb0['model'],qs['fields'](_0x2fb66e['query'][_0x2250('0x3b')]));_0x5886ed['attributes']=_0x5886ed['attributes'][_0x2250('0x3c')]?_0x5886ed['attributes']:_0x4ebeb0['model'];if(_0x2fb66e['query'][_0x2250('0x46')]){_0x5886ed[_0x2250('0x47')]=[{'all':!![]}];}_0x5886ed=_['merge']({},_0x5886ed,_0x2fb66e[_0x2250('0x4b')]);return db[_0x2250('0x32')][_0x2250('0x4c')](_0x5886ed)['then'](handleEntityNotFound(_0x3dabf1,null))[_0x2250('0x28')](respondWithResult(_0x3dabf1,null))['catch'](handleError(_0x3dabf1,null));};exports['create']=function(_0x415416,_0x569408){return db[_0x2250('0x32')][_0x2250('0x4d')](_0x415416['body'],{})[_0x2250('0x28')](function(_0x19fcb9){var _0x382885=_0x415416[_0x2250('0x4e')][_0x2250('0x2a')]({'plain':!![]});if(!_0x382885)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x382885[_0x2250('0x4f')]===_0x2250('0x4e')){var _0x5e2688=_0x19fcb9[_0x2250('0x2a')]({'plain':!![]});var _0x45d619=_0x2250('0x2b');return db[_0x2250('0x50')][_0x2250('0x4c')]({'where':{'name':_0x45d619,'userProfileId':_0x382885[_0x2250('0x51')]},'raw':!![]})[_0x2250('0x28')](function(_0x2ad8a5){if(_0x2ad8a5&&_0x2ad8a5[_0x2250('0x52')]===0x0){return db[_0x2250('0x53')][_0x2250('0x4d')]({'name':_0x5e2688[_0x2250('0x2f')],'resourceId':_0x5e2688['id'],'type':_0x2ad8a5['name'],'sectionId':_0x2ad8a5['id']},{})[_0x2250('0x28')](function(){return _0x19fcb9;});}else{return _0x19fcb9;}})[_0x2250('0x48')](function(_0x5e050a){logger[_0x2250('0x2d')](_0x2250('0x54'),_0x5e050a);throw _0x5e050a;});}return _0x19fcb9;})['then'](respondWithResult(_0x569408,0xc9))['catch'](handleError(_0x569408,null));};exports['update']=function(_0x1dba05,_0x420e3f){if(_0x1dba05[_0x2250('0x55')]['id']){delete _0x1dba05['body']['id'];}return db['FaxQueue'][_0x2250('0x4c')]({'where':{'id':_0x1dba05[_0x2250('0x49')]['id']}})[_0x2250('0x28')](handleEntityNotFound(_0x420e3f,null))[_0x2250('0x28')](saveUpdates(_0x1dba05[_0x2250('0x55')],null))[_0x2250('0x28')](respondWithResult(_0x420e3f,null))[_0x2250('0x48')](handleError(_0x420e3f,null));};exports['destroy']=function(_0xbca4b9,_0x1620ae){return db[_0x2250('0x32')][_0x2250('0x4c')]({'where':{'id':_0xbca4b9[_0x2250('0x49')]['id']}})[_0x2250('0x28')](handleEntityNotFound(_0x1620ae,null))[_0x2250('0x28')](removeEntity(_0x1620ae,null))[_0x2250('0x48')](handleError(_0x1620ae,null));};exports[_0x2250('0x56')]=function(_0x500447,_0x374a46){return db[_0x2250('0x32')][_0x2250('0x56')]()[_0x2250('0x28')](respondWithResult(_0x374a46,null))['catch'](handleError(_0x374a46,null));};exports['getMembers']=function(_0x40d51a,_0x2068a4,_0x57679e){var _0x4b3c57={'raw':!![],'where':{}},_0x23f2ca={},_0x48db19;return db['FaxQueue'][_0x2250('0x57')]({'where':{'id':_0x40d51a[_0x2250('0x49')]['id']}})[_0x2250('0x28')](handleEntityNotFound(_0x2068a4,null))[_0x2250('0x28')](function(_0xe15c92){if(_0xe15c92){_0x48db19=_0xe15c92['get']({'plain':!![]});_0x23f2ca[_0x2250('0x38')]=_[_0x2250('0x36')](db[_0x2250('0x58')][_0x2250('0x4a')]);_0x23f2ca['query']=_['keys'](_0x40d51a[_0x2250('0x35')]);_0x23f2ca[_0x2250('0x37')]=_[_0x2250('0x3a')](_0x23f2ca[_0x2250('0x38')],_0x23f2ca['query']);_0x4b3c57['attributes']=_[_0x2250('0x3a')](_0x23f2ca[_0x2250('0x38')],qs[_0x2250('0x3b')](_0x40d51a['query'][_0x2250('0x3b')]));_0x4b3c57[_0x2250('0x39')]=_0x4b3c57[_0x2250('0x39')][_0x2250('0x3c')]?_0x4b3c57[_0x2250('0x39')]:_0x23f2ca['model'];if(!_0x40d51a['query']['hasOwnProperty'](_0x2250('0x3d'))){_0x4b3c57[_0x2250('0x3e')]=qs[_0x2250('0x3e')](_0x40d51a[_0x2250('0x35')][_0x2250('0x3e')]);_0x4b3c57[_0x2250('0x1f')]=qs['offset'](_0x40d51a[_0x2250('0x35')][_0x2250('0x1f')]);}_0x4b3c57[_0x2250('0x3f')]=qs[_0x2250('0x40')](_0x40d51a[_0x2250('0x35')][_0x2250('0x40')]);_0x4b3c57[_0x2250('0x43')]=qs[_0x2250('0x37')](_[_0x2250('0x41')](_0x40d51a[_0x2250('0x35')],_0x23f2ca[_0x2250('0x37')]));_0x4b3c57[_0x2250('0x43')][_0x2250('0x59')]=_0xe15c92['id'];if(_0x40d51a['query'][_0x2250('0x42')]){_0x4b3c57[_0x2250('0x43')]=_['merge'](_0x4b3c57['where'],{'$or':_[_0x2250('0x31')](_0x4b3c57[_0x2250('0x39')],function(_0x4b027a){var _0x51c87d={};_0x51c87d[_0x4b027a]={'$like':'%'+_0x40d51a[_0x2250('0x35')][_0x2250('0x42')]+'%'};return _0x51c87d;})});}_0x4b3c57=_['merge']({},_0x4b3c57,_0x40d51a['options']);return db[_0x2250('0x58')]['findAll'](_0x4b3c57);}})[_0x2250('0x28')](function(_0xc3d4a3){if(_0xc3d4a3){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0xc3d4a3,'UserId'),'role':'agent'},'attributes':['id',_0x2250('0x2f'),'faxPause',_0x2250('0x5a'),_0x2250('0x5b')]});}})[_0x2250('0x28')](function(_0x2c19a2){if(_0x2c19a2){return{'count':_0x2c19a2[_0x2250('0x21')],'rows':_[_0x2250('0x31')](_0x2c19a2[_0x2250('0x5c')],function(_0xafe5f3){return{'membername':_0xafe5f3[_0x2250('0x2f')],'UserId':_0xafe5f3['id'],'queue_name':_0x48db19[_0x2250('0x2f')],'FaxQueueId':_0x48db19['id'],'interface':util[_0x2250('0x5d')](_0x2250('0x5e'),_0x2250('0x5f'),_0xafe5f3[_0x2250('0x2f')]),'penalty':0x0,'paused':_0xafe5f3[_0x2250('0x60')],'createdAt':_0xafe5f3[_0x2250('0x5b')],'updatedAt':_0xafe5f3[_0x2250('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2250('0x28')](respondWithFilteredResult(_0x2068a4,_0x4b3c57))[_0x2250('0x48')](handleError(_0x2068a4,null));};exports[_0x2250('0x61')]=function(_0x22729c,_0x1454f0,_0x292b74){var _0x147f3e={};var _0x46ff3d={};var _0x105bfe;var _0x5859bc;return db[_0x2250('0x32')][_0x2250('0x57')]({'where':{'id':_0x22729c[_0x2250('0x49')]['id']}})['then'](handleEntityNotFound(_0x1454f0,null))[_0x2250('0x28')](function(_0x4c3442){if(_0x4c3442){_0x105bfe=_0x4c3442;_0x46ff3d['model']=_[_0x2250('0x36')](db[_0x2250('0x62')][_0x2250('0x4a')]);_0x46ff3d[_0x2250('0x35')]=_[_0x2250('0x36')](_0x22729c[_0x2250('0x35')]);_0x46ff3d[_0x2250('0x37')]=_['intersection'](_0x46ff3d[_0x2250('0x38')],_0x46ff3d['query']);_0x147f3e[_0x2250('0x39')]=_[_0x2250('0x3a')](_0x46ff3d[_0x2250('0x38')],qs['fields'](_0x22729c['query']['fields']));_0x147f3e[_0x2250('0x39')]=_0x147f3e[_0x2250('0x39')][_0x2250('0x3c')]?_0x147f3e['attributes']:_0x46ff3d[_0x2250('0x38')];_0x147f3e[_0x2250('0x3f')]=qs[_0x2250('0x40')](_0x22729c[_0x2250('0x35')]['sort']);_0x147f3e[_0x2250('0x43')]=qs['filters'](_['pick'](_0x22729c[_0x2250('0x35')],_0x46ff3d[_0x2250('0x37')]));if(_0x22729c['query'][_0x2250('0x42')]){_0x147f3e['where']=_[_0x2250('0x45')](_0x147f3e['where'],{'$or':_[_0x2250('0x31')](_0x147f3e[_0x2250('0x39')],function(_0x281870){var _0x60424d={};_0x60424d[_0x281870]={'$like':'%'+_0x22729c[_0x2250('0x35')][_0x2250('0x42')]+'%'};return _0x60424d;})});}_0x147f3e=_['merge']({},_0x147f3e,_0x22729c[_0x2250('0x4b')]);return _0x105bfe['getTeams'](_0x147f3e);}})[_0x2250('0x28')](function(_0xfe2563){if(_0xfe2563){_0x5859bc=_0xfe2563[_0x2250('0x3c')];if(!_0x22729c['query'][_0x2250('0x63')](_0x2250('0x3d'))){_0x147f3e['limit']=qs[_0x2250('0x3e')](_0x22729c['query'][_0x2250('0x3e')]);_0x147f3e[_0x2250('0x1f')]=qs[_0x2250('0x1f')](_0x22729c[_0x2250('0x35')][_0x2250('0x1f')]);}return _0x105bfe[_0x2250('0x61')](_0x147f3e);}})[_0x2250('0x28')](function(_0x19f85b){if(_0x19f85b){return _0x19f85b?{'count':_0x5859bc,'rows':_0x19f85b}:null;}})[_0x2250('0x28')](respondWithResult(_0x1454f0,null))[_0x2250('0x48')](handleError(_0x1454f0,null));};exports[_0x2250('0x64')]=function(_0x42dcc7,_0x2f3166,_0x2cd5ce){var _0x1a2f81=_0x42dcc7[_0x2250('0x55')][_0x2250('0x65')];return db[_0x2250('0x62')][_0x2250('0x66')]({'where':{'id':_0x1a2f81},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2250('0x67'),'attributes':['id',_0x2250('0x2f'),_0x2250('0x68'),_0x2250('0x69'),_0x2250('0x6a')],'raw':!![]}]})['then'](function(_0x664334){if(_0x664334){var _0x14a564=_[_0x2250('0x6b')](_0x664334,function(_0x37c0fd){var _0x242655=_0x37c0fd[_0x2250('0x2a')]({'plain':!![]});return _0x242655['Agents'];});return db[_0x2250('0x32')][_0x2250('0x4c')]({'where':{'id':_0x42dcc7[_0x2250('0x49')]['id']}})[_0x2250('0x28')](function(_0x4cba22){return db[_0x2250('0x6c')]['transaction'](function(_0x4ac947){return _0x4cba22[_0x2250('0x64')](_0x1a2f81,{'transaction':_0x4ac947})[_0x2250('0x28')](function(){return BPromise[_0x2250('0x6d')](_0x14a564,function(_0x58fba2){return db[_0x2250('0x58')]['findOrCreate']({'where':{'UserId':_0x58fba2['id'],'FaxQueueId':_0x42dcc7['params']['id']},'transaction':_0x4ac947});});})['then'](function(){_0x14a564[_0x2250('0x6e')](function(_0x4cbf80){socket[_0x2250('0x6f')](_0x2250('0x70'),{'UserId':_0x4cbf80['id'],'FaxQueueId':_0x4cba22['id']});});});});});}})[_0x2250('0x28')](respondWithStatusCode(_0x2f3166,null))[_0x2250('0x48')](handleError(_0x2f3166,null));};exports[_0x2250('0x71')]=function(_0x564d00,_0x1be96e,_0x4468c4){return db['Team'][_0x2250('0x66')]({'where':{'id':_0x564d00[_0x2250('0x35')][_0x2250('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1be96e,null))[_0x2250('0x28')](function(_0x38c190){var _0x438246=_[_0x2250('0x31')](_0x38c190,'id');var _0x2cec42=[];var _0x75881a=[];var _0x23f572=squel['select']();_0x23f572[_0x2250('0x72')](_0x2250('0x73'))[_0x2250('0x74')](_0x2250('0x75'),'tq')['join'](_0x2250('0x76'),'ut',_0x2250('0x77'))[_0x2250('0x43')](_0x2250('0x78'),_0x564d00[_0x2250('0x49')]['id']);for(var _0x21d3b2=0x0;_0x21d3b2<_0x38c190['length'];_0x21d3b2+=0x1){let _0x3fb3dc=_0x38c190[_0x21d3b2];for(var _0x3b87fc=0x0;_0x3b87fc<_0x3fb3dc[_0x2250('0x67')][_0x2250('0x3c')];_0x3b87fc+=0x1){let _0x27fd18=_0x3fb3dc[_0x2250('0x67')][_0x3b87fc];var _0x3c967e=_0x23f572[_0x2250('0x79')]();_0x3c967e[_0x2250('0x43')](_0x2250('0x7a'),_0x27fd18['id']);_0x75881a['push'](db[_0x2250('0x6c')][_0x2250('0x35')](_0x3c967e[_0x2250('0x7b')](),{'type':db[_0x2250('0x6c')][_0x2250('0x7c')]['SELECT']})[_0x2250('0x28')](function(_0xafb74d){if(_0xafb74d[_0x2250('0x3c')]===0x1){return _0x27fd18['id'];}else{var _0x13bc50=_[_0x2250('0x7d')](_[_0x2250('0x31')](_0xafb74d,_0x2250('0x7e')),function(_0xdacc03){return _['includes'](_0x438246,_0xdacc03);});if(_0x13bc50){return _0x27fd18['id'];}}}));}}return BPromise[_0x2250('0x7f')](_0x75881a)[_0x2250('0x28')](function(_0x3256f5){_0x2cec42=_(_0x2cec42)[_0x2250('0x80')](_0x3256f5)['compact']()[_0x2250('0x81')]();return db['FaxQueue'][_0x2250('0x4c')]({'where':{'id':_0x564d00[_0x2250('0x49')]['id']}})[_0x2250('0x28')](function(_0x1cca76){return db[_0x2250('0x6c')]['transaction'](function(_0x2d6834){return _0x1cca76['removeTeams'](_0x564d00[_0x2250('0x35')][_0x2250('0x65')],{'transaction':_0x2d6834})[_0x2250('0x28')](function(){if(!_['isEmpty'](_0x2cec42)){return _0x1cca76['removeAgents'](_0x2cec42,{'transaction':_0x2d6834});}})[_0x2250('0x28')](function(){_0x2cec42[_0x2250('0x6e')](function(_0x43a78c){socket[_0x2250('0x6f')]('userFaxQueue:remove',{'UserId':_0x43a78c,'FaxQueueId':_0x1cca76['id']});});});});});});})[_0x2250('0x28')](respondWithStatusCode(_0x1be96e,null))['catch'](handleError(_0x1be96e,null));};exports['addAgents']=function(_0xd144e5,_0x3b3b87,_0x25fd34){return db[_0x2250('0x32')]['find']({'where':{'id':_0xd144e5[_0x2250('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b3b87,null))[_0x2250('0x28')](function(_0x47e4be){if(_0x47e4be){return _0x47e4be[_0x2250('0x82')](_0xd144e5[_0x2250('0x55')][_0x2250('0x65')],_['omit'](_0xd144e5[_0x2250('0x55')],[_0x2250('0x65'),'id'])||{})[_0x2250('0x83')](function(_0x39d032){for(var _0x520163=0x0;_0x520163<_0xd144e5[_0x2250('0x55')]['ids']['length'];_0x520163+=0x1){socket[_0x2250('0x6f')](_0x2250('0x70'),{'UserId':_0xd144e5['body'][_0x2250('0x65')][_0x520163],'FaxQueueId':_0xd144e5[_0x2250('0x49')]['id']});}return _0x39d032;});}})[_0x2250('0x28')](respondWithResult(_0x3b3b87,null))[_0x2250('0x48')](handleError(_0x3b3b87,null));};exports[_0x2250('0x84')]=function(_0x442600,_0x198fef,_0x303bef){return db[_0x2250('0x32')][_0x2250('0x4c')]({'where':{'id':_0x442600[_0x2250('0x49')]['id']}})[_0x2250('0x28')](handleEntityNotFound(_0x198fef,null))[_0x2250('0x28')](function(_0x28e087){if(_0x28e087){return _0x28e087['removeAgents'](_0x442600[_0x2250('0x35')][_0x2250('0x65')])['then'](function(){if(_[_0x2250('0x85')](_0x442600[_0x2250('0x35')][_0x2250('0x65')])){for(var _0x2fa558=0x0;_0x2fa558<_0x442600[_0x2250('0x35')]['ids'][_0x2250('0x3c')];_0x2fa558+=0x1){socket[_0x2250('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x442600['query'][_0x2250('0x65')][_0x2fa558]),'FaxQueueId':Number(_0x442600[_0x2250('0x49')]['id'])});}}else{socket[_0x2250('0x6f')](_0x2250('0x86'),{'UserId':Number(_0x442600[_0x2250('0x35')][_0x2250('0x65')]),'FaxQueueId':Number(_0x442600[_0x2250('0x49')]['id'])});}});}})[_0x2250('0x28')](respondWithStatusCode(_0x198fef,null))['catch'](handleError(_0x198fef,null));};exports[_0x2250('0x87')]=function(_0x22e471,_0x42cf47,_0x2a741a){var _0x3bbc30={};var _0x3018c9={};var _0x1e49bd;var _0x2746b0;return db[_0x2250('0x32')][_0x2250('0x57')]({'where':{'id':_0x22e471[_0x2250('0x49')]['id']}})[_0x2250('0x28')](handleEntityNotFound(_0x42cf47,null))[_0x2250('0x28')](function(_0x197262){if(_0x197262){_0x1e49bd=_0x197262;_0x3018c9[_0x2250('0x38')]=_[_0x2250('0x36')](db['User'][_0x2250('0x4a')]);_0x3018c9[_0x2250('0x35')]=_[_0x2250('0x36')](_0x22e471['query']);_0x3018c9[_0x2250('0x37')]=_[_0x2250('0x3a')](_0x3018c9[_0x2250('0x38')],_0x3018c9['query']);_0x3bbc30[_0x2250('0x39')]=_[_0x2250('0x3a')](_0x3018c9[_0x2250('0x38')],qs['fields'](_0x22e471[_0x2250('0x35')]['fields']));_0x3bbc30['attributes']=_0x3bbc30[_0x2250('0x39')][_0x2250('0x3c')]?_0x3bbc30[_0x2250('0x39')]:_0x3018c9['model'];_0x3bbc30[_0x2250('0x3f')]=qs[_0x2250('0x40')](_0x22e471[_0x2250('0x35')][_0x2250('0x40')]);_0x3bbc30[_0x2250('0x43')]=qs[_0x2250('0x37')](_[_0x2250('0x41')](_0x22e471[_0x2250('0x35')],_0x3018c9['filters']));if(_0x22e471[_0x2250('0x35')][_0x2250('0x42')]){_0x3bbc30[_0x2250('0x43')]=_[_0x2250('0x45')](_0x3bbc30['where'],{'$or':_[_0x2250('0x31')](_0x3bbc30['attributes'],function(_0x40e029){var _0x11152c={};_0x11152c[_0x40e029]={'$like':'%'+_0x22e471[_0x2250('0x35')][_0x2250('0x42')]+'%'};return _0x11152c;})});}_0x3bbc30=_[_0x2250('0x45')]({},_0x3bbc30,_0x22e471[_0x2250('0x4b')]);return _0x1e49bd[_0x2250('0x87')](_0x3bbc30);}})['then'](function(_0xbe265c){if(_0xbe265c){_0x2746b0=_0xbe265c[_0x2250('0x3c')];if(!_0x22e471[_0x2250('0x35')][_0x2250('0x63')]('nolimit')){_0x3bbc30[_0x2250('0x3e')]=qs[_0x2250('0x3e')](_0x22e471['query'][_0x2250('0x3e')]);_0x3bbc30[_0x2250('0x1f')]=qs[_0x2250('0x1f')](_0x22e471[_0x2250('0x35')][_0x2250('0x1f')]);}return _0x1e49bd[_0x2250('0x87')](_0x3bbc30);}})['then'](function(_0x3e9128){if(_0x3e9128){return _0x3e9128?{'count':_0x2746b0,'rows':_0x3e9128}:null;}})[_0x2250('0x28')](respondWithResult(_0x42cf47,null))['catch'](handleError(_0x42cf47,null));}; \ No newline at end of file +var _0x1bf3=['map','FaxQueue','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','where','filter','options','findAll','rows','catch','show','params','includeAll','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','nolimit','FaxQueueId','User','findAndCountAll','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','userFaxQueue:save','removeTeams','select','field','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','omit','isArray','getAgents','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0x1bf3,0x16f));var _0x31bf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bf3[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x31bf('0x0'));var rimraf=require(_0x31bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31bf('0x2'));var rp=require(_0x31bf('0x3'));var moment=require(_0x31bf('0x4'));var BPromise=require(_0x31bf('0x5'));var Mustache=require(_0x31bf('0x6'));var util=require(_0x31bf('0x7'));var path=require(_0x31bf('0x8'));var sox=require(_0x31bf('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31bf('0xa'));var _=require(_0x31bf('0xb'));var squel=require(_0x31bf('0xc'));var crypto=require(_0x31bf('0xd'));var jsforce=require(_0x31bf('0xe'));var deskjs=require(_0x31bf('0xf'));var toCsv=require(_0x31bf('0x10'));var querystring=require(_0x31bf('0x11'));var Papa=require(_0x31bf('0x12'));var Redis=require(_0x31bf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x31bf('0x14'));var as=require(_0x31bf('0x15'));var hardwareService=require(_0x31bf('0x16'));var logger=require('../../config/logger')(_0x31bf('0x17'));var utils=require(_0x31bf('0x18'));var config=require(_0x31bf('0x19'));var licenseUtil=require(_0x31bf('0x1a'));var db=require('../../mysqldb')['db'];config[_0x31bf('0x1b')]=_['defaults'](config[_0x31bf('0x1b')],{'host':_0x31bf('0x1c'),'port':0x18eb});var socket=require(_0x31bf('0x1d'))(new Redis(config['redis']));require(_0x31bf('0x1e'))[_0x31bf('0x1f')](socket);function respondWithStatusCode(_0x2c7bc0,_0xe4ebec){_0xe4ebec=_0xe4ebec||0xcc;return function(_0x3bb61d){if(_0x3bb61d){return _0x2c7bc0[_0x31bf('0x20')](_0xe4ebec);}return _0x2c7bc0[_0x31bf('0x21')](_0xe4ebec)[_0x31bf('0x22')]();};}function respondWithResult(_0x5ab39e,_0x3d1bbe){_0x3d1bbe=_0x3d1bbe||0xc8;return function(_0x5081eb){if(_0x5081eb){return _0x5ab39e[_0x31bf('0x21')](_0x3d1bbe)[_0x31bf('0x23')](_0x5081eb);}};}function respondWithFilteredResult(_0x4afc6f,_0x2aa62f){return function(_0x4e0f61){if(_0x4e0f61){var _0x4b0313=typeof _0x2aa62f[_0x31bf('0x24')]===_0x31bf('0x25')&&typeof _0x2aa62f[_0x31bf('0x26')]===_0x31bf('0x25');var _0x11ca02=_0x4e0f61[_0x31bf('0x27')];var _0x169047=_0x4b0313?0x0:_0x2aa62f[_0x31bf('0x24')];var _0x38123c=_0x4b0313?_0x4e0f61[_0x31bf('0x27')]:_0x2aa62f[_0x31bf('0x24')]+_0x2aa62f['limit'];var _0xdcf2ce;if(_0x38123c>=_0x11ca02){_0x38123c=_0x11ca02;_0xdcf2ce=0xc8;}else{_0xdcf2ce=0xce;}_0x4afc6f['status'](_0xdcf2ce);return _0x4afc6f[_0x31bf('0x28')]('Content-Range',_0x169047+'-'+_0x38123c+'/'+_0x11ca02)[_0x31bf('0x23')](_0x4e0f61);}return null;};}function patchUpdates(_0x58d2d9){return function(_0x11edcb){try{jsonpatch[_0x31bf('0x29')](_0x11edcb,_0x58d2d9,!![]);}catch(_0x55cdb6){return BPromise['reject'](_0x55cdb6);}return _0x11edcb[_0x31bf('0x2a')]();};}function saveUpdates(_0x411ecc,_0x243f7d){return function(_0x54f637){if(_0x54f637){return _0x54f637[_0x31bf('0x2b')](_0x411ecc)[_0x31bf('0x2c')](function(_0x2139f0){return _0x2139f0;});}return null;};}function removeEntity(_0x34f556,_0x50ea23){return function(_0x4b06d4){if(_0x4b06d4){return _0x4b06d4[_0x31bf('0x2d')]()[_0x31bf('0x2c')](function(){var _0x3a26cf=_0x4b06d4[_0x31bf('0x2e')]({'plain':!![]});var _0x59a29b=_0x31bf('0x2f');return db[_0x31bf('0x30')]['destroy']({'where':{'type':_0x59a29b,'resourceId':_0x3a26cf['id']}})['then'](function(){return _0x4b06d4;});})['then'](function(){_0x34f556['status'](0xcc)[_0x31bf('0x22')]();});}};}function handleEntityNotFound(_0x3b72c0,_0x1c2450){return function(_0x574935){if(!_0x574935){_0x3b72c0[_0x31bf('0x20')](0x194);}return _0x574935;};}function handleError(_0x4dde26,_0x194966){_0x194966=_0x194966||0x1f4;return function(_0x195079){logger[_0x31bf('0x31')](_0x195079['stack']);if(_0x195079[_0x31bf('0x32')]){delete _0x195079[_0x31bf('0x32')];}_0x4dde26['status'](_0x194966)[_0x31bf('0x33')](_0x195079);};}exports[_0x31bf('0x34')]=function(_0x29d3c5,_0x3be290){var _0x45eb78={},_0x9443bd={},_0x3cca3e={'count':0x0,'rows':[]};var _0xe4f950=_[_0x31bf('0x35')](db[_0x31bf('0x36')][_0x31bf('0x37')],function(_0x513caa){return{'name':_0x513caa['fieldName'],'type':_0x513caa[_0x31bf('0x38')][_0x31bf('0x39')]};});_0x9443bd[_0x31bf('0x3a')]=_[_0x31bf('0x35')](_0xe4f950,'name');_0x9443bd['query']=_[_0x31bf('0x3b')](_0x29d3c5['query']);_0x9443bd[_0x31bf('0x3c')]=_[_0x31bf('0x3d')](_0x9443bd['model'],_0x9443bd['query']);_0x45eb78[_0x31bf('0x3e')]=_['intersection'](_0x9443bd[_0x31bf('0x3a')],qs['fields'](_0x29d3c5['query'][_0x31bf('0x3f')]));_0x45eb78[_0x31bf('0x3e')]=_0x45eb78[_0x31bf('0x3e')][_0x31bf('0x40')]?_0x45eb78[_0x31bf('0x3e')]:_0x9443bd[_0x31bf('0x3a')];if(!_0x29d3c5[_0x31bf('0x41')][_0x31bf('0x42')]('nolimit')){_0x45eb78[_0x31bf('0x26')]=qs[_0x31bf('0x26')](_0x29d3c5[_0x31bf('0x41')][_0x31bf('0x26')]);_0x45eb78[_0x31bf('0x24')]=qs[_0x31bf('0x24')](_0x29d3c5[_0x31bf('0x41')][_0x31bf('0x24')]);}_0x45eb78[_0x31bf('0x43')]=qs[_0x31bf('0x44')](_0x29d3c5[_0x31bf('0x41')][_0x31bf('0x44')]);_0x45eb78[_0x31bf('0x45')]=qs[_0x31bf('0x3c')](_['pick'](_0x29d3c5[_0x31bf('0x41')],_0x9443bd[_0x31bf('0x3c')]),_0xe4f950);if(_0x29d3c5[_0x31bf('0x41')][_0x31bf('0x46')]){_0x45eb78[_0x31bf('0x45')]=_['merge'](_0x45eb78['where'],{'$or':_[_0x31bf('0x35')](_0xe4f950,function(_0x9e442f){if(_0x9e442f[_0x31bf('0x38')]!=='VIRTUAL'){var _0x170874={};_0x170874[_0x9e442f[_0x31bf('0x32')]]={'$like':'%'+_0x29d3c5[_0x31bf('0x41')][_0x31bf('0x46')]+'%'};return _0x170874;}})});}_0x45eb78=_['merge']({},_0x45eb78,_0x29d3c5[_0x31bf('0x47')]);var _0x1c0ca6={'where':_0x45eb78[_0x31bf('0x45')]};return db[_0x31bf('0x36')][_0x31bf('0x27')](_0x1c0ca6)['then'](function(_0x2c0780){_0x3cca3e[_0x31bf('0x27')]=_0x2c0780;if(_0x29d3c5['query']['includeAll']){_0x45eb78['include']=[{'all':!![]}];}return db[_0x31bf('0x36')][_0x31bf('0x48')](_0x45eb78);})[_0x31bf('0x2c')](function(_0x4f562d){_0x3cca3e[_0x31bf('0x49')]=_0x4f562d;return _0x3cca3e;})[_0x31bf('0x2c')](respondWithFilteredResult(_0x3be290,_0x45eb78))[_0x31bf('0x4a')](handleError(_0x3be290,null));};exports[_0x31bf('0x4b')]=function(_0x424bfa,_0x3199fb){var _0x1d01b9={'raw':!![],'where':{'id':_0x424bfa[_0x31bf('0x4c')]['id']}},_0x2bdf02={};_0x2bdf02[_0x31bf('0x3a')]=_[_0x31bf('0x3b')](db[_0x31bf('0x36')][_0x31bf('0x37')]);_0x2bdf02[_0x31bf('0x41')]=_[_0x31bf('0x3b')](_0x424bfa[_0x31bf('0x41')]);_0x2bdf02[_0x31bf('0x3c')]=_[_0x31bf('0x3d')](_0x2bdf02[_0x31bf('0x3a')],_0x2bdf02[_0x31bf('0x41')]);_0x1d01b9['attributes']=_['intersection'](_0x2bdf02[_0x31bf('0x3a')],qs['fields'](_0x424bfa[_0x31bf('0x41')][_0x31bf('0x3f')]));_0x1d01b9[_0x31bf('0x3e')]=_0x1d01b9[_0x31bf('0x3e')][_0x31bf('0x40')]?_0x1d01b9['attributes']:_0x2bdf02['model'];if(_0x424bfa[_0x31bf('0x41')][_0x31bf('0x4d')]){_0x1d01b9[_0x31bf('0x4e')]=[{'all':!![]}];}_0x1d01b9=_[_0x31bf('0x4f')]({},_0x1d01b9,_0x424bfa['options']);return db[_0x31bf('0x36')][_0x31bf('0x50')](_0x1d01b9)['then'](handleEntityNotFound(_0x3199fb,null))[_0x31bf('0x2c')](respondWithResult(_0x3199fb,null))[_0x31bf('0x4a')](handleError(_0x3199fb,null));};exports[_0x31bf('0x51')]=function(_0x2f101e,_0x54a3ae){return db[_0x31bf('0x36')][_0x31bf('0x51')](_0x2f101e[_0x31bf('0x52')],{})['then'](function(_0x5e6c0b){var _0x459866=_0x2f101e['user'][_0x31bf('0x2e')]({'plain':!![]});if(!_0x459866)throw new Error(_0x31bf('0x53'));if(_0x459866[_0x31bf('0x54')]===_0x31bf('0x55')){var _0x24ca94=_0x5e6c0b[_0x31bf('0x2e')]({'plain':!![]});var _0x360360='FaxQueues';return db['UserProfileSection'][_0x31bf('0x50')]({'where':{'name':_0x360360,'userProfileId':_0x459866[_0x31bf('0x56')]},'raw':!![]})['then'](function(_0xca344a){if(_0xca344a&&_0xca344a['autoAssociation']===0x0){return db[_0x31bf('0x30')][_0x31bf('0x51')]({'name':_0x24ca94['name'],'resourceId':_0x24ca94['id'],'type':_0xca344a[_0x31bf('0x32')],'sectionId':_0xca344a['id']},{})['then'](function(){return _0x5e6c0b;});}else{return _0x5e6c0b;}})[_0x31bf('0x4a')](function(_0x491796){logger['error'](_0x31bf('0x57'),_0x491796);throw _0x491796;});}return _0x5e6c0b;})[_0x31bf('0x2c')](respondWithResult(_0x54a3ae,0xc9))['catch'](handleError(_0x54a3ae,null));};exports[_0x31bf('0x2b')]=function(_0x31bf8d,_0x41b0d9){if(_0x31bf8d[_0x31bf('0x52')]['id']){delete _0x31bf8d['body']['id'];}return db['FaxQueue'][_0x31bf('0x50')]({'where':{'id':_0x31bf8d[_0x31bf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41b0d9,null))[_0x31bf('0x2c')](saveUpdates(_0x31bf8d[_0x31bf('0x52')],null))[_0x31bf('0x2c')](respondWithResult(_0x41b0d9,null))[_0x31bf('0x4a')](handleError(_0x41b0d9,null));};exports[_0x31bf('0x2d')]=function(_0x5aafd8,_0x5e02e6){return db[_0x31bf('0x36')]['find']({'where':{'id':_0x5aafd8[_0x31bf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e02e6,null))[_0x31bf('0x2c')](removeEntity(_0x5e02e6,null))[_0x31bf('0x4a')](handleError(_0x5e02e6,null));};exports[_0x31bf('0x58')]=function(_0x218647,_0x33b55a){return db[_0x31bf('0x36')][_0x31bf('0x58')]()[_0x31bf('0x2c')](respondWithResult(_0x33b55a,null))[_0x31bf('0x4a')](handleError(_0x33b55a,null));};exports[_0x31bf('0x59')]=function(_0x3ffa9a,_0x2eca88,_0x51e8c5){var _0x2d3cc7={'raw':!![],'where':{}},_0x496d33={},_0x3d27ef;return db[_0x31bf('0x36')]['findOne']({'where':{'id':_0x3ffa9a[_0x31bf('0x4c')]['id']}})[_0x31bf('0x2c')](handleEntityNotFound(_0x2eca88,null))[_0x31bf('0x2c')](function(_0x5e86e8){if(_0x5e86e8){_0x3d27ef=_0x5e86e8[_0x31bf('0x2e')]({'plain':!![]});_0x496d33['model']=_[_0x31bf('0x3b')](db[_0x31bf('0x5a')][_0x31bf('0x37')]);_0x496d33[_0x31bf('0x41')]=_[_0x31bf('0x3b')](_0x3ffa9a['query']);_0x496d33[_0x31bf('0x3c')]=_['intersection'](_0x496d33[_0x31bf('0x3a')],_0x496d33[_0x31bf('0x41')]);_0x2d3cc7[_0x31bf('0x3e')]=_[_0x31bf('0x3d')](_0x496d33[_0x31bf('0x3a')],qs[_0x31bf('0x3f')](_0x3ffa9a['query'][_0x31bf('0x3f')]));_0x2d3cc7[_0x31bf('0x3e')]=_0x2d3cc7['attributes'][_0x31bf('0x40')]?_0x2d3cc7[_0x31bf('0x3e')]:_0x496d33[_0x31bf('0x3a')];if(!_0x3ffa9a[_0x31bf('0x41')][_0x31bf('0x42')](_0x31bf('0x5b'))){_0x2d3cc7[_0x31bf('0x26')]=qs[_0x31bf('0x26')](_0x3ffa9a[_0x31bf('0x41')][_0x31bf('0x26')]);_0x2d3cc7['offset']=qs['offset'](_0x3ffa9a[_0x31bf('0x41')]['offset']);}_0x2d3cc7[_0x31bf('0x43')]=qs['sort'](_0x3ffa9a[_0x31bf('0x41')][_0x31bf('0x44')]);_0x2d3cc7[_0x31bf('0x45')]=qs[_0x31bf('0x3c')](_['pick'](_0x3ffa9a['query'],_0x496d33[_0x31bf('0x3c')]));_0x2d3cc7['where'][_0x31bf('0x5c')]=_0x5e86e8['id'];if(_0x3ffa9a[_0x31bf('0x41')][_0x31bf('0x46')]){_0x2d3cc7[_0x31bf('0x45')]=_[_0x31bf('0x4f')](_0x2d3cc7[_0x31bf('0x45')],{'$or':_[_0x31bf('0x35')](_0x2d3cc7[_0x31bf('0x3e')],function(_0x243df1){var _0x471413={};_0x471413[_0x243df1]={'$like':'%'+_0x3ffa9a['query'][_0x31bf('0x46')]+'%'};return _0x471413;})});}_0x2d3cc7=_['merge']({},_0x2d3cc7,_0x3ffa9a[_0x31bf('0x47')]);return db[_0x31bf('0x5a')][_0x31bf('0x48')](_0x2d3cc7);}})[_0x31bf('0x2c')](function(_0x1fbb4f){if(_0x1fbb4f){return db[_0x31bf('0x5d')][_0x31bf('0x5e')]({'where':{'id':_['map'](_0x1fbb4f,'UserId'),'role':'agent'},'attributes':['id','name',_0x31bf('0x5f'),_0x31bf('0x60'),_0x31bf('0x61')]});}})[_0x31bf('0x2c')](function(_0xf570db){if(_0xf570db){return{'count':_0xf570db[_0x31bf('0x27')],'rows':_[_0x31bf('0x35')](_0xf570db['rows'],function(_0x34fe12){return{'membername':_0x34fe12[_0x31bf('0x32')],'UserId':_0x34fe12['id'],'queue_name':_0x3d27ef[_0x31bf('0x32')],'FaxQueueId':_0x3d27ef['id'],'interface':util['format'](_0x31bf('0x62'),_0x31bf('0x63'),_0x34fe12['name']),'penalty':0x0,'paused':_0x34fe12[_0x31bf('0x5f')],'createdAt':_0x34fe12[_0x31bf('0x61')],'updatedAt':_0x34fe12['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x31bf('0x2c')](respondWithFilteredResult(_0x2eca88,_0x2d3cc7))[_0x31bf('0x4a')](handleError(_0x2eca88,null));};exports[_0x31bf('0x64')]=function(_0x35ec05,_0x5aff2f,_0x2b05b1){var _0x1300ac={};var _0x26aa49={};var _0x7ba202;var _0x4e48c0;return db['FaxQueue'][_0x31bf('0x65')]({'where':{'id':_0x35ec05['params']['id']}})[_0x31bf('0x2c')](handleEntityNotFound(_0x5aff2f,null))[_0x31bf('0x2c')](function(_0x4a2c71){if(_0x4a2c71){_0x7ba202=_0x4a2c71;_0x26aa49[_0x31bf('0x3a')]=_['keys'](db['Team'][_0x31bf('0x37')]);_0x26aa49['query']=_['keys'](_0x35ec05['query']);_0x26aa49['filters']=_[_0x31bf('0x3d')](_0x26aa49['model'],_0x26aa49[_0x31bf('0x41')]);_0x1300ac[_0x31bf('0x3e')]=_[_0x31bf('0x3d')](_0x26aa49['model'],qs[_0x31bf('0x3f')](_0x35ec05[_0x31bf('0x41')][_0x31bf('0x3f')]));_0x1300ac[_0x31bf('0x3e')]=_0x1300ac[_0x31bf('0x3e')][_0x31bf('0x40')]?_0x1300ac[_0x31bf('0x3e')]:_0x26aa49['model'];_0x1300ac[_0x31bf('0x43')]=qs[_0x31bf('0x44')](_0x35ec05[_0x31bf('0x41')][_0x31bf('0x44')]);_0x1300ac[_0x31bf('0x45')]=qs[_0x31bf('0x3c')](_['pick'](_0x35ec05[_0x31bf('0x41')],_0x26aa49[_0x31bf('0x3c')]));if(_0x35ec05[_0x31bf('0x41')][_0x31bf('0x46')]){_0x1300ac[_0x31bf('0x45')]=_[_0x31bf('0x4f')](_0x1300ac[_0x31bf('0x45')],{'$or':_[_0x31bf('0x35')](_0x1300ac[_0x31bf('0x3e')],function(_0x302a6e){var _0x590008={};_0x590008[_0x302a6e]={'$like':'%'+_0x35ec05[_0x31bf('0x41')][_0x31bf('0x46')]+'%'};return _0x590008;})});}_0x1300ac=_[_0x31bf('0x4f')]({},_0x1300ac,_0x35ec05[_0x31bf('0x47')]);return _0x7ba202[_0x31bf('0x64')](_0x1300ac);}})[_0x31bf('0x2c')](function(_0x12d267){if(_0x12d267){_0x4e48c0=_0x12d267[_0x31bf('0x40')];if(!_0x35ec05[_0x31bf('0x41')][_0x31bf('0x42')](_0x31bf('0x5b'))){_0x1300ac[_0x31bf('0x26')]=qs[_0x31bf('0x26')](_0x35ec05[_0x31bf('0x41')][_0x31bf('0x26')]);_0x1300ac[_0x31bf('0x24')]=qs['offset'](_0x35ec05[_0x31bf('0x41')][_0x31bf('0x24')]);}return _0x7ba202['getTeams'](_0x1300ac);}})['then'](function(_0x2c8448){if(_0x2c8448){return _0x2c8448?{'count':_0x4e48c0,'rows':_0x2c8448}:null;}})['then'](respondWithResult(_0x5aff2f,null))[_0x31bf('0x4a')](handleError(_0x5aff2f,null));};exports[_0x31bf('0x66')]=function(_0x1a1d3d,_0x451000,_0x1b38e2){var _0x15576f=_0x1a1d3d[_0x31bf('0x52')][_0x31bf('0x67')];return db[_0x31bf('0x68')][_0x31bf('0x48')]({'where':{'id':_0x15576f},'attributes':['id'],'include':[{'model':db[_0x31bf('0x5d')],'as':_0x31bf('0x69'),'attributes':['id','name',_0x31bf('0x6a'),_0x31bf('0x6b'),_0x31bf('0x6c')],'raw':!![]}]})[_0x31bf('0x2c')](function(_0x4d704f){if(_0x4d704f){var _0x33954b=_[_0x31bf('0x6d')](_0x4d704f,function(_0x50d232){var _0x6f248e=_0x50d232[_0x31bf('0x2e')]({'plain':!![]});return _0x6f248e[_0x31bf('0x69')];});return db[_0x31bf('0x36')][_0x31bf('0x50')]({'where':{'id':_0x1a1d3d[_0x31bf('0x4c')]['id']}})[_0x31bf('0x2c')](function(_0x2500d1){return db['sequelize'][_0x31bf('0x6e')](function(_0x2bf37a){return _0x2500d1[_0x31bf('0x66')](_0x15576f,{'transaction':_0x2bf37a})[_0x31bf('0x2c')](function(){return BPromise[_0x31bf('0x6f')](_0x33954b,function(_0x5a89a1){return db[_0x31bf('0x5a')][_0x31bf('0x70')]({'where':{'UserId':_0x5a89a1['id'],'FaxQueueId':_0x1a1d3d['params']['id']},'transaction':_0x2bf37a});});})[_0x31bf('0x2c')](function(){_0x33954b['forEach'](function(_0x30981a){socket['emit'](_0x31bf('0x71'),{'UserId':_0x30981a['id'],'FaxQueueId':_0x2500d1['id']});});});});});}})['then'](respondWithStatusCode(_0x451000,null))['catch'](handleError(_0x451000,null));};exports[_0x31bf('0x72')]=function(_0x2c39fd,_0x749a5e,_0x2f04c5){return db[_0x31bf('0x68')][_0x31bf('0x48')]({'where':{'id':_0x2c39fd[_0x31bf('0x41')][_0x31bf('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x31bf('0x2c')](handleEntityNotFound(_0x749a5e,null))[_0x31bf('0x2c')](function(_0x1dc8b2){var _0x310652=_['map'](_0x1dc8b2,'id');var _0x11a0bf=[];var _0x1ccd0f=[];var _0x2aebec=squel[_0x31bf('0x73')]();_0x2aebec[_0x31bf('0x74')]('tq.TeamId')['from']('team_has_fax_queues','tq')['join'](_0x31bf('0x75'),'ut',_0x31bf('0x76'))[_0x31bf('0x45')](_0x31bf('0x77'),_0x2c39fd['params']['id']);for(var _0x14fa4e=0x0;_0x14fa4e<_0x1dc8b2[_0x31bf('0x40')];_0x14fa4e+=0x1){let _0x4325ea=_0x1dc8b2[_0x14fa4e];for(var _0x77ef0e=0x0;_0x77ef0e<_0x4325ea[_0x31bf('0x69')][_0x31bf('0x40')];_0x77ef0e+=0x1){let _0x37e76c=_0x4325ea[_0x31bf('0x69')][_0x77ef0e];var _0x2a4e1c=_0x2aebec[_0x31bf('0x78')]();_0x2a4e1c[_0x31bf('0x45')](_0x31bf('0x79'),_0x37e76c['id']);_0x1ccd0f[_0x31bf('0x7a')](db[_0x31bf('0x7b')][_0x31bf('0x41')](_0x2a4e1c['toString'](),{'type':db[_0x31bf('0x7b')]['QueryTypes'][_0x31bf('0x7c')]})[_0x31bf('0x2c')](function(_0x5d0762){if(_0x5d0762[_0x31bf('0x40')]===0x1){return _0x37e76c['id'];}else{var _0x457072=_['every'](_[_0x31bf('0x35')](_0x5d0762,_0x31bf('0x7d')),function(_0x6d05ba){return _['includes'](_0x310652,_0x6d05ba);});if(_0x457072){return _0x37e76c['id'];}}}));}}return BPromise[_0x31bf('0x7e')](_0x1ccd0f)[_0x31bf('0x2c')](function(_0x20c146){_0x11a0bf=_(_0x11a0bf)[_0x31bf('0x7f')](_0x20c146)[_0x31bf('0x80')]()[_0x31bf('0x81')]();return db[_0x31bf('0x36')]['find']({'where':{'id':_0x2c39fd[_0x31bf('0x4c')]['id']}})['then'](function(_0x5025dc){return db[_0x31bf('0x7b')][_0x31bf('0x6e')](function(_0x1bd375){return _0x5025dc['removeTeams'](_0x2c39fd[_0x31bf('0x41')][_0x31bf('0x67')],{'transaction':_0x1bd375})[_0x31bf('0x2c')](function(){if(!_[_0x31bf('0x82')](_0x11a0bf)){return _0x5025dc[_0x31bf('0x83')](_0x11a0bf,{'transaction':_0x1bd375});}})[_0x31bf('0x2c')](function(){_0x11a0bf[_0x31bf('0x84')](function(_0x26ec7d){socket[_0x31bf('0x85')](_0x31bf('0x86'),{'UserId':_0x26ec7d,'FaxQueueId':_0x5025dc['id']});});});});});});})[_0x31bf('0x2c')](respondWithStatusCode(_0x749a5e,null))[_0x31bf('0x4a')](handleError(_0x749a5e,null));};exports['addAgents']=function(_0x49db2b,_0x433196,_0x12f34e){return db['FaxQueue'][_0x31bf('0x50')]({'where':{'id':_0x49db2b[_0x31bf('0x4c')]['id']}})[_0x31bf('0x2c')](handleEntityNotFound(_0x433196,null))[_0x31bf('0x2c')](function(_0x316953){if(_0x316953){return _0x316953[_0x31bf('0x87')](_0x49db2b[_0x31bf('0x52')]['ids'],_[_0x31bf('0x88')](_0x49db2b[_0x31bf('0x52')],[_0x31bf('0x67'),'id'])||{})['spread'](function(_0x19ac45){for(var _0x4b8bb5=0x0;_0x4b8bb5<_0x49db2b['body']['ids'][_0x31bf('0x40')];_0x4b8bb5+=0x1){socket[_0x31bf('0x85')](_0x31bf('0x71'),{'UserId':_0x49db2b[_0x31bf('0x52')]['ids'][_0x4b8bb5],'FaxQueueId':_0x49db2b[_0x31bf('0x4c')]['id']});}return _0x19ac45;});}})[_0x31bf('0x2c')](respondWithResult(_0x433196,null))[_0x31bf('0x4a')](handleError(_0x433196,null));};exports[_0x31bf('0x83')]=function(_0x3bd8e6,_0x16a947,_0x57d3e9){return db[_0x31bf('0x36')][_0x31bf('0x50')]({'where':{'id':_0x3bd8e6['params']['id']}})['then'](handleEntityNotFound(_0x16a947,null))[_0x31bf('0x2c')](function(_0x55e37e){if(_0x55e37e){return _0x55e37e[_0x31bf('0x83')](_0x3bd8e6[_0x31bf('0x41')]['ids'])[_0x31bf('0x2c')](function(){if(_[_0x31bf('0x89')](_0x3bd8e6[_0x31bf('0x41')][_0x31bf('0x67')])){for(var _0x539636=0x0;_0x539636<_0x3bd8e6[_0x31bf('0x41')][_0x31bf('0x67')][_0x31bf('0x40')];_0x539636+=0x1){socket[_0x31bf('0x85')](_0x31bf('0x86'),{'UserId':Number(_0x3bd8e6[_0x31bf('0x41')]['ids'][_0x539636]),'FaxQueueId':Number(_0x3bd8e6[_0x31bf('0x4c')]['id'])});}}else{socket[_0x31bf('0x85')](_0x31bf('0x86'),{'UserId':Number(_0x3bd8e6[_0x31bf('0x41')][_0x31bf('0x67')]),'FaxQueueId':Number(_0x3bd8e6[_0x31bf('0x4c')]['id'])});}});}})[_0x31bf('0x2c')](respondWithStatusCode(_0x16a947,null))[_0x31bf('0x4a')](handleError(_0x16a947,null));};exports[_0x31bf('0x8a')]=function(_0x27621e,_0xa02fe5,_0x321cda){var _0x584769={};var _0x3f33e2={};var _0x1bac0d;var _0x1cf024;return db[_0x31bf('0x36')][_0x31bf('0x65')]({'where':{'id':_0x27621e[_0x31bf('0x4c')]['id']}})[_0x31bf('0x2c')](handleEntityNotFound(_0xa02fe5,null))['then'](function(_0x43b716){if(_0x43b716){_0x1bac0d=_0x43b716;_0x3f33e2['model']=_[_0x31bf('0x3b')](db[_0x31bf('0x5d')][_0x31bf('0x37')]);_0x3f33e2[_0x31bf('0x41')]=_[_0x31bf('0x3b')](_0x27621e[_0x31bf('0x41')]);_0x3f33e2[_0x31bf('0x3c')]=_[_0x31bf('0x3d')](_0x3f33e2['model'],_0x3f33e2[_0x31bf('0x41')]);_0x584769[_0x31bf('0x3e')]=_[_0x31bf('0x3d')](_0x3f33e2['model'],qs['fields'](_0x27621e['query']['fields']));_0x584769[_0x31bf('0x3e')]=_0x584769[_0x31bf('0x3e')][_0x31bf('0x40')]?_0x584769['attributes']:_0x3f33e2[_0x31bf('0x3a')];_0x584769[_0x31bf('0x43')]=qs[_0x31bf('0x44')](_0x27621e[_0x31bf('0x41')][_0x31bf('0x44')]);_0x584769[_0x31bf('0x45')]=qs[_0x31bf('0x3c')](_[_0x31bf('0x8b')](_0x27621e[_0x31bf('0x41')],_0x3f33e2[_0x31bf('0x3c')]));if(_0x27621e[_0x31bf('0x41')][_0x31bf('0x46')]){_0x584769[_0x31bf('0x45')]=_[_0x31bf('0x4f')](_0x584769[_0x31bf('0x45')],{'$or':_['map'](_0x584769[_0x31bf('0x3e')],function(_0x358d8c){var _0x576e71={};_0x576e71[_0x358d8c]={'$like':'%'+_0x27621e[_0x31bf('0x41')]['filter']+'%'};return _0x576e71;})});}_0x584769=_['merge']({},_0x584769,_0x27621e[_0x31bf('0x47')]);return _0x1bac0d[_0x31bf('0x8a')](_0x584769);}})[_0x31bf('0x2c')](function(_0x530a28){if(_0x530a28){_0x1cf024=_0x530a28[_0x31bf('0x40')];if(!_0x27621e[_0x31bf('0x41')][_0x31bf('0x42')](_0x31bf('0x5b'))){_0x584769[_0x31bf('0x26')]=qs['limit'](_0x27621e[_0x31bf('0x41')][_0x31bf('0x26')]);_0x584769[_0x31bf('0x24')]=qs[_0x31bf('0x24')](_0x27621e[_0x31bf('0x41')]['offset']);}return _0x1bac0d['getAgents'](_0x584769);}})['then'](function(_0x42092c){if(_0x42092c){return _0x42092c?{'count':_0x1cf024,'rows':_0x42092c}:null;}})[_0x31bf('0x2c')](respondWithResult(_0xa02fe5,null))['catch'](handleError(_0xa02fe5,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index bb4c488..51c828d 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 _0xbd4b=['save','update','emit','hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners'];(function(_0x327e47,_0x1f69a3){var _0xd2b5cd=function(_0x53feec){while(--_0x53feec){_0x327e47['push'](_0x327e47['shift']());}};_0xd2b5cd(++_0x1f69a3);}(_0xbd4b,0xcc));var _0xbbd4=function(_0x3904e5,_0x5c5eb5){_0x3904e5=_0x3904e5-0x0;var _0x38caee=_0xbd4b[_0x3904e5];return _0x38caee;};'use strict';var EventEmitter=require(_0xbbd4('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xbbd4('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbbd4('0x2')](0x0);var events={'afterCreate':_0xbbd4('0x3'),'afterUpdate':_0xbbd4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2f553d){return function(_0x42de66,_0x28ffce,_0x47f167){FaxQueueEvents[_0xbbd4('0x5')](_0x2f553d+':'+_0x42de66['id'],_0x42de66);FaxQueueEvents[_0xbbd4('0x5')](_0x2f553d,_0x42de66);_0x47f167(null);};}for(var e in events){if(events[_0xbbd4('0x6')](e)){var event=events[e];FaxQueue[_0xbbd4('0x7')](e,emitEvent(event));}}module[_0xbbd4('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xdf3e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','update'];(function(_0x22fbd3,_0x16a179){var _0x3ec068=function(_0x369859){while(--_0x369859){_0x22fbd3['push'](_0x22fbd3['shift']());}};_0x3ec068(++_0x16a179);}(_0xdf3e,0x17f));var _0xedf3=function(_0x4d64ef,_0x39133d){_0x4d64ef=_0x4d64ef-0x0;var _0xdfb5f4=_0xdf3e[_0x4d64ef];return _0xdfb5f4;};'use strict';var EventEmitter=require(_0xedf3('0x0'));var FaxQueue=require(_0xedf3('0x1'))['db'][_0xedf3('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xedf3('0x3'),'afterDestroy':_0xedf3('0x4')};function emitEvent(_0x528393){return function(_0x412ccd,_0xd32003,_0x1de979){FaxQueueEvents[_0xedf3('0x5')](_0x528393+':'+_0x412ccd['id'],_0x412ccd);FaxQueueEvents[_0xedf3('0x5')](_0x528393,_0x412ccd);_0x1de979(null);};}for(var e in events){if(events[_0xedf3('0x6')](e)){var event=events[e];FaxQueue[_0xedf3('0x7')](e,emitEvent(event));}}module[_0xedf3('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 3435811..438e0be 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 _0x83b1=['request-promise','path','rimraf','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x582818,_0x1ea6ee){var _0xdedbe5=function(_0x4bbe6a){while(--_0x4bbe6a){_0x582818['push'](_0x582818['shift']());}};_0xdedbe5(++_0x1ea6ee);}(_0x83b1,0xaf));var _0x183b=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x83b1[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x183b('0x0'));var util=require(_0x183b('0x1'));var logger=require(_0x183b('0x2'))(_0x183b('0x3'));var moment=require(_0x183b('0x4'));var BPromise=require('bluebird');var rp=require(_0x183b('0x5'));var fs=require('fs');var path=require(_0x183b('0x6'));var rimraf=require(_0x183b('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x183b('0x8')]=function(_0x379e74,_0x47e576){return _0x379e74[_0x183b('0x9')](_0x183b('0xa'),attributes,{'tableName':_0x183b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0c0=['./faxQueue.attributes','exports','FaxQueue','lodash','util','request-promise','path','rimraf'];(function(_0x3ffa0c,_0x224db1){var _0x8157b8=function(_0xee3d62){while(--_0xee3d62){_0x3ffa0c['push'](_0x3ffa0c['shift']());}};_0x8157b8(++_0x224db1);}(_0xd0c0,0x1bb));var _0x0d0c=function(_0x1ed3cc,_0x52ea3a){_0x1ed3cc=_0x1ed3cc-0x0;var _0x183f3e=_0xd0c0[_0x1ed3cc];return _0x183f3e;};'use strict';var _=require(_0x0d0c('0x0'));var util=require(_0x0d0c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0d0c('0x2'));var fs=require('fs');var path=require(_0x0d0c('0x3'));var rimraf=require(_0x0d0c('0x4'));var config=require('../../config/environment');var attributes=require(_0x0d0c('0x5'));module[_0x0d0c('0x6')]=function(_0xe0069c,_0x4baffe){return _0xe0069c['define'](_0x0d0c('0x7'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 4432238..1cba9c5 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 _0xb24d=['redis','localhost','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','map','model','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xb24d,0x1b5));var _0xdb24=function(_0x395715,_0x2247b1){_0x395715=_0x395715-0x0;var _0x157a79=_0xb24d[_0x395715];return _0x157a79;};'use strict';var _=require(_0xdb24('0x0'));var util=require(_0xdb24('0x1'));var moment=require(_0xdb24('0x2'));var BPromise=require(_0xdb24('0x3'));var rs=require(_0xdb24('0x4'));var fs=require('fs');var Redis=require(_0xdb24('0x5'));var db=require(_0xdb24('0x6'))['db'];var utils=require(_0xdb24('0x7'));var logger=require(_0xdb24('0x8'))('rpc');var config=require(_0xdb24('0x9'));var jayson=require(_0xdb24('0xa'));var client=jayson[_0xdb24('0xb')][_0xdb24('0xc')]({'port':0x232a});config['redis']=_[_0xdb24('0xd')](config[_0xdb24('0xe')],{'host':_0xdb24('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb24('0xe')]));require('./faxQueue.socket')[_0xdb24('0x10')](socket);function respondWithRpcPromise(_0x81d957,_0x5822d1,_0x4065db){return new BPromise(function(_0x195a1f,_0x157541){return client[_0xdb24('0x11')](_0x81d957,_0x4065db)[_0xdb24('0x12')](function(_0x273c93){logger[_0xdb24('0x13')]('FaxQueue,\x20%s,\x20%s',_0x5822d1,_0xdb24('0x14'));logger[_0xdb24('0x15')](_0xdb24('0x16'),_0x5822d1,_0xdb24('0x14'),JSON[_0xdb24('0x17')](_0x273c93));if(_0x273c93[_0xdb24('0x18')]){if(_0x273c93[_0xdb24('0x18')][_0xdb24('0x19')]===0x1f4){logger['error'](_0xdb24('0x1a'),_0x5822d1,_0x273c93[_0xdb24('0x18')][_0xdb24('0x1b')]);return _0x157541(_0x273c93[_0xdb24('0x18')][_0xdb24('0x1b')]);}logger[_0xdb24('0x18')](_0xdb24('0x1a'),_0x5822d1,_0x273c93[_0xdb24('0x18')][_0xdb24('0x1b')]);return _0x195a1f(_0x273c93[_0xdb24('0x18')][_0xdb24('0x1b')]);}else{logger[_0xdb24('0x13')](_0xdb24('0x1a'),_0x5822d1,'request\x20sent');_0x195a1f(_0x273c93[_0xdb24('0x1c')][_0xdb24('0x1b')]);}})[_0xdb24('0x1d')](function(_0x393e5d){logger['error'](_0xdb24('0x1a'),_0x5822d1,_0x393e5d);_0x157541(_0x393e5d);});});}exports[_0xdb24('0x1e')]=function(_0x41ba4d){var _0x35d9b6=this;return new Promise(function(_0x37385f,_0x5f4a23){return db[_0xdb24('0x1f')][_0xdb24('0x20')]({'raw':_0x41ba4d[_0xdb24('0x21')]?_0x41ba4d[_0xdb24('0x21')][_0xdb24('0x22')]===undefined?!![]:![]:!![],'where':_0x41ba4d[_0xdb24('0x21')]?_0x41ba4d[_0xdb24('0x21')][_0xdb24('0x23')]||null:null,'attributes':_0x41ba4d[_0xdb24('0x21')]?_0x41ba4d['options'][_0xdb24('0x24')]||null:null,'limit':_0x41ba4d[_0xdb24('0x21')]?_0x41ba4d[_0xdb24('0x21')]['limit']||null:null,'include':_0x41ba4d[_0xdb24('0x21')]?_0x41ba4d['options'][_0xdb24('0x25')]?_['map'](_0x41ba4d[_0xdb24('0x21')]['include'],function(_0x2d43cd){return{'model':db[_0x2d43cd['model']],'as':_0x2d43cd['as'],'attributes':_0x2d43cd[_0xdb24('0x24')],'include':_0x2d43cd[_0xdb24('0x25')]?_[_0xdb24('0x26')](_0x2d43cd[_0xdb24('0x25')],function(_0x24c58c){return{'model':db[_0x24c58c[_0xdb24('0x27')]],'as':_0x24c58c['as'],'attributes':_0x24c58c['attributes'],'include':_0x24c58c['include']?_['map'](_0x24c58c[_0xdb24('0x25')],function(_0x36f02a){return{'model':db[_0x36f02a[_0xdb24('0x27')]],'as':_0x36f02a['as'],'attributes':_0x36f02a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb24('0x12')](function(_0x5d25c9){logger[_0xdb24('0x13')](_0xdb24('0x1e'),_0x41ba4d);logger['debug'](_0xdb24('0x1e'),_0x41ba4d,JSON[_0xdb24('0x17')](_0x5d25c9));_0x37385f(_0x5d25c9);})['catch'](function(_0x343a54){logger['error'](_0xdb24('0x1e'),_0x343a54[_0xdb24('0x1b')],_0x41ba4d);_0x5f4a23(_0x35d9b6['error'](0x1f4,_0x343a54[_0xdb24('0x1b')]));});});};exports[_0xdb24('0x28')]=function(_0x810455){var _0x3408f9=this;return new Promise(function(_0x1bd4b6,_0x31f156){return db['FaxQueue']['find']({'raw':_0x810455[_0xdb24('0x21')]?_0x810455[_0xdb24('0x21')][_0xdb24('0x22')]===undefined?!![]:![]:!![],'where':_0x810455[_0xdb24('0x21')]?_0x810455[_0xdb24('0x21')]['where']||null:null,'attributes':_0x810455[_0xdb24('0x21')]?_0x810455[_0xdb24('0x21')][_0xdb24('0x24')]||null:null,'include':_0x810455[_0xdb24('0x21')]?_0x810455[_0xdb24('0x21')][_0xdb24('0x25')]?_[_0xdb24('0x26')](_0x810455[_0xdb24('0x21')][_0xdb24('0x25')],function(_0x4a3d17){return{'model':db[_0x4a3d17[_0xdb24('0x27')]],'as':_0x4a3d17['as'],'attributes':_0x4a3d17['attributes'],'include':_0x4a3d17['include']?_[_0xdb24('0x26')](_0x4a3d17[_0xdb24('0x25')],function(_0x3a2686){return{'model':db[_0x3a2686[_0xdb24('0x27')]],'as':_0x3a2686['as'],'attributes':_0x3a2686['attributes'],'include':_0x3a2686['include']?_[_0xdb24('0x26')](_0x3a2686[_0xdb24('0x25')],function(_0x132dfd){return{'model':db[_0x132dfd[_0xdb24('0x27')]],'as':_0x132dfd['as'],'attributes':_0x132dfd[_0xdb24('0x24')]};}):[]};}):[]};}):[]:[]})[_0xdb24('0x12')](function(_0x2c0f29){logger[_0xdb24('0x13')]('ShowFaxQueue',_0x810455);logger[_0xdb24('0x15')](_0xdb24('0x28'),_0x810455,JSON[_0xdb24('0x17')](_0x2c0f29));_0x1bd4b6(_0x2c0f29);})[_0xdb24('0x1d')](function(_0x48cf70){logger['error'](_0xdb24('0x28'),_0x48cf70['message'],_0x810455);_0x31f156(_0x3408f9[_0xdb24('0x18')](0x1f4,_0x48cf70[_0xdb24('0x1b')]));});});}; \ No newline at end of file +var _0x05fe=['request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','find','ShowFaxQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s'];(function(_0x226404,_0xe6e833){var _0x6b4e36=function(_0x70ed73){while(--_0x70ed73){_0x226404['push'](_0x226404['shift']());}};_0x6b4e36(++_0xe6e833);}(_0x05fe,0x175));var _0xe05f=function(_0x3faeee,_0x7b451f){_0x3faeee=_0x3faeee-0x0;var _0x511431=_0x05fe[_0x3faeee];return _0x511431;};'use strict';var _=require(_0xe05f('0x0'));var util=require('util');var moment=require(_0xe05f('0x1'));var BPromise=require(_0xe05f('0x2'));var rs=require(_0xe05f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe05f('0x4'))['db'];var utils=require(_0xe05f('0x5'));var logger=require('../../config/logger')(_0xe05f('0x6'));var config=require(_0xe05f('0x7'));var jayson=require(_0xe05f('0x8'));var client=jayson[_0xe05f('0x9')]['http']({'port':0x232a});config[_0xe05f('0xa')]=_[_0xe05f('0xb')](config['redis'],{'host':_0xe05f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe05f('0xa')]));require(_0xe05f('0xd'))['register'](socket);function respondWithRpcPromise(_0x109ff3,_0x39c168,_0x3b6e1c){return new BPromise(function(_0x539d49,_0x36101b){return client[_0xe05f('0xe')](_0x109ff3,_0x3b6e1c)['then'](function(_0x2d73e6){logger[_0xe05f('0xf')](_0xe05f('0x10'),_0x39c168,_0xe05f('0x11'));logger[_0xe05f('0x12')](_0xe05f('0x13'),_0x39c168,_0xe05f('0x11'),JSON[_0xe05f('0x14')](_0x2d73e6));if(_0x2d73e6[_0xe05f('0x15')]){if(_0x2d73e6[_0xe05f('0x15')][_0xe05f('0x16')]===0x1f4){logger['error'](_0xe05f('0x10'),_0x39c168,_0x2d73e6[_0xe05f('0x15')]['message']);return _0x36101b(_0x2d73e6[_0xe05f('0x15')][_0xe05f('0x17')]);}logger[_0xe05f('0x15')](_0xe05f('0x10'),_0x39c168,_0x2d73e6[_0xe05f('0x15')][_0xe05f('0x17')]);return _0x539d49(_0x2d73e6[_0xe05f('0x15')]['message']);}else{logger[_0xe05f('0xf')](_0xe05f('0x10'),_0x39c168,'request\x20sent');_0x539d49(_0x2d73e6['result'][_0xe05f('0x17')]);}})[_0xe05f('0x18')](function(_0x851d4a){logger[_0xe05f('0x15')](_0xe05f('0x10'),_0x39c168,_0x851d4a);_0x36101b(_0x851d4a);});});}exports[_0xe05f('0x19')]=function(_0x5ac547){var _0x28513c=this;return new Promise(function(_0x44fd6b,_0x351549){return db[_0xe05f('0x1a')][_0xe05f('0x1b')]({'raw':_0x5ac547['options']?_0x5ac547[_0xe05f('0x1c')][_0xe05f('0x1d')]===undefined?!![]:![]:!![],'where':_0x5ac547[_0xe05f('0x1c')]?_0x5ac547['options'][_0xe05f('0x1e')]||null:null,'attributes':_0x5ac547['options']?_0x5ac547[_0xe05f('0x1c')][_0xe05f('0x1f')]||null:null,'limit':_0x5ac547[_0xe05f('0x1c')]?_0x5ac547[_0xe05f('0x1c')][_0xe05f('0x20')]||null:null,'include':_0x5ac547['options']?_0x5ac547['options']['include']?_[_0xe05f('0x21')](_0x5ac547['options'][_0xe05f('0x22')],function(_0x587ffd){return{'model':db[_0x587ffd[_0xe05f('0x23')]],'as':_0x587ffd['as'],'attributes':_0x587ffd[_0xe05f('0x1f')],'include':_0x587ffd[_0xe05f('0x22')]?_['map'](_0x587ffd[_0xe05f('0x22')],function(_0x1d21e7){return{'model':db[_0x1d21e7[_0xe05f('0x23')]],'as':_0x1d21e7['as'],'attributes':_0x1d21e7[_0xe05f('0x1f')],'include':_0x1d21e7[_0xe05f('0x22')]?_[_0xe05f('0x21')](_0x1d21e7[_0xe05f('0x22')],function(_0x59cc29){return{'model':db[_0x59cc29[_0xe05f('0x23')]],'as':_0x59cc29['as'],'attributes':_0x59cc29[_0xe05f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe05f('0x24')](function(_0x14c263){logger['info'](_0xe05f('0x19'),_0x5ac547);logger[_0xe05f('0x12')](_0xe05f('0x19'),_0x5ac547,JSON[_0xe05f('0x14')](_0x14c263));_0x44fd6b(_0x14c263);})['catch'](function(_0x2aff6c){logger[_0xe05f('0x15')](_0xe05f('0x19'),_0x2aff6c[_0xe05f('0x17')],_0x5ac547);_0x351549(_0x28513c[_0xe05f('0x15')](0x1f4,_0x2aff6c[_0xe05f('0x17')]));});});};exports['ShowFaxQueue']=function(_0x17601e){var _0x3be258=this;return new Promise(function(_0x48ae09,_0x3a6bf6){return db[_0xe05f('0x1a')][_0xe05f('0x25')]({'raw':_0x17601e['options']?_0x17601e[_0xe05f('0x1c')][_0xe05f('0x1d')]===undefined?!![]:![]:!![],'where':_0x17601e[_0xe05f('0x1c')]?_0x17601e[_0xe05f('0x1c')]['where']||null:null,'attributes':_0x17601e[_0xe05f('0x1c')]?_0x17601e[_0xe05f('0x1c')][_0xe05f('0x1f')]||null:null,'include':_0x17601e[_0xe05f('0x1c')]?_0x17601e['options'][_0xe05f('0x22')]?_[_0xe05f('0x21')](_0x17601e['options'][_0xe05f('0x22')],function(_0x2ab794){return{'model':db[_0x2ab794[_0xe05f('0x23')]],'as':_0x2ab794['as'],'attributes':_0x2ab794[_0xe05f('0x1f')],'include':_0x2ab794['include']?_[_0xe05f('0x21')](_0x2ab794[_0xe05f('0x22')],function(_0x1cfb66){return{'model':db[_0x1cfb66[_0xe05f('0x23')]],'as':_0x1cfb66['as'],'attributes':_0x1cfb66[_0xe05f('0x1f')],'include':_0x1cfb66['include']?_[_0xe05f('0x21')](_0x1cfb66[_0xe05f('0x22')],function(_0x1c588b){return{'model':db[_0x1c588b['model']],'as':_0x1c588b['as'],'attributes':_0x1c588b[_0xe05f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x82243f){logger[_0xe05f('0xf')](_0xe05f('0x26'),_0x17601e);logger[_0xe05f('0x12')](_0xe05f('0x26'),_0x17601e,JSON[_0xe05f('0x14')](_0x82243f));_0x48ae09(_0x82243f);})[_0xe05f('0x18')](function(_0x2fd097){logger[_0xe05f('0x15')](_0xe05f('0x26'),_0x2fd097[_0xe05f('0x17')],_0x17601e);_0x3a6bf6(_0x3be258[_0xe05f('0x15')](0x1f4,_0x2fd097['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0f293ac..8d0bee6 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 _0xae00=['save','update','removeListener','faxQueue:','./faxQueue.events'];(function(_0x94bcfd,_0x158819){var _0x362808=function(_0x527fd7){while(--_0x527fd7){_0x94bcfd['push'](_0x94bcfd['shift']());}};_0x362808(++_0x158819);}(_0xae00,0x1bc));var _0x0ae0=function(_0x4737a0,_0x36520e){_0x4737a0=_0x4737a0-0x0;var _0x4d558b=_0xae00[_0x4737a0];return _0x4d558b;};'use strict';var FaxQueueEvents=require(_0x0ae0('0x0'));var events=[_0x0ae0('0x1'),'remove',_0x0ae0('0x2')];function createListener(_0xa90493,_0x4b493f){return function(_0x3fba84){_0x4b493f['emit'](_0xa90493,_0x3fba84);};}function removeListener(_0x55f866,_0x57bc84){return function(){FaxQueueEvents[_0x0ae0('0x3')](_0x55f866,_0x57bc84);};}exports['register']=function(_0x48ca98){for(var _0xfd84ec=0x0,_0x5122d5=events['length'];_0xfd84ec<_0x5122d5;_0xfd84ec++){var _0x3c2fde=events[_0xfd84ec];var _0x38b448=createListener(_0x0ae0('0x4')+_0x3c2fde,_0x48ca98);FaxQueueEvents['on'](_0x3c2fde,_0x38b448);}}; \ No newline at end of file +var _0x09bd=['length','faxQueue:','update','emit','removeListener','register'];(function(_0x1e4ad1,_0xcd0134){var _0x352695=function(_0x213356){while(--_0x213356){_0x1e4ad1['push'](_0x1e4ad1['shift']());}};_0x352695(++_0xcd0134);}(_0x09bd,0xda));var _0xd09b=function(_0x23e2a3,_0x13e18e){_0x23e2a3=_0x23e2a3-0x0;var _0x27901b=_0x09bd[_0x23e2a3];return _0x27901b;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0xd09b('0x0')];function createListener(_0x25fa7f,_0x67df18){return function(_0x4cff98){_0x67df18[_0xd09b('0x1')](_0x25fa7f,_0x4cff98);};}function removeListener(_0x51ca96,_0x2e4a97){return function(){FaxQueueEvents[_0xd09b('0x2')](_0x51ca96,_0x2e4a97);};}exports[_0xd09b('0x3')]=function(_0x22f2e2){for(var _0x405551=0x0,_0x39e3d5=events[_0xd09b('0x4')];_0x405551<_0x39e3d5;_0x405551++){var _0x251b68=events[_0x405551];var _0xbec760=createListener(_0xd09b('0x5')+_0x251b68,_0x22f2e2);FaxQueueEvents['on'](_0x251b68,_0xbec760);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index bfeb0f9..76518fc 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 _0xc024=['create','post','addTeams','addAgents','put','update','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x18de49,_0x595ade){var _0x1ff164=function(_0x250933){while(--_0x250933){_0x18de49['push'](_0x18de49['shift']());}};_0x1ff164(++_0x595ade);}(_0xc024,0x105));var _0x4c02=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xc024[_0x481bf7];return _0x461787;};'use strict';var multer=require('multer');var util=require(_0x4c02('0x0'));var path=require(_0x4c02('0x1'));var timeout=require(_0x4c02('0x2'));var express=require(_0x4c02('0x3'));var router=express[_0x4c02('0x4')]();var fs_extra=require(_0x4c02('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4c02('0x6'));router[_0x4c02('0x7')]('/',auth[_0x4c02('0x8')](),controller['index']);router[_0x4c02('0x7')](_0x4c02('0x9'),auth[_0x4c02('0x8')](),controller[_0x4c02('0xa')]);router[_0x4c02('0x7')](_0x4c02('0xb'),auth['isAuthenticated'](),controller[_0x4c02('0xc')]);router[_0x4c02('0x7')](_0x4c02('0xd'),auth[_0x4c02('0x8')](),controller[_0x4c02('0xe')]);router[_0x4c02('0x7')](_0x4c02('0xf'),auth[_0x4c02('0x8')](),controller[_0x4c02('0x10')]);router['get'](_0x4c02('0x11'),auth[_0x4c02('0x8')](),controller[_0x4c02('0x12')]);router['post']('/',auth[_0x4c02('0x8')](),controller[_0x4c02('0x13')]);router[_0x4c02('0x14')](_0x4c02('0xf'),auth[_0x4c02('0x8')](),controller[_0x4c02('0x15')]);router[_0x4c02('0x14')](_0x4c02('0x11'),auth[_0x4c02('0x8')](),controller[_0x4c02('0x16')]);router[_0x4c02('0x17')](_0x4c02('0xb'),auth[_0x4c02('0x8')](),controller[_0x4c02('0x18')]);router[_0x4c02('0x19')](_0x4c02('0xb'),auth[_0x4c02('0x8')](),controller['destroy']);router[_0x4c02('0x19')](_0x4c02('0xf'),auth[_0x4c02('0x8')](),controller[_0x4c02('0x1a')]);router[_0x4c02('0x19')](_0x4c02('0x11'),auth[_0x4c02('0x8')](),controller['removeAgents']);module[_0x4c02('0x1b')]=router; \ No newline at end of file +var _0xf0d3=['Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout'];(function(_0x467d3b,_0x4225ba){var _0x1a35ec=function(_0x46673c){while(--_0x46673c){_0x467d3b['push'](_0x467d3b['shift']());}};_0x1a35ec(++_0x4225ba);}(_0xf0d3,0xba));var _0x3f0d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0d3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f0d('0x0'));var util=require(_0x3f0d('0x1'));var path=require('path');var timeout=require(_0x3f0d('0x2'));var express=require('express');var router=express[_0x3f0d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3f0d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f0d('0x5'));var controller=require(_0x3f0d('0x6'));router[_0x3f0d('0x7')]('/',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3f0d('0xa')]);router[_0x3f0d('0x7')](_0x3f0d('0xb'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0xc')]);router['get'](_0x3f0d('0xd'),auth['isAuthenticated'](),controller[_0x3f0d('0xe')]);router[_0x3f0d('0x7')]('/:id/teams',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0xf')]);router[_0x3f0d('0x7')](_0x3f0d('0x10'),auth['isAuthenticated'](),controller[_0x3f0d('0x11')]);router[_0x3f0d('0x12')]('/',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x13')]);router[_0x3f0d('0x12')](_0x3f0d('0x14'),auth[_0x3f0d('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x15')]);router['put'](_0x3f0d('0xb'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x16')]);router[_0x3f0d('0x17')](_0x3f0d('0xb'),auth['isAuthenticated'](),controller[_0x3f0d('0x18')]);router[_0x3f0d('0x17')](_0x3f0d('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x3f0d('0x17')](_0x3f0d('0x10'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x19')]);module[_0x3f0d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 6c56faa..e46816f 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 _0x2ecd=['exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ecd,0xb7));var _0xd2ec=function(_0x457a44,_0x3c9d86){_0x457a44=_0x457a44-0x0;var _0x1fc1d7=_0x2ecd[_0x457a44];return _0x1fc1d7;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd2ec('0x0')]={'uniqueid':{'type':Sequelize[_0xd2ec('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd2ec('0x1')]},'joinAt':{'type':Sequelize[_0xd2ec('0x2')]},'leaveAt':{'type':Sequelize[_0xd2ec('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd2ec('0x2')]},'reason':{'type':Sequelize[_0xd2ec('0x1')]}}; \ No newline at end of file +var _0xc429=['DATE','moment','sequelize','STRING'];(function(_0x24ef1c,_0x559d36){var _0x45ab3e=function(_0x21283b){while(--_0x21283b){_0x24ef1c['push'](_0x24ef1c['shift']());}};_0x45ab3e(++_0x559d36);}(_0xc429,0xfd));var _0x9c42=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xc429[_0x5a4400];return _0xf9b532;};'use strict';var moment=require(_0x9c42('0x0'));var Sequelize=require(_0x9c42('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9c42('0x2')]},'joinAt':{'type':Sequelize[_0x9c42('0x3')]},'leaveAt':{'type':Sequelize[_0x9c42('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9c42('0x3')]},'reason':{'type':Sequelize[_0x9c42('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a7ad959..b8914f3 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 _0x451e=['error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy'];(function(_0x317e30,_0x32ad66){var _0x203788=function(_0x264d38){while(--_0x264d38){_0x317e30['push'](_0x317e30['shift']());}};_0x203788(++_0x32ad66);}(_0x451e,0x164));var _0xe451=function(_0xdb0044,_0x40bd8e){_0xdb0044=_0xdb0044-0x0;var _0x30fc0d=_0x451e[_0xdb0044];return _0x30fc0d;};'use strict';var emlformat=require(_0xe451('0x0'));var rimraf=require(_0xe451('0x1'));var zipdir=require(_0xe451('0x2'));var jsonpatch=require(_0xe451('0x3'));var rp=require(_0xe451('0x4'));var moment=require(_0xe451('0x5'));var BPromise=require(_0xe451('0x6'));var Mustache=require(_0xe451('0x7'));var util=require(_0xe451('0x8'));var path=require('path');var sox=require(_0xe451('0x9'));var csv=require('to-csv');var ejs=require(_0xe451('0xa'));var fs=require('fs');var fs_extra=require(_0xe451('0xb'));var _=require(_0xe451('0xc'));var squel=require(_0xe451('0xd'));var crypto=require(_0xe451('0xe'));var jsforce=require(_0xe451('0xf'));var deskjs=require(_0xe451('0x10'));var toCsv=require(_0xe451('0x11'));var querystring=require(_0xe451('0x12'));var Papa=require(_0xe451('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe451('0x14'));var logger=require(_0xe451('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe451('0x16'));var db=require(_0xe451('0x17'))['db'];function respondWithStatusCode(_0x59d77c,_0x3e6f55){_0x3e6f55=_0x3e6f55||0xcc;return function(_0xf20798){if(_0xf20798){return _0x59d77c[_0xe451('0x18')](_0x3e6f55);}return _0x59d77c[_0xe451('0x19')](_0x3e6f55)[_0xe451('0x1a')]();};}function respondWithResult(_0x1700a2,_0x665bec){_0x665bec=_0x665bec||0xc8;return function(_0x3cbf5b){if(_0x3cbf5b){return _0x1700a2[_0xe451('0x19')](_0x665bec)[_0xe451('0x1b')](_0x3cbf5b);}};}function respondWithFilteredResult(_0x263373,_0x236725){return function(_0x217d70){if(_0x217d70){var _0x42577e=typeof _0x236725[_0xe451('0x1c')]===_0xe451('0x1d')&&typeof _0x236725[_0xe451('0x1e')]==='undefined';var _0x5f4dc6=_0x217d70['count'];var _0x26d8a9=_0x42577e?0x0:_0x236725[_0xe451('0x1c')];var _0x27300b=_0x42577e?_0x217d70[_0xe451('0x1f')]:_0x236725[_0xe451('0x1c')]+_0x236725['limit'];var _0x1b6ae0;if(_0x27300b>=_0x5f4dc6){_0x27300b=_0x5f4dc6;_0x1b6ae0=0xc8;}else{_0x1b6ae0=0xce;}_0x263373[_0xe451('0x19')](_0x1b6ae0);return _0x263373[_0xe451('0x20')](_0xe451('0x21'),_0x26d8a9+'-'+_0x27300b+'/'+_0x5f4dc6)[_0xe451('0x1b')](_0x217d70);}return null;};}function patchUpdates(_0x1d91c1){return function(_0x51f58f){try{jsonpatch[_0xe451('0x22')](_0x51f58f,_0x1d91c1,!![]);}catch(_0x426a49){return BPromise['reject'](_0x426a49);}return _0x51f58f[_0xe451('0x23')]();};}function saveUpdates(_0xe0efaf,_0x4910b4){return function(_0x16255a){if(_0x16255a){return _0x16255a[_0xe451('0x24')](_0xe0efaf)[_0xe451('0x25')](function(_0x4f2543){return _0x4f2543;});}return null;};}function removeEntity(_0x10c255,_0x54a3e7){return function(_0x4cc32e){if(_0x4cc32e){return _0x4cc32e[_0xe451('0x26')]()[_0xe451('0x25')](function(){_0x10c255[_0xe451('0x19')](0xcc)[_0xe451('0x1a')]();});}};}function handleEntityNotFound(_0x962d22,_0x5e1f5b){return function(_0x12e34d){if(!_0x12e34d){_0x962d22[_0xe451('0x18')](0x194);}return _0x12e34d;};}function handleError(_0xa5dec3,_0x5e43b3){_0x5e43b3=_0x5e43b3||0x1f4;return function(_0x255947){logger[_0xe451('0x27')](_0x255947[_0xe451('0x28')]);if(_0x255947[_0xe451('0x29')]){delete _0x255947['name'];}_0xa5dec3[_0xe451('0x19')](_0x5e43b3)[_0xe451('0x2a')](_0x255947);};}exports[_0xe451('0x2b')]=function(_0x201991,_0x50012d){var _0x4bd8c8={},_0x2ede05={},_0x446f29={'count':0x0,'rows':[]};var _0x3acab5=_[_0xe451('0x2c')](db[_0xe451('0x2d')][_0xe451('0x2e')],function(_0x52125c){return{'name':_0x52125c[_0xe451('0x2f')],'type':_0x52125c[_0xe451('0x30')][_0xe451('0x31')]};});_0x2ede05[_0xe451('0x32')]=_[_0xe451('0x2c')](_0x3acab5,_0xe451('0x29'));_0x2ede05['query']=_[_0xe451('0x33')](_0x201991[_0xe451('0x34')]);_0x2ede05[_0xe451('0x35')]=_[_0xe451('0x36')](_0x2ede05[_0xe451('0x32')],_0x2ede05[_0xe451('0x34')]);_0x4bd8c8['attributes']=_[_0xe451('0x36')](_0x2ede05[_0xe451('0x32')],qs[_0xe451('0x37')](_0x201991[_0xe451('0x34')]['fields']));_0x4bd8c8[_0xe451('0x38')]=_0x4bd8c8[_0xe451('0x38')][_0xe451('0x39')]?_0x4bd8c8[_0xe451('0x38')]:_0x2ede05[_0xe451('0x32')];if(!_0x201991[_0xe451('0x34')][_0xe451('0x3a')](_0xe451('0x3b'))){_0x4bd8c8[_0xe451('0x1e')]=qs[_0xe451('0x1e')](_0x201991['query'][_0xe451('0x1e')]);_0x4bd8c8[_0xe451('0x1c')]=qs['offset'](_0x201991[_0xe451('0x34')][_0xe451('0x1c')]);}_0x4bd8c8[_0xe451('0x3c')]=qs[_0xe451('0x3d')](_0x201991[_0xe451('0x34')][_0xe451('0x3d')]);_0x4bd8c8[_0xe451('0x3e')]=qs[_0xe451('0x35')](_[_0xe451('0x3f')](_0x201991[_0xe451('0x34')],_0x2ede05['filters']),_0x3acab5);if(_0x201991[_0xe451('0x34')][_0xe451('0x40')]){_0x4bd8c8[_0xe451('0x3e')]=_[_0xe451('0x41')](_0x4bd8c8[_0xe451('0x3e')],{'$or':_['map'](_0x3acab5,function(_0x1cb827){if(_0x1cb827[_0xe451('0x30')]!==_0xe451('0x42')){var _0x9e7e88={};_0x9e7e88[_0x1cb827[_0xe451('0x29')]]={'$like':'%'+_0x201991[_0xe451('0x34')][_0xe451('0x40')]+'%'};return _0x9e7e88;}})});}_0x4bd8c8=_[_0xe451('0x41')]({},_0x4bd8c8,_0x201991[_0xe451('0x43')]);var _0x515c95={'where':_0x4bd8c8[_0xe451('0x3e')]};return db[_0xe451('0x2d')][_0xe451('0x1f')](_0x515c95)['then'](function(_0x3b3ac7){_0x446f29[_0xe451('0x1f')]=_0x3b3ac7;if(_0x201991[_0xe451('0x34')][_0xe451('0x44')]){_0x4bd8c8[_0xe451('0x45')]=[{'all':!![]}];}return db[_0xe451('0x2d')][_0xe451('0x46')](_0x4bd8c8);})[_0xe451('0x25')](function(_0x564d75){_0x446f29[_0xe451('0x47')]=_0x564d75;return _0x446f29;})['then'](respondWithFilteredResult(_0x50012d,_0x4bd8c8))[_0xe451('0x48')](handleError(_0x50012d,null));};exports[_0xe451('0x49')]=function(_0x329e30,_0x5c7ca2){var _0x302e67={'raw':!![],'where':{'id':_0x329e30[_0xe451('0x4a')]['id']}},_0x4bd48c={};_0x4bd48c['model']=_[_0xe451('0x33')](db[_0xe451('0x2d')][_0xe451('0x2e')]);_0x4bd48c[_0xe451('0x34')]=_[_0xe451('0x33')](_0x329e30[_0xe451('0x34')]);_0x4bd48c['filters']=_[_0xe451('0x36')](_0x4bd48c[_0xe451('0x32')],_0x4bd48c[_0xe451('0x34')]);_0x302e67['attributes']=_[_0xe451('0x36')](_0x4bd48c[_0xe451('0x32')],qs[_0xe451('0x37')](_0x329e30[_0xe451('0x34')][_0xe451('0x37')]));_0x302e67['attributes']=_0x302e67[_0xe451('0x38')][_0xe451('0x39')]?_0x302e67[_0xe451('0x38')]:_0x4bd48c[_0xe451('0x32')];if(_0x329e30[_0xe451('0x34')][_0xe451('0x44')]){_0x302e67[_0xe451('0x45')]=[{'all':!![]}];}_0x302e67=_[_0xe451('0x41')]({},_0x302e67,_0x329e30[_0xe451('0x43')]);return db['FaxQueueReport']['find'](_0x302e67)['then'](handleEntityNotFound(_0x5c7ca2,null))[_0xe451('0x25')](respondWithResult(_0x5c7ca2,null))[_0xe451('0x48')](handleError(_0x5c7ca2,null));};exports[_0xe451('0x4b')]=function(_0x18fbc3,_0x36cfd6){return db[_0xe451('0x2d')][_0xe451('0x4b')](_0x18fbc3[_0xe451('0x4c')],{})[_0xe451('0x25')](respondWithResult(_0x36cfd6,0xc9))['catch'](handleError(_0x36cfd6,null));};exports[_0xe451('0x24')]=function(_0x5824bf,_0x368913){if(_0x5824bf[_0xe451('0x4c')]['id']){delete _0x5824bf['body']['id'];}return db['FaxQueueReport'][_0xe451('0x4d')]({'where':{'id':_0x5824bf[_0xe451('0x4a')]['id']}})[_0xe451('0x25')](handleEntityNotFound(_0x368913,null))['then'](saveUpdates(_0x5824bf[_0xe451('0x4c')],null))[_0xe451('0x25')](respondWithResult(_0x368913,null))[_0xe451('0x48')](handleError(_0x368913,null));};exports[_0xe451('0x26')]=function(_0x1d7321,_0x363f55){return db['FaxQueueReport'][_0xe451('0x4d')]({'where':{'id':_0x1d7321[_0xe451('0x4a')]['id']}})[_0xe451('0x25')](handleEntityNotFound(_0x363f55,null))[_0xe451('0x25')](removeEntity(_0x363f55,null))['catch'](handleError(_0x363f55,null));};exports[_0xe451('0x4e')]=function(_0x27208d,_0x48e808){return db[_0xe451('0x2d')]['describe']()[_0xe451('0x25')](respondWithResult(_0x48e808,null))[_0xe451('0x48')](handleError(_0x48e808,null));}; \ No newline at end of file +var _0x399d=['moment','bluebird','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','rows','params','catch','create','body','find','describe','eml-format','zip-dir'];(function(_0x5bbf70,_0x2f58b3){var _0x397a54=function(_0x4b1bc7){while(--_0x4b1bc7){_0x5bbf70['push'](_0x5bbf70['shift']());}};_0x397a54(++_0x2f58b3);}(_0x399d,0x196));var _0xd399=function(_0x6c7302,_0x5c2a02){_0x6c7302=_0x6c7302-0x0;var _0x19a2c2=_0x399d[_0x6c7302];return _0x19a2c2;};'use strict';var emlformat=require(_0xd399('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd399('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd399('0x2'));var BPromise=require(_0xd399('0x3'));var Mustache=require(_0xd399('0x4'));var util=require(_0xd399('0x5'));var path=require('path');var sox=require(_0xd399('0x6'));var csv=require(_0xd399('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd399('0x8'));var jsforce=require(_0xd399('0x9'));var deskjs=require(_0xd399('0xa'));var toCsv=require(_0xd399('0x7'));var querystring=require(_0xd399('0xb'));var Papa=require(_0xd399('0xc'));var Redis=require(_0xd399('0xd'));var authService=require(_0xd399('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd399('0xf'));var hardwareService=require(_0xd399('0x10'));var logger=require(_0xd399('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd399('0x12'))['db'];function respondWithStatusCode(_0x1b6b1a,_0x2bdcc9){_0x2bdcc9=_0x2bdcc9||0xcc;return function(_0x1601ee){if(_0x1601ee){return _0x1b6b1a[_0xd399('0x13')](_0x2bdcc9);}return _0x1b6b1a[_0xd399('0x14')](_0x2bdcc9)[_0xd399('0x15')]();};}function respondWithResult(_0x41fece,_0x5b6ab1){_0x5b6ab1=_0x5b6ab1||0xc8;return function(_0x24f0aa){if(_0x24f0aa){return _0x41fece[_0xd399('0x14')](_0x5b6ab1)['json'](_0x24f0aa);}};}function respondWithFilteredResult(_0x3bfe0b,_0x5b9321){return function(_0x24af56){if(_0x24af56){var _0x24267d=typeof _0x5b9321[_0xd399('0x16')]===_0xd399('0x17')&&typeof _0x5b9321[_0xd399('0x18')]==='undefined';var _0x562185=_0x24af56[_0xd399('0x19')];var _0x40872c=_0x24267d?0x0:_0x5b9321[_0xd399('0x16')];var _0x2016a7=_0x24267d?_0x24af56[_0xd399('0x19')]:_0x5b9321[_0xd399('0x16')]+_0x5b9321[_0xd399('0x18')];var _0x52d0f9;if(_0x2016a7>=_0x562185){_0x2016a7=_0x562185;_0x52d0f9=0xc8;}else{_0x52d0f9=0xce;}_0x3bfe0b[_0xd399('0x14')](_0x52d0f9);return _0x3bfe0b['set'](_0xd399('0x1a'),_0x40872c+'-'+_0x2016a7+'/'+_0x562185)[_0xd399('0x1b')](_0x24af56);}return null;};}function patchUpdates(_0x2685d3){return function(_0x2c646b){try{jsonpatch[_0xd399('0x1c')](_0x2c646b,_0x2685d3,!![]);}catch(_0x3947e4){return BPromise[_0xd399('0x1d')](_0x3947e4);}return _0x2c646b[_0xd399('0x1e')]();};}function saveUpdates(_0x1a61ee,_0x324567){return function(_0x27cdbc){if(_0x27cdbc){return _0x27cdbc[_0xd399('0x1f')](_0x1a61ee)[_0xd399('0x20')](function(_0x6209fc){return _0x6209fc;});}return null;};}function removeEntity(_0x233198,_0x57bddb){return function(_0x5e12f8){if(_0x5e12f8){return _0x5e12f8[_0xd399('0x21')]()[_0xd399('0x20')](function(){_0x233198[_0xd399('0x14')](0xcc)[_0xd399('0x15')]();});}};}function handleEntityNotFound(_0x92d3a,_0x431125){return function(_0x5edf08){if(!_0x5edf08){_0x92d3a[_0xd399('0x13')](0x194);}return _0x5edf08;};}function handleError(_0x37290c,_0x4fbd19){_0x4fbd19=_0x4fbd19||0x1f4;return function(_0xdc16b9){logger['error'](_0xdc16b9['stack']);if(_0xdc16b9[_0xd399('0x22')]){delete _0xdc16b9[_0xd399('0x22')];}_0x37290c['status'](_0x4fbd19)[_0xd399('0x23')](_0xdc16b9);};}exports[_0xd399('0x24')]=function(_0x1ac309,_0x2e71dc){var _0x478d7e={},_0x81d5bd={},_0x26eecd={'count':0x0,'rows':[]};var _0x3a6430=_[_0xd399('0x25')](db['FaxQueueReport'][_0xd399('0x26')],function(_0x325a49){return{'name':_0x325a49[_0xd399('0x27')],'type':_0x325a49[_0xd399('0x28')][_0xd399('0x29')]};});_0x81d5bd[_0xd399('0x2a')]=_[_0xd399('0x25')](_0x3a6430,_0xd399('0x22'));_0x81d5bd['query']=_[_0xd399('0x2b')](_0x1ac309[_0xd399('0x2c')]);_0x81d5bd[_0xd399('0x2d')]=_[_0xd399('0x2e')](_0x81d5bd['model'],_0x81d5bd[_0xd399('0x2c')]);_0x478d7e[_0xd399('0x2f')]=_['intersection'](_0x81d5bd['model'],qs[_0xd399('0x30')](_0x1ac309[_0xd399('0x2c')]['fields']));_0x478d7e[_0xd399('0x2f')]=_0x478d7e[_0xd399('0x2f')][_0xd399('0x31')]?_0x478d7e[_0xd399('0x2f')]:_0x81d5bd[_0xd399('0x2a')];if(!_0x1ac309[_0xd399('0x2c')][_0xd399('0x32')](_0xd399('0x33'))){_0x478d7e[_0xd399('0x18')]=qs['limit'](_0x1ac309[_0xd399('0x2c')][_0xd399('0x18')]);_0x478d7e[_0xd399('0x16')]=qs[_0xd399('0x16')](_0x1ac309[_0xd399('0x2c')][_0xd399('0x16')]);}_0x478d7e['order']=qs[_0xd399('0x34')](_0x1ac309[_0xd399('0x2c')][_0xd399('0x34')]);_0x478d7e[_0xd399('0x35')]=qs[_0xd399('0x2d')](_[_0xd399('0x36')](_0x1ac309[_0xd399('0x2c')],_0x81d5bd[_0xd399('0x2d')]),_0x3a6430);if(_0x1ac309['query']['filter']){_0x478d7e[_0xd399('0x35')]=_[_0xd399('0x37')](_0x478d7e[_0xd399('0x35')],{'$or':_[_0xd399('0x25')](_0x3a6430,function(_0x1f2e98){if(_0x1f2e98[_0xd399('0x28')]!==_0xd399('0x38')){var _0x607904={};_0x607904[_0x1f2e98['name']]={'$like':'%'+_0x1ac309[_0xd399('0x2c')]['filter']+'%'};return _0x607904;}})});}_0x478d7e=_[_0xd399('0x37')]({},_0x478d7e,_0x1ac309[_0xd399('0x39')]);var _0x25313e={'where':_0x478d7e[_0xd399('0x35')]};return db[_0xd399('0x3a')][_0xd399('0x19')](_0x25313e)[_0xd399('0x20')](function(_0x53c824){_0x26eecd[_0xd399('0x19')]=_0x53c824;if(_0x1ac309['query'][_0xd399('0x3b')]){_0x478d7e[_0xd399('0x3c')]=[{'all':!![]}];}return db[_0xd399('0x3a')]['findAll'](_0x478d7e);})[_0xd399('0x20')](function(_0x3afc5a){_0x26eecd[_0xd399('0x3d')]=_0x3afc5a;return _0x26eecd;})[_0xd399('0x20')](respondWithFilteredResult(_0x2e71dc,_0x478d7e))['catch'](handleError(_0x2e71dc,null));};exports['show']=function(_0x43e01b,_0x5404ec){var _0x4dcfb3={'raw':!![],'where':{'id':_0x43e01b[_0xd399('0x3e')]['id']}},_0x421a83={};_0x421a83[_0xd399('0x2a')]=_[_0xd399('0x2b')](db[_0xd399('0x3a')]['rawAttributes']);_0x421a83[_0xd399('0x2c')]=_['keys'](_0x43e01b['query']);_0x421a83['filters']=_[_0xd399('0x2e')](_0x421a83[_0xd399('0x2a')],_0x421a83[_0xd399('0x2c')]);_0x4dcfb3[_0xd399('0x2f')]=_[_0xd399('0x2e')](_0x421a83[_0xd399('0x2a')],qs[_0xd399('0x30')](_0x43e01b[_0xd399('0x2c')][_0xd399('0x30')]));_0x4dcfb3[_0xd399('0x2f')]=_0x4dcfb3[_0xd399('0x2f')][_0xd399('0x31')]?_0x4dcfb3[_0xd399('0x2f')]:_0x421a83[_0xd399('0x2a')];if(_0x43e01b[_0xd399('0x2c')]['includeAll']){_0x4dcfb3[_0xd399('0x3c')]=[{'all':!![]}];}_0x4dcfb3=_[_0xd399('0x37')]({},_0x4dcfb3,_0x43e01b[_0xd399('0x39')]);return db[_0xd399('0x3a')]['find'](_0x4dcfb3)[_0xd399('0x20')](handleEntityNotFound(_0x5404ec,null))['then'](respondWithResult(_0x5404ec,null))[_0xd399('0x3f')](handleError(_0x5404ec,null));};exports[_0xd399('0x40')]=function(_0x1a012b,_0x5c839a){return db[_0xd399('0x3a')][_0xd399('0x40')](_0x1a012b[_0xd399('0x41')],{})[_0xd399('0x20')](respondWithResult(_0x5c839a,0xc9))[_0xd399('0x3f')](handleError(_0x5c839a,null));};exports[_0xd399('0x1f')]=function(_0x571714,_0x449cd8){if(_0x571714['body']['id']){delete _0x571714[_0xd399('0x41')]['id'];}return db[_0xd399('0x3a')][_0xd399('0x42')]({'where':{'id':_0x571714[_0xd399('0x3e')]['id']}})['then'](handleEntityNotFound(_0x449cd8,null))['then'](saveUpdates(_0x571714[_0xd399('0x41')],null))[_0xd399('0x20')](respondWithResult(_0x449cd8,null))[_0xd399('0x3f')](handleError(_0x449cd8,null));};exports[_0xd399('0x21')]=function(_0x5c346c,_0x2f168a){return db[_0xd399('0x3a')][_0xd399('0x42')]({'where':{'id':_0x5c346c[_0xd399('0x3e')]['id']}})[_0xd399('0x20')](handleEntityNotFound(_0x2f168a,null))[_0xd399('0x20')](removeEntity(_0x2f168a,null))[_0xd399('0x3f')](handleError(_0x2f168a,null));};exports[_0xd399('0x43')]=function(_0x46fa92,_0x34251b){return db['FaxQueueReport'][_0xd399('0x43')]()[_0xd399('0x20')](respondWithResult(_0x34251b,null))[_0xd399('0x3f')](handleError(_0x34251b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 0110753..ff53869 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 _0x9376=['report_fax_queue','uniqueid','lodash','../../config/logger','request-promise','path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9376,0x156));var _0x6937=function(_0x505766,_0x4d4a04){_0x505766=_0x505766-0x0;var _0x429123=_0x9376[_0x505766];return _0x429123;};'use strict';var _=require(_0x6937('0x0'));var util=require('util');var logger=require(_0x6937('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6937('0x2'));var fs=require('fs');var path=require(_0x6937('0x3'));var rimraf=require('rimraf');var config=require(_0x6937('0x4'));var attributes=require(_0x6937('0x5'));module['exports']=function(_0x1c581d,_0x45c627){return _0x1c581d[_0x6937('0x6')](_0x6937('0x7'),attributes,{'tableName':_0x6937('0x8'),'paranoid':![],'indexes':[{'name':_0x6937('0x9'),'fields':[_0x6937('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x27a8e2,_0x1c10c8){var _0x1ceed6=function(_0x3efcea){while(--_0x3efcea){_0x27a8e2['push'](_0x27a8e2['shift']());}};_0x1ceed6(++_0x1c10c8);}(_0x00bb,0x195));var _0xb00b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x00bb[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))(_0xb00b('0x3'));var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb00b('0x6'));var rimraf=require(_0xb00b('0x7'));var config=require(_0xb00b('0x8'));var attributes=require(_0xb00b('0x9'));module['exports']=function(_0xab92e6,_0x4f4601){return _0xab92e6[_0xb00b('0xa')](_0xb00b('0xb'),attributes,{'tableName':_0xb00b('0xc'),'paranoid':![],'indexes':[{'name':_0xb00b('0xd'),'fields':[_0xb00b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ec480a1..2edc47c 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 _0x8fa4=['stringify','UpdateFaxQueueReport','FaxQueueReport','update','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateFaxQueueReport','body','raw'];(function(_0x9437f0,_0x19126d){var _0x52a399=function(_0x1c36fe){while(--_0x1c36fe){_0x9437f0['push'](_0x9437f0['shift']());}};_0x52a399(++_0x19126d);}(_0x8fa4,0x1e8));var _0x48fa=function(_0x139db2,_0x4cb3d8){_0x139db2=_0x139db2-0x0;var _0x552baf=_0x8fa4[_0x139db2];return _0x552baf;};'use strict';var _=require(_0x48fa('0x0'));var util=require(_0x48fa('0x1'));var moment=require(_0x48fa('0x2'));var BPromise=require(_0x48fa('0x3'));var rs=require(_0x48fa('0x4'));var fs=require('fs');var Redis=require(_0x48fa('0x5'));var db=require(_0x48fa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x48fa('0x7'))('rpc');var config=require(_0x48fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x48fa('0x9')][_0x48fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e472,_0x257bd8,_0x3df866){return new BPromise(function(_0x103748,_0x532572){return client[_0x48fa('0xb')](_0x27e472,_0x3df866)[_0x48fa('0xc')](function(_0x3933f9){logger[_0x48fa('0xd')](_0x48fa('0xe'),_0x257bd8,_0x48fa('0xf'));logger[_0x48fa('0x10')](_0x48fa('0x11'),_0x257bd8,_0x48fa('0xf'),JSON['stringify'](_0x3933f9));if(_0x3933f9[_0x48fa('0x12')]){if(_0x3933f9[_0x48fa('0x12')]['code']===0x1f4){logger['error'](_0x48fa('0xe'),_0x257bd8,_0x3933f9[_0x48fa('0x12')][_0x48fa('0x13')]);return _0x532572(_0x3933f9[_0x48fa('0x12')]['message']);}logger[_0x48fa('0x12')](_0x48fa('0xe'),_0x257bd8,_0x3933f9[_0x48fa('0x12')][_0x48fa('0x13')]);return _0x103748(_0x3933f9[_0x48fa('0x12')]['message']);}else{logger[_0x48fa('0xd')](_0x48fa('0xe'),_0x257bd8,'request\x20sent');_0x103748(_0x3933f9['result'][_0x48fa('0x13')]);}})[_0x48fa('0x14')](function(_0x31c18a){logger[_0x48fa('0x12')](_0x48fa('0xe'),_0x257bd8,_0x31c18a);_0x532572(_0x31c18a);});});}exports[_0x48fa('0x15')]=function(_0x3a146f){var _0x22b8ca=this;return new Promise(function(_0x5e04c3,_0x2f598d){return db['FaxQueueReport']['create'](_0x3a146f[_0x48fa('0x16')],{'raw':_0x3a146f['options']?_0x3a146f['options'][_0x48fa('0x17')]===undefined?!![]:![]:!![]})[_0x48fa('0xc')](function(_0x65a541){logger['info'](_0x48fa('0x15'),_0x3a146f);logger['debug']('CreateFaxQueueReport',_0x3a146f,JSON[_0x48fa('0x18')](_0x65a541));_0x5e04c3(_0x65a541);})[_0x48fa('0x14')](function(_0x36c943){logger[_0x48fa('0x12')]('CreateFaxQueueReport',_0x36c943[_0x48fa('0x13')],_0x3a146f);_0x2f598d(_0x22b8ca[_0x48fa('0x12')](0x1f4,_0x36c943[_0x48fa('0x13')]));});});};exports[_0x48fa('0x19')]=function(_0xa8e255){var _0x5a8e4d=this;return new Promise(function(_0x98a7f5,_0x49bc16){return db[_0x48fa('0x1a')][_0x48fa('0x1b')](_0xa8e255[_0x48fa('0x16')],{'raw':_0xa8e255[_0x48fa('0x1c')]?_0xa8e255[_0x48fa('0x1c')][_0x48fa('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa8e255['options']?_0xa8e255[_0x48fa('0x1c')][_0x48fa('0x1d')]||null:null,'attributes':_0xa8e255[_0x48fa('0x1c')]?_0xa8e255[_0x48fa('0x1c')][_0x48fa('0x1e')]||null:null,'limit':_0xa8e255[_0x48fa('0x1c')]?_0xa8e255[_0x48fa('0x1c')][_0x48fa('0x1f')]||null:null})[_0x48fa('0xc')](function(_0x4bce32){logger[_0x48fa('0xd')](_0x48fa('0x19'),_0xa8e255);logger['debug'](_0x48fa('0x19'),_0xa8e255,JSON['stringify'](_0x4bce32));_0x98a7f5(_0x4bce32);})['catch'](function(_0xd80207){logger['error'](_0x48fa('0x19'),_0xd80207[_0x48fa('0x13')],_0xa8e255);_0x49bc16(_0x5a8e4d['error'](0x1f4,_0xd80207['message']));});});}; \ No newline at end of file +var _0x6492=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0x6492,0x124));var _0x2649=function(_0xe4f6d,_0x472f54){_0xe4f6d=_0xe4f6d-0x0;var _0x5d975b=_0x6492[_0xe4f6d];return _0x5d975b;};'use strict';var _=require(_0x2649('0x0'));var util=require('util');var moment=require(_0x2649('0x1'));var BPromise=require('bluebird');var rs=require(_0x2649('0x2'));var fs=require('fs');var Redis=require(_0x2649('0x3'));var db=require(_0x2649('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2649('0x5'))(_0x2649('0x6'));var config=require('../../config/environment');var jayson=require(_0x2649('0x7'));var client=jayson[_0x2649('0x8')][_0x2649('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45030e,_0x41ba80,_0x5a014d){return new BPromise(function(_0x43a612,_0x11a55c){return client[_0x2649('0xa')](_0x45030e,_0x5a014d)['then'](function(_0x3ab456){logger[_0x2649('0xb')](_0x2649('0xc'),_0x41ba80,_0x2649('0xd'));logger[_0x2649('0xe')](_0x2649('0xf'),_0x41ba80,_0x2649('0xd'),JSON[_0x2649('0x10')](_0x3ab456));if(_0x3ab456[_0x2649('0x11')]){if(_0x3ab456[_0x2649('0x11')][_0x2649('0x12')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x41ba80,_0x3ab456[_0x2649('0x11')][_0x2649('0x13')]);return _0x11a55c(_0x3ab456['error'][_0x2649('0x13')]);}logger['error'](_0x2649('0xc'),_0x41ba80,_0x3ab456[_0x2649('0x11')][_0x2649('0x13')]);return _0x43a612(_0x3ab456['error'][_0x2649('0x13')]);}else{logger[_0x2649('0xb')](_0x2649('0xc'),_0x41ba80,_0x2649('0xd'));_0x43a612(_0x3ab456[_0x2649('0x14')]['message']);}})[_0x2649('0x15')](function(_0x452b8c){logger[_0x2649('0x11')](_0x2649('0xc'),_0x41ba80,_0x452b8c);_0x11a55c(_0x452b8c);});});}exports[_0x2649('0x16')]=function(_0x54942b){var _0x160d6c=this;return new Promise(function(_0x46e272,_0x401f65){return db[_0x2649('0x17')][_0x2649('0x18')](_0x54942b[_0x2649('0x19')],{'raw':_0x54942b['options']?_0x54942b[_0x2649('0x1a')][_0x2649('0x1b')]===undefined?!![]:![]:!![]})[_0x2649('0x1c')](function(_0x36d1a3){logger[_0x2649('0xb')](_0x2649('0x16'),_0x54942b);logger[_0x2649('0xe')]('CreateFaxQueueReport',_0x54942b,JSON[_0x2649('0x10')](_0x36d1a3));_0x46e272(_0x36d1a3);})['catch'](function(_0x6030c){logger[_0x2649('0x11')](_0x2649('0x16'),_0x6030c[_0x2649('0x13')],_0x54942b);_0x401f65(_0x160d6c[_0x2649('0x11')](0x1f4,_0x6030c[_0x2649('0x13')]));});});};exports[_0x2649('0x1d')]=function(_0x2a063d){var _0x406094=this;return new Promise(function(_0x2ab634,_0x458faa){return db['FaxQueueReport'][_0x2649('0x1e')](_0x2a063d[_0x2649('0x19')],{'raw':_0x2a063d[_0x2649('0x1a')]?_0x2a063d['options'][_0x2649('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a063d[_0x2649('0x1a')]?_0x2a063d[_0x2649('0x1a')][_0x2649('0x1f')]||null:null,'attributes':_0x2a063d[_0x2649('0x1a')]?_0x2a063d[_0x2649('0x1a')][_0x2649('0x20')]||null:null,'limit':_0x2a063d[_0x2649('0x1a')]?_0x2a063d[_0x2649('0x1a')][_0x2649('0x21')]||null:null})[_0x2649('0x1c')](function(_0x3c3985){logger['info'](_0x2649('0x1d'),_0x2a063d);logger[_0x2649('0xe')](_0x2649('0x1d'),_0x2a063d,JSON['stringify'](_0x3c3985));_0x2ab634(_0x3c3985);})[_0x2649('0x15')](function(_0x4e72e7){logger[_0x2649('0x11')](_0x2649('0x1d'),_0x4e72e7[_0x2649('0x13')],_0x2a063d);_0x458faa(_0x406094['error'](0x1f4,_0x4e72e7[_0x2649('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index d8d9ee4..b7bc777 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 _0xef74=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','delete','destroy'];(function(_0x469965,_0x4d5691){var _0x3b8729=function(_0x5a823e){while(--_0x5a823e){_0x469965['push'](_0x469965['shift']());}};_0x3b8729(++_0x4d5691);}(_0xef74,0x1b6));var _0x4ef7=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xef74[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x4ef7('0x0'));var util=require(_0x4ef7('0x1'));var path=require(_0x4ef7('0x2'));var timeout=require(_0x4ef7('0x3'));var express=require('express');var router=express[_0x4ef7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4ef7('0x5'));var interaction=require(_0x4ef7('0x6'));var config=require(_0x4ef7('0x7'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x4ef7('0x8')](),controller[_0x4ef7('0x9')]);router[_0x4ef7('0xa')](_0x4ef7('0xb'),auth[_0x4ef7('0x8')](),controller[_0x4ef7('0xc')]);router[_0x4ef7('0xa')](_0x4ef7('0xd'),auth['isAuthenticated'](),controller[_0x4ef7('0xe')]);router['post']('/',auth[_0x4ef7('0x8')](),controller[_0x4ef7('0xf')]);router['put'](_0x4ef7('0xd'),auth[_0x4ef7('0x8')](),controller['update']);router[_0x4ef7('0x10')](_0x4ef7('0xd'),auth[_0x4ef7('0x8')](),controller[_0x4ef7('0x11')]);module[_0x4ef7('0x12')]=router; \ No newline at end of file +var _0xc0bc=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x49adc7,_0x204e95){var _0xf0245=function(_0x22d490){while(--_0x22d490){_0x49adc7['push'](_0x49adc7['shift']());}};_0xf0245(++_0x204e95);}(_0xc0bc,0x105));var _0xcc0b=function(_0x1cc7a7,_0x4b32c2){_0x1cc7a7=_0x1cc7a7-0x0;var _0x5bc099=_0xc0bc[_0x1cc7a7];return _0x5bc099;};'use strict';var multer=require(_0xcc0b('0x0'));var util=require('util');var path=require(_0xcc0b('0x1'));var timeout=require(_0xcc0b('0x2'));var express=require(_0xcc0b('0x3'));var router=express[_0xcc0b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcc0b('0x5'));var config=require(_0xcc0b('0x6'));var controller=require('./faxQueueReport.controller');router[_0xcc0b('0x7')]('/',auth[_0xcc0b('0x8')](),controller[_0xcc0b('0x9')]);router[_0xcc0b('0x7')](_0xcc0b('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xcc0b('0xb'),auth[_0xcc0b('0x8')](),controller[_0xcc0b('0xc')]);router['post']('/',auth[_0xcc0b('0x8')](),controller[_0xcc0b('0xd')]);router[_0xcc0b('0xe')](_0xcc0b('0xb'),auth[_0xcc0b('0x8')](),controller[_0xcc0b('0xf')]);router[_0xcc0b('0x10')](_0xcc0b('0xb'),auth['isAuthenticated'](),controller[_0xcc0b('0x11')]);module[_0xcc0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e600309..37de2c0 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 _0x0c99=['queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0x0c99,0x8f));var _0x90c9=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x0c99[_0x3c8e9a];return _0x2d4c57;};'use strict';var moment=require(_0x90c9('0x0'));var Sequelize=require(_0x90c9('0x1'));module[_0x90c9('0x2')]={'uniqueid':{'type':Sequelize[_0x90c9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x90c9('0x4')](_0x90c9('0x5'),_0x90c9('0x6'),_0x90c9('0x7')),'allowNull':![],'defaultValue':_0x90c9('0x7')},'transferredAt':{'type':Sequelize[_0x90c9('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x90c9('0x9')]}}; \ No newline at end of file +var _0xf23f=['DATE','NOW','moment','exports','ENUM','agent','queue'];(function(_0x15a61c,_0x4a3e68){var _0x219018=function(_0xf305e1){while(--_0xf305e1){_0x15a61c['push'](_0x15a61c['shift']());}};_0x219018(++_0x4a3e68);}(_0xf23f,0x152));var _0xff23=function(_0x4a6462,_0x61b1b5){_0x4a6462=_0x4a6462-0x0;var _0x122407=_0xf23f[_0x4a6462];return _0x122407;};'use strict';var moment=require(_0xff23('0x0'));var Sequelize=require('sequelize');module[_0xff23('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xff23('0x2')]('account',_0xff23('0x3'),_0xff23('0x4')),'allowNull':![],'defaultValue':_0xff23('0x4')},'transferredAt':{'type':Sequelize[_0xff23('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xff23('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index afdc69e..7b9d8da 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 _0x1736=['path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x1736,0x98));var _0x6173=function(_0x1277e1,_0x133847){_0x1277e1=_0x1277e1-0x0;var _0x4e6c29=_0x1736[_0x1277e1];return _0x4e6c29;};'use strict';var emlformat=require(_0x6173('0x0'));var rimraf=require(_0x6173('0x1'));var zipdir=require(_0x6173('0x2'));var jsonpatch=require(_0x6173('0x3'));var rp=require(_0x6173('0x4'));var moment=require(_0x6173('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6173('0x6'));var util=require(_0x6173('0x7'));var path=require(_0x6173('0x8'));var sox=require(_0x6173('0x9'));var csv=require(_0x6173('0xa'));var ejs=require(_0x6173('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6173('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6173('0xd'));var deskjs=require(_0x6173('0xe'));var toCsv=require(_0x6173('0xa'));var querystring=require(_0x6173('0xf'));var Papa=require(_0x6173('0x10'));var Redis=require(_0x6173('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6173('0x12'));var as=require(_0x6173('0x13'));var hardwareService=require(_0x6173('0x14'));var logger=require(_0x6173('0x15'))(_0x6173('0x16'));var utils=require(_0x6173('0x17'));var config=require(_0x6173('0x18'));var licenseUtil=require(_0x6173('0x19'));var db=require(_0x6173('0x1a'))['db'];function respondWithStatusCode(_0x258d57,_0x4a413c){_0x4a413c=_0x4a413c||0xcc;return function(_0x3639ea){if(_0x3639ea){return _0x258d57[_0x6173('0x1b')](_0x4a413c);}return _0x258d57['status'](_0x4a413c)[_0x6173('0x1c')]();};}function respondWithResult(_0x5ec2fe,_0x5ad869){_0x5ad869=_0x5ad869||0xc8;return function(_0x5caa38){if(_0x5caa38){return _0x5ec2fe[_0x6173('0x1d')](_0x5ad869)[_0x6173('0x1e')](_0x5caa38);}};}function respondWithFilteredResult(_0x40b9a9,_0x10d8fb){return function(_0x6d6e8f){if(_0x6d6e8f){var _0xbdf79d=typeof _0x10d8fb[_0x6173('0x1f')]==='undefined'&&typeof _0x10d8fb[_0x6173('0x20')]===_0x6173('0x21');var _0x431ed2=_0x6d6e8f[_0x6173('0x22')];var _0x5d5a55=_0xbdf79d?0x0:_0x10d8fb[_0x6173('0x1f')];var _0x50ed69=_0xbdf79d?_0x6d6e8f['count']:_0x10d8fb[_0x6173('0x1f')]+_0x10d8fb['limit'];var _0x574843;if(_0x50ed69>=_0x431ed2){_0x50ed69=_0x431ed2;_0x574843=0xc8;}else{_0x574843=0xce;}_0x40b9a9[_0x6173('0x1d')](_0x574843);return _0x40b9a9[_0x6173('0x23')](_0x6173('0x24'),_0x5d5a55+'-'+_0x50ed69+'/'+_0x431ed2)[_0x6173('0x1e')](_0x6d6e8f);}return null;};}function patchUpdates(_0x590928){return function(_0x3d7776){try{jsonpatch[_0x6173('0x25')](_0x3d7776,_0x590928,!![]);}catch(_0x585495){return BPromise[_0x6173('0x26')](_0x585495);}return _0x3d7776[_0x6173('0x27')]();};}function saveUpdates(_0x4194f5,_0x3ce4ee){return function(_0x33b021){if(_0x33b021){return _0x33b021[_0x6173('0x28')](_0x4194f5)[_0x6173('0x29')](function(_0x5dddbb){return _0x5dddbb;});}return null;};}function removeEntity(_0x1272e3,_0x3bd53c){return function(_0x1e0845){if(_0x1e0845){return _0x1e0845['destroy']()[_0x6173('0x29')](function(){_0x1272e3[_0x6173('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30589c,_0x4914f6){return function(_0x117fb6){if(!_0x117fb6){_0x30589c[_0x6173('0x1b')](0x194);}return _0x117fb6;};}function handleError(_0x5c7051,_0x5288be){_0x5288be=_0x5288be||0x1f4;return function(_0x43a416){logger[_0x6173('0x2a')](_0x43a416[_0x6173('0x2b')]);if(_0x43a416['name']){delete _0x43a416[_0x6173('0x2c')];}_0x5c7051[_0x6173('0x1d')](_0x5288be)[_0x6173('0x2d')](_0x43a416);};}exports['index']=function(_0x1fa6ca,_0x43fa66){var _0x2b63a3={},_0x18c25c={},_0x3c7157={'count':0x0,'rows':[]};var _0x105839=_['map'](db['FaxTransferReport'][_0x6173('0x2e')],function(_0x1b5590){return{'name':_0x1b5590[_0x6173('0x2f')],'type':_0x1b5590[_0x6173('0x30')][_0x6173('0x31')]};});_0x18c25c[_0x6173('0x32')]=_[_0x6173('0x33')](_0x105839,_0x6173('0x2c'));_0x18c25c['query']=_['keys'](_0x1fa6ca['query']);_0x18c25c[_0x6173('0x34')]=_[_0x6173('0x35')](_0x18c25c[_0x6173('0x32')],_0x18c25c[_0x6173('0x36')]);_0x2b63a3[_0x6173('0x37')]=_[_0x6173('0x35')](_0x18c25c[_0x6173('0x32')],qs['fields'](_0x1fa6ca['query']['fields']));_0x2b63a3[_0x6173('0x37')]=_0x2b63a3[_0x6173('0x37')][_0x6173('0x38')]?_0x2b63a3[_0x6173('0x37')]:_0x18c25c['model'];if(!_0x1fa6ca[_0x6173('0x36')]['hasOwnProperty'](_0x6173('0x39'))){_0x2b63a3[_0x6173('0x20')]=qs[_0x6173('0x20')](_0x1fa6ca[_0x6173('0x36')][_0x6173('0x20')]);_0x2b63a3[_0x6173('0x1f')]=qs[_0x6173('0x1f')](_0x1fa6ca['query'][_0x6173('0x1f')]);}_0x2b63a3[_0x6173('0x3a')]=qs['sort'](_0x1fa6ca[_0x6173('0x36')][_0x6173('0x3b')]);_0x2b63a3[_0x6173('0x3c')]=qs[_0x6173('0x34')](_[_0x6173('0x3d')](_0x1fa6ca[_0x6173('0x36')],_0x18c25c[_0x6173('0x34')]),_0x105839);if(_0x1fa6ca[_0x6173('0x36')][_0x6173('0x3e')]){_0x2b63a3['where']=_[_0x6173('0x3f')](_0x2b63a3[_0x6173('0x3c')],{'$or':_[_0x6173('0x33')](_0x105839,function(_0x348d81){if(_0x348d81[_0x6173('0x30')]!==_0x6173('0x40')){var _0x142660={};_0x142660[_0x348d81[_0x6173('0x2c')]]={'$like':'%'+_0x1fa6ca[_0x6173('0x36')][_0x6173('0x3e')]+'%'};return _0x142660;}})});}_0x2b63a3=_['merge']({},_0x2b63a3,_0x1fa6ca[_0x6173('0x41')]);var _0x39c4e2={'where':_0x2b63a3[_0x6173('0x3c')]};return db[_0x6173('0x42')][_0x6173('0x22')](_0x39c4e2)['then'](function(_0x4b8709){_0x3c7157[_0x6173('0x22')]=_0x4b8709;if(_0x1fa6ca[_0x6173('0x36')][_0x6173('0x43')]){_0x2b63a3[_0x6173('0x44')]=[{'all':!![]}];}return db[_0x6173('0x42')][_0x6173('0x45')](_0x2b63a3);})['then'](function(_0x376e0a){_0x3c7157[_0x6173('0x46')]=_0x376e0a;return _0x3c7157;})[_0x6173('0x29')](respondWithFilteredResult(_0x43fa66,_0x2b63a3))['catch'](handleError(_0x43fa66,null));};exports[_0x6173('0x47')]=function(_0x39d869,_0x4f4de7){var _0x339adc={'raw':!![],'where':{'id':_0x39d869['params']['id']}},_0x3f9833={};_0x3f9833['model']=_[_0x6173('0x48')](db[_0x6173('0x42')][_0x6173('0x2e')]);_0x3f9833[_0x6173('0x36')]=_[_0x6173('0x48')](_0x39d869[_0x6173('0x36')]);_0x3f9833[_0x6173('0x34')]=_[_0x6173('0x35')](_0x3f9833[_0x6173('0x32')],_0x3f9833[_0x6173('0x36')]);_0x339adc['attributes']=_[_0x6173('0x35')](_0x3f9833[_0x6173('0x32')],qs['fields'](_0x39d869[_0x6173('0x36')]['fields']));_0x339adc[_0x6173('0x37')]=_0x339adc[_0x6173('0x37')]['length']?_0x339adc[_0x6173('0x37')]:_0x3f9833[_0x6173('0x32')];if(_0x39d869[_0x6173('0x36')]['includeAll']){_0x339adc[_0x6173('0x44')]=[{'all':!![]}];}_0x339adc=_[_0x6173('0x3f')]({},_0x339adc,_0x39d869[_0x6173('0x41')]);return db['FaxTransferReport'][_0x6173('0x49')](_0x339adc)[_0x6173('0x29')](handleEntityNotFound(_0x4f4de7,null))['then'](respondWithResult(_0x4f4de7,null))[_0x6173('0x4a')](handleError(_0x4f4de7,null));};exports[_0x6173('0x4b')]=function(_0x307c34,_0x3da157){return db[_0x6173('0x42')][_0x6173('0x4b')](_0x307c34[_0x6173('0x4c')],{})[_0x6173('0x29')](respondWithResult(_0x3da157,0xc9))[_0x6173('0x4a')](handleError(_0x3da157,null));};exports[_0x6173('0x28')]=function(_0x1ac758,_0x3a5549){if(_0x1ac758[_0x6173('0x4c')]['id']){delete _0x1ac758[_0x6173('0x4c')]['id'];}return db[_0x6173('0x42')][_0x6173('0x49')]({'where':{'id':_0x1ac758[_0x6173('0x4d')]['id']}})[_0x6173('0x29')](handleEntityNotFound(_0x3a5549,null))[_0x6173('0x29')](saveUpdates(_0x1ac758['body'],null))[_0x6173('0x29')](respondWithResult(_0x3a5549,null))['catch'](handleError(_0x3a5549,null));};exports[_0x6173('0x4e')]=function(_0x31f66d,_0x43e730){return db[_0x6173('0x42')][_0x6173('0x49')]({'where':{'id':_0x31f66d[_0x6173('0x4d')]['id']}})[_0x6173('0x29')](handleEntityNotFound(_0x43e730,null))['then'](removeEntity(_0x43e730,null))['catch'](handleError(_0x43e730,null));};exports[_0x6173('0x4f')]=function(_0xb6a22,_0x581173){return db['FaxTransferReport'][_0x6173('0x4f')]()[_0x6173('0x29')](respondWithResult(_0x581173,null))[_0x6173('0x4a')](handleError(_0x581173,null));}; \ No newline at end of file +var _0x1cc1=['../../config/license/util','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','then','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','create','body','update','params','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1cc1,0x15f));var _0x11cc=function(_0x3cc481,_0x51ec0b){_0x3cc481=_0x3cc481-0x0;var _0x22e684=_0x1cc1[_0x3cc481];return _0x22e684;};'use strict';var emlformat=require(_0x11cc('0x0'));var rimraf=require(_0x11cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11cc('0x2'));var rp=require('request-promise');var moment=require(_0x11cc('0x3'));var BPromise=require(_0x11cc('0x4'));var Mustache=require(_0x11cc('0x5'));var util=require(_0x11cc('0x6'));var path=require(_0x11cc('0x7'));var sox=require('sox');var csv=require(_0x11cc('0x8'));var ejs=require(_0x11cc('0x9'));var fs=require('fs');var fs_extra=require(_0x11cc('0xa'));var _=require('lodash');var squel=require(_0x11cc('0xb'));var crypto=require(_0x11cc('0xc'));var jsforce=require(_0x11cc('0xd'));var deskjs=require(_0x11cc('0xe'));var toCsv=require(_0x11cc('0x8'));var querystring=require(_0x11cc('0xf'));var Papa=require(_0x11cc('0x10'));var Redis=require(_0x11cc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x11cc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11cc('0x13'));var logger=require(_0x11cc('0x14'))(_0x11cc('0x15'));var utils=require(_0x11cc('0x16'));var config=require(_0x11cc('0x17'));var licenseUtil=require(_0x11cc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1762e3,_0x35b930){_0x35b930=_0x35b930||0xcc;return function(_0xeb865f){if(_0xeb865f){return _0x1762e3['sendStatus'](_0x35b930);}return _0x1762e3['status'](_0x35b930)[_0x11cc('0x19')]();};}function respondWithResult(_0x513538,_0x5d863b){_0x5d863b=_0x5d863b||0xc8;return function(_0x5b95ed){if(_0x5b95ed){return _0x513538['status'](_0x5d863b)[_0x11cc('0x1a')](_0x5b95ed);}};}function respondWithFilteredResult(_0x3ca053,_0x259e65){return function(_0x4f247e){if(_0x4f247e){var _0x503eb6=typeof _0x259e65[_0x11cc('0x1b')]===_0x11cc('0x1c')&&typeof _0x259e65['limit']===_0x11cc('0x1c');var _0x40f07f=_0x4f247e[_0x11cc('0x1d')];var _0x3db877=_0x503eb6?0x0:_0x259e65[_0x11cc('0x1b')];var _0x278e21=_0x503eb6?_0x4f247e[_0x11cc('0x1d')]:_0x259e65[_0x11cc('0x1b')]+_0x259e65[_0x11cc('0x1e')];var _0x29442e;if(_0x278e21>=_0x40f07f){_0x278e21=_0x40f07f;_0x29442e=0xc8;}else{_0x29442e=0xce;}_0x3ca053[_0x11cc('0x1f')](_0x29442e);return _0x3ca053[_0x11cc('0x20')](_0x11cc('0x21'),_0x3db877+'-'+_0x278e21+'/'+_0x40f07f)[_0x11cc('0x1a')](_0x4f247e);}return null;};}function patchUpdates(_0x139f26){return function(_0x1d850a){try{jsonpatch['apply'](_0x1d850a,_0x139f26,!![]);}catch(_0x14422d){return BPromise[_0x11cc('0x22')](_0x14422d);}return _0x1d850a['save']();};}function saveUpdates(_0x272b3f,_0x3a5660){return function(_0x434bf1){if(_0x434bf1){return _0x434bf1['update'](_0x272b3f)[_0x11cc('0x23')](function(_0x294546){return _0x294546;});}return null;};}function removeEntity(_0x6772e4,_0x4bb186){return function(_0x26c9fb){if(_0x26c9fb){return _0x26c9fb[_0x11cc('0x24')]()[_0x11cc('0x23')](function(){_0x6772e4[_0x11cc('0x1f')](0xcc)[_0x11cc('0x19')]();});}};}function handleEntityNotFound(_0x4ea303,_0x5280f7){return function(_0x456462){if(!_0x456462){_0x4ea303[_0x11cc('0x25')](0x194);}return _0x456462;};}function handleError(_0x3afd18,_0x3f09d5){_0x3f09d5=_0x3f09d5||0x1f4;return function(_0x2cbc5d){logger['error'](_0x2cbc5d[_0x11cc('0x26')]);if(_0x2cbc5d[_0x11cc('0x27')]){delete _0x2cbc5d[_0x11cc('0x27')];}_0x3afd18[_0x11cc('0x1f')](_0x3f09d5)[_0x11cc('0x28')](_0x2cbc5d);};}exports[_0x11cc('0x29')]=function(_0x2dae30,_0x2737f5){var _0x16353={},_0x385743={},_0x5ec739={'count':0x0,'rows':[]};var _0x2ffedb=_[_0x11cc('0x2a')](db[_0x11cc('0x2b')][_0x11cc('0x2c')],function(_0x4cde1d){return{'name':_0x4cde1d[_0x11cc('0x2d')],'type':_0x4cde1d[_0x11cc('0x2e')]['key']};});_0x385743[_0x11cc('0x2f')]=_[_0x11cc('0x2a')](_0x2ffedb,_0x11cc('0x27'));_0x385743['query']=_[_0x11cc('0x30')](_0x2dae30[_0x11cc('0x31')]);_0x385743[_0x11cc('0x32')]=_[_0x11cc('0x33')](_0x385743[_0x11cc('0x2f')],_0x385743[_0x11cc('0x31')]);_0x16353[_0x11cc('0x34')]=_[_0x11cc('0x33')](_0x385743[_0x11cc('0x2f')],qs[_0x11cc('0x35')](_0x2dae30['query'][_0x11cc('0x35')]));_0x16353[_0x11cc('0x34')]=_0x16353[_0x11cc('0x34')]['length']?_0x16353[_0x11cc('0x34')]:_0x385743[_0x11cc('0x2f')];if(!_0x2dae30[_0x11cc('0x31')][_0x11cc('0x36')]('nolimit')){_0x16353[_0x11cc('0x1e')]=qs[_0x11cc('0x1e')](_0x2dae30['query'][_0x11cc('0x1e')]);_0x16353[_0x11cc('0x1b')]=qs[_0x11cc('0x1b')](_0x2dae30[_0x11cc('0x31')][_0x11cc('0x1b')]);}_0x16353[_0x11cc('0x37')]=qs[_0x11cc('0x38')](_0x2dae30[_0x11cc('0x31')][_0x11cc('0x38')]);_0x16353[_0x11cc('0x39')]=qs[_0x11cc('0x32')](_[_0x11cc('0x3a')](_0x2dae30['query'],_0x385743[_0x11cc('0x32')]),_0x2ffedb);if(_0x2dae30[_0x11cc('0x31')][_0x11cc('0x3b')]){_0x16353['where']=_[_0x11cc('0x3c')](_0x16353['where'],{'$or':_[_0x11cc('0x2a')](_0x2ffedb,function(_0x3b7b93){if(_0x3b7b93['type']!==_0x11cc('0x3d')){var _0x103f33={};_0x103f33[_0x3b7b93[_0x11cc('0x27')]]={'$like':'%'+_0x2dae30[_0x11cc('0x31')][_0x11cc('0x3b')]+'%'};return _0x103f33;}})});}_0x16353=_[_0x11cc('0x3c')]({},_0x16353,_0x2dae30[_0x11cc('0x3e')]);var _0x138dc1={'where':_0x16353[_0x11cc('0x39')]};return db[_0x11cc('0x2b')][_0x11cc('0x1d')](_0x138dc1)[_0x11cc('0x23')](function(_0x57d5b3){_0x5ec739[_0x11cc('0x1d')]=_0x57d5b3;if(_0x2dae30[_0x11cc('0x31')][_0x11cc('0x3f')]){_0x16353[_0x11cc('0x40')]=[{'all':!![]}];}return db[_0x11cc('0x2b')][_0x11cc('0x41')](_0x16353);})[_0x11cc('0x23')](function(_0x37f9d3){_0x5ec739[_0x11cc('0x42')]=_0x37f9d3;return _0x5ec739;})['then'](respondWithFilteredResult(_0x2737f5,_0x16353))[_0x11cc('0x43')](handleError(_0x2737f5,null));};exports['show']=function(_0x52243e,_0x4b0be8){var _0x4a28bb={'raw':!![],'where':{'id':_0x52243e['params']['id']}},_0x12aa77={};_0x12aa77['model']=_[_0x11cc('0x30')](db[_0x11cc('0x2b')][_0x11cc('0x2c')]);_0x12aa77['query']=_['keys'](_0x52243e[_0x11cc('0x31')]);_0x12aa77[_0x11cc('0x32')]=_['intersection'](_0x12aa77[_0x11cc('0x2f')],_0x12aa77[_0x11cc('0x31')]);_0x4a28bb['attributes']=_[_0x11cc('0x33')](_0x12aa77[_0x11cc('0x2f')],qs['fields'](_0x52243e[_0x11cc('0x31')]['fields']));_0x4a28bb[_0x11cc('0x34')]=_0x4a28bb['attributes'][_0x11cc('0x44')]?_0x4a28bb['attributes']:_0x12aa77[_0x11cc('0x2f')];if(_0x52243e[_0x11cc('0x31')]['includeAll']){_0x4a28bb['include']=[{'all':!![]}];}_0x4a28bb=_[_0x11cc('0x3c')]({},_0x4a28bb,_0x52243e['options']);return db['FaxTransferReport']['find'](_0x4a28bb)[_0x11cc('0x23')](handleEntityNotFound(_0x4b0be8,null))[_0x11cc('0x23')](respondWithResult(_0x4b0be8,null))[_0x11cc('0x43')](handleError(_0x4b0be8,null));};exports[_0x11cc('0x45')]=function(_0x2b3fc8,_0xa00e77){return db[_0x11cc('0x2b')][_0x11cc('0x45')](_0x2b3fc8[_0x11cc('0x46')],{})[_0x11cc('0x23')](respondWithResult(_0xa00e77,0xc9))[_0x11cc('0x43')](handleError(_0xa00e77,null));};exports[_0x11cc('0x47')]=function(_0x993424,_0x3715f4){if(_0x993424[_0x11cc('0x46')]['id']){delete _0x993424[_0x11cc('0x46')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x993424[_0x11cc('0x48')]['id']}})[_0x11cc('0x23')](handleEntityNotFound(_0x3715f4,null))[_0x11cc('0x23')](saveUpdates(_0x993424['body'],null))['then'](respondWithResult(_0x3715f4,null))[_0x11cc('0x43')](handleError(_0x3715f4,null));};exports['destroy']=function(_0x474ae0,_0x3a2c1b){return db[_0x11cc('0x2b')][_0x11cc('0x49')]({'where':{'id':_0x474ae0[_0x11cc('0x48')]['id']}})[_0x11cc('0x23')](handleEntityNotFound(_0x3a2c1b,null))[_0x11cc('0x23')](removeEntity(_0x3a2c1b,null))[_0x11cc('0x43')](handleError(_0x3a2c1b,null));};exports[_0x11cc('0x4a')]=function(_0xc1c90f,_0x4f9a89){return db['FaxTransferReport']['describe']()[_0x11cc('0x23')](respondWithResult(_0x4f9a89,null))['catch'](handleError(_0x4f9a89,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 72a21d2..3556fdb 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 _0x099e=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x099e,0x129));var _0xe099=function(_0x5d2637,_0x10eccc){_0x5d2637=_0x5d2637-0x0;var _0x33af90=_0x099e[_0x5d2637];return _0x33af90;};'use strict';var _=require(_0xe099('0x0'));var util=require(_0xe099('0x1'));var logger=require(_0xe099('0x2'))(_0xe099('0x3'));var moment=require(_0xe099('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe099('0x5'));var rimraf=require(_0xe099('0x6'));var config=require(_0xe099('0x7'));var attributes=require(_0xe099('0x8'));module[_0xe099('0x9')]=function(_0x137d3e,_0x4f82c7){return _0x137d3e[_0xe099('0xa')](_0xe099('0xb'),attributes,{'tableName':_0xe099('0xc'),'paranoid':![],'indexes':[{'name':_0xe099('0xd'),'fields':[_0xe099('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b84=['rimraf','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','moment','request-promise','path'];(function(_0x11e66a,_0x378eb9){var _0x2487df=function(_0x136c15){while(--_0x136c15){_0x11e66a['push'](_0x11e66a['shift']());}};_0x2487df(++_0x378eb9);}(_0x7b84,0xb0));var _0x47b8=function(_0x4a7d36,_0x32d3c7){_0x4a7d36=_0x4a7d36-0x0;var _0x4ce015=_0x7b84[_0x4a7d36];return _0x4ce015;};'use strict';var _=require(_0x47b8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x47b8('0x1'));var BPromise=require('bluebird');var rp=require(_0x47b8('0x2'));var fs=require('fs');var path=require(_0x47b8('0x3'));var rimraf=require(_0x47b8('0x4'));var config=require('../../config/environment');var attributes=require(_0x47b8('0x5'));module[_0x47b8('0x6')]=function(_0x2c0058,_0x578cfd){return _0x2c0058[_0x47b8('0x7')]('FaxTransferReport',attributes,{'tableName':_0x47b8('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47b8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 839a0c1..75653f2 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 _0xa2bb=['../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14e947,_0x1d07c6){var _0x4fbe18=function(_0x11d0e7){while(--_0x11d0e7){_0x14e947['push'](_0x14e947['shift']());}};_0x4fbe18(++_0x1d07c6);}(_0xa2bb,0xdd));var _0xba2b=function(_0x586365,_0x3e2047){_0x586365=_0x586365-0x0;var _0x11c068=_0xa2bb[_0x586365];return _0x11c068;};'use strict';var _=require(_0xba2b('0x0'));var util=require('util');var moment=require(_0xba2b('0x1'));var BPromise=require(_0xba2b('0x2'));var rs=require(_0xba2b('0x3'));var fs=require('fs');var Redis=require(_0xba2b('0x4'));var db=require(_0xba2b('0x5'))['db'];var utils=require(_0xba2b('0x6'));var logger=require(_0xba2b('0x7'))(_0xba2b('0x8'));var config=require(_0xba2b('0x9'));var jayson=require(_0xba2b('0xa'));var client=jayson[_0xba2b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f0e4e,_0x46ef37,_0x1d58a0){return new BPromise(function(_0x438a99,_0x23da2a){return client[_0xba2b('0xc')](_0x5f0e4e,_0x1d58a0)[_0xba2b('0xd')](function(_0x47c755){logger[_0xba2b('0xe')](_0xba2b('0xf'),_0x46ef37,_0xba2b('0x10'));logger[_0xba2b('0x11')](_0xba2b('0x12'),_0x46ef37,_0xba2b('0x10'),JSON[_0xba2b('0x13')](_0x47c755));if(_0x47c755[_0xba2b('0x14')]){if(_0x47c755[_0xba2b('0x14')]['code']===0x1f4){logger[_0xba2b('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x46ef37,_0x47c755[_0xba2b('0x14')][_0xba2b('0x15')]);return _0x23da2a(_0x47c755['error'][_0xba2b('0x15')]);}logger[_0xba2b('0x14')](_0xba2b('0xf'),_0x46ef37,_0x47c755['error'][_0xba2b('0x15')]);return _0x438a99(_0x47c755[_0xba2b('0x14')]['message']);}else{logger[_0xba2b('0xe')](_0xba2b('0xf'),_0x46ef37,_0xba2b('0x10'));_0x438a99(_0x47c755['result'][_0xba2b('0x15')]);}})[_0xba2b('0x16')](function(_0x2c8cd9){logger[_0xba2b('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x46ef37,_0x2c8cd9);_0x23da2a(_0x2c8cd9);});});} \ No newline at end of file +var _0x27e6=['lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x83537f,_0x5c5fad){var _0x16516b=function(_0x17aae3){while(--_0x17aae3){_0x83537f['push'](_0x83537f['shift']());}};_0x16516b(++_0x5c5fad);}(_0x27e6,0x1b5));var _0x627e=function(_0x5776c8,_0x4b5944){_0x5776c8=_0x5776c8-0x0;var _0x4ece13=_0x27e6[_0x5776c8];return _0x4ece13;};'use strict';var _=require(_0x627e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x627e('0x1'));var fs=require('fs');var Redis=require(_0x627e('0x2'));var db=require(_0x627e('0x3'))['db'];var utils=require(_0x627e('0x4'));var logger=require('../../config/logger')(_0x627e('0x5'));var config=require(_0x627e('0x6'));var jayson=require(_0x627e('0x7'));var client=jayson[_0x627e('0x8')][_0x627e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27c486,_0x3e2d91,_0x475bea){return new BPromise(function(_0x5b295f,_0x86230f){return client[_0x627e('0xa')](_0x27c486,_0x475bea)[_0x627e('0xb')](function(_0x9b8b1){logger[_0x627e('0xc')](_0x627e('0xd'),_0x3e2d91,'request\x20sent');logger[_0x627e('0xe')](_0x627e('0xf'),_0x3e2d91,_0x627e('0x10'),JSON[_0x627e('0x11')](_0x9b8b1));if(_0x9b8b1['error']){if(_0x9b8b1[_0x627e('0x12')][_0x627e('0x13')]===0x1f4){logger[_0x627e('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x3e2d91,_0x9b8b1[_0x627e('0x12')][_0x627e('0x14')]);return _0x86230f(_0x9b8b1[_0x627e('0x12')][_0x627e('0x14')]);}logger[_0x627e('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x3e2d91,_0x9b8b1['error'][_0x627e('0x14')]);return _0x5b295f(_0x9b8b1['error'][_0x627e('0x14')]);}else{logger[_0x627e('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x3e2d91,_0x627e('0x10'));_0x5b295f(_0x9b8b1[_0x627e('0x15')][_0x627e('0x14')]);}})[_0x627e('0x16')](function(_0x5194e9){logger[_0x627e('0x12')](_0x627e('0xd'),_0x3e2d91,_0x5194e9);_0x86230f(_0x5194e9);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e73871a..512f2be 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 _0x87c6=['../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','put','update','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5bbb64,_0xf56e3c){var _0x309aca=function(_0x3ba67e){while(--_0x3ba67e){_0x5bbb64['push'](_0x5bbb64['shift']());}};_0x309aca(++_0xf56e3c);}(_0x87c6,0x12c));var _0x687c=function(_0x229e95,_0x2ed8a4){_0x229e95=_0x229e95-0x0;var _0x2e61b0=_0x87c6[_0x229e95];return _0x2e61b0;};'use strict';var multer=require(_0x687c('0x0'));var util=require('util');var path=require(_0x687c('0x1'));var timeout=require(_0x687c('0x2'));var express=require(_0x687c('0x3'));var router=express[_0x687c('0x4')]();var fs_extra=require(_0x687c('0x5'));var auth=require(_0x687c('0x6'));var interaction=require(_0x687c('0x7'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x687c('0x8')]('/',auth['isAuthenticated'](),controller[_0x687c('0x9')]);router[_0x687c('0x8')](_0x687c('0xa'),auth[_0x687c('0xb')](),controller[_0x687c('0xc')]);router[_0x687c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x687c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x687c('0xe')]('/:id',auth[_0x687c('0xb')](),controller[_0x687c('0xf')]);router['delete'](_0x687c('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x687c('0x11')]=router; \ No newline at end of file +var _0x8bd2=['index','describe','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x3ebc39,_0x1f4d54){var _0x5248a8=function(_0x2392a9){while(--_0x2392a9){_0x3ebc39['push'](_0x3ebc39['shift']());}};_0x5248a8(++_0x1f4d54);}(_0x8bd2,0x126));var _0x28bd=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x8bd2[_0x120123];return _0x3bec4c;};'use strict';var multer=require(_0x28bd('0x0'));var util=require(_0x28bd('0x1'));var path=require('path');var timeout=require(_0x28bd('0x2'));var express=require(_0x28bd('0x3'));var router=express['Router']();var fs_extra=require(_0x28bd('0x4'));var auth=require(_0x28bd('0x5'));var interaction=require(_0x28bd('0x6'));var config=require('../../config/environment');var controller=require(_0x28bd('0x7'));router[_0x28bd('0x8')]('/',auth[_0x28bd('0x9')](),controller[_0x28bd('0xa')]);router['get']('/describe',auth[_0x28bd('0x9')](),controller[_0x28bd('0xb')]);router[_0x28bd('0x8')](_0x28bd('0xc'),auth[_0x28bd('0x9')](),controller[_0x28bd('0xd')]);router['post']('/',auth[_0x28bd('0x9')](),controller[_0x28bd('0xe')]);router[_0x28bd('0xf')](_0x28bd('0xc'),auth[_0x28bd('0x9')](),controller[_0x28bd('0x10')]);router[_0x28bd('0x11')](_0x28bd('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x28bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f6be240..c79b5d0 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 _0xb155=['addConfiguration','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x142c2b,_0x2a8bb0){var _0x42388e=function(_0x502505){while(--_0x502505){_0x142c2b['push'](_0x142c2b['shift']());}};_0x42388e(++_0x2a8bb0);}(_0xb155,0x1f4));var _0x5b15=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0xb155[_0x39ffd1];return _0x31267e;};'use strict';var multer=require(_0x5b15('0x0'));var util=require(_0x5b15('0x1'));var path=require('path');var timeout=require(_0x5b15('0x2'));var express=require(_0x5b15('0x3'));var router=express[_0x5b15('0x4')]();var fs_extra=require(_0x5b15('0x5'));var auth=require(_0x5b15('0x6'));var interaction=require(_0x5b15('0x7'));var config=require(_0x5b15('0x8'));var controller=require(_0x5b15('0x9'));router['get']('/',auth[_0x5b15('0xa')](),controller[_0x5b15('0xb')]);router['get']('/:id',auth[_0x5b15('0xa')](),controller[_0x5b15('0xc')]);router[_0x5b15('0xd')](_0x5b15('0xe'),auth['isAuthenticated'](),controller[_0x5b15('0xf')]);router['get'](_0x5b15('0x10'),auth[_0x5b15('0xa')](),controller[_0x5b15('0x11')]);router['post']('/',auth[_0x5b15('0xa')](),controller[_0x5b15('0x12')]);router[_0x5b15('0x13')](_0x5b15('0xe'),auth[_0x5b15('0xa')](),controller[_0x5b15('0x14')]);router[_0x5b15('0x15')](_0x5b15('0x16'),auth[_0x5b15('0xa')](),controller[_0x5b15('0x17')]);router[_0x5b15('0x18')](_0x5b15('0x16'),auth[_0x5b15('0xa')](),controller[_0x5b15('0x19')]);module['exports']=router; \ No newline at end of file +var _0xe0b4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x418060,_0xd3b3b7){var _0x21f56b=function(_0x1fd89e){while(--_0x1fd89e){_0x418060['push'](_0x418060['shift']());}};_0x21f56b(++_0xd3b3b7);}(_0xe0b4,0xac));var _0x4e0b=function(_0x1478ea,_0x38a8b9){_0x1478ea=_0x1478ea-0x0;var _0x504a16=_0xe0b4[_0x1478ea];return _0x504a16;};'use strict';var multer=require(_0x4e0b('0x0'));var util=require(_0x4e0b('0x1'));var path=require(_0x4e0b('0x2'));var timeout=require(_0x4e0b('0x3'));var express=require(_0x4e0b('0x4'));var router=express[_0x4e0b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4e0b('0x6'));var interaction=require(_0x4e0b('0x7'));var config=require(_0x4e0b('0x8'));var controller=require('./intDeskAccount.controller');router[_0x4e0b('0x9')]('/',auth[_0x4e0b('0xa')](),controller[_0x4e0b('0xb')]);router[_0x4e0b('0x9')](_0x4e0b('0xc'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0xd')]);router[_0x4e0b('0x9')](_0x4e0b('0xe'),auth['isAuthenticated'](),controller[_0x4e0b('0xf')]);router[_0x4e0b('0x9')](_0x4e0b('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x4e0b('0x11')]('/',auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x12')]);router[_0x4e0b('0x11')](_0x4e0b('0xe'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x13')]);router[_0x4e0b('0x14')]('/:id',auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x15')]);router[_0x4e0b('0x16')]('/:id',auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x17')]);module[_0x4e0b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 340526b..c37bece 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 _0xdfb1=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x3f3b4c,_0x81d0f){var _0x25b938=function(_0x68eea2){while(--_0x68eea2){_0x3f3b4c['push'](_0x3f3b4c['shift']());}};_0x25b938(++_0x81d0f);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x44bb1c,_0x5f10b9){_0x44bb1c=_0x44bb1c-0x0;var _0x49ffe4=_0xdfb1[_0x44bb1c];return _0x49ffe4;};'use strict';var Sequelize=require(_0x1dfb('0x0'));module[_0x1dfb('0x1')]={'name':{'type':Sequelize[_0x1dfb('0x2')]},'description':{'type':Sequelize[_0x1dfb('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1dfb('0x2')]},'authType':{'type':Sequelize[_0x1dfb('0x3')](_0x1dfb('0x4')),'defaultValue':_0x1dfb('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x1dfb('0x2')]},'tokenSecret':{'type':Sequelize[_0x1dfb('0x2')]},'serverUrl':{'type':Sequelize[_0x1dfb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1dfb('0x5'),_0x1dfb('0x6')),'defaultValue':_0x1dfb('0x5')}}; \ No newline at end of file +var _0x9354=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x1d0583,_0x48cea7){var _0x2ad49a=function(_0x2e2705){while(--_0x2e2705){_0x1d0583['push'](_0x1d0583['shift']());}};_0x2ad49a(++_0x48cea7);}(_0x9354,0x96));var _0x4935=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x9354[_0x54381d];return _0x5308a7;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4935('0x1')]},'remoteUri':{'type':Sequelize[_0x4935('0x1')]},'authType':{'type':Sequelize[_0x4935('0x2')](_0x4935('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x4935('0x1')]},'consumerKey':{'type':Sequelize[_0x4935('0x1')]},'consumerSecret':{'type':Sequelize[_0x4935('0x1')]},'token':{'type':Sequelize[_0x4935('0x1')]},'tokenSecret':{'type':Sequelize[_0x4935('0x1')]},'serverUrl':{'type':Sequelize[_0x4935('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4935('0x2')](_0x4935('0x4'),_0x4935('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c9b4dd2..0046a27 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 _0xf2cf=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','then','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','info','result','sendStatus','end','json','offset','limit','undefined','status','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','DeskAccount','count','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','DeskConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','password','consumerKey','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','Authorization','Basic\x20%s','%s:%s','username','toString','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch'];(function(_0xf5aed3,_0x5ef3f4){var _0x585202=function(_0x95a0c8){while(--_0x95a0c8){_0xf5aed3['push'](_0xf5aed3['shift']());}};_0x585202(++_0x5ef3f4);}(_0xf2cf,0xf5));var _0xff2c=function(_0x1f7d2f,_0x51cb86){_0x1f7d2f=_0x1f7d2f-0x0;var _0x326c52=_0xf2cf[_0x1f7d2f];return _0x326c52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff2c('0x0'));var zipdir=require(_0xff2c('0x1'));var jsonpatch=require(_0xff2c('0x2'));var rp=require('request-promise');var moment=require(_0xff2c('0x3'));var BPromise=require(_0xff2c('0x4'));var Mustache=require(_0xff2c('0x5'));var util=require(_0xff2c('0x6'));var path=require(_0xff2c('0x7'));var sox=require(_0xff2c('0x8'));var csv=require('to-csv');var ejs=require(_0xff2c('0x9'));var fs=require('fs');var fs_extra=require(_0xff2c('0xa'));var _=require('lodash');var squel=require(_0xff2c('0xb'));var crypto=require(_0xff2c('0xc'));var jsforce=require(_0xff2c('0xd'));var deskjs=require(_0xff2c('0xe'));var toCsv=require(_0xff2c('0xf'));var querystring=require(_0xff2c('0x10'));var Papa=require(_0xff2c('0x11'));var Redis=require('ioredis');var authService=require(_0xff2c('0x12'));var qs=require(_0xff2c('0x13'));var as=require(_0xff2c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff2c('0x15'))(_0xff2c('0x16'));var utils=require(_0xff2c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff2c('0x18'))['db'];var integrations=require(_0xff2c('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xff2c('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53c0e1,_0x8f8578,_0x2d3ee6,_0x1f229b){return new BPromise(function(_0x4778db,_0x4fc59b){var _0x2b1f8e=_0x1f229b||client;return _0x2b1f8e['request'](_0x53c0e1,_0x2d3ee6)[_0xff2c('0x1b')](function(_0x2eb087){logger['info']('DeskAccount,\x20%s,\x20%s',_0x8f8578,'request\x20sent');logger[_0xff2c('0x1c')](_0xff2c('0x1d'),_0x8f8578,_0xff2c('0x1e'),JSON[_0xff2c('0x1f')](_0x2eb087));if(_0x2eb087[_0xff2c('0x20')]){if(_0x2eb087[_0xff2c('0x20')][_0xff2c('0x21')]===0x1f4){logger[_0xff2c('0x20')](_0xff2c('0x22'),_0x8f8578,_0x2eb087[_0xff2c('0x20')][_0xff2c('0x23')]);return _0x4fc59b(_0x2eb087[_0xff2c('0x20')][_0xff2c('0x23')]);}logger[_0xff2c('0x20')](_0xff2c('0x22'),_0x8f8578,_0x2eb087[_0xff2c('0x20')][_0xff2c('0x23')]);return _0x4778db(_0x2eb087[_0xff2c('0x20')][_0xff2c('0x23')]);}else{logger[_0xff2c('0x24')](_0xff2c('0x22'),_0x8f8578,_0xff2c('0x1e'));_0x4778db(_0x2eb087[_0xff2c('0x25')][_0xff2c('0x23')]);}})['catch'](function(_0x1de9de){logger[_0xff2c('0x20')](_0xff2c('0x22'),_0x8f8578,_0x1de9de);_0x4fc59b(_0x1de9de);});});}function respondWithStatusCode(_0x137b2d,_0x235783){_0x235783=_0x235783||0xcc;return function(_0xc61299){if(_0xc61299){return _0x137b2d[_0xff2c('0x26')](_0x235783);}return _0x137b2d['status'](_0x235783)[_0xff2c('0x27')]();};}function respondWithResult(_0x29848e,_0x360ac2){_0x360ac2=_0x360ac2||0xc8;return function(_0x35f52e){if(_0x35f52e){return _0x29848e['status'](_0x360ac2)[_0xff2c('0x28')](_0x35f52e);}};}function respondWithFilteredResult(_0x11e132,_0x3fd743){return function(_0x46f7b3){if(_0x46f7b3){var _0x2eee77=typeof _0x3fd743[_0xff2c('0x29')]==='undefined'&&typeof _0x3fd743[_0xff2c('0x2a')]===_0xff2c('0x2b');var _0x4103f0=_0x46f7b3['count'];var _0x59088e=_0x2eee77?0x0:_0x3fd743[_0xff2c('0x29')];var _0x2205f3=_0x2eee77?_0x46f7b3['count']:_0x3fd743[_0xff2c('0x29')]+_0x3fd743['limit'];var _0x5ba347;if(_0x2205f3>=_0x4103f0){_0x2205f3=_0x4103f0;_0x5ba347=0xc8;}else{_0x5ba347=0xce;}_0x11e132[_0xff2c('0x2c')](_0x5ba347);return _0x11e132[_0xff2c('0x2d')](_0xff2c('0x2e'),_0x59088e+'-'+_0x2205f3+'/'+_0x4103f0)[_0xff2c('0x28')](_0x46f7b3);}return null;};}function patchUpdates(_0x1c95ad){return function(_0x39297f){try{jsonpatch['apply'](_0x39297f,_0x1c95ad,!![]);}catch(_0x311136){return BPromise[_0xff2c('0x2f')](_0x311136);}return _0x39297f[_0xff2c('0x30')]();};}function saveUpdates(_0x56361f,_0x1f6750){return function(_0x4e0278){if(_0x4e0278){return _0x4e0278[_0xff2c('0x31')](_0x56361f)[_0xff2c('0x1b')](function(_0x541045){return _0x541045;});}return null;};}function removeEntity(_0x4c4080,_0x59bb0a){return function(_0x558c25){if(_0x558c25){return _0x558c25[_0xff2c('0x32')]()[_0xff2c('0x1b')](function(){_0x4c4080[_0xff2c('0x2c')](0xcc)[_0xff2c('0x27')]();});}};}function handleEntityNotFound(_0x1d6827,_0x29c4bb){return function(_0x19dd26){if(!_0x19dd26){_0x1d6827[_0xff2c('0x26')](0x194);}return _0x19dd26;};}function handleError(_0x5e676c,_0x4733f0){_0x4733f0=_0x4733f0||0x1f4;return function(_0x17027a){logger[_0xff2c('0x20')](_0x17027a['stack']);if(_0x17027a[_0xff2c('0x33')]){delete _0x17027a[_0xff2c('0x33')];}_0x5e676c[_0xff2c('0x2c')](_0x4733f0)[_0xff2c('0x34')](_0x17027a);};}exports[_0xff2c('0x35')]=function(_0x3f460c,_0xbd1d7f){var _0xcf181b={},_0x28b70c={},_0x4e6da7={'count':0x0,'rows':[]};var _0x54755e=_[_0xff2c('0x36')](db['DeskAccount'][_0xff2c('0x37')],function(_0x3ca73c){return{'name':_0x3ca73c[_0xff2c('0x38')],'type':_0x3ca73c['type'][_0xff2c('0x39')]};});_0x28b70c['model']=_['map'](_0x54755e,_0xff2c('0x33'));_0x28b70c['query']=_[_0xff2c('0x3a')](_0x3f460c[_0xff2c('0x3b')]);_0x28b70c['filters']=_[_0xff2c('0x3c')](_0x28b70c[_0xff2c('0x3d')],_0x28b70c[_0xff2c('0x3b')]);_0xcf181b[_0xff2c('0x3e')]=_[_0xff2c('0x3c')](_0x28b70c[_0xff2c('0x3d')],qs[_0xff2c('0x3f')](_0x3f460c[_0xff2c('0x3b')][_0xff2c('0x3f')]));_0xcf181b[_0xff2c('0x3e')]=_0xcf181b[_0xff2c('0x3e')][_0xff2c('0x40')]?_0xcf181b[_0xff2c('0x3e')]:_0x28b70c[_0xff2c('0x3d')];if(!_0x3f460c[_0xff2c('0x3b')][_0xff2c('0x41')](_0xff2c('0x42'))){_0xcf181b[_0xff2c('0x2a')]=qs['limit'](_0x3f460c['query'][_0xff2c('0x2a')]);_0xcf181b[_0xff2c('0x29')]=qs[_0xff2c('0x29')](_0x3f460c['query'][_0xff2c('0x29')]);}_0xcf181b[_0xff2c('0x43')]=qs['sort'](_0x3f460c[_0xff2c('0x3b')][_0xff2c('0x44')]);_0xcf181b['where']=qs[_0xff2c('0x45')](_[_0xff2c('0x46')](_0x3f460c[_0xff2c('0x3b')],_0x28b70c[_0xff2c('0x45')]),_0x54755e);if(_0x3f460c[_0xff2c('0x3b')]['filter']){_0xcf181b[_0xff2c('0x47')]=_[_0xff2c('0x48')](_0xcf181b['where'],{'$or':_['map'](_0x54755e,function(_0x31d5cf){if(_0x31d5cf['type']!==_0xff2c('0x49')){var _0x3c9fca={};_0x3c9fca[_0x31d5cf[_0xff2c('0x33')]]={'$like':'%'+_0x3f460c['query']['filter']+'%'};return _0x3c9fca;}})});}_0xcf181b=_[_0xff2c('0x48')]({},_0xcf181b,_0x3f460c[_0xff2c('0x4a')]);var _0x3028bb={'where':_0xcf181b['where']};return db[_0xff2c('0x4b')]['count'](_0x3028bb)[_0xff2c('0x1b')](function(_0x5cb7e6){_0x4e6da7[_0xff2c('0x4c')]=_0x5cb7e6;if(_0x3f460c[_0xff2c('0x3b')][_0xff2c('0x4d')]){_0xcf181b[_0xff2c('0x4e')]=[{'all':!![]}];}return db[_0xff2c('0x4b')][_0xff2c('0x4f')](_0xcf181b);})[_0xff2c('0x1b')](function(_0x2d7377){_0x4e6da7[_0xff2c('0x50')]=_0x2d7377;return _0x4e6da7;})[_0xff2c('0x1b')](respondWithFilteredResult(_0xbd1d7f,_0xcf181b))[_0xff2c('0x51')](handleError(_0xbd1d7f,null));};exports['show']=function(_0x5d5dca,_0x19fad3){var _0x1e1c17={'raw':![],'where':{'id':_0x5d5dca[_0xff2c('0x52')]['id']}},_0x2be4f0={};_0x2be4f0['model']=_[_0xff2c('0x3a')](db[_0xff2c('0x4b')]['rawAttributes']);_0x2be4f0[_0xff2c('0x3b')]=_[_0xff2c('0x3a')](_0x5d5dca['query']);_0x2be4f0[_0xff2c('0x45')]=_[_0xff2c('0x3c')](_0x2be4f0['model'],_0x2be4f0['query']);_0x1e1c17['attributes']=_[_0xff2c('0x3c')](_0x2be4f0[_0xff2c('0x3d')],qs['fields'](_0x5d5dca[_0xff2c('0x3b')][_0xff2c('0x3f')]));_0x1e1c17[_0xff2c('0x3e')]=_0x1e1c17[_0xff2c('0x3e')]['length']?_0x1e1c17['attributes']:_0x2be4f0[_0xff2c('0x3d')];if(_0x5d5dca[_0xff2c('0x3b')]['includeAll']){_0x1e1c17[_0xff2c('0x4e')]=[{'all':!![]}];}_0x1e1c17=_[_0xff2c('0x48')]({},_0x1e1c17,_0x5d5dca[_0xff2c('0x4a')]);return db[_0xff2c('0x4b')][_0xff2c('0x53')](_0x1e1c17)[_0xff2c('0x1b')](handleEntityNotFound(_0x19fad3,null))['then'](respondWithResult(_0x19fad3,null))[_0xff2c('0x51')](handleError(_0x19fad3,null));};exports[_0xff2c('0x54')]=function(_0x57aa63,_0x4d2481){return db['DeskAccount'][_0xff2c('0x54')](_0x57aa63['body'],{})[_0xff2c('0x1b')](respondWithResult(_0x4d2481,0xc9))[_0xff2c('0x51')](handleError(_0x4d2481,null));};exports[_0xff2c('0x31')]=function(_0x4d8976,_0x3fa0f8){if(_0x4d8976[_0xff2c('0x55')]['id']){delete _0x4d8976[_0xff2c('0x55')]['id'];}return db[_0xff2c('0x4b')][_0xff2c('0x53')]({'where':{'id':_0x4d8976[_0xff2c('0x52')]['id']}})[_0xff2c('0x1b')](handleEntityNotFound(_0x3fa0f8,null))['then'](saveUpdates(_0x4d8976['body'],null))['then'](respondWithResult(_0x3fa0f8,null))['catch'](handleError(_0x3fa0f8,null));};exports[_0xff2c('0x32')]=function(_0x310395,_0x32dbad){return db[_0xff2c('0x4b')][_0xff2c('0x53')]({'where':{'id':_0x310395[_0xff2c('0x52')]['id']}})[_0xff2c('0x1b')](handleEntityNotFound(_0x32dbad,null))['then'](removeEntity(_0x32dbad,null))[_0xff2c('0x51')](handleError(_0x32dbad,null));};exports[_0xff2c('0x56')]=function(_0xabea8,_0x53e836,_0x40e90c){var _0x2bbb14={};var _0x37ad80={};var _0x5b11dc;var _0x14c41b;return db[_0xff2c('0x4b')][_0xff2c('0x57')]({'where':{'id':_0xabea8[_0xff2c('0x52')]['id']}})[_0xff2c('0x1b')](handleEntityNotFound(_0x53e836,null))[_0xff2c('0x1b')](function(_0x19c93a){if(_0x19c93a){_0x5b11dc=_0x19c93a;_0x37ad80[_0xff2c('0x3d')]=_['keys'](db[_0xff2c('0x58')][_0xff2c('0x37')]);_0x37ad80['query']=_[_0xff2c('0x3a')](_0xabea8[_0xff2c('0x3b')]);_0x37ad80[_0xff2c('0x45')]=_[_0xff2c('0x3c')](_0x37ad80[_0xff2c('0x3d')],_0x37ad80['query']);_0x2bbb14[_0xff2c('0x3e')]=_['intersection'](_0x37ad80[_0xff2c('0x3d')],qs[_0xff2c('0x3f')](_0xabea8[_0xff2c('0x3b')][_0xff2c('0x3f')]));_0x2bbb14['attributes']=_0x2bbb14['attributes'][_0xff2c('0x40')]?_0x2bbb14['attributes']:_0x37ad80['model'];_0x2bbb14[_0xff2c('0x43')]=qs[_0xff2c('0x44')](_0xabea8['query']['sort']);_0x2bbb14[_0xff2c('0x47')]=qs[_0xff2c('0x45')](_['pick'](_0xabea8[_0xff2c('0x3b')],_0x37ad80[_0xff2c('0x45')]));if(_0xabea8[_0xff2c('0x3b')][_0xff2c('0x59')]){_0x2bbb14[_0xff2c('0x47')]=_['merge'](_0x2bbb14[_0xff2c('0x47')],{'$or':_[_0xff2c('0x36')](_0x2bbb14[_0xff2c('0x3e')],function(_0x388e8b){var _0x3697d3={};_0x3697d3[_0x388e8b]={'$like':'%'+_0xabea8[_0xff2c('0x3b')][_0xff2c('0x59')]+'%'};return _0x3697d3;})});}_0x2bbb14=_['merge']({},_0x2bbb14,_0xabea8[_0xff2c('0x4a')]);return _0x5b11dc['getConfigurations'](_0x2bbb14);}})['then'](function(_0x324949){if(_0x324949){_0x14c41b=_0x324949['length'];if(!_0xabea8['query'][_0xff2c('0x41')](_0xff2c('0x42'))){_0x2bbb14[_0xff2c('0x2a')]=qs[_0xff2c('0x2a')](_0xabea8[_0xff2c('0x3b')][_0xff2c('0x2a')]);_0x2bbb14[_0xff2c('0x29')]=qs[_0xff2c('0x29')](_0xabea8[_0xff2c('0x3b')][_0xff2c('0x29')]);}return _0x5b11dc[_0xff2c('0x56')](_0x2bbb14);}})[_0xff2c('0x1b')](function(_0x31b160){if(_0x31b160){return _0x31b160?{'count':_0x14c41b,'rows':_0x31b160}:null;}})[_0xff2c('0x1b')](respondWithResult(_0x53e836,null))[_0xff2c('0x51')](handleError(_0x53e836,null));};exports[_0xff2c('0x5a')]=function(_0x4040c4,_0x4c3719,_0x4ebe57){if(_0x4040c4[_0xff2c('0x55')]['id']){delete _0x4040c4[_0xff2c('0x55')]['id'];}return db[_0xff2c('0x4b')][_0xff2c('0x57')]({'where':{'id':_0x4040c4[_0xff2c('0x52')]['id']}})['then'](handleEntityNotFound(_0x4c3719,null))['then'](function(_0x1a77c4){if(_0x1a77c4){_0x4040c4[_0xff2c('0x55')][_0xff2c('0x5b')]=_0x1a77c4['id'];_0x4040c4[_0xff2c('0x55')][_0xff2c('0x5c')]=integrations[_0xff2c('0x5d')](_0x4040c4[_0xff2c('0x55')][_0xff2c('0x5e')],_0x4040c4[_0xff2c('0x55')][_0xff2c('0x5f')]);_0x4040c4[_0xff2c('0x55')][_0xff2c('0x60')]=integrations[_0xff2c('0x61')](_0x4040c4[_0xff2c('0x55')][_0xff2c('0x5e')],_0x4040c4[_0xff2c('0x55')][_0xff2c('0x5f')]);return db[_0xff2c('0x58')][_0xff2c('0x54')](_0x4040c4['body'],{'include':[{'model':db[_0xff2c('0x62')],'as':_0xff2c('0x5c')},{'model':db[_0xff2c('0x62')],'as':_0xff2c('0x60')}]});}return null;})[_0xff2c('0x1b')](respondWithResult(_0x4c3719,null))['catch'](handleError(_0x4c3719,null));};exports[_0xff2c('0x63')]=function(_0x4e9351,_0x3a8d05,_0x5a6f97){var _0x17e28b=[{'name':_0xff2c('0x64'),'label':_0xff2c('0x64'),'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 _0x18aad0='';return db[_0xff2c('0x4b')][_0xff2c('0x57')]({'where':{'id':_0x4e9351[_0xff2c('0x52')]['id']},'attributes':['id',_0xff2c('0x65'),'authType','username',_0xff2c('0x66'),_0xff2c('0x67'),'consumerSecret','token',_0xff2c('0x68')]})[_0xff2c('0x1b')](handleEntityNotFound(_0x3a8d05,null))['then'](function(_0x358ea5){if(_0x358ea5){_0x18aad0=_0x358ea5[_0xff2c('0x65')];var _0x509782=_0x18aad0[_0xff2c('0x69')](-0x1);if(_0x509782==='/'){_0x18aad0=_0x18aad0[_0xff2c('0x6a')](0x0,_0x18aad0[_0xff2c('0x6b')](_0x509782));}var _0x381fe0={'method':'GET','uri':util[_0xff2c('0x6c')](_0xff2c('0x6d'),_0x18aad0),'headers':{'Content-Type':_0xff2c('0x6e'),'Accept':_0xff2c('0x6e')},'json':!![]};if(_0x358ea5[_0xff2c('0x6f')]==='basic'){_0x381fe0['headers'][_0xff2c('0x70')]=util[_0xff2c('0x6c')](_0xff2c('0x71'),new Buffer(util['format'](_0xff2c('0x72'),_0x358ea5[_0xff2c('0x73')],_0x358ea5[_0xff2c('0x66')]))[_0xff2c('0x74')]('base64'));}return rp(_0x381fe0)['then'](function(_0x3f644e){return _0x17e28b['concat'](_[_0xff2c('0x36')](_0x3f644e[_0xff2c('0x75')]['entries'],function(_0x2a5192){return{'id':_0x2a5192[_0xff2c('0x33')],'name':_0x2a5192[_0xff2c('0x33')],'type':_0x2a5192['type'],'active':_0x2a5192[_0xff2c('0x76')],'label':_0x2a5192[_0xff2c('0x77')],'custom':!![]};}));});}})['then'](function(_0x308cfd){return{'count':_0x308cfd['length'],'rows':_0x308cfd};})[_0xff2c('0x1b')](respondWithResult(_0x3a8d05,null))[_0xff2c('0x51')](function(_0x2caa63){var _0x4fa5ea=_0x4e9351[_0xff2c('0x3b')][_0xff2c('0x78')]?0x1f4:_0x2caa63[_0xff2c('0x79')]||0x1f4;logger[_0xff2c('0x20')](_0xff2c('0x7a'),_0xff2c('0x63'),_0x4fa5ea,JSON[_0xff2c('0x1f')](_0x2caa63));delete _0x2caa63['name'];if(_0x4fa5ea===0x191){_0x4fa5ea=0x190;}_0x3a8d05[_0xff2c('0x2c')](_0x4fa5ea)[_0xff2c('0x34')](_0x4e9351[_0xff2c('0x3b')]['test']?{'message':_0xff2c('0x7b'),'statusCode':_0x2caa63[_0xff2c('0x79')]}:_0x2caa63);});}; \ No newline at end of file +var _0xb91a=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','status','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','keys','include','DeskAccount','find','create','body','getConfigurations','DeskConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','lastIndexOf','GET','%s/custom_fields','application/json','headers','Authorization','format','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x133b90,_0x4590a5){var _0x1a9984=function(_0x495a78){while(--_0x495a78){_0x133b90['push'](_0x133b90['shift']());}};_0x1a9984(++_0x4590a5);}(_0xb91a,0xf4));var _0xab91=function(_0x1253bb,_0x45282e){_0x1253bb=_0x1253bb-0x0;var _0x55d3e2=_0xb91a[_0x1253bb];return _0x55d3e2;};'use strict';var emlformat=require(_0xab91('0x0'));var rimraf=require(_0xab91('0x1'));var zipdir=require(_0xab91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab91('0x3'));var BPromise=require(_0xab91('0x4'));var Mustache=require(_0xab91('0x5'));var util=require(_0xab91('0x6'));var path=require(_0xab91('0x7'));var sox=require(_0xab91('0x8'));var csv=require(_0xab91('0x9'));var ejs=require(_0xab91('0xa'));var fs=require('fs');var fs_extra=require(_0xab91('0xb'));var _=require(_0xab91('0xc'));var squel=require('squel');var crypto=require(_0xab91('0xd'));var jsforce=require(_0xab91('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab91('0xf'));var Redis=require(_0xab91('0x10'));var authService=require(_0xab91('0x11'));var qs=require(_0xab91('0x12'));var as=require(_0xab91('0x13'));var hardwareService=require(_0xab91('0x14'));var logger=require(_0xab91('0x15'))(_0xab91('0x16'));var utils=require(_0xab91('0x17'));var config=require(_0xab91('0x18'));var licenseUtil=require(_0xab91('0x19'));var db=require(_0xab91('0x1a'))['db'];var integrations=require(_0xab91('0x1b'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab91('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3e77bc,_0x86902e,_0x14bded,_0x14b304){return new BPromise(function(_0xaa6e77,_0x54cdf0){var _0x5414f7=_0x14b304||client;return _0x5414f7[_0xab91('0x1d')](_0x3e77bc,_0x14bded)[_0xab91('0x1e')](function(_0x1b0d61){logger[_0xab91('0x1f')](_0xab91('0x20'),_0x86902e,_0xab91('0x21'));logger[_0xab91('0x22')](_0xab91('0x23'),_0x86902e,'request\x20sent',JSON['stringify'](_0x1b0d61));if(_0x1b0d61[_0xab91('0x24')]){if(_0x1b0d61['error'][_0xab91('0x25')]===0x1f4){logger[_0xab91('0x24')](_0xab91('0x20'),_0x86902e,_0x1b0d61['error'][_0xab91('0x26')]);return _0x54cdf0(_0x1b0d61['error'][_0xab91('0x26')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x86902e,_0x1b0d61[_0xab91('0x24')]['message']);return _0xaa6e77(_0x1b0d61[_0xab91('0x24')][_0xab91('0x26')]);}else{logger[_0xab91('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x86902e,_0xab91('0x21'));_0xaa6e77(_0x1b0d61[_0xab91('0x27')][_0xab91('0x26')]);}})[_0xab91('0x28')](function(_0x23cbc1){logger[_0xab91('0x24')](_0xab91('0x20'),_0x86902e,_0x23cbc1);_0x54cdf0(_0x23cbc1);});});}function respondWithStatusCode(_0x57a7e9,_0x5eca53){_0x5eca53=_0x5eca53||0xcc;return function(_0x18445a){if(_0x18445a){return _0x57a7e9['sendStatus'](_0x5eca53);}return _0x57a7e9['status'](_0x5eca53)[_0xab91('0x29')]();};}function respondWithResult(_0x1a0bc2,_0x5586cd){_0x5586cd=_0x5586cd||0xc8;return function(_0x425d39){if(_0x425d39){return _0x1a0bc2['status'](_0x5586cd)[_0xab91('0x2a')](_0x425d39);}};}function respondWithFilteredResult(_0x400134,_0x5a3c05){return function(_0x4138eb){if(_0x4138eb){var _0x5b57e9=typeof _0x5a3c05[_0xab91('0x2b')]===_0xab91('0x2c')&&typeof _0x5a3c05[_0xab91('0x2d')]===_0xab91('0x2c');var _0x532bd2=_0x4138eb[_0xab91('0x2e')];var _0x4c7a87=_0x5b57e9?0x0:_0x5a3c05[_0xab91('0x2b')];var _0x197d0c=_0x5b57e9?_0x4138eb[_0xab91('0x2e')]:_0x5a3c05[_0xab91('0x2b')]+_0x5a3c05[_0xab91('0x2d')];var _0x366b3e;if(_0x197d0c>=_0x532bd2){_0x197d0c=_0x532bd2;_0x366b3e=0xc8;}else{_0x366b3e=0xce;}_0x400134['status'](_0x366b3e);return _0x400134[_0xab91('0x2f')](_0xab91('0x30'),_0x4c7a87+'-'+_0x197d0c+'/'+_0x532bd2)[_0xab91('0x2a')](_0x4138eb);}return null;};}function patchUpdates(_0x108d31){return function(_0x1c5ec7){try{jsonpatch[_0xab91('0x31')](_0x1c5ec7,_0x108d31,!![]);}catch(_0x4b8cd1){return BPromise[_0xab91('0x32')](_0x4b8cd1);}return _0x1c5ec7[_0xab91('0x33')]();};}function saveUpdates(_0xaf40a5,_0x245841){return function(_0x532aaa){if(_0x532aaa){return _0x532aaa[_0xab91('0x34')](_0xaf40a5)[_0xab91('0x1e')](function(_0x2d6495){return _0x2d6495;});}return null;};}function removeEntity(_0x50253b,_0x60a532){return function(_0x4c45cb){if(_0x4c45cb){return _0x4c45cb[_0xab91('0x35')]()[_0xab91('0x1e')](function(){_0x50253b['status'](0xcc)[_0xab91('0x29')]();});}};}function handleEntityNotFound(_0x145dcc,_0x40f841){return function(_0x3d8c7b){if(!_0x3d8c7b){_0x145dcc[_0xab91('0x36')](0x194);}return _0x3d8c7b;};}function handleError(_0x3e1625,_0x15d2dd){_0x15d2dd=_0x15d2dd||0x1f4;return function(_0x576bbc){logger['error'](_0x576bbc[_0xab91('0x37')]);if(_0x576bbc[_0xab91('0x38')]){delete _0x576bbc[_0xab91('0x38')];}_0x3e1625[_0xab91('0x39')](_0x15d2dd)[_0xab91('0x3a')](_0x576bbc);};}exports[_0xab91('0x3b')]=function(_0xa783c,_0x6ad869){var _0x4787f0={},_0x286c6d={},_0x18f17b={'count':0x0,'rows':[]};var _0x5d00ee=_[_0xab91('0x3c')](db['DeskAccount'][_0xab91('0x3d')],function(_0x41c790){return{'name':_0x41c790[_0xab91('0x3e')],'type':_0x41c790[_0xab91('0x3f')]['key']};});_0x286c6d['model']=_['map'](_0x5d00ee,_0xab91('0x38'));_0x286c6d[_0xab91('0x40')]=_['keys'](_0xa783c[_0xab91('0x40')]);_0x286c6d[_0xab91('0x41')]=_[_0xab91('0x42')](_0x286c6d[_0xab91('0x43')],_0x286c6d[_0xab91('0x40')]);_0x4787f0[_0xab91('0x44')]=_[_0xab91('0x42')](_0x286c6d[_0xab91('0x43')],qs[_0xab91('0x45')](_0xa783c[_0xab91('0x40')][_0xab91('0x45')]));_0x4787f0[_0xab91('0x44')]=_0x4787f0['attributes'][_0xab91('0x46')]?_0x4787f0[_0xab91('0x44')]:_0x286c6d[_0xab91('0x43')];if(!_0xa783c[_0xab91('0x40')][_0xab91('0x47')](_0xab91('0x48'))){_0x4787f0['limit']=qs[_0xab91('0x2d')](_0xa783c['query'][_0xab91('0x2d')]);_0x4787f0[_0xab91('0x2b')]=qs[_0xab91('0x2b')](_0xa783c[_0xab91('0x40')][_0xab91('0x2b')]);}_0x4787f0[_0xab91('0x49')]=qs[_0xab91('0x4a')](_0xa783c[_0xab91('0x40')][_0xab91('0x4a')]);_0x4787f0[_0xab91('0x4b')]=qs[_0xab91('0x41')](_[_0xab91('0x4c')](_0xa783c[_0xab91('0x40')],_0x286c6d[_0xab91('0x41')]),_0x5d00ee);if(_0xa783c[_0xab91('0x40')][_0xab91('0x4d')]){_0x4787f0[_0xab91('0x4b')]=_['merge'](_0x4787f0[_0xab91('0x4b')],{'$or':_[_0xab91('0x3c')](_0x5d00ee,function(_0x84648){if(_0x84648['type']!==_0xab91('0x4e')){var _0x69c8bc={};_0x69c8bc[_0x84648['name']]={'$like':'%'+_0xa783c[_0xab91('0x40')][_0xab91('0x4d')]+'%'};return _0x69c8bc;}})});}_0x4787f0=_[_0xab91('0x4f')]({},_0x4787f0,_0xa783c[_0xab91('0x50')]);var _0x56c5b3={'where':_0x4787f0[_0xab91('0x4b')]};return db['DeskAccount'][_0xab91('0x2e')](_0x56c5b3)['then'](function(_0x31228d){_0x18f17b[_0xab91('0x2e')]=_0x31228d;if(_0xa783c[_0xab91('0x40')][_0xab91('0x51')]){_0x4787f0['include']=[{'all':!![]}];}return db['DeskAccount'][_0xab91('0x52')](_0x4787f0);})['then'](function(_0x54b3cc){_0x18f17b[_0xab91('0x53')]=_0x54b3cc;return _0x18f17b;})[_0xab91('0x1e')](respondWithFilteredResult(_0x6ad869,_0x4787f0))[_0xab91('0x28')](handleError(_0x6ad869,null));};exports['show']=function(_0x11bb27,_0x4f0764){var _0x5bf385={'raw':![],'where':{'id':_0x11bb27[_0xab91('0x54')]['id']}},_0x2367a7={};_0x2367a7['model']=_[_0xab91('0x55')](db['DeskAccount'][_0xab91('0x3d')]);_0x2367a7[_0xab91('0x40')]=_[_0xab91('0x55')](_0x11bb27['query']);_0x2367a7[_0xab91('0x41')]=_[_0xab91('0x42')](_0x2367a7[_0xab91('0x43')],_0x2367a7[_0xab91('0x40')]);_0x5bf385[_0xab91('0x44')]=_[_0xab91('0x42')](_0x2367a7[_0xab91('0x43')],qs[_0xab91('0x45')](_0x11bb27[_0xab91('0x40')][_0xab91('0x45')]));_0x5bf385[_0xab91('0x44')]=_0x5bf385[_0xab91('0x44')]['length']?_0x5bf385['attributes']:_0x2367a7[_0xab91('0x43')];if(_0x11bb27['query'][_0xab91('0x51')]){_0x5bf385[_0xab91('0x56')]=[{'all':!![]}];}_0x5bf385=_['merge']({},_0x5bf385,_0x11bb27[_0xab91('0x50')]);return db[_0xab91('0x57')][_0xab91('0x58')](_0x5bf385)[_0xab91('0x1e')](handleEntityNotFound(_0x4f0764,null))[_0xab91('0x1e')](respondWithResult(_0x4f0764,null))[_0xab91('0x28')](handleError(_0x4f0764,null));};exports[_0xab91('0x59')]=function(_0x34ca51,_0x32fb35){return db[_0xab91('0x57')][_0xab91('0x59')](_0x34ca51[_0xab91('0x5a')],{})[_0xab91('0x1e')](respondWithResult(_0x32fb35,0xc9))[_0xab91('0x28')](handleError(_0x32fb35,null));};exports[_0xab91('0x34')]=function(_0x2a6e3d,_0x4fb23b){if(_0x2a6e3d[_0xab91('0x5a')]['id']){delete _0x2a6e3d[_0xab91('0x5a')]['id'];}return db[_0xab91('0x57')][_0xab91('0x58')]({'where':{'id':_0x2a6e3d[_0xab91('0x54')]['id']}})[_0xab91('0x1e')](handleEntityNotFound(_0x4fb23b,null))[_0xab91('0x1e')](saveUpdates(_0x2a6e3d['body'],null))[_0xab91('0x1e')](respondWithResult(_0x4fb23b,null))[_0xab91('0x28')](handleError(_0x4fb23b,null));};exports[_0xab91('0x35')]=function(_0x219058,_0xd77a0b){return db[_0xab91('0x57')][_0xab91('0x58')]({'where':{'id':_0x219058[_0xab91('0x54')]['id']}})[_0xab91('0x1e')](handleEntityNotFound(_0xd77a0b,null))[_0xab91('0x1e')](removeEntity(_0xd77a0b,null))[_0xab91('0x28')](handleError(_0xd77a0b,null));};exports[_0xab91('0x5b')]=function(_0x30f1e2,_0x4e6f6c,_0x2175e0){var _0x96000a={};var _0x5c1a4e={};var _0x176715;var _0x357e30;return db[_0xab91('0x57')]['findOne']({'where':{'id':_0x30f1e2[_0xab91('0x54')]['id']}})['then'](handleEntityNotFound(_0x4e6f6c,null))['then'](function(_0xc0632){if(_0xc0632){_0x176715=_0xc0632;_0x5c1a4e[_0xab91('0x43')]=_[_0xab91('0x55')](db[_0xab91('0x5c')][_0xab91('0x3d')]);_0x5c1a4e['query']=_[_0xab91('0x55')](_0x30f1e2[_0xab91('0x40')]);_0x5c1a4e['filters']=_[_0xab91('0x42')](_0x5c1a4e[_0xab91('0x43')],_0x5c1a4e[_0xab91('0x40')]);_0x96000a[_0xab91('0x44')]=_[_0xab91('0x42')](_0x5c1a4e[_0xab91('0x43')],qs[_0xab91('0x45')](_0x30f1e2[_0xab91('0x40')][_0xab91('0x45')]));_0x96000a[_0xab91('0x44')]=_0x96000a[_0xab91('0x44')][_0xab91('0x46')]?_0x96000a['attributes']:_0x5c1a4e['model'];_0x96000a[_0xab91('0x49')]=qs['sort'](_0x30f1e2[_0xab91('0x40')][_0xab91('0x4a')]);_0x96000a[_0xab91('0x4b')]=qs[_0xab91('0x41')](_['pick'](_0x30f1e2[_0xab91('0x40')],_0x5c1a4e[_0xab91('0x41')]));if(_0x30f1e2[_0xab91('0x40')][_0xab91('0x4d')]){_0x96000a[_0xab91('0x4b')]=_[_0xab91('0x4f')](_0x96000a[_0xab91('0x4b')],{'$or':_['map'](_0x96000a[_0xab91('0x44')],function(_0x1c684f){var _0x36d6f9={};_0x36d6f9[_0x1c684f]={'$like':'%'+_0x30f1e2[_0xab91('0x40')][_0xab91('0x4d')]+'%'};return _0x36d6f9;})});}_0x96000a=_['merge']({},_0x96000a,_0x30f1e2[_0xab91('0x50')]);return _0x176715['getConfigurations'](_0x96000a);}})[_0xab91('0x1e')](function(_0x1518aa){if(_0x1518aa){_0x357e30=_0x1518aa['length'];if(!_0x30f1e2['query']['hasOwnProperty'](_0xab91('0x48'))){_0x96000a[_0xab91('0x2d')]=qs[_0xab91('0x2d')](_0x30f1e2['query'][_0xab91('0x2d')]);_0x96000a[_0xab91('0x2b')]=qs[_0xab91('0x2b')](_0x30f1e2[_0xab91('0x40')][_0xab91('0x2b')]);}return _0x176715[_0xab91('0x5b')](_0x96000a);}})['then'](function(_0x4a0ab6){if(_0x4a0ab6){return _0x4a0ab6?{'count':_0x357e30,'rows':_0x4a0ab6}:null;}})[_0xab91('0x1e')](respondWithResult(_0x4e6f6c,null))['catch'](handleError(_0x4e6f6c,null));};exports['addConfiguration']=function(_0xe155d6,_0x5ab0d9,_0xc02c22){if(_0xe155d6[_0xab91('0x5a')]['id']){delete _0xe155d6[_0xab91('0x5a')]['id'];}return db['DeskAccount'][_0xab91('0x5d')]({'where':{'id':_0xe155d6[_0xab91('0x54')]['id']}})[_0xab91('0x1e')](handleEntityNotFound(_0x5ab0d9,null))[_0xab91('0x1e')](function(_0x28b3ed){if(_0x28b3ed){_0xe155d6['body'][_0xab91('0x5e')]=_0x28b3ed['id'];_0xe155d6[_0xab91('0x5a')][_0xab91('0x5f')]=integrations[_0xab91('0x60')](_0xe155d6[_0xab91('0x5a')][_0xab91('0x61')],_0xe155d6[_0xab91('0x5a')][_0xab91('0x3f')]);_0xe155d6['body'][_0xab91('0x62')]=integrations[_0xab91('0x63')](_0xe155d6[_0xab91('0x5a')][_0xab91('0x61')],_0xe155d6[_0xab91('0x5a')][_0xab91('0x3f')]);return db[_0xab91('0x5c')][_0xab91('0x59')](_0xe155d6[_0xab91('0x5a')],{'include':[{'model':db['DeskField'],'as':_0xab91('0x5f')},{'model':db[_0xab91('0x64')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5ab0d9,null))[_0xab91('0x28')](handleError(_0x5ab0d9,null));};exports[_0xab91('0x65')]=function(_0xa951c2,_0x1668d3,_0x294505){var _0x24a108=[{'name':_0xab91('0x66'),'label':_0xab91('0x66'),'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 _0x399eb5='';return db[_0xab91('0x57')][_0xab91('0x5d')]({'where':{'id':_0xa951c2[_0xab91('0x54')]['id']},'attributes':['id',_0xab91('0x67'),_0xab91('0x68'),'username',_0xab91('0x69'),_0xab91('0x6a'),_0xab91('0x6b'),_0xab91('0x6c'),'tokenSecret']})[_0xab91('0x1e')](handleEntityNotFound(_0x1668d3,null))[_0xab91('0x1e')](function(_0x3d74e3){if(_0x3d74e3){_0x399eb5=_0x3d74e3[_0xab91('0x67')];var _0x37e925=_0x399eb5['slice'](-0x1);if(_0x37e925==='/'){_0x399eb5=_0x399eb5['substring'](0x0,_0x399eb5[_0xab91('0x6d')](_0x37e925));}var _0x3f5c4f={'method':_0xab91('0x6e'),'uri':util['format'](_0xab91('0x6f'),_0x399eb5),'headers':{'Content-Type':_0xab91('0x70'),'Accept':_0xab91('0x70')},'json':!![]};if(_0x3d74e3[_0xab91('0x68')]==='basic'){_0x3f5c4f[_0xab91('0x71')][_0xab91('0x72')]=util[_0xab91('0x73')](_0xab91('0x74'),new Buffer(util[_0xab91('0x73')](_0xab91('0x75'),_0x3d74e3[_0xab91('0x76')],_0x3d74e3[_0xab91('0x69')]))[_0xab91('0x77')](_0xab91('0x78')));}return rp(_0x3f5c4f)[_0xab91('0x1e')](function(_0x4f33c8){return _0x24a108[_0xab91('0x79')](_['map'](_0x4f33c8[_0xab91('0x7a')][_0xab91('0x7b')],function(_0x1162a2){return{'id':_0x1162a2[_0xab91('0x38')],'name':_0x1162a2[_0xab91('0x38')],'type':_0x1162a2['type'],'active':_0x1162a2['active'],'label':_0x1162a2[_0xab91('0x7c')],'custom':!![]};}));});}})[_0xab91('0x1e')](function(_0x43320a){return{'count':_0x43320a['length'],'rows':_0x43320a};})[_0xab91('0x1e')](respondWithResult(_0x1668d3,null))['catch'](function(_0x32b246){var _0x4458e9=_0xa951c2['query']['test']?0x1f4:_0x32b246[_0xab91('0x7d')]||0x1f4;logger[_0xab91('0x24')](_0xab91('0x7e'),_0xab91('0x65'),_0x4458e9,JSON['stringify'](_0x32b246));delete _0x32b246['name'];if(_0x4458e9===0x191){_0x4458e9=0x190;}_0x1668d3[_0xab91('0x39')](_0x4458e9)[_0xab91('0x3a')](_0xa951c2[_0xab91('0x40')][_0xab91('0x7f')]?{'message':_0xab91('0x80'),'statusCode':_0x32b246[_0xab91('0x7d')]}:_0x32b246);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0f9939c..6e2657e 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 _0xc99b=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc99b,0x11e));var _0xbc99=function(_0x441964,_0x3070ae){_0x441964=_0x441964-0x0;var _0x4211f0=_0xc99b[_0x441964];return _0x4211f0;};'use strict';var _=require('lodash');var util=require(_0xbc99('0x0'));var logger=require(_0xbc99('0x1'))(_0xbc99('0x2'));var moment=require(_0xbc99('0x3'));var BPromise=require(_0xbc99('0x4'));var rp=require(_0xbc99('0x5'));var fs=require('fs');var path=require(_0xbc99('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbc99('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5ebb60,_0x26a3db){return _0x5ebb60[_0xbc99('0x8')](_0xbc99('0x9'),attributes,{'tableName':_0xbc99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb742=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x395f17,_0x50444e){var _0x505564=function(_0x1de631){while(--_0x1de631){_0x395f17['push'](_0x395f17['shift']());}};_0x505564(++_0x50444e);}(_0xb742,0x169));var _0x2b74=function(_0x235f95,_0x2bf647){_0x235f95=_0x235f95-0x0;var _0x2348cb=_0xb742[_0x235f95];return _0x2348cb;};'use strict';var _=require(_0x2b74('0x0'));var util=require(_0x2b74('0x1'));var logger=require(_0x2b74('0x2'))(_0x2b74('0x3'));var moment=require(_0x2b74('0x4'));var BPromise=require(_0x2b74('0x5'));var rp=require(_0x2b74('0x6'));var fs=require('fs');var path=require(_0x2b74('0x7'));var rimraf=require(_0x2b74('0x8'));var config=require(_0x2b74('0x9'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x2b74('0xa')]=function(_0xf183e5,_0x16b28c){return _0xf183e5[_0x2b74('0xb')](_0x2b74('0xc'),attributes,{'tableName':_0x2b74('0xd'),'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 9d313f3..66dfcce 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 _0x5502=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','model','include','map','GetDeskAccount','ShowDeskAccount','DeskAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ca684,_0x14b082){var _0x271f0c=function(_0x344718){while(--_0x344718){_0x3ca684['push'](_0x3ca684['shift']());}};_0x271f0c(++_0x14b082);}(_0x5502,0xef));var _0x2550=function(_0x1ea321,_0x4b76e7){_0x1ea321=_0x1ea321-0x0;var _0x5de358=_0x5502[_0x1ea321];return _0x5de358;};'use strict';var _=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2550('0x2'));var fs=require('fs');var Redis=require(_0x2550('0x3'));var db=require(_0x2550('0x4'))['db'];var utils=require(_0x2550('0x5'));var logger=require(_0x2550('0x6'))(_0x2550('0x7'));var config=require(_0x2550('0x8'));var jayson=require(_0x2550('0x9'));var client=jayson[_0x2550('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3667be,_0x1574a0,_0x503c3d){return new BPromise(function(_0x454989,_0x2ddec4){return client[_0x2550('0xb')](_0x3667be,_0x503c3d)[_0x2550('0xc')](function(_0x3755e5){logger[_0x2550('0xd')](_0x2550('0xe'),_0x1574a0,_0x2550('0xf'));logger[_0x2550('0x10')](_0x2550('0x11'),_0x1574a0,_0x2550('0xf'),JSON[_0x2550('0x12')](_0x3755e5));if(_0x3755e5[_0x2550('0x13')]){if(_0x3755e5[_0x2550('0x13')][_0x2550('0x14')]===0x1f4){logger[_0x2550('0x13')](_0x2550('0xe'),_0x1574a0,_0x3755e5['error'][_0x2550('0x15')]);return _0x2ddec4(_0x3755e5[_0x2550('0x13')][_0x2550('0x15')]);}logger[_0x2550('0x13')](_0x2550('0xe'),_0x1574a0,_0x3755e5['error'][_0x2550('0x15')]);return _0x454989(_0x3755e5[_0x2550('0x13')][_0x2550('0x15')]);}else{logger[_0x2550('0xd')](_0x2550('0xe'),_0x1574a0,_0x2550('0xf'));_0x454989(_0x3755e5[_0x2550('0x16')][_0x2550('0x15')]);}})[_0x2550('0x17')](function(_0x2a4414){logger[_0x2550('0x13')](_0x2550('0xe'),_0x1574a0,_0x2a4414);_0x2ddec4(_0x2a4414);});});}exports['GetDeskAccount']=function(_0x3be8a9){var _0x8aa15e=this;return new Promise(function(_0xf2583b,_0xcabb65){return db['DeskAccount']['findAll']({'raw':_0x3be8a9[_0x2550('0x18')]?_0x3be8a9[_0x2550('0x18')][_0x2550('0x19')]===undefined?!![]:![]:!![],'where':_0x3be8a9['options']?_0x3be8a9[_0x2550('0x18')][_0x2550('0x1a')]||null:null,'attributes':_0x3be8a9['options']?_0x3be8a9[_0x2550('0x18')][_0x2550('0x1b')]||null:null,'limit':_0x3be8a9[_0x2550('0x18')]?_0x3be8a9[_0x2550('0x18')][_0x2550('0x1c')]||null:null,'include':_0x3be8a9[_0x2550('0x18')]?_0x3be8a9[_0x2550('0x18')]['include']?_['map'](_0x3be8a9[_0x2550('0x18')]['include'],function(_0x23b5df){return{'model':db[_0x23b5df[_0x2550('0x1d')]],'as':_0x23b5df['as'],'attributes':_0x23b5df[_0x2550('0x1b')],'include':_0x23b5df[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x23b5df['include'],function(_0x299b26){return{'model':db[_0x299b26['model']],'as':_0x299b26['as'],'attributes':_0x299b26[_0x2550('0x1b')],'include':_0x299b26[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x299b26[_0x2550('0x1e')],function(_0x88a873){return{'model':db[_0x88a873['model']],'as':_0x88a873['as'],'attributes':_0x88a873['attributes']};}):[]};}):[]};}):[]:[]})[_0x2550('0xc')](function(_0x49777d){logger[_0x2550('0xd')](_0x2550('0x20'),_0x3be8a9);logger['debug'](_0x2550('0x20'),_0x3be8a9,JSON['stringify'](_0x49777d));_0xf2583b(_0x49777d);})['catch'](function(_0x30cb3d){logger[_0x2550('0x13')](_0x2550('0x20'),_0x30cb3d[_0x2550('0x15')],_0x3be8a9);_0xcabb65(_0x8aa15e[_0x2550('0x13')](0x1f4,_0x30cb3d[_0x2550('0x15')]));});});};exports[_0x2550('0x21')]=function(_0x3ca513){var _0x56f635=this;return new Promise(function(_0x5b64dc,_0x29e42a){return db[_0x2550('0x22')]['find']({'raw':_0x3ca513[_0x2550('0x18')]?_0x3ca513[_0x2550('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3ca513[_0x2550('0x18')]?_0x3ca513[_0x2550('0x18')]['where']||null:null,'attributes':_0x3ca513[_0x2550('0x18')]?_0x3ca513[_0x2550('0x18')][_0x2550('0x1b')]||null:null,'include':_0x3ca513[_0x2550('0x18')]?_0x3ca513[_0x2550('0x18')][_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x3ca513['options'][_0x2550('0x1e')],function(_0x51d428){return{'model':db[_0x51d428['model']],'as':_0x51d428['as'],'attributes':_0x51d428[_0x2550('0x1b')],'include':_0x51d428[_0x2550('0x1e')]?_['map'](_0x51d428[_0x2550('0x1e')],function(_0x137ed8){return{'model':db[_0x137ed8[_0x2550('0x1d')]],'as':_0x137ed8['as'],'attributes':_0x137ed8[_0x2550('0x1b')],'include':_0x137ed8['include']?_[_0x2550('0x1f')](_0x137ed8[_0x2550('0x1e')],function(_0x48ab5a){return{'model':db[_0x48ab5a['model']],'as':_0x48ab5a['as'],'attributes':_0x48ab5a['attributes']};}):[]};}):[]};}):[]:[]})[_0x2550('0xc')](function(_0x16dd58){logger[_0x2550('0xd')](_0x2550('0x21'),_0x3ca513);logger['debug'](_0x2550('0x21'),_0x3ca513,JSON['stringify'](_0x16dd58));_0x5b64dc(_0x16dd58);})[_0x2550('0x17')](function(_0x4836c1){logger[_0x2550('0x13')](_0x2550('0x21'),_0x4836c1[_0x2550('0x15')],_0x3ca513);_0x29e42a(_0x56f635[_0x2550('0x13')](0x1f4,_0x4836c1[_0x2550('0x15')]));});});}; \ No newline at end of file +var _0xb3a9=['include','map','model','then','catch','DeskAccount','find','ShowDeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetDeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0x2d3be9,_0x3fe55b){var _0x2481c2=function(_0x447f6d){while(--_0x447f6d){_0x2d3be9['push'](_0x2d3be9['shift']());}};_0x2481c2(++_0x3fe55b);}(_0xb3a9,0x10b));var _0x9b3a=function(_0x5e350c,_0x297a94){_0x5e350c=_0x5e350c-0x0;var _0x6e9aa=_0xb3a9[_0x5e350c];return _0x6e9aa;};'use strict';var _=require('lodash');var util=require(_0x9b3a('0x0'));var moment=require('moment');var BPromise=require(_0x9b3a('0x1'));var rs=require(_0x9b3a('0x2'));var fs=require('fs');var Redis=require(_0x9b3a('0x3'));var db=require(_0x9b3a('0x4'))['db'];var utils=require(_0x9b3a('0x5'));var logger=require(_0x9b3a('0x6'))(_0x9b3a('0x7'));var config=require(_0x9b3a('0x8'));var jayson=require(_0x9b3a('0x9'));var client=jayson[_0x9b3a('0xa')][_0x9b3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50f033,_0x429df7,_0x44d889){return new BPromise(function(_0x25f067,_0x119010){return client[_0x9b3a('0xc')](_0x50f033,_0x44d889)['then'](function(_0x3c1201){logger['info'](_0x9b3a('0xd'),_0x429df7,_0x9b3a('0xe'));logger[_0x9b3a('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x429df7,'request\x20sent',JSON[_0x9b3a('0x10')](_0x3c1201));if(_0x3c1201[_0x9b3a('0x11')]){if(_0x3c1201['error'][_0x9b3a('0x12')]===0x1f4){logger[_0x9b3a('0x11')](_0x9b3a('0xd'),_0x429df7,_0x3c1201['error'][_0x9b3a('0x13')]);return _0x119010(_0x3c1201[_0x9b3a('0x11')][_0x9b3a('0x13')]);}logger[_0x9b3a('0x11')](_0x9b3a('0xd'),_0x429df7,_0x3c1201['error']['message']);return _0x25f067(_0x3c1201[_0x9b3a('0x11')][_0x9b3a('0x13')]);}else{logger[_0x9b3a('0x14')](_0x9b3a('0xd'),_0x429df7,'request\x20sent');_0x25f067(_0x3c1201[_0x9b3a('0x15')]['message']);}})['catch'](function(_0x4aa19c){logger[_0x9b3a('0x11')]('DeskAccount,\x20%s,\x20%s',_0x429df7,_0x4aa19c);_0x119010(_0x4aa19c);});});}exports[_0x9b3a('0x16')]=function(_0x24976e){var _0x2ce281=this;return new Promise(function(_0x574f1d,_0x3c9d1f){return db['DeskAccount'][_0x9b3a('0x17')]({'raw':_0x24976e[_0x9b3a('0x18')]?_0x24976e[_0x9b3a('0x18')][_0x9b3a('0x19')]===undefined?!![]:![]:!![],'where':_0x24976e[_0x9b3a('0x18')]?_0x24976e[_0x9b3a('0x18')][_0x9b3a('0x1a')]||null:null,'attributes':_0x24976e['options']?_0x24976e[_0x9b3a('0x18')][_0x9b3a('0x1b')]||null:null,'limit':_0x24976e[_0x9b3a('0x18')]?_0x24976e[_0x9b3a('0x18')][_0x9b3a('0x1c')]||null:null,'include':_0x24976e['options']?_0x24976e[_0x9b3a('0x18')][_0x9b3a('0x1d')]?_[_0x9b3a('0x1e')](_0x24976e[_0x9b3a('0x18')][_0x9b3a('0x1d')],function(_0x1c9aad){return{'model':db[_0x1c9aad['model']],'as':_0x1c9aad['as'],'attributes':_0x1c9aad[_0x9b3a('0x1b')],'include':_0x1c9aad[_0x9b3a('0x1d')]?_['map'](_0x1c9aad[_0x9b3a('0x1d')],function(_0x401e4d){return{'model':db[_0x401e4d['model']],'as':_0x401e4d['as'],'attributes':_0x401e4d[_0x9b3a('0x1b')],'include':_0x401e4d[_0x9b3a('0x1d')]?_['map'](_0x401e4d[_0x9b3a('0x1d')],function(_0x3cac02){return{'model':db[_0x3cac02[_0x9b3a('0x1f')]],'as':_0x3cac02['as'],'attributes':_0x3cac02['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b3a('0x20')](function(_0x1cb1fa){logger[_0x9b3a('0x14')](_0x9b3a('0x16'),_0x24976e);logger[_0x9b3a('0xf')]('GetDeskAccount',_0x24976e,JSON[_0x9b3a('0x10')](_0x1cb1fa));_0x574f1d(_0x1cb1fa);})[_0x9b3a('0x21')](function(_0x41dad8){logger[_0x9b3a('0x11')](_0x9b3a('0x16'),_0x41dad8['message'],_0x24976e);_0x3c9d1f(_0x2ce281[_0x9b3a('0x11')](0x1f4,_0x41dad8['message']));});});};exports['ShowDeskAccount']=function(_0x24a6a6){var _0xb8dfa6=this;return new Promise(function(_0x5225aa,_0x31aa57){return db[_0x9b3a('0x22')][_0x9b3a('0x23')]({'raw':_0x24a6a6[_0x9b3a('0x18')]?_0x24a6a6[_0x9b3a('0x18')][_0x9b3a('0x19')]===undefined?!![]:![]:!![],'where':_0x24a6a6['options']?_0x24a6a6['options'][_0x9b3a('0x1a')]||null:null,'attributes':_0x24a6a6[_0x9b3a('0x18')]?_0x24a6a6['options'][_0x9b3a('0x1b')]||null:null,'include':_0x24a6a6['options']?_0x24a6a6[_0x9b3a('0x18')]['include']?_[_0x9b3a('0x1e')](_0x24a6a6[_0x9b3a('0x18')][_0x9b3a('0x1d')],function(_0x3939af){return{'model':db[_0x3939af[_0x9b3a('0x1f')]],'as':_0x3939af['as'],'attributes':_0x3939af[_0x9b3a('0x1b')],'include':_0x3939af[_0x9b3a('0x1d')]?_[_0x9b3a('0x1e')](_0x3939af[_0x9b3a('0x1d')],function(_0x592999){return{'model':db[_0x592999['model']],'as':_0x592999['as'],'attributes':_0x592999['attributes'],'include':_0x592999[_0x9b3a('0x1d')]?_[_0x9b3a('0x1e')](_0x592999[_0x9b3a('0x1d')],function(_0x152b50){return{'model':db[_0x152b50[_0x9b3a('0x1f')]],'as':_0x152b50['as'],'attributes':_0x152b50[_0x9b3a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9b3a('0x20')](function(_0x5d515a){logger[_0x9b3a('0x14')](_0x9b3a('0x24'),_0x24a6a6);logger[_0x9b3a('0xf')](_0x9b3a('0x24'),_0x24a6a6,JSON[_0x9b3a('0x10')](_0x5d515a));_0x5225aa(_0x5d515a);})[_0x9b3a('0x21')](function(_0x278429){logger[_0x9b3a('0x11')](_0x9b3a('0x24'),_0x278429[_0x9b3a('0x13')],_0x24a6a6);_0x31aa57(_0xb8dfa6[_0x9b3a('0x11')](0x1f4,_0x278429[_0x9b3a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 1a1aa94..d9f880c 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 _0x5725=['create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post'];(function(_0x446b27,_0x4fa8e0){var _0x5382ba=function(_0xc29ff0){while(--_0xc29ff0){_0x446b27['push'](_0x446b27['shift']());}};_0x5382ba(++_0x4fa8e0);}(_0x5725,0x15e));var _0x5572=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5725[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x5572('0x0'));var path=require(_0x5572('0x1'));var timeout=require('connect-timeout');var express=require(_0x5572('0x2'));var router=express[_0x5572('0x3')]();var fs_extra=require(_0x5572('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5572('0x5'));var config=require(_0x5572('0x6'));var controller=require('./intDeskConfiguration.controller');router[_0x5572('0x7')]('/',auth[_0x5572('0x8')](),controller[_0x5572('0x9')]);router[_0x5572('0x7')](_0x5572('0xa'),auth[_0x5572('0x8')](),controller['show']);router['get'](_0x5572('0xb'),auth['isAuthenticated'](),controller[_0x5572('0xc')]);router['get']('/:id/subjects',auth[_0x5572('0x8')](),controller[_0x5572('0xd')]);router[_0x5572('0x7')](_0x5572('0xe'),auth[_0x5572('0x8')](),controller[_0x5572('0xf')]);router[_0x5572('0x7')](_0x5572('0x10'),auth[_0x5572('0x8')](),controller['getTags']);router[_0x5572('0x11')]('/',auth[_0x5572('0x8')](),controller[_0x5572('0x12')]);router[_0x5572('0x11')](_0x5572('0x10'),auth['isAuthenticated'](),controller['setTags']);router[_0x5572('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5572('0x14')]);router[_0x5572('0x15')](_0x5572('0xa'),auth[_0x5572('0x8')](),controller[_0x5572('0x16')]);module['exports']=router; \ No newline at end of file +var _0x111f=['post','create','setTags','put','update','destroy','multer','util','path','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0x111f,0x14b));var _0xf111=function(_0x589d97,_0x3fa206){_0x589d97=_0x589d97-0x0;var _0x4e371a=_0x111f[_0x589d97];return _0x4e371a;};'use strict';var multer=require(_0xf111('0x0'));var util=require(_0xf111('0x1'));var path=require(_0xf111('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf111('0x3')]();var fs_extra=require(_0xf111('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf111('0x5'));var controller=require(_0xf111('0x6'));router[_0xf111('0x7')]('/',auth[_0xf111('0x8')](),controller['index']);router['get'](_0xf111('0x9'),auth[_0xf111('0x8')](),controller[_0xf111('0xa')]);router[_0xf111('0x7')](_0xf111('0xb'),auth[_0xf111('0x8')](),controller[_0xf111('0xc')]);router[_0xf111('0x7')](_0xf111('0xd'),auth[_0xf111('0x8')](),controller[_0xf111('0xe')]);router['get'](_0xf111('0xf'),auth['isAuthenticated'](),controller[_0xf111('0x10')]);router['get'](_0xf111('0x11'),auth['isAuthenticated'](),controller[_0xf111('0x12')]);router[_0xf111('0x13')]('/',auth[_0xf111('0x8')](),controller[_0xf111('0x14')]);router[_0xf111('0x13')]('/:id/tags',auth[_0xf111('0x8')](),controller[_0xf111('0x15')]);router[_0xf111('0x16')](_0xf111('0x9'),auth[_0xf111('0x8')](),controller[_0xf111('0x17')]);router['delete']('/:id',auth[_0xf111('0x8')](),controller[_0xf111('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3b26bd6..718fdd1 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 _0xd331=['exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd331,0x14c));var _0x1d33=function(_0xa95cc9,_0x2f278d){_0xa95cc9=_0xa95cc9-0x0;var _0x5a078f=_0xd331[_0xa95cc9];return _0x5a078f;};'use strict';var Sequelize=require('sequelize');module[_0x1d33('0x0')]={'name':{'type':Sequelize[_0x1d33('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6994=['exports','STRING'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x6994,0x9e));var _0x4699=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x6994[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require('sequelize');module[_0x4699('0x0')]={'name':{'type':Sequelize[_0x4699('0x1')]},'description':{'type':Sequelize[_0x4699('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 33396f8..76bc450 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 _0x3c81=['request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','json','limit','undefined','offset','count','status','Content-Range','apply','save','update','then','destroy','end','stack','name','send','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','catch','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x14716e,_0xa451){var _0x5df3a9=function(_0xff12f9){while(--_0xff12f9){_0x14716e['push'](_0x14716e['shift']());}};_0x5df3a9(++_0xa451);}(_0x3c81,0x102));var _0x13c8=function(_0x2e2c5f,_0x16f3b8){_0x2e2c5f=_0x2e2c5f-0x0;var _0x5a5001=_0x3c81[_0x2e2c5f];return _0x5a5001;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x13c8('0x19')][_0x13c8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2304b5,_0x1f9b6f,_0x4a077c,_0x42955d){return new BPromise(function(_0x515681,_0x4d7a88){var _0x589636=_0x42955d||client;return _0x589636[_0x13c8('0x1b')](_0x2304b5,_0x4a077c)['then'](function(_0x337397){logger[_0x13c8('0x1c')](_0x13c8('0x1d'),_0x1f9b6f,_0x13c8('0x1e'));logger['debug'](_0x13c8('0x1f'),_0x1f9b6f,_0x13c8('0x1e'),JSON[_0x13c8('0x20')](_0x337397));if(_0x337397[_0x13c8('0x21')]){if(_0x337397[_0x13c8('0x21')][_0x13c8('0x22')]===0x1f4){logger[_0x13c8('0x21')](_0x13c8('0x1d'),_0x1f9b6f,_0x337397[_0x13c8('0x21')][_0x13c8('0x23')]);return _0x4d7a88(_0x337397[_0x13c8('0x21')]['message']);}logger[_0x13c8('0x21')](_0x13c8('0x1d'),_0x1f9b6f,_0x337397[_0x13c8('0x21')][_0x13c8('0x23')]);return _0x515681(_0x337397['error'][_0x13c8('0x23')]);}else{logger[_0x13c8('0x1c')](_0x13c8('0x1d'),_0x1f9b6f,_0x13c8('0x1e'));_0x515681(_0x337397[_0x13c8('0x24')][_0x13c8('0x23')]);}})['catch'](function(_0x28f99c){logger[_0x13c8('0x21')](_0x13c8('0x1d'),_0x1f9b6f,_0x28f99c);_0x4d7a88(_0x28f99c);});});}function respondWithStatusCode(_0xcf41d2,_0x577df6){_0x577df6=_0x577df6||0xcc;return function(_0x1770e5){if(_0x1770e5){return _0xcf41d2[_0x13c8('0x25')](_0x577df6);}return _0xcf41d2['status'](_0x577df6)['end']();};}function respondWithResult(_0x3b4fd8,_0x4aff35){_0x4aff35=_0x4aff35||0xc8;return function(_0x47e8ae){if(_0x47e8ae){return _0x3b4fd8['status'](_0x4aff35)[_0x13c8('0x26')](_0x47e8ae);}};}function respondWithFilteredResult(_0xc7f1b6,_0x53ada9){return function(_0x4df077){if(_0x4df077){var _0x196983=typeof _0x53ada9['offset']==='undefined'&&typeof _0x53ada9[_0x13c8('0x27')]===_0x13c8('0x28');var _0x34fdbe=_0x4df077['count'];var _0x5ef2f7=_0x196983?0x0:_0x53ada9[_0x13c8('0x29')];var _0x1071a0=_0x196983?_0x4df077[_0x13c8('0x2a')]:_0x53ada9[_0x13c8('0x29')]+_0x53ada9[_0x13c8('0x27')];var _0x220d40;if(_0x1071a0>=_0x34fdbe){_0x1071a0=_0x34fdbe;_0x220d40=0xc8;}else{_0x220d40=0xce;}_0xc7f1b6[_0x13c8('0x2b')](_0x220d40);return _0xc7f1b6['set'](_0x13c8('0x2c'),_0x5ef2f7+'-'+_0x1071a0+'/'+_0x34fdbe)[_0x13c8('0x26')](_0x4df077);}return null;};}function patchUpdates(_0x5a5911){return function(_0x5c85e4){try{jsonpatch[_0x13c8('0x2d')](_0x5c85e4,_0x5a5911,!![]);}catch(_0xc7225a){return BPromise['reject'](_0xc7225a);}return _0x5c85e4[_0x13c8('0x2e')]();};}function saveUpdates(_0x355ddc,_0x47e0f8){return function(_0x21224a){if(_0x21224a){return _0x21224a[_0x13c8('0x2f')](_0x355ddc)[_0x13c8('0x30')](function(_0x26a93b){return _0x26a93b;});}return null;};}function removeEntity(_0x207dc2,_0x2f600d){return function(_0x1a9298){if(_0x1a9298){return _0x1a9298[_0x13c8('0x31')]()['then'](function(){_0x207dc2['status'](0xcc)[_0x13c8('0x32')]();});}};}function handleEntityNotFound(_0x37eaec,_0x517d01){return function(_0x30d328){if(!_0x30d328){_0x37eaec['sendStatus'](0x194);}return _0x30d328;};}function handleError(_0x1fdf7d,_0x541784){_0x541784=_0x541784||0x1f4;return function(_0x202918){logger[_0x13c8('0x21')](_0x202918[_0x13c8('0x33')]);if(_0x202918[_0x13c8('0x34')]){delete _0x202918[_0x13c8('0x34')];}_0x1fdf7d[_0x13c8('0x2b')](_0x541784)[_0x13c8('0x35')](_0x202918);};}exports['index']=function(_0x388df4,_0x4f7a97){var _0x4fcec3={},_0x362b9c={},_0x8ae2e5={'count':0x0,'rows':[]};var _0x2bfbf4=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x2776c0){return{'name':_0x2776c0[_0x13c8('0x36')],'type':_0x2776c0[_0x13c8('0x37')][_0x13c8('0x38')]};});_0x362b9c[_0x13c8('0x39')]=_[_0x13c8('0x3a')](_0x2bfbf4,_0x13c8('0x34'));_0x362b9c[_0x13c8('0x3b')]=_[_0x13c8('0x3c')](_0x388df4['query']);_0x362b9c['filters']=_[_0x13c8('0x3d')](_0x362b9c[_0x13c8('0x39')],_0x362b9c[_0x13c8('0x3b')]);_0x4fcec3[_0x13c8('0x3e')]=_['intersection'](_0x362b9c[_0x13c8('0x39')],qs['fields'](_0x388df4[_0x13c8('0x3b')][_0x13c8('0x3f')]));_0x4fcec3[_0x13c8('0x3e')]=_0x4fcec3[_0x13c8('0x3e')][_0x13c8('0x40')]?_0x4fcec3[_0x13c8('0x3e')]:_0x362b9c[_0x13c8('0x39')];if(!_0x388df4[_0x13c8('0x3b')][_0x13c8('0x41')](_0x13c8('0x42'))){_0x4fcec3[_0x13c8('0x27')]=qs[_0x13c8('0x27')](_0x388df4[_0x13c8('0x3b')][_0x13c8('0x27')]);_0x4fcec3[_0x13c8('0x29')]=qs[_0x13c8('0x29')](_0x388df4[_0x13c8('0x3b')][_0x13c8('0x29')]);}_0x4fcec3[_0x13c8('0x43')]=qs[_0x13c8('0x44')](_0x388df4[_0x13c8('0x3b')][_0x13c8('0x44')]);_0x4fcec3[_0x13c8('0x45')]=qs[_0x13c8('0x46')](_[_0x13c8('0x47')](_0x388df4['query'],_0x362b9c[_0x13c8('0x46')]),_0x2bfbf4);if(_0x388df4[_0x13c8('0x3b')][_0x13c8('0x48')]){_0x4fcec3[_0x13c8('0x45')]=_[_0x13c8('0x49')](_0x4fcec3['where'],{'$or':_['map'](_0x2bfbf4,function(_0x25606f){if(_0x25606f[_0x13c8('0x37')]!==_0x13c8('0x4a')){var _0x47d41f={};_0x47d41f[_0x25606f['name']]={'$like':'%'+_0x388df4['query'][_0x13c8('0x48')]+'%'};return _0x47d41f;}})});}_0x4fcec3=_['merge']({},_0x4fcec3,_0x388df4[_0x13c8('0x4b')]);var _0x4e3bb7={'where':_0x4fcec3[_0x13c8('0x45')]};return db[_0x13c8('0x4c')][_0x13c8('0x2a')](_0x4e3bb7)[_0x13c8('0x30')](function(_0x3fcc4d){_0x8ae2e5[_0x13c8('0x2a')]=_0x3fcc4d;if(_0x388df4['query'][_0x13c8('0x4d')]){_0x4fcec3[_0x13c8('0x4e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x13c8('0x4f')](_0x4fcec3);})[_0x13c8('0x30')](function(_0x2e925f){_0x8ae2e5[_0x13c8('0x50')]=_0x2e925f;return _0x8ae2e5;})[_0x13c8('0x30')](respondWithFilteredResult(_0x4f7a97,_0x4fcec3))['catch'](handleError(_0x4f7a97,null));};exports[_0x13c8('0x51')]=function(_0x32914b,_0x2e94ae){var _0x38418b={'raw':![],'where':{'id':_0x32914b['params']['id']}},_0x185d18={};_0x185d18[_0x13c8('0x39')]=_[_0x13c8('0x3c')](db[_0x13c8('0x4c')][_0x13c8('0x52')]);_0x185d18[_0x13c8('0x3b')]=_[_0x13c8('0x3c')](_0x32914b[_0x13c8('0x3b')]);_0x185d18[_0x13c8('0x46')]=_[_0x13c8('0x3d')](_0x185d18[_0x13c8('0x39')],_0x185d18[_0x13c8('0x3b')]);_0x38418b['attributes']=_[_0x13c8('0x3d')](_0x185d18[_0x13c8('0x39')],qs[_0x13c8('0x3f')](_0x32914b[_0x13c8('0x3b')][_0x13c8('0x3f')]));_0x38418b[_0x13c8('0x3e')]=_0x38418b['attributes'][_0x13c8('0x40')]?_0x38418b[_0x13c8('0x3e')]:_0x185d18[_0x13c8('0x39')];if(_0x32914b['query']['includeAll']){_0x38418b[_0x13c8('0x4e')]=[{'all':!![]}];}_0x38418b=_[_0x13c8('0x49')]({},_0x38418b,_0x32914b['options']);return db[_0x13c8('0x4c')][_0x13c8('0x53')](_0x38418b)['then'](handleEntityNotFound(_0x2e94ae,null))[_0x13c8('0x30')](respondWithResult(_0x2e94ae,null))['catch'](handleError(_0x2e94ae,null));};exports[_0x13c8('0x54')]=function(_0x1f67bd,_0x10c72f){return db['DeskConfiguration'][_0x13c8('0x54')](_0x1f67bd[_0x13c8('0x55')],{})['then'](respondWithResult(_0x10c72f,0xc9))[_0x13c8('0x56')](handleError(_0x10c72f,null));};exports['update']=function(_0x95289e,_0x5eda4c){if(_0x95289e[_0x13c8('0x55')]['id']){delete _0x95289e[_0x13c8('0x55')]['id'];}return db[_0x13c8('0x4c')]['find']({'where':{'id':_0x95289e[_0x13c8('0x57')]['id']}})['then'](handleEntityNotFound(_0x5eda4c,null))['then'](saveUpdates(_0x95289e['body'],null))['then'](respondWithResult(_0x5eda4c,null))['catch'](handleError(_0x5eda4c,null));};exports[_0x13c8('0x31')]=function(_0x46074c,_0x1515a5){return db[_0x13c8('0x4c')][_0x13c8('0x53')]({'where':{'id':_0x46074c[_0x13c8('0x57')]['id']}})[_0x13c8('0x30')](handleEntityNotFound(_0x1515a5,null))['then'](removeEntity(_0x1515a5,null))['catch'](handleError(_0x1515a5,null));};exports[_0x13c8('0x58')]=function(_0x30e3e4,_0x27760b,_0x11b3ba){var _0x1a346a={};var _0x1ceea5={};var _0x4678a0;var _0x1053a4;return db['DeskConfiguration'][_0x13c8('0x59')]({'where':{'id':_0x30e3e4[_0x13c8('0x57')]['id']}})['then'](handleEntityNotFound(_0x27760b,null))[_0x13c8('0x30')](function(_0x2ebbcd){if(_0x2ebbcd){_0x4678a0=_0x2ebbcd;_0x1ceea5[_0x13c8('0x39')]=_[_0x13c8('0x3c')](db[_0x13c8('0x5a')][_0x13c8('0x52')]);_0x1ceea5[_0x13c8('0x3b')]=_[_0x13c8('0x3c')](_0x30e3e4[_0x13c8('0x3b')]);_0x1ceea5[_0x13c8('0x46')]=_[_0x13c8('0x3d')](_0x1ceea5[_0x13c8('0x39')],_0x1ceea5[_0x13c8('0x3b')]);_0x1a346a[_0x13c8('0x3e')]=_[_0x13c8('0x3d')](_0x1ceea5[_0x13c8('0x39')],qs['fields'](_0x30e3e4[_0x13c8('0x3b')]['fields']));_0x1a346a[_0x13c8('0x3e')]=_0x1a346a[_0x13c8('0x3e')]['length']?_0x1a346a[_0x13c8('0x3e')]:_0x1ceea5[_0x13c8('0x39')];_0x1a346a['order']=qs[_0x13c8('0x44')](_0x30e3e4[_0x13c8('0x3b')][_0x13c8('0x44')]);_0x1a346a[_0x13c8('0x45')]=qs[_0x13c8('0x46')](_[_0x13c8('0x47')](_0x30e3e4[_0x13c8('0x3b')],_0x1ceea5[_0x13c8('0x46')]));if(_0x30e3e4[_0x13c8('0x3b')][_0x13c8('0x48')]){_0x1a346a[_0x13c8('0x45')]=_['merge'](_0x1a346a[_0x13c8('0x45')],{'$or':_[_0x13c8('0x3a')](_0x1a346a[_0x13c8('0x3e')],function(_0x2445c1){var _0x372ae4={};_0x372ae4[_0x2445c1]={'$like':'%'+_0x30e3e4[_0x13c8('0x3b')]['filter']+'%'};return _0x372ae4;})});}_0x1a346a=_[_0x13c8('0x49')]({},_0x1a346a,_0x30e3e4[_0x13c8('0x4b')]);return _0x4678a0[_0x13c8('0x58')](_0x1a346a);}})['then'](function(_0x54241e){if(_0x54241e){_0x1053a4=_0x54241e[_0x13c8('0x40')];if(!_0x30e3e4[_0x13c8('0x3b')][_0x13c8('0x41')](_0x13c8('0x42'))){_0x1a346a[_0x13c8('0x27')]=qs['limit'](_0x30e3e4[_0x13c8('0x3b')][_0x13c8('0x27')]);_0x1a346a[_0x13c8('0x29')]=qs[_0x13c8('0x29')](_0x30e3e4['query'][_0x13c8('0x29')]);}return _0x4678a0[_0x13c8('0x58')](_0x1a346a);}})[_0x13c8('0x30')](function(_0x308482){if(_0x308482){return _0x308482?{'count':_0x1053a4,'rows':_0x308482}:null;}})[_0x13c8('0x30')](respondWithResult(_0x27760b,null))[_0x13c8('0x56')](handleError(_0x27760b,null));};exports[_0x13c8('0x5b')]=function(_0x4b3579,_0x45f0ba,_0x40ff05){var _0x399ea3={};var _0x55926a={};var _0x1fc721;var _0x34cf4a;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4b3579[_0x13c8('0x57')]['id']}})['then'](handleEntityNotFound(_0x45f0ba,null))[_0x13c8('0x30')](function(_0x47f5ff){if(_0x47f5ff){_0x1fc721=_0x47f5ff;_0x55926a[_0x13c8('0x39')]=_[_0x13c8('0x3c')](db[_0x13c8('0x5a')][_0x13c8('0x52')]);_0x55926a[_0x13c8('0x3b')]=_['keys'](_0x4b3579[_0x13c8('0x3b')]);_0x55926a[_0x13c8('0x46')]=_['intersection'](_0x55926a[_0x13c8('0x39')],_0x55926a[_0x13c8('0x3b')]);_0x399ea3[_0x13c8('0x3e')]=_[_0x13c8('0x3d')](_0x55926a[_0x13c8('0x39')],qs[_0x13c8('0x3f')](_0x4b3579[_0x13c8('0x3b')][_0x13c8('0x3f')]));_0x399ea3[_0x13c8('0x3e')]=_0x399ea3[_0x13c8('0x3e')]['length']?_0x399ea3[_0x13c8('0x3e')]:_0x55926a[_0x13c8('0x39')];_0x399ea3['order']=qs['sort'](_0x4b3579[_0x13c8('0x3b')][_0x13c8('0x44')]);_0x399ea3[_0x13c8('0x45')]=qs[_0x13c8('0x46')](_[_0x13c8('0x47')](_0x4b3579[_0x13c8('0x3b')],_0x55926a['filters']));if(_0x4b3579[_0x13c8('0x3b')][_0x13c8('0x48')]){_0x399ea3[_0x13c8('0x45')]=_[_0x13c8('0x49')](_0x399ea3[_0x13c8('0x45')],{'$or':_['map'](_0x399ea3[_0x13c8('0x3e')],function(_0x13b97d){var _0x564cc9={};_0x564cc9[_0x13b97d]={'$like':'%'+_0x4b3579[_0x13c8('0x3b')][_0x13c8('0x48')]+'%'};return _0x564cc9;})});}_0x399ea3=_['merge']({},_0x399ea3,_0x4b3579[_0x13c8('0x4b')]);return _0x1fc721['getSubjects'](_0x399ea3);}})[_0x13c8('0x30')](function(_0x5a4e0a){if(_0x5a4e0a){_0x34cf4a=_0x5a4e0a[_0x13c8('0x40')];if(!_0x4b3579[_0x13c8('0x3b')][_0x13c8('0x41')]('nolimit')){_0x399ea3[_0x13c8('0x27')]=qs['limit'](_0x4b3579['query'][_0x13c8('0x27')]);_0x399ea3[_0x13c8('0x29')]=qs[_0x13c8('0x29')](_0x4b3579[_0x13c8('0x3b')]['offset']);}return _0x1fc721['getSubjects'](_0x399ea3);}})[_0x13c8('0x30')](function(_0x55727a){if(_0x55727a){return _0x55727a?{'count':_0x34cf4a,'rows':_0x55727a}:null;}})['then'](respondWithResult(_0x45f0ba,null))[_0x13c8('0x56')](handleError(_0x45f0ba,null));};exports[_0x13c8('0x5c')]=function(_0x316b20,_0x36000c,_0x523eef){var _0x16386c={};var _0x48cb34={};var _0x5ecd3c;var _0x14cfac;return db[_0x13c8('0x4c')][_0x13c8('0x59')]({'where':{'id':_0x316b20[_0x13c8('0x57')]['id']}})[_0x13c8('0x30')](handleEntityNotFound(_0x36000c,null))['then'](function(_0x23766e){if(_0x23766e){_0x5ecd3c=_0x23766e;_0x48cb34['model']=_[_0x13c8('0x3c')](db['DeskField']['rawAttributes']);_0x48cb34[_0x13c8('0x3b')]=_['keys'](_0x316b20[_0x13c8('0x3b')]);_0x48cb34[_0x13c8('0x46')]=_['intersection'](_0x48cb34[_0x13c8('0x39')],_0x48cb34[_0x13c8('0x3b')]);_0x16386c[_0x13c8('0x3e')]=_[_0x13c8('0x3d')](_0x48cb34[_0x13c8('0x39')],qs['fields'](_0x316b20[_0x13c8('0x3b')][_0x13c8('0x3f')]));_0x16386c[_0x13c8('0x3e')]=_0x16386c[_0x13c8('0x3e')][_0x13c8('0x40')]?_0x16386c['attributes']:_0x48cb34['model'];_0x16386c[_0x13c8('0x43')]=qs[_0x13c8('0x44')](_0x316b20[_0x13c8('0x3b')][_0x13c8('0x44')]);_0x16386c[_0x13c8('0x45')]=qs[_0x13c8('0x46')](_[_0x13c8('0x47')](_0x316b20[_0x13c8('0x3b')],_0x48cb34[_0x13c8('0x46')]));if(_0x316b20[_0x13c8('0x3b')]['filter']){_0x16386c['where']=_[_0x13c8('0x49')](_0x16386c[_0x13c8('0x45')],{'$or':_['map'](_0x16386c[_0x13c8('0x3e')],function(_0x462db2){var _0x1c6fcd={};_0x1c6fcd[_0x462db2]={'$like':'%'+_0x316b20[_0x13c8('0x3b')]['filter']+'%'};return _0x1c6fcd;})});}_0x16386c=_[_0x13c8('0x49')]({},_0x16386c,_0x316b20[_0x13c8('0x4b')]);return _0x5ecd3c[_0x13c8('0x5c')](_0x16386c);}})['then'](function(_0x2959c5){if(_0x2959c5){_0x14cfac=_0x2959c5[_0x13c8('0x40')];if(!_0x316b20[_0x13c8('0x3b')]['hasOwnProperty'](_0x13c8('0x42'))){_0x16386c[_0x13c8('0x27')]=qs[_0x13c8('0x27')](_0x316b20[_0x13c8('0x3b')][_0x13c8('0x27')]);_0x16386c[_0x13c8('0x29')]=qs['offset'](_0x316b20['query']['offset']);}return _0x5ecd3c['getDescriptions'](_0x16386c);}})[_0x13c8('0x30')](function(_0x174b63){if(_0x174b63){return _0x174b63?{'count':_0x14cfac,'rows':_0x174b63}:null;}})[_0x13c8('0x30')](respondWithResult(_0x36000c,null))[_0x13c8('0x56')](handleError(_0x36000c,null));};exports[_0x13c8('0x5d')]=function(_0x3c9355,_0x1b9c6f,_0x126fa4){var _0x2180a9={};var _0x87dc49={};var _0x350465;var _0x4b4691;return db['DeskConfiguration'][_0x13c8('0x59')]({'where':{'id':_0x3c9355[_0x13c8('0x57')]['id']}})[_0x13c8('0x30')](handleEntityNotFound(_0x1b9c6f,null))[_0x13c8('0x30')](function(_0x4d1f5b){if(_0x4d1f5b){_0x350465=_0x4d1f5b;_0x87dc49[_0x13c8('0x39')]=_[_0x13c8('0x3c')](db[_0x13c8('0x5e')]['rawAttributes']);_0x87dc49['query']=_['keys'](_0x3c9355[_0x13c8('0x3b')]);_0x87dc49[_0x13c8('0x46')]=_[_0x13c8('0x3d')](_0x87dc49[_0x13c8('0x39')],_0x87dc49[_0x13c8('0x3b')]);_0x2180a9[_0x13c8('0x3e')]=_[_0x13c8('0x3d')](_0x87dc49[_0x13c8('0x39')],qs['fields'](_0x3c9355[_0x13c8('0x3b')]['fields']));_0x2180a9['attributes']=_0x2180a9[_0x13c8('0x3e')][_0x13c8('0x40')]?_0x2180a9[_0x13c8('0x3e')]:_0x87dc49[_0x13c8('0x39')];_0x2180a9['order']=qs[_0x13c8('0x44')](_0x3c9355['query'][_0x13c8('0x44')]);_0x2180a9[_0x13c8('0x45')]=qs[_0x13c8('0x46')](_[_0x13c8('0x47')](_0x3c9355['query'],_0x87dc49[_0x13c8('0x46')]));if(_0x3c9355['query'][_0x13c8('0x48')]){_0x2180a9[_0x13c8('0x45')]=_['merge'](_0x2180a9['where'],{'$or':_['map'](_0x2180a9[_0x13c8('0x3e')],function(_0x1cda57){var _0x5048e4={};_0x5048e4[_0x1cda57]={'$like':'%'+_0x3c9355[_0x13c8('0x3b')][_0x13c8('0x48')]+'%'};return _0x5048e4;})});}_0x2180a9=_[_0x13c8('0x49')]({},_0x2180a9,_0x3c9355['options']);return _0x350465[_0x13c8('0x5d')](_0x2180a9);}})['then'](function(_0x4dc047){if(_0x4dc047){_0x4b4691=_0x4dc047['length'];if(!_0x3c9355[_0x13c8('0x3b')][_0x13c8('0x41')](_0x13c8('0x42'))){_0x2180a9[_0x13c8('0x27')]=qs[_0x13c8('0x27')](_0x3c9355[_0x13c8('0x3b')]['limit']);_0x2180a9[_0x13c8('0x29')]=qs['offset'](_0x3c9355['query'][_0x13c8('0x29')]);}return _0x350465['getTags'](_0x2180a9);}})[_0x13c8('0x30')](function(_0x3a701b){if(_0x3a701b){return _0x3a701b?{'count':_0x4b4691,'rows':_0x3a701b}:null;}})['then'](respondWithResult(_0x1b9c6f,null))[_0x13c8('0x56')](handleError(_0x1b9c6f,null));};exports[_0x13c8('0x5f')]=function(_0x2d0e63,_0x49cb2a,_0x4208a0){if(_0x2d0e63['body']['id']){delete _0x2d0e63[_0x13c8('0x55')]['id'];}return db[_0x13c8('0x4c')]['findOne']({'where':{'id':_0x2d0e63[_0x13c8('0x57')]['id']}})['then'](handleEntityNotFound(_0x49cb2a,null))['then'](function(_0x167979){if(_0x167979){return _0x167979[_0x13c8('0x5f')](_0x2d0e63[_0x13c8('0x55')]['ids']||[]);}return null;})[_0x13c8('0x30')](respondWithResult(_0x49cb2a,null))[_0x13c8('0x56')](handleError(_0x49cb2a,null));}; \ No newline at end of file +var _0x1775=['http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskConfiguration','includeAll','rows','show','rawAttributes','length','include','find','create','update','body','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client'];(function(_0x28b685,_0x539201){var _0x48deb=function(_0x1ff0cd){while(--_0x1ff0cd){_0x28b685['push'](_0x28b685['shift']());}};_0x48deb(++_0x539201);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];var jayson=require(_0x5177('0x1c'));var client=jayson[_0x5177('0x1d')][_0x5177('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x299eba,_0x1ab4f1,_0x2ec90f,_0x3e6224){return new BPromise(function(_0x1eb9dd,_0x41bef4){var _0x2bf5bb=_0x3e6224||client;return _0x2bf5bb[_0x5177('0x1f')](_0x299eba,_0x2ec90f)[_0x5177('0x20')](function(_0x1b32e6){logger[_0x5177('0x21')](_0x5177('0x22'),_0x1ab4f1,_0x5177('0x23'));logger[_0x5177('0x24')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ab4f1,_0x5177('0x23'),JSON[_0x5177('0x25')](_0x1b32e6));if(_0x1b32e6[_0x5177('0x26')]){if(_0x1b32e6[_0x5177('0x26')]['code']===0x1f4){logger[_0x5177('0x26')](_0x5177('0x22'),_0x1ab4f1,_0x1b32e6[_0x5177('0x26')]['message']);return _0x41bef4(_0x1b32e6[_0x5177('0x26')]['message']);}logger[_0x5177('0x26')](_0x5177('0x22'),_0x1ab4f1,_0x1b32e6[_0x5177('0x26')][_0x5177('0x27')]);return _0x1eb9dd(_0x1b32e6[_0x5177('0x26')][_0x5177('0x27')]);}else{logger[_0x5177('0x21')](_0x5177('0x22'),_0x1ab4f1,_0x5177('0x23'));_0x1eb9dd(_0x1b32e6[_0x5177('0x28')][_0x5177('0x27')]);}})[_0x5177('0x29')](function(_0x5d9a9c){logger[_0x5177('0x26')]('DeskConfiguration,\x20%s,\x20%s',_0x1ab4f1,_0x5d9a9c);_0x41bef4(_0x5d9a9c);});});}function respondWithStatusCode(_0x30b60f,_0x2c68d8){_0x2c68d8=_0x2c68d8||0xcc;return function(_0x3b39b5){if(_0x3b39b5){return _0x30b60f[_0x5177('0x2a')](_0x2c68d8);}return _0x30b60f['status'](_0x2c68d8)[_0x5177('0x2b')]();};}function respondWithResult(_0x533409,_0x564139){_0x564139=_0x564139||0xc8;return function(_0x19a0c2){if(_0x19a0c2){return _0x533409[_0x5177('0x2c')](_0x564139)['json'](_0x19a0c2);}};}function respondWithFilteredResult(_0x3285b3,_0x4eba3a){return function(_0x231d35){if(_0x231d35){var _0x1cbd29=typeof _0x4eba3a['offset']===_0x5177('0x2d')&&typeof _0x4eba3a[_0x5177('0x2e')]===_0x5177('0x2d');var _0x7f86e=_0x231d35[_0x5177('0x2f')];var _0x1cef5d=_0x1cbd29?0x0:_0x4eba3a['offset'];var _0x498fcd=_0x1cbd29?_0x231d35[_0x5177('0x2f')]:_0x4eba3a[_0x5177('0x30')]+_0x4eba3a[_0x5177('0x2e')];var _0x174f7a;if(_0x498fcd>=_0x7f86e){_0x498fcd=_0x7f86e;_0x174f7a=0xc8;}else{_0x174f7a=0xce;}_0x3285b3[_0x5177('0x2c')](_0x174f7a);return _0x3285b3[_0x5177('0x31')](_0x5177('0x32'),_0x1cef5d+'-'+_0x498fcd+'/'+_0x7f86e)[_0x5177('0x33')](_0x231d35);}return null;};}function patchUpdates(_0x49f6f1){return function(_0x42e1db){try{jsonpatch[_0x5177('0x34')](_0x42e1db,_0x49f6f1,!![]);}catch(_0x4f3416){return BPromise[_0x5177('0x35')](_0x4f3416);}return _0x42e1db['save']();};}function saveUpdates(_0x172b36,_0x1a2c46){return function(_0x1ba51c){if(_0x1ba51c){return _0x1ba51c['update'](_0x172b36)['then'](function(_0x13de2a){return _0x13de2a;});}return null;};}function removeEntity(_0x45ae80,_0x6bcb80){return function(_0x3735e9){if(_0x3735e9){return _0x3735e9[_0x5177('0x36')]()[_0x5177('0x20')](function(){_0x45ae80[_0x5177('0x2c')](0xcc)[_0x5177('0x2b')]();});}};}function handleEntityNotFound(_0x513095,_0x459ac6){return function(_0x1d9afe){if(!_0x1d9afe){_0x513095['sendStatus'](0x194);}return _0x1d9afe;};}function handleError(_0xa0851d,_0x2a26fc){_0x2a26fc=_0x2a26fc||0x1f4;return function(_0x172196){logger[_0x5177('0x26')](_0x172196[_0x5177('0x37')]);if(_0x172196[_0x5177('0x38')]){delete _0x172196['name'];}_0xa0851d[_0x5177('0x2c')](_0x2a26fc)[_0x5177('0x39')](_0x172196);};}exports[_0x5177('0x3a')]=function(_0x2e2cc2,_0x154296){var _0xacaa96={},_0x1bb1e3={},_0x5a5a33={'count':0x0,'rows':[]};var _0x257350=_[_0x5177('0x3b')](db['DeskConfiguration']['rawAttributes'],function(_0x35dea3){return{'name':_0x35dea3[_0x5177('0x3c')],'type':_0x35dea3[_0x5177('0x3d')][_0x5177('0x3e')]};});_0x1bb1e3[_0x5177('0x3f')]=_[_0x5177('0x3b')](_0x257350,_0x5177('0x38'));_0x1bb1e3[_0x5177('0x40')]=_[_0x5177('0x41')](_0x2e2cc2[_0x5177('0x40')]);_0x1bb1e3[_0x5177('0x42')]=_[_0x5177('0x43')](_0x1bb1e3[_0x5177('0x3f')],_0x1bb1e3['query']);_0xacaa96[_0x5177('0x44')]=_[_0x5177('0x43')](_0x1bb1e3['model'],qs[_0x5177('0x45')](_0x2e2cc2['query'][_0x5177('0x45')]));_0xacaa96[_0x5177('0x44')]=_0xacaa96[_0x5177('0x44')]['length']?_0xacaa96['attributes']:_0x1bb1e3[_0x5177('0x3f')];if(!_0x2e2cc2[_0x5177('0x40')][_0x5177('0x46')](_0x5177('0x47'))){_0xacaa96[_0x5177('0x2e')]=qs[_0x5177('0x2e')](_0x2e2cc2[_0x5177('0x40')][_0x5177('0x2e')]);_0xacaa96['offset']=qs[_0x5177('0x30')](_0x2e2cc2['query']['offset']);}_0xacaa96[_0x5177('0x48')]=qs[_0x5177('0x49')](_0x2e2cc2['query'][_0x5177('0x49')]);_0xacaa96['where']=qs['filters'](_[_0x5177('0x4a')](_0x2e2cc2[_0x5177('0x40')],_0x1bb1e3[_0x5177('0x42')]),_0x257350);if(_0x2e2cc2[_0x5177('0x40')][_0x5177('0x4b')]){_0xacaa96[_0x5177('0x4c')]=_[_0x5177('0x4d')](_0xacaa96['where'],{'$or':_['map'](_0x257350,function(_0x12b70){if(_0x12b70['type']!==_0x5177('0x4e')){var _0x3476d3={};_0x3476d3[_0x12b70[_0x5177('0x38')]]={'$like':'%'+_0x2e2cc2[_0x5177('0x40')]['filter']+'%'};return _0x3476d3;}})});}_0xacaa96=_[_0x5177('0x4d')]({},_0xacaa96,_0x2e2cc2[_0x5177('0x4f')]);var _0x363c63={'where':_0xacaa96[_0x5177('0x4c')]};return db[_0x5177('0x50')][_0x5177('0x2f')](_0x363c63)[_0x5177('0x20')](function(_0xa24b4d){_0x5a5a33[_0x5177('0x2f')]=_0xa24b4d;if(_0x2e2cc2[_0x5177('0x40')][_0x5177('0x51')]){_0xacaa96['include']=[{'all':!![]}];}return db[_0x5177('0x50')]['findAll'](_0xacaa96);})['then'](function(_0x5bda8a){_0x5a5a33[_0x5177('0x52')]=_0x5bda8a;return _0x5a5a33;})[_0x5177('0x20')](respondWithFilteredResult(_0x154296,_0xacaa96))['catch'](handleError(_0x154296,null));};exports[_0x5177('0x53')]=function(_0x2913a2,_0x208483){var _0x4891fe={'raw':![],'where':{'id':_0x2913a2['params']['id']}},_0x1d4ae4={};_0x1d4ae4['model']=_['keys'](db[_0x5177('0x50')][_0x5177('0x54')]);_0x1d4ae4[_0x5177('0x40')]=_['keys'](_0x2913a2['query']);_0x1d4ae4[_0x5177('0x42')]=_['intersection'](_0x1d4ae4[_0x5177('0x3f')],_0x1d4ae4[_0x5177('0x40')]);_0x4891fe[_0x5177('0x44')]=_[_0x5177('0x43')](_0x1d4ae4[_0x5177('0x3f')],qs[_0x5177('0x45')](_0x2913a2[_0x5177('0x40')][_0x5177('0x45')]));_0x4891fe[_0x5177('0x44')]=_0x4891fe[_0x5177('0x44')][_0x5177('0x55')]?_0x4891fe[_0x5177('0x44')]:_0x1d4ae4[_0x5177('0x3f')];if(_0x2913a2['query']['includeAll']){_0x4891fe[_0x5177('0x56')]=[{'all':!![]}];}_0x4891fe=_['merge']({},_0x4891fe,_0x2913a2[_0x5177('0x4f')]);return db['DeskConfiguration'][_0x5177('0x57')](_0x4891fe)[_0x5177('0x20')](handleEntityNotFound(_0x208483,null))[_0x5177('0x20')](respondWithResult(_0x208483,null))['catch'](handleError(_0x208483,null));};exports['create']=function(_0x19884e,_0x43b5b9){return db[_0x5177('0x50')][_0x5177('0x58')](_0x19884e['body'],{})['then'](respondWithResult(_0x43b5b9,0xc9))[_0x5177('0x29')](handleError(_0x43b5b9,null));};exports[_0x5177('0x59')]=function(_0x32a53a,_0x736b13){if(_0x32a53a['body']['id']){delete _0x32a53a[_0x5177('0x5a')]['id'];}return db[_0x5177('0x50')][_0x5177('0x57')]({'where':{'id':_0x32a53a['params']['id']}})[_0x5177('0x20')](handleEntityNotFound(_0x736b13,null))[_0x5177('0x20')](saveUpdates(_0x32a53a[_0x5177('0x5a')],null))['then'](respondWithResult(_0x736b13,null))[_0x5177('0x29')](handleError(_0x736b13,null));};exports['destroy']=function(_0x40dfd6,_0x39fb92){return db[_0x5177('0x50')]['find']({'where':{'id':_0x40dfd6[_0x5177('0x5b')]['id']}})[_0x5177('0x20')](handleEntityNotFound(_0x39fb92,null))[_0x5177('0x20')](removeEntity(_0x39fb92,null))[_0x5177('0x29')](handleError(_0x39fb92,null));};exports[_0x5177('0x5c')]=function(_0x74589e,_0x37380c,_0x267599){var _0x5ceed2={};var _0x5d96ce={};var _0x4b5b6b;var _0x3bc60b;return db[_0x5177('0x50')][_0x5177('0x5d')]({'where':{'id':_0x74589e[_0x5177('0x5b')]['id']}})[_0x5177('0x20')](handleEntityNotFound(_0x37380c,null))[_0x5177('0x20')](function(_0x4b0b3f){if(_0x4b0b3f){_0x4b5b6b=_0x4b0b3f;_0x5d96ce['model']=_[_0x5177('0x41')](db[_0x5177('0x5e')][_0x5177('0x54')]);_0x5d96ce[_0x5177('0x40')]=_[_0x5177('0x41')](_0x74589e[_0x5177('0x40')]);_0x5d96ce[_0x5177('0x42')]=_[_0x5177('0x43')](_0x5d96ce[_0x5177('0x3f')],_0x5d96ce['query']);_0x5ceed2[_0x5177('0x44')]=_[_0x5177('0x43')](_0x5d96ce['model'],qs[_0x5177('0x45')](_0x74589e[_0x5177('0x40')]['fields']));_0x5ceed2[_0x5177('0x44')]=_0x5ceed2[_0x5177('0x44')][_0x5177('0x55')]?_0x5ceed2['attributes']:_0x5d96ce[_0x5177('0x3f')];_0x5ceed2[_0x5177('0x48')]=qs['sort'](_0x74589e['query'][_0x5177('0x49')]);_0x5ceed2['where']=qs[_0x5177('0x42')](_['pick'](_0x74589e[_0x5177('0x40')],_0x5d96ce[_0x5177('0x42')]));if(_0x74589e['query'][_0x5177('0x4b')]){_0x5ceed2[_0x5177('0x4c')]=_[_0x5177('0x4d')](_0x5ceed2[_0x5177('0x4c')],{'$or':_[_0x5177('0x3b')](_0x5ceed2[_0x5177('0x44')],function(_0x20d476){var _0x58ebdd={};_0x58ebdd[_0x20d476]={'$like':'%'+_0x74589e[_0x5177('0x40')]['filter']+'%'};return _0x58ebdd;})});}_0x5ceed2=_['merge']({},_0x5ceed2,_0x74589e[_0x5177('0x4f')]);return _0x4b5b6b[_0x5177('0x5c')](_0x5ceed2);}})['then'](function(_0x23e0e6){if(_0x23e0e6){_0x3bc60b=_0x23e0e6[_0x5177('0x55')];if(!_0x74589e[_0x5177('0x40')][_0x5177('0x46')](_0x5177('0x47'))){_0x5ceed2[_0x5177('0x2e')]=qs[_0x5177('0x2e')](_0x74589e[_0x5177('0x40')]['limit']);_0x5ceed2['offset']=qs[_0x5177('0x30')](_0x74589e[_0x5177('0x40')][_0x5177('0x30')]);}return _0x4b5b6b[_0x5177('0x5c')](_0x5ceed2);}})[_0x5177('0x20')](function(_0x3dd58f){if(_0x3dd58f){return _0x3dd58f?{'count':_0x3bc60b,'rows':_0x3dd58f}:null;}})['then'](respondWithResult(_0x37380c,null))[_0x5177('0x29')](handleError(_0x37380c,null));};exports[_0x5177('0x5f')]=function(_0x36ab31,_0x46d72e,_0x4aa151){var _0x2e26c6={};var _0x95f83a={};var _0x124935;var _0x22da9d;return db[_0x5177('0x50')]['findOne']({'where':{'id':_0x36ab31[_0x5177('0x5b')]['id']}})['then'](handleEntityNotFound(_0x46d72e,null))[_0x5177('0x20')](function(_0x2ac8f0){if(_0x2ac8f0){_0x124935=_0x2ac8f0;_0x95f83a['model']=_[_0x5177('0x41')](db[_0x5177('0x5e')][_0x5177('0x54')]);_0x95f83a[_0x5177('0x40')]=_['keys'](_0x36ab31[_0x5177('0x40')]);_0x95f83a[_0x5177('0x42')]=_[_0x5177('0x43')](_0x95f83a[_0x5177('0x3f')],_0x95f83a['query']);_0x2e26c6[_0x5177('0x44')]=_[_0x5177('0x43')](_0x95f83a[_0x5177('0x3f')],qs['fields'](_0x36ab31['query'][_0x5177('0x45')]));_0x2e26c6[_0x5177('0x44')]=_0x2e26c6[_0x5177('0x44')][_0x5177('0x55')]?_0x2e26c6[_0x5177('0x44')]:_0x95f83a[_0x5177('0x3f')];_0x2e26c6[_0x5177('0x48')]=qs[_0x5177('0x49')](_0x36ab31[_0x5177('0x40')]['sort']);_0x2e26c6['where']=qs['filters'](_[_0x5177('0x4a')](_0x36ab31['query'],_0x95f83a[_0x5177('0x42')]));if(_0x36ab31[_0x5177('0x40')][_0x5177('0x4b')]){_0x2e26c6[_0x5177('0x4c')]=_[_0x5177('0x4d')](_0x2e26c6['where'],{'$or':_[_0x5177('0x3b')](_0x2e26c6[_0x5177('0x44')],function(_0x41a7fa){var _0x4fce32={};_0x4fce32[_0x41a7fa]={'$like':'%'+_0x36ab31[_0x5177('0x40')]['filter']+'%'};return _0x4fce32;})});}_0x2e26c6=_[_0x5177('0x4d')]({},_0x2e26c6,_0x36ab31[_0x5177('0x4f')]);return _0x124935['getSubjects'](_0x2e26c6);}})[_0x5177('0x20')](function(_0x3f3031){if(_0x3f3031){_0x22da9d=_0x3f3031['length'];if(!_0x36ab31['query'][_0x5177('0x46')]('nolimit')){_0x2e26c6[_0x5177('0x2e')]=qs[_0x5177('0x2e')](_0x36ab31['query'][_0x5177('0x2e')]);_0x2e26c6[_0x5177('0x30')]=qs[_0x5177('0x30')](_0x36ab31[_0x5177('0x40')][_0x5177('0x30')]);}return _0x124935[_0x5177('0x5f')](_0x2e26c6);}})[_0x5177('0x20')](function(_0x10b062){if(_0x10b062){return _0x10b062?{'count':_0x22da9d,'rows':_0x10b062}:null;}})['then'](respondWithResult(_0x46d72e,null))[_0x5177('0x29')](handleError(_0x46d72e,null));};exports['getDescriptions']=function(_0x3ece97,_0x339d5d,_0x46d726){var _0x2f9728={};var _0x4ea67b={};var _0x154290;var _0x14f272;return db['DeskConfiguration'][_0x5177('0x5d')]({'where':{'id':_0x3ece97[_0x5177('0x5b')]['id']}})['then'](handleEntityNotFound(_0x339d5d,null))[_0x5177('0x20')](function(_0x5f57bc){if(_0x5f57bc){_0x154290=_0x5f57bc;_0x4ea67b[_0x5177('0x3f')]=_['keys'](db['DeskField']['rawAttributes']);_0x4ea67b[_0x5177('0x40')]=_[_0x5177('0x41')](_0x3ece97[_0x5177('0x40')]);_0x4ea67b['filters']=_[_0x5177('0x43')](_0x4ea67b[_0x5177('0x3f')],_0x4ea67b[_0x5177('0x40')]);_0x2f9728[_0x5177('0x44')]=_[_0x5177('0x43')](_0x4ea67b['model'],qs[_0x5177('0x45')](_0x3ece97[_0x5177('0x40')]['fields']));_0x2f9728[_0x5177('0x44')]=_0x2f9728['attributes'][_0x5177('0x55')]?_0x2f9728['attributes']:_0x4ea67b[_0x5177('0x3f')];_0x2f9728[_0x5177('0x48')]=qs[_0x5177('0x49')](_0x3ece97[_0x5177('0x40')][_0x5177('0x49')]);_0x2f9728[_0x5177('0x4c')]=qs['filters'](_['pick'](_0x3ece97[_0x5177('0x40')],_0x4ea67b[_0x5177('0x42')]));if(_0x3ece97[_0x5177('0x40')]['filter']){_0x2f9728[_0x5177('0x4c')]=_[_0x5177('0x4d')](_0x2f9728['where'],{'$or':_[_0x5177('0x3b')](_0x2f9728['attributes'],function(_0x125b08){var _0x134b2f={};_0x134b2f[_0x125b08]={'$like':'%'+_0x3ece97[_0x5177('0x40')]['filter']+'%'};return _0x134b2f;})});}_0x2f9728=_[_0x5177('0x4d')]({},_0x2f9728,_0x3ece97['options']);return _0x154290[_0x5177('0x60')](_0x2f9728);}})[_0x5177('0x20')](function(_0x5a40f1){if(_0x5a40f1){_0x14f272=_0x5a40f1['length'];if(!_0x3ece97['query'][_0x5177('0x46')]('nolimit')){_0x2f9728[_0x5177('0x2e')]=qs[_0x5177('0x2e')](_0x3ece97[_0x5177('0x40')]['limit']);_0x2f9728['offset']=qs['offset'](_0x3ece97[_0x5177('0x40')][_0x5177('0x30')]);}return _0x154290[_0x5177('0x60')](_0x2f9728);}})['then'](function(_0x4152f2){if(_0x4152f2){return _0x4152f2?{'count':_0x14f272,'rows':_0x4152f2}:null;}})[_0x5177('0x20')](respondWithResult(_0x339d5d,null))['catch'](handleError(_0x339d5d,null));};exports[_0x5177('0x61')]=function(_0x526459,_0x26fd12,_0x5442fa){var _0x4a0f8b={};var _0x5910a8={};var _0x3940dd;var _0x5b908d;return db[_0x5177('0x50')][_0x5177('0x5d')]({'where':{'id':_0x526459[_0x5177('0x5b')]['id']}})[_0x5177('0x20')](handleEntityNotFound(_0x26fd12,null))[_0x5177('0x20')](function(_0x197377){if(_0x197377){_0x3940dd=_0x197377;_0x5910a8['model']=_[_0x5177('0x41')](db[_0x5177('0x62')]['rawAttributes']);_0x5910a8[_0x5177('0x40')]=_[_0x5177('0x41')](_0x526459[_0x5177('0x40')]);_0x5910a8['filters']=_['intersection'](_0x5910a8['model'],_0x5910a8[_0x5177('0x40')]);_0x4a0f8b[_0x5177('0x44')]=_[_0x5177('0x43')](_0x5910a8[_0x5177('0x3f')],qs[_0x5177('0x45')](_0x526459[_0x5177('0x40')][_0x5177('0x45')]));_0x4a0f8b[_0x5177('0x44')]=_0x4a0f8b[_0x5177('0x44')][_0x5177('0x55')]?_0x4a0f8b[_0x5177('0x44')]:_0x5910a8[_0x5177('0x3f')];_0x4a0f8b['order']=qs[_0x5177('0x49')](_0x526459['query'][_0x5177('0x49')]);_0x4a0f8b[_0x5177('0x4c')]=qs[_0x5177('0x42')](_['pick'](_0x526459[_0x5177('0x40')],_0x5910a8[_0x5177('0x42')]));if(_0x526459[_0x5177('0x40')][_0x5177('0x4b')]){_0x4a0f8b[_0x5177('0x4c')]=_[_0x5177('0x4d')](_0x4a0f8b[_0x5177('0x4c')],{'$or':_[_0x5177('0x3b')](_0x4a0f8b['attributes'],function(_0x479948){var _0x67fde4={};_0x67fde4[_0x479948]={'$like':'%'+_0x526459['query'][_0x5177('0x4b')]+'%'};return _0x67fde4;})});}_0x4a0f8b=_[_0x5177('0x4d')]({},_0x4a0f8b,_0x526459['options']);return _0x3940dd[_0x5177('0x61')](_0x4a0f8b);}})[_0x5177('0x20')](function(_0x54efd0){if(_0x54efd0){_0x5b908d=_0x54efd0[_0x5177('0x55')];if(!_0x526459[_0x5177('0x40')][_0x5177('0x46')](_0x5177('0x47'))){_0x4a0f8b[_0x5177('0x2e')]=qs[_0x5177('0x2e')](_0x526459[_0x5177('0x40')][_0x5177('0x2e')]);_0x4a0f8b[_0x5177('0x30')]=qs[_0x5177('0x30')](_0x526459[_0x5177('0x40')][_0x5177('0x30')]);}return _0x3940dd[_0x5177('0x61')](_0x4a0f8b);}})['then'](function(_0x174655){if(_0x174655){return _0x174655?{'count':_0x5b908d,'rows':_0x174655}:null;}})[_0x5177('0x20')](respondWithResult(_0x26fd12,null))[_0x5177('0x29')](handleError(_0x26fd12,null));};exports['setTags']=function(_0x363010,_0xa08446,_0x51ef0a){if(_0x363010[_0x5177('0x5a')]['id']){delete _0x363010['body']['id'];}return db['DeskConfiguration'][_0x5177('0x5d')]({'where':{'id':_0x363010[_0x5177('0x5b')]['id']}})[_0x5177('0x20')](handleEntityNotFound(_0xa08446,null))[_0x5177('0x20')](function(_0x356874){if(_0x356874){return _0x356874[_0x5177('0x63')](_0x363010['body'][_0x5177('0x64')]||[]);}return null;})[_0x5177('0x20')](respondWithResult(_0xa08446,null))['catch'](handleError(_0xa08446,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f1bd47a..365b0d6 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 _0xd4f6=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','lodash','api','moment','bluebird'];(function(_0x24d750,_0xfe2c96){var _0x187bc2=function(_0x312268){while(--_0x312268){_0x24d750['push'](_0x24d750['shift']());}};_0x187bc2(++_0xfe2c96);}(_0xd4f6,0x128));var _0x6d4f=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0xd4f6[_0x553502];return _0x246c37;};'use strict';var _=require(_0x6d4f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6d4f('0x1'));var moment=require(_0x6d4f('0x2'));var BPromise=require(_0x6d4f('0x3'));var rp=require(_0x6d4f('0x4'));var fs=require('fs');var path=require(_0x6d4f('0x5'));var rimraf=require(_0x6d4f('0x6'));var config=require(_0x6d4f('0x7'));var attributes=require(_0x6d4f('0x8'));module['exports']=function(_0x1b9fef,_0x46051b){return _0x1b9fef['define'](_0x6d4f('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6adf=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api'];(function(_0x427173,_0x38543a){var _0x264b51=function(_0x1ec9f7){while(--_0x1ec9f7){_0x427173['push'](_0x427173['shift']());}};_0x264b51(++_0x38543a);}(_0x6adf,0x7e));var _0xf6ad=function(_0x559474,_0x1baa8f){_0x559474=_0x559474-0x0;var _0x20bbe6=_0x6adf[_0x559474];return _0x20bbe6;};'use strict';var _=require(_0xf6ad('0x0'));var util=require(_0xf6ad('0x1'));var logger=require(_0xf6ad('0x2'))(_0xf6ad('0x3'));var moment=require(_0xf6ad('0x4'));var BPromise=require(_0xf6ad('0x5'));var rp=require(_0xf6ad('0x6'));var fs=require('fs');var path=require(_0xf6ad('0x7'));var rimraf=require(_0xf6ad('0x8'));var config=require(_0xf6ad('0x9'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x1d734b,_0x29ab2b){return _0x1d734b[_0xf6ad('0xa')](_0xf6ad('0xb'),attributes,{'tableName':_0xf6ad('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 ec7df33..5a4297f 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 _0xc5ba=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x10224e,_0x46a037){var _0x57e372=function(_0x5b19bd){while(--_0x5b19bd){_0x10224e['push'](_0x10224e['shift']());}};_0x57e372(++_0x46a037);}(_0xc5ba,0xb9));var _0xac5b=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xc5ba[_0x35e75a];return _0xb23c7f;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var BPromise=require(_0xac5b('0x3'));var rs=require(_0xac5b('0x4'));var fs=require('fs');var Redis=require(_0xac5b('0x5'));var db=require(_0xac5b('0x6'))['db'];var utils=require(_0xac5b('0x7'));var logger=require(_0xac5b('0x8'))(_0xac5b('0x9'));var config=require(_0xac5b('0xa'));var jayson=require(_0xac5b('0xb'));var client=jayson[_0xac5b('0xc')][_0xac5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38602a,_0xc09fbc,_0xc193a7){return new BPromise(function(_0x4a7fc7,_0x525e20){return client[_0xac5b('0xe')](_0x38602a,_0xc193a7)['then'](function(_0x3c5bd3){logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));logger[_0xac5b('0x12')](_0xac5b('0x13'),_0xc09fbc,_0xac5b('0x11'),JSON[_0xac5b('0x14')](_0x3c5bd3));if(_0x3c5bd3[_0xac5b('0x15')]){if(_0x3c5bd3['error'][_0xac5b('0x16')]===0x1f4){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x525e20(_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);}logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x4a7fc7(_0x3c5bd3[_0xac5b('0x15')]['message']);}else{logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));_0x4a7fc7(_0x3c5bd3[_0xac5b('0x18')][_0xac5b('0x17')]);}})[_0xac5b('0x19')](function(_0x363de5){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x363de5);_0x525e20(_0x363de5);});});} \ No newline at end of file +var _0xb48d=['DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x1c49cf,_0x3bbc11){var _0x53e567=function(_0x303be1){while(--_0x303be1){_0x1c49cf['push'](_0x1c49cf['shift']());}};_0x53e567(++_0x3bbc11);}(_0xb48d,0x194));var _0xdb48=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xb48d[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xdb48('0x0'));var util=require('util');var moment=require(_0xdb48('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb48('0x2'));var fs=require('fs');var Redis=require(_0xdb48('0x3'));var db=require(_0xdb48('0x4'))['db'];var utils=require(_0xdb48('0x5'));var logger=require('../../config/logger')(_0xdb48('0x6'));var config=require('../../config/environment');var jayson=require(_0xdb48('0x7'));var client=jayson[_0xdb48('0x8')][_0xdb48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db721,_0x4e834c,_0x251ce5){return new BPromise(function(_0x173933,_0x5f2b47){return client[_0xdb48('0xa')](_0x5db721,_0x251ce5)[_0xdb48('0xb')](function(_0x4ddac8){logger[_0xdb48('0xc')](_0xdb48('0xd'),_0x4e834c,'request\x20sent');logger['debug'](_0xdb48('0xe'),_0x4e834c,_0xdb48('0xf'),JSON[_0xdb48('0x10')](_0x4ddac8));if(_0x4ddac8['error']){if(_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x12')]===0x1f4){logger['error'](_0xdb48('0xd'),_0x4e834c,_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);return _0x5f2b47(_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);}logger[_0xdb48('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x4e834c,_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);return _0x173933(_0x4ddac8[_0xdb48('0x11')]['message']);}else{logger[_0xdb48('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x4e834c,_0xdb48('0xf'));_0x173933(_0x4ddac8[_0xdb48('0x14')][_0xdb48('0x13')]);}})[_0xdb48('0x15')](function(_0x43c3ad){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4e834c,_0x43c3ad);_0x5f2b47(_0x43c3ad);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9c21d6f..e13580d 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7a54,0x106));var _0x47a5=function(_0x393f4f,_0x2f1baa){_0x393f4f=_0x393f4f-0x0;var _0x4c4df6=_0x7a54[_0x393f4f];return _0x4c4df6;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7a54,0x106));var _0x47a5=function(_0x3c7b49,_0x243389){_0x3c7b49=_0x3c7b49-0x0;var _0x52a379=_0x7a54[_0x3c7b49];return _0x52a379;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 58042d5..2257c94 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 _0x0ecd=['STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue','picklist'];(function(_0x1e944e,_0x5303ed){var _0x80fb9c=function(_0x3dd512){while(--_0x3dd512){_0x1e944e['push'](_0x1e944e['shift']());}};_0x80fb9c(++_0x5303ed);}(_0x0ecd,0xa5));var _0xd0ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ecd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd0ec('0x0'));module['exports']={'type':{'type':Sequelize[_0xd0ec('0x1')](_0xd0ec('0x2'),'variable',_0xd0ec('0x3'),_0xd0ec('0x4'),_0xd0ec('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd0ec('0x6')]},'key':{'type':Sequelize[_0xd0ec('0x6')]},'keyType':{'type':Sequelize[_0xd0ec('0x1')](_0xd0ec('0x2'),_0xd0ec('0x7'),_0xd0ec('0x3'))},'keyContent':{'type':Sequelize[_0xd0ec('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd0ec('0x6')]},'customField':{'type':Sequelize[_0xd0ec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd0ec('0x6')]}}; \ No newline at end of file +var _0x8a59=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x3b77aa,_0xb10575){var _0x217df5=function(_0x187a22){while(--_0x187a22){_0x3b77aa['push'](_0x3b77aa['shift']());}};_0x217df5(++_0xb10575);}(_0x8a59,0x116));var _0x98a5=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x8a59[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x98a5('0x0'));module[_0x98a5('0x1')]={'type':{'type':Sequelize[_0x98a5('0x2')](_0x98a5('0x3'),_0x98a5('0x4'),_0x98a5('0x5'),_0x98a5('0x6'),_0x98a5('0x7')),'defaultValue':_0x98a5('0x3')},'content':{'type':Sequelize[_0x98a5('0x8')]},'key':{'type':Sequelize[_0x98a5('0x8')]},'keyType':{'type':Sequelize[_0x98a5('0x2')](_0x98a5('0x3'),_0x98a5('0x4'),_0x98a5('0x5'))},'keyContent':{'type':Sequelize[_0x98a5('0x8')]},'idField':{'type':Sequelize[_0x98a5('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x98a5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98a5('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5d97512..cc6b3dc 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 _0x5ec6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service'];(function(_0x5e19ce,_0xf69afe){var _0x4b8eb8=function(_0x151c8c){while(--_0x151c8c){_0x5e19ce['push'](_0x5e19ce['shift']());}};_0x4b8eb8(++_0xf69afe);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5150d1,_0x407f6f){_0x5150d1=_0x5150d1-0x0;var _0x5bdf68=_0x5ec6[_0x5150d1];return _0x5bdf68;};'use strict';var emlformat=require(_0x65ec('0x0'));var rimraf=require(_0x65ec('0x1'));var zipdir=require(_0x65ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65ec('0x3'));var moment=require('moment');var BPromise=require(_0x65ec('0x4'));var Mustache=require('mustache');var util=require(_0x65ec('0x5'));var path=require('path');var sox=require(_0x65ec('0x6'));var csv=require('to-csv');var ejs=require(_0x65ec('0x7'));var fs=require('fs');var fs_extra=require(_0x65ec('0x8'));var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0xc'));var querystring=require(_0x65ec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xf'));var hardwareService=require(_0x65ec('0x10'));var logger=require('../../config/logger')(_0x65ec('0x11'));var utils=require(_0x65ec('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x65ec('0x13'));var db=require(_0x65ec('0x14'))['db'];function respondWithStatusCode(_0x53d62b,_0x3e52c8){_0x3e52c8=_0x3e52c8||0xcc;return function(_0x2af7d6){if(_0x2af7d6){return _0x53d62b[_0x65ec('0x15')](_0x3e52c8);}return _0x53d62b[_0x65ec('0x16')](_0x3e52c8)[_0x65ec('0x17')]();};}function respondWithResult(_0x434e20,_0x344724){_0x344724=_0x344724||0xc8;return function(_0x3edbfd){if(_0x3edbfd){return _0x434e20['status'](_0x344724)[_0x65ec('0x18')](_0x3edbfd);}};}function respondWithFilteredResult(_0x3ed6f7,_0x35d06b){return function(_0x4bbe88){if(_0x4bbe88){var _0x5a0442=typeof _0x35d06b[_0x65ec('0x19')]===_0x65ec('0x1a')&&typeof _0x35d06b[_0x65ec('0x1b')]==='undefined';var _0x25dae7=_0x4bbe88[_0x65ec('0x1c')];var _0x1254f8=_0x5a0442?0x0:_0x35d06b[_0x65ec('0x19')];var _0x29ebc4=_0x5a0442?_0x4bbe88[_0x65ec('0x1c')]:_0x35d06b[_0x65ec('0x19')]+_0x35d06b[_0x65ec('0x1b')];var _0x2127e2;if(_0x29ebc4>=_0x25dae7){_0x29ebc4=_0x25dae7;_0x2127e2=0xc8;}else{_0x2127e2=0xce;}_0x3ed6f7[_0x65ec('0x16')](_0x2127e2);return _0x3ed6f7[_0x65ec('0x1d')](_0x65ec('0x1e'),_0x1254f8+'-'+_0x29ebc4+'/'+_0x25dae7)[_0x65ec('0x18')](_0x4bbe88);}return null;};}function patchUpdates(_0x1467ac){return function(_0x3804a4){try{jsonpatch[_0x65ec('0x1f')](_0x3804a4,_0x1467ac,!![]);}catch(_0x15d4eb){return BPromise[_0x65ec('0x20')](_0x15d4eb);}return _0x3804a4[_0x65ec('0x21')]();};}function saveUpdates(_0x4ff93c,_0x170703){return function(_0x297fba){if(_0x297fba){return _0x297fba[_0x65ec('0x22')](_0x4ff93c)[_0x65ec('0x23')](function(_0x1d60fb){return _0x1d60fb;});}return null;};}function removeEntity(_0x163e55,_0x47288d){return function(_0x58239f){if(_0x58239f){return _0x58239f[_0x65ec('0x24')]()[_0x65ec('0x23')](function(){_0x163e55[_0x65ec('0x16')](0xcc)[_0x65ec('0x17')]();});}};}function handleEntityNotFound(_0x288e66,_0x156793){return function(_0x21426b){if(!_0x21426b){_0x288e66[_0x65ec('0x15')](0x194);}return _0x21426b;};}function handleError(_0x297e09,_0x4c846b){_0x4c846b=_0x4c846b||0x1f4;return function(_0x10baef){logger[_0x65ec('0x25')](_0x10baef[_0x65ec('0x26')]);if(_0x10baef[_0x65ec('0x27')]){delete _0x10baef['name'];}_0x297e09[_0x65ec('0x16')](_0x4c846b)['send'](_0x10baef);};}exports[_0x65ec('0x28')]=function(_0x1ada47,_0x1d0b5c){var _0x30366c={},_0x14431d={},_0x46d4c1={'count':0x0,'rows':[]};var _0x46bf66=_[_0x65ec('0x29')](db[_0x65ec('0x2a')][_0x65ec('0x2b')],function(_0x3c97e2){return{'name':_0x3c97e2['fieldName'],'type':_0x3c97e2['type'][_0x65ec('0x2c')]};});_0x14431d['model']=_[_0x65ec('0x29')](_0x46bf66,_0x65ec('0x27'));_0x14431d['query']=_[_0x65ec('0x2d')](_0x1ada47[_0x65ec('0x2e')]);_0x14431d[_0x65ec('0x2f')]=_[_0x65ec('0x30')](_0x14431d['model'],_0x14431d[_0x65ec('0x2e')]);_0x30366c[_0x65ec('0x31')]=_[_0x65ec('0x30')](_0x14431d[_0x65ec('0x32')],qs[_0x65ec('0x33')](_0x1ada47[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x30366c[_0x65ec('0x31')]=_0x30366c[_0x65ec('0x31')][_0x65ec('0x34')]?_0x30366c['attributes']:_0x14431d[_0x65ec('0x32')];if(!_0x1ada47[_0x65ec('0x2e')]['hasOwnProperty'](_0x65ec('0x35'))){_0x30366c[_0x65ec('0x1b')]=qs[_0x65ec('0x1b')](_0x1ada47[_0x65ec('0x2e')][_0x65ec('0x1b')]);_0x30366c[_0x65ec('0x19')]=qs[_0x65ec('0x19')](_0x1ada47['query'][_0x65ec('0x19')]);}_0x30366c[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x1ada47[_0x65ec('0x2e')]['sort']);_0x30366c[_0x65ec('0x38')]=qs[_0x65ec('0x2f')](_[_0x65ec('0x39')](_0x1ada47[_0x65ec('0x2e')],_0x14431d['filters']),_0x46bf66);if(_0x1ada47['query'][_0x65ec('0x3a')]){_0x30366c['where']=_[_0x65ec('0x3b')](_0x30366c[_0x65ec('0x38')],{'$or':_['map'](_0x46bf66,function(_0x16ef59){if(_0x16ef59[_0x65ec('0x3c')]!==_0x65ec('0x3d')){var _0x5357bf={};_0x5357bf[_0x16ef59[_0x65ec('0x27')]]={'$like':'%'+_0x1ada47[_0x65ec('0x2e')][_0x65ec('0x3a')]+'%'};return _0x5357bf;}})});}_0x30366c=_[_0x65ec('0x3b')]({},_0x30366c,_0x1ada47[_0x65ec('0x3e')]);var _0x2ce56f={'where':_0x30366c[_0x65ec('0x38')]};return db['DeskField'][_0x65ec('0x1c')](_0x2ce56f)['then'](function(_0x2654b2){_0x46d4c1[_0x65ec('0x1c')]=_0x2654b2;if(_0x1ada47[_0x65ec('0x2e')][_0x65ec('0x3f')]){_0x30366c[_0x65ec('0x40')]=[{'all':!![]}];}return db[_0x65ec('0x2a')]['findAll'](_0x30366c);})[_0x65ec('0x23')](function(_0x4ba7df){_0x46d4c1['rows']=_0x4ba7df;return _0x46d4c1;})[_0x65ec('0x23')](respondWithFilteredResult(_0x1d0b5c,_0x30366c))[_0x65ec('0x41')](handleError(_0x1d0b5c,null));};exports[_0x65ec('0x42')]=function(_0x143a11,_0x1d475e){var _0x524235={'raw':!![],'where':{'id':_0x143a11[_0x65ec('0x43')]['id']}},_0x4843ca={};_0x4843ca[_0x65ec('0x32')]=_[_0x65ec('0x2d')](db[_0x65ec('0x2a')][_0x65ec('0x2b')]);_0x4843ca['query']=_['keys'](_0x143a11[_0x65ec('0x2e')]);_0x4843ca[_0x65ec('0x2f')]=_[_0x65ec('0x30')](_0x4843ca[_0x65ec('0x32')],_0x4843ca[_0x65ec('0x2e')]);_0x524235[_0x65ec('0x31')]=_[_0x65ec('0x30')](_0x4843ca['model'],qs[_0x65ec('0x33')](_0x143a11[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x524235['attributes']=_0x524235[_0x65ec('0x31')][_0x65ec('0x34')]?_0x524235['attributes']:_0x4843ca[_0x65ec('0x32')];if(_0x143a11[_0x65ec('0x2e')][_0x65ec('0x3f')]){_0x524235[_0x65ec('0x40')]=[{'all':!![]}];}_0x524235=_[_0x65ec('0x3b')]({},_0x524235,_0x143a11['options']);return db[_0x65ec('0x2a')][_0x65ec('0x44')](_0x524235)[_0x65ec('0x23')](handleEntityNotFound(_0x1d475e,null))[_0x65ec('0x23')](respondWithResult(_0x1d475e,null))['catch'](handleError(_0x1d475e,null));};exports[_0x65ec('0x45')]=function(_0x509c28,_0x1ed0f9){return db[_0x65ec('0x2a')][_0x65ec('0x45')](_0x509c28['body'],{})['then'](respondWithResult(_0x1ed0f9,0xc9))[_0x65ec('0x41')](handleError(_0x1ed0f9,null));};exports[_0x65ec('0x22')]=function(_0xf5419,_0x2111af){if(_0xf5419[_0x65ec('0x46')]['id']){delete _0xf5419[_0x65ec('0x46')]['id'];}return db[_0x65ec('0x2a')][_0x65ec('0x44')]({'where':{'id':_0xf5419[_0x65ec('0x43')]['id']}})[_0x65ec('0x23')](handleEntityNotFound(_0x2111af,null))[_0x65ec('0x23')](saveUpdates(_0xf5419[_0x65ec('0x46')],null))[_0x65ec('0x23')](respondWithResult(_0x2111af,null))[_0x65ec('0x41')](handleError(_0x2111af,null));};exports[_0x65ec('0x24')]=function(_0x14eaef,_0x22c28c){return db['DeskField'][_0x65ec('0x44')]({'where':{'id':_0x14eaef[_0x65ec('0x43')]['id']}})['then'](handleEntityNotFound(_0x22c28c,null))[_0x65ec('0x23')](removeEntity(_0x22c28c,null))[_0x65ec('0x41')](handleError(_0x22c28c,null));}; \ No newline at end of file +var _0x1775=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x49a3a5,_0x5a8caf){var _0xf6b7fb=function(_0x3b05aa){while(--_0x3b05aa){_0x49a3a5['push'](_0x49a3a5['shift']());}};_0xf6b7fb(++_0x5a8caf);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x564139,_0x19a0c2){return function(_0x15cb93){if(!_0x15cb93){_0x564139['sendStatus'](0x194);}return _0x15cb93;};}function handleError(_0x3285b3,_0x4eba3a){_0x4eba3a=_0x4eba3a||0x1f4;return function(_0x231d35){logger[_0x5177('0x2a')](_0x231d35['stack']);if(_0x231d35[_0x5177('0x2b')]){delete _0x231d35[_0x5177('0x2b')];}_0x3285b3[_0x5177('0x1d')](_0x4eba3a)[_0x5177('0x2c')](_0x231d35);};}exports[_0x5177('0x2d')]=function(_0x1cef5d,_0x5577bb){var _0x498fcd={},_0x45cf20={},_0x1c660e={'count':0x0,'rows':[]};var _0x7dae59=_[_0x5177('0x2e')](db[_0x5177('0x2f')][_0x5177('0x30')],function(_0x31eb9f){return{'name':_0x31eb9f[_0x5177('0x31')],'type':_0x31eb9f['type'][_0x5177('0x32')]};});_0x45cf20[_0x5177('0x33')]=_['map'](_0x7dae59,_0x5177('0x2b'));_0x45cf20['query']=_[_0x5177('0x34')](_0x1cef5d[_0x5177('0x35')]);_0x45cf20[_0x5177('0x36')]=_['intersection'](_0x45cf20['model'],_0x45cf20[_0x5177('0x35')]);_0x498fcd[_0x5177('0x37')]=_[_0x5177('0x38')](_0x45cf20[_0x5177('0x33')],qs[_0x5177('0x39')](_0x1cef5d[_0x5177('0x35')][_0x5177('0x39')]));_0x498fcd[_0x5177('0x37')]=_0x498fcd['attributes'][_0x5177('0x3a')]?_0x498fcd[_0x5177('0x37')]:_0x45cf20['model'];if(!_0x1cef5d[_0x5177('0x35')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x498fcd[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x1cef5d[_0x5177('0x35')]['limit']);_0x498fcd[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x1cef5d[_0x5177('0x35')][_0x5177('0x20')]);}_0x498fcd[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x1cef5d[_0x5177('0x35')]['sort']);_0x498fcd[_0x5177('0x40')]=qs[_0x5177('0x36')](_['pick'](_0x1cef5d['query'],_0x45cf20[_0x5177('0x36')]),_0x7dae59);if(_0x1cef5d[_0x5177('0x35')][_0x5177('0x41')]){_0x498fcd[_0x5177('0x40')]=_[_0x5177('0x42')](_0x498fcd[_0x5177('0x40')],{'$or':_[_0x5177('0x2e')](_0x7dae59,function(_0x24fd92){if(_0x24fd92[_0x5177('0x43')]!==_0x5177('0x44')){var _0x16fabc={};_0x16fabc[_0x24fd92[_0x5177('0x2b')]]={'$like':'%'+_0x1cef5d[_0x5177('0x35')]['filter']+'%'};return _0x16fabc;}})});}_0x498fcd=_[_0x5177('0x42')]({},_0x498fcd,_0x1cef5d[_0x5177('0x45')]);var _0x4e3677={'where':_0x498fcd[_0x5177('0x40')]};return db['DeskField'][_0x5177('0x22')](_0x4e3677)[_0x5177('0x28')](function(_0x3f02f1){_0x1c660e['count']=_0x3f02f1;if(_0x1cef5d['query'][_0x5177('0x46')]){_0x498fcd[_0x5177('0x47')]=[{'all':!![]}];}return db[_0x5177('0x2f')][_0x5177('0x48')](_0x498fcd);})[_0x5177('0x28')](function(_0x3e710d){_0x1c660e[_0x5177('0x49')]=_0x3e710d;return _0x1c660e;})[_0x5177('0x28')](respondWithFilteredResult(_0x5577bb,_0x498fcd))['catch'](handleError(_0x5577bb,null));};exports[_0x5177('0x4a')]=function(_0x51ecc0,_0x5e3d30){var _0x30e4f3={'raw':!![],'where':{'id':_0x51ecc0['params']['id']}},_0x17dc98={};_0x17dc98[_0x5177('0x33')]=_['keys'](db['DeskField'][_0x5177('0x30')]);_0x17dc98[_0x5177('0x35')]=_[_0x5177('0x34')](_0x51ecc0[_0x5177('0x35')]);_0x17dc98[_0x5177('0x36')]=_[_0x5177('0x38')](_0x17dc98[_0x5177('0x33')],_0x17dc98['query']);_0x30e4f3['attributes']=_[_0x5177('0x38')](_0x17dc98['model'],qs[_0x5177('0x39')](_0x51ecc0[_0x5177('0x35')][_0x5177('0x39')]));_0x30e4f3[_0x5177('0x37')]=_0x30e4f3['attributes'][_0x5177('0x3a')]?_0x30e4f3[_0x5177('0x37')]:_0x17dc98[_0x5177('0x33')];if(_0x51ecc0[_0x5177('0x35')][_0x5177('0x46')]){_0x30e4f3[_0x5177('0x47')]=[{'all':!![]}];}_0x30e4f3=_[_0x5177('0x42')]({},_0x30e4f3,_0x51ecc0[_0x5177('0x45')]);return db[_0x5177('0x2f')][_0x5177('0x4b')](_0x30e4f3)[_0x5177('0x28')](handleEntityNotFound(_0x5e3d30,null))['then'](respondWithResult(_0x5e3d30,null))[_0x5177('0x4c')](handleError(_0x5e3d30,null));};exports['create']=function(_0x58a4e6,_0x5bda8a){return db[_0x5177('0x2f')][_0x5177('0x4d')](_0x58a4e6['body'],{})[_0x5177('0x28')](respondWithResult(_0x5bda8a,0xc9))[_0x5177('0x4c')](handleError(_0x5bda8a,null));};exports[_0x5177('0x4e')]=function(_0x4891fe,_0x1d4ae4){if(_0x4891fe['body']['id']){delete _0x4891fe['body']['id'];}return db['DeskField'][_0x5177('0x4b')]({'where':{'id':_0x4891fe[_0x5177('0x4f')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x1d4ae4,null))['then'](saveUpdates(_0x4891fe['body'],null))[_0x5177('0x28')](respondWithResult(_0x1d4ae4,null))['catch'](handleError(_0x1d4ae4,null));};exports[_0x5177('0x29')]=function(_0x9dd7a2,_0x430e8e){return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x9dd7a2[_0x5177('0x4f')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x430e8e,null))[_0x5177('0x28')](removeEntity(_0x430e8e,null))[_0x5177('0x4c')](handleError(_0x430e8e,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 904ab4f..e854110 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 _0xe277=['idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields'];(function(_0xae8fa0,_0xfc4874){var _0x4de436=function(_0x815c4){while(--_0x815c4){_0xae8fa0['push'](_0xae8fa0['shift']());}};_0x4de436(++_0xfc4874);}(_0xe277,0x14c));var _0x7e27=function(_0x402dd7,_0x32164c){_0x402dd7=_0x402dd7-0x0;var _0x5d14ba=_0xe277[_0x402dd7];return _0x5d14ba;};'use strict';var _=require(_0x7e27('0x0'));var util=require(_0x7e27('0x1'));var logger=require(_0x7e27('0x2'))(_0x7e27('0x3'));var moment=require('moment');var BPromise=require(_0x7e27('0x4'));var rp=require(_0x7e27('0x5'));var fs=require('fs');var path=require(_0x7e27('0x6'));var rimraf=require(_0x7e27('0x7'));var config=require(_0x7e27('0x8'));var attributes=require(_0x7e27('0x9'));module[_0x7e27('0xa')]=function(_0x289363,_0x34bd93){return _0x289363[_0x7e27('0xb')]('DeskField',attributes,{'tableName':_0x7e27('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x7e27('0xd'),_0x7e27('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9fb=['../../config/environment','exports','define','DeskField','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc35f72,_0x2b88b4){var _0x498249=function(_0x2d07e2){while(--_0x2d07e2){_0xc35f72['push'](_0xc35f72['shift']());}};_0x498249(++_0x2b88b4);}(_0xf9fb,0xd7));var _0xbf9f=function(_0x652c5a,_0x95cde5){_0x652c5a=_0x652c5a-0x0;var _0x4d5c3d=_0xf9fb[_0x652c5a];return _0x4d5c3d;};'use strict';var _=require(_0xbf9f('0x0'));var util=require(_0xbf9f('0x1'));var logger=require(_0xbf9f('0x2'))(_0xbf9f('0x3'));var moment=require(_0xbf9f('0x4'));var BPromise=require(_0xbf9f('0x5'));var rp=require(_0xbf9f('0x6'));var fs=require('fs');var path=require(_0xbf9f('0x7'));var rimraf=require(_0xbf9f('0x8'));var config=require(_0xbf9f('0x9'));var attributes=require('./intDeskField.attributes');module[_0xbf9f('0xa')]=function(_0x101920,_0x301e93){return _0x101920[_0xbf9f('0xb')](_0xbf9f('0xc'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xbf9f('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index a4d86d8..7077786 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 _0x3a9c=['../../config/logger','../../config/environment','client','http','request','then','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x11e9f9,_0x3cd4e2){var _0x14d5c1=function(_0x3e3551){while(--_0x3e3551){_0x11e9f9['push'](_0x11e9f9['shift']());}};_0x14d5c1(++_0x3cd4e2);}(_0x3a9c,0x19e));var _0xc3a9=function(_0x3eeafe,_0x2e0480){_0x3eeafe=_0x3eeafe-0x0;var _0x4f32ab=_0x3a9c[_0x3eeafe];return _0x4f32ab;};'use strict';var _=require(_0xc3a9('0x0'));var util=require('util');var moment=require(_0xc3a9('0x1'));var BPromise=require(_0xc3a9('0x2'));var rs=require(_0xc3a9('0x3'));var fs=require('fs');var Redis=require(_0xc3a9('0x4'));var db=require(_0xc3a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3a9('0x6'))('rpc');var config=require(_0xc3a9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc3a9('0x8')][_0xc3a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43bd8e,_0x2233b9,_0xc0c167){return new BPromise(function(_0x1f6d13,_0x468574){return client[_0xc3a9('0xa')](_0x43bd8e,_0xc0c167)[_0xc3a9('0xb')](function(_0x228595){logger['info'](_0xc3a9('0xc'),_0x2233b9,'request\x20sent');logger[_0xc3a9('0xd')](_0xc3a9('0xe'),_0x2233b9,'request\x20sent',JSON['stringify'](_0x228595));if(_0x228595['error']){if(_0x228595[_0xc3a9('0xf')][_0xc3a9('0x10')]===0x1f4){logger[_0xc3a9('0xf')](_0xc3a9('0xc'),_0x2233b9,_0x228595[_0xc3a9('0xf')][_0xc3a9('0x11')]);return _0x468574(_0x228595[_0xc3a9('0xf')][_0xc3a9('0x11')]);}logger['error'](_0xc3a9('0xc'),_0x2233b9,_0x228595[_0xc3a9('0xf')][_0xc3a9('0x11')]);return _0x1f6d13(_0x228595[_0xc3a9('0xf')][_0xc3a9('0x11')]);}else{logger['info'](_0xc3a9('0xc'),_0x2233b9,_0xc3a9('0x12'));_0x1f6d13(_0x228595['result'][_0xc3a9('0x11')]);}})[_0xc3a9('0x13')](function(_0x5e7101){logger['error']('DeskField,\x20%s,\x20%s',_0x2233b9,_0x5e7101);_0x468574(_0x5e7101);});});} \ No newline at end of file +var _0x3c4d=['error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x4dfaa3,_0x3fd354){var _0x1425e6=function(_0x23f2f2){while(--_0x23f2f2){_0x4dfaa3['push'](_0x4dfaa3['shift']());}};_0x1425e6(++_0x3fd354);}(_0x3c4d,0xbd));var _0xd3c4=function(_0x32f512,_0x89908c){_0x32f512=_0x32f512-0x0;var _0x48e9a0=_0x3c4d[_0x32f512];return _0x48e9a0;};'use strict';var _=require('lodash');var util=require(_0xd3c4('0x0'));var moment=require(_0xd3c4('0x1'));var BPromise=require(_0xd3c4('0x2'));var rs=require(_0xd3c4('0x3'));var fs=require('fs');var Redis=require(_0xd3c4('0x4'));var db=require(_0xd3c4('0x5'))['db'];var utils=require(_0xd3c4('0x6'));var logger=require(_0xd3c4('0x7'))(_0xd3c4('0x8'));var config=require(_0xd3c4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd3c4('0xa')][_0xd3c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a4f25,_0x3305ad,_0x3f9221){return new BPromise(function(_0xd421fd,_0x4f8922){return client[_0xd3c4('0xc')](_0x1a4f25,_0x3f9221)[_0xd3c4('0xd')](function(_0x57378a){logger['info'](_0xd3c4('0xe'),_0x3305ad,_0xd3c4('0xf'));logger[_0xd3c4('0x10')](_0xd3c4('0x11'),_0x3305ad,_0xd3c4('0xf'),JSON['stringify'](_0x57378a));if(_0x57378a[_0xd3c4('0x12')]){if(_0x57378a[_0xd3c4('0x12')][_0xd3c4('0x13')]===0x1f4){logger[_0xd3c4('0x12')]('DeskField,\x20%s,\x20%s',_0x3305ad,_0x57378a['error'][_0xd3c4('0x14')]);return _0x4f8922(_0x57378a[_0xd3c4('0x12')][_0xd3c4('0x14')]);}logger[_0xd3c4('0x12')](_0xd3c4('0xe'),_0x3305ad,_0x57378a['error'][_0xd3c4('0x14')]);return _0xd421fd(_0x57378a[_0xd3c4('0x12')][_0xd3c4('0x14')]);}else{logger[_0xd3c4('0x15')](_0xd3c4('0xe'),_0x3305ad,_0xd3c4('0xf'));_0xd421fd(_0x57378a['result']['message']);}})[_0xd3c4('0x16')](function(_0x3edda1){logger[_0xd3c4('0x12')](_0xd3c4('0xe'),_0x3305ad,_0x3edda1);_0x4f8922(_0x3edda1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4a5a26a..6b32044 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 _0x3f08=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x503768,_0x79abd4){var _0x172d44=function(_0x2aedb7){while(--_0x2aedb7){_0x503768['push'](_0x503768['shift']());}};_0x172d44(++_0x79abd4);}(_0x3f08,0x19e));var _0x83f0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3f08[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x83f0('0x0'));var util=require('util');var path=require(_0x83f0('0x1'));var timeout=require(_0x83f0('0x2'));var express=require(_0x83f0('0x3'));var router=express[_0x83f0('0x4')]();var fs_extra=require(_0x83f0('0x5'));var auth=require(_0x83f0('0x6'));var interaction=require(_0x83f0('0x7'));var config=require('../../config/environment');var controller=require(_0x83f0('0x8'));router[_0x83f0('0x9')]('/',auth[_0x83f0('0xa')](),controller[_0x83f0('0xb')]);router[_0x83f0('0x9')](_0x83f0('0xc'),auth[_0x83f0('0xa')](),controller[_0x83f0('0xd')]);router[_0x83f0('0x9')](_0x83f0('0xe'),auth[_0x83f0('0xa')](),controller[_0x83f0('0xf')]);router[_0x83f0('0x9')](_0x83f0('0x10'),auth[_0x83f0('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x83f0('0x11')](_0x83f0('0xe'),auth[_0x83f0('0xa')](),controller['addConfiguration']);router[_0x83f0('0x12')](_0x83f0('0xc'),auth[_0x83f0('0xa')](),controller['update']);router[_0x83f0('0x13')]('/:id',auth[_0x83f0('0xa')](),controller[_0x83f0('0x14')]);module[_0x83f0('0x15')]=router; \ No newline at end of file +var _0x12b0=['addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations'];(function(_0x2fba0c,_0x2cf2c0){var _0x263a96=function(_0x895beb){while(--_0x895beb){_0x2fba0c['push'](_0x2fba0c['shift']());}};_0x263a96(++_0x2cf2c0);}(_0x12b0,0x1d3));var _0x012b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x12b0[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x012b('0x0'));var util=require(_0x012b('0x1'));var path=require('path');var timeout=require(_0x012b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x012b('0x3'));var auth=require(_0x012b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x012b('0x5'));router[_0x012b('0x6')]('/',auth[_0x012b('0x7')](),controller[_0x012b('0x8')]);router[_0x012b('0x6')](_0x012b('0x9'),auth[_0x012b('0x7')](),controller[_0x012b('0xa')]);router[_0x012b('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x012b('0xb')]);router[_0x012b('0x6')](_0x012b('0xc'),auth[_0x012b('0x7')](),controller[_0x012b('0xd')]);router['post']('/',auth[_0x012b('0x7')](),controller['create']);router[_0x012b('0xe')](_0x012b('0xf'),auth['isAuthenticated'](),controller[_0x012b('0x10')]);router[_0x012b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x012b('0x12')]);router[_0x012b('0x13')](_0x012b('0x9'),auth[_0x012b('0x7')](),controller[_0x012b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 06f898e..6e643d6 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 _0x9a7e=['STRING'];(function(_0x1b4878,_0x4bd5e8){var _0x1829dc=function(_0x58400d){while(--_0x58400d){_0x1b4878['push'](_0x1b4878['shift']());}};_0x1829dc(++_0x4bd5e8);}(_0x9a7e,0x182));var _0xe9a7=function(_0x51d9b5,_0x58d302){_0x51d9b5=_0x51d9b5-0x0;var _0x5159fc=_0x9a7e[_0x51d9b5];return _0x5159fc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe9a7('0x0')]},'username':{'type':Sequelize[_0xe9a7('0x0')]},'password':{'type':Sequelize[_0xe9a7('0x0')]},'remoteUri':{'type':Sequelize[_0xe9a7('0x0')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe9a7('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb062=['STRING','exports'];(function(_0x4855fa,_0x490cf3){var _0x4b7a91=function(_0x456ec7){while(--_0x456ec7){_0x4855fa['push'](_0x4855fa['shift']());}};_0x4b7a91(++_0x490cf3);}(_0xb062,0x12d));var _0x2b06=function(_0x1b33f5,_0x228f05){_0x1b33f5=_0x1b33f5-0x0;var _0x10bd34=_0xb062[_0x1b33f5];return _0x10bd34;};'use strict';var Sequelize=require('sequelize');module[_0x2b06('0x0')]={'name':{'type':Sequelize[_0x2b06('0x1')]},'username':{'type':Sequelize[_0x2b06('0x1')]},'password':{'type':Sequelize[_0x2b06('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x2b06('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2b06('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d00652a..df638d4 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 _0x7f98=['phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','forEach','@odata.type','lastIndexOf','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','fields','includeAll','options','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','title','customerid','ownerid','caseorigincode','subject'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7f98,0x78));var _0x87f9=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x7f98[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0x87f9('0x0'));var rimraf=require(_0x87f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87f9('0x2'));var rp=require('request-promise');var moment=require(_0x87f9('0x3'));var BPromise=require(_0x87f9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x87f9('0x5'));var sox=require(_0x87f9('0x6'));var csv=require(_0x87f9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87f9('0x8'));var _=require(_0x87f9('0x9'));var squel=require(_0x87f9('0xa'));var crypto=require(_0x87f9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x87f9('0xc'));var toCsv=require(_0x87f9('0x7'));var querystring=require(_0x87f9('0xd'));var Papa=require(_0x87f9('0xe'));var Redis=require(_0x87f9('0xf'));var authService=require(_0x87f9('0x10'));var qs=require(_0x87f9('0x11'));var as=require(_0x87f9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x87f9('0x13'));var utils=require(_0x87f9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x87f9('0x15'));var db=require(_0x87f9('0x16'))['db'];var integrations=require(_0x87f9('0x17'));var jayson=require(_0x87f9('0x18'));var client=jayson['client'][_0x87f9('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2a183b,_0x36585a,_0x5ae7c4,_0x55ce9f){return new BPromise(function(_0x5dbdb3,_0x129aad){var _0x34510b=_0x55ce9f||client;return _0x34510b['request'](_0x2a183b,_0x5ae7c4)[_0x87f9('0x1a')](function(_0x14f2f0){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x36585a,_0x87f9('0x1b'));logger[_0x87f9('0x1c')](_0x87f9('0x1d'),_0x36585a,'request\x20sent',JSON[_0x87f9('0x1e')](_0x14f2f0));if(_0x14f2f0[_0x87f9('0x1f')]){if(_0x14f2f0['error'][_0x87f9('0x20')]===0x1f4){logger[_0x87f9('0x1f')](_0x87f9('0x21'),_0x36585a,_0x14f2f0[_0x87f9('0x1f')]['message']);return _0x129aad(_0x14f2f0[_0x87f9('0x1f')][_0x87f9('0x22')]);}logger[_0x87f9('0x1f')](_0x87f9('0x21'),_0x36585a,_0x14f2f0[_0x87f9('0x1f')][_0x87f9('0x22')]);return _0x5dbdb3(_0x14f2f0[_0x87f9('0x1f')]['message']);}else{logger['info'](_0x87f9('0x21'),_0x36585a,_0x87f9('0x1b'));_0x5dbdb3(_0x14f2f0[_0x87f9('0x23')][_0x87f9('0x22')]);}})[_0x87f9('0x24')](function(_0x4105f6){logger['error'](_0x87f9('0x21'),_0x36585a,_0x4105f6);_0x129aad(_0x4105f6);});});}function respondWithStatusCode(_0x368ac5,_0x25f737){_0x25f737=_0x25f737||0xcc;return function(_0x2bde82){if(_0x2bde82){return _0x368ac5[_0x87f9('0x25')](_0x25f737);}return _0x368ac5[_0x87f9('0x26')](_0x25f737)['end']();};}function respondWithResult(_0x52242a,_0x3d8b47){_0x3d8b47=_0x3d8b47||0xc8;return function(_0x464a01){if(_0x464a01){return _0x52242a[_0x87f9('0x26')](_0x3d8b47)[_0x87f9('0x27')](_0x464a01);}};}function respondWithFilteredResult(_0x59eddb,_0x18de3c){return function(_0x1747b0){if(_0x1747b0){var _0x8733b7=typeof _0x18de3c[_0x87f9('0x28')]===_0x87f9('0x29')&&typeof _0x18de3c[_0x87f9('0x2a')]==='undefined';var _0x3b2388=_0x1747b0[_0x87f9('0x2b')];var _0x1af065=_0x8733b7?0x0:_0x18de3c[_0x87f9('0x28')];var _0x59774b=_0x8733b7?_0x1747b0[_0x87f9('0x2b')]:_0x18de3c['offset']+_0x18de3c['limit'];var _0x3e9b24;if(_0x59774b>=_0x3b2388){_0x59774b=_0x3b2388;_0x3e9b24=0xc8;}else{_0x3e9b24=0xce;}_0x59eddb[_0x87f9('0x26')](_0x3e9b24);return _0x59eddb['set']('Content-Range',_0x1af065+'-'+_0x59774b+'/'+_0x3b2388)[_0x87f9('0x27')](_0x1747b0);}return null;};}function patchUpdates(_0xe8655c){return function(_0x28ef59){try{jsonpatch[_0x87f9('0x2c')](_0x28ef59,_0xe8655c,!![]);}catch(_0x53d735){return BPromise[_0x87f9('0x2d')](_0x53d735);}return _0x28ef59[_0x87f9('0x2e')]();};}function saveUpdates(_0x172ab8,_0x392588){return function(_0x2f9efb){if(_0x2f9efb){return _0x2f9efb[_0x87f9('0x2f')](_0x172ab8)[_0x87f9('0x1a')](function(_0x38c1aa){return _0x38c1aa;});}return null;};}function removeEntity(_0x382421,_0x4fdb4d){return function(_0x5684e0){if(_0x5684e0){return _0x5684e0[_0x87f9('0x30')]()[_0x87f9('0x1a')](function(){_0x382421['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9888,_0x31832b){return function(_0x3d0f59){if(!_0x3d0f59){_0x2e9888[_0x87f9('0x25')](0x194);}return _0x3d0f59;};}function handleError(_0x7e72a7,_0x44fa5e){_0x44fa5e=_0x44fa5e||0x1f4;return function(_0x13fd4a){logger[_0x87f9('0x1f')](_0x13fd4a[_0x87f9('0x31')]);if(_0x13fd4a[_0x87f9('0x32')]){delete _0x13fd4a['name'];}_0x7e72a7[_0x87f9('0x26')](_0x44fa5e)['send'](_0x13fd4a);};}exports[_0x87f9('0x33')]=function(_0x7234f9,_0x4245e5){var _0x5ea1f6={},_0x565c62={},_0x49cef4={'count':0x0,'rows':[]};var _0x1f8ad9=_[_0x87f9('0x34')](db[_0x87f9('0x35')][_0x87f9('0x36')],function(_0x4207e9){return{'name':_0x4207e9[_0x87f9('0x37')],'type':_0x4207e9[_0x87f9('0x38')][_0x87f9('0x39')]};});_0x565c62[_0x87f9('0x3a')]=_[_0x87f9('0x34')](_0x1f8ad9,_0x87f9('0x32'));_0x565c62[_0x87f9('0x3b')]=_[_0x87f9('0x3c')](_0x7234f9[_0x87f9('0x3b')]);_0x565c62[_0x87f9('0x3d')]=_[_0x87f9('0x3e')](_0x565c62[_0x87f9('0x3a')],_0x565c62[_0x87f9('0x3b')]);_0x5ea1f6['attributes']=_[_0x87f9('0x3e')](_0x565c62[_0x87f9('0x3a')],qs['fields'](_0x7234f9['query']['fields']));_0x5ea1f6[_0x87f9('0x3f')]=_0x5ea1f6['attributes'][_0x87f9('0x40')]?_0x5ea1f6[_0x87f9('0x3f')]:_0x565c62[_0x87f9('0x3a')];if(!_0x7234f9[_0x87f9('0x3b')][_0x87f9('0x41')]('nolimit')){_0x5ea1f6['limit']=qs[_0x87f9('0x2a')](_0x7234f9['query']['limit']);_0x5ea1f6['offset']=qs[_0x87f9('0x28')](_0x7234f9[_0x87f9('0x3b')][_0x87f9('0x28')]);}_0x5ea1f6[_0x87f9('0x42')]=qs['sort'](_0x7234f9[_0x87f9('0x3b')][_0x87f9('0x43')]);_0x5ea1f6[_0x87f9('0x44')]=qs[_0x87f9('0x3d')](_[_0x87f9('0x45')](_0x7234f9[_0x87f9('0x3b')],_0x565c62[_0x87f9('0x3d')]),_0x1f8ad9);if(_0x7234f9['query'][_0x87f9('0x46')]){_0x5ea1f6[_0x87f9('0x44')]=_[_0x87f9('0x47')](_0x5ea1f6[_0x87f9('0x44')],{'$or':_['map'](_0x1f8ad9,function(_0x31d9ce){if(_0x31d9ce[_0x87f9('0x38')]!==_0x87f9('0x48')){var _0x4fd0f8={};_0x4fd0f8[_0x31d9ce['name']]={'$like':'%'+_0x7234f9[_0x87f9('0x3b')][_0x87f9('0x46')]+'%'};return _0x4fd0f8;}})});}_0x5ea1f6=_[_0x87f9('0x47')]({},_0x5ea1f6,_0x7234f9['options']);var _0x41620e={'where':_0x5ea1f6[_0x87f9('0x44')]};return db['Dynamics365Account']['count'](_0x41620e)['then'](function(_0x53af7f){_0x49cef4[_0x87f9('0x2b')]=_0x53af7f;if(_0x7234f9[_0x87f9('0x3b')]['includeAll']){_0x5ea1f6[_0x87f9('0x49')]=[{'all':!![]}];}return db[_0x87f9('0x35')][_0x87f9('0x4a')](_0x5ea1f6);})['then'](function(_0x1fffa3){_0x49cef4[_0x87f9('0x4b')]=_0x1fffa3;return _0x49cef4;})[_0x87f9('0x1a')](respondWithFilteredResult(_0x4245e5,_0x5ea1f6))['catch'](handleError(_0x4245e5,null));};exports[_0x87f9('0x4c')]=function(_0x441a85,_0x29f4c8){var _0x32847b={'raw':![],'where':{'id':_0x441a85['params']['id']}},_0xaf6b50={};_0xaf6b50[_0x87f9('0x3a')]=_[_0x87f9('0x3c')](db[_0x87f9('0x35')][_0x87f9('0x36')]);_0xaf6b50[_0x87f9('0x3b')]=_[_0x87f9('0x3c')](_0x441a85[_0x87f9('0x3b')]);_0xaf6b50[_0x87f9('0x3d')]=_[_0x87f9('0x3e')](_0xaf6b50['model'],_0xaf6b50[_0x87f9('0x3b')]);_0x32847b[_0x87f9('0x3f')]=_[_0x87f9('0x3e')](_0xaf6b50[_0x87f9('0x3a')],qs[_0x87f9('0x4d')](_0x441a85[_0x87f9('0x3b')][_0x87f9('0x4d')]));_0x32847b[_0x87f9('0x3f')]=_0x32847b['attributes'][_0x87f9('0x40')]?_0x32847b[_0x87f9('0x3f')]:_0xaf6b50['model'];if(_0x441a85[_0x87f9('0x3b')][_0x87f9('0x4e')]){_0x32847b[_0x87f9('0x49')]=[{'all':!![]}];}_0x32847b=_[_0x87f9('0x47')]({},_0x32847b,_0x441a85[_0x87f9('0x4f')]);return db['Dynamics365Account'][_0x87f9('0x50')](_0x32847b)[_0x87f9('0x1a')](handleEntityNotFound(_0x29f4c8,null))[_0x87f9('0x1a')](respondWithResult(_0x29f4c8,null))[_0x87f9('0x24')](handleError(_0x29f4c8,null));};exports[_0x87f9('0x51')]=function(_0x12d857,_0x5c02cc){return db[_0x87f9('0x35')][_0x87f9('0x51')](_0x12d857[_0x87f9('0x52')],{})[_0x87f9('0x1a')](respondWithResult(_0x5c02cc,0xc9))[_0x87f9('0x24')](handleError(_0x5c02cc,null));};exports['update']=function(_0x120fc6,_0xc30875){if(_0x120fc6['body']['id']){delete _0x120fc6[_0x87f9('0x52')]['id'];}return db[_0x87f9('0x35')]['find']({'where':{'id':_0x120fc6[_0x87f9('0x53')]['id']}})[_0x87f9('0x1a')](handleEntityNotFound(_0xc30875,null))[_0x87f9('0x1a')](saveUpdates(_0x120fc6[_0x87f9('0x52')],null))[_0x87f9('0x1a')](respondWithResult(_0xc30875,null))[_0x87f9('0x24')](handleError(_0xc30875,null));};exports[_0x87f9('0x30')]=function(_0x47592b,_0x23a0bc){return db[_0x87f9('0x35')][_0x87f9('0x50')]({'where':{'id':_0x47592b[_0x87f9('0x53')]['id']}})['then'](handleEntityNotFound(_0x23a0bc,null))['then'](removeEntity(_0x23a0bc,null))[_0x87f9('0x24')](handleError(_0x23a0bc,null));};exports[_0x87f9('0x54')]=function(_0x520780,_0x4f5780,_0x5238fb){var _0x2d9f73={};var _0x56ff65={};var _0x5a48ef;var _0x54a994;return db[_0x87f9('0x35')][_0x87f9('0x55')]({'where':{'id':_0x520780['params']['id']}})[_0x87f9('0x1a')](handleEntityNotFound(_0x4f5780,null))[_0x87f9('0x1a')](function(_0x1cf3b7){if(_0x1cf3b7){_0x5a48ef=_0x1cf3b7;_0x56ff65[_0x87f9('0x3a')]=_[_0x87f9('0x3c')](db[_0x87f9('0x56')][_0x87f9('0x36')]);_0x56ff65['query']=_['keys'](_0x520780['query']);_0x56ff65[_0x87f9('0x3d')]=_[_0x87f9('0x3e')](_0x56ff65['model'],_0x56ff65[_0x87f9('0x3b')]);_0x2d9f73[_0x87f9('0x3f')]=_[_0x87f9('0x3e')](_0x56ff65[_0x87f9('0x3a')],qs[_0x87f9('0x4d')](_0x520780[_0x87f9('0x3b')][_0x87f9('0x4d')]));_0x2d9f73['attributes']=_0x2d9f73[_0x87f9('0x3f')][_0x87f9('0x40')]?_0x2d9f73[_0x87f9('0x3f')]:_0x56ff65[_0x87f9('0x3a')];_0x2d9f73['order']=qs[_0x87f9('0x43')](_0x520780[_0x87f9('0x3b')]['sort']);_0x2d9f73[_0x87f9('0x44')]=qs[_0x87f9('0x3d')](_[_0x87f9('0x45')](_0x520780['query'],_0x56ff65[_0x87f9('0x3d')]));if(_0x520780[_0x87f9('0x3b')][_0x87f9('0x46')]){_0x2d9f73[_0x87f9('0x44')]=_[_0x87f9('0x47')](_0x2d9f73[_0x87f9('0x44')],{'$or':_[_0x87f9('0x34')](_0x2d9f73[_0x87f9('0x3f')],function(_0x3222d5){var _0x3be9c3={};_0x3be9c3[_0x3222d5]={'$like':'%'+_0x520780[_0x87f9('0x3b')][_0x87f9('0x46')]+'%'};return _0x3be9c3;})});}_0x2d9f73=_[_0x87f9('0x47')]({},_0x2d9f73,_0x520780[_0x87f9('0x4f')]);return _0x5a48ef[_0x87f9('0x54')](_0x2d9f73);}})[_0x87f9('0x1a')](function(_0x3fc800){if(_0x3fc800){_0x54a994=_0x3fc800[_0x87f9('0x40')];if(!_0x520780[_0x87f9('0x3b')][_0x87f9('0x41')](_0x87f9('0x57'))){_0x2d9f73[_0x87f9('0x2a')]=qs[_0x87f9('0x2a')](_0x520780[_0x87f9('0x3b')][_0x87f9('0x2a')]);_0x2d9f73[_0x87f9('0x28')]=qs[_0x87f9('0x28')](_0x520780['query']['offset']);}return _0x5a48ef[_0x87f9('0x54')](_0x2d9f73);}})[_0x87f9('0x1a')](function(_0xd16103){if(_0xd16103){return _0xd16103?{'count':_0x54a994,'rows':_0xd16103}:null;}})[_0x87f9('0x1a')](respondWithResult(_0x4f5780,null))['catch'](handleError(_0x4f5780,null));};exports['addConfiguration']=function(_0x9167b8,_0x1b2a36,_0x630fb){if(_0x9167b8[_0x87f9('0x52')]['id']){delete _0x9167b8[_0x87f9('0x52')]['id'];}return db[_0x87f9('0x35')][_0x87f9('0x55')]({'where':{'id':_0x9167b8[_0x87f9('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b2a36,null))['then'](function(_0x37a996){if(_0x37a996){_0x9167b8[_0x87f9('0x52')][_0x87f9('0x58')]=_0x37a996['id'];_0x9167b8[_0x87f9('0x52')][_0x87f9('0x59')]=integrations[_0x87f9('0x5a')](_0x9167b8['body'][_0x87f9('0x5b')],_0x9167b8['body'][_0x87f9('0x38')]);_0x9167b8[_0x87f9('0x52')][_0x87f9('0x5c')]=integrations[_0x87f9('0x5d')](_0x9167b8[_0x87f9('0x52')]['channel'],_0x9167b8[_0x87f9('0x52')][_0x87f9('0x38')]);return db[_0x87f9('0x56')][_0x87f9('0x51')](_0x9167b8[_0x87f9('0x52')],{'include':[{'model':db[_0x87f9('0x5e')],'as':_0x87f9('0x59')},{'model':db[_0x87f9('0x5e')],'as':_0x87f9('0x5c')}]});}return null;})['then'](respondWithResult(_0x1b2a36,null))['catch'](handleError(_0x1b2a36,null));};exports[_0x87f9('0x5f')]=function(_0x14bf17,_0x1c569a,_0x367dcd){var _0x345362=_0x14bf17[_0x87f9('0x3b')][_0x87f9('0x60')];var _0x56b163=_0x345362===_0x87f9('0x61')?'Incident':'PhoneCall';var _0x21ba5f='';var _0x2bb796='';var _0xc76d5a='';var _0x45490d='';var _0x775cb3='';var _0x3f5614='';var _0x55b04e='';var _0x5664e2='';var _0x3e0912=[_0x87f9('0x62'),'description',_0x87f9('0x63'),_0x87f9('0x64'),_0x87f9('0x65'),_0x87f9('0x66'),_0x87f9('0x67'),_0x87f9('0x68'),_0x87f9('0x69'),_0x87f9('0x6a')];var _0x148241=['accountidname',_0x87f9('0x6b'),_0x87f9('0x6c'),_0x87f9('0x6d'),'contactidname',_0x87f9('0x6e'),_0x87f9('0x6f'),_0x87f9('0x70'),'createdbyexternalpartyname',_0x87f9('0x71'),_0x87f9('0x72'),_0x87f9('0x73'),_0x87f9('0x74'),_0x87f9('0x75'),_0x87f9('0x76'),'customeridname',_0x87f9('0x77'),_0x87f9('0x78'),_0x87f9('0x79'),_0x87f9('0x7a'),_0x87f9('0x7b'),_0x87f9('0x7c'),_0x87f9('0x7d'),'exchangerate',_0x87f9('0x7e'),_0x87f9('0x7f'),'importsequencenumber',_0x87f9('0x80'),'kbarticleidname',_0x87f9('0x81'),_0x87f9('0x82'),_0x87f9('0x83'),_0x87f9('0x84'),_0x87f9('0x85'),_0x87f9('0x86'),_0x87f9('0x87'),_0x87f9('0x88'),_0x87f9('0x89'),_0x87f9('0x8a'),_0x87f9('0x8b'),_0x87f9('0x8c'),_0x87f9('0x8d'),_0x87f9('0x8e'),_0x87f9('0x8f'),'owneridtype',_0x87f9('0x90'),_0x87f9('0x91'),_0x87f9('0x92'),'primarycontactidyominame','prioritycodename',_0x87f9('0x93'),_0x87f9('0x94'),_0x87f9('0x95'),_0x87f9('0x96'),_0x87f9('0x97'),_0x87f9('0x98'),_0x87f9('0x99'),_0x87f9('0x9a'),_0x87f9('0x9b'),'slaname',_0x87f9('0x9c'),_0x87f9('0x9d'),_0x87f9('0x9e'),_0x87f9('0x9f'),_0x87f9('0xa0'),_0x87f9('0xa1'),_0x87f9('0xa2'),_0x87f9('0xa3'),'utcconversiontimezonecode',_0x87f9('0xa4')];var _0x3a43ea=_0x3e0912[_0x87f9('0xa5')](_0x148241);return db[_0x87f9('0x35')][_0x87f9('0x55')]({'where':{'id':_0x14bf17[_0x87f9('0x53')]['id']},'attributes':['id',_0x87f9('0xa6'),'password',_0x87f9('0xa7'),_0x87f9('0xa8'),_0x87f9('0xa9'),_0x87f9('0xaa')]})[_0x87f9('0x1a')](handleEntityNotFound(_0x1c569a,null))[_0x87f9('0x1a')](function(_0x4be695){if(_0x4be695){_0x5664e2=_0x4be695[_0x87f9('0xa7')];var _0x1e38ee=_0x5664e2['slice'](-0x1);if(_0x1e38ee==='/'){_0x5664e2=_0x5664e2[_0x87f9('0xab')](0x0,_0x5664e2['lastIndexOf'](_0x1e38ee));}_0x55b04e=util[_0x87f9('0xac')](_0x87f9('0xad'),_0x5664e2);var _0x1a6022={'method':_0x87f9('0xae'),'uri':_0x87f9('0xaf')+_0x4be695['tenantId']+_0x87f9('0xb0'),'form':{'client_id':_0x4be695[_0x87f9('0xa9')],'resource':_0x5664e2,'username':_0x4be695[_0x87f9('0xa6')],'password':_0x4be695[_0x87f9('0xb1')],'grant_type':_0x87f9('0xb1'),'client_secret':_0x4be695[_0x87f9('0xaa')]},'json':!![]};return rp(_0x1a6022);}})['then'](function(_0x380e24){_0x3f5614=_0x380e24[_0x87f9('0xb2')];var _0x14a30b={'method':'GET','uri':encodeURI(_0x55b04e+_0x87f9('0xb3')+_0x56b163+'\x27'),'headers':{'Authorization':_0x87f9('0xb4')+_0x3f5614,'If-None-Match':null,'OData-Version':_0x87f9('0xb5')},'json':!![]};return rp(_0x14a30b);})[_0x87f9('0x1a')](function(_0x4e552e){var _0x5c1978=_0x4e552e[_0x87f9('0xb6')][0x0];var _0x31a18a=_0x5c1978[_0x87f9('0xb7')];var _0x3dc5f9={'method':_0x87f9('0xb8'),'uri':_0x55b04e+_0x87f9('0xb9')+_0x31a18a+_0x87f9('0xba'),'headers':{'Authorization':_0x87f9('0xb4')+_0x3f5614,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3dc5f9);})['then'](function(_0x2b0c43){_0x21ba5f=_0x2b0c43;_0x2bb796=_0x21ba5f['Attributes'];_0x2bb796=_[_0x87f9('0xbb')](_0x2bb796,function(_0x5ce1e4){return!_0x3a43ea[_0x87f9('0xbc')](_0x5ce1e4['LogicalName']);});var _0x2749f8=[];var _0x25cf91=[];_0x2bb796[_0x87f9('0xbd')](function(_0x510687){if(_0x510687[_0x87f9('0xbe')]){var _0x142e94=_0x510687[_0x87f9('0xbe')][_0x87f9('0xab')](_0x510687['@odata.type'][_0x87f9('0xbf')]('.')+0x1);if(_0x142e94==='PicklistAttributeMetadata'){_0x2749f8[_0x87f9('0xc0')](getSelectList(_0x55b04e,_0x345362,_0x25cf91,_0x21ba5f[_0x87f9('0xb7')],_0x510687[_0x87f9('0xb7')],_0x3f5614));}}});return Promise[_0x87f9('0xc1')](_0x2749f8);})[_0x87f9('0x1a')](function(_0x54a269){_0xc76d5a=_0x54a269[0x0];var _0x15b34d=[];var _0x12e320=[];_0x2bb796['forEach'](function(_0x1e79b6){if(!_[_0x87f9('0xc2')](_0x1e79b6['@odata.type'])){var _0x27510f=_0x1e79b6[_0x87f9('0xbe')]['substring'](_0x1e79b6[_0x87f9('0xbe')][_0x87f9('0xbf')]('.')+0x1);if(_0x27510f===_0x87f9('0xc3')){_0x15b34d[_0x87f9('0xc0')](getBooleanList(_0x55b04e,_0x345362,_0x12e320,_0x21ba5f[_0x87f9('0xb7')],_0x1e79b6[_0x87f9('0xb7')],_0x3f5614));}}});return Promise[_0x87f9('0xc1')](_0x15b34d);})['then'](function(_0x15d0a2){_0x45490d=_0x15d0a2[0x0];var _0x58bb05=[];var _0x1ab4d7=[];_0x2bb796[_0x87f9('0xbd')](function(_0x467099){if(_0x467099[_0x87f9('0xbe')]){var _0x50bd11=_0x467099['@odata.type'][_0x87f9('0xab')](_0x467099[_0x87f9('0xbe')][_0x87f9('0xbf')]('.')+0x1);if(_0x50bd11===_0x87f9('0xc4')||_0x50bd11===_0x87f9('0xc5')||_0x50bd11===_0x87f9('0xc6')||_0x50bd11===_0x87f9('0xc7')||_0x50bd11===_0x87f9('0xc8')||_0x50bd11===_0x87f9('0xc9')||_0x50bd11===_0x87f9('0xca')||_0x50bd11===_0x87f9('0xcb')||_0x50bd11===_0x87f9('0xcc')||_0x50bd11===_0x87f9('0xcd')){_0x58bb05[_0x87f9('0xc0')](getInputList(_0x55b04e,_0x345362,_0x50bd11,_0x1ab4d7,_0x21ba5f['MetadataId'],_0x467099[_0x87f9('0xb7')],_0x3f5614));}}});return Promise[_0x87f9('0xc1')](_0x58bb05);})[_0x87f9('0x1a')](function(_0x1c6032){_0x775cb3=_0x1c6032[0x0];var _0x39a400=_0xc76d5a[_0x87f9('0xa5')](_0x45490d)[_0x87f9('0xa5')](_0x775cb3);var _0x4b9519={'count':_0x39a400[_0x87f9('0x40')],'rows':_0x39a400};return _0x4b9519;})[_0x87f9('0x1a')](respondWithResult(_0x1c569a,null))[_0x87f9('0x24')](function(_0x245f2d){var _0x3839ba=_0x14bf17['query'][_0x87f9('0xce')]?0x1f4:_0x245f2d['statusCode']||0x1f4;logger['error'](_0x245f2d[_0x87f9('0x31')]);delete _0x245f2d[_0x87f9('0x32')];if(_0x3839ba===0x191){_0x3839ba=0x190;}_0x1c569a[_0x87f9('0x26')](_0x3839ba)['send'](_0x14bf17[_0x87f9('0x3b')][_0x87f9('0xce')]?{'message':_0x87f9('0xcf'),'statusCode':_0x245f2d[_0x87f9('0xd0')]}:_0x245f2d);});};function getSelectList(_0x5aa65c,_0x349a7d,_0x17fbaa,_0xf2fe41,_0x42203a,_0x1c8bf9){var _0x309eb5={'method':'GET','uri':_0x5aa65c+'EntityDefinitions('+_0xf2fe41+_0x87f9('0xd1')+_0x42203a+_0x87f9('0xd2')+_0x87f9('0xd3'),'headers':{'Authorization':_0x87f9('0xb4')+_0x1c8bf9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x309eb5)[_0x87f9('0x1a')](function(_0x3e3a67){var _0x2870e6=[];var _0x147927=_0x3e3a67[_0x87f9('0xd4')][_0x87f9('0xd5')];_0x147927[_0x87f9('0xbd')](function(_0x57d15a){_0x2870e6['push']({'name':_0x57d15a[_0x87f9('0xd6')][_0x87f9('0xd7')][_0x87f9('0xd6')],'value':String(_0x57d15a[_0x87f9('0xd8')])});});var _0x110238={'id':_0x349a7d+'_'+_0x3e3a67[_0x87f9('0xd9')],'name':_0x3e3a67[_0x87f9('0xda')][_0x87f9('0xd7')][_0x87f9('0xd6')],'custom':![],'options':_0x2870e6};_0x17fbaa['push'](_0x110238);return _0x17fbaa;});}function getBooleanList(_0x239cb4,_0x5ba0e9,_0x2de950,_0x4f1743,_0x171313,_0x5823c5){var _0x3b6430={'method':_0x87f9('0xb8'),'uri':_0x239cb4+_0x87f9('0xb9')+_0x4f1743+_0x87f9('0xd1')+_0x171313+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x87f9('0xb4')+_0x5823c5,'If-None-Match':null,'OData-Version':_0x87f9('0xb5')},'json':!![]};return rp(_0x3b6430)[_0x87f9('0x1a')](function(_0x246580){var _0xb08912=[];_0xb08912['push']({'name':_0x246580['OptionSet'][_0x87f9('0xdb')][_0x87f9('0xd6')]['UserLocalizedLabel'][_0x87f9('0xd6')],'value':_0x87f9('0xdc')},{'name':_0x246580[_0x87f9('0xd4')][_0x87f9('0xdd')][_0x87f9('0xd6')][_0x87f9('0xd7')][_0x87f9('0xd6')],'value':'false'});var _0xd7f11f={'id':_0x5ba0e9+'_'+_0x246580[_0x87f9('0xd9')],'name':_0x246580[_0x87f9('0xda')][_0x87f9('0xd7')][_0x87f9('0xd6')],'custom':![],'options':_0xb08912};_0x2de950[_0x87f9('0xc0')](_0xd7f11f);return _0x2de950;});}function getInputList(_0xc43bd6,_0xa466c2,_0x5e7b31,_0x48fd42,_0x2c1306,_0x5e1a0d,_0x2e34e4){var _0x6e2a9={'method':_0x87f9('0xb8'),'uri':_0xc43bd6+_0x87f9('0xb9')+_0x2c1306+')/Attributes('+_0x5e1a0d+')/Microsoft.Dynamics.CRM.'+_0x5e7b31+_0x87f9('0xde'),'headers':{'Authorization':_0x87f9('0xb4')+_0x2e34e4,'If-None-Match':null,'OData-Version':_0x87f9('0xb5')},'json':!![]};return rp(_0x6e2a9)[_0x87f9('0x1a')](function(_0x2c5923){var _0x540578={'id':_0xa466c2+'_'+_0x2c5923[_0x87f9('0xd9')],'name':_0x2c5923[_0x87f9('0xda')][_0x87f9('0xd7')]?_0x2c5923['DisplayName'][_0x87f9('0xd7')][_0x87f9('0xd6')]:_0x2c5923[_0x87f9('0xd9')],'custom':![],'options':[]};_0x48fd42[_0x87f9('0xc0')](_0x540578);return _0x48fd42;});} \ No newline at end of file +var _0x3887=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','result','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','destroy','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','sort','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','ticketType','PhoneCall','title','description','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','findOne','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','?$select=DisplayName,LogicalName','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0xa762c9,_0x42752f){var _0x4ff075=function(_0x39c62a){while(--_0x39c62a){_0xa762c9['push'](_0xa762c9['shift']());}};_0x4ff075(++_0x42752f);}(_0x3887,0xca));var _0x7388=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x3887[_0x33593e];return _0x53db1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7388('0x0'));var zipdir=require(_0x7388('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7388('0x2'));var moment=require(_0x7388('0x3'));var BPromise=require(_0x7388('0x4'));var Mustache=require(_0x7388('0x5'));var util=require(_0x7388('0x6'));var path=require(_0x7388('0x7'));var sox=require(_0x7388('0x8'));var csv=require(_0x7388('0x9'));var ejs=require(_0x7388('0xa'));var fs=require('fs');var fs_extra=require(_0x7388('0xb'));var _=require('lodash');var squel=require(_0x7388('0xc'));var crypto=require(_0x7388('0xd'));var jsforce=require(_0x7388('0xe'));var deskjs=require(_0x7388('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7388('0x10'));var Papa=require('papaparse');var Redis=require(_0x7388('0x11'));var authService=require(_0x7388('0x12'));var qs=require(_0x7388('0x13'));var as=require(_0x7388('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7388('0x15'))('api');var utils=require(_0x7388('0x16'));var config=require(_0x7388('0x17'));var licenseUtil=require(_0x7388('0x18'));var db=require(_0x7388('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7388('0x1a'));var client=jayson['client'][_0x7388('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x51cec9,_0xfbffca,_0x23ff79,_0x4c3e95){return new BPromise(function(_0x18069a,_0x570f09){var _0x4e6f52=_0x4c3e95||client;return _0x4e6f52[_0x7388('0x1c')](_0x51cec9,_0x23ff79)[_0x7388('0x1d')](function(_0x85b2b4){logger[_0x7388('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0xfbffca,'request\x20sent');logger[_0x7388('0x1f')](_0x7388('0x20'),_0xfbffca,'request\x20sent',JSON['stringify'](_0x85b2b4));if(_0x85b2b4[_0x7388('0x21')]){if(_0x85b2b4[_0x7388('0x21')][_0x7388('0x22')]===0x1f4){logger[_0x7388('0x21')](_0x7388('0x23'),_0xfbffca,_0x85b2b4[_0x7388('0x21')][_0x7388('0x24')]);return _0x570f09(_0x85b2b4[_0x7388('0x21')]['message']);}logger[_0x7388('0x21')](_0x7388('0x23'),_0xfbffca,_0x85b2b4[_0x7388('0x21')][_0x7388('0x24')]);return _0x18069a(_0x85b2b4[_0x7388('0x21')]['message']);}else{logger[_0x7388('0x1e')](_0x7388('0x23'),_0xfbffca,_0x7388('0x25'));_0x18069a(_0x85b2b4[_0x7388('0x26')][_0x7388('0x24')]);}})['catch'](function(_0x345251){logger[_0x7388('0x21')](_0x7388('0x23'),_0xfbffca,_0x345251);_0x570f09(_0x345251);});});}function respondWithStatusCode(_0x15f2ea,_0x198695){_0x198695=_0x198695||0xcc;return function(_0x5cf944){if(_0x5cf944){return _0x15f2ea['sendStatus'](_0x198695);}return _0x15f2ea['status'](_0x198695)[_0x7388('0x27')]();};}function respondWithResult(_0x2e5b3c,_0x266c34){_0x266c34=_0x266c34||0xc8;return function(_0x3ab3f1){if(_0x3ab3f1){return _0x2e5b3c[_0x7388('0x28')](_0x266c34)[_0x7388('0x29')](_0x3ab3f1);}};}function respondWithFilteredResult(_0x55166a,_0x5e6f1b){return function(_0x1cf09a){if(_0x1cf09a){var _0x4f33f4=typeof _0x5e6f1b['offset']==='undefined'&&typeof _0x5e6f1b[_0x7388('0x2a')]===_0x7388('0x2b');var _0x237788=_0x1cf09a['count'];var _0x422cb2=_0x4f33f4?0x0:_0x5e6f1b['offset'];var _0x5af8d9=_0x4f33f4?_0x1cf09a[_0x7388('0x2c')]:_0x5e6f1b[_0x7388('0x2d')]+_0x5e6f1b['limit'];var _0x2102dd;if(_0x5af8d9>=_0x237788){_0x5af8d9=_0x237788;_0x2102dd=0xc8;}else{_0x2102dd=0xce;}_0x55166a[_0x7388('0x28')](_0x2102dd);return _0x55166a[_0x7388('0x2e')](_0x7388('0x2f'),_0x422cb2+'-'+_0x5af8d9+'/'+_0x237788)[_0x7388('0x29')](_0x1cf09a);}return null;};}function patchUpdates(_0x1853dd){return function(_0x2ac562){try{jsonpatch[_0x7388('0x30')](_0x2ac562,_0x1853dd,!![]);}catch(_0xbc5c51){return BPromise['reject'](_0xbc5c51);}return _0x2ac562['save']();};}function saveUpdates(_0x48421a,_0xc3554d){return function(_0x4109dc){if(_0x4109dc){return _0x4109dc[_0x7388('0x31')](_0x48421a)[_0x7388('0x1d')](function(_0x3d3ec7){return _0x3d3ec7;});}return null;};}function removeEntity(_0x50473a,_0x4a1a1f){return function(_0xa1ee84){if(_0xa1ee84){return _0xa1ee84[_0x7388('0x32')]()['then'](function(){_0x50473a[_0x7388('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6fbf16,_0x578808){return function(_0x135053){if(!_0x135053){_0x6fbf16['sendStatus'](0x194);}return _0x135053;};}function handleError(_0x4ff7b1,_0xfcc17d){_0xfcc17d=_0xfcc17d||0x1f4;return function(_0x329706){logger[_0x7388('0x21')](_0x329706[_0x7388('0x33')]);if(_0x329706[_0x7388('0x34')]){delete _0x329706[_0x7388('0x34')];}_0x4ff7b1['status'](_0xfcc17d)['send'](_0x329706);};}exports[_0x7388('0x35')]=function(_0x387c59,_0x1149d3){var _0x1f6fed={},_0x242c1b={},_0x13d6a6={'count':0x0,'rows':[]};var _0x23e620=_[_0x7388('0x36')](db[_0x7388('0x37')][_0x7388('0x38')],function(_0x8c0f9b){return{'name':_0x8c0f9b[_0x7388('0x39')],'type':_0x8c0f9b[_0x7388('0x3a')][_0x7388('0x3b')]};});_0x242c1b[_0x7388('0x3c')]=_[_0x7388('0x36')](_0x23e620,'name');_0x242c1b['query']=_[_0x7388('0x3d')](_0x387c59[_0x7388('0x3e')]);_0x242c1b[_0x7388('0x3f')]=_['intersection'](_0x242c1b[_0x7388('0x3c')],_0x242c1b[_0x7388('0x3e')]);_0x1f6fed[_0x7388('0x40')]=_[_0x7388('0x41')](_0x242c1b[_0x7388('0x3c')],qs[_0x7388('0x42')](_0x387c59[_0x7388('0x3e')][_0x7388('0x42')]));_0x1f6fed[_0x7388('0x40')]=_0x1f6fed['attributes'][_0x7388('0x43')]?_0x1f6fed[_0x7388('0x40')]:_0x242c1b[_0x7388('0x3c')];if(!_0x387c59[_0x7388('0x3e')][_0x7388('0x44')](_0x7388('0x45'))){_0x1f6fed[_0x7388('0x2a')]=qs[_0x7388('0x2a')](_0x387c59[_0x7388('0x3e')][_0x7388('0x2a')]);_0x1f6fed[_0x7388('0x2d')]=qs[_0x7388('0x2d')](_0x387c59[_0x7388('0x3e')][_0x7388('0x2d')]);}_0x1f6fed[_0x7388('0x46')]=qs['sort'](_0x387c59[_0x7388('0x3e')]['sort']);_0x1f6fed['where']=qs['filters'](_[_0x7388('0x47')](_0x387c59[_0x7388('0x3e')],_0x242c1b[_0x7388('0x3f')]),_0x23e620);if(_0x387c59['query'][_0x7388('0x48')]){_0x1f6fed['where']=_[_0x7388('0x49')](_0x1f6fed['where'],{'$or':_['map'](_0x23e620,function(_0x5d16c4){if(_0x5d16c4['type']!==_0x7388('0x4a')){var _0x3b41b8={};_0x3b41b8[_0x5d16c4[_0x7388('0x34')]]={'$like':'%'+_0x387c59[_0x7388('0x3e')][_0x7388('0x48')]+'%'};return _0x3b41b8;}})});}_0x1f6fed=_[_0x7388('0x49')]({},_0x1f6fed,_0x387c59[_0x7388('0x4b')]);var _0xb063d4={'where':_0x1f6fed[_0x7388('0x4c')]};return db[_0x7388('0x37')][_0x7388('0x2c')](_0xb063d4)[_0x7388('0x1d')](function(_0x4bc8ed){_0x13d6a6[_0x7388('0x2c')]=_0x4bc8ed;if(_0x387c59[_0x7388('0x3e')][_0x7388('0x4d')]){_0x1f6fed[_0x7388('0x4e')]=[{'all':!![]}];}return db[_0x7388('0x37')][_0x7388('0x4f')](_0x1f6fed);})[_0x7388('0x1d')](function(_0x55c975){_0x13d6a6[_0x7388('0x50')]=_0x55c975;return _0x13d6a6;})[_0x7388('0x1d')](respondWithFilteredResult(_0x1149d3,_0x1f6fed))[_0x7388('0x51')](handleError(_0x1149d3,null));};exports[_0x7388('0x52')]=function(_0x425398,_0xbf581){var _0x5a6f65={'raw':![],'where':{'id':_0x425398[_0x7388('0x53')]['id']}},_0x396fc2={};_0x396fc2[_0x7388('0x3c')]=_[_0x7388('0x3d')](db['Dynamics365Account'][_0x7388('0x38')]);_0x396fc2['query']=_[_0x7388('0x3d')](_0x425398[_0x7388('0x3e')]);_0x396fc2[_0x7388('0x3f')]=_[_0x7388('0x41')](_0x396fc2[_0x7388('0x3c')],_0x396fc2[_0x7388('0x3e')]);_0x5a6f65[_0x7388('0x40')]=_[_0x7388('0x41')](_0x396fc2[_0x7388('0x3c')],qs[_0x7388('0x42')](_0x425398[_0x7388('0x3e')][_0x7388('0x42')]));_0x5a6f65[_0x7388('0x40')]=_0x5a6f65[_0x7388('0x40')]['length']?_0x5a6f65[_0x7388('0x40')]:_0x396fc2[_0x7388('0x3c')];if(_0x425398[_0x7388('0x3e')][_0x7388('0x4d')]){_0x5a6f65[_0x7388('0x4e')]=[{'all':!![]}];}_0x5a6f65=_[_0x7388('0x49')]({},_0x5a6f65,_0x425398[_0x7388('0x4b')]);return db['Dynamics365Account']['find'](_0x5a6f65)[_0x7388('0x1d')](handleEntityNotFound(_0xbf581,null))[_0x7388('0x1d')](respondWithResult(_0xbf581,null))[_0x7388('0x51')](handleError(_0xbf581,null));};exports[_0x7388('0x54')]=function(_0x2b6372,_0x463a99){return db[_0x7388('0x37')][_0x7388('0x54')](_0x2b6372[_0x7388('0x55')],{})[_0x7388('0x1d')](respondWithResult(_0x463a99,0xc9))[_0x7388('0x51')](handleError(_0x463a99,null));};exports[_0x7388('0x31')]=function(_0x580462,_0x822b58){if(_0x580462[_0x7388('0x55')]['id']){delete _0x580462[_0x7388('0x55')]['id'];}return db[_0x7388('0x37')]['find']({'where':{'id':_0x580462[_0x7388('0x53')]['id']}})[_0x7388('0x1d')](handleEntityNotFound(_0x822b58,null))['then'](saveUpdates(_0x580462['body'],null))['then'](respondWithResult(_0x822b58,null))['catch'](handleError(_0x822b58,null));};exports['destroy']=function(_0x4f1df8,_0x49a543){return db[_0x7388('0x37')][_0x7388('0x56')]({'where':{'id':_0x4f1df8[_0x7388('0x53')]['id']}})[_0x7388('0x1d')](handleEntityNotFound(_0x49a543,null))[_0x7388('0x1d')](removeEntity(_0x49a543,null))['catch'](handleError(_0x49a543,null));};exports[_0x7388('0x57')]=function(_0x594ff0,_0x27c699,_0x2657ea){var _0x406f86={};var _0x1d0eae={};var _0x5bba35;var _0x348ee4;return db['Dynamics365Account']['findOne']({'where':{'id':_0x594ff0['params']['id']}})['then'](handleEntityNotFound(_0x27c699,null))[_0x7388('0x1d')](function(_0x2d70d6){if(_0x2d70d6){_0x5bba35=_0x2d70d6;_0x1d0eae[_0x7388('0x3c')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x1d0eae[_0x7388('0x3e')]=_['keys'](_0x594ff0[_0x7388('0x3e')]);_0x1d0eae['filters']=_['intersection'](_0x1d0eae[_0x7388('0x3c')],_0x1d0eae[_0x7388('0x3e')]);_0x406f86[_0x7388('0x40')]=_[_0x7388('0x41')](_0x1d0eae[_0x7388('0x3c')],qs[_0x7388('0x42')](_0x594ff0[_0x7388('0x3e')][_0x7388('0x42')]));_0x406f86[_0x7388('0x40')]=_0x406f86[_0x7388('0x40')][_0x7388('0x43')]?_0x406f86['attributes']:_0x1d0eae[_0x7388('0x3c')];_0x406f86[_0x7388('0x46')]=qs[_0x7388('0x58')](_0x594ff0[_0x7388('0x3e')][_0x7388('0x58')]);_0x406f86[_0x7388('0x4c')]=qs[_0x7388('0x3f')](_[_0x7388('0x47')](_0x594ff0[_0x7388('0x3e')],_0x1d0eae[_0x7388('0x3f')]));if(_0x594ff0[_0x7388('0x3e')][_0x7388('0x48')]){_0x406f86[_0x7388('0x4c')]=_[_0x7388('0x49')](_0x406f86[_0x7388('0x4c')],{'$or':_[_0x7388('0x36')](_0x406f86['attributes'],function(_0x1e220e){var _0x134a43={};_0x134a43[_0x1e220e]={'$like':'%'+_0x594ff0[_0x7388('0x3e')][_0x7388('0x48')]+'%'};return _0x134a43;})});}_0x406f86=_[_0x7388('0x49')]({},_0x406f86,_0x594ff0['options']);return _0x5bba35[_0x7388('0x57')](_0x406f86);}})[_0x7388('0x1d')](function(_0x41397a){if(_0x41397a){_0x348ee4=_0x41397a[_0x7388('0x43')];if(!_0x594ff0[_0x7388('0x3e')][_0x7388('0x44')](_0x7388('0x45'))){_0x406f86[_0x7388('0x2a')]=qs[_0x7388('0x2a')](_0x594ff0[_0x7388('0x3e')]['limit']);_0x406f86['offset']=qs[_0x7388('0x2d')](_0x594ff0[_0x7388('0x3e')][_0x7388('0x2d')]);}return _0x5bba35[_0x7388('0x57')](_0x406f86);}})[_0x7388('0x1d')](function(_0x308ddb){if(_0x308ddb){return _0x308ddb?{'count':_0x348ee4,'rows':_0x308ddb}:null;}})[_0x7388('0x1d')](respondWithResult(_0x27c699,null))[_0x7388('0x51')](handleError(_0x27c699,null));};exports['addConfiguration']=function(_0x5dfc19,_0x4d535a,_0x2cfa12){if(_0x5dfc19['body']['id']){delete _0x5dfc19[_0x7388('0x55')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x5dfc19[_0x7388('0x53')]['id']}})['then'](handleEntityNotFound(_0x4d535a,null))[_0x7388('0x1d')](function(_0x354384){if(_0x354384){_0x5dfc19['body'][_0x7388('0x59')]=_0x354384['id'];_0x5dfc19[_0x7388('0x55')][_0x7388('0x5a')]=integrations[_0x7388('0x5b')](_0x5dfc19['body'][_0x7388('0x5c')],_0x5dfc19[_0x7388('0x55')]['type']);_0x5dfc19[_0x7388('0x55')][_0x7388('0x5d')]=integrations[_0x7388('0x5e')](_0x5dfc19[_0x7388('0x55')][_0x7388('0x5c')],_0x5dfc19[_0x7388('0x55')][_0x7388('0x3a')]);return db['Dynamics365Configuration'][_0x7388('0x54')](_0x5dfc19[_0x7388('0x55')],{'include':[{'model':db['Dynamics365Field'],'as':_0x7388('0x5a')},{'model':db['Dynamics365Field'],'as':_0x7388('0x5d')}]});}return null;})['then'](respondWithResult(_0x4d535a,null))[_0x7388('0x51')](handleError(_0x4d535a,null));};exports[_0x7388('0x5f')]=function(_0x45d275,_0x5ce3fc,_0x37d9ac){var _0xc87519=_0x45d275['query'][_0x7388('0x60')];var _0x5f4e7a=_0xc87519==='incident'?'Incident':_0x7388('0x61');var _0x5727b2='';var _0x186881='';var _0x472b5a='';var _0x5c89b6='';var _0x566226='';var _0x226373='';var _0x3aad8b='';var _0x3df443='';var _0x338b33=[_0x7388('0x62'),_0x7388('0x63'),'customerid','ownerid',_0x7388('0x64'),_0x7388('0x65'),_0x7388('0x66'),_0x7388('0x67'),_0x7388('0x68'),_0x7388('0x69')];var _0x31aeff=[_0x7388('0x6a'),_0x7388('0x6b'),_0x7388('0x6c'),_0x7388('0x6d'),_0x7388('0x6e'),_0x7388('0x6f'),_0x7388('0x70'),_0x7388('0x71'),_0x7388('0x72'),_0x7388('0x73'),_0x7388('0x74'),_0x7388('0x75'),'createdon',_0x7388('0x76'),_0x7388('0x77'),'customeridname',_0x7388('0x78'),_0x7388('0x79'),_0x7388('0x7a'),_0x7388('0x7b'),_0x7388('0x7c'),_0x7388('0x7d'),_0x7388('0x7e'),'exchangerate','firstresponsebykpiidname',_0x7388('0x7f'),_0x7388('0x80'),_0x7388('0x81'),_0x7388('0x82'),_0x7388('0x83'),_0x7388('0x84'),_0x7388('0x85'),_0x7388('0x86'),_0x7388('0x87'),_0x7388('0x88'),_0x7388('0x89'),'modifiedonbehalfbyname',_0x7388('0x8a'),_0x7388('0x8b'),'msdyn_iotalertname',_0x7388('0x8c'),_0x7388('0x8d'),_0x7388('0x8e'),_0x7388('0x8f'),_0x7388('0x90'),_0x7388('0x91'),'parentcaseidname',_0x7388('0x92'),_0x7388('0x93'),_0x7388('0x94'),'productidname','productserialnumber',_0x7388('0x95'),_0x7388('0x96'),_0x7388('0x97'),_0x7388('0x98'),_0x7388('0x99'),_0x7388('0x9a'),'slainvokedidname',_0x7388('0x9b'),_0x7388('0x9c'),'statecode',_0x7388('0x9d'),'subjectidname','ticketnumber',_0x7388('0x9e'),_0x7388('0x9f'),_0x7388('0xa0'),_0x7388('0xa1'),'versionnumber'];var _0x27fa60=_0x338b33[_0x7388('0xa2')](_0x31aeff);return db['Dynamics365Account'][_0x7388('0xa3')]({'where':{'id':_0x45d275['params']['id']},'attributes':['id',_0x7388('0xa4'),_0x7388('0xa5'),_0x7388('0xa6'),_0x7388('0xa7'),_0x7388('0xa8'),_0x7388('0xa9')]})[_0x7388('0x1d')](handleEntityNotFound(_0x5ce3fc,null))[_0x7388('0x1d')](function(_0x23aea8){if(_0x23aea8){_0x3df443=_0x23aea8['remoteUri'];var _0x2f96f3=_0x3df443[_0x7388('0xaa')](-0x1);if(_0x2f96f3==='/'){_0x3df443=_0x3df443[_0x7388('0xab')](0x0,_0x3df443[_0x7388('0xac')](_0x2f96f3));}_0x3aad8b=util[_0x7388('0xad')](_0x7388('0xae'),_0x3df443);var _0x17b3fc={'method':_0x7388('0xaf'),'uri':'https://login.microsoftonline.com/'+_0x23aea8[_0x7388('0xa7')]+_0x7388('0xb0'),'form':{'client_id':_0x23aea8[_0x7388('0xa8')],'resource':_0x3df443,'username':_0x23aea8[_0x7388('0xa4')],'password':_0x23aea8[_0x7388('0xa5')],'grant_type':_0x7388('0xa5'),'client_secret':_0x23aea8['clientSecret']},'json':!![]};return rp(_0x17b3fc);}})[_0x7388('0x1d')](function(_0x4cfe12){_0x226373=_0x4cfe12['access_token'];var _0x208076={'method':'GET','uri':encodeURI(_0x3aad8b+_0x7388('0xb1')+_0x5f4e7a+'\x27'),'headers':{'Authorization':_0x7388('0xb2')+_0x226373,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x208076);})[_0x7388('0x1d')](function(_0x1fa266){var _0x1f89d9=_0x1fa266[_0x7388('0xb3')][0x0];var _0x34b1ce=_0x1f89d9['MetadataId'];var _0x565c6c={'method':'GET','uri':_0x3aad8b+_0x7388('0xb4')+_0x34b1ce+_0x7388('0xb5'),'headers':{'Authorization':_0x7388('0xb2')+_0x226373,'If-None-Match':null,'OData-Version':_0x7388('0xb6')},'json':!![]};return rp(_0x565c6c);})[_0x7388('0x1d')](function(_0x32a6e8){_0x5727b2=_0x32a6e8;_0x186881=_0x5727b2[_0x7388('0xb7')];_0x186881=_[_0x7388('0xb8')](_0x186881,function(_0x143774){return!_0x27fa60[_0x7388('0xb9')](_0x143774[_0x7388('0xba')]);});var _0x40a5b6=[];var _0xdefcb0=[];_0x186881[_0x7388('0xbb')](function(_0x1e7acd){if(_0x1e7acd['@odata.type']){var _0x101ea4=_0x1e7acd[_0x7388('0xbc')][_0x7388('0xab')](_0x1e7acd[_0x7388('0xbc')]['lastIndexOf']('.')+0x1);if(_0x101ea4===_0x7388('0xbd')){_0x40a5b6[_0x7388('0xbe')](getSelectList(_0x3aad8b,_0xc87519,_0xdefcb0,_0x5727b2['MetadataId'],_0x1e7acd[_0x7388('0xbf')],_0x226373));}}});return Promise[_0x7388('0xc0')](_0x40a5b6);})['then'](function(_0x327b19){_0x472b5a=_0x327b19[0x0];var _0x5b6bfe=[];var _0x1bfe0d=[];_0x186881[_0x7388('0xbb')](function(_0x25b2e3){if(!_[_0x7388('0xc1')](_0x25b2e3['@odata.type'])){var _0x4c36b2=_0x25b2e3[_0x7388('0xbc')][_0x7388('0xab')](_0x25b2e3[_0x7388('0xbc')][_0x7388('0xac')]('.')+0x1);if(_0x4c36b2===_0x7388('0xc2')){_0x5b6bfe[_0x7388('0xbe')](getBooleanList(_0x3aad8b,_0xc87519,_0x1bfe0d,_0x5727b2[_0x7388('0xbf')],_0x25b2e3[_0x7388('0xbf')],_0x226373));}}});return Promise[_0x7388('0xc0')](_0x5b6bfe);})[_0x7388('0x1d')](function(_0x592949){_0x5c89b6=_0x592949[0x0];var _0x5d8e9e=[];var _0x2018af=[];_0x186881[_0x7388('0xbb')](function(_0x54beb7){if(_0x54beb7[_0x7388('0xbc')]){var _0x5b1273=_0x54beb7[_0x7388('0xbc')][_0x7388('0xab')](_0x54beb7['@odata.type'][_0x7388('0xac')]('.')+0x1);if(_0x5b1273===_0x7388('0xc3')||_0x5b1273===_0x7388('0xc4')||_0x5b1273===_0x7388('0xc5')||_0x5b1273===_0x7388('0xc6')||_0x5b1273==='MemoAttributeMetadata'||_0x5b1273===_0x7388('0xc7')||_0x5b1273===_0x7388('0xc8')||_0x5b1273===_0x7388('0xc9')||_0x5b1273==='StateAttributeMetadata'||_0x5b1273===_0x7388('0xca')){_0x5d8e9e[_0x7388('0xbe')](getInputList(_0x3aad8b,_0xc87519,_0x5b1273,_0x2018af,_0x5727b2[_0x7388('0xbf')],_0x54beb7[_0x7388('0xbf')],_0x226373));}}});return Promise[_0x7388('0xc0')](_0x5d8e9e);})[_0x7388('0x1d')](function(_0x170936){_0x566226=_0x170936[0x0];var _0x19a633=_0x472b5a[_0x7388('0xa2')](_0x5c89b6)[_0x7388('0xa2')](_0x566226);var _0x6cdeff={'count':_0x19a633[_0x7388('0x43')],'rows':_0x19a633};return _0x6cdeff;})[_0x7388('0x1d')](respondWithResult(_0x5ce3fc,null))['catch'](function(_0x5d908c){var _0x3bc26e=_0x45d275[_0x7388('0x3e')][_0x7388('0xcb')]?0x1f4:_0x5d908c[_0x7388('0xcc')]||0x1f4;logger['error'](_0x5d908c[_0x7388('0x33')]);delete _0x5d908c[_0x7388('0x34')];if(_0x3bc26e===0x191){_0x3bc26e=0x190;}_0x5ce3fc[_0x7388('0x28')](_0x3bc26e)[_0x7388('0xcd')](_0x45d275[_0x7388('0x3e')][_0x7388('0xcb')]?{'message':_0x7388('0xce'),'statusCode':_0x5d908c['statusCode']}:_0x5d908c);});};function getSelectList(_0x18321d,_0x4db88a,_0x2845ea,_0x39af34,_0x567d5e,_0x4a94a7){var _0x1e29ea={'method':_0x7388('0xcf'),'uri':_0x18321d+_0x7388('0xb4')+_0x39af34+_0x7388('0xd0')+_0x567d5e+_0x7388('0xd1')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x4a94a7,'If-None-Match':null,'OData-Version':_0x7388('0xb6')},'json':!![]};return rp(_0x1e29ea)[_0x7388('0x1d')](function(_0x353df2){var _0x3d8ef8=[];var _0x5d5187=_0x353df2[_0x7388('0xd2')][_0x7388('0xd3')];_0x5d5187[_0x7388('0xbb')](function(_0x4479d0){_0x3d8ef8[_0x7388('0xbe')]({'name':_0x4479d0[_0x7388('0xd4')]['UserLocalizedLabel'][_0x7388('0xd4')],'value':String(_0x4479d0[_0x7388('0xd5')])});});var _0x507412={'id':_0x4db88a+'_'+_0x353df2[_0x7388('0xba')],'name':_0x353df2[_0x7388('0xd6')][_0x7388('0xd7')][_0x7388('0xd4')],'custom':![],'options':_0x3d8ef8};_0x2845ea['push'](_0x507412);return _0x2845ea;});}function getBooleanList(_0x568366,_0x305249,_0x28e48f,_0x4631d4,_0x1f86b3,_0x45a1bd){var _0x4f03ca={'method':_0x7388('0xcf'),'uri':_0x568366+'EntityDefinitions('+_0x4631d4+_0x7388('0xd0')+_0x1f86b3+_0x7388('0xd8'),'headers':{'Authorization':_0x7388('0xb2')+_0x45a1bd,'If-None-Match':null,'OData-Version':_0x7388('0xb6')},'json':!![]};return rp(_0x4f03ca)[_0x7388('0x1d')](function(_0x32af7d){var _0x5eed72=[];_0x5eed72[_0x7388('0xbe')]({'name':_0x32af7d['OptionSet'][_0x7388('0xd9')]['Label'][_0x7388('0xd7')]['Label'],'value':'true'},{'name':_0x32af7d['OptionSet'][_0x7388('0xda')][_0x7388('0xd4')][_0x7388('0xd7')]['Label'],'value':'false'});var _0x3df40b={'id':_0x305249+'_'+_0x32af7d['LogicalName'],'name':_0x32af7d[_0x7388('0xd6')][_0x7388('0xd7')][_0x7388('0xd4')],'custom':![],'options':_0x5eed72};_0x28e48f[_0x7388('0xbe')](_0x3df40b);return _0x28e48f;});}function getInputList(_0x276d2e,_0x1252b6,_0x3ec4b3,_0x32e069,_0x464ebe,_0x371d2a,_0x143496){var _0x23d61a={'method':_0x7388('0xcf'),'uri':_0x276d2e+_0x7388('0xb4')+_0x464ebe+')/Attributes('+_0x371d2a+')/Microsoft.Dynamics.CRM.'+_0x3ec4b3+_0x7388('0xdb'),'headers':{'Authorization':_0x7388('0xb2')+_0x143496,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23d61a)[_0x7388('0x1d')](function(_0x1f2cb9){var _0x2f38bb={'id':_0x1252b6+'_'+_0x1f2cb9['LogicalName'],'name':_0x1f2cb9['DisplayName'][_0x7388('0xd7')]?_0x1f2cb9[_0x7388('0xd6')][_0x7388('0xd7')][_0x7388('0xd4')]:_0x1f2cb9['LogicalName'],'custom':![],'options':[]};_0x32e069[_0x7388('0xbe')](_0x2f38bb);return _0x32e069;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 98577d1..9561f7a 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 _0x93ae=['moment','bluebird','path','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api'];(function(_0x236029,_0x5d4c17){var _0x350df5=function(_0x551862){while(--_0x551862){_0x236029['push'](_0x236029['shift']());}};_0x350df5(++_0x5d4c17);}(_0x93ae,0x10f));var _0xe93a=function(_0x4e726a,_0x56f117){_0x4e726a=_0x4e726a-0x0;var _0x312e41=_0x93ae[_0x4e726a];return _0x312e41;};'use strict';var _=require(_0xe93a('0x0'));var util=require(_0xe93a('0x1'));var logger=require(_0xe93a('0x2'))(_0xe93a('0x3'));var moment=require(_0xe93a('0x4'));var BPromise=require(_0xe93a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe93a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe93a('0x7'));var integrations=require(_0xe93a('0x8'));module['exports']=function(_0x27b3d8,_0x597dd4){return _0x27b3d8['define'](_0xe93a('0x9'),attributes,{'tableName':_0xe93a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x872c=['bluebird','path','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','../../config/logger','api','moment'];(function(_0x614d23,_0x20a041){var _0x3c158a=function(_0x4892e9){while(--_0x4892e9){_0x614d23['push'](_0x614d23['shift']());}};_0x3c158a(++_0x20a041);}(_0x872c,0x1e0));var _0xc872=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x872c[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xc872('0x0'));var util=require('util');var logger=require(_0xc872('0x1'))(_0xc872('0x2'));var moment=require(_0xc872('0x3'));var BPromise=require(_0xc872('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc872('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc872('0x6'));var integrations=require(_0xc872('0x7'));module[_0xc872('0x8')]=function(_0x11d92c,_0x20c4e4){return _0x11d92c[_0xc872('0x9')](_0xc872('0xa'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 9ffeb1c..1877824 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 _0x2706=['options','raw','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetDynamics365Account','Dynamics365Account','findAll'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x2706,0x107));var _0x6270=function(_0x33fe27,_0x302350){_0x33fe27=_0x33fe27-0x0;var _0x38b47a=_0x2706[_0x33fe27];return _0x38b47a;};'use strict';var _=require('lodash');var util=require(_0x6270('0x0'));var moment=require(_0x6270('0x1'));var BPromise=require(_0x6270('0x2'));var rs=require(_0x6270('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6270('0x4'))['db'];var utils=require(_0x6270('0x5'));var logger=require(_0x6270('0x6'))(_0x6270('0x7'));var config=require(_0x6270('0x8'));var jayson=require(_0x6270('0x9'));var client=jayson[_0x6270('0xa')][_0x6270('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fac3f,_0x4f700e,_0x2e6a1b){return new BPromise(function(_0x585bc1,_0x35a6e3){return client[_0x6270('0xc')](_0x4fac3f,_0x2e6a1b)[_0x6270('0xd')](function(_0xea69a0){logger[_0x6270('0xe')](_0x6270('0xf'),_0x4f700e,'request\x20sent');logger[_0x6270('0x10')](_0x6270('0x11'),_0x4f700e,_0x6270('0x12'),JSON[_0x6270('0x13')](_0xea69a0));if(_0xea69a0[_0x6270('0x14')]){if(_0xea69a0['error']['code']===0x1f4){logger[_0x6270('0x14')](_0x6270('0xf'),_0x4f700e,_0xea69a0['error']['message']);return _0x35a6e3(_0xea69a0['error'][_0x6270('0x15')]);}logger['error'](_0x6270('0xf'),_0x4f700e,_0xea69a0['error']['message']);return _0x585bc1(_0xea69a0['error'][_0x6270('0x15')]);}else{logger[_0x6270('0xe')](_0x6270('0xf'),_0x4f700e,'request\x20sent');_0x585bc1(_0xea69a0['result'][_0x6270('0x15')]);}})['catch'](function(_0x26ceb9){logger[_0x6270('0x14')](_0x6270('0xf'),_0x4f700e,_0x26ceb9);_0x35a6e3(_0x26ceb9);});});}exports[_0x6270('0x16')]=function(_0x2c87c9){var _0x5f1eb4=this;return new Promise(function(_0x3ba0f4,_0x4daec2){return db[_0x6270('0x17')][_0x6270('0x18')]({'raw':_0x2c87c9[_0x6270('0x19')]?_0x2c87c9[_0x6270('0x19')][_0x6270('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c87c9[_0x6270('0x19')]?_0x2c87c9[_0x6270('0x19')][_0x6270('0x1b')]||null:null,'attributes':_0x2c87c9[_0x6270('0x19')]?_0x2c87c9[_0x6270('0x19')][_0x6270('0x1c')]||null:null,'limit':_0x2c87c9[_0x6270('0x19')]?_0x2c87c9['options'][_0x6270('0x1d')]||null:null,'include':_0x2c87c9[_0x6270('0x19')]?_0x2c87c9[_0x6270('0x19')][_0x6270('0x1e')]?_[_0x6270('0x1f')](_0x2c87c9[_0x6270('0x19')][_0x6270('0x1e')],function(_0x564398){return{'model':db[_0x564398[_0x6270('0x20')]],'as':_0x564398['as'],'attributes':_0x564398[_0x6270('0x1c')],'include':_0x564398[_0x6270('0x1e')]?_['map'](_0x564398[_0x6270('0x1e')],function(_0x4099d6){return{'model':db[_0x4099d6[_0x6270('0x20')]],'as':_0x4099d6['as'],'attributes':_0x4099d6[_0x6270('0x1c')],'include':_0x4099d6[_0x6270('0x1e')]?_[_0x6270('0x1f')](_0x4099d6['include'],function(_0x3bd0f9){return{'model':db[_0x3bd0f9[_0x6270('0x20')]],'as':_0x3bd0f9['as'],'attributes':_0x3bd0f9[_0x6270('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6270('0xd')](function(_0x1d1450){logger['info']('GetDynamics365Account',_0x2c87c9);logger[_0x6270('0x10')]('GetDynamics365Account',_0x2c87c9,JSON[_0x6270('0x13')](_0x1d1450));_0x3ba0f4(_0x1d1450);})[_0x6270('0x21')](function(_0x5b027b){logger['error'](_0x6270('0x16'),_0x5b027b['message'],_0x2c87c9);_0x4daec2(_0x5f1eb4[_0x6270('0x14')](0x1f4,_0x5b027b[_0x6270('0x15')]));});});};exports[_0x6270('0x22')]=function(_0x24c63f){var _0x2a0164=this;return new Promise(function(_0x51a8eb,_0x289493){return db[_0x6270('0x17')][_0x6270('0x23')]({'raw':_0x24c63f[_0x6270('0x19')]?_0x24c63f[_0x6270('0x19')][_0x6270('0x1a')]===undefined?!![]:![]:!![],'where':_0x24c63f[_0x6270('0x19')]?_0x24c63f[_0x6270('0x19')][_0x6270('0x1b')]||null:null,'attributes':_0x24c63f['options']?_0x24c63f[_0x6270('0x19')][_0x6270('0x1c')]||null:null,'include':_0x24c63f['options']?_0x24c63f[_0x6270('0x19')]['include']?_[_0x6270('0x1f')](_0x24c63f[_0x6270('0x19')][_0x6270('0x1e')],function(_0x3796c3){return{'model':db[_0x3796c3[_0x6270('0x20')]],'as':_0x3796c3['as'],'attributes':_0x3796c3[_0x6270('0x1c')],'include':_0x3796c3[_0x6270('0x1e')]?_[_0x6270('0x1f')](_0x3796c3['include'],function(_0x57394e){return{'model':db[_0x57394e[_0x6270('0x20')]],'as':_0x57394e['as'],'attributes':_0x57394e[_0x6270('0x1c')],'include':_0x57394e[_0x6270('0x1e')]?_[_0x6270('0x1f')](_0x57394e[_0x6270('0x1e')],function(_0x562bf9){return{'model':db[_0x562bf9[_0x6270('0x20')]],'as':_0x562bf9['as'],'attributes':_0x562bf9[_0x6270('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6270('0xd')](function(_0x5967bd){logger['info']('ShowDynamics365Account',_0x24c63f);logger[_0x6270('0x10')](_0x6270('0x22'),_0x24c63f,JSON[_0x6270('0x13')](_0x5967bd));_0x51a8eb(_0x5967bd);})['catch'](function(_0x34200a){logger[_0x6270('0x14')]('ShowDynamics365Account',_0x34200a[_0x6270('0x15')],_0x24c63f);_0x289493(_0x2a0164[_0x6270('0x14')](0x1f4,_0x34200a['message']));});});}; \ No newline at end of file +var _0xcaf2=['raw','attributes','limit','include','map','model','GetDynamics365Account','stringify','catch','ShowDynamics365Account','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','Dynamics365Account','options'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcaf2,0x8a));var _0x2caf=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xcaf2[_0x3de873];return _0x380b8c;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});}exports['GetDynamics365Account']=function(_0x4a33fc){var _0x3e975f=this;return new Promise(function(_0x58047b,_0xe72440){return db[_0x2caf('0x14')]['findAll']({'raw':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')][_0x2caf('0x16')]===undefined?!![]:![]:!![],'where':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')]['where']||null:null,'attributes':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')][_0x2caf('0x17')]||null:null,'limit':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')][_0x2caf('0x18')]||null:null,'include':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')][_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x4a33fc[_0x2caf('0x15')]['include'],function(_0x296305){return{'model':db[_0x296305[_0x2caf('0x1b')]],'as':_0x296305['as'],'attributes':_0x296305[_0x2caf('0x17')],'include':_0x296305[_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x296305[_0x2caf('0x19')],function(_0x392196){return{'model':db[_0x392196[_0x2caf('0x1b')]],'as':_0x392196['as'],'attributes':_0x392196[_0x2caf('0x17')],'include':_0x392196[_0x2caf('0x19')]?_['map'](_0x392196[_0x2caf('0x19')],function(_0x325eda){return{'model':db[_0x325eda[_0x2caf('0x1b')]],'as':_0x325eda['as'],'attributes':_0x325eda[_0x2caf('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2caf('0xa')](function(_0x17d3c6){logger[_0x2caf('0xb')](_0x2caf('0x1c'),_0x4a33fc);logger[_0x2caf('0xe')](_0x2caf('0x1c'),_0x4a33fc,JSON[_0x2caf('0x1d')](_0x17d3c6));_0x58047b(_0x17d3c6);})[_0x2caf('0x1e')](function(_0x158d60){logger['error'](_0x2caf('0x1c'),_0x158d60[_0x2caf('0x12')],_0x4a33fc);_0xe72440(_0x3e975f[_0x2caf('0x10')](0x1f4,_0x158d60[_0x2caf('0x12')]));});});};exports[_0x2caf('0x1f')]=function(_0x1f52bf){var _0x3812cd=this;return new Promise(function(_0x524e0c,_0x21b3c4){return db[_0x2caf('0x14')]['find']({'raw':_0x1f52bf[_0x2caf('0x15')]?_0x1f52bf[_0x2caf('0x15')][_0x2caf('0x16')]===undefined?!![]:![]:!![],'where':_0x1f52bf['options']?_0x1f52bf[_0x2caf('0x15')]['where']||null:null,'attributes':_0x1f52bf['options']?_0x1f52bf[_0x2caf('0x15')][_0x2caf('0x17')]||null:null,'include':_0x1f52bf[_0x2caf('0x15')]?_0x1f52bf[_0x2caf('0x15')][_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x1f52bf[_0x2caf('0x15')][_0x2caf('0x19')],function(_0x20818e){return{'model':db[_0x20818e['model']],'as':_0x20818e['as'],'attributes':_0x20818e[_0x2caf('0x17')],'include':_0x20818e[_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x20818e[_0x2caf('0x19')],function(_0x17c1b4){return{'model':db[_0x17c1b4[_0x2caf('0x1b')]],'as':_0x17c1b4['as'],'attributes':_0x17c1b4[_0x2caf('0x17')],'include':_0x17c1b4[_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x17c1b4[_0x2caf('0x19')],function(_0x105ec7){return{'model':db[_0x105ec7[_0x2caf('0x1b')]],'as':_0x105ec7['as'],'attributes':_0x105ec7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x410020){logger[_0x2caf('0xb')](_0x2caf('0x1f'),_0x1f52bf);logger[_0x2caf('0xe')]('ShowDynamics365Account',_0x1f52bf,JSON[_0x2caf('0x1d')](_0x410020));_0x524e0c(_0x410020);})[_0x2caf('0x1e')](function(_0x4568f9){logger[_0x2caf('0x10')](_0x2caf('0x1f'),_0x4568f9[_0x2caf('0x12')],_0x1f52bf);_0x21b3c4(_0x3812cd[_0x2caf('0x10')](0x1f4,_0x4568f9[_0x2caf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7acfd34..47d194e 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 _0x14ed=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14ed,0x155));var _0xd14e=function(_0x553faf,_0x44ed98){_0x553faf=_0x553faf-0x0;var _0x2dafaa=_0x14ed[_0x553faf];return _0x2dafaa;};'use strict';var multer=require(_0xd14e('0x0'));var util=require(_0xd14e('0x1'));var path=require(_0xd14e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd14e('0x3')]();var fs_extra=require(_0xd14e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd14e('0x5'));var config=require(_0xd14e('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xd14e('0x7')]('/',auth[_0xd14e('0x8')](),controller[_0xd14e('0x9')]);router[_0xd14e('0x7')]('/:id',auth[_0xd14e('0x8')](),controller[_0xd14e('0xa')]);router[_0xd14e('0x7')]('/:id/fields',auth[_0xd14e('0x8')](),controller['getFields']);router['get'](_0xd14e('0xb'),auth[_0xd14e('0x8')](),controller[_0xd14e('0xc')]);router[_0xd14e('0x7')](_0xd14e('0xd'),auth[_0xd14e('0x8')](),controller[_0xd14e('0xe')]);router[_0xd14e('0xf')]('/',auth['isAuthenticated'](),controller[_0xd14e('0x10')]);router[_0xd14e('0x11')](_0xd14e('0x12'),auth[_0xd14e('0x8')](),controller[_0xd14e('0x13')]);router['delete'](_0xd14e('0x12'),auth[_0xd14e('0x8')](),controller[_0xd14e('0x14')]);module[_0xd14e('0x15')]=router; \ No newline at end of file +var _0x9718=['getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects'];(function(_0x18dc67,_0x446d67){var _0x11f2ea=function(_0x21caa2){while(--_0x21caa2){_0x18dc67['push'](_0x18dc67['shift']());}};_0x11f2ea(++_0x446d67);}(_0x9718,0x127));var _0x8971=function(_0x301fe0,_0x2d4d39){_0x301fe0=_0x301fe0-0x0;var _0x43ad95=_0x9718[_0x301fe0];return _0x43ad95;};'use strict';var multer=require(_0x8971('0x0'));var util=require(_0x8971('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8971('0x2'));var router=express[_0x8971('0x3')]();var fs_extra=require(_0x8971('0x4'));var auth=require(_0x8971('0x5'));var interaction=require(_0x8971('0x6'));var config=require(_0x8971('0x7'));var controller=require(_0x8971('0x8'));router[_0x8971('0x9')]('/',auth['isAuthenticated'](),controller[_0x8971('0xa')]);router[_0x8971('0x9')](_0x8971('0xb'),auth['isAuthenticated'](),controller[_0x8971('0xc')]);router[_0x8971('0x9')](_0x8971('0xd'),auth[_0x8971('0xe')](),controller[_0x8971('0xf')]);router['get'](_0x8971('0x10'),auth[_0x8971('0xe')](),controller[_0x8971('0x11')]);router['get'](_0x8971('0x12'),auth['isAuthenticated'](),controller[_0x8971('0x13')]);router[_0x8971('0x14')]('/',auth[_0x8971('0xe')](),controller['create']);router[_0x8971('0x15')](_0x8971('0xb'),auth[_0x8971('0xe')](),controller[_0x8971('0x16')]);router[_0x8971('0x17')](_0x8971('0xb'),auth[_0x8971('0xe')](),controller[_0x8971('0x18')]);module[_0x8971('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c1bdbaa..9d3bb37 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 _0x3972=['phonecall','sequelize','exports','STRING','ENUM','incident'];(function(_0x461739,_0x19e3ab){var _0xab4001=function(_0x51f7f1){while(--_0x51f7f1){_0x461739['push'](_0x461739['shift']());}};_0xab4001(++_0x19e3ab);}(_0x3972,0x1cf));var _0x2397=function(_0x35d24a,_0x4812f7){_0x35d24a=_0x35d24a-0x0;var _0x31b2e0=_0x3972[_0x35d24a];return _0x31b2e0;};'use strict';var Sequelize=require(_0x2397('0x0'));module[_0x2397('0x1')]={'name':{'type':Sequelize[_0x2397('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x2397('0x3')](_0x2397('0x4'),_0x2397('0x5')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xded5=['incident','exports','STRING','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xded5,0x7d));var _0x5ded=function(_0x2fa157,_0x5376b){_0x2fa157=_0x2fa157-0x0;var _0x3c0392=_0xded5[_0x2fa157];return _0x3c0392;};'use strict';var Sequelize=require('sequelize');module[_0x5ded('0x0')]={'name':{'type':Sequelize[_0x5ded('0x1')]},'description':{'type':Sequelize[_0x5ded('0x1')]},'ticketType':{'type':Sequelize[_0x5ded('0x2')]('incident','phonecall'),'defaultValue':_0x5ded('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ee12ec8..e47ae3d 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 _0xa902=['apply','reject','update','end','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','length','find','create','body','params','destroy','findOne','order','getFields','getSubjects','keys','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','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','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0xe5d54f,_0x143d93){var _0x2a74bf=function(_0x3e56cb){while(--_0x3e56cb){_0xe5d54f['push'](_0xe5d54f['shift']());}};_0x2a74bf(++_0x143d93);}(_0xa902,0x19d));var _0x2a90=function(_0x1693c5,_0x42d910){_0x1693c5=_0x1693c5-0x0;var _0x40b6d6=_0xa902[_0x1693c5];return _0x40b6d6;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require(_0x2a90('0x6'));var path=require('path');var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a90('0xa'));var squel=require(_0x2a90('0xb'));var crypto=require('crypto');var jsforce=require(_0x2a90('0xc'));var deskjs=require(_0x2a90('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2a90('0xe'));var Papa=require(_0x2a90('0xf'));var Redis=require(_0x2a90('0x10'));var authService=require(_0x2a90('0x11'));var qs=require(_0x2a90('0x12'));var as=require(_0x2a90('0x13'));var hardwareService=require(_0x2a90('0x14'));var logger=require(_0x2a90('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2a90('0x16'));var db=require(_0x2a90('0x17'))['db'];var jayson=require(_0x2a90('0x18'));var client=jayson[_0x2a90('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4db44c,_0x916852,_0x36883d,_0xb4ca0b){return new BPromise(function(_0x5892c5,_0x2e27f1){var _0x2c0076=_0xb4ca0b||client;return _0x2c0076[_0x2a90('0x1a')](_0x4db44c,_0x36883d)[_0x2a90('0x1b')](function(_0x3ba97f){logger[_0x2a90('0x1c')](_0x2a90('0x1d'),_0x916852,'request\x20sent');logger[_0x2a90('0x1e')](_0x2a90('0x1f'),_0x916852,_0x2a90('0x20'),JSON['stringify'](_0x3ba97f));if(_0x3ba97f[_0x2a90('0x21')]){if(_0x3ba97f[_0x2a90('0x21')][_0x2a90('0x22')]===0x1f4){logger[_0x2a90('0x21')](_0x2a90('0x1d'),_0x916852,_0x3ba97f['error']['message']);return _0x2e27f1(_0x3ba97f['error'][_0x2a90('0x23')]);}logger[_0x2a90('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x916852,_0x3ba97f[_0x2a90('0x21')]['message']);return _0x5892c5(_0x3ba97f[_0x2a90('0x21')][_0x2a90('0x23')]);}else{logger[_0x2a90('0x1c')](_0x2a90('0x1d'),_0x916852,'request\x20sent');_0x5892c5(_0x3ba97f[_0x2a90('0x24')][_0x2a90('0x23')]);}})[_0x2a90('0x25')](function(_0x76ea7d){logger['error'](_0x2a90('0x1d'),_0x916852,_0x76ea7d);_0x2e27f1(_0x76ea7d);});});}function respondWithStatusCode(_0x1f88ca,_0x52423a){_0x52423a=_0x52423a||0xcc;return function(_0x59c090){if(_0x59c090){return _0x1f88ca[_0x2a90('0x26')](_0x52423a);}return _0x1f88ca[_0x2a90('0x27')](_0x52423a)['end']();};}function respondWithResult(_0x37f12,_0x1ea94e){_0x1ea94e=_0x1ea94e||0xc8;return function(_0x366fc4){if(_0x366fc4){return _0x37f12[_0x2a90('0x27')](_0x1ea94e)[_0x2a90('0x28')](_0x366fc4);}};}function respondWithFilteredResult(_0x21454c,_0x11d385){return function(_0x54cc00){if(_0x54cc00){var _0x45e532=typeof _0x11d385[_0x2a90('0x29')]===_0x2a90('0x2a')&&typeof _0x11d385[_0x2a90('0x2b')]===_0x2a90('0x2a');var _0x2911b7=_0x54cc00[_0x2a90('0x2c')];var _0x5f5478=_0x45e532?0x0:_0x11d385[_0x2a90('0x29')];var _0x1b85a8=_0x45e532?_0x54cc00[_0x2a90('0x2c')]:_0x11d385['offset']+_0x11d385[_0x2a90('0x2b')];var _0x3a8d34;if(_0x1b85a8>=_0x2911b7){_0x1b85a8=_0x2911b7;_0x3a8d34=0xc8;}else{_0x3a8d34=0xce;}_0x21454c[_0x2a90('0x27')](_0x3a8d34);return _0x21454c[_0x2a90('0x2d')](_0x2a90('0x2e'),_0x5f5478+'-'+_0x1b85a8+'/'+_0x2911b7)[_0x2a90('0x28')](_0x54cc00);}return null;};}function patchUpdates(_0x476a6c){return function(_0x1f4bf3){try{jsonpatch[_0x2a90('0x2f')](_0x1f4bf3,_0x476a6c,!![]);}catch(_0x30a69c){return BPromise[_0x2a90('0x30')](_0x30a69c);}return _0x1f4bf3['save']();};}function saveUpdates(_0x3eeb44,_0xb6f7c9){return function(_0xfe7a6e){if(_0xfe7a6e){return _0xfe7a6e[_0x2a90('0x31')](_0x3eeb44)[_0x2a90('0x1b')](function(_0x239a81){return _0x239a81;});}return null;};}function removeEntity(_0x5742f6,_0x3463cf){return function(_0x5ae4b7){if(_0x5ae4b7){return _0x5ae4b7['destroy']()[_0x2a90('0x1b')](function(){_0x5742f6[_0x2a90('0x27')](0xcc)[_0x2a90('0x32')]();});}};}function handleEntityNotFound(_0x25567f,_0x5f1164){return function(_0x261af7){if(!_0x261af7){_0x25567f[_0x2a90('0x26')](0x194);}return _0x261af7;};}function handleError(_0x54d04e,_0x41a765){_0x41a765=_0x41a765||0x1f4;return function(_0xa8feb5){logger[_0x2a90('0x21')](_0xa8feb5['stack']);if(_0xa8feb5[_0x2a90('0x33')]){delete _0xa8feb5[_0x2a90('0x33')];}_0x54d04e[_0x2a90('0x27')](_0x41a765)[_0x2a90('0x34')](_0xa8feb5);};}exports[_0x2a90('0x35')]=function(_0x2d79dd,_0x220465){var _0x5a727a={},_0x364f61={},_0x32551e={'count':0x0,'rows':[]};var _0x99d5ba=_[_0x2a90('0x36')](db[_0x2a90('0x37')][_0x2a90('0x38')],function(_0x50c990){return{'name':_0x50c990[_0x2a90('0x39')],'type':_0x50c990[_0x2a90('0x3a')][_0x2a90('0x3b')]};});_0x364f61[_0x2a90('0x3c')]=_[_0x2a90('0x36')](_0x99d5ba,'name');_0x364f61['query']=_['keys'](_0x2d79dd[_0x2a90('0x3d')]);_0x364f61[_0x2a90('0x3e')]=_[_0x2a90('0x3f')](_0x364f61[_0x2a90('0x3c')],_0x364f61[_0x2a90('0x3d')]);_0x5a727a[_0x2a90('0x40')]=_[_0x2a90('0x3f')](_0x364f61['model'],qs[_0x2a90('0x41')](_0x2d79dd[_0x2a90('0x3d')][_0x2a90('0x41')]));_0x5a727a[_0x2a90('0x40')]=_0x5a727a[_0x2a90('0x40')]['length']?_0x5a727a['attributes']:_0x364f61['model'];if(!_0x2d79dd[_0x2a90('0x3d')][_0x2a90('0x42')](_0x2a90('0x43'))){_0x5a727a[_0x2a90('0x2b')]=qs['limit'](_0x2d79dd[_0x2a90('0x3d')][_0x2a90('0x2b')]);_0x5a727a['offset']=qs[_0x2a90('0x29')](_0x2d79dd[_0x2a90('0x3d')][_0x2a90('0x29')]);}_0x5a727a['order']=qs[_0x2a90('0x44')](_0x2d79dd[_0x2a90('0x3d')][_0x2a90('0x44')]);_0x5a727a[_0x2a90('0x45')]=qs['filters'](_[_0x2a90('0x46')](_0x2d79dd[_0x2a90('0x3d')],_0x364f61[_0x2a90('0x3e')]),_0x99d5ba);if(_0x2d79dd['query']['filter']){_0x5a727a[_0x2a90('0x45')]=_[_0x2a90('0x47')](_0x5a727a['where'],{'$or':_['map'](_0x99d5ba,function(_0x3d8d7f){if(_0x3d8d7f[_0x2a90('0x3a')]!==_0x2a90('0x48')){var _0x42c6de={};_0x42c6de[_0x3d8d7f[_0x2a90('0x33')]]={'$like':'%'+_0x2d79dd[_0x2a90('0x3d')][_0x2a90('0x49')]+'%'};return _0x42c6de;}})});}_0x5a727a=_['merge']({},_0x5a727a,_0x2d79dd[_0x2a90('0x4a')]);var _0x2233cd={'where':_0x5a727a[_0x2a90('0x45')]};return db[_0x2a90('0x37')][_0x2a90('0x2c')](_0x2233cd)['then'](function(_0x45fd4a){_0x32551e[_0x2a90('0x2c')]=_0x45fd4a;if(_0x2d79dd['query'][_0x2a90('0x4b')]){_0x5a727a[_0x2a90('0x4c')]=[{'all':!![]}];}return db[_0x2a90('0x37')][_0x2a90('0x4d')](_0x5a727a);})[_0x2a90('0x1b')](function(_0x461404){_0x32551e[_0x2a90('0x4e')]=_0x461404;return _0x32551e;})[_0x2a90('0x1b')](respondWithFilteredResult(_0x220465,_0x5a727a))[_0x2a90('0x25')](handleError(_0x220465,null));};exports['show']=function(_0x47a5f1,_0x5bd310){var _0x327708={'raw':![],'where':{'id':_0x47a5f1['params']['id']}},_0x5f5a61={};_0x5f5a61[_0x2a90('0x3c')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x5f5a61[_0x2a90('0x3d')]=_['keys'](_0x47a5f1['query']);_0x5f5a61[_0x2a90('0x3e')]=_[_0x2a90('0x3f')](_0x5f5a61['model'],_0x5f5a61[_0x2a90('0x3d')]);_0x327708[_0x2a90('0x40')]=_['intersection'](_0x5f5a61[_0x2a90('0x3c')],qs['fields'](_0x47a5f1[_0x2a90('0x3d')][_0x2a90('0x41')]));_0x327708['attributes']=_0x327708[_0x2a90('0x40')][_0x2a90('0x4f')]?_0x327708[_0x2a90('0x40')]:_0x5f5a61['model'];if(_0x47a5f1[_0x2a90('0x3d')][_0x2a90('0x4b')]){_0x327708[_0x2a90('0x4c')]=[{'all':!![]}];}_0x327708=_[_0x2a90('0x47')]({},_0x327708,_0x47a5f1[_0x2a90('0x4a')]);return db[_0x2a90('0x37')][_0x2a90('0x50')](_0x327708)[_0x2a90('0x1b')](handleEntityNotFound(_0x5bd310,null))['then'](respondWithResult(_0x5bd310,null))[_0x2a90('0x25')](handleError(_0x5bd310,null));};exports['create']=function(_0x80b810,_0x46984f){return db[_0x2a90('0x37')][_0x2a90('0x51')](_0x80b810[_0x2a90('0x52')],{})[_0x2a90('0x1b')](respondWithResult(_0x46984f,0xc9))['catch'](handleError(_0x46984f,null));};exports[_0x2a90('0x31')]=function(_0x4005b9,_0x3c8b5f){if(_0x4005b9[_0x2a90('0x52')]['id']){delete _0x4005b9[_0x2a90('0x52')]['id'];}return db[_0x2a90('0x37')]['find']({'where':{'id':_0x4005b9[_0x2a90('0x53')]['id']}})[_0x2a90('0x1b')](handleEntityNotFound(_0x3c8b5f,null))[_0x2a90('0x1b')](saveUpdates(_0x4005b9[_0x2a90('0x52')],null))[_0x2a90('0x1b')](respondWithResult(_0x3c8b5f,null))['catch'](handleError(_0x3c8b5f,null));};exports[_0x2a90('0x54')]=function(_0x2a6a22,_0x30ed1d){return db[_0x2a90('0x37')][_0x2a90('0x50')]({'where':{'id':_0x2a6a22[_0x2a90('0x53')]['id']}})['then'](handleEntityNotFound(_0x30ed1d,null))['then'](removeEntity(_0x30ed1d,null))[_0x2a90('0x25')](handleError(_0x30ed1d,null));};exports['getFields']=function(_0x4a7159,_0x4c859a,_0xa12dbe){var _0x45a6e0={};var _0x48cc2b={};var _0x1d6c34;var _0x411ab3;return db['Dynamics365Configuration'][_0x2a90('0x55')]({'where':{'id':_0x4a7159['params']['id']}})[_0x2a90('0x1b')](handleEntityNotFound(_0x4c859a,null))['then'](function(_0x15cf89){if(_0x15cf89){_0x1d6c34=_0x15cf89;_0x48cc2b[_0x2a90('0x3c')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x48cc2b[_0x2a90('0x3d')]=_['keys'](_0x4a7159[_0x2a90('0x3d')]);_0x48cc2b[_0x2a90('0x3e')]=_['intersection'](_0x48cc2b[_0x2a90('0x3c')],_0x48cc2b[_0x2a90('0x3d')]);_0x45a6e0[_0x2a90('0x40')]=_[_0x2a90('0x3f')](_0x48cc2b['model'],qs['fields'](_0x4a7159[_0x2a90('0x3d')]['fields']));_0x45a6e0[_0x2a90('0x40')]=_0x45a6e0[_0x2a90('0x40')][_0x2a90('0x4f')]?_0x45a6e0[_0x2a90('0x40')]:_0x48cc2b['model'];_0x45a6e0[_0x2a90('0x56')]=qs['sort'](_0x4a7159[_0x2a90('0x3d')][_0x2a90('0x44')]);_0x45a6e0['where']=qs[_0x2a90('0x3e')](_[_0x2a90('0x46')](_0x4a7159['query'],_0x48cc2b[_0x2a90('0x3e')]));if(_0x4a7159[_0x2a90('0x3d')][_0x2a90('0x49')]){_0x45a6e0[_0x2a90('0x45')]=_['merge'](_0x45a6e0[_0x2a90('0x45')],{'$or':_[_0x2a90('0x36')](_0x45a6e0['attributes'],function(_0x5cfb4b){var _0x28904d={};_0x28904d[_0x5cfb4b]={'$like':'%'+_0x4a7159[_0x2a90('0x3d')][_0x2a90('0x49')]+'%'};return _0x28904d;})});}_0x45a6e0=_[_0x2a90('0x47')]({},_0x45a6e0,_0x4a7159[_0x2a90('0x4a')]);return _0x1d6c34[_0x2a90('0x57')](_0x45a6e0);}})[_0x2a90('0x1b')](function(_0x1d6066){if(_0x1d6066){_0x411ab3=_0x1d6066[_0x2a90('0x4f')];if(!_0x4a7159['query'][_0x2a90('0x42')]('nolimit')){_0x45a6e0[_0x2a90('0x2b')]=qs[_0x2a90('0x2b')](_0x4a7159[_0x2a90('0x3d')][_0x2a90('0x2b')]);_0x45a6e0[_0x2a90('0x29')]=qs[_0x2a90('0x29')](_0x4a7159[_0x2a90('0x3d')][_0x2a90('0x29')]);}return _0x1d6c34[_0x2a90('0x57')](_0x45a6e0);}})[_0x2a90('0x1b')](function(_0x436b1e){if(_0x436b1e){return _0x436b1e?{'count':_0x411ab3,'rows':_0x436b1e}:null;}})[_0x2a90('0x1b')](respondWithResult(_0x4c859a,null))[_0x2a90('0x25')](handleError(_0x4c859a,null));};exports[_0x2a90('0x58')]=function(_0x29e424,_0x787128,_0x1f2c89){var _0x3341a4={};var _0x4af3fa={};var _0x1912a0;var _0x2434d1;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x29e424[_0x2a90('0x53')]['id']}})[_0x2a90('0x1b')](handleEntityNotFound(_0x787128,null))[_0x2a90('0x1b')](function(_0x5bc4d4){if(_0x5bc4d4){_0x1912a0=_0x5bc4d4;_0x4af3fa[_0x2a90('0x3c')]=_[_0x2a90('0x59')](db[_0x2a90('0x5a')][_0x2a90('0x38')]);_0x4af3fa[_0x2a90('0x3d')]=_[_0x2a90('0x59')](_0x29e424[_0x2a90('0x3d')]);_0x4af3fa[_0x2a90('0x3e')]=_[_0x2a90('0x3f')](_0x4af3fa[_0x2a90('0x3c')],_0x4af3fa[_0x2a90('0x3d')]);_0x3341a4['attributes']=_[_0x2a90('0x3f')](_0x4af3fa[_0x2a90('0x3c')],qs['fields'](_0x29e424[_0x2a90('0x3d')][_0x2a90('0x41')]));_0x3341a4['attributes']=_0x3341a4['attributes']['length']?_0x3341a4[_0x2a90('0x40')]:_0x4af3fa['model'];_0x3341a4[_0x2a90('0x56')]=qs['sort'](_0x29e424[_0x2a90('0x3d')][_0x2a90('0x44')]);_0x3341a4[_0x2a90('0x45')]=qs[_0x2a90('0x3e')](_[_0x2a90('0x46')](_0x29e424['query'],_0x4af3fa[_0x2a90('0x3e')]));if(_0x29e424[_0x2a90('0x3d')]['filter']){_0x3341a4[_0x2a90('0x45')]=_['merge'](_0x3341a4[_0x2a90('0x45')],{'$or':_['map'](_0x3341a4[_0x2a90('0x40')],function(_0x2aed89){var _0x384dbe={};_0x384dbe[_0x2aed89]={'$like':'%'+_0x29e424[_0x2a90('0x3d')][_0x2a90('0x49')]+'%'};return _0x384dbe;})});}_0x3341a4=_[_0x2a90('0x47')]({},_0x3341a4,_0x29e424[_0x2a90('0x4a')]);return _0x1912a0[_0x2a90('0x58')](_0x3341a4);}})[_0x2a90('0x1b')](function(_0x2ade50){if(_0x2ade50){_0x2434d1=_0x2ade50[_0x2a90('0x4f')];if(!_0x29e424[_0x2a90('0x3d')]['hasOwnProperty'](_0x2a90('0x43'))){_0x3341a4[_0x2a90('0x2b')]=qs[_0x2a90('0x2b')](_0x29e424[_0x2a90('0x3d')][_0x2a90('0x2b')]);_0x3341a4[_0x2a90('0x29')]=qs['offset'](_0x29e424[_0x2a90('0x3d')]['offset']);}return _0x1912a0['getSubjects'](_0x3341a4);}})[_0x2a90('0x1b')](function(_0x2976d7){if(_0x2976d7){return _0x2976d7?{'count':_0x2434d1,'rows':_0x2976d7}:null;}})[_0x2a90('0x1b')](respondWithResult(_0x787128,null))[_0x2a90('0x25')](handleError(_0x787128,null));};exports['getDescriptions']=function(_0x315878,_0x5b2dfd,_0x5c031b){var _0x5a67ff={};var _0x2edddd={};var _0x148553;var _0x4ccbc9;return db['Dynamics365Configuration'][_0x2a90('0x55')]({'where':{'id':_0x315878['params']['id']}})[_0x2a90('0x1b')](handleEntityNotFound(_0x5b2dfd,null))['then'](function(_0x498857){if(_0x498857){_0x148553=_0x498857;_0x2edddd[_0x2a90('0x3c')]=_[_0x2a90('0x59')](db[_0x2a90('0x5a')][_0x2a90('0x38')]);_0x2edddd[_0x2a90('0x3d')]=_['keys'](_0x315878[_0x2a90('0x3d')]);_0x2edddd['filters']=_['intersection'](_0x2edddd[_0x2a90('0x3c')],_0x2edddd[_0x2a90('0x3d')]);_0x5a67ff['attributes']=_[_0x2a90('0x3f')](_0x2edddd[_0x2a90('0x3c')],qs['fields'](_0x315878[_0x2a90('0x3d')][_0x2a90('0x41')]));_0x5a67ff[_0x2a90('0x40')]=_0x5a67ff[_0x2a90('0x40')][_0x2a90('0x4f')]?_0x5a67ff[_0x2a90('0x40')]:_0x2edddd[_0x2a90('0x3c')];_0x5a67ff['order']=qs[_0x2a90('0x44')](_0x315878[_0x2a90('0x3d')][_0x2a90('0x44')]);_0x5a67ff[_0x2a90('0x45')]=qs[_0x2a90('0x3e')](_[_0x2a90('0x46')](_0x315878['query'],_0x2edddd[_0x2a90('0x3e')]));if(_0x315878[_0x2a90('0x3d')]['filter']){_0x5a67ff[_0x2a90('0x45')]=_[_0x2a90('0x47')](_0x5a67ff[_0x2a90('0x45')],{'$or':_[_0x2a90('0x36')](_0x5a67ff['attributes'],function(_0x4fa9d3){var _0x421e80={};_0x421e80[_0x4fa9d3]={'$like':'%'+_0x315878['query'][_0x2a90('0x49')]+'%'};return _0x421e80;})});}_0x5a67ff=_[_0x2a90('0x47')]({},_0x5a67ff,_0x315878[_0x2a90('0x4a')]);return _0x148553[_0x2a90('0x5b')](_0x5a67ff);}})[_0x2a90('0x1b')](function(_0x2e3311){if(_0x2e3311){_0x4ccbc9=_0x2e3311[_0x2a90('0x4f')];if(!_0x315878['query']['hasOwnProperty'](_0x2a90('0x43'))){_0x5a67ff[_0x2a90('0x2b')]=qs[_0x2a90('0x2b')](_0x315878['query']['limit']);_0x5a67ff[_0x2a90('0x29')]=qs[_0x2a90('0x29')](_0x315878[_0x2a90('0x3d')][_0x2a90('0x29')]);}return _0x148553[_0x2a90('0x5b')](_0x5a67ff);}})[_0x2a90('0x1b')](function(_0x588952){if(_0x588952){return _0x588952?{'count':_0x4ccbc9,'rows':_0x588952}:null;}})['then'](respondWithResult(_0x5b2dfd,null))['catch'](handleError(_0x5b2dfd,null));}; \ No newline at end of file +var _0x6c1c=['merge','VIRTUAL','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','getFields','findOne','getSubjects','Dynamics365Field','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','stack','name','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x5a8e8c,_0xf66927){var _0x4a98fe=function(_0x1446dd){while(--_0x1446dd){_0x5a8e8c['push'](_0x5a8e8c['shift']());}};_0x4a98fe(++_0xf66927);}(_0x6c1c,0xcb));var _0xc6c1=function(_0x50f112,_0xd38e53){_0x50f112=_0x50f112-0x0;var _0x4ecf28=_0x6c1c[_0x50f112];return _0x4ecf28;};'use strict';var emlformat=require(_0xc6c1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc6c1('0x1'));var rp=require(_0xc6c1('0x2'));var moment=require(_0xc6c1('0x3'));var BPromise=require(_0xc6c1('0x4'));var Mustache=require(_0xc6c1('0x5'));var util=require(_0xc6c1('0x6'));var path=require(_0xc6c1('0x7'));var sox=require(_0xc6c1('0x8'));var csv=require(_0xc6c1('0x9'));var ejs=require(_0xc6c1('0xa'));var fs=require('fs');var fs_extra=require(_0xc6c1('0xb'));var _=require(_0xc6c1('0xc'));var squel=require('squel');var crypto=require(_0xc6c1('0xd'));var jsforce=require(_0xc6c1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc6c1('0x9'));var querystring=require(_0xc6c1('0xf'));var Papa=require(_0xc6c1('0x10'));var Redis=require(_0xc6c1('0x11'));var authService=require(_0xc6c1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc6c1('0x13'));var hardwareService=require(_0xc6c1('0x14'));var logger=require('../../config/logger')(_0xc6c1('0x15'));var utils=require(_0xc6c1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc6c1('0x17'));var db=require(_0xc6c1('0x18'))['db'];var jayson=require(_0xc6c1('0x19'));var client=jayson[_0xc6c1('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x254413,_0x2398d0,_0x2b6eb8,_0x2bf464){return new BPromise(function(_0x5e5c58,_0x1d3e45){var _0x3888b9=_0x2bf464||client;return _0x3888b9[_0xc6c1('0x1b')](_0x254413,_0x2b6eb8)['then'](function(_0x249c3c){logger[_0xc6c1('0x1c')](_0xc6c1('0x1d'),_0x2398d0,_0xc6c1('0x1e'));logger[_0xc6c1('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2398d0,_0xc6c1('0x1e'),JSON[_0xc6c1('0x20')](_0x249c3c));if(_0x249c3c['error']){if(_0x249c3c[_0xc6c1('0x21')][_0xc6c1('0x22')]===0x1f4){logger[_0xc6c1('0x21')](_0xc6c1('0x1d'),_0x2398d0,_0x249c3c[_0xc6c1('0x21')][_0xc6c1('0x23')]);return _0x1d3e45(_0x249c3c[_0xc6c1('0x21')][_0xc6c1('0x23')]);}logger[_0xc6c1('0x21')](_0xc6c1('0x1d'),_0x2398d0,_0x249c3c['error']['message']);return _0x5e5c58(_0x249c3c[_0xc6c1('0x21')][_0xc6c1('0x23')]);}else{logger[_0xc6c1('0x1c')](_0xc6c1('0x1d'),_0x2398d0,_0xc6c1('0x1e'));_0x5e5c58(_0x249c3c[_0xc6c1('0x24')][_0xc6c1('0x23')]);}})['catch'](function(_0x4a17aa){logger[_0xc6c1('0x21')](_0xc6c1('0x1d'),_0x2398d0,_0x4a17aa);_0x1d3e45(_0x4a17aa);});});}function respondWithStatusCode(_0x168efa,_0x28fe07){_0x28fe07=_0x28fe07||0xcc;return function(_0x43d7b7){if(_0x43d7b7){return _0x168efa[_0xc6c1('0x25')](_0x28fe07);}return _0x168efa[_0xc6c1('0x26')](_0x28fe07)[_0xc6c1('0x27')]();};}function respondWithResult(_0x192b8c,_0x2b8fff){_0x2b8fff=_0x2b8fff||0xc8;return function(_0x43c9f9){if(_0x43c9f9){return _0x192b8c[_0xc6c1('0x26')](_0x2b8fff)[_0xc6c1('0x28')](_0x43c9f9);}};}function respondWithFilteredResult(_0x3a695b,_0x2e89f8){return function(_0x4e6c5a){if(_0x4e6c5a){var _0x1a2ccb=typeof _0x2e89f8['offset']===_0xc6c1('0x29')&&typeof _0x2e89f8[_0xc6c1('0x2a')]===_0xc6c1('0x29');var _0x37d428=_0x4e6c5a[_0xc6c1('0x2b')];var _0x4f5616=_0x1a2ccb?0x0:_0x2e89f8['offset'];var _0x5cd01b=_0x1a2ccb?_0x4e6c5a[_0xc6c1('0x2b')]:_0x2e89f8[_0xc6c1('0x2c')]+_0x2e89f8[_0xc6c1('0x2a')];var _0x1f2967;if(_0x5cd01b>=_0x37d428){_0x5cd01b=_0x37d428;_0x1f2967=0xc8;}else{_0x1f2967=0xce;}_0x3a695b[_0xc6c1('0x26')](_0x1f2967);return _0x3a695b[_0xc6c1('0x2d')](_0xc6c1('0x2e'),_0x4f5616+'-'+_0x5cd01b+'/'+_0x37d428)['json'](_0x4e6c5a);}return null;};}function patchUpdates(_0x2d6fb8){return function(_0x1f780a){try{jsonpatch['apply'](_0x1f780a,_0x2d6fb8,!![]);}catch(_0x771b11){return BPromise['reject'](_0x771b11);}return _0x1f780a['save']();};}function saveUpdates(_0x4c2bab,_0x12fe7d){return function(_0x1cd047){if(_0x1cd047){return _0x1cd047[_0xc6c1('0x2f')](_0x4c2bab)[_0xc6c1('0x30')](function(_0xac9ae9){return _0xac9ae9;});}return null;};}function removeEntity(_0x36defa,_0x34bb73){return function(_0x2d1c4c){if(_0x2d1c4c){return _0x2d1c4c[_0xc6c1('0x31')]()['then'](function(){_0x36defa[_0xc6c1('0x26')](0xcc)[_0xc6c1('0x27')]();});}};}function handleEntityNotFound(_0x1ca8ad,_0x264840){return function(_0xffc1f){if(!_0xffc1f){_0x1ca8ad[_0xc6c1('0x25')](0x194);}return _0xffc1f;};}function handleError(_0x48077f,_0x2f8c6a){_0x2f8c6a=_0x2f8c6a||0x1f4;return function(_0x1e17ca){logger[_0xc6c1('0x21')](_0x1e17ca[_0xc6c1('0x32')]);if(_0x1e17ca['name']){delete _0x1e17ca[_0xc6c1('0x33')];}_0x48077f['status'](_0x2f8c6a)['send'](_0x1e17ca);};}exports[_0xc6c1('0x34')]=function(_0x5a89cc,_0x270cfd){var _0x4cc8b0={},_0x30aa8f={},_0x4f15ca={'count':0x0,'rows':[]};var _0x23513e=_['map'](db[_0xc6c1('0x35')][_0xc6c1('0x36')],function(_0x30842e){return{'name':_0x30842e[_0xc6c1('0x37')],'type':_0x30842e[_0xc6c1('0x38')][_0xc6c1('0x39')]};});_0x30aa8f[_0xc6c1('0x3a')]=_[_0xc6c1('0x3b')](_0x23513e,'name');_0x30aa8f['query']=_['keys'](_0x5a89cc[_0xc6c1('0x3c')]);_0x30aa8f['filters']=_[_0xc6c1('0x3d')](_0x30aa8f[_0xc6c1('0x3a')],_0x30aa8f[_0xc6c1('0x3c')]);_0x4cc8b0['attributes']=_['intersection'](_0x30aa8f[_0xc6c1('0x3a')],qs[_0xc6c1('0x3e')](_0x5a89cc['query'][_0xc6c1('0x3e')]));_0x4cc8b0[_0xc6c1('0x3f')]=_0x4cc8b0[_0xc6c1('0x3f')][_0xc6c1('0x40')]?_0x4cc8b0['attributes']:_0x30aa8f[_0xc6c1('0x3a')];if(!_0x5a89cc[_0xc6c1('0x3c')][_0xc6c1('0x41')](_0xc6c1('0x42'))){_0x4cc8b0['limit']=qs[_0xc6c1('0x2a')](_0x5a89cc['query'][_0xc6c1('0x2a')]);_0x4cc8b0[_0xc6c1('0x2c')]=qs['offset'](_0x5a89cc['query'][_0xc6c1('0x2c')]);}_0x4cc8b0[_0xc6c1('0x43')]=qs[_0xc6c1('0x44')](_0x5a89cc[_0xc6c1('0x3c')][_0xc6c1('0x44')]);_0x4cc8b0[_0xc6c1('0x45')]=qs[_0xc6c1('0x46')](_[_0xc6c1('0x47')](_0x5a89cc['query'],_0x30aa8f['filters']),_0x23513e);if(_0x5a89cc[_0xc6c1('0x3c')][_0xc6c1('0x48')]){_0x4cc8b0['where']=_[_0xc6c1('0x49')](_0x4cc8b0[_0xc6c1('0x45')],{'$or':_[_0xc6c1('0x3b')](_0x23513e,function(_0x175dbd){if(_0x175dbd[_0xc6c1('0x38')]!==_0xc6c1('0x4a')){var _0x253d4d={};_0x253d4d[_0x175dbd[_0xc6c1('0x33')]]={'$like':'%'+_0x5a89cc['query']['filter']+'%'};return _0x253d4d;}})});}_0x4cc8b0=_[_0xc6c1('0x49')]({},_0x4cc8b0,_0x5a89cc['options']);var _0x4f1e29={'where':_0x4cc8b0['where']};return db[_0xc6c1('0x35')][_0xc6c1('0x2b')](_0x4f1e29)[_0xc6c1('0x30')](function(_0x4e69e3){_0x4f15ca[_0xc6c1('0x2b')]=_0x4e69e3;if(_0x5a89cc[_0xc6c1('0x3c')]['includeAll']){_0x4cc8b0[_0xc6c1('0x4b')]=[{'all':!![]}];}return db[_0xc6c1('0x35')][_0xc6c1('0x4c')](_0x4cc8b0);})['then'](function(_0x387e66){_0x4f15ca[_0xc6c1('0x4d')]=_0x387e66;return _0x4f15ca;})[_0xc6c1('0x30')](respondWithFilteredResult(_0x270cfd,_0x4cc8b0))[_0xc6c1('0x4e')](handleError(_0x270cfd,null));};exports[_0xc6c1('0x4f')]=function(_0x51fc52,_0xa51f5f){var _0x6c72a9={'raw':![],'where':{'id':_0x51fc52['params']['id']}},_0x5c4178={};_0x5c4178[_0xc6c1('0x3a')]=_[_0xc6c1('0x50')](db['Dynamics365Configuration']['rawAttributes']);_0x5c4178['query']=_['keys'](_0x51fc52[_0xc6c1('0x3c')]);_0x5c4178[_0xc6c1('0x46')]=_[_0xc6c1('0x3d')](_0x5c4178['model'],_0x5c4178[_0xc6c1('0x3c')]);_0x6c72a9[_0xc6c1('0x3f')]=_['intersection'](_0x5c4178[_0xc6c1('0x3a')],qs[_0xc6c1('0x3e')](_0x51fc52[_0xc6c1('0x3c')]['fields']));_0x6c72a9[_0xc6c1('0x3f')]=_0x6c72a9[_0xc6c1('0x3f')][_0xc6c1('0x40')]?_0x6c72a9[_0xc6c1('0x3f')]:_0x5c4178['model'];if(_0x51fc52[_0xc6c1('0x3c')][_0xc6c1('0x51')]){_0x6c72a9[_0xc6c1('0x4b')]=[{'all':!![]}];}_0x6c72a9=_[_0xc6c1('0x49')]({},_0x6c72a9,_0x51fc52[_0xc6c1('0x52')]);return db[_0xc6c1('0x35')][_0xc6c1('0x53')](_0x6c72a9)[_0xc6c1('0x30')](handleEntityNotFound(_0xa51f5f,null))[_0xc6c1('0x30')](respondWithResult(_0xa51f5f,null))['catch'](handleError(_0xa51f5f,null));};exports[_0xc6c1('0x54')]=function(_0x2cbe03,_0x1a8a8e){return db[_0xc6c1('0x35')][_0xc6c1('0x54')](_0x2cbe03['body'],{})['then'](respondWithResult(_0x1a8a8e,0xc9))['catch'](handleError(_0x1a8a8e,null));};exports['update']=function(_0x35f201,_0x15ef09){if(_0x35f201[_0xc6c1('0x55')]['id']){delete _0x35f201['body']['id'];}return db[_0xc6c1('0x35')][_0xc6c1('0x53')]({'where':{'id':_0x35f201[_0xc6c1('0x56')]['id']}})['then'](handleEntityNotFound(_0x15ef09,null))['then'](saveUpdates(_0x35f201[_0xc6c1('0x55')],null))['then'](respondWithResult(_0x15ef09,null))['catch'](handleError(_0x15ef09,null));};exports['destroy']=function(_0x11b8b4,_0x52de1a){return db['Dynamics365Configuration']['find']({'where':{'id':_0x11b8b4[_0xc6c1('0x56')]['id']}})[_0xc6c1('0x30')](handleEntityNotFound(_0x52de1a,null))[_0xc6c1('0x30')](removeEntity(_0x52de1a,null))[_0xc6c1('0x4e')](handleError(_0x52de1a,null));};exports[_0xc6c1('0x57')]=function(_0x411bea,_0x5a4bce,_0x7bb23f){var _0x7095d7={};var _0x245011={};var _0x49bb9c;var _0x5abcbd;return db[_0xc6c1('0x35')][_0xc6c1('0x58')]({'where':{'id':_0x411bea[_0xc6c1('0x56')]['id']}})[_0xc6c1('0x30')](handleEntityNotFound(_0x5a4bce,null))[_0xc6c1('0x30')](function(_0x39c025){if(_0x39c025){_0x49bb9c=_0x39c025;_0x245011[_0xc6c1('0x3a')]=_[_0xc6c1('0x50')](db['Dynamics365Field'][_0xc6c1('0x36')]);_0x245011[_0xc6c1('0x3c')]=_[_0xc6c1('0x50')](_0x411bea[_0xc6c1('0x3c')]);_0x245011[_0xc6c1('0x46')]=_[_0xc6c1('0x3d')](_0x245011[_0xc6c1('0x3a')],_0x245011[_0xc6c1('0x3c')]);_0x7095d7[_0xc6c1('0x3f')]=_['intersection'](_0x245011['model'],qs[_0xc6c1('0x3e')](_0x411bea[_0xc6c1('0x3c')][_0xc6c1('0x3e')]));_0x7095d7[_0xc6c1('0x3f')]=_0x7095d7[_0xc6c1('0x3f')][_0xc6c1('0x40')]?_0x7095d7[_0xc6c1('0x3f')]:_0x245011['model'];_0x7095d7[_0xc6c1('0x43')]=qs[_0xc6c1('0x44')](_0x411bea['query']['sort']);_0x7095d7[_0xc6c1('0x45')]=qs[_0xc6c1('0x46')](_[_0xc6c1('0x47')](_0x411bea[_0xc6c1('0x3c')],_0x245011[_0xc6c1('0x46')]));if(_0x411bea[_0xc6c1('0x3c')][_0xc6c1('0x48')]){_0x7095d7['where']=_[_0xc6c1('0x49')](_0x7095d7[_0xc6c1('0x45')],{'$or':_[_0xc6c1('0x3b')](_0x7095d7[_0xc6c1('0x3f')],function(_0x54e9de){var _0x12cf34={};_0x12cf34[_0x54e9de]={'$like':'%'+_0x411bea[_0xc6c1('0x3c')][_0xc6c1('0x48')]+'%'};return _0x12cf34;})});}_0x7095d7=_[_0xc6c1('0x49')]({},_0x7095d7,_0x411bea[_0xc6c1('0x52')]);return _0x49bb9c[_0xc6c1('0x57')](_0x7095d7);}})['then'](function(_0x55383b){if(_0x55383b){_0x5abcbd=_0x55383b[_0xc6c1('0x40')];if(!_0x411bea[_0xc6c1('0x3c')]['hasOwnProperty'](_0xc6c1('0x42'))){_0x7095d7['limit']=qs[_0xc6c1('0x2a')](_0x411bea[_0xc6c1('0x3c')][_0xc6c1('0x2a')]);_0x7095d7[_0xc6c1('0x2c')]=qs['offset'](_0x411bea['query'][_0xc6c1('0x2c')]);}return _0x49bb9c['getFields'](_0x7095d7);}})['then'](function(_0x2a9670){if(_0x2a9670){return _0x2a9670?{'count':_0x5abcbd,'rows':_0x2a9670}:null;}})[_0xc6c1('0x30')](respondWithResult(_0x5a4bce,null))[_0xc6c1('0x4e')](handleError(_0x5a4bce,null));};exports[_0xc6c1('0x59')]=function(_0x72d2ec,_0x552764,_0x22774d){var _0x490fab={};var _0x63cfd3={};var _0x5ddc2d;var _0x5a8403;return db[_0xc6c1('0x35')][_0xc6c1('0x58')]({'where':{'id':_0x72d2ec[_0xc6c1('0x56')]['id']}})['then'](handleEntityNotFound(_0x552764,null))[_0xc6c1('0x30')](function(_0x31c5ad){if(_0x31c5ad){_0x5ddc2d=_0x31c5ad;_0x63cfd3[_0xc6c1('0x3a')]=_[_0xc6c1('0x50')](db[_0xc6c1('0x5a')]['rawAttributes']);_0x63cfd3[_0xc6c1('0x3c')]=_[_0xc6c1('0x50')](_0x72d2ec['query']);_0x63cfd3[_0xc6c1('0x46')]=_[_0xc6c1('0x3d')](_0x63cfd3[_0xc6c1('0x3a')],_0x63cfd3[_0xc6c1('0x3c')]);_0x490fab[_0xc6c1('0x3f')]=_['intersection'](_0x63cfd3[_0xc6c1('0x3a')],qs[_0xc6c1('0x3e')](_0x72d2ec[_0xc6c1('0x3c')][_0xc6c1('0x3e')]));_0x490fab['attributes']=_0x490fab[_0xc6c1('0x3f')][_0xc6c1('0x40')]?_0x490fab[_0xc6c1('0x3f')]:_0x63cfd3[_0xc6c1('0x3a')];_0x490fab[_0xc6c1('0x43')]=qs['sort'](_0x72d2ec[_0xc6c1('0x3c')][_0xc6c1('0x44')]);_0x490fab[_0xc6c1('0x45')]=qs[_0xc6c1('0x46')](_[_0xc6c1('0x47')](_0x72d2ec[_0xc6c1('0x3c')],_0x63cfd3[_0xc6c1('0x46')]));if(_0x72d2ec[_0xc6c1('0x3c')]['filter']){_0x490fab[_0xc6c1('0x45')]=_[_0xc6c1('0x49')](_0x490fab[_0xc6c1('0x45')],{'$or':_[_0xc6c1('0x3b')](_0x490fab[_0xc6c1('0x3f')],function(_0x1c134c){var _0x12600f={};_0x12600f[_0x1c134c]={'$like':'%'+_0x72d2ec['query'][_0xc6c1('0x48')]+'%'};return _0x12600f;})});}_0x490fab=_[_0xc6c1('0x49')]({},_0x490fab,_0x72d2ec['options']);return _0x5ddc2d[_0xc6c1('0x59')](_0x490fab);}})[_0xc6c1('0x30')](function(_0x226811){if(_0x226811){_0x5a8403=_0x226811[_0xc6c1('0x40')];if(!_0x72d2ec[_0xc6c1('0x3c')][_0xc6c1('0x41')](_0xc6c1('0x42'))){_0x490fab[_0xc6c1('0x2a')]=qs['limit'](_0x72d2ec[_0xc6c1('0x3c')]['limit']);_0x490fab[_0xc6c1('0x2c')]=qs['offset'](_0x72d2ec[_0xc6c1('0x3c')][_0xc6c1('0x2c')]);}return _0x5ddc2d[_0xc6c1('0x59')](_0x490fab);}})[_0xc6c1('0x30')](function(_0x42041f){if(_0x42041f){return _0x42041f?{'count':_0x5a8403,'rows':_0x42041f}:null;}})[_0xc6c1('0x30')](respondWithResult(_0x552764,null))['catch'](handleError(_0x552764,null));};exports['getDescriptions']=function(_0xe06296,_0x8f947a,_0x3717c5){var _0x518721={};var _0x1d006a={};var _0x39fc95;var _0x242c19;return db[_0xc6c1('0x35')][_0xc6c1('0x58')]({'where':{'id':_0xe06296['params']['id']}})['then'](handleEntityNotFound(_0x8f947a,null))['then'](function(_0x13639c){if(_0x13639c){_0x39fc95=_0x13639c;_0x1d006a[_0xc6c1('0x3a')]=_[_0xc6c1('0x50')](db[_0xc6c1('0x5a')][_0xc6c1('0x36')]);_0x1d006a[_0xc6c1('0x3c')]=_[_0xc6c1('0x50')](_0xe06296[_0xc6c1('0x3c')]);_0x1d006a[_0xc6c1('0x46')]=_[_0xc6c1('0x3d')](_0x1d006a[_0xc6c1('0x3a')],_0x1d006a[_0xc6c1('0x3c')]);_0x518721[_0xc6c1('0x3f')]=_['intersection'](_0x1d006a[_0xc6c1('0x3a')],qs[_0xc6c1('0x3e')](_0xe06296['query'][_0xc6c1('0x3e')]));_0x518721['attributes']=_0x518721[_0xc6c1('0x3f')][_0xc6c1('0x40')]?_0x518721[_0xc6c1('0x3f')]:_0x1d006a['model'];_0x518721['order']=qs[_0xc6c1('0x44')](_0xe06296[_0xc6c1('0x3c')]['sort']);_0x518721[_0xc6c1('0x45')]=qs['filters'](_[_0xc6c1('0x47')](_0xe06296[_0xc6c1('0x3c')],_0x1d006a[_0xc6c1('0x46')]));if(_0xe06296[_0xc6c1('0x3c')][_0xc6c1('0x48')]){_0x518721[_0xc6c1('0x45')]=_[_0xc6c1('0x49')](_0x518721[_0xc6c1('0x45')],{'$or':_['map'](_0x518721[_0xc6c1('0x3f')],function(_0x2f6d89){var _0xbc55ab={};_0xbc55ab[_0x2f6d89]={'$like':'%'+_0xe06296[_0xc6c1('0x3c')]['filter']+'%'};return _0xbc55ab;})});}_0x518721=_[_0xc6c1('0x49')]({},_0x518721,_0xe06296[_0xc6c1('0x52')]);return _0x39fc95[_0xc6c1('0x5b')](_0x518721);}})[_0xc6c1('0x30')](function(_0x22320b){if(_0x22320b){_0x242c19=_0x22320b['length'];if(!_0xe06296[_0xc6c1('0x3c')][_0xc6c1('0x41')](_0xc6c1('0x42'))){_0x518721[_0xc6c1('0x2a')]=qs[_0xc6c1('0x2a')](_0xe06296[_0xc6c1('0x3c')]['limit']);_0x518721['offset']=qs[_0xc6c1('0x2c')](_0xe06296[_0xc6c1('0x3c')][_0xc6c1('0x2c')]);}return _0x39fc95[_0xc6c1('0x5b')](_0x518721);}})[_0xc6c1('0x30')](function(_0x47c1dc){if(_0x47c1dc){return _0x47c1dc?{'count':_0x242c19,'rows':_0x47c1dc}:null;}})[_0xc6c1('0x30')](respondWithResult(_0x8f947a,null))[_0xc6c1('0x4e')](handleError(_0x8f947a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index dc6c5a9..6d042be 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 _0xaa5b=['define','Dynamics365Configuration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xaa5b,0x16e));var _0xbaa5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa5b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa5('0x0'));var util=require(_0xbaa5('0x1'));var logger=require(_0xbaa5('0x2'))(_0xbaa5('0x3'));var moment=require(_0xbaa5('0x4'));var BPromise=require(_0xbaa5('0x5'));var rp=require(_0xbaa5('0x6'));var fs=require('fs');var path=require(_0xbaa5('0x7'));var rimraf=require(_0xbaa5('0x8'));var config=require('../../config/environment');var attributes=require(_0xbaa5('0x9'));module[_0xbaa5('0xa')]=function(_0x1b7df4,_0xab8e14){return _0x1b7df4[_0xbaa5('0xb')](_0xbaa5('0xc'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb902=['./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x73971d,_0x3e675f){var _0x4217fb=function(_0x571599){while(--_0x571599){_0x73971d['push'](_0x73971d['shift']());}};_0x4217fb(++_0x3e675f);}(_0xb902,0x1f3));var _0x2b90=function(_0x86ad94,_0x434438){_0x86ad94=_0x86ad94-0x0;var _0x46b990=_0xb902[_0x86ad94];return _0x46b990;};'use strict';var _=require(_0x2b90('0x0'));var util=require('util');var logger=require(_0x2b90('0x1'))(_0x2b90('0x2'));var moment=require(_0x2b90('0x3'));var BPromise=require(_0x2b90('0x4'));var rp=require(_0x2b90('0x5'));var fs=require('fs');var path=require(_0x2b90('0x6'));var rimraf=require(_0x2b90('0x7'));var config=require('../../config/environment');var attributes=require(_0x2b90('0x8'));module[_0x2b90('0x9')]=function(_0x21457b,_0x28a554){return _0x21457b[_0x2b90('0xa')](_0x2b90('0xb'),attributes,{'tableName':_0x2b90('0xc'),'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 a4260aa..bfe094a 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 _0x2bf2=['../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','bluebird','randomstring','../../mysqldb','rpc'];(function(_0xb905fe,_0x123c76){var _0x497fb4=function(_0x48c368){while(--_0x48c368){_0xb905fe['push'](_0xb905fe['shift']());}};_0x497fb4(++_0x123c76);}(_0x2bf2,0x1e2));var _0x22bf=function(_0x4ff78a,_0x15a6cd){_0x4ff78a=_0x4ff78a-0x0;var _0x3efdaf=_0x2bf2[_0x4ff78a];return _0x3efdaf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x22bf('0x0'));var rs=require(_0x22bf('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22bf('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22bf('0x3'));var config=require(_0x22bf('0x4'));var jayson=require(_0x22bf('0x5'));var client=jayson[_0x22bf('0x6')][_0x22bf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f8516,_0x536915,_0x5f00ab){return new BPromise(function(_0x2ce679,_0x3ef909){return client['request'](_0x3f8516,_0x5f00ab)[_0x22bf('0x8')](function(_0x45333b){logger[_0x22bf('0x9')](_0x22bf('0xa'),_0x536915,_0x22bf('0xb'));logger[_0x22bf('0xc')](_0x22bf('0xd'),_0x536915,_0x22bf('0xb'),JSON[_0x22bf('0xe')](_0x45333b));if(_0x45333b[_0x22bf('0xf')]){if(_0x45333b[_0x22bf('0xf')]['code']===0x1f4){logger[_0x22bf('0xf')](_0x22bf('0xa'),_0x536915,_0x45333b[_0x22bf('0xf')][_0x22bf('0x10')]);return _0x3ef909(_0x45333b[_0x22bf('0xf')][_0x22bf('0x10')]);}logger[_0x22bf('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x536915,_0x45333b['error']['message']);return _0x2ce679(_0x45333b[_0x22bf('0xf')][_0x22bf('0x10')]);}else{logger[_0x22bf('0x9')](_0x22bf('0xa'),_0x536915,_0x22bf('0xb'));_0x2ce679(_0x45333b[_0x22bf('0x11')][_0x22bf('0x10')]);}})['catch'](function(_0x2c5097){logger[_0x22bf('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x536915,_0x2c5097);_0x3ef909(_0x2c5097);});});} \ No newline at end of file +var _0x0e08=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2a0afb,_0x221e51){var _0x537b6b=function(_0x8ba2d5){while(--_0x8ba2d5){_0x2a0afb['push'](_0x2a0afb['shift']());}};_0x537b6b(++_0x221e51);}(_0x0e08,0xdf));var _0x80e0=function(_0x3ef754,_0x375a0d){_0x3ef754=_0x3ef754-0x0;var _0x280bf0=_0x0e08[_0x3ef754];return _0x280bf0;};'use strict';var _=require(_0x80e0('0x0'));var util=require(_0x80e0('0x1'));var moment=require(_0x80e0('0x2'));var BPromise=require(_0x80e0('0x3'));var rs=require(_0x80e0('0x4'));var fs=require('fs');var Redis=require(_0x80e0('0x5'));var db=require(_0x80e0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x80e0('0x7'))(_0x80e0('0x8'));var config=require(_0x80e0('0x9'));var jayson=require(_0x80e0('0xa'));var client=jayson[_0x80e0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546cca,_0x1dfb09,_0x201ddd){return new BPromise(function(_0x3b8a64,_0x1b1449){return client['request'](_0x546cca,_0x201ddd)[_0x80e0('0xc')](function(_0x2bcd22){logger[_0x80e0('0xd')](_0x80e0('0xe'),_0x1dfb09,_0x80e0('0xf'));logger[_0x80e0('0x10')](_0x80e0('0x11'),_0x1dfb09,'request\x20sent',JSON[_0x80e0('0x12')](_0x2bcd22));if(_0x2bcd22[_0x80e0('0x13')]){if(_0x2bcd22['error']['code']===0x1f4){logger[_0x80e0('0x13')](_0x80e0('0xe'),_0x1dfb09,_0x2bcd22[_0x80e0('0x13')]['message']);return _0x1b1449(_0x2bcd22[_0x80e0('0x13')][_0x80e0('0x14')]);}logger[_0x80e0('0x13')](_0x80e0('0xe'),_0x1dfb09,_0x2bcd22[_0x80e0('0x13')][_0x80e0('0x14')]);return _0x3b8a64(_0x2bcd22[_0x80e0('0x13')][_0x80e0('0x14')]);}else{logger[_0x80e0('0xd')](_0x80e0('0xe'),_0x1dfb09,_0x80e0('0xf'));_0x3b8a64(_0x2bcd22[_0x80e0('0x15')][_0x80e0('0x14')]);}})[_0x80e0('0x16')](function(_0x2acd50){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1dfb09,_0x2acd50);_0x1b1449(_0x2acd50);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 550b3e8..bc428e5 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 _0xc874=['put','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show'];(function(_0x259341,_0x1cc3a2){var _0x54b951=function(_0x571847){while(--_0x571847){_0x259341['push'](_0x259341['shift']());}};_0x54b951(++_0x1cc3a2);}(_0xc874,0x154));var _0x4c87=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xc874[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),auth[_0x4c87('0xa')](),controller[_0x4c87('0xb')]);router['post']('/',auth[_0x4c87('0xa')](),controller['create']);router[_0x4c87('0xc')](_0x4c87('0x9'),auth[_0x4c87('0xa')](),controller[_0x4c87('0xd')]);router[_0x4c87('0xe')]('/:id',auth[_0x4c87('0xa')](),controller[_0x4c87('0xf')]);module['exports']=router; \ No newline at end of file +var _0x05c2=['./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x48a81d,_0x2b3d9e){var _0x19699a=function(_0x117ebf){while(--_0x117ebf){_0x48a81d['push'](_0x48a81d['shift']());}};_0x19699a(++_0x2b3d9e);}(_0x05c2,0x174));var _0x205c=function(_0x145deb,_0x6968fd){_0x145deb=_0x145deb-0x0;var _0x57f43a=_0x05c2[_0x145deb];return _0x57f43a;};'use strict';var multer=require(_0x205c('0x0'));var util=require(_0x205c('0x1'));var path=require('path');var timeout=require(_0x205c('0x2'));var express=require(_0x205c('0x3'));var router=express[_0x205c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x205c('0x5'));var interaction=require(_0x205c('0x6'));var config=require(_0x205c('0x7'));var controller=require(_0x205c('0x8'));router[_0x205c('0x9')]('/',auth[_0x205c('0xa')](),controller['index']);router[_0x205c('0x9')](_0x205c('0xb'),auth[_0x205c('0xa')](),controller[_0x205c('0xc')]);router[_0x205c('0xd')]('/',auth['isAuthenticated'](),controller[_0x205c('0xe')]);router[_0x205c('0xf')](_0x205c('0xb'),auth[_0x205c('0xa')](),controller[_0x205c('0x10')]);router[_0x205c('0x11')](_0x205c('0xb'),auth[_0x205c('0xa')](),controller[_0x205c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ee1cfc3..a2e5e4d 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 _0x6f47=['ENUM','variable','keyValue','string','STRING','customVariable','BOOLEAN','exports'];(function(_0x1e8eb4,_0x53a726){var _0x3e3e6e=function(_0x29dbf3){while(--_0x29dbf3){_0x1e8eb4['push'](_0x1e8eb4['shift']());}};_0x3e3e6e(++_0x53a726);}(_0x6f47,0xc7));var _0x76f4=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x6f47[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'type':{'type':Sequelize[_0x76f4('0x1')]('string',_0x76f4('0x2'),'customVariable',_0x76f4('0x3'),'picklist'),'defaultValue':_0x76f4('0x4')},'content':{'type':Sequelize[_0x76f4('0x5')]},'key':{'type':Sequelize[_0x76f4('0x5')]},'keyType':{'type':Sequelize[_0x76f4('0x1')]('string',_0x76f4('0x2'),_0x76f4('0x6'))},'keyContent':{'type':Sequelize[_0x76f4('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x76f4('0x5')]},'customField':{'type':Sequelize[_0x76f4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x76f4('0x5')]}}; \ No newline at end of file +var _0xf072=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x13610a,_0x4f866c){var _0x150ecc=function(_0x383f46){while(--_0x383f46){_0x13610a['push'](_0x13610a['shift']());}};_0x150ecc(++_0x4f866c);}(_0xf072,0x1cf));var _0x2f07=function(_0xb1d0fa,_0x56e67d){_0xb1d0fa=_0xb1d0fa-0x0;var _0x4b25fa=_0xf072[_0xb1d0fa];return _0x4b25fa;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'type':{'type':Sequelize[_0x2f07('0x2')]('string',_0x2f07('0x3'),'customVariable',_0x2f07('0x4'),_0x2f07('0x5')),'defaultValue':_0x2f07('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2f07('0x7')]},'keyType':{'type':Sequelize[_0x2f07('0x2')](_0x2f07('0x6'),_0x2f07('0x3'),_0x2f07('0x8'))},'keyContent':{'type':Sequelize[_0x2f07('0x7')]},'idField':{'type':Sequelize[_0x2f07('0x7')]},'nameField':{'type':Sequelize[_0x2f07('0x7')]},'customField':{'type':Sequelize[_0x2f07('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2f07('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 33aa398..9722c6e 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 _0x335a=['VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','rows','catch','show','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','save','then','destroy','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','model','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x335a,0x1e1));var _0xa335=function(_0x370998,_0x2d271d){_0x370998=_0x370998-0x0;var _0x1864ea=_0x335a[_0x370998];return _0x1864ea;};'use strict';var emlformat=require(_0xa335('0x0'));var rimraf=require(_0xa335('0x1'));var zipdir=require(_0xa335('0x2'));var jsonpatch=require(_0xa335('0x3'));var rp=require(_0xa335('0x4'));var moment=require('moment');var BPromise=require(_0xa335('0x5'));var Mustache=require(_0xa335('0x6'));var util=require(_0xa335('0x7'));var path=require(_0xa335('0x8'));var sox=require(_0xa335('0x9'));var csv=require(_0xa335('0xa'));var ejs=require(_0xa335('0xb'));var fs=require('fs');var fs_extra=require(_0xa335('0xc'));var _=require(_0xa335('0xd'));var squel=require(_0xa335('0xe'));var crypto=require(_0xa335('0xf'));var jsforce=require(_0xa335('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa335('0xa'));var querystring=require(_0xa335('0x11'));var Papa=require(_0xa335('0x12'));var Redis=require(_0xa335('0x13'));var authService=require(_0xa335('0x14'));var qs=require(_0xa335('0x15'));var as=require(_0xa335('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa335('0x17'))(_0xa335('0x18'));var utils=require(_0xa335('0x19'));var config=require(_0xa335('0x1a'));var licenseUtil=require(_0xa335('0x1b'));var db=require(_0xa335('0x1c'))['db'];function respondWithStatusCode(_0x11cec5,_0x318413){_0x318413=_0x318413||0xcc;return function(_0x2db0cf){if(_0x2db0cf){return _0x11cec5[_0xa335('0x1d')](_0x318413);}return _0x11cec5[_0xa335('0x1e')](_0x318413)[_0xa335('0x1f')]();};}function respondWithResult(_0x4cab82,_0x1fdfc0){_0x1fdfc0=_0x1fdfc0||0xc8;return function(_0x24446b){if(_0x24446b){return _0x4cab82[_0xa335('0x1e')](_0x1fdfc0)[_0xa335('0x20')](_0x24446b);}};}function respondWithFilteredResult(_0x484ca6,_0x5be433){return function(_0x1a6da2){if(_0x1a6da2){var _0x57fd27=typeof _0x5be433[_0xa335('0x21')]===_0xa335('0x22')&&typeof _0x5be433['limit']===_0xa335('0x22');var _0x246fa3=_0x1a6da2[_0xa335('0x23')];var _0x176f5e=_0x57fd27?0x0:_0x5be433[_0xa335('0x21')];var _0x8cd019=_0x57fd27?_0x1a6da2[_0xa335('0x23')]:_0x5be433[_0xa335('0x21')]+_0x5be433['limit'];var _0x131468;if(_0x8cd019>=_0x246fa3){_0x8cd019=_0x246fa3;_0x131468=0xc8;}else{_0x131468=0xce;}_0x484ca6[_0xa335('0x1e')](_0x131468);return _0x484ca6[_0xa335('0x24')]('Content-Range',_0x176f5e+'-'+_0x8cd019+'/'+_0x246fa3)[_0xa335('0x20')](_0x1a6da2);}return null;};}function patchUpdates(_0x4e96ce){return function(_0x10e00a){try{jsonpatch['apply'](_0x10e00a,_0x4e96ce,!![]);}catch(_0x3cd05b){return BPromise[_0xa335('0x25')](_0x3cd05b);}return _0x10e00a[_0xa335('0x26')]();};}function saveUpdates(_0x533781,_0x28c4ab){return function(_0x15c0ca){if(_0x15c0ca){return _0x15c0ca['update'](_0x533781)[_0xa335('0x27')](function(_0x4eeeeb){return _0x4eeeeb;});}return null;};}function removeEntity(_0x3156ae,_0xc823){return function(_0x2d9941){if(_0x2d9941){return _0x2d9941[_0xa335('0x28')]()['then'](function(){_0x3156ae[_0xa335('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44bc22,_0x453afb){return function(_0x38f6c8){if(!_0x38f6c8){_0x44bc22[_0xa335('0x1d')](0x194);}return _0x38f6c8;};}function handleError(_0x8c34fb,_0x554191){_0x554191=_0x554191||0x1f4;return function(_0x41e2af){logger['error'](_0x41e2af[_0xa335('0x29')]);if(_0x41e2af[_0xa335('0x2a')]){delete _0x41e2af[_0xa335('0x2a')];}_0x8c34fb[_0xa335('0x1e')](_0x554191)[_0xa335('0x2b')](_0x41e2af);};}exports[_0xa335('0x2c')]=function(_0x3f0127,_0x2fe7be){var _0x18f87e={},_0x928e06={},_0x2dd75e={'count':0x0,'rows':[]};var _0x4ca81b=_['map'](db['Dynamics365Field'][_0xa335('0x2d')],function(_0x592039){return{'name':_0x592039['fieldName'],'type':_0x592039[_0xa335('0x2e')][_0xa335('0x2f')]};});_0x928e06['model']=_[_0xa335('0x30')](_0x4ca81b,_0xa335('0x2a'));_0x928e06[_0xa335('0x31')]=_[_0xa335('0x32')](_0x3f0127[_0xa335('0x31')]);_0x928e06['filters']=_[_0xa335('0x33')](_0x928e06['model'],_0x928e06[_0xa335('0x31')]);_0x18f87e[_0xa335('0x34')]=_[_0xa335('0x33')](_0x928e06['model'],qs['fields'](_0x3f0127[_0xa335('0x31')][_0xa335('0x35')]));_0x18f87e[_0xa335('0x34')]=_0x18f87e['attributes']['length']?_0x18f87e[_0xa335('0x34')]:_0x928e06[_0xa335('0x36')];if(!_0x3f0127['query'][_0xa335('0x37')](_0xa335('0x38'))){_0x18f87e[_0xa335('0x39')]=qs[_0xa335('0x39')](_0x3f0127[_0xa335('0x31')][_0xa335('0x39')]);_0x18f87e[_0xa335('0x21')]=qs['offset'](_0x3f0127['query'][_0xa335('0x21')]);}_0x18f87e[_0xa335('0x3a')]=qs[_0xa335('0x3b')](_0x3f0127[_0xa335('0x31')][_0xa335('0x3b')]);_0x18f87e['where']=qs[_0xa335('0x3c')](_[_0xa335('0x3d')](_0x3f0127[_0xa335('0x31')],_0x928e06[_0xa335('0x3c')]),_0x4ca81b);if(_0x3f0127[_0xa335('0x31')][_0xa335('0x3e')]){_0x18f87e[_0xa335('0x3f')]=_[_0xa335('0x40')](_0x18f87e['where'],{'$or':_['map'](_0x4ca81b,function(_0x21c8b4){if(_0x21c8b4[_0xa335('0x2e')]!==_0xa335('0x41')){var _0x3cd8b4={};_0x3cd8b4[_0x21c8b4[_0xa335('0x2a')]]={'$like':'%'+_0x3f0127[_0xa335('0x31')][_0xa335('0x3e')]+'%'};return _0x3cd8b4;}})});}_0x18f87e=_[_0xa335('0x40')]({},_0x18f87e,_0x3f0127[_0xa335('0x42')]);var _0x4e7227={'where':_0x18f87e['where']};return db[_0xa335('0x43')][_0xa335('0x23')](_0x4e7227)['then'](function(_0x3c4ba9){_0x2dd75e[_0xa335('0x23')]=_0x3c4ba9;if(_0x3f0127[_0xa335('0x31')][_0xa335('0x44')]){_0x18f87e[_0xa335('0x45')]=[{'all':!![]}];}return db[_0xa335('0x43')][_0xa335('0x46')](_0x18f87e);})['then'](function(_0x4370f2){_0x2dd75e[_0xa335('0x47')]=_0x4370f2;return _0x2dd75e;})[_0xa335('0x27')](respondWithFilteredResult(_0x2fe7be,_0x18f87e))[_0xa335('0x48')](handleError(_0x2fe7be,null));};exports[_0xa335('0x49')]=function(_0x4044e6,_0x2644f9){var _0x1268d8={'raw':!![],'where':{'id':_0x4044e6['params']['id']}},_0x3293f={};_0x3293f[_0xa335('0x36')]=_[_0xa335('0x32')](db[_0xa335('0x43')][_0xa335('0x2d')]);_0x3293f[_0xa335('0x31')]=_[_0xa335('0x32')](_0x4044e6['query']);_0x3293f[_0xa335('0x3c')]=_[_0xa335('0x33')](_0x3293f[_0xa335('0x36')],_0x3293f[_0xa335('0x31')]);_0x1268d8['attributes']=_['intersection'](_0x3293f['model'],qs[_0xa335('0x35')](_0x4044e6[_0xa335('0x31')]['fields']));_0x1268d8[_0xa335('0x34')]=_0x1268d8[_0xa335('0x34')]['length']?_0x1268d8[_0xa335('0x34')]:_0x3293f[_0xa335('0x36')];if(_0x4044e6[_0xa335('0x31')][_0xa335('0x44')]){_0x1268d8[_0xa335('0x45')]=[{'all':!![]}];}_0x1268d8=_[_0xa335('0x40')]({},_0x1268d8,_0x4044e6[_0xa335('0x42')]);return db['Dynamics365Field']['find'](_0x1268d8)[_0xa335('0x27')](handleEntityNotFound(_0x2644f9,null))[_0xa335('0x27')](respondWithResult(_0x2644f9,null))[_0xa335('0x48')](handleError(_0x2644f9,null));};exports[_0xa335('0x4a')]=function(_0x51e48d,_0x4ea07b){return db['Dynamics365Field'][_0xa335('0x4a')](_0x51e48d[_0xa335('0x4b')],{})[_0xa335('0x27')](respondWithResult(_0x4ea07b,0xc9))[_0xa335('0x48')](handleError(_0x4ea07b,null));};exports[_0xa335('0x4c')]=function(_0xabd2a1,_0xdf4d8b){if(_0xabd2a1[_0xa335('0x4b')]['id']){delete _0xabd2a1[_0xa335('0x4b')]['id'];}return db[_0xa335('0x43')]['find']({'where':{'id':_0xabd2a1['params']['id']}})[_0xa335('0x27')](handleEntityNotFound(_0xdf4d8b,null))['then'](saveUpdates(_0xabd2a1[_0xa335('0x4b')],null))[_0xa335('0x27')](respondWithResult(_0xdf4d8b,null))[_0xa335('0x48')](handleError(_0xdf4d8b,null));};exports[_0xa335('0x28')]=function(_0x46f39c,_0x1d5835){return db[_0xa335('0x43')]['find']({'where':{'id':_0x46f39c[_0xa335('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d5835,null))[_0xa335('0x27')](removeEntity(_0x1d5835,null))[_0xa335('0x48')](handleError(_0x1d5835,null));}; \ No newline at end of file +var _0xf69a=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','Dynamics365Field','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','merge','where','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf69a,0xcc));var _0xaf69=function(_0x4057ca,_0xbe5390){_0x4057ca=_0x4057ca-0x0;var _0x20f2ea=_0xf69a[_0x4057ca];return _0x20f2ea;};'use strict';var emlformat=require(_0xaf69('0x0'));var rimraf=require(_0xaf69('0x1'));var zipdir=require(_0xaf69('0x2'));var jsonpatch=require(_0xaf69('0x3'));var rp=require(_0xaf69('0x4'));var moment=require(_0xaf69('0x5'));var BPromise=require(_0xaf69('0x6'));var Mustache=require('mustache');var util=require(_0xaf69('0x7'));var path=require(_0xaf69('0x8'));var sox=require('sox');var csv=require(_0xaf69('0x9'));var ejs=require(_0xaf69('0xa'));var fs=require('fs');var fs_extra=require(_0xaf69('0xb'));var _=require(_0xaf69('0xc'));var squel=require('squel');var crypto=require(_0xaf69('0xd'));var jsforce=require(_0xaf69('0xe'));var deskjs=require(_0xaf69('0xf'));var toCsv=require(_0xaf69('0x9'));var querystring=require(_0xaf69('0x10'));var Papa=require(_0xaf69('0x11'));var Redis=require(_0xaf69('0x12'));var authService=require(_0xaf69('0x13'));var qs=require(_0xaf69('0x14'));var as=require(_0xaf69('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf69('0x16'))(_0xaf69('0x17'));var utils=require(_0xaf69('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaf69('0x19'))['db'];function respondWithStatusCode(_0x3e119c,_0x234dcc){_0x234dcc=_0x234dcc||0xcc;return function(_0x4fb9b5){if(_0x4fb9b5){return _0x3e119c[_0xaf69('0x1a')](_0x234dcc);}return _0x3e119c[_0xaf69('0x1b')](_0x234dcc)['end']();};}function respondWithResult(_0x4a14ae,_0x416a93){_0x416a93=_0x416a93||0xc8;return function(_0x176e23){if(_0x176e23){return _0x4a14ae[_0xaf69('0x1b')](_0x416a93)[_0xaf69('0x1c')](_0x176e23);}};}function respondWithFilteredResult(_0x3a3d4b,_0x137c1d){return function(_0x31873b){if(_0x31873b){var _0x52f24e=typeof _0x137c1d[_0xaf69('0x1d')]===_0xaf69('0x1e')&&typeof _0x137c1d[_0xaf69('0x1f')]===_0xaf69('0x1e');var _0x4f9e80=_0x31873b[_0xaf69('0x20')];var _0x4b2fba=_0x52f24e?0x0:_0x137c1d['offset'];var _0x1afc88=_0x52f24e?_0x31873b[_0xaf69('0x20')]:_0x137c1d['offset']+_0x137c1d[_0xaf69('0x1f')];var _0x63fae0;if(_0x1afc88>=_0x4f9e80){_0x1afc88=_0x4f9e80;_0x63fae0=0xc8;}else{_0x63fae0=0xce;}_0x3a3d4b[_0xaf69('0x1b')](_0x63fae0);return _0x3a3d4b[_0xaf69('0x21')](_0xaf69('0x22'),_0x4b2fba+'-'+_0x1afc88+'/'+_0x4f9e80)[_0xaf69('0x1c')](_0x31873b);}return null;};}function patchUpdates(_0x506934){return function(_0x4bf110){try{jsonpatch['apply'](_0x4bf110,_0x506934,!![]);}catch(_0x2de768){return BPromise[_0xaf69('0x23')](_0x2de768);}return _0x4bf110[_0xaf69('0x24')]();};}function saveUpdates(_0x3971b7,_0x35c017){return function(_0x42fcbb){if(_0x42fcbb){return _0x42fcbb[_0xaf69('0x25')](_0x3971b7)['then'](function(_0x2defc6){return _0x2defc6;});}return null;};}function removeEntity(_0x1d00a3,_0x297a2f){return function(_0x2f213d){if(_0x2f213d){return _0x2f213d[_0xaf69('0x26')]()[_0xaf69('0x27')](function(){_0x1d00a3[_0xaf69('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cccf0,_0x7f4fe7){return function(_0x5bfe1e){if(!_0x5bfe1e){_0x4cccf0['sendStatus'](0x194);}return _0x5bfe1e;};}function handleError(_0x2d4b86,_0x4ac1ee){_0x4ac1ee=_0x4ac1ee||0x1f4;return function(_0x414166){logger[_0xaf69('0x28')](_0x414166['stack']);if(_0x414166[_0xaf69('0x29')]){delete _0x414166['name'];}_0x2d4b86[_0xaf69('0x1b')](_0x4ac1ee)[_0xaf69('0x2a')](_0x414166);};}exports[_0xaf69('0x2b')]=function(_0x1e4a52,_0x3b6a9d){var _0x284d13={},_0x436985={},_0x24de11={'count':0x0,'rows':[]};var _0x304c14=_[_0xaf69('0x2c')](db[_0xaf69('0x2d')][_0xaf69('0x2e')],function(_0x5137e4){return{'name':_0x5137e4['fieldName'],'type':_0x5137e4['type'][_0xaf69('0x2f')]};});_0x436985[_0xaf69('0x30')]=_[_0xaf69('0x2c')](_0x304c14,_0xaf69('0x29'));_0x436985[_0xaf69('0x31')]=_[_0xaf69('0x32')](_0x1e4a52[_0xaf69('0x31')]);_0x436985[_0xaf69('0x33')]=_[_0xaf69('0x34')](_0x436985[_0xaf69('0x30')],_0x436985[_0xaf69('0x31')]);_0x284d13[_0xaf69('0x35')]=_[_0xaf69('0x34')](_0x436985[_0xaf69('0x30')],qs[_0xaf69('0x36')](_0x1e4a52[_0xaf69('0x31')][_0xaf69('0x36')]));_0x284d13[_0xaf69('0x35')]=_0x284d13[_0xaf69('0x35')][_0xaf69('0x37')]?_0x284d13[_0xaf69('0x35')]:_0x436985['model'];if(!_0x1e4a52['query']['hasOwnProperty'](_0xaf69('0x38'))){_0x284d13[_0xaf69('0x1f')]=qs[_0xaf69('0x1f')](_0x1e4a52[_0xaf69('0x31')][_0xaf69('0x1f')]);_0x284d13[_0xaf69('0x1d')]=qs[_0xaf69('0x1d')](_0x1e4a52[_0xaf69('0x31')][_0xaf69('0x1d')]);}_0x284d13[_0xaf69('0x39')]=qs[_0xaf69('0x3a')](_0x1e4a52[_0xaf69('0x31')][_0xaf69('0x3a')]);_0x284d13['where']=qs['filters'](_['pick'](_0x1e4a52[_0xaf69('0x31')],_0x436985[_0xaf69('0x33')]),_0x304c14);if(_0x1e4a52[_0xaf69('0x31')][_0xaf69('0x3b')]){_0x284d13['where']=_[_0xaf69('0x3c')](_0x284d13[_0xaf69('0x3d')],{'$or':_[_0xaf69('0x2c')](_0x304c14,function(_0x55886f){if(_0x55886f['type']!=='VIRTUAL'){var _0x1fa792={};_0x1fa792[_0x55886f[_0xaf69('0x29')]]={'$like':'%'+_0x1e4a52[_0xaf69('0x31')][_0xaf69('0x3b')]+'%'};return _0x1fa792;}})});}_0x284d13=_[_0xaf69('0x3c')]({},_0x284d13,_0x1e4a52[_0xaf69('0x3e')]);var _0x3dfd04={'where':_0x284d13[_0xaf69('0x3d')]};return db[_0xaf69('0x2d')][_0xaf69('0x20')](_0x3dfd04)['then'](function(_0x27682c){_0x24de11[_0xaf69('0x20')]=_0x27682c;if(_0x1e4a52[_0xaf69('0x31')][_0xaf69('0x3f')]){_0x284d13['include']=[{'all':!![]}];}return db[_0xaf69('0x2d')][_0xaf69('0x40')](_0x284d13);})[_0xaf69('0x27')](function(_0x3a7e7f){_0x24de11[_0xaf69('0x41')]=_0x3a7e7f;return _0x24de11;})[_0xaf69('0x27')](respondWithFilteredResult(_0x3b6a9d,_0x284d13))[_0xaf69('0x42')](handleError(_0x3b6a9d,null));};exports[_0xaf69('0x43')]=function(_0x554e6e,_0xfaba51){var _0x2b7dbb={'raw':!![],'where':{'id':_0x554e6e[_0xaf69('0x44')]['id']}},_0x3febc7={};_0x3febc7[_0xaf69('0x30')]=_['keys'](db[_0xaf69('0x2d')][_0xaf69('0x2e')]);_0x3febc7[_0xaf69('0x31')]=_['keys'](_0x554e6e[_0xaf69('0x31')]);_0x3febc7[_0xaf69('0x33')]=_[_0xaf69('0x34')](_0x3febc7[_0xaf69('0x30')],_0x3febc7['query']);_0x2b7dbb[_0xaf69('0x35')]=_[_0xaf69('0x34')](_0x3febc7[_0xaf69('0x30')],qs[_0xaf69('0x36')](_0x554e6e[_0xaf69('0x31')][_0xaf69('0x36')]));_0x2b7dbb[_0xaf69('0x35')]=_0x2b7dbb[_0xaf69('0x35')][_0xaf69('0x37')]?_0x2b7dbb[_0xaf69('0x35')]:_0x3febc7[_0xaf69('0x30')];if(_0x554e6e[_0xaf69('0x31')][_0xaf69('0x3f')]){_0x2b7dbb[_0xaf69('0x45')]=[{'all':!![]}];}_0x2b7dbb=_[_0xaf69('0x3c')]({},_0x2b7dbb,_0x554e6e[_0xaf69('0x3e')]);return db[_0xaf69('0x2d')]['find'](_0x2b7dbb)[_0xaf69('0x27')](handleEntityNotFound(_0xfaba51,null))[_0xaf69('0x27')](respondWithResult(_0xfaba51,null))[_0xaf69('0x42')](handleError(_0xfaba51,null));};exports[_0xaf69('0x46')]=function(_0x16eb21,_0x386c50){return db[_0xaf69('0x2d')]['create'](_0x16eb21['body'],{})[_0xaf69('0x27')](respondWithResult(_0x386c50,0xc9))['catch'](handleError(_0x386c50,null));};exports[_0xaf69('0x25')]=function(_0x1be3d1,_0x566deb){if(_0x1be3d1[_0xaf69('0x47')]['id']){delete _0x1be3d1[_0xaf69('0x47')]['id'];}return db[_0xaf69('0x2d')][_0xaf69('0x48')]({'where':{'id':_0x1be3d1[_0xaf69('0x44')]['id']}})[_0xaf69('0x27')](handleEntityNotFound(_0x566deb,null))['then'](saveUpdates(_0x1be3d1[_0xaf69('0x47')],null))[_0xaf69('0x27')](respondWithResult(_0x566deb,null))[_0xaf69('0x42')](handleError(_0x566deb,null));};exports[_0xaf69('0x26')]=function(_0xe9721b,_0x10c293){return db[_0xaf69('0x2d')][_0xaf69('0x48')]({'where':{'id':_0xe9721b['params']['id']}})[_0xaf69('0x27')](handleEntityNotFound(_0x10c293,null))['then'](removeEntity(_0x10c293,null))[_0xaf69('0x42')](handleError(_0x10c293,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 20bd1d6..164ff11 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 _0x6d33=['dynamics365_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','define','int_dynamics365_fields'];(function(_0x30105f,_0xf51ccd){var _0x17759e=function(_0x5d785d){while(--_0x5d785d){_0x30105f['push'](_0x30105f['shift']());}};_0x17759e(++_0xf51ccd);}(_0x6d33,0x1e3));var _0x36d3=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x6d33[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require(_0x36d3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x36d3('0x1'));var moment=require(_0x36d3('0x2'));var BPromise=require(_0x36d3('0x3'));var rp=require(_0x36d3('0x4'));var fs=require('fs');var path=require(_0x36d3('0x5'));var rimraf=require(_0x36d3('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x321503,_0x5b5a3b){return _0x321503[_0x36d3('0x7')]('Dynamics365Field',attributes,{'tableName':_0x36d3('0x8'),'paranoid':![],'indexes':[{'name':_0x36d3('0x9'),'fields':[_0x36d3('0xa'),_0x36d3('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd36=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','dynamics365_unique_index','idField','FieldId','moment'];(function(_0x34ed48,_0x2cc995){var _0x37da5c=function(_0x5b6e16){while(--_0x5b6e16){_0x34ed48['push'](_0x34ed48['shift']());}};_0x37da5c(++_0x2cc995);}(_0xfd36,0x8f));var _0x6fd3=function(_0x811dfc,_0x754913){_0x811dfc=_0x811dfc-0x0;var _0x5e3ea4=_0xfd36[_0x811dfc];return _0x5e3ea4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6fd3('0x0'));var BPromise=require(_0x6fd3('0x1'));var rp=require(_0x6fd3('0x2'));var fs=require('fs');var path=require(_0x6fd3('0x3'));var rimraf=require(_0x6fd3('0x4'));var config=require(_0x6fd3('0x5'));var attributes=require(_0x6fd3('0x6'));module[_0x6fd3('0x7')]=function(_0x5bbe1a,_0x134b71){return _0x5bbe1a['define'](_0x6fd3('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x6fd3('0x9'),'fields':[_0x6fd3('0xa'),_0x6fd3('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 86f131a..cbbc360 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 _0x2eb2=['request','then','info','request\x20sent','error','Dynamics365Field,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x401822,_0x49b445){var _0x573996=function(_0x119519){while(--_0x119519){_0x401822['push'](_0x401822['shift']());}};_0x573996(++_0x49b445);}(_0x2eb2,0x19f));var _0x22eb=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2eb2[_0x491a7f];return _0x3d8f44;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file +var _0x6f83=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6f83,0x72));var _0x36f8=function(_0x16f0c1,_0x28227c){_0x16f0c1=_0x16f0c1-0x0;var _0x4208f4=_0x6f83[_0x16f0c1];return _0x4208f4;};'use strict';var _=require('lodash');var util=require(_0x36f8('0x0'));var moment=require(_0x36f8('0x1'));var BPromise=require('bluebird');var rs=require(_0x36f8('0x2'));var fs=require('fs');var Redis=require(_0x36f8('0x3'));var db=require(_0x36f8('0x4'))['db'];var utils=require(_0x36f8('0x5'));var logger=require(_0x36f8('0x6'))(_0x36f8('0x7'));var config=require(_0x36f8('0x8'));var jayson=require(_0x36f8('0x9'));var client=jayson[_0x36f8('0xa')][_0x36f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d94b,_0x2c0367,_0x370a97){return new BPromise(function(_0x3fe644,_0x22b992){return client[_0x36f8('0xc')](_0x27d94b,_0x370a97)['then'](function(_0x48c7b2){logger['info'](_0x36f8('0xd'),_0x2c0367,_0x36f8('0xe'));logger[_0x36f8('0xf')](_0x36f8('0x10'),_0x2c0367,_0x36f8('0xe'),JSON[_0x36f8('0x11')](_0x48c7b2));if(_0x48c7b2[_0x36f8('0x12')]){if(_0x48c7b2[_0x36f8('0x12')][_0x36f8('0x13')]===0x1f4){logger['error'](_0x36f8('0xd'),_0x2c0367,_0x48c7b2[_0x36f8('0x12')][_0x36f8('0x14')]);return _0x22b992(_0x48c7b2[_0x36f8('0x12')]['message']);}logger[_0x36f8('0x12')](_0x36f8('0xd'),_0x2c0367,_0x48c7b2[_0x36f8('0x12')]['message']);return _0x3fe644(_0x48c7b2[_0x36f8('0x12')][_0x36f8('0x14')]);}else{logger[_0x36f8('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x2c0367,_0x36f8('0xe'));_0x3fe644(_0x48c7b2[_0x36f8('0x16')][_0x36f8('0x14')]);}})[_0x36f8('0x17')](function(_0x5ec545){logger['error'](_0x36f8('0xd'),_0x2c0367,_0x5ec545);_0x22b992(_0x5ec545);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 37439c2..eb30deb 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 _0xd792=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports'];(function(_0x36c30a,_0x2af1df){var _0x1f12cf=function(_0x3f2054){while(--_0x3f2054){_0x36c30a['push'](_0x36c30a['shift']());}};_0x1f12cf(++_0x2af1df);}(_0xd792,0x78));var _0x2d79=function(_0x5886db,_0x4d30d4){_0x5886db=_0x5886db-0x0;var _0x537a05=_0xd792[_0x5886db];return _0x537a05;};'use strict';var multer=require(_0x2d79('0x0'));var util=require(_0x2d79('0x1'));var path=require(_0x2d79('0x2'));var timeout=require(_0x2d79('0x3'));var express=require(_0x2d79('0x4'));var router=express['Router']();var fs_extra=require(_0x2d79('0x5'));var auth=require(_0x2d79('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d79('0x7'));var controller=require(_0x2d79('0x8'));router[_0x2d79('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2d79('0x9')](_0x2d79('0xa'),auth[_0x2d79('0xb')](),controller[_0x2d79('0xc')]);router[_0x2d79('0x9')](_0x2d79('0xd'),auth[_0x2d79('0xb')](),controller[_0x2d79('0xe')]);router['get'](_0x2d79('0xf'),auth[_0x2d79('0xb')](),controller[_0x2d79('0x10')]);router[_0x2d79('0x11')]('/',auth[_0x2d79('0xb')](),controller[_0x2d79('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x2d79('0x13')]('/:id',auth[_0x2d79('0xb')](),controller[_0x2d79('0x14')]);router[_0x2d79('0x15')](_0x2d79('0xa'),auth['isAuthenticated'](),controller[_0x2d79('0x16')]);module[_0x2d79('0x17')]=router; \ No newline at end of file +var _0x22a2=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22a2,0x16c));var _0x222a=function(_0x15dc4a,_0x37ac48){_0x15dc4a=_0x15dc4a-0x0;var _0x23c048=_0x22a2[_0x15dc4a];return _0x23c048;};'use strict';var multer=require(_0x222a('0x0'));var util=require(_0x222a('0x1'));var path=require(_0x222a('0x2'));var timeout=require(_0x222a('0x3'));var express=require(_0x222a('0x4'));var router=express[_0x222a('0x5')]();var fs_extra=require(_0x222a('0x6'));var auth=require(_0x222a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x222a('0x8'));var controller=require(_0x222a('0x9'));router[_0x222a('0xa')]('/',auth[_0x222a('0xb')](),controller[_0x222a('0xc')]);router[_0x222a('0xa')](_0x222a('0xd'),auth[_0x222a('0xb')](),controller[_0x222a('0xe')]);router['get'](_0x222a('0xf'),auth[_0x222a('0xb')](),controller[_0x222a('0x10')]);router[_0x222a('0xa')](_0x222a('0x11'),auth['isAuthenticated'](),controller[_0x222a('0x12')]);router[_0x222a('0x13')]('/',auth[_0x222a('0xb')](),controller[_0x222a('0x14')]);router[_0x222a('0x13')]('/:id/configurations',auth[_0x222a('0xb')](),controller[_0x222a('0x15')]);router['put'](_0x222a('0xd'),auth[_0x222a('0xb')](),controller[_0x222a('0x16')]);router[_0x222a('0x17')](_0x222a('0xd'),auth[_0x222a('0xb')](),controller[_0x222a('0x18')]);module[_0x222a('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 332d20b..43765ee 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 _0xc83d=['STRING','username','remoteUri','sequelize'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0xc83d,0x16f));var _0xdc83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc83d[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xdc83('0x0'));module['exports']={'name':{'type':Sequelize[_0xdc83('0x1')]},'description':{'type':Sequelize[_0xdc83('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xdc83('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xdc83('0x1')],'unique':_0xdc83('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xffb5=['STRING','username','remoteUri'];(function(_0x1a897b,_0x33c762){var _0x54da75=function(_0x45054e){while(--_0x45054e){_0x1a897b['push'](_0x1a897b['shift']());}};_0x54da75(++_0x33c762);}(_0xffb5,0x1d1));var _0x5ffb=function(_0x5f2bc5,_0x1b915e){_0x5f2bc5=_0x5f2bc5-0x0;var _0xe3038=_0xffb5[_0x5f2bc5];return _0xe3038;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5ffb('0x0')]},'username':{'type':Sequelize[_0x5ffb('0x0')],'unique':_0x5ffb('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5ffb('0x2')},'serverUrl':{'type':Sequelize[_0x5ffb('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 7a954d9..6404a1d 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 _0x0c02=['http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','limit','count','set','apply','reject','save','update','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','FreshdeskAccount','includeAll','rows','catch','show','params','include','find','create','body','getConfigurations','FreshdeskConfiguration','merge','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','apiKey','remoteUri','slice','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','client'];(function(_0xb042e4,_0x5d402e){var _0xfcb441=function(_0x55a578){while(--_0x55a578){_0xb042e4['push'](_0xb042e4['shift']());}};_0xfcb441(++_0x5d402e);}(_0x0c02,0xdc));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x20c0('0x0'));var rimraf=require(_0x20c0('0x1'));var zipdir=require(_0x20c0('0x2'));var jsonpatch=require(_0x20c0('0x3'));var rp=require(_0x20c0('0x4'));var moment=require(_0x20c0('0x5'));var BPromise=require(_0x20c0('0x6'));var Mustache=require(_0x20c0('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20c0('0x8'));var _=require(_0x20c0('0x9'));var squel=require(_0x20c0('0xa'));var crypto=require(_0x20c0('0xb'));var jsforce=require(_0x20c0('0xc'));var deskjs=require(_0x20c0('0xd'));var toCsv=require(_0x20c0('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x20c0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x20c0('0x10'));var as=require(_0x20c0('0x11'));var hardwareService=require(_0x20c0('0x12'));var logger=require(_0x20c0('0x13'))(_0x20c0('0x14'));var utils=require(_0x20c0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x20c0('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x20c0('0x17')][_0x20c0('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x25ec8d,_0x2bd9ea,_0x1ec5d0,_0x1c3593){return new BPromise(function(_0x173a4e,_0x2ef228){var _0x2090a2=_0x1c3593||client;return _0x2090a2[_0x20c0('0x19')](_0x25ec8d,_0x1ec5d0)[_0x20c0('0x1a')](function(_0xbe35bd){logger[_0x20c0('0x1b')](_0x20c0('0x1c'),_0x2bd9ea,_0x20c0('0x1d'));logger[_0x20c0('0x1e')](_0x20c0('0x1f'),_0x2bd9ea,_0x20c0('0x1d'),JSON[_0x20c0('0x20')](_0xbe35bd));if(_0xbe35bd[_0x20c0('0x21')]){if(_0xbe35bd['error'][_0x20c0('0x22')]===0x1f4){logger[_0x20c0('0x21')](_0x20c0('0x1c'),_0x2bd9ea,_0xbe35bd[_0x20c0('0x21')][_0x20c0('0x23')]);return _0x2ef228(_0xbe35bd[_0x20c0('0x21')][_0x20c0('0x23')]);}logger[_0x20c0('0x21')](_0x20c0('0x1c'),_0x2bd9ea,_0xbe35bd[_0x20c0('0x21')][_0x20c0('0x23')]);return _0x173a4e(_0xbe35bd[_0x20c0('0x21')][_0x20c0('0x23')]);}else{logger[_0x20c0('0x1b')]('FreshdeskAccount,\x20%s,\x20%s',_0x2bd9ea,_0x20c0('0x1d'));_0x173a4e(_0xbe35bd[_0x20c0('0x24')]['message']);}})['catch'](function(_0x8102df){logger[_0x20c0('0x21')](_0x20c0('0x1c'),_0x2bd9ea,_0x8102df);_0x2ef228(_0x8102df);});});}function respondWithStatusCode(_0x8d32a,_0x3c4e75){_0x3c4e75=_0x3c4e75||0xcc;return function(_0x2b4b84){if(_0x2b4b84){return _0x8d32a['sendStatus'](_0x3c4e75);}return _0x8d32a[_0x20c0('0x25')](_0x3c4e75)['end']();};}function respondWithResult(_0x479b07,_0x54532e){_0x54532e=_0x54532e||0xc8;return function(_0x426f13){if(_0x426f13){return _0x479b07['status'](_0x54532e)[_0x20c0('0x26')](_0x426f13);}};}function respondWithFilteredResult(_0x5b1097,_0x2856ea){return function(_0x3d1be2){if(_0x3d1be2){var _0x4e6ac6=typeof _0x2856ea[_0x20c0('0x27')]==='undefined'&&typeof _0x2856ea[_0x20c0('0x28')]==='undefined';var _0x42d2cb=_0x3d1be2['count'];var _0x1de016=_0x4e6ac6?0x0:_0x2856ea[_0x20c0('0x27')];var _0x3fa50e=_0x4e6ac6?_0x3d1be2[_0x20c0('0x29')]:_0x2856ea[_0x20c0('0x27')]+_0x2856ea['limit'];var _0x4c29d0;if(_0x3fa50e>=_0x42d2cb){_0x3fa50e=_0x42d2cb;_0x4c29d0=0xc8;}else{_0x4c29d0=0xce;}_0x5b1097[_0x20c0('0x25')](_0x4c29d0);return _0x5b1097[_0x20c0('0x2a')]('Content-Range',_0x1de016+'-'+_0x3fa50e+'/'+_0x42d2cb)[_0x20c0('0x26')](_0x3d1be2);}return null;};}function patchUpdates(_0x364bf8){return function(_0x9bc84b){try{jsonpatch[_0x20c0('0x2b')](_0x9bc84b,_0x364bf8,!![]);}catch(_0x127a62){return BPromise[_0x20c0('0x2c')](_0x127a62);}return _0x9bc84b[_0x20c0('0x2d')]();};}function saveUpdates(_0x15b524,_0x49f43f){return function(_0x58d9b5){if(_0x58d9b5){return _0x58d9b5[_0x20c0('0x2e')](_0x15b524)['then'](function(_0x5b0e65){return _0x5b0e65;});}return null;};}function removeEntity(_0x1f3411,_0x446724){return function(_0x26640d){if(_0x26640d){return _0x26640d['destroy']()[_0x20c0('0x1a')](function(){_0x1f3411['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x293465,_0x453266){return function(_0x5afa14){if(!_0x5afa14){_0x293465['sendStatus'](0x194);}return _0x5afa14;};}function handleError(_0x2354bd,_0x3f8099){_0x3f8099=_0x3f8099||0x1f4;return function(_0x37aa17){logger[_0x20c0('0x21')](_0x37aa17['stack']);if(_0x37aa17[_0x20c0('0x2f')]){delete _0x37aa17['name'];}_0x2354bd[_0x20c0('0x25')](_0x3f8099)['send'](_0x37aa17);};}exports[_0x20c0('0x30')]=function(_0x326bdf,_0x52a516){var _0x1ae004={},_0x1bd343={},_0x399670={'count':0x0,'rows':[]};var _0x5c16ec=_['map'](db['FreshdeskAccount'][_0x20c0('0x31')],function(_0xcf08c1){return{'name':_0xcf08c1[_0x20c0('0x32')],'type':_0xcf08c1[_0x20c0('0x33')][_0x20c0('0x34')]};});_0x1bd343[_0x20c0('0x35')]=_[_0x20c0('0x36')](_0x5c16ec,'name');_0x1bd343[_0x20c0('0x37')]=_[_0x20c0('0x38')](_0x326bdf[_0x20c0('0x37')]);_0x1bd343[_0x20c0('0x39')]=_['intersection'](_0x1bd343[_0x20c0('0x35')],_0x1bd343[_0x20c0('0x37')]);_0x1ae004[_0x20c0('0x3a')]=_[_0x20c0('0x3b')](_0x1bd343[_0x20c0('0x35')],qs[_0x20c0('0x3c')](_0x326bdf[_0x20c0('0x37')]['fields']));_0x1ae004[_0x20c0('0x3a')]=_0x1ae004[_0x20c0('0x3a')][_0x20c0('0x3d')]?_0x1ae004['attributes']:_0x1bd343[_0x20c0('0x35')];if(!_0x326bdf[_0x20c0('0x37')][_0x20c0('0x3e')]('nolimit')){_0x1ae004['limit']=qs[_0x20c0('0x28')](_0x326bdf[_0x20c0('0x37')]['limit']);_0x1ae004[_0x20c0('0x27')]=qs[_0x20c0('0x27')](_0x326bdf['query']['offset']);}_0x1ae004[_0x20c0('0x3f')]=qs[_0x20c0('0x40')](_0x326bdf[_0x20c0('0x37')][_0x20c0('0x40')]);_0x1ae004[_0x20c0('0x41')]=qs[_0x20c0('0x39')](_[_0x20c0('0x42')](_0x326bdf[_0x20c0('0x37')],_0x1bd343[_0x20c0('0x39')]),_0x5c16ec);if(_0x326bdf['query'][_0x20c0('0x43')]){_0x1ae004[_0x20c0('0x41')]=_['merge'](_0x1ae004[_0x20c0('0x41')],{'$or':_['map'](_0x5c16ec,function(_0x9544f5){if(_0x9544f5[_0x20c0('0x33')]!==_0x20c0('0x44')){var _0x2a1dd5={};_0x2a1dd5[_0x9544f5[_0x20c0('0x2f')]]={'$like':'%'+_0x326bdf[_0x20c0('0x37')]['filter']+'%'};return _0x2a1dd5;}})});}_0x1ae004=_['merge']({},_0x1ae004,_0x326bdf[_0x20c0('0x45')]);var _0x59934a={'where':_0x1ae004['where']};return db[_0x20c0('0x46')]['count'](_0x59934a)[_0x20c0('0x1a')](function(_0xf29d8f){_0x399670[_0x20c0('0x29')]=_0xf29d8f;if(_0x326bdf['query'][_0x20c0('0x47')]){_0x1ae004['include']=[{'all':!![]}];}return db[_0x20c0('0x46')]['findAll'](_0x1ae004);})[_0x20c0('0x1a')](function(_0x54a4cb){_0x399670[_0x20c0('0x48')]=_0x54a4cb;return _0x399670;})[_0x20c0('0x1a')](respondWithFilteredResult(_0x52a516,_0x1ae004))[_0x20c0('0x49')](handleError(_0x52a516,null));};exports[_0x20c0('0x4a')]=function(_0x3318cd,_0x2ed42a){var _0x1f0822={'raw':![],'where':{'id':_0x3318cd[_0x20c0('0x4b')]['id']}},_0x3fb49c={};_0x3fb49c[_0x20c0('0x35')]=_[_0x20c0('0x38')](db['FreshdeskAccount'][_0x20c0('0x31')]);_0x3fb49c[_0x20c0('0x37')]=_['keys'](_0x3318cd[_0x20c0('0x37')]);_0x3fb49c[_0x20c0('0x39')]=_[_0x20c0('0x3b')](_0x3fb49c[_0x20c0('0x35')],_0x3fb49c['query']);_0x1f0822[_0x20c0('0x3a')]=_['intersection'](_0x3fb49c[_0x20c0('0x35')],qs['fields'](_0x3318cd[_0x20c0('0x37')][_0x20c0('0x3c')]));_0x1f0822[_0x20c0('0x3a')]=_0x1f0822['attributes'][_0x20c0('0x3d')]?_0x1f0822['attributes']:_0x3fb49c[_0x20c0('0x35')];if(_0x3318cd[_0x20c0('0x37')]['includeAll']){_0x1f0822[_0x20c0('0x4c')]=[{'all':!![]}];}_0x1f0822=_['merge']({},_0x1f0822,_0x3318cd[_0x20c0('0x45')]);return db[_0x20c0('0x46')][_0x20c0('0x4d')](_0x1f0822)[_0x20c0('0x1a')](handleEntityNotFound(_0x2ed42a,null))[_0x20c0('0x1a')](respondWithResult(_0x2ed42a,null))[_0x20c0('0x49')](handleError(_0x2ed42a,null));};exports[_0x20c0('0x4e')]=function(_0x286fc5,_0x923e96){return db[_0x20c0('0x46')][_0x20c0('0x4e')](_0x286fc5['body'],{})[_0x20c0('0x1a')](respondWithResult(_0x923e96,0xc9))[_0x20c0('0x49')](handleError(_0x923e96,null));};exports[_0x20c0('0x2e')]=function(_0x4e45b2,_0x14707f){if(_0x4e45b2['body']['id']){delete _0x4e45b2['body']['id'];}return db['FreshdeskAccount'][_0x20c0('0x4d')]({'where':{'id':_0x4e45b2[_0x20c0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14707f,null))['then'](saveUpdates(_0x4e45b2[_0x20c0('0x4f')],null))[_0x20c0('0x1a')](respondWithResult(_0x14707f,null))['catch'](handleError(_0x14707f,null));};exports['destroy']=function(_0x2127a8,_0x1f9d04){return db[_0x20c0('0x46')]['find']({'where':{'id':_0x2127a8[_0x20c0('0x4b')]['id']}})[_0x20c0('0x1a')](handleEntityNotFound(_0x1f9d04,null))[_0x20c0('0x1a')](removeEntity(_0x1f9d04,null))[_0x20c0('0x49')](handleError(_0x1f9d04,null));};exports[_0x20c0('0x50')]=function(_0x5743fc,_0x40416d,_0x20e57c){var _0x4a1bd5={};var _0x3af9de={};var _0xf93d68;var _0x1b01f3;return db[_0x20c0('0x46')]['findOne']({'where':{'id':_0x5743fc['params']['id']}})[_0x20c0('0x1a')](handleEntityNotFound(_0x40416d,null))['then'](function(_0x57ba77){if(_0x57ba77){_0xf93d68=_0x57ba77;_0x3af9de[_0x20c0('0x35')]=_['keys'](db[_0x20c0('0x51')][_0x20c0('0x31')]);_0x3af9de[_0x20c0('0x37')]=_[_0x20c0('0x38')](_0x5743fc['query']);_0x3af9de[_0x20c0('0x39')]=_[_0x20c0('0x3b')](_0x3af9de[_0x20c0('0x35')],_0x3af9de[_0x20c0('0x37')]);_0x4a1bd5['attributes']=_[_0x20c0('0x3b')](_0x3af9de['model'],qs[_0x20c0('0x3c')](_0x5743fc[_0x20c0('0x37')][_0x20c0('0x3c')]));_0x4a1bd5[_0x20c0('0x3a')]=_0x4a1bd5['attributes'][_0x20c0('0x3d')]?_0x4a1bd5[_0x20c0('0x3a')]:_0x3af9de[_0x20c0('0x35')];_0x4a1bd5[_0x20c0('0x3f')]=qs[_0x20c0('0x40')](_0x5743fc[_0x20c0('0x37')]['sort']);_0x4a1bd5[_0x20c0('0x41')]=qs[_0x20c0('0x39')](_[_0x20c0('0x42')](_0x5743fc[_0x20c0('0x37')],_0x3af9de[_0x20c0('0x39')]));if(_0x5743fc[_0x20c0('0x37')]['filter']){_0x4a1bd5[_0x20c0('0x41')]=_[_0x20c0('0x52')](_0x4a1bd5[_0x20c0('0x41')],{'$or':_['map'](_0x4a1bd5[_0x20c0('0x3a')],function(_0x527dba){var _0x5bb9a9={};_0x5bb9a9[_0x527dba]={'$like':'%'+_0x5743fc[_0x20c0('0x37')][_0x20c0('0x43')]+'%'};return _0x5bb9a9;})});}_0x4a1bd5=_['merge']({},_0x4a1bd5,_0x5743fc[_0x20c0('0x45')]);return _0xf93d68[_0x20c0('0x50')](_0x4a1bd5);}})[_0x20c0('0x1a')](function(_0x3ed2ee){if(_0x3ed2ee){_0x1b01f3=_0x3ed2ee[_0x20c0('0x3d')];if(!_0x5743fc[_0x20c0('0x37')][_0x20c0('0x3e')](_0x20c0('0x53'))){_0x4a1bd5['limit']=qs['limit'](_0x5743fc[_0x20c0('0x37')]['limit']);_0x4a1bd5[_0x20c0('0x27')]=qs['offset'](_0x5743fc[_0x20c0('0x37')][_0x20c0('0x27')]);}return _0xf93d68[_0x20c0('0x50')](_0x4a1bd5);}})[_0x20c0('0x1a')](function(_0x3f9757){if(_0x3f9757){return _0x3f9757?{'count':_0x1b01f3,'rows':_0x3f9757}:null;}})['then'](respondWithResult(_0x40416d,null))['catch'](handleError(_0x40416d,null));};exports[_0x20c0('0x54')]=function(_0x144720,_0x21f7fe,_0x4b6b5c){if(_0x144720['body']['id']){delete _0x144720[_0x20c0('0x4f')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x144720[_0x20c0('0x4b')]['id']}})[_0x20c0('0x1a')](handleEntityNotFound(_0x21f7fe,null))[_0x20c0('0x1a')](function(_0x30a7d7){if(_0x30a7d7){_0x144720[_0x20c0('0x4f')][_0x20c0('0x55')]=_0x30a7d7['id'];_0x144720['body'][_0x20c0('0x56')]=integrations['getSubjects'](_0x144720['body'][_0x20c0('0x57')],_0x144720['body'][_0x20c0('0x33')]);_0x144720[_0x20c0('0x4f')][_0x20c0('0x58')]=integrations[_0x20c0('0x59')](_0x144720['body'][_0x20c0('0x57')],_0x144720[_0x20c0('0x4f')][_0x20c0('0x33')]);return db[_0x20c0('0x51')][_0x20c0('0x4e')](_0x144720['body'],{'include':[{'model':db[_0x20c0('0x5a')],'as':_0x20c0('0x56')},{'model':db[_0x20c0('0x5a')],'as':_0x20c0('0x58')}]});}return null;})[_0x20c0('0x1a')](respondWithResult(_0x21f7fe,null))[_0x20c0('0x49')](handleError(_0x21f7fe,null));};exports['getFields']=function(_0x2fa300,_0x4e224f,_0x4b31b9){var _0x1fd5ce='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x2fa300[_0x20c0('0x4b')]['id']},'attributes':['id','remoteUri',_0x20c0('0x5b')]})[_0x20c0('0x1a')](handleEntityNotFound(_0x4e224f,null))[_0x20c0('0x1a')](function(_0x41e66b){if(_0x41e66b){_0x1fd5ce=_0x41e66b[_0x20c0('0x5c')];var _0x8490d6=_0x1fd5ce[_0x20c0('0x5d')](-0x1);if(_0x8490d6==='/'){_0x1fd5ce=_0x1fd5ce['substring'](0x0,_0x1fd5ce['lastIndexOf'](_0x8490d6));}return rp({'method':_0x20c0('0x5e'),'uri':util[_0x20c0('0x5f')](_0x20c0('0x60'),_0x1fd5ce,_0x20c0('0x61')),'headers':{'Authorization':util[_0x20c0('0x5f')](_0x20c0('0x62'),new Buffer(util['format'](_0x20c0('0x63'),_0x41e66b[_0x20c0('0x5b')]))[_0x20c0('0x64')](_0x20c0('0x65')))},'json':!![]});}})[_0x20c0('0x1a')](function(_0x3ca100){if(_0x3ca100){var _0x424064=[_0x20c0('0x66'),_0x20c0('0x67'),_0x20c0('0x68'),_0x20c0('0x69'),_0x20c0('0x25'),_0x20c0('0x6a'),'group','source','ticket_type',_0x20c0('0x6b'),_0x20c0('0x6c')];_['remove'](_0x3ca100,function(_0x2d4cc1){return _0x424064[_0x20c0('0x6d')](_0x2d4cc1[_0x20c0('0x2f')])||!_0x2d4cc1[_0x20c0('0x6e')]&&_0x2d4cc1[_0x20c0('0x33')]!==_0x20c0('0x6f')&&_0x2d4cc1[_0x20c0('0x33')]!==_0x20c0('0x70');});return{'count':_0x3ca100[_0x20c0('0x3d')],'rows':_['map'](_0x3ca100,function(_0x25d52d){return{'id':_0x25d52d[_0x20c0('0x2f')],'name':_0x25d52d[_0x20c0('0x71')],'custom':!_0x25d52d[_0x20c0('0x6e')],'options':_0x25d52d[_0x20c0('0x72')]?_[_0x20c0('0x36')](_0x25d52d[_0x20c0('0x72')],function(_0x24fb84){return{'name':_[_0x20c0('0x73')](_0x24fb84),'value':_0x24fb84};}):[]};})};}})[_0x20c0('0x1a')](respondWithResult(_0x4e224f,null))[_0x20c0('0x49')](function(_0x78095){var _0x104e59=_0x2fa300[_0x20c0('0x37')][_0x20c0('0x74')]?0x1f4:_0x78095['statusCode']||0x1f4;logger['error'](_0x20c0('0x75'),_0x20c0('0x76'),_0x104e59,JSON[_0x20c0('0x20')](_0x78095));delete _0x78095[_0x20c0('0x2f')];if(_0x104e59===0x191){_0x104e59=0x190;}_0x4e224f[_0x20c0('0x25')](_0x104e59)[_0x20c0('0x77')](_0x2fa300['query'][_0x20c0('0x74')]?{'message':_0x20c0('0x78'),'statusCode':_0x78095[_0x20c0('0x79')]}:_0x78095);});}; \ No newline at end of file +var _0x0808=['Content-Range','reject','save','update','destroy','end','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','keys','includeAll','options','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','length','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','company','includes','custom_text','default','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set'];(function(_0x4f828c,_0x2f6cac){var _0x1fea4d=function(_0x3049f2){while(--_0x3049f2){_0x4f828c['push'](_0x4f828c['shift']());}};_0x1fea4d(++_0x2f6cac);}(_0x0808,0xc5));var _0x8080=function(_0x5b2e05,_0x41f457){_0x5b2e05=_0x5b2e05-0x0;var _0x2b70c2=_0x0808[_0x5b2e05];return _0x2b70c2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8080('0x0'));var moment=require(_0x8080('0x1'));var BPromise=require(_0x8080('0x2'));var Mustache=require(_0x8080('0x3'));var util=require('util');var path=require('path');var sox=require(_0x8080('0x4'));var csv=require(_0x8080('0x5'));var ejs=require(_0x8080('0x6'));var fs=require('fs');var fs_extra=require(_0x8080('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8080('0x8'));var jsforce=require(_0x8080('0x9'));var deskjs=require(_0x8080('0xa'));var toCsv=require(_0x8080('0x5'));var querystring=require('querystring');var Papa=require(_0x8080('0xb'));var Redis=require(_0x8080('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8080('0xd'));var as=require(_0x8080('0xe'));var hardwareService=require(_0x8080('0xf'));var logger=require(_0x8080('0x10'))(_0x8080('0x11'));var utils=require(_0x8080('0x12'));var config=require(_0x8080('0x13'));var licenseUtil=require(_0x8080('0x14'));var db=require(_0x8080('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x8080('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bbb93,_0x1088a8,_0x3ee7c3,_0x2bdef3){return new BPromise(function(_0xb3186d,_0x136edf){var _0xae4049=_0x2bdef3||client;return _0xae4049['request'](_0x1bbb93,_0x3ee7c3)[_0x8080('0x17')](function(_0x3dadf2){logger['info'](_0x8080('0x18'),_0x1088a8,_0x8080('0x19'));logger[_0x8080('0x1a')](_0x8080('0x1b'),_0x1088a8,_0x8080('0x19'),JSON['stringify'](_0x3dadf2));if(_0x3dadf2[_0x8080('0x1c')]){if(_0x3dadf2['error'][_0x8080('0x1d')]===0x1f4){logger[_0x8080('0x1c')](_0x8080('0x18'),_0x1088a8,_0x3dadf2['error'][_0x8080('0x1e')]);return _0x136edf(_0x3dadf2[_0x8080('0x1c')][_0x8080('0x1e')]);}logger[_0x8080('0x1c')](_0x8080('0x18'),_0x1088a8,_0x3dadf2[_0x8080('0x1c')][_0x8080('0x1e')]);return _0xb3186d(_0x3dadf2[_0x8080('0x1c')][_0x8080('0x1e')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x1088a8,'request\x20sent');_0xb3186d(_0x3dadf2[_0x8080('0x1f')][_0x8080('0x1e')]);}})[_0x8080('0x20')](function(_0x538f32){logger[_0x8080('0x1c')](_0x8080('0x18'),_0x1088a8,_0x538f32);_0x136edf(_0x538f32);});});}function respondWithStatusCode(_0x10a79e,_0x20b083){_0x20b083=_0x20b083||0xcc;return function(_0x322b84){if(_0x322b84){return _0x10a79e[_0x8080('0x21')](_0x20b083);}return _0x10a79e[_0x8080('0x22')](_0x20b083)['end']();};}function respondWithResult(_0x429014,_0x56ff9d){_0x56ff9d=_0x56ff9d||0xc8;return function(_0x207337){if(_0x207337){return _0x429014[_0x8080('0x22')](_0x56ff9d)[_0x8080('0x23')](_0x207337);}};}function respondWithFilteredResult(_0x364d0d,_0x2824d0){return function(_0x37a9f7){if(_0x37a9f7){var _0x365c5b=typeof _0x2824d0['offset']===_0x8080('0x24')&&typeof _0x2824d0[_0x8080('0x25')]==='undefined';var _0x2afa39=_0x37a9f7[_0x8080('0x26')];var _0x4c294f=_0x365c5b?0x0:_0x2824d0[_0x8080('0x27')];var _0x5b0aee=_0x365c5b?_0x37a9f7['count']:_0x2824d0['offset']+_0x2824d0[_0x8080('0x25')];var _0x31558d;if(_0x5b0aee>=_0x2afa39){_0x5b0aee=_0x2afa39;_0x31558d=0xc8;}else{_0x31558d=0xce;}_0x364d0d['status'](_0x31558d);return _0x364d0d[_0x8080('0x28')](_0x8080('0x29'),_0x4c294f+'-'+_0x5b0aee+'/'+_0x2afa39)[_0x8080('0x23')](_0x37a9f7);}return null;};}function patchUpdates(_0x3600f4){return function(_0x53f548){try{jsonpatch['apply'](_0x53f548,_0x3600f4,!![]);}catch(_0x16755a){return BPromise[_0x8080('0x2a')](_0x16755a);}return _0x53f548[_0x8080('0x2b')]();};}function saveUpdates(_0x5e9a71,_0x1a8811){return function(_0x36692f){if(_0x36692f){return _0x36692f[_0x8080('0x2c')](_0x5e9a71)[_0x8080('0x17')](function(_0x5869e3){return _0x5869e3;});}return null;};}function removeEntity(_0x2d422d,_0x1ea035){return function(_0x5efcf9){if(_0x5efcf9){return _0x5efcf9[_0x8080('0x2d')]()['then'](function(){_0x2d422d[_0x8080('0x22')](0xcc)[_0x8080('0x2e')]();});}};}function handleEntityNotFound(_0x16cada,_0x1b49e3){return function(_0x55f041){if(!_0x55f041){_0x16cada[_0x8080('0x21')](0x194);}return _0x55f041;};}function handleError(_0x390432,_0x2c83d9){_0x2c83d9=_0x2c83d9||0x1f4;return function(_0x4d4c4a){logger['error'](_0x4d4c4a['stack']);if(_0x4d4c4a[_0x8080('0x2f')]){delete _0x4d4c4a[_0x8080('0x2f')];}_0x390432[_0x8080('0x22')](_0x2c83d9)[_0x8080('0x30')](_0x4d4c4a);};}exports[_0x8080('0x31')]=function(_0x4e3e54,_0x49e97b){var _0x9a3261={},_0x134a30={},_0x2ade8f={'count':0x0,'rows':[]};var _0x1a0720=_[_0x8080('0x32')](db[_0x8080('0x33')][_0x8080('0x34')],function(_0x565b95){return{'name':_0x565b95[_0x8080('0x35')],'type':_0x565b95[_0x8080('0x36')][_0x8080('0x37')]};});_0x134a30[_0x8080('0x38')]=_[_0x8080('0x32')](_0x1a0720,'name');_0x134a30['query']=_['keys'](_0x4e3e54[_0x8080('0x39')]);_0x134a30[_0x8080('0x3a')]=_[_0x8080('0x3b')](_0x134a30['model'],_0x134a30[_0x8080('0x39')]);_0x9a3261[_0x8080('0x3c')]=_[_0x8080('0x3b')](_0x134a30[_0x8080('0x38')],qs[_0x8080('0x3d')](_0x4e3e54[_0x8080('0x39')]['fields']));_0x9a3261['attributes']=_0x9a3261[_0x8080('0x3c')]['length']?_0x9a3261[_0x8080('0x3c')]:_0x134a30['model'];if(!_0x4e3e54[_0x8080('0x39')]['hasOwnProperty'](_0x8080('0x3e'))){_0x9a3261[_0x8080('0x25')]=qs[_0x8080('0x25')](_0x4e3e54[_0x8080('0x39')][_0x8080('0x25')]);_0x9a3261[_0x8080('0x27')]=qs[_0x8080('0x27')](_0x4e3e54['query'][_0x8080('0x27')]);}_0x9a3261[_0x8080('0x3f')]=qs[_0x8080('0x40')](_0x4e3e54[_0x8080('0x39')][_0x8080('0x40')]);_0x9a3261[_0x8080('0x41')]=qs['filters'](_[_0x8080('0x42')](_0x4e3e54['query'],_0x134a30[_0x8080('0x3a')]),_0x1a0720);if(_0x4e3e54['query'][_0x8080('0x43')]){_0x9a3261[_0x8080('0x41')]=_[_0x8080('0x44')](_0x9a3261[_0x8080('0x41')],{'$or':_['map'](_0x1a0720,function(_0x4c7bed){if(_0x4c7bed[_0x8080('0x36')]!==_0x8080('0x45')){var _0x5796ea={};_0x5796ea[_0x4c7bed['name']]={'$like':'%'+_0x4e3e54[_0x8080('0x39')][_0x8080('0x43')]+'%'};return _0x5796ea;}})});}_0x9a3261=_['merge']({},_0x9a3261,_0x4e3e54['options']);var _0x221c7c={'where':_0x9a3261['where']};return db[_0x8080('0x33')][_0x8080('0x26')](_0x221c7c)[_0x8080('0x17')](function(_0x33dc6c){_0x2ade8f['count']=_0x33dc6c;if(_0x4e3e54[_0x8080('0x39')]['includeAll']){_0x9a3261[_0x8080('0x46')]=[{'all':!![]}];}return db[_0x8080('0x33')][_0x8080('0x47')](_0x9a3261);})[_0x8080('0x17')](function(_0x5d4f6c){_0x2ade8f['rows']=_0x5d4f6c;return _0x2ade8f;})[_0x8080('0x17')](respondWithFilteredResult(_0x49e97b,_0x9a3261))[_0x8080('0x20')](handleError(_0x49e97b,null));};exports[_0x8080('0x48')]=function(_0x31950b,_0x46c3fe){var _0x5982c8={'raw':![],'where':{'id':_0x31950b[_0x8080('0x49')]['id']}},_0x43f8a4={};_0x43f8a4[_0x8080('0x38')]=_[_0x8080('0x4a')](db['FreshdeskAccount'][_0x8080('0x34')]);_0x43f8a4[_0x8080('0x39')]=_[_0x8080('0x4a')](_0x31950b['query']);_0x43f8a4[_0x8080('0x3a')]=_[_0x8080('0x3b')](_0x43f8a4[_0x8080('0x38')],_0x43f8a4['query']);_0x5982c8[_0x8080('0x3c')]=_['intersection'](_0x43f8a4[_0x8080('0x38')],qs[_0x8080('0x3d')](_0x31950b[_0x8080('0x39')]['fields']));_0x5982c8[_0x8080('0x3c')]=_0x5982c8[_0x8080('0x3c')]['length']?_0x5982c8[_0x8080('0x3c')]:_0x43f8a4[_0x8080('0x38')];if(_0x31950b[_0x8080('0x39')][_0x8080('0x4b')]){_0x5982c8[_0x8080('0x46')]=[{'all':!![]}];}_0x5982c8=_[_0x8080('0x44')]({},_0x5982c8,_0x31950b[_0x8080('0x4c')]);return db['FreshdeskAccount'][_0x8080('0x4d')](_0x5982c8)[_0x8080('0x17')](handleEntityNotFound(_0x46c3fe,null))[_0x8080('0x17')](respondWithResult(_0x46c3fe,null))['catch'](handleError(_0x46c3fe,null));};exports['create']=function(_0x186b6f,_0x339b1b){return db[_0x8080('0x33')][_0x8080('0x4e')](_0x186b6f['body'],{})['then'](respondWithResult(_0x339b1b,0xc9))[_0x8080('0x20')](handleError(_0x339b1b,null));};exports[_0x8080('0x2c')]=function(_0x7bfc77,_0x2bfe92){if(_0x7bfc77['body']['id']){delete _0x7bfc77[_0x8080('0x4f')]['id'];}return db[_0x8080('0x33')][_0x8080('0x4d')]({'where':{'id':_0x7bfc77[_0x8080('0x49')]['id']}})[_0x8080('0x17')](handleEntityNotFound(_0x2bfe92,null))['then'](saveUpdates(_0x7bfc77[_0x8080('0x4f')],null))[_0x8080('0x17')](respondWithResult(_0x2bfe92,null))[_0x8080('0x20')](handleError(_0x2bfe92,null));};exports[_0x8080('0x2d')]=function(_0x6c1f68,_0x33737a){return db[_0x8080('0x33')][_0x8080('0x4d')]({'where':{'id':_0x6c1f68[_0x8080('0x49')]['id']}})[_0x8080('0x17')](handleEntityNotFound(_0x33737a,null))[_0x8080('0x17')](removeEntity(_0x33737a,null))[_0x8080('0x20')](handleError(_0x33737a,null));};exports['getConfigurations']=function(_0x2b5b17,_0x324b8f,_0x469890){var _0xd6a22={};var _0x2c6872={};var _0x15012c;var _0x1d31ed;return db[_0x8080('0x33')][_0x8080('0x50')]({'where':{'id':_0x2b5b17[_0x8080('0x49')]['id']}})[_0x8080('0x17')](handleEntityNotFound(_0x324b8f,null))[_0x8080('0x17')](function(_0x4b8f39){if(_0x4b8f39){_0x15012c=_0x4b8f39;_0x2c6872['model']=_[_0x8080('0x4a')](db[_0x8080('0x51')][_0x8080('0x34')]);_0x2c6872[_0x8080('0x39')]=_['keys'](_0x2b5b17['query']);_0x2c6872[_0x8080('0x3a')]=_[_0x8080('0x3b')](_0x2c6872[_0x8080('0x38')],_0x2c6872[_0x8080('0x39')]);_0xd6a22[_0x8080('0x3c')]=_[_0x8080('0x3b')](_0x2c6872[_0x8080('0x38')],qs[_0x8080('0x3d')](_0x2b5b17[_0x8080('0x39')][_0x8080('0x3d')]));_0xd6a22[_0x8080('0x3c')]=_0xd6a22[_0x8080('0x3c')]['length']?_0xd6a22[_0x8080('0x3c')]:_0x2c6872[_0x8080('0x38')];_0xd6a22[_0x8080('0x3f')]=qs['sort'](_0x2b5b17[_0x8080('0x39')][_0x8080('0x40')]);_0xd6a22['where']=qs['filters'](_['pick'](_0x2b5b17[_0x8080('0x39')],_0x2c6872[_0x8080('0x3a')]));if(_0x2b5b17[_0x8080('0x39')][_0x8080('0x43')]){_0xd6a22[_0x8080('0x41')]=_[_0x8080('0x44')](_0xd6a22[_0x8080('0x41')],{'$or':_['map'](_0xd6a22[_0x8080('0x3c')],function(_0x3eac14){var _0x2a631a={};_0x2a631a[_0x3eac14]={'$like':'%'+_0x2b5b17[_0x8080('0x39')]['filter']+'%'};return _0x2a631a;})});}_0xd6a22=_['merge']({},_0xd6a22,_0x2b5b17['options']);return _0x15012c[_0x8080('0x52')](_0xd6a22);}})[_0x8080('0x17')](function(_0x163a61){if(_0x163a61){_0x1d31ed=_0x163a61[_0x8080('0x53')];if(!_0x2b5b17[_0x8080('0x39')][_0x8080('0x54')](_0x8080('0x3e'))){_0xd6a22[_0x8080('0x25')]=qs[_0x8080('0x25')](_0x2b5b17[_0x8080('0x39')][_0x8080('0x25')]);_0xd6a22[_0x8080('0x27')]=qs[_0x8080('0x27')](_0x2b5b17[_0x8080('0x39')][_0x8080('0x27')]);}return _0x15012c[_0x8080('0x52')](_0xd6a22);}})[_0x8080('0x17')](function(_0x3d76b6){if(_0x3d76b6){return _0x3d76b6?{'count':_0x1d31ed,'rows':_0x3d76b6}:null;}})[_0x8080('0x17')](respondWithResult(_0x324b8f,null))[_0x8080('0x20')](handleError(_0x324b8f,null));};exports[_0x8080('0x55')]=function(_0x211b5f,_0x3b437b,_0x1c92a2){if(_0x211b5f[_0x8080('0x4f')]['id']){delete _0x211b5f[_0x8080('0x4f')]['id'];}return db[_0x8080('0x33')][_0x8080('0x50')]({'where':{'id':_0x211b5f[_0x8080('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b437b,null))['then'](function(_0x367a66){if(_0x367a66){_0x211b5f['body']['AccountId']=_0x367a66['id'];_0x211b5f[_0x8080('0x4f')][_0x8080('0x56')]=integrations[_0x8080('0x57')](_0x211b5f['body'][_0x8080('0x58')],_0x211b5f['body'][_0x8080('0x36')]);_0x211b5f['body']['Descriptions']=integrations['getDescriptions'](_0x211b5f[_0x8080('0x4f')][_0x8080('0x58')],_0x211b5f['body'][_0x8080('0x36')]);return db[_0x8080('0x51')][_0x8080('0x4e')](_0x211b5f['body'],{'include':[{'model':db[_0x8080('0x59')],'as':_0x8080('0x56')},{'model':db[_0x8080('0x59')],'as':_0x8080('0x5a')}]});}return null;})[_0x8080('0x17')](respondWithResult(_0x3b437b,null))[_0x8080('0x20')](handleError(_0x3b437b,null));};exports[_0x8080('0x5b')]=function(_0x3d0ef7,_0x4e3ddd,_0x5a7069){var _0x55d22b='';return db[_0x8080('0x33')]['findOne']({'where':{'id':_0x3d0ef7['params']['id']},'attributes':['id',_0x8080('0x5c'),_0x8080('0x5d')]})[_0x8080('0x17')](handleEntityNotFound(_0x4e3ddd,null))[_0x8080('0x17')](function(_0xb6abce){if(_0xb6abce){_0x55d22b=_0xb6abce[_0x8080('0x5c')];var _0x599fa3=_0x55d22b[_0x8080('0x5e')](-0x1);if(_0x599fa3==='/'){_0x55d22b=_0x55d22b[_0x8080('0x5f')](0x0,_0x55d22b[_0x8080('0x60')](_0x599fa3));}return rp({'method':_0x8080('0x61'),'uri':util[_0x8080('0x62')](_0x8080('0x63'),_0x55d22b,_0x8080('0x64')),'headers':{'Authorization':util[_0x8080('0x62')](_0x8080('0x65'),new Buffer(util['format'](_0x8080('0x66'),_0xb6abce[_0x8080('0x5d')]))[_0x8080('0x67')](_0x8080('0x68')))},'json':!![]});}})[_0x8080('0x17')](function(_0x5d7785){if(_0x5d7785){var _0x314678=[_0x8080('0x69'),_0x8080('0x6a'),_0x8080('0x6b'),'description',_0x8080('0x22'),_0x8080('0x6c'),_0x8080('0x6d'),_0x8080('0x6e'),'ticket_type',_0x8080('0x6d'),_0x8080('0x6f')];_['remove'](_0x5d7785,function(_0x4b65d8){return _0x314678[_0x8080('0x70')](_0x4b65d8['name'])||!_0x4b65d8['default']&&_0x4b65d8['type']!==_0x8080('0x71')&&_0x4b65d8['type']!=='custom_dropdown';});return{'count':_0x5d7785[_0x8080('0x53')],'rows':_[_0x8080('0x32')](_0x5d7785,function(_0x4c1490){return{'id':_0x4c1490[_0x8080('0x2f')],'name':_0x4c1490['label'],'custom':!_0x4c1490[_0x8080('0x72')],'options':_0x4c1490['choices']?_[_0x8080('0x32')](_0x4c1490[_0x8080('0x73')],function(_0x13b909){return{'name':_['capitalize'](_0x13b909),'value':_0x13b909};}):[]};})};}})[_0x8080('0x17')](respondWithResult(_0x4e3ddd,null))[_0x8080('0x20')](function(_0x4a5230){var _0x7c476d=_0x3d0ef7['query'][_0x8080('0x74')]?0x1f4:_0x4a5230[_0x8080('0x75')]||0x1f4;logger[_0x8080('0x1c')](_0x8080('0x76'),'getFields',_0x7c476d,JSON['stringify'](_0x4a5230));delete _0x4a5230[_0x8080('0x2f')];if(_0x7c476d===0x191){_0x7c476d=0x190;}_0x4e3ddd[_0x8080('0x22')](_0x7c476d)[_0x8080('0x30')](_0x3d0ef7[_0x8080('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4a5230[_0x8080('0x75')]}:_0x4a5230);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f8950ab..b8b1c27 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 _0xbfb1=['../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x6f6e1f,_0x109b4e){var _0x5357f9=function(_0x553d07){while(--_0x553d07){_0x6f6e1f['push'](_0x6f6e1f['shift']());}};_0x5357f9(++_0x109b4e);}(_0xbfb1,0x17a));var _0x1bfb=function(_0x354151,_0x3f2fe1){_0x354151=_0x354151-0x0;var _0x2ecc93=_0xbfb1[_0x354151];return _0x2ecc93;};'use strict';var _=require(_0x1bfb('0x0'));var util=require('util');var logger=require(_0x1bfb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1bfb('0x2'));var rp=require(_0x1bfb('0x3'));var fs=require('fs');var path=require(_0x1bfb('0x4'));var rimraf=require('rimraf');var config=require(_0x1bfb('0x5'));var attributes=require(_0x1bfb('0x6'));var integrations=require(_0x1bfb('0x7'));module[_0x1bfb('0x8')]=function(_0x382362,_0x1146bf){return _0x382362[_0x1bfb('0x9')]('FreshdeskAccount',attributes,{'tableName':_0x1bfb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33dd=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3f0f94,_0x1f71fd){var _0x5b5d41=function(_0x3c272f){while(--_0x3c272f){_0x3f0f94['push'](_0x3f0f94['shift']());}};_0x5b5d41(++_0x1f71fd);}(_0x33dd,0x172));var _0xd33d=function(_0xb5711f,_0x2c684e){_0xb5711f=_0xb5711f-0x0;var _0x12958f=_0x33dd[_0xb5711f];return _0x12958f;};'use strict';var _=require(_0xd33d('0x0'));var util=require('util');var logger=require(_0xd33d('0x1'))(_0xd33d('0x2'));var moment=require(_0xd33d('0x3'));var BPromise=require(_0xd33d('0x4'));var rp=require(_0xd33d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd33d('0x6'));var config=require(_0xd33d('0x7'));var attributes=require(_0xd33d('0x8'));var integrations=require(_0xd33d('0x9'));module[_0xd33d('0xa')]=function(_0x4f8489,_0x19d4a2){return _0x4f8489[_0xd33d('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xd33d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 8476822..96af88e 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 _0x9f47=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','model','map','stringify','ShowFreshdeskAccount','find','then','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2d0531,_0x1f493d){var _0x2b2c85=function(_0x3cac9d){while(--_0x3cac9d){_0x2d0531['push'](_0x2d0531['shift']());}};_0x2b2c85(++_0x1f493d);}(_0x9f47,0xaf));var _0x79f4=function(_0x373e3b,_0x5f5440){_0x373e3b=_0x373e3b-0x0;var _0x526f13=_0x9f47[_0x373e3b];return _0x526f13;};'use strict';var _=require(_0x79f4('0x0'));var util=require('util');var moment=require(_0x79f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x79f4('0x2'));var fs=require('fs');var Redis=require(_0x79f4('0x3'));var db=require(_0x79f4('0x4'))['db'];var utils=require(_0x79f4('0x5'));var logger=require(_0x79f4('0x6'))(_0x79f4('0x7'));var config=require(_0x79f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x79f4('0x9')][_0x79f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aec12,_0x4334fc,_0x359b6c){return new BPromise(function(_0x1831d4,_0x39adef){return client[_0x79f4('0xb')](_0x4aec12,_0x359b6c)['then'](function(_0xc9d1c9){logger[_0x79f4('0xc')](_0x79f4('0xd'),_0x4334fc,'request\x20sent');logger[_0x79f4('0xe')](_0x79f4('0xf'),_0x4334fc,_0x79f4('0x10'),JSON['stringify'](_0xc9d1c9));if(_0xc9d1c9[_0x79f4('0x11')]){if(_0xc9d1c9[_0x79f4('0x11')][_0x79f4('0x12')]===0x1f4){logger[_0x79f4('0x11')](_0x79f4('0xd'),_0x4334fc,_0xc9d1c9[_0x79f4('0x11')][_0x79f4('0x13')]);return _0x39adef(_0xc9d1c9[_0x79f4('0x11')]['message']);}logger[_0x79f4('0x11')](_0x79f4('0xd'),_0x4334fc,_0xc9d1c9['error'][_0x79f4('0x13')]);return _0x1831d4(_0xc9d1c9[_0x79f4('0x11')][_0x79f4('0x13')]);}else{logger[_0x79f4('0xc')](_0x79f4('0xd'),_0x4334fc,'request\x20sent');_0x1831d4(_0xc9d1c9[_0x79f4('0x14')][_0x79f4('0x13')]);}})[_0x79f4('0x15')](function(_0x3357b1){logger['error'](_0x79f4('0xd'),_0x4334fc,_0x3357b1);_0x39adef(_0x3357b1);});});}exports[_0x79f4('0x16')]=function(_0x27362d){var _0x2d64c9=this;return new Promise(function(_0x184add,_0x25696c){return db[_0x79f4('0x17')][_0x79f4('0x18')]({'raw':_0x27362d[_0x79f4('0x19')]?_0x27362d[_0x79f4('0x19')][_0x79f4('0x1a')]===undefined?!![]:![]:!![],'where':_0x27362d[_0x79f4('0x19')]?_0x27362d[_0x79f4('0x19')]['where']||null:null,'attributes':_0x27362d['options']?_0x27362d['options'][_0x79f4('0x1b')]||null:null,'limit':_0x27362d[_0x79f4('0x19')]?_0x27362d[_0x79f4('0x19')][_0x79f4('0x1c')]||null:null,'include':_0x27362d[_0x79f4('0x19')]?_0x27362d['options'][_0x79f4('0x1d')]?_['map'](_0x27362d[_0x79f4('0x19')][_0x79f4('0x1d')],function(_0x42b218){return{'model':db[_0x42b218[_0x79f4('0x1e')]],'as':_0x42b218['as'],'attributes':_0x42b218[_0x79f4('0x1b')],'include':_0x42b218[_0x79f4('0x1d')]?_[_0x79f4('0x1f')](_0x42b218[_0x79f4('0x1d')],function(_0x14517f){return{'model':db[_0x14517f['model']],'as':_0x14517f['as'],'attributes':_0x14517f[_0x79f4('0x1b')],'include':_0x14517f[_0x79f4('0x1d')]?_[_0x79f4('0x1f')](_0x14517f['include'],function(_0x517251){return{'model':db[_0x517251['model']],'as':_0x517251['as'],'attributes':_0x517251[_0x79f4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x146d62){logger[_0x79f4('0xc')](_0x79f4('0x16'),_0x27362d);logger[_0x79f4('0xe')](_0x79f4('0x16'),_0x27362d,JSON[_0x79f4('0x20')](_0x146d62));_0x184add(_0x146d62);})['catch'](function(_0x200ca9){logger[_0x79f4('0x11')](_0x79f4('0x16'),_0x200ca9['message'],_0x27362d);_0x25696c(_0x2d64c9['error'](0x1f4,_0x200ca9[_0x79f4('0x13')]));});});};exports[_0x79f4('0x21')]=function(_0x793fdc){var _0x324b57=this;return new Promise(function(_0x5185c3,_0x2ea5cf){return db[_0x79f4('0x17')][_0x79f4('0x22')]({'raw':_0x793fdc[_0x79f4('0x19')]?_0x793fdc[_0x79f4('0x19')][_0x79f4('0x1a')]===undefined?!![]:![]:!![],'where':_0x793fdc[_0x79f4('0x19')]?_0x793fdc['options']['where']||null:null,'attributes':_0x793fdc[_0x79f4('0x19')]?_0x793fdc[_0x79f4('0x19')][_0x79f4('0x1b')]||null:null,'include':_0x793fdc[_0x79f4('0x19')]?_0x793fdc['options'][_0x79f4('0x1d')]?_['map'](_0x793fdc[_0x79f4('0x19')]['include'],function(_0x53c52a){return{'model':db[_0x53c52a['model']],'as':_0x53c52a['as'],'attributes':_0x53c52a[_0x79f4('0x1b')],'include':_0x53c52a[_0x79f4('0x1d')]?_['map'](_0x53c52a['include'],function(_0x5ab3db){return{'model':db[_0x5ab3db[_0x79f4('0x1e')]],'as':_0x5ab3db['as'],'attributes':_0x5ab3db[_0x79f4('0x1b')],'include':_0x5ab3db[_0x79f4('0x1d')]?_[_0x79f4('0x1f')](_0x5ab3db[_0x79f4('0x1d')],function(_0x4c5877){return{'model':db[_0x4c5877[_0x79f4('0x1e')]],'as':_0x4c5877['as'],'attributes':_0x4c5877[_0x79f4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x79f4('0x23')](function(_0x5e4cfc){logger[_0x79f4('0xc')]('ShowFreshdeskAccount',_0x793fdc);logger[_0x79f4('0xe')](_0x79f4('0x21'),_0x793fdc,JSON[_0x79f4('0x20')](_0x5e4cfc));_0x5185c3(_0x5e4cfc);})[_0x79f4('0x15')](function(_0x39c00b){logger[_0x79f4('0x11')](_0x79f4('0x21'),_0x39c00b[_0x79f4('0x13')],_0x793fdc);_0x2ea5cf(_0x324b57[_0x79f4('0x11')](0x1f4,_0x39c00b[_0x79f4('0x13')]));});});}; \ No newline at end of file +var _0x8748=['debug','ShowFreshdeskAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','include','model','map','GetFreshdeskAccount'];(function(_0x42b44f,_0x4ee6e1){var _0x14ce90=function(_0x15c782){while(--_0x15c782){_0x42b44f['push'](_0x42b44f['shift']());}};_0x14ce90(++_0x4ee6e1);}(_0x8748,0x161));var _0x8874=function(_0x32f099,_0x8e8c68){_0x32f099=_0x32f099-0x0;var _0x4d010a=_0x8748[_0x32f099];return _0x4d010a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8874('0x0'));var BPromise=require(_0x8874('0x1'));var rs=require(_0x8874('0x2'));var fs=require('fs');var Redis=require(_0x8874('0x3'));var db=require(_0x8874('0x4'))['db'];var utils=require(_0x8874('0x5'));var logger=require(_0x8874('0x6'))(_0x8874('0x7'));var config=require(_0x8874('0x8'));var jayson=require(_0x8874('0x9'));var client=jayson['client'][_0x8874('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ecb9d,_0xe67762,_0x5b40ab){return new BPromise(function(_0x272a34,_0x4ab700){return client['request'](_0x2ecb9d,_0x5b40ab)[_0x8874('0xb')](function(_0x5bd39c){logger[_0x8874('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0xe67762,_0x8874('0xd'));logger['debug'](_0x8874('0xe'),_0xe67762,'request\x20sent',JSON[_0x8874('0xf')](_0x5bd39c));if(_0x5bd39c[_0x8874('0x10')]){if(_0x5bd39c[_0x8874('0x10')][_0x8874('0x11')]===0x1f4){logger[_0x8874('0x10')](_0x8874('0x12'),_0xe67762,_0x5bd39c['error']['message']);return _0x4ab700(_0x5bd39c['error'][_0x8874('0x13')]);}logger[_0x8874('0x10')](_0x8874('0x12'),_0xe67762,_0x5bd39c[_0x8874('0x10')][_0x8874('0x13')]);return _0x272a34(_0x5bd39c[_0x8874('0x10')][_0x8874('0x13')]);}else{logger[_0x8874('0xc')](_0x8874('0x12'),_0xe67762,_0x8874('0xd'));_0x272a34(_0x5bd39c[_0x8874('0x14')][_0x8874('0x13')]);}})[_0x8874('0x15')](function(_0x15702d){logger[_0x8874('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xe67762,_0x15702d);_0x4ab700(_0x15702d);});});}exports['GetFreshdeskAccount']=function(_0x2af506){var _0x8dd50c=this;return new Promise(function(_0x48faf9,_0x7d2fba){return db[_0x8874('0x16')][_0x8874('0x17')]({'raw':_0x2af506[_0x8874('0x18')]?_0x2af506[_0x8874('0x18')][_0x8874('0x19')]===undefined?!![]:![]:!![],'where':_0x2af506[_0x8874('0x18')]?_0x2af506[_0x8874('0x18')][_0x8874('0x1a')]||null:null,'attributes':_0x2af506['options']?_0x2af506['options'][_0x8874('0x1b')]||null:null,'limit':_0x2af506['options']?_0x2af506[_0x8874('0x18')]['limit']||null:null,'include':_0x2af506[_0x8874('0x18')]?_0x2af506[_0x8874('0x18')][_0x8874('0x1c')]?_['map'](_0x2af506[_0x8874('0x18')][_0x8874('0x1c')],function(_0x86301e){return{'model':db[_0x86301e[_0x8874('0x1d')]],'as':_0x86301e['as'],'attributes':_0x86301e[_0x8874('0x1b')],'include':_0x86301e[_0x8874('0x1c')]?_[_0x8874('0x1e')](_0x86301e[_0x8874('0x1c')],function(_0x3842d3){return{'model':db[_0x3842d3['model']],'as':_0x3842d3['as'],'attributes':_0x3842d3['attributes'],'include':_0x3842d3[_0x8874('0x1c')]?_[_0x8874('0x1e')](_0x3842d3['include'],function(_0x5a424c){return{'model':db[_0x5a424c[_0x8874('0x1d')]],'as':_0x5a424c['as'],'attributes':_0x5a424c[_0x8874('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5aac4c){logger[_0x8874('0xc')](_0x8874('0x1f'),_0x2af506);logger[_0x8874('0x20')](_0x8874('0x1f'),_0x2af506,JSON[_0x8874('0xf')](_0x5aac4c));_0x48faf9(_0x5aac4c);})[_0x8874('0x15')](function(_0x4f0b4b){logger[_0x8874('0x10')]('GetFreshdeskAccount',_0x4f0b4b[_0x8874('0x13')],_0x2af506);_0x7d2fba(_0x8dd50c[_0x8874('0x10')](0x1f4,_0x4f0b4b[_0x8874('0x13')]));});});};exports[_0x8874('0x21')]=function(_0x1239e1){var _0xee620e=this;return new Promise(function(_0x30ceda,_0x14260c){return db['FreshdeskAccount'][_0x8874('0x22')]({'raw':_0x1239e1[_0x8874('0x18')]?_0x1239e1[_0x8874('0x18')][_0x8874('0x19')]===undefined?!![]:![]:!![],'where':_0x1239e1[_0x8874('0x18')]?_0x1239e1[_0x8874('0x18')][_0x8874('0x1a')]||null:null,'attributes':_0x1239e1[_0x8874('0x18')]?_0x1239e1[_0x8874('0x18')][_0x8874('0x1b')]||null:null,'include':_0x1239e1[_0x8874('0x18')]?_0x1239e1[_0x8874('0x18')][_0x8874('0x1c')]?_[_0x8874('0x1e')](_0x1239e1[_0x8874('0x18')]['include'],function(_0x5681f0){return{'model':db[_0x5681f0[_0x8874('0x1d')]],'as':_0x5681f0['as'],'attributes':_0x5681f0['attributes'],'include':_0x5681f0[_0x8874('0x1c')]?_[_0x8874('0x1e')](_0x5681f0[_0x8874('0x1c')],function(_0x2a5122){return{'model':db[_0x2a5122[_0x8874('0x1d')]],'as':_0x2a5122['as'],'attributes':_0x2a5122[_0x8874('0x1b')],'include':_0x2a5122['include']?_[_0x8874('0x1e')](_0x2a5122[_0x8874('0x1c')],function(_0x304e63){return{'model':db[_0x304e63[_0x8874('0x1d')]],'as':_0x304e63['as'],'attributes':_0x304e63['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1911ee){logger[_0x8874('0xc')](_0x8874('0x21'),_0x1239e1);logger['debug']('ShowFreshdeskAccount',_0x1239e1,JSON[_0x8874('0xf')](_0x1911ee));_0x30ceda(_0x1911ee);})[_0x8874('0x15')](function(_0x1350ba){logger['error'](_0x8874('0x21'),_0x1350ba['message'],_0x1239e1);_0x14260c(_0xee620e[_0x8874('0x10')](0x1f4,_0x1350ba[_0x8874('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 253d74e..705cb76 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 _0x7ff7=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x358000,_0x4efb0e){var _0x53d1c0=function(_0x3690d8){while(--_0x3690d8){_0x358000['push'](_0x358000['shift']());}};_0x53d1c0(++_0x4efb0e);}(_0x7ff7,0xc2));var _0x77ff=function(_0x1db678,_0x2965a0){_0x1db678=_0x1db678-0x0;var _0x5bd949=_0x7ff7[_0x1db678];return _0x5bd949;};'use strict';var multer=require(_0x77ff('0x0'));var util=require(_0x77ff('0x1'));var path=require(_0x77ff('0x2'));var timeout=require(_0x77ff('0x3'));var express=require(_0x77ff('0x4'));var router=express['Router']();var fs_extra=require(_0x77ff('0x5'));var auth=require(_0x77ff('0x6'));var interaction=require(_0x77ff('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x77ff('0x8')]('/',auth[_0x77ff('0x9')](),controller[_0x77ff('0xa')]);router[_0x77ff('0x8')](_0x77ff('0xb'),auth[_0x77ff('0x9')](),controller['show']);router[_0x77ff('0x8')](_0x77ff('0xc'),auth['isAuthenticated'](),controller[_0x77ff('0xd')]);router[_0x77ff('0x8')]('/:id/subjects',auth[_0x77ff('0x9')](),controller[_0x77ff('0xe')]);router[_0x77ff('0x8')](_0x77ff('0xf'),auth[_0x77ff('0x9')](),controller[_0x77ff('0x10')]);router[_0x77ff('0x8')](_0x77ff('0x11'),auth['isAuthenticated'](),controller[_0x77ff('0x12')]);router[_0x77ff('0x13')]('/',auth[_0x77ff('0x9')](),controller[_0x77ff('0x14')]);router[_0x77ff('0x13')]('/:id/tags',auth['isAuthenticated'](),controller[_0x77ff('0x15')]);router[_0x77ff('0x16')](_0x77ff('0xb'),auth[_0x77ff('0x9')](),controller[_0x77ff('0x17')]);router[_0x77ff('0x18')]('/:id',auth[_0x77ff('0x9')](),controller[_0x77ff('0x19')]);module[_0x77ff('0x1a')]=router; \ No newline at end of file +var _0xdb60=['/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','setTags','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x3ed004,_0x1ad442){var _0x15ea5c=function(_0x69854b){while(--_0x69854b){_0x3ed004['push'](_0x3ed004['shift']());}};_0x15ea5c(++_0x1ad442);}(_0xdb60,0xfd));var _0x0db6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb60[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0db6('0x0'));var util=require(_0x0db6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0db6('0x2')]();var fs_extra=require(_0x0db6('0x3'));var auth=require(_0x0db6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x0db6('0x5')]('/',auth[_0x0db6('0x6')](),controller['index']);router[_0x0db6('0x5')](_0x0db6('0x7'),auth[_0x0db6('0x6')](),controller[_0x0db6('0x8')]);router['get'](_0x0db6('0x9'),auth[_0x0db6('0x6')](),controller[_0x0db6('0xa')]);router[_0x0db6('0x5')]('/:id/subjects',auth[_0x0db6('0x6')](),controller[_0x0db6('0xb')]);router[_0x0db6('0x5')](_0x0db6('0xc'),auth['isAuthenticated'](),controller[_0x0db6('0xd')]);router[_0x0db6('0x5')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x0db6('0xe')]('/',auth[_0x0db6('0x6')](),controller[_0x0db6('0xf')]);router[_0x0db6('0xe')]('/:id/tags',auth[_0x0db6('0x6')](),controller[_0x0db6('0x10')]);router['put']('/:id',auth[_0x0db6('0x6')](),controller['update']);router[_0x0db6('0x11')](_0x0db6('0x7'),auth['isAuthenticated'](),controller[_0x0db6('0x12')]);module[_0x0db6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3d3d32d..accf5af 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 _0xee95=['sequelize','exports','STRING'];(function(_0x56dd47,_0x82906){var _0x263c39=function(_0x58ee6a){while(--_0x58ee6a){_0x56dd47['push'](_0x56dd47['shift']());}};_0x263c39(++_0x82906);}(_0xee95,0x1f2));var _0x5ee9=function(_0xbd383d,_0x295862){_0xbd383d=_0xbd383d-0x0;var _0x4a128f=_0xee95[_0xbd383d];return _0x4a128f;};'use strict';var Sequelize=require(_0x5ee9('0x0'));module[_0x5ee9('0x1')]={'name':{'type':Sequelize[_0x5ee9('0x2')]},'description':{'type':Sequelize[_0x5ee9('0x2')]}}; \ No newline at end of file +var _0x8c49=['STRING'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x8c49,0x1f0));var _0x98c4=function(_0x655ab,_0x3bf2e9){_0x655ab=_0x655ab-0x0;var _0x1c456a=_0x8c49[_0x655ab];return _0x1c456a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x98c4('0x0')]},'description':{'type':Sequelize[_0x98c4('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index da71a55..368e793 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 _0x2333=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','stack','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','destroy','findOne','FreshdeskField','pick','getFields','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x2333,0x11a));var _0x3233=function(_0x22eefa,_0x2d70d4){_0x22eefa=_0x22eefa-0x0;var _0x3ca564=_0x2333[_0x22eefa];return _0x3ca564;};'use strict';var emlformat=require(_0x3233('0x0'));var rimraf=require(_0x3233('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3233('0x2'));var moment=require(_0x3233('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3233('0x4'));var util=require(_0x3233('0x5'));var path=require(_0x3233('0x6'));var sox=require(_0x3233('0x7'));var csv=require(_0x3233('0x8'));var ejs=require(_0x3233('0x9'));var fs=require('fs');var fs_extra=require(_0x3233('0xa'));var _=require(_0x3233('0xb'));var squel=require(_0x3233('0xc'));var crypto=require(_0x3233('0xd'));var jsforce=require(_0x3233('0xe'));var deskjs=require(_0x3233('0xf'));var toCsv=require(_0x3233('0x8'));var querystring=require(_0x3233('0x10'));var Papa=require(_0x3233('0x11'));var Redis=require(_0x3233('0x12'));var authService=require(_0x3233('0x13'));var qs=require(_0x3233('0x14'));var as=require(_0x3233('0x15'));var hardwareService=require(_0x3233('0x16'));var logger=require(_0x3233('0x17'))('api');var utils=require(_0x3233('0x18'));var config=require(_0x3233('0x19'));var licenseUtil=require(_0x3233('0x1a'));var db=require(_0x3233('0x1b'))['db'];var jayson=require(_0x3233('0x1c'));var client=jayson[_0x3233('0x1d')][_0x3233('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x17ab5f,_0x35d954,_0x37ce62,_0x428b44){return new BPromise(function(_0x27e9fd,_0x7f5e07){var _0x562756=_0x428b44||client;return _0x562756['request'](_0x17ab5f,_0x37ce62)[_0x3233('0x1f')](function(_0x26a41e){logger[_0x3233('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x35d954,_0x3233('0x21'));logger[_0x3233('0x22')](_0x3233('0x23'),_0x35d954,'request\x20sent',JSON[_0x3233('0x24')](_0x26a41e));if(_0x26a41e[_0x3233('0x25')]){if(_0x26a41e['error'][_0x3233('0x26')]===0x1f4){logger['error'](_0x3233('0x27'),_0x35d954,_0x26a41e['error']['message']);return _0x7f5e07(_0x26a41e['error'][_0x3233('0x28')]);}logger['error'](_0x3233('0x27'),_0x35d954,_0x26a41e['error'][_0x3233('0x28')]);return _0x27e9fd(_0x26a41e[_0x3233('0x25')][_0x3233('0x28')]);}else{logger[_0x3233('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x35d954,_0x3233('0x21'));_0x27e9fd(_0x26a41e[_0x3233('0x29')][_0x3233('0x28')]);}})['catch'](function(_0x290d77){logger['error'](_0x3233('0x27'),_0x35d954,_0x290d77);_0x7f5e07(_0x290d77);});});}function respondWithStatusCode(_0xa73f3e,_0x43227e){_0x43227e=_0x43227e||0xcc;return function(_0x4c3875){if(_0x4c3875){return _0xa73f3e[_0x3233('0x2a')](_0x43227e);}return _0xa73f3e['status'](_0x43227e)[_0x3233('0x2b')]();};}function respondWithResult(_0xf32321,_0x56f216){_0x56f216=_0x56f216||0xc8;return function(_0x3351d3){if(_0x3351d3){return _0xf32321['status'](_0x56f216)['json'](_0x3351d3);}};}function respondWithFilteredResult(_0x430e8e,_0x39a345){return function(_0x5d8e63){if(_0x5d8e63){var _0x276b6=typeof _0x39a345[_0x3233('0x2c')]===_0x3233('0x2d')&&typeof _0x39a345[_0x3233('0x2e')]===_0x3233('0x2d');var _0x5549d5=_0x5d8e63[_0x3233('0x2f')];var _0xd4171b=_0x276b6?0x0:_0x39a345[_0x3233('0x2c')];var _0xc87d63=_0x276b6?_0x5d8e63[_0x3233('0x2f')]:_0x39a345[_0x3233('0x2c')]+_0x39a345[_0x3233('0x2e')];var _0x3074d7;if(_0xc87d63>=_0x5549d5){_0xc87d63=_0x5549d5;_0x3074d7=0xc8;}else{_0x3074d7=0xce;}_0x430e8e[_0x3233('0x30')](_0x3074d7);return _0x430e8e['set'](_0x3233('0x31'),_0xd4171b+'-'+_0xc87d63+'/'+_0x5549d5)[_0x3233('0x32')](_0x5d8e63);}return null;};}function patchUpdates(_0x559515){return function(_0x2c55f7){try{jsonpatch[_0x3233('0x33')](_0x2c55f7,_0x559515,!![]);}catch(_0x53b6fe){return BPromise[_0x3233('0x34')](_0x53b6fe);}return _0x2c55f7[_0x3233('0x35')]();};}function saveUpdates(_0x54947b,_0x25abd1){return function(_0xfb5932){if(_0xfb5932){return _0xfb5932['update'](_0x54947b)[_0x3233('0x1f')](function(_0x3883bd){return _0x3883bd;});}return null;};}function removeEntity(_0x5412f1,_0x4ef94a){return function(_0x41826f){if(_0x41826f){return _0x41826f['destroy']()[_0x3233('0x1f')](function(){_0x5412f1[_0x3233('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a4e6,_0x861264){return function(_0x36eab7){if(!_0x36eab7){_0x21a4e6[_0x3233('0x2a')](0x194);}return _0x36eab7;};}function handleError(_0xa35766,_0x127f67){_0x127f67=_0x127f67||0x1f4;return function(_0x56a79a){logger['error'](_0x56a79a[_0x3233('0x36')]);if(_0x56a79a[_0x3233('0x37')]){delete _0x56a79a['name'];}_0xa35766[_0x3233('0x30')](_0x127f67)['send'](_0x56a79a);};}exports[_0x3233('0x38')]=function(_0x15bdeb,_0x470d2e){var _0x5f4be0={},_0xd30b2b={},_0xe97e1b={'count':0x0,'rows':[]};var _0x21e7f8=_['map'](db[_0x3233('0x39')][_0x3233('0x3a')],function(_0x392e18){return{'name':_0x392e18[_0x3233('0x3b')],'type':_0x392e18[_0x3233('0x3c')][_0x3233('0x3d')]};});_0xd30b2b[_0x3233('0x3e')]=_[_0x3233('0x3f')](_0x21e7f8,'name');_0xd30b2b[_0x3233('0x40')]=_[_0x3233('0x41')](_0x15bdeb['query']);_0xd30b2b[_0x3233('0x42')]=_['intersection'](_0xd30b2b[_0x3233('0x3e')],_0xd30b2b['query']);_0x5f4be0[_0x3233('0x43')]=_[_0x3233('0x44')](_0xd30b2b[_0x3233('0x3e')],qs[_0x3233('0x45')](_0x15bdeb[_0x3233('0x40')]['fields']));_0x5f4be0['attributes']=_0x5f4be0[_0x3233('0x43')]['length']?_0x5f4be0[_0x3233('0x43')]:_0xd30b2b[_0x3233('0x3e')];if(!_0x15bdeb[_0x3233('0x40')][_0x3233('0x46')](_0x3233('0x47'))){_0x5f4be0[_0x3233('0x2e')]=qs['limit'](_0x15bdeb[_0x3233('0x40')][_0x3233('0x2e')]);_0x5f4be0[_0x3233('0x2c')]=qs['offset'](_0x15bdeb['query']['offset']);}_0x5f4be0[_0x3233('0x48')]=qs[_0x3233('0x49')](_0x15bdeb[_0x3233('0x40')][_0x3233('0x49')]);_0x5f4be0['where']=qs[_0x3233('0x42')](_['pick'](_0x15bdeb[_0x3233('0x40')],_0xd30b2b[_0x3233('0x42')]),_0x21e7f8);if(_0x15bdeb['query'][_0x3233('0x4a')]){_0x5f4be0[_0x3233('0x4b')]=_[_0x3233('0x4c')](_0x5f4be0[_0x3233('0x4b')],{'$or':_[_0x3233('0x3f')](_0x21e7f8,function(_0x18d8ab){if(_0x18d8ab[_0x3233('0x3c')]!==_0x3233('0x4d')){var _0x3cefd2={};_0x3cefd2[_0x18d8ab['name']]={'$like':'%'+_0x15bdeb[_0x3233('0x40')][_0x3233('0x4a')]+'%'};return _0x3cefd2;}})});}_0x5f4be0=_[_0x3233('0x4c')]({},_0x5f4be0,_0x15bdeb[_0x3233('0x4e')]);var _0x16190b={'where':_0x5f4be0[_0x3233('0x4b')]};return db[_0x3233('0x39')][_0x3233('0x2f')](_0x16190b)[_0x3233('0x1f')](function(_0x4ecd59){_0xe97e1b[_0x3233('0x2f')]=_0x4ecd59;if(_0x15bdeb[_0x3233('0x40')][_0x3233('0x4f')]){_0x5f4be0['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x3233('0x50')](_0x5f4be0);})[_0x3233('0x1f')](function(_0x34f30d){_0xe97e1b[_0x3233('0x51')]=_0x34f30d;return _0xe97e1b;})[_0x3233('0x1f')](respondWithFilteredResult(_0x470d2e,_0x5f4be0))[_0x3233('0x52')](handleError(_0x470d2e,null));};exports[_0x3233('0x53')]=function(_0xf5467e,_0x1477f5){var _0x59deb1={'raw':![],'where':{'id':_0xf5467e[_0x3233('0x54')]['id']}},_0x4aa692={};_0x4aa692['model']=_[_0x3233('0x41')](db[_0x3233('0x39')][_0x3233('0x3a')]);_0x4aa692['query']=_[_0x3233('0x41')](_0xf5467e[_0x3233('0x40')]);_0x4aa692[_0x3233('0x42')]=_[_0x3233('0x44')](_0x4aa692['model'],_0x4aa692[_0x3233('0x40')]);_0x59deb1[_0x3233('0x43')]=_[_0x3233('0x44')](_0x4aa692[_0x3233('0x3e')],qs['fields'](_0xf5467e['query'][_0x3233('0x45')]));_0x59deb1[_0x3233('0x43')]=_0x59deb1[_0x3233('0x43')][_0x3233('0x55')]?_0x59deb1['attributes']:_0x4aa692[_0x3233('0x3e')];if(_0xf5467e['query'][_0x3233('0x4f')]){_0x59deb1[_0x3233('0x56')]=[{'all':!![]}];}_0x59deb1=_[_0x3233('0x4c')]({},_0x59deb1,_0xf5467e[_0x3233('0x4e')]);return db[_0x3233('0x39')]['find'](_0x59deb1)[_0x3233('0x1f')](handleEntityNotFound(_0x1477f5,null))[_0x3233('0x1f')](respondWithResult(_0x1477f5,null))['catch'](handleError(_0x1477f5,null));};exports[_0x3233('0x57')]=function(_0xd061d7,_0x1f965f){return db['FreshdeskConfiguration']['create'](_0xd061d7[_0x3233('0x58')],{})['then'](respondWithResult(_0x1f965f,0xc9))[_0x3233('0x52')](handleError(_0x1f965f,null));};exports['update']=function(_0x5b8d84,_0x1d7a7c){if(_0x5b8d84['body']['id']){delete _0x5b8d84['body']['id'];}return db['FreshdeskConfiguration'][_0x3233('0x59')]({'where':{'id':_0x5b8d84[_0x3233('0x54')]['id']}})[_0x3233('0x1f')](handleEntityNotFound(_0x1d7a7c,null))[_0x3233('0x1f')](saveUpdates(_0x5b8d84[_0x3233('0x58')],null))['then'](respondWithResult(_0x1d7a7c,null))[_0x3233('0x52')](handleError(_0x1d7a7c,null));};exports[_0x3233('0x5a')]=function(_0x463202,_0x571e1a){return db[_0x3233('0x39')][_0x3233('0x59')]({'where':{'id':_0x463202[_0x3233('0x54')]['id']}})[_0x3233('0x1f')](handleEntityNotFound(_0x571e1a,null))['then'](removeEntity(_0x571e1a,null))[_0x3233('0x52')](handleError(_0x571e1a,null));};exports['getFields']=function(_0x4235f7,_0x248105,_0x332920){var _0x2e2074={};var _0x531d97={};var _0x1dd34d;var _0x33c791;return db[_0x3233('0x39')][_0x3233('0x5b')]({'where':{'id':_0x4235f7[_0x3233('0x54')]['id']}})[_0x3233('0x1f')](handleEntityNotFound(_0x248105,null))[_0x3233('0x1f')](function(_0x4f63c5){if(_0x4f63c5){_0x1dd34d=_0x4f63c5;_0x531d97[_0x3233('0x3e')]=_[_0x3233('0x41')](db[_0x3233('0x5c')][_0x3233('0x3a')]);_0x531d97[_0x3233('0x40')]=_[_0x3233('0x41')](_0x4235f7[_0x3233('0x40')]);_0x531d97[_0x3233('0x42')]=_['intersection'](_0x531d97[_0x3233('0x3e')],_0x531d97['query']);_0x2e2074[_0x3233('0x43')]=_[_0x3233('0x44')](_0x531d97[_0x3233('0x3e')],qs[_0x3233('0x45')](_0x4235f7[_0x3233('0x40')][_0x3233('0x45')]));_0x2e2074[_0x3233('0x43')]=_0x2e2074[_0x3233('0x43')]['length']?_0x2e2074[_0x3233('0x43')]:_0x531d97[_0x3233('0x3e')];_0x2e2074['order']=qs[_0x3233('0x49')](_0x4235f7['query'][_0x3233('0x49')]);_0x2e2074[_0x3233('0x4b')]=qs[_0x3233('0x42')](_[_0x3233('0x5d')](_0x4235f7['query'],_0x531d97[_0x3233('0x42')]));if(_0x4235f7[_0x3233('0x40')][_0x3233('0x4a')]){_0x2e2074['where']=_[_0x3233('0x4c')](_0x2e2074[_0x3233('0x4b')],{'$or':_[_0x3233('0x3f')](_0x2e2074['attributes'],function(_0x36eeee){var _0x136dc5={};_0x136dc5[_0x36eeee]={'$like':'%'+_0x4235f7[_0x3233('0x40')][_0x3233('0x4a')]+'%'};return _0x136dc5;})});}_0x2e2074=_[_0x3233('0x4c')]({},_0x2e2074,_0x4235f7[_0x3233('0x4e')]);return _0x1dd34d[_0x3233('0x5e')](_0x2e2074);}})[_0x3233('0x1f')](function(_0x4b450e){if(_0x4b450e){_0x33c791=_0x4b450e[_0x3233('0x55')];if(!_0x4235f7[_0x3233('0x40')][_0x3233('0x46')](_0x3233('0x47'))){_0x2e2074[_0x3233('0x2e')]=qs['limit'](_0x4235f7[_0x3233('0x40')][_0x3233('0x2e')]);_0x2e2074[_0x3233('0x2c')]=qs[_0x3233('0x2c')](_0x4235f7[_0x3233('0x40')][_0x3233('0x2c')]);}return _0x1dd34d['getFields'](_0x2e2074);}})['then'](function(_0x319bcd){if(_0x319bcd){return _0x319bcd?{'count':_0x33c791,'rows':_0x319bcd}:null;}})[_0x3233('0x1f')](respondWithResult(_0x248105,null))[_0x3233('0x52')](handleError(_0x248105,null));};exports['getSubjects']=function(_0x514c5f,_0x54fe01,_0x1cdbc9){var _0x498b2f={};var _0x538f8a={};var _0x59fc78;var _0x2b4350;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x514c5f[_0x3233('0x54')]['id']}})[_0x3233('0x1f')](handleEntityNotFound(_0x54fe01,null))[_0x3233('0x1f')](function(_0x3427b8){if(_0x3427b8){_0x59fc78=_0x3427b8;_0x538f8a[_0x3233('0x3e')]=_[_0x3233('0x41')](db[_0x3233('0x5c')][_0x3233('0x3a')]);_0x538f8a['query']=_[_0x3233('0x41')](_0x514c5f[_0x3233('0x40')]);_0x538f8a[_0x3233('0x42')]=_['intersection'](_0x538f8a[_0x3233('0x3e')],_0x538f8a[_0x3233('0x40')]);_0x498b2f[_0x3233('0x43')]=_[_0x3233('0x44')](_0x538f8a['model'],qs['fields'](_0x514c5f[_0x3233('0x40')][_0x3233('0x45')]));_0x498b2f[_0x3233('0x43')]=_0x498b2f['attributes'][_0x3233('0x55')]?_0x498b2f[_0x3233('0x43')]:_0x538f8a[_0x3233('0x3e')];_0x498b2f[_0x3233('0x48')]=qs[_0x3233('0x49')](_0x514c5f[_0x3233('0x40')][_0x3233('0x49')]);_0x498b2f['where']=qs[_0x3233('0x42')](_[_0x3233('0x5d')](_0x514c5f[_0x3233('0x40')],_0x538f8a[_0x3233('0x42')]));if(_0x514c5f[_0x3233('0x40')][_0x3233('0x4a')]){_0x498b2f[_0x3233('0x4b')]=_[_0x3233('0x4c')](_0x498b2f[_0x3233('0x4b')],{'$or':_['map'](_0x498b2f[_0x3233('0x43')],function(_0x4171c8){var _0x2f8869={};_0x2f8869[_0x4171c8]={'$like':'%'+_0x514c5f[_0x3233('0x40')][_0x3233('0x4a')]+'%'};return _0x2f8869;})});}_0x498b2f=_[_0x3233('0x4c')]({},_0x498b2f,_0x514c5f[_0x3233('0x4e')]);return _0x59fc78['getSubjects'](_0x498b2f);}})['then'](function(_0x551f33){if(_0x551f33){_0x2b4350=_0x551f33[_0x3233('0x55')];if(!_0x514c5f[_0x3233('0x40')][_0x3233('0x46')](_0x3233('0x47'))){_0x498b2f[_0x3233('0x2e')]=qs[_0x3233('0x2e')](_0x514c5f['query'][_0x3233('0x2e')]);_0x498b2f[_0x3233('0x2c')]=qs['offset'](_0x514c5f[_0x3233('0x40')][_0x3233('0x2c')]);}return _0x59fc78[_0x3233('0x5f')](_0x498b2f);}})['then'](function(_0x33b902){if(_0x33b902){return _0x33b902?{'count':_0x2b4350,'rows':_0x33b902}:null;}})[_0x3233('0x1f')](respondWithResult(_0x54fe01,null))[_0x3233('0x52')](handleError(_0x54fe01,null));};exports[_0x3233('0x60')]=function(_0x26d165,_0x3da0a7,_0x252ac7){var _0x67148c={};var _0x1e01ee={};var _0xfb456c;var _0x26a8b3;return db[_0x3233('0x39')][_0x3233('0x5b')]({'where':{'id':_0x26d165[_0x3233('0x54')]['id']}})[_0x3233('0x1f')](handleEntityNotFound(_0x3da0a7,null))[_0x3233('0x1f')](function(_0x218659){if(_0x218659){_0xfb456c=_0x218659;_0x1e01ee['model']=_['keys'](db[_0x3233('0x5c')][_0x3233('0x3a')]);_0x1e01ee[_0x3233('0x40')]=_['keys'](_0x26d165[_0x3233('0x40')]);_0x1e01ee[_0x3233('0x42')]=_['intersection'](_0x1e01ee[_0x3233('0x3e')],_0x1e01ee[_0x3233('0x40')]);_0x67148c[_0x3233('0x43')]=_[_0x3233('0x44')](_0x1e01ee[_0x3233('0x3e')],qs['fields'](_0x26d165[_0x3233('0x40')][_0x3233('0x45')]));_0x67148c['attributes']=_0x67148c[_0x3233('0x43')][_0x3233('0x55')]?_0x67148c[_0x3233('0x43')]:_0x1e01ee[_0x3233('0x3e')];_0x67148c['order']=qs[_0x3233('0x49')](_0x26d165[_0x3233('0x40')][_0x3233('0x49')]);_0x67148c[_0x3233('0x4b')]=qs[_0x3233('0x42')](_[_0x3233('0x5d')](_0x26d165[_0x3233('0x40')],_0x1e01ee[_0x3233('0x42')]));if(_0x26d165[_0x3233('0x40')][_0x3233('0x4a')]){_0x67148c[_0x3233('0x4b')]=_['merge'](_0x67148c[_0x3233('0x4b')],{'$or':_['map'](_0x67148c['attributes'],function(_0x5a42a7){var _0x5ae47d={};_0x5ae47d[_0x5a42a7]={'$like':'%'+_0x26d165[_0x3233('0x40')][_0x3233('0x4a')]+'%'};return _0x5ae47d;})});}_0x67148c=_[_0x3233('0x4c')]({},_0x67148c,_0x26d165[_0x3233('0x4e')]);return _0xfb456c[_0x3233('0x60')](_0x67148c);}})[_0x3233('0x1f')](function(_0x32a6a3){if(_0x32a6a3){_0x26a8b3=_0x32a6a3['length'];if(!_0x26d165[_0x3233('0x40')][_0x3233('0x46')](_0x3233('0x47'))){_0x67148c[_0x3233('0x2e')]=qs[_0x3233('0x2e')](_0x26d165[_0x3233('0x40')][_0x3233('0x2e')]);_0x67148c['offset']=qs[_0x3233('0x2c')](_0x26d165[_0x3233('0x40')][_0x3233('0x2c')]);}return _0xfb456c['getDescriptions'](_0x67148c);}})['then'](function(_0x2b7be5){if(_0x2b7be5){return _0x2b7be5?{'count':_0x26a8b3,'rows':_0x2b7be5}:null;}})['then'](respondWithResult(_0x3da0a7,null))[_0x3233('0x52')](handleError(_0x3da0a7,null));};exports[_0x3233('0x61')]=function(_0x6f016c,_0x436485,_0x19400e){var _0x4032d2={};var _0x53af87={};var _0x2b311e;var _0x2df1d3;return db['FreshdeskConfiguration'][_0x3233('0x5b')]({'where':{'id':_0x6f016c['params']['id']}})[_0x3233('0x1f')](handleEntityNotFound(_0x436485,null))[_0x3233('0x1f')](function(_0x3cb2f5){if(_0x3cb2f5){_0x2b311e=_0x3cb2f5;_0x53af87[_0x3233('0x3e')]=_[_0x3233('0x41')](db['Tag']['rawAttributes']);_0x53af87['query']=_[_0x3233('0x41')](_0x6f016c[_0x3233('0x40')]);_0x53af87[_0x3233('0x42')]=_[_0x3233('0x44')](_0x53af87[_0x3233('0x3e')],_0x53af87['query']);_0x4032d2['attributes']=_[_0x3233('0x44')](_0x53af87[_0x3233('0x3e')],qs['fields'](_0x6f016c[_0x3233('0x40')]['fields']));_0x4032d2[_0x3233('0x43')]=_0x4032d2[_0x3233('0x43')][_0x3233('0x55')]?_0x4032d2['attributes']:_0x53af87['model'];_0x4032d2[_0x3233('0x48')]=qs[_0x3233('0x49')](_0x6f016c['query'][_0x3233('0x49')]);_0x4032d2['where']=qs[_0x3233('0x42')](_[_0x3233('0x5d')](_0x6f016c[_0x3233('0x40')],_0x53af87[_0x3233('0x42')]));if(_0x6f016c['query'][_0x3233('0x4a')]){_0x4032d2[_0x3233('0x4b')]=_['merge'](_0x4032d2['where'],{'$or':_[_0x3233('0x3f')](_0x4032d2[_0x3233('0x43')],function(_0x1328c5){var _0x3d6323={};_0x3d6323[_0x1328c5]={'$like':'%'+_0x6f016c[_0x3233('0x40')][_0x3233('0x4a')]+'%'};return _0x3d6323;})});}_0x4032d2=_[_0x3233('0x4c')]({},_0x4032d2,_0x6f016c[_0x3233('0x4e')]);return _0x2b311e[_0x3233('0x61')](_0x4032d2);}})[_0x3233('0x1f')](function(_0x5e450e){if(_0x5e450e){_0x2df1d3=_0x5e450e[_0x3233('0x55')];if(!_0x6f016c[_0x3233('0x40')]['hasOwnProperty'](_0x3233('0x47'))){_0x4032d2[_0x3233('0x2e')]=qs[_0x3233('0x2e')](_0x6f016c['query'][_0x3233('0x2e')]);_0x4032d2['offset']=qs['offset'](_0x6f016c['query'][_0x3233('0x2c')]);}return _0x2b311e['getTags'](_0x4032d2);}})[_0x3233('0x1f')](function(_0x53139a){if(_0x53139a){return _0x53139a?{'count':_0x2df1d3,'rows':_0x53139a}:null;}})[_0x3233('0x1f')](respondWithResult(_0x436485,null))['catch'](handleError(_0x436485,null));};exports['setTags']=function(_0x3187ec,_0x42f80d,_0x508f64){if(_0x3187ec[_0x3233('0x58')]['id']){delete _0x3187ec[_0x3233('0x58')]['id'];}return db[_0x3233('0x39')][_0x3233('0x5b')]({'where':{'id':_0x3187ec[_0x3233('0x54')]['id']}})[_0x3233('0x1f')](handleEntityNotFound(_0x42f80d,null))[_0x3233('0x1f')](function(_0x5b1415){if(_0x5b1415){return _0x5b1415[_0x3233('0x62')](_0x3187ec['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x42f80d,null))['catch'](handleError(_0x42f80d,null));}; \ No newline at end of file +var _0x82b0=['index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','filter','options','count','includeAll','FreshdeskConfiguration','rows','catch','params','include','create','body','find','getFields','findOne','FreshdeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','client','http','request','then','info','request\x20sent','debug','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','json','undefined','offset','limit','set','Content-Range','apply','reject','update','stack','name'];(function(_0x3f5476,_0x23caf7){var _0x496d2c=function(_0x4b33f1){while(--_0x4b33f1){_0x3f5476['push'](_0x3f5476['shift']());}};_0x496d2c(++_0x23caf7);}(_0x82b0,0x81));var _0x082b=function(_0x35a9a7,_0x5e8c7f){_0x35a9a7=_0x35a9a7-0x0;var _0x142c13=_0x82b0[_0x35a9a7];return _0x142c13;};'use strict';var emlformat=require(_0x082b('0x0'));var rimraf=require(_0x082b('0x1'));var zipdir=require(_0x082b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x082b('0x3'));var moment=require(_0x082b('0x4'));var BPromise=require(_0x082b('0x5'));var Mustache=require(_0x082b('0x6'));var util=require('util');var path=require(_0x082b('0x7'));var sox=require(_0x082b('0x8'));var csv=require(_0x082b('0x9'));var ejs=require(_0x082b('0xa'));var fs=require('fs');var fs_extra=require(_0x082b('0xb'));var _=require('lodash');var squel=require(_0x082b('0xc'));var crypto=require(_0x082b('0xd'));var jsforce=require(_0x082b('0xe'));var deskjs=require(_0x082b('0xf'));var toCsv=require(_0x082b('0x9'));var querystring=require(_0x082b('0x10'));var Papa=require(_0x082b('0x11'));var Redis=require(_0x082b('0x12'));var authService=require(_0x082b('0x13'));var qs=require(_0x082b('0x14'));var as=require(_0x082b('0x15'));var hardwareService=require(_0x082b('0x16'));var logger=require(_0x082b('0x17'))(_0x082b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x082b('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x082b('0x1a')][_0x082b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x535946,_0x3d2b45,_0x451411,_0x27bc44){return new BPromise(function(_0x1f0c32,_0x40e206){var _0x4d7ad9=_0x27bc44||client;return _0x4d7ad9[_0x082b('0x1c')](_0x535946,_0x451411)[_0x082b('0x1d')](function(_0x49db08){logger[_0x082b('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3d2b45,_0x082b('0x1f'));logger[_0x082b('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3d2b45,_0x082b('0x1f'),JSON[_0x082b('0x21')](_0x49db08));if(_0x49db08[_0x082b('0x22')]){if(_0x49db08[_0x082b('0x22')]['code']===0x1f4){logger[_0x082b('0x22')](_0x082b('0x23'),_0x3d2b45,_0x49db08[_0x082b('0x22')][_0x082b('0x24')]);return _0x40e206(_0x49db08[_0x082b('0x22')][_0x082b('0x24')]);}logger[_0x082b('0x22')](_0x082b('0x23'),_0x3d2b45,_0x49db08['error'][_0x082b('0x24')]);return _0x1f0c32(_0x49db08[_0x082b('0x22')][_0x082b('0x24')]);}else{logger['info'](_0x082b('0x23'),_0x3d2b45,_0x082b('0x1f'));_0x1f0c32(_0x49db08[_0x082b('0x25')]['message']);}})['catch'](function(_0x47454f){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3d2b45,_0x47454f);_0x40e206(_0x47454f);});});}function respondWithStatusCode(_0x3ae657,_0xaa7eb){_0xaa7eb=_0xaa7eb||0xcc;return function(_0x271340){if(_0x271340){return _0x3ae657[_0x082b('0x26')](_0xaa7eb);}return _0x3ae657[_0x082b('0x27')](_0xaa7eb)['end']();};}function respondWithResult(_0x203242,_0x1254fd){_0x1254fd=_0x1254fd||0xc8;return function(_0x40d737){if(_0x40d737){return _0x203242[_0x082b('0x27')](_0x1254fd)[_0x082b('0x28')](_0x40d737);}};}function respondWithFilteredResult(_0x8c3c9,_0x1b6dfc){return function(_0x4e30e8){if(_0x4e30e8){var _0x20ff4a=typeof _0x1b6dfc['offset']===_0x082b('0x29')&&typeof _0x1b6dfc['limit']===_0x082b('0x29');var _0x15c093=_0x4e30e8['count'];var _0x2279d7=_0x20ff4a?0x0:_0x1b6dfc['offset'];var _0x228a5a=_0x20ff4a?_0x4e30e8['count']:_0x1b6dfc[_0x082b('0x2a')]+_0x1b6dfc[_0x082b('0x2b')];var _0x1f8ce4;if(_0x228a5a>=_0x15c093){_0x228a5a=_0x15c093;_0x1f8ce4=0xc8;}else{_0x1f8ce4=0xce;}_0x8c3c9[_0x082b('0x27')](_0x1f8ce4);return _0x8c3c9[_0x082b('0x2c')](_0x082b('0x2d'),_0x2279d7+'-'+_0x228a5a+'/'+_0x15c093)[_0x082b('0x28')](_0x4e30e8);}return null;};}function patchUpdates(_0x2c9197){return function(_0xab3a99){try{jsonpatch[_0x082b('0x2e')](_0xab3a99,_0x2c9197,!![]);}catch(_0x3124dc){return BPromise[_0x082b('0x2f')](_0x3124dc);}return _0xab3a99['save']();};}function saveUpdates(_0x2ed47f,_0x32e57d){return function(_0x43244b){if(_0x43244b){return _0x43244b[_0x082b('0x30')](_0x2ed47f)[_0x082b('0x1d')](function(_0x50d5fd){return _0x50d5fd;});}return null;};}function removeEntity(_0x47c8e1,_0x465783){return function(_0x2de0bc){if(_0x2de0bc){return _0x2de0bc['destroy']()[_0x082b('0x1d')](function(){_0x47c8e1[_0x082b('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fed1e,_0x4b7c1b){return function(_0x174662){if(!_0x174662){_0x3fed1e[_0x082b('0x26')](0x194);}return _0x174662;};}function handleError(_0x55e89e,_0x403ed1){_0x403ed1=_0x403ed1||0x1f4;return function(_0x17570){logger[_0x082b('0x22')](_0x17570[_0x082b('0x31')]);if(_0x17570[_0x082b('0x32')]){delete _0x17570['name'];}_0x55e89e[_0x082b('0x27')](_0x403ed1)['send'](_0x17570);};}exports[_0x082b('0x33')]=function(_0x458840,_0x40e422){var _0x441bb5={},_0x3257c6={},_0x122077={'count':0x0,'rows':[]};var _0x6bf96c=_[_0x082b('0x34')](db['FreshdeskConfiguration'][_0x082b('0x35')],function(_0x16fe05){return{'name':_0x16fe05['fieldName'],'type':_0x16fe05[_0x082b('0x36')][_0x082b('0x37')]};});_0x3257c6[_0x082b('0x38')]=_[_0x082b('0x34')](_0x6bf96c,_0x082b('0x32'));_0x3257c6[_0x082b('0x39')]=_[_0x082b('0x3a')](_0x458840[_0x082b('0x39')]);_0x3257c6['filters']=_[_0x082b('0x3b')](_0x3257c6[_0x082b('0x38')],_0x3257c6[_0x082b('0x39')]);_0x441bb5[_0x082b('0x3c')]=_['intersection'](_0x3257c6[_0x082b('0x38')],qs[_0x082b('0x3d')](_0x458840[_0x082b('0x39')][_0x082b('0x3d')]));_0x441bb5[_0x082b('0x3c')]=_0x441bb5['attributes'][_0x082b('0x3e')]?_0x441bb5[_0x082b('0x3c')]:_0x3257c6['model'];if(!_0x458840[_0x082b('0x39')][_0x082b('0x3f')]('nolimit')){_0x441bb5[_0x082b('0x2b')]=qs[_0x082b('0x2b')](_0x458840[_0x082b('0x39')][_0x082b('0x2b')]);_0x441bb5[_0x082b('0x2a')]=qs[_0x082b('0x2a')](_0x458840[_0x082b('0x39')][_0x082b('0x2a')]);}_0x441bb5[_0x082b('0x40')]=qs['sort'](_0x458840[_0x082b('0x39')][_0x082b('0x41')]);_0x441bb5[_0x082b('0x42')]=qs[_0x082b('0x43')](_['pick'](_0x458840[_0x082b('0x39')],_0x3257c6[_0x082b('0x43')]),_0x6bf96c);if(_0x458840[_0x082b('0x39')]['filter']){_0x441bb5[_0x082b('0x42')]=_[_0x082b('0x44')](_0x441bb5[_0x082b('0x42')],{'$or':_[_0x082b('0x34')](_0x6bf96c,function(_0x2556ca){if(_0x2556ca[_0x082b('0x36')]!=='VIRTUAL'){var _0x3d062e={};_0x3d062e[_0x2556ca[_0x082b('0x32')]]={'$like':'%'+_0x458840[_0x082b('0x39')][_0x082b('0x45')]+'%'};return _0x3d062e;}})});}_0x441bb5=_[_0x082b('0x44')]({},_0x441bb5,_0x458840[_0x082b('0x46')]);var _0x36fab5={'where':_0x441bb5[_0x082b('0x42')]};return db['FreshdeskConfiguration'][_0x082b('0x47')](_0x36fab5)[_0x082b('0x1d')](function(_0x44401f){_0x122077['count']=_0x44401f;if(_0x458840[_0x082b('0x39')][_0x082b('0x48')]){_0x441bb5['include']=[{'all':!![]}];}return db[_0x082b('0x49')]['findAll'](_0x441bb5);})[_0x082b('0x1d')](function(_0x5d238e){_0x122077[_0x082b('0x4a')]=_0x5d238e;return _0x122077;})['then'](respondWithFilteredResult(_0x40e422,_0x441bb5))[_0x082b('0x4b')](handleError(_0x40e422,null));};exports['show']=function(_0x2613ec,_0x553a1e){var _0x3d043c={'raw':![],'where':{'id':_0x2613ec[_0x082b('0x4c')]['id']}},_0x518f6b={};_0x518f6b[_0x082b('0x38')]=_[_0x082b('0x3a')](db[_0x082b('0x49')][_0x082b('0x35')]);_0x518f6b[_0x082b('0x39')]=_[_0x082b('0x3a')](_0x2613ec['query']);_0x518f6b[_0x082b('0x43')]=_[_0x082b('0x3b')](_0x518f6b[_0x082b('0x38')],_0x518f6b['query']);_0x3d043c[_0x082b('0x3c')]=_[_0x082b('0x3b')](_0x518f6b[_0x082b('0x38')],qs[_0x082b('0x3d')](_0x2613ec[_0x082b('0x39')][_0x082b('0x3d')]));_0x3d043c[_0x082b('0x3c')]=_0x3d043c['attributes']['length']?_0x3d043c[_0x082b('0x3c')]:_0x518f6b['model'];if(_0x2613ec[_0x082b('0x39')][_0x082b('0x48')]){_0x3d043c[_0x082b('0x4d')]=[{'all':!![]}];}_0x3d043c=_['merge']({},_0x3d043c,_0x2613ec['options']);return db['FreshdeskConfiguration']['find'](_0x3d043c)[_0x082b('0x1d')](handleEntityNotFound(_0x553a1e,null))[_0x082b('0x1d')](respondWithResult(_0x553a1e,null))['catch'](handleError(_0x553a1e,null));};exports[_0x082b('0x4e')]=function(_0x35ffad,_0x37948a){return db[_0x082b('0x49')]['create'](_0x35ffad[_0x082b('0x4f')],{})[_0x082b('0x1d')](respondWithResult(_0x37948a,0xc9))[_0x082b('0x4b')](handleError(_0x37948a,null));};exports[_0x082b('0x30')]=function(_0x1f2a57,_0x4a5f3e){if(_0x1f2a57[_0x082b('0x4f')]['id']){delete _0x1f2a57[_0x082b('0x4f')]['id'];}return db['FreshdeskConfiguration'][_0x082b('0x50')]({'where':{'id':_0x1f2a57[_0x082b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a5f3e,null))[_0x082b('0x1d')](saveUpdates(_0x1f2a57['body'],null))[_0x082b('0x1d')](respondWithResult(_0x4a5f3e,null))[_0x082b('0x4b')](handleError(_0x4a5f3e,null));};exports['destroy']=function(_0xe0c2f5,_0x57830d){return db[_0x082b('0x49')][_0x082b('0x50')]({'where':{'id':_0xe0c2f5['params']['id']}})['then'](handleEntityNotFound(_0x57830d,null))['then'](removeEntity(_0x57830d,null))[_0x082b('0x4b')](handleError(_0x57830d,null));};exports[_0x082b('0x51')]=function(_0xdb9522,_0x3e73fc,_0x1285ac){var _0x4709d4={};var _0x878034={};var _0x454e18;var _0x544d87;return db[_0x082b('0x49')][_0x082b('0x52')]({'where':{'id':_0xdb9522['params']['id']}})[_0x082b('0x1d')](handleEntityNotFound(_0x3e73fc,null))[_0x082b('0x1d')](function(_0x38d3f9){if(_0x38d3f9){_0x454e18=_0x38d3f9;_0x878034[_0x082b('0x38')]=_[_0x082b('0x3a')](db[_0x082b('0x53')][_0x082b('0x35')]);_0x878034['query']=_[_0x082b('0x3a')](_0xdb9522[_0x082b('0x39')]);_0x878034['filters']=_[_0x082b('0x3b')](_0x878034[_0x082b('0x38')],_0x878034['query']);_0x4709d4['attributes']=_[_0x082b('0x3b')](_0x878034[_0x082b('0x38')],qs[_0x082b('0x3d')](_0xdb9522[_0x082b('0x39')]['fields']));_0x4709d4[_0x082b('0x3c')]=_0x4709d4[_0x082b('0x3c')]['length']?_0x4709d4[_0x082b('0x3c')]:_0x878034[_0x082b('0x38')];_0x4709d4[_0x082b('0x40')]=qs[_0x082b('0x41')](_0xdb9522['query'][_0x082b('0x41')]);_0x4709d4[_0x082b('0x42')]=qs[_0x082b('0x43')](_[_0x082b('0x54')](_0xdb9522[_0x082b('0x39')],_0x878034[_0x082b('0x43')]));if(_0xdb9522[_0x082b('0x39')][_0x082b('0x45')]){_0x4709d4[_0x082b('0x42')]=_['merge'](_0x4709d4[_0x082b('0x42')],{'$or':_['map'](_0x4709d4[_0x082b('0x3c')],function(_0x4a296d){var _0x5962c0={};_0x5962c0[_0x4a296d]={'$like':'%'+_0xdb9522[_0x082b('0x39')]['filter']+'%'};return _0x5962c0;})});}_0x4709d4=_['merge']({},_0x4709d4,_0xdb9522['options']);return _0x454e18['getFields'](_0x4709d4);}})[_0x082b('0x1d')](function(_0x3a6af0){if(_0x3a6af0){_0x544d87=_0x3a6af0[_0x082b('0x3e')];if(!_0xdb9522[_0x082b('0x39')][_0x082b('0x3f')](_0x082b('0x55'))){_0x4709d4['limit']=qs[_0x082b('0x2b')](_0xdb9522[_0x082b('0x39')]['limit']);_0x4709d4[_0x082b('0x2a')]=qs[_0x082b('0x2a')](_0xdb9522[_0x082b('0x39')][_0x082b('0x2a')]);}return _0x454e18[_0x082b('0x51')](_0x4709d4);}})[_0x082b('0x1d')](function(_0x358899){if(_0x358899){return _0x358899?{'count':_0x544d87,'rows':_0x358899}:null;}})[_0x082b('0x1d')](respondWithResult(_0x3e73fc,null))[_0x082b('0x4b')](handleError(_0x3e73fc,null));};exports[_0x082b('0x56')]=function(_0x4e7e43,_0x39f218,_0x502fdc){var _0x257cf4={};var _0xc056d={};var _0x473686;var _0x14a8b8;return db[_0x082b('0x49')][_0x082b('0x52')]({'where':{'id':_0x4e7e43['params']['id']}})[_0x082b('0x1d')](handleEntityNotFound(_0x39f218,null))[_0x082b('0x1d')](function(_0xdf6ae4){if(_0xdf6ae4){_0x473686=_0xdf6ae4;_0xc056d[_0x082b('0x38')]=_[_0x082b('0x3a')](db[_0x082b('0x53')][_0x082b('0x35')]);_0xc056d['query']=_[_0x082b('0x3a')](_0x4e7e43[_0x082b('0x39')]);_0xc056d['filters']=_['intersection'](_0xc056d[_0x082b('0x38')],_0xc056d[_0x082b('0x39')]);_0x257cf4['attributes']=_['intersection'](_0xc056d[_0x082b('0x38')],qs[_0x082b('0x3d')](_0x4e7e43[_0x082b('0x39')][_0x082b('0x3d')]));_0x257cf4[_0x082b('0x3c')]=_0x257cf4['attributes'][_0x082b('0x3e')]?_0x257cf4['attributes']:_0xc056d[_0x082b('0x38')];_0x257cf4[_0x082b('0x40')]=qs[_0x082b('0x41')](_0x4e7e43[_0x082b('0x39')]['sort']);_0x257cf4[_0x082b('0x42')]=qs[_0x082b('0x43')](_['pick'](_0x4e7e43['query'],_0xc056d[_0x082b('0x43')]));if(_0x4e7e43[_0x082b('0x39')]['filter']){_0x257cf4['where']=_[_0x082b('0x44')](_0x257cf4[_0x082b('0x42')],{'$or':_['map'](_0x257cf4[_0x082b('0x3c')],function(_0x300201){var _0x408d2c={};_0x408d2c[_0x300201]={'$like':'%'+_0x4e7e43[_0x082b('0x39')][_0x082b('0x45')]+'%'};return _0x408d2c;})});}_0x257cf4=_[_0x082b('0x44')]({},_0x257cf4,_0x4e7e43[_0x082b('0x46')]);return _0x473686[_0x082b('0x56')](_0x257cf4);}})[_0x082b('0x1d')](function(_0x55d724){if(_0x55d724){_0x14a8b8=_0x55d724[_0x082b('0x3e')];if(!_0x4e7e43[_0x082b('0x39')][_0x082b('0x3f')](_0x082b('0x55'))){_0x257cf4[_0x082b('0x2b')]=qs[_0x082b('0x2b')](_0x4e7e43['query'][_0x082b('0x2b')]);_0x257cf4[_0x082b('0x2a')]=qs[_0x082b('0x2a')](_0x4e7e43[_0x082b('0x39')][_0x082b('0x2a')]);}return _0x473686[_0x082b('0x56')](_0x257cf4);}})['then'](function(_0x20b025){if(_0x20b025){return _0x20b025?{'count':_0x14a8b8,'rows':_0x20b025}:null;}})['then'](respondWithResult(_0x39f218,null))[_0x082b('0x4b')](handleError(_0x39f218,null));};exports[_0x082b('0x57')]=function(_0xf78c13,_0x45f9fd,_0x5e4fd8){var _0x4d1163={};var _0x24ece0={};var _0x3af5bb;var _0x372e96;return db[_0x082b('0x49')][_0x082b('0x52')]({'where':{'id':_0xf78c13[_0x082b('0x4c')]['id']}})[_0x082b('0x1d')](handleEntityNotFound(_0x45f9fd,null))[_0x082b('0x1d')](function(_0x165bcc){if(_0x165bcc){_0x3af5bb=_0x165bcc;_0x24ece0[_0x082b('0x38')]=_[_0x082b('0x3a')](db[_0x082b('0x53')][_0x082b('0x35')]);_0x24ece0[_0x082b('0x39')]=_['keys'](_0xf78c13[_0x082b('0x39')]);_0x24ece0['filters']=_[_0x082b('0x3b')](_0x24ece0['model'],_0x24ece0[_0x082b('0x39')]);_0x4d1163[_0x082b('0x3c')]=_['intersection'](_0x24ece0['model'],qs['fields'](_0xf78c13[_0x082b('0x39')][_0x082b('0x3d')]));_0x4d1163[_0x082b('0x3c')]=_0x4d1163[_0x082b('0x3c')][_0x082b('0x3e')]?_0x4d1163['attributes']:_0x24ece0[_0x082b('0x38')];_0x4d1163['order']=qs[_0x082b('0x41')](_0xf78c13['query'][_0x082b('0x41')]);_0x4d1163[_0x082b('0x42')]=qs[_0x082b('0x43')](_['pick'](_0xf78c13['query'],_0x24ece0[_0x082b('0x43')]));if(_0xf78c13[_0x082b('0x39')][_0x082b('0x45')]){_0x4d1163[_0x082b('0x42')]=_[_0x082b('0x44')](_0x4d1163[_0x082b('0x42')],{'$or':_[_0x082b('0x34')](_0x4d1163['attributes'],function(_0x526ade){var _0x508bed={};_0x508bed[_0x526ade]={'$like':'%'+_0xf78c13[_0x082b('0x39')][_0x082b('0x45')]+'%'};return _0x508bed;})});}_0x4d1163=_[_0x082b('0x44')]({},_0x4d1163,_0xf78c13[_0x082b('0x46')]);return _0x3af5bb['getDescriptions'](_0x4d1163);}})[_0x082b('0x1d')](function(_0x582409){if(_0x582409){_0x372e96=_0x582409[_0x082b('0x3e')];if(!_0xf78c13['query'][_0x082b('0x3f')]('nolimit')){_0x4d1163[_0x082b('0x2b')]=qs[_0x082b('0x2b')](_0xf78c13[_0x082b('0x39')][_0x082b('0x2b')]);_0x4d1163[_0x082b('0x2a')]=qs[_0x082b('0x2a')](_0xf78c13['query']['offset']);}return _0x3af5bb[_0x082b('0x57')](_0x4d1163);}})[_0x082b('0x1d')](function(_0x4cb756){if(_0x4cb756){return _0x4cb756?{'count':_0x372e96,'rows':_0x4cb756}:null;}})[_0x082b('0x1d')](respondWithResult(_0x45f9fd,null))[_0x082b('0x4b')](handleError(_0x45f9fd,null));};exports['getTags']=function(_0x305e2f,_0x1b8ae9,_0x4f5c68){var _0x196825={};var _0x1025fc={};var _0x6792f1;var _0x41c52b;return db[_0x082b('0x49')][_0x082b('0x52')]({'where':{'id':_0x305e2f[_0x082b('0x4c')]['id']}})[_0x082b('0x1d')](handleEntityNotFound(_0x1b8ae9,null))['then'](function(_0x21b326){if(_0x21b326){_0x6792f1=_0x21b326;_0x1025fc[_0x082b('0x38')]=_[_0x082b('0x3a')](db['Tag'][_0x082b('0x35')]);_0x1025fc[_0x082b('0x39')]=_[_0x082b('0x3a')](_0x305e2f[_0x082b('0x39')]);_0x1025fc[_0x082b('0x43')]=_[_0x082b('0x3b')](_0x1025fc[_0x082b('0x38')],_0x1025fc[_0x082b('0x39')]);_0x196825[_0x082b('0x3c')]=_['intersection'](_0x1025fc[_0x082b('0x38')],qs[_0x082b('0x3d')](_0x305e2f[_0x082b('0x39')][_0x082b('0x3d')]));_0x196825[_0x082b('0x3c')]=_0x196825[_0x082b('0x3c')]['length']?_0x196825['attributes']:_0x1025fc['model'];_0x196825[_0x082b('0x40')]=qs[_0x082b('0x41')](_0x305e2f['query'][_0x082b('0x41')]);_0x196825['where']=qs[_0x082b('0x43')](_[_0x082b('0x54')](_0x305e2f[_0x082b('0x39')],_0x1025fc[_0x082b('0x43')]));if(_0x305e2f[_0x082b('0x39')]['filter']){_0x196825[_0x082b('0x42')]=_['merge'](_0x196825[_0x082b('0x42')],{'$or':_[_0x082b('0x34')](_0x196825[_0x082b('0x3c')],function(_0x353d69){var _0x2f1dbb={};_0x2f1dbb[_0x353d69]={'$like':'%'+_0x305e2f['query']['filter']+'%'};return _0x2f1dbb;})});}_0x196825=_[_0x082b('0x44')]({},_0x196825,_0x305e2f[_0x082b('0x46')]);return _0x6792f1[_0x082b('0x58')](_0x196825);}})[_0x082b('0x1d')](function(_0x2f91ee){if(_0x2f91ee){_0x41c52b=_0x2f91ee[_0x082b('0x3e')];if(!_0x305e2f[_0x082b('0x39')][_0x082b('0x3f')](_0x082b('0x55'))){_0x196825['limit']=qs[_0x082b('0x2b')](_0x305e2f[_0x082b('0x39')][_0x082b('0x2b')]);_0x196825['offset']=qs[_0x082b('0x2a')](_0x305e2f[_0x082b('0x39')]['offset']);}return _0x6792f1['getTags'](_0x196825);}})[_0x082b('0x1d')](function(_0x1dbb8e){if(_0x1dbb8e){return _0x1dbb8e?{'count':_0x41c52b,'rows':_0x1dbb8e}:null;}})['then'](respondWithResult(_0x1b8ae9,null))[_0x082b('0x4b')](handleError(_0x1b8ae9,null));};exports[_0x082b('0x59')]=function(_0x3b9109,_0x36ca98,_0x5dcb76){if(_0x3b9109[_0x082b('0x4f')]['id']){delete _0x3b9109[_0x082b('0x4f')]['id'];}return db[_0x082b('0x49')][_0x082b('0x52')]({'where':{'id':_0x3b9109['params']['id']}})[_0x082b('0x1d')](handleEntityNotFound(_0x36ca98,null))[_0x082b('0x1d')](function(_0x53c928){if(_0x53c928){return _0x53c928[_0x082b('0x59')](_0x3b9109[_0x082b('0x4f')]['ids']||[]);}return null;})['then'](respondWithResult(_0x36ca98,null))['catch'](handleError(_0x36ca98,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3e5877b..da19242 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 _0x74d4=['./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x307174,_0x538975){var _0x511d0f=function(_0x291897){while(--_0x291897){_0x307174['push'](_0x307174['shift']());}};_0x511d0f(++_0x538975);}(_0x74d4,0x71));var _0x474d=function(_0x24b3c3,_0x46b45d){_0x24b3c3=_0x24b3c3-0x0;var _0x2e856b=_0x74d4[_0x24b3c3];return _0x2e856b;};'use strict';var _=require(_0x474d('0x0'));var util=require(_0x474d('0x1'));var logger=require(_0x474d('0x2'))(_0x474d('0x3'));var moment=require('moment');var BPromise=require(_0x474d('0x4'));var rp=require(_0x474d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x474d('0x6'));var attributes=require(_0x474d('0x7'));module[_0x474d('0x8')]=function(_0x29d104,_0x42110e){return _0x29d104['define'](_0x474d('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b5c=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x563b28,_0x1812d2){var _0x2d6e8d=function(_0x393192){while(--_0x393192){_0x563b28['push'](_0x563b28['shift']());}};_0x2d6e8d(++_0x1812d2);}(_0x1b5c,0x130));var _0xc1b5=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x1b5c[_0x5eb22e];return _0x27fed5;};'use strict';var _=require('lodash');var util=require(_0xc1b5('0x0'));var logger=require(_0xc1b5('0x1'))(_0xc1b5('0x2'));var moment=require(_0xc1b5('0x3'));var BPromise=require(_0xc1b5('0x4'));var rp=require(_0xc1b5('0x5'));var fs=require('fs');var path=require(_0xc1b5('0x6'));var rimraf=require(_0xc1b5('0x7'));var config=require(_0xc1b5('0x8'));var attributes=require(_0xc1b5('0x9'));module[_0xc1b5('0xa')]=function(_0x8984c9,_0x13b50c){return _0x8984c9['define']('FreshdeskConfiguration',attributes,{'tableName':_0xc1b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 0eae6aa..ea56ef7 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 _0x074b=['message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x575c52,_0x576dab){var _0x5b497b=function(_0x233e1a){while(--_0x233e1a){_0x575c52['push'](_0x575c52['shift']());}};_0x5b497b(++_0x576dab);}(_0x074b,0x1ca));var _0xb074=function(_0x423fda,_0x2afb5f){_0x423fda=_0x423fda-0x0;var _0xc49ca6=_0x074b[_0x423fda];return _0xc49ca6;};'use strict';var _=require(_0xb074('0x0'));var util=require(_0xb074('0x1'));var moment=require(_0xb074('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb074('0x3'));var db=require(_0xb074('0x4'))['db'];var utils=require(_0xb074('0x5'));var logger=require('../../config/logger')(_0xb074('0x6'));var config=require(_0xb074('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb074('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x192d86,_0x2edc6d,_0x270cfe){return new BPromise(function(_0x38b0d2,_0x530be5){return client[_0xb074('0x9')](_0x192d86,_0x270cfe)[_0xb074('0xa')](function(_0x26520b){logger[_0xb074('0xb')](_0xb074('0xc'),_0x2edc6d,'request\x20sent');logger['debug'](_0xb074('0xd'),_0x2edc6d,_0xb074('0xe'),JSON[_0xb074('0xf')](_0x26520b));if(_0x26520b[_0xb074('0x10')]){if(_0x26520b[_0xb074('0x10')]['code']===0x1f4){logger['error'](_0xb074('0xc'),_0x2edc6d,_0x26520b[_0xb074('0x10')][_0xb074('0x11')]);return _0x530be5(_0x26520b[_0xb074('0x10')][_0xb074('0x11')]);}logger[_0xb074('0x10')](_0xb074('0xc'),_0x2edc6d,_0x26520b[_0xb074('0x10')][_0xb074('0x11')]);return _0x38b0d2(_0x26520b[_0xb074('0x10')][_0xb074('0x11')]);}else{logger['info'](_0xb074('0xc'),_0x2edc6d,_0xb074('0xe'));_0x38b0d2(_0x26520b['result'][_0xb074('0x11')]);}})[_0xb074('0x12')](function(_0xf07f0b){logger[_0xb074('0x10')](_0xb074('0xc'),_0x2edc6d,_0xf07f0b);_0x530be5(_0xf07f0b);});});} \ No newline at end of file +var _0x000e=['stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5bd197,_0x46a986){var _0x3a4b42=function(_0x46a7e1){while(--_0x46a7e1){_0x5bd197['push'](_0x5bd197['shift']());}};_0x3a4b42(++_0x46a986);}(_0x000e,0x97));var _0xe000=function(_0x578407,_0xa334b6){_0x578407=_0x578407-0x0;var _0x105488=_0x000e[_0x578407];return _0x105488;};'use strict';var _=require(_0xe000('0x0'));var util=require('util');var moment=require(_0xe000('0x1'));var BPromise=require('bluebird');var rs=require(_0xe000('0x2'));var fs=require('fs');var Redis=require(_0xe000('0x3'));var db=require(_0xe000('0x4'))['db'];var utils=require(_0xe000('0x5'));var logger=require(_0xe000('0x6'))(_0xe000('0x7'));var config=require(_0xe000('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe000('0x9')][_0xe000('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7094,_0x24f7e3,_0x2ba1aa){return new BPromise(function(_0x507c36,_0x180529){return client[_0xe000('0xb')](_0x3f7094,_0x2ba1aa)[_0xe000('0xc')](function(_0x1d8c37){logger['info'](_0xe000('0xd'),_0x24f7e3,_0xe000('0xe'));logger[_0xe000('0xf')](_0xe000('0x10'),_0x24f7e3,_0xe000('0xe'),JSON[_0xe000('0x11')](_0x1d8c37));if(_0x1d8c37[_0xe000('0x12')]){if(_0x1d8c37[_0xe000('0x12')][_0xe000('0x13')]===0x1f4){logger['error'](_0xe000('0xd'),_0x24f7e3,_0x1d8c37[_0xe000('0x12')][_0xe000('0x14')]);return _0x180529(_0x1d8c37[_0xe000('0x12')]['message']);}logger['error'](_0xe000('0xd'),_0x24f7e3,_0x1d8c37[_0xe000('0x12')][_0xe000('0x14')]);return _0x507c36(_0x1d8c37[_0xe000('0x12')][_0xe000('0x14')]);}else{logger[_0xe000('0x15')](_0xe000('0xd'),_0x24f7e3,_0xe000('0xe'));_0x507c36(_0x1d8c37[_0xe000('0x16')][_0xe000('0x14')]);}})[_0xe000('0x17')](function(_0x4c5c40){logger[_0xe000('0x12')](_0xe000('0xd'),_0x24f7e3,_0x4c5c40);_0x180529(_0x4c5c40);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a00cd30..8ad3032 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 _0x31cb=['update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x1883bb,_0x825ea5){var _0x12631d=function(_0x51ca07){while(--_0x51ca07){_0x1883bb['push'](_0x1883bb['shift']());}};_0x12631d(++_0x825ea5);}(_0x31cb,0x1d7));var _0xb31c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x31cb[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb31c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb31c('0x1'));var express=require(_0xb31c('0x2'));var router=express[_0xb31c('0x3')]();var fs_extra=require(_0xb31c('0x4'));var auth=require(_0xb31c('0x5'));var interaction=require(_0xb31c('0x6'));var config=require(_0xb31c('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xb31c('0x8')]('/',auth[_0xb31c('0x9')](),controller[_0xb31c('0xa')]);router[_0xb31c('0x8')](_0xb31c('0xb'),auth[_0xb31c('0x9')](),controller[_0xb31c('0xc')]);router[_0xb31c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb31c('0xe')](_0xb31c('0xb'),auth['isAuthenticated'](),controller[_0xb31c('0xf')]);router[_0xb31c('0x10')](_0xb31c('0xb'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1e0a=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer'];(function(_0x30a6d6,_0x229753){var _0xf7c511=function(_0x2e6369){while(--_0x2e6369){_0x30a6d6['push'](_0x30a6d6['shift']());}};_0xf7c511(++_0x229753);}(_0x1e0a,0x98));var _0xa1e0=function(_0x588da3,_0x7937df){_0x588da3=_0x588da3-0x0;var _0x2a5c73=_0x1e0a[_0x588da3];return _0x2a5c73;};'use strict';var multer=require(_0xa1e0('0x0'));var util=require(_0xa1e0('0x1'));var path=require('path');var timeout=require(_0xa1e0('0x2'));var express=require(_0xa1e0('0x3'));var router=express[_0xa1e0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa1e0('0x5'));var interaction=require(_0xa1e0('0x6'));var config=require('../../config/environment');var controller=require(_0xa1e0('0x7'));router[_0xa1e0('0x8')]('/',auth[_0xa1e0('0x9')](),controller[_0xa1e0('0xa')]);router[_0xa1e0('0x8')](_0xa1e0('0xb'),auth[_0xa1e0('0x9')](),controller[_0xa1e0('0xc')]);router[_0xa1e0('0xd')]('/',auth[_0xa1e0('0x9')](),controller[_0xa1e0('0xe')]);router['put'](_0xa1e0('0xb'),auth[_0xa1e0('0x9')](),controller['update']);router[_0xa1e0('0xf')](_0xa1e0('0xb'),auth[_0xa1e0('0x9')](),controller[_0xa1e0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 8eabc24..792b99e 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 _0xad8a=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x75045b,_0x14edb4){var _0x10acc5=function(_0x1edca4){while(--_0x1edca4){_0x75045b['push'](_0x75045b['shift']());}};_0x10acc5(++_0x14edb4);}(_0xad8a,0xb0));var _0xaad8=function(_0x3f45f3,_0x4e4e79){_0x3f45f3=_0x3f45f3-0x0;var _0x3ef549=_0xad8a[_0x3f45f3];return _0x3ef549;};'use strict';var Sequelize=require(_0xaad8('0x0'));module[_0xaad8('0x1')]={'type':{'type':Sequelize[_0xaad8('0x2')](_0xaad8('0x3'),_0xaad8('0x4'),'customVariable',_0xaad8('0x5'),_0xaad8('0x6')),'defaultValue':_0xaad8('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaad8('0x7')]},'keyType':{'type':Sequelize[_0xaad8('0x2')](_0xaad8('0x3'),_0xaad8('0x4'),_0xaad8('0x8'))},'keyContent':{'type':Sequelize[_0xaad8('0x7')]},'idField':{'type':Sequelize[_0xaad8('0x7')]},'nameField':{'type':Sequelize[_0xaad8('0x7')]},'customField':{'type':Sequelize[_0xaad8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaad8('0x7')]}}; \ No newline at end of file +var _0x9b67=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x45c2ac,_0x538e3e){var _0x1b7998=function(_0x4cb935){while(--_0x4cb935){_0x45c2ac['push'](_0x45c2ac['shift']());}};_0x1b7998(++_0x538e3e);}(_0x9b67,0xf6));var _0x79b6=function(_0x384489,_0xece7fc){_0x384489=_0x384489-0x0;var _0x71540d=_0x9b67[_0x384489];return _0x71540d;};'use strict';var Sequelize=require(_0x79b6('0x0'));module[_0x79b6('0x1')]={'type':{'type':Sequelize[_0x79b6('0x2')](_0x79b6('0x3'),_0x79b6('0x4'),'customVariable',_0x79b6('0x5'),_0x79b6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x79b6('0x7')]},'keyType':{'type':Sequelize[_0x79b6('0x2')](_0x79b6('0x3'),_0x79b6('0x4'),_0x79b6('0x8'))},'keyContent':{'type':Sequelize[_0x79b6('0x7')]},'idField':{'type':Sequelize[_0x79b6('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x79b6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x79b6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 6018d62..f381ebf 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 _0x634a=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x634a,0x17f));var _0xa634=function(_0x155ec4,_0x41e306){_0x155ec4=_0x155ec4-0x0;var _0x41070c=_0x634a[_0x155ec4];return _0x41070c;};'use strict';var emlformat=require(_0xa634('0x0'));var rimraf=require(_0xa634('0x1'));var zipdir=require(_0xa634('0x2'));var jsonpatch=require(_0xa634('0x3'));var rp=require(_0xa634('0x4'));var moment=require(_0xa634('0x5'));var BPromise=require(_0xa634('0x6'));var Mustache=require(_0xa634('0x7'));var util=require(_0xa634('0x8'));var path=require(_0xa634('0x9'));var sox=require(_0xa634('0xa'));var csv=require(_0xa634('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa634('0xc'));var _=require(_0xa634('0xd'));var squel=require(_0xa634('0xe'));var crypto=require('crypto');var jsforce=require(_0xa634('0xf'));var deskjs=require(_0xa634('0x10'));var toCsv=require(_0xa634('0xb'));var querystring=require(_0xa634('0x11'));var Papa=require(_0xa634('0x12'));var Redis=require(_0xa634('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa634('0x14'));var as=require(_0xa634('0x15'));var hardwareService=require(_0xa634('0x16'));var logger=require(_0xa634('0x17'))('api');var utils=require(_0xa634('0x18'));var config=require(_0xa634('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa634('0x1a'))['db'];function respondWithStatusCode(_0x1ae0b6,_0x36421c){_0x36421c=_0x36421c||0xcc;return function(_0x4a9f92){if(_0x4a9f92){return _0x1ae0b6[_0xa634('0x1b')](_0x36421c);}return _0x1ae0b6[_0xa634('0x1c')](_0x36421c)[_0xa634('0x1d')]();};}function respondWithResult(_0x58beb8,_0x9c54fd){_0x9c54fd=_0x9c54fd||0xc8;return function(_0x49c986){if(_0x49c986){return _0x58beb8[_0xa634('0x1c')](_0x9c54fd)['json'](_0x49c986);}};}function respondWithFilteredResult(_0x247e85,_0x51a5e3){return function(_0x2638e1){if(_0x2638e1){var _0x284ebe=typeof _0x51a5e3[_0xa634('0x1e')]===_0xa634('0x1f')&&typeof _0x51a5e3['limit']===_0xa634('0x1f');var _0x16983c=_0x2638e1['count'];var _0x13b4ee=_0x284ebe?0x0:_0x51a5e3['offset'];var _0x534183=_0x284ebe?_0x2638e1['count']:_0x51a5e3[_0xa634('0x1e')]+_0x51a5e3[_0xa634('0x20')];var _0x5e0b58;if(_0x534183>=_0x16983c){_0x534183=_0x16983c;_0x5e0b58=0xc8;}else{_0x5e0b58=0xce;}_0x247e85[_0xa634('0x1c')](_0x5e0b58);return _0x247e85[_0xa634('0x21')](_0xa634('0x22'),_0x13b4ee+'-'+_0x534183+'/'+_0x16983c)[_0xa634('0x23')](_0x2638e1);}return null;};}function patchUpdates(_0x119f6b){return function(_0x29b81a){try{jsonpatch[_0xa634('0x24')](_0x29b81a,_0x119f6b,!![]);}catch(_0x4b3f86){return BPromise['reject'](_0x4b3f86);}return _0x29b81a[_0xa634('0x25')]();};}function saveUpdates(_0x3b08e3,_0x39d52a){return function(_0x2c90ea){if(_0x2c90ea){return _0x2c90ea[_0xa634('0x26')](_0x3b08e3)[_0xa634('0x27')](function(_0x58c772){return _0x58c772;});}return null;};}function removeEntity(_0x25d89,_0x820ea0){return function(_0x476418){if(_0x476418){return _0x476418[_0xa634('0x28')]()[_0xa634('0x27')](function(){_0x25d89[_0xa634('0x1c')](0xcc)[_0xa634('0x1d')]();});}};}function handleEntityNotFound(_0x440bae,_0x536b69){return function(_0x23a976){if(!_0x23a976){_0x440bae['sendStatus'](0x194);}return _0x23a976;};}function handleError(_0x493b4a,_0x5c4f2a){_0x5c4f2a=_0x5c4f2a||0x1f4;return function(_0x37a04c){logger['error'](_0x37a04c[_0xa634('0x29')]);if(_0x37a04c['name']){delete _0x37a04c[_0xa634('0x2a')];}_0x493b4a[_0xa634('0x1c')](_0x5c4f2a)[_0xa634('0x2b')](_0x37a04c);};}exports[_0xa634('0x2c')]=function(_0x53a6ac,_0x289dc8){var _0x7c6195={},_0x1f773e={},_0x131fef={'count':0x0,'rows':[]};var _0x374518=_[_0xa634('0x2d')](db[_0xa634('0x2e')][_0xa634('0x2f')],function(_0x387fab){return{'name':_0x387fab[_0xa634('0x30')],'type':_0x387fab['type'][_0xa634('0x31')]};});_0x1f773e[_0xa634('0x32')]=_[_0xa634('0x2d')](_0x374518,_0xa634('0x2a'));_0x1f773e[_0xa634('0x33')]=_['keys'](_0x53a6ac['query']);_0x1f773e[_0xa634('0x34')]=_[_0xa634('0x35')](_0x1f773e['model'],_0x1f773e[_0xa634('0x33')]);_0x7c6195[_0xa634('0x36')]=_['intersection'](_0x1f773e[_0xa634('0x32')],qs['fields'](_0x53a6ac[_0xa634('0x33')][_0xa634('0x37')]));_0x7c6195[_0xa634('0x36')]=_0x7c6195['attributes'][_0xa634('0x38')]?_0x7c6195['attributes']:_0x1f773e['model'];if(!_0x53a6ac['query'][_0xa634('0x39')]('nolimit')){_0x7c6195[_0xa634('0x20')]=qs['limit'](_0x53a6ac['query'][_0xa634('0x20')]);_0x7c6195[_0xa634('0x1e')]=qs[_0xa634('0x1e')](_0x53a6ac[_0xa634('0x33')][_0xa634('0x1e')]);}_0x7c6195[_0xa634('0x3a')]=qs['sort'](_0x53a6ac[_0xa634('0x33')][_0xa634('0x3b')]);_0x7c6195[_0xa634('0x3c')]=qs[_0xa634('0x34')](_[_0xa634('0x3d')](_0x53a6ac[_0xa634('0x33')],_0x1f773e[_0xa634('0x34')]),_0x374518);if(_0x53a6ac[_0xa634('0x33')][_0xa634('0x3e')]){_0x7c6195[_0xa634('0x3c')]=_['merge'](_0x7c6195['where'],{'$or':_[_0xa634('0x2d')](_0x374518,function(_0x4173ed){if(_0x4173ed[_0xa634('0x3f')]!==_0xa634('0x40')){var _0x5e7909={};_0x5e7909[_0x4173ed['name']]={'$like':'%'+_0x53a6ac[_0xa634('0x33')][_0xa634('0x3e')]+'%'};return _0x5e7909;}})});}_0x7c6195=_[_0xa634('0x41')]({},_0x7c6195,_0x53a6ac[_0xa634('0x42')]);var _0x3d1fc0={'where':_0x7c6195['where']};return db[_0xa634('0x2e')][_0xa634('0x43')](_0x3d1fc0)[_0xa634('0x27')](function(_0x2425eb){_0x131fef[_0xa634('0x43')]=_0x2425eb;if(_0x53a6ac[_0xa634('0x33')][_0xa634('0x44')]){_0x7c6195[_0xa634('0x45')]=[{'all':!![]}];}return db[_0xa634('0x2e')][_0xa634('0x46')](_0x7c6195);})[_0xa634('0x27')](function(_0x3adb18){_0x131fef[_0xa634('0x47')]=_0x3adb18;return _0x131fef;})['then'](respondWithFilteredResult(_0x289dc8,_0x7c6195))['catch'](handleError(_0x289dc8,null));};exports[_0xa634('0x48')]=function(_0x38dc7b,_0x36032f){var _0x119d66={'raw':!![],'where':{'id':_0x38dc7b[_0xa634('0x49')]['id']}},_0x1d7771={};_0x1d7771['model']=_[_0xa634('0x4a')](db[_0xa634('0x2e')][_0xa634('0x2f')]);_0x1d7771[_0xa634('0x33')]=_['keys'](_0x38dc7b['query']);_0x1d7771[_0xa634('0x34')]=_[_0xa634('0x35')](_0x1d7771[_0xa634('0x32')],_0x1d7771[_0xa634('0x33')]);_0x119d66[_0xa634('0x36')]=_[_0xa634('0x35')](_0x1d7771[_0xa634('0x32')],qs['fields'](_0x38dc7b[_0xa634('0x33')]['fields']));_0x119d66['attributes']=_0x119d66[_0xa634('0x36')][_0xa634('0x38')]?_0x119d66[_0xa634('0x36')]:_0x1d7771[_0xa634('0x32')];if(_0x38dc7b[_0xa634('0x33')]['includeAll']){_0x119d66['include']=[{'all':!![]}];}_0x119d66=_[_0xa634('0x41')]({},_0x119d66,_0x38dc7b[_0xa634('0x42')]);return db[_0xa634('0x2e')][_0xa634('0x4b')](_0x119d66)[_0xa634('0x27')](handleEntityNotFound(_0x36032f,null))[_0xa634('0x27')](respondWithResult(_0x36032f,null))[_0xa634('0x4c')](handleError(_0x36032f,null));};exports[_0xa634('0x4d')]=function(_0x117779,_0x35085c){return db[_0xa634('0x2e')][_0xa634('0x4d')](_0x117779['body'],{})[_0xa634('0x27')](respondWithResult(_0x35085c,0xc9))[_0xa634('0x4c')](handleError(_0x35085c,null));};exports[_0xa634('0x26')]=function(_0x3080c1,_0x15b351){if(_0x3080c1[_0xa634('0x4e')]['id']){delete _0x3080c1[_0xa634('0x4e')]['id'];}return db[_0xa634('0x2e')][_0xa634('0x4b')]({'where':{'id':_0x3080c1[_0xa634('0x49')]['id']}})[_0xa634('0x27')](handleEntityNotFound(_0x15b351,null))[_0xa634('0x27')](saveUpdates(_0x3080c1[_0xa634('0x4e')],null))[_0xa634('0x27')](respondWithResult(_0x15b351,null))['catch'](handleError(_0x15b351,null));};exports[_0xa634('0x28')]=function(_0x1e1fc5,_0x58deeb){return db[_0xa634('0x2e')][_0xa634('0x4b')]({'where':{'id':_0x1e1fc5[_0xa634('0x49')]['id']}})[_0xa634('0x27')](handleEntityNotFound(_0x58deeb,null))[_0xa634('0x27')](removeEntity(_0x58deeb,null))[_0xa634('0x4c')](handleError(_0x58deeb,null));}; \ No newline at end of file +var _0x77ec=['where','pick','filter','merge','VIRTUAL','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','FreshdeskField','rawAttributes','type','key','query','keys','filters','intersection','model','fields','length','attributes','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77ec,0x1cf));var _0xc77e=function(_0x4b895b,_0x515995){_0x4b895b=_0x4b895b-0x0;var _0x7f3d3b=_0x77ec[_0x4b895b];return _0x7f3d3b;};'use strict';var emlformat=require(_0xc77e('0x0'));var rimraf=require(_0xc77e('0x1'));var zipdir=require(_0xc77e('0x2'));var jsonpatch=require(_0xc77e('0x3'));var rp=require(_0xc77e('0x4'));var moment=require(_0xc77e('0x5'));var BPromise=require(_0xc77e('0x6'));var Mustache=require(_0xc77e('0x7'));var util=require(_0xc77e('0x8'));var path=require(_0xc77e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc77e('0xa'));var fs=require('fs');var fs_extra=require(_0xc77e('0xb'));var _=require('lodash');var squel=require(_0xc77e('0xc'));var crypto=require(_0xc77e('0xd'));var jsforce=require(_0xc77e('0xe'));var deskjs=require(_0xc77e('0xf'));var toCsv=require(_0xc77e('0x10'));var querystring=require('querystring');var Papa=require(_0xc77e('0x11'));var Redis=require(_0xc77e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc77e('0x13'));var as=require(_0xc77e('0x14'));var hardwareService=require(_0xc77e('0x15'));var logger=require(_0xc77e('0x16'))(_0xc77e('0x17'));var utils=require(_0xc77e('0x18'));var config=require(_0xc77e('0x19'));var licenseUtil=require(_0xc77e('0x1a'));var db=require(_0xc77e('0x1b'))['db'];function respondWithStatusCode(_0x4e22d4,_0x4ceb83){_0x4ceb83=_0x4ceb83||0xcc;return function(_0x19d09a){if(_0x19d09a){return _0x4e22d4[_0xc77e('0x1c')](_0x4ceb83);}return _0x4e22d4[_0xc77e('0x1d')](_0x4ceb83)[_0xc77e('0x1e')]();};}function respondWithResult(_0x502c50,_0x5aca36){_0x5aca36=_0x5aca36||0xc8;return function(_0x19b776){if(_0x19b776){return _0x502c50['status'](_0x5aca36)[_0xc77e('0x1f')](_0x19b776);}};}function respondWithFilteredResult(_0x5a229a,_0x5377f1){return function(_0xa6ad3c){if(_0xa6ad3c){var _0x279d60=typeof _0x5377f1['offset']===_0xc77e('0x20')&&typeof _0x5377f1[_0xc77e('0x21')]===_0xc77e('0x20');var _0x5086ef=_0xa6ad3c[_0xc77e('0x22')];var _0x4caf0d=_0x279d60?0x0:_0x5377f1[_0xc77e('0x23')];var _0x19bcd1=_0x279d60?_0xa6ad3c[_0xc77e('0x22')]:_0x5377f1[_0xc77e('0x23')]+_0x5377f1[_0xc77e('0x21')];var _0x2f54c4;if(_0x19bcd1>=_0x5086ef){_0x19bcd1=_0x5086ef;_0x2f54c4=0xc8;}else{_0x2f54c4=0xce;}_0x5a229a[_0xc77e('0x1d')](_0x2f54c4);return _0x5a229a['set'](_0xc77e('0x24'),_0x4caf0d+'-'+_0x19bcd1+'/'+_0x5086ef)['json'](_0xa6ad3c);}return null;};}function patchUpdates(_0x4e6249){return function(_0x4c8b6b){try{jsonpatch[_0xc77e('0x25')](_0x4c8b6b,_0x4e6249,!![]);}catch(_0x5344d3){return BPromise[_0xc77e('0x26')](_0x5344d3);}return _0x4c8b6b[_0xc77e('0x27')]();};}function saveUpdates(_0x572de3,_0x1371ef){return function(_0x4a7b03){if(_0x4a7b03){return _0x4a7b03[_0xc77e('0x28')](_0x572de3)['then'](function(_0x55380a){return _0x55380a;});}return null;};}function removeEntity(_0x459e52,_0x1ec12d){return function(_0x474268){if(_0x474268){return _0x474268[_0xc77e('0x29')]()[_0xc77e('0x2a')](function(){_0x459e52[_0xc77e('0x1d')](0xcc)[_0xc77e('0x1e')]();});}};}function handleEntityNotFound(_0x9c2924,_0x50fe44){return function(_0xd1a48f){if(!_0xd1a48f){_0x9c2924['sendStatus'](0x194);}return _0xd1a48f;};}function handleError(_0x26abc3,_0x7b6e1d){_0x7b6e1d=_0x7b6e1d||0x1f4;return function(_0x3b064a){logger[_0xc77e('0x2b')](_0x3b064a['stack']);if(_0x3b064a[_0xc77e('0x2c')]){delete _0x3b064a[_0xc77e('0x2c')];}_0x26abc3[_0xc77e('0x1d')](_0x7b6e1d)[_0xc77e('0x2d')](_0x3b064a);};}exports[_0xc77e('0x2e')]=function(_0x1a6faa,_0xc4eb0e){var _0x8e4095={},_0xce3334={},_0x12b6c4={'count':0x0,'rows':[]};var _0x4beea4=_[_0xc77e('0x2f')](db[_0xc77e('0x30')][_0xc77e('0x31')],function(_0x2efc81){return{'name':_0x2efc81['fieldName'],'type':_0x2efc81[_0xc77e('0x32')][_0xc77e('0x33')]};});_0xce3334['model']=_[_0xc77e('0x2f')](_0x4beea4,_0xc77e('0x2c'));_0xce3334[_0xc77e('0x34')]=_[_0xc77e('0x35')](_0x1a6faa['query']);_0xce3334[_0xc77e('0x36')]=_[_0xc77e('0x37')](_0xce3334[_0xc77e('0x38')],_0xce3334['query']);_0x8e4095['attributes']=_['intersection'](_0xce3334[_0xc77e('0x38')],qs[_0xc77e('0x39')](_0x1a6faa[_0xc77e('0x34')][_0xc77e('0x39')]));_0x8e4095['attributes']=_0x8e4095['attributes'][_0xc77e('0x3a')]?_0x8e4095[_0xc77e('0x3b')]:_0xce3334[_0xc77e('0x38')];if(!_0x1a6faa[_0xc77e('0x34')]['hasOwnProperty']('nolimit')){_0x8e4095[_0xc77e('0x21')]=qs['limit'](_0x1a6faa[_0xc77e('0x34')][_0xc77e('0x21')]);_0x8e4095[_0xc77e('0x23')]=qs['offset'](_0x1a6faa[_0xc77e('0x34')][_0xc77e('0x23')]);}_0x8e4095[_0xc77e('0x3c')]=qs[_0xc77e('0x3d')](_0x1a6faa[_0xc77e('0x34')]['sort']);_0x8e4095[_0xc77e('0x3e')]=qs[_0xc77e('0x36')](_[_0xc77e('0x3f')](_0x1a6faa[_0xc77e('0x34')],_0xce3334[_0xc77e('0x36')]),_0x4beea4);if(_0x1a6faa[_0xc77e('0x34')][_0xc77e('0x40')]){_0x8e4095[_0xc77e('0x3e')]=_[_0xc77e('0x41')](_0x8e4095[_0xc77e('0x3e')],{'$or':_['map'](_0x4beea4,function(_0x579bd5){if(_0x579bd5[_0xc77e('0x32')]!==_0xc77e('0x42')){var _0x110fb7={};_0x110fb7[_0x579bd5[_0xc77e('0x2c')]]={'$like':'%'+_0x1a6faa['query'][_0xc77e('0x40')]+'%'};return _0x110fb7;}})});}_0x8e4095=_[_0xc77e('0x41')]({},_0x8e4095,_0x1a6faa['options']);var _0x292841={'where':_0x8e4095['where']};return db[_0xc77e('0x30')]['count'](_0x292841)['then'](function(_0x48df7e){_0x12b6c4[_0xc77e('0x22')]=_0x48df7e;if(_0x1a6faa['query']['includeAll']){_0x8e4095[_0xc77e('0x43')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x8e4095);})[_0xc77e('0x2a')](function(_0x3231ef){_0x12b6c4['rows']=_0x3231ef;return _0x12b6c4;})['then'](respondWithFilteredResult(_0xc4eb0e,_0x8e4095))[_0xc77e('0x44')](handleError(_0xc4eb0e,null));};exports[_0xc77e('0x45')]=function(_0x403c06,_0x347c67){var _0x2fd634={'raw':!![],'where':{'id':_0x403c06[_0xc77e('0x46')]['id']}},_0x448f71={};_0x448f71['model']=_[_0xc77e('0x35')](db[_0xc77e('0x30')]['rawAttributes']);_0x448f71[_0xc77e('0x34')]=_[_0xc77e('0x35')](_0x403c06[_0xc77e('0x34')]);_0x448f71[_0xc77e('0x36')]=_[_0xc77e('0x37')](_0x448f71[_0xc77e('0x38')],_0x448f71['query']);_0x2fd634[_0xc77e('0x3b')]=_[_0xc77e('0x37')](_0x448f71[_0xc77e('0x38')],qs[_0xc77e('0x39')](_0x403c06[_0xc77e('0x34')][_0xc77e('0x39')]));_0x2fd634[_0xc77e('0x3b')]=_0x2fd634['attributes'][_0xc77e('0x3a')]?_0x2fd634[_0xc77e('0x3b')]:_0x448f71[_0xc77e('0x38')];if(_0x403c06[_0xc77e('0x34')][_0xc77e('0x47')]){_0x2fd634[_0xc77e('0x43')]=[{'all':!![]}];}_0x2fd634=_[_0xc77e('0x41')]({},_0x2fd634,_0x403c06['options']);return db[_0xc77e('0x30')][_0xc77e('0x48')](_0x2fd634)[_0xc77e('0x2a')](handleEntityNotFound(_0x347c67,null))['then'](respondWithResult(_0x347c67,null))[_0xc77e('0x44')](handleError(_0x347c67,null));};exports['create']=function(_0x493c52,_0x59e5d8){return db['FreshdeskField'][_0xc77e('0x49')](_0x493c52['body'],{})['then'](respondWithResult(_0x59e5d8,0xc9))[_0xc77e('0x44')](handleError(_0x59e5d8,null));};exports[_0xc77e('0x28')]=function(_0x384b83,_0x212f6c){if(_0x384b83[_0xc77e('0x4a')]['id']){delete _0x384b83[_0xc77e('0x4a')]['id'];}return db[_0xc77e('0x30')][_0xc77e('0x48')]({'where':{'id':_0x384b83[_0xc77e('0x46')]['id']}})['then'](handleEntityNotFound(_0x212f6c,null))[_0xc77e('0x2a')](saveUpdates(_0x384b83['body'],null))[_0xc77e('0x2a')](respondWithResult(_0x212f6c,null))[_0xc77e('0x44')](handleError(_0x212f6c,null));};exports[_0xc77e('0x29')]=function(_0x5f2c0b,_0x55bafd){return db[_0xc77e('0x30')][_0xc77e('0x48')]({'where':{'id':_0x5f2c0b[_0xc77e('0x46')]['id']}})['then'](handleEntityNotFound(_0x55bafd,null))[_0xc77e('0x2a')](removeEntity(_0x55bafd,null))[_0xc77e('0x44')](handleError(_0x55bafd,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 2837004..96d11f3 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 _0x7976=['define','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path','./intFreshdeskField.attributes'];(function(_0x190c49,_0x103457){var _0x475b9a=function(_0x44f13c){while(--_0x44f13c){_0x190c49['push'](_0x190c49['shift']());}};_0x475b9a(++_0x103457);}(_0x7976,0x130));var _0x6797=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0x7976[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0x6797('0x0'));var util=require(_0x6797('0x1'));var logger=require('../../config/logger')(_0x6797('0x2'));var moment=require(_0x6797('0x3'));var BPromise=require(_0x6797('0x4'));var rp=require(_0x6797('0x5'));var fs=require('fs');var path=require(_0x6797('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6797('0x7'));module['exports']=function(_0x37929e,_0x29c364){return _0x37929e[_0x6797('0x8')]('FreshdeskField',attributes,{'tableName':_0x6797('0x9'),'paranoid':![],'indexes':[{'name':_0x6797('0xa'),'fields':['idField',_0x6797('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91b9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','../../config/logger','api'];(function(_0x27827c,_0x25478f){var _0x1d18af=function(_0x192475){while(--_0x192475){_0x27827c['push'](_0x27827c['shift']());}};_0x1d18af(++_0x25478f);}(_0x91b9,0x1b1));var _0x991b=function(_0x5a5595,_0x145fa0){_0x5a5595=_0x5a5595-0x0;var _0x43809d=_0x91b9[_0x5a5595];return _0x43809d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x991b('0x0'))(_0x991b('0x1'));var moment=require(_0x991b('0x2'));var BPromise=require(_0x991b('0x3'));var rp=require(_0x991b('0x4'));var fs=require('fs');var path=require(_0x991b('0x5'));var rimraf=require(_0x991b('0x6'));var config=require(_0x991b('0x7'));var attributes=require(_0x991b('0x8'));module[_0x991b('0x9')]=function(_0x50ea64,_0x3af6de){return _0x50ea64[_0x991b('0xa')](_0x991b('0xb'),attributes,{'tableName':_0x991b('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x991b('0xd'),_0x991b('0xe')],'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 1a3b1f1..b4dad59 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(_0x58353a,_0x122d0a){var _0x211712=function(_0x1fa816){while(--_0x1fa816){_0x58353a['push'](_0x58353a['shift']());}};_0x211712(++_0x122d0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5013f2,_0x3d896b){_0x5013f2=_0x5013f2-0x0;var _0x166b9f=_0xb10b[_0x5013f2];return _0x166b9f;};'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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x5ab36e,_0x2a0d82){_0x5ab36e=_0x5ab36e-0x0;var _0x23426f=_0x7a54[_0x5ab36e];return _0x23426f;};'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 89830f2..aaeddb4 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 _0xffaa=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xffaa,0xe1));var _0xaffa=function(_0x6b0034,_0x5af041){_0x6b0034=_0x6b0034-0x0;var _0x5eda66=_0xffaa[_0x6b0034];return _0x5eda66;};'use strict';var multer=require('multer');var util=require(_0xaffa('0x0'));var path=require(_0xaffa('0x1'));var timeout=require(_0xaffa('0x2'));var express=require(_0xaffa('0x3'));var router=express[_0xaffa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaffa('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0xaffa('0x6')]('/',auth[_0xaffa('0x7')](),controller[_0xaffa('0x8')]);router['get'](_0xaffa('0x9'),auth['isAuthenticated'](),controller[_0xaffa('0xa')]);router[_0xaffa('0x6')](_0xaffa('0xb'),auth[_0xaffa('0x7')](),controller[_0xaffa('0xc')]);router['get']('/:id/fields',auth[_0xaffa('0x7')](),controller[_0xaffa('0xd')]);router['post']('/',auth[_0xaffa('0x7')](),controller[_0xaffa('0xe')]);router[_0xaffa('0xf')]('/:id/configurations',auth[_0xaffa('0x7')](),controller[_0xaffa('0x10')]);router[_0xaffa('0x11')]('/:id',auth[_0xaffa('0x7')](),controller['update']);router[_0xaffa('0x12')](_0xaffa('0x9'),auth['isAuthenticated'](),controller[_0xaffa('0x13')]);module[_0xaffa('0x14')]=router; \ No newline at end of file +var _0xfc30=['post','addConfiguration','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x45fe42,_0x1aa6a0){var _0x1cdae0=function(_0x1f9a75){while(--_0x1f9a75){_0x45fe42['push'](_0x45fe42['shift']());}};_0x1cdae0(++_0x1aa6a0);}(_0xfc30,0xd8));var _0x0fc3=function(_0x480c83,_0x1f8665){_0x480c83=_0x480c83-0x0;var _0x3368e0=_0xfc30[_0x480c83];return _0x3368e0;};'use strict';var multer=require(_0x0fc3('0x0'));var util=require(_0x0fc3('0x1'));var path=require(_0x0fc3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0fc3('0x3')]();var fs_extra=require(_0x0fc3('0x4'));var auth=require(_0x0fc3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0fc3('0x6'));var controller=require(_0x0fc3('0x7'));router[_0x0fc3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0fc3('0x8')](_0x0fc3('0x9'),auth[_0x0fc3('0xa')](),controller[_0x0fc3('0xb')]);router[_0x0fc3('0x8')](_0x0fc3('0xc'),auth[_0x0fc3('0xa')](),controller[_0x0fc3('0xd')]);router[_0x0fc3('0x8')](_0x0fc3('0xe'),auth[_0x0fc3('0xa')](),controller['getFields']);router[_0x0fc3('0xf')]('/',auth[_0x0fc3('0xa')](),controller['create']);router[_0x0fc3('0xf')](_0x0fc3('0xc'),auth[_0x0fc3('0xa')](),controller[_0x0fc3('0x10')]);router[_0x0fc3('0x11')](_0x0fc3('0x9'),auth[_0x0fc3('0xa')](),controller['update']);router[_0x0fc3('0x12')](_0x0fc3('0x9'),auth['isAuthenticated'](),controller[_0x0fc3('0x13')]);module[_0x0fc3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 261f0d7..72b7157 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 _0xc98a=['sequelize','exports','STRING','username'];(function(_0xfdb14f,_0x49d076){var _0x37daa7=function(_0xcb88e9){while(--_0xcb88e9){_0xfdb14f['push'](_0xfdb14f['shift']());}};_0x37daa7(++_0x49d076);}(_0xc98a,0x1a8));var _0xac98=function(_0x28e3e7,_0x9a1649){_0x28e3e7=_0x28e3e7-0x0;var _0x44d59d=_0xc98a[_0x28e3e7];return _0x44d59d;};'use strict';var Sequelize=require(_0xac98('0x0'));module[_0xac98('0x1')]={'name':{'type':Sequelize[_0xac98('0x2')]},'description':{'type':Sequelize[_0xac98('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xac98('0x3')},'apiKey':{'type':Sequelize[_0xac98('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xac98('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6ace=['exports','STRING','username','remoteUri','sequelize'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0x6ace,0xf9));var _0xe6ac=function(_0x828160,_0x26d5be){_0x828160=_0x828160-0x0;var _0x296b5f=_0x6ace[_0x828160];return _0x296b5f;};'use strict';var Sequelize=require(_0xe6ac('0x0'));module[_0xe6ac('0x1')]={'name':{'type':Sequelize[_0xe6ac('0x2')]},'description':{'type':Sequelize[_0xe6ac('0x2')]},'username':{'type':Sequelize[_0xe6ac('0x2')],'unique':_0xe6ac('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe6ac('0x4')},'serverUrl':{'type':Sequelize[_0xe6ac('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 81c2cec..8611823 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 _0xd45e=['where','merge','VIRTUAL','include','rows','params','fields','includeAll','options','catch','body','find','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','create','FreshsalesField','getFields','apiKey','username','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','status','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter'];(function(_0x1f2f37,_0x1e8c70){var _0x508364=function(_0x3e49e2){while(--_0x3e49e2){_0x1f2f37['push'](_0x1f2f37['shift']());}};_0x508364(++_0x1e8c70);}(_0xd45e,0x182));var _0xed45=function(_0x57bea8,_0x4bd16c){_0x57bea8=_0x57bea8-0x0;var _0x103037=_0xd45e[_0x57bea8];return _0x103037;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed45('0x0'));var zipdir=require(_0xed45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed45('0x2'));var moment=require('moment');var BPromise=require(_0xed45('0x3'));var Mustache=require(_0xed45('0x4'));var util=require(_0xed45('0x5'));var path=require('path');var sox=require(_0xed45('0x6'));var csv=require(_0xed45('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed45('0x8'));var squel=require(_0xed45('0x9'));var crypto=require('crypto');var jsforce=require(_0xed45('0xa'));var deskjs=require(_0xed45('0xb'));var toCsv=require(_0xed45('0x7'));var querystring=require(_0xed45('0xc'));var Papa=require(_0xed45('0xd'));var Redis=require(_0xed45('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xed45('0xf'));var as=require(_0xed45('0x10'));var hardwareService=require(_0xed45('0x11'));var logger=require(_0xed45('0x12'))(_0xed45('0x13'));var utils=require(_0xed45('0x14'));var config=require(_0xed45('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xed45('0x16'))['db'];var integrations=require(_0xed45('0x17'));var jayson=require(_0xed45('0x18'));var client=jayson[_0xed45('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f35ef,_0x5e7767,_0xba7783,_0x2156a8){return new BPromise(function(_0xd6dcbb,_0x112873){var _0x531e22=_0x2156a8||client;return _0x531e22[_0xed45('0x1a')](_0x3f35ef,_0xba7783)[_0xed45('0x1b')](function(_0xcd3247){logger['info'](_0xed45('0x1c'),_0x5e7767,'request\x20sent');logger[_0xed45('0x1d')](_0xed45('0x1e'),_0x5e7767,_0xed45('0x1f'),JSON[_0xed45('0x20')](_0xcd3247));if(_0xcd3247['error']){if(_0xcd3247[_0xed45('0x21')]['code']===0x1f4){logger['error'](_0xed45('0x1c'),_0x5e7767,_0xcd3247[_0xed45('0x21')][_0xed45('0x22')]);return _0x112873(_0xcd3247['error']['message']);}logger[_0xed45('0x21')](_0xed45('0x1c'),_0x5e7767,_0xcd3247['error']['message']);return _0xd6dcbb(_0xcd3247[_0xed45('0x21')][_0xed45('0x22')]);}else{logger[_0xed45('0x23')](_0xed45('0x1c'),_0x5e7767,_0xed45('0x1f'));_0xd6dcbb(_0xcd3247[_0xed45('0x24')]['message']);}})['catch'](function(_0x57c103){logger['error'](_0xed45('0x1c'),_0x5e7767,_0x57c103);_0x112873(_0x57c103);});});}function respondWithStatusCode(_0x4238c1,_0x430001){_0x430001=_0x430001||0xcc;return function(_0x1e3180){if(_0x1e3180){return _0x4238c1['sendStatus'](_0x430001);}return _0x4238c1['status'](_0x430001)[_0xed45('0x25')]();};}function respondWithResult(_0x11d537,_0x19eb86){_0x19eb86=_0x19eb86||0xc8;return function(_0x55290d){if(_0x55290d){return _0x11d537['status'](_0x19eb86)[_0xed45('0x26')](_0x55290d);}};}function respondWithFilteredResult(_0x59bfc1,_0x5079a4){return function(_0x5ed657){if(_0x5ed657){var _0xc7dc3f=typeof _0x5079a4['offset']===_0xed45('0x27')&&typeof _0x5079a4[_0xed45('0x28')]===_0xed45('0x27');var _0x427dec=_0x5ed657[_0xed45('0x29')];var _0x400e2d=_0xc7dc3f?0x0:_0x5079a4[_0xed45('0x2a')];var _0x525ebd=_0xc7dc3f?_0x5ed657[_0xed45('0x29')]:_0x5079a4[_0xed45('0x2a')]+_0x5079a4['limit'];var _0x2023e4;if(_0x525ebd>=_0x427dec){_0x525ebd=_0x427dec;_0x2023e4=0xc8;}else{_0x2023e4=0xce;}_0x59bfc1['status'](_0x2023e4);return _0x59bfc1['set'](_0xed45('0x2b'),_0x400e2d+'-'+_0x525ebd+'/'+_0x427dec)[_0xed45('0x26')](_0x5ed657);}return null;};}function patchUpdates(_0x19defe){return function(_0x1ae992){try{jsonpatch[_0xed45('0x2c')](_0x1ae992,_0x19defe,!![]);}catch(_0x4baa1f){return BPromise[_0xed45('0x2d')](_0x4baa1f);}return _0x1ae992[_0xed45('0x2e')]();};}function saveUpdates(_0x581b0d,_0xc1e44f){return function(_0x16a8d4){if(_0x16a8d4){return _0x16a8d4[_0xed45('0x2f')](_0x581b0d)[_0xed45('0x1b')](function(_0x341ade){return _0x341ade;});}return null;};}function removeEntity(_0x1deb41,_0x2844f6){return function(_0x56ef27){if(_0x56ef27){return _0x56ef27[_0xed45('0x30')]()[_0xed45('0x1b')](function(){_0x1deb41[_0xed45('0x31')](0xcc)[_0xed45('0x25')]();});}};}function handleEntityNotFound(_0x31c7c8,_0x5466b7){return function(_0x37e145){if(!_0x37e145){_0x31c7c8[_0xed45('0x32')](0x194);}return _0x37e145;};}function handleError(_0x313102,_0x142caf){_0x142caf=_0x142caf||0x1f4;return function(_0x4a7a24){logger[_0xed45('0x21')](_0x4a7a24[_0xed45('0x33')]);if(_0x4a7a24[_0xed45('0x34')]){delete _0x4a7a24['name'];}_0x313102[_0xed45('0x31')](_0x142caf)[_0xed45('0x35')](_0x4a7a24);};}exports[_0xed45('0x36')]=function(_0x5144cc,_0x44d345){var _0x19117d={},_0x347ccf={},_0x17b54f={'count':0x0,'rows':[]};var _0x369b2c=_[_0xed45('0x37')](db[_0xed45('0x38')][_0xed45('0x39')],function(_0x5c9e7c){return{'name':_0x5c9e7c[_0xed45('0x3a')],'type':_0x5c9e7c[_0xed45('0x3b')][_0xed45('0x3c')]};});_0x347ccf[_0xed45('0x3d')]=_['map'](_0x369b2c,_0xed45('0x34'));_0x347ccf[_0xed45('0x3e')]=_[_0xed45('0x3f')](_0x5144cc[_0xed45('0x3e')]);_0x347ccf['filters']=_[_0xed45('0x40')](_0x347ccf[_0xed45('0x3d')],_0x347ccf[_0xed45('0x3e')]);_0x19117d[_0xed45('0x41')]=_[_0xed45('0x40')](_0x347ccf['model'],qs['fields'](_0x5144cc['query']['fields']));_0x19117d[_0xed45('0x41')]=_0x19117d[_0xed45('0x41')][_0xed45('0x42')]?_0x19117d[_0xed45('0x41')]:_0x347ccf[_0xed45('0x3d')];if(!_0x5144cc[_0xed45('0x3e')][_0xed45('0x43')](_0xed45('0x44'))){_0x19117d[_0xed45('0x28')]=qs['limit'](_0x5144cc[_0xed45('0x3e')][_0xed45('0x28')]);_0x19117d['offset']=qs['offset'](_0x5144cc[_0xed45('0x3e')]['offset']);}_0x19117d[_0xed45('0x45')]=qs[_0xed45('0x46')](_0x5144cc[_0xed45('0x3e')][_0xed45('0x46')]);_0x19117d['where']=qs[_0xed45('0x47')](_[_0xed45('0x48')](_0x5144cc[_0xed45('0x3e')],_0x347ccf['filters']),_0x369b2c);if(_0x5144cc[_0xed45('0x3e')][_0xed45('0x49')]){_0x19117d[_0xed45('0x4a')]=_[_0xed45('0x4b')](_0x19117d[_0xed45('0x4a')],{'$or':_['map'](_0x369b2c,function(_0x484cb6){if(_0x484cb6['type']!==_0xed45('0x4c')){var _0x7d4d3e={};_0x7d4d3e[_0x484cb6['name']]={'$like':'%'+_0x5144cc[_0xed45('0x3e')][_0xed45('0x49')]+'%'};return _0x7d4d3e;}})});}_0x19117d=_[_0xed45('0x4b')]({},_0x19117d,_0x5144cc['options']);var _0x3b5dc3={'where':_0x19117d[_0xed45('0x4a')]};return db[_0xed45('0x38')][_0xed45('0x29')](_0x3b5dc3)[_0xed45('0x1b')](function(_0x10598c){_0x17b54f['count']=_0x10598c;if(_0x5144cc['query']['includeAll']){_0x19117d[_0xed45('0x4d')]=[{'all':!![]}];}return db[_0xed45('0x38')]['findAll'](_0x19117d);})['then'](function(_0x457ea6){_0x17b54f[_0xed45('0x4e')]=_0x457ea6;return _0x17b54f;})['then'](respondWithFilteredResult(_0x44d345,_0x19117d))['catch'](handleError(_0x44d345,null));};exports['show']=function(_0x4e4f4b,_0x3eeefa){var _0x18bf02={'raw':![],'where':{'id':_0x4e4f4b[_0xed45('0x4f')]['id']}},_0x335a9f={};_0x335a9f[_0xed45('0x3d')]=_['keys'](db[_0xed45('0x38')][_0xed45('0x39')]);_0x335a9f['query']=_[_0xed45('0x3f')](_0x4e4f4b[_0xed45('0x3e')]);_0x335a9f[_0xed45('0x47')]=_['intersection'](_0x335a9f[_0xed45('0x3d')],_0x335a9f[_0xed45('0x3e')]);_0x18bf02[_0xed45('0x41')]=_[_0xed45('0x40')](_0x335a9f['model'],qs[_0xed45('0x50')](_0x4e4f4b[_0xed45('0x3e')][_0xed45('0x50')]));_0x18bf02[_0xed45('0x41')]=_0x18bf02[_0xed45('0x41')][_0xed45('0x42')]?_0x18bf02['attributes']:_0x335a9f[_0xed45('0x3d')];if(_0x4e4f4b[_0xed45('0x3e')][_0xed45('0x51')]){_0x18bf02[_0xed45('0x4d')]=[{'all':!![]}];}_0x18bf02=_[_0xed45('0x4b')]({},_0x18bf02,_0x4e4f4b[_0xed45('0x52')]);return db[_0xed45('0x38')]['find'](_0x18bf02)['then'](handleEntityNotFound(_0x3eeefa,null))[_0xed45('0x1b')](respondWithResult(_0x3eeefa,null))[_0xed45('0x53')](handleError(_0x3eeefa,null));};exports['create']=function(_0x40565f,_0x18e206){return db[_0xed45('0x38')]['create'](_0x40565f['body'],{})['then'](respondWithResult(_0x18e206,0xc9))['catch'](handleError(_0x18e206,null));};exports[_0xed45('0x2f')]=function(_0x53baf9,_0x433110){if(_0x53baf9['body']['id']){delete _0x53baf9[_0xed45('0x54')]['id'];}return db[_0xed45('0x38')][_0xed45('0x55')]({'where':{'id':_0x53baf9[_0xed45('0x4f')]['id']}})[_0xed45('0x1b')](handleEntityNotFound(_0x433110,null))['then'](saveUpdates(_0x53baf9[_0xed45('0x54')],null))[_0xed45('0x1b')](respondWithResult(_0x433110,null))[_0xed45('0x53')](handleError(_0x433110,null));};exports[_0xed45('0x30')]=function(_0x12709e,_0x5be251){return db[_0xed45('0x38')]['find']({'where':{'id':_0x12709e['params']['id']}})['then'](handleEntityNotFound(_0x5be251,null))[_0xed45('0x1b')](removeEntity(_0x5be251,null))[_0xed45('0x53')](handleError(_0x5be251,null));};exports['getConfigurations']=function(_0x5be12e,_0x1d5e42,_0x3a912b){var _0x4f3a76={};var _0x5f03cf={};var _0x14303f;var _0x57a0c6;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x5be12e[_0xed45('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1d5e42,null))[_0xed45('0x1b')](function(_0x27dbe5){if(_0x27dbe5){_0x14303f=_0x27dbe5;_0x5f03cf[_0xed45('0x3d')]=_[_0xed45('0x3f')](db['FreshsalesConfiguration'][_0xed45('0x39')]);_0x5f03cf[_0xed45('0x3e')]=_[_0xed45('0x3f')](_0x5be12e[_0xed45('0x3e')]);_0x5f03cf[_0xed45('0x47')]=_[_0xed45('0x40')](_0x5f03cf[_0xed45('0x3d')],_0x5f03cf[_0xed45('0x3e')]);_0x4f3a76[_0xed45('0x41')]=_[_0xed45('0x40')](_0x5f03cf[_0xed45('0x3d')],qs['fields'](_0x5be12e[_0xed45('0x3e')][_0xed45('0x50')]));_0x4f3a76['attributes']=_0x4f3a76[_0xed45('0x41')][_0xed45('0x42')]?_0x4f3a76[_0xed45('0x41')]:_0x5f03cf[_0xed45('0x3d')];_0x4f3a76[_0xed45('0x45')]=qs[_0xed45('0x46')](_0x5be12e['query'][_0xed45('0x46')]);_0x4f3a76['where']=qs[_0xed45('0x47')](_[_0xed45('0x48')](_0x5be12e[_0xed45('0x3e')],_0x5f03cf[_0xed45('0x47')]));if(_0x5be12e[_0xed45('0x3e')]['filter']){_0x4f3a76['where']=_[_0xed45('0x4b')](_0x4f3a76['where'],{'$or':_['map'](_0x4f3a76[_0xed45('0x41')],function(_0x4fbb8e){var _0x1fcc9e={};_0x1fcc9e[_0x4fbb8e]={'$like':'%'+_0x5be12e[_0xed45('0x3e')][_0xed45('0x49')]+'%'};return _0x1fcc9e;})});}_0x4f3a76=_[_0xed45('0x4b')]({},_0x4f3a76,_0x5be12e['options']);return _0x14303f[_0xed45('0x56')](_0x4f3a76);}})['then'](function(_0x146bd1){if(_0x146bd1){_0x57a0c6=_0x146bd1[_0xed45('0x42')];if(!_0x5be12e[_0xed45('0x3e')][_0xed45('0x43')]('nolimit')){_0x4f3a76[_0xed45('0x28')]=qs['limit'](_0x5be12e[_0xed45('0x3e')]['limit']);_0x4f3a76['offset']=qs['offset'](_0x5be12e[_0xed45('0x3e')][_0xed45('0x2a')]);}return _0x14303f[_0xed45('0x56')](_0x4f3a76);}})[_0xed45('0x1b')](function(_0x3c8cc7){if(_0x3c8cc7){return _0x3c8cc7?{'count':_0x57a0c6,'rows':_0x3c8cc7}:null;}})[_0xed45('0x1b')](respondWithResult(_0x1d5e42,null))[_0xed45('0x53')](handleError(_0x1d5e42,null));};exports[_0xed45('0x57')]=function(_0x1cccc5,_0x7c89b6,_0x3e25b6){if(_0x1cccc5[_0xed45('0x54')]['id']){delete _0x1cccc5[_0xed45('0x54')]['id'];}return db[_0xed45('0x38')][_0xed45('0x58')]({'where':{'id':_0x1cccc5[_0xed45('0x4f')]['id']}})[_0xed45('0x1b')](handleEntityNotFound(_0x7c89b6,null))[_0xed45('0x1b')](function(_0x89d3b3){if(_0x89d3b3){_0x1cccc5[_0xed45('0x54')][_0xed45('0x59')]=_0x89d3b3['id'];_0x1cccc5[_0xed45('0x54')]['Subjects']=integrations[_0xed45('0x5a')](_0x1cccc5['body'][_0xed45('0x5b')],_0x1cccc5[_0xed45('0x54')][_0xed45('0x3b')]);_0x1cccc5[_0xed45('0x54')][_0xed45('0x5c')]=integrations[_0xed45('0x5d')](_0x1cccc5[_0xed45('0x54')][_0xed45('0x5b')],_0x1cccc5[_0xed45('0x54')][_0xed45('0x3b')]);return db[_0xed45('0x5e')][_0xed45('0x5f')](_0x1cccc5[_0xed45('0x54')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0xed45('0x60')],'as':'Descriptions'}]});}return null;})[_0xed45('0x1b')](respondWithResult(_0x7c89b6,null))[_0xed45('0x53')](handleError(_0x7c89b6,null));};exports[_0xed45('0x61')]=function(_0x5c9e24,_0x3b4c3f,_0x4217c4){var _0x149da8='';var _0x380da7='';return db[_0xed45('0x38')][_0xed45('0x58')]({'where':{'id':_0x5c9e24[_0xed45('0x4f')]['id']},'attributes':['id','username','remoteUri',_0xed45('0x62')]})[_0xed45('0x1b')](handleEntityNotFound(_0x3b4c3f,null))[_0xed45('0x1b')](function(_0x3033a1){if(_0x3033a1){_0x380da7=_0x3033a1[_0xed45('0x63')];_0x149da8=_0x3033a1[_0xed45('0x64')];var _0x5efb61=_0x3033a1['remoteUri'][_0xed45('0x65')](-0x1);if(_0x5efb61==='/'){_0x149da8=_0x149da8['substring'](0x0,_0x149da8[_0xed45('0x66')](_0x5efb61));}return rp({'method':_0xed45('0x67'),'uri':util[_0xed45('0x68')](_0xed45('0x69'),_0x149da8,_0xed45('0x6a')),'headers':{'Authorization':_0xed45('0x6b')+_0x3033a1[_0xed45('0x62')]},'json':!![]});}})[_0xed45('0x1b')](function(_0x36c151){if(_0x36c151){var _0x19c132=_0x36c151[_0xed45('0x6c')];var _0x312693=![];var _0x10b710=null;for(_0x10b710=0x0;_0x10b710<_0x19c132[_0xed45('0x42')];_0x10b710++){if(_0x19c132[_0x10b710][_0xed45('0x6d')]===_0x380da7){_0x312693=!![];}}if(_0x312693){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xed45('0x6e')});}}})[_0xed45('0x1b')](respondWithResult(_0x3b4c3f,null))[_0xed45('0x53')](function(_0x1c8550){var _0x4c1af3=_0x5c9e24[_0xed45('0x3e')][_0xed45('0x6f')]?0x1f4:_0x1c8550[_0xed45('0x70')]||0x1f4;logger['error'](_0xed45('0x71'),_0xed45('0x61'),_0x4c1af3,JSON['stringify'](_0x1c8550));delete _0x1c8550['name'];if(_0x4c1af3===0x191){_0x4c1af3=0x190;}_0x3b4c3f[_0xed45('0x31')](_0x4c1af3)['send'](_0x5c9e24['query'][_0xed45('0x6f')]?{'message':_0xed45('0x72'),'statusCode':_0x1c8550['statusCode']}:_0x1c8550);});}; \ No newline at end of file +var _0x6dd1=['json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','name','send','index','map','FreshsalesAccount','fieldName','type','key','keys','filters','model','attributes','intersection','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','show','params','rawAttributes','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshsalesField','Subjects','apiKey','username','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','statusCode','getFields','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status'];(function(_0x7fb7f3,_0x29dc45){var _0x283b8d=function(_0x385333){while(--_0x385333){_0x7fb7f3['push'](_0x7fb7f3['shift']());}};_0x283b8d(++_0x29dc45);}(_0x6dd1,0x111));var _0x16dd=function(_0x2c4f48,_0x2165ef){_0x2c4f48=_0x2c4f48-0x0;var _0x51ea07=_0x6dd1[_0x2c4f48];return _0x51ea07;};'use strict';var emlformat=require(_0x16dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16dd('0x1'));var jsonpatch=require(_0x16dd('0x2'));var rp=require('request-promise');var moment=require(_0x16dd('0x3'));var BPromise=require(_0x16dd('0x4'));var Mustache=require(_0x16dd('0x5'));var util=require(_0x16dd('0x6'));var path=require(_0x16dd('0x7'));var sox=require(_0x16dd('0x8'));var csv=require(_0x16dd('0x9'));var ejs=require(_0x16dd('0xa'));var fs=require('fs');var fs_extra=require(_0x16dd('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x16dd('0xc'));var toCsv=require(_0x16dd('0x9'));var querystring=require(_0x16dd('0xd'));var Papa=require(_0x16dd('0xe'));var Redis=require('ioredis');var authService=require(_0x16dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16dd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16dd('0x11'));var utils=require(_0x16dd('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x16dd('0x13'));var db=require(_0x16dd('0x14'))['db'];var integrations=require(_0x16dd('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x16dd('0x16')][_0x16dd('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x148e7d,_0x78caa4,_0x475e16,_0x4d460c){return new BPromise(function(_0x4f3646,_0xcfde1c){var _0x5e81b1=_0x4d460c||client;return _0x5e81b1[_0x16dd('0x18')](_0x148e7d,_0x475e16)[_0x16dd('0x19')](function(_0x31a026){logger[_0x16dd('0x1a')](_0x16dd('0x1b'),_0x78caa4,_0x16dd('0x1c'));logger[_0x16dd('0x1d')](_0x16dd('0x1e'),_0x78caa4,'request\x20sent',JSON[_0x16dd('0x1f')](_0x31a026));if(_0x31a026[_0x16dd('0x20')]){if(_0x31a026[_0x16dd('0x20')][_0x16dd('0x21')]===0x1f4){logger[_0x16dd('0x20')]('FreshsalesAccount,\x20%s,\x20%s',_0x78caa4,_0x31a026[_0x16dd('0x20')][_0x16dd('0x22')]);return _0xcfde1c(_0x31a026[_0x16dd('0x20')][_0x16dd('0x22')]);}logger[_0x16dd('0x20')](_0x16dd('0x1b'),_0x78caa4,_0x31a026[_0x16dd('0x20')][_0x16dd('0x22')]);return _0x4f3646(_0x31a026[_0x16dd('0x20')][_0x16dd('0x22')]);}else{logger['info'](_0x16dd('0x1b'),_0x78caa4,_0x16dd('0x1c'));_0x4f3646(_0x31a026[_0x16dd('0x23')][_0x16dd('0x22')]);}})[_0x16dd('0x24')](function(_0x495753){logger['error'](_0x16dd('0x1b'),_0x78caa4,_0x495753);_0xcfde1c(_0x495753);});});}function respondWithStatusCode(_0x239e59,_0x4d1f98){_0x4d1f98=_0x4d1f98||0xcc;return function(_0x1276e6){if(_0x1276e6){return _0x239e59[_0x16dd('0x25')](_0x4d1f98);}return _0x239e59[_0x16dd('0x26')](_0x4d1f98)['end']();};}function respondWithResult(_0x256d87,_0x251be0){_0x251be0=_0x251be0||0xc8;return function(_0x33e57d){if(_0x33e57d){return _0x256d87['status'](_0x251be0)[_0x16dd('0x27')](_0x33e57d);}};}function respondWithFilteredResult(_0x3625ec,_0x409b83){return function(_0x4a5dba){if(_0x4a5dba){var _0x4c1614=typeof _0x409b83[_0x16dd('0x28')]===_0x16dd('0x29')&&typeof _0x409b83['limit']==='undefined';var _0x511816=_0x4a5dba[_0x16dd('0x2a')];var _0x20fc34=_0x4c1614?0x0:_0x409b83[_0x16dd('0x28')];var _0x482cfb=_0x4c1614?_0x4a5dba[_0x16dd('0x2a')]:_0x409b83[_0x16dd('0x28')]+_0x409b83[_0x16dd('0x2b')];var _0x1fc400;if(_0x482cfb>=_0x511816){_0x482cfb=_0x511816;_0x1fc400=0xc8;}else{_0x1fc400=0xce;}_0x3625ec['status'](_0x1fc400);return _0x3625ec[_0x16dd('0x2c')](_0x16dd('0x2d'),_0x20fc34+'-'+_0x482cfb+'/'+_0x511816)['json'](_0x4a5dba);}return null;};}function patchUpdates(_0x1d9e3e){return function(_0x28f033){try{jsonpatch['apply'](_0x28f033,_0x1d9e3e,!![]);}catch(_0x46ff2e){return BPromise['reject'](_0x46ff2e);}return _0x28f033[_0x16dd('0x2e')]();};}function saveUpdates(_0x57b1b5,_0x40c9d3){return function(_0x109ed0){if(_0x109ed0){return _0x109ed0[_0x16dd('0x2f')](_0x57b1b5)['then'](function(_0x3aefc4){return _0x3aefc4;});}return null;};}function removeEntity(_0x2bbcb4,_0x49bc0c){return function(_0xc150a0){if(_0xc150a0){return _0xc150a0[_0x16dd('0x30')]()[_0x16dd('0x19')](function(){_0x2bbcb4[_0x16dd('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x361f40,_0x101916){return function(_0x50f511){if(!_0x50f511){_0x361f40[_0x16dd('0x25')](0x194);}return _0x50f511;};}function handleError(_0x53694d,_0xa04fee){_0xa04fee=_0xa04fee||0x1f4;return function(_0x3128b1){logger['error'](_0x3128b1['stack']);if(_0x3128b1[_0x16dd('0x31')]){delete _0x3128b1[_0x16dd('0x31')];}_0x53694d[_0x16dd('0x26')](_0xa04fee)[_0x16dd('0x32')](_0x3128b1);};}exports[_0x16dd('0x33')]=function(_0x7edb3f,_0x2289d2){var _0x2bbed9={},_0x12c14e={},_0x58ce74={'count':0x0,'rows':[]};var _0x2f3064=_[_0x16dd('0x34')](db[_0x16dd('0x35')]['rawAttributes'],function(_0x425e6b){return{'name':_0x425e6b[_0x16dd('0x36')],'type':_0x425e6b[_0x16dd('0x37')][_0x16dd('0x38')]};});_0x12c14e['model']=_['map'](_0x2f3064,'name');_0x12c14e['query']=_[_0x16dd('0x39')](_0x7edb3f['query']);_0x12c14e[_0x16dd('0x3a')]=_['intersection'](_0x12c14e[_0x16dd('0x3b')],_0x12c14e['query']);_0x2bbed9[_0x16dd('0x3c')]=_[_0x16dd('0x3d')](_0x12c14e[_0x16dd('0x3b')],qs[_0x16dd('0x3e')](_0x7edb3f[_0x16dd('0x3f')][_0x16dd('0x3e')]));_0x2bbed9['attributes']=_0x2bbed9[_0x16dd('0x3c')][_0x16dd('0x40')]?_0x2bbed9[_0x16dd('0x3c')]:_0x12c14e[_0x16dd('0x3b')];if(!_0x7edb3f[_0x16dd('0x3f')][_0x16dd('0x41')]('nolimit')){_0x2bbed9['limit']=qs[_0x16dd('0x2b')](_0x7edb3f['query']['limit']);_0x2bbed9[_0x16dd('0x28')]=qs[_0x16dd('0x28')](_0x7edb3f[_0x16dd('0x3f')][_0x16dd('0x28')]);}_0x2bbed9[_0x16dd('0x42')]=qs['sort'](_0x7edb3f['query'][_0x16dd('0x43')]);_0x2bbed9[_0x16dd('0x44')]=qs[_0x16dd('0x3a')](_[_0x16dd('0x45')](_0x7edb3f[_0x16dd('0x3f')],_0x12c14e[_0x16dd('0x3a')]),_0x2f3064);if(_0x7edb3f[_0x16dd('0x3f')][_0x16dd('0x46')]){_0x2bbed9[_0x16dd('0x44')]=_[_0x16dd('0x47')](_0x2bbed9[_0x16dd('0x44')],{'$or':_[_0x16dd('0x34')](_0x2f3064,function(_0x26eb28){if(_0x26eb28['type']!=='VIRTUAL'){var _0x58c21e={};_0x58c21e[_0x26eb28[_0x16dd('0x31')]]={'$like':'%'+_0x7edb3f[_0x16dd('0x3f')][_0x16dd('0x46')]+'%'};return _0x58c21e;}})});}_0x2bbed9=_[_0x16dd('0x47')]({},_0x2bbed9,_0x7edb3f['options']);var _0x10bee9={'where':_0x2bbed9[_0x16dd('0x44')]};return db[_0x16dd('0x35')][_0x16dd('0x2a')](_0x10bee9)[_0x16dd('0x19')](function(_0x50b163){_0x58ce74[_0x16dd('0x2a')]=_0x50b163;if(_0x7edb3f[_0x16dd('0x3f')][_0x16dd('0x48')]){_0x2bbed9[_0x16dd('0x49')]=[{'all':!![]}];}return db[_0x16dd('0x35')]['findAll'](_0x2bbed9);})['then'](function(_0x2e9fab){_0x58ce74['rows']=_0x2e9fab;return _0x58ce74;})['then'](respondWithFilteredResult(_0x2289d2,_0x2bbed9))[_0x16dd('0x24')](handleError(_0x2289d2,null));};exports[_0x16dd('0x4a')]=function(_0x2a7190,_0x5a3af6){var _0x10db7c={'raw':![],'where':{'id':_0x2a7190[_0x16dd('0x4b')]['id']}},_0x3b89f6={};_0x3b89f6[_0x16dd('0x3b')]=_[_0x16dd('0x39')](db[_0x16dd('0x35')][_0x16dd('0x4c')]);_0x3b89f6[_0x16dd('0x3f')]=_[_0x16dd('0x39')](_0x2a7190[_0x16dd('0x3f')]);_0x3b89f6[_0x16dd('0x3a')]=_[_0x16dd('0x3d')](_0x3b89f6[_0x16dd('0x3b')],_0x3b89f6[_0x16dd('0x3f')]);_0x10db7c['attributes']=_[_0x16dd('0x3d')](_0x3b89f6['model'],qs['fields'](_0x2a7190[_0x16dd('0x3f')][_0x16dd('0x3e')]));_0x10db7c[_0x16dd('0x3c')]=_0x10db7c[_0x16dd('0x3c')]['length']?_0x10db7c[_0x16dd('0x3c')]:_0x3b89f6[_0x16dd('0x3b')];if(_0x2a7190[_0x16dd('0x3f')][_0x16dd('0x48')]){_0x10db7c['include']=[{'all':!![]}];}_0x10db7c=_[_0x16dd('0x47')]({},_0x10db7c,_0x2a7190['options']);return db[_0x16dd('0x35')][_0x16dd('0x4d')](_0x10db7c)[_0x16dd('0x19')](handleEntityNotFound(_0x5a3af6,null))[_0x16dd('0x19')](respondWithResult(_0x5a3af6,null))['catch'](handleError(_0x5a3af6,null));};exports[_0x16dd('0x4e')]=function(_0x13fe84,_0x2e1b83){return db['FreshsalesAccount'][_0x16dd('0x4e')](_0x13fe84['body'],{})[_0x16dd('0x19')](respondWithResult(_0x2e1b83,0xc9))[_0x16dd('0x24')](handleError(_0x2e1b83,null));};exports['update']=function(_0x23b2c6,_0x5980c4){if(_0x23b2c6[_0x16dd('0x4f')]['id']){delete _0x23b2c6[_0x16dd('0x4f')]['id'];}return db[_0x16dd('0x35')][_0x16dd('0x4d')]({'where':{'id':_0x23b2c6['params']['id']}})[_0x16dd('0x19')](handleEntityNotFound(_0x5980c4,null))[_0x16dd('0x19')](saveUpdates(_0x23b2c6['body'],null))[_0x16dd('0x19')](respondWithResult(_0x5980c4,null))['catch'](handleError(_0x5980c4,null));};exports['destroy']=function(_0xf1a3a8,_0x2c8a52){return db[_0x16dd('0x35')]['find']({'where':{'id':_0xf1a3a8[_0x16dd('0x4b')]['id']}})[_0x16dd('0x19')](handleEntityNotFound(_0x2c8a52,null))[_0x16dd('0x19')](removeEntity(_0x2c8a52,null))[_0x16dd('0x24')](handleError(_0x2c8a52,null));};exports[_0x16dd('0x50')]=function(_0x5b2f93,_0x3e3b6b,_0x53d55c){var _0x49378c={};var _0x40865b={};var _0x10be1b;var _0x19b649;return db[_0x16dd('0x35')][_0x16dd('0x51')]({'where':{'id':_0x5b2f93[_0x16dd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e3b6b,null))['then'](function(_0x582acf){if(_0x582acf){_0x10be1b=_0x582acf;_0x40865b[_0x16dd('0x3b')]=_['keys'](db[_0x16dd('0x52')]['rawAttributes']);_0x40865b[_0x16dd('0x3f')]=_[_0x16dd('0x39')](_0x5b2f93[_0x16dd('0x3f')]);_0x40865b[_0x16dd('0x3a')]=_[_0x16dd('0x3d')](_0x40865b['model'],_0x40865b['query']);_0x49378c[_0x16dd('0x3c')]=_[_0x16dd('0x3d')](_0x40865b['model'],qs['fields'](_0x5b2f93[_0x16dd('0x3f')][_0x16dd('0x3e')]));_0x49378c[_0x16dd('0x3c')]=_0x49378c[_0x16dd('0x3c')][_0x16dd('0x40')]?_0x49378c[_0x16dd('0x3c')]:_0x40865b[_0x16dd('0x3b')];_0x49378c[_0x16dd('0x42')]=qs['sort'](_0x5b2f93[_0x16dd('0x3f')][_0x16dd('0x43')]);_0x49378c[_0x16dd('0x44')]=qs[_0x16dd('0x3a')](_[_0x16dd('0x45')](_0x5b2f93[_0x16dd('0x3f')],_0x40865b[_0x16dd('0x3a')]));if(_0x5b2f93['query'][_0x16dd('0x46')]){_0x49378c[_0x16dd('0x44')]=_[_0x16dd('0x47')](_0x49378c[_0x16dd('0x44')],{'$or':_[_0x16dd('0x34')](_0x49378c[_0x16dd('0x3c')],function(_0x299e60){var _0x4c2f88={};_0x4c2f88[_0x299e60]={'$like':'%'+_0x5b2f93[_0x16dd('0x3f')][_0x16dd('0x46')]+'%'};return _0x4c2f88;})});}_0x49378c=_[_0x16dd('0x47')]({},_0x49378c,_0x5b2f93['options']);return _0x10be1b[_0x16dd('0x50')](_0x49378c);}})[_0x16dd('0x19')](function(_0x4828f3){if(_0x4828f3){_0x19b649=_0x4828f3[_0x16dd('0x40')];if(!_0x5b2f93[_0x16dd('0x3f')][_0x16dd('0x41')](_0x16dd('0x53'))){_0x49378c[_0x16dd('0x2b')]=qs[_0x16dd('0x2b')](_0x5b2f93[_0x16dd('0x3f')][_0x16dd('0x2b')]);_0x49378c[_0x16dd('0x28')]=qs[_0x16dd('0x28')](_0x5b2f93['query'][_0x16dd('0x28')]);}return _0x10be1b[_0x16dd('0x50')](_0x49378c);}})['then'](function(_0x3c4bce){if(_0x3c4bce){return _0x3c4bce?{'count':_0x19b649,'rows':_0x3c4bce}:null;}})[_0x16dd('0x19')](respondWithResult(_0x3e3b6b,null))[_0x16dd('0x24')](handleError(_0x3e3b6b,null));};exports[_0x16dd('0x54')]=function(_0xcdbb69,_0x19c8b5,_0x5a807c){if(_0xcdbb69[_0x16dd('0x4f')]['id']){delete _0xcdbb69[_0x16dd('0x4f')]['id'];}return db[_0x16dd('0x35')][_0x16dd('0x51')]({'where':{'id':_0xcdbb69[_0x16dd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19c8b5,null))[_0x16dd('0x19')](function(_0x3d9fd1){if(_0x3d9fd1){_0xcdbb69[_0x16dd('0x4f')][_0x16dd('0x55')]=_0x3d9fd1['id'];_0xcdbb69[_0x16dd('0x4f')]['Subjects']=integrations[_0x16dd('0x56')](_0xcdbb69[_0x16dd('0x4f')][_0x16dd('0x57')],_0xcdbb69[_0x16dd('0x4f')]['type']);_0xcdbb69[_0x16dd('0x4f')][_0x16dd('0x58')]=integrations['getDescriptions'](_0xcdbb69['body']['channel'],_0xcdbb69[_0x16dd('0x4f')]['type']);return db['FreshsalesConfiguration']['create'](_0xcdbb69['body'],{'include':[{'model':db[_0x16dd('0x59')],'as':_0x16dd('0x5a')},{'model':db[_0x16dd('0x59')],'as':_0x16dd('0x58')}]});}return null;})[_0x16dd('0x19')](respondWithResult(_0x19c8b5,null))[_0x16dd('0x24')](handleError(_0x19c8b5,null));};exports['getFields']=function(_0x26d74b,_0x5aeed3,_0xc65fa9){var _0x5d97f4='';var _0x1f1a87='';return db[_0x16dd('0x35')][_0x16dd('0x51')]({'where':{'id':_0x26d74b['params']['id']},'attributes':['id','username','remoteUri',_0x16dd('0x5b')]})['then'](handleEntityNotFound(_0x5aeed3,null))[_0x16dd('0x19')](function(_0x574d1a){if(_0x574d1a){_0x1f1a87=_0x574d1a[_0x16dd('0x5c')];_0x5d97f4=_0x574d1a['remoteUri'];var _0x276a6e=_0x574d1a['remoteUri']['slice'](-0x1);if(_0x276a6e==='/'){_0x5d97f4=_0x5d97f4['substring'](0x0,_0x5d97f4[_0x16dd('0x5d')](_0x276a6e));}return rp({'method':'GET','uri':util[_0x16dd('0x5e')](_0x16dd('0x5f'),_0x5d97f4,_0x16dd('0x60')),'headers':{'Authorization':_0x16dd('0x61')+_0x574d1a[_0x16dd('0x5b')]},'json':!![]});}})[_0x16dd('0x19')](function(_0x2c85c1){if(_0x2c85c1){var _0x736e24=_0x2c85c1[_0x16dd('0x62')];var _0x1470d8=![];var _0x132f13=null;for(_0x132f13=0x0;_0x132f13<_0x736e24[_0x16dd('0x40')];_0x132f13++){if(_0x736e24[_0x132f13]['email']===_0x1f1a87){_0x1470d8=!![];}}if(_0x1470d8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x16dd('0x63')});}}})['then'](respondWithResult(_0x5aeed3,null))[_0x16dd('0x24')](function(_0xd41f16){var _0x2b670a=_0x26d74b[_0x16dd('0x3f')]['test']?0x1f4:_0xd41f16[_0x16dd('0x64')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x16dd('0x65'),_0x2b670a,JSON['stringify'](_0xd41f16));delete _0xd41f16['name'];if(_0x2b670a===0x191){_0x2b670a=0x190;}_0x5aeed3[_0x16dd('0x26')](_0x2b670a)[_0x16dd('0x32')](_0x26d74b['query'][_0x16dd('0x66')]?{'message':_0x16dd('0x67'),'statusCode':_0xd41f16[_0x16dd('0x64')]}:_0xd41f16);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 6c09e97..a2f6ec2 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 _0xac8e=['api','moment','bluebird','path','../../config/environment','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger'];(function(_0x5d3a6a,_0x11c93a){var _0x35980b=function(_0x554419){while(--_0x554419){_0x5d3a6a['push'](_0x5d3a6a['shift']());}};_0x35980b(++_0x11c93a);}(_0xac8e,0x19f));var _0xeac8=function(_0x104aea,_0x2a8556){_0x104aea=_0x104aea-0x0;var _0x52714c=_0xac8e[_0x104aea];return _0x52714c;};'use strict';var _=require(_0xeac8('0x0'));var util=require(_0xeac8('0x1'));var logger=require(_0xeac8('0x2'))(_0xeac8('0x3'));var moment=require(_0xeac8('0x4'));var BPromise=require(_0xeac8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeac8('0x6'));var rimraf=require('rimraf');var config=require(_0xeac8('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeac8('0x8')]=function(_0x3120df,_0x840395){return _0x3120df['define'](_0xeac8('0x9'),attributes,{'tableName':_0xeac8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15f9=['rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x22bbed,_0x30c61a){var _0x37f3e8=function(_0x2819a7){while(--_0x2819a7){_0x22bbed['push'](_0x22bbed['shift']());}};_0x37f3e8(++_0x30c61a);}(_0x15f9,0xf7));var _0x915f=function(_0x4090a5,_0x175801){_0x4090a5=_0x4090a5-0x0;var _0x502295=_0x15f9[_0x4090a5];return _0x502295;};'use strict';var _=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var logger=require(_0x915f('0x2'))(_0x915f('0x3'));var moment=require(_0x915f('0x4'));var BPromise=require(_0x915f('0x5'));var rp=require(_0x915f('0x6'));var fs=require('fs');var path=require(_0x915f('0x7'));var rimraf=require(_0x915f('0x8'));var config=require('../../config/environment');var attributes=require(_0x915f('0x9'));var integrations=require(_0x915f('0xa'));module[_0x915f('0xb')]=function(_0x44264e,_0x59aea6){return _0x44264e[_0x915f('0xc')](_0x915f('0xd'),attributes,{'tableName':_0x915f('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 f382f2e..263a91e 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 _0x01a6=['attributes','then','find','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','include','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01a6,0x162));var _0x601a=function(_0x566715,_0x46112b){_0x566715=_0x566715-0x0;var _0x58892f=_0x01a6[_0x566715];return _0x58892f;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var moment=require(_0x601a('0x1'));var BPromise=require(_0x601a('0x2'));var rs=require(_0x601a('0x3'));var fs=require('fs');var Redis=require(_0x601a('0x4'));var db=require(_0x601a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x601a('0x6'))('rpc');var config=require(_0x601a('0x7'));var jayson=require(_0x601a('0x8'));var client=jayson[_0x601a('0x9')][_0x601a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x272297,_0x5d94b5,_0x4ec3fe){return new BPromise(function(_0x208472,_0x1b6bf7){return client[_0x601a('0xb')](_0x272297,_0x4ec3fe)['then'](function(_0x6c5aab){logger[_0x601a('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'));logger[_0x601a('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'),JSON[_0x601a('0xf')](_0x6c5aab));if(_0x6c5aab[_0x601a('0x10')]){if(_0x6c5aab[_0x601a('0x10')][_0x601a('0x11')]===0x1f4){logger[_0x601a('0x10')](_0x601a('0x12'),_0x5d94b5,_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);return _0x1b6bf7(_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);}logger['error'](_0x601a('0x12'),_0x5d94b5,_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);return _0x208472(_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);}else{logger[_0x601a('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'));_0x208472(_0x6c5aab[_0x601a('0x14')][_0x601a('0x13')]);}})[_0x601a('0x15')](function(_0x4e1ebf){logger[_0x601a('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x5d94b5,_0x4e1ebf);_0x1b6bf7(_0x4e1ebf);});});}exports[_0x601a('0x16')]=function(_0x1d3839){var _0x359554=this;return new Promise(function(_0x3411c3,_0x117870){return db[_0x601a('0x17')][_0x601a('0x18')]({'raw':_0x1d3839['options']?_0x1d3839[_0x601a('0x19')][_0x601a('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d3839[_0x601a('0x19')]?_0x1d3839[_0x601a('0x19')][_0x601a('0x1b')]||null:null,'attributes':_0x1d3839[_0x601a('0x19')]?_0x1d3839[_0x601a('0x19')]['attributes']||null:null,'limit':_0x1d3839[_0x601a('0x19')]?_0x1d3839['options']['limit']||null:null,'include':_0x1d3839[_0x601a('0x19')]?_0x1d3839[_0x601a('0x19')][_0x601a('0x1c')]?_[_0x601a('0x1d')](_0x1d3839['options'][_0x601a('0x1c')],function(_0x5be894){return{'model':db[_0x5be894['model']],'as':_0x5be894['as'],'attributes':_0x5be894['attributes'],'include':_0x5be894['include']?_['map'](_0x5be894[_0x601a('0x1c')],function(_0x599d71){return{'model':db[_0x599d71[_0x601a('0x1e')]],'as':_0x599d71['as'],'attributes':_0x599d71[_0x601a('0x1f')],'include':_0x599d71[_0x601a('0x1c')]?_[_0x601a('0x1d')](_0x599d71['include'],function(_0x336e88){return{'model':db[_0x336e88[_0x601a('0x1e')]],'as':_0x336e88['as'],'attributes':_0x336e88['attributes']};}):[]};}):[]};}):[]:[]})[_0x601a('0x20')](function(_0x335581){logger[_0x601a('0xc')](_0x601a('0x16'),_0x1d3839);logger[_0x601a('0xe')]('GetFreshsalesAccount',_0x1d3839,JSON[_0x601a('0xf')](_0x335581));_0x3411c3(_0x335581);})[_0x601a('0x15')](function(_0x9e08f4){logger[_0x601a('0x10')](_0x601a('0x16'),_0x9e08f4['message'],_0x1d3839);_0x117870(_0x359554[_0x601a('0x10')](0x1f4,_0x9e08f4[_0x601a('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x44d27f){var _0x342bc0=this;return new Promise(function(_0x2c764a,_0x508ddc){return db['FreshsalesAccount'][_0x601a('0x21')]({'raw':_0x44d27f[_0x601a('0x19')]?_0x44d27f[_0x601a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x44d27f[_0x601a('0x19')]?_0x44d27f['options'][_0x601a('0x1b')]||null:null,'attributes':_0x44d27f[_0x601a('0x19')]?_0x44d27f[_0x601a('0x19')][_0x601a('0x1f')]||null:null,'include':_0x44d27f[_0x601a('0x19')]?_0x44d27f[_0x601a('0x19')][_0x601a('0x1c')]?_[_0x601a('0x1d')](_0x44d27f[_0x601a('0x19')][_0x601a('0x1c')],function(_0x3b86b5){return{'model':db[_0x3b86b5[_0x601a('0x1e')]],'as':_0x3b86b5['as'],'attributes':_0x3b86b5[_0x601a('0x1f')],'include':_0x3b86b5[_0x601a('0x1c')]?_['map'](_0x3b86b5[_0x601a('0x1c')],function(_0x56a1bc){return{'model':db[_0x56a1bc[_0x601a('0x1e')]],'as':_0x56a1bc['as'],'attributes':_0x56a1bc[_0x601a('0x1f')],'include':_0x56a1bc[_0x601a('0x1c')]?_[_0x601a('0x1d')](_0x56a1bc[_0x601a('0x1c')],function(_0x28be2b){return{'model':db[_0x28be2b[_0x601a('0x1e')]],'as':_0x28be2b['as'],'attributes':_0x28be2b['attributes']};}):[]};}):[]};}):[]:[]})[_0x601a('0x20')](function(_0x2f94a7){logger[_0x601a('0xc')](_0x601a('0x22'),_0x44d27f);logger[_0x601a('0xe')](_0x601a('0x22'),_0x44d27f,JSON['stringify'](_0x2f94a7));_0x2c764a(_0x2f94a7);})[_0x601a('0x15')](function(_0x1aaaa0){logger[_0x601a('0x10')](_0x601a('0x22'),_0x1aaaa0[_0x601a('0x13')],_0x44d27f);_0x508ddc(_0x342bc0[_0x601a('0x10')](0x1f4,_0x1aaaa0[_0x601a('0x13')]));});});}; \ No newline at end of file +var _0x3d3d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','result','message','catch','findAll','options','where','limit','map','include','model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount','FreshsalesAccount','find','util','moment','randomstring','ioredis'];(function(_0x496cf1,_0x5b1e66){var _0x20f6d7=function(_0x35233d){while(--_0x35233d){_0x496cf1['push'](_0x496cf1['shift']());}};_0x20f6d7(++_0x5b1e66);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var moment=require(_0xd3d3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3d3('0x2'));var fs=require('fs');var Redis=require(_0xd3d3('0x3'));var db=require(_0xd3d3('0x4'))['db'];var utils=require(_0xd3d3('0x5'));var logger=require(_0xd3d3('0x6'))(_0xd3d3('0x7'));var config=require(_0xd3d3('0x8'));var jayson=require(_0xd3d3('0x9'));var client=jayson[_0xd3d3('0xa')][_0xd3d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa421,_0x1f47fe,_0x263940){return new BPromise(function(_0x3fe58e,_0x2ed96f){return client['request'](_0x4aa421,_0x263940)[_0xd3d3('0xc')](function(_0x412054){logger[_0xd3d3('0xd')](_0xd3d3('0xe'),_0x1f47fe,'request\x20sent');logger[_0xd3d3('0xf')](_0xd3d3('0x10'),_0x1f47fe,_0xd3d3('0x11'),JSON[_0xd3d3('0x12')](_0x412054));if(_0x412054[_0xd3d3('0x13')]){if(_0x412054[_0xd3d3('0x13')]['code']===0x1f4){logger[_0xd3d3('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1f47fe,_0x412054['error']['message']);return _0x2ed96f(_0x412054[_0xd3d3('0x13')]['message']);}logger['error'](_0xd3d3('0xe'),_0x1f47fe,_0x412054[_0xd3d3('0x13')]['message']);return _0x3fe58e(_0x412054[_0xd3d3('0x13')]['message']);}else{logger['info'](_0xd3d3('0xe'),_0x1f47fe,_0xd3d3('0x11'));_0x3fe58e(_0x412054[_0xd3d3('0x14')][_0xd3d3('0x15')]);}})[_0xd3d3('0x16')](function(_0x5c3462){logger[_0xd3d3('0x13')](_0xd3d3('0xe'),_0x1f47fe,_0x5c3462);_0x2ed96f(_0x5c3462);});});}exports['GetFreshsalesAccount']=function(_0x4c18e3){var _0xd369a3=this;return new Promise(function(_0x39792f,_0x14ee85){return db['FreshsalesAccount'][_0xd3d3('0x17')]({'raw':_0x4c18e3[_0xd3d3('0x18')]?_0x4c18e3[_0xd3d3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c18e3[_0xd3d3('0x18')]?_0x4c18e3[_0xd3d3('0x18')][_0xd3d3('0x19')]||null:null,'attributes':_0x4c18e3['options']?_0x4c18e3[_0xd3d3('0x18')]['attributes']||null:null,'limit':_0x4c18e3['options']?_0x4c18e3[_0xd3d3('0x18')][_0xd3d3('0x1a')]||null:null,'include':_0x4c18e3[_0xd3d3('0x18')]?_0x4c18e3[_0xd3d3('0x18')]['include']?_[_0xd3d3('0x1b')](_0x4c18e3[_0xd3d3('0x18')][_0xd3d3('0x1c')],function(_0x358ecc){return{'model':db[_0x358ecc[_0xd3d3('0x1d')]],'as':_0x358ecc['as'],'attributes':_0x358ecc[_0xd3d3('0x1e')],'include':_0x358ecc[_0xd3d3('0x1c')]?_[_0xd3d3('0x1b')](_0x358ecc[_0xd3d3('0x1c')],function(_0x1cb091){return{'model':db[_0x1cb091[_0xd3d3('0x1d')]],'as':_0x1cb091['as'],'attributes':_0x1cb091[_0xd3d3('0x1e')],'include':_0x1cb091['include']?_[_0xd3d3('0x1b')](_0x1cb091['include'],function(_0x400a14){return{'model':db[_0x400a14[_0xd3d3('0x1d')]],'as':_0x400a14['as'],'attributes':_0x400a14['attributes']};}):[]};}):[]};}):[]:[]})[_0xd3d3('0xc')](function(_0x1a1933){logger[_0xd3d3('0xd')]('GetFreshsalesAccount',_0x4c18e3);logger[_0xd3d3('0xf')](_0xd3d3('0x1f'),_0x4c18e3,JSON[_0xd3d3('0x12')](_0x1a1933));_0x39792f(_0x1a1933);})['catch'](function(_0x47688a){logger[_0xd3d3('0x13')](_0xd3d3('0x1f'),_0x47688a[_0xd3d3('0x15')],_0x4c18e3);_0x14ee85(_0xd369a3[_0xd3d3('0x13')](0x1f4,_0x47688a[_0xd3d3('0x15')]));});});};exports[_0xd3d3('0x20')]=function(_0x22bcc9){var _0x9a03c5=this;return new Promise(function(_0x12a6a9,_0x1e4b3b){return db[_0xd3d3('0x21')][_0xd3d3('0x22')]({'raw':_0x22bcc9[_0xd3d3('0x18')]?_0x22bcc9['options']['raw']===undefined?!![]:![]:!![],'where':_0x22bcc9[_0xd3d3('0x18')]?_0x22bcc9[_0xd3d3('0x18')]['where']||null:null,'attributes':_0x22bcc9[_0xd3d3('0x18')]?_0x22bcc9[_0xd3d3('0x18')][_0xd3d3('0x1e')]||null:null,'include':_0x22bcc9[_0xd3d3('0x18')]?_0x22bcc9[_0xd3d3('0x18')]['include']?_[_0xd3d3('0x1b')](_0x22bcc9['options']['include'],function(_0x41fd40){return{'model':db[_0x41fd40['model']],'as':_0x41fd40['as'],'attributes':_0x41fd40[_0xd3d3('0x1e')],'include':_0x41fd40['include']?_[_0xd3d3('0x1b')](_0x41fd40[_0xd3d3('0x1c')],function(_0x37432f){return{'model':db[_0x37432f[_0xd3d3('0x1d')]],'as':_0x37432f['as'],'attributes':_0x37432f[_0xd3d3('0x1e')],'include':_0x37432f['include']?_[_0xd3d3('0x1b')](_0x37432f[_0xd3d3('0x1c')],function(_0x2d4942){return{'model':db[_0x2d4942[_0xd3d3('0x1d')]],'as':_0x2d4942['as'],'attributes':_0x2d4942[_0xd3d3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd3d3('0xc')](function(_0x2c1bfb){logger[_0xd3d3('0xd')](_0xd3d3('0x20'),_0x22bcc9);logger['debug'](_0xd3d3('0x20'),_0x22bcc9,JSON[_0xd3d3('0x12')](_0x2c1bfb));_0x12a6a9(_0x2c1bfb);})[_0xd3d3('0x16')](function(_0x388505){logger[_0xd3d3('0x13')]('ShowFreshsalesAccount',_0x388505['message'],_0x22bcc9);_0x1e4b3b(_0x9a03c5[_0xd3d3('0x13')](0x1f4,_0x388505[_0xd3d3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 447bb50..20c2b30 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 _0x3d38=['get','/:id/descriptions','/:id/fields','create','put','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','/:id','show','getSubjects'];(function(_0x3d450e,_0x515178){var _0x1f3f15=function(_0x585b8a){while(--_0x585b8a){_0x3d450e['push'](_0x3d450e['shift']());}};_0x1f3f15(++_0x515178);}(_0x3d38,0x1d7));var _0x83d3=function(_0x1aec28,_0x556b6f){_0x1aec28=_0x1aec28-0x0;var _0x2398c7=_0x3d38[_0x1aec28];return _0x2398c7;};'use strict';var multer=require('multer');var util=require(_0x83d3('0x0'));var path=require('path');var timeout=require(_0x83d3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x83d3('0x2'));var auth=require(_0x83d3('0x3'));var interaction=require(_0x83d3('0x4'));var config=require(_0x83d3('0x5'));var controller=require(_0x83d3('0x6'));router['get']('/',auth[_0x83d3('0x7')](),controller[_0x83d3('0x8')]);router['get'](_0x83d3('0x9'),auth[_0x83d3('0x7')](),controller[_0x83d3('0xa')]);router['get']('/:id/subjects',auth[_0x83d3('0x7')](),controller[_0x83d3('0xb')]);router[_0x83d3('0xc')](_0x83d3('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x83d3('0xc')](_0x83d3('0xe'),auth[_0x83d3('0x7')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x83d3('0xf')]);router[_0x83d3('0x10')](_0x83d3('0x9'),auth['isAuthenticated'](),controller[_0x83d3('0x11')]);router[_0x83d3('0x12')](_0x83d3('0x9'),auth[_0x83d3('0x7')](),controller[_0x83d3('0x13')]);module[_0x83d3('0x14')]=router; \ No newline at end of file +var _0xf164=['/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id/subjects','getSubjects','/:id/fields','getFields','post','create','update'];(function(_0x2aa01c,_0x51ec62){var _0x314fa5=function(_0x4859f5){while(--_0x4859f5){_0x2aa01c['push'](_0x2aa01c['shift']());}};_0x314fa5(++_0x51ec62);}(_0xf164,0xcb));var _0x4f16=function(_0x6be190,_0x25e8dd){_0x6be190=_0x6be190-0x0;var _0x3867df=_0xf164[_0x6be190];return _0x3867df;};'use strict';var multer=require(_0x4f16('0x0'));var util=require(_0x4f16('0x1'));var path=require(_0x4f16('0x2'));var timeout=require(_0x4f16('0x3'));var express=require(_0x4f16('0x4'));var router=express['Router']();var fs_extra=require(_0x4f16('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4f16('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x4f16('0x7')]('/',auth[_0x4f16('0x8')](),controller[_0x4f16('0x9')]);router[_0x4f16('0x7')]('/:id',auth[_0x4f16('0x8')](),controller['show']);router['get'](_0x4f16('0xa'),auth[_0x4f16('0x8')](),controller[_0x4f16('0xb')]);router[_0x4f16('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x4f16('0x7')](_0x4f16('0xc'),auth['isAuthenticated'](),controller[_0x4f16('0xd')]);router[_0x4f16('0xe')]('/',auth[_0x4f16('0x8')](),controller[_0x4f16('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4f16('0x10')]);router['delete'](_0x4f16('0x11'),auth['isAuthenticated'](),controller[_0x4f16('0x12')]);module[_0x4f16('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 51146ba..f11d5d3 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 _0x03c7=['exports','STRING'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x03c7,0x1be));var _0x703c=function(_0x54e124,_0x242d6a){_0x54e124=_0x54e124-0x0;var _0x488726=_0x03c7[_0x54e124];return _0x488726;};'use strict';var Sequelize=require('sequelize');module[_0x703c('0x0')]={'name':{'type':Sequelize[_0x703c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c41=['STRING','exports'];(function(_0x59b35f,_0x350657){var _0x348c0d=function(_0x5a8f41){while(--_0x5a8f41){_0x59b35f['push'](_0x59b35f['shift']());}};_0x348c0d(++_0x350657);}(_0x2c41,0xdf));var _0x12c4=function(_0x2f1f08,_0x158f35){_0x2f1f08=_0x2f1f08-0x0;var _0x32f365=_0x2c41[_0x2f1f08];return _0x32f365;};'use strict';var Sequelize=require('sequelize');module[_0x12c4('0x0')]={'name':{'type':Sequelize[_0x12c4('0x1')]},'description':{'type':Sequelize[_0x12c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1efa62a..8726b88 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 _0xc9b0=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll','include','findAll','show','params','find','create','body','destroy','findOne','FreshsalesField','getSubjects','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x670b87,_0x4863be){var _0x20d7fb=function(_0x28fa42){while(--_0x28fa42){_0x670b87['push'](_0x670b87['shift']());}};_0x20d7fb(++_0x4863be);}(_0xc9b0,0x143));var _0x0c9b=function(_0x4daa40,_0x1cb2a7){_0x4daa40=_0x4daa40-0x0;var _0x4e836c=_0xc9b0[_0x4daa40];return _0x4e836c;};'use strict';var emlformat=require(_0x0c9b('0x0'));var rimraf=require(_0x0c9b('0x1'));var zipdir=require(_0x0c9b('0x2'));var jsonpatch=require(_0x0c9b('0x3'));var rp=require(_0x0c9b('0x4'));var moment=require(_0x0c9b('0x5'));var BPromise=require(_0x0c9b('0x6'));var Mustache=require(_0x0c9b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0c9b('0x8'));var csv=require(_0x0c9b('0x9'));var ejs=require(_0x0c9b('0xa'));var fs=require('fs');var fs_extra=require(_0x0c9b('0xb'));var _=require(_0x0c9b('0xc'));var squel=require(_0x0c9b('0xd'));var crypto=require(_0x0c9b('0xe'));var jsforce=require(_0x0c9b('0xf'));var deskjs=require(_0x0c9b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0c9b('0x11'));var authService=require(_0x0c9b('0x12'));var qs=require(_0x0c9b('0x13'));var as=require(_0x0c9b('0x14'));var hardwareService=require(_0x0c9b('0x15'));var logger=require(_0x0c9b('0x16'))('api');var utils=require(_0x0c9b('0x17'));var config=require(_0x0c9b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c9b('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0c9b('0x1a')][_0x0c9b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2d97b8,_0xec0b75,_0x2fc28f,_0x2bc058){return new BPromise(function(_0x291aeb,_0x41603d){var _0x40d68f=_0x2bc058||client;return _0x40d68f[_0x0c9b('0x1c')](_0x2d97b8,_0x2fc28f)['then'](function(_0x5967a6){logger['info'](_0x0c9b('0x1d'),_0xec0b75,_0x0c9b('0x1e'));logger['debug'](_0x0c9b('0x1f'),_0xec0b75,_0x0c9b('0x1e'),JSON[_0x0c9b('0x20')](_0x5967a6));if(_0x5967a6[_0x0c9b('0x21')]){if(_0x5967a6[_0x0c9b('0x21')][_0x0c9b('0x22')]===0x1f4){logger[_0x0c9b('0x21')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xec0b75,_0x5967a6['error'][_0x0c9b('0x23')]);return _0x41603d(_0x5967a6['error'][_0x0c9b('0x23')]);}logger[_0x0c9b('0x21')](_0x0c9b('0x1d'),_0xec0b75,_0x5967a6[_0x0c9b('0x21')][_0x0c9b('0x23')]);return _0x291aeb(_0x5967a6[_0x0c9b('0x21')][_0x0c9b('0x23')]);}else{logger[_0x0c9b('0x24')](_0x0c9b('0x1d'),_0xec0b75,_0x0c9b('0x1e'));_0x291aeb(_0x5967a6['result'][_0x0c9b('0x23')]);}})[_0x0c9b('0x25')](function(_0x3f499a){logger['error'](_0x0c9b('0x1d'),_0xec0b75,_0x3f499a);_0x41603d(_0x3f499a);});});}function respondWithStatusCode(_0x37ee51,_0x2409c6){_0x2409c6=_0x2409c6||0xcc;return function(_0x5c83c8){if(_0x5c83c8){return _0x37ee51[_0x0c9b('0x26')](_0x2409c6);}return _0x37ee51['status'](_0x2409c6)[_0x0c9b('0x27')]();};}function respondWithResult(_0x246738,_0x2d1ce5){_0x2d1ce5=_0x2d1ce5||0xc8;return function(_0x1824d2){if(_0x1824d2){return _0x246738[_0x0c9b('0x28')](_0x2d1ce5)[_0x0c9b('0x29')](_0x1824d2);}};}function respondWithFilteredResult(_0x29e457,_0x21748a){return function(_0x476c59){if(_0x476c59){var _0x243fec=typeof _0x21748a[_0x0c9b('0x2a')]==='undefined'&&typeof _0x21748a['limit']===_0x0c9b('0x2b');var _0x29f1bb=_0x476c59[_0x0c9b('0x2c')];var _0x2c9f63=_0x243fec?0x0:_0x21748a['offset'];var _0x361d03=_0x243fec?_0x476c59[_0x0c9b('0x2c')]:_0x21748a['offset']+_0x21748a[_0x0c9b('0x2d')];var _0x3498e6;if(_0x361d03>=_0x29f1bb){_0x361d03=_0x29f1bb;_0x3498e6=0xc8;}else{_0x3498e6=0xce;}_0x29e457[_0x0c9b('0x28')](_0x3498e6);return _0x29e457[_0x0c9b('0x2e')](_0x0c9b('0x2f'),_0x2c9f63+'-'+_0x361d03+'/'+_0x29f1bb)[_0x0c9b('0x29')](_0x476c59);}return null;};}function patchUpdates(_0x523fad){return function(_0x2eeea7){try{jsonpatch[_0x0c9b('0x30')](_0x2eeea7,_0x523fad,!![]);}catch(_0x4b3f6d){return BPromise[_0x0c9b('0x31')](_0x4b3f6d);}return _0x2eeea7[_0x0c9b('0x32')]();};}function saveUpdates(_0x45aa93,_0x174448){return function(_0x233d4b){if(_0x233d4b){return _0x233d4b[_0x0c9b('0x33')](_0x45aa93)[_0x0c9b('0x34')](function(_0x31397b){return _0x31397b;});}return null;};}function removeEntity(_0x16fd5e,_0x46c27d){return function(_0x57a0ad){if(_0x57a0ad){return _0x57a0ad['destroy']()['then'](function(){_0x16fd5e[_0x0c9b('0x28')](0xcc)[_0x0c9b('0x27')]();});}};}function handleEntityNotFound(_0x16fb5e,_0x1237d5){return function(_0x3655be){if(!_0x3655be){_0x16fb5e[_0x0c9b('0x26')](0x194);}return _0x3655be;};}function handleError(_0x2da701,_0x265fae){_0x265fae=_0x265fae||0x1f4;return function(_0x414fda){logger[_0x0c9b('0x21')](_0x414fda['stack']);if(_0x414fda[_0x0c9b('0x35')]){delete _0x414fda['name'];}_0x2da701[_0x0c9b('0x28')](_0x265fae)[_0x0c9b('0x36')](_0x414fda);};}exports[_0x0c9b('0x37')]=function(_0x7e5856,_0xa07a10){var _0x5b300a={},_0x430db5={},_0x50dae4={'count':0x0,'rows':[]};var _0x58cef3=_[_0x0c9b('0x38')](db['FreshsalesConfiguration'][_0x0c9b('0x39')],function(_0x1a6731){return{'name':_0x1a6731[_0x0c9b('0x3a')],'type':_0x1a6731[_0x0c9b('0x3b')][_0x0c9b('0x3c')]};});_0x430db5[_0x0c9b('0x3d')]=_[_0x0c9b('0x38')](_0x58cef3,_0x0c9b('0x35'));_0x430db5[_0x0c9b('0x3e')]=_[_0x0c9b('0x3f')](_0x7e5856[_0x0c9b('0x3e')]);_0x430db5[_0x0c9b('0x40')]=_['intersection'](_0x430db5[_0x0c9b('0x3d')],_0x430db5[_0x0c9b('0x3e')]);_0x5b300a[_0x0c9b('0x41')]=_[_0x0c9b('0x42')](_0x430db5[_0x0c9b('0x3d')],qs['fields'](_0x7e5856[_0x0c9b('0x3e')][_0x0c9b('0x43')]));_0x5b300a[_0x0c9b('0x41')]=_0x5b300a[_0x0c9b('0x41')][_0x0c9b('0x44')]?_0x5b300a[_0x0c9b('0x41')]:_0x430db5[_0x0c9b('0x3d')];if(!_0x7e5856[_0x0c9b('0x3e')]['hasOwnProperty'](_0x0c9b('0x45'))){_0x5b300a['limit']=qs[_0x0c9b('0x2d')](_0x7e5856[_0x0c9b('0x3e')][_0x0c9b('0x2d')]);_0x5b300a[_0x0c9b('0x2a')]=qs[_0x0c9b('0x2a')](_0x7e5856['query'][_0x0c9b('0x2a')]);}_0x5b300a[_0x0c9b('0x46')]=qs[_0x0c9b('0x47')](_0x7e5856[_0x0c9b('0x3e')][_0x0c9b('0x47')]);_0x5b300a[_0x0c9b('0x48')]=qs[_0x0c9b('0x40')](_[_0x0c9b('0x49')](_0x7e5856['query'],_0x430db5[_0x0c9b('0x40')]),_0x58cef3);if(_0x7e5856[_0x0c9b('0x3e')][_0x0c9b('0x4a')]){_0x5b300a[_0x0c9b('0x48')]=_['merge'](_0x5b300a[_0x0c9b('0x48')],{'$or':_['map'](_0x58cef3,function(_0x3ef9f3){if(_0x3ef9f3[_0x0c9b('0x3b')]!==_0x0c9b('0x4b')){var _0x54bbfc={};_0x54bbfc[_0x3ef9f3[_0x0c9b('0x35')]]={'$like':'%'+_0x7e5856['query']['filter']+'%'};return _0x54bbfc;}})});}_0x5b300a=_[_0x0c9b('0x4c')]({},_0x5b300a,_0x7e5856[_0x0c9b('0x4d')]);var _0x2d8ddd={'where':_0x5b300a[_0x0c9b('0x48')]};return db[_0x0c9b('0x4e')][_0x0c9b('0x2c')](_0x2d8ddd)['then'](function(_0x5307fa){_0x50dae4[_0x0c9b('0x2c')]=_0x5307fa;if(_0x7e5856[_0x0c9b('0x3e')][_0x0c9b('0x4f')]){_0x5b300a[_0x0c9b('0x50')]=[{'all':!![]}];}return db[_0x0c9b('0x4e')][_0x0c9b('0x51')](_0x5b300a);})[_0x0c9b('0x34')](function(_0x2861f9){_0x50dae4['rows']=_0x2861f9;return _0x50dae4;})['then'](respondWithFilteredResult(_0xa07a10,_0x5b300a))[_0x0c9b('0x25')](handleError(_0xa07a10,null));};exports[_0x0c9b('0x52')]=function(_0x593849,_0x120b28){var _0x55e94d={'raw':![],'where':{'id':_0x593849[_0x0c9b('0x53')]['id']}},_0x52f612={};_0x52f612[_0x0c9b('0x3d')]=_[_0x0c9b('0x3f')](db[_0x0c9b('0x4e')][_0x0c9b('0x39')]);_0x52f612[_0x0c9b('0x3e')]=_[_0x0c9b('0x3f')](_0x593849['query']);_0x52f612['filters']=_[_0x0c9b('0x42')](_0x52f612['model'],_0x52f612[_0x0c9b('0x3e')]);_0x55e94d[_0x0c9b('0x41')]=_['intersection'](_0x52f612['model'],qs['fields'](_0x593849[_0x0c9b('0x3e')][_0x0c9b('0x43')]));_0x55e94d[_0x0c9b('0x41')]=_0x55e94d['attributes'][_0x0c9b('0x44')]?_0x55e94d['attributes']:_0x52f612[_0x0c9b('0x3d')];if(_0x593849[_0x0c9b('0x3e')][_0x0c9b('0x4f')]){_0x55e94d[_0x0c9b('0x50')]=[{'all':!![]}];}_0x55e94d=_['merge']({},_0x55e94d,_0x593849['options']);return db[_0x0c9b('0x4e')][_0x0c9b('0x54')](_0x55e94d)[_0x0c9b('0x34')](handleEntityNotFound(_0x120b28,null))[_0x0c9b('0x34')](respondWithResult(_0x120b28,null))['catch'](handleError(_0x120b28,null));};exports[_0x0c9b('0x55')]=function(_0x5d7f6a,_0x255ef0){return db[_0x0c9b('0x4e')][_0x0c9b('0x55')](_0x5d7f6a[_0x0c9b('0x56')],{})[_0x0c9b('0x34')](respondWithResult(_0x255ef0,0xc9))['catch'](handleError(_0x255ef0,null));};exports['update']=function(_0x4191b8,_0x7df4c0){if(_0x4191b8[_0x0c9b('0x56')]['id']){delete _0x4191b8[_0x0c9b('0x56')]['id'];}return db['FreshsalesConfiguration'][_0x0c9b('0x54')]({'where':{'id':_0x4191b8['params']['id']}})[_0x0c9b('0x34')](handleEntityNotFound(_0x7df4c0,null))[_0x0c9b('0x34')](saveUpdates(_0x4191b8['body'],null))[_0x0c9b('0x34')](respondWithResult(_0x7df4c0,null))['catch'](handleError(_0x7df4c0,null));};exports[_0x0c9b('0x57')]=function(_0x485996,_0xa7e293){return db[_0x0c9b('0x4e')][_0x0c9b('0x54')]({'where':{'id':_0x485996[_0x0c9b('0x53')]['id']}})[_0x0c9b('0x34')](handleEntityNotFound(_0xa7e293,null))[_0x0c9b('0x34')](removeEntity(_0xa7e293,null))['catch'](handleError(_0xa7e293,null));};exports['getSubjects']=function(_0x522312,_0x44b7f1,_0x47b62f){var _0x1262ca={};var _0x12ea68={};var _0x2c10bd;var _0x31926c;return db['FreshsalesConfiguration'][_0x0c9b('0x58')]({'where':{'id':_0x522312[_0x0c9b('0x53')]['id']}})[_0x0c9b('0x34')](handleEntityNotFound(_0x44b7f1,null))[_0x0c9b('0x34')](function(_0x2bb6ca){if(_0x2bb6ca){_0x2c10bd=_0x2bb6ca;_0x12ea68[_0x0c9b('0x3d')]=_[_0x0c9b('0x3f')](db[_0x0c9b('0x59')][_0x0c9b('0x39')]);_0x12ea68[_0x0c9b('0x3e')]=_[_0x0c9b('0x3f')](_0x522312[_0x0c9b('0x3e')]);_0x12ea68[_0x0c9b('0x40')]=_[_0x0c9b('0x42')](_0x12ea68[_0x0c9b('0x3d')],_0x12ea68['query']);_0x1262ca['attributes']=_['intersection'](_0x12ea68['model'],qs[_0x0c9b('0x43')](_0x522312['query'][_0x0c9b('0x43')]));_0x1262ca[_0x0c9b('0x41')]=_0x1262ca[_0x0c9b('0x41')][_0x0c9b('0x44')]?_0x1262ca[_0x0c9b('0x41')]:_0x12ea68[_0x0c9b('0x3d')];_0x1262ca[_0x0c9b('0x46')]=qs[_0x0c9b('0x47')](_0x522312[_0x0c9b('0x3e')][_0x0c9b('0x47')]);_0x1262ca[_0x0c9b('0x48')]=qs[_0x0c9b('0x40')](_[_0x0c9b('0x49')](_0x522312['query'],_0x12ea68['filters']));if(_0x522312[_0x0c9b('0x3e')][_0x0c9b('0x4a')]){_0x1262ca[_0x0c9b('0x48')]=_[_0x0c9b('0x4c')](_0x1262ca[_0x0c9b('0x48')],{'$or':_[_0x0c9b('0x38')](_0x1262ca[_0x0c9b('0x41')],function(_0x21aca3){var _0x30f4d7={};_0x30f4d7[_0x21aca3]={'$like':'%'+_0x522312[_0x0c9b('0x3e')][_0x0c9b('0x4a')]+'%'};return _0x30f4d7;})});}_0x1262ca=_[_0x0c9b('0x4c')]({},_0x1262ca,_0x522312[_0x0c9b('0x4d')]);return _0x2c10bd[_0x0c9b('0x5a')](_0x1262ca);}})[_0x0c9b('0x34')](function(_0x4ff3e5){if(_0x4ff3e5){_0x31926c=_0x4ff3e5['length'];if(!_0x522312[_0x0c9b('0x3e')][_0x0c9b('0x5b')]('nolimit')){_0x1262ca[_0x0c9b('0x2d')]=qs[_0x0c9b('0x2d')](_0x522312[_0x0c9b('0x3e')][_0x0c9b('0x2d')]);_0x1262ca[_0x0c9b('0x2a')]=qs[_0x0c9b('0x2a')](_0x522312[_0x0c9b('0x3e')][_0x0c9b('0x2a')]);}return _0x2c10bd[_0x0c9b('0x5a')](_0x1262ca);}})[_0x0c9b('0x34')](function(_0x3ad93f){if(_0x3ad93f){return _0x3ad93f?{'count':_0x31926c,'rows':_0x3ad93f}:null;}})[_0x0c9b('0x34')](respondWithResult(_0x44b7f1,null))[_0x0c9b('0x25')](handleError(_0x44b7f1,null));};exports[_0x0c9b('0x5c')]=function(_0xdf6278,_0x3f779a,_0x378c03){var _0x32fbf2={};var _0x428850={};var _0x508d00;var _0x27b0b5;return db['FreshsalesConfiguration'][_0x0c9b('0x58')]({'where':{'id':_0xdf6278[_0x0c9b('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f779a,null))[_0x0c9b('0x34')](function(_0x4159b8){if(_0x4159b8){_0x508d00=_0x4159b8;_0x428850[_0x0c9b('0x3d')]=_[_0x0c9b('0x3f')](db['FreshsalesField'][_0x0c9b('0x39')]);_0x428850['query']=_[_0x0c9b('0x3f')](_0xdf6278[_0x0c9b('0x3e')]);_0x428850[_0x0c9b('0x40')]=_['intersection'](_0x428850[_0x0c9b('0x3d')],_0x428850['query']);_0x32fbf2[_0x0c9b('0x41')]=_[_0x0c9b('0x42')](_0x428850[_0x0c9b('0x3d')],qs['fields'](_0xdf6278[_0x0c9b('0x3e')][_0x0c9b('0x43')]));_0x32fbf2[_0x0c9b('0x41')]=_0x32fbf2[_0x0c9b('0x41')][_0x0c9b('0x44')]?_0x32fbf2[_0x0c9b('0x41')]:_0x428850[_0x0c9b('0x3d')];_0x32fbf2[_0x0c9b('0x46')]=qs['sort'](_0xdf6278[_0x0c9b('0x3e')]['sort']);_0x32fbf2[_0x0c9b('0x48')]=qs[_0x0c9b('0x40')](_[_0x0c9b('0x49')](_0xdf6278[_0x0c9b('0x3e')],_0x428850['filters']));if(_0xdf6278[_0x0c9b('0x3e')][_0x0c9b('0x4a')]){_0x32fbf2[_0x0c9b('0x48')]=_[_0x0c9b('0x4c')](_0x32fbf2[_0x0c9b('0x48')],{'$or':_[_0x0c9b('0x38')](_0x32fbf2[_0x0c9b('0x41')],function(_0x3e96cb){var _0xc3a912={};_0xc3a912[_0x3e96cb]={'$like':'%'+_0xdf6278[_0x0c9b('0x3e')][_0x0c9b('0x4a')]+'%'};return _0xc3a912;})});}_0x32fbf2=_[_0x0c9b('0x4c')]({},_0x32fbf2,_0xdf6278['options']);return _0x508d00[_0x0c9b('0x5c')](_0x32fbf2);}})[_0x0c9b('0x34')](function(_0x1dc216){if(_0x1dc216){_0x27b0b5=_0x1dc216[_0x0c9b('0x44')];if(!_0xdf6278[_0x0c9b('0x3e')][_0x0c9b('0x5b')](_0x0c9b('0x45'))){_0x32fbf2[_0x0c9b('0x2d')]=qs['limit'](_0xdf6278['query']['limit']);_0x32fbf2[_0x0c9b('0x2a')]=qs['offset'](_0xdf6278[_0x0c9b('0x3e')]['offset']);}return _0x508d00['getDescriptions'](_0x32fbf2);}})['then'](function(_0x1976e6){if(_0x1976e6){return _0x1976e6?{'count':_0x27b0b5,'rows':_0x1976e6}:null;}})[_0x0c9b('0x34')](respondWithResult(_0x3f779a,null))[_0x0c9b('0x25')](handleError(_0x3f779a,null));};exports[_0x0c9b('0x5d')]=function(_0x631dec,_0x7130e9,_0x210e82){var _0x36557f={};var _0x30e4f2={};var _0x2fc339;var _0x4b2ecf;return db[_0x0c9b('0x4e')]['findOne']({'where':{'id':_0x631dec[_0x0c9b('0x53')]['id']}})[_0x0c9b('0x34')](handleEntityNotFound(_0x7130e9,null))[_0x0c9b('0x34')](function(_0x2940cf){if(_0x2940cf){_0x2fc339=_0x2940cf;_0x30e4f2[_0x0c9b('0x3d')]=_[_0x0c9b('0x3f')](db[_0x0c9b('0x59')][_0x0c9b('0x39')]);_0x30e4f2['query']=_[_0x0c9b('0x3f')](_0x631dec[_0x0c9b('0x3e')]);_0x30e4f2[_0x0c9b('0x40')]=_[_0x0c9b('0x42')](_0x30e4f2['model'],_0x30e4f2['query']);_0x36557f[_0x0c9b('0x41')]=_[_0x0c9b('0x42')](_0x30e4f2[_0x0c9b('0x3d')],qs[_0x0c9b('0x43')](_0x631dec[_0x0c9b('0x3e')]['fields']));_0x36557f[_0x0c9b('0x41')]=_0x36557f[_0x0c9b('0x41')][_0x0c9b('0x44')]?_0x36557f[_0x0c9b('0x41')]:_0x30e4f2[_0x0c9b('0x3d')];_0x36557f[_0x0c9b('0x46')]=qs[_0x0c9b('0x47')](_0x631dec[_0x0c9b('0x3e')][_0x0c9b('0x47')]);_0x36557f['where']=qs[_0x0c9b('0x40')](_[_0x0c9b('0x49')](_0x631dec['query'],_0x30e4f2['filters']));if(_0x631dec['query'][_0x0c9b('0x4a')]){_0x36557f[_0x0c9b('0x48')]=_[_0x0c9b('0x4c')](_0x36557f[_0x0c9b('0x48')],{'$or':_[_0x0c9b('0x38')](_0x36557f[_0x0c9b('0x41')],function(_0x49a481){var _0x5c4a3f={};_0x5c4a3f[_0x49a481]={'$like':'%'+_0x631dec[_0x0c9b('0x3e')][_0x0c9b('0x4a')]+'%'};return _0x5c4a3f;})});}_0x36557f=_[_0x0c9b('0x4c')]({},_0x36557f,_0x631dec['options']);return _0x2fc339[_0x0c9b('0x5d')](_0x36557f);}})['then'](function(_0x145388){if(_0x145388){_0x4b2ecf=_0x145388[_0x0c9b('0x44')];if(!_0x631dec[_0x0c9b('0x3e')]['hasOwnProperty']('nolimit')){_0x36557f[_0x0c9b('0x2d')]=qs[_0x0c9b('0x2d')](_0x631dec['query']['limit']);_0x36557f[_0x0c9b('0x2a')]=qs['offset'](_0x631dec['query'][_0x0c9b('0x2a')]);}return _0x2fc339['getFields'](_0x36557f);}})[_0x0c9b('0x34')](function(_0x2e28e2){if(_0x2e28e2){return _0x2e28e2?{'count':_0x4b2ecf,'rows':_0x2e28e2}:null;}})['then'](respondWithResult(_0x7130e9,null))[_0x0c9b('0x25')](handleError(_0x7130e9,null));}; \ No newline at end of file +var _0xd217=['sendStatus','status','end','offset','undefined','limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','count','include','findAll','catch','includeAll','create','body','find','params','getSubjects','filter','getDescriptions','FreshsalesField','order','getFields','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x4ee2d1,_0x261825){var _0x20b0fe=function(_0x1fb6b1){while(--_0x1fb6b1){_0x4ee2d1['push'](_0x4ee2d1['shift']());}};_0x20b0fe(++_0x261825);}(_0xd217,0x141));var _0x7d21=function(_0x1c4254,_0x2025dd){_0x1c4254=_0x1c4254-0x0;var _0x4ec581=_0xd217[_0x1c4254];return _0x4ec581;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d21('0x0'));var zipdir=require(_0x7d21('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d21('0x2'));var moment=require(_0x7d21('0x3'));var BPromise=require(_0x7d21('0x4'));var Mustache=require(_0x7d21('0x5'));var util=require(_0x7d21('0x6'));var path=require(_0x7d21('0x7'));var sox=require(_0x7d21('0x8'));var csv=require(_0x7d21('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d21('0xa'));var squel=require(_0x7d21('0xb'));var crypto=require(_0x7d21('0xc'));var jsforce=require(_0x7d21('0xd'));var deskjs=require(_0x7d21('0xe'));var toCsv=require(_0x7d21('0x9'));var querystring=require(_0x7d21('0xf'));var Papa=require(_0x7d21('0x10'));var Redis=require(_0x7d21('0x11'));var authService=require(_0x7d21('0x12'));var qs=require(_0x7d21('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d21('0x14'))('api');var utils=require(_0x7d21('0x15'));var config=require(_0x7d21('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d21('0x17'))['db'];var jayson=require(_0x7d21('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e4ad0,_0x392217,_0x47a708,_0x94a746){return new BPromise(function(_0x28fc27,_0x14da44){var _0x18fc52=_0x94a746||client;return _0x18fc52[_0x7d21('0x19')](_0x5e4ad0,_0x47a708)['then'](function(_0x1542a4){logger[_0x7d21('0x1a')](_0x7d21('0x1b'),_0x392217,'request\x20sent');logger[_0x7d21('0x1c')](_0x7d21('0x1d'),_0x392217,_0x7d21('0x1e'),JSON['stringify'](_0x1542a4));if(_0x1542a4[_0x7d21('0x1f')]){if(_0x1542a4[_0x7d21('0x1f')][_0x7d21('0x20')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x392217,_0x1542a4[_0x7d21('0x1f')][_0x7d21('0x21')]);return _0x14da44(_0x1542a4[_0x7d21('0x1f')][_0x7d21('0x21')]);}logger[_0x7d21('0x1f')](_0x7d21('0x1b'),_0x392217,_0x1542a4[_0x7d21('0x1f')][_0x7d21('0x21')]);return _0x28fc27(_0x1542a4[_0x7d21('0x1f')][_0x7d21('0x21')]);}else{logger[_0x7d21('0x1a')](_0x7d21('0x1b'),_0x392217,_0x7d21('0x1e'));_0x28fc27(_0x1542a4[_0x7d21('0x22')]['message']);}})['catch'](function(_0x4a2cad){logger[_0x7d21('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x392217,_0x4a2cad);_0x14da44(_0x4a2cad);});});}function respondWithStatusCode(_0x72e361,_0x321d8e){_0x321d8e=_0x321d8e||0xcc;return function(_0xf1cedf){if(_0xf1cedf){return _0x72e361[_0x7d21('0x23')](_0x321d8e);}return _0x72e361[_0x7d21('0x24')](_0x321d8e)[_0x7d21('0x25')]();};}function respondWithResult(_0x497373,_0x4d8a24){_0x4d8a24=_0x4d8a24||0xc8;return function(_0x232d0e){if(_0x232d0e){return _0x497373['status'](_0x4d8a24)['json'](_0x232d0e);}};}function respondWithFilteredResult(_0x30da14,_0x2f94af){return function(_0x1a2324){if(_0x1a2324){var _0x5ecdcd=typeof _0x2f94af[_0x7d21('0x26')]===_0x7d21('0x27')&&typeof _0x2f94af[_0x7d21('0x28')]==='undefined';var _0x56c0aa=_0x1a2324['count'];var _0x5dacbf=_0x5ecdcd?0x0:_0x2f94af[_0x7d21('0x26')];var _0x1f7936=_0x5ecdcd?_0x1a2324['count']:_0x2f94af[_0x7d21('0x26')]+_0x2f94af['limit'];var _0xc247a0;if(_0x1f7936>=_0x56c0aa){_0x1f7936=_0x56c0aa;_0xc247a0=0xc8;}else{_0xc247a0=0xce;}_0x30da14[_0x7d21('0x24')](_0xc247a0);return _0x30da14['set']('Content-Range',_0x5dacbf+'-'+_0x1f7936+'/'+_0x56c0aa)['json'](_0x1a2324);}return null;};}function patchUpdates(_0x5412d2){return function(_0x596104){try{jsonpatch[_0x7d21('0x29')](_0x596104,_0x5412d2,!![]);}catch(_0x56a952){return BPromise[_0x7d21('0x2a')](_0x56a952);}return _0x596104[_0x7d21('0x2b')]();};}function saveUpdates(_0x4f002e,_0x323a8a){return function(_0x39aba7){if(_0x39aba7){return _0x39aba7[_0x7d21('0x2c')](_0x4f002e)[_0x7d21('0x2d')](function(_0x41b8e1){return _0x41b8e1;});}return null;};}function removeEntity(_0x1476d2,_0x2315ce){return function(_0x1fd9e2){if(_0x1fd9e2){return _0x1fd9e2[_0x7d21('0x2e')]()[_0x7d21('0x2d')](function(){_0x1476d2[_0x7d21('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475dea,_0x32977b){return function(_0x29f900){if(!_0x29f900){_0x475dea[_0x7d21('0x23')](0x194);}return _0x29f900;};}function handleError(_0xa61e4b,_0xfa580a){_0xfa580a=_0xfa580a||0x1f4;return function(_0xbbec62){logger[_0x7d21('0x1f')](_0xbbec62[_0x7d21('0x2f')]);if(_0xbbec62[_0x7d21('0x30')]){delete _0xbbec62['name'];}_0xa61e4b[_0x7d21('0x24')](_0xfa580a)[_0x7d21('0x31')](_0xbbec62);};}exports[_0x7d21('0x32')]=function(_0x3a8797,_0x53524d){var _0x1a6e14={},_0x176a7e={},_0x21ee94={'count':0x0,'rows':[]};var _0x4430ad=_[_0x7d21('0x33')](db[_0x7d21('0x34')][_0x7d21('0x35')],function(_0x2a6400){return{'name':_0x2a6400[_0x7d21('0x36')],'type':_0x2a6400['type'][_0x7d21('0x37')]};});_0x176a7e[_0x7d21('0x38')]=_[_0x7d21('0x33')](_0x4430ad,_0x7d21('0x30'));_0x176a7e[_0x7d21('0x39')]=_[_0x7d21('0x3a')](_0x3a8797[_0x7d21('0x39')]);_0x176a7e['filters']=_[_0x7d21('0x3b')](_0x176a7e[_0x7d21('0x38')],_0x176a7e[_0x7d21('0x39')]);_0x1a6e14[_0x7d21('0x3c')]=_[_0x7d21('0x3b')](_0x176a7e[_0x7d21('0x38')],qs[_0x7d21('0x3d')](_0x3a8797[_0x7d21('0x39')][_0x7d21('0x3d')]));_0x1a6e14[_0x7d21('0x3c')]=_0x1a6e14[_0x7d21('0x3c')][_0x7d21('0x3e')]?_0x1a6e14[_0x7d21('0x3c')]:_0x176a7e['model'];if(!_0x3a8797[_0x7d21('0x39')][_0x7d21('0x3f')](_0x7d21('0x40'))){_0x1a6e14['limit']=qs[_0x7d21('0x28')](_0x3a8797[_0x7d21('0x39')][_0x7d21('0x28')]);_0x1a6e14['offset']=qs[_0x7d21('0x26')](_0x3a8797[_0x7d21('0x39')][_0x7d21('0x26')]);}_0x1a6e14['order']=qs['sort'](_0x3a8797['query'][_0x7d21('0x41')]);_0x1a6e14[_0x7d21('0x42')]=qs[_0x7d21('0x43')](_[_0x7d21('0x44')](_0x3a8797[_0x7d21('0x39')],_0x176a7e[_0x7d21('0x43')]),_0x4430ad);if(_0x3a8797[_0x7d21('0x39')]['filter']){_0x1a6e14['where']=_[_0x7d21('0x45')](_0x1a6e14[_0x7d21('0x42')],{'$or':_['map'](_0x4430ad,function(_0x3bee1a){if(_0x3bee1a[_0x7d21('0x46')]!==_0x7d21('0x47')){var _0xeeba3={};_0xeeba3[_0x3bee1a[_0x7d21('0x30')]]={'$like':'%'+_0x3a8797[_0x7d21('0x39')]['filter']+'%'};return _0xeeba3;}})});}_0x1a6e14=_[_0x7d21('0x45')]({},_0x1a6e14,_0x3a8797[_0x7d21('0x48')]);var _0xb655bf={'where':_0x1a6e14[_0x7d21('0x42')]};return db[_0x7d21('0x34')][_0x7d21('0x49')](_0xb655bf)[_0x7d21('0x2d')](function(_0x312463){_0x21ee94[_0x7d21('0x49')]=_0x312463;if(_0x3a8797[_0x7d21('0x39')]['includeAll']){_0x1a6e14[_0x7d21('0x4a')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x7d21('0x4b')](_0x1a6e14);})[_0x7d21('0x2d')](function(_0x52f194){_0x21ee94['rows']=_0x52f194;return _0x21ee94;})[_0x7d21('0x2d')](respondWithFilteredResult(_0x53524d,_0x1a6e14))[_0x7d21('0x4c')](handleError(_0x53524d,null));};exports['show']=function(_0x2b103f,_0x5e3bae){var _0x3cf6ca={'raw':![],'where':{'id':_0x2b103f['params']['id']}},_0x248eed={};_0x248eed[_0x7d21('0x38')]=_[_0x7d21('0x3a')](db[_0x7d21('0x34')][_0x7d21('0x35')]);_0x248eed['query']=_['keys'](_0x2b103f[_0x7d21('0x39')]);_0x248eed[_0x7d21('0x43')]=_['intersection'](_0x248eed[_0x7d21('0x38')],_0x248eed[_0x7d21('0x39')]);_0x3cf6ca[_0x7d21('0x3c')]=_['intersection'](_0x248eed[_0x7d21('0x38')],qs[_0x7d21('0x3d')](_0x2b103f[_0x7d21('0x39')][_0x7d21('0x3d')]));_0x3cf6ca[_0x7d21('0x3c')]=_0x3cf6ca[_0x7d21('0x3c')][_0x7d21('0x3e')]?_0x3cf6ca[_0x7d21('0x3c')]:_0x248eed['model'];if(_0x2b103f[_0x7d21('0x39')][_0x7d21('0x4d')]){_0x3cf6ca[_0x7d21('0x4a')]=[{'all':!![]}];}_0x3cf6ca=_[_0x7d21('0x45')]({},_0x3cf6ca,_0x2b103f[_0x7d21('0x48')]);return db['FreshsalesConfiguration']['find'](_0x3cf6ca)[_0x7d21('0x2d')](handleEntityNotFound(_0x5e3bae,null))['then'](respondWithResult(_0x5e3bae,null))['catch'](handleError(_0x5e3bae,null));};exports[_0x7d21('0x4e')]=function(_0x268f1c,_0x584718){return db[_0x7d21('0x34')][_0x7d21('0x4e')](_0x268f1c[_0x7d21('0x4f')],{})[_0x7d21('0x2d')](respondWithResult(_0x584718,0xc9))[_0x7d21('0x4c')](handleError(_0x584718,null));};exports[_0x7d21('0x2c')]=function(_0x6c3160,_0x11cb38){if(_0x6c3160[_0x7d21('0x4f')]['id']){delete _0x6c3160['body']['id'];}return db['FreshsalesConfiguration'][_0x7d21('0x50')]({'where':{'id':_0x6c3160[_0x7d21('0x51')]['id']}})[_0x7d21('0x2d')](handleEntityNotFound(_0x11cb38,null))['then'](saveUpdates(_0x6c3160[_0x7d21('0x4f')],null))[_0x7d21('0x2d')](respondWithResult(_0x11cb38,null))[_0x7d21('0x4c')](handleError(_0x11cb38,null));};exports[_0x7d21('0x2e')]=function(_0x3708eb,_0x15517d){return db['FreshsalesConfiguration'][_0x7d21('0x50')]({'where':{'id':_0x3708eb[_0x7d21('0x51')]['id']}})[_0x7d21('0x2d')](handleEntityNotFound(_0x15517d,null))['then'](removeEntity(_0x15517d,null))[_0x7d21('0x4c')](handleError(_0x15517d,null));};exports[_0x7d21('0x52')]=function(_0x496779,_0x4802f4,_0x405e7a){var _0x53b4e4={};var _0x29710e={};var _0x35d0b9;var _0x2e4759;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x496779[_0x7d21('0x51')]['id']}})[_0x7d21('0x2d')](handleEntityNotFound(_0x4802f4,null))[_0x7d21('0x2d')](function(_0x4a285b){if(_0x4a285b){_0x35d0b9=_0x4a285b;_0x29710e[_0x7d21('0x38')]=_[_0x7d21('0x3a')](db['FreshsalesField'][_0x7d21('0x35')]);_0x29710e['query']=_[_0x7d21('0x3a')](_0x496779[_0x7d21('0x39')]);_0x29710e[_0x7d21('0x43')]=_['intersection'](_0x29710e[_0x7d21('0x38')],_0x29710e[_0x7d21('0x39')]);_0x53b4e4[_0x7d21('0x3c')]=_[_0x7d21('0x3b')](_0x29710e[_0x7d21('0x38')],qs[_0x7d21('0x3d')](_0x496779[_0x7d21('0x39')][_0x7d21('0x3d')]));_0x53b4e4[_0x7d21('0x3c')]=_0x53b4e4[_0x7d21('0x3c')]['length']?_0x53b4e4['attributes']:_0x29710e[_0x7d21('0x38')];_0x53b4e4['order']=qs[_0x7d21('0x41')](_0x496779['query']['sort']);_0x53b4e4[_0x7d21('0x42')]=qs['filters'](_[_0x7d21('0x44')](_0x496779[_0x7d21('0x39')],_0x29710e[_0x7d21('0x43')]));if(_0x496779[_0x7d21('0x39')][_0x7d21('0x53')]){_0x53b4e4[_0x7d21('0x42')]=_['merge'](_0x53b4e4['where'],{'$or':_[_0x7d21('0x33')](_0x53b4e4[_0x7d21('0x3c')],function(_0x1a9d51){var _0x1fc0e6={};_0x1fc0e6[_0x1a9d51]={'$like':'%'+_0x496779[_0x7d21('0x39')][_0x7d21('0x53')]+'%'};return _0x1fc0e6;})});}_0x53b4e4=_[_0x7d21('0x45')]({},_0x53b4e4,_0x496779[_0x7d21('0x48')]);return _0x35d0b9[_0x7d21('0x52')](_0x53b4e4);}})['then'](function(_0x51f102){if(_0x51f102){_0x2e4759=_0x51f102[_0x7d21('0x3e')];if(!_0x496779['query'][_0x7d21('0x3f')](_0x7d21('0x40'))){_0x53b4e4[_0x7d21('0x28')]=qs[_0x7d21('0x28')](_0x496779[_0x7d21('0x39')]['limit']);_0x53b4e4[_0x7d21('0x26')]=qs[_0x7d21('0x26')](_0x496779[_0x7d21('0x39')][_0x7d21('0x26')]);}return _0x35d0b9[_0x7d21('0x52')](_0x53b4e4);}})['then'](function(_0x428eb8){if(_0x428eb8){return _0x428eb8?{'count':_0x2e4759,'rows':_0x428eb8}:null;}})['then'](respondWithResult(_0x4802f4,null))['catch'](handleError(_0x4802f4,null));};exports[_0x7d21('0x54')]=function(_0x2f4e53,_0x3fa451,_0x5c0b94){var _0x3aeb9c={};var _0x4dd703={};var _0xaa494e;var _0x18b994;return db[_0x7d21('0x34')]['findOne']({'where':{'id':_0x2f4e53[_0x7d21('0x51')]['id']}})[_0x7d21('0x2d')](handleEntityNotFound(_0x3fa451,null))['then'](function(_0x5d824e){if(_0x5d824e){_0xaa494e=_0x5d824e;_0x4dd703[_0x7d21('0x38')]=_[_0x7d21('0x3a')](db[_0x7d21('0x55')][_0x7d21('0x35')]);_0x4dd703[_0x7d21('0x39')]=_['keys'](_0x2f4e53[_0x7d21('0x39')]);_0x4dd703[_0x7d21('0x43')]=_['intersection'](_0x4dd703[_0x7d21('0x38')],_0x4dd703[_0x7d21('0x39')]);_0x3aeb9c[_0x7d21('0x3c')]=_[_0x7d21('0x3b')](_0x4dd703[_0x7d21('0x38')],qs[_0x7d21('0x3d')](_0x2f4e53[_0x7d21('0x39')][_0x7d21('0x3d')]));_0x3aeb9c[_0x7d21('0x3c')]=_0x3aeb9c['attributes'][_0x7d21('0x3e')]?_0x3aeb9c['attributes']:_0x4dd703['model'];_0x3aeb9c[_0x7d21('0x56')]=qs[_0x7d21('0x41')](_0x2f4e53[_0x7d21('0x39')][_0x7d21('0x41')]);_0x3aeb9c[_0x7d21('0x42')]=qs[_0x7d21('0x43')](_['pick'](_0x2f4e53[_0x7d21('0x39')],_0x4dd703[_0x7d21('0x43')]));if(_0x2f4e53['query'][_0x7d21('0x53')]){_0x3aeb9c[_0x7d21('0x42')]=_[_0x7d21('0x45')](_0x3aeb9c[_0x7d21('0x42')],{'$or':_[_0x7d21('0x33')](_0x3aeb9c[_0x7d21('0x3c')],function(_0x23b37b){var _0x49122a={};_0x49122a[_0x23b37b]={'$like':'%'+_0x2f4e53[_0x7d21('0x39')][_0x7d21('0x53')]+'%'};return _0x49122a;})});}_0x3aeb9c=_['merge']({},_0x3aeb9c,_0x2f4e53[_0x7d21('0x48')]);return _0xaa494e['getDescriptions'](_0x3aeb9c);}})[_0x7d21('0x2d')](function(_0x32ce24){if(_0x32ce24){_0x18b994=_0x32ce24[_0x7d21('0x3e')];if(!_0x2f4e53[_0x7d21('0x39')][_0x7d21('0x3f')]('nolimit')){_0x3aeb9c[_0x7d21('0x28')]=qs[_0x7d21('0x28')](_0x2f4e53[_0x7d21('0x39')]['limit']);_0x3aeb9c[_0x7d21('0x26')]=qs[_0x7d21('0x26')](_0x2f4e53[_0x7d21('0x39')][_0x7d21('0x26')]);}return _0xaa494e['getDescriptions'](_0x3aeb9c);}})[_0x7d21('0x2d')](function(_0x568cc0){if(_0x568cc0){return _0x568cc0?{'count':_0x18b994,'rows':_0x568cc0}:null;}})[_0x7d21('0x2d')](respondWithResult(_0x3fa451,null))['catch'](handleError(_0x3fa451,null));};exports[_0x7d21('0x57')]=function(_0x576951,_0x3ecf0f,_0x11759e){var _0x510c2c={};var _0x391c7a={};var _0x4f35f6;var _0x6ab0c6;return db['FreshsalesConfiguration'][_0x7d21('0x58')]({'where':{'id':_0x576951[_0x7d21('0x51')]['id']}})[_0x7d21('0x2d')](handleEntityNotFound(_0x3ecf0f,null))[_0x7d21('0x2d')](function(_0x443924){if(_0x443924){_0x4f35f6=_0x443924;_0x391c7a[_0x7d21('0x38')]=_['keys'](db[_0x7d21('0x55')][_0x7d21('0x35')]);_0x391c7a[_0x7d21('0x39')]=_[_0x7d21('0x3a')](_0x576951[_0x7d21('0x39')]);_0x391c7a[_0x7d21('0x43')]=_[_0x7d21('0x3b')](_0x391c7a[_0x7d21('0x38')],_0x391c7a[_0x7d21('0x39')]);_0x510c2c['attributes']=_['intersection'](_0x391c7a['model'],qs[_0x7d21('0x3d')](_0x576951['query'][_0x7d21('0x3d')]));_0x510c2c[_0x7d21('0x3c')]=_0x510c2c[_0x7d21('0x3c')][_0x7d21('0x3e')]?_0x510c2c[_0x7d21('0x3c')]:_0x391c7a['model'];_0x510c2c[_0x7d21('0x56')]=qs[_0x7d21('0x41')](_0x576951[_0x7d21('0x39')][_0x7d21('0x41')]);_0x510c2c['where']=qs[_0x7d21('0x43')](_[_0x7d21('0x44')](_0x576951[_0x7d21('0x39')],_0x391c7a[_0x7d21('0x43')]));if(_0x576951[_0x7d21('0x39')][_0x7d21('0x53')]){_0x510c2c['where']=_[_0x7d21('0x45')](_0x510c2c[_0x7d21('0x42')],{'$or':_[_0x7d21('0x33')](_0x510c2c['attributes'],function(_0x81c08){var _0x24254d={};_0x24254d[_0x81c08]={'$like':'%'+_0x576951['query'][_0x7d21('0x53')]+'%'};return _0x24254d;})});}_0x510c2c=_[_0x7d21('0x45')]({},_0x510c2c,_0x576951[_0x7d21('0x48')]);return _0x4f35f6['getFields'](_0x510c2c);}})['then'](function(_0x4b335e){if(_0x4b335e){_0x6ab0c6=_0x4b335e[_0x7d21('0x3e')];if(!_0x576951[_0x7d21('0x39')][_0x7d21('0x3f')](_0x7d21('0x40'))){_0x510c2c[_0x7d21('0x28')]=qs['limit'](_0x576951[_0x7d21('0x39')][_0x7d21('0x28')]);_0x510c2c['offset']=qs['offset'](_0x576951[_0x7d21('0x39')][_0x7d21('0x26')]);}return _0x4f35f6[_0x7d21('0x57')](_0x510c2c);}})[_0x7d21('0x2d')](function(_0x41e9a4){if(_0x41e9a4){return _0x41e9a4?{'count':_0x6ab0c6,'rows':_0x41e9a4}:null;}})[_0x7d21('0x2d')](respondWithResult(_0x3ecf0f,null))[_0x7d21('0x4c')](handleError(_0x3ecf0f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7b21a02..97f7a2d 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 _0x5ec6=['int_freshsales_configurations','lodash','util','../../config/logger','moment','request-promise','rimraf','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration'];(function(_0x56aab0,_0x4afd25){var _0xa15bf4=function(_0x499049){while(--_0x499049){_0x56aab0['push'](_0x56aab0['shift']());}};_0xa15bf4(++_0x4afd25);}(_0x5ec6,0x7f));var _0x65ec=function(_0x550dd7,_0xe70d73){_0x550dd7=_0x550dd7-0x0;var _0x8044e5=_0x5ec6[_0x550dd7];return _0x8044e5;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var logger=require(_0x65ec('0x2'))('api');var moment=require(_0x65ec('0x3'));var BPromise=require('bluebird');var rp=require(_0x65ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x65ec('0x6'));module['exports']=function(_0x2fc973,_0xbb2e56){return _0x2fc973['define'](_0x65ec('0x7'),attributes,{'tableName':_0x65ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7070=['api','request-promise','path','rimraf','../../config/environment','exports','FreshsalesConfiguration','util'];(function(_0x46e4d5,_0xd67b87){var _0x452cd3=function(_0x24ca9a){while(--_0x24ca9a){_0x46e4d5['push'](_0x46e4d5['shift']());}};_0x452cd3(++_0xd67b87);}(_0x7070,0x1d7));var _0x0707=function(_0x374582,_0x10047e){_0x374582=_0x374582-0x0;var _0x33488c=_0x7070[_0x374582];return _0x33488c;};'use strict';var _=require('lodash');var util=require(_0x0707('0x0'));var logger=require('../../config/logger')(_0x0707('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0707('0x2'));var fs=require('fs');var path=require(_0x0707('0x3'));var rimraf=require(_0x0707('0x4'));var config=require(_0x0707('0x5'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x0707('0x6')]=function(_0x138a4,_0x5e07ee){return _0x138a4['define'](_0x0707('0x7'),attributes,{'tableName':'int_freshsales_configurations','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 ebf7e8a..aa2e0cf 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 _0xe87e=['code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0xd5fd5c,_0x3e2a66){var _0x3b0663=function(_0x40643b){while(--_0x40643b){_0xd5fd5c['push'](_0xd5fd5c['shift']());}};_0x3b0663(++_0x3e2a66);}(_0xe87e,0x17d));var _0xee87=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xe87e[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0xee87('0x0'));var util=require(_0xee87('0x1'));var moment=require(_0xee87('0x2'));var BPromise=require(_0xee87('0x3'));var rs=require(_0xee87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee87('0x5'))['db'];var utils=require(_0xee87('0x6'));var logger=require(_0xee87('0x7'))(_0xee87('0x8'));var config=require(_0xee87('0x9'));var jayson=require(_0xee87('0xa'));var client=jayson[_0xee87('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589c36,_0x2bde4c,_0x2ee165){return new BPromise(function(_0x2fda67,_0x71d659){return client[_0xee87('0xc')](_0x589c36,_0x2ee165)['then'](function(_0x2ed8e9){logger[_0xee87('0xd')](_0xee87('0xe'),_0x2bde4c,_0xee87('0xf'));logger['debug'](_0xee87('0x10'),_0x2bde4c,_0xee87('0xf'),JSON['stringify'](_0x2ed8e9));if(_0x2ed8e9[_0xee87('0x11')]){if(_0x2ed8e9[_0xee87('0x11')][_0xee87('0x12')]===0x1f4){logger[_0xee87('0x11')](_0xee87('0xe'),_0x2bde4c,_0x2ed8e9[_0xee87('0x11')][_0xee87('0x13')]);return _0x71d659(_0x2ed8e9[_0xee87('0x11')]['message']);}logger[_0xee87('0x11')](_0xee87('0xe'),_0x2bde4c,_0x2ed8e9['error']['message']);return _0x2fda67(_0x2ed8e9[_0xee87('0x11')][_0xee87('0x13')]);}else{logger['info'](_0xee87('0xe'),_0x2bde4c,_0xee87('0xf'));_0x2fda67(_0x2ed8e9[_0xee87('0x14')][_0xee87('0x13')]);}})['catch'](function(_0x290968){logger['error'](_0xee87('0xe'),_0x2bde4c,_0x290968);_0x71d659(_0x290968);});});} \ No newline at end of file +var _0x8130=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3b7fb0,_0x23b425){var _0x42e80c=function(_0x52d269){while(--_0x52d269){_0x3b7fb0['push'](_0x3b7fb0['shift']());}};_0x42e80c(++_0x23b425);}(_0x8130,0x146));var _0x0813=function(_0x5c3eb8,_0x1122e5){_0x5c3eb8=_0x5c3eb8-0x0;var _0x4e4df3=_0x8130[_0x5c3eb8];return _0x4e4df3;};'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':0x232a});function respondWithRpcPromise(_0x2df45a,_0x2bbdfd,_0x19a508){return new BPromise(function(_0x2ab8f0,_0x115a90){return client[_0x0813('0xa')](_0x2df45a,_0x19a508)['then'](function(_0x44ec2c){logger[_0x0813('0xb')](_0x0813('0xc'),_0x2bbdfd,'request\x20sent');logger['debug'](_0x0813('0xd'),_0x2bbdfd,'request\x20sent',JSON[_0x0813('0xe')](_0x44ec2c));if(_0x44ec2c['error']){if(_0x44ec2c[_0x0813('0xf')][_0x0813('0x10')]===0x1f4){logger[_0x0813('0xf')](_0x0813('0xc'),_0x2bbdfd,_0x44ec2c['error']['message']);return _0x115a90(_0x44ec2c[_0x0813('0xf')][_0x0813('0x11')]);}logger['error'](_0x0813('0xc'),_0x2bbdfd,_0x44ec2c['error']['message']);return _0x2ab8f0(_0x44ec2c[_0x0813('0xf')][_0x0813('0x11')]);}else{logger['info'](_0x0813('0xc'),_0x2bbdfd,'request\x20sent');_0x2ab8f0(_0x44ec2c[_0x0813('0x12')][_0x0813('0x11')]);}})[_0x0813('0x13')](function(_0xee126d){logger[_0x0813('0xf')](_0x0813('0xc'),_0x2bbdfd,_0xee126d);_0x115a90(_0xee126d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0d6df18..c35e45c 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xc0bbc3,_0x3702df){var _0x4fa138=function(_0x41b58a){while(--_0x41b58a){_0xc0bbc3['push'](_0xc0bbc3['shift']());}};_0x4fa138(++_0x3702df);}(_0xac4a,0x13f));var _0xaac4=function(_0x42dcc7,_0x3f8474){_0x42dcc7=_0x42dcc7-0x0;var _0x27efc9=_0xac4a[_0x42dcc7];return _0x27efc9;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0xe5b5=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x56fc8a,_0x52fd8d){var _0x5d93ef=function(_0x3ecc20){while(--_0x3ecc20){_0x56fc8a['push'](_0x56fc8a['shift']());}};_0x5d93ef(++_0x52fd8d);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xe5b5[_0x1e4f2d];return _0xd05ce5;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0x10')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0x12')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x13')]);router['delete'](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x14')]);module[_0x5e5b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 270ec15..728b391 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 _0xdc97=['picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x4998bd,_0x505b2a){var _0x3f8ce4=function(_0x9930ea){while(--_0x9930ea){_0x4998bd['push'](_0x4998bd['shift']());}};_0x3f8ce4(++_0x505b2a);}(_0xdc97,0x13b));var _0x7dc9=function(_0x4f0666,_0x38c2ec){_0x4f0666=_0x4f0666-0x0;var _0x3bbd03=_0xdc97[_0x4f0666];return _0x3bbd03;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'type':{'type':Sequelize[_0x7dc9('0x2')]('string',_0x7dc9('0x3'),'customVariable',_0x7dc9('0x4'),_0x7dc9('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7dc9('0x6')]},'key':{'type':Sequelize[_0x7dc9('0x6')]},'keyType':{'type':Sequelize[_0x7dc9('0x2')](_0x7dc9('0x7'),'variable',_0x7dc9('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7dc9('0x6')]},'customField':{'type':Sequelize[_0x7dc9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7dc9('0x6')]}}; \ No newline at end of file +var _0x8ef6=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3656b9,_0x3e5299){_0x3656b9=_0x3656b9-0x0;var _0x33a40b=_0x8ef6[_0x3656b9];return _0x33a40b;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'type':{'type':Sequelize[_0x68ef('0x2')](_0x68ef('0x3'),_0x68ef('0x4'),_0x68ef('0x5'),_0x68ef('0x6'),'picklist'),'defaultValue':_0x68ef('0x3')},'content':{'type':Sequelize[_0x68ef('0x7')]},'key':{'type':Sequelize[_0x68ef('0x7')]},'keyType':{'type':Sequelize[_0x68ef('0x2')]('string','variable',_0x68ef('0x5'))},'keyContent':{'type':Sequelize[_0x68ef('0x7')]},'idField':{'type':Sequelize[_0x68ef('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x68ef('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x68ef('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d2bf208..cfe4b7a 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 _0xad15=['FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map'];(function(_0x4c5034,_0x264da9){var _0x139f2f=function(_0x5544d7){while(--_0x5544d7){_0x4c5034['push'](_0x4c5034['shift']());}};_0x139f2f(++_0x264da9);}(_0xad15,0x1ca));var _0x5ad1=function(_0x3d71ba,_0x49a38b){_0x3d71ba=_0x3d71ba-0x0;var _0x5e0ed0=_0xad15[_0x3d71ba];return _0x5e0ed0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ad1('0x0'));var zipdir=require(_0x5ad1('0x1'));var jsonpatch=require(_0x5ad1('0x2'));var rp=require(_0x5ad1('0x3'));var moment=require('moment');var BPromise=require(_0x5ad1('0x4'));var Mustache=require('mustache');var util=require(_0x5ad1('0x5'));var path=require(_0x5ad1('0x6'));var sox=require(_0x5ad1('0x7'));var csv=require(_0x5ad1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ad1('0x9'));var _=require(_0x5ad1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5ad1('0xb'));var toCsv=require(_0x5ad1('0x8'));var querystring=require(_0x5ad1('0xc'));var Papa=require('papaparse');var Redis=require(_0x5ad1('0xd'));var authService=require(_0x5ad1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5ad1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ad1('0x10'))(_0x5ad1('0x11'));var utils=require(_0x5ad1('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5ad1('0x13'));var db=require(_0x5ad1('0x14'))['db'];function respondWithStatusCode(_0x3d34a8,_0x542170){_0x542170=_0x542170||0xcc;return function(_0x43c07e){if(_0x43c07e){return _0x3d34a8['sendStatus'](_0x542170);}return _0x3d34a8['status'](_0x542170)[_0x5ad1('0x15')]();};}function respondWithResult(_0x4d50b2,_0x235845){_0x235845=_0x235845||0xc8;return function(_0x31dde0){if(_0x31dde0){return _0x4d50b2[_0x5ad1('0x16')](_0x235845)[_0x5ad1('0x17')](_0x31dde0);}};}function respondWithFilteredResult(_0x28ab7b,_0x3baeec){return function(_0xb4272f){if(_0xb4272f){var _0x3d7eaa=typeof _0x3baeec[_0x5ad1('0x18')]==='undefined'&&typeof _0x3baeec[_0x5ad1('0x19')]==='undefined';var _0x1e7972=_0xb4272f[_0x5ad1('0x1a')];var _0x2cc940=_0x3d7eaa?0x0:_0x3baeec[_0x5ad1('0x18')];var _0x9d84a8=_0x3d7eaa?_0xb4272f[_0x5ad1('0x1a')]:_0x3baeec['offset']+_0x3baeec['limit'];var _0xbc7807;if(_0x9d84a8>=_0x1e7972){_0x9d84a8=_0x1e7972;_0xbc7807=0xc8;}else{_0xbc7807=0xce;}_0x28ab7b[_0x5ad1('0x16')](_0xbc7807);return _0x28ab7b['set']('Content-Range',_0x2cc940+'-'+_0x9d84a8+'/'+_0x1e7972)['json'](_0xb4272f);}return null;};}function patchUpdates(_0xc4ad5b){return function(_0x371ed1){try{jsonpatch[_0x5ad1('0x1b')](_0x371ed1,_0xc4ad5b,!![]);}catch(_0x54e8ff){return BPromise[_0x5ad1('0x1c')](_0x54e8ff);}return _0x371ed1[_0x5ad1('0x1d')]();};}function saveUpdates(_0x496263,_0xe045af){return function(_0x5ba348){if(_0x5ba348){return _0x5ba348[_0x5ad1('0x1e')](_0x496263)[_0x5ad1('0x1f')](function(_0x577530){return _0x577530;});}return null;};}function removeEntity(_0x2df109,_0x1db620){return function(_0xe9ffe6){if(_0xe9ffe6){return _0xe9ffe6[_0x5ad1('0x20')]()['then'](function(){_0x2df109[_0x5ad1('0x16')](0xcc)[_0x5ad1('0x15')]();});}};}function handleEntityNotFound(_0x28be24,_0x4cd238){return function(_0x5ebaec){if(!_0x5ebaec){_0x28be24[_0x5ad1('0x21')](0x194);}return _0x5ebaec;};}function handleError(_0x4e9ab3,_0x5b0d98){_0x5b0d98=_0x5b0d98||0x1f4;return function(_0x3e0db2){logger[_0x5ad1('0x22')](_0x3e0db2[_0x5ad1('0x23')]);if(_0x3e0db2[_0x5ad1('0x24')]){delete _0x3e0db2[_0x5ad1('0x24')];}_0x4e9ab3[_0x5ad1('0x16')](_0x5b0d98)['send'](_0x3e0db2);};}exports[_0x5ad1('0x25')]=function(_0x399507,_0x55d85c){var _0x513739={},_0x5a3fe1={},_0x20bb18={'count':0x0,'rows':[]};var _0xabc541=_[_0x5ad1('0x26')](db[_0x5ad1('0x27')][_0x5ad1('0x28')],function(_0x5ed37e){return{'name':_0x5ed37e[_0x5ad1('0x29')],'type':_0x5ed37e['type'][_0x5ad1('0x2a')]};});_0x5a3fe1[_0x5ad1('0x2b')]=_[_0x5ad1('0x26')](_0xabc541,_0x5ad1('0x24'));_0x5a3fe1[_0x5ad1('0x2c')]=_[_0x5ad1('0x2d')](_0x399507['query']);_0x5a3fe1[_0x5ad1('0x2e')]=_[_0x5ad1('0x2f')](_0x5a3fe1['model'],_0x5a3fe1['query']);_0x513739[_0x5ad1('0x30')]=_[_0x5ad1('0x2f')](_0x5a3fe1[_0x5ad1('0x2b')],qs[_0x5ad1('0x31')](_0x399507[_0x5ad1('0x2c')][_0x5ad1('0x31')]));_0x513739[_0x5ad1('0x30')]=_0x513739[_0x5ad1('0x30')][_0x5ad1('0x32')]?_0x513739[_0x5ad1('0x30')]:_0x5a3fe1[_0x5ad1('0x2b')];if(!_0x399507[_0x5ad1('0x2c')][_0x5ad1('0x33')](_0x5ad1('0x34'))){_0x513739['limit']=qs[_0x5ad1('0x19')](_0x399507[_0x5ad1('0x2c')][_0x5ad1('0x19')]);_0x513739[_0x5ad1('0x18')]=qs[_0x5ad1('0x18')](_0x399507[_0x5ad1('0x2c')][_0x5ad1('0x18')]);}_0x513739[_0x5ad1('0x35')]=qs[_0x5ad1('0x36')](_0x399507[_0x5ad1('0x2c')][_0x5ad1('0x36')]);_0x513739['where']=qs[_0x5ad1('0x2e')](_[_0x5ad1('0x37')](_0x399507[_0x5ad1('0x2c')],_0x5a3fe1[_0x5ad1('0x2e')]),_0xabc541);if(_0x399507['query'][_0x5ad1('0x38')]){_0x513739[_0x5ad1('0x39')]=_[_0x5ad1('0x3a')](_0x513739[_0x5ad1('0x39')],{'$or':_['map'](_0xabc541,function(_0x5c1351){if(_0x5c1351[_0x5ad1('0x3b')]!==_0x5ad1('0x3c')){var _0x181f08={};_0x181f08[_0x5c1351[_0x5ad1('0x24')]]={'$like':'%'+_0x399507[_0x5ad1('0x2c')][_0x5ad1('0x38')]+'%'};return _0x181f08;}})});}_0x513739=_[_0x5ad1('0x3a')]({},_0x513739,_0x399507[_0x5ad1('0x3d')]);var _0x3f95a1={'where':_0x513739[_0x5ad1('0x39')]};return db['FreshsalesField'][_0x5ad1('0x1a')](_0x3f95a1)[_0x5ad1('0x1f')](function(_0x63cf37){_0x20bb18[_0x5ad1('0x1a')]=_0x63cf37;if(_0x399507[_0x5ad1('0x2c')][_0x5ad1('0x3e')]){_0x513739[_0x5ad1('0x3f')]=[{'all':!![]}];}return db[_0x5ad1('0x27')][_0x5ad1('0x40')](_0x513739);})[_0x5ad1('0x1f')](function(_0x31b113){_0x20bb18[_0x5ad1('0x41')]=_0x31b113;return _0x20bb18;})[_0x5ad1('0x1f')](respondWithFilteredResult(_0x55d85c,_0x513739))[_0x5ad1('0x42')](handleError(_0x55d85c,null));};exports['show']=function(_0x4c7274,_0x344d12){var _0x7ff954={'raw':!![],'where':{'id':_0x4c7274['params']['id']}},_0x3fa377={};_0x3fa377[_0x5ad1('0x2b')]=_[_0x5ad1('0x2d')](db[_0x5ad1('0x27')][_0x5ad1('0x28')]);_0x3fa377[_0x5ad1('0x2c')]=_['keys'](_0x4c7274[_0x5ad1('0x2c')]);_0x3fa377[_0x5ad1('0x2e')]=_[_0x5ad1('0x2f')](_0x3fa377[_0x5ad1('0x2b')],_0x3fa377['query']);_0x7ff954['attributes']=_['intersection'](_0x3fa377[_0x5ad1('0x2b')],qs['fields'](_0x4c7274[_0x5ad1('0x2c')][_0x5ad1('0x31')]));_0x7ff954[_0x5ad1('0x30')]=_0x7ff954[_0x5ad1('0x30')][_0x5ad1('0x32')]?_0x7ff954['attributes']:_0x3fa377[_0x5ad1('0x2b')];if(_0x4c7274['query']['includeAll']){_0x7ff954[_0x5ad1('0x3f')]=[{'all':!![]}];}_0x7ff954=_[_0x5ad1('0x3a')]({},_0x7ff954,_0x4c7274[_0x5ad1('0x3d')]);return db[_0x5ad1('0x27')][_0x5ad1('0x43')](_0x7ff954)[_0x5ad1('0x1f')](handleEntityNotFound(_0x344d12,null))[_0x5ad1('0x1f')](respondWithResult(_0x344d12,null))[_0x5ad1('0x42')](handleError(_0x344d12,null));};exports[_0x5ad1('0x44')]=function(_0x189b38,_0x46e9f3){return db[_0x5ad1('0x27')][_0x5ad1('0x44')](_0x189b38[_0x5ad1('0x45')],{})[_0x5ad1('0x1f')](respondWithResult(_0x46e9f3,0xc9))[_0x5ad1('0x42')](handleError(_0x46e9f3,null));};exports[_0x5ad1('0x1e')]=function(_0x335cc3,_0x1578ea){if(_0x335cc3[_0x5ad1('0x45')]['id']){delete _0x335cc3['body']['id'];}return db[_0x5ad1('0x27')][_0x5ad1('0x43')]({'where':{'id':_0x335cc3[_0x5ad1('0x46')]['id']}})['then'](handleEntityNotFound(_0x1578ea,null))[_0x5ad1('0x1f')](saveUpdates(_0x335cc3[_0x5ad1('0x45')],null))[_0x5ad1('0x1f')](respondWithResult(_0x1578ea,null))[_0x5ad1('0x42')](handleError(_0x1578ea,null));};exports[_0x5ad1('0x20')]=function(_0x1c628d,_0x54a9d9){return db[_0x5ad1('0x27')][_0x5ad1('0x43')]({'where':{'id':_0x1c628d[_0x5ad1('0x46')]['id']}})[_0x5ad1('0x1f')](handleEntityNotFound(_0x54a9d9,null))[_0x5ad1('0x1f')](removeEntity(_0x54a9d9,null))[_0x5ad1('0x42')](handleError(_0x54a9d9,null));}; \ No newline at end of file +var _0xbb03=['send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','rimraf','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name'];(function(_0xa41818,_0x346292){var _0x2e8ae6=function(_0x5b895f){while(--_0x5b895f){_0xa41818['push'](_0xa41818['shift']());}};_0x2e8ae6(++_0x346292);}(_0xbb03,0xb5));var _0x3bb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbb03[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bb0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bb0('0x1'));var moment=require(_0x3bb0('0x2'));var BPromise=require(_0x3bb0('0x3'));var Mustache=require('mustache');var util=require(_0x3bb0('0x4'));var path=require(_0x3bb0('0x5'));var sox=require(_0x3bb0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bb0('0x7'));var _=require(_0x3bb0('0x8'));var squel=require(_0x3bb0('0x9'));var crypto=require(_0x3bb0('0xa'));var jsforce=require(_0x3bb0('0xb'));var deskjs=require(_0x3bb0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3bb0('0xd'));var Papa=require(_0x3bb0('0xe'));var Redis=require(_0x3bb0('0xf'));var authService=require(_0x3bb0('0x10'));var qs=require(_0x3bb0('0x11'));var as=require(_0x3bb0('0x12'));var hardwareService=require(_0x3bb0('0x13'));var logger=require(_0x3bb0('0x14'))(_0x3bb0('0x15'));var utils=require(_0x3bb0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3bb0('0x17'));var db=require(_0x3bb0('0x18'))['db'];function respondWithStatusCode(_0x5cfa5,_0x50f69b){_0x50f69b=_0x50f69b||0xcc;return function(_0x38f8d0){if(_0x38f8d0){return _0x5cfa5[_0x3bb0('0x19')](_0x50f69b);}return _0x5cfa5[_0x3bb0('0x1a')](_0x50f69b)[_0x3bb0('0x1b')]();};}function respondWithResult(_0x3dde11,_0x51f252){_0x51f252=_0x51f252||0xc8;return function(_0x467eb1){if(_0x467eb1){return _0x3dde11['status'](_0x51f252)[_0x3bb0('0x1c')](_0x467eb1);}};}function respondWithFilteredResult(_0x48bc7d,_0x479012){return function(_0x83b4dd){if(_0x83b4dd){var _0x818478=typeof _0x479012[_0x3bb0('0x1d')]===_0x3bb0('0x1e')&&typeof _0x479012[_0x3bb0('0x1f')]===_0x3bb0('0x1e');var _0x338a9f=_0x83b4dd[_0x3bb0('0x20')];var _0x2e387f=_0x818478?0x0:_0x479012[_0x3bb0('0x1d')];var _0x2ae503=_0x818478?_0x83b4dd[_0x3bb0('0x20')]:_0x479012[_0x3bb0('0x1d')]+_0x479012[_0x3bb0('0x1f')];var _0x270fff;if(_0x2ae503>=_0x338a9f){_0x2ae503=_0x338a9f;_0x270fff=0xc8;}else{_0x270fff=0xce;}_0x48bc7d['status'](_0x270fff);return _0x48bc7d[_0x3bb0('0x21')](_0x3bb0('0x22'),_0x2e387f+'-'+_0x2ae503+'/'+_0x338a9f)['json'](_0x83b4dd);}return null;};}function patchUpdates(_0x3e9d44){return function(_0x2df900){try{jsonpatch['apply'](_0x2df900,_0x3e9d44,!![]);}catch(_0x230109){return BPromise['reject'](_0x230109);}return _0x2df900[_0x3bb0('0x23')]();};}function saveUpdates(_0x227ed3,_0x178ba6){return function(_0x23782c){if(_0x23782c){return _0x23782c['update'](_0x227ed3)[_0x3bb0('0x24')](function(_0x18f6ad){return _0x18f6ad;});}return null;};}function removeEntity(_0x3b447e,_0x30ec27){return function(_0x2a7868){if(_0x2a7868){return _0x2a7868[_0x3bb0('0x25')]()[_0x3bb0('0x24')](function(){_0x3b447e[_0x3bb0('0x1a')](0xcc)[_0x3bb0('0x1b')]();});}};}function handleEntityNotFound(_0x5607e1,_0x488f27){return function(_0x415dab){if(!_0x415dab){_0x5607e1[_0x3bb0('0x19')](0x194);}return _0x415dab;};}function handleError(_0x454cc3,_0x2d9e27){_0x2d9e27=_0x2d9e27||0x1f4;return function(_0x37159b){logger[_0x3bb0('0x26')](_0x37159b[_0x3bb0('0x27')]);if(_0x37159b[_0x3bb0('0x28')]){delete _0x37159b[_0x3bb0('0x28')];}_0x454cc3[_0x3bb0('0x1a')](_0x2d9e27)[_0x3bb0('0x29')](_0x37159b);};}exports['index']=function(_0x5e0510,_0x1e9e48){var _0x1eadd3={},_0x498aaa={},_0x17a630={'count':0x0,'rows':[]};var _0x349536=_[_0x3bb0('0x2a')](db[_0x3bb0('0x2b')][_0x3bb0('0x2c')],function(_0xd127d8){return{'name':_0xd127d8[_0x3bb0('0x2d')],'type':_0xd127d8[_0x3bb0('0x2e')][_0x3bb0('0x2f')]};});_0x498aaa[_0x3bb0('0x30')]=_[_0x3bb0('0x2a')](_0x349536,'name');_0x498aaa[_0x3bb0('0x31')]=_[_0x3bb0('0x32')](_0x5e0510['query']);_0x498aaa[_0x3bb0('0x33')]=_[_0x3bb0('0x34')](_0x498aaa[_0x3bb0('0x30')],_0x498aaa[_0x3bb0('0x31')]);_0x1eadd3[_0x3bb0('0x35')]=_[_0x3bb0('0x34')](_0x498aaa[_0x3bb0('0x30')],qs[_0x3bb0('0x36')](_0x5e0510[_0x3bb0('0x31')][_0x3bb0('0x36')]));_0x1eadd3[_0x3bb0('0x35')]=_0x1eadd3[_0x3bb0('0x35')]['length']?_0x1eadd3[_0x3bb0('0x35')]:_0x498aaa[_0x3bb0('0x30')];if(!_0x5e0510['query']['hasOwnProperty']('nolimit')){_0x1eadd3[_0x3bb0('0x1f')]=qs[_0x3bb0('0x1f')](_0x5e0510[_0x3bb0('0x31')]['limit']);_0x1eadd3[_0x3bb0('0x1d')]=qs[_0x3bb0('0x1d')](_0x5e0510[_0x3bb0('0x31')][_0x3bb0('0x1d')]);}_0x1eadd3[_0x3bb0('0x37')]=qs[_0x3bb0('0x38')](_0x5e0510[_0x3bb0('0x31')][_0x3bb0('0x38')]);_0x1eadd3[_0x3bb0('0x39')]=qs[_0x3bb0('0x33')](_[_0x3bb0('0x3a')](_0x5e0510[_0x3bb0('0x31')],_0x498aaa[_0x3bb0('0x33')]),_0x349536);if(_0x5e0510['query'][_0x3bb0('0x3b')]){_0x1eadd3[_0x3bb0('0x39')]=_[_0x3bb0('0x3c')](_0x1eadd3[_0x3bb0('0x39')],{'$or':_[_0x3bb0('0x2a')](_0x349536,function(_0x51be38){if(_0x51be38['type']!=='VIRTUAL'){var _0x131d52={};_0x131d52[_0x51be38[_0x3bb0('0x28')]]={'$like':'%'+_0x5e0510[_0x3bb0('0x31')][_0x3bb0('0x3b')]+'%'};return _0x131d52;}})});}_0x1eadd3=_[_0x3bb0('0x3c')]({},_0x1eadd3,_0x5e0510[_0x3bb0('0x3d')]);var _0x585015={'where':_0x1eadd3[_0x3bb0('0x39')]};return db[_0x3bb0('0x2b')][_0x3bb0('0x20')](_0x585015)['then'](function(_0x1d454d){_0x17a630[_0x3bb0('0x20')]=_0x1d454d;if(_0x5e0510[_0x3bb0('0x31')][_0x3bb0('0x3e')]){_0x1eadd3[_0x3bb0('0x3f')]=[{'all':!![]}];}return db[_0x3bb0('0x2b')][_0x3bb0('0x40')](_0x1eadd3);})['then'](function(_0x3fa75b){_0x17a630[_0x3bb0('0x41')]=_0x3fa75b;return _0x17a630;})[_0x3bb0('0x24')](respondWithFilteredResult(_0x1e9e48,_0x1eadd3))[_0x3bb0('0x42')](handleError(_0x1e9e48,null));};exports[_0x3bb0('0x43')]=function(_0x4513e5,_0x24fcac){var _0x10be2f={'raw':!![],'where':{'id':_0x4513e5['params']['id']}},_0x4bd641={};_0x4bd641['model']=_['keys'](db[_0x3bb0('0x2b')][_0x3bb0('0x2c')]);_0x4bd641[_0x3bb0('0x31')]=_['keys'](_0x4513e5['query']);_0x4bd641['filters']=_[_0x3bb0('0x34')](_0x4bd641[_0x3bb0('0x30')],_0x4bd641[_0x3bb0('0x31')]);_0x10be2f[_0x3bb0('0x35')]=_[_0x3bb0('0x34')](_0x4bd641[_0x3bb0('0x30')],qs[_0x3bb0('0x36')](_0x4513e5['query']['fields']));_0x10be2f['attributes']=_0x10be2f['attributes'][_0x3bb0('0x44')]?_0x10be2f[_0x3bb0('0x35')]:_0x4bd641[_0x3bb0('0x30')];if(_0x4513e5[_0x3bb0('0x31')][_0x3bb0('0x3e')]){_0x10be2f[_0x3bb0('0x3f')]=[{'all':!![]}];}_0x10be2f=_[_0x3bb0('0x3c')]({},_0x10be2f,_0x4513e5[_0x3bb0('0x3d')]);return db[_0x3bb0('0x2b')][_0x3bb0('0x45')](_0x10be2f)[_0x3bb0('0x24')](handleEntityNotFound(_0x24fcac,null))[_0x3bb0('0x24')](respondWithResult(_0x24fcac,null))[_0x3bb0('0x42')](handleError(_0x24fcac,null));};exports['create']=function(_0x2638ad,_0x5e46e1){return db[_0x3bb0('0x2b')][_0x3bb0('0x46')](_0x2638ad[_0x3bb0('0x47')],{})[_0x3bb0('0x24')](respondWithResult(_0x5e46e1,0xc9))['catch'](handleError(_0x5e46e1,null));};exports[_0x3bb0('0x48')]=function(_0x213515,_0x2cd868){if(_0x213515['body']['id']){delete _0x213515[_0x3bb0('0x47')]['id'];}return db[_0x3bb0('0x2b')][_0x3bb0('0x45')]({'where':{'id':_0x213515[_0x3bb0('0x49')]['id']}})[_0x3bb0('0x24')](handleEntityNotFound(_0x2cd868,null))[_0x3bb0('0x24')](saveUpdates(_0x213515[_0x3bb0('0x47')],null))[_0x3bb0('0x24')](respondWithResult(_0x2cd868,null))[_0x3bb0('0x42')](handleError(_0x2cd868,null));};exports['destroy']=function(_0x4c4545,_0x335a5c){return db[_0x3bb0('0x2b')][_0x3bb0('0x45')]({'where':{'id':_0x4c4545[_0x3bb0('0x49')]['id']}})[_0x3bb0('0x24')](handleEntityNotFound(_0x335a5c,null))['then'](removeEntity(_0x335a5c,null))[_0x3bb0('0x42')](handleError(_0x335a5c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 90874eb..19de8f8 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 _0x1c2e=['./intFreshsalesField.attributes','define','FreshsalesField','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1c2e,0x186));var _0xe1c2=function(_0x3d7978,_0x59f051){_0x3d7978=_0x3d7978-0x0;var _0x33dd50=_0x1c2e[_0x3d7978];return _0x33dd50;};'use strict';var _=require('lodash');var util=require(_0xe1c2('0x0'));var logger=require(_0xe1c2('0x1'))('api');var moment=require(_0xe1c2('0x2'));var BPromise=require(_0xe1c2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1c2('0x4'));var rimraf=require('rimraf');var config=require(_0xe1c2('0x5'));var attributes=require(_0xe1c2('0x6'));module['exports']=function(_0x564500,_0x1cf122){return _0x564500[_0xe1c2('0x7')](_0xe1c2('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3514=['../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x1464f0,_0x538e3c){var _0x3c8cd2=function(_0x3e240d){while(--_0x3e240d){_0x1464f0['push'](_0x1464f0['shift']());}};_0x3c8cd2(++_0x538e3c);}(_0x3514,0x1db));var _0x4351=function(_0x341bf7,_0x2f76d3){_0x341bf7=_0x341bf7-0x0;var _0x3cf419=_0x3514[_0x341bf7];return _0x3cf419;};'use strict';var _=require(_0x4351('0x0'));var util=require(_0x4351('0x1'));var logger=require(_0x4351('0x2'))('api');var moment=require(_0x4351('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4351('0x4'));var rimraf=require(_0x4351('0x5'));var config=require(_0x4351('0x6'));var attributes=require(_0x4351('0x7'));module['exports']=function(_0x56baeb,_0x3f0aec){return _0x56baeb[_0x4351('0x8')](_0x4351('0x9'),attributes,{'tableName':_0x4351('0xa'),'paranoid':![],'indexes':[{'name':_0x4351('0xb'),'fields':['idField',_0x4351('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 780c0d1..de581d3 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 _0x1d89=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5eb545,_0x2b0213){var _0x566aa3=function(_0x296898){while(--_0x296898){_0x5eb545['push'](_0x5eb545['shift']());}};_0x566aa3(++_0x2b0213);}(_0x1d89,0x179));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91d8('0x0'));var util=require(_0x91d8('0x1'));var moment=require(_0x91d8('0x2'));var BPromise=require(_0x91d8('0x3'));var rs=require(_0x91d8('0x4'));var fs=require('fs');var Redis=require(_0x91d8('0x5'));var db=require(_0x91d8('0x6'))['db'];var utils=require(_0x91d8('0x7'));var logger=require('../../config/logger')(_0x91d8('0x8'));var config=require(_0x91d8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x91d8('0xa')][_0x91d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5079f1,_0x2e8b3a,_0xaa684d){return new BPromise(function(_0x3cb587,_0x169136){return client[_0x91d8('0xc')](_0x5079f1,_0xaa684d)[_0x91d8('0xd')](function(_0x43ee7d){logger[_0x91d8('0xe')](_0x91d8('0xf'),_0x2e8b3a,_0x91d8('0x10'));logger[_0x91d8('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2e8b3a,_0x91d8('0x10'),JSON[_0x91d8('0x12')](_0x43ee7d));if(_0x43ee7d[_0x91d8('0x13')]){if(_0x43ee7d[_0x91d8('0x13')][_0x91d8('0x14')]===0x1f4){logger[_0x91d8('0x13')](_0x91d8('0xf'),_0x2e8b3a,_0x43ee7d[_0x91d8('0x13')][_0x91d8('0x15')]);return _0x169136(_0x43ee7d['error'][_0x91d8('0x15')]);}logger[_0x91d8('0x13')](_0x91d8('0xf'),_0x2e8b3a,_0x43ee7d['error'][_0x91d8('0x15')]);return _0x3cb587(_0x43ee7d[_0x91d8('0x13')][_0x91d8('0x15')]);}else{logger[_0x91d8('0xe')](_0x91d8('0xf'),_0x2e8b3a,_0x91d8('0x10'));_0x3cb587(_0x43ee7d[_0x91d8('0x16')]['message']);}})[_0x91d8('0x17')](function(_0x464171){logger[_0x91d8('0x13')](_0x91d8('0xf'),_0x2e8b3a,_0x464171);_0x169136(_0x464171);});});} \ No newline at end of file +var _0xdb67=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdb67,0x15b));var _0x7db6=function(_0x5337d3,_0x1401c7){_0x5337d3=_0x5337d3-0x0;var _0x461aa4=_0xdb67[_0x5337d3];return _0x461aa4;};'use strict';var _=require('lodash');var util=require(_0x7db6('0x0'));var moment=require(_0x7db6('0x1'));var BPromise=require(_0x7db6('0x2'));var rs=require(_0x7db6('0x3'));var fs=require('fs');var Redis=require(_0x7db6('0x4'));var db=require(_0x7db6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7db6('0x6'));var config=require(_0x7db6('0x7'));var jayson=require(_0x7db6('0x8'));var client=jayson[_0x7db6('0x9')][_0x7db6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387866,_0x470fa8,_0x444638){return new BPromise(function(_0x13311a,_0x4512db){return client[_0x7db6('0xb')](_0x387866,_0x444638)[_0x7db6('0xc')](function(_0x31bdaf){logger[_0x7db6('0xd')](_0x7db6('0xe'),_0x470fa8,_0x7db6('0xf'));logger[_0x7db6('0x10')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x470fa8,_0x7db6('0xf'),JSON['stringify'](_0x31bdaf));if(_0x31bdaf['error']){if(_0x31bdaf[_0x7db6('0x11')]['code']===0x1f4){logger[_0x7db6('0x11')](_0x7db6('0xe'),_0x470fa8,_0x31bdaf[_0x7db6('0x11')]['message']);return _0x4512db(_0x31bdaf[_0x7db6('0x11')][_0x7db6('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x470fa8,_0x31bdaf[_0x7db6('0x11')][_0x7db6('0x12')]);return _0x13311a(_0x31bdaf[_0x7db6('0x11')][_0x7db6('0x12')]);}else{logger[_0x7db6('0xd')](_0x7db6('0xe'),_0x470fa8,_0x7db6('0xf'));_0x13311a(_0x31bdaf['result']['message']);}})[_0x7db6('0x13')](function(_0x4924f2){logger[_0x7db6('0x11')](_0x7db6('0xe'),_0x470fa8,_0x4924f2);_0x4512db(_0x4924f2);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a5feb02..a0abac7 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 _0x63a2=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x63a2,0x14d));var _0x263a=function(_0x3802cd,_0x15acd9){_0x3802cd=_0x3802cd-0x0;var _0x21dd68=_0x63a2[_0x3802cd];return _0x21dd68;};'use strict';var multer=require(_0x263a('0x0'));var util=require(_0x263a('0x1'));var path=require(_0x263a('0x2'));var timeout=require(_0x263a('0x3'));var express=require('express');var router=express[_0x263a('0x4')]();var fs_extra=require(_0x263a('0x5'));var auth=require(_0x263a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x263a('0x7'));var controller=require(_0x263a('0x8'));router[_0x263a('0x9')]('/',auth['isAuthenticated'](),controller[_0x263a('0xa')]);router['get'](_0x263a('0xb'),auth[_0x263a('0xc')](),controller[_0x263a('0xd')]);router[_0x263a('0x9')](_0x263a('0xe'),auth[_0x263a('0xc')](),controller[_0x263a('0xf')]);router[_0x263a('0x9')](_0x263a('0x10'),auth[_0x263a('0xc')](),controller[_0x263a('0x11')]);router[_0x263a('0x12')]('/',auth[_0x263a('0xc')](),controller[_0x263a('0x13')]);router[_0x263a('0x12')](_0x263a('0xe'),auth[_0x263a('0xc')](),controller['addConfiguration']);router[_0x263a('0x14')](_0x263a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x263a('0x15')](_0x263a('0xb'),auth[_0x263a('0xc')](),controller['destroy']);module[_0x263a('0x16')]=router; \ No newline at end of file +var _0xbad7=['../../components/interaction/service','./intSalesforceAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3caa80,_0x128fdc){var _0x2e7db4=function(_0x7e94ad){while(--_0x7e94ad){_0x3caa80['push'](_0x3caa80['shift']());}};_0x2e7db4(++_0x128fdc);}(_0xbad7,0x1dd));var _0x7bad=function(_0x40cd61,_0x36162c){_0x40cd61=_0x40cd61-0x0;var _0x120ce8=_0xbad7[_0x40cd61];return _0x120ce8;};'use strict';var multer=require(_0x7bad('0x0'));var util=require(_0x7bad('0x1'));var path=require(_0x7bad('0x2'));var timeout=require(_0x7bad('0x3'));var express=require(_0x7bad('0x4'));var router=express['Router']();var fs_extra=require(_0x7bad('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7bad('0x6'));var config=require('../../config/environment');var controller=require(_0x7bad('0x7'));router[_0x7bad('0x8')]('/',auth['isAuthenticated'](),controller[_0x7bad('0x9')]);router[_0x7bad('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7bad('0xa')]);router[_0x7bad('0x8')](_0x7bad('0xb'),auth[_0x7bad('0xc')](),controller[_0x7bad('0xd')]);router['get'](_0x7bad('0xe'),auth[_0x7bad('0xc')](),controller['getFields']);router[_0x7bad('0xf')]('/',auth['isAuthenticated'](),controller[_0x7bad('0x10')]);router[_0x7bad('0xf')](_0x7bad('0xb'),auth[_0x7bad('0xc')](),controller['addConfiguration']);router['put'](_0x7bad('0x11'),auth[_0x7bad('0xc')](),controller[_0x7bad('0x12')]);router[_0x7bad('0x13')]('/:id',auth[_0x7bad('0xc')](),controller[_0x7bad('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 0d23f2f..c414026 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 _0x79d4=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x4e6975,_0x124473){var _0xea3fbf=function(_0x418860){while(--_0x418860){_0x4e6975['push'](_0x4e6975['shift']());}};_0xea3fbf(++_0x124473);}(_0x79d4,0x13e));var _0x479d=function(_0x484344,_0x233983){_0x484344=_0x484344-0x0;var _0x10e6e7=_0x79d4[_0x484344];return _0x10e6e7;};'use strict';var Sequelize=require(_0x479d('0x0'));module[_0x479d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x479d('0x2')]},'username':{'type':Sequelize[_0x479d('0x2')],'unique':_0x479d('0x3')},'remoteUri':{'type':Sequelize[_0x479d('0x2')]},'password':{'type':Sequelize[_0x479d('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x479d('0x2')]},'securityToken':{'type':Sequelize[_0x479d('0x2')]},'serverUrl':{'type':Sequelize[_0x479d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x479d('0x4')]('integrationTab',_0x479d('0x5')),'defaultValue':_0x479d('0x6')}}; \ No newline at end of file +var _0x8ec5=['username','integrationTab','newTab','sequelize','STRING'];(function(_0x48a426,_0x23f35c){var _0x21abb1=function(_0xfc0c6c){while(--_0xfc0c6c){_0x48a426['push'](_0x48a426['shift']());}};_0x21abb1(++_0x23f35c);}(_0x8ec5,0x152));var _0x58ec=function(_0x2dd6e3,_0x30117c){_0x2dd6e3=_0x2dd6e3-0x0;var _0x437a03=_0x8ec5[_0x2dd6e3];return _0x437a03;};'use strict';var Sequelize=require(_0x58ec('0x0'));module['exports']={'name':{'type':Sequelize[_0x58ec('0x1')]},'description':{'type':Sequelize[_0x58ec('0x1')]},'username':{'type':Sequelize[_0x58ec('0x1')],'unique':_0x58ec('0x2')},'remoteUri':{'type':Sequelize[_0x58ec('0x1')]},'password':{'type':Sequelize[_0x58ec('0x1')]},'clientId':{'type':Sequelize[_0x58ec('0x1')]},'clientSecret':{'type':Sequelize[_0x58ec('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x58ec('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x58ec('0x3'),_0x58ec('0x4')),'defaultValue':_0x58ec('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b23f98a..7e4ccfb 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 _0x8109=['clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','status','undefined','count','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','include','find','create','body','destroy','getConfigurations','hasOwnProperty','addConfiguration','Subjects','getDescriptions','channel','SalesforceField','Descriptions','getFields','Task','findOne','remoteUri'];(function(_0x208c6b,_0x47b4b8){var _0x479ce9=function(_0x1eb6d1){while(--_0x1eb6d1){_0x208c6b['push'](_0x208c6b['shift']());}};_0x479ce9(++_0x47b4b8);}(_0x8109,0xa9));var _0x9810=function(_0x5390ce,_0x2f312f){_0x5390ce=_0x5390ce-0x0;var _0x31adcb=_0x8109[_0x5390ce];return _0x31adcb;};'use strict';var emlformat=require(_0x9810('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9810('0x1'));var jsonpatch=require(_0x9810('0x2'));var rp=require('request-promise');var moment=require(_0x9810('0x3'));var BPromise=require(_0x9810('0x4'));var Mustache=require(_0x9810('0x5'));var util=require(_0x9810('0x6'));var path=require(_0x9810('0x7'));var sox=require(_0x9810('0x8'));var csv=require(_0x9810('0x9'));var ejs=require(_0x9810('0xa'));var fs=require('fs');var fs_extra=require(_0x9810('0xb'));var _=require(_0x9810('0xc'));var squel=require(_0x9810('0xd'));var crypto=require('crypto');var jsforce=require(_0x9810('0xe'));var deskjs=require(_0x9810('0xf'));var toCsv=require(_0x9810('0x9'));var querystring=require(_0x9810('0x10'));var Papa=require(_0x9810('0x11'));var Redis=require('ioredis');var authService=require(_0x9810('0x12'));var qs=require(_0x9810('0x13'));var as=require(_0x9810('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9810('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9810('0x16'));var licenseUtil=require(_0x9810('0x17'));var db=require(_0x9810('0x18'))['db'];var integrations=require(_0x9810('0x19'));var jayson=require(_0x9810('0x1a'));var client=jayson[_0x9810('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fc4af,_0x2a9aa5,_0x3c74b0,_0x2f6fc0){return new BPromise(function(_0x2d52b1,_0x333ad4){var _0x22366c=_0x2f6fc0||client;return _0x22366c['request'](_0x3fc4af,_0x3c74b0)[_0x9810('0x1c')](function(_0x1a4735){logger[_0x9810('0x1d')](_0x9810('0x1e'),_0x2a9aa5,'request\x20sent');logger['debug'](_0x9810('0x1f'),_0x2a9aa5,'request\x20sent',JSON['stringify'](_0x1a4735));if(_0x1a4735[_0x9810('0x20')]){if(_0x1a4735[_0x9810('0x20')][_0x9810('0x21')]===0x1f4){logger[_0x9810('0x20')](_0x9810('0x1e'),_0x2a9aa5,_0x1a4735[_0x9810('0x20')]['message']);return _0x333ad4(_0x1a4735['error']['message']);}logger[_0x9810('0x20')](_0x9810('0x1e'),_0x2a9aa5,_0x1a4735['error'][_0x9810('0x22')]);return _0x2d52b1(_0x1a4735[_0x9810('0x20')][_0x9810('0x22')]);}else{logger[_0x9810('0x1d')](_0x9810('0x1e'),_0x2a9aa5,_0x9810('0x23'));_0x2d52b1(_0x1a4735['result'][_0x9810('0x22')]);}})[_0x9810('0x24')](function(_0x5a777d){logger[_0x9810('0x20')](_0x9810('0x1e'),_0x2a9aa5,_0x5a777d);_0x333ad4(_0x5a777d);});});}function respondWithStatusCode(_0xadadda,_0x4bc29a){_0x4bc29a=_0x4bc29a||0xcc;return function(_0x44ea43){if(_0x44ea43){return _0xadadda['sendStatus'](_0x4bc29a);}return _0xadadda[_0x9810('0x25')](_0x4bc29a)['end']();};}function respondWithResult(_0x86f047,_0xc0de6c){_0xc0de6c=_0xc0de6c||0xc8;return function(_0x18b185){if(_0x18b185){return _0x86f047[_0x9810('0x25')](_0xc0de6c)['json'](_0x18b185);}};}function respondWithFilteredResult(_0x528da6,_0x539696){return function(_0x137b47){if(_0x137b47){var _0x2443c3=typeof _0x539696['offset']===_0x9810('0x26')&&typeof _0x539696['limit']==='undefined';var _0x13b6af=_0x137b47[_0x9810('0x27')];var _0x303727=_0x2443c3?0x0:_0x539696[_0x9810('0x28')];var _0x17f314=_0x2443c3?_0x137b47[_0x9810('0x27')]:_0x539696['offset']+_0x539696[_0x9810('0x29')];var _0xb5095f;if(_0x17f314>=_0x13b6af){_0x17f314=_0x13b6af;_0xb5095f=0xc8;}else{_0xb5095f=0xce;}_0x528da6[_0x9810('0x25')](_0xb5095f);return _0x528da6['set'](_0x9810('0x2a'),_0x303727+'-'+_0x17f314+'/'+_0x13b6af)['json'](_0x137b47);}return null;};}function patchUpdates(_0x3525f5){return function(_0x5d98cd){try{jsonpatch[_0x9810('0x2b')](_0x5d98cd,_0x3525f5,!![]);}catch(_0x167058){return BPromise[_0x9810('0x2c')](_0x167058);}return _0x5d98cd[_0x9810('0x2d')]();};}function saveUpdates(_0x304a05,_0x35cfb4){return function(_0x4b38d8){if(_0x4b38d8){return _0x4b38d8[_0x9810('0x2e')](_0x304a05)[_0x9810('0x1c')](function(_0x3a1b59){return _0x3a1b59;});}return null;};}function removeEntity(_0x3c11ae,_0x5bc796){return function(_0x4ea276){if(_0x4ea276){return _0x4ea276['destroy']()['then'](function(){_0x3c11ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4273b2,_0x9195db){return function(_0x22af12){if(!_0x22af12){_0x4273b2[_0x9810('0x2f')](0x194);}return _0x22af12;};}function handleError(_0x280ca1,_0x5e7a14){_0x5e7a14=_0x5e7a14||0x1f4;return function(_0x322e71){logger['error'](_0x322e71[_0x9810('0x30')]);if(_0x322e71[_0x9810('0x31')]){delete _0x322e71['name'];}_0x280ca1[_0x9810('0x25')](_0x5e7a14)[_0x9810('0x32')](_0x322e71);};}exports[_0x9810('0x33')]=function(_0x1883bf,_0x389444){var _0x3a62a6={},_0x4302ec={},_0x3aaf6b={'count':0x0,'rows':[]};var _0x39a01a=_['map'](db[_0x9810('0x34')][_0x9810('0x35')],function(_0x5751f8){return{'name':_0x5751f8[_0x9810('0x36')],'type':_0x5751f8[_0x9810('0x37')][_0x9810('0x38')]};});_0x4302ec[_0x9810('0x39')]=_[_0x9810('0x3a')](_0x39a01a,'name');_0x4302ec[_0x9810('0x3b')]=_[_0x9810('0x3c')](_0x1883bf[_0x9810('0x3b')]);_0x4302ec[_0x9810('0x3d')]=_[_0x9810('0x3e')](_0x4302ec[_0x9810('0x39')],_0x4302ec[_0x9810('0x3b')]);_0x3a62a6[_0x9810('0x3f')]=_[_0x9810('0x3e')](_0x4302ec[_0x9810('0x39')],qs[_0x9810('0x40')](_0x1883bf['query'][_0x9810('0x40')]));_0x3a62a6[_0x9810('0x3f')]=_0x3a62a6['attributes']['length']?_0x3a62a6[_0x9810('0x3f')]:_0x4302ec[_0x9810('0x39')];if(!_0x1883bf[_0x9810('0x3b')]['hasOwnProperty'](_0x9810('0x41'))){_0x3a62a6[_0x9810('0x29')]=qs[_0x9810('0x29')](_0x1883bf[_0x9810('0x3b')][_0x9810('0x29')]);_0x3a62a6[_0x9810('0x28')]=qs[_0x9810('0x28')](_0x1883bf[_0x9810('0x3b')][_0x9810('0x28')]);}_0x3a62a6[_0x9810('0x42')]=qs[_0x9810('0x43')](_0x1883bf[_0x9810('0x3b')]['sort']);_0x3a62a6['where']=qs[_0x9810('0x3d')](_[_0x9810('0x44')](_0x1883bf[_0x9810('0x3b')],_0x4302ec[_0x9810('0x3d')]),_0x39a01a);if(_0x1883bf[_0x9810('0x3b')]['filter']){_0x3a62a6[_0x9810('0x45')]=_[_0x9810('0x46')](_0x3a62a6['where'],{'$or':_[_0x9810('0x3a')](_0x39a01a,function(_0x46f144){if(_0x46f144[_0x9810('0x37')]!==_0x9810('0x47')){var _0x515d14={};_0x515d14[_0x46f144[_0x9810('0x31')]]={'$like':'%'+_0x1883bf[_0x9810('0x3b')][_0x9810('0x48')]+'%'};return _0x515d14;}})});}_0x3a62a6=_[_0x9810('0x46')]({},_0x3a62a6,_0x1883bf[_0x9810('0x49')]);var _0x16438a={'where':_0x3a62a6[_0x9810('0x45')]};return db[_0x9810('0x34')][_0x9810('0x27')](_0x16438a)[_0x9810('0x1c')](function(_0x2d0223){_0x3aaf6b[_0x9810('0x27')]=_0x2d0223;if(_0x1883bf[_0x9810('0x3b')][_0x9810('0x4a')]){_0x3a62a6['include']=[{'all':!![]}];}return db[_0x9810('0x34')][_0x9810('0x4b')](_0x3a62a6);})[_0x9810('0x1c')](function(_0x42db0a){_0x3aaf6b[_0x9810('0x4c')]=_0x42db0a;return _0x3aaf6b;})[_0x9810('0x1c')](respondWithFilteredResult(_0x389444,_0x3a62a6))[_0x9810('0x24')](handleError(_0x389444,null));};exports[_0x9810('0x4d')]=function(_0x1f4d1c,_0x46e69d){var _0x3289da={'raw':![],'where':{'id':_0x1f4d1c[_0x9810('0x4e')]['id']}},_0x80fc68={};_0x80fc68[_0x9810('0x39')]=_[_0x9810('0x3c')](db[_0x9810('0x34')][_0x9810('0x35')]);_0x80fc68[_0x9810('0x3b')]=_['keys'](_0x1f4d1c[_0x9810('0x3b')]);_0x80fc68[_0x9810('0x3d')]=_[_0x9810('0x3e')](_0x80fc68[_0x9810('0x39')],_0x80fc68[_0x9810('0x3b')]);_0x3289da['attributes']=_[_0x9810('0x3e')](_0x80fc68[_0x9810('0x39')],qs[_0x9810('0x40')](_0x1f4d1c[_0x9810('0x3b')]['fields']));_0x3289da[_0x9810('0x3f')]=_0x3289da[_0x9810('0x3f')][_0x9810('0x4f')]?_0x3289da['attributes']:_0x80fc68['model'];if(_0x1f4d1c[_0x9810('0x3b')][_0x9810('0x4a')]){_0x3289da[_0x9810('0x50')]=[{'all':!![]}];}_0x3289da=_[_0x9810('0x46')]({},_0x3289da,_0x1f4d1c[_0x9810('0x49')]);return db[_0x9810('0x34')][_0x9810('0x51')](_0x3289da)[_0x9810('0x1c')](handleEntityNotFound(_0x46e69d,null))['then'](respondWithResult(_0x46e69d,null))[_0x9810('0x24')](handleError(_0x46e69d,null));};exports[_0x9810('0x52')]=function(_0x2bdba7,_0x4d5bc6){return db['SalesforceAccount'][_0x9810('0x52')](_0x2bdba7['body'],{})[_0x9810('0x1c')](respondWithResult(_0x4d5bc6,0xc9))[_0x9810('0x24')](handleError(_0x4d5bc6,null));};exports[_0x9810('0x2e')]=function(_0x59b175,_0x4d5c8f){if(_0x59b175[_0x9810('0x53')]['id']){delete _0x59b175[_0x9810('0x53')]['id'];}return db[_0x9810('0x34')][_0x9810('0x51')]({'where':{'id':_0x59b175['params']['id']}})['then'](handleEntityNotFound(_0x4d5c8f,null))['then'](saveUpdates(_0x59b175[_0x9810('0x53')],null))[_0x9810('0x1c')](respondWithResult(_0x4d5c8f,null))['catch'](handleError(_0x4d5c8f,null));};exports[_0x9810('0x54')]=function(_0x3e68ed,_0x411fff){return db[_0x9810('0x34')][_0x9810('0x51')]({'where':{'id':_0x3e68ed['params']['id']}})[_0x9810('0x1c')](handleEntityNotFound(_0x411fff,null))[_0x9810('0x1c')](removeEntity(_0x411fff,null))[_0x9810('0x24')](handleError(_0x411fff,null));};exports[_0x9810('0x55')]=function(_0x30e39f,_0x232891,_0xdfa02){var _0x1c3d70={};var _0x5ceac9={};var _0x3fd52b;var _0x1b28a0;return db[_0x9810('0x34')]['findOne']({'where':{'id':_0x30e39f[_0x9810('0x4e')]['id']}})[_0x9810('0x1c')](handleEntityNotFound(_0x232891,null))[_0x9810('0x1c')](function(_0x835b2){if(_0x835b2){_0x3fd52b=_0x835b2;_0x5ceac9[_0x9810('0x39')]=_[_0x9810('0x3c')](db['SalesforceConfiguration'][_0x9810('0x35')]);_0x5ceac9[_0x9810('0x3b')]=_[_0x9810('0x3c')](_0x30e39f[_0x9810('0x3b')]);_0x5ceac9['filters']=_[_0x9810('0x3e')](_0x5ceac9['model'],_0x5ceac9[_0x9810('0x3b')]);_0x1c3d70[_0x9810('0x3f')]=_[_0x9810('0x3e')](_0x5ceac9[_0x9810('0x39')],qs[_0x9810('0x40')](_0x30e39f[_0x9810('0x3b')][_0x9810('0x40')]));_0x1c3d70[_0x9810('0x3f')]=_0x1c3d70[_0x9810('0x3f')][_0x9810('0x4f')]?_0x1c3d70['attributes']:_0x5ceac9[_0x9810('0x39')];_0x1c3d70['order']=qs[_0x9810('0x43')](_0x30e39f['query'][_0x9810('0x43')]);_0x1c3d70['where']=qs[_0x9810('0x3d')](_['pick'](_0x30e39f[_0x9810('0x3b')],_0x5ceac9['filters']));if(_0x30e39f[_0x9810('0x3b')][_0x9810('0x48')]){_0x1c3d70[_0x9810('0x45')]=_[_0x9810('0x46')](_0x1c3d70[_0x9810('0x45')],{'$or':_['map'](_0x1c3d70[_0x9810('0x3f')],function(_0x3ab40c){var _0x37ef75={};_0x37ef75[_0x3ab40c]={'$like':'%'+_0x30e39f['query']['filter']+'%'};return _0x37ef75;})});}_0x1c3d70=_[_0x9810('0x46')]({},_0x1c3d70,_0x30e39f[_0x9810('0x49')]);return _0x3fd52b['getConfigurations'](_0x1c3d70);}})[_0x9810('0x1c')](function(_0x44f1b1){if(_0x44f1b1){_0x1b28a0=_0x44f1b1['length'];if(!_0x30e39f[_0x9810('0x3b')][_0x9810('0x56')](_0x9810('0x41'))){_0x1c3d70[_0x9810('0x29')]=qs[_0x9810('0x29')](_0x30e39f[_0x9810('0x3b')]['limit']);_0x1c3d70[_0x9810('0x28')]=qs['offset'](_0x30e39f[_0x9810('0x3b')][_0x9810('0x28')]);}return _0x3fd52b[_0x9810('0x55')](_0x1c3d70);}})[_0x9810('0x1c')](function(_0x49867f){if(_0x49867f){return _0x49867f?{'count':_0x1b28a0,'rows':_0x49867f}:null;}})[_0x9810('0x1c')](respondWithResult(_0x232891,null))['catch'](handleError(_0x232891,null));};exports[_0x9810('0x57')]=function(_0x2190db,_0xa68085,_0x1abba9){if(_0x2190db[_0x9810('0x53')]['id']){delete _0x2190db[_0x9810('0x53')]['id'];}return db[_0x9810('0x34')]['findOne']({'where':{'id':_0x2190db['params']['id']}})[_0x9810('0x1c')](handleEntityNotFound(_0xa68085,null))['then'](function(_0x3027a4){if(_0x3027a4){_0x2190db['body']['AccountId']=_0x3027a4['id'];_0x2190db['body'][_0x9810('0x58')]=integrations['getSubjects'](_0x2190db[_0x9810('0x53')]['channel'],_0x2190db[_0x9810('0x53')][_0x9810('0x37')]);_0x2190db[_0x9810('0x53')]['Descriptions']=integrations[_0x9810('0x59')](_0x2190db['body'][_0x9810('0x5a')],_0x2190db['body'][_0x9810('0x37')]);return db['SalesforceConfiguration'][_0x9810('0x52')](_0x2190db['body'],{'include':[{'model':db['SalesforceField'],'as':_0x9810('0x58')},{'model':db[_0x9810('0x5b')],'as':_0x9810('0x5c')}]});}return null;})[_0x9810('0x1c')](respondWithResult(_0xa68085,null))['catch'](handleError(_0xa68085,null));};exports[_0x9810('0x5d')]=function(_0x227202,_0x280ef8,_0x33ce7d){var _0x21894b;var _0x25766b='';var _0x39e487=_0x9810('0x5e');return db[_0x9810('0x34')][_0x9810('0x5f')]({'where':{'id':_0x227202[_0x9810('0x4e')]['id']},'attributes':['id',_0x9810('0x60'),_0x9810('0x61'),_0x9810('0x62'),_0x9810('0x63'),_0x9810('0x64'),_0x9810('0x65')]})[_0x9810('0x1c')](handleEntityNotFound(_0x280ef8,null))[_0x9810('0x1c')](function(_0x2320ec){if(_0x2320ec){_0x25766b=_0x2320ec[_0x9810('0x60')];var _0x21921a=_0x25766b['slice'](-0x1);if(_0x21921a==='/'){_0x25766b=_0x25766b[_0x9810('0x66')](0x0,_0x25766b[_0x9810('0x67')](_0x21921a));}_0x21894b=new jsforce[(_0x9810('0x68'))]({'oauth2':{'loginUrl':_0x25766b,'clientId':_0x2320ec[_0x9810('0x61')],'clientSecret':_0x2320ec['clientSecret']}});return _0x21894b[_0x9810('0x69')](_0x2320ec[_0x9810('0x63')],_0x2320ec[_0x9810('0x64')][_0x9810('0x6a')](_0x2320ec['securityToken']));}})[_0x9810('0x1c')](function(_0xc3cfd1){if(_0xc3cfd1){if(!_[_0x9810('0x6b')](_0x227202['query']['ticketType'])){_0x39e487=_0x227202[_0x9810('0x3b')][_0x9810('0x6c')];}return _0x21894b[_0x9810('0x6d')](_0x39e487)[_0x9810('0x6e')]();}})[_0x9810('0x1c')](function(_0x12430f){var _0x2f83b7=['OwnerId',_0x9810('0x6f'),_0x9810('0x70'),_0x9810('0x71'),_0x9810('0x72'),'Description'];var _0x58847c=[_0x9810('0x73'),'int',_0x9810('0x74'),_0x9810('0x75'),_0x9810('0x76'),_0x9810('0x77'),_0x9810('0x78')];if(_0x12430f){_[_0x9810('0x79')](_0x12430f[_0x9810('0x40')],function(_0x5eb4e7){return _0x2f83b7['includes'](_0x5eb4e7[_0x9810('0x31')])||!_0x58847c[_0x9810('0x7a')](_0x5eb4e7[_0x9810('0x37')]);});return{'count':_0x12430f['fields'][_0x9810('0x4f')],'rows':_[_0x9810('0x3a')](_0x12430f['fields'],function(_0x153b1d){return{'id':_0x153b1d[_0x9810('0x31')],'name':_0x153b1d[_0x9810('0x7b')],'custom':_0x153b1d[_0x9810('0x7c')],'options':_0x153b1d['picklistValues'][_0x9810('0x4f')]>0x0?_[_0x9810('0x3a')](_0x153b1d[_0x9810('0x7d')],function(_0x2b20fe){return{'name':_0x2b20fe[_0x9810('0x7b')],'value':_0x2b20fe[_0x9810('0x7e')]};}):_0x153b1d[_0x9810('0x37')]==_0x9810('0x75')?[{'name':_0x9810('0x7f'),'value':'true'},{'name':'False','value':_0x9810('0x80')}]:[]};})};}})[_0x9810('0x1c')](respondWithResult(_0x280ef8,null))[_0x9810('0x24')](function(_0xaad956){var _0x40c9c8=_0x227202['query'][_0x9810('0x81')]?0x1f4:_0xaad956[_0x9810('0x82')]||0x1f4;logger['error'](_0x9810('0x83'),_0x9810('0x5d'),_0x40c9c8,JSON['stringify'](_0xaad956));delete _0xaad956['name'];if(_0x40c9c8===0x191){_0x40c9c8=0x190;}_0x280ef8['status'](_0x40c9c8)[_0x9810('0x32')](_0x227202[_0x9810('0x3b')][_0x9810('0x81')]?{'message':_0x9810('0x84'),'statusCode':_0xaad956[_0x9810('0x82')]}:_0xaad956);});}; \ No newline at end of file +var _0xfc75=['status','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','SalesforceAccount','rawAttributes','key','model','map','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getDescriptions','channel','SalesforceField','getFields','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','sendStatus','end'];(function(_0x56aab0,_0x4afd25){var _0xa15bf4=function(_0x499049){while(--_0x499049){_0x56aab0['push'](_0x56aab0['shift']());}};_0xa15bf4(++_0x4afd25);}(_0xfc75,0xe1));var _0x5fc7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfc75[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x5fc7('0x0'));var rimraf=require(_0x5fc7('0x1'));var zipdir=require(_0x5fc7('0x2'));var jsonpatch=require(_0x5fc7('0x3'));var rp=require(_0x5fc7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5fc7('0x5'));var util=require('util');var path=require(_0x5fc7('0x6'));var sox=require(_0x5fc7('0x7'));var csv=require(_0x5fc7('0x8'));var ejs=require(_0x5fc7('0x9'));var fs=require('fs');var fs_extra=require(_0x5fc7('0xa'));var _=require('lodash');var squel=require(_0x5fc7('0xb'));var crypto=require('crypto');var jsforce=require(_0x5fc7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5fc7('0xd'));var Papa=require('papaparse');var Redis=require(_0x5fc7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5fc7('0xf'));var as=require(_0x5fc7('0x10'));var hardwareService=require(_0x5fc7('0x11'));var logger=require('../../config/logger')(_0x5fc7('0x12'));var utils=require(_0x5fc7('0x13'));var config=require(_0x5fc7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fc7('0x15'))['db'];var integrations=require(_0x5fc7('0x16'));var jayson=require(_0x5fc7('0x17'));var client=jayson[_0x5fc7('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea6a3,_0x599c23,_0x53ca56,_0xb9cf6){return new BPromise(function(_0x13fb24,_0x278d97){var _0x11e612=_0xb9cf6||client;return _0x11e612['request'](_0x5ea6a3,_0x53ca56)[_0x5fc7('0x19')](function(_0x32d87c){logger[_0x5fc7('0x1a')](_0x5fc7('0x1b'),_0x599c23,'request\x20sent');logger[_0x5fc7('0x1c')](_0x5fc7('0x1d'),_0x599c23,'request\x20sent',JSON['stringify'](_0x32d87c));if(_0x32d87c[_0x5fc7('0x1e')]){if(_0x32d87c[_0x5fc7('0x1e')][_0x5fc7('0x1f')]===0x1f4){logger[_0x5fc7('0x1e')]('SalesforceAccount,\x20%s,\x20%s',_0x599c23,_0x32d87c[_0x5fc7('0x1e')][_0x5fc7('0x20')]);return _0x278d97(_0x32d87c[_0x5fc7('0x1e')][_0x5fc7('0x20')]);}logger[_0x5fc7('0x1e')]('SalesforceAccount,\x20%s,\x20%s',_0x599c23,_0x32d87c['error'][_0x5fc7('0x20')]);return _0x13fb24(_0x32d87c[_0x5fc7('0x1e')][_0x5fc7('0x20')]);}else{logger[_0x5fc7('0x1a')](_0x5fc7('0x1b'),_0x599c23,_0x5fc7('0x21'));_0x13fb24(_0x32d87c[_0x5fc7('0x22')][_0x5fc7('0x20')]);}})['catch'](function(_0x4050fb){logger['error'](_0x5fc7('0x1b'),_0x599c23,_0x4050fb);_0x278d97(_0x4050fb);});});}function respondWithStatusCode(_0xc530af,_0x2bd0e5){_0x2bd0e5=_0x2bd0e5||0xcc;return function(_0x3b80fe){if(_0x3b80fe){return _0xc530af[_0x5fc7('0x23')](_0x2bd0e5);}return _0xc530af['status'](_0x2bd0e5)[_0x5fc7('0x24')]();};}function respondWithResult(_0x6f28e0,_0x2eb2a5){_0x2eb2a5=_0x2eb2a5||0xc8;return function(_0x1b9deb){if(_0x1b9deb){return _0x6f28e0[_0x5fc7('0x25')](_0x2eb2a5)[_0x5fc7('0x26')](_0x1b9deb);}};}function respondWithFilteredResult(_0x9c258c,_0x13752f){return function(_0x4ce63d){if(_0x4ce63d){var _0x5eecfb=typeof _0x13752f[_0x5fc7('0x27')]==='undefined'&&typeof _0x13752f[_0x5fc7('0x28')]==='undefined';var _0xc801c0=_0x4ce63d[_0x5fc7('0x29')];var _0x443b4a=_0x5eecfb?0x0:_0x13752f[_0x5fc7('0x27')];var _0x45c682=_0x5eecfb?_0x4ce63d[_0x5fc7('0x29')]:_0x13752f[_0x5fc7('0x27')]+_0x13752f[_0x5fc7('0x28')];var _0x218c7a;if(_0x45c682>=_0xc801c0){_0x45c682=_0xc801c0;_0x218c7a=0xc8;}else{_0x218c7a=0xce;}_0x9c258c[_0x5fc7('0x25')](_0x218c7a);return _0x9c258c['set'](_0x5fc7('0x2a'),_0x443b4a+'-'+_0x45c682+'/'+_0xc801c0)[_0x5fc7('0x26')](_0x4ce63d);}return null;};}function patchUpdates(_0x40d6b2){return function(_0x17de2f){try{jsonpatch[_0x5fc7('0x2b')](_0x17de2f,_0x40d6b2,!![]);}catch(_0x879b91){return BPromise[_0x5fc7('0x2c')](_0x879b91);}return _0x17de2f[_0x5fc7('0x2d')]();};}function saveUpdates(_0x453c92,_0x5585c2){return function(_0x5aab0b){if(_0x5aab0b){return _0x5aab0b[_0x5fc7('0x2e')](_0x453c92)[_0x5fc7('0x19')](function(_0x29836){return _0x29836;});}return null;};}function removeEntity(_0x459321,_0x38980b){return function(_0x3c4cc0){if(_0x3c4cc0){return _0x3c4cc0[_0x5fc7('0x2f')]()[_0x5fc7('0x19')](function(){_0x459321[_0x5fc7('0x25')](0xcc)[_0x5fc7('0x24')]();});}};}function handleEntityNotFound(_0x4324bf,_0x1fd7f0){return function(_0x4a29ef){if(!_0x4a29ef){_0x4324bf['sendStatus'](0x194);}return _0x4a29ef;};}function handleError(_0x695864,_0x4e2845){_0x4e2845=_0x4e2845||0x1f4;return function(_0xcc4105){logger[_0x5fc7('0x1e')](_0xcc4105[_0x5fc7('0x30')]);if(_0xcc4105[_0x5fc7('0x31')]){delete _0xcc4105[_0x5fc7('0x31')];}_0x695864[_0x5fc7('0x25')](_0x4e2845)['send'](_0xcc4105);};}exports['index']=function(_0x391510,_0x37d02c){var _0x14fea5={},_0x3ccb66={},_0x51d758={'count':0x0,'rows':[]};var _0x5357e8=_['map'](db[_0x5fc7('0x32')][_0x5fc7('0x33')],function(_0x233e56){return{'name':_0x233e56['fieldName'],'type':_0x233e56['type'][_0x5fc7('0x34')]};});_0x3ccb66[_0x5fc7('0x35')]=_[_0x5fc7('0x36')](_0x5357e8,'name');_0x3ccb66['query']=_[_0x5fc7('0x37')](_0x391510[_0x5fc7('0x38')]);_0x3ccb66['filters']=_['intersection'](_0x3ccb66[_0x5fc7('0x35')],_0x3ccb66[_0x5fc7('0x38')]);_0x14fea5['attributes']=_[_0x5fc7('0x39')](_0x3ccb66[_0x5fc7('0x35')],qs['fields'](_0x391510['query'][_0x5fc7('0x3a')]));_0x14fea5['attributes']=_0x14fea5[_0x5fc7('0x3b')]['length']?_0x14fea5[_0x5fc7('0x3b')]:_0x3ccb66[_0x5fc7('0x35')];if(!_0x391510['query'][_0x5fc7('0x3c')](_0x5fc7('0x3d'))){_0x14fea5['limit']=qs[_0x5fc7('0x28')](_0x391510[_0x5fc7('0x38')][_0x5fc7('0x28')]);_0x14fea5[_0x5fc7('0x27')]=qs['offset'](_0x391510['query'][_0x5fc7('0x27')]);}_0x14fea5[_0x5fc7('0x3e')]=qs[_0x5fc7('0x3f')](_0x391510[_0x5fc7('0x38')][_0x5fc7('0x3f')]);_0x14fea5[_0x5fc7('0x40')]=qs['filters'](_[_0x5fc7('0x41')](_0x391510[_0x5fc7('0x38')],_0x3ccb66[_0x5fc7('0x42')]),_0x5357e8);if(_0x391510[_0x5fc7('0x38')]['filter']){_0x14fea5[_0x5fc7('0x40')]=_['merge'](_0x14fea5['where'],{'$or':_[_0x5fc7('0x36')](_0x5357e8,function(_0x556bb1){if(_0x556bb1[_0x5fc7('0x43')]!==_0x5fc7('0x44')){var _0x3cd27c={};_0x3cd27c[_0x556bb1[_0x5fc7('0x31')]]={'$like':'%'+_0x391510[_0x5fc7('0x38')][_0x5fc7('0x45')]+'%'};return _0x3cd27c;}})});}_0x14fea5=_[_0x5fc7('0x46')]({},_0x14fea5,_0x391510[_0x5fc7('0x47')]);var _0x21fec6={'where':_0x14fea5[_0x5fc7('0x40')]};return db[_0x5fc7('0x32')][_0x5fc7('0x29')](_0x21fec6)['then'](function(_0x32097d){_0x51d758[_0x5fc7('0x29')]=_0x32097d;if(_0x391510[_0x5fc7('0x38')][_0x5fc7('0x48')]){_0x14fea5[_0x5fc7('0x49')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x5fc7('0x4a')](_0x14fea5);})[_0x5fc7('0x19')](function(_0x425880){_0x51d758[_0x5fc7('0x4b')]=_0x425880;return _0x51d758;})['then'](respondWithFilteredResult(_0x37d02c,_0x14fea5))[_0x5fc7('0x4c')](handleError(_0x37d02c,null));};exports[_0x5fc7('0x4d')]=function(_0x3372f5,_0x52e094){var _0x468d7e={'raw':![],'where':{'id':_0x3372f5[_0x5fc7('0x4e')]['id']}},_0x487f18={};_0x487f18[_0x5fc7('0x35')]=_[_0x5fc7('0x37')](db[_0x5fc7('0x32')][_0x5fc7('0x33')]);_0x487f18[_0x5fc7('0x38')]=_[_0x5fc7('0x37')](_0x3372f5['query']);_0x487f18[_0x5fc7('0x42')]=_[_0x5fc7('0x39')](_0x487f18[_0x5fc7('0x35')],_0x487f18[_0x5fc7('0x38')]);_0x468d7e[_0x5fc7('0x3b')]=_[_0x5fc7('0x39')](_0x487f18[_0x5fc7('0x35')],qs[_0x5fc7('0x3a')](_0x3372f5[_0x5fc7('0x38')][_0x5fc7('0x3a')]));_0x468d7e[_0x5fc7('0x3b')]=_0x468d7e[_0x5fc7('0x3b')][_0x5fc7('0x4f')]?_0x468d7e[_0x5fc7('0x3b')]:_0x487f18[_0x5fc7('0x35')];if(_0x3372f5[_0x5fc7('0x38')][_0x5fc7('0x48')]){_0x468d7e[_0x5fc7('0x49')]=[{'all':!![]}];}_0x468d7e=_[_0x5fc7('0x46')]({},_0x468d7e,_0x3372f5[_0x5fc7('0x47')]);return db[_0x5fc7('0x32')][_0x5fc7('0x50')](_0x468d7e)[_0x5fc7('0x19')](handleEntityNotFound(_0x52e094,null))[_0x5fc7('0x19')](respondWithResult(_0x52e094,null))[_0x5fc7('0x4c')](handleError(_0x52e094,null));};exports[_0x5fc7('0x51')]=function(_0x2e501c,_0x287846){return db[_0x5fc7('0x32')][_0x5fc7('0x51')](_0x2e501c['body'],{})[_0x5fc7('0x19')](respondWithResult(_0x287846,0xc9))[_0x5fc7('0x4c')](handleError(_0x287846,null));};exports[_0x5fc7('0x2e')]=function(_0x4d626d,_0x3a95df){if(_0x4d626d[_0x5fc7('0x52')]['id']){delete _0x4d626d[_0x5fc7('0x52')]['id'];}return db[_0x5fc7('0x32')][_0x5fc7('0x50')]({'where':{'id':_0x4d626d[_0x5fc7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a95df,null))['then'](saveUpdates(_0x4d626d['body'],null))[_0x5fc7('0x19')](respondWithResult(_0x3a95df,null))[_0x5fc7('0x4c')](handleError(_0x3a95df,null));};exports[_0x5fc7('0x2f')]=function(_0x48a741,_0x523144){return db[_0x5fc7('0x32')]['find']({'where':{'id':_0x48a741[_0x5fc7('0x4e')]['id']}})[_0x5fc7('0x19')](handleEntityNotFound(_0x523144,null))[_0x5fc7('0x19')](removeEntity(_0x523144,null))[_0x5fc7('0x4c')](handleError(_0x523144,null));};exports[_0x5fc7('0x53')]=function(_0x142ce1,_0x4cb972,_0x491a56){var _0x5adb5b={};var _0x1ae2a0={};var _0x48da37;var _0x195a2b;return db[_0x5fc7('0x32')][_0x5fc7('0x54')]({'where':{'id':_0x142ce1[_0x5fc7('0x4e')]['id']}})[_0x5fc7('0x19')](handleEntityNotFound(_0x4cb972,null))[_0x5fc7('0x19')](function(_0x9e33b3){if(_0x9e33b3){_0x48da37=_0x9e33b3;_0x1ae2a0['model']=_[_0x5fc7('0x37')](db[_0x5fc7('0x55')][_0x5fc7('0x33')]);_0x1ae2a0[_0x5fc7('0x38')]=_[_0x5fc7('0x37')](_0x142ce1[_0x5fc7('0x38')]);_0x1ae2a0[_0x5fc7('0x42')]=_[_0x5fc7('0x39')](_0x1ae2a0['model'],_0x1ae2a0['query']);_0x5adb5b[_0x5fc7('0x3b')]=_['intersection'](_0x1ae2a0[_0x5fc7('0x35')],qs[_0x5fc7('0x3a')](_0x142ce1['query'][_0x5fc7('0x3a')]));_0x5adb5b['attributes']=_0x5adb5b[_0x5fc7('0x3b')][_0x5fc7('0x4f')]?_0x5adb5b[_0x5fc7('0x3b')]:_0x1ae2a0[_0x5fc7('0x35')];_0x5adb5b[_0x5fc7('0x3e')]=qs['sort'](_0x142ce1[_0x5fc7('0x38')][_0x5fc7('0x3f')]);_0x5adb5b['where']=qs[_0x5fc7('0x42')](_[_0x5fc7('0x41')](_0x142ce1['query'],_0x1ae2a0[_0x5fc7('0x42')]));if(_0x142ce1['query']['filter']){_0x5adb5b['where']=_[_0x5fc7('0x46')](_0x5adb5b[_0x5fc7('0x40')],{'$or':_['map'](_0x5adb5b[_0x5fc7('0x3b')],function(_0x16656f){var _0x10cf5d={};_0x10cf5d[_0x16656f]={'$like':'%'+_0x142ce1[_0x5fc7('0x38')][_0x5fc7('0x45')]+'%'};return _0x10cf5d;})});}_0x5adb5b=_[_0x5fc7('0x46')]({},_0x5adb5b,_0x142ce1[_0x5fc7('0x47')]);return _0x48da37[_0x5fc7('0x53')](_0x5adb5b);}})[_0x5fc7('0x19')](function(_0x58c761){if(_0x58c761){_0x195a2b=_0x58c761['length'];if(!_0x142ce1[_0x5fc7('0x38')]['hasOwnProperty'](_0x5fc7('0x3d'))){_0x5adb5b['limit']=qs[_0x5fc7('0x28')](_0x142ce1[_0x5fc7('0x38')][_0x5fc7('0x28')]);_0x5adb5b[_0x5fc7('0x27')]=qs[_0x5fc7('0x27')](_0x142ce1[_0x5fc7('0x38')][_0x5fc7('0x27')]);}return _0x48da37[_0x5fc7('0x53')](_0x5adb5b);}})[_0x5fc7('0x19')](function(_0x157b7c){if(_0x157b7c){return _0x157b7c?{'count':_0x195a2b,'rows':_0x157b7c}:null;}})['then'](respondWithResult(_0x4cb972,null))[_0x5fc7('0x4c')](handleError(_0x4cb972,null));};exports[_0x5fc7('0x56')]=function(_0x2343ec,_0x4beb3d,_0x3ab982){if(_0x2343ec[_0x5fc7('0x52')]['id']){delete _0x2343ec['body']['id'];}return db[_0x5fc7('0x32')][_0x5fc7('0x54')]({'where':{'id':_0x2343ec[_0x5fc7('0x4e')]['id']}})[_0x5fc7('0x19')](handleEntityNotFound(_0x4beb3d,null))['then'](function(_0x274b8a){if(_0x274b8a){_0x2343ec['body'][_0x5fc7('0x57')]=_0x274b8a['id'];_0x2343ec[_0x5fc7('0x52')][_0x5fc7('0x58')]=integrations['getSubjects'](_0x2343ec[_0x5fc7('0x52')]['channel'],_0x2343ec[_0x5fc7('0x52')][_0x5fc7('0x43')]);_0x2343ec[_0x5fc7('0x52')]['Descriptions']=integrations[_0x5fc7('0x59')](_0x2343ec[_0x5fc7('0x52')][_0x5fc7('0x5a')],_0x2343ec[_0x5fc7('0x52')][_0x5fc7('0x43')]);return db[_0x5fc7('0x55')][_0x5fc7('0x51')](_0x2343ec[_0x5fc7('0x52')],{'include':[{'model':db[_0x5fc7('0x5b')],'as':_0x5fc7('0x58')},{'model':db[_0x5fc7('0x5b')],'as':'Descriptions'}]});}return null;})[_0x5fc7('0x19')](respondWithResult(_0x4beb3d,null))[_0x5fc7('0x4c')](handleError(_0x4beb3d,null));};exports[_0x5fc7('0x5c')]=function(_0x274120,_0x41c870,_0x4fde2f){var _0x28b539;var _0x516d53='';var _0x2e94b8='Task';return db['SalesforceAccount'][_0x5fc7('0x54')]({'where':{'id':_0x274120[_0x5fc7('0x4e')]['id']},'attributes':['id','remoteUri',_0x5fc7('0x5d'),_0x5fc7('0x5e'),'username',_0x5fc7('0x5f'),_0x5fc7('0x60')]})['then'](handleEntityNotFound(_0x41c870,null))['then'](function(_0x1f4745){if(_0x1f4745){_0x516d53=_0x1f4745['remoteUri'];var _0x239322=_0x516d53[_0x5fc7('0x61')](-0x1);if(_0x239322==='/'){_0x516d53=_0x516d53[_0x5fc7('0x62')](0x0,_0x516d53[_0x5fc7('0x63')](_0x239322));}_0x28b539=new jsforce[(_0x5fc7('0x64'))]({'oauth2':{'loginUrl':_0x516d53,'clientId':_0x1f4745[_0x5fc7('0x5d')],'clientSecret':_0x1f4745[_0x5fc7('0x5e')]}});return _0x28b539[_0x5fc7('0x65')](_0x1f4745['username'],_0x1f4745[_0x5fc7('0x5f')][_0x5fc7('0x66')](_0x1f4745[_0x5fc7('0x60')]));}})[_0x5fc7('0x19')](function(_0x3a35e0){if(_0x3a35e0){if(!_[_0x5fc7('0x67')](_0x274120[_0x5fc7('0x38')][_0x5fc7('0x68')])){_0x2e94b8=_0x274120[_0x5fc7('0x38')]['ticketType'];}return _0x28b539['sobject'](_0x2e94b8)[_0x5fc7('0x69')]();}})[_0x5fc7('0x19')](function(_0x3e226e){var _0x370b4c=[_0x5fc7('0x6a'),_0x5fc7('0x6b'),_0x5fc7('0x6c'),_0x5fc7('0x6d'),_0x5fc7('0x6e'),_0x5fc7('0x6f')];var _0x17cc84=[_0x5fc7('0x70'),'int','picklist',_0x5fc7('0x71'),_0x5fc7('0x72'),_0x5fc7('0x73'),_0x5fc7('0x74')];if(_0x3e226e){_[_0x5fc7('0x75')](_0x3e226e[_0x5fc7('0x3a')],function(_0x5192e8){return _0x370b4c[_0x5fc7('0x76')](_0x5192e8[_0x5fc7('0x31')])||!_0x17cc84['includes'](_0x5192e8[_0x5fc7('0x43')]);});return{'count':_0x3e226e[_0x5fc7('0x3a')]['length'],'rows':_[_0x5fc7('0x36')](_0x3e226e[_0x5fc7('0x3a')],function(_0x5bd13e){return{'id':_0x5bd13e[_0x5fc7('0x31')],'name':_0x5bd13e[_0x5fc7('0x77')],'custom':_0x5bd13e[_0x5fc7('0x78')],'options':_0x5bd13e[_0x5fc7('0x79')][_0x5fc7('0x4f')]>0x0?_['map'](_0x5bd13e[_0x5fc7('0x79')],function(_0x465795){return{'name':_0x465795[_0x5fc7('0x77')],'value':_0x465795['value']};}):_0x5bd13e[_0x5fc7('0x43')]==_0x5fc7('0x71')?[{'name':_0x5fc7('0x7a'),'value':_0x5fc7('0x7b')},{'name':_0x5fc7('0x7c'),'value':_0x5fc7('0x7d')}]:[]};})};}})['then'](respondWithResult(_0x41c870,null))[_0x5fc7('0x4c')](function(_0x34d8c5){var _0x4214a1=_0x274120[_0x5fc7('0x38')][_0x5fc7('0x7e')]?0x1f4:_0x34d8c5[_0x5fc7('0x7f')]||0x1f4;logger[_0x5fc7('0x1e')](_0x5fc7('0x80'),_0x5fc7('0x5c'),_0x4214a1,JSON['stringify'](_0x34d8c5));delete _0x34d8c5['name'];if(_0x4214a1===0x191){_0x4214a1=0x190;}_0x41c870[_0x5fc7('0x25')](_0x4214a1)[_0x5fc7('0x81')](_0x274120[_0x5fc7('0x38')]['test']?{'message':_0x5fc7('0x82'),'statusCode':_0x34d8c5[_0x5fc7('0x7f')]}:_0x34d8c5);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f17af8d..138cb21 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 _0xf7cd=['moment','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','api'];(function(_0x51e897,_0x3d9a7e){var _0x54a1b8=function(_0x32089d){while(--_0x32089d){_0x51e897['push'](_0x51e897['shift']());}};_0x54a1b8(++_0x3d9a7e);}(_0xf7cd,0x105));var _0xdf7c=function(_0x4f3489,_0x425334){_0x4f3489=_0x4f3489-0x0;var _0x4cb4ee=_0xf7cd[_0x4f3489];return _0x4cb4ee;};'use strict';var _=require(_0xdf7c('0x0'));var util=require(_0xdf7c('0x1'));var logger=require('../../config/logger')(_0xdf7c('0x2'));var moment=require(_0xdf7c('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf7c('0x5'));var config=require('../../config/environment');var attributes=require(_0xdf7c('0x6'));var integrations=require(_0xdf7c('0x7'));module[_0xdf7c('0x8')]=function(_0x22e3c1,_0x24e6f8){return _0x22e3c1['define'](_0xdf7c('0x9'),attributes,{'tableName':_0xdf7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc684=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','define','int_salesforce_accounts'];(function(_0x513aec,_0x377f91){var _0x3d7227=function(_0x21d457){while(--_0x21d457){_0x513aec['push'](_0x513aec['shift']());}};_0x3d7227(++_0x377f91);}(_0xc684,0x15f));var _0x4c68=function(_0x28c642,_0x56da77){_0x28c642=_0x28c642-0x0;var _0x47fff1=_0xc684[_0x28c642];return _0x47fff1;};'use strict';var _=require(_0x4c68('0x0'));var util=require(_0x4c68('0x1'));var logger=require(_0x4c68('0x2'))(_0x4c68('0x3'));var moment=require(_0x4c68('0x4'));var BPromise=require(_0x4c68('0x5'));var rp=require(_0x4c68('0x6'));var fs=require('fs');var path=require(_0x4c68('0x7'));var rimraf=require(_0x4c68('0x8'));var config=require(_0x4c68('0x9'));var attributes=require(_0x4c68('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x47750c,_0x1cc6f4){return _0x47750c[_0x4c68('0xb')]('SalesforceAccount',attributes,{'tableName':_0x4c68('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 08677d3..02b3c07 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 _0xb903=['info','result','findAll','options','raw','where','attributes','limit','map','include','model','then','GetSalesforceAccount','debug','stringify','ShowSalesforceAccount','SalesforceAccount','find','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','SalesforceAccount,\x20%s,\x20%s','message'];(function(_0x310a54,_0x212d9a){var _0x4e4caa=function(_0x6baec9){while(--_0x6baec9){_0x310a54['push'](_0x310a54['shift']());}};_0x4e4caa(++_0x212d9a);}(_0xb903,0x185));var _0x3b90=function(_0x10f2da,_0x485f2c){_0x10f2da=_0x10f2da-0x0;var _0x6267ed=_0xb903[_0x10f2da];return _0x6267ed;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});}exports['GetSalesforceAccount']=function(_0x269488){var _0x3cf281=this;return new Promise(function(_0x11ad7d,_0x131f3f){return db['SalesforceAccount'][_0x3b90('0x14')]({'raw':_0x269488['options']?_0x269488[_0x3b90('0x15')][_0x3b90('0x16')]===undefined?!![]:![]:!![],'where':_0x269488['options']?_0x269488[_0x3b90('0x15')][_0x3b90('0x17')]||null:null,'attributes':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')][_0x3b90('0x18')]||null:null,'limit':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')][_0x3b90('0x19')]||null:null,'include':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')]['include']?_[_0x3b90('0x1a')](_0x269488[_0x3b90('0x15')][_0x3b90('0x1b')],function(_0x7faee){return{'model':db[_0x7faee[_0x3b90('0x1c')]],'as':_0x7faee['as'],'attributes':_0x7faee[_0x3b90('0x18')],'include':_0x7faee['include']?_['map'](_0x7faee[_0x3b90('0x1b')],function(_0x29d472){return{'model':db[_0x29d472[_0x3b90('0x1c')]],'as':_0x29d472['as'],'attributes':_0x29d472[_0x3b90('0x18')],'include':_0x29d472['include']?_[_0x3b90('0x1a')](_0x29d472[_0x3b90('0x1b')],function(_0x1787d1){return{'model':db[_0x1787d1['model']],'as':_0x1787d1['as'],'attributes':_0x1787d1[_0x3b90('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b90('0x1d')](function(_0x17ec7f){logger[_0x3b90('0x12')](_0x3b90('0x1e'),_0x269488);logger[_0x3b90('0x1f')]('GetSalesforceAccount',_0x269488,JSON[_0x3b90('0x20')](_0x17ec7f));_0x11ad7d(_0x17ec7f);})['catch'](function(_0xaf453c){logger[_0x3b90('0xf')](_0x3b90('0x1e'),_0xaf453c[_0x3b90('0x11')],_0x269488);_0x131f3f(_0x3cf281[_0x3b90('0xf')](0x1f4,_0xaf453c[_0x3b90('0x11')]));});});};exports[_0x3b90('0x21')]=function(_0x2430ec){var _0x500ceb=this;return new Promise(function(_0x4d1f31,_0x43bd4f){return db[_0x3b90('0x22')][_0x3b90('0x23')]({'raw':_0x2430ec[_0x3b90('0x15')]?_0x2430ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x2430ec[_0x3b90('0x15')]?_0x2430ec[_0x3b90('0x15')][_0x3b90('0x17')]||null:null,'attributes':_0x2430ec['options']?_0x2430ec[_0x3b90('0x15')]['attributes']||null:null,'include':_0x2430ec['options']?_0x2430ec[_0x3b90('0x15')][_0x3b90('0x1b')]?_['map'](_0x2430ec[_0x3b90('0x15')][_0x3b90('0x1b')],function(_0x3e30b8){return{'model':db[_0x3e30b8['model']],'as':_0x3e30b8['as'],'attributes':_0x3e30b8['attributes'],'include':_0x3e30b8[_0x3b90('0x1b')]?_[_0x3b90('0x1a')](_0x3e30b8[_0x3b90('0x1b')],function(_0x401dc5){return{'model':db[_0x401dc5['model']],'as':_0x401dc5['as'],'attributes':_0x401dc5['attributes'],'include':_0x401dc5[_0x3b90('0x1b')]?_[_0x3b90('0x1a')](_0x401dc5['include'],function(_0x57946d){return{'model':db[_0x57946d[_0x3b90('0x1c')]],'as':_0x57946d['as'],'attributes':_0x57946d[_0x3b90('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b90('0x1d')](function(_0x298df6){logger['info'](_0x3b90('0x21'),_0x2430ec);logger['debug'](_0x3b90('0x21'),_0x2430ec,JSON[_0x3b90('0x20')](_0x298df6));_0x4d1f31(_0x298df6);})[_0x3b90('0x24')](function(_0x20abf8){logger[_0x3b90('0xf')](_0x3b90('0x21'),_0x20abf8[_0x3b90('0x11')],_0x2430ec);_0x43bd4f(_0x500ceb['error'](0x1f4,_0x20abf8[_0x3b90('0x11')]));});});}; \ No newline at end of file +var _0x55e0=['then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','limit','include','map','model','stringify','ShowSalesforceAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x4f3da4,_0x121375){var _0x1df1a1=function(_0x329dfc){while(--_0x329dfc){_0x4f3da4['push'](_0x4f3da4['shift']());}};_0x1df1a1(++_0x121375);}(_0x55e0,0xdc));var _0x055e=function(_0x1b05b0,_0x1b4bdb){_0x1b05b0=_0x1b05b0-0x0;var _0xaae986=_0x55e0[_0x1b05b0];return _0xaae986;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});}exports[_0x055e('0x16')]=function(_0x4c85dd){var _0x36ef10=this;return new Promise(function(_0x2cf3de,_0x2f4a06){return db[_0x055e('0x17')]['findAll']({'raw':_0x4c85dd[_0x055e('0x18')]?_0x4c85dd[_0x055e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c85dd[_0x055e('0x18')]?_0x4c85dd[_0x055e('0x18')][_0x055e('0x19')]||null:null,'attributes':_0x4c85dd[_0x055e('0x18')]?_0x4c85dd[_0x055e('0x18')][_0x055e('0x1a')]||null:null,'limit':_0x4c85dd['options']?_0x4c85dd[_0x055e('0x18')][_0x055e('0x1b')]||null:null,'include':_0x4c85dd[_0x055e('0x18')]?_0x4c85dd['options'][_0x055e('0x1c')]?_[_0x055e('0x1d')](_0x4c85dd[_0x055e('0x18')][_0x055e('0x1c')],function(_0x51df23){return{'model':db[_0x51df23[_0x055e('0x1e')]],'as':_0x51df23['as'],'attributes':_0x51df23['attributes'],'include':_0x51df23[_0x055e('0x1c')]?_[_0x055e('0x1d')](_0x51df23[_0x055e('0x1c')],function(_0x1a76c6){return{'model':db[_0x1a76c6[_0x055e('0x1e')]],'as':_0x1a76c6['as'],'attributes':_0x1a76c6[_0x055e('0x1a')],'include':_0x1a76c6['include']?_[_0x055e('0x1d')](_0x1a76c6[_0x055e('0x1c')],function(_0x2a82f8){return{'model':db[_0x2a82f8['model']],'as':_0x2a82f8['as'],'attributes':_0x2a82f8[_0x055e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x055e('0xb')](function(_0x42f2df){logger[_0x055e('0xc')]('GetSalesforceAccount',_0x4c85dd);logger[_0x055e('0xf')]('GetSalesforceAccount',_0x4c85dd,JSON[_0x055e('0x1f')](_0x42f2df));_0x2cf3de(_0x42f2df);})[_0x055e('0x15')](function(_0x23a506){logger[_0x055e('0x11')](_0x055e('0x16'),_0x23a506['message'],_0x4c85dd);_0x2f4a06(_0x36ef10[_0x055e('0x11')](0x1f4,_0x23a506[_0x055e('0x13')]));});});};exports[_0x055e('0x20')]=function(_0x1499e1){var _0x36abb2=this;return new Promise(function(_0x225c88,_0x59f8c4){return db[_0x055e('0x17')]['find']({'raw':_0x1499e1[_0x055e('0x18')]?_0x1499e1[_0x055e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1499e1[_0x055e('0x18')]?_0x1499e1[_0x055e('0x18')][_0x055e('0x19')]||null:null,'attributes':_0x1499e1[_0x055e('0x18')]?_0x1499e1[_0x055e('0x18')][_0x055e('0x1a')]||null:null,'include':_0x1499e1['options']?_0x1499e1['options'][_0x055e('0x1c')]?_['map'](_0x1499e1['options']['include'],function(_0x31ee60){return{'model':db[_0x31ee60[_0x055e('0x1e')]],'as':_0x31ee60['as'],'attributes':_0x31ee60[_0x055e('0x1a')],'include':_0x31ee60[_0x055e('0x1c')]?_[_0x055e('0x1d')](_0x31ee60[_0x055e('0x1c')],function(_0x13efb7){return{'model':db[_0x13efb7[_0x055e('0x1e')]],'as':_0x13efb7['as'],'attributes':_0x13efb7[_0x055e('0x1a')],'include':_0x13efb7[_0x055e('0x1c')]?_[_0x055e('0x1d')](_0x13efb7[_0x055e('0x1c')],function(_0x54539e){return{'model':db[_0x54539e['model']],'as':_0x54539e['as'],'attributes':_0x54539e[_0x055e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x055e('0xb')](function(_0x10346b){logger[_0x055e('0xc')](_0x055e('0x20'),_0x1499e1);logger[_0x055e('0xf')](_0x055e('0x20'),_0x1499e1,JSON['stringify'](_0x10346b));_0x225c88(_0x10346b);})[_0x055e('0x15')](function(_0x265fed){logger[_0x055e('0x11')](_0x055e('0x20'),_0x265fed[_0x055e('0x13')],_0x1499e1);_0x59f8c4(_0x36abb2['error'](0x1f4,_0x265fed[_0x055e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6d5a522..e4345ea 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 _0x6355=['update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put'];(function(_0x52318f,_0x185680){var _0x30ede9=function(_0x3dfe04){while(--_0x3dfe04){_0x52318f['push'](_0x52318f['shift']());}};_0x30ede9(++_0x185680);}(_0x6355,0x153));var _0x5635=function(_0x229ad1,_0x3183c2){_0x229ad1=_0x229ad1-0x0;var _0x36ab81=_0x6355[_0x229ad1];return _0x36ab81;};'use strict';var multer=require(_0x5635('0x0'));var util=require(_0x5635('0x1'));var path=require('path');var timeout=require(_0x5635('0x2'));var express=require('express');var router=express[_0x5635('0x3')]();var fs_extra=require(_0x5635('0x4'));var auth=require(_0x5635('0x5'));var interaction=require(_0x5635('0x6'));var config=require(_0x5635('0x7'));var controller=require(_0x5635('0x8'));router['get']('/',auth[_0x5635('0x9')](),controller[_0x5635('0xa')]);router[_0x5635('0xb')](_0x5635('0xc'),auth[_0x5635('0x9')](),controller[_0x5635('0xd')]);router[_0x5635('0xb')](_0x5635('0xe'),auth[_0x5635('0x9')](),controller[_0x5635('0xf')]);router[_0x5635('0xb')](_0x5635('0x10'),auth[_0x5635('0x9')](),controller[_0x5635('0x11')]);router['get'](_0x5635('0x12'),auth[_0x5635('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x5635('0x9')](),controller[_0x5635('0x13')]);router[_0x5635('0x14')](_0x5635('0xc'),auth[_0x5635('0x9')](),controller[_0x5635('0x15')]);router[_0x5635('0x16')]('/:id',auth[_0x5635('0x9')](),controller[_0x5635('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5d05=['Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x5d48d1,_0x30b0ec){var _0x508a12=function(_0x35d525){while(--_0x35d525){_0x5d48d1['push'](_0x5d48d1['shift']());}};_0x508a12(++_0x30b0ec);}(_0x5d05,0x173));var _0x55d0=function(_0x536eca,_0x18b615){_0x536eca=_0x536eca-0x0;var _0x28f35f=_0x5d05[_0x536eca];return _0x28f35f;};'use strict';var multer=require('multer');var util=require(_0x55d0('0x0'));var path=require(_0x55d0('0x1'));var timeout=require(_0x55d0('0x2'));var express=require(_0x55d0('0x3'));var router=express[_0x55d0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x55d0('0x5'));var config=require(_0x55d0('0x6'));var controller=require(_0x55d0('0x7'));router[_0x55d0('0x8')]('/',auth[_0x55d0('0x9')](),controller[_0x55d0('0xa')]);router[_0x55d0('0x8')](_0x55d0('0xb'),auth[_0x55d0('0x9')](),controller[_0x55d0('0xc')]);router[_0x55d0('0x8')](_0x55d0('0xd'),auth['isAuthenticated'](),controller[_0x55d0('0xe')]);router['get'](_0x55d0('0xf'),auth[_0x55d0('0x9')](),controller[_0x55d0('0x10')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x55d0('0x11')]);router[_0x55d0('0x12')]('/',auth[_0x55d0('0x9')](),controller[_0x55d0('0x13')]);router[_0x55d0('0x14')](_0x55d0('0xb'),auth[_0x55d0('0x9')](),controller[_0x55d0('0x15')]);router[_0x55d0('0x16')](_0x55d0('0xb'),auth[_0x55d0('0x9')](),controller[_0x55d0('0x17')]);module[_0x55d0('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b4ceea9..1e34490 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 _0x9a02=['Task','Case','contact_lead','account_contact_lead','account','contact','lead','sequelize','exports','STRING','ENUM'];(function(_0x24189f,_0x193d3d){var _0xd85189=function(_0x1961a0){while(--_0x1961a0){_0x24189f['push'](_0x24189f['shift']());}};_0xd85189(++_0x193d3d);}(_0x9a02,0x15c));var _0x29a0=function(_0x2c911a,_0x433c80){_0x2c911a=_0x2c911a-0x0;var _0x4df395=_0x9a02[_0x2c911a];return _0x4df395;};'use strict';var Sequelize=require(_0x29a0('0x0'));module[_0x29a0('0x1')]={'name':{'type':Sequelize[_0x29a0('0x2')]},'description':{'type':Sequelize[_0x29a0('0x2')]},'ticketType':{'type':Sequelize[_0x29a0('0x3')](_0x29a0('0x4'),_0x29a0('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x29a0('0x6'),'contact','lead',_0x29a0('0x7'),_0x29a0('0x8')),'defaultValue':_0x29a0('0x6')},'moduleCreate':{'type':Sequelize[_0x29a0('0x3')]('nothing',_0x29a0('0x9'),'lead',_0x29a0('0x8')),'defaultValue':_0x29a0('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x29a0('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea0a=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize'];(function(_0x3be20a,_0x223336){var _0x7382f6=function(_0x41c98f){while(--_0x41c98f){_0x3be20a['push'](_0x3be20a['shift']());}};_0x7382f6(++_0x223336);}(_0xea0a,0x99));var _0xaea0=function(_0x4f4f19,_0x3488a5){_0x4f4f19=_0x4f4f19-0x0;var _0x3f0b1f=_0xea0a[_0x4f4f19];return _0x3f0b1f;};'use strict';var Sequelize=require(_0xaea0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaea0('0x1')]},'ticketType':{'type':Sequelize[_0xaea0('0x2')](_0xaea0('0x3'),_0xaea0('0x4')),'defaultValue':_0xaea0('0x3')},'moduleSearch':{'type':Sequelize[_0xaea0('0x2')](_0xaea0('0x5'),_0xaea0('0x6'),_0xaea0('0x7'),_0xaea0('0x8'),_0xaea0('0x9')),'defaultValue':_0xaea0('0x5')},'moduleCreate':{'type':Sequelize[_0xaea0('0x2')](_0xaea0('0xa'),'contact',_0xaea0('0x7'),_0xaea0('0x9')),'defaultValue':_0xaea0('0x7')},'leadId':{'type':Sequelize[_0xaea0('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xaea0('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xaea0('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xaea0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index fdf9588..38432ed 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 _0x9d4a=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','count','include','SalesforceConfiguration','findAll','rows','show','params','create','body','update','find','getFields','findOne','SalesforceField','sort','pick','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','set','Content-Range','apply','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9d4a,0x7e));var _0xa9d4=function(_0x3846d8,_0x2c622b){_0x3846d8=_0x3846d8-0x0;var _0x277c07=_0x9d4a[_0x3846d8];return _0x277c07;};'use strict';var emlformat=require(_0xa9d4('0x0'));var rimraf=require(_0xa9d4('0x1'));var zipdir=require(_0xa9d4('0x2'));var jsonpatch=require(_0xa9d4('0x3'));var rp=require(_0xa9d4('0x4'));var moment=require(_0xa9d4('0x5'));var BPromise=require(_0xa9d4('0x6'));var Mustache=require(_0xa9d4('0x7'));var util=require(_0xa9d4('0x8'));var path=require(_0xa9d4('0x9'));var sox=require(_0xa9d4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9d4('0xb'));var _=require(_0xa9d4('0xc'));var squel=require(_0xa9d4('0xd'));var crypto=require(_0xa9d4('0xe'));var jsforce=require(_0xa9d4('0xf'));var deskjs=require(_0xa9d4('0x10'));var toCsv=require(_0xa9d4('0x11'));var querystring=require(_0xa9d4('0x12'));var Papa=require(_0xa9d4('0x13'));var Redis=require(_0xa9d4('0x14'));var authService=require(_0xa9d4('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xa9d4('0x16'));var hardwareService=require(_0xa9d4('0x17'));var logger=require(_0xa9d4('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xa9d4('0x19'));var licenseUtil=require(_0xa9d4('0x1a'));var db=require(_0xa9d4('0x1b'))['db'];var jayson=require(_0xa9d4('0x1c'));var client=jayson[_0xa9d4('0x1d')][_0xa9d4('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x106596,_0x5b09ca,_0x42f3ed,_0x564ae9){return new BPromise(function(_0x43151c,_0x40228f){var _0x48c0a0=_0x564ae9||client;return _0x48c0a0['request'](_0x106596,_0x42f3ed)[_0xa9d4('0x1f')](function(_0x56c2b3){logger[_0xa9d4('0x20')](_0xa9d4('0x21'),_0x5b09ca,_0xa9d4('0x22'));logger[_0xa9d4('0x23')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5b09ca,'request\x20sent',JSON[_0xa9d4('0x24')](_0x56c2b3));if(_0x56c2b3['error']){if(_0x56c2b3[_0xa9d4('0x25')][_0xa9d4('0x26')]===0x1f4){logger['error'](_0xa9d4('0x21'),_0x5b09ca,_0x56c2b3[_0xa9d4('0x25')][_0xa9d4('0x27')]);return _0x40228f(_0x56c2b3[_0xa9d4('0x25')][_0xa9d4('0x27')]);}logger[_0xa9d4('0x25')](_0xa9d4('0x21'),_0x5b09ca,_0x56c2b3[_0xa9d4('0x25')][_0xa9d4('0x27')]);return _0x43151c(_0x56c2b3[_0xa9d4('0x25')][_0xa9d4('0x27')]);}else{logger[_0xa9d4('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5b09ca,_0xa9d4('0x22'));_0x43151c(_0x56c2b3['result']['message']);}})[_0xa9d4('0x28')](function(_0x4d6b18){logger[_0xa9d4('0x25')](_0xa9d4('0x21'),_0x5b09ca,_0x4d6b18);_0x40228f(_0x4d6b18);});});}function respondWithStatusCode(_0x55be7e,_0x36c450){_0x36c450=_0x36c450||0xcc;return function(_0x31eb3f){if(_0x31eb3f){return _0x55be7e['sendStatus'](_0x36c450);}return _0x55be7e[_0xa9d4('0x29')](_0x36c450)[_0xa9d4('0x2a')]();};}function respondWithResult(_0x381a8a,_0x444fc7){_0x444fc7=_0x444fc7||0xc8;return function(_0x5a8ad3){if(_0x5a8ad3){return _0x381a8a[_0xa9d4('0x29')](_0x444fc7)[_0xa9d4('0x2b')](_0x5a8ad3);}};}function respondWithFilteredResult(_0x36ffe7,_0x34f098){return function(_0xf3fc14){if(_0xf3fc14){var _0x1fedb7=typeof _0x34f098[_0xa9d4('0x2c')]===_0xa9d4('0x2d')&&typeof _0x34f098['limit']===_0xa9d4('0x2d');var _0x123583=_0xf3fc14['count'];var _0x8c4bc2=_0x1fedb7?0x0:_0x34f098[_0xa9d4('0x2c')];var _0xd25ae7=_0x1fedb7?_0xf3fc14['count']:_0x34f098['offset']+_0x34f098[_0xa9d4('0x2e')];var _0x1c83a3;if(_0xd25ae7>=_0x123583){_0xd25ae7=_0x123583;_0x1c83a3=0xc8;}else{_0x1c83a3=0xce;}_0x36ffe7[_0xa9d4('0x29')](_0x1c83a3);return _0x36ffe7[_0xa9d4('0x2f')](_0xa9d4('0x30'),_0x8c4bc2+'-'+_0xd25ae7+'/'+_0x123583)[_0xa9d4('0x2b')](_0xf3fc14);}return null;};}function patchUpdates(_0x4a2528){return function(_0x5022f8){try{jsonpatch[_0xa9d4('0x31')](_0x5022f8,_0x4a2528,!![]);}catch(_0xd032e5){return BPromise['reject'](_0xd032e5);}return _0x5022f8['save']();};}function saveUpdates(_0x12a11a,_0x746632){return function(_0x211358){if(_0x211358){return _0x211358['update'](_0x12a11a)[_0xa9d4('0x1f')](function(_0x3641d9){return _0x3641d9;});}return null;};}function removeEntity(_0x24538c,_0x1e2bd3){return function(_0x1911dd){if(_0x1911dd){return _0x1911dd[_0xa9d4('0x32')]()[_0xa9d4('0x1f')](function(){_0x24538c[_0xa9d4('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5c3c,_0x384a06){return function(_0x5c3179){if(!_0x5c3179){_0x1b5c3c[_0xa9d4('0x33')](0x194);}return _0x5c3179;};}function handleError(_0x409090,_0x2aad09){_0x2aad09=_0x2aad09||0x1f4;return function(_0x3eb86d){logger['error'](_0x3eb86d[_0xa9d4('0x34')]);if(_0x3eb86d[_0xa9d4('0x35')]){delete _0x3eb86d['name'];}_0x409090[_0xa9d4('0x29')](_0x2aad09)[_0xa9d4('0x36')](_0x3eb86d);};}exports['index']=function(_0xea7b4e,_0x3f5a94){var _0x534c72={},_0x365ef6={},_0x1de7a4={'count':0x0,'rows':[]};var _0x122bc0=_[_0xa9d4('0x37')](db['SalesforceConfiguration'][_0xa9d4('0x38')],function(_0xd91c2a){return{'name':_0xd91c2a[_0xa9d4('0x39')],'type':_0xd91c2a['type'][_0xa9d4('0x3a')]};});_0x365ef6['model']=_['map'](_0x122bc0,_0xa9d4('0x35'));_0x365ef6[_0xa9d4('0x3b')]=_[_0xa9d4('0x3c')](_0xea7b4e[_0xa9d4('0x3b')]);_0x365ef6[_0xa9d4('0x3d')]=_[_0xa9d4('0x3e')](_0x365ef6[_0xa9d4('0x3f')],_0x365ef6[_0xa9d4('0x3b')]);_0x534c72[_0xa9d4('0x40')]=_[_0xa9d4('0x3e')](_0x365ef6[_0xa9d4('0x3f')],qs['fields'](_0xea7b4e[_0xa9d4('0x3b')][_0xa9d4('0x41')]));_0x534c72['attributes']=_0x534c72[_0xa9d4('0x40')][_0xa9d4('0x42')]?_0x534c72[_0xa9d4('0x40')]:_0x365ef6['model'];if(!_0xea7b4e['query'][_0xa9d4('0x43')](_0xa9d4('0x44'))){_0x534c72[_0xa9d4('0x2e')]=qs[_0xa9d4('0x2e')](_0xea7b4e[_0xa9d4('0x3b')][_0xa9d4('0x2e')]);_0x534c72['offset']=qs[_0xa9d4('0x2c')](_0xea7b4e[_0xa9d4('0x3b')]['offset']);}_0x534c72[_0xa9d4('0x45')]=qs['sort'](_0xea7b4e[_0xa9d4('0x3b')]['sort']);_0x534c72[_0xa9d4('0x46')]=qs['filters'](_['pick'](_0xea7b4e[_0xa9d4('0x3b')],_0x365ef6[_0xa9d4('0x3d')]),_0x122bc0);if(_0xea7b4e[_0xa9d4('0x3b')][_0xa9d4('0x47')]){_0x534c72[_0xa9d4('0x46')]=_[_0xa9d4('0x48')](_0x534c72[_0xa9d4('0x46')],{'$or':_['map'](_0x122bc0,function(_0x3be87b){if(_0x3be87b[_0xa9d4('0x49')]!==_0xa9d4('0x4a')){var _0x45a695={};_0x45a695[_0x3be87b[_0xa9d4('0x35')]]={'$like':'%'+_0xea7b4e[_0xa9d4('0x3b')][_0xa9d4('0x47')]+'%'};return _0x45a695;}})});}_0x534c72=_['merge']({},_0x534c72,_0xea7b4e['options']);var _0x5b7999={'where':_0x534c72[_0xa9d4('0x46')]};return db['SalesforceConfiguration']['count'](_0x5b7999)[_0xa9d4('0x1f')](function(_0x11b518){_0x1de7a4[_0xa9d4('0x4b')]=_0x11b518;if(_0xea7b4e[_0xa9d4('0x3b')]['includeAll']){_0x534c72[_0xa9d4('0x4c')]=[{'all':!![]}];}return db[_0xa9d4('0x4d')][_0xa9d4('0x4e')](_0x534c72);})[_0xa9d4('0x1f')](function(_0x511ea8){_0x1de7a4[_0xa9d4('0x4f')]=_0x511ea8;return _0x1de7a4;})[_0xa9d4('0x1f')](respondWithFilteredResult(_0x3f5a94,_0x534c72))[_0xa9d4('0x28')](handleError(_0x3f5a94,null));};exports[_0xa9d4('0x50')]=function(_0xbf9fde,_0x4f364c){var _0x3d88fd={'raw':![],'where':{'id':_0xbf9fde[_0xa9d4('0x51')]['id']}},_0x24513e={};_0x24513e[_0xa9d4('0x3f')]=_['keys'](db[_0xa9d4('0x4d')]['rawAttributes']);_0x24513e['query']=_[_0xa9d4('0x3c')](_0xbf9fde[_0xa9d4('0x3b')]);_0x24513e[_0xa9d4('0x3d')]=_[_0xa9d4('0x3e')](_0x24513e[_0xa9d4('0x3f')],_0x24513e[_0xa9d4('0x3b')]);_0x3d88fd['attributes']=_[_0xa9d4('0x3e')](_0x24513e['model'],qs['fields'](_0xbf9fde[_0xa9d4('0x3b')][_0xa9d4('0x41')]));_0x3d88fd[_0xa9d4('0x40')]=_0x3d88fd[_0xa9d4('0x40')][_0xa9d4('0x42')]?_0x3d88fd[_0xa9d4('0x40')]:_0x24513e[_0xa9d4('0x3f')];if(_0xbf9fde['query']['includeAll']){_0x3d88fd[_0xa9d4('0x4c')]=[{'all':!![]}];}_0x3d88fd=_[_0xa9d4('0x48')]({},_0x3d88fd,_0xbf9fde['options']);return db[_0xa9d4('0x4d')]['find'](_0x3d88fd)[_0xa9d4('0x1f')](handleEntityNotFound(_0x4f364c,null))[_0xa9d4('0x1f')](respondWithResult(_0x4f364c,null))[_0xa9d4('0x28')](handleError(_0x4f364c,null));};exports[_0xa9d4('0x52')]=function(_0x19171b,_0x329f54){return db[_0xa9d4('0x4d')]['create'](_0x19171b[_0xa9d4('0x53')],{})[_0xa9d4('0x1f')](respondWithResult(_0x329f54,0xc9))[_0xa9d4('0x28')](handleError(_0x329f54,null));};exports[_0xa9d4('0x54')]=function(_0x14c2c2,_0x4317f3){if(_0x14c2c2['body']['id']){delete _0x14c2c2[_0xa9d4('0x53')]['id'];}return db[_0xa9d4('0x4d')][_0xa9d4('0x55')]({'where':{'id':_0x14c2c2['params']['id']}})[_0xa9d4('0x1f')](handleEntityNotFound(_0x4317f3,null))[_0xa9d4('0x1f')](saveUpdates(_0x14c2c2[_0xa9d4('0x53')],null))[_0xa9d4('0x1f')](respondWithResult(_0x4317f3,null))[_0xa9d4('0x28')](handleError(_0x4317f3,null));};exports[_0xa9d4('0x32')]=function(_0x556338,_0x6f6621){return db[_0xa9d4('0x4d')][_0xa9d4('0x55')]({'where':{'id':_0x556338[_0xa9d4('0x51')]['id']}})['then'](handleEntityNotFound(_0x6f6621,null))['then'](removeEntity(_0x6f6621,null))['catch'](handleError(_0x6f6621,null));};exports[_0xa9d4('0x56')]=function(_0x394f2b,_0x5c37d3,_0xcfc670){var _0x5e3a81={};var _0x2045ac={};var _0x4d309a;var _0x546201;return db[_0xa9d4('0x4d')][_0xa9d4('0x57')]({'where':{'id':_0x394f2b['params']['id']}})[_0xa9d4('0x1f')](handleEntityNotFound(_0x5c37d3,null))['then'](function(_0x3d7d00){if(_0x3d7d00){_0x4d309a=_0x3d7d00;_0x2045ac['model']=_[_0xa9d4('0x3c')](db[_0xa9d4('0x58')][_0xa9d4('0x38')]);_0x2045ac['query']=_[_0xa9d4('0x3c')](_0x394f2b[_0xa9d4('0x3b')]);_0x2045ac[_0xa9d4('0x3d')]=_[_0xa9d4('0x3e')](_0x2045ac[_0xa9d4('0x3f')],_0x2045ac[_0xa9d4('0x3b')]);_0x5e3a81[_0xa9d4('0x40')]=_[_0xa9d4('0x3e')](_0x2045ac[_0xa9d4('0x3f')],qs[_0xa9d4('0x41')](_0x394f2b[_0xa9d4('0x3b')]['fields']));_0x5e3a81[_0xa9d4('0x40')]=_0x5e3a81[_0xa9d4('0x40')][_0xa9d4('0x42')]?_0x5e3a81[_0xa9d4('0x40')]:_0x2045ac['model'];_0x5e3a81[_0xa9d4('0x45')]=qs[_0xa9d4('0x59')](_0x394f2b['query'][_0xa9d4('0x59')]);_0x5e3a81[_0xa9d4('0x46')]=qs[_0xa9d4('0x3d')](_[_0xa9d4('0x5a')](_0x394f2b[_0xa9d4('0x3b')],_0x2045ac[_0xa9d4('0x3d')]));if(_0x394f2b['query'][_0xa9d4('0x47')]){_0x5e3a81[_0xa9d4('0x46')]=_[_0xa9d4('0x48')](_0x5e3a81['where'],{'$or':_[_0xa9d4('0x37')](_0x5e3a81[_0xa9d4('0x40')],function(_0x236c00){var _0x16ec8d={};_0x16ec8d[_0x236c00]={'$like':'%'+_0x394f2b['query']['filter']+'%'};return _0x16ec8d;})});}_0x5e3a81=_['merge']({},_0x5e3a81,_0x394f2b[_0xa9d4('0x5b')]);return _0x4d309a[_0xa9d4('0x56')](_0x5e3a81);}})[_0xa9d4('0x1f')](function(_0x28af65){if(_0x28af65){_0x546201=_0x28af65[_0xa9d4('0x42')];if(!_0x394f2b[_0xa9d4('0x3b')][_0xa9d4('0x43')](_0xa9d4('0x44'))){_0x5e3a81[_0xa9d4('0x2e')]=qs[_0xa9d4('0x2e')](_0x394f2b[_0xa9d4('0x3b')][_0xa9d4('0x2e')]);_0x5e3a81[_0xa9d4('0x2c')]=qs[_0xa9d4('0x2c')](_0x394f2b[_0xa9d4('0x3b')]['offset']);}return _0x4d309a[_0xa9d4('0x56')](_0x5e3a81);}})['then'](function(_0x187686){if(_0x187686){return _0x187686?{'count':_0x546201,'rows':_0x187686}:null;}})['then'](respondWithResult(_0x5c37d3,null))[_0xa9d4('0x28')](handleError(_0x5c37d3,null));};exports['getSubjects']=function(_0x25cd64,_0x30b7d4,_0xb715f8){var _0x525a5d={};var _0x234f99={};var _0x1bf98e;var _0x2ae5d2;return db[_0xa9d4('0x4d')][_0xa9d4('0x57')]({'where':{'id':_0x25cd64[_0xa9d4('0x51')]['id']}})[_0xa9d4('0x1f')](handleEntityNotFound(_0x30b7d4,null))[_0xa9d4('0x1f')](function(_0x5c7e2b){if(_0x5c7e2b){_0x1bf98e=_0x5c7e2b;_0x234f99[_0xa9d4('0x3f')]=_[_0xa9d4('0x3c')](db[_0xa9d4('0x58')][_0xa9d4('0x38')]);_0x234f99[_0xa9d4('0x3b')]=_[_0xa9d4('0x3c')](_0x25cd64[_0xa9d4('0x3b')]);_0x234f99[_0xa9d4('0x3d')]=_[_0xa9d4('0x3e')](_0x234f99[_0xa9d4('0x3f')],_0x234f99[_0xa9d4('0x3b')]);_0x525a5d[_0xa9d4('0x40')]=_['intersection'](_0x234f99[_0xa9d4('0x3f')],qs[_0xa9d4('0x41')](_0x25cd64[_0xa9d4('0x3b')][_0xa9d4('0x41')]));_0x525a5d['attributes']=_0x525a5d['attributes']['length']?_0x525a5d[_0xa9d4('0x40')]:_0x234f99[_0xa9d4('0x3f')];_0x525a5d[_0xa9d4('0x45')]=qs[_0xa9d4('0x59')](_0x25cd64[_0xa9d4('0x3b')][_0xa9d4('0x59')]);_0x525a5d['where']=qs[_0xa9d4('0x3d')](_[_0xa9d4('0x5a')](_0x25cd64[_0xa9d4('0x3b')],_0x234f99[_0xa9d4('0x3d')]));if(_0x25cd64[_0xa9d4('0x3b')][_0xa9d4('0x47')]){_0x525a5d[_0xa9d4('0x46')]=_['merge'](_0x525a5d[_0xa9d4('0x46')],{'$or':_['map'](_0x525a5d[_0xa9d4('0x40')],function(_0x251dc0){var _0x5365b9={};_0x5365b9[_0x251dc0]={'$like':'%'+_0x25cd64[_0xa9d4('0x3b')][_0xa9d4('0x47')]+'%'};return _0x5365b9;})});}_0x525a5d=_['merge']({},_0x525a5d,_0x25cd64['options']);return _0x1bf98e['getSubjects'](_0x525a5d);}})['then'](function(_0x2bfbe9){if(_0x2bfbe9){_0x2ae5d2=_0x2bfbe9[_0xa9d4('0x42')];if(!_0x25cd64[_0xa9d4('0x3b')]['hasOwnProperty'](_0xa9d4('0x44'))){_0x525a5d['limit']=qs[_0xa9d4('0x2e')](_0x25cd64[_0xa9d4('0x3b')][_0xa9d4('0x2e')]);_0x525a5d['offset']=qs[_0xa9d4('0x2c')](_0x25cd64[_0xa9d4('0x3b')][_0xa9d4('0x2c')]);}return _0x1bf98e[_0xa9d4('0x5c')](_0x525a5d);}})[_0xa9d4('0x1f')](function(_0x4dc57c){if(_0x4dc57c){return _0x4dc57c?{'count':_0x2ae5d2,'rows':_0x4dc57c}:null;}})[_0xa9d4('0x1f')](respondWithResult(_0x30b7d4,null))[_0xa9d4('0x28')](handleError(_0x30b7d4,null));};exports[_0xa9d4('0x5d')]=function(_0x15edaf,_0x32712e,_0x25b404){var _0x370cdb={};var _0x372bf6={};var _0x463e6d;var _0x284575;return db[_0xa9d4('0x4d')]['findOne']({'where':{'id':_0x15edaf[_0xa9d4('0x51')]['id']}})[_0xa9d4('0x1f')](handleEntityNotFound(_0x32712e,null))[_0xa9d4('0x1f')](function(_0x27d5e0){if(_0x27d5e0){_0x463e6d=_0x27d5e0;_0x372bf6[_0xa9d4('0x3f')]=_['keys'](db[_0xa9d4('0x58')][_0xa9d4('0x38')]);_0x372bf6[_0xa9d4('0x3b')]=_[_0xa9d4('0x3c')](_0x15edaf[_0xa9d4('0x3b')]);_0x372bf6[_0xa9d4('0x3d')]=_[_0xa9d4('0x3e')](_0x372bf6[_0xa9d4('0x3f')],_0x372bf6[_0xa9d4('0x3b')]);_0x370cdb[_0xa9d4('0x40')]=_['intersection'](_0x372bf6[_0xa9d4('0x3f')],qs['fields'](_0x15edaf[_0xa9d4('0x3b')]['fields']));_0x370cdb[_0xa9d4('0x40')]=_0x370cdb['attributes'][_0xa9d4('0x42')]?_0x370cdb[_0xa9d4('0x40')]:_0x372bf6[_0xa9d4('0x3f')];_0x370cdb[_0xa9d4('0x45')]=qs[_0xa9d4('0x59')](_0x15edaf[_0xa9d4('0x3b')][_0xa9d4('0x59')]);_0x370cdb[_0xa9d4('0x46')]=qs[_0xa9d4('0x3d')](_['pick'](_0x15edaf['query'],_0x372bf6[_0xa9d4('0x3d')]));if(_0x15edaf[_0xa9d4('0x3b')][_0xa9d4('0x47')]){_0x370cdb[_0xa9d4('0x46')]=_[_0xa9d4('0x48')](_0x370cdb[_0xa9d4('0x46')],{'$or':_['map'](_0x370cdb['attributes'],function(_0x504681){var _0x1fccc6={};_0x1fccc6[_0x504681]={'$like':'%'+_0x15edaf[_0xa9d4('0x3b')][_0xa9d4('0x47')]+'%'};return _0x1fccc6;})});}_0x370cdb=_[_0xa9d4('0x48')]({},_0x370cdb,_0x15edaf[_0xa9d4('0x5b')]);return _0x463e6d[_0xa9d4('0x5d')](_0x370cdb);}})['then'](function(_0x5d89d6){if(_0x5d89d6){_0x284575=_0x5d89d6[_0xa9d4('0x42')];if(!_0x15edaf[_0xa9d4('0x3b')][_0xa9d4('0x43')](_0xa9d4('0x44'))){_0x370cdb['limit']=qs[_0xa9d4('0x2e')](_0x15edaf[_0xa9d4('0x3b')][_0xa9d4('0x2e')]);_0x370cdb[_0xa9d4('0x2c')]=qs[_0xa9d4('0x2c')](_0x15edaf[_0xa9d4('0x3b')]['offset']);}return _0x463e6d[_0xa9d4('0x5d')](_0x370cdb);}})[_0xa9d4('0x1f')](function(_0x591869){if(_0x591869){return _0x591869?{'count':_0x284575,'rows':_0x591869}:null;}})[_0xa9d4('0x1f')](respondWithResult(_0x32712e,null))['catch'](handleError(_0x32712e,null));}; \ No newline at end of file +var _0xb5dc=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','undefined','offset','count','set','Content-Range','apply','update','destroy','stack','name','send','SalesforceConfiguration','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','fields','limit','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','model','length','create','body','find','getFields','pick','hasOwnProperty','nolimit','getSubjects','findOne','SalesforceField','getDescriptions','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x11d95f,_0x34f442){var _0x2b1a14=function(_0x3a4fa5){while(--_0x3a4fa5){_0x11d95f['push'](_0x11d95f['shift']());}};_0x2b1a14(++_0x34f442);}(_0xb5dc,0xe3));var _0xcb5d=function(_0x374640,_0x8a5170){_0x374640=_0x374640-0x0;var _0x1b6c4c=_0xb5dc[_0x374640];return _0x1b6c4c;};'use strict';var emlformat=require(_0xcb5d('0x0'));var rimraf=require(_0xcb5d('0x1'));var zipdir=require(_0xcb5d('0x2'));var jsonpatch=require(_0xcb5d('0x3'));var rp=require(_0xcb5d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcb5d('0x5'));var path=require(_0xcb5d('0x6'));var sox=require(_0xcb5d('0x7'));var csv=require(_0xcb5d('0x8'));var ejs=require(_0xcb5d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcb5d('0xa'));var crypto=require(_0xcb5d('0xb'));var jsforce=require(_0xcb5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb5d('0x8'));var querystring=require(_0xcb5d('0xd'));var Papa=require(_0xcb5d('0xe'));var Redis=require('ioredis');var authService=require(_0xcb5d('0xf'));var qs=require(_0xcb5d('0x10'));var as=require(_0xcb5d('0x11'));var hardwareService=require(_0xcb5d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xcb5d('0x13'));var config=require(_0xcb5d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xcb5d('0x15'));var client=jayson[_0xcb5d('0x16')][_0xcb5d('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e53df,_0x149625,_0x14c109,_0x33c1e8){return new BPromise(function(_0x32ae8c,_0x888310){var _0x48de97=_0x33c1e8||client;return _0x48de97['request'](_0x4e53df,_0x14c109)[_0xcb5d('0x18')](function(_0x56e069){logger[_0xcb5d('0x19')](_0xcb5d('0x1a'),_0x149625,_0xcb5d('0x1b'));logger['debug'](_0xcb5d('0x1c'),_0x149625,'request\x20sent',JSON['stringify'](_0x56e069));if(_0x56e069[_0xcb5d('0x1d')]){if(_0x56e069['error']['code']===0x1f4){logger[_0xcb5d('0x1d')](_0xcb5d('0x1a'),_0x149625,_0x56e069['error'][_0xcb5d('0x1e')]);return _0x888310(_0x56e069[_0xcb5d('0x1d')][_0xcb5d('0x1e')]);}logger['error'](_0xcb5d('0x1a'),_0x149625,_0x56e069['error'][_0xcb5d('0x1e')]);return _0x32ae8c(_0x56e069['error'][_0xcb5d('0x1e')]);}else{logger[_0xcb5d('0x19')](_0xcb5d('0x1a'),_0x149625,_0xcb5d('0x1b'));_0x32ae8c(_0x56e069[_0xcb5d('0x1f')][_0xcb5d('0x1e')]);}})[_0xcb5d('0x20')](function(_0x5484d1){logger[_0xcb5d('0x1d')](_0xcb5d('0x1a'),_0x149625,_0x5484d1);_0x888310(_0x5484d1);});});}function respondWithStatusCode(_0x292c01,_0x19ea3e){_0x19ea3e=_0x19ea3e||0xcc;return function(_0x10d16d){if(_0x10d16d){return _0x292c01[_0xcb5d('0x21')](_0x19ea3e);}return _0x292c01['status'](_0x19ea3e)[_0xcb5d('0x22')]();};}function respondWithResult(_0x34930a,_0x3ad2ad){_0x3ad2ad=_0x3ad2ad||0xc8;return function(_0x505b75){if(_0x505b75){return _0x34930a[_0xcb5d('0x23')](_0x3ad2ad)[_0xcb5d('0x24')](_0x505b75);}};}function respondWithFilteredResult(_0x5cfea8,_0x2abcc3){return function(_0x1562b3){if(_0x1562b3){var _0x3ef042=typeof _0x2abcc3['offset']===_0xcb5d('0x25')&&typeof _0x2abcc3['limit']===_0xcb5d('0x25');var _0x421d1a=_0x1562b3['count'];var _0x467a0e=_0x3ef042?0x0:_0x2abcc3[_0xcb5d('0x26')];var _0x47cfd8=_0x3ef042?_0x1562b3[_0xcb5d('0x27')]:_0x2abcc3[_0xcb5d('0x26')]+_0x2abcc3['limit'];var _0x279ca3;if(_0x47cfd8>=_0x421d1a){_0x47cfd8=_0x421d1a;_0x279ca3=0xc8;}else{_0x279ca3=0xce;}_0x5cfea8['status'](_0x279ca3);return _0x5cfea8[_0xcb5d('0x28')](_0xcb5d('0x29'),_0x467a0e+'-'+_0x47cfd8+'/'+_0x421d1a)[_0xcb5d('0x24')](_0x1562b3);}return null;};}function patchUpdates(_0xd8611){return function(_0x5aed95){try{jsonpatch[_0xcb5d('0x2a')](_0x5aed95,_0xd8611,!![]);}catch(_0x3e733c){return BPromise['reject'](_0x3e733c);}return _0x5aed95['save']();};}function saveUpdates(_0x598797,_0x3445f0){return function(_0x2fdeb9){if(_0x2fdeb9){return _0x2fdeb9[_0xcb5d('0x2b')](_0x598797)[_0xcb5d('0x18')](function(_0xc255c){return _0xc255c;});}return null;};}function removeEntity(_0x5d4f6c,_0x52c86d){return function(_0x18d092){if(_0x18d092){return _0x18d092[_0xcb5d('0x2c')]()[_0xcb5d('0x18')](function(){_0x5d4f6c[_0xcb5d('0x23')](0xcc)[_0xcb5d('0x22')]();});}};}function handleEntityNotFound(_0x3a3cae,_0x32cf5f){return function(_0x1f4613){if(!_0x1f4613){_0x3a3cae['sendStatus'](0x194);}return _0x1f4613;};}function handleError(_0x40d638,_0x413a62){_0x413a62=_0x413a62||0x1f4;return function(_0x4a0619){logger['error'](_0x4a0619[_0xcb5d('0x2d')]);if(_0x4a0619[_0xcb5d('0x2e')]){delete _0x4a0619[_0xcb5d('0x2e')];}_0x40d638[_0xcb5d('0x23')](_0x413a62)[_0xcb5d('0x2f')](_0x4a0619);};}exports['index']=function(_0x3a8261,_0x4a71a9){var _0x3275a4={},_0x577770={},_0x55cd44={'count':0x0,'rows':[]};var _0x4f7511=_['map'](db[_0xcb5d('0x30')][_0xcb5d('0x31')],function(_0x67735f){return{'name':_0x67735f[_0xcb5d('0x32')],'type':_0x67735f[_0xcb5d('0x33')]['key']};});_0x577770['model']=_[_0xcb5d('0x34')](_0x4f7511,_0xcb5d('0x2e'));_0x577770[_0xcb5d('0x35')]=_[_0xcb5d('0x36')](_0x3a8261[_0xcb5d('0x35')]);_0x577770[_0xcb5d('0x37')]=_[_0xcb5d('0x38')](_0x577770['model'],_0x577770['query']);_0x3275a4[_0xcb5d('0x39')]=_[_0xcb5d('0x38')](_0x577770['model'],qs[_0xcb5d('0x3a')](_0x3a8261['query'][_0xcb5d('0x3a')]));_0x3275a4['attributes']=_0x3275a4[_0xcb5d('0x39')]['length']?_0x3275a4['attributes']:_0x577770['model'];if(!_0x3a8261['query']['hasOwnProperty']('nolimit')){_0x3275a4['limit']=qs['limit'](_0x3a8261[_0xcb5d('0x35')][_0xcb5d('0x3b')]);_0x3275a4[_0xcb5d('0x26')]=qs[_0xcb5d('0x26')](_0x3a8261[_0xcb5d('0x35')]['offset']);}_0x3275a4['order']=qs['sort'](_0x3a8261[_0xcb5d('0x35')][_0xcb5d('0x3c')]);_0x3275a4[_0xcb5d('0x3d')]=qs[_0xcb5d('0x37')](_['pick'](_0x3a8261[_0xcb5d('0x35')],_0x577770[_0xcb5d('0x37')]),_0x4f7511);if(_0x3a8261[_0xcb5d('0x35')][_0xcb5d('0x3e')]){_0x3275a4[_0xcb5d('0x3d')]=_[_0xcb5d('0x3f')](_0x3275a4[_0xcb5d('0x3d')],{'$or':_[_0xcb5d('0x34')](_0x4f7511,function(_0x3b29ef){if(_0x3b29ef['type']!=='VIRTUAL'){var _0x3baf8d={};_0x3baf8d[_0x3b29ef[_0xcb5d('0x2e')]]={'$like':'%'+_0x3a8261[_0xcb5d('0x35')]['filter']+'%'};return _0x3baf8d;}})});}_0x3275a4=_['merge']({},_0x3275a4,_0x3a8261[_0xcb5d('0x40')]);var _0x5dab90={'where':_0x3275a4[_0xcb5d('0x3d')]};return db[_0xcb5d('0x30')][_0xcb5d('0x27')](_0x5dab90)[_0xcb5d('0x18')](function(_0xf53e48){_0x55cd44['count']=_0xf53e48;if(_0x3a8261['query'][_0xcb5d('0x41')]){_0x3275a4[_0xcb5d('0x42')]=[{'all':!![]}];}return db[_0xcb5d('0x30')][_0xcb5d('0x43')](_0x3275a4);})[_0xcb5d('0x18')](function(_0xf592ea){_0x55cd44[_0xcb5d('0x44')]=_0xf592ea;return _0x55cd44;})[_0xcb5d('0x18')](respondWithFilteredResult(_0x4a71a9,_0x3275a4))[_0xcb5d('0x20')](handleError(_0x4a71a9,null));};exports[_0xcb5d('0x45')]=function(_0x31c0ba,_0x2e2828){var _0x991592={'raw':![],'where':{'id':_0x31c0ba[_0xcb5d('0x46')]['id']}},_0x290abf={};_0x290abf['model']=_[_0xcb5d('0x36')](db[_0xcb5d('0x30')][_0xcb5d('0x31')]);_0x290abf['query']=_[_0xcb5d('0x36')](_0x31c0ba[_0xcb5d('0x35')]);_0x290abf[_0xcb5d('0x37')]=_[_0xcb5d('0x38')](_0x290abf['model'],_0x290abf['query']);_0x991592[_0xcb5d('0x39')]=_['intersection'](_0x290abf[_0xcb5d('0x47')],qs[_0xcb5d('0x3a')](_0x31c0ba[_0xcb5d('0x35')][_0xcb5d('0x3a')]));_0x991592[_0xcb5d('0x39')]=_0x991592[_0xcb5d('0x39')][_0xcb5d('0x48')]?_0x991592[_0xcb5d('0x39')]:_0x290abf[_0xcb5d('0x47')];if(_0x31c0ba[_0xcb5d('0x35')]['includeAll']){_0x991592[_0xcb5d('0x42')]=[{'all':!![]}];}_0x991592=_[_0xcb5d('0x3f')]({},_0x991592,_0x31c0ba['options']);return db[_0xcb5d('0x30')]['find'](_0x991592)[_0xcb5d('0x18')](handleEntityNotFound(_0x2e2828,null))['then'](respondWithResult(_0x2e2828,null))[_0xcb5d('0x20')](handleError(_0x2e2828,null));};exports[_0xcb5d('0x49')]=function(_0x2e9914,_0x3b3e6f){return db[_0xcb5d('0x30')][_0xcb5d('0x49')](_0x2e9914[_0xcb5d('0x4a')],{})[_0xcb5d('0x18')](respondWithResult(_0x3b3e6f,0xc9))[_0xcb5d('0x20')](handleError(_0x3b3e6f,null));};exports[_0xcb5d('0x2b')]=function(_0x2b0692,_0x59b172){if(_0x2b0692['body']['id']){delete _0x2b0692['body']['id'];}return db[_0xcb5d('0x30')]['find']({'where':{'id':_0x2b0692[_0xcb5d('0x46')]['id']}})['then'](handleEntityNotFound(_0x59b172,null))[_0xcb5d('0x18')](saveUpdates(_0x2b0692['body'],null))[_0xcb5d('0x18')](respondWithResult(_0x59b172,null))['catch'](handleError(_0x59b172,null));};exports[_0xcb5d('0x2c')]=function(_0x3da3bf,_0x62a18a){return db[_0xcb5d('0x30')][_0xcb5d('0x4b')]({'where':{'id':_0x3da3bf['params']['id']}})[_0xcb5d('0x18')](handleEntityNotFound(_0x62a18a,null))[_0xcb5d('0x18')](removeEntity(_0x62a18a,null))[_0xcb5d('0x20')](handleError(_0x62a18a,null));};exports[_0xcb5d('0x4c')]=function(_0x3bbcd8,_0x3ed671,_0xd8653f){var _0x1689fb={};var _0x3f784f={};var _0x189244;var _0x2ec96c;return db[_0xcb5d('0x30')]['findOne']({'where':{'id':_0x3bbcd8[_0xcb5d('0x46')]['id']}})[_0xcb5d('0x18')](handleEntityNotFound(_0x3ed671,null))[_0xcb5d('0x18')](function(_0x1d9075){if(_0x1d9075){_0x189244=_0x1d9075;_0x3f784f[_0xcb5d('0x47')]=_['keys'](db['SalesforceField'][_0xcb5d('0x31')]);_0x3f784f[_0xcb5d('0x35')]=_['keys'](_0x3bbcd8['query']);_0x3f784f[_0xcb5d('0x37')]=_[_0xcb5d('0x38')](_0x3f784f[_0xcb5d('0x47')],_0x3f784f['query']);_0x1689fb['attributes']=_[_0xcb5d('0x38')](_0x3f784f[_0xcb5d('0x47')],qs[_0xcb5d('0x3a')](_0x3bbcd8[_0xcb5d('0x35')][_0xcb5d('0x3a')]));_0x1689fb['attributes']=_0x1689fb[_0xcb5d('0x39')][_0xcb5d('0x48')]?_0x1689fb[_0xcb5d('0x39')]:_0x3f784f[_0xcb5d('0x47')];_0x1689fb['order']=qs[_0xcb5d('0x3c')](_0x3bbcd8[_0xcb5d('0x35')][_0xcb5d('0x3c')]);_0x1689fb[_0xcb5d('0x3d')]=qs[_0xcb5d('0x37')](_[_0xcb5d('0x4d')](_0x3bbcd8[_0xcb5d('0x35')],_0x3f784f[_0xcb5d('0x37')]));if(_0x3bbcd8['query']['filter']){_0x1689fb[_0xcb5d('0x3d')]=_[_0xcb5d('0x3f')](_0x1689fb[_0xcb5d('0x3d')],{'$or':_[_0xcb5d('0x34')](_0x1689fb[_0xcb5d('0x39')],function(_0x2f9707){var _0x3ce81b={};_0x3ce81b[_0x2f9707]={'$like':'%'+_0x3bbcd8[_0xcb5d('0x35')][_0xcb5d('0x3e')]+'%'};return _0x3ce81b;})});}_0x1689fb=_['merge']({},_0x1689fb,_0x3bbcd8[_0xcb5d('0x40')]);return _0x189244[_0xcb5d('0x4c')](_0x1689fb);}})['then'](function(_0x4e19e5){if(_0x4e19e5){_0x2ec96c=_0x4e19e5[_0xcb5d('0x48')];if(!_0x3bbcd8[_0xcb5d('0x35')][_0xcb5d('0x4e')](_0xcb5d('0x4f'))){_0x1689fb['limit']=qs[_0xcb5d('0x3b')](_0x3bbcd8[_0xcb5d('0x35')][_0xcb5d('0x3b')]);_0x1689fb[_0xcb5d('0x26')]=qs['offset'](_0x3bbcd8[_0xcb5d('0x35')]['offset']);}return _0x189244[_0xcb5d('0x4c')](_0x1689fb);}})[_0xcb5d('0x18')](function(_0x3c058d){if(_0x3c058d){return _0x3c058d?{'count':_0x2ec96c,'rows':_0x3c058d}:null;}})[_0xcb5d('0x18')](respondWithResult(_0x3ed671,null))[_0xcb5d('0x20')](handleError(_0x3ed671,null));};exports[_0xcb5d('0x50')]=function(_0xb8ebc3,_0x2a9365,_0x5bc2a4){var _0x2b842e={};var _0x31e33f={};var _0x51c846;var _0x2872bf;return db[_0xcb5d('0x30')][_0xcb5d('0x51')]({'where':{'id':_0xb8ebc3[_0xcb5d('0x46')]['id']}})[_0xcb5d('0x18')](handleEntityNotFound(_0x2a9365,null))[_0xcb5d('0x18')](function(_0x1a75a8){if(_0x1a75a8){_0x51c846=_0x1a75a8;_0x31e33f[_0xcb5d('0x47')]=_[_0xcb5d('0x36')](db[_0xcb5d('0x52')]['rawAttributes']);_0x31e33f[_0xcb5d('0x35')]=_[_0xcb5d('0x36')](_0xb8ebc3[_0xcb5d('0x35')]);_0x31e33f[_0xcb5d('0x37')]=_['intersection'](_0x31e33f[_0xcb5d('0x47')],_0x31e33f['query']);_0x2b842e[_0xcb5d('0x39')]=_[_0xcb5d('0x38')](_0x31e33f[_0xcb5d('0x47')],qs[_0xcb5d('0x3a')](_0xb8ebc3[_0xcb5d('0x35')]['fields']));_0x2b842e[_0xcb5d('0x39')]=_0x2b842e[_0xcb5d('0x39')][_0xcb5d('0x48')]?_0x2b842e['attributes']:_0x31e33f['model'];_0x2b842e['order']=qs['sort'](_0xb8ebc3[_0xcb5d('0x35')][_0xcb5d('0x3c')]);_0x2b842e[_0xcb5d('0x3d')]=qs[_0xcb5d('0x37')](_[_0xcb5d('0x4d')](_0xb8ebc3['query'],_0x31e33f[_0xcb5d('0x37')]));if(_0xb8ebc3[_0xcb5d('0x35')][_0xcb5d('0x3e')]){_0x2b842e[_0xcb5d('0x3d')]=_[_0xcb5d('0x3f')](_0x2b842e[_0xcb5d('0x3d')],{'$or':_['map'](_0x2b842e[_0xcb5d('0x39')],function(_0xe2e1dd){var _0x543701={};_0x543701[_0xe2e1dd]={'$like':'%'+_0xb8ebc3['query'][_0xcb5d('0x3e')]+'%'};return _0x543701;})});}_0x2b842e=_['merge']({},_0x2b842e,_0xb8ebc3[_0xcb5d('0x40')]);return _0x51c846['getSubjects'](_0x2b842e);}})[_0xcb5d('0x18')](function(_0x156a59){if(_0x156a59){_0x2872bf=_0x156a59[_0xcb5d('0x48')];if(!_0xb8ebc3['query']['hasOwnProperty'](_0xcb5d('0x4f'))){_0x2b842e[_0xcb5d('0x3b')]=qs[_0xcb5d('0x3b')](_0xb8ebc3[_0xcb5d('0x35')][_0xcb5d('0x3b')]);_0x2b842e[_0xcb5d('0x26')]=qs[_0xcb5d('0x26')](_0xb8ebc3[_0xcb5d('0x35')][_0xcb5d('0x26')]);}return _0x51c846[_0xcb5d('0x50')](_0x2b842e);}})[_0xcb5d('0x18')](function(_0x45749c){if(_0x45749c){return _0x45749c?{'count':_0x2872bf,'rows':_0x45749c}:null;}})[_0xcb5d('0x18')](respondWithResult(_0x2a9365,null))['catch'](handleError(_0x2a9365,null));};exports[_0xcb5d('0x53')]=function(_0x5e462b,_0x309d97,_0x356ffa){var _0x300d9f={};var _0x3eaf1f={};var _0x121045;var _0xc94db6;return db[_0xcb5d('0x30')][_0xcb5d('0x51')]({'where':{'id':_0x5e462b[_0xcb5d('0x46')]['id']}})['then'](handleEntityNotFound(_0x309d97,null))['then'](function(_0x3fc163){if(_0x3fc163){_0x121045=_0x3fc163;_0x3eaf1f[_0xcb5d('0x47')]=_[_0xcb5d('0x36')](db['SalesforceField'][_0xcb5d('0x31')]);_0x3eaf1f[_0xcb5d('0x35')]=_[_0xcb5d('0x36')](_0x5e462b[_0xcb5d('0x35')]);_0x3eaf1f[_0xcb5d('0x37')]=_[_0xcb5d('0x38')](_0x3eaf1f[_0xcb5d('0x47')],_0x3eaf1f[_0xcb5d('0x35')]);_0x300d9f['attributes']=_[_0xcb5d('0x38')](_0x3eaf1f['model'],qs[_0xcb5d('0x3a')](_0x5e462b['query'][_0xcb5d('0x3a')]));_0x300d9f['attributes']=_0x300d9f[_0xcb5d('0x39')][_0xcb5d('0x48')]?_0x300d9f['attributes']:_0x3eaf1f[_0xcb5d('0x47')];_0x300d9f[_0xcb5d('0x54')]=qs[_0xcb5d('0x3c')](_0x5e462b[_0xcb5d('0x35')]['sort']);_0x300d9f[_0xcb5d('0x3d')]=qs[_0xcb5d('0x37')](_[_0xcb5d('0x4d')](_0x5e462b[_0xcb5d('0x35')],_0x3eaf1f[_0xcb5d('0x37')]));if(_0x5e462b['query'][_0xcb5d('0x3e')]){_0x300d9f[_0xcb5d('0x3d')]=_[_0xcb5d('0x3f')](_0x300d9f[_0xcb5d('0x3d')],{'$or':_[_0xcb5d('0x34')](_0x300d9f[_0xcb5d('0x39')],function(_0x29311e){var _0x5ec292={};_0x5ec292[_0x29311e]={'$like':'%'+_0x5e462b[_0xcb5d('0x35')]['filter']+'%'};return _0x5ec292;})});}_0x300d9f=_[_0xcb5d('0x3f')]({},_0x300d9f,_0x5e462b[_0xcb5d('0x40')]);return _0x121045['getDescriptions'](_0x300d9f);}})[_0xcb5d('0x18')](function(_0x26a831){if(_0x26a831){_0xc94db6=_0x26a831[_0xcb5d('0x48')];if(!_0x5e462b[_0xcb5d('0x35')][_0xcb5d('0x4e')](_0xcb5d('0x4f'))){_0x300d9f[_0xcb5d('0x3b')]=qs[_0xcb5d('0x3b')](_0x5e462b[_0xcb5d('0x35')][_0xcb5d('0x3b')]);_0x300d9f[_0xcb5d('0x26')]=qs[_0xcb5d('0x26')](_0x5e462b['query'][_0xcb5d('0x26')]);}return _0x121045[_0xcb5d('0x53')](_0x300d9f);}})['then'](function(_0x2ac934){if(_0x2ac934){return _0x2ac934?{'count':_0xc94db6,'rows':_0x2ac934}:null;}})[_0xcb5d('0x18')](respondWithResult(_0x309d97,null))[_0xcb5d('0x20')](handleError(_0x309d97,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ebd7b0e..f8a5234 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 _0x7d07=['./intSalesforceConfiguration.attributes','exports','define','lodash','api','moment','request-promise','rimraf','../../config/environment'];(function(_0xe298d1,_0x4c10db){var _0xd0825=function(_0x3b6c6f){while(--_0x3b6c6f){_0xe298d1['push'](_0xe298d1['shift']());}};_0xd0825(++_0x4c10db);}(_0x7d07,0xdb));var _0x77d0=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x7d07[_0x22431e];return _0xd978e9;};'use strict';var _=require(_0x77d0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x77d0('0x1'));var moment=require(_0x77d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x77d0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77d0('0x4'));var config=require(_0x77d0('0x5'));var attributes=require(_0x77d0('0x6'));module[_0x77d0('0x7')]=function(_0x5e8aa2,_0xa669b1){return _0x5e8aa2[_0x77d0('0x8')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8c8=['request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','int_salesforce_configurations','lodash','api','moment','bluebird'];(function(_0xf3f5b3,_0x455b64){var _0xb34ecb=function(_0x3efc4a){while(--_0x3efc4a){_0xf3f5b3['push'](_0xf3f5b3['shift']());}};_0xb34ecb(++_0x455b64);}(_0xa8c8,0x9c));var _0x8a8c=function(_0x41733a,_0x5577f3){_0x41733a=_0x41733a-0x0;var _0x4f15f6=_0xa8c8[_0x41733a];return _0x4f15f6;};'use strict';var _=require(_0x8a8c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8a8c('0x1'));var moment=require(_0x8a8c('0x2'));var BPromise=require(_0x8a8c('0x3'));var rp=require(_0x8a8c('0x4'));var fs=require('fs');var path=require(_0x8a8c('0x5'));var rimraf=require('rimraf');var config=require(_0x8a8c('0x6'));var attributes=require(_0x8a8c('0x7'));module['exports']=function(_0x17af9d,_0x3764e6){return _0x17af9d['define'](_0x8a8c('0x8'),attributes,{'tableName':_0x8a8c('0x9'),'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 c7380cb..d026037 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 _0xe00f=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result'];(function(_0xf333d2,_0x44d7f8){var _0x39fadb=function(_0x42d01a){while(--_0x42d01a){_0xf333d2['push'](_0xf333d2['shift']());}};_0x39fadb(++_0x44d7f8);}(_0xe00f,0x168));var _0xfe00=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0xe00f[_0x2b6600];return _0x912ee2;};'use strict';var _=require(_0xfe00('0x0'));var util=require(_0xfe00('0x1'));var moment=require('moment');var BPromise=require(_0xfe00('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe00('0x3'))['db'];var utils=require(_0xfe00('0x4'));var logger=require(_0xfe00('0x5'))('rpc');var config=require(_0xfe00('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe00('0x7')][_0xfe00('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbfed53,_0x1cadaa,_0x3c16dc){return new BPromise(function(_0x1a6c66,_0x375ec4){return client[_0xfe00('0x9')](_0xbfed53,_0x3c16dc)[_0xfe00('0xa')](function(_0x1de53b){logger['info'](_0xfe00('0xb'),_0x1cadaa,_0xfe00('0xc'));logger[_0xfe00('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1cadaa,'request\x20sent',JSON['stringify'](_0x1de53b));if(_0x1de53b[_0xfe00('0xe')]){if(_0x1de53b[_0xfe00('0xe')]['code']===0x1f4){logger[_0xfe00('0xe')](_0xfe00('0xb'),_0x1cadaa,_0x1de53b[_0xfe00('0xe')][_0xfe00('0xf')]);return _0x375ec4(_0x1de53b[_0xfe00('0xe')]['message']);}logger[_0xfe00('0xe')](_0xfe00('0xb'),_0x1cadaa,_0x1de53b[_0xfe00('0xe')][_0xfe00('0xf')]);return _0x1a6c66(_0x1de53b[_0xfe00('0xe')][_0xfe00('0xf')]);}else{logger[_0xfe00('0x10')](_0xfe00('0xb'),_0x1cadaa,_0xfe00('0xc'));_0x1a6c66(_0x1de53b[_0xfe00('0x11')][_0xfe00('0xf')]);}})['catch'](function(_0x8fc696){logger[_0xfe00('0xe')](_0xfe00('0xb'),_0x1cadaa,_0x8fc696);_0x375ec4(_0x8fc696);});});} \ No newline at end of file +var _0x9064=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0x9064,0x64));var _0x4906=function(_0x248c73,_0x3363a3){_0x248c73=_0x248c73-0x0;var _0x4fe94c=_0x9064[_0x248c73];return _0x4fe94c;};'use strict';var _=require('lodash');var util=require(_0x4906('0x0'));var moment=require(_0x4906('0x1'));var BPromise=require('bluebird');var rs=require(_0x4906('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4906('0x3'))['db'];var utils=require(_0x4906('0x4'));var logger=require(_0x4906('0x5'))(_0x4906('0x6'));var config=require(_0x4906('0x7'));var jayson=require(_0x4906('0x8'));var client=jayson[_0x4906('0x9')][_0x4906('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x238374,_0xdb756d,_0x1d0f35){return new BPromise(function(_0x5875e8,_0x1bcb79){return client[_0x4906('0xb')](_0x238374,_0x1d0f35)['then'](function(_0x103ea6){logger['info'](_0x4906('0xc'),_0xdb756d,'request\x20sent');logger[_0x4906('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xdb756d,_0x4906('0xe'),JSON[_0x4906('0xf')](_0x103ea6));if(_0x103ea6[_0x4906('0x10')]){if(_0x103ea6[_0x4906('0x10')][_0x4906('0x11')]===0x1f4){logger[_0x4906('0x10')](_0x4906('0xc'),_0xdb756d,_0x103ea6['error'][_0x4906('0x12')]);return _0x1bcb79(_0x103ea6['error'][_0x4906('0x12')]);}logger[_0x4906('0x10')](_0x4906('0xc'),_0xdb756d,_0x103ea6[_0x4906('0x10')]['message']);return _0x5875e8(_0x103ea6[_0x4906('0x10')][_0x4906('0x12')]);}else{logger[_0x4906('0x13')](_0x4906('0xc'),_0xdb756d,_0x4906('0xe'));_0x5875e8(_0x103ea6[_0x4906('0x14')][_0x4906('0x12')]);}})['catch'](function(_0x213c59){logger['error'](_0x4906('0xc'),_0xdb756d,_0x213c59);_0x1bcb79(_0x213c59);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8b79dc2..61b0808 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 _0xf7d9=['delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x14b195,_0x460868){var _0x42f003=function(_0x266e88){while(--_0x266e88){_0x14b195['push'](_0x14b195['shift']());}};_0x42f003(++_0x460868);}(_0xf7d9,0x122));var _0x9f7d=function(_0x403af9,_0x11d485){_0x403af9=_0x403af9-0x0;var _0x27e253=_0xf7d9[_0x403af9];return _0x27e253;};'use strict';var multer=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var path=require(_0x9f7d('0x2'));var timeout=require(_0x9f7d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f7d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f7d('0x5'));var config=require(_0x9f7d('0x6'));var controller=require(_0x9f7d('0x7'));router[_0x9f7d('0x8')]('/',auth[_0x9f7d('0x9')](),controller['index']);router['get'](_0x9f7d('0xa'),auth[_0x9f7d('0x9')](),controller[_0x9f7d('0xb')]);router[_0x9f7d('0xc')]('/',auth[_0x9f7d('0x9')](),controller[_0x9f7d('0xd')]);router['put'](_0x9f7d('0xa'),auth[_0x9f7d('0x9')](),controller['update']);router[_0x9f7d('0xe')](_0x9f7d('0xa'),auth[_0x9f7d('0x9')](),controller['destroy']);module[_0x9f7d('0xf')]=router; \ No newline at end of file +var _0x1280=['./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x1280,0xac));var _0x0128=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x1280[_0x31df6f];return _0x31e353;};'use strict';var multer=require(_0x0128('0x0'));var util=require('util');var path=require(_0x0128('0x1'));var timeout=require(_0x0128('0x2'));var express=require(_0x0128('0x3'));var router=express[_0x0128('0x4')]();var fs_extra=require(_0x0128('0x5'));var auth=require(_0x0128('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0128('0x7'));var controller=require(_0x0128('0x8'));router[_0x0128('0x9')]('/',auth[_0x0128('0xa')](),controller['index']);router['get'](_0x0128('0xb'),auth[_0x0128('0xa')](),controller[_0x0128('0xc')]);router[_0x0128('0xd')]('/',auth['isAuthenticated'](),controller[_0x0128('0xe')]);router[_0x0128('0xf')]('/:id',auth[_0x0128('0xa')](),controller[_0x0128('0x10')]);router[_0x0128('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0128('0x12')]);module[_0x0128('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 31e388e..1638244 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 _0xcb91=['string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x5322c3,_0x307e98){var _0x4f0c61=function(_0x1e521f){while(--_0x1e521f){_0x5322c3['push'](_0x5322c3['shift']());}};_0x4f0c61(++_0x307e98);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xcb91[_0xdd2bfa];return _0x55397e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue',_0x1cb9('0x4')),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1cb9('0x5')]},'keyType':{'type':Sequelize[_0x1cb9('0x0')]('string',_0x1cb9('0x2'),_0x1cb9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb9('0x5')]},'variableName':{'type':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x40cdad,_0x441ca9){var _0x4c8426=function(_0x1bbf4f){while(--_0x1bbf4f){_0x40cdad['push'](_0x40cdad['shift']());}};_0x4c8426(++_0x441ca9);}(_0xe706,0xa3));var _0x6e70=function(_0x442214,_0x3a869f){_0x442214=_0x442214-0x0;var _0x2bddf9=_0xe706[_0x442214];return _0x2bddf9;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'type':{'type':Sequelize[_0x6e70('0x2')]('string',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'defaultValue':_0x6e70('0x7')},'content':{'type':Sequelize[_0x6e70('0x8')]},'key':{'type':Sequelize[_0x6e70('0x8')]},'keyType':{'type':Sequelize[_0x6e70('0x2')](_0x6e70('0x7'),_0x6e70('0x3'),_0x6e70('0x4'))},'keyContent':{'type':Sequelize[_0x6e70('0x8')]},'idField':{'type':Sequelize[_0x6e70('0x8')]},'variableName':{'type':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index cfbbfd4..fc85463 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 _0xc231=['path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','sendStatus','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xc231,0x15c));var _0x1c23=function(_0x263a15,_0x5d1067){_0x263a15=_0x263a15-0x0;var _0x3c6620=_0xc231[_0x263a15];return _0x3c6620;};'use strict';var emlformat=require(_0x1c23('0x0'));var rimraf=require(_0x1c23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c23('0x2'));var rp=require(_0x1c23('0x3'));var moment=require(_0x1c23('0x4'));var BPromise=require(_0x1c23('0x5'));var Mustache=require('mustache');var util=require(_0x1c23('0x6'));var path=require(_0x1c23('0x7'));var sox=require(_0x1c23('0x8'));var csv=require(_0x1c23('0x9'));var ejs=require(_0x1c23('0xa'));var fs=require('fs');var fs_extra=require(_0x1c23('0xb'));var _=require(_0x1c23('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1c23('0xd'));var deskjs=require(_0x1c23('0xe'));var toCsv=require(_0x1c23('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1c23('0xf'));var authService=require(_0x1c23('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1c23('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1c23('0x12'));var utils=require(_0x1c23('0x13'));var config=require(_0x1c23('0x14'));var licenseUtil=require(_0x1c23('0x15'));var db=require(_0x1c23('0x16'))['db'];function respondWithStatusCode(_0x574275,_0x3c0444){_0x3c0444=_0x3c0444||0xcc;return function(_0x2d63c2){if(_0x2d63c2){return _0x574275['sendStatus'](_0x3c0444);}return _0x574275['status'](_0x3c0444)[_0x1c23('0x17')]();};}function respondWithResult(_0xfd2e91,_0x1f748f){_0x1f748f=_0x1f748f||0xc8;return function(_0xb94188){if(_0xb94188){return _0xfd2e91[_0x1c23('0x18')](_0x1f748f)[_0x1c23('0x19')](_0xb94188);}};}function respondWithFilteredResult(_0x102150,_0x1959c8){return function(_0x562f01){if(_0x562f01){var _0x2dfa45=typeof _0x1959c8[_0x1c23('0x1a')]==='undefined'&&typeof _0x1959c8[_0x1c23('0x1b')]===_0x1c23('0x1c');var _0x242296=_0x562f01['count'];var _0x191ba3=_0x2dfa45?0x0:_0x1959c8[_0x1c23('0x1a')];var _0x16cee5=_0x2dfa45?_0x562f01[_0x1c23('0x1d')]:_0x1959c8[_0x1c23('0x1a')]+_0x1959c8[_0x1c23('0x1b')];var _0x32c233;if(_0x16cee5>=_0x242296){_0x16cee5=_0x242296;_0x32c233=0xc8;}else{_0x32c233=0xce;}_0x102150[_0x1c23('0x18')](_0x32c233);return _0x102150[_0x1c23('0x1e')](_0x1c23('0x1f'),_0x191ba3+'-'+_0x16cee5+'/'+_0x242296)['json'](_0x562f01);}return null;};}function patchUpdates(_0x46fff4){return function(_0x79933d){try{jsonpatch['apply'](_0x79933d,_0x46fff4,!![]);}catch(_0x56ea4e){return BPromise['reject'](_0x56ea4e);}return _0x79933d[_0x1c23('0x20')]();};}function saveUpdates(_0x1f2f97,_0x613a6c){return function(_0x1c5b1a){if(_0x1c5b1a){return _0x1c5b1a[_0x1c23('0x21')](_0x1f2f97)[_0x1c23('0x22')](function(_0x3d729b){return _0x3d729b;});}return null;};}function removeEntity(_0x562ad9,_0x31b91b){return function(_0x494a9c){if(_0x494a9c){return _0x494a9c['destroy']()[_0x1c23('0x22')](function(){_0x562ad9[_0x1c23('0x18')](0xcc)[_0x1c23('0x17')]();});}};}function handleEntityNotFound(_0x5cd68c,_0x1a1763){return function(_0x162c58){if(!_0x162c58){_0x5cd68c[_0x1c23('0x23')](0x194);}return _0x162c58;};}function handleError(_0x171f64,_0x1da5b3){_0x1da5b3=_0x1da5b3||0x1f4;return function(_0x4dfe1f){logger[_0x1c23('0x24')](_0x4dfe1f['stack']);if(_0x4dfe1f['name']){delete _0x4dfe1f[_0x1c23('0x25')];}_0x171f64[_0x1c23('0x18')](_0x1da5b3)[_0x1c23('0x26')](_0x4dfe1f);};}exports[_0x1c23('0x27')]=function(_0x5c0394,_0xa9c7be){var _0x303971={},_0x57c965={},_0xf2c89b={'count':0x0,'rows':[]};var _0x298763=_[_0x1c23('0x28')](db[_0x1c23('0x29')][_0x1c23('0x2a')],function(_0x2ccdc8){return{'name':_0x2ccdc8[_0x1c23('0x2b')],'type':_0x2ccdc8[_0x1c23('0x2c')][_0x1c23('0x2d')]};});_0x57c965[_0x1c23('0x2e')]=_[_0x1c23('0x28')](_0x298763,_0x1c23('0x25'));_0x57c965['query']=_[_0x1c23('0x2f')](_0x5c0394[_0x1c23('0x30')]);_0x57c965[_0x1c23('0x31')]=_[_0x1c23('0x32')](_0x57c965[_0x1c23('0x2e')],_0x57c965['query']);_0x303971[_0x1c23('0x33')]=_[_0x1c23('0x32')](_0x57c965[_0x1c23('0x2e')],qs[_0x1c23('0x34')](_0x5c0394['query'][_0x1c23('0x34')]));_0x303971[_0x1c23('0x33')]=_0x303971[_0x1c23('0x33')][_0x1c23('0x35')]?_0x303971[_0x1c23('0x33')]:_0x57c965[_0x1c23('0x2e')];if(!_0x5c0394[_0x1c23('0x30')][_0x1c23('0x36')]('nolimit')){_0x303971[_0x1c23('0x1b')]=qs['limit'](_0x5c0394[_0x1c23('0x30')][_0x1c23('0x1b')]);_0x303971[_0x1c23('0x1a')]=qs[_0x1c23('0x1a')](_0x5c0394[_0x1c23('0x30')][_0x1c23('0x1a')]);}_0x303971[_0x1c23('0x37')]=qs[_0x1c23('0x38')](_0x5c0394['query']['sort']);_0x303971[_0x1c23('0x39')]=qs[_0x1c23('0x31')](_['pick'](_0x5c0394[_0x1c23('0x30')],_0x57c965[_0x1c23('0x31')]),_0x298763);if(_0x5c0394[_0x1c23('0x30')]['filter']){_0x303971[_0x1c23('0x39')]=_['merge'](_0x303971[_0x1c23('0x39')],{'$or':_['map'](_0x298763,function(_0x19e0d0){if(_0x19e0d0[_0x1c23('0x2c')]!==_0x1c23('0x3a')){var _0x405101={};_0x405101[_0x19e0d0[_0x1c23('0x25')]]={'$like':'%'+_0x5c0394['query']['filter']+'%'};return _0x405101;}})});}_0x303971=_[_0x1c23('0x3b')]({},_0x303971,_0x5c0394[_0x1c23('0x3c')]);var _0x29f997={'where':_0x303971['where']};return db['SalesforceField'][_0x1c23('0x1d')](_0x29f997)['then'](function(_0x50df62){_0xf2c89b['count']=_0x50df62;if(_0x5c0394[_0x1c23('0x30')][_0x1c23('0x3d')]){_0x303971[_0x1c23('0x3e')]=[{'all':!![]}];}return db[_0x1c23('0x29')][_0x1c23('0x3f')](_0x303971);})['then'](function(_0x4fe488){_0xf2c89b['rows']=_0x4fe488;return _0xf2c89b;})[_0x1c23('0x22')](respondWithFilteredResult(_0xa9c7be,_0x303971))[_0x1c23('0x40')](handleError(_0xa9c7be,null));};exports[_0x1c23('0x41')]=function(_0x1cd933,_0x584fb2){var _0x5d4e98={'raw':!![],'where':{'id':_0x1cd933[_0x1c23('0x42')]['id']}},_0x4b88a1={};_0x4b88a1[_0x1c23('0x2e')]=_[_0x1c23('0x2f')](db[_0x1c23('0x29')][_0x1c23('0x2a')]);_0x4b88a1[_0x1c23('0x30')]=_['keys'](_0x1cd933[_0x1c23('0x30')]);_0x4b88a1[_0x1c23('0x31')]=_[_0x1c23('0x32')](_0x4b88a1[_0x1c23('0x2e')],_0x4b88a1[_0x1c23('0x30')]);_0x5d4e98[_0x1c23('0x33')]=_[_0x1c23('0x32')](_0x4b88a1['model'],qs[_0x1c23('0x34')](_0x1cd933[_0x1c23('0x30')][_0x1c23('0x34')]));_0x5d4e98[_0x1c23('0x33')]=_0x5d4e98['attributes'][_0x1c23('0x35')]?_0x5d4e98[_0x1c23('0x33')]:_0x4b88a1['model'];if(_0x1cd933[_0x1c23('0x30')][_0x1c23('0x3d')]){_0x5d4e98['include']=[{'all':!![]}];}_0x5d4e98=_[_0x1c23('0x3b')]({},_0x5d4e98,_0x1cd933[_0x1c23('0x3c')]);return db[_0x1c23('0x29')][_0x1c23('0x43')](_0x5d4e98)[_0x1c23('0x22')](handleEntityNotFound(_0x584fb2,null))['then'](respondWithResult(_0x584fb2,null))['catch'](handleError(_0x584fb2,null));};exports[_0x1c23('0x44')]=function(_0x220018,_0x2dd292){return db[_0x1c23('0x29')][_0x1c23('0x44')](_0x220018[_0x1c23('0x45')],{})[_0x1c23('0x22')](respondWithResult(_0x2dd292,0xc9))[_0x1c23('0x40')](handleError(_0x2dd292,null));};exports[_0x1c23('0x21')]=function(_0x210472,_0x3cdd04){if(_0x210472[_0x1c23('0x45')]['id']){delete _0x210472[_0x1c23('0x45')]['id'];}return db[_0x1c23('0x29')][_0x1c23('0x43')]({'where':{'id':_0x210472[_0x1c23('0x42')]['id']}})[_0x1c23('0x22')](handleEntityNotFound(_0x3cdd04,null))[_0x1c23('0x22')](saveUpdates(_0x210472[_0x1c23('0x45')],null))[_0x1c23('0x22')](respondWithResult(_0x3cdd04,null))['catch'](handleError(_0x3cdd04,null));};exports[_0x1c23('0x46')]=function(_0x4649f9,_0x56dd29){return db[_0x1c23('0x29')][_0x1c23('0x43')]({'where':{'id':_0x4649f9[_0x1c23('0x42')]['id']}})[_0x1c23('0x22')](handleEntityNotFound(_0x56dd29,null))[_0x1c23('0x22')](removeEntity(_0x56dd29,null))['catch'](handleError(_0x56dd29,null));}; \ No newline at end of file +var _0x2391=['SalesforceField','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','then','includeAll','include','rows','catch','params','fields','options','create','update','body','find','destroy','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','error','name','send','index','map'];(function(_0x3bbe4b,_0x35f067){var _0x402d37=function(_0x2f7f78){while(--_0x2f7f78){_0x3bbe4b['push'](_0x3bbe4b['shift']());}};_0x402d37(++_0x35f067);}(_0x2391,0x69));var _0x1239=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x2391[_0x433a86];return _0x23000c;};'use strict';var emlformat=require(_0x1239('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1239('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1239('0x2'));var moment=require(_0x1239('0x3'));var BPromise=require(_0x1239('0x4'));var Mustache=require('mustache');var util=require(_0x1239('0x5'));var path=require(_0x1239('0x6'));var sox=require(_0x1239('0x7'));var csv=require('to-csv');var ejs=require(_0x1239('0x8'));var fs=require('fs');var fs_extra=require(_0x1239('0x9'));var _=require(_0x1239('0xa'));var squel=require(_0x1239('0xb'));var crypto=require(_0x1239('0xc'));var jsforce=require(_0x1239('0xd'));var deskjs=require(_0x1239('0xe'));var toCsv=require(_0x1239('0xf'));var querystring=require(_0x1239('0x10'));var Papa=require(_0x1239('0x11'));var Redis=require(_0x1239('0x12'));var authService=require(_0x1239('0x13'));var qs=require(_0x1239('0x14'));var as=require(_0x1239('0x15'));var hardwareService=require(_0x1239('0x16'));var logger=require('../../config/logger')(_0x1239('0x17'));var utils=require(_0x1239('0x18'));var config=require(_0x1239('0x19'));var licenseUtil=require(_0x1239('0x1a'));var db=require(_0x1239('0x1b'))['db'];function respondWithStatusCode(_0x58d886,_0x59ee62){_0x59ee62=_0x59ee62||0xcc;return function(_0x5ee3d0){if(_0x5ee3d0){return _0x58d886[_0x1239('0x1c')](_0x59ee62);}return _0x58d886[_0x1239('0x1d')](_0x59ee62)[_0x1239('0x1e')]();};}function respondWithResult(_0x56dbf,_0x1c10e3){_0x1c10e3=_0x1c10e3||0xc8;return function(_0x3f4e09){if(_0x3f4e09){return _0x56dbf[_0x1239('0x1d')](_0x1c10e3)[_0x1239('0x1f')](_0x3f4e09);}};}function respondWithFilteredResult(_0x90b21e,_0xd1d956){return function(_0x1afbc){if(_0x1afbc){var _0x159b24=typeof _0xd1d956[_0x1239('0x20')]==='undefined'&&typeof _0xd1d956['limit']==='undefined';var _0x1d3c37=_0x1afbc[_0x1239('0x21')];var _0x152425=_0x159b24?0x0:_0xd1d956[_0x1239('0x20')];var _0x4dda55=_0x159b24?_0x1afbc['count']:_0xd1d956[_0x1239('0x20')]+_0xd1d956[_0x1239('0x22')];var _0x2474b5;if(_0x4dda55>=_0x1d3c37){_0x4dda55=_0x1d3c37;_0x2474b5=0xc8;}else{_0x2474b5=0xce;}_0x90b21e[_0x1239('0x1d')](_0x2474b5);return _0x90b21e[_0x1239('0x23')]('Content-Range',_0x152425+'-'+_0x4dda55+'/'+_0x1d3c37)[_0x1239('0x1f')](_0x1afbc);}return null;};}function patchUpdates(_0xac88ba){return function(_0x4694ca){try{jsonpatch[_0x1239('0x24')](_0x4694ca,_0xac88ba,!![]);}catch(_0x8ced11){return BPromise['reject'](_0x8ced11);}return _0x4694ca[_0x1239('0x25')]();};}function saveUpdates(_0x14ad77,_0x50709a){return function(_0x358359){if(_0x358359){return _0x358359['update'](_0x14ad77)['then'](function(_0x14535b){return _0x14535b;});}return null;};}function removeEntity(_0x261187,_0x2bff9e){return function(_0x3f012f){if(_0x3f012f){return _0x3f012f['destroy']()['then'](function(){_0x261187[_0x1239('0x1d')](0xcc)[_0x1239('0x1e')]();});}};}function handleEntityNotFound(_0x4bd096,_0x4c75cf){return function(_0xcc197d){if(!_0xcc197d){_0x4bd096[_0x1239('0x1c')](0x194);}return _0xcc197d;};}function handleError(_0x5e642a,_0xe6da45){_0xe6da45=_0xe6da45||0x1f4;return function(_0x17f992){logger[_0x1239('0x26')](_0x17f992['stack']);if(_0x17f992[_0x1239('0x27')]){delete _0x17f992['name'];}_0x5e642a[_0x1239('0x1d')](_0xe6da45)[_0x1239('0x28')](_0x17f992);};}exports[_0x1239('0x29')]=function(_0x510b68,_0x32f996){var _0x8ef5ac={},_0x5f293b={},_0x484255={'count':0x0,'rows':[]};var _0x42e395=_[_0x1239('0x2a')](db[_0x1239('0x2b')][_0x1239('0x2c')],function(_0x3aacea){return{'name':_0x3aacea['fieldName'],'type':_0x3aacea[_0x1239('0x2d')][_0x1239('0x2e')]};});_0x5f293b[_0x1239('0x2f')]=_[_0x1239('0x2a')](_0x42e395,'name');_0x5f293b[_0x1239('0x30')]=_[_0x1239('0x31')](_0x510b68[_0x1239('0x30')]);_0x5f293b['filters']=_[_0x1239('0x32')](_0x5f293b['model'],_0x5f293b[_0x1239('0x30')]);_0x8ef5ac['attributes']=_[_0x1239('0x32')](_0x5f293b[_0x1239('0x2f')],qs['fields'](_0x510b68[_0x1239('0x30')]['fields']));_0x8ef5ac[_0x1239('0x33')]=_0x8ef5ac[_0x1239('0x33')][_0x1239('0x34')]?_0x8ef5ac[_0x1239('0x33')]:_0x5f293b['model'];if(!_0x510b68[_0x1239('0x30')][_0x1239('0x35')]('nolimit')){_0x8ef5ac['limit']=qs[_0x1239('0x22')](_0x510b68[_0x1239('0x30')][_0x1239('0x22')]);_0x8ef5ac[_0x1239('0x20')]=qs[_0x1239('0x20')](_0x510b68['query'][_0x1239('0x20')]);}_0x8ef5ac['order']=qs[_0x1239('0x36')](_0x510b68['query']['sort']);_0x8ef5ac[_0x1239('0x37')]=qs[_0x1239('0x38')](_[_0x1239('0x39')](_0x510b68[_0x1239('0x30')],_0x5f293b['filters']),_0x42e395);if(_0x510b68[_0x1239('0x30')][_0x1239('0x3a')]){_0x8ef5ac[_0x1239('0x37')]=_['merge'](_0x8ef5ac[_0x1239('0x37')],{'$or':_['map'](_0x42e395,function(_0x15755b){if(_0x15755b[_0x1239('0x2d')]!==_0x1239('0x3b')){var _0x1deda1={};_0x1deda1[_0x15755b['name']]={'$like':'%'+_0x510b68[_0x1239('0x30')][_0x1239('0x3a')]+'%'};return _0x1deda1;}})});}_0x8ef5ac=_[_0x1239('0x3c')]({},_0x8ef5ac,_0x510b68['options']);var _0x517de3={'where':_0x8ef5ac[_0x1239('0x37')]};return db[_0x1239('0x2b')][_0x1239('0x21')](_0x517de3)[_0x1239('0x3d')](function(_0x4cd11d){_0x484255[_0x1239('0x21')]=_0x4cd11d;if(_0x510b68[_0x1239('0x30')][_0x1239('0x3e')]){_0x8ef5ac[_0x1239('0x3f')]=[{'all':!![]}];}return db[_0x1239('0x2b')]['findAll'](_0x8ef5ac);})[_0x1239('0x3d')](function(_0x15a855){_0x484255[_0x1239('0x40')]=_0x15a855;return _0x484255;})['then'](respondWithFilteredResult(_0x32f996,_0x8ef5ac))[_0x1239('0x41')](handleError(_0x32f996,null));};exports['show']=function(_0x29f523,_0x10a86a){var _0x2229b0={'raw':!![],'where':{'id':_0x29f523[_0x1239('0x42')]['id']}},_0x2a70d2={};_0x2a70d2[_0x1239('0x2f')]=_[_0x1239('0x31')](db['SalesforceField'][_0x1239('0x2c')]);_0x2a70d2['query']=_[_0x1239('0x31')](_0x29f523['query']);_0x2a70d2[_0x1239('0x38')]=_[_0x1239('0x32')](_0x2a70d2[_0x1239('0x2f')],_0x2a70d2['query']);_0x2229b0[_0x1239('0x33')]=_[_0x1239('0x32')](_0x2a70d2[_0x1239('0x2f')],qs[_0x1239('0x43')](_0x29f523['query'][_0x1239('0x43')]));_0x2229b0[_0x1239('0x33')]=_0x2229b0['attributes'][_0x1239('0x34')]?_0x2229b0[_0x1239('0x33')]:_0x2a70d2[_0x1239('0x2f')];if(_0x29f523['query'][_0x1239('0x3e')]){_0x2229b0[_0x1239('0x3f')]=[{'all':!![]}];}_0x2229b0=_[_0x1239('0x3c')]({},_0x2229b0,_0x29f523[_0x1239('0x44')]);return db['SalesforceField']['find'](_0x2229b0)['then'](handleEntityNotFound(_0x10a86a,null))[_0x1239('0x3d')](respondWithResult(_0x10a86a,null))[_0x1239('0x41')](handleError(_0x10a86a,null));};exports['create']=function(_0x4051fe,_0x1c9b00){return db[_0x1239('0x2b')][_0x1239('0x45')](_0x4051fe['body'],{})[_0x1239('0x3d')](respondWithResult(_0x1c9b00,0xc9))['catch'](handleError(_0x1c9b00,null));};exports[_0x1239('0x46')]=function(_0xae669,_0x1d1dcd){if(_0xae669[_0x1239('0x47')]['id']){delete _0xae669[_0x1239('0x47')]['id'];}return db['SalesforceField'][_0x1239('0x48')]({'where':{'id':_0xae669['params']['id']}})['then'](handleEntityNotFound(_0x1d1dcd,null))['then'](saveUpdates(_0xae669[_0x1239('0x47')],null))[_0x1239('0x3d')](respondWithResult(_0x1d1dcd,null))[_0x1239('0x41')](handleError(_0x1d1dcd,null));};exports[_0x1239('0x49')]=function(_0x4ba073,_0x218022){return db[_0x1239('0x2b')][_0x1239('0x48')]({'where':{'id':_0x4ba073[_0x1239('0x42')]['id']}})[_0x1239('0x3d')](handleEntityNotFound(_0x218022,null))[_0x1239('0x3d')](removeEntity(_0x218022,null))[_0x1239('0x41')](handleError(_0x218022,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 8f2ae31..eb361e0 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 _0x35d0=['path','rimraf','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x316c00,_0x1cca31){var _0x8d4b88=function(_0x571912){while(--_0x571912){_0x316c00['push'](_0x316c00['shift']());}};_0x8d4b88(++_0x1cca31);}(_0x35d0,0xf9));var _0x035d=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x35d0[_0x3e478c];return _0x29ef89;};'use strict';var _=require(_0x035d('0x0'));var util=require(_0x035d('0x1'));var logger=require('../../config/logger')(_0x035d('0x2'));var moment=require(_0x035d('0x3'));var BPromise=require(_0x035d('0x4'));var rp=require(_0x035d('0x5'));var fs=require('fs');var path=require(_0x035d('0x6'));var rimraf=require(_0x035d('0x7'));var config=require('../../config/environment');var attributes=require(_0x035d('0x8'));module[_0x035d('0x9')]=function(_0x3e6d36,_0x3f5f0d){return _0x3e6d36['define'](_0x035d('0xa'),attributes,{'tableName':_0x035d('0xb'),'paranoid':![],'indexes':[{'name':_0x035d('0xc'),'fields':[_0x035d('0xd'),_0x035d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x877f=['SalesforceField','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSalesforceField.attributes','exports','define'];(function(_0x8aa6fa,_0x2e01e2){var _0x49bff3=function(_0x3f0b54){while(--_0x3f0b54){_0x8aa6fa['push'](_0x8aa6fa['shift']());}};_0x49bff3(++_0x2e01e2);}(_0x877f,0x12d));var _0xf877=function(_0x46deb5,_0x2136db){_0x46deb5=_0x46deb5-0x0;var _0x579e72=_0x877f[_0x46deb5];return _0x579e72;};'use strict';var _=require(_0xf877('0x0'));var util=require(_0xf877('0x1'));var logger=require(_0xf877('0x2'))(_0xf877('0x3'));var moment=require(_0xf877('0x4'));var BPromise=require(_0xf877('0x5'));var rp=require(_0xf877('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf877('0x7'));var attributes=require(_0xf877('0x8'));module[_0xf877('0x9')]=function(_0x3481ec,_0x42ec8a){return _0x3481ec[_0xf877('0xa')](_0xf877('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xf877('0xc'),'FieldId'],'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 68c3472..96a8e0c 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 _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x3a0e08,_0x20a614){var _0xee94d3=function(_0x47d7eb){while(--_0x47d7eb){_0x3a0e08['push'](_0x3a0e08['shift']());}};_0xee94d3(++_0x20a614);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2b9848,_0x26ae6e){_0x2b9848=_0x2b9848-0x0;var _0x25f49f=_0x9ffd[_0x2b9848];return _0x25f49f;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0x9bde=['code','message','SalesforceField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x506d90,_0x129b92){var _0x43cbe6=function(_0x3bd5e3){while(--_0x3bd5e3){_0x506d90['push'](_0x506d90['shift']());}};_0x43cbe6(++_0x129b92);}(_0x9bde,0xe1));var _0xe9bd=function(_0x310238,_0x5bb743){_0x310238=_0x310238-0x0;var _0x5c8ae7=_0x9bde[_0x310238];return _0x5c8ae7;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('SalesforceField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 020b503..781a2a2 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 _0x955f=['/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x36bab3,_0x19ce33){var _0x2d3989=function(_0x2a4f60){while(--_0x2a4f60){_0x36bab3['push'](_0x36bab3['shift']());}};_0x2d3989(++_0x19ce33);}(_0x955f,0x1eb));var _0xf955=function(_0x9dd588,_0x1a0e00){_0x9dd588=_0x9dd588-0x0;var _0x110e27=_0x955f[_0x9dd588];return _0x110e27;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./intServicenowAccount.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0x7')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller['getFields']);router[_0xf955('0xe')]('/',auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0xe')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x10')]);router['put'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);router[_0xf955('0x12')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0x13')]);module[_0xf955('0x14')]=router; \ No newline at end of file +var _0x236c=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','post','create','addConfiguration','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x236c,0x155));var _0xc236=function(_0xcb3cc7,_0x598a44){_0xcb3cc7=_0xcb3cc7-0x0;var _0x29d5aa=_0x236c[_0xcb3cc7];return _0x29d5aa;};'use strict';var multer=require(_0xc236('0x0'));var util=require('util');var path=require(_0xc236('0x1'));var timeout=require(_0xc236('0x2'));var express=require(_0xc236('0x3'));var router=express[_0xc236('0x4')]();var fs_extra=require(_0xc236('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc236('0x6'));var config=require(_0xc236('0x7'));var controller=require(_0xc236('0x8'));router[_0xc236('0x9')]('/',auth[_0xc236('0xa')](),controller[_0xc236('0xb')]);router['get'](_0xc236('0xc'),auth[_0xc236('0xa')](),controller['show']);router['get']('/:id/configurations',auth[_0xc236('0xa')](),controller['getConfigurations']);router[_0xc236('0x9')](_0xc236('0xd'),auth[_0xc236('0xa')](),controller[_0xc236('0xe')]);router[_0xc236('0xf')]('/',auth['isAuthenticated'](),controller[_0xc236('0x10')]);router[_0xc236('0xf')]('/:id/configurations',auth[_0xc236('0xa')](),controller[_0xc236('0x11')]);router['put'](_0xc236('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc236('0x12')](_0xc236('0xc'),auth[_0xc236('0xa')](),controller[_0xc236('0x13')]);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 08ead4f..9cbe663 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 _0xa943=['STRING','sequelize','exports'];(function(_0x2f3750,_0x328bc8){var _0x48c81f=function(_0x3ad9db){while(--_0x3ad9db){_0x2f3750['push'](_0x2f3750['shift']());}};_0x48c81f(++_0x328bc8);}(_0xa943,0x16f));var _0x3a94=function(_0x1b282e,_0x2da5c5){_0x1b282e=_0x1b282e-0x0;var _0x292eb3=_0xa943[_0x1b282e];return _0x292eb3;};'use strict';var Sequelize=require(_0x3a94('0x0'));module[_0x3a94('0x1')]={'name':{'type':Sequelize[_0x3a94('0x2')]},'description':{'type':Sequelize[_0x3a94('0x2')]},'username':{'type':Sequelize[_0x3a94('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x3a94('0x2')]},'email':{'type':Sequelize[_0x3a94('0x2')]},'remoteUri':{'type':Sequelize[_0x3a94('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdac5=['STRING','username','remoteUri','sequelize','exports'];(function(_0x272f0d,_0x2a0a87){var _0x68c5b2=function(_0x361268){while(--_0x361268){_0x272f0d['push'](_0x272f0d['shift']());}};_0x68c5b2(++_0x2a0a87);}(_0xdac5,0xd0));var _0x5dac=function(_0x13457d,_0xa30ef9){_0x13457d=_0x13457d-0x0;var _0x1ea981=_0xdac5[_0x13457d];return _0x1ea981;};'use strict';var Sequelize=require(_0x5dac('0x0'));module[_0x5dac('0x1')]={'name':{'type':Sequelize[_0x5dac('0x2')]},'description':{'type':Sequelize[_0x5dac('0x2')]},'username':{'type':Sequelize[_0x5dac('0x2')],'unique':_0x5dac('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5dac('0x2')],'unique':_0x5dac('0x4')},'serverUrl':{'type':Sequelize[_0x5dac('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 57392be..5c78444 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 _0xc910=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','keys','rawAttributes','includeAll','find','catch','create','body','update','params','destroy','findOne','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','priority','time_worked','opened_at','business_duration','group_list','work_end','resolved_at','work_notes','correlation_display','delivery_task','work_start','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','activity_due','assigned_to','severity','comments','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','serverUrl','remoteUri','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','label','concat','test','Wrong\x20credentials','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','stack','name','index','map','ServicenowAccount','fieldName','type'];(function(_0x14c8ee,_0x34d4fb){var _0x51acc2=function(_0x4c1277){while(--_0x4c1277){_0x14c8ee['push'](_0x14c8ee['shift']());}};_0x51acc2(++_0x34d4fb);}(_0xc910,0x148));var _0x0c91=function(_0x2d64d0,_0x2c910f){_0x2d64d0=_0x2d64d0-0x0;var _0x4258ae=_0xc910[_0x2d64d0];return _0x4258ae;};'use strict';var emlformat=require(_0x0c91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c91('0x1'));var jsonpatch=require(_0x0c91('0x2'));var rp=require('request-promise');var moment=require(_0x0c91('0x3'));var BPromise=require(_0x0c91('0x4'));var Mustache=require('mustache');var util=require(_0x0c91('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0c91('0x6'));var fs=require('fs');var fs_extra=require(_0x0c91('0x7'));var _=require('lodash');var squel=require(_0x0c91('0x8'));var crypto=require(_0x0c91('0x9'));var jsforce=require(_0x0c91('0xa'));var deskjs=require(_0x0c91('0xb'));var toCsv=require(_0x0c91('0xc'));var querystring=require(_0x0c91('0xd'));var Papa=require(_0x0c91('0xe'));var Redis=require('ioredis');var authService=require(_0x0c91('0xf'));var qs=require(_0x0c91('0x10'));var as=require(_0x0c91('0x11'));var hardwareService=require(_0x0c91('0x12'));var logger=require(_0x0c91('0x13'))(_0x0c91('0x14'));var utils=require(_0x0c91('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0c91('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0c91('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x0c91('0x18')][_0x0c91('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5ab1c3,_0x13c491,_0x53fd3f,_0x168f9a){return new BPromise(function(_0x54a70f,_0x4b325b){var _0x4b5342=_0x168f9a||client;return _0x4b5342[_0x0c91('0x1a')](_0x5ab1c3,_0x53fd3f)['then'](function(_0xead21){logger[_0x0c91('0x1b')](_0x0c91('0x1c'),_0x13c491,_0x0c91('0x1d'));logger[_0x0c91('0x1e')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x13c491,'request\x20sent',JSON[_0x0c91('0x1f')](_0xead21));if(_0xead21['error']){if(_0xead21[_0x0c91('0x20')][_0x0c91('0x21')]===0x1f4){logger['error'](_0x0c91('0x1c'),_0x13c491,_0xead21['error']['message']);return _0x4b325b(_0xead21[_0x0c91('0x20')]['message']);}logger[_0x0c91('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x13c491,_0xead21['error'][_0x0c91('0x22')]);return _0x54a70f(_0xead21[_0x0c91('0x20')][_0x0c91('0x22')]);}else{logger['info'](_0x0c91('0x1c'),_0x13c491,_0x0c91('0x1d'));_0x54a70f(_0xead21[_0x0c91('0x23')][_0x0c91('0x22')]);}})['catch'](function(_0xcbf81a){logger[_0x0c91('0x20')](_0x0c91('0x1c'),_0x13c491,_0xcbf81a);_0x4b325b(_0xcbf81a);});});}function respondWithStatusCode(_0xbf98af,_0x2677f8){_0x2677f8=_0x2677f8||0xcc;return function(_0x2d5b5f){if(_0x2d5b5f){return _0xbf98af[_0x0c91('0x24')](_0x2677f8);}return _0xbf98af[_0x0c91('0x25')](_0x2677f8)[_0x0c91('0x26')]();};}function respondWithResult(_0x384153,_0x77fe5c){_0x77fe5c=_0x77fe5c||0xc8;return function(_0x373213){if(_0x373213){return _0x384153[_0x0c91('0x25')](_0x77fe5c)[_0x0c91('0x27')](_0x373213);}};}function respondWithFilteredResult(_0x1db5af,_0xc75c1f){return function(_0xfa87ce){if(_0xfa87ce){var _0x4ca9e8=typeof _0xc75c1f[_0x0c91('0x28')]===_0x0c91('0x29')&&typeof _0xc75c1f[_0x0c91('0x2a')]===_0x0c91('0x29');var _0x5ad62e=_0xfa87ce[_0x0c91('0x2b')];var _0x170837=_0x4ca9e8?0x0:_0xc75c1f[_0x0c91('0x28')];var _0x4f8b7d=_0x4ca9e8?_0xfa87ce[_0x0c91('0x2b')]:_0xc75c1f['offset']+_0xc75c1f[_0x0c91('0x2a')];var _0x2e4537;if(_0x4f8b7d>=_0x5ad62e){_0x4f8b7d=_0x5ad62e;_0x2e4537=0xc8;}else{_0x2e4537=0xce;}_0x1db5af['status'](_0x2e4537);return _0x1db5af['set'](_0x0c91('0x2c'),_0x170837+'-'+_0x4f8b7d+'/'+_0x5ad62e)[_0x0c91('0x27')](_0xfa87ce);}return null;};}function patchUpdates(_0x41e8ad){return function(_0x460ff2){try{jsonpatch[_0x0c91('0x2d')](_0x460ff2,_0x41e8ad,!![]);}catch(_0xab6dd1){return BPromise[_0x0c91('0x2e')](_0xab6dd1);}return _0x460ff2[_0x0c91('0x2f')]();};}function saveUpdates(_0x5719fc,_0x1048a7){return function(_0x5b8e1f){if(_0x5b8e1f){return _0x5b8e1f['update'](_0x5719fc)[_0x0c91('0x30')](function(_0x1d3e35){return _0x1d3e35;});}return null;};}function removeEntity(_0x20bd8f,_0x310f13){return function(_0x55a551){if(_0x55a551){return _0x55a551['destroy']()[_0x0c91('0x30')](function(){_0x20bd8f[_0x0c91('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dc2be,_0x280188){return function(_0x581e12){if(!_0x581e12){_0x1dc2be[_0x0c91('0x24')](0x194);}return _0x581e12;};}function handleError(_0x1a5138,_0x2b6486){_0x2b6486=_0x2b6486||0x1f4;return function(_0x959f3c){logger['error'](_0x959f3c[_0x0c91('0x31')]);if(_0x959f3c[_0x0c91('0x32')]){delete _0x959f3c[_0x0c91('0x32')];}_0x1a5138[_0x0c91('0x25')](_0x2b6486)['send'](_0x959f3c);};}exports[_0x0c91('0x33')]=function(_0x1e299c,_0x4a8d19){var _0xfa8bc5={},_0x596531={},_0x4f1071={'count':0x0,'rows':[]};var _0x5c5272=_[_0x0c91('0x34')](db[_0x0c91('0x35')]['rawAttributes'],function(_0x4591c8){return{'name':_0x4591c8[_0x0c91('0x36')],'type':_0x4591c8[_0x0c91('0x37')][_0x0c91('0x38')]};});_0x596531[_0x0c91('0x39')]=_[_0x0c91('0x34')](_0x5c5272,_0x0c91('0x32'));_0x596531[_0x0c91('0x3a')]=_['keys'](_0x1e299c[_0x0c91('0x3a')]);_0x596531[_0x0c91('0x3b')]=_[_0x0c91('0x3c')](_0x596531[_0x0c91('0x39')],_0x596531[_0x0c91('0x3a')]);_0xfa8bc5[_0x0c91('0x3d')]=_[_0x0c91('0x3c')](_0x596531[_0x0c91('0x39')],qs[_0x0c91('0x3e')](_0x1e299c[_0x0c91('0x3a')][_0x0c91('0x3e')]));_0xfa8bc5[_0x0c91('0x3d')]=_0xfa8bc5[_0x0c91('0x3d')][_0x0c91('0x3f')]?_0xfa8bc5[_0x0c91('0x3d')]:_0x596531['model'];if(!_0x1e299c['query'][_0x0c91('0x40')](_0x0c91('0x41'))){_0xfa8bc5['limit']=qs[_0x0c91('0x2a')](_0x1e299c['query'][_0x0c91('0x2a')]);_0xfa8bc5[_0x0c91('0x28')]=qs[_0x0c91('0x28')](_0x1e299c[_0x0c91('0x3a')]['offset']);}_0xfa8bc5[_0x0c91('0x42')]=qs[_0x0c91('0x43')](_0x1e299c[_0x0c91('0x3a')]['sort']);_0xfa8bc5[_0x0c91('0x44')]=qs[_0x0c91('0x3b')](_[_0x0c91('0x45')](_0x1e299c[_0x0c91('0x3a')],_0x596531[_0x0c91('0x3b')]),_0x5c5272);if(_0x1e299c[_0x0c91('0x3a')]['filter']){_0xfa8bc5[_0x0c91('0x44')]=_[_0x0c91('0x46')](_0xfa8bc5[_0x0c91('0x44')],{'$or':_[_0x0c91('0x34')](_0x5c5272,function(_0x46e5f7){if(_0x46e5f7[_0x0c91('0x37')]!==_0x0c91('0x47')){var _0x39222d={};_0x39222d[_0x46e5f7[_0x0c91('0x32')]]={'$like':'%'+_0x1e299c['query'][_0x0c91('0x48')]+'%'};return _0x39222d;}})});}_0xfa8bc5=_['merge']({},_0xfa8bc5,_0x1e299c[_0x0c91('0x49')]);var _0x3a3983={'where':_0xfa8bc5[_0x0c91('0x44')]};return db['ServicenowAccount'][_0x0c91('0x2b')](_0x3a3983)[_0x0c91('0x30')](function(_0x275997){_0x4f1071[_0x0c91('0x2b')]=_0x275997;if(_0x1e299c[_0x0c91('0x3a')]['includeAll']){_0xfa8bc5[_0x0c91('0x4a')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x0c91('0x4b')](_0xfa8bc5);})[_0x0c91('0x30')](function(_0x3e2ec2){_0x4f1071['rows']=_0x3e2ec2;return _0x4f1071;})[_0x0c91('0x30')](respondWithFilteredResult(_0x4a8d19,_0xfa8bc5))['catch'](handleError(_0x4a8d19,null));};exports[_0x0c91('0x4c')]=function(_0x5ba5c0,_0x479287){var _0x382f15={'raw':![],'where':{'id':_0x5ba5c0['params']['id']}},_0x360201={};_0x360201[_0x0c91('0x39')]=_[_0x0c91('0x4d')](db['ServicenowAccount'][_0x0c91('0x4e')]);_0x360201[_0x0c91('0x3a')]=_[_0x0c91('0x4d')](_0x5ba5c0[_0x0c91('0x3a')]);_0x360201[_0x0c91('0x3b')]=_['intersection'](_0x360201[_0x0c91('0x39')],_0x360201[_0x0c91('0x3a')]);_0x382f15[_0x0c91('0x3d')]=_[_0x0c91('0x3c')](_0x360201[_0x0c91('0x39')],qs['fields'](_0x5ba5c0[_0x0c91('0x3a')][_0x0c91('0x3e')]));_0x382f15['attributes']=_0x382f15['attributes'][_0x0c91('0x3f')]?_0x382f15[_0x0c91('0x3d')]:_0x360201[_0x0c91('0x39')];if(_0x5ba5c0['query'][_0x0c91('0x4f')]){_0x382f15[_0x0c91('0x4a')]=[{'all':!![]}];}_0x382f15=_[_0x0c91('0x46')]({},_0x382f15,_0x5ba5c0['options']);return db[_0x0c91('0x35')][_0x0c91('0x50')](_0x382f15)[_0x0c91('0x30')](handleEntityNotFound(_0x479287,null))[_0x0c91('0x30')](respondWithResult(_0x479287,null))[_0x0c91('0x51')](handleError(_0x479287,null));};exports[_0x0c91('0x52')]=function(_0x5263f3,_0x516a30){return db[_0x0c91('0x35')][_0x0c91('0x52')](_0x5263f3[_0x0c91('0x53')],{})[_0x0c91('0x30')](respondWithResult(_0x516a30,0xc9))[_0x0c91('0x51')](handleError(_0x516a30,null));};exports[_0x0c91('0x54')]=function(_0x3a02da,_0x4b5adc){if(_0x3a02da[_0x0c91('0x53')]['id']){delete _0x3a02da['body']['id'];}return db[_0x0c91('0x35')][_0x0c91('0x50')]({'where':{'id':_0x3a02da[_0x0c91('0x55')]['id']}})[_0x0c91('0x30')](handleEntityNotFound(_0x4b5adc,null))[_0x0c91('0x30')](saveUpdates(_0x3a02da[_0x0c91('0x53')],null))['then'](respondWithResult(_0x4b5adc,null))[_0x0c91('0x51')](handleError(_0x4b5adc,null));};exports[_0x0c91('0x56')]=function(_0x1b14d5,_0x44cbf0){return db[_0x0c91('0x35')]['find']({'where':{'id':_0x1b14d5['params']['id']}})[_0x0c91('0x30')](handleEntityNotFound(_0x44cbf0,null))[_0x0c91('0x30')](removeEntity(_0x44cbf0,null))[_0x0c91('0x51')](handleError(_0x44cbf0,null));};exports['getConfigurations']=function(_0x301be9,_0x1c7722,_0x14d869){var _0x49cff4={};var _0x1e684b={};var _0x1a8f49;var _0x1d3945;return db['ServicenowAccount'][_0x0c91('0x57')]({'where':{'id':_0x301be9[_0x0c91('0x55')]['id']}})[_0x0c91('0x30')](handleEntityNotFound(_0x1c7722,null))['then'](function(_0x33c19a){if(_0x33c19a){_0x1a8f49=_0x33c19a;_0x1e684b[_0x0c91('0x39')]=_['keys'](db['ServicenowConfiguration'][_0x0c91('0x4e')]);_0x1e684b[_0x0c91('0x3a')]=_[_0x0c91('0x4d')](_0x301be9[_0x0c91('0x3a')]);_0x1e684b[_0x0c91('0x3b')]=_[_0x0c91('0x3c')](_0x1e684b[_0x0c91('0x39')],_0x1e684b['query']);_0x49cff4['attributes']=_[_0x0c91('0x3c')](_0x1e684b[_0x0c91('0x39')],qs[_0x0c91('0x3e')](_0x301be9[_0x0c91('0x3a')][_0x0c91('0x3e')]));_0x49cff4[_0x0c91('0x3d')]=_0x49cff4[_0x0c91('0x3d')][_0x0c91('0x3f')]?_0x49cff4['attributes']:_0x1e684b['model'];_0x49cff4[_0x0c91('0x42')]=qs[_0x0c91('0x43')](_0x301be9[_0x0c91('0x3a')][_0x0c91('0x43')]);_0x49cff4[_0x0c91('0x44')]=qs[_0x0c91('0x3b')](_[_0x0c91('0x45')](_0x301be9[_0x0c91('0x3a')],_0x1e684b[_0x0c91('0x3b')]));if(_0x301be9[_0x0c91('0x3a')][_0x0c91('0x48')]){_0x49cff4[_0x0c91('0x44')]=_[_0x0c91('0x46')](_0x49cff4[_0x0c91('0x44')],{'$or':_[_0x0c91('0x34')](_0x49cff4[_0x0c91('0x3d')],function(_0x472262){var _0x3b2ff7={};_0x3b2ff7[_0x472262]={'$like':'%'+_0x301be9[_0x0c91('0x3a')]['filter']+'%'};return _0x3b2ff7;})});}_0x49cff4=_[_0x0c91('0x46')]({},_0x49cff4,_0x301be9['options']);return _0x1a8f49[_0x0c91('0x58')](_0x49cff4);}})[_0x0c91('0x30')](function(_0x5448b1){if(_0x5448b1){_0x1d3945=_0x5448b1[_0x0c91('0x3f')];if(!_0x301be9[_0x0c91('0x3a')][_0x0c91('0x40')](_0x0c91('0x41'))){_0x49cff4[_0x0c91('0x2a')]=qs[_0x0c91('0x2a')](_0x301be9[_0x0c91('0x3a')]['limit']);_0x49cff4[_0x0c91('0x28')]=qs[_0x0c91('0x28')](_0x301be9['query'][_0x0c91('0x28')]);}return _0x1a8f49['getConfigurations'](_0x49cff4);}})['then'](function(_0x19804c){if(_0x19804c){return _0x19804c?{'count':_0x1d3945,'rows':_0x19804c}:null;}})[_0x0c91('0x30')](respondWithResult(_0x1c7722,null))[_0x0c91('0x51')](handleError(_0x1c7722,null));};exports[_0x0c91('0x59')]=function(_0x46150e,_0x2fd3d9,_0x3012f9){if(_0x46150e[_0x0c91('0x53')]['id']){delete _0x46150e[_0x0c91('0x53')]['id'];}return db['ServicenowAccount'][_0x0c91('0x57')]({'where':{'id':_0x46150e[_0x0c91('0x55')]['id']}})['then'](handleEntityNotFound(_0x2fd3d9,null))[_0x0c91('0x30')](function(_0x5ebd50){if(_0x5ebd50){_0x46150e[_0x0c91('0x53')]['AccountId']=_0x5ebd50['id'];_0x46150e[_0x0c91('0x53')]['Subjects']=integrations[_0x0c91('0x5a')](_0x46150e[_0x0c91('0x53')][_0x0c91('0x5b')],_0x46150e[_0x0c91('0x53')]['type']);_0x46150e[_0x0c91('0x53')][_0x0c91('0x5c')]=integrations[_0x0c91('0x5d')](_0x46150e[_0x0c91('0x53')]['channel'],_0x46150e['body'][_0x0c91('0x37')]);return db[_0x0c91('0x5e')][_0x0c91('0x52')](_0x46150e['body'],{'include':[{'model':db[_0x0c91('0x5f')],'as':'Subjects'},{'model':db[_0x0c91('0x5f')],'as':_0x0c91('0x5c')}]});}return null;})['then'](respondWithResult(_0x2fd3d9,null))['catch'](handleError(_0x2fd3d9,null));};exports[_0x0c91('0x60')]=function(_0x3816ea,_0x528d8e,_0xa495e8){var _0x1738b6=[_0x0c91('0x61'),_0x0c91('0x62'),_0x0c91('0x63'),_0x0c91('0x64'),_0x0c91('0x65'),_0x0c91('0x66'),_0x0c91('0x67'),'severity',_0x0c91('0x68')];var _0xb0e2e2=[_0x0c91('0x69'),'made_sla',_0x0c91('0x6a'),_0x0c91('0x6b'),_0x0c91('0x6c'),_0x0c91('0x6d'),_0x0c91('0x6e'),'hold_reason','approval_history',_0x0c91('0x6f'),_0x0c91('0x70'),_0x0c91('0x71'),'opened_by',_0x0c91('0x72'),_0x0c91('0x73'),_0x0c91('0x74'),_0x0c91('0x75'),'sys_created_by',_0x0c91('0x63'),_0x0c91('0x42'),_0x0c91('0x76'),_0x0c91('0x77'),_0x0c91('0x78'),_0x0c91('0x79'),_0x0c91('0x7a'),'active',_0x0c91('0x7b'),'business_service',_0x0c91('0x7c'),'sys_domain_path','rfc',_0x0c91('0x7d'),'expected_start',_0x0c91('0x7e'),_0x0c91('0x7f'),_0x0c91('0x80'),_0x0c91('0x81'),'reopened_time',_0x0c91('0x82'),'caller_id','approval_set',_0x0c91('0x64'),_0x0c91('0x83'),'short_description',_0x0c91('0x65'),_0x0c91('0x84'),_0x0c91('0x85'),_0x0c91('0x86'),'assignment_group','business_stc','additional_assignee_list',_0x0c91('0x87'),_0x0c91('0x88'),'notify',_0x0c91('0x89'),_0x0c91('0x8a'),_0x0c91('0x8b'),_0x0c91('0x8c'),_0x0c91('0x8d'),_0x0c91('0x8e'),_0x0c91('0x8f'),_0x0c91('0x90'),'incident_state',_0x0c91('0x91'),_0x0c91('0x92'),'company','reassignment_count',_0x0c91('0x93'),_0x0c91('0x94'),_0x0c91('0x95'),_0x0c91('0x96'),_0x0c91('0x97'),'approval',_0x0c91('0x98'),_0x0c91('0x99'),'sys_mod_count',_0x0c91('0x9a'),_0x0c91('0x9b'),_0x0c91('0x9c'),_0x0c91('0x9d'),'correlation_id',_0x0c91('0x9e'),'category'];var _0xccce78='';var _0x24cb50='';var _0x242ae9=[];var _0x28b2b7='';var _0x5b20a1='';var _0x217766=[];var _0x298221='';var _0xdbee6='';var _0x521c45={};var _0x45bcbe='';return db[_0x0c91('0x35')][_0x0c91('0x57')]({'where':{'id':_0x3816ea['params']['id']},'attributes':['id',_0x0c91('0x9f'),_0x0c91('0xa0'),_0x0c91('0xa1'),'remoteUri',_0x0c91('0xa2')]})[_0x0c91('0x30')](handleEntityNotFound(_0x528d8e,null))[_0x0c91('0x30')](function(_0x188fff){if(_0x188fff){_0x45bcbe=_0x188fff[_0x0c91('0xa3')];var _0x44087f=_0x45bcbe[_0x0c91('0xa4')](-0x1);if(_0x44087f==='/'){_0x45bcbe=_0x45bcbe['substring'](0x0,_0x45bcbe['lastIndexOf'](_0x44087f));}_0xdbee6=util[_0x0c91('0xa5')](_0x0c91('0xa6'),_0x45bcbe);_0x298221=util['format'](_0x0c91('0xa7'),_0x45bcbe);_0x521c45={'user':_0x188fff[_0x0c91('0x9f')],'pass':_0x188fff[_0x0c91('0xa0')]};var _0xf23b7b={'method':_0x0c91('0xa8'),'uri':_0xdbee6+_0x0c91('0xa9'),'auth':_0x521c45,'json':!![]};return rp(_0xf23b7b);}})[_0x0c91('0x30')](function(_0x216f15){if(_0x216f15[_0x0c91('0x23')][_0x0c91('0x3f')]>0x0){_0xccce78=_0x216f15[_0x0c91('0x23')];}console[_0x0c91('0xaa')](_0x0c91('0xab'),_0xccce78);_0x217766=[];_0x24cb50=Object[_0x0c91('0xac')]([],_0xccce78);_['remove'](_0x24cb50,function(_0x51607c){return!_0x1738b6[_0x0c91('0xad')](_0x51607c[_0x0c91('0x32')]);});_0x24cb50[_0x0c91('0xae')](function(_0xbe4527){var _0x2ebf87=createFieldObject(_0x298221,_0x521c45,_0xbe4527['internalType'],_0xbe4527['name'],_0xbe4527['label'],![]);_0x217766[_0x0c91('0xaf')](_0x2ebf87);});return Promise[_0x0c91('0xb0')](_0x217766);})[_0x0c91('0x30')](function(_0xdf894){_0x242ae9=_0xdf894;_0x28b2b7=Object['assign']([],_0xccce78);console[_0x0c91('0xaa')]('TCL:\x20_object',_0xccce78);_['remove'](_0x28b2b7,function(_0x3e9b82){return _0xb0e2e2[_0x0c91('0xad')](_0x3e9b82['name']);});console[_0x0c91('0xaa')](_0x0c91('0xb1'),_0x28b2b7);_0x217766=[];_0x28b2b7[_0x0c91('0xae')](function(_0x5678de){var _0xdc5676=createFieldObject(_0x298221,_0x521c45,_0x5678de[_0x0c91('0xb2')],_0x5678de['name'],_0x5678de[_0x0c91('0xb3')],!![]);_0x217766['push'](_0xdc5676);});return Promise[_0x0c91('0xb0')](_0x217766);})[_0x0c91('0x30')](function(_0x4b763e){_0x5b20a1=_0x4b763e;var _0x213bb4=_0x242ae9[_0x0c91('0xb4')](_0x5b20a1);return{'count':_0x213bb4[_0x0c91('0x3f')],'rows':_0x213bb4};})[_0x0c91('0x30')](respondWithResult(_0x528d8e,null))[_0x0c91('0x51')](function(_0x5f4d0a){console['log']('ServiceNow\x20error:\x20'+_0x5f4d0a);var _0xafab28=_0x3816ea['query'][_0x0c91('0xb5')]?0x1f4:_0x5f4d0a['statusCode']||0x1f4;logger['error'](_0x5f4d0a[_0x0c91('0x31')]);delete _0x5f4d0a['name'];if(_0xafab28===0x191){_0xafab28=0x190;}_0x528d8e['status'](_0xafab28)['send'](_0x3816ea[_0x0c91('0x3a')]['test']?{'message':_0x0c91('0xb6'),'statusCode':_0x5f4d0a[_0x0c91('0xb7')]}:_0x5f4d0a);});};function createFieldObject(_0x38c5d5,_0x3bfefc,_0x4d2b0b,_0x184ab1,_0xe6ac90,_0x5eab07){return new Promise(function(_0x21e113,_0x20d407){var _0xe48fc2={'id':_0x184ab1,'name':_0xe6ac90,'custom':_0x5eab07};if(_0x4d2b0b===_0x0c91('0xb8')){_0xe48fc2[_0x0c91('0x49')]=[{'name':_0x0c91('0xb9'),'value':_0x0c91('0xba')},{'name':_0x0c91('0xbb'),'value':'false'}];_0x21e113(_0xe48fc2);}else{var _0x380ae8={'method':_0x0c91('0xa8'),'uri':_0x38c5d5+_0x0c91('0xbc')+_0x184ab1,'auth':_0x3bfefc,'json':!![]};return rp(_0x380ae8)[_0x0c91('0x30')](function(_0x1bc155){var _0x531dbb=[];if(_0x1bc155[_0x0c91('0x23')][_0x0c91('0x3f')]>0x0){_0x1bc155['result'][_0x0c91('0xae')](function(_0x2b8652){if(_0x2b8652[_0x0c91('0xbd')]===_0x0c91('0xbe')){var _0x5a154c={'name':_0x2b8652['label'],'value':_0x2b8652[_0x0c91('0xbf')]};_0x531dbb[_0x0c91('0xaf')](_0x5a154c);}});}_0xe48fc2[_0x0c91('0x49')]=_0x531dbb;if(_0xe48fc2[_0x0c91('0x49')][_0x0c91('0x3f')]>0x0){_0x21e113(_0xe48fc2);}else{if(_0x5eab07==![]){_0x21e113();}else{_0x21e113(_0xe48fc2);}}});}});} \ No newline at end of file +var _0x1217=['close_code','notify','incident_state','category','caused_by','upon_reject','sys_updated_on','approval_history','number','resolved_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','delivery_plan','impact','active','priority','rfc','time_worked','expected_start','business_duration','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','calendar_duration','sys_class_name','close_notes','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','severity','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','incident?sysparm_display_value=all','log','includes','forEach','internalType','all','assign','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','find','body','destroy','findOne','ServicenowConfiguration','getConfigurations','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','knowledge','subcategory'];(function(_0x4959fd,_0x186515){var _0x97de01=function(_0x29e1d0){while(--_0x29e1d0){_0x4959fd['push'](_0x4959fd['shift']());}};_0x97de01(++_0x186515);}(_0x1217,0x11b));var _0x7121=function(_0xbab64f,_0x26d1c3){_0xbab64f=_0xbab64f-0x0;var _0x213519=_0x1217[_0xbab64f];return _0x213519;};'use strict';var emlformat=require(_0x7121('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7121('0x1'));var jsonpatch=require(_0x7121('0x2'));var rp=require(_0x7121('0x3'));var moment=require('moment');var BPromise=require(_0x7121('0x4'));var Mustache=require(_0x7121('0x5'));var util=require(_0x7121('0x6'));var path=require('path');var sox=require(_0x7121('0x7'));var csv=require(_0x7121('0x8'));var ejs=require(_0x7121('0x9'));var fs=require('fs');var fs_extra=require(_0x7121('0xa'));var _=require(_0x7121('0xb'));var squel=require('squel');var crypto=require(_0x7121('0xc'));var jsforce=require(_0x7121('0xd'));var deskjs=require(_0x7121('0xe'));var toCsv=require(_0x7121('0x8'));var querystring=require(_0x7121('0xf'));var Papa=require(_0x7121('0x10'));var Redis=require(_0x7121('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7121('0x12'));var hardwareService=require(_0x7121('0x13'));var logger=require('../../config/logger')(_0x7121('0x14'));var utils=require(_0x7121('0x15'));var config=require(_0x7121('0x16'));var licenseUtil=require(_0x7121('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7121('0x18'));var jayson=require(_0x7121('0x19'));var client=jayson[_0x7121('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc6d4,_0xa3cd08,_0x4db288,_0x3a992b){return new BPromise(function(_0x183656,_0x828931){var _0x244c2c=_0x3a992b||client;return _0x244c2c['request'](_0x1bc6d4,_0x4db288)[_0x7121('0x1b')](function(_0x59098b){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0xa3cd08,'request\x20sent');logger[_0x7121('0x1c')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xa3cd08,_0x7121('0x1d'),JSON[_0x7121('0x1e')](_0x59098b));if(_0x59098b['error']){if(_0x59098b[_0x7121('0x1f')][_0x7121('0x20')]===0x1f4){logger['error'](_0x7121('0x21'),_0xa3cd08,_0x59098b[_0x7121('0x1f')][_0x7121('0x22')]);return _0x828931(_0x59098b['error'][_0x7121('0x22')]);}logger[_0x7121('0x1f')](_0x7121('0x21'),_0xa3cd08,_0x59098b[_0x7121('0x1f')][_0x7121('0x22')]);return _0x183656(_0x59098b[_0x7121('0x1f')][_0x7121('0x22')]);}else{logger[_0x7121('0x23')](_0x7121('0x21'),_0xa3cd08,'request\x20sent');_0x183656(_0x59098b[_0x7121('0x24')][_0x7121('0x22')]);}})[_0x7121('0x25')](function(_0x58f9b7){logger['error'](_0x7121('0x21'),_0xa3cd08,_0x58f9b7);_0x828931(_0x58f9b7);});});}function respondWithStatusCode(_0x5d866c,_0x556f11){_0x556f11=_0x556f11||0xcc;return function(_0x48f094){if(_0x48f094){return _0x5d866c[_0x7121('0x26')](_0x556f11);}return _0x5d866c[_0x7121('0x27')](_0x556f11)[_0x7121('0x28')]();};}function respondWithResult(_0x2eaae2,_0x438d68){_0x438d68=_0x438d68||0xc8;return function(_0xc76907){if(_0xc76907){return _0x2eaae2[_0x7121('0x27')](_0x438d68)[_0x7121('0x29')](_0xc76907);}};}function respondWithFilteredResult(_0x256b73,_0x4d67d0){return function(_0x33bde9){if(_0x33bde9){var _0x68212c=typeof _0x4d67d0[_0x7121('0x2a')]===_0x7121('0x2b')&&typeof _0x4d67d0[_0x7121('0x2c')]==='undefined';var _0x48ad6b=_0x33bde9[_0x7121('0x2d')];var _0x2596ec=_0x68212c?0x0:_0x4d67d0['offset'];var _0xa82c4f=_0x68212c?_0x33bde9['count']:_0x4d67d0[_0x7121('0x2a')]+_0x4d67d0[_0x7121('0x2c')];var _0x465af3;if(_0xa82c4f>=_0x48ad6b){_0xa82c4f=_0x48ad6b;_0x465af3=0xc8;}else{_0x465af3=0xce;}_0x256b73[_0x7121('0x27')](_0x465af3);return _0x256b73[_0x7121('0x2e')](_0x7121('0x2f'),_0x2596ec+'-'+_0xa82c4f+'/'+_0x48ad6b)['json'](_0x33bde9);}return null;};}function patchUpdates(_0x152477){return function(_0x5ab153){try{jsonpatch[_0x7121('0x30')](_0x5ab153,_0x152477,!![]);}catch(_0x47ea9d){return BPromise[_0x7121('0x31')](_0x47ea9d);}return _0x5ab153[_0x7121('0x32')]();};}function saveUpdates(_0x330571,_0x22926e){return function(_0x39020e){if(_0x39020e){return _0x39020e[_0x7121('0x33')](_0x330571)[_0x7121('0x1b')](function(_0x16b1d1){return _0x16b1d1;});}return null;};}function removeEntity(_0x581610,_0x1010f5){return function(_0x4aee12){if(_0x4aee12){return _0x4aee12['destroy']()['then'](function(){_0x581610[_0x7121('0x27')](0xcc)[_0x7121('0x28')]();});}};}function handleEntityNotFound(_0x327d13,_0x468f14){return function(_0x615f98){if(!_0x615f98){_0x327d13[_0x7121('0x26')](0x194);}return _0x615f98;};}function handleError(_0x472797,_0x1097ac){_0x1097ac=_0x1097ac||0x1f4;return function(_0x492cae){logger[_0x7121('0x1f')](_0x492cae[_0x7121('0x34')]);if(_0x492cae['name']){delete _0x492cae['name'];}_0x472797[_0x7121('0x27')](_0x1097ac)['send'](_0x492cae);};}exports[_0x7121('0x35')]=function(_0x33ef9c,_0x420921){var _0x43dc9f={},_0x21735b={},_0x3563bf={'count':0x0,'rows':[]};var _0x2a40f0=_[_0x7121('0x36')](db[_0x7121('0x37')][_0x7121('0x38')],function(_0x1bc4d9){return{'name':_0x1bc4d9[_0x7121('0x39')],'type':_0x1bc4d9[_0x7121('0x3a')][_0x7121('0x3b')]};});_0x21735b[_0x7121('0x3c')]=_[_0x7121('0x36')](_0x2a40f0,_0x7121('0x3d'));_0x21735b[_0x7121('0x3e')]=_[_0x7121('0x3f')](_0x33ef9c[_0x7121('0x3e')]);_0x21735b[_0x7121('0x40')]=_['intersection'](_0x21735b[_0x7121('0x3c')],_0x21735b[_0x7121('0x3e')]);_0x43dc9f[_0x7121('0x41')]=_[_0x7121('0x42')](_0x21735b[_0x7121('0x3c')],qs[_0x7121('0x43')](_0x33ef9c[_0x7121('0x3e')][_0x7121('0x43')]));_0x43dc9f[_0x7121('0x41')]=_0x43dc9f[_0x7121('0x41')]['length']?_0x43dc9f['attributes']:_0x21735b['model'];if(!_0x33ef9c[_0x7121('0x3e')][_0x7121('0x44')](_0x7121('0x45'))){_0x43dc9f[_0x7121('0x2c')]=qs['limit'](_0x33ef9c[_0x7121('0x3e')][_0x7121('0x2c')]);_0x43dc9f[_0x7121('0x2a')]=qs['offset'](_0x33ef9c[_0x7121('0x3e')][_0x7121('0x2a')]);}_0x43dc9f[_0x7121('0x46')]=qs[_0x7121('0x47')](_0x33ef9c[_0x7121('0x3e')][_0x7121('0x47')]);_0x43dc9f['where']=qs['filters'](_[_0x7121('0x48')](_0x33ef9c[_0x7121('0x3e')],_0x21735b[_0x7121('0x40')]),_0x2a40f0);if(_0x33ef9c[_0x7121('0x3e')][_0x7121('0x49')]){_0x43dc9f[_0x7121('0x4a')]=_[_0x7121('0x4b')](_0x43dc9f['where'],{'$or':_[_0x7121('0x36')](_0x2a40f0,function(_0x385e1d){if(_0x385e1d[_0x7121('0x3a')]!==_0x7121('0x4c')){var _0x120222={};_0x120222[_0x385e1d['name']]={'$like':'%'+_0x33ef9c[_0x7121('0x3e')]['filter']+'%'};return _0x120222;}})});}_0x43dc9f=_[_0x7121('0x4b')]({},_0x43dc9f,_0x33ef9c[_0x7121('0x4d')]);var _0x5a055c={'where':_0x43dc9f['where']};return db[_0x7121('0x37')][_0x7121('0x2d')](_0x5a055c)[_0x7121('0x1b')](function(_0x1db13c){_0x3563bf[_0x7121('0x2d')]=_0x1db13c;if(_0x33ef9c[_0x7121('0x3e')][_0x7121('0x4e')]){_0x43dc9f[_0x7121('0x4f')]=[{'all':!![]}];}return db[_0x7121('0x37')][_0x7121('0x50')](_0x43dc9f);})[_0x7121('0x1b')](function(_0x4d2dc9){_0x3563bf[_0x7121('0x51')]=_0x4d2dc9;return _0x3563bf;})[_0x7121('0x1b')](respondWithFilteredResult(_0x420921,_0x43dc9f))[_0x7121('0x25')](handleError(_0x420921,null));};exports[_0x7121('0x52')]=function(_0x5d089e,_0x41cb04){var _0xed64bf={'raw':![],'where':{'id':_0x5d089e[_0x7121('0x53')]['id']}},_0x6a4e5b={};_0x6a4e5b['model']=_['keys'](db['ServicenowAccount'][_0x7121('0x38')]);_0x6a4e5b[_0x7121('0x3e')]=_[_0x7121('0x3f')](_0x5d089e[_0x7121('0x3e')]);_0x6a4e5b[_0x7121('0x40')]=_[_0x7121('0x42')](_0x6a4e5b[_0x7121('0x3c')],_0x6a4e5b[_0x7121('0x3e')]);_0xed64bf[_0x7121('0x41')]=_['intersection'](_0x6a4e5b[_0x7121('0x3c')],qs['fields'](_0x5d089e[_0x7121('0x3e')][_0x7121('0x43')]));_0xed64bf[_0x7121('0x41')]=_0xed64bf[_0x7121('0x41')][_0x7121('0x54')]?_0xed64bf[_0x7121('0x41')]:_0x6a4e5b['model'];if(_0x5d089e[_0x7121('0x3e')]['includeAll']){_0xed64bf['include']=[{'all':!![]}];}_0xed64bf=_['merge']({},_0xed64bf,_0x5d089e[_0x7121('0x4d')]);return db[_0x7121('0x37')]['find'](_0xed64bf)[_0x7121('0x1b')](handleEntityNotFound(_0x41cb04,null))[_0x7121('0x1b')](respondWithResult(_0x41cb04,null))['catch'](handleError(_0x41cb04,null));};exports[_0x7121('0x55')]=function(_0x5af175,_0x52047d){return db[_0x7121('0x37')][_0x7121('0x55')](_0x5af175['body'],{})['then'](respondWithResult(_0x52047d,0xc9))[_0x7121('0x25')](handleError(_0x52047d,null));};exports['update']=function(_0xea4c0f,_0xa18070){if(_0xea4c0f['body']['id']){delete _0xea4c0f['body']['id'];}return db[_0x7121('0x37')][_0x7121('0x56')]({'where':{'id':_0xea4c0f['params']['id']}})[_0x7121('0x1b')](handleEntityNotFound(_0xa18070,null))[_0x7121('0x1b')](saveUpdates(_0xea4c0f[_0x7121('0x57')],null))[_0x7121('0x1b')](respondWithResult(_0xa18070,null))[_0x7121('0x25')](handleError(_0xa18070,null));};exports[_0x7121('0x58')]=function(_0x499b5e,_0x531e8f){return db[_0x7121('0x37')][_0x7121('0x56')]({'where':{'id':_0x499b5e[_0x7121('0x53')]['id']}})[_0x7121('0x1b')](handleEntityNotFound(_0x531e8f,null))['then'](removeEntity(_0x531e8f,null))[_0x7121('0x25')](handleError(_0x531e8f,null));};exports['getConfigurations']=function(_0x116489,_0x4cd9c6,_0x495ea9){var _0x4f4708={};var _0x3622e8={};var _0x69cb0d;var _0x18492d;return db[_0x7121('0x37')][_0x7121('0x59')]({'where':{'id':_0x116489[_0x7121('0x53')]['id']}})[_0x7121('0x1b')](handleEntityNotFound(_0x4cd9c6,null))[_0x7121('0x1b')](function(_0x22ad55){if(_0x22ad55){_0x69cb0d=_0x22ad55;_0x3622e8[_0x7121('0x3c')]=_[_0x7121('0x3f')](db[_0x7121('0x5a')][_0x7121('0x38')]);_0x3622e8['query']=_[_0x7121('0x3f')](_0x116489[_0x7121('0x3e')]);_0x3622e8['filters']=_[_0x7121('0x42')](_0x3622e8[_0x7121('0x3c')],_0x3622e8[_0x7121('0x3e')]);_0x4f4708['attributes']=_[_0x7121('0x42')](_0x3622e8[_0x7121('0x3c')],qs['fields'](_0x116489['query'][_0x7121('0x43')]));_0x4f4708[_0x7121('0x41')]=_0x4f4708['attributes'][_0x7121('0x54')]?_0x4f4708[_0x7121('0x41')]:_0x3622e8['model'];_0x4f4708[_0x7121('0x46')]=qs[_0x7121('0x47')](_0x116489[_0x7121('0x3e')][_0x7121('0x47')]);_0x4f4708[_0x7121('0x4a')]=qs[_0x7121('0x40')](_[_0x7121('0x48')](_0x116489[_0x7121('0x3e')],_0x3622e8['filters']));if(_0x116489[_0x7121('0x3e')][_0x7121('0x49')]){_0x4f4708[_0x7121('0x4a')]=_[_0x7121('0x4b')](_0x4f4708[_0x7121('0x4a')],{'$or':_['map'](_0x4f4708[_0x7121('0x41')],function(_0x56bfd0){var _0x29a3be={};_0x29a3be[_0x56bfd0]={'$like':'%'+_0x116489[_0x7121('0x3e')][_0x7121('0x49')]+'%'};return _0x29a3be;})});}_0x4f4708=_['merge']({},_0x4f4708,_0x116489[_0x7121('0x4d')]);return _0x69cb0d[_0x7121('0x5b')](_0x4f4708);}})[_0x7121('0x1b')](function(_0x23e257){if(_0x23e257){_0x18492d=_0x23e257[_0x7121('0x54')];if(!_0x116489['query']['hasOwnProperty']('nolimit')){_0x4f4708[_0x7121('0x2c')]=qs[_0x7121('0x2c')](_0x116489['query'][_0x7121('0x2c')]);_0x4f4708[_0x7121('0x2a')]=qs[_0x7121('0x2a')](_0x116489[_0x7121('0x3e')]['offset']);}return _0x69cb0d[_0x7121('0x5b')](_0x4f4708);}})['then'](function(_0x4f93d1){if(_0x4f93d1){return _0x4f93d1?{'count':_0x18492d,'rows':_0x4f93d1}:null;}})[_0x7121('0x1b')](respondWithResult(_0x4cd9c6,null))[_0x7121('0x25')](handleError(_0x4cd9c6,null));};exports['addConfiguration']=function(_0x4084b6,_0x36dc95,_0xfff1b0){if(_0x4084b6[_0x7121('0x57')]['id']){delete _0x4084b6['body']['id'];}return db[_0x7121('0x37')][_0x7121('0x59')]({'where':{'id':_0x4084b6[_0x7121('0x53')]['id']}})[_0x7121('0x1b')](handleEntityNotFound(_0x36dc95,null))['then'](function(_0x3a453a){if(_0x3a453a){_0x4084b6[_0x7121('0x57')]['AccountId']=_0x3a453a['id'];_0x4084b6[_0x7121('0x57')][_0x7121('0x5c')]=integrations[_0x7121('0x5d')](_0x4084b6[_0x7121('0x57')][_0x7121('0x5e')],_0x4084b6[_0x7121('0x57')][_0x7121('0x3a')]);_0x4084b6[_0x7121('0x57')][_0x7121('0x5f')]=integrations['getDescriptions'](_0x4084b6[_0x7121('0x57')][_0x7121('0x5e')],_0x4084b6[_0x7121('0x57')][_0x7121('0x3a')]);return db['ServicenowConfiguration'][_0x7121('0x55')](_0x4084b6[_0x7121('0x57')],{'include':[{'model':db[_0x7121('0x60')],'as':_0x7121('0x5c')},{'model':db[_0x7121('0x60')],'as':_0x7121('0x5f')}]});}return null;})['then'](respondWithResult(_0x36dc95,null))[_0x7121('0x25')](handleError(_0x36dc95,null));};exports[_0x7121('0x61')]=function(_0x752cd8,_0x372ecb,_0x4ff93a){var _0x223c24=[_0x7121('0x62'),'hold_reason',_0x7121('0x63'),_0x7121('0x64'),_0x7121('0x65'),_0x7121('0x66'),_0x7121('0x67'),'severity',_0x7121('0x68')];var _0x5309cb=['parent',_0x7121('0x62'),_0x7121('0x69'),'watch_list',_0x7121('0x6a'),_0x7121('0x6b'),'child_incidents','hold_reason',_0x7121('0x6c'),_0x7121('0x6d'),_0x7121('0x6e'),'sys_updated_by','opened_by',_0x7121('0x6f'),_0x7121('0x70'),_0x7121('0x71'),_0x7121('0x72'),'sys_created_by','knowledge',_0x7121('0x46'),_0x7121('0x73'),_0x7121('0x74'),'cmdb_ci',_0x7121('0x75'),_0x7121('0x76'),_0x7121('0x77'),'work_notes_list','business_service',_0x7121('0x78'),'sys_domain_path',_0x7121('0x79'),_0x7121('0x7a'),_0x7121('0x7b'),'opened_at',_0x7121('0x7c'),'group_list',_0x7121('0x7d'),'reopened_time',_0x7121('0x7e'),_0x7121('0x7f'),_0x7121('0x80'),_0x7121('0x64'),_0x7121('0x81'),_0x7121('0x82'),_0x7121('0x65'),_0x7121('0x83'),'delivery_task',_0x7121('0x84'),_0x7121('0x85'),'business_stc','additional_assignee_list','description',_0x7121('0x86'),_0x7121('0x66'),_0x7121('0x87'),_0x7121('0x88'),'closed_by',_0x7121('0x89'),'parent_incident',_0x7121('0x8a'),_0x7121('0x8b'),_0x7121('0x8c'),_0x7121('0x67'),_0x7121('0x8d'),_0x7121('0x8e'),_0x7121('0x8f'),_0x7121('0x90'),_0x7121('0x91'),'assigned_to',_0x7121('0x92'),_0x7121('0x93'),_0x7121('0x94'),'approval',_0x7121('0x95'),_0x7121('0x96'),_0x7121('0x97'),_0x7121('0x98'),_0x7121('0x99'),_0x7121('0x9a'),_0x7121('0x9b'),_0x7121('0x9c'),_0x7121('0x9d'),'category'];var _0x572ec7='';var _0xbb1784='';var _0x107d03=[];var _0x4d1d4f='';var _0x4a447f='';var _0x2198ab=[];var _0x5eebe6='';var _0x67ae1b='';var _0x1b144f={};var _0x24f8ae='';return db[_0x7121('0x37')][_0x7121('0x59')]({'where':{'id':_0x752cd8[_0x7121('0x53')]['id']},'attributes':['id',_0x7121('0x9e'),_0x7121('0x9f'),'email',_0x7121('0xa0'),_0x7121('0xa1')]})[_0x7121('0x1b')](handleEntityNotFound(_0x372ecb,null))[_0x7121('0x1b')](function(_0x2be543){if(_0x2be543){_0x24f8ae=_0x2be543[_0x7121('0xa0')];var _0x4c9918=_0x24f8ae['slice'](-0x1);if(_0x4c9918==='/'){_0x24f8ae=_0x24f8ae[_0x7121('0xa2')](0x0,_0x24f8ae[_0x7121('0xa3')](_0x4c9918));}_0x67ae1b=util['format'](_0x7121('0xa4'),_0x24f8ae);_0x5eebe6=util[_0x7121('0xa5')](_0x7121('0xa6'),_0x24f8ae);_0x1b144f={'user':_0x2be543['username'],'pass':_0x2be543['password']};var _0x36600c={'method':'GET','uri':_0x67ae1b+_0x7121('0xa7'),'auth':_0x1b144f,'json':!![]};return rp(_0x36600c);}})[_0x7121('0x1b')](function(_0xdc1472){if(_0xdc1472[_0x7121('0x24')]['length']>0x0){_0x572ec7=_0xdc1472[_0x7121('0x24')];}console[_0x7121('0xa8')]('incident\x20table\x20objects',_0x572ec7);_0x2198ab=[];_0xbb1784=Object['assign']([],_0x572ec7);_['remove'](_0xbb1784,function(_0x25800c){return!_0x223c24[_0x7121('0xa9')](_0x25800c[_0x7121('0x3d')]);});_0xbb1784[_0x7121('0xaa')](function(_0x4fb943){var _0x3fb62a=createFieldObject(_0x5eebe6,_0x1b144f,_0x4fb943[_0x7121('0xab')],_0x4fb943[_0x7121('0x3d')],_0x4fb943['label'],![]);_0x2198ab['push'](_0x3fb62a);});return Promise[_0x7121('0xac')](_0x2198ab);})[_0x7121('0x1b')](function(_0x8e6716){_0x107d03=_0x8e6716;_0x4d1d4f=Object[_0x7121('0xad')]([],_0x572ec7);console['log'](_0x7121('0xae'),_0x572ec7);_[_0x7121('0xaf')](_0x4d1d4f,function(_0x4b00c6){return _0x5309cb[_0x7121('0xa9')](_0x4b00c6['name']);});console['log'](_0x7121('0xb0'),_0x4d1d4f);_0x2198ab=[];_0x4d1d4f[_0x7121('0xaa')](function(_0x22cf7d){var _0x591bd5=createFieldObject(_0x5eebe6,_0x1b144f,_0x22cf7d[_0x7121('0xab')],_0x22cf7d[_0x7121('0x3d')],_0x22cf7d[_0x7121('0xb1')],!![]);_0x2198ab[_0x7121('0xb2')](_0x591bd5);});return Promise[_0x7121('0xac')](_0x2198ab);})[_0x7121('0x1b')](function(_0x47ad45){_0x4a447f=_0x47ad45;var _0x499dc9=_0x107d03[_0x7121('0xb3')](_0x4a447f);return{'count':_0x499dc9[_0x7121('0x54')],'rows':_0x499dc9};})[_0x7121('0x1b')](respondWithResult(_0x372ecb,null))['catch'](function(_0x2ab12f){console[_0x7121('0xa8')](_0x7121('0xb4')+_0x2ab12f);var _0x2c9927=_0x752cd8[_0x7121('0x3e')][_0x7121('0xb5')]?0x1f4:_0x2ab12f[_0x7121('0xb6')]||0x1f4;logger[_0x7121('0x1f')](_0x2ab12f[_0x7121('0x34')]);delete _0x2ab12f[_0x7121('0x3d')];if(_0x2c9927===0x191){_0x2c9927=0x190;}_0x372ecb[_0x7121('0x27')](_0x2c9927)[_0x7121('0xb7')](_0x752cd8[_0x7121('0x3e')][_0x7121('0xb5')]?{'message':_0x7121('0xb8'),'statusCode':_0x2ab12f[_0x7121('0xb6')]}:_0x2ab12f);});};function createFieldObject(_0x5fe578,_0x4826e5,_0x511171,_0x5f2f78,_0x1c3ebf,_0x44c26d){return new Promise(function(_0x22a3c9,_0x2223af){var _0x4f680d={'id':_0x5f2f78,'name':_0x1c3ebf,'custom':_0x44c26d};if(_0x511171===_0x7121('0xb9')){_0x4f680d[_0x7121('0x4d')]=[{'name':_0x7121('0xba'),'value':_0x7121('0xbb')},{'name':'False','value':_0x7121('0xbc')}];_0x22a3c9(_0x4f680d);}else{var _0x122846={'method':_0x7121('0xbd'),'uri':_0x5fe578+_0x7121('0xbe')+_0x5f2f78,'auth':_0x4826e5,'json':!![]};return rp(_0x122846)['then'](function(_0x41fdce){var _0x557ba5=[];if(_0x41fdce[_0x7121('0x24')]['length']>0x0){_0x41fdce[_0x7121('0x24')][_0x7121('0xaa')](function(_0x10cae4){if(_0x10cae4[_0x7121('0xbf')]===_0x7121('0xbc')){var _0x333e86={'name':_0x10cae4['label'],'value':_0x10cae4['value']};_0x557ba5[_0x7121('0xb2')](_0x333e86);}});}_0x4f680d['options']=_0x557ba5;if(_0x4f680d['options'][_0x7121('0x54')]>0x0){_0x22a3c9(_0x4f680d);}else{if(_0x44c26d==![]){_0x22a3c9();}else{_0x22a3c9(_0x4f680d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 73c451a..f1ea695 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 _0xae24=['../../config/logger','moment','bluebird','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x194a4,_0xd80598){var _0x49085f=function(_0x823fb1){while(--_0x823fb1){_0x194a4['push'](_0x194a4['shift']());}};_0x49085f(++_0xd80598);}(_0xae24,0x182));var _0x4ae2=function(_0x490791,_0x1efd2b){_0x490791=_0x490791-0x0;var _0x3b2d4e=_0xae24[_0x490791];return _0x3b2d4e;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));var integrations=require(_0x4ae2('0x6'));module[_0x4ae2('0x7')]=function(_0x3e6055,_0x428054){return _0x3e6055[_0x4ae2('0x8')]('ServicenowAccount',attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd59=['bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x3a23d3,_0x4088d8){var _0x10803b=function(_0x333328){while(--_0x333328){_0x3a23d3['push'](_0x3a23d3['shift']());}};_0x10803b(++_0x4088d8);}(_0xcd59,0x14b));var _0x9cd5=function(_0x1cd71f,_0x2a9d19){_0x1cd71f=_0x1cd71f-0x0;var _0x33d362=_0xcd59[_0x1cd71f];return _0x33d362;};'use strict';var _=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var logger=require(_0x9cd5('0x2'))(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var BPromise=require(_0x9cd5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cd5('0x6'));var rimraf=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var attributes=require(_0x9cd5('0x9'));var integrations=require(_0x9cd5('0xa'));module[_0x9cd5('0xb')]=function(_0x46277c,_0x2cd19a){return _0x46277c[_0x9cd5('0xc')](_0x9cd5('0xd'),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 2185115..dce6fd5 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 _0x8464=['options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','find','ShowServicenowAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ServicenowAccount','findAll'];(function(_0x1a186b,_0x5f09a6){var _0x5de2e9=function(_0x5a21de){while(--_0x5a21de){_0x1a186b['push'](_0x1a186b['shift']());}};_0x5de2e9(++_0x5f09a6);}(_0x8464,0x1c5));var _0x4846=function(_0x59033f,_0x2cf207){_0x59033f=_0x59033f-0x0;var _0x4a4ecb=_0x8464[_0x59033f];return _0x4a4ecb;};'use strict';var _=require(_0x4846('0x0'));var util=require(_0x4846('0x1'));var moment=require('moment');var BPromise=require(_0x4846('0x2'));var rs=require(_0x4846('0x3'));var fs=require('fs');var Redis=require(_0x4846('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4846('0x5'));var logger=require(_0x4846('0x6'))(_0x4846('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4846('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eedea,_0x49ca8f,_0x5e4f70){return new BPromise(function(_0x5c000d,_0x580cf1){return client[_0x4846('0x9')](_0x3eedea,_0x5e4f70)[_0x4846('0xa')](function(_0x5a12ec){logger[_0x4846('0xb')](_0x4846('0xc'),_0x49ca8f,_0x4846('0xd'));logger[_0x4846('0xe')](_0x4846('0xf'),_0x49ca8f,_0x4846('0xd'),JSON[_0x4846('0x10')](_0x5a12ec));if(_0x5a12ec[_0x4846('0x11')]){if(_0x5a12ec['error']['code']===0x1f4){logger['error'](_0x4846('0xc'),_0x49ca8f,_0x5a12ec[_0x4846('0x11')]['message']);return _0x580cf1(_0x5a12ec[_0x4846('0x11')][_0x4846('0x12')]);}logger[_0x4846('0x11')](_0x4846('0xc'),_0x49ca8f,_0x5a12ec[_0x4846('0x11')][_0x4846('0x12')]);return _0x5c000d(_0x5a12ec['error'][_0x4846('0x12')]);}else{logger[_0x4846('0xb')](_0x4846('0xc'),_0x49ca8f,_0x4846('0xd'));_0x5c000d(_0x5a12ec[_0x4846('0x13')]['message']);}})[_0x4846('0x14')](function(_0x112c04){logger[_0x4846('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x49ca8f,_0x112c04);_0x580cf1(_0x112c04);});});}exports['GetServicenowAccount']=function(_0x46165f){var _0x59dd2b=this;return new Promise(function(_0x27c6e9,_0x33d7e7){return db[_0x4846('0x15')][_0x4846('0x16')]({'raw':_0x46165f[_0x4846('0x17')]?_0x46165f[_0x4846('0x17')][_0x4846('0x18')]===undefined?!![]:![]:!![],'where':_0x46165f[_0x4846('0x17')]?_0x46165f['options'][_0x4846('0x19')]||null:null,'attributes':_0x46165f[_0x4846('0x17')]?_0x46165f['options'][_0x4846('0x1a')]||null:null,'limit':_0x46165f[_0x4846('0x17')]?_0x46165f['options'][_0x4846('0x1b')]||null:null,'include':_0x46165f[_0x4846('0x17')]?_0x46165f['options'][_0x4846('0x1c')]?_[_0x4846('0x1d')](_0x46165f[_0x4846('0x17')][_0x4846('0x1c')],function(_0x1a8eef){return{'model':db[_0x1a8eef['model']],'as':_0x1a8eef['as'],'attributes':_0x1a8eef[_0x4846('0x1a')],'include':_0x1a8eef[_0x4846('0x1c')]?_['map'](_0x1a8eef[_0x4846('0x1c')],function(_0x259ca0){return{'model':db[_0x259ca0[_0x4846('0x1e')]],'as':_0x259ca0['as'],'attributes':_0x259ca0[_0x4846('0x1a')],'include':_0x259ca0['include']?_[_0x4846('0x1d')](_0x259ca0[_0x4846('0x1c')],function(_0x43d8ef){return{'model':db[_0x43d8ef['model']],'as':_0x43d8ef['as'],'attributes':_0x43d8ef[_0x4846('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4846('0xa')](function(_0x1a8997){logger[_0x4846('0xb')](_0x4846('0x1f'),_0x46165f);logger[_0x4846('0xe')](_0x4846('0x1f'),_0x46165f,JSON['stringify'](_0x1a8997));_0x27c6e9(_0x1a8997);})[_0x4846('0x14')](function(_0xd01466){logger[_0x4846('0x11')](_0x4846('0x1f'),_0xd01466[_0x4846('0x12')],_0x46165f);_0x33d7e7(_0x59dd2b[_0x4846('0x11')](0x1f4,_0xd01466[_0x4846('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x368bc1){var _0x20e608=this;return new Promise(function(_0x415f48,_0x389802){return db[_0x4846('0x15')][_0x4846('0x20')]({'raw':_0x368bc1[_0x4846('0x17')]?_0x368bc1[_0x4846('0x17')][_0x4846('0x18')]===undefined?!![]:![]:!![],'where':_0x368bc1[_0x4846('0x17')]?_0x368bc1['options'][_0x4846('0x19')]||null:null,'attributes':_0x368bc1[_0x4846('0x17')]?_0x368bc1[_0x4846('0x17')][_0x4846('0x1a')]||null:null,'include':_0x368bc1[_0x4846('0x17')]?_0x368bc1[_0x4846('0x17')]['include']?_['map'](_0x368bc1[_0x4846('0x17')][_0x4846('0x1c')],function(_0x3f7a73){return{'model':db[_0x3f7a73[_0x4846('0x1e')]],'as':_0x3f7a73['as'],'attributes':_0x3f7a73[_0x4846('0x1a')],'include':_0x3f7a73[_0x4846('0x1c')]?_['map'](_0x3f7a73[_0x4846('0x1c')],function(_0xd0e50d){return{'model':db[_0xd0e50d[_0x4846('0x1e')]],'as':_0xd0e50d['as'],'attributes':_0xd0e50d[_0x4846('0x1a')],'include':_0xd0e50d['include']?_[_0x4846('0x1d')](_0xd0e50d[_0x4846('0x1c')],function(_0x1bb356){return{'model':db[_0x1bb356[_0x4846('0x1e')]],'as':_0x1bb356['as'],'attributes':_0x1bb356[_0x4846('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4846('0xa')](function(_0x2a5928){logger[_0x4846('0xb')](_0x4846('0x21'),_0x368bc1);logger[_0x4846('0xe')](_0x4846('0x21'),_0x368bc1,JSON[_0x4846('0x10')](_0x2a5928));_0x415f48(_0x2a5928);})[_0x4846('0x14')](function(_0x2ac682){logger['error'](_0x4846('0x21'),_0x2ac682[_0x4846('0x12')],_0x368bc1);_0x389802(_0x20e608[_0x4846('0x11')](0x1f4,_0x2ac682[_0x4846('0x12')]));});});}; \ No newline at end of file +var _0xa57f=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','model','attributes','include','map','then','ShowServicenowAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0xa57f,0x1c6));var _0xfa57=function(_0x11f4e5,_0x22c0a3){_0x11f4e5=_0x11f4e5-0x0;var _0x24a8d1=_0xa57f[_0x11f4e5];return _0x24a8d1;};'use strict';var _=require(_0xfa57('0x0'));var util=require(_0xfa57('0x1'));var moment=require(_0xfa57('0x2'));var BPromise=require(_0xfa57('0x3'));var rs=require(_0xfa57('0x4'));var fs=require('fs');var Redis=require(_0xfa57('0x5'));var db=require(_0xfa57('0x6'))['db'];var utils=require(_0xfa57('0x7'));var logger=require(_0xfa57('0x8'))(_0xfa57('0x9'));var config=require(_0xfa57('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfa57('0xb')][_0xfa57('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1db7eb,_0x457b84,_0x4f184b){return new BPromise(function(_0x4ca39e,_0x2a1014){return client[_0xfa57('0xd')](_0x1db7eb,_0x4f184b)['then'](function(_0x41680a){logger['info'](_0xfa57('0xe'),_0x457b84,_0xfa57('0xf'));logger[_0xfa57('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x457b84,_0xfa57('0xf'),JSON[_0xfa57('0x11')](_0x41680a));if(_0x41680a['error']){if(_0x41680a['error']['code']===0x1f4){logger['error'](_0xfa57('0xe'),_0x457b84,_0x41680a[_0xfa57('0x12')]['message']);return _0x2a1014(_0x41680a['error'][_0xfa57('0x13')]);}logger['error'](_0xfa57('0xe'),_0x457b84,_0x41680a[_0xfa57('0x12')][_0xfa57('0x13')]);return _0x4ca39e(_0x41680a['error'][_0xfa57('0x13')]);}else{logger[_0xfa57('0x14')](_0xfa57('0xe'),_0x457b84,_0xfa57('0xf'));_0x4ca39e(_0x41680a[_0xfa57('0x15')]['message']);}})[_0xfa57('0x16')](function(_0x3fd11c){logger['error'](_0xfa57('0xe'),_0x457b84,_0x3fd11c);_0x2a1014(_0x3fd11c);});});}exports[_0xfa57('0x17')]=function(_0x40dc39){var _0x55ec6c=this;return new Promise(function(_0x3a9862,_0x244fc0){return db[_0xfa57('0x18')][_0xfa57('0x19')]({'raw':_0x40dc39['options']?_0x40dc39[_0xfa57('0x1a')][_0xfa57('0x1b')]===undefined?!![]:![]:!![],'where':_0x40dc39[_0xfa57('0x1a')]?_0x40dc39[_0xfa57('0x1a')]['where']||null:null,'attributes':_0x40dc39[_0xfa57('0x1a')]?_0x40dc39['options']['attributes']||null:null,'limit':_0x40dc39[_0xfa57('0x1a')]?_0x40dc39[_0xfa57('0x1a')][_0xfa57('0x1c')]||null:null,'include':_0x40dc39['options']?_0x40dc39[_0xfa57('0x1a')]['include']?_['map'](_0x40dc39['options']['include'],function(_0x1234c9){return{'model':db[_0x1234c9[_0xfa57('0x1d')]],'as':_0x1234c9['as'],'attributes':_0x1234c9[_0xfa57('0x1e')],'include':_0x1234c9[_0xfa57('0x1f')]?_['map'](_0x1234c9[_0xfa57('0x1f')],function(_0x2c486b){return{'model':db[_0x2c486b['model']],'as':_0x2c486b['as'],'attributes':_0x2c486b['attributes'],'include':_0x2c486b[_0xfa57('0x1f')]?_[_0xfa57('0x20')](_0x2c486b[_0xfa57('0x1f')],function(_0x1fcd29){return{'model':db[_0x1fcd29[_0xfa57('0x1d')]],'as':_0x1fcd29['as'],'attributes':_0x1fcd29[_0xfa57('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfa57('0x21')](function(_0x38256f){logger[_0xfa57('0x14')]('GetServicenowAccount',_0x40dc39);logger[_0xfa57('0x10')](_0xfa57('0x17'),_0x40dc39,JSON[_0xfa57('0x11')](_0x38256f));_0x3a9862(_0x38256f);})[_0xfa57('0x16')](function(_0x2e673b){logger[_0xfa57('0x12')](_0xfa57('0x17'),_0x2e673b[_0xfa57('0x13')],_0x40dc39);_0x244fc0(_0x55ec6c[_0xfa57('0x12')](0x1f4,_0x2e673b[_0xfa57('0x13')]));});});};exports[_0xfa57('0x22')]=function(_0x431032){var _0x13406e=this;return new Promise(function(_0x2d85bc,_0x58064c){return db[_0xfa57('0x18')]['find']({'raw':_0x431032[_0xfa57('0x1a')]?_0x431032[_0xfa57('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x431032[_0xfa57('0x1a')]?_0x431032[_0xfa57('0x1a')][_0xfa57('0x23')]||null:null,'attributes':_0x431032[_0xfa57('0x1a')]?_0x431032['options'][_0xfa57('0x1e')]||null:null,'include':_0x431032[_0xfa57('0x1a')]?_0x431032[_0xfa57('0x1a')][_0xfa57('0x1f')]?_['map'](_0x431032[_0xfa57('0x1a')][_0xfa57('0x1f')],function(_0x2fad69){return{'model':db[_0x2fad69[_0xfa57('0x1d')]],'as':_0x2fad69['as'],'attributes':_0x2fad69[_0xfa57('0x1e')],'include':_0x2fad69[_0xfa57('0x1f')]?_[_0xfa57('0x20')](_0x2fad69['include'],function(_0x214f50){return{'model':db[_0x214f50['model']],'as':_0x214f50['as'],'attributes':_0x214f50[_0xfa57('0x1e')],'include':_0x214f50['include']?_[_0xfa57('0x20')](_0x214f50[_0xfa57('0x1f')],function(_0x2985e6){return{'model':db[_0x2985e6['model']],'as':_0x2985e6['as'],'attributes':_0x2985e6[_0xfa57('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfa57('0x21')](function(_0x2f2425){logger['info'](_0xfa57('0x22'),_0x431032);logger[_0xfa57('0x10')]('ShowServicenowAccount',_0x431032,JSON[_0xfa57('0x11')](_0x2f2425));_0x2d85bc(_0x2f2425);})[_0xfa57('0x16')](function(_0x506849){logger[_0xfa57('0x12')](_0xfa57('0x22'),_0x506849['message'],_0x431032);_0x58064c(_0x13406e[_0xfa57('0x12')](0x1f4,_0x506849[_0xfa57('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e0ec9d8..dca5d02 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 _0x850b=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','delete','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x850b,0x114));var _0xb850=function(_0x3e3e5b,_0x194e02){_0x3e3e5b=_0x3e3e5b-0x0;var _0x40a067=_0x850b[_0x3e3e5b];return _0x40a067;};'use strict';var multer=require(_0xb850('0x0'));var util=require(_0xb850('0x1'));var path=require(_0xb850('0x2'));var timeout=require('connect-timeout');var express=require(_0xb850('0x3'));var router=express['Router']();var fs_extra=require(_0xb850('0x4'));var auth=require(_0xb850('0x5'));var interaction=require(_0xb850('0x6'));var config=require(_0xb850('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xb850('0x8')]('/',auth[_0xb850('0x9')](),controller[_0xb850('0xa')]);router[_0xb850('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb850('0xb')]);router[_0xb850('0x8')](_0xb850('0xc'),auth[_0xb850('0x9')](),controller[_0xb850('0xd')]);router[_0xb850('0x8')](_0xb850('0xe'),auth[_0xb850('0x9')](),controller[_0xb850('0xf')]);router[_0xb850('0x8')](_0xb850('0x10'),auth['isAuthenticated'](),controller[_0xb850('0x11')]);router[_0xb850('0x12')]('/',auth[_0xb850('0x9')](),controller['create']);router['put']('/:id',auth[_0xb850('0x9')](),controller[_0xb850('0x13')]);router[_0xb850('0x14')](_0xb850('0x15'),auth[_0xb850('0x9')](),controller[_0xb850('0x16')]);module[_0xb850('0x17')]=router; \ No newline at end of file +var _0x4ad6=['Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x3268b5,_0x32a892){var _0x19a74b=function(_0x3d5dd9){while(--_0x3d5dd9){_0x3268b5['push'](_0x3268b5['shift']());}};_0x19a74b(++_0x32a892);}(_0x4ad6,0x1a5));var _0x64ad=function(_0xc6a472,_0x15728c){_0xc6a472=_0xc6a472-0x0;var _0x5eb219=_0x4ad6[_0xc6a472];return _0x5eb219;};'use strict';var multer=require(_0x64ad('0x0'));var util=require(_0x64ad('0x1'));var path=require(_0x64ad('0x2'));var timeout=require(_0x64ad('0x3'));var express=require('express');var router=express[_0x64ad('0x4')]();var fs_extra=require(_0x64ad('0x5'));var auth=require(_0x64ad('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x64ad('0x7'));var controller=require(_0x64ad('0x8'));router[_0x64ad('0x9')]('/',auth[_0x64ad('0xa')](),controller[_0x64ad('0xb')]);router['get'](_0x64ad('0xc'),auth[_0x64ad('0xa')](),controller[_0x64ad('0xd')]);router[_0x64ad('0x9')](_0x64ad('0xe'),auth[_0x64ad('0xa')](),controller[_0x64ad('0xf')]);router[_0x64ad('0x9')](_0x64ad('0x10'),auth[_0x64ad('0xa')](),controller[_0x64ad('0x11')]);router[_0x64ad('0x9')](_0x64ad('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x64ad('0x13')]('/',auth[_0x64ad('0xa')](),controller[_0x64ad('0x14')]);router[_0x64ad('0x15')](_0x64ad('0xc'),auth['isAuthenticated'](),controller[_0x64ad('0x16')]);router[_0x64ad('0x17')](_0x64ad('0xc'),auth[_0x64ad('0xa')](),controller['destroy']);module[_0x64ad('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 24d183d..81fe00a 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 _0x5604=['STRING','exports'];(function(_0x57a53b,_0x11494e){var _0x29e81c=function(_0x24c522){while(--_0x24c522){_0x57a53b['push'](_0x57a53b['shift']());}};_0x29e81c(++_0x11494e);}(_0x5604,0x1a7));var _0x4560=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x5604[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require('sequelize');module[_0x4560('0x0')]={'name':{'type':Sequelize[_0x4560('0x1')]},'description':{'type':Sequelize[_0x4560('0x1')]}}; \ No newline at end of file +var _0xb58f=['sequelize','exports','STRING'];(function(_0x33df84,_0x5825d1){var _0x42e95e=function(_0x1858ba){while(--_0x1858ba){_0x33df84['push'](_0x33df84['shift']());}};_0x42e95e(++_0x5825d1);}(_0xb58f,0x1e0));var _0xfb58=function(_0x22f08d,_0x2eebdd){_0x22f08d=_0x22f08d-0x0;var _0x4b70a8=_0xb58f[_0x22f08d];return _0x4b70a8;};'use strict';var Sequelize=require(_0xfb58('0x0'));module[_0xfb58('0x1')]={'name':{'type':Sequelize[_0xfb58('0x2')]},'description':{'type':Sequelize[_0xfb58('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 38a0aa6..bec6a76 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 _0x0323=['body','findOne','ServicenowField','filter','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','options','ServicenowConfiguration','include','findAll','rows','show','params','keys','rawAttributes','includeAll','merge','find','catch','create'];(function(_0x37da98,_0x240110){var _0x5c1326=function(_0x5b8165){while(--_0x5b8165){_0x37da98['push'](_0x37da98['shift']());}};_0x5c1326(++_0x240110);}(_0x0323,0x124));var _0x3032=function(_0x28db37,_0x539b92){_0x28db37=_0x28db37-0x0;var _0x562a4d=_0x0323[_0x28db37];return _0x562a4d;};'use strict';var emlformat=require(_0x3032('0x0'));var rimraf=require(_0x3032('0x1'));var zipdir=require(_0x3032('0x2'));var jsonpatch=require(_0x3032('0x3'));var rp=require(_0x3032('0x4'));var moment=require(_0x3032('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3032('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3032('0x7'));var csv=require(_0x3032('0x8'));var ejs=require(_0x3032('0x9'));var fs=require('fs');var fs_extra=require(_0x3032('0xa'));var _=require(_0x3032('0xb'));var squel=require(_0x3032('0xc'));var crypto=require(_0x3032('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3032('0xe'));var toCsv=require(_0x3032('0x8'));var querystring=require(_0x3032('0xf'));var Papa=require('papaparse');var Redis=require(_0x3032('0x10'));var authService=require(_0x3032('0x11'));var qs=require(_0x3032('0x12'));var as=require(_0x3032('0x13'));var hardwareService=require(_0x3032('0x14'));var logger=require(_0x3032('0x15'))(_0x3032('0x16'));var utils=require(_0x3032('0x17'));var config=require(_0x3032('0x18'));var licenseUtil=require(_0x3032('0x19'));var db=require(_0x3032('0x1a'))['db'];var jayson=require(_0x3032('0x1b'));var client=jayson['client'][_0x3032('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1311c0,_0x3f0883,_0x4d0e24,_0x588a0c){return new BPromise(function(_0x4e9969,_0x28dcac){var _0x48b6d3=_0x588a0c||client;return _0x48b6d3['request'](_0x1311c0,_0x4d0e24)[_0x3032('0x1d')](function(_0x434ef7){logger[_0x3032('0x1e')](_0x3032('0x1f'),_0x3f0883,'request\x20sent');logger[_0x3032('0x20')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3f0883,_0x3032('0x21'),JSON[_0x3032('0x22')](_0x434ef7));if(_0x434ef7['error']){if(_0x434ef7[_0x3032('0x23')][_0x3032('0x24')]===0x1f4){logger[_0x3032('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3f0883,_0x434ef7[_0x3032('0x23')][_0x3032('0x25')]);return _0x28dcac(_0x434ef7['error'][_0x3032('0x25')]);}logger[_0x3032('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3f0883,_0x434ef7[_0x3032('0x23')]['message']);return _0x4e9969(_0x434ef7[_0x3032('0x23')][_0x3032('0x25')]);}else{logger[_0x3032('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3f0883,_0x3032('0x21'));_0x4e9969(_0x434ef7[_0x3032('0x26')]['message']);}})['catch'](function(_0x3d71b1){logger[_0x3032('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3f0883,_0x3d71b1);_0x28dcac(_0x3d71b1);});});}function respondWithStatusCode(_0x4bef6d,_0x51813c){_0x51813c=_0x51813c||0xcc;return function(_0x545793){if(_0x545793){return _0x4bef6d[_0x3032('0x27')](_0x51813c);}return _0x4bef6d[_0x3032('0x28')](_0x51813c)[_0x3032('0x29')]();};}function respondWithResult(_0x4524a0,_0x2de8a9){_0x2de8a9=_0x2de8a9||0xc8;return function(_0x2ef721){if(_0x2ef721){return _0x4524a0[_0x3032('0x28')](_0x2de8a9)[_0x3032('0x2a')](_0x2ef721);}};}function respondWithFilteredResult(_0x575d69,_0x36e484){return function(_0x1edd13){if(_0x1edd13){var _0x5506d5=typeof _0x36e484[_0x3032('0x2b')]===_0x3032('0x2c')&&typeof _0x36e484[_0x3032('0x2d')]===_0x3032('0x2c');var _0x2643dc=_0x1edd13['count'];var _0x4a627a=_0x5506d5?0x0:_0x36e484['offset'];var _0x13ec47=_0x5506d5?_0x1edd13[_0x3032('0x2e')]:_0x36e484[_0x3032('0x2b')]+_0x36e484[_0x3032('0x2d')];var _0x42f2a5;if(_0x13ec47>=_0x2643dc){_0x13ec47=_0x2643dc;_0x42f2a5=0xc8;}else{_0x42f2a5=0xce;}_0x575d69[_0x3032('0x28')](_0x42f2a5);return _0x575d69[_0x3032('0x2f')](_0x3032('0x30'),_0x4a627a+'-'+_0x13ec47+'/'+_0x2643dc)['json'](_0x1edd13);}return null;};}function patchUpdates(_0x1f1b79){return function(_0x272a44){try{jsonpatch[_0x3032('0x31')](_0x272a44,_0x1f1b79,!![]);}catch(_0x1ea88d){return BPromise['reject'](_0x1ea88d);}return _0x272a44['save']();};}function saveUpdates(_0x3dcc15,_0x52d00c){return function(_0xb3218c){if(_0xb3218c){return _0xb3218c[_0x3032('0x32')](_0x3dcc15)['then'](function(_0x21d8c1){return _0x21d8c1;});}return null;};}function removeEntity(_0x25b568,_0x3a9db1){return function(_0x25abcc){if(_0x25abcc){return _0x25abcc[_0x3032('0x33')]()[_0x3032('0x1d')](function(){_0x25b568[_0x3032('0x28')](0xcc)[_0x3032('0x29')]();});}};}function handleEntityNotFound(_0x2c4baf,_0x446eb2){return function(_0x4659fd){if(!_0x4659fd){_0x2c4baf[_0x3032('0x27')](0x194);}return _0x4659fd;};}function handleError(_0x24f0ee,_0x2fd92f){_0x2fd92f=_0x2fd92f||0x1f4;return function(_0x542b63){logger['error'](_0x542b63[_0x3032('0x34')]);if(_0x542b63[_0x3032('0x35')]){delete _0x542b63[_0x3032('0x35')];}_0x24f0ee[_0x3032('0x28')](_0x2fd92f)[_0x3032('0x36')](_0x542b63);};}exports[_0x3032('0x37')]=function(_0x36c77a,_0x40d093){var _0x3c5808={},_0xf14b29={},_0x584a3c={'count':0x0,'rows':[]};var _0x1a9a0a=_[_0x3032('0x38')](db['ServicenowConfiguration']['rawAttributes'],function(_0x1504fb){return{'name':_0x1504fb[_0x3032('0x39')],'type':_0x1504fb[_0x3032('0x3a')][_0x3032('0x3b')]};});_0xf14b29[_0x3032('0x3c')]=_[_0x3032('0x38')](_0x1a9a0a,'name');_0xf14b29[_0x3032('0x3d')]=_['keys'](_0x36c77a[_0x3032('0x3d')]);_0xf14b29[_0x3032('0x3e')]=_[_0x3032('0x3f')](_0xf14b29[_0x3032('0x3c')],_0xf14b29[_0x3032('0x3d')]);_0x3c5808[_0x3032('0x40')]=_[_0x3032('0x3f')](_0xf14b29[_0x3032('0x3c')],qs[_0x3032('0x41')](_0x36c77a['query'][_0x3032('0x41')]));_0x3c5808['attributes']=_0x3c5808[_0x3032('0x40')][_0x3032('0x42')]?_0x3c5808[_0x3032('0x40')]:_0xf14b29[_0x3032('0x3c')];if(!_0x36c77a['query'][_0x3032('0x43')](_0x3032('0x44'))){_0x3c5808[_0x3032('0x2d')]=qs[_0x3032('0x2d')](_0x36c77a[_0x3032('0x3d')][_0x3032('0x2d')]);_0x3c5808[_0x3032('0x2b')]=qs[_0x3032('0x2b')](_0x36c77a[_0x3032('0x3d')][_0x3032('0x2b')]);}_0x3c5808[_0x3032('0x45')]=qs[_0x3032('0x46')](_0x36c77a[_0x3032('0x3d')]['sort']);_0x3c5808['where']=qs[_0x3032('0x3e')](_[_0x3032('0x47')](_0x36c77a[_0x3032('0x3d')],_0xf14b29[_0x3032('0x3e')]),_0x1a9a0a);if(_0x36c77a[_0x3032('0x3d')]['filter']){_0x3c5808[_0x3032('0x48')]=_['merge'](_0x3c5808[_0x3032('0x48')],{'$or':_[_0x3032('0x38')](_0x1a9a0a,function(_0x343b62){if(_0x343b62[_0x3032('0x3a')]!==_0x3032('0x49')){var _0x5ba516={};_0x5ba516[_0x343b62[_0x3032('0x35')]]={'$like':'%'+_0x36c77a['query']['filter']+'%'};return _0x5ba516;}})});}_0x3c5808=_['merge']({},_0x3c5808,_0x36c77a[_0x3032('0x4a')]);var _0x184cbd={'where':_0x3c5808[_0x3032('0x48')]};return db[_0x3032('0x4b')][_0x3032('0x2e')](_0x184cbd)['then'](function(_0x48e382){_0x584a3c[_0x3032('0x2e')]=_0x48e382;if(_0x36c77a[_0x3032('0x3d')]['includeAll']){_0x3c5808[_0x3032('0x4c')]=[{'all':!![]}];}return db[_0x3032('0x4b')][_0x3032('0x4d')](_0x3c5808);})[_0x3032('0x1d')](function(_0x177d19){_0x584a3c[_0x3032('0x4e')]=_0x177d19;return _0x584a3c;})['then'](respondWithFilteredResult(_0x40d093,_0x3c5808))['catch'](handleError(_0x40d093,null));};exports[_0x3032('0x4f')]=function(_0x376aea,_0x5b9810){var _0x219861={'raw':![],'where':{'id':_0x376aea[_0x3032('0x50')]['id']}},_0x109ebb={};_0x109ebb[_0x3032('0x3c')]=_[_0x3032('0x51')](db['ServicenowConfiguration'][_0x3032('0x52')]);_0x109ebb[_0x3032('0x3d')]=_[_0x3032('0x51')](_0x376aea['query']);_0x109ebb[_0x3032('0x3e')]=_['intersection'](_0x109ebb[_0x3032('0x3c')],_0x109ebb[_0x3032('0x3d')]);_0x219861['attributes']=_[_0x3032('0x3f')](_0x109ebb['model'],qs[_0x3032('0x41')](_0x376aea[_0x3032('0x3d')]['fields']));_0x219861[_0x3032('0x40')]=_0x219861[_0x3032('0x40')][_0x3032('0x42')]?_0x219861['attributes']:_0x109ebb[_0x3032('0x3c')];if(_0x376aea[_0x3032('0x3d')][_0x3032('0x53')]){_0x219861[_0x3032('0x4c')]=[{'all':!![]}];}_0x219861=_[_0x3032('0x54')]({},_0x219861,_0x376aea['options']);return db[_0x3032('0x4b')][_0x3032('0x55')](_0x219861)[_0x3032('0x1d')](handleEntityNotFound(_0x5b9810,null))['then'](respondWithResult(_0x5b9810,null))[_0x3032('0x56')](handleError(_0x5b9810,null));};exports['create']=function(_0x3f7c22,_0x1f0522){return db[_0x3032('0x4b')][_0x3032('0x57')](_0x3f7c22['body'],{})[_0x3032('0x1d')](respondWithResult(_0x1f0522,0xc9))[_0x3032('0x56')](handleError(_0x1f0522,null));};exports[_0x3032('0x32')]=function(_0x2ee70a,_0x2c570d){if(_0x2ee70a[_0x3032('0x58')]['id']){delete _0x2ee70a['body']['id'];}return db['ServicenowConfiguration'][_0x3032('0x55')]({'where':{'id':_0x2ee70a['params']['id']}})[_0x3032('0x1d')](handleEntityNotFound(_0x2c570d,null))[_0x3032('0x1d')](saveUpdates(_0x2ee70a[_0x3032('0x58')],null))[_0x3032('0x1d')](respondWithResult(_0x2c570d,null))[_0x3032('0x56')](handleError(_0x2c570d,null));};exports[_0x3032('0x33')]=function(_0x592f7b,_0x403696){return db[_0x3032('0x4b')][_0x3032('0x55')]({'where':{'id':_0x592f7b['params']['id']}})[_0x3032('0x1d')](handleEntityNotFound(_0x403696,null))[_0x3032('0x1d')](removeEntity(_0x403696,null))[_0x3032('0x56')](handleError(_0x403696,null));};exports['getFields']=function(_0x110079,_0x281f4d,_0xd25aa){var _0x1956a0={};var _0x221f08={};var _0x3dcfd6;var _0xb5e94;return db['ServicenowConfiguration'][_0x3032('0x59')]({'where':{'id':_0x110079[_0x3032('0x50')]['id']}})['then'](handleEntityNotFound(_0x281f4d,null))['then'](function(_0xcc041b){if(_0xcc041b){_0x3dcfd6=_0xcc041b;_0x221f08['model']=_[_0x3032('0x51')](db[_0x3032('0x5a')]['rawAttributes']);_0x221f08[_0x3032('0x3d')]=_[_0x3032('0x51')](_0x110079[_0x3032('0x3d')]);_0x221f08[_0x3032('0x3e')]=_[_0x3032('0x3f')](_0x221f08[_0x3032('0x3c')],_0x221f08[_0x3032('0x3d')]);_0x1956a0[_0x3032('0x40')]=_['intersection'](_0x221f08[_0x3032('0x3c')],qs[_0x3032('0x41')](_0x110079[_0x3032('0x3d')][_0x3032('0x41')]));_0x1956a0[_0x3032('0x40')]=_0x1956a0['attributes'][_0x3032('0x42')]?_0x1956a0[_0x3032('0x40')]:_0x221f08['model'];_0x1956a0[_0x3032('0x45')]=qs['sort'](_0x110079['query'][_0x3032('0x46')]);_0x1956a0['where']=qs[_0x3032('0x3e')](_[_0x3032('0x47')](_0x110079[_0x3032('0x3d')],_0x221f08['filters']));if(_0x110079[_0x3032('0x3d')][_0x3032('0x5b')]){_0x1956a0[_0x3032('0x48')]=_['merge'](_0x1956a0[_0x3032('0x48')],{'$or':_[_0x3032('0x38')](_0x1956a0[_0x3032('0x40')],function(_0x42dbb6){var _0x46c137={};_0x46c137[_0x42dbb6]={'$like':'%'+_0x110079[_0x3032('0x3d')]['filter']+'%'};return _0x46c137;})});}_0x1956a0=_['merge']({},_0x1956a0,_0x110079[_0x3032('0x4a')]);return _0x3dcfd6['getFields'](_0x1956a0);}})['then'](function(_0x20c89a){if(_0x20c89a){_0xb5e94=_0x20c89a[_0x3032('0x42')];if(!_0x110079[_0x3032('0x3d')]['hasOwnProperty'](_0x3032('0x44'))){_0x1956a0[_0x3032('0x2d')]=qs['limit'](_0x110079['query'][_0x3032('0x2d')]);_0x1956a0[_0x3032('0x2b')]=qs['offset'](_0x110079['query'][_0x3032('0x2b')]);}return _0x3dcfd6[_0x3032('0x5c')](_0x1956a0);}})[_0x3032('0x1d')](function(_0x5338bd){if(_0x5338bd){return _0x5338bd?{'count':_0xb5e94,'rows':_0x5338bd}:null;}})[_0x3032('0x1d')](respondWithResult(_0x281f4d,null))[_0x3032('0x56')](handleError(_0x281f4d,null));};exports[_0x3032('0x5d')]=function(_0x5ef0c4,_0xba1dae,_0x448174){var _0x2d6361={};var _0x14c03e={};var _0x17f1a1;var _0x3546ec;return db[_0x3032('0x4b')][_0x3032('0x59')]({'where':{'id':_0x5ef0c4[_0x3032('0x50')]['id']}})['then'](handleEntityNotFound(_0xba1dae,null))['then'](function(_0x3262ef){if(_0x3262ef){_0x17f1a1=_0x3262ef;_0x14c03e['model']=_[_0x3032('0x51')](db[_0x3032('0x5a')][_0x3032('0x52')]);_0x14c03e[_0x3032('0x3d')]=_[_0x3032('0x51')](_0x5ef0c4[_0x3032('0x3d')]);_0x14c03e[_0x3032('0x3e')]=_[_0x3032('0x3f')](_0x14c03e['model'],_0x14c03e[_0x3032('0x3d')]);_0x2d6361['attributes']=_[_0x3032('0x3f')](_0x14c03e[_0x3032('0x3c')],qs[_0x3032('0x41')](_0x5ef0c4[_0x3032('0x3d')][_0x3032('0x41')]));_0x2d6361['attributes']=_0x2d6361['attributes'][_0x3032('0x42')]?_0x2d6361['attributes']:_0x14c03e[_0x3032('0x3c')];_0x2d6361[_0x3032('0x45')]=qs[_0x3032('0x46')](_0x5ef0c4[_0x3032('0x3d')]['sort']);_0x2d6361[_0x3032('0x48')]=qs[_0x3032('0x3e')](_[_0x3032('0x47')](_0x5ef0c4[_0x3032('0x3d')],_0x14c03e[_0x3032('0x3e')]));if(_0x5ef0c4['query'][_0x3032('0x5b')]){_0x2d6361[_0x3032('0x48')]=_[_0x3032('0x54')](_0x2d6361[_0x3032('0x48')],{'$or':_['map'](_0x2d6361[_0x3032('0x40')],function(_0x19a233){var _0x4c8937={};_0x4c8937[_0x19a233]={'$like':'%'+_0x5ef0c4['query'][_0x3032('0x5b')]+'%'};return _0x4c8937;})});}_0x2d6361=_[_0x3032('0x54')]({},_0x2d6361,_0x5ef0c4['options']);return _0x17f1a1[_0x3032('0x5d')](_0x2d6361);}})[_0x3032('0x1d')](function(_0x49e11a){if(_0x49e11a){_0x3546ec=_0x49e11a[_0x3032('0x42')];if(!_0x5ef0c4[_0x3032('0x3d')][_0x3032('0x43')](_0x3032('0x44'))){_0x2d6361['limit']=qs[_0x3032('0x2d')](_0x5ef0c4['query']['limit']);_0x2d6361[_0x3032('0x2b')]=qs['offset'](_0x5ef0c4['query'][_0x3032('0x2b')]);}return _0x17f1a1[_0x3032('0x5d')](_0x2d6361);}})[_0x3032('0x1d')](function(_0x12168b){if(_0x12168b){return _0x12168b?{'count':_0x3546ec,'rows':_0x12168b}:null;}})[_0x3032('0x1d')](respondWithResult(_0xba1dae,null))[_0x3032('0x56')](handleError(_0xba1dae,null));};exports[_0x3032('0x5e')]=function(_0x2d3442,_0xe83931,_0x298539){var _0x59433c={};var _0x3c9430={};var _0x4f3f7e;var _0x103649;return db[_0x3032('0x4b')][_0x3032('0x59')]({'where':{'id':_0x2d3442['params']['id']}})[_0x3032('0x1d')](handleEntityNotFound(_0xe83931,null))[_0x3032('0x1d')](function(_0x16ecb){if(_0x16ecb){_0x4f3f7e=_0x16ecb;_0x3c9430[_0x3032('0x3c')]=_['keys'](db[_0x3032('0x5a')][_0x3032('0x52')]);_0x3c9430[_0x3032('0x3d')]=_['keys'](_0x2d3442[_0x3032('0x3d')]);_0x3c9430[_0x3032('0x3e')]=_['intersection'](_0x3c9430[_0x3032('0x3c')],_0x3c9430[_0x3032('0x3d')]);_0x59433c[_0x3032('0x40')]=_['intersection'](_0x3c9430[_0x3032('0x3c')],qs[_0x3032('0x41')](_0x2d3442[_0x3032('0x3d')][_0x3032('0x41')]));_0x59433c[_0x3032('0x40')]=_0x59433c[_0x3032('0x40')][_0x3032('0x42')]?_0x59433c[_0x3032('0x40')]:_0x3c9430[_0x3032('0x3c')];_0x59433c[_0x3032('0x45')]=qs['sort'](_0x2d3442[_0x3032('0x3d')]['sort']);_0x59433c['where']=qs['filters'](_[_0x3032('0x47')](_0x2d3442[_0x3032('0x3d')],_0x3c9430[_0x3032('0x3e')]));if(_0x2d3442[_0x3032('0x3d')][_0x3032('0x5b')]){_0x59433c[_0x3032('0x48')]=_[_0x3032('0x54')](_0x59433c[_0x3032('0x48')],{'$or':_[_0x3032('0x38')](_0x59433c[_0x3032('0x40')],function(_0x19a2be){var _0x2aa4df={};_0x2aa4df[_0x19a2be]={'$like':'%'+_0x2d3442[_0x3032('0x3d')][_0x3032('0x5b')]+'%'};return _0x2aa4df;})});}_0x59433c=_[_0x3032('0x54')]({},_0x59433c,_0x2d3442[_0x3032('0x4a')]);return _0x4f3f7e[_0x3032('0x5e')](_0x59433c);}})['then'](function(_0x13f866){if(_0x13f866){_0x103649=_0x13f866['length'];if(!_0x2d3442[_0x3032('0x3d')][_0x3032('0x43')](_0x3032('0x44'))){_0x59433c[_0x3032('0x2d')]=qs[_0x3032('0x2d')](_0x2d3442['query'][_0x3032('0x2d')]);_0x59433c[_0x3032('0x2b')]=qs['offset'](_0x2d3442[_0x3032('0x3d')]['offset']);}return _0x4f3f7e[_0x3032('0x5e')](_0x59433c);}})[_0x3032('0x1d')](function(_0x3f4613){if(_0x3f4613){return _0x3f4613?{'count':_0x103649,'rows':_0x3f4613}:null;}})[_0x3032('0x1d')](respondWithResult(_0xe83931,null))[_0x3032('0x56')](handleError(_0xe83931,null));}; \ No newline at end of file +var _0xf8fc=['../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','stack','name','index','ServicenowConfiguration','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','find','create','body','ServicenowField','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api'];(function(_0x11e01d,_0x399744){var _0x3b0620=function(_0x3663b6){while(--_0x3663b6){_0x11e01d['push'](_0x11e01d['shift']());}};_0x3b0620(++_0x399744);}(_0xf8fc,0x9b));var _0xcf8f=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xf8fc[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0xcf8f('0x0'));var rimraf=require(_0xcf8f('0x1'));var zipdir=require(_0xcf8f('0x2'));var jsonpatch=require(_0xcf8f('0x3'));var rp=require(_0xcf8f('0x4'));var moment=require(_0xcf8f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcf8f('0x6'));var path=require('path');var sox=require(_0xcf8f('0x7'));var csv=require(_0xcf8f('0x8'));var ejs=require(_0xcf8f('0x9'));var fs=require('fs');var fs_extra=require(_0xcf8f('0xa'));var _=require(_0xcf8f('0xb'));var squel=require(_0xcf8f('0xc'));var crypto=require('crypto');var jsforce=require(_0xcf8f('0xd'));var deskjs=require(_0xcf8f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcf8f('0xf'));var Papa=require(_0xcf8f('0x10'));var Redis=require(_0xcf8f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf8f('0x12'));var logger=require(_0xcf8f('0x13'))(_0xcf8f('0x14'));var utils=require('../../config/utils');var config=require(_0xcf8f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf8f('0x16'))['db'];var jayson=require(_0xcf8f('0x17'));var client=jayson[_0xcf8f('0x18')][_0xcf8f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x19c7ac,_0x545dc8,_0x5b0113,_0x1d2dfa){return new BPromise(function(_0x168a21,_0x12326c){var _0x6be92b=_0x1d2dfa||client;return _0x6be92b['request'](_0x19c7ac,_0x5b0113)[_0xcf8f('0x1a')](function(_0x2e5e84){logger[_0xcf8f('0x1b')](_0xcf8f('0x1c'),_0x545dc8,'request\x20sent');logger['debug'](_0xcf8f('0x1d'),_0x545dc8,_0xcf8f('0x1e'),JSON['stringify'](_0x2e5e84));if(_0x2e5e84[_0xcf8f('0x1f')]){if(_0x2e5e84[_0xcf8f('0x1f')][_0xcf8f('0x20')]===0x1f4){logger[_0xcf8f('0x1f')](_0xcf8f('0x1c'),_0x545dc8,_0x2e5e84['error'][_0xcf8f('0x21')]);return _0x12326c(_0x2e5e84[_0xcf8f('0x1f')][_0xcf8f('0x21')]);}logger[_0xcf8f('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0x545dc8,_0x2e5e84['error']['message']);return _0x168a21(_0x2e5e84['error'][_0xcf8f('0x21')]);}else{logger[_0xcf8f('0x1b')](_0xcf8f('0x1c'),_0x545dc8,'request\x20sent');_0x168a21(_0x2e5e84['result'][_0xcf8f('0x21')]);}})[_0xcf8f('0x22')](function(_0x125083){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x545dc8,_0x125083);_0x12326c(_0x125083);});});}function respondWithStatusCode(_0x45c4b0,_0x56db66){_0x56db66=_0x56db66||0xcc;return function(_0x370055){if(_0x370055){return _0x45c4b0[_0xcf8f('0x23')](_0x56db66);}return _0x45c4b0[_0xcf8f('0x24')](_0x56db66)[_0xcf8f('0x25')]();};}function respondWithResult(_0xc80a11,_0x215095){_0x215095=_0x215095||0xc8;return function(_0x2e93f5){if(_0x2e93f5){return _0xc80a11[_0xcf8f('0x24')](_0x215095)[_0xcf8f('0x26')](_0x2e93f5);}};}function respondWithFilteredResult(_0x416c31,_0x5ee20f){return function(_0x1661cc){if(_0x1661cc){var _0x580b5c=typeof _0x5ee20f[_0xcf8f('0x27')]===_0xcf8f('0x28')&&typeof _0x5ee20f[_0xcf8f('0x29')]===_0xcf8f('0x28');var _0x28227e=_0x1661cc[_0xcf8f('0x2a')];var _0x11552b=_0x580b5c?0x0:_0x5ee20f[_0xcf8f('0x27')];var _0x3231ff=_0x580b5c?_0x1661cc[_0xcf8f('0x2a')]:_0x5ee20f[_0xcf8f('0x27')]+_0x5ee20f[_0xcf8f('0x29')];var _0x152fd0;if(_0x3231ff>=_0x28227e){_0x3231ff=_0x28227e;_0x152fd0=0xc8;}else{_0x152fd0=0xce;}_0x416c31[_0xcf8f('0x24')](_0x152fd0);return _0x416c31['set']('Content-Range',_0x11552b+'-'+_0x3231ff+'/'+_0x28227e)[_0xcf8f('0x26')](_0x1661cc);}return null;};}function patchUpdates(_0x350923){return function(_0x5097f9){try{jsonpatch[_0xcf8f('0x2b')](_0x5097f9,_0x350923,!![]);}catch(_0x3c83b1){return BPromise[_0xcf8f('0x2c')](_0x3c83b1);}return _0x5097f9[_0xcf8f('0x2d')]();};}function saveUpdates(_0x24fe79,_0x5c19c6){return function(_0x36b714){if(_0x36b714){return _0x36b714[_0xcf8f('0x2e')](_0x24fe79)[_0xcf8f('0x1a')](function(_0x3f5965){return _0x3f5965;});}return null;};}function removeEntity(_0x48c30e,_0x3ac424){return function(_0x306853){if(_0x306853){return _0x306853[_0xcf8f('0x2f')]()['then'](function(){_0x48c30e['status'](0xcc)[_0xcf8f('0x25')]();});}};}function handleEntityNotFound(_0x15fd8e,_0x488d80){return function(_0x50512e){if(!_0x50512e){_0x15fd8e[_0xcf8f('0x23')](0x194);}return _0x50512e;};}function handleError(_0x16f679,_0x33fa97){_0x33fa97=_0x33fa97||0x1f4;return function(_0x1eef4b){logger[_0xcf8f('0x1f')](_0x1eef4b[_0xcf8f('0x30')]);if(_0x1eef4b[_0xcf8f('0x31')]){delete _0x1eef4b[_0xcf8f('0x31')];}_0x16f679['status'](_0x33fa97)['send'](_0x1eef4b);};}exports[_0xcf8f('0x32')]=function(_0x41dc65,_0x3efae9){var _0x2b3e64={},_0x2b3a65={},_0x47f476={'count':0x0,'rows':[]};var _0x4960b3=_['map'](db[_0xcf8f('0x33')]['rawAttributes'],function(_0x469809){return{'name':_0x469809[_0xcf8f('0x34')],'type':_0x469809['type'][_0xcf8f('0x35')]};});_0x2b3a65[_0xcf8f('0x36')]=_[_0xcf8f('0x37')](_0x4960b3,'name');_0x2b3a65[_0xcf8f('0x38')]=_[_0xcf8f('0x39')](_0x41dc65['query']);_0x2b3a65[_0xcf8f('0x3a')]=_[_0xcf8f('0x3b')](_0x2b3a65[_0xcf8f('0x36')],_0x2b3a65[_0xcf8f('0x38')]);_0x2b3e64['attributes']=_[_0xcf8f('0x3b')](_0x2b3a65[_0xcf8f('0x36')],qs[_0xcf8f('0x3c')](_0x41dc65['query']['fields']));_0x2b3e64[_0xcf8f('0x3d')]=_0x2b3e64[_0xcf8f('0x3d')]['length']?_0x2b3e64[_0xcf8f('0x3d')]:_0x2b3a65['model'];if(!_0x41dc65[_0xcf8f('0x38')][_0xcf8f('0x3e')](_0xcf8f('0x3f'))){_0x2b3e64[_0xcf8f('0x29')]=qs[_0xcf8f('0x29')](_0x41dc65[_0xcf8f('0x38')][_0xcf8f('0x29')]);_0x2b3e64[_0xcf8f('0x27')]=qs[_0xcf8f('0x27')](_0x41dc65['query'][_0xcf8f('0x27')]);}_0x2b3e64[_0xcf8f('0x40')]=qs[_0xcf8f('0x41')](_0x41dc65[_0xcf8f('0x38')][_0xcf8f('0x41')]);_0x2b3e64[_0xcf8f('0x42')]=qs[_0xcf8f('0x3a')](_[_0xcf8f('0x43')](_0x41dc65[_0xcf8f('0x38')],_0x2b3a65[_0xcf8f('0x3a')]),_0x4960b3);if(_0x41dc65[_0xcf8f('0x38')][_0xcf8f('0x44')]){_0x2b3e64[_0xcf8f('0x42')]=_[_0xcf8f('0x45')](_0x2b3e64[_0xcf8f('0x42')],{'$or':_[_0xcf8f('0x37')](_0x4960b3,function(_0x4c2da9){if(_0x4c2da9[_0xcf8f('0x46')]!==_0xcf8f('0x47')){var _0x121812={};_0x121812[_0x4c2da9['name']]={'$like':'%'+_0x41dc65[_0xcf8f('0x38')]['filter']+'%'};return _0x121812;}})});}_0x2b3e64=_[_0xcf8f('0x45')]({},_0x2b3e64,_0x41dc65[_0xcf8f('0x48')]);var _0x39b183={'where':_0x2b3e64[_0xcf8f('0x42')]};return db[_0xcf8f('0x33')][_0xcf8f('0x2a')](_0x39b183)[_0xcf8f('0x1a')](function(_0x4b3e92){_0x47f476[_0xcf8f('0x2a')]=_0x4b3e92;if(_0x41dc65['query'][_0xcf8f('0x49')]){_0x2b3e64[_0xcf8f('0x4a')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x2b3e64);})[_0xcf8f('0x1a')](function(_0x32343c){_0x47f476[_0xcf8f('0x4b')]=_0x32343c;return _0x47f476;})['then'](respondWithFilteredResult(_0x3efae9,_0x2b3e64))[_0xcf8f('0x22')](handleError(_0x3efae9,null));};exports[_0xcf8f('0x4c')]=function(_0x4dba88,_0x52726){var _0x40c895={'raw':![],'where':{'id':_0x4dba88[_0xcf8f('0x4d')]['id']}},_0x30f0a2={};_0x30f0a2[_0xcf8f('0x36')]=_[_0xcf8f('0x39')](db[_0xcf8f('0x33')][_0xcf8f('0x4e')]);_0x30f0a2[_0xcf8f('0x38')]=_[_0xcf8f('0x39')](_0x4dba88['query']);_0x30f0a2[_0xcf8f('0x3a')]=_[_0xcf8f('0x3b')](_0x30f0a2[_0xcf8f('0x36')],_0x30f0a2[_0xcf8f('0x38')]);_0x40c895[_0xcf8f('0x3d')]=_[_0xcf8f('0x3b')](_0x30f0a2[_0xcf8f('0x36')],qs[_0xcf8f('0x3c')](_0x4dba88[_0xcf8f('0x38')][_0xcf8f('0x3c')]));_0x40c895[_0xcf8f('0x3d')]=_0x40c895[_0xcf8f('0x3d')][_0xcf8f('0x4f')]?_0x40c895['attributes']:_0x30f0a2[_0xcf8f('0x36')];if(_0x4dba88['query'][_0xcf8f('0x49')]){_0x40c895['include']=[{'all':!![]}];}_0x40c895=_[_0xcf8f('0x45')]({},_0x40c895,_0x4dba88['options']);return db[_0xcf8f('0x33')][_0xcf8f('0x50')](_0x40c895)[_0xcf8f('0x1a')](handleEntityNotFound(_0x52726,null))[_0xcf8f('0x1a')](respondWithResult(_0x52726,null))['catch'](handleError(_0x52726,null));};exports[_0xcf8f('0x51')]=function(_0x4821e0,_0x32285a){return db['ServicenowConfiguration'][_0xcf8f('0x51')](_0x4821e0[_0xcf8f('0x52')],{})[_0xcf8f('0x1a')](respondWithResult(_0x32285a,0xc9))[_0xcf8f('0x22')](handleError(_0x32285a,null));};exports[_0xcf8f('0x2e')]=function(_0x12157e,_0x4779c7){if(_0x12157e[_0xcf8f('0x52')]['id']){delete _0x12157e[_0xcf8f('0x52')]['id'];}return db[_0xcf8f('0x33')][_0xcf8f('0x50')]({'where':{'id':_0x12157e[_0xcf8f('0x4d')]['id']}})[_0xcf8f('0x1a')](handleEntityNotFound(_0x4779c7,null))[_0xcf8f('0x1a')](saveUpdates(_0x12157e['body'],null))[_0xcf8f('0x1a')](respondWithResult(_0x4779c7,null))[_0xcf8f('0x22')](handleError(_0x4779c7,null));};exports[_0xcf8f('0x2f')]=function(_0x100db2,_0x41e2ba){return db[_0xcf8f('0x33')][_0xcf8f('0x50')]({'where':{'id':_0x100db2['params']['id']}})[_0xcf8f('0x1a')](handleEntityNotFound(_0x41e2ba,null))[_0xcf8f('0x1a')](removeEntity(_0x41e2ba,null))[_0xcf8f('0x22')](handleError(_0x41e2ba,null));};exports['getFields']=function(_0x556236,_0x40f7c5,_0x2d1026){var _0x4001fc={};var _0x22719d={};var _0x4bfc30;var _0x99c1a5;return db[_0xcf8f('0x33')]['findOne']({'where':{'id':_0x556236[_0xcf8f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f7c5,null))[_0xcf8f('0x1a')](function(_0x15eb7e){if(_0x15eb7e){_0x4bfc30=_0x15eb7e;_0x22719d[_0xcf8f('0x36')]=_[_0xcf8f('0x39')](db[_0xcf8f('0x53')][_0xcf8f('0x4e')]);_0x22719d[_0xcf8f('0x38')]=_[_0xcf8f('0x39')](_0x556236['query']);_0x22719d['filters']=_[_0xcf8f('0x3b')](_0x22719d[_0xcf8f('0x36')],_0x22719d[_0xcf8f('0x38')]);_0x4001fc[_0xcf8f('0x3d')]=_['intersection'](_0x22719d[_0xcf8f('0x36')],qs[_0xcf8f('0x3c')](_0x556236[_0xcf8f('0x38')]['fields']));_0x4001fc['attributes']=_0x4001fc[_0xcf8f('0x3d')][_0xcf8f('0x4f')]?_0x4001fc[_0xcf8f('0x3d')]:_0x22719d[_0xcf8f('0x36')];_0x4001fc['order']=qs[_0xcf8f('0x41')](_0x556236[_0xcf8f('0x38')][_0xcf8f('0x41')]);_0x4001fc[_0xcf8f('0x42')]=qs['filters'](_[_0xcf8f('0x43')](_0x556236['query'],_0x22719d['filters']));if(_0x556236[_0xcf8f('0x38')][_0xcf8f('0x44')]){_0x4001fc['where']=_[_0xcf8f('0x45')](_0x4001fc[_0xcf8f('0x42')],{'$or':_[_0xcf8f('0x37')](_0x4001fc[_0xcf8f('0x3d')],function(_0x26cff9){var _0x5836bf={};_0x5836bf[_0x26cff9]={'$like':'%'+_0x556236[_0xcf8f('0x38')]['filter']+'%'};return _0x5836bf;})});}_0x4001fc=_[_0xcf8f('0x45')]({},_0x4001fc,_0x556236[_0xcf8f('0x48')]);return _0x4bfc30[_0xcf8f('0x54')](_0x4001fc);}})['then'](function(_0x36da29){if(_0x36da29){_0x99c1a5=_0x36da29[_0xcf8f('0x4f')];if(!_0x556236[_0xcf8f('0x38')]['hasOwnProperty']('nolimit')){_0x4001fc['limit']=qs[_0xcf8f('0x29')](_0x556236['query'][_0xcf8f('0x29')]);_0x4001fc[_0xcf8f('0x27')]=qs['offset'](_0x556236[_0xcf8f('0x38')][_0xcf8f('0x27')]);}return _0x4bfc30['getFields'](_0x4001fc);}})['then'](function(_0x56cc4c){if(_0x56cc4c){return _0x56cc4c?{'count':_0x99c1a5,'rows':_0x56cc4c}:null;}})['then'](respondWithResult(_0x40f7c5,null))['catch'](handleError(_0x40f7c5,null));};exports[_0xcf8f('0x55')]=function(_0x126f2b,_0x3d69b7,_0x28030a){var _0x3ea29f={};var _0x394ac6={};var _0x5740dc;var _0x5d2717;return db[_0xcf8f('0x33')][_0xcf8f('0x56')]({'where':{'id':_0x126f2b['params']['id']}})[_0xcf8f('0x1a')](handleEntityNotFound(_0x3d69b7,null))[_0xcf8f('0x1a')](function(_0x17c908){if(_0x17c908){_0x5740dc=_0x17c908;_0x394ac6[_0xcf8f('0x36')]=_[_0xcf8f('0x39')](db[_0xcf8f('0x53')][_0xcf8f('0x4e')]);_0x394ac6[_0xcf8f('0x38')]=_[_0xcf8f('0x39')](_0x126f2b['query']);_0x394ac6[_0xcf8f('0x3a')]=_[_0xcf8f('0x3b')](_0x394ac6[_0xcf8f('0x36')],_0x394ac6[_0xcf8f('0x38')]);_0x3ea29f[_0xcf8f('0x3d')]=_['intersection'](_0x394ac6[_0xcf8f('0x36')],qs['fields'](_0x126f2b[_0xcf8f('0x38')]['fields']));_0x3ea29f['attributes']=_0x3ea29f[_0xcf8f('0x3d')][_0xcf8f('0x4f')]?_0x3ea29f['attributes']:_0x394ac6[_0xcf8f('0x36')];_0x3ea29f[_0xcf8f('0x40')]=qs[_0xcf8f('0x41')](_0x126f2b[_0xcf8f('0x38')][_0xcf8f('0x41')]);_0x3ea29f[_0xcf8f('0x42')]=qs[_0xcf8f('0x3a')](_[_0xcf8f('0x43')](_0x126f2b['query'],_0x394ac6[_0xcf8f('0x3a')]));if(_0x126f2b[_0xcf8f('0x38')][_0xcf8f('0x44')]){_0x3ea29f[_0xcf8f('0x42')]=_['merge'](_0x3ea29f[_0xcf8f('0x42')],{'$or':_[_0xcf8f('0x37')](_0x3ea29f[_0xcf8f('0x3d')],function(_0x32e412){var _0x224f7f={};_0x224f7f[_0x32e412]={'$like':'%'+_0x126f2b['query']['filter']+'%'};return _0x224f7f;})});}_0x3ea29f=_[_0xcf8f('0x45')]({},_0x3ea29f,_0x126f2b['options']);return _0x5740dc[_0xcf8f('0x55')](_0x3ea29f);}})[_0xcf8f('0x1a')](function(_0x597d6a){if(_0x597d6a){_0x5d2717=_0x597d6a['length'];if(!_0x126f2b['query'][_0xcf8f('0x3e')](_0xcf8f('0x3f'))){_0x3ea29f[_0xcf8f('0x29')]=qs[_0xcf8f('0x29')](_0x126f2b[_0xcf8f('0x38')][_0xcf8f('0x29')]);_0x3ea29f[_0xcf8f('0x27')]=qs[_0xcf8f('0x27')](_0x126f2b[_0xcf8f('0x38')][_0xcf8f('0x27')]);}return _0x5740dc[_0xcf8f('0x55')](_0x3ea29f);}})[_0xcf8f('0x1a')](function(_0x5ecefd){if(_0x5ecefd){return _0x5ecefd?{'count':_0x5d2717,'rows':_0x5ecefd}:null;}})['then'](respondWithResult(_0x3d69b7,null))['catch'](handleError(_0x3d69b7,null));};exports[_0xcf8f('0x57')]=function(_0x413060,_0x365824,_0x4111ef){var _0x2b8847={};var _0x51f06b={};var _0x1674de;var _0x315a2a;return db['ServicenowConfiguration'][_0xcf8f('0x56')]({'where':{'id':_0x413060[_0xcf8f('0x4d')]['id']}})[_0xcf8f('0x1a')](handleEntityNotFound(_0x365824,null))[_0xcf8f('0x1a')](function(_0x365f19){if(_0x365f19){_0x1674de=_0x365f19;_0x51f06b[_0xcf8f('0x36')]=_[_0xcf8f('0x39')](db[_0xcf8f('0x53')][_0xcf8f('0x4e')]);_0x51f06b['query']=_[_0xcf8f('0x39')](_0x413060['query']);_0x51f06b['filters']=_[_0xcf8f('0x3b')](_0x51f06b[_0xcf8f('0x36')],_0x51f06b[_0xcf8f('0x38')]);_0x2b8847[_0xcf8f('0x3d')]=_[_0xcf8f('0x3b')](_0x51f06b['model'],qs['fields'](_0x413060['query']['fields']));_0x2b8847[_0xcf8f('0x3d')]=_0x2b8847[_0xcf8f('0x3d')][_0xcf8f('0x4f')]?_0x2b8847[_0xcf8f('0x3d')]:_0x51f06b['model'];_0x2b8847[_0xcf8f('0x40')]=qs[_0xcf8f('0x41')](_0x413060[_0xcf8f('0x38')][_0xcf8f('0x41')]);_0x2b8847['where']=qs['filters'](_[_0xcf8f('0x43')](_0x413060['query'],_0x51f06b['filters']));if(_0x413060[_0xcf8f('0x38')][_0xcf8f('0x44')]){_0x2b8847[_0xcf8f('0x42')]=_[_0xcf8f('0x45')](_0x2b8847[_0xcf8f('0x42')],{'$or':_[_0xcf8f('0x37')](_0x2b8847[_0xcf8f('0x3d')],function(_0x292654){var _0x349361={};_0x349361[_0x292654]={'$like':'%'+_0x413060[_0xcf8f('0x38')][_0xcf8f('0x44')]+'%'};return _0x349361;})});}_0x2b8847=_[_0xcf8f('0x45')]({},_0x2b8847,_0x413060[_0xcf8f('0x48')]);return _0x1674de[_0xcf8f('0x57')](_0x2b8847);}})[_0xcf8f('0x1a')](function(_0x5c4dc2){if(_0x5c4dc2){_0x315a2a=_0x5c4dc2['length'];if(!_0x413060[_0xcf8f('0x38')][_0xcf8f('0x3e')]('nolimit')){_0x2b8847[_0xcf8f('0x29')]=qs[_0xcf8f('0x29')](_0x413060['query'][_0xcf8f('0x29')]);_0x2b8847[_0xcf8f('0x27')]=qs[_0xcf8f('0x27')](_0x413060[_0xcf8f('0x38')][_0xcf8f('0x27')]);}return _0x1674de[_0xcf8f('0x57')](_0x2b8847);}})[_0xcf8f('0x1a')](function(_0x1382b7){if(_0x1382b7){return _0x1382b7?{'count':_0x315a2a,'rows':_0x1382b7}:null;}})[_0xcf8f('0x1a')](respondWithResult(_0x365824,null))[_0xcf8f('0x22')](handleError(_0x365824,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 07b6b19..02d468b 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 _0x778d=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x778d,0x1c8));var _0xd778=function(_0x57d6e7,_0x209339){_0x57d6e7=_0x57d6e7-0x0;var _0x33a428=_0x778d[_0x57d6e7];return _0x33a428;};'use strict';var _=require(_0xd778('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd778('0x1'));var rp=require(_0xd778('0x2'));var fs=require('fs');var path=require(_0xd778('0x3'));var rimraf=require(_0xd778('0x4'));var config=require(_0xd778('0x5'));var attributes=require(_0xd778('0x6'));module[_0xd778('0x7')]=function(_0x825a24,_0x29027b){return _0x825a24[_0xd778('0x8')](_0xd778('0x9'),attributes,{'tableName':_0xd778('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e8b=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x5382a1,_0x3001ce){var _0x3e8e46=function(_0x33ed3e){while(--_0x33ed3e){_0x5382a1['push'](_0x5382a1['shift']());}};_0x3e8e46(++_0x3001ce);}(_0x4e8b,0xb5));var _0xb4e8=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x4e8b[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0xb4e8('0x0'));var util=require('util');var logger=require(_0xb4e8('0x1'))(_0xb4e8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4e8('0x3'));var rimraf=require(_0xb4e8('0x4'));var config=require(_0xb4e8('0x5'));var attributes=require(_0xb4e8('0x6'));module[_0xb4e8('0x7')]=function(_0x2e0c57,_0x19c09c){return _0x2e0c57[_0xb4e8('0x8')](_0xb4e8('0x9'),attributes,{'tableName':_0xb4e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index db3a23d..a11de84 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 _0xcde8=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','info','result','catch','util','moment','bluebird'];(function(_0x48f287,_0x285c89){var _0x3b9800=function(_0x14027a){while(--_0x14027a){_0x48f287['push'](_0x48f287['shift']());}};_0x3b9800(++_0x285c89);}(_0xcde8,0xcc));var _0x8cde=function(_0x3f7e26,_0x5cb782){_0x3f7e26=_0x3f7e26-0x0;var _0x5858f9=_0xcde8[_0x3f7e26];return _0x5858f9;};'use strict';var _=require('lodash');var util=require(_0x8cde('0x0'));var moment=require(_0x8cde('0x1'));var BPromise=require(_0x8cde('0x2'));var rs=require(_0x8cde('0x3'));var fs=require('fs');var Redis=require(_0x8cde('0x4'));var db=require(_0x8cde('0x5'))['db'];var utils=require(_0x8cde('0x6'));var logger=require('../../config/logger')(_0x8cde('0x7'));var config=require(_0x8cde('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8cde('0x9')][_0x8cde('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e9db1,_0x4381bc,_0x41ebe0){return new BPromise(function(_0x30b32b,_0x53905b){return client[_0x8cde('0xb')](_0x3e9db1,_0x41ebe0)[_0x8cde('0xc')](function(_0x7d60e5){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x4381bc,'request\x20sent');logger['debug'](_0x8cde('0xd'),_0x4381bc,_0x8cde('0xe'),JSON[_0x8cde('0xf')](_0x7d60e5));if(_0x7d60e5['error']){if(_0x7d60e5[_0x8cde('0x10')][_0x8cde('0x11')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4381bc,_0x7d60e5[_0x8cde('0x10')][_0x8cde('0x12')]);return _0x53905b(_0x7d60e5[_0x8cde('0x10')]['message']);}logger[_0x8cde('0x10')](_0x8cde('0x13'),_0x4381bc,_0x7d60e5[_0x8cde('0x10')][_0x8cde('0x12')]);return _0x30b32b(_0x7d60e5[_0x8cde('0x10')]['message']);}else{logger[_0x8cde('0x14')](_0x8cde('0x13'),_0x4381bc,'request\x20sent');_0x30b32b(_0x7d60e5[_0x8cde('0x15')][_0x8cde('0x12')]);}})[_0x8cde('0x16')](function(_0x1ab5ac){logger[_0x8cde('0x10')](_0x8cde('0x13'),_0x4381bc,_0x1ab5ac);_0x53905b(_0x1ab5ac);});});} \ No newline at end of file +var _0x9fcb=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x9fcb,0xc0));var _0xb9fc=function(_0x2508d7,_0x25f09a){_0x2508d7=_0x2508d7-0x0;var _0x1e6003=_0x9fcb[_0x2508d7];return _0x1e6003;};'use strict';var _=require(_0xb9fc('0x0'));var util=require(_0xb9fc('0x1'));var moment=require(_0xb9fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9fc('0x3'));var fs=require('fs');var Redis=require(_0xb9fc('0x4'));var db=require(_0xb9fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9fc('0x6'))(_0xb9fc('0x7'));var config=require(_0xb9fc('0x8'));var jayson=require(_0xb9fc('0x9'));var client=jayson['client'][_0xb9fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27da51,_0xde4660,_0x1b0477){return new BPromise(function(_0x445fc9,_0x4024c8){return client[_0xb9fc('0xb')](_0x27da51,_0x1b0477)[_0xb9fc('0xc')](function(_0x810206){logger[_0xb9fc('0xd')](_0xb9fc('0xe'),_0xde4660,_0xb9fc('0xf'));logger[_0xb9fc('0x10')](_0xb9fc('0x11'),_0xde4660,'request\x20sent',JSON['stringify'](_0x810206));if(_0x810206[_0xb9fc('0x12')]){if(_0x810206[_0xb9fc('0x12')][_0xb9fc('0x13')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0xde4660,_0x810206[_0xb9fc('0x12')]['message']);return _0x4024c8(_0x810206[_0xb9fc('0x12')][_0xb9fc('0x14')]);}logger['error'](_0xb9fc('0xe'),_0xde4660,_0x810206[_0xb9fc('0x12')][_0xb9fc('0x14')]);return _0x445fc9(_0x810206['error'][_0xb9fc('0x14')]);}else{logger[_0xb9fc('0xd')](_0xb9fc('0xe'),_0xde4660,_0xb9fc('0xf'));_0x445fc9(_0x810206['result'][_0xb9fc('0x14')]);}})[_0xb9fc('0x15')](function(_0x4c4c8c){logger[_0xb9fc('0x12')](_0xb9fc('0xe'),_0xde4660,_0x4c4c8c);_0x4024c8(_0x4c4c8c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a526f91..73f3588 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 _0xa5e8=['create','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post'];(function(_0x946f86,_0x7e0b8e){var _0x21a573=function(_0x5151dc){while(--_0x5151dc){_0x946f86['push'](_0x946f86['shift']());}};_0x21a573(++_0x7e0b8e);}(_0xa5e8,0xf4));var _0x8a5e=function(_0xed7f7e,_0x5e1640){_0xed7f7e=_0xed7f7e-0x0;var _0x391ced=_0xa5e8[_0xed7f7e];return _0x391ced;};'use strict';var multer=require(_0x8a5e('0x0'));var util=require('util');var path=require(_0x8a5e('0x1'));var timeout=require(_0x8a5e('0x2'));var express=require(_0x8a5e('0x3'));var router=express['Router']();var fs_extra=require(_0x8a5e('0x4'));var auth=require(_0x8a5e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8a5e('0x6'));var controller=require('./intServicenowField.controller');router[_0x8a5e('0x7')]('/',auth[_0x8a5e('0x8')](),controller['index']);router['get'](_0x8a5e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8a5e('0xa')]('/',auth[_0x8a5e('0x8')](),controller[_0x8a5e('0xb')]);router['put']('/:id',auth[_0x8a5e('0x8')](),controller[_0x8a5e('0xc')]);router[_0x8a5e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8a5e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1bf3=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','put'];(function(_0xa03344,_0x581292){var _0x38acfd=function(_0x1b1e8c){while(--_0x1b1e8c){_0xa03344['push'](_0xa03344['shift']());}};_0x38acfd(++_0x581292);}(_0x1bf3,0x79));var _0x31bf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bf3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x31bf('0x0'));var util=require(_0x31bf('0x1'));var path=require(_0x31bf('0x2'));var timeout=require(_0x31bf('0x3'));var express=require(_0x31bf('0x4'));var router=express['Router']();var fs_extra=require(_0x31bf('0x5'));var auth=require(_0x31bf('0x6'));var interaction=require(_0x31bf('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x31bf('0x8')](),controller[_0x31bf('0x9')]);router[_0x31bf('0xa')](_0x31bf('0xb'),auth['isAuthenticated'](),controller[_0x31bf('0xc')]);router['post']('/',auth[_0x31bf('0x8')](),controller['create']);router[_0x31bf('0xd')](_0x31bf('0xb'),auth[_0x31bf('0x8')](),controller['update']);router['delete'](_0x31bf('0xb'),auth[_0x31bf('0x8')](),controller[_0x31bf('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 178c2b5..623b056 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 _0xeda8=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x1514e6,_0xce6f04){var _0x2daa08=function(_0x60eca){while(--_0x60eca){_0x1514e6['push'](_0x1514e6['shift']());}};_0x2daa08(++_0xce6f04);}(_0xeda8,0x104));var _0x8eda=function(_0x295f94,_0x33e330){_0x295f94=_0x295f94-0x0;var _0xda88ae=_0xeda8[_0x295f94];return _0xda88ae;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8eda('0x2'),_0x8eda('0x3'),_0x8eda('0x4'),_0x8eda('0x5'),_0x8eda('0x6')),'defaultValue':_0x8eda('0x2')},'content':{'type':Sequelize[_0x8eda('0x7')]},'key':{'type':Sequelize[_0x8eda('0x7')]},'keyType':{'type':Sequelize[_0x8eda('0x8')](_0x8eda('0x2'),_0x8eda('0x3'),_0x8eda('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8eda('0x7')]},'nameField':{'type':Sequelize[_0x8eda('0x7')]},'customField':{'type':Sequelize[_0x8eda('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8eda('0x7')]}}; \ No newline at end of file +var _0xbd51=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x17a057,_0x51ef19){var _0x5b34d2=function(_0x3f69f0){while(--_0x3f69f0){_0x17a057['push'](_0x17a057['shift']());}};_0x5b34d2(++_0x51ef19);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x386dc3,_0x45e3c1){_0x386dc3=_0x386dc3-0x0;var _0x3868ce=_0xbd51[_0x386dc3];return _0x3868ce;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'type':{'type':Sequelize[_0x1bd5('0x1')](_0x1bd5('0x2'),_0x1bd5('0x3'),_0x1bd5('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1bd5('0x5')]},'keyType':{'type':Sequelize[_0x1bd5('0x1')](_0x1bd5('0x2'),'variable',_0x1bd5('0x4'))},'keyContent':{'type':Sequelize[_0x1bd5('0x5')]},'idField':{'type':Sequelize[_0x1bd5('0x5')]},'nameField':{'type':Sequelize[_0x1bd5('0x5')]},'customField':{'type':Sequelize[_0x1bd5('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d9ccda4..3c04651 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 _0x3ce5=['params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','count','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','nolimit','order','sort','filter','merge','where','options','ServicenowField','include','rows','catch','show','keys','fields','includeAll','create','body'];(function(_0x3a7e09,_0x27e35d){var _0x3f00b4=function(_0x25102f){while(--_0x25102f){_0x3a7e09['push'](_0x3a7e09['shift']());}};_0x3f00b4(++_0x27e35d);}(_0x3ce5,0xdc));var _0x53ce=function(_0x3a57e9,_0x2e2982){_0x3a57e9=_0x3a57e9-0x0;var _0x449bdb=_0x3ce5[_0x3a57e9];return _0x449bdb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53ce('0x0'));var zipdir=require(_0x53ce('0x1'));var jsonpatch=require(_0x53ce('0x2'));var rp=require('request-promise');var moment=require(_0x53ce('0x3'));var BPromise=require(_0x53ce('0x4'));var Mustache=require(_0x53ce('0x5'));var util=require(_0x53ce('0x6'));var path=require(_0x53ce('0x7'));var sox=require(_0x53ce('0x8'));var csv=require(_0x53ce('0x9'));var ejs=require(_0x53ce('0xa'));var fs=require('fs');var fs_extra=require(_0x53ce('0xb'));var _=require(_0x53ce('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x53ce('0xd'));var deskjs=require(_0x53ce('0xe'));var toCsv=require(_0x53ce('0x9'));var querystring=require(_0x53ce('0xf'));var Papa=require(_0x53ce('0x10'));var Redis=require('ioredis');var authService=require(_0x53ce('0x11'));var qs=require(_0x53ce('0x12'));var as=require(_0x53ce('0x13'));var hardwareService=require(_0x53ce('0x14'));var logger=require(_0x53ce('0x15'))(_0x53ce('0x16'));var utils=require(_0x53ce('0x17'));var config=require(_0x53ce('0x18'));var licenseUtil=require(_0x53ce('0x19'));var db=require(_0x53ce('0x1a'))['db'];function respondWithStatusCode(_0x2daad1,_0x18b0a2){_0x18b0a2=_0x18b0a2||0xcc;return function(_0xe697e){if(_0xe697e){return _0x2daad1[_0x53ce('0x1b')](_0x18b0a2);}return _0x2daad1['status'](_0x18b0a2)[_0x53ce('0x1c')]();};}function respondWithResult(_0x5cc284,_0x1c364d){_0x1c364d=_0x1c364d||0xc8;return function(_0x1b4c6d){if(_0x1b4c6d){return _0x5cc284[_0x53ce('0x1d')](_0x1c364d)['json'](_0x1b4c6d);}};}function respondWithFilteredResult(_0x415bce,_0x174411){return function(_0x44ce0a){if(_0x44ce0a){var _0x5f27c4=typeof _0x174411[_0x53ce('0x1e')]==='undefined'&&typeof _0x174411['limit']==='undefined';var _0x3c6fff=_0x44ce0a[_0x53ce('0x1f')];var _0x295788=_0x5f27c4?0x0:_0x174411['offset'];var _0x26f4b9=_0x5f27c4?_0x44ce0a['count']:_0x174411[_0x53ce('0x1e')]+_0x174411[_0x53ce('0x20')];var _0x539e12;if(_0x26f4b9>=_0x3c6fff){_0x26f4b9=_0x3c6fff;_0x539e12=0xc8;}else{_0x539e12=0xce;}_0x415bce[_0x53ce('0x1d')](_0x539e12);return _0x415bce[_0x53ce('0x21')]('Content-Range',_0x295788+'-'+_0x26f4b9+'/'+_0x3c6fff)[_0x53ce('0x22')](_0x44ce0a);}return null;};}function patchUpdates(_0x270735){return function(_0x4d031e){try{jsonpatch[_0x53ce('0x23')](_0x4d031e,_0x270735,!![]);}catch(_0x397839){return BPromise[_0x53ce('0x24')](_0x397839);}return _0x4d031e['save']();};}function saveUpdates(_0x610648,_0xaf9804){return function(_0x1179b1){if(_0x1179b1){return _0x1179b1[_0x53ce('0x25')](_0x610648)['then'](function(_0x127de3){return _0x127de3;});}return null;};}function removeEntity(_0x88831e,_0xe9b9fe){return function(_0x320e6){if(_0x320e6){return _0x320e6[_0x53ce('0x26')]()[_0x53ce('0x27')](function(){_0x88831e[_0x53ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8525,_0x409507){return function(_0x2286b8){if(!_0x2286b8){_0x3f8525[_0x53ce('0x1b')](0x194);}return _0x2286b8;};}function handleError(_0x140ea4,_0x2b82be){_0x2b82be=_0x2b82be||0x1f4;return function(_0x528be1){logger[_0x53ce('0x28')](_0x528be1[_0x53ce('0x29')]);if(_0x528be1[_0x53ce('0x2a')]){delete _0x528be1[_0x53ce('0x2a')];}_0x140ea4['status'](_0x2b82be)[_0x53ce('0x2b')](_0x528be1);};}exports[_0x53ce('0x2c')]=function(_0x3215d6,_0x22d0ea){var _0x20a3d2={},_0xe773f7={},_0x207874={'count':0x0,'rows':[]};var _0x185f75=_['map'](db['ServicenowField'][_0x53ce('0x2d')],function(_0x4160a){return{'name':_0x4160a[_0x53ce('0x2e')],'type':_0x4160a[_0x53ce('0x2f')][_0x53ce('0x30')]};});_0xe773f7[_0x53ce('0x31')]=_[_0x53ce('0x32')](_0x185f75,'name');_0xe773f7[_0x53ce('0x33')]=_['keys'](_0x3215d6[_0x53ce('0x33')]);_0xe773f7[_0x53ce('0x34')]=_[_0x53ce('0x35')](_0xe773f7[_0x53ce('0x31')],_0xe773f7['query']);_0x20a3d2[_0x53ce('0x36')]=_[_0x53ce('0x35')](_0xe773f7[_0x53ce('0x31')],qs['fields'](_0x3215d6[_0x53ce('0x33')]['fields']));_0x20a3d2[_0x53ce('0x36')]=_0x20a3d2[_0x53ce('0x36')]['length']?_0x20a3d2[_0x53ce('0x36')]:_0xe773f7[_0x53ce('0x31')];if(!_0x3215d6[_0x53ce('0x33')]['hasOwnProperty'](_0x53ce('0x37'))){_0x20a3d2['limit']=qs[_0x53ce('0x20')](_0x3215d6[_0x53ce('0x33')][_0x53ce('0x20')]);_0x20a3d2[_0x53ce('0x1e')]=qs[_0x53ce('0x1e')](_0x3215d6[_0x53ce('0x33')][_0x53ce('0x1e')]);}_0x20a3d2[_0x53ce('0x38')]=qs[_0x53ce('0x39')](_0x3215d6[_0x53ce('0x33')][_0x53ce('0x39')]);_0x20a3d2['where']=qs[_0x53ce('0x34')](_['pick'](_0x3215d6[_0x53ce('0x33')],_0xe773f7[_0x53ce('0x34')]),_0x185f75);if(_0x3215d6['query'][_0x53ce('0x3a')]){_0x20a3d2['where']=_[_0x53ce('0x3b')](_0x20a3d2[_0x53ce('0x3c')],{'$or':_[_0x53ce('0x32')](_0x185f75,function(_0x30b5c9){if(_0x30b5c9[_0x53ce('0x2f')]!=='VIRTUAL'){var _0x16b19e={};_0x16b19e[_0x30b5c9[_0x53ce('0x2a')]]={'$like':'%'+_0x3215d6[_0x53ce('0x33')]['filter']+'%'};return _0x16b19e;}})});}_0x20a3d2=_[_0x53ce('0x3b')]({},_0x20a3d2,_0x3215d6[_0x53ce('0x3d')]);var _0xce75aa={'where':_0x20a3d2[_0x53ce('0x3c')]};return db[_0x53ce('0x3e')][_0x53ce('0x1f')](_0xce75aa)[_0x53ce('0x27')](function(_0x1b4211){_0x207874[_0x53ce('0x1f')]=_0x1b4211;if(_0x3215d6['query']['includeAll']){_0x20a3d2[_0x53ce('0x3f')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x20a3d2);})[_0x53ce('0x27')](function(_0xeba4e1){_0x207874[_0x53ce('0x40')]=_0xeba4e1;return _0x207874;})[_0x53ce('0x27')](respondWithFilteredResult(_0x22d0ea,_0x20a3d2))[_0x53ce('0x41')](handleError(_0x22d0ea,null));};exports[_0x53ce('0x42')]=function(_0x3f730d,_0x4b9c84){var _0x429457={'raw':!![],'where':{'id':_0x3f730d['params']['id']}},_0x20e298={};_0x20e298[_0x53ce('0x31')]=_[_0x53ce('0x43')](db[_0x53ce('0x3e')][_0x53ce('0x2d')]);_0x20e298[_0x53ce('0x33')]=_[_0x53ce('0x43')](_0x3f730d[_0x53ce('0x33')]);_0x20e298['filters']=_[_0x53ce('0x35')](_0x20e298[_0x53ce('0x31')],_0x20e298[_0x53ce('0x33')]);_0x429457[_0x53ce('0x36')]=_[_0x53ce('0x35')](_0x20e298[_0x53ce('0x31')],qs[_0x53ce('0x44')](_0x3f730d[_0x53ce('0x33')][_0x53ce('0x44')]));_0x429457['attributes']=_0x429457[_0x53ce('0x36')]['length']?_0x429457['attributes']:_0x20e298[_0x53ce('0x31')];if(_0x3f730d[_0x53ce('0x33')][_0x53ce('0x45')]){_0x429457['include']=[{'all':!![]}];}_0x429457=_[_0x53ce('0x3b')]({},_0x429457,_0x3f730d[_0x53ce('0x3d')]);return db[_0x53ce('0x3e')]['find'](_0x429457)[_0x53ce('0x27')](handleEntityNotFound(_0x4b9c84,null))['then'](respondWithResult(_0x4b9c84,null))[_0x53ce('0x41')](handleError(_0x4b9c84,null));};exports[_0x53ce('0x46')]=function(_0x589e30,_0x32a96c){return db[_0x53ce('0x3e')][_0x53ce('0x46')](_0x589e30['body'],{})['then'](respondWithResult(_0x32a96c,0xc9))[_0x53ce('0x41')](handleError(_0x32a96c,null));};exports[_0x53ce('0x25')]=function(_0x20e051,_0x4ff378){if(_0x20e051[_0x53ce('0x47')]['id']){delete _0x20e051[_0x53ce('0x47')]['id'];}return db[_0x53ce('0x3e')]['find']({'where':{'id':_0x20e051[_0x53ce('0x48')]['id']}})[_0x53ce('0x27')](handleEntityNotFound(_0x4ff378,null))[_0x53ce('0x27')](saveUpdates(_0x20e051['body'],null))[_0x53ce('0x27')](respondWithResult(_0x4ff378,null))[_0x53ce('0x41')](handleError(_0x4ff378,null));};exports[_0x53ce('0x26')]=function(_0x2951ca,_0x24023c){return db[_0x53ce('0x3e')]['find']({'where':{'id':_0x2951ca['params']['id']}})[_0x53ce('0x27')](handleEntityNotFound(_0x24023c,null))[_0x53ce('0x27')](removeEntity(_0x24023c,null))['catch'](handleError(_0x24023c,null));}; \ No newline at end of file +var _0xb01b=['map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index'];(function(_0x4e8389,_0x54af45){var _0xcfb706=function(_0x23c0a3){while(--_0x23c0a3){_0x4e8389['push'](_0x4e8389['shift']());}};_0xcfb706(++_0x54af45);}(_0xb01b,0x139));var _0xbb01=function(_0x124a04,_0x101f55){_0x124a04=_0x124a04-0x0;var _0x4e4f3f=_0xb01b[_0x124a04];return _0x4e4f3f;};'use strict';var emlformat=require(_0xbb01('0x0'));var rimraf=require(_0xbb01('0x1'));var zipdir=require(_0xbb01('0x2'));var jsonpatch=require(_0xbb01('0x3'));var rp=require('request-promise');var moment=require(_0xbb01('0x4'));var BPromise=require(_0xbb01('0x5'));var Mustache=require(_0xbb01('0x6'));var util=require(_0xbb01('0x7'));var path=require('path');var sox=require(_0xbb01('0x8'));var csv=require(_0xbb01('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb01('0xa'));var _=require(_0xbb01('0xb'));var squel=require(_0xbb01('0xc'));var crypto=require(_0xbb01('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbb01('0xe'));var toCsv=require(_0xbb01('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbb01('0xf'));var authService=require(_0xbb01('0x10'));var qs=require(_0xbb01('0x11'));var as=require(_0xbb01('0x12'));var hardwareService=require(_0xbb01('0x13'));var logger=require(_0xbb01('0x14'))(_0xbb01('0x15'));var utils=require(_0xbb01('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb01('0x17'));var db=require(_0xbb01('0x18'))['db'];function respondWithStatusCode(_0x9e2dd5,_0x1a3d01){_0x1a3d01=_0x1a3d01||0xcc;return function(_0x2d1f76){if(_0x2d1f76){return _0x9e2dd5['sendStatus'](_0x1a3d01);}return _0x9e2dd5[_0xbb01('0x19')](_0x1a3d01)[_0xbb01('0x1a')]();};}function respondWithResult(_0xad3fd0,_0x1332b2){_0x1332b2=_0x1332b2||0xc8;return function(_0x41d11f){if(_0x41d11f){return _0xad3fd0[_0xbb01('0x19')](_0x1332b2)[_0xbb01('0x1b')](_0x41d11f);}};}function respondWithFilteredResult(_0x47da5d,_0xf62e30){return function(_0x5d8204){if(_0x5d8204){var _0x54d05d=typeof _0xf62e30[_0xbb01('0x1c')]==='undefined'&&typeof _0xf62e30[_0xbb01('0x1d')]===_0xbb01('0x1e');var _0x2b853f=_0x5d8204[_0xbb01('0x1f')];var _0x4e82b=_0x54d05d?0x0:_0xf62e30[_0xbb01('0x1c')];var _0x4f3067=_0x54d05d?_0x5d8204[_0xbb01('0x1f')]:_0xf62e30[_0xbb01('0x1c')]+_0xf62e30[_0xbb01('0x1d')];var _0x15c5ed;if(_0x4f3067>=_0x2b853f){_0x4f3067=_0x2b853f;_0x15c5ed=0xc8;}else{_0x15c5ed=0xce;}_0x47da5d[_0xbb01('0x19')](_0x15c5ed);return _0x47da5d['set'](_0xbb01('0x20'),_0x4e82b+'-'+_0x4f3067+'/'+_0x2b853f)['json'](_0x5d8204);}return null;};}function patchUpdates(_0xddb9bd){return function(_0x4dbce5){try{jsonpatch['apply'](_0x4dbce5,_0xddb9bd,!![]);}catch(_0x3efe53){return BPromise[_0xbb01('0x21')](_0x3efe53);}return _0x4dbce5['save']();};}function saveUpdates(_0x448baa,_0x6d6017){return function(_0x515e24){if(_0x515e24){return _0x515e24[_0xbb01('0x22')](_0x448baa)[_0xbb01('0x23')](function(_0x544514){return _0x544514;});}return null;};}function removeEntity(_0x2f9b33,_0x31044d){return function(_0x286da1){if(_0x286da1){return _0x286da1[_0xbb01('0x24')]()[_0xbb01('0x23')](function(){_0x2f9b33[_0xbb01('0x19')](0xcc)[_0xbb01('0x1a')]();});}};}function handleEntityNotFound(_0x374b05,_0x306133){return function(_0x123107){if(!_0x123107){_0x374b05['sendStatus'](0x194);}return _0x123107;};}function handleError(_0x12a1e2,_0x2e6e47){_0x2e6e47=_0x2e6e47||0x1f4;return function(_0x53f6e8){logger[_0xbb01('0x25')](_0x53f6e8[_0xbb01('0x26')]);if(_0x53f6e8[_0xbb01('0x27')]){delete _0x53f6e8['name'];}_0x12a1e2[_0xbb01('0x19')](_0x2e6e47)[_0xbb01('0x28')](_0x53f6e8);};}exports[_0xbb01('0x29')]=function(_0x3ad019,_0xc3f724){var _0x53eb47={},_0x4fb255={},_0x215343={'count':0x0,'rows':[]};var _0x18d124=_[_0xbb01('0x2a')](db[_0xbb01('0x2b')][_0xbb01('0x2c')],function(_0x434d5d){return{'name':_0x434d5d[_0xbb01('0x2d')],'type':_0x434d5d[_0xbb01('0x2e')]['key']};});_0x4fb255[_0xbb01('0x2f')]=_[_0xbb01('0x2a')](_0x18d124,_0xbb01('0x27'));_0x4fb255[_0xbb01('0x30')]=_[_0xbb01('0x31')](_0x3ad019[_0xbb01('0x30')]);_0x4fb255['filters']=_[_0xbb01('0x32')](_0x4fb255[_0xbb01('0x2f')],_0x4fb255[_0xbb01('0x30')]);_0x53eb47[_0xbb01('0x33')]=_[_0xbb01('0x32')](_0x4fb255[_0xbb01('0x2f')],qs['fields'](_0x3ad019[_0xbb01('0x30')]['fields']));_0x53eb47[_0xbb01('0x33')]=_0x53eb47[_0xbb01('0x33')]['length']?_0x53eb47[_0xbb01('0x33')]:_0x4fb255['model'];if(!_0x3ad019[_0xbb01('0x30')][_0xbb01('0x34')](_0xbb01('0x35'))){_0x53eb47[_0xbb01('0x1d')]=qs['limit'](_0x3ad019[_0xbb01('0x30')][_0xbb01('0x1d')]);_0x53eb47[_0xbb01('0x1c')]=qs['offset'](_0x3ad019[_0xbb01('0x30')]['offset']);}_0x53eb47[_0xbb01('0x36')]=qs['sort'](_0x3ad019[_0xbb01('0x30')]['sort']);_0x53eb47[_0xbb01('0x37')]=qs[_0xbb01('0x38')](_[_0xbb01('0x39')](_0x3ad019[_0xbb01('0x30')],_0x4fb255['filters']),_0x18d124);if(_0x3ad019[_0xbb01('0x30')][_0xbb01('0x3a')]){_0x53eb47[_0xbb01('0x37')]=_[_0xbb01('0x3b')](_0x53eb47[_0xbb01('0x37')],{'$or':_[_0xbb01('0x2a')](_0x18d124,function(_0x3d0418){if(_0x3d0418[_0xbb01('0x2e')]!==_0xbb01('0x3c')){var _0x581cd7={};_0x581cd7[_0x3d0418[_0xbb01('0x27')]]={'$like':'%'+_0x3ad019['query']['filter']+'%'};return _0x581cd7;}})});}_0x53eb47=_['merge']({},_0x53eb47,_0x3ad019[_0xbb01('0x3d')]);var _0x470a23={'where':_0x53eb47[_0xbb01('0x37')]};return db[_0xbb01('0x2b')][_0xbb01('0x1f')](_0x470a23)['then'](function(_0x137f77){_0x215343[_0xbb01('0x1f')]=_0x137f77;if(_0x3ad019[_0xbb01('0x30')][_0xbb01('0x3e')]){_0x53eb47[_0xbb01('0x3f')]=[{'all':!![]}];}return db[_0xbb01('0x2b')][_0xbb01('0x40')](_0x53eb47);})[_0xbb01('0x23')](function(_0x343c53){_0x215343[_0xbb01('0x41')]=_0x343c53;return _0x215343;})[_0xbb01('0x23')](respondWithFilteredResult(_0xc3f724,_0x53eb47))['catch'](handleError(_0xc3f724,null));};exports['show']=function(_0x55091d,_0x30c75f){var _0x28d37a={'raw':!![],'where':{'id':_0x55091d['params']['id']}},_0x3c5091={};_0x3c5091[_0xbb01('0x2f')]=_['keys'](db[_0xbb01('0x2b')][_0xbb01('0x2c')]);_0x3c5091[_0xbb01('0x30')]=_[_0xbb01('0x31')](_0x55091d['query']);_0x3c5091[_0xbb01('0x38')]=_[_0xbb01('0x32')](_0x3c5091[_0xbb01('0x2f')],_0x3c5091['query']);_0x28d37a[_0xbb01('0x33')]=_[_0xbb01('0x32')](_0x3c5091[_0xbb01('0x2f')],qs['fields'](_0x55091d[_0xbb01('0x30')]['fields']));_0x28d37a['attributes']=_0x28d37a[_0xbb01('0x33')]['length']?_0x28d37a[_0xbb01('0x33')]:_0x3c5091['model'];if(_0x55091d[_0xbb01('0x30')][_0xbb01('0x3e')]){_0x28d37a[_0xbb01('0x3f')]=[{'all':!![]}];}_0x28d37a=_[_0xbb01('0x3b')]({},_0x28d37a,_0x55091d[_0xbb01('0x3d')]);return db[_0xbb01('0x2b')][_0xbb01('0x42')](_0x28d37a)['then'](handleEntityNotFound(_0x30c75f,null))[_0xbb01('0x23')](respondWithResult(_0x30c75f,null))[_0xbb01('0x43')](handleError(_0x30c75f,null));};exports[_0xbb01('0x44')]=function(_0x227cf7,_0x97cf25){return db[_0xbb01('0x2b')][_0xbb01('0x44')](_0x227cf7[_0xbb01('0x45')],{})[_0xbb01('0x23')](respondWithResult(_0x97cf25,0xc9))[_0xbb01('0x43')](handleError(_0x97cf25,null));};exports[_0xbb01('0x22')]=function(_0x4b66cc,_0x2e4d0e){if(_0x4b66cc[_0xbb01('0x45')]['id']){delete _0x4b66cc[_0xbb01('0x45')]['id'];}return db[_0xbb01('0x2b')][_0xbb01('0x42')]({'where':{'id':_0x4b66cc[_0xbb01('0x46')]['id']}})[_0xbb01('0x23')](handleEntityNotFound(_0x2e4d0e,null))[_0xbb01('0x23')](saveUpdates(_0x4b66cc[_0xbb01('0x45')],null))[_0xbb01('0x23')](respondWithResult(_0x2e4d0e,null))[_0xbb01('0x43')](handleError(_0x2e4d0e,null));};exports['destroy']=function(_0x5a53bd,_0x3c3a88){return db['ServicenowField']['find']({'where':{'id':_0x5a53bd['params']['id']}})[_0xbb01('0x23')](handleEntityNotFound(_0x3c3a88,null))[_0xbb01('0x23')](removeEntity(_0x3c3a88,null))[_0xbb01('0x43')](handleError(_0x3c3a88,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 87634d0..5bfa7ed 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 _0x7d15=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','idField'];(function(_0x27a948,_0x4e5fa0){var _0x593311=function(_0x5b344f){while(--_0x5b344f){_0x27a948['push'](_0x27a948['shift']());}};_0x593311(++_0x4e5fa0);}(_0x7d15,0xa6));var _0x57d1=function(_0x7441e7,_0x22245b){_0x7441e7=_0x7441e7-0x0;var _0x5d13ad=_0x7d15[_0x7441e7];return _0x5d13ad;};'use strict';var _=require(_0x57d1('0x0'));var util=require(_0x57d1('0x1'));var logger=require('../../config/logger')(_0x57d1('0x2'));var moment=require(_0x57d1('0x3'));var BPromise=require(_0x57d1('0x4'));var rp=require(_0x57d1('0x5'));var fs=require('fs');var path=require(_0x57d1('0x6'));var rimraf=require(_0x57d1('0x7'));var config=require(_0x57d1('0x8'));var attributes=require(_0x57d1('0x9'));module[_0x57d1('0xa')]=function(_0x5a8a36,_0x4ce748){return _0x5a8a36[_0x57d1('0xb')](_0x57d1('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x57d1('0xd'),_0x57d1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2f6=['./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51a0ab,_0x56f62b){var _0x22d8fe=function(_0x350fa9){while(--_0x350fa9){_0x51a0ab['push'](_0x51a0ab['shift']());}};_0x22d8fe(++_0x56f62b);}(_0xf2f6,0xca));var _0x6f2f=function(_0x66efd2,_0x98dd94){_0x66efd2=_0x66efd2-0x0;var _0x5944ea=_0xf2f6[_0x66efd2];return _0x5944ea;};'use strict';var _=require('lodash');var util=require(_0x6f2f('0x0'));var logger=require(_0x6f2f('0x1'))(_0x6f2f('0x2'));var moment=require('moment');var BPromise=require(_0x6f2f('0x3'));var rp=require(_0x6f2f('0x4'));var fs=require('fs');var path=require(_0x6f2f('0x5'));var rimraf=require(_0x6f2f('0x6'));var config=require(_0x6f2f('0x7'));var attributes=require(_0x6f2f('0x8'));module['exports']=function(_0x42d5d0,_0x201566){return _0x42d5d0['define'](_0x6f2f('0x9'),attributes,{'tableName':_0x6f2f('0xa'),'paranoid':![],'indexes':[{'name':_0x6f2f('0xb'),'fields':[_0x6f2f('0xc'),_0x6f2f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 32cd6cf..25085ad 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 _0xd0cc=['info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then'];(function(_0x5b4998,_0x5dd132){var _0x25e0c0=function(_0x42ec5e){while(--_0x42ec5e){_0x5b4998['push'](_0x5b4998['shift']());}};_0x25e0c0(++_0x5dd132);}(_0xd0cc,0xa1));var _0xcd0c=function(_0x591578,_0x589ca5){_0x591578=_0x591578-0x0;var _0x343807=_0xd0cc[_0x591578];return _0x343807;};'use strict';var _=require(_0xcd0c('0x0'));var util=require(_0xcd0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd0c('0x2'));var fs=require('fs');var Redis=require(_0xcd0c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd0c('0x4'));var logger=require(_0xcd0c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcd0c('0x6'));var client=jayson[_0xcd0c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d078b,_0x35fced,_0x2c4095){return new BPromise(function(_0x2ff959,_0x4c26be){return client[_0xcd0c('0x8')](_0x9d078b,_0x2c4095)[_0xcd0c('0x9')](function(_0x47408a){logger[_0xcd0c('0xa')](_0xcd0c('0xb'),_0x35fced,_0xcd0c('0xc'));logger['debug'](_0xcd0c('0xd'),_0x35fced,_0xcd0c('0xc'),JSON[_0xcd0c('0xe')](_0x47408a));if(_0x47408a[_0xcd0c('0xf')]){if(_0x47408a[_0xcd0c('0xf')]['code']===0x1f4){logger[_0xcd0c('0xf')](_0xcd0c('0xb'),_0x35fced,_0x47408a[_0xcd0c('0xf')][_0xcd0c('0x10')]);return _0x4c26be(_0x47408a[_0xcd0c('0xf')][_0xcd0c('0x10')]);}logger[_0xcd0c('0xf')]('ServicenowField,\x20%s,\x20%s',_0x35fced,_0x47408a[_0xcd0c('0xf')][_0xcd0c('0x10')]);return _0x2ff959(_0x47408a[_0xcd0c('0xf')][_0xcd0c('0x10')]);}else{logger['info'](_0xcd0c('0xb'),_0x35fced,_0xcd0c('0xc'));_0x2ff959(_0x47408a[_0xcd0c('0x11')][_0xcd0c('0x10')]);}})[_0xcd0c('0x12')](function(_0x240ff2){logger[_0xcd0c('0xf')]('ServicenowField,\x20%s,\x20%s',_0x35fced,_0x240ff2);_0x4c26be(_0x240ff2);});});} \ No newline at end of file +var _0x376c=['info','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','ServicenowField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then'];(function(_0x1f1806,_0x3ec9b0){var _0x38f425=function(_0xda866f){while(--_0xda866f){_0x1f1806['push'](_0x1f1806['shift']());}};_0x38f425(++_0x3ec9b0);}(_0x376c,0xa9));var _0xc376=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x376c[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0xc376('0x0'));var moment=require(_0xc376('0x1'));var BPromise=require(_0xc376('0x2'));var rs=require(_0xc376('0x3'));var fs=require('fs');var Redis=require(_0xc376('0x4'));var db=require(_0xc376('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc376('0x6'));var jayson=require(_0xc376('0x7'));var client=jayson[_0xc376('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a9ac5,_0xc03f58,_0x859a9d){return new BPromise(function(_0x22970f,_0x26a02e){return client[_0xc376('0x9')](_0x2a9ac5,_0x859a9d)[_0xc376('0xa')](function(_0x61c934){logger[_0xc376('0xb')]('ServicenowField,\x20%s,\x20%s',_0xc03f58,_0xc376('0xc'));logger['debug'](_0xc376('0xd'),_0xc03f58,_0xc376('0xc'),JSON['stringify'](_0x61c934));if(_0x61c934[_0xc376('0xe')]){if(_0x61c934[_0xc376('0xe')][_0xc376('0xf')]===0x1f4){logger[_0xc376('0xe')](_0xc376('0x10'),_0xc03f58,_0x61c934['error']['message']);return _0x26a02e(_0x61c934[_0xc376('0xe')][_0xc376('0x11')]);}logger['error'](_0xc376('0x10'),_0xc03f58,_0x61c934[_0xc376('0xe')][_0xc376('0x11')]);return _0x22970f(_0x61c934[_0xc376('0xe')][_0xc376('0x11')]);}else{logger['info'](_0xc376('0x10'),_0xc03f58,_0xc376('0xc'));_0x22970f(_0x61c934['result']['message']);}})['catch'](function(_0x18adf1){logger['error'](_0xc376('0x10'),_0xc03f58,_0x18adf1);_0x26a02e(_0x18adf1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 73262f9..b73d1e7 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 _0x1b37=['/:id','destroy','exports','multer','util','fs-extra','../../components/auth/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete'];(function(_0x54bef0,_0x21348d){var _0x243932=function(_0x3281ad){while(--_0x3281ad){_0x54bef0['push'](_0x54bef0['shift']());}};_0x243932(++_0x21348d);}(_0x1b37,0x1cf));var _0x71b3=function(_0x12003a,_0x563c09){_0x12003a=_0x12003a-0x0;var _0x3400c4=_0x1b37[_0x12003a];return _0x3400c4;};'use strict';var multer=require(_0x71b3('0x0'));var util=require(_0x71b3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x71b3('0x2'));var auth=require(_0x71b3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x71b3('0x4'));router[_0x71b3('0x5')]('/',auth[_0x71b3('0x6')](),controller[_0x71b3('0x7')]);router['get']('/:id',auth[_0x71b3('0x6')](),controller[_0x71b3('0x8')]);router['get'](_0x71b3('0x9'),auth[_0x71b3('0x6')](),controller[_0x71b3('0xa')]);router['get'](_0x71b3('0xb'),auth['isAuthenticated'](),controller[_0x71b3('0xc')]);router[_0x71b3('0xd')]('/',auth[_0x71b3('0x6')](),controller['create']);router[_0x71b3('0xd')](_0x71b3('0x9'),auth[_0x71b3('0x6')](),controller[_0x71b3('0xe')]);router[_0x71b3('0xf')]('/:id',auth[_0x71b3('0x6')](),controller['update']);router[_0x71b3('0x10')](_0x71b3('0x11'),auth[_0x71b3('0x6')](),controller[_0x71b3('0x12')]);module[_0x71b3('0x13')]=router; \ No newline at end of file +var _0x49c8=['get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller'];(function(_0x3fa4bd,_0x14a72d){var _0x358c95=function(_0x55c7fc){while(--_0x55c7fc){_0x3fa4bd['push'](_0x3fa4bd['shift']());}};_0x358c95(++_0x14a72d);}(_0x49c8,0x1e5));var _0x849c=function(_0x26bab7,_0x59b5bf){_0x26bab7=_0x26bab7-0x0;var _0x1abee1=_0x49c8[_0x26bab7];return _0x1abee1;};'use strict';var multer=require(_0x849c('0x0'));var util=require('util');var path=require(_0x849c('0x1'));var timeout=require(_0x849c('0x2'));var express=require(_0x849c('0x3'));var router=express[_0x849c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x849c('0x5'));var interaction=require(_0x849c('0x6'));var config=require(_0x849c('0x7'));var controller=require(_0x849c('0x8'));router[_0x849c('0x9')]('/',auth['isAuthenticated'](),controller[_0x849c('0xa')]);router[_0x849c('0x9')](_0x849c('0xb'),auth[_0x849c('0xc')](),controller[_0x849c('0xd')]);router[_0x849c('0x9')](_0x849c('0xe'),auth[_0x849c('0xc')](),controller[_0x849c('0xf')]);router[_0x849c('0x9')](_0x849c('0x10'),auth[_0x849c('0xc')](),controller[_0x849c('0x11')]);router[_0x849c('0x12')]('/',auth[_0x849c('0xc')](),controller[_0x849c('0x13')]);router[_0x849c('0x12')](_0x849c('0xe'),auth['isAuthenticated'](),controller[_0x849c('0x14')]);router[_0x849c('0x15')](_0x849c('0xb'),auth[_0x849c('0xc')](),controller[_0x849c('0x16')]);router[_0x849c('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x849c('0x18')]);module[_0x849c('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 338acb0..fc548d2 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 _0x0e63=['STRING','username','sequelize'];(function(_0x370fb3,_0xe54247){var _0x17bec3=function(_0x8befcd){while(--_0x8befcd){_0x370fb3['push'](_0x370fb3['shift']());}};_0x17bec3(++_0xe54247);}(_0x0e63,0xb6));var _0x30e6=function(_0x46a82b,_0x372b54){_0x46a82b=_0x46a82b-0x0;var _0x68abdb=_0x0e63[_0x46a82b];return _0x68abdb;};'use strict';var Sequelize=require(_0x30e6('0x0'));module['exports']={'name':{'type':Sequelize[_0x30e6('0x1')]},'description':{'type':Sequelize[_0x30e6('0x1')]},'username':{'type':Sequelize[_0x30e6('0x1')],'unique':_0x30e6('0x2')},'password':{'type':Sequelize[_0x30e6('0x1')]},'remoteUri':{'type':Sequelize[_0x30e6('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x30e6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd050=['exports','STRING','remoteUri','sequelize'];(function(_0x45a56d,_0x1efaae){var _0x50c0ef=function(_0x30c187){while(--_0x30c187){_0x45a56d['push'](_0x45a56d['shift']());}};_0x50c0ef(++_0x1efaae);}(_0xd050,0xf3));var _0x0d05=function(_0x515ab3,_0x5b063c){_0x515ab3=_0x515ab3-0x0;var _0x502809=_0xd050[_0x515ab3];return _0x502809;};'use strict';var Sequelize=require(_0x0d05('0x0'));module[_0x0d05('0x1')]={'name':{'type':Sequelize[_0x0d05('0x2')]},'description':{'type':Sequelize[_0x0d05('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0d05('0x2')],'unique':_0x0d05('0x3')},'serverUrl':{'type':Sequelize[_0x0d05('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 395c350..ca91c57 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 _0xd0a0=['options','SugarcrmAccount','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','assigned_user_id','description','date_start','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','Calls','values','remove','includes','label','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','end','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x4cf9e6,_0x1c4289){var _0xf9e375=function(_0x5044c6){while(--_0x5044c6){_0x4cf9e6['push'](_0x4cf9e6['shift']());}};_0xf9e375(++_0x1c4289);}(_0xd0a0,0x1b4));var _0x0d0a=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0xd0a0[_0x2a2166];return _0x3bcf50;};'use strict';var emlformat=require(_0x0d0a('0x0'));var rimraf=require(_0x0d0a('0x1'));var zipdir=require(_0x0d0a('0x2'));var jsonpatch=require(_0x0d0a('0x3'));var rp=require(_0x0d0a('0x4'));var moment=require(_0x0d0a('0x5'));var BPromise=require(_0x0d0a('0x6'));var Mustache=require(_0x0d0a('0x7'));var util=require('util');var path=require(_0x0d0a('0x8'));var sox=require('sox');var csv=require(_0x0d0a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d0a('0xa'));var _=require('lodash');var squel=require(_0x0d0a('0xb'));var crypto=require(_0x0d0a('0xc'));var jsforce=require(_0x0d0a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0d0a('0x9'));var querystring=require(_0x0d0a('0xe'));var Papa=require(_0x0d0a('0xf'));var Redis=require(_0x0d0a('0x10'));var authService=require(_0x0d0a('0x11'));var qs=require(_0x0d0a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d0a('0x13'));var logger=require(_0x0d0a('0x14'))(_0x0d0a('0x15'));var utils=require('../../config/utils');var config=require(_0x0d0a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d0a('0x17'))['db'];var integrations=require(_0x0d0a('0x18'));var jayson=require(_0x0d0a('0x19'));var client=jayson['client'][_0x0d0a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3f29b2,_0x25cd1d,_0x22c001,_0x2cdc9c){return new BPromise(function(_0x1b66e4,_0x27eb7b){var _0x15188e=_0x2cdc9c||client;return _0x15188e[_0x0d0a('0x1b')](_0x3f29b2,_0x22c001)[_0x0d0a('0x1c')](function(_0x1fbef0){logger['info'](_0x0d0a('0x1d'),_0x25cd1d,_0x0d0a('0x1e'));logger[_0x0d0a('0x1f')](_0x0d0a('0x20'),_0x25cd1d,_0x0d0a('0x1e'),JSON['stringify'](_0x1fbef0));if(_0x1fbef0[_0x0d0a('0x21')]){if(_0x1fbef0[_0x0d0a('0x21')][_0x0d0a('0x22')]===0x1f4){logger[_0x0d0a('0x21')](_0x0d0a('0x1d'),_0x25cd1d,_0x1fbef0[_0x0d0a('0x21')]['message']);return _0x27eb7b(_0x1fbef0[_0x0d0a('0x21')][_0x0d0a('0x23')]);}logger['error'](_0x0d0a('0x1d'),_0x25cd1d,_0x1fbef0[_0x0d0a('0x21')]['message']);return _0x1b66e4(_0x1fbef0[_0x0d0a('0x21')][_0x0d0a('0x23')]);}else{logger[_0x0d0a('0x24')]('SugarcrmAccount,\x20%s,\x20%s',_0x25cd1d,_0x0d0a('0x1e'));_0x1b66e4(_0x1fbef0[_0x0d0a('0x25')][_0x0d0a('0x23')]);}})[_0x0d0a('0x26')](function(_0x42ea9f){logger[_0x0d0a('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x25cd1d,_0x42ea9f);_0x27eb7b(_0x42ea9f);});});}function respondWithStatusCode(_0x5b5caa,_0x110e96){_0x110e96=_0x110e96||0xcc;return function(_0x53c1da){if(_0x53c1da){return _0x5b5caa['sendStatus'](_0x110e96);}return _0x5b5caa[_0x0d0a('0x27')](_0x110e96)['end']();};}function respondWithResult(_0x104409,_0x3c7c23){_0x3c7c23=_0x3c7c23||0xc8;return function(_0x5e46b1){if(_0x5e46b1){return _0x104409['status'](_0x3c7c23)['json'](_0x5e46b1);}};}function respondWithFilteredResult(_0x44f3f7,_0x1f287d){return function(_0x1e9af8){if(_0x1e9af8){var _0x4fd492=typeof _0x1f287d[_0x0d0a('0x28')]==='undefined'&&typeof _0x1f287d['limit']===_0x0d0a('0x29');var _0x223be2=_0x1e9af8['count'];var _0x621353=_0x4fd492?0x0:_0x1f287d[_0x0d0a('0x28')];var _0x1e55f0=_0x4fd492?_0x1e9af8[_0x0d0a('0x2a')]:_0x1f287d[_0x0d0a('0x28')]+_0x1f287d[_0x0d0a('0x2b')];var _0x37959d;if(_0x1e55f0>=_0x223be2){_0x1e55f0=_0x223be2;_0x37959d=0xc8;}else{_0x37959d=0xce;}_0x44f3f7[_0x0d0a('0x27')](_0x37959d);return _0x44f3f7[_0x0d0a('0x2c')](_0x0d0a('0x2d'),_0x621353+'-'+_0x1e55f0+'/'+_0x223be2)[_0x0d0a('0x2e')](_0x1e9af8);}return null;};}function patchUpdates(_0x105297){return function(_0x101a9c){try{jsonpatch[_0x0d0a('0x2f')](_0x101a9c,_0x105297,!![]);}catch(_0x41c2fa){return BPromise[_0x0d0a('0x30')](_0x41c2fa);}return _0x101a9c[_0x0d0a('0x31')]();};}function saveUpdates(_0x482e04,_0x57952b){return function(_0x20c092){if(_0x20c092){return _0x20c092['update'](_0x482e04)[_0x0d0a('0x1c')](function(_0x59d6da){return _0x59d6da;});}return null;};}function removeEntity(_0x677851,_0x9463a3){return function(_0x3b4ecb){if(_0x3b4ecb){return _0x3b4ecb[_0x0d0a('0x32')]()[_0x0d0a('0x1c')](function(){_0x677851[_0x0d0a('0x27')](0xcc)[_0x0d0a('0x33')]();});}};}function handleEntityNotFound(_0x216e51,_0x247c97){return function(_0x4f7cb3){if(!_0x4f7cb3){_0x216e51['sendStatus'](0x194);}return _0x4f7cb3;};}function handleError(_0x458d10,_0x1d9ce4){_0x1d9ce4=_0x1d9ce4||0x1f4;return function(_0x75a0ea){logger[_0x0d0a('0x21')](_0x75a0ea[_0x0d0a('0x34')]);if(_0x75a0ea[_0x0d0a('0x35')]){delete _0x75a0ea[_0x0d0a('0x35')];}_0x458d10[_0x0d0a('0x27')](_0x1d9ce4)[_0x0d0a('0x36')](_0x75a0ea);};}exports['index']=function(_0x5c4537,_0x32b86f){var _0x234d29={},_0x2af0e6={},_0x5a6b6e={'count':0x0,'rows':[]};var _0x2e148e=_['map'](db['SugarcrmAccount'][_0x0d0a('0x37')],function(_0x46686e){return{'name':_0x46686e[_0x0d0a('0x38')],'type':_0x46686e[_0x0d0a('0x39')][_0x0d0a('0x3a')]};});_0x2af0e6[_0x0d0a('0x3b')]=_[_0x0d0a('0x3c')](_0x2e148e,_0x0d0a('0x35'));_0x2af0e6[_0x0d0a('0x3d')]=_[_0x0d0a('0x3e')](_0x5c4537[_0x0d0a('0x3d')]);_0x2af0e6['filters']=_[_0x0d0a('0x3f')](_0x2af0e6[_0x0d0a('0x3b')],_0x2af0e6[_0x0d0a('0x3d')]);_0x234d29['attributes']=_['intersection'](_0x2af0e6[_0x0d0a('0x3b')],qs['fields'](_0x5c4537[_0x0d0a('0x3d')][_0x0d0a('0x40')]));_0x234d29[_0x0d0a('0x41')]=_0x234d29['attributes'][_0x0d0a('0x42')]?_0x234d29['attributes']:_0x2af0e6[_0x0d0a('0x3b')];if(!_0x5c4537[_0x0d0a('0x3d')][_0x0d0a('0x43')](_0x0d0a('0x44'))){_0x234d29[_0x0d0a('0x2b')]=qs['limit'](_0x5c4537[_0x0d0a('0x3d')]['limit']);_0x234d29[_0x0d0a('0x28')]=qs[_0x0d0a('0x28')](_0x5c4537['query']['offset']);}_0x234d29['order']=qs[_0x0d0a('0x45')](_0x5c4537[_0x0d0a('0x3d')][_0x0d0a('0x45')]);_0x234d29['where']=qs[_0x0d0a('0x46')](_[_0x0d0a('0x47')](_0x5c4537[_0x0d0a('0x3d')],_0x2af0e6['filters']),_0x2e148e);if(_0x5c4537[_0x0d0a('0x3d')][_0x0d0a('0x48')]){_0x234d29[_0x0d0a('0x49')]=_[_0x0d0a('0x4a')](_0x234d29[_0x0d0a('0x49')],{'$or':_[_0x0d0a('0x3c')](_0x2e148e,function(_0x532a76){if(_0x532a76[_0x0d0a('0x39')]!==_0x0d0a('0x4b')){var _0x51ce67={};_0x51ce67[_0x532a76[_0x0d0a('0x35')]]={'$like':'%'+_0x5c4537[_0x0d0a('0x3d')][_0x0d0a('0x48')]+'%'};return _0x51ce67;}})});}_0x234d29=_['merge']({},_0x234d29,_0x5c4537[_0x0d0a('0x4c')]);var _0x3773ef={'where':_0x234d29[_0x0d0a('0x49')]};return db[_0x0d0a('0x4d')][_0x0d0a('0x2a')](_0x3773ef)['then'](function(_0x399317){_0x5a6b6e[_0x0d0a('0x2a')]=_0x399317;if(_0x5c4537[_0x0d0a('0x3d')][_0x0d0a('0x4e')]){_0x234d29[_0x0d0a('0x4f')]=[{'all':!![]}];}return db[_0x0d0a('0x4d')][_0x0d0a('0x50')](_0x234d29);})['then'](function(_0x389435){_0x5a6b6e[_0x0d0a('0x51')]=_0x389435;return _0x5a6b6e;})[_0x0d0a('0x1c')](respondWithFilteredResult(_0x32b86f,_0x234d29))[_0x0d0a('0x26')](handleError(_0x32b86f,null));};exports[_0x0d0a('0x52')]=function(_0x49ac61,_0x292894){var _0x508a28={'raw':![],'where':{'id':_0x49ac61[_0x0d0a('0x53')]['id']}},_0x288fe4={};_0x288fe4[_0x0d0a('0x3b')]=_[_0x0d0a('0x3e')](db[_0x0d0a('0x4d')][_0x0d0a('0x37')]);_0x288fe4['query']=_['keys'](_0x49ac61[_0x0d0a('0x3d')]);_0x288fe4[_0x0d0a('0x46')]=_[_0x0d0a('0x3f')](_0x288fe4[_0x0d0a('0x3b')],_0x288fe4[_0x0d0a('0x3d')]);_0x508a28[_0x0d0a('0x41')]=_[_0x0d0a('0x3f')](_0x288fe4['model'],qs[_0x0d0a('0x40')](_0x49ac61[_0x0d0a('0x3d')]['fields']));_0x508a28[_0x0d0a('0x41')]=_0x508a28[_0x0d0a('0x41')][_0x0d0a('0x42')]?_0x508a28[_0x0d0a('0x41')]:_0x288fe4['model'];if(_0x49ac61[_0x0d0a('0x3d')][_0x0d0a('0x4e')]){_0x508a28['include']=[{'all':!![]}];}_0x508a28=_[_0x0d0a('0x4a')]({},_0x508a28,_0x49ac61[_0x0d0a('0x4c')]);return db['SugarcrmAccount'][_0x0d0a('0x54')](_0x508a28)[_0x0d0a('0x1c')](handleEntityNotFound(_0x292894,null))[_0x0d0a('0x1c')](respondWithResult(_0x292894,null))['catch'](handleError(_0x292894,null));};exports[_0x0d0a('0x55')]=function(_0x165165,_0x4c8690){return db[_0x0d0a('0x4d')]['create'](_0x165165[_0x0d0a('0x56')],{})[_0x0d0a('0x1c')](respondWithResult(_0x4c8690,0xc9))[_0x0d0a('0x26')](handleError(_0x4c8690,null));};exports['update']=function(_0x4f7302,_0x21e518){if(_0x4f7302[_0x0d0a('0x56')]['id']){delete _0x4f7302[_0x0d0a('0x56')]['id'];}return db[_0x0d0a('0x4d')]['find']({'where':{'id':_0x4f7302[_0x0d0a('0x53')]['id']}})['then'](handleEntityNotFound(_0x21e518,null))[_0x0d0a('0x1c')](saveUpdates(_0x4f7302[_0x0d0a('0x56')],null))[_0x0d0a('0x1c')](respondWithResult(_0x21e518,null))[_0x0d0a('0x26')](handleError(_0x21e518,null));};exports[_0x0d0a('0x32')]=function(_0x147525,_0x530fa0){return db[_0x0d0a('0x4d')][_0x0d0a('0x54')]({'where':{'id':_0x147525[_0x0d0a('0x53')]['id']}})[_0x0d0a('0x1c')](handleEntityNotFound(_0x530fa0,null))[_0x0d0a('0x1c')](removeEntity(_0x530fa0,null))[_0x0d0a('0x26')](handleError(_0x530fa0,null));};exports[_0x0d0a('0x57')]=function(_0x2ae15,_0x572f22,_0x2af3ec){var _0x268f33={};var _0x13907a={};var _0x38a57b;var _0x393304;return db[_0x0d0a('0x4d')][_0x0d0a('0x58')]({'where':{'id':_0x2ae15['params']['id']}})[_0x0d0a('0x1c')](handleEntityNotFound(_0x572f22,null))['then'](function(_0x236bbe){if(_0x236bbe){_0x38a57b=_0x236bbe;_0x13907a[_0x0d0a('0x3b')]=_[_0x0d0a('0x3e')](db[_0x0d0a('0x59')][_0x0d0a('0x37')]);_0x13907a['query']=_['keys'](_0x2ae15[_0x0d0a('0x3d')]);_0x13907a[_0x0d0a('0x46')]=_['intersection'](_0x13907a[_0x0d0a('0x3b')],_0x13907a[_0x0d0a('0x3d')]);_0x268f33[_0x0d0a('0x41')]=_['intersection'](_0x13907a[_0x0d0a('0x3b')],qs[_0x0d0a('0x40')](_0x2ae15[_0x0d0a('0x3d')][_0x0d0a('0x40')]));_0x268f33['attributes']=_0x268f33[_0x0d0a('0x41')][_0x0d0a('0x42')]?_0x268f33[_0x0d0a('0x41')]:_0x13907a[_0x0d0a('0x3b')];_0x268f33['order']=qs[_0x0d0a('0x45')](_0x2ae15[_0x0d0a('0x3d')][_0x0d0a('0x45')]);_0x268f33[_0x0d0a('0x49')]=qs[_0x0d0a('0x46')](_[_0x0d0a('0x47')](_0x2ae15[_0x0d0a('0x3d')],_0x13907a[_0x0d0a('0x46')]));if(_0x2ae15[_0x0d0a('0x3d')][_0x0d0a('0x48')]){_0x268f33[_0x0d0a('0x49')]=_['merge'](_0x268f33['where'],{'$or':_[_0x0d0a('0x3c')](_0x268f33[_0x0d0a('0x41')],function(_0x2c404f){var _0x4da876={};_0x4da876[_0x2c404f]={'$like':'%'+_0x2ae15['query'][_0x0d0a('0x48')]+'%'};return _0x4da876;})});}_0x268f33=_[_0x0d0a('0x4a')]({},_0x268f33,_0x2ae15['options']);return _0x38a57b[_0x0d0a('0x57')](_0x268f33);}})[_0x0d0a('0x1c')](function(_0x1ba37d){if(_0x1ba37d){_0x393304=_0x1ba37d[_0x0d0a('0x42')];if(!_0x2ae15[_0x0d0a('0x3d')][_0x0d0a('0x43')](_0x0d0a('0x44'))){_0x268f33[_0x0d0a('0x2b')]=qs[_0x0d0a('0x2b')](_0x2ae15[_0x0d0a('0x3d')][_0x0d0a('0x2b')]);_0x268f33[_0x0d0a('0x28')]=qs[_0x0d0a('0x28')](_0x2ae15[_0x0d0a('0x3d')][_0x0d0a('0x28')]);}return _0x38a57b[_0x0d0a('0x57')](_0x268f33);}})[_0x0d0a('0x1c')](function(_0x2f473f){if(_0x2f473f){return _0x2f473f?{'count':_0x393304,'rows':_0x2f473f}:null;}})[_0x0d0a('0x1c')](respondWithResult(_0x572f22,null))['catch'](handleError(_0x572f22,null));};exports[_0x0d0a('0x5a')]=function(_0x21b6de,_0x3d6596,_0x976182){if(_0x21b6de['body']['id']){delete _0x21b6de[_0x0d0a('0x56')]['id'];}return db['SugarcrmAccount'][_0x0d0a('0x58')]({'where':{'id':_0x21b6de[_0x0d0a('0x53')]['id']}})[_0x0d0a('0x1c')](handleEntityNotFound(_0x3d6596,null))[_0x0d0a('0x1c')](function(_0x309de1){if(_0x309de1){_0x21b6de[_0x0d0a('0x56')]['AccountId']=_0x309de1['id'];_0x21b6de[_0x0d0a('0x56')][_0x0d0a('0x5b')]=integrations[_0x0d0a('0x5c')](_0x21b6de[_0x0d0a('0x56')]['channel'],_0x21b6de[_0x0d0a('0x56')][_0x0d0a('0x39')]);_0x21b6de[_0x0d0a('0x56')][_0x0d0a('0x5d')]=integrations[_0x0d0a('0x5e')](_0x21b6de['body'][_0x0d0a('0x5f')],_0x21b6de['body'][_0x0d0a('0x39')]);return db[_0x0d0a('0x59')][_0x0d0a('0x55')](_0x21b6de[_0x0d0a('0x56')],{'include':[{'model':db[_0x0d0a('0x60')],'as':_0x0d0a('0x5b')},{'model':db[_0x0d0a('0x60')],'as':'Descriptions'}]});}return null;})[_0x0d0a('0x1c')](respondWithResult(_0x3d6596,null))[_0x0d0a('0x26')](handleError(_0x3d6596,null));};exports['getFields']=function(_0x21e13e,_0x5add71,_0x31e4fd){var _0x32f033='';var _0x1be883=['id','name',_0x0d0a('0x61'),'created_by',_0x0d0a('0x62'),_0x0d0a('0x63'),'duration_hours','duration_minutes',_0x0d0a('0x64'),_0x0d0a('0x65'),_0x0d0a('0x66'),_0x0d0a('0x67')];return db['SugarcrmAccount'][_0x0d0a('0x58')]({'where':{'id':_0x21e13e[_0x0d0a('0x53')]['id']},'attributes':['id',_0x0d0a('0x68'),'password',_0x0d0a('0x69')]})[_0x0d0a('0x1c')](handleEntityNotFound(_0x5add71,null))[_0x0d0a('0x1c')](function(_0x45baf3){if(_0x45baf3){_0x32f033=_0x45baf3['remoteUri'];var _0xfaa4af=_0x32f033[_0x0d0a('0x6a')](-0x1);if(_0xfaa4af==='/'){_0x32f033=_0x32f033[_0x0d0a('0x6b')](0x0,_0x32f033[_0x0d0a('0x6c')](_0xfaa4af));}return rp({'method':'POST','uri':util[_0x0d0a('0x6d')]('%s%s',_0x32f033,_0x0d0a('0x6e')),'json':!![],'form':{'method':'login','input_type':_0x0d0a('0x6f'),'response_type':'JSON','rest_data':JSON[_0x0d0a('0x70')]({'user_auth':{'user_name':_0x45baf3[_0x0d0a('0x68')],'password':_0x45baf3['password'],'encryption':_0x0d0a('0x71')},'application':_0x0d0a('0x72')})}});}})[_0x0d0a('0x1c')](function(_0x3b81c7){if(_0x3b81c7&&_0x3b81c7['name']!==_0x0d0a('0x73')&&_0x3b81c7[_0x0d0a('0x35')]!==_0x0d0a('0x74')){return rp({'method':_0x0d0a('0x75'),'uri':util[_0x0d0a('0x6d')]('%s%s',_0x32f033,_0x0d0a('0x6e')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x0d0a('0x6f'),'response_type':_0x0d0a('0x6f'),'rest_data':JSON[_0x0d0a('0x70')]({'session':_0x3b81c7['id'],'module_name':_0x0d0a('0x76')})}})[_0x0d0a('0x1c')](function(_0x4b8af2){if(_0x4b8af2){var _0xb6083e=_[_0x0d0a('0x77')](_0x4b8af2['module_fields']);_[_0x0d0a('0x78')](_0xb6083e,function(_0xf315f8){return _0x1be883[_0x0d0a('0x79')](_0xf315f8[_0x0d0a('0x35')]);});return{'count':_0xb6083e[_0x0d0a('0x42')],'rows':_[_0x0d0a('0x3c')](_0xb6083e,function(_0x56a1c5){return{'id':_0x56a1c5[_0x0d0a('0x35')],'name':_0x56a1c5[_0x0d0a('0x7a')],'custom':_['endsWith'](_0x56a1c5[_0x0d0a('0x35')],'_c')?!![]:![],'options':_0x56a1c5[_0x0d0a('0x4c')]?_[_0x0d0a('0x3c')](_[_0x0d0a('0x77')](_0x56a1c5[_0x0d0a('0x4c')]),function(_0x588383){return{'name':_0x588383[_0x0d0a('0x7b')],'value':_0x588383[_0x0d0a('0x35')]};}):[]};})};}})[_0x0d0a('0x1c')](respondWithResult(_0x5add71,null))[_0x0d0a('0x26')](function(_0x16199a){var _0x58c9b7=_0x21e13e[_0x0d0a('0x3d')][_0x0d0a('0x7c')]?0x1f4:_0x16199a[_0x0d0a('0x7d')]||0x1f4;logger[_0x0d0a('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x0d0a('0x7e'),_0x58c9b7,JSON[_0x0d0a('0x70')](_0x16199a));delete _0x16199a['name'];if(_0x58c9b7===0x191){_0x58c9b7=0x190;}_0x5add71[_0x0d0a('0x27')](_0x58c9b7)[_0x0d0a('0x36')](_0x21e13e[_0x0d0a('0x3d')][_0x0d0a('0x7c')]?{'message':_0x0d0a('0x7f'),'statusCode':_0x16199a['statusCode']}:_0x16199a);});}else{var _0x2c63d0=0x1f4;_0x5add71[_0x0d0a('0x27')](_0x2c63d0)['send']({'message':_0x0d0a('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x16f6=['password','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','Calls','values','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','SugarcrmAccount','key','model','keys','query','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','show','params','rawAttributes','create','body','find','findOne','order','getConfigurations','length','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_type','direction','remoteUri','slice','lastIndexOf','POST','login','JSON','username'];(function(_0x4fc212,_0x1087aa){var _0x252317=function(_0x6facac){while(--_0x6facac){_0x4fc212['push'](_0x4fc212['shift']());}};_0x252317(++_0x1087aa);}(_0x16f6,0x18a));var _0x616f=function(_0x149548,_0x137071){_0x149548=_0x149548-0x0;var _0x16947a=_0x16f6[_0x149548];return _0x16947a;};'use strict';var emlformat=require(_0x616f('0x0'));var rimraf=require(_0x616f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x616f('0x2'));var rp=require(_0x616f('0x3'));var moment=require(_0x616f('0x4'));var BPromise=require(_0x616f('0x5'));var Mustache=require(_0x616f('0x6'));var util=require('util');var path=require(_0x616f('0x7'));var sox=require(_0x616f('0x8'));var csv=require(_0x616f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x616f('0xa'));var _=require(_0x616f('0xb'));var squel=require(_0x616f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x616f('0xd'));var toCsv=require(_0x616f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x616f('0xe'));var as=require(_0x616f('0xf'));var hardwareService=require(_0x616f('0x10'));var logger=require(_0x616f('0x11'))('api');var utils=require(_0x616f('0x12'));var config=require(_0x616f('0x13'));var licenseUtil=require(_0x616f('0x14'));var db=require(_0x616f('0x15'))['db'];var integrations=require(_0x616f('0x16'));var jayson=require(_0x616f('0x17'));var client=jayson[_0x616f('0x18')][_0x616f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1f0eab,_0x3c2f8a,_0x2a1188,_0x41e5cf){return new BPromise(function(_0x5701ef,_0x5f5169){var _0x5aecd8=_0x41e5cf||client;return _0x5aecd8[_0x616f('0x1a')](_0x1f0eab,_0x2a1188)['then'](function(_0x3c18ac){logger[_0x616f('0x1b')](_0x616f('0x1c'),_0x3c2f8a,_0x616f('0x1d'));logger[_0x616f('0x1e')](_0x616f('0x1f'),_0x3c2f8a,_0x616f('0x1d'),JSON[_0x616f('0x20')](_0x3c18ac));if(_0x3c18ac[_0x616f('0x21')]){if(_0x3c18ac['error'][_0x616f('0x22')]===0x1f4){logger[_0x616f('0x21')](_0x616f('0x1c'),_0x3c2f8a,_0x3c18ac[_0x616f('0x21')][_0x616f('0x23')]);return _0x5f5169(_0x3c18ac['error'][_0x616f('0x23')]);}logger[_0x616f('0x21')](_0x616f('0x1c'),_0x3c2f8a,_0x3c18ac[_0x616f('0x21')][_0x616f('0x23')]);return _0x5701ef(_0x3c18ac[_0x616f('0x21')]['message']);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3c2f8a,_0x616f('0x1d'));_0x5701ef(_0x3c18ac['result']['message']);}})[_0x616f('0x24')](function(_0x5f40b3){logger[_0x616f('0x21')](_0x616f('0x1c'),_0x3c2f8a,_0x5f40b3);_0x5f5169(_0x5f40b3);});});}function respondWithStatusCode(_0x3327aa,_0x1c9d73){_0x1c9d73=_0x1c9d73||0xcc;return function(_0x167247){if(_0x167247){return _0x3327aa['sendStatus'](_0x1c9d73);}return _0x3327aa[_0x616f('0x25')](_0x1c9d73)['end']();};}function respondWithResult(_0xfa3e69,_0x184e99){_0x184e99=_0x184e99||0xc8;return function(_0x3ef7d9){if(_0x3ef7d9){return _0xfa3e69[_0x616f('0x25')](_0x184e99)[_0x616f('0x26')](_0x3ef7d9);}};}function respondWithFilteredResult(_0x555cb5,_0x5448dd){return function(_0x3fa92d){if(_0x3fa92d){var _0x551439=typeof _0x5448dd[_0x616f('0x27')]==='undefined'&&typeof _0x5448dd[_0x616f('0x28')]===_0x616f('0x29');var _0x2c2206=_0x3fa92d[_0x616f('0x2a')];var _0x470406=_0x551439?0x0:_0x5448dd[_0x616f('0x27')];var _0x50e193=_0x551439?_0x3fa92d[_0x616f('0x2a')]:_0x5448dd[_0x616f('0x27')]+_0x5448dd[_0x616f('0x28')];var _0x37f526;if(_0x50e193>=_0x2c2206){_0x50e193=_0x2c2206;_0x37f526=0xc8;}else{_0x37f526=0xce;}_0x555cb5[_0x616f('0x25')](_0x37f526);return _0x555cb5[_0x616f('0x2b')](_0x616f('0x2c'),_0x470406+'-'+_0x50e193+'/'+_0x2c2206)[_0x616f('0x26')](_0x3fa92d);}return null;};}function patchUpdates(_0x573c24){return function(_0x15065d){try{jsonpatch['apply'](_0x15065d,_0x573c24,!![]);}catch(_0x414aaf){return BPromise[_0x616f('0x2d')](_0x414aaf);}return _0x15065d[_0x616f('0x2e')]();};}function saveUpdates(_0x404c3e,_0x45d42d){return function(_0xb87ffd){if(_0xb87ffd){return _0xb87ffd[_0x616f('0x2f')](_0x404c3e)[_0x616f('0x30')](function(_0x563f2b){return _0x563f2b;});}return null;};}function removeEntity(_0x3db7df,_0x9a4ba4){return function(_0x5f0cdd){if(_0x5f0cdd){return _0x5f0cdd[_0x616f('0x31')]()[_0x616f('0x30')](function(){_0x3db7df['status'](0xcc)[_0x616f('0x32')]();});}};}function handleEntityNotFound(_0x37d607,_0x4963d9){return function(_0x520989){if(!_0x520989){_0x37d607[_0x616f('0x33')](0x194);}return _0x520989;};}function handleError(_0x5f07e6,_0x10a493){_0x10a493=_0x10a493||0x1f4;return function(_0x58081c){logger[_0x616f('0x21')](_0x58081c[_0x616f('0x34')]);if(_0x58081c[_0x616f('0x35')]){delete _0x58081c[_0x616f('0x35')];}_0x5f07e6['status'](_0x10a493)[_0x616f('0x36')](_0x58081c);};}exports[_0x616f('0x37')]=function(_0x2190a6,_0x417096){var _0x203f93={},_0x41b023={},_0x16e1b7={'count':0x0,'rows':[]};var _0x5c8f84=_[_0x616f('0x38')](db[_0x616f('0x39')]['rawAttributes'],function(_0x39112e){return{'name':_0x39112e['fieldName'],'type':_0x39112e['type'][_0x616f('0x3a')]};});_0x41b023[_0x616f('0x3b')]=_[_0x616f('0x38')](_0x5c8f84,_0x616f('0x35'));_0x41b023['query']=_[_0x616f('0x3c')](_0x2190a6[_0x616f('0x3d')]);_0x41b023[_0x616f('0x3e')]=_['intersection'](_0x41b023[_0x616f('0x3b')],_0x41b023[_0x616f('0x3d')]);_0x203f93[_0x616f('0x3f')]=_[_0x616f('0x40')](_0x41b023['model'],qs[_0x616f('0x41')](_0x2190a6[_0x616f('0x3d')][_0x616f('0x41')]));_0x203f93[_0x616f('0x3f')]=_0x203f93['attributes']['length']?_0x203f93['attributes']:_0x41b023[_0x616f('0x3b')];if(!_0x2190a6[_0x616f('0x3d')]['hasOwnProperty'](_0x616f('0x42'))){_0x203f93[_0x616f('0x28')]=qs['limit'](_0x2190a6[_0x616f('0x3d')][_0x616f('0x28')]);_0x203f93[_0x616f('0x27')]=qs[_0x616f('0x27')](_0x2190a6['query']['offset']);}_0x203f93['order']=qs[_0x616f('0x43')](_0x2190a6[_0x616f('0x3d')][_0x616f('0x43')]);_0x203f93[_0x616f('0x44')]=qs[_0x616f('0x3e')](_[_0x616f('0x45')](_0x2190a6[_0x616f('0x3d')],_0x41b023[_0x616f('0x3e')]),_0x5c8f84);if(_0x2190a6[_0x616f('0x3d')][_0x616f('0x46')]){_0x203f93[_0x616f('0x44')]=_[_0x616f('0x47')](_0x203f93[_0x616f('0x44')],{'$or':_[_0x616f('0x38')](_0x5c8f84,function(_0xa4ebed){if(_0xa4ebed[_0x616f('0x48')]!=='VIRTUAL'){var _0x39573e={};_0x39573e[_0xa4ebed[_0x616f('0x35')]]={'$like':'%'+_0x2190a6[_0x616f('0x3d')][_0x616f('0x46')]+'%'};return _0x39573e;}})});}_0x203f93=_[_0x616f('0x47')]({},_0x203f93,_0x2190a6[_0x616f('0x49')]);var _0x5a0071={'where':_0x203f93[_0x616f('0x44')]};return db[_0x616f('0x39')][_0x616f('0x2a')](_0x5a0071)[_0x616f('0x30')](function(_0x4fa326){_0x16e1b7[_0x616f('0x2a')]=_0x4fa326;if(_0x2190a6['query'][_0x616f('0x4a')]){_0x203f93['include']=[{'all':!![]}];}return db[_0x616f('0x39')][_0x616f('0x4b')](_0x203f93);})[_0x616f('0x30')](function(_0x4f0a9c){_0x16e1b7['rows']=_0x4f0a9c;return _0x16e1b7;})[_0x616f('0x30')](respondWithFilteredResult(_0x417096,_0x203f93))[_0x616f('0x24')](handleError(_0x417096,null));};exports[_0x616f('0x4c')]=function(_0x31a514,_0x91be7d){var _0x5318bb={'raw':![],'where':{'id':_0x31a514[_0x616f('0x4d')]['id']}},_0x3e87ce={};_0x3e87ce[_0x616f('0x3b')]=_[_0x616f('0x3c')](db['SugarcrmAccount'][_0x616f('0x4e')]);_0x3e87ce['query']=_[_0x616f('0x3c')](_0x31a514[_0x616f('0x3d')]);_0x3e87ce[_0x616f('0x3e')]=_[_0x616f('0x40')](_0x3e87ce[_0x616f('0x3b')],_0x3e87ce[_0x616f('0x3d')]);_0x5318bb[_0x616f('0x3f')]=_[_0x616f('0x40')](_0x3e87ce['model'],qs[_0x616f('0x41')](_0x31a514[_0x616f('0x3d')][_0x616f('0x41')]));_0x5318bb[_0x616f('0x3f')]=_0x5318bb[_0x616f('0x3f')]['length']?_0x5318bb[_0x616f('0x3f')]:_0x3e87ce['model'];if(_0x31a514[_0x616f('0x3d')][_0x616f('0x4a')]){_0x5318bb['include']=[{'all':!![]}];}_0x5318bb=_[_0x616f('0x47')]({},_0x5318bb,_0x31a514[_0x616f('0x49')]);return db['SugarcrmAccount']['find'](_0x5318bb)[_0x616f('0x30')](handleEntityNotFound(_0x91be7d,null))[_0x616f('0x30')](respondWithResult(_0x91be7d,null))[_0x616f('0x24')](handleError(_0x91be7d,null));};exports[_0x616f('0x4f')]=function(_0x2e663a,_0x1d088e){return db[_0x616f('0x39')]['create'](_0x2e663a[_0x616f('0x50')],{})[_0x616f('0x30')](respondWithResult(_0x1d088e,0xc9))[_0x616f('0x24')](handleError(_0x1d088e,null));};exports[_0x616f('0x2f')]=function(_0x434955,_0x3e41fe){if(_0x434955['body']['id']){delete _0x434955[_0x616f('0x50')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x434955['params']['id']}})[_0x616f('0x30')](handleEntityNotFound(_0x3e41fe,null))[_0x616f('0x30')](saveUpdates(_0x434955[_0x616f('0x50')],null))[_0x616f('0x30')](respondWithResult(_0x3e41fe,null))[_0x616f('0x24')](handleError(_0x3e41fe,null));};exports['destroy']=function(_0x45bee0,_0x2082ec){return db[_0x616f('0x39')][_0x616f('0x51')]({'where':{'id':_0x45bee0[_0x616f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2082ec,null))[_0x616f('0x30')](removeEntity(_0x2082ec,null))['catch'](handleError(_0x2082ec,null));};exports['getConfigurations']=function(_0x19320d,_0x32dbbe,_0x2a2789){var _0x10a223={};var _0x15cf1c={};var _0x254979;var _0x545d00;return db[_0x616f('0x39')][_0x616f('0x52')]({'where':{'id':_0x19320d[_0x616f('0x4d')]['id']}})[_0x616f('0x30')](handleEntityNotFound(_0x32dbbe,null))[_0x616f('0x30')](function(_0x2a9012){if(_0x2a9012){_0x254979=_0x2a9012;_0x15cf1c[_0x616f('0x3b')]=_[_0x616f('0x3c')](db['SugarcrmConfiguration'][_0x616f('0x4e')]);_0x15cf1c[_0x616f('0x3d')]=_[_0x616f('0x3c')](_0x19320d[_0x616f('0x3d')]);_0x15cf1c[_0x616f('0x3e')]=_[_0x616f('0x40')](_0x15cf1c[_0x616f('0x3b')],_0x15cf1c[_0x616f('0x3d')]);_0x10a223[_0x616f('0x3f')]=_[_0x616f('0x40')](_0x15cf1c[_0x616f('0x3b')],qs[_0x616f('0x41')](_0x19320d[_0x616f('0x3d')][_0x616f('0x41')]));_0x10a223[_0x616f('0x3f')]=_0x10a223[_0x616f('0x3f')]['length']?_0x10a223[_0x616f('0x3f')]:_0x15cf1c[_0x616f('0x3b')];_0x10a223[_0x616f('0x53')]=qs[_0x616f('0x43')](_0x19320d[_0x616f('0x3d')][_0x616f('0x43')]);_0x10a223[_0x616f('0x44')]=qs[_0x616f('0x3e')](_[_0x616f('0x45')](_0x19320d[_0x616f('0x3d')],_0x15cf1c['filters']));if(_0x19320d[_0x616f('0x3d')][_0x616f('0x46')]){_0x10a223['where']=_[_0x616f('0x47')](_0x10a223[_0x616f('0x44')],{'$or':_[_0x616f('0x38')](_0x10a223[_0x616f('0x3f')],function(_0x4a3a9a){var _0x42f91f={};_0x42f91f[_0x4a3a9a]={'$like':'%'+_0x19320d[_0x616f('0x3d')][_0x616f('0x46')]+'%'};return _0x42f91f;})});}_0x10a223=_[_0x616f('0x47')]({},_0x10a223,_0x19320d[_0x616f('0x49')]);return _0x254979[_0x616f('0x54')](_0x10a223);}})[_0x616f('0x30')](function(_0x52ce7f){if(_0x52ce7f){_0x545d00=_0x52ce7f[_0x616f('0x55')];if(!_0x19320d[_0x616f('0x3d')][_0x616f('0x56')]('nolimit')){_0x10a223[_0x616f('0x28')]=qs[_0x616f('0x28')](_0x19320d[_0x616f('0x3d')][_0x616f('0x28')]);_0x10a223[_0x616f('0x27')]=qs['offset'](_0x19320d[_0x616f('0x3d')][_0x616f('0x27')]);}return _0x254979[_0x616f('0x54')](_0x10a223);}})['then'](function(_0xfc5361){if(_0xfc5361){return _0xfc5361?{'count':_0x545d00,'rows':_0xfc5361}:null;}})[_0x616f('0x30')](respondWithResult(_0x32dbbe,null))[_0x616f('0x24')](handleError(_0x32dbbe,null));};exports['addConfiguration']=function(_0x514534,_0x49211b,_0x289e9b){if(_0x514534[_0x616f('0x50')]['id']){delete _0x514534[_0x616f('0x50')]['id'];}return db['SugarcrmAccount'][_0x616f('0x52')]({'where':{'id':_0x514534['params']['id']}})['then'](handleEntityNotFound(_0x49211b,null))[_0x616f('0x30')](function(_0x531c66){if(_0x531c66){_0x514534[_0x616f('0x50')][_0x616f('0x57')]=_0x531c66['id'];_0x514534[_0x616f('0x50')][_0x616f('0x58')]=integrations[_0x616f('0x59')](_0x514534[_0x616f('0x50')][_0x616f('0x5a')],_0x514534[_0x616f('0x50')][_0x616f('0x48')]);_0x514534['body'][_0x616f('0x5b')]=integrations[_0x616f('0x5c')](_0x514534['body']['channel'],_0x514534[_0x616f('0x50')][_0x616f('0x48')]);return db[_0x616f('0x5d')][_0x616f('0x4f')](_0x514534[_0x616f('0x50')],{'include':[{'model':db[_0x616f('0x5e')],'as':_0x616f('0x58')},{'model':db[_0x616f('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x49211b,null))[_0x616f('0x24')](handleError(_0x49211b,null));};exports[_0x616f('0x5f')]=function(_0x1f268d,_0xb02f09,_0x270a04){var _0x5c6e14='';var _0x383510=['id',_0x616f('0x35'),_0x616f('0x60'),_0x616f('0x61'),_0x616f('0x62'),_0x616f('0x63'),_0x616f('0x64'),'duration_minutes','parent_id',_0x616f('0x65'),'parent_name',_0x616f('0x66')];return db[_0x616f('0x39')][_0x616f('0x52')]({'where':{'id':_0x1f268d[_0x616f('0x4d')]['id']},'attributes':['id','username','password',_0x616f('0x67')]})['then'](handleEntityNotFound(_0xb02f09,null))['then'](function(_0x4771ed){if(_0x4771ed){_0x5c6e14=_0x4771ed[_0x616f('0x67')];var _0x4b4c1d=_0x5c6e14[_0x616f('0x68')](-0x1);if(_0x4b4c1d==='/'){_0x5c6e14=_0x5c6e14['substring'](0x0,_0x5c6e14[_0x616f('0x69')](_0x4b4c1d));}return rp({'method':_0x616f('0x6a'),'uri':util['format']('%s%s',_0x5c6e14,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x616f('0x6b'),'input_type':_0x616f('0x6c'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4771ed[_0x616f('0x6d')],'password':_0x4771ed[_0x616f('0x6e')],'encryption':'PLAIN'},'application':_0x616f('0x6f')})}});}})['then'](function(_0x266806){if(_0x266806&&_0x266806[_0x616f('0x35')]!=='Invalid\x20Login'&&_0x266806[_0x616f('0x35')]!==_0x616f('0x70')){return rp({'method':_0x616f('0x6a'),'uri':util[_0x616f('0x71')]('%s%s',_0x5c6e14,_0x616f('0x72')),'json':!![],'form':{'method':_0x616f('0x73'),'input_type':_0x616f('0x6c'),'response_type':_0x616f('0x6c'),'rest_data':JSON['stringify']({'session':_0x266806['id'],'module_name':_0x616f('0x74')})}})['then'](function(_0x52c8ab){if(_0x52c8ab){var _0x3d6f2f=_[_0x616f('0x75')](_0x52c8ab['module_fields']);_[_0x616f('0x76')](_0x3d6f2f,function(_0x17b154){return _0x383510[_0x616f('0x77')](_0x17b154[_0x616f('0x35')]);});return{'count':_0x3d6f2f[_0x616f('0x55')],'rows':_[_0x616f('0x38')](_0x3d6f2f,function(_0x248c08){return{'id':_0x248c08['name'],'name':_0x248c08[_0x616f('0x78')],'custom':_[_0x616f('0x79')](_0x248c08[_0x616f('0x35')],'_c')?!![]:![],'options':_0x248c08[_0x616f('0x49')]?_['map'](_[_0x616f('0x75')](_0x248c08['options']),function(_0x116907){return{'name':_0x116907['value'],'value':_0x116907[_0x616f('0x35')]};}):[]};})};}})[_0x616f('0x30')](respondWithResult(_0xb02f09,null))[_0x616f('0x24')](function(_0x2a8afd){var _0x4270f0=_0x1f268d[_0x616f('0x3d')][_0x616f('0x7a')]?0x1f4:_0x2a8afd[_0x616f('0x7b')]||0x1f4;logger[_0x616f('0x21')](_0x616f('0x7c'),_0x616f('0x5f'),_0x4270f0,JSON[_0x616f('0x20')](_0x2a8afd));delete _0x2a8afd[_0x616f('0x35')];if(_0x4270f0===0x191){_0x4270f0=0x190;}_0xb02f09['status'](_0x4270f0)['send'](_0x1f268d['query'][_0x616f('0x7a')]?{'message':_0x616f('0x7d'),'statusCode':_0x2a8afd[_0x616f('0x7b')]}:_0x2a8afd);});}else{var _0x8bedf1=0x1f4;_0xb02f09['status'](_0x8bedf1)[_0x616f('0x36')]({'message':_0x616f('0x7d'),'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 e526948..0424b08 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 _0x9aa2=['request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','lodash','../../config/logger','moment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9aa2,0x125));var _0x29aa=function(_0x1e7c1a,_0x1e1385){_0x1e7c1a=_0x1e7c1a-0x0;var _0x4761d5=_0x9aa2[_0x1e7c1a];return _0x4761d5;};'use strict';var _=require(_0x29aa('0x0'));var util=require('util');var logger=require(_0x29aa('0x1'))('api');var moment=require(_0x29aa('0x2'));var BPromise=require('bluebird');var rp=require(_0x29aa('0x3'));var fs=require('fs');var path=require(_0x29aa('0x4'));var rimraf=require('rimraf');var config=require(_0x29aa('0x5'));var attributes=require(_0x29aa('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x29aa('0x7')]=function(_0xcbbf34,_0x18a7fb){return _0xcbbf34['define']('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe313=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util','api','moment','bluebird','path'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xe313,0xeb));var _0x3e31=function(_0x4333b1,_0x2234cc){_0x4333b1=_0x4333b1-0x0;var _0x17137d=_0xe313[_0x4333b1];return _0x17137d;};'use strict';var _=require('lodash');var util=require(_0x3e31('0x0'));var logger=require('../../config/logger')(_0x3e31('0x1'));var moment=require(_0x3e31('0x2'));var BPromise=require(_0x3e31('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e31('0x4'));var rimraf=require(_0x3e31('0x5'));var config=require(_0x3e31('0x6'));var attributes=require(_0x3e31('0x7'));var integrations=require(_0x3e31('0x8'));module[_0x3e31('0x9')]=function(_0x2a78f8,_0xb7dffb){return _0x2a78f8['define'](_0x3e31('0xa'),attributes,{'tableName':_0x3e31('0xb'),'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 7323114..7e2bbe4 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 _0x9f19=['where','attributes','limit','include','map','model','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x9f19,0x11f));var _0x99f1=function(_0x4d4702,_0x5e60d9){_0x4d4702=_0x4d4702-0x0;var _0x37def6=_0x9f19[_0x4d4702];return _0x37def6;};'use strict';var _=require(_0x99f1('0x0'));var util=require(_0x99f1('0x1'));var moment=require(_0x99f1('0x2'));var BPromise=require(_0x99f1('0x3'));var rs=require(_0x99f1('0x4'));var fs=require('fs');var Redis=require(_0x99f1('0x5'));var db=require(_0x99f1('0x6'))['db'];var utils=require(_0x99f1('0x7'));var logger=require(_0x99f1('0x8'))('rpc');var config=require(_0x99f1('0x9'));var jayson=require(_0x99f1('0xa'));var client=jayson['client'][_0x99f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6de9ce,_0x1a268c,_0x29e1f2){return new BPromise(function(_0x38f9ec,_0x406d9c){return client['request'](_0x6de9ce,_0x29e1f2)[_0x99f1('0xc')](function(_0x4f8a6b){logger[_0x99f1('0xd')](_0x99f1('0xe'),_0x1a268c,_0x99f1('0xf'));logger[_0x99f1('0x10')](_0x99f1('0x11'),_0x1a268c,_0x99f1('0xf'),JSON[_0x99f1('0x12')](_0x4f8a6b));if(_0x4f8a6b[_0x99f1('0x13')]){if(_0x4f8a6b[_0x99f1('0x13')][_0x99f1('0x14')]===0x1f4){logger[_0x99f1('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x1a268c,_0x4f8a6b[_0x99f1('0x13')][_0x99f1('0x15')]);return _0x406d9c(_0x4f8a6b[_0x99f1('0x13')][_0x99f1('0x15')]);}logger[_0x99f1('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x1a268c,_0x4f8a6b[_0x99f1('0x13')][_0x99f1('0x15')]);return _0x38f9ec(_0x4f8a6b[_0x99f1('0x13')][_0x99f1('0x15')]);}else{logger[_0x99f1('0xd')](_0x99f1('0xe'),_0x1a268c,_0x99f1('0xf'));_0x38f9ec(_0x4f8a6b[_0x99f1('0x16')][_0x99f1('0x15')]);}})[_0x99f1('0x17')](function(_0x2a1ca1){logger[_0x99f1('0x13')](_0x99f1('0xe'),_0x1a268c,_0x2a1ca1);_0x406d9c(_0x2a1ca1);});});}exports[_0x99f1('0x18')]=function(_0x466905){var _0x38b064=this;return new Promise(function(_0x53edc4,_0x1f2f22){return db[_0x99f1('0x19')]['findAll']({'raw':_0x466905['options']?_0x466905[_0x99f1('0x1a')][_0x99f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x466905[_0x99f1('0x1a')]?_0x466905[_0x99f1('0x1a')][_0x99f1('0x1c')]||null:null,'attributes':_0x466905[_0x99f1('0x1a')]?_0x466905[_0x99f1('0x1a')][_0x99f1('0x1d')]||null:null,'limit':_0x466905[_0x99f1('0x1a')]?_0x466905['options'][_0x99f1('0x1e')]||null:null,'include':_0x466905[_0x99f1('0x1a')]?_0x466905['options'][_0x99f1('0x1f')]?_[_0x99f1('0x20')](_0x466905[_0x99f1('0x1a')]['include'],function(_0x338456){return{'model':db[_0x338456[_0x99f1('0x21')]],'as':_0x338456['as'],'attributes':_0x338456[_0x99f1('0x1d')],'include':_0x338456[_0x99f1('0x1f')]?_['map'](_0x338456[_0x99f1('0x1f')],function(_0x1cb6d2){return{'model':db[_0x1cb6d2['model']],'as':_0x1cb6d2['as'],'attributes':_0x1cb6d2[_0x99f1('0x1d')],'include':_0x1cb6d2[_0x99f1('0x1f')]?_[_0x99f1('0x20')](_0x1cb6d2[_0x99f1('0x1f')],function(_0x324645){return{'model':db[_0x324645[_0x99f1('0x21')]],'as':_0x324645['as'],'attributes':_0x324645[_0x99f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x99f1('0xc')](function(_0x91939){logger[_0x99f1('0xd')](_0x99f1('0x18'),_0x466905);logger[_0x99f1('0x10')](_0x99f1('0x18'),_0x466905,JSON['stringify'](_0x91939));_0x53edc4(_0x91939);})['catch'](function(_0x1bcba7){logger[_0x99f1('0x13')](_0x99f1('0x18'),_0x1bcba7[_0x99f1('0x15')],_0x466905);_0x1f2f22(_0x38b064[_0x99f1('0x13')](0x1f4,_0x1bcba7[_0x99f1('0x15')]));});});};exports[_0x99f1('0x22')]=function(_0xcd6840){var _0x348e0d=this;return new Promise(function(_0x2e9d35,_0x49f10c){return db[_0x99f1('0x19')]['find']({'raw':_0xcd6840[_0x99f1('0x1a')]?_0xcd6840[_0x99f1('0x1a')][_0x99f1('0x1b')]===undefined?!![]:![]:!![],'where':_0xcd6840[_0x99f1('0x1a')]?_0xcd6840[_0x99f1('0x1a')]['where']||null:null,'attributes':_0xcd6840[_0x99f1('0x1a')]?_0xcd6840[_0x99f1('0x1a')][_0x99f1('0x1d')]||null:null,'include':_0xcd6840['options']?_0xcd6840['options']['include']?_[_0x99f1('0x20')](_0xcd6840[_0x99f1('0x1a')][_0x99f1('0x1f')],function(_0x395e6e){return{'model':db[_0x395e6e[_0x99f1('0x21')]],'as':_0x395e6e['as'],'attributes':_0x395e6e[_0x99f1('0x1d')],'include':_0x395e6e['include']?_['map'](_0x395e6e[_0x99f1('0x1f')],function(_0x56eea9){return{'model':db[_0x56eea9[_0x99f1('0x21')]],'as':_0x56eea9['as'],'attributes':_0x56eea9['attributes'],'include':_0x56eea9[_0x99f1('0x1f')]?_['map'](_0x56eea9[_0x99f1('0x1f')],function(_0x5cdd82){return{'model':db[_0x5cdd82[_0x99f1('0x21')]],'as':_0x5cdd82['as'],'attributes':_0x5cdd82[_0x99f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x99f1('0xc')](function(_0x5e849b){logger[_0x99f1('0xd')]('ShowSugarcrmAccount',_0xcd6840);logger['debug']('ShowSugarcrmAccount',_0xcd6840,JSON[_0x99f1('0x12')](_0x5e849b));_0x2e9d35(_0x5e849b);})[_0x99f1('0x17')](function(_0x1562b1){logger[_0x99f1('0x13')](_0x99f1('0x22'),_0x1562b1[_0x99f1('0x15')],_0xcd6840);_0x49f10c(_0x348e0d[_0x99f1('0x13')](0x1f4,_0x1562b1['message']));});});}; \ No newline at end of file +var _0xc019=['map','model','ShowSugarcrmAccount','find','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xc019,0x89));var _0x9c01=function(_0x37011f,_0x16a2e3){_0x37011f=_0x37011f-0x0;var _0x4130cc=_0xc019[_0x37011f];return _0x4130cc;};'use strict';var _=require('lodash');var util=require(_0x9c01('0x0'));var moment=require(_0x9c01('0x1'));var BPromise=require(_0x9c01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c01('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9c01('0x4'))(_0x9c01('0x5'));var config=require(_0x9c01('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9c01('0x7')][_0x9c01('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb9bd80,_0x241197,_0x57a7d6){return new BPromise(function(_0x2a6053,_0x83fa8d){return client[_0x9c01('0x9')](_0xb9bd80,_0x57a7d6)[_0x9c01('0xa')](function(_0x320c03){logger[_0x9c01('0xb')](_0x9c01('0xc'),_0x241197,'request\x20sent');logger[_0x9c01('0xd')](_0x9c01('0xe'),_0x241197,_0x9c01('0xf'),JSON[_0x9c01('0x10')](_0x320c03));if(_0x320c03[_0x9c01('0x11')]){if(_0x320c03[_0x9c01('0x11')]['code']===0x1f4){logger[_0x9c01('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x241197,_0x320c03[_0x9c01('0x11')][_0x9c01('0x12')]);return _0x83fa8d(_0x320c03[_0x9c01('0x11')]['message']);}logger['error'](_0x9c01('0xc'),_0x241197,_0x320c03[_0x9c01('0x11')][_0x9c01('0x12')]);return _0x2a6053(_0x320c03[_0x9c01('0x11')]['message']);}else{logger[_0x9c01('0xb')](_0x9c01('0xc'),_0x241197,_0x9c01('0xf'));_0x2a6053(_0x320c03[_0x9c01('0x13')][_0x9c01('0x12')]);}})['catch'](function(_0x340143){logger[_0x9c01('0x11')](_0x9c01('0xc'),_0x241197,_0x340143);_0x83fa8d(_0x340143);});});}exports[_0x9c01('0x14')]=function(_0x4e2564){var _0x3c0ada=this;return new Promise(function(_0x59af07,_0x28c73e){return db[_0x9c01('0x15')][_0x9c01('0x16')]({'raw':_0x4e2564['options']?_0x4e2564[_0x9c01('0x17')][_0x9c01('0x18')]===undefined?!![]:![]:!![],'where':_0x4e2564[_0x9c01('0x17')]?_0x4e2564['options'][_0x9c01('0x19')]||null:null,'attributes':_0x4e2564[_0x9c01('0x17')]?_0x4e2564['options'][_0x9c01('0x1a')]||null:null,'limit':_0x4e2564[_0x9c01('0x17')]?_0x4e2564['options']['limit']||null:null,'include':_0x4e2564[_0x9c01('0x17')]?_0x4e2564[_0x9c01('0x17')][_0x9c01('0x1b')]?_[_0x9c01('0x1c')](_0x4e2564[_0x9c01('0x17')][_0x9c01('0x1b')],function(_0x316ca7){return{'model':db[_0x316ca7[_0x9c01('0x1d')]],'as':_0x316ca7['as'],'attributes':_0x316ca7['attributes'],'include':_0x316ca7['include']?_[_0x9c01('0x1c')](_0x316ca7[_0x9c01('0x1b')],function(_0x14c254){return{'model':db[_0x14c254[_0x9c01('0x1d')]],'as':_0x14c254['as'],'attributes':_0x14c254[_0x9c01('0x1a')],'include':_0x14c254['include']?_['map'](_0x14c254[_0x9c01('0x1b')],function(_0x29637e){return{'model':db[_0x29637e['model']],'as':_0x29637e['as'],'attributes':_0x29637e[_0x9c01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9c01('0xa')](function(_0x18708b){logger[_0x9c01('0xb')](_0x9c01('0x14'),_0x4e2564);logger[_0x9c01('0xd')](_0x9c01('0x14'),_0x4e2564,JSON['stringify'](_0x18708b));_0x59af07(_0x18708b);})['catch'](function(_0xe88c4a){logger[_0x9c01('0x11')](_0x9c01('0x14'),_0xe88c4a[_0x9c01('0x12')],_0x4e2564);_0x28c73e(_0x3c0ada['error'](0x1f4,_0xe88c4a[_0x9c01('0x12')]));});});};exports[_0x9c01('0x1e')]=function(_0x509195){var _0x39523a=this;return new Promise(function(_0x3f9727,_0x58b8c2){return db['SugarcrmAccount'][_0x9c01('0x1f')]({'raw':_0x509195['options']?_0x509195[_0x9c01('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x509195['options']?_0x509195['options'][_0x9c01('0x19')]||null:null,'attributes':_0x509195[_0x9c01('0x17')]?_0x509195[_0x9c01('0x17')]['attributes']||null:null,'include':_0x509195[_0x9c01('0x17')]?_0x509195[_0x9c01('0x17')]['include']?_[_0x9c01('0x1c')](_0x509195[_0x9c01('0x17')][_0x9c01('0x1b')],function(_0x56314d){return{'model':db[_0x56314d[_0x9c01('0x1d')]],'as':_0x56314d['as'],'attributes':_0x56314d['attributes'],'include':_0x56314d[_0x9c01('0x1b')]?_[_0x9c01('0x1c')](_0x56314d['include'],function(_0x367637){return{'model':db[_0x367637[_0x9c01('0x1d')]],'as':_0x367637['as'],'attributes':_0x367637['attributes'],'include':_0x367637[_0x9c01('0x1b')]?_['map'](_0x367637[_0x9c01('0x1b')],function(_0x2191fd){return{'model':db[_0x2191fd[_0x9c01('0x1d')]],'as':_0x2191fd['as'],'attributes':_0x2191fd[_0x9c01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9c01('0xa')](function(_0x30c5bc){logger[_0x9c01('0xb')](_0x9c01('0x1e'),_0x509195);logger[_0x9c01('0xd')](_0x9c01('0x1e'),_0x509195,JSON[_0x9c01('0x10')](_0x30c5bc));_0x3f9727(_0x30c5bc);})[_0x9c01('0x20')](function(_0x2820e6){logger[_0x9c01('0x11')](_0x9c01('0x1e'),_0x2820e6['message'],_0x509195);_0x58b8c2(_0x39523a[_0x9c01('0x11')](0x1f4,_0x2820e6['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1862959..d701bcf 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 _0xbb99=['../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2330fd,_0x56e9c7){var _0x5c1eba=function(_0x517719){while(--_0x517719){_0x2330fd['push'](_0x2330fd['shift']());}};_0x5c1eba(++_0x56e9c7);}(_0xbb99,0xd1));var _0x9bb9=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0xbb99[_0x32b993];return _0x482780;};'use strict';var multer=require(_0x9bb9('0x0'));var util=require(_0x9bb9('0x1'));var path=require(_0x9bb9('0x2'));var timeout=require(_0x9bb9('0x3'));var express=require(_0x9bb9('0x4'));var router=express[_0x9bb9('0x5')]();var fs_extra=require(_0x9bb9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9bb9('0x7'));var config=require('../../config/environment');var controller=require(_0x9bb9('0x8'));router[_0x9bb9('0x9')]('/',auth[_0x9bb9('0xa')](),controller[_0x9bb9('0xb')]);router[_0x9bb9('0x9')]('/:id',auth[_0x9bb9('0xa')](),controller[_0x9bb9('0xc')]);router['get'](_0x9bb9('0xd'),auth['isAuthenticated'](),controller[_0x9bb9('0xe')]);router[_0x9bb9('0x9')](_0x9bb9('0xf'),auth[_0x9bb9('0xa')](),controller[_0x9bb9('0x10')]);router['get']('/:id/descriptions',auth[_0x9bb9('0xa')](),controller[_0x9bb9('0x11')]);router[_0x9bb9('0x12')]('/',auth['isAuthenticated'](),controller[_0x9bb9('0x13')]);router[_0x9bb9('0x14')](_0x9bb9('0x15'),auth[_0x9bb9('0xa')](),controller['update']);router[_0x9bb9('0x16')](_0x9bb9('0x15'),auth[_0x9bb9('0xa')](),controller[_0x9bb9('0x17')]);module['exports']=router; \ No newline at end of file +var _0xdf76=['express','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xdf76,0x1b6));var _0x6df7=function(_0x3bcb39,_0x2e1bd0){_0x3bcb39=_0x3bcb39-0x0;var _0x158bc4=_0xdf76[_0x3bcb39];return _0x158bc4;};'use strict';var multer=require(_0x6df7('0x0'));var util=require(_0x6df7('0x1'));var path=require(_0x6df7('0x2'));var timeout=require('connect-timeout');var express=require(_0x6df7('0x3'));var router=express[_0x6df7('0x4')]();var fs_extra=require(_0x6df7('0x5'));var auth=require(_0x6df7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6df7('0x7'));router[_0x6df7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6df7('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x6df7('0x9')]);router[_0x6df7('0x8')](_0x6df7('0xa'),auth[_0x6df7('0xb')](),controller[_0x6df7('0xc')]);router['get'](_0x6df7('0xd'),auth['isAuthenticated'](),controller[_0x6df7('0xe')]);router[_0x6df7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6df7('0x10')](_0x6df7('0x11'),auth[_0x6df7('0xb')](),controller[_0x6df7('0x12')]);router[_0x6df7('0x13')](_0x6df7('0x11'),auth['isAuthenticated'](),controller[_0x6df7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 42a8f7e..453adf9 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 _0xbc02=['STRING','exports'];(function(_0x430ca1,_0x26bfb3){var _0x4cb726=function(_0x4972cf){while(--_0x4972cf){_0x430ca1['push'](_0x430ca1['shift']());}};_0x4cb726(++_0x26bfb3);}(_0xbc02,0xa7));var _0x2bc0=function(_0x24f9d9,_0x6b4d81){_0x24f9d9=_0x24f9d9-0x0;var _0x392b6c=_0xbc02[_0x24f9d9];return _0x392b6c;};'use strict';var Sequelize=require('sequelize');module[_0x2bc0('0x0')]={'name':{'type':Sequelize[_0x2bc0('0x1')]},'description':{'type':Sequelize[_0x2bc0('0x1')]}}; \ No newline at end of file +var _0x996f=['sequelize','exports','STRING'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x996f,0xea));var _0xf996=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x996f[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0xf996('0x0'));module[_0xf996('0x1')]={'name':{'type':Sequelize[_0xf996('0x2')]},'description':{'type':Sequelize[_0xf996('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 57f2516..8f6822b 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 _0x2dae=['find','findOne','pick','getFields','getSubjects','SugarcrmField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','options','includeAll','params','include','merge','create','body'];(function(_0x162758,_0x173413){var _0x33e2bd=function(_0x462106){while(--_0x462106){_0x162758['push'](_0x162758['shift']());}};_0x33e2bd(++_0x173413);}(_0x2dae,0xc3));var _0xe2da=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x2dae[_0x56e4e7];return _0x383618;};'use strict';var emlformat=require(_0xe2da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe2da('0x1'));var jsonpatch=require(_0xe2da('0x2'));var rp=require(_0xe2da('0x3'));var moment=require(_0xe2da('0x4'));var BPromise=require(_0xe2da('0x5'));var Mustache=require('mustache');var util=require(_0xe2da('0x6'));var path=require(_0xe2da('0x7'));var sox=require(_0xe2da('0x8'));var csv=require(_0xe2da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe2da('0xa'));var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x9'));var querystring=require(_0xe2da('0x10'));var Papa=require(_0xe2da('0x11'));var Redis=require('ioredis');var authService=require(_0xe2da('0x12'));var qs=require(_0xe2da('0x13'));var as=require(_0xe2da('0x14'));var hardwareService=require(_0xe2da('0x15'));var logger=require(_0xe2da('0x16'))(_0xe2da('0x17'));var utils=require(_0xe2da('0x18'));var config=require(_0xe2da('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2da('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe2da('0x1b')][_0xe2da('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x37064e,_0x411b9f,_0xfab73e,_0x5660b5){return new BPromise(function(_0x295a86,_0x48584b){var _0x236e7a=_0x5660b5||client;return _0x236e7a['request'](_0x37064e,_0xfab73e)['then'](function(_0x403d1c){logger[_0xe2da('0x1d')](_0xe2da('0x1e'),_0x411b9f,'request\x20sent');logger[_0xe2da('0x1f')](_0xe2da('0x20'),_0x411b9f,_0xe2da('0x21'),JSON[_0xe2da('0x22')](_0x403d1c));if(_0x403d1c['error']){if(_0x403d1c[_0xe2da('0x23')][_0xe2da('0x24')]===0x1f4){logger[_0xe2da('0x23')](_0xe2da('0x1e'),_0x411b9f,_0x403d1c[_0xe2da('0x23')]['message']);return _0x48584b(_0x403d1c[_0xe2da('0x23')][_0xe2da('0x25')]);}logger['error'](_0xe2da('0x1e'),_0x411b9f,_0x403d1c[_0xe2da('0x23')][_0xe2da('0x25')]);return _0x295a86(_0x403d1c[_0xe2da('0x23')][_0xe2da('0x25')]);}else{logger[_0xe2da('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x411b9f,_0xe2da('0x21'));_0x295a86(_0x403d1c['result'][_0xe2da('0x25')]);}})[_0xe2da('0x26')](function(_0x395af6){logger[_0xe2da('0x23')](_0xe2da('0x1e'),_0x411b9f,_0x395af6);_0x48584b(_0x395af6);});});}function respondWithStatusCode(_0x1e45e9,_0x38f2c4){_0x38f2c4=_0x38f2c4||0xcc;return function(_0x221e98){if(_0x221e98){return _0x1e45e9['sendStatus'](_0x38f2c4);}return _0x1e45e9[_0xe2da('0x27')](_0x38f2c4)[_0xe2da('0x28')]();};}function respondWithResult(_0xb4d957,_0x14704d){_0x14704d=_0x14704d||0xc8;return function(_0x3778dc){if(_0x3778dc){return _0xb4d957[_0xe2da('0x27')](_0x14704d)[_0xe2da('0x29')](_0x3778dc);}};}function respondWithFilteredResult(_0x56c37e,_0x2adc49){return function(_0x3e23d7){if(_0x3e23d7){var _0x1dc228=typeof _0x2adc49[_0xe2da('0x2a')]===_0xe2da('0x2b')&&typeof _0x2adc49[_0xe2da('0x2c')]===_0xe2da('0x2b');var _0x39f60e=_0x3e23d7['count'];var _0x487a7c=_0x1dc228?0x0:_0x2adc49['offset'];var _0x3c4845=_0x1dc228?_0x3e23d7[_0xe2da('0x2d')]:_0x2adc49[_0xe2da('0x2a')]+_0x2adc49[_0xe2da('0x2c')];var _0x5de7fb;if(_0x3c4845>=_0x39f60e){_0x3c4845=_0x39f60e;_0x5de7fb=0xc8;}else{_0x5de7fb=0xce;}_0x56c37e['status'](_0x5de7fb);return _0x56c37e[_0xe2da('0x2e')](_0xe2da('0x2f'),_0x487a7c+'-'+_0x3c4845+'/'+_0x39f60e)[_0xe2da('0x29')](_0x3e23d7);}return null;};}function patchUpdates(_0x39f983){return function(_0x7ab5ee){try{jsonpatch[_0xe2da('0x30')](_0x7ab5ee,_0x39f983,!![]);}catch(_0x195b93){return BPromise[_0xe2da('0x31')](_0x195b93);}return _0x7ab5ee[_0xe2da('0x32')]();};}function saveUpdates(_0x499400,_0x576959){return function(_0x672767){if(_0x672767){return _0x672767[_0xe2da('0x33')](_0x499400)[_0xe2da('0x34')](function(_0x34f5fe){return _0x34f5fe;});}return null;};}function removeEntity(_0x195537,_0x27e86d){return function(_0x121cbf){if(_0x121cbf){return _0x121cbf[_0xe2da('0x35')]()[_0xe2da('0x34')](function(){_0x195537[_0xe2da('0x27')](0xcc)[_0xe2da('0x28')]();});}};}function handleEntityNotFound(_0x2386b8,_0x4ef546){return function(_0x19d6c8){if(!_0x19d6c8){_0x2386b8[_0xe2da('0x36')](0x194);}return _0x19d6c8;};}function handleError(_0x2618a1,_0x109d51){_0x109d51=_0x109d51||0x1f4;return function(_0x3a6f08){logger['error'](_0x3a6f08[_0xe2da('0x37')]);if(_0x3a6f08[_0xe2da('0x38')]){delete _0x3a6f08[_0xe2da('0x38')];}_0x2618a1['status'](_0x109d51)[_0xe2da('0x39')](_0x3a6f08);};}exports[_0xe2da('0x3a')]=function(_0x262bf8,_0x53af7f){var _0x4d0963={},_0x156deb={},_0x1f4a5a={'count':0x0,'rows':[]};var _0x4d6e6c=_[_0xe2da('0x3b')](db[_0xe2da('0x3c')][_0xe2da('0x3d')],function(_0x256a0c){return{'name':_0x256a0c[_0xe2da('0x3e')],'type':_0x256a0c['type'][_0xe2da('0x3f')]};});_0x156deb['model']=_['map'](_0x4d6e6c,_0xe2da('0x38'));_0x156deb['query']=_[_0xe2da('0x40')](_0x262bf8[_0xe2da('0x41')]);_0x156deb['filters']=_[_0xe2da('0x42')](_0x156deb[_0xe2da('0x43')],_0x156deb['query']);_0x4d0963['attributes']=_['intersection'](_0x156deb[_0xe2da('0x43')],qs[_0xe2da('0x44')](_0x262bf8[_0xe2da('0x41')][_0xe2da('0x44')]));_0x4d0963[_0xe2da('0x45')]=_0x4d0963[_0xe2da('0x45')][_0xe2da('0x46')]?_0x4d0963['attributes']:_0x156deb[_0xe2da('0x43')];if(!_0x262bf8[_0xe2da('0x41')][_0xe2da('0x47')](_0xe2da('0x48'))){_0x4d0963[_0xe2da('0x2c')]=qs['limit'](_0x262bf8[_0xe2da('0x41')][_0xe2da('0x2c')]);_0x4d0963[_0xe2da('0x2a')]=qs['offset'](_0x262bf8[_0xe2da('0x41')][_0xe2da('0x2a')]);}_0x4d0963[_0xe2da('0x49')]=qs[_0xe2da('0x4a')](_0x262bf8[_0xe2da('0x41')][_0xe2da('0x4a')]);_0x4d0963[_0xe2da('0x4b')]=qs[_0xe2da('0x4c')](_['pick'](_0x262bf8[_0xe2da('0x41')],_0x156deb[_0xe2da('0x4c')]),_0x4d6e6c);if(_0x262bf8[_0xe2da('0x41')][_0xe2da('0x4d')]){_0x4d0963[_0xe2da('0x4b')]=_['merge'](_0x4d0963[_0xe2da('0x4b')],{'$or':_[_0xe2da('0x3b')](_0x4d6e6c,function(_0x9ecea8){if(_0x9ecea8[_0xe2da('0x4e')]!==_0xe2da('0x4f')){var _0x3383cc={};_0x3383cc[_0x9ecea8[_0xe2da('0x38')]]={'$like':'%'+_0x262bf8['query'][_0xe2da('0x4d')]+'%'};return _0x3383cc;}})});}_0x4d0963=_['merge']({},_0x4d0963,_0x262bf8[_0xe2da('0x50')]);var _0x54b3ad={'where':_0x4d0963[_0xe2da('0x4b')]};return db['SugarcrmConfiguration'][_0xe2da('0x2d')](_0x54b3ad)[_0xe2da('0x34')](function(_0x525912){_0x1f4a5a[_0xe2da('0x2d')]=_0x525912;if(_0x262bf8[_0xe2da('0x41')][_0xe2da('0x51')]){_0x4d0963['include']=[{'all':!![]}];}return db[_0xe2da('0x3c')]['findAll'](_0x4d0963);})['then'](function(_0x16a393){_0x1f4a5a['rows']=_0x16a393;return _0x1f4a5a;})[_0xe2da('0x34')](respondWithFilteredResult(_0x53af7f,_0x4d0963))[_0xe2da('0x26')](handleError(_0x53af7f,null));};exports['show']=function(_0xa7ddc,_0x1464b7){var _0x482547={'raw':![],'where':{'id':_0xa7ddc[_0xe2da('0x52')]['id']}},_0x4a6d80={};_0x4a6d80['model']=_[_0xe2da('0x40')](db[_0xe2da('0x3c')][_0xe2da('0x3d')]);_0x4a6d80[_0xe2da('0x41')]=_[_0xe2da('0x40')](_0xa7ddc[_0xe2da('0x41')]);_0x4a6d80[_0xe2da('0x4c')]=_[_0xe2da('0x42')](_0x4a6d80[_0xe2da('0x43')],_0x4a6d80['query']);_0x482547[_0xe2da('0x45')]=_[_0xe2da('0x42')](_0x4a6d80[_0xe2da('0x43')],qs['fields'](_0xa7ddc[_0xe2da('0x41')][_0xe2da('0x44')]));_0x482547[_0xe2da('0x45')]=_0x482547[_0xe2da('0x45')][_0xe2da('0x46')]?_0x482547[_0xe2da('0x45')]:_0x4a6d80[_0xe2da('0x43')];if(_0xa7ddc['query']['includeAll']){_0x482547[_0xe2da('0x53')]=[{'all':!![]}];}_0x482547=_[_0xe2da('0x54')]({},_0x482547,_0xa7ddc[_0xe2da('0x50')]);return db['SugarcrmConfiguration']['find'](_0x482547)[_0xe2da('0x34')](handleEntityNotFound(_0x1464b7,null))['then'](respondWithResult(_0x1464b7,null))[_0xe2da('0x26')](handleError(_0x1464b7,null));};exports[_0xe2da('0x55')]=function(_0x8e78b9,_0x3099aa){return db[_0xe2da('0x3c')][_0xe2da('0x55')](_0x8e78b9[_0xe2da('0x56')],{})[_0xe2da('0x34')](respondWithResult(_0x3099aa,0xc9))[_0xe2da('0x26')](handleError(_0x3099aa,null));};exports['update']=function(_0x26a9f0,_0x2f763b){if(_0x26a9f0[_0xe2da('0x56')]['id']){delete _0x26a9f0[_0xe2da('0x56')]['id'];}return db['SugarcrmConfiguration'][_0xe2da('0x57')]({'where':{'id':_0x26a9f0[_0xe2da('0x52')]['id']}})[_0xe2da('0x34')](handleEntityNotFound(_0x2f763b,null))['then'](saveUpdates(_0x26a9f0[_0xe2da('0x56')],null))[_0xe2da('0x34')](respondWithResult(_0x2f763b,null))[_0xe2da('0x26')](handleError(_0x2f763b,null));};exports[_0xe2da('0x35')]=function(_0x188bb0,_0x22a571){return db[_0xe2da('0x3c')][_0xe2da('0x57')]({'where':{'id':_0x188bb0[_0xe2da('0x52')]['id']}})[_0xe2da('0x34')](handleEntityNotFound(_0x22a571,null))[_0xe2da('0x34')](removeEntity(_0x22a571,null))[_0xe2da('0x26')](handleError(_0x22a571,null));};exports['getFields']=function(_0x2b50cb,_0x705010,_0xe5d403){var _0x268052={};var _0x7526bd={};var _0x277e8c;var _0x1fc0df;return db['SugarcrmConfiguration'][_0xe2da('0x58')]({'where':{'id':_0x2b50cb['params']['id']}})[_0xe2da('0x34')](handleEntityNotFound(_0x705010,null))[_0xe2da('0x34')](function(_0x5b0c33){if(_0x5b0c33){_0x277e8c=_0x5b0c33;_0x7526bd['model']=_[_0xe2da('0x40')](db['SugarcrmField'][_0xe2da('0x3d')]);_0x7526bd['query']=_[_0xe2da('0x40')](_0x2b50cb[_0xe2da('0x41')]);_0x7526bd[_0xe2da('0x4c')]=_['intersection'](_0x7526bd['model'],_0x7526bd['query']);_0x268052[_0xe2da('0x45')]=_[_0xe2da('0x42')](_0x7526bd[_0xe2da('0x43')],qs[_0xe2da('0x44')](_0x2b50cb['query'][_0xe2da('0x44')]));_0x268052[_0xe2da('0x45')]=_0x268052[_0xe2da('0x45')][_0xe2da('0x46')]?_0x268052[_0xe2da('0x45')]:_0x7526bd[_0xe2da('0x43')];_0x268052[_0xe2da('0x49')]=qs['sort'](_0x2b50cb[_0xe2da('0x41')][_0xe2da('0x4a')]);_0x268052[_0xe2da('0x4b')]=qs[_0xe2da('0x4c')](_[_0xe2da('0x59')](_0x2b50cb['query'],_0x7526bd[_0xe2da('0x4c')]));if(_0x2b50cb['query'][_0xe2da('0x4d')]){_0x268052['where']=_[_0xe2da('0x54')](_0x268052['where'],{'$or':_['map'](_0x268052[_0xe2da('0x45')],function(_0x405743){var _0x2cff55={};_0x2cff55[_0x405743]={'$like':'%'+_0x2b50cb[_0xe2da('0x41')][_0xe2da('0x4d')]+'%'};return _0x2cff55;})});}_0x268052=_[_0xe2da('0x54')]({},_0x268052,_0x2b50cb[_0xe2da('0x50')]);return _0x277e8c[_0xe2da('0x5a')](_0x268052);}})[_0xe2da('0x34')](function(_0x17af45){if(_0x17af45){_0x1fc0df=_0x17af45['length'];if(!_0x2b50cb[_0xe2da('0x41')][_0xe2da('0x47')](_0xe2da('0x48'))){_0x268052[_0xe2da('0x2c')]=qs['limit'](_0x2b50cb[_0xe2da('0x41')][_0xe2da('0x2c')]);_0x268052[_0xe2da('0x2a')]=qs[_0xe2da('0x2a')](_0x2b50cb['query'][_0xe2da('0x2a')]);}return _0x277e8c['getFields'](_0x268052);}})[_0xe2da('0x34')](function(_0x3c2294){if(_0x3c2294){return _0x3c2294?{'count':_0x1fc0df,'rows':_0x3c2294}:null;}})['then'](respondWithResult(_0x705010,null))[_0xe2da('0x26')](handleError(_0x705010,null));};exports[_0xe2da('0x5b')]=function(_0x2843b,_0x835995,_0x42f865){var _0x4fe3dd={};var _0x1a6f48={};var _0x53a070;var _0x4943b3;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2843b[_0xe2da('0x52')]['id']}})[_0xe2da('0x34')](handleEntityNotFound(_0x835995,null))[_0xe2da('0x34')](function(_0xc378ca){if(_0xc378ca){_0x53a070=_0xc378ca;_0x1a6f48[_0xe2da('0x43')]=_[_0xe2da('0x40')](db[_0xe2da('0x5c')][_0xe2da('0x3d')]);_0x1a6f48[_0xe2da('0x41')]=_['keys'](_0x2843b[_0xe2da('0x41')]);_0x1a6f48[_0xe2da('0x4c')]=_[_0xe2da('0x42')](_0x1a6f48[_0xe2da('0x43')],_0x1a6f48[_0xe2da('0x41')]);_0x4fe3dd[_0xe2da('0x45')]=_[_0xe2da('0x42')](_0x1a6f48[_0xe2da('0x43')],qs[_0xe2da('0x44')](_0x2843b[_0xe2da('0x41')]['fields']));_0x4fe3dd[_0xe2da('0x45')]=_0x4fe3dd[_0xe2da('0x45')][_0xe2da('0x46')]?_0x4fe3dd[_0xe2da('0x45')]:_0x1a6f48[_0xe2da('0x43')];_0x4fe3dd[_0xe2da('0x49')]=qs[_0xe2da('0x4a')](_0x2843b[_0xe2da('0x41')][_0xe2da('0x4a')]);_0x4fe3dd[_0xe2da('0x4b')]=qs[_0xe2da('0x4c')](_[_0xe2da('0x59')](_0x2843b['query'],_0x1a6f48[_0xe2da('0x4c')]));if(_0x2843b['query'][_0xe2da('0x4d')]){_0x4fe3dd[_0xe2da('0x4b')]=_[_0xe2da('0x54')](_0x4fe3dd[_0xe2da('0x4b')],{'$or':_[_0xe2da('0x3b')](_0x4fe3dd[_0xe2da('0x45')],function(_0x252578){var _0x54a1b8={};_0x54a1b8[_0x252578]={'$like':'%'+_0x2843b[_0xe2da('0x41')][_0xe2da('0x4d')]+'%'};return _0x54a1b8;})});}_0x4fe3dd=_[_0xe2da('0x54')]({},_0x4fe3dd,_0x2843b[_0xe2da('0x50')]);return _0x53a070[_0xe2da('0x5b')](_0x4fe3dd);}})[_0xe2da('0x34')](function(_0x4a9e88){if(_0x4a9e88){_0x4943b3=_0x4a9e88[_0xe2da('0x46')];if(!_0x2843b[_0xe2da('0x41')][_0xe2da('0x47')](_0xe2da('0x48'))){_0x4fe3dd[_0xe2da('0x2c')]=qs[_0xe2da('0x2c')](_0x2843b[_0xe2da('0x41')]['limit']);_0x4fe3dd[_0xe2da('0x2a')]=qs[_0xe2da('0x2a')](_0x2843b[_0xe2da('0x41')][_0xe2da('0x2a')]);}return _0x53a070[_0xe2da('0x5b')](_0x4fe3dd);}})[_0xe2da('0x34')](function(_0x5cfa5f){if(_0x5cfa5f){return _0x5cfa5f?{'count':_0x4943b3,'rows':_0x5cfa5f}:null;}})[_0xe2da('0x34')](respondWithResult(_0x835995,null))['catch'](handleError(_0x835995,null));};exports['getDescriptions']=function(_0x3a6bf4,_0x6b5a99,_0x4afc18){var _0x539c43={};var _0x3f0e80={};var _0x23daa8;var _0x20bf30;return db[_0xe2da('0x3c')]['findOne']({'where':{'id':_0x3a6bf4[_0xe2da('0x52')]['id']}})['then'](handleEntityNotFound(_0x6b5a99,null))['then'](function(_0x423b63){if(_0x423b63){_0x23daa8=_0x423b63;_0x3f0e80[_0xe2da('0x43')]=_[_0xe2da('0x40')](db[_0xe2da('0x5c')][_0xe2da('0x3d')]);_0x3f0e80[_0xe2da('0x41')]=_['keys'](_0x3a6bf4[_0xe2da('0x41')]);_0x3f0e80[_0xe2da('0x4c')]=_[_0xe2da('0x42')](_0x3f0e80['model'],_0x3f0e80[_0xe2da('0x41')]);_0x539c43[_0xe2da('0x45')]=_[_0xe2da('0x42')](_0x3f0e80['model'],qs[_0xe2da('0x44')](_0x3a6bf4[_0xe2da('0x41')][_0xe2da('0x44')]));_0x539c43[_0xe2da('0x45')]=_0x539c43[_0xe2da('0x45')]['length']?_0x539c43[_0xe2da('0x45')]:_0x3f0e80[_0xe2da('0x43')];_0x539c43[_0xe2da('0x49')]=qs[_0xe2da('0x4a')](_0x3a6bf4[_0xe2da('0x41')][_0xe2da('0x4a')]);_0x539c43[_0xe2da('0x4b')]=qs[_0xe2da('0x4c')](_[_0xe2da('0x59')](_0x3a6bf4['query'],_0x3f0e80[_0xe2da('0x4c')]));if(_0x3a6bf4[_0xe2da('0x41')]['filter']){_0x539c43[_0xe2da('0x4b')]=_['merge'](_0x539c43['where'],{'$or':_['map'](_0x539c43[_0xe2da('0x45')],function(_0x69d108){var _0x5f5cca={};_0x5f5cca[_0x69d108]={'$like':'%'+_0x3a6bf4[_0xe2da('0x41')]['filter']+'%'};return _0x5f5cca;})});}_0x539c43=_[_0xe2da('0x54')]({},_0x539c43,_0x3a6bf4[_0xe2da('0x50')]);return _0x23daa8[_0xe2da('0x5d')](_0x539c43);}})[_0xe2da('0x34')](function(_0x3e81e8){if(_0x3e81e8){_0x20bf30=_0x3e81e8[_0xe2da('0x46')];if(!_0x3a6bf4[_0xe2da('0x41')]['hasOwnProperty']('nolimit')){_0x539c43[_0xe2da('0x2c')]=qs[_0xe2da('0x2c')](_0x3a6bf4[_0xe2da('0x41')][_0xe2da('0x2c')]);_0x539c43['offset']=qs[_0xe2da('0x2a')](_0x3a6bf4['query'][_0xe2da('0x2a')]);}return _0x23daa8[_0xe2da('0x5d')](_0x539c43);}})[_0xe2da('0x34')](function(_0x15fabb){if(_0x15fabb){return _0x15fabb?{'count':_0x20bf30,'rows':_0x15fabb}:null;}})[_0xe2da('0x34')](respondWithResult(_0x6b5a99,null))[_0xe2da('0x26')](handleError(_0x6b5a99,null));}; \ No newline at end of file +var _0xcb06=['error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','stack','name','map','SugarcrmConfiguration','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','include','findAll','show','params','rawAttributes','includeAll','find','create','body','update','destroy','getFields','findOne','getSubjects','getDescriptions','SugarcrmField','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0xcb06,0x145));var _0x6cb0=function(_0x1a3ca2,_0xe144e7){_0x1a3ca2=_0x1a3ca2-0x0;var _0x30ea08=_0xcb06[_0x1a3ca2];return _0x30ea08;};'use strict';var emlformat=require(_0x6cb0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6cb0('0x1'));var rp=require('request-promise');var moment=require(_0x6cb0('0x2'));var BPromise=require(_0x6cb0('0x3'));var Mustache=require(_0x6cb0('0x4'));var util=require(_0x6cb0('0x5'));var path=require(_0x6cb0('0x6'));var sox=require(_0x6cb0('0x7'));var csv=require(_0x6cb0('0x8'));var ejs=require(_0x6cb0('0x9'));var fs=require('fs');var fs_extra=require(_0x6cb0('0xa'));var _=require('lodash');var squel=require(_0x6cb0('0xb'));var crypto=require(_0x6cb0('0xc'));var jsforce=require(_0x6cb0('0xd'));var deskjs=require(_0x6cb0('0xe'));var toCsv=require(_0x6cb0('0x8'));var querystring=require(_0x6cb0('0xf'));var Papa=require(_0x6cb0('0x10'));var Redis=require(_0x6cb0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6cb0('0x12'));var hardwareService=require(_0x6cb0('0x13'));var logger=require('../../config/logger')(_0x6cb0('0x14'));var utils=require(_0x6cb0('0x15'));var config=require(_0x6cb0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6cb0('0x17'))['db'];var jayson=require(_0x6cb0('0x18'));var client=jayson[_0x6cb0('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c4c34,_0x5765a4,_0x49dd76,_0x3db375){return new BPromise(function(_0x43ca66,_0x51c585){var _0x5760db=_0x3db375||client;return _0x5760db['request'](_0x1c4c34,_0x49dd76)[_0x6cb0('0x1a')](function(_0x4a0def){logger[_0x6cb0('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5765a4,_0x6cb0('0x1c'));logger[_0x6cb0('0x1d')](_0x6cb0('0x1e'),_0x5765a4,_0x6cb0('0x1c'),JSON['stringify'](_0x4a0def));if(_0x4a0def['error']){if(_0x4a0def[_0x6cb0('0x1f')]['code']===0x1f4){logger[_0x6cb0('0x1f')](_0x6cb0('0x20'),_0x5765a4,_0x4a0def[_0x6cb0('0x1f')][_0x6cb0('0x21')]);return _0x51c585(_0x4a0def['error'][_0x6cb0('0x21')]);}logger[_0x6cb0('0x1f')](_0x6cb0('0x20'),_0x5765a4,_0x4a0def['error'][_0x6cb0('0x21')]);return _0x43ca66(_0x4a0def[_0x6cb0('0x1f')][_0x6cb0('0x21')]);}else{logger['info'](_0x6cb0('0x20'),_0x5765a4,'request\x20sent');_0x43ca66(_0x4a0def[_0x6cb0('0x22')]['message']);}})[_0x6cb0('0x23')](function(_0x422d3d){logger[_0x6cb0('0x1f')](_0x6cb0('0x20'),_0x5765a4,_0x422d3d);_0x51c585(_0x422d3d);});});}function respondWithStatusCode(_0x265538,_0x3f5324){_0x3f5324=_0x3f5324||0xcc;return function(_0x56d5f6){if(_0x56d5f6){return _0x265538[_0x6cb0('0x24')](_0x3f5324);}return _0x265538[_0x6cb0('0x25')](_0x3f5324)[_0x6cb0('0x26')]();};}function respondWithResult(_0x2390e4,_0x455736){_0x455736=_0x455736||0xc8;return function(_0x5e0eb9){if(_0x5e0eb9){return _0x2390e4[_0x6cb0('0x25')](_0x455736)[_0x6cb0('0x27')](_0x5e0eb9);}};}function respondWithFilteredResult(_0x44be89,_0x34c40d){return function(_0x45527f){if(_0x45527f){var _0x3033ef=typeof _0x34c40d[_0x6cb0('0x28')]==='undefined'&&typeof _0x34c40d['limit']===_0x6cb0('0x29');var _0x7fc6e=_0x45527f['count'];var _0x4037e3=_0x3033ef?0x0:_0x34c40d[_0x6cb0('0x28')];var _0x3e8ab8=_0x3033ef?_0x45527f['count']:_0x34c40d[_0x6cb0('0x28')]+_0x34c40d[_0x6cb0('0x2a')];var _0x23212b;if(_0x3e8ab8>=_0x7fc6e){_0x3e8ab8=_0x7fc6e;_0x23212b=0xc8;}else{_0x23212b=0xce;}_0x44be89[_0x6cb0('0x25')](_0x23212b);return _0x44be89[_0x6cb0('0x2b')]('Content-Range',_0x4037e3+'-'+_0x3e8ab8+'/'+_0x7fc6e)[_0x6cb0('0x27')](_0x45527f);}return null;};}function patchUpdates(_0x329fe4){return function(_0x1b5d96){try{jsonpatch[_0x6cb0('0x2c')](_0x1b5d96,_0x329fe4,!![]);}catch(_0x4db3eb){return BPromise[_0x6cb0('0x2d')](_0x4db3eb);}return _0x1b5d96[_0x6cb0('0x2e')]();};}function saveUpdates(_0x53f439,_0x17094e){return function(_0x45f8e3){if(_0x45f8e3){return _0x45f8e3['update'](_0x53f439)[_0x6cb0('0x1a')](function(_0x47d952){return _0x47d952;});}return null;};}function removeEntity(_0x2330da,_0x3067d4){return function(_0x38abf8){if(_0x38abf8){return _0x38abf8['destroy']()[_0x6cb0('0x1a')](function(){_0x2330da[_0x6cb0('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f271e,_0x211970){return function(_0x22c395){if(!_0x22c395){_0x4f271e[_0x6cb0('0x24')](0x194);}return _0x22c395;};}function handleError(_0x48fcfd,_0x531673){_0x531673=_0x531673||0x1f4;return function(_0x74778b){logger[_0x6cb0('0x1f')](_0x74778b[_0x6cb0('0x2f')]);if(_0x74778b[_0x6cb0('0x30')]){delete _0x74778b['name'];}_0x48fcfd[_0x6cb0('0x25')](_0x531673)['send'](_0x74778b);};}exports['index']=function(_0xf7945d,_0x19de75){var _0x171c71={},_0x4866f0={},_0x2d1e0c={'count':0x0,'rows':[]};var _0x332813=_[_0x6cb0('0x31')](db[_0x6cb0('0x32')]['rawAttributes'],function(_0x3849a2){return{'name':_0x3849a2[_0x6cb0('0x33')],'type':_0x3849a2[_0x6cb0('0x34')][_0x6cb0('0x35')]};});_0x4866f0[_0x6cb0('0x36')]=_[_0x6cb0('0x31')](_0x332813,_0x6cb0('0x30'));_0x4866f0['query']=_[_0x6cb0('0x37')](_0xf7945d['query']);_0x4866f0[_0x6cb0('0x38')]=_[_0x6cb0('0x39')](_0x4866f0[_0x6cb0('0x36')],_0x4866f0[_0x6cb0('0x3a')]);_0x171c71['attributes']=_['intersection'](_0x4866f0[_0x6cb0('0x36')],qs[_0x6cb0('0x3b')](_0xf7945d[_0x6cb0('0x3a')]['fields']));_0x171c71['attributes']=_0x171c71[_0x6cb0('0x3c')][_0x6cb0('0x3d')]?_0x171c71[_0x6cb0('0x3c')]:_0x4866f0['model'];if(!_0xf7945d['query'][_0x6cb0('0x3e')](_0x6cb0('0x3f'))){_0x171c71['limit']=qs[_0x6cb0('0x2a')](_0xf7945d[_0x6cb0('0x3a')][_0x6cb0('0x2a')]);_0x171c71[_0x6cb0('0x28')]=qs[_0x6cb0('0x28')](_0xf7945d[_0x6cb0('0x3a')][_0x6cb0('0x28')]);}_0x171c71[_0x6cb0('0x40')]=qs[_0x6cb0('0x41')](_0xf7945d['query']['sort']);_0x171c71['where']=qs[_0x6cb0('0x38')](_[_0x6cb0('0x42')](_0xf7945d[_0x6cb0('0x3a')],_0x4866f0[_0x6cb0('0x38')]),_0x332813);if(_0xf7945d[_0x6cb0('0x3a')]['filter']){_0x171c71[_0x6cb0('0x43')]=_[_0x6cb0('0x44')](_0x171c71[_0x6cb0('0x43')],{'$or':_['map'](_0x332813,function(_0x440898){if(_0x440898[_0x6cb0('0x34')]!==_0x6cb0('0x45')){var _0x380b9e={};_0x380b9e[_0x440898[_0x6cb0('0x30')]]={'$like':'%'+_0xf7945d[_0x6cb0('0x3a')][_0x6cb0('0x46')]+'%'};return _0x380b9e;}})});}_0x171c71=_['merge']({},_0x171c71,_0xf7945d[_0x6cb0('0x47')]);var _0x1008a5={'where':_0x171c71[_0x6cb0('0x43')]};return db[_0x6cb0('0x32')][_0x6cb0('0x48')](_0x1008a5)[_0x6cb0('0x1a')](function(_0x1fccca){_0x2d1e0c[_0x6cb0('0x48')]=_0x1fccca;if(_0xf7945d[_0x6cb0('0x3a')]['includeAll']){_0x171c71[_0x6cb0('0x49')]=[{'all':!![]}];}return db[_0x6cb0('0x32')][_0x6cb0('0x4a')](_0x171c71);})[_0x6cb0('0x1a')](function(_0x25a740){_0x2d1e0c['rows']=_0x25a740;return _0x2d1e0c;})[_0x6cb0('0x1a')](respondWithFilteredResult(_0x19de75,_0x171c71))[_0x6cb0('0x23')](handleError(_0x19de75,null));};exports[_0x6cb0('0x4b')]=function(_0x3b7dc9,_0x4b6b5e){var _0x5685dc={'raw':![],'where':{'id':_0x3b7dc9[_0x6cb0('0x4c')]['id']}},_0x519841={};_0x519841['model']=_['keys'](db[_0x6cb0('0x32')][_0x6cb0('0x4d')]);_0x519841['query']=_[_0x6cb0('0x37')](_0x3b7dc9[_0x6cb0('0x3a')]);_0x519841[_0x6cb0('0x38')]=_[_0x6cb0('0x39')](_0x519841[_0x6cb0('0x36')],_0x519841['query']);_0x5685dc[_0x6cb0('0x3c')]=_[_0x6cb0('0x39')](_0x519841[_0x6cb0('0x36')],qs['fields'](_0x3b7dc9[_0x6cb0('0x3a')]['fields']));_0x5685dc[_0x6cb0('0x3c')]=_0x5685dc[_0x6cb0('0x3c')][_0x6cb0('0x3d')]?_0x5685dc[_0x6cb0('0x3c')]:_0x519841[_0x6cb0('0x36')];if(_0x3b7dc9['query'][_0x6cb0('0x4e')]){_0x5685dc['include']=[{'all':!![]}];}_0x5685dc=_[_0x6cb0('0x44')]({},_0x5685dc,_0x3b7dc9[_0x6cb0('0x47')]);return db[_0x6cb0('0x32')][_0x6cb0('0x4f')](_0x5685dc)['then'](handleEntityNotFound(_0x4b6b5e,null))['then'](respondWithResult(_0x4b6b5e,null))[_0x6cb0('0x23')](handleError(_0x4b6b5e,null));};exports[_0x6cb0('0x50')]=function(_0x1cbf30,_0x31a9ac){return db[_0x6cb0('0x32')][_0x6cb0('0x50')](_0x1cbf30[_0x6cb0('0x51')],{})[_0x6cb0('0x1a')](respondWithResult(_0x31a9ac,0xc9))[_0x6cb0('0x23')](handleError(_0x31a9ac,null));};exports[_0x6cb0('0x52')]=function(_0x571174,_0xd5880d){if(_0x571174[_0x6cb0('0x51')]['id']){delete _0x571174[_0x6cb0('0x51')]['id'];}return db[_0x6cb0('0x32')][_0x6cb0('0x4f')]({'where':{'id':_0x571174[_0x6cb0('0x4c')]['id']}})[_0x6cb0('0x1a')](handleEntityNotFound(_0xd5880d,null))[_0x6cb0('0x1a')](saveUpdates(_0x571174[_0x6cb0('0x51')],null))[_0x6cb0('0x1a')](respondWithResult(_0xd5880d,null))[_0x6cb0('0x23')](handleError(_0xd5880d,null));};exports[_0x6cb0('0x53')]=function(_0x5dde29,_0x574526){return db['SugarcrmConfiguration'][_0x6cb0('0x4f')]({'where':{'id':_0x5dde29['params']['id']}})['then'](handleEntityNotFound(_0x574526,null))['then'](removeEntity(_0x574526,null))[_0x6cb0('0x23')](handleError(_0x574526,null));};exports[_0x6cb0('0x54')]=function(_0x39646c,_0x122c68,_0x548e77){var _0x248fef={};var _0x1d3c89={};var _0x1c640a;var _0x3c2a14;return db[_0x6cb0('0x32')][_0x6cb0('0x55')]({'where':{'id':_0x39646c[_0x6cb0('0x4c')]['id']}})[_0x6cb0('0x1a')](handleEntityNotFound(_0x122c68,null))[_0x6cb0('0x1a')](function(_0x4ef5c7){if(_0x4ef5c7){_0x1c640a=_0x4ef5c7;_0x1d3c89[_0x6cb0('0x36')]=_['keys'](db['SugarcrmField'][_0x6cb0('0x4d')]);_0x1d3c89[_0x6cb0('0x3a')]=_[_0x6cb0('0x37')](_0x39646c[_0x6cb0('0x3a')]);_0x1d3c89['filters']=_[_0x6cb0('0x39')](_0x1d3c89['model'],_0x1d3c89['query']);_0x248fef[_0x6cb0('0x3c')]=_[_0x6cb0('0x39')](_0x1d3c89[_0x6cb0('0x36')],qs['fields'](_0x39646c[_0x6cb0('0x3a')]['fields']));_0x248fef[_0x6cb0('0x3c')]=_0x248fef[_0x6cb0('0x3c')]['length']?_0x248fef['attributes']:_0x1d3c89[_0x6cb0('0x36')];_0x248fef[_0x6cb0('0x40')]=qs[_0x6cb0('0x41')](_0x39646c[_0x6cb0('0x3a')]['sort']);_0x248fef[_0x6cb0('0x43')]=qs[_0x6cb0('0x38')](_['pick'](_0x39646c[_0x6cb0('0x3a')],_0x1d3c89[_0x6cb0('0x38')]));if(_0x39646c[_0x6cb0('0x3a')]['filter']){_0x248fef[_0x6cb0('0x43')]=_[_0x6cb0('0x44')](_0x248fef[_0x6cb0('0x43')],{'$or':_['map'](_0x248fef['attributes'],function(_0x587373){var _0x2bda0b={};_0x2bda0b[_0x587373]={'$like':'%'+_0x39646c[_0x6cb0('0x3a')]['filter']+'%'};return _0x2bda0b;})});}_0x248fef=_[_0x6cb0('0x44')]({},_0x248fef,_0x39646c['options']);return _0x1c640a[_0x6cb0('0x54')](_0x248fef);}})[_0x6cb0('0x1a')](function(_0x44ebb9){if(_0x44ebb9){_0x3c2a14=_0x44ebb9['length'];if(!_0x39646c['query'][_0x6cb0('0x3e')](_0x6cb0('0x3f'))){_0x248fef[_0x6cb0('0x2a')]=qs[_0x6cb0('0x2a')](_0x39646c[_0x6cb0('0x3a')][_0x6cb0('0x2a')]);_0x248fef['offset']=qs[_0x6cb0('0x28')](_0x39646c[_0x6cb0('0x3a')][_0x6cb0('0x28')]);}return _0x1c640a[_0x6cb0('0x54')](_0x248fef);}})[_0x6cb0('0x1a')](function(_0x5dcd69){if(_0x5dcd69){return _0x5dcd69?{'count':_0x3c2a14,'rows':_0x5dcd69}:null;}})[_0x6cb0('0x1a')](respondWithResult(_0x122c68,null))['catch'](handleError(_0x122c68,null));};exports[_0x6cb0('0x56')]=function(_0x3457b3,_0x408f05,_0x2e44f8){var _0x16a573={};var _0x13ca61={};var _0x49ca4a;var _0x5cbfc8;return db[_0x6cb0('0x32')][_0x6cb0('0x55')]({'where':{'id':_0x3457b3[_0x6cb0('0x4c')]['id']}})[_0x6cb0('0x1a')](handleEntityNotFound(_0x408f05,null))[_0x6cb0('0x1a')](function(_0x3e7060){if(_0x3e7060){_0x49ca4a=_0x3e7060;_0x13ca61[_0x6cb0('0x36')]=_[_0x6cb0('0x37')](db['SugarcrmField'][_0x6cb0('0x4d')]);_0x13ca61[_0x6cb0('0x3a')]=_[_0x6cb0('0x37')](_0x3457b3[_0x6cb0('0x3a')]);_0x13ca61[_0x6cb0('0x38')]=_['intersection'](_0x13ca61['model'],_0x13ca61[_0x6cb0('0x3a')]);_0x16a573['attributes']=_['intersection'](_0x13ca61[_0x6cb0('0x36')],qs['fields'](_0x3457b3[_0x6cb0('0x3a')][_0x6cb0('0x3b')]));_0x16a573['attributes']=_0x16a573[_0x6cb0('0x3c')]['length']?_0x16a573[_0x6cb0('0x3c')]:_0x13ca61[_0x6cb0('0x36')];_0x16a573[_0x6cb0('0x40')]=qs[_0x6cb0('0x41')](_0x3457b3[_0x6cb0('0x3a')][_0x6cb0('0x41')]);_0x16a573['where']=qs[_0x6cb0('0x38')](_[_0x6cb0('0x42')](_0x3457b3[_0x6cb0('0x3a')],_0x13ca61[_0x6cb0('0x38')]));if(_0x3457b3[_0x6cb0('0x3a')][_0x6cb0('0x46')]){_0x16a573[_0x6cb0('0x43')]=_[_0x6cb0('0x44')](_0x16a573[_0x6cb0('0x43')],{'$or':_[_0x6cb0('0x31')](_0x16a573[_0x6cb0('0x3c')],function(_0x3a6dfe){var _0x278cfb={};_0x278cfb[_0x3a6dfe]={'$like':'%'+_0x3457b3[_0x6cb0('0x3a')][_0x6cb0('0x46')]+'%'};return _0x278cfb;})});}_0x16a573=_['merge']({},_0x16a573,_0x3457b3[_0x6cb0('0x47')]);return _0x49ca4a[_0x6cb0('0x56')](_0x16a573);}})[_0x6cb0('0x1a')](function(_0x412340){if(_0x412340){_0x5cbfc8=_0x412340['length'];if(!_0x3457b3[_0x6cb0('0x3a')][_0x6cb0('0x3e')](_0x6cb0('0x3f'))){_0x16a573[_0x6cb0('0x2a')]=qs[_0x6cb0('0x2a')](_0x3457b3[_0x6cb0('0x3a')]['limit']);_0x16a573['offset']=qs[_0x6cb0('0x28')](_0x3457b3['query']['offset']);}return _0x49ca4a[_0x6cb0('0x56')](_0x16a573);}})[_0x6cb0('0x1a')](function(_0x40a23a){if(_0x40a23a){return _0x40a23a?{'count':_0x5cbfc8,'rows':_0x40a23a}:null;}})[_0x6cb0('0x1a')](respondWithResult(_0x408f05,null))[_0x6cb0('0x23')](handleError(_0x408f05,null));};exports[_0x6cb0('0x57')]=function(_0x5797e4,_0x49b760,_0x39225f){var _0x38355c={};var _0x3a676b={};var _0x373687;var _0x286e99;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x5797e4['params']['id']}})[_0x6cb0('0x1a')](handleEntityNotFound(_0x49b760,null))['then'](function(_0x3329fc){if(_0x3329fc){_0x373687=_0x3329fc;_0x3a676b['model']=_[_0x6cb0('0x37')](db[_0x6cb0('0x58')]['rawAttributes']);_0x3a676b[_0x6cb0('0x3a')]=_[_0x6cb0('0x37')](_0x5797e4[_0x6cb0('0x3a')]);_0x3a676b['filters']=_['intersection'](_0x3a676b['model'],_0x3a676b[_0x6cb0('0x3a')]);_0x38355c[_0x6cb0('0x3c')]=_[_0x6cb0('0x39')](_0x3a676b[_0x6cb0('0x36')],qs[_0x6cb0('0x3b')](_0x5797e4[_0x6cb0('0x3a')][_0x6cb0('0x3b')]));_0x38355c[_0x6cb0('0x3c')]=_0x38355c['attributes']['length']?_0x38355c[_0x6cb0('0x3c')]:_0x3a676b[_0x6cb0('0x36')];_0x38355c[_0x6cb0('0x40')]=qs[_0x6cb0('0x41')](_0x5797e4[_0x6cb0('0x3a')][_0x6cb0('0x41')]);_0x38355c[_0x6cb0('0x43')]=qs[_0x6cb0('0x38')](_[_0x6cb0('0x42')](_0x5797e4[_0x6cb0('0x3a')],_0x3a676b[_0x6cb0('0x38')]));if(_0x5797e4[_0x6cb0('0x3a')][_0x6cb0('0x46')]){_0x38355c[_0x6cb0('0x43')]=_[_0x6cb0('0x44')](_0x38355c[_0x6cb0('0x43')],{'$or':_['map'](_0x38355c[_0x6cb0('0x3c')],function(_0x56137b){var _0x2c6795={};_0x2c6795[_0x56137b]={'$like':'%'+_0x5797e4[_0x6cb0('0x3a')]['filter']+'%'};return _0x2c6795;})});}_0x38355c=_[_0x6cb0('0x44')]({},_0x38355c,_0x5797e4[_0x6cb0('0x47')]);return _0x373687[_0x6cb0('0x57')](_0x38355c);}})[_0x6cb0('0x1a')](function(_0x28988f){if(_0x28988f){_0x286e99=_0x28988f[_0x6cb0('0x3d')];if(!_0x5797e4[_0x6cb0('0x3a')][_0x6cb0('0x3e')](_0x6cb0('0x3f'))){_0x38355c['limit']=qs[_0x6cb0('0x2a')](_0x5797e4[_0x6cb0('0x3a')][_0x6cb0('0x2a')]);_0x38355c[_0x6cb0('0x28')]=qs[_0x6cb0('0x28')](_0x5797e4['query'][_0x6cb0('0x28')]);}return _0x373687['getDescriptions'](_0x38355c);}})[_0x6cb0('0x1a')](function(_0x57c543){if(_0x57c543){return _0x57c543?{'count':_0x286e99,'rows':_0x57c543}:null;}})[_0x6cb0('0x1a')](respondWithResult(_0x49b760,null))['catch'](handleError(_0x49b760,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 3dd018e..329c00c 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 _0x86d9=['request-promise','path','rimraf','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x50dccc,_0x268d91){var _0x249167=function(_0x536417){while(--_0x536417){_0x50dccc['push'](_0x50dccc['shift']());}};_0x249167(++_0x268d91);}(_0x86d9,0x7c));var _0x986d=function(_0x9e9a80,_0x2ce689){_0x9e9a80=_0x9e9a80-0x0;var _0x473f6d=_0x86d9[_0x9e9a80];return _0x473f6d;};'use strict';var _=require(_0x986d('0x0'));var util=require(_0x986d('0x1'));var logger=require(_0x986d('0x2'))(_0x986d('0x3'));var moment=require(_0x986d('0x4'));var BPromise=require(_0x986d('0x5'));var rp=require(_0x986d('0x6'));var fs=require('fs');var path=require(_0x986d('0x7'));var rimraf=require(_0x986d('0x8'));var config=require(_0x986d('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x986d('0xa')]=function(_0x26c05b,_0x31dbde){return _0x26c05b['define'](_0x986d('0xb'),attributes,{'tableName':_0x986d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ebe=['int_sugarcrm_configurations','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x42a5cd,_0x502cdd){var _0x523008=function(_0x1047bb){while(--_0x1047bb){_0x42a5cd['push'](_0x42a5cd['shift']());}};_0x523008(++_0x502cdd);}(_0x4ebe,0x145));var _0xe4eb=function(_0x1e555e,_0x54f2e1){_0x1e555e=_0x1e555e-0x0;var _0x4deb62=_0x4ebe[_0x1e555e];return _0x4deb62;};'use strict';var _=require(_0xe4eb('0x0'));var util=require('util');var logger=require(_0xe4eb('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe4eb('0x2'));var rp=require(_0xe4eb('0x3'));var fs=require('fs');var path=require(_0xe4eb('0x4'));var rimraf=require(_0xe4eb('0x5'));var config=require(_0xe4eb('0x6'));var attributes=require(_0xe4eb('0x7'));module[_0xe4eb('0x8')]=function(_0x4d4a4a,_0x47ac70){return _0x4d4a4a[_0xe4eb('0x9')](_0xe4eb('0xa'),attributes,{'tableName':_0xe4eb('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 e3ba4f6..860e5f6 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 _0x3826=['request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x6c75da,_0x1b96d6){var _0x5f5d21=function(_0x5ef793){while(--_0x5ef793){_0x6c75da['push'](_0x6c75da['shift']());}};_0x5f5d21(++_0x1b96d6);}(_0x3826,0x95));var _0x6382=function(_0x5d57c7,_0x3547be){_0x5d57c7=_0x5d57c7-0x0;var _0x2ee0ee=_0x3826[_0x5d57c7];return _0x2ee0ee;};'use strict';var _=require(_0x6382('0x0'));var util=require(_0x6382('0x1'));var moment=require(_0x6382('0x2'));var BPromise=require(_0x6382('0x3'));var rs=require(_0x6382('0x4'));var fs=require('fs');var Redis=require(_0x6382('0x5'));var db=require(_0x6382('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6382('0x7'))(_0x6382('0x8'));var config=require(_0x6382('0x9'));var jayson=require(_0x6382('0xa'));var client=jayson['client'][_0x6382('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a5488,_0x3f60e3,_0x1523a9){return new BPromise(function(_0x3a81ae,_0x958e7d){return client[_0x6382('0xc')](_0x8a5488,_0x1523a9)['then'](function(_0x324687){logger[_0x6382('0xd')](_0x6382('0xe'),_0x3f60e3,_0x6382('0xf'));logger['debug'](_0x6382('0x10'),_0x3f60e3,_0x6382('0xf'),JSON[_0x6382('0x11')](_0x324687));if(_0x324687['error']){if(_0x324687[_0x6382('0x12')][_0x6382('0x13')]===0x1f4){logger[_0x6382('0x12')](_0x6382('0xe'),_0x3f60e3,_0x324687['error'][_0x6382('0x14')]);return _0x958e7d(_0x324687[_0x6382('0x12')]['message']);}logger[_0x6382('0x12')](_0x6382('0xe'),_0x3f60e3,_0x324687[_0x6382('0x12')][_0x6382('0x14')]);return _0x3a81ae(_0x324687[_0x6382('0x12')][_0x6382('0x14')]);}else{logger[_0x6382('0xd')](_0x6382('0xe'),_0x3f60e3,_0x6382('0xf'));_0x3a81ae(_0x324687[_0x6382('0x15')][_0x6382('0x14')]);}})[_0x6382('0x16')](function(_0x4da1ac){logger['error'](_0x6382('0xe'),_0x3f60e3,_0x4da1ac);_0x958e7d(_0x4da1ac);});});} \ No newline at end of file +var _0xcf83=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1cf870,_0x5f172d){var _0x439018=function(_0x4e0f93){while(--_0x4e0f93){_0x1cf870['push'](_0x1cf870['shift']());}};_0x439018(++_0x5f172d);}(_0xcf83,0xaa));var _0x3cf8=function(_0x3d6987,_0x3dd21c){_0x3d6987=_0x3d6987-0x0;var _0x3bb47=_0xcf83[_0x3d6987];return _0x3bb47;};'use strict';var _=require(_0x3cf8('0x0'));var util=require(_0x3cf8('0x1'));var moment=require(_0x3cf8('0x2'));var BPromise=require(_0x3cf8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cf8('0x4'));var db=require(_0x3cf8('0x5'))['db'];var utils=require(_0x3cf8('0x6'));var logger=require(_0x3cf8('0x7'))('rpc');var config=require(_0x3cf8('0x8'));var jayson=require(_0x3cf8('0x9'));var client=jayson[_0x3cf8('0xa')][_0x3cf8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x460ac6,_0x431873,_0x222647){return new BPromise(function(_0xbfa63e,_0x562dd8){return client[_0x3cf8('0xc')](_0x460ac6,_0x222647)[_0x3cf8('0xd')](function(_0x2305ae){logger[_0x3cf8('0xe')](_0x3cf8('0xf'),_0x431873,_0x3cf8('0x10'));logger[_0x3cf8('0x11')](_0x3cf8('0x12'),_0x431873,_0x3cf8('0x10'),JSON[_0x3cf8('0x13')](_0x2305ae));if(_0x2305ae[_0x3cf8('0x14')]){if(_0x2305ae['error'][_0x3cf8('0x15')]===0x1f4){logger[_0x3cf8('0x14')](_0x3cf8('0xf'),_0x431873,_0x2305ae[_0x3cf8('0x14')][_0x3cf8('0x16')]);return _0x562dd8(_0x2305ae[_0x3cf8('0x14')][_0x3cf8('0x16')]);}logger[_0x3cf8('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x431873,_0x2305ae['error']['message']);return _0xbfa63e(_0x2305ae[_0x3cf8('0x14')]['message']);}else{logger[_0x3cf8('0xe')](_0x3cf8('0xf'),_0x431873,_0x3cf8('0x10'));_0xbfa63e(_0x2305ae[_0x3cf8('0x17')]['message']);}})['catch'](function(_0x39272a){logger['error'](_0x3cf8('0xf'),_0x431873,_0x39272a);_0x562dd8(_0x39272a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 974269c..1fa45b3 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 _0xc1e8=['index','/:id','show','post','isAuthenticated','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xc1e8,0x87));var _0x8c1e=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xc1e8[_0x12d812];return _0x3711ab;};'use strict';var multer=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var path=require(_0x8c1e('0x2'));var timeout=require(_0x8c1e('0x3'));var express=require(_0x8c1e('0x4'));var router=express[_0x8c1e('0x5')]();var fs_extra=require(_0x8c1e('0x6'));var auth=require(_0x8c1e('0x7'));var interaction=require(_0x8c1e('0x8'));var config=require(_0x8c1e('0x9'));var controller=require(_0x8c1e('0xa'));router[_0x8c1e('0xb')]('/',auth['isAuthenticated'](),controller[_0x8c1e('0xc')]);router[_0x8c1e('0xb')](_0x8c1e('0xd'),auth['isAuthenticated'](),controller[_0x8c1e('0xe')]);router[_0x8c1e('0xf')]('/',auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x11')]);router[_0x8c1e('0x12')]('/:id',auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8c1e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x78f5=['isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','/:id'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x78f5,0xbc));var _0x578f=function(_0x3d9740,_0x32dd79){_0x3d9740=_0x3d9740-0x0;var _0x58b687=_0x78f5[_0x3d9740];return _0x58b687;};'use strict';var multer=require(_0x578f('0x0'));var util=require(_0x578f('0x1'));var path=require(_0x578f('0x2'));var timeout=require(_0x578f('0x3'));var express=require(_0x578f('0x4'));var router=express[_0x578f('0x5')]();var fs_extra=require(_0x578f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x578f('0x7'));var config=require(_0x578f('0x8'));var controller=require(_0x578f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x578f('0xa')]);router['get'](_0x578f('0xb'),auth[_0x578f('0xc')](),controller[_0x578f('0xd')]);router[_0x578f('0xe')]('/',auth[_0x578f('0xc')](),controller['create']);router[_0x578f('0xf')](_0x578f('0xb'),auth[_0x578f('0xc')](),controller[_0x578f('0x10')]);router[_0x578f('0x11')](_0x578f('0xb'),auth[_0x578f('0xc')](),controller[_0x578f('0x12')]);module[_0x578f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1a5cbe9..82453a9 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 _0x19ea=['variable','BOOLEAN','sequelize','string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x403c23,_0x36d1ad){var _0x23f3ce=function(_0x510da5){while(--_0x510da5){_0x403c23['push'](_0x403c23['shift']());}};_0x23f3ce(++_0x36d1ad);}(_0x19ea,0xfe));var _0xa19e=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x19ea[_0x4e4f0e];return _0x1a7219;};'use strict';var Sequelize=require(_0xa19e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa19e('0x1'),'variable',_0xa19e('0x2'),_0xa19e('0x3'),_0xa19e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa19e('0x5')]},'keyType':{'type':Sequelize[_0xa19e('0x6')](_0xa19e('0x1'),_0xa19e('0x7'),_0xa19e('0x2'))},'keyContent':{'type':Sequelize[_0xa19e('0x5')]},'idField':{'type':Sequelize[_0xa19e('0x5')]},'nameField':{'type':Sequelize[_0xa19e('0x5')]},'customField':{'type':Sequelize[_0xa19e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa19e('0x5')]}}; \ No newline at end of file +var _0xf120=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xf120,0x179));var _0x0f12=function(_0x9412fc,_0x320b25){_0x9412fc=_0x9412fc-0x0;var _0x1c10e1=_0xf120[_0x9412fc];return _0x1c10e1;};'use strict';var Sequelize=require('sequelize');module[_0x0f12('0x0')]={'type':{'type':Sequelize[_0x0f12('0x1')](_0x0f12('0x2'),'variable',_0x0f12('0x3'),_0x0f12('0x4'),_0x0f12('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0f12('0x6')]},'key':{'type':Sequelize[_0x0f12('0x6')]},'keyType':{'type':Sequelize[_0x0f12('0x1')](_0x0f12('0x2'),_0x0f12('0x7'),_0x0f12('0x3'))},'keyContent':{'type':Sequelize[_0x0f12('0x6')]},'idField':{'type':Sequelize[_0x0f12('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0f12('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4fd0078..a38e841 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 _0xedd9=['key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','SugarcrmField','rawAttributes','fieldName','type'];(function(_0x5cc8b5,_0x592249){var _0x4a64f8=function(_0x1fd7b2){while(--_0x1fd7b2){_0x5cc8b5['push'](_0x5cc8b5['shift']());}};_0x4a64f8(++_0x592249);}(_0xedd9,0xfc));var _0x9edd=function(_0x18f27e,_0x4cee11){_0x18f27e=_0x18f27e-0x0;var _0x59a719=_0xedd9[_0x18f27e];return _0x59a719;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['SugarcrmField'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['SugarcrmField'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['SugarcrmField'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));}; \ No newline at end of file +var _0x49e9=['status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','SugarcrmField','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x1185b3,_0x29e07b){return function(_0x255b11){if(!_0x255b11){_0x1185b3[_0x949e('0x18')](0x194);}return _0x255b11;};}function handleError(_0x20258c,_0x5dcc46){_0x5dcc46=_0x5dcc46||0x1f4;return function(_0x212224){logger[_0x949e('0x27')](_0x212224['stack']);if(_0x212224[_0x949e('0x28')]){delete _0x212224[_0x949e('0x28')];}_0x20258c['status'](_0x5dcc46)[_0x949e('0x29')](_0x212224);};}exports[_0x949e('0x2a')]=function(_0x5b9f28,_0x1867d9){var _0x5b2b0b={},_0x5e6e34={},_0x4e169d={'count':0x0,'rows':[]};var _0x54ad5d=_['map'](db[_0x949e('0x2b')][_0x949e('0x2c')],function(_0x3051ec){return{'name':_0x3051ec['fieldName'],'type':_0x3051ec['type']['key']};});_0x5e6e34['model']=_[_0x949e('0x2d')](_0x54ad5d,_0x949e('0x28'));_0x5e6e34[_0x949e('0x2e')]=_[_0x949e('0x2f')](_0x5b9f28['query']);_0x5e6e34[_0x949e('0x30')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],_0x5e6e34['query']);_0x5b2b0b[_0x949e('0x33')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],qs['fields'](_0x5b9f28['query'][_0x949e('0x34')]));_0x5b2b0b[_0x949e('0x33')]=_0x5b2b0b[_0x949e('0x33')][_0x949e('0x35')]?_0x5b2b0b['attributes']:_0x5e6e34[_0x949e('0x32')];if(!_0x5b9f28[_0x949e('0x2e')][_0x949e('0x36')](_0x949e('0x37'))){_0x5b2b0b[_0x949e('0x1c')]=qs[_0x949e('0x1c')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x1c')]);_0x5b2b0b['offset']=qs['offset'](_0x5b9f28[_0x949e('0x2e')]['offset']);}_0x5b2b0b['order']=qs[_0x949e('0x38')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x38')]);_0x5b2b0b[_0x949e('0x39')]=qs[_0x949e('0x30')](_[_0x949e('0x3a')](_0x5b9f28[_0x949e('0x2e')],_0x5e6e34[_0x949e('0x30')]),_0x54ad5d);if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3b')]){_0x5b2b0b[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5b2b0b[_0x949e('0x39')],{'$or':_[_0x949e('0x2d')](_0x54ad5d,function(_0x26ad2b){if(_0x26ad2b[_0x949e('0x3d')]!==_0x949e('0x3e')){var _0x498fa3={};_0x498fa3[_0x26ad2b[_0x949e('0x28')]]={'$like':'%'+_0x5b9f28['query'][_0x949e('0x3b')]+'%'};return _0x498fa3;}})});}_0x5b2b0b=_[_0x949e('0x3c')]({},_0x5b2b0b,_0x5b9f28['options']);var _0x5084dc={'where':_0x5b2b0b['where']};return db[_0x949e('0x2b')][_0x949e('0x1d')](_0x5084dc)['then'](function(_0x59c024){_0x4e169d['count']=_0x59c024;if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3f')]){_0x5b2b0b['include']=[{'all':!![]}];}return db[_0x949e('0x2b')][_0x949e('0x40')](_0x5b2b0b);})['then'](function(_0x3a1bc7){_0x4e169d[_0x949e('0x41')]=_0x3a1bc7;return _0x4e169d;})[_0x949e('0x25')](respondWithFilteredResult(_0x1867d9,_0x5b2b0b))[_0x949e('0x42')](handleError(_0x1867d9,null));};exports['show']=function(_0x58b34b,_0x2bca69){var _0x590aa7={'raw':!![],'where':{'id':_0x58b34b[_0x949e('0x43')]['id']}},_0x7201da={};_0x7201da[_0x949e('0x32')]=_[_0x949e('0x2f')](db[_0x949e('0x2b')]['rawAttributes']);_0x7201da['query']=_[_0x949e('0x2f')](_0x58b34b['query']);_0x7201da[_0x949e('0x30')]=_[_0x949e('0x31')](_0x7201da[_0x949e('0x32')],_0x7201da[_0x949e('0x2e')]);_0x590aa7[_0x949e('0x33')]=_[_0x949e('0x31')](_0x7201da['model'],qs['fields'](_0x58b34b[_0x949e('0x2e')][_0x949e('0x34')]));_0x590aa7[_0x949e('0x33')]=_0x590aa7[_0x949e('0x33')][_0x949e('0x35')]?_0x590aa7['attributes']:_0x7201da[_0x949e('0x32')];if(_0x58b34b[_0x949e('0x2e')]['includeAll']){_0x590aa7[_0x949e('0x44')]=[{'all':!![]}];}_0x590aa7=_[_0x949e('0x3c')]({},_0x590aa7,_0x58b34b[_0x949e('0x45')]);return db[_0x949e('0x2b')][_0x949e('0x46')](_0x590aa7)[_0x949e('0x25')](handleEntityNotFound(_0x2bca69,null))[_0x949e('0x25')](respondWithResult(_0x2bca69,null))[_0x949e('0x42')](handleError(_0x2bca69,null));};exports[_0x949e('0x47')]=function(_0x4913f5,_0x1599ea){return db['SugarcrmField'][_0x949e('0x47')](_0x4913f5[_0x949e('0x48')],{})['then'](respondWithResult(_0x1599ea,0xc9))[_0x949e('0x42')](handleError(_0x1599ea,null));};exports[_0x949e('0x49')]=function(_0x121355,_0x2e2b6a){if(_0x121355[_0x949e('0x48')]['id']){delete _0x121355[_0x949e('0x48')]['id'];}return db[_0x949e('0x2b')][_0x949e('0x46')]({'where':{'id':_0x121355['params']['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x2e2b6a,null))[_0x949e('0x25')](saveUpdates(_0x121355[_0x949e('0x48')],null))[_0x949e('0x25')](respondWithResult(_0x2e2b6a,null))[_0x949e('0x42')](handleError(_0x2e2b6a,null));};exports['destroy']=function(_0x5f23b2,_0x46a4fe){return db[_0x949e('0x2b')]['find']({'where':{'id':_0x5f23b2[_0x949e('0x43')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x46a4fe,null))[_0x949e('0x25')](removeEntity(_0x46a4fe,null))[_0x949e('0x42')](handleError(_0x46a4fe,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 14a16ad..09f14a4 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 _0xe531=['moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x2330c9,_0x583368){var _0x2491e2=function(_0x1490aa){while(--_0x1490aa){_0x2330c9['push'](_0x2330c9['shift']());}};_0x2491e2(++_0x583368);}(_0xe531,0x8d));var _0x1e53=function(_0x4d7b8d,_0x57d433){_0x4d7b8d=_0x4d7b8d-0x0;var _0x440892=_0xe531[_0x4d7b8d];return _0x440892;};'use strict';var _=require(_0x1e53('0x0'));var util=require(_0x1e53('0x1'));var logger=require(_0x1e53('0x2'))('api');var moment=require(_0x1e53('0x3'));var BPromise=require(_0x1e53('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e53('0x5'));var rimraf=require(_0x1e53('0x6'));var config=require(_0x1e53('0x7'));var attributes=require(_0x1e53('0x8'));module[_0x1e53('0x9')]=function(_0x4f9325,_0x2d2480){return _0x4f9325[_0x1e53('0xa')](_0x1e53('0xb'),attributes,{'tableName':_0x1e53('0xc'),'paranoid':![],'indexes':[{'name':_0x1e53('0xd'),'fields':[_0x1e53('0xe'),_0x1e53('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9c5=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api'];(function(_0x394112,_0x135a07){var _0x2e65f0=function(_0x302a2d){while(--_0x302a2d){_0x394112['push'](_0x394112['shift']());}};_0x2e65f0(++_0x135a07);}(_0xe9c5,0x17d));var _0x5e9c=function(_0x892c63,_0x5a2b12){_0x892c63=_0x892c63-0x0;var _0x1d8bbb=_0xe9c5[_0x892c63];return _0x1d8bbb;};'use strict';var _=require(_0x5e9c('0x0'));var util=require(_0x5e9c('0x1'));var logger=require('../../config/logger')(_0x5e9c('0x2'));var moment=require('moment');var BPromise=require(_0x5e9c('0x3'));var rp=require(_0x5e9c('0x4'));var fs=require('fs');var path=require(_0x5e9c('0x5'));var rimraf=require(_0x5e9c('0x6'));var config=require(_0x5e9c('0x7'));var attributes=require(_0x5e9c('0x8'));module[_0x5e9c('0x9')]=function(_0x2f6cb9,_0x3363fd){return _0x2f6cb9[_0x5e9c('0xa')](_0x5e9c('0xb'),attributes,{'tableName':_0x5e9c('0xc'),'paranoid':![],'indexes':[{'name':_0x5e9c('0xd'),'fields':[_0x5e9c('0xe'),_0x5e9c('0xf')],'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 bbfae89..60db254 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x121f0a,_0x38d0a6){var _0x47afc8=function(_0x22a077){while(--_0x22a077){_0x121f0a['push'](_0x121f0a['shift']());}};_0x47afc8(++_0x38d0a6);}(_0x14a0,0x8e));var _0x014a=function(_0x39d6c7,_0x55d7d0){_0x39d6c7=_0x39d6c7-0x0;var _0xc0d795=_0x14a0[_0x39d6c7];return _0xc0d795;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x566ced,_0x1af685){var _0x222d4f=function(_0x351770){while(--_0x351770){_0x566ced['push'](_0x566ced['shift']());}};_0x222d4f(++_0x1af685);}(_0xb10b,0x12a));var _0xbb10=function(_0x28d1ea,_0x426311){_0x28d1ea=_0x28d1ea-0x0;var _0x1667b6=_0xb10b[_0x28d1ea];return _0x1667b6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 532fcd0..ee01d86 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 _0x8aca=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1dc4cb,_0x1719d3){var _0x16e4ac=function(_0x100882){while(--_0x100882){_0x1dc4cb['push'](_0x1dc4cb['shift']());}};_0x16e4ac(++_0x1719d3);}(_0x8aca,0xb2));var _0xa8ac=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x8aca[_0x237546];return _0x233e29;};'use strict';var multer=require(_0xa8ac('0x0'));var util=require('util');var path=require(_0xa8ac('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8ac('0x2'));var router=express[_0xa8ac('0x3')]();var fs_extra=require(_0xa8ac('0x4'));var auth=require(_0xa8ac('0x5'));var interaction=require(_0xa8ac('0x6'));var config=require(_0xa8ac('0x7'));var controller=require(_0xa8ac('0x8'));router[_0xa8ac('0x9')]('/',auth['isAuthenticated'](),controller[_0xa8ac('0xa')]);router[_0xa8ac('0x9')](_0xa8ac('0xb'),auth[_0xa8ac('0xc')](),controller[_0xa8ac('0xd')]);router[_0xa8ac('0x9')](_0xa8ac('0xe'),auth['isAuthenticated'](),controller[_0xa8ac('0xf')]);router[_0xa8ac('0x9')](_0xa8ac('0x10'),auth[_0xa8ac('0xc')](),controller['getFields']);router[_0xa8ac('0x11')]('/',auth[_0xa8ac('0xc')](),controller[_0xa8ac('0x12')]);router['post'](_0xa8ac('0xe'),auth['isAuthenticated'](),controller[_0xa8ac('0x13')]);router['put'](_0xa8ac('0xb'),auth[_0xa8ac('0xc')](),controller[_0xa8ac('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa8ac('0x15')]);module[_0xa8ac('0x16')]=router; \ No newline at end of file +var _0x1156=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','exports','multer','path'];(function(_0x37cdf3,_0x4e545f){var _0x6bdd52=function(_0x20ce16){while(--_0x20ce16){_0x37cdf3['push'](_0x37cdf3['shift']());}};_0x6bdd52(++_0x4e545f);}(_0x1156,0x178));var _0x6115=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x1156[_0x32b993];return _0x482780;};'use strict';var multer=require(_0x6115('0x0'));var util=require('util');var path=require(_0x6115('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6115('0x2')]();var fs_extra=require(_0x6115('0x3'));var auth=require(_0x6115('0x4'));var interaction=require(_0x6115('0x5'));var config=require(_0x6115('0x6'));var controller=require(_0x6115('0x7'));router[_0x6115('0x8')]('/',auth[_0x6115('0x9')](),controller[_0x6115('0xa')]);router[_0x6115('0x8')](_0x6115('0xb'),auth[_0x6115('0x9')](),controller['show']);router[_0x6115('0x8')](_0x6115('0xc'),auth[_0x6115('0x9')](),controller['getConfigurations']);router[_0x6115('0x8')]('/:id/fields',auth[_0x6115('0x9')](),controller[_0x6115('0xd')]);router[_0x6115('0xe')]('/',auth[_0x6115('0x9')](),controller[_0x6115('0xf')]);router[_0x6115('0xe')](_0x6115('0xc'),auth[_0x6115('0x9')](),controller[_0x6115('0x10')]);router[_0x6115('0x11')](_0x6115('0xb'),auth['isAuthenticated'](),controller[_0x6115('0x12')]);router[_0x6115('0x13')](_0x6115('0xb'),auth[_0x6115('0x9')](),controller['destroy']);module[_0x6115('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5307180..3906c5c 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 _0xb306=['STRING','HelpDesk','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb306,0x12e));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6b30('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b30('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6b30('0x1')]},'username':{'type':Sequelize[_0x6b30('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6b30('0x1')],'allowNull':![],'defaultValue':_0x6b30('0x2')},'remoteUri':{'type':Sequelize[_0x6b30('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6b30('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x71ab=['HelpDesk','exports','STRING'];(function(_0xa90e10,_0x377ff7){var _0xe61724=function(_0x3695b4){while(--_0x3695b4){_0xa90e10['push'](_0xa90e10['shift']());}};_0xe61724(++_0x377ff7);}(_0x71ab,0x64));var _0xb71a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71ab[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![],'defaultValue':_0xb71a('0x2')},'remoteUri':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 5f070b4..35d5d45 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 _0xaa88=['rawAttributes','include','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','addConfiguration','params','AccountId','channel','type','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','moduleName','remoteUri','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','token','describe','result','sessionName','includes','remove','editable','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','VtigerAccount','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show'];(function(_0x42e726,_0xf42a58){var _0x4c9629=function(_0x3b2703){while(--_0x3b2703){_0x42e726['push'](_0x42e726['shift']());}};_0x4c9629(++_0xf42a58);}(_0xaa88,0x137));var _0x8aa8=function(_0xdbb6cb,_0x3b8fda){_0xdbb6cb=_0xdbb6cb-0x0;var _0x476b50=_0xaa88[_0xdbb6cb];return _0x476b50;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];var integrations=require(_0x8aa8('0x19'));var jayson=require(_0x8aa8('0x1a'));var client=jayson['client'][_0x8aa8('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x179e33,_0x2fa66f,_0x4b686e,_0x391642){return new BPromise(function(_0x4af534,_0x4f3a2e){var _0x433e95=_0x391642||client;return _0x433e95[_0x8aa8('0x1c')](_0x179e33,_0x4b686e)[_0x8aa8('0x1d')](function(_0xa6c2af){logger[_0x8aa8('0x1e')](_0x8aa8('0x1f'),_0x2fa66f,_0x8aa8('0x20'));logger[_0x8aa8('0x21')](_0x8aa8('0x22'),_0x2fa66f,'request\x20sent',JSON['stringify'](_0xa6c2af));if(_0xa6c2af[_0x8aa8('0x23')]){if(_0xa6c2af['error']['code']===0x1f4){logger[_0x8aa8('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x2fa66f,_0xa6c2af[_0x8aa8('0x23')][_0x8aa8('0x24')]);return _0x4f3a2e(_0xa6c2af[_0x8aa8('0x23')][_0x8aa8('0x24')]);}logger['error'](_0x8aa8('0x1f'),_0x2fa66f,_0xa6c2af[_0x8aa8('0x23')][_0x8aa8('0x24')]);return _0x4af534(_0xa6c2af[_0x8aa8('0x23')][_0x8aa8('0x24')]);}else{logger[_0x8aa8('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x2fa66f,_0x8aa8('0x20'));_0x4af534(_0xa6c2af['result'][_0x8aa8('0x24')]);}})['catch'](function(_0x2c1828){logger['error'](_0x8aa8('0x1f'),_0x2fa66f,_0x2c1828);_0x4f3a2e(_0x2c1828);});});}function respondWithStatusCode(_0x40adb5,_0x3ca7dc){_0x3ca7dc=_0x3ca7dc||0xcc;return function(_0x5e5d91){if(_0x5e5d91){return _0x40adb5[_0x8aa8('0x25')](_0x3ca7dc);}return _0x40adb5[_0x8aa8('0x26')](_0x3ca7dc)[_0x8aa8('0x27')]();};}function respondWithResult(_0x547a7b,_0x57acd2){_0x57acd2=_0x57acd2||0xc8;return function(_0x2d1508){if(_0x2d1508){return _0x547a7b[_0x8aa8('0x26')](_0x57acd2)[_0x8aa8('0x28')](_0x2d1508);}};}function respondWithFilteredResult(_0x3a3c7a,_0x24143e){return function(_0x4a8212){if(_0x4a8212){var _0x2bc34a=typeof _0x24143e['offset']===_0x8aa8('0x29')&&typeof _0x24143e[_0x8aa8('0x2a')]===_0x8aa8('0x29');var _0x519ac0=_0x4a8212['count'];var _0x10810d=_0x2bc34a?0x0:_0x24143e['offset'];var _0x385208=_0x2bc34a?_0x4a8212[_0x8aa8('0x2b')]:_0x24143e[_0x8aa8('0x2c')]+_0x24143e[_0x8aa8('0x2a')];var _0xe07a83;if(_0x385208>=_0x519ac0){_0x385208=_0x519ac0;_0xe07a83=0xc8;}else{_0xe07a83=0xce;}_0x3a3c7a['status'](_0xe07a83);return _0x3a3c7a[_0x8aa8('0x2d')](_0x8aa8('0x2e'),_0x10810d+'-'+_0x385208+'/'+_0x519ac0)['json'](_0x4a8212);}return null;};}function patchUpdates(_0x99f74e){return function(_0xee2f61){try{jsonpatch[_0x8aa8('0x2f')](_0xee2f61,_0x99f74e,!![]);}catch(_0x5b6d5d){return BPromise[_0x8aa8('0x30')](_0x5b6d5d);}return _0xee2f61[_0x8aa8('0x31')]();};}function saveUpdates(_0x23a37c,_0x423b02){return function(_0x1313f8){if(_0x1313f8){return _0x1313f8[_0x8aa8('0x32')](_0x23a37c)[_0x8aa8('0x1d')](function(_0xcad4f8){return _0xcad4f8;});}return null;};}function removeEntity(_0x354375,_0x3a257c){return function(_0x3e069a){if(_0x3e069a){return _0x3e069a['destroy']()['then'](function(){_0x354375[_0x8aa8('0x26')](0xcc)[_0x8aa8('0x27')]();});}};}function handleEntityNotFound(_0x201d8d,_0x106ccb){return function(_0xbe7639){if(!_0xbe7639){_0x201d8d[_0x8aa8('0x25')](0x194);}return _0xbe7639;};}function handleError(_0x4b6f91,_0x4b8118){_0x4b8118=_0x4b8118||0x1f4;return function(_0x19ed76){logger['error'](_0x19ed76[_0x8aa8('0x33')]);if(_0x19ed76[_0x8aa8('0x34')]){delete _0x19ed76[_0x8aa8('0x34')];}_0x4b6f91['status'](_0x4b8118)[_0x8aa8('0x35')](_0x19ed76);};}exports[_0x8aa8('0x36')]=function(_0x231e29,_0x5c28fa){var _0x526779={},_0x22b511={},_0x1f90fc={'count':0x0,'rows':[]};var _0x52f87d=_[_0x8aa8('0x37')](db[_0x8aa8('0x38')]['rawAttributes'],function(_0x3bbdd5){return{'name':_0x3bbdd5['fieldName'],'type':_0x3bbdd5['type'][_0x8aa8('0x39')]};});_0x22b511['model']=_[_0x8aa8('0x37')](_0x52f87d,_0x8aa8('0x34'));_0x22b511[_0x8aa8('0x3a')]=_[_0x8aa8('0x3b')](_0x231e29['query']);_0x22b511[_0x8aa8('0x3c')]=_[_0x8aa8('0x3d')](_0x22b511['model'],_0x22b511[_0x8aa8('0x3a')]);_0x526779[_0x8aa8('0x3e')]=_['intersection'](_0x22b511[_0x8aa8('0x3f')],qs[_0x8aa8('0x40')](_0x231e29[_0x8aa8('0x3a')][_0x8aa8('0x40')]));_0x526779[_0x8aa8('0x3e')]=_0x526779[_0x8aa8('0x3e')][_0x8aa8('0x41')]?_0x526779[_0x8aa8('0x3e')]:_0x22b511[_0x8aa8('0x3f')];if(!_0x231e29[_0x8aa8('0x3a')][_0x8aa8('0x42')](_0x8aa8('0x43'))){_0x526779[_0x8aa8('0x2a')]=qs[_0x8aa8('0x2a')](_0x231e29[_0x8aa8('0x3a')][_0x8aa8('0x2a')]);_0x526779['offset']=qs[_0x8aa8('0x2c')](_0x231e29['query']['offset']);}_0x526779['order']=qs[_0x8aa8('0x44')](_0x231e29['query']['sort']);_0x526779[_0x8aa8('0x45')]=qs['filters'](_[_0x8aa8('0x46')](_0x231e29['query'],_0x22b511['filters']),_0x52f87d);if(_0x231e29[_0x8aa8('0x3a')][_0x8aa8('0x47')]){_0x526779[_0x8aa8('0x45')]=_[_0x8aa8('0x48')](_0x526779[_0x8aa8('0x45')],{'$or':_[_0x8aa8('0x37')](_0x52f87d,function(_0x9618e3){if(_0x9618e3['type']!==_0x8aa8('0x49')){var _0x53a7a4={};_0x53a7a4[_0x9618e3[_0x8aa8('0x34')]]={'$like':'%'+_0x231e29[_0x8aa8('0x3a')][_0x8aa8('0x47')]+'%'};return _0x53a7a4;}})});}_0x526779=_[_0x8aa8('0x48')]({},_0x526779,_0x231e29[_0x8aa8('0x4a')]);var _0x44f2b4={'where':_0x526779['where']};return db['VtigerAccount'][_0x8aa8('0x2b')](_0x44f2b4)[_0x8aa8('0x1d')](function(_0x5e1d3a){_0x1f90fc[_0x8aa8('0x2b')]=_0x5e1d3a;if(_0x231e29[_0x8aa8('0x3a')][_0x8aa8('0x4b')]){_0x526779['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x526779);})['then'](function(_0x2bd2ae){_0x1f90fc[_0x8aa8('0x4c')]=_0x2bd2ae;return _0x1f90fc;})['then'](respondWithFilteredResult(_0x5c28fa,_0x526779))[_0x8aa8('0x4d')](handleError(_0x5c28fa,null));};exports[_0x8aa8('0x4e')]=function(_0x20a463,_0x1aa1b6){var _0x20384a={'raw':![],'where':{'id':_0x20a463['params']['id']}},_0x6a6f93={};_0x6a6f93['model']=_[_0x8aa8('0x3b')](db['VtigerAccount'][_0x8aa8('0x4f')]);_0x6a6f93['query']=_[_0x8aa8('0x3b')](_0x20a463[_0x8aa8('0x3a')]);_0x6a6f93[_0x8aa8('0x3c')]=_[_0x8aa8('0x3d')](_0x6a6f93[_0x8aa8('0x3f')],_0x6a6f93[_0x8aa8('0x3a')]);_0x20384a[_0x8aa8('0x3e')]=_[_0x8aa8('0x3d')](_0x6a6f93[_0x8aa8('0x3f')],qs[_0x8aa8('0x40')](_0x20a463[_0x8aa8('0x3a')][_0x8aa8('0x40')]));_0x20384a['attributes']=_0x20384a[_0x8aa8('0x3e')]['length']?_0x20384a['attributes']:_0x6a6f93['model'];if(_0x20a463[_0x8aa8('0x3a')]['includeAll']){_0x20384a[_0x8aa8('0x50')]=[{'all':!![]}];}_0x20384a=_[_0x8aa8('0x48')]({},_0x20384a,_0x20a463[_0x8aa8('0x4a')]);return db['VtigerAccount'][_0x8aa8('0x51')](_0x20384a)[_0x8aa8('0x1d')](handleEntityNotFound(_0x1aa1b6,null))[_0x8aa8('0x1d')](respondWithResult(_0x1aa1b6,null))[_0x8aa8('0x4d')](handleError(_0x1aa1b6,null));};exports['create']=function(_0x5f16d5,_0x334975){return db[_0x8aa8('0x38')][_0x8aa8('0x52')](_0x5f16d5[_0x8aa8('0x53')],{})['then'](respondWithResult(_0x334975,0xc9))['catch'](handleError(_0x334975,null));};exports[_0x8aa8('0x32')]=function(_0x1bd389,_0x26eb56){if(_0x1bd389['body']['id']){delete _0x1bd389[_0x8aa8('0x53')]['id'];}return db[_0x8aa8('0x38')]['find']({'where':{'id':_0x1bd389['params']['id']}})['then'](handleEntityNotFound(_0x26eb56,null))['then'](saveUpdates(_0x1bd389[_0x8aa8('0x53')],null))['then'](respondWithResult(_0x26eb56,null))[_0x8aa8('0x4d')](handleError(_0x26eb56,null));};exports[_0x8aa8('0x54')]=function(_0x57d247,_0x581baa){return db[_0x8aa8('0x38')][_0x8aa8('0x51')]({'where':{'id':_0x57d247['params']['id']}})['then'](handleEntityNotFound(_0x581baa,null))['then'](removeEntity(_0x581baa,null))[_0x8aa8('0x4d')](handleError(_0x581baa,null));};exports[_0x8aa8('0x55')]=function(_0x570f6a,_0x5ef6b1,_0x20feaf){var _0x18f5c6={};var _0x5ac786={};var _0x3b141c;var _0x43e352;return db['VtigerAccount'][_0x8aa8('0x56')]({'where':{'id':_0x570f6a['params']['id']}})[_0x8aa8('0x1d')](handleEntityNotFound(_0x5ef6b1,null))['then'](function(_0x26f771){if(_0x26f771){_0x3b141c=_0x26f771;_0x5ac786[_0x8aa8('0x3f')]=_[_0x8aa8('0x3b')](db[_0x8aa8('0x57')][_0x8aa8('0x4f')]);_0x5ac786['query']=_[_0x8aa8('0x3b')](_0x570f6a[_0x8aa8('0x3a')]);_0x5ac786[_0x8aa8('0x3c')]=_[_0x8aa8('0x3d')](_0x5ac786['model'],_0x5ac786[_0x8aa8('0x3a')]);_0x18f5c6[_0x8aa8('0x3e')]=_['intersection'](_0x5ac786[_0x8aa8('0x3f')],qs[_0x8aa8('0x40')](_0x570f6a[_0x8aa8('0x3a')][_0x8aa8('0x40')]));_0x18f5c6[_0x8aa8('0x3e')]=_0x18f5c6[_0x8aa8('0x3e')][_0x8aa8('0x41')]?_0x18f5c6['attributes']:_0x5ac786['model'];_0x18f5c6['order']=qs[_0x8aa8('0x44')](_0x570f6a[_0x8aa8('0x3a')][_0x8aa8('0x44')]);_0x18f5c6[_0x8aa8('0x45')]=qs[_0x8aa8('0x3c')](_[_0x8aa8('0x46')](_0x570f6a[_0x8aa8('0x3a')],_0x5ac786[_0x8aa8('0x3c')]));if(_0x570f6a[_0x8aa8('0x3a')][_0x8aa8('0x47')]){_0x18f5c6[_0x8aa8('0x45')]=_[_0x8aa8('0x48')](_0x18f5c6[_0x8aa8('0x45')],{'$or':_[_0x8aa8('0x37')](_0x18f5c6[_0x8aa8('0x3e')],function(_0x36523a){var _0x84c520={};_0x84c520[_0x36523a]={'$like':'%'+_0x570f6a[_0x8aa8('0x3a')][_0x8aa8('0x47')]+'%'};return _0x84c520;})});}_0x18f5c6=_['merge']({},_0x18f5c6,_0x570f6a[_0x8aa8('0x4a')]);return _0x3b141c[_0x8aa8('0x55')](_0x18f5c6);}})[_0x8aa8('0x1d')](function(_0x1f2b70){if(_0x1f2b70){_0x43e352=_0x1f2b70[_0x8aa8('0x41')];if(!_0x570f6a[_0x8aa8('0x3a')][_0x8aa8('0x42')](_0x8aa8('0x43'))){_0x18f5c6[_0x8aa8('0x2a')]=qs['limit'](_0x570f6a[_0x8aa8('0x3a')][_0x8aa8('0x2a')]);_0x18f5c6['offset']=qs[_0x8aa8('0x2c')](_0x570f6a['query'][_0x8aa8('0x2c')]);}return _0x3b141c[_0x8aa8('0x55')](_0x18f5c6);}})['then'](function(_0x2fcdf2){if(_0x2fcdf2){return _0x2fcdf2?{'count':_0x43e352,'rows':_0x2fcdf2}:null;}})[_0x8aa8('0x1d')](respondWithResult(_0x5ef6b1,null))[_0x8aa8('0x4d')](handleError(_0x5ef6b1,null));};exports[_0x8aa8('0x58')]=function(_0xd136db,_0x27e3af,_0x7236f9){if(_0xd136db['body']['id']){delete _0xd136db[_0x8aa8('0x53')]['id'];}return db[_0x8aa8('0x38')][_0x8aa8('0x56')]({'where':{'id':_0xd136db[_0x8aa8('0x59')]['id']}})['then'](handleEntityNotFound(_0x27e3af,null))['then'](function(_0x284600){if(_0x284600){_0xd136db[_0x8aa8('0x53')][_0x8aa8('0x5a')]=_0x284600['id'];_0xd136db[_0x8aa8('0x53')]['Subjects']=integrations['getSubjects'](_0xd136db['body'][_0x8aa8('0x5b')],_0xd136db[_0x8aa8('0x53')][_0x8aa8('0x5c')]);_0xd136db[_0x8aa8('0x53')][_0x8aa8('0x5d')]=integrations[_0x8aa8('0x5e')](_0xd136db[_0x8aa8('0x53')][_0x8aa8('0x5b')],_0xd136db[_0x8aa8('0x53')]['type']);return db[_0x8aa8('0x57')]['create'](_0xd136db['body'],{'include':[{'model':db[_0x8aa8('0x5f')],'as':_0x8aa8('0x60')},{'model':db[_0x8aa8('0x5f')],'as':'Descriptions'}]});}return null;})[_0x8aa8('0x1d')](respondWithResult(_0x27e3af,null))['catch'](handleError(_0x27e3af,null));};var md5=require(_0x8aa8('0x61'));exports[_0x8aa8('0x62')]=function(_0x46a637,_0xdb62e7,_0x4685cf){var _0x5d1c8e=null;var _0x5d504c=null;var _0x11d2e9=null;var _0x12d40e=null;var _0x4122eb='';return db[_0x8aa8('0x38')][_0x8aa8('0x56')]({'where':{'id':_0x46a637[_0x8aa8('0x59')]['id']},'attributes':['id',_0x8aa8('0x34'),_0x8aa8('0x63'),'description',_0x8aa8('0x64'),_0x8aa8('0x65'),'serverUrl','accessKey']})[_0x8aa8('0x1d')](handleEntityNotFound(_0xdb62e7,null))[_0x8aa8('0x1d')](function(_0x505100){if(_0x505100){_0x5d1c8e=_0x505100[_0x8aa8('0x63')];_0x5d504c=_0x505100[_0x8aa8('0x66')];_0x11d2e9=_0x505100[_0x8aa8('0x64')];_0x4122eb=_0x505100['remoteUri'];var _0x4d213b=_0x4122eb['slice'](-0x1);if(_0x4d213b==='/'){_0x4122eb=_0x4122eb[_0x8aa8('0x67')](0x0,_0x4122eb[_0x8aa8('0x68')](_0x4d213b));}_0x12d40e=util[_0x8aa8('0x69')](_0x8aa8('0x6a'),_0x4122eb);var _0x4875d0={'method':_0x8aa8('0x6b'),'uri':_0x12d40e,'qs':{'operation':_0x8aa8('0x6c'),'username':_0x505100[_0x8aa8('0x63')]},'json':!![]};return rp(_0x4875d0);}})[_0x8aa8('0x1d')](function(_0x5bfcb3){if(_0x5bfcb3[_0x8aa8('0x6d')]){var _0x5714b7={'method':'POST','uri':_0x12d40e,'form':{'operation':_0x8aa8('0x6e'),'username':_0x5d1c8e,'accessKey':md5(_0x5bfcb3['result'][_0x8aa8('0x6f')]+_0x5d504c)},'json':!![]};return rp(_0x5714b7);}})[_0x8aa8('0x1d')](function(_0x2a7e7f){if(_0x2a7e7f['success']){var _0x46507d={'method':_0x8aa8('0x6b'),'uri':_0x12d40e,'qs':{'operation':_0x8aa8('0x70'),'username':_0x5d1c8e,'sessionName':_0x2a7e7f[_0x8aa8('0x71')][_0x8aa8('0x72')],'elementType':_0x11d2e9},'json':!![]};return rp(_0x46507d);}})[_0x8aa8('0x1d')](function(_0x49f4de){if(_0x49f4de['success']){var _0x839d86=['autogenerated','reference','owner'];_['remove'](_0x49f4de['result'][_0x8aa8('0x40')],function(_0x26092c){return _0x839d86[_0x8aa8('0x73')](_0x26092c[_0x8aa8('0x5c')][_0x8aa8('0x34')]);});_[_0x8aa8('0x74')](_0x49f4de[_0x8aa8('0x71')][_0x8aa8('0x40')],function(_0x1582bd){return _0x1582bd[_0x8aa8('0x75')]==='false';});return{'count':_0x49f4de['result'][_0x8aa8('0x40')][_0x8aa8('0x41')],'rows':_[_0x8aa8('0x37')](_0x49f4de[_0x8aa8('0x71')][_0x8aa8('0x40')],function(_0x227591){return{'id':_0x227591[_0x8aa8('0x34')],'name':_0x227591[_0x8aa8('0x76')],'custom':_['startsWith'](_0x227591[_0x8aa8('0x34')],_0x8aa8('0x77'))?!![]:![],'options':_0x227591[_0x8aa8('0x5c')]['name']===_0x8aa8('0x78')&&_0x227591[_0x8aa8('0x5c')]['picklistValues'][_0x8aa8('0x41')]>0x0?_[_0x8aa8('0x37')](_0x227591[_0x8aa8('0x5c')][_0x8aa8('0x79')],function(_0x384a39){return{'name':_0x384a39['label'],'value':_0x384a39[_0x8aa8('0x7a')]};}):[]};})};}})[_0x8aa8('0x1d')](respondWithResult(_0xdb62e7,null))[_0x8aa8('0x4d')](function(_0x47b4db){console[_0x8aa8('0x7b')](_0x8aa8('0x7c')+_0x47b4db);var _0x786047=_0x46a637[_0x8aa8('0x3a')][_0x8aa8('0x7d')]?0x1f4:_0x47b4db[_0x8aa8('0x7e')]||0x1f4;logger['error'](_0x8aa8('0x7f'),'getFields',_0x786047,JSON[_0x8aa8('0x80')](_0x47b4db));delete _0x47b4db[_0x8aa8('0x34')];if(_0x786047===0x191){_0x786047=0x190;}_0xdb62e7[_0x8aa8('0x26')](_0x786047)[_0x8aa8('0x35')](_0x46a637[_0x8aa8('0x3a')]['test']?{'message':_0x8aa8('0x81'),'statusCode':_0x47b4db[_0x8aa8('0x7e')]}:_0x47b4db);});}; \ No newline at end of file +var _0xd8b0=['AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','moduleName','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','token','success','autogenerated','reference','remove','result','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','undefined','limit','offset','set','Content-Range','json','save','update','destroy','end','stack','name','send','VtigerAccount','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','findOne','length','order','pick','options','getConfigurations'];(function(_0x299089,_0x3cff81){var _0x11c91f=function(_0x3e135b){while(--_0x3e135b){_0x299089['push'](_0x299089['shift']());}};_0x11c91f(++_0x3cff81);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];var integrations=require(_0x0d8b('0x18'));var jayson=require(_0x0d8b('0x19'));var client=jayson[_0x0d8b('0x1a')][_0x0d8b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x31a8cc,_0x1d4bbc,_0x2ce75e,_0x5ad086){return new BPromise(function(_0xe65334,_0x1567ce){var _0x2d4e1c=_0x5ad086||client;return _0x2d4e1c['request'](_0x31a8cc,_0x2ce75e)[_0x0d8b('0x1c')](function(_0xa86349){logger[_0x0d8b('0x1d')](_0x0d8b('0x1e'),_0x1d4bbc,_0x0d8b('0x1f'));logger['debug'](_0x0d8b('0x20'),_0x1d4bbc,_0x0d8b('0x1f'),JSON[_0x0d8b('0x21')](_0xa86349));if(_0xa86349[_0x0d8b('0x22')]){if(_0xa86349[_0x0d8b('0x22')][_0x0d8b('0x23')]===0x1f4){logger[_0x0d8b('0x22')](_0x0d8b('0x1e'),_0x1d4bbc,_0xa86349['error'][_0x0d8b('0x24')]);return _0x1567ce(_0xa86349[_0x0d8b('0x22')][_0x0d8b('0x24')]);}logger[_0x0d8b('0x22')](_0x0d8b('0x1e'),_0x1d4bbc,_0xa86349[_0x0d8b('0x22')][_0x0d8b('0x24')]);return _0xe65334(_0xa86349[_0x0d8b('0x22')]['message']);}else{logger['info'](_0x0d8b('0x1e'),_0x1d4bbc,'request\x20sent');_0xe65334(_0xa86349['result']['message']);}})[_0x0d8b('0x25')](function(_0x2b924f){logger[_0x0d8b('0x22')](_0x0d8b('0x1e'),_0x1d4bbc,_0x2b924f);_0x1567ce(_0x2b924f);});});}function respondWithStatusCode(_0x221071,_0x2c64e2){_0x2c64e2=_0x2c64e2||0xcc;return function(_0x30980c){if(_0x30980c){return _0x221071[_0x0d8b('0x26')](_0x2c64e2);}return _0x221071[_0x0d8b('0x27')](_0x2c64e2)['end']();};}function respondWithResult(_0xe8bbee,_0x4463ee){_0x4463ee=_0x4463ee||0xc8;return function(_0x5363e3){if(_0x5363e3){return _0xe8bbee[_0x0d8b('0x27')](_0x4463ee)['json'](_0x5363e3);}};}function respondWithFilteredResult(_0x3dd149,_0x234bdd){return function(_0xa2af02){if(_0xa2af02){var _0x4fe6f9=typeof _0x234bdd['offset']===_0x0d8b('0x28')&&typeof _0x234bdd[_0x0d8b('0x29')]==='undefined';var _0xcbc4ac=_0xa2af02['count'];var _0x1b2b59=_0x4fe6f9?0x0:_0x234bdd['offset'];var _0x97050a=_0x4fe6f9?_0xa2af02['count']:_0x234bdd[_0x0d8b('0x2a')]+_0x234bdd['limit'];var _0x3829c6;if(_0x97050a>=_0xcbc4ac){_0x97050a=_0xcbc4ac;_0x3829c6=0xc8;}else{_0x3829c6=0xce;}_0x3dd149['status'](_0x3829c6);return _0x3dd149[_0x0d8b('0x2b')](_0x0d8b('0x2c'),_0x1b2b59+'-'+_0x97050a+'/'+_0xcbc4ac)[_0x0d8b('0x2d')](_0xa2af02);}return null;};}function patchUpdates(_0x56120a){return function(_0x4c80a2){try{jsonpatch['apply'](_0x4c80a2,_0x56120a,!![]);}catch(_0x4e8992){return BPromise['reject'](_0x4e8992);}return _0x4c80a2[_0x0d8b('0x2e')]();};}function saveUpdates(_0x54f6f3,_0x5d05fc){return function(_0x36017a){if(_0x36017a){return _0x36017a[_0x0d8b('0x2f')](_0x54f6f3)[_0x0d8b('0x1c')](function(_0xdeee5d){return _0xdeee5d;});}return null;};}function removeEntity(_0x183220,_0xeaa769){return function(_0x4a99d3){if(_0x4a99d3){return _0x4a99d3[_0x0d8b('0x30')]()['then'](function(){_0x183220[_0x0d8b('0x27')](0xcc)[_0x0d8b('0x31')]();});}};}function handleEntityNotFound(_0x4b3ea0,_0xb18586){return function(_0x23f7f6){if(!_0x23f7f6){_0x4b3ea0[_0x0d8b('0x26')](0x194);}return _0x23f7f6;};}function handleError(_0x4f2ed2,_0x113318){_0x113318=_0x113318||0x1f4;return function(_0x2c507e){logger[_0x0d8b('0x22')](_0x2c507e[_0x0d8b('0x32')]);if(_0x2c507e[_0x0d8b('0x33')]){delete _0x2c507e['name'];}_0x4f2ed2[_0x0d8b('0x27')](_0x113318)[_0x0d8b('0x34')](_0x2c507e);};}exports['index']=function(_0x1180ac,_0x3cc3ee){var _0x188af2={},_0x974b9b={},_0x373544={'count':0x0,'rows':[]};var _0x519088=_['map'](db[_0x0d8b('0x35')]['rawAttributes'],function(_0x531c55){return{'name':_0x531c55[_0x0d8b('0x36')],'type':_0x531c55[_0x0d8b('0x37')][_0x0d8b('0x38')]};});_0x974b9b[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x519088,_0x0d8b('0x33'));_0x974b9b['query']=_[_0x0d8b('0x3b')](_0x1180ac[_0x0d8b('0x3c')]);_0x974b9b[_0x0d8b('0x3d')]=_[_0x0d8b('0x3e')](_0x974b9b[_0x0d8b('0x39')],_0x974b9b[_0x0d8b('0x3c')]);_0x188af2[_0x0d8b('0x3f')]=_['intersection'](_0x974b9b[_0x0d8b('0x39')],qs[_0x0d8b('0x40')](_0x1180ac[_0x0d8b('0x3c')][_0x0d8b('0x40')]));_0x188af2['attributes']=_0x188af2[_0x0d8b('0x3f')]['length']?_0x188af2[_0x0d8b('0x3f')]:_0x974b9b[_0x0d8b('0x39')];if(!_0x1180ac[_0x0d8b('0x3c')][_0x0d8b('0x41')](_0x0d8b('0x42'))){_0x188af2[_0x0d8b('0x29')]=qs[_0x0d8b('0x29')](_0x1180ac[_0x0d8b('0x3c')][_0x0d8b('0x29')]);_0x188af2[_0x0d8b('0x2a')]=qs['offset'](_0x1180ac['query']['offset']);}_0x188af2['order']=qs['sort'](_0x1180ac[_0x0d8b('0x3c')][_0x0d8b('0x43')]);_0x188af2[_0x0d8b('0x44')]=qs['filters'](_['pick'](_0x1180ac[_0x0d8b('0x3c')],_0x974b9b[_0x0d8b('0x3d')]),_0x519088);if(_0x1180ac[_0x0d8b('0x3c')]['filter']){_0x188af2[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x188af2['where'],{'$or':_['map'](_0x519088,function(_0x372740){if(_0x372740['type']!==_0x0d8b('0x46')){var _0x5a96b1={};_0x5a96b1[_0x372740['name']]={'$like':'%'+_0x1180ac[_0x0d8b('0x3c')][_0x0d8b('0x47')]+'%'};return _0x5a96b1;}})});}_0x188af2=_['merge']({},_0x188af2,_0x1180ac['options']);var _0x59b8e9={'where':_0x188af2['where']};return db[_0x0d8b('0x35')][_0x0d8b('0x48')](_0x59b8e9)[_0x0d8b('0x1c')](function(_0x490eda){_0x373544[_0x0d8b('0x48')]=_0x490eda;if(_0x1180ac[_0x0d8b('0x3c')][_0x0d8b('0x49')]){_0x188af2[_0x0d8b('0x4a')]=[{'all':!![]}];}return db[_0x0d8b('0x35')][_0x0d8b('0x4b')](_0x188af2);})[_0x0d8b('0x1c')](function(_0x1d5067){_0x373544[_0x0d8b('0x4c')]=_0x1d5067;return _0x373544;})[_0x0d8b('0x1c')](respondWithFilteredResult(_0x3cc3ee,_0x188af2))[_0x0d8b('0x25')](handleError(_0x3cc3ee,null));};exports[_0x0d8b('0x4d')]=function(_0x84ef1c,_0x3e569b){var _0x570af8={'raw':![],'where':{'id':_0x84ef1c[_0x0d8b('0x4e')]['id']}},_0xdfcf32={};_0xdfcf32[_0x0d8b('0x39')]=_[_0x0d8b('0x3b')](db['VtigerAccount'][_0x0d8b('0x4f')]);_0xdfcf32['query']=_['keys'](_0x84ef1c[_0x0d8b('0x3c')]);_0xdfcf32[_0x0d8b('0x3d')]=_[_0x0d8b('0x3e')](_0xdfcf32[_0x0d8b('0x39')],_0xdfcf32['query']);_0x570af8[_0x0d8b('0x3f')]=_[_0x0d8b('0x3e')](_0xdfcf32[_0x0d8b('0x39')],qs[_0x0d8b('0x40')](_0x84ef1c[_0x0d8b('0x3c')]['fields']));_0x570af8['attributes']=_0x570af8['attributes']['length']?_0x570af8[_0x0d8b('0x3f')]:_0xdfcf32[_0x0d8b('0x39')];if(_0x84ef1c['query']['includeAll']){_0x570af8[_0x0d8b('0x4a')]=[{'all':!![]}];}_0x570af8=_[_0x0d8b('0x45')]({},_0x570af8,_0x84ef1c['options']);return db['VtigerAccount'][_0x0d8b('0x50')](_0x570af8)[_0x0d8b('0x1c')](handleEntityNotFound(_0x3e569b,null))[_0x0d8b('0x1c')](respondWithResult(_0x3e569b,null))[_0x0d8b('0x25')](handleError(_0x3e569b,null));};exports[_0x0d8b('0x51')]=function(_0x506a79,_0x2de903){return db[_0x0d8b('0x35')]['create'](_0x506a79['body'],{})[_0x0d8b('0x1c')](respondWithResult(_0x2de903,0xc9))[_0x0d8b('0x25')](handleError(_0x2de903,null));};exports['update']=function(_0x55a489,_0xb8be3b){if(_0x55a489[_0x0d8b('0x52')]['id']){delete _0x55a489[_0x0d8b('0x52')]['id'];}return db[_0x0d8b('0x35')]['find']({'where':{'id':_0x55a489[_0x0d8b('0x4e')]['id']}})['then'](handleEntityNotFound(_0xb8be3b,null))['then'](saveUpdates(_0x55a489[_0x0d8b('0x52')],null))[_0x0d8b('0x1c')](respondWithResult(_0xb8be3b,null))['catch'](handleError(_0xb8be3b,null));};exports['destroy']=function(_0x44ed23,_0x3d7161){return db[_0x0d8b('0x35')][_0x0d8b('0x50')]({'where':{'id':_0x44ed23[_0x0d8b('0x4e')]['id']}})[_0x0d8b('0x1c')](handleEntityNotFound(_0x3d7161,null))[_0x0d8b('0x1c')](removeEntity(_0x3d7161,null))[_0x0d8b('0x25')](handleError(_0x3d7161,null));};exports['getConfigurations']=function(_0x24a859,_0x37dc9f,_0x3a3d33){var _0x3c7efb={};var _0x3fb9ea={};var _0x47104e;var _0x70c8c4;return db[_0x0d8b('0x35')][_0x0d8b('0x53')]({'where':{'id':_0x24a859['params']['id']}})[_0x0d8b('0x1c')](handleEntityNotFound(_0x37dc9f,null))[_0x0d8b('0x1c')](function(_0x180b7b){if(_0x180b7b){_0x47104e=_0x180b7b;_0x3fb9ea[_0x0d8b('0x39')]=_[_0x0d8b('0x3b')](db['VtigerConfiguration'][_0x0d8b('0x4f')]);_0x3fb9ea[_0x0d8b('0x3c')]=_[_0x0d8b('0x3b')](_0x24a859[_0x0d8b('0x3c')]);_0x3fb9ea[_0x0d8b('0x3d')]=_['intersection'](_0x3fb9ea['model'],_0x3fb9ea[_0x0d8b('0x3c')]);_0x3c7efb[_0x0d8b('0x3f')]=_[_0x0d8b('0x3e')](_0x3fb9ea[_0x0d8b('0x39')],qs['fields'](_0x24a859[_0x0d8b('0x3c')][_0x0d8b('0x40')]));_0x3c7efb[_0x0d8b('0x3f')]=_0x3c7efb['attributes'][_0x0d8b('0x54')]?_0x3c7efb['attributes']:_0x3fb9ea[_0x0d8b('0x39')];_0x3c7efb[_0x0d8b('0x55')]=qs[_0x0d8b('0x43')](_0x24a859[_0x0d8b('0x3c')][_0x0d8b('0x43')]);_0x3c7efb[_0x0d8b('0x44')]=qs['filters'](_[_0x0d8b('0x56')](_0x24a859['query'],_0x3fb9ea[_0x0d8b('0x3d')]));if(_0x24a859[_0x0d8b('0x3c')][_0x0d8b('0x47')]){_0x3c7efb[_0x0d8b('0x44')]=_['merge'](_0x3c7efb[_0x0d8b('0x44')],{'$or':_[_0x0d8b('0x3a')](_0x3c7efb[_0x0d8b('0x3f')],function(_0x2332fc){var _0x2ccdae={};_0x2ccdae[_0x2332fc]={'$like':'%'+_0x24a859[_0x0d8b('0x3c')][_0x0d8b('0x47')]+'%'};return _0x2ccdae;})});}_0x3c7efb=_[_0x0d8b('0x45')]({},_0x3c7efb,_0x24a859[_0x0d8b('0x57')]);return _0x47104e[_0x0d8b('0x58')](_0x3c7efb);}})['then'](function(_0x4ee1e8){if(_0x4ee1e8){_0x70c8c4=_0x4ee1e8[_0x0d8b('0x54')];if(!_0x24a859[_0x0d8b('0x3c')]['hasOwnProperty'](_0x0d8b('0x42'))){_0x3c7efb['limit']=qs['limit'](_0x24a859[_0x0d8b('0x3c')][_0x0d8b('0x29')]);_0x3c7efb['offset']=qs['offset'](_0x24a859[_0x0d8b('0x3c')][_0x0d8b('0x2a')]);}return _0x47104e[_0x0d8b('0x58')](_0x3c7efb);}})[_0x0d8b('0x1c')](function(_0x2ab72b){if(_0x2ab72b){return _0x2ab72b?{'count':_0x70c8c4,'rows':_0x2ab72b}:null;}})[_0x0d8b('0x1c')](respondWithResult(_0x37dc9f,null))[_0x0d8b('0x25')](handleError(_0x37dc9f,null));};exports['addConfiguration']=function(_0x1ca60c,_0x5878c2,_0x1a203e){if(_0x1ca60c[_0x0d8b('0x52')]['id']){delete _0x1ca60c[_0x0d8b('0x52')]['id'];}return db[_0x0d8b('0x35')]['findOne']({'where':{'id':_0x1ca60c[_0x0d8b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5878c2,null))[_0x0d8b('0x1c')](function(_0x2c6c5f){if(_0x2c6c5f){_0x1ca60c[_0x0d8b('0x52')][_0x0d8b('0x59')]=_0x2c6c5f['id'];_0x1ca60c[_0x0d8b('0x52')][_0x0d8b('0x5a')]=integrations[_0x0d8b('0x5b')](_0x1ca60c[_0x0d8b('0x52')][_0x0d8b('0x5c')],_0x1ca60c[_0x0d8b('0x52')]['type']);_0x1ca60c[_0x0d8b('0x52')]['Descriptions']=integrations[_0x0d8b('0x5d')](_0x1ca60c[_0x0d8b('0x52')]['channel'],_0x1ca60c[_0x0d8b('0x52')]['type']);return db[_0x0d8b('0x5e')][_0x0d8b('0x51')](_0x1ca60c[_0x0d8b('0x52')],{'include':[{'model':db[_0x0d8b('0x5f')],'as':_0x0d8b('0x5a')},{'model':db[_0x0d8b('0x5f')],'as':_0x0d8b('0x60')}]});}return null;})[_0x0d8b('0x1c')](respondWithResult(_0x5878c2,null))['catch'](handleError(_0x5878c2,null));};var md5=require(_0x0d8b('0x61'));exports[_0x0d8b('0x62')]=function(_0x5b2916,_0x191a5a,_0x105df9){var _0x303d6=null;var _0x2da0af=null;var _0x16141a=null;var _0x9e44b4=null;var _0x40ff07='';return db[_0x0d8b('0x35')][_0x0d8b('0x53')]({'where':{'id':_0x5b2916[_0x0d8b('0x4e')]['id']},'attributes':['id',_0x0d8b('0x33'),_0x0d8b('0x63'),'description',_0x0d8b('0x64'),_0x0d8b('0x65'),_0x0d8b('0x66'),'accessKey']})['then'](handleEntityNotFound(_0x191a5a,null))[_0x0d8b('0x1c')](function(_0x3aeb45){if(_0x3aeb45){_0x303d6=_0x3aeb45[_0x0d8b('0x63')];_0x2da0af=_0x3aeb45['accessKey'];_0x16141a=_0x3aeb45['moduleName'];_0x40ff07=_0x3aeb45[_0x0d8b('0x65')];var _0x130159=_0x40ff07[_0x0d8b('0x67')](-0x1);if(_0x130159==='/'){_0x40ff07=_0x40ff07[_0x0d8b('0x68')](0x0,_0x40ff07[_0x0d8b('0x69')](_0x130159));}_0x9e44b4=util[_0x0d8b('0x6a')](_0x0d8b('0x6b'),_0x40ff07);var _0x2c826b={'method':_0x0d8b('0x6c'),'uri':_0x9e44b4,'qs':{'operation':_0x0d8b('0x6d'),'username':_0x3aeb45[_0x0d8b('0x63')]},'json':!![]};return rp(_0x2c826b);}})[_0x0d8b('0x1c')](function(_0x3b060e){if(_0x3b060e['success']){var _0x3d3b0b={'method':_0x0d8b('0x6e'),'uri':_0x9e44b4,'form':{'operation':'login','username':_0x303d6,'accessKey':md5(_0x3b060e['result'][_0x0d8b('0x6f')]+_0x2da0af)},'json':!![]};return rp(_0x3d3b0b);}})[_0x0d8b('0x1c')](function(_0x3573b4){if(_0x3573b4[_0x0d8b('0x70')]){var _0x23e2e0={'method':_0x0d8b('0x6c'),'uri':_0x9e44b4,'qs':{'operation':'describe','username':_0x303d6,'sessionName':_0x3573b4['result']['sessionName'],'elementType':_0x16141a},'json':!![]};return rp(_0x23e2e0);}})[_0x0d8b('0x1c')](function(_0xce759e){if(_0xce759e[_0x0d8b('0x70')]){var _0x28f9b7=[_0x0d8b('0x71'),_0x0d8b('0x72'),'owner'];_[_0x0d8b('0x73')](_0xce759e[_0x0d8b('0x74')]['fields'],function(_0x30a69d){return _0x28f9b7['includes'](_0x30a69d[_0x0d8b('0x37')][_0x0d8b('0x33')]);});_[_0x0d8b('0x73')](_0xce759e[_0x0d8b('0x74')][_0x0d8b('0x40')],function(_0x8fae7f){return _0x8fae7f[_0x0d8b('0x75')]===_0x0d8b('0x76');});return{'count':_0xce759e[_0x0d8b('0x74')][_0x0d8b('0x40')][_0x0d8b('0x54')],'rows':_[_0x0d8b('0x3a')](_0xce759e['result']['fields'],function(_0x41baa2){return{'id':_0x41baa2[_0x0d8b('0x33')],'name':_0x41baa2[_0x0d8b('0x77')],'custom':_[_0x0d8b('0x78')](_0x41baa2[_0x0d8b('0x33')],_0x0d8b('0x79'))?!![]:![],'options':_0x41baa2[_0x0d8b('0x37')]['name']===_0x0d8b('0x7a')&&_0x41baa2['type'][_0x0d8b('0x7b')]['length']>0x0?_['map'](_0x41baa2[_0x0d8b('0x37')][_0x0d8b('0x7b')],function(_0x25d99f){return{'name':_0x25d99f[_0x0d8b('0x77')],'value':_0x25d99f[_0x0d8b('0x7c')]};}):[]};})};}})[_0x0d8b('0x1c')](respondWithResult(_0x191a5a,null))[_0x0d8b('0x25')](function(_0x180eda){console[_0x0d8b('0x7d')](_0x0d8b('0x7e')+_0x180eda);var _0x3a6014=_0x5b2916[_0x0d8b('0x3c')]['test']?0x1f4:_0x180eda[_0x0d8b('0x7f')]||0x1f4;logger[_0x0d8b('0x22')](_0x0d8b('0x80'),'getFields',_0x3a6014,JSON['stringify'](_0x180eda));delete _0x180eda[_0x0d8b('0x33')];if(_0x3a6014===0x191){_0x3a6014=0x190;}_0x191a5a[_0x0d8b('0x27')](_0x3a6014)[_0x0d8b('0x34')](_0x5b2916[_0x0d8b('0x3c')][_0x0d8b('0x81')]?{'message':_0x0d8b('0x82'),'statusCode':_0x180eda['statusCode']}:_0x180eda);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 772db37..7fac4c3 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 _0x20c6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','define','VtigerAccount','lodash','util'];(function(_0x22e49d,_0x173e40){var _0xe00a10=function(_0x15afee){while(--_0x15afee){_0x22e49d['push'](_0x22e49d['shift']());}};_0xe00a10(++_0x173e40);}(_0x20c6,0xdb));var _0x620c=function(_0x370de9,_0x57af01){_0x370de9=_0x370de9-0x0;var _0x1a43ee=_0x20c6[_0x370de9];return _0x1a43ee;};'use strict';var _=require(_0x620c('0x0'));var util=require(_0x620c('0x1'));var logger=require(_0x620c('0x2'))(_0x620c('0x3'));var moment=require(_0x620c('0x4'));var BPromise=require(_0x620c('0x5'));var rp=require(_0x620c('0x6'));var fs=require('fs');var path=require(_0x620c('0x7'));var rimraf=require(_0x620c('0x8'));var config=require(_0x620c('0x9'));var attributes=require(_0x620c('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1031c4,_0x323c95){return _0x1031c4[_0x620c('0xb')](_0x620c('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb4e=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x3f282b,_0x581e91){var _0x5f12df=function(_0x3eb94d){while(--_0x3eb94d){_0x3f282b['push'](_0x3f282b['shift']());}};_0x5f12df(++_0x581e91);}(_0xbb4e,0xb1));var _0xebb4=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0xbb4e[_0x15af0f];return _0x2bd1cb;};'use strict';var _=require(_0xebb4('0x0'));var util=require(_0xebb4('0x1'));var logger=require(_0xebb4('0x2'))(_0xebb4('0x3'));var moment=require(_0xebb4('0x4'));var BPromise=require('bluebird');var rp=require(_0xebb4('0x5'));var fs=require('fs');var path=require(_0xebb4('0x6'));var rimraf=require(_0xebb4('0x7'));var config=require(_0xebb4('0x8'));var attributes=require(_0xebb4('0x9'));var integrations=require(_0xebb4('0xa'));module[_0xebb4('0xb')]=function(_0x40109c,_0x3b7844){return _0x40109c['define'](_0xebb4('0xc'),attributes,{'tableName':_0xebb4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 15b7255..d9a777b 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 _0x4a8c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','raw','options','where','attributes','include','map','model','GetVtigerAccount','debug','stringify','ShowVtigerAccount','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x4a8c,0xa5));var _0xc4a8=function(_0x4ebe9b,_0x2ea11d){_0x4ebe9b=_0x4ebe9b-0x0;var _0x2dbe82=_0x4a8c[_0x4ebe9b];return _0x2dbe82;};'use strict';var _=require(_0xc4a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4a8('0x1'));var rs=require(_0xc4a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4a8('0x3'))['db'];var utils=require(_0xc4a8('0x4'));var logger=require(_0xc4a8('0x5'))(_0xc4a8('0x6'));var config=require(_0xc4a8('0x7'));var jayson=require(_0xc4a8('0x8'));var client=jayson[_0xc4a8('0x9')][_0xc4a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x275ba1,_0x3c74aa,_0x5d4915){return new BPromise(function(_0x22a9c3,_0x48b3f9){return client['request'](_0x275ba1,_0x5d4915)[_0xc4a8('0xb')](function(_0x57949d){logger[_0xc4a8('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x3c74aa,'request\x20sent');logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3c74aa,_0xc4a8('0xd'),JSON['stringify'](_0x57949d));if(_0x57949d[_0xc4a8('0xe')]){if(_0x57949d[_0xc4a8('0xe')][_0xc4a8('0xf')]===0x1f4){logger[_0xc4a8('0xe')](_0xc4a8('0x10'),_0x3c74aa,_0x57949d['error']['message']);return _0x48b3f9(_0x57949d[_0xc4a8('0xe')][_0xc4a8('0x11')]);}logger[_0xc4a8('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3c74aa,_0x57949d[_0xc4a8('0xe')][_0xc4a8('0x11')]);return _0x22a9c3(_0x57949d[_0xc4a8('0xe')]['message']);}else{logger[_0xc4a8('0xc')](_0xc4a8('0x10'),_0x3c74aa,'request\x20sent');_0x22a9c3(_0x57949d[_0xc4a8('0x12')]['message']);}})[_0xc4a8('0x13')](function(_0x283417){logger[_0xc4a8('0xe')](_0xc4a8('0x10'),_0x3c74aa,_0x283417);_0x48b3f9(_0x283417);});});}exports['GetVtigerAccount']=function(_0x451717){var _0x55314b=this;return new Promise(function(_0x1a9862,_0xa3ea8f){return db[_0xc4a8('0x14')][_0xc4a8('0x15')]({'raw':_0x451717['options']?_0x451717['options'][_0xc4a8('0x16')]===undefined?!![]:![]:!![],'where':_0x451717[_0xc4a8('0x17')]?_0x451717[_0xc4a8('0x17')][_0xc4a8('0x18')]||null:null,'attributes':_0x451717[_0xc4a8('0x17')]?_0x451717[_0xc4a8('0x17')][_0xc4a8('0x19')]||null:null,'limit':_0x451717[_0xc4a8('0x17')]?_0x451717[_0xc4a8('0x17')]['limit']||null:null,'include':_0x451717[_0xc4a8('0x17')]?_0x451717[_0xc4a8('0x17')][_0xc4a8('0x1a')]?_[_0xc4a8('0x1b')](_0x451717[_0xc4a8('0x17')][_0xc4a8('0x1a')],function(_0xed58ac){return{'model':db[_0xed58ac['model']],'as':_0xed58ac['as'],'attributes':_0xed58ac[_0xc4a8('0x19')],'include':_0xed58ac[_0xc4a8('0x1a')]?_[_0xc4a8('0x1b')](_0xed58ac['include'],function(_0x5ac60d){return{'model':db[_0x5ac60d[_0xc4a8('0x1c')]],'as':_0x5ac60d['as'],'attributes':_0x5ac60d[_0xc4a8('0x19')],'include':_0x5ac60d['include']?_[_0xc4a8('0x1b')](_0x5ac60d['include'],function(_0x1527f3){return{'model':db[_0x1527f3[_0xc4a8('0x1c')]],'as':_0x1527f3['as'],'attributes':_0x1527f3[_0xc4a8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc4a8('0xb')](function(_0x39118d){logger[_0xc4a8('0xc')](_0xc4a8('0x1d'),_0x451717);logger[_0xc4a8('0x1e')](_0xc4a8('0x1d'),_0x451717,JSON[_0xc4a8('0x1f')](_0x39118d));_0x1a9862(_0x39118d);})['catch'](function(_0x528505){logger[_0xc4a8('0xe')](_0xc4a8('0x1d'),_0x528505[_0xc4a8('0x11')],_0x451717);_0xa3ea8f(_0x55314b[_0xc4a8('0xe')](0x1f4,_0x528505['message']));});});};exports[_0xc4a8('0x20')]=function(_0x2fb38c){var _0x17c710=this;return new Promise(function(_0x450e8b,_0x124fdd){return db[_0xc4a8('0x14')][_0xc4a8('0x21')]({'raw':_0x2fb38c[_0xc4a8('0x17')]?_0x2fb38c[_0xc4a8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2fb38c['options']?_0x2fb38c[_0xc4a8('0x17')][_0xc4a8('0x18')]||null:null,'attributes':_0x2fb38c['options']?_0x2fb38c[_0xc4a8('0x17')][_0xc4a8('0x19')]||null:null,'include':_0x2fb38c['options']?_0x2fb38c[_0xc4a8('0x17')][_0xc4a8('0x1a')]?_[_0xc4a8('0x1b')](_0x2fb38c[_0xc4a8('0x17')]['include'],function(_0x1515ab){return{'model':db[_0x1515ab[_0xc4a8('0x1c')]],'as':_0x1515ab['as'],'attributes':_0x1515ab['attributes'],'include':_0x1515ab[_0xc4a8('0x1a')]?_[_0xc4a8('0x1b')](_0x1515ab[_0xc4a8('0x1a')],function(_0x1b7232){return{'model':db[_0x1b7232[_0xc4a8('0x1c')]],'as':_0x1b7232['as'],'attributes':_0x1b7232[_0xc4a8('0x19')],'include':_0x1b7232[_0xc4a8('0x1a')]?_[_0xc4a8('0x1b')](_0x1b7232['include'],function(_0x36c390){return{'model':db[_0x36c390['model']],'as':_0x36c390['as'],'attributes':_0x36c390[_0xc4a8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc4a8('0xb')](function(_0x271999){logger[_0xc4a8('0xc')](_0xc4a8('0x20'),_0x2fb38c);logger['debug'](_0xc4a8('0x20'),_0x2fb38c,JSON[_0xc4a8('0x1f')](_0x271999));_0x450e8b(_0x271999);})[_0xc4a8('0x13')](function(_0x5baa22){logger[_0xc4a8('0xe')](_0xc4a8('0x20'),_0x5baa22[_0xc4a8('0x11')],_0x2fb38c);_0x124fdd(_0x17c710['error'](0x1f4,_0x5baa22[_0xc4a8('0x11')]));});});}; \ No newline at end of file +var _0x7663=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','raw','options','where','attributes','map','include','model','find','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x1b5e26,_0x453ef6){var _0x246191=function(_0x54a89e){while(--_0x54a89e){_0x1b5e26['push'](_0x1b5e26['shift']());}};_0x246191(++_0x453ef6);}(_0x7663,0x17f));var _0x3766=function(_0xcd4afb,_0x1dca16){_0xcd4afb=_0xcd4afb-0x0;var _0x4e1264=_0x7663[_0xcd4afb];return _0x4e1264;};'use strict';var _=require(_0x3766('0x0'));var util=require('util');var moment=require(_0x3766('0x1'));var BPromise=require(_0x3766('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3766('0x3'));var db=require(_0x3766('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3766('0x5'))(_0x3766('0x6'));var config=require('../../config/environment');var jayson=require(_0x3766('0x7'));var client=jayson[_0x3766('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x368355,_0x4f400c,_0x2eda46){return new BPromise(function(_0x136a4c,_0x150949){return client[_0x3766('0x9')](_0x368355,_0x2eda46)[_0x3766('0xa')](function(_0x4dd0ae){logger[_0x3766('0xb')](_0x3766('0xc'),_0x4f400c,_0x3766('0xd'));logger[_0x3766('0xe')](_0x3766('0xf'),_0x4f400c,_0x3766('0xd'),JSON[_0x3766('0x10')](_0x4dd0ae));if(_0x4dd0ae[_0x3766('0x11')]){if(_0x4dd0ae[_0x3766('0x11')][_0x3766('0x12')]===0x1f4){logger[_0x3766('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f400c,_0x4dd0ae[_0x3766('0x11')][_0x3766('0x13')]);return _0x150949(_0x4dd0ae[_0x3766('0x11')][_0x3766('0x13')]);}logger[_0x3766('0x11')](_0x3766('0xc'),_0x4f400c,_0x4dd0ae['error'][_0x3766('0x13')]);return _0x136a4c(_0x4dd0ae[_0x3766('0x11')]['message']);}else{logger[_0x3766('0xb')](_0x3766('0xc'),_0x4f400c,_0x3766('0xd'));_0x136a4c(_0x4dd0ae[_0x3766('0x14')][_0x3766('0x13')]);}})[_0x3766('0x15')](function(_0xc7c69a){logger[_0x3766('0x11')](_0x3766('0xc'),_0x4f400c,_0xc7c69a);_0x150949(_0xc7c69a);});});}exports[_0x3766('0x16')]=function(_0x3ee74a){var _0x581005=this;return new Promise(function(_0x258c65,_0x16f44c){return db[_0x3766('0x17')]['findAll']({'raw':_0x3ee74a['options']?_0x3ee74a['options'][_0x3766('0x18')]===undefined?!![]:![]:!![],'where':_0x3ee74a[_0x3766('0x19')]?_0x3ee74a[_0x3766('0x19')][_0x3766('0x1a')]||null:null,'attributes':_0x3ee74a[_0x3766('0x19')]?_0x3ee74a[_0x3766('0x19')][_0x3766('0x1b')]||null:null,'limit':_0x3ee74a[_0x3766('0x19')]?_0x3ee74a[_0x3766('0x19')]['limit']||null:null,'include':_0x3ee74a['options']?_0x3ee74a['options']['include']?_[_0x3766('0x1c')](_0x3ee74a[_0x3766('0x19')][_0x3766('0x1d')],function(_0x227ea5){return{'model':db[_0x227ea5[_0x3766('0x1e')]],'as':_0x227ea5['as'],'attributes':_0x227ea5[_0x3766('0x1b')],'include':_0x227ea5['include']?_[_0x3766('0x1c')](_0x227ea5[_0x3766('0x1d')],function(_0x26e27a){return{'model':db[_0x26e27a[_0x3766('0x1e')]],'as':_0x26e27a['as'],'attributes':_0x26e27a[_0x3766('0x1b')],'include':_0x26e27a[_0x3766('0x1d')]?_[_0x3766('0x1c')](_0x26e27a[_0x3766('0x1d')],function(_0x102d8a){return{'model':db[_0x102d8a[_0x3766('0x1e')]],'as':_0x102d8a['as'],'attributes':_0x102d8a[_0x3766('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3766('0xa')](function(_0x462aca){logger[_0x3766('0xb')]('GetVtigerAccount',_0x3ee74a);logger[_0x3766('0xe')](_0x3766('0x16'),_0x3ee74a,JSON[_0x3766('0x10')](_0x462aca));_0x258c65(_0x462aca);})[_0x3766('0x15')](function(_0x53ecb9){logger['error'](_0x3766('0x16'),_0x53ecb9['message'],_0x3ee74a);_0x16f44c(_0x581005['error'](0x1f4,_0x53ecb9[_0x3766('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x518ece){var _0x393b54=this;return new Promise(function(_0x168de2,_0x1f5baa){return db[_0x3766('0x17')][_0x3766('0x1f')]({'raw':_0x518ece[_0x3766('0x19')]?_0x518ece[_0x3766('0x19')][_0x3766('0x18')]===undefined?!![]:![]:!![],'where':_0x518ece['options']?_0x518ece[_0x3766('0x19')][_0x3766('0x1a')]||null:null,'attributes':_0x518ece['options']?_0x518ece[_0x3766('0x19')][_0x3766('0x1b')]||null:null,'include':_0x518ece['options']?_0x518ece[_0x3766('0x19')][_0x3766('0x1d')]?_['map'](_0x518ece['options']['include'],function(_0xac0dc5){return{'model':db[_0xac0dc5['model']],'as':_0xac0dc5['as'],'attributes':_0xac0dc5[_0x3766('0x1b')],'include':_0xac0dc5[_0x3766('0x1d')]?_[_0x3766('0x1c')](_0xac0dc5[_0x3766('0x1d')],function(_0x4734dd){return{'model':db[_0x4734dd[_0x3766('0x1e')]],'as':_0x4734dd['as'],'attributes':_0x4734dd[_0x3766('0x1b')],'include':_0x4734dd[_0x3766('0x1d')]?_[_0x3766('0x1c')](_0x4734dd[_0x3766('0x1d')],function(_0xa4fded){return{'model':db[_0xa4fded['model']],'as':_0xa4fded['as'],'attributes':_0xa4fded[_0x3766('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3766('0xa')](function(_0x34d2ae){logger['info']('ShowVtigerAccount',_0x518ece);logger[_0x3766('0xe')](_0x3766('0x20'),_0x518ece,JSON[_0x3766('0x10')](_0x34d2ae));_0x168de2(_0x34d2ae);})[_0x3766('0x15')](function(_0x20a9c5){logger['error'](_0x3766('0x20'),_0x20a9c5['message'],_0x518ece);_0x1f5baa(_0x393b54[_0x3766('0x11')](0x1f4,_0x20a9c5[_0x3766('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index b5e3a1b..e2b71de 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0xb1de68,_0x4a194b){var _0x134f02=function(_0xb37976){while(--_0xb37976){_0xb1de68['push'](_0xb1de68['shift']());}};_0x134f02(++_0x4a194b);}(_0xadb5,0xad));var _0x5adb=function(_0x17af6d,_0x34e694){_0x17af6d=_0x17af6d-0x0;var _0x1800bb=_0xadb5[_0x17af6d];return _0x1800bb;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4a1dea,_0x4a780a){var _0x5a4459=function(_0x138bd7){while(--_0x138bd7){_0x4a1dea['push'](_0x4a1dea['shift']());}};_0x5a4459(++_0x4a780a);}(_0xadb5,0xad));var _0x5adb=function(_0x294df9,_0x44159c){_0x294df9=_0x294df9-0x0;var _0x14b969=_0xadb5[_0x294df9];return _0x14b969;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 28a4b31..5204e9f 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 _0x6224=['STRING','exports'];(function(_0x10427a,_0x1dfe34){var _0x45e8e2=function(_0x3f5fca){while(--_0x3f5fca){_0x10427a['push'](_0x10427a['shift']());}};_0x45e8e2(++_0x1dfe34);}(_0x6224,0x189));var _0x4622=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x6224[_0x3cae69];return _0x3128eb;};'use strict';var Sequelize=require('sequelize');module[_0x4622('0x0')]={'name':{'type':Sequelize[_0x4622('0x1')]},'description':{'type':Sequelize[_0x4622('0x1')]}}; \ No newline at end of file +var _0xd1ac=['sequelize','exports','STRING'];(function(_0x2729e1,_0x23507c){var _0x38a4cb=function(_0x592364){while(--_0x592364){_0x2729e1['push'](_0x2729e1['shift']());}};_0x38a4cb(++_0x23507c);}(_0xd1ac,0x16e));var _0xcd1a=function(_0x4dadd0,_0xd02549){_0x4dadd0=_0x4dadd0-0x0;var _0x3daaac=_0xd1ac[_0x4dadd0];return _0x3daaac;};'use strict';var Sequelize=require(_0xcd1a('0x0'));module[_0xcd1a('0x1')]={'name':{'type':Sequelize[_0xcd1a('0x2')]},'description':{'type':Sequelize[_0xcd1a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2631bf0..7c4d8c5 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 _0xf71c=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','create','body','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x10379e,_0x28f9a){var _0x7d604d=function(_0x5d7a29){while(--_0x5d7a29){_0x10379e['push'](_0x10379e['shift']());}};_0x7d604d(++_0x28f9a);}(_0xf71c,0xc7));var _0xcf71=function(_0x177ac1,_0x45b891){_0x177ac1=_0x177ac1-0x0;var _0x21dc92=_0xf71c[_0x177ac1];return _0x21dc92;};'use strict';var emlformat=require(_0xcf71('0x0'));var rimraf=require(_0xcf71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcf71('0x2'));var BPromise=require(_0xcf71('0x3'));var Mustache=require(_0xcf71('0x4'));var util=require('util');var path=require(_0xcf71('0x5'));var sox=require(_0xcf71('0x6'));var csv=require(_0xcf71('0x7'));var ejs=require(_0xcf71('0x8'));var fs=require('fs');var fs_extra=require(_0xcf71('0x9'));var _=require(_0xcf71('0xa'));var squel=require('squel');var crypto=require(_0xcf71('0xb'));var jsforce=require(_0xcf71('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcf71('0x7'));var querystring=require('querystring');var Papa=require(_0xcf71('0xd'));var Redis=require(_0xcf71('0xe'));var authService=require(_0xcf71('0xf'));var qs=require(_0xcf71('0x10'));var as=require(_0xcf71('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcf71('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xcf71('0x13'));var db=require(_0xcf71('0x14'))['db'];var jayson=require(_0xcf71('0x15'));var client=jayson[_0xcf71('0x16')][_0xcf71('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x56cc3a,_0xd774da,_0x37d018,_0x500da4){return new BPromise(function(_0x273f70,_0x57ef42){var _0x2f4d9b=_0x500da4||client;return _0x2f4d9b[_0xcf71('0x18')](_0x56cc3a,_0x37d018)[_0xcf71('0x19')](function(_0x111d1c){logger[_0xcf71('0x1a')](_0xcf71('0x1b'),_0xd774da,_0xcf71('0x1c'));logger[_0xcf71('0x1d')](_0xcf71('0x1e'),_0xd774da,_0xcf71('0x1c'),JSON[_0xcf71('0x1f')](_0x111d1c));if(_0x111d1c[_0xcf71('0x20')]){if(_0x111d1c[_0xcf71('0x20')]['code']===0x1f4){logger[_0xcf71('0x20')](_0xcf71('0x1b'),_0xd774da,_0x111d1c[_0xcf71('0x20')][_0xcf71('0x21')]);return _0x57ef42(_0x111d1c[_0xcf71('0x20')]['message']);}logger['error'](_0xcf71('0x1b'),_0xd774da,_0x111d1c['error'][_0xcf71('0x21')]);return _0x273f70(_0x111d1c[_0xcf71('0x20')][_0xcf71('0x21')]);}else{logger['info'](_0xcf71('0x1b'),_0xd774da,_0xcf71('0x1c'));_0x273f70(_0x111d1c[_0xcf71('0x22')]['message']);}})[_0xcf71('0x23')](function(_0x45b9fe){logger['error'](_0xcf71('0x1b'),_0xd774da,_0x45b9fe);_0x57ef42(_0x45b9fe);});});}function respondWithStatusCode(_0x4a3aab,_0x166847){_0x166847=_0x166847||0xcc;return function(_0x2739fe){if(_0x2739fe){return _0x4a3aab['sendStatus'](_0x166847);}return _0x4a3aab[_0xcf71('0x24')](_0x166847)[_0xcf71('0x25')]();};}function respondWithResult(_0x1df011,_0x1fd0b4){_0x1fd0b4=_0x1fd0b4||0xc8;return function(_0x16507c){if(_0x16507c){return _0x1df011[_0xcf71('0x24')](_0x1fd0b4)[_0xcf71('0x26')](_0x16507c);}};}function respondWithFilteredResult(_0x4888fb,_0x464182){return function(_0x1c045d){if(_0x1c045d){var _0x1780ff=typeof _0x464182[_0xcf71('0x27')]===_0xcf71('0x28')&&typeof _0x464182[_0xcf71('0x29')]===_0xcf71('0x28');var _0x4b95d1=_0x1c045d['count'];var _0x36edb2=_0x1780ff?0x0:_0x464182[_0xcf71('0x27')];var _0x370cf8=_0x1780ff?_0x1c045d[_0xcf71('0x2a')]:_0x464182[_0xcf71('0x27')]+_0x464182[_0xcf71('0x29')];var _0x33f80c;if(_0x370cf8>=_0x4b95d1){_0x370cf8=_0x4b95d1;_0x33f80c=0xc8;}else{_0x33f80c=0xce;}_0x4888fb[_0xcf71('0x24')](_0x33f80c);return _0x4888fb['set'](_0xcf71('0x2b'),_0x36edb2+'-'+_0x370cf8+'/'+_0x4b95d1)[_0xcf71('0x26')](_0x1c045d);}return null;};}function patchUpdates(_0x331fcc){return function(_0x113fa9){try{jsonpatch['apply'](_0x113fa9,_0x331fcc,!![]);}catch(_0x217f57){return BPromise[_0xcf71('0x2c')](_0x217f57);}return _0x113fa9[_0xcf71('0x2d')]();};}function saveUpdates(_0x4a7c88,_0x503ac4){return function(_0x10d35b){if(_0x10d35b){return _0x10d35b[_0xcf71('0x2e')](_0x4a7c88)[_0xcf71('0x19')](function(_0x3f752b){return _0x3f752b;});}return null;};}function removeEntity(_0x427037,_0x26f906){return function(_0x2eab08){if(_0x2eab08){return _0x2eab08[_0xcf71('0x2f')]()[_0xcf71('0x19')](function(){_0x427037[_0xcf71('0x24')](0xcc)[_0xcf71('0x25')]();});}};}function handleEntityNotFound(_0x90bc26,_0x75dc60){return function(_0x5acca7){if(!_0x5acca7){_0x90bc26[_0xcf71('0x30')](0x194);}return _0x5acca7;};}function handleError(_0x4bd76a,_0x5257c5){_0x5257c5=_0x5257c5||0x1f4;return function(_0x3bc5e8){logger[_0xcf71('0x20')](_0x3bc5e8[_0xcf71('0x31')]);if(_0x3bc5e8['name']){delete _0x3bc5e8[_0xcf71('0x32')];}_0x4bd76a[_0xcf71('0x24')](_0x5257c5)[_0xcf71('0x33')](_0x3bc5e8);};}exports[_0xcf71('0x34')]=function(_0x2b2c4d,_0x4d63e1){var _0x34d8d6={},_0x40275a={},_0x5057e3={'count':0x0,'rows':[]};var _0x47f785=_[_0xcf71('0x35')](db[_0xcf71('0x36')][_0xcf71('0x37')],function(_0x41fc19){return{'name':_0x41fc19[_0xcf71('0x38')],'type':_0x41fc19[_0xcf71('0x39')][_0xcf71('0x3a')]};});_0x40275a['model']=_[_0xcf71('0x35')](_0x47f785,'name');_0x40275a[_0xcf71('0x3b')]=_[_0xcf71('0x3c')](_0x2b2c4d[_0xcf71('0x3b')]);_0x40275a[_0xcf71('0x3d')]=_[_0xcf71('0x3e')](_0x40275a[_0xcf71('0x3f')],_0x40275a[_0xcf71('0x3b')]);_0x34d8d6[_0xcf71('0x40')]=_[_0xcf71('0x3e')](_0x40275a['model'],qs[_0xcf71('0x41')](_0x2b2c4d[_0xcf71('0x3b')][_0xcf71('0x41')]));_0x34d8d6[_0xcf71('0x40')]=_0x34d8d6[_0xcf71('0x40')][_0xcf71('0x42')]?_0x34d8d6[_0xcf71('0x40')]:_0x40275a[_0xcf71('0x3f')];if(!_0x2b2c4d[_0xcf71('0x3b')][_0xcf71('0x43')](_0xcf71('0x44'))){_0x34d8d6[_0xcf71('0x29')]=qs[_0xcf71('0x29')](_0x2b2c4d[_0xcf71('0x3b')][_0xcf71('0x29')]);_0x34d8d6[_0xcf71('0x27')]=qs[_0xcf71('0x27')](_0x2b2c4d['query'][_0xcf71('0x27')]);}_0x34d8d6['order']=qs['sort'](_0x2b2c4d[_0xcf71('0x3b')][_0xcf71('0x45')]);_0x34d8d6[_0xcf71('0x46')]=qs[_0xcf71('0x3d')](_[_0xcf71('0x47')](_0x2b2c4d[_0xcf71('0x3b')],_0x40275a['filters']),_0x47f785);if(_0x2b2c4d['query'][_0xcf71('0x48')]){_0x34d8d6[_0xcf71('0x46')]=_[_0xcf71('0x49')](_0x34d8d6[_0xcf71('0x46')],{'$or':_[_0xcf71('0x35')](_0x47f785,function(_0xd983d9){if(_0xd983d9[_0xcf71('0x39')]!==_0xcf71('0x4a')){var _0xe18618={};_0xe18618[_0xd983d9[_0xcf71('0x32')]]={'$like':'%'+_0x2b2c4d[_0xcf71('0x3b')][_0xcf71('0x48')]+'%'};return _0xe18618;}})});}_0x34d8d6=_['merge']({},_0x34d8d6,_0x2b2c4d[_0xcf71('0x4b')]);var _0x27506e={'where':_0x34d8d6[_0xcf71('0x46')]};return db[_0xcf71('0x36')][_0xcf71('0x2a')](_0x27506e)['then'](function(_0x5b6d52){_0x5057e3[_0xcf71('0x2a')]=_0x5b6d52;if(_0x2b2c4d[_0xcf71('0x3b')][_0xcf71('0x4c')]){_0x34d8d6['include']=[{'all':!![]}];}return db[_0xcf71('0x36')][_0xcf71('0x4d')](_0x34d8d6);})[_0xcf71('0x19')](function(_0x4c0e71){_0x5057e3[_0xcf71('0x4e')]=_0x4c0e71;return _0x5057e3;})['then'](respondWithFilteredResult(_0x4d63e1,_0x34d8d6))[_0xcf71('0x23')](handleError(_0x4d63e1,null));};exports['show']=function(_0x1ba67d,_0x3fc672){var _0xdfae45={'raw':![],'where':{'id':_0x1ba67d[_0xcf71('0x4f')]['id']}},_0x205fc4={};_0x205fc4[_0xcf71('0x3f')]=_[_0xcf71('0x3c')](db[_0xcf71('0x36')]['rawAttributes']);_0x205fc4[_0xcf71('0x3b')]=_['keys'](_0x1ba67d[_0xcf71('0x3b')]);_0x205fc4[_0xcf71('0x3d')]=_[_0xcf71('0x3e')](_0x205fc4[_0xcf71('0x3f')],_0x205fc4[_0xcf71('0x3b')]);_0xdfae45[_0xcf71('0x40')]=_['intersection'](_0x205fc4[_0xcf71('0x3f')],qs[_0xcf71('0x41')](_0x1ba67d['query'][_0xcf71('0x41')]));_0xdfae45[_0xcf71('0x40')]=_0xdfae45['attributes'][_0xcf71('0x42')]?_0xdfae45[_0xcf71('0x40')]:_0x205fc4[_0xcf71('0x3f')];if(_0x1ba67d[_0xcf71('0x3b')][_0xcf71('0x4c')]){_0xdfae45[_0xcf71('0x50')]=[{'all':!![]}];}_0xdfae45=_[_0xcf71('0x49')]({},_0xdfae45,_0x1ba67d['options']);return db['VtigerConfiguration'][_0xcf71('0x51')](_0xdfae45)['then'](handleEntityNotFound(_0x3fc672,null))[_0xcf71('0x19')](respondWithResult(_0x3fc672,null))['catch'](handleError(_0x3fc672,null));};exports[_0xcf71('0x52')]=function(_0x5b1d94,_0x1f5f6b){return db['VtigerConfiguration']['create'](_0x5b1d94[_0xcf71('0x53')],{})['then'](respondWithResult(_0x1f5f6b,0xc9))[_0xcf71('0x23')](handleError(_0x1f5f6b,null));};exports['update']=function(_0x425b79,_0x57dd3b){if(_0x425b79['body']['id']){delete _0x425b79[_0xcf71('0x53')]['id'];}return db[_0xcf71('0x36')][_0xcf71('0x51')]({'where':{'id':_0x425b79[_0xcf71('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57dd3b,null))['then'](saveUpdates(_0x425b79[_0xcf71('0x53')],null))['then'](respondWithResult(_0x57dd3b,null))['catch'](handleError(_0x57dd3b,null));};exports['destroy']=function(_0x1d9c72,_0x5cfac9){return db['VtigerConfiguration'][_0xcf71('0x51')]({'where':{'id':_0x1d9c72[_0xcf71('0x4f')]['id']}})[_0xcf71('0x19')](handleEntityNotFound(_0x5cfac9,null))[_0xcf71('0x19')](removeEntity(_0x5cfac9,null))[_0xcf71('0x23')](handleError(_0x5cfac9,null));};exports[_0xcf71('0x54')]=function(_0x7b0bd7,_0x56d22f,_0x11f532){var _0x36760e={};var _0x509257={};var _0x504113;var _0x5a2bb9;return db[_0xcf71('0x36')][_0xcf71('0x55')]({'where':{'id':_0x7b0bd7[_0xcf71('0x4f')]['id']}})[_0xcf71('0x19')](handleEntityNotFound(_0x56d22f,null))[_0xcf71('0x19')](function(_0x2a446f){if(_0x2a446f){_0x504113=_0x2a446f;_0x509257[_0xcf71('0x3f')]=_[_0xcf71('0x3c')](db[_0xcf71('0x56')][_0xcf71('0x37')]);_0x509257[_0xcf71('0x3b')]=_[_0xcf71('0x3c')](_0x7b0bd7[_0xcf71('0x3b')]);_0x509257[_0xcf71('0x3d')]=_[_0xcf71('0x3e')](_0x509257[_0xcf71('0x3f')],_0x509257[_0xcf71('0x3b')]);_0x36760e[_0xcf71('0x40')]=_['intersection'](_0x509257['model'],qs[_0xcf71('0x41')](_0x7b0bd7[_0xcf71('0x3b')][_0xcf71('0x41')]));_0x36760e[_0xcf71('0x40')]=_0x36760e[_0xcf71('0x40')][_0xcf71('0x42')]?_0x36760e[_0xcf71('0x40')]:_0x509257[_0xcf71('0x3f')];_0x36760e[_0xcf71('0x57')]=qs[_0xcf71('0x45')](_0x7b0bd7[_0xcf71('0x3b')]['sort']);_0x36760e[_0xcf71('0x46')]=qs[_0xcf71('0x3d')](_['pick'](_0x7b0bd7[_0xcf71('0x3b')],_0x509257['filters']));if(_0x7b0bd7['query'][_0xcf71('0x48')]){_0x36760e[_0xcf71('0x46')]=_['merge'](_0x36760e['where'],{'$or':_[_0xcf71('0x35')](_0x36760e[_0xcf71('0x40')],function(_0x5dd124){var _0x582a13={};_0x582a13[_0x5dd124]={'$like':'%'+_0x7b0bd7['query'][_0xcf71('0x48')]+'%'};return _0x582a13;})});}_0x36760e=_['merge']({},_0x36760e,_0x7b0bd7[_0xcf71('0x4b')]);return _0x504113['getFields'](_0x36760e);}})['then'](function(_0x3e021f){if(_0x3e021f){_0x5a2bb9=_0x3e021f['length'];if(!_0x7b0bd7[_0xcf71('0x3b')][_0xcf71('0x43')]('nolimit')){_0x36760e[_0xcf71('0x29')]=qs[_0xcf71('0x29')](_0x7b0bd7[_0xcf71('0x3b')]['limit']);_0x36760e['offset']=qs['offset'](_0x7b0bd7[_0xcf71('0x3b')][_0xcf71('0x27')]);}return _0x504113[_0xcf71('0x54')](_0x36760e);}})[_0xcf71('0x19')](function(_0x4262e9){if(_0x4262e9){return _0x4262e9?{'count':_0x5a2bb9,'rows':_0x4262e9}:null;}})[_0xcf71('0x19')](respondWithResult(_0x56d22f,null))[_0xcf71('0x23')](handleError(_0x56d22f,null));};exports['getSubjects']=function(_0x11c19f,_0x2815eb,_0x5b0943){var _0x28152d={};var _0x34a363={};var _0x357ce2;var _0x426d69;return db['VtigerConfiguration'][_0xcf71('0x55')]({'where':{'id':_0x11c19f[_0xcf71('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2815eb,null))['then'](function(_0x49f9d8){if(_0x49f9d8){_0x357ce2=_0x49f9d8;_0x34a363['model']=_[_0xcf71('0x3c')](db[_0xcf71('0x56')][_0xcf71('0x37')]);_0x34a363[_0xcf71('0x3b')]=_[_0xcf71('0x3c')](_0x11c19f[_0xcf71('0x3b')]);_0x34a363['filters']=_[_0xcf71('0x3e')](_0x34a363['model'],_0x34a363['query']);_0x28152d[_0xcf71('0x40')]=_[_0xcf71('0x3e')](_0x34a363['model'],qs[_0xcf71('0x41')](_0x11c19f[_0xcf71('0x3b')][_0xcf71('0x41')]));_0x28152d[_0xcf71('0x40')]=_0x28152d[_0xcf71('0x40')][_0xcf71('0x42')]?_0x28152d[_0xcf71('0x40')]:_0x34a363[_0xcf71('0x3f')];_0x28152d[_0xcf71('0x57')]=qs['sort'](_0x11c19f[_0xcf71('0x3b')][_0xcf71('0x45')]);_0x28152d[_0xcf71('0x46')]=qs[_0xcf71('0x3d')](_[_0xcf71('0x47')](_0x11c19f[_0xcf71('0x3b')],_0x34a363[_0xcf71('0x3d')]));if(_0x11c19f[_0xcf71('0x3b')][_0xcf71('0x48')]){_0x28152d['where']=_['merge'](_0x28152d[_0xcf71('0x46')],{'$or':_[_0xcf71('0x35')](_0x28152d['attributes'],function(_0xc6f2c3){var _0x18b479={};_0x18b479[_0xc6f2c3]={'$like':'%'+_0x11c19f[_0xcf71('0x3b')][_0xcf71('0x48')]+'%'};return _0x18b479;})});}_0x28152d=_[_0xcf71('0x49')]({},_0x28152d,_0x11c19f[_0xcf71('0x4b')]);return _0x357ce2[_0xcf71('0x58')](_0x28152d);}})['then'](function(_0x501b92){if(_0x501b92){_0x426d69=_0x501b92[_0xcf71('0x42')];if(!_0x11c19f['query'][_0xcf71('0x43')](_0xcf71('0x44'))){_0x28152d[_0xcf71('0x29')]=qs[_0xcf71('0x29')](_0x11c19f[_0xcf71('0x3b')][_0xcf71('0x29')]);_0x28152d[_0xcf71('0x27')]=qs['offset'](_0x11c19f[_0xcf71('0x3b')]['offset']);}return _0x357ce2['getSubjects'](_0x28152d);}})[_0xcf71('0x19')](function(_0x27af05){if(_0x27af05){return _0x27af05?{'count':_0x426d69,'rows':_0x27af05}:null;}})[_0xcf71('0x19')](respondWithResult(_0x2815eb,null))[_0xcf71('0x23')](handleError(_0x2815eb,null));};exports[_0xcf71('0x59')]=function(_0x9c7fa6,_0x3813fb,_0x44662f){var _0x2e2933={};var _0x2cb322={};var _0x545d50;var _0x5974ec;return db['VtigerConfiguration'][_0xcf71('0x55')]({'where':{'id':_0x9c7fa6['params']['id']}})['then'](handleEntityNotFound(_0x3813fb,null))[_0xcf71('0x19')](function(_0x33a64f){if(_0x33a64f){_0x545d50=_0x33a64f;_0x2cb322[_0xcf71('0x3f')]=_['keys'](db[_0xcf71('0x56')]['rawAttributes']);_0x2cb322[_0xcf71('0x3b')]=_['keys'](_0x9c7fa6['query']);_0x2cb322['filters']=_['intersection'](_0x2cb322['model'],_0x2cb322[_0xcf71('0x3b')]);_0x2e2933[_0xcf71('0x40')]=_[_0xcf71('0x3e')](_0x2cb322[_0xcf71('0x3f')],qs[_0xcf71('0x41')](_0x9c7fa6[_0xcf71('0x3b')]['fields']));_0x2e2933['attributes']=_0x2e2933[_0xcf71('0x40')][_0xcf71('0x42')]?_0x2e2933[_0xcf71('0x40')]:_0x2cb322[_0xcf71('0x3f')];_0x2e2933[_0xcf71('0x57')]=qs[_0xcf71('0x45')](_0x9c7fa6[_0xcf71('0x3b')][_0xcf71('0x45')]);_0x2e2933[_0xcf71('0x46')]=qs[_0xcf71('0x3d')](_[_0xcf71('0x47')](_0x9c7fa6[_0xcf71('0x3b')],_0x2cb322[_0xcf71('0x3d')]));if(_0x9c7fa6[_0xcf71('0x3b')][_0xcf71('0x48')]){_0x2e2933[_0xcf71('0x46')]=_['merge'](_0x2e2933[_0xcf71('0x46')],{'$or':_[_0xcf71('0x35')](_0x2e2933['attributes'],function(_0x9e2b2c){var _0x490b21={};_0x490b21[_0x9e2b2c]={'$like':'%'+_0x9c7fa6[_0xcf71('0x3b')][_0xcf71('0x48')]+'%'};return _0x490b21;})});}_0x2e2933=_[_0xcf71('0x49')]({},_0x2e2933,_0x9c7fa6[_0xcf71('0x4b')]);return _0x545d50[_0xcf71('0x59')](_0x2e2933);}})['then'](function(_0x3a3fee){if(_0x3a3fee){_0x5974ec=_0x3a3fee[_0xcf71('0x42')];if(!_0x9c7fa6[_0xcf71('0x3b')][_0xcf71('0x43')]('nolimit')){_0x2e2933[_0xcf71('0x29')]=qs['limit'](_0x9c7fa6['query'][_0xcf71('0x29')]);_0x2e2933[_0xcf71('0x27')]=qs[_0xcf71('0x27')](_0x9c7fa6[_0xcf71('0x3b')][_0xcf71('0x27')]);}return _0x545d50[_0xcf71('0x59')](_0x2e2933);}})['then'](function(_0x3129f1){if(_0x3129f1){return _0x3129f1?{'count':_0x5974ec,'rows':_0x3129f1}:null;}})[_0xcf71('0x19')](respondWithResult(_0x3813fb,null))[_0xcf71('0x23')](handleError(_0x3813fb,null));}; \ No newline at end of file +var _0xb870=['index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','fields','length','create','body','find','getFields','getSubjects','VtigerField','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','set','apply','reject','save','update','destroy','sendStatus','stack','name','send'];(function(_0x79f3a7,_0x2e66a7){var _0x3c3ca1=function(_0x5913da){while(--_0x5913da){_0x79f3a7['push'](_0x79f3a7['shift']());}};_0x3c3ca1(++_0x2e66a7);}(_0xb870,0x194));var _0x0b87=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0xb870[_0xcf5436];return _0xc4f5c8;};'use strict';var emlformat=require(_0x0b87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b87('0x1'));var jsonpatch=require(_0x0b87('0x2'));var rp=require('request-promise');var moment=require(_0x0b87('0x3'));var BPromise=require(_0x0b87('0x4'));var Mustache=require('mustache');var util=require(_0x0b87('0x5'));var path=require(_0x0b87('0x6'));var sox=require('sox');var csv=require(_0x0b87('0x7'));var ejs=require(_0x0b87('0x8'));var fs=require('fs');var fs_extra=require(_0x0b87('0x9'));var _=require(_0x0b87('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0b87('0xb'));var deskjs=require(_0x0b87('0xc'));var toCsv=require(_0x0b87('0x7'));var querystring=require('querystring');var Papa=require(_0x0b87('0xd'));var Redis=require(_0x0b87('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0b87('0xf'));var as=require(_0x0b87('0x10'));var hardwareService=require(_0x0b87('0x11'));var logger=require('../../config/logger')(_0x0b87('0x12'));var utils=require(_0x0b87('0x13'));var config=require(_0x0b87('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b87('0x15'))['db'];var jayson=require(_0x0b87('0x16'));var client=jayson[_0x0b87('0x17')][_0x0b87('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4d1c39,_0x165772,_0x8fe55a,_0x54e250){return new BPromise(function(_0x79d82d,_0x2c160e){var _0x17af5f=_0x54e250||client;return _0x17af5f['request'](_0x4d1c39,_0x8fe55a)[_0x0b87('0x19')](function(_0x25430e){logger[_0x0b87('0x1a')]('VtigerConfiguration,\x20%s,\x20%s',_0x165772,_0x0b87('0x1b'));logger['debug'](_0x0b87('0x1c'),_0x165772,'request\x20sent',JSON['stringify'](_0x25430e));if(_0x25430e[_0x0b87('0x1d')]){if(_0x25430e[_0x0b87('0x1d')][_0x0b87('0x1e')]===0x1f4){logger[_0x0b87('0x1d')](_0x0b87('0x1f'),_0x165772,_0x25430e[_0x0b87('0x1d')]['message']);return _0x2c160e(_0x25430e[_0x0b87('0x1d')][_0x0b87('0x20')]);}logger['error'](_0x0b87('0x1f'),_0x165772,_0x25430e['error']['message']);return _0x79d82d(_0x25430e[_0x0b87('0x1d')][_0x0b87('0x20')]);}else{logger[_0x0b87('0x1a')](_0x0b87('0x1f'),_0x165772,_0x0b87('0x1b'));_0x79d82d(_0x25430e[_0x0b87('0x21')]['message']);}})[_0x0b87('0x22')](function(_0x2d82ad){logger[_0x0b87('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x165772,_0x2d82ad);_0x2c160e(_0x2d82ad);});});}function respondWithStatusCode(_0x3234cb,_0x1a28b7){_0x1a28b7=_0x1a28b7||0xcc;return function(_0x283e0f){if(_0x283e0f){return _0x3234cb['sendStatus'](_0x1a28b7);}return _0x3234cb[_0x0b87('0x23')](_0x1a28b7)[_0x0b87('0x24')]();};}function respondWithResult(_0x440a41,_0x55f43e){_0x55f43e=_0x55f43e||0xc8;return function(_0x2d4c01){if(_0x2d4c01){return _0x440a41[_0x0b87('0x23')](_0x55f43e)[_0x0b87('0x25')](_0x2d4c01);}};}function respondWithFilteredResult(_0x36fd72,_0x11f8a7){return function(_0x5e5303){if(_0x5e5303){var _0x47126d=typeof _0x11f8a7['offset']===_0x0b87('0x26')&&typeof _0x11f8a7[_0x0b87('0x27')]===_0x0b87('0x26');var _0x196f0c=_0x5e5303[_0x0b87('0x28')];var _0x558942=_0x47126d?0x0:_0x11f8a7['offset'];var _0x3aa560=_0x47126d?_0x5e5303[_0x0b87('0x28')]:_0x11f8a7['offset']+_0x11f8a7[_0x0b87('0x27')];var _0x4ceece;if(_0x3aa560>=_0x196f0c){_0x3aa560=_0x196f0c;_0x4ceece=0xc8;}else{_0x4ceece=0xce;}_0x36fd72[_0x0b87('0x23')](_0x4ceece);return _0x36fd72[_0x0b87('0x29')]('Content-Range',_0x558942+'-'+_0x3aa560+'/'+_0x196f0c)['json'](_0x5e5303);}return null;};}function patchUpdates(_0x57dfd0){return function(_0x35cb58){try{jsonpatch[_0x0b87('0x2a')](_0x35cb58,_0x57dfd0,!![]);}catch(_0x139e20){return BPromise[_0x0b87('0x2b')](_0x139e20);}return _0x35cb58[_0x0b87('0x2c')]();};}function saveUpdates(_0x487848,_0x5b1f3d){return function(_0x328831){if(_0x328831){return _0x328831[_0x0b87('0x2d')](_0x487848)[_0x0b87('0x19')](function(_0x19f800){return _0x19f800;});}return null;};}function removeEntity(_0x34cb35,_0x50c7c0){return function(_0xec9006){if(_0xec9006){return _0xec9006[_0x0b87('0x2e')]()[_0x0b87('0x19')](function(){_0x34cb35[_0x0b87('0x23')](0xcc)[_0x0b87('0x24')]();});}};}function handleEntityNotFound(_0xd69103,_0x5b8c25){return function(_0x5b15fd){if(!_0x5b15fd){_0xd69103[_0x0b87('0x2f')](0x194);}return _0x5b15fd;};}function handleError(_0x1dc746,_0x1d3ff8){_0x1d3ff8=_0x1d3ff8||0x1f4;return function(_0x477596){logger[_0x0b87('0x1d')](_0x477596[_0x0b87('0x30')]);if(_0x477596['name']){delete _0x477596[_0x0b87('0x31')];}_0x1dc746[_0x0b87('0x23')](_0x1d3ff8)[_0x0b87('0x32')](_0x477596);};}exports[_0x0b87('0x33')]=function(_0x5e9ab4,_0x4d03d3){var _0x1ef43f={},_0x4de3a8={},_0xd8f048={'count':0x0,'rows':[]};var _0x207783=_[_0x0b87('0x34')](db[_0x0b87('0x35')][_0x0b87('0x36')],function(_0x50190f){return{'name':_0x50190f[_0x0b87('0x37')],'type':_0x50190f[_0x0b87('0x38')][_0x0b87('0x39')]};});_0x4de3a8[_0x0b87('0x3a')]=_[_0x0b87('0x34')](_0x207783,_0x0b87('0x31'));_0x4de3a8[_0x0b87('0x3b')]=_[_0x0b87('0x3c')](_0x5e9ab4[_0x0b87('0x3b')]);_0x4de3a8['filters']=_[_0x0b87('0x3d')](_0x4de3a8[_0x0b87('0x3a')],_0x4de3a8[_0x0b87('0x3b')]);_0x1ef43f['attributes']=_[_0x0b87('0x3d')](_0x4de3a8[_0x0b87('0x3a')],qs['fields'](_0x5e9ab4['query']['fields']));_0x1ef43f[_0x0b87('0x3e')]=_0x1ef43f[_0x0b87('0x3e')]['length']?_0x1ef43f[_0x0b87('0x3e')]:_0x4de3a8[_0x0b87('0x3a')];if(!_0x5e9ab4[_0x0b87('0x3b')][_0x0b87('0x3f')](_0x0b87('0x40'))){_0x1ef43f['limit']=qs[_0x0b87('0x27')](_0x5e9ab4[_0x0b87('0x3b')][_0x0b87('0x27')]);_0x1ef43f[_0x0b87('0x41')]=qs[_0x0b87('0x41')](_0x5e9ab4[_0x0b87('0x3b')]['offset']);}_0x1ef43f[_0x0b87('0x42')]=qs[_0x0b87('0x43')](_0x5e9ab4[_0x0b87('0x3b')][_0x0b87('0x43')]);_0x1ef43f[_0x0b87('0x44')]=qs[_0x0b87('0x45')](_[_0x0b87('0x46')](_0x5e9ab4[_0x0b87('0x3b')],_0x4de3a8['filters']),_0x207783);if(_0x5e9ab4[_0x0b87('0x3b')]['filter']){_0x1ef43f['where']=_[_0x0b87('0x47')](_0x1ef43f[_0x0b87('0x44')],{'$or':_[_0x0b87('0x34')](_0x207783,function(_0x482452){if(_0x482452['type']!==_0x0b87('0x48')){var _0x212e03={};_0x212e03[_0x482452['name']]={'$like':'%'+_0x5e9ab4[_0x0b87('0x3b')][_0x0b87('0x49')]+'%'};return _0x212e03;}})});}_0x1ef43f=_[_0x0b87('0x47')]({},_0x1ef43f,_0x5e9ab4[_0x0b87('0x4a')]);var _0x219531={'where':_0x1ef43f[_0x0b87('0x44')]};return db[_0x0b87('0x35')]['count'](_0x219531)[_0x0b87('0x19')](function(_0x4d25c4){_0xd8f048[_0x0b87('0x28')]=_0x4d25c4;if(_0x5e9ab4[_0x0b87('0x3b')][_0x0b87('0x4b')]){_0x1ef43f[_0x0b87('0x4c')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x0b87('0x4d')](_0x1ef43f);})['then'](function(_0x4d4546){_0xd8f048[_0x0b87('0x4e')]=_0x4d4546;return _0xd8f048;})[_0x0b87('0x19')](respondWithFilteredResult(_0x4d03d3,_0x1ef43f))[_0x0b87('0x22')](handleError(_0x4d03d3,null));};exports[_0x0b87('0x4f')]=function(_0x5b2250,_0x9e45e5){var _0x3dcd16={'raw':![],'where':{'id':_0x5b2250[_0x0b87('0x50')]['id']}},_0x2b1315={};_0x2b1315['model']=_[_0x0b87('0x3c')](db[_0x0b87('0x35')][_0x0b87('0x36')]);_0x2b1315[_0x0b87('0x3b')]=_[_0x0b87('0x3c')](_0x5b2250[_0x0b87('0x3b')]);_0x2b1315['filters']=_[_0x0b87('0x3d')](_0x2b1315[_0x0b87('0x3a')],_0x2b1315['query']);_0x3dcd16[_0x0b87('0x3e')]=_[_0x0b87('0x3d')](_0x2b1315['model'],qs[_0x0b87('0x51')](_0x5b2250['query'][_0x0b87('0x51')]));_0x3dcd16[_0x0b87('0x3e')]=_0x3dcd16[_0x0b87('0x3e')][_0x0b87('0x52')]?_0x3dcd16[_0x0b87('0x3e')]:_0x2b1315['model'];if(_0x5b2250[_0x0b87('0x3b')][_0x0b87('0x4b')]){_0x3dcd16[_0x0b87('0x4c')]=[{'all':!![]}];}_0x3dcd16=_[_0x0b87('0x47')]({},_0x3dcd16,_0x5b2250[_0x0b87('0x4a')]);return db[_0x0b87('0x35')]['find'](_0x3dcd16)[_0x0b87('0x19')](handleEntityNotFound(_0x9e45e5,null))[_0x0b87('0x19')](respondWithResult(_0x9e45e5,null))['catch'](handleError(_0x9e45e5,null));};exports['create']=function(_0x7f5ad,_0x29cd5b){return db['VtigerConfiguration'][_0x0b87('0x53')](_0x7f5ad[_0x0b87('0x54')],{})[_0x0b87('0x19')](respondWithResult(_0x29cd5b,0xc9))[_0x0b87('0x22')](handleError(_0x29cd5b,null));};exports['update']=function(_0x590a90,_0x201cde){if(_0x590a90['body']['id']){delete _0x590a90[_0x0b87('0x54')]['id'];}return db[_0x0b87('0x35')][_0x0b87('0x55')]({'where':{'id':_0x590a90['params']['id']}})[_0x0b87('0x19')](handleEntityNotFound(_0x201cde,null))[_0x0b87('0x19')](saveUpdates(_0x590a90[_0x0b87('0x54')],null))[_0x0b87('0x19')](respondWithResult(_0x201cde,null))[_0x0b87('0x22')](handleError(_0x201cde,null));};exports[_0x0b87('0x2e')]=function(_0x5a05e2,_0xa21326){return db[_0x0b87('0x35')][_0x0b87('0x55')]({'where':{'id':_0x5a05e2['params']['id']}})[_0x0b87('0x19')](handleEntityNotFound(_0xa21326,null))[_0x0b87('0x19')](removeEntity(_0xa21326,null))[_0x0b87('0x22')](handleError(_0xa21326,null));};exports[_0x0b87('0x56')]=function(_0x4ce8a7,_0x44f46d,_0x104fc5){var _0x51f6ff={};var _0x13e550={};var _0x1472b5;var _0x2cf9be;return db[_0x0b87('0x35')]['findOne']({'where':{'id':_0x4ce8a7[_0x0b87('0x50')]['id']}})['then'](handleEntityNotFound(_0x44f46d,null))[_0x0b87('0x19')](function(_0x5970df){if(_0x5970df){_0x1472b5=_0x5970df;_0x13e550['model']=_[_0x0b87('0x3c')](db['VtigerField'][_0x0b87('0x36')]);_0x13e550['query']=_[_0x0b87('0x3c')](_0x4ce8a7[_0x0b87('0x3b')]);_0x13e550['filters']=_[_0x0b87('0x3d')](_0x13e550[_0x0b87('0x3a')],_0x13e550[_0x0b87('0x3b')]);_0x51f6ff[_0x0b87('0x3e')]=_[_0x0b87('0x3d')](_0x13e550[_0x0b87('0x3a')],qs[_0x0b87('0x51')](_0x4ce8a7[_0x0b87('0x3b')][_0x0b87('0x51')]));_0x51f6ff[_0x0b87('0x3e')]=_0x51f6ff[_0x0b87('0x3e')][_0x0b87('0x52')]?_0x51f6ff[_0x0b87('0x3e')]:_0x13e550[_0x0b87('0x3a')];_0x51f6ff[_0x0b87('0x42')]=qs['sort'](_0x4ce8a7[_0x0b87('0x3b')][_0x0b87('0x43')]);_0x51f6ff[_0x0b87('0x44')]=qs[_0x0b87('0x45')](_[_0x0b87('0x46')](_0x4ce8a7['query'],_0x13e550[_0x0b87('0x45')]));if(_0x4ce8a7[_0x0b87('0x3b')][_0x0b87('0x49')]){_0x51f6ff[_0x0b87('0x44')]=_[_0x0b87('0x47')](_0x51f6ff[_0x0b87('0x44')],{'$or':_[_0x0b87('0x34')](_0x51f6ff[_0x0b87('0x3e')],function(_0x42fce2){var _0x1eb9fc={};_0x1eb9fc[_0x42fce2]={'$like':'%'+_0x4ce8a7[_0x0b87('0x3b')]['filter']+'%'};return _0x1eb9fc;})});}_0x51f6ff=_['merge']({},_0x51f6ff,_0x4ce8a7['options']);return _0x1472b5[_0x0b87('0x56')](_0x51f6ff);}})[_0x0b87('0x19')](function(_0x3f511e){if(_0x3f511e){_0x2cf9be=_0x3f511e[_0x0b87('0x52')];if(!_0x4ce8a7[_0x0b87('0x3b')]['hasOwnProperty']('nolimit')){_0x51f6ff[_0x0b87('0x27')]=qs[_0x0b87('0x27')](_0x4ce8a7['query'][_0x0b87('0x27')]);_0x51f6ff[_0x0b87('0x41')]=qs[_0x0b87('0x41')](_0x4ce8a7[_0x0b87('0x3b')][_0x0b87('0x41')]);}return _0x1472b5['getFields'](_0x51f6ff);}})[_0x0b87('0x19')](function(_0x470045){if(_0x470045){return _0x470045?{'count':_0x2cf9be,'rows':_0x470045}:null;}})[_0x0b87('0x19')](respondWithResult(_0x44f46d,null))[_0x0b87('0x22')](handleError(_0x44f46d,null));};exports[_0x0b87('0x57')]=function(_0x311489,_0x5deed1,_0x56bb1d){var _0x18800f={};var _0x336822={};var _0x5db7cd;var _0x3c17e4;return db[_0x0b87('0x35')]['findOne']({'where':{'id':_0x311489[_0x0b87('0x50')]['id']}})['then'](handleEntityNotFound(_0x5deed1,null))[_0x0b87('0x19')](function(_0x215788){if(_0x215788){_0x5db7cd=_0x215788;_0x336822['model']=_[_0x0b87('0x3c')](db[_0x0b87('0x58')][_0x0b87('0x36')]);_0x336822[_0x0b87('0x3b')]=_[_0x0b87('0x3c')](_0x311489[_0x0b87('0x3b')]);_0x336822[_0x0b87('0x45')]=_[_0x0b87('0x3d')](_0x336822['model'],_0x336822[_0x0b87('0x3b')]);_0x18800f[_0x0b87('0x3e')]=_[_0x0b87('0x3d')](_0x336822[_0x0b87('0x3a')],qs[_0x0b87('0x51')](_0x311489[_0x0b87('0x3b')][_0x0b87('0x51')]));_0x18800f[_0x0b87('0x3e')]=_0x18800f[_0x0b87('0x3e')][_0x0b87('0x52')]?_0x18800f['attributes']:_0x336822['model'];_0x18800f['order']=qs[_0x0b87('0x43')](_0x311489[_0x0b87('0x3b')][_0x0b87('0x43')]);_0x18800f[_0x0b87('0x44')]=qs[_0x0b87('0x45')](_[_0x0b87('0x46')](_0x311489['query'],_0x336822[_0x0b87('0x45')]));if(_0x311489['query'][_0x0b87('0x49')]){_0x18800f[_0x0b87('0x44')]=_[_0x0b87('0x47')](_0x18800f[_0x0b87('0x44')],{'$or':_['map'](_0x18800f[_0x0b87('0x3e')],function(_0x10f7f4){var _0xfbbc8a={};_0xfbbc8a[_0x10f7f4]={'$like':'%'+_0x311489[_0x0b87('0x3b')][_0x0b87('0x49')]+'%'};return _0xfbbc8a;})});}_0x18800f=_['merge']({},_0x18800f,_0x311489['options']);return _0x5db7cd['getSubjects'](_0x18800f);}})[_0x0b87('0x19')](function(_0x58d802){if(_0x58d802){_0x3c17e4=_0x58d802[_0x0b87('0x52')];if(!_0x311489[_0x0b87('0x3b')][_0x0b87('0x3f')]('nolimit')){_0x18800f[_0x0b87('0x27')]=qs[_0x0b87('0x27')](_0x311489[_0x0b87('0x3b')]['limit']);_0x18800f[_0x0b87('0x41')]=qs[_0x0b87('0x41')](_0x311489[_0x0b87('0x3b')][_0x0b87('0x41')]);}return _0x5db7cd[_0x0b87('0x57')](_0x18800f);}})[_0x0b87('0x19')](function(_0x12f6aa){if(_0x12f6aa){return _0x12f6aa?{'count':_0x3c17e4,'rows':_0x12f6aa}:null;}})[_0x0b87('0x19')](respondWithResult(_0x5deed1,null))[_0x0b87('0x22')](handleError(_0x5deed1,null));};exports[_0x0b87('0x59')]=function(_0xaaec07,_0x3caecc,_0x173670){var _0x3ad631={};var _0x35a7b0={};var _0x5179eb;var _0x42f937;return db[_0x0b87('0x35')][_0x0b87('0x5a')]({'where':{'id':_0xaaec07[_0x0b87('0x50')]['id']}})[_0x0b87('0x19')](handleEntityNotFound(_0x3caecc,null))['then'](function(_0x4c6cab){if(_0x4c6cab){_0x5179eb=_0x4c6cab;_0x35a7b0[_0x0b87('0x3a')]=_['keys'](db['VtigerField'][_0x0b87('0x36')]);_0x35a7b0['query']=_['keys'](_0xaaec07['query']);_0x35a7b0[_0x0b87('0x45')]=_[_0x0b87('0x3d')](_0x35a7b0['model'],_0x35a7b0['query']);_0x3ad631['attributes']=_[_0x0b87('0x3d')](_0x35a7b0[_0x0b87('0x3a')],qs[_0x0b87('0x51')](_0xaaec07[_0x0b87('0x3b')][_0x0b87('0x51')]));_0x3ad631[_0x0b87('0x3e')]=_0x3ad631['attributes'][_0x0b87('0x52')]?_0x3ad631[_0x0b87('0x3e')]:_0x35a7b0[_0x0b87('0x3a')];_0x3ad631['order']=qs[_0x0b87('0x43')](_0xaaec07[_0x0b87('0x3b')][_0x0b87('0x43')]);_0x3ad631[_0x0b87('0x44')]=qs[_0x0b87('0x45')](_[_0x0b87('0x46')](_0xaaec07[_0x0b87('0x3b')],_0x35a7b0[_0x0b87('0x45')]));if(_0xaaec07[_0x0b87('0x3b')][_0x0b87('0x49')]){_0x3ad631[_0x0b87('0x44')]=_['merge'](_0x3ad631[_0x0b87('0x44')],{'$or':_[_0x0b87('0x34')](_0x3ad631[_0x0b87('0x3e')],function(_0x2f87a5){var _0x13c055={};_0x13c055[_0x2f87a5]={'$like':'%'+_0xaaec07[_0x0b87('0x3b')][_0x0b87('0x49')]+'%'};return _0x13c055;})});}_0x3ad631=_[_0x0b87('0x47')]({},_0x3ad631,_0xaaec07[_0x0b87('0x4a')]);return _0x5179eb[_0x0b87('0x59')](_0x3ad631);}})[_0x0b87('0x19')](function(_0x1d04bc){if(_0x1d04bc){_0x42f937=_0x1d04bc[_0x0b87('0x52')];if(!_0xaaec07[_0x0b87('0x3b')]['hasOwnProperty']('nolimit')){_0x3ad631[_0x0b87('0x27')]=qs[_0x0b87('0x27')](_0xaaec07[_0x0b87('0x3b')]['limit']);_0x3ad631[_0x0b87('0x41')]=qs[_0x0b87('0x41')](_0xaaec07['query'][_0x0b87('0x41')]);}return _0x5179eb['getDescriptions'](_0x3ad631);}})[_0x0b87('0x19')](function(_0xd4a1ab){if(_0xd4a1ab){return _0xd4a1ab?{'count':_0x42f937,'rows':_0xd4a1ab}:null;}})[_0x0b87('0x19')](respondWithResult(_0x3caecc,null))[_0x0b87('0x22')](handleError(_0x3caecc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 902c696..72c4be1 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 _0x2897=['./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util','../../config/logger','api','bluebird','../../config/environment'];(function(_0x372128,_0x4a05d6){var _0x3c57c1=function(_0x224e30){while(--_0x224e30){_0x372128['push'](_0x372128['shift']());}};_0x3c57c1(++_0x4a05d6);}(_0x2897,0x1ce));var _0x7289=function(_0x3e5b5f,_0x391308){_0x3e5b5f=_0x3e5b5f-0x0;var _0x1782a6=_0x2897[_0x3e5b5f];return _0x1782a6;};'use strict';var _=require(_0x7289('0x0'));var util=require(_0x7289('0x1'));var logger=require(_0x7289('0x2'))(_0x7289('0x3'));var moment=require('moment');var BPromise=require(_0x7289('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7289('0x5'));var attributes=require(_0x7289('0x6'));module[_0x7289('0x7')]=function(_0x4e2adb,_0x118ba9){return _0x4e2adb['define'](_0x7289('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb05=['exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x411d2e,_0xfa96e2){var _0x3d276f=function(_0x2395bc){while(--_0x2395bc){_0x411d2e['push'](_0x411d2e['shift']());}};_0x3d276f(++_0xfa96e2);}(_0xbb05,0xba));var _0x5bb0=function(_0x50abfa,_0x33324d){_0x50abfa=_0x50abfa-0x0;var _0x1fc97b=_0xbb05[_0x50abfa];return _0x1fc97b;};'use strict';var _=require('lodash');var util=require(_0x5bb0('0x0'));var logger=require(_0x5bb0('0x1'))(_0x5bb0('0x2'));var moment=require(_0x5bb0('0x3'));var BPromise=require(_0x5bb0('0x4'));var rp=require(_0x5bb0('0x5'));var fs=require('fs');var path=require(_0x5bb0('0x6'));var rimraf=require('rimraf');var config=require(_0x5bb0('0x7'));var attributes=require(_0x5bb0('0x8'));module[_0x5bb0('0x9')]=function(_0x2ba51b,_0x474276){return _0x2ba51b[_0x5bb0('0xa')](_0x5bb0('0xb'),attributes,{'tableName':_0x5bb0('0xc'),'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 ddfaa6f..3165801 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 _0x3da4=['then','request\x20sent','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0xf27a18,_0x1b5b0f){var _0x35c069=function(_0x304f54){while(--_0x304f54){_0xf27a18['push'](_0xf27a18['shift']());}};_0x35c069(++_0x1b5b0f);}(_0x3da4,0x177));var _0x43da=function(_0xa8213,_0x38ed6e){_0xa8213=_0xa8213-0x0;var _0x4e739b=_0x3da4[_0xa8213];return _0x4e739b;};'use strict';var _=require(_0x43da('0x0'));var util=require('util');var moment=require(_0x43da('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43da('0x2'));var db=require(_0x43da('0x3'))['db'];var utils=require(_0x43da('0x4'));var logger=require(_0x43da('0x5'))(_0x43da('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x43da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x70b1c7,_0x1cecc1,_0x22ec76){return new BPromise(function(_0x573b15,_0x50aeb0){return client[_0x43da('0x8')](_0x70b1c7,_0x22ec76)[_0x43da('0x9')](function(_0xc28186){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x1cecc1,_0x43da('0xa'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1cecc1,_0x43da('0xa'),JSON['stringify'](_0xc28186));if(_0xc28186[_0x43da('0xb')]){if(_0xc28186[_0x43da('0xb')][_0x43da('0xc')]===0x1f4){logger['error'](_0x43da('0xd'),_0x1cecc1,_0xc28186['error'][_0x43da('0xe')]);return _0x50aeb0(_0xc28186[_0x43da('0xb')][_0x43da('0xe')]);}logger[_0x43da('0xb')](_0x43da('0xd'),_0x1cecc1,_0xc28186['error'][_0x43da('0xe')]);return _0x573b15(_0xc28186[_0x43da('0xb')]['message']);}else{logger[_0x43da('0xf')](_0x43da('0xd'),_0x1cecc1,_0x43da('0xa'));_0x573b15(_0xc28186['result'][_0x43da('0xe')]);}})['catch'](function(_0x290e60){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1cecc1,_0x290e60);_0x50aeb0(_0x290e60);});});} \ No newline at end of file +var _0xcf70=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xcf70,0x11d));var _0x0cf7=function(_0x3a0bae,_0x4b9194){_0x3a0bae=_0x3a0bae-0x0;var _0x384b13=_0xcf70[_0x3a0bae];return _0x384b13;};'use strict';var _=require(_0x0cf7('0x0'));var util=require(_0x0cf7('0x1'));var moment=require(_0x0cf7('0x2'));var BPromise=require(_0x0cf7('0x3'));var rs=require(_0x0cf7('0x4'));var fs=require('fs');var Redis=require(_0x0cf7('0x5'));var db=require(_0x0cf7('0x6'))['db'];var utils=require(_0x0cf7('0x7'));var logger=require(_0x0cf7('0x8'))(_0x0cf7('0x9'));var config=require('../../config/environment');var jayson=require(_0x0cf7('0xa'));var client=jayson[_0x0cf7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33806b,_0x44ee96,_0x360380){return new BPromise(function(_0x104fb4,_0x2c8528){return client['request'](_0x33806b,_0x360380)[_0x0cf7('0xc')](function(_0x19f8f1){logger[_0x0cf7('0xd')](_0x0cf7('0xe'),_0x44ee96,'request\x20sent');logger[_0x0cf7('0xf')](_0x0cf7('0x10'),_0x44ee96,_0x0cf7('0x11'),JSON[_0x0cf7('0x12')](_0x19f8f1));if(_0x19f8f1[_0x0cf7('0x13')]){if(_0x19f8f1[_0x0cf7('0x13')][_0x0cf7('0x14')]===0x1f4){logger[_0x0cf7('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x44ee96,_0x19f8f1[_0x0cf7('0x13')][_0x0cf7('0x15')]);return _0x2c8528(_0x19f8f1[_0x0cf7('0x13')]['message']);}logger[_0x0cf7('0x13')](_0x0cf7('0xe'),_0x44ee96,_0x19f8f1['error'][_0x0cf7('0x15')]);return _0x104fb4(_0x19f8f1['error'][_0x0cf7('0x15')]);}else{logger[_0x0cf7('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x44ee96,_0x0cf7('0x11'));_0x104fb4(_0x19f8f1[_0x0cf7('0x16')]['message']);}})[_0x0cf7('0x17')](function(_0x29151b){logger[_0x0cf7('0x13')](_0x0cf7('0xe'),_0x44ee96,_0x29151b);_0x2c8528(_0x29151b);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index f558560..b7c7780 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 _0x2ef3=['show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','/:id','isAuthenticated'];(function(_0x80fec,_0x196330){var _0x56c96a=function(_0x122201){while(--_0x122201){_0x80fec['push'](_0x80fec['shift']());}};_0x56c96a(++_0x196330);}(_0x2ef3,0xba));var _0x32ef=function(_0xddf9d3,_0x200ddf){_0xddf9d3=_0xddf9d3-0x0;var _0x81e924=_0x2ef3[_0xddf9d3];return _0x81e924;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0xd')]('/',auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller['update']);router['delete'](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file +var _0x2ef3=['show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','/:id','isAuthenticated'];(function(_0x2ccef3,_0x315039){var _0x26f0e8=function(_0x132018){while(--_0x132018){_0x2ccef3['push'](_0x2ccef3['shift']());}};_0x26f0e8(++_0x315039);}(_0x2ef3,0xba));var _0x32ef=function(_0x5f33cd,_0xcb723b){_0x5f33cd=_0x5f33cd-0x0;var _0x356558=_0x2ef3[_0x5f33cd];return _0x356558;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0xd')]('/',auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller['update']);router['delete'](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c498f4a..2f9f55b 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 _0xd0bb=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','STRING','string','customVariable'];(function(_0x236b4b,_0x5a39f9){var _0x5220b2=function(_0x26215b){while(--_0x26215b){_0x236b4b['push'](_0x236b4b['shift']());}};_0x5220b2(++_0x5a39f9);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4fde9a,_0x5d1eda){_0x4fde9a=_0x4fde9a-0x0;var _0x58f321=_0xd0bb[_0x4fde9a];return _0x58f321;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'type':{'type':Sequelize[_0xbd0b('0x2')]('string',_0xbd0b('0x3'),'customVariable',_0xbd0b('0x4'),_0xbd0b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbd0b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbd0b('0x2')](_0xbd0b('0x7'),_0xbd0b('0x3'),_0xbd0b('0x8'))},'keyContent':{'type':Sequelize[_0xbd0b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbd0b('0x6')]},'customField':{'type':Sequelize[_0xbd0b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd0b('0x6')]}}; \ No newline at end of file +var _0x60c2=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','exports'];(function(_0x1b33b6,_0xc179bb){var _0x31a7be=function(_0x20e02d){while(--_0x20e02d){_0x1b33b6['push'](_0x1b33b6['shift']());}};_0x31a7be(++_0xc179bb);}(_0x60c2,0x8f));var _0x260c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x60c2[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0x260c('0x0')]={'type':{'type':Sequelize[_0x260c('0x1')](_0x260c('0x2'),_0x260c('0x3'),_0x260c('0x4'),_0x260c('0x5'),_0x260c('0x6')),'defaultValue':_0x260c('0x2')},'content':{'type':Sequelize[_0x260c('0x7')]},'key':{'type':Sequelize[_0x260c('0x7')]},'keyType':{'type':Sequelize[_0x260c('0x1')](_0x260c('0x2'),'variable',_0x260c('0x4'))},'keyContent':{'type':Sequelize[_0x260c('0x7')]},'idField':{'type':Sequelize[_0x260c('0x7')]},'nameField':{'type':Sequelize[_0x260c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x260c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index fbc6ad5..1812325 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 _0xe9ca=['count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','findAll','rows','catch','show','params','include','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x57330e,_0x1123fc){var _0x33c870=function(_0x488157){while(--_0x488157){_0x57330e['push'](_0x57330e['shift']());}};_0x33c870(++_0x1123fc);}(_0xe9ca,0x1db));var _0xae9c=function(_0x52c511,_0x13f96d){_0x52c511=_0x52c511-0x0;var _0x518408=_0xe9ca[_0x52c511];return _0x518408;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae9c('0x0'));var zipdir=require(_0xae9c('0x1'));var jsonpatch=require(_0xae9c('0x2'));var rp=require(_0xae9c('0x3'));var moment=require(_0xae9c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae9c('0x5'));var path=require(_0xae9c('0x6'));var sox=require(_0xae9c('0x7'));var csv=require(_0xae9c('0x8'));var ejs=require(_0xae9c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae9c('0xa'));var squel=require(_0xae9c('0xb'));var crypto=require(_0xae9c('0xc'));var jsforce=require(_0xae9c('0xd'));var deskjs=require(_0xae9c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xae9c('0xf'));var Papa=require(_0xae9c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xae9c('0x11'));var as=require(_0xae9c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae9c('0x13'))(_0xae9c('0x14'));var utils=require(_0xae9c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xae9c('0x16'))['db'];function respondWithStatusCode(_0x4e6422,_0x28e469){_0x28e469=_0x28e469||0xcc;return function(_0x1d0b46){if(_0x1d0b46){return _0x4e6422[_0xae9c('0x17')](_0x28e469);}return _0x4e6422[_0xae9c('0x18')](_0x28e469)[_0xae9c('0x19')]();};}function respondWithResult(_0x1b6e6c,_0x25ad0a){_0x25ad0a=_0x25ad0a||0xc8;return function(_0x406b6d){if(_0x406b6d){return _0x1b6e6c['status'](_0x25ad0a)[_0xae9c('0x1a')](_0x406b6d);}};}function respondWithFilteredResult(_0x40735f,_0x4530ce){return function(_0x3c5086){if(_0x3c5086){var _0xeee5c3=typeof _0x4530ce['offset']===_0xae9c('0x1b')&&typeof _0x4530ce[_0xae9c('0x1c')]===_0xae9c('0x1b');var _0x2a074e=_0x3c5086[_0xae9c('0x1d')];var _0x5ad39e=_0xeee5c3?0x0:_0x4530ce[_0xae9c('0x1e')];var _0x166db0=_0xeee5c3?_0x3c5086[_0xae9c('0x1d')]:_0x4530ce['offset']+_0x4530ce[_0xae9c('0x1c')];var _0x4ef1ca;if(_0x166db0>=_0x2a074e){_0x166db0=_0x2a074e;_0x4ef1ca=0xc8;}else{_0x4ef1ca=0xce;}_0x40735f['status'](_0x4ef1ca);return _0x40735f[_0xae9c('0x1f')](_0xae9c('0x20'),_0x5ad39e+'-'+_0x166db0+'/'+_0x2a074e)[_0xae9c('0x1a')](_0x3c5086);}return null;};}function patchUpdates(_0xc33971){return function(_0x2fc43a){try{jsonpatch[_0xae9c('0x21')](_0x2fc43a,_0xc33971,!![]);}catch(_0x444802){return BPromise['reject'](_0x444802);}return _0x2fc43a['save']();};}function saveUpdates(_0x1b2142,_0x17c25b){return function(_0x27f3f1){if(_0x27f3f1){return _0x27f3f1[_0xae9c('0x22')](_0x1b2142)[_0xae9c('0x23')](function(_0x3c2d0d){return _0x3c2d0d;});}return null;};}function removeEntity(_0x1d6d23,_0x2e3f53){return function(_0x2c2d44){if(_0x2c2d44){return _0x2c2d44[_0xae9c('0x24')]()['then'](function(){_0x1d6d23[_0xae9c('0x18')](0xcc)[_0xae9c('0x19')]();});}};}function handleEntityNotFound(_0x12722e,_0x598d2d){return function(_0x38e2ad){if(!_0x38e2ad){_0x12722e[_0xae9c('0x17')](0x194);}return _0x38e2ad;};}function handleError(_0x5183ba,_0x5292dc){_0x5292dc=_0x5292dc||0x1f4;return function(_0x4a6c31){logger[_0xae9c('0x25')](_0x4a6c31[_0xae9c('0x26')]);if(_0x4a6c31[_0xae9c('0x27')]){delete _0x4a6c31[_0xae9c('0x27')];}_0x5183ba[_0xae9c('0x18')](_0x5292dc)['send'](_0x4a6c31);};}exports[_0xae9c('0x28')]=function(_0x347839,_0x1dc0a4){var _0x39a9de={},_0x5995f6={},_0x57b5aa={'count':0x0,'rows':[]};var _0x22b77c=_[_0xae9c('0x29')](db[_0xae9c('0x2a')][_0xae9c('0x2b')],function(_0x45ea63){return{'name':_0x45ea63[_0xae9c('0x2c')],'type':_0x45ea63[_0xae9c('0x2d')][_0xae9c('0x2e')]};});_0x5995f6[_0xae9c('0x2f')]=_[_0xae9c('0x29')](_0x22b77c,'name');_0x5995f6[_0xae9c('0x30')]=_[_0xae9c('0x31')](_0x347839[_0xae9c('0x30')]);_0x5995f6[_0xae9c('0x32')]=_[_0xae9c('0x33')](_0x5995f6[_0xae9c('0x2f')],_0x5995f6['query']);_0x39a9de[_0xae9c('0x34')]=_[_0xae9c('0x33')](_0x5995f6['model'],qs[_0xae9c('0x35')](_0x347839[_0xae9c('0x30')]['fields']));_0x39a9de[_0xae9c('0x34')]=_0x39a9de[_0xae9c('0x34')][_0xae9c('0x36')]?_0x39a9de['attributes']:_0x5995f6[_0xae9c('0x2f')];if(!_0x347839[_0xae9c('0x30')][_0xae9c('0x37')](_0xae9c('0x38'))){_0x39a9de['limit']=qs[_0xae9c('0x1c')](_0x347839[_0xae9c('0x30')][_0xae9c('0x1c')]);_0x39a9de['offset']=qs[_0xae9c('0x1e')](_0x347839['query'][_0xae9c('0x1e')]);}_0x39a9de['order']=qs[_0xae9c('0x39')](_0x347839[_0xae9c('0x30')]['sort']);_0x39a9de['where']=qs[_0xae9c('0x32')](_[_0xae9c('0x3a')](_0x347839['query'],_0x5995f6[_0xae9c('0x32')]),_0x22b77c);if(_0x347839[_0xae9c('0x30')][_0xae9c('0x3b')]){_0x39a9de['where']=_[_0xae9c('0x3c')](_0x39a9de[_0xae9c('0x3d')],{'$or':_[_0xae9c('0x29')](_0x22b77c,function(_0x1ad9c5){if(_0x1ad9c5[_0xae9c('0x2d')]!=='VIRTUAL'){var _0x349ad5={};_0x349ad5[_0x1ad9c5[_0xae9c('0x27')]]={'$like':'%'+_0x347839[_0xae9c('0x30')]['filter']+'%'};return _0x349ad5;}})});}_0x39a9de=_[_0xae9c('0x3c')]({},_0x39a9de,_0x347839[_0xae9c('0x3e')]);var _0x3385d1={'where':_0x39a9de[_0xae9c('0x3d')]};return db[_0xae9c('0x2a')]['count'](_0x3385d1)['then'](function(_0x45b3c4){_0x57b5aa['count']=_0x45b3c4;if(_0x347839[_0xae9c('0x30')][_0xae9c('0x3f')]){_0x39a9de['include']=[{'all':!![]}];}return db[_0xae9c('0x2a')][_0xae9c('0x40')](_0x39a9de);})[_0xae9c('0x23')](function(_0x374f34){_0x57b5aa[_0xae9c('0x41')]=_0x374f34;return _0x57b5aa;})[_0xae9c('0x23')](respondWithFilteredResult(_0x1dc0a4,_0x39a9de))[_0xae9c('0x42')](handleError(_0x1dc0a4,null));};exports[_0xae9c('0x43')]=function(_0x539765,_0x3d0b0e){var _0x5a24a8={'raw':!![],'where':{'id':_0x539765[_0xae9c('0x44')]['id']}},_0x2d1316={};_0x2d1316[_0xae9c('0x2f')]=_[_0xae9c('0x31')](db[_0xae9c('0x2a')]['rawAttributes']);_0x2d1316[_0xae9c('0x30')]=_['keys'](_0x539765[_0xae9c('0x30')]);_0x2d1316[_0xae9c('0x32')]=_[_0xae9c('0x33')](_0x2d1316['model'],_0x2d1316[_0xae9c('0x30')]);_0x5a24a8['attributes']=_[_0xae9c('0x33')](_0x2d1316[_0xae9c('0x2f')],qs[_0xae9c('0x35')](_0x539765[_0xae9c('0x30')][_0xae9c('0x35')]));_0x5a24a8['attributes']=_0x5a24a8[_0xae9c('0x34')][_0xae9c('0x36')]?_0x5a24a8[_0xae9c('0x34')]:_0x2d1316[_0xae9c('0x2f')];if(_0x539765[_0xae9c('0x30')][_0xae9c('0x3f')]){_0x5a24a8[_0xae9c('0x45')]=[{'all':!![]}];}_0x5a24a8=_['merge']({},_0x5a24a8,_0x539765[_0xae9c('0x3e')]);return db[_0xae9c('0x2a')]['find'](_0x5a24a8)['then'](handleEntityNotFound(_0x3d0b0e,null))[_0xae9c('0x23')](respondWithResult(_0x3d0b0e,null))[_0xae9c('0x42')](handleError(_0x3d0b0e,null));};exports[_0xae9c('0x46')]=function(_0x3eb59a,_0x394b76){return db['VtigerField'][_0xae9c('0x46')](_0x3eb59a[_0xae9c('0x47')],{})[_0xae9c('0x23')](respondWithResult(_0x394b76,0xc9))[_0xae9c('0x42')](handleError(_0x394b76,null));};exports['update']=function(_0x516e17,_0xcc20ce){if(_0x516e17[_0xae9c('0x47')]['id']){delete _0x516e17['body']['id'];}return db[_0xae9c('0x2a')]['find']({'where':{'id':_0x516e17[_0xae9c('0x44')]['id']}})[_0xae9c('0x23')](handleEntityNotFound(_0xcc20ce,null))[_0xae9c('0x23')](saveUpdates(_0x516e17['body'],null))['then'](respondWithResult(_0xcc20ce,null))[_0xae9c('0x42')](handleError(_0xcc20ce,null));};exports[_0xae9c('0x24')]=function(_0x1e855b,_0x3c3338){return db['VtigerField']['find']({'where':{'id':_0x1e855b[_0xae9c('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c3338,null))[_0xae9c('0x23')](removeEntity(_0x3c3338,null))['catch'](handleError(_0x3c3338,null));}; \ No newline at end of file +var _0x0625=['destroy','rimraf','request-promise','moment','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','VtigerField','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','catch','show','params','length','includeAll','include','options','find','create','body'];(function(_0x32a2cd,_0x4b4e64){var _0x5c73e4=function(_0x156ab9){while(--_0x156ab9){_0x32a2cd['push'](_0x32a2cd['shift']());}};_0x5c73e4(++_0x4b4e64);}(_0x0625,0x199));var _0x5062=function(_0x2025dc,_0x36409d){_0x2025dc=_0x2025dc-0x0;var _0x472e1d=_0x0625[_0x2025dc];return _0x472e1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5062('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5062('0x1'));var moment=require(_0x5062('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5062('0x3'));var util=require(_0x5062('0x4'));var path=require(_0x5062('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5062('0x6'));var fs=require('fs');var fs_extra=require(_0x5062('0x7'));var _=require('lodash');var squel=require(_0x5062('0x8'));var crypto=require('crypto');var jsforce=require(_0x5062('0x9'));var deskjs=require(_0x5062('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5062('0xb'));var Papa=require('papaparse');var Redis=require(_0x5062('0xc'));var authService=require(_0x5062('0xd'));var qs=require(_0x5062('0xe'));var as=require(_0x5062('0xf'));var hardwareService=require(_0x5062('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x5062('0x11'));var config=require(_0x5062('0x12'));var licenseUtil=require(_0x5062('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eb51c,_0x45236c){_0x45236c=_0x45236c||0xcc;return function(_0x5c98ee){if(_0x5c98ee){return _0x1eb51c[_0x5062('0x14')](_0x45236c);}return _0x1eb51c[_0x5062('0x15')](_0x45236c)[_0x5062('0x16')]();};}function respondWithResult(_0x35893f,_0x5e3e42){_0x5e3e42=_0x5e3e42||0xc8;return function(_0x44fe60){if(_0x44fe60){return _0x35893f[_0x5062('0x15')](_0x5e3e42)['json'](_0x44fe60);}};}function respondWithFilteredResult(_0x4154a7,_0x4ed9b0){return function(_0x47c396){if(_0x47c396){var _0x4a87bb=typeof _0x4ed9b0[_0x5062('0x17')]===_0x5062('0x18')&&typeof _0x4ed9b0[_0x5062('0x19')]===_0x5062('0x18');var _0x480660=_0x47c396[_0x5062('0x1a')];var _0x7bd1e7=_0x4a87bb?0x0:_0x4ed9b0[_0x5062('0x17')];var _0x2647b0=_0x4a87bb?_0x47c396['count']:_0x4ed9b0[_0x5062('0x17')]+_0x4ed9b0[_0x5062('0x19')];var _0x5b13d0;if(_0x2647b0>=_0x480660){_0x2647b0=_0x480660;_0x5b13d0=0xc8;}else{_0x5b13d0=0xce;}_0x4154a7[_0x5062('0x15')](_0x5b13d0);return _0x4154a7[_0x5062('0x1b')]('Content-Range',_0x7bd1e7+'-'+_0x2647b0+'/'+_0x480660)['json'](_0x47c396);}return null;};}function patchUpdates(_0x4b97e3){return function(_0xdf7b55){try{jsonpatch['apply'](_0xdf7b55,_0x4b97e3,!![]);}catch(_0x4528f3){return BPromise[_0x5062('0x1c')](_0x4528f3);}return _0xdf7b55[_0x5062('0x1d')]();};}function saveUpdates(_0x2f7e3c,_0x4aeab1){return function(_0x10a84e){if(_0x10a84e){return _0x10a84e[_0x5062('0x1e')](_0x2f7e3c)[_0x5062('0x1f')](function(_0x4a0f6a){return _0x4a0f6a;});}return null;};}function removeEntity(_0x43f8ac,_0x5d89ad){return function(_0x3189e4){if(_0x3189e4){return _0x3189e4['destroy']()[_0x5062('0x1f')](function(){_0x43f8ac[_0x5062('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c6ddd,_0x445905){return function(_0x20a1f8){if(!_0x20a1f8){_0x8c6ddd['sendStatus'](0x194);}return _0x20a1f8;};}function handleError(_0x55a354,_0x333cb7){_0x333cb7=_0x333cb7||0x1f4;return function(_0x229c86){logger[_0x5062('0x20')](_0x229c86[_0x5062('0x21')]);if(_0x229c86[_0x5062('0x22')]){delete _0x229c86['name'];}_0x55a354[_0x5062('0x15')](_0x333cb7)[_0x5062('0x23')](_0x229c86);};}exports['index']=function(_0x30c9e6,_0x568343){var _0x5163c7={},_0x3ae86d={},_0x8042e0={'count':0x0,'rows':[]};var _0x40ea82=_['map'](db[_0x5062('0x24')]['rawAttributes'],function(_0x1f7da4){return{'name':_0x1f7da4[_0x5062('0x25')],'type':_0x1f7da4[_0x5062('0x26')][_0x5062('0x27')]};});_0x3ae86d[_0x5062('0x28')]=_[_0x5062('0x29')](_0x40ea82,_0x5062('0x22'));_0x3ae86d[_0x5062('0x2a')]=_[_0x5062('0x2b')](_0x30c9e6[_0x5062('0x2a')]);_0x3ae86d['filters']=_[_0x5062('0x2c')](_0x3ae86d[_0x5062('0x28')],_0x3ae86d[_0x5062('0x2a')]);_0x5163c7['attributes']=_['intersection'](_0x3ae86d['model'],qs[_0x5062('0x2d')](_0x30c9e6[_0x5062('0x2a')]['fields']));_0x5163c7[_0x5062('0x2e')]=_0x5163c7['attributes']['length']?_0x5163c7[_0x5062('0x2e')]:_0x3ae86d[_0x5062('0x28')];if(!_0x30c9e6[_0x5062('0x2a')][_0x5062('0x2f')](_0x5062('0x30'))){_0x5163c7['limit']=qs[_0x5062('0x19')](_0x30c9e6['query']['limit']);_0x5163c7[_0x5062('0x17')]=qs[_0x5062('0x17')](_0x30c9e6[_0x5062('0x2a')]['offset']);}_0x5163c7['order']=qs['sort'](_0x30c9e6['query'][_0x5062('0x31')]);_0x5163c7[_0x5062('0x32')]=qs[_0x5062('0x33')](_[_0x5062('0x34')](_0x30c9e6[_0x5062('0x2a')],_0x3ae86d[_0x5062('0x33')]),_0x40ea82);if(_0x30c9e6[_0x5062('0x2a')][_0x5062('0x35')]){_0x5163c7[_0x5062('0x32')]=_[_0x5062('0x36')](_0x5163c7['where'],{'$or':_[_0x5062('0x29')](_0x40ea82,function(_0x17b7fb){if(_0x17b7fb[_0x5062('0x26')]!==_0x5062('0x37')){var _0x1cb09c={};_0x1cb09c[_0x17b7fb[_0x5062('0x22')]]={'$like':'%'+_0x30c9e6['query'][_0x5062('0x35')]+'%'};return _0x1cb09c;}})});}_0x5163c7=_['merge']({},_0x5163c7,_0x30c9e6['options']);var _0x17a19b={'where':_0x5163c7[_0x5062('0x32')]};return db[_0x5062('0x24')]['count'](_0x17a19b)[_0x5062('0x1f')](function(_0xe751bf){_0x8042e0['count']=_0xe751bf;if(_0x30c9e6[_0x5062('0x2a')]['includeAll']){_0x5163c7['include']=[{'all':!![]}];}return db[_0x5062('0x24')][_0x5062('0x38')](_0x5163c7);})[_0x5062('0x1f')](function(_0x326134){_0x8042e0['rows']=_0x326134;return _0x8042e0;})[_0x5062('0x1f')](respondWithFilteredResult(_0x568343,_0x5163c7))[_0x5062('0x39')](handleError(_0x568343,null));};exports[_0x5062('0x3a')]=function(_0x8004e8,_0x17f488){var _0x23ed48={'raw':!![],'where':{'id':_0x8004e8[_0x5062('0x3b')]['id']}},_0x90425b={};_0x90425b[_0x5062('0x28')]=_[_0x5062('0x2b')](db[_0x5062('0x24')]['rawAttributes']);_0x90425b[_0x5062('0x2a')]=_[_0x5062('0x2b')](_0x8004e8[_0x5062('0x2a')]);_0x90425b['filters']=_[_0x5062('0x2c')](_0x90425b[_0x5062('0x28')],_0x90425b[_0x5062('0x2a')]);_0x23ed48[_0x5062('0x2e')]=_[_0x5062('0x2c')](_0x90425b[_0x5062('0x28')],qs[_0x5062('0x2d')](_0x8004e8[_0x5062('0x2a')][_0x5062('0x2d')]));_0x23ed48[_0x5062('0x2e')]=_0x23ed48['attributes'][_0x5062('0x3c')]?_0x23ed48[_0x5062('0x2e')]:_0x90425b[_0x5062('0x28')];if(_0x8004e8[_0x5062('0x2a')][_0x5062('0x3d')]){_0x23ed48[_0x5062('0x3e')]=[{'all':!![]}];}_0x23ed48=_[_0x5062('0x36')]({},_0x23ed48,_0x8004e8[_0x5062('0x3f')]);return db[_0x5062('0x24')][_0x5062('0x40')](_0x23ed48)[_0x5062('0x1f')](handleEntityNotFound(_0x17f488,null))['then'](respondWithResult(_0x17f488,null))[_0x5062('0x39')](handleError(_0x17f488,null));};exports[_0x5062('0x41')]=function(_0x1ac312,_0x3da8c5){return db[_0x5062('0x24')][_0x5062('0x41')](_0x1ac312[_0x5062('0x42')],{})[_0x5062('0x1f')](respondWithResult(_0x3da8c5,0xc9))[_0x5062('0x39')](handleError(_0x3da8c5,null));};exports['update']=function(_0xd91737,_0x2047c6){if(_0xd91737[_0x5062('0x42')]['id']){delete _0xd91737[_0x5062('0x42')]['id'];}return db[_0x5062('0x24')][_0x5062('0x40')]({'where':{'id':_0xd91737[_0x5062('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2047c6,null))[_0x5062('0x1f')](saveUpdates(_0xd91737['body'],null))[_0x5062('0x1f')](respondWithResult(_0x2047c6,null))[_0x5062('0x39')](handleError(_0x2047c6,null));};exports[_0x5062('0x43')]=function(_0x2e601f,_0x47e053){return db['VtigerField'][_0x5062('0x40')]({'where':{'id':_0x2e601f[_0x5062('0x3b')]['id']}})[_0x5062('0x1f')](handleEntityNotFound(_0x47e053,null))['then'](removeEntity(_0x47e053,null))['catch'](handleError(_0x47e053,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1381b31..547cd7f 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x3ed824,_0x1ea959){var _0x2204c9=function(_0x5592ed){while(--_0x5592ed){_0x3ed824['push'](_0x3ed824['shift']());}};_0x2204c9(++_0x1ea959);}(_0x7a54,0x106));var _0x47a5=function(_0x2906e2,_0x4e78a3){_0x2906e2=_0x2906e2-0x0;var _0x239098=_0x7a54[_0x2906e2];return _0x239098;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index b1c07a8..2cc36b1 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 _0x7072=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0xd6db21,_0x1d08f3){var _0x3b96a0=function(_0x157017){while(--_0x157017){_0xd6db21['push'](_0xd6db21['shift']());}};_0x3b96a0(++_0x1d08f3);}(_0x7072,0x138));var _0x2707=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x7072[_0x125ff8];return _0x2d9ef;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});} \ No newline at end of file +var _0xafcd=['debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x206c6d,_0x45624d){var _0x429e29=function(_0x41a5c1){while(--_0x41a5c1){_0x206c6d['push'](_0x206c6d['shift']());}};_0x429e29(++_0x45624d);}(_0xafcd,0x157));var _0xdafc=function(_0x4ae2fb,_0x1c1c67){_0x4ae2fb=_0x4ae2fb-0x0;var _0x4f5268=_0xafcd[_0x4ae2fb];return _0x4f5268;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var moment=require(_0xdafc('0x2'));var BPromise=require(_0xdafc('0x3'));var rs=require(_0xdafc('0x4'));var fs=require('fs');var Redis=require(_0xdafc('0x5'));var db=require(_0xdafc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdafc('0x7'))(_0xdafc('0x8'));var config=require(_0xdafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdafc('0xa')][_0xdafc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33adc9,_0x52872c,_0x24f2e7){return new BPromise(function(_0x255125,_0x397db6){return client[_0xdafc('0xc')](_0x33adc9,_0x24f2e7)[_0xdafc('0xd')](function(_0x241787){logger[_0xdafc('0xe')](_0xdafc('0xf'),_0x52872c,_0xdafc('0x10'));logger[_0xdafc('0x11')](_0xdafc('0x12'),_0x52872c,'request\x20sent',JSON['stringify'](_0x241787));if(_0x241787[_0xdafc('0x13')]){if(_0x241787[_0xdafc('0x13')][_0xdafc('0x14')]===0x1f4){logger[_0xdafc('0x13')](_0xdafc('0xf'),_0x52872c,_0x241787['error']['message']);return _0x397db6(_0x241787['error'][_0xdafc('0x15')]);}logger['error'](_0xdafc('0xf'),_0x52872c,_0x241787['error'][_0xdafc('0x15')]);return _0x255125(_0x241787[_0xdafc('0x13')][_0xdafc('0x15')]);}else{logger[_0xdafc('0xe')]('VtigerField,\x20%s,\x20%s',_0x52872c,'request\x20sent');_0x255125(_0x241787[_0xdafc('0x16')][_0xdafc('0x15')]);}})[_0xdafc('0x17')](function(_0x5bfac1){logger['error'](_0xdafc('0xf'),_0x52872c,_0x5bfac1);_0x397db6(_0x5bfac1);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f43b1ba..28eb632 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 _0xfd20=['destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','update'];(function(_0x5529c7,_0x204602){var _0x507f58=function(_0x49a77f){while(--_0x49a77f){_0x5529c7['push'](_0x5529c7['shift']());}};_0x507f58(++_0x204602);}(_0xfd20,0x66));var _0x0fd2=function(_0x443111,_0x3c94ae){_0x443111=_0x443111-0x0;var _0x3056c5=_0xfd20[_0x443111];return _0x3056c5;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x4'));var controller=require(_0x0fd2('0x5'));router[_0x0fd2('0x6')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x8')]);router['get']('/:id',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x9')]);router[_0x0fd2('0x6')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0x6')]('/:id/fields',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xc')]);router['post']('/',auth[_0x0fd2('0x7')](),controller['create']);router[_0x0fd2('0xd')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xe')]);router[_0x0fd2('0xf')](_0x0fd2('0x10'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x11')]);router['delete']('/:id',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x12')]);module[_0x0fd2('0x13')]=router; \ No newline at end of file +var _0xfc9b=['express','Router','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0xfc9b,0x74));var _0xbfc9=function(_0x29cc61,_0x3a14d1){_0x29cc61=_0x29cc61-0x0;var _0x5c8dc2=_0xfc9b[_0x29cc61];return _0x5c8dc2;};'use strict';var multer=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var path=require(_0xbfc9('0x2'));var timeout=require(_0xbfc9('0x3'));var express=require(_0xbfc9('0x4'));var router=express[_0xbfc9('0x5')]();var fs_extra=require(_0xbfc9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbfc9('0x7'));var config=require('../../config/environment');var controller=require(_0xbfc9('0x8'));router[_0xbfc9('0x9')]('/',auth['isAuthenticated'](),controller[_0xbfc9('0xa')]);router[_0xbfc9('0x9')](_0xbfc9('0xb'),auth[_0xbfc9('0xc')](),controller['show']);router[_0xbfc9('0x9')]('/:id/configurations',auth[_0xbfc9('0xc')](),controller['getConfigurations']);router[_0xbfc9('0x9')]('/:id/fields',auth[_0xbfc9('0xc')](),controller[_0xbfc9('0xd')]);router[_0xbfc9('0xe')]('/',auth[_0xbfc9('0xc')](),controller[_0xbfc9('0xf')]);router[_0xbfc9('0xe')]('/:id/configurations',auth[_0xbfc9('0xc')](),controller[_0xbfc9('0x10')]);router['put'](_0xbfc9('0xb'),auth['isAuthenticated'](),controller[_0xbfc9('0x11')]);router[_0xbfc9('0x12')](_0xbfc9('0xb'),auth[_0xbfc9('0xc')](),controller['destroy']);module[_0xbfc9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 32ccd24..8ea0a2c 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 _0x9b77=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0x9b77,0x17e));var _0x79b7=function(_0x207140,_0x4c6556){_0x207140=_0x207140-0x0;var _0x39e8cf=_0x9b77[_0x207140];return _0x39e8cf;};'use strict';var Sequelize=require(_0x79b7('0x0'));module[_0x79b7('0x1')]={'name':{'type':Sequelize[_0x79b7('0x2')]},'description':{'type':Sequelize[_0x79b7('0x2')]},'username':{'type':Sequelize[_0x79b7('0x2')],'unique':_0x79b7('0x3')},'password':{'type':Sequelize[_0x79b7('0x2')]},'token':{'type':Sequelize[_0x79b7('0x2')]},'remoteUri':{'type':Sequelize[_0x79b7('0x2')],'unique':_0x79b7('0x4')},'authType':{'type':Sequelize[_0x79b7('0x5')](_0x79b7('0x6'),_0x79b7('0x7')),'defaultValue':_0x79b7('0x6')},'serverUrl':{'type':Sequelize[_0x79b7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x79b7('0x5')](_0x79b7('0x8'),_0x79b7('0x9')),'defaultValue':_0x79b7('0x8')}}; \ No newline at end of file +var _0x4e62=['ENUM','token','password','integrationTab','sequelize','STRING','remoteUri'];(function(_0x2a9d64,_0x12e22f){var _0x865660=function(_0x2f9c9f){while(--_0x2f9c9f){_0x2a9d64['push'](_0x2a9d64['shift']());}};_0x865660(++_0x12e22f);}(_0x4e62,0x17e));var _0x24e6=function(_0x274033,_0x1035af){_0x274033=_0x274033-0x0;var _0x27ba3e=_0x4e62[_0x274033];return _0x27ba3e;};'use strict';var Sequelize=require(_0x24e6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x24e6('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x24e6('0x1')]},'remoteUri':{'type':Sequelize[_0x24e6('0x1')],'unique':_0x24e6('0x2')},'authType':{'type':Sequelize[_0x24e6('0x3')]('password',_0x24e6('0x4')),'defaultValue':_0x24e6('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x24e6('0x3')](_0x24e6('0x6'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 69f5e4c..49c3476 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 _0xc780=['message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','ZendeskAccount','findAll','rows','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','nolimit','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','authType','remoteUri','slice','substring','lastIndexOf','GET','ticket_fields','password','headers','format','Basic\x20%s','username','base64','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b778b,_0x4cf753){var _0x1c7151=function(_0x47be9b){while(--_0x47be9b){_0x4b778b['push'](_0x4b778b['shift']());}};_0x1c7151(++_0x4cf753);}(_0xc780,0xd4));var _0x0c78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc780[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0c78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c78('0x1'));var jsonpatch=require(_0x0c78('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0c78('0x3'));var Mustache=require(_0x0c78('0x4'));var util=require(_0x0c78('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0c78('0x6'));var ejs=require(_0x0c78('0x7'));var fs=require('fs');var fs_extra=require(_0x0c78('0x8'));var _=require(_0x0c78('0x9'));var squel=require(_0x0c78('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0c78('0xb'));var toCsv=require(_0x0c78('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c78('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x0c78('0xd'));var hardwareService=require(_0x0c78('0xe'));var logger=require('../../config/logger')(_0x0c78('0xf'));var utils=require(_0x0c78('0x10'));var config=require(_0x0c78('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c78('0x12'))['db'];var integrations=require(_0x0c78('0x13'));var jayson=require('jayson/promise');var client=jayson[_0x0c78('0x14')][_0x0c78('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x31e6a1,_0xb97d84,_0x5c37c0,_0x12e157){return new BPromise(function(_0x25d926,_0x2216a6){var _0x1f00ac=_0x12e157||client;return _0x1f00ac['request'](_0x31e6a1,_0x5c37c0)['then'](function(_0x5a3c35){logger[_0x0c78('0x16')](_0x0c78('0x17'),_0xb97d84,_0x0c78('0x18'));logger[_0x0c78('0x19')](_0x0c78('0x1a'),_0xb97d84,_0x0c78('0x18'),JSON[_0x0c78('0x1b')](_0x5a3c35));if(_0x5a3c35['error']){if(_0x5a3c35[_0x0c78('0x1c')][_0x0c78('0x1d')]===0x1f4){logger[_0x0c78('0x1c')]('ZendeskAccount,\x20%s,\x20%s',_0xb97d84,_0x5a3c35['error'][_0x0c78('0x1e')]);return _0x2216a6(_0x5a3c35[_0x0c78('0x1c')][_0x0c78('0x1e')]);}logger[_0x0c78('0x1c')]('ZendeskAccount,\x20%s,\x20%s',_0xb97d84,_0x5a3c35[_0x0c78('0x1c')]['message']);return _0x25d926(_0x5a3c35[_0x0c78('0x1c')]['message']);}else{logger[_0x0c78('0x16')](_0x0c78('0x17'),_0xb97d84,'request\x20sent');_0x25d926(_0x5a3c35[_0x0c78('0x1f')][_0x0c78('0x1e')]);}})[_0x0c78('0x20')](function(_0x1d0e91){logger[_0x0c78('0x1c')](_0x0c78('0x17'),_0xb97d84,_0x1d0e91);_0x2216a6(_0x1d0e91);});});}function respondWithStatusCode(_0x15c897,_0x176b51){_0x176b51=_0x176b51||0xcc;return function(_0x262a56){if(_0x262a56){return _0x15c897[_0x0c78('0x21')](_0x176b51);}return _0x15c897[_0x0c78('0x22')](_0x176b51)['end']();};}function respondWithResult(_0x1f66b7,_0x587906){_0x587906=_0x587906||0xc8;return function(_0x1eb7cd){if(_0x1eb7cd){return _0x1f66b7['status'](_0x587906)[_0x0c78('0x23')](_0x1eb7cd);}};}function respondWithFilteredResult(_0x536eae,_0xcd437b){return function(_0x5e1b0b){if(_0x5e1b0b){var _0x1da0ad=typeof _0xcd437b[_0x0c78('0x24')]===_0x0c78('0x25')&&typeof _0xcd437b[_0x0c78('0x26')]===_0x0c78('0x25');var _0x101ece=_0x5e1b0b[_0x0c78('0x27')];var _0x2ea7d8=_0x1da0ad?0x0:_0xcd437b[_0x0c78('0x24')];var _0x247352=_0x1da0ad?_0x5e1b0b[_0x0c78('0x27')]:_0xcd437b[_0x0c78('0x24')]+_0xcd437b[_0x0c78('0x26')];var _0x187315;if(_0x247352>=_0x101ece){_0x247352=_0x101ece;_0x187315=0xc8;}else{_0x187315=0xce;}_0x536eae[_0x0c78('0x22')](_0x187315);return _0x536eae[_0x0c78('0x28')](_0x0c78('0x29'),_0x2ea7d8+'-'+_0x247352+'/'+_0x101ece)[_0x0c78('0x23')](_0x5e1b0b);}return null;};}function patchUpdates(_0x1874b2){return function(_0x148de3){try{jsonpatch[_0x0c78('0x2a')](_0x148de3,_0x1874b2,!![]);}catch(_0x23d55f){return BPromise[_0x0c78('0x2b')](_0x23d55f);}return _0x148de3[_0x0c78('0x2c')]();};}function saveUpdates(_0xdce784,_0x1a9ec3){return function(_0xa4d7b6){if(_0xa4d7b6){return _0xa4d7b6['update'](_0xdce784)[_0x0c78('0x2d')](function(_0x83c7a0){return _0x83c7a0;});}return null;};}function removeEntity(_0x379286,_0x290980){return function(_0x441acc){if(_0x441acc){return _0x441acc[_0x0c78('0x2e')]()[_0x0c78('0x2d')](function(){_0x379286[_0x0c78('0x22')](0xcc)[_0x0c78('0x2f')]();});}};}function handleEntityNotFound(_0x4a0095,_0xb9d432){return function(_0x24c56a){if(!_0x24c56a){_0x4a0095[_0x0c78('0x21')](0x194);}return _0x24c56a;};}function handleError(_0x33586d,_0x415ffb){_0x415ffb=_0x415ffb||0x1f4;return function(_0x12427e){logger[_0x0c78('0x1c')](_0x12427e[_0x0c78('0x30')]);if(_0x12427e[_0x0c78('0x31')]){delete _0x12427e[_0x0c78('0x31')];}_0x33586d[_0x0c78('0x22')](_0x415ffb)[_0x0c78('0x32')](_0x12427e);};}exports[_0x0c78('0x33')]=function(_0x466f9a,_0x156c1e){var _0x433a0e={},_0x2a1176={},_0x40455b={'count':0x0,'rows':[]};var _0x256e2c=_[_0x0c78('0x34')](db['ZendeskAccount'][_0x0c78('0x35')],function(_0x3534db){return{'name':_0x3534db[_0x0c78('0x36')],'type':_0x3534db[_0x0c78('0x37')][_0x0c78('0x38')]};});_0x2a1176[_0x0c78('0x39')]=_['map'](_0x256e2c,'name');_0x2a1176[_0x0c78('0x3a')]=_[_0x0c78('0x3b')](_0x466f9a[_0x0c78('0x3a')]);_0x2a1176[_0x0c78('0x3c')]=_[_0x0c78('0x3d')](_0x2a1176[_0x0c78('0x39')],_0x2a1176[_0x0c78('0x3a')]);_0x433a0e[_0x0c78('0x3e')]=_['intersection'](_0x2a1176[_0x0c78('0x39')],qs[_0x0c78('0x3f')](_0x466f9a[_0x0c78('0x3a')][_0x0c78('0x3f')]));_0x433a0e[_0x0c78('0x3e')]=_0x433a0e[_0x0c78('0x3e')][_0x0c78('0x40')]?_0x433a0e[_0x0c78('0x3e')]:_0x2a1176['model'];if(!_0x466f9a[_0x0c78('0x3a')][_0x0c78('0x41')]('nolimit')){_0x433a0e['limit']=qs['limit'](_0x466f9a[_0x0c78('0x3a')][_0x0c78('0x26')]);_0x433a0e['offset']=qs[_0x0c78('0x24')](_0x466f9a[_0x0c78('0x3a')][_0x0c78('0x24')]);}_0x433a0e[_0x0c78('0x42')]=qs[_0x0c78('0x43')](_0x466f9a[_0x0c78('0x3a')][_0x0c78('0x43')]);_0x433a0e['where']=qs[_0x0c78('0x3c')](_[_0x0c78('0x44')](_0x466f9a[_0x0c78('0x3a')],_0x2a1176[_0x0c78('0x3c')]),_0x256e2c);if(_0x466f9a[_0x0c78('0x3a')][_0x0c78('0x45')]){_0x433a0e[_0x0c78('0x46')]=_[_0x0c78('0x47')](_0x433a0e[_0x0c78('0x46')],{'$or':_['map'](_0x256e2c,function(_0x2c1a0f){if(_0x2c1a0f[_0x0c78('0x37')]!=='VIRTUAL'){var _0x243ff0={};_0x243ff0[_0x2c1a0f[_0x0c78('0x31')]]={'$like':'%'+_0x466f9a[_0x0c78('0x3a')][_0x0c78('0x45')]+'%'};return _0x243ff0;}})});}_0x433a0e=_[_0x0c78('0x47')]({},_0x433a0e,_0x466f9a['options']);var _0x54728d={'where':_0x433a0e[_0x0c78('0x46')]};return db['ZendeskAccount'][_0x0c78('0x27')](_0x54728d)[_0x0c78('0x2d')](function(_0x1f9aca){_0x40455b[_0x0c78('0x27')]=_0x1f9aca;if(_0x466f9a[_0x0c78('0x3a')][_0x0c78('0x48')]){_0x433a0e[_0x0c78('0x49')]=[{'all':!![]}];}return db[_0x0c78('0x4a')][_0x0c78('0x4b')](_0x433a0e);})[_0x0c78('0x2d')](function(_0x2cb555){_0x40455b[_0x0c78('0x4c')]=_0x2cb555;return _0x40455b;})[_0x0c78('0x2d')](respondWithFilteredResult(_0x156c1e,_0x433a0e))[_0x0c78('0x20')](handleError(_0x156c1e,null));};exports[_0x0c78('0x4d')]=function(_0x5b639a,_0x134f20){var _0x49167c={'raw':![],'where':{'id':_0x5b639a[_0x0c78('0x4e')]['id']}},_0x30d3d3={};_0x30d3d3[_0x0c78('0x39')]=_[_0x0c78('0x3b')](db[_0x0c78('0x4a')][_0x0c78('0x35')]);_0x30d3d3['query']=_[_0x0c78('0x3b')](_0x5b639a[_0x0c78('0x3a')]);_0x30d3d3[_0x0c78('0x3c')]=_[_0x0c78('0x3d')](_0x30d3d3[_0x0c78('0x39')],_0x30d3d3[_0x0c78('0x3a')]);_0x49167c['attributes']=_[_0x0c78('0x3d')](_0x30d3d3[_0x0c78('0x39')],qs[_0x0c78('0x3f')](_0x5b639a[_0x0c78('0x3a')]['fields']));_0x49167c['attributes']=_0x49167c['attributes']['length']?_0x49167c['attributes']:_0x30d3d3['model'];if(_0x5b639a[_0x0c78('0x3a')]['includeAll']){_0x49167c[_0x0c78('0x49')]=[{'all':!![]}];}_0x49167c=_[_0x0c78('0x47')]({},_0x49167c,_0x5b639a['options']);return db[_0x0c78('0x4a')][_0x0c78('0x4f')](_0x49167c)[_0x0c78('0x2d')](handleEntityNotFound(_0x134f20,null))[_0x0c78('0x2d')](respondWithResult(_0x134f20,null))[_0x0c78('0x20')](handleError(_0x134f20,null));};exports[_0x0c78('0x50')]=function(_0xd114fa,_0x491e0a){return db[_0x0c78('0x4a')][_0x0c78('0x50')](_0xd114fa[_0x0c78('0x51')],{})[_0x0c78('0x2d')](respondWithResult(_0x491e0a,0xc9))['catch'](handleError(_0x491e0a,null));};exports['update']=function(_0x53d5b9,_0x28d794){if(_0x53d5b9[_0x0c78('0x51')]['id']){delete _0x53d5b9['body']['id'];}return db[_0x0c78('0x4a')]['find']({'where':{'id':_0x53d5b9[_0x0c78('0x4e')]['id']}})[_0x0c78('0x2d')](handleEntityNotFound(_0x28d794,null))['then'](saveUpdates(_0x53d5b9[_0x0c78('0x51')],null))['then'](respondWithResult(_0x28d794,null))[_0x0c78('0x20')](handleError(_0x28d794,null));};exports[_0x0c78('0x2e')]=function(_0x57ad60,_0x57674c){return db['ZendeskAccount']['find']({'where':{'id':_0x57ad60[_0x0c78('0x4e')]['id']}})[_0x0c78('0x2d')](handleEntityNotFound(_0x57674c,null))[_0x0c78('0x2d')](removeEntity(_0x57674c,null))['catch'](handleError(_0x57674c,null));};exports[_0x0c78('0x52')]=function(_0x7b3e2b,_0x59cc4b,_0x266b81){var _0x5178a5={};var _0x4527c1={};var _0x12553f;var _0x4e3e4f;return db[_0x0c78('0x4a')][_0x0c78('0x53')]({'where':{'id':_0x7b3e2b['params']['id']}})[_0x0c78('0x2d')](handleEntityNotFound(_0x59cc4b,null))[_0x0c78('0x2d')](function(_0x24ae7b){if(_0x24ae7b){_0x12553f=_0x24ae7b;_0x4527c1[_0x0c78('0x39')]=_[_0x0c78('0x3b')](db[_0x0c78('0x54')][_0x0c78('0x35')]);_0x4527c1[_0x0c78('0x3a')]=_[_0x0c78('0x3b')](_0x7b3e2b[_0x0c78('0x3a')]);_0x4527c1['filters']=_['intersection'](_0x4527c1['model'],_0x4527c1[_0x0c78('0x3a')]);_0x5178a5[_0x0c78('0x3e')]=_['intersection'](_0x4527c1[_0x0c78('0x39')],qs['fields'](_0x7b3e2b[_0x0c78('0x3a')][_0x0c78('0x3f')]));_0x5178a5[_0x0c78('0x3e')]=_0x5178a5[_0x0c78('0x3e')][_0x0c78('0x40')]?_0x5178a5[_0x0c78('0x3e')]:_0x4527c1['model'];_0x5178a5[_0x0c78('0x42')]=qs[_0x0c78('0x43')](_0x7b3e2b[_0x0c78('0x3a')]['sort']);_0x5178a5[_0x0c78('0x46')]=qs['filters'](_['pick'](_0x7b3e2b[_0x0c78('0x3a')],_0x4527c1['filters']));if(_0x7b3e2b[_0x0c78('0x3a')][_0x0c78('0x45')]){_0x5178a5[_0x0c78('0x46')]=_[_0x0c78('0x47')](_0x5178a5[_0x0c78('0x46')],{'$or':_[_0x0c78('0x34')](_0x5178a5[_0x0c78('0x3e')],function(_0x55525d){var _0x7b7df5={};_0x7b7df5[_0x55525d]={'$like':'%'+_0x7b3e2b[_0x0c78('0x3a')][_0x0c78('0x45')]+'%'};return _0x7b7df5;})});}_0x5178a5=_[_0x0c78('0x47')]({},_0x5178a5,_0x7b3e2b['options']);return _0x12553f[_0x0c78('0x52')](_0x5178a5);}})[_0x0c78('0x2d')](function(_0x552177){if(_0x552177){_0x4e3e4f=_0x552177['length'];if(!_0x7b3e2b['query']['hasOwnProperty'](_0x0c78('0x55'))){_0x5178a5[_0x0c78('0x26')]=qs[_0x0c78('0x26')](_0x7b3e2b['query']['limit']);_0x5178a5[_0x0c78('0x24')]=qs['offset'](_0x7b3e2b['query']['offset']);}return _0x12553f[_0x0c78('0x52')](_0x5178a5);}})[_0x0c78('0x2d')](function(_0x1169df){if(_0x1169df){return _0x1169df?{'count':_0x4e3e4f,'rows':_0x1169df}:null;}})[_0x0c78('0x2d')](respondWithResult(_0x59cc4b,null))[_0x0c78('0x20')](handleError(_0x59cc4b,null));};exports['addConfiguration']=function(_0x3a3698,_0x28bb9d,_0x2e736a){if(_0x3a3698['body']['id']){delete _0x3a3698[_0x0c78('0x51')]['id'];}return db['ZendeskAccount'][_0x0c78('0x53')]({'where':{'id':_0x3a3698[_0x0c78('0x4e')]['id']}})[_0x0c78('0x2d')](handleEntityNotFound(_0x28bb9d,null))[_0x0c78('0x2d')](function(_0x314c1e){if(_0x314c1e){_0x3a3698['body']['AccountId']=_0x314c1e['id'];_0x3a3698[_0x0c78('0x51')][_0x0c78('0x56')]=integrations[_0x0c78('0x57')](_0x3a3698[_0x0c78('0x51')][_0x0c78('0x58')],_0x3a3698['body'][_0x0c78('0x37')]);_0x3a3698[_0x0c78('0x51')][_0x0c78('0x59')]=integrations['getDescriptions'](_0x3a3698[_0x0c78('0x51')][_0x0c78('0x58')],_0x3a3698[_0x0c78('0x51')][_0x0c78('0x37')]);return db[_0x0c78('0x54')][_0x0c78('0x50')](_0x3a3698[_0x0c78('0x51')],{'include':[{'model':db[_0x0c78('0x5a')],'as':_0x0c78('0x56')},{'model':db[_0x0c78('0x5a')],'as':_0x0c78('0x59')}]});}return null;})[_0x0c78('0x2d')](respondWithResult(_0x28bb9d,null))['catch'](handleError(_0x28bb9d,null));};exports[_0x0c78('0x5b')]=function(_0x4690b5,_0xc9fa81,_0x3c9492){var _0x27fc44='';return db[_0x0c78('0x4a')][_0x0c78('0x53')]({'where':{'id':_0x4690b5[_0x0c78('0x4e')]['id']},'attributes':['id','username','password','token',_0x0c78('0x5c'),_0x0c78('0x5d')]})[_0x0c78('0x2d')](handleEntityNotFound(_0xc9fa81,null))[_0x0c78('0x2d')](function(_0x526e63){if(_0x526e63){_0x27fc44=_0x526e63[_0x0c78('0x5d')];var _0x9c5f8e=_0x27fc44[_0x0c78('0x5e')](-0x1);if(_0x9c5f8e==='/'){_0x27fc44=_0x27fc44[_0x0c78('0x5f')](0x0,_0x27fc44[_0x0c78('0x60')](_0x9c5f8e));}var _0x421206={'method':_0x0c78('0x61'),'uri':util['format']('%s/%s',_0x27fc44,_0x0c78('0x62')),'json':!![]};switch(_0x526e63[_0x0c78('0x5c')]){case _0x0c78('0x63'):_0x421206[_0x0c78('0x64')]={'Authorization':util[_0x0c78('0x65')](_0x0c78('0x66'),new Buffer(util[_0x0c78('0x65')]('%s:%s',_0x526e63[_0x0c78('0x67')],_0x526e63[_0x0c78('0x63')]))['toString'](_0x0c78('0x68')))};break;case _0x0c78('0x69'):_0x421206[_0x0c78('0x64')]={'Authorization':util['format'](_0x0c78('0x66'),new Buffer(util[_0x0c78('0x65')](_0x0c78('0x6a'),_0x526e63[_0x0c78('0x67')],_0x526e63[_0x0c78('0x69')]))['toString'](_0x0c78('0x68')))};break;default:throw new db[(_0x0c78('0x6b'))][(_0x0c78('0x6c'))](_0x0c78('0x6d'));}return rp(_0x421206);}})[_0x0c78('0x2d')](function(_0x2741bd){if(_0x2741bd){var _0x554469=['subject',_0x0c78('0x6e'),_0x0c78('0x6f'),'assignee'];_[_0x0c78('0x70')](_0x2741bd['ticket_fields'],function(_0x4c4cb8){return _0x554469[_0x0c78('0x71')](_0x4c4cb8[_0x0c78('0x37')]);});return{'count':_0x2741bd['ticket_fields']['length'],'rows':_[_0x0c78('0x34')](_0x2741bd['ticket_fields'],function(_0x1e8ab5){return{'id':_0x1e8ab5['id'],'name':_0x1e8ab5['position']>0x7?_0x1e8ab5[_0x0c78('0x72')]:_0x1e8ab5[_0x0c78('0x37')],'custom':_0x1e8ab5[_0x0c78('0x73')]>0x7?!![]:![],'options':_0x1e8ab5[_0x0c78('0x74')]?_0x1e8ab5[_0x0c78('0x74')]:_0x1e8ab5[_0x0c78('0x75')]?_0x1e8ab5[_0x0c78('0x75')]:[]};})};}})[_0x0c78('0x2d')](respondWithResult(_0xc9fa81,null))[_0x0c78('0x20')](function(_0x84bf8e){var _0x49ed2d=_0x4690b5[_0x0c78('0x3a')][_0x0c78('0x76')]?0x1f4:_0x84bf8e[_0x0c78('0x77')]||0x1f4;logger[_0x0c78('0x1c')](_0x0c78('0x78'),_0x0c78('0x5b'),_0x49ed2d,JSON[_0x0c78('0x1b')](_0x84bf8e));delete _0x84bf8e[_0x0c78('0x31')];if(_0x49ed2d===0x191){_0x49ed2d=0x190;}_0xc9fa81[_0x0c78('0x22')](_0x49ed2d)[_0x0c78('0x32')](_0x4690b5[_0x0c78('0x3a')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x84bf8e[_0x0c78('0x77')]}:_0x84bf8e);});}; \ No newline at end of file +var _0xea91=['stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','include','rows','show','params','keys','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','channel','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','format','Basic\x20%s','toString','base64','headers','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','assignee','includes','position','title','system_field_options','custom_field_options','statusCode','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3c9fdb,_0x3a964c){var _0x25fe17=function(_0x4aacf2){while(--_0x4aacf2){_0x3c9fdb['push'](_0x3c9fdb['shift']());}};_0x25fe17(++_0x3a964c);}(_0xea91,0xd7));var _0x1ea9=function(_0x2288fb,_0x40e7b1){_0x2288fb=_0x2288fb-0x0;var _0x49451e=_0xea91[_0x2288fb];return _0x49451e;};'use strict';var emlformat=require(_0x1ea9('0x0'));var rimraf=require(_0x1ea9('0x1'));var zipdir=require(_0x1ea9('0x2'));var jsonpatch=require(_0x1ea9('0x3'));var rp=require(_0x1ea9('0x4'));var moment=require(_0x1ea9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1ea9('0x6'));var util=require(_0x1ea9('0x7'));var path=require(_0x1ea9('0x8'));var sox=require(_0x1ea9('0x9'));var csv=require(_0x1ea9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ea9('0xb'));var squel=require(_0x1ea9('0xc'));var crypto=require(_0x1ea9('0xd'));var jsforce=require(_0x1ea9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1ea9('0xa'));var querystring=require(_0x1ea9('0xf'));var Papa=require(_0x1ea9('0x10'));var Redis=require(_0x1ea9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1ea9('0x12'));var hardwareService=require(_0x1ea9('0x13'));var logger=require(_0x1ea9('0x14'))(_0x1ea9('0x15'));var utils=require('../../config/utils');var config=require(_0x1ea9('0x16'));var licenseUtil=require(_0x1ea9('0x17'));var db=require(_0x1ea9('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x1ea9('0x19')][_0x1ea9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x282966,_0x580295,_0x536283,_0x4b3cee){return new BPromise(function(_0x21f69a,_0x21fdc0){var _0x370cda=_0x4b3cee||client;return _0x370cda[_0x1ea9('0x1b')](_0x282966,_0x536283)[_0x1ea9('0x1c')](function(_0xd0473d){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x580295,_0x1ea9('0x1d'));logger['debug'](_0x1ea9('0x1e'),_0x580295,_0x1ea9('0x1d'),JSON[_0x1ea9('0x1f')](_0xd0473d));if(_0xd0473d[_0x1ea9('0x20')]){if(_0xd0473d['error'][_0x1ea9('0x21')]===0x1f4){logger[_0x1ea9('0x20')](_0x1ea9('0x22'),_0x580295,_0xd0473d['error'][_0x1ea9('0x23')]);return _0x21fdc0(_0xd0473d[_0x1ea9('0x20')]['message']);}logger['error'](_0x1ea9('0x22'),_0x580295,_0xd0473d[_0x1ea9('0x20')][_0x1ea9('0x23')]);return _0x21f69a(_0xd0473d['error'][_0x1ea9('0x23')]);}else{logger['info'](_0x1ea9('0x22'),_0x580295,'request\x20sent');_0x21f69a(_0xd0473d[_0x1ea9('0x24')]['message']);}})[_0x1ea9('0x25')](function(_0x2f6c14){logger[_0x1ea9('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x580295,_0x2f6c14);_0x21fdc0(_0x2f6c14);});});}function respondWithStatusCode(_0xaabeda,_0x199b98){_0x199b98=_0x199b98||0xcc;return function(_0x5a0bfe){if(_0x5a0bfe){return _0xaabeda[_0x1ea9('0x26')](_0x199b98);}return _0xaabeda[_0x1ea9('0x27')](_0x199b98)[_0x1ea9('0x28')]();};}function respondWithResult(_0x2e2839,_0x15df40){_0x15df40=_0x15df40||0xc8;return function(_0x59af15){if(_0x59af15){return _0x2e2839[_0x1ea9('0x27')](_0x15df40)[_0x1ea9('0x29')](_0x59af15);}};}function respondWithFilteredResult(_0x1c4d3d,_0x442b65){return function(_0x340377){if(_0x340377){var _0x437558=typeof _0x442b65[_0x1ea9('0x2a')]===_0x1ea9('0x2b')&&typeof _0x442b65[_0x1ea9('0x2c')]===_0x1ea9('0x2b');var _0x23ce09=_0x340377['count'];var _0x2e6e67=_0x437558?0x0:_0x442b65['offset'];var _0xb4dbcd=_0x437558?_0x340377[_0x1ea9('0x2d')]:_0x442b65[_0x1ea9('0x2a')]+_0x442b65[_0x1ea9('0x2c')];var _0x162cad;if(_0xb4dbcd>=_0x23ce09){_0xb4dbcd=_0x23ce09;_0x162cad=0xc8;}else{_0x162cad=0xce;}_0x1c4d3d[_0x1ea9('0x27')](_0x162cad);return _0x1c4d3d[_0x1ea9('0x2e')](_0x1ea9('0x2f'),_0x2e6e67+'-'+_0xb4dbcd+'/'+_0x23ce09)[_0x1ea9('0x29')](_0x340377);}return null;};}function patchUpdates(_0x4a9b97){return function(_0x538440){try{jsonpatch[_0x1ea9('0x30')](_0x538440,_0x4a9b97,!![]);}catch(_0x116945){return BPromise[_0x1ea9('0x31')](_0x116945);}return _0x538440[_0x1ea9('0x32')]();};}function saveUpdates(_0x3499c1,_0x5a93c8){return function(_0x11280b){if(_0x11280b){return _0x11280b[_0x1ea9('0x33')](_0x3499c1)[_0x1ea9('0x1c')](function(_0xc85c16){return _0xc85c16;});}return null;};}function removeEntity(_0x12152e,_0x325f4b){return function(_0x1650e8){if(_0x1650e8){return _0x1650e8[_0x1ea9('0x34')]()[_0x1ea9('0x1c')](function(){_0x12152e[_0x1ea9('0x27')](0xcc)[_0x1ea9('0x28')]();});}};}function handleEntityNotFound(_0x2585b7,_0x520222){return function(_0x114f6c){if(!_0x114f6c){_0x2585b7[_0x1ea9('0x26')](0x194);}return _0x114f6c;};}function handleError(_0x5b53ef,_0x1852d5){_0x1852d5=_0x1852d5||0x1f4;return function(_0x3efd7d){logger[_0x1ea9('0x20')](_0x3efd7d[_0x1ea9('0x35')]);if(_0x3efd7d['name']){delete _0x3efd7d[_0x1ea9('0x36')];}_0x5b53ef[_0x1ea9('0x27')](_0x1852d5)[_0x1ea9('0x37')](_0x3efd7d);};}exports[_0x1ea9('0x38')]=function(_0x18681e,_0xd3b51f){var _0xed2e20={},_0x41dca4={},_0x185ad9={'count':0x0,'rows':[]};var _0x31f42f=_[_0x1ea9('0x39')](db[_0x1ea9('0x3a')][_0x1ea9('0x3b')],function(_0x2dc81c){return{'name':_0x2dc81c[_0x1ea9('0x3c')],'type':_0x2dc81c[_0x1ea9('0x3d')][_0x1ea9('0x3e')]};});_0x41dca4[_0x1ea9('0x3f')]=_[_0x1ea9('0x39')](_0x31f42f,_0x1ea9('0x36'));_0x41dca4[_0x1ea9('0x40')]=_['keys'](_0x18681e['query']);_0x41dca4[_0x1ea9('0x41')]=_[_0x1ea9('0x42')](_0x41dca4[_0x1ea9('0x3f')],_0x41dca4['query']);_0xed2e20[_0x1ea9('0x43')]=_[_0x1ea9('0x42')](_0x41dca4['model'],qs[_0x1ea9('0x44')](_0x18681e[_0x1ea9('0x40')][_0x1ea9('0x44')]));_0xed2e20[_0x1ea9('0x43')]=_0xed2e20[_0x1ea9('0x43')][_0x1ea9('0x45')]?_0xed2e20[_0x1ea9('0x43')]:_0x41dca4['model'];if(!_0x18681e[_0x1ea9('0x40')][_0x1ea9('0x46')](_0x1ea9('0x47'))){_0xed2e20['limit']=qs[_0x1ea9('0x2c')](_0x18681e[_0x1ea9('0x40')][_0x1ea9('0x2c')]);_0xed2e20['offset']=qs[_0x1ea9('0x2a')](_0x18681e[_0x1ea9('0x40')][_0x1ea9('0x2a')]);}_0xed2e20[_0x1ea9('0x48')]=qs[_0x1ea9('0x49')](_0x18681e['query'][_0x1ea9('0x49')]);_0xed2e20['where']=qs[_0x1ea9('0x41')](_[_0x1ea9('0x4a')](_0x18681e['query'],_0x41dca4[_0x1ea9('0x41')]),_0x31f42f);if(_0x18681e[_0x1ea9('0x40')]['filter']){_0xed2e20[_0x1ea9('0x4b')]=_['merge'](_0xed2e20[_0x1ea9('0x4b')],{'$or':_['map'](_0x31f42f,function(_0x1cea5e){if(_0x1cea5e[_0x1ea9('0x3d')]!=='VIRTUAL'){var _0x4edc4c={};_0x4edc4c[_0x1cea5e[_0x1ea9('0x36')]]={'$like':'%'+_0x18681e[_0x1ea9('0x40')]['filter']+'%'};return _0x4edc4c;}})});}_0xed2e20=_[_0x1ea9('0x4c')]({},_0xed2e20,_0x18681e[_0x1ea9('0x4d')]);var _0x300317={'where':_0xed2e20[_0x1ea9('0x4b')]};return db[_0x1ea9('0x3a')]['count'](_0x300317)[_0x1ea9('0x1c')](function(_0x55c63b){_0x185ad9[_0x1ea9('0x2d')]=_0x55c63b;if(_0x18681e[_0x1ea9('0x40')][_0x1ea9('0x4e')]){_0xed2e20[_0x1ea9('0x4f')]=[{'all':!![]}];}return db[_0x1ea9('0x3a')]['findAll'](_0xed2e20);})['then'](function(_0x2573c6){_0x185ad9[_0x1ea9('0x50')]=_0x2573c6;return _0x185ad9;})[_0x1ea9('0x1c')](respondWithFilteredResult(_0xd3b51f,_0xed2e20))[_0x1ea9('0x25')](handleError(_0xd3b51f,null));};exports[_0x1ea9('0x51')]=function(_0x37a8be,_0x28488e){var _0x46ddc1={'raw':![],'where':{'id':_0x37a8be[_0x1ea9('0x52')]['id']}},_0x348b52={};_0x348b52[_0x1ea9('0x3f')]=_[_0x1ea9('0x53')](db[_0x1ea9('0x3a')][_0x1ea9('0x3b')]);_0x348b52[_0x1ea9('0x40')]=_[_0x1ea9('0x53')](_0x37a8be[_0x1ea9('0x40')]);_0x348b52['filters']=_[_0x1ea9('0x42')](_0x348b52[_0x1ea9('0x3f')],_0x348b52[_0x1ea9('0x40')]);_0x46ddc1[_0x1ea9('0x43')]=_[_0x1ea9('0x42')](_0x348b52[_0x1ea9('0x3f')],qs[_0x1ea9('0x44')](_0x37a8be['query'][_0x1ea9('0x44')]));_0x46ddc1['attributes']=_0x46ddc1[_0x1ea9('0x43')][_0x1ea9('0x45')]?_0x46ddc1[_0x1ea9('0x43')]:_0x348b52['model'];if(_0x37a8be[_0x1ea9('0x40')][_0x1ea9('0x4e')]){_0x46ddc1[_0x1ea9('0x4f')]=[{'all':!![]}];}_0x46ddc1=_[_0x1ea9('0x4c')]({},_0x46ddc1,_0x37a8be[_0x1ea9('0x4d')]);return db[_0x1ea9('0x3a')][_0x1ea9('0x54')](_0x46ddc1)[_0x1ea9('0x1c')](handleEntityNotFound(_0x28488e,null))[_0x1ea9('0x1c')](respondWithResult(_0x28488e,null))[_0x1ea9('0x25')](handleError(_0x28488e,null));};exports['create']=function(_0x1295c9,_0x4864f1){return db[_0x1ea9('0x3a')][_0x1ea9('0x55')](_0x1295c9['body'],{})[_0x1ea9('0x1c')](respondWithResult(_0x4864f1,0xc9))[_0x1ea9('0x25')](handleError(_0x4864f1,null));};exports[_0x1ea9('0x33')]=function(_0x4919f1,_0x6b14a5){if(_0x4919f1[_0x1ea9('0x56')]['id']){delete _0x4919f1[_0x1ea9('0x56')]['id'];}return db[_0x1ea9('0x3a')][_0x1ea9('0x54')]({'where':{'id':_0x4919f1['params']['id']}})['then'](handleEntityNotFound(_0x6b14a5,null))[_0x1ea9('0x1c')](saveUpdates(_0x4919f1[_0x1ea9('0x56')],null))[_0x1ea9('0x1c')](respondWithResult(_0x6b14a5,null))[_0x1ea9('0x25')](handleError(_0x6b14a5,null));};exports[_0x1ea9('0x34')]=function(_0x2bc44c,_0x23a251){return db[_0x1ea9('0x3a')][_0x1ea9('0x54')]({'where':{'id':_0x2bc44c[_0x1ea9('0x52')]['id']}})['then'](handleEntityNotFound(_0x23a251,null))[_0x1ea9('0x1c')](removeEntity(_0x23a251,null))[_0x1ea9('0x25')](handleError(_0x23a251,null));};exports['getConfigurations']=function(_0x2ef43b,_0x21a6c8,_0x40f58c){var _0x42be0a={};var _0x3d3461={};var _0x5b0b8c;var _0x426aa2;return db['ZendeskAccount'][_0x1ea9('0x57')]({'where':{'id':_0x2ef43b['params']['id']}})[_0x1ea9('0x1c')](handleEntityNotFound(_0x21a6c8,null))[_0x1ea9('0x1c')](function(_0x49f35e){if(_0x49f35e){_0x5b0b8c=_0x49f35e;_0x3d3461[_0x1ea9('0x3f')]=_[_0x1ea9('0x53')](db['ZendeskConfiguration'][_0x1ea9('0x3b')]);_0x3d3461[_0x1ea9('0x40')]=_['keys'](_0x2ef43b[_0x1ea9('0x40')]);_0x3d3461[_0x1ea9('0x41')]=_[_0x1ea9('0x42')](_0x3d3461[_0x1ea9('0x3f')],_0x3d3461['query']);_0x42be0a[_0x1ea9('0x43')]=_[_0x1ea9('0x42')](_0x3d3461[_0x1ea9('0x3f')],qs['fields'](_0x2ef43b[_0x1ea9('0x40')][_0x1ea9('0x44')]));_0x42be0a[_0x1ea9('0x43')]=_0x42be0a[_0x1ea9('0x43')]['length']?_0x42be0a[_0x1ea9('0x43')]:_0x3d3461[_0x1ea9('0x3f')];_0x42be0a[_0x1ea9('0x48')]=qs[_0x1ea9('0x49')](_0x2ef43b[_0x1ea9('0x40')][_0x1ea9('0x49')]);_0x42be0a[_0x1ea9('0x4b')]=qs[_0x1ea9('0x41')](_[_0x1ea9('0x4a')](_0x2ef43b['query'],_0x3d3461[_0x1ea9('0x41')]));if(_0x2ef43b[_0x1ea9('0x40')]['filter']){_0x42be0a[_0x1ea9('0x4b')]=_[_0x1ea9('0x4c')](_0x42be0a['where'],{'$or':_[_0x1ea9('0x39')](_0x42be0a[_0x1ea9('0x43')],function(_0xa06501){var _0xc9b4cc={};_0xc9b4cc[_0xa06501]={'$like':'%'+_0x2ef43b['query']['filter']+'%'};return _0xc9b4cc;})});}_0x42be0a=_['merge']({},_0x42be0a,_0x2ef43b[_0x1ea9('0x4d')]);return _0x5b0b8c[_0x1ea9('0x58')](_0x42be0a);}})['then'](function(_0x577706){if(_0x577706){_0x426aa2=_0x577706['length'];if(!_0x2ef43b[_0x1ea9('0x40')][_0x1ea9('0x46')](_0x1ea9('0x47'))){_0x42be0a['limit']=qs[_0x1ea9('0x2c')](_0x2ef43b[_0x1ea9('0x40')]['limit']);_0x42be0a[_0x1ea9('0x2a')]=qs[_0x1ea9('0x2a')](_0x2ef43b[_0x1ea9('0x40')][_0x1ea9('0x2a')]);}return _0x5b0b8c[_0x1ea9('0x58')](_0x42be0a);}})[_0x1ea9('0x1c')](function(_0x24057b){if(_0x24057b){return _0x24057b?{'count':_0x426aa2,'rows':_0x24057b}:null;}})['then'](respondWithResult(_0x21a6c8,null))['catch'](handleError(_0x21a6c8,null));};exports[_0x1ea9('0x59')]=function(_0x10e975,_0xb9b82f,_0x5e33c1){if(_0x10e975[_0x1ea9('0x56')]['id']){delete _0x10e975[_0x1ea9('0x56')]['id'];}return db[_0x1ea9('0x3a')]['findOne']({'where':{'id':_0x10e975[_0x1ea9('0x52')]['id']}})[_0x1ea9('0x1c')](handleEntityNotFound(_0xb9b82f,null))[_0x1ea9('0x1c')](function(_0x3b14b9){if(_0x3b14b9){_0x10e975[_0x1ea9('0x56')][_0x1ea9('0x5a')]=_0x3b14b9['id'];_0x10e975['body']['Subjects']=integrations['getSubjects'](_0x10e975[_0x1ea9('0x56')][_0x1ea9('0x5b')],_0x10e975[_0x1ea9('0x56')][_0x1ea9('0x3d')]);_0x10e975[_0x1ea9('0x56')]['Descriptions']=integrations[_0x1ea9('0x5c')](_0x10e975['body'][_0x1ea9('0x5b')],_0x10e975[_0x1ea9('0x56')][_0x1ea9('0x3d')]);return db[_0x1ea9('0x5d')][_0x1ea9('0x55')](_0x10e975[_0x1ea9('0x56')],{'include':[{'model':db[_0x1ea9('0x5e')],'as':'Subjects'},{'model':db[_0x1ea9('0x5e')],'as':'Descriptions'}]});}return null;})[_0x1ea9('0x1c')](respondWithResult(_0xb9b82f,null))[_0x1ea9('0x25')](handleError(_0xb9b82f,null));};exports[_0x1ea9('0x5f')]=function(_0x4c0495,_0x5928bb,_0x2a2b0d){var _0x548456='';return db['ZendeskAccount'][_0x1ea9('0x57')]({'where':{'id':_0x4c0495[_0x1ea9('0x52')]['id']},'attributes':['id',_0x1ea9('0x60'),_0x1ea9('0x61'),_0x1ea9('0x62'),_0x1ea9('0x63'),_0x1ea9('0x64')]})[_0x1ea9('0x1c')](handleEntityNotFound(_0x5928bb,null))[_0x1ea9('0x1c')](function(_0x439e1c){if(_0x439e1c){_0x548456=_0x439e1c[_0x1ea9('0x64')];var _0x769f00=_0x548456[_0x1ea9('0x65')](-0x1);if(_0x769f00==='/'){_0x548456=_0x548456[_0x1ea9('0x66')](0x0,_0x548456['lastIndexOf'](_0x769f00));}var _0xd858cb={'method':_0x1ea9('0x67'),'uri':util['format'](_0x1ea9('0x68'),_0x548456,_0x1ea9('0x69')),'json':!![]};switch(_0x439e1c[_0x1ea9('0x63')]){case _0x1ea9('0x61'):_0xd858cb['headers']={'Authorization':util[_0x1ea9('0x6a')](_0x1ea9('0x6b'),new Buffer(util[_0x1ea9('0x6a')]('%s:%s',_0x439e1c[_0x1ea9('0x60')],_0x439e1c[_0x1ea9('0x61')]))[_0x1ea9('0x6c')](_0x1ea9('0x6d')))};break;case _0x1ea9('0x62'):_0xd858cb[_0x1ea9('0x6e')]={'Authorization':util[_0x1ea9('0x6a')](_0x1ea9('0x6b'),new Buffer(util['format']('%s/token:%s',_0x439e1c['username'],_0x439e1c[_0x1ea9('0x62')]))[_0x1ea9('0x6c')](_0x1ea9('0x6d')))};break;default:throw new db[(_0x1ea9('0x6f'))][(_0x1ea9('0x70'))](_0x1ea9('0x71'));}return rp(_0xd858cb);}})[_0x1ea9('0x1c')](function(_0x14e9a2){if(_0x14e9a2){var _0x34d190=[_0x1ea9('0x72'),'description','group',_0x1ea9('0x73')];_['remove'](_0x14e9a2[_0x1ea9('0x69')],function(_0x57b4ae){return _0x34d190[_0x1ea9('0x74')](_0x57b4ae[_0x1ea9('0x3d')]);});return{'count':_0x14e9a2[_0x1ea9('0x69')][_0x1ea9('0x45')],'rows':_[_0x1ea9('0x39')](_0x14e9a2[_0x1ea9('0x69')],function(_0x93a0ba){return{'id':_0x93a0ba['id'],'name':_0x93a0ba[_0x1ea9('0x75')]>0x7?_0x93a0ba[_0x1ea9('0x76')]:_0x93a0ba[_0x1ea9('0x3d')],'custom':_0x93a0ba[_0x1ea9('0x75')]>0x7?!![]:![],'options':_0x93a0ba[_0x1ea9('0x77')]?_0x93a0ba[_0x1ea9('0x77')]:_0x93a0ba[_0x1ea9('0x78')]?_0x93a0ba['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x5928bb,null))[_0x1ea9('0x25')](function(_0x3cb803){var _0x1b1b64=_0x4c0495['query']['test']?0x1f4:_0x3cb803[_0x1ea9('0x79')]||0x1f4;logger[_0x1ea9('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x1ea9('0x5f'),_0x1b1b64,JSON[_0x1ea9('0x1f')](_0x3cb803));delete _0x3cb803[_0x1ea9('0x36')];if(_0x1b1b64===0x191){_0x1b1b64=0x190;}_0x5928bb[_0x1ea9('0x27')](_0x1b1b64)['send'](_0x4c0495['query'][_0x1ea9('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x3cb803['statusCode']}:_0x3cb803);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1968f8c..f8b573d 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 _0x72c5=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','api','bluebird','request-promise'];(function(_0x18fcdc,_0x50716e){var _0x2a11cc=function(_0x169cad){while(--_0x169cad){_0x18fcdc['push'](_0x18fcdc['shift']());}};_0x2a11cc(++_0x50716e);}(_0x72c5,0x80));var _0x572c=function(_0x3671d7,_0x586bbc){_0x3671d7=_0x3671d7-0x0;var _0xf9f6e6=_0x72c5[_0x3671d7];return _0xf9f6e6;};'use strict';var _=require('lodash');var util=require(_0x572c('0x0'));var logger=require('../../config/logger')(_0x572c('0x1'));var moment=require('moment');var BPromise=require(_0x572c('0x2'));var rp=require(_0x572c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x572c('0x4'));var config=require(_0x572c('0x5'));var attributes=require(_0x572c('0x6'));var integrations=require(_0x572c('0x7'));module[_0x572c('0x8')]=function(_0x315607,_0x1d4bc6){return _0x315607[_0x572c('0x9')](_0x572c('0xa'),attributes,{'tableName':_0x572c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe022=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x2ded39,_0x325441){var _0x472e51=function(_0x880397){while(--_0x880397){_0x2ded39['push'](_0x2ded39['shift']());}};_0x472e51(++_0x325441);}(_0xe022,0x80));var _0x2e02=function(_0x5a66a9,_0x59ba6b){_0x5a66a9=_0x5a66a9-0x0;var _0x1caf80=_0xe022[_0x5a66a9];return _0x1caf80;};'use strict';var _=require(_0x2e02('0x0'));var util=require(_0x2e02('0x1'));var logger=require(_0x2e02('0x2'))(_0x2e02('0x3'));var moment=require(_0x2e02('0x4'));var BPromise=require(_0x2e02('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e02('0x6'));var config=require(_0x2e02('0x7'));var attributes=require(_0x2e02('0x8'));var integrations=require(_0x2e02('0x9'));module[_0x2e02('0xa')]=function(_0x1e8944,_0x221a82){return _0x1e8944[_0x2e02('0xb')](_0x2e02('0xc'),attributes,{'tableName':_0x2e02('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 1e66733..ed31c63 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x10da5a,_0x5bb53c){var _0x49a6f5=function(_0x10f387){while(--_0x10f387){_0x10da5a['push'](_0x10da5a['shift']());}};_0x49a6f5(++_0x5bb53c);}(_0x757a,0xde));var _0xa757=function(_0x4de48d,_0x3c75fe){_0x4de48d=_0x4de48d-0x0;var _0x19984f=_0x757a[_0x4de48d];return _0x19984f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','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','options'];(function(_0x4e4bf5,_0xfaffdf){var _0x529e0f=function(_0x28b161){while(--_0x28b161){_0x4e4bf5['push'](_0x4e4bf5['shift']());}};_0x529e0f(++_0xfaffdf);}(_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);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1b43c2c..225e3a3 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 _0xd7d3=['exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/tags','getTags','create','post'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xd7d3,0x1b6));var _0x3d7d=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0xd7d3[_0x2adfb1];return _0xa52d45;};'use strict';var multer=require(_0x3d7d('0x0'));var util=require('util');var path=require(_0x3d7d('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d7d('0x2'));var router=express[_0x3d7d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3d7d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3d7d('0x5'));var controller=require(_0x3d7d('0x6'));router[_0x3d7d('0x7')]('/',auth[_0x3d7d('0x8')](),controller[_0x3d7d('0x9')]);router[_0x3d7d('0x7')](_0x3d7d('0xa'),auth[_0x3d7d('0x8')](),controller[_0x3d7d('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x3d7d('0xc'),auth['isAuthenticated'](),controller[_0x3d7d('0xd')]);router[_0x3d7d('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3d7d('0x7')](_0x3d7d('0xe'),auth[_0x3d7d('0x8')](),controller[_0x3d7d('0xf')]);router['post']('/',auth[_0x3d7d('0x8')](),controller[_0x3d7d('0x10')]);router[_0x3d7d('0x11')]('/:id/tags',auth[_0x3d7d('0x8')](),controller['setTags']);router['put'](_0x3d7d('0xa'),auth[_0x3d7d('0x8')](),controller['update']);router['delete'](_0x3d7d('0xa'),auth[_0x3d7d('0x8')](),controller['destroy']);module[_0x3d7d('0x12')]=router; \ No newline at end of file +var _0x2c3c=['get','isAuthenticated','index','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller'];(function(_0x4e7490,_0x4b26ae){var _0x3622d0=function(_0x40a2bb){while(--_0x40a2bb){_0x4e7490['push'](_0x4e7490['shift']());}};_0x3622d0(++_0x4b26ae);}(_0x2c3c,0x1cc));var _0xc2c3=function(_0x90f6be,_0x5ebf25){_0x90f6be=_0x90f6be-0x0;var _0x41f160=_0x2c3c[_0x90f6be];return _0x41f160;};'use strict';var multer=require('multer');var util=require(_0xc2c3('0x0'));var path=require(_0xc2c3('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2c3('0x2'));var router=express['Router']();var fs_extra=require(_0xc2c3('0x3'));var auth=require(_0xc2c3('0x4'));var interaction=require(_0xc2c3('0x5'));var config=require(_0xc2c3('0x6'));var controller=require(_0xc2c3('0x7'));router[_0xc2c3('0x8')]('/',auth[_0xc2c3('0x9')](),controller[_0xc2c3('0xa')]);router[_0xc2c3('0x8')]('/:id',auth[_0xc2c3('0x9')](),controller[_0xc2c3('0xb')]);router['get'](_0xc2c3('0xc'),auth[_0xc2c3('0x9')](),controller[_0xc2c3('0xd')]);router[_0xc2c3('0x8')]('/:id/subjects',auth[_0xc2c3('0x9')](),controller['getSubjects']);router['get'](_0xc2c3('0xe'),auth[_0xc2c3('0x9')](),controller[_0xc2c3('0xf')]);router[_0xc2c3('0x8')](_0xc2c3('0x10'),auth[_0xc2c3('0x9')](),controller[_0xc2c3('0x11')]);router[_0xc2c3('0x12')]('/',auth[_0xc2c3('0x9')](),controller[_0xc2c3('0x13')]);router[_0xc2c3('0x12')](_0xc2c3('0x10'),auth[_0xc2c3('0x9')](),controller[_0xc2c3('0x14')]);router[_0xc2c3('0x15')](_0xc2c3('0x16'),auth[_0xc2c3('0x9')](),controller[_0xc2c3('0x17')]);router['delete'](_0xc2c3('0x16'),auth[_0xc2c3('0x9')](),controller[_0xc2c3('0x18')]);module[_0xc2c3('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 71fa7c1..fcca2c0 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 _0xe254=['sequelize','exports','STRING'];(function(_0x47d501,_0x57a192){var _0x10cff5=function(_0xd3b350){while(--_0xd3b350){_0x47d501['push'](_0x47d501['shift']());}};_0x10cff5(++_0x57a192);}(_0xe254,0x13e));var _0x4e25=function(_0x53337d,_0x59714b){_0x53337d=_0x53337d-0x0;var _0x2ef0b7=_0xe254[_0x53337d];return _0x2ef0b7;};'use strict';var Sequelize=require(_0x4e25('0x0'));module[_0x4e25('0x1')]={'name':{'type':Sequelize[_0x4e25('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd951=['sequelize','exports','STRING'];(function(_0x2433fa,_0x4af7b9){var _0x3b7c04=function(_0x2806d0){while(--_0x2806d0){_0x2433fa['push'](_0x2433fa['shift']());}};_0x3b7c04(++_0x4af7b9);}(_0xd951,0x12f));var _0x1d95=function(_0x322020,_0x4a1883){_0x322020=_0x322020-0x0;var _0x2d696b=_0xd951[_0x322020];return _0x2d696b;};'use strict';var Sequelize=require(_0x1d95('0x0'));module[_0x1d95('0x1')]={'name':{'type':Sequelize[_0x1d95('0x2')]},'description':{'type':Sequelize[_0x1d95('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0215431..da06968 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 _0xa7ad=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','ZendeskConfiguration','length','options','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa7ad,0xc4));var _0xda7a=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xa7ad[_0x2aea9e];return _0x430b92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda7a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda7a('0x1'));var rp=require(_0xda7a('0x2'));var moment=require(_0xda7a('0x3'));var BPromise=require(_0xda7a('0x4'));var Mustache=require(_0xda7a('0x5'));var util=require(_0xda7a('0x6'));var path=require(_0xda7a('0x7'));var sox=require(_0xda7a('0x8'));var csv=require(_0xda7a('0x9'));var ejs=require(_0xda7a('0xa'));var fs=require('fs');var fs_extra=require(_0xda7a('0xb'));var _=require(_0xda7a('0xc'));var squel=require(_0xda7a('0xd'));var crypto=require(_0xda7a('0xe'));var jsforce=require(_0xda7a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda7a('0x10'));var Papa=require(_0xda7a('0x11'));var Redis=require('ioredis');var authService=require(_0xda7a('0x12'));var qs=require(_0xda7a('0x13'));var as=require(_0xda7a('0x14'));var hardwareService=require(_0xda7a('0x15'));var logger=require(_0xda7a('0x16'))(_0xda7a('0x17'));var utils=require(_0xda7a('0x18'));var config=require(_0xda7a('0x19'));var licenseUtil=require(_0xda7a('0x1a'));var db=require(_0xda7a('0x1b'))['db'];var jayson=require(_0xda7a('0x1c'));var client=jayson[_0xda7a('0x1d')][_0xda7a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2202de,_0x2702ce,_0xf3da35,_0x3d20db){return new BPromise(function(_0x2ad4e5,_0x432809){var _0x4c0ff1=_0x3d20db||client;return _0x4c0ff1[_0xda7a('0x1f')](_0x2202de,_0xf3da35)[_0xda7a('0x20')](function(_0x1b01d0){logger[_0xda7a('0x21')](_0xda7a('0x22'),_0x2702ce,'request\x20sent');logger[_0xda7a('0x23')](_0xda7a('0x24'),_0x2702ce,_0xda7a('0x25'),JSON['stringify'](_0x1b01d0));if(_0x1b01d0[_0xda7a('0x26')]){if(_0x1b01d0[_0xda7a('0x26')][_0xda7a('0x27')]===0x1f4){logger[_0xda7a('0x26')](_0xda7a('0x22'),_0x2702ce,_0x1b01d0[_0xda7a('0x26')]['message']);return _0x432809(_0x1b01d0[_0xda7a('0x26')][_0xda7a('0x28')]);}logger[_0xda7a('0x26')](_0xda7a('0x22'),_0x2702ce,_0x1b01d0[_0xda7a('0x26')]['message']);return _0x2ad4e5(_0x1b01d0[_0xda7a('0x26')][_0xda7a('0x28')]);}else{logger[_0xda7a('0x21')](_0xda7a('0x22'),_0x2702ce,_0xda7a('0x25'));_0x2ad4e5(_0x1b01d0[_0xda7a('0x29')]['message']);}})[_0xda7a('0x2a')](function(_0x3f135d){logger[_0xda7a('0x26')](_0xda7a('0x22'),_0x2702ce,_0x3f135d);_0x432809(_0x3f135d);});});}function respondWithStatusCode(_0xd07a0b,_0x4bda97){_0x4bda97=_0x4bda97||0xcc;return function(_0x1cd325){if(_0x1cd325){return _0xd07a0b[_0xda7a('0x2b')](_0x4bda97);}return _0xd07a0b[_0xda7a('0x2c')](_0x4bda97)[_0xda7a('0x2d')]();};}function respondWithResult(_0x3b9cee,_0x33bb2e){_0x33bb2e=_0x33bb2e||0xc8;return function(_0x128add){if(_0x128add){return _0x3b9cee['status'](_0x33bb2e)[_0xda7a('0x2e')](_0x128add);}};}function respondWithFilteredResult(_0x51aba5,_0x24fd60){return function(_0x5f01bd){if(_0x5f01bd){var _0x22ae3d=typeof _0x24fd60[_0xda7a('0x2f')]==='undefined'&&typeof _0x24fd60['limit']==='undefined';var _0x139b42=_0x5f01bd['count'];var _0x404fc9=_0x22ae3d?0x0:_0x24fd60[_0xda7a('0x2f')];var _0x5e431e=_0x22ae3d?_0x5f01bd[_0xda7a('0x30')]:_0x24fd60[_0xda7a('0x2f')]+_0x24fd60[_0xda7a('0x31')];var _0x2df6c6;if(_0x5e431e>=_0x139b42){_0x5e431e=_0x139b42;_0x2df6c6=0xc8;}else{_0x2df6c6=0xce;}_0x51aba5[_0xda7a('0x2c')](_0x2df6c6);return _0x51aba5[_0xda7a('0x32')](_0xda7a('0x33'),_0x404fc9+'-'+_0x5e431e+'/'+_0x139b42)['json'](_0x5f01bd);}return null;};}function patchUpdates(_0x1808c3){return function(_0x2a253a){try{jsonpatch[_0xda7a('0x34')](_0x2a253a,_0x1808c3,!![]);}catch(_0x59e307){return BPromise[_0xda7a('0x35')](_0x59e307);}return _0x2a253a[_0xda7a('0x36')]();};}function saveUpdates(_0x3ec3f5,_0x25df58){return function(_0x77aba8){if(_0x77aba8){return _0x77aba8[_0xda7a('0x37')](_0x3ec3f5)['then'](function(_0x243ced){return _0x243ced;});}return null;};}function removeEntity(_0x1614f6,_0x46d5a4){return function(_0xf28bcc){if(_0xf28bcc){return _0xf28bcc[_0xda7a('0x38')]()[_0xda7a('0x20')](function(){_0x1614f6[_0xda7a('0x2c')](0xcc)[_0xda7a('0x2d')]();});}};}function handleEntityNotFound(_0x2a5b07,_0x53f2df){return function(_0x159152){if(!_0x159152){_0x2a5b07['sendStatus'](0x194);}return _0x159152;};}function handleError(_0x1204c6,_0x4e50c3){_0x4e50c3=_0x4e50c3||0x1f4;return function(_0x3e86b9){logger[_0xda7a('0x26')](_0x3e86b9[_0xda7a('0x39')]);if(_0x3e86b9[_0xda7a('0x3a')]){delete _0x3e86b9['name'];}_0x1204c6['status'](_0x4e50c3)[_0xda7a('0x3b')](_0x3e86b9);};}exports[_0xda7a('0x3c')]=function(_0x3da29a,_0xc12c1){var _0x4388c1={},_0x3b90a7={},_0xb3dcae={'count':0x0,'rows':[]};var _0x261eff=_[_0xda7a('0x3d')](db['ZendeskConfiguration'][_0xda7a('0x3e')],function(_0x25c369){return{'name':_0x25c369[_0xda7a('0x3f')],'type':_0x25c369['type'][_0xda7a('0x40')]};});_0x3b90a7[_0xda7a('0x41')]=_['map'](_0x261eff,_0xda7a('0x3a'));_0x3b90a7[_0xda7a('0x42')]=_[_0xda7a('0x43')](_0x3da29a[_0xda7a('0x42')]);_0x3b90a7[_0xda7a('0x44')]=_['intersection'](_0x3b90a7['model'],_0x3b90a7[_0xda7a('0x42')]);_0x4388c1['attributes']=_[_0xda7a('0x45')](_0x3b90a7[_0xda7a('0x41')],qs[_0xda7a('0x46')](_0x3da29a['query'][_0xda7a('0x46')]));_0x4388c1['attributes']=_0x4388c1[_0xda7a('0x47')]['length']?_0x4388c1[_0xda7a('0x47')]:_0x3b90a7[_0xda7a('0x41')];if(!_0x3da29a[_0xda7a('0x42')][_0xda7a('0x48')](_0xda7a('0x49'))){_0x4388c1[_0xda7a('0x31')]=qs[_0xda7a('0x31')](_0x3da29a[_0xda7a('0x42')][_0xda7a('0x31')]);_0x4388c1[_0xda7a('0x2f')]=qs[_0xda7a('0x2f')](_0x3da29a[_0xda7a('0x42')][_0xda7a('0x2f')]);}_0x4388c1[_0xda7a('0x4a')]=qs['sort'](_0x3da29a[_0xda7a('0x42')][_0xda7a('0x4b')]);_0x4388c1[_0xda7a('0x4c')]=qs[_0xda7a('0x44')](_[_0xda7a('0x4d')](_0x3da29a['query'],_0x3b90a7[_0xda7a('0x44')]),_0x261eff);if(_0x3da29a[_0xda7a('0x42')][_0xda7a('0x4e')]){_0x4388c1[_0xda7a('0x4c')]=_[_0xda7a('0x4f')](_0x4388c1[_0xda7a('0x4c')],{'$or':_[_0xda7a('0x3d')](_0x261eff,function(_0x1c183f){if(_0x1c183f['type']!==_0xda7a('0x50')){var _0x365ee8={};_0x365ee8[_0x1c183f['name']]={'$like':'%'+_0x3da29a['query'][_0xda7a('0x4e')]+'%'};return _0x365ee8;}})});}_0x4388c1=_[_0xda7a('0x4f')]({},_0x4388c1,_0x3da29a['options']);var _0x3518ca={'where':_0x4388c1['where']};return db['ZendeskConfiguration'][_0xda7a('0x30')](_0x3518ca)['then'](function(_0x67d1c4){_0xb3dcae['count']=_0x67d1c4;if(_0x3da29a[_0xda7a('0x42')][_0xda7a('0x51')]){_0x4388c1[_0xda7a('0x52')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xda7a('0x53')](_0x4388c1);})['then'](function(_0x3de09e){_0xb3dcae[_0xda7a('0x54')]=_0x3de09e;return _0xb3dcae;})[_0xda7a('0x20')](respondWithFilteredResult(_0xc12c1,_0x4388c1))[_0xda7a('0x2a')](handleError(_0xc12c1,null));};exports[_0xda7a('0x55')]=function(_0x481f7d,_0x34860c){var _0x23586b={'raw':![],'where':{'id':_0x481f7d[_0xda7a('0x56')]['id']}},_0x4264a5={};_0x4264a5[_0xda7a('0x41')]=_[_0xda7a('0x43')](db[_0xda7a('0x57')][_0xda7a('0x3e')]);_0x4264a5[_0xda7a('0x42')]=_[_0xda7a('0x43')](_0x481f7d[_0xda7a('0x42')]);_0x4264a5[_0xda7a('0x44')]=_[_0xda7a('0x45')](_0x4264a5['model'],_0x4264a5[_0xda7a('0x42')]);_0x23586b[_0xda7a('0x47')]=_['intersection'](_0x4264a5[_0xda7a('0x41')],qs[_0xda7a('0x46')](_0x481f7d[_0xda7a('0x42')]['fields']));_0x23586b[_0xda7a('0x47')]=_0x23586b[_0xda7a('0x47')][_0xda7a('0x58')]?_0x23586b[_0xda7a('0x47')]:_0x4264a5[_0xda7a('0x41')];if(_0x481f7d[_0xda7a('0x42')][_0xda7a('0x51')]){_0x23586b[_0xda7a('0x52')]=[{'all':!![]}];}_0x23586b=_['merge']({},_0x23586b,_0x481f7d[_0xda7a('0x59')]);return db[_0xda7a('0x57')][_0xda7a('0x5a')](_0x23586b)['then'](handleEntityNotFound(_0x34860c,null))[_0xda7a('0x20')](respondWithResult(_0x34860c,null))[_0xda7a('0x2a')](handleError(_0x34860c,null));};exports[_0xda7a('0x5b')]=function(_0x3c0990,_0x2a55e6){return db['ZendeskConfiguration'][_0xda7a('0x5b')](_0x3c0990['body'],{})[_0xda7a('0x20')](respondWithResult(_0x2a55e6,0xc9))['catch'](handleError(_0x2a55e6,null));};exports[_0xda7a('0x37')]=function(_0x44afdb,_0x3f5bc2){if(_0x44afdb[_0xda7a('0x5c')]['id']){delete _0x44afdb[_0xda7a('0x5c')]['id'];}return db[_0xda7a('0x57')]['find']({'where':{'id':_0x44afdb[_0xda7a('0x56')]['id']}})[_0xda7a('0x20')](handleEntityNotFound(_0x3f5bc2,null))['then'](saveUpdates(_0x44afdb[_0xda7a('0x5c')],null))[_0xda7a('0x20')](respondWithResult(_0x3f5bc2,null))[_0xda7a('0x2a')](handleError(_0x3f5bc2,null));};exports[_0xda7a('0x38')]=function(_0x2761ea,_0x25860c){return db[_0xda7a('0x57')][_0xda7a('0x5a')]({'where':{'id':_0x2761ea[_0xda7a('0x56')]['id']}})[_0xda7a('0x20')](handleEntityNotFound(_0x25860c,null))[_0xda7a('0x20')](removeEntity(_0x25860c,null))[_0xda7a('0x2a')](handleError(_0x25860c,null));};exports[_0xda7a('0x5d')]=function(_0x55e178,_0x27bd17,_0x2553bb){var _0x52dc28={};var _0xb074a={};var _0x40f8bc;var _0x409631;return db[_0xda7a('0x57')][_0xda7a('0x5e')]({'where':{'id':_0x55e178['params']['id']}})[_0xda7a('0x20')](handleEntityNotFound(_0x27bd17,null))[_0xda7a('0x20')](function(_0x511006){if(_0x511006){_0x40f8bc=_0x511006;_0xb074a[_0xda7a('0x41')]=_['keys'](db[_0xda7a('0x5f')][_0xda7a('0x3e')]);_0xb074a[_0xda7a('0x42')]=_['keys'](_0x55e178[_0xda7a('0x42')]);_0xb074a[_0xda7a('0x44')]=_[_0xda7a('0x45')](_0xb074a[_0xda7a('0x41')],_0xb074a[_0xda7a('0x42')]);_0x52dc28[_0xda7a('0x47')]=_[_0xda7a('0x45')](_0xb074a[_0xda7a('0x41')],qs['fields'](_0x55e178['query'][_0xda7a('0x46')]));_0x52dc28[_0xda7a('0x47')]=_0x52dc28[_0xda7a('0x47')]['length']?_0x52dc28[_0xda7a('0x47')]:_0xb074a['model'];_0x52dc28[_0xda7a('0x4a')]=qs['sort'](_0x55e178[_0xda7a('0x42')]['sort']);_0x52dc28['where']=qs['filters'](_[_0xda7a('0x4d')](_0x55e178[_0xda7a('0x42')],_0xb074a[_0xda7a('0x44')]));if(_0x55e178[_0xda7a('0x42')]['filter']){_0x52dc28['where']=_[_0xda7a('0x4f')](_0x52dc28[_0xda7a('0x4c')],{'$or':_[_0xda7a('0x3d')](_0x52dc28['attributes'],function(_0x46bb6f){var _0x259ee2={};_0x259ee2[_0x46bb6f]={'$like':'%'+_0x55e178[_0xda7a('0x42')]['filter']+'%'};return _0x259ee2;})});}_0x52dc28=_['merge']({},_0x52dc28,_0x55e178[_0xda7a('0x59')]);return _0x40f8bc[_0xda7a('0x5d')](_0x52dc28);}})[_0xda7a('0x20')](function(_0x29b692){if(_0x29b692){_0x409631=_0x29b692[_0xda7a('0x58')];if(!_0x55e178[_0xda7a('0x42')][_0xda7a('0x48')](_0xda7a('0x49'))){_0x52dc28[_0xda7a('0x31')]=qs[_0xda7a('0x31')](_0x55e178[_0xda7a('0x42')][_0xda7a('0x31')]);_0x52dc28['offset']=qs[_0xda7a('0x2f')](_0x55e178[_0xda7a('0x42')][_0xda7a('0x2f')]);}return _0x40f8bc[_0xda7a('0x5d')](_0x52dc28);}})[_0xda7a('0x20')](function(_0x10c4e1){if(_0x10c4e1){return _0x10c4e1?{'count':_0x409631,'rows':_0x10c4e1}:null;}})['then'](respondWithResult(_0x27bd17,null))[_0xda7a('0x2a')](handleError(_0x27bd17,null));};exports['getSubjects']=function(_0x3b85a6,_0x5f2749,_0x86949b){var _0x3de19b={};var _0x160bb8={};var _0xb0239;var _0x1ef1f2;return db[_0xda7a('0x57')][_0xda7a('0x5e')]({'where':{'id':_0x3b85a6['params']['id']}})[_0xda7a('0x20')](handleEntityNotFound(_0x5f2749,null))[_0xda7a('0x20')](function(_0x2eb291){if(_0x2eb291){_0xb0239=_0x2eb291;_0x160bb8[_0xda7a('0x41')]=_[_0xda7a('0x43')](db[_0xda7a('0x5f')][_0xda7a('0x3e')]);_0x160bb8[_0xda7a('0x42')]=_[_0xda7a('0x43')](_0x3b85a6[_0xda7a('0x42')]);_0x160bb8[_0xda7a('0x44')]=_['intersection'](_0x160bb8[_0xda7a('0x41')],_0x160bb8['query']);_0x3de19b[_0xda7a('0x47')]=_[_0xda7a('0x45')](_0x160bb8[_0xda7a('0x41')],qs[_0xda7a('0x46')](_0x3b85a6[_0xda7a('0x42')][_0xda7a('0x46')]));_0x3de19b[_0xda7a('0x47')]=_0x3de19b[_0xda7a('0x47')][_0xda7a('0x58')]?_0x3de19b['attributes']:_0x160bb8[_0xda7a('0x41')];_0x3de19b[_0xda7a('0x4a')]=qs[_0xda7a('0x4b')](_0x3b85a6[_0xda7a('0x42')]['sort']);_0x3de19b[_0xda7a('0x4c')]=qs[_0xda7a('0x44')](_[_0xda7a('0x4d')](_0x3b85a6[_0xda7a('0x42')],_0x160bb8[_0xda7a('0x44')]));if(_0x3b85a6[_0xda7a('0x42')][_0xda7a('0x4e')]){_0x3de19b[_0xda7a('0x4c')]=_[_0xda7a('0x4f')](_0x3de19b['where'],{'$or':_[_0xda7a('0x3d')](_0x3de19b[_0xda7a('0x47')],function(_0x28e31f){var _0x157492={};_0x157492[_0x28e31f]={'$like':'%'+_0x3b85a6[_0xda7a('0x42')]['filter']+'%'};return _0x157492;})});}_0x3de19b=_['merge']({},_0x3de19b,_0x3b85a6[_0xda7a('0x59')]);return _0xb0239[_0xda7a('0x60')](_0x3de19b);}})['then'](function(_0x295a6a){if(_0x295a6a){_0x1ef1f2=_0x295a6a[_0xda7a('0x58')];if(!_0x3b85a6[_0xda7a('0x42')][_0xda7a('0x48')]('nolimit')){_0x3de19b[_0xda7a('0x31')]=qs[_0xda7a('0x31')](_0x3b85a6[_0xda7a('0x42')][_0xda7a('0x31')]);_0x3de19b['offset']=qs[_0xda7a('0x2f')](_0x3b85a6[_0xda7a('0x42')][_0xda7a('0x2f')]);}return _0xb0239[_0xda7a('0x60')](_0x3de19b);}})[_0xda7a('0x20')](function(_0x124647){if(_0x124647){return _0x124647?{'count':_0x1ef1f2,'rows':_0x124647}:null;}})[_0xda7a('0x20')](respondWithResult(_0x5f2749,null))['catch'](handleError(_0x5f2749,null));};exports[_0xda7a('0x61')]=function(_0x3838a4,_0x3bb1a2,_0x436aa6){var _0x2340d5={};var _0x3eb15b={};var _0xadacd5;var _0x544bab;return db[_0xda7a('0x57')][_0xda7a('0x5e')]({'where':{'id':_0x3838a4[_0xda7a('0x56')]['id']}})['then'](handleEntityNotFound(_0x3bb1a2,null))[_0xda7a('0x20')](function(_0x25f756){if(_0x25f756){_0xadacd5=_0x25f756;_0x3eb15b[_0xda7a('0x41')]=_[_0xda7a('0x43')](db[_0xda7a('0x5f')][_0xda7a('0x3e')]);_0x3eb15b[_0xda7a('0x42')]=_[_0xda7a('0x43')](_0x3838a4[_0xda7a('0x42')]);_0x3eb15b[_0xda7a('0x44')]=_['intersection'](_0x3eb15b[_0xda7a('0x41')],_0x3eb15b[_0xda7a('0x42')]);_0x2340d5[_0xda7a('0x47')]=_['intersection'](_0x3eb15b[_0xda7a('0x41')],qs[_0xda7a('0x46')](_0x3838a4[_0xda7a('0x42')][_0xda7a('0x46')]));_0x2340d5['attributes']=_0x2340d5[_0xda7a('0x47')][_0xda7a('0x58')]?_0x2340d5[_0xda7a('0x47')]:_0x3eb15b[_0xda7a('0x41')];_0x2340d5[_0xda7a('0x4a')]=qs[_0xda7a('0x4b')](_0x3838a4['query'][_0xda7a('0x4b')]);_0x2340d5[_0xda7a('0x4c')]=qs['filters'](_['pick'](_0x3838a4[_0xda7a('0x42')],_0x3eb15b[_0xda7a('0x44')]));if(_0x3838a4['query'][_0xda7a('0x4e')]){_0x2340d5[_0xda7a('0x4c')]=_[_0xda7a('0x4f')](_0x2340d5[_0xda7a('0x4c')],{'$or':_[_0xda7a('0x3d')](_0x2340d5['attributes'],function(_0x2e5eeb){var _0x5b803e={};_0x5b803e[_0x2e5eeb]={'$like':'%'+_0x3838a4[_0xda7a('0x42')][_0xda7a('0x4e')]+'%'};return _0x5b803e;})});}_0x2340d5=_[_0xda7a('0x4f')]({},_0x2340d5,_0x3838a4[_0xda7a('0x59')]);return _0xadacd5[_0xda7a('0x61')](_0x2340d5);}})[_0xda7a('0x20')](function(_0x5cca9d){if(_0x5cca9d){_0x544bab=_0x5cca9d['length'];if(!_0x3838a4['query'][_0xda7a('0x48')](_0xda7a('0x49'))){_0x2340d5[_0xda7a('0x31')]=qs[_0xda7a('0x31')](_0x3838a4['query'][_0xda7a('0x31')]);_0x2340d5[_0xda7a('0x2f')]=qs['offset'](_0x3838a4[_0xda7a('0x42')][_0xda7a('0x2f')]);}return _0xadacd5['getDescriptions'](_0x2340d5);}})[_0xda7a('0x20')](function(_0x271c87){if(_0x271c87){return _0x271c87?{'count':_0x544bab,'rows':_0x271c87}:null;}})[_0xda7a('0x20')](respondWithResult(_0x3bb1a2,null))[_0xda7a('0x2a')](handleError(_0x3bb1a2,null));};exports[_0xda7a('0x62')]=function(_0x12541b,_0x1a939f,_0x39eae7){var _0x3d3cbc={};var _0x49768e={};var _0x52b4cd;var _0x4fc4a6;return db[_0xda7a('0x57')][_0xda7a('0x5e')]({'where':{'id':_0x12541b[_0xda7a('0x56')]['id']}})['then'](handleEntityNotFound(_0x1a939f,null))[_0xda7a('0x20')](function(_0x513c1a){if(_0x513c1a){_0x52b4cd=_0x513c1a;_0x49768e[_0xda7a('0x41')]=_[_0xda7a('0x43')](db[_0xda7a('0x63')][_0xda7a('0x3e')]);_0x49768e['query']=_[_0xda7a('0x43')](_0x12541b['query']);_0x49768e[_0xda7a('0x44')]=_[_0xda7a('0x45')](_0x49768e[_0xda7a('0x41')],_0x49768e['query']);_0x3d3cbc[_0xda7a('0x47')]=_[_0xda7a('0x45')](_0x49768e['model'],qs[_0xda7a('0x46')](_0x12541b['query'][_0xda7a('0x46')]));_0x3d3cbc[_0xda7a('0x47')]=_0x3d3cbc[_0xda7a('0x47')]['length']?_0x3d3cbc[_0xda7a('0x47')]:_0x49768e[_0xda7a('0x41')];_0x3d3cbc['order']=qs['sort'](_0x12541b[_0xda7a('0x42')][_0xda7a('0x4b')]);_0x3d3cbc[_0xda7a('0x4c')]=qs[_0xda7a('0x44')](_[_0xda7a('0x4d')](_0x12541b['query'],_0x49768e[_0xda7a('0x44')]));if(_0x12541b['query'][_0xda7a('0x4e')]){_0x3d3cbc[_0xda7a('0x4c')]=_[_0xda7a('0x4f')](_0x3d3cbc[_0xda7a('0x4c')],{'$or':_[_0xda7a('0x3d')](_0x3d3cbc[_0xda7a('0x47')],function(_0x2991f8){var _0x443289={};_0x443289[_0x2991f8]={'$like':'%'+_0x12541b[_0xda7a('0x42')][_0xda7a('0x4e')]+'%'};return _0x443289;})});}_0x3d3cbc=_['merge']({},_0x3d3cbc,_0x12541b['options']);return _0x52b4cd['getTags'](_0x3d3cbc);}})[_0xda7a('0x20')](function(_0x6172f3){if(_0x6172f3){_0x4fc4a6=_0x6172f3[_0xda7a('0x58')];if(!_0x12541b[_0xda7a('0x42')]['hasOwnProperty'](_0xda7a('0x49'))){_0x3d3cbc['limit']=qs[_0xda7a('0x31')](_0x12541b[_0xda7a('0x42')]['limit']);_0x3d3cbc[_0xda7a('0x2f')]=qs['offset'](_0x12541b[_0xda7a('0x42')][_0xda7a('0x2f')]);}return _0x52b4cd[_0xda7a('0x62')](_0x3d3cbc);}})[_0xda7a('0x20')](function(_0x966b66){if(_0x966b66){return _0x966b66?{'count':_0x4fc4a6,'rows':_0x966b66}:null;}})['then'](respondWithResult(_0x1a939f,null))['catch'](handleError(_0x1a939f,null));};exports[_0xda7a('0x64')]=function(_0x418d0d,_0x35d521,_0x4f54b6){if(_0x418d0d[_0xda7a('0x5c')]['id']){delete _0x418d0d[_0xda7a('0x5c')]['id'];}return db['ZendeskConfiguration'][_0xda7a('0x5e')]({'where':{'id':_0x418d0d['params']['id']}})[_0xda7a('0x20')](handleEntityNotFound(_0x35d521,null))['then'](function(_0xba1a38){if(_0xba1a38){return _0xba1a38[_0xda7a('0x64')](_0x418d0d[_0xda7a('0x5c')][_0xda7a('0x65')]||[]);}return null;})[_0xda7a('0x20')](respondWithResult(_0x35d521,null))[_0xda7a('0x2a')](handleError(_0x35d521,null));}; \ No newline at end of file +var _0xe820=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','length','include','find','create','body','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0xeb255b,_0x27451c){var _0x24e874=function(_0x8267ec){while(--_0x8267ec){_0xeb255b['push'](_0xeb255b['shift']());}};_0x24e874(++_0x27451c);}(_0xe820,0x10a));var _0x0e82=function(_0x3c9427,_0x36e0b0){_0x3c9427=_0x3c9427-0x0;var _0xbaa97c=_0xe820[_0x3c9427];return _0xbaa97c;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require(_0x0e82('0x1'));var zipdir=require(_0x0e82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e82('0x3'));var moment=require('moment');var BPromise=require(_0x0e82('0x4'));var Mustache=require(_0x0e82('0x5'));var util=require(_0x0e82('0x6'));var path=require(_0x0e82('0x7'));var sox=require('sox');var csv=require(_0x0e82('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e82('0x9'));var _=require(_0x0e82('0xa'));var squel=require(_0x0e82('0xb'));var crypto=require(_0x0e82('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require(_0x0e82('0xf'));var authService=require(_0x0e82('0x10'));var qs=require(_0x0e82('0x11'));var as=require(_0x0e82('0x12'));var hardwareService=require(_0x0e82('0x13'));var logger=require(_0x0e82('0x14'))('api');var utils=require(_0x0e82('0x15'));var config=require(_0x0e82('0x16'));var licenseUtil=require(_0x0e82('0x17'));var db=require(_0x0e82('0x18'))['db'];var jayson=require(_0x0e82('0x19'));var client=jayson[_0x0e82('0x1a')][_0x0e82('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x28d5f9,_0x4287a2,_0x20d34e,_0x57e104){return new BPromise(function(_0x478c53,_0x3d51b0){var _0x439fe2=_0x57e104||client;return _0x439fe2[_0x0e82('0x1c')](_0x28d5f9,_0x20d34e)[_0x0e82('0x1d')](function(_0x2db813){logger['info'](_0x0e82('0x1e'),_0x4287a2,_0x0e82('0x1f'));logger[_0x0e82('0x20')](_0x0e82('0x21'),_0x4287a2,'request\x20sent',JSON[_0x0e82('0x22')](_0x2db813));if(_0x2db813[_0x0e82('0x23')]){if(_0x2db813['error'][_0x0e82('0x24')]===0x1f4){logger[_0x0e82('0x23')](_0x0e82('0x1e'),_0x4287a2,_0x2db813[_0x0e82('0x23')][_0x0e82('0x25')]);return _0x3d51b0(_0x2db813[_0x0e82('0x23')][_0x0e82('0x25')]);}logger['error'](_0x0e82('0x1e'),_0x4287a2,_0x2db813['error'][_0x0e82('0x25')]);return _0x478c53(_0x2db813[_0x0e82('0x23')][_0x0e82('0x25')]);}else{logger[_0x0e82('0x26')](_0x0e82('0x1e'),_0x4287a2,_0x0e82('0x1f'));_0x478c53(_0x2db813['result'][_0x0e82('0x25')]);}})[_0x0e82('0x27')](function(_0x2042b2){logger[_0x0e82('0x23')](_0x0e82('0x1e'),_0x4287a2,_0x2042b2);_0x3d51b0(_0x2042b2);});});}function respondWithStatusCode(_0x4387e7,_0x11a9ca){_0x11a9ca=_0x11a9ca||0xcc;return function(_0x38dde4){if(_0x38dde4){return _0x4387e7['sendStatus'](_0x11a9ca);}return _0x4387e7[_0x0e82('0x28')](_0x11a9ca)[_0x0e82('0x29')]();};}function respondWithResult(_0x4a264d,_0x568632){_0x568632=_0x568632||0xc8;return function(_0x333729){if(_0x333729){return _0x4a264d[_0x0e82('0x28')](_0x568632)[_0x0e82('0x2a')](_0x333729);}};}function respondWithFilteredResult(_0xf66a12,_0x402f95){return function(_0x5063e0){if(_0x5063e0){var _0xb8caa8=typeof _0x402f95[_0x0e82('0x2b')]===_0x0e82('0x2c')&&typeof _0x402f95[_0x0e82('0x2d')]===_0x0e82('0x2c');var _0x6d1c7f=_0x5063e0[_0x0e82('0x2e')];var _0x466d45=_0xb8caa8?0x0:_0x402f95[_0x0e82('0x2b')];var _0x64542f=_0xb8caa8?_0x5063e0[_0x0e82('0x2e')]:_0x402f95[_0x0e82('0x2b')]+_0x402f95[_0x0e82('0x2d')];var _0x4d55ea;if(_0x64542f>=_0x6d1c7f){_0x64542f=_0x6d1c7f;_0x4d55ea=0xc8;}else{_0x4d55ea=0xce;}_0xf66a12[_0x0e82('0x28')](_0x4d55ea);return _0xf66a12[_0x0e82('0x2f')](_0x0e82('0x30'),_0x466d45+'-'+_0x64542f+'/'+_0x6d1c7f)[_0x0e82('0x2a')](_0x5063e0);}return null;};}function patchUpdates(_0x2719d3){return function(_0x43e0c7){try{jsonpatch[_0x0e82('0x31')](_0x43e0c7,_0x2719d3,!![]);}catch(_0x168560){return BPromise['reject'](_0x168560);}return _0x43e0c7[_0x0e82('0x32')]();};}function saveUpdates(_0x1756ae,_0x568e99){return function(_0x1d149f){if(_0x1d149f){return _0x1d149f[_0x0e82('0x33')](_0x1756ae)[_0x0e82('0x1d')](function(_0x1bb6ec){return _0x1bb6ec;});}return null;};}function removeEntity(_0xb35924,_0x37080d){return function(_0x1f6ace){if(_0x1f6ace){return _0x1f6ace[_0x0e82('0x34')]()[_0x0e82('0x1d')](function(){_0xb35924[_0x0e82('0x28')](0xcc)[_0x0e82('0x29')]();});}};}function handleEntityNotFound(_0x30c057,_0x4f181e){return function(_0x260fac){if(!_0x260fac){_0x30c057[_0x0e82('0x35')](0x194);}return _0x260fac;};}function handleError(_0x346624,_0x3734dd){_0x3734dd=_0x3734dd||0x1f4;return function(_0x38b266){logger['error'](_0x38b266[_0x0e82('0x36')]);if(_0x38b266[_0x0e82('0x37')]){delete _0x38b266['name'];}_0x346624[_0x0e82('0x28')](_0x3734dd)[_0x0e82('0x38')](_0x38b266);};}exports[_0x0e82('0x39')]=function(_0x1314bd,_0x38d133){var _0x38edfe={},_0x225580={},_0x518ca9={'count':0x0,'rows':[]};var _0x519ef=_[_0x0e82('0x3a')](db[_0x0e82('0x3b')][_0x0e82('0x3c')],function(_0x339dd4){return{'name':_0x339dd4[_0x0e82('0x3d')],'type':_0x339dd4[_0x0e82('0x3e')][_0x0e82('0x3f')]};});_0x225580[_0x0e82('0x40')]=_['map'](_0x519ef,_0x0e82('0x37'));_0x225580[_0x0e82('0x41')]=_[_0x0e82('0x42')](_0x1314bd[_0x0e82('0x41')]);_0x225580[_0x0e82('0x43')]=_[_0x0e82('0x44')](_0x225580['model'],_0x225580[_0x0e82('0x41')]);_0x38edfe['attributes']=_[_0x0e82('0x44')](_0x225580['model'],qs[_0x0e82('0x45')](_0x1314bd[_0x0e82('0x41')][_0x0e82('0x45')]));_0x38edfe[_0x0e82('0x46')]=_0x38edfe[_0x0e82('0x46')]['length']?_0x38edfe[_0x0e82('0x46')]:_0x225580['model'];if(!_0x1314bd[_0x0e82('0x41')][_0x0e82('0x47')](_0x0e82('0x48'))){_0x38edfe[_0x0e82('0x2d')]=qs['limit'](_0x1314bd[_0x0e82('0x41')][_0x0e82('0x2d')]);_0x38edfe[_0x0e82('0x2b')]=qs[_0x0e82('0x2b')](_0x1314bd[_0x0e82('0x41')][_0x0e82('0x2b')]);}_0x38edfe['order']=qs[_0x0e82('0x49')](_0x1314bd[_0x0e82('0x41')][_0x0e82('0x49')]);_0x38edfe['where']=qs[_0x0e82('0x43')](_[_0x0e82('0x4a')](_0x1314bd[_0x0e82('0x41')],_0x225580[_0x0e82('0x43')]),_0x519ef);if(_0x1314bd[_0x0e82('0x41')][_0x0e82('0x4b')]){_0x38edfe[_0x0e82('0x4c')]=_[_0x0e82('0x4d')](_0x38edfe[_0x0e82('0x4c')],{'$or':_[_0x0e82('0x3a')](_0x519ef,function(_0x5dd301){if(_0x5dd301[_0x0e82('0x3e')]!==_0x0e82('0x4e')){var _0x54f3fc={};_0x54f3fc[_0x5dd301[_0x0e82('0x37')]]={'$like':'%'+_0x1314bd[_0x0e82('0x41')][_0x0e82('0x4b')]+'%'};return _0x54f3fc;}})});}_0x38edfe=_[_0x0e82('0x4d')]({},_0x38edfe,_0x1314bd[_0x0e82('0x4f')]);var _0xcd4ac1={'where':_0x38edfe['where']};return db[_0x0e82('0x3b')][_0x0e82('0x2e')](_0xcd4ac1)[_0x0e82('0x1d')](function(_0x54ea9c){_0x518ca9[_0x0e82('0x2e')]=_0x54ea9c;if(_0x1314bd[_0x0e82('0x41')][_0x0e82('0x50')]){_0x38edfe['include']=[{'all':!![]}];}return db[_0x0e82('0x3b')][_0x0e82('0x51')](_0x38edfe);})[_0x0e82('0x1d')](function(_0x566c2c){_0x518ca9['rows']=_0x566c2c;return _0x518ca9;})[_0x0e82('0x1d')](respondWithFilteredResult(_0x38d133,_0x38edfe))[_0x0e82('0x27')](handleError(_0x38d133,null));};exports[_0x0e82('0x52')]=function(_0x1b3dcb,_0x5109fb){var _0x52d54d={'raw':![],'where':{'id':_0x1b3dcb[_0x0e82('0x53')]['id']}},_0x11fa39={};_0x11fa39[_0x0e82('0x40')]=_['keys'](db[_0x0e82('0x3b')][_0x0e82('0x3c')]);_0x11fa39[_0x0e82('0x41')]=_[_0x0e82('0x42')](_0x1b3dcb[_0x0e82('0x41')]);_0x11fa39[_0x0e82('0x43')]=_['intersection'](_0x11fa39['model'],_0x11fa39[_0x0e82('0x41')]);_0x52d54d[_0x0e82('0x46')]=_[_0x0e82('0x44')](_0x11fa39[_0x0e82('0x40')],qs[_0x0e82('0x45')](_0x1b3dcb['query'][_0x0e82('0x45')]));_0x52d54d[_0x0e82('0x46')]=_0x52d54d['attributes'][_0x0e82('0x54')]?_0x52d54d[_0x0e82('0x46')]:_0x11fa39[_0x0e82('0x40')];if(_0x1b3dcb[_0x0e82('0x41')][_0x0e82('0x50')]){_0x52d54d[_0x0e82('0x55')]=[{'all':!![]}];}_0x52d54d=_[_0x0e82('0x4d')]({},_0x52d54d,_0x1b3dcb['options']);return db['ZendeskConfiguration'][_0x0e82('0x56')](_0x52d54d)[_0x0e82('0x1d')](handleEntityNotFound(_0x5109fb,null))[_0x0e82('0x1d')](respondWithResult(_0x5109fb,null))[_0x0e82('0x27')](handleError(_0x5109fb,null));};exports[_0x0e82('0x57')]=function(_0x3da216,_0x1a468e){return db['ZendeskConfiguration']['create'](_0x3da216['body'],{})[_0x0e82('0x1d')](respondWithResult(_0x1a468e,0xc9))['catch'](handleError(_0x1a468e,null));};exports[_0x0e82('0x33')]=function(_0x2d0efe,_0x6cd744){if(_0x2d0efe[_0x0e82('0x58')]['id']){delete _0x2d0efe[_0x0e82('0x58')]['id'];}return db[_0x0e82('0x3b')]['find']({'where':{'id':_0x2d0efe[_0x0e82('0x53')]['id']}})[_0x0e82('0x1d')](handleEntityNotFound(_0x6cd744,null))[_0x0e82('0x1d')](saveUpdates(_0x2d0efe[_0x0e82('0x58')],null))[_0x0e82('0x1d')](respondWithResult(_0x6cd744,null))[_0x0e82('0x27')](handleError(_0x6cd744,null));};exports[_0x0e82('0x34')]=function(_0x52d54f,_0x1e6194){return db[_0x0e82('0x3b')]['find']({'where':{'id':_0x52d54f[_0x0e82('0x53')]['id']}})[_0x0e82('0x1d')](handleEntityNotFound(_0x1e6194,null))['then'](removeEntity(_0x1e6194,null))[_0x0e82('0x27')](handleError(_0x1e6194,null));};exports[_0x0e82('0x59')]=function(_0x4e4581,_0x4c43ba,_0x2073c4){var _0x17be27={};var _0xc4b7cc={};var _0x2580e6;var _0x80d467;return db[_0x0e82('0x3b')][_0x0e82('0x5a')]({'where':{'id':_0x4e4581['params']['id']}})['then'](handleEntityNotFound(_0x4c43ba,null))[_0x0e82('0x1d')](function(_0x2d3d79){if(_0x2d3d79){_0x2580e6=_0x2d3d79;_0xc4b7cc['model']=_[_0x0e82('0x42')](db[_0x0e82('0x5b')][_0x0e82('0x3c')]);_0xc4b7cc['query']=_[_0x0e82('0x42')](_0x4e4581[_0x0e82('0x41')]);_0xc4b7cc[_0x0e82('0x43')]=_['intersection'](_0xc4b7cc['model'],_0xc4b7cc[_0x0e82('0x41')]);_0x17be27['attributes']=_[_0x0e82('0x44')](_0xc4b7cc[_0x0e82('0x40')],qs[_0x0e82('0x45')](_0x4e4581[_0x0e82('0x41')][_0x0e82('0x45')]));_0x17be27['attributes']=_0x17be27['attributes'][_0x0e82('0x54')]?_0x17be27[_0x0e82('0x46')]:_0xc4b7cc[_0x0e82('0x40')];_0x17be27[_0x0e82('0x5c')]=qs['sort'](_0x4e4581['query']['sort']);_0x17be27['where']=qs[_0x0e82('0x43')](_[_0x0e82('0x4a')](_0x4e4581[_0x0e82('0x41')],_0xc4b7cc[_0x0e82('0x43')]));if(_0x4e4581[_0x0e82('0x41')][_0x0e82('0x4b')]){_0x17be27[_0x0e82('0x4c')]=_[_0x0e82('0x4d')](_0x17be27[_0x0e82('0x4c')],{'$or':_['map'](_0x17be27[_0x0e82('0x46')],function(_0x1d9818){var _0x338150={};_0x338150[_0x1d9818]={'$like':'%'+_0x4e4581[_0x0e82('0x41')][_0x0e82('0x4b')]+'%'};return _0x338150;})});}_0x17be27=_[_0x0e82('0x4d')]({},_0x17be27,_0x4e4581[_0x0e82('0x4f')]);return _0x2580e6[_0x0e82('0x59')](_0x17be27);}})[_0x0e82('0x1d')](function(_0x4c8308){if(_0x4c8308){_0x80d467=_0x4c8308[_0x0e82('0x54')];if(!_0x4e4581[_0x0e82('0x41')][_0x0e82('0x47')]('nolimit')){_0x17be27[_0x0e82('0x2d')]=qs[_0x0e82('0x2d')](_0x4e4581[_0x0e82('0x41')]['limit']);_0x17be27[_0x0e82('0x2b')]=qs['offset'](_0x4e4581[_0x0e82('0x41')][_0x0e82('0x2b')]);}return _0x2580e6[_0x0e82('0x59')](_0x17be27);}})['then'](function(_0x482122){if(_0x482122){return _0x482122?{'count':_0x80d467,'rows':_0x482122}:null;}})[_0x0e82('0x1d')](respondWithResult(_0x4c43ba,null))['catch'](handleError(_0x4c43ba,null));};exports[_0x0e82('0x5d')]=function(_0x2d0528,_0x813c22,_0x114247){var _0x118994={};var _0x1ef976={};var _0x154af4;var _0x2df2b3;return db['ZendeskConfiguration'][_0x0e82('0x5a')]({'where':{'id':_0x2d0528['params']['id']}})[_0x0e82('0x1d')](handleEntityNotFound(_0x813c22,null))[_0x0e82('0x1d')](function(_0x25f43f){if(_0x25f43f){_0x154af4=_0x25f43f;_0x1ef976[_0x0e82('0x40')]=_['keys'](db[_0x0e82('0x5b')][_0x0e82('0x3c')]);_0x1ef976[_0x0e82('0x41')]=_[_0x0e82('0x42')](_0x2d0528[_0x0e82('0x41')]);_0x1ef976[_0x0e82('0x43')]=_['intersection'](_0x1ef976[_0x0e82('0x40')],_0x1ef976['query']);_0x118994[_0x0e82('0x46')]=_[_0x0e82('0x44')](_0x1ef976[_0x0e82('0x40')],qs[_0x0e82('0x45')](_0x2d0528[_0x0e82('0x41')]['fields']));_0x118994[_0x0e82('0x46')]=_0x118994[_0x0e82('0x46')][_0x0e82('0x54')]?_0x118994[_0x0e82('0x46')]:_0x1ef976[_0x0e82('0x40')];_0x118994['order']=qs[_0x0e82('0x49')](_0x2d0528[_0x0e82('0x41')][_0x0e82('0x49')]);_0x118994[_0x0e82('0x4c')]=qs[_0x0e82('0x43')](_['pick'](_0x2d0528['query'],_0x1ef976[_0x0e82('0x43')]));if(_0x2d0528[_0x0e82('0x41')]['filter']){_0x118994['where']=_[_0x0e82('0x4d')](_0x118994['where'],{'$or':_[_0x0e82('0x3a')](_0x118994[_0x0e82('0x46')],function(_0x250f78){var _0x2c5f75={};_0x2c5f75[_0x250f78]={'$like':'%'+_0x2d0528[_0x0e82('0x41')]['filter']+'%'};return _0x2c5f75;})});}_0x118994=_['merge']({},_0x118994,_0x2d0528[_0x0e82('0x4f')]);return _0x154af4['getSubjects'](_0x118994);}})[_0x0e82('0x1d')](function(_0x13a6f3){if(_0x13a6f3){_0x2df2b3=_0x13a6f3[_0x0e82('0x54')];if(!_0x2d0528[_0x0e82('0x41')][_0x0e82('0x47')](_0x0e82('0x48'))){_0x118994[_0x0e82('0x2d')]=qs[_0x0e82('0x2d')](_0x2d0528[_0x0e82('0x41')][_0x0e82('0x2d')]);_0x118994[_0x0e82('0x2b')]=qs[_0x0e82('0x2b')](_0x2d0528['query'][_0x0e82('0x2b')]);}return _0x154af4['getSubjects'](_0x118994);}})[_0x0e82('0x1d')](function(_0xd57551){if(_0xd57551){return _0xd57551?{'count':_0x2df2b3,'rows':_0xd57551}:null;}})[_0x0e82('0x1d')](respondWithResult(_0x813c22,null))[_0x0e82('0x27')](handleError(_0x813c22,null));};exports[_0x0e82('0x5e')]=function(_0x293267,_0x332c3e,_0x2357fa){var _0x41ec29={};var _0x5a25f4={};var _0x41747a;var _0x1049d6;return db[_0x0e82('0x3b')][_0x0e82('0x5a')]({'where':{'id':_0x293267[_0x0e82('0x53')]['id']}})['then'](handleEntityNotFound(_0x332c3e,null))[_0x0e82('0x1d')](function(_0x5e5d37){if(_0x5e5d37){_0x41747a=_0x5e5d37;_0x5a25f4[_0x0e82('0x40')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x5a25f4[_0x0e82('0x41')]=_[_0x0e82('0x42')](_0x293267[_0x0e82('0x41')]);_0x5a25f4[_0x0e82('0x43')]=_['intersection'](_0x5a25f4[_0x0e82('0x40')],_0x5a25f4['query']);_0x41ec29['attributes']=_['intersection'](_0x5a25f4[_0x0e82('0x40')],qs['fields'](_0x293267['query'][_0x0e82('0x45')]));_0x41ec29[_0x0e82('0x46')]=_0x41ec29['attributes'][_0x0e82('0x54')]?_0x41ec29['attributes']:_0x5a25f4[_0x0e82('0x40')];_0x41ec29['order']=qs['sort'](_0x293267['query'][_0x0e82('0x49')]);_0x41ec29[_0x0e82('0x4c')]=qs['filters'](_[_0x0e82('0x4a')](_0x293267[_0x0e82('0x41')],_0x5a25f4[_0x0e82('0x43')]));if(_0x293267[_0x0e82('0x41')][_0x0e82('0x4b')]){_0x41ec29[_0x0e82('0x4c')]=_[_0x0e82('0x4d')](_0x41ec29['where'],{'$or':_[_0x0e82('0x3a')](_0x41ec29[_0x0e82('0x46')],function(_0x2eab2f){var _0x54b681={};_0x54b681[_0x2eab2f]={'$like':'%'+_0x293267[_0x0e82('0x41')][_0x0e82('0x4b')]+'%'};return _0x54b681;})});}_0x41ec29=_['merge']({},_0x41ec29,_0x293267['options']);return _0x41747a[_0x0e82('0x5e')](_0x41ec29);}})[_0x0e82('0x1d')](function(_0x4e784d){if(_0x4e784d){_0x1049d6=_0x4e784d[_0x0e82('0x54')];if(!_0x293267[_0x0e82('0x41')][_0x0e82('0x47')](_0x0e82('0x48'))){_0x41ec29[_0x0e82('0x2d')]=qs[_0x0e82('0x2d')](_0x293267[_0x0e82('0x41')][_0x0e82('0x2d')]);_0x41ec29[_0x0e82('0x2b')]=qs[_0x0e82('0x2b')](_0x293267[_0x0e82('0x41')][_0x0e82('0x2b')]);}return _0x41747a[_0x0e82('0x5e')](_0x41ec29);}})[_0x0e82('0x1d')](function(_0xa8123e){if(_0xa8123e){return _0xa8123e?{'count':_0x1049d6,'rows':_0xa8123e}:null;}})['then'](respondWithResult(_0x332c3e,null))['catch'](handleError(_0x332c3e,null));};exports[_0x0e82('0x5f')]=function(_0x59be1f,_0x55b5f4,_0x5b9eff){var _0x1c87cb={};var _0x5303b7={};var _0x1c181b;var _0x342d76;return db[_0x0e82('0x3b')][_0x0e82('0x5a')]({'where':{'id':_0x59be1f[_0x0e82('0x53')]['id']}})['then'](handleEntityNotFound(_0x55b5f4,null))[_0x0e82('0x1d')](function(_0x4fba4f){if(_0x4fba4f){_0x1c181b=_0x4fba4f;_0x5303b7['model']=_[_0x0e82('0x42')](db[_0x0e82('0x60')]['rawAttributes']);_0x5303b7['query']=_[_0x0e82('0x42')](_0x59be1f[_0x0e82('0x41')]);_0x5303b7['filters']=_[_0x0e82('0x44')](_0x5303b7[_0x0e82('0x40')],_0x5303b7[_0x0e82('0x41')]);_0x1c87cb[_0x0e82('0x46')]=_[_0x0e82('0x44')](_0x5303b7[_0x0e82('0x40')],qs[_0x0e82('0x45')](_0x59be1f['query'][_0x0e82('0x45')]));_0x1c87cb[_0x0e82('0x46')]=_0x1c87cb['attributes'][_0x0e82('0x54')]?_0x1c87cb[_0x0e82('0x46')]:_0x5303b7[_0x0e82('0x40')];_0x1c87cb[_0x0e82('0x5c')]=qs[_0x0e82('0x49')](_0x59be1f[_0x0e82('0x41')][_0x0e82('0x49')]);_0x1c87cb[_0x0e82('0x4c')]=qs[_0x0e82('0x43')](_[_0x0e82('0x4a')](_0x59be1f['query'],_0x5303b7[_0x0e82('0x43')]));if(_0x59be1f[_0x0e82('0x41')]['filter']){_0x1c87cb[_0x0e82('0x4c')]=_['merge'](_0x1c87cb['where'],{'$or':_[_0x0e82('0x3a')](_0x1c87cb[_0x0e82('0x46')],function(_0x4c446a){var _0x40c059={};_0x40c059[_0x4c446a]={'$like':'%'+_0x59be1f[_0x0e82('0x41')][_0x0e82('0x4b')]+'%'};return _0x40c059;})});}_0x1c87cb=_[_0x0e82('0x4d')]({},_0x1c87cb,_0x59be1f[_0x0e82('0x4f')]);return _0x1c181b[_0x0e82('0x5f')](_0x1c87cb);}})[_0x0e82('0x1d')](function(_0x42c665){if(_0x42c665){_0x342d76=_0x42c665['length'];if(!_0x59be1f['query'][_0x0e82('0x47')]('nolimit')){_0x1c87cb['limit']=qs['limit'](_0x59be1f[_0x0e82('0x41')][_0x0e82('0x2d')]);_0x1c87cb[_0x0e82('0x2b')]=qs[_0x0e82('0x2b')](_0x59be1f[_0x0e82('0x41')][_0x0e82('0x2b')]);}return _0x1c181b[_0x0e82('0x5f')](_0x1c87cb);}})[_0x0e82('0x1d')](function(_0x25dd26){if(_0x25dd26){return _0x25dd26?{'count':_0x342d76,'rows':_0x25dd26}:null;}})[_0x0e82('0x1d')](respondWithResult(_0x55b5f4,null))[_0x0e82('0x27')](handleError(_0x55b5f4,null));};exports[_0x0e82('0x61')]=function(_0x116d7e,_0x2b4398,_0x48f740){if(_0x116d7e['body']['id']){delete _0x116d7e[_0x0e82('0x58')]['id'];}return db['ZendeskConfiguration'][_0x0e82('0x5a')]({'where':{'id':_0x116d7e[_0x0e82('0x53')]['id']}})[_0x0e82('0x1d')](handleEntityNotFound(_0x2b4398,null))[_0x0e82('0x1d')](function(_0x4efde8){if(_0x4efde8){return _0x4efde8[_0x0e82('0x61')](_0x116d7e[_0x0e82('0x58')][_0x0e82('0x62')]||[]);}return null;})[_0x0e82('0x1d')](respondWithResult(_0x2b4398,null))['catch'](handleError(_0x2b4398,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 1f8666b..f137703 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 _0x389e=['lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x389e,0x99));var _0xe389=function(_0x1c106d,_0x2c9dd1){_0x1c106d=_0x1c106d-0x0;var _0x15b77a=_0x389e[_0x1c106d];return _0x15b77a;};'use strict';var _=require(_0xe389('0x0'));var util=require('util');var logger=require(_0xe389('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe389('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe389('0x3'));var rimraf=require(_0xe389('0x4'));var config=require(_0xe389('0x5'));var attributes=require(_0xe389('0x6'));module[_0xe389('0x7')]=function(_0x3c10c7,_0x22477f){return _0x3c10c7[_0xe389('0x8')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2059=['bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x22b70f,_0x4c853f){var _0x100985=function(_0x18628e){while(--_0x18628e){_0x22b70f['push'](_0x22b70f['shift']());}};_0x100985(++_0x4c853f);}(_0x2059,0x164));var _0x9205=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x2059[_0x270a54];return _0x4d07d0;};'use strict';var _=require(_0x9205('0x0'));var util=require(_0x9205('0x1'));var logger=require('../../config/logger')(_0x9205('0x2'));var moment=require(_0x9205('0x3'));var BPromise=require(_0x9205('0x4'));var rp=require(_0x9205('0x5'));var fs=require('fs');var path=require(_0x9205('0x6'));var rimraf=require('rimraf');var config=require(_0x9205('0x7'));var attributes=require(_0x9205('0x8'));module[_0x9205('0x9')]=function(_0x2f8166,_0x162658){return _0x2f8166[_0x9205('0xa')](_0x9205('0xb'),attributes,{'tableName':'int_zendesk_configurations','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 888843b..699539b 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 _0x1359=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1359,0x138));var _0x9135=function(_0x2d2aa4,_0x4f0c97){_0x2d2aa4=_0x2d2aa4-0x0;var _0x1b54bd=_0x1359[_0x2d2aa4];return _0x1b54bd;};'use strict';var _=require(_0x9135('0x0'));var util=require(_0x9135('0x1'));var moment=require(_0x9135('0x2'));var BPromise=require(_0x9135('0x3'));var rs=require(_0x9135('0x4'));var fs=require('fs');var Redis=require(_0x9135('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9135('0x6'));var logger=require(_0x9135('0x7'))(_0x9135('0x8'));var config=require(_0x9135('0x9'));var jayson=require(_0x9135('0xa'));var client=jayson[_0x9135('0xb')][_0x9135('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d2024,_0x482bb2,_0x4c9ea3){return new BPromise(function(_0x425e45,_0x282c16){return client['request'](_0x3d2024,_0x4c9ea3)[_0x9135('0xd')](function(_0x2942d1){logger[_0x9135('0xe')](_0x9135('0xf'),_0x482bb2,_0x9135('0x10'));logger[_0x9135('0x11')](_0x9135('0x12'),_0x482bb2,'request\x20sent',JSON['stringify'](_0x2942d1));if(_0x2942d1[_0x9135('0x13')]){if(_0x2942d1[_0x9135('0x13')][_0x9135('0x14')]===0x1f4){logger[_0x9135('0x13')](_0x9135('0xf'),_0x482bb2,_0x2942d1['error'][_0x9135('0x15')]);return _0x282c16(_0x2942d1[_0x9135('0x13')][_0x9135('0x15')]);}logger[_0x9135('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x482bb2,_0x2942d1['error']['message']);return _0x425e45(_0x2942d1[_0x9135('0x13')][_0x9135('0x15')]);}else{logger[_0x9135('0xe')](_0x9135('0xf'),_0x482bb2,_0x9135('0x10'));_0x425e45(_0x2942d1[_0x9135('0x16')]['message']);}})[_0x9135('0x17')](function(_0x2d8d83){logger[_0x9135('0x13')](_0x9135('0xf'),_0x482bb2,_0x2d8d83);_0x282c16(_0x2d8d83);});});} \ No newline at end of file +var _0x9774=['error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x481074,_0x3a636f){var _0x57f798=function(_0x2b3851){while(--_0x2b3851){_0x481074['push'](_0x481074['shift']());}};_0x57f798(++_0x3a636f);}(_0x9774,0x176));var _0x4977=function(_0x204d6a,_0x30c2f5){_0x204d6a=_0x204d6a-0x0;var _0x3da49b=_0x9774[_0x204d6a];return _0x3da49b;};'use strict';var _=require(_0x4977('0x0'));var util=require(_0x4977('0x1'));var moment=require(_0x4977('0x2'));var BPromise=require(_0x4977('0x3'));var rs=require(_0x4977('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4977('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4977('0x6'))(_0x4977('0x7'));var config=require('../../config/environment');var jayson=require(_0x4977('0x8'));var client=jayson[_0x4977('0x9')][_0x4977('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d0a5,_0x236099,_0x58601e){return new BPromise(function(_0x3c8066,_0x44209e){return client[_0x4977('0xb')](_0x48d0a5,_0x58601e)[_0x4977('0xc')](function(_0x175d63){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x236099,_0x4977('0xd'));logger[_0x4977('0xe')](_0x4977('0xf'),_0x236099,_0x4977('0xd'),JSON[_0x4977('0x10')](_0x175d63));if(_0x175d63[_0x4977('0x11')]){if(_0x175d63[_0x4977('0x11')][_0x4977('0x12')]===0x1f4){logger[_0x4977('0x11')](_0x4977('0x13'),_0x236099,_0x175d63['error']['message']);return _0x44209e(_0x175d63[_0x4977('0x11')][_0x4977('0x14')]);}logger[_0x4977('0x11')](_0x4977('0x13'),_0x236099,_0x175d63['error'][_0x4977('0x14')]);return _0x3c8066(_0x175d63[_0x4977('0x11')][_0x4977('0x14')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x236099,_0x4977('0xd'));_0x3c8066(_0x175d63[_0x4977('0x15')][_0x4977('0x14')]);}})[_0x4977('0x16')](function(_0xd5c103){logger['error'](_0x4977('0x13'),_0x236099,_0xd5c103);_0x44209e(_0xd5c103);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index afdb5b3..880dd11 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 _0x9975=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x2aff0a,_0x291b32){var _0x4fad8e=function(_0x17daac){while(--_0x17daac){_0x2aff0a['push'](_0x2aff0a['shift']());}};_0x4fad8e(++_0x291b32);}(_0x9975,0xa0));var _0x5997=function(_0x5a167c,_0x121d32){_0x5a167c=_0x5a167c-0x0;var _0x2b66f4=_0x9975[_0x5a167c];return _0x2b66f4;};'use strict';var multer=require(_0x5997('0x0'));var util=require(_0x5997('0x1'));var path=require(_0x5997('0x2'));var timeout=require(_0x5997('0x3'));var express=require(_0x5997('0x4'));var router=express[_0x5997('0x5')]();var fs_extra=require(_0x5997('0x6'));var auth=require(_0x5997('0x7'));var interaction=require(_0x5997('0x8'));var config=require(_0x5997('0x9'));var controller=require('./intZendeskField.controller');router[_0x5997('0xa')]('/',auth[_0x5997('0xb')](),controller['index']);router[_0x5997('0xa')](_0x5997('0xc'),auth[_0x5997('0xb')](),controller[_0x5997('0xd')]);router[_0x5997('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5997('0xf')](_0x5997('0xc'),auth[_0x5997('0xb')](),controller[_0x5997('0x10')]);router[_0x5997('0x11')](_0x5997('0xc'),auth[_0x5997('0xb')](),controller[_0x5997('0x12')]);module[_0x5997('0x13')]=router; \ No newline at end of file +var _0x82b3=['./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x503f76,_0xd3338c){var _0x1cc46a=function(_0xc9c1d9){while(--_0xc9c1d9){_0x503f76['push'](_0x503f76['shift']());}};_0x1cc46a(++_0xd3338c);}(_0x82b3,0xc0));var _0x382b=function(_0x57796f,_0x1f0edc){_0x57796f=_0x57796f-0x0;var _0x55f673=_0x82b3[_0x57796f];return _0x55f673;};'use strict';var multer=require(_0x382b('0x0'));var util=require(_0x382b('0x1'));var path=require(_0x382b('0x2'));var timeout=require(_0x382b('0x3'));var express=require(_0x382b('0x4'));var router=express[_0x382b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x382b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x382b('0x7'));var controller=require(_0x382b('0x8'));router[_0x382b('0x9')]('/',auth[_0x382b('0xa')](),controller[_0x382b('0xb')]);router[_0x382b('0x9')](_0x382b('0xc'),auth[_0x382b('0xa')](),controller[_0x382b('0xd')]);router[_0x382b('0xe')]('/',auth[_0x382b('0xa')](),controller[_0x382b('0xf')]);router['put'](_0x382b('0xc'),auth[_0x382b('0xa')](),controller[_0x382b('0x10')]);router[_0x382b('0x11')](_0x382b('0xc'),auth[_0x382b('0xa')](),controller[_0x382b('0x12')]);module[_0x382b('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 1b88165..a7a2230 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 _0x222f=['string','keyValue','picklist','STRING','variable','customVariable','sequelize','exports','ENUM'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x222f,0x1a4));var _0xf222=function(_0x1c6551,_0x3fbc2e){_0x1c6551=_0x1c6551-0x0;var _0x3f7434=_0x222f[_0x1c6551];return _0x3f7434;};'use strict';var Sequelize=require(_0xf222('0x0'));module[_0xf222('0x1')]={'type':{'type':Sequelize[_0xf222('0x2')](_0xf222('0x3'),'variable','customVariable',_0xf222('0x4'),_0xf222('0x5')),'defaultValue':_0xf222('0x3')},'content':{'type':Sequelize[_0xf222('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf222('0x2')]('string',_0xf222('0x7'),_0xf222('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf222('0x6')]},'nameField':{'type':Sequelize[_0xf222('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf222('0x6')]}}; \ No newline at end of file +var _0x57d4=['picklist','STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x52e9e3,_0xe465a7){var _0x960a8d=function(_0x572a0d){while(--_0x572a0d){_0x52e9e3['push'](_0x52e9e3['shift']());}};_0x960a8d(++_0xe465a7);}(_0x57d4,0x78));var _0x457d=function(_0x58a4ee,_0x3fde05){_0x58a4ee=_0x58a4ee-0x0;var _0x23f362=_0x57d4[_0x58a4ee];return _0x23f362;};'use strict';var Sequelize=require(_0x457d('0x0'));module[_0x457d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x457d('0x2'),_0x457d('0x3'),_0x457d('0x4'),_0x457d('0x5'),_0x457d('0x6')),'defaultValue':_0x457d('0x2')},'content':{'type':Sequelize[_0x457d('0x7')]},'key':{'type':Sequelize[_0x457d('0x7')]},'keyType':{'type':Sequelize[_0x457d('0x8')](_0x457d('0x2'),_0x457d('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x457d('0x7')]},'idField':{'type':Sequelize[_0x457d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x457d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ad4547f..16ee4c2 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 _0xb24d=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ZendeskField','fieldName','type','key','model','keys','query'];(function(_0x25e1b3,_0x401acb){var _0x456406=function(_0x3bbc49){while(--_0x3bbc49){_0x25e1b3['push'](_0x25e1b3['shift']());}};_0x456406(++_0x401acb);}(_0xb24d,0xb4));var _0xdb24=function(_0x3d7d7e,_0x22db6b){_0x3d7d7e=_0x3d7d7e-0x0;var _0x32840e=_0xb24d[_0x3d7d7e];return _0x32840e;};'use strict';var emlformat=require(_0xdb24('0x0'));var rimraf=require(_0xdb24('0x1'));var zipdir=require(_0xdb24('0x2'));var jsonpatch=require(_0xdb24('0x3'));var rp=require(_0xdb24('0x4'));var moment=require(_0xdb24('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdb24('0x6'));var path=require('path');var sox=require(_0xdb24('0x7'));var csv=require('to-csv');var ejs=require(_0xdb24('0x8'));var fs=require('fs');var fs_extra=require(_0xdb24('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb24('0xa'));var jsforce=require(_0xdb24('0xb'));var deskjs=require(_0xdb24('0xc'));var toCsv=require(_0xdb24('0xd'));var querystring=require(_0xdb24('0xe'));var Papa=require(_0xdb24('0xf'));var Redis=require(_0xdb24('0x10'));var authService=require(_0xdb24('0x11'));var qs=require(_0xdb24('0x12'));var as=require(_0xdb24('0x13'));var hardwareService=require(_0xdb24('0x14'));var logger=require(_0xdb24('0x15'))(_0xdb24('0x16'));var utils=require('../../config/utils');var config=require(_0xdb24('0x17'));var licenseUtil=require(_0xdb24('0x18'));var db=require(_0xdb24('0x19'))['db'];function respondWithStatusCode(_0x2a8450,_0x31f4f3){_0x31f4f3=_0x31f4f3||0xcc;return function(_0x383fbc){if(_0x383fbc){return _0x2a8450['sendStatus'](_0x31f4f3);}return _0x2a8450[_0xdb24('0x1a')](_0x31f4f3)[_0xdb24('0x1b')]();};}function respondWithResult(_0x424993,_0x3ac7e0){_0x3ac7e0=_0x3ac7e0||0xc8;return function(_0x5c2c30){if(_0x5c2c30){return _0x424993[_0xdb24('0x1a')](_0x3ac7e0)[_0xdb24('0x1c')](_0x5c2c30);}};}function respondWithFilteredResult(_0x2f03f4,_0x1cc94a){return function(_0x3e9ab3){if(_0x3e9ab3){var _0x1451dc=typeof _0x1cc94a[_0xdb24('0x1d')]===_0xdb24('0x1e')&&typeof _0x1cc94a[_0xdb24('0x1f')]===_0xdb24('0x1e');var _0x219cc3=_0x3e9ab3['count'];var _0x2468a0=_0x1451dc?0x0:_0x1cc94a['offset'];var _0x20d5db=_0x1451dc?_0x3e9ab3['count']:_0x1cc94a[_0xdb24('0x1d')]+_0x1cc94a[_0xdb24('0x1f')];var _0x33d1c7;if(_0x20d5db>=_0x219cc3){_0x20d5db=_0x219cc3;_0x33d1c7=0xc8;}else{_0x33d1c7=0xce;}_0x2f03f4[_0xdb24('0x1a')](_0x33d1c7);return _0x2f03f4[_0xdb24('0x20')](_0xdb24('0x21'),_0x2468a0+'-'+_0x20d5db+'/'+_0x219cc3)[_0xdb24('0x1c')](_0x3e9ab3);}return null;};}function patchUpdates(_0x85bf24){return function(_0x4453a0){try{jsonpatch['apply'](_0x4453a0,_0x85bf24,!![]);}catch(_0x48d367){return BPromise[_0xdb24('0x22')](_0x48d367);}return _0x4453a0[_0xdb24('0x23')]();};}function saveUpdates(_0x23d1f5,_0x4a37e1){return function(_0x3c8b89){if(_0x3c8b89){return _0x3c8b89[_0xdb24('0x24')](_0x23d1f5)['then'](function(_0x174eb2){return _0x174eb2;});}return null;};}function removeEntity(_0x4d174e,_0x6d1a34){return function(_0x26a209){if(_0x26a209){return _0x26a209['destroy']()[_0xdb24('0x25')](function(){_0x4d174e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f62d,_0x2202d2){return function(_0x1de3e5){if(!_0x1de3e5){_0x21f62d['sendStatus'](0x194);}return _0x1de3e5;};}function handleError(_0xac1455,_0x33377f){_0x33377f=_0x33377f||0x1f4;return function(_0x52b903){logger[_0xdb24('0x26')](_0x52b903[_0xdb24('0x27')]);if(_0x52b903[_0xdb24('0x28')]){delete _0x52b903[_0xdb24('0x28')];}_0xac1455['status'](_0x33377f)[_0xdb24('0x29')](_0x52b903);};}exports[_0xdb24('0x2a')]=function(_0x154436,_0x2131e6){var _0x324388={},_0xbf91d={},_0x27c66d={'count':0x0,'rows':[]};var _0x202292=_[_0xdb24('0x2b')](db[_0xdb24('0x2c')]['rawAttributes'],function(_0x124bf3){return{'name':_0x124bf3[_0xdb24('0x2d')],'type':_0x124bf3[_0xdb24('0x2e')][_0xdb24('0x2f')]};});_0xbf91d[_0xdb24('0x30')]=_[_0xdb24('0x2b')](_0x202292,_0xdb24('0x28'));_0xbf91d['query']=_[_0xdb24('0x31')](_0x154436[_0xdb24('0x32')]);_0xbf91d[_0xdb24('0x33')]=_[_0xdb24('0x34')](_0xbf91d[_0xdb24('0x30')],_0xbf91d['query']);_0x324388['attributes']=_[_0xdb24('0x34')](_0xbf91d['model'],qs[_0xdb24('0x35')](_0x154436[_0xdb24('0x32')][_0xdb24('0x35')]));_0x324388[_0xdb24('0x36')]=_0x324388[_0xdb24('0x36')][_0xdb24('0x37')]?_0x324388['attributes']:_0xbf91d['model'];if(!_0x154436[_0xdb24('0x32')][_0xdb24('0x38')](_0xdb24('0x39'))){_0x324388[_0xdb24('0x1f')]=qs[_0xdb24('0x1f')](_0x154436[_0xdb24('0x32')][_0xdb24('0x1f')]);_0x324388[_0xdb24('0x1d')]=qs[_0xdb24('0x1d')](_0x154436['query'][_0xdb24('0x1d')]);}_0x324388[_0xdb24('0x3a')]=qs[_0xdb24('0x3b')](_0x154436[_0xdb24('0x32')][_0xdb24('0x3b')]);_0x324388[_0xdb24('0x3c')]=qs['filters'](_[_0xdb24('0x3d')](_0x154436[_0xdb24('0x32')],_0xbf91d[_0xdb24('0x33')]),_0x202292);if(_0x154436[_0xdb24('0x32')][_0xdb24('0x3e')]){_0x324388[_0xdb24('0x3c')]=_['merge'](_0x324388[_0xdb24('0x3c')],{'$or':_[_0xdb24('0x2b')](_0x202292,function(_0x343173){if(_0x343173[_0xdb24('0x2e')]!==_0xdb24('0x3f')){var _0x354bed={};_0x354bed[_0x343173[_0xdb24('0x28')]]={'$like':'%'+_0x154436[_0xdb24('0x32')][_0xdb24('0x3e')]+'%'};return _0x354bed;}})});}_0x324388=_['merge']({},_0x324388,_0x154436[_0xdb24('0x40')]);var _0x52f520={'where':_0x324388[_0xdb24('0x3c')]};return db[_0xdb24('0x2c')][_0xdb24('0x41')](_0x52f520)[_0xdb24('0x25')](function(_0x1eb16e){_0x27c66d[_0xdb24('0x41')]=_0x1eb16e;if(_0x154436[_0xdb24('0x32')][_0xdb24('0x42')]){_0x324388['include']=[{'all':!![]}];}return db['ZendeskField'][_0xdb24('0x43')](_0x324388);})[_0xdb24('0x25')](function(_0x785799){_0x27c66d[_0xdb24('0x44')]=_0x785799;return _0x27c66d;})[_0xdb24('0x25')](respondWithFilteredResult(_0x2131e6,_0x324388))[_0xdb24('0x45')](handleError(_0x2131e6,null));};exports[_0xdb24('0x46')]=function(_0x541228,_0x395b5e){var _0x2b5b20={'raw':!![],'where':{'id':_0x541228[_0xdb24('0x47')]['id']}},_0x36072e={};_0x36072e[_0xdb24('0x30')]=_['keys'](db[_0xdb24('0x2c')][_0xdb24('0x48')]);_0x36072e['query']=_[_0xdb24('0x31')](_0x541228[_0xdb24('0x32')]);_0x36072e[_0xdb24('0x33')]=_[_0xdb24('0x34')](_0x36072e[_0xdb24('0x30')],_0x36072e[_0xdb24('0x32')]);_0x2b5b20[_0xdb24('0x36')]=_[_0xdb24('0x34')](_0x36072e[_0xdb24('0x30')],qs[_0xdb24('0x35')](_0x541228['query'][_0xdb24('0x35')]));_0x2b5b20[_0xdb24('0x36')]=_0x2b5b20[_0xdb24('0x36')][_0xdb24('0x37')]?_0x2b5b20[_0xdb24('0x36')]:_0x36072e['model'];if(_0x541228[_0xdb24('0x32')][_0xdb24('0x42')]){_0x2b5b20['include']=[{'all':!![]}];}_0x2b5b20=_[_0xdb24('0x49')]({},_0x2b5b20,_0x541228['options']);return db['ZendeskField'][_0xdb24('0x4a')](_0x2b5b20)[_0xdb24('0x25')](handleEntityNotFound(_0x395b5e,null))[_0xdb24('0x25')](respondWithResult(_0x395b5e,null))['catch'](handleError(_0x395b5e,null));};exports[_0xdb24('0x4b')]=function(_0x5d799b,_0x1cd886){return db[_0xdb24('0x2c')][_0xdb24('0x4b')](_0x5d799b[_0xdb24('0x4c')],{})[_0xdb24('0x25')](respondWithResult(_0x1cd886,0xc9))[_0xdb24('0x45')](handleError(_0x1cd886,null));};exports[_0xdb24('0x24')]=function(_0x19c972,_0x111c48){if(_0x19c972[_0xdb24('0x4c')]['id']){delete _0x19c972['body']['id'];}return db[_0xdb24('0x2c')]['find']({'where':{'id':_0x19c972[_0xdb24('0x47')]['id']}})[_0xdb24('0x25')](handleEntityNotFound(_0x111c48,null))['then'](saveUpdates(_0x19c972['body'],null))[_0xdb24('0x25')](respondWithResult(_0x111c48,null))[_0xdb24('0x45')](handleError(_0x111c48,null));};exports['destroy']=function(_0x299b69,_0x10b1e8){return db[_0xdb24('0x2c')][_0xdb24('0x4a')]({'where':{'id':_0x299b69[_0xdb24('0x47')]['id']}})['then'](handleEntityNotFound(_0x10b1e8,null))[_0xdb24('0x25')](removeEntity(_0x10b1e8,null))['catch'](handleError(_0x10b1e8,null));}; \ No newline at end of file +var _0x5a46=['reject','then','destroy','error','name','send','index','ZendeskField','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','find','catch','create','body','update','params','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply'];(function(_0x91f1f5,_0x230416){var _0x5bdb35=function(_0x149aa9){while(--_0x149aa9){_0x91f1f5['push'](_0x91f1f5['shift']());}};_0x5bdb35(++_0x230416);}(_0x5a46,0x103));var _0x65a4=function(_0x39e287,_0x396b37){_0x39e287=_0x39e287-0x0;var _0x281614=_0x5a46[_0x39e287];return _0x281614;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x65a4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65a4('0x1'));var moment=require('moment');var BPromise=require(_0x65a4('0x2'));var Mustache=require(_0x65a4('0x3'));var util=require(_0x65a4('0x4'));var path=require(_0x65a4('0x5'));var sox=require('sox');var csv=require(_0x65a4('0x6'));var ejs=require(_0x65a4('0x7'));var fs=require('fs');var fs_extra=require(_0x65a4('0x8'));var _=require('lodash');var squel=require(_0x65a4('0x9'));var crypto=require(_0x65a4('0xa'));var jsforce=require(_0x65a4('0xb'));var deskjs=require(_0x65a4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65a4('0xd'));var Papa=require('papaparse');var Redis=require(_0x65a4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x65a4('0xf'));var hardwareService=require(_0x65a4('0x10'));var logger=require(_0x65a4('0x11'))(_0x65a4('0x12'));var utils=require('../../config/utils');var config=require(_0x65a4('0x13'));var licenseUtil=require(_0x65a4('0x14'));var db=require(_0x65a4('0x15'))['db'];function respondWithStatusCode(_0x113d1e,_0x14e1e8){_0x14e1e8=_0x14e1e8||0xcc;return function(_0x2dcab8){if(_0x2dcab8){return _0x113d1e[_0x65a4('0x16')](_0x14e1e8);}return _0x113d1e[_0x65a4('0x17')](_0x14e1e8)[_0x65a4('0x18')]();};}function respondWithResult(_0x3aee41,_0x213f19){_0x213f19=_0x213f19||0xc8;return function(_0x228d5d){if(_0x228d5d){return _0x3aee41[_0x65a4('0x17')](_0x213f19)[_0x65a4('0x19')](_0x228d5d);}};}function respondWithFilteredResult(_0x5b5e25,_0x28d193){return function(_0x407455){if(_0x407455){var _0xd3e8b7=typeof _0x28d193['offset']===_0x65a4('0x1a')&&typeof _0x28d193[_0x65a4('0x1b')]==='undefined';var _0x207d45=_0x407455['count'];var _0x29a657=_0xd3e8b7?0x0:_0x28d193[_0x65a4('0x1c')];var _0x196a46=_0xd3e8b7?_0x407455[_0x65a4('0x1d')]:_0x28d193[_0x65a4('0x1c')]+_0x28d193[_0x65a4('0x1b')];var _0x2add8e;if(_0x196a46>=_0x207d45){_0x196a46=_0x207d45;_0x2add8e=0xc8;}else{_0x2add8e=0xce;}_0x5b5e25[_0x65a4('0x17')](_0x2add8e);return _0x5b5e25[_0x65a4('0x1e')](_0x65a4('0x1f'),_0x29a657+'-'+_0x196a46+'/'+_0x207d45)[_0x65a4('0x19')](_0x407455);}return null;};}function patchUpdates(_0x27f637){return function(_0x145d0d){try{jsonpatch[_0x65a4('0x20')](_0x145d0d,_0x27f637,!![]);}catch(_0x5c1cf9){return BPromise[_0x65a4('0x21')](_0x5c1cf9);}return _0x145d0d['save']();};}function saveUpdates(_0x58fa0d,_0x4274da){return function(_0x5e19fd){if(_0x5e19fd){return _0x5e19fd['update'](_0x58fa0d)[_0x65a4('0x22')](function(_0x4d5a4b){return _0x4d5a4b;});}return null;};}function removeEntity(_0x4b81e7,_0x4796d5){return function(_0x58107e){if(_0x58107e){return _0x58107e[_0x65a4('0x23')]()['then'](function(){_0x4b81e7[_0x65a4('0x17')](0xcc)[_0x65a4('0x18')]();});}};}function handleEntityNotFound(_0x74e9cc,_0x42745f){return function(_0x538a6f){if(!_0x538a6f){_0x74e9cc[_0x65a4('0x16')](0x194);}return _0x538a6f;};}function handleError(_0x109db2,_0x3bb9ef){_0x3bb9ef=_0x3bb9ef||0x1f4;return function(_0x97debd){logger[_0x65a4('0x24')](_0x97debd['stack']);if(_0x97debd[_0x65a4('0x25')]){delete _0x97debd[_0x65a4('0x25')];}_0x109db2[_0x65a4('0x17')](_0x3bb9ef)[_0x65a4('0x26')](_0x97debd);};}exports[_0x65a4('0x27')]=function(_0x5a9f80,_0x33684e){var _0x2725e0={},_0x2873bf={},_0x478bc9={'count':0x0,'rows':[]};var _0x25d231=_['map'](db[_0x65a4('0x28')][_0x65a4('0x29')],function(_0x43d8ba){return{'name':_0x43d8ba['fieldName'],'type':_0x43d8ba[_0x65a4('0x2a')][_0x65a4('0x2b')]};});_0x2873bf[_0x65a4('0x2c')]=_[_0x65a4('0x2d')](_0x25d231,_0x65a4('0x25'));_0x2873bf[_0x65a4('0x2e')]=_['keys'](_0x5a9f80[_0x65a4('0x2e')]);_0x2873bf[_0x65a4('0x2f')]=_[_0x65a4('0x30')](_0x2873bf['model'],_0x2873bf['query']);_0x2725e0['attributes']=_[_0x65a4('0x30')](_0x2873bf[_0x65a4('0x2c')],qs[_0x65a4('0x31')](_0x5a9f80[_0x65a4('0x2e')][_0x65a4('0x31')]));_0x2725e0[_0x65a4('0x32')]=_0x2725e0[_0x65a4('0x32')][_0x65a4('0x33')]?_0x2725e0[_0x65a4('0x32')]:_0x2873bf[_0x65a4('0x2c')];if(!_0x5a9f80[_0x65a4('0x2e')][_0x65a4('0x34')](_0x65a4('0x35'))){_0x2725e0[_0x65a4('0x1b')]=qs['limit'](_0x5a9f80[_0x65a4('0x2e')][_0x65a4('0x1b')]);_0x2725e0[_0x65a4('0x1c')]=qs[_0x65a4('0x1c')](_0x5a9f80[_0x65a4('0x2e')][_0x65a4('0x1c')]);}_0x2725e0[_0x65a4('0x36')]=qs['sort'](_0x5a9f80[_0x65a4('0x2e')][_0x65a4('0x37')]);_0x2725e0[_0x65a4('0x38')]=qs[_0x65a4('0x2f')](_[_0x65a4('0x39')](_0x5a9f80['query'],_0x2873bf[_0x65a4('0x2f')]),_0x25d231);if(_0x5a9f80[_0x65a4('0x2e')][_0x65a4('0x3a')]){_0x2725e0[_0x65a4('0x38')]=_[_0x65a4('0x3b')](_0x2725e0[_0x65a4('0x38')],{'$or':_[_0x65a4('0x2d')](_0x25d231,function(_0x5e166b){if(_0x5e166b[_0x65a4('0x2a')]!==_0x65a4('0x3c')){var _0x275fa3={};_0x275fa3[_0x5e166b[_0x65a4('0x25')]]={'$like':'%'+_0x5a9f80[_0x65a4('0x2e')][_0x65a4('0x3a')]+'%'};return _0x275fa3;}})});}_0x2725e0=_['merge']({},_0x2725e0,_0x5a9f80[_0x65a4('0x3d')]);var _0x181e5c={'where':_0x2725e0[_0x65a4('0x38')]};return db['ZendeskField'][_0x65a4('0x1d')](_0x181e5c)[_0x65a4('0x22')](function(_0x59b08d){_0x478bc9[_0x65a4('0x1d')]=_0x59b08d;if(_0x5a9f80[_0x65a4('0x2e')][_0x65a4('0x3e')]){_0x2725e0[_0x65a4('0x3f')]=[{'all':!![]}];}return db[_0x65a4('0x28')][_0x65a4('0x40')](_0x2725e0);})[_0x65a4('0x22')](function(_0x444f68){_0x478bc9['rows']=_0x444f68;return _0x478bc9;})['then'](respondWithFilteredResult(_0x33684e,_0x2725e0))['catch'](handleError(_0x33684e,null));};exports[_0x65a4('0x41')]=function(_0x4a8e10,_0x1013d8){var _0x2ec0d1={'raw':!![],'where':{'id':_0x4a8e10['params']['id']}},_0x26d295={};_0x26d295[_0x65a4('0x2c')]=_[_0x65a4('0x42')](db[_0x65a4('0x28')][_0x65a4('0x29')]);_0x26d295[_0x65a4('0x2e')]=_[_0x65a4('0x42')](_0x4a8e10[_0x65a4('0x2e')]);_0x26d295['filters']=_[_0x65a4('0x30')](_0x26d295[_0x65a4('0x2c')],_0x26d295['query']);_0x2ec0d1[_0x65a4('0x32')]=_[_0x65a4('0x30')](_0x26d295[_0x65a4('0x2c')],qs[_0x65a4('0x31')](_0x4a8e10[_0x65a4('0x2e')]['fields']));_0x2ec0d1[_0x65a4('0x32')]=_0x2ec0d1[_0x65a4('0x32')][_0x65a4('0x33')]?_0x2ec0d1[_0x65a4('0x32')]:_0x26d295[_0x65a4('0x2c')];if(_0x4a8e10['query'][_0x65a4('0x3e')]){_0x2ec0d1['include']=[{'all':!![]}];}_0x2ec0d1=_['merge']({},_0x2ec0d1,_0x4a8e10[_0x65a4('0x3d')]);return db[_0x65a4('0x28')][_0x65a4('0x43')](_0x2ec0d1)['then'](handleEntityNotFound(_0x1013d8,null))[_0x65a4('0x22')](respondWithResult(_0x1013d8,null))[_0x65a4('0x44')](handleError(_0x1013d8,null));};exports[_0x65a4('0x45')]=function(_0xf53340,_0x41cfbc){return db[_0x65a4('0x28')][_0x65a4('0x45')](_0xf53340[_0x65a4('0x46')],{})['then'](respondWithResult(_0x41cfbc,0xc9))[_0x65a4('0x44')](handleError(_0x41cfbc,null));};exports[_0x65a4('0x47')]=function(_0x116561,_0x91d983){if(_0x116561[_0x65a4('0x46')]['id']){delete _0x116561['body']['id'];}return db[_0x65a4('0x28')]['find']({'where':{'id':_0x116561['params']['id']}})[_0x65a4('0x22')](handleEntityNotFound(_0x91d983,null))[_0x65a4('0x22')](saveUpdates(_0x116561[_0x65a4('0x46')],null))[_0x65a4('0x22')](respondWithResult(_0x91d983,null))[_0x65a4('0x44')](handleError(_0x91d983,null));};exports[_0x65a4('0x23')]=function(_0x534c23,_0x62dc55){return db[_0x65a4('0x28')][_0x65a4('0x43')]({'where':{'id':_0x534c23[_0x65a4('0x48')]['id']}})[_0x65a4('0x22')](handleEntityNotFound(_0x62dc55,null))[_0x65a4('0x22')](removeEntity(_0x62dc55,null))[_0x65a4('0x44')](handleError(_0x62dc55,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 435430f..ab48a7c 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 _0x3402=['exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x467510,_0x48d904){var _0x2991cb=function(_0x1ea6e5){while(--_0x1ea6e5){_0x467510['push'](_0x467510['shift']());}};_0x2991cb(++_0x48d904);}(_0x3402,0x1f0));var _0x2340=function(_0x1b98fc,_0x1bd2bb){_0x1b98fc=_0x1b98fc-0x0;var _0x46ea3a=_0x3402[_0x1b98fc];return _0x46ea3a;};'use strict';var _=require(_0x2340('0x0'));var util=require('util');var logger=require(_0x2340('0x1'))(_0x2340('0x2'));var moment=require(_0x2340('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2340('0x4'));var rimraf=require(_0x2340('0x5'));var config=require(_0x2340('0x6'));var attributes=require(_0x2340('0x7'));module[_0x2340('0x8')]=function(_0x5dc7e6,_0x5cf949){return _0x5dc7e6[_0x2340('0x9')](_0x2340('0xa'),attributes,{'tableName':_0x2340('0xb'),'paranoid':![],'indexes':[{'name':_0x2340('0xc'),'fields':[_0x2340('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb94=['zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskField.attributes','ZendeskField'];(function(_0x58aad3,_0x2a1647){var _0x2618d9=function(_0x3b760a){while(--_0x3b760a){_0x58aad3['push'](_0x58aad3['shift']());}};_0x2618d9(++_0x2a1647);}(_0xdb94,0xab));var _0x4db9=function(_0x50a5cd,_0x1f5a3a){_0x50a5cd=_0x50a5cd-0x0;var _0x49ddf5=_0xdb94[_0x50a5cd];return _0x49ddf5;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4db9('0x9'),'fields':[_0x4db9('0xa'),_0x4db9('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 b52e499..1150f40 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 _0x5c41=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment'];(function(_0x674a4,_0x1cc0ec){var _0x2dd94f=function(_0x3d6694){while(--_0x3d6694){_0x674a4['push'](_0x674a4['shift']());}};_0x2dd94f(++_0x1cc0ec);}(_0x5c41,0xfa));var _0x15c4=function(_0x303d27,_0x34d5f8){_0x303d27=_0x303d27-0x0;var _0x3eae5d=_0x5c41[_0x303d27];return _0x3eae5d;};'use strict';var _=require(_0x15c4('0x0'));var util=require('util');var moment=require(_0x15c4('0x1'));var BPromise=require(_0x15c4('0x2'));var rs=require(_0x15c4('0x3'));var fs=require('fs');var Redis=require(_0x15c4('0x4'));var db=require(_0x15c4('0x5'))['db'];var utils=require(_0x15c4('0x6'));var logger=require(_0x15c4('0x7'))(_0x15c4('0x8'));var config=require(_0x15c4('0x9'));var jayson=require(_0x15c4('0xa'));var client=jayson['client'][_0x15c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53abc3,_0x235ee3,_0x43bfaf){return new BPromise(function(_0x5caba0,_0x171e39){return client[_0x15c4('0xc')](_0x53abc3,_0x43bfaf)['then'](function(_0x17421c){logger[_0x15c4('0xd')](_0x15c4('0xe'),_0x235ee3,'request\x20sent');logger[_0x15c4('0xf')](_0x15c4('0x10'),_0x235ee3,'request\x20sent',JSON['stringify'](_0x17421c));if(_0x17421c[_0x15c4('0x11')]){if(_0x17421c[_0x15c4('0x11')][_0x15c4('0x12')]===0x1f4){logger[_0x15c4('0x11')](_0x15c4('0xe'),_0x235ee3,_0x17421c[_0x15c4('0x11')][_0x15c4('0x13')]);return _0x171e39(_0x17421c[_0x15c4('0x11')]['message']);}logger[_0x15c4('0x11')](_0x15c4('0xe'),_0x235ee3,_0x17421c[_0x15c4('0x11')][_0x15c4('0x13')]);return _0x5caba0(_0x17421c['error']['message']);}else{logger['info'](_0x15c4('0xe'),_0x235ee3,'request\x20sent');_0x5caba0(_0x17421c['result']['message']);}})[_0x15c4('0x14')](function(_0x19ae4e){logger[_0x15c4('0x11')](_0x15c4('0xe'),_0x235ee3,_0x19ae4e);_0x171e39(_0x19ae4e);});});} \ No newline at end of file +var _0x9868=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x11b55f,_0x4bf278){var _0xf39291=function(_0x2f95e8){while(--_0x2f95e8){_0x11b55f['push'](_0x11b55f['shift']());}};_0xf39291(++_0x4bf278);}(_0x9868,0xd7));var _0x8986=function(_0x3da1f9,_0x53cab4){_0x3da1f9=_0x3da1f9-0x0;var _0x26e234=_0x9868[_0x3da1f9];return _0x26e234;};'use strict';var _=require('lodash');var util=require(_0x8986('0x0'));var moment=require(_0x8986('0x1'));var BPromise=require(_0x8986('0x2'));var rs=require(_0x8986('0x3'));var fs=require('fs');var Redis=require(_0x8986('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8986('0x5'));var logger=require(_0x8986('0x6'))(_0x8986('0x7'));var config=require('../../config/environment');var jayson=require(_0x8986('0x8'));var client=jayson['client'][_0x8986('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a3ba3,_0x1bd6ad,_0x51c58d){return new BPromise(function(_0x1cb929,_0x6b01a5){return client['request'](_0x4a3ba3,_0x51c58d)[_0x8986('0xa')](function(_0x5b5864){logger[_0x8986('0xb')](_0x8986('0xc'),_0x1bd6ad,_0x8986('0xd'));logger[_0x8986('0xe')](_0x8986('0xf'),_0x1bd6ad,_0x8986('0xd'),JSON[_0x8986('0x10')](_0x5b5864));if(_0x5b5864[_0x8986('0x11')]){if(_0x5b5864['error']['code']===0x1f4){logger[_0x8986('0x11')](_0x8986('0xc'),_0x1bd6ad,_0x5b5864['error'][_0x8986('0x12')]);return _0x6b01a5(_0x5b5864[_0x8986('0x11')][_0x8986('0x12')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x1bd6ad,_0x5b5864[_0x8986('0x11')][_0x8986('0x12')]);return _0x1cb929(_0x5b5864[_0x8986('0x11')][_0x8986('0x12')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x1bd6ad,'request\x20sent');_0x1cb929(_0x5b5864[_0x8986('0x13')]['message']);}})[_0x8986('0x14')](function(_0x422613){logger[_0x8986('0x11')]('ZendeskField,\x20%s,\x20%s',_0x1bd6ad,_0x422613);_0x6b01a5(_0x422613);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 7816bc6..87af360 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 _0xaf8b=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','express'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xaf8b,0x18c));var _0xbaf8=function(_0x30ef53,_0x1927f7){_0x30ef53=_0x30ef53-0x0;var _0x12fab2=_0xaf8b[_0x30ef53];return _0x12fab2;};'use strict';var multer=require(_0xbaf8('0x0'));var util=require(_0xbaf8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbaf8('0x2'));var router=express[_0xbaf8('0x3')]();var fs_extra=require(_0xbaf8('0x4'));var auth=require(_0xbaf8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xbaf8('0x6')]('/',auth[_0xbaf8('0x7')](),controller[_0xbaf8('0x8')]);router[_0xbaf8('0x6')](_0xbaf8('0x9'),auth[_0xbaf8('0x7')](),controller[_0xbaf8('0xa')]);router[_0xbaf8('0x6')](_0xbaf8('0xb'),auth[_0xbaf8('0x7')](),controller[_0xbaf8('0xc')]);router[_0xbaf8('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbaf8('0xd')]);router[_0xbaf8('0xe')]('/',auth[_0xbaf8('0x7')](),controller['create']);router[_0xbaf8('0xe')](_0xbaf8('0xb'),auth[_0xbaf8('0x7')](),controller[_0xbaf8('0xf')]);router[_0xbaf8('0x10')](_0xbaf8('0x9'),auth[_0xbaf8('0x7')](),controller[_0xbaf8('0x11')]);router[_0xbaf8('0x12')](_0xbaf8('0x9'),auth['isAuthenticated'](),controller[_0xbaf8('0x13')]);module[_0xbaf8('0x14')]=router; \ No newline at end of file +var _0x4ebb=['get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','multer','util','express','../../components/auth/service','../../config/environment','./intZohoAccount.controller'];(function(_0x3a7520,_0x2367ae){var _0x45eee8=function(_0x49765c){while(--_0x49765c){_0x3a7520['push'](_0x3a7520['shift']());}};_0x45eee8(++_0x2367ae);}(_0x4ebb,0x104));var _0xb4eb=function(_0x5ed40d,_0x1a0fc7){_0x5ed40d=_0x5ed40d-0x0;var _0x4c20eb=_0x4ebb[_0x5ed40d];return _0x4c20eb;};'use strict';var multer=require(_0xb4eb('0x0'));var util=require(_0xb4eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb4eb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb4eb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb4eb('0x4'));var controller=require(_0xb4eb('0x5'));router[_0xb4eb('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb4eb('0x6')](_0xb4eb('0x7'),auth[_0xb4eb('0x8')](),controller[_0xb4eb('0x9')]);router[_0xb4eb('0x6')](_0xb4eb('0xa'),auth[_0xb4eb('0x8')](),controller[_0xb4eb('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xb4eb('0xc')]);router[_0xb4eb('0xd')]('/',auth[_0xb4eb('0x8')](),controller[_0xb4eb('0xe')]);router[_0xb4eb('0xd')](_0xb4eb('0xa'),auth[_0xb4eb('0x8')](),controller[_0xb4eb('0xf')]);router[_0xb4eb('0x10')]('/:id',auth[_0xb4eb('0x8')](),controller[_0xb4eb('0x11')]);router[_0xb4eb('0x12')](_0xb4eb('0x7'),auth[_0xb4eb('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 3e9821a..37677dc 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 _0x86de=['STRING'];(function(_0x27ccd3,_0x54b108){var _0x494076=function(_0x59e698){while(--_0x59e698){_0x27ccd3['push'](_0x27ccd3['shift']());}};_0x494076(++_0x54b108);}(_0x86de,0x68));var _0xe86d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86de[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe86d('0x0')]},'host':{'type':Sequelize[_0xe86d('0x0')]},'zone':{'type':Sequelize[_0xe86d('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe86d('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xe86d('0x0')]},'refreshToken':{'type':Sequelize[_0xe86d('0x0')]}}; \ No newline at end of file +var _0xe5e4=['sequelize','exports','STRING'];(function(_0x41eabb,_0x3c2889){var _0x263a57=function(_0x5616de){while(--_0x5616de){_0x41eabb['push'](_0x41eabb['shift']());}};_0x263a57(++_0x3c2889);}(_0xe5e4,0x1c8));var _0x4e5e=function(_0x15378e,_0xa3b80a){_0x15378e=_0x15378e-0x0;var _0x48a502=_0xe5e4[_0x15378e];return _0x48a502;};'use strict';var Sequelize=require(_0x4e5e('0x0'));module[_0x4e5e('0x1')]={'name':{'type':Sequelize[_0x4e5e('0x2')]},'description':{'type':Sequelize[_0x4e5e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4e5e('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4e5e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x4e5e('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9613d7b..8c5d8d5 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 _0x6324=['https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','then','destroy','name','index','map','ZohoAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x6324,0x142));var _0x4632=function(_0x2478b8,_0x40961b){_0x2478b8=_0x2478b8-0x0;var _0x102501=_0x6324[_0x2478b8];return _0x102501;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4632('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x4632('0x19')][_0x4632('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ef228,_0x2dce9f,_0x51ee37,_0x3ba361){return new BPromise(function(_0x255882,_0x3b9901){var _0x37d798=_0x3ba361||client;return _0x37d798[_0x4632('0x1b')](_0x3ef228,_0x51ee37)['then'](function(_0x47b349){logger[_0x4632('0x1c')](_0x4632('0x1d'),_0x2dce9f,_0x4632('0x1e'));logger[_0x4632('0x1f')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2dce9f,_0x4632('0x1e'),JSON[_0x4632('0x20')](_0x47b349));if(_0x47b349[_0x4632('0x21')]){if(_0x47b349['error'][_0x4632('0x22')]===0x1f4){logger[_0x4632('0x21')]('ZohoAccount,\x20%s,\x20%s',_0x2dce9f,_0x47b349['error'][_0x4632('0x23')]);return _0x3b9901(_0x47b349[_0x4632('0x21')][_0x4632('0x23')]);}logger[_0x4632('0x21')](_0x4632('0x1d'),_0x2dce9f,_0x47b349[_0x4632('0x21')][_0x4632('0x23')]);return _0x255882(_0x47b349[_0x4632('0x21')][_0x4632('0x23')]);}else{logger[_0x4632('0x1c')](_0x4632('0x1d'),_0x2dce9f,_0x4632('0x1e'));_0x255882(_0x47b349[_0x4632('0x24')][_0x4632('0x23')]);}})[_0x4632('0x25')](function(_0x1a9695){logger[_0x4632('0x21')](_0x4632('0x1d'),_0x2dce9f,_0x1a9695);_0x3b9901(_0x1a9695);});});}function respondWithStatusCode(_0x380a9f,_0x1e1b86){_0x1e1b86=_0x1e1b86||0xcc;return function(_0x38cbbc){if(_0x38cbbc){return _0x380a9f[_0x4632('0x26')](_0x1e1b86);}return _0x380a9f[_0x4632('0x27')](_0x1e1b86)[_0x4632('0x28')]();};}function respondWithResult(_0xb074d,_0x1b8de0){_0x1b8de0=_0x1b8de0||0xc8;return function(_0x4af026){if(_0x4af026){return _0xb074d[_0x4632('0x27')](_0x1b8de0)[_0x4632('0x29')](_0x4af026);}};}function respondWithFilteredResult(_0x372679,_0x22d0f5){return function(_0x2a0b11){if(_0x2a0b11){var _0x438354=typeof _0x22d0f5['offset']==='undefined'&&typeof _0x22d0f5[_0x4632('0x2a')]===_0x4632('0x2b');var _0x2f6656=_0x2a0b11[_0x4632('0x2c')];var _0x34079f=_0x438354?0x0:_0x22d0f5[_0x4632('0x2d')];var _0x3570b2=_0x438354?_0x2a0b11['count']:_0x22d0f5[_0x4632('0x2d')]+_0x22d0f5[_0x4632('0x2a')];var _0x48f5fb;if(_0x3570b2>=_0x2f6656){_0x3570b2=_0x2f6656;_0x48f5fb=0xc8;}else{_0x48f5fb=0xce;}_0x372679[_0x4632('0x27')](_0x48f5fb);return _0x372679['set'](_0x4632('0x2e'),_0x34079f+'-'+_0x3570b2+'/'+_0x2f6656)['json'](_0x2a0b11);}return null;};}function patchUpdates(_0x4fda35){return function(_0x1973eb){try{jsonpatch[_0x4632('0x2f')](_0x1973eb,_0x4fda35,!![]);}catch(_0x3fe812){return BPromise['reject'](_0x3fe812);}return _0x1973eb['save']();};}function saveUpdates(_0x395f4e,_0x7671ab){return function(_0x596586){if(_0x596586){return _0x596586['update'](_0x395f4e)[_0x4632('0x30')](function(_0x666af9){return _0x666af9;});}return null;};}function removeEntity(_0x49621b,_0x101906){return function(_0x2a1093){if(_0x2a1093){return _0x2a1093[_0x4632('0x31')]()[_0x4632('0x30')](function(){_0x49621b[_0x4632('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0382,_0x3cc984){return function(_0x5a577c){if(!_0x5a577c){_0x5f0382['sendStatus'](0x194);}return _0x5a577c;};}function handleError(_0x465831,_0x59de6f){_0x59de6f=_0x59de6f||0x1f4;return function(_0x49355c){logger[_0x4632('0x21')](_0x49355c['stack']);if(_0x49355c[_0x4632('0x32')]){delete _0x49355c[_0x4632('0x32')];}_0x465831[_0x4632('0x27')](_0x59de6f)['send'](_0x49355c);};}exports[_0x4632('0x33')]=function(_0xf37b63,_0x39305a){var _0xca07f5={},_0x37c4d0={},_0x5d20f9={'count':0x0,'rows':[]};var _0x486f6c=_[_0x4632('0x34')](db[_0x4632('0x35')][_0x4632('0x36')],function(_0x4f40af){return{'name':_0x4f40af['fieldName'],'type':_0x4f40af['type'][_0x4632('0x37')]};});_0x37c4d0[_0x4632('0x38')]=_['map'](_0x486f6c,_0x4632('0x32'));_0x37c4d0[_0x4632('0x39')]=_[_0x4632('0x3a')](_0xf37b63[_0x4632('0x39')]);_0x37c4d0[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0x37c4d0[_0x4632('0x38')],_0x37c4d0[_0x4632('0x39')]);_0xca07f5[_0x4632('0x3d')]=_[_0x4632('0x3c')](_0x37c4d0[_0x4632('0x38')],qs[_0x4632('0x3e')](_0xf37b63['query'][_0x4632('0x3e')]));_0xca07f5[_0x4632('0x3d')]=_0xca07f5['attributes'][_0x4632('0x3f')]?_0xca07f5[_0x4632('0x3d')]:_0x37c4d0['model'];if(!_0xf37b63[_0x4632('0x39')]['hasOwnProperty'](_0x4632('0x40'))){_0xca07f5[_0x4632('0x2a')]=qs[_0x4632('0x2a')](_0xf37b63[_0x4632('0x39')]['limit']);_0xca07f5[_0x4632('0x2d')]=qs[_0x4632('0x2d')](_0xf37b63[_0x4632('0x39')][_0x4632('0x2d')]);}_0xca07f5['order']=qs['sort'](_0xf37b63[_0x4632('0x39')][_0x4632('0x41')]);_0xca07f5[_0x4632('0x42')]=qs['filters'](_[_0x4632('0x43')](_0xf37b63[_0x4632('0x39')],_0x37c4d0[_0x4632('0x3b')]),_0x486f6c);if(_0xf37b63[_0x4632('0x39')][_0x4632('0x44')]){_0xca07f5[_0x4632('0x42')]=_[_0x4632('0x45')](_0xca07f5['where'],{'$or':_[_0x4632('0x34')](_0x486f6c,function(_0xa0022c){if(_0xa0022c[_0x4632('0x46')]!==_0x4632('0x47')){var _0x165c00={};_0x165c00[_0xa0022c['name']]={'$like':'%'+_0xf37b63['query'][_0x4632('0x44')]+'%'};return _0x165c00;}})});}_0xca07f5=_[_0x4632('0x45')]({},_0xca07f5,_0xf37b63[_0x4632('0x48')]);var _0x2e5978={'where':_0xca07f5['where']};return db[_0x4632('0x35')][_0x4632('0x2c')](_0x2e5978)[_0x4632('0x30')](function(_0x20c8cc){_0x5d20f9[_0x4632('0x2c')]=_0x20c8cc;if(_0xf37b63['query'][_0x4632('0x49')]){_0xca07f5[_0x4632('0x4a')]=[{'all':!![]}];}return db[_0x4632('0x35')][_0x4632('0x4b')](_0xca07f5);})[_0x4632('0x30')](function(_0x2eb8b0){_0x5d20f9[_0x4632('0x4c')]=_0x2eb8b0;return _0x5d20f9;})[_0x4632('0x30')](respondWithFilteredResult(_0x39305a,_0xca07f5))[_0x4632('0x25')](handleError(_0x39305a,null));};exports[_0x4632('0x4d')]=function(_0x127db3,_0x517584){var _0xc3ffd0={'raw':![],'where':{'id':_0x127db3[_0x4632('0x4e')]['id']}},_0x1ccadb={};_0x1ccadb['model']=_[_0x4632('0x3a')](db[_0x4632('0x35')][_0x4632('0x36')]);_0x1ccadb[_0x4632('0x39')]=_[_0x4632('0x3a')](_0x127db3[_0x4632('0x39')]);_0x1ccadb[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0x1ccadb[_0x4632('0x38')],_0x1ccadb[_0x4632('0x39')]);_0xc3ffd0['attributes']=_[_0x4632('0x3c')](_0x1ccadb[_0x4632('0x38')],qs['fields'](_0x127db3[_0x4632('0x39')][_0x4632('0x3e')]));_0xc3ffd0[_0x4632('0x3d')]=_0xc3ffd0[_0x4632('0x3d')][_0x4632('0x3f')]?_0xc3ffd0[_0x4632('0x3d')]:_0x1ccadb[_0x4632('0x38')];if(_0x127db3[_0x4632('0x39')][_0x4632('0x49')]){_0xc3ffd0[_0x4632('0x4a')]=[{'all':!![]}];}_0xc3ffd0=_[_0x4632('0x45')]({},_0xc3ffd0,_0x127db3[_0x4632('0x48')]);return db[_0x4632('0x35')][_0x4632('0x4f')](_0xc3ffd0)[_0x4632('0x30')](handleEntityNotFound(_0x517584,null))[_0x4632('0x30')](respondWithResult(_0x517584,null))[_0x4632('0x25')](handleError(_0x517584,null));};exports[_0x4632('0x50')]=function(_0xb1456b,_0x36c824){return db['ZohoAccount'][_0x4632('0x50')](_0xb1456b[_0x4632('0x51')],{})[_0x4632('0x30')](respondWithResult(_0x36c824,0xc9))[_0x4632('0x25')](handleError(_0x36c824,null));};exports[_0x4632('0x52')]=function(_0x33ad25,_0x5d2cbb){if(_0x33ad25[_0x4632('0x51')]['id']){delete _0x33ad25[_0x4632('0x51')]['id'];}return db[_0x4632('0x35')]['find']({'where':{'id':_0x33ad25[_0x4632('0x4e')]['id']}})[_0x4632('0x30')](handleEntityNotFound(_0x5d2cbb,null))['then'](saveUpdates(_0x33ad25[_0x4632('0x51')],null))[_0x4632('0x30')](respondWithResult(_0x5d2cbb,null))[_0x4632('0x25')](handleError(_0x5d2cbb,null));};exports['destroy']=function(_0x3aeefd,_0x334a8e){return db[_0x4632('0x35')][_0x4632('0x4f')]({'where':{'id':_0x3aeefd[_0x4632('0x4e')]['id']}})[_0x4632('0x30')](handleEntityNotFound(_0x334a8e,null))[_0x4632('0x30')](removeEntity(_0x334a8e,null))[_0x4632('0x25')](handleError(_0x334a8e,null));};exports[_0x4632('0x53')]=function(_0x3abcbf,_0x58d39a,_0x3eb7bc){var _0x7273dd={};var _0x556bec={};var _0x381a9e;var _0x503ccd;return db['ZohoAccount'][_0x4632('0x54')]({'where':{'id':_0x3abcbf[_0x4632('0x4e')]['id']}})[_0x4632('0x30')](handleEntityNotFound(_0x58d39a,null))[_0x4632('0x30')](function(_0x3a030b){if(_0x3a030b){_0x381a9e=_0x3a030b;_0x556bec[_0x4632('0x38')]=_[_0x4632('0x3a')](db[_0x4632('0x55')][_0x4632('0x36')]);_0x556bec[_0x4632('0x39')]=_[_0x4632('0x3a')](_0x3abcbf[_0x4632('0x39')]);_0x556bec[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0x556bec['model'],_0x556bec['query']);_0x7273dd[_0x4632('0x3d')]=_[_0x4632('0x3c')](_0x556bec[_0x4632('0x38')],qs[_0x4632('0x3e')](_0x3abcbf[_0x4632('0x39')][_0x4632('0x3e')]));_0x7273dd['attributes']=_0x7273dd[_0x4632('0x3d')][_0x4632('0x3f')]?_0x7273dd[_0x4632('0x3d')]:_0x556bec[_0x4632('0x38')];_0x7273dd['order']=qs['sort'](_0x3abcbf[_0x4632('0x39')]['sort']);_0x7273dd[_0x4632('0x42')]=qs[_0x4632('0x3b')](_[_0x4632('0x43')](_0x3abcbf[_0x4632('0x39')],_0x556bec[_0x4632('0x3b')]));if(_0x3abcbf['query'][_0x4632('0x44')]){_0x7273dd[_0x4632('0x42')]=_['merge'](_0x7273dd['where'],{'$or':_[_0x4632('0x34')](_0x7273dd[_0x4632('0x3d')],function(_0x47391f){var _0x3090d6={};_0x3090d6[_0x47391f]={'$like':'%'+_0x3abcbf['query']['filter']+'%'};return _0x3090d6;})});}_0x7273dd=_['merge']({},_0x7273dd,_0x3abcbf[_0x4632('0x48')]);return _0x381a9e['getConfigurations'](_0x7273dd);}})[_0x4632('0x30')](function(_0x3595fa){if(_0x3595fa){_0x503ccd=_0x3595fa[_0x4632('0x3f')];if(!_0x3abcbf[_0x4632('0x39')][_0x4632('0x56')](_0x4632('0x40'))){_0x7273dd[_0x4632('0x2a')]=qs[_0x4632('0x2a')](_0x3abcbf[_0x4632('0x39')][_0x4632('0x2a')]);_0x7273dd[_0x4632('0x2d')]=qs[_0x4632('0x2d')](_0x3abcbf[_0x4632('0x39')][_0x4632('0x2d')]);}return _0x381a9e[_0x4632('0x53')](_0x7273dd);}})[_0x4632('0x30')](function(_0x550c4d){if(_0x550c4d){return _0x550c4d?{'count':_0x503ccd,'rows':_0x550c4d}:null;}})[_0x4632('0x30')](respondWithResult(_0x58d39a,null))[_0x4632('0x25')](handleError(_0x58d39a,null));};exports[_0x4632('0x57')]=function(_0x26a3f3,_0x1e0948,_0x273a0d){if(_0x26a3f3[_0x4632('0x51')]['id']){delete _0x26a3f3[_0x4632('0x51')]['id'];}return db[_0x4632('0x35')][_0x4632('0x54')]({'where':{'id':_0x26a3f3[_0x4632('0x4e')]['id']}})[_0x4632('0x30')](handleEntityNotFound(_0x1e0948,null))[_0x4632('0x30')](function(_0x4bba05){if(_0x4bba05){_0x26a3f3[_0x4632('0x51')][_0x4632('0x58')]=_0x4bba05['id'];_0x26a3f3[_0x4632('0x51')][_0x4632('0x59')]=integrations[_0x4632('0x5a')](_0x26a3f3[_0x4632('0x51')]['channel'],_0x26a3f3[_0x4632('0x51')][_0x4632('0x46')]);_0x26a3f3['body'][_0x4632('0x5b')]=integrations[_0x4632('0x5c')](_0x26a3f3[_0x4632('0x51')][_0x4632('0x5d')],_0x26a3f3[_0x4632('0x51')]['type']);return db[_0x4632('0x55')][_0x4632('0x50')](_0x26a3f3[_0x4632('0x51')],{'include':[{'model':db['ZohoField'],'as':_0x4632('0x59')},{'model':db[_0x4632('0x5e')],'as':_0x4632('0x5b')}]});}return null;})[_0x4632('0x30')](respondWithResult(_0x1e0948,null))[_0x4632('0x25')](handleError(_0x1e0948,null));};function getAccessToken(_0x3a3f3a){return new Promise(function(_0x35ca5d,_0x295b86){var _0x48fb81;switch(_0x3a3f3a[_0x4632('0x5f')]){case'US':_0x48fb81=_0x4632('0x60');break;case'AU':_0x48fb81=_0x4632('0x61');break;case'EU':_0x48fb81='https://accounts.zoho.eu';break;case'IN':_0x48fb81=_0x4632('0x62');break;case'CN':_0x48fb81=_0x4632('0x63');break;default:_0x48fb81='https://accounts.zoho.eu';break;}var _0x4a4ae2={'method':_0x4632('0x64'),'uri':_0x48fb81+_0x4632('0x65'),'qs':{'refresh_token':_0x3a3f3a['refreshToken'],'client_id':_0x3a3f3a[_0x4632('0x66')],'client_secret':_0x3a3f3a[_0x4632('0x67')],'grant_type':_0x4632('0x68')},'json':!![]};return rp(_0x4a4ae2)[_0x4632('0x30')](function(_0x40b7c5){if(_0x40b7c5[_0x4632('0x69')]){_0x35ca5d(_0x40b7c5[_0x4632('0x69')]);}else{_0x295b86(_0x4632('0x6a'));}})['catch'](function(_0x1604da){_0x295b86(_0x1604da);});});}exports[_0x4632('0x6b')]=function(_0x32d228,_0x16085e,_0x4fc23d){var _0x32da20,_0x22fae3,_0x45f42f,_0x194bec,_0x3cee1d;return db['ZohoAccount'][_0x4632('0x54')]({'where':{'id':_0x32d228[_0x4632('0x4e')]['id']},'attributes':['id',_0x4632('0x6c'),_0x4632('0x5f'),_0x4632('0x66'),_0x4632('0x67'),_0x4632('0x6d'),_0x4632('0x22'),'refreshToken']})[_0x4632('0x30')](handleEntityNotFound(_0x16085e,null))[_0x4632('0x30')](function(_0x44f95d){_0x3cee1d=_0x44f95d;_0x32da20=_0x3cee1d[_0x4632('0x6c')];_0x22fae3=_0x32da20===_0x4632('0x6e')?'eu':_0x4632('0x6f');_0x45f42f=_0x3cee1d['serverUrl'];var _0x26b3de=_0x45f42f[_0x4632('0x70')](-0x1);if(_0x26b3de==='/'||_0x26b3de==='\x5c'||_0x26b3de===':'){_0x45f42f=_0x45f42f[_0x4632('0x71')](0x0,_0x45f42f[_0x4632('0x72')](_0x26b3de));}if(!_0x3cee1d[_0x4632('0x73')]){throw new Error(_0x4632('0x74'));}return getAccessToken(_0x3cee1d);})[_0x4632('0x30')](function(_0x4db3d2){if(_0x4db3d2){return rp({'method':_0x4632('0x75'),'uri':util[_0x4632('0x76')](_0x4632('0x77'),_0x22fae3),'qs':{'module':_0x4632('0x78')},'headers':{'Authorization':_0x4632('0x79')+_0x4db3d2},'json':!![]});}})[_0x4632('0x30')](function(_0x447b84){if(_0x447b84){if(_0x447b84['response']&&_0x447b84[_0x4632('0x7a')]['error']){throw new Error(_0x447b84[_0x4632('0x7a')][_0x4632('0x21')][_0x4632('0x23')]);}var _0x1192ed=[];var _0x232962=[];var _0x13d927=[_0x4632('0x7b'),_0x4632('0x7c'),_0x4632('0x7d'),'WhoId',_0x4632('0x7e'),_0x4632('0x7f'),_0x4632('0x80'),'Call_Type'];_0x232962=_[_0x4632('0x81')](_0x447b84[_0x4632('0x3e')],function(_0x3cacec){return _0x13d927[_0x4632('0x82')](_0x3cacec[_0x4632('0x83')]);});for(var _0x314821=0x0;_0x314821<_0x232962['length'];_0x314821++){if(_0x232962[_0x314821]['system_mandatory']===![]){_0x1192ed[_0x4632('0x84')]({'id':_0x232962[_0x314821]['id'],'name':_0x232962[_0x314821][_0x4632('0x85')],'custom':_0x232962[_0x314821][_0x4632('0x86')],'options':_0x232962[_0x314821]['data_type']===_0x4632('0x87')&&_0x232962[_0x314821]['pick_list_values'][_0x4632('0x3f')]>-0x1?_['map'](_0x232962[_0x314821][_0x4632('0x88')],function(_0xede2e9){return{'name':_0xede2e9,'value':_0xede2e9};}):[]});}}return{'count':_0x1192ed['length'],'rows':_0x1192ed};}else{return{'count':0x0,'rows':[]};}})[_0x4632('0x30')](respondWithResult(_0x16085e,null))[_0x4632('0x25')](function(_0x312040){var _0x5d36c4=_0x32d228[_0x4632('0x39')][_0x4632('0x89')]?0x1f4:_0x312040[_0x4632('0x8a')]||0x1f4;logger[_0x4632('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x4632('0x6b'),_0x5d36c4,JSON[_0x4632('0x20')](_0x312040));delete _0x312040[_0x4632('0x32')];if(_0x5d36c4===0x191){_0x5d36c4=0x190;}_0x16085e[_0x4632('0x27')](_0x5d36c4)['send'](_0x32d228['query'][_0x4632('0x89')]?{'message':_0x4632('0x8b'),'statusCode':_0x312040[_0x4632('0x8a')]}:_0x312040);});}; \ No newline at end of file +var _0xbee3=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','include','findAll','show','includeAll','find','create','body','params','ZohoConfiguration','order','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','code','refreshToken','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','push','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','end','json','undefined','limit','count','offset','apply','save','update','then','destroy','stack','name','send','map','ZohoAccount','fieldName','type','key'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xbee3,0xd5));var _0x3bee=function(_0x4c23a3,_0x52e5f8){_0x4c23a3=_0x4c23a3-0x0;var _0x4113fa=_0xbee3[_0x4c23a3];return _0x4113fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];var integrations=require(_0x3bee('0x17'));var jayson=require(_0x3bee('0x18'));var client=jayson[_0x3bee('0x19')][_0x3bee('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xc8c1f0,_0x49b721,_0xad01f9,_0x33504d){return new BPromise(function(_0x31ac52,_0x237110){var _0x3a0396=_0x33504d||client;return _0x3a0396['request'](_0xc8c1f0,_0xad01f9)['then'](function(_0x346767){logger['info'](_0x3bee('0x1b'),_0x49b721,_0x3bee('0x1c'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x49b721,_0x3bee('0x1c'),JSON[_0x3bee('0x1d')](_0x346767));if(_0x346767[_0x3bee('0x1e')]){if(_0x346767[_0x3bee('0x1e')]['code']===0x1f4){logger[_0x3bee('0x1e')](_0x3bee('0x1b'),_0x49b721,_0x346767[_0x3bee('0x1e')][_0x3bee('0x1f')]);return _0x237110(_0x346767[_0x3bee('0x1e')][_0x3bee('0x1f')]);}logger[_0x3bee('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x49b721,_0x346767['error'][_0x3bee('0x1f')]);return _0x31ac52(_0x346767[_0x3bee('0x1e')]['message']);}else{logger[_0x3bee('0x20')](_0x3bee('0x1b'),_0x49b721,_0x3bee('0x1c'));_0x31ac52(_0x346767[_0x3bee('0x21')][_0x3bee('0x1f')]);}})[_0x3bee('0x22')](function(_0x473d61){logger['error'](_0x3bee('0x1b'),_0x49b721,_0x473d61);_0x237110(_0x473d61);});});}function respondWithStatusCode(_0x1ed0c1,_0x1fed5a){_0x1fed5a=_0x1fed5a||0xcc;return function(_0x3bb884){if(_0x3bb884){return _0x1ed0c1['sendStatus'](_0x1fed5a);}return _0x1ed0c1[_0x3bee('0x23')](_0x1fed5a)[_0x3bee('0x24')]();};}function respondWithResult(_0x1e0111,_0x4b4cd4){_0x4b4cd4=_0x4b4cd4||0xc8;return function(_0x5ed022){if(_0x5ed022){return _0x1e0111[_0x3bee('0x23')](_0x4b4cd4)[_0x3bee('0x25')](_0x5ed022);}};}function respondWithFilteredResult(_0x5341e2,_0x2c0e50){return function(_0x1b4ce0){if(_0x1b4ce0){var _0x2e666a=typeof _0x2c0e50['offset']===_0x3bee('0x26')&&typeof _0x2c0e50[_0x3bee('0x27')]===_0x3bee('0x26');var _0x4f2066=_0x1b4ce0[_0x3bee('0x28')];var _0xf08fb3=_0x2e666a?0x0:_0x2c0e50[_0x3bee('0x29')];var _0x496abd=_0x2e666a?_0x1b4ce0[_0x3bee('0x28')]:_0x2c0e50[_0x3bee('0x29')]+_0x2c0e50[_0x3bee('0x27')];var _0xda5745;if(_0x496abd>=_0x4f2066){_0x496abd=_0x4f2066;_0xda5745=0xc8;}else{_0xda5745=0xce;}_0x5341e2[_0x3bee('0x23')](_0xda5745);return _0x5341e2['set']('Content-Range',_0xf08fb3+'-'+_0x496abd+'/'+_0x4f2066)[_0x3bee('0x25')](_0x1b4ce0);}return null;};}function patchUpdates(_0x1e1529){return function(_0x10bae0){try{jsonpatch[_0x3bee('0x2a')](_0x10bae0,_0x1e1529,!![]);}catch(_0x4df2ac){return BPromise['reject'](_0x4df2ac);}return _0x10bae0[_0x3bee('0x2b')]();};}function saveUpdates(_0x42cb58,_0x4f5b58){return function(_0x51be99){if(_0x51be99){return _0x51be99[_0x3bee('0x2c')](_0x42cb58)[_0x3bee('0x2d')](function(_0x36447b){return _0x36447b;});}return null;};}function removeEntity(_0x308269,_0x845f21){return function(_0x2cfb4b){if(_0x2cfb4b){return _0x2cfb4b[_0x3bee('0x2e')]()[_0x3bee('0x2d')](function(){_0x308269[_0x3bee('0x23')](0xcc)[_0x3bee('0x24')]();});}};}function handleEntityNotFound(_0x569675,_0x485514){return function(_0x190905){if(!_0x190905){_0x569675['sendStatus'](0x194);}return _0x190905;};}function handleError(_0x52015b,_0x9cfb2f){_0x9cfb2f=_0x9cfb2f||0x1f4;return function(_0x1bc332){logger[_0x3bee('0x1e')](_0x1bc332[_0x3bee('0x2f')]);if(_0x1bc332[_0x3bee('0x30')]){delete _0x1bc332[_0x3bee('0x30')];}_0x52015b[_0x3bee('0x23')](_0x9cfb2f)[_0x3bee('0x31')](_0x1bc332);};}exports['index']=function(_0x3b0395,_0x1c599a){var _0x5f046a={},_0x3711e4={},_0x28181b={'count':0x0,'rows':[]};var _0x106ce6=_[_0x3bee('0x32')](db[_0x3bee('0x33')]['rawAttributes'],function(_0x57a895){return{'name':_0x57a895[_0x3bee('0x34')],'type':_0x57a895[_0x3bee('0x35')][_0x3bee('0x36')]};});_0x3711e4[_0x3bee('0x37')]=_[_0x3bee('0x32')](_0x106ce6,_0x3bee('0x30'));_0x3711e4[_0x3bee('0x38')]=_[_0x3bee('0x39')](_0x3b0395[_0x3bee('0x38')]);_0x3711e4[_0x3bee('0x3a')]=_[_0x3bee('0x3b')](_0x3711e4[_0x3bee('0x37')],_0x3711e4['query']);_0x5f046a[_0x3bee('0x3c')]=_[_0x3bee('0x3b')](_0x3711e4[_0x3bee('0x37')],qs[_0x3bee('0x3d')](_0x3b0395[_0x3bee('0x38')][_0x3bee('0x3d')]));_0x5f046a[_0x3bee('0x3c')]=_0x5f046a[_0x3bee('0x3c')][_0x3bee('0x3e')]?_0x5f046a[_0x3bee('0x3c')]:_0x3711e4[_0x3bee('0x37')];if(!_0x3b0395[_0x3bee('0x38')][_0x3bee('0x3f')]('nolimit')){_0x5f046a[_0x3bee('0x27')]=qs[_0x3bee('0x27')](_0x3b0395[_0x3bee('0x38')][_0x3bee('0x27')]);_0x5f046a[_0x3bee('0x29')]=qs[_0x3bee('0x29')](_0x3b0395[_0x3bee('0x38')][_0x3bee('0x29')]);}_0x5f046a['order']=qs[_0x3bee('0x40')](_0x3b0395[_0x3bee('0x38')][_0x3bee('0x40')]);_0x5f046a['where']=qs[_0x3bee('0x3a')](_['pick'](_0x3b0395[_0x3bee('0x38')],_0x3711e4['filters']),_0x106ce6);if(_0x3b0395['query'][_0x3bee('0x41')]){_0x5f046a[_0x3bee('0x42')]=_[_0x3bee('0x43')](_0x5f046a[_0x3bee('0x42')],{'$or':_[_0x3bee('0x32')](_0x106ce6,function(_0x55627a){if(_0x55627a['type']!==_0x3bee('0x44')){var _0x5a9db2={};_0x5a9db2[_0x55627a[_0x3bee('0x30')]]={'$like':'%'+_0x3b0395['query'][_0x3bee('0x41')]+'%'};return _0x5a9db2;}})});}_0x5f046a=_['merge']({},_0x5f046a,_0x3b0395[_0x3bee('0x45')]);var _0x5293d9={'where':_0x5f046a[_0x3bee('0x42')]};return db[_0x3bee('0x33')]['count'](_0x5293d9)['then'](function(_0x44bcfb){_0x28181b['count']=_0x44bcfb;if(_0x3b0395['query']['includeAll']){_0x5f046a[_0x3bee('0x46')]=[{'all':!![]}];}return db['ZohoAccount'][_0x3bee('0x47')](_0x5f046a);})[_0x3bee('0x2d')](function(_0xd87fd2){_0x28181b['rows']=_0xd87fd2;return _0x28181b;})[_0x3bee('0x2d')](respondWithFilteredResult(_0x1c599a,_0x5f046a))['catch'](handleError(_0x1c599a,null));};exports[_0x3bee('0x48')]=function(_0x516a91,_0x26ccd7){var _0x16b096={'raw':![],'where':{'id':_0x516a91['params']['id']}},_0x15a96a={};_0x15a96a[_0x3bee('0x37')]=_[_0x3bee('0x39')](db[_0x3bee('0x33')]['rawAttributes']);_0x15a96a['query']=_[_0x3bee('0x39')](_0x516a91[_0x3bee('0x38')]);_0x15a96a[_0x3bee('0x3a')]=_[_0x3bee('0x3b')](_0x15a96a[_0x3bee('0x37')],_0x15a96a[_0x3bee('0x38')]);_0x16b096[_0x3bee('0x3c')]=_['intersection'](_0x15a96a[_0x3bee('0x37')],qs[_0x3bee('0x3d')](_0x516a91['query']['fields']));_0x16b096[_0x3bee('0x3c')]=_0x16b096['attributes'][_0x3bee('0x3e')]?_0x16b096[_0x3bee('0x3c')]:_0x15a96a[_0x3bee('0x37')];if(_0x516a91['query'][_0x3bee('0x49')]){_0x16b096[_0x3bee('0x46')]=[{'all':!![]}];}_0x16b096=_[_0x3bee('0x43')]({},_0x16b096,_0x516a91['options']);return db[_0x3bee('0x33')][_0x3bee('0x4a')](_0x16b096)['then'](handleEntityNotFound(_0x26ccd7,null))[_0x3bee('0x2d')](respondWithResult(_0x26ccd7,null))[_0x3bee('0x22')](handleError(_0x26ccd7,null));};exports['create']=function(_0x432920,_0x29bf8c){return db[_0x3bee('0x33')][_0x3bee('0x4b')](_0x432920[_0x3bee('0x4c')],{})[_0x3bee('0x2d')](respondWithResult(_0x29bf8c,0xc9))[_0x3bee('0x22')](handleError(_0x29bf8c,null));};exports[_0x3bee('0x2c')]=function(_0x4c981f,_0x51fd46){if(_0x4c981f[_0x3bee('0x4c')]['id']){delete _0x4c981f['body']['id'];}return db[_0x3bee('0x33')][_0x3bee('0x4a')]({'where':{'id':_0x4c981f[_0x3bee('0x4d')]['id']}})['then'](handleEntityNotFound(_0x51fd46,null))[_0x3bee('0x2d')](saveUpdates(_0x4c981f[_0x3bee('0x4c')],null))[_0x3bee('0x2d')](respondWithResult(_0x51fd46,null))['catch'](handleError(_0x51fd46,null));};exports[_0x3bee('0x2e')]=function(_0x52a327,_0x3cb900){return db[_0x3bee('0x33')][_0x3bee('0x4a')]({'where':{'id':_0x52a327['params']['id']}})[_0x3bee('0x2d')](handleEntityNotFound(_0x3cb900,null))[_0x3bee('0x2d')](removeEntity(_0x3cb900,null))[_0x3bee('0x22')](handleError(_0x3cb900,null));};exports['getConfigurations']=function(_0x5d95a7,_0xb9f53e,_0x272031){var _0x149b35={};var _0x4e6b22={};var _0x4a8d2b;var _0x2799e3;return db['ZohoAccount']['findOne']({'where':{'id':_0x5d95a7[_0x3bee('0x4d')]['id']}})[_0x3bee('0x2d')](handleEntityNotFound(_0xb9f53e,null))[_0x3bee('0x2d')](function(_0x4a989c){if(_0x4a989c){_0x4a8d2b=_0x4a989c;_0x4e6b22['model']=_[_0x3bee('0x39')](db[_0x3bee('0x4e')]['rawAttributes']);_0x4e6b22[_0x3bee('0x38')]=_['keys'](_0x5d95a7[_0x3bee('0x38')]);_0x4e6b22[_0x3bee('0x3a')]=_[_0x3bee('0x3b')](_0x4e6b22[_0x3bee('0x37')],_0x4e6b22[_0x3bee('0x38')]);_0x149b35[_0x3bee('0x3c')]=_[_0x3bee('0x3b')](_0x4e6b22[_0x3bee('0x37')],qs[_0x3bee('0x3d')](_0x5d95a7[_0x3bee('0x38')][_0x3bee('0x3d')]));_0x149b35['attributes']=_0x149b35['attributes']['length']?_0x149b35[_0x3bee('0x3c')]:_0x4e6b22[_0x3bee('0x37')];_0x149b35[_0x3bee('0x4f')]=qs[_0x3bee('0x40')](_0x5d95a7['query'][_0x3bee('0x40')]);_0x149b35[_0x3bee('0x42')]=qs['filters'](_['pick'](_0x5d95a7[_0x3bee('0x38')],_0x4e6b22[_0x3bee('0x3a')]));if(_0x5d95a7[_0x3bee('0x38')]['filter']){_0x149b35[_0x3bee('0x42')]=_[_0x3bee('0x43')](_0x149b35[_0x3bee('0x42')],{'$or':_['map'](_0x149b35[_0x3bee('0x3c')],function(_0x412e0d){var _0x1bfb3a={};_0x1bfb3a[_0x412e0d]={'$like':'%'+_0x5d95a7[_0x3bee('0x38')]['filter']+'%'};return _0x1bfb3a;})});}_0x149b35=_['merge']({},_0x149b35,_0x5d95a7[_0x3bee('0x45')]);return _0x4a8d2b[_0x3bee('0x50')](_0x149b35);}})[_0x3bee('0x2d')](function(_0x3f239a){if(_0x3f239a){_0x2799e3=_0x3f239a[_0x3bee('0x3e')];if(!_0x5d95a7['query'][_0x3bee('0x3f')]('nolimit')){_0x149b35[_0x3bee('0x27')]=qs[_0x3bee('0x27')](_0x5d95a7[_0x3bee('0x38')][_0x3bee('0x27')]);_0x149b35[_0x3bee('0x29')]=qs[_0x3bee('0x29')](_0x5d95a7[_0x3bee('0x38')]['offset']);}return _0x4a8d2b[_0x3bee('0x50')](_0x149b35);}})[_0x3bee('0x2d')](function(_0x42045d){if(_0x42045d){return _0x42045d?{'count':_0x2799e3,'rows':_0x42045d}:null;}})[_0x3bee('0x2d')](respondWithResult(_0xb9f53e,null))['catch'](handleError(_0xb9f53e,null));};exports[_0x3bee('0x51')]=function(_0x378f83,_0x379761,_0x249bd2){if(_0x378f83[_0x3bee('0x4c')]['id']){delete _0x378f83[_0x3bee('0x4c')]['id'];}return db[_0x3bee('0x33')][_0x3bee('0x52')]({'where':{'id':_0x378f83['params']['id']}})[_0x3bee('0x2d')](handleEntityNotFound(_0x379761,null))[_0x3bee('0x2d')](function(_0x339aef){if(_0x339aef){_0x378f83['body'][_0x3bee('0x53')]=_0x339aef['id'];_0x378f83[_0x3bee('0x4c')][_0x3bee('0x54')]=integrations[_0x3bee('0x55')](_0x378f83[_0x3bee('0x4c')][_0x3bee('0x56')],_0x378f83[_0x3bee('0x4c')][_0x3bee('0x35')]);_0x378f83[_0x3bee('0x4c')][_0x3bee('0x57')]=integrations[_0x3bee('0x58')](_0x378f83[_0x3bee('0x4c')][_0x3bee('0x56')],_0x378f83[_0x3bee('0x4c')][_0x3bee('0x35')]);return db[_0x3bee('0x4e')][_0x3bee('0x4b')](_0x378f83[_0x3bee('0x4c')],{'include':[{'model':db[_0x3bee('0x59')],'as':_0x3bee('0x54')},{'model':db[_0x3bee('0x59')],'as':_0x3bee('0x57')}]});}return null;})[_0x3bee('0x2d')](respondWithResult(_0x379761,null))[_0x3bee('0x22')](handleError(_0x379761,null));};function getAccessToken(_0x75ba50){return new Promise(function(_0x556e60,_0x35f0fb){var _0xef6d20;switch(_0x75ba50[_0x3bee('0x5a')]){case'US':_0xef6d20=_0x3bee('0x5b');break;case'AU':_0xef6d20=_0x3bee('0x5c');break;case'EU':_0xef6d20=_0x3bee('0x5d');break;case'IN':_0xef6d20=_0x3bee('0x5e');break;case'CN':_0xef6d20=_0x3bee('0x5f');break;default:_0xef6d20=_0x3bee('0x5d');break;}var _0x4e5bf6={'method':_0x3bee('0x60'),'uri':_0xef6d20+_0x3bee('0x61'),'qs':{'refresh_token':_0x75ba50['refreshToken'],'client_id':_0x75ba50[_0x3bee('0x62')],'client_secret':_0x75ba50['clientSecret'],'grant_type':_0x3bee('0x63')},'json':!![]};return rp(_0x4e5bf6)[_0x3bee('0x2d')](function(_0x3b6709){if(_0x3b6709['access_token']){_0x556e60(_0x3b6709['access_token']);}else{_0x35f0fb(_0x3bee('0x64'));}})[_0x3bee('0x22')](function(_0x3c055b){_0x35f0fb(_0x3c055b);});});}exports[_0x3bee('0x65')]=function(_0x29950f,_0x337d75,_0xd59c63){var _0x2a0555,_0x5e6f16,_0x137e02,_0x1cfadb,_0x22d336;return db[_0x3bee('0x33')][_0x3bee('0x52')]({'where':{'id':_0x29950f[_0x3bee('0x4d')]['id']},'attributes':['id',_0x3bee('0x66'),'zone',_0x3bee('0x62'),_0x3bee('0x67'),'serverUrl',_0x3bee('0x68'),_0x3bee('0x69')]})['then'](handleEntityNotFound(_0x337d75,null))[_0x3bee('0x2d')](function(_0x53183c){_0x22d336=_0x53183c;_0x2a0555=_0x22d336[_0x3bee('0x66')];_0x5e6f16=_0x2a0555===_0x3bee('0x6a')?'eu':_0x3bee('0x6b');_0x137e02=_0x22d336[_0x3bee('0x6c')];var _0x515717=_0x137e02[_0x3bee('0x6d')](-0x1);if(_0x515717==='/'||_0x515717==='\x5c'||_0x515717===':'){_0x137e02=_0x137e02[_0x3bee('0x6e')](0x0,_0x137e02[_0x3bee('0x6f')](_0x515717));}if(!_0x22d336['refreshToken']){throw new Error(_0x3bee('0x70'));}return getAccessToken(_0x22d336);})[_0x3bee('0x2d')](function(_0x52ad3d){if(_0x52ad3d){return rp({'method':_0x3bee('0x71'),'uri':util[_0x3bee('0x72')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5e6f16),'qs':{'module':_0x3bee('0x73')},'headers':{'Authorization':_0x3bee('0x74')+_0x52ad3d},'json':!![]});}})[_0x3bee('0x2d')](function(_0x4556ea){if(_0x4556ea){if(_0x4556ea[_0x3bee('0x75')]&&_0x4556ea['response'][_0x3bee('0x1e')]){throw new Error(_0x4556ea[_0x3bee('0x75')][_0x3bee('0x1e')]['message']);}var _0x49859c=[];var _0x133909=[];var _0x3656b9=[_0x3bee('0x76'),_0x3bee('0x77'),_0x3bee('0x78'),'WhoId',_0x3bee('0x79'),'Call_Result',_0x3bee('0x7a'),_0x3bee('0x7b')];_0x133909=_[_0x3bee('0x7c')](_0x4556ea[_0x3bee('0x3d')],function(_0x3ca8ad){return _0x3656b9[_0x3bee('0x7d')](_0x3ca8ad[_0x3bee('0x7e')]);});for(var _0x2116eb=0x0;_0x2116eb<_0x133909[_0x3bee('0x3e')];_0x2116eb++){if(_0x133909[_0x2116eb]['system_mandatory']===![]){_0x49859c[_0x3bee('0x7f')]({'id':_0x133909[_0x2116eb]['id'],'name':_0x133909[_0x2116eb]['display_label'],'custom':_0x133909[_0x2116eb]['custom_field'],'options':_0x133909[_0x2116eb][_0x3bee('0x80')]==='picklist'&&_0x133909[_0x2116eb]['pick_list_values'][_0x3bee('0x3e')]>-0x1?_[_0x3bee('0x32')](_0x133909[_0x2116eb][_0x3bee('0x81')],function(_0x15bb8b){return{'name':_0x15bb8b,'value':_0x15bb8b};}):[]});}}return{'count':_0x49859c[_0x3bee('0x3e')],'rows':_0x49859c};}else{return{'count':0x0,'rows':[]};}})[_0x3bee('0x2d')](respondWithResult(_0x337d75,null))[_0x3bee('0x22')](function(_0x54c0fb){var _0x5732eb=_0x29950f['query']['test']?0x1f4:_0x54c0fb[_0x3bee('0x82')]||0x1f4;logger['error'](_0x3bee('0x83'),_0x3bee('0x65'),_0x5732eb,JSON['stringify'](_0x54c0fb));delete _0x54c0fb[_0x3bee('0x30')];if(_0x5732eb===0x191){_0x5732eb=0x190;}_0x337d75['status'](_0x5732eb)[_0x3bee('0x31')](_0x29950f[_0x3bee('0x38')][_0x3bee('0x84')]?{'message':_0x3bee('0x85'),'statusCode':_0x54c0fb[_0x3bee('0x82')]}:_0x54c0fb);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index adb9d9b..e230758 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 _0x2818=['define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','https://accounts.zoho.com','https://accounts.zoho.com.cn','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports'];(function(_0x59b4d4,_0x368618){var _0x120c5d=function(_0x5f12f9){while(--_0x5f12f9){_0x59b4d4['push'](_0x59b4d4['shift']());}};_0x120c5d(++_0x368618);}(_0x2818,0x181));var _0x8281=function(_0x631b77,_0x4eaa3b){_0x631b77=_0x631b77-0x0;var _0x1ef794=_0x2818[_0x631b77];return _0x1ef794;};'use strict';var _=require(_0x8281('0x0'));var util=require(_0x8281('0x1'));var logger=require(_0x8281('0x2'))('api');var moment=require(_0x8281('0x3'));var BPromise=require(_0x8281('0x4'));var rp=require(_0x8281('0x5'));var fs=require('fs');var path=require(_0x8281('0x6'));var rimraf=require(_0x8281('0x7'));var config=require(_0x8281('0x8'));var attributes=require(_0x8281('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8281('0xa')]=function(_0x1a5d20,_0xc1e24b){return _0x1a5d20[_0x8281('0xb')](_0x8281('0xc'),attributes,{'tableName':_0x8281('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2eaccc,_0x369496,_0x6a0735){if(_0x2eaccc[_0x8281('0xe')](_0x8281('0xf'))||_0x2eaccc['changed'](_0x8281('0x10'))||_0x2eaccc[_0x8281('0xe')](_0x8281('0x11'))||_0x2eaccc['changed'](_0x8281('0x12'))||_0x2eaccc['changed'](_0x8281('0x13'))||_0x2eaccc[_0x8281('0xe')](_0x8281('0x14'))){var _0xe6c35c,_0x446846;_0xe6c35c=_0x2eaccc[_0x8281('0x10')];var _0x581d9d=_0xe6c35c[_0x8281('0x15')](-0x1);if(_0x581d9d==='/'||_0x581d9d==='\x5c'||_0x581d9d===':'){_0xe6c35c=_0xe6c35c[_0x8281('0x16')](0x0,_0xe6c35c[_0x8281('0x17')](_0x581d9d));}switch(_0x2eaccc['zone']){case'US':_0x446846='https://accounts.zoho.com';break;case'AU':_0x446846=_0x8281('0x18');break;case'IN':_0x446846=_0x8281('0x19');break;case'CN':_0x446846='https://accounts.zoho.com.cn';break;default:_0x446846=_0x8281('0x1a');break;}var _0x262e17={'method':_0x8281('0x1b'),'uri':_0x446846+_0x8281('0x1c'),'form':{'grant_type':_0x8281('0x1d'),'client_id':_0x2eaccc[_0x8281('0x11')],'client_secret':_0x2eaccc[_0x8281('0x12')],'redirect_uri':_0x2eaccc[_0x8281('0x10')],'code':_0x2eaccc[_0x8281('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x262e17)[_0x8281('0x1e')](function(_0x398a04){var _0x1ae3a8=JSON[_0x8281('0x1f')](_0x398a04);if(_0x1ae3a8['refresh_token']){_0x2eaccc[_0x8281('0x20')]=_0x1ae3a8[_0x8281('0x21')];logger[_0x8281('0x22')](util[_0x8281('0x23')](_0x8281('0x24'),_0x2eaccc['name'],_0x2eaccc['id']));}else{logger['error'](util[_0x8281('0x23')](_0x8281('0x25'),_0x2eaccc[_0x8281('0x26')],_0x2eaccc['id']),util[_0x8281('0x27')](_0x1ae3a8,{'showHidden':![],'depth':null}));}return _0x6a0735(null,_0x369496);})[_0x8281('0x28')](function(_0x27795f){logger[_0x8281('0x29')](util[_0x8281('0x23')](_0x8281('0x25'),_0x2eaccc[_0x8281('0x26')],_0x2eaccc['id']),util[_0x8281('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x6a0735(_0x27795f);});}else{return _0x6a0735(null,_0x369496);}},'beforeUpdate':function(_0x401ec9,_0x3d62f0,_0x589f50){if(_0x401ec9[_0x8281('0xe')]('zone')||_0x401ec9['changed'](_0x8281('0x10'))||_0x401ec9[_0x8281('0xe')]('clientId')||_0x401ec9[_0x8281('0xe')]('clientSecret')||_0x401ec9[_0x8281('0xe')]('code')||_0x401ec9[_0x8281('0xe')](_0x8281('0x14'))){var _0x34d152,_0x185880;_0x34d152=_0x401ec9[_0x8281('0x10')];var _0x296b0b=_0x34d152[_0x8281('0x15')](-0x1);if(_0x296b0b==='/'||_0x296b0b==='\x5c'||_0x296b0b===':'){_0x34d152=_0x34d152['substring'](0x0,_0x34d152['lastIndexOf'](_0x296b0b));}switch(_0x401ec9[_0x8281('0xf')]){case'US':_0x185880=_0x8281('0x2a');break;case'AU':_0x185880=_0x8281('0x18');break;case'IN':_0x185880=_0x8281('0x19');break;case'CN':_0x185880=_0x8281('0x2b');break;default:_0x185880=_0x8281('0x1a');break;}var _0x4fdf7a={'method':'POST','uri':_0x185880+_0x8281('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x401ec9[_0x8281('0x11')],'client_secret':_0x401ec9[_0x8281('0x12')],'redirect_uri':_0x401ec9['serverUrl'],'code':_0x401ec9[_0x8281('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4fdf7a)[_0x8281('0x1e')](function(_0x10b820){var _0x31cc97=JSON[_0x8281('0x1f')](_0x10b820);if(_0x31cc97['refresh_token']){_0x401ec9[_0x8281('0x20')]=_0x31cc97[_0x8281('0x21')];logger['info'](util[_0x8281('0x23')](_0x8281('0x24'),_0x401ec9['name'],_0x401ec9['id']));}else{logger[_0x8281('0x29')](util['format'](_0x8281('0x25'),_0x401ec9[_0x8281('0x26')],_0x401ec9['id']),util[_0x8281('0x27')](_0x31cc97,{'showHidden':![],'depth':null}));}return _0x589f50(null,_0x3d62f0);})[_0x8281('0x28')](function(_0x480c58){logger[_0x8281('0x29')](util['format'](_0x8281('0x25'),_0x401ec9[_0x8281('0x26')],_0x401ec9['id']),util[_0x8281('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x589f50(_0x480c58);});}else{return _0x589f50(null,_0x3d62f0);}}}});}; \ No newline at end of file +var _0xfc8d=['zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','authorization_code','clientSecret','then','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','/oauth/v2/token','application/x-www-form-urlencoded','parse','refreshToken','info','error','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','host','slice','substring','lastIndexOf'];(function(_0x51e0f9,_0x1c6826){var _0x1001c0=function(_0xfb174f){while(--_0xfb174f){_0x51e0f9['push'](_0x51e0f9['shift']());}};_0x1001c0(++_0x1c6826);}(_0xfc8d,0x144));var _0xdfc8=function(_0x35cff0,_0x2e162c){_0x35cff0=_0x35cff0-0x0;var _0x4a9414=_0xfc8d[_0x35cff0];return _0x4a9414;};'use strict';var _=require(_0xdfc8('0x0'));var util=require(_0xdfc8('0x1'));var logger=require('../../config/logger')(_0xdfc8('0x2'));var moment=require('moment');var BPromise=require(_0xdfc8('0x3'));var rp=require(_0xdfc8('0x4'));var fs=require('fs');var path=require(_0xdfc8('0x5'));var rimraf=require(_0xdfc8('0x6'));var config=require(_0xdfc8('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xdfc8('0x8'));module['exports']=function(_0x2c0496,_0x530d32){return _0x2c0496[_0xdfc8('0x9')](_0xdfc8('0xa'),attributes,{'tableName':_0xdfc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x198adc,_0x36c75d,_0x3ec28b){if(_0x198adc[_0xdfc8('0xc')]('zone')||_0x198adc[_0xdfc8('0xc')](_0xdfc8('0xd'))||_0x198adc[_0xdfc8('0xc')](_0xdfc8('0xe'))||_0x198adc[_0xdfc8('0xc')]('clientSecret')||_0x198adc[_0xdfc8('0xc')](_0xdfc8('0xf'))||_0x198adc['changed'](_0xdfc8('0x10'))){var _0xf89131,_0x2d32c6;_0xf89131=_0x198adc[_0xdfc8('0xd')];var _0x2b99c7=_0xf89131[_0xdfc8('0x11')](-0x1);if(_0x2b99c7==='/'||_0x2b99c7==='\x5c'||_0x2b99c7===':'){_0xf89131=_0xf89131[_0xdfc8('0x12')](0x0,_0xf89131[_0xdfc8('0x13')](_0x2b99c7));}switch(_0x198adc[_0xdfc8('0x14')]){case'US':_0x2d32c6=_0xdfc8('0x15');break;case'AU':_0x2d32c6='https://accounts.zoho.com.au';break;case'IN':_0x2d32c6=_0xdfc8('0x16');break;case'CN':_0x2d32c6='https://accounts.zoho.com.cn';break;default:_0x2d32c6=_0xdfc8('0x17');break;}var _0x3aa5e9={'method':_0xdfc8('0x18'),'uri':_0x2d32c6+'/oauth/v2/token','form':{'grant_type':_0xdfc8('0x19'),'client_id':_0x198adc[_0xdfc8('0xe')],'client_secret':_0x198adc[_0xdfc8('0x1a')],'redirect_uri':_0x198adc[_0xdfc8('0xd')],'code':_0x198adc[_0xdfc8('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3aa5e9)[_0xdfc8('0x1b')](function(_0x22f05d){var _0x49c66d=JSON['parse'](_0x22f05d);if(_0x49c66d[_0xdfc8('0x1c')]){_0x198adc['refreshToken']=_0x49c66d[_0xdfc8('0x1c')];logger['info'](util['format'](_0xdfc8('0x1d'),_0x198adc['name'],_0x198adc['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x198adc[_0xdfc8('0x1e')],_0x198adc['id']),util[_0xdfc8('0x1f')](_0x49c66d,{'showHidden':![],'depth':null}));}return _0x3ec28b(null,_0x36c75d);})[_0xdfc8('0x20')](function(_0x11b4d8){logger['error'](util[_0xdfc8('0x21')](_0xdfc8('0x22'),_0x198adc[_0xdfc8('0x1e')],_0x198adc['id']),util[_0xdfc8('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x3ec28b(_0x11b4d8);});}else{return _0x3ec28b(null,_0x36c75d);}},'beforeUpdate':function(_0x408e63,_0x1729da,_0x2414bb){if(_0x408e63[_0xdfc8('0xc')]('zone')||_0x408e63[_0xdfc8('0xc')](_0xdfc8('0xd'))||_0x408e63[_0xdfc8('0xc')](_0xdfc8('0xe'))||_0x408e63['changed'](_0xdfc8('0x1a'))||_0x408e63[_0xdfc8('0xc')](_0xdfc8('0xf'))||_0x408e63[_0xdfc8('0xc')]('host')){var _0x56b65e,_0x1f1bef;_0x56b65e=_0x408e63['serverUrl'];var _0x10de78=_0x56b65e[_0xdfc8('0x11')](-0x1);if(_0x10de78==='/'||_0x10de78==='\x5c'||_0x10de78===':'){_0x56b65e=_0x56b65e[_0xdfc8('0x12')](0x0,_0x56b65e[_0xdfc8('0x13')](_0x10de78));}switch(_0x408e63[_0xdfc8('0x14')]){case'US':_0x1f1bef=_0xdfc8('0x15');break;case'AU':_0x1f1bef=_0xdfc8('0x23');break;case'IN':_0x1f1bef=_0xdfc8('0x16');break;case'CN':_0x1f1bef=_0xdfc8('0x24');break;default:_0x1f1bef=_0xdfc8('0x17');break;}var _0x5b62ab={'method':'POST','uri':_0x1f1bef+_0xdfc8('0x25'),'form':{'grant_type':_0xdfc8('0x19'),'client_id':_0x408e63['clientId'],'client_secret':_0x408e63['clientSecret'],'redirect_uri':_0x408e63['serverUrl'],'code':_0x408e63['code']},'headers':{'Content-Type':_0xdfc8('0x26')}};return rp(_0x5b62ab)['then'](function(_0xfa5891){var _0x5575cb=JSON[_0xdfc8('0x27')](_0xfa5891);if(_0x5575cb[_0xdfc8('0x1c')]){_0x408e63[_0xdfc8('0x28')]=_0x5575cb[_0xdfc8('0x1c')];logger[_0xdfc8('0x29')](util[_0xdfc8('0x21')](_0xdfc8('0x1d'),_0x408e63[_0xdfc8('0x1e')],_0x408e63['id']));}else{logger[_0xdfc8('0x2a')](util['format'](_0xdfc8('0x22'),_0x408e63[_0xdfc8('0x1e')],_0x408e63['id']),util[_0xdfc8('0x1f')](_0x5575cb,{'showHidden':![],'depth':null}));}return _0x2414bb(null,_0x1729da);})[_0xdfc8('0x20')](function(_0x4b4375){logger[_0xdfc8('0x2a')](util[_0xdfc8('0x21')](_0xdfc8('0x22'),_0x408e63[_0xdfc8('0x1e')],_0x408e63['id']),util[_0xdfc8('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x2414bb(_0x4b4375);});}else{return _0x2414bb(null,_0x1729da);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 85d02b3..88b9a58 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 _0x780c=['ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','then','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetZohoAccount'];(function(_0x151813,_0x4bf7fc){var _0x37183f=function(_0x406b80){while(--_0x406b80){_0x151813['push'](_0x151813['shift']());}};_0x37183f(++_0x4bf7fc);}(_0x780c,0xd3));var _0xc780=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x780c[_0x12a554];return _0x244ba0;};'use strict';var _=require(_0xc780('0x0'));var util=require('util');var moment=require(_0xc780('0x1'));var BPromise=require(_0xc780('0x2'));var rs=require(_0xc780('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc780('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc780('0x5'))('rpc');var config=require(_0xc780('0x6'));var jayson=require(_0xc780('0x7'));var client=jayson['client'][_0xc780('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x199d5a,_0x1fb792,_0x11ce65){return new BPromise(function(_0x51d177,_0x14f3c6){return client[_0xc780('0x9')](_0x199d5a,_0x11ce65)['then'](function(_0x5209a8){logger[_0xc780('0xa')](_0xc780('0xb'),_0x1fb792,_0xc780('0xc'));logger[_0xc780('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1fb792,_0xc780('0xc'),JSON['stringify'](_0x5209a8));if(_0x5209a8[_0xc780('0xe')]){if(_0x5209a8['error'][_0xc780('0xf')]===0x1f4){logger[_0xc780('0xe')](_0xc780('0xb'),_0x1fb792,_0x5209a8[_0xc780('0xe')]['message']);return _0x14f3c6(_0x5209a8[_0xc780('0xe')][_0xc780('0x10')]);}logger[_0xc780('0xe')](_0xc780('0xb'),_0x1fb792,_0x5209a8['error'][_0xc780('0x10')]);return _0x51d177(_0x5209a8['error'][_0xc780('0x10')]);}else{logger['info'](_0xc780('0xb'),_0x1fb792,_0xc780('0xc'));_0x51d177(_0x5209a8[_0xc780('0x11')][_0xc780('0x10')]);}})[_0xc780('0x12')](function(_0x1f58d5){logger['error'](_0xc780('0xb'),_0x1fb792,_0x1f58d5);_0x14f3c6(_0x1f58d5);});});}exports[_0xc780('0x13')]=function(_0x39a3d4){var _0x224660=this;return new Promise(function(_0x2f3374,_0x21ce79){return db[_0xc780('0x14')][_0xc780('0x15')]({'raw':_0x39a3d4['options']?_0x39a3d4[_0xc780('0x16')][_0xc780('0x17')]===undefined?!![]:![]:!![],'where':_0x39a3d4[_0xc780('0x16')]?_0x39a3d4[_0xc780('0x16')][_0xc780('0x18')]||null:null,'attributes':_0x39a3d4[_0xc780('0x16')]?_0x39a3d4[_0xc780('0x16')][_0xc780('0x19')]||null:null,'limit':_0x39a3d4['options']?_0x39a3d4[_0xc780('0x16')][_0xc780('0x1a')]||null:null,'include':_0x39a3d4[_0xc780('0x16')]?_0x39a3d4['options'][_0xc780('0x1b')]?_[_0xc780('0x1c')](_0x39a3d4['options'][_0xc780('0x1b')],function(_0x51d009){return{'model':db[_0x51d009[_0xc780('0x1d')]],'as':_0x51d009['as'],'attributes':_0x51d009[_0xc780('0x19')],'include':_0x51d009[_0xc780('0x1b')]?_[_0xc780('0x1c')](_0x51d009[_0xc780('0x1b')],function(_0x5bcbe8){return{'model':db[_0x5bcbe8['model']],'as':_0x5bcbe8['as'],'attributes':_0x5bcbe8[_0xc780('0x19')],'include':_0x5bcbe8['include']?_[_0xc780('0x1c')](_0x5bcbe8[_0xc780('0x1b')],function(_0x125652){return{'model':db[_0x125652[_0xc780('0x1d')]],'as':_0x125652['as'],'attributes':_0x125652[_0xc780('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x478418){logger[_0xc780('0xa')](_0xc780('0x13'),_0x39a3d4);logger[_0xc780('0xd')]('GetZohoAccount',_0x39a3d4,JSON['stringify'](_0x478418));_0x2f3374(_0x478418);})[_0xc780('0x12')](function(_0x132683){logger[_0xc780('0xe')](_0xc780('0x13'),_0x132683[_0xc780('0x10')],_0x39a3d4);_0x21ce79(_0x224660[_0xc780('0xe')](0x1f4,_0x132683['message']));});});};exports[_0xc780('0x1e')]=function(_0x523412){var _0x1d6f83=this;return new Promise(function(_0x235ae7,_0x14d79d){return db[_0xc780('0x14')]['find']({'raw':_0x523412[_0xc780('0x16')]?_0x523412[_0xc780('0x16')][_0xc780('0x17')]===undefined?!![]:![]:!![],'where':_0x523412[_0xc780('0x16')]?_0x523412[_0xc780('0x16')][_0xc780('0x18')]||null:null,'attributes':_0x523412[_0xc780('0x16')]?_0x523412[_0xc780('0x16')][_0xc780('0x19')]||null:null,'include':_0x523412[_0xc780('0x16')]?_0x523412[_0xc780('0x16')][_0xc780('0x1b')]?_[_0xc780('0x1c')](_0x523412['options'][_0xc780('0x1b')],function(_0x4f423a){return{'model':db[_0x4f423a['model']],'as':_0x4f423a['as'],'attributes':_0x4f423a['attributes'],'include':_0x4f423a[_0xc780('0x1b')]?_[_0xc780('0x1c')](_0x4f423a[_0xc780('0x1b')],function(_0x429707){return{'model':db[_0x429707[_0xc780('0x1d')]],'as':_0x429707['as'],'attributes':_0x429707['attributes'],'include':_0x429707[_0xc780('0x1b')]?_['map'](_0x429707[_0xc780('0x1b')],function(_0x496d77){return{'model':db[_0x496d77[_0xc780('0x1d')]],'as':_0x496d77['as'],'attributes':_0x496d77[_0xc780('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc780('0x1f')](function(_0x1da072){logger['info'](_0xc780('0x1e'),_0x523412);logger[_0xc780('0xd')](_0xc780('0x1e'),_0x523412,JSON[_0xc780('0x20')](_0x1da072));_0x235ae7(_0x1da072);})['catch'](function(_0x4f6948){logger[_0xc780('0xe')]('ShowZohoAccount',_0x4f6948['message'],_0x523412);_0x14d79d(_0x1d6f83[_0xc780('0xe')](0x1f4,_0x4f6948['message']));});});}; \ No newline at end of file +var _0xc42c=['stringify','ShowZohoAccount','find','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x48f32b,_0x58b671){var _0x49a97a=function(_0x2164e5){while(--_0x2164e5){_0x48f32b['push'](_0x48f32b['shift']());}};_0x49a97a(++_0x58b671);}(_0xc42c,0x13e));var _0xcc42=function(_0x2573f8,_0x580bd4){_0x2573f8=_0x2573f8-0x0;var _0x2c84ae=_0xc42c[_0x2573f8];return _0x2c84ae;};'use strict';var _=require('lodash');var util=require(_0xcc42('0x0'));var moment=require(_0xcc42('0x1'));var BPromise=require(_0xcc42('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc42('0x3'));var logger=require(_0xcc42('0x4'))(_0xcc42('0x5'));var config=require(_0xcc42('0x6'));var jayson=require(_0xcc42('0x7'));var client=jayson[_0xcc42('0x8')][_0xcc42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151faa,_0x3b7fa5,_0x4ab6e0){return new BPromise(function(_0x585e0b,_0x501f49){return client[_0xcc42('0xa')](_0x151faa,_0x4ab6e0)['then'](function(_0x11c838){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x3b7fa5,_0xcc42('0xb'));logger[_0xcc42('0xc')](_0xcc42('0xd'),_0x3b7fa5,'request\x20sent',JSON['stringify'](_0x11c838));if(_0x11c838[_0xcc42('0xe')]){if(_0x11c838[_0xcc42('0xe')][_0xcc42('0xf')]===0x1f4){logger[_0xcc42('0xe')](_0xcc42('0x10'),_0x3b7fa5,_0x11c838['error'][_0xcc42('0x11')]);return _0x501f49(_0x11c838['error'][_0xcc42('0x11')]);}logger['error'](_0xcc42('0x10'),_0x3b7fa5,_0x11c838['error'][_0xcc42('0x11')]);return _0x585e0b(_0x11c838[_0xcc42('0xe')][_0xcc42('0x11')]);}else{logger[_0xcc42('0x12')](_0xcc42('0x10'),_0x3b7fa5,_0xcc42('0xb'));_0x585e0b(_0x11c838[_0xcc42('0x13')][_0xcc42('0x11')]);}})[_0xcc42('0x14')](function(_0x40a6da){logger[_0xcc42('0xe')](_0xcc42('0x10'),_0x3b7fa5,_0x40a6da);_0x501f49(_0x40a6da);});});}exports[_0xcc42('0x15')]=function(_0x3da071){var _0x1babbd=this;return new Promise(function(_0x33a2b0,_0x3ed83e){return db['ZohoAccount'][_0xcc42('0x16')]({'raw':_0x3da071[_0xcc42('0x17')]?_0x3da071[_0xcc42('0x17')][_0xcc42('0x18')]===undefined?!![]:![]:!![],'where':_0x3da071['options']?_0x3da071[_0xcc42('0x17')][_0xcc42('0x19')]||null:null,'attributes':_0x3da071[_0xcc42('0x17')]?_0x3da071[_0xcc42('0x17')][_0xcc42('0x1a')]||null:null,'limit':_0x3da071[_0xcc42('0x17')]?_0x3da071[_0xcc42('0x17')][_0xcc42('0x1b')]||null:null,'include':_0x3da071['options']?_0x3da071[_0xcc42('0x17')][_0xcc42('0x1c')]?_['map'](_0x3da071[_0xcc42('0x17')]['include'],function(_0x5f1314){return{'model':db[_0x5f1314['model']],'as':_0x5f1314['as'],'attributes':_0x5f1314[_0xcc42('0x1a')],'include':_0x5f1314[_0xcc42('0x1c')]?_[_0xcc42('0x1d')](_0x5f1314[_0xcc42('0x1c')],function(_0x505978){return{'model':db[_0x505978[_0xcc42('0x1e')]],'as':_0x505978['as'],'attributes':_0x505978[_0xcc42('0x1a')],'include':_0x505978['include']?_[_0xcc42('0x1d')](_0x505978[_0xcc42('0x1c')],function(_0x2304db){return{'model':db[_0x2304db[_0xcc42('0x1e')]],'as':_0x2304db['as'],'attributes':_0x2304db[_0xcc42('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcc42('0x1f')](function(_0x198d04){logger['info']('GetZohoAccount',_0x3da071);logger[_0xcc42('0xc')](_0xcc42('0x15'),_0x3da071,JSON[_0xcc42('0x20')](_0x198d04));_0x33a2b0(_0x198d04);})[_0xcc42('0x14')](function(_0x313b6d){logger[_0xcc42('0xe')](_0xcc42('0x15'),_0x313b6d[_0xcc42('0x11')],_0x3da071);_0x3ed83e(_0x1babbd[_0xcc42('0xe')](0x1f4,_0x313b6d[_0xcc42('0x11')]));});});};exports[_0xcc42('0x21')]=function(_0xe8bd5){var _0x42034d=this;return new Promise(function(_0x1d6582,_0xc434ef){return db['ZohoAccount'][_0xcc42('0x22')]({'raw':_0xe8bd5[_0xcc42('0x17')]?_0xe8bd5[_0xcc42('0x17')][_0xcc42('0x18')]===undefined?!![]:![]:!![],'where':_0xe8bd5[_0xcc42('0x17')]?_0xe8bd5[_0xcc42('0x17')][_0xcc42('0x19')]||null:null,'attributes':_0xe8bd5[_0xcc42('0x17')]?_0xe8bd5[_0xcc42('0x17')]['attributes']||null:null,'include':_0xe8bd5[_0xcc42('0x17')]?_0xe8bd5[_0xcc42('0x17')]['include']?_['map'](_0xe8bd5[_0xcc42('0x17')][_0xcc42('0x1c')],function(_0x1360f6){return{'model':db[_0x1360f6[_0xcc42('0x1e')]],'as':_0x1360f6['as'],'attributes':_0x1360f6[_0xcc42('0x1a')],'include':_0x1360f6[_0xcc42('0x1c')]?_[_0xcc42('0x1d')](_0x1360f6['include'],function(_0x1078c7){return{'model':db[_0x1078c7[_0xcc42('0x1e')]],'as':_0x1078c7['as'],'attributes':_0x1078c7[_0xcc42('0x1a')],'include':_0x1078c7[_0xcc42('0x1c')]?_[_0xcc42('0x1d')](_0x1078c7[_0xcc42('0x1c')],function(_0x300d2b){return{'model':db[_0x300d2b['model']],'as':_0x300d2b['as'],'attributes':_0x300d2b[_0xcc42('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcc42('0x1f')](function(_0x54846d){logger[_0xcc42('0x12')]('ShowZohoAccount',_0xe8bd5);logger[_0xcc42('0xc')](_0xcc42('0x21'),_0xe8bd5,JSON[_0xcc42('0x20')](_0x54846d));_0x1d6582(_0x54846d);})[_0xcc42('0x14')](function(_0x3cddc3){logger[_0xcc42('0xe')]('ShowZohoAccount',_0x3cddc3[_0xcc42('0x11')],_0xe8bd5);_0xc434ef(_0x42034d[_0xcc42('0xe')](0x1f4,_0x3cddc3[_0xcc42('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0fc5a2c..3fde092 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 _0xc167=['./intZohoConfiguration.controller','isAuthenticated','get','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','create','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xc167,0x171));var _0x7c16=function(_0x1d02bf,_0x1940de){_0x1d02bf=_0x1d02bf-0x0;var _0x8def97=_0xc167[_0x1d02bf];return _0x8def97;};'use strict';var multer=require('multer');var util=require(_0x7c16('0x0'));var path=require(_0x7c16('0x1'));var timeout=require(_0x7c16('0x2'));var express=require(_0x7c16('0x3'));var router=express[_0x7c16('0x4')]();var fs_extra=require(_0x7c16('0x5'));var auth=require(_0x7c16('0x6'));var interaction=require(_0x7c16('0x7'));var config=require(_0x7c16('0x8'));var controller=require(_0x7c16('0x9'));router['get']('/',auth[_0x7c16('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7c16('0xb')](_0x7c16('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x7c16('0xb')]('/:id/subjects',auth[_0x7c16('0xa')](),controller[_0x7c16('0xd')]);router[_0x7c16('0xb')](_0x7c16('0xe'),auth['isAuthenticated'](),controller[_0x7c16('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7c16('0x10')]);router['put'](_0x7c16('0x11'),auth[_0x7c16('0xa')](),controller[_0x7c16('0x12')]);router[_0x7c16('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7c16('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5047=['put','delete','destroy','exports','path','express','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','/:id','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x34124e,_0x3607c6){var _0x3d51c8=function(_0x4deb61){while(--_0x4deb61){_0x34124e['push'](_0x34124e['shift']());}};_0x3d51c8(++_0x3607c6);}(_0x5047,0xa4));var _0x7504=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x5047[_0x2bc3f4];return _0x14ac53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7504('0x0'));var timeout=require('connect-timeout');var express=require(_0x7504('0x1'));var router=express[_0x7504('0x2')]();var fs_extra=require(_0x7504('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7504('0x4'));var config=require('../../config/environment');var controller=require(_0x7504('0x5'));router[_0x7504('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7504('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x7504('0x6')](_0x7504('0x8'),auth[_0x7504('0x9')](),controller[_0x7504('0xa')]);router[_0x7504('0x6')](_0x7504('0xb'),auth[_0x7504('0x9')](),controller['getSubjects']);router[_0x7504('0x6')](_0x7504('0xc'),auth[_0x7504('0x9')](),controller[_0x7504('0xd')]);router[_0x7504('0xe')]('/',auth[_0x7504('0x9')](),controller[_0x7504('0xf')]);router[_0x7504('0x10')](_0x7504('0x7'),auth[_0x7504('0x9')](),controller['update']);router[_0x7504('0x11')](_0x7504('0x7'),auth[_0x7504('0x9')](),controller[_0x7504('0x12')]);module[_0x7504('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2132fa5..b8153b5 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 _0x2031=['contact_lead','sequelize','exports','STRING','ENUM','lead','contact','nothing'];(function(_0x52560d,_0x3a3b7a){var _0x13f3b7=function(_0x67f835){while(--_0x67f835){_0x52560d['push'](_0x52560d['shift']());}};_0x13f3b7(++_0x3a3b7a);}(_0x2031,0x1c9));var _0x1203=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2031[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x1203('0x0'));module[_0x1203('0x1')]={'name':{'type':Sequelize[_0x1203('0x2')]},'moduleCreate':{'type':Sequelize[_0x1203('0x3')](_0x1203('0x4'),_0x1203('0x5'),_0x1203('0x6')),'defaultValue':_0x1203('0x4')},'moduleSearch':{'type':Sequelize[_0x1203('0x3')](_0x1203('0x7'),'contact',_0x1203('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x1203('0x2')]}}; \ No newline at end of file +var _0x4ba3=['contact_lead','lead','sequelize','exports','STRING','ENUM','contact'];(function(_0x2874ab,_0x454122){var _0x56a7f2=function(_0x4b2072){while(--_0x4b2072){_0x2874ab['push'](_0x2874ab['shift']());}};_0x56a7f2(++_0x454122);}(_0x4ba3,0x1de));var _0x34ba=function(_0x4b373a,_0x3fc14e){_0x4b373a=_0x4b373a-0x0;var _0x1a5312=_0x4ba3[_0x4b373a];return _0x1a5312;};'use strict';var Sequelize=require(_0x34ba('0x0'));module[_0x34ba('0x1')]={'name':{'type':Sequelize[_0x34ba('0x2')]},'moduleCreate':{'type':Sequelize[_0x34ba('0x3')]('lead',_0x34ba('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x34ba('0x3')](_0x34ba('0x5'),_0x34ba('0x4'),_0x34ba('0x6')),'defaultValue':_0x34ba('0x5')},'description':{'type':Sequelize[_0x34ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index bde6c76..111ef9c 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 _0xb138=['path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','update','getFields','findOne','ZohoField','sort','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x4ea851,_0x410ac3){var _0x30937f=function(_0x388e91){while(--_0x388e91){_0x4ea851['push'](_0x4ea851['shift']());}};_0x30937f(++_0x410ac3);}(_0xb138,0x1dd));var _0x8b13=function(_0x4e9b13,_0x24f7dc){_0x4e9b13=_0x4e9b13-0x0;var _0x402563=_0xb138[_0x4e9b13];return _0x402563;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];var jayson=require(_0x8b13('0x1a'));var client=jayson[_0x8b13('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50e7a4,_0x3dcde6,_0x130a6f,_0x5f12b5){return new BPromise(function(_0x51a935,_0x479773){var _0x272cb0=_0x5f12b5||client;return _0x272cb0[_0x8b13('0x1c')](_0x50e7a4,_0x130a6f)[_0x8b13('0x1d')](function(_0x2c615a){logger[_0x8b13('0x1e')]('ZohoConfiguration,\x20%s,\x20%s',_0x3dcde6,_0x8b13('0x1f'));logger[_0x8b13('0x20')](_0x8b13('0x21'),_0x3dcde6,_0x8b13('0x1f'),JSON[_0x8b13('0x22')](_0x2c615a));if(_0x2c615a[_0x8b13('0x23')]){if(_0x2c615a[_0x8b13('0x23')][_0x8b13('0x24')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3dcde6,_0x2c615a[_0x8b13('0x23')][_0x8b13('0x25')]);return _0x479773(_0x2c615a[_0x8b13('0x23')][_0x8b13('0x25')]);}logger[_0x8b13('0x23')](_0x8b13('0x26'),_0x3dcde6,_0x2c615a['error'][_0x8b13('0x25')]);return _0x51a935(_0x2c615a[_0x8b13('0x23')][_0x8b13('0x25')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3dcde6,_0x8b13('0x1f'));_0x51a935(_0x2c615a[_0x8b13('0x27')]['message']);}})[_0x8b13('0x28')](function(_0x2c3afb){logger[_0x8b13('0x23')](_0x8b13('0x26'),_0x3dcde6,_0x2c3afb);_0x479773(_0x2c3afb);});});}function respondWithStatusCode(_0xc05d5c,_0x583639){_0x583639=_0x583639||0xcc;return function(_0x339271){if(_0x339271){return _0xc05d5c[_0x8b13('0x29')](_0x583639);}return _0xc05d5c['status'](_0x583639)[_0x8b13('0x2a')]();};}function respondWithResult(_0x4fdd1c,_0x420772){_0x420772=_0x420772||0xc8;return function(_0x325d68){if(_0x325d68){return _0x4fdd1c['status'](_0x420772)[_0x8b13('0x2b')](_0x325d68);}};}function respondWithFilteredResult(_0x3223d8,_0x4f8e58){return function(_0x134c5e){if(_0x134c5e){var _0x14a739=typeof _0x4f8e58[_0x8b13('0x2c')]===_0x8b13('0x2d')&&typeof _0x4f8e58[_0x8b13('0x2e')]==='undefined';var _0x6023f5=_0x134c5e[_0x8b13('0x2f')];var _0x3475d8=_0x14a739?0x0:_0x4f8e58[_0x8b13('0x2c')];var _0x114b01=_0x14a739?_0x134c5e[_0x8b13('0x2f')]:_0x4f8e58['offset']+_0x4f8e58[_0x8b13('0x2e')];var _0xfec033;if(_0x114b01>=_0x6023f5){_0x114b01=_0x6023f5;_0xfec033=0xc8;}else{_0xfec033=0xce;}_0x3223d8[_0x8b13('0x30')](_0xfec033);return _0x3223d8[_0x8b13('0x31')](_0x8b13('0x32'),_0x3475d8+'-'+_0x114b01+'/'+_0x6023f5)[_0x8b13('0x2b')](_0x134c5e);}return null;};}function patchUpdates(_0x3304bd){return function(_0x44bce2){try{jsonpatch[_0x8b13('0x33')](_0x44bce2,_0x3304bd,!![]);}catch(_0x5751db){return BPromise[_0x8b13('0x34')](_0x5751db);}return _0x44bce2[_0x8b13('0x35')]();};}function saveUpdates(_0x288ff7,_0x2878a6){return function(_0x51a334){if(_0x51a334){return _0x51a334['update'](_0x288ff7)[_0x8b13('0x1d')](function(_0x5cedea){return _0x5cedea;});}return null;};}function removeEntity(_0x5663fa,_0x3b1dfa){return function(_0x535521){if(_0x535521){return _0x535521[_0x8b13('0x36')]()[_0x8b13('0x1d')](function(){_0x5663fa[_0x8b13('0x30')](0xcc)[_0x8b13('0x2a')]();});}};}function handleEntityNotFound(_0x11657e,_0x669416){return function(_0x1fcd82){if(!_0x1fcd82){_0x11657e[_0x8b13('0x29')](0x194);}return _0x1fcd82;};}function handleError(_0x269743,_0x1b313d){_0x1b313d=_0x1b313d||0x1f4;return function(_0x4d45bc){logger[_0x8b13('0x23')](_0x4d45bc[_0x8b13('0x37')]);if(_0x4d45bc[_0x8b13('0x38')]){delete _0x4d45bc[_0x8b13('0x38')];}_0x269743[_0x8b13('0x30')](_0x1b313d)[_0x8b13('0x39')](_0x4d45bc);};}exports[_0x8b13('0x3a')]=function(_0x241687,_0x5c67b1){var _0x219bdf={},_0x5089c6={},_0x3826a5={'count':0x0,'rows':[]};var _0x37732c=_[_0x8b13('0x3b')](db[_0x8b13('0x3c')][_0x8b13('0x3d')],function(_0x327eb1){return{'name':_0x327eb1['fieldName'],'type':_0x327eb1['type'][_0x8b13('0x3e')]};});_0x5089c6['model']=_[_0x8b13('0x3b')](_0x37732c,'name');_0x5089c6[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0x241687[_0x8b13('0x3f')]);_0x5089c6[_0x8b13('0x41')]=_[_0x8b13('0x42')](_0x5089c6['model'],_0x5089c6['query']);_0x219bdf[_0x8b13('0x43')]=_['intersection'](_0x5089c6[_0x8b13('0x44')],qs[_0x8b13('0x45')](_0x241687['query'][_0x8b13('0x45')]));_0x219bdf[_0x8b13('0x43')]=_0x219bdf[_0x8b13('0x43')][_0x8b13('0x46')]?_0x219bdf[_0x8b13('0x43')]:_0x5089c6[_0x8b13('0x44')];if(!_0x241687[_0x8b13('0x3f')]['hasOwnProperty']('nolimit')){_0x219bdf['limit']=qs[_0x8b13('0x2e')](_0x241687[_0x8b13('0x3f')][_0x8b13('0x2e')]);_0x219bdf[_0x8b13('0x2c')]=qs[_0x8b13('0x2c')](_0x241687[_0x8b13('0x3f')]['offset']);}_0x219bdf[_0x8b13('0x47')]=qs['sort'](_0x241687[_0x8b13('0x3f')]['sort']);_0x219bdf[_0x8b13('0x48')]=qs[_0x8b13('0x41')](_[_0x8b13('0x49')](_0x241687[_0x8b13('0x3f')],_0x5089c6[_0x8b13('0x41')]),_0x37732c);if(_0x241687[_0x8b13('0x3f')][_0x8b13('0x4a')]){_0x219bdf['where']=_['merge'](_0x219bdf['where'],{'$or':_[_0x8b13('0x3b')](_0x37732c,function(_0x30d58f){if(_0x30d58f[_0x8b13('0x4b')]!==_0x8b13('0x4c')){var _0x4a4018={};_0x4a4018[_0x30d58f['name']]={'$like':'%'+_0x241687[_0x8b13('0x3f')]['filter']+'%'};return _0x4a4018;}})});}_0x219bdf=_[_0x8b13('0x4d')]({},_0x219bdf,_0x241687[_0x8b13('0x4e')]);var _0x20c363={'where':_0x219bdf[_0x8b13('0x48')]};return db[_0x8b13('0x3c')]['count'](_0x20c363)[_0x8b13('0x1d')](function(_0x2044fc){_0x3826a5[_0x8b13('0x2f')]=_0x2044fc;if(_0x241687[_0x8b13('0x3f')][_0x8b13('0x4f')]){_0x219bdf[_0x8b13('0x50')]=[{'all':!![]}];}return db[_0x8b13('0x3c')][_0x8b13('0x51')](_0x219bdf);})[_0x8b13('0x1d')](function(_0x518298){_0x3826a5[_0x8b13('0x52')]=_0x518298;return _0x3826a5;})['then'](respondWithFilteredResult(_0x5c67b1,_0x219bdf))[_0x8b13('0x28')](handleError(_0x5c67b1,null));};exports[_0x8b13('0x53')]=function(_0x403651,_0x5d9ddb){var _0x148efb={'raw':![],'where':{'id':_0x403651[_0x8b13('0x54')]['id']}},_0x35f612={};_0x35f612[_0x8b13('0x44')]=_[_0x8b13('0x40')](db[_0x8b13('0x3c')][_0x8b13('0x3d')]);_0x35f612['query']=_[_0x8b13('0x40')](_0x403651['query']);_0x35f612[_0x8b13('0x41')]=_[_0x8b13('0x42')](_0x35f612[_0x8b13('0x44')],_0x35f612[_0x8b13('0x3f')]);_0x148efb[_0x8b13('0x43')]=_[_0x8b13('0x42')](_0x35f612[_0x8b13('0x44')],qs[_0x8b13('0x45')](_0x403651[_0x8b13('0x3f')][_0x8b13('0x45')]));_0x148efb[_0x8b13('0x43')]=_0x148efb[_0x8b13('0x43')][_0x8b13('0x46')]?_0x148efb[_0x8b13('0x43')]:_0x35f612[_0x8b13('0x44')];if(_0x403651[_0x8b13('0x3f')][_0x8b13('0x4f')]){_0x148efb['include']=[{'all':!![]}];}_0x148efb=_[_0x8b13('0x4d')]({},_0x148efb,_0x403651[_0x8b13('0x4e')]);return db['ZohoConfiguration'][_0x8b13('0x55')](_0x148efb)[_0x8b13('0x1d')](handleEntityNotFound(_0x5d9ddb,null))[_0x8b13('0x1d')](respondWithResult(_0x5d9ddb,null))[_0x8b13('0x28')](handleError(_0x5d9ddb,null));};exports[_0x8b13('0x56')]=function(_0x12549b,_0x934f){return db[_0x8b13('0x3c')][_0x8b13('0x56')](_0x12549b[_0x8b13('0x57')],{})[_0x8b13('0x1d')](respondWithResult(_0x934f,0xc9))[_0x8b13('0x28')](handleError(_0x934f,null));};exports[_0x8b13('0x58')]=function(_0x25ab1f,_0x22e7a6){if(_0x25ab1f['body']['id']){delete _0x25ab1f[_0x8b13('0x57')]['id'];}return db[_0x8b13('0x3c')]['find']({'where':{'id':_0x25ab1f[_0x8b13('0x54')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x22e7a6,null))[_0x8b13('0x1d')](saveUpdates(_0x25ab1f[_0x8b13('0x57')],null))[_0x8b13('0x1d')](respondWithResult(_0x22e7a6,null))['catch'](handleError(_0x22e7a6,null));};exports[_0x8b13('0x36')]=function(_0xcd5c10,_0x46850a){return db['ZohoConfiguration'][_0x8b13('0x55')]({'where':{'id':_0xcd5c10[_0x8b13('0x54')]['id']}})['then'](handleEntityNotFound(_0x46850a,null))[_0x8b13('0x1d')](removeEntity(_0x46850a,null))[_0x8b13('0x28')](handleError(_0x46850a,null));};exports[_0x8b13('0x59')]=function(_0xd29067,_0x49e5cd,_0x13c8bd){var _0x28d568={};var _0x52e705={};var _0x33a1ad;var _0x130704;return db[_0x8b13('0x3c')][_0x8b13('0x5a')]({'where':{'id':_0xd29067['params']['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x49e5cd,null))[_0x8b13('0x1d')](function(_0x25a3bd){if(_0x25a3bd){_0x33a1ad=_0x25a3bd;_0x52e705[_0x8b13('0x44')]=_[_0x8b13('0x40')](db[_0x8b13('0x5b')]['rawAttributes']);_0x52e705[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0xd29067[_0x8b13('0x3f')]);_0x52e705['filters']=_[_0x8b13('0x42')](_0x52e705[_0x8b13('0x44')],_0x52e705[_0x8b13('0x3f')]);_0x28d568[_0x8b13('0x43')]=_['intersection'](_0x52e705['model'],qs['fields'](_0xd29067['query']['fields']));_0x28d568[_0x8b13('0x43')]=_0x28d568[_0x8b13('0x43')]['length']?_0x28d568[_0x8b13('0x43')]:_0x52e705['model'];_0x28d568[_0x8b13('0x47')]=qs[_0x8b13('0x5c')](_0xd29067[_0x8b13('0x3f')][_0x8b13('0x5c')]);_0x28d568[_0x8b13('0x48')]=qs[_0x8b13('0x41')](_[_0x8b13('0x49')](_0xd29067['query'],_0x52e705[_0x8b13('0x41')]));if(_0xd29067['query'][_0x8b13('0x4a')]){_0x28d568[_0x8b13('0x48')]=_[_0x8b13('0x4d')](_0x28d568[_0x8b13('0x48')],{'$or':_[_0x8b13('0x3b')](_0x28d568[_0x8b13('0x43')],function(_0x10f1bf){var _0x550ff1={};_0x550ff1[_0x10f1bf]={'$like':'%'+_0xd29067[_0x8b13('0x3f')]['filter']+'%'};return _0x550ff1;})});}_0x28d568=_[_0x8b13('0x4d')]({},_0x28d568,_0xd29067[_0x8b13('0x4e')]);return _0x33a1ad[_0x8b13('0x59')](_0x28d568);}})[_0x8b13('0x1d')](function(_0x177a64){if(_0x177a64){_0x130704=_0x177a64['length'];if(!_0xd29067['query'][_0x8b13('0x5d')](_0x8b13('0x5e'))){_0x28d568['limit']=qs[_0x8b13('0x2e')](_0xd29067[_0x8b13('0x3f')][_0x8b13('0x2e')]);_0x28d568['offset']=qs[_0x8b13('0x2c')](_0xd29067[_0x8b13('0x3f')][_0x8b13('0x2c')]);}return _0x33a1ad[_0x8b13('0x59')](_0x28d568);}})['then'](function(_0x2a6c62){if(_0x2a6c62){return _0x2a6c62?{'count':_0x130704,'rows':_0x2a6c62}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x49e5cd,null))['catch'](handleError(_0x49e5cd,null));};exports[_0x8b13('0x5f')]=function(_0x3bfd74,_0x69e237,_0x3734e7){var _0x45fe23={};var _0x1243f8={};var _0x4334c1;var _0x1bb954;return db[_0x8b13('0x3c')][_0x8b13('0x5a')]({'where':{'id':_0x3bfd74[_0x8b13('0x54')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x69e237,null))[_0x8b13('0x1d')](function(_0x1db235){if(_0x1db235){_0x4334c1=_0x1db235;_0x1243f8['model']=_[_0x8b13('0x40')](db['ZohoField'][_0x8b13('0x3d')]);_0x1243f8[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0x3bfd74[_0x8b13('0x3f')]);_0x1243f8['filters']=_['intersection'](_0x1243f8[_0x8b13('0x44')],_0x1243f8[_0x8b13('0x3f')]);_0x45fe23['attributes']=_[_0x8b13('0x42')](_0x1243f8[_0x8b13('0x44')],qs[_0x8b13('0x45')](_0x3bfd74[_0x8b13('0x3f')][_0x8b13('0x45')]));_0x45fe23[_0x8b13('0x43')]=_0x45fe23[_0x8b13('0x43')][_0x8b13('0x46')]?_0x45fe23[_0x8b13('0x43')]:_0x1243f8[_0x8b13('0x44')];_0x45fe23['order']=qs[_0x8b13('0x5c')](_0x3bfd74[_0x8b13('0x3f')]['sort']);_0x45fe23[_0x8b13('0x48')]=qs[_0x8b13('0x41')](_['pick'](_0x3bfd74[_0x8b13('0x3f')],_0x1243f8[_0x8b13('0x41')]));if(_0x3bfd74[_0x8b13('0x3f')][_0x8b13('0x4a')]){_0x45fe23[_0x8b13('0x48')]=_[_0x8b13('0x4d')](_0x45fe23[_0x8b13('0x48')],{'$or':_[_0x8b13('0x3b')](_0x45fe23['attributes'],function(_0x2642b1){var _0x213b43={};_0x213b43[_0x2642b1]={'$like':'%'+_0x3bfd74[_0x8b13('0x3f')]['filter']+'%'};return _0x213b43;})});}_0x45fe23=_[_0x8b13('0x4d')]({},_0x45fe23,_0x3bfd74['options']);return _0x4334c1[_0x8b13('0x5f')](_0x45fe23);}})[_0x8b13('0x1d')](function(_0x38a1ce){if(_0x38a1ce){_0x1bb954=_0x38a1ce[_0x8b13('0x46')];if(!_0x3bfd74[_0x8b13('0x3f')][_0x8b13('0x5d')](_0x8b13('0x5e'))){_0x45fe23[_0x8b13('0x2e')]=qs[_0x8b13('0x2e')](_0x3bfd74[_0x8b13('0x3f')]['limit']);_0x45fe23[_0x8b13('0x2c')]=qs[_0x8b13('0x2c')](_0x3bfd74[_0x8b13('0x3f')][_0x8b13('0x2c')]);}return _0x4334c1[_0x8b13('0x5f')](_0x45fe23);}})[_0x8b13('0x1d')](function(_0x2c69f5){if(_0x2c69f5){return _0x2c69f5?{'count':_0x1bb954,'rows':_0x2c69f5}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x69e237,null))[_0x8b13('0x28')](handleError(_0x69e237,null));};exports[_0x8b13('0x60')]=function(_0x291962,_0x1819fb,_0x378e33){var _0x4bb71a={};var _0x491bf8={};var _0x3870a9;var _0x512f30;return db[_0x8b13('0x3c')][_0x8b13('0x5a')]({'where':{'id':_0x291962['params']['id']}})['then'](handleEntityNotFound(_0x1819fb,null))[_0x8b13('0x1d')](function(_0x416f9c){if(_0x416f9c){_0x3870a9=_0x416f9c;_0x491bf8[_0x8b13('0x44')]=_[_0x8b13('0x40')](db[_0x8b13('0x5b')]['rawAttributes']);_0x491bf8[_0x8b13('0x3f')]=_['keys'](_0x291962[_0x8b13('0x3f')]);_0x491bf8[_0x8b13('0x41')]=_['intersection'](_0x491bf8[_0x8b13('0x44')],_0x491bf8[_0x8b13('0x3f')]);_0x4bb71a[_0x8b13('0x43')]=_[_0x8b13('0x42')](_0x491bf8[_0x8b13('0x44')],qs['fields'](_0x291962[_0x8b13('0x3f')][_0x8b13('0x45')]));_0x4bb71a[_0x8b13('0x43')]=_0x4bb71a['attributes'][_0x8b13('0x46')]?_0x4bb71a['attributes']:_0x491bf8[_0x8b13('0x44')];_0x4bb71a[_0x8b13('0x47')]=qs[_0x8b13('0x5c')](_0x291962[_0x8b13('0x3f')][_0x8b13('0x5c')]);_0x4bb71a[_0x8b13('0x48')]=qs[_0x8b13('0x41')](_[_0x8b13('0x49')](_0x291962[_0x8b13('0x3f')],_0x491bf8[_0x8b13('0x41')]));if(_0x291962['query'][_0x8b13('0x4a')]){_0x4bb71a[_0x8b13('0x48')]=_[_0x8b13('0x4d')](_0x4bb71a[_0x8b13('0x48')],{'$or':_[_0x8b13('0x3b')](_0x4bb71a['attributes'],function(_0x1a4c09){var _0x45dc31={};_0x45dc31[_0x1a4c09]={'$like':'%'+_0x291962[_0x8b13('0x3f')][_0x8b13('0x4a')]+'%'};return _0x45dc31;})});}_0x4bb71a=_[_0x8b13('0x4d')]({},_0x4bb71a,_0x291962[_0x8b13('0x4e')]);return _0x3870a9['getDescriptions'](_0x4bb71a);}})[_0x8b13('0x1d')](function(_0xd2b08b){if(_0xd2b08b){_0x512f30=_0xd2b08b['length'];if(!_0x291962[_0x8b13('0x3f')]['hasOwnProperty'](_0x8b13('0x5e'))){_0x4bb71a['limit']=qs[_0x8b13('0x2e')](_0x291962[_0x8b13('0x3f')][_0x8b13('0x2e')]);_0x4bb71a[_0x8b13('0x2c')]=qs[_0x8b13('0x2c')](_0x291962[_0x8b13('0x3f')][_0x8b13('0x2c')]);}return _0x3870a9[_0x8b13('0x60')](_0x4bb71a);}})['then'](function(_0x800c3c){if(_0x800c3c){return _0x800c3c?{'count':_0x512f30,'rows':_0x800c3c}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x1819fb,null))['catch'](handleError(_0x1819fb,null));}; \ No newline at end of file +var _0x81bd=['nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','getFields','findOne','ZohoField','map','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x81bd,0x7c));var _0xd81b=function(_0x1e76e8,_0x41ec55){_0x1e76e8=_0x1e76e8-0x0;var _0x2d7a1f=_0x81bd[_0x1e76e8];return _0x2d7a1f;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28782f,_0x51e19c){return function(_0x34634a){if(!_0x34634a){_0x28782f[_0xd81b('0x29')](0x194);}return _0x34634a;};}function handleError(_0xeca9bc,_0xcd9e86){_0xcd9e86=_0xcd9e86||0x1f4;return function(_0x36c69f){logger[_0xd81b('0x25')](_0x36c69f[_0xd81b('0x35')]);if(_0x36c69f[_0xd81b('0x36')]){delete _0x36c69f[_0xd81b('0x36')];}_0xeca9bc[_0xd81b('0x2a')](_0xcd9e86)[_0xd81b('0x37')](_0x36c69f);};}exports[_0xd81b('0x38')]=function(_0x346038,_0x57bc0c){var _0x49deb8={},_0x413bf6={},_0x46119e={'count':0x0,'rows':[]};var _0x401430=_['map'](db[_0xd81b('0x39')][_0xd81b('0x3a')],function(_0x5a236a){return{'name':_0x5a236a[_0xd81b('0x3b')],'type':_0x5a236a[_0xd81b('0x3c')]['key']};});_0x413bf6[_0xd81b('0x3d')]=_['map'](_0x401430,_0xd81b('0x36'));_0x413bf6[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x346038[_0xd81b('0x3e')]);_0x413bf6['filters']=_[_0xd81b('0x40')](_0x413bf6[_0xd81b('0x3d')],_0x413bf6[_0xd81b('0x3e')]);_0x49deb8[_0xd81b('0x41')]=_[_0xd81b('0x40')](_0x413bf6[_0xd81b('0x3d')],qs[_0xd81b('0x42')](_0x346038['query'][_0xd81b('0x42')]));_0x49deb8[_0xd81b('0x41')]=_0x49deb8[_0xd81b('0x41')]['length']?_0x49deb8[_0xd81b('0x41')]:_0x413bf6[_0xd81b('0x3d')];if(!_0x346038[_0xd81b('0x3e')][_0xd81b('0x43')](_0xd81b('0x44'))){_0x49deb8['limit']=qs[_0xd81b('0x2f')](_0x346038[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x49deb8[_0xd81b('0x2d')]=qs[_0xd81b('0x2d')](_0x346038[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x49deb8[_0xd81b('0x45')]=qs[_0xd81b('0x46')](_0x346038[_0xd81b('0x3e')][_0xd81b('0x46')]);_0x49deb8['where']=qs[_0xd81b('0x47')](_[_0xd81b('0x48')](_0x346038[_0xd81b('0x3e')],_0x413bf6[_0xd81b('0x47')]),_0x401430);if(_0x346038[_0xd81b('0x3e')][_0xd81b('0x49')]){_0x49deb8[_0xd81b('0x4a')]=_[_0xd81b('0x4b')](_0x49deb8['where'],{'$or':_['map'](_0x401430,function(_0x36651b){if(_0x36651b[_0xd81b('0x3c')]!==_0xd81b('0x4c')){var _0x222c5e={};_0x222c5e[_0x36651b[_0xd81b('0x36')]]={'$like':'%'+_0x346038[_0xd81b('0x3e')][_0xd81b('0x49')]+'%'};return _0x222c5e;}})});}_0x49deb8=_[_0xd81b('0x4b')]({},_0x49deb8,_0x346038[_0xd81b('0x4d')]);var _0xcfbbc2={'where':_0x49deb8[_0xd81b('0x4a')]};return db[_0xd81b('0x39')]['count'](_0xcfbbc2)[_0xd81b('0x1e')](function(_0x2b61fc){_0x46119e[_0xd81b('0x30')]=_0x2b61fc;if(_0x346038[_0xd81b('0x3e')][_0xd81b('0x4e')]){_0x49deb8[_0xd81b('0x4f')]=[{'all':!![]}];}return db[_0xd81b('0x39')][_0xd81b('0x50')](_0x49deb8);})[_0xd81b('0x1e')](function(_0x53ea36){_0x46119e[_0xd81b('0x51')]=_0x53ea36;return _0x46119e;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x57bc0c,_0x49deb8))[_0xd81b('0x52')](handleError(_0x57bc0c,null));};exports[_0xd81b('0x53')]=function(_0x55326b,_0x43e8fe){var _0x151127={'raw':![],'where':{'id':_0x55326b[_0xd81b('0x54')]['id']}},_0x15030b={};_0x15030b[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](db[_0xd81b('0x39')][_0xd81b('0x3a')]);_0x15030b[_0xd81b('0x3e')]=_['keys'](_0x55326b['query']);_0x15030b[_0xd81b('0x47')]=_[_0xd81b('0x40')](_0x15030b[_0xd81b('0x3d')],_0x15030b[_0xd81b('0x3e')]);_0x151127[_0xd81b('0x41')]=_[_0xd81b('0x40')](_0x15030b[_0xd81b('0x3d')],qs[_0xd81b('0x42')](_0x55326b['query'][_0xd81b('0x42')]));_0x151127[_0xd81b('0x41')]=_0x151127[_0xd81b('0x41')][_0xd81b('0x55')]?_0x151127[_0xd81b('0x41')]:_0x15030b['model'];if(_0x55326b[_0xd81b('0x3e')][_0xd81b('0x4e')]){_0x151127['include']=[{'all':!![]}];}_0x151127=_[_0xd81b('0x4b')]({},_0x151127,_0x55326b[_0xd81b('0x4d')]);return db[_0xd81b('0x39')][_0xd81b('0x56')](_0x151127)[_0xd81b('0x1e')](handleEntityNotFound(_0x43e8fe,null))[_0xd81b('0x1e')](respondWithResult(_0x43e8fe,null))[_0xd81b('0x52')](handleError(_0x43e8fe,null));};exports[_0xd81b('0x57')]=function(_0x3ed626,_0x23bbc5){return db[_0xd81b('0x39')]['create'](_0x3ed626[_0xd81b('0x58')],{})['then'](respondWithResult(_0x23bbc5,0xc9))[_0xd81b('0x52')](handleError(_0x23bbc5,null));};exports[_0xd81b('0x59')]=function(_0x390db6,_0x3c2a9f){if(_0x390db6[_0xd81b('0x58')]['id']){delete _0x390db6[_0xd81b('0x58')]['id'];}return db['ZohoConfiguration'][_0xd81b('0x56')]({'where':{'id':_0x390db6[_0xd81b('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c2a9f,null))['then'](saveUpdates(_0x390db6[_0xd81b('0x58')],null))['then'](respondWithResult(_0x3c2a9f,null))[_0xd81b('0x52')](handleError(_0x3c2a9f,null));};exports['destroy']=function(_0x2914da,_0x315a66){return db[_0xd81b('0x39')]['find']({'where':{'id':_0x2914da[_0xd81b('0x54')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x315a66,null))['then'](removeEntity(_0x315a66,null))[_0xd81b('0x52')](handleError(_0x315a66,null));};exports[_0xd81b('0x5a')]=function(_0x5951ec,_0x1ba5d6,_0x5e1cd7){var _0x3c9264={};var _0x31553e={};var _0x39bdf8;var _0x33fe23;return db[_0xd81b('0x39')][_0xd81b('0x5b')]({'where':{'id':_0x5951ec[_0xd81b('0x54')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x1ba5d6,null))[_0xd81b('0x1e')](function(_0x209102){if(_0x209102){_0x39bdf8=_0x209102;_0x31553e['model']=_[_0xd81b('0x3f')](db[_0xd81b('0x5c')][_0xd81b('0x3a')]);_0x31553e[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x5951ec[_0xd81b('0x3e')]);_0x31553e[_0xd81b('0x47')]=_['intersection'](_0x31553e['model'],_0x31553e['query']);_0x3c9264[_0xd81b('0x41')]=_[_0xd81b('0x40')](_0x31553e[_0xd81b('0x3d')],qs[_0xd81b('0x42')](_0x5951ec[_0xd81b('0x3e')][_0xd81b('0x42')]));_0x3c9264[_0xd81b('0x41')]=_0x3c9264['attributes'][_0xd81b('0x55')]?_0x3c9264[_0xd81b('0x41')]:_0x31553e[_0xd81b('0x3d')];_0x3c9264[_0xd81b('0x45')]=qs[_0xd81b('0x46')](_0x5951ec[_0xd81b('0x3e')][_0xd81b('0x46')]);_0x3c9264['where']=qs[_0xd81b('0x47')](_[_0xd81b('0x48')](_0x5951ec[_0xd81b('0x3e')],_0x31553e[_0xd81b('0x47')]));if(_0x5951ec[_0xd81b('0x3e')][_0xd81b('0x49')]){_0x3c9264[_0xd81b('0x4a')]=_[_0xd81b('0x4b')](_0x3c9264[_0xd81b('0x4a')],{'$or':_[_0xd81b('0x5d')](_0x3c9264[_0xd81b('0x41')],function(_0x43d40d){var _0x5ea906={};_0x5ea906[_0x43d40d]={'$like':'%'+_0x5951ec[_0xd81b('0x3e')]['filter']+'%'};return _0x5ea906;})});}_0x3c9264=_[_0xd81b('0x4b')]({},_0x3c9264,_0x5951ec[_0xd81b('0x4d')]);return _0x39bdf8[_0xd81b('0x5a')](_0x3c9264);}})[_0xd81b('0x1e')](function(_0xb94a69){if(_0xb94a69){_0x33fe23=_0xb94a69[_0xd81b('0x55')];if(!_0x5951ec[_0xd81b('0x3e')][_0xd81b('0x43')](_0xd81b('0x44'))){_0x3c9264[_0xd81b('0x2f')]=qs['limit'](_0x5951ec[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x3c9264[_0xd81b('0x2d')]=qs[_0xd81b('0x2d')](_0x5951ec[_0xd81b('0x3e')]['offset']);}return _0x39bdf8['getFields'](_0x3c9264);}})[_0xd81b('0x1e')](function(_0x1b1ef6){if(_0x1b1ef6){return _0x1b1ef6?{'count':_0x33fe23,'rows':_0x1b1ef6}:null;}})[_0xd81b('0x1e')](respondWithResult(_0x1ba5d6,null))[_0xd81b('0x52')](handleError(_0x1ba5d6,null));};exports[_0xd81b('0x5e')]=function(_0x1a95d5,_0xaee7e3,_0x539132){var _0x2190df={};var _0x41ac46={};var _0x9fd6d;var _0x1c6ec8;return db[_0xd81b('0x39')][_0xd81b('0x5b')]({'where':{'id':_0x1a95d5[_0xd81b('0x54')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0xaee7e3,null))[_0xd81b('0x1e')](function(_0x527384){if(_0x527384){_0x9fd6d=_0x527384;_0x41ac46[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](db[_0xd81b('0x5c')][_0xd81b('0x3a')]);_0x41ac46[_0xd81b('0x3e')]=_['keys'](_0x1a95d5[_0xd81b('0x3e')]);_0x41ac46[_0xd81b('0x47')]=_['intersection'](_0x41ac46[_0xd81b('0x3d')],_0x41ac46[_0xd81b('0x3e')]);_0x2190df['attributes']=_[_0xd81b('0x40')](_0x41ac46[_0xd81b('0x3d')],qs[_0xd81b('0x42')](_0x1a95d5['query'][_0xd81b('0x42')]));_0x2190df[_0xd81b('0x41')]=_0x2190df[_0xd81b('0x41')]['length']?_0x2190df['attributes']:_0x41ac46[_0xd81b('0x3d')];_0x2190df[_0xd81b('0x45')]=qs[_0xd81b('0x46')](_0x1a95d5['query'][_0xd81b('0x46')]);_0x2190df[_0xd81b('0x4a')]=qs[_0xd81b('0x47')](_[_0xd81b('0x48')](_0x1a95d5['query'],_0x41ac46['filters']));if(_0x1a95d5[_0xd81b('0x3e')][_0xd81b('0x49')]){_0x2190df[_0xd81b('0x4a')]=_[_0xd81b('0x4b')](_0x2190df['where'],{'$or':_[_0xd81b('0x5d')](_0x2190df[_0xd81b('0x41')],function(_0x4b8294){var _0x46e36b={};_0x46e36b[_0x4b8294]={'$like':'%'+_0x1a95d5['query'][_0xd81b('0x49')]+'%'};return _0x46e36b;})});}_0x2190df=_[_0xd81b('0x4b')]({},_0x2190df,_0x1a95d5['options']);return _0x9fd6d[_0xd81b('0x5e')](_0x2190df);}})[_0xd81b('0x1e')](function(_0xb96f2f){if(_0xb96f2f){_0x1c6ec8=_0xb96f2f[_0xd81b('0x55')];if(!_0x1a95d5[_0xd81b('0x3e')]['hasOwnProperty'](_0xd81b('0x44'))){_0x2190df[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x1a95d5[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x2190df[_0xd81b('0x2d')]=qs['offset'](_0x1a95d5['query'][_0xd81b('0x2d')]);}return _0x9fd6d[_0xd81b('0x5e')](_0x2190df);}})[_0xd81b('0x1e')](function(_0x15aed5){if(_0x15aed5){return _0x15aed5?{'count':_0x1c6ec8,'rows':_0x15aed5}:null;}})['then'](respondWithResult(_0xaee7e3,null))[_0xd81b('0x52')](handleError(_0xaee7e3,null));};exports[_0xd81b('0x5f')]=function(_0x3ba71c,_0x195f1c,_0xc6454a){var _0x589882={};var _0x3744bf={};var _0x374ac0;var _0x159b28;return db[_0xd81b('0x39')][_0xd81b('0x5b')]({'where':{'id':_0x3ba71c[_0xd81b('0x54')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x195f1c,null))['then'](function(_0x3dc419){if(_0x3dc419){_0x374ac0=_0x3dc419;_0x3744bf[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](db[_0xd81b('0x5c')][_0xd81b('0x3a')]);_0x3744bf[_0xd81b('0x3e')]=_['keys'](_0x3ba71c[_0xd81b('0x3e')]);_0x3744bf['filters']=_[_0xd81b('0x40')](_0x3744bf[_0xd81b('0x3d')],_0x3744bf[_0xd81b('0x3e')]);_0x589882['attributes']=_[_0xd81b('0x40')](_0x3744bf[_0xd81b('0x3d')],qs[_0xd81b('0x42')](_0x3ba71c[_0xd81b('0x3e')][_0xd81b('0x42')]));_0x589882[_0xd81b('0x41')]=_0x589882['attributes'][_0xd81b('0x55')]?_0x589882['attributes']:_0x3744bf['model'];_0x589882[_0xd81b('0x45')]=qs[_0xd81b('0x46')](_0x3ba71c[_0xd81b('0x3e')]['sort']);_0x589882[_0xd81b('0x4a')]=qs[_0xd81b('0x47')](_[_0xd81b('0x48')](_0x3ba71c[_0xd81b('0x3e')],_0x3744bf[_0xd81b('0x47')]));if(_0x3ba71c[_0xd81b('0x3e')]['filter']){_0x589882[_0xd81b('0x4a')]=_[_0xd81b('0x4b')](_0x589882[_0xd81b('0x4a')],{'$or':_[_0xd81b('0x5d')](_0x589882[_0xd81b('0x41')],function(_0x19b09c){var _0x977603={};_0x977603[_0x19b09c]={'$like':'%'+_0x3ba71c[_0xd81b('0x3e')][_0xd81b('0x49')]+'%'};return _0x977603;})});}_0x589882=_[_0xd81b('0x4b')]({},_0x589882,_0x3ba71c[_0xd81b('0x4d')]);return _0x374ac0[_0xd81b('0x5f')](_0x589882);}})[_0xd81b('0x1e')](function(_0x2c19fd){if(_0x2c19fd){_0x159b28=_0x2c19fd[_0xd81b('0x55')];if(!_0x3ba71c['query'][_0xd81b('0x43')]('nolimit')){_0x589882[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x3ba71c[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x589882[_0xd81b('0x2d')]=qs[_0xd81b('0x2d')](_0x3ba71c['query'][_0xd81b('0x2d')]);}return _0x374ac0[_0xd81b('0x5f')](_0x589882);}})[_0xd81b('0x1e')](function(_0x3ebb20){if(_0x3ebb20){return _0x3ebb20?{'count':_0x159b28,'rows':_0x3ebb20}:null;}})[_0xd81b('0x1e')](respondWithResult(_0x195f1c,null))[_0xd81b('0x52')](handleError(_0x195f1c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fd8c3cf..c601679 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 _0xbd82=['../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0x5b7b86,_0x14da00){var _0x3027b4=function(_0x41df2c){while(--_0x41df2c){_0x5b7b86['push'](_0x5b7b86['shift']());}};_0x3027b4(++_0x14da00);}(_0xbd82,0x150));var _0x2bd8=function(_0x24d7b5,_0x3b7b3e){_0x24d7b5=_0x24d7b5-0x0;var _0x2da79e=_0xbd82[_0x24d7b5];return _0x2da79e;};'use strict';var _=require(_0x2bd8('0x0'));var util=require(_0x2bd8('0x1'));var logger=require(_0x2bd8('0x2'))(_0x2bd8('0x3'));var moment=require(_0x2bd8('0x4'));var BPromise=require('bluebird');var rp=require(_0x2bd8('0x5'));var fs=require('fs');var path=require(_0x2bd8('0x6'));var rimraf=require('rimraf');var config=require(_0x2bd8('0x7'));var attributes=require(_0x2bd8('0x8'));module[_0x2bd8('0x9')]=function(_0x45a4f6,_0x2774be){return _0x45a4f6[_0x2bd8('0xa')](_0x2bd8('0xb'),attributes,{'tableName':_0x2bd8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc8=['int_zoho_configurations','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration'];(function(_0x5dedec,_0x259a7c){var _0x180738=function(_0x55de15){while(--_0x55de15){_0x5dedec['push'](_0x5dedec['shift']());}};_0x180738(++_0x259a7c);}(_0xafc8,0x1cd));var _0x8afc=function(_0x54f905,_0x2be168){_0x54f905=_0x54f905-0x0;var _0x25c29c=_0xafc8[_0x54f905];return _0x25c29c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8afc('0x0'))('api');var moment=require(_0x8afc('0x1'));var BPromise=require('bluebird');var rp=require(_0x8afc('0x2'));var fs=require('fs');var path=require(_0x8afc('0x3'));var rimraf=require(_0x8afc('0x4'));var config=require(_0x8afc('0x5'));var attributes=require(_0x8afc('0x6'));module[_0x8afc('0x7')]=function(_0x512544,_0x573065){return _0x512544['define'](_0x8afc('0x8'),attributes,{'tableName':_0x8afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 33298fc..6aabe9e 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 _0xe78c=['message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x42d645,_0x61c13f){var _0x448a1=function(_0x285d12){while(--_0x285d12){_0x42d645['push'](_0x42d645['shift']());}};_0x448a1(++_0x61c13f);}(_0xe78c,0x1d1));var _0xce78=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe78c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xce78('0x0'));var util=require(_0xce78('0x1'));var moment=require('moment');var BPromise=require(_0xce78('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce78('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce78('0x4'));var logger=require(_0xce78('0x5'))(_0xce78('0x6'));var config=require(_0xce78('0x7'));var jayson=require(_0xce78('0x8'));var client=jayson['client'][_0xce78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f185f,_0x539fea,_0x4cc28c){return new BPromise(function(_0x2fe327,_0x4e65df){return client['request'](_0x1f185f,_0x4cc28c)[_0xce78('0xa')](function(_0x3436c1){logger[_0xce78('0xb')](_0xce78('0xc'),_0x539fea,_0xce78('0xd'));logger[_0xce78('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x539fea,'request\x20sent',JSON[_0xce78('0xf')](_0x3436c1));if(_0x3436c1[_0xce78('0x10')]){if(_0x3436c1[_0xce78('0x10')][_0xce78('0x11')]===0x1f4){logger[_0xce78('0x10')](_0xce78('0xc'),_0x539fea,_0x3436c1[_0xce78('0x10')][_0xce78('0x12')]);return _0x4e65df(_0x3436c1[_0xce78('0x10')][_0xce78('0x12')]);}logger[_0xce78('0x10')](_0xce78('0xc'),_0x539fea,_0x3436c1['error'][_0xce78('0x12')]);return _0x2fe327(_0x3436c1[_0xce78('0x10')][_0xce78('0x12')]);}else{logger[_0xce78('0xb')](_0xce78('0xc'),_0x539fea,_0xce78('0xd'));_0x2fe327(_0x3436c1[_0xce78('0x13')][_0xce78('0x12')]);}})[_0xce78('0x14')](function(_0xad7497){logger['error'](_0xce78('0xc'),_0x539fea,_0xad7497);_0x4e65df(_0xad7497);});});} \ No newline at end of file +var _0xc73b=['info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc73b,0x1e7));var _0xbc73=function(_0x58927a,_0x373c03){_0x58927a=_0x58927a-0x0;var _0x25cd1f=_0xc73b[_0x58927a];return _0x25cd1f;};'use strict';var _=require('lodash');var util=require(_0xbc73('0x0'));var moment=require('moment');var BPromise=require(_0xbc73('0x1'));var rs=require(_0xbc73('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc73('0x3'))['db'];var utils=require(_0xbc73('0x4'));var logger=require(_0xbc73('0x5'))(_0xbc73('0x6'));var config=require(_0xbc73('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbc73('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2504c4,_0x2d908c,_0xb72ba3){return new BPromise(function(_0x40fbf4,_0xc610ae){return client[_0xbc73('0x9')](_0x2504c4,_0xb72ba3)[_0xbc73('0xa')](function(_0x2602bb){logger['info'](_0xbc73('0xb'),_0x2d908c,_0xbc73('0xc'));logger[_0xbc73('0xd')](_0xbc73('0xe'),_0x2d908c,_0xbc73('0xc'),JSON[_0xbc73('0xf')](_0x2602bb));if(_0x2602bb['error']){if(_0x2602bb['error'][_0xbc73('0x10')]===0x1f4){logger[_0xbc73('0x11')](_0xbc73('0xb'),_0x2d908c,_0x2602bb['error'][_0xbc73('0x12')]);return _0xc610ae(_0x2602bb[_0xbc73('0x11')]['message']);}logger[_0xbc73('0x11')](_0xbc73('0xb'),_0x2d908c,_0x2602bb[_0xbc73('0x11')][_0xbc73('0x12')]);return _0x40fbf4(_0x2602bb[_0xbc73('0x11')]['message']);}else{logger[_0xbc73('0x13')](_0xbc73('0xb'),_0x2d908c,_0xbc73('0xc'));_0x40fbf4(_0x2602bb[_0xbc73('0x14')][_0xbc73('0x12')]);}})[_0xbc73('0x15')](function(_0x597dfd){logger['error'](_0xbc73('0xb'),_0x2d908c,_0x597dfd);_0xc610ae(_0x597dfd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 4e88d8a..9f8cd33 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 _0x32d5=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x434bf7,_0xaab22d){var _0x355355=function(_0x4f6319){while(--_0x4f6319){_0x434bf7['push'](_0x434bf7['shift']());}};_0x355355(++_0xaab22d);}(_0x32d5,0x1aa));var _0x532d=function(_0x5e0870,_0x357a71){_0x5e0870=_0x5e0870-0x0;var _0x3709a7=_0x32d5[_0x5e0870];return _0x3709a7;};'use strict';var multer=require(_0x532d('0x0'));var util=require(_0x532d('0x1'));var path=require(_0x532d('0x2'));var timeout=require(_0x532d('0x3'));var express=require(_0x532d('0x4'));var router=express[_0x532d('0x5')]();var fs_extra=require(_0x532d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x532d('0x7'));var config=require(_0x532d('0x8'));var controller=require('./intZohoField.controller');router[_0x532d('0x9')]('/',auth[_0x532d('0xa')](),controller[_0x532d('0xb')]);router[_0x532d('0x9')](_0x532d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x532d('0xd')]('/',auth['isAuthenticated'](),controller[_0x532d('0xe')]);router[_0x532d('0xf')](_0x532d('0xc'),auth[_0x532d('0xa')](),controller[_0x532d('0x10')]);router[_0x532d('0x11')](_0x532d('0xc'),auth[_0x532d('0xa')](),controller[_0x532d('0x12')]);module[_0x532d('0x13')]=router; \ No newline at end of file +var _0xbfcc=['Router','fs-extra','get','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x1184b3,_0x2f2893){var _0xc260e0=function(_0x958b02){while(--_0x958b02){_0x1184b3['push'](_0x1184b3['shift']());}};_0xc260e0(++_0x2f2893);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0xbfcc[_0x52b24f];return _0x46ea6b;};'use strict';var multer=require(_0xcbfc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcbfc('0x1'));var express=require(_0xcbfc('0x2'));var router=express[_0xcbfc('0x3')]();var fs_extra=require(_0xcbfc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xcbfc('0x5')]('/',auth[_0xcbfc('0x6')](),controller['index']);router[_0xcbfc('0x5')]('/:id',auth[_0xcbfc('0x6')](),controller[_0xcbfc('0x7')]);router[_0xcbfc('0x8')]('/',auth[_0xcbfc('0x6')](),controller['create']);router[_0xcbfc('0x9')](_0xcbfc('0xa'),auth[_0xcbfc('0x6')](),controller[_0xcbfc('0xb')]);router[_0xcbfc('0xc')](_0xcbfc('0xa'),auth['isAuthenticated'](),controller[_0xcbfc('0xd')]);module[_0xcbfc('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e8d4bb0..77a386a 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 _0x7341=['ENUM','variable','customVariable','picklist','string','STRING'];(function(_0x298d18,_0x2364a1){var _0x3ecf4a=function(_0x30eb9f){while(--_0x30eb9f){_0x298d18['push'](_0x298d18['shift']());}};_0x3ecf4a(++_0x2364a1);}(_0x7341,0xe4));var _0x1734=function(_0x5594a0,_0x2fbdc6){_0x5594a0=_0x5594a0-0x0;var _0x115e70=_0x7341[_0x5594a0];return _0x115e70;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1734('0x0')]('string',_0x1734('0x1'),_0x1734('0x2'),'keyValue',_0x1734('0x3')),'defaultValue':_0x1734('0x4')},'content':{'type':Sequelize[_0x1734('0x5')]},'key':{'type':Sequelize[_0x1734('0x5')]},'keyType':{'type':Sequelize[_0x1734('0x0')](_0x1734('0x4'),_0x1734('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x1734('0x5')]},'idField':{'type':Sequelize[_0x1734('0x5')]},'nameField':{'type':Sequelize[_0x1734('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1734('0x5')]}}; \ No newline at end of file +var _0x9b67=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x21ad07,_0x4ffe2b){var _0x3ebce8=function(_0x3ebfcb){while(--_0x3ebfcb){_0x21ad07['push'](_0x21ad07['shift']());}};_0x3ebce8(++_0x4ffe2b);}(_0x9b67,0xf6));var _0x79b6=function(_0x4feaf1,_0x153706){_0x4feaf1=_0x4feaf1-0x0;var _0x15b884=_0x9b67[_0x4feaf1];return _0x15b884;};'use strict';var Sequelize=require(_0x79b6('0x0'));module[_0x79b6('0x1')]={'type':{'type':Sequelize[_0x79b6('0x2')](_0x79b6('0x3'),_0x79b6('0x4'),'customVariable',_0x79b6('0x5'),_0x79b6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x79b6('0x7')]},'keyType':{'type':Sequelize[_0x79b6('0x2')](_0x79b6('0x3'),_0x79b6('0x4'),_0x79b6('0x8'))},'keyContent':{'type':Sequelize[_0x79b6('0x7')]},'idField':{'type':Sequelize[_0x79b6('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x79b6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x79b6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b8bc145..a3547d7 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 _0x959b=['VIRTUAL','filter','options','ZohoField','include','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x590b71,_0xf2162b){var _0x4bbc59=function(_0x34fe71){while(--_0x34fe71){_0x590b71['push'](_0x590b71['shift']());}};_0x4bbc59(++_0xf2162b);}(_0x959b,0x1ca));var _0xb959=function(_0x8284ac,_0x47ae5f){_0x8284ac=_0x8284ac-0x0;var _0x4f0524=_0x959b[_0x8284ac];return _0x4f0524;};'use strict';var emlformat=require(_0xb959('0x0'));var rimraf=require(_0xb959('0x1'));var zipdir=require(_0xb959('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb959('0x3'));var moment=require(_0xb959('0x4'));var BPromise=require(_0xb959('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb959('0x6'));var csv=require(_0xb959('0x7'));var ejs=require(_0xb959('0x8'));var fs=require('fs');var fs_extra=require(_0xb959('0x9'));var _=require(_0xb959('0xa'));var squel=require(_0xb959('0xb'));var crypto=require(_0xb959('0xc'));var jsforce=require(_0xb959('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb959('0x7'));var querystring=require(_0xb959('0xe'));var Papa=require('papaparse');var Redis=require(_0xb959('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb959('0x10'));var as=require(_0xb959('0x11'));var hardwareService=require(_0xb959('0x12'));var logger=require(_0xb959('0x13'))(_0xb959('0x14'));var utils=require('../../config/utils');var config=require(_0xb959('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb959('0x16'))['db'];function respondWithStatusCode(_0x540e34,_0x31522e){_0x31522e=_0x31522e||0xcc;return function(_0x2ab872){if(_0x2ab872){return _0x540e34['sendStatus'](_0x31522e);}return _0x540e34['status'](_0x31522e)[_0xb959('0x17')]();};}function respondWithResult(_0x12dd0c,_0x16446f){_0x16446f=_0x16446f||0xc8;return function(_0x136d0f){if(_0x136d0f){return _0x12dd0c[_0xb959('0x18')](_0x16446f)[_0xb959('0x19')](_0x136d0f);}};}function respondWithFilteredResult(_0x2ecbcf,_0x1a1972){return function(_0x3b2c7a){if(_0x3b2c7a){var _0x51a188=typeof _0x1a1972['offset']===_0xb959('0x1a')&&typeof _0x1a1972[_0xb959('0x1b')]===_0xb959('0x1a');var _0x4f2f5a=_0x3b2c7a[_0xb959('0x1c')];var _0x5ecd4d=_0x51a188?0x0:_0x1a1972[_0xb959('0x1d')];var _0x5ea437=_0x51a188?_0x3b2c7a['count']:_0x1a1972[_0xb959('0x1d')]+_0x1a1972[_0xb959('0x1b')];var _0x4e855b;if(_0x5ea437>=_0x4f2f5a){_0x5ea437=_0x4f2f5a;_0x4e855b=0xc8;}else{_0x4e855b=0xce;}_0x2ecbcf[_0xb959('0x18')](_0x4e855b);return _0x2ecbcf[_0xb959('0x1e')](_0xb959('0x1f'),_0x5ecd4d+'-'+_0x5ea437+'/'+_0x4f2f5a)[_0xb959('0x19')](_0x3b2c7a);}return null;};}function patchUpdates(_0xa6d6b9){return function(_0x5ca952){try{jsonpatch[_0xb959('0x20')](_0x5ca952,_0xa6d6b9,!![]);}catch(_0x57754a){return BPromise['reject'](_0x57754a);}return _0x5ca952[_0xb959('0x21')]();};}function saveUpdates(_0x566dde,_0x959148){return function(_0x2a1e21){if(_0x2a1e21){return _0x2a1e21[_0xb959('0x22')](_0x566dde)['then'](function(_0x2e7fa8){return _0x2e7fa8;});}return null;};}function removeEntity(_0x4783d7,_0x4f3b18){return function(_0x26f6a1){if(_0x26f6a1){return _0x26f6a1[_0xb959('0x23')]()[_0xb959('0x24')](function(){_0x4783d7['status'](0xcc)[_0xb959('0x17')]();});}};}function handleEntityNotFound(_0x466604,_0x459d1a){return function(_0x1d1e24){if(!_0x1d1e24){_0x466604[_0xb959('0x25')](0x194);}return _0x1d1e24;};}function handleError(_0x226ca0,_0x44ac3f){_0x44ac3f=_0x44ac3f||0x1f4;return function(_0x356382){logger['error'](_0x356382[_0xb959('0x26')]);if(_0x356382[_0xb959('0x27')]){delete _0x356382['name'];}_0x226ca0[_0xb959('0x18')](_0x44ac3f)[_0xb959('0x28')](_0x356382);};}exports[_0xb959('0x29')]=function(_0x33f28a,_0x40bd32){var _0x3342f4={},_0x1cf179={},_0x4d3d77={'count':0x0,'rows':[]};var _0x171d4c=_[_0xb959('0x2a')](db['ZohoField'][_0xb959('0x2b')],function(_0x3f1aef){return{'name':_0x3f1aef[_0xb959('0x2c')],'type':_0x3f1aef[_0xb959('0x2d')][_0xb959('0x2e')]};});_0x1cf179[_0xb959('0x2f')]=_[_0xb959('0x2a')](_0x171d4c,_0xb959('0x27'));_0x1cf179[_0xb959('0x30')]=_[_0xb959('0x31')](_0x33f28a['query']);_0x1cf179[_0xb959('0x32')]=_[_0xb959('0x33')](_0x1cf179['model'],_0x1cf179[_0xb959('0x30')]);_0x3342f4[_0xb959('0x34')]=_[_0xb959('0x33')](_0x1cf179[_0xb959('0x2f')],qs['fields'](_0x33f28a[_0xb959('0x30')]['fields']));_0x3342f4[_0xb959('0x34')]=_0x3342f4[_0xb959('0x34')][_0xb959('0x35')]?_0x3342f4[_0xb959('0x34')]:_0x1cf179[_0xb959('0x2f')];if(!_0x33f28a['query'][_0xb959('0x36')](_0xb959('0x37'))){_0x3342f4[_0xb959('0x1b')]=qs['limit'](_0x33f28a[_0xb959('0x30')][_0xb959('0x1b')]);_0x3342f4[_0xb959('0x1d')]=qs[_0xb959('0x1d')](_0x33f28a[_0xb959('0x30')]['offset']);}_0x3342f4['order']=qs[_0xb959('0x38')](_0x33f28a['query']['sort']);_0x3342f4[_0xb959('0x39')]=qs[_0xb959('0x32')](_[_0xb959('0x3a')](_0x33f28a[_0xb959('0x30')],_0x1cf179[_0xb959('0x32')]),_0x171d4c);if(_0x33f28a[_0xb959('0x30')]['filter']){_0x3342f4[_0xb959('0x39')]=_[_0xb959('0x3b')](_0x3342f4[_0xb959('0x39')],{'$or':_['map'](_0x171d4c,function(_0x2b542a){if(_0x2b542a['type']!==_0xb959('0x3c')){var _0x1419c3={};_0x1419c3[_0x2b542a[_0xb959('0x27')]]={'$like':'%'+_0x33f28a[_0xb959('0x30')][_0xb959('0x3d')]+'%'};return _0x1419c3;}})});}_0x3342f4=_[_0xb959('0x3b')]({},_0x3342f4,_0x33f28a[_0xb959('0x3e')]);var _0x16818a={'where':_0x3342f4['where']};return db[_0xb959('0x3f')][_0xb959('0x1c')](_0x16818a)[_0xb959('0x24')](function(_0x46559d){_0x4d3d77[_0xb959('0x1c')]=_0x46559d;if(_0x33f28a[_0xb959('0x30')]['includeAll']){_0x3342f4[_0xb959('0x40')]=[{'all':!![]}];}return db['ZohoField'][_0xb959('0x41')](_0x3342f4);})[_0xb959('0x24')](function(_0x4515b9){_0x4d3d77[_0xb959('0x42')]=_0x4515b9;return _0x4d3d77;})[_0xb959('0x24')](respondWithFilteredResult(_0x40bd32,_0x3342f4))[_0xb959('0x43')](handleError(_0x40bd32,null));};exports[_0xb959('0x44')]=function(_0x36533d,_0x2073be){var _0x476750={'raw':!![],'where':{'id':_0x36533d[_0xb959('0x45')]['id']}},_0x3d2053={};_0x3d2053['model']=_[_0xb959('0x31')](db['ZohoField'][_0xb959('0x2b')]);_0x3d2053['query']=_['keys'](_0x36533d[_0xb959('0x30')]);_0x3d2053[_0xb959('0x32')]=_[_0xb959('0x33')](_0x3d2053[_0xb959('0x2f')],_0x3d2053[_0xb959('0x30')]);_0x476750[_0xb959('0x34')]=_['intersection'](_0x3d2053[_0xb959('0x2f')],qs[_0xb959('0x46')](_0x36533d['query'][_0xb959('0x46')]));_0x476750[_0xb959('0x34')]=_0x476750[_0xb959('0x34')]['length']?_0x476750['attributes']:_0x3d2053[_0xb959('0x2f')];if(_0x36533d[_0xb959('0x30')]['includeAll']){_0x476750[_0xb959('0x40')]=[{'all':!![]}];}_0x476750=_[_0xb959('0x3b')]({},_0x476750,_0x36533d[_0xb959('0x3e')]);return db[_0xb959('0x3f')][_0xb959('0x47')](_0x476750)[_0xb959('0x24')](handleEntityNotFound(_0x2073be,null))[_0xb959('0x24')](respondWithResult(_0x2073be,null))[_0xb959('0x43')](handleError(_0x2073be,null));};exports[_0xb959('0x48')]=function(_0x273aab,_0x411d44){return db['ZohoField'][_0xb959('0x48')](_0x273aab[_0xb959('0x49')],{})['then'](respondWithResult(_0x411d44,0xc9))[_0xb959('0x43')](handleError(_0x411d44,null));};exports[_0xb959('0x22')]=function(_0x13cc3a,_0x295e3c){if(_0x13cc3a[_0xb959('0x49')]['id']){delete _0x13cc3a[_0xb959('0x49')]['id'];}return db[_0xb959('0x3f')][_0xb959('0x47')]({'where':{'id':_0x13cc3a[_0xb959('0x45')]['id']}})[_0xb959('0x24')](handleEntityNotFound(_0x295e3c,null))['then'](saveUpdates(_0x13cc3a[_0xb959('0x49')],null))[_0xb959('0x24')](respondWithResult(_0x295e3c,null))[_0xb959('0x43')](handleError(_0x295e3c,null));};exports[_0xb959('0x23')]=function(_0xda7fc2,_0x2c1204){return db['ZohoField'][_0xb959('0x47')]({'where':{'id':_0xda7fc2[_0xb959('0x45')]['id']}})[_0xb959('0x24')](handleEntityNotFound(_0x2c1204,null))[_0xb959('0x24')](removeEntity(_0x2c1204,null))[_0xb959('0x43')](handleError(_0x2c1204,null));}; \ No newline at end of file +var _0x3d52=['destroy','sendStatus','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d52,0x15b));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x23d5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x23d5('0x1'));var jsonpatch=require(_0x23d5('0x2'));var rp=require(_0x23d5('0x3'));var moment=require(_0x23d5('0x4'));var BPromise=require(_0x23d5('0x5'));var Mustache=require(_0x23d5('0x6'));var util=require(_0x23d5('0x7'));var path=require(_0x23d5('0x8'));var sox=require(_0x23d5('0x9'));var csv=require(_0x23d5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23d5('0xb'));var _=require(_0x23d5('0xc'));var squel=require(_0x23d5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23d5('0xe'));var toCsv=require(_0x23d5('0xa'));var querystring=require(_0x23d5('0xf'));var Papa=require('papaparse');var Redis=require(_0x23d5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x23d5('0x11'));var as=require(_0x23d5('0x12'));var hardwareService=require(_0x23d5('0x13'));var logger=require(_0x23d5('0x14'))(_0x23d5('0x15'));var utils=require(_0x23d5('0x16'));var config=require(_0x23d5('0x17'));var licenseUtil=require(_0x23d5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321535,_0x4bf5df){_0x4bf5df=_0x4bf5df||0xcc;return function(_0x7b9509){if(_0x7b9509){return _0x321535['sendStatus'](_0x4bf5df);}return _0x321535[_0x23d5('0x19')](_0x4bf5df)[_0x23d5('0x1a')]();};}function respondWithResult(_0x1e5325,_0xa4a56e){_0xa4a56e=_0xa4a56e||0xc8;return function(_0x5f1fa0){if(_0x5f1fa0){return _0x1e5325[_0x23d5('0x19')](_0xa4a56e)[_0x23d5('0x1b')](_0x5f1fa0);}};}function respondWithFilteredResult(_0x54eec1,_0x47c9ad){return function(_0x233538){if(_0x233538){var _0x452681=typeof _0x47c9ad[_0x23d5('0x1c')]===_0x23d5('0x1d')&&typeof _0x47c9ad[_0x23d5('0x1e')]==='undefined';var _0x466ad3=_0x233538[_0x23d5('0x1f')];var _0x44d9d2=_0x452681?0x0:_0x47c9ad[_0x23d5('0x1c')];var _0xca4949=_0x452681?_0x233538[_0x23d5('0x1f')]:_0x47c9ad['offset']+_0x47c9ad[_0x23d5('0x1e')];var _0x70ab8f;if(_0xca4949>=_0x466ad3){_0xca4949=_0x466ad3;_0x70ab8f=0xc8;}else{_0x70ab8f=0xce;}_0x54eec1['status'](_0x70ab8f);return _0x54eec1[_0x23d5('0x20')](_0x23d5('0x21'),_0x44d9d2+'-'+_0xca4949+'/'+_0x466ad3)[_0x23d5('0x1b')](_0x233538);}return null;};}function patchUpdates(_0x2acc3b){return function(_0x216b72){try{jsonpatch[_0x23d5('0x22')](_0x216b72,_0x2acc3b,!![]);}catch(_0x5d6d38){return BPromise[_0x23d5('0x23')](_0x5d6d38);}return _0x216b72[_0x23d5('0x24')]();};}function saveUpdates(_0x508959,_0x340578){return function(_0x1dff48){if(_0x1dff48){return _0x1dff48['update'](_0x508959)[_0x23d5('0x25')](function(_0x22400c){return _0x22400c;});}return null;};}function removeEntity(_0x3628c6,_0x2ee575){return function(_0x530474){if(_0x530474){return _0x530474[_0x23d5('0x26')]()['then'](function(){_0x3628c6[_0x23d5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f50a3,_0x2b7b3c){return function(_0x22c1d7){if(!_0x22c1d7){_0x2f50a3[_0x23d5('0x27')](0x194);}return _0x22c1d7;};}function handleError(_0x521436,_0x5a20de){_0x5a20de=_0x5a20de||0x1f4;return function(_0x5425fe){logger[_0x23d5('0x28')](_0x5425fe['stack']);if(_0x5425fe[_0x23d5('0x29')]){delete _0x5425fe['name'];}_0x521436[_0x23d5('0x19')](_0x5a20de)[_0x23d5('0x2a')](_0x5425fe);};}exports[_0x23d5('0x2b')]=function(_0x4b257c,_0x57c4a7){var _0x4ff03a={},_0x55ffa8={},_0x4ac9d4={'count':0x0,'rows':[]};var _0x2f0c74=_[_0x23d5('0x2c')](db[_0x23d5('0x2d')][_0x23d5('0x2e')],function(_0x5d2287){return{'name':_0x5d2287[_0x23d5('0x2f')],'type':_0x5d2287[_0x23d5('0x30')][_0x23d5('0x31')]};});_0x55ffa8[_0x23d5('0x32')]=_['map'](_0x2f0c74,_0x23d5('0x29'));_0x55ffa8[_0x23d5('0x33')]=_[_0x23d5('0x34')](_0x4b257c[_0x23d5('0x33')]);_0x55ffa8[_0x23d5('0x35')]=_[_0x23d5('0x36')](_0x55ffa8[_0x23d5('0x32')],_0x55ffa8[_0x23d5('0x33')]);_0x4ff03a[_0x23d5('0x37')]=_[_0x23d5('0x36')](_0x55ffa8[_0x23d5('0x32')],qs[_0x23d5('0x38')](_0x4b257c[_0x23d5('0x33')]['fields']));_0x4ff03a['attributes']=_0x4ff03a[_0x23d5('0x37')][_0x23d5('0x39')]?_0x4ff03a[_0x23d5('0x37')]:_0x55ffa8[_0x23d5('0x32')];if(!_0x4b257c['query']['hasOwnProperty'](_0x23d5('0x3a'))){_0x4ff03a[_0x23d5('0x1e')]=qs[_0x23d5('0x1e')](_0x4b257c[_0x23d5('0x33')][_0x23d5('0x1e')]);_0x4ff03a['offset']=qs['offset'](_0x4b257c['query'][_0x23d5('0x1c')]);}_0x4ff03a['order']=qs['sort'](_0x4b257c[_0x23d5('0x33')][_0x23d5('0x3b')]);_0x4ff03a[_0x23d5('0x3c')]=qs[_0x23d5('0x35')](_[_0x23d5('0x3d')](_0x4b257c['query'],_0x55ffa8[_0x23d5('0x35')]),_0x2f0c74);if(_0x4b257c[_0x23d5('0x33')][_0x23d5('0x3e')]){_0x4ff03a[_0x23d5('0x3c')]=_['merge'](_0x4ff03a['where'],{'$or':_[_0x23d5('0x2c')](_0x2f0c74,function(_0x4781a1){if(_0x4781a1['type']!==_0x23d5('0x3f')){var _0x4a1797={};_0x4a1797[_0x4781a1[_0x23d5('0x29')]]={'$like':'%'+_0x4b257c['query']['filter']+'%'};return _0x4a1797;}})});}_0x4ff03a=_[_0x23d5('0x40')]({},_0x4ff03a,_0x4b257c[_0x23d5('0x41')]);var _0x465168={'where':_0x4ff03a[_0x23d5('0x3c')]};return db[_0x23d5('0x2d')][_0x23d5('0x1f')](_0x465168)[_0x23d5('0x25')](function(_0x3558bf){_0x4ac9d4[_0x23d5('0x1f')]=_0x3558bf;if(_0x4b257c['query'][_0x23d5('0x42')]){_0x4ff03a[_0x23d5('0x43')]=[{'all':!![]}];}return db['ZohoField'][_0x23d5('0x44')](_0x4ff03a);})[_0x23d5('0x25')](function(_0x88fbe1){_0x4ac9d4[_0x23d5('0x45')]=_0x88fbe1;return _0x4ac9d4;})[_0x23d5('0x25')](respondWithFilteredResult(_0x57c4a7,_0x4ff03a))[_0x23d5('0x46')](handleError(_0x57c4a7,null));};exports[_0x23d5('0x47')]=function(_0x62efba,_0x10b4db){var _0x4bfc59={'raw':!![],'where':{'id':_0x62efba['params']['id']}},_0x17ac02={};_0x17ac02[_0x23d5('0x32')]=_[_0x23d5('0x34')](db[_0x23d5('0x2d')]['rawAttributes']);_0x17ac02[_0x23d5('0x33')]=_['keys'](_0x62efba[_0x23d5('0x33')]);_0x17ac02['filters']=_['intersection'](_0x17ac02[_0x23d5('0x32')],_0x17ac02[_0x23d5('0x33')]);_0x4bfc59['attributes']=_['intersection'](_0x17ac02['model'],qs['fields'](_0x62efba['query'][_0x23d5('0x38')]));_0x4bfc59[_0x23d5('0x37')]=_0x4bfc59[_0x23d5('0x37')][_0x23d5('0x39')]?_0x4bfc59['attributes']:_0x17ac02['model'];if(_0x62efba[_0x23d5('0x33')][_0x23d5('0x42')]){_0x4bfc59[_0x23d5('0x43')]=[{'all':!![]}];}_0x4bfc59=_[_0x23d5('0x40')]({},_0x4bfc59,_0x62efba[_0x23d5('0x41')]);return db[_0x23d5('0x2d')][_0x23d5('0x48')](_0x4bfc59)[_0x23d5('0x25')](handleEntityNotFound(_0x10b4db,null))[_0x23d5('0x25')](respondWithResult(_0x10b4db,null))[_0x23d5('0x46')](handleError(_0x10b4db,null));};exports[_0x23d5('0x49')]=function(_0x53fda4,_0x68adfb){return db['ZohoField'][_0x23d5('0x49')](_0x53fda4['body'],{})['then'](respondWithResult(_0x68adfb,0xc9))[_0x23d5('0x46')](handleError(_0x68adfb,null));};exports[_0x23d5('0x4a')]=function(_0x12ad77,_0x2f6de5){if(_0x12ad77[_0x23d5('0x4b')]['id']){delete _0x12ad77[_0x23d5('0x4b')]['id'];}return db[_0x23d5('0x2d')][_0x23d5('0x48')]({'where':{'id':_0x12ad77['params']['id']}})[_0x23d5('0x25')](handleEntityNotFound(_0x2f6de5,null))[_0x23d5('0x25')](saveUpdates(_0x12ad77['body'],null))[_0x23d5('0x25')](respondWithResult(_0x2f6de5,null))[_0x23d5('0x46')](handleError(_0x2f6de5,null));};exports[_0x23d5('0x26')]=function(_0x58e8c5,_0x2588e4){return db[_0x23d5('0x2d')][_0x23d5('0x48')]({'where':{'id':_0x58e8c5[_0x23d5('0x4c')]['id']}})[_0x23d5('0x25')](handleEntityNotFound(_0x2588e4,null))['then'](removeEntity(_0x2588e4,null))['catch'](handleError(_0x2588e4,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 05d4d41..b0574ee 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 _0x7ba6=['define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZohoField.attributes'];(function(_0x58ee96,_0x5affd5){var _0xb346aa=function(_0x245b1a){while(--_0x245b1a){_0x58ee96['push'](_0x58ee96['shift']());}};_0xb346aa(++_0x5affd5);}(_0x7ba6,0x115));var _0x67ba=function(_0x3ff725,_0xe1c308){_0x3ff725=_0x3ff725-0x0;var _0x529c19=_0x7ba6[_0x3ff725];return _0x529c19;};'use strict';var _=require(_0x67ba('0x0'));var util=require(_0x67ba('0x1'));var logger=require(_0x67ba('0x2'))(_0x67ba('0x3'));var moment=require('moment');var BPromise=require(_0x67ba('0x4'));var rp=require(_0x67ba('0x5'));var fs=require('fs');var path=require(_0x67ba('0x6'));var rimraf=require(_0x67ba('0x7'));var config=require('../../config/environment');var attributes=require(_0x67ba('0x8'));module['exports']=function(_0x4aa69f,_0x5d7feb){return _0x4aa69f[_0x67ba('0x9')](_0x67ba('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x67ba('0xb'),'fields':[_0x67ba('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x155c=['request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','api','moment','bluebird'];(function(_0x27b758,_0x521c93){var _0x5ed825=function(_0x3a1428){while(--_0x3a1428){_0x27b758['push'](_0x27b758['shift']());}};_0x5ed825(++_0x521c93);}(_0x155c,0x13d));var _0xc155=function(_0x388236,_0x23f8a1){_0x388236=_0x388236-0x0;var _0x41e277=_0x155c[_0x388236];return _0x41e277;};'use strict';var _=require(_0xc155('0x0'));var util=require(_0xc155('0x1'));var logger=require('../../config/logger')(_0xc155('0x2'));var moment=require(_0xc155('0x3'));var BPromise=require(_0xc155('0x4'));var rp=require(_0xc155('0x5'));var fs=require('fs');var path=require(_0xc155('0x6'));var rimraf=require('rimraf');var config=require(_0xc155('0x7'));var attributes=require(_0xc155('0x8'));module[_0xc155('0x9')]=function(_0x279247,_0x3939bc){return _0x279247['define'](_0xc155('0xa'),attributes,{'tableName':_0xc155('0xb'),'paranoid':![],'indexes':[{'name':_0xc155('0xc'),'fields':[_0xc155('0xd'),'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 3807180..00265d2 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 _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x6ae9e6,_0x23ac45){var _0x4c2511=function(_0x3729f2){while(--_0x3729f2){_0x6ae9e6['push'](_0x6ae9e6['shift']());}};_0x4c2511(++_0x23ac45);}(_0x032e,0x124));var _0xe032=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x032e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('ZohoField,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('ZohoField,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5636,0x102));var _0x6563=function(_0x53646a,_0x11b1a0){_0x53646a=_0x53646a-0x0;var _0x25001a=_0x5636[_0x53646a];return _0x25001a;};'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 3183ff3..1e8b032 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 _0xc584=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x329f42,_0x2de7e7){var _0x3618f0=function(_0xf18f87){while(--_0xf18f87){_0x329f42['push'](_0x329f42['shift']());}};_0x3618f0(++_0x2de7e7);}(_0xc584,0xa8));var _0x4c58=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0xc584[_0x4cf8d4];return _0x2c1beb;};'use strict';var multer=require('multer');var util=require(_0x4c58('0x0'));var path=require(_0x4c58('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c58('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4c58('0x3'));var interaction=require(_0x4c58('0x4'));var config=require(_0x4c58('0x5'));module['exports']=router; \ No newline at end of file +var _0x94df=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x94df,0xa3));var _0xf94d=function(_0xb92e85,_0x4a7235){_0xb92e85=_0xb92e85-0x0;var _0x1b4302=_0x94df[_0xb92e85];return _0x1b4302;};'use strict';var multer=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var path=require(_0xf94d('0x2'));var timeout=require(_0xf94d('0x3'));var express=require(_0xf94d('0x4'));var router=express[_0xf94d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf94d('0x6'));var interaction=require(_0xf94d('0x7'));var config=require(_0xf94d('0x8'));module[_0xf94d('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8afb56e..61c098b 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 _0x98dc=['state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x98dc,0x171));var _0xc98d=function(_0x149ea5,_0x181c89){_0x149ea5=_0x149ea5-0x0;var _0x4aa47c=_0x98dc[_0x149ea5];return _0x4aa47c;};'use strict';var Sequelize=require(_0xc98d('0x0'));module[_0xc98d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc98d('0x2')},'version':{'type':Sequelize[_0xc98d('0x3')],'allowNull':![],'unique':_0xc98d('0x2')},'main':{'type':Sequelize[_0xc98d('0x3')],'defaultValue':_0xc98d('0x4')},'filename':{'type':Sequelize[_0xc98d('0x3')]},'path':{'type':Sequelize[_0xc98d('0x3')]},'type':{'type':Sequelize[_0xc98d('0x3')]},'size':{'type':Sequelize[_0xc98d('0x5')]},'active':{'type':Sequelize[_0xc98d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xc98d('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xc98d('0x3')],'unique':_0xc98d('0x7')},'description':{'type':Sequelize[_0xc98d('0x3')]},'title':{'type':Sequelize[_0xc98d('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xc98d('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x3ed9=['unique_name_and_version','app.js','BOOLEAN','exports','STRING'];(function(_0x5e2ac7,_0x45265d){var _0x4fb946=function(_0x388b38){while(--_0x388b38){_0x5e2ac7['push'](_0x5e2ac7['shift']());}};_0x4fb946(++_0x45265d);}(_0x3ed9,0x198));var _0x93ed=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0x3ed9[_0x3e7e96];return _0x13f6f0;};'use strict';var Sequelize=require('sequelize');module[_0x93ed('0x0')]={'name':{'type':Sequelize[_0x93ed('0x1')],'allowNull':![],'unique':_0x93ed('0x2')},'version':{'type':Sequelize[_0x93ed('0x1')],'allowNull':![],'unique':_0x93ed('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x93ed('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x93ed('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x93ed('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x93ed('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x93ed('0x1')]},'title':{'type':Sequelize[_0x93ed('0x1')]},'remoteUri':{'type':Sequelize[_0x93ed('0x1')]},'link':{'type':Sequelize[_0x93ed('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index bab32ca..bf898dc 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 _0xc4e5=['fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','attributes'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xc4e5,0x1c5));var _0x5c4e=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xc4e5[_0x18d631];return _0x50d708;};'use strict';var emlformat=require(_0x5c4e('0x0'));var rimraf=require(_0x5c4e('0x1'));var zipdir=require(_0x5c4e('0x2'));var jsonpatch=require(_0x5c4e('0x3'));var rp=require(_0x5c4e('0x4'));var moment=require('moment');var BPromise=require(_0x5c4e('0x5'));var Mustache=require(_0x5c4e('0x6'));var util=require('util');var path=require(_0x5c4e('0x7'));var sox=require(_0x5c4e('0x8'));var csv=require(_0x5c4e('0x9'));var ejs=require(_0x5c4e('0xa'));var fs=require('fs');var fs_extra=require(_0x5c4e('0xb'));var _=require('lodash');var squel=require(_0x5c4e('0xc'));var crypto=require(_0x5c4e('0xd'));var jsforce=require(_0x5c4e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5c4e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5c4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c4e('0x10'))(_0x5c4e('0x11'));var utils=require(_0x5c4e('0x12'));var config=require(_0x5c4e('0x13'));var licenseUtil=require(_0x5c4e('0x14'));var db=require(_0x5c4e('0x15'))['db'];function respondWithStatusCode(_0x25b51a,_0x2c7a2a){_0x2c7a2a=_0x2c7a2a||0xcc;return function(_0x41a78c){if(_0x41a78c){return _0x25b51a[_0x5c4e('0x16')](_0x2c7a2a);}return _0x25b51a[_0x5c4e('0x17')](_0x2c7a2a)['end']();};}function respondWithResult(_0x551851,_0x598ae5){_0x598ae5=_0x598ae5||0xc8;return function(_0x384984){if(_0x384984){return _0x551851['status'](_0x598ae5)['json'](_0x384984);}};}function respondWithFilteredResult(_0x3e069f,_0x29c991){return function(_0x7de481){if(_0x7de481){var _0xb7c851=typeof _0x29c991[_0x5c4e('0x18')]===_0x5c4e('0x19')&&typeof _0x29c991['limit']===_0x5c4e('0x19');var _0x1b039c=_0x7de481[_0x5c4e('0x1a')];var _0x2962c7=_0xb7c851?0x0:_0x29c991[_0x5c4e('0x18')];var _0x64f2f=_0xb7c851?_0x7de481['count']:_0x29c991['offset']+_0x29c991[_0x5c4e('0x1b')];var _0x15b9a0;if(_0x64f2f>=_0x1b039c){_0x64f2f=_0x1b039c;_0x15b9a0=0xc8;}else{_0x15b9a0=0xce;}_0x3e069f['status'](_0x15b9a0);return _0x3e069f[_0x5c4e('0x1c')](_0x5c4e('0x1d'),_0x2962c7+'-'+_0x64f2f+'/'+_0x1b039c)['json'](_0x7de481);}return null;};}function patchUpdates(_0x3f7e0e){return function(_0x21ca7b){try{jsonpatch[_0x5c4e('0x1e')](_0x21ca7b,_0x3f7e0e,!![]);}catch(_0x42f309){return BPromise[_0x5c4e('0x1f')](_0x42f309);}return _0x21ca7b[_0x5c4e('0x20')]();};}function saveUpdates(_0x281847,_0x15bacb){return function(_0x5cbdfa){if(_0x5cbdfa){return _0x5cbdfa[_0x5c4e('0x21')](_0x281847)[_0x5c4e('0x22')](function(_0x4b29f4){return _0x4b29f4;});}return null;};}function removeEntity(_0x5db2dd,_0x14703d){return function(_0xb03e96){if(_0xb03e96){return _0xb03e96[_0x5c4e('0x23')]()[_0x5c4e('0x22')](function(){_0x5db2dd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b7897,_0x3cd925){return function(_0x28189d){if(!_0x28189d){_0x1b7897[_0x5c4e('0x16')](0x194);}return _0x28189d;};}function handleError(_0x53f3e5,_0x169a43){_0x169a43=_0x169a43||0x1f4;return function(_0x2431a6){logger[_0x5c4e('0x24')](_0x2431a6[_0x5c4e('0x25')]);if(_0x2431a6[_0x5c4e('0x26')]){delete _0x2431a6[_0x5c4e('0x26')];}_0x53f3e5[_0x5c4e('0x17')](_0x169a43)[_0x5c4e('0x27')](_0x2431a6);};}exports[_0x5c4e('0x28')]=function(_0x283793,_0x55faf7){var _0x4126b0={},_0xd42be1={},_0xc41335={'count':0x0,'rows':[]};var _0x37d08a=_[_0x5c4e('0x29')](db[_0x5c4e('0x2a')][_0x5c4e('0x2b')],function(_0x435041){return{'name':_0x435041[_0x5c4e('0x2c')],'type':_0x435041[_0x5c4e('0x2d')][_0x5c4e('0x2e')]};});_0xd42be1[_0x5c4e('0x2f')]=_[_0x5c4e('0x29')](_0x37d08a,'name');_0xd42be1[_0x5c4e('0x30')]=_['keys'](_0x283793[_0x5c4e('0x30')]);_0xd42be1[_0x5c4e('0x31')]=_['intersection'](_0xd42be1[_0x5c4e('0x2f')],_0xd42be1['query']);_0x4126b0[_0x5c4e('0x32')]=_['intersection'](_0xd42be1['model'],qs[_0x5c4e('0x33')](_0x283793[_0x5c4e('0x30')][_0x5c4e('0x33')]));_0x4126b0[_0x5c4e('0x32')]=_0x4126b0[_0x5c4e('0x32')][_0x5c4e('0x34')]?_0x4126b0[_0x5c4e('0x32')]:_0xd42be1['model'];if(!_0x283793[_0x5c4e('0x30')][_0x5c4e('0x35')]('nolimit')){_0x4126b0['limit']=qs['limit'](_0x283793['query'][_0x5c4e('0x1b')]);_0x4126b0[_0x5c4e('0x18')]=qs[_0x5c4e('0x18')](_0x283793[_0x5c4e('0x30')][_0x5c4e('0x18')]);}_0x4126b0[_0x5c4e('0x36')]=qs[_0x5c4e('0x37')](_0x283793[_0x5c4e('0x30')]['sort']);_0x4126b0[_0x5c4e('0x38')]=qs[_0x5c4e('0x31')](_[_0x5c4e('0x39')](_0x283793[_0x5c4e('0x30')],_0xd42be1[_0x5c4e('0x31')]),_0x37d08a);if(_0x283793[_0x5c4e('0x30')]['filter']){_0x4126b0[_0x5c4e('0x38')]=_[_0x5c4e('0x3a')](_0x4126b0[_0x5c4e('0x38')],{'$or':_[_0x5c4e('0x29')](_0x37d08a,function(_0x27e7bb){if(_0x27e7bb[_0x5c4e('0x2d')]!=='VIRTUAL'){var _0x4df1d6={};_0x4df1d6[_0x27e7bb[_0x5c4e('0x26')]]={'$like':'%'+_0x283793[_0x5c4e('0x30')][_0x5c4e('0x3b')]+'%'};return _0x4df1d6;}})});}_0x4126b0=_[_0x5c4e('0x3a')]({},_0x4126b0,_0x283793['options']);var _0x2f09b4={'where':_0x4126b0[_0x5c4e('0x38')]};return db[_0x5c4e('0x2a')][_0x5c4e('0x1a')](_0x2f09b4)[_0x5c4e('0x22')](function(_0x1cf93d){_0xc41335[_0x5c4e('0x1a')]=_0x1cf93d;if(_0x283793[_0x5c4e('0x30')]['includeAll']){_0x4126b0[_0x5c4e('0x3c')]=[{'all':!![]}];}return db[_0x5c4e('0x2a')][_0x5c4e('0x3d')](_0x4126b0);})['then'](function(_0x3f5a27){_0xc41335[_0x5c4e('0x3e')]=_0x3f5a27;return _0xc41335;})[_0x5c4e('0x22')](respondWithFilteredResult(_0x55faf7,_0x4126b0))[_0x5c4e('0x3f')](handleError(_0x55faf7,null));};exports[_0x5c4e('0x40')]=function(_0x729e0c,_0x322167){var _0x3a9de0={'raw':![],'where':{'id':_0x729e0c[_0x5c4e('0x41')]['id']}},_0x3dfebf={};_0x3dfebf[_0x5c4e('0x2f')]=_[_0x5c4e('0x42')](db['Integration'][_0x5c4e('0x2b')]);_0x3dfebf[_0x5c4e('0x30')]=_[_0x5c4e('0x42')](_0x729e0c[_0x5c4e('0x30')]);_0x3dfebf['filters']=_[_0x5c4e('0x43')](_0x3dfebf[_0x5c4e('0x2f')],_0x3dfebf[_0x5c4e('0x30')]);_0x3a9de0[_0x5c4e('0x32')]=_['intersection'](_0x3dfebf['model'],qs[_0x5c4e('0x33')](_0x729e0c[_0x5c4e('0x30')][_0x5c4e('0x33')]));_0x3a9de0['attributes']=_0x3a9de0[_0x5c4e('0x32')][_0x5c4e('0x34')]?_0x3a9de0[_0x5c4e('0x32')]:_0x3dfebf[_0x5c4e('0x2f')];if(_0x729e0c[_0x5c4e('0x30')]['includeAll']){_0x3a9de0[_0x5c4e('0x3c')]=[{'all':!![]}];}_0x3a9de0=_[_0x5c4e('0x3a')]({},_0x3a9de0,_0x729e0c[_0x5c4e('0x44')]);return db[_0x5c4e('0x2a')][_0x5c4e('0x45')](_0x3a9de0)[_0x5c4e('0x22')](handleEntityNotFound(_0x322167,null))[_0x5c4e('0x22')](respondWithResult(_0x322167,null))[_0x5c4e('0x3f')](handleError(_0x322167,null));};exports[_0x5c4e('0x46')]=function(_0x5d3faa,_0x5beafa){return db[_0x5c4e('0x2a')][_0x5c4e('0x46')](_0x5d3faa[_0x5c4e('0x47')],{})[_0x5c4e('0x22')](respondWithResult(_0x5beafa,0xc9))[_0x5c4e('0x3f')](handleError(_0x5beafa,null));};exports[_0x5c4e('0x21')]=function(_0x1c479b,_0xe978f9){if(_0x1c479b[_0x5c4e('0x47')]['id']){delete _0x1c479b[_0x5c4e('0x47')]['id'];}return db['Integration'][_0x5c4e('0x45')]({'where':{'id':_0x1c479b[_0x5c4e('0x41')]['id']}})[_0x5c4e('0x22')](handleEntityNotFound(_0xe978f9,null))[_0x5c4e('0x22')](saveUpdates(_0x1c479b[_0x5c4e('0x47')],null))[_0x5c4e('0x22')](respondWithResult(_0xe978f9,null))['catch'](handleError(_0xe978f9,null));};exports[_0x5c4e('0x23')]=function(_0x1f355a,_0x306191){return db[_0x5c4e('0x2a')][_0x5c4e('0x45')]({'where':{'id':_0x1f355a[_0x5c4e('0x41')]['id']}})['then'](handleEntityNotFound(_0x306191,null))[_0x5c4e('0x22')](removeEntity(_0x306191,null))[_0x5c4e('0x3f')](handleError(_0x306191,null));}; \ No newline at end of file +var _0xfc15=['offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','name','send','index','Integration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','filters','length','include','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status'];(function(_0x671283,_0x3dc64f){var _0xec0b6b=function(_0x126809){while(--_0x126809){_0x671283['push'](_0x671283['shift']());}};_0xec0b6b(++_0x3dc64f);}(_0xfc15,0x72));var _0x5fc1=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xfc15[_0xc67528];return _0x38e26d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fc1('0x0'));var zipdir=require(_0x5fc1('0x1'));var jsonpatch=require(_0x5fc1('0x2'));var rp=require(_0x5fc1('0x3'));var moment=require(_0x5fc1('0x4'));var BPromise=require(_0x5fc1('0x5'));var Mustache=require(_0x5fc1('0x6'));var util=require(_0x5fc1('0x7'));var path=require(_0x5fc1('0x8'));var sox=require(_0x5fc1('0x9'));var csv=require(_0x5fc1('0xa'));var ejs=require(_0x5fc1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fc1('0xc'));var squel=require('squel');var crypto=require(_0x5fc1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5fc1('0xe'));var toCsv=require(_0x5fc1('0xa'));var querystring=require(_0x5fc1('0xf'));var Papa=require(_0x5fc1('0x10'));var Redis=require('ioredis');var authService=require(_0x5fc1('0x11'));var qs=require(_0x5fc1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fc1('0x13'))(_0x5fc1('0x14'));var utils=require(_0x5fc1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5fc1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d64a,_0x562dae){_0x562dae=_0x562dae||0xcc;return function(_0x30894d){if(_0x30894d){return _0x10d64a[_0x5fc1('0x17')](_0x562dae);}return _0x10d64a['status'](_0x562dae)[_0x5fc1('0x18')]();};}function respondWithResult(_0x44f661,_0x3f592d){_0x3f592d=_0x3f592d||0xc8;return function(_0x3e164){if(_0x3e164){return _0x44f661[_0x5fc1('0x19')](_0x3f592d)['json'](_0x3e164);}};}function respondWithFilteredResult(_0x3cd7ba,_0x2a139a){return function(_0x44ba47){if(_0x44ba47){var _0x46ebba=typeof _0x2a139a[_0x5fc1('0x1a')]===_0x5fc1('0x1b')&&typeof _0x2a139a[_0x5fc1('0x1c')]==='undefined';var _0x375829=_0x44ba47[_0x5fc1('0x1d')];var _0x4edaf3=_0x46ebba?0x0:_0x2a139a['offset'];var _0x1cbe68=_0x46ebba?_0x44ba47[_0x5fc1('0x1d')]:_0x2a139a[_0x5fc1('0x1a')]+_0x2a139a[_0x5fc1('0x1c')];var _0x124ce6;if(_0x1cbe68>=_0x375829){_0x1cbe68=_0x375829;_0x124ce6=0xc8;}else{_0x124ce6=0xce;}_0x3cd7ba[_0x5fc1('0x19')](_0x124ce6);return _0x3cd7ba['set'](_0x5fc1('0x1e'),_0x4edaf3+'-'+_0x1cbe68+'/'+_0x375829)[_0x5fc1('0x1f')](_0x44ba47);}return null;};}function patchUpdates(_0x2050cc){return function(_0x565862){try{jsonpatch['apply'](_0x565862,_0x2050cc,!![]);}catch(_0x54c15c){return BPromise[_0x5fc1('0x20')](_0x54c15c);}return _0x565862[_0x5fc1('0x21')]();};}function saveUpdates(_0x15fa9d,_0x46d7a4){return function(_0xd57533){if(_0xd57533){return _0xd57533['update'](_0x15fa9d)[_0x5fc1('0x22')](function(_0x35b3a0){return _0x35b3a0;});}return null;};}function removeEntity(_0x3f93c5,_0x5e72f5){return function(_0xd97d1f){if(_0xd97d1f){return _0xd97d1f[_0x5fc1('0x23')]()['then'](function(){_0x3f93c5[_0x5fc1('0x19')](0xcc)[_0x5fc1('0x18')]();});}};}function handleEntityNotFound(_0x374fb7,_0x147967){return function(_0x2d7af0){if(!_0x2d7af0){_0x374fb7[_0x5fc1('0x17')](0x194);}return _0x2d7af0;};}function handleError(_0x7b2ba6,_0x43b4ac){_0x43b4ac=_0x43b4ac||0x1f4;return function(_0x38a9f2){logger['error'](_0x38a9f2['stack']);if(_0x38a9f2[_0x5fc1('0x24')]){delete _0x38a9f2['name'];}_0x7b2ba6[_0x5fc1('0x19')](_0x43b4ac)[_0x5fc1('0x25')](_0x38a9f2);};}exports[_0x5fc1('0x26')]=function(_0x4164e9,_0xa80595){var _0x4f32f3={},_0x2fc376={},_0x2909d3={'count':0x0,'rows':[]};var _0x1ff8b3=_['map'](db[_0x5fc1('0x27')][_0x5fc1('0x28')],function(_0x55db60){return{'name':_0x55db60[_0x5fc1('0x29')],'type':_0x55db60[_0x5fc1('0x2a')][_0x5fc1('0x2b')]};});_0x2fc376[_0x5fc1('0x2c')]=_['map'](_0x1ff8b3,_0x5fc1('0x24'));_0x2fc376[_0x5fc1('0x2d')]=_['keys'](_0x4164e9[_0x5fc1('0x2d')]);_0x2fc376['filters']=_[_0x5fc1('0x2e')](_0x2fc376[_0x5fc1('0x2c')],_0x2fc376[_0x5fc1('0x2d')]);_0x4f32f3[_0x5fc1('0x2f')]=_[_0x5fc1('0x2e')](_0x2fc376[_0x5fc1('0x2c')],qs[_0x5fc1('0x30')](_0x4164e9[_0x5fc1('0x2d')][_0x5fc1('0x30')]));_0x4f32f3[_0x5fc1('0x2f')]=_0x4f32f3[_0x5fc1('0x2f')]['length']?_0x4f32f3[_0x5fc1('0x2f')]:_0x2fc376[_0x5fc1('0x2c')];if(!_0x4164e9[_0x5fc1('0x2d')][_0x5fc1('0x31')]('nolimit')){_0x4f32f3[_0x5fc1('0x1c')]=qs[_0x5fc1('0x1c')](_0x4164e9[_0x5fc1('0x2d')][_0x5fc1('0x1c')]);_0x4f32f3[_0x5fc1('0x1a')]=qs['offset'](_0x4164e9['query'][_0x5fc1('0x1a')]);}_0x4f32f3[_0x5fc1('0x32')]=qs[_0x5fc1('0x33')](_0x4164e9[_0x5fc1('0x2d')][_0x5fc1('0x33')]);_0x4f32f3[_0x5fc1('0x34')]=qs['filters'](_['pick'](_0x4164e9[_0x5fc1('0x2d')],_0x2fc376['filters']),_0x1ff8b3);if(_0x4164e9[_0x5fc1('0x2d')][_0x5fc1('0x35')]){_0x4f32f3[_0x5fc1('0x34')]=_[_0x5fc1('0x36')](_0x4f32f3[_0x5fc1('0x34')],{'$or':_['map'](_0x1ff8b3,function(_0x2e9b9a){if(_0x2e9b9a['type']!==_0x5fc1('0x37')){var _0x11859d={};_0x11859d[_0x2e9b9a[_0x5fc1('0x24')]]={'$like':'%'+_0x4164e9[_0x5fc1('0x2d')][_0x5fc1('0x35')]+'%'};return _0x11859d;}})});}_0x4f32f3=_[_0x5fc1('0x36')]({},_0x4f32f3,_0x4164e9[_0x5fc1('0x38')]);var _0x507235={'where':_0x4f32f3[_0x5fc1('0x34')]};return db[_0x5fc1('0x27')]['count'](_0x507235)[_0x5fc1('0x22')](function(_0x1377b5){_0x2909d3[_0x5fc1('0x1d')]=_0x1377b5;if(_0x4164e9[_0x5fc1('0x2d')][_0x5fc1('0x39')]){_0x4f32f3['include']=[{'all':!![]}];}return db[_0x5fc1('0x27')][_0x5fc1('0x3a')](_0x4f32f3);})[_0x5fc1('0x22')](function(_0x50bf1a){_0x2909d3['rows']=_0x50bf1a;return _0x2909d3;})['then'](respondWithFilteredResult(_0xa80595,_0x4f32f3))[_0x5fc1('0x3b')](handleError(_0xa80595,null));};exports[_0x5fc1('0x3c')]=function(_0x30d85a,_0x590fd6){var _0x40ae7e={'raw':![],'where':{'id':_0x30d85a[_0x5fc1('0x3d')]['id']}},_0x4c4868={};_0x4c4868[_0x5fc1('0x2c')]=_[_0x5fc1('0x3e')](db[_0x5fc1('0x27')][_0x5fc1('0x28')]);_0x4c4868['query']=_['keys'](_0x30d85a[_0x5fc1('0x2d')]);_0x4c4868[_0x5fc1('0x3f')]=_[_0x5fc1('0x2e')](_0x4c4868[_0x5fc1('0x2c')],_0x4c4868[_0x5fc1('0x2d')]);_0x40ae7e[_0x5fc1('0x2f')]=_[_0x5fc1('0x2e')](_0x4c4868[_0x5fc1('0x2c')],qs[_0x5fc1('0x30')](_0x30d85a[_0x5fc1('0x2d')]['fields']));_0x40ae7e[_0x5fc1('0x2f')]=_0x40ae7e[_0x5fc1('0x2f')][_0x5fc1('0x40')]?_0x40ae7e[_0x5fc1('0x2f')]:_0x4c4868[_0x5fc1('0x2c')];if(_0x30d85a[_0x5fc1('0x2d')][_0x5fc1('0x39')]){_0x40ae7e[_0x5fc1('0x41')]=[{'all':!![]}];}_0x40ae7e=_[_0x5fc1('0x36')]({},_0x40ae7e,_0x30d85a[_0x5fc1('0x38')]);return db[_0x5fc1('0x27')][_0x5fc1('0x42')](_0x40ae7e)[_0x5fc1('0x22')](handleEntityNotFound(_0x590fd6,null))[_0x5fc1('0x22')](respondWithResult(_0x590fd6,null))[_0x5fc1('0x3b')](handleError(_0x590fd6,null));};exports[_0x5fc1('0x43')]=function(_0x526431,_0x536621){return db[_0x5fc1('0x27')][_0x5fc1('0x43')](_0x526431[_0x5fc1('0x44')],{})[_0x5fc1('0x22')](respondWithResult(_0x536621,0xc9))['catch'](handleError(_0x536621,null));};exports[_0x5fc1('0x45')]=function(_0x4f64d5,_0x15a33a){if(_0x4f64d5[_0x5fc1('0x44')]['id']){delete _0x4f64d5[_0x5fc1('0x44')]['id'];}return db[_0x5fc1('0x27')][_0x5fc1('0x42')]({'where':{'id':_0x4f64d5[_0x5fc1('0x3d')]['id']}})[_0x5fc1('0x22')](handleEntityNotFound(_0x15a33a,null))[_0x5fc1('0x22')](saveUpdates(_0x4f64d5[_0x5fc1('0x44')],null))['then'](respondWithResult(_0x15a33a,null))[_0x5fc1('0x3b')](handleError(_0x15a33a,null));};exports['destroy']=function(_0x4b9432,_0x151152){return db[_0x5fc1('0x27')][_0x5fc1('0x42')]({'where':{'id':_0x4b9432['params']['id']}})[_0x5fc1('0x22')](handleEntityNotFound(_0x151152,null))['then'](removeEntity(_0x151152,null))[_0x5fc1('0x3b')](handleError(_0x151152,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b73f8b9..9b10d89 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 _0xcd64=['path','../../config/environment','define','Integration','integrations','lodash','../../config/logger','api'];(function(_0x88484d,_0x4c302b){var _0x5f26df=function(_0x56c552){while(--_0x56c552){_0x88484d['push'](_0x88484d['shift']());}};_0x5f26df(++_0x4c302b);}(_0xcd64,0x1a5));var _0x4cd6=function(_0x52774c,_0x5e47ba){_0x52774c=_0x52774c-0x0;var _0x1d58c3=_0xcd64[_0x52774c];return _0x1d58c3;};'use strict';var _=require(_0x4cd6('0x0'));var util=require('util');var logger=require(_0x4cd6('0x1'))(_0x4cd6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cd6('0x3'));var rimraf=require('rimraf');var config=require(_0x4cd6('0x4'));var attributes=require('./integration.attributes');module['exports']=function(_0x3ce1d1,_0x3e4918){return _0x3ce1d1[_0x4cd6('0x5')](_0x4cd6('0x6'),attributes,{'tableName':_0x4cd6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe868=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Integration','integrations','util','../../config/logger','api'];(function(_0x3f94c0,_0x21c689){var _0x9e5521=function(_0x5bc221){while(--_0x5bc221){_0x3f94c0['push'](_0x3f94c0['shift']());}};_0x9e5521(++_0x21c689);}(_0xe868,0x189));var _0x8e86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe868[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x8e86('0x0'));var logger=require(_0x8e86('0x1'))(_0x8e86('0x2'));var moment=require(_0x8e86('0x3'));var BPromise=require(_0x8e86('0x4'));var rp=require(_0x8e86('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e86('0x6'));var config=require(_0x8e86('0x7'));var attributes=require('./integration.attributes');module[_0x8e86('0x8')]=function(_0xb9d12d,_0x243202){return _0xb9d12d[_0x8e86('0x9')](_0x8e86('0xa'),attributes,{'tableName':_0x8e86('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 9e5a289..106e0d2 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 _0x320e=['result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x53f707,_0x51a2f7){var _0x10a9f5=function(_0x14b513){while(--_0x14b513){_0x53f707['push'](_0x53f707['shift']());}};_0x10a9f5(++_0x51a2f7);}(_0x320e,0x8c));var _0xe320=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x320e[_0x47568e];return _0x33815b;};'use strict';var _=require(_0xe320('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe320('0x1'));var fs=require('fs');var Redis=require(_0xe320('0x2'));var db=require(_0xe320('0x3'))['db'];var utils=require(_0xe320('0x4'));var logger=require('../../config/logger')(_0xe320('0x5'));var config=require(_0xe320('0x6'));var jayson=require(_0xe320('0x7'));var client=jayson[_0xe320('0x8')][_0xe320('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x454fd8,_0x4d3c57,_0x3596d9){return new BPromise(function(_0x1da78a,_0x234d55){return client[_0xe320('0xa')](_0x454fd8,_0x3596d9)[_0xe320('0xb')](function(_0x13cabb){logger[_0xe320('0xc')](_0xe320('0xd'),_0x4d3c57,_0xe320('0xe'));logger[_0xe320('0xf')](_0xe320('0x10'),_0x4d3c57,_0xe320('0xe'),JSON[_0xe320('0x11')](_0x13cabb));if(_0x13cabb['error']){if(_0x13cabb[_0xe320('0x12')][_0xe320('0x13')]===0x1f4){logger[_0xe320('0x12')](_0xe320('0xd'),_0x4d3c57,_0x13cabb[_0xe320('0x12')][_0xe320('0x14')]);return _0x234d55(_0x13cabb[_0xe320('0x12')][_0xe320('0x14')]);}logger[_0xe320('0x12')](_0xe320('0xd'),_0x4d3c57,_0x13cabb[_0xe320('0x12')][_0xe320('0x14')]);return _0x1da78a(_0x13cabb[_0xe320('0x12')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x4d3c57,_0xe320('0xe'));_0x1da78a(_0x13cabb[_0xe320('0x15')][_0xe320('0x14')]);}})[_0xe320('0x16')](function(_0x257467){logger[_0xe320('0x12')](_0xe320('0xd'),_0x4d3c57,_0x257467);_0x234d55(_0x257467);});});} \ No newline at end of file +var _0xbcc7=['../../config/logger','rpc','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','bluebird','../../mysqldb'];(function(_0x12a617,_0x3b7d72){var _0x59afb0=function(_0x34e681){while(--_0x34e681){_0x12a617['push'](_0x12a617['shift']());}};_0x59afb0(++_0x3b7d72);}(_0xbcc7,0x19a));var _0x7bcc=function(_0xb76b10,_0x4bdd6c){_0xb76b10=_0xb76b10-0x0;var _0x277068=_0xbcc7[_0xb76b10];return _0x277068;};'use strict';var _=require(_0x7bcc('0x0'));var util=require(_0x7bcc('0x1'));var moment=require('moment');var BPromise=require(_0x7bcc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bcc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bcc('0x4'))(_0x7bcc('0x5'));var config=require('../../config/environment');var jayson=require(_0x7bcc('0x6'));var client=jayson[_0x7bcc('0x7')][_0x7bcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f1cb3,_0x127f68,_0x33ea35){return new BPromise(function(_0x5534d5,_0x18939b){return client['request'](_0x2f1cb3,_0x33ea35)[_0x7bcc('0x9')](function(_0x3524cc){logger['info'](_0x7bcc('0xa'),_0x127f68,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x127f68,_0x7bcc('0xb'),JSON[_0x7bcc('0xc')](_0x3524cc));if(_0x3524cc[_0x7bcc('0xd')]){if(_0x3524cc[_0x7bcc('0xd')][_0x7bcc('0xe')]===0x1f4){logger[_0x7bcc('0xd')](_0x7bcc('0xa'),_0x127f68,_0x3524cc['error'][_0x7bcc('0xf')]);return _0x18939b(_0x3524cc[_0x7bcc('0xd')][_0x7bcc('0xf')]);}logger[_0x7bcc('0xd')](_0x7bcc('0xa'),_0x127f68,_0x3524cc[_0x7bcc('0xd')]['message']);return _0x5534d5(_0x3524cc[_0x7bcc('0xd')][_0x7bcc('0xf')]);}else{logger[_0x7bcc('0x10')](_0x7bcc('0xa'),_0x127f68,_0x7bcc('0xb'));_0x5534d5(_0x3524cc[_0x7bcc('0x11')][_0x7bcc('0xf')]);}})['catch'](function(_0x20105e){logger['error'](_0x7bcc('0xa'),_0x127f68,_0x20105e);_0x18939b(_0x20105e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 33a6bc2..4b83985 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 _0xbdb6=['isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./integrationReport.controller','get','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb6,0x199));var _0x6bdb=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xbdb6[_0x441563];return _0x2369ec;};'use strict';var multer=require(_0x6bdb('0x0'));var util=require(_0x6bdb('0x1'));var path=require(_0x6bdb('0x2'));var timeout=require(_0x6bdb('0x3'));var express=require(_0x6bdb('0x4'));var router=express[_0x6bdb('0x5')]();var fs_extra=require(_0x6bdb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6bdb('0x7'));var config=require('../../config/environment');var controller=require(_0x6bdb('0x8'));router[_0x6bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6bdb('0x9')](_0x6bdb('0xa'),auth[_0x6bdb('0xb')](),controller[_0x6bdb('0xc')]);router[_0x6bdb('0x9')](_0x6bdb('0xd'),auth[_0x6bdb('0xb')](),controller['show']);router[_0x6bdb('0xe')]('/',auth[_0x6bdb('0xb')](),controller[_0x6bdb('0xf')]);router[_0x6bdb('0x10')](_0x6bdb('0xd'),auth[_0x6bdb('0xb')](),controller[_0x6bdb('0x11')]);router[_0x6bdb('0x12')]('/:id',auth[_0x6bdb('0xb')](),controller[_0x6bdb('0x13')]);module[_0x6bdb('0x14')]=router; \ No newline at end of file +var _0x10d1=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10d1,0x6a));var _0x110d=function(_0x4267a8,_0x29a6c0){_0x4267a8=_0x4267a8-0x0;var _0x3af09e=_0x10d1[_0x4267a8];return _0x3af09e;};'use strict';var multer=require(_0x110d('0x0'));var util=require(_0x110d('0x1'));var path=require(_0x110d('0x2'));var timeout=require(_0x110d('0x3'));var express=require(_0x110d('0x4'));var router=express['Router']();var fs_extra=require(_0x110d('0x5'));var auth=require(_0x110d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x110d('0x7'));var controller=require(_0x110d('0x8'));router[_0x110d('0x9')]('/',auth['isAuthenticated'](),controller[_0x110d('0xa')]);router[_0x110d('0x9')](_0x110d('0xb'),auth[_0x110d('0xc')](),controller[_0x110d('0xd')]);router[_0x110d('0x9')](_0x110d('0xe'),auth['isAuthenticated'](),controller[_0x110d('0xf')]);router[_0x110d('0x10')]('/',auth[_0x110d('0xc')](),controller['create']);router[_0x110d('0x11')]('/:id',auth[_0x110d('0xc')](),controller['update']);router[_0x110d('0x12')](_0x110d('0xe'),auth[_0x110d('0xc')](),controller[_0x110d('0x13')]);module[_0x110d('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 ff21066..bfdf242 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 _0xa674=['TEXT','ENUM','SENT','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x22cb92,_0x4b48d8){var _0x321931=function(_0x3a1796){while(--_0x3a1796){_0x22cb92['push'](_0x22cb92['shift']());}};_0x321931(++_0x4b48d8);}(_0xa674,0x12d));var _0x4a67=function(_0x1e47c7,_0x30e922){_0x1e47c7=_0x1e47c7-0x0;var _0xbf8e72=_0xa674[_0x1e47c7];return _0xbf8e72;};'use strict';var Sequelize=require('sequelize');module[_0x4a67('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4a67('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x4a67('0x1')]},'integrationId':{'type':Sequelize[_0x4a67('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4a67('0x1')]},'calleridname':{'type':Sequelize[_0x4a67('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4a67('0x1')]},'membername':{'type':Sequelize[_0x4a67('0x1')]},'agentcalledAt':{'type':Sequelize[_0x4a67('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4a67('0x3')]},'holdtime':{'type':Sequelize[_0x4a67('0x2')]},'agentcomplete':{'type':Sequelize[_0x4a67('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4a67('0x3')]},'talktime':{'type':Sequelize[_0x4a67('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x4a67('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4a67('0x3')]},'agentdump':{'type':Sequelize[_0x4a67('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4a67('0x3')]},'lastevent':{'type':Sequelize[_0x4a67('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4a67('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4a67('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4a67('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4a67('0x1')]},'context':{'type':Sequelize[_0x4a67('0x1')]},'exten':{'type':Sequelize[_0x4a67('0x1')]},'priority':{'type':Sequelize[_0x4a67('0x1')]},'destchannel':{'type':Sequelize[_0x4a67('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4a67('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4a67('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4a67('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4a67('0x1')]},'destcontext':{'type':Sequelize[_0x4a67('0x1')]},'destexten':{'type':Sequelize[_0x4a67('0x1')]},'destpriority':{'type':Sequelize[_0x4a67('0x1')]},'destuniqueid':{'type':Sequelize[_0x4a67('0x1')]},'messageId':{'type':Sequelize[_0x4a67('0x1')]},'inReplyTo':{'type':Sequelize[_0x4a67('0x1')]},'subject':{'type':Sequelize[_0x4a67('0x1')]},'from':{'type':Sequelize[_0x4a67('0x1')]},'to':{'type':Sequelize[_0x4a67('0x1')]},'cc':{'type':Sequelize[_0x4a67('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x4a67('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x4a67('0x6')](_0x4a67('0x7'),'SENDING','RECEIVED',_0x4a67('0x8'))},'url':{'type':Sequelize[_0x4a67('0x1')]},'app':{'type':Sequelize[_0x4a67('0x1')]},'appdata':{'type':Sequelize[_0x4a67('0x1')]},'projectId':{'type':Sequelize[_0x4a67('0x2')]}}; \ No newline at end of file +var _0xb374=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xb374,0x1e2));var _0x4b37=function(_0x36d588,_0x9fcf50){_0x36d588=_0x36d588-0x0;var _0x3dd0f6=_0xb374[_0x36d588];return _0x3dd0f6;};'use strict';var Sequelize=require(_0x4b37('0x0'));module[_0x4b37('0x1')]={'integration':{'type':Sequelize[_0x4b37('0x2')]},'eventChannel':{'type':Sequelize[_0x4b37('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x4b37('0x2')]},'integrationId':{'type':Sequelize[_0x4b37('0x3')]},'contacts':{'type':Sequelize[_0x4b37('0x2')]},'uniqueid':{'type':Sequelize[_0x4b37('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4b37('0x2')]},'membername':{'type':Sequelize[_0x4b37('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4b37('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4b37('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4b37('0x4')]},'talktime':{'type':Sequelize[_0x4b37('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4b37('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4b37('0x4')]},'agentdump':{'type':Sequelize[_0x4b37('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4b37('0x4')]},'lastevent':{'type':Sequelize[_0x4b37('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4b37('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4b37('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4b37('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4b37('0x2')]},'destchannel':{'type':Sequelize[_0x4b37('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4b37('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4b37('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4b37('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4b37('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4b37('0x2')]},'destexten':{'type':Sequelize[_0x4b37('0x2')]},'destpriority':{'type':Sequelize[_0x4b37('0x2')]},'destuniqueid':{'type':Sequelize[_0x4b37('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4b37('0x2')]},'subject':{'type':Sequelize[_0x4b37('0x2')]},'from':{'type':Sequelize[_0x4b37('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4b37('0x2')]},'attachment':{'type':Sequelize[_0x4b37('0x6')]},'html':{'type':Sequelize[_0x4b37('0x6')]},'text':{'type':Sequelize[_0x4b37('0x6')]},'status':{'type':Sequelize[_0x4b37('0x7')](_0x4b37('0x8'),'SENDING',_0x4b37('0x9'),_0x4b37('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4b37('0x2')]},'appdata':{'type':Sequelize[_0x4b37('0x2')]},'projectId':{'type':Sequelize[_0x4b37('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9569693..5d95bc4 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 _0xc300=['catch','create','body','find','params','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','IntegrationReport','rawAttributes','type','key','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','rows','show','keys','includeAll'];(function(_0x32d788,_0xbaa65e){var _0x1b671a=function(_0x1f8ff3){while(--_0x1f8ff3){_0x32d788['push'](_0x32d788['shift']());}};_0x1b671a(++_0xbaa65e);}(_0xc300,0x132));var _0x0c30=function(_0x290cad,_0x46d566){_0x290cad=_0x290cad-0x0;var _0x56f92f=_0xc300[_0x290cad];return _0x56f92f;};'use strict';var emlformat=require(_0x0c30('0x0'));var rimraf=require(_0x0c30('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0c30('0x2'));var moment=require(_0x0c30('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0c30('0x4'));var util=require(_0x0c30('0x5'));var path=require(_0x0c30('0x6'));var sox=require(_0x0c30('0x7'));var csv=require(_0x0c30('0x8'));var ejs=require(_0x0c30('0x9'));var fs=require('fs');var fs_extra=require(_0x0c30('0xa'));var _=require(_0x0c30('0xb'));var squel=require('squel');var crypto=require(_0x0c30('0xc'));var jsforce=require(_0x0c30('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c30('0x8'));var querystring=require(_0x0c30('0xe'));var Papa=require('papaparse');var Redis=require(_0x0c30('0xf'));var authService=require(_0x0c30('0x10'));var qs=require(_0x0c30('0x11'));var as=require(_0x0c30('0x12'));var hardwareService=require(_0x0c30('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0c30('0x14'));var config=require(_0x0c30('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x67a814,_0x192ae4){_0x192ae4=_0x192ae4||0xcc;return function(_0x2be3b0){if(_0x2be3b0){return _0x67a814[_0x0c30('0x16')](_0x192ae4);}return _0x67a814[_0x0c30('0x17')](_0x192ae4)['end']();};}function respondWithResult(_0x11c0ae,_0x50ed2a){_0x50ed2a=_0x50ed2a||0xc8;return function(_0x2b727d){if(_0x2b727d){return _0x11c0ae[_0x0c30('0x17')](_0x50ed2a)[_0x0c30('0x18')](_0x2b727d);}};}function respondWithFilteredResult(_0x10061d,_0x295efb){return function(_0x3aa672){if(_0x3aa672){var _0x58ac6e=typeof _0x295efb[_0x0c30('0x19')]==='undefined'&&typeof _0x295efb[_0x0c30('0x1a')]===_0x0c30('0x1b');var _0x22bd25=_0x3aa672['count'];var _0x2538a6=_0x58ac6e?0x0:_0x295efb[_0x0c30('0x19')];var _0x3df784=_0x58ac6e?_0x3aa672[_0x0c30('0x1c')]:_0x295efb['offset']+_0x295efb[_0x0c30('0x1a')];var _0x3c2e66;if(_0x3df784>=_0x22bd25){_0x3df784=_0x22bd25;_0x3c2e66=0xc8;}else{_0x3c2e66=0xce;}_0x10061d[_0x0c30('0x17')](_0x3c2e66);return _0x10061d[_0x0c30('0x1d')](_0x0c30('0x1e'),_0x2538a6+'-'+_0x3df784+'/'+_0x22bd25)[_0x0c30('0x18')](_0x3aa672);}return null;};}function patchUpdates(_0x11442a){return function(_0x5305d6){try{jsonpatch[_0x0c30('0x1f')](_0x5305d6,_0x11442a,!![]);}catch(_0x3dd61f){return BPromise[_0x0c30('0x20')](_0x3dd61f);}return _0x5305d6[_0x0c30('0x21')]();};}function saveUpdates(_0x1e9ac5,_0x1fa8ba){return function(_0x299316){if(_0x299316){return _0x299316[_0x0c30('0x22')](_0x1e9ac5)[_0x0c30('0x23')](function(_0x3e4563){return _0x3e4563;});}return null;};}function removeEntity(_0x262198,_0x1289e5){return function(_0x5bc7f4){if(_0x5bc7f4){return _0x5bc7f4[_0x0c30('0x24')]()[_0x0c30('0x23')](function(){_0x262198['status'](0xcc)[_0x0c30('0x25')]();});}};}function handleEntityNotFound(_0x47c67c,_0x529855){return function(_0x3672a5){if(!_0x3672a5){_0x47c67c['sendStatus'](0x194);}return _0x3672a5;};}function handleError(_0x8ffdf8,_0x2d9959){_0x2d9959=_0x2d9959||0x1f4;return function(_0x1453d6){logger[_0x0c30('0x26')](_0x1453d6[_0x0c30('0x27')]);if(_0x1453d6['name']){delete _0x1453d6[_0x0c30('0x28')];}_0x8ffdf8[_0x0c30('0x17')](_0x2d9959)[_0x0c30('0x29')](_0x1453d6);};}exports['index']=function(_0x58a64e,_0x14f9a8){var _0x2791d0={},_0x2b1413={},_0x3175dc={'count':0x0,'rows':[]};var _0x2a90a0=_['map'](db[_0x0c30('0x2a')][_0x0c30('0x2b')],function(_0x3f5d7f){return{'name':_0x3f5d7f['fieldName'],'type':_0x3f5d7f[_0x0c30('0x2c')][_0x0c30('0x2d')]};});_0x2b1413['model']=_['map'](_0x2a90a0,_0x0c30('0x28'));_0x2b1413[_0x0c30('0x2e')]=_['keys'](_0x58a64e['query']);_0x2b1413['filters']=_[_0x0c30('0x2f')](_0x2b1413['model'],_0x2b1413['query']);_0x2791d0[_0x0c30('0x30')]=_[_0x0c30('0x2f')](_0x2b1413['model'],qs[_0x0c30('0x31')](_0x58a64e[_0x0c30('0x2e')][_0x0c30('0x31')]));_0x2791d0[_0x0c30('0x30')]=_0x2791d0[_0x0c30('0x30')][_0x0c30('0x32')]?_0x2791d0[_0x0c30('0x30')]:_0x2b1413[_0x0c30('0x33')];if(!_0x58a64e[_0x0c30('0x2e')][_0x0c30('0x34')](_0x0c30('0x35'))){_0x2791d0['limit']=qs['limit'](_0x58a64e[_0x0c30('0x2e')][_0x0c30('0x1a')]);_0x2791d0[_0x0c30('0x19')]=qs[_0x0c30('0x19')](_0x58a64e[_0x0c30('0x2e')]['offset']);}_0x2791d0[_0x0c30('0x36')]=qs['sort'](_0x58a64e[_0x0c30('0x2e')][_0x0c30('0x37')]);_0x2791d0[_0x0c30('0x38')]=qs[_0x0c30('0x39')](_[_0x0c30('0x3a')](_0x58a64e['query'],_0x2b1413['filters']),_0x2a90a0);if(_0x58a64e[_0x0c30('0x2e')][_0x0c30('0x3b')]){_0x2791d0[_0x0c30('0x38')]=_[_0x0c30('0x3c')](_0x2791d0['where'],{'$or':_[_0x0c30('0x3d')](_0x2a90a0,function(_0x13dfde){if(_0x13dfde[_0x0c30('0x2c')]!==_0x0c30('0x3e')){var _0x4b3827={};_0x4b3827[_0x13dfde[_0x0c30('0x28')]]={'$like':'%'+_0x58a64e[_0x0c30('0x2e')][_0x0c30('0x3b')]+'%'};return _0x4b3827;}})});}_0x2791d0=_[_0x0c30('0x3c')]({},_0x2791d0,_0x58a64e[_0x0c30('0x3f')]);var _0x283851={'where':_0x2791d0['where']};return db[_0x0c30('0x2a')][_0x0c30('0x1c')](_0x283851)[_0x0c30('0x23')](function(_0x221d4c){_0x3175dc[_0x0c30('0x1c')]=_0x221d4c;if(_0x58a64e[_0x0c30('0x2e')]['includeAll']){_0x2791d0[_0x0c30('0x40')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x2791d0);})[_0x0c30('0x23')](function(_0x2cc81e){_0x3175dc[_0x0c30('0x41')]=_0x2cc81e;return _0x3175dc;})[_0x0c30('0x23')](respondWithFilteredResult(_0x14f9a8,_0x2791d0))['catch'](handleError(_0x14f9a8,null));};exports[_0x0c30('0x42')]=function(_0x3e90a5,_0x3ef844){var _0x2e665d={'raw':![],'where':{'id':_0x3e90a5['params']['id']}},_0x1efd0f={};_0x1efd0f[_0x0c30('0x33')]=_['keys'](db[_0x0c30('0x2a')][_0x0c30('0x2b')]);_0x1efd0f[_0x0c30('0x2e')]=_[_0x0c30('0x43')](_0x3e90a5[_0x0c30('0x2e')]);_0x1efd0f[_0x0c30('0x39')]=_[_0x0c30('0x2f')](_0x1efd0f[_0x0c30('0x33')],_0x1efd0f[_0x0c30('0x2e')]);_0x2e665d[_0x0c30('0x30')]=_[_0x0c30('0x2f')](_0x1efd0f['model'],qs['fields'](_0x3e90a5[_0x0c30('0x2e')][_0x0c30('0x31')]));_0x2e665d[_0x0c30('0x30')]=_0x2e665d[_0x0c30('0x30')][_0x0c30('0x32')]?_0x2e665d[_0x0c30('0x30')]:_0x1efd0f['model'];if(_0x3e90a5[_0x0c30('0x2e')][_0x0c30('0x44')]){_0x2e665d[_0x0c30('0x40')]=[{'all':!![]}];}_0x2e665d=_[_0x0c30('0x3c')]({},_0x2e665d,_0x3e90a5[_0x0c30('0x3f')]);return db['IntegrationReport']['find'](_0x2e665d)[_0x0c30('0x23')](handleEntityNotFound(_0x3ef844,null))[_0x0c30('0x23')](respondWithResult(_0x3ef844,null))[_0x0c30('0x45')](handleError(_0x3ef844,null));};exports[_0x0c30('0x46')]=function(_0x2b59fa,_0x1d687f){return db[_0x0c30('0x2a')][_0x0c30('0x46')](_0x2b59fa['body'],{})[_0x0c30('0x23')](respondWithResult(_0x1d687f,0xc9))[_0x0c30('0x45')](handleError(_0x1d687f,null));};exports[_0x0c30('0x22')]=function(_0x158c1d,_0x1bba03){if(_0x158c1d[_0x0c30('0x47')]['id']){delete _0x158c1d['body']['id'];}return db[_0x0c30('0x2a')][_0x0c30('0x48')]({'where':{'id':_0x158c1d[_0x0c30('0x49')]['id']}})[_0x0c30('0x23')](handleEntityNotFound(_0x1bba03,null))[_0x0c30('0x23')](saveUpdates(_0x158c1d[_0x0c30('0x47')],null))['then'](respondWithResult(_0x1bba03,null))[_0x0c30('0x45')](handleError(_0x1bba03,null));};exports['destroy']=function(_0x324c60,_0x595621){return db['IntegrationReport'][_0x0c30('0x48')]({'where':{'id':_0x324c60[_0x0c30('0x49')]['id']}})['then'](handleEntityNotFound(_0x595621,null))[_0x0c30('0x23')](removeEntity(_0x595621,null))[_0x0c30('0x45')](handleError(_0x595621,null));};exports[_0x0c30('0x4a')]=function(_0x2b1cb7,_0x3c5bb3){return db['IntegrationReport'][_0x0c30('0x4a')]()[_0x0c30('0x23')](respondWithResult(_0x3c5bb3,null))['catch'](handleError(_0x3c5bb3,null));}; \ No newline at end of file +var _0x3665=['merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick'];(function(_0x4314db,_0x35c9a9){var _0x485e52=function(_0x4a65c2){while(--_0x4a65c2){_0x4314db['push'](_0x4314db['shift']());}};_0x485e52(++_0x35c9a9);}(_0x3665,0x1d7));var _0x5366=function(_0x364089,_0x36a5ba){_0x364089=_0x364089-0x0;var _0x119875=_0x3665[_0x364089];return _0x119875;};'use strict';var emlformat=require(_0x5366('0x0'));var rimraf=require(_0x5366('0x1'));var zipdir=require(_0x5366('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5366('0x3'));var BPromise=require(_0x5366('0x4'));var Mustache=require(_0x5366('0x5'));var util=require(_0x5366('0x6'));var path=require(_0x5366('0x7'));var sox=require(_0x5366('0x8'));var csv=require(_0x5366('0x9'));var ejs=require(_0x5366('0xa'));var fs=require('fs');var fs_extra=require(_0x5366('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5366('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5366('0x9'));var querystring=require(_0x5366('0xd'));var Papa=require(_0x5366('0xe'));var Redis=require(_0x5366('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5366('0x10'));var as=require(_0x5366('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5366('0x12'))('api');var utils=require(_0x5366('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5366('0x14'));var db=require(_0x5366('0x15'))['db'];function respondWithStatusCode(_0x5c6788,_0x2253b7){_0x2253b7=_0x2253b7||0xcc;return function(_0x3c9350){if(_0x3c9350){return _0x5c6788[_0x5366('0x16')](_0x2253b7);}return _0x5c6788[_0x5366('0x17')](_0x2253b7)[_0x5366('0x18')]();};}function respondWithResult(_0xd89fcf,_0x400f11){_0x400f11=_0x400f11||0xc8;return function(_0x4a181c){if(_0x4a181c){return _0xd89fcf['status'](_0x400f11)[_0x5366('0x19')](_0x4a181c);}};}function respondWithFilteredResult(_0x23e73b,_0x5dfd43){return function(_0x46b586){if(_0x46b586){var _0x1a7514=typeof _0x5dfd43[_0x5366('0x1a')]==='undefined'&&typeof _0x5dfd43['limit']===_0x5366('0x1b');var _0x704fab=_0x46b586[_0x5366('0x1c')];var _0x512287=_0x1a7514?0x0:_0x5dfd43[_0x5366('0x1a')];var _0x278d7e=_0x1a7514?_0x46b586['count']:_0x5dfd43[_0x5366('0x1a')]+_0x5dfd43[_0x5366('0x1d')];var _0x4ee9d6;if(_0x278d7e>=_0x704fab){_0x278d7e=_0x704fab;_0x4ee9d6=0xc8;}else{_0x4ee9d6=0xce;}_0x23e73b['status'](_0x4ee9d6);return _0x23e73b[_0x5366('0x1e')](_0x5366('0x1f'),_0x512287+'-'+_0x278d7e+'/'+_0x704fab)[_0x5366('0x19')](_0x46b586);}return null;};}function patchUpdates(_0x5b70f7){return function(_0x4b9917){try{jsonpatch['apply'](_0x4b9917,_0x5b70f7,!![]);}catch(_0xbd69b5){return BPromise[_0x5366('0x20')](_0xbd69b5);}return _0x4b9917[_0x5366('0x21')]();};}function saveUpdates(_0x4c614d,_0x518b07){return function(_0xa8ec8){if(_0xa8ec8){return _0xa8ec8[_0x5366('0x22')](_0x4c614d)['then'](function(_0x25a1ad){return _0x25a1ad;});}return null;};}function removeEntity(_0xe2e11e,_0x4f5644){return function(_0x50b625){if(_0x50b625){return _0x50b625[_0x5366('0x23')]()[_0x5366('0x24')](function(){_0xe2e11e['status'](0xcc)[_0x5366('0x18')]();});}};}function handleEntityNotFound(_0xca0d6,_0x15a37d){return function(_0xcdb49d){if(!_0xcdb49d){_0xca0d6['sendStatus'](0x194);}return _0xcdb49d;};}function handleError(_0x27a276,_0x5446e6){_0x5446e6=_0x5446e6||0x1f4;return function(_0xe62374){logger[_0x5366('0x25')](_0xe62374[_0x5366('0x26')]);if(_0xe62374[_0x5366('0x27')]){delete _0xe62374[_0x5366('0x27')];}_0x27a276[_0x5366('0x17')](_0x5446e6)[_0x5366('0x28')](_0xe62374);};}exports[_0x5366('0x29')]=function(_0x1bb016,_0x20d041){var _0x1faf54={},_0x320f82={},_0x40dd44={'count':0x0,'rows':[]};var _0x701a65=_['map'](db[_0x5366('0x2a')][_0x5366('0x2b')],function(_0x25cc76){return{'name':_0x25cc76[_0x5366('0x2c')],'type':_0x25cc76[_0x5366('0x2d')][_0x5366('0x2e')]};});_0x320f82['model']=_[_0x5366('0x2f')](_0x701a65,_0x5366('0x27'));_0x320f82[_0x5366('0x30')]=_[_0x5366('0x31')](_0x1bb016[_0x5366('0x30')]);_0x320f82[_0x5366('0x32')]=_[_0x5366('0x33')](_0x320f82[_0x5366('0x34')],_0x320f82[_0x5366('0x30')]);_0x1faf54['attributes']=_['intersection'](_0x320f82['model'],qs[_0x5366('0x35')](_0x1bb016[_0x5366('0x30')][_0x5366('0x35')]));_0x1faf54['attributes']=_0x1faf54[_0x5366('0x36')][_0x5366('0x37')]?_0x1faf54[_0x5366('0x36')]:_0x320f82[_0x5366('0x34')];if(!_0x1bb016[_0x5366('0x30')]['hasOwnProperty'](_0x5366('0x38'))){_0x1faf54[_0x5366('0x1d')]=qs[_0x5366('0x1d')](_0x1bb016[_0x5366('0x30')][_0x5366('0x1d')]);_0x1faf54[_0x5366('0x1a')]=qs['offset'](_0x1bb016[_0x5366('0x30')]['offset']);}_0x1faf54[_0x5366('0x39')]=qs[_0x5366('0x3a')](_0x1bb016[_0x5366('0x30')][_0x5366('0x3a')]);_0x1faf54[_0x5366('0x3b')]=qs[_0x5366('0x32')](_[_0x5366('0x3c')](_0x1bb016[_0x5366('0x30')],_0x320f82[_0x5366('0x32')]),_0x701a65);if(_0x1bb016[_0x5366('0x30')]['filter']){_0x1faf54[_0x5366('0x3b')]=_[_0x5366('0x3d')](_0x1faf54['where'],{'$or':_['map'](_0x701a65,function(_0x560da3){if(_0x560da3[_0x5366('0x2d')]!==_0x5366('0x3e')){var _0x47167c={};_0x47167c[_0x560da3[_0x5366('0x27')]]={'$like':'%'+_0x1bb016[_0x5366('0x30')][_0x5366('0x3f')]+'%'};return _0x47167c;}})});}_0x1faf54=_['merge']({},_0x1faf54,_0x1bb016[_0x5366('0x40')]);var _0x60099e={'where':_0x1faf54[_0x5366('0x3b')]};return db[_0x5366('0x2a')][_0x5366('0x1c')](_0x60099e)[_0x5366('0x24')](function(_0x1b7ace){_0x40dd44[_0x5366('0x1c')]=_0x1b7ace;if(_0x1bb016[_0x5366('0x30')]['includeAll']){_0x1faf54[_0x5366('0x41')]=[{'all':!![]}];}return db[_0x5366('0x2a')][_0x5366('0x42')](_0x1faf54);})[_0x5366('0x24')](function(_0x4db7f8){_0x40dd44[_0x5366('0x43')]=_0x4db7f8;return _0x40dd44;})[_0x5366('0x24')](respondWithFilteredResult(_0x20d041,_0x1faf54))[_0x5366('0x44')](handleError(_0x20d041,null));};exports[_0x5366('0x45')]=function(_0x2adea6,_0x5cdd9c){var _0x4a0be2={'raw':![],'where':{'id':_0x2adea6[_0x5366('0x46')]['id']}},_0x48feac={};_0x48feac[_0x5366('0x34')]=_[_0x5366('0x31')](db[_0x5366('0x2a')][_0x5366('0x2b')]);_0x48feac[_0x5366('0x30')]=_[_0x5366('0x31')](_0x2adea6['query']);_0x48feac[_0x5366('0x32')]=_[_0x5366('0x33')](_0x48feac[_0x5366('0x34')],_0x48feac[_0x5366('0x30')]);_0x4a0be2[_0x5366('0x36')]=_[_0x5366('0x33')](_0x48feac[_0x5366('0x34')],qs[_0x5366('0x35')](_0x2adea6[_0x5366('0x30')][_0x5366('0x35')]));_0x4a0be2['attributes']=_0x4a0be2[_0x5366('0x36')][_0x5366('0x37')]?_0x4a0be2[_0x5366('0x36')]:_0x48feac['model'];if(_0x2adea6[_0x5366('0x30')][_0x5366('0x47')]){_0x4a0be2[_0x5366('0x41')]=[{'all':!![]}];}_0x4a0be2=_[_0x5366('0x3d')]({},_0x4a0be2,_0x2adea6['options']);return db[_0x5366('0x2a')][_0x5366('0x48')](_0x4a0be2)[_0x5366('0x24')](handleEntityNotFound(_0x5cdd9c,null))[_0x5366('0x24')](respondWithResult(_0x5cdd9c,null))[_0x5366('0x44')](handleError(_0x5cdd9c,null));};exports[_0x5366('0x49')]=function(_0x572960,_0x278927){return db['IntegrationReport'][_0x5366('0x49')](_0x572960[_0x5366('0x4a')],{})[_0x5366('0x24')](respondWithResult(_0x278927,0xc9))[_0x5366('0x44')](handleError(_0x278927,null));};exports[_0x5366('0x22')]=function(_0x121560,_0x519530){if(_0x121560[_0x5366('0x4a')]['id']){delete _0x121560[_0x5366('0x4a')]['id'];}return db[_0x5366('0x2a')][_0x5366('0x48')]({'where':{'id':_0x121560[_0x5366('0x46')]['id']}})['then'](handleEntityNotFound(_0x519530,null))[_0x5366('0x24')](saveUpdates(_0x121560[_0x5366('0x4a')],null))[_0x5366('0x24')](respondWithResult(_0x519530,null))[_0x5366('0x44')](handleError(_0x519530,null));};exports[_0x5366('0x23')]=function(_0x556de9,_0x155a0e){return db[_0x5366('0x2a')][_0x5366('0x48')]({'where':{'id':_0x556de9['params']['id']}})[_0x5366('0x24')](handleEntityNotFound(_0x155a0e,null))[_0x5366('0x24')](removeEntity(_0x155a0e,null))[_0x5366('0x44')](handleError(_0x155a0e,null));};exports[_0x5366('0x4b')]=function(_0xa5c42,_0x369e88){return db[_0x5366('0x2a')][_0x5366('0x4b')]()[_0x5366('0x24')](respondWithResult(_0x369e88,null))['catch'](handleError(_0x369e88,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7c39c49..ac8950c 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 _0x2ac1=['report_integration','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','IntegrationReport'];(function(_0xd5c983,_0x394e66){var _0x3d2d91=function(_0x4291dc){while(--_0x4291dc){_0xd5c983['push'](_0xd5c983['shift']());}};_0x3d2d91(++_0x394e66);}(_0x2ac1,0x97));var _0x12ac=function(_0x4abc62,_0xb6b96f){_0x4abc62=_0x4abc62-0x0;var _0x4c65c9=_0x2ac1[_0x4abc62];return _0x4c65c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x12ac('0x0'))(_0x12ac('0x1'));var moment=require('moment');var BPromise=require(_0x12ac('0x2'));var rp=require(_0x12ac('0x3'));var fs=require('fs');var path=require(_0x12ac('0x4'));var rimraf=require(_0x12ac('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x12ac('0x6')]=function(_0x5567aa,_0x111f8f){return _0x5567aa[_0x12ac('0x7')](_0x12ac('0x8'),attributes,{'tableName':_0x12ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x632c=['path','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x632c,0x172));var _0xc632=function(_0x91c704,_0x4c93fd){_0x91c704=_0x91c704-0x0;var _0x137930=_0x632c[_0x91c704];return _0x137930;};'use strict';var _=require(_0xc632('0x0'));var util=require(_0xc632('0x1'));var logger=require(_0xc632('0x2'))(_0xc632('0x3'));var moment=require(_0xc632('0x4'));var BPromise=require(_0xc632('0x5'));var rp=require(_0xc632('0x6'));var fs=require('fs');var path=require(_0xc632('0x7'));var rimraf=require('rimraf');var config=require(_0xc632('0x8'));var attributes=require(_0xc632('0x9'));module['exports']=function(_0x4b9249,_0x418779){return _0x4b9249[_0xc632('0xa')](_0xc632('0xb'),attributes,{'tableName':_0xc632('0xc'),'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 81266a8..9b281df 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(_0x522ac7,_0x21868a){var _0x25ab5b=function(_0x5ce9fa){while(--_0x5ce9fa){_0x522ac7['push'](_0x522ac7['shift']());}};_0x25ab5b(++_0x21868a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x35f83e,_0x30ec55){_0x35f83e=_0x35f83e-0x0;var _0x249b05=_0x5eb8[_0x35f83e];return _0x249b05;};'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 _0xb7e7=['IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xa996ab,_0x30b9fa){var _0x4c7dd0=function(_0x3336c6){while(--_0x3336c6){_0xa996ab['push'](_0xa996ab['shift']());}};_0x4c7dd0(++_0x30b9fa);}(_0xb7e7,0x121));var _0x7b7e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb7e7[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2c82bf3..f60a81a 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 _0xdd5e=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','post','create','addInterval','addIntervals','/:id','update','delete','destroy'];(function(_0x1c9c50,_0x3cfd26){var _0x355ae5=function(_0x36530e){while(--_0x36530e){_0x1c9c50['push'](_0x1c9c50['shift']());}};_0x355ae5(++_0x3cfd26);}(_0xdd5e,0x127));var _0xedd5=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xdd5e[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0xedd5('0x0'));var path=require(_0xedd5('0x1'));var timeout=require(_0xedd5('0x2'));var express=require('express');var router=express[_0xedd5('0x3')]();var fs_extra=require(_0xedd5('0x4'));var auth=require(_0xedd5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xedd5('0x6'));var controller=require(_0xedd5('0x7'));router[_0xedd5('0x8')]('/',auth[_0xedd5('0x9')](),controller[_0xedd5('0xa')]);router[_0xedd5('0x8')]('/:id',auth[_0xedd5('0x9')](),controller[_0xedd5('0xb')]);router[_0xedd5('0x8')]('/:id/sub_intervals',auth[_0xedd5('0x9')](),controller['getIntervals']);router[_0xedd5('0xc')]('/',auth[_0xedd5('0x9')](),controller[_0xedd5('0xd')]);router[_0xedd5('0xc')]('/:id/sub_intervals',auth[_0xedd5('0x9')](),controller[_0xedd5('0xe')]);router['post']('/:id/sub_intervals/create_many',auth[_0xedd5('0x9')](),controller[_0xedd5('0xf')]);router['put'](_0xedd5('0x10'),auth['isAuthenticated'](),controller[_0xedd5('0x11')]);router[_0xedd5('0x12')](_0xedd5('0x10'),auth[_0xedd5('0x9')](),controller[_0xedd5('0x13')]);module[_0xedd5('0x14')]=router; \ No newline at end of file +var _0xc455=['post','/:id/sub_intervals','addInterval','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getIntervals','create'];(function(_0xab40fb,_0x262699){var _0x216a7d=function(_0x4e8005){while(--_0x4e8005){_0xab40fb['push'](_0xab40fb['shift']());}};_0x216a7d(++_0x262699);}(_0xc455,0x152));var _0x5c45=function(_0x2abae4,_0x7cfebb){_0x2abae4=_0x2abae4-0x0;var _0x46ac25=_0xc455[_0x2abae4];return _0x46ac25;};'use strict';var multer=require(_0x5c45('0x0'));var util=require(_0x5c45('0x1'));var path=require(_0x5c45('0x2'));var timeout=require(_0x5c45('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5c45('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5c45('0x5'));var config=require(_0x5c45('0x6'));var controller=require('./interval.controller');router[_0x5c45('0x7')]('/',auth[_0x5c45('0x8')](),controller[_0x5c45('0x9')]);router[_0x5c45('0x7')](_0x5c45('0xa'),auth['isAuthenticated'](),controller[_0x5c45('0xb')]);router['get']('/:id/sub_intervals',auth[_0x5c45('0x8')](),controller[_0x5c45('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5c45('0xd')]);router[_0x5c45('0xe')](_0x5c45('0xf'),auth['isAuthenticated'](),controller[_0x5c45('0x10')]);router[_0x5c45('0xe')]('/:id/sub_intervals/create_many',auth[_0x5c45('0x8')](),controller[_0x5c45('0x11')]);router[_0x5c45('0x12')]('/:id',auth[_0x5c45('0x8')](),controller[_0x5c45('0x13')]);router[_0x5c45('0x14')](_0x5c45('0xa'),auth[_0x5c45('0x8')](),controller['destroy']);module[_0x5c45('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index cea1382..82fa9db 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 _0x4af1=['sequelize','STRING'];(function(_0x262fa1,_0x9ff6fb){var _0x5b4510=function(_0x356cce){while(--_0x356cce){_0x262fa1['push'](_0x262fa1['shift']());}};_0x5b4510(++_0x9ff6fb);}(_0x4af1,0x18e));var _0x14af=function(_0xdc2bd,_0x312ba7){_0xdc2bd=_0xdc2bd-0x0;var _0xef8903=_0x4af1[_0xdc2bd];return _0xef8903;};'use strict';var Sequelize=require(_0x14af('0x0'));module['exports']={'name':{'type':Sequelize[_0x14af('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x14af('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x7e4f=['exports','STRING','sequelize'];(function(_0x28f54f,_0x46a572){var _0x4d2e2a=function(_0xc910b){while(--_0xc910b){_0x28f54f['push'](_0x28f54f['shift']());}};_0x4d2e2a(++_0x46a572);}(_0x7e4f,0xc5));var _0xf7e4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7e4f[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xf7e4('0x0'));module[_0xf7e4('0x1')]={'name':{'type':Sequelize[_0xf7e4('0x2')]},'description':{'type':Sequelize[_0xf7e4('0x2')]},'interval':{'type':Sequelize[_0xf7e4('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 1a5ae2e..b51399e 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 _0x6324=['type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','map','Interval','fieldName'];(function(_0x5bf152,_0x2884b3){var _0x5d1230=function(_0x40a921){while(--_0x40a921){_0x5bf152['push'](_0x5bf152['shift']());}};_0x5d1230(++_0x2884b3);}(_0x6324,0x13b));var _0x4632=function(_0x41b654,_0x39239c){_0x41b654=_0x41b654-0x0;var _0x55c219=_0x6324[_0x41b654];return _0x55c219;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4632('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4632('0x2'));var moment=require(_0x4632('0x3'));var BPromise=require(_0x4632('0x4'));var Mustache=require(_0x4632('0x5'));var util=require(_0x4632('0x6'));var path=require(_0x4632('0x7'));var sox=require(_0x4632('0x8'));var csv=require(_0x4632('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4632('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require(_0x4632('0x10'));var authService=require(_0x4632('0x11'));var qs=require(_0x4632('0x12'));var as=require(_0x4632('0x13'));var hardwareService=require(_0x4632('0x14'));var logger=require('../../config/logger')(_0x4632('0x15'));var utils=require(_0x4632('0x16'));var config=require(_0x4632('0x17'));var licenseUtil=require(_0x4632('0x18'));var db=require(_0x4632('0x19'))['db'];var extensions=require(_0x4632('0x1a'));function respondWithStatusCode(_0x1ef599,_0x229141){_0x229141=_0x229141||0xcc;return function(_0xacec7){if(_0xacec7){return _0x1ef599[_0x4632('0x1b')](_0x229141);}return _0x1ef599[_0x4632('0x1c')](_0x229141)[_0x4632('0x1d')]();};}function respondWithResult(_0x2d6247,_0x590c1a){_0x590c1a=_0x590c1a||0xc8;return function(_0x5e6818){if(_0x5e6818){return _0x2d6247[_0x4632('0x1c')](_0x590c1a)[_0x4632('0x1e')](_0x5e6818);}};}function respondWithFilteredResult(_0x4c466e,_0x271168){return function(_0x28f78c){if(_0x28f78c){var _0x379478=typeof _0x271168[_0x4632('0x1f')]==='undefined'&&typeof _0x271168[_0x4632('0x20')]===_0x4632('0x21');var _0x49bb8a=_0x28f78c[_0x4632('0x22')];var _0x4367ad=_0x379478?0x0:_0x271168[_0x4632('0x1f')];var _0x4263e1=_0x379478?_0x28f78c[_0x4632('0x22')]:_0x271168[_0x4632('0x1f')]+_0x271168[_0x4632('0x20')];var _0x4bbd57;if(_0x4263e1>=_0x49bb8a){_0x4263e1=_0x49bb8a;_0x4bbd57=0xc8;}else{_0x4bbd57=0xce;}_0x4c466e[_0x4632('0x1c')](_0x4bbd57);return _0x4c466e[_0x4632('0x23')]('Content-Range',_0x4367ad+'-'+_0x4263e1+'/'+_0x49bb8a)[_0x4632('0x1e')](_0x28f78c);}return null;};}function patchUpdates(_0x506bc6){return function(_0x5d1fe0){try{jsonpatch[_0x4632('0x24')](_0x5d1fe0,_0x506bc6,!![]);}catch(_0x43cd63){return BPromise['reject'](_0x43cd63);}return _0x5d1fe0[_0x4632('0x25')]();};}function saveUpdates(_0x56838e,_0x15dd3e){return function(_0x33c34e){if(_0x33c34e){return _0x33c34e[_0x4632('0x26')](_0x56838e)[_0x4632('0x27')](function(_0x5588d9){return _0x5588d9;});}return null;};}function removeEntity(_0x27859a,_0xe3a260){return function(_0x61c885){if(_0x61c885){return _0x61c885[_0x4632('0x28')]()['then'](function(){var _0x1bab0f=_0x61c885[_0x4632('0x29')]({'plain':!![]});var _0x3bfef9=_0x4632('0x2a');return db[_0x4632('0x2b')][_0x4632('0x28')]({'where':{'type':_0x3bfef9,'resourceId':_0x1bab0f['id']}})['then'](function(){return _0x61c885;});})[_0x4632('0x27')](function(){_0x27859a[_0x4632('0x1c')](0xcc)[_0x4632('0x1d')]();});}};}function handleEntityNotFound(_0x307b03,_0x25c93b){return function(_0x592c8f){if(!_0x592c8f){_0x307b03[_0x4632('0x1b')](0x194);}return _0x592c8f;};}function handleError(_0x4fbdab,_0x2fb7e0){_0x2fb7e0=_0x2fb7e0||0x1f4;return function(_0x2ffd62){logger['error'](_0x2ffd62[_0x4632('0x2c')]);if(_0x2ffd62[_0x4632('0x2d')]){delete _0x2ffd62[_0x4632('0x2d')];}_0x4fbdab[_0x4632('0x1c')](_0x2fb7e0)['send'](_0x2ffd62);};}exports['index']=function(_0x5ef877,_0x4b473a){var _0x36979e={},_0x54c481={},_0x32412f={'count':0x0,'rows':[]};var _0x36cdcc=_[_0x4632('0x2e')](db[_0x4632('0x2f')]['rawAttributes'],function(_0x43ef5c){return{'name':_0x43ef5c[_0x4632('0x30')],'type':_0x43ef5c[_0x4632('0x31')]['key']};});_0x54c481[_0x4632('0x32')]=_['map'](_0x36cdcc,_0x4632('0x2d'));_0x54c481['query']=_[_0x4632('0x33')](_0x5ef877[_0x4632('0x34')]);_0x54c481[_0x4632('0x35')]=_[_0x4632('0x36')](_0x54c481['model'],_0x54c481['query']);_0x36979e[_0x4632('0x37')]=_[_0x4632('0x36')](_0x54c481['model'],qs[_0x4632('0x38')](_0x5ef877['query'][_0x4632('0x38')]));_0x36979e[_0x4632('0x37')]=_0x36979e[_0x4632('0x37')][_0x4632('0x39')]?_0x36979e[_0x4632('0x37')]:_0x54c481['model'];if(!_0x5ef877[_0x4632('0x34')][_0x4632('0x3a')](_0x4632('0x3b'))){_0x36979e['limit']=qs[_0x4632('0x20')](_0x5ef877['query']['limit']);_0x36979e[_0x4632('0x1f')]=qs[_0x4632('0x1f')](_0x5ef877[_0x4632('0x34')][_0x4632('0x1f')]);}_0x36979e[_0x4632('0x3c')]=qs['sort'](_0x5ef877[_0x4632('0x34')][_0x4632('0x3d')]);_0x36979e[_0x4632('0x3e')]=qs[_0x4632('0x35')](_[_0x4632('0x3f')](_0x5ef877[_0x4632('0x34')],_0x54c481[_0x4632('0x35')]),_0x36cdcc);if(_0x5ef877['query'][_0x4632('0x40')]){_0x36979e[_0x4632('0x3e')]=_['merge'](_0x36979e[_0x4632('0x3e')],{'$or':_[_0x4632('0x2e')](_0x36cdcc,function(_0x1b5597){if(_0x1b5597[_0x4632('0x31')]!==_0x4632('0x41')){var _0x4c01b3={};_0x4c01b3[_0x1b5597['name']]={'$like':'%'+_0x5ef877['query']['filter']+'%'};return _0x4c01b3;}})});}_0x36979e=_[_0x4632('0x42')]({},_0x36979e,_0x5ef877[_0x4632('0x43')]);var _0x2bbeec={'where':_0x36979e[_0x4632('0x3e')]};return db[_0x4632('0x2f')][_0x4632('0x22')](_0x2bbeec)[_0x4632('0x27')](function(_0x37a626){_0x32412f[_0x4632('0x22')]=_0x37a626;if(_0x5ef877[_0x4632('0x34')][_0x4632('0x44')]){_0x36979e['include']=[{'all':!![]}];}return db[_0x4632('0x2f')][_0x4632('0x45')](_0x36979e);})[_0x4632('0x27')](function(_0x6e2a2e){_0x32412f['rows']=_0x6e2a2e;return _0x32412f;})[_0x4632('0x27')](respondWithFilteredResult(_0x4b473a,_0x36979e))[_0x4632('0x46')](handleError(_0x4b473a,null));};exports[_0x4632('0x47')]=function(_0x537ee8,_0x575f59){var _0x27c546={'raw':!![],'where':{'id':_0x537ee8[_0x4632('0x48')]['id']}},_0x1b081d={};_0x1b081d[_0x4632('0x32')]=_[_0x4632('0x33')](db[_0x4632('0x2f')][_0x4632('0x49')]);_0x1b081d[_0x4632('0x34')]=_['keys'](_0x537ee8[_0x4632('0x34')]);_0x1b081d[_0x4632('0x35')]=_[_0x4632('0x36')](_0x1b081d['model'],_0x1b081d[_0x4632('0x34')]);_0x27c546['attributes']=_[_0x4632('0x36')](_0x1b081d[_0x4632('0x32')],qs[_0x4632('0x38')](_0x537ee8[_0x4632('0x34')][_0x4632('0x38')]));_0x27c546['attributes']=_0x27c546[_0x4632('0x37')][_0x4632('0x39')]?_0x27c546[_0x4632('0x37')]:_0x1b081d['model'];if(_0x537ee8['query'][_0x4632('0x44')]){_0x27c546[_0x4632('0x4a')]=[{'all':!![]}];}_0x27c546=_[_0x4632('0x42')]({},_0x27c546,_0x537ee8[_0x4632('0x43')]);return db[_0x4632('0x2f')][_0x4632('0x4b')](_0x27c546)[_0x4632('0x27')](handleEntityNotFound(_0x575f59,null))[_0x4632('0x27')](respondWithResult(_0x575f59,null))[_0x4632('0x46')](handleError(_0x575f59,null));};exports[_0x4632('0x4c')]=function(_0x21858e,_0x2728ac){return db[_0x4632('0x2f')][_0x4632('0x4c')](_0x21858e[_0x4632('0x4d')],{})[_0x4632('0x27')](function(_0x418900){var _0x378157=_0x21858e[_0x4632('0x4e')][_0x4632('0x29')]({'plain':!![]});if(!_0x378157)throw new Error(_0x4632('0x4f'));if(_0x378157[_0x4632('0x50')]===_0x4632('0x4e')){var _0x2709af=_0x418900[_0x4632('0x29')]({'plain':!![]});var _0x2b90df=_0x4632('0x2a');return db[_0x4632('0x51')][_0x4632('0x4b')]({'where':{'name':_0x2b90df,'userProfileId':_0x378157[_0x4632('0x52')]},'raw':!![]})[_0x4632('0x27')](function(_0x2afd3d){if(_0x2afd3d&&_0x2afd3d[_0x4632('0x53')]===0x0){return db[_0x4632('0x2b')]['create']({'name':_0x2709af[_0x4632('0x2d')],'resourceId':_0x2709af['id'],'type':_0x2afd3d[_0x4632('0x2d')],'sectionId':_0x2afd3d['id']},{})[_0x4632('0x27')](function(){return _0x418900;});}else{return _0x418900;}})[_0x4632('0x46')](function(_0x66dbf9){logger[_0x4632('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x66dbf9);throw _0x66dbf9;});}return _0x418900;})[_0x4632('0x27')](respondWithResult(_0x2728ac,0xc9))['catch'](handleError(_0x2728ac,null));};exports[_0x4632('0x26')]=function(_0x3788aa,_0x2ac005){if(_0x3788aa[_0x4632('0x4d')]['id']){delete _0x3788aa[_0x4632('0x4d')]['id'];}return db[_0x4632('0x2f')][_0x4632('0x4b')]({'where':{'id':_0x3788aa[_0x4632('0x48')]['id']}})['then'](handleEntityNotFound(_0x2ac005,null))[_0x4632('0x27')](saveUpdates(_0x3788aa[_0x4632('0x4d')],null))['then'](respondWithResult(_0x2ac005,null))['catch'](handleError(_0x2ac005,null));};exports[_0x4632('0x28')]=function(_0x4e2638,_0x33ccfe){return db['Interval']['find']({'where':{'id':_0x4e2638[_0x4632('0x48')]['id']}})[_0x4632('0x27')](handleEntityNotFound(_0x33ccfe,null))[_0x4632('0x27')](removeEntity(_0x33ccfe,null))[_0x4632('0x46')](handleError(_0x33ccfe,null));};exports[_0x4632('0x55')]=function(_0x1e572e,_0x3437cd,_0x552cc7){if(_0x1e572e[_0x4632('0x4d')]['id']){delete _0x1e572e[_0x4632('0x4d')]['id'];}return db['Interval']['find']({'where':{'id':_0x1e572e[_0x4632('0x48')]['id']}})[_0x4632('0x27')](handleEntityNotFound(_0x3437cd,null))[_0x4632('0x27')](function(_0x554107){if(_0x554107){_0x1e572e['body'][_0x4632('0x56')]=_0x554107['id'];return db[_0x4632('0x2f')]['create'](_0x1e572e['body']);}})[_0x4632('0x27')](respondWithResult(_0x3437cd,null))['catch'](handleError(_0x3437cd,null));};exports[_0x4632('0x57')]=function(_0x124cc5,_0x4c9ff6,_0x26b4b8){var _0x5043f0={};var _0x440c7e={};var _0x2f05f3;var _0x5ba02c;return db[_0x4632('0x2f')][_0x4632('0x58')]({'where':{'id':_0x124cc5['params']['id']}})[_0x4632('0x27')](handleEntityNotFound(_0x4c9ff6,null))[_0x4632('0x27')](function(_0x1decdf){if(_0x1decdf){_0x2f05f3=_0x1decdf;_0x440c7e[_0x4632('0x32')]=_[_0x4632('0x33')](db[_0x4632('0x2f')][_0x4632('0x49')]);_0x440c7e[_0x4632('0x34')]=_['keys'](_0x124cc5['query']);_0x440c7e[_0x4632('0x35')]=_[_0x4632('0x36')](_0x440c7e['model'],_0x440c7e[_0x4632('0x34')]);_0x5043f0[_0x4632('0x37')]=_[_0x4632('0x36')](_0x440c7e[_0x4632('0x32')],qs[_0x4632('0x38')](_0x124cc5[_0x4632('0x34')][_0x4632('0x38')]));_0x5043f0[_0x4632('0x37')]=_0x5043f0[_0x4632('0x37')][_0x4632('0x39')]?_0x5043f0['attributes']:_0x440c7e[_0x4632('0x32')];_0x5043f0[_0x4632('0x3c')]=qs[_0x4632('0x3d')](_0x124cc5[_0x4632('0x34')][_0x4632('0x3d')]);_0x5043f0[_0x4632('0x3e')]=qs[_0x4632('0x35')](_[_0x4632('0x3f')](_0x124cc5[_0x4632('0x34')],_0x440c7e[_0x4632('0x35')]));if(_0x124cc5[_0x4632('0x34')][_0x4632('0x40')]){_0x5043f0[_0x4632('0x3e')]=_[_0x4632('0x42')](_0x5043f0[_0x4632('0x3e')],{'$or':_[_0x4632('0x2e')](_0x5043f0['attributes'],function(_0x50a2f8){var _0x11c8e7={};_0x11c8e7[_0x50a2f8]={'$like':'%'+_0x124cc5['query'][_0x4632('0x40')]+'%'};return _0x11c8e7;})});}_0x5043f0=_[_0x4632('0x42')]({},_0x5043f0,_0x124cc5['options']);return _0x2f05f3[_0x4632('0x57')](_0x5043f0);}})[_0x4632('0x27')](function(_0x1b93f5){if(_0x1b93f5){_0x5ba02c=_0x1b93f5[_0x4632('0x39')];if(!_0x124cc5['query']['hasOwnProperty'](_0x4632('0x3b'))){_0x5043f0[_0x4632('0x20')]=qs['limit'](_0x124cc5[_0x4632('0x34')][_0x4632('0x20')]);_0x5043f0[_0x4632('0x1f')]=qs[_0x4632('0x1f')](_0x124cc5['query'][_0x4632('0x1f')]);}return _0x2f05f3[_0x4632('0x57')](_0x5043f0);}})[_0x4632('0x27')](function(_0x15f60b){if(_0x15f60b){return _0x15f60b?{'count':_0x5ba02c,'rows':_0x15f60b}:null;}})[_0x4632('0x27')](respondWithResult(_0x4c9ff6,null))[_0x4632('0x46')](handleError(_0x4c9ff6,null));};exports[_0x4632('0x59')]=function(_0x53529d,_0x221114,_0x127d83){return db[_0x4632('0x2f')][_0x4632('0x58')]({'where':{'id':_0x53529d['params']['id']}})[_0x4632('0x27')](handleEntityNotFound(_0x221114,null))[_0x4632('0x27')](function(_0x43f012){if(_0x43f012){return db[_0x4632('0x5a')]['transaction'](function(_0xe68ae8){return db[_0x4632('0x2f')][_0x4632('0x28')]({'where':{'IntervalId':_0x53529d[_0x4632('0x48')]['id']},'transaction':_0xe68ae8})[_0x4632('0x27')](function(_0x1ffec4){var _0x5c916b=_[_0x4632('0x2e')](_0x53529d[_0x4632('0x4d')],function(_0x1528e9){delete _0x1528e9['id'];_0x1528e9[_0x4632('0x56')]=_0x53529d['params']['id'];return _0x1528e9;});return db[_0x4632('0x2f')]['bulkCreate'](_0x5c916b,{'transaction':_0xe68ae8});});})[_0x4632('0x27')](function(){return db['Interval'][_0x4632('0x45')]({'where':{'IntervalId':_0x53529d[_0x4632('0x48')]['id']}});});}})['then'](respondWithResult(_0x221114,null))['catch'](handleError(_0x221114,null));}; \ No newline at end of file +var _0xfb51=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','map','Interval','rawAttributes','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','pick','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xfb51,0x1b5));var _0x1fb5=function(_0x1c7586,_0x1d46bd){_0x1c7586=_0x1c7586-0x0;var _0x3bd9a1=_0xfb51[_0x1c7586];return _0x3bd9a1;};'use strict';var emlformat=require(_0x1fb5('0x0'));var rimraf=require(_0x1fb5('0x1'));var zipdir=require(_0x1fb5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fb5('0x3'));var moment=require(_0x1fb5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1fb5('0x5'));var util=require(_0x1fb5('0x6'));var path=require(_0x1fb5('0x7'));var sox=require(_0x1fb5('0x8'));var csv=require(_0x1fb5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fb5('0xa'));var _=require(_0x1fb5('0xb'));var squel=require(_0x1fb5('0xc'));var crypto=require(_0x1fb5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1fb5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1fb5('0xf'));var Papa=require(_0x1fb5('0x10'));var Redis=require(_0x1fb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1fb5('0x12'));var as=require(_0x1fb5('0x13'));var hardwareService=require(_0x1fb5('0x14'));var logger=require('../../config/logger')(_0x1fb5('0x15'));var utils=require(_0x1fb5('0x16'));var config=require(_0x1fb5('0x17'));var licenseUtil=require(_0x1fb5('0x18'));var db=require(_0x1fb5('0x19'))['db'];var extensions=require(_0x1fb5('0x1a'));function respondWithStatusCode(_0x28cbfa,_0x1b0d95){_0x1b0d95=_0x1b0d95||0xcc;return function(_0x41c588){if(_0x41c588){return _0x28cbfa[_0x1fb5('0x1b')](_0x1b0d95);}return _0x28cbfa[_0x1fb5('0x1c')](_0x1b0d95)[_0x1fb5('0x1d')]();};}function respondWithResult(_0x4b9ba6,_0x5c3572){_0x5c3572=_0x5c3572||0xc8;return function(_0xfd062){if(_0xfd062){return _0x4b9ba6['status'](_0x5c3572)[_0x1fb5('0x1e')](_0xfd062);}};}function respondWithFilteredResult(_0x4337e,_0x21deed){return function(_0x42ad30){if(_0x42ad30){var _0x38b3b0=typeof _0x21deed[_0x1fb5('0x1f')]==='undefined'&&typeof _0x21deed[_0x1fb5('0x20')]===_0x1fb5('0x21');var _0x34c41a=_0x42ad30[_0x1fb5('0x22')];var _0x1faaea=_0x38b3b0?0x0:_0x21deed[_0x1fb5('0x1f')];var _0x59bfa2=_0x38b3b0?_0x42ad30[_0x1fb5('0x22')]:_0x21deed[_0x1fb5('0x1f')]+_0x21deed['limit'];var _0x478b16;if(_0x59bfa2>=_0x34c41a){_0x59bfa2=_0x34c41a;_0x478b16=0xc8;}else{_0x478b16=0xce;}_0x4337e[_0x1fb5('0x1c')](_0x478b16);return _0x4337e[_0x1fb5('0x23')](_0x1fb5('0x24'),_0x1faaea+'-'+_0x59bfa2+'/'+_0x34c41a)[_0x1fb5('0x1e')](_0x42ad30);}return null;};}function patchUpdates(_0x59be83){return function(_0x6ba6ff){try{jsonpatch['apply'](_0x6ba6ff,_0x59be83,!![]);}catch(_0x4bc63d){return BPromise[_0x1fb5('0x25')](_0x4bc63d);}return _0x6ba6ff[_0x1fb5('0x26')]();};}function saveUpdates(_0x15c7ad,_0x393374){return function(_0x5b0b9f){if(_0x5b0b9f){return _0x5b0b9f[_0x1fb5('0x27')](_0x15c7ad)[_0x1fb5('0x28')](function(_0x264468){return _0x264468;});}return null;};}function removeEntity(_0x215f9d,_0x39440e){return function(_0x1dd434){if(_0x1dd434){return _0x1dd434[_0x1fb5('0x29')]()['then'](function(){var _0x35184b=_0x1dd434[_0x1fb5('0x2a')]({'plain':!![]});var _0x125827=_0x1fb5('0x2b');return db[_0x1fb5('0x2c')][_0x1fb5('0x29')]({'where':{'type':_0x125827,'resourceId':_0x35184b['id']}})[_0x1fb5('0x28')](function(){return _0x1dd434;});})[_0x1fb5('0x28')](function(){_0x215f9d[_0x1fb5('0x1c')](0xcc)[_0x1fb5('0x1d')]();});}};}function handleEntityNotFound(_0x175326,_0x553705){return function(_0x4d7b84){if(!_0x4d7b84){_0x175326[_0x1fb5('0x1b')](0x194);}return _0x4d7b84;};}function handleError(_0x3f02d3,_0x5d9b8d){_0x5d9b8d=_0x5d9b8d||0x1f4;return function(_0x5aaf13){logger[_0x1fb5('0x2d')](_0x5aaf13[_0x1fb5('0x2e')]);if(_0x5aaf13[_0x1fb5('0x2f')]){delete _0x5aaf13[_0x1fb5('0x2f')];}_0x3f02d3[_0x1fb5('0x1c')](_0x5d9b8d)[_0x1fb5('0x30')](_0x5aaf13);};}exports['index']=function(_0x239200,_0x4c7adf){var _0x5da38b={},_0x196b2c={},_0x49f459={'count':0x0,'rows':[]};var _0x60295=_[_0x1fb5('0x31')](db[_0x1fb5('0x32')][_0x1fb5('0x33')],function(_0x1c7fb9){return{'name':_0x1c7fb9['fieldName'],'type':_0x1c7fb9[_0x1fb5('0x34')][_0x1fb5('0x35')]};});_0x196b2c['model']=_[_0x1fb5('0x31')](_0x60295,_0x1fb5('0x2f'));_0x196b2c[_0x1fb5('0x36')]=_[_0x1fb5('0x37')](_0x239200[_0x1fb5('0x36')]);_0x196b2c[_0x1fb5('0x38')]=_['intersection'](_0x196b2c[_0x1fb5('0x39')],_0x196b2c['query']);_0x5da38b[_0x1fb5('0x3a')]=_['intersection'](_0x196b2c[_0x1fb5('0x39')],qs[_0x1fb5('0x3b')](_0x239200[_0x1fb5('0x36')][_0x1fb5('0x3b')]));_0x5da38b[_0x1fb5('0x3a')]=_0x5da38b[_0x1fb5('0x3a')]['length']?_0x5da38b[_0x1fb5('0x3a')]:_0x196b2c[_0x1fb5('0x39')];if(!_0x239200[_0x1fb5('0x36')][_0x1fb5('0x3c')]('nolimit')){_0x5da38b['limit']=qs[_0x1fb5('0x20')](_0x239200[_0x1fb5('0x36')][_0x1fb5('0x20')]);_0x5da38b[_0x1fb5('0x1f')]=qs['offset'](_0x239200[_0x1fb5('0x36')]['offset']);}_0x5da38b[_0x1fb5('0x3d')]=qs['sort'](_0x239200[_0x1fb5('0x36')][_0x1fb5('0x3e')]);_0x5da38b[_0x1fb5('0x3f')]=qs[_0x1fb5('0x38')](_['pick'](_0x239200[_0x1fb5('0x36')],_0x196b2c['filters']),_0x60295);if(_0x239200['query']['filter']){_0x5da38b[_0x1fb5('0x3f')]=_[_0x1fb5('0x40')](_0x5da38b[_0x1fb5('0x3f')],{'$or':_[_0x1fb5('0x31')](_0x60295,function(_0x15e531){if(_0x15e531[_0x1fb5('0x34')]!==_0x1fb5('0x41')){var _0xf6337={};_0xf6337[_0x15e531[_0x1fb5('0x2f')]]={'$like':'%'+_0x239200[_0x1fb5('0x36')][_0x1fb5('0x42')]+'%'};return _0xf6337;}})});}_0x5da38b=_[_0x1fb5('0x40')]({},_0x5da38b,_0x239200[_0x1fb5('0x43')]);var _0x461036={'where':_0x5da38b[_0x1fb5('0x3f')]};return db[_0x1fb5('0x32')][_0x1fb5('0x22')](_0x461036)[_0x1fb5('0x28')](function(_0x565c07){_0x49f459[_0x1fb5('0x22')]=_0x565c07;if(_0x239200[_0x1fb5('0x36')][_0x1fb5('0x44')]){_0x5da38b[_0x1fb5('0x45')]=[{'all':!![]}];}return db['Interval'][_0x1fb5('0x46')](_0x5da38b);})[_0x1fb5('0x28')](function(_0x5d0626){_0x49f459[_0x1fb5('0x47')]=_0x5d0626;return _0x49f459;})[_0x1fb5('0x28')](respondWithFilteredResult(_0x4c7adf,_0x5da38b))[_0x1fb5('0x48')](handleError(_0x4c7adf,null));};exports[_0x1fb5('0x49')]=function(_0x50206a,_0x49a72a){var _0x414d89={'raw':!![],'where':{'id':_0x50206a[_0x1fb5('0x4a')]['id']}},_0x4ec331={};_0x4ec331['model']=_[_0x1fb5('0x37')](db['Interval'][_0x1fb5('0x33')]);_0x4ec331[_0x1fb5('0x36')]=_['keys'](_0x50206a['query']);_0x4ec331[_0x1fb5('0x38')]=_[_0x1fb5('0x4b')](_0x4ec331[_0x1fb5('0x39')],_0x4ec331[_0x1fb5('0x36')]);_0x414d89['attributes']=_[_0x1fb5('0x4b')](_0x4ec331[_0x1fb5('0x39')],qs['fields'](_0x50206a[_0x1fb5('0x36')]['fields']));_0x414d89[_0x1fb5('0x3a')]=_0x414d89[_0x1fb5('0x3a')][_0x1fb5('0x4c')]?_0x414d89[_0x1fb5('0x3a')]:_0x4ec331[_0x1fb5('0x39')];if(_0x50206a[_0x1fb5('0x36')]['includeAll']){_0x414d89[_0x1fb5('0x45')]=[{'all':!![]}];}_0x414d89=_['merge']({},_0x414d89,_0x50206a[_0x1fb5('0x43')]);return db['Interval'][_0x1fb5('0x4d')](_0x414d89)[_0x1fb5('0x28')](handleEntityNotFound(_0x49a72a,null))[_0x1fb5('0x28')](respondWithResult(_0x49a72a,null))[_0x1fb5('0x48')](handleError(_0x49a72a,null));};exports[_0x1fb5('0x4e')]=function(_0x245ad3,_0x554b34){return db['Interval'][_0x1fb5('0x4e')](_0x245ad3[_0x1fb5('0x4f')],{})[_0x1fb5('0x28')](function(_0x3fe929){var _0x5e124c=_0x245ad3[_0x1fb5('0x50')][_0x1fb5('0x2a')]({'plain':!![]});if(!_0x5e124c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e124c[_0x1fb5('0x51')]===_0x1fb5('0x50')){var _0x3b31ae=_0x3fe929[_0x1fb5('0x2a')]({'plain':!![]});var _0x394871='Intervals';return db[_0x1fb5('0x52')][_0x1fb5('0x4d')]({'where':{'name':_0x394871,'userProfileId':_0x5e124c[_0x1fb5('0x53')]},'raw':!![]})[_0x1fb5('0x28')](function(_0x863010){if(_0x863010&&_0x863010['autoAssociation']===0x0){return db[_0x1fb5('0x2c')][_0x1fb5('0x4e')]({'name':_0x3b31ae[_0x1fb5('0x2f')],'resourceId':_0x3b31ae['id'],'type':_0x863010[_0x1fb5('0x2f')],'sectionId':_0x863010['id']},{})['then'](function(){return _0x3fe929;});}else{return _0x3fe929;}})[_0x1fb5('0x48')](function(_0x5aaa73){logger['error'](_0x1fb5('0x54'),_0x5aaa73);throw _0x5aaa73;});}return _0x3fe929;})[_0x1fb5('0x28')](respondWithResult(_0x554b34,0xc9))['catch'](handleError(_0x554b34,null));};exports[_0x1fb5('0x27')]=function(_0x235af9,_0x27886a){if(_0x235af9[_0x1fb5('0x4f')]['id']){delete _0x235af9[_0x1fb5('0x4f')]['id'];}return db[_0x1fb5('0x32')][_0x1fb5('0x4d')]({'where':{'id':_0x235af9[_0x1fb5('0x4a')]['id']}})[_0x1fb5('0x28')](handleEntityNotFound(_0x27886a,null))[_0x1fb5('0x28')](saveUpdates(_0x235af9[_0x1fb5('0x4f')],null))['then'](respondWithResult(_0x27886a,null))[_0x1fb5('0x48')](handleError(_0x27886a,null));};exports['destroy']=function(_0xa1518f,_0x66c10d){return db['Interval'][_0x1fb5('0x4d')]({'where':{'id':_0xa1518f[_0x1fb5('0x4a')]['id']}})[_0x1fb5('0x28')](handleEntityNotFound(_0x66c10d,null))[_0x1fb5('0x28')](removeEntity(_0x66c10d,null))[_0x1fb5('0x48')](handleError(_0x66c10d,null));};exports['addInterval']=function(_0x442347,_0x23f5fe,_0x47623f){if(_0x442347[_0x1fb5('0x4f')]['id']){delete _0x442347['body']['id'];}return db['Interval']['find']({'where':{'id':_0x442347[_0x1fb5('0x4a')]['id']}})[_0x1fb5('0x28')](handleEntityNotFound(_0x23f5fe,null))[_0x1fb5('0x28')](function(_0x4b6d8a){if(_0x4b6d8a){_0x442347[_0x1fb5('0x4f')][_0x1fb5('0x55')]=_0x4b6d8a['id'];return db[_0x1fb5('0x32')]['create'](_0x442347[_0x1fb5('0x4f')]);}})[_0x1fb5('0x28')](respondWithResult(_0x23f5fe,null))['catch'](handleError(_0x23f5fe,null));};exports[_0x1fb5('0x56')]=function(_0x26205f,_0x3b3294,_0x4fe03a){var _0x5ca98f={};var _0x584ff5={};var _0x4085f9;var _0x13e827;return db[_0x1fb5('0x32')][_0x1fb5('0x57')]({'where':{'id':_0x26205f[_0x1fb5('0x4a')]['id']}})[_0x1fb5('0x28')](handleEntityNotFound(_0x3b3294,null))[_0x1fb5('0x28')](function(_0x15ef6b){if(_0x15ef6b){_0x4085f9=_0x15ef6b;_0x584ff5['model']=_[_0x1fb5('0x37')](db[_0x1fb5('0x32')][_0x1fb5('0x33')]);_0x584ff5[_0x1fb5('0x36')]=_[_0x1fb5('0x37')](_0x26205f['query']);_0x584ff5[_0x1fb5('0x38')]=_['intersection'](_0x584ff5[_0x1fb5('0x39')],_0x584ff5[_0x1fb5('0x36')]);_0x5ca98f[_0x1fb5('0x3a')]=_[_0x1fb5('0x4b')](_0x584ff5[_0x1fb5('0x39')],qs[_0x1fb5('0x3b')](_0x26205f[_0x1fb5('0x36')][_0x1fb5('0x3b')]));_0x5ca98f[_0x1fb5('0x3a')]=_0x5ca98f['attributes'][_0x1fb5('0x4c')]?_0x5ca98f[_0x1fb5('0x3a')]:_0x584ff5[_0x1fb5('0x39')];_0x5ca98f['order']=qs['sort'](_0x26205f[_0x1fb5('0x36')][_0x1fb5('0x3e')]);_0x5ca98f[_0x1fb5('0x3f')]=qs[_0x1fb5('0x38')](_[_0x1fb5('0x58')](_0x26205f[_0x1fb5('0x36')],_0x584ff5['filters']));if(_0x26205f[_0x1fb5('0x36')][_0x1fb5('0x42')]){_0x5ca98f[_0x1fb5('0x3f')]=_[_0x1fb5('0x40')](_0x5ca98f[_0x1fb5('0x3f')],{'$or':_[_0x1fb5('0x31')](_0x5ca98f['attributes'],function(_0x63a552){var _0x556090={};_0x556090[_0x63a552]={'$like':'%'+_0x26205f[_0x1fb5('0x36')]['filter']+'%'};return _0x556090;})});}_0x5ca98f=_[_0x1fb5('0x40')]({},_0x5ca98f,_0x26205f['options']);return _0x4085f9[_0x1fb5('0x56')](_0x5ca98f);}})[_0x1fb5('0x28')](function(_0x3fe25b){if(_0x3fe25b){_0x13e827=_0x3fe25b[_0x1fb5('0x4c')];if(!_0x26205f[_0x1fb5('0x36')]['hasOwnProperty']('nolimit')){_0x5ca98f[_0x1fb5('0x20')]=qs[_0x1fb5('0x20')](_0x26205f[_0x1fb5('0x36')][_0x1fb5('0x20')]);_0x5ca98f[_0x1fb5('0x1f')]=qs[_0x1fb5('0x1f')](_0x26205f[_0x1fb5('0x36')][_0x1fb5('0x1f')]);}return _0x4085f9[_0x1fb5('0x56')](_0x5ca98f);}})[_0x1fb5('0x28')](function(_0x140507){if(_0x140507){return _0x140507?{'count':_0x13e827,'rows':_0x140507}:null;}})[_0x1fb5('0x28')](respondWithResult(_0x3b3294,null))[_0x1fb5('0x48')](handleError(_0x3b3294,null));};exports['addIntervals']=function(_0xe62932,_0x2225ce,_0x3d3226){return db[_0x1fb5('0x32')][_0x1fb5('0x57')]({'where':{'id':_0xe62932[_0x1fb5('0x4a')]['id']}})[_0x1fb5('0x28')](handleEntityNotFound(_0x2225ce,null))[_0x1fb5('0x28')](function(_0x456041){if(_0x456041){return db['sequelize'][_0x1fb5('0x59')](function(_0x3a3d64){return db[_0x1fb5('0x32')][_0x1fb5('0x29')]({'where':{'IntervalId':_0xe62932['params']['id']},'transaction':_0x3a3d64})[_0x1fb5('0x28')](function(_0x348314){var _0x1d9ef6=_[_0x1fb5('0x31')](_0xe62932['body'],function(_0x2c4d23){delete _0x2c4d23['id'];_0x2c4d23[_0x1fb5('0x55')]=_0xe62932[_0x1fb5('0x4a')]['id'];return _0x2c4d23;});return db['Interval'][_0x1fb5('0x5a')](_0x1d9ef6,{'transaction':_0x3a3d64});});})[_0x1fb5('0x28')](function(){return db['Interval'][_0x1fb5('0x46')]({'where':{'IntervalId':_0xe62932[_0x1fb5('0x4a')]['id']}});});}})[_0x1fb5('0x28')](respondWithResult(_0x2225ce,null))[_0x1fb5('0x48')](handleError(_0x2225ce,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bf785f8..ed08483 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 _0xd5c4=['Interval','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/extensions/rewrite','define'];(function(_0x2249c2,_0x125dd2){var _0xa94ad=function(_0x24c014){while(--_0x24c014){_0x2249c2['push'](_0x2249c2['shift']());}};_0xa94ad(++_0x125dd2);}(_0xd5c4,0x12d));var _0x4d5c=function(_0x31f7fe,_0xbad764){_0x31f7fe=_0x31f7fe-0x0;var _0xcaed36=_0xd5c4[_0x31f7fe];return _0xcaed36;};'use strict';var _=require(_0x4d5c('0x0'));var util=require(_0x4d5c('0x1'));var logger=require(_0x4d5c('0x2'))(_0x4d5c('0x3'));var moment=require(_0x4d5c('0x4'));var BPromise=require(_0x4d5c('0x5'));var rp=require(_0x4d5c('0x6'));var fs=require('fs');var path=require(_0x4d5c('0x7'));var rimraf=require('rimraf');var config=require(_0x4d5c('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0x4d5c('0x9'));module['exports']=function(_0x453881,_0x3000a7){return _0x453881[_0x4d5c('0xa')](_0x4d5c('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ecf04,_0x43a4e6){extensions['rewrite'](_0x453881,_0x1ecf04);},'afterBulkCreate':function(_0x42a5ce,_0x570729,_0x1ab514){_0x1ab514();extensions[_0x4d5c('0xc')](_0x453881,_0x42a5ce[0x0]);},'afterUpdate':function(_0x5ce2ac,_0x1e625a){extensions['rewrite'](_0x453881,_0x5ce2ac);},'afterDestroy':function(_0x2be347,_0x28f489){extensions[_0x4d5c('0xc')](_0x453881,_0x2be347);}}});}; \ No newline at end of file +var _0x5bb7=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','request-promise'];(function(_0x1e6d58,_0x33595a){var _0xa3c9ef=function(_0x36f7d2){while(--_0x36f7d2){_0x1e6d58['push'](_0x1e6d58['shift']());}};_0xa3c9ef(++_0x33595a);}(_0x5bb7,0x104));var _0x75bb=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x5bb7[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x75bb('0x0'));var util=require('util');var logger=require(_0x75bb('0x1'))(_0x75bb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x75bb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75bb('0x4'));var config=require(_0x75bb('0x5'));var attributes=require(_0x75bb('0x6'));var extensions=require(_0x75bb('0x7'));module[_0x75bb('0x8')]=function(_0xe4c848,_0x4144d6){return _0xe4c848['define'](_0x75bb('0x9'),attributes,{'tableName':_0x75bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x104bf0,_0x2ca29a){extensions[_0x75bb('0xb')](_0xe4c848,_0x104bf0);},'afterBulkCreate':function(_0x2887b2,_0x3e0905,_0x38bb8d){_0x38bb8d();extensions[_0x75bb('0xb')](_0xe4c848,_0x2887b2[0x0]);},'afterUpdate':function(_0x532377,_0x2bb5c3){extensions[_0x75bb('0xb')](_0xe4c848,_0x532377);},'afterDestroy':function(_0x4a9fb8,_0xe20d66){extensions[_0x75bb('0xb')](_0xe4c848,_0x4a9fb8);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index fc69d67..9d4a96e 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 _0x2225=['debug','stringify','error','code','message','result','GetInterval','findAll','options','raw','where','attributes','include','map','model','catch','ShowInterval','find','then','info','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','Interval,\x20%s,\x20%s','request\x20sent'];(function(_0x42de31,_0x2d33eb){var _0x313209=function(_0x25d3d9){while(--_0x25d3d9){_0x42de31['push'](_0x42de31['shift']());}};_0x313209(++_0x2d33eb);}(_0x2225,0x194));var _0x5222=function(_0x373250,_0x2f013f){_0x373250=_0x373250-0x0;var _0x18992a=_0x2225[_0x373250];return _0x18992a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5222('0x0'));var BPromise=require(_0x5222('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5222('0x2'));var db=require(_0x5222('0x3'))['db'];var utils=require(_0x5222('0x4'));var logger=require('../../config/logger')(_0x5222('0x5'));var config=require(_0x5222('0x6'));var jayson=require(_0x5222('0x7'));var client=jayson[_0x5222('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aa892,_0x3fc383,_0x518146){return new BPromise(function(_0x17a308,_0x5bdb27){return client[_0x5222('0x9')](_0x3aa892,_0x518146)['then'](function(_0x530f24){logger['info'](_0x5222('0xa'),_0x3fc383,_0x5222('0xb'));logger[_0x5222('0xc')]('Interval,\x20%s,\x20%s,\x20%s',_0x3fc383,_0x5222('0xb'),JSON[_0x5222('0xd')](_0x530f24));if(_0x530f24[_0x5222('0xe')]){if(_0x530f24['error'][_0x5222('0xf')]===0x1f4){logger['error'](_0x5222('0xa'),_0x3fc383,_0x530f24['error'][_0x5222('0x10')]);return _0x5bdb27(_0x530f24[_0x5222('0xe')][_0x5222('0x10')]);}logger['error'](_0x5222('0xa'),_0x3fc383,_0x530f24['error'][_0x5222('0x10')]);return _0x17a308(_0x530f24[_0x5222('0xe')][_0x5222('0x10')]);}else{logger['info'](_0x5222('0xa'),_0x3fc383,_0x5222('0xb'));_0x17a308(_0x530f24[_0x5222('0x11')][_0x5222('0x10')]);}})['catch'](function(_0x3a109a){logger[_0x5222('0xe')](_0x5222('0xa'),_0x3fc383,_0x3a109a);_0x5bdb27(_0x3a109a);});});}exports[_0x5222('0x12')]=function(_0x178e1f){var _0x2b68fe=this;return new Promise(function(_0x1357f4,_0x5ee925){return db['Interval'][_0x5222('0x13')]({'raw':_0x178e1f[_0x5222('0x14')]?_0x178e1f['options'][_0x5222('0x15')]===undefined?!![]:![]:!![],'where':_0x178e1f[_0x5222('0x14')]?_0x178e1f['options'][_0x5222('0x16')]||null:null,'attributes':_0x178e1f['options']?_0x178e1f[_0x5222('0x14')][_0x5222('0x17')]||null:null,'limit':_0x178e1f['options']?_0x178e1f[_0x5222('0x14')]['limit']||null:null,'include':_0x178e1f['options']?_0x178e1f[_0x5222('0x14')][_0x5222('0x18')]?_[_0x5222('0x19')](_0x178e1f[_0x5222('0x14')][_0x5222('0x18')],function(_0x4a99bc){return{'model':db[_0x4a99bc[_0x5222('0x1a')]],'as':_0x4a99bc['as'],'attributes':_0x4a99bc[_0x5222('0x17')],'include':_0x4a99bc[_0x5222('0x18')]?_[_0x5222('0x19')](_0x4a99bc[_0x5222('0x18')],function(_0x18e0b1){return{'model':db[_0x18e0b1[_0x5222('0x1a')]],'as':_0x18e0b1['as'],'attributes':_0x18e0b1[_0x5222('0x17')],'include':_0x18e0b1[_0x5222('0x18')]?_[_0x5222('0x19')](_0x18e0b1[_0x5222('0x18')],function(_0x187ecb){return{'model':db[_0x187ecb[_0x5222('0x1a')]],'as':_0x187ecb['as'],'attributes':_0x187ecb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c634a){logger['info']('GetInterval',_0x178e1f);logger[_0x5222('0xc')]('GetInterval',_0x178e1f,JSON[_0x5222('0xd')](_0x3c634a));_0x1357f4(_0x3c634a);})[_0x5222('0x1b')](function(_0x1e4d21){logger[_0x5222('0xe')]('GetInterval',_0x1e4d21[_0x5222('0x10')],_0x178e1f);_0x5ee925(_0x2b68fe[_0x5222('0xe')](0x1f4,_0x1e4d21[_0x5222('0x10')]));});});};exports[_0x5222('0x1c')]=function(_0x4af986){var _0x311fd9=this;return new Promise(function(_0x55e046,_0x4e5c20){return db['Interval'][_0x5222('0x1d')]({'raw':_0x4af986[_0x5222('0x14')]?_0x4af986[_0x5222('0x14')][_0x5222('0x15')]===undefined?!![]:![]:!![],'where':_0x4af986[_0x5222('0x14')]?_0x4af986[_0x5222('0x14')][_0x5222('0x16')]||null:null,'attributes':_0x4af986[_0x5222('0x14')]?_0x4af986['options'][_0x5222('0x17')]||null:null,'include':_0x4af986['options']?_0x4af986[_0x5222('0x14')][_0x5222('0x18')]?_[_0x5222('0x19')](_0x4af986['options'][_0x5222('0x18')],function(_0x598d77){return{'model':db[_0x598d77['model']],'as':_0x598d77['as'],'attributes':_0x598d77['attributes'],'include':_0x598d77[_0x5222('0x18')]?_[_0x5222('0x19')](_0x598d77['include'],function(_0x24e97e){return{'model':db[_0x24e97e[_0x5222('0x1a')]],'as':_0x24e97e['as'],'attributes':_0x24e97e['attributes'],'include':_0x24e97e['include']?_[_0x5222('0x19')](_0x24e97e[_0x5222('0x18')],function(_0x432bbf){return{'model':db[_0x432bbf['model']],'as':_0x432bbf['as'],'attributes':_0x432bbf['attributes']};}):[]};}):[]};}):[]:[]})[_0x5222('0x1e')](function(_0x136c9c){logger[_0x5222('0x1f')](_0x5222('0x1c'),_0x4af986);logger[_0x5222('0xc')](_0x5222('0x1c'),_0x4af986,JSON[_0x5222('0xd')](_0x136c9c));_0x55e046(_0x136c9c);})[_0x5222('0x1b')](function(_0x142f5d){logger[_0x5222('0xe')](_0x5222('0x1c'),_0x142f5d['message'],_0x4af986);_0x4e5c20(_0x311fd9[_0x5222('0xe')](0x1f4,_0x142f5d['message']));});});}; \ No newline at end of file +var _0x77ed=['model','then','ShowInterval','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','http','request','Interval,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetInterval','Interval','options','raw','attributes','include','map'];(function(_0x579b91,_0x1497a3){var _0x172a99=function(_0x4912e6){while(--_0x4912e6){_0x579b91['push'](_0x579b91['shift']());}};_0x172a99(++_0x1497a3);}(_0x77ed,0x1a7));var _0xd77e=function(_0x436ccc,_0x229592){_0x436ccc=_0x436ccc-0x0;var _0x2a8ff9=_0x77ed[_0x436ccc];return _0x2a8ff9;};'use strict';var _=require(_0xd77e('0x0'));var util=require(_0xd77e('0x1'));var moment=require(_0xd77e('0x2'));var BPromise=require('bluebird');var rs=require(_0xd77e('0x3'));var fs=require('fs');var Redis=require(_0xd77e('0x4'));var db=require(_0xd77e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd77e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd77e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x365076,_0x54ee07,_0x5d41b2){return new BPromise(function(_0x30b38c,_0x3e0a31){return client[_0xd77e('0x8')](_0x365076,_0x5d41b2)['then'](function(_0x11dbd8){logger['info'](_0xd77e('0x9'),_0x54ee07,_0xd77e('0xa'));logger[_0xd77e('0xb')]('Interval,\x20%s,\x20%s,\x20%s',_0x54ee07,_0xd77e('0xa'),JSON[_0xd77e('0xc')](_0x11dbd8));if(_0x11dbd8[_0xd77e('0xd')]){if(_0x11dbd8[_0xd77e('0xd')]['code']===0x1f4){logger[_0xd77e('0xd')](_0xd77e('0x9'),_0x54ee07,_0x11dbd8['error'][_0xd77e('0xe')]);return _0x3e0a31(_0x11dbd8[_0xd77e('0xd')][_0xd77e('0xe')]);}logger['error'](_0xd77e('0x9'),_0x54ee07,_0x11dbd8[_0xd77e('0xd')][_0xd77e('0xe')]);return _0x30b38c(_0x11dbd8[_0xd77e('0xd')][_0xd77e('0xe')]);}else{logger[_0xd77e('0xf')]('Interval,\x20%s,\x20%s',_0x54ee07,_0xd77e('0xa'));_0x30b38c(_0x11dbd8[_0xd77e('0x10')]['message']);}})[_0xd77e('0x11')](function(_0x3874e4){logger[_0xd77e('0xd')](_0xd77e('0x9'),_0x54ee07,_0x3874e4);_0x3e0a31(_0x3874e4);});});}exports[_0xd77e('0x12')]=function(_0x3fd607){var _0x14d82d=this;return new Promise(function(_0x14d9b0,_0x187ba7){return db[_0xd77e('0x13')]['findAll']({'raw':_0x3fd607[_0xd77e('0x14')]?_0x3fd607['options'][_0xd77e('0x15')]===undefined?!![]:![]:!![],'where':_0x3fd607[_0xd77e('0x14')]?_0x3fd607[_0xd77e('0x14')]['where']||null:null,'attributes':_0x3fd607[_0xd77e('0x14')]?_0x3fd607[_0xd77e('0x14')][_0xd77e('0x16')]||null:null,'limit':_0x3fd607['options']?_0x3fd607[_0xd77e('0x14')]['limit']||null:null,'include':_0x3fd607[_0xd77e('0x14')]?_0x3fd607[_0xd77e('0x14')][_0xd77e('0x17')]?_[_0xd77e('0x18')](_0x3fd607['options'][_0xd77e('0x17')],function(_0x7f09e7){return{'model':db[_0x7f09e7['model']],'as':_0x7f09e7['as'],'attributes':_0x7f09e7[_0xd77e('0x16')],'include':_0x7f09e7['include']?_[_0xd77e('0x18')](_0x7f09e7[_0xd77e('0x17')],function(_0x5dfbc0){return{'model':db[_0x5dfbc0[_0xd77e('0x19')]],'as':_0x5dfbc0['as'],'attributes':_0x5dfbc0[_0xd77e('0x16')],'include':_0x5dfbc0['include']?_[_0xd77e('0x18')](_0x5dfbc0['include'],function(_0x3ad78c){return{'model':db[_0x3ad78c[_0xd77e('0x19')]],'as':_0x3ad78c['as'],'attributes':_0x3ad78c[_0xd77e('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd77e('0x1a')](function(_0x2d0ea8){logger[_0xd77e('0xf')]('GetInterval',_0x3fd607);logger['debug']('GetInterval',_0x3fd607,JSON[_0xd77e('0xc')](_0x2d0ea8));_0x14d9b0(_0x2d0ea8);})[_0xd77e('0x11')](function(_0x3b983c){logger[_0xd77e('0xd')]('GetInterval',_0x3b983c[_0xd77e('0xe')],_0x3fd607);_0x187ba7(_0x14d82d[_0xd77e('0xd')](0x1f4,_0x3b983c[_0xd77e('0xe')]));});});};exports[_0xd77e('0x1b')]=function(_0x2b9ee9){var _0x167a2c=this;return new Promise(function(_0xb29ab8,_0x40ce85){return db[_0xd77e('0x13')]['find']({'raw':_0x2b9ee9[_0xd77e('0x14')]?_0x2b9ee9[_0xd77e('0x14')][_0xd77e('0x15')]===undefined?!![]:![]:!![],'where':_0x2b9ee9[_0xd77e('0x14')]?_0x2b9ee9[_0xd77e('0x14')]['where']||null:null,'attributes':_0x2b9ee9[_0xd77e('0x14')]?_0x2b9ee9['options'][_0xd77e('0x16')]||null:null,'include':_0x2b9ee9['options']?_0x2b9ee9['options'][_0xd77e('0x17')]?_['map'](_0x2b9ee9[_0xd77e('0x14')][_0xd77e('0x17')],function(_0x1431fb){return{'model':db[_0x1431fb[_0xd77e('0x19')]],'as':_0x1431fb['as'],'attributes':_0x1431fb[_0xd77e('0x16')],'include':_0x1431fb[_0xd77e('0x17')]?_[_0xd77e('0x18')](_0x1431fb[_0xd77e('0x17')],function(_0x20bc47){return{'model':db[_0x20bc47['model']],'as':_0x20bc47['as'],'attributes':_0x20bc47[_0xd77e('0x16')],'include':_0x20bc47['include']?_[_0xd77e('0x18')](_0x20bc47[_0xd77e('0x17')],function(_0xf67edc){return{'model':db[_0xf67edc[_0xd77e('0x19')]],'as':_0xf67edc['as'],'attributes':_0xf67edc[_0xd77e('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4235bf){logger['info'](_0xd77e('0x1b'),_0x2b9ee9);logger[_0xd77e('0xb')](_0xd77e('0x1b'),_0x2b9ee9,JSON[_0xd77e('0xc')](_0x4235bf));_0xb29ab8(_0x4235bf);})[_0xd77e('0x11')](function(_0x3a91b4){logger[_0xd77e('0xd')](_0xd77e('0x1b'),_0x3a91b4[_0xd77e('0xe')],_0x2b9ee9);_0x40ce85(_0x167a2c[_0xd77e('0xd')](0x1f4,_0x3a91b4['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 551fde0..9aa3cf6 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 _0xc53a=['Router','../../components/auth/service','isAuthenticated','send','express'];(function(_0x101134,_0x1ed1d3){var _0xc47acc=function(_0x7ea469){while(--_0x7ea469){_0x101134['push'](_0x101134['shift']());}};_0xc47acc(++_0x1ed1d3);}(_0xc53a,0xd6));var _0xac53=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc53a[_0x167cc1];return _0x10bc4b;};'use strict';var express=require(_0xac53('0x0'));var router=express[_0xac53('0x1')]();var auth=require(_0xac53('0x2'));var controller=require('./jira.controller');router['post']('/',auth[_0xac53('0x3')](),controller[_0xac53('0x4')]);module['exports']=router; \ No newline at end of file +var _0xbafa=['exports','express','Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send'];(function(_0x3c729b,_0x2a4146){var _0x55894c=function(_0x183a16){while(--_0x183a16){_0x3c729b['push'](_0x3c729b['shift']());}};_0x55894c(++_0x2a4146);}(_0xbafa,0x81));var _0xabaf=function(_0x1b64eb,_0x11427c){_0x1b64eb=_0x1b64eb-0x0;var _0xf32d56=_0xbafa[_0x1b64eb];return _0xf32d56;};'use strict';var express=require(_0xabaf('0x0'));var router=express[_0xabaf('0x1')]();var auth=require(_0xabaf('0x2'));var controller=require(_0xabaf('0x3'));router[_0xabaf('0x4')]('/',auth[_0xabaf('0x5')](),controller[_0xabaf('0x6')]);module[_0xabaf('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 27afd48..1fddfaf 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 _0x89ac=['key','Report','\x20from\x20','description','issuetype','fields','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','stringify','request','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','https','../../config/logger','api'];(function(_0x75da33,_0x2096b1){var _0x5a5571=function(_0x21d941){while(--_0x21d941){_0x75da33['push'](_0x75da33['shift']());}};_0x5a5571(++_0x2096b1);}(_0x89ac,0x7b));var _0xc89a=function(_0x23c9bd,_0x482ca2){_0x23c9bd=_0x23c9bd-0x0;var _0x549cb5=_0x89ac[_0x23c9bd];return _0x549cb5;};'use strict';var BPromise=require('bluebird');var https=require(_0xc89a('0x0'));var logger=require(_0xc89a('0x1'))(_0xc89a('0x2'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x4101b4,_0x4c288b){var _0xfe5a91={'fields':{'project':{'key':_0x4101b4[_0xc89a('0x3')]||'MOTGUI'},'summary':(_0x4101b4['summary']||_0xc89a('0x4'))+_0xc89a('0x5')+_0x4101b4['ip'],'description':_0x4101b4[_0xc89a('0x6')]||JSON['stringify'](_0x4101b4),'issuetype':{'name':_0x4101b4[_0xc89a('0x7')]||'Bug'}}};_0xfe5a91[_0xc89a('0x8')]['customfield_11500']=_0x4101b4[_0xc89a('0x9')];_0xfe5a91['fields'][_0xc89a('0xa')]=_0x4101b4[_0xc89a('0xb')];_0xfe5a91['fields'][_0xc89a('0xc')]=_0x4101b4['newToken'];_0xfe5a91[_0xc89a('0x8')][_0xc89a('0xd')]=_0x4101b4[_0xc89a('0xe')];_0xfe5a91['fields']['customfield_11504']=_0x4101b4[_0xc89a('0xf')];_0xfe5a91[_0xc89a('0x8')][_0xc89a('0x10')]=_0x4101b4['ip'];var _0x165ab8={'host':_0xc89a('0x11'),'port':0x1bb,'path':_0xc89a('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xc89a('0x13'),'Authorization':_0xc89a('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xc89a('0x15')]('base64')}};var _0x254c93=JSON[_0xc89a('0x16')](_0xfe5a91);var _0x1f6683=https[_0xc89a('0x17')](_0x165ab8,function(_0x448a55){_0x448a55['setEncoding'](_0xc89a('0x18'));var _0x1372bf='';_0x448a55['on'](_0xc89a('0x19'),function(_0x3183a5){_0x1372bf+=_0x3183a5;});_0x448a55['on'](_0xc89a('0x1a'),function(){if(_0x4c288b){return _0x4c288b[_0xc89a('0x1b')](_0x448a55[_0xc89a('0x1c')])[_0xc89a('0x1d')](JSON[_0xc89a('0x1e')](_0x1372bf));}});});_0x1f6683['on'](_0xc89a('0x1f'),function(_0x4e3789){if(_0x4c288b){return _0x4c288b[_0xc89a('0x1b')](0x1f4)['json']({'errors':[{'message':_0xc89a('0x20'),'type':_0xc89a('0x21')}]});}});_0x1f6683[_0xc89a('0x22')](_0x254c93);_0x1f6683[_0xc89a('0x1a')]();}exports[_0xc89a('0x23')]=openIssue;exports[_0xc89a('0x24')]=function(_0x3307a9,_0x588a05){_0x3307a9[_0xc89a('0x25')]['ip']=_0x3307a9[_0xc89a('0x26')][_0xc89a('0x27')]||_0x3307a9['connection'][_0xc89a('0x28')]||_0x3307a9[_0xc89a('0x29')][_0xc89a('0x28')]||_0x3307a9['connection'][_0xc89a('0x29')][_0xc89a('0x28')];return openIssue(_0x3307a9[_0xc89a('0x25')],_0x588a05);}; \ No newline at end of file +var _0xf892=['socket','remoteAddress','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','body','headers','x-forwarded-for','connection'];(function(_0x5d90b8,_0x528b3a){var _0x5712b3=function(_0x478049){while(--_0x478049){_0x5d90b8['push'](_0x5d90b8['shift']());}};_0x5712b3(++_0x528b3a);}(_0xf892,0x86));var _0x2f89=function(_0x1def93,_0x1adede){_0x1def93=_0x1def93-0x0;var _0x35199a=_0xf892[_0x1def93];return _0x35199a;};'use strict';var BPromise=require(_0x2f89('0x0'));var https=require(_0x2f89('0x1'));var logger=require(_0x2f89('0x2'))('api');var USERNAME='support';var PASSWORD=_0x2f89('0x3');function openIssue(_0x3983ff,_0xa06642){var _0x571fdf={'fields':{'project':{'key':_0x3983ff[_0x2f89('0x4')]||_0x2f89('0x5')},'summary':(_0x3983ff['summary']||'Report')+_0x2f89('0x6')+_0x3983ff['ip'],'description':_0x3983ff[_0x2f89('0x7')]||JSON[_0x2f89('0x8')](_0x3983ff),'issuetype':{'name':_0x3983ff['issuetype']||_0x2f89('0x9')}}};_0x571fdf['fields'][_0x2f89('0xa')]=_0x3983ff[_0x2f89('0xb')];_0x571fdf[_0x2f89('0xc')][_0x2f89('0xd')]=_0x3983ff[_0x2f89('0xe')];_0x571fdf[_0x2f89('0xc')][_0x2f89('0xf')]=_0x3983ff[_0x2f89('0x10')];_0x571fdf['fields'][_0x2f89('0x11')]=_0x3983ff[_0x2f89('0x12')];_0x571fdf[_0x2f89('0xc')][_0x2f89('0x13')]=_0x3983ff[_0x2f89('0x14')];_0x571fdf[_0x2f89('0xc')][_0x2f89('0x15')]=_0x3983ff['ip'];var _0x3dd66d={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x2f89('0x16'),'method':_0x2f89('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x2f89('0x18'),'Authorization':_0x2f89('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x2f89('0x1a')]('base64')}};var _0x2b9f35=JSON[_0x2f89('0x8')](_0x571fdf);var _0xe438b5=https[_0x2f89('0x1b')](_0x3dd66d,function(_0x1b6f73){_0x1b6f73[_0x2f89('0x1c')](_0x2f89('0x1d'));var _0x8d6f16='';_0x1b6f73['on'](_0x2f89('0x1e'),function(_0x4fe0f2){_0x8d6f16+=_0x4fe0f2;});_0x1b6f73['on'](_0x2f89('0x1f'),function(){if(_0xa06642){return _0xa06642[_0x2f89('0x20')](_0x1b6f73[_0x2f89('0x21')])[_0x2f89('0x22')](JSON['parse'](_0x8d6f16));}});});_0xe438b5['on']('error',function(_0x5099de){if(_0xa06642){return _0xa06642[_0x2f89('0x20')](0x1f4)['json']({'errors':[{'message':_0x2f89('0x23'),'type':_0x2f89('0x24')}]});}});_0xe438b5['write'](_0x2b9f35);_0xe438b5[_0x2f89('0x1f')]();}exports[_0x2f89('0x25')]=openIssue;exports['send']=function(_0x1e67d2,_0x511e91){_0x1e67d2[_0x2f89('0x26')]['ip']=_0x1e67d2[_0x2f89('0x27')][_0x2f89('0x28')]||_0x1e67d2[_0x2f89('0x29')]['remoteAddress']||_0x1e67d2['socket']['remoteAddress']||_0x1e67d2[_0x2f89('0x29')][_0x2f89('0x2a')][_0x2f89('0x2b')];return openIssue(_0x1e67d2[_0x2f89('0x26')],_0x511e91);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 129375a..70b62f4 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 _0xfc33=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x4e8ac0,_0x45d5d9){var _0x1ce292=function(_0xc1741f){while(--_0xc1741f){_0x4e8ac0['push'](_0x4e8ac0['shift']());}};_0x1ce292(++_0x45d5d9);}(_0xfc33,0x9f));var _0x3fc3=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xfc33[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0x3fc3('0x0'));var util=require(_0x3fc3('0x1'));var path=require(_0x3fc3('0x2'));var timeout=require('connect-timeout');var express=require(_0x3fc3('0x3'));var router=express[_0x3fc3('0x4')]();var fs_extra=require(_0x3fc3('0x5'));var auth=require(_0x3fc3('0x6'));var interaction=require(_0x3fc3('0x7'));var config=require(_0x3fc3('0x8'));var controller=require(_0x3fc3('0x9'));router[_0x3fc3('0xa')]('/',auth[_0x3fc3('0xb')](),controller[_0x3fc3('0xc')]);router['get'](_0x3fc3('0xd'),auth[_0x3fc3('0xb')](),controller[_0x3fc3('0xe')]);router[_0x3fc3('0xa')](_0x3fc3('0xf'),auth['isAuthenticated'](),controller[_0x3fc3('0x10')]);router[_0x3fc3('0x11')]('/',auth[_0x3fc3('0xb')](),controller['create']);router[_0x3fc3('0x12')](_0x3fc3('0xf'),auth[_0x3fc3('0xb')](),controller[_0x3fc3('0x13')]);router[_0x3fc3('0x14')](_0x3fc3('0xf'),auth[_0x3fc3('0xb')](),controller[_0x3fc3('0x15')]);module[_0x3fc3('0x16')]=router; \ No newline at end of file +var _0xd2fd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','delete','multer','util','path'];(function(_0x5a5f47,_0x42ea38){var _0xb679af=function(_0x136ff4){while(--_0x136ff4){_0x5a5f47['push'](_0x5a5f47['shift']());}};_0xb679af(++_0x42ea38);}(_0xd2fd,0xf4));var _0xdd2f=function(_0x202b44,_0x5addf7){_0x202b44=_0x202b44-0x0;var _0x12139d=_0xd2fd[_0x202b44];return _0x12139d;};'use strict';var multer=require(_0xdd2f('0x0'));var util=require(_0xdd2f('0x1'));var path=require(_0xdd2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xdd2f('0x3'));var router=express[_0xdd2f('0x4')]();var fs_extra=require(_0xdd2f('0x5'));var auth=require(_0xdd2f('0x6'));var interaction=require(_0xdd2f('0x7'));var config=require(_0xdd2f('0x8'));var controller=require(_0xdd2f('0x9'));router[_0xdd2f('0xa')]('/',auth[_0xdd2f('0xb')](),controller[_0xdd2f('0xc')]);router[_0xdd2f('0xa')](_0xdd2f('0xd'),auth[_0xdd2f('0xb')](),controller[_0xdd2f('0xe')]);router['get'](_0xdd2f('0xf'),auth[_0xdd2f('0xb')](),controller[_0xdd2f('0x10')]);router['post']('/',auth[_0xdd2f('0xb')](),controller[_0xdd2f('0x11')]);router['put'](_0xdd2f('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xdd2f('0x12')]('/:id',auth[_0xdd2f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 9bdfdb7..1338071 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 _0x087b=['long','STRING','sequelize','exports'];(function(_0x39bc80,_0x18f609){var _0x350050=function(_0x318e71){while(--_0x318e71){_0x39bc80['push'](_0x39bc80['shift']());}};_0x350050(++_0x18f609);}(_0x087b,0x11a));var _0xb087=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x087b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize['TEXT'](_0xb087('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xb087('0x3')]},'queue':{'type':Sequelize[_0xb087('0x3')]},'uniqueid':{'type':Sequelize[_0xb087('0x3')]},'calleridname':{'type':Sequelize[_0xb087('0x3')]},'calleridnum':{'type':Sequelize[_0xb087('0x3')]},'questionId':{'type':Sequelize[_0xb087('0x3')]}}; \ No newline at end of file +var _0x57f8=['exports','TEXT','long','STRING'];(function(_0x2e770c,_0x457975){var _0x2428c5=function(_0x5931ea){while(--_0x5931ea){_0x2e770c['push'](_0x2e770c['shift']());}};_0x2428c5(++_0x457975);}(_0x57f8,0x198));var _0x857f=function(_0x1bb0b6,_0x1734b7){_0x1bb0b6=_0x1bb0b6-0x0;var _0x45f16b=_0x57f8[_0x1bb0b6];return _0x45f16b;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'question':{'type':Sequelize[_0x857f('0x1')]},'answer':{'type':Sequelize[_0x857f('0x1')](_0x857f('0x2'))},'membername':{'type':Sequelize[_0x857f('0x3')]},'projectname':{'type':Sequelize[_0x857f('0x3')]},'queue':{'type':Sequelize[_0x857f('0x3')]},'uniqueid':{'type':Sequelize[_0x857f('0x3')]},'calleridname':{'type':Sequelize[_0x857f('0x3')]},'calleridnum':{'type':Sequelize[_0x857f('0x3')]},'questionId':{'type':Sequelize[_0x857f('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 9a1a767..66e9be0 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 _0x06f0=['name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack'];(function(_0x586c21,_0x17875f){var _0x903a23=function(_0x256a94){while(--_0x256a94){_0x586c21['push'](_0x586c21['shift']());}};_0x903a23(++_0x17875f);}(_0x06f0,0x115));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x006f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x006f('0x1'));var rp=require(_0x006f('0x2'));var moment=require('moment');var BPromise=require(_0x006f('0x3'));var Mustache=require('mustache');var util=require(_0x006f('0x4'));var path=require(_0x006f('0x5'));var sox=require('sox');var csv=require(_0x006f('0x6'));var ejs=require(_0x006f('0x7'));var fs=require('fs');var fs_extra=require(_0x006f('0x8'));var _=require(_0x006f('0x9'));var squel=require(_0x006f('0xa'));var crypto=require(_0x006f('0xb'));var jsforce=require(_0x006f('0xc'));var deskjs=require(_0x006f('0xd'));var toCsv=require(_0x006f('0x6'));var querystring=require(_0x006f('0xe'));var Papa=require('papaparse');var Redis=require(_0x006f('0xf'));var authService=require(_0x006f('0x10'));var qs=require(_0x006f('0x11'));var as=require(_0x006f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x006f('0x13'))(_0x006f('0x14'));var utils=require(_0x006f('0x15'));var config=require(_0x006f('0x16'));var licenseUtil=require(_0x006f('0x17'));var db=require(_0x006f('0x18'))['db'];function respondWithStatusCode(_0x50fc3c,_0x4ca056){_0x4ca056=_0x4ca056||0xcc;return function(_0x581a5e){if(_0x581a5e){return _0x50fc3c['sendStatus'](_0x4ca056);}return _0x50fc3c[_0x006f('0x19')](_0x4ca056)['end']();};}function respondWithResult(_0x59b5db,_0x55eaa5){_0x55eaa5=_0x55eaa5||0xc8;return function(_0x2cee93){if(_0x2cee93){return _0x59b5db[_0x006f('0x19')](_0x55eaa5)['json'](_0x2cee93);}};}function respondWithFilteredResult(_0x49a9e9,_0x674f54){return function(_0x4f747e){if(_0x4f747e){var _0xf1825a=typeof _0x674f54['offset']===_0x006f('0x1a')&&typeof _0x674f54[_0x006f('0x1b')]===_0x006f('0x1a');var _0x293638=_0x4f747e['count'];var _0x58a378=_0xf1825a?0x0:_0x674f54['offset'];var _0x38285f=_0xf1825a?_0x4f747e[_0x006f('0x1c')]:_0x674f54[_0x006f('0x1d')]+_0x674f54[_0x006f('0x1b')];var _0x1e5ba5;if(_0x38285f>=_0x293638){_0x38285f=_0x293638;_0x1e5ba5=0xc8;}else{_0x1e5ba5=0xce;}_0x49a9e9[_0x006f('0x19')](_0x1e5ba5);return _0x49a9e9[_0x006f('0x1e')](_0x006f('0x1f'),_0x58a378+'-'+_0x38285f+'/'+_0x293638)[_0x006f('0x20')](_0x4f747e);}return null;};}function patchUpdates(_0x529319){return function(_0x91c3eb){try{jsonpatch[_0x006f('0x21')](_0x91c3eb,_0x529319,!![]);}catch(_0x23dc65){return BPromise[_0x006f('0x22')](_0x23dc65);}return _0x91c3eb[_0x006f('0x23')]();};}function saveUpdates(_0x1bc51c,_0x97fcae){return function(_0x1ef6b9){if(_0x1ef6b9){return _0x1ef6b9[_0x006f('0x24')](_0x1bc51c)['then'](function(_0xdc9331){return _0xdc9331;});}return null;};}function removeEntity(_0x3faf63,_0x20e942){return function(_0xe5a9fb){if(_0xe5a9fb){return _0xe5a9fb[_0x006f('0x25')]()[_0x006f('0x26')](function(){_0x3faf63[_0x006f('0x19')](0xcc)[_0x006f('0x27')]();});}};}function handleEntityNotFound(_0x5504f8,_0x3c59c1){return function(_0x4e7924){if(!_0x4e7924){_0x5504f8[_0x006f('0x28')](0x194);}return _0x4e7924;};}function handleError(_0x5903d3,_0x39657c){_0x39657c=_0x39657c||0x1f4;return function(_0x40cf22){logger[_0x006f('0x29')](_0x40cf22[_0x006f('0x2a')]);if(_0x40cf22[_0x006f('0x2b')]){delete _0x40cf22['name'];}_0x5903d3[_0x006f('0x19')](_0x39657c)[_0x006f('0x2c')](_0x40cf22);};}exports[_0x006f('0x2d')]=function(_0x3a782d,_0x332a83){var _0xf5844e={},_0x32f409={},_0x26e8f1={'count':0x0,'rows':[]};var _0x348c9d=_[_0x006f('0x2e')](db[_0x006f('0x2f')][_0x006f('0x30')],function(_0x1f48ec){return{'name':_0x1f48ec[_0x006f('0x31')],'type':_0x1f48ec[_0x006f('0x32')][_0x006f('0x33')]};});_0x32f409[_0x006f('0x34')]=_[_0x006f('0x2e')](_0x348c9d,_0x006f('0x2b'));_0x32f409[_0x006f('0x35')]=_[_0x006f('0x36')](_0x3a782d[_0x006f('0x35')]);_0x32f409[_0x006f('0x37')]=_[_0x006f('0x38')](_0x32f409[_0x006f('0x34')],_0x32f409[_0x006f('0x35')]);_0xf5844e[_0x006f('0x39')]=_['intersection'](_0x32f409[_0x006f('0x34')],qs[_0x006f('0x3a')](_0x3a782d[_0x006f('0x35')]['fields']));_0xf5844e['attributes']=_0xf5844e[_0x006f('0x39')][_0x006f('0x3b')]?_0xf5844e[_0x006f('0x39')]:_0x32f409['model'];if(!_0x3a782d[_0x006f('0x35')][_0x006f('0x3c')](_0x006f('0x3d'))){_0xf5844e[_0x006f('0x1b')]=qs[_0x006f('0x1b')](_0x3a782d[_0x006f('0x35')][_0x006f('0x1b')]);_0xf5844e[_0x006f('0x1d')]=qs[_0x006f('0x1d')](_0x3a782d['query'][_0x006f('0x1d')]);}_0xf5844e[_0x006f('0x3e')]=qs[_0x006f('0x3f')](_0x3a782d[_0x006f('0x35')][_0x006f('0x3f')]);_0xf5844e[_0x006f('0x40')]=qs[_0x006f('0x37')](_[_0x006f('0x41')](_0x3a782d['query'],_0x32f409[_0x006f('0x37')]),_0x348c9d);if(_0x3a782d[_0x006f('0x35')]['filter']){_0xf5844e['where']=_[_0x006f('0x42')](_0xf5844e[_0x006f('0x40')],{'$or':_['map'](_0x348c9d,function(_0x4dc1c6){if(_0x4dc1c6[_0x006f('0x32')]!==_0x006f('0x43')){var _0x42191e={};_0x42191e[_0x4dc1c6[_0x006f('0x2b')]]={'$like':'%'+_0x3a782d[_0x006f('0x35')]['filter']+'%'};return _0x42191e;}})});}_0xf5844e=_[_0x006f('0x42')]({},_0xf5844e,_0x3a782d[_0x006f('0x44')]);var _0xe073b7={'where':_0xf5844e[_0x006f('0x40')]};return db[_0x006f('0x2f')][_0x006f('0x1c')](_0xe073b7)['then'](function(_0x4c940e){_0x26e8f1[_0x006f('0x1c')]=_0x4c940e;if(_0x3a782d[_0x006f('0x35')]['includeAll']){_0xf5844e[_0x006f('0x45')]=[{'all':!![]}];}return db[_0x006f('0x2f')][_0x006f('0x46')](_0xf5844e);})[_0x006f('0x26')](function(_0x4b4200){_0x26e8f1[_0x006f('0x47')]=_0x4b4200;return _0x26e8f1;})[_0x006f('0x26')](respondWithFilteredResult(_0x332a83,_0xf5844e))[_0x006f('0x48')](handleError(_0x332a83,null));};exports[_0x006f('0x49')]=function(_0x219885,_0x10f66f){var _0x479f31={'raw':!![],'where':{'id':_0x219885[_0x006f('0x4a')]['id']}},_0x2f4f9e={};_0x2f4f9e['model']=_[_0x006f('0x36')](db[_0x006f('0x2f')][_0x006f('0x30')]);_0x2f4f9e['query']=_['keys'](_0x219885[_0x006f('0x35')]);_0x2f4f9e[_0x006f('0x37')]=_['intersection'](_0x2f4f9e['model'],_0x2f4f9e[_0x006f('0x35')]);_0x479f31[_0x006f('0x39')]=_[_0x006f('0x38')](_0x2f4f9e[_0x006f('0x34')],qs[_0x006f('0x3a')](_0x219885[_0x006f('0x35')][_0x006f('0x3a')]));_0x479f31[_0x006f('0x39')]=_0x479f31[_0x006f('0x39')][_0x006f('0x3b')]?_0x479f31['attributes']:_0x2f4f9e['model'];if(_0x219885[_0x006f('0x35')][_0x006f('0x4b')]){_0x479f31[_0x006f('0x45')]=[{'all':!![]}];}_0x479f31=_['merge']({},_0x479f31,_0x219885['options']);return db['JscriptyAnswerReport'][_0x006f('0x4c')](_0x479f31)[_0x006f('0x26')](handleEntityNotFound(_0x10f66f,null))[_0x006f('0x26')](respondWithResult(_0x10f66f,null))['catch'](handleError(_0x10f66f,null));};exports['create']=function(_0x4cf9c7,_0x11ef88){return db[_0x006f('0x2f')][_0x006f('0x4d')](_0x4cf9c7['body'],{})[_0x006f('0x26')](respondWithResult(_0x11ef88,0xc9))[_0x006f('0x48')](handleError(_0x11ef88,null));};exports[_0x006f('0x24')]=function(_0x44ce70,_0x41d1c5){if(_0x44ce70[_0x006f('0x4e')]['id']){delete _0x44ce70['body']['id'];}return db[_0x006f('0x2f')]['find']({'where':{'id':_0x44ce70[_0x006f('0x4a')]['id']}})[_0x006f('0x26')](handleEntityNotFound(_0x41d1c5,null))[_0x006f('0x26')](saveUpdates(_0x44ce70[_0x006f('0x4e')],null))[_0x006f('0x26')](respondWithResult(_0x41d1c5,null))[_0x006f('0x48')](handleError(_0x41d1c5,null));};exports['destroy']=function(_0x7d0351,_0x21c2bc){return db['JscriptyAnswerReport'][_0x006f('0x4c')]({'where':{'id':_0x7d0351[_0x006f('0x4a')]['id']}})[_0x006f('0x26')](handleEntityNotFound(_0x21c2bc,null))[_0x006f('0x26')](removeEntity(_0x21c2bc,null))[_0x006f('0x48')](handleError(_0x21c2bc,null));};exports['describe']=function(_0x41cd02,_0x4369b5){return db[_0x006f('0x2f')][_0x006f('0x4f')]()[_0x006f('0x26')](respondWithResult(_0x4369b5,null))[_0x006f('0x48')](handleError(_0x4369b5,null));}; \ No newline at end of file +var _0xf293=['limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined'];(function(_0x4b46f3,_0x39a536){var _0x21a617=function(_0x11f216){while(--_0x11f216){_0x4b46f3['push'](_0x4b46f3['shift']());}};_0x21a617(++_0x39a536);}(_0xf293,0x114));var _0x3f29=function(_0x3572f7,_0x341eba){_0x3572f7=_0x3572f7-0x0;var _0x54df0e=_0xf293[_0x3572f7];return _0x54df0e;};'use strict';var emlformat=require(_0x3f29('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3f29('0x1'));var moment=require(_0x3f29('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3f29('0x3'));var util=require('util');var path=require(_0x3f29('0x4'));var sox=require(_0x3f29('0x5'));var csv=require(_0x3f29('0x6'));var ejs=require(_0x3f29('0x7'));var fs=require('fs');var fs_extra=require(_0x3f29('0x8'));var _=require(_0x3f29('0x9'));var squel=require('squel');var crypto=require(_0x3f29('0xa'));var jsforce=require(_0x3f29('0xb'));var deskjs=require(_0x3f29('0xc'));var toCsv=require(_0x3f29('0x6'));var querystring=require(_0x3f29('0xd'));var Papa=require(_0x3f29('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f29('0xf'));var as=require(_0x3f29('0x10'));var hardwareService=require(_0x3f29('0x11'));var logger=require(_0x3f29('0x12'))(_0x3f29('0x13'));var utils=require(_0x3f29('0x14'));var config=require(_0x3f29('0x15'));var licenseUtil=require(_0x3f29('0x16'));var db=require(_0x3f29('0x17'))['db'];function respondWithStatusCode(_0x2b1ff4,_0x236eb3){_0x236eb3=_0x236eb3||0xcc;return function(_0x18a80f){if(_0x18a80f){return _0x2b1ff4['sendStatus'](_0x236eb3);}return _0x2b1ff4[_0x3f29('0x18')](_0x236eb3)[_0x3f29('0x19')]();};}function respondWithResult(_0x2e1a68,_0x5eda0d){_0x5eda0d=_0x5eda0d||0xc8;return function(_0x12c3f1){if(_0x12c3f1){return _0x2e1a68['status'](_0x5eda0d)['json'](_0x12c3f1);}};}function respondWithFilteredResult(_0xc36ac4,_0xc419b2){return function(_0x4b57be){if(_0x4b57be){var _0x1b8447=typeof _0xc419b2[_0x3f29('0x1a')]===_0x3f29('0x1b')&&typeof _0xc419b2[_0x3f29('0x1c')]===_0x3f29('0x1b');var _0x3afd68=_0x4b57be['count'];var _0x18d776=_0x1b8447?0x0:_0xc419b2[_0x3f29('0x1a')];var _0x4ffda9=_0x1b8447?_0x4b57be[_0x3f29('0x1d')]:_0xc419b2['offset']+_0xc419b2[_0x3f29('0x1c')];var _0xc28a07;if(_0x4ffda9>=_0x3afd68){_0x4ffda9=_0x3afd68;_0xc28a07=0xc8;}else{_0xc28a07=0xce;}_0xc36ac4['status'](_0xc28a07);return _0xc36ac4[_0x3f29('0x1e')](_0x3f29('0x1f'),_0x18d776+'-'+_0x4ffda9+'/'+_0x3afd68)[_0x3f29('0x20')](_0x4b57be);}return null;};}function patchUpdates(_0x42e1d2){return function(_0x406baa){try{jsonpatch[_0x3f29('0x21')](_0x406baa,_0x42e1d2,!![]);}catch(_0x24ca75){return BPromise['reject'](_0x24ca75);}return _0x406baa[_0x3f29('0x22')]();};}function saveUpdates(_0x2d1ea2,_0x3b905d){return function(_0x5724f3){if(_0x5724f3){return _0x5724f3[_0x3f29('0x23')](_0x2d1ea2)[_0x3f29('0x24')](function(_0x30ae7e){return _0x30ae7e;});}return null;};}function removeEntity(_0x4d53fc,_0x12eb06){return function(_0x5a23a5){if(_0x5a23a5){return _0x5a23a5[_0x3f29('0x25')]()[_0x3f29('0x24')](function(){_0x4d53fc[_0x3f29('0x18')](0xcc)[_0x3f29('0x19')]();});}};}function handleEntityNotFound(_0x3137cd,_0x3e42ac){return function(_0x4f4006){if(!_0x4f4006){_0x3137cd['sendStatus'](0x194);}return _0x4f4006;};}function handleError(_0xb3286b,_0x4b37f6){_0x4b37f6=_0x4b37f6||0x1f4;return function(_0x47e48e){logger[_0x3f29('0x26')](_0x47e48e[_0x3f29('0x27')]);if(_0x47e48e[_0x3f29('0x28')]){delete _0x47e48e[_0x3f29('0x28')];}_0xb3286b['status'](_0x4b37f6)[_0x3f29('0x29')](_0x47e48e);};}exports['index']=function(_0x1fe034,_0x185c3b){var _0x14b548={},_0x41d1cd={},_0x3017a5={'count':0x0,'rows':[]};var _0x400dfc=_[_0x3f29('0x2a')](db[_0x3f29('0x2b')]['rawAttributes'],function(_0x36d122){return{'name':_0x36d122[_0x3f29('0x2c')],'type':_0x36d122[_0x3f29('0x2d')][_0x3f29('0x2e')]};});_0x41d1cd[_0x3f29('0x2f')]=_[_0x3f29('0x2a')](_0x400dfc,_0x3f29('0x28'));_0x41d1cd[_0x3f29('0x30')]=_[_0x3f29('0x31')](_0x1fe034[_0x3f29('0x30')]);_0x41d1cd[_0x3f29('0x32')]=_['intersection'](_0x41d1cd['model'],_0x41d1cd[_0x3f29('0x30')]);_0x14b548[_0x3f29('0x33')]=_[_0x3f29('0x34')](_0x41d1cd[_0x3f29('0x2f')],qs[_0x3f29('0x35')](_0x1fe034[_0x3f29('0x30')][_0x3f29('0x35')]));_0x14b548['attributes']=_0x14b548[_0x3f29('0x33')][_0x3f29('0x36')]?_0x14b548[_0x3f29('0x33')]:_0x41d1cd[_0x3f29('0x2f')];if(!_0x1fe034['query'][_0x3f29('0x37')](_0x3f29('0x38'))){_0x14b548['limit']=qs[_0x3f29('0x1c')](_0x1fe034[_0x3f29('0x30')]['limit']);_0x14b548[_0x3f29('0x1a')]=qs[_0x3f29('0x1a')](_0x1fe034[_0x3f29('0x30')][_0x3f29('0x1a')]);}_0x14b548[_0x3f29('0x39')]=qs['sort'](_0x1fe034['query'][_0x3f29('0x3a')]);_0x14b548[_0x3f29('0x3b')]=qs[_0x3f29('0x32')](_[_0x3f29('0x3c')](_0x1fe034[_0x3f29('0x30')],_0x41d1cd[_0x3f29('0x32')]),_0x400dfc);if(_0x1fe034[_0x3f29('0x30')][_0x3f29('0x3d')]){_0x14b548[_0x3f29('0x3b')]=_['merge'](_0x14b548[_0x3f29('0x3b')],{'$or':_[_0x3f29('0x2a')](_0x400dfc,function(_0x3800ce){if(_0x3800ce[_0x3f29('0x2d')]!==_0x3f29('0x3e')){var _0x7b8173={};_0x7b8173[_0x3800ce['name']]={'$like':'%'+_0x1fe034[_0x3f29('0x30')][_0x3f29('0x3d')]+'%'};return _0x7b8173;}})});}_0x14b548=_[_0x3f29('0x3f')]({},_0x14b548,_0x1fe034[_0x3f29('0x40')]);var _0x1c1e44={'where':_0x14b548[_0x3f29('0x3b')]};return db[_0x3f29('0x2b')]['count'](_0x1c1e44)[_0x3f29('0x24')](function(_0x47d28d){_0x3017a5[_0x3f29('0x1d')]=_0x47d28d;if(_0x1fe034[_0x3f29('0x30')][_0x3f29('0x41')]){_0x14b548[_0x3f29('0x42')]=[{'all':!![]}];}return db[_0x3f29('0x2b')][_0x3f29('0x43')](_0x14b548);})[_0x3f29('0x24')](function(_0x2a23b6){_0x3017a5[_0x3f29('0x44')]=_0x2a23b6;return _0x3017a5;})[_0x3f29('0x24')](respondWithFilteredResult(_0x185c3b,_0x14b548))[_0x3f29('0x45')](handleError(_0x185c3b,null));};exports[_0x3f29('0x46')]=function(_0xbe4c4e,_0x4820bf){var _0x2631db={'raw':!![],'where':{'id':_0xbe4c4e[_0x3f29('0x47')]['id']}},_0x282e9e={};_0x282e9e['model']=_[_0x3f29('0x31')](db[_0x3f29('0x2b')]['rawAttributes']);_0x282e9e[_0x3f29('0x30')]=_[_0x3f29('0x31')](_0xbe4c4e['query']);_0x282e9e[_0x3f29('0x32')]=_['intersection'](_0x282e9e[_0x3f29('0x2f')],_0x282e9e['query']);_0x2631db[_0x3f29('0x33')]=_[_0x3f29('0x34')](_0x282e9e['model'],qs[_0x3f29('0x35')](_0xbe4c4e[_0x3f29('0x30')][_0x3f29('0x35')]));_0x2631db[_0x3f29('0x33')]=_0x2631db[_0x3f29('0x33')][_0x3f29('0x36')]?_0x2631db[_0x3f29('0x33')]:_0x282e9e[_0x3f29('0x2f')];if(_0xbe4c4e[_0x3f29('0x30')]['includeAll']){_0x2631db[_0x3f29('0x42')]=[{'all':!![]}];}_0x2631db=_['merge']({},_0x2631db,_0xbe4c4e[_0x3f29('0x40')]);return db['JscriptyAnswerReport'][_0x3f29('0x48')](_0x2631db)['then'](handleEntityNotFound(_0x4820bf,null))['then'](respondWithResult(_0x4820bf,null))[_0x3f29('0x45')](handleError(_0x4820bf,null));};exports['create']=function(_0x184a29,_0x59b2f4){return db[_0x3f29('0x2b')][_0x3f29('0x49')](_0x184a29[_0x3f29('0x4a')],{})['then'](respondWithResult(_0x59b2f4,0xc9))[_0x3f29('0x45')](handleError(_0x59b2f4,null));};exports[_0x3f29('0x23')]=function(_0x28cfc0,_0x20c880){if(_0x28cfc0[_0x3f29('0x4a')]['id']){delete _0x28cfc0[_0x3f29('0x4a')]['id'];}return db[_0x3f29('0x2b')][_0x3f29('0x48')]({'where':{'id':_0x28cfc0['params']['id']}})['then'](handleEntityNotFound(_0x20c880,null))[_0x3f29('0x24')](saveUpdates(_0x28cfc0[_0x3f29('0x4a')],null))[_0x3f29('0x24')](respondWithResult(_0x20c880,null))[_0x3f29('0x45')](handleError(_0x20c880,null));};exports['destroy']=function(_0x1b5914,_0x14a307){return db[_0x3f29('0x2b')][_0x3f29('0x48')]({'where':{'id':_0x1b5914['params']['id']}})[_0x3f29('0x24')](handleEntityNotFound(_0x14a307,null))[_0x3f29('0x24')](removeEntity(_0x14a307,null))['catch'](handleError(_0x14a307,null));};exports[_0x3f29('0x4b')]=function(_0x21a642,_0xf7c5d5){return db['JscriptyAnswerReport'][_0x3f29('0x4b')]()[_0x3f29('0x24')](respondWithResult(_0xf7c5d5,null))['catch'](handleError(_0xf7c5d5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7709964..c5cba51 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 _0x17d7=['JscriptyAnswerReport','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x17d7,0x14b));var _0x717d=function(_0x1acf74,_0x4c04ef){_0x1acf74=_0x1acf74-0x0;var _0x5d425f=_0x17d7[_0x1acf74];return _0x5d425f;};'use strict';var _=require(_0x717d('0x0'));var util=require('util');var logger=require(_0x717d('0x1'))(_0x717d('0x2'));var moment=require(_0x717d('0x3'));var BPromise=require(_0x717d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x717d('0x5'));var config=require(_0x717d('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x717d('0x7')]=function(_0x18bf92,_0x3058ff){return _0x18bf92[_0x717d('0x8')](_0x717d('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe458=['moment','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api'];(function(_0x23c53a,_0x5c6704){var _0x2efde5=function(_0x24a538){while(--_0x24a538){_0x23c53a['push'](_0x23c53a['shift']());}};_0x2efde5(++_0x5c6704);}(_0xe458,0x81));var _0x8e45=function(_0x178ddf,_0x352479){_0x178ddf=_0x178ddf-0x0;var _0x1c3572=_0xe458[_0x178ddf];return _0x1c3572;};'use strict';var _=require(_0x8e45('0x0'));var util=require(_0x8e45('0x1'));var logger=require('../../config/logger')(_0x8e45('0x2'));var moment=require(_0x8e45('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e45('0x5'));var config=require(_0x8e45('0x6'));var attributes=require(_0x8e45('0x7'));module[_0x8e45('0x8')]=function(_0x26eec3,_0x6a01bc){return _0x26eec3[_0x8e45('0x9')](_0x8e45('0xa'),attributes,{'tableName':_0x8e45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index d4ce4bf..11fd085 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 _0xc60d=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x372d83,_0x4ea7c8){var _0x3c28d9=function(_0x18aaed){while(--_0x18aaed){_0x372d83['push'](_0x372d83['shift']());}};_0x3c28d9(++_0x4ea7c8);}(_0xc60d,0x1e8));var _0xdc60=function(_0x50c7d6,_0x43aaed){_0x50c7d6=_0x50c7d6-0x0;var _0x4e1b11=_0xc60d[_0x50c7d6];return _0x4e1b11;};'use strict';var _=require(_0xdc60('0x0'));var util=require(_0xdc60('0x1'));var moment=require('moment');var BPromise=require(_0xdc60('0x2'));var rs=require(_0xdc60('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc60('0x4'))['db'];var utils=require(_0xdc60('0x5'));var logger=require(_0xdc60('0x6'))(_0xdc60('0x7'));var config=require(_0xdc60('0x8'));var jayson=require(_0xdc60('0x9'));var client=jayson[_0xdc60('0xa')][_0xdc60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1afc54,_0x2d96cd,_0x83e7c1){return new BPromise(function(_0x5bdbcd,_0x49b35b){return client['request'](_0x1afc54,_0x83e7c1)['then'](function(_0x10ed04){logger[_0xdc60('0xc')](_0xdc60('0xd'),_0x2d96cd,_0xdc60('0xe'));logger[_0xdc60('0xf')](_0xdc60('0x10'),_0x2d96cd,_0xdc60('0xe'),JSON[_0xdc60('0x11')](_0x10ed04));if(_0x10ed04[_0xdc60('0x12')]){if(_0x10ed04[_0xdc60('0x12')][_0xdc60('0x13')]===0x1f4){logger[_0xdc60('0x12')](_0xdc60('0xd'),_0x2d96cd,_0x10ed04[_0xdc60('0x12')][_0xdc60('0x14')]);return _0x49b35b(_0x10ed04['error'][_0xdc60('0x14')]);}logger['error'](_0xdc60('0xd'),_0x2d96cd,_0x10ed04[_0xdc60('0x12')]['message']);return _0x5bdbcd(_0x10ed04['error'][_0xdc60('0x14')]);}else{logger[_0xdc60('0xc')](_0xdc60('0xd'),_0x2d96cd,_0xdc60('0xe'));_0x5bdbcd(_0x10ed04[_0xdc60('0x15')][_0xdc60('0x14')]);}})[_0xdc60('0x16')](function(_0x20a6d5){logger[_0xdc60('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2d96cd,_0x20a6d5);_0x49b35b(_0x20a6d5);});});} \ No newline at end of file +var _0x1801=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x1b5395,_0x7ba831){var _0x3557ca=function(_0x314f7f){while(--_0x314f7f){_0x1b5395['push'](_0x1b5395['shift']());}};_0x3557ca(++_0x7ba831);}(_0x1801,0x1eb));var _0x1180=function(_0x1c5a80,_0x3c53c7){_0x1c5a80=_0x1c5a80-0x0;var _0x211e6f=_0x1801[_0x1c5a80];return _0x211e6f;};'use strict';var _=require(_0x1180('0x0'));var util=require(_0x1180('0x1'));var moment=require(_0x1180('0x2'));var BPromise=require(_0x1180('0x3'));var rs=require(_0x1180('0x4'));var fs=require('fs');var Redis=require(_0x1180('0x5'));var db=require(_0x1180('0x6'))['db'];var utils=require(_0x1180('0x7'));var logger=require(_0x1180('0x8'))(_0x1180('0x9'));var config=require(_0x1180('0xa'));var jayson=require(_0x1180('0xb'));var client=jayson[_0x1180('0xc')][_0x1180('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xd82bdf,_0x4f863d,_0x976063){return new BPromise(function(_0x24c348,_0x3151fc){return client[_0x1180('0xe')](_0xd82bdf,_0x976063)[_0x1180('0xf')](function(_0x4430f9){logger[_0x1180('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f863d,_0x1180('0x11'));logger[_0x1180('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4f863d,_0x1180('0x11'),JSON[_0x1180('0x13')](_0x4430f9));if(_0x4430f9[_0x1180('0x14')]){if(_0x4430f9[_0x1180('0x14')][_0x1180('0x15')]===0x1f4){logger[_0x1180('0x14')](_0x1180('0x16'),_0x4f863d,_0x4430f9[_0x1180('0x14')][_0x1180('0x17')]);return _0x3151fc(_0x4430f9['error'][_0x1180('0x17')]);}logger[_0x1180('0x14')](_0x1180('0x16'),_0x4f863d,_0x4430f9['error'][_0x1180('0x17')]);return _0x24c348(_0x4430f9['error']['message']);}else{logger[_0x1180('0x10')](_0x1180('0x16'),_0x4f863d,_0x1180('0x11'));_0x24c348(_0x4430f9[_0x1180('0x18')][_0x1180('0x17')]);}})[_0x1180('0x19')](function(_0x847dcd){logger[_0x1180('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f863d,_0x847dcd);_0x3151fc(_0x847dcd);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index c93f46c..bafced7 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 _0xffd6=['Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','/:id/clone','clone','update','destroy','multer','util','path'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xffd6,0x97));var _0x6ffd=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0xffd6[_0x5c78d9];return _0x69ae1f;};'use strict';var multer=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var path=require(_0x6ffd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ffd('0x3')]();var fs_extra=require(_0x6ffd('0x4'));var auth=require(_0x6ffd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ffd('0x6'));var controller=require(_0x6ffd('0x7'));router[_0x6ffd('0x8')]('/',auth[_0x6ffd('0x9')](),controller['index']);router[_0x6ffd('0x8')](_0x6ffd('0xa'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xb')]);router[_0x6ffd('0x8')]('/:id/sessions',auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xc')]);router['get'](_0x6ffd('0xd'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xe')]);router[_0x6ffd('0x8')](_0x6ffd('0xf'),auth[_0x6ffd('0x9')](),timeout(_0x6ffd('0x10')),controller['getSummary']);router[_0x6ffd('0x11')]('/',auth[_0x6ffd('0x9')](),controller['create']);router[_0x6ffd('0x11')](_0x6ffd('0x12'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0x13')]);router['put'](_0x6ffd('0xa'),auth['isAuthenticated'](),controller[_0x6ffd('0x14')]);router['delete'](_0x6ffd('0xa'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7880=['create','/:id/clone','clone','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post'];(function(_0x67131e,_0x36b994){var _0x902116=function(_0xfa0078){while(--_0xfa0078){_0x67131e['push'](_0x67131e['shift']());}};_0x902116(++_0x36b994);}(_0x7880,0x1f4));var _0x0788=function(_0x1f5303,_0x354414){_0x1f5303=_0x1f5303-0x0;var _0x84ef1a=_0x7880[_0x1f5303];return _0x84ef1a;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['get'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x11')]);router[_0x0788('0x9')](_0x0788('0x12'),auth['isAuthenticated'](),timeout(_0x0788('0x13')),controller[_0x0788('0x14')]);router[_0x0788('0x15')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0x16')]);router[_0x0788('0x15')](_0x0788('0x17'),auth['isAuthenticated'](),controller[_0x0788('0x18')]);router[_0x0788('0x19')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x1a')]('/:id',auth[_0x0788('0xa')](),controller[_0x0788('0x1b')]);module[_0x0788('0x1c')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 27133cd..d99cf88 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 _0x24a0=['setDataValue','stringify','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING','name','TEXT','long'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x24a0,0x13c));var _0x024a=function(_0x4f103d,_0x42dce8){_0x4f103d=_0x4f103d-0x0;var _0x3b14b2=_0x24a0[_0x4f103d];return _0x3b14b2;};'use strict';var Sequelize=require(_0x024a('0x0'));var _=require('lodash');var util=require('util');module[_0x024a('0x1')]={'name':{'type':Sequelize[_0x024a('0x2')],'unique':_0x024a('0x3')},'description':{'type':Sequelize[_0x024a('0x2')]},'formData':{'type':Sequelize[_0x024a('0x4')](_0x024a('0x5')),'set':function(_0x1f083a){if(_['isObjectLike'](_0x1f083a)){this[_0x024a('0x6')]('formData',JSON[_0x024a('0x7')](_0x1f083a));}else if(_['isString'](_0x1f083a)){this[_0x024a('0x6')]('formData',_0x1f083a);}else{this[_0x024a('0x6')](_0x024a('0x8'),util[_0x024a('0x9')](_0x024a('0xa'),this[_0x024a('0xb')](_0x024a('0x3'))||'',this[_0x024a('0xb')](_0x024a('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x024a('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x024a('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x2338=['sequelize','lodash','util','exports','name','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x37d6b8,_0x525b5b){var _0x318611=function(_0x484847){while(--_0x484847){_0x37d6b8['push'](_0x37d6b8['shift']());}};_0x318611(++_0x525b5b);}(_0x2338,0x66));var _0x8233=function(_0x307b6f,_0x173287){_0x307b6f=_0x307b6f-0x0;var _0x4a2119=_0x2338[_0x307b6f];return _0x4a2119;};'use strict';var Sequelize=require(_0x8233('0x0'));var _=require(_0x8233('0x1'));var util=require(_0x8233('0x2'));module[_0x8233('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x8233('0x4')},'description':{'type':Sequelize[_0x8233('0x5')]},'formData':{'type':Sequelize[_0x8233('0x6')](_0x8233('0x7')),'set':function(_0x133515){if(_[_0x8233('0x8')](_0x133515)){this[_0x8233('0x9')](_0x8233('0xa'),JSON[_0x8233('0xb')](_0x133515));}else if(_['isString'](_0x133515)){this[_0x8233('0x9')](_0x8233('0xa'),_0x133515);}else{this[_0x8233('0x9')](_0x8233('0xa'),util[_0x8233('0xc')](_0x8233('0xd'),this[_0x8233('0xe')](_0x8233('0x4'))||'',this[_0x8233('0xe')](_0x8233('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8233('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a7093c9..c0e4ecc 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 _0xa9e0=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','Projects','UserProfileSection','params','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','SessionId','answer','push','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x221f25,_0x389676){var _0x17be81=function(_0x22e79f){while(--_0x22e79f){_0x221f25['push'](_0x221f25['shift']());}};_0x17be81(++_0x389676);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x24')]({'plain':!![]});var _0x16b1ca='Projects';return db['UserProfileResource'][_0x0a9e('0x23')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x22')](function(){return _0x2fb0e4;});})[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x17')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x563b45){return{'name':_0x563b45[_0x0a9e('0x2c')],'type':_0x563b45[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x5c877d['model']=_[_0x0a9e('0x29')](_0x40e7a3,'name');_0x5c877d[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x468813[_0x0a9e('0x2f')]);_0x5c877d[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2f')]);_0x2ec755[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5c877d[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2ec755[_0x0a9e('0x33')]=_0x2ec755['attributes'][_0x0a9e('0x36')]?_0x2ec755['attributes']:_0x5c877d[_0x0a9e('0x34')];if(!_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2ec755['limit']=qs[_0x0a9e('0x1a')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x1a')]);_0x2ec755[_0x0a9e('0x1b')]=qs['offset'](_0x468813['query'][_0x0a9e('0x1b')]);}_0x2ec755['order']=qs[_0x0a9e('0x39')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x39')]);_0x2ec755[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3b')](_0x468813[_0x0a9e('0x2f')],_0x5c877d[_0x0a9e('0x31')]),_0x40e7a3);if(_0x468813['query'][_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2ec755['where'],{'$or':_['map'](_0x40e7a3,function(_0x11b61d){if(_0x11b61d[_0x0a9e('0x2d')]!=='VIRTUAL'){var _0x2b814e={};_0x2b814e[_0x11b61d[_0x0a9e('0x27')]]={'$like':'%'+_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x2b814e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813['options']);var _0x15e37d={'where':_0x2ec755[_0x0a9e('0x3a')]};return db['JscriptyProject'][_0x0a9e('0x1c')](_0x15e37d)[_0x0a9e('0x22')](function(_0x1459bb){_0x15b200['count']=_0x1459bb;if(_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3e')]){_0x2ec755[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x2ec755);})[_0x0a9e('0x22')](function(_0x2881b3){_0x15b200[_0x0a9e('0x41')]=_0x2881b3;return _0x15b200;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x148007,_0x1a7bce){var _0x11ca30={'raw':![],'where':{'id':_0x148007['params']['id']}},_0x37f6cc={};_0x37f6cc['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x37f6cc[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x148007[_0x0a9e('0x2f')]);_0x37f6cc[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x37f6cc[_0x0a9e('0x34')],_0x37f6cc[_0x0a9e('0x2f')]);_0x11ca30[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x37f6cc['model'],qs[_0x0a9e('0x35')](_0x148007[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x11ca30[_0x0a9e('0x33')]=_0x11ca30[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x11ca30[_0x0a9e('0x33')]:_0x37f6cc[_0x0a9e('0x34')];if(_0x148007['query'][_0x0a9e('0x3e')]){_0x11ca30['include']=[{'all':!![]}];}_0x11ca30=_[_0x0a9e('0x3d')]({},_0x11ca30,_0x148007[_0x0a9e('0x44')]);return db[_0x0a9e('0x2a')]['find'](_0x11ca30)[_0x0a9e('0x22')](handleEntityNotFound(_0x1a7bce,null))[_0x0a9e('0x22')](respondWithResult(_0x1a7bce,null))[_0x0a9e('0x42')](handleError(_0x1a7bce,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x2a')]['create'](_0x45c845[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](function(_0x1b5e80){var _0x16f976=_0x45c845[_0x0a9e('0x47')][_0x0a9e('0x24')]({'plain':!![]});if(!_0x16f976)throw new Error(_0x0a9e('0x48'));if(_0x16f976[_0x0a9e('0x49')]===_0x0a9e('0x47')){var _0x58a5c2=_0x1b5e80[_0x0a9e('0x24')]({'plain':!![]});var _0x3fe430='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x3fe430,'userProfileId':_0x16f976[_0x0a9e('0x4a')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x37edaa){if(_0x37edaa&&_0x37edaa[_0x0a9e('0x4b')]===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x58a5c2[_0x0a9e('0x27')],'resourceId':_0x58a5c2['id'],'type':_0x37edaa[_0x0a9e('0x27')],'sectionId':_0x37edaa['id']},{})['then'](function(){return _0x1b5e80;});}else{return _0x1b5e80;}})['catch'](function(_0x53975a){logger[_0x0a9e('0x25')](_0x0a9e('0x4d'),_0x53975a);throw _0x53975a;});}return _0x1b5e80;})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))['catch'](handleError(_0x37be73,null));};exports[_0x0a9e('0x4e')]=function(_0x161aa7,_0x53d113){var _0x5a88da={'where':{'id':_0x161aa7['params']['id']}},_0x2ef381={};_0x2ef381[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x5a88da[_0x0a9e('0x33')]=_['intersection'](_0x2ef381[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x161aa7['query']['fields']));_0x5a88da[_0x0a9e('0x33')]=_0x5a88da[_0x0a9e('0x33')]['length']?_0x5a88da[_0x0a9e('0x33')]:_0x2ef381['model'];if(_0x161aa7[_0x0a9e('0x2f')]['includeAll']){_0x5a88da[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x5a88da=_['merge']({},_0x5a88da,_0x161aa7['options']);return db['JscriptyProject'][_0x0a9e('0x4f')](_0x5a88da)['then'](handleEntityNotFound(_0x53d113,null))[_0x0a9e('0x22')](function(_0x65432){if(_0x65432){var _0x3cfd00=_0x65432[_0x0a9e('0x24')]({'plain':!![]});_0x3cfd00=qs[_0x0a9e('0x50')](_0x3cfd00,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x161aa7[_0x0a9e('0x46')]=_['omit'](_0x161aa7[_0x0a9e('0x46')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x45')](_[_0x0a9e('0x3d')](_0x3cfd00,_0x161aa7['body']),{'include':_0x161aa7[_0x0a9e('0x2f')][_0x0a9e('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x3649cc){var _0x5cc8fb=_0x161aa7[_0x0a9e('0x47')]['get']({'plain':!![]});if(!_0x5cc8fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc8fb['role']===_0x0a9e('0x47')){var _0x49d231=_0x3649cc[_0x0a9e('0x24')]({'plain':!![]});var _0x1fc70e=_0x0a9e('0x53');return db[_0x0a9e('0x54')][_0x0a9e('0x4f')]({'where':{'name':_0x1fc70e,'userProfileId':_0x5cc8fb[_0x0a9e('0x4a')]},'raw':!![]})['then'](function(_0x1627a7){if(_0x1627a7&&_0x1627a7['autoAssociation']===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x49d231[_0x0a9e('0x27')],'resourceId':_0x49d231['id'],'type':_0x1627a7['name'],'sectionId':_0x1627a7['id']},{})[_0x0a9e('0x22')](function(){return _0x3649cc;});}else{return _0x3649cc;}})[_0x0a9e('0x42')](function(_0x119677){logger[_0x0a9e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x119677);throw _0x119677;});}return _0x3649cc;});}})[_0x0a9e('0x22')](respondWithResult(_0x53d113,0xc9))[_0x0a9e('0x42')](handleError(_0x53d113,null));};exports['update']=function(_0x797b45,_0x17e88c){if(_0x797b45[_0x0a9e('0x46')]['id']){delete _0x797b45[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x797b45[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x17e88c,null))[_0x0a9e('0x22')](saveUpdates(_0x797b45['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x17e88c,null))['catch'](handleError(_0x17e88c,null));};exports['destroy']=function(_0x242745,_0x4556c5){return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'id':_0x242745[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x22')](removeEntity(_0x4556c5,null))[_0x0a9e('0x42')](handleError(_0x4556c5,null));};exports[_0x0a9e('0x56')]=function(_0x1cc4f3,_0x2e89b7,_0x19012b){var _0x2bbb86={'raw':!![],'where':{}};var _0x2b8192={};var _0x320898={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x1cc4f3[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e89b7,null))[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){_0x2b8192[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x58')][_0x0a9e('0x2b')]);_0x2b8192['query']=_[_0x0a9e('0x30')](_0x1cc4f3[_0x0a9e('0x2f')]);_0x2b8192[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x2b8192[_0x0a9e('0x34')],_0x2b8192['query']);_0x2bbb86['attributes']=_['intersection'](_0x2b8192[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2bbb86[_0x0a9e('0x33')]=_0x2bbb86[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x2bbb86[_0x0a9e('0x33')]:_0x2b8192['model'];if(!_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2bbb86['limit']=qs[_0x0a9e('0x1a')](_0x1cc4f3['query'][_0x0a9e('0x1a')]);_0x2bbb86[_0x0a9e('0x1b')]=qs['offset'](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x2bbb86[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x1cc4f3['query'][_0x0a9e('0x39')]);_0x2bbb86[_0x0a9e('0x3a')]=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x1cc4f3['query'],_0x2b8192[_0x0a9e('0x31')]));_0x2bbb86[_0x0a9e('0x3a')][_0x0a9e('0x5a')]=_0x295763['id'];if(_0x1cc4f3[_0x0a9e('0x2f')]['filter']){_0x2bbb86[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2bbb86[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x2bbb86[_0x0a9e('0x33')],function(_0xdb98ca){var _0x40fc56={};_0x40fc56[_0xdb98ca]={'$like':'%'+_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x40fc56;})});}_0x2bbb86=_[_0x0a9e('0x3d')]({},_0x2bbb86,_0x1cc4f3[_0x0a9e('0x44')]);return db[_0x0a9e('0x58')][_0x0a9e('0x1c')]({'where':_0x2bbb86[_0x0a9e('0x3a')]})['then'](function(_0xf4120f){_0x320898[_0x0a9e('0x1c')]=_0xf4120f;if(_0x1cc4f3[_0x0a9e('0x2f')]['includeAll']){_0x2bbb86[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x58')][_0x0a9e('0x40')](_0x2bbb86);})[_0x0a9e('0x22')](function(_0x56d650){_0x320898['rows']=_0x56d650;return _0x320898;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2e89b7,_0x2bbb86))[_0x0a9e('0x42')](handleError(_0x2e89b7,null));};exports['getAnswers']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={'raw':!![],'where':{}};var _0x5637a1={};var _0x28a942={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x45108c[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x22')](function(_0x444f1f){if(_0x444f1f){_0x5637a1['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x5b')][_0x0a9e('0x2b')]);_0x5637a1[_0x0a9e('0x2f')]=_['keys'](_0x45108c[_0x0a9e('0x2f')]);_0x5637a1[_0x0a9e('0x31')]=_['intersection'](_0x5637a1[_0x0a9e('0x34')],_0x5637a1['query']);_0x8ebf02[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5637a1[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x45108c['query']['fields']));_0x8ebf02[_0x0a9e('0x33')]=_0x8ebf02[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x8ebf02['attributes']:_0x5637a1[_0x0a9e('0x34')];if(!_0x45108c[_0x0a9e('0x2f')]['hasOwnProperty']('nolimit')){_0x8ebf02[_0x0a9e('0x1a')]=qs['limit'](_0x45108c['query']['limit']);_0x8ebf02[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x8ebf02[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x45108c['query'][_0x0a9e('0x39')]);_0x8ebf02['where']=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x45108c[_0x0a9e('0x2f')],_0x5637a1[_0x0a9e('0x31')]));_0x8ebf02['where'][_0x0a9e('0x5a')]=_0x444f1f['id'];if(_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]){_0x8ebf02['where']=_[_0x0a9e('0x3d')](_0x8ebf02[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x8ebf02[_0x0a9e('0x33')],function(_0x255e49){var _0x1910bf={};_0x1910bf[_0x255e49]={'$like':'%'+_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x1910bf;})});}_0x8ebf02=_['merge']({},_0x8ebf02,_0x45108c[_0x0a9e('0x44')]);return db[_0x0a9e('0x5b')]['count']({'where':_0x8ebf02[_0x0a9e('0x3a')]})[_0x0a9e('0x22')](function(_0x3a1974){_0x28a942['count']=_0x3a1974;if(_0x45108c[_0x0a9e('0x2f')]['includeAll']){_0x8ebf02[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5b')][_0x0a9e('0x40')](_0x8ebf02);})[_0x0a9e('0x22')](function(_0x842d6f){_0x28a942[_0x0a9e('0x41')]=_0x842d6f;return _0x28a942;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x53a6a1,_0x8ebf02))[_0x0a9e('0x42')](handleError(_0x53a6a1,null));};function char(_0x501050){return _0x0a9e('0x5c')===typeof _0x501050?String[_0x0a9e('0x5d')][_0x0a9e('0x1f')](null,arguments):_0x501050;}function needsEncapsulation(_0x30ef6e){return!!_0x30ef6e&&(_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xd))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xa))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x2c))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x18273f){var _0x4989f9=char(0x22),_0xc81b64='\x5c'+char(0x22),_0x23e2bd=_0x18273f[_0x0a9e('0x5e')]()[_0x0a9e('0x60')](new RegExp(_0x4989f9,'g'),_0xc81b64);return _0x4989f9+_0x23e2bd+_0x4989f9;}exports[_0x0a9e('0x61')]=function(_0x5d9ddb,_0x3afc8c,_0x1756c7){var _0x5ce99d,_0x23b447;var _0x5e725e={'where':{'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']}};if(_0x5d9ddb[_0x0a9e('0x2f')][_0x0a9e('0x62')]){_0x5e725e[_0x0a9e('0x3a')]['starttime']=JSON[_0x0a9e('0x63')](_0x5d9ddb['query'][_0x0a9e('0x62')]);}return db[_0x0a9e('0x58')]['findAll'](_0x5e725e)[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x1dd541){if(_0x1dd541){_0x5ce99d=_0x1dd541;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x0a9e('0x29')](_0x5ce99d,'id')},'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']},'order':_0x0a9e('0x64')});}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x2450a8){if(_0x2450a8){_0x23b447=_0x2450a8;var _0x17793e={};for(var _0x3c75b9=0x0,_0x3f8124=_0x23b447['length'];_0x3c75b9<_0x3f8124;_0x3c75b9++){if(!_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x3c75b9]['questionId'])){_0x17793e[_0x23b447[_0x3c75b9][_0x0a9e('0x65')]]=needsEncapsulation(_0x23b447[_0x3c75b9][_0x0a9e('0x66')])?encapsulate(_0x23b447[_0x3c75b9][_0x0a9e('0x66')]):_0x23b447[_0x3c75b9][_0x0a9e('0x66')];}}var _0x1b61d5=[],_0x4e7273={};for(var _0x436313=0x0,_0x4667bf=_0x5ce99d[_0x0a9e('0x36')];_0x436313<_0x4667bf;_0x436313++){_0x4e7273={'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id'],'SessionId':_0x5ce99d[_0x436313]['id'],'StartTime':moment(_0x5ce99d[_0x436313][_0x0a9e('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x22a3cb=0x0,_0x583662=_0x23b447[_0x0a9e('0x36')];_0x22a3cb<_0x583662;_0x22a3cb++){if(_0x23b447[_0x22a3cb][_0x0a9e('0x68')]==_0x5ce99d[_0x436313]['id']&&_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x22a3cb][_0x0a9e('0x65')])){_0x4e7273[_0x17793e[_0x23b447[_0x22a3cb][_0x0a9e('0x65')]]]=_0x23b447[_0x22a3cb][_0x0a9e('0x69')];}}for(var _0x596312 in _0x17793e){if(!_0x4e7273['hasOwnProperty'](_0x17793e[_0x596312])){_0x4e7273[_0x17793e[_0x596312]]=null;}}_0x1b61d5[_0x0a9e('0x6a')](_0x4e7273);}return _0x1b61d5;}})['then'](function(_0x2469d1){if(!_['isEmpty'](_0x2469d1)){var _0x427ccc=toCsv(_0x2469d1);var _0x564db2=Date['now']();fs[_0x0a9e('0x6b')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2),_0x427ccc);_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x6e'),_0x0a9e('0x6f')+util[_0x0a9e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb['params']['id'],_0x564db2));_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x70'),_0x0a9e('0x71'));return _0x3afc8c[_0x0a9e('0x72')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2));}else{return _0x3afc8c[_0x0a9e('0x15')](0xcc);}})['catch'](handleError(_0x3afc8c,null));}; \ No newline at end of file +var _0xa9e0=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','Projects','UserProfileSection','params','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','SessionId','answer','push','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x3c5e6b,_0x31674d){var _0x2c33ba=function(_0x55b146){while(--_0x55b146){_0x3c5e6b['push'](_0x3c5e6b['shift']());}};_0x2c33ba(++_0x31674d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x24')]({'plain':!![]});var _0x16b1ca='Projects';return db['UserProfileResource'][_0x0a9e('0x23')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x22')](function(){return _0x2fb0e4;});})[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x17')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x563b45){return{'name':_0x563b45[_0x0a9e('0x2c')],'type':_0x563b45[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x5c877d['model']=_[_0x0a9e('0x29')](_0x40e7a3,'name');_0x5c877d[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x468813[_0x0a9e('0x2f')]);_0x5c877d[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2f')]);_0x2ec755[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5c877d[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2ec755[_0x0a9e('0x33')]=_0x2ec755['attributes'][_0x0a9e('0x36')]?_0x2ec755['attributes']:_0x5c877d[_0x0a9e('0x34')];if(!_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2ec755['limit']=qs[_0x0a9e('0x1a')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x1a')]);_0x2ec755[_0x0a9e('0x1b')]=qs['offset'](_0x468813['query'][_0x0a9e('0x1b')]);}_0x2ec755['order']=qs[_0x0a9e('0x39')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x39')]);_0x2ec755[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3b')](_0x468813[_0x0a9e('0x2f')],_0x5c877d[_0x0a9e('0x31')]),_0x40e7a3);if(_0x468813['query'][_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2ec755['where'],{'$or':_['map'](_0x40e7a3,function(_0x11b61d){if(_0x11b61d[_0x0a9e('0x2d')]!=='VIRTUAL'){var _0x2b814e={};_0x2b814e[_0x11b61d[_0x0a9e('0x27')]]={'$like':'%'+_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x2b814e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813['options']);var _0x15e37d={'where':_0x2ec755[_0x0a9e('0x3a')]};return db['JscriptyProject'][_0x0a9e('0x1c')](_0x15e37d)[_0x0a9e('0x22')](function(_0x1459bb){_0x15b200['count']=_0x1459bb;if(_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3e')]){_0x2ec755[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x2ec755);})[_0x0a9e('0x22')](function(_0x2881b3){_0x15b200[_0x0a9e('0x41')]=_0x2881b3;return _0x15b200;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x148007,_0x1a7bce){var _0x11ca30={'raw':![],'where':{'id':_0x148007['params']['id']}},_0x37f6cc={};_0x37f6cc['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x37f6cc[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x148007[_0x0a9e('0x2f')]);_0x37f6cc[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x37f6cc[_0x0a9e('0x34')],_0x37f6cc[_0x0a9e('0x2f')]);_0x11ca30[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x37f6cc['model'],qs[_0x0a9e('0x35')](_0x148007[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x11ca30[_0x0a9e('0x33')]=_0x11ca30[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x11ca30[_0x0a9e('0x33')]:_0x37f6cc[_0x0a9e('0x34')];if(_0x148007['query'][_0x0a9e('0x3e')]){_0x11ca30['include']=[{'all':!![]}];}_0x11ca30=_[_0x0a9e('0x3d')]({},_0x11ca30,_0x148007[_0x0a9e('0x44')]);return db[_0x0a9e('0x2a')]['find'](_0x11ca30)[_0x0a9e('0x22')](handleEntityNotFound(_0x1a7bce,null))[_0x0a9e('0x22')](respondWithResult(_0x1a7bce,null))[_0x0a9e('0x42')](handleError(_0x1a7bce,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x2a')]['create'](_0x45c845[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](function(_0x1b5e80){var _0x16f976=_0x45c845[_0x0a9e('0x47')][_0x0a9e('0x24')]({'plain':!![]});if(!_0x16f976)throw new Error(_0x0a9e('0x48'));if(_0x16f976[_0x0a9e('0x49')]===_0x0a9e('0x47')){var _0x58a5c2=_0x1b5e80[_0x0a9e('0x24')]({'plain':!![]});var _0x3fe430='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x3fe430,'userProfileId':_0x16f976[_0x0a9e('0x4a')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x37edaa){if(_0x37edaa&&_0x37edaa[_0x0a9e('0x4b')]===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x58a5c2[_0x0a9e('0x27')],'resourceId':_0x58a5c2['id'],'type':_0x37edaa[_0x0a9e('0x27')],'sectionId':_0x37edaa['id']},{})['then'](function(){return _0x1b5e80;});}else{return _0x1b5e80;}})['catch'](function(_0x53975a){logger[_0x0a9e('0x25')](_0x0a9e('0x4d'),_0x53975a);throw _0x53975a;});}return _0x1b5e80;})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))['catch'](handleError(_0x37be73,null));};exports[_0x0a9e('0x4e')]=function(_0x161aa7,_0x53d113){var _0x5a88da={'where':{'id':_0x161aa7['params']['id']}},_0x2ef381={};_0x2ef381[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x5a88da[_0x0a9e('0x33')]=_['intersection'](_0x2ef381[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x161aa7['query']['fields']));_0x5a88da[_0x0a9e('0x33')]=_0x5a88da[_0x0a9e('0x33')]['length']?_0x5a88da[_0x0a9e('0x33')]:_0x2ef381['model'];if(_0x161aa7[_0x0a9e('0x2f')]['includeAll']){_0x5a88da[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x5a88da=_['merge']({},_0x5a88da,_0x161aa7['options']);return db['JscriptyProject'][_0x0a9e('0x4f')](_0x5a88da)['then'](handleEntityNotFound(_0x53d113,null))[_0x0a9e('0x22')](function(_0x65432){if(_0x65432){var _0x3cfd00=_0x65432[_0x0a9e('0x24')]({'plain':!![]});_0x3cfd00=qs[_0x0a9e('0x50')](_0x3cfd00,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x161aa7[_0x0a9e('0x46')]=_['omit'](_0x161aa7[_0x0a9e('0x46')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x45')](_[_0x0a9e('0x3d')](_0x3cfd00,_0x161aa7['body']),{'include':_0x161aa7[_0x0a9e('0x2f')][_0x0a9e('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x3649cc){var _0x5cc8fb=_0x161aa7[_0x0a9e('0x47')]['get']({'plain':!![]});if(!_0x5cc8fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc8fb['role']===_0x0a9e('0x47')){var _0x49d231=_0x3649cc[_0x0a9e('0x24')]({'plain':!![]});var _0x1fc70e=_0x0a9e('0x53');return db[_0x0a9e('0x54')][_0x0a9e('0x4f')]({'where':{'name':_0x1fc70e,'userProfileId':_0x5cc8fb[_0x0a9e('0x4a')]},'raw':!![]})['then'](function(_0x1627a7){if(_0x1627a7&&_0x1627a7['autoAssociation']===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x49d231[_0x0a9e('0x27')],'resourceId':_0x49d231['id'],'type':_0x1627a7['name'],'sectionId':_0x1627a7['id']},{})[_0x0a9e('0x22')](function(){return _0x3649cc;});}else{return _0x3649cc;}})[_0x0a9e('0x42')](function(_0x119677){logger[_0x0a9e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x119677);throw _0x119677;});}return _0x3649cc;});}})[_0x0a9e('0x22')](respondWithResult(_0x53d113,0xc9))[_0x0a9e('0x42')](handleError(_0x53d113,null));};exports['update']=function(_0x797b45,_0x17e88c){if(_0x797b45[_0x0a9e('0x46')]['id']){delete _0x797b45[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x797b45[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x17e88c,null))[_0x0a9e('0x22')](saveUpdates(_0x797b45['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x17e88c,null))['catch'](handleError(_0x17e88c,null));};exports['destroy']=function(_0x242745,_0x4556c5){return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'id':_0x242745[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x22')](removeEntity(_0x4556c5,null))[_0x0a9e('0x42')](handleError(_0x4556c5,null));};exports[_0x0a9e('0x56')]=function(_0x1cc4f3,_0x2e89b7,_0x19012b){var _0x2bbb86={'raw':!![],'where':{}};var _0x2b8192={};var _0x320898={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x1cc4f3[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e89b7,null))[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){_0x2b8192[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x58')][_0x0a9e('0x2b')]);_0x2b8192['query']=_[_0x0a9e('0x30')](_0x1cc4f3[_0x0a9e('0x2f')]);_0x2b8192[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x2b8192[_0x0a9e('0x34')],_0x2b8192['query']);_0x2bbb86['attributes']=_['intersection'](_0x2b8192[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2bbb86[_0x0a9e('0x33')]=_0x2bbb86[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x2bbb86[_0x0a9e('0x33')]:_0x2b8192['model'];if(!_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2bbb86['limit']=qs[_0x0a9e('0x1a')](_0x1cc4f3['query'][_0x0a9e('0x1a')]);_0x2bbb86[_0x0a9e('0x1b')]=qs['offset'](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x2bbb86[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x1cc4f3['query'][_0x0a9e('0x39')]);_0x2bbb86[_0x0a9e('0x3a')]=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x1cc4f3['query'],_0x2b8192[_0x0a9e('0x31')]));_0x2bbb86[_0x0a9e('0x3a')][_0x0a9e('0x5a')]=_0x295763['id'];if(_0x1cc4f3[_0x0a9e('0x2f')]['filter']){_0x2bbb86[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2bbb86[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x2bbb86[_0x0a9e('0x33')],function(_0xdb98ca){var _0x40fc56={};_0x40fc56[_0xdb98ca]={'$like':'%'+_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x40fc56;})});}_0x2bbb86=_[_0x0a9e('0x3d')]({},_0x2bbb86,_0x1cc4f3[_0x0a9e('0x44')]);return db[_0x0a9e('0x58')][_0x0a9e('0x1c')]({'where':_0x2bbb86[_0x0a9e('0x3a')]})['then'](function(_0xf4120f){_0x320898[_0x0a9e('0x1c')]=_0xf4120f;if(_0x1cc4f3[_0x0a9e('0x2f')]['includeAll']){_0x2bbb86[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x58')][_0x0a9e('0x40')](_0x2bbb86);})[_0x0a9e('0x22')](function(_0x56d650){_0x320898['rows']=_0x56d650;return _0x320898;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2e89b7,_0x2bbb86))[_0x0a9e('0x42')](handleError(_0x2e89b7,null));};exports['getAnswers']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={'raw':!![],'where':{}};var _0x5637a1={};var _0x28a942={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x45108c[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x22')](function(_0x444f1f){if(_0x444f1f){_0x5637a1['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x5b')][_0x0a9e('0x2b')]);_0x5637a1[_0x0a9e('0x2f')]=_['keys'](_0x45108c[_0x0a9e('0x2f')]);_0x5637a1[_0x0a9e('0x31')]=_['intersection'](_0x5637a1[_0x0a9e('0x34')],_0x5637a1['query']);_0x8ebf02[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5637a1[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x45108c['query']['fields']));_0x8ebf02[_0x0a9e('0x33')]=_0x8ebf02[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x8ebf02['attributes']:_0x5637a1[_0x0a9e('0x34')];if(!_0x45108c[_0x0a9e('0x2f')]['hasOwnProperty']('nolimit')){_0x8ebf02[_0x0a9e('0x1a')]=qs['limit'](_0x45108c['query']['limit']);_0x8ebf02[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x8ebf02[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x45108c['query'][_0x0a9e('0x39')]);_0x8ebf02['where']=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x45108c[_0x0a9e('0x2f')],_0x5637a1[_0x0a9e('0x31')]));_0x8ebf02['where'][_0x0a9e('0x5a')]=_0x444f1f['id'];if(_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]){_0x8ebf02['where']=_[_0x0a9e('0x3d')](_0x8ebf02[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x8ebf02[_0x0a9e('0x33')],function(_0x255e49){var _0x1910bf={};_0x1910bf[_0x255e49]={'$like':'%'+_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x1910bf;})});}_0x8ebf02=_['merge']({},_0x8ebf02,_0x45108c[_0x0a9e('0x44')]);return db[_0x0a9e('0x5b')]['count']({'where':_0x8ebf02[_0x0a9e('0x3a')]})[_0x0a9e('0x22')](function(_0x3a1974){_0x28a942['count']=_0x3a1974;if(_0x45108c[_0x0a9e('0x2f')]['includeAll']){_0x8ebf02[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5b')][_0x0a9e('0x40')](_0x8ebf02);})[_0x0a9e('0x22')](function(_0x842d6f){_0x28a942[_0x0a9e('0x41')]=_0x842d6f;return _0x28a942;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x53a6a1,_0x8ebf02))[_0x0a9e('0x42')](handleError(_0x53a6a1,null));};function char(_0x501050){return _0x0a9e('0x5c')===typeof _0x501050?String[_0x0a9e('0x5d')][_0x0a9e('0x1f')](null,arguments):_0x501050;}function needsEncapsulation(_0x30ef6e){return!!_0x30ef6e&&(_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xd))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xa))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x2c))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x18273f){var _0x4989f9=char(0x22),_0xc81b64='\x5c'+char(0x22),_0x23e2bd=_0x18273f[_0x0a9e('0x5e')]()[_0x0a9e('0x60')](new RegExp(_0x4989f9,'g'),_0xc81b64);return _0x4989f9+_0x23e2bd+_0x4989f9;}exports[_0x0a9e('0x61')]=function(_0x5d9ddb,_0x3afc8c,_0x1756c7){var _0x5ce99d,_0x23b447;var _0x5e725e={'where':{'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']}};if(_0x5d9ddb[_0x0a9e('0x2f')][_0x0a9e('0x62')]){_0x5e725e[_0x0a9e('0x3a')]['starttime']=JSON[_0x0a9e('0x63')](_0x5d9ddb['query'][_0x0a9e('0x62')]);}return db[_0x0a9e('0x58')]['findAll'](_0x5e725e)[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x1dd541){if(_0x1dd541){_0x5ce99d=_0x1dd541;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x0a9e('0x29')](_0x5ce99d,'id')},'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']},'order':_0x0a9e('0x64')});}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x2450a8){if(_0x2450a8){_0x23b447=_0x2450a8;var _0x17793e={};for(var _0x3c75b9=0x0,_0x3f8124=_0x23b447['length'];_0x3c75b9<_0x3f8124;_0x3c75b9++){if(!_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x3c75b9]['questionId'])){_0x17793e[_0x23b447[_0x3c75b9][_0x0a9e('0x65')]]=needsEncapsulation(_0x23b447[_0x3c75b9][_0x0a9e('0x66')])?encapsulate(_0x23b447[_0x3c75b9][_0x0a9e('0x66')]):_0x23b447[_0x3c75b9][_0x0a9e('0x66')];}}var _0x1b61d5=[],_0x4e7273={};for(var _0x436313=0x0,_0x4667bf=_0x5ce99d[_0x0a9e('0x36')];_0x436313<_0x4667bf;_0x436313++){_0x4e7273={'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id'],'SessionId':_0x5ce99d[_0x436313]['id'],'StartTime':moment(_0x5ce99d[_0x436313][_0x0a9e('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x22a3cb=0x0,_0x583662=_0x23b447[_0x0a9e('0x36')];_0x22a3cb<_0x583662;_0x22a3cb++){if(_0x23b447[_0x22a3cb][_0x0a9e('0x68')]==_0x5ce99d[_0x436313]['id']&&_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x22a3cb][_0x0a9e('0x65')])){_0x4e7273[_0x17793e[_0x23b447[_0x22a3cb][_0x0a9e('0x65')]]]=_0x23b447[_0x22a3cb][_0x0a9e('0x69')];}}for(var _0x596312 in _0x17793e){if(!_0x4e7273['hasOwnProperty'](_0x17793e[_0x596312])){_0x4e7273[_0x17793e[_0x596312]]=null;}}_0x1b61d5[_0x0a9e('0x6a')](_0x4e7273);}return _0x1b61d5;}})['then'](function(_0x2469d1){if(!_['isEmpty'](_0x2469d1)){var _0x427ccc=toCsv(_0x2469d1);var _0x564db2=Date['now']();fs[_0x0a9e('0x6b')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2),_0x427ccc);_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x6e'),_0x0a9e('0x6f')+util[_0x0a9e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb['params']['id'],_0x564db2));_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x70'),_0x0a9e('0x71'));return _0x3afc8c[_0x0a9e('0x72')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2));}else{return _0x3afc8c[_0x0a9e('0x15')](0xcc);}})['catch'](handleError(_0x3afc8c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c7a15f4..b300e3c 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 _0x2bbb=['../../config/environment','./jscriptyProject.attributes','JscriptyProject','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x446172,_0x3f0651){var _0x5349d9=function(_0x1ba7f9){while(--_0x1ba7f9){_0x446172['push'](_0x446172['shift']());}};_0x5349d9(++_0x3f0651);}(_0x2bbb,0x1d9));var _0xb2bb=function(_0x18099a,_0x5a9e3d){_0x18099a=_0x18099a-0x0;var _0x180791=_0x2bbb[_0x18099a];return _0x180791;};'use strict';var _=require(_0xb2bb('0x0'));var util=require(_0xb2bb('0x1'));var logger=require(_0xb2bb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb2bb('0x3'));var rp=require(_0xb2bb('0x4'));var fs=require('fs');var path=require(_0xb2bb('0x5'));var rimraf=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var attributes=require(_0xb2bb('0x8'));module['exports']=function(_0x425aca,_0x2718b7){return _0x425aca['define'](_0xb2bb('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd61f=['JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x57601c,_0x92ff8e){var _0x3660b3=function(_0x1359a3){while(--_0x1359a3){_0x57601c['push'](_0x57601c['shift']());}};_0x3660b3(++_0x92ff8e);}(_0xd61f,0x183));var _0xfd61=function(_0x2f42e8,_0x4714f6){_0x2f42e8=_0x2f42e8-0x0;var _0xa79541=_0xd61f[_0x2f42e8];return _0xa79541;};'use strict';var _=require(_0xfd61('0x0'));var util=require('util');var logger=require(_0xfd61('0x1'))(_0xfd61('0x2'));var moment=require(_0xfd61('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd61('0x4'));var fs=require('fs');var path=require(_0xfd61('0x5'));var rimraf=require('rimraf');var config=require(_0xfd61('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xfd61('0x7')]=function(_0x3efdd0,_0x2b9a61){return _0x3efdd0[_0xfd61('0x8')](_0xfd61('0x9'),attributes,{'tableName':_0xfd61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 9e124fc..9966db8 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 _0x22c2=['../../config/utils','../../config/logger','rpc','client','http','request','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x22c2,0x1c8));var _0x222c=function(_0x39a40f,_0x278f1d){_0x39a40f=_0x39a40f-0x0;var _0x3d32c7=_0x22c2[_0x39a40f];return _0x3d32c7;};'use strict';var _=require('lodash');var util=require(_0x222c('0x0'));var moment=require(_0x222c('0x1'));var BPromise=require(_0x222c('0x2'));var rs=require(_0x222c('0x3'));var fs=require('fs');var Redis=require(_0x222c('0x4'));var db=require(_0x222c('0x5'))['db'];var utils=require(_0x222c('0x6'));var logger=require(_0x222c('0x7'))(_0x222c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x222c('0x9')][_0x222c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dcaab,_0x254abb,_0x3ce9f0){return new BPromise(function(_0x169dbc,_0x2d1d2c){return client[_0x222c('0xb')](_0x4dcaab,_0x3ce9f0)[_0x222c('0xc')](function(_0xa1cf8f){logger['info'](_0x222c('0xd'),_0x254abb,_0x222c('0xe'));logger['debug'](_0x222c('0xf'),_0x254abb,_0x222c('0xe'),JSON[_0x222c('0x10')](_0xa1cf8f));if(_0xa1cf8f[_0x222c('0x11')]){if(_0xa1cf8f[_0x222c('0x11')][_0x222c('0x12')]===0x1f4){logger['error'](_0x222c('0xd'),_0x254abb,_0xa1cf8f['error']['message']);return _0x2d1d2c(_0xa1cf8f[_0x222c('0x11')][_0x222c('0x13')]);}logger['error'](_0x222c('0xd'),_0x254abb,_0xa1cf8f[_0x222c('0x11')][_0x222c('0x13')]);return _0x169dbc(_0xa1cf8f['error'][_0x222c('0x13')]);}else{logger[_0x222c('0x14')](_0x222c('0xd'),_0x254abb,_0x222c('0xe'));_0x169dbc(_0xa1cf8f['result'][_0x222c('0x13')]);}})[_0x222c('0x15')](function(_0x389a86){logger[_0x222c('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x254abb,_0x389a86);_0x2d1d2c(_0x389a86);});});} \ No newline at end of file +var _0xecd9=['JscriptyProject,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4f2c15,_0x281aef){var _0x316727=function(_0x8680a8){while(--_0x8680a8){_0x4f2c15['push'](_0x4f2c15['shift']());}};_0x316727(++_0x281aef);}(_0xecd9,0xb6));var _0x9ecd=function(_0x386f39,_0x3d8e41){_0x386f39=_0x386f39-0x0;var _0xd635a8=_0xecd9[_0x386f39];return _0xd635a8;};'use strict';var _=require(_0x9ecd('0x0'));var util=require(_0x9ecd('0x1'));var moment=require(_0x9ecd('0x2'));var BPromise=require(_0x9ecd('0x3'));var rs=require(_0x9ecd('0x4'));var fs=require('fs');var Redis=require(_0x9ecd('0x5'));var db=require(_0x9ecd('0x6'))['db'];var utils=require(_0x9ecd('0x7'));var logger=require(_0x9ecd('0x8'))(_0x9ecd('0x9'));var config=require(_0x9ecd('0xa'));var jayson=require(_0x9ecd('0xb'));var client=jayson['client'][_0x9ecd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x272acc,_0x1436c1,_0x519253){return new BPromise(function(_0x447460,_0x19dc09){return client[_0x9ecd('0xd')](_0x272acc,_0x519253)[_0x9ecd('0xe')](function(_0x44051c){logger[_0x9ecd('0xf')](_0x9ecd('0x10'),_0x1436c1,_0x9ecd('0x11'));logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x1436c1,_0x9ecd('0x11'),JSON[_0x9ecd('0x12')](_0x44051c));if(_0x44051c['error']){if(_0x44051c[_0x9ecd('0x13')]['code']===0x1f4){logger[_0x9ecd('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x1436c1,_0x44051c[_0x9ecd('0x13')]['message']);return _0x19dc09(_0x44051c[_0x9ecd('0x13')][_0x9ecd('0x14')]);}logger[_0x9ecd('0x13')](_0x9ecd('0x10'),_0x1436c1,_0x44051c[_0x9ecd('0x13')]['message']);return _0x447460(_0x44051c[_0x9ecd('0x13')]['message']);}else{logger[_0x9ecd('0xf')](_0x9ecd('0x10'),_0x1436c1,_0x9ecd('0x11'));_0x447460(_0x44051c['result'][_0x9ecd('0x14')]);}})[_0x9ecd('0x15')](function(_0x2c198c){logger[_0x9ecd('0x13')](_0x9ecd('0x10'),_0x1436c1,_0x2c198c);_0x19dc09(_0x2c198c);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2ed83b6..1973713 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 _0x6d6a=['/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x6d6a,0x16c));var _0xa6d6=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x6d6a[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0xa6d6('0x0'));var util=require(_0xa6d6('0x1'));var path=require('path');var timeout=require(_0xa6d6('0x2'));var express=require(_0xa6d6('0x3'));var router=express[_0xa6d6('0x4')]();var fs_extra=require(_0xa6d6('0x5'));var auth=require(_0xa6d6('0x6'));var interaction=require(_0xa6d6('0x7'));var config=require(_0xa6d6('0x8'));var controller=require(_0xa6d6('0x9'));router[_0xa6d6('0xa')]('/',auth[_0xa6d6('0xb')](),controller['index']);router[_0xa6d6('0xa')](_0xa6d6('0xc'),auth[_0xa6d6('0xb')](),controller[_0xa6d6('0xd')]);router[_0xa6d6('0xa')](_0xa6d6('0xe'),auth[_0xa6d6('0xb')](),controller[_0xa6d6('0xf')]);router[_0xa6d6('0x10')]('/',auth[_0xa6d6('0xb')](),controller[_0xa6d6('0x11')]);router['put'](_0xa6d6('0xe'),auth[_0xa6d6('0xb')](),controller['update']);router[_0xa6d6('0x12')](_0xa6d6('0xe'),auth['isAuthenticated'](),controller[_0xa6d6('0x13')]);module[_0xa6d6('0x14')]=router; \ No newline at end of file +var _0x46cf=['../../config/environment','./jscriptyQuestionReport.controller','get','/describe','describe','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x339d84,_0x11a821){var _0x97921e=function(_0x3fe9fd){while(--_0x3fe9fd){_0x339d84['push'](_0x339d84['shift']());}};_0x97921e(++_0x11a821);}(_0x46cf,0xe0));var _0xf46c=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x46cf[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0xf46c('0x0'));var util=require(_0xf46c('0x1'));var path=require(_0xf46c('0x2'));var timeout=require(_0xf46c('0x3'));var express=require(_0xf46c('0x4'));var router=express['Router']();var fs_extra=require(_0xf46c('0x5'));var auth=require(_0xf46c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf46c('0x7'));var controller=require(_0xf46c('0x8'));router[_0xf46c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf46c('0x9')](_0xf46c('0xa'),auth['isAuthenticated'](),controller[_0xf46c('0xb')]);router[_0xf46c('0x9')]('/:id',auth[_0xf46c('0xc')](),controller[_0xf46c('0xd')]);router[_0xf46c('0xe')]('/',auth[_0xf46c('0xc')](),controller['create']);router[_0xf46c('0xf')](_0xf46c('0x10'),auth[_0xf46c('0xc')](),controller[_0xf46c('0x11')]);router[_0xf46c('0x12')](_0xf46c('0x10'),auth[_0xf46c('0xc')](),controller[_0xf46c('0x13')]);module[_0xf46c('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 1537af8..3e95d27 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 _0xd139=['long','STRING','sequelize','exports'];(function(_0xa4f529,_0x36add4){var _0x3ce0df=function(_0x4ac770){while(--_0x4ac770){_0xa4f529['push'](_0xa4f529['shift']());}};_0x3ce0df(++_0x36add4);}(_0xd139,0x14e));var _0x9d13=function(_0x3e6546,_0x512dc7){_0x3e6546=_0x3e6546-0x0;var _0x466c74=_0xd139[_0x3e6546];return _0x466c74;};'use strict';var Sequelize=require(_0x9d13('0x0'));module[_0x9d13('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize['TEXT'](_0x9d13('0x2'))},'membername':{'type':Sequelize[_0x9d13('0x3')]},'projectname':{'type':Sequelize[_0x9d13('0x3')]},'queue':{'type':Sequelize[_0x9d13('0x3')]},'uniqueid':{'type':Sequelize[_0x9d13('0x3')]},'calleridname':{'type':Sequelize[_0x9d13('0x3')]},'calleridnum':{'type':Sequelize[_0x9d13('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1399=['sequelize','exports','TEXT','STRING'];(function(_0x8ae2a8,_0x5b8dff){var _0x4515fc=function(_0x3f20b0){while(--_0x3f20b0){_0x8ae2a8['push'](_0x8ae2a8['shift']());}};_0x4515fc(++_0x5b8dff);}(_0x1399,0x16c));var _0x9139=function(_0x7aeee4,_0x4c888c){_0x7aeee4=_0x7aeee4-0x0;var _0xcebaeb=_0x1399[_0x7aeee4];return _0xcebaeb;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x9139('0x2')]('long')},'membername':{'type':Sequelize[_0x9139('0x3')]},'projectname':{'type':Sequelize[_0x9139('0x3')]},'queue':{'type':Sequelize[_0x9139('0x3')]},'uniqueid':{'type':Sequelize[_0x9139('0x3')]},'calleridname':{'type':Sequelize[_0x9139('0x3')]},'calleridnum':{'type':Sequelize[_0x9139('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 2baa886..7e8ecc7 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 _0xe706=['includeAll','rows','catch','include','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x3f9137,_0x59a8bc){var _0x14f8b6=function(_0x5ceb44){while(--_0x5ceb44){_0x3f9137['push'](_0x3f9137['shift']());}};_0x14f8b6(++_0x59a8bc);}(_0xe706,0xa3));var _0x6e70=function(_0x31c68e,_0x5f0385){_0x31c68e=_0x31c68e-0x0;var _0x159e5d=_0xe706[_0x31c68e];return _0x159e5d;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={},_0xecf336={},_0x2864a0={'count':0x0,'rows':[]};var _0x396a67=_[_0x6e70('0x2e')](db[_0x6e70('0x2f')][_0x6e70('0x30')],function(_0x3a0821){return{'name':_0x3a0821[_0x6e70('0x31')],'type':_0x3a0821['type'][_0x6e70('0x32')]};});_0xecf336['model']=_[_0x6e70('0x2e')](_0x396a67,'name');_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x5d772a[_0x6e70('0x33')]);_0xecf336['filters']=_[_0x6e70('0x35')](_0xecf336[_0x6e70('0x36')],_0xecf336['query']);_0x406f29[_0x6e70('0x37')]=_[_0x6e70('0x35')](_0xecf336['model'],qs[_0x6e70('0x38')](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x38')]));_0x406f29[_0x6e70('0x37')]=_0x406f29[_0x6e70('0x37')][_0x6e70('0x39')]?_0x406f29[_0x6e70('0x37')]:_0xecf336[_0x6e70('0x36')];if(!_0x5d772a[_0x6e70('0x33')][_0x6e70('0x3a')]('nolimit')){_0x406f29[_0x6e70('0x20')]=qs['limit'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x20')]);_0x406f29[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x22')]);}_0x406f29[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x3c')]);_0x406f29[_0x6e70('0x3d')]=qs[_0x6e70('0x3e')](_[_0x6e70('0x3f')](_0x5d772a['query'],_0xecf336['filters']),_0x396a67);if(_0x5d772a['query'][_0x6e70('0x40')]){_0x406f29[_0x6e70('0x3d')]=_[_0x6e70('0x41')](_0x406f29[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x396a67,function(_0x3bdd87){if(_0x3bdd87['type']!==_0x6e70('0x42')){var _0x9e7ad2={};_0x9e7ad2[_0x3bdd87[_0x6e70('0x2b')]]={'$like':'%'+_0x5d772a[_0x6e70('0x33')][_0x6e70('0x40')]+'%'};return _0x9e7ad2;}})});}_0x406f29=_[_0x6e70('0x41')]({},_0x406f29,_0x5d772a[_0x6e70('0x43')]);var _0x16fc7d={'where':_0x406f29['where']};return db[_0x6e70('0x2f')][_0x6e70('0x21')](_0x16fc7d)[_0x6e70('0x29')](function(_0x31cad2){_0x2864a0[_0x6e70('0x21')]=_0x31cad2;if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x44')]){_0x406f29['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x406f29);})[_0x6e70('0x29')](function(_0x2b63cc){_0x2864a0[_0x6e70('0x45')]=_0x2b63cc;return _0x2864a0;})[_0x6e70('0x29')](respondWithFilteredResult(_0x1952ea,_0x406f29))[_0x6e70('0x46')](handleError(_0x1952ea,null));};exports['show']=function(_0x225d44,_0x2a58d7){var _0x2a2aca={'raw':!![],'where':{'id':_0x225d44['params']['id']}},_0x52b197={};_0x52b197['model']=_[_0x6e70('0x34')](db['JscriptyQuestionReport'][_0x6e70('0x30')]);_0x52b197[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x225d44[_0x6e70('0x33')]);_0x52b197['filters']=_[_0x6e70('0x35')](_0x52b197['model'],_0x52b197[_0x6e70('0x33')]);_0x2a2aca[_0x6e70('0x37')]=_[_0x6e70('0x35')](_0x52b197[_0x6e70('0x36')],qs['fields'](_0x225d44[_0x6e70('0x33')][_0x6e70('0x38')]));_0x2a2aca[_0x6e70('0x37')]=_0x2a2aca[_0x6e70('0x37')][_0x6e70('0x39')]?_0x2a2aca[_0x6e70('0x37')]:_0x52b197[_0x6e70('0x36')];if(_0x225d44['query'][_0x6e70('0x44')]){_0x2a2aca[_0x6e70('0x47')]=[{'all':!![]}];}_0x2a2aca=_[_0x6e70('0x41')]({},_0x2a2aca,_0x225d44[_0x6e70('0x43')]);return db[_0x6e70('0x2f')][_0x6e70('0x48')](_0x2a2aca)[_0x6e70('0x29')](handleEntityNotFound(_0x2a58d7,null))['then'](respondWithResult(_0x2a58d7,null))[_0x6e70('0x46')](handleError(_0x2a58d7,null));};exports['create']=function(_0x11794e,_0x3836e4){return db['JscriptyQuestionReport']['create'](_0x11794e[_0x6e70('0x49')],{})[_0x6e70('0x29')](respondWithResult(_0x3836e4,0xc9))[_0x6e70('0x46')](handleError(_0x3836e4,null));};exports['update']=function(_0x4af9b1,_0x238ebb){if(_0x4af9b1[_0x6e70('0x49')]['id']){delete _0x4af9b1[_0x6e70('0x49')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4af9b1[_0x6e70('0x4a')]['id']}})['then'](handleEntityNotFound(_0x238ebb,null))[_0x6e70('0x29')](saveUpdates(_0x4af9b1[_0x6e70('0x49')],null))[_0x6e70('0x29')](respondWithResult(_0x238ebb,null))[_0x6e70('0x46')](handleError(_0x238ebb,null));};exports[_0x6e70('0x4b')]=function(_0x4b354e,_0x4ae901){return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4b354e[_0x6e70('0x4a')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x4ae901,null))[_0x6e70('0x29')](removeEntity(_0x4ae901,null))['catch'](handleError(_0x4ae901,null));};exports[_0x6e70('0x4c')]=function(_0x232366,_0x1fa320){return db[_0x6e70('0x2f')][_0x6e70('0x4c')]()['then'](respondWithResult(_0x1fa320,null))[_0x6e70('0x46')](handleError(_0x1fa320,null));}; \ No newline at end of file +var _0x878f=['intersection','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','JscriptyQuestionReport','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes'];(function(_0x343e78,_0x5cc10c){var _0x2031de=function(_0x20d48d){while(--_0x20d48d){_0x343e78['push'](_0x343e78['shift']());}};_0x2031de(++_0x5cc10c);}(_0x878f,0x173));var _0xf878=function(_0x529c38,_0x13fdf8){_0x529c38=_0x529c38-0x0;var _0x531eb3=_0x878f[_0x529c38];return _0x531eb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x339c9c,_0x596fb5){_0x596fb5=_0x596fb5||0xcc;return function(_0x1ce004){if(_0x1ce004){return _0x339c9c[_0xf878('0x15')](_0x596fb5);}return _0x339c9c[_0xf878('0x16')](_0x596fb5)['end']();};}function respondWithResult(_0xe2c2de,_0x3902f7){_0x3902f7=_0x3902f7||0xc8;return function(_0x119e9e){if(_0x119e9e){return _0xe2c2de['status'](_0x3902f7)['json'](_0x119e9e);}};}function respondWithFilteredResult(_0x4c0948,_0x35ff2d){return function(_0x31d888){if(_0x31d888){var _0x6dbeca=typeof _0x35ff2d[_0xf878('0x17')]===_0xf878('0x18')&&typeof _0x35ff2d[_0xf878('0x19')]===_0xf878('0x18');var _0x3c5dee=_0x31d888[_0xf878('0x1a')];var _0x3b2e1b=_0x6dbeca?0x0:_0x35ff2d['offset'];var _0x2b2b54=_0x6dbeca?_0x31d888[_0xf878('0x1a')]:_0x35ff2d[_0xf878('0x17')]+_0x35ff2d[_0xf878('0x19')];var _0x3714f6;if(_0x2b2b54>=_0x3c5dee){_0x2b2b54=_0x3c5dee;_0x3714f6=0xc8;}else{_0x3714f6=0xce;}_0x4c0948[_0xf878('0x16')](_0x3714f6);return _0x4c0948[_0xf878('0x1b')]('Content-Range',_0x3b2e1b+'-'+_0x2b2b54+'/'+_0x3c5dee)[_0xf878('0x1c')](_0x31d888);}return null;};}function patchUpdates(_0x140866){return function(_0x250f85){try{jsonpatch['apply'](_0x250f85,_0x140866,!![]);}catch(_0x432e5d){return BPromise[_0xf878('0x1d')](_0x432e5d);}return _0x250f85[_0xf878('0x1e')]();};}function saveUpdates(_0x392822,_0x22d884){return function(_0x442450){if(_0x442450){return _0x442450[_0xf878('0x1f')](_0x392822)[_0xf878('0x20')](function(_0x212436){return _0x212436;});}return null;};}function removeEntity(_0x1a6506,_0x45e61f){return function(_0x566995){if(_0x566995){return _0x566995[_0xf878('0x21')]()['then'](function(){_0x1a6506[_0xf878('0x16')](0xcc)[_0xf878('0x22')]();});}};}function handleEntityNotFound(_0x35b3b4,_0x280036){return function(_0x20449e){if(!_0x20449e){_0x35b3b4['sendStatus'](0x194);}return _0x20449e;};}function handleError(_0x58c713,_0x59ba7b){_0x59ba7b=_0x59ba7b||0x1f4;return function(_0x242926){logger[_0xf878('0x23')](_0x242926[_0xf878('0x24')]);if(_0x242926['name']){delete _0x242926[_0xf878('0x25')];}_0x58c713[_0xf878('0x16')](_0x59ba7b)[_0xf878('0x26')](_0x242926);};}exports[_0xf878('0x27')]=function(_0x41dd55,_0x5aff46){var _0x502322={},_0x9a127d={},_0x5d9c97={'count':0x0,'rows':[]};var _0x4a0286=_[_0xf878('0x28')](db['JscriptyQuestionReport'][_0xf878('0x29')],function(_0x51afaf){return{'name':_0x51afaf[_0xf878('0x2a')],'type':_0x51afaf['type'][_0xf878('0x2b')]};});_0x9a127d['model']=_[_0xf878('0x28')](_0x4a0286,_0xf878('0x25'));_0x9a127d[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x41dd55[_0xf878('0x2c')]);_0x9a127d[_0xf878('0x2e')]=_['intersection'](_0x9a127d[_0xf878('0x2f')],_0x9a127d[_0xf878('0x2c')]);_0x502322[_0xf878('0x30')]=_[_0xf878('0x31')](_0x9a127d[_0xf878('0x2f')],qs['fields'](_0x41dd55[_0xf878('0x2c')][_0xf878('0x32')]));_0x502322['attributes']=_0x502322[_0xf878('0x30')][_0xf878('0x33')]?_0x502322[_0xf878('0x30')]:_0x9a127d[_0xf878('0x2f')];if(!_0x41dd55[_0xf878('0x2c')]['hasOwnProperty'](_0xf878('0x34'))){_0x502322[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x41dd55[_0xf878('0x2c')]['limit']);_0x502322[_0xf878('0x17')]=qs['offset'](_0x41dd55['query'][_0xf878('0x17')]);}_0x502322[_0xf878('0x35')]=qs[_0xf878('0x36')](_0x41dd55[_0xf878('0x2c')][_0xf878('0x36')]);_0x502322['where']=qs[_0xf878('0x2e')](_['pick'](_0x41dd55[_0xf878('0x2c')],_0x9a127d[_0xf878('0x2e')]),_0x4a0286);if(_0x41dd55['query'][_0xf878('0x37')]){_0x502322[_0xf878('0x38')]=_['merge'](_0x502322[_0xf878('0x38')],{'$or':_[_0xf878('0x28')](_0x4a0286,function(_0x5b4098){if(_0x5b4098[_0xf878('0x39')]!==_0xf878('0x3a')){var _0x34731d={};_0x34731d[_0x5b4098[_0xf878('0x25')]]={'$like':'%'+_0x41dd55[_0xf878('0x2c')][_0xf878('0x37')]+'%'};return _0x34731d;}})});}_0x502322=_[_0xf878('0x3b')]({},_0x502322,_0x41dd55['options']);var _0x1179fb={'where':_0x502322[_0xf878('0x38')]};return db['JscriptyQuestionReport'][_0xf878('0x1a')](_0x1179fb)['then'](function(_0x489964){_0x5d9c97[_0xf878('0x1a')]=_0x489964;if(_0x41dd55[_0xf878('0x2c')][_0xf878('0x3c')]){_0x502322[_0xf878('0x3d')]=[{'all':!![]}];}return db[_0xf878('0x3e')]['findAll'](_0x502322);})[_0xf878('0x20')](function(_0x4c4ae4){_0x5d9c97[_0xf878('0x3f')]=_0x4c4ae4;return _0x5d9c97;})[_0xf878('0x20')](respondWithFilteredResult(_0x5aff46,_0x502322))['catch'](handleError(_0x5aff46,null));};exports['show']=function(_0x180594,_0x2a66c1){var _0x13fcd3={'raw':!![],'where':{'id':_0x180594[_0xf878('0x40')]['id']}},_0x2f6ee5={};_0x2f6ee5[_0xf878('0x2f')]=_[_0xf878('0x2d')](db[_0xf878('0x3e')][_0xf878('0x29')]);_0x2f6ee5['query']=_[_0xf878('0x2d')](_0x180594[_0xf878('0x2c')]);_0x2f6ee5[_0xf878('0x2e')]=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],_0x2f6ee5[_0xf878('0x2c')]);_0x13fcd3['attributes']=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],qs[_0xf878('0x32')](_0x180594[_0xf878('0x2c')][_0xf878('0x32')]));_0x13fcd3['attributes']=_0x13fcd3[_0xf878('0x30')][_0xf878('0x33')]?_0x13fcd3[_0xf878('0x30')]:_0x2f6ee5[_0xf878('0x2f')];if(_0x180594['query'][_0xf878('0x3c')]){_0x13fcd3[_0xf878('0x3d')]=[{'all':!![]}];}_0x13fcd3=_[_0xf878('0x3b')]({},_0x13fcd3,_0x180594['options']);return db['JscriptyQuestionReport'][_0xf878('0x41')](_0x13fcd3)['then'](handleEntityNotFound(_0x2a66c1,null))['then'](respondWithResult(_0x2a66c1,null))['catch'](handleError(_0x2a66c1,null));};exports[_0xf878('0x42')]=function(_0x49e719,_0x156fdb){return db[_0xf878('0x3e')][_0xf878('0x42')](_0x49e719[_0xf878('0x43')],{})[_0xf878('0x20')](respondWithResult(_0x156fdb,0xc9))[_0xf878('0x44')](handleError(_0x156fdb,null));};exports[_0xf878('0x1f')]=function(_0x526c89,_0xb0bf4c){if(_0x526c89[_0xf878('0x43')]['id']){delete _0x526c89[_0xf878('0x43')]['id'];}return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x526c89['params']['id']}})['then'](handleEntityNotFound(_0xb0bf4c,null))[_0xf878('0x20')](saveUpdates(_0x526c89[_0xf878('0x43')],null))['then'](respondWithResult(_0xb0bf4c,null))[_0xf878('0x44')](handleError(_0xb0bf4c,null));};exports['destroy']=function(_0x1ce6b9,_0x31adde){return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x1ce6b9['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x31adde,null))[_0xf878('0x20')](removeEntity(_0x31adde,null))[_0xf878('0x44')](handleError(_0x31adde,null));};exports['describe']=function(_0xce30a5,_0x30df05){return db[_0xf878('0x3e')][_0xf878('0x45')]()['then'](respondWithResult(_0x30df05,null))[_0xf878('0x44')](handleError(_0x30df05,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7924f31..29243ef 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 _0xb304=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xb304,0x1ec));var _0x4b30=function(_0x482d88,_0x1e4c15){_0x482d88=_0x482d88-0x0;var _0x54c7c2=_0xb304[_0x482d88];return _0x54c7c2;};'use strict';var _=require(_0x4b30('0x0'));var util=require('util');var logger=require(_0x4b30('0x1'))(_0x4b30('0x2'));var moment=require(_0x4b30('0x3'));var BPromise=require(_0x4b30('0x4'));var rp=require(_0x4b30('0x5'));var fs=require('fs');var path=require(_0x4b30('0x6'));var rimraf=require(_0x4b30('0x7'));var config=require(_0x4b30('0x8'));var attributes=require(_0x4b30('0x9'));module[_0x4b30('0xa')]=function(_0x3ae346,_0x1f1169){return _0x3ae346['define'](_0x4b30('0xb'),attributes,{'tableName':_0x4b30('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f18=['../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x6f18,0x185));var _0x86f1=function(_0x181b05,_0x396b7f){_0x181b05=_0x181b05-0x0;var _0x3586bf=_0x6f18[_0x181b05];return _0x3586bf;};'use strict';var _=require(_0x86f1('0x0'));var util=require(_0x86f1('0x1'));var logger=require(_0x86f1('0x2'))(_0x86f1('0x3'));var moment=require(_0x86f1('0x4'));var BPromise=require('bluebird');var rp=require(_0x86f1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86f1('0x6'));var config=require(_0x86f1('0x7'));var attributes=require(_0x86f1('0x8'));module['exports']=function(_0x465b8f,_0x2b3c5e){return _0x465b8f[_0x86f1('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x86f1('0xa'),'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 342d98e..39f9e5c 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 _0xcfcf=['../../config/utils','../../config/logger','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x569059,_0x490d98){var _0x4c2cfb=function(_0xa90da0){while(--_0xa90da0){_0x569059['push'](_0x569059['shift']());}};_0x4c2cfb(++_0x490d98);}(_0xcfcf,0x1c5));var _0xfcfc=function(_0x168888,_0x1f8123){_0x168888=_0x168888-0x0;var _0x442a72=_0xcfcf[_0x168888];return _0x442a72;};'use strict';var _=require(_0xfcfc('0x0'));var util=require(_0xfcfc('0x1'));var moment=require(_0xfcfc('0x2'));var BPromise=require(_0xfcfc('0x3'));var rs=require(_0xfcfc('0x4'));var fs=require('fs');var Redis=require(_0xfcfc('0x5'));var db=require(_0xfcfc('0x6'))['db'];var utils=require(_0xfcfc('0x7'));var logger=require(_0xfcfc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcfc('0x9'));var client=jayson['client'][_0xfcfc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c2969,_0x375508,_0x5b207d){return new BPromise(function(_0x8f2d6f,_0x2d646d){return client[_0xfcfc('0xb')](_0x1c2969,_0x5b207d)[_0xfcfc('0xc')](function(_0x203c6e){logger[_0xfcfc('0xd')](_0xfcfc('0xe'),_0x375508,_0xfcfc('0xf'));logger[_0xfcfc('0x10')](_0xfcfc('0x11'),_0x375508,_0xfcfc('0xf'),JSON[_0xfcfc('0x12')](_0x203c6e));if(_0x203c6e[_0xfcfc('0x13')]){if(_0x203c6e[_0xfcfc('0x13')][_0xfcfc('0x14')]===0x1f4){logger[_0xfcfc('0x13')](_0xfcfc('0xe'),_0x375508,_0x203c6e['error'][_0xfcfc('0x15')]);return _0x2d646d(_0x203c6e[_0xfcfc('0x13')][_0xfcfc('0x15')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x375508,_0x203c6e[_0xfcfc('0x13')][_0xfcfc('0x15')]);return _0x8f2d6f(_0x203c6e[_0xfcfc('0x13')][_0xfcfc('0x15')]);}else{logger['info'](_0xfcfc('0xe'),_0x375508,_0xfcfc('0xf'));_0x8f2d6f(_0x203c6e['result']['message']);}})[_0xfcfc('0x16')](function(_0x578b07){logger[_0xfcfc('0x13')](_0xfcfc('0xe'),_0x375508,_0x578b07);_0x2d646d(_0x578b07);});});} \ No newline at end of file +var _0x0539=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0539,0x126));var _0x9053=function(_0x35dbe3,_0xbf1c2b){_0x35dbe3=_0x35dbe3-0x0;var _0x35fc21=_0x0539[_0x35dbe3];return _0x35fc21;};'use strict';var _=require('lodash');var util=require(_0x9053('0x0'));var moment=require(_0x9053('0x1'));var BPromise=require(_0x9053('0x2'));var rs=require(_0x9053('0x3'));var fs=require('fs');var Redis=require(_0x9053('0x4'));var db=require(_0x9053('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9053('0x6'))(_0x9053('0x7'));var config=require('../../config/environment');var jayson=require(_0x9053('0x8'));var client=jayson['client'][_0x9053('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37b770,_0x3a0d66,_0x51d3e0){return new BPromise(function(_0x206d52,_0x147138){return client[_0x9053('0xa')](_0x37b770,_0x51d3e0)[_0x9053('0xb')](function(_0x1badd1){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a0d66,_0x9053('0xc'));logger[_0x9053('0xd')](_0x9053('0xe'),_0x3a0d66,_0x9053('0xc'),JSON[_0x9053('0xf')](_0x1badd1));if(_0x1badd1[_0x9053('0x10')]){if(_0x1badd1[_0x9053('0x10')][_0x9053('0x11')]===0x1f4){logger[_0x9053('0x10')](_0x9053('0x12'),_0x3a0d66,_0x1badd1['error'][_0x9053('0x13')]);return _0x147138(_0x1badd1[_0x9053('0x10')][_0x9053('0x13')]);}logger[_0x9053('0x10')](_0x9053('0x12'),_0x3a0d66,_0x1badd1[_0x9053('0x10')]['message']);return _0x206d52(_0x1badd1[_0x9053('0x10')][_0x9053('0x13')]);}else{logger['info'](_0x9053('0x12'),_0x3a0d66,'request\x20sent');_0x206d52(_0x1badd1[_0x9053('0x14')][_0x9053('0x13')]);}})[_0x9053('0x15')](function(_0x225e03){logger[_0x9053('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a0d66,_0x225e03);_0x147138(_0x225e03);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index c8969dd..d5dcd5e 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 _0x038b=['isAuthenticated','/:id','/:id/questions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','/describe'];(function(_0x3b9812,_0x540ccd){var _0x5bd515=function(_0x538c2a){while(--_0x538c2a){_0x3b9812['push'](_0x3b9812['shift']());}};_0x5bd515(++_0x540ccd);}(_0x038b,0x114));var _0xb038=function(_0x502594,_0x37b2da){_0x502594=_0x502594-0x0;var _0x77bba4=_0x038b[_0x502594];return _0x77bba4;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb038('0x7')](_0xb038('0x8'),auth[_0xb038('0x9')](),controller['describe']);router['get'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller['show']);router['get'](_0xb038('0xb'),auth[_0xb038('0x9')](),controller['getQuestions']);router[_0xb038('0xc')]('/',auth[_0xb038('0x9')](),controller[_0xb038('0xd')]);router[_0xb038('0xe')](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0xf')]);router[_0xb038('0x10')](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0x11')]);module[_0xb038('0x12')]=router; \ No newline at end of file +var _0x4c60=['./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','getQuestions','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4c60,0xc1));var _0x04c6=function(_0x171833,_0x506df0){_0x171833=_0x171833-0x0;var _0x10658a=_0x4c60[_0x171833];return _0x10658a;};'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 fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['get']('/:id/questions',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['post']('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0xd')]);router['put'](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xe')]);router[_0x04c6('0xf')]('/:id',auth[_0x04c6('0x7')](),controller[_0x04c6('0x10')]);module[_0x04c6('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 78a2c06..af8868a 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 _0x4a83=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue'];(function(_0xdfaef5,_0x4c76ef){var _0x20286b=function(_0x51a2bc){while(--_0x51a2bc){_0xdfaef5['push'](_0xdfaef5['shift']());}};_0x20286b(++_0x4c76ef);}(_0x4a83,0x140));var _0x34a8=function(_0x51fb15,_0x4ffc5f){_0x51fb15=_0x51fb15-0x0;var _0x11899e=_0x4a83[_0x51fb15];return _0x11899e;};'use strict';var moment=require(_0x34a8('0x0'));var Sequelize=require(_0x34a8('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x34a8('0x2')],'set':function(_0xdc3eff){this[_0x34a8('0x3')]('starttime',_0xdc3eff);this[_0x34a8('0x3')](_0x34a8('0x4'),moment()[_0x34a8('0x5')](_0x34a8('0x6')));}},'endtime':{'type':Sequelize[_0x34a8('0x2')]},'membername':{'type':Sequelize[_0x34a8('0x7')]},'projectname':{'type':Sequelize[_0x34a8('0x7')]},'queue':{'type':Sequelize[_0x34a8('0x7')]},'uniqueid':{'type':Sequelize[_0x34a8('0x7')]},'calleridname':{'type':Sequelize[_0x34a8('0x7')]},'calleridnum':{'type':Sequelize[_0x34a8('0x7')]},'completed':{'type':Sequelize[_0x34a8('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x9154=['STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xa9c607,_0x4d986){var _0x544070=function(_0x273109){while(--_0x273109){_0xa9c607['push'](_0xa9c607['shift']());}};_0x544070(++_0x4d986);}(_0x9154,0x9b));var _0x4915=function(_0x2e95f1,_0x567b35){_0x2e95f1=_0x2e95f1-0x0;var _0x4055fe=_0x9154[_0x2e95f1];return _0x4055fe;};'use strict';var moment=require('moment');var Sequelize=require(_0x4915('0x0'));module[_0x4915('0x1')]={'starttime':{'type':Sequelize[_0x4915('0x2')],'set':function(_0x19008d){this[_0x4915('0x3')]('starttime',_0x19008d);this[_0x4915('0x3')](_0x4915('0x4'),moment()[_0x4915('0x5')](_0x4915('0x6')));}},'endtime':{'type':Sequelize[_0x4915('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x4915('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4915('0x7')]},'calleridname':{'type':Sequelize[_0x4915('0x7')]},'calleridnum':{'type':Sequelize[_0x4915('0x7')]},'completed':{'type':Sequelize[_0x4915('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7678638..a8af683 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 _0xaa0a=['create','body','params','describe','findOne','JscriptyQuestionReport','findAll','eml-format','rimraf','fast-json-patch','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','find'];(function(_0x4029c1,_0x1f3fa8){var _0x2e1107=function(_0x11ded3){while(--_0x11ded3){_0x4029c1['push'](_0x4029c1['shift']());}};_0x2e1107(++_0x1f3fa8);}(_0xaa0a,0x18d));var _0xaaa0=function(_0x3bd6fc,_0x56493c){_0x3bd6fc=_0x3bd6fc-0x0;var _0x16e4bd=_0xaa0a[_0x3bd6fc];return _0x16e4bd;};'use strict';var emlformat=require(_0xaaa0('0x0'));var rimraf=require(_0xaaa0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaaa0('0x2'));var rp=require(_0xaaa0('0x3'));var moment=require(_0xaaa0('0x4'));var BPromise=require(_0xaaa0('0x5'));var Mustache=require('mustache');var util=require(_0xaaa0('0x6'));var path=require(_0xaaa0('0x7'));var sox=require('sox');var csv=require(_0xaaa0('0x8'));var ejs=require(_0xaaa0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaaa0('0xa'));var squel=require('squel');var crypto=require(_0xaaa0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaaa0('0xc'));var toCsv=require(_0xaaa0('0x8'));var querystring=require(_0xaaa0('0xd'));var Papa=require(_0xaaa0('0xe'));var Redis=require('ioredis');var authService=require(_0xaaa0('0xf'));var qs=require(_0xaaa0('0x10'));var as=require(_0xaaa0('0x11'));var hardwareService=require(_0xaaa0('0x12'));var logger=require('../../config/logger')(_0xaaa0('0x13'));var utils=require('../../config/utils');var config=require(_0xaaa0('0x14'));var licenseUtil=require(_0xaaa0('0x15'));var db=require(_0xaaa0('0x16'))['db'];function respondWithStatusCode(_0x4c5a18,_0x1aa84f){_0x1aa84f=_0x1aa84f||0xcc;return function(_0x2c15b7){if(_0x2c15b7){return _0x4c5a18[_0xaaa0('0x17')](_0x1aa84f);}return _0x4c5a18[_0xaaa0('0x18')](_0x1aa84f)[_0xaaa0('0x19')]();};}function respondWithResult(_0xbe687c,_0x50d7e1){_0x50d7e1=_0x50d7e1||0xc8;return function(_0x5ac719){if(_0x5ac719){return _0xbe687c[_0xaaa0('0x18')](_0x50d7e1)[_0xaaa0('0x1a')](_0x5ac719);}};}function respondWithFilteredResult(_0x23ac50,_0x2de62b){return function(_0x1df0cf){if(_0x1df0cf){var _0x4247bf=typeof _0x2de62b[_0xaaa0('0x1b')]===_0xaaa0('0x1c')&&typeof _0x2de62b[_0xaaa0('0x1d')]==='undefined';var _0x31a55c=_0x1df0cf['count'];var _0x458e87=_0x4247bf?0x0:_0x2de62b[_0xaaa0('0x1b')];var _0x334166=_0x4247bf?_0x1df0cf[_0xaaa0('0x1e')]:_0x2de62b[_0xaaa0('0x1b')]+_0x2de62b[_0xaaa0('0x1d')];var _0xf51ad7;if(_0x334166>=_0x31a55c){_0x334166=_0x31a55c;_0xf51ad7=0xc8;}else{_0xf51ad7=0xce;}_0x23ac50['status'](_0xf51ad7);return _0x23ac50['set'](_0xaaa0('0x1f'),_0x458e87+'-'+_0x334166+'/'+_0x31a55c)[_0xaaa0('0x1a')](_0x1df0cf);}return null;};}function patchUpdates(_0x2925a6){return function(_0xfe92d4){try{jsonpatch[_0xaaa0('0x20')](_0xfe92d4,_0x2925a6,!![]);}catch(_0x4272be){return BPromise[_0xaaa0('0x21')](_0x4272be);}return _0xfe92d4[_0xaaa0('0x22')]();};}function saveUpdates(_0x228079,_0x255a84){return function(_0x4b5cd8){if(_0x4b5cd8){return _0x4b5cd8[_0xaaa0('0x23')](_0x228079)[_0xaaa0('0x24')](function(_0x2cbda3){return _0x2cbda3;});}return null;};}function removeEntity(_0xa5ee4b,_0x4565a9){return function(_0x57bee0){if(_0x57bee0){return _0x57bee0[_0xaaa0('0x25')]()[_0xaaa0('0x24')](function(){_0xa5ee4b[_0xaaa0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4373ae,_0x589915){return function(_0x573e34){if(!_0x573e34){_0x4373ae[_0xaaa0('0x17')](0x194);}return _0x573e34;};}function handleError(_0x2759f2,_0x33d348){_0x33d348=_0x33d348||0x1f4;return function(_0x25cbc6){logger['error'](_0x25cbc6[_0xaaa0('0x26')]);if(_0x25cbc6['name']){delete _0x25cbc6[_0xaaa0('0x27')];}_0x2759f2[_0xaaa0('0x18')](_0x33d348)[_0xaaa0('0x28')](_0x25cbc6);};}exports[_0xaaa0('0x29')]=function(_0x2defad,_0x326377){var _0x15850f={},_0x865173={},_0x4b52d6={'count':0x0,'rows':[]};var _0x5f4f90=_['map'](db[_0xaaa0('0x2a')][_0xaaa0('0x2b')],function(_0x320b3c){return{'name':_0x320b3c[_0xaaa0('0x2c')],'type':_0x320b3c[_0xaaa0('0x2d')][_0xaaa0('0x2e')]};});_0x865173['model']=_['map'](_0x5f4f90,_0xaaa0('0x27'));_0x865173[_0xaaa0('0x2f')]=_[_0xaaa0('0x30')](_0x2defad[_0xaaa0('0x2f')]);_0x865173[_0xaaa0('0x31')]=_['intersection'](_0x865173[_0xaaa0('0x32')],_0x865173['query']);_0x15850f[_0xaaa0('0x33')]=_[_0xaaa0('0x34')](_0x865173[_0xaaa0('0x32')],qs[_0xaaa0('0x35')](_0x2defad['query'][_0xaaa0('0x35')]));_0x15850f[_0xaaa0('0x33')]=_0x15850f['attributes'][_0xaaa0('0x36')]?_0x15850f['attributes']:_0x865173[_0xaaa0('0x32')];if(!_0x2defad[_0xaaa0('0x2f')][_0xaaa0('0x37')](_0xaaa0('0x38'))){_0x15850f['limit']=qs['limit'](_0x2defad['query'][_0xaaa0('0x1d')]);_0x15850f['offset']=qs[_0xaaa0('0x1b')](_0x2defad[_0xaaa0('0x2f')]['offset']);}_0x15850f[_0xaaa0('0x39')]=qs[_0xaaa0('0x3a')](_0x2defad[_0xaaa0('0x2f')][_0xaaa0('0x3a')]);_0x15850f[_0xaaa0('0x3b')]=qs[_0xaaa0('0x31')](_[_0xaaa0('0x3c')](_0x2defad[_0xaaa0('0x2f')],_0x865173[_0xaaa0('0x31')]),_0x5f4f90);if(_0x2defad['query'][_0xaaa0('0x3d')]){_0x15850f[_0xaaa0('0x3b')]=_[_0xaaa0('0x3e')](_0x15850f['where'],{'$or':_[_0xaaa0('0x3f')](_0x5f4f90,function(_0x5e5db9){if(_0x5e5db9[_0xaaa0('0x2d')]!==_0xaaa0('0x40')){var _0x50796b={};_0x50796b[_0x5e5db9[_0xaaa0('0x27')]]={'$like':'%'+_0x2defad['query'][_0xaaa0('0x3d')]+'%'};return _0x50796b;}})});}_0x15850f=_[_0xaaa0('0x3e')]({},_0x15850f,_0x2defad[_0xaaa0('0x41')]);var _0x31276e={'where':_0x15850f[_0xaaa0('0x3b')]};return db[_0xaaa0('0x2a')][_0xaaa0('0x1e')](_0x31276e)[_0xaaa0('0x24')](function(_0x3e5904){_0x4b52d6[_0xaaa0('0x1e')]=_0x3e5904;if(_0x2defad['query'][_0xaaa0('0x42')]){_0x15850f[_0xaaa0('0x43')]=[{'all':!![]}];}return db[_0xaaa0('0x2a')]['findAll'](_0x15850f);})[_0xaaa0('0x24')](function(_0x5462c0){_0x4b52d6[_0xaaa0('0x44')]=_0x5462c0;return _0x4b52d6;})[_0xaaa0('0x24')](respondWithFilteredResult(_0x326377,_0x15850f))[_0xaaa0('0x45')](handleError(_0x326377,null));};exports['show']=function(_0x515e72,_0x4179f8){var _0x5ee550={'raw':!![],'where':{'id':_0x515e72['params']['id']}},_0x5b1930={};_0x5b1930[_0xaaa0('0x32')]=_['keys'](db['JscriptySessionReport'][_0xaaa0('0x2b')]);_0x5b1930[_0xaaa0('0x2f')]=_[_0xaaa0('0x30')](_0x515e72[_0xaaa0('0x2f')]);_0x5b1930[_0xaaa0('0x31')]=_[_0xaaa0('0x34')](_0x5b1930[_0xaaa0('0x32')],_0x5b1930[_0xaaa0('0x2f')]);_0x5ee550[_0xaaa0('0x33')]=_[_0xaaa0('0x34')](_0x5b1930[_0xaaa0('0x32')],qs[_0xaaa0('0x35')](_0x515e72[_0xaaa0('0x2f')][_0xaaa0('0x35')]));_0x5ee550[_0xaaa0('0x33')]=_0x5ee550[_0xaaa0('0x33')][_0xaaa0('0x36')]?_0x5ee550[_0xaaa0('0x33')]:_0x5b1930[_0xaaa0('0x32')];if(_0x515e72[_0xaaa0('0x2f')][_0xaaa0('0x42')]){_0x5ee550[_0xaaa0('0x43')]=[{'all':!![]}];}_0x5ee550=_[_0xaaa0('0x3e')]({},_0x5ee550,_0x515e72[_0xaaa0('0x41')]);return db[_0xaaa0('0x2a')][_0xaaa0('0x46')](_0x5ee550)[_0xaaa0('0x24')](handleEntityNotFound(_0x4179f8,null))[_0xaaa0('0x24')](respondWithResult(_0x4179f8,null))[_0xaaa0('0x45')](handleError(_0x4179f8,null));};exports[_0xaaa0('0x47')]=function(_0x542457,_0x50f987){return db[_0xaaa0('0x2a')][_0xaaa0('0x47')](_0x542457[_0xaaa0('0x48')],{})[_0xaaa0('0x24')](respondWithResult(_0x50f987,0xc9))[_0xaaa0('0x45')](handleError(_0x50f987,null));};exports[_0xaaa0('0x23')]=function(_0x13484f,_0x364ccd){if(_0x13484f['body']['id']){delete _0x13484f[_0xaaa0('0x48')]['id'];}return db[_0xaaa0('0x2a')]['find']({'where':{'id':_0x13484f[_0xaaa0('0x49')]['id']}})['then'](handleEntityNotFound(_0x364ccd,null))[_0xaaa0('0x24')](saveUpdates(_0x13484f[_0xaaa0('0x48')],null))[_0xaaa0('0x24')](respondWithResult(_0x364ccd,null))[_0xaaa0('0x45')](handleError(_0x364ccd,null));};exports[_0xaaa0('0x25')]=function(_0x932b33,_0x319823){return db[_0xaaa0('0x2a')][_0xaaa0('0x46')]({'where':{'id':_0x932b33[_0xaaa0('0x49')]['id']}})[_0xaaa0('0x24')](handleEntityNotFound(_0x319823,null))['then'](removeEntity(_0x319823,null))[_0xaaa0('0x45')](handleError(_0x319823,null));};exports[_0xaaa0('0x4a')]=function(_0x2929b8,_0x32368a){return db[_0xaaa0('0x2a')][_0xaaa0('0x4a')]()[_0xaaa0('0x24')](respondWithResult(_0x32368a,null))[_0xaaa0('0x45')](handleError(_0x32368a,null));};exports['getQuestions']=function(_0x11824f,_0x364102,_0xcd5063){var _0x57e7da={'raw':!![],'where':{}};var _0x51673c={};var _0x22ef2b={'count':0x0,'rows':[]};return db[_0xaaa0('0x2a')][_0xaaa0('0x4b')]({'where':{'id':_0x11824f[_0xaaa0('0x49')]['id']}})[_0xaaa0('0x24')](handleEntityNotFound(_0x364102,null))[_0xaaa0('0x24')](function(_0x1f8405){if(_0x1f8405){_0x51673c[_0xaaa0('0x32')]=_[_0xaaa0('0x30')](db[_0xaaa0('0x4c')][_0xaaa0('0x2b')]);_0x51673c['query']=_[_0xaaa0('0x30')](_0x11824f['query']);_0x51673c[_0xaaa0('0x31')]=_[_0xaaa0('0x34')](_0x51673c['model'],_0x51673c[_0xaaa0('0x2f')]);_0x57e7da[_0xaaa0('0x33')]=_[_0xaaa0('0x34')](_0x51673c[_0xaaa0('0x32')],qs['fields'](_0x11824f[_0xaaa0('0x2f')][_0xaaa0('0x35')]));_0x57e7da[_0xaaa0('0x33')]=_0x57e7da[_0xaaa0('0x33')]['length']?_0x57e7da[_0xaaa0('0x33')]:_0x51673c['model'];if(!_0x11824f['query'][_0xaaa0('0x37')](_0xaaa0('0x38'))){_0x57e7da[_0xaaa0('0x1d')]=qs[_0xaaa0('0x1d')](_0x11824f[_0xaaa0('0x2f')][_0xaaa0('0x1d')]);_0x57e7da[_0xaaa0('0x1b')]=qs[_0xaaa0('0x1b')](_0x11824f[_0xaaa0('0x2f')][_0xaaa0('0x1b')]);}_0x57e7da[_0xaaa0('0x39')]=qs[_0xaaa0('0x3a')](_0x11824f[_0xaaa0('0x2f')][_0xaaa0('0x3a')]);_0x57e7da[_0xaaa0('0x3b')]=qs['filters'](_[_0xaaa0('0x3c')](_0x11824f[_0xaaa0('0x2f')],_0x51673c[_0xaaa0('0x31')]));_0x57e7da[_0xaaa0('0x3b')]['SessionId']=_0x1f8405['id'];if(_0x11824f[_0xaaa0('0x2f')][_0xaaa0('0x3d')]){_0x57e7da['where']=_[_0xaaa0('0x3e')](_0x57e7da[_0xaaa0('0x3b')],{'$or':_[_0xaaa0('0x3f')](_0x57e7da[_0xaaa0('0x33')],function(_0xea8eba){var _0x3a1075={};_0x3a1075[_0xea8eba]={'$like':'%'+_0x11824f['query'][_0xaaa0('0x3d')]+'%'};return _0x3a1075;})});}_0x57e7da=_[_0xaaa0('0x3e')]({},_0x57e7da,_0x11824f[_0xaaa0('0x41')]);return db[_0xaaa0('0x4c')]['count']({'where':_0x57e7da[_0xaaa0('0x3b')]})[_0xaaa0('0x24')](function(_0x4ec103){_0x22ef2b[_0xaaa0('0x1e')]=_0x4ec103;if(_0x11824f['query']['includeAll']){_0x57e7da['include']=[{'all':!![]}];}return db[_0xaaa0('0x4c')][_0xaaa0('0x4d')](_0x57e7da);})[_0xaaa0('0x24')](function(_0x1f7f3a){_0x22ef2b[_0xaaa0('0x44')]=_0x1f7f3a;return _0x22ef2b;});}})[_0xaaa0('0x24')](respondWithFilteredResult(_0x364102,_0x57e7da))[_0xaaa0('0x45')](handleError(_0x364102,null));}; \ No newline at end of file +var _0xf88e=['model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','JscriptySessionReport','include','findAll','rows','catch','show','params','fields','includeAll','find','create','body','update','destroy','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','then','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x48dd82,_0xbf858e){var _0x3fb2f8=function(_0x288f47){while(--_0x288f47){_0x48dd82['push'](_0x48dd82['shift']());}};_0x3fb2f8(++_0xbf858e);}(_0xf88e,0xd0));var _0xef88=function(_0x4e1a73,_0x2056b1){_0x4e1a73=_0x4e1a73-0x0;var _0x5efdd5=_0xf88e[_0x4e1a73];return _0x5efdd5;};'use strict';var emlformat=require(_0xef88('0x0'));var rimraf=require(_0xef88('0x1'));var zipdir=require(_0xef88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef88('0x3'));var moment=require('moment');var BPromise=require(_0xef88('0x4'));var Mustache=require(_0xef88('0x5'));var util=require(_0xef88('0x6'));var path=require(_0xef88('0x7'));var sox=require(_0xef88('0x8'));var csv=require(_0xef88('0x9'));var ejs=require(_0xef88('0xa'));var fs=require('fs');var fs_extra=require(_0xef88('0xb'));var _=require(_0xef88('0xc'));var squel=require(_0xef88('0xd'));var crypto=require(_0xef88('0xe'));var jsforce=require(_0xef88('0xf'));var deskjs=require(_0xef88('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef88('0x11'));var Redis=require(_0xef88('0x12'));var authService=require(_0xef88('0x13'));var qs=require(_0xef88('0x14'));var as=require(_0xef88('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef88('0x16'))(_0xef88('0x17'));var utils=require(_0xef88('0x18'));var config=require(_0xef88('0x19'));var licenseUtil=require(_0xef88('0x1a'));var db=require(_0xef88('0x1b'))['db'];function respondWithStatusCode(_0x5a495a,_0x331efd){_0x331efd=_0x331efd||0xcc;return function(_0x571de0){if(_0x571de0){return _0x5a495a['sendStatus'](_0x331efd);}return _0x5a495a[_0xef88('0x1c')](_0x331efd)[_0xef88('0x1d')]();};}function respondWithResult(_0x33ac07,_0x56333b){_0x56333b=_0x56333b||0xc8;return function(_0x5f3dbc){if(_0x5f3dbc){return _0x33ac07['status'](_0x56333b)[_0xef88('0x1e')](_0x5f3dbc);}};}function respondWithFilteredResult(_0x540294,_0x21545d){return function(_0x1d10be){if(_0x1d10be){var _0x9ece76=typeof _0x21545d['offset']==='undefined'&&typeof _0x21545d[_0xef88('0x1f')]===_0xef88('0x20');var _0x297af1=_0x1d10be['count'];var _0x1f54d7=_0x9ece76?0x0:_0x21545d[_0xef88('0x21')];var _0x55e5b5=_0x9ece76?_0x1d10be[_0xef88('0x22')]:_0x21545d[_0xef88('0x21')]+_0x21545d[_0xef88('0x1f')];var _0x3a50e7;if(_0x55e5b5>=_0x297af1){_0x55e5b5=_0x297af1;_0x3a50e7=0xc8;}else{_0x3a50e7=0xce;}_0x540294[_0xef88('0x1c')](_0x3a50e7);return _0x540294[_0xef88('0x23')](_0xef88('0x24'),_0x1f54d7+'-'+_0x55e5b5+'/'+_0x297af1)[_0xef88('0x1e')](_0x1d10be);}return null;};}function patchUpdates(_0x3f1dea){return function(_0xa40c03){try{jsonpatch[_0xef88('0x25')](_0xa40c03,_0x3f1dea,!![]);}catch(_0x3b2b1b){return BPromise[_0xef88('0x26')](_0x3b2b1b);}return _0xa40c03['save']();};}function saveUpdates(_0x4c3265,_0x214126){return function(_0x359b57){if(_0x359b57){return _0x359b57['update'](_0x4c3265)[_0xef88('0x27')](function(_0x176e22){return _0x176e22;});}return null;};}function removeEntity(_0x3a4764,_0x40fa72){return function(_0x3390b6){if(_0x3390b6){return _0x3390b6['destroy']()[_0xef88('0x27')](function(){_0x3a4764['status'](0xcc)[_0xef88('0x1d')]();});}};}function handleEntityNotFound(_0x2aafff,_0x126074){return function(_0x52a293){if(!_0x52a293){_0x2aafff[_0xef88('0x28')](0x194);}return _0x52a293;};}function handleError(_0x47516f,_0x4e6035){_0x4e6035=_0x4e6035||0x1f4;return function(_0x316f7b){logger[_0xef88('0x29')](_0x316f7b[_0xef88('0x2a')]);if(_0x316f7b['name']){delete _0x316f7b['name'];}_0x47516f['status'](_0x4e6035)[_0xef88('0x2b')](_0x316f7b);};}exports[_0xef88('0x2c')]=function(_0x5c7702,_0x2d7e73){var _0x4ad1f1={},_0x2e0211={},_0x257cfe={'count':0x0,'rows':[]};var _0x3c6653=_[_0xef88('0x2d')](db['JscriptySessionReport'][_0xef88('0x2e')],function(_0x48629c){return{'name':_0x48629c[_0xef88('0x2f')],'type':_0x48629c[_0xef88('0x30')][_0xef88('0x31')]};});_0x2e0211[_0xef88('0x32')]=_[_0xef88('0x2d')](_0x3c6653,_0xef88('0x33'));_0x2e0211[_0xef88('0x34')]=_[_0xef88('0x35')](_0x5c7702['query']);_0x2e0211[_0xef88('0x36')]=_[_0xef88('0x37')](_0x2e0211[_0xef88('0x32')],_0x2e0211[_0xef88('0x34')]);_0x4ad1f1[_0xef88('0x38')]=_[_0xef88('0x37')](_0x2e0211['model'],qs['fields'](_0x5c7702['query']['fields']));_0x4ad1f1[_0xef88('0x38')]=_0x4ad1f1['attributes'][_0xef88('0x39')]?_0x4ad1f1[_0xef88('0x38')]:_0x2e0211['model'];if(!_0x5c7702[_0xef88('0x34')][_0xef88('0x3a')](_0xef88('0x3b'))){_0x4ad1f1[_0xef88('0x1f')]=qs[_0xef88('0x1f')](_0x5c7702[_0xef88('0x34')]['limit']);_0x4ad1f1[_0xef88('0x21')]=qs[_0xef88('0x21')](_0x5c7702[_0xef88('0x34')][_0xef88('0x21')]);}_0x4ad1f1[_0xef88('0x3c')]=qs[_0xef88('0x3d')](_0x5c7702[_0xef88('0x34')][_0xef88('0x3d')]);_0x4ad1f1[_0xef88('0x3e')]=qs[_0xef88('0x36')](_['pick'](_0x5c7702[_0xef88('0x34')],_0x2e0211['filters']),_0x3c6653);if(_0x5c7702['query'][_0xef88('0x3f')]){_0x4ad1f1['where']=_[_0xef88('0x40')](_0x4ad1f1[_0xef88('0x3e')],{'$or':_['map'](_0x3c6653,function(_0x4fb005){if(_0x4fb005[_0xef88('0x30')]!==_0xef88('0x41')){var _0x1795e0={};_0x1795e0[_0x4fb005[_0xef88('0x33')]]={'$like':'%'+_0x5c7702[_0xef88('0x34')]['filter']+'%'};return _0x1795e0;}})});}_0x4ad1f1=_[_0xef88('0x40')]({},_0x4ad1f1,_0x5c7702[_0xef88('0x42')]);var _0x29ec39={'where':_0x4ad1f1[_0xef88('0x3e')]};return db[_0xef88('0x43')]['count'](_0x29ec39)[_0xef88('0x27')](function(_0x807cb7){_0x257cfe[_0xef88('0x22')]=_0x807cb7;if(_0x5c7702['query']['includeAll']){_0x4ad1f1[_0xef88('0x44')]=[{'all':!![]}];}return db[_0xef88('0x43')][_0xef88('0x45')](_0x4ad1f1);})[_0xef88('0x27')](function(_0x4d7dbc){_0x257cfe[_0xef88('0x46')]=_0x4d7dbc;return _0x257cfe;})[_0xef88('0x27')](respondWithFilteredResult(_0x2d7e73,_0x4ad1f1))[_0xef88('0x47')](handleError(_0x2d7e73,null));};exports[_0xef88('0x48')]=function(_0x5d181f,_0x2daf43){var _0x24a3b7={'raw':!![],'where':{'id':_0x5d181f[_0xef88('0x49')]['id']}},_0x259040={};_0x259040[_0xef88('0x32')]=_[_0xef88('0x35')](db[_0xef88('0x43')][_0xef88('0x2e')]);_0x259040[_0xef88('0x34')]=_['keys'](_0x5d181f[_0xef88('0x34')]);_0x259040[_0xef88('0x36')]=_[_0xef88('0x37')](_0x259040['model'],_0x259040[_0xef88('0x34')]);_0x24a3b7[_0xef88('0x38')]=_[_0xef88('0x37')](_0x259040[_0xef88('0x32')],qs[_0xef88('0x4a')](_0x5d181f['query'][_0xef88('0x4a')]));_0x24a3b7[_0xef88('0x38')]=_0x24a3b7['attributes'][_0xef88('0x39')]?_0x24a3b7[_0xef88('0x38')]:_0x259040[_0xef88('0x32')];if(_0x5d181f[_0xef88('0x34')][_0xef88('0x4b')]){_0x24a3b7[_0xef88('0x44')]=[{'all':!![]}];}_0x24a3b7=_[_0xef88('0x40')]({},_0x24a3b7,_0x5d181f[_0xef88('0x42')]);return db[_0xef88('0x43')][_0xef88('0x4c')](_0x24a3b7)[_0xef88('0x27')](handleEntityNotFound(_0x2daf43,null))[_0xef88('0x27')](respondWithResult(_0x2daf43,null))[_0xef88('0x47')](handleError(_0x2daf43,null));};exports[_0xef88('0x4d')]=function(_0x2ad3f0,_0x4dec81){return db[_0xef88('0x43')][_0xef88('0x4d')](_0x2ad3f0[_0xef88('0x4e')],{})[_0xef88('0x27')](respondWithResult(_0x4dec81,0xc9))[_0xef88('0x47')](handleError(_0x4dec81,null));};exports[_0xef88('0x4f')]=function(_0x10824d,_0x18347a){if(_0x10824d[_0xef88('0x4e')]['id']){delete _0x10824d[_0xef88('0x4e')]['id'];}return db[_0xef88('0x43')][_0xef88('0x4c')]({'where':{'id':_0x10824d['params']['id']}})['then'](handleEntityNotFound(_0x18347a,null))[_0xef88('0x27')](saveUpdates(_0x10824d['body'],null))[_0xef88('0x27')](respondWithResult(_0x18347a,null))['catch'](handleError(_0x18347a,null));};exports[_0xef88('0x50')]=function(_0x58b907,_0x110080){return db['JscriptySessionReport'][_0xef88('0x4c')]({'where':{'id':_0x58b907[_0xef88('0x49')]['id']}})[_0xef88('0x27')](handleEntityNotFound(_0x110080,null))[_0xef88('0x27')](removeEntity(_0x110080,null))[_0xef88('0x47')](handleError(_0x110080,null));};exports['describe']=function(_0x5f1a58,_0x2cbed6){return db[_0xef88('0x43')]['describe']()[_0xef88('0x27')](respondWithResult(_0x2cbed6,null))[_0xef88('0x47')](handleError(_0x2cbed6,null));};exports[_0xef88('0x51')]=function(_0x133592,_0x2f662e,_0x5dac81){var _0x381bfc={'raw':!![],'where':{}};var _0x4ee87a={};var _0x37f629={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xef88('0x52')]({'where':{'id':_0x133592['params']['id']}})[_0xef88('0x27')](handleEntityNotFound(_0x2f662e,null))[_0xef88('0x27')](function(_0x26de24){if(_0x26de24){_0x4ee87a[_0xef88('0x32')]=_['keys'](db[_0xef88('0x53')][_0xef88('0x2e')]);_0x4ee87a[_0xef88('0x34')]=_[_0xef88('0x35')](_0x133592['query']);_0x4ee87a[_0xef88('0x36')]=_[_0xef88('0x37')](_0x4ee87a[_0xef88('0x32')],_0x4ee87a['query']);_0x381bfc[_0xef88('0x38')]=_[_0xef88('0x37')](_0x4ee87a[_0xef88('0x32')],qs['fields'](_0x133592[_0xef88('0x34')][_0xef88('0x4a')]));_0x381bfc[_0xef88('0x38')]=_0x381bfc[_0xef88('0x38')]['length']?_0x381bfc[_0xef88('0x38')]:_0x4ee87a[_0xef88('0x32')];if(!_0x133592[_0xef88('0x34')][_0xef88('0x3a')]('nolimit')){_0x381bfc[_0xef88('0x1f')]=qs[_0xef88('0x1f')](_0x133592[_0xef88('0x34')][_0xef88('0x1f')]);_0x381bfc[_0xef88('0x21')]=qs['offset'](_0x133592['query'][_0xef88('0x21')]);}_0x381bfc[_0xef88('0x3c')]=qs[_0xef88('0x3d')](_0x133592[_0xef88('0x34')][_0xef88('0x3d')]);_0x381bfc[_0xef88('0x3e')]=qs[_0xef88('0x36')](_[_0xef88('0x54')](_0x133592[_0xef88('0x34')],_0x4ee87a[_0xef88('0x36')]));_0x381bfc[_0xef88('0x3e')][_0xef88('0x55')]=_0x26de24['id'];if(_0x133592['query']['filter']){_0x381bfc[_0xef88('0x3e')]=_[_0xef88('0x40')](_0x381bfc[_0xef88('0x3e')],{'$or':_['map'](_0x381bfc['attributes'],function(_0x1ff29b){var _0x344779={};_0x344779[_0x1ff29b]={'$like':'%'+_0x133592[_0xef88('0x34')][_0xef88('0x3f')]+'%'};return _0x344779;})});}_0x381bfc=_[_0xef88('0x40')]({},_0x381bfc,_0x133592[_0xef88('0x42')]);return db[_0xef88('0x53')][_0xef88('0x22')]({'where':_0x381bfc[_0xef88('0x3e')]})[_0xef88('0x27')](function(_0x29dab9){_0x37f629[_0xef88('0x22')]=_0x29dab9;if(_0x133592['query']['includeAll']){_0x381bfc[_0xef88('0x44')]=[{'all':!![]}];}return db[_0xef88('0x53')]['findAll'](_0x381bfc);})[_0xef88('0x27')](function(_0x124c14){_0x37f629['rows']=_0x124c14;return _0x37f629;});}})[_0xef88('0x27')](respondWithFilteredResult(_0x2f662e,_0x381bfc))[_0xef88('0x47')](handleError(_0x2f662e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8443a06..0b3d403 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 _0x7823=['../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','request-promise','path','rimraf'];(function(_0x55b523,_0x153614){var _0x2d3897=function(_0x3b4eb4){while(--_0x3b4eb4){_0x55b523['push'](_0x55b523['shift']());}};_0x2d3897(++_0x153614);}(_0x7823,0x1bd));var _0x3782=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7823[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x3782('0x0'));var logger=require(_0x3782('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3782('0x2'));var fs=require('fs');var path=require(_0x3782('0x3'));var rimraf=require(_0x3782('0x4'));var config=require(_0x3782('0x5'));var attributes=require(_0x3782('0x6'));module[_0x3782('0x7')]=function(_0x24bdd9,_0x13b5d3){return _0x24bdd9['define'](_0x3782('0x8'),attributes,{'tableName':_0x3782('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45b1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x19f4d1,_0x1ac835){var _0x4ee31a=function(_0x32eb46){while(--_0x32eb46){_0x19f4d1['push'](_0x19f4d1['shift']());}};_0x4ee31a(++_0x1ac835);}(_0x45b1,0x16a));var _0x145b=function(_0x194b40,_0x5a8c7d){_0x194b40=_0x194b40-0x0;var _0xfcab6b=_0x45b1[_0x194b40];return _0xfcab6b;};'use strict';var _=require(_0x145b('0x0'));var util=require(_0x145b('0x1'));var logger=require('../../config/logger')(_0x145b('0x2'));var moment=require(_0x145b('0x3'));var BPromise=require(_0x145b('0x4'));var rp=require(_0x145b('0x5'));var fs=require('fs');var path=require(_0x145b('0x6'));var rimraf=require(_0x145b('0x7'));var config=require(_0x145b('0x8'));var attributes=require(_0x145b('0x9'));module[_0x145b('0xa')]=function(_0x276b3b,_0x7445bc){return _0x276b3b['define'](_0x145b('0xb'),attributes,{'tableName':_0x145b('0xc'),'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 ee99f62..2ae2e85 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 _0x2a2b=['stringify','code','error','message','info','lodash','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x2a2b,0x1d5));var _0xb2a2=function(_0x18c8dc,_0x510c11){_0x18c8dc=_0x18c8dc-0x0;var _0x5b1272=_0x2a2b[_0x18c8dc];return _0x5b1272;};'use strict';var _=require(_0xb2a2('0x0'));var util=require('util');var moment=require(_0xb2a2('0x1'));var BPromise=require(_0xb2a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb2a2('0x4'))('rpc');var config=require(_0xb2a2('0x5'));var jayson=require(_0xb2a2('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28430c,_0x578330,_0x4956e3){return new BPromise(function(_0x49a161,_0x3319f4){return client['request'](_0x28430c,_0x4956e3)['then'](function(_0x546b01){logger['info'](_0xb2a2('0x7'),_0x578330,_0xb2a2('0x8'));logger[_0xb2a2('0x9')](_0xb2a2('0xa'),_0x578330,_0xb2a2('0x8'),JSON[_0xb2a2('0xb')](_0x546b01));if(_0x546b01['error']){if(_0x546b01['error'][_0xb2a2('0xc')]===0x1f4){logger['error'](_0xb2a2('0x7'),_0x578330,_0x546b01[_0xb2a2('0xd')]['message']);return _0x3319f4(_0x546b01[_0xb2a2('0xd')][_0xb2a2('0xe')]);}logger[_0xb2a2('0xd')](_0xb2a2('0x7'),_0x578330,_0x546b01[_0xb2a2('0xd')][_0xb2a2('0xe')]);return _0x49a161(_0x546b01[_0xb2a2('0xd')][_0xb2a2('0xe')]);}else{logger[_0xb2a2('0xf')](_0xb2a2('0x7'),_0x578330,_0xb2a2('0x8'));_0x49a161(_0x546b01['result'][_0xb2a2('0xe')]);}})['catch'](function(_0x768341){logger[_0xb2a2('0xd')](_0xb2a2('0x7'),_0x578330,_0x768341);_0x3319f4(_0x768341);});});} \ No newline at end of file +var _0xfb9a=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x742856,_0x51cd83){var _0x568e74=function(_0x5783a8){while(--_0x5783a8){_0x742856['push'](_0x742856['shift']());}};_0x568e74(++_0x51cd83);}(_0xfb9a,0x1f4));var _0xafb9=function(_0xa3dcbd,_0x88dd22){_0xa3dcbd=_0xa3dcbd-0x0;var _0x27dcd8=_0xfb9a[_0xa3dcbd];return _0x27dcd8;};'use strict';var _=require(_0xafb9('0x0'));var util=require(_0xafb9('0x1'));var moment=require(_0xafb9('0x2'));var BPromise=require(_0xafb9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafb9('0x4'));var db=require(_0xafb9('0x5'))['db'];var utils=require(_0xafb9('0x6'));var logger=require(_0xafb9('0x7'))(_0xafb9('0x8'));var config=require('../../config/environment');var jayson=require(_0xafb9('0x9'));var client=jayson[_0xafb9('0xa')][_0xafb9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b6048,_0x4fde55,_0x5708c0){return new BPromise(function(_0x808783,_0x4716ac){return client[_0xafb9('0xc')](_0x2b6048,_0x5708c0)[_0xafb9('0xd')](function(_0x2e94a8){logger[_0xafb9('0xe')](_0xafb9('0xf'),_0x4fde55,_0xafb9('0x10'));logger[_0xafb9('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4fde55,_0xafb9('0x10'),JSON['stringify'](_0x2e94a8));if(_0x2e94a8['error']){if(_0x2e94a8[_0xafb9('0x12')][_0xafb9('0x13')]===0x1f4){logger['error'](_0xafb9('0xf'),_0x4fde55,_0x2e94a8[_0xafb9('0x12')][_0xafb9('0x14')]);return _0x4716ac(_0x2e94a8['error'][_0xafb9('0x14')]);}logger[_0xafb9('0x12')](_0xafb9('0xf'),_0x4fde55,_0x2e94a8[_0xafb9('0x12')][_0xafb9('0x14')]);return _0x808783(_0x2e94a8[_0xafb9('0x12')]['message']);}else{logger[_0xafb9('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x4fde55,_0xafb9('0x10'));_0x808783(_0x2e94a8[_0xafb9('0x15')][_0xafb9('0x14')]);}})['catch'](function(_0x5ede7c){logger[_0xafb9('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4fde55,_0x5ede7c);_0x4716ac(_0x5ede7c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 3d40890..112d137 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 _0x4828=['./license.controller','get','index','put','/:id','update','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4828,0x13f));var _0x8482=function(_0x4a7fd1,_0x4bdde1){_0x4a7fd1=_0x4a7fd1-0x0;var _0x12ef10=_0x4828[_0x4a7fd1];return _0x12ef10;};'use strict';var multer=require('multer');var util=require(_0x8482('0x0'));var path=require('path');var timeout=require(_0x8482('0x1'));var express=require(_0x8482('0x2'));var router=express[_0x8482('0x3')]();var fs_extra=require(_0x8482('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8482('0x5'));var controller=require(_0x8482('0x6'));router[_0x8482('0x7')]('/',controller[_0x8482('0x8')]);router[_0x8482('0x9')](_0x8482('0xa'),auth['isAuthenticated'](),controller[_0x8482('0xb')]);module[_0x8482('0xc')]=router; \ No newline at end of file +var _0xab1f=['isAuthenticated','update','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','put','/:id'];(function(_0xa76db3,_0xf8fd0){var _0x47338e=function(_0x3163b6){while(--_0x3163b6){_0xa76db3['push'](_0xa76db3['shift']());}};_0x47338e(++_0xf8fd0);}(_0xab1f,0x91));var _0xfab1=function(_0x414d1e,_0x5b295c){_0x414d1e=_0x414d1e-0x0;var _0x35df4c=_0xab1f[_0x414d1e];return _0x35df4c;};'use strict';var multer=require(_0xfab1('0x0'));var util=require('util');var path=require(_0xfab1('0x1'));var timeout=require(_0xfab1('0x2'));var express=require(_0xfab1('0x3'));var router=express['Router']();var fs_extra=require(_0xfab1('0x4'));var auth=require(_0xfab1('0x5'));var interaction=require(_0xfab1('0x6'));var config=require(_0xfab1('0x7'));var controller=require('./license.controller');router[_0xfab1('0x8')]('/',controller['index']);router[_0xfab1('0x9')](_0xfab1('0xa'),auth[_0xfab1('0xb')](),controller[_0xfab1('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c99e5ed..c2d6b39 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 _0xdbf5=['exports','STRING','INTEGER'];(function(_0x2d6d5f,_0x583ccd){var _0x7a96b7=function(_0xe43cbe){while(--_0xe43cbe){_0x2d6d5f['push'](_0x2d6d5f['shift']());}};_0x7a96b7(++_0x583ccd);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x178e47,_0x170e1d){_0x178e47=_0x178e47-0x0;var _0x2f42f6=_0xdbf5[_0x178e47];return _0x2f42f6;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x53ec=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x3d5f09,_0x293238){var _0x3b14fe=function(_0x298b36){while(--_0x298b36){_0x3d5f09['push'](_0x3d5f09['shift']());}};_0x3b14fe(++_0x293238);}(_0x53ec,0x192));var _0xc53e=function(_0xbaf699,_0x4aa945){_0xbaf699=_0xbaf699-0x0;var _0x55a131=_0x53ec[_0xbaf699];return _0x55a131;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'license':{'type':Sequelize[_0xc53e('0x2')]},'data1':{'type':Sequelize[_0xc53e('0x3')]},'data2':{'type':Sequelize[_0xc53e('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xc53e('0x4')],'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 01dbc8b..36b8222 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 _0xb4b6=['License','rawAttributes','query','attributes','intersection','fields','getLicense','catch','update','body','params','get','checkLicense','demo','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','then','stack','name','model','keys'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x2ede45,_0x203b12){_0x2ede45=_0x2ede45-0x0;var _0x2842ac=_0xb4b6[_0x2ede45];return _0x2842ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b4b('0x0'));var zipdir=require(_0x6b4b('0x1'));var jsonpatch=require(_0x6b4b('0x2'));var rp=require(_0x6b4b('0x3'));var moment=require(_0x6b4b('0x4'));var BPromise=require(_0x6b4b('0x5'));var Mustache=require(_0x6b4b('0x6'));var util=require(_0x6b4b('0x7'));var path=require(_0x6b4b('0x8'));var sox=require('sox');var csv=require(_0x6b4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b4b('0xa'));var _=require(_0x6b4b('0xb'));var squel=require(_0x6b4b('0xc'));var crypto=require(_0x6b4b('0xd'));var jsforce=require(_0x6b4b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b4b('0x9'));var querystring=require(_0x6b4b('0xf'));var Papa=require(_0x6b4b('0x10'));var Redis=require(_0x6b4b('0x11'));var authService=require(_0x6b4b('0x12'));var qs=require(_0x6b4b('0x13'));var as=require(_0x6b4b('0x14'));var hardwareService=require(_0x6b4b('0x15'));var logger=require('../../config/logger')(_0x6b4b('0x16'));var utils=require('../../config/utils');var config=require(_0x6b4b('0x17'));var licenseUtil=require(_0x6b4b('0x18'));var db=require(_0x6b4b('0x19'))['db'];function respondWithStatusCode(_0x2ba8a0,_0x476d20){_0x476d20=_0x476d20||0xcc;return function(_0xa50ae5){if(_0xa50ae5){return _0x2ba8a0[_0x6b4b('0x1a')](_0x476d20);}return _0x2ba8a0['status'](_0x476d20)[_0x6b4b('0x1b')]();};}function respondWithResult(_0x2acc64,_0x3b99db){_0x3b99db=_0x3b99db||0xc8;return function(_0x587ed1){if(_0x587ed1){return _0x2acc64['status'](_0x3b99db)[_0x6b4b('0x1c')](_0x587ed1);}};}function respondWithFilteredResult(_0x2bf3fe,_0x5bf378){return function(_0x21ab38){if(_0x21ab38){var _0x3842a6=typeof _0x5bf378[_0x6b4b('0x1d')]===_0x6b4b('0x1e')&&typeof _0x5bf378[_0x6b4b('0x1f')]===_0x6b4b('0x1e');var _0x2fecb4=_0x21ab38[_0x6b4b('0x20')];var _0x15333b=_0x3842a6?0x0:_0x5bf378['offset'];var _0x5a1afc=_0x3842a6?_0x21ab38[_0x6b4b('0x20')]:_0x5bf378['offset']+_0x5bf378[_0x6b4b('0x1f')];var _0x44c5f6;if(_0x5a1afc>=_0x2fecb4){_0x5a1afc=_0x2fecb4;_0x44c5f6=0xc8;}else{_0x44c5f6=0xce;}_0x2bf3fe[_0x6b4b('0x21')](_0x44c5f6);return _0x2bf3fe[_0x6b4b('0x22')]('Content-Range',_0x15333b+'-'+_0x5a1afc+'/'+_0x2fecb4)[_0x6b4b('0x1c')](_0x21ab38);}return null;};}function patchUpdates(_0x6235eb){return function(_0x5f2224){try{jsonpatch['apply'](_0x5f2224,_0x6235eb,!![]);}catch(_0x5ec8a9){return BPromise[_0x6b4b('0x23')](_0x5ec8a9);}return _0x5f2224[_0x6b4b('0x24')]();};}function saveUpdates(_0x203f2a,_0x222e23){return function(_0x1a9fba){if(_0x1a9fba){return _0x1a9fba['update'](_0x203f2a)[_0x6b4b('0x25')](function(_0xbee434){return _0xbee434;});}return null;};}function removeEntity(_0x3a0376,_0xef64c9){return function(_0x595f33){if(_0x595f33){return _0x595f33['destroy']()['then'](function(){_0x3a0376['status'](0xcc)[_0x6b4b('0x1b')]();});}};}function handleEntityNotFound(_0x526f6d,_0x5df887){return function(_0x24e78a){if(!_0x24e78a){_0x526f6d[_0x6b4b('0x1a')](0x194);}return _0x24e78a;};}function handleError(_0x46580b,_0x35b517){_0x35b517=_0x35b517||0x1f4;return function(_0x5afba8){logger['error'](_0x5afba8[_0x6b4b('0x26')]);if(_0x5afba8[_0x6b4b('0x27')]){delete _0x5afba8[_0x6b4b('0x27')];}_0x46580b[_0x6b4b('0x21')](_0x35b517)['send'](_0x5afba8);};}var utilLicense=require(_0x6b4b('0x18'));exports['index']=function(_0x1c2f42,_0x1ab47c){var _0x334cf8={'raw':!![],'where':{'id':0x1}},_0x5efba8={};_0x5efba8[_0x6b4b('0x28')]=_[_0x6b4b('0x29')](db[_0x6b4b('0x2a')][_0x6b4b('0x2b')]);_0x5efba8[_0x6b4b('0x2c')]=_[_0x6b4b('0x29')](_0x1c2f42['query']);_0x5efba8['filters']=_['intersection'](_0x5efba8[_0x6b4b('0x28')],_0x5efba8[_0x6b4b('0x2c')]);_0x334cf8[_0x6b4b('0x2d')]=_[_0x6b4b('0x2e')](_0x5efba8[_0x6b4b('0x28')],qs[_0x6b4b('0x2f')](_0x1c2f42['query']['fields']));_0x334cf8['attributes']=_0x334cf8[_0x6b4b('0x2d')]['length']?_0x334cf8[_0x6b4b('0x2d')]:_0x5efba8['model'];_0x334cf8=_['merge']({},_0x334cf8,_0x1c2f42['options']);return utilLicense[_0x6b4b('0x30')](_0x334cf8)[_0x6b4b('0x25')](respondWithResult(_0x1ab47c,null))[_0x6b4b('0x31')](handleError(_0x1ab47c,null));};exports[_0x6b4b('0x32')]=function(_0x20d81a,_0x59015c){if(_0x20d81a[_0x6b4b('0x33')]['id']){delete _0x20d81a['body']['id'];}return db[_0x6b4b('0x2a')]['find']({'where':{'id':_0x20d81a[_0x6b4b('0x34')]['id']}})[_0x6b4b('0x25')](handleEntityNotFound(_0x59015c,null))[_0x6b4b('0x25')](function(_0x509fc1){var _0x273521=_0x509fc1[_0x6b4b('0x35')]({'plain':!![]});return utilLicense[_0x6b4b('0x36')](_0x273521,_0x20d81a['body']['key']);})[_0x6b4b('0x25')](function(_0x14522f){if(!_0x14522f[_0x6b4b('0x37')]){return saveUpdates(_0x20d81a[_0x6b4b('0x33')],null);}return _0x14522f;})[_0x6b4b('0x25')](respondWithResult(_0x59015c,null))[_0x6b4b('0x31')](handleError(_0x59015c,null));}; \ No newline at end of file +var _0x4975=['name','index','model','query','keys','intersection','fields','attributes','length','options','getLicense','catch','body','License','find','params','get','key','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x47fdd5,_0x43815a){var _0x3337dd=function(_0x49d70c){while(--_0x49d70c){_0x47fdd5['push'](_0x47fdd5['shift']());}};_0x3337dd(++_0x43815a);}(_0x4975,0x86));var _0x5497=function(_0x3af007,_0xe1d464){_0x3af007=_0x3af007-0x0;var _0x82bfd3=_0x4975[_0x3af007];return _0x82bfd3;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}var utilLicense=require('../../config/license/util');exports[_0x5497('0x29')]=function(_0x48d146,_0x5e9356){var _0xc3465={'raw':!![],'where':{'id':0x1}},_0xb14593={};_0xb14593[_0x5497('0x2a')]=_['keys'](db['License']['rawAttributes']);_0xb14593[_0x5497('0x2b')]=_[_0x5497('0x2c')](_0x48d146[_0x5497('0x2b')]);_0xb14593['filters']=_['intersection'](_0xb14593['model'],_0xb14593[_0x5497('0x2b')]);_0xc3465['attributes']=_[_0x5497('0x2d')](_0xb14593[_0x5497('0x2a')],qs[_0x5497('0x2e')](_0x48d146['query'][_0x5497('0x2e')]));_0xc3465[_0x5497('0x2f')]=_0xc3465['attributes'][_0x5497('0x30')]?_0xc3465[_0x5497('0x2f')]:_0xb14593[_0x5497('0x2a')];_0xc3465=_['merge']({},_0xc3465,_0x48d146[_0x5497('0x31')]);return utilLicense[_0x5497('0x32')](_0xc3465)[_0x5497('0x24')](respondWithResult(_0x5e9356,null))[_0x5497('0x33')](handleError(_0x5e9356,null));};exports[_0x5497('0x23')]=function(_0x4a6459,_0x386845){if(_0x4a6459[_0x5497('0x34')]['id']){delete _0x4a6459['body']['id'];}return db[_0x5497('0x35')][_0x5497('0x36')]({'where':{'id':_0x4a6459[_0x5497('0x37')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x386845,null))[_0x5497('0x24')](function(_0x37011c){var _0x580e86=_0x37011c[_0x5497('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x580e86,_0x4a6459[_0x5497('0x34')][_0x5497('0x39')]);})[_0x5497('0x24')](function(_0x5ab18c){if(!_0x5ab18c['demo']){return saveUpdates(_0x4a6459[_0x5497('0x34')],null);}return _0x5ab18c;})[_0x5497('0x24')](respondWithResult(_0x386845,null))[_0x5497('0x33')](handleError(_0x386845,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1329370..53f9497 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 _0x90c8=['license','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','define','License'];(function(_0x54a192,_0x4d8636){var _0x18560d=function(_0x538d01){while(--_0x538d01){_0x54a192['push'](_0x54a192['shift']());}};_0x18560d(++_0x4d8636);}(_0x90c8,0x1eb));var _0x890c=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x90c8[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x890c('0x0'));var util=require(_0x890c('0x1'));var logger=require(_0x890c('0x2'))(_0x890c('0x3'));var moment=require(_0x890c('0x4'));var BPromise=require(_0x890c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x890c('0x6'));var rimraf=require(_0x890c('0x7'));var config=require(_0x890c('0x8'));var attributes=require(_0x890c('0x9'));module[_0x890c('0xa')]=function(_0x1b1b10,_0x1adc15){return _0x1b1b10[_0x890c('0xb')](_0x890c('0xc'),attributes,{'tableName':_0x890c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08b3=['exports','define','License','license','lodash','util','../../config/logger','api','rimraf','./license.attributes'];(function(_0x2ec719,_0x390e2a){var _0x51b3a5=function(_0x4ce142){while(--_0x4ce142){_0x2ec719['push'](_0x2ec719['shift']());}};_0x51b3a5(++_0x390e2a);}(_0x08b3,0x130));var _0x308b=function(_0x21aa59,_0x3fd7d6){_0x21aa59=_0x21aa59-0x0;var _0x52eb81=_0x08b3[_0x21aa59];return _0x52eb81;};'use strict';var _=require(_0x308b('0x0'));var util=require(_0x308b('0x1'));var logger=require(_0x308b('0x2'))(_0x308b('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(_0x308b('0x4'));var config=require('../../config/environment');var attributes=require(_0x308b('0x5'));module[_0x308b('0x6')]=function(_0x35958b,_0x44220a){return _0x35958b[_0x308b('0x7')](_0x308b('0x8'),attributes,{'tableName':_0x308b('0x9'),'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 eb4a592..37a015b 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 _0x4d41=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','License,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x4ae8b6,_0x2415d0){var _0x414254=function(_0x234500){while(--_0x234500){_0x4ae8b6['push'](_0x4ae8b6['shift']());}};_0x414254(++_0x2415d0);}(_0x4d41,0x153));var _0x14d4=function(_0x242152,_0x2f7b09){_0x242152=_0x242152-0x0;var _0x167a0d=_0x4d41[_0x242152];return _0x167a0d;};'use strict';var _=require(_0x14d4('0x0'));var util=require(_0x14d4('0x1'));var moment=require(_0x14d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x14d4('0x3'));var fs=require('fs');var Redis=require(_0x14d4('0x4'));var db=require(_0x14d4('0x5'))['db'];var utils=require(_0x14d4('0x6'));var logger=require(_0x14d4('0x7'))(_0x14d4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14d4('0x9')][_0x14d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f7d30,_0x586569,_0x5a6cc0){return new BPromise(function(_0x5af0d5,_0x38ad4e){return client[_0x14d4('0xb')](_0x2f7d30,_0x5a6cc0)[_0x14d4('0xc')](function(_0x466286){logger['info']('License,\x20%s,\x20%s',_0x586569,_0x14d4('0xd'));logger[_0x14d4('0xe')](_0x14d4('0xf'),_0x586569,'request\x20sent',JSON['stringify'](_0x466286));if(_0x466286[_0x14d4('0x10')]){if(_0x466286['error'][_0x14d4('0x11')]===0x1f4){logger[_0x14d4('0x10')]('License,\x20%s,\x20%s',_0x586569,_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);return _0x38ad4e(_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);}logger[_0x14d4('0x10')](_0x14d4('0x13'),_0x586569,_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);return _0x5af0d5(_0x466286[_0x14d4('0x10')]['message']);}else{logger[_0x14d4('0x14')](_0x14d4('0x13'),_0x586569,_0x14d4('0xd'));_0x5af0d5(_0x466286['result'][_0x14d4('0x12')]);}})[_0x14d4('0x15')](function(_0x2eafb9){logger[_0x14d4('0x10')](_0x14d4('0x13'),_0x586569,_0x2eafb9);_0x38ad4e(_0x2eafb9);});});} \ No newline at end of file +var _0x684c=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis'];(function(_0x46fa41,_0x509ce7){var _0x2b36ea=function(_0x5de590){while(--_0x5de590){_0x46fa41['push'](_0x46fa41['shift']());}};_0x2b36ea(++_0x509ce7);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var util=require(_0xc684('0x1'));var moment=require('moment');var BPromise=require(_0xc684('0x2'));var rs=require(_0xc684('0x3'));var fs=require('fs');var Redis=require(_0xc684('0x4'));var db=require(_0xc684('0x5'))['db'];var utils=require(_0xc684('0x6'));var logger=require('../../config/logger')(_0xc684('0x7'));var config=require(_0xc684('0x8'));var jayson=require(_0xc684('0x9'));var client=jayson[_0xc684('0xa')][_0xc684('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57a63c,_0x23bd1c,_0x1a96ea){return new BPromise(function(_0x146733,_0xccb771){return client[_0xc684('0xc')](_0x57a63c,_0x1a96ea)[_0xc684('0xd')](function(_0x3b3bc0){logger[_0xc684('0xe')](_0xc684('0xf'),_0x23bd1c,_0xc684('0x10'));logger[_0xc684('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x23bd1c,_0xc684('0x10'),JSON[_0xc684('0x12')](_0x3b3bc0));if(_0x3b3bc0[_0xc684('0x13')]){if(_0x3b3bc0[_0xc684('0x13')][_0xc684('0x14')]===0x1f4){logger[_0xc684('0x13')]('License,\x20%s,\x20%s',_0x23bd1c,_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);return _0xccb771(_0x3b3bc0['error']['message']);}logger[_0xc684('0x13')](_0xc684('0xf'),_0x23bd1c,_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);return _0x146733(_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);}else{logger['info']('License,\x20%s,\x20%s',_0x23bd1c,_0xc684('0x10'));_0x146733(_0x3b3bc0['result']['message']);}})['catch'](function(_0x47a8eb){logger['error'](_0xc684('0xf'),_0x23bd1c,_0x47a8eb);_0xccb771(_0x47a8eb);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f0669ce..19efd1b 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 _0xcf1e=['addDisposition','addAnswer','addImap','addSmtp','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeDispositions','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post'];(function(_0x147e9e,_0x3dfac5){var _0x1b42cf=function(_0x3a9bdc){while(--_0x3a9bdc){_0x147e9e['push'](_0x147e9e['shift']());}};_0x1b42cf(++_0x3dfac5);}(_0xcf1e,0xa7));var _0xecf1=function(_0x44f3c8,_0x42bdd7){_0x44f3c8=_0x44f3c8-0x0;var _0x272fd4=_0xcf1e[_0x44f3c8];return _0x272fd4;};'use strict';var multer=require(_0xecf1('0x0'));var util=require(_0xecf1('0x1'));var path=require(_0xecf1('0x2'));var timeout=require(_0xecf1('0x3'));var express=require('express');var router=express[_0xecf1('0x4')]();var fs_extra=require(_0xecf1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xecf1('0x6'));var config=require(_0xecf1('0x7'));var controller=require(_0xecf1('0x8'));router[_0xecf1('0x9')]('/',auth[_0xecf1('0xa')](),controller[_0xecf1('0xb')]);router['get']('/describe',auth[_0xecf1('0xa')](),controller[_0xecf1('0xc')]);router['get']('/:id',auth[_0xecf1('0xa')](),controller[_0xecf1('0xd')]);router['get'](_0xecf1('0xe'),auth[_0xecf1('0xa')](),controller[_0xecf1('0xf')]);router[_0xecf1('0x9')](_0xecf1('0x10'),auth['isAuthenticated'](),controller[_0xecf1('0x11')]);router[_0xecf1('0x9')](_0xecf1('0x12'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x13')]);router['get'](_0xecf1('0x14'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x15')]);router['get'](_0xecf1('0x16'),auth['isAuthenticated'](),controller[_0xecf1('0x17')]);router[_0xecf1('0x9')](_0xecf1('0x18'),auth['isAuthenticated'](),controller[_0xecf1('0x19')]);router[_0xecf1('0x9')](_0xecf1('0x1a'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x1b')]);router['get'](_0xecf1('0x1c'),auth['isAuthenticated'](),controller[_0xecf1('0x1d')]);router['get'](_0xecf1('0x1e'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x1f')]);router[_0xecf1('0x20')](_0xecf1('0xe'),auth['isAuthenticated'](),controller[_0xecf1('0x21')]);router['post'](_0xecf1('0x10'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x22')]);router[_0xecf1('0x20')]('/',auth[_0xecf1('0xa')](),controller['create']);router[_0xecf1('0x20')](_0xecf1('0x12'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x23')]);router[_0xecf1('0x20')](_0xecf1('0x14'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x24')]);router[_0xecf1('0x20')](_0xecf1('0x16'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0xecf1('0x18'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x25')]);router[_0xecf1('0x20')](_0xecf1('0x26'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x27')]);router[_0xecf1('0x20')](_0xecf1('0x1e'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x28')]);router[_0xecf1('0x29')](_0xecf1('0x2a'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x2b')]);router[_0xecf1('0x2c')](_0xecf1('0xe'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x2d')]);router[_0xecf1('0x2c')]('/:id/canned_answers',auth[_0xecf1('0xa')](),controller['removeAnswers']);router[_0xecf1('0x2c')](_0xecf1('0x12'),auth[_0xecf1('0xa')](),controller[_0xecf1('0x2e')]);router[_0xecf1('0x2c')](_0xecf1('0x14'),auth[_0xecf1('0xa')](),controller['removeSmtp']);router[_0xecf1('0x2c')]('/:id',auth[_0xecf1('0xa')](),controller[_0xecf1('0x2f')]);router[_0xecf1('0x2c')]('/:id/users',auth[_0xecf1('0xa')](),controller[_0xecf1('0x30')]);module[_0xecf1('0x31')]=router; \ No newline at end of file +var _0x2223=['/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/applications','addApplications','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/messages','getMessages','verifySmtp'];(function(_0x2da6e6,_0x4d7b3d){var _0x21740d=function(_0x294aff){while(--_0x294aff){_0x2da6e6['push'](_0x2da6e6['shift']());}};_0x21740d(++_0x4d7b3d);}(_0x2223,0x1b4));var _0x3222=function(_0x19f96b,_0x4089e8){_0x19f96b=_0x19f96b-0x0;var _0x59e0c4=_0x2223[_0x19f96b];return _0x59e0c4;};'use strict';var multer=require(_0x3222('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3222('0x1'));var express=require('express');var router=express[_0x3222('0x2')]();var fs_extra=require(_0x3222('0x3'));var auth=require(_0x3222('0x4'));var interaction=require(_0x3222('0x5'));var config=require(_0x3222('0x6'));var controller=require(_0x3222('0x7'));router[_0x3222('0x8')]('/',auth[_0x3222('0x9')](),controller[_0x3222('0xa')]);router[_0x3222('0x8')]('/describe',auth[_0x3222('0x9')](),controller['describe']);router[_0x3222('0x8')](_0x3222('0xb'),auth[_0x3222('0x9')](),controller[_0x3222('0xc')]);router[_0x3222('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3222('0xd')]);router[_0x3222('0x8')](_0x3222('0xe'),auth['isAuthenticated'](),controller[_0x3222('0xf')]);router[_0x3222('0x8')](_0x3222('0x10'),auth[_0x3222('0x9')](),controller[_0x3222('0x11')]);router['get']('/:id/out_servers',auth[_0x3222('0x9')](),controller[_0x3222('0x12')]);router[_0x3222('0x8')](_0x3222('0x13'),auth[_0x3222('0x9')](),controller[_0x3222('0x14')]);router[_0x3222('0x8')]('/:id/applications',auth[_0x3222('0x9')](),controller['getApplications']);router['get'](_0x3222('0x15'),auth[_0x3222('0x9')](),controller[_0x3222('0x16')]);router[_0x3222('0x8')]('/:id/verify',auth['isAuthenticated'](),controller[_0x3222('0x17')]);router['get'](_0x3222('0x18'),auth['isAuthenticated'](),controller[_0x3222('0x19')]);router[_0x3222('0x1a')](_0x3222('0x1b'),auth['isAuthenticated'](),controller[_0x3222('0x1c')]);router[_0x3222('0x1a')](_0x3222('0xe'),auth[_0x3222('0x9')](),controller[_0x3222('0x1d')]);router[_0x3222('0x1a')]('/',auth[_0x3222('0x9')](),controller[_0x3222('0x1e')]);router['post'](_0x3222('0x10'),auth[_0x3222('0x9')](),controller[_0x3222('0x1f')]);router[_0x3222('0x1a')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x3222('0x20')]);router['post']('/:id/interactions',auth[_0x3222('0x9')](),controller[_0x3222('0x21')]);router[_0x3222('0x1a')](_0x3222('0x22'),auth[_0x3222('0x9')](),controller[_0x3222('0x23')]);router['post']('/:id/send',auth[_0x3222('0x9')](),controller['send']);router['post'](_0x3222('0x18'),auth[_0x3222('0x9')](),controller[_0x3222('0x24')]);router[_0x3222('0x25')](_0x3222('0xb'),auth[_0x3222('0x9')](),controller['update']);router[_0x3222('0x26')](_0x3222('0x1b'),auth[_0x3222('0x9')](),controller[_0x3222('0x27')]);router['delete'](_0x3222('0xe'),auth[_0x3222('0x9')](),controller[_0x3222('0x28')]);router[_0x3222('0x26')](_0x3222('0x10'),auth[_0x3222('0x9')](),controller[_0x3222('0x29')]);router[_0x3222('0x26')](_0x3222('0x2a'),auth[_0x3222('0x9')](),controller[_0x3222('0x2b')]);router[_0x3222('0x26')](_0x3222('0xb'),auth['isAuthenticated'](),controller[_0x3222('0x2c')]);router['delete'](_0x3222('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3222('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 241ce2a..0e88ccd 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 _0x72f5=['mandatoryDisposition','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x72f5,0x1c8));var _0x572f=function(_0x138ed4,_0x2e6a7a){_0x138ed4=_0x138ed4-0x0;var _0x453256=_0x72f5[_0x138ed4];return _0x453256;};'use strict';var Sequelize=require('sequelize');module[_0x572f('0x0')]={'description':{'type':Sequelize[_0x572f('0x1')]},'name':{'type':Sequelize[_0x572f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x572f('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x572f('0x3')]},'markAsUnread':{'type':Sequelize[_0x572f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x572f('0x1')],'allowNull':![],'defaultValue':_0x572f('0x4')},'fontSize':{'type':Sequelize[_0x572f('0x5')](0x2)[_0x572f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x572f('0x7');}},'notificationSound':{'type':Sequelize[_0x572f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x572f('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x572f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x572f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x572f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x572f('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x572f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x572f('0x2')],'defaultValue':![],'comment':_0x572f('0x9'),'set':function(_0x517fda){if(!_0x517fda)this['setDataValue'](_0x572f('0xa'),null);this[_0x572f('0xb')](_0x572f('0xc'),_0x517fda);}}}; \ No newline at end of file +var _0x5ebc=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x1690b4,_0xacaf2b){var _0x1997af=function(_0x3f88e2){while(--_0x3f88e2){_0x1690b4['push'](_0x1690b4['shift']());}};_0x1997af(++_0xacaf2b);}(_0x5ebc,0x94));var _0xc5eb=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x5ebc[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0xc5eb('0x0'));module[_0xc5eb('0x1')]={'description':{'type':Sequelize[_0xc5eb('0x2')]},'name':{'type':Sequelize[_0xc5eb('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc5eb('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc5eb('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xc5eb('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xc5eb('0x4')]},'markAsUnread':{'type':Sequelize[_0xc5eb('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc5eb('0x2')],'allowNull':![],'defaultValue':_0xc5eb('0x5')},'fontSize':{'type':Sequelize[_0xc5eb('0x6')](0x2)[_0xc5eb('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc5eb('0x4')],'defaultValue':function(){return _0xc5eb('0x8');}},'notificationSound':{'type':Sequelize[_0xc5eb('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc5eb('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc5eb('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc5eb('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc5eb('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc5eb('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc5eb('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4a8c3f){if(!_0x4a8c3f)this[_0xc5eb('0x9')](_0xc5eb('0xa'),null);this['setDataValue'](_0xc5eb('0xb'),_0x4a8c3f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 9c74fdf..932d6bd 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 _0x36fb=['userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailAccount.socket','jayson/promise','client','http','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','json','save','update','destroy','MailAccounts','UserProfileResource','name','send','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','Imap','find','body','describe','addDisposition','MailAccountId','Disposition','create','findOne','nolimit','includeAll','removeDispositions','CannedAnswer','getAnswers','ids','email','ListId','active','description','isNil','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','User','fullname','Tag','Tags','color','tag','transaction','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit'];(function(_0x19ff50,_0x4ec334){var _0x33b996=function(_0x203a79){while(--_0x203a79){_0x19ff50['push'](_0x19ff50['shift']());}};_0x33b996(++_0x4ec334);}(_0x36fb,0xc8));var _0xb36f=function(_0x1fc987,_0x4f5657){_0x1fc987=_0x1fc987-0x0;var _0x56a13d=_0x36fb[_0x1fc987];return _0x56a13d;};'use strict';var emlformat=require(_0xb36f('0x0'));var rimraf=require(_0xb36f('0x1'));var zipdir=require(_0xb36f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb36f('0x3'));var moment=require(_0xb36f('0x4'));var BPromise=require(_0xb36f('0x5'));var Mustache=require(_0xb36f('0x6'));var util=require('util');var path=require(_0xb36f('0x7'));var sox=require(_0xb36f('0x8'));var csv=require(_0xb36f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb36f('0xa'));var _=require(_0xb36f('0xb'));var squel=require(_0xb36f('0xc'));var crypto=require(_0xb36f('0xd'));var jsforce=require(_0xb36f('0xe'));var deskjs=require(_0xb36f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb36f('0x10'));var Papa=require(_0xb36f('0x11'));var htmlToText=require(_0xb36f('0x12'));var juice=require(_0xb36f('0x13'));var Redis=require(_0xb36f('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb36f('0x15'));var as=require(_0xb36f('0x16'));var hardwareService=require(_0xb36f('0x17'));var logger=require(_0xb36f('0x18'))('api');var utils=require(_0xb36f('0x19'));var config=require(_0xb36f('0x1a'));var licenseUtil=require(_0xb36f('0x1b'));var db=require(_0xb36f('0x1c'))['db'];config[_0xb36f('0x1d')]=_[_0xb36f('0x1e')](config[_0xb36f('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb36f('0x1f'))['register'](socket);var jayson=require(_0xb36f('0x20'));var client=jayson[_0xb36f('0x21')][_0xb36f('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x5860cd,_0x4cbbd2,_0x4083b5,_0x5c1f3c){return new BPromise(function(_0x2c18c4,_0x44fd5e){var _0x1fe7a3=_0x5c1f3c||client;return _0x1fe7a3['request'](_0x5860cd,_0x4083b5)[_0xb36f('0x23')](function(_0x14c751){logger[_0xb36f('0x24')]('MailAccount,\x20%s,\x20%s',_0x4cbbd2,_0xb36f('0x25'));logger['debug'](_0xb36f('0x26'),_0x4cbbd2,_0xb36f('0x25'),JSON[_0xb36f('0x27')](_0x14c751));if(_0x14c751[_0xb36f('0x28')]){if(_0x14c751[_0xb36f('0x28')][_0xb36f('0x29')]===0x1f4){logger[_0xb36f('0x28')](_0xb36f('0x2a'),_0x4cbbd2,_0x14c751['error'][_0xb36f('0x2b')]);return _0x44fd5e(_0x14c751[_0xb36f('0x28')][_0xb36f('0x2b')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x4cbbd2,_0x14c751[_0xb36f('0x28')][_0xb36f('0x2b')]);return _0x2c18c4(_0x14c751[_0xb36f('0x28')]['message']);}else{logger[_0xb36f('0x24')]('MailAccount,\x20%s,\x20%s',_0x4cbbd2,_0xb36f('0x25'));_0x2c18c4(_0x14c751[_0xb36f('0x2c')][_0xb36f('0x2b')]);}})[_0xb36f('0x2d')](function(_0x52b3b7){logger['error']('MailAccount,\x20%s,\x20%s',_0x4cbbd2,_0x52b3b7);_0x44fd5e(_0x52b3b7);});});}function respondWithStatusCode(_0x72d902,_0x4249b8){_0x4249b8=_0x4249b8||0xcc;return function(_0x472db7){if(_0x472db7){return _0x72d902[_0xb36f('0x2e')](_0x4249b8);}return _0x72d902[_0xb36f('0x2f')](_0x4249b8)[_0xb36f('0x30')]();};}function respondWithResult(_0x13e7e7,_0x358d8b){_0x358d8b=_0x358d8b||0xc8;return function(_0x3693e1){if(_0x3693e1){return _0x13e7e7[_0xb36f('0x2f')](_0x358d8b)['json'](_0x3693e1);}};}function respondWithFilteredResult(_0x424dc1,_0xaa2650){return function(_0x2668b7){if(_0x2668b7){var _0x45c3dd=typeof _0xaa2650[_0xb36f('0x31')]==='undefined'&&typeof _0xaa2650[_0xb36f('0x32')]===_0xb36f('0x33');var _0x226c23=_0x2668b7[_0xb36f('0x34')];var _0x583887=_0x45c3dd?0x0:_0xaa2650[_0xb36f('0x31')];var _0x1e5a99=_0x45c3dd?_0x2668b7[_0xb36f('0x34')]:_0xaa2650[_0xb36f('0x31')]+_0xaa2650[_0xb36f('0x32')];var _0x263bd7;if(_0x1e5a99>=_0x226c23){_0x1e5a99=_0x226c23;_0x263bd7=0xc8;}else{_0x263bd7=0xce;}_0x424dc1[_0xb36f('0x2f')](_0x263bd7);return _0x424dc1[_0xb36f('0x35')]('Content-Range',_0x583887+'-'+_0x1e5a99+'/'+_0x226c23)[_0xb36f('0x36')](_0x2668b7);}return null;};}function patchUpdates(_0x42ada3){return function(_0x42bb19){try{jsonpatch['apply'](_0x42bb19,_0x42ada3,!![]);}catch(_0x30e2a6){return BPromise['reject'](_0x30e2a6);}return _0x42bb19[_0xb36f('0x37')]();};}function saveUpdates(_0x452ae7,_0x486c09){return function(_0x513f74){if(_0x513f74){return _0x513f74[_0xb36f('0x38')](_0x452ae7)['then'](function(_0x42cdbf){return _0x42cdbf;});}return null;};}function removeEntity(_0x80c966,_0x3e2082){return function(_0x18267e){if(_0x18267e){return _0x18267e[_0xb36f('0x39')]()[_0xb36f('0x23')](function(){var _0x2d5f32=_0x18267e['get']({'plain':!![]});var _0x4f48bd=_0xb36f('0x3a');return db[_0xb36f('0x3b')][_0xb36f('0x39')]({'where':{'type':_0x4f48bd,'resourceId':_0x2d5f32['id']}})['then'](function(){return _0x18267e;});})[_0xb36f('0x23')](function(){_0x80c966[_0xb36f('0x2f')](0xcc)[_0xb36f('0x30')]();});}};}function handleEntityNotFound(_0x10674f,_0x1be313){return function(_0x1b71f3){if(!_0x1b71f3){_0x10674f['sendStatus'](0x194);}return _0x1b71f3;};}function handleError(_0x47b857,_0x2c6f9a){_0x2c6f9a=_0x2c6f9a||0x1f4;return function(_0x419f06){logger[_0xb36f('0x28')](_0x419f06['stack']);if(_0x419f06[_0xb36f('0x3c')]){delete _0x419f06[_0xb36f('0x3c')];}_0x47b857['status'](_0x2c6f9a)[_0xb36f('0x3d')](_0x419f06);};}exports[_0xb36f('0x3e')]=function(_0x313435,_0x15c9c7){var _0x70d1bf={'include':[{'model':db[_0xb36f('0x3f')],'as':'Imap'},{'model':db[_0xb36f('0x40')],'as':_0xb36f('0x41')},{'model':db[_0xb36f('0x42')],'as':_0xb36f('0x43')}]},_0x29d178={},_0x978abb={'count':0x0,'rows':[]};var _0x298b7a=_[_0xb36f('0x44')](db[_0xb36f('0x45')][_0xb36f('0x46')],function(_0x196849){return{'name':_0x196849[_0xb36f('0x47')],'type':_0x196849[_0xb36f('0x48')][_0xb36f('0x49')]};});_0x29d178[_0xb36f('0x4a')]=_['map'](_0x298b7a,_0xb36f('0x3c'));_0x29d178['query']=_[_0xb36f('0x4b')](_0x313435[_0xb36f('0x4c')]);_0x29d178['filters']=_[_0xb36f('0x4d')](_0x29d178[_0xb36f('0x4a')],_0x29d178[_0xb36f('0x4c')]);_0x70d1bf[_0xb36f('0x4e')]=_[_0xb36f('0x4d')](_0x29d178[_0xb36f('0x4a')],qs[_0xb36f('0x4f')](_0x313435[_0xb36f('0x4c')][_0xb36f('0x4f')]));_0x70d1bf['attributes']=_0x70d1bf[_0xb36f('0x4e')][_0xb36f('0x50')]?_0x70d1bf[_0xb36f('0x4e')]:_0x29d178[_0xb36f('0x4a')];if(!_0x313435[_0xb36f('0x4c')][_0xb36f('0x51')]('nolimit')){_0x70d1bf[_0xb36f('0x32')]=qs['limit'](_0x313435[_0xb36f('0x4c')][_0xb36f('0x32')]);_0x70d1bf[_0xb36f('0x31')]=qs[_0xb36f('0x31')](_0x313435[_0xb36f('0x4c')]['offset']);}_0x70d1bf[_0xb36f('0x52')]=qs['sort'](_0x313435[_0xb36f('0x4c')][_0xb36f('0x53')]);_0x70d1bf[_0xb36f('0x54')]=qs[_0xb36f('0x55')](_[_0xb36f('0x56')](_0x313435[_0xb36f('0x4c')],_0x29d178[_0xb36f('0x55')]),_0x298b7a);if(_0x313435[_0xb36f('0x4c')]['filter']){_0x70d1bf['where']=_['merge'](_0x70d1bf[_0xb36f('0x54')],{'$or':_[_0xb36f('0x44')](_0x298b7a,function(_0x1b3573){if(_0x1b3573[_0xb36f('0x48')]!==_0xb36f('0x57')){var _0x273b4c={};_0x273b4c[_0x1b3573[_0xb36f('0x3c')]]={'$like':'%'+_0x313435[_0xb36f('0x4c')][_0xb36f('0x58')]+'%'};return _0x273b4c;}})});}_0x70d1bf=_[_0xb36f('0x59')]({},_0x70d1bf,_0x313435[_0xb36f('0x5a')]);var _0x4b6c25={'where':_0x70d1bf[_0xb36f('0x54')]};return db['MailAccount'][_0xb36f('0x34')](_0x4b6c25)[_0xb36f('0x23')](function(_0x611967){_0x978abb['count']=_0x611967;if(_0x313435[_0xb36f('0x4c')]['includeAll']){_0x70d1bf[_0xb36f('0x5b')]=[{'all':!![]}];}return db[_0xb36f('0x45')][_0xb36f('0x5c')](_0x70d1bf);})[_0xb36f('0x23')](function(_0x1c7b0d){_0x978abb[_0xb36f('0x5d')]=_0x1c7b0d;return _0x978abb;})['then'](respondWithFilteredResult(_0x15c9c7,_0x70d1bf))[_0xb36f('0x2d')](handleError(_0x15c9c7,null));};exports[_0xb36f('0x5e')]=function(_0x16da4b,_0x46fd93){var _0x3c70c5={'raw':![],'where':{'id':_0x16da4b[_0xb36f('0x5f')]['id']},'include':[{'model':db[_0xb36f('0x3f')],'as':_0xb36f('0x60')},{'model':db[_0xb36f('0x40')],'as':_0xb36f('0x41')},{'model':db[_0xb36f('0x42')],'as':_0xb36f('0x43')}]},_0x3722ac={};_0x3722ac[_0xb36f('0x4a')]=_[_0xb36f('0x4b')](db[_0xb36f('0x45')][_0xb36f('0x46')]);_0x3722ac[_0xb36f('0x4c')]=_[_0xb36f('0x4b')](_0x16da4b[_0xb36f('0x4c')]);_0x3722ac['filters']=_[_0xb36f('0x4d')](_0x3722ac['model'],_0x3722ac[_0xb36f('0x4c')]);_0x3c70c5[_0xb36f('0x4e')]=_['intersection'](_0x3722ac[_0xb36f('0x4a')],qs[_0xb36f('0x4f')](_0x16da4b['query'][_0xb36f('0x4f')]));_0x3c70c5[_0xb36f('0x4e')]=_0x3c70c5[_0xb36f('0x4e')][_0xb36f('0x50')]?_0x3c70c5[_0xb36f('0x4e')]:_0x3722ac[_0xb36f('0x4a')];if(_0x16da4b[_0xb36f('0x4c')]['includeAll']){_0x3c70c5[_0xb36f('0x5b')]=[{'all':!![]}];}_0x3c70c5=_[_0xb36f('0x59')]({},_0x3c70c5,_0x16da4b[_0xb36f('0x5a')]);return db[_0xb36f('0x45')][_0xb36f('0x61')](_0x3c70c5)[_0xb36f('0x23')](handleEntityNotFound(_0x46fd93,null))[_0xb36f('0x23')](respondWithResult(_0x46fd93,null))[_0xb36f('0x2d')](handleError(_0x46fd93,null));};exports[_0xb36f('0x38')]=function(_0x5ec220,_0x2d009a){if(_0x5ec220[_0xb36f('0x62')]['id']){delete _0x5ec220[_0xb36f('0x62')]['id'];}return db[_0xb36f('0x45')]['find']({'where':{'id':_0x5ec220[_0xb36f('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xb36f('0x40')],'as':_0xb36f('0x41')},{'model':db[_0xb36f('0x42')],'as':'mandatoryDispositionPause'}]})[_0xb36f('0x23')](handleEntityNotFound(_0x2d009a,null))[_0xb36f('0x23')](saveUpdates(_0x5ec220['body'],null))[_0xb36f('0x23')](function(_0x32eeaf){if(_0x32eeaf&&_0x5ec220[_0xb36f('0x62')]['Imap']){return db[_0xb36f('0x3f')][_0xb36f('0x38')](_0x5ec220['body'][_0xb36f('0x60')],{'where':{'MailAccountId':_0x32eeaf['id']}})['then'](function(){return _0x32eeaf;});}return _0x32eeaf;})[_0xb36f('0x23')](function(_0x210eff){if(_0x210eff&&_0x5ec220[_0xb36f('0x62')][_0xb36f('0x41')]){return db[_0xb36f('0x40')][_0xb36f('0x38')](_0x5ec220[_0xb36f('0x62')][_0xb36f('0x41')],{'where':{'MailAccountId':_0x210eff['id']}})['then'](function(){return _0x210eff;});}return _0x210eff;})[_0xb36f('0x23')](respondWithResult(_0x2d009a,null))[_0xb36f('0x2d')](handleError(_0x2d009a,null));};exports[_0xb36f('0x63')]=function(_0x48cf03,_0x2bea80){return db[_0xb36f('0x45')][_0xb36f('0x63')]()[_0xb36f('0x23')](respondWithResult(_0x2bea80,null))[_0xb36f('0x2d')](handleError(_0x2bea80,null));};exports[_0xb36f('0x64')]=function(_0x17c27f,_0x12989a,_0x4dbbb0){if(_0x17c27f[_0xb36f('0x62')]['id']){delete _0x17c27f[_0xb36f('0x62')]['id'];}return db[_0xb36f('0x45')]['find']({'where':{'id':_0x17c27f[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x12989a,null))['then'](function(_0xfdaf80){if(_0xfdaf80){_0x17c27f['body'][_0xb36f('0x65')]=_0xfdaf80['id'];return db[_0xb36f('0x66')][_0xb36f('0x67')](_0x17c27f[_0xb36f('0x62')]);}})[_0xb36f('0x23')](respondWithResult(_0x12989a,null))['catch'](handleError(_0x12989a,null));};exports['getDispositions']=function(_0x55276d,_0x3f9448,_0x3560dc){var _0xe6a499={'raw':![],'where':{}};var _0x327420={};var _0x4df6f2={'count':0x0,'rows':[]};return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x55276d[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x3f9448,null))[_0xb36f('0x23')](function(_0x2c44e6){if(_0x2c44e6){_0x327420[_0xb36f('0x4a')]=_['keys'](db[_0xb36f('0x66')]['rawAttributes']);_0x327420['query']=_[_0xb36f('0x4b')](_0x55276d[_0xb36f('0x4c')]);_0x327420[_0xb36f('0x55')]=_[_0xb36f('0x4d')](_0x327420['model'],_0x327420['query']);_0xe6a499[_0xb36f('0x4e')]=_[_0xb36f('0x4d')](_0x327420['model'],qs[_0xb36f('0x4f')](_0x55276d[_0xb36f('0x4c')]['fields']));_0xe6a499[_0xb36f('0x4e')]=_0xe6a499[_0xb36f('0x4e')]['length']?_0xe6a499[_0xb36f('0x4e')]:_0x327420[_0xb36f('0x4a')];if(!_0x55276d[_0xb36f('0x4c')][_0xb36f('0x51')](_0xb36f('0x69'))){_0xe6a499['limit']=qs['limit'](_0x55276d[_0xb36f('0x4c')]['limit']);_0xe6a499[_0xb36f('0x31')]=qs[_0xb36f('0x31')](_0x55276d[_0xb36f('0x4c')][_0xb36f('0x31')]);}_0xe6a499[_0xb36f('0x52')]=qs[_0xb36f('0x53')](_0x55276d[_0xb36f('0x4c')][_0xb36f('0x53')]);_0xe6a499[_0xb36f('0x54')]=qs[_0xb36f('0x55')](_[_0xb36f('0x56')](_0x55276d['query'],_0x327420[_0xb36f('0x55')]));_0xe6a499[_0xb36f('0x54')]['MailAccountId']=_0x2c44e6['id'];if(_0x55276d[_0xb36f('0x4c')][_0xb36f('0x58')]){_0xe6a499['where']=_[_0xb36f('0x59')](_0xe6a499[_0xb36f('0x54')],{'$or':_[_0xb36f('0x44')](_0xe6a499[_0xb36f('0x4e')],function(_0x4facf5){var _0x3dc3a2={};_0x3dc3a2[_0x4facf5]={'$like':'%'+_0x55276d[_0xb36f('0x4c')][_0xb36f('0x58')]+'%'};return _0x3dc3a2;})});}_0xe6a499=_[_0xb36f('0x59')]({},_0xe6a499,_0x55276d[_0xb36f('0x5a')]);return db[_0xb36f('0x66')][_0xb36f('0x34')]({'where':_0xe6a499[_0xb36f('0x54')]})[_0xb36f('0x23')](function(_0x5dc7fc){_0x4df6f2[_0xb36f('0x34')]=_0x5dc7fc;if(_0x55276d[_0xb36f('0x4c')][_0xb36f('0x6a')]){_0xe6a499[_0xb36f('0x5b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xe6a499);})['then'](function(_0x2c2a11){_0x4df6f2[_0xb36f('0x5d')]=_0x2c2a11;return _0x4df6f2;});}})[_0xb36f('0x23')](respondWithFilteredResult(_0x3f9448,_0xe6a499))['catch'](handleError(_0x3f9448,null));};exports[_0xb36f('0x6b')]=function(_0x1a8a8c,_0x2e58d8,_0x466c86){return db[_0xb36f('0x45')][_0xb36f('0x61')]({'where':{'id':_0x1a8a8c[_0xb36f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2e58d8,null))['then'](function(_0x5c2cdd){if(_0x5c2cdd){return _0x5c2cdd[_0xb36f('0x6b')](_0x1a8a8c['query']['ids']);}})[_0xb36f('0x23')](respondWithStatusCode(_0x2e58d8,null))[_0xb36f('0x2d')](handleError(_0x2e58d8,null));};exports['addAnswer']=function(_0x1eb338,_0x3badb5,_0xae9048){if(_0x1eb338[_0xb36f('0x62')]['id']){delete _0x1eb338[_0xb36f('0x62')]['id'];}return db[_0xb36f('0x45')][_0xb36f('0x61')]({'where':{'id':_0x1eb338['params']['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x3badb5,null))[_0xb36f('0x23')](function(_0x5191c2){if(_0x5191c2){_0x1eb338[_0xb36f('0x62')]['MailAccountId']=_0x5191c2['id'];return db[_0xb36f('0x6c')][_0xb36f('0x67')](_0x1eb338[_0xb36f('0x62')]);}})[_0xb36f('0x23')](respondWithResult(_0x3badb5,null))[_0xb36f('0x2d')](handleError(_0x3badb5,null));};exports[_0xb36f('0x6d')]=function(_0x3b2017,_0x3afbee,_0x1d3dda){var _0x1e365e={'raw':![],'where':{}};var _0x522ff5={};var _0x36767b={'count':0x0,'rows':[]};return db[_0xb36f('0x45')]['findOne']({'where':{'id':_0x3b2017[_0xb36f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3afbee,null))[_0xb36f('0x23')](function(_0x196507){if(_0x196507){_0x522ff5[_0xb36f('0x4a')]=_[_0xb36f('0x4b')](db['CannedAnswer'][_0xb36f('0x46')]);_0x522ff5[_0xb36f('0x4c')]=_[_0xb36f('0x4b')](_0x3b2017['query']);_0x522ff5[_0xb36f('0x55')]=_['intersection'](_0x522ff5[_0xb36f('0x4a')],_0x522ff5[_0xb36f('0x4c')]);_0x1e365e[_0xb36f('0x4e')]=_['intersection'](_0x522ff5['model'],qs[_0xb36f('0x4f')](_0x3b2017[_0xb36f('0x4c')][_0xb36f('0x4f')]));_0x1e365e['attributes']=_0x1e365e[_0xb36f('0x4e')][_0xb36f('0x50')]?_0x1e365e[_0xb36f('0x4e')]:_0x522ff5[_0xb36f('0x4a')];if(!_0x3b2017[_0xb36f('0x4c')][_0xb36f('0x51')](_0xb36f('0x69'))){_0x1e365e[_0xb36f('0x32')]=qs[_0xb36f('0x32')](_0x3b2017[_0xb36f('0x4c')][_0xb36f('0x32')]);_0x1e365e[_0xb36f('0x31')]=qs[_0xb36f('0x31')](_0x3b2017[_0xb36f('0x4c')][_0xb36f('0x31')]);}_0x1e365e[_0xb36f('0x52')]=qs[_0xb36f('0x53')](_0x3b2017[_0xb36f('0x4c')][_0xb36f('0x53')]);_0x1e365e[_0xb36f('0x54')]=qs[_0xb36f('0x55')](_[_0xb36f('0x56')](_0x3b2017['query'],_0x522ff5[_0xb36f('0x55')]));_0x1e365e[_0xb36f('0x54')]['MailAccountId']=_0x196507['id'];if(_0x3b2017[_0xb36f('0x4c')][_0xb36f('0x58')]){_0x1e365e['where']=_[_0xb36f('0x59')](_0x1e365e[_0xb36f('0x54')],{'$or':_[_0xb36f('0x44')](_0x1e365e['attributes'],function(_0xa394de){var _0x4d3486={};_0x4d3486[_0xa394de]={'$like':'%'+_0x3b2017['query'][_0xb36f('0x58')]+'%'};return _0x4d3486;})});}_0x1e365e=_[_0xb36f('0x59')]({},_0x1e365e,_0x3b2017['options']);return db[_0xb36f('0x6c')][_0xb36f('0x34')]({'where':_0x1e365e[_0xb36f('0x54')]})[_0xb36f('0x23')](function(_0x12c462){_0x36767b['count']=_0x12c462;if(_0x3b2017['query']['includeAll']){_0x1e365e['include']=[{'all':!![]}];}return db[_0xb36f('0x6c')][_0xb36f('0x5c')](_0x1e365e);})[_0xb36f('0x23')](function(_0x25cd4f){_0x36767b['rows']=_0x25cd4f;return _0x36767b;});}})['then'](respondWithFilteredResult(_0x3afbee,_0x1e365e))[_0xb36f('0x2d')](handleError(_0x3afbee,null));};exports['removeAnswers']=function(_0x3eef59,_0x3aaf86,_0x1e02e8){return db[_0xb36f('0x45')][_0xb36f('0x61')]({'where':{'id':_0x3eef59[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x3aaf86,null))[_0xb36f('0x23')](function(_0x2edd2a){if(_0x2edd2a){return _0x2edd2a['removeAnswers'](_0x3eef59[_0xb36f('0x4c')][_0xb36f('0x6e')]);}})['then'](respondWithStatusCode(_0x3aaf86,null))['catch'](handleError(_0x3aaf86,null));};exports[_0xb36f('0x67')]=function(_0x1c0737,_0x36fc11){var _0x2e98e0={'name':_0x1c0737[_0xb36f('0x62')][_0xb36f('0x3c')],'key':_0x1c0737['body']['key'],'email':_0x1c0737['body'][_0xb36f('0x6f')],'ListId':_0x1c0737[_0xb36f('0x62')][_0xb36f('0x70')],'active':!_['isNil'](_0x1c0737['body'][_0xb36f('0x71')])?_0x1c0737[_0xb36f('0x62')][_0xb36f('0x71')]:!![],'description':_0x1c0737[_0xb36f('0x62')][_0xb36f('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0xb36f('0x73')](_0x1c0737[_0xb36f('0x62')][_0xb36f('0x74')])){if(_0x1c0737['body'][_0xb36f('0x75')]){_0x2e98e0[_0xb36f('0x60')][_0xb36f('0x76')]=_0x2e98e0[_0xb36f('0x41')][_0xb36f('0x76')]=_0x1c0737[_0xb36f('0x62')][_0xb36f('0x77')];_0x2e98e0[_0xb36f('0x60')][_0xb36f('0x78')]=_0x2e98e0['Smtp'][_0xb36f('0x79')]=_0x1c0737[_0xb36f('0x62')][_0xb36f('0x7a')];}else{_0x2e98e0[_0xb36f('0x60')][_0xb36f('0x7b')]=_0x2e98e0[_0xb36f('0x41')][_0xb36f('0x7b')]=![];}_0x2e98e0[_0xb36f('0x60')][_0xb36f('0x7c')]=_0x1c0737[_0xb36f('0x62')][_0xb36f('0x60')][_0xb36f('0x7c')];_0x2e98e0[_0xb36f('0x60')]['port']=_0x1c0737[_0xb36f('0x62')][_0xb36f('0x60')][_0xb36f('0x7d')];_0x2e98e0['Smtp'][_0xb36f('0x7c')]=_0x1c0737['body'][_0xb36f('0x41')][_0xb36f('0x7c')];_0x2e98e0['Smtp']['port']=_0x1c0737[_0xb36f('0x62')][_0xb36f('0x41')][_0xb36f('0x7d')];}else{_0x2e98e0[_0xb36f('0x60')][_0xb36f('0x7e')]=_0x2e98e0['Smtp'][_0xb36f('0x7e')]=_0x1c0737[_0xb36f('0x62')][_0xb36f('0x74')];_0x2e98e0['Imap'][_0xb36f('0x76')]=_0x2e98e0[_0xb36f('0x41')][_0xb36f('0x76')]=_0x1c0737[_0xb36f('0x62')][_0xb36f('0x77')];_0x2e98e0[_0xb36f('0x60')][_0xb36f('0x78')]=_0x2e98e0[_0xb36f('0x41')][_0xb36f('0x79')]=_0x1c0737['body']['cpassword'];}return db[_0xb36f('0x45')]['create'](_0x2e98e0,{'include':[{'model':db[_0xb36f('0x40')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xb36f('0x60')}]})['then'](function(_0x101eff){var _0x5df467=_0x1c0737[_0xb36f('0x76')][_0xb36f('0x7f')]({'plain':!![]});if(!_0x5df467)throw new Error(_0xb36f('0x80'));if(_0x5df467[_0xb36f('0x81')]===_0xb36f('0x76')){var _0x91fee0=_0x101eff['get']({'plain':!![]});return db[_0xb36f('0x82')][_0xb36f('0x61')]({'where':{'name':'MailAccounts','userProfileId':_0x5df467[_0xb36f('0x83')]},'raw':!![]})['then'](function(_0x38e524){if(_0x38e524&&_0x38e524[_0xb36f('0x84')]===0x0){return db[_0xb36f('0x3b')]['create']({'name':_0x91fee0['name'],'resourceId':_0x91fee0['id'],'type':_0x38e524['name'],'sectionId':_0x38e524['id']},{})['then'](function(){return _0x101eff;});}else{return _0x101eff;}})[_0xb36f('0x2d')](function(_0x565327){logger[_0xb36f('0x28')](_0xb36f('0x85'),_0x565327);throw _0x565327;});}return _0x101eff;})['then'](respondWithResult(_0x36fc11,0xc9))['catch'](handleError(_0x36fc11,null));};exports[_0xb36f('0x86')]=function(_0x371418,_0x364972,_0x224ef0){return db[_0xb36f('0x45')]['findOne']({'where':{'id':_0x371418[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x364972,null))[_0xb36f('0x23')](function(_0x2aa194){if(_0x2aa194){return _0x2aa194[_0xb36f('0x86')]();}return null;})[_0xb36f('0x23')](respondWithResult(_0x364972,null))[_0xb36f('0x2d')](handleError(_0x364972,null));};exports[_0xb36f('0x87')]=function(_0x58bd2d,_0x368e78,_0x1e0d92){if(_0x58bd2d[_0xb36f('0x62')]['id']){delete _0x58bd2d[_0xb36f('0x62')]['id'];}return db[_0xb36f('0x45')]['find']({'where':{'id':_0x58bd2d['params']['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x368e78,null))[_0xb36f('0x23')](function(_0x563e90){if(_0x563e90){_0x58bd2d['body'][_0xb36f('0x65')]=_0x563e90['id'];return db[_0xb36f('0x3f')]['create'](_0x58bd2d[_0xb36f('0x62')]);}})[_0xb36f('0x23')](respondWithResult(_0x368e78,null))[_0xb36f('0x2d')](handleError(_0x368e78,null));};exports[_0xb36f('0x88')]=function(_0x54ebbe,_0xe06e1b,_0x43288c){return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x54ebbe[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0xe06e1b,null))[_0xb36f('0x23')](function(_0x204319){if(_0x204319){return _0x204319[_0xb36f('0x89')](null);}return null;})[_0xb36f('0x23')](respondWithStatusCode(_0xe06e1b,null))[_0xb36f('0x2d')](handleError(_0xe06e1b,null));};exports[_0xb36f('0x8a')]=function(_0x124823,_0x1506ef,_0x27ce59){return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x124823[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x1506ef,null))['then'](function(_0x33c3b8){if(_0x33c3b8){return _0x33c3b8[_0xb36f('0x8a')]();}return null;})[_0xb36f('0x23')](respondWithResult(_0x1506ef,null))['catch'](handleError(_0x1506ef,null));};exports[_0xb36f('0x8b')]=function(_0x309395,_0x1a2e02,_0x279c54){if(_0x309395[_0xb36f('0x62')]['id']){delete _0x309395[_0xb36f('0x62')]['id'];}return db[_0xb36f('0x45')][_0xb36f('0x61')]({'where':{'id':_0x309395[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x1a2e02,null))[_0xb36f('0x23')](function(_0x26c2b3){if(_0x26c2b3){_0x309395[_0xb36f('0x62')][_0xb36f('0x65')]=_0x26c2b3['id'];return db[_0xb36f('0x40')]['create'](_0x309395[_0xb36f('0x62')]);}})[_0xb36f('0x23')](respondWithResult(_0x1a2e02,null))[_0xb36f('0x2d')](handleError(_0x1a2e02,null));};exports['removeSmtp']=function(_0x947455,_0xb3b324,_0x46556a){return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x947455[_0xb36f('0x5f')]['id']}})['then'](handleEntityNotFound(_0xb3b324,null))[_0xb36f('0x23')](function(_0x5ae527){if(_0x5ae527){return _0x5ae527[_0xb36f('0x8c')](null);}return null;})[_0xb36f('0x23')](respondWithStatusCode(_0xb3b324,null))[_0xb36f('0x2d')](handleError(_0xb3b324,null));};exports[_0xb36f('0x8d')]=function(_0x30b67b,_0x316c02,_0x1aba57){return db['MailInteraction'][_0xb36f('0x61')]({'where':{'id':_0x30b67b[_0xb36f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x316c02,null))[_0xb36f('0x23')](function(_0x5b454e){if(_0x5b454e){return _0x5b454e['addInteraction'](_0x30b67b[_0xb36f('0x62')][_0xb36f('0x6e')],_[_0xb36f('0x8e')](_0x30b67b[_0xb36f('0x62')],['ids','id'])||{});}})[_0xb36f('0x23')](respondWithResult(_0x316c02,null))['catch'](handleError(_0x316c02,null));};exports[_0xb36f('0x8f')]=function(_0x3480ce,_0x25cd94,_0x2f3170){var _0x335bdd={'raw':![],'where':{}};var _0x5b2670={};var _0x152c4e={'count':0x0,'rows':[]};return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x3480ce[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x25cd94,null))['then'](function(_0x381a0a){if(_0x381a0a){_0x5b2670[_0xb36f('0x4a')]=_[_0xb36f('0x4b')](db[_0xb36f('0x90')][_0xb36f('0x46')]);_0x5b2670['query']=_['keys'](_0x3480ce[_0xb36f('0x4c')]);_0x5b2670[_0xb36f('0x55')]=_[_0xb36f('0x4d')](_0x5b2670[_0xb36f('0x4a')],_0x5b2670[_0xb36f('0x4c')]);_0x335bdd[_0xb36f('0x4e')]=_['intersection'](_0x5b2670['model'],qs[_0xb36f('0x4f')](_0x3480ce[_0xb36f('0x4c')][_0xb36f('0x4f')]));_0x335bdd['attributes']=_0x335bdd[_0xb36f('0x4e')]['length']?_0x335bdd['attributes']:_0x5b2670[_0xb36f('0x4a')];if(!_0x3480ce['query']['hasOwnProperty']('nolimit')){_0x335bdd['limit']=qs[_0xb36f('0x32')](_0x3480ce[_0xb36f('0x4c')][_0xb36f('0x32')]);_0x335bdd[_0xb36f('0x31')]=qs[_0xb36f('0x31')](_0x3480ce[_0xb36f('0x4c')]['offset']);}_0x335bdd[_0xb36f('0x52')]=qs['sort'](_0x3480ce[_0xb36f('0x4c')][_0xb36f('0x53')]);_0x335bdd[_0xb36f('0x54')]=qs[_0xb36f('0x55')](_[_0xb36f('0x56')](_0x3480ce[_0xb36f('0x4c')],_0x5b2670[_0xb36f('0x55')]));_0x335bdd[_0xb36f('0x54')][_0xb36f('0x65')]=_0x381a0a['id'];if(_0x3480ce[_0xb36f('0x4c')]['filter']){_0x335bdd['where']=_[_0xb36f('0x59')](_0x335bdd[_0xb36f('0x54')],{'$or':_[_0xb36f('0x44')](_0x335bdd[_0xb36f('0x4e')],function(_0x5461fc){var _0x551809={};_0x551809[_0x5461fc]={'$like':'%'+_0x3480ce[_0xb36f('0x4c')][_0xb36f('0x58')]+'%'};return _0x551809;})});}_0x335bdd=_['merge']({},_0x335bdd,_0x3480ce[_0xb36f('0x5a')]);return db[_0xb36f('0x90')][_0xb36f('0x34')]({'where':_0x335bdd['where']})['then'](function(_0x152e2d){_0x152c4e[_0xb36f('0x34')]=_0x152e2d;if(_0x3480ce[_0xb36f('0x4c')]['includeAll']){_0x335bdd[_0xb36f('0x5b')]=[{'model':db[_0xb36f('0x91')],'as':'Contact','required':![]},{'model':db[_0xb36f('0x92')],'as':'Owner','attributes':[_0xb36f('0x3c'),_0xb36f('0x93'),'internal'],'required':![]},{'model':db[_0xb36f('0x94')],'as':_0xb36f('0x95'),'attributes':['id',_0xb36f('0x3c'),_0xb36f('0x96')],'where':_0x3480ce[_0xb36f('0x4c')][_0xb36f('0x97')]?{'id':_0x3480ce[_0xb36f('0x4c')]['tag']}:undefined,'required':_0x3480ce[_0xb36f('0x4c')][_0xb36f('0x97')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x335bdd);})['then'](function(_0x287720){_0x152c4e[_0xb36f('0x5d')]=_0x287720;return _0x152c4e;});}})[_0xb36f('0x23')](respondWithFilteredResult(_0x25cd94,_0x335bdd))['catch'](handleError(_0x25cd94,null));};exports['addApplications']=function(_0x1ac8c1,_0x223d03,_0x31ed6c){return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x1ac8c1[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x223d03,null))['then'](function(_0x271d38){if(_0x271d38){return db['sequelize'][_0xb36f('0x98')](function(_0x75ae12){return db['MailApplication'][_0xb36f('0x39')]({'where':{'MailAccountId':_0x1ac8c1['params']['id']},'transaction':_0x75ae12})[_0xb36f('0x23')](function(_0xde3332){var _0x18f584=_[_0xb36f('0x44')](_0x1ac8c1[_0xb36f('0x62')],function(_0x40426d){_0x40426d[_0xb36f('0x65')]=_0x1ac8c1[_0xb36f('0x5f')]['id'];return _0x40426d;});return db[_0xb36f('0x99')]['bulkCreate'](_0x18f584,{'transaction':_0x75ae12});});})[_0xb36f('0x23')](function(){return db[_0xb36f('0x99')][_0xb36f('0x9a')]({'where':{'MailAccountId':_0x1ac8c1[_0xb36f('0x5f')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x223d03,null))[_0xb36f('0x2d')](handleError(_0x223d03,null));};exports['getApplications']=function(_0x26751b,_0xe4e05f,_0x10b1af){var _0x52f3d6={};var _0x10e9f7={};var _0x360958;var _0x4dc846;return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x26751b['params']['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0xe4e05f,null))[_0xb36f('0x23')](function(_0x39fdc1){if(_0x39fdc1){_0x360958=_0x39fdc1;_0x10e9f7[_0xb36f('0x4a')]=_[_0xb36f('0x4b')](db[_0xb36f('0x99')][_0xb36f('0x46')]);_0x10e9f7[_0xb36f('0x4c')]=_[_0xb36f('0x4b')](_0x26751b['query']);_0x10e9f7['filters']=_[_0xb36f('0x4d')](_0x10e9f7[_0xb36f('0x4a')],_0x10e9f7[_0xb36f('0x4c')]);_0x52f3d6[_0xb36f('0x4e')]=_[_0xb36f('0x4d')](_0x10e9f7[_0xb36f('0x4a')],qs['fields'](_0x26751b[_0xb36f('0x4c')][_0xb36f('0x4f')]));_0x52f3d6['attributes']=_0x52f3d6['attributes']['length']?_0x52f3d6[_0xb36f('0x4e')]:_0x10e9f7[_0xb36f('0x4a')];_0x52f3d6['order']=qs[_0xb36f('0x53')](_0x26751b[_0xb36f('0x4c')][_0xb36f('0x53')]);_0x52f3d6[_0xb36f('0x54')]=qs[_0xb36f('0x55')](_[_0xb36f('0x56')](_0x26751b[_0xb36f('0x4c')],_0x10e9f7['filters']));if(_0x26751b[_0xb36f('0x4c')][_0xb36f('0x58')]){_0x52f3d6[_0xb36f('0x54')]=_['merge'](_0x52f3d6[_0xb36f('0x54')],{'$or':_[_0xb36f('0x44')](_0x52f3d6['attributes'],function(_0xacd5d8){var _0x1606c1={};_0x1606c1[_0xacd5d8]={'$like':'%'+_0x26751b[_0xb36f('0x4c')][_0xb36f('0x58')]+'%'};return _0x1606c1;})});}_0x52f3d6=_[_0xb36f('0x59')]({},_0x52f3d6,_0x26751b[_0xb36f('0x5a')]);return _0x360958[_0xb36f('0x9b')](_0x52f3d6);}})[_0xb36f('0x23')](function(_0x1263d3){if(_0x1263d3){_0x4dc846=_0x1263d3[_0xb36f('0x50')];if(!_0x26751b[_0xb36f('0x4c')]['hasOwnProperty'](_0xb36f('0x69'))){_0x52f3d6[_0xb36f('0x32')]=qs[_0xb36f('0x32')](_0x26751b['query']['limit']);_0x52f3d6['offset']=qs['offset'](_0x26751b[_0xb36f('0x4c')][_0xb36f('0x31')]);}return _0x360958[_0xb36f('0x9b')](_0x52f3d6);}})[_0xb36f('0x23')](function(_0x55535b){if(_0x55535b){return _0x55535b?{'count':_0x4dc846,'rows':_0x55535b}:null;}})['then'](respondWithResult(_0xe4e05f,null))[_0xb36f('0x2d')](handleError(_0xe4e05f,null));};exports[_0xb36f('0x9c')]=function(_0x4ed702,_0x44b50a,_0x3b7eb6){var _0x5aeed3={'raw':!![],'where':{}};var _0x1f031a={};var _0xda3eb4={'count':0x0,'rows':[]};return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x4ed702['params']['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x44b50a,null))[_0xb36f('0x23')](function(_0x55b29e){if(_0x55b29e){_0x1f031a[_0xb36f('0x4a')]=_[_0xb36f('0x4b')](db[_0xb36f('0x9d')]['rawAttributes']);_0x1f031a[_0xb36f('0x4c')]=_[_0xb36f('0x4b')](_0x4ed702[_0xb36f('0x4c')]);_0x1f031a[_0xb36f('0x55')]=_[_0xb36f('0x4d')](_0x1f031a[_0xb36f('0x4a')],_0x1f031a[_0xb36f('0x4c')]);_0x5aeed3['attributes']=_[_0xb36f('0x4d')](_0x1f031a[_0xb36f('0x4a')],qs[_0xb36f('0x4f')](_0x4ed702[_0xb36f('0x4c')][_0xb36f('0x4f')]));_0x5aeed3[_0xb36f('0x4e')]=_0x5aeed3['attributes'][_0xb36f('0x50')]?_0x5aeed3[_0xb36f('0x4e')]:_0x1f031a[_0xb36f('0x4a')];if(!_0x4ed702[_0xb36f('0x4c')][_0xb36f('0x51')](_0xb36f('0x69'))){_0x5aeed3[_0xb36f('0x32')]=qs[_0xb36f('0x32')](_0x4ed702['query'][_0xb36f('0x32')]);_0x5aeed3[_0xb36f('0x31')]=qs[_0xb36f('0x31')](_0x4ed702[_0xb36f('0x4c')]['offset']);}_0x5aeed3[_0xb36f('0x52')]=qs[_0xb36f('0x53')](_0x4ed702[_0xb36f('0x4c')][_0xb36f('0x53')]);_0x5aeed3[_0xb36f('0x54')]=qs[_0xb36f('0x55')](_[_0xb36f('0x56')](_0x4ed702[_0xb36f('0x4c')],_0x1f031a['filters']));_0x5aeed3[_0xb36f('0x54')]['MailAccountId']=_0x55b29e['id'];if(_0x4ed702[_0xb36f('0x4c')][_0xb36f('0x58')]){_0x5aeed3[_0xb36f('0x54')]=_[_0xb36f('0x59')](_0x5aeed3[_0xb36f('0x54')],{'$or':_[_0xb36f('0x44')](_0x5aeed3[_0xb36f('0x4e')],function(_0x3ea8e2){var _0x558753={};_0x558753[_0x3ea8e2]={'$like':'%'+_0x4ed702[_0xb36f('0x4c')][_0xb36f('0x58')]+'%'};return _0x558753;})});}if(_0x4ed702[_0xb36f('0x4c')]['$gte']){var _0x526ae7=_0x4ed702[_0xb36f('0x4c')][_0xb36f('0x9e')][_0xb36f('0x9f')](',');var _0x2ed5ea={};_0x2ed5ea[_0x526ae7[0x0]]={'$gte':moment(_0x526ae7[0x1])[_0xb36f('0xa0')](_0xb36f('0xa1'))};_0x5aeed3[_0xb36f('0x54')]=_[_0xb36f('0x59')](_0x5aeed3[_0xb36f('0x54')],_0x2ed5ea);}_0x5aeed3=_[_0xb36f('0x59')]({},_0x5aeed3,_0x4ed702[_0xb36f('0x5a')]);return db[_0xb36f('0x9d')]['count']({'where':_0x5aeed3['where']})[_0xb36f('0x23')](function(_0x161418){_0xda3eb4[_0xb36f('0x34')]=_0x161418;if(_0x4ed702['query'][_0xb36f('0x6a')]){_0x5aeed3[_0xb36f('0x5b')]=[{'all':!![]}];}return db[_0xb36f('0x9d')][_0xb36f('0x5c')](_0x5aeed3);})[_0xb36f('0x23')](function(_0x37bb00){if(_0x4ed702['query'][_0xb36f('0xa2')]===_0xb36f('0xa3')){for(var _0x445928=0x0;_0x445928<_0x37bb00[_0xb36f('0x50')];_0x445928++){_0x37bb00[_0x445928][_0xb36f('0x62')]=juice(_0x37bb00[_0x445928][_0xb36f('0x62')]);}}_0xda3eb4[_0xb36f('0x5d')]=_0x37bb00;return _0xda3eb4;});}})[_0xb36f('0x23')](respondWithFilteredResult(_0x44b50a,_0x5aeed3))[_0xb36f('0x2d')](handleError(_0x44b50a,null));};exports[_0xb36f('0x3d')]=function(_0x253167,_0x38cb47,_0x36ea20){var _0x18a88c,_0x4eb81b={},_0x56e44a;if(_0x253167[_0xb36f('0x62')]['to']){_0x56e44a=_0x253167[_0xb36f('0x62')]['to'][_0xb36f('0x9f')](',')[0x0];}return db[_0xb36f('0x45')][_0xb36f('0x61')]({'where':{'id':_0x253167[_0xb36f('0x5f')]['id']},'include':[{'model':db[_0xb36f('0xa4')],'as':_0xb36f('0xa5'),'include':[{'model':db[_0xb36f('0x91')],'as':_0xb36f('0xa6'),'where':{'email':_0x56e44a},'limit':0x1,'order':[[_0xb36f('0xa7'),_0xb36f('0xa8')]]}]},{'model':db[_0xb36f('0x40')],'as':_0xb36f('0x41'),'raw':!![]}]})[_0xb36f('0x23')](handleEntityNotFound(_0x38cb47,null))[_0xb36f('0x23')](function(_0x178e22){if(_0x178e22){_0x18a88c=_0x178e22;if(_0x178e22['Smtp']){if(_[_0xb36f('0x73')](_0x253167['body'][_0xb36f('0xa9')])){_0x253167[_0xb36f('0x62')]['from']=util[_0xb36f('0xa0')](_0xb36f('0xaa'),_0x178e22[_0xb36f('0x3c')],_0x178e22[_0xb36f('0x6f')]||_0x178e22[_0xb36f('0x41')][_0xb36f('0x76')]);}if(_0x253167[_0xb36f('0x62')][_0xb36f('0xab')]&&_0x253167[_0xb36f('0x62')]['attachments'][_0xb36f('0x50')]){for(var _0x4ca89c=0x0;_0x4ca89c<_0x253167['body'][_0xb36f('0xab')][_0xb36f('0x50')];_0x4ca89c+=0x1){_0x253167[_0xb36f('0x62')]['attachments'][_0x4ca89c]={'filename':_0x253167[_0xb36f('0x62')][_0xb36f('0xab')][_0x4ca89c]['name'],'path':path['join'](config[_0xb36f('0xac')],_0xb36f('0xad'),_0x253167['body'][_0xb36f('0xab')][_0x4ca89c][_0xb36f('0xae')])};}}var _0xbf522e={'tls':{'rejectUnauthorized':![]}};if(_[_0xb36f('0x73')](_0x178e22[_0xb36f('0x41')][_0xb36f('0x7e')])){if(_0x178e22[_0xb36f('0x41')][_0xb36f('0x7b')]){_0xbf522e[_0xb36f('0xaf')]={'user':_0x178e22[_0xb36f('0x41')]['user'],'pass':_0x178e22[_0xb36f('0x41')][_0xb36f('0x79')]};}_0xbf522e['host']=_0x178e22[_0xb36f('0x41')][_0xb36f('0x7c')];_0xbf522e[_0xb36f('0x7d')]=_0x178e22[_0xb36f('0x41')][_0xb36f('0x7d')];_0xbf522e[_0xb36f('0xb0')]=_0x178e22[_0xb36f('0x41')]['secure'];}else{_0xbf522e['service']=_0x178e22[_0xb36f('0x41')][_0xb36f('0x7e')];_0xbf522e['auth']={'user':_0x178e22[_0xb36f('0x41')][_0xb36f('0x76')],'pass':_0x178e22[_0xb36f('0x41')][_0xb36f('0x79')]};}return respondWithRpcPromise(_0xb36f('0xb1'),'sendMail',{'account':_0xbf522e,'message':_0x253167[_0xb36f('0x62')]});}else{throw new Error(_0xb36f('0xb2'));}}})[_0xb36f('0x23')](function(_0x5775dc){if(_0x5775dc){_0x4eb81b=_0x5775dc;if(_0x18a88c[_0xb36f('0xa5')]){if(_0x18a88c[_0xb36f('0xa5')][_0xb36f('0xa6')][_0xb36f('0x50')]){return _0x18a88c['List'][_0xb36f('0xa6')][0x0];}else{return db[_0xb36f('0x91')][_0xb36f('0x67')](_['defaults'](_0x253167[_0xb36f('0x62')],{'firstName':_0x253167['body']['to'],'email':_0x253167['body']['to'],'phone':_0x253167[_0xb36f('0x62')]['to'],'ListId':_0x18a88c[_0xb36f('0x70')]}));}}else{throw new Error(_0xb36f('0xb2'));}}})['then'](function(_0x3977d0){if(_0x3977d0){var _0x522040={'UserId':_0x253167[_0xb36f('0x76')]['id'],'ContactId':_0x3977d0['id'],'MailAccountId':_0x18a88c['id'],'inReplyTo':_0x4eb81b[_0xb36f('0xb3')],'to':_0x253167[_0xb36f('0x62')]['from'],'cc':_0x253167[_0xb36f('0x62')]['cc'],'subject':_0x253167[_0xb36f('0x62')][_0xb36f('0xb4')],'attach':_0x253167[_0xb36f('0x62')][_0xb36f('0xb5')],'firstMsgDirection':_0xb36f('0xb6'),'lastMsgAt':moment()[_0xb36f('0xa0')](_0xb36f('0xa1')),'lastMsgDirection':'out','Messages':[_[_0xb36f('0x59')](_0x253167[_0xb36f('0x62')],{'messageId':_0x4eb81b[_0xb36f('0xb3')],'sentAt':moment()[_0xb36f('0xa0')](_0xb36f('0xa1')),'read':!![],'MailAccountId':_0x18a88c['id'],'UserId':_0x253167[_0xb36f('0x76')]['id'],'ContactId':_0x3977d0['id']})]};if(_0x253167[_0xb36f('0x62')][_0xb36f('0xb7')]){_0x522040=_['merge'](_0x522040,_0x253167[_0xb36f('0x62')][_0xb36f('0xb7')]);}return db[_0xb36f('0x90')][_0xb36f('0x67')](_0x522040,{'include':[{'model':db['MailMessage'],'as':_0xb36f('0xb8')}]});}})[_0xb36f('0x23')](respondWithResult(_0x38cb47,null))['catch'](handleError(_0x38cb47,null));};exports['verifySmtp']=function(_0x28afa1,_0x7014ac,_0x14a1c7){return db[_0xb36f('0x45')][_0xb36f('0x61')]({'where':{'id':_0x28afa1[_0xb36f('0x5f')]['id']},'include':[{'model':db[_0xb36f('0x40')],'as':'Smtp','raw':!![]}]})[_0xb36f('0x23')](handleEntityNotFound(_0x7014ac,null))[_0xb36f('0x23')](function(_0x53ceb5){if(_0x53ceb5&&_0x53ceb5[_0xb36f('0x41')]){var _0x54d6fb={'id':_0x53ceb5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x53ceb5[_0xb36f('0x41')][_0xb36f('0x7e')]){_0x54d6fb['service']=_0x53ceb5[_0xb36f('0x41')][_0xb36f('0x7e')];}else{_0x54d6fb[_0xb36f('0x7c')]=_0x53ceb5[_0xb36f('0x41')][_0xb36f('0x7c')];_0x54d6fb[_0xb36f('0x7d')]=_0x53ceb5['Smtp'][_0xb36f('0x7d')];_0x54d6fb[_0xb36f('0xb0')]=_0x53ceb5['Smtp'][_0xb36f('0xb0')];}if(_0x53ceb5[_0xb36f('0x41')][_0xb36f('0x7b')]){_0x54d6fb[_0xb36f('0xaf')]={'user':_0x53ceb5['Smtp']['user'],'pass':_0x53ceb5[_0xb36f('0x41')]['pass']};}return respondWithRpcPromise(_0xb36f('0xb9'),_0xb36f('0xba'),{'account':_0x54d6fb});}})['then'](respondWithResult(_0x7014ac,null))[_0xb36f('0x2d')](handleError(_0x7014ac,null));};exports[_0xb36f('0x39')]=function(_0x45440e,_0xa7a566){return db[_0xb36f('0x45')][_0xb36f('0x61')]({'where':{'id':_0x45440e[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0xa7a566,null))[_0xb36f('0x23')](function(_0x4d8f5f){if(_0x4d8f5f&&_0x4d8f5f[_0xb36f('0x7e')]){throw new db['Sequelize'][(_0xb36f('0xbb'))](_0xb36f('0xbc'));}return _0x4d8f5f;})[_0xb36f('0x23')](removeEntity(_0xa7a566,null))[_0xb36f('0x2d')](handleError(_0xa7a566,null));};exports['addAgents']=function(_0x23bff6,_0x26cf9e,_0x5cb340){return db[_0xb36f('0x45')][_0xb36f('0x61')]({'where':{'id':_0x23bff6[_0xb36f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x26cf9e,null))[_0xb36f('0x23')](function(_0x3bf380){if(_0x3bf380){return _0x3bf380[_0xb36f('0xbd')](_0x23bff6[_0xb36f('0x62')][_0xb36f('0x6e')],_[_0xb36f('0x8e')](_0x23bff6['body'],['ids','id'])||{})[_0xb36f('0xbe')](function(_0x2746af){for(var _0x15d01c=0x0;_0x15d01c<_0x23bff6['body']['ids']['length'];_0x15d01c+=0x1){socket[_0xb36f('0xbf')](_0xb36f('0xc0'),{'UserId':_0x23bff6[_0xb36f('0x62')][_0xb36f('0x6e')][_0x15d01c],'MailAccountId':_0x23bff6[_0xb36f('0x5f')]['id']});}return _0x2746af;});}})['then'](respondWithResult(_0x26cf9e,null))[_0xb36f('0x2d')](handleError(_0x26cf9e,null));};exports[_0xb36f('0xc1')]=function(_0x1339c8,_0x27bc6d,_0x4f4b21){return db['MailAccount'][_0xb36f('0x61')]({'where':{'id':_0x1339c8[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x27bc6d,null))['then'](function(_0x56c0cf){if(_0x56c0cf){return _0x56c0cf['removeAgents'](_0x1339c8[_0xb36f('0x4c')][_0xb36f('0x6e')])[_0xb36f('0x23')](function(){if(_['isArray'](_0x1339c8['query'][_0xb36f('0x6e')])){for(var _0x637805=0x0;_0x637805<_0x1339c8[_0xb36f('0x4c')][_0xb36f('0x6e')][_0xb36f('0x50')];_0x637805+=0x1){socket[_0xb36f('0xbf')](_0xb36f('0xc2'),{'UserId':Number(_0x1339c8[_0xb36f('0x4c')]['ids'][_0x637805]),'MailAccountId':Number(_0x1339c8[_0xb36f('0x5f')]['id'])});}}else{socket[_0xb36f('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x1339c8['query']['ids']),'MailAccountId':Number(_0x1339c8[_0xb36f('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x27bc6d,null))[_0xb36f('0x2d')](handleError(_0x27bc6d,null));};exports[_0xb36f('0xc3')]=function(_0x255a05,_0x3a1f8b,_0x2246f2){var _0x23afb9={};var _0x1ed111={};var _0x1d7b0d;var _0x9db61e;return db[_0xb36f('0x45')][_0xb36f('0x68')]({'where':{'id':_0x255a05[_0xb36f('0x5f')]['id']}})[_0xb36f('0x23')](handleEntityNotFound(_0x3a1f8b,null))[_0xb36f('0x23')](function(_0x4ada33){if(_0x4ada33){_0x1d7b0d=_0x4ada33;_0x1ed111[_0xb36f('0x4a')]=_[_0xb36f('0x4b')](db[_0xb36f('0x92')][_0xb36f('0x46')]);_0x1ed111['query']=_[_0xb36f('0x4b')](_0x255a05[_0xb36f('0x4c')]);_0x1ed111[_0xb36f('0x55')]=_[_0xb36f('0x4d')](_0x1ed111[_0xb36f('0x4a')],_0x1ed111['query']);_0x23afb9[_0xb36f('0x4e')]=_[_0xb36f('0x4d')](_0x1ed111['model'],qs['fields'](_0x255a05['query']['fields']));_0x23afb9[_0xb36f('0x4e')]=_0x23afb9[_0xb36f('0x4e')]['length']?_0x23afb9['attributes']:_0x1ed111['model'];_0x23afb9['order']=qs[_0xb36f('0x53')](_0x255a05['query'][_0xb36f('0x53')]);_0x23afb9[_0xb36f('0x54')]=qs['filters'](_[_0xb36f('0x56')](_0x255a05[_0xb36f('0x4c')],_0x1ed111[_0xb36f('0x55')]));if(_0x255a05[_0xb36f('0x4c')]['filter']){_0x23afb9['where']=_[_0xb36f('0x59')](_0x23afb9[_0xb36f('0x54')],{'$or':_[_0xb36f('0x44')](_0x23afb9[_0xb36f('0x4e')],function(_0x4c5643){var _0x52d80b={};_0x52d80b[_0x4c5643]={'$like':'%'+_0x255a05[_0xb36f('0x4c')]['filter']+'%'};return _0x52d80b;})});}_0x23afb9=_['merge']({},_0x23afb9,_0x255a05['options']);return _0x1d7b0d[_0xb36f('0xc3')](_0x23afb9);}})[_0xb36f('0x23')](function(_0xd82c2){if(_0xd82c2){_0x9db61e=_0xd82c2[_0xb36f('0x50')];if(!_0x255a05['query'][_0xb36f('0x51')](_0xb36f('0x69'))){_0x23afb9[_0xb36f('0x32')]=qs[_0xb36f('0x32')](_0x255a05[_0xb36f('0x4c')][_0xb36f('0x32')]);_0x23afb9[_0xb36f('0x31')]=qs['offset'](_0x255a05['query'][_0xb36f('0x31')]);}return _0x1d7b0d['getAgents'](_0x23afb9);}})['then'](function(_0x81c03d){if(_0x81c03d){return _0x81c03d?{'count':_0x9db61e,'rows':_0x81c03d}:null;}})[_0xb36f('0x23')](respondWithResult(_0x3a1f8b,null))[_0xb36f('0x2d')](handleError(_0x3a1f8b,null));}; \ No newline at end of file +var _0x2d87=['debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','MailAccounts','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','offset','sort','where','merge','options','include','rows','show','includeAll','find','body','params','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','rawAttributes','hasOwnProperty','nolimit','order','pick','filter','findAll','removeDispositions','CannedAnswer','create','removeAnswers','ids','email','ListId','isNil','active','description','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','password','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','updatedAt','DESC','from','%s\x20<%s>','attachments','join','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4b7a7d,_0x3c5327){var _0x217d66=function(_0x2071d4){while(--_0x2071d4){_0x4b7a7d['push'](_0x4b7a7d['shift']());}};_0x217d66(++_0x3c5327);}(_0x2d87,0x160));var _0x72d8=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2d87[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x72d8('0x0'));var rimraf=require(_0x72d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d8('0x2'));var rp=require(_0x72d8('0x3'));var moment=require(_0x72d8('0x4'));var BPromise=require(_0x72d8('0x5'));var Mustache=require(_0x72d8('0x6'));var util=require('util');var path=require('path');var sox=require(_0x72d8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72d8('0x8'));var _=require(_0x72d8('0x9'));var squel=require(_0x72d8('0xa'));var crypto=require(_0x72d8('0xb'));var jsforce=require(_0x72d8('0xc'));var deskjs=require(_0x72d8('0xd'));var toCsv=require(_0x72d8('0xe'));var querystring=require(_0x72d8('0xf'));var Papa=require(_0x72d8('0x10'));var htmlToText=require(_0x72d8('0x11'));var juice=require('juice');var Redis=require(_0x72d8('0x12'));var authService=require(_0x72d8('0x13'));var qs=require(_0x72d8('0x14'));var as=require(_0x72d8('0x15'));var hardwareService=require(_0x72d8('0x16'));var logger=require('../../config/logger')(_0x72d8('0x17'));var utils=require(_0x72d8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x72d8('0x19'))['db'];config['redis']=_[_0x72d8('0x1a')](config[_0x72d8('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72d8('0x1b')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x72d8('0x1c'));var client=jayson[_0x72d8('0x1d')][_0x72d8('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x36a6b3,_0x47bd27,_0x5711eb,_0x478236){return new BPromise(function(_0x904345,_0x2c1bdd){var _0xfd9b14=_0x478236||client;return _0xfd9b14[_0x72d8('0x1f')](_0x36a6b3,_0x5711eb)[_0x72d8('0x20')](function(_0x537f0b){logger[_0x72d8('0x21')](_0x72d8('0x22'),_0x47bd27,_0x72d8('0x23'));logger[_0x72d8('0x24')](_0x72d8('0x25'),_0x47bd27,'request\x20sent',JSON[_0x72d8('0x26')](_0x537f0b));if(_0x537f0b[_0x72d8('0x27')]){if(_0x537f0b[_0x72d8('0x27')]['code']===0x1f4){logger[_0x72d8('0x27')](_0x72d8('0x22'),_0x47bd27,_0x537f0b[_0x72d8('0x27')]['message']);return _0x2c1bdd(_0x537f0b[_0x72d8('0x27')][_0x72d8('0x28')]);}logger[_0x72d8('0x27')](_0x72d8('0x22'),_0x47bd27,_0x537f0b[_0x72d8('0x27')][_0x72d8('0x28')]);return _0x904345(_0x537f0b[_0x72d8('0x27')][_0x72d8('0x28')]);}else{logger['info'](_0x72d8('0x22'),_0x47bd27,_0x72d8('0x23'));_0x904345(_0x537f0b['result'][_0x72d8('0x28')]);}})[_0x72d8('0x29')](function(_0x3c41bf){logger['error'](_0x72d8('0x22'),_0x47bd27,_0x3c41bf);_0x2c1bdd(_0x3c41bf);});});}function respondWithStatusCode(_0x4d8d4f,_0xd03482){_0xd03482=_0xd03482||0xcc;return function(_0x342027){if(_0x342027){return _0x4d8d4f[_0x72d8('0x2a')](_0xd03482);}return _0x4d8d4f[_0x72d8('0x2b')](_0xd03482)[_0x72d8('0x2c')]();};}function respondWithResult(_0x4aa1c2,_0x14b677){_0x14b677=_0x14b677||0xc8;return function(_0x3d3a97){if(_0x3d3a97){return _0x4aa1c2[_0x72d8('0x2b')](_0x14b677)[_0x72d8('0x2d')](_0x3d3a97);}};}function respondWithFilteredResult(_0x56d3c4,_0x4dfcdf){return function(_0x3a1708){if(_0x3a1708){var _0x350a34=typeof _0x4dfcdf['offset']===_0x72d8('0x2e')&&typeof _0x4dfcdf[_0x72d8('0x2f')]===_0x72d8('0x2e');var _0x48e2a5=_0x3a1708[_0x72d8('0x30')];var _0x358393=_0x350a34?0x0:_0x4dfcdf['offset'];var _0x101a21=_0x350a34?_0x3a1708[_0x72d8('0x30')]:_0x4dfcdf['offset']+_0x4dfcdf[_0x72d8('0x2f')];var _0x3f63c7;if(_0x101a21>=_0x48e2a5){_0x101a21=_0x48e2a5;_0x3f63c7=0xc8;}else{_0x3f63c7=0xce;}_0x56d3c4[_0x72d8('0x2b')](_0x3f63c7);return _0x56d3c4['set'](_0x72d8('0x31'),_0x358393+'-'+_0x101a21+'/'+_0x48e2a5)[_0x72d8('0x2d')](_0x3a1708);}return null;};}function patchUpdates(_0x313760){return function(_0x37ed92){try{jsonpatch[_0x72d8('0x32')](_0x37ed92,_0x313760,!![]);}catch(_0x733310){return BPromise[_0x72d8('0x33')](_0x733310);}return _0x37ed92['save']();};}function saveUpdates(_0x487685,_0x109517){return function(_0x3d5a57){if(_0x3d5a57){return _0x3d5a57[_0x72d8('0x34')](_0x487685)[_0x72d8('0x20')](function(_0x4df646){return _0x4df646;});}return null;};}function removeEntity(_0x5c3815,_0x37bc7a){return function(_0x138997){if(_0x138997){return _0x138997[_0x72d8('0x35')]()[_0x72d8('0x20')](function(){var _0x121803=_0x138997['get']({'plain':!![]});var _0x5d7c01=_0x72d8('0x36');return db[_0x72d8('0x37')][_0x72d8('0x35')]({'where':{'type':_0x5d7c01,'resourceId':_0x121803['id']}})[_0x72d8('0x20')](function(){return _0x138997;});})[_0x72d8('0x20')](function(){_0x5c3815[_0x72d8('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e10ed,_0x196a3a){return function(_0x5d40e9){if(!_0x5d40e9){_0x3e10ed[_0x72d8('0x2a')](0x194);}return _0x5d40e9;};}function handleError(_0x1fe317,_0x192daa){_0x192daa=_0x192daa||0x1f4;return function(_0x462e92){logger['error'](_0x462e92[_0x72d8('0x38')]);if(_0x462e92[_0x72d8('0x39')]){delete _0x462e92[_0x72d8('0x39')];}_0x1fe317[_0x72d8('0x2b')](_0x192daa)[_0x72d8('0x3a')](_0x462e92);};}exports['index']=function(_0x1623b5,_0x43c3ae){var _0xe4e69b={'include':[{'model':db[_0x72d8('0x3b')],'as':_0x72d8('0x3c')},{'model':db[_0x72d8('0x3d')],'as':_0x72d8('0x3e')},{'model':db[_0x72d8('0x3f')],'as':_0x72d8('0x40')}]},_0x53e724={},_0x3a8fc9={'count':0x0,'rows':[]};var _0x4d7fa5=_['map'](db[_0x72d8('0x41')]['rawAttributes'],function(_0x512024){return{'name':_0x512024[_0x72d8('0x42')],'type':_0x512024[_0x72d8('0x43')]['key']};});_0x53e724[_0x72d8('0x44')]=_[_0x72d8('0x45')](_0x4d7fa5,_0x72d8('0x39'));_0x53e724['query']=_[_0x72d8('0x46')](_0x1623b5['query']);_0x53e724[_0x72d8('0x47')]=_[_0x72d8('0x48')](_0x53e724['model'],_0x53e724[_0x72d8('0x49')]);_0xe4e69b[_0x72d8('0x4a')]=_['intersection'](_0x53e724['model'],qs[_0x72d8('0x4b')](_0x1623b5[_0x72d8('0x49')][_0x72d8('0x4b')]));_0xe4e69b[_0x72d8('0x4a')]=_0xe4e69b[_0x72d8('0x4a')][_0x72d8('0x4c')]?_0xe4e69b[_0x72d8('0x4a')]:_0x53e724['model'];if(!_0x1623b5['query']['hasOwnProperty']('nolimit')){_0xe4e69b[_0x72d8('0x2f')]=qs[_0x72d8('0x2f')](_0x1623b5[_0x72d8('0x49')][_0x72d8('0x2f')]);_0xe4e69b[_0x72d8('0x4d')]=qs[_0x72d8('0x4d')](_0x1623b5[_0x72d8('0x49')][_0x72d8('0x4d')]);}_0xe4e69b['order']=qs[_0x72d8('0x4e')](_0x1623b5[_0x72d8('0x49')][_0x72d8('0x4e')]);_0xe4e69b[_0x72d8('0x4f')]=qs[_0x72d8('0x47')](_['pick'](_0x1623b5['query'],_0x53e724['filters']),_0x4d7fa5);if(_0x1623b5[_0x72d8('0x49')]['filter']){_0xe4e69b[_0x72d8('0x4f')]=_[_0x72d8('0x50')](_0xe4e69b[_0x72d8('0x4f')],{'$or':_[_0x72d8('0x45')](_0x4d7fa5,function(_0x8931f6){if(_0x8931f6['type']!=='VIRTUAL'){var _0x6d1700={};_0x6d1700[_0x8931f6[_0x72d8('0x39')]]={'$like':'%'+_0x1623b5[_0x72d8('0x49')]['filter']+'%'};return _0x6d1700;}})});}_0xe4e69b=_['merge']({},_0xe4e69b,_0x1623b5[_0x72d8('0x51')]);var _0x41f1f5={'where':_0xe4e69b[_0x72d8('0x4f')]};return db[_0x72d8('0x41')][_0x72d8('0x30')](_0x41f1f5)[_0x72d8('0x20')](function(_0x5783cb){_0x3a8fc9[_0x72d8('0x30')]=_0x5783cb;if(_0x1623b5['query']['includeAll']){_0xe4e69b[_0x72d8('0x52')]=[{'all':!![]}];}return db[_0x72d8('0x41')]['findAll'](_0xe4e69b);})[_0x72d8('0x20')](function(_0x164ebb){_0x3a8fc9[_0x72d8('0x53')]=_0x164ebb;return _0x3a8fc9;})[_0x72d8('0x20')](respondWithFilteredResult(_0x43c3ae,_0xe4e69b))[_0x72d8('0x29')](handleError(_0x43c3ae,null));};exports[_0x72d8('0x54')]=function(_0x5f02bd,_0x5e42be){var _0x3a6b1d={'raw':![],'where':{'id':_0x5f02bd['params']['id']},'include':[{'model':db[_0x72d8('0x3b')],'as':_0x72d8('0x3c')},{'model':db[_0x72d8('0x3d')],'as':_0x72d8('0x3e')},{'model':db[_0x72d8('0x3f')],'as':_0x72d8('0x40')}]},_0x471375={};_0x471375['model']=_[_0x72d8('0x46')](db[_0x72d8('0x41')]['rawAttributes']);_0x471375['query']=_[_0x72d8('0x46')](_0x5f02bd[_0x72d8('0x49')]);_0x471375['filters']=_['intersection'](_0x471375[_0x72d8('0x44')],_0x471375[_0x72d8('0x49')]);_0x3a6b1d[_0x72d8('0x4a')]=_[_0x72d8('0x48')](_0x471375['model'],qs['fields'](_0x5f02bd['query'][_0x72d8('0x4b')]));_0x3a6b1d[_0x72d8('0x4a')]=_0x3a6b1d['attributes'][_0x72d8('0x4c')]?_0x3a6b1d[_0x72d8('0x4a')]:_0x471375[_0x72d8('0x44')];if(_0x5f02bd[_0x72d8('0x49')][_0x72d8('0x55')]){_0x3a6b1d[_0x72d8('0x52')]=[{'all':!![]}];}_0x3a6b1d=_['merge']({},_0x3a6b1d,_0x5f02bd[_0x72d8('0x51')]);return db[_0x72d8('0x41')][_0x72d8('0x56')](_0x3a6b1d)[_0x72d8('0x20')](handleEntityNotFound(_0x5e42be,null))[_0x72d8('0x20')](respondWithResult(_0x5e42be,null))[_0x72d8('0x29')](handleError(_0x5e42be,null));};exports[_0x72d8('0x34')]=function(_0x5c9197,_0x343037){if(_0x5c9197[_0x72d8('0x57')]['id']){delete _0x5c9197[_0x72d8('0x57')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5c9197[_0x72d8('0x58')]['id']},'include':[{'model':db[_0x72d8('0x3b')],'as':_0x72d8('0x3c')},{'model':db[_0x72d8('0x3d')],'as':_0x72d8('0x3e')},{'model':db[_0x72d8('0x3f')],'as':_0x72d8('0x40')}]})['then'](handleEntityNotFound(_0x343037,null))[_0x72d8('0x20')](saveUpdates(_0x5c9197[_0x72d8('0x57')],null))[_0x72d8('0x20')](function(_0x6843a7){if(_0x6843a7&&_0x5c9197['body']['Imap']){return db[_0x72d8('0x3b')][_0x72d8('0x34')](_0x5c9197['body']['Imap'],{'where':{'MailAccountId':_0x6843a7['id']}})['then'](function(){return _0x6843a7;});}return _0x6843a7;})[_0x72d8('0x20')](function(_0x17bac3){if(_0x17bac3&&_0x5c9197['body'][_0x72d8('0x3e')]){return db[_0x72d8('0x3d')][_0x72d8('0x34')](_0x5c9197[_0x72d8('0x57')][_0x72d8('0x3e')],{'where':{'MailAccountId':_0x17bac3['id']}})[_0x72d8('0x20')](function(){return _0x17bac3;});}return _0x17bac3;})[_0x72d8('0x20')](respondWithResult(_0x343037,null))[_0x72d8('0x29')](handleError(_0x343037,null));};exports[_0x72d8('0x59')]=function(_0x5a156e,_0x14c63a){return db[_0x72d8('0x41')][_0x72d8('0x59')]()[_0x72d8('0x20')](respondWithResult(_0x14c63a,null))[_0x72d8('0x29')](handleError(_0x14c63a,null));};exports[_0x72d8('0x5a')]=function(_0x12f223,_0x51d441,_0x3532e5){if(_0x12f223[_0x72d8('0x57')]['id']){delete _0x12f223['body']['id'];}return db[_0x72d8('0x41')]['find']({'where':{'id':_0x12f223[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x51d441,null))[_0x72d8('0x20')](function(_0x5ace99){if(_0x5ace99){_0x12f223[_0x72d8('0x57')][_0x72d8('0x5b')]=_0x5ace99['id'];return db[_0x72d8('0x5c')]['create'](_0x12f223['body']);}})[_0x72d8('0x20')](respondWithResult(_0x51d441,null))[_0x72d8('0x29')](handleError(_0x51d441,null));};exports[_0x72d8('0x5d')]=function(_0x363ec7,_0x38b956,_0x3525ad){var _0x263307={'raw':![],'where':{}};var _0x5499d6={};var _0x3fd7bd={'count':0x0,'rows':[]};return db[_0x72d8('0x41')][_0x72d8('0x5e')]({'where':{'id':_0x363ec7[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x38b956,null))[_0x72d8('0x20')](function(_0xbe020d){if(_0xbe020d){_0x5499d6[_0x72d8('0x44')]=_[_0x72d8('0x46')](db[_0x72d8('0x5c')][_0x72d8('0x5f')]);_0x5499d6[_0x72d8('0x49')]=_[_0x72d8('0x46')](_0x363ec7['query']);_0x5499d6['filters']=_[_0x72d8('0x48')](_0x5499d6[_0x72d8('0x44')],_0x5499d6[_0x72d8('0x49')]);_0x263307[_0x72d8('0x4a')]=_[_0x72d8('0x48')](_0x5499d6['model'],qs[_0x72d8('0x4b')](_0x363ec7['query'][_0x72d8('0x4b')]));_0x263307[_0x72d8('0x4a')]=_0x263307[_0x72d8('0x4a')]['length']?_0x263307[_0x72d8('0x4a')]:_0x5499d6[_0x72d8('0x44')];if(!_0x363ec7[_0x72d8('0x49')][_0x72d8('0x60')](_0x72d8('0x61'))){_0x263307[_0x72d8('0x2f')]=qs[_0x72d8('0x2f')](_0x363ec7[_0x72d8('0x49')][_0x72d8('0x2f')]);_0x263307[_0x72d8('0x4d')]=qs[_0x72d8('0x4d')](_0x363ec7[_0x72d8('0x49')][_0x72d8('0x4d')]);}_0x263307[_0x72d8('0x62')]=qs['sort'](_0x363ec7[_0x72d8('0x49')][_0x72d8('0x4e')]);_0x263307[_0x72d8('0x4f')]=qs[_0x72d8('0x47')](_[_0x72d8('0x63')](_0x363ec7['query'],_0x5499d6[_0x72d8('0x47')]));_0x263307[_0x72d8('0x4f')][_0x72d8('0x5b')]=_0xbe020d['id'];if(_0x363ec7['query']['filter']){_0x263307[_0x72d8('0x4f')]=_['merge'](_0x263307['where'],{'$or':_[_0x72d8('0x45')](_0x263307[_0x72d8('0x4a')],function(_0x42e988){var _0x5153ca={};_0x5153ca[_0x42e988]={'$like':'%'+_0x363ec7[_0x72d8('0x49')][_0x72d8('0x64')]+'%'};return _0x5153ca;})});}_0x263307=_['merge']({},_0x263307,_0x363ec7[_0x72d8('0x51')]);return db[_0x72d8('0x5c')]['count']({'where':_0x263307[_0x72d8('0x4f')]})['then'](function(_0x42b2c7){_0x3fd7bd['count']=_0x42b2c7;if(_0x363ec7['query'][_0x72d8('0x55')]){_0x263307['include']=[{'all':!![]}];}return db[_0x72d8('0x5c')][_0x72d8('0x65')](_0x263307);})[_0x72d8('0x20')](function(_0x21a5b5){_0x3fd7bd['rows']=_0x21a5b5;return _0x3fd7bd;});}})['then'](respondWithFilteredResult(_0x38b956,_0x263307))['catch'](handleError(_0x38b956,null));};exports[_0x72d8('0x66')]=function(_0x2ece6e,_0x3d7bf1,_0x471865){return db[_0x72d8('0x41')][_0x72d8('0x56')]({'where':{'id':_0x2ece6e['params']['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x3d7bf1,null))[_0x72d8('0x20')](function(_0x4a22b0){if(_0x4a22b0){return _0x4a22b0[_0x72d8('0x66')](_0x2ece6e[_0x72d8('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x3d7bf1,null))[_0x72d8('0x29')](handleError(_0x3d7bf1,null));};exports['addAnswer']=function(_0x1d86e5,_0x5bf63b,_0x5db52a){if(_0x1d86e5[_0x72d8('0x57')]['id']){delete _0x1d86e5[_0x72d8('0x57')]['id'];}return db[_0x72d8('0x41')][_0x72d8('0x56')]({'where':{'id':_0x1d86e5[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x5bf63b,null))[_0x72d8('0x20')](function(_0x20c32d){if(_0x20c32d){_0x1d86e5[_0x72d8('0x57')][_0x72d8('0x5b')]=_0x20c32d['id'];return db[_0x72d8('0x67')][_0x72d8('0x68')](_0x1d86e5[_0x72d8('0x57')]);}})['then'](respondWithResult(_0x5bf63b,null))['catch'](handleError(_0x5bf63b,null));};exports['getAnswers']=function(_0x11712e,_0x489126,_0xd27937){var _0xb1a869={'raw':![],'where':{}};var _0x1e6929={};var _0x2582b7={'count':0x0,'rows':[]};return db[_0x72d8('0x41')][_0x72d8('0x5e')]({'where':{'id':_0x11712e['params']['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x489126,null))[_0x72d8('0x20')](function(_0x503b69){if(_0x503b69){_0x1e6929[_0x72d8('0x44')]=_[_0x72d8('0x46')](db[_0x72d8('0x67')][_0x72d8('0x5f')]);_0x1e6929[_0x72d8('0x49')]=_[_0x72d8('0x46')](_0x11712e[_0x72d8('0x49')]);_0x1e6929[_0x72d8('0x47')]=_[_0x72d8('0x48')](_0x1e6929[_0x72d8('0x44')],_0x1e6929[_0x72d8('0x49')]);_0xb1a869[_0x72d8('0x4a')]=_[_0x72d8('0x48')](_0x1e6929[_0x72d8('0x44')],qs[_0x72d8('0x4b')](_0x11712e[_0x72d8('0x49')]['fields']));_0xb1a869[_0x72d8('0x4a')]=_0xb1a869[_0x72d8('0x4a')]['length']?_0xb1a869['attributes']:_0x1e6929[_0x72d8('0x44')];if(!_0x11712e['query'][_0x72d8('0x60')](_0x72d8('0x61'))){_0xb1a869[_0x72d8('0x2f')]=qs['limit'](_0x11712e['query'][_0x72d8('0x2f')]);_0xb1a869[_0x72d8('0x4d')]=qs[_0x72d8('0x4d')](_0x11712e[_0x72d8('0x49')]['offset']);}_0xb1a869[_0x72d8('0x62')]=qs[_0x72d8('0x4e')](_0x11712e[_0x72d8('0x49')][_0x72d8('0x4e')]);_0xb1a869[_0x72d8('0x4f')]=qs['filters'](_['pick'](_0x11712e[_0x72d8('0x49')],_0x1e6929['filters']));_0xb1a869[_0x72d8('0x4f')][_0x72d8('0x5b')]=_0x503b69['id'];if(_0x11712e['query'][_0x72d8('0x64')]){_0xb1a869[_0x72d8('0x4f')]=_['merge'](_0xb1a869[_0x72d8('0x4f')],{'$or':_[_0x72d8('0x45')](_0xb1a869['attributes'],function(_0x23c872){var _0x4c89ce={};_0x4c89ce[_0x23c872]={'$like':'%'+_0x11712e[_0x72d8('0x49')][_0x72d8('0x64')]+'%'};return _0x4c89ce;})});}_0xb1a869=_[_0x72d8('0x50')]({},_0xb1a869,_0x11712e[_0x72d8('0x51')]);return db['CannedAnswer'][_0x72d8('0x30')]({'where':_0xb1a869[_0x72d8('0x4f')]})[_0x72d8('0x20')](function(_0x5ce10c){_0x2582b7['count']=_0x5ce10c;if(_0x11712e[_0x72d8('0x49')][_0x72d8('0x55')]){_0xb1a869['include']=[{'all':!![]}];}return db[_0x72d8('0x67')]['findAll'](_0xb1a869);})['then'](function(_0x40a8b5){_0x2582b7[_0x72d8('0x53')]=_0x40a8b5;return _0x2582b7;});}})[_0x72d8('0x20')](respondWithFilteredResult(_0x489126,_0xb1a869))['catch'](handleError(_0x489126,null));};exports['removeAnswers']=function(_0x3452fc,_0x4d6a31,_0x44e62f){return db[_0x72d8('0x41')][_0x72d8('0x56')]({'where':{'id':_0x3452fc['params']['id']}})['then'](handleEntityNotFound(_0x4d6a31,null))[_0x72d8('0x20')](function(_0x1cb5be){if(_0x1cb5be){return _0x1cb5be[_0x72d8('0x69')](_0x3452fc['query'][_0x72d8('0x6a')]);}})[_0x72d8('0x20')](respondWithStatusCode(_0x4d6a31,null))[_0x72d8('0x29')](handleError(_0x4d6a31,null));};exports[_0x72d8('0x68')]=function(_0x294e5b,_0x243a44){var _0x30b32a={'name':_0x294e5b[_0x72d8('0x57')][_0x72d8('0x39')],'key':_0x294e5b[_0x72d8('0x57')]['key'],'email':_0x294e5b[_0x72d8('0x57')][_0x72d8('0x6b')],'ListId':_0x294e5b[_0x72d8('0x57')][_0x72d8('0x6c')],'active':!_[_0x72d8('0x6d')](_0x294e5b[_0x72d8('0x57')][_0x72d8('0x6e')])?_0x294e5b[_0x72d8('0x57')]['active']:!![],'description':_0x294e5b[_0x72d8('0x57')][_0x72d8('0x6f')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x294e5b[_0x72d8('0x57')]['cservice'])){if(_0x294e5b[_0x72d8('0x57')][_0x72d8('0x70')]){_0x30b32a[_0x72d8('0x3c')][_0x72d8('0x71')]=_0x30b32a[_0x72d8('0x3e')][_0x72d8('0x71')]=_0x294e5b[_0x72d8('0x57')][_0x72d8('0x72')];_0x30b32a['Imap']['password']=_0x30b32a[_0x72d8('0x3e')][_0x72d8('0x73')]=_0x294e5b['body'][_0x72d8('0x74')];}else{_0x30b32a[_0x72d8('0x3c')][_0x72d8('0x75')]=_0x30b32a[_0x72d8('0x3e')][_0x72d8('0x75')]=![];}_0x30b32a[_0x72d8('0x3c')][_0x72d8('0x76')]=_0x294e5b[_0x72d8('0x57')]['Imap']['host'];_0x30b32a['Imap']['port']=_0x294e5b[_0x72d8('0x57')]['Imap'][_0x72d8('0x77')];_0x30b32a[_0x72d8('0x3e')][_0x72d8('0x76')]=_0x294e5b['body']['Smtp'][_0x72d8('0x76')];_0x30b32a['Smtp'][_0x72d8('0x77')]=_0x294e5b[_0x72d8('0x57')][_0x72d8('0x3e')]['port'];}else{_0x30b32a['Imap'][_0x72d8('0x78')]=_0x30b32a[_0x72d8('0x3e')]['service']=_0x294e5b[_0x72d8('0x57')]['cservice'];_0x30b32a['Imap'][_0x72d8('0x71')]=_0x30b32a[_0x72d8('0x3e')]['user']=_0x294e5b[_0x72d8('0x57')][_0x72d8('0x72')];_0x30b32a[_0x72d8('0x3c')][_0x72d8('0x79')]=_0x30b32a[_0x72d8('0x3e')][_0x72d8('0x73')]=_0x294e5b[_0x72d8('0x57')][_0x72d8('0x74')];}return db['MailAccount']['create'](_0x30b32a,{'include':[{'model':db[_0x72d8('0x3d')],'as':_0x72d8('0x3e')},{'model':db[_0x72d8('0x3b')],'as':'Imap'}]})[_0x72d8('0x20')](function(_0x3847f4){var _0x117562=_0x294e5b[_0x72d8('0x71')][_0x72d8('0x7a')]({'plain':!![]});if(!_0x117562)throw new Error(_0x72d8('0x7b'));if(_0x117562['role']===_0x72d8('0x71')){var _0x546707=_0x3847f4[_0x72d8('0x7a')]({'plain':!![]});return db['UserProfileSection'][_0x72d8('0x56')]({'where':{'name':_0x72d8('0x36'),'userProfileId':_0x117562[_0x72d8('0x7c')]},'raw':!![]})[_0x72d8('0x20')](function(_0x10ea81){if(_0x10ea81&&_0x10ea81[_0x72d8('0x7d')]===0x0){return db[_0x72d8('0x37')][_0x72d8('0x68')]({'name':_0x546707[_0x72d8('0x39')],'resourceId':_0x546707['id'],'type':_0x10ea81[_0x72d8('0x39')],'sectionId':_0x10ea81['id']},{})[_0x72d8('0x20')](function(){return _0x3847f4;});}else{return _0x3847f4;}})[_0x72d8('0x29')](function(_0x25bf51){logger[_0x72d8('0x27')](_0x72d8('0x7e'),_0x25bf51);throw _0x25bf51;});}return _0x3847f4;})[_0x72d8('0x20')](respondWithResult(_0x243a44,0xc9))[_0x72d8('0x29')](handleError(_0x243a44,null));};exports[_0x72d8('0x7f')]=function(_0x4ca3fb,_0x25afd1,_0x54fa5b){return db[_0x72d8('0x41')][_0x72d8('0x5e')]({'where':{'id':_0x4ca3fb[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x25afd1,null))['then'](function(_0x434d06){if(_0x434d06){return _0x434d06[_0x72d8('0x7f')]();}return null;})[_0x72d8('0x20')](respondWithResult(_0x25afd1,null))[_0x72d8('0x29')](handleError(_0x25afd1,null));};exports['addImap']=function(_0xf905c2,_0xf803e0,_0x39389c){if(_0xf905c2[_0x72d8('0x57')]['id']){delete _0xf905c2[_0x72d8('0x57')]['id'];}return db[_0x72d8('0x41')][_0x72d8('0x56')]({'where':{'id':_0xf905c2['params']['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0xf803e0,null))[_0x72d8('0x20')](function(_0xb7c431){if(_0xb7c431){_0xf905c2[_0x72d8('0x57')]['MailAccountId']=_0xb7c431['id'];return db[_0x72d8('0x3b')]['create'](_0xf905c2[_0x72d8('0x57')]);}})['then'](respondWithResult(_0xf803e0,null))[_0x72d8('0x29')](handleError(_0xf803e0,null));};exports[_0x72d8('0x80')]=function(_0x573954,_0x27be53,_0x452dc4){return db[_0x72d8('0x41')]['findOne']({'where':{'id':_0x573954[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x27be53,null))[_0x72d8('0x20')](function(_0x315987){if(_0x315987){return _0x315987[_0x72d8('0x81')](null);}return null;})[_0x72d8('0x20')](respondWithStatusCode(_0x27be53,null))[_0x72d8('0x29')](handleError(_0x27be53,null));};exports[_0x72d8('0x82')]=function(_0x1d6b10,_0x105916,_0x42a40e){return db['MailAccount'][_0x72d8('0x5e')]({'where':{'id':_0x1d6b10[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x105916,null))[_0x72d8('0x20')](function(_0xea8a99){if(_0xea8a99){return _0xea8a99['getSmtp']();}return null;})[_0x72d8('0x20')](respondWithResult(_0x105916,null))[_0x72d8('0x29')](handleError(_0x105916,null));};exports[_0x72d8('0x83')]=function(_0x4a333d,_0x23c175,_0x1928c1){if(_0x4a333d[_0x72d8('0x57')]['id']){delete _0x4a333d[_0x72d8('0x57')]['id'];}return db[_0x72d8('0x41')][_0x72d8('0x56')]({'where':{'id':_0x4a333d[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x23c175,null))[_0x72d8('0x20')](function(_0x11caa9){if(_0x11caa9){_0x4a333d['body'][_0x72d8('0x5b')]=_0x11caa9['id'];return db['MailServerOut']['create'](_0x4a333d[_0x72d8('0x57')]);}})['then'](respondWithResult(_0x23c175,null))[_0x72d8('0x29')](handleError(_0x23c175,null));};exports[_0x72d8('0x84')]=function(_0x3a0bce,_0x244f22,_0x4e2800){return db[_0x72d8('0x41')][_0x72d8('0x5e')]({'where':{'id':_0x3a0bce[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x244f22,null))['then'](function(_0x601581){if(_0x601581){return _0x601581['setSmtp'](null);}return null;})[_0x72d8('0x20')](respondWithStatusCode(_0x244f22,null))[_0x72d8('0x29')](handleError(_0x244f22,null));};exports[_0x72d8('0x85')]=function(_0x4b4bd5,_0x85673,_0x538237){return db[_0x72d8('0x86')][_0x72d8('0x56')]({'where':{'id':_0x4b4bd5[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x85673,null))['then'](function(_0x188689){if(_0x188689){return _0x188689['addInteraction'](_0x4b4bd5[_0x72d8('0x57')][_0x72d8('0x6a')],_['omit'](_0x4b4bd5[_0x72d8('0x57')],[_0x72d8('0x6a'),'id'])||{});}})[_0x72d8('0x20')](respondWithResult(_0x85673,null))[_0x72d8('0x29')](handleError(_0x85673,null));};exports[_0x72d8('0x87')]=function(_0x381860,_0x354089,_0x40abb0){var _0x51d243={'raw':![],'where':{}};var _0x7c2760={};var _0x302cf6={'count':0x0,'rows':[]};return db[_0x72d8('0x41')]['findOne']({'where':{'id':_0x381860['params']['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x354089,null))[_0x72d8('0x20')](function(_0x3256dc){if(_0x3256dc){_0x7c2760[_0x72d8('0x44')]=_['keys'](db[_0x72d8('0x86')][_0x72d8('0x5f')]);_0x7c2760[_0x72d8('0x49')]=_[_0x72d8('0x46')](_0x381860[_0x72d8('0x49')]);_0x7c2760[_0x72d8('0x47')]=_[_0x72d8('0x48')](_0x7c2760[_0x72d8('0x44')],_0x7c2760[_0x72d8('0x49')]);_0x51d243[_0x72d8('0x4a')]=_['intersection'](_0x7c2760[_0x72d8('0x44')],qs[_0x72d8('0x4b')](_0x381860[_0x72d8('0x49')][_0x72d8('0x4b')]));_0x51d243['attributes']=_0x51d243[_0x72d8('0x4a')]['length']?_0x51d243[_0x72d8('0x4a')]:_0x7c2760[_0x72d8('0x44')];if(!_0x381860[_0x72d8('0x49')][_0x72d8('0x60')](_0x72d8('0x61'))){_0x51d243[_0x72d8('0x2f')]=qs['limit'](_0x381860[_0x72d8('0x49')][_0x72d8('0x2f')]);_0x51d243[_0x72d8('0x4d')]=qs[_0x72d8('0x4d')](_0x381860['query'][_0x72d8('0x4d')]);}_0x51d243[_0x72d8('0x62')]=qs[_0x72d8('0x4e')](_0x381860[_0x72d8('0x49')]['sort']);_0x51d243[_0x72d8('0x4f')]=qs[_0x72d8('0x47')](_['pick'](_0x381860[_0x72d8('0x49')],_0x7c2760[_0x72d8('0x47')]));_0x51d243[_0x72d8('0x4f')][_0x72d8('0x5b')]=_0x3256dc['id'];if(_0x381860[_0x72d8('0x49')][_0x72d8('0x64')]){_0x51d243[_0x72d8('0x4f')]=_[_0x72d8('0x50')](_0x51d243[_0x72d8('0x4f')],{'$or':_[_0x72d8('0x45')](_0x51d243[_0x72d8('0x4a')],function(_0x515e60){var _0x4ceecc={};_0x4ceecc[_0x515e60]={'$like':'%'+_0x381860[_0x72d8('0x49')][_0x72d8('0x64')]+'%'};return _0x4ceecc;})});}_0x51d243=_[_0x72d8('0x50')]({},_0x51d243,_0x381860[_0x72d8('0x51')]);return db[_0x72d8('0x86')][_0x72d8('0x30')]({'where':_0x51d243['where']})['then'](function(_0x4e35fa){_0x302cf6[_0x72d8('0x30')]=_0x4e35fa;if(_0x381860['query'][_0x72d8('0x55')]){_0x51d243[_0x72d8('0x52')]=[{'model':db[_0x72d8('0x88')],'as':_0x72d8('0x89'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x72d8('0x8a'),_0x72d8('0x8b')],'required':![]},{'model':db[_0x72d8('0x8c')],'as':_0x72d8('0x8d'),'attributes':['id',_0x72d8('0x39'),_0x72d8('0x8e')],'where':_0x381860[_0x72d8('0x49')][_0x72d8('0x8f')]?{'id':_0x381860[_0x72d8('0x49')][_0x72d8('0x8f')]}:undefined,'required':_0x381860[_0x72d8('0x49')][_0x72d8('0x8f')]?!![]:![]}];}return db[_0x72d8('0x86')][_0x72d8('0x65')](_0x51d243);})['then'](function(_0x199afc){_0x302cf6[_0x72d8('0x53')]=_0x199afc;return _0x302cf6;});}})[_0x72d8('0x20')](respondWithFilteredResult(_0x354089,_0x51d243))['catch'](handleError(_0x354089,null));};exports[_0x72d8('0x90')]=function(_0x1d41e0,_0xf93a05,_0xcdeb52){return db[_0x72d8('0x41')][_0x72d8('0x5e')]({'where':{'id':_0x1d41e0[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0xf93a05,null))['then'](function(_0x1ae6f0){if(_0x1ae6f0){return db[_0x72d8('0x91')][_0x72d8('0x92')](function(_0x52611b){return db['MailApplication'][_0x72d8('0x35')]({'where':{'MailAccountId':_0x1d41e0[_0x72d8('0x58')]['id']},'transaction':_0x52611b})[_0x72d8('0x20')](function(_0x3fb19b){var _0xfff54e=_['map'](_0x1d41e0[_0x72d8('0x57')],function(_0x413de0){_0x413de0['MailAccountId']=_0x1d41e0[_0x72d8('0x58')]['id'];return _0x413de0;});return db[_0x72d8('0x93')][_0x72d8('0x94')](_0xfff54e,{'transaction':_0x52611b});});})[_0x72d8('0x20')](function(){return db['MailApplication'][_0x72d8('0x95')]({'where':{'MailAccountId':_0x1d41e0[_0x72d8('0x58')]['id']},'order':'priority'});});}})[_0x72d8('0x20')](respondWithResult(_0xf93a05,null))[_0x72d8('0x29')](handleError(_0xf93a05,null));};exports[_0x72d8('0x96')]=function(_0xc5ddd7,_0x322588,_0x5e5379){var _0x4c21d7={};var _0x458a32={};var _0x45441d;var _0x7fc375;return db[_0x72d8('0x41')][_0x72d8('0x5e')]({'where':{'id':_0xc5ddd7[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x322588,null))[_0x72d8('0x20')](function(_0x1c7d22){if(_0x1c7d22){_0x45441d=_0x1c7d22;_0x458a32['model']=_[_0x72d8('0x46')](db[_0x72d8('0x93')][_0x72d8('0x5f')]);_0x458a32['query']=_[_0x72d8('0x46')](_0xc5ddd7[_0x72d8('0x49')]);_0x458a32[_0x72d8('0x47')]=_[_0x72d8('0x48')](_0x458a32[_0x72d8('0x44')],_0x458a32['query']);_0x4c21d7[_0x72d8('0x4a')]=_[_0x72d8('0x48')](_0x458a32[_0x72d8('0x44')],qs[_0x72d8('0x4b')](_0xc5ddd7[_0x72d8('0x49')][_0x72d8('0x4b')]));_0x4c21d7[_0x72d8('0x4a')]=_0x4c21d7[_0x72d8('0x4a')][_0x72d8('0x4c')]?_0x4c21d7[_0x72d8('0x4a')]:_0x458a32[_0x72d8('0x44')];_0x4c21d7['order']=qs[_0x72d8('0x4e')](_0xc5ddd7[_0x72d8('0x49')]['sort']);_0x4c21d7[_0x72d8('0x4f')]=qs[_0x72d8('0x47')](_[_0x72d8('0x63')](_0xc5ddd7['query'],_0x458a32[_0x72d8('0x47')]));if(_0xc5ddd7[_0x72d8('0x49')][_0x72d8('0x64')]){_0x4c21d7['where']=_[_0x72d8('0x50')](_0x4c21d7[_0x72d8('0x4f')],{'$or':_[_0x72d8('0x45')](_0x4c21d7['attributes'],function(_0xe5e1ab){var _0x4001e3={};_0x4001e3[_0xe5e1ab]={'$like':'%'+_0xc5ddd7[_0x72d8('0x49')]['filter']+'%'};return _0x4001e3;})});}_0x4c21d7=_[_0x72d8('0x50')]({},_0x4c21d7,_0xc5ddd7['options']);return _0x45441d[_0x72d8('0x96')](_0x4c21d7);}})[_0x72d8('0x20')](function(_0x1eb6da){if(_0x1eb6da){_0x7fc375=_0x1eb6da[_0x72d8('0x4c')];if(!_0xc5ddd7['query']['hasOwnProperty'](_0x72d8('0x61'))){_0x4c21d7[_0x72d8('0x2f')]=qs[_0x72d8('0x2f')](_0xc5ddd7[_0x72d8('0x49')][_0x72d8('0x2f')]);_0x4c21d7['offset']=qs['offset'](_0xc5ddd7[_0x72d8('0x49')][_0x72d8('0x4d')]);}return _0x45441d['getApplications'](_0x4c21d7);}})[_0x72d8('0x20')](function(_0x130fc5){if(_0x130fc5){return _0x130fc5?{'count':_0x7fc375,'rows':_0x130fc5}:null;}})[_0x72d8('0x20')](respondWithResult(_0x322588,null))[_0x72d8('0x29')](handleError(_0x322588,null));};exports[_0x72d8('0x97')]=function(_0x221a99,_0x493498,_0x2683db){var _0x2320d2={'raw':!![],'where':{}};var _0x13fc24={};var _0x2a01c0={'count':0x0,'rows':[]};return db[_0x72d8('0x41')]['findOne']({'where':{'id':_0x221a99[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x493498,null))[_0x72d8('0x20')](function(_0x56c9f9){if(_0x56c9f9){_0x13fc24['model']=_[_0x72d8('0x46')](db['MailMessage'][_0x72d8('0x5f')]);_0x13fc24[_0x72d8('0x49')]=_['keys'](_0x221a99[_0x72d8('0x49')]);_0x13fc24[_0x72d8('0x47')]=_['intersection'](_0x13fc24[_0x72d8('0x44')],_0x13fc24[_0x72d8('0x49')]);_0x2320d2[_0x72d8('0x4a')]=_['intersection'](_0x13fc24[_0x72d8('0x44')],qs['fields'](_0x221a99['query']['fields']));_0x2320d2['attributes']=_0x2320d2[_0x72d8('0x4a')]['length']?_0x2320d2['attributes']:_0x13fc24['model'];if(!_0x221a99['query'][_0x72d8('0x60')]('nolimit')){_0x2320d2[_0x72d8('0x2f')]=qs[_0x72d8('0x2f')](_0x221a99['query'][_0x72d8('0x2f')]);_0x2320d2['offset']=qs[_0x72d8('0x4d')](_0x221a99['query'][_0x72d8('0x4d')]);}_0x2320d2[_0x72d8('0x62')]=qs[_0x72d8('0x4e')](_0x221a99[_0x72d8('0x49')][_0x72d8('0x4e')]);_0x2320d2[_0x72d8('0x4f')]=qs[_0x72d8('0x47')](_[_0x72d8('0x63')](_0x221a99[_0x72d8('0x49')],_0x13fc24['filters']));_0x2320d2[_0x72d8('0x4f')][_0x72d8('0x5b')]=_0x56c9f9['id'];if(_0x221a99[_0x72d8('0x49')][_0x72d8('0x64')]){_0x2320d2[_0x72d8('0x4f')]=_[_0x72d8('0x50')](_0x2320d2['where'],{'$or':_[_0x72d8('0x45')](_0x2320d2[_0x72d8('0x4a')],function(_0x4f180c){var _0x2fed58={};_0x2fed58[_0x4f180c]={'$like':'%'+_0x221a99[_0x72d8('0x49')][_0x72d8('0x64')]+'%'};return _0x2fed58;})});}if(_0x221a99[_0x72d8('0x49')][_0x72d8('0x98')]){var _0x431183=_0x221a99[_0x72d8('0x49')][_0x72d8('0x98')][_0x72d8('0x99')](',');var _0x4a0998={};_0x4a0998[_0x431183[0x0]]={'$gte':moment(_0x431183[0x1])[_0x72d8('0x9a')](_0x72d8('0x9b'))};_0x2320d2[_0x72d8('0x4f')]=_[_0x72d8('0x50')](_0x2320d2['where'],_0x4a0998);}_0x2320d2=_[_0x72d8('0x50')]({},_0x2320d2,_0x221a99[_0x72d8('0x51')]);return db[_0x72d8('0x9c')]['count']({'where':_0x2320d2['where']})['then'](function(_0x6ca86e){_0x2a01c0[_0x72d8('0x30')]=_0x6ca86e;if(_0x221a99[_0x72d8('0x49')][_0x72d8('0x55')]){_0x2320d2[_0x72d8('0x52')]=[{'all':!![]}];}return db['MailMessage'][_0x72d8('0x65')](_0x2320d2);})[_0x72d8('0x20')](function(_0x24e13){if(_0x221a99[_0x72d8('0x49')][_0x72d8('0x9d')]===_0x72d8('0x9e')){for(var _0x234f58=0x0;_0x234f58<_0x24e13[_0x72d8('0x4c')];_0x234f58++){_0x24e13[_0x234f58][_0x72d8('0x57')]=juice(_0x24e13[_0x234f58][_0x72d8('0x57')]);}}_0x2a01c0[_0x72d8('0x53')]=_0x24e13;return _0x2a01c0;});}})[_0x72d8('0x20')](respondWithFilteredResult(_0x493498,_0x2320d2))['catch'](handleError(_0x493498,null));};exports[_0x72d8('0x3a')]=function(_0x54d4e0,_0x142d9a,_0x18c206){var _0x39129f,_0x290969={},_0x2cfa9a;if(_0x54d4e0[_0x72d8('0x57')]['to']){_0x2cfa9a=_0x54d4e0[_0x72d8('0x57')]['to']['split'](',')[0x0];}return db[_0x72d8('0x41')]['find']({'where':{'id':_0x54d4e0[_0x72d8('0x58')]['id']},'include':[{'model':db[_0x72d8('0x9f')],'as':_0x72d8('0xa0'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x2cfa9a},'limit':0x1,'order':[[_0x72d8('0xa1'),_0x72d8('0xa2')]]}]},{'model':db[_0x72d8('0x3d')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x142d9a,null))[_0x72d8('0x20')](function(_0x6ea2f4){if(_0x6ea2f4){_0x39129f=_0x6ea2f4;if(_0x6ea2f4['Smtp']){if(_[_0x72d8('0x6d')](_0x54d4e0['body'][_0x72d8('0xa3')])){_0x54d4e0[_0x72d8('0x57')][_0x72d8('0xa3')]=util[_0x72d8('0x9a')](_0x72d8('0xa4'),_0x6ea2f4[_0x72d8('0x39')],_0x6ea2f4['email']||_0x6ea2f4[_0x72d8('0x3e')][_0x72d8('0x71')]);}if(_0x54d4e0[_0x72d8('0x57')][_0x72d8('0xa5')]&&_0x54d4e0[_0x72d8('0x57')]['attachments'][_0x72d8('0x4c')]){for(var _0x33684a=0x0;_0x33684a<_0x54d4e0[_0x72d8('0x57')]['attachments'][_0x72d8('0x4c')];_0x33684a+=0x1){_0x54d4e0['body'][_0x72d8('0xa5')][_0x33684a]={'filename':_0x54d4e0['body']['attachments'][_0x33684a][_0x72d8('0x39')],'path':path[_0x72d8('0xa6')](config['root'],_0x72d8('0xa7'),_0x54d4e0[_0x72d8('0x57')][_0x72d8('0xa5')][_0x33684a]['basename'])};}}var _0x4e8aae={'tls':{'rejectUnauthorized':![]}};if(_[_0x72d8('0x6d')](_0x6ea2f4[_0x72d8('0x3e')][_0x72d8('0x78')])){if(_0x6ea2f4['Smtp'][_0x72d8('0x75')]){_0x4e8aae[_0x72d8('0xa8')]={'user':_0x6ea2f4[_0x72d8('0x3e')][_0x72d8('0x71')],'pass':_0x6ea2f4[_0x72d8('0x3e')][_0x72d8('0x73')]};}_0x4e8aae[_0x72d8('0x76')]=_0x6ea2f4['Smtp'][_0x72d8('0x76')];_0x4e8aae['port']=_0x6ea2f4[_0x72d8('0x3e')]['port'];_0x4e8aae['secure']=_0x6ea2f4[_0x72d8('0x3e')][_0x72d8('0xa9')];}else{_0x4e8aae[_0x72d8('0x78')]=_0x6ea2f4[_0x72d8('0x3e')][_0x72d8('0x78')];_0x4e8aae[_0x72d8('0xa8')]={'user':_0x6ea2f4['Smtp']['user'],'pass':_0x6ea2f4[_0x72d8('0x3e')][_0x72d8('0x73')]};}return respondWithRpcPromise(_0x72d8('0xaa'),_0x72d8('0xab'),{'account':_0x4e8aae,'message':_0x54d4e0[_0x72d8('0x57')]});}else{throw new Error(_0x72d8('0xac'));}}})['then'](function(_0x2db387){if(_0x2db387){_0x290969=_0x2db387;if(_0x39129f['List']){if(_0x39129f[_0x72d8('0xa0')][_0x72d8('0xad')][_0x72d8('0x4c')]){return _0x39129f[_0x72d8('0xa0')]['Contacts'][0x0];}else{return db[_0x72d8('0x88')][_0x72d8('0x68')](_[_0x72d8('0x1a')](_0x54d4e0[_0x72d8('0x57')],{'firstName':_0x54d4e0[_0x72d8('0x57')]['to'],'email':_0x54d4e0['body']['to'],'phone':_0x54d4e0[_0x72d8('0x57')]['to'],'ListId':_0x39129f[_0x72d8('0x6c')]}));}}else{throw new Error(_0x72d8('0xac'));}}})[_0x72d8('0x20')](function(_0x4e2482){if(_0x4e2482){var _0x1f7425={'UserId':_0x54d4e0['user']['id'],'ContactId':_0x4e2482['id'],'MailAccountId':_0x39129f['id'],'inReplyTo':_0x290969[_0x72d8('0xae')],'to':_0x54d4e0[_0x72d8('0x57')][_0x72d8('0xa3')],'cc':_0x54d4e0[_0x72d8('0x57')]['cc'],'subject':_0x54d4e0['body'][_0x72d8('0xaf')],'attach':_0x54d4e0['body'][_0x72d8('0xb0')],'firstMsgDirection':_0x72d8('0xb1'),'lastMsgAt':moment()[_0x72d8('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x72d8('0xb1'),'Messages':[_['merge'](_0x54d4e0[_0x72d8('0x57')],{'messageId':_0x290969[_0x72d8('0xae')],'sentAt':moment()[_0x72d8('0x9a')](_0x72d8('0x9b')),'read':!![],'MailAccountId':_0x39129f['id'],'UserId':_0x54d4e0['user']['id'],'ContactId':_0x4e2482['id']})]};if(_0x54d4e0['body'][_0x72d8('0xb2')]){_0x1f7425=_[_0x72d8('0x50')](_0x1f7425,_0x54d4e0[_0x72d8('0x57')][_0x72d8('0xb2')]);}return db[_0x72d8('0x86')]['create'](_0x1f7425,{'include':[{'model':db['MailMessage'],'as':_0x72d8('0xb3')}]});}})[_0x72d8('0x20')](respondWithResult(_0x142d9a,null))['catch'](handleError(_0x142d9a,null));};exports[_0x72d8('0xb4')]=function(_0x3dd539,_0xb1cc51,_0x14d428){return db[_0x72d8('0x41')]['find']({'where':{'id':_0x3dd539[_0x72d8('0x58')]['id']},'include':[{'model':db[_0x72d8('0x3d')],'as':_0x72d8('0x3e'),'raw':!![]}]})[_0x72d8('0x20')](handleEntityNotFound(_0xb1cc51,null))['then'](function(_0x6b9021){if(_0x6b9021&&_0x6b9021[_0x72d8('0x3e')]){var _0x48ef0e={'id':_0x6b9021['id'],'tls':{'rejectUnauthorized':![]}};if(_0x6b9021[_0x72d8('0x3e')][_0x72d8('0x78')]){_0x48ef0e[_0x72d8('0x78')]=_0x6b9021['Smtp'][_0x72d8('0x78')];}else{_0x48ef0e['host']=_0x6b9021[_0x72d8('0x3e')][_0x72d8('0x76')];_0x48ef0e[_0x72d8('0x77')]=_0x6b9021['Smtp'][_0x72d8('0x77')];_0x48ef0e[_0x72d8('0xa9')]=_0x6b9021['Smtp'][_0x72d8('0xa9')];}if(_0x6b9021[_0x72d8('0x3e')][_0x72d8('0x75')]){_0x48ef0e[_0x72d8('0xa8')]={'user':_0x6b9021[_0x72d8('0x3e')][_0x72d8('0x71')],'pass':_0x6b9021[_0x72d8('0x3e')][_0x72d8('0x73')]};}return respondWithRpcPromise(_0x72d8('0xb5'),_0x72d8('0xb4'),{'account':_0x48ef0e});}})[_0x72d8('0x20')](respondWithResult(_0xb1cc51,null))[_0x72d8('0x29')](handleError(_0xb1cc51,null));};exports[_0x72d8('0x35')]=function(_0x2db78f,_0x17e314){return db['MailAccount'][_0x72d8('0x56')]({'where':{'id':_0x2db78f[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x17e314,null))[_0x72d8('0x20')](function(_0x64e07f){if(_0x64e07f&&_0x64e07f['service']){throw new db[(_0x72d8('0xb6'))][(_0x72d8('0xb7'))](_0x72d8('0xb8'));}return _0x64e07f;})['then'](removeEntity(_0x17e314,null))[_0x72d8('0x29')](handleError(_0x17e314,null));};exports[_0x72d8('0xb9')]=function(_0x4a1bcf,_0x1975e1,_0x1410c0){return db[_0x72d8('0x41')][_0x72d8('0x56')]({'where':{'id':_0x4a1bcf[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x1975e1,null))[_0x72d8('0x20')](function(_0x1ce530){if(_0x1ce530){return _0x1ce530[_0x72d8('0xb9')](_0x4a1bcf[_0x72d8('0x57')]['ids'],_[_0x72d8('0xba')](_0x4a1bcf[_0x72d8('0x57')],['ids','id'])||{})[_0x72d8('0xbb')](function(_0x409675){for(var _0x535f3f=0x0;_0x535f3f<_0x4a1bcf[_0x72d8('0x57')][_0x72d8('0x6a')][_0x72d8('0x4c')];_0x535f3f+=0x1){socket[_0x72d8('0xbc')](_0x72d8('0xbd'),{'UserId':_0x4a1bcf['body']['ids'][_0x535f3f],'MailAccountId':_0x4a1bcf[_0x72d8('0x58')]['id']});}return _0x409675;});}})[_0x72d8('0x20')](respondWithResult(_0x1975e1,null))[_0x72d8('0x29')](handleError(_0x1975e1,null));};exports[_0x72d8('0xbe')]=function(_0x4ca01e,_0xfa90f9,_0x12b8ce){return db[_0x72d8('0x41')][_0x72d8('0x56')]({'where':{'id':_0x4ca01e[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0xfa90f9,null))['then'](function(_0x1d2aa9){if(_0x1d2aa9){return _0x1d2aa9[_0x72d8('0xbe')](_0x4ca01e[_0x72d8('0x49')][_0x72d8('0x6a')])['then'](function(){if(_['isArray'](_0x4ca01e['query'][_0x72d8('0x6a')])){for(var _0x7d2e7d=0x0;_0x7d2e7d<_0x4ca01e[_0x72d8('0x49')][_0x72d8('0x6a')]['length'];_0x7d2e7d+=0x1){socket[_0x72d8('0xbc')](_0x72d8('0xbf'),{'UserId':Number(_0x4ca01e[_0x72d8('0x49')][_0x72d8('0x6a')][_0x7d2e7d]),'MailAccountId':Number(_0x4ca01e[_0x72d8('0x58')]['id'])});}}else{socket[_0x72d8('0xbc')](_0x72d8('0xbf'),{'UserId':Number(_0x4ca01e[_0x72d8('0x49')][_0x72d8('0x6a')]),'MailAccountId':Number(_0x4ca01e['params']['id'])});}});}})[_0x72d8('0x20')](respondWithStatusCode(_0xfa90f9,null))[_0x72d8('0x29')](handleError(_0xfa90f9,null));};exports[_0x72d8('0xc0')]=function(_0x5678fd,_0x258f67,_0x4b0363){var _0x430189={};var _0x57e708={};var _0x49cb6a;var _0x395b45;return db[_0x72d8('0x41')][_0x72d8('0x5e')]({'where':{'id':_0x5678fd[_0x72d8('0x58')]['id']}})[_0x72d8('0x20')](handleEntityNotFound(_0x258f67,null))[_0x72d8('0x20')](function(_0x4200e3){if(_0x4200e3){_0x49cb6a=_0x4200e3;_0x57e708['model']=_[_0x72d8('0x46')](db[_0x72d8('0xc1')][_0x72d8('0x5f')]);_0x57e708[_0x72d8('0x49')]=_['keys'](_0x5678fd[_0x72d8('0x49')]);_0x57e708[_0x72d8('0x47')]=_['intersection'](_0x57e708[_0x72d8('0x44')],_0x57e708[_0x72d8('0x49')]);_0x430189[_0x72d8('0x4a')]=_[_0x72d8('0x48')](_0x57e708['model'],qs[_0x72d8('0x4b')](_0x5678fd[_0x72d8('0x49')][_0x72d8('0x4b')]));_0x430189[_0x72d8('0x4a')]=_0x430189[_0x72d8('0x4a')][_0x72d8('0x4c')]?_0x430189[_0x72d8('0x4a')]:_0x57e708['model'];_0x430189[_0x72d8('0x62')]=qs['sort'](_0x5678fd['query']['sort']);_0x430189[_0x72d8('0x4f')]=qs[_0x72d8('0x47')](_[_0x72d8('0x63')](_0x5678fd[_0x72d8('0x49')],_0x57e708[_0x72d8('0x47')]));if(_0x5678fd['query']['filter']){_0x430189[_0x72d8('0x4f')]=_[_0x72d8('0x50')](_0x430189[_0x72d8('0x4f')],{'$or':_[_0x72d8('0x45')](_0x430189[_0x72d8('0x4a')],function(_0xd9553b){var _0x5d096c={};_0x5d096c[_0xd9553b]={'$like':'%'+_0x5678fd[_0x72d8('0x49')]['filter']+'%'};return _0x5d096c;})});}_0x430189=_['merge']({},_0x430189,_0x5678fd[_0x72d8('0x51')]);return _0x49cb6a['getAgents'](_0x430189);}})['then'](function(_0x1375a6){if(_0x1375a6){_0x395b45=_0x1375a6[_0x72d8('0x4c')];if(!_0x5678fd['query'][_0x72d8('0x60')](_0x72d8('0x61'))){_0x430189[_0x72d8('0x2f')]=qs['limit'](_0x5678fd[_0x72d8('0x49')][_0x72d8('0x2f')]);_0x430189[_0x72d8('0x4d')]=qs[_0x72d8('0x4d')](_0x5678fd[_0x72d8('0x49')][_0x72d8('0x4d')]);}return _0x49cb6a[_0x72d8('0xc0')](_0x430189);}})[_0x72d8('0x20')](function(_0x11f4b4){if(_0x11f4b4){return _0x11f4b4?{'count':_0x395b45,'rows':_0x11f4b4}:null;}})[_0x72d8('0x20')](respondWithResult(_0x258f67,null))[_0x72d8('0x29')](handleError(_0x258f67,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ce2d754..9540625 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 _0x138e=['emit','hasOwnProperty','exports','../../mysqldb','MailAccount','update','remove'];(function(_0x23b785,_0xf98051){var _0x25066a=function(_0x51a04c){while(--_0x51a04c){_0x23b785['push'](_0x23b785['shift']());}};_0x25066a(++_0xf98051);}(_0x138e,0xc0));var _0xe138=function(_0x506d47,_0x42fe39){_0x506d47=_0x506d47-0x0;var _0x1fb5a2=_0x138e[_0x506d47];return _0x1fb5a2;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xe138('0x0'))['db'][_0xe138('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe138('0x2'),'afterDestroy':_0xe138('0x3')};function emitEvent(_0x30fb2e){return function(_0x69ceda,_0x4f0687,_0x4c156f){MailAccountEvents[_0xe138('0x4')](_0x30fb2e+':'+_0x69ceda['id'],_0x69ceda);MailAccountEvents[_0xe138('0x4')](_0x30fb2e,_0x69ceda);_0x4c156f(null);};}for(var e in events){if(events[_0xe138('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xe138('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xa99f=['hasOwnProperty','hook','events','MailAccount','setMaxListeners','save','update','emit'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xa99f,0x1da));var _0xfa99=function(_0x4ca2ad,_0x3632b6){_0x4ca2ad=_0x4ca2ad-0x0;var _0x905606=_0xa99f[_0x4ca2ad];return _0x905606;};'use strict';var EventEmitter=require(_0xfa99('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xfa99('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xfa99('0x2')](0x0);var events={'afterCreate':_0xfa99('0x3'),'afterUpdate':_0xfa99('0x4'),'afterDestroy':'remove'};function emitEvent(_0x512333){return function(_0x50bf7f,_0x1a09c2,_0x573924){MailAccountEvents[_0xfa99('0x5')](_0x512333+':'+_0x50bf7f['id'],_0x50bf7f);MailAccountEvents[_0xfa99('0x5')](_0x512333,_0x50bf7f);_0x573924(null);};}for(var e in events){if(events[_0xfa99('0x6')](e)){var event=events[e];MailAccount[_0xfa99('0x7')](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 342fd97..2df3920 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 _0xd140=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x3aa819,_0x1d04ee){var _0x3b4cb3=function(_0xee072d){while(--_0xee072d){_0x3aa819['push'](_0x3aa819['shift']());}};_0x3b4cb3(++_0x1d04ee);}(_0xd140,0x1d4));var _0x0d14=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd140[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d14('0x0'));var util=require('util');var logger=require(_0x0d14('0x1'))(_0x0d14('0x2'));var moment=require(_0x0d14('0x3'));var BPromise=require(_0x0d14('0x4'));var rp=require(_0x0d14('0x5'));var fs=require('fs');var path=require(_0x0d14('0x6'));var rimraf=require('rimraf');var config=require(_0x0d14('0x7'));var attributes=require(_0x0d14('0x8'));module[_0x0d14('0x9')]=function(_0x4e6dfe,_0xf33b6c){return _0x4e6dfe[_0x0d14('0xa')](_0x0d14('0xb'),attributes,{'tableName':_0x0d14('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b0a=['path','rimraf','exports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14aee3,_0x547817){var _0xc5b322=function(_0x4527e6){while(--_0x4527e6){_0x14aee3['push'](_0x14aee3['shift']());}};_0xc5b322(++_0x547817);}(_0x1b0a,0x16b));var _0xa1b0=function(_0x5f1e29,_0x56d12a){_0x5f1e29=_0x5f1e29-0x0;var _0x436a27=_0x1b0a[_0x5f1e29];return _0x436a27;};'use strict';var _=require(_0xa1b0('0x0'));var util=require(_0xa1b0('0x1'));var logger=require(_0xa1b0('0x2'))(_0xa1b0('0x3'));var moment=require(_0xa1b0('0x4'));var BPromise=require(_0xa1b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1b0('0x6'));var rimraf=require(_0xa1b0('0x7'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0xa1b0('0x8')]=function(_0x1decaa,_0x46eeda){return _0x1decaa['define']('MailAccount',attributes,{'tableName':'mail_accounts','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 3188a37..5936d15 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 _0x3316=['Applications','List','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','format','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowMailAccount','find','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','account','Contacts','DESC'];(function(_0x2fa393,_0x57e26d){var _0x15a4fb=function(_0x2a8eb9){while(--_0x2a8eb9){_0x2fa393['push'](_0x2fa393['shift']());}};_0x15a4fb(++_0x57e26d);}(_0x3316,0x16c));var _0x6331=function(_0x4024a8,_0x24792b){_0x4024a8=_0x4024a8-0x0;var _0x4d7178=_0x3316[_0x4024a8];return _0x4d7178;};'use strict';var _=require(_0x6331('0x0'));var util=require(_0x6331('0x1'));var moment=require('moment');var BPromise=require(_0x6331('0x2'));var rs=require(_0x6331('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6331('0x4'))['db'];var utils=require(_0x6331('0x5'));var logger=require(_0x6331('0x6'))(_0x6331('0x7'));var config=require(_0x6331('0x8'));var jayson=require(_0x6331('0x9'));var client=jayson[_0x6331('0xa')][_0x6331('0xb')]({'port':0x232c});config['redis']=_[_0x6331('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6331('0xd'))(new Redis(config[_0x6331('0xe')]));require(_0x6331('0xf'))[_0x6331('0x10')](socket);function respondWithRpcPromise(_0x42a17e,_0x13e12c,_0x29906f){return new BPromise(function(_0x510ab0,_0x43f275){return client[_0x6331('0x11')](_0x42a17e,_0x29906f)[_0x6331('0x12')](function(_0x57787f){logger['info'](_0x6331('0x13'),_0x13e12c,_0x6331('0x14'));logger[_0x6331('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x13e12c,_0x6331('0x14'),JSON[_0x6331('0x16')](_0x57787f));if(_0x57787f[_0x6331('0x17')]){if(_0x57787f[_0x6331('0x17')][_0x6331('0x18')]===0x1f4){logger[_0x6331('0x17')]('MailAccount,\x20%s,\x20%s',_0x13e12c,_0x57787f['error']['message']);return _0x43f275(_0x57787f['error'][_0x6331('0x19')]);}logger[_0x6331('0x17')](_0x6331('0x13'),_0x13e12c,_0x57787f[_0x6331('0x17')]['message']);return _0x510ab0(_0x57787f[_0x6331('0x17')][_0x6331('0x19')]);}else{logger[_0x6331('0x1a')](_0x6331('0x13'),_0x13e12c,_0x6331('0x14'));_0x510ab0(_0x57787f[_0x6331('0x1b')][_0x6331('0x19')]);}})['catch'](function(_0x38ca0a){logger['error'](_0x6331('0x13'),_0x13e12c,_0x38ca0a);_0x43f275(_0x38ca0a);});});}exports[_0x6331('0x1c')]=function(_0x68e1bf){var _0x3c8a37=this;return new Promise(function(_0x2bd36f,_0x3287b5){return db[_0x6331('0x1d')][_0x6331('0x1e')]({'raw':_0x68e1bf['options']?_0x68e1bf[_0x6331('0x1f')][_0x6331('0x20')]===undefined?!![]:![]:!![],'where':_0x68e1bf[_0x6331('0x1f')]?_0x68e1bf[_0x6331('0x1f')][_0x6331('0x21')]||null:null,'attributes':_0x68e1bf[_0x6331('0x1f')]?_0x68e1bf[_0x6331('0x1f')][_0x6331('0x22')]||null:null,'limit':_0x68e1bf[_0x6331('0x1f')]?_0x68e1bf['options'][_0x6331('0x23')]||null:null,'include':_0x68e1bf[_0x6331('0x1f')]?_0x68e1bf[_0x6331('0x1f')][_0x6331('0x24')]?_[_0x6331('0x25')](_0x68e1bf['options']['include'],function(_0x129ebb){return{'model':db[_0x129ebb[_0x6331('0x26')]],'as':_0x129ebb['as'],'attributes':_0x129ebb[_0x6331('0x22')],'include':_0x129ebb[_0x6331('0x24')]?_[_0x6331('0x25')](_0x129ebb['include'],function(_0xd4c3a3){return{'model':db[_0xd4c3a3[_0x6331('0x26')]],'as':_0xd4c3a3['as'],'attributes':_0xd4c3a3[_0x6331('0x22')],'include':_0xd4c3a3[_0x6331('0x24')]?_[_0x6331('0x25')](_0xd4c3a3[_0x6331('0x24')],function(_0x61c725){return{'model':db[_0x61c725['model']],'as':_0x61c725['as'],'attributes':_0x61c725[_0x6331('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f8fc3){logger[_0x6331('0x1a')](_0x6331('0x1c'),_0x68e1bf);logger[_0x6331('0x15')]('GetMailAccount',_0x68e1bf,JSON[_0x6331('0x16')](_0x3f8fc3));_0x2bd36f(_0x3f8fc3);})[_0x6331('0x27')](function(_0x195d8d){logger[_0x6331('0x17')](_0x6331('0x1c'),_0x195d8d[_0x6331('0x19')],_0x68e1bf);_0x3287b5(_0x3c8a37[_0x6331('0x17')](0x1f4,_0x195d8d[_0x6331('0x19')]));});});};exports[_0x6331('0x28')]=function(_0x404509){var _0x4ea71f=this;return new Promise(function(_0x41f513,_0x515f5a){return db[_0x6331('0x1d')][_0x6331('0x29')]({'raw':_0x404509['options']?_0x404509[_0x6331('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x404509[_0x6331('0x1f')]?_0x404509[_0x6331('0x1f')][_0x6331('0x21')]||null:null,'attributes':_0x404509[_0x6331('0x1f')]?_0x404509[_0x6331('0x1f')][_0x6331('0x22')]||null:null,'include':_0x404509[_0x6331('0x1f')]?_0x404509[_0x6331('0x1f')][_0x6331('0x24')]?_['map'](_0x404509[_0x6331('0x1f')][_0x6331('0x24')],function(_0x111b13){return{'model':db[_0x111b13[_0x6331('0x26')]],'as':_0x111b13['as'],'attributes':_0x111b13[_0x6331('0x22')],'include':_0x111b13['include']?_[_0x6331('0x25')](_0x111b13[_0x6331('0x24')],function(_0x473204){return{'model':db[_0x473204[_0x6331('0x26')]],'as':_0x473204['as'],'attributes':_0x473204['attributes'],'include':_0x473204[_0x6331('0x24')]?_[_0x6331('0x25')](_0x473204['include'],function(_0x9a77b8){return{'model':db[_0x9a77b8['model']],'as':_0x9a77b8['as'],'attributes':_0x9a77b8[_0x6331('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50d93a){logger[_0x6331('0x1a')](_0x6331('0x28'),_0x404509);logger[_0x6331('0x15')](_0x6331('0x28'),_0x404509,JSON[_0x6331('0x16')](_0x50d93a));_0x41f513(_0x50d93a);})[_0x6331('0x27')](function(_0x1ab311){logger[_0x6331('0x17')](_0x6331('0x28'),_0x1ab311['message'],_0x404509);_0x515f5a(_0x4ea71f[_0x6331('0x17')](0x1f4,_0x1ab311['message']));});});};exports[_0x6331('0x2a')]=function(_0x74999a){var _0x18a6c3=this;return new Promise(function(_0x18f368,_0x19982f){var _0x50eb9b={'body':_0x74999a['body'],'channel':_0x6331('0x2b')};var _0x3f8f76=_[_0x6331('0x2c')](_[_0x6331('0x2d')](db[_0x6331('0x2e')][_0x6331('0x2f')]),[_0x6331('0x30'),_0x6331('0x31'),_0x6331('0x32'),_0x6331('0x33')]);var _0x59cd18=![];if(_0x74999a['body']['id']){delete _0x74999a['body']['id'];}if(_[_0x6331('0x34')](_0x74999a[_0x6331('0x35')]['from'])){return _0x19982f(_0x18a6c3[_0x6331('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x74999a[_0x6331('0x35')][_0x6331('0x35')])||_0x74999a[_0x6331('0x35')][_0x6331('0x35')]===''){return _0x19982f(_0x18a6c3['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x6331('0x34')](_0x74999a['body']['mapKey'])){return _0x19982f(_0x18a6c3[_0x6331('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f8f76));}if(!_['includes'](_0x3f8f76,_0x74999a[_0x6331('0x35')]['mapKey'])){return _0x19982f(_0x18a6c3['error'](0x1f4,_0x6331('0x36')+_0x3f8f76));}var _0x33e548={};_0x33e548[_0x74999a[_0x6331('0x35')][_0x6331('0x37')]]=_0x74999a[_0x6331('0x35')][_0x6331('0x38')];return db[_0x6331('0x1d')][_0x6331('0x29')]({'where':{'id':_0x74999a[_0x6331('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x6331('0x3a'),'where':_0x33e548,'limit':0x1,'order':[[_0x6331('0x31'),_0x6331('0x3b')]]}]},{'model':db['MailApplication'],'as':_0x6331('0x3c')},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x6331('0x12')](function(_0x4ce311){if(_0x4ce311&&_0x4ce311[_0x6331('0x3d')]){var _0x26dde7=_0x4ce311[_0x6331('0x3e')]({'plain':!![]});_0x50eb9b['account']=_[_0x6331('0x3f')](_0x26dde7,[_0x6331('0x3c'),_0x6331('0x3d')]);_0x50eb9b[_0x6331('0x40')]=_0x26dde7[_0x6331('0x3c')];_0x50eb9b[_0x6331('0x41')]=_0x26dde7['List'];_0x50eb9b[_0x6331('0x40')]=_[_0x6331('0x42')](_0x50eb9b[_0x6331('0x40')],[_0x6331('0x43')],[_0x6331('0x44')]);if(_0x50eb9b['account']&&_0x50eb9b[_0x6331('0x39')][_0x6331('0x45')]){_0x50eb9b[_0x6331('0x40')][_0x6331('0x46')]({'id':0x0,'priority':_0x50eb9b['applications'][_0x6331('0x47')]+0x1,'app':_0x6331('0x48'),'appdata':_0x6331('0x45'),'interval':_0x6331('0x49')});}if(_0x50eb9b[_0x6331('0x39')][_0x6331('0x3c')]){delete _0x50eb9b[_0x6331('0x39')][_0x6331('0x3c')];}if(_0x50eb9b[_0x6331('0x39')][_0x6331('0x3d')]){delete _0x50eb9b['account']['List'];}if(_0x26dde7[_0x6331('0x3d')]['Contacts'][_0x6331('0x47')]){return _0x26dde7['List']['Contacts'][0x0];}var _0x5b6be9=_[_0x6331('0xc')](_0x74999a[_0x6331('0x35')],{'firstName':_0x74999a[_0x6331('0x35')][_0x6331('0x38')],'ListId':_0x26dde7[_0x6331('0x33')]});_0x5b6be9[_0x74999a['body'][_0x6331('0x37')]]=_0x74999a[_0x6331('0x35')][_0x6331('0x38')];return db['CmContact'][_0x6331('0x4a')](_0x5b6be9);}else{throw new Error(_0x6331('0x4b'));}})['then'](function(_0xe6f3f0){_0x50eb9b['contact']=_0xe6f3f0;if(_0xe6f3f0){if(!_0x74999a[_0x6331('0x35')]['message'][_0x6331('0x4c')]){_0x74999a['body']['message'][_0x6331('0x4c')]=rs[_0x6331('0x4d')]()+'\x20'+_0x74999a[_0x6331('0x35')]['message']['from'];}var _0x36eae4={'ContactId':_0xe6f3f0['id'],'MailAccountId':_0x74999a['account']['id'],'inReplyTo':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x4c')],'to':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x38')],'cc':_0x74999a[_0x6331('0x35')][_0x6331('0x19')]['cc'],'subject':_0x74999a['body'][_0x6331('0x19')][_0x6331('0x4e')],'attach':_0x74999a['body']['message'][_0x6331('0x4f')],'lastMsgAt':moment()['format'](_0x6331('0x50')),'lastMsgDirection':'in'};return db[_0x6331('0x51')][_0x6331('0x29')]({'where':{'closed':![],'MailAccountId':_0x74999a[_0x6331('0x39')]['id']},'include':[{'model':db[_0x6331('0x52')],'as':_0x6331('0x53'),'attributes':[_0x6331('0x4c')],'where':{'messageId':_0x74999a['body'][_0x6331('0x19')]['inReplyTo']}}]})[_0x6331('0x12')](function(_0x11d710){if(_0x11d710){return[_0x11d710,![]];}return db['MailInteraction'][_0x6331('0x4a')](_0x36eae4)['then'](function(_0x15315c){return[_0x15315c,!![]];});});}else{throw new Error(_0x6331('0x54'));}})[_0x6331('0x55')](function(_0x460044,_0x65cd86){if(_0x460044){_0x59cd18=_0x65cd86;if(!_0x65cd86){return _0x460044[_0x6331('0x56')]({'inReplyTo':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x4c')],'to':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x38')],'cc':_0x74999a[_0x6331('0x35')]['message']['cc'],'subject':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x4e')],'attach':_0x460044[_0x6331('0x4f')]?_0x460044[_0x6331('0x4f')]:_0x74999a[_0x6331('0x35')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x6331('0x57')](_0x6331('0x50')),'lastMsgAt':moment()[_0x6331('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x460044;}}})[_0x6331('0x12')](function(_0x4357c0){_0x50eb9b[_0x6331('0x58')]=_0x4357c0[_0x6331('0x3e')]({'plain':!![]});_0x50eb9b[_0x6331('0x58')][_0x6331('0x59')]=_0x59cd18;return db['MailMessage'][_0x6331('0x4a')]({'body':_0x74999a['body'][_0x6331('0x35')],'MailAccountId':_0x74999a[_0x6331('0x39')]['id'],'MailInteractionId':_0x4357c0['id'],'direction':'in','ContactId':_0x50eb9b[_0x6331('0x5a')]['id'],'messageId':_0x74999a['body'][_0x6331('0x19')][_0x6331('0x4c')],'from':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x38')],'to':_0x74999a[_0x6331('0x35')]['message']['to'],'cc':_0x74999a[_0x6331('0x35')][_0x6331('0x19')]['cc'],'subject':_0x74999a[_0x6331('0x35')]['message'][_0x6331('0x4e')],'attach':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x4f')],'Attachments':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x5b')],'originTo':_0x74999a['body'][_0x6331('0x19')][_0x6331('0x5c')],'originCc':_0x74999a[_0x6331('0x35')][_0x6331('0x19')][_0x6331('0x5d')],'bcc':_0x74999a['body'][_0x6331('0x19')][_0x6331('0x5e')],'ChatWebsiteId':_0x74999a['body']['message'][_0x6331('0x5f')]||null,'originChannel':_0x74999a[_0x6331('0x35')][_0x6331('0x19')]['originChannel']||_0x6331('0x60'),'ChatOfflineMessageId':_0x74999a[_0x6331('0x35')][_0x6331('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x6331('0x61')}]});})[_0x6331('0x12')](function(_0x32e626){_0x50eb9b['message']=_0x32e626;if(_0x50eb9b[_0x6331('0x58')]['UserId']){return db[_0x6331('0x62')][_0x6331('0x29')]({'attributes':['id',_0x6331('0x63')],'where':{'id':_0x50eb9b[_0x6331('0x58')][_0x6331('0x64')]}})[_0x6331('0x12')](function(_0x2038ac){if(_0x2038ac){_0x50eb9b['applications'][_0x6331('0x65')]({'id':0x0,'priority':0x0,'app':_0x6331('0x66'),'appdata':_0x2038ac[_0x6331('0x63')]+','+(_0x50eb9b['account'][_0x6331('0x67')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x50eb9b);});}return respondWithRpcPromise(_0x6331('0x68'),_0x6331('0x69'),_0x50eb9b);})[_0x6331('0x12')](function(_0x491d31){_0x18f368(_0x491d31);})[_0x6331('0x27')](function(_0x39ec75){_0x19982f(_0x18a6c3[_0x6331('0x17')](0x1f4,_0x39ec75[_0x6331('0x19')]));});});}; \ No newline at end of file +var _0x5c7a=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','stringify','ShowMailAccount','MailAccount','find','mail','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','format','MailInteraction','MailMessage','Messages','inReplyTo','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x315d84,_0x3dacc3){var _0x560da1=function(_0x22ccb0){while(--_0x22ccb0){_0x315d84['push'](_0x315d84['shift']());}};_0x560da1(++_0x3dacc3);}(_0x5c7a,0xca));var _0xa5c7=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x5c7a[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0xa5c7('0x0'));var util=require(_0xa5c7('0x1'));var moment=require(_0xa5c7('0x2'));var BPromise=require(_0xa5c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5c7('0x4'));var db=require(_0xa5c7('0x5'))['db'];var utils=require(_0xa5c7('0x6'));var logger=require(_0xa5c7('0x7'))('rpc');var config=require(_0xa5c7('0x8'));var jayson=require(_0xa5c7('0x9'));var client=jayson[_0xa5c7('0xa')][_0xa5c7('0xb')]({'port':0x232c});config[_0xa5c7('0xc')]=_[_0xa5c7('0xd')](config[_0xa5c7('0xc')],{'host':_0xa5c7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa5c7('0xf'))[_0xa5c7('0x10')](socket);function respondWithRpcPromise(_0x3a6da5,_0x2d1c50,_0xb51ae9){return new BPromise(function(_0x154e02,_0x554f21){return client['request'](_0x3a6da5,_0xb51ae9)['then'](function(_0x523b1c){logger[_0xa5c7('0x11')](_0xa5c7('0x12'),_0x2d1c50,'request\x20sent');logger[_0xa5c7('0x13')](_0xa5c7('0x14'),_0x2d1c50,_0xa5c7('0x15'),JSON['stringify'](_0x523b1c));if(_0x523b1c[_0xa5c7('0x16')]){if(_0x523b1c[_0xa5c7('0x16')][_0xa5c7('0x17')]===0x1f4){logger[_0xa5c7('0x16')](_0xa5c7('0x12'),_0x2d1c50,_0x523b1c[_0xa5c7('0x16')][_0xa5c7('0x18')]);return _0x554f21(_0x523b1c['error'][_0xa5c7('0x18')]);}logger[_0xa5c7('0x16')](_0xa5c7('0x12'),_0x2d1c50,_0x523b1c['error'][_0xa5c7('0x18')]);return _0x154e02(_0x523b1c[_0xa5c7('0x16')]['message']);}else{logger[_0xa5c7('0x11')](_0xa5c7('0x12'),_0x2d1c50,_0xa5c7('0x15'));_0x154e02(_0x523b1c[_0xa5c7('0x19')][_0xa5c7('0x18')]);}})[_0xa5c7('0x1a')](function(_0x407667){logger[_0xa5c7('0x16')](_0xa5c7('0x12'),_0x2d1c50,_0x407667);_0x554f21(_0x407667);});});}exports[_0xa5c7('0x1b')]=function(_0x25880f){var _0x1afc0c=this;return new Promise(function(_0x58f012,_0x41406d){return db['MailAccount'][_0xa5c7('0x1c')]({'raw':_0x25880f[_0xa5c7('0x1d')]?_0x25880f[_0xa5c7('0x1d')][_0xa5c7('0x1e')]===undefined?!![]:![]:!![],'where':_0x25880f[_0xa5c7('0x1d')]?_0x25880f[_0xa5c7('0x1d')][_0xa5c7('0x1f')]||null:null,'attributes':_0x25880f[_0xa5c7('0x1d')]?_0x25880f[_0xa5c7('0x1d')]['attributes']||null:null,'limit':_0x25880f[_0xa5c7('0x1d')]?_0x25880f[_0xa5c7('0x1d')][_0xa5c7('0x20')]||null:null,'include':_0x25880f[_0xa5c7('0x1d')]?_0x25880f[_0xa5c7('0x1d')]['include']?_['map'](_0x25880f[_0xa5c7('0x1d')][_0xa5c7('0x21')],function(_0x23ebe8){return{'model':db[_0x23ebe8['model']],'as':_0x23ebe8['as'],'attributes':_0x23ebe8['attributes'],'include':_0x23ebe8[_0xa5c7('0x21')]?_[_0xa5c7('0x22')](_0x23ebe8[_0xa5c7('0x21')],function(_0x5e453b){return{'model':db[_0x5e453b[_0xa5c7('0x23')]],'as':_0x5e453b['as'],'attributes':_0x5e453b['attributes'],'include':_0x5e453b['include']?_['map'](_0x5e453b['include'],function(_0x5aa168){return{'model':db[_0x5aa168[_0xa5c7('0x23')]],'as':_0x5aa168['as'],'attributes':_0x5aa168[_0xa5c7('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa5c7('0x25')](function(_0x554211){logger[_0xa5c7('0x11')](_0xa5c7('0x1b'),_0x25880f);logger[_0xa5c7('0x13')](_0xa5c7('0x1b'),_0x25880f,JSON[_0xa5c7('0x26')](_0x554211));_0x58f012(_0x554211);})[_0xa5c7('0x1a')](function(_0x508bc0){logger[_0xa5c7('0x16')]('GetMailAccount',_0x508bc0[_0xa5c7('0x18')],_0x25880f);_0x41406d(_0x1afc0c[_0xa5c7('0x16')](0x1f4,_0x508bc0[_0xa5c7('0x18')]));});});};exports[_0xa5c7('0x27')]=function(_0x14c18f){var _0x48b9d6=this;return new Promise(function(_0x5044ed,_0x5aaac3){return db[_0xa5c7('0x28')][_0xa5c7('0x29')]({'raw':_0x14c18f['options']?_0x14c18f[_0xa5c7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x14c18f[_0xa5c7('0x1d')]?_0x14c18f[_0xa5c7('0x1d')][_0xa5c7('0x1f')]||null:null,'attributes':_0x14c18f[_0xa5c7('0x1d')]?_0x14c18f[_0xa5c7('0x1d')][_0xa5c7('0x24')]||null:null,'include':_0x14c18f[_0xa5c7('0x1d')]?_0x14c18f['options']['include']?_['map'](_0x14c18f[_0xa5c7('0x1d')][_0xa5c7('0x21')],function(_0x12f049){return{'model':db[_0x12f049[_0xa5c7('0x23')]],'as':_0x12f049['as'],'attributes':_0x12f049[_0xa5c7('0x24')],'include':_0x12f049[_0xa5c7('0x21')]?_[_0xa5c7('0x22')](_0x12f049[_0xa5c7('0x21')],function(_0x42f2){return{'model':db[_0x42f2[_0xa5c7('0x23')]],'as':_0x42f2['as'],'attributes':_0x42f2['attributes'],'include':_0x42f2[_0xa5c7('0x21')]?_['map'](_0x42f2[_0xa5c7('0x21')],function(_0x5932b8){return{'model':db[_0x5932b8['model']],'as':_0x5932b8['as'],'attributes':_0x5932b8[_0xa5c7('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa5c7('0x25')](function(_0x277193){logger[_0xa5c7('0x11')](_0xa5c7('0x27'),_0x14c18f);logger['debug'](_0xa5c7('0x27'),_0x14c18f,JSON[_0xa5c7('0x26')](_0x277193));_0x5044ed(_0x277193);})[_0xa5c7('0x1a')](function(_0x54be0d){logger[_0xa5c7('0x16')]('ShowMailAccount',_0x54be0d[_0xa5c7('0x18')],_0x14c18f);_0x5aaac3(_0x48b9d6[_0xa5c7('0x16')](0x1f4,_0x54be0d[_0xa5c7('0x18')]));});});};exports['NotifyMailAccount']=function(_0x21b40f){var _0x39a696=this;return new Promise(function(_0x4daa50,_0x3b3f66){var _0x542050={'body':_0x21b40f['body'],'channel':_0xa5c7('0x2a')};var _0x1e605c=_[_0xa5c7('0x2b')](_['keys'](db[_0xa5c7('0x2c')][_0xa5c7('0x2d')]),[_0xa5c7('0x2e'),_0xa5c7('0x2f'),_0xa5c7('0x30'),_0xa5c7('0x31')]);var _0x3cc360=![];if(_0x21b40f['body']['id']){delete _0x21b40f[_0xa5c7('0x32')]['id'];}if(_['isNil'](_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x33')])){return _0x3b3f66(_0x39a696[_0xa5c7('0x16')](0x1f4,_0xa5c7('0x34')));}if(_['isNil'](_0x21b40f['body'][_0xa5c7('0x32')])||_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x32')]===''){return _0x3b3f66(_0x39a696[_0xa5c7('0x16')](0x1f4,_0xa5c7('0x35')));}if(_['isNil'](_0x21b40f['body'][_0xa5c7('0x36')])){return _0x3b3f66(_0x39a696[_0xa5c7('0x16')](0x1f4,_0xa5c7('0x37')+_0x1e605c));}if(!_[_0xa5c7('0x38')](_0x1e605c,_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x36')])){return _0x3b3f66(_0x39a696[_0xa5c7('0x16')](0x1f4,_0xa5c7('0x39')+_0x1e605c));}var _0xdcfd7c={};_0xdcfd7c[_0x21b40f[_0xa5c7('0x32')]['mapKey']]=_0x21b40f['body'][_0xa5c7('0x33')];return db['MailAccount'][_0xa5c7('0x29')]({'where':{'id':_0x21b40f[_0xa5c7('0x3a')]['id']},'include':[{'model':db[_0xa5c7('0x3b')],'as':_0xa5c7('0x3c'),'include':[{'model':db[_0xa5c7('0x2c')],'as':_0xa5c7('0x3d'),'where':_0xdcfd7c,'limit':0x1,'order':[[_0xa5c7('0x2f'),'DESC']]}]},{'model':db[_0xa5c7('0x3e')],'as':_0xa5c7('0x3f')},{'model':db[_0xa5c7('0x40')],'as':_0xa5c7('0x41')}]})[_0xa5c7('0x25')](function(_0x1a25a3){if(_0x1a25a3&&_0x1a25a3[_0xa5c7('0x3c')]){var _0x4259f0=_0x1a25a3[_0xa5c7('0x42')]({'plain':!![]});_0x542050[_0xa5c7('0x3a')]=_[_0xa5c7('0x43')](_0x4259f0,[_0xa5c7('0x3f'),_0xa5c7('0x3c')]);_0x542050[_0xa5c7('0x44')]=_0x4259f0['Applications'];_0x542050['list']=_0x4259f0[_0xa5c7('0x3c')];_0x542050[_0xa5c7('0x44')]=_[_0xa5c7('0x45')](_0x542050[_0xa5c7('0x44')],[_0xa5c7('0x46')],[_0xa5c7('0x47')]);if(_0x542050['account']&&_0x542050[_0xa5c7('0x3a')][_0xa5c7('0x48')]){_0x542050[_0xa5c7('0x44')][_0xa5c7('0x49')]({'id':0x0,'priority':_0x542050[_0xa5c7('0x44')][_0xa5c7('0x4a')]+0x1,'app':'close','appdata':_0xa5c7('0x48'),'interval':_0xa5c7('0x4b')});}if(_0x542050[_0xa5c7('0x3a')][_0xa5c7('0x3f')]){delete _0x542050[_0xa5c7('0x3a')][_0xa5c7('0x3f')];}if(_0x542050[_0xa5c7('0x3a')][_0xa5c7('0x3c')]){delete _0x542050[_0xa5c7('0x3a')][_0xa5c7('0x3c')];}if(_0x4259f0[_0xa5c7('0x3c')][_0xa5c7('0x3d')][_0xa5c7('0x4a')]){return _0x4259f0[_0xa5c7('0x3c')][_0xa5c7('0x3d')][0x0];}var _0x4ae0ab=_[_0xa5c7('0xd')](_0x21b40f['body'],{'firstName':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x33')],'ListId':_0x4259f0[_0xa5c7('0x31')]});_0x4ae0ab[_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x36')]]=_0x21b40f['body'][_0xa5c7('0x33')];return db[_0xa5c7('0x2c')][_0xa5c7('0x4c')](_0x4ae0ab);}else{throw new Error(_0xa5c7('0x4d'));}})[_0xa5c7('0x25')](function(_0x4a0c70){_0x542050['contact']=_0x4a0c70;if(_0x4a0c70){if(!_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x4e')]){_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')]['messageId']=rs[_0xa5c7('0x4f')]()+'\x20'+_0x21b40f[_0xa5c7('0x32')]['message'][_0xa5c7('0x33')];}var _0x513f9d={'ContactId':_0x4a0c70['id'],'MailAccountId':_0x21b40f[_0xa5c7('0x3a')]['id'],'inReplyTo':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')]['messageId'],'to':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x33')],'cc':_0x21b40f['body']['message']['cc'],'subject':_0x21b40f[_0xa5c7('0x32')]['message'][_0xa5c7('0x50')],'attach':_0x21b40f[_0xa5c7('0x32')]['message']['attach'],'lastMsgAt':moment()[_0xa5c7('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xa5c7('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x21b40f[_0xa5c7('0x3a')]['id']},'include':[{'model':db[_0xa5c7('0x53')],'as':_0xa5c7('0x54'),'attributes':[_0xa5c7('0x4e')],'where':{'messageId':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x55')]}}]})[_0xa5c7('0x25')](function(_0x265b5f){if(_0x265b5f){return[_0x265b5f,![]];}return db[_0xa5c7('0x52')][_0xa5c7('0x4c')](_0x513f9d)['then'](function(_0x385a91){return[_0x385a91,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x257f2b,_0x341954){if(_0x257f2b){_0x3cc360=_0x341954;if(!_0x341954){return _0x257f2b[_0xa5c7('0x56')]({'inReplyTo':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x4e')],'to':_0x21b40f[_0xa5c7('0x32')]['message'][_0xa5c7('0x33')],'cc':_0x21b40f['body']['message']['cc'],'subject':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')]['subject'],'attach':_0x257f2b[_0xa5c7('0x57')]?_0x257f2b['attach']:_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x57')],'substatus':null,'substatusAt':moment()[_0xa5c7('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xa5c7('0x51')](_0xa5c7('0x58')),'lastMsgDirection':'in'});}else{return _0x257f2b;}}})[_0xa5c7('0x25')](function(_0x3eb0b9){_0x542050['interaction']=_0x3eb0b9[_0xa5c7('0x42')]({'plain':!![]});_0x542050[_0xa5c7('0x59')]['created']=_0x3cc360;return db[_0xa5c7('0x53')][_0xa5c7('0x4c')]({'body':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x32')],'MailAccountId':_0x21b40f['account']['id'],'MailInteractionId':_0x3eb0b9['id'],'direction':'in','ContactId':_0x542050[_0xa5c7('0x5a')]['id'],'messageId':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x4e')],'from':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x33')],'to':_0x21b40f[_0xa5c7('0x32')]['message']['to'],'cc':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')]['cc'],'subject':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x50')],'attach':_0x21b40f['body'][_0xa5c7('0x18')][_0xa5c7('0x57')],'Attachments':_0x21b40f['body'][_0xa5c7('0x18')]['attachments'],'originTo':_0x21b40f['body']['message'][_0xa5c7('0x5b')],'originCc':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x5c')],'bcc':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x5d')],'ChatWebsiteId':_0x21b40f[_0xa5c7('0x32')][_0xa5c7('0x18')][_0xa5c7('0x5e')]||null,'originChannel':_0x21b40f['body'][_0xa5c7('0x18')][_0xa5c7('0x5f')]||_0xa5c7('0x60'),'ChatOfflineMessageId':_0x21b40f[_0xa5c7('0x32')]['message'][_0xa5c7('0x61')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0xa5c7('0x25')](function(_0x2635d6){_0x542050[_0xa5c7('0x18')]=_0x2635d6;if(_0x542050[_0xa5c7('0x59')][_0xa5c7('0x62')]){return db[_0xa5c7('0x63')][_0xa5c7('0x29')]({'attributes':['id',_0xa5c7('0x64')],'where':{'id':_0x542050[_0xa5c7('0x59')]['UserId']}})['then'](function(_0x2da455){if(_0x2da455){_0x542050[_0xa5c7('0x44')][_0xa5c7('0x65')]({'id':0x0,'priority':0x0,'app':_0xa5c7('0x66'),'appdata':_0x2da455[_0xa5c7('0x64')]+','+(_0x542050[_0xa5c7('0x3a')][_0xa5c7('0x67')]||0xa),'interval':_0xa5c7('0x4b')});}return respondWithRpcPromise(_0xa5c7('0x68'),'startRouting',_0x542050);});}return respondWithRpcPromise('Start','startRouting',_0x542050);})[_0xa5c7('0x25')](function(_0x367c48){_0x4daa50(_0x367c48);})[_0xa5c7('0x1a')](function(_0x8acb1d){_0x3b3f66(_0x39a696[_0xa5c7('0x16')](0x1f4,_0x8acb1d[_0xa5c7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 4ead90e..47cbbeb 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 _0x13fe=['update','emit','removeListener','register','./mailAccount.events','save','remove'];(function(_0x47f9d1,_0x3f9922){var _0x3fe0b7=function(_0x1add18){while(--_0x1add18){_0x47f9d1['push'](_0x47f9d1['shift']());}};_0x3fe0b7(++_0x3f9922);}(_0x13fe,0x138));var _0xe13f=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x13fe[_0x13ea00];return _0x1f7347;};'use strict';var MailAccountEvents=require(_0xe13f('0x0'));var events=[_0xe13f('0x1'),_0xe13f('0x2'),_0xe13f('0x3')];function createListener(_0x329355,_0x2efd00){return function(_0x5f0bd1){_0x2efd00[_0xe13f('0x4')](_0x329355,_0x5f0bd1);};}function removeListener(_0x466eee,_0x19c559){return function(){MailAccountEvents[_0xe13f('0x5')](_0x466eee,_0x19c559);};}exports[_0xe13f('0x6')]=function(_0x1ddbff){for(var _0x2832ce=0x0,_0x594e3b=events['length'];_0x2832ce<_0x594e3b;_0x2832ce++){var _0x1b237d=events[_0x2832ce];var _0x39a413=createListener('mailAccount:'+_0x1b237d,_0x1ddbff);MailAccountEvents['on'](_0x1b237d,_0x39a413);}}; \ No newline at end of file +var _0xf4d9=['remove','update','removeListener','mailAccount:','./mailAccount.events'];(function(_0x2b2007,_0xb700f6){var _0x362550=function(_0x29c1d3){while(--_0x29c1d3){_0x2b2007['push'](_0x2b2007['shift']());}};_0x362550(++_0xb700f6);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x5ea2e9,_0x320c87){_0x5ea2e9=_0x5ea2e9-0x0;var _0xa1da5=_0xf4d9[_0x5ea2e9];return _0xa1da5;};'use strict';var MailAccountEvents=require(_0x9f4d('0x0'));var events=['save',_0x9f4d('0x1'),_0x9f4d('0x2')];function createListener(_0x35fa60,_0x41bd00){return function(_0x22339e){_0x41bd00['emit'](_0x35fa60,_0x22339e);};}function removeListener(_0x179d90,_0x9ee061){return function(){MailAccountEvents[_0x9f4d('0x3')](_0x179d90,_0x9ee061);};}exports['register']=function(_0x191f1c){for(var _0x370059=0x0,_0x2d7228=events['length'];_0x370059<_0x2d7228;_0x370059++){var _0x415499=events[_0x370059];var _0x55865b=createListener(_0x9f4d('0x4')+_0x415499,_0x191f1c);MailAccountEvents['on'](_0x415499,_0x55865b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cb0ed72..f75c4d0 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 _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','/:id','update','delete','destroy'];(function(_0x5524a4,_0x335747){var _0x53469d=function(_0x470184){while(--_0x470184){_0x5524a4['push'](_0x5524a4['shift']());}};_0x53469d(++_0x335747);}(_0x1261,0x144));var _0x1126=function(_0x591781,_0x8e0ed2){_0x591781=_0x591781-0x0;var _0x315bd9=_0x1261[_0x591781];return _0x315bd9;};'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 fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/:id',auth[_0x1126('0xa')](),controller[_0x1126('0xb')]);router['put'](_0x1126('0xc'),auth[_0x1126('0xa')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')](_0x1126('0xc'),auth['isAuthenticated'](),controller[_0x1126('0xf')]);module[_0x1126('0x10')]=router; \ No newline at end of file +var _0x2ef3=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','show','put'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e48ae,_0x55acfb){_0x5e48ae=_0x5e48ae-0x0;var _0x5aa218=_0x2ef3[_0x5e48ae];return _0x5aa218;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0xc'),auth[_0x32ef('0xd')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xc'),auth[_0x32ef('0xd')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 2e4435a..e8c3484 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 _0xe07e=['*,*,*,*','INTEGER','STRING','noop','TEXT'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe07e,0xdd));var _0xee07=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0xe07e[_0x57966a];return _0x191765;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xee07('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xee07('0x1')],'allowNull':![],'defaultValue':_0xee07('0x2')},'appdata':{'type':Sequelize[_0xee07('0x3')]()},'description':{'type':Sequelize[_0xee07('0x1')]},'interval':{'type':Sequelize[_0xee07('0x1')],'defaultValue':_0xee07('0x4')}}; \ No newline at end of file +var _0x918c=['*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x918c,0xa6));var _0xc918=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x918c[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0xc918('0x0')]={'priority':{'type':Sequelize[_0xc918('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc918('0x2')],'allowNull':![],'defaultValue':_0xc918('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc918('0x2')]},'interval':{'type':Sequelize[_0xc918('0x2')],'defaultValue':_0xc918('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6b99636..550d728 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 _0x9e56=['filters','intersection','model','fields','attributes','length','include','merge','options','catch','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','keys','MailApplication','rawAttributes','query'];(function(_0x194c84,_0xd0086a){var _0x5a0899=function(_0x45ba39){while(--_0x45ba39){_0x194c84['push'](_0x194c84['shift']());}};_0x5a0899(++_0xd0086a);}(_0x9e56,0x16e));var _0x69e5=function(_0x499eaf,_0x560a5a){_0x499eaf=_0x499eaf-0x0;var _0x2fa121=_0x9e56[_0x499eaf];return _0x2fa121;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x69e5('0x0'));var rp=require(_0x69e5('0x1'));var moment=require(_0x69e5('0x2'));var BPromise=require(_0x69e5('0x3'));var Mustache=require(_0x69e5('0x4'));var util=require(_0x69e5('0x5'));var path=require('path');var sox=require(_0x69e5('0x6'));var csv=require('to-csv');var ejs=require(_0x69e5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69e5('0x8'));var squel=require(_0x69e5('0x9'));var crypto=require(_0x69e5('0xa'));var jsforce=require(_0x69e5('0xb'));var deskjs=require(_0x69e5('0xc'));var toCsv=require(_0x69e5('0xd'));var querystring=require(_0x69e5('0xe'));var Papa=require('papaparse');var Redis=require(_0x69e5('0xf'));var authService=require(_0x69e5('0x10'));var qs=require(_0x69e5('0x11'));var as=require(_0x69e5('0x12'));var hardwareService=require(_0x69e5('0x13'));var logger=require('../../config/logger')(_0x69e5('0x14'));var utils=require(_0x69e5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x69e5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aa404,_0xca6555){_0xca6555=_0xca6555||0xcc;return function(_0x4bce39){if(_0x4bce39){return _0x5aa404['sendStatus'](_0xca6555);}return _0x5aa404[_0x69e5('0x17')](_0xca6555)[_0x69e5('0x18')]();};}function respondWithResult(_0x323c3d,_0x1ade13){_0x1ade13=_0x1ade13||0xc8;return function(_0x112b81){if(_0x112b81){return _0x323c3d[_0x69e5('0x17')](_0x1ade13)[_0x69e5('0x19')](_0x112b81);}};}function respondWithFilteredResult(_0x3dad4a,_0xa358c7){return function(_0x11e668){if(_0x11e668){var _0x47fdd7=typeof _0xa358c7[_0x69e5('0x1a')]==='undefined'&&typeof _0xa358c7[_0x69e5('0x1b')]===_0x69e5('0x1c');var _0x557c88=_0x11e668[_0x69e5('0x1d')];var _0xb0d89f=_0x47fdd7?0x0:_0xa358c7[_0x69e5('0x1a')];var _0x2cd94e=_0x47fdd7?_0x11e668[_0x69e5('0x1d')]:_0xa358c7[_0x69e5('0x1a')]+_0xa358c7[_0x69e5('0x1b')];var _0x36367c;if(_0x2cd94e>=_0x557c88){_0x2cd94e=_0x557c88;_0x36367c=0xc8;}else{_0x36367c=0xce;}_0x3dad4a[_0x69e5('0x17')](_0x36367c);return _0x3dad4a['set'](_0x69e5('0x1e'),_0xb0d89f+'-'+_0x2cd94e+'/'+_0x557c88)[_0x69e5('0x19')](_0x11e668);}return null;};}function patchUpdates(_0x2b8d99){return function(_0x37d10b){try{jsonpatch[_0x69e5('0x1f')](_0x37d10b,_0x2b8d99,!![]);}catch(_0x542574){return BPromise['reject'](_0x542574);}return _0x37d10b[_0x69e5('0x20')]();};}function saveUpdates(_0x5388d0,_0x1bf123){return function(_0x1e6b84){if(_0x1e6b84){return _0x1e6b84[_0x69e5('0x21')](_0x5388d0)[_0x69e5('0x22')](function(_0x54598c){return _0x54598c;});}return null;};}function removeEntity(_0x331a66,_0x3786c6){return function(_0x151a48){if(_0x151a48){return _0x151a48[_0x69e5('0x23')]()[_0x69e5('0x22')](function(){_0x331a66[_0x69e5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a75b,_0x1e7c0a){return function(_0x275642){if(!_0x275642){_0x39a75b[_0x69e5('0x24')](0x194);}return _0x275642;};}function handleError(_0x1ab063,_0x25ae3e){_0x25ae3e=_0x25ae3e||0x1f4;return function(_0x5a7136){logger[_0x69e5('0x25')](_0x5a7136[_0x69e5('0x26')]);if(_0x5a7136[_0x69e5('0x27')]){delete _0x5a7136[_0x69e5('0x27')];}_0x1ab063['status'](_0x25ae3e)[_0x69e5('0x28')](_0x5a7136);};}exports[_0x69e5('0x29')]=function(_0x16dbba,_0x16aea0){var _0x12ad3d={'raw':!![],'where':{'id':_0x16dbba[_0x69e5('0x2a')]['id']}},_0x1972a8={};_0x1972a8['model']=_[_0x69e5('0x2b')](db[_0x69e5('0x2c')][_0x69e5('0x2d')]);_0x1972a8[_0x69e5('0x2e')]=_[_0x69e5('0x2b')](_0x16dbba[_0x69e5('0x2e')]);_0x1972a8[_0x69e5('0x2f')]=_[_0x69e5('0x30')](_0x1972a8[_0x69e5('0x31')],_0x1972a8[_0x69e5('0x2e')]);_0x12ad3d['attributes']=_[_0x69e5('0x30')](_0x1972a8['model'],qs[_0x69e5('0x32')](_0x16dbba[_0x69e5('0x2e')]['fields']));_0x12ad3d[_0x69e5('0x33')]=_0x12ad3d['attributes'][_0x69e5('0x34')]?_0x12ad3d[_0x69e5('0x33')]:_0x1972a8['model'];if(_0x16dbba['query']['includeAll']){_0x12ad3d[_0x69e5('0x35')]=[{'all':!![]}];}_0x12ad3d=_[_0x69e5('0x36')]({},_0x12ad3d,_0x16dbba[_0x69e5('0x37')]);return db[_0x69e5('0x2c')]['find'](_0x12ad3d)[_0x69e5('0x22')](handleEntityNotFound(_0x16aea0,null))[_0x69e5('0x22')](respondWithResult(_0x16aea0,null))[_0x69e5('0x38')](handleError(_0x16aea0,null));};exports[_0x69e5('0x21')]=function(_0x1d37ba,_0x399d11){if(_0x1d37ba['body']['id']){delete _0x1d37ba[_0x69e5('0x39')]['id'];}return db[_0x69e5('0x2c')][_0x69e5('0x3a')]({'where':{'id':_0x1d37ba['params']['id']}})[_0x69e5('0x22')](handleEntityNotFound(_0x399d11,null))['then'](saveUpdates(_0x1d37ba[_0x69e5('0x39')],null))[_0x69e5('0x22')](respondWithResult(_0x399d11,null))[_0x69e5('0x38')](handleError(_0x399d11,null));};exports[_0x69e5('0x23')]=function(_0x2aa367,_0x2005e3){return db['MailApplication'][_0x69e5('0x3a')]({'where':{'id':_0x2aa367[_0x69e5('0x2a')]['id']}})[_0x69e5('0x22')](handleEntityNotFound(_0x2005e3,null))[_0x69e5('0x22')](removeEntity(_0x2005e3,null))[_0x69e5('0x38')](handleError(_0x2005e3,null));}; \ No newline at end of file +var _0xe504=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','MailApplication','find','catch','body','params','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status'];(function(_0x227465,_0x4066c4){var _0xa1a432=function(_0x509038){while(--_0x509038){_0x227465['push'](_0x227465['shift']());}};_0xa1a432(++_0x4066c4);}(_0xe504,0xc0));var _0x4e50=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe504[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e50('0x0'));var zipdir=require(_0x4e50('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e50('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e50('0x3'));var util=require('util');var path=require(_0x4e50('0x4'));var sox=require(_0x4e50('0x5'));var csv=require(_0x4e50('0x6'));var ejs=require(_0x4e50('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e50('0x8'));var squel=require('squel');var crypto=require(_0x4e50('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4e50('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4e50('0xb'));var Papa=require(_0x4e50('0xc'));var Redis=require('ioredis');var authService=require(_0x4e50('0xd'));var qs=require(_0x4e50('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e50('0xf'));var logger=require(_0x4e50('0x10'))(_0x4e50('0x11'));var utils=require('../../config/utils');var config=require(_0x4e50('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e50('0x13'))['db'];function respondWithStatusCode(_0x2b24e9,_0x5d009b){_0x5d009b=_0x5d009b||0xcc;return function(_0x382181){if(_0x382181){return _0x2b24e9[_0x4e50('0x14')](_0x5d009b);}return _0x2b24e9['status'](_0x5d009b)[_0x4e50('0x15')]();};}function respondWithResult(_0x5ec20c,_0x2fd0a4){_0x2fd0a4=_0x2fd0a4||0xc8;return function(_0x1048f0){if(_0x1048f0){return _0x5ec20c['status'](_0x2fd0a4)[_0x4e50('0x16')](_0x1048f0);}};}function respondWithFilteredResult(_0x32c90d,_0x491bfb){return function(_0x12bf3d){if(_0x12bf3d){var _0x2d71ef=typeof _0x491bfb[_0x4e50('0x17')]===_0x4e50('0x18')&&typeof _0x491bfb[_0x4e50('0x19')]===_0x4e50('0x18');var _0x103d14=_0x12bf3d[_0x4e50('0x1a')];var _0x358627=_0x2d71ef?0x0:_0x491bfb[_0x4e50('0x17')];var _0x367122=_0x2d71ef?_0x12bf3d['count']:_0x491bfb[_0x4e50('0x17')]+_0x491bfb['limit'];var _0x39dd32;if(_0x367122>=_0x103d14){_0x367122=_0x103d14;_0x39dd32=0xc8;}else{_0x39dd32=0xce;}_0x32c90d[_0x4e50('0x1b')](_0x39dd32);return _0x32c90d['set'](_0x4e50('0x1c'),_0x358627+'-'+_0x367122+'/'+_0x103d14)[_0x4e50('0x16')](_0x12bf3d);}return null;};}function patchUpdates(_0x121a14){return function(_0x147d58){try{jsonpatch[_0x4e50('0x1d')](_0x147d58,_0x121a14,!![]);}catch(_0x3cd67a){return BPromise[_0x4e50('0x1e')](_0x3cd67a);}return _0x147d58[_0x4e50('0x1f')]();};}function saveUpdates(_0x2aeee7,_0x3f4dfc){return function(_0x203344){if(_0x203344){return _0x203344[_0x4e50('0x20')](_0x2aeee7)[_0x4e50('0x21')](function(_0x1c5531){return _0x1c5531;});}return null;};}function removeEntity(_0x1d6b16,_0x33d244){return function(_0x515300){if(_0x515300){return _0x515300[_0x4e50('0x22')]()[_0x4e50('0x21')](function(){_0x1d6b16[_0x4e50('0x1b')](0xcc)[_0x4e50('0x15')]();});}};}function handleEntityNotFound(_0x5a9f0c,_0x1e95f6){return function(_0x2e34bc){if(!_0x2e34bc){_0x5a9f0c[_0x4e50('0x14')](0x194);}return _0x2e34bc;};}function handleError(_0x2feb0b,_0x1f50c8){_0x1f50c8=_0x1f50c8||0x1f4;return function(_0x5622dd){logger[_0x4e50('0x23')](_0x5622dd[_0x4e50('0x24')]);if(_0x5622dd[_0x4e50('0x25')]){delete _0x5622dd[_0x4e50('0x25')];}_0x2feb0b[_0x4e50('0x1b')](_0x1f50c8)[_0x4e50('0x26')](_0x5622dd);};}exports[_0x4e50('0x27')]=function(_0x4ee10c,_0x14d906){var _0x282697={'raw':!![],'where':{'id':_0x4ee10c['params']['id']}},_0x776d41={};_0x776d41[_0x4e50('0x28')]=_[_0x4e50('0x29')](db['MailApplication'][_0x4e50('0x2a')]);_0x776d41[_0x4e50('0x2b')]=_[_0x4e50('0x29')](_0x4ee10c[_0x4e50('0x2b')]);_0x776d41[_0x4e50('0x2c')]=_[_0x4e50('0x2d')](_0x776d41[_0x4e50('0x28')],_0x776d41[_0x4e50('0x2b')]);_0x282697[_0x4e50('0x2e')]=_[_0x4e50('0x2d')](_0x776d41[_0x4e50('0x28')],qs[_0x4e50('0x2f')](_0x4ee10c[_0x4e50('0x2b')][_0x4e50('0x2f')]));_0x282697['attributes']=_0x282697[_0x4e50('0x2e')][_0x4e50('0x30')]?_0x282697[_0x4e50('0x2e')]:_0x776d41[_0x4e50('0x28')];if(_0x4ee10c[_0x4e50('0x2b')]['includeAll']){_0x282697['include']=[{'all':!![]}];}_0x282697=_['merge']({},_0x282697,_0x4ee10c[_0x4e50('0x31')]);return db[_0x4e50('0x32')][_0x4e50('0x33')](_0x282697)['then'](handleEntityNotFound(_0x14d906,null))[_0x4e50('0x21')](respondWithResult(_0x14d906,null))[_0x4e50('0x34')](handleError(_0x14d906,null));};exports['update']=function(_0x521ded,_0x29589c){if(_0x521ded[_0x4e50('0x35')]['id']){delete _0x521ded['body']['id'];}return db[_0x4e50('0x32')][_0x4e50('0x33')]({'where':{'id':_0x521ded[_0x4e50('0x36')]['id']}})['then'](handleEntityNotFound(_0x29589c,null))['then'](saveUpdates(_0x521ded[_0x4e50('0x35')],null))['then'](respondWithResult(_0x29589c,null))[_0x4e50('0x34')](handleError(_0x29589c,null));};exports[_0x4e50('0x22')]=function(_0x5ad48d,_0x1bdb17){return db[_0x4e50('0x32')][_0x4e50('0x33')]({'where':{'id':_0x5ad48d[_0x4e50('0x36')]['id']}})[_0x4e50('0x21')](handleEntityNotFound(_0x1bdb17,null))[_0x4e50('0x21')](removeEntity(_0x1bdb17,null))['catch'](handleError(_0x1bdb17,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4e3e325..197b3ed 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 _0x3419=['api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x30acd4,_0x53f020){var _0x245d4b=function(_0x301312){while(--_0x301312){_0x30acd4['push'](_0x30acd4['shift']());}};_0x245d4b(++_0x53f020);}(_0x3419,0xb3));var _0x9341=function(_0x4d515d,_0x108c96){_0x4d515d=_0x4d515d-0x0;var _0x58fe07=_0x3419[_0x4d515d];return _0x58fe07;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var logger=require(_0x9341('0x2'))(_0x9341('0x3'));var moment=require(_0x9341('0x4'));var BPromise=require('bluebird');var rp=require(_0x9341('0x5'));var fs=require('fs');var path=require(_0x9341('0x6'));var rimraf=require(_0x9341('0x7'));var config=require(_0x9341('0x8'));var attributes=require(_0x9341('0x9'));module['exports']=function(_0xa36232,_0x204ee){return _0xa36232['define'](_0x9341('0xa'),attributes,{'tableName':_0x9341('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9341('0xc'),'collate':_0x9341('0xd')});}; \ No newline at end of file +var _0x659c=['path','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','lodash','api','moment','request-promise'];(function(_0x22e41a,_0x4d7954){var _0x58ca73=function(_0x2a5e16){while(--_0x2a5e16){_0x22e41a['push'](_0x22e41a['shift']());}};_0x58ca73(++_0x4d7954);}(_0x659c,0x1aa));var _0xc659=function(_0x12939d,_0x24971d){_0x12939d=_0x12939d-0x0;var _0x38f9ab=_0x659c[_0x12939d];return _0x38f9ab;};'use strict';var _=require(_0xc659('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc659('0x1'));var moment=require(_0xc659('0x2'));var BPromise=require('bluebird');var rp=require(_0xc659('0x3'));var fs=require('fs');var path=require(_0xc659('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc659('0x5'));module[_0xc659('0x6')]=function(_0x369dc0,_0x312440){return _0x369dc0[_0xc659('0x7')](_0xc659('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc659('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 150359c..a6dc595 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 _0x3ff4=['update','body','options','raw','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x3ff4,0xd2));var _0x43ff=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x3ff4[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x43ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x43ff('0x1'));var rs=require(_0x43ff('0x2'));var fs=require('fs');var Redis=require(_0x43ff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x43ff('0x4'));var logger=require(_0x43ff('0x5'))(_0x43ff('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x43ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c1499,_0x5719fb,_0x3fc35f){return new BPromise(function(_0x3955e4,_0x300352){return client['request'](_0x1c1499,_0x3fc35f)[_0x43ff('0x8')](function(_0x5a1245){logger[_0x43ff('0x9')](_0x43ff('0xa'),_0x5719fb,_0x43ff('0xb'));logger[_0x43ff('0xc')](_0x43ff('0xd'),_0x5719fb,'request\x20sent',JSON[_0x43ff('0xe')](_0x5a1245));if(_0x5a1245[_0x43ff('0xf')]){if(_0x5a1245['error'][_0x43ff('0x10')]===0x1f4){logger[_0x43ff('0xf')](_0x43ff('0xa'),_0x5719fb,_0x5a1245[_0x43ff('0xf')][_0x43ff('0x11')]);return _0x300352(_0x5a1245['error'][_0x43ff('0x11')]);}logger[_0x43ff('0xf')](_0x43ff('0xa'),_0x5719fb,_0x5a1245[_0x43ff('0xf')][_0x43ff('0x11')]);return _0x3955e4(_0x5a1245[_0x43ff('0xf')]['message']);}else{logger[_0x43ff('0x9')](_0x43ff('0xa'),_0x5719fb,'request\x20sent');_0x3955e4(_0x5a1245[_0x43ff('0x12')][_0x43ff('0x11')]);}})[_0x43ff('0x13')](function(_0x56fe0b){logger[_0x43ff('0xf')](_0x43ff('0xa'),_0x5719fb,_0x56fe0b);_0x300352(_0x56fe0b);});});}exports[_0x43ff('0x14')]=function(_0x3bdb85){var _0x56bfdb=this;return new Promise(function(_0xf0c4a5,_0x1f100c){return db[_0x43ff('0x15')][_0x43ff('0x16')](_0x3bdb85[_0x43ff('0x17')],{'raw':_0x3bdb85['options']?_0x3bdb85[_0x43ff('0x18')][_0x43ff('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bdb85[_0x43ff('0x18')]?_0x3bdb85[_0x43ff('0x18')][_0x43ff('0x1a')]||null:null,'attributes':_0x3bdb85[_0x43ff('0x18')]?_0x3bdb85[_0x43ff('0x18')][_0x43ff('0x1b')]||null:null,'limit':_0x3bdb85['options']?_0x3bdb85[_0x43ff('0x18')][_0x43ff('0x1c')]||null:null})['then'](function(_0x179d6a){logger[_0x43ff('0x9')]('UpdateMailApplication',_0x3bdb85);logger[_0x43ff('0xc')](_0x43ff('0x14'),_0x3bdb85,JSON[_0x43ff('0xe')](_0x179d6a));_0xf0c4a5(_0x179d6a);})[_0x43ff('0x13')](function(_0x1278c4){logger[_0x43ff('0xf')]('UpdateMailApplication',_0x1278c4['message'],_0x3bdb85);_0x1f100c(_0x56bfdb[_0x43ff('0xf')](0x1f4,_0x1278c4['message']));});});}; \ No newline at end of file +var _0x95eb=['options','raw','attributes','limit','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','update'];(function(_0x1fda18,_0x4d089e){var _0x298e9f=function(_0x356278){while(--_0x356278){_0x1fda18['push'](_0x1fda18['shift']());}};_0x298e9f(++_0x4d089e);}(_0x95eb,0x1d8));var _0xb95e=function(_0x4f857f,_0x3f2bf6){_0x4f857f=_0x4f857f-0x0;var _0x4d008e=_0x95eb[_0x4f857f];return _0x4d008e;};'use strict';var _=require(_0xb95e('0x0'));var util=require(_0xb95e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb95e('0x2'));var db=require(_0xb95e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb95e('0x4'))(_0xb95e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb95e('0x6')][_0xb95e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43d2d8,_0x2461c6,_0x345c3d){return new BPromise(function(_0x52ec08,_0x36d48f){return client[_0xb95e('0x8')](_0x43d2d8,_0x345c3d)[_0xb95e('0x9')](function(_0x1baf9e){logger[_0xb95e('0xa')]('MailApplication,\x20%s,\x20%s',_0x2461c6,_0xb95e('0xb'));logger['debug'](_0xb95e('0xc'),_0x2461c6,_0xb95e('0xb'),JSON[_0xb95e('0xd')](_0x1baf9e));if(_0x1baf9e['error']){if(_0x1baf9e[_0xb95e('0xe')][_0xb95e('0xf')]===0x1f4){logger[_0xb95e('0xe')](_0xb95e('0x10'),_0x2461c6,_0x1baf9e[_0xb95e('0xe')][_0xb95e('0x11')]);return _0x36d48f(_0x1baf9e[_0xb95e('0xe')]['message']);}logger[_0xb95e('0xe')]('MailApplication,\x20%s,\x20%s',_0x2461c6,_0x1baf9e['error'][_0xb95e('0x11')]);return _0x52ec08(_0x1baf9e[_0xb95e('0xe')][_0xb95e('0x11')]);}else{logger['info'](_0xb95e('0x10'),_0x2461c6,_0xb95e('0xb'));_0x52ec08(_0x1baf9e[_0xb95e('0x12')][_0xb95e('0x11')]);}})[_0xb95e('0x13')](function(_0x30f7ef){logger[_0xb95e('0xe')](_0xb95e('0x10'),_0x2461c6,_0x30f7ef);_0x36d48f(_0x30f7ef);});});}exports[_0xb95e('0x14')]=function(_0x1006ab){var _0x280df3=this;return new Promise(function(_0x1abe7d,_0x3ebe03){return db['MailApplication'][_0xb95e('0x15')](_0x1006ab['body'],{'raw':_0x1006ab[_0xb95e('0x16')]?_0x1006ab[_0xb95e('0x16')][_0xb95e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1006ab['options']?_0x1006ab[_0xb95e('0x16')]['where']||null:null,'attributes':_0x1006ab[_0xb95e('0x16')]?_0x1006ab[_0xb95e('0x16')][_0xb95e('0x18')]||null:null,'limit':_0x1006ab[_0xb95e('0x16')]?_0x1006ab[_0xb95e('0x16')][_0xb95e('0x19')]||null:null})[_0xb95e('0x9')](function(_0x2e8e7d){logger[_0xb95e('0xa')]('UpdateMailApplication',_0x1006ab);logger['debug'](_0xb95e('0x14'),_0x1006ab,JSON[_0xb95e('0xd')](_0x2e8e7d));_0x1abe7d(_0x2e8e7d);})[_0xb95e('0x13')](function(_0x24501b){logger['error'](_0xb95e('0x14'),_0x24501b['message'],_0x1006ab);_0x3ebe03(_0x280df3['error'](0x1f4,_0x24501b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 4ec13cb..e25aa23 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 _0xc17e=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','exports','util'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xc17e,0xc3));var _0xec17=function(_0x496cdc,_0x9d6db3){_0x496cdc=_0x496cdc-0x0;var _0x103a8e=_0xc17e[_0x496cdc];return _0x103a8e;};'use strict';var multer=require('multer');var util=require(_0xec17('0x0'));var path=require(_0xec17('0x1'));var timeout=require('connect-timeout');var express=require(_0xec17('0x2'));var router=express[_0xec17('0x3')]();var fs_extra=require(_0xec17('0x4'));var auth=require(_0xec17('0x5'));var interaction=require(_0xec17('0x6'));var config=require(_0xec17('0x7'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xec17('0x8')]);router[_0xec17('0x9')](_0xec17('0xa'),auth[_0xec17('0xb')](),controller['describe']);router[_0xec17('0x9')](_0xec17('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xec17('0xd'),auth[_0xec17('0xb')](),controller['getMessages']);router[_0xec17('0x9')](_0xec17('0xe'),auth[_0xec17('0xb')](),controller[_0xec17('0xf')]);router['post']('/',auth[_0xec17('0xb')](),controller[_0xec17('0x10')]);router[_0xec17('0x11')](_0xec17('0xd'),auth[_0xec17('0xb')](),controller[_0xec17('0x12')]);router[_0xec17('0x11')](_0xec17('0x13'),auth[_0xec17('0xb')](),interaction[_0xec17('0x14')](_0xec17('0x15'),'mailinteraction:addtags'),controller[_0xec17('0x16')]);router[_0xec17('0x17')](_0xec17('0xc'),auth[_0xec17('0xb')](),interaction[_0xec17('0x14')](_0xec17('0x15'),_0xec17('0x18')),controller['update']);router[_0xec17('0x19')]('/:id',auth[_0xec17('0xb')](),interaction[_0xec17('0x14')]('mail',_0xec17('0x1a')),controller['destroy']);router[_0xec17('0x19')](_0xec17('0x13'),auth[_0xec17('0xb')](),controller['removeTags']);module[_0xec17('0x1b')]=router; \ No newline at end of file +var _0x1e9a=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x1e9a,0x87));var _0xa1e9=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1e9a[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0xa1e9('0x0'));var util=require('util');var path=require(_0xa1e9('0x1'));var timeout=require(_0xa1e9('0x2'));var express=require(_0xa1e9('0x3'));var router=express['Router']();var fs_extra=require(_0xa1e9('0x4'));var auth=require(_0xa1e9('0x5'));var interaction=require(_0xa1e9('0x6'));var config=require(_0xa1e9('0x7'));var controller=require(_0xa1e9('0x8'));router[_0xa1e9('0x9')]('/',auth[_0xa1e9('0xa')](),controller[_0xa1e9('0xb')]);router[_0xa1e9('0x9')](_0xa1e9('0xc'),auth[_0xa1e9('0xa')](),controller[_0xa1e9('0xd')]);router[_0xa1e9('0x9')](_0xa1e9('0xe'),auth[_0xa1e9('0xa')](),controller[_0xa1e9('0xf')]);router[_0xa1e9('0x9')](_0xa1e9('0x10'),auth['isAuthenticated'](),controller[_0xa1e9('0x11')]);router[_0xa1e9('0x9')](_0xa1e9('0x12'),auth[_0xa1e9('0xa')](),controller[_0xa1e9('0x13')]);router[_0xa1e9('0x14')]('/',auth[_0xa1e9('0xa')](),controller[_0xa1e9('0x15')]);router[_0xa1e9('0x14')]('/:id/messages',auth[_0xa1e9('0xa')](),controller[_0xa1e9('0x16')]);router['post'](_0xa1e9('0x17'),auth[_0xa1e9('0xa')](),interaction[_0xa1e9('0x18')]('mail','mailinteraction:addtags'),controller['addTags']);router[_0xa1e9('0x19')](_0xa1e9('0xe'),auth[_0xa1e9('0xa')](),interaction[_0xa1e9('0x18')](_0xa1e9('0x1a'),_0xa1e9('0x1b')),controller[_0xa1e9('0x1c')]);router[_0xa1e9('0x1d')](_0xa1e9('0xe'),auth[_0xa1e9('0xa')](),interaction[_0xa1e9('0x18')](_0xa1e9('0x1a'),_0xa1e9('0x1e')),controller[_0xa1e9('0x1f')]);router['delete'](_0xa1e9('0x17'),auth['isAuthenticated'](),controller[_0xa1e9('0x20')]);module[_0xa1e9('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 f7ff758..3c439da 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 _0xdd8f=['long','ENUM','out','iconv','BOOLEAN','DATE','STRING','TEXT'];(function(_0x2f66fe,_0x46be8b){var _0x1a1d22=function(_0x1bd32a){while(--_0x1bd32a){_0x2f66fe['push'](_0x2f66fe['shift']());}};_0x1a1d22(++_0x46be8b);}(_0xdd8f,0x6b));var _0xfdd8=function(_0x5f0b7e,_0x3a40d3){_0x5f0b7e=_0x5f0b7e-0x0;var _0x3e024f=_0xdd8f[_0x5f0b7e];return _0x3e024f;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xfdd8('0x0'));module['exports']={'closed':{'type':Sequelize[_0xfdd8('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfdd8('0x2')]},'disposition':{'type':Sequelize[_0xfdd8('0x3')]},'secondDisposition':{'type':Sequelize[_0xfdd8('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfdd8('0x3')]},'note':{'type':Sequelize[_0xfdd8('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xfdd8('0x3')]},'cc':{'type':Sequelize[_0xfdd8('0x4')](_0xfdd8('0x5'))},'subject':{'type':Sequelize[_0xfdd8('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfdd8('0x2')]},'substatus':{'type':Sequelize[_0xfdd8('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xfdd8('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfdd8('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfdd8('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfdd8('0x6')]('in',_0xfdd8('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5990=['long','DATE','ENUM','sequelize','iconv','exports','BOOLEAN','STRING','TEXT'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x5990,0x1a1));var _0x0599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5990[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0599('0x0'));var iconv=require(_0x0599('0x1'));module[_0x0599('0x2')]={'closed':{'type':Sequelize[_0x0599('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0599('0x4')]},'note':{'type':Sequelize[_0x0599('0x4')]},'inReplyTo':{'type':Sequelize[_0x0599('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x0599('0x5')](_0x0599('0x6'))},'subject':{'type':Sequelize[_0x0599('0x5')]()},'attach':{'type':Sequelize[_0x0599('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0599('0x7')]},'substatus':{'type':Sequelize[_0x0599('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0599('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0599('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x0599('0x8')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 610f93d..e3f00cf 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 _0x210c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.MailInteractionId','from','left_join','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','union','User','UserId','text','some','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','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','SELECT','clone','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','MailInteraction','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','Setting','enableEmailPreview','all','rows','show','params','options','create','body','describe','addMessage','ids','getMessages','filter','format','includeAll','include','findAll','inlineCss','true','omit','spread','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','createdAt','Messages','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','message%d.eml','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2cd6ed,_0x5b5051){var _0x44537b=function(_0x343f0a){while(--_0x343f0a){_0x2cd6ed['push'](_0x2cd6ed['shift']());}};_0x44537b(++_0x5b5051);}(_0x210c,0x1d0));var _0xc210=function(_0x26a672,_0x59f5be){_0x26a672=_0x26a672-0x0;var _0x348f43=_0x210c[_0x26a672];return _0x348f43;};'use strict';var emlformat=require(_0xc210('0x0'));var rimraf=require(_0xc210('0x1'));var zipdir=require(_0xc210('0x2'));var jsonpatch=require(_0xc210('0x3'));var rp=require(_0xc210('0x4'));var moment=require(_0xc210('0x5'));var BPromise=require(_0xc210('0x6'));var Mustache=require(_0xc210('0x7'));var util=require(_0xc210('0x8'));var path=require(_0xc210('0x9'));var sox=require(_0xc210('0xa'));var csv=require(_0xc210('0xb'));var ejs=require(_0xc210('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc210('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc210('0xe'));var deskjs=require(_0xc210('0xf'));var toCsv=require(_0xc210('0xb'));var querystring=require('querystring');var Papa=require(_0xc210('0x10'));var htmlToText=require(_0xc210('0x11'));var juice=require(_0xc210('0x12'));var Redis=require(_0xc210('0x13'));var authService=require(_0xc210('0x14'));var qs=require(_0xc210('0x15'));var as=require(_0xc210('0x16'));var hardwareService=require(_0xc210('0x17'));var logger=require(_0xc210('0x18'))(_0xc210('0x19'));var utils=require(_0xc210('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xc210('0x1b'));var db=require(_0xc210('0x1c'))['db'];config[_0xc210('0x1d')]=_[_0xc210('0x1e')](config[_0xc210('0x1d')],{'host':_0xc210('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')[_0xc210('0x20')](socket);function respondWithStatusCode(_0x40ee06,_0x4a6b16){_0x4a6b16=_0x4a6b16||0xcc;return function(_0x267d79){if(_0x267d79){return _0x40ee06[_0xc210('0x21')](_0x4a6b16);}return _0x40ee06[_0xc210('0x22')](_0x4a6b16)[_0xc210('0x23')]();};}function respondWithResult(_0x2511c3,_0x1e05c7){_0x1e05c7=_0x1e05c7||0xc8;return function(_0x39b0cf){if(_0x39b0cf){return _0x2511c3[_0xc210('0x22')](_0x1e05c7)['json'](_0x39b0cf);}};}function respondWithFilteredResult(_0x217a52,_0x47fd11){return function(_0x3ccbc5){if(_0x3ccbc5){var _0x58db9f=typeof _0x47fd11[_0xc210('0x24')]===_0xc210('0x25')&&typeof _0x47fd11[_0xc210('0x26')]==='undefined';var _0x5def9c=_0x3ccbc5['count'];var _0x507ea3=_0x58db9f?0x0:_0x47fd11[_0xc210('0x24')];var _0xa895ef=_0x58db9f?_0x3ccbc5['count']:_0x47fd11[_0xc210('0x24')]+_0x47fd11[_0xc210('0x26')];var _0x45f0de;if(_0xa895ef>=_0x5def9c){_0xa895ef=_0x5def9c;_0x45f0de=0xc8;}else{_0x45f0de=0xce;}_0x217a52[_0xc210('0x22')](_0x45f0de);return _0x217a52['set'](_0xc210('0x27'),_0x507ea3+'-'+_0xa895ef+'/'+_0x5def9c)[_0xc210('0x28')](_0x3ccbc5);}return null;};}function patchUpdates(_0x575600){return function(_0x10cddf){try{jsonpatch[_0xc210('0x29')](_0x10cddf,_0x575600,!![]);}catch(_0x252ef9){return BPromise['reject'](_0x252ef9);}return _0x10cddf[_0xc210('0x2a')]();};}function saveUpdates(_0x34307a,_0x2c4264){return function(_0x1e1945){if(_0x1e1945){return _0x1e1945[_0xc210('0x2b')](_0x34307a)[_0xc210('0x2c')](function(_0x52021d){return _0x52021d;});}return null;};}function removeEntity(_0x59bb94,_0xa98200){return function(_0x20bc54){if(_0x20bc54){return _0x20bc54[_0xc210('0x2d')]()[_0xc210('0x2c')](function(){_0x59bb94[_0xc210('0x22')](0xcc)[_0xc210('0x23')]();});}};}function handleEntityNotFound(_0x3a4fa4,_0x9336ee){return function(_0x4cf042){if(!_0x4cf042){_0x3a4fa4[_0xc210('0x21')](0x194);}return _0x4cf042;};}function handleError(_0x230cd4,_0x3964d4){_0x3964d4=_0x3964d4||0x1f4;return function(_0x189c1f){logger[_0xc210('0x2e')](_0x189c1f[_0xc210('0x2f')]);if(_0x189c1f[_0xc210('0x30')]){delete _0x189c1f[_0xc210('0x30')];}_0x230cd4[_0xc210('0x22')](_0x3964d4)[_0xc210('0x31')](_0x189c1f);};}function getInteractionUsers(_0x1beeff,_0x1fc585){return new BPromise(function(_0x5a1e93,_0x534cba){try{if(_0x1fc585[_0x1beeff['id']]){_0x1beeff[_0xc210('0x32')]=_[_0xc210('0x33')](_0x1fc585[_0x1beeff['id']],function(_0x55fe1e){return{'id':_0x55fe1e['id'],'fullname':_0x55fe1e[_0xc210('0x34')]};});}}catch(_0x357611){_0x534cba(_0x357611);}_0x5a1e93(_0x1beeff);});}function getInteractionTags(_0x513bc4,_0x39aab2){return new BPromise(function(_0x41fc89,_0x2aa831){try{if(_0x513bc4[_0xc210('0x35')]){_0x513bc4[_0xc210('0x36')]=[];_0x513bc4[_0xc210('0x35')][_0xc210('0x37')](',')[_0xc210('0x38')](function(_0x1e3311){_0x513bc4[_0xc210('0x36')][_0xc210('0x39')](_0x39aab2[_0x1e3311]);});}delete _0x513bc4['TagIds'];}catch(_0x3a9654){_0x2aa831(_0x3a9654);}_0x41fc89(_0x513bc4);});}function getLastMessageText(_0x624118){return new BPromise(function(_0x8ff02d,_0x319099){return db[_0xc210('0x3a')][_0xc210('0x3b')]({'where':{'$and':[{'MailInteractionId':_0x624118['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xc210('0x3c')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc210('0x3d')],'order':_0xc210('0x3e'),'raw':!![]})[_0xc210('0x2c')](function(_0x59dec9){if(_0x59dec9&&_0x59dec9[_0xc210('0x3d')]){_0x624118[_0xc210('0x3f')]=_['trimStart'](_0x59dec9[_0xc210('0x3d')]);}_0x8ff02d(_0x624118);})[_0xc210('0x40')](function(_0x580545){_0x319099(_0x580545);});});}function updateMailInteraction(_0x12cf82,_0x438ec2,_0x566176,_0xe2ab78){return new BPromise(function(_0x52e31f,_0x5d2767){return getInteractionUsers(_0x12cf82,_0x566176)['then'](function(_0x2b8703){return getInteractionTags(_0x2b8703,_0x438ec2);})[_0xc210('0x2c')](function(_0x31c4d5){if(_0xe2ab78){_0x52e31f(getLastMessageText(_0x31c4d5));}else{_0x52e31f(_0x31c4d5);}})[_0xc210('0x40')](function(_0x2b9471){_0x5d2767(_0x2b9471);});});}exports[_0xc210('0x41')]=function(_0x2a2105,_0x58b953){var _0x4baab4={},_0x90a608={},_0xe86040={'count':0x0,'rows':[]};var _0x531e2e=_[_0xc210('0x33')](db['MailInteraction'][_0xc210('0x42')],function(_0xbbe8cd){return{'name':_0xbbe8cd['fieldName'],'type':_0xbbe8cd[_0xc210('0x43')][_0xc210('0x44')]};});_0x90a608[_0xc210('0x45')]=_['map'](_0x531e2e,_0xc210('0x30'));_0x90a608[_0xc210('0x46')]=_[_0xc210('0x47')](_0x2a2105[_0xc210('0x46')]);_0x90a608[_0xc210('0x48')]=_[_0xc210('0x49')](_0x90a608[_0xc210('0x45')],_0x90a608[_0xc210('0x46')]);_0x4baab4[_0xc210('0x4a')]=_['intersection'](_0x90a608[_0xc210('0x45')],qs['fields'](_0x2a2105[_0xc210('0x46')][_0xc210('0x4b')]));_0x4baab4[_0xc210('0x4a')]=_0x4baab4['attributes'][_0xc210('0x4c')]?_0x4baab4['attributes']:_0x90a608[_0xc210('0x45')];if(!_0x2a2105[_0xc210('0x46')][_0xc210('0x4d')](_0xc210('0x4e'))){_0x4baab4[_0xc210('0x26')]=qs[_0xc210('0x26')](_0x2a2105[_0xc210('0x46')][_0xc210('0x26')]);_0x4baab4[_0xc210('0x24')]=qs[_0xc210('0x24')](_0x2a2105[_0xc210('0x46')][_0xc210('0x24')]);}_0x4baab4['order']=qs['sort'](_0x2a2105[_0xc210('0x46')][_0xc210('0x4f')]);_0x4baab4[_0xc210('0x50')]=qs[_0xc210('0x48')](_[_0xc210('0x51')](_0x2a2105['query'],_0x90a608[_0xc210('0x48')]),_0x531e2e);var _0xf5b26a=[];var _0x5035cf=squel[_0xc210('0x52')]()[_0xc210('0x53')]('id')['field'](_0xc210('0x30'))[_0xc210('0x53')](_0xc210('0x54'))['from'](_0xc210('0x55'));var _0x45ea3c=squel['select']()['field'](_0xc210('0x56'))[_0xc210('0x53')](_0xc210('0x57'))[_0xc210('0x53')](_0xc210('0x58'))[_0xc210('0x59')]('user_has_mail_interactions','ui')[_0xc210('0x5a')]('users','u','u.id\x20=\x20ui.UserId');var _0x46adf7=squel[_0xc210('0x52')]()[_0xc210('0x59')](_0xc210('0x5b'),'i')[_0xc210('0x5a')](_0xc210('0x5c'),'c',_0xc210('0x5d'))[_0xc210('0x5a')](_0xc210('0x5e'),'o',_0xc210('0x5f'))[_0xc210('0x5a')]('mail_accounts','a',_0xc210('0x60'))[_0xc210('0x5a')](_0xc210('0x61'),'me',_0xc210('0x62'))['left_join'](_0xc210('0x63'),'it',_0xc210('0x64'))[_0xc210('0x5a')]('tools_tags','t',_0xc210('0x65'));var _0xa0b05d=squel[_0xc210('0x66')]();var _0x9f100e=[];var _0x8d1bbf=squel['expr']();var _0x38199f;if(_0x2a2105['query'][_0xc210('0x67')]){_0x38199f=as[_0xc210('0x68')](_0x2a2105[_0xc210('0x46')][_0xc210('0x67')]);var _0x2951be=_0x38199f[_0xc210('0x69')];for(var _0x20455f=0x0;_0x20455f<_0x38199f[_0xc210('0x6a')][_0xc210('0x4c')];_0x20455f++){var _0x4fc227=_0x38199f[_0xc210('0x6a')][_0x20455f];var _0x30a305='i';var _0x3017dc=_['find'](_0x531e2e,['name',_0x4fc227[_0xc210('0x53')]]);if(!_0x3017dc){switch(_0x4fc227[_0xc210('0x53')]){case _0xc210('0x6b'):if(_0x4fc227[_0xc210('0x6c')]==0x1){_0x46adf7[_0xc210('0x6d')]('`'+_0x4fc227['field']+_0xc210('0x6e'));}else{_0x46adf7[_0xc210('0x6d')]('`'+_0x4fc227['field']+_0xc210('0x6f'));}break;case _0xc210('0x70'):if(_0x4fc227[_0xc210('0x71')]===_0xc210('0x72')){if(_0x4fc227[_0xc210('0x6c')][_0xc210('0x37')]('\x20')[_0xc210('0x4c')]>0x1){_0xa0b05d[_0x2951be]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4fc227[_0xc210('0x6c')]),null);}else{var _0x81b435='%'+_0x4fc227[_0xc210('0x6c')]+'%';_0xa0b05d[_0x2951be](_0xc210('0x73'),_0x81b435,_0x81b435,_0x81b435);}}else{_0x3017dc=_[_0xc210('0x74')](_0x531e2e,[_0xc210('0x30'),_0xc210('0x75')]);_0x4fc227[_0xc210('0x53')]=_0xc210('0x75');_0x2bc5f8=as[_0xc210('0x76')](_0x30a305,_0x3017dc[_0xc210('0x43')],_0x4fc227);_0xa0b05d[_0x2951be](_0x2bc5f8['text'],_0x2bc5f8['value'][_0xc210('0x77')],_0x2bc5f8[_0xc210('0x6c')][_0xc210('0x23')]);}break;case _0xc210('0x78'):var _0x8e7a45=_0x4fc227['value'][_0xc210('0x37')](',')[_0xc210('0x33')](function(_0x384d24){return Number(_0x384d24);});_0x8e7a45['forEach'](function(_0x435015){_0x8d1bbf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x435015+',%');});_0x9f100e=_[_0xc210('0x79')](_0x9f100e,_0x8e7a45);break;case _0xc210('0x7a'):if(_0x4fc227[_0xc210('0x71')]===_0xc210('0x72')){_0xa0b05d[_0x2951be]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4fc227[_0xc210('0x6c')]+'%',null);}else{_0x3017dc=_[_0xc210('0x74')](_0x531e2e,[_0xc210('0x30'),_0xc210('0x7b')]);_0x4fc227['field']=_0xc210('0x7b');_0x2bc5f8=as[_0xc210('0x76')](_0x30a305,_0x3017dc['type'],_0x4fc227);_0xa0b05d[_0x2951be](_0x2bc5f8[_0xc210('0x7c')],_0x2bc5f8['value'][_0xc210('0x77')],_0x2bc5f8['value'][_0xc210('0x23')]);}break;case _0xc210('0x3d'):_0x2bc5f8=as[_0xc210('0x76')]('me',null,_0x4fc227);_0xa0b05d[_0x2951be](_0x2bc5f8[_0xc210('0x7c')],_0x2bc5f8[_0xc210('0x6c')][_0xc210('0x77')],_0x2bc5f8['value']['end']);break;}}else{var _0x2bc5f8=as[_0xc210('0x76')](_0x30a305,_0x3017dc[_0xc210('0x43')],_0x4fc227);_0xa0b05d[_0x2951be](_0x2bc5f8[_0xc210('0x7c')],_0x2bc5f8[_0xc210('0x6c')]['start'],_0x2bc5f8[_0xc210('0x6c')][_0xc210('0x23')]);}}}else{var _0x5a7dd1=_(_0x2a2105['query'])[_0xc210('0x47')]()[_0xc210('0x33')](function(_0x31cc91){return _[_0xc210('0x7d')](_0x531e2e,[_0xc210('0x30'),_0x31cc91])?_0x31cc91:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x5a7dd1)){_0x5a7dd1[_0xc210('0x38')](function(_0x428121){if(_0x428121===_0xc210('0x7e')){_0x46adf7['where'](_0xc210('0x7f'),[][_0xc210('0x80')](_0x2a2105['query'][_0x428121]));}else if(_0x428121==='createdAt'){var _0x10f25b=JSON[_0xc210('0x81')](_0x2a2105[_0xc210('0x46')][_0x428121])[_0xc210('0x82')];var _0x173f98=JSON[_0xc210('0x81')](_0x2a2105[_0xc210('0x46')][_0x428121])[_0xc210('0x83')];_0x46adf7[_0xc210('0x50')](_0xc210('0x84'),_0x10f25b,_0x173f98);}else{if(_0x2a2105[_0xc210('0x46')][_0x428121]==='null'){_0x46adf7[_0xc210('0x50')]('i.'+_0x428121+_0xc210('0x85'));}else{_0x46adf7['where']('i.'+_0x428121+_0xc210('0x86'),_0x2a2105['query'][_0x428121]);}}});}if(_0x2a2105[_0xc210('0x46')][_0xc210('0x87')]){if(_0x2a2105[_0xc210('0x46')][_0xc210('0x87')]==0x1){_0x46adf7[_0xc210('0x6d')](_0xc210('0x88'));}else{_0x46adf7['having']('`unreadMessages`\x20>\x200');}}if(_0x2a2105[_0xc210('0x46')][_0xc210('0x89')]){_0x9f100e=_[_0xc210('0x8a')](_0x2a2105[_0xc210('0x46')]['tag'])?_0x2a2105['query'][_0xc210('0x89')]:new Array(_0x2a2105[_0xc210('0x46')][_0xc210('0x89')]);_0x9f100e['forEach'](function(_0x81ba83){_0x8d1bbf['or'](_0xc210('0x8b'),'%,'+_0x81ba83+',%');});}if(_0x2a2105[_0xc210('0x46')]['filter']){var _0x5a030d=_0x2a2105[_0xc210('0x46')]['filter'][_0xc210('0x8c')]('\x5c','\x5c\x5c')[_0xc210('0x8c')](/'/g,'\x27\x27');if(qs[_0xc210('0x8d')](_0x5a030d)){_0xa0b05d['or'](_0xc210('0x8e'),_0x5a030d+'%');}else if(qs['isEmail'](_0x5a030d)){_0xa0b05d['or']('c.email\x20LIKE\x20?',_0x5a030d+'%');}else{_0xa0b05d['or'](_0xc210('0x8f'),qs[_0xc210('0x90')](_0x5a030d))['or'](_0xc210('0x91'),qs['getFullTextValue'](_0x5a030d));}}}_0x46adf7['where'](_0xa0b05d);_0x46adf7[_0xc210('0x92')](_0xc210('0x93'));var _0x13a93b={'type':db[_0xc210('0x94')]['QueryTypes'][_0xc210('0x95')],'raw':!![]};var _0xfe3f05=_0x46adf7[_0xc210('0x96')]();_0xfe3f05['field'](_0xc210('0x93'));_0xfe3f05['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc210('0x6b'));if(_0x4baab4[_0xc210('0x97')]){_0x4baab4[_0xc210('0x97')]['forEach'](function(_0x403946){var _0x4105bb=_0x403946[0x0]===_0xc210('0x98')?_0x403946[0x0]:'i.'+_0x403946[0x0];_0x46adf7[_0xc210('0x97')](_0x4105bb,_0x403946[0x1]===_0xc210('0x99')?![]:!![]);});}if(!_[_0xc210('0x9a')](_0x9f100e)){_0x46adf7[_0xc210('0x6d')](_0x8d1bbf);_0xfe3f05[_0xc210('0x50')](_0xc210('0x9b'),_0x9f100e);}BPromise[_0xc210('0x9c')]()[_0xc210('0x2c')](function(){if(!_0x38199f){if(_0x2a2105[_0xc210('0x46')][_0xc210('0x7e')])return;_0xfe3f05[_0xc210('0x50')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x46adf7[_0xc210('0x50')](_0xc210('0x9d'));return;}if(_0x2a2105[_0xc210('0x9e')][_0xc210('0x9f')]!=='agent')return;return _0x2a2105[_0xc210('0x9e')][_0xc210('0xa0')]({'attributes':['id'],'raw':!![]})[_0xc210('0x2c')](function(_0x130129){if(_['isEmpty'](_0x130129)){_0xfe3f05['where'](_0xc210('0xa1'));_0x46adf7[_0xc210('0x50')](_0xc210('0xa1'));}else{_0xfe3f05[_0xc210('0x50')](_0xc210('0x7f'),_[_0xc210('0x33')](_0x130129,'id'));_0x46adf7[_0xc210('0x50')]('i.MailAccountId\x20IN\x20?',_[_0xc210('0x33')](_0x130129,'id'));}});})[_0xc210('0x2c')](function(){if(_0x2a2105['user'][_0xc210('0x9f')]==='agent'&&!_0x38199f&&!_0x2a2105[_0xc210('0x46')]['MailAccountId'])return[];return db[_0xc210('0xa2')][_0xc210('0x46')](_0xfe3f05[_0xc210('0xa3')](),_0x13a93b);})[_0xc210('0x2c')](function(_0x517771){_0xe86040[_0xc210('0xa4')]=_0x517771[_0xc210('0x4c')];if(_0xe86040['count']===0x0)return[];return db[_0xc210('0xa2')][_0xc210('0x46')](_0x5035cf[_0xc210('0xa3')](),_0x13a93b)[_0xc210('0x2c')](function(_0x252e30){_0xf5b26a=_[_0xc210('0xa5')](_0x252e30,'id');_0x13a93b=_[_0xc210('0xa6')](_0x13a93b,{'model':db[_0xc210('0xa7')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a2105[_0xc210('0x46')][_0xc210('0x4b')]){_0x4baab4[_0xc210('0x4a')]['forEach'](function(_0xab6cf1){_0x46adf7['field']('i.'+_0xab6cf1);});}else{_0x46adf7[_0xc210('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc210('0x6b'));_0x46adf7[_0xc210('0x53')](_0xc210('0xa8'),_0xc210('0xa9'));_0x46adf7['field']('a.mandatoryDisposition',_0xc210('0xaa'));_0x46adf7[_0xc210('0x53')](_0xc210('0xab'),_0xc210('0x98'));_0x46adf7[_0xc210('0x53')](_0xc210('0x93'));_0x46adf7[_0xc210('0x53')](_0xc210('0xac'));_0x46adf7['field'](_0xc210('0xad'));_0x46adf7['field'](_0xc210('0xae'));_0x46adf7[_0xc210('0x53')](_0xc210('0xaf'));_0x46adf7[_0xc210('0x53')]('i.attach');_0x46adf7[_0xc210('0x53')](_0xc210('0xb0'));_0x46adf7['field'](_0xc210('0xb1'));_0x46adf7[_0xc210('0x53')](_0xc210('0xb2'));_0x46adf7[_0xc210('0x53')](_0xc210('0xb3'));_0x46adf7['field'](_0xc210('0xb4'));_0x46adf7[_0xc210('0x53')]('i.thirdDisposition');_0x46adf7[_0xc210('0x53')](_0xc210('0xb5'));_0x46adf7[_0xc210('0x53')]('i.to');_0x46adf7[_0xc210('0x53')]('i.ContactId');_0x46adf7[_0xc210('0x53')](_0xc210('0xb6'));_0x46adf7[_0xc210('0x53')]('i.UserId');_0x46adf7[_0xc210('0x53')](_0xc210('0xb7'),_0xc210('0xb8'));_0x46adf7[_0xc210('0x53')](_0xc210('0xb9'),_0xc210('0xba'));_0x46adf7[_0xc210('0x53')](_0xc210('0xbb'),'Contact.email');_0x46adf7['field'](_0xc210('0xbc'),'Contact.phone');_0x46adf7['field'](_0xc210('0xbd'),_0xc210('0xbe'));_0x46adf7['field']('c.fax','Contact.fax');_0x46adf7[_0xc210('0x53')]('o.fullname',_0xc210('0xbf'));_0x46adf7[_0xc210('0x53')](_0xc210('0xc0'),_0xc210('0xc1'));_0x46adf7[_0xc210('0x53')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4baab4[_0xc210('0x26')])_0x46adf7[_0xc210('0x26')](_0x4baab4[_0xc210('0x26')]);if(_0x4baab4[_0xc210('0x24')])_0x46adf7[_0xc210('0x24')](_0x4baab4[_0xc210('0x24')]);return db[_0xc210('0xa2')]['query'](_0x46adf7[_0xc210('0xa3')](),_0x13a93b);})['then'](function(_0x3c7947){if(_0x3c7947[_0xc210('0x4c')]>0x0)_0x45ea3c[_0xc210('0x50')](_0xc210('0xc2'),_['map'](_0x3c7947,'id'));return db[_0xc210('0xa2')][_0xc210('0x46')](_0x45ea3c[_0xc210('0xa3')](),_0x13a93b)[_0xc210('0x2c')](function(_0x8ab8b6){var _0x34589e=_['groupBy'](_0x8ab8b6,'MailInteractionId');var _0x4ff475=[];return db[_0xc210('0xc3')][_0xc210('0x3b')]({'attributes':[_0xc210('0xc4')],'raw':!![]})[_0xc210('0x2c')](function(_0x567f9d){var _0x30ef97=_0x567f9d['enableEmailPreview'];_0x3c7947[_0xc210('0x38')](function(_0x12091b){_0x4ff475[_0xc210('0x39')](updateMailInteraction(_0x12091b,_0xf5b26a,_0x34589e,_0x30ef97));});return BPromise[_0xc210('0xc5')](_0x4ff475);});});});})[_0xc210('0x2c')](function(_0x302fee){_0xe86040[_0xc210('0xc6')]=_0x302fee;return _0xe86040;})[_0xc210('0x2c')](respondWithFilteredResult(_0x58b953,_0x4baab4))[_0xc210('0x40')](handleError(_0x58b953,null));};exports[_0xc210('0xc7')]=function(_0x257452,_0x360e47){var _0x4544e7={'raw':![],'where':{'id':_0x257452[_0xc210('0xc8')]['id']}},_0x261c3a={};_0x261c3a['model']=_[_0xc210('0x47')](db[_0xc210('0xa7')][_0xc210('0x42')]);_0x261c3a[_0xc210('0x46')]=_[_0xc210('0x47')](_0x257452[_0xc210('0x46')]);_0x261c3a['filters']=_[_0xc210('0x49')](_0x261c3a['model'],_0x261c3a[_0xc210('0x46')]);_0x4544e7[_0xc210('0x4a')]=_['intersection'](_0x261c3a[_0xc210('0x45')],qs[_0xc210('0x4b')](_0x257452['query'][_0xc210('0x4b')]));_0x4544e7['attributes']=_0x4544e7[_0xc210('0x4a')][_0xc210('0x4c')]?_0x4544e7['attributes']:_0x261c3a[_0xc210('0x45')];if(_0x257452[_0xc210('0x46')]['includeAll']){_0x4544e7['include']=[{'all':!![]}];}_0x4544e7=_[_0xc210('0xa6')]({},_0x4544e7,_0x257452[_0xc210('0xc9')]);return db[_0xc210('0xa7')][_0xc210('0x74')](_0x4544e7)[_0xc210('0x2c')](handleEntityNotFound(_0x360e47,null))[_0xc210('0x2c')](respondWithResult(_0x360e47,null))[_0xc210('0x40')](handleError(_0x360e47,null));};exports['create']=function(_0x1ecffb,_0x37e23c){return db[_0xc210('0xa7')][_0xc210('0xca')](_0x1ecffb[_0xc210('0xcb')],{})[_0xc210('0x2c')](respondWithResult(_0x37e23c,0xc9))[_0xc210('0x40')](handleError(_0x37e23c,null));};exports[_0xc210('0x2b')]=function(_0x5306de,_0x7b5846){if(_0x5306de[_0xc210('0xcb')]['id']){delete _0x5306de[_0xc210('0xcb')]['id'];}return db[_0xc210('0xa7')]['find']({'where':{'id':_0x5306de[_0xc210('0xc8')]['id']}})[_0xc210('0x2c')](handleEntityNotFound(_0x7b5846,null))['then'](saveUpdates(_0x5306de[_0xc210('0xcb')],null))['then'](respondWithResult(_0x7b5846,null))[_0xc210('0x40')](handleError(_0x7b5846,null));};exports[_0xc210('0x2d')]=function(_0x42e1fe,_0x1b10d8){return db['MailInteraction'][_0xc210('0x74')]({'where':{'id':_0x42e1fe['params']['id']}})[_0xc210('0x2c')](handleEntityNotFound(_0x1b10d8,null))[_0xc210('0x2c')](removeEntity(_0x1b10d8,null))['catch'](handleError(_0x1b10d8,null));};exports[_0xc210('0xcc')]=function(_0xdda48,_0x2a41ce){return db[_0xc210('0xa7')][_0xc210('0xcc')]()[_0xc210('0x2c')](respondWithResult(_0x2a41ce,null))[_0xc210('0x40')](handleError(_0x2a41ce,null));};exports[_0xc210('0xcd')]=function(_0x280e83,_0x576a0e,_0x328edf){return db['MailMessage']['find']({'where':{'id':_0x280e83[_0xc210('0xc8')]['id']}})[_0xc210('0x2c')](handleEntityNotFound(_0x576a0e,null))['then'](function(_0x185836){if(_0x185836){return _0x185836['addMessage'](_0x280e83[_0xc210('0xcb')][_0xc210('0xce')],_['omit'](_0x280e83[_0xc210('0xcb')],[_0xc210('0xce'),'id'])||{});}})[_0xc210('0x2c')](respondWithResult(_0x576a0e,null))[_0xc210('0x40')](handleError(_0x576a0e,null));};exports[_0xc210('0xcf')]=function(_0x114ba0,_0x72d0c9,_0x533fb){var _0x162a28={'raw':![],'where':{}};var _0x24bdd6={};var _0x80d3b8={'count':0x0,'rows':[]};return db[_0xc210('0xa7')]['findOne']({'where':{'id':_0x114ba0[_0xc210('0xc8')]['id']}})[_0xc210('0x2c')](handleEntityNotFound(_0x72d0c9,null))[_0xc210('0x2c')](function(_0x1ae795){if(_0x1ae795){_0x24bdd6[_0xc210('0x45')]=_[_0xc210('0x47')](db['MailMessage'][_0xc210('0x42')]);_0x24bdd6[_0xc210('0x46')]=_[_0xc210('0x47')](_0x114ba0[_0xc210('0x46')]);_0x24bdd6[_0xc210('0x48')]=_[_0xc210('0x49')](_0x24bdd6['model'],_0x24bdd6[_0xc210('0x46')]);_0x162a28[_0xc210('0x4a')]=_['intersection'](_0x24bdd6['model'],qs[_0xc210('0x4b')](_0x114ba0[_0xc210('0x46')][_0xc210('0x4b')]));_0x162a28[_0xc210('0x4a')]=_0x162a28[_0xc210('0x4a')][_0xc210('0x4c')]?_0x162a28[_0xc210('0x4a')]:_0x24bdd6[_0xc210('0x45')];if(!_0x114ba0[_0xc210('0x46')]['hasOwnProperty'](_0xc210('0x4e'))){_0x162a28[_0xc210('0x26')]=qs[_0xc210('0x26')](_0x114ba0[_0xc210('0x46')]['limit']);_0x162a28[_0xc210('0x24')]=qs[_0xc210('0x24')](_0x114ba0[_0xc210('0x46')][_0xc210('0x24')]);}_0x162a28['order']=qs[_0xc210('0x4f')](_0x114ba0['query'][_0xc210('0x4f')]);_0x162a28[_0xc210('0x50')]=qs[_0xc210('0x48')](_[_0xc210('0x51')](_0x114ba0['query'],_0x24bdd6[_0xc210('0x48')]));_0x162a28[_0xc210('0x50')]['MailInteractionId']=_0x1ae795['id'];if(_0x114ba0['query']['filter']){_0x162a28[_0xc210('0x50')]=_[_0xc210('0xa6')](_0x162a28[_0xc210('0x50')],{'$or':_[_0xc210('0x33')](_0x162a28[_0xc210('0x4a')],function(_0x3ad89d){var _0x549f6c={};_0x549f6c[_0x3ad89d]={'$like':'%'+_0x114ba0['query'][_0xc210('0xd0')]+'%'};return _0x549f6c;})});}if(_0x114ba0[_0xc210('0x46')][_0xc210('0x82')]){var _0x32ef9e=_0x114ba0['query']['$gte']['split'](',');var _0x3fd996={};_0x3fd996[_0x32ef9e[0x0]]={'$gte':moment(_0x32ef9e[0x1])[_0xc210('0xd1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x162a28[_0xc210('0x50')]=_[_0xc210('0xa6')](_0x162a28['where'],_0x3fd996);}_0x162a28=_[_0xc210('0xa6')]({},_0x162a28,_0x114ba0[_0xc210('0xc9')]);return db['MailMessage'][_0xc210('0xa4')]({'where':_0x162a28[_0xc210('0x50')]})[_0xc210('0x2c')](function(_0x59e93c){_0x80d3b8['count']=_0x59e93c;if(_0x114ba0[_0xc210('0x46')][_0xc210('0xd2')]){_0x162a28[_0xc210('0xd3')]=[{'all':!![]}];}return db['MailMessage'][_0xc210('0xd4')](_0x162a28);})[_0xc210('0x2c')](function(_0x5bb30){if(_0x114ba0[_0xc210('0x46')][_0xc210('0xd5')]===_0xc210('0xd6')){for(var _0x55c2e1=0x0;_0x55c2e1<_0x5bb30['length'];_0x55c2e1++){_0x5bb30[_0x55c2e1]['body']=juice(_0x5bb30[_0x55c2e1]['body']);}}_0x80d3b8[_0xc210('0xc6')]=_0x5bb30;return _0x80d3b8;});}})[_0xc210('0x2c')](respondWithFilteredResult(_0x72d0c9,_0x162a28))['catch'](handleError(_0x72d0c9,null));};exports['addTags']=function(_0x201fc5,_0x395a0b,_0x352b4b){return db[_0xc210('0xa7')][_0xc210('0x74')]({'where':{'id':_0x201fc5[_0xc210('0xc8')]['id']}})[_0xc210('0x2c')](handleEntityNotFound(_0x395a0b,null))[_0xc210('0x2c')](function(_0x40e7c4){if(_0x40e7c4){return _0x40e7c4['setTags'](_0x201fc5[_0xc210('0xcb')][_0xc210('0xce')],_[_0xc210('0xd7')](_0x201fc5[_0xc210('0xcb')],[_0xc210('0xce'),'id'])||{})[_0xc210('0xd8')](function(){return db[_0xc210('0x78')][_0xc210('0xd4')]({'attributes':['id',_0xc210('0x30'),_0xc210('0x54')],'where':{'id':_0x201fc5[_0xc210('0xcb')][_0xc210('0xce')]}});})['then'](function(_0x2701f8){socket[_0xc210('0xd9')]('mailInteractionTags:save',{'id':Number(_0x201fc5['params']['id']),'tags':_0x2701f8||[]});return{'id':Number(_0x201fc5['params']['id']),'tags':_0x2701f8||[]};});}})['then'](respondWithResult(_0x395a0b,null))[_0xc210('0x40')](handleError(_0x395a0b,null));};exports[_0xc210('0xda')]=function(_0x28bea4,_0x5a9529,_0x1cd228){return db['MailInteraction']['find']({'where':{'id':_0x28bea4[_0xc210('0xc8')]['id']}})[_0xc210('0x2c')](handleEntityNotFound(_0x5a9529,null))[_0xc210('0x2c')](function(_0x47f485){if(_0x47f485){return _0x47f485[_0xc210('0xda')](_0x28bea4['query'][_0xc210('0xce')]);}})[_0xc210('0x2c')](respondWithStatusCode(_0x5a9529,null))['catch'](handleError(_0x5a9529,null));};exports[_0xc210('0xdb')]=function(_0x17d14f,_0x29e138){var _0x27ad99=moment()['unix']()[_0xc210('0xa3')]();var _0x38fb6a=path[_0xc210('0xdc')](config[_0xc210('0xdd')],_0xc210('0xde'),_0xc210('0xdf'),'tmp');var _0x28435a=path[_0xc210('0xdc')](config[_0xc210('0xdd')],'server',_0xc210('0xdf'),_0xc210('0xe0'));var _0x24c2a7=path[_0xc210('0xdc')](_0x38fb6a,_0x27ad99);var _0x436ad5=util['format'](_0xc210('0xe1'),_0x17d14f['params']['id'],_0x27ad99);var _0xec17bb=path[_0xc210('0xdc')](_0x38fb6a,_0x436ad5);var _0x248488=[];if(_0x17d14f[_0xc210('0x46')][_0xc210('0xe0')]){_0x248488[_0xc210('0x39')]({'model':db[_0xc210('0xe2')],'as':_0xc210('0xe3'),'raw':!![]});}var _0x2731aa=[{'model':db[_0xc210('0x3a')],'as':'Messages','attributes':['id',_0xc210('0xcb'),_0xc210('0x59'),'to','cc',_0xc210('0xe4'),_0xc210('0xe5'),_0xc210('0xe6')],'where':{'secret':![]},'order':qs[_0xc210('0x4f')]('id'),'include':_0x248488}];return db[_0xc210('0xa7')][_0xc210('0x74')]({'where':{'id':_0x17d14f['params']['id']},'include':_0x2731aa})['then'](handleEntityNotFound(_0x29e138,null))['then'](function(_0x66fb24){if(_0x66fb24&&_0x66fb24[_0xc210('0xe7')]){var _0x4f85f6=_0x66fb24[_0xc210('0xe8')]({'plain':!![]});fs['mkdirSync'](_0x24c2a7);return BPromise[_0xc210('0xe9')](_0x4f85f6['Messages'],function(_0x27282f,_0x20f6ef){var _0x252476={'from':_0x27282f['from'],'to':_0x27282f['to'],'subject':_0x27282f[_0xc210('0xe5')],'html':_0x27282f['body'],'headers':{'Date':moment(_0x27282f[_0xc210('0xe6')])[_0xc210('0xd1')](_0xc210('0xea'))},'attachments':[]};if(_0x27282f['cc']){_0x252476[_0xc210('0xeb')]['Cc']=_0x27282f['cc'];}if(_0x27282f[_0xc210('0xe4')]){_0x252476[_0xc210('0xeb')][_0xc210('0xec')]=_0x27282f[_0xc210('0xe4')];}return new BPromise(function(_0x39d721,_0x18e021){if(_0x27282f[_0xc210('0xe3')]){for(var _0x469d29=0x0;_0x469d29<_0x27282f['Attachments'][_0xc210('0x4c')];_0x469d29++){var _0x3cb11b=_0x27282f['Attachments'][_0x469d29];var _0x4e0862=path[_0xc210('0xdc')](_0x28435a,_0x3cb11b['basename']);if(fs[_0xc210('0xed')](_0x4e0862)){_0x252476['attachments'][_0xc210('0x39')]({'name':_0x3cb11b['name'],'contentType':_0x3cb11b['type'],'data':fs['readFileSync'](_0x4e0862)});}}}emlformat[_0xc210('0xee')](_0x252476,function(_0x5cd885,_0xa2d66e){if(_0x5cd885)return _0x18e021(_0x5cd885);fs['writeFileSync'](path[_0xc210('0xdc')](_0x24c2a7,util[_0xc210('0xd1')](_0xc210('0xef'),_0x20f6ef)),_0xa2d66e);return _0x39d721(_0xa2d66e);});});})[_0xc210('0x2c')](function(){return new BPromise(function(_0x1a58f6,_0x321b2d){zipdir(_0x24c2a7,{'saveTo':_0xec17bb},function(_0x15f360,_0x248411){if(_0x15f360)return _0x321b2d(_0x15f360);return _0x1a58f6(_0x248411);});})[_0xc210('0x2c')](function(){return new BPromise(function(_0xfa0e54,_0x439441){rimraf(_0x24c2a7,function(_0x42026d){if(_0x42026d)_0x439441(_0x42026d);return _0xfa0e54();});});})[_0xc210('0x2c')](function(){return _0x29e138['download'](_0xec17bb,_0x436ad5,function(_0x20c239){if(_0x20c239){console[_0xc210('0xf0')](_0xc210('0xf1'),_0x20c239);}else{fs[_0xc210('0xf2')](_0xec17bb);}});});});}else{return _0x29e138[_0xc210('0x21')](0xc8);}})[_0xc210('0x40')](handleError(_0x29e138,null));}; \ No newline at end of file +var _0x9256=['pick','select','field','name','color','from','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','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','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','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?','start','keys','some','compact','isEmpty','forEach','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','having','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.subject','i.disposition','i.to','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','all','rows','catch','show','params','includeAll','include','options','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','rawAttributes','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','mailInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','get','mkdirSync','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','message%d.eml','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','end','error','stack','Users','map','fullname','TagIds','split','push','findOne','out','plainBody','-id','index','MailInteraction','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x9256,0x19c));var _0x6925=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9256[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6925('0x0'));var zipdir=require(_0x6925('0x1'));var jsonpatch=require(_0x6925('0x2'));var rp=require(_0x6925('0x3'));var moment=require(_0x6925('0x4'));var BPromise=require(_0x6925('0x5'));var Mustache=require(_0x6925('0x6'));var util=require(_0x6925('0x7'));var path=require('path');var sox=require(_0x6925('0x8'));var csv=require(_0x6925('0x9'));var ejs=require(_0x6925('0xa'));var fs=require('fs');var fs_extra=require(_0x6925('0xb'));var _=require('lodash');var squel=require(_0x6925('0xc'));var crypto=require(_0x6925('0xd'));var jsforce=require(_0x6925('0xe'));var deskjs=require(_0x6925('0xf'));var toCsv=require(_0x6925('0x9'));var querystring=require(_0x6925('0x10'));var Papa=require(_0x6925('0x11'));var htmlToText=require(_0x6925('0x12'));var juice=require(_0x6925('0x13'));var Redis=require(_0x6925('0x14'));var authService=require(_0x6925('0x15'));var qs=require(_0x6925('0x16'));var as=require(_0x6925('0x17'));var hardwareService=require(_0x6925('0x18'));var logger=require(_0x6925('0x19'))(_0x6925('0x1a'));var utils=require('../../config/utils');var config=require(_0x6925('0x1b'));var licenseUtil=require(_0x6925('0x1c'));var db=require(_0x6925('0x1d'))['db'];config[_0x6925('0x1e')]=_[_0x6925('0x1f')](config[_0x6925('0x1e')],{'host':_0x6925('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6925('0x21'))[_0x6925('0x22')](socket);function respondWithStatusCode(_0x3f7232,_0x1bc541){_0x1bc541=_0x1bc541||0xcc;return function(_0x13ba83){if(_0x13ba83){return _0x3f7232[_0x6925('0x23')](_0x1bc541);}return _0x3f7232['status'](_0x1bc541)['end']();};}function respondWithResult(_0x497d62,_0x48790c){_0x48790c=_0x48790c||0xc8;return function(_0x2799d6){if(_0x2799d6){return _0x497d62[_0x6925('0x24')](_0x48790c)['json'](_0x2799d6);}};}function respondWithFilteredResult(_0x5c73c7,_0xc91309){return function(_0x2fe94a){if(_0x2fe94a){var _0x23fe76=typeof _0xc91309[_0x6925('0x25')]===_0x6925('0x26')&&typeof _0xc91309[_0x6925('0x27')]===_0x6925('0x26');var _0x232aa4=_0x2fe94a[_0x6925('0x28')];var _0x540650=_0x23fe76?0x0:_0xc91309['offset'];var _0x22e2ff=_0x23fe76?_0x2fe94a[_0x6925('0x28')]:_0xc91309['offset']+_0xc91309[_0x6925('0x27')];var _0x183b71;if(_0x22e2ff>=_0x232aa4){_0x22e2ff=_0x232aa4;_0x183b71=0xc8;}else{_0x183b71=0xce;}_0x5c73c7[_0x6925('0x24')](_0x183b71);return _0x5c73c7[_0x6925('0x29')](_0x6925('0x2a'),_0x540650+'-'+_0x22e2ff+'/'+_0x232aa4)[_0x6925('0x2b')](_0x2fe94a);}return null;};}function patchUpdates(_0x17367f){return function(_0x3acb53){try{jsonpatch['apply'](_0x3acb53,_0x17367f,!![]);}catch(_0x2b3c65){return BPromise['reject'](_0x2b3c65);}return _0x3acb53[_0x6925('0x2c')]();};}function saveUpdates(_0x43b7cd,_0x11a517){return function(_0x377d1e){if(_0x377d1e){return _0x377d1e['update'](_0x43b7cd)[_0x6925('0x2d')](function(_0x23eaea){return _0x23eaea;});}return null;};}function removeEntity(_0x529bc2,_0x519099){return function(_0x387cdd){if(_0x387cdd){return _0x387cdd[_0x6925('0x2e')]()[_0x6925('0x2d')](function(){_0x529bc2['status'](0xcc)[_0x6925('0x2f')]();});}};}function handleEntityNotFound(_0x5355d3,_0x685c0b){return function(_0x3eaf85){if(!_0x3eaf85){_0x5355d3[_0x6925('0x23')](0x194);}return _0x3eaf85;};}function handleError(_0x2932ca,_0x59b2cd){_0x59b2cd=_0x59b2cd||0x1f4;return function(_0x49e173){logger[_0x6925('0x30')](_0x49e173[_0x6925('0x31')]);if(_0x49e173['name']){delete _0x49e173['name'];}_0x2932ca[_0x6925('0x24')](_0x59b2cd)['send'](_0x49e173);};}function getInteractionUsers(_0x3af1ff,_0x107b6f){return new BPromise(function(_0x23bfeb,_0x1b16bc){try{if(_0x107b6f[_0x3af1ff['id']]){_0x3af1ff[_0x6925('0x32')]=_[_0x6925('0x33')](_0x107b6f[_0x3af1ff['id']],function(_0x263600){return{'id':_0x263600['id'],'fullname':_0x263600[_0x6925('0x34')]};});}}catch(_0x5c93e0){_0x1b16bc(_0x5c93e0);}_0x23bfeb(_0x3af1ff);});}function getInteractionTags(_0x4e84e2,_0xe28125){return new BPromise(function(_0x3a5144,_0x5801af){try{if(_0x4e84e2[_0x6925('0x35')]){_0x4e84e2['Tags']=[];_0x4e84e2[_0x6925('0x35')][_0x6925('0x36')](',')['forEach'](function(_0x54da3a){_0x4e84e2['Tags'][_0x6925('0x37')](_0xe28125[_0x54da3a]);});}delete _0x4e84e2[_0x6925('0x35')];}catch(_0x1d5169){_0x5801af(_0x1d5169);}_0x3a5144(_0x4e84e2);});}function getLastMessageText(_0x4cfc97){return new BPromise(function(_0x122953,_0xf2bb17){return db['MailMessage'][_0x6925('0x38')]({'where':{'$and':[{'MailInteractionId':_0x4cfc97['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6925('0x39')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x6925('0x3a')],'order':_0x6925('0x3b'),'raw':!![]})[_0x6925('0x2d')](function(_0x1b28b0){if(_0x1b28b0&&_0x1b28b0[_0x6925('0x3a')]){_0x4cfc97['lastMsgText']=_['trimStart'](_0x1b28b0[_0x6925('0x3a')]);}_0x122953(_0x4cfc97);})['catch'](function(_0x17bc36){_0xf2bb17(_0x17bc36);});});}function updateMailInteraction(_0xcd6b59,_0x2e6f74,_0x133136,_0x390638){return new BPromise(function(_0x2c06e1,_0x8b72d1){return getInteractionUsers(_0xcd6b59,_0x133136)['then'](function(_0x26c956){return getInteractionTags(_0x26c956,_0x2e6f74);})[_0x6925('0x2d')](function(_0x472e29){if(_0x390638){_0x2c06e1(getLastMessageText(_0x472e29));}else{_0x2c06e1(_0x472e29);}})['catch'](function(_0x152f75){_0x8b72d1(_0x152f75);});});}exports[_0x6925('0x3c')]=function(_0x29c112,_0x7d76d8){var _0x4abd85={},_0x407c1d={},_0x4db80c={'count':0x0,'rows':[]};var _0x5d142d=_['map'](db[_0x6925('0x3d')]['rawAttributes'],function(_0xbbb25f){return{'name':_0xbbb25f[_0x6925('0x3e')],'type':_0xbbb25f[_0x6925('0x3f')][_0x6925('0x40')]};});_0x407c1d[_0x6925('0x41')]=_[_0x6925('0x33')](_0x5d142d,'name');_0x407c1d[_0x6925('0x42')]=_['keys'](_0x29c112[_0x6925('0x42')]);_0x407c1d[_0x6925('0x43')]=_[_0x6925('0x44')](_0x407c1d[_0x6925('0x41')],_0x407c1d[_0x6925('0x42')]);_0x4abd85['attributes']=_[_0x6925('0x44')](_0x407c1d[_0x6925('0x41')],qs[_0x6925('0x45')](_0x29c112[_0x6925('0x42')][_0x6925('0x45')]));_0x4abd85[_0x6925('0x46')]=_0x4abd85['attributes']['length']?_0x4abd85[_0x6925('0x46')]:_0x407c1d[_0x6925('0x41')];if(!_0x29c112[_0x6925('0x42')][_0x6925('0x47')]('nolimit')){_0x4abd85[_0x6925('0x27')]=qs['limit'](_0x29c112[_0x6925('0x42')][_0x6925('0x27')]);_0x4abd85['offset']=qs[_0x6925('0x25')](_0x29c112['query'][_0x6925('0x25')]);}_0x4abd85['order']=qs[_0x6925('0x48')](_0x29c112[_0x6925('0x42')]['sort']);_0x4abd85[_0x6925('0x49')]=qs['filters'](_[_0x6925('0x4a')](_0x29c112[_0x6925('0x42')],_0x407c1d[_0x6925('0x43')]),_0x5d142d);var _0x288f23=[];var _0x6919fa=squel[_0x6925('0x4b')]()[_0x6925('0x4c')]('id')[_0x6925('0x4c')](_0x6925('0x4d'))['field'](_0x6925('0x4e'))[_0x6925('0x4f')]('tools_tags');var _0x398fa4=squel[_0x6925('0x4b')]()['field']('u.id')[_0x6925('0x4c')](_0x6925('0x50'))['field'](_0x6925('0x51'))[_0x6925('0x4f')](_0x6925('0x52'),'ui')[_0x6925('0x53')](_0x6925('0x54'),'u',_0x6925('0x55'));var _0x3527ef=squel[_0x6925('0x4b')]()[_0x6925('0x4f')]('mail_interactions','i')[_0x6925('0x53')]('cm_contacts','c',_0x6925('0x56'))[_0x6925('0x53')](_0x6925('0x54'),'o',_0x6925('0x57'))[_0x6925('0x53')](_0x6925('0x58'),'a',_0x6925('0x59'))[_0x6925('0x53')]('mail_messages','me',_0x6925('0x5a'))['left_join']('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0x6925('0x53')]('tools_tags','t',_0x6925('0x5b'));var _0x5357ae=squel[_0x6925('0x5c')]();var _0x38d75c=[];var _0x4ae5ca=squel[_0x6925('0x5c')]();var _0x22221a;if(_0x29c112[_0x6925('0x42')][_0x6925('0x5d')]){_0x22221a=as[_0x6925('0x5e')](_0x29c112[_0x6925('0x42')]['search']);var _0x39b3ad=_0x22221a[_0x6925('0x5f')];for(var _0x1e82b3=0x0;_0x1e82b3<_0x22221a[_0x6925('0x60')][_0x6925('0x61')];_0x1e82b3++){var _0xd43a82=_0x22221a[_0x6925('0x60')][_0x1e82b3];var _0x4b3f73='i';var _0x5c2204=_[_0x6925('0x62')](_0x5d142d,[_0x6925('0x4d'),_0xd43a82[_0x6925('0x4c')]]);if(!_0x5c2204){switch(_0xd43a82['field']){case _0x6925('0x63'):if(_0xd43a82[_0x6925('0x64')]==0x1){_0x3527ef['having']('`'+_0xd43a82[_0x6925('0x4c')]+_0x6925('0x65'));}else{_0x3527ef['having']('`'+_0xd43a82[_0x6925('0x4c')]+_0x6925('0x66'));}break;case'Contact':if(_0xd43a82[_0x6925('0x67')]===_0x6925('0x68')){if(_0xd43a82[_0x6925('0x64')]['split']('\x20')[_0x6925('0x61')]>0x1){_0x5357ae[_0x39b3ad](_0x6925('0x69'),qs[_0x6925('0x6a')](_0xd43a82['value']),null);}else{var _0x2d5a1d='%'+_0xd43a82[_0x6925('0x64')]+'%';_0x5357ae[_0x39b3ad](_0x6925('0x6b'),_0x2d5a1d,_0x2d5a1d,_0x2d5a1d);}}else{_0x5c2204=_[_0x6925('0x62')](_0x5d142d,[_0x6925('0x4d'),_0x6925('0x6c')]);_0xd43a82['field']=_0x6925('0x6c');_0x403922=as[_0x6925('0x6d')](_0x4b3f73,_0x5c2204[_0x6925('0x3f')],_0xd43a82);_0x5357ae[_0x39b3ad](_0x403922[_0x6925('0x6e')],_0x403922[_0x6925('0x64')]['start'],_0x403922['value'][_0x6925('0x2f')]);}break;case _0x6925('0x6f'):var _0x21dddb=_0xd43a82['value'][_0x6925('0x36')](',')[_0x6925('0x33')](function(_0x1d3882){return Number(_0x1d3882);});_0x21dddb['forEach'](function(_0x4ab5a5){_0x4ae5ca['or'](_0x6925('0x70'),'%,'+_0x4ab5a5+',%');});_0x38d75c=_[_0x6925('0x71')](_0x38d75c,_0x21dddb);break;case _0x6925('0x72'):if(_0xd43a82['operator']==='$substring'){_0x5357ae[_0x39b3ad](_0x6925('0x73'),'%'+_0xd43a82[_0x6925('0x64')]+'%',null);}else{_0x5c2204=_[_0x6925('0x62')](_0x5d142d,[_0x6925('0x4d'),'UserId']);_0xd43a82[_0x6925('0x4c')]='UserId';_0x403922=as[_0x6925('0x6d')](_0x4b3f73,_0x5c2204['type'],_0xd43a82);_0x5357ae[_0x39b3ad](_0x403922[_0x6925('0x6e')],_0x403922[_0x6925('0x64')][_0x6925('0x74')],_0x403922[_0x6925('0x64')]['end']);}break;case'plainBody':_0x403922=as[_0x6925('0x6d')]('me',null,_0xd43a82);_0x5357ae[_0x39b3ad](_0x403922[_0x6925('0x6e')],_0x403922[_0x6925('0x64')]['start'],_0x403922[_0x6925('0x64')]['end']);break;}}else{var _0x403922=as['buildExpression'](_0x4b3f73,_0x5c2204[_0x6925('0x3f')],_0xd43a82);_0x5357ae[_0x39b3ad](_0x403922[_0x6925('0x6e')],_0x403922[_0x6925('0x64')]['start'],_0x403922[_0x6925('0x64')][_0x6925('0x2f')]);}}}else{var _0x6637ab=_(_0x29c112[_0x6925('0x42')])[_0x6925('0x75')]()[_0x6925('0x33')](function(_0x44df86){return _[_0x6925('0x76')](_0x5d142d,[_0x6925('0x4d'),_0x44df86])?_0x44df86:undefined;})[_0x6925('0x77')]()[_0x6925('0x64')]();if(!_[_0x6925('0x78')](_0x6637ab)){_0x6637ab[_0x6925('0x79')](function(_0x49ef22){if(_0x49ef22===_0x6925('0x7a')){_0x3527ef[_0x6925('0x49')](_0x6925('0x7b'),[][_0x6925('0x7c')](_0x29c112[_0x6925('0x42')][_0x49ef22]));}else if(_0x49ef22===_0x6925('0x7d')){var _0x5d8765=JSON['parse'](_0x29c112['query'][_0x49ef22])['$gte'];var _0x441df1=JSON[_0x6925('0x7e')](_0x29c112['query'][_0x49ef22])[_0x6925('0x7f')];_0x3527ef[_0x6925('0x49')](_0x6925('0x80'),_0x5d8765,_0x441df1);}else{if(_0x29c112[_0x6925('0x42')][_0x49ef22]===_0x6925('0x81')){_0x3527ef[_0x6925('0x49')]('i.'+_0x49ef22+_0x6925('0x82'));}else{_0x3527ef[_0x6925('0x49')]('i.'+_0x49ef22+'\x20=\x20?',_0x29c112['query'][_0x49ef22]);}}});}if(_0x29c112['query']['read']){if(_0x29c112['query']['read']==0x1){_0x3527ef[_0x6925('0x83')](_0x6925('0x84'));}else{_0x3527ef['having']('`unreadMessages`\x20>\x200');}}if(_0x29c112[_0x6925('0x42')]['tag']){_0x38d75c=_[_0x6925('0x85')](_0x29c112[_0x6925('0x42')][_0x6925('0x86')])?_0x29c112['query'][_0x6925('0x86')]:new Array(_0x29c112[_0x6925('0x42')]['tag']);_0x38d75c[_0x6925('0x79')](function(_0x1766a6){_0x4ae5ca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1766a6+',%');});}if(_0x29c112[_0x6925('0x42')][_0x6925('0x87')]){var _0x27717b=_0x29c112[_0x6925('0x42')]['filter'][_0x6925('0x88')]('\x5c','\x5c\x5c')[_0x6925('0x88')](/'/g,'\x27\x27');if(qs[_0x6925('0x89')](_0x27717b)){_0x5357ae['or']('i.id\x20LIKE\x20?',_0x27717b+'%');}else if(qs[_0x6925('0x8a')](_0x27717b)){_0x5357ae['or'](_0x6925('0x8b'),_0x27717b+'%');}else{_0x5357ae['or'](_0x6925('0x8c'),qs['getFullTextValue'](_0x27717b))['or'](_0x6925('0x8d'),qs['getFullTextValue'](_0x27717b));}}}_0x3527ef[_0x6925('0x49')](_0x5357ae);_0x3527ef[_0x6925('0x8e')](_0x6925('0x8f'));var _0x2fc6b9={'type':db['Sequelize'][_0x6925('0x90')][_0x6925('0x91')],'raw':!![]};var _0x386c9a=_0x3527ef[_0x6925('0x92')]();_0x386c9a['field'](_0x6925('0x8f'));_0x386c9a['field'](_0x6925('0x93'),'unreadMessages');if(_0x4abd85[_0x6925('0x94')]){_0x4abd85[_0x6925('0x94')][_0x6925('0x79')](function(_0x491fbf){var _0x147b7a=_0x491fbf[0x0]===_0x6925('0x95')?_0x491fbf[0x0]:'i.'+_0x491fbf[0x0];_0x3527ef[_0x6925('0x94')](_0x147b7a,_0x491fbf[0x1]===_0x6925('0x96')?![]:!![]);});}if(!_[_0x6925('0x78')](_0x38d75c)){_0x3527ef['having'](_0x4ae5ca);_0x386c9a[_0x6925('0x49')](_0x6925('0x97'),_0x38d75c);}BPromise[_0x6925('0x98')]()['then'](function(){if(!_0x22221a){if(_0x29c112[_0x6925('0x42')][_0x6925('0x7a')])return;_0x386c9a[_0x6925('0x49')](_0x6925('0x99'));_0x3527ef['where'](_0x6925('0x99'));return;}if(_0x29c112['user']['role']!==_0x6925('0x9a'))return;return _0x29c112[_0x6925('0x9b')][_0x6925('0x9c')]({'attributes':['id'],'raw':!![]})[_0x6925('0x2d')](function(_0x380ba0){if(_[_0x6925('0x78')](_0x380ba0)){_0x386c9a[_0x6925('0x49')](_0x6925('0x9d'));_0x3527ef[_0x6925('0x49')](_0x6925('0x9d'));}else{_0x386c9a[_0x6925('0x49')](_0x6925('0x7b'),_[_0x6925('0x33')](_0x380ba0,'id'));_0x3527ef['where'](_0x6925('0x7b'),_[_0x6925('0x33')](_0x380ba0,'id'));}});})['then'](function(){if(_0x29c112[_0x6925('0x9b')][_0x6925('0x9e')]===_0x6925('0x9a')&&!_0x22221a&&!_0x29c112[_0x6925('0x42')][_0x6925('0x7a')])return[];return db[_0x6925('0x9f')][_0x6925('0x42')](_0x386c9a[_0x6925('0xa0')](),_0x2fc6b9);})[_0x6925('0x2d')](function(_0x2d3288){_0x4db80c[_0x6925('0x28')]=_0x2d3288['length'];if(_0x4db80c[_0x6925('0x28')]===0x0)return[];return db[_0x6925('0x9f')][_0x6925('0x42')](_0x6919fa[_0x6925('0xa0')](),_0x2fc6b9)[_0x6925('0x2d')](function(_0x5dda8d){_0x288f23=_[_0x6925('0xa1')](_0x5dda8d,'id');_0x2fc6b9=_[_0x6925('0xa2')](_0x2fc6b9,{'model':db[_0x6925('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x29c112['query'][_0x6925('0x45')]){_0x4abd85[_0x6925('0x46')][_0x6925('0x79')](function(_0x2da9f7){_0x3527ef[_0x6925('0x4c')]('i.'+_0x2da9f7);});}else{_0x3527ef[_0x6925('0x4c')](_0x6925('0x93'),'unreadMessages');_0x3527ef[_0x6925('0x4c')](_0x6925('0xa3'),_0x6925('0xa4'));_0x3527ef['field'](_0x6925('0xa5'),_0x6925('0xa6'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xa7'),_0x6925('0x95'));_0x3527ef[_0x6925('0x4c')](_0x6925('0x8f'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xa8'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xa9'));_0x3527ef['field'](_0x6925('0xaa'));_0x3527ef['field'](_0x6925('0xab'));_0x3527ef[_0x6925('0x4c')]('i.attach');_0x3527ef[_0x6925('0x4c')]('i.lastMsgAt');_0x3527ef['field']('i.lastMsgDirection');_0x3527ef[_0x6925('0x4c')](_0x6925('0xac'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xad'));_0x3527ef['field']('i.secondDisposition');_0x3527ef[_0x6925('0x4c')]('i.thirdDisposition');_0x3527ef[_0x6925('0x4c')]('i.substatus');_0x3527ef[_0x6925('0x4c')](_0x6925('0xae'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xaf'));_0x3527ef[_0x6925('0x4c')]('i.MailAccountId');_0x3527ef[_0x6925('0x4c')](_0x6925('0xb0'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xb1'),_0x6925('0xb2'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xb3'),_0x6925('0xb4'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xb5'),_0x6925('0xb6'));_0x3527ef['field']('c.phone','Contact.phone');_0x3527ef[_0x6925('0x4c')]('c.mobile','Contact.mobile');_0x3527ef['field']('c.fax',_0x6925('0xb7'));_0x3527ef[_0x6925('0x4c')]('o.fullname',_0x6925('0xb8'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xb9'),_0x6925('0xba'));_0x3527ef[_0x6925('0x4c')](_0x6925('0xbb'),'TagIds');}if(_0x4abd85[_0x6925('0x27')])_0x3527ef['limit'](_0x4abd85[_0x6925('0x27')]);if(_0x4abd85[_0x6925('0x25')])_0x3527ef[_0x6925('0x25')](_0x4abd85[_0x6925('0x25')]);return db['sequelize']['query'](_0x3527ef[_0x6925('0xa0')](),_0x2fc6b9);})[_0x6925('0x2d')](function(_0x1b3f47){if(_0x1b3f47[_0x6925('0x61')]>0x0)_0x398fa4['where']('ui.MailInteractionId\x20IN\x20?',_[_0x6925('0x33')](_0x1b3f47,'id'));return db[_0x6925('0x9f')][_0x6925('0x42')](_0x398fa4[_0x6925('0xa0')](),_0x2fc6b9)[_0x6925('0x2d')](function(_0x1b29be){var _0x503866=_[_0x6925('0xbc')](_0x1b29be,_0x6925('0xbd'));var _0x35b1c8=[];return db['Setting'][_0x6925('0x38')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x46725f){var _0x130587=_0x46725f['enableEmailPreview'];_0x1b3f47[_0x6925('0x79')](function(_0x258531){_0x35b1c8['push'](updateMailInteraction(_0x258531,_0x288f23,_0x503866,_0x130587));});return BPromise[_0x6925('0xbe')](_0x35b1c8);});});});})[_0x6925('0x2d')](function(_0x392ee5){_0x4db80c[_0x6925('0xbf')]=_0x392ee5;return _0x4db80c;})['then'](respondWithFilteredResult(_0x7d76d8,_0x4abd85))[_0x6925('0xc0')](handleError(_0x7d76d8,null));};exports[_0x6925('0xc1')]=function(_0x3b17f9,_0x247f56){var _0x36c56d={'raw':![],'where':{'id':_0x3b17f9[_0x6925('0xc2')]['id']}},_0x5d79cc={};_0x5d79cc['model']=_[_0x6925('0x75')](db[_0x6925('0x3d')]['rawAttributes']);_0x5d79cc[_0x6925('0x42')]=_[_0x6925('0x75')](_0x3b17f9['query']);_0x5d79cc[_0x6925('0x43')]=_[_0x6925('0x44')](_0x5d79cc[_0x6925('0x41')],_0x5d79cc[_0x6925('0x42')]);_0x36c56d['attributes']=_[_0x6925('0x44')](_0x5d79cc[_0x6925('0x41')],qs['fields'](_0x3b17f9[_0x6925('0x42')][_0x6925('0x45')]));_0x36c56d[_0x6925('0x46')]=_0x36c56d[_0x6925('0x46')][_0x6925('0x61')]?_0x36c56d[_0x6925('0x46')]:_0x5d79cc[_0x6925('0x41')];if(_0x3b17f9[_0x6925('0x42')][_0x6925('0xc3')]){_0x36c56d[_0x6925('0xc4')]=[{'all':!![]}];}_0x36c56d=_[_0x6925('0xa2')]({},_0x36c56d,_0x3b17f9[_0x6925('0xc5')]);return db['MailInteraction'][_0x6925('0x62')](_0x36c56d)[_0x6925('0x2d')](handleEntityNotFound(_0x247f56,null))['then'](respondWithResult(_0x247f56,null))[_0x6925('0xc0')](handleError(_0x247f56,null));};exports[_0x6925('0xc6')]=function(_0x2ab724,_0x269d83){return db['MailInteraction'][_0x6925('0xc6')](_0x2ab724['body'],{})['then'](respondWithResult(_0x269d83,0xc9))[_0x6925('0xc0')](handleError(_0x269d83,null));};exports['update']=function(_0x252d36,_0x244d3a){if(_0x252d36[_0x6925('0xc7')]['id']){delete _0x252d36[_0x6925('0xc7')]['id'];}return db[_0x6925('0x3d')][_0x6925('0x62')]({'where':{'id':_0x252d36[_0x6925('0xc2')]['id']}})['then'](handleEntityNotFound(_0x244d3a,null))['then'](saveUpdates(_0x252d36[_0x6925('0xc7')],null))[_0x6925('0x2d')](respondWithResult(_0x244d3a,null))[_0x6925('0xc0')](handleError(_0x244d3a,null));};exports[_0x6925('0x2e')]=function(_0x46faf0,_0x1a83fd){return db['MailInteraction'][_0x6925('0x62')]({'where':{'id':_0x46faf0[_0x6925('0xc2')]['id']}})['then'](handleEntityNotFound(_0x1a83fd,null))['then'](removeEntity(_0x1a83fd,null))[_0x6925('0xc0')](handleError(_0x1a83fd,null));};exports['describe']=function(_0x5b49e0,_0x5ca9a7){return db[_0x6925('0x3d')][_0x6925('0xc8')]()['then'](respondWithResult(_0x5ca9a7,null))[_0x6925('0xc0')](handleError(_0x5ca9a7,null));};exports[_0x6925('0xc9')]=function(_0x128007,_0x5932cd,_0x37eeb9){return db[_0x6925('0xca')][_0x6925('0x62')]({'where':{'id':_0x128007[_0x6925('0xc2')]['id']}})['then'](handleEntityNotFound(_0x5932cd,null))[_0x6925('0x2d')](function(_0x155323){if(_0x155323){return _0x155323[_0x6925('0xc9')](_0x128007['body'][_0x6925('0xcb')],_[_0x6925('0xcc')](_0x128007[_0x6925('0xc7')],[_0x6925('0xcb'),'id'])||{});}})['then'](respondWithResult(_0x5932cd,null))[_0x6925('0xc0')](handleError(_0x5932cd,null));};exports[_0x6925('0xcd')]=function(_0x2bfad9,_0x8fb599,_0x233b4e){var _0x10d575={'raw':![],'where':{}};var _0x337812={};var _0x4373dd={'count':0x0,'rows':[]};return db[_0x6925('0x3d')][_0x6925('0x38')]({'where':{'id':_0x2bfad9[_0x6925('0xc2')]['id']}})[_0x6925('0x2d')](handleEntityNotFound(_0x8fb599,null))['then'](function(_0x13c958){if(_0x13c958){_0x337812[_0x6925('0x41')]=_[_0x6925('0x75')](db[_0x6925('0xca')][_0x6925('0xce')]);_0x337812['query']=_[_0x6925('0x75')](_0x2bfad9['query']);_0x337812[_0x6925('0x43')]=_[_0x6925('0x44')](_0x337812['model'],_0x337812[_0x6925('0x42')]);_0x10d575[_0x6925('0x46')]=_[_0x6925('0x44')](_0x337812[_0x6925('0x41')],qs[_0x6925('0x45')](_0x2bfad9[_0x6925('0x42')][_0x6925('0x45')]));_0x10d575[_0x6925('0x46')]=_0x10d575['attributes'][_0x6925('0x61')]?_0x10d575[_0x6925('0x46')]:_0x337812[_0x6925('0x41')];if(!_0x2bfad9[_0x6925('0x42')]['hasOwnProperty'](_0x6925('0xcf'))){_0x10d575[_0x6925('0x27')]=qs[_0x6925('0x27')](_0x2bfad9[_0x6925('0x42')]['limit']);_0x10d575['offset']=qs['offset'](_0x2bfad9[_0x6925('0x42')][_0x6925('0x25')]);}_0x10d575[_0x6925('0x94')]=qs[_0x6925('0x48')](_0x2bfad9['query'][_0x6925('0x48')]);_0x10d575[_0x6925('0x49')]=qs[_0x6925('0x43')](_[_0x6925('0x4a')](_0x2bfad9[_0x6925('0x42')],_0x337812[_0x6925('0x43')]));_0x10d575[_0x6925('0x49')][_0x6925('0xbd')]=_0x13c958['id'];if(_0x2bfad9[_0x6925('0x42')][_0x6925('0x87')]){_0x10d575[_0x6925('0x49')]=_[_0x6925('0xa2')](_0x10d575[_0x6925('0x49')],{'$or':_[_0x6925('0x33')](_0x10d575[_0x6925('0x46')],function(_0x3d1c80){var _0xd2084b={};_0xd2084b[_0x3d1c80]={'$like':'%'+_0x2bfad9[_0x6925('0x42')][_0x6925('0x87')]+'%'};return _0xd2084b;})});}if(_0x2bfad9[_0x6925('0x42')][_0x6925('0xd0')]){var _0x4012b1=_0x2bfad9[_0x6925('0x42')][_0x6925('0xd0')]['split'](',');var _0x24cfcb={};_0x24cfcb[_0x4012b1[0x0]]={'$gte':moment(_0x4012b1[0x1])[_0x6925('0xd1')](_0x6925('0xd2'))};_0x10d575[_0x6925('0x49')]=_[_0x6925('0xa2')](_0x10d575[_0x6925('0x49')],_0x24cfcb);}_0x10d575=_[_0x6925('0xa2')]({},_0x10d575,_0x2bfad9['options']);return db[_0x6925('0xca')][_0x6925('0x28')]({'where':_0x10d575[_0x6925('0x49')]})[_0x6925('0x2d')](function(_0x495d7a){_0x4373dd[_0x6925('0x28')]=_0x495d7a;if(_0x2bfad9['query'][_0x6925('0xc3')]){_0x10d575['include']=[{'all':!![]}];}return db[_0x6925('0xca')]['findAll'](_0x10d575);})[_0x6925('0x2d')](function(_0x20f34a){if(_0x2bfad9[_0x6925('0x42')]['inlineCss']==='true'){for(var _0x26fb86=0x0;_0x26fb86<_0x20f34a['length'];_0x26fb86++){_0x20f34a[_0x26fb86][_0x6925('0xc7')]=juice(_0x20f34a[_0x26fb86][_0x6925('0xc7')]);}}_0x4373dd['rows']=_0x20f34a;return _0x4373dd;});}})[_0x6925('0x2d')](respondWithFilteredResult(_0x8fb599,_0x10d575))[_0x6925('0xc0')](handleError(_0x8fb599,null));};exports[_0x6925('0xd3')]=function(_0x10317d,_0x947141,_0x25fea2){return db[_0x6925('0x3d')]['find']({'where':{'id':_0x10317d[_0x6925('0xc2')]['id']}})[_0x6925('0x2d')](handleEntityNotFound(_0x947141,null))[_0x6925('0x2d')](function(_0x1e7403){if(_0x1e7403){return _0x1e7403[_0x6925('0xd4')](_0x10317d[_0x6925('0xc7')][_0x6925('0xcb')],_[_0x6925('0xcc')](_0x10317d['body'],[_0x6925('0xcb'),'id'])||{})[_0x6925('0xd5')](function(){return db['Tag'][_0x6925('0xd6')]({'attributes':['id',_0x6925('0x4d'),_0x6925('0x4e')],'where':{'id':_0x10317d[_0x6925('0xc7')]['ids']}});})[_0x6925('0x2d')](function(_0x3f00f2){socket[_0x6925('0xd7')](_0x6925('0xd8'),{'id':Number(_0x10317d[_0x6925('0xc2')]['id']),'tags':_0x3f00f2||[]});return{'id':Number(_0x10317d[_0x6925('0xc2')]['id']),'tags':_0x3f00f2||[]};});}})['then'](respondWithResult(_0x947141,null))[_0x6925('0xc0')](handleError(_0x947141,null));};exports[_0x6925('0xd9')]=function(_0x1e753a,_0x5f1d51,_0x5759e4){return db[_0x6925('0x3d')][_0x6925('0x62')]({'where':{'id':_0x1e753a['params']['id']}})['then'](handleEntityNotFound(_0x5f1d51,null))['then'](function(_0x10a613){if(_0x10a613){return _0x10a613[_0x6925('0xd9')](_0x1e753a[_0x6925('0x42')][_0x6925('0xcb')]);}})[_0x6925('0x2d')](respondWithStatusCode(_0x5f1d51,null))[_0x6925('0xc0')](handleError(_0x5f1d51,null));};exports['download']=function(_0x152b1f,_0x551d9e){var _0x1e4f3b=moment()['unix']()[_0x6925('0xa0')]();var _0x1c45d0=path[_0x6925('0xda')](config[_0x6925('0xdb')],_0x6925('0xdc'),_0x6925('0xdd'),_0x6925('0xde'));var _0x180ad8=path[_0x6925('0xda')](config[_0x6925('0xdb')],_0x6925('0xdc'),_0x6925('0xdd'),_0x6925('0xdf'));var _0x1e0152=path['join'](_0x1c45d0,_0x1e4f3b);var _0xaeeee7=util['format'](_0x6925('0xe0'),_0x152b1f['params']['id'],_0x1e4f3b);var _0x9a8d12=path[_0x6925('0xda')](_0x1c45d0,_0xaeeee7);var _0xdf0f33=[];if(_0x152b1f[_0x6925('0x42')][_0x6925('0xdf')]){_0xdf0f33[_0x6925('0x37')]({'model':db['Attachment'],'as':_0x6925('0xe1'),'raw':!![]});}var _0x4f4ce7=[{'model':db['MailMessage'],'as':_0x6925('0xe2'),'attributes':['id','body','from','to','cc',_0x6925('0xe3'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x6925('0x48')]('id'),'include':_0xdf0f33}];return db[_0x6925('0x3d')]['find']({'where':{'id':_0x152b1f[_0x6925('0xc2')]['id']},'include':_0x4f4ce7})[_0x6925('0x2d')](handleEntityNotFound(_0x551d9e,null))[_0x6925('0x2d')](function(_0x4e4d76){if(_0x4e4d76&&_0x4e4d76[_0x6925('0xe2')]){var _0x3d1eb6=_0x4e4d76[_0x6925('0xe4')]({'plain':!![]});fs[_0x6925('0xe5')](_0x1e0152);return BPromise[_0x6925('0xe6')](_0x3d1eb6['Messages'],function(_0x1fce0,_0x122387){var _0x551cca={'from':_0x1fce0[_0x6925('0x4f')],'to':_0x1fce0['to'],'subject':_0x1fce0[_0x6925('0xe7')],'html':_0x1fce0[_0x6925('0xc7')],'headers':{'Date':moment(_0x1fce0['createdAt'])[_0x6925('0xd1')](_0x6925('0xe8'))},'attachments':[]};if(_0x1fce0['cc']){_0x551cca[_0x6925('0xe9')]['Cc']=_0x1fce0['cc'];}if(_0x1fce0['bcc']){_0x551cca[_0x6925('0xe9')][_0x6925('0xea')]=_0x1fce0[_0x6925('0xe3')];}return new BPromise(function(_0x1bb901,_0x15f4c1){if(_0x1fce0['Attachments']){for(var _0x3b8349=0x0;_0x3b8349<_0x1fce0[_0x6925('0xe1')]['length'];_0x3b8349++){var _0x1f46cd=_0x1fce0[_0x6925('0xe1')][_0x3b8349];var _0x5f539c=path[_0x6925('0xda')](_0x180ad8,_0x1f46cd['basename']);if(fs[_0x6925('0xeb')](_0x5f539c)){_0x551cca[_0x6925('0xdf')][_0x6925('0x37')]({'name':_0x1f46cd['name'],'contentType':_0x1f46cd[_0x6925('0x3f')],'data':fs[_0x6925('0xec')](_0x5f539c)});}}}emlformat[_0x6925('0xed')](_0x551cca,function(_0xd8edda,_0x2b109c){if(_0xd8edda)return _0x15f4c1(_0xd8edda);fs['writeFileSync'](path[_0x6925('0xda')](_0x1e0152,util[_0x6925('0xd1')](_0x6925('0xee'),_0x122387)),_0x2b109c);return _0x1bb901(_0x2b109c);});});})[_0x6925('0x2d')](function(){return new BPromise(function(_0x1cbf9d,_0x4add73){zipdir(_0x1e0152,{'saveTo':_0x9a8d12},function(_0x25e07e,_0x412468){if(_0x25e07e)return _0x4add73(_0x25e07e);return _0x1cbf9d(_0x412468);});})[_0x6925('0x2d')](function(){return new BPromise(function(_0x4ce75d,_0x20c106){rimraf(_0x1e0152,function(_0x58731b){if(_0x58731b)_0x20c106(_0x58731b);return _0x4ce75d();});});})[_0x6925('0x2d')](function(){return _0x551d9e[_0x6925('0xef')](_0x9a8d12,_0xaeeee7,function(_0x578d18){if(_0x578d18){console[_0x6925('0xf0')](_0x6925('0xf1'),_0x578d18);}else{fs[_0x6925('0xf2')](_0x9a8d12);}});});});}else{return _0x551d9e[_0x6925('0x23')](0xc8);}})['catch'](handleError(_0x551d9e,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a7c6097..8fa1319 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 _0xe764=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','events','MailInteraction','setMaxListeners','save','update'];(function(_0x33f54b,_0x41df7d){var _0x191255=function(_0x1c4faf){while(--_0x1c4faf){_0x33f54b['push'](_0x33f54b['shift']());}};_0x191255(++_0x41df7d);}(_0xe764,0xcb));var _0x4e76=function(_0x1856e8,_0x4532d6){_0x1856e8=_0x1856e8-0x0;var _0x4ad341=_0xe764[_0x1856e8];return _0x4ad341;};'use strict';var EventEmitter=require(_0x4e76('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x4e76('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4e76('0x2')](0x0);var events={'afterCreate':_0x4e76('0x3'),'afterUpdate':_0x4e76('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e4136){return function(_0x2c2e0b,_0x3cd2fb,_0x41b44e){_0x2c2e0b[_0x4e76('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4bc004){_0x2c2e0b[_0x4e76('0x6')](_0x4e76('0x7'),_0x4bc004[_0x4e76('0x8')](function(_0x52322b){return{'id':_0x52322b['id']};}));return MailMessage[_0x4e76('0x9')]({'where':{'MailInteractionId':_0x2c2e0b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4e76('0xa')](function(_0x824934){_0x2c2e0b[_0x4e76('0x6')](_0x4e76('0xb'),_0x824934['length']);MailInteractionEvents[_0x4e76('0xc')](_0x5e4136+':'+_0x2c2e0b['id'],_0x2c2e0b);MailInteractionEvents[_0x4e76('0xc')](_0x5e4136,_0x2c2e0b);_0x41b44e(null);})[_0x4e76('0xd')](_0x41b44e(null));};}for(var e in events){if(events[_0x4e76('0xe')](e)){var event=events[e];MailInteraction[_0x4e76('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x0f35=['exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','getUsers','then','setDataValue','map','length','emit','catch','hook'];(function(_0x3bf1e0,_0x1580be){var _0x5a9ded=function(_0x229240){while(--_0x229240){_0x3bf1e0['push'](_0x3bf1e0['shift']());}};_0x5a9ded(++_0x1580be);}(_0x0f35,0xb5));var _0x50f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f35[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x50f3('0x0'));var MailInteraction=require(_0x50f3('0x1'))['db'][_0x50f3('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x50f3('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x50f3('0x4')](0x0);var events={'afterCreate':_0x50f3('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ea72d){return function(_0xb4fb5f,_0x186117,_0x58df63){_0xb4fb5f[_0x50f3('0x6')]({'attributes':['id'],'raw':!![]})[_0x50f3('0x7')](function(_0x5fef40){_0xb4fb5f[_0x50f3('0x8')]('Users',_0x5fef40[_0x50f3('0x9')](function(_0x374559){return{'id':_0x374559['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0xb4fb5f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a98f5){_0xb4fb5f['setDataValue']('unreadMessages',_0x2a98f5[_0x50f3('0xa')]);MailInteractionEvents['emit'](_0x1ea72d+':'+_0xb4fb5f['id'],_0xb4fb5f);MailInteractionEvents[_0x50f3('0xb')](_0x1ea72d,_0xb4fb5f);_0x58df63(null);})[_0x50f3('0xc')](_0x58df63(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x50f3('0xd')](e,emitEvent(event));}}module[_0x50f3('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 15abb7d..aa3493d 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 _0x131e=['closedAt','substatus','changed','models','MailMessage','update','then','catch','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x394322,_0x2cf44f){var _0x229cf0=function(_0x4e31c9){while(--_0x4e31c9){_0x394322['push'](_0x394322['shift']());}};_0x229cf0(++_0x2cf44f);}(_0x131e,0x1ec));var _0xe131=function(_0x2e2bb9,_0x3afb53){_0x2e2bb9=_0x2e2bb9-0x0;var _0x2cc582=_0x131e[_0x2e2bb9];return _0x2cc582;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe131('0x0'));var moment=require(_0xe131('0x1'));var BPromise=require(_0xe131('0x2'));var rp=require(_0xe131('0x3'));var fs=require('fs');var path=require(_0xe131('0x4'));var rimraf=require(_0xe131('0x5'));var config=require('../../config/environment');var attributes=require(_0xe131('0x6'));module[_0xe131('0x7')]=function(_0x2de969,_0x1eb0df){return _0x2de969[_0xe131('0x8')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0xe131('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x210bb5,_0x530ecb,_0xfdbf4c){if(_0x210bb5['substatus']){_0x210bb5[_0xe131('0xa')]=moment()[_0xe131('0xb')](_0xe131('0xc'));}if(_0x210bb5[_0xe131('0xd')]){_0x210bb5[_0xe131('0xe')]=moment()[_0xe131('0xb')](_0xe131('0xc'));}_0xfdbf4c(null,_0x530ecb);},'beforeUpdate':function(_0x555b36,_0x55768a,_0x554db6){if(_0x555b36['changed'](_0xe131('0xf'))){_0x555b36[_0xe131('0xa')]=_0x555b36[_0xe131('0xf')]?moment()[_0xe131('0xb')](_0xe131('0xc')):null;}if(_0x555b36[_0xe131('0x10')](_0xe131('0xd'))){_0x555b36[_0xe131('0xe')]=moment()[_0xe131('0xb')]('YYYY-MM-DD\x20HH:mm:ss');_0x555b36['substatus']=null;_0x555b36['substatusAt']=null;}_0x554db6(null,_0x555b36);},'afterUpdate':function(_0x5a6ca9,_0x4987dc,_0x2628e7){var _0x32091b=_0x2de969[_0xe131('0x11')];var _0x5a02b6=_0x5a6ca9['get']({'plain':!![]});if(_0x5a02b6[_0xe131('0xd')]){return _0x32091b[_0xe131('0x12')][_0xe131('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x5a02b6['id']}})[_0xe131('0x14')](function(){_0x2628e7();})[_0xe131('0x15')](function(_0x76fd26){_0x2628e7(_0x76fd26);});}else{_0x2628e7();}}},'charset':'utf8mb4','collate':_0xe131('0x16')});}; \ No newline at end of file +var _0xe3db=['update','then','catch','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','get','MailMessage'];(function(_0x5d42a0,_0x1e9149){var _0x4a2da1=function(_0x16926e){while(--_0x16926e){_0x5d42a0['push'](_0x5d42a0['shift']());}};_0x4a2da1(++_0x1e9149);}(_0xe3db,0xc8));var _0xbe3d=function(_0x95381d,_0x3a2c0b){_0x95381d=_0x95381d-0x0;var _0x581f7e=_0xe3db[_0x95381d];return _0x581f7e;};'use strict';var _=require(_0xbe3d('0x0'));var util=require(_0xbe3d('0x1'));var logger=require('../../config/logger')(_0xbe3d('0x2'));var moment=require(_0xbe3d('0x3'));var BPromise=require(_0xbe3d('0x4'));var rp=require(_0xbe3d('0x5'));var fs=require('fs');var path=require(_0xbe3d('0x6'));var rimraf=require(_0xbe3d('0x7'));var config=require(_0xbe3d('0x8'));var attributes=require(_0xbe3d('0x9'));module[_0xbe3d('0xa')]=function(_0xd5a81,_0x2b4c19){return _0xd5a81['define'](_0xbe3d('0xb'),attributes,{'tableName':_0xbe3d('0xc'),'paranoid':![],'indexes':[{'name':_0xbe3d('0xd'),'fields':[_0xbe3d('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x105b9e,_0x2aa8ff,_0x514464){if(_0x105b9e['substatus']){_0x105b9e[_0xbe3d('0xf')]=moment()[_0xbe3d('0x10')](_0xbe3d('0x11'));}if(_0x105b9e[_0xbe3d('0x12')]){_0x105b9e[_0xbe3d('0x13')]=moment()[_0xbe3d('0x10')](_0xbe3d('0x11'));}_0x514464(null,_0x2aa8ff);},'beforeUpdate':function(_0x2a772f,_0x1ff83c,_0x276e4c){if(_0x2a772f[_0xbe3d('0x14')](_0xbe3d('0x15'))){_0x2a772f['substatusAt']=_0x2a772f[_0xbe3d('0x15')]?moment()[_0xbe3d('0x10')](_0xbe3d('0x11')):null;}if(_0x2a772f[_0xbe3d('0x14')](_0xbe3d('0x12'))){_0x2a772f[_0xbe3d('0x13')]=moment()[_0xbe3d('0x10')](_0xbe3d('0x11'));_0x2a772f[_0xbe3d('0x15')]=null;_0x2a772f[_0xbe3d('0xf')]=null;}_0x276e4c(null,_0x2a772f);},'afterUpdate':function(_0x2a45ef,_0x196b9a,_0x113b23){var _0x3f8630=_0xd5a81['models'];var _0x16f473=_0x2a45ef[_0xbe3d('0x16')]({'plain':!![]});if(_0x16f473[_0xbe3d('0x12')]){return _0x3f8630[_0xbe3d('0x17')][_0xbe3d('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x16f473['id']}})[_0xbe3d('0x19')](function(){_0x113b23();})[_0xbe3d('0x1a')](function(_0x2b3db3){_0x113b23(_0x2b3db3);});}else{_0x113b23();}}},'charset':_0xbe3d('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index a2c5e30..85a7e24 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 _0x2cbd=['ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','find','ids','spread','AddTags','lodash','util','bluebird','randomstring'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x2cbd[_0x55969b];return _0x3d7fc1;};'use strict';var _=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var moment=require('moment');var BPromise=require(_0xd2cb('0x2'));var rs=require(_0xd2cb('0x3'));var fs=require('fs');var Redis=require(_0xd2cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd2cb('0x5'));var logger=require(_0xd2cb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd2cb('0x7'));var client=jayson[_0xd2cb('0x8')][_0xd2cb('0x9')]({'port':0x232a});config[_0xd2cb('0xa')]=_['defaults'](config[_0xd2cb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2cb('0xb'))(new Redis(config['redis']));require(_0xd2cb('0xc'))[_0xd2cb('0xd')](socket);function respondWithRpcPromise(_0x4b6cf4,_0x36e855,_0x216a2c){return new BPromise(function(_0x4f4a00,_0xa5ad40){return client[_0xd2cb('0xe')](_0x4b6cf4,_0x216a2c)[_0xd2cb('0xf')](function(_0x284441){logger[_0xd2cb('0x10')]('MailInteraction,\x20%s,\x20%s',_0x36e855,_0xd2cb('0x11'));logger[_0xd2cb('0x12')](_0xd2cb('0x13'),_0x36e855,_0xd2cb('0x11'),JSON[_0xd2cb('0x14')](_0x284441));if(_0x284441['error']){if(_0x284441[_0xd2cb('0x15')][_0xd2cb('0x16')]===0x1f4){logger[_0xd2cb('0x15')]('MailInteraction,\x20%s,\x20%s',_0x36e855,_0x284441[_0xd2cb('0x15')][_0xd2cb('0x17')]);return _0xa5ad40(_0x284441['error'][_0xd2cb('0x17')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x36e855,_0x284441[_0xd2cb('0x15')][_0xd2cb('0x17')]);return _0x4f4a00(_0x284441[_0xd2cb('0x15')][_0xd2cb('0x17')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x36e855,_0xd2cb('0x11'));_0x4f4a00(_0x284441[_0xd2cb('0x18')]['message']);}})[_0xd2cb('0x19')](function(_0xd74fd1){logger[_0xd2cb('0x15')]('MailInteraction,\x20%s,\x20%s',_0x36e855,_0xd74fd1);_0xa5ad40(_0xd74fd1);});});}exports[_0xd2cb('0x1a')]=function(_0x4ea157){var _0x4cf1e8=this;return new Promise(function(_0x42d379,_0x190cbb){return db[_0xd2cb('0x1b')]['update'](_0x4ea157[_0xd2cb('0x1c')],{'raw':_0x4ea157[_0xd2cb('0x1d')]?_0x4ea157[_0xd2cb('0x1d')][_0xd2cb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ea157[_0xd2cb('0x1d')]?_0x4ea157[_0xd2cb('0x1d')][_0xd2cb('0x1f')]||null:null,'attributes':_0x4ea157[_0xd2cb('0x1d')]?_0x4ea157['options'][_0xd2cb('0x20')]||null:null,'limit':_0x4ea157[_0xd2cb('0x1d')]?_0x4ea157['options'][_0xd2cb('0x21')]||null:null})[_0xd2cb('0xf')](function(_0x138498){logger[_0xd2cb('0x10')](_0xd2cb('0x1a'),_0x4ea157);logger[_0xd2cb('0x12')]('UpdateMailInteraction',_0x4ea157,JSON[_0xd2cb('0x14')](_0x138498));_0x42d379(_0x138498);})['catch'](function(_0x5978c1){logger['error'](_0xd2cb('0x1a'),_0x5978c1[_0xd2cb('0x17')],_0x4ea157);_0x190cbb(_0x4cf1e8[_0xd2cb('0x15')](0x1f4,_0x5978c1[_0xd2cb('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x30214e){return new Promise(function(_0x45f762,_0xd28ae7){return db[_0xd2cb('0x1b')][_0xd2cb('0x22')]({'where':_0x30214e[_0xd2cb('0x1d')]?_0x30214e[_0xd2cb('0x1d')][_0xd2cb('0x1f')]||null:null})[_0xd2cb('0xf')](function(_0x24dba2){if(_0x24dba2){return _0x24dba2['addTags'](_0x30214e[_0xd2cb('0x1c')][_0xd2cb('0x23')],_['omit'](_0x30214e[_0xd2cb('0x1c')],[_0xd2cb('0x23'),'id'])||{});}})[_0xd2cb('0x24')](function(_0x2f64f7){logger['info']('AddTags',_0x30214e);logger[_0xd2cb('0x12')](_0xd2cb('0x25'),_0x30214e,JSON[_0xd2cb('0x14')](_0x2f64f7));_0x45f762(_0x2f64f7);})[_0xd2cb('0x19')](function(_0x416c40){logger['error'](_0xd2cb('0x25'),_0x416c40[_0xd2cb('0x17')],_0x30214e);_0xd28ae7(_this[_0xd2cb('0x15')](0x1f4,_0x416c40[_0xd2cb('0x17')]));});});}; \ No newline at end of file +var _0x26bc=['message','result','catch','MailInteraction','update','options','raw','where','attributes','debug','UpdateMailInteraction','stringify','AddTagsToMailInteraction','find','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0x26bc,0x162));var _0xc26b=function(_0x2d551b,_0x284012){_0x2d551b=_0x2d551b-0x0;var _0x4fbca3=_0x26bc[_0x2d551b];return _0x4fbca3;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232a});config[_0xc26b('0xb')]=_['defaults'](config[_0xc26b('0xb')],{'host':_0xc26b('0xc'),'port':0x18eb});var socket=require(_0xc26b('0xd'))(new Redis(config[_0xc26b('0xb')]));require(_0xc26b('0xe'))[_0xc26b('0xf')](socket);function respondWithRpcPromise(_0x22af41,_0x9deb12,_0x373372){return new BPromise(function(_0x468863,_0x51d46c){return client[_0xc26b('0x10')](_0x22af41,_0x373372)[_0xc26b('0x11')](function(_0x196bb0){logger[_0xc26b('0x12')](_0xc26b('0x13'),_0x9deb12,_0xc26b('0x14'));logger['debug'](_0xc26b('0x15'),_0x9deb12,'request\x20sent',JSON['stringify'](_0x196bb0));if(_0x196bb0[_0xc26b('0x16')]){if(_0x196bb0[_0xc26b('0x16')][_0xc26b('0x17')]===0x1f4){logger[_0xc26b('0x16')]('MailInteraction,\x20%s,\x20%s',_0x9deb12,_0x196bb0[_0xc26b('0x16')][_0xc26b('0x18')]);return _0x51d46c(_0x196bb0[_0xc26b('0x16')][_0xc26b('0x18')]);}logger[_0xc26b('0x16')](_0xc26b('0x13'),_0x9deb12,_0x196bb0['error'][_0xc26b('0x18')]);return _0x468863(_0x196bb0[_0xc26b('0x16')]['message']);}else{logger[_0xc26b('0x12')]('MailInteraction,\x20%s,\x20%s',_0x9deb12,'request\x20sent');_0x468863(_0x196bb0[_0xc26b('0x19')]['message']);}})[_0xc26b('0x1a')](function(_0x3e5e8b){logger[_0xc26b('0x16')](_0xc26b('0x13'),_0x9deb12,_0x3e5e8b);_0x51d46c(_0x3e5e8b);});});}exports['UpdateMailInteraction']=function(_0x1c7f1b){var _0x42d60a=this;return new Promise(function(_0x2523b5,_0x8531d6){return db[_0xc26b('0x1b')][_0xc26b('0x1c')](_0x1c7f1b['body'],{'raw':_0x1c7f1b[_0xc26b('0x1d')]?_0x1c7f1b['options'][_0xc26b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7f1b[_0xc26b('0x1d')]?_0x1c7f1b[_0xc26b('0x1d')][_0xc26b('0x1f')]||null:null,'attributes':_0x1c7f1b['options']?_0x1c7f1b[_0xc26b('0x1d')][_0xc26b('0x20')]||null:null,'limit':_0x1c7f1b[_0xc26b('0x1d')]?_0x1c7f1b[_0xc26b('0x1d')]['limit']||null:null})[_0xc26b('0x11')](function(_0x367824){logger['info']('UpdateMailInteraction',_0x1c7f1b);logger[_0xc26b('0x21')](_0xc26b('0x22'),_0x1c7f1b,JSON[_0xc26b('0x23')](_0x367824));_0x2523b5(_0x367824);})[_0xc26b('0x1a')](function(_0x33e752){logger[_0xc26b('0x16')]('UpdateMailInteraction',_0x33e752[_0xc26b('0x18')],_0x1c7f1b);_0x8531d6(_0x42d60a['error'](0x1f4,_0x33e752[_0xc26b('0x18')]));});});};exports[_0xc26b('0x24')]=function(_0x302485){return new Promise(function(_0x5422df,_0x1f7d2e){return db[_0xc26b('0x1b')][_0xc26b('0x25')]({'where':_0x302485[_0xc26b('0x1d')]?_0x302485[_0xc26b('0x1d')][_0xc26b('0x1f')]||null:null})['then'](function(_0x3a8a2d){if(_0x3a8a2d){return _0x3a8a2d['addTags'](_0x302485[_0xc26b('0x26')]['ids'],_['omit'](_0x302485[_0xc26b('0x26')],[_0xc26b('0x27'),'id'])||{});}})[_0xc26b('0x28')](function(_0x49c679){logger[_0xc26b('0x12')](_0xc26b('0x29'),_0x302485);logger['debug'](_0xc26b('0x29'),_0x302485,JSON[_0xc26b('0x23')](_0x49c679));_0x5422df(_0x49c679);})[_0xc26b('0x1a')](function(_0x197634){logger[_0xc26b('0x16')](_0xc26b('0x29'),_0x197634[_0xc26b('0x18')],_0x302485);_0x1f7d2e(_this[_0xc26b('0x16')](0x1f4,_0x197634[_0xc26b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a05ce7c..80486ef 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 _0xdc90=['register','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0x3ba38b,_0x39c0be){var _0x574206=function(_0x138d19){while(--_0x138d19){_0x3ba38b['push'](_0x3ba38b['shift']());}};_0x574206(++_0x39c0be);}(_0xdc90,0x135));var _0x0dc9=function(_0x17c710,_0x4583f3){_0x17c710=_0x17c710-0x0;var _0x33493d=_0xdc90[_0x17c710];return _0x33493d;};'use strict';var MailInteractionEvents=require(_0x0dc9('0x0'));var events=['save',_0x0dc9('0x1'),_0x0dc9('0x2')];function createListener(_0x5024d0,_0x214732){return function(_0x5b026e){_0x214732['emit'](_0x5024d0,_0x5b026e);};}function removeListener(_0x1e2be8,_0x488b51){return function(){MailInteractionEvents['removeListener'](_0x1e2be8,_0x488b51);};}exports[_0x0dc9('0x3')]=function(_0x232f6a){for(var _0x54a43f=0x0,_0xc04b25=events[_0x0dc9('0x4')];_0x54a43f<_0xc04b25;_0x54a43f++){var _0x4b94e8=events[_0x54a43f];var _0x25e0fd=createListener(_0x0dc9('0x5')+_0x4b94e8,_0x232f6a);MailInteractionEvents['on'](_0x4b94e8,_0x25e0fd);}}; \ No newline at end of file +var _0xb1d4=['update','emit','removeListener','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x32d5b1,_0x519b78){var _0x24d774=function(_0x2e7773){while(--_0x2e7773){_0x32d5b1['push'](_0x32d5b1['shift']());}};_0x24d774(++_0x519b78);}(_0xb1d4,0x9d));var _0x4b1d=function(_0x3874ab,_0x1e2dec){_0x3874ab=_0x3874ab-0x0;var _0x3b90e8=_0xb1d4[_0x3874ab];return _0x3b90e8;};'use strict';var MailInteractionEvents=require(_0x4b1d('0x0'));var events=[_0x4b1d('0x1'),_0x4b1d('0x2'),_0x4b1d('0x3')];function createListener(_0x43b904,_0x21e72f){return function(_0x38ab8a){_0x21e72f[_0x4b1d('0x4')](_0x43b904,_0x38ab8a);};}function removeListener(_0x9c55c0,_0x5841d9){return function(){MailInteractionEvents[_0x4b1d('0x5')](_0x9c55c0,_0x5841d9);};}exports['register']=function(_0x1671b1){for(var _0x5330f4=0x0,_0x28e2a5=events[_0x4b1d('0x6')];_0x5330f4<_0x28e2a5;_0x5330f4++){var _0x4ec971=events[_0x5330f4];var _0x33400a=createListener(_0x4b1d('0x7')+_0x4ec971,_0x1671b1);MailInteractionEvents['on'](_0x4ec971,_0x33400a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 92c93ef..6a58f75 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 _0x2568=['index','/describe','show','/:id/download','download','post','tracked','mailmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2568,0xad));var _0x8256=function(_0x1f3409,_0x57493b){_0x1f3409=_0x1f3409-0x0;var _0x336c55=_0x2568[_0x1f3409];return _0x336c55;};'use strict';var multer=require(_0x8256('0x0'));var util=require(_0x8256('0x1'));var path=require(_0x8256('0x2'));var timeout=require(_0x8256('0x3'));var express=require(_0x8256('0x4'));var router=express[_0x8256('0x5')]();var fs_extra=require(_0x8256('0x6'));var auth=require(_0x8256('0x7'));var interaction=require(_0x8256('0x8'));var config=require(_0x8256('0x9'));var controller=require(_0x8256('0xa'));router[_0x8256('0xb')]('/',auth[_0x8256('0xc')](),controller[_0x8256('0xd')]);router[_0x8256('0xb')](_0x8256('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0x8256('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x8256('0xf')]);router['get'](_0x8256('0x10'),auth[_0x8256('0xc')](),controller[_0x8256('0x11')]);router[_0x8256('0x12')]('/',auth[_0x8256('0xc')](),interaction[_0x8256('0x13')]('mail',_0x8256('0x14')),controller['create']);router[_0x8256('0x15')](_0x8256('0x16'),auth['isAuthenticated'](),controller[_0x8256('0x17')]);router['put'](_0x8256('0x18'),auth[_0x8256('0xc')](),controller[_0x8256('0x19')]);router[_0x8256('0x15')](_0x8256('0x1a'),auth[_0x8256('0xc')](),controller[_0x8256('0x1b')]);router[_0x8256('0x1c')]('/:id',auth[_0x8256('0xc')](),controller[_0x8256('0x1d')]);module[_0x8256('0x1e')]=router; \ No newline at end of file +var _0x563b=['accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','/:id/download','download','post','tracked','mail','create','put','/:id/accept'];(function(_0x399fdf,_0x1cb22f){var _0x5628bc=function(_0x12df64){while(--_0x12df64){_0x399fdf['push'](_0x399fdf['shift']());}};_0x5628bc(++_0x1cb22f);}(_0x563b,0x113));var _0xb563=function(_0x298622,_0x86ada7){_0x298622=_0x298622-0x0;var _0x348f81=_0x563b[_0x298622];return _0x348f81;};'use strict';var multer=require('multer');var util=require(_0xb563('0x0'));var path=require(_0xb563('0x1'));var timeout=require(_0xb563('0x2'));var express=require(_0xb563('0x3'));var router=express[_0xb563('0x4')]();var fs_extra=require(_0xb563('0x5'));var auth=require(_0xb563('0x6'));var interaction=require(_0xb563('0x7'));var config=require(_0xb563('0x8'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0xb563('0x9')](),controller[_0xb563('0xa')]);router[_0xb563('0xb')](_0xb563('0xc'),auth[_0xb563('0x9')](),controller['describe']);router[_0xb563('0xb')](_0xb563('0xd'),auth[_0xb563('0x9')](),controller['show']);router[_0xb563('0xb')](_0xb563('0xe'),auth['isAuthenticated'](),controller[_0xb563('0xf')]);router[_0xb563('0x10')]('/',auth[_0xb563('0x9')](),interaction[_0xb563('0x11')](_0xb563('0x12'),'mailmessage:create'),controller[_0xb563('0x13')]);router['put'](_0xb563('0xd'),auth[_0xb563('0x9')](),controller['update']);router[_0xb563('0x14')](_0xb563('0x15'),auth['isAuthenticated'](),controller[_0xb563('0x16')]);router[_0xb563('0x14')](_0xb563('0x17'),auth[_0xb563('0x9')](),controller[_0xb563('0x18')]);router[_0xb563('0x19')](_0xb563('0xd'),auth[_0xb563('0x9')](),controller['destroy']);module[_0xb563('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 750245f..7f5a42a 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 _0xcd15=['TEXT','out','STRING','long','DATE','BOOLEAN','ENUM','Email','lodash','exports'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xcd15,0x1a2));var _0x5cd1=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xcd15[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x5cd1('0x0'));module[_0x5cd1('0x1')]={'body':{'type':Sequelize[_0x5cd1('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5cd1('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5cd1('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5cd1('0x4')](0x1fe)},'from':{'type':Sequelize[_0x5cd1('0x4')]},'to':{'type':Sequelize[_0x5cd1('0x2')](_0x5cd1('0x5'))},'cc':{'type':Sequelize[_0x5cd1('0x2')](_0x5cd1('0x5'))},'bcc':{'type':Sequelize[_0x5cd1('0x2')](_0x5cd1('0x5'))},'subject':{'type':Sequelize[_0x5cd1('0x2')]},'sentAt':{'type':Sequelize[_0x5cd1('0x6')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5cd1('0x7')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5cd1('0x6')]},'originTo':{'type':Sequelize[_0x5cd1('0x2')]('long')},'originCc':{'type':Sequelize['TEXT'](_0x5cd1('0x5'))},'originChannel':{'type':Sequelize[_0x5cd1('0x8')](_0x5cd1('0x9'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x3449=['INTEGER','ENUM','Chat','Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN','out','STRING','long','DATE'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x3449,0x146));var _0x9344=function(_0x1e9e90,_0x36f7db){_0x1e9e90=_0x1e9e90-0x0;var _0x1d6f64=_0x3449[_0x1e9e90];return _0x1d6f64;};'use strict';var Sequelize=require(_0x9344('0x0'));var _=require(_0x9344('0x1'));module[_0x9344('0x2')]={'body':{'type':Sequelize[_0x9344('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9344('0x3')](_0x9344('0x4'))},'read':{'type':Sequelize[_0x9344('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9344('0x6')),'defaultValue':_0x9344('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9344('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x9344('0x3')](_0x9344('0x8'))},'cc':{'type':Sequelize[_0x9344('0x3')]('long')},'bcc':{'type':Sequelize[_0x9344('0x3')](_0x9344('0x8'))},'subject':{'type':Sequelize[_0x9344('0x3')]},'sentAt':{'type':Sequelize[_0x9344('0x9')]},'attach':{'type':Sequelize[_0x9344('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9344('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9344('0x9')]},'originTo':{'type':Sequelize[_0x9344('0x3')](_0x9344('0x8'))},'originCc':{'type':Sequelize[_0x9344('0x3')](_0x9344('0x8'))},'originChannel':{'type':Sequelize[_0x9344('0xb')]('Email',_0x9344('0xc')),'defaultValue':_0x9344('0xd'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4d956b3..e5a0662 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 _0xbacb=['Contact','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','cf_','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','startsWith','push','QueryTypes','SELECT','rejectmessage','download','unix','toString','join','root','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','Attachments','headers','bcc','Bcc','basename','existsSync','readFileSync','build','writeFileSync','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','destroy','end','stack','map','MailMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','update','body','find','params','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','isNil','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','server/files/attachments','List','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','read','readAt','UserId','agent'];(function(_0x2e1a2,_0x81aa1c){var _0x3df6c8=function(_0x54d755){while(--_0x54d755){_0x2e1a2['push'](_0x2e1a2['shift']());}};_0x3df6c8(++_0x81aa1c);}(_0xbacb,0x1a6));var _0xbbac=function(_0x47549e,_0x1d590f){_0x47549e=_0x47549e-0x0;var _0x33a9da=_0xbacb[_0x47549e];return _0x33a9da;};'use strict';var emlformat=require(_0xbbac('0x0'));var rimraf=require(_0xbbac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbac('0x2'));var rp=require(_0xbbac('0x3'));var moment=require(_0xbbac('0x4'));var BPromise=require(_0xbbac('0x5'));var Mustache=require(_0xbbac('0x6'));var util=require(_0xbbac('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbbac('0x8'));var ejs=require(_0xbbac('0x9'));var fs=require('fs');var fs_extra=require(_0xbbac('0xa'));var _=require(_0xbbac('0xb'));var squel=require('squel');var crypto=require(_0xbbac('0xc'));var jsforce=require(_0xbbac('0xd'));var deskjs=require(_0xbbac('0xe'));var toCsv=require(_0xbbac('0x8'));var querystring=require(_0xbbac('0xf'));var Papa=require(_0xbbac('0x10'));var Redis=require('ioredis');var authService=require(_0xbbac('0x11'));var qs=require(_0xbbac('0x12'));var as=require(_0xbbac('0x13'));var hardwareService=require(_0xbbac('0x14'));var logger=require(_0xbbac('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbbac('0x16'));var licenseUtil=require(_0xbbac('0x17'));var db=require(_0xbbac('0x18'))['db'];config['redis']=_[_0xbbac('0x19')](config['redis'],{'host':_0xbbac('0x1a'),'port':0x18eb});var socket=require(_0xbbac('0x1b'))(new Redis(config['redis']));require(_0xbbac('0x1c'))[_0xbbac('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbbac('0x1e')][_0xbbac('0x1f')]({'port':0x232c});var client9003=jayson[_0xbbac('0x1e')][_0xbbac('0x1f')]({'port':0x232b});var client9002=jayson['client'][_0xbbac('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x282a21,_0x23f578,_0x31b551,_0xa10fef){return new BPromise(function(_0x597916,_0x5d0c0b){var _0x1ed67d=_0xa10fef||client;return _0x1ed67d[_0xbbac('0x20')](_0x282a21,_0x31b551)[_0xbbac('0x21')](function(_0x53cb9c){logger['info'](_0xbbac('0x22'),_0x23f578,_0xbbac('0x23'));logger[_0xbbac('0x24')](_0xbbac('0x25'),_0x23f578,_0xbbac('0x23'),JSON[_0xbbac('0x26')](_0x53cb9c));if(_0x53cb9c[_0xbbac('0x27')]){if(_0x53cb9c[_0xbbac('0x27')][_0xbbac('0x28')]===0x1f4){logger['error'](_0xbbac('0x22'),_0x23f578,_0x53cb9c['error'][_0xbbac('0x29')]);return _0x5d0c0b(_0x53cb9c[_0xbbac('0x27')]['message']);}logger[_0xbbac('0x27')]('MailMessage,\x20%s,\x20%s',_0x23f578,_0x53cb9c[_0xbbac('0x27')][_0xbbac('0x29')]);return _0x597916(_0x53cb9c[_0xbbac('0x27')][_0xbbac('0x29')]);}else{logger[_0xbbac('0x2a')](_0xbbac('0x22'),_0x23f578,_0xbbac('0x23'));_0x597916(_0x53cb9c['result'][_0xbbac('0x29')]);}})[_0xbbac('0x2b')](function(_0x3ead07){logger[_0xbbac('0x27')]('MailMessage,\x20%s,\x20%s',_0x23f578,_0x3ead07);_0x5d0c0b(_0x3ead07);});});}function respondWithStatusCode(_0x448ad5,_0x19681c){_0x19681c=_0x19681c||0xcc;return function(_0x19df63){if(_0x19df63){return _0x448ad5[_0xbbac('0x2c')](_0x19681c);}return _0x448ad5[_0xbbac('0x2d')](_0x19681c)['end']();};}function respondWithResult(_0x40da4f,_0xd12324){_0xd12324=_0xd12324||0xc8;return function(_0x483d12){if(_0x483d12){return _0x40da4f['status'](_0xd12324)[_0xbbac('0x2e')](_0x483d12);}};}function respondWithFilteredResult(_0x48e768,_0x10c4ae){return function(_0x30d552){if(_0x30d552){var _0x9f28be=typeof _0x10c4ae['offset']===_0xbbac('0x2f')&&typeof _0x10c4ae[_0xbbac('0x30')]===_0xbbac('0x2f');var _0x44a672=_0x30d552[_0xbbac('0x31')];var _0x1255ab=_0x9f28be?0x0:_0x10c4ae['offset'];var _0x551f8a=_0x9f28be?_0x30d552[_0xbbac('0x31')]:_0x10c4ae[_0xbbac('0x32')]+_0x10c4ae['limit'];var _0x3e42a2;if(_0x551f8a>=_0x44a672){_0x551f8a=_0x44a672;_0x3e42a2=0xc8;}else{_0x3e42a2=0xce;}_0x48e768[_0xbbac('0x2d')](_0x3e42a2);return _0x48e768['set'](_0xbbac('0x33'),_0x1255ab+'-'+_0x551f8a+'/'+_0x44a672)[_0xbbac('0x2e')](_0x30d552);}return null;};}function patchUpdates(_0x20701f){return function(_0x5ee4d3){try{jsonpatch[_0xbbac('0x34')](_0x5ee4d3,_0x20701f,!![]);}catch(_0x34a93f){return BPromise[_0xbbac('0x35')](_0x34a93f);}return _0x5ee4d3['save']();};}function saveUpdates(_0x3a5b77,_0x44df8b){return function(_0xbb6960){if(_0xbb6960){return _0xbb6960['update'](_0x3a5b77)['then'](function(_0x5e87b3){return _0x5e87b3;});}return null;};}function removeEntity(_0x3fd372,_0x18a5d9){return function(_0x145bf6){if(_0x145bf6){return _0x145bf6[_0xbbac('0x36')]()['then'](function(){_0x3fd372['status'](0xcc)[_0xbbac('0x37')]();});}};}function handleEntityNotFound(_0x250937,_0x422411){return function(_0x5c15eb){if(!_0x5c15eb){_0x250937[_0xbbac('0x2c')](0x194);}return _0x5c15eb;};}function handleError(_0xc167fd,_0x295f30){_0x295f30=_0x295f30||0x1f4;return function(_0x48c379){logger[_0xbbac('0x27')](_0x48c379[_0xbbac('0x38')]);if(_0x48c379['name']){delete _0x48c379['name'];}_0xc167fd[_0xbbac('0x2d')](_0x295f30)['send'](_0x48c379);};}exports['index']=function(_0x53e510,_0x2233e2){var _0xd4b0fb={},_0x586e49={},_0x2bfa0b={'count':0x0,'rows':[]};var _0x37fc7f=_[_0xbbac('0x39')](db[_0xbbac('0x3a')][_0xbbac('0x3b')],function(_0x1e7dbf){return{'name':_0x1e7dbf[_0xbbac('0x3c')],'type':_0x1e7dbf[_0xbbac('0x3d')][_0xbbac('0x3e')]};});_0x586e49[_0xbbac('0x3f')]=_[_0xbbac('0x39')](_0x37fc7f,_0xbbac('0x40'));_0x586e49[_0xbbac('0x41')]=_[_0xbbac('0x42')](_0x53e510[_0xbbac('0x41')]);_0x586e49[_0xbbac('0x43')]=_[_0xbbac('0x44')](_0x586e49[_0xbbac('0x3f')],_0x586e49['query']);_0xd4b0fb['attributes']=_[_0xbbac('0x44')](_0x586e49['model'],qs[_0xbbac('0x45')](_0x53e510[_0xbbac('0x41')][_0xbbac('0x45')]));_0xd4b0fb['attributes']=_0xd4b0fb[_0xbbac('0x46')][_0xbbac('0x47')]?_0xd4b0fb[_0xbbac('0x46')]:_0x586e49[_0xbbac('0x3f')];if(!_0x53e510[_0xbbac('0x41')][_0xbbac('0x48')](_0xbbac('0x49'))){_0xd4b0fb[_0xbbac('0x30')]=qs[_0xbbac('0x30')](_0x53e510[_0xbbac('0x41')][_0xbbac('0x30')]);_0xd4b0fb['offset']=qs[_0xbbac('0x32')](_0x53e510[_0xbbac('0x41')][_0xbbac('0x32')]);}_0xd4b0fb[_0xbbac('0x4a')]=qs[_0xbbac('0x4b')](_0x53e510['query'][_0xbbac('0x4b')]);_0xd4b0fb[_0xbbac('0x4c')]=qs['filters'](_[_0xbbac('0x4d')](_0x53e510['query'],_0x586e49[_0xbbac('0x43')]),_0x37fc7f);if(_0x53e510[_0xbbac('0x41')][_0xbbac('0x4e')]){_0xd4b0fb[_0xbbac('0x4c')]=_['merge'](_0xd4b0fb['where'],{'$or':_[_0xbbac('0x39')](_0x37fc7f,function(_0x522555){if(_0x522555[_0xbbac('0x3d')]!=='VIRTUAL'){var _0x19ab8d={};_0x19ab8d[_0x522555[_0xbbac('0x40')]]={'$like':'%'+_0x53e510[_0xbbac('0x41')][_0xbbac('0x4e')]+'%'};return _0x19ab8d;}})});}_0xd4b0fb=_[_0xbbac('0x4f')]({},_0xd4b0fb,_0x53e510['options']);var _0x312c4f={'where':_0xd4b0fb[_0xbbac('0x4c')]};return db[_0xbbac('0x3a')]['count'](_0x312c4f)[_0xbbac('0x21')](function(_0x5f44a8){_0x2bfa0b['count']=_0x5f44a8;if(_0x53e510['query'][_0xbbac('0x50')]){_0xd4b0fb[_0xbbac('0x51')]=[{'all':!![]}];}return db[_0xbbac('0x3a')][_0xbbac('0x52')](_0xd4b0fb);})['then'](function(_0x61889c){_0x2bfa0b[_0xbbac('0x53')]=_0x61889c;return _0x2bfa0b;})['then'](respondWithFilteredResult(_0x2233e2,_0xd4b0fb))[_0xbbac('0x2b')](handleError(_0x2233e2,null));};exports[_0xbbac('0x54')]=function(_0x55937c,_0x221f34){var _0x54f9bb={'raw':!![],'where':{'id':_0x55937c['params']['id']}},_0x41cac6={};_0x41cac6[_0xbbac('0x3f')]=_[_0xbbac('0x42')](db[_0xbbac('0x3a')]['rawAttributes']);_0x41cac6[_0xbbac('0x41')]=_[_0xbbac('0x42')](_0x55937c[_0xbbac('0x41')]);_0x41cac6[_0xbbac('0x43')]=_['intersection'](_0x41cac6['model'],_0x41cac6[_0xbbac('0x41')]);_0x54f9bb[_0xbbac('0x46')]=_['intersection'](_0x41cac6[_0xbbac('0x3f')],qs['fields'](_0x55937c['query'][_0xbbac('0x45')]));_0x54f9bb['attributes']=_0x54f9bb['attributes']['length']?_0x54f9bb['attributes']:_0x41cac6[_0xbbac('0x3f')];if(_0x55937c[_0xbbac('0x41')][_0xbbac('0x50')]){_0x54f9bb['include']=[{'all':!![]}];}_0x54f9bb=_[_0xbbac('0x4f')]({},_0x54f9bb,_0x55937c['options']);return db[_0xbbac('0x3a')]['find'](_0x54f9bb)['then'](handleEntityNotFound(_0x221f34,null))['then'](respondWithResult(_0x221f34,null))['catch'](handleError(_0x221f34,null));};exports[_0xbbac('0x55')]=function(_0x4ed2f4,_0x379141){if(_0x4ed2f4[_0xbbac('0x56')]['id']){delete _0x4ed2f4[_0xbbac('0x56')]['id'];}return db['MailMessage'][_0xbbac('0x57')]({'where':{'id':_0x4ed2f4[_0xbbac('0x58')]['id']}})[_0xbbac('0x21')](handleEntityNotFound(_0x379141,null))[_0xbbac('0x21')](saveUpdates(_0x4ed2f4[_0xbbac('0x56')],null))[_0xbbac('0x21')](respondWithResult(_0x379141,null))[_0xbbac('0x2b')](handleError(_0x379141,null));};exports['destroy']=function(_0x4cc75f,_0x496493){return db[_0xbbac('0x3a')][_0xbbac('0x57')]({'where':{'id':_0x4cc75f[_0xbbac('0x58')]['id']}})['then'](handleEntityNotFound(_0x496493,null))[_0xbbac('0x21')](removeEntity(_0x496493,null))['catch'](handleError(_0x496493,null));};exports[_0xbbac('0x59')]=function(_0x35d896,_0x9803b9){return db[_0xbbac('0x3a')][_0xbbac('0x59')]()[_0xbbac('0x21')](respondWithResult(_0x9803b9,null))[_0xbbac('0x2b')](handleError(_0x9803b9,null));};exports['create']=function(_0x4a5e5b,_0x5d8f63){return db['MailMessage'][_0xbbac('0x5a')](_0x4a5e5b['body'])['then'](function(_0x3b740f){if(_0x3b740f){if(_0x3b740f['direction']===_0xbbac('0x5b')&&!_0x3b740f[_0xbbac('0x5c')]){var _0x8e5218,_0x33a443,_0x23a523;if(_0x4a5e5b[_0xbbac('0x56')]['to']){_0x33a443=_0x4a5e5b[_0xbbac('0x56')]['to'][_0xbbac('0x5d')](',')[0x0];}return db[_0xbbac('0x5e')][_0xbbac('0x5f')]({'where':{'id':_0x3b740f[_0xbbac('0x60')]},'include':[{'model':db[_0xbbac('0x61')],'as':'List','include':[{'model':db[_0xbbac('0x62')],'as':_0xbbac('0x63'),'where':{'email':_0x33a443},'limit':0x1,'order':[[_0xbbac('0x64'),_0xbbac('0x65')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xbbac('0x21')](function(_0xf99d02){_0x8e5218=_0xf99d02;if(_0x8e5218&&_0x8e5218['Smtp']){var _0x41b3e3={'tls':{'rejectUnauthorized':![]}};if(_[_0xbbac('0x66')](_0x8e5218[_0xbbac('0x67')][_0xbbac('0x68')])){_0x41b3e3['host']=_0x8e5218[_0xbbac('0x67')][_0xbbac('0x69')];_0x41b3e3[_0xbbac('0x6a')]=_0x8e5218['Smtp'][_0xbbac('0x6a')];_0x41b3e3[_0xbbac('0x6b')]=_0x8e5218['Smtp'][_0xbbac('0x6b')];if(_0x8e5218[_0xbbac('0x67')][_0xbbac('0x6c')]){_0x41b3e3[_0xbbac('0x6d')]={'user':_0x8e5218['Smtp'][_0xbbac('0x6e')],'pass':_0x8e5218[_0xbbac('0x67')][_0xbbac('0x6f')]};}}else{_0x41b3e3[_0xbbac('0x68')]=_0x8e5218[_0xbbac('0x67')][_0xbbac('0x68')];_0x41b3e3[_0xbbac('0x6d')]={'user':_0x8e5218[_0xbbac('0x67')][_0xbbac('0x6e')],'pass':_0x8e5218[_0xbbac('0x67')][_0xbbac('0x6f')]};_0x41b3e3[_0xbbac('0x6b')]=_0x8e5218['Smtp'][_0xbbac('0x6b')];}if(_0x4a5e5b['body'][_0xbbac('0x70')]&&_0x4a5e5b[_0xbbac('0x56')][_0xbbac('0x70')]['length']){for(var _0x454e48=0x0;_0x454e48<_0x4a5e5b['body']['attachments'][_0xbbac('0x47')];_0x454e48+=0x1){_0x4a5e5b[_0xbbac('0x56')]['attachments'][_0x454e48]={'filename':_0x4a5e5b[_0xbbac('0x56')][_0xbbac('0x70')][_0x454e48]['name'],'path':path['join'](config['root'],_0xbbac('0x71'),_0x4a5e5b[_0xbbac('0x56')][_0xbbac('0x70')][_0x454e48]['basename'])};}}_0x23a523={'account':_0x41b3e3,'message':_0x4a5e5b['body']};return;}})[_0xbbac('0x21')](function(){if(_0x8e5218['List']){if(_0x8e5218['List'][_0xbbac('0x63')]['length']){return _0x8e5218[_0xbbac('0x72')][_0xbbac('0x63')][0x0];}else{return db['CmContact']['create'](_[_0xbbac('0x19')](_0x4a5e5b[_0xbbac('0x56')],{'firstName':_0x4a5e5b['body']['to'],'email':_0x4a5e5b['body']['to'],'phone':_0x4a5e5b[_0xbbac('0x56')]['to'],'ListId':_0x8e5218['ListId']}));}}else{throw new Error(_0xbbac('0x73'));}})[_0xbbac('0x21')](function(){if(_0x23a523){return respondWithRpcPromise(_0xbbac('0x74'),_0xbbac('0x75'),_0x23a523,client9003)[_0xbbac('0x21')](function(_0x427d56){return _0x3b740f[_0xbbac('0x55')]({'read':!![],'messageId':_0x427d56[_0xbbac('0x76')],'sentAt':moment()[_0xbbac('0x77')](_0xbbac('0x78'))});})['catch'](function(_0x51e39e){logger[_0xbbac('0x27')]('%s',JSON[_0xbbac('0x26')](_0x51e39e));return _0x3b740f;});}return _0x3b740f;});}return _0x3b740f;}})[_0xbbac('0x21')](respondWithResult(_0x5d8f63,0xc9))[_0xbbac('0x2b')](handleError(_0x5d8f63,null));};var interaction_log=require(_0xbbac('0x15'))(_0xbbac('0x79'));exports[_0xbbac('0x7a')]=function(_0x20e9c2,_0x1417cd,_0x21d447){var _0x3e3c34={'agent':{},'channel':'mail'};if(_0x20e9c2['body']['id']){delete _0x20e9c2[_0xbbac('0x56')]['id'];}_0x20e9c2[_0xbbac('0x56')][_0xbbac('0x7b')]=!![];_0x20e9c2[_0xbbac('0x56')][_0xbbac('0x7c')]=moment()[_0xbbac('0x77')](_0xbbac('0x78'));_0x20e9c2['body'][_0xbbac('0x7d')]=_0x20e9c2[_0xbbac('0x56')][_0xbbac('0x7d')]||_0x20e9c2[_0xbbac('0x6e')]['id'];_0x3e3c34[_0xbbac('0x7e')]['id']=_0x20e9c2[_0xbbac('0x56')][_0xbbac('0x7d')];return db[_0xbbac('0x3a')][_0xbbac('0x57')]({'where':{'id':_0x20e9c2[_0xbbac('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xbbac('0x7f')}]})[_0xbbac('0x21')](handleEntityNotFound(_0x1417cd,null))[_0xbbac('0x21')](saveUpdates(_0x20e9c2[_0xbbac('0x56')],null))[_0xbbac('0x21')](function(_0x553354){if(_0x553354){_0x3e3c34[_0xbbac('0x29')]=_0x553354[_0xbbac('0x80')]({'plain':!![]});return db['MailInteraction'][_0xbbac('0x57')]({'where':{'id':_0x553354[_0xbbac('0x81')]}});}return null;})[_0xbbac('0x21')](handleEntityNotFound(_0x1417cd,null))[_0xbbac('0x21')](function(_0x15fa97){if(_0x15fa97){return _0x15fa97[_0xbbac('0x55')]({'UserId':_0x20e9c2[_0xbbac('0x56')]['UserId'],'read1stAt':_[_0xbbac('0x66')](_0x15fa97[_0xbbac('0x82')])?moment()[_0xbbac('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbbac('0x21')](function(_0x1a276e){if(_0x1a276e){_0x3e3c34[_0xbbac('0x83')]=_0x1a276e[_0xbbac('0x80')]({'plain':!![]});interaction_log['info'](_0xbbac('0x84'),_0x20e9c2[_0xbbac('0x6e')]['id'],_0x20e9c2['user']['name'],_0x20e9c2['user'][_0xbbac('0x85')],_0x3e3c34[_0xbbac('0x83')]['id'],_0x20e9c2[_0xbbac('0x56')]?JSON[_0xbbac('0x26')](_0x20e9c2[_0xbbac('0x56')]):_0xbbac('0x86'));return respondWithRpcPromise(_0xbbac('0x87'),_0xbbac('0x88'),_0x3e3c34);}return null;})[_0xbbac('0x21')](function(_0x436d5a){return db[_0xbbac('0x62')][_0xbbac('0x59')]()['then'](function(_0x14493a){var _0x5938b2=[];for(var _0x14558b=0x0;_0x14558b=_0x4ee7a5){_0x2b6836=_0x4ee7a5;_0x59a405=0xc8;}else{_0x59a405=0xce;}_0x39069b[_0x4d63('0x2f')](_0x59a405);return _0x39069b[_0x4d63('0x36')](_0x4d63('0x37'),_0x4fd372+'-'+_0x2b6836+'/'+_0x4ee7a5)[_0x4d63('0x31')](_0x61accd);}return null;};}function patchUpdates(_0x56063e){return function(_0x2878f4){try{jsonpatch[_0x4d63('0x38')](_0x2878f4,_0x56063e,!![]);}catch(_0x3480ce){return BPromise['reject'](_0x3480ce);}return _0x2878f4[_0x4d63('0x39')]();};}function saveUpdates(_0x5d125f,_0x53b6e1){return function(_0x10fa6b){if(_0x10fa6b){return _0x10fa6b[_0x4d63('0x3a')](_0x5d125f)['then'](function(_0x372230){return _0x372230;});}return null;};}function removeEntity(_0x117c44,_0x319a06){return function(_0x346b1b){if(_0x346b1b){return _0x346b1b[_0x4d63('0x3b')]()['then'](function(){_0x117c44[_0x4d63('0x2f')](0xcc)[_0x4d63('0x30')]();});}};}function handleEntityNotFound(_0x3c7d04,_0x553f56){return function(_0x2dba14){if(!_0x2dba14){_0x3c7d04[_0x4d63('0x2e')](0x194);}return _0x2dba14;};}function handleError(_0x5a56bd,_0x2495e5){_0x2495e5=_0x2495e5||0x1f4;return function(_0x197a3d){logger[_0x4d63('0x28')](_0x197a3d['stack']);if(_0x197a3d[_0x4d63('0x3c')]){delete _0x197a3d[_0x4d63('0x3c')];}_0x5a56bd[_0x4d63('0x2f')](_0x2495e5)[_0x4d63('0x3d')](_0x197a3d);};}exports['index']=function(_0x3a4893,_0x2fc0fe){var _0x59b19a={},_0x4f4eaa={},_0x1a59b5={'count':0x0,'rows':[]};var _0x4f4874=_[_0x4d63('0x3e')](db['MailMessage']['rawAttributes'],function(_0x7cba2d){return{'name':_0x7cba2d[_0x4d63('0x3f')],'type':_0x7cba2d[_0x4d63('0x40')][_0x4d63('0x41')]};});_0x4f4eaa[_0x4d63('0x42')]=_[_0x4d63('0x3e')](_0x4f4874,_0x4d63('0x3c'));_0x4f4eaa['query']=_[_0x4d63('0x43')](_0x3a4893[_0x4d63('0x44')]);_0x4f4eaa[_0x4d63('0x45')]=_['intersection'](_0x4f4eaa['model'],_0x4f4eaa['query']);_0x59b19a[_0x4d63('0x46')]=_[_0x4d63('0x47')](_0x4f4eaa[_0x4d63('0x42')],qs[_0x4d63('0x48')](_0x3a4893['query'][_0x4d63('0x48')]));_0x59b19a[_0x4d63('0x46')]=_0x59b19a[_0x4d63('0x46')][_0x4d63('0x49')]?_0x59b19a['attributes']:_0x4f4eaa[_0x4d63('0x42')];if(!_0x3a4893[_0x4d63('0x44')][_0x4d63('0x4a')](_0x4d63('0x4b'))){_0x59b19a['limit']=qs[_0x4d63('0x34')](_0x3a4893[_0x4d63('0x44')][_0x4d63('0x34')]);_0x59b19a[_0x4d63('0x32')]=qs['offset'](_0x3a4893[_0x4d63('0x44')][_0x4d63('0x32')]);}_0x59b19a[_0x4d63('0x4c')]=qs[_0x4d63('0x4d')](_0x3a4893[_0x4d63('0x44')][_0x4d63('0x4d')]);_0x59b19a[_0x4d63('0x4e')]=qs[_0x4d63('0x45')](_[_0x4d63('0x4f')](_0x3a4893[_0x4d63('0x44')],_0x4f4eaa[_0x4d63('0x45')]),_0x4f4874);if(_0x3a4893[_0x4d63('0x44')][_0x4d63('0x50')]){_0x59b19a[_0x4d63('0x4e')]=_['merge'](_0x59b19a[_0x4d63('0x4e')],{'$or':_[_0x4d63('0x3e')](_0x4f4874,function(_0x305242){if(_0x305242[_0x4d63('0x40')]!==_0x4d63('0x51')){var _0x30ace9={};_0x30ace9[_0x305242[_0x4d63('0x3c')]]={'$like':'%'+_0x3a4893[_0x4d63('0x44')][_0x4d63('0x50')]+'%'};return _0x30ace9;}})});}_0x59b19a=_[_0x4d63('0x52')]({},_0x59b19a,_0x3a4893[_0x4d63('0x53')]);var _0x31de25={'where':_0x59b19a['where']};return db[_0x4d63('0x54')][_0x4d63('0x35')](_0x31de25)[_0x4d63('0x24')](function(_0x24e5e5){_0x1a59b5[_0x4d63('0x35')]=_0x24e5e5;if(_0x3a4893[_0x4d63('0x44')][_0x4d63('0x55')]){_0x59b19a[_0x4d63('0x56')]=[{'all':!![]}];}return db[_0x4d63('0x54')][_0x4d63('0x57')](_0x59b19a);})[_0x4d63('0x24')](function(_0x1356b5){_0x1a59b5[_0x4d63('0x58')]=_0x1356b5;return _0x1a59b5;})['then'](respondWithFilteredResult(_0x2fc0fe,_0x59b19a))['catch'](handleError(_0x2fc0fe,null));};exports[_0x4d63('0x59')]=function(_0x215be2,_0x3e476b){var _0x3f82d3={'raw':!![],'where':{'id':_0x215be2[_0x4d63('0x5a')]['id']}},_0xec809f={};_0xec809f[_0x4d63('0x42')]=_['keys'](db[_0x4d63('0x54')][_0x4d63('0x5b')]);_0xec809f['query']=_[_0x4d63('0x43')](_0x215be2[_0x4d63('0x44')]);_0xec809f[_0x4d63('0x45')]=_[_0x4d63('0x47')](_0xec809f[_0x4d63('0x42')],_0xec809f[_0x4d63('0x44')]);_0x3f82d3['attributes']=_[_0x4d63('0x47')](_0xec809f[_0x4d63('0x42')],qs[_0x4d63('0x48')](_0x215be2['query'][_0x4d63('0x48')]));_0x3f82d3['attributes']=_0x3f82d3['attributes'][_0x4d63('0x49')]?_0x3f82d3[_0x4d63('0x46')]:_0xec809f[_0x4d63('0x42')];if(_0x215be2[_0x4d63('0x44')][_0x4d63('0x55')]){_0x3f82d3[_0x4d63('0x56')]=[{'all':!![]}];}_0x3f82d3=_[_0x4d63('0x52')]({},_0x3f82d3,_0x215be2[_0x4d63('0x53')]);return db[_0x4d63('0x54')][_0x4d63('0x5c')](_0x3f82d3)[_0x4d63('0x24')](handleEntityNotFound(_0x3e476b,null))[_0x4d63('0x24')](respondWithResult(_0x3e476b,null))[_0x4d63('0x2d')](handleError(_0x3e476b,null));};exports[_0x4d63('0x3a')]=function(_0x3eac75,_0x5d68e8){if(_0x3eac75[_0x4d63('0x5d')]['id']){delete _0x3eac75[_0x4d63('0x5d')]['id'];}return db[_0x4d63('0x54')][_0x4d63('0x5c')]({'where':{'id':_0x3eac75['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x5d68e8,null))[_0x4d63('0x24')](saveUpdates(_0x3eac75[_0x4d63('0x5d')],null))[_0x4d63('0x24')](respondWithResult(_0x5d68e8,null))[_0x4d63('0x2d')](handleError(_0x5d68e8,null));};exports[_0x4d63('0x3b')]=function(_0x5972c2,_0x4efcbb){return db['MailMessage'][_0x4d63('0x5c')]({'where':{'id':_0x5972c2['params']['id']}})['then'](handleEntityNotFound(_0x4efcbb,null))[_0x4d63('0x24')](removeEntity(_0x4efcbb,null))[_0x4d63('0x2d')](handleError(_0x4efcbb,null));};exports[_0x4d63('0x5e')]=function(_0x5067dc,_0x24932f){return db[_0x4d63('0x54')][_0x4d63('0x5e')]()[_0x4d63('0x24')](respondWithResult(_0x24932f,null))[_0x4d63('0x2d')](handleError(_0x24932f,null));};exports['create']=function(_0x2c84db,_0x3d05df){return db[_0x4d63('0x54')][_0x4d63('0x5f')](_0x2c84db[_0x4d63('0x5d')])['then'](function(_0x4d1e59){if(_0x4d1e59){if(_0x4d1e59[_0x4d63('0x60')]===_0x4d63('0x61')&&!_0x4d1e59[_0x4d63('0x62')]){var _0x13570a,_0x46428c,_0xe9df5a;if(_0x2c84db['body']['to']){_0x46428c=_0x2c84db['body']['to']['split'](',')[0x0];}return db[_0x4d63('0x63')][_0x4d63('0x64')]({'where':{'id':_0x4d1e59[_0x4d63('0x65')]},'include':[{'model':db['CmList'],'as':_0x4d63('0x66'),'include':[{'model':db[_0x4d63('0x67')],'as':'Contacts','where':{'email':_0x46428c},'limit':0x1,'order':[[_0x4d63('0x68'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x4d63('0x69'),'raw':!![]}]})[_0x4d63('0x24')](function(_0x2ff0e0){_0x13570a=_0x2ff0e0;if(_0x13570a&&_0x13570a['Smtp']){var _0x42b369={'tls':{'rejectUnauthorized':![]}};if(_[_0x4d63('0x6a')](_0x13570a['Smtp'][_0x4d63('0x6b')])){_0x42b369['host']=_0x13570a[_0x4d63('0x69')]['host'];_0x42b369[_0x4d63('0x6c')]=_0x13570a[_0x4d63('0x69')][_0x4d63('0x6c')];_0x42b369[_0x4d63('0x6d')]=_0x13570a[_0x4d63('0x69')][_0x4d63('0x6d')];if(_0x13570a[_0x4d63('0x69')][_0x4d63('0x6e')]){_0x42b369[_0x4d63('0x6f')]={'user':_0x13570a[_0x4d63('0x69')][_0x4d63('0x70')],'pass':_0x13570a[_0x4d63('0x69')][_0x4d63('0x71')]};}}else{_0x42b369[_0x4d63('0x6b')]=_0x13570a[_0x4d63('0x69')][_0x4d63('0x6b')];_0x42b369[_0x4d63('0x6f')]={'user':_0x13570a[_0x4d63('0x69')][_0x4d63('0x70')],'pass':_0x13570a[_0x4d63('0x69')][_0x4d63('0x71')]};_0x42b369['secure']=_0x13570a[_0x4d63('0x69')][_0x4d63('0x6d')];}if(_0x2c84db['body']['attachments']&&_0x2c84db[_0x4d63('0x5d')][_0x4d63('0x72')][_0x4d63('0x49')]){for(var _0x539264=0x0;_0x539264<_0x2c84db[_0x4d63('0x5d')][_0x4d63('0x72')][_0x4d63('0x49')];_0x539264+=0x1){_0x2c84db[_0x4d63('0x5d')][_0x4d63('0x72')][_0x539264]={'filename':_0x2c84db[_0x4d63('0x5d')][_0x4d63('0x72')][_0x539264][_0x4d63('0x3c')],'path':path[_0x4d63('0x73')](config[_0x4d63('0x74')],_0x4d63('0x75'),_0x2c84db['body']['attachments'][_0x539264][_0x4d63('0x76')])};}}_0xe9df5a={'account':_0x42b369,'message':_0x2c84db['body']};return;}})[_0x4d63('0x24')](function(){if(_0x13570a['List']){if(_0x13570a[_0x4d63('0x66')][_0x4d63('0x77')][_0x4d63('0x49')]){return _0x13570a[_0x4d63('0x66')]['Contacts'][0x0];}else{return db['CmContact'][_0x4d63('0x5f')](_['defaults'](_0x2c84db[_0x4d63('0x5d')],{'firstName':_0x2c84db[_0x4d63('0x5d')]['to'],'email':_0x2c84db[_0x4d63('0x5d')]['to'],'phone':_0x2c84db[_0x4d63('0x5d')]['to'],'ListId':_0x13570a[_0x4d63('0x78')]}));}}else{throw new Error(_0x4d63('0x79'));}})['then'](function(){if(_0xe9df5a){return respondWithRpcPromise(_0x4d63('0x7a'),_0x4d63('0x7b'),_0xe9df5a,client9003)[_0x4d63('0x24')](function(_0x5108e5){return _0x4d1e59[_0x4d63('0x3a')]({'read':!![],'messageId':_0x5108e5[_0x4d63('0x7c')],'sentAt':moment()[_0x4d63('0x7d')](_0x4d63('0x7e'))});})[_0x4d63('0x2d')](function(_0x508050){logger['error']('%s',JSON[_0x4d63('0x27')](_0x508050));return _0x4d1e59;});}return _0x4d1e59;});}return _0x4d1e59;}})[_0x4d63('0x24')](respondWithResult(_0x3d05df,0xc9))[_0x4d63('0x2d')](handleError(_0x3d05df,null));};var interaction_log=require(_0x4d63('0x7f'))('mail-interactions');exports[_0x4d63('0x80')]=function(_0x30a139,_0x14163b,_0x10adc3){var _0x253920={'agent':{},'channel':_0x4d63('0x81')};if(_0x30a139[_0x4d63('0x5d')]['id']){delete _0x30a139[_0x4d63('0x5d')]['id'];}_0x30a139[_0x4d63('0x5d')][_0x4d63('0x82')]=!![];_0x30a139[_0x4d63('0x5d')]['readAt']=moment()['format'](_0x4d63('0x7e'));_0x30a139[_0x4d63('0x5d')][_0x4d63('0x83')]=_0x30a139[_0x4d63('0x5d')]['UserId']||_0x30a139[_0x4d63('0x70')]['id'];_0x253920[_0x4d63('0x84')]['id']=_0x30a139['body'][_0x4d63('0x83')];return db[_0x4d63('0x54')][_0x4d63('0x5c')]({'where':{'id':_0x30a139[_0x4d63('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x4d63('0x24')](handleEntityNotFound(_0x14163b,null))['then'](saveUpdates(_0x30a139[_0x4d63('0x5d')],null))[_0x4d63('0x24')](function(_0x1b3ed0){if(_0x1b3ed0){_0x253920[_0x4d63('0x2a')]=_0x1b3ed0[_0x4d63('0x85')]({'plain':!![]});return db[_0x4d63('0x86')]['find']({'where':{'id':_0x1b3ed0[_0x4d63('0x87')]}});}return null;})['then'](handleEntityNotFound(_0x14163b,null))[_0x4d63('0x24')](function(_0x5cf39c){if(_0x5cf39c){return _0x5cf39c[_0x4d63('0x3a')]({'UserId':_0x30a139[_0x4d63('0x5d')][_0x4d63('0x83')],'read1stAt':_[_0x4d63('0x6a')](_0x5cf39c[_0x4d63('0x88')])?moment()['format'](_0x4d63('0x7e')):undefined});}return null;})[_0x4d63('0x24')](function(_0xd64eec){if(_0xd64eec){_0x253920[_0x4d63('0x89')]=_0xd64eec[_0x4d63('0x85')]({'plain':!![]});interaction_log[_0x4d63('0x2b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30a139['user']['id'],_0x30a139[_0x4d63('0x70')][_0x4d63('0x3c')],_0x30a139[_0x4d63('0x70')][_0x4d63('0x8a')],_0x253920[_0x4d63('0x89')]['id'],_0x30a139[_0x4d63('0x5d')]?JSON[_0x4d63('0x27')](_0x30a139[_0x4d63('0x5d')]):'null');return respondWithRpcPromise(_0x4d63('0x8b'),'acceptMessage',_0x253920);}return null;})[_0x4d63('0x24')](function(_0x1b32f3){return db[_0x4d63('0x67')]['describe']()[_0x4d63('0x24')](function(_0x158cc8){var _0x54e2fa=[];for(var _0x3307e0=0x0;_0x3307e0=_0x3c88ad){_0x27ad2c=_0x3c88ad;_0x4c4763=0xc8;}else{_0x4c4763=0xce;}_0x8e2acd[_0x9c28('0x1c')](_0x4c4763);return _0x8e2acd[_0x9c28('0x23')](_0x9c28('0x24'),_0x2dc312+'-'+_0x27ad2c+'/'+_0x3c88ad)[_0x9c28('0x1e')](_0x593c87);}return null;};}function patchUpdates(_0x4ae4e9){return function(_0x1fc3bd){try{jsonpatch[_0x9c28('0x25')](_0x1fc3bd,_0x4ae4e9,!![]);}catch(_0x2208d5){return BPromise[_0x9c28('0x26')](_0x2208d5);}return _0x1fc3bd[_0x9c28('0x27')]();};}function saveUpdates(_0x10aabc,_0x256611){return function(_0x210edb){if(_0x210edb){return _0x210edb[_0x9c28('0x28')](_0x10aabc)[_0x9c28('0x29')](function(_0x35bb09){return _0x35bb09;});}return null;};}function removeEntity(_0x142c18,_0x4089dd){return function(_0x5e8e36){if(_0x5e8e36){return _0x5e8e36['destroy']()[_0x9c28('0x29')](function(){var _0x3d137c=_0x5e8e36['get']({'plain':!![]});var _0x1457e5=_0x9c28('0x2a');return db[_0x9c28('0x2b')]['destroy']({'where':{'type':_0x1457e5,'resourceId':_0x3d137c['id']}})['then'](function(){return _0x5e8e36;});})[_0x9c28('0x29')](function(){_0x142c18[_0x9c28('0x1c')](0xcc)[_0x9c28('0x1d')]();});}};}function handleEntityNotFound(_0x1bff77,_0x1d5c30){return function(_0x2c17c7){if(!_0x2c17c7){_0x1bff77['sendStatus'](0x194);}return _0x2c17c7;};}function handleError(_0x2cff5f,_0x612cc9){_0x612cc9=_0x612cc9||0x1f4;return function(_0x4727e4){logger[_0x9c28('0x2c')](_0x4727e4[_0x9c28('0x2d')]);if(_0x4727e4[_0x9c28('0x2e')]){delete _0x4727e4[_0x9c28('0x2e')];}_0x2cff5f[_0x9c28('0x1c')](_0x612cc9)['send'](_0x4727e4);};}exports[_0x9c28('0x2f')]=function(_0x33884f,_0x22f2ef){var _0x61c6b9={},_0x26c2f2={},_0x238074={'count':0x0,'rows':[]};var _0x34ffa3=_[_0x9c28('0x30')](db[_0x9c28('0x31')][_0x9c28('0x32')],function(_0x4900d0){return{'name':_0x4900d0[_0x9c28('0x33')],'type':_0x4900d0[_0x9c28('0x34')]['key']};});_0x26c2f2[_0x9c28('0x35')]=_[_0x9c28('0x30')](_0x34ffa3,_0x9c28('0x2e'));_0x26c2f2[_0x9c28('0x36')]=_[_0x9c28('0x37')](_0x33884f[_0x9c28('0x36')]);_0x26c2f2[_0x9c28('0x38')]=_['intersection'](_0x26c2f2['model'],_0x26c2f2[_0x9c28('0x36')]);_0x61c6b9['attributes']=_[_0x9c28('0x39')](_0x26c2f2['model'],qs[_0x9c28('0x3a')](_0x33884f[_0x9c28('0x36')][_0x9c28('0x3a')]));_0x61c6b9[_0x9c28('0x3b')]=_0x61c6b9['attributes'][_0x9c28('0x3c')]?_0x61c6b9['attributes']:_0x26c2f2[_0x9c28('0x35')];if(!_0x33884f[_0x9c28('0x36')]['hasOwnProperty'](_0x9c28('0x3d'))){_0x61c6b9[_0x9c28('0x22')]=qs[_0x9c28('0x22')](_0x33884f[_0x9c28('0x36')][_0x9c28('0x22')]);_0x61c6b9[_0x9c28('0x1f')]=qs[_0x9c28('0x1f')](_0x33884f[_0x9c28('0x36')][_0x9c28('0x1f')]);}_0x61c6b9['order']=qs[_0x9c28('0x3e')](_0x33884f[_0x9c28('0x36')]['sort']);_0x61c6b9['where']=qs[_0x9c28('0x38')](_[_0x9c28('0x3f')](_0x33884f['query'],_0x26c2f2['filters']),_0x34ffa3);if(_0x33884f[_0x9c28('0x36')][_0x9c28('0x40')]){_0x61c6b9['where']=_[_0x9c28('0x41')](_0x61c6b9['where'],{'$or':_[_0x9c28('0x30')](_0x34ffa3,function(_0x582c2c){if(_0x582c2c[_0x9c28('0x34')]!=='VIRTUAL'){var _0x17e3f3={};_0x17e3f3[_0x582c2c['name']]={'$like':'%'+_0x33884f['query'][_0x9c28('0x40')]+'%'};return _0x17e3f3;}})});}_0x61c6b9=_['merge']({},_0x61c6b9,_0x33884f[_0x9c28('0x42')]);var _0x33defd={'where':_0x61c6b9[_0x9c28('0x43')]};return db[_0x9c28('0x31')][_0x9c28('0x21')](_0x33defd)[_0x9c28('0x29')](function(_0x9a72bd){_0x238074['count']=_0x9a72bd;if(_0x33884f[_0x9c28('0x36')]['includeAll']){_0x61c6b9[_0x9c28('0x44')]=[{'all':!![]}];}return db[_0x9c28('0x31')][_0x9c28('0x45')](_0x61c6b9);})[_0x9c28('0x29')](function(_0x424357){_0x238074['rows']=_0x424357;return _0x238074;})[_0x9c28('0x29')](respondWithFilteredResult(_0x22f2ef,_0x61c6b9))[_0x9c28('0x46')](handleError(_0x22f2ef,null));};exports[_0x9c28('0x47')]=function(_0x5e3571,_0x462af3){var _0x1e03ec={'raw':!![],'where':{'id':_0x5e3571['params']['id']}},_0x404f2a={};_0x404f2a['model']=_[_0x9c28('0x37')](db[_0x9c28('0x31')][_0x9c28('0x32')]);_0x404f2a[_0x9c28('0x36')]=_[_0x9c28('0x37')](_0x5e3571[_0x9c28('0x36')]);_0x404f2a[_0x9c28('0x38')]=_['intersection'](_0x404f2a['model'],_0x404f2a['query']);_0x1e03ec['attributes']=_[_0x9c28('0x39')](_0x404f2a[_0x9c28('0x35')],qs[_0x9c28('0x3a')](_0x5e3571[_0x9c28('0x36')][_0x9c28('0x3a')]));_0x1e03ec[_0x9c28('0x3b')]=_0x1e03ec[_0x9c28('0x3b')][_0x9c28('0x3c')]?_0x1e03ec[_0x9c28('0x3b')]:_0x404f2a[_0x9c28('0x35')];if(_0x5e3571[_0x9c28('0x36')][_0x9c28('0x48')]){_0x1e03ec[_0x9c28('0x44')]=[{'all':!![]}];}_0x1e03ec=_[_0x9c28('0x41')]({},_0x1e03ec,_0x5e3571[_0x9c28('0x42')]);return db['MailQueue'][_0x9c28('0x49')](_0x1e03ec)['then'](handleEntityNotFound(_0x462af3,null))['then'](respondWithResult(_0x462af3,null))['catch'](handleError(_0x462af3,null));};exports['create']=function(_0x929ad,_0x391636){return db[_0x9c28('0x31')][_0x9c28('0x4a')](_0x929ad[_0x9c28('0x4b')],{})[_0x9c28('0x29')](function(_0x14158b){var _0x278126=_0x929ad['user'][_0x9c28('0x4c')]({'plain':!![]});if(!_0x278126)throw new Error(_0x9c28('0x4d'));if(_0x278126['role']===_0x9c28('0x4e')){var _0x51e2fa=_0x14158b['get']({'plain':!![]});var _0x580cdc=_0x9c28('0x2a');return db[_0x9c28('0x4f')][_0x9c28('0x49')]({'where':{'name':_0x580cdc,'userProfileId':_0x278126[_0x9c28('0x50')]},'raw':!![]})[_0x9c28('0x29')](function(_0x56f205){if(_0x56f205&&_0x56f205[_0x9c28('0x51')]===0x0){return db[_0x9c28('0x2b')][_0x9c28('0x4a')]({'name':_0x51e2fa['name'],'resourceId':_0x51e2fa['id'],'type':_0x56f205[_0x9c28('0x2e')],'sectionId':_0x56f205['id']},{})[_0x9c28('0x29')](function(){return _0x14158b;});}else{return _0x14158b;}})['catch'](function(_0x5ce56e){logger['error'](_0x9c28('0x52'),_0x5ce56e);throw _0x5ce56e;});}return _0x14158b;})['then'](respondWithResult(_0x391636,0xc9))[_0x9c28('0x46')](handleError(_0x391636,null));};exports[_0x9c28('0x28')]=function(_0x5255e2,_0x31ea05){if(_0x5255e2[_0x9c28('0x4b')]['id']){delete _0x5255e2[_0x9c28('0x4b')]['id'];}return db[_0x9c28('0x31')][_0x9c28('0x49')]({'where':{'id':_0x5255e2[_0x9c28('0x53')]['id']}})[_0x9c28('0x29')](handleEntityNotFound(_0x31ea05,null))[_0x9c28('0x29')](saveUpdates(_0x5255e2['body'],null))['then'](respondWithResult(_0x31ea05,null))[_0x9c28('0x46')](handleError(_0x31ea05,null));};exports['destroy']=function(_0x1ffd2f,_0x2e5669){return db[_0x9c28('0x31')][_0x9c28('0x49')]({'where':{'id':_0x1ffd2f['params']['id']}})[_0x9c28('0x29')](handleEntityNotFound(_0x2e5669,null))[_0x9c28('0x29')](removeEntity(_0x2e5669,null))[_0x9c28('0x46')](handleError(_0x2e5669,null));};exports['describe']=function(_0x110fd4,_0x762603){return db[_0x9c28('0x31')][_0x9c28('0x54')]()['then'](respondWithResult(_0x762603,null))[_0x9c28('0x46')](handleError(_0x762603,null));};exports['getMembers']=function(_0x337404,_0x30905f,_0x31be99){var _0x276a84={'raw':!![],'where':{}},_0x104ea5={},_0x1c9cfb;return db[_0x9c28('0x31')][_0x9c28('0x55')]({'where':{'id':_0x337404[_0x9c28('0x53')]['id']}})[_0x9c28('0x29')](handleEntityNotFound(_0x30905f,null))[_0x9c28('0x29')](function(_0xf4922c){if(_0xf4922c){_0x1c9cfb=_0xf4922c['get']({'plain':!![]});_0x104ea5['model']=_[_0x9c28('0x37')](db[_0x9c28('0x56')][_0x9c28('0x32')]);_0x104ea5['query']=_[_0x9c28('0x37')](_0x337404[_0x9c28('0x36')]);_0x104ea5[_0x9c28('0x38')]=_[_0x9c28('0x39')](_0x104ea5[_0x9c28('0x35')],_0x104ea5[_0x9c28('0x36')]);_0x276a84[_0x9c28('0x3b')]=_[_0x9c28('0x39')](_0x104ea5[_0x9c28('0x35')],qs[_0x9c28('0x3a')](_0x337404[_0x9c28('0x36')]['fields']));_0x276a84['attributes']=_0x276a84[_0x9c28('0x3b')]['length']?_0x276a84[_0x9c28('0x3b')]:_0x104ea5[_0x9c28('0x35')];if(!_0x337404['query']['hasOwnProperty']('nolimit')){_0x276a84['limit']=qs[_0x9c28('0x22')](_0x337404[_0x9c28('0x36')][_0x9c28('0x22')]);_0x276a84['offset']=qs[_0x9c28('0x1f')](_0x337404[_0x9c28('0x36')][_0x9c28('0x1f')]);}_0x276a84[_0x9c28('0x57')]=qs[_0x9c28('0x3e')](_0x337404[_0x9c28('0x36')][_0x9c28('0x3e')]);_0x276a84[_0x9c28('0x43')]=qs[_0x9c28('0x38')](_[_0x9c28('0x3f')](_0x337404[_0x9c28('0x36')],_0x104ea5['filters']));_0x276a84[_0x9c28('0x43')][_0x9c28('0x58')]=_0xf4922c['id'];if(_0x337404[_0x9c28('0x36')][_0x9c28('0x40')]){_0x276a84[_0x9c28('0x43')]=_[_0x9c28('0x41')](_0x276a84[_0x9c28('0x43')],{'$or':_[_0x9c28('0x30')](_0x276a84[_0x9c28('0x3b')],function(_0x22f16e){var _0x35f9c7={};_0x35f9c7[_0x22f16e]={'$like':'%'+_0x337404['query']['filter']+'%'};return _0x35f9c7;})});}_0x276a84=_[_0x9c28('0x41')]({},_0x276a84,_0x337404[_0x9c28('0x42')]);return db[_0x9c28('0x56')][_0x9c28('0x45')](_0x276a84);}})[_0x9c28('0x29')](function(_0x538abe){if(_0x538abe){return db['User'][_0x9c28('0x59')]({'where':{'id':_[_0x9c28('0x30')](_0x538abe,'UserId'),'role':'agent'},'attributes':['id',_0x9c28('0x2e'),'mailPause',_0x9c28('0x5a'),'createdAt']});}})['then'](function(_0x5f3cc5){if(_0x5f3cc5){return{'count':_0x5f3cc5[_0x9c28('0x21')],'rows':_[_0x9c28('0x30')](_0x5f3cc5[_0x9c28('0x5b')],function(_0x33ed44){return{'membername':_0x33ed44[_0x9c28('0x2e')],'UserId':_0x33ed44['id'],'queue_name':_0x1c9cfb[_0x9c28('0x2e')],'MailQueueId':_0x1c9cfb['id'],'interface':util[_0x9c28('0x5c')](_0x9c28('0x5d'),_0x9c28('0x5e'),_0x33ed44[_0x9c28('0x2e')]),'penalty':0x0,'paused':_0x33ed44[_0x9c28('0x5f')],'createdAt':_0x33ed44['createdAt'],'updatedAt':_0x33ed44[_0x9c28('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9c28('0x29')](respondWithFilteredResult(_0x30905f,_0x276a84))['catch'](handleError(_0x30905f,null));};exports[_0x9c28('0x60')]=function(_0x5bc263,_0x277637,_0x5c5634){var _0x1c75ea={};var _0x51e505={};var _0x51f0e0;var _0x3cc99c;return db['MailQueue'][_0x9c28('0x55')]({'where':{'id':_0x5bc263['params']['id']}})[_0x9c28('0x29')](handleEntityNotFound(_0x277637,null))[_0x9c28('0x29')](function(_0x539a88){if(_0x539a88){_0x51f0e0=_0x539a88;_0x51e505[_0x9c28('0x35')]=_[_0x9c28('0x37')](db[_0x9c28('0x61')][_0x9c28('0x32')]);_0x51e505['query']=_[_0x9c28('0x37')](_0x5bc263[_0x9c28('0x36')]);_0x51e505['filters']=_[_0x9c28('0x39')](_0x51e505[_0x9c28('0x35')],_0x51e505['query']);_0x1c75ea[_0x9c28('0x3b')]=_['intersection'](_0x51e505[_0x9c28('0x35')],qs['fields'](_0x5bc263['query'][_0x9c28('0x3a')]));_0x1c75ea['attributes']=_0x1c75ea[_0x9c28('0x3b')][_0x9c28('0x3c')]?_0x1c75ea[_0x9c28('0x3b')]:_0x51e505[_0x9c28('0x35')];_0x1c75ea[_0x9c28('0x57')]=qs[_0x9c28('0x3e')](_0x5bc263[_0x9c28('0x36')][_0x9c28('0x3e')]);_0x1c75ea[_0x9c28('0x43')]=qs['filters'](_[_0x9c28('0x3f')](_0x5bc263[_0x9c28('0x36')],_0x51e505[_0x9c28('0x38')]));if(_0x5bc263[_0x9c28('0x36')][_0x9c28('0x40')]){_0x1c75ea[_0x9c28('0x43')]=_[_0x9c28('0x41')](_0x1c75ea[_0x9c28('0x43')],{'$or':_[_0x9c28('0x30')](_0x1c75ea['attributes'],function(_0x5a3945){var _0x3ef82a={};_0x3ef82a[_0x5a3945]={'$like':'%'+_0x5bc263['query'][_0x9c28('0x40')]+'%'};return _0x3ef82a;})});}_0x1c75ea=_[_0x9c28('0x41')]({},_0x1c75ea,_0x5bc263[_0x9c28('0x42')]);return _0x51f0e0['getTeams'](_0x1c75ea);}})[_0x9c28('0x29')](function(_0x692736){if(_0x692736){_0x3cc99c=_0x692736[_0x9c28('0x3c')];if(!_0x5bc263['query']['hasOwnProperty'](_0x9c28('0x3d'))){_0x1c75ea[_0x9c28('0x22')]=qs[_0x9c28('0x22')](_0x5bc263[_0x9c28('0x36')][_0x9c28('0x22')]);_0x1c75ea[_0x9c28('0x1f')]=qs[_0x9c28('0x1f')](_0x5bc263[_0x9c28('0x36')][_0x9c28('0x1f')]);}return _0x51f0e0[_0x9c28('0x60')](_0x1c75ea);}})[_0x9c28('0x29')](function(_0xc844e2){if(_0xc844e2){return _0xc844e2?{'count':_0x3cc99c,'rows':_0xc844e2}:null;}})[_0x9c28('0x29')](respondWithResult(_0x277637,null))[_0x9c28('0x46')](handleError(_0x277637,null));};exports[_0x9c28('0x62')]=function(_0x2689d9,_0x2d1478,_0xcdb30d){var _0x3088a8=_0x2689d9[_0x9c28('0x4b')]['ids'];return db[_0x9c28('0x61')]['findAll']({'where':{'id':_0x3088a8},'attributes':['id'],'include':[{'model':db[_0x9c28('0x63')],'as':_0x9c28('0x64'),'attributes':['id','name',_0x9c28('0x65'),'voicePause',_0x9c28('0x66')],'raw':!![]}]})[_0x9c28('0x29')](function(_0x5d14ee){if(_0x5d14ee){var _0x2fd6ee=_[_0x9c28('0x67')](_0x5d14ee,function(_0x3016da){var _0x5e9f76=_0x3016da[_0x9c28('0x4c')]({'plain':!![]});return _0x5e9f76[_0x9c28('0x64')];});return db[_0x9c28('0x31')][_0x9c28('0x49')]({'where':{'id':_0x2689d9['params']['id']}})[_0x9c28('0x29')](function(_0x304848){return db[_0x9c28('0x68')][_0x9c28('0x69')](function(_0x3c2e87){return _0x304848['addTeams'](_0x3088a8,{'transaction':_0x3c2e87})[_0x9c28('0x29')](function(){return BPromise[_0x9c28('0x6a')](_0x2fd6ee,function(_0x5259de){return db[_0x9c28('0x56')][_0x9c28('0x6b')]({'where':{'UserId':_0x5259de['id'],'MailQueueId':_0x2689d9[_0x9c28('0x53')]['id']},'transaction':_0x3c2e87});});})['then'](function(){_0x2fd6ee[_0x9c28('0x6c')](function(_0x357b67){socket[_0x9c28('0x6d')](_0x9c28('0x6e'),{'UserId':_0x357b67['id'],'MailQueueId':_0x304848['id']});});});});});}})[_0x9c28('0x29')](respondWithStatusCode(_0x2d1478,null))[_0x9c28('0x46')](handleError(_0x2d1478,null));};exports['removeTeams']=function(_0x5d73f4,_0x48e56e,_0x379549){return db[_0x9c28('0x61')]['findAll']({'where':{'id':_0x5d73f4[_0x9c28('0x36')][_0x9c28('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x9c28('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9c28('0x29')](handleEntityNotFound(_0x48e56e,null))['then'](function(_0x397c12){var _0x2a9128=_['map'](_0x397c12,'id');var _0x1a68d6=[];var _0x3e2edb=[];var _0x4568fa=squel[_0x9c28('0x70')]();_0x4568fa[_0x9c28('0x71')]('tq.TeamId')[_0x9c28('0x72')](_0x9c28('0x73'),'tq')[_0x9c28('0x74')]('user_has_teams','ut',_0x9c28('0x75'))[_0x9c28('0x43')](_0x9c28('0x76'),_0x5d73f4[_0x9c28('0x53')]['id']);for(var _0x33c5c2=0x0;_0x33c5c2<_0x397c12[_0x9c28('0x3c')];_0x33c5c2+=0x1){let _0x3beb3c=_0x397c12[_0x33c5c2];for(var _0x34f42c=0x0;_0x34f42c<_0x3beb3c['Agents'][_0x9c28('0x3c')];_0x34f42c+=0x1){let _0x382dad=_0x3beb3c[_0x9c28('0x64')][_0x34f42c];var _0x4e3302=_0x4568fa['clone']();_0x4e3302[_0x9c28('0x43')](_0x9c28('0x77'),_0x382dad['id']);_0x3e2edb[_0x9c28('0x78')](db[_0x9c28('0x68')]['query'](_0x4e3302[_0x9c28('0x79')](),{'type':db[_0x9c28('0x68')][_0x9c28('0x7a')][_0x9c28('0x7b')]})[_0x9c28('0x29')](function(_0x4855ad){if(_0x4855ad[_0x9c28('0x3c')]===0x1){return _0x382dad['id'];}else{var _0x15cd03=_[_0x9c28('0x7c')](_['map'](_0x4855ad,'TeamId'),function(_0x27e821){return _['includes'](_0x2a9128,_0x27e821);});if(_0x15cd03){return _0x382dad['id'];}}}));}}return BPromise[_0x9c28('0x7d')](_0x3e2edb)[_0x9c28('0x29')](function(_0x331c6c){_0x1a68d6=_(_0x1a68d6)[_0x9c28('0x7e')](_0x331c6c)['compact']()['value']();return db['MailQueue']['find']({'where':{'id':_0x5d73f4[_0x9c28('0x53')]['id']}})[_0x9c28('0x29')](function(_0x39c490){return db[_0x9c28('0x68')]['transaction'](function(_0x2ef233){return _0x39c490[_0x9c28('0x7f')](_0x5d73f4['query']['ids'],{'transaction':_0x2ef233})[_0x9c28('0x29')](function(){if(!_[_0x9c28('0x80')](_0x1a68d6)){return _0x39c490[_0x9c28('0x81')](_0x1a68d6,{'transaction':_0x2ef233});}})[_0x9c28('0x29')](function(){_0x1a68d6[_0x9c28('0x6c')](function(_0x5071f9){socket[_0x9c28('0x6d')](_0x9c28('0x82'),{'UserId':_0x5071f9,'MailQueueId':_0x39c490['id']});});});});});});})[_0x9c28('0x29')](respondWithStatusCode(_0x48e56e,null))['catch'](handleError(_0x48e56e,null));};exports[_0x9c28('0x83')]=function(_0x494faf,_0x38d09a,_0x448fd0){return db[_0x9c28('0x31')][_0x9c28('0x49')]({'where':{'id':_0x494faf[_0x9c28('0x53')]['id']}})['then'](handleEntityNotFound(_0x38d09a,null))[_0x9c28('0x29')](function(_0x57716e){if(_0x57716e){return _0x57716e[_0x9c28('0x83')](_0x494faf['body']['ids'],_[_0x9c28('0x84')](_0x494faf[_0x9c28('0x4b')],[_0x9c28('0x6f'),'id'])||{})['spread'](function(_0xd4c9c9){for(var _0x2a1b51=0x0;_0x2a1b51<_0x494faf[_0x9c28('0x4b')][_0x9c28('0x6f')]['length'];_0x2a1b51+=0x1){socket[_0x9c28('0x6d')](_0x9c28('0x6e'),{'UserId':_0x494faf[_0x9c28('0x4b')][_0x9c28('0x6f')][_0x2a1b51],'MailQueueId':_0x494faf[_0x9c28('0x53')]['id']});}return _0xd4c9c9;});}})[_0x9c28('0x29')](respondWithResult(_0x38d09a,null))[_0x9c28('0x46')](handleError(_0x38d09a,null));};exports['removeAgents']=function(_0x2e1f66,_0x20c5fa,_0x4b92ca){return db[_0x9c28('0x31')][_0x9c28('0x49')]({'where':{'id':_0x2e1f66[_0x9c28('0x53')]['id']}})['then'](handleEntityNotFound(_0x20c5fa,null))[_0x9c28('0x29')](function(_0x1649c7){if(_0x1649c7){return _0x1649c7[_0x9c28('0x81')](_0x2e1f66[_0x9c28('0x36')]['ids'])[_0x9c28('0x29')](function(){if(_[_0x9c28('0x85')](_0x2e1f66['query'][_0x9c28('0x6f')])){for(var _0x250fde=0x0;_0x250fde<_0x2e1f66[_0x9c28('0x36')]['ids'][_0x9c28('0x3c')];_0x250fde+=0x1){socket[_0x9c28('0x6d')](_0x9c28('0x82'),{'UserId':Number(_0x2e1f66[_0x9c28('0x36')]['ids'][_0x250fde]),'MailQueueId':Number(_0x2e1f66[_0x9c28('0x53')]['id'])});}}else{socket[_0x9c28('0x6d')](_0x9c28('0x82'),{'UserId':Number(_0x2e1f66[_0x9c28('0x36')]['ids']),'MailQueueId':Number(_0x2e1f66[_0x9c28('0x53')]['id'])});}});}})[_0x9c28('0x29')](respondWithStatusCode(_0x20c5fa,null))['catch'](handleError(_0x20c5fa,null));};exports[_0x9c28('0x86')]=function(_0x3fb1e8,_0x33ee9d,_0x306987){var _0x492f89={};var _0x344057={};var _0x4593c2;var _0xf49477;return db['MailQueue'][_0x9c28('0x55')]({'where':{'id':_0x3fb1e8[_0x9c28('0x53')]['id']}})[_0x9c28('0x29')](handleEntityNotFound(_0x33ee9d,null))[_0x9c28('0x29')](function(_0x4c1a56){if(_0x4c1a56){_0x4593c2=_0x4c1a56;_0x344057['model']=_[_0x9c28('0x37')](db['User']['rawAttributes']);_0x344057[_0x9c28('0x36')]=_['keys'](_0x3fb1e8[_0x9c28('0x36')]);_0x344057[_0x9c28('0x38')]=_['intersection'](_0x344057[_0x9c28('0x35')],_0x344057[_0x9c28('0x36')]);_0x492f89[_0x9c28('0x3b')]=_[_0x9c28('0x39')](_0x344057[_0x9c28('0x35')],qs[_0x9c28('0x3a')](_0x3fb1e8['query'][_0x9c28('0x3a')]));_0x492f89[_0x9c28('0x3b')]=_0x492f89[_0x9c28('0x3b')][_0x9c28('0x3c')]?_0x492f89[_0x9c28('0x3b')]:_0x344057[_0x9c28('0x35')];_0x492f89[_0x9c28('0x57')]=qs[_0x9c28('0x3e')](_0x3fb1e8[_0x9c28('0x36')][_0x9c28('0x3e')]);_0x492f89[_0x9c28('0x43')]=qs[_0x9c28('0x38')](_[_0x9c28('0x3f')](_0x3fb1e8[_0x9c28('0x36')],_0x344057['filters']));if(_0x3fb1e8[_0x9c28('0x36')]['filter']){_0x492f89[_0x9c28('0x43')]=_[_0x9c28('0x41')](_0x492f89[_0x9c28('0x43')],{'$or':_[_0x9c28('0x30')](_0x492f89[_0x9c28('0x3b')],function(_0x1d152b){var _0x375bc2={};_0x375bc2[_0x1d152b]={'$like':'%'+_0x3fb1e8[_0x9c28('0x36')][_0x9c28('0x40')]+'%'};return _0x375bc2;})});}_0x492f89=_['merge']({},_0x492f89,_0x3fb1e8[_0x9c28('0x42')]);return _0x4593c2[_0x9c28('0x86')](_0x492f89);}})['then'](function(_0x25add6){if(_0x25add6){_0xf49477=_0x25add6[_0x9c28('0x3c')];if(!_0x3fb1e8[_0x9c28('0x36')][_0x9c28('0x87')]('nolimit')){_0x492f89[_0x9c28('0x22')]=qs['limit'](_0x3fb1e8[_0x9c28('0x36')][_0x9c28('0x22')]);_0x492f89[_0x9c28('0x1f')]=qs[_0x9c28('0x1f')](_0x3fb1e8['query'][_0x9c28('0x1f')]);}return _0x4593c2[_0x9c28('0x86')](_0x492f89);}})[_0x9c28('0x29')](function(_0x123b6a){if(_0x123b6a){return _0x123b6a?{'count':_0xf49477,'rows':_0x123b6a}:null;}})[_0x9c28('0x29')](respondWithResult(_0x33ee9d,null))[_0x9c28('0x46')](handleError(_0x33ee9d,null));}; \ No newline at end of file +var _0x3179=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','name','index','map','MailQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','length','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x379862,_0x463533){var _0x316e83=function(_0x366dda){while(--_0x366dda){_0x379862['push'](_0x379862['shift']());}};_0x316e83(++_0x463533);}(_0x3179,0x7f));var _0x9317=function(_0x1abb8a,_0x45ca71){_0x1abb8a=_0x1abb8a-0x0;var _0x36b1dc=_0x3179[_0x1abb8a];return _0x36b1dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9317('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9317('0x1'));var rp=require(_0x9317('0x2'));var moment=require(_0x9317('0x3'));var BPromise=require(_0x9317('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9317('0x5'));var sox=require(_0x9317('0x6'));var csv=require('to-csv');var ejs=require(_0x9317('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9317('0x8'));var squel=require(_0x9317('0x9'));var crypto=require(_0x9317('0xa'));var jsforce=require(_0x9317('0xb'));var deskjs=require(_0x9317('0xc'));var toCsv=require(_0x9317('0xd'));var querystring=require(_0x9317('0xe'));var Papa=require(_0x9317('0xf'));var Redis=require(_0x9317('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9317('0x11'));var hardwareService=require(_0x9317('0x12'));var logger=require(_0x9317('0x13'))(_0x9317('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9317('0x15'));var db=require(_0x9317('0x16'))['db'];config[_0x9317('0x17')]=_[_0x9317('0x18')](config[_0x9317('0x17')],{'host':_0x9317('0x19'),'port':0x18eb});var socket=require(_0x9317('0x1a'))(new Redis(config[_0x9317('0x17')]));require(_0x9317('0x1b'))[_0x9317('0x1c')](socket);function respondWithStatusCode(_0x361dfa,_0x4a7b68){_0x4a7b68=_0x4a7b68||0xcc;return function(_0x390cc8){if(_0x390cc8){return _0x361dfa[_0x9317('0x1d')](_0x4a7b68);}return _0x361dfa['status'](_0x4a7b68)[_0x9317('0x1e')]();};}function respondWithResult(_0x2295a8,_0x517228){_0x517228=_0x517228||0xc8;return function(_0x7af7ad){if(_0x7af7ad){return _0x2295a8[_0x9317('0x1f')](_0x517228)[_0x9317('0x20')](_0x7af7ad);}};}function respondWithFilteredResult(_0x10af9b,_0x22350e){return function(_0x46c7fa){if(_0x46c7fa){var _0x136e40=typeof _0x22350e[_0x9317('0x21')]==='undefined'&&typeof _0x22350e[_0x9317('0x22')]==='undefined';var _0x3f2928=_0x46c7fa[_0x9317('0x23')];var _0x3574b0=_0x136e40?0x0:_0x22350e[_0x9317('0x21')];var _0x18cad2=_0x136e40?_0x46c7fa['count']:_0x22350e[_0x9317('0x21')]+_0x22350e[_0x9317('0x22')];var _0x197c52;if(_0x18cad2>=_0x3f2928){_0x18cad2=_0x3f2928;_0x197c52=0xc8;}else{_0x197c52=0xce;}_0x10af9b[_0x9317('0x1f')](_0x197c52);return _0x10af9b[_0x9317('0x24')](_0x9317('0x25'),_0x3574b0+'-'+_0x18cad2+'/'+_0x3f2928)[_0x9317('0x20')](_0x46c7fa);}return null;};}function patchUpdates(_0x1eb57a){return function(_0x516128){try{jsonpatch['apply'](_0x516128,_0x1eb57a,!![]);}catch(_0x32ac95){return BPromise[_0x9317('0x26')](_0x32ac95);}return _0x516128[_0x9317('0x27')]();};}function saveUpdates(_0x4452d3,_0x117297){return function(_0x22ae0d){if(_0x22ae0d){return _0x22ae0d[_0x9317('0x28')](_0x4452d3)[_0x9317('0x29')](function(_0x8c6710){return _0x8c6710;});}return null;};}function removeEntity(_0x872f5d,_0x4e5154){return function(_0x389a9b){if(_0x389a9b){return _0x389a9b[_0x9317('0x2a')]()['then'](function(){var _0x13ac31=_0x389a9b['get']({'plain':!![]});var _0x4599bf=_0x9317('0x2b');return db[_0x9317('0x2c')]['destroy']({'where':{'type':_0x4599bf,'resourceId':_0x13ac31['id']}})['then'](function(){return _0x389a9b;});})[_0x9317('0x29')](function(){_0x872f5d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x166ce8,_0x1b4260){return function(_0x359943){if(!_0x359943){_0x166ce8[_0x9317('0x1d')](0x194);}return _0x359943;};}function handleError(_0x105c3f,_0x5acfc8){_0x5acfc8=_0x5acfc8||0x1f4;return function(_0x34e204){logger[_0x9317('0x2d')](_0x34e204['stack']);if(_0x34e204['name']){delete _0x34e204[_0x9317('0x2e')];}_0x105c3f['status'](_0x5acfc8)['send'](_0x34e204);};}exports[_0x9317('0x2f')]=function(_0x197eef,_0x170e8e){var _0x536499={},_0x36d395={},_0x3d9270={'count':0x0,'rows':[]};var _0x2fc9d3=_[_0x9317('0x30')](db[_0x9317('0x31')][_0x9317('0x32')],function(_0x23c4ca){return{'name':_0x23c4ca[_0x9317('0x33')],'type':_0x23c4ca[_0x9317('0x34')][_0x9317('0x35')]};});_0x36d395[_0x9317('0x36')]=_[_0x9317('0x30')](_0x2fc9d3,'name');_0x36d395['query']=_[_0x9317('0x37')](_0x197eef[_0x9317('0x38')]);_0x36d395['filters']=_[_0x9317('0x39')](_0x36d395[_0x9317('0x36')],_0x36d395['query']);_0x536499['attributes']=_[_0x9317('0x39')](_0x36d395[_0x9317('0x36')],qs['fields'](_0x197eef['query']['fields']));_0x536499[_0x9317('0x3a')]=_0x536499[_0x9317('0x3a')]['length']?_0x536499[_0x9317('0x3a')]:_0x36d395[_0x9317('0x36')];if(!_0x197eef[_0x9317('0x38')][_0x9317('0x3b')](_0x9317('0x3c'))){_0x536499[_0x9317('0x22')]=qs[_0x9317('0x22')](_0x197eef[_0x9317('0x38')][_0x9317('0x22')]);_0x536499[_0x9317('0x21')]=qs[_0x9317('0x21')](_0x197eef['query']['offset']);}_0x536499[_0x9317('0x3d')]=qs[_0x9317('0x3e')](_0x197eef[_0x9317('0x38')]['sort']);_0x536499[_0x9317('0x3f')]=qs[_0x9317('0x40')](_[_0x9317('0x41')](_0x197eef[_0x9317('0x38')],_0x36d395[_0x9317('0x40')]),_0x2fc9d3);if(_0x197eef[_0x9317('0x38')][_0x9317('0x42')]){_0x536499[_0x9317('0x3f')]=_[_0x9317('0x43')](_0x536499[_0x9317('0x3f')],{'$or':_[_0x9317('0x30')](_0x2fc9d3,function(_0x2cea7d){if(_0x2cea7d[_0x9317('0x34')]!==_0x9317('0x44')){var _0x28cbd4={};_0x28cbd4[_0x2cea7d[_0x9317('0x2e')]]={'$like':'%'+_0x197eef[_0x9317('0x38')]['filter']+'%'};return _0x28cbd4;}})});}_0x536499=_[_0x9317('0x43')]({},_0x536499,_0x197eef['options']);var _0x46d36f={'where':_0x536499['where']};return db[_0x9317('0x31')][_0x9317('0x23')](_0x46d36f)[_0x9317('0x29')](function(_0xa7d89d){_0x3d9270[_0x9317('0x23')]=_0xa7d89d;if(_0x197eef[_0x9317('0x38')][_0x9317('0x45')]){_0x536499[_0x9317('0x46')]=[{'all':!![]}];}return db[_0x9317('0x31')][_0x9317('0x47')](_0x536499);})[_0x9317('0x29')](function(_0x54b4c8){_0x3d9270[_0x9317('0x48')]=_0x54b4c8;return _0x3d9270;})[_0x9317('0x29')](respondWithFilteredResult(_0x170e8e,_0x536499))[_0x9317('0x49')](handleError(_0x170e8e,null));};exports[_0x9317('0x4a')]=function(_0x46eafe,_0x38d98c){var _0x291b0b={'raw':!![],'where':{'id':_0x46eafe[_0x9317('0x4b')]['id']}},_0x51646c={};_0x51646c['model']=_[_0x9317('0x37')](db['MailQueue']['rawAttributes']);_0x51646c[_0x9317('0x38')]=_[_0x9317('0x37')](_0x46eafe['query']);_0x51646c[_0x9317('0x40')]=_[_0x9317('0x39')](_0x51646c['model'],_0x51646c[_0x9317('0x38')]);_0x291b0b[_0x9317('0x3a')]=_[_0x9317('0x39')](_0x51646c[_0x9317('0x36')],qs[_0x9317('0x4c')](_0x46eafe[_0x9317('0x38')][_0x9317('0x4c')]));_0x291b0b['attributes']=_0x291b0b[_0x9317('0x3a')]['length']?_0x291b0b['attributes']:_0x51646c[_0x9317('0x36')];if(_0x46eafe[_0x9317('0x38')]['includeAll']){_0x291b0b['include']=[{'all':!![]}];}_0x291b0b=_['merge']({},_0x291b0b,_0x46eafe[_0x9317('0x4d')]);return db[_0x9317('0x31')]['find'](_0x291b0b)[_0x9317('0x29')](handleEntityNotFound(_0x38d98c,null))[_0x9317('0x29')](respondWithResult(_0x38d98c,null))['catch'](handleError(_0x38d98c,null));};exports['create']=function(_0x3b57c6,_0x1f4edd){return db[_0x9317('0x31')][_0x9317('0x4e')](_0x3b57c6[_0x9317('0x4f')],{})[_0x9317('0x29')](function(_0x428288){var _0x38daf9=_0x3b57c6[_0x9317('0x50')][_0x9317('0x51')]({'plain':!![]});if(!_0x38daf9)throw new Error(_0x9317('0x52'));if(_0x38daf9['role']==='user'){var _0x1c784e=_0x428288['get']({'plain':!![]});var _0x48f9c0=_0x9317('0x2b');return db['UserProfileSection'][_0x9317('0x53')]({'where':{'name':_0x48f9c0,'userProfileId':_0x38daf9[_0x9317('0x54')]},'raw':!![]})[_0x9317('0x29')](function(_0x194864){if(_0x194864&&_0x194864[_0x9317('0x55')]===0x0){return db['UserProfileResource'][_0x9317('0x4e')]({'name':_0x1c784e['name'],'resourceId':_0x1c784e['id'],'type':_0x194864['name'],'sectionId':_0x194864['id']},{})[_0x9317('0x29')](function(){return _0x428288;});}else{return _0x428288;}})[_0x9317('0x49')](function(_0x2566bd){logger[_0x9317('0x2d')](_0x9317('0x56'),_0x2566bd);throw _0x2566bd;});}return _0x428288;})['then'](respondWithResult(_0x1f4edd,0xc9))[_0x9317('0x49')](handleError(_0x1f4edd,null));};exports[_0x9317('0x28')]=function(_0x2c7559,_0x37dc0d){if(_0x2c7559[_0x9317('0x4f')]['id']){delete _0x2c7559[_0x9317('0x4f')]['id'];}return db[_0x9317('0x31')][_0x9317('0x53')]({'where':{'id':_0x2c7559[_0x9317('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37dc0d,null))[_0x9317('0x29')](saveUpdates(_0x2c7559[_0x9317('0x4f')],null))['then'](respondWithResult(_0x37dc0d,null))[_0x9317('0x49')](handleError(_0x37dc0d,null));};exports['destroy']=function(_0x23deaf,_0x694ebc){return db['MailQueue'][_0x9317('0x53')]({'where':{'id':_0x23deaf[_0x9317('0x4b')]['id']}})['then'](handleEntityNotFound(_0x694ebc,null))[_0x9317('0x29')](removeEntity(_0x694ebc,null))[_0x9317('0x49')](handleError(_0x694ebc,null));};exports['describe']=function(_0x49b8c4,_0x51dfe2){return db[_0x9317('0x31')][_0x9317('0x57')]()[_0x9317('0x29')](respondWithResult(_0x51dfe2,null))[_0x9317('0x49')](handleError(_0x51dfe2,null));};exports[_0x9317('0x58')]=function(_0x2f5c52,_0x1448c2,_0xebdaa1){var _0x4b4992={'raw':!![],'where':{}},_0xec0189={},_0x18917d;return db['MailQueue'][_0x9317('0x59')]({'where':{'id':_0x2f5c52[_0x9317('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1448c2,null))[_0x9317('0x29')](function(_0xcd720b){if(_0xcd720b){_0x18917d=_0xcd720b[_0x9317('0x51')]({'plain':!![]});_0xec0189[_0x9317('0x36')]=_[_0x9317('0x37')](db[_0x9317('0x5a')][_0x9317('0x32')]);_0xec0189[_0x9317('0x38')]=_[_0x9317('0x37')](_0x2f5c52[_0x9317('0x38')]);_0xec0189['filters']=_[_0x9317('0x39')](_0xec0189[_0x9317('0x36')],_0xec0189[_0x9317('0x38')]);_0x4b4992['attributes']=_[_0x9317('0x39')](_0xec0189[_0x9317('0x36')],qs[_0x9317('0x4c')](_0x2f5c52[_0x9317('0x38')][_0x9317('0x4c')]));_0x4b4992[_0x9317('0x3a')]=_0x4b4992[_0x9317('0x3a')][_0x9317('0x5b')]?_0x4b4992[_0x9317('0x3a')]:_0xec0189[_0x9317('0x36')];if(!_0x2f5c52[_0x9317('0x38')][_0x9317('0x3b')]('nolimit')){_0x4b4992[_0x9317('0x22')]=qs[_0x9317('0x22')](_0x2f5c52[_0x9317('0x38')][_0x9317('0x22')]);_0x4b4992[_0x9317('0x21')]=qs[_0x9317('0x21')](_0x2f5c52[_0x9317('0x38')][_0x9317('0x21')]);}_0x4b4992['order']=qs['sort'](_0x2f5c52[_0x9317('0x38')][_0x9317('0x3e')]);_0x4b4992[_0x9317('0x3f')]=qs[_0x9317('0x40')](_[_0x9317('0x41')](_0x2f5c52[_0x9317('0x38')],_0xec0189[_0x9317('0x40')]));_0x4b4992[_0x9317('0x3f')][_0x9317('0x5c')]=_0xcd720b['id'];if(_0x2f5c52[_0x9317('0x38')]['filter']){_0x4b4992[_0x9317('0x3f')]=_[_0x9317('0x43')](_0x4b4992[_0x9317('0x3f')],{'$or':_[_0x9317('0x30')](_0x4b4992[_0x9317('0x3a')],function(_0x1d5496){var _0x2ee07a={};_0x2ee07a[_0x1d5496]={'$like':'%'+_0x2f5c52[_0x9317('0x38')][_0x9317('0x42')]+'%'};return _0x2ee07a;})});}_0x4b4992=_[_0x9317('0x43')]({},_0x4b4992,_0x2f5c52[_0x9317('0x4d')]);return db['UserMailQueue'][_0x9317('0x47')](_0x4b4992);}})['then'](function(_0x3b71d5){if(_0x3b71d5){return db[_0x9317('0x5d')][_0x9317('0x5e')]({'where':{'id':_['map'](_0x3b71d5,_0x9317('0x5f')),'role':_0x9317('0x60')},'attributes':['id',_0x9317('0x2e'),_0x9317('0x61'),_0x9317('0x62'),'createdAt']});}})[_0x9317('0x29')](function(_0x334a80){if(_0x334a80){return{'count':_0x334a80[_0x9317('0x23')],'rows':_[_0x9317('0x30')](_0x334a80[_0x9317('0x48')],function(_0x38db54){return{'membername':_0x38db54[_0x9317('0x2e')],'UserId':_0x38db54['id'],'queue_name':_0x18917d[_0x9317('0x2e')],'MailQueueId':_0x18917d['id'],'interface':util[_0x9317('0x63')](_0x9317('0x64'),_0x9317('0x65'),_0x38db54[_0x9317('0x2e')]),'penalty':0x0,'paused':_0x38db54[_0x9317('0x61')],'createdAt':_0x38db54[_0x9317('0x66')],'updatedAt':_0x38db54[_0x9317('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1448c2,_0x4b4992))[_0x9317('0x49')](handleError(_0x1448c2,null));};exports['getTeams']=function(_0x3b5763,_0x51d442,_0x65d73f){var _0x519c0c={};var _0x574889={};var _0x5d469f;var _0x5c3336;return db[_0x9317('0x31')]['findOne']({'where':{'id':_0x3b5763[_0x9317('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51d442,null))[_0x9317('0x29')](function(_0x57fb74){if(_0x57fb74){_0x5d469f=_0x57fb74;_0x574889[_0x9317('0x36')]=_['keys'](db[_0x9317('0x67')]['rawAttributes']);_0x574889[_0x9317('0x38')]=_[_0x9317('0x37')](_0x3b5763[_0x9317('0x38')]);_0x574889[_0x9317('0x40')]=_['intersection'](_0x574889[_0x9317('0x36')],_0x574889[_0x9317('0x38')]);_0x519c0c[_0x9317('0x3a')]=_[_0x9317('0x39')](_0x574889[_0x9317('0x36')],qs[_0x9317('0x4c')](_0x3b5763['query'][_0x9317('0x4c')]));_0x519c0c['attributes']=_0x519c0c['attributes'][_0x9317('0x5b')]?_0x519c0c[_0x9317('0x3a')]:_0x574889['model'];_0x519c0c[_0x9317('0x3d')]=qs['sort'](_0x3b5763[_0x9317('0x38')][_0x9317('0x3e')]);_0x519c0c[_0x9317('0x3f')]=qs['filters'](_[_0x9317('0x41')](_0x3b5763[_0x9317('0x38')],_0x574889[_0x9317('0x40')]));if(_0x3b5763['query']['filter']){_0x519c0c[_0x9317('0x3f')]=_[_0x9317('0x43')](_0x519c0c[_0x9317('0x3f')],{'$or':_[_0x9317('0x30')](_0x519c0c['attributes'],function(_0x33c947){var _0x358ee8={};_0x358ee8[_0x33c947]={'$like':'%'+_0x3b5763[_0x9317('0x38')][_0x9317('0x42')]+'%'};return _0x358ee8;})});}_0x519c0c=_[_0x9317('0x43')]({},_0x519c0c,_0x3b5763[_0x9317('0x4d')]);return _0x5d469f[_0x9317('0x68')](_0x519c0c);}})['then'](function(_0x18b9cc){if(_0x18b9cc){_0x5c3336=_0x18b9cc['length'];if(!_0x3b5763[_0x9317('0x38')]['hasOwnProperty'](_0x9317('0x3c'))){_0x519c0c[_0x9317('0x22')]=qs[_0x9317('0x22')](_0x3b5763[_0x9317('0x38')]['limit']);_0x519c0c[_0x9317('0x21')]=qs[_0x9317('0x21')](_0x3b5763[_0x9317('0x38')]['offset']);}return _0x5d469f[_0x9317('0x68')](_0x519c0c);}})[_0x9317('0x29')](function(_0x1cd6ec){if(_0x1cd6ec){return _0x1cd6ec?{'count':_0x5c3336,'rows':_0x1cd6ec}:null;}})[_0x9317('0x29')](respondWithResult(_0x51d442,null))['catch'](handleError(_0x51d442,null));};exports[_0x9317('0x69')]=function(_0x23dbb7,_0x17f776,_0x187d86){var _0x180c86=_0x23dbb7[_0x9317('0x4f')][_0x9317('0x6a')];return db[_0x9317('0x67')][_0x9317('0x47')]({'where':{'id':_0x180c86},'attributes':['id'],'include':[{'model':db[_0x9317('0x5d')],'as':_0x9317('0x6b'),'attributes':['id',_0x9317('0x2e'),_0x9317('0x6c'),_0x9317('0x6d'),_0x9317('0x6e')],'raw':!![]}]})[_0x9317('0x29')](function(_0x3b6220){if(_0x3b6220){var _0x45b764=_['flatMap'](_0x3b6220,function(_0x4a55a4){var _0xffa5f=_0x4a55a4[_0x9317('0x51')]({'plain':!![]});return _0xffa5f[_0x9317('0x6b')];});return db['MailQueue'][_0x9317('0x53')]({'where':{'id':_0x23dbb7['params']['id']}})[_0x9317('0x29')](function(_0x21f9d1){return db[_0x9317('0x6f')][_0x9317('0x70')](function(_0x1defc3){return _0x21f9d1[_0x9317('0x69')](_0x180c86,{'transaction':_0x1defc3})[_0x9317('0x29')](function(){return BPromise[_0x9317('0x71')](_0x45b764,function(_0xc34e0f){return db[_0x9317('0x5a')][_0x9317('0x72')]({'where':{'UserId':_0xc34e0f['id'],'MailQueueId':_0x23dbb7['params']['id']},'transaction':_0x1defc3});});})[_0x9317('0x29')](function(){_0x45b764['forEach'](function(_0x4c1e5c){socket[_0x9317('0x73')]('userMailQueue:save',{'UserId':_0x4c1e5c['id'],'MailQueueId':_0x21f9d1['id']});});});});});}})[_0x9317('0x29')](respondWithStatusCode(_0x17f776,null))[_0x9317('0x49')](handleError(_0x17f776,null));};exports[_0x9317('0x74')]=function(_0xf51cbf,_0x21e895,_0x56408f){return db[_0x9317('0x67')][_0x9317('0x47')]({'where':{'id':_0xf51cbf[_0x9317('0x38')][_0x9317('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9317('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x9317('0x29')](handleEntityNotFound(_0x21e895,null))['then'](function(_0x437568){var _0x1d2612=_[_0x9317('0x30')](_0x437568,'id');var _0x4cd8b1=[];var _0x32d63d=[];var _0x5be6f8=squel[_0x9317('0x75')]();_0x5be6f8['field'](_0x9317('0x76'))[_0x9317('0x77')]('team_has_mail_queues','tq')[_0x9317('0x78')](_0x9317('0x79'),'ut',_0x9317('0x7a'))['where'](_0x9317('0x7b'),_0xf51cbf[_0x9317('0x4b')]['id']);for(var _0x37032b=0x0;_0x37032b<_0x437568['length'];_0x37032b+=0x1){let _0x59a0cb=_0x437568[_0x37032b];for(var _0x3b77bf=0x0;_0x3b77bf<_0x59a0cb['Agents'][_0x9317('0x5b')];_0x3b77bf+=0x1){let _0x19843b=_0x59a0cb[_0x9317('0x6b')][_0x3b77bf];var _0x5a9657=_0x5be6f8[_0x9317('0x7c')]();_0x5a9657[_0x9317('0x3f')](_0x9317('0x7d'),_0x19843b['id']);_0x32d63d[_0x9317('0x7e')](db[_0x9317('0x6f')][_0x9317('0x38')](_0x5a9657[_0x9317('0x7f')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x9317('0x29')](function(_0xc8cd29){if(_0xc8cd29[_0x9317('0x5b')]===0x1){return _0x19843b['id'];}else{var _0x15ac13=_[_0x9317('0x80')](_[_0x9317('0x30')](_0xc8cd29,_0x9317('0x81')),function(_0x583d8b){return _[_0x9317('0x82')](_0x1d2612,_0x583d8b);});if(_0x15ac13){return _0x19843b['id'];}}}));}}return BPromise[_0x9317('0x83')](_0x32d63d)['then'](function(_0x4158fd){_0x4cd8b1=_(_0x4cd8b1)[_0x9317('0x84')](_0x4158fd)[_0x9317('0x85')]()[_0x9317('0x86')]();return db['MailQueue'][_0x9317('0x53')]({'where':{'id':_0xf51cbf['params']['id']}})['then'](function(_0x1eeb87){return db[_0x9317('0x6f')]['transaction'](function(_0x3382ff){return _0x1eeb87[_0x9317('0x74')](_0xf51cbf[_0x9317('0x38')][_0x9317('0x6a')],{'transaction':_0x3382ff})[_0x9317('0x29')](function(){if(!_[_0x9317('0x87')](_0x4cd8b1)){return _0x1eeb87[_0x9317('0x88')](_0x4cd8b1,{'transaction':_0x3382ff});}})[_0x9317('0x29')](function(){_0x4cd8b1['forEach'](function(_0x5ca506){socket[_0x9317('0x73')]('userMailQueue:remove',{'UserId':_0x5ca506,'MailQueueId':_0x1eeb87['id']});});});});});});})[_0x9317('0x29')](respondWithStatusCode(_0x21e895,null))[_0x9317('0x49')](handleError(_0x21e895,null));};exports[_0x9317('0x89')]=function(_0xa8602a,_0x31e5d5,_0x209018){return db['MailQueue'][_0x9317('0x53')]({'where':{'id':_0xa8602a[_0x9317('0x4b')]['id']}})[_0x9317('0x29')](handleEntityNotFound(_0x31e5d5,null))[_0x9317('0x29')](function(_0x1755b5){if(_0x1755b5){return _0x1755b5[_0x9317('0x89')](_0xa8602a[_0x9317('0x4f')][_0x9317('0x6a')],_[_0x9317('0x8a')](_0xa8602a['body'],[_0x9317('0x6a'),'id'])||{})['spread'](function(_0x3caf33){for(var _0x467f45=0x0;_0x467f45<_0xa8602a[_0x9317('0x4f')][_0x9317('0x6a')][_0x9317('0x5b')];_0x467f45+=0x1){socket[_0x9317('0x73')](_0x9317('0x8b'),{'UserId':_0xa8602a[_0x9317('0x4f')][_0x9317('0x6a')][_0x467f45],'MailQueueId':_0xa8602a[_0x9317('0x4b')]['id']});}return _0x3caf33;});}})[_0x9317('0x29')](respondWithResult(_0x31e5d5,null))[_0x9317('0x49')](handleError(_0x31e5d5,null));};exports[_0x9317('0x88')]=function(_0x3bb51f,_0x4b3a13,_0x240714){return db[_0x9317('0x31')][_0x9317('0x53')]({'where':{'id':_0x3bb51f['params']['id']}})['then'](handleEntityNotFound(_0x4b3a13,null))[_0x9317('0x29')](function(_0x4cea36){if(_0x4cea36){return _0x4cea36['removeAgents'](_0x3bb51f[_0x9317('0x38')][_0x9317('0x6a')])['then'](function(){if(_[_0x9317('0x8c')](_0x3bb51f['query'][_0x9317('0x6a')])){for(var _0x4fc0c1=0x0;_0x4fc0c1<_0x3bb51f['query'][_0x9317('0x6a')]['length'];_0x4fc0c1+=0x1){socket[_0x9317('0x73')](_0x9317('0x8d'),{'UserId':Number(_0x3bb51f[_0x9317('0x38')]['ids'][_0x4fc0c1]),'MailQueueId':Number(_0x3bb51f[_0x9317('0x4b')]['id'])});}}else{socket[_0x9317('0x73')](_0x9317('0x8d'),{'UserId':Number(_0x3bb51f['query']['ids']),'MailQueueId':Number(_0x3bb51f[_0x9317('0x4b')]['id'])});}});}})[_0x9317('0x29')](respondWithStatusCode(_0x4b3a13,null))[_0x9317('0x49')](handleError(_0x4b3a13,null));};exports[_0x9317('0x8e')]=function(_0x26e2fd,_0xcc9b50,_0x34df31){var _0x19f30c={};var _0x1d52e2={};var _0x459596;var _0x2999b6;return db[_0x9317('0x31')][_0x9317('0x59')]({'where':{'id':_0x26e2fd[_0x9317('0x4b')]['id']}})[_0x9317('0x29')](handleEntityNotFound(_0xcc9b50,null))['then'](function(_0x5ce50f){if(_0x5ce50f){_0x459596=_0x5ce50f;_0x1d52e2[_0x9317('0x36')]=_[_0x9317('0x37')](db[_0x9317('0x5d')][_0x9317('0x32')]);_0x1d52e2['query']=_['keys'](_0x26e2fd['query']);_0x1d52e2[_0x9317('0x40')]=_[_0x9317('0x39')](_0x1d52e2[_0x9317('0x36')],_0x1d52e2['query']);_0x19f30c[_0x9317('0x3a')]=_[_0x9317('0x39')](_0x1d52e2[_0x9317('0x36')],qs[_0x9317('0x4c')](_0x26e2fd[_0x9317('0x38')][_0x9317('0x4c')]));_0x19f30c[_0x9317('0x3a')]=_0x19f30c[_0x9317('0x3a')][_0x9317('0x5b')]?_0x19f30c['attributes']:_0x1d52e2[_0x9317('0x36')];_0x19f30c['order']=qs[_0x9317('0x3e')](_0x26e2fd['query'][_0x9317('0x3e')]);_0x19f30c['where']=qs[_0x9317('0x40')](_[_0x9317('0x41')](_0x26e2fd[_0x9317('0x38')],_0x1d52e2['filters']));if(_0x26e2fd[_0x9317('0x38')]['filter']){_0x19f30c[_0x9317('0x3f')]=_[_0x9317('0x43')](_0x19f30c['where'],{'$or':_[_0x9317('0x30')](_0x19f30c[_0x9317('0x3a')],function(_0x2edcb3){var _0x28ee13={};_0x28ee13[_0x2edcb3]={'$like':'%'+_0x26e2fd[_0x9317('0x38')][_0x9317('0x42')]+'%'};return _0x28ee13;})});}_0x19f30c=_['merge']({},_0x19f30c,_0x26e2fd[_0x9317('0x4d')]);return _0x459596[_0x9317('0x8e')](_0x19f30c);}})[_0x9317('0x29')](function(_0x59fb50){if(_0x59fb50){_0x2999b6=_0x59fb50[_0x9317('0x5b')];if(!_0x26e2fd['query'][_0x9317('0x3b')]('nolimit')){_0x19f30c[_0x9317('0x22')]=qs[_0x9317('0x22')](_0x26e2fd[_0x9317('0x38')][_0x9317('0x22')]);_0x19f30c[_0x9317('0x21')]=qs[_0x9317('0x21')](_0x26e2fd['query'][_0x9317('0x21')]);}return _0x459596[_0x9317('0x8e')](_0x19f30c);}})[_0x9317('0x29')](function(_0x3b90b0){if(_0x3b90b0){return _0x3b90b0?{'count':_0x2999b6,'rows':_0x3b90b0}:null;}})[_0x9317('0x29')](respondWithResult(_0xcc9b50,null))['catch'](handleError(_0xcc9b50,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 0dd8007..8ec83b6 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 _0x7374=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x55a178,_0x2e135e){var _0x2fab3f=function(_0x1ad954){while(--_0x1ad954){_0x55a178['push'](_0x55a178['shift']());}};_0x2fab3f(++_0x2e135e);}(_0x7374,0x1de));var _0x4737=function(_0x31af27,_0x4b80be){_0x31af27=_0x31af27-0x0;var _0x3a9bf0=_0x7374[_0x31af27];return _0x3a9bf0;};'use strict';var EventEmitter=require(_0x4737('0x0'));var MailQueue=require(_0x4737('0x1'))['db'][_0x4737('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4737('0x3')](0x0);var events={'afterCreate':_0x4737('0x4'),'afterUpdate':_0x4737('0x5'),'afterDestroy':_0x4737('0x6')};function emitEvent(_0x2c0584){return function(_0x58766a,_0x598f59,_0x15ee4c){MailQueueEvents[_0x4737('0x7')](_0x2c0584+':'+_0x58766a['id'],_0x58766a);MailQueueEvents[_0x4737('0x7')](_0x2c0584,_0x58766a);_0x15ee4c(null);};}for(var e in events){if(events[_0x4737('0x8')](e)){var event=events[e];MailQueue[_0x4737('0x9')](e,emitEvent(event));}}module[_0x4737('0xa')]=MailQueueEvents; \ No newline at end of file +var _0xb26d=['MailQueue','setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x3d8d49,_0x5ef7a4){var _0x3e5cf8=function(_0x5338f5){while(--_0x5338f5){_0x3d8d49['push'](_0x3d8d49['shift']());}};_0x3e5cf8(++_0x5ef7a4);}(_0xb26d,0x15d));var _0xdb26=function(_0x40c8ac,_0x48cfda){_0x40c8ac=_0x40c8ac-0x0;var _0x3aafe8=_0xb26d[_0x40c8ac];return _0x3aafe8;};'use strict';var EventEmitter=require(_0xdb26('0x0'));var MailQueue=require(_0xdb26('0x1'))['db'][_0xdb26('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xdb26('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb26('0x4'),'afterDestroy':_0xdb26('0x5')};function emitEvent(_0x506153){return function(_0x15bafb,_0x347d0c,_0x364697){MailQueueEvents[_0xdb26('0x6')](_0x506153+':'+_0x15bafb['id'],_0x15bafb);MailQueueEvents[_0xdb26('0x6')](_0x506153,_0x15bafb);_0x364697(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xdb26('0x7')](e,emitEvent(event));}}module[_0xdb26('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 89e08ce..64218e7 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 _0x1981=['./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2ec06f,_0x3bb56d){var _0x3a1c71=function(_0x5ca631){while(--_0x5ca631){_0x2ec06f['push'](_0x2ec06f['shift']());}};_0x3a1c71(++_0x3bb56d);}(_0x1981,0x1d9));var _0x1198=function(_0x5e62fa,_0x14276b){_0x5e62fa=_0x5e62fa-0x0;var _0x41d2c6=_0x1981[_0x5e62fa];return _0x41d2c6;};'use strict';var _=require(_0x1198('0x0'));var util=require(_0x1198('0x1'));var logger=require(_0x1198('0x2'))(_0x1198('0x3'));var moment=require('moment');var BPromise=require(_0x1198('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1198('0x5'));var rimraf=require(_0x1198('0x6'));var config=require('../../config/environment');var attributes=require(_0x1198('0x7'));module[_0x1198('0x8')]=function(_0xbb43b3,_0x1c778b){return _0xbb43b3[_0x1198('0x9')](_0x1198('0xa'),attributes,{'tableName':_0x1198('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd47f=['path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2f9bf6,_0x38a31d){var _0x2d88b5=function(_0x104137){while(--_0x104137){_0x2f9bf6['push'](_0x2f9bf6['shift']());}};_0x2d88b5(++_0x38a31d);}(_0xd47f,0x8b));var _0xfd47=function(_0x3a0cc5,_0x27540f){_0x3a0cc5=_0x3a0cc5-0x0;var _0x5eca0a=_0xd47f[_0x3a0cc5];return _0x5eca0a;};'use strict';var _=require(_0xfd47('0x0'));var util=require('util');var logger=require(_0xfd47('0x1'))(_0xfd47('0x2'));var moment=require(_0xfd47('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd47('0x4'));var fs=require('fs');var path=require(_0xfd47('0x5'));var rimraf=require(_0xfd47('0x6'));var config=require(_0xfd47('0x7'));var attributes=require(_0xfd47('0x8'));module[_0xfd47('0x9')]=function(_0x47cb6c,_0x4ace0b){return _0x47cb6c['define'](_0xfd47('0xa'),attributes,{'tableName':_0xfd47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index e34b042..5c226e7 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 _0x211d=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model','map','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring'];(function(_0x4402b6,_0x2c8543){var _0x1c9a9b=function(_0x3f2f80){while(--_0x3f2f80){_0x4402b6['push'](_0x4402b6['shift']());}};_0x1c9a9b(++_0x2c8543);}(_0x211d,0xeb));var _0xd211=function(_0x19bbf0,_0x386a94){_0x19bbf0=_0x19bbf0-0x0;var _0x574bf6=_0x211d[_0x19bbf0];return _0x574bf6;};'use strict';var _=require(_0xd211('0x0'));var util=require(_0xd211('0x1'));var moment=require(_0xd211('0x2'));var BPromise=require(_0xd211('0x3'));var rs=require(_0xd211('0x4'));var fs=require('fs');var Redis=require(_0xd211('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd211('0x6'))(_0xd211('0x7'));var config=require(_0xd211('0x8'));var jayson=require(_0xd211('0x9'));var client=jayson[_0xd211('0xa')]['http']({'port':0x232a});config['redis']=_[_0xd211('0xb')](config[_0xd211('0xc')],{'host':_0xd211('0xd'),'port':0x18eb});var socket=require(_0xd211('0xe'))(new Redis(config[_0xd211('0xc')]));require(_0xd211('0xf'))[_0xd211('0x10')](socket);function respondWithRpcPromise(_0x55d47d,_0x47084d,_0x5882b9){return new BPromise(function(_0x39ed7a,_0x11248b){return client['request'](_0x55d47d,_0x5882b9)[_0xd211('0x11')](function(_0x377414){logger[_0xd211('0x12')]('MailQueue,\x20%s,\x20%s',_0x47084d,_0xd211('0x13'));logger[_0xd211('0x14')](_0xd211('0x15'),_0x47084d,_0xd211('0x13'),JSON[_0xd211('0x16')](_0x377414));if(_0x377414[_0xd211('0x17')]){if(_0x377414['error'][_0xd211('0x18')]===0x1f4){logger['error'](_0xd211('0x19'),_0x47084d,_0x377414['error'][_0xd211('0x1a')]);return _0x11248b(_0x377414[_0xd211('0x17')]['message']);}logger[_0xd211('0x17')](_0xd211('0x19'),_0x47084d,_0x377414[_0xd211('0x17')][_0xd211('0x1a')]);return _0x39ed7a(_0x377414['error'][_0xd211('0x1a')]);}else{logger['info'](_0xd211('0x19'),_0x47084d,_0xd211('0x13'));_0x39ed7a(_0x377414[_0xd211('0x1b')][_0xd211('0x1a')]);}})['catch'](function(_0x4834a7){logger[_0xd211('0x17')](_0xd211('0x19'),_0x47084d,_0x4834a7);_0x11248b(_0x4834a7);});});}exports[_0xd211('0x1c')]=function(_0x2208eb){var _0x4f8c9e=this;return new Promise(function(_0x3da319,_0x19899c){return db[_0xd211('0x1d')]['findAll']({'raw':_0x2208eb['options']?_0x2208eb[_0xd211('0x1e')][_0xd211('0x1f')]===undefined?!![]:![]:!![],'where':_0x2208eb[_0xd211('0x1e')]?_0x2208eb[_0xd211('0x1e')][_0xd211('0x20')]||null:null,'attributes':_0x2208eb[_0xd211('0x1e')]?_0x2208eb[_0xd211('0x1e')][_0xd211('0x21')]||null:null,'limit':_0x2208eb[_0xd211('0x1e')]?_0x2208eb[_0xd211('0x1e')][_0xd211('0x22')]||null:null,'include':_0x2208eb['options']?_0x2208eb[_0xd211('0x1e')]['include']?_['map'](_0x2208eb['options'][_0xd211('0x23')],function(_0x60485f){return{'model':db[_0x60485f[_0xd211('0x24')]],'as':_0x60485f['as'],'attributes':_0x60485f['attributes'],'include':_0x60485f[_0xd211('0x23')]?_[_0xd211('0x25')](_0x60485f[_0xd211('0x23')],function(_0x4f71e8){return{'model':db[_0x4f71e8[_0xd211('0x24')]],'as':_0x4f71e8['as'],'attributes':_0x4f71e8[_0xd211('0x21')],'include':_0x4f71e8[_0xd211('0x23')]?_[_0xd211('0x25')](_0x4f71e8[_0xd211('0x23')],function(_0x1622bc){return{'model':db[_0x1622bc[_0xd211('0x24')]],'as':_0x1622bc['as'],'attributes':_0x1622bc[_0xd211('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd211('0x11')](function(_0x30a90c){logger[_0xd211('0x12')]('GetMailQueue',_0x2208eb);logger[_0xd211('0x14')](_0xd211('0x1c'),_0x2208eb,JSON[_0xd211('0x16')](_0x30a90c));_0x3da319(_0x30a90c);})['catch'](function(_0x6d94ea){logger[_0xd211('0x17')](_0xd211('0x1c'),_0x6d94ea[_0xd211('0x1a')],_0x2208eb);_0x19899c(_0x4f8c9e[_0xd211('0x17')](0x1f4,_0x6d94ea[_0xd211('0x1a')]));});});};exports[_0xd211('0x26')]=function(_0x27f8cb){var _0x4516eb=this;return new Promise(function(_0x2e6e1b,_0x13a090){return db[_0xd211('0x1d')][_0xd211('0x27')]({'raw':_0x27f8cb['options']?_0x27f8cb[_0xd211('0x1e')][_0xd211('0x1f')]===undefined?!![]:![]:!![],'where':_0x27f8cb[_0xd211('0x1e')]?_0x27f8cb['options'][_0xd211('0x20')]||null:null,'attributes':_0x27f8cb[_0xd211('0x1e')]?_0x27f8cb[_0xd211('0x1e')][_0xd211('0x21')]||null:null,'include':_0x27f8cb[_0xd211('0x1e')]?_0x27f8cb[_0xd211('0x1e')][_0xd211('0x23')]?_['map'](_0x27f8cb[_0xd211('0x1e')][_0xd211('0x23')],function(_0x22da26){return{'model':db[_0x22da26['model']],'as':_0x22da26['as'],'attributes':_0x22da26[_0xd211('0x21')],'include':_0x22da26[_0xd211('0x23')]?_['map'](_0x22da26[_0xd211('0x23')],function(_0x5cd3b6){return{'model':db[_0x5cd3b6['model']],'as':_0x5cd3b6['as'],'attributes':_0x5cd3b6[_0xd211('0x21')],'include':_0x5cd3b6[_0xd211('0x23')]?_[_0xd211('0x25')](_0x5cd3b6[_0xd211('0x23')],function(_0x3ae7e9){return{'model':db[_0x3ae7e9['model']],'as':_0x3ae7e9['as'],'attributes':_0x3ae7e9[_0xd211('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd211('0x11')](function(_0xc44c4d){logger['info'](_0xd211('0x26'),_0x27f8cb);logger[_0xd211('0x14')]('ShowMailQueue',_0x27f8cb,JSON[_0xd211('0x16')](_0xc44c4d));_0x2e6e1b(_0xc44c4d);})['catch'](function(_0x11e2dc){logger['error'](_0xd211('0x26'),_0x11e2dc[_0xd211('0x1a')],_0x27f8cb);_0x13a090(_0x4516eb[_0xd211('0x17')](0x1f4,_0x11e2dc[_0xd211('0x1a')]));});});}; \ No newline at end of file +var _0x9808=['GetMailQueue','ShowMailQueue','MailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','where','attributes','limit','include','map','model'];(function(_0xe48a36,_0x10c4cc){var _0x3ff569=function(_0x166ce5){while(--_0x166ce5){_0xe48a36['push'](_0xe48a36['shift']());}};_0x3ff569(++_0x10c4cc);}(_0x9808,0x11d));var _0x8980=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0x9808[_0x19f9e6];return _0x45c862;};'use strict';var _=require(_0x8980('0x0'));var util=require(_0x8980('0x1'));var moment=require(_0x8980('0x2'));var BPromise=require(_0x8980('0x3'));var rs=require(_0x8980('0x4'));var fs=require('fs');var Redis=require(_0x8980('0x5'));var db=require(_0x8980('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8980('0x7'))('rpc');var config=require(_0x8980('0x8'));var jayson=require(_0x8980('0x9'));var client=jayson['client'][_0x8980('0xa')]({'port':0x232a});config[_0x8980('0xb')]=_[_0x8980('0xc')](config['redis'],{'host':_0x8980('0xd'),'port':0x18eb});var socket=require(_0x8980('0xe'))(new Redis(config[_0x8980('0xb')]));require(_0x8980('0xf'))['register'](socket);function respondWithRpcPromise(_0x1c5394,_0x56d296,_0x2e6159){return new BPromise(function(_0x5cbe46,_0x11d5b4){return client[_0x8980('0x10')](_0x1c5394,_0x2e6159)['then'](function(_0x308ae2){logger[_0x8980('0x11')](_0x8980('0x12'),_0x56d296,_0x8980('0x13'));logger[_0x8980('0x14')](_0x8980('0x15'),_0x56d296,_0x8980('0x13'),JSON[_0x8980('0x16')](_0x308ae2));if(_0x308ae2[_0x8980('0x17')]){if(_0x308ae2[_0x8980('0x17')]['code']===0x1f4){logger[_0x8980('0x17')](_0x8980('0x12'),_0x56d296,_0x308ae2[_0x8980('0x17')]['message']);return _0x11d5b4(_0x308ae2[_0x8980('0x17')][_0x8980('0x18')]);}logger[_0x8980('0x17')]('MailQueue,\x20%s,\x20%s',_0x56d296,_0x308ae2[_0x8980('0x17')][_0x8980('0x18')]);return _0x5cbe46(_0x308ae2['error'][_0x8980('0x18')]);}else{logger[_0x8980('0x11')](_0x8980('0x12'),_0x56d296,_0x8980('0x13'));_0x5cbe46(_0x308ae2[_0x8980('0x19')]['message']);}})[_0x8980('0x1a')](function(_0x3d1c98){logger[_0x8980('0x17')](_0x8980('0x12'),_0x56d296,_0x3d1c98);_0x11d5b4(_0x3d1c98);});});}exports['GetMailQueue']=function(_0x5a00be){var _0x37791f=this;return new Promise(function(_0x4c3324,_0x118ec8){return db['MailQueue'][_0x8980('0x1b')]({'raw':_0x5a00be['options']?_0x5a00be[_0x8980('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5a00be['options']?_0x5a00be[_0x8980('0x1c')][_0x8980('0x1d')]||null:null,'attributes':_0x5a00be['options']?_0x5a00be[_0x8980('0x1c')][_0x8980('0x1e')]||null:null,'limit':_0x5a00be[_0x8980('0x1c')]?_0x5a00be[_0x8980('0x1c')][_0x8980('0x1f')]||null:null,'include':_0x5a00be[_0x8980('0x1c')]?_0x5a00be[_0x8980('0x1c')]['include']?_['map'](_0x5a00be[_0x8980('0x1c')]['include'],function(_0xec539b){return{'model':db[_0xec539b['model']],'as':_0xec539b['as'],'attributes':_0xec539b['attributes'],'include':_0xec539b[_0x8980('0x20')]?_[_0x8980('0x21')](_0xec539b[_0x8980('0x20')],function(_0x437d20){return{'model':db[_0x437d20['model']],'as':_0x437d20['as'],'attributes':_0x437d20[_0x8980('0x1e')],'include':_0x437d20[_0x8980('0x20')]?_[_0x8980('0x21')](_0x437d20[_0x8980('0x20')],function(_0x146552){return{'model':db[_0x146552[_0x8980('0x22')]],'as':_0x146552['as'],'attributes':_0x146552[_0x8980('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f124d){logger[_0x8980('0x11')](_0x8980('0x23'),_0x5a00be);logger[_0x8980('0x14')](_0x8980('0x23'),_0x5a00be,JSON[_0x8980('0x16')](_0x1f124d));_0x4c3324(_0x1f124d);})['catch'](function(_0x57d804){logger['error'](_0x8980('0x23'),_0x57d804[_0x8980('0x18')],_0x5a00be);_0x118ec8(_0x37791f[_0x8980('0x17')](0x1f4,_0x57d804[_0x8980('0x18')]));});});};exports[_0x8980('0x24')]=function(_0xb7c7e9){var _0x294666=this;return new Promise(function(_0x50f751,_0x411c81){return db[_0x8980('0x25')][_0x8980('0x26')]({'raw':_0xb7c7e9['options']?_0xb7c7e9[_0x8980('0x1c')][_0x8980('0x27')]===undefined?!![]:![]:!![],'where':_0xb7c7e9[_0x8980('0x1c')]?_0xb7c7e9['options'][_0x8980('0x1d')]||null:null,'attributes':_0xb7c7e9[_0x8980('0x1c')]?_0xb7c7e9[_0x8980('0x1c')][_0x8980('0x1e')]||null:null,'include':_0xb7c7e9['options']?_0xb7c7e9[_0x8980('0x1c')][_0x8980('0x20')]?_[_0x8980('0x21')](_0xb7c7e9[_0x8980('0x1c')]['include'],function(_0x11ea95){return{'model':db[_0x11ea95[_0x8980('0x22')]],'as':_0x11ea95['as'],'attributes':_0x11ea95[_0x8980('0x1e')],'include':_0x11ea95[_0x8980('0x20')]?_['map'](_0x11ea95[_0x8980('0x20')],function(_0x2d98e6){return{'model':db[_0x2d98e6[_0x8980('0x22')]],'as':_0x2d98e6['as'],'attributes':_0x2d98e6[_0x8980('0x1e')],'include':_0x2d98e6[_0x8980('0x20')]?_['map'](_0x2d98e6[_0x8980('0x20')],function(_0x4480d6){return{'model':db[_0x4480d6['model']],'as':_0x4480d6['as'],'attributes':_0x4480d6[_0x8980('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ec5ac){logger[_0x8980('0x11')](_0x8980('0x24'),_0xb7c7e9);logger[_0x8980('0x14')]('ShowMailQueue',_0xb7c7e9,JSON[_0x8980('0x16')](_0x1ec5ac));_0x50f751(_0x1ec5ac);})[_0x8980('0x1a')](function(_0x42b2d9){logger[_0x8980('0x17')](_0x8980('0x24'),_0x42b2d9['message'],_0xb7c7e9);_0x411c81(_0x294666['error'](0x1f4,_0x42b2d9['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b6c1b7c..4a5bdce 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 _0x0b81=['save','removeListener','length','./mailQueue.events'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x0b81,0x1cb));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x10b8('0x0'));var events=[_0x10b8('0x1'),'remove','update'];function createListener(_0x3d5d21,_0x50ccfb){return function(_0x30148c){_0x50ccfb['emit'](_0x3d5d21,_0x30148c);};}function removeListener(_0x180845,_0x1cd016){return function(){MailQueueEvents[_0x10b8('0x2')](_0x180845,_0x1cd016);};}exports['register']=function(_0x93b04){for(var _0x551c50=0x0,_0x273249=events[_0x10b8('0x3')];_0x551c50<_0x273249;_0x551c50++){var _0x408350=events[_0x551c50];var _0x46cc97=createListener('mailQueue:'+_0x408350,_0x93b04);MailQueueEvents['on'](_0x408350,_0x46cc97);}}; \ No newline at end of file +var _0xc63f=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x15b045,_0x50c353){var _0x3520e5=function(_0x29d78f){while(--_0x29d78f){_0x15b045['push'](_0x15b045['shift']());}};_0x3520e5(++_0x50c353);}(_0xc63f,0xd9));var _0xfc63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc63f[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0xfc63('0x0'));var events=[_0xfc63('0x1'),_0xfc63('0x2'),_0xfc63('0x3')];function createListener(_0x528559,_0x5e06d7){return function(_0xa1c4a2){_0x5e06d7[_0xfc63('0x4')](_0x528559,_0xa1c4a2);};}function removeListener(_0x3b0db5,_0x138f15){return function(){MailQueueEvents[_0xfc63('0x5')](_0x3b0db5,_0x138f15);};}exports[_0xfc63('0x6')]=function(_0x21f0ec){for(var _0x5f14d7=0x0,_0x957aea=events['length'];_0x5f14d7<_0x957aea;_0x5f14d7++){var _0x59d758=events[_0x5f14d7];var _0xadd094=createListener(_0xfc63('0x7')+_0x59d758,_0x21f0ec);MailQueueEvents['on'](_0x59d758,_0xadd094);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index f23bfa8..e621330 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 _0x88f5=['/:id','show','post','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x208e83,_0x5af60a){var _0x21b194=function(_0x52f968){while(--_0x52f968){_0x208e83['push'](_0x208e83['shift']());}};_0x21b194(++_0x5af60a);}(_0x88f5,0x79));var _0x588f=function(_0x22dee2,_0x5d95bc){_0x22dee2=_0x22dee2-0x0;var _0x44d0cf=_0x88f5[_0x22dee2];return _0x44d0cf;};'use strict';var multer=require(_0x588f('0x0'));var util=require(_0x588f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x588f('0x2'));var router=express[_0x588f('0x3')]();var fs_extra=require(_0x588f('0x4'));var auth=require(_0x588f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x588f('0x6'));var controller=require(_0x588f('0x7'));router[_0x588f('0x8')]('/',auth[_0x588f('0x9')](),controller['index']);router[_0x588f('0x8')](_0x588f('0xa'),auth[_0x588f('0x9')](),controller[_0x588f('0xb')]);router[_0x588f('0x8')](_0x588f('0xc'),auth['isAuthenticated'](),controller[_0x588f('0xd')]);router[_0x588f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x588f('0xf')](_0x588f('0xc'),auth[_0x588f('0x9')](),controller['update']);router[_0x588f('0x10')]('/:id',auth[_0x588f('0x9')](),controller[_0x588f('0x11')]);module[_0x588f('0x12')]=router; \ No newline at end of file +var _0x0f93=['../../config/environment','./mailQueueReport.controller','get','index','/describe','show','create','put','/:id','update','delete','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2d8bc8,_0x4e8d3d){var _0x495aa7=function(_0x1170be){while(--_0x1170be){_0x2d8bc8['push'](_0x2d8bc8['shift']());}};_0x495aa7(++_0x4e8d3d);}(_0x0f93,0x66));var _0x30f9=function(_0x3332a4,_0x3c50f){_0x3332a4=_0x3332a4-0x0;var _0xfa1e4f=_0x0f93[_0x3332a4];return _0xfa1e4f;};'use strict';var multer=require('multer');var util=require(_0x30f9('0x0'));var path=require(_0x30f9('0x1'));var timeout=require(_0x30f9('0x2'));var express=require(_0x30f9('0x3'));var router=express[_0x30f9('0x4')]();var fs_extra=require(_0x30f9('0x5'));var auth=require(_0x30f9('0x6'));var interaction=require(_0x30f9('0x7'));var config=require(_0x30f9('0x8'));var controller=require(_0x30f9('0x9'));router[_0x30f9('0xa')]('/',auth['isAuthenticated'](),controller[_0x30f9('0xb')]);router[_0x30f9('0xa')](_0x30f9('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x30f9('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x30f9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x30f9('0xe')]);router[_0x30f9('0xf')](_0x30f9('0x10'),auth['isAuthenticated'](),controller[_0x30f9('0x11')]);router[_0x30f9('0x12')](_0x30f9('0x10'),auth[_0x30f9('0x13')](),controller[_0x30f9('0x14')]);module[_0x30f9('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 77e7b2c..c94a2a4 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 _0xc4cc=['exports','STRING','DATE'];(function(_0xba7a47,_0x22662a){var _0x3a0ce0=function(_0x59f41d){while(--_0x59f41d){_0xba7a47['push'](_0xba7a47['shift']());}};_0x3a0ce0(++_0x22662a);}(_0xc4cc,0x189));var _0xcc4c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc4cc[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xcc4c('0x0')]={'uniqueid':{'type':Sequelize[_0xcc4c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xcc4c('0x1')]},'joinAt':{'type':Sequelize[_0xcc4c('0x2')]},'leaveAt':{'type':Sequelize[_0xcc4c('0x2')]},'acceptAt':{'type':Sequelize[_0xcc4c('0x2')]},'exitAt':{'type':Sequelize[_0xcc4c('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc3a=['DATE','moment','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc3a,0xa9));var _0xafc3=function(_0x22a2b3,_0x1b9e8d){_0x22a2b3=_0x22a2b3-0x0;var _0x48d024=_0xfc3a[_0x22a2b3];return _0x48d024;};'use strict';var moment=require(_0xafc3('0x0'));var Sequelize=require('sequelize');module[_0xafc3('0x1')]={'uniqueid':{'type':Sequelize[_0xafc3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xafc3('0x2')]},'joinAt':{'type':Sequelize[_0xafc3('0x3')]},'leaveAt':{'type':Sequelize[_0xafc3('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xafc3('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e0b18b0..d1430ad 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 _0x2b24=['stack','index','map','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','MailQueueReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','apply','reject','save','update','then','destroy','error'];(function(_0x197d9a,_0x9c38c4){var _0x1b4b1b=function(_0x46840c){while(--_0x46840c){_0x197d9a['push'](_0x197d9a['shift']());}};_0x1b4b1b(++_0x9c38c4);}(_0x2b24,0x72));var _0x42b2=function(_0x42e538,_0x54d51d){_0x42e538=_0x42e538-0x0;var _0x57475d=_0x2b24[_0x42e538];return _0x57475d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42b2('0x0'));var zipdir=require(_0x42b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42b2('0x2'));var moment=require(_0x42b2('0x3'));var BPromise=require(_0x42b2('0x4'));var Mustache=require(_0x42b2('0x5'));var util=require('util');var path=require(_0x42b2('0x6'));var sox=require(_0x42b2('0x7'));var csv=require(_0x42b2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42b2('0x9'));var _=require(_0x42b2('0xa'));var squel=require(_0x42b2('0xb'));var crypto=require(_0x42b2('0xc'));var jsforce=require(_0x42b2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x42b2('0x8'));var querystring=require(_0x42b2('0xe'));var Papa=require(_0x42b2('0xf'));var Redis=require(_0x42b2('0x10'));var authService=require(_0x42b2('0x11'));var qs=require(_0x42b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x42b2('0x13'))(_0x42b2('0x14'));var utils=require(_0x42b2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x42b2('0x16'));var db=require(_0x42b2('0x17'))['db'];function respondWithStatusCode(_0xa60027,_0x5bc55a){_0x5bc55a=_0x5bc55a||0xcc;return function(_0x1acf90){if(_0x1acf90){return _0xa60027[_0x42b2('0x18')](_0x5bc55a);}return _0xa60027[_0x42b2('0x19')](_0x5bc55a)[_0x42b2('0x1a')]();};}function respondWithResult(_0x1e3985,_0x18fbda){_0x18fbda=_0x18fbda||0xc8;return function(_0x260480){if(_0x260480){return _0x1e3985['status'](_0x18fbda)['json'](_0x260480);}};}function respondWithFilteredResult(_0x29b64c,_0x35b8d2){return function(_0x2e945e){if(_0x2e945e){var _0x3ae2e4=typeof _0x35b8d2[_0x42b2('0x1b')]===_0x42b2('0x1c')&&typeof _0x35b8d2['limit']===_0x42b2('0x1c');var _0x1d4b41=_0x2e945e[_0x42b2('0x1d')];var _0xabcf0e=_0x3ae2e4?0x0:_0x35b8d2[_0x42b2('0x1b')];var _0x21d1b3=_0x3ae2e4?_0x2e945e[_0x42b2('0x1d')]:_0x35b8d2['offset']+_0x35b8d2['limit'];var _0x48e965;if(_0x21d1b3>=_0x1d4b41){_0x21d1b3=_0x1d4b41;_0x48e965=0xc8;}else{_0x48e965=0xce;}_0x29b64c[_0x42b2('0x19')](_0x48e965);return _0x29b64c[_0x42b2('0x1e')]('Content-Range',_0xabcf0e+'-'+_0x21d1b3+'/'+_0x1d4b41)['json'](_0x2e945e);}return null;};}function patchUpdates(_0x1fb2bb){return function(_0xb26ab3){try{jsonpatch[_0x42b2('0x1f')](_0xb26ab3,_0x1fb2bb,!![]);}catch(_0x2931bf){return BPromise[_0x42b2('0x20')](_0x2931bf);}return _0xb26ab3[_0x42b2('0x21')]();};}function saveUpdates(_0x2988de,_0x1a61c1){return function(_0x293550){if(_0x293550){return _0x293550[_0x42b2('0x22')](_0x2988de)[_0x42b2('0x23')](function(_0x16337e){return _0x16337e;});}return null;};}function removeEntity(_0x4c7e4f,_0x119519){return function(_0x2d6c88){if(_0x2d6c88){return _0x2d6c88[_0x42b2('0x24')]()[_0x42b2('0x23')](function(){_0x4c7e4f[_0x42b2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x215c63,_0x11cd9d){return function(_0x36c261){if(!_0x36c261){_0x215c63[_0x42b2('0x18')](0x194);}return _0x36c261;};}function handleError(_0x5569a7,_0x279fce){_0x279fce=_0x279fce||0x1f4;return function(_0x264431){logger[_0x42b2('0x25')](_0x264431[_0x42b2('0x26')]);if(_0x264431['name']){delete _0x264431['name'];}_0x5569a7['status'](_0x279fce)['send'](_0x264431);};}exports[_0x42b2('0x27')]=function(_0x3d49f9,_0x20cea9){var _0x25198d={},_0x34f936={},_0x4f5692={'count':0x0,'rows':[]};var _0x5784b2=_[_0x42b2('0x28')](db['MailQueueReport'][_0x42b2('0x29')],function(_0x501317){return{'name':_0x501317[_0x42b2('0x2a')],'type':_0x501317['type'][_0x42b2('0x2b')]};});_0x34f936[_0x42b2('0x2c')]=_[_0x42b2('0x28')](_0x5784b2,_0x42b2('0x2d'));_0x34f936[_0x42b2('0x2e')]=_['keys'](_0x3d49f9['query']);_0x34f936[_0x42b2('0x2f')]=_[_0x42b2('0x30')](_0x34f936['model'],_0x34f936[_0x42b2('0x2e')]);_0x25198d[_0x42b2('0x31')]=_[_0x42b2('0x30')](_0x34f936[_0x42b2('0x2c')],qs[_0x42b2('0x32')](_0x3d49f9[_0x42b2('0x2e')][_0x42b2('0x32')]));_0x25198d[_0x42b2('0x31')]=_0x25198d[_0x42b2('0x31')]['length']?_0x25198d[_0x42b2('0x31')]:_0x34f936['model'];if(!_0x3d49f9[_0x42b2('0x2e')][_0x42b2('0x33')](_0x42b2('0x34'))){_0x25198d[_0x42b2('0x35')]=qs['limit'](_0x3d49f9['query']['limit']);_0x25198d[_0x42b2('0x1b')]=qs['offset'](_0x3d49f9[_0x42b2('0x2e')][_0x42b2('0x1b')]);}_0x25198d[_0x42b2('0x36')]=qs[_0x42b2('0x37')](_0x3d49f9[_0x42b2('0x2e')][_0x42b2('0x37')]);_0x25198d['where']=qs['filters'](_[_0x42b2('0x38')](_0x3d49f9['query'],_0x34f936[_0x42b2('0x2f')]),_0x5784b2);if(_0x3d49f9['query'][_0x42b2('0x39')]){_0x25198d[_0x42b2('0x3a')]=_[_0x42b2('0x3b')](_0x25198d['where'],{'$or':_[_0x42b2('0x28')](_0x5784b2,function(_0x47fec9){if(_0x47fec9[_0x42b2('0x3c')]!==_0x42b2('0x3d')){var _0x1041e5={};_0x1041e5[_0x47fec9['name']]={'$like':'%'+_0x3d49f9[_0x42b2('0x2e')][_0x42b2('0x39')]+'%'};return _0x1041e5;}})});}_0x25198d=_[_0x42b2('0x3b')]({},_0x25198d,_0x3d49f9[_0x42b2('0x3e')]);var _0x2b5ad0={'where':_0x25198d[_0x42b2('0x3a')]};return db[_0x42b2('0x3f')][_0x42b2('0x1d')](_0x2b5ad0)[_0x42b2('0x23')](function(_0x3c3647){_0x4f5692[_0x42b2('0x1d')]=_0x3c3647;if(_0x3d49f9[_0x42b2('0x2e')][_0x42b2('0x40')]){_0x25198d[_0x42b2('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x42b2('0x42')](_0x25198d);})[_0x42b2('0x23')](function(_0x21a037){_0x4f5692[_0x42b2('0x43')]=_0x21a037;return _0x4f5692;})[_0x42b2('0x23')](respondWithFilteredResult(_0x20cea9,_0x25198d))['catch'](handleError(_0x20cea9,null));};exports[_0x42b2('0x44')]=function(_0x507b04,_0x3a8f3e){var _0x2a7fd1={'raw':!![],'where':{'id':_0x507b04[_0x42b2('0x45')]['id']}},_0x4822fc={};_0x4822fc['model']=_['keys'](db[_0x42b2('0x3f')][_0x42b2('0x29')]);_0x4822fc['query']=_[_0x42b2('0x46')](_0x507b04[_0x42b2('0x2e')]);_0x4822fc['filters']=_['intersection'](_0x4822fc['model'],_0x4822fc['query']);_0x2a7fd1['attributes']=_[_0x42b2('0x30')](_0x4822fc[_0x42b2('0x2c')],qs['fields'](_0x507b04[_0x42b2('0x2e')][_0x42b2('0x32')]));_0x2a7fd1[_0x42b2('0x31')]=_0x2a7fd1['attributes']['length']?_0x2a7fd1[_0x42b2('0x31')]:_0x4822fc[_0x42b2('0x2c')];if(_0x507b04['query'][_0x42b2('0x40')]){_0x2a7fd1[_0x42b2('0x41')]=[{'all':!![]}];}_0x2a7fd1=_['merge']({},_0x2a7fd1,_0x507b04[_0x42b2('0x3e')]);return db[_0x42b2('0x3f')][_0x42b2('0x47')](_0x2a7fd1)['then'](handleEntityNotFound(_0x3a8f3e,null))[_0x42b2('0x23')](respondWithResult(_0x3a8f3e,null))[_0x42b2('0x48')](handleError(_0x3a8f3e,null));};exports[_0x42b2('0x49')]=function(_0x3fe93a,_0x597204){return db[_0x42b2('0x3f')][_0x42b2('0x49')](_0x3fe93a[_0x42b2('0x4a')],{})[_0x42b2('0x23')](respondWithResult(_0x597204,0xc9))[_0x42b2('0x48')](handleError(_0x597204,null));};exports[_0x42b2('0x22')]=function(_0x480ed6,_0x3ce642){if(_0x480ed6[_0x42b2('0x4a')]['id']){delete _0x480ed6['body']['id'];}return db[_0x42b2('0x3f')][_0x42b2('0x47')]({'where':{'id':_0x480ed6[_0x42b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ce642,null))[_0x42b2('0x23')](saveUpdates(_0x480ed6['body'],null))[_0x42b2('0x23')](respondWithResult(_0x3ce642,null))[_0x42b2('0x48')](handleError(_0x3ce642,null));};exports['destroy']=function(_0x3d7fa9,_0x111358){return db['MailQueueReport'][_0x42b2('0x47')]({'where':{'id':_0x3d7fa9['params']['id']}})['then'](handleEntityNotFound(_0x111358,null))[_0x42b2('0x23')](removeEntity(_0x111358,null))['catch'](handleError(_0x111358,null));};exports[_0x42b2('0x4b')]=function(_0x20bd72,_0x3c1b4a){return db[_0x42b2('0x3f')][_0x42b2('0x4b')]()[_0x42b2('0x23')](respondWithResult(_0x3c1b4a,null))[_0x42b2('0x48')](handleError(_0x3c1b4a,null));}; \ No newline at end of file +var _0xbcb4=['sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcb4,0x1ac));var _0x4bcb=function(_0x2482df,_0x4d1526){_0x2482df=_0x2482df-0x0;var _0x1768ab=_0xbcb4[_0x2482df];return _0x1768ab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4bcb('0x0'));var jsonpatch=require(_0x4bcb('0x1'));var rp=require(_0x4bcb('0x2'));var moment=require('moment');var BPromise=require(_0x4bcb('0x3'));var Mustache=require(_0x4bcb('0x4'));var util=require(_0x4bcb('0x5'));var path=require('path');var sox=require(_0x4bcb('0x6'));var csv=require(_0x4bcb('0x7'));var ejs=require(_0x4bcb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bcb('0x9'));var squel=require(_0x4bcb('0xa'));var crypto=require(_0x4bcb('0xb'));var jsforce=require(_0x4bcb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4bcb('0x7'));var querystring=require(_0x4bcb('0xd'));var Papa=require(_0x4bcb('0xe'));var Redis=require(_0x4bcb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4bcb('0x10'));var as=require(_0x4bcb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4bcb('0x12'));var utils=require(_0x4bcb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4bcb('0x14'));var db=require(_0x4bcb('0x15'))['db'];function respondWithStatusCode(_0x3609b6,_0x596ff3){_0x596ff3=_0x596ff3||0xcc;return function(_0x20826a){if(_0x20826a){return _0x3609b6[_0x4bcb('0x16')](_0x596ff3);}return _0x3609b6['status'](_0x596ff3)[_0x4bcb('0x17')]();};}function respondWithResult(_0x20e270,_0x25eab9){_0x25eab9=_0x25eab9||0xc8;return function(_0x437788){if(_0x437788){return _0x20e270[_0x4bcb('0x18')](_0x25eab9)[_0x4bcb('0x19')](_0x437788);}};}function respondWithFilteredResult(_0x248249,_0x22bede){return function(_0x3a2d32){if(_0x3a2d32){var _0x32f0b5=typeof _0x22bede[_0x4bcb('0x1a')]==='undefined'&&typeof _0x22bede[_0x4bcb('0x1b')]===_0x4bcb('0x1c');var _0x4f0bbc=_0x3a2d32[_0x4bcb('0x1d')];var _0x174ccf=_0x32f0b5?0x0:_0x22bede[_0x4bcb('0x1a')];var _0x31058d=_0x32f0b5?_0x3a2d32['count']:_0x22bede['offset']+_0x22bede[_0x4bcb('0x1b')];var _0x49b05b;if(_0x31058d>=_0x4f0bbc){_0x31058d=_0x4f0bbc;_0x49b05b=0xc8;}else{_0x49b05b=0xce;}_0x248249['status'](_0x49b05b);return _0x248249[_0x4bcb('0x1e')](_0x4bcb('0x1f'),_0x174ccf+'-'+_0x31058d+'/'+_0x4f0bbc)[_0x4bcb('0x19')](_0x3a2d32);}return null;};}function patchUpdates(_0x2ae183){return function(_0x342f24){try{jsonpatch[_0x4bcb('0x20')](_0x342f24,_0x2ae183,!![]);}catch(_0x56659c){return BPromise['reject'](_0x56659c);}return _0x342f24[_0x4bcb('0x21')]();};}function saveUpdates(_0x55fef1,_0x23ecd9){return function(_0x9cfce7){if(_0x9cfce7){return _0x9cfce7[_0x4bcb('0x22')](_0x55fef1)['then'](function(_0x3dfd76){return _0x3dfd76;});}return null;};}function removeEntity(_0x1b9ece,_0x4e10ab){return function(_0x853592){if(_0x853592){return _0x853592[_0x4bcb('0x23')]()[_0x4bcb('0x24')](function(){_0x1b9ece[_0x4bcb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e7c5c,_0x1b469d){return function(_0x40e709){if(!_0x40e709){_0x1e7c5c[_0x4bcb('0x16')](0x194);}return _0x40e709;};}function handleError(_0x1e3792,_0x36cf29){_0x36cf29=_0x36cf29||0x1f4;return function(_0x19cc6b){logger[_0x4bcb('0x25')](_0x19cc6b[_0x4bcb('0x26')]);if(_0x19cc6b['name']){delete _0x19cc6b[_0x4bcb('0x27')];}_0x1e3792[_0x4bcb('0x18')](_0x36cf29)[_0x4bcb('0x28')](_0x19cc6b);};}exports[_0x4bcb('0x29')]=function(_0xd32518,_0x1de378){var _0x19c860={},_0x5a6e14={},_0x2e9e57={'count':0x0,'rows':[]};var _0x585188=_[_0x4bcb('0x2a')](db[_0x4bcb('0x2b')][_0x4bcb('0x2c')],function(_0x5ad7e5){return{'name':_0x5ad7e5[_0x4bcb('0x2d')],'type':_0x5ad7e5[_0x4bcb('0x2e')][_0x4bcb('0x2f')]};});_0x5a6e14['model']=_[_0x4bcb('0x2a')](_0x585188,_0x4bcb('0x27'));_0x5a6e14['query']=_[_0x4bcb('0x30')](_0xd32518[_0x4bcb('0x31')]);_0x5a6e14[_0x4bcb('0x32')]=_['intersection'](_0x5a6e14['model'],_0x5a6e14[_0x4bcb('0x31')]);_0x19c860[_0x4bcb('0x33')]=_[_0x4bcb('0x34')](_0x5a6e14[_0x4bcb('0x35')],qs[_0x4bcb('0x36')](_0xd32518[_0x4bcb('0x31')][_0x4bcb('0x36')]));_0x19c860[_0x4bcb('0x33')]=_0x19c860[_0x4bcb('0x33')][_0x4bcb('0x37')]?_0x19c860['attributes']:_0x5a6e14[_0x4bcb('0x35')];if(!_0xd32518[_0x4bcb('0x31')][_0x4bcb('0x38')]('nolimit')){_0x19c860[_0x4bcb('0x1b')]=qs[_0x4bcb('0x1b')](_0xd32518[_0x4bcb('0x31')][_0x4bcb('0x1b')]);_0x19c860[_0x4bcb('0x1a')]=qs[_0x4bcb('0x1a')](_0xd32518[_0x4bcb('0x31')]['offset']);}_0x19c860['order']=qs['sort'](_0xd32518[_0x4bcb('0x31')][_0x4bcb('0x39')]);_0x19c860['where']=qs[_0x4bcb('0x32')](_[_0x4bcb('0x3a')](_0xd32518[_0x4bcb('0x31')],_0x5a6e14[_0x4bcb('0x32')]),_0x585188);if(_0xd32518[_0x4bcb('0x31')]['filter']){_0x19c860[_0x4bcb('0x3b')]=_['merge'](_0x19c860[_0x4bcb('0x3b')],{'$or':_[_0x4bcb('0x2a')](_0x585188,function(_0x410bf3){if(_0x410bf3[_0x4bcb('0x2e')]!==_0x4bcb('0x3c')){var _0x50f354={};_0x50f354[_0x410bf3[_0x4bcb('0x27')]]={'$like':'%'+_0xd32518[_0x4bcb('0x31')][_0x4bcb('0x3d')]+'%'};return _0x50f354;}})});}_0x19c860=_[_0x4bcb('0x3e')]({},_0x19c860,_0xd32518[_0x4bcb('0x3f')]);var _0x1bed8f={'where':_0x19c860[_0x4bcb('0x3b')]};return db['MailQueueReport']['count'](_0x1bed8f)['then'](function(_0x442f43){_0x2e9e57['count']=_0x442f43;if(_0xd32518[_0x4bcb('0x31')][_0x4bcb('0x40')]){_0x19c860[_0x4bcb('0x41')]=[{'all':!![]}];}return db[_0x4bcb('0x2b')][_0x4bcb('0x42')](_0x19c860);})[_0x4bcb('0x24')](function(_0x291693){_0x2e9e57[_0x4bcb('0x43')]=_0x291693;return _0x2e9e57;})[_0x4bcb('0x24')](respondWithFilteredResult(_0x1de378,_0x19c860))['catch'](handleError(_0x1de378,null));};exports[_0x4bcb('0x44')]=function(_0x113a8e,_0x50631a){var _0x461344={'raw':!![],'where':{'id':_0x113a8e[_0x4bcb('0x45')]['id']}},_0x4c5aee={};_0x4c5aee['model']=_['keys'](db[_0x4bcb('0x2b')][_0x4bcb('0x2c')]);_0x4c5aee[_0x4bcb('0x31')]=_[_0x4bcb('0x30')](_0x113a8e[_0x4bcb('0x31')]);_0x4c5aee[_0x4bcb('0x32')]=_['intersection'](_0x4c5aee[_0x4bcb('0x35')],_0x4c5aee[_0x4bcb('0x31')]);_0x461344[_0x4bcb('0x33')]=_['intersection'](_0x4c5aee['model'],qs[_0x4bcb('0x36')](_0x113a8e[_0x4bcb('0x31')][_0x4bcb('0x36')]));_0x461344[_0x4bcb('0x33')]=_0x461344[_0x4bcb('0x33')][_0x4bcb('0x37')]?_0x461344[_0x4bcb('0x33')]:_0x4c5aee[_0x4bcb('0x35')];if(_0x113a8e[_0x4bcb('0x31')][_0x4bcb('0x40')]){_0x461344[_0x4bcb('0x41')]=[{'all':!![]}];}_0x461344=_[_0x4bcb('0x3e')]({},_0x461344,_0x113a8e[_0x4bcb('0x3f')]);return db[_0x4bcb('0x2b')][_0x4bcb('0x46')](_0x461344)[_0x4bcb('0x24')](handleEntityNotFound(_0x50631a,null))['then'](respondWithResult(_0x50631a,null))['catch'](handleError(_0x50631a,null));};exports[_0x4bcb('0x47')]=function(_0x4b021f,_0x464371){return db[_0x4bcb('0x2b')][_0x4bcb('0x47')](_0x4b021f[_0x4bcb('0x48')],{})[_0x4bcb('0x24')](respondWithResult(_0x464371,0xc9))[_0x4bcb('0x49')](handleError(_0x464371,null));};exports[_0x4bcb('0x22')]=function(_0x5f5962,_0x23b8ca){if(_0x5f5962[_0x4bcb('0x48')]['id']){delete _0x5f5962[_0x4bcb('0x48')]['id'];}return db[_0x4bcb('0x2b')][_0x4bcb('0x46')]({'where':{'id':_0x5f5962[_0x4bcb('0x45')]['id']}})[_0x4bcb('0x24')](handleEntityNotFound(_0x23b8ca,null))[_0x4bcb('0x24')](saveUpdates(_0x5f5962[_0x4bcb('0x48')],null))[_0x4bcb('0x24')](respondWithResult(_0x23b8ca,null))[_0x4bcb('0x49')](handleError(_0x23b8ca,null));};exports[_0x4bcb('0x23')]=function(_0x22fe5c,_0x5f737e){return db[_0x4bcb('0x2b')][_0x4bcb('0x46')]({'where':{'id':_0x22fe5c[_0x4bcb('0x45')]['id']}})[_0x4bcb('0x24')](handleEntityNotFound(_0x5f737e,null))[_0x4bcb('0x24')](removeEntity(_0x5f737e,null))[_0x4bcb('0x49')](handleError(_0x5f737e,null));};exports['describe']=function(_0x1ddc6a,_0x3ec1a7){return db['MailQueueReport'][_0x4bcb('0x4a')]()[_0x4bcb('0x24')](respondWithResult(_0x3ec1a7,null))[_0x4bcb('0x49')](handleError(_0x3ec1a7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 23e7e7a..8d49213 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 _0x4703=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x28abca,_0x516224){var _0x1aa32e=function(_0x413290){while(--_0x413290){_0x28abca['push'](_0x28abca['shift']());}};_0x1aa32e(++_0x516224);}(_0x4703,0xda));var _0x3470=function(_0xb85d59,_0x289f2e){_0xb85d59=_0xb85d59-0x0;var _0x8ba75a=_0x4703[_0xb85d59];return _0x8ba75a;};'use strict';var _=require(_0x3470('0x0'));var util=require(_0x3470('0x1'));var logger=require(_0x3470('0x2'))(_0x3470('0x3'));var moment=require(_0x3470('0x4'));var BPromise=require(_0x3470('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3470('0x6'));var config=require(_0x3470('0x7'));var attributes=require(_0x3470('0x8'));module[_0x3470('0x9')]=function(_0x184fac,_0x55a269){return _0x184fac[_0x3470('0xa')](_0x3470('0xb'),attributes,{'tableName':_0x3470('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3470('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2831=['MailQueueReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x4cb343,_0x3decf1){var _0x3c3bee=function(_0x4cbe1c){while(--_0x4cbe1c){_0x4cb343['push'](_0x4cb343['shift']());}};_0x3c3bee(++_0x3decf1);}(_0x2831,0x1ee));var _0x1283=function(_0x2c9197,_0x37f2f2){_0x2c9197=_0x2c9197-0x0;var _0x3eed29=_0x2831[_0x2c9197];return _0x3eed29;};'use strict';var _=require('lodash');var util=require(_0x1283('0x0'));var logger=require(_0x1283('0x1'))(_0x1283('0x2'));var moment=require('moment');var BPromise=require(_0x1283('0x3'));var rp=require(_0x1283('0x4'));var fs=require('fs');var path=require(_0x1283('0x5'));var rimraf=require(_0x1283('0x6'));var config=require(_0x1283('0x7'));var attributes=require(_0x1283('0x8'));module[_0x1283('0x9')]=function(_0x481ea3,_0x79119f){return _0x481ea3['define'](_0x1283('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1283('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 389bcec..9bd95fc 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 _0xb004=['UpdateMailQueueReport','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport','create','body','options'];(function(_0xbd70e0,_0x193932){var _0x2f1f32=function(_0x279e6e){while(--_0x279e6e){_0xbd70e0['push'](_0xbd70e0['shift']());}};_0x2f1f32(++_0x193932);}(_0xb004,0x16c));var _0x4b00=function(_0x459ff4,_0xda1a1f){_0x459ff4=_0x459ff4-0x0;var _0x13a7f9=_0xb004[_0x459ff4];return _0x13a7f9;};'use strict';var _=require(_0x4b00('0x0'));var util=require(_0x4b00('0x1'));var moment=require(_0x4b00('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b00('0x3'));var fs=require('fs');var Redis=require(_0x4b00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b00('0x5'));var logger=require('../../config/logger')(_0x4b00('0x6'));var config=require('../../config/environment');var jayson=require(_0x4b00('0x7'));var client=jayson[_0x4b00('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b33b,_0x542ad0,_0x4dbde7){return new BPromise(function(_0x3c5744,_0x5923c1){return client[_0x4b00('0x9')](_0x10b33b,_0x4dbde7)[_0x4b00('0xa')](function(_0x2938b6){logger['info'](_0x4b00('0xb'),_0x542ad0,_0x4b00('0xc'));logger[_0x4b00('0xd')](_0x4b00('0xe'),_0x542ad0,_0x4b00('0xc'),JSON[_0x4b00('0xf')](_0x2938b6));if(_0x2938b6['error']){if(_0x2938b6[_0x4b00('0x10')][_0x4b00('0x11')]===0x1f4){logger[_0x4b00('0x10')](_0x4b00('0xb'),_0x542ad0,_0x2938b6[_0x4b00('0x10')]['message']);return _0x5923c1(_0x2938b6[_0x4b00('0x10')][_0x4b00('0x12')]);}logger[_0x4b00('0x10')](_0x4b00('0xb'),_0x542ad0,_0x2938b6[_0x4b00('0x10')][_0x4b00('0x12')]);return _0x3c5744(_0x2938b6['error'][_0x4b00('0x12')]);}else{logger[_0x4b00('0x13')](_0x4b00('0xb'),_0x542ad0,_0x4b00('0xc'));_0x3c5744(_0x2938b6['result'][_0x4b00('0x12')]);}})[_0x4b00('0x14')](function(_0x3e3e4b){logger['error'](_0x4b00('0xb'),_0x542ad0,_0x3e3e4b);_0x5923c1(_0x3e3e4b);});});}exports[_0x4b00('0x15')]=function(_0x2dc38e){var _0x5d2979=this;return new Promise(function(_0x10311f,_0x41c741){return db[_0x4b00('0x16')][_0x4b00('0x17')](_0x2dc38e[_0x4b00('0x18')],{'raw':_0x2dc38e[_0x4b00('0x19')]?_0x2dc38e[_0x4b00('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4b00('0xa')](function(_0x2513d0){logger[_0x4b00('0x13')]('CreateMailQueueReport',_0x2dc38e);logger['debug'](_0x4b00('0x15'),_0x2dc38e,JSON['stringify'](_0x2513d0));_0x10311f(_0x2513d0);})[_0x4b00('0x14')](function(_0x15d1d7){logger[_0x4b00('0x10')](_0x4b00('0x15'),_0x15d1d7[_0x4b00('0x12')],_0x2dc38e);_0x41c741(_0x5d2979['error'](0x1f4,_0x15d1d7[_0x4b00('0x12')]));});});};exports[_0x4b00('0x1a')]=function(_0xfd2bb0){var _0xf563d7=this;return new Promise(function(_0x3f3484,_0x4d0830){return db['MailQueueReport']['update'](_0xfd2bb0[_0x4b00('0x18')],{'raw':_0xfd2bb0[_0x4b00('0x19')]?_0xfd2bb0[_0x4b00('0x19')][_0x4b00('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd2bb0[_0x4b00('0x19')]?_0xfd2bb0[_0x4b00('0x19')][_0x4b00('0x1c')]||null:null,'attributes':_0xfd2bb0['options']?_0xfd2bb0['options'][_0x4b00('0x1d')]||null:null,'limit':_0xfd2bb0[_0x4b00('0x19')]?_0xfd2bb0[_0x4b00('0x19')]['limit']||null:null})[_0x4b00('0xa')](function(_0x3e96b1){logger['info']('UpdateMailQueueReport',_0xfd2bb0);logger[_0x4b00('0xd')](_0x4b00('0x1a'),_0xfd2bb0,JSON[_0x4b00('0xf')](_0x3e96b1));_0x3f3484(_0x3e96b1);})[_0x4b00('0x14')](function(_0x50417b){logger[_0x4b00('0x10')](_0x4b00('0x1a'),_0x50417b[_0x4b00('0x12')],_0xfd2bb0);_0x4d0830(_0xf563d7[_0x4b00('0x10')](0x1f4,_0x50417b[_0x4b00('0x12')]));});});}; \ No newline at end of file +var _0x27b9=['http','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','then','stringify','update','raw','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x27e6dd,_0x31f029){var _0x283bfb=function(_0x1b4a05){while(--_0x1b4a05){_0x27e6dd['push'](_0x27e6dd['shift']());}};_0x283bfb(++_0x31f029);}(_0x27b9,0xf0));var _0x927b=function(_0x597217,_0x4cb26b){_0x597217=_0x597217-0x0;var _0x3f676f=_0x27b9[_0x597217];return _0x3f676f;};'use strict';var _=require('lodash');var util=require(_0x927b('0x0'));var moment=require('moment');var BPromise=require(_0x927b('0x1'));var rs=require(_0x927b('0x2'));var fs=require('fs');var Redis=require(_0x927b('0x3'));var db=require(_0x927b('0x4'))['db'];var utils=require(_0x927b('0x5'));var logger=require(_0x927b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x927b('0x7'));var client=jayson['client'][_0x927b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e46a0,_0x1c41ea,_0x17379d){return new BPromise(function(_0x254197,_0xae9ae4){return client['request'](_0x5e46a0,_0x17379d)['then'](function(_0x6475cf){logger[_0x927b('0x9')](_0x927b('0xa'),_0x1c41ea,'request\x20sent');logger[_0x927b('0xb')](_0x927b('0xc'),_0x1c41ea,_0x927b('0xd'),JSON['stringify'](_0x6475cf));if(_0x6475cf[_0x927b('0xe')]){if(_0x6475cf[_0x927b('0xe')][_0x927b('0xf')]===0x1f4){logger[_0x927b('0xe')](_0x927b('0xa'),_0x1c41ea,_0x6475cf[_0x927b('0xe')][_0x927b('0x10')]);return _0xae9ae4(_0x6475cf[_0x927b('0xe')][_0x927b('0x10')]);}logger[_0x927b('0xe')](_0x927b('0xa'),_0x1c41ea,_0x6475cf[_0x927b('0xe')][_0x927b('0x10')]);return _0x254197(_0x6475cf['error']['message']);}else{logger[_0x927b('0x9')](_0x927b('0xa'),_0x1c41ea,_0x927b('0xd'));_0x254197(_0x6475cf[_0x927b('0x11')]['message']);}})[_0x927b('0x12')](function(_0x29e6c6){logger[_0x927b('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x1c41ea,_0x29e6c6);_0xae9ae4(_0x29e6c6);});});}exports[_0x927b('0x13')]=function(_0x4c5586){var _0x304f21=this;return new Promise(function(_0x728485,_0x5455c1){return db[_0x927b('0x14')][_0x927b('0x15')](_0x4c5586[_0x927b('0x16')],{'raw':_0x4c5586[_0x927b('0x17')]?_0x4c5586[_0x927b('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x927b('0x18')](function(_0xca6350){logger['info'](_0x927b('0x13'),_0x4c5586);logger[_0x927b('0xb')](_0x927b('0x13'),_0x4c5586,JSON[_0x927b('0x19')](_0xca6350));_0x728485(_0xca6350);})['catch'](function(_0x500548){logger[_0x927b('0xe')](_0x927b('0x13'),_0x500548[_0x927b('0x10')],_0x4c5586);_0x5455c1(_0x304f21[_0x927b('0xe')](0x1f4,_0x500548['message']));});});};exports['UpdateMailQueueReport']=function(_0x2c77f1){var _0x4844df=this;return new Promise(function(_0x1b6999,_0x1630b6){return db[_0x927b('0x14')][_0x927b('0x1a')](_0x2c77f1[_0x927b('0x16')],{'raw':_0x2c77f1[_0x927b('0x17')]?_0x2c77f1[_0x927b('0x17')][_0x927b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c77f1[_0x927b('0x17')]?_0x2c77f1[_0x927b('0x17')]['where']||null:null,'attributes':_0x2c77f1['options']?_0x2c77f1[_0x927b('0x17')][_0x927b('0x1c')]||null:null,'limit':_0x2c77f1[_0x927b('0x17')]?_0x2c77f1['options'][_0x927b('0x1d')]||null:null})['then'](function(_0x869069){logger[_0x927b('0x9')](_0x927b('0x1e'),_0x2c77f1);logger['debug'](_0x927b('0x1e'),_0x2c77f1,JSON[_0x927b('0x19')](_0x869069));_0x1b6999(_0x869069);})[_0x927b('0x12')](function(_0xd6c4b3){logger[_0x927b('0xe')](_0x927b('0x1e'),_0xd6c4b3[_0x927b('0x10')],_0x2c77f1);_0x1630b6(_0x4844df[_0x927b('0xe')](0x1f4,_0xd6c4b3[_0x927b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 3271f46..6ccc52c 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 _0xa68c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa68c,0x187));var _0xca68=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa68c[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xca68('0x0'));var util=require(_0xca68('0x1'));var path=require(_0xca68('0x2'));var timeout=require(_0xca68('0x3'));var express=require(_0xca68('0x4'));var router=express[_0xca68('0x5')]();var fs_extra=require(_0xca68('0x6'));var auth=require(_0xca68('0x7'));var interaction=require(_0xca68('0x8'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xe6e4=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x545c6d,_0x13142d){var _0x3d91f6=function(_0x5d2591){while(--_0x5d2591){_0x545c6d['push'](_0x545c6d['shift']());}};_0x3d91f6(++_0x13142d);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x552c03,_0x247fab){_0x552c03=_0x552c03-0x0;var _0x25e104=_0xe6e4[_0x552c03];return _0x25e104;};'use strict';var multer=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var path=require(_0x4e6e('0x2'));var timeout=require(_0x4e6e('0x3'));var express=require(_0x4e6e('0x4'));var router=express[_0x4e6e('0x5')]();var fs_extra=require(_0x4e6e('0x6'));var auth=require(_0x4e6e('0x7'));var interaction=require(_0x4e6e('0x8'));var config=require('../../config/environment');module[_0x4e6e('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 5b36de0..0f46480 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 _0x998c=['INTEGER','STRING','sequelize','exports','BOOLEAN'];(function(_0x16e333,_0x50758e){var _0x48895c=function(_0x55b707){while(--_0x55b707){_0x16e333['push'](_0x16e333['shift']());}};_0x48895c(++_0x50758e);}(_0x998c,0x115));var _0xc998=function(_0x1c1da1,_0x4755d8){_0x1c1da1=_0x1c1da1-0x0;var _0x3c1816=_0x998c[_0x1c1da1];return _0x3c1816;};'use strict';var Sequelize=require(_0xc998('0x0'));module[_0xc998('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xc998('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc998('0x3')]},'tls':{'type':Sequelize[_0xc998('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc998('0x4')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc998('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc998('0x4')]}}; \ No newline at end of file +var _0xf9f1=['sequelize','STRING','BOOLEAN','INBOX'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0xf9f1,0x1d8));var _0x1f9f=function(_0x17ba89,_0x467c6d){_0x17ba89=_0x17ba89-0x0;var _0x1b49f4=_0xf9f1[_0x17ba89];return _0x1b49f4;};'use strict';var Sequelize=require(_0x1f9f('0x0'));module['exports']={'description':{'type':Sequelize[_0x1f9f('0x1')]},'host':{'type':Sequelize[_0x1f9f('0x1')]},'authentication':{'type':Sequelize[_0x1f9f('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1f9f('0x1')]},'password':{'type':Sequelize[_0x1f9f('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x1f9f('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x1f9f('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x1f9f('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index bad8848..1e38699 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 _0xee4f=['bluebird','path','../../config/environment','MailServerIn','mail_servers_in','lodash','api','moment'];(function(_0x42e988,_0xd8abe0){var _0x5ce1fb=function(_0x2531bc){while(--_0x2531bc){_0x42e988['push'](_0x42e988['shift']());}};_0x5ce1fb(++_0xd8abe0);}(_0xee4f,0xad));var _0xfee4=function(_0xdfeba4,_0xdbd7da){_0xdfeba4=_0xdfeba4-0x0;var _0x41fa04=_0xee4f[_0xdfeba4];return _0x41fa04;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfee4('0x1'));var moment=require(_0xfee4('0x2'));var BPromise=require(_0xfee4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfee4('0x4'));var rimraf=require('rimraf');var config=require(_0xfee4('0x5'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x1c39b1,_0x498647){return _0x1c39b1['define'](_0xfee4('0x6'),attributes,{'tableName':_0xfee4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0647=['api','moment','bluebird','request-promise','../../config/environment','./mailServerIn.attributes','exports','define','lodash','../../config/logger'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0x0647,0xd0));var _0x7064=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x0647[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x7064('0x0'));var util=require('util');var logger=require(_0x7064('0x1'))(_0x7064('0x2'));var moment=require(_0x7064('0x3'));var BPromise=require(_0x7064('0x4'));var rp=require(_0x7064('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7064('0x6'));var attributes=require(_0x7064('0x7'));module[_0x7064('0x8')]=function(_0x44b1bb,_0x2b6f9b){return _0x44b1bb[_0x7064('0x9')]('MailServerIn',attributes,{'tableName':'mail_servers_in','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 15a1246..6aecb4c 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 _0x446d=['http','request','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x56c462,_0x5f2aa8){var _0x1e9f37=function(_0x41692a){while(--_0x41692a){_0x56c462['push'](_0x56c462['shift']());}};_0x1e9f37(++_0x5f2aa8);}(_0x446d,0x1bc));var _0xd446=function(_0x1ccb6b,_0x4e91e6){_0x1ccb6b=_0x1ccb6b-0x0;var _0x4c316=_0x446d[_0x1ccb6b];return _0x4c316;};'use strict';var _=require(_0xd446('0x0'));var util=require(_0xd446('0x1'));var moment=require('moment');var BPromise=require(_0xd446('0x2'));var rs=require(_0xd446('0x3'));var fs=require('fs');var Redis=require(_0xd446('0x4'));var db=require(_0xd446('0x5'))['db'];var utils=require(_0xd446('0x6'));var logger=require('../../config/logger')(_0xd446('0x7'));var config=require(_0xd446('0x8'));var jayson=require(_0xd446('0x9'));var client=jayson[_0xd446('0xa')][_0xd446('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417ef3,_0x30ed72,_0x81346a){return new BPromise(function(_0x291479,_0x1b45b0){return client[_0xd446('0xc')](_0x417ef3,_0x81346a)[_0xd446('0xd')](function(_0x3cc286){logger['info'](_0xd446('0xe'),_0x30ed72,'request\x20sent');logger[_0xd446('0xf')](_0xd446('0x10'),_0x30ed72,_0xd446('0x11'),JSON[_0xd446('0x12')](_0x3cc286));if(_0x3cc286[_0xd446('0x13')]){if(_0x3cc286[_0xd446('0x13')]['code']===0x1f4){logger[_0xd446('0x13')](_0xd446('0xe'),_0x30ed72,_0x3cc286[_0xd446('0x13')][_0xd446('0x14')]);return _0x1b45b0(_0x3cc286[_0xd446('0x13')][_0xd446('0x14')]);}logger[_0xd446('0x13')]('MailServerIn,\x20%s,\x20%s',_0x30ed72,_0x3cc286[_0xd446('0x13')][_0xd446('0x14')]);return _0x291479(_0x3cc286[_0xd446('0x13')][_0xd446('0x14')]);}else{logger[_0xd446('0x15')](_0xd446('0xe'),_0x30ed72,'request\x20sent');_0x291479(_0x3cc286[_0xd446('0x16')][_0xd446('0x14')]);}})['catch'](function(_0x80156c){logger[_0xd446('0x13')]('MailServerIn,\x20%s,\x20%s',_0x30ed72,_0x80156c);_0x1b45b0(_0x80156c);});});}exports[_0xd446('0x17')]=function(_0x5e3270){var _0x4ec45d=this;return new Promise(function(_0x26f263,_0x3555d8){return db[_0xd446('0x18')][_0xd446('0x19')]({'raw':_0x5e3270[_0xd446('0x1a')]?_0x5e3270[_0xd446('0x1a')][_0xd446('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e3270[_0xd446('0x1a')]?_0x5e3270['options'][_0xd446('0x1c')]||null:null,'attributes':_0x5e3270[_0xd446('0x1a')]?_0x5e3270[_0xd446('0x1a')][_0xd446('0x1d')]||null:null,'limit':_0x5e3270[_0xd446('0x1a')]?_0x5e3270['options'][_0xd446('0x1e')]||null:null,'include':_0x5e3270[_0xd446('0x1a')]?_0x5e3270[_0xd446('0x1a')]['include']?_['map'](_0x5e3270[_0xd446('0x1a')][_0xd446('0x1f')],function(_0x2675ed){return{'model':db[_0x2675ed[_0xd446('0x20')]],'as':_0x2675ed['as'],'attributes':_0x2675ed['attributes'],'include':_0x2675ed[_0xd446('0x1f')]?_[_0xd446('0x21')](_0x2675ed[_0xd446('0x1f')],function(_0xeb04e){return{'model':db[_0xeb04e[_0xd446('0x20')]],'as':_0xeb04e['as'],'attributes':_0xeb04e['attributes'],'include':_0xeb04e[_0xd446('0x1f')]?_[_0xd446('0x21')](_0xeb04e[_0xd446('0x1f')],function(_0x4fd93e){return{'model':db[_0x4fd93e[_0xd446('0x20')]],'as':_0x4fd93e['as'],'attributes':_0x4fd93e[_0xd446('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x264464){logger['info']('GetMailServerIn',_0x5e3270);logger[_0xd446('0xf')](_0xd446('0x17'),_0x5e3270,JSON[_0xd446('0x12')](_0x264464));_0x26f263(_0x264464);})[_0xd446('0x22')](function(_0x139507){logger['error'](_0xd446('0x17'),_0x139507[_0xd446('0x14')],_0x5e3270);_0x3555d8(_0x4ec45d[_0xd446('0x13')](0x1f4,_0x139507[_0xd446('0x14')]));});});}; \ No newline at end of file +var _0xdb58=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','options','raw','attributes','limit','include','map','model','GetMailServerIn','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s'];(function(_0x33e834,_0x3c9c93){var _0x51f83b=function(_0x5e4155){while(--_0x5e4155){_0x33e834['push'](_0x33e834['shift']());}};_0x51f83b(++_0x3c9c93);}(_0xdb58,0x167));var _0x8db5=function(_0xd50f07,_0x5e3645){_0xd50f07=_0xd50f07-0x0;var _0x16afa8=_0xdb58[_0xd50f07];return _0x16afa8;};'use strict';var _=require(_0x8db5('0x0'));var util=require(_0x8db5('0x1'));var moment=require('moment');var BPromise=require(_0x8db5('0x2'));var rs=require(_0x8db5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8db5('0x4'))['db'];var utils=require(_0x8db5('0x5'));var logger=require(_0x8db5('0x6'))(_0x8db5('0x7'));var config=require('../../config/environment');var jayson=require(_0x8db5('0x8'));var client=jayson['client'][_0x8db5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c7a57,_0x2ebc67,_0x4e07d7){return new BPromise(function(_0x188799,_0x50f3cc){return client['request'](_0x2c7a57,_0x4e07d7)[_0x8db5('0xa')](function(_0xeb937f){logger[_0x8db5('0xb')](_0x8db5('0xc'),_0x2ebc67,_0x8db5('0xd'));logger[_0x8db5('0xe')](_0x8db5('0xf'),_0x2ebc67,'request\x20sent',JSON[_0x8db5('0x10')](_0xeb937f));if(_0xeb937f[_0x8db5('0x11')]){if(_0xeb937f[_0x8db5('0x11')][_0x8db5('0x12')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2ebc67,_0xeb937f[_0x8db5('0x11')]['message']);return _0x50f3cc(_0xeb937f[_0x8db5('0x11')][_0x8db5('0x13')]);}logger[_0x8db5('0x11')]('MailServerIn,\x20%s,\x20%s',_0x2ebc67,_0xeb937f[_0x8db5('0x11')][_0x8db5('0x13')]);return _0x188799(_0xeb937f[_0x8db5('0x11')]['message']);}else{logger[_0x8db5('0xb')](_0x8db5('0xc'),_0x2ebc67,_0x8db5('0xd'));_0x188799(_0xeb937f[_0x8db5('0x14')][_0x8db5('0x13')]);}})[_0x8db5('0x15')](function(_0x1ce240){logger[_0x8db5('0x11')](_0x8db5('0xc'),_0x2ebc67,_0x1ce240);_0x50f3cc(_0x1ce240);});});}exports['GetMailServerIn']=function(_0x3e9848){var _0x5c9fa8=this;return new Promise(function(_0x1d8b73,_0x2f15e6){return db[_0x8db5('0x16')]['findAll']({'raw':_0x3e9848[_0x8db5('0x17')]?_0x3e9848['options'][_0x8db5('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9848['options']?_0x3e9848[_0x8db5('0x17')]['where']||null:null,'attributes':_0x3e9848[_0x8db5('0x17')]?_0x3e9848[_0x8db5('0x17')][_0x8db5('0x19')]||null:null,'limit':_0x3e9848[_0x8db5('0x17')]?_0x3e9848['options'][_0x8db5('0x1a')]||null:null,'include':_0x3e9848[_0x8db5('0x17')]?_0x3e9848[_0x8db5('0x17')][_0x8db5('0x1b')]?_[_0x8db5('0x1c')](_0x3e9848[_0x8db5('0x17')][_0x8db5('0x1b')],function(_0x13702c){return{'model':db[_0x13702c[_0x8db5('0x1d')]],'as':_0x13702c['as'],'attributes':_0x13702c[_0x8db5('0x19')],'include':_0x13702c[_0x8db5('0x1b')]?_[_0x8db5('0x1c')](_0x13702c[_0x8db5('0x1b')],function(_0x560683){return{'model':db[_0x560683[_0x8db5('0x1d')]],'as':_0x560683['as'],'attributes':_0x560683[_0x8db5('0x19')],'include':_0x560683[_0x8db5('0x1b')]?_['map'](_0x560683[_0x8db5('0x1b')],function(_0x47a5f4){return{'model':db[_0x47a5f4['model']],'as':_0x47a5f4['as'],'attributes':_0x47a5f4[_0x8db5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8db5('0xa')](function(_0x287456){logger[_0x8db5('0xb')](_0x8db5('0x1e'),_0x3e9848);logger['debug'](_0x8db5('0x1e'),_0x3e9848,JSON[_0x8db5('0x10')](_0x287456));_0x1d8b73(_0x287456);})[_0x8db5('0x15')](function(_0x248cae){logger[_0x8db5('0x11')](_0x8db5('0x1e'),_0x248cae[_0x8db5('0x13')],_0x3e9848);_0x2f15e6(_0x5c9fa8[_0x8db5('0x11')](0x1f4,_0x248cae[_0x8db5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 93a563a..c9d09fc 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 _0xb43b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x57bc17,_0x1065d3){_0x57bc17=_0x57bc17-0x0;var _0x327511=_0xb43b[_0x57bc17];return _0x327511;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')]('/',auth[_0xbb43('0xb')](),controller['create']);router[_0xbb43('0xe')](_0xbb43('0xa'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x11')]);module[_0xbb43('0x12')]=router; \ No newline at end of file +var _0xaa88=['./mailServerOut.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x375d94,_0x482a34){var _0x276133=function(_0x48e493){while(--_0x48e493){_0x375d94['push'](_0x375d94['shift']());}};_0x276133(++_0x482a34);}(_0xaa88,0x137));var _0x8aa8=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0xaa88[_0x44606e];return _0xe68388;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller['destroy']);module[_0x8aa8('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index be415c9..9c4cd3a 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 _0xae35=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xae35,0x172));var _0x5ae3=function(_0x3fad82,_0x5a36c8){_0x3fad82=_0x3fad82-0x0;var _0x185d81=_0xae35[_0x3fad82];return _0x185d81;};'use strict';var Sequelize=require(_0x5ae3('0x0'));module[_0x5ae3('0x1')]={'description':{'type':Sequelize[_0x5ae3('0x2')]},'host':{'type':Sequelize[_0x5ae3('0x2')]},'user':{'type':Sequelize[_0x5ae3('0x2')]},'pass':{'type':Sequelize[_0x5ae3('0x2')]},'port':{'type':Sequelize[_0x5ae3('0x3')]},'secure':{'type':Sequelize[_0x5ae3('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x5ae3('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa751=['BOOLEAN','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa751,0x175));var _0x1a75=function(_0x5c809,_0x478741){_0x5c809=_0x5c809-0x0;var _0x466386=_0xa751[_0x5c809];return _0x466386;};'use strict';var Sequelize=require(_0x1a75('0x0'));module[_0x1a75('0x1')]={'description':{'type':Sequelize[_0x1a75('0x2')]},'host':{'type':Sequelize[_0x1a75('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1a75('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x1a75('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x1a75('0x2')]},'authentication':{'type':Sequelize[_0x1a75('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5c22b8c..cc15da6 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 _0xf534=['json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','end'];(function(_0x1c5778,_0x95d00a){var _0x5111e6=function(_0x354e36){while(--_0x354e36){_0x1c5778['push'](_0x1c5778['shift']());}};_0x5111e6(++_0x95d00a);}(_0xf534,0xc7));var _0x4f53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf534[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4f53('0x0'));var rimraf=require(_0x4f53('0x1'));var zipdir=require(_0x4f53('0x2'));var jsonpatch=require(_0x4f53('0x3'));var rp=require(_0x4f53('0x4'));var moment=require(_0x4f53('0x5'));var BPromise=require(_0x4f53('0x6'));var Mustache=require(_0x4f53('0x7'));var util=require(_0x4f53('0x8'));var path=require(_0x4f53('0x9'));var sox=require(_0x4f53('0xa'));var csv=require(_0x4f53('0xb'));var ejs=require(_0x4f53('0xc'));var fs=require('fs');var fs_extra=require(_0x4f53('0xd'));var _=require(_0x4f53('0xe'));var squel=require(_0x4f53('0xf'));var crypto=require(_0x4f53('0x10'));var jsforce=require(_0x4f53('0x11'));var deskjs=require(_0x4f53('0x12'));var toCsv=require(_0x4f53('0xb'));var querystring=require(_0x4f53('0x13'));var Papa=require(_0x4f53('0x14'));var Redis=require(_0x4f53('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x4f53('0x16'));var as=require(_0x4f53('0x17'));var hardwareService=require(_0x4f53('0x18'));var logger=require('../../config/logger')(_0x4f53('0x19'));var utils=require('../../config/utils');var config=require(_0x4f53('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f89c1,_0x4c1046){_0x4c1046=_0x4c1046||0xcc;return function(_0x384ec0){if(_0x384ec0){return _0x2f89c1['sendStatus'](_0x4c1046);}return _0x2f89c1[_0x4f53('0x1b')](_0x4c1046)[_0x4f53('0x1c')]();};}function respondWithResult(_0x42bb54,_0x5bf59f){_0x5bf59f=_0x5bf59f||0xc8;return function(_0x28db1c){if(_0x28db1c){return _0x42bb54[_0x4f53('0x1b')](_0x5bf59f)[_0x4f53('0x1d')](_0x28db1c);}};}function respondWithFilteredResult(_0x1736e4,_0x4ef00f){return function(_0xfdfbd9){if(_0xfdfbd9){var _0x1b3b45=typeof _0x4ef00f[_0x4f53('0x1e')]===_0x4f53('0x1f')&&typeof _0x4ef00f['limit']===_0x4f53('0x1f');var _0x4c5583=_0xfdfbd9[_0x4f53('0x20')];var _0x33af84=_0x1b3b45?0x0:_0x4ef00f['offset'];var _0x3f5e2d=_0x1b3b45?_0xfdfbd9['count']:_0x4ef00f[_0x4f53('0x1e')]+_0x4ef00f[_0x4f53('0x21')];var _0x2d2b13;if(_0x3f5e2d>=_0x4c5583){_0x3f5e2d=_0x4c5583;_0x2d2b13=0xc8;}else{_0x2d2b13=0xce;}_0x1736e4[_0x4f53('0x1b')](_0x2d2b13);return _0x1736e4['set'](_0x4f53('0x22'),_0x33af84+'-'+_0x3f5e2d+'/'+_0x4c5583)[_0x4f53('0x1d')](_0xfdfbd9);}return null;};}function patchUpdates(_0xe21109){return function(_0x337a2b){try{jsonpatch[_0x4f53('0x23')](_0x337a2b,_0xe21109,!![]);}catch(_0x4a3932){return BPromise['reject'](_0x4a3932);}return _0x337a2b[_0x4f53('0x24')]();};}function saveUpdates(_0x49cec6,_0x3e2bda){return function(_0x23d807){if(_0x23d807){return _0x23d807[_0x4f53('0x25')](_0x49cec6)[_0x4f53('0x26')](function(_0x2ffbbe){return _0x2ffbbe;});}return null;};}function removeEntity(_0x44d88b,_0x1d8fb8){return function(_0x47515d){if(_0x47515d){return _0x47515d[_0x4f53('0x27')]()[_0x4f53('0x26')](function(){_0x44d88b[_0x4f53('0x1b')](0xcc)[_0x4f53('0x1c')]();});}};}function handleEntityNotFound(_0x5cd276,_0x3762b3){return function(_0x20774e){if(!_0x20774e){_0x5cd276[_0x4f53('0x28')](0x194);}return _0x20774e;};}function handleError(_0x4d42e2,_0xa5d870){_0xa5d870=_0xa5d870||0x1f4;return function(_0x3c2862){logger['error'](_0x3c2862[_0x4f53('0x29')]);if(_0x3c2862[_0x4f53('0x2a')]){delete _0x3c2862['name'];}_0x4d42e2[_0x4f53('0x1b')](_0xa5d870)[_0x4f53('0x2b')](_0x3c2862);};}exports[_0x4f53('0x2c')]=function(_0x27626a,_0x2f772c){var _0x2c56fe={},_0x5deb91={},_0x2bea80={'count':0x0,'rows':[]};var _0x44e53e=_[_0x4f53('0x2d')](db[_0x4f53('0x2e')][_0x4f53('0x2f')],function(_0x3d1470){return{'name':_0x3d1470[_0x4f53('0x30')],'type':_0x3d1470[_0x4f53('0x31')][_0x4f53('0x32')]};});_0x5deb91[_0x4f53('0x33')]=_[_0x4f53('0x2d')](_0x44e53e,_0x4f53('0x2a'));_0x5deb91[_0x4f53('0x34')]=_[_0x4f53('0x35')](_0x27626a[_0x4f53('0x34')]);_0x5deb91[_0x4f53('0x36')]=_[_0x4f53('0x37')](_0x5deb91[_0x4f53('0x33')],_0x5deb91[_0x4f53('0x34')]);_0x2c56fe[_0x4f53('0x38')]=_[_0x4f53('0x37')](_0x5deb91['model'],qs[_0x4f53('0x39')](_0x27626a[_0x4f53('0x34')][_0x4f53('0x39')]));_0x2c56fe[_0x4f53('0x38')]=_0x2c56fe[_0x4f53('0x38')]['length']?_0x2c56fe[_0x4f53('0x38')]:_0x5deb91[_0x4f53('0x33')];if(!_0x27626a[_0x4f53('0x34')][_0x4f53('0x3a')](_0x4f53('0x3b'))){_0x2c56fe[_0x4f53('0x21')]=qs[_0x4f53('0x21')](_0x27626a[_0x4f53('0x34')][_0x4f53('0x21')]);_0x2c56fe[_0x4f53('0x1e')]=qs[_0x4f53('0x1e')](_0x27626a['query'][_0x4f53('0x1e')]);}_0x2c56fe[_0x4f53('0x3c')]=qs[_0x4f53('0x3d')](_0x27626a[_0x4f53('0x34')][_0x4f53('0x3d')]);_0x2c56fe[_0x4f53('0x3e')]=qs[_0x4f53('0x36')](_['pick'](_0x27626a[_0x4f53('0x34')],_0x5deb91[_0x4f53('0x36')]),_0x44e53e);if(_0x27626a[_0x4f53('0x34')][_0x4f53('0x3f')]){_0x2c56fe[_0x4f53('0x3e')]=_[_0x4f53('0x40')](_0x2c56fe[_0x4f53('0x3e')],{'$or':_['map'](_0x44e53e,function(_0x4bc3dd){if(_0x4bc3dd[_0x4f53('0x31')]!=='VIRTUAL'){var _0x12dc65={};_0x12dc65[_0x4bc3dd['name']]={'$like':'%'+_0x27626a[_0x4f53('0x34')][_0x4f53('0x3f')]+'%'};return _0x12dc65;}})});}_0x2c56fe=_[_0x4f53('0x40')]({},_0x2c56fe,_0x27626a[_0x4f53('0x41')]);var _0x4b7660={'where':_0x2c56fe[_0x4f53('0x3e')]};return db[_0x4f53('0x2e')]['count'](_0x4b7660)[_0x4f53('0x26')](function(_0x169230){_0x2bea80['count']=_0x169230;if(_0x27626a[_0x4f53('0x34')]['includeAll']){_0x2c56fe[_0x4f53('0x42')]=[{'all':!![]}];}return db[_0x4f53('0x2e')][_0x4f53('0x43')](_0x2c56fe);})['then'](function(_0x50fb99){_0x2bea80[_0x4f53('0x44')]=_0x50fb99;return _0x2bea80;})[_0x4f53('0x26')](respondWithFilteredResult(_0x2f772c,_0x2c56fe))[_0x4f53('0x45')](handleError(_0x2f772c,null));};exports[_0x4f53('0x46')]=function(_0x590c1c,_0x1418f4){var _0x37da38={'raw':!![],'where':{'id':_0x590c1c[_0x4f53('0x47')]['id']}},_0x2cbc8f={};_0x2cbc8f[_0x4f53('0x33')]=_[_0x4f53('0x35')](db[_0x4f53('0x2e')]['rawAttributes']);_0x2cbc8f[_0x4f53('0x34')]=_[_0x4f53('0x35')](_0x590c1c['query']);_0x2cbc8f[_0x4f53('0x36')]=_[_0x4f53('0x37')](_0x2cbc8f[_0x4f53('0x33')],_0x2cbc8f[_0x4f53('0x34')]);_0x37da38[_0x4f53('0x38')]=_['intersection'](_0x2cbc8f[_0x4f53('0x33')],qs[_0x4f53('0x39')](_0x590c1c[_0x4f53('0x34')]['fields']));_0x37da38['attributes']=_0x37da38[_0x4f53('0x38')]['length']?_0x37da38[_0x4f53('0x38')]:_0x2cbc8f[_0x4f53('0x33')];if(_0x590c1c[_0x4f53('0x34')][_0x4f53('0x48')]){_0x37da38[_0x4f53('0x42')]=[{'all':!![]}];}_0x37da38=_[_0x4f53('0x40')]({},_0x37da38,_0x590c1c[_0x4f53('0x41')]);return db['MailServerOut'][_0x4f53('0x49')](_0x37da38)[_0x4f53('0x26')](handleEntityNotFound(_0x1418f4,null))[_0x4f53('0x26')](respondWithResult(_0x1418f4,null))[_0x4f53('0x45')](handleError(_0x1418f4,null));};exports['create']=function(_0x33089f,_0xba9d65){return db[_0x4f53('0x2e')][_0x4f53('0x4a')](_0x33089f[_0x4f53('0x4b')],{})[_0x4f53('0x26')](respondWithResult(_0xba9d65,0xc9))[_0x4f53('0x45')](handleError(_0xba9d65,null));};exports[_0x4f53('0x25')]=function(_0x28905d,_0x58d3f6){if(_0x28905d[_0x4f53('0x4b')]['id']){delete _0x28905d[_0x4f53('0x4b')]['id'];}return db[_0x4f53('0x2e')][_0x4f53('0x49')]({'where':{'id':_0x28905d[_0x4f53('0x47')]['id']}})[_0x4f53('0x26')](handleEntityNotFound(_0x58d3f6,null))[_0x4f53('0x26')](saveUpdates(_0x28905d[_0x4f53('0x4b')],null))[_0x4f53('0x26')](respondWithResult(_0x58d3f6,null))['catch'](handleError(_0x58d3f6,null));};exports[_0x4f53('0x27')]=function(_0x5b970a,_0x361a72){return db[_0x4f53('0x2e')]['find']({'where':{'id':_0x5b970a[_0x4f53('0x47')]['id']}})[_0x4f53('0x26')](handleEntityNotFound(_0x361a72,null))[_0x4f53('0x26')](removeEntity(_0x361a72,null))[_0x4f53('0x45')](handleError(_0x361a72,null));}; \ No newline at end of file +var _0x9026=['count','set','Content-Range','reject','save','end','error','name','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9026,0x19d));var _0x6902=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x9026[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0x6902('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6902('0x1'));var jsonpatch=require(_0x6902('0x2'));var rp=require(_0x6902('0x3'));var moment=require(_0x6902('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6902('0x5'));var util=require(_0x6902('0x6'));var path=require('path');var sox=require(_0x6902('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6902('0x8'));var _=require(_0x6902('0x9'));var squel=require('squel');var crypto=require(_0x6902('0xa'));var jsforce=require(_0x6902('0xb'));var deskjs=require(_0x6902('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6902('0xd'));var Papa=require(_0x6902('0xe'));var Redis=require(_0x6902('0xf'));var authService=require(_0x6902('0x10'));var qs=require(_0x6902('0x11'));var as=require(_0x6902('0x12'));var hardwareService=require(_0x6902('0x13'));var logger=require(_0x6902('0x14'))(_0x6902('0x15'));var utils=require('../../config/utils');var config=require(_0x6902('0x16'));var licenseUtil=require(_0x6902('0x17'));var db=require(_0x6902('0x18'))['db'];function respondWithStatusCode(_0x32391d,_0x24d2d8){_0x24d2d8=_0x24d2d8||0xcc;return function(_0x1562ad){if(_0x1562ad){return _0x32391d[_0x6902('0x19')](_0x24d2d8);}return _0x32391d[_0x6902('0x1a')](_0x24d2d8)['end']();};}function respondWithResult(_0x5bf4b4,_0x1ef7f0){_0x1ef7f0=_0x1ef7f0||0xc8;return function(_0x1d2a1c){if(_0x1d2a1c){return _0x5bf4b4['status'](_0x1ef7f0)[_0x6902('0x1b')](_0x1d2a1c);}};}function respondWithFilteredResult(_0x4af3e5,_0x29544d){return function(_0x456842){if(_0x456842){var _0x45bef2=typeof _0x29544d[_0x6902('0x1c')]===_0x6902('0x1d')&&typeof _0x29544d[_0x6902('0x1e')]===_0x6902('0x1d');var _0x1fb311=_0x456842['count'];var _0x32bf58=_0x45bef2?0x0:_0x29544d[_0x6902('0x1c')];var _0x37ac6e=_0x45bef2?_0x456842[_0x6902('0x1f')]:_0x29544d['offset']+_0x29544d['limit'];var _0x2e7973;if(_0x37ac6e>=_0x1fb311){_0x37ac6e=_0x1fb311;_0x2e7973=0xc8;}else{_0x2e7973=0xce;}_0x4af3e5[_0x6902('0x1a')](_0x2e7973);return _0x4af3e5[_0x6902('0x20')](_0x6902('0x21'),_0x32bf58+'-'+_0x37ac6e+'/'+_0x1fb311)[_0x6902('0x1b')](_0x456842);}return null;};}function patchUpdates(_0x1d117b){return function(_0x5a8e02){try{jsonpatch['apply'](_0x5a8e02,_0x1d117b,!![]);}catch(_0x3a8d74){return BPromise[_0x6902('0x22')](_0x3a8d74);}return _0x5a8e02[_0x6902('0x23')]();};}function saveUpdates(_0x2f096b,_0x368250){return function(_0x3f3371){if(_0x3f3371){return _0x3f3371['update'](_0x2f096b)['then'](function(_0x3721ad){return _0x3721ad;});}return null;};}function removeEntity(_0x453b84,_0xb6833a){return function(_0x4a2586){if(_0x4a2586){return _0x4a2586['destroy']()['then'](function(){_0x453b84[_0x6902('0x1a')](0xcc)[_0x6902('0x24')]();});}};}function handleEntityNotFound(_0x4397d4,_0x5d5292){return function(_0x2086ad){if(!_0x2086ad){_0x4397d4['sendStatus'](0x194);}return _0x2086ad;};}function handleError(_0x138cd4,_0x5b76fc){_0x5b76fc=_0x5b76fc||0x1f4;return function(_0x5b1d6c){logger[_0x6902('0x25')](_0x5b1d6c['stack']);if(_0x5b1d6c[_0x6902('0x26')]){delete _0x5b1d6c[_0x6902('0x26')];}_0x138cd4['status'](_0x5b76fc)['send'](_0x5b1d6c);};}exports[_0x6902('0x27')]=function(_0x4a8d84,_0x2b1ba1){var _0x512f6c={},_0x1508cc={},_0xbc7ae7={'count':0x0,'rows':[]};var _0xdc5e58=_[_0x6902('0x28')](db[_0x6902('0x29')][_0x6902('0x2a')],function(_0x269f25){return{'name':_0x269f25[_0x6902('0x2b')],'type':_0x269f25['type'][_0x6902('0x2c')]};});_0x1508cc[_0x6902('0x2d')]=_[_0x6902('0x28')](_0xdc5e58,_0x6902('0x26'));_0x1508cc[_0x6902('0x2e')]=_[_0x6902('0x2f')](_0x4a8d84[_0x6902('0x2e')]);_0x1508cc[_0x6902('0x30')]=_[_0x6902('0x31')](_0x1508cc['model'],_0x1508cc[_0x6902('0x2e')]);_0x512f6c[_0x6902('0x32')]=_[_0x6902('0x31')](_0x1508cc[_0x6902('0x2d')],qs[_0x6902('0x33')](_0x4a8d84[_0x6902('0x2e')][_0x6902('0x33')]));_0x512f6c[_0x6902('0x32')]=_0x512f6c[_0x6902('0x32')][_0x6902('0x34')]?_0x512f6c['attributes']:_0x1508cc['model'];if(!_0x4a8d84[_0x6902('0x2e')]['hasOwnProperty'](_0x6902('0x35'))){_0x512f6c[_0x6902('0x1e')]=qs[_0x6902('0x1e')](_0x4a8d84[_0x6902('0x2e')][_0x6902('0x1e')]);_0x512f6c['offset']=qs['offset'](_0x4a8d84['query'][_0x6902('0x1c')]);}_0x512f6c[_0x6902('0x36')]=qs[_0x6902('0x37')](_0x4a8d84[_0x6902('0x2e')][_0x6902('0x37')]);_0x512f6c['where']=qs[_0x6902('0x30')](_[_0x6902('0x38')](_0x4a8d84[_0x6902('0x2e')],_0x1508cc[_0x6902('0x30')]),_0xdc5e58);if(_0x4a8d84[_0x6902('0x2e')][_0x6902('0x39')]){_0x512f6c[_0x6902('0x3a')]=_[_0x6902('0x3b')](_0x512f6c[_0x6902('0x3a')],{'$or':_[_0x6902('0x28')](_0xdc5e58,function(_0x942948){if(_0x942948[_0x6902('0x3c')]!==_0x6902('0x3d')){var _0xe2f8ac={};_0xe2f8ac[_0x942948[_0x6902('0x26')]]={'$like':'%'+_0x4a8d84['query']['filter']+'%'};return _0xe2f8ac;}})});}_0x512f6c=_[_0x6902('0x3b')]({},_0x512f6c,_0x4a8d84['options']);var _0x386a69={'where':_0x512f6c[_0x6902('0x3a')]};return db['MailServerOut'][_0x6902('0x1f')](_0x386a69)[_0x6902('0x3e')](function(_0x4e0a9b){_0xbc7ae7[_0x6902('0x1f')]=_0x4e0a9b;if(_0x4a8d84[_0x6902('0x2e')][_0x6902('0x3f')]){_0x512f6c[_0x6902('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x6902('0x41')](_0x512f6c);})[_0x6902('0x3e')](function(_0x189595){_0xbc7ae7[_0x6902('0x42')]=_0x189595;return _0xbc7ae7;})[_0x6902('0x3e')](respondWithFilteredResult(_0x2b1ba1,_0x512f6c))[_0x6902('0x43')](handleError(_0x2b1ba1,null));};exports[_0x6902('0x44')]=function(_0x521790,_0x8cccaf){var _0x2cde28={'raw':!![],'where':{'id':_0x521790[_0x6902('0x45')]['id']}},_0x57c262={};_0x57c262[_0x6902('0x2d')]=_[_0x6902('0x2f')](db['MailServerOut'][_0x6902('0x2a')]);_0x57c262['query']=_['keys'](_0x521790['query']);_0x57c262[_0x6902('0x30')]=_[_0x6902('0x31')](_0x57c262['model'],_0x57c262[_0x6902('0x2e')]);_0x2cde28[_0x6902('0x32')]=_[_0x6902('0x31')](_0x57c262['model'],qs[_0x6902('0x33')](_0x521790[_0x6902('0x2e')][_0x6902('0x33')]));_0x2cde28[_0x6902('0x32')]=_0x2cde28[_0x6902('0x32')][_0x6902('0x34')]?_0x2cde28[_0x6902('0x32')]:_0x57c262[_0x6902('0x2d')];if(_0x521790[_0x6902('0x2e')][_0x6902('0x3f')]){_0x2cde28[_0x6902('0x40')]=[{'all':!![]}];}_0x2cde28=_[_0x6902('0x3b')]({},_0x2cde28,_0x521790['options']);return db[_0x6902('0x29')][_0x6902('0x46')](_0x2cde28)[_0x6902('0x3e')](handleEntityNotFound(_0x8cccaf,null))[_0x6902('0x3e')](respondWithResult(_0x8cccaf,null))[_0x6902('0x43')](handleError(_0x8cccaf,null));};exports['create']=function(_0x2f9be2,_0x1419f0){return db[_0x6902('0x29')][_0x6902('0x47')](_0x2f9be2[_0x6902('0x48')],{})[_0x6902('0x3e')](respondWithResult(_0x1419f0,0xc9))['catch'](handleError(_0x1419f0,null));};exports['update']=function(_0x33a3b3,_0x2d8be5){if(_0x33a3b3['body']['id']){delete _0x33a3b3['body']['id'];}return db[_0x6902('0x29')][_0x6902('0x46')]({'where':{'id':_0x33a3b3[_0x6902('0x45')]['id']}})[_0x6902('0x3e')](handleEntityNotFound(_0x2d8be5,null))[_0x6902('0x3e')](saveUpdates(_0x33a3b3[_0x6902('0x48')],null))[_0x6902('0x3e')](respondWithResult(_0x2d8be5,null))[_0x6902('0x43')](handleError(_0x2d8be5,null));};exports[_0x6902('0x49')]=function(_0x2cf949,_0x1b11d8){return db[_0x6902('0x29')][_0x6902('0x46')]({'where':{'id':_0x2cf949[_0x6902('0x45')]['id']}})[_0x6902('0x3e')](handleEntityNotFound(_0x1b11d8,null))[_0x6902('0x3e')](removeEntity(_0x1b11d8,null))[_0x6902('0x43')](handleError(_0x1b11d8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f899f55..9e664a2 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 _0x326f=['mail_servers_out','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x5ef4c,_0x20cb0b){var _0x5adc60=function(_0x16c25f){while(--_0x16c25f){_0x5ef4c['push'](_0x5ef4c['shift']());}};_0x5adc60(++_0x20cb0b);}(_0x326f,0xd1));var _0xf326=function(_0x201c10,_0x4ea884){_0x201c10=_0x201c10-0x0;var _0x81cce7=_0x326f[_0x201c10];return _0x81cce7;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','mail_servers_out','lodash'];(function(_0x10d3a9,_0x5175a5){var _0x443c92=function(_0x486623){while(--_0x486623){_0x10d3a9['push'](_0x10d3a9['shift']());}};_0x443c92(++_0x5175a5);}(_0xabce,0x103));var _0xeabc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xabce[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('MailServerOut',attributes,{'tableName':_0xeabc('0x9'),'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 c6bb56e..f76c6b7 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 _0x0c84=['jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x73e5b0,_0x241ec0){var _0x23ed6f=function(_0x12825c){while(--_0x12825c){_0x73e5b0['push'](_0x73e5b0['shift']());}};_0x23ed6f(++_0x241ec0);}(_0x0c84,0xc7));var _0x40c8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0c84[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x40c8('0x0'));var moment=require(_0x40c8('0x1'));var BPromise=require('bluebird');var rs=require(_0x40c8('0x2'));var fs=require('fs');var Redis=require(_0x40c8('0x3'));var db=require(_0x40c8('0x4'))['db'];var utils=require(_0x40c8('0x5'));var logger=require('../../config/logger')(_0x40c8('0x6'));var config=require(_0x40c8('0x7'));var jayson=require(_0x40c8('0x8'));var client=jayson[_0x40c8('0x9')][_0x40c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54d647,_0x2ad096,_0x46b57a){return new BPromise(function(_0x36ab24,_0x592a2d){return client[_0x40c8('0xb')](_0x54d647,_0x46b57a)[_0x40c8('0xc')](function(_0x5e1123){logger[_0x40c8('0xd')](_0x40c8('0xe'),_0x2ad096,_0x40c8('0xf'));logger[_0x40c8('0x10')](_0x40c8('0x11'),_0x2ad096,_0x40c8('0xf'),JSON[_0x40c8('0x12')](_0x5e1123));if(_0x5e1123[_0x40c8('0x13')]){if(_0x5e1123[_0x40c8('0x13')][_0x40c8('0x14')]===0x1f4){logger[_0x40c8('0x13')](_0x40c8('0xe'),_0x2ad096,_0x5e1123[_0x40c8('0x13')][_0x40c8('0x15')]);return _0x592a2d(_0x5e1123[_0x40c8('0x13')][_0x40c8('0x15')]);}logger['error'](_0x40c8('0xe'),_0x2ad096,_0x5e1123[_0x40c8('0x13')]['message']);return _0x36ab24(_0x5e1123[_0x40c8('0x13')][_0x40c8('0x15')]);}else{logger[_0x40c8('0xd')]('MailServerOut,\x20%s,\x20%s',_0x2ad096,_0x40c8('0xf'));_0x36ab24(_0x5e1123['result'][_0x40c8('0x15')]);}})[_0x40c8('0x16')](function(_0x1528d8){logger[_0x40c8('0x13')](_0x40c8('0xe'),_0x2ad096,_0x1528d8);_0x592a2d(_0x1528d8);});});} \ No newline at end of file +var _0xf973=['result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf973,0x106));var _0x3f97=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0xf973[_0x44ca6e];return _0x2edab2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f97('0x0'));var BPromise=require(_0x3f97('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f97('0x2'))['db'];var utils=require(_0x3f97('0x3'));var logger=require(_0x3f97('0x4'))(_0x3f97('0x5'));var config=require(_0x3f97('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3f97('0x7')][_0x3f97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2687da,_0x25328a,_0x47fdb1){return new BPromise(function(_0x4e779a,_0x1ba977){return client['request'](_0x2687da,_0x47fdb1)[_0x3f97('0x9')](function(_0x245b43){logger[_0x3f97('0xa')](_0x3f97('0xb'),_0x25328a,'request\x20sent');logger['debug'](_0x3f97('0xc'),_0x25328a,_0x3f97('0xd'),JSON[_0x3f97('0xe')](_0x245b43));if(_0x245b43[_0x3f97('0xf')]){if(_0x245b43['error'][_0x3f97('0x10')]===0x1f4){logger[_0x3f97('0xf')](_0x3f97('0xb'),_0x25328a,_0x245b43['error'][_0x3f97('0x11')]);return _0x1ba977(_0x245b43[_0x3f97('0xf')][_0x3f97('0x11')]);}logger[_0x3f97('0xf')]('MailServerOut,\x20%s,\x20%s',_0x25328a,_0x245b43[_0x3f97('0xf')][_0x3f97('0x11')]);return _0x4e779a(_0x245b43['error'][_0x3f97('0x11')]);}else{logger[_0x3f97('0xa')](_0x3f97('0xb'),_0x25328a,_0x3f97('0xd'));_0x4e779a(_0x245b43[_0x3f97('0x12')]['message']);}})[_0x3f97('0x13')](function(_0x13aeda){logger[_0x3f97('0xf')](_0x3f97('0xb'),_0x25328a,_0x13aeda);_0x1ba977(_0x13aeda);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index bc39bee..23ee9fb 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 _0xd0a4=['destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','/:id','post','create','put'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0xd0a4,0x166));var _0x4d0a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd0a4[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x4d0a('0x0'));var util=require(_0x4d0a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d0a('0x2')]();var fs_extra=require(_0x4d0a('0x3'));var auth=require(_0x4d0a('0x4'));var interaction=require(_0x4d0a('0x5'));var config=require(_0x4d0a('0x6'));var controller=require(_0x4d0a('0x7'));router[_0x4d0a('0x8')]('/',auth[_0x4d0a('0x9')](),controller[_0x4d0a('0xa')]);router['get']('/describe',auth[_0x4d0a('0x9')](),controller[_0x4d0a('0xb')]);router['get'](_0x4d0a('0xc'),auth[_0x4d0a('0x9')](),controller['show']);router[_0x4d0a('0xd')]('/',auth[_0x4d0a('0x9')](),controller[_0x4d0a('0xe')]);router[_0x4d0a('0xf')](_0x4d0a('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4d0a('0xc'),auth[_0x4d0a('0x9')](),controller[_0x4d0a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x38c9=['get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller'];(function(_0x5f504b,_0x22813a){var _0x1cf25a=function(_0x4e9f04){while(--_0x4e9f04){_0x5f504b['push'](_0x5f504b['shift']());}};_0x1cf25a(++_0x22813a);}(_0x38c9,0x199));var _0x938c=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x38c9[_0x11a220];return _0x20d8fe;};'use strict';var multer=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var path=require(_0x938c('0x2'));var timeout=require('connect-timeout');var express=require(_0x938c('0x3'));var router=express[_0x938c('0x4')]();var fs_extra=require(_0x938c('0x5'));var auth=require(_0x938c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x938c('0x7'));var controller=require(_0x938c('0x8'));router[_0x938c('0x9')]('/',auth[_0x938c('0xa')](),controller['index']);router[_0x938c('0x9')](_0x938c('0xb'),auth[_0x938c('0xa')](),controller[_0x938c('0xc')]);router['get']('/:id',auth[_0x938c('0xa')](),controller[_0x938c('0xd')]);router[_0x938c('0xe')]('/',auth[_0x938c('0xa')](),controller[_0x938c('0xf')]);router[_0x938c('0x10')](_0x938c('0x11'),auth[_0x938c('0xa')](),controller[_0x938c('0x12')]);router[_0x938c('0x13')](_0x938c('0x11'),auth[_0x938c('0xa')](),controller[_0x938c('0x14')]);module[_0x938c('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index b008bd2..f583d77 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 _0x6fc2=['sequelize','exports','STRING'];(function(_0x376713,_0x5e9900){var _0x1c108c=function(_0x1d67fb){while(--_0x1d67fb){_0x376713['push'](_0x376713['shift']());}};_0x1c108c(++_0x5e9900);}(_0x6fc2,0x117));var _0x26fc=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x6fc2[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0x26fc('0x0'));module[_0x26fc('0x1')]={'name':{'type':Sequelize[_0x26fc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x26fc('0x2')]}}; \ No newline at end of file +var _0xb90a=['name','sequelize','exports'];(function(_0x2a81a6,_0xa097cb){var _0x5cf004=function(_0x4b547f){while(--_0x4b547f){_0x2a81a6['push'](_0x2a81a6['shift']());}};_0x5cf004(++_0xa097cb);}(_0xb90a,0x12a));var _0xab90=function(_0x42a823,_0x212a8d){_0x42a823=_0x42a823-0x0;var _0x571da0=_0xb90a[_0x42a823];return _0x571da0;};'use strict';var Sequelize=require(_0xab90('0x0'));module[_0xab90('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xab90('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d5a8740..41dc49e 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 _0x0f72=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','stack','name','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x22de84,_0x56142b){var _0x54fc49=function(_0x3be7bc){while(--_0x3be7bc){_0x22de84['push'](_0x22de84['shift']());}};_0x54fc49(++_0x56142b);}(_0x0f72,0xcb));var _0x20f7=function(_0x12a9bf,_0x503ded){_0x12a9bf=_0x12a9bf-0x0;var _0x413c15=_0x0f72[_0x12a9bf];return _0x413c15;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x20f7('0x0'));var jsonpatch=require(_0x20f7('0x1'));var rp=require(_0x20f7('0x2'));var moment=require(_0x20f7('0x3'));var BPromise=require(_0x20f7('0x4'));var Mustache=require(_0x20f7('0x5'));var util=require(_0x20f7('0x6'));var path=require(_0x20f7('0x7'));var sox=require(_0x20f7('0x8'));var csv=require(_0x20f7('0x9'));var ejs=require(_0x20f7('0xa'));var fs=require('fs');var fs_extra=require(_0x20f7('0xb'));var _=require(_0x20f7('0xc'));var squel=require('squel');var crypto=require(_0x20f7('0xd'));var jsforce=require(_0x20f7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x20f7('0x9'));var querystring=require(_0x20f7('0xf'));var Papa=require('papaparse');var Redis=require(_0x20f7('0x10'));var authService=require(_0x20f7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20f7('0x12'));var logger=require(_0x20f7('0x13'))('api');var utils=require(_0x20f7('0x14'));var config=require(_0x20f7('0x15'));var licenseUtil=require(_0x20f7('0x16'));var db=require(_0x20f7('0x17'))['db'];function respondWithStatusCode(_0x30ed2b,_0x225a28){_0x225a28=_0x225a28||0xcc;return function(_0x530218){if(_0x530218){return _0x30ed2b[_0x20f7('0x18')](_0x225a28);}return _0x30ed2b[_0x20f7('0x19')](_0x225a28)['end']();};}function respondWithResult(_0x24c111,_0x367a23){_0x367a23=_0x367a23||0xc8;return function(_0x5064b0){if(_0x5064b0){return _0x24c111['status'](_0x367a23)[_0x20f7('0x1a')](_0x5064b0);}};}function respondWithFilteredResult(_0x1ba31d,_0x5db90d){return function(_0x4d3121){if(_0x4d3121){var _0x453848=typeof _0x5db90d[_0x20f7('0x1b')]===_0x20f7('0x1c')&&typeof _0x5db90d[_0x20f7('0x1d')]===_0x20f7('0x1c');var _0x407d5b=_0x4d3121['count'];var _0x102cf0=_0x453848?0x0:_0x5db90d['offset'];var _0x36dac8=_0x453848?_0x4d3121[_0x20f7('0x1e')]:_0x5db90d['offset']+_0x5db90d['limit'];var _0x2967fa;if(_0x36dac8>=_0x407d5b){_0x36dac8=_0x407d5b;_0x2967fa=0xc8;}else{_0x2967fa=0xce;}_0x1ba31d[_0x20f7('0x19')](_0x2967fa);return _0x1ba31d[_0x20f7('0x1f')]('Content-Range',_0x102cf0+'-'+_0x36dac8+'/'+_0x407d5b)[_0x20f7('0x1a')](_0x4d3121);}return null;};}function patchUpdates(_0x5536e9){return function(_0x2cc97b){try{jsonpatch[_0x20f7('0x20')](_0x2cc97b,_0x5536e9,!![]);}catch(_0x38b36c){return BPromise[_0x20f7('0x21')](_0x38b36c);}return _0x2cc97b['save']();};}function saveUpdates(_0x3c64f9,_0x70d3bb){return function(_0x23bfd9){if(_0x23bfd9){return _0x23bfd9[_0x20f7('0x22')](_0x3c64f9)[_0x20f7('0x23')](function(_0x49fa93){return _0x49fa93;});}return null;};}function removeEntity(_0x4316c7,_0x2b1c40){return function(_0x3295a8){if(_0x3295a8){return _0x3295a8[_0x20f7('0x24')]()[_0x20f7('0x23')](function(){_0x4316c7[_0x20f7('0x19')](0xcc)[_0x20f7('0x25')]();});}};}function handleEntityNotFound(_0x2e16d3,_0x29fde9){return function(_0xce33dd){if(!_0xce33dd){_0x2e16d3[_0x20f7('0x18')](0x194);}return _0xce33dd;};}function handleError(_0x2dd0da,_0x350cb7){_0x350cb7=_0x350cb7||0x1f4;return function(_0x5c4ef2){logger['error'](_0x5c4ef2[_0x20f7('0x26')]);if(_0x5c4ef2[_0x20f7('0x27')]){delete _0x5c4ef2['name'];}_0x2dd0da[_0x20f7('0x19')](_0x350cb7)['send'](_0x5c4ef2);};}exports[_0x20f7('0x28')]=function(_0x3b4933,_0x43e04f){var _0x3adacd={},_0x1c59fa={},_0x38d24c={'count':0x0,'rows':[]};var _0x441d5e=_[_0x20f7('0x29')](db[_0x20f7('0x2a')]['rawAttributes'],function(_0x5f0365){return{'name':_0x5f0365[_0x20f7('0x2b')],'type':_0x5f0365[_0x20f7('0x2c')][_0x20f7('0x2d')]};});_0x1c59fa[_0x20f7('0x2e')]=_[_0x20f7('0x29')](_0x441d5e,'name');_0x1c59fa[_0x20f7('0x2f')]=_[_0x20f7('0x30')](_0x3b4933[_0x20f7('0x2f')]);_0x1c59fa[_0x20f7('0x31')]=_['intersection'](_0x1c59fa[_0x20f7('0x2e')],_0x1c59fa[_0x20f7('0x2f')]);_0x3adacd['attributes']=_[_0x20f7('0x32')](_0x1c59fa['model'],qs['fields'](_0x3b4933[_0x20f7('0x2f')][_0x20f7('0x33')]));_0x3adacd['attributes']=_0x3adacd[_0x20f7('0x34')][_0x20f7('0x35')]?_0x3adacd[_0x20f7('0x34')]:_0x1c59fa[_0x20f7('0x2e')];if(!_0x3b4933['query'][_0x20f7('0x36')](_0x20f7('0x37'))){_0x3adacd[_0x20f7('0x1d')]=qs[_0x20f7('0x1d')](_0x3b4933['query']['limit']);_0x3adacd[_0x20f7('0x1b')]=qs['offset'](_0x3b4933[_0x20f7('0x2f')][_0x20f7('0x1b')]);}_0x3adacd[_0x20f7('0x38')]=qs[_0x20f7('0x39')](_0x3b4933['query'][_0x20f7('0x39')]);_0x3adacd[_0x20f7('0x3a')]=qs[_0x20f7('0x31')](_['pick'](_0x3b4933['query'],_0x1c59fa['filters']),_0x441d5e);if(_0x3b4933['query']['filter']){_0x3adacd[_0x20f7('0x3a')]=_[_0x20f7('0x3b')](_0x3adacd[_0x20f7('0x3a')],{'$or':_[_0x20f7('0x29')](_0x441d5e,function(_0x21fa6e){if(_0x21fa6e['type']!=='VIRTUAL'){var _0x44a568={};_0x44a568[_0x21fa6e[_0x20f7('0x27')]]={'$like':'%'+_0x3b4933[_0x20f7('0x2f')][_0x20f7('0x3c')]+'%'};return _0x44a568;}})});}_0x3adacd=_[_0x20f7('0x3b')]({},_0x3adacd,_0x3b4933['options']);var _0x444722={'where':_0x3adacd['where']};return db[_0x20f7('0x2a')][_0x20f7('0x1e')](_0x444722)[_0x20f7('0x23')](function(_0x54ac67){_0x38d24c[_0x20f7('0x1e')]=_0x54ac67;if(_0x3b4933[_0x20f7('0x2f')]['includeAll']){_0x3adacd[_0x20f7('0x3d')]=[{'all':!![]}];}return db['MailSubstatus'][_0x20f7('0x3e')](_0x3adacd);})[_0x20f7('0x23')](function(_0x4f615d){_0x38d24c[_0x20f7('0x3f')]=_0x4f615d;return _0x38d24c;})[_0x20f7('0x23')](respondWithFilteredResult(_0x43e04f,_0x3adacd))[_0x20f7('0x40')](handleError(_0x43e04f,null));};exports[_0x20f7('0x41')]=function(_0x23b53f,_0x37ead4){var _0x310149={'raw':!![],'where':{'id':_0x23b53f[_0x20f7('0x42')]['id']}},_0x4b09f7={};_0x4b09f7[_0x20f7('0x2e')]=_[_0x20f7('0x30')](db[_0x20f7('0x2a')][_0x20f7('0x43')]);_0x4b09f7[_0x20f7('0x2f')]=_[_0x20f7('0x30')](_0x23b53f[_0x20f7('0x2f')]);_0x4b09f7[_0x20f7('0x31')]=_[_0x20f7('0x32')](_0x4b09f7[_0x20f7('0x2e')],_0x4b09f7[_0x20f7('0x2f')]);_0x310149[_0x20f7('0x34')]=_[_0x20f7('0x32')](_0x4b09f7[_0x20f7('0x2e')],qs[_0x20f7('0x33')](_0x23b53f[_0x20f7('0x2f')]['fields']));_0x310149[_0x20f7('0x34')]=_0x310149[_0x20f7('0x34')][_0x20f7('0x35')]?_0x310149[_0x20f7('0x34')]:_0x4b09f7[_0x20f7('0x2e')];if(_0x23b53f[_0x20f7('0x2f')]['includeAll']){_0x310149[_0x20f7('0x3d')]=[{'all':!![]}];}_0x310149=_[_0x20f7('0x3b')]({},_0x310149,_0x23b53f['options']);return db['MailSubstatus'][_0x20f7('0x44')](_0x310149)['then'](handleEntityNotFound(_0x37ead4,null))[_0x20f7('0x23')](respondWithResult(_0x37ead4,null))['catch'](handleError(_0x37ead4,null));};exports['create']=function(_0x506071,_0x1f115f){return db['MailSubstatus'][_0x20f7('0x45')](_0x506071[_0x20f7('0x46')],{})[_0x20f7('0x23')](respondWithResult(_0x1f115f,0xc9))['catch'](handleError(_0x1f115f,null));};exports['update']=function(_0x30e2ff,_0x836491){if(_0x30e2ff['body']['id']){delete _0x30e2ff[_0x20f7('0x46')]['id'];}return db[_0x20f7('0x2a')]['find']({'where':{'id':_0x30e2ff[_0x20f7('0x42')]['id']}})[_0x20f7('0x23')](handleEntityNotFound(_0x836491,null))[_0x20f7('0x23')](saveUpdates(_0x30e2ff[_0x20f7('0x46')],null))['then'](respondWithResult(_0x836491,null))['catch'](handleError(_0x836491,null));};exports[_0x20f7('0x24')]=function(_0x59edc5,_0x3e8f0f){return db[_0x20f7('0x2a')][_0x20f7('0x44')]({'where':{'id':_0x59edc5[_0x20f7('0x42')]['id']}})[_0x20f7('0x23')](handleEntityNotFound(_0x3e8f0f,null))['then'](removeEntity(_0x3e8f0f,null))[_0x20f7('0x40')](handleError(_0x3e8f0f,null));};exports[_0x20f7('0x47')]=function(_0xa7d858,_0x854ef4){return db[_0x20f7('0x2a')][_0x20f7('0x47')]()[_0x20f7('0x23')](respondWithResult(_0x854ef4,null))[_0x20f7('0x40')](handleError(_0x854ef4,null));}; \ No newline at end of file +var _0x255d=['key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','MailSubstatus','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x136269,_0x5c3057){var _0x4bdb93=function(_0x4a33d9){while(--_0x4a33d9){_0x136269['push'](_0x136269['shift']());}};_0x4bdb93(++_0x5c3057);}(_0x255d,0x151));var _0xd255=function(_0x217332,_0x3c4328){_0x217332=_0x217332-0x0;var _0x141ba3=_0x255d[_0x217332];return _0x141ba3;};'use strict';var emlformat=require(_0xd255('0x0'));var rimraf=require(_0xd255('0x1'));var zipdir=require(_0xd255('0x2'));var jsonpatch=require(_0xd255('0x3'));var rp=require(_0xd255('0x4'));var moment=require('moment');var BPromise=require(_0xd255('0x5'));var Mustache=require(_0xd255('0x6'));var util=require(_0xd255('0x7'));var path=require(_0xd255('0x8'));var sox=require(_0xd255('0x9'));var csv=require(_0xd255('0xa'));var ejs=require(_0xd255('0xb'));var fs=require('fs');var fs_extra=require(_0xd255('0xc'));var _=require('lodash');var squel=require(_0xd255('0xd'));var crypto=require(_0xd255('0xe'));var jsforce=require(_0xd255('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd255('0xa'));var querystring=require(_0xd255('0x10'));var Papa=require(_0xd255('0x11'));var Redis=require('ioredis');var authService=require(_0xd255('0x12'));var qs=require(_0xd255('0x13'));var as=require(_0xd255('0x14'));var hardwareService=require(_0xd255('0x15'));var logger=require(_0xd255('0x16'))(_0xd255('0x17'));var utils=require(_0xd255('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd255('0x19'));var db=require(_0xd255('0x1a'))['db'];function respondWithStatusCode(_0x43ea14,_0x2a1fd3){_0x2a1fd3=_0x2a1fd3||0xcc;return function(_0x30ddf3){if(_0x30ddf3){return _0x43ea14[_0xd255('0x1b')](_0x2a1fd3);}return _0x43ea14[_0xd255('0x1c')](_0x2a1fd3)[_0xd255('0x1d')]();};}function respondWithResult(_0x48d5c6,_0x2e561a){_0x2e561a=_0x2e561a||0xc8;return function(_0x59dea2){if(_0x59dea2){return _0x48d5c6[_0xd255('0x1c')](_0x2e561a)[_0xd255('0x1e')](_0x59dea2);}};}function respondWithFilteredResult(_0x1977f0,_0x59b928){return function(_0x1f51e7){if(_0x1f51e7){var _0xc8f21=typeof _0x59b928[_0xd255('0x1f')]==='undefined'&&typeof _0x59b928[_0xd255('0x20')]===_0xd255('0x21');var _0x332f1c=_0x1f51e7[_0xd255('0x22')];var _0x4bc323=_0xc8f21?0x0:_0x59b928[_0xd255('0x1f')];var _0x13cfdb=_0xc8f21?_0x1f51e7[_0xd255('0x22')]:_0x59b928['offset']+_0x59b928[_0xd255('0x20')];var _0x2dabf2;if(_0x13cfdb>=_0x332f1c){_0x13cfdb=_0x332f1c;_0x2dabf2=0xc8;}else{_0x2dabf2=0xce;}_0x1977f0[_0xd255('0x1c')](_0x2dabf2);return _0x1977f0['set']('Content-Range',_0x4bc323+'-'+_0x13cfdb+'/'+_0x332f1c)[_0xd255('0x1e')](_0x1f51e7);}return null;};}function patchUpdates(_0x230c75){return function(_0x35e2b4){try{jsonpatch[_0xd255('0x23')](_0x35e2b4,_0x230c75,!![]);}catch(_0xedd1ce){return BPromise[_0xd255('0x24')](_0xedd1ce);}return _0x35e2b4[_0xd255('0x25')]();};}function saveUpdates(_0x5b23b8,_0x171722){return function(_0x2c37eb){if(_0x2c37eb){return _0x2c37eb['update'](_0x5b23b8)[_0xd255('0x26')](function(_0x12c1b3){return _0x12c1b3;});}return null;};}function removeEntity(_0x19b22e,_0x1b4627){return function(_0x4ee86c){if(_0x4ee86c){return _0x4ee86c[_0xd255('0x27')]()[_0xd255('0x26')](function(){_0x19b22e[_0xd255('0x1c')](0xcc)[_0xd255('0x1d')]();});}};}function handleEntityNotFound(_0x1e8a61,_0x45dd67){return function(_0x4cf96c){if(!_0x4cf96c){_0x1e8a61[_0xd255('0x1b')](0x194);}return _0x4cf96c;};}function handleError(_0x58f2a5,_0xd3f828){_0xd3f828=_0xd3f828||0x1f4;return function(_0x201dbe){logger['error'](_0x201dbe[_0xd255('0x28')]);if(_0x201dbe[_0xd255('0x29')]){delete _0x201dbe[_0xd255('0x29')];}_0x58f2a5[_0xd255('0x1c')](_0xd3f828)[_0xd255('0x2a')](_0x201dbe);};}exports[_0xd255('0x2b')]=function(_0x21fad7,_0x2f2931){var _0x53f463={},_0x3a0d0e={},_0x21a506={'count':0x0,'rows':[]};var _0x3b4361=_[_0xd255('0x2c')](db['MailSubstatus'][_0xd255('0x2d')],function(_0x40699a){return{'name':_0x40699a[_0xd255('0x2e')],'type':_0x40699a[_0xd255('0x2f')][_0xd255('0x30')]};});_0x3a0d0e['model']=_[_0xd255('0x2c')](_0x3b4361,_0xd255('0x29'));_0x3a0d0e[_0xd255('0x31')]=_[_0xd255('0x32')](_0x21fad7[_0xd255('0x31')]);_0x3a0d0e[_0xd255('0x33')]=_[_0xd255('0x34')](_0x3a0d0e['model'],_0x3a0d0e['query']);_0x53f463[_0xd255('0x35')]=_[_0xd255('0x34')](_0x3a0d0e[_0xd255('0x36')],qs[_0xd255('0x37')](_0x21fad7['query'][_0xd255('0x37')]));_0x53f463['attributes']=_0x53f463[_0xd255('0x35')][_0xd255('0x38')]?_0x53f463[_0xd255('0x35')]:_0x3a0d0e[_0xd255('0x36')];if(!_0x21fad7[_0xd255('0x31')][_0xd255('0x39')]('nolimit')){_0x53f463[_0xd255('0x20')]=qs[_0xd255('0x20')](_0x21fad7['query'][_0xd255('0x20')]);_0x53f463[_0xd255('0x1f')]=qs[_0xd255('0x1f')](_0x21fad7[_0xd255('0x31')][_0xd255('0x1f')]);}_0x53f463[_0xd255('0x3a')]=qs[_0xd255('0x3b')](_0x21fad7['query']['sort']);_0x53f463[_0xd255('0x3c')]=qs[_0xd255('0x33')](_['pick'](_0x21fad7[_0xd255('0x31')],_0x3a0d0e[_0xd255('0x33')]),_0x3b4361);if(_0x21fad7[_0xd255('0x31')][_0xd255('0x3d')]){_0x53f463[_0xd255('0x3c')]=_['merge'](_0x53f463['where'],{'$or':_[_0xd255('0x2c')](_0x3b4361,function(_0x2cd946){if(_0x2cd946['type']!==_0xd255('0x3e')){var _0x31ba95={};_0x31ba95[_0x2cd946[_0xd255('0x29')]]={'$like':'%'+_0x21fad7[_0xd255('0x31')][_0xd255('0x3d')]+'%'};return _0x31ba95;}})});}_0x53f463=_[_0xd255('0x3f')]({},_0x53f463,_0x21fad7['options']);var _0x50e64f={'where':_0x53f463[_0xd255('0x3c')]};return db['MailSubstatus']['count'](_0x50e64f)[_0xd255('0x26')](function(_0x381041){_0x21a506[_0xd255('0x22')]=_0x381041;if(_0x21fad7[_0xd255('0x31')][_0xd255('0x40')]){_0x53f463[_0xd255('0x41')]=[{'all':!![]}];}return db[_0xd255('0x42')][_0xd255('0x43')](_0x53f463);})[_0xd255('0x26')](function(_0x479717){_0x21a506[_0xd255('0x44')]=_0x479717;return _0x21a506;})[_0xd255('0x26')](respondWithFilteredResult(_0x2f2931,_0x53f463))[_0xd255('0x45')](handleError(_0x2f2931,null));};exports[_0xd255('0x46')]=function(_0x313717,_0x2079ba){var _0x264a9e={'raw':!![],'where':{'id':_0x313717['params']['id']}},_0x489101={};_0x489101[_0xd255('0x36')]=_[_0xd255('0x32')](db[_0xd255('0x42')][_0xd255('0x2d')]);_0x489101[_0xd255('0x31')]=_[_0xd255('0x32')](_0x313717['query']);_0x489101[_0xd255('0x33')]=_[_0xd255('0x34')](_0x489101[_0xd255('0x36')],_0x489101['query']);_0x264a9e[_0xd255('0x35')]=_['intersection'](_0x489101[_0xd255('0x36')],qs[_0xd255('0x37')](_0x313717[_0xd255('0x31')][_0xd255('0x37')]));_0x264a9e[_0xd255('0x35')]=_0x264a9e['attributes']['length']?_0x264a9e[_0xd255('0x35')]:_0x489101[_0xd255('0x36')];if(_0x313717[_0xd255('0x31')]['includeAll']){_0x264a9e[_0xd255('0x41')]=[{'all':!![]}];}_0x264a9e=_[_0xd255('0x3f')]({},_0x264a9e,_0x313717[_0xd255('0x47')]);return db[_0xd255('0x42')][_0xd255('0x48')](_0x264a9e)['then'](handleEntityNotFound(_0x2079ba,null))[_0xd255('0x26')](respondWithResult(_0x2079ba,null))[_0xd255('0x45')](handleError(_0x2079ba,null));};exports[_0xd255('0x49')]=function(_0x1a0834,_0x2e22c9){return db[_0xd255('0x42')]['create'](_0x1a0834[_0xd255('0x4a')],{})[_0xd255('0x26')](respondWithResult(_0x2e22c9,0xc9))['catch'](handleError(_0x2e22c9,null));};exports['update']=function(_0x243fcd,_0x2c09cb){if(_0x243fcd[_0xd255('0x4a')]['id']){delete _0x243fcd[_0xd255('0x4a')]['id'];}return db[_0xd255('0x42')][_0xd255('0x48')]({'where':{'id':_0x243fcd['params']['id']}})[_0xd255('0x26')](handleEntityNotFound(_0x2c09cb,null))[_0xd255('0x26')](saveUpdates(_0x243fcd[_0xd255('0x4a')],null))[_0xd255('0x26')](respondWithResult(_0x2c09cb,null))['catch'](handleError(_0x2c09cb,null));};exports[_0xd255('0x27')]=function(_0x55f587,_0x433cdd){return db[_0xd255('0x42')][_0xd255('0x48')]({'where':{'id':_0x55f587[_0xd255('0x4b')]['id']}})['then'](handleEntityNotFound(_0x433cdd,null))[_0xd255('0x26')](removeEntity(_0x433cdd,null))[_0xd255('0x45')](handleError(_0x433cdd,null));};exports[_0xd255('0x4c')]=function(_0x520a66,_0x2edc2c){return db[_0xd255('0x42')][_0xd255('0x4c')]()[_0xd255('0x26')](respondWithResult(_0x2edc2c,null))[_0xd255('0x45')](handleError(_0x2edc2c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4ef1db2..b0304d1 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 _0xdd4f=['exports','define','MailSubstatus','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xb46344,_0x1909b0){_0xb46344=_0xb46344-0x0;var _0x82d37c=_0xdd4f[_0xb46344];return _0x82d37c;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./mailSubstatus.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7334=['exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes'];(function(_0x502ca3,_0x36be36){var _0x27f42c=function(_0x1e3045){while(--_0x1e3045){_0x502ca3['push'](_0x502ca3['shift']());}};_0x27f42c(++_0x36be36);}(_0x7334,0x184));var _0x4733=function(_0x5457c7,_0xd61d20){_0x5457c7=_0x5457c7-0x0;var _0x5a7840=_0x7334[_0x5457c7];return _0x5a7840;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var logger=require(_0x4733('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4733('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4733('0x4'));var rimraf=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var attributes=require(_0x4733('0x7'));module[_0x4733('0x8')]=function(_0x449ead,_0x16d7cc){return _0x449ead[_0x4733('0x9')](_0x4733('0xa'),attributes,{'tableName':_0x4733('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 70e09c7..f53f0ce 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 _0x22fb=['MailSubstatus,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x118edb,_0x3ed3bf){var _0x5ad5c1=function(_0x207733){while(--_0x207733){_0x118edb['push'](_0x118edb['shift']());}};_0x5ad5c1(++_0x3ed3bf);}(_0x22fb,0x192));var _0xb22f=function(_0xffc671,_0xf94d24){_0xffc671=_0xffc671-0x0;var _0x583c90=_0x22fb[_0xffc671];return _0x583c90;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x26f4a4,_0xeb0dc6){var _0x437404=function(_0x173ca5){while(--_0x173ca5){_0x26f4a4['push'](_0x26f4a4['shift']());}};_0x437404(++_0xeb0dc6);}(_0xaa88,0x137));var _0x8aa8=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0xaa88[_0x5de532];return _0x4e9192;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 2350157..9c191e0 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 _0x6ae2=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','/describe','isAuthenticated'];(function(_0x3383a9,_0x480978){var _0x2ec865=function(_0x5a5cc7){while(--_0x5a5cc7){_0x3383a9['push'](_0x3383a9['shift']());}};_0x2ec865(++_0x480978);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x459820,_0x50202a){_0x459820=_0x459820-0x0;var _0x1d0c05=_0x6ae2[_0x459820];return _0x1d0c05;};'use strict';var multer=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var path=require(_0x26ae('0x2'));var timeout=require(_0x26ae('0x3'));var express=require(_0x26ae('0x4'));var router=express[_0x26ae('0x5')]();var fs_extra=require(_0x26ae('0x6'));var auth=require(_0x26ae('0x7'));var interaction=require(_0x26ae('0x8'));var config=require('../../config/environment');var controller=require(_0x26ae('0x9'));router[_0x26ae('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x26ae('0xa')](_0x26ae('0xb'),auth[_0x26ae('0xc')](),controller[_0x26ae('0xd')]);router[_0x26ae('0xa')](_0x26ae('0xe'),auth[_0x26ae('0xc')](),controller[_0x26ae('0xf')]);router[_0x26ae('0x10')]('/',auth[_0x26ae('0xc')](),controller[_0x26ae('0x11')]);router[_0x26ae('0x12')]('/:id',auth[_0x26ae('0xc')](),controller['update']);router[_0x26ae('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x26ae('0x14')]);module[_0x26ae('0x15')]=router; \ No newline at end of file +var _0x823c=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','delete','destroy','exports'];(function(_0x30d24b,_0x3e0dfc){var _0x5b774d=function(_0x56545a){while(--_0x56545a){_0x30d24b['push'](_0x30d24b['shift']());}};_0x5b774d(++_0x3e0dfc);}(_0x823c,0x143));var _0xc823=function(_0x16832c,_0x49c3d5){_0x16832c=_0x16832c-0x0;var _0x24a51a=_0x823c[_0x16832c];return _0x24a51a;};'use strict';var multer=require(_0xc823('0x0'));var util=require('util');var path=require(_0xc823('0x1'));var timeout=require(_0xc823('0x2'));var express=require(_0xc823('0x3'));var router=express[_0xc823('0x4')]();var fs_extra=require(_0xc823('0x5'));var auth=require(_0xc823('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc823('0x7'));var controller=require(_0xc823('0x8'));router[_0xc823('0x9')]('/',auth[_0xc823('0xa')](),controller[_0xc823('0xb')]);router['get'](_0xc823('0xc'),auth[_0xc823('0xa')](),controller['describe']);router['get'](_0xc823('0xd'),auth[_0xc823('0xa')](),controller['show']);router[_0xc823('0xe')]('/',auth[_0xc823('0xa')](),controller['create']);router['put'](_0xc823('0xd'),auth[_0xc823('0xa')](),controller[_0xc823('0xf')]);router[_0xc823('0x10')](_0xc823('0xd'),auth['isAuthenticated'](),controller[_0xc823('0x11')]);module[_0xc823('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 11196b2..76c759e 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 _0xab97=['account','queue','moment','sequelize','STRING'];(function(_0x29794b,_0x17e57e){var _0x38f6cf=function(_0x256136){while(--_0x256136){_0x29794b['push'](_0x29794b['shift']());}};_0x38f6cf(++_0x17e57e);}(_0xab97,0x1c9));var _0x7ab9=function(_0x54effc,_0x2c57d0){_0x54effc=_0x54effc-0x0;var _0x55fca9=_0xab97[_0x54effc];return _0x55fca9;};'use strict';var moment=require(_0x7ab9('0x0'));var Sequelize=require(_0x7ab9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7ab9('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7ab9('0x3'),'agent',_0x7ab9('0x4')),'allowNull':![],'defaultValue':_0x7ab9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x03f6=['sequelize','ENUM','account','queue','DATE','NOW'];(function(_0x3df18c,_0xdd935){var _0x2f50ef=function(_0x5bccfa){while(--_0x5bccfa){_0x3df18c['push'](_0x3df18c['shift']());}};_0x2f50ef(++_0xdd935);}(_0x03f6,0x102));var _0x603f=function(_0xfa0a40,_0x5d6403){_0xfa0a40=_0xfa0a40-0x0;var _0x2e9e9d=_0x03f6[_0xfa0a40];return _0x2e9e9d;};'use strict';var moment=require('moment');var Sequelize=require(_0x603f('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x603f('0x1')](_0x603f('0x2'),'agent',_0x603f('0x3')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x603f('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x603f('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e63525c..0797ace 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 _0xfeaf=['squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x3ce0d5,_0x203024){var _0x2e5731=function(_0x4be620){while(--_0x4be620){_0x3ce0d5['push'](_0x3ce0d5['shift']());}};_0x2e5731(++_0x203024);}(_0xfeaf,0x81));var _0xffea=function(_0x138147,_0x2f95b8){_0x138147=_0x138147-0x0;var _0x57870c=_0xfeaf[_0x138147];return _0x57870c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xffea('0x0'));var zipdir=require(_0xffea('0x1'));var jsonpatch=require(_0xffea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xffea('0x3'));var Mustache=require(_0xffea('0x4'));var util=require(_0xffea('0x5'));var path=require(_0xffea('0x6'));var sox=require('sox');var csv=require(_0xffea('0x7'));var ejs=require(_0xffea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xffea('0x9'));var crypto=require('crypto');var jsforce=require(_0xffea('0xa'));var deskjs=require(_0xffea('0xb'));var toCsv=require(_0xffea('0x7'));var querystring=require(_0xffea('0xc'));var Papa=require(_0xffea('0xd'));var Redis=require('ioredis');var authService=require(_0xffea('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xffea('0xf'));var hardwareService=require(_0xffea('0x10'));var logger=require('../../config/logger')(_0xffea('0x11'));var utils=require(_0xffea('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1952a8,_0x59d0cf){_0x59d0cf=_0x59d0cf||0xcc;return function(_0xf99383){if(_0xf99383){return _0x1952a8['sendStatus'](_0x59d0cf);}return _0x1952a8['status'](_0x59d0cf)[_0xffea('0x13')]();};}function respondWithResult(_0x4eb574,_0x2f8d36){_0x2f8d36=_0x2f8d36||0xc8;return function(_0x689749){if(_0x689749){return _0x4eb574[_0xffea('0x14')](_0x2f8d36)[_0xffea('0x15')](_0x689749);}};}function respondWithFilteredResult(_0x5f4548,_0x4322b7){return function(_0x474a81){if(_0x474a81){var _0x2eedfa=typeof _0x4322b7[_0xffea('0x16')]===_0xffea('0x17')&&typeof _0x4322b7[_0xffea('0x18')]==='undefined';var _0x586dbb=_0x474a81[_0xffea('0x19')];var _0xf7c8f=_0x2eedfa?0x0:_0x4322b7[_0xffea('0x16')];var _0x71c9dd=_0x2eedfa?_0x474a81['count']:_0x4322b7['offset']+_0x4322b7['limit'];var _0x76fc68;if(_0x71c9dd>=_0x586dbb){_0x71c9dd=_0x586dbb;_0x76fc68=0xc8;}else{_0x76fc68=0xce;}_0x5f4548['status'](_0x76fc68);return _0x5f4548['set'](_0xffea('0x1a'),_0xf7c8f+'-'+_0x71c9dd+'/'+_0x586dbb)[_0xffea('0x15')](_0x474a81);}return null;};}function patchUpdates(_0x639946){return function(_0x34202a){try{jsonpatch['apply'](_0x34202a,_0x639946,!![]);}catch(_0x2053ba){return BPromise['reject'](_0x2053ba);}return _0x34202a[_0xffea('0x1b')]();};}function saveUpdates(_0x40f995,_0x30d57c){return function(_0x39f0dd){if(_0x39f0dd){return _0x39f0dd[_0xffea('0x1c')](_0x40f995)[_0xffea('0x1d')](function(_0x476c9f){return _0x476c9f;});}return null;};}function removeEntity(_0x16e964,_0x4ea6b6){return function(_0x1d7fba){if(_0x1d7fba){return _0x1d7fba[_0xffea('0x1e')]()[_0xffea('0x1d')](function(){_0x16e964[_0xffea('0x14')](0xcc)[_0xffea('0x13')]();});}};}function handleEntityNotFound(_0xca9090,_0x532c6b){return function(_0x502e0d){if(!_0x502e0d){_0xca9090[_0xffea('0x1f')](0x194);}return _0x502e0d;};}function handleError(_0x581457,_0xa571f6){_0xa571f6=_0xa571f6||0x1f4;return function(_0x396bfe){logger['error'](_0x396bfe['stack']);if(_0x396bfe[_0xffea('0x20')]){delete _0x396bfe['name'];}_0x581457[_0xffea('0x14')](_0xa571f6)[_0xffea('0x21')](_0x396bfe);};}exports[_0xffea('0x22')]=function(_0x1caf87,_0x293e6a){var _0x30166f={},_0x5aa024={},_0x558e67={'count':0x0,'rows':[]};var _0xd147fa=_[_0xffea('0x23')](db[_0xffea('0x24')][_0xffea('0x25')],function(_0x2054f8){return{'name':_0x2054f8[_0xffea('0x26')],'type':_0x2054f8[_0xffea('0x27')]['key']};});_0x5aa024[_0xffea('0x28')]=_[_0xffea('0x23')](_0xd147fa,'name');_0x5aa024['query']=_[_0xffea('0x29')](_0x1caf87[_0xffea('0x2a')]);_0x5aa024['filters']=_[_0xffea('0x2b')](_0x5aa024[_0xffea('0x28')],_0x5aa024['query']);_0x30166f[_0xffea('0x2c')]=_['intersection'](_0x5aa024['model'],qs[_0xffea('0x2d')](_0x1caf87['query'][_0xffea('0x2d')]));_0x30166f[_0xffea('0x2c')]=_0x30166f['attributes'][_0xffea('0x2e')]?_0x30166f['attributes']:_0x5aa024[_0xffea('0x28')];if(!_0x1caf87[_0xffea('0x2a')][_0xffea('0x2f')](_0xffea('0x30'))){_0x30166f['limit']=qs[_0xffea('0x18')](_0x1caf87[_0xffea('0x2a')][_0xffea('0x18')]);_0x30166f[_0xffea('0x16')]=qs[_0xffea('0x16')](_0x1caf87[_0xffea('0x2a')][_0xffea('0x16')]);}_0x30166f[_0xffea('0x31')]=qs[_0xffea('0x32')](_0x1caf87['query'][_0xffea('0x32')]);_0x30166f[_0xffea('0x33')]=qs['filters'](_[_0xffea('0x34')](_0x1caf87[_0xffea('0x2a')],_0x5aa024[_0xffea('0x35')]),_0xd147fa);if(_0x1caf87[_0xffea('0x2a')]['filter']){_0x30166f[_0xffea('0x33')]=_[_0xffea('0x36')](_0x30166f[_0xffea('0x33')],{'$or':_[_0xffea('0x23')](_0xd147fa,function(_0x545386){if(_0x545386[_0xffea('0x27')]!==_0xffea('0x37')){var _0x528bf8={};_0x528bf8[_0x545386['name']]={'$like':'%'+_0x1caf87[_0xffea('0x2a')][_0xffea('0x38')]+'%'};return _0x528bf8;}})});}_0x30166f=_['merge']({},_0x30166f,_0x1caf87['options']);var _0x338fd0={'where':_0x30166f['where']};return db[_0xffea('0x24')][_0xffea('0x19')](_0x338fd0)[_0xffea('0x1d')](function(_0x3479c0){_0x558e67[_0xffea('0x19')]=_0x3479c0;if(_0x1caf87[_0xffea('0x2a')]['includeAll']){_0x30166f[_0xffea('0x39')]=[{'all':!![]}];}return db['MailTransferReport'][_0xffea('0x3a')](_0x30166f);})[_0xffea('0x1d')](function(_0x23ffee){_0x558e67[_0xffea('0x3b')]=_0x23ffee;return _0x558e67;})['then'](respondWithFilteredResult(_0x293e6a,_0x30166f))['catch'](handleError(_0x293e6a,null));};exports[_0xffea('0x3c')]=function(_0x1b811a,_0x43ad26){var _0x564b63={'raw':!![],'where':{'id':_0x1b811a[_0xffea('0x3d')]['id']}},_0x31e36f={};_0x31e36f[_0xffea('0x28')]=_['keys'](db['MailTransferReport']['rawAttributes']);_0x31e36f[_0xffea('0x2a')]=_[_0xffea('0x29')](_0x1b811a[_0xffea('0x2a')]);_0x31e36f[_0xffea('0x35')]=_[_0xffea('0x2b')](_0x31e36f[_0xffea('0x28')],_0x31e36f[_0xffea('0x2a')]);_0x564b63[_0xffea('0x2c')]=_[_0xffea('0x2b')](_0x31e36f[_0xffea('0x28')],qs['fields'](_0x1b811a[_0xffea('0x2a')][_0xffea('0x2d')]));_0x564b63[_0xffea('0x2c')]=_0x564b63[_0xffea('0x2c')][_0xffea('0x2e')]?_0x564b63['attributes']:_0x31e36f['model'];if(_0x1b811a[_0xffea('0x2a')][_0xffea('0x3e')]){_0x564b63[_0xffea('0x39')]=[{'all':!![]}];}_0x564b63=_[_0xffea('0x36')]({},_0x564b63,_0x1b811a[_0xffea('0x3f')]);return db[_0xffea('0x24')][_0xffea('0x40')](_0x564b63)['then'](handleEntityNotFound(_0x43ad26,null))['then'](respondWithResult(_0x43ad26,null))[_0xffea('0x41')](handleError(_0x43ad26,null));};exports[_0xffea('0x42')]=function(_0x9edcbb,_0x17213b){return db['MailTransferReport']['create'](_0x9edcbb['body'],{})['then'](respondWithResult(_0x17213b,0xc9))[_0xffea('0x41')](handleError(_0x17213b,null));};exports['update']=function(_0x46a0b2,_0x36e8f5){if(_0x46a0b2['body']['id']){delete _0x46a0b2[_0xffea('0x43')]['id'];}return db['MailTransferReport'][_0xffea('0x40')]({'where':{'id':_0x46a0b2['params']['id']}})[_0xffea('0x1d')](handleEntityNotFound(_0x36e8f5,null))[_0xffea('0x1d')](saveUpdates(_0x46a0b2['body'],null))['then'](respondWithResult(_0x36e8f5,null))[_0xffea('0x41')](handleError(_0x36e8f5,null));};exports[_0xffea('0x1e')]=function(_0x4abae7,_0x5bb232){return db['MailTransferReport'][_0xffea('0x40')]({'where':{'id':_0x4abae7[_0xffea('0x3d')]['id']}})[_0xffea('0x1d')](handleEntityNotFound(_0x5bb232,null))['then'](removeEntity(_0x5bb232,null))[_0xffea('0x41')](handleError(_0x5bb232,null));};exports[_0xffea('0x44')]=function(_0x87f951,_0x1e778f){return db['MailTransferReport'][_0xffea('0x44')]()[_0xffea('0x1d')](respondWithResult(_0x1e778f,null))[_0xffea('0x41')](handleError(_0x1e778f,null));}; \ No newline at end of file +var _0x03f1=['count','set','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','MailTransferReport','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','pick','where','filter','merge','options','includeAll','include','rows','catch','intersection','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0xb481b0,_0xe6114a){var _0x3cb51c=function(_0x3b88ff){while(--_0x3b88ff){_0xb481b0['push'](_0xb481b0['shift']());}};_0x3cb51c(++_0xe6114a);}(_0x03f1,0x151));var _0x103f=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x03f1[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x103f('0x0'));var rimraf=require(_0x103f('0x1'));var zipdir=require(_0x103f('0x2'));var jsonpatch=require(_0x103f('0x3'));var rp=require(_0x103f('0x4'));var moment=require(_0x103f('0x5'));var BPromise=require(_0x103f('0x6'));var Mustache=require(_0x103f('0x7'));var util=require('util');var path=require(_0x103f('0x8'));var sox=require('sox');var csv=require(_0x103f('0x9'));var ejs=require(_0x103f('0xa'));var fs=require('fs');var fs_extra=require(_0x103f('0xb'));var _=require(_0x103f('0xc'));var squel=require(_0x103f('0xd'));var crypto=require('crypto');var jsforce=require(_0x103f('0xe'));var deskjs=require(_0x103f('0xf'));var toCsv=require(_0x103f('0x9'));var querystring=require(_0x103f('0x10'));var Papa=require('papaparse');var Redis=require(_0x103f('0x11'));var authService=require(_0x103f('0x12'));var qs=require(_0x103f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x103f('0x14'));var logger=require(_0x103f('0x15'))(_0x103f('0x16'));var utils=require(_0x103f('0x17'));var config=require(_0x103f('0x18'));var licenseUtil=require(_0x103f('0x19'));var db=require(_0x103f('0x1a'))['db'];function respondWithStatusCode(_0x2f834d,_0x151fd5){_0x151fd5=_0x151fd5||0xcc;return function(_0x24ce5e){if(_0x24ce5e){return _0x2f834d['sendStatus'](_0x151fd5);}return _0x2f834d[_0x103f('0x1b')](_0x151fd5)[_0x103f('0x1c')]();};}function respondWithResult(_0x38c10c,_0x12e771){_0x12e771=_0x12e771||0xc8;return function(_0x15cf66){if(_0x15cf66){return _0x38c10c[_0x103f('0x1b')](_0x12e771)[_0x103f('0x1d')](_0x15cf66);}};}function respondWithFilteredResult(_0x119d9e,_0x5cde1c){return function(_0x3eb547){if(_0x3eb547){var _0x508801=typeof _0x5cde1c[_0x103f('0x1e')]===_0x103f('0x1f')&&typeof _0x5cde1c[_0x103f('0x20')]===_0x103f('0x1f');var _0x38f769=_0x3eb547[_0x103f('0x21')];var _0x544542=_0x508801?0x0:_0x5cde1c[_0x103f('0x1e')];var _0x59e93e=_0x508801?_0x3eb547['count']:_0x5cde1c[_0x103f('0x1e')]+_0x5cde1c[_0x103f('0x20')];var _0x54a827;if(_0x59e93e>=_0x38f769){_0x59e93e=_0x38f769;_0x54a827=0xc8;}else{_0x54a827=0xce;}_0x119d9e[_0x103f('0x1b')](_0x54a827);return _0x119d9e[_0x103f('0x22')]('Content-Range',_0x544542+'-'+_0x59e93e+'/'+_0x38f769)[_0x103f('0x1d')](_0x3eb547);}return null;};}function patchUpdates(_0x322ee6){return function(_0x326a1c){try{jsonpatch[_0x103f('0x23')](_0x326a1c,_0x322ee6,!![]);}catch(_0x474786){return BPromise[_0x103f('0x24')](_0x474786);}return _0x326a1c[_0x103f('0x25')]();};}function saveUpdates(_0x10981e,_0x405007){return function(_0x4912a5){if(_0x4912a5){return _0x4912a5[_0x103f('0x26')](_0x10981e)[_0x103f('0x27')](function(_0x4d27cd){return _0x4d27cd;});}return null;};}function removeEntity(_0x615794,_0x1363c9){return function(_0x276d84){if(_0x276d84){return _0x276d84['destroy']()[_0x103f('0x27')](function(){_0x615794['status'](0xcc)[_0x103f('0x1c')]();});}};}function handleEntityNotFound(_0x274eb5,_0x4f20b0){return function(_0x50495d){if(!_0x50495d){_0x274eb5[_0x103f('0x28')](0x194);}return _0x50495d;};}function handleError(_0xe24283,_0x5e40ef){_0x5e40ef=_0x5e40ef||0x1f4;return function(_0x5c9aa5){logger[_0x103f('0x29')](_0x5c9aa5[_0x103f('0x2a')]);if(_0x5c9aa5[_0x103f('0x2b')]){delete _0x5c9aa5[_0x103f('0x2b')];}_0xe24283[_0x103f('0x1b')](_0x5e40ef)['send'](_0x5c9aa5);};}exports[_0x103f('0x2c')]=function(_0xeabd1e,_0x66e0dd){var _0x4577e9={},_0x4c8380={},_0x202e10={'count':0x0,'rows':[]};var _0x45165f=_[_0x103f('0x2d')](db[_0x103f('0x2e')]['rawAttributes'],function(_0x1fd836){return{'name':_0x1fd836[_0x103f('0x2f')],'type':_0x1fd836[_0x103f('0x30')][_0x103f('0x31')]};});_0x4c8380[_0x103f('0x32')]=_[_0x103f('0x2d')](_0x45165f,_0x103f('0x2b'));_0x4c8380[_0x103f('0x33')]=_[_0x103f('0x34')](_0xeabd1e[_0x103f('0x33')]);_0x4c8380[_0x103f('0x35')]=_['intersection'](_0x4c8380[_0x103f('0x32')],_0x4c8380['query']);_0x4577e9[_0x103f('0x36')]=_['intersection'](_0x4c8380[_0x103f('0x32')],qs['fields'](_0xeabd1e[_0x103f('0x33')][_0x103f('0x37')]));_0x4577e9[_0x103f('0x36')]=_0x4577e9[_0x103f('0x36')][_0x103f('0x38')]?_0x4577e9['attributes']:_0x4c8380['model'];if(!_0xeabd1e['query'][_0x103f('0x39')]('nolimit')){_0x4577e9['limit']=qs[_0x103f('0x20')](_0xeabd1e[_0x103f('0x33')][_0x103f('0x20')]);_0x4577e9[_0x103f('0x1e')]=qs['offset'](_0xeabd1e[_0x103f('0x33')][_0x103f('0x1e')]);}_0x4577e9['order']=qs[_0x103f('0x3a')](_0xeabd1e['query'][_0x103f('0x3a')]);_0x4577e9['where']=qs[_0x103f('0x35')](_[_0x103f('0x3b')](_0xeabd1e[_0x103f('0x33')],_0x4c8380[_0x103f('0x35')]),_0x45165f);if(_0xeabd1e[_0x103f('0x33')]['filter']){_0x4577e9[_0x103f('0x3c')]=_['merge'](_0x4577e9['where'],{'$or':_[_0x103f('0x2d')](_0x45165f,function(_0x2f5d9c){if(_0x2f5d9c[_0x103f('0x30')]!=='VIRTUAL'){var _0x2e601d={};_0x2e601d[_0x2f5d9c[_0x103f('0x2b')]]={'$like':'%'+_0xeabd1e['query'][_0x103f('0x3d')]+'%'};return _0x2e601d;}})});}_0x4577e9=_[_0x103f('0x3e')]({},_0x4577e9,_0xeabd1e[_0x103f('0x3f')]);var _0x38eadf={'where':_0x4577e9[_0x103f('0x3c')]};return db[_0x103f('0x2e')][_0x103f('0x21')](_0x38eadf)[_0x103f('0x27')](function(_0x1ab573){_0x202e10['count']=_0x1ab573;if(_0xeabd1e[_0x103f('0x33')][_0x103f('0x40')]){_0x4577e9[_0x103f('0x41')]=[{'all':!![]}];}return db[_0x103f('0x2e')]['findAll'](_0x4577e9);})[_0x103f('0x27')](function(_0x18b18b){_0x202e10[_0x103f('0x42')]=_0x18b18b;return _0x202e10;})['then'](respondWithFilteredResult(_0x66e0dd,_0x4577e9))[_0x103f('0x43')](handleError(_0x66e0dd,null));};exports['show']=function(_0x39ecb2,_0x4ca2e7){var _0x496d08={'raw':!![],'where':{'id':_0x39ecb2['params']['id']}},_0x19142b={};_0x19142b[_0x103f('0x32')]=_[_0x103f('0x34')](db[_0x103f('0x2e')]['rawAttributes']);_0x19142b[_0x103f('0x33')]=_[_0x103f('0x34')](_0x39ecb2[_0x103f('0x33')]);_0x19142b['filters']=_[_0x103f('0x44')](_0x19142b[_0x103f('0x32')],_0x19142b[_0x103f('0x33')]);_0x496d08['attributes']=_[_0x103f('0x44')](_0x19142b['model'],qs['fields'](_0x39ecb2['query'][_0x103f('0x37')]));_0x496d08['attributes']=_0x496d08[_0x103f('0x36')][_0x103f('0x38')]?_0x496d08[_0x103f('0x36')]:_0x19142b[_0x103f('0x32')];if(_0x39ecb2[_0x103f('0x33')][_0x103f('0x40')]){_0x496d08[_0x103f('0x41')]=[{'all':!![]}];}_0x496d08=_[_0x103f('0x3e')]({},_0x496d08,_0x39ecb2[_0x103f('0x3f')]);return db[_0x103f('0x2e')][_0x103f('0x45')](_0x496d08)['then'](handleEntityNotFound(_0x4ca2e7,null))[_0x103f('0x27')](respondWithResult(_0x4ca2e7,null))[_0x103f('0x43')](handleError(_0x4ca2e7,null));};exports[_0x103f('0x46')]=function(_0x5d6537,_0x5be0a7){return db[_0x103f('0x2e')][_0x103f('0x46')](_0x5d6537[_0x103f('0x47')],{})[_0x103f('0x27')](respondWithResult(_0x5be0a7,0xc9))[_0x103f('0x43')](handleError(_0x5be0a7,null));};exports[_0x103f('0x26')]=function(_0x293286,_0x22d4dc){if(_0x293286[_0x103f('0x47')]['id']){delete _0x293286[_0x103f('0x47')]['id'];}return db[_0x103f('0x2e')][_0x103f('0x45')]({'where':{'id':_0x293286['params']['id']}})['then'](handleEntityNotFound(_0x22d4dc,null))['then'](saveUpdates(_0x293286[_0x103f('0x47')],null))[_0x103f('0x27')](respondWithResult(_0x22d4dc,null))[_0x103f('0x43')](handleError(_0x22d4dc,null));};exports['destroy']=function(_0x4f4fc4,_0x30aa89){return db[_0x103f('0x2e')]['find']({'where':{'id':_0x4f4fc4[_0x103f('0x48')]['id']}})[_0x103f('0x27')](handleEntityNotFound(_0x30aa89,null))[_0x103f('0x27')](removeEntity(_0x30aa89,null))['catch'](handleError(_0x30aa89,null));};exports['describe']=function(_0x3b25b7,_0x3e7ea8){return db[_0x103f('0x2e')][_0x103f('0x49')]()[_0x103f('0x27')](respondWithResult(_0x3e7ea8,null))[_0x103f('0x43')](handleError(_0x3e7ea8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index aa0873f..b7b414c 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 _0x3b0a=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x1008f0,_0x1d32bb){var _0x423ac5=function(_0x25b44d){while(--_0x25b44d){_0x1008f0['push'](_0x1008f0['shift']());}};_0x423ac5(++_0x1d32bb);}(_0x3b0a,0xa9));var _0xa3b0=function(_0x121652,_0x35ccd9){_0x121652=_0x121652-0x0;var _0x4469d9=_0x3b0a[_0x121652];return _0x4469d9;};'use strict';var _=require('lodash');var util=require(_0xa3b0('0x0'));var logger=require(_0xa3b0('0x1'))(_0xa3b0('0x2'));var moment=require(_0xa3b0('0x3'));var BPromise=require(_0xa3b0('0x4'));var rp=require(_0xa3b0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3b0('0x6'));var config=require(_0xa3b0('0x7'));var attributes=require(_0xa3b0('0x8'));module['exports']=function(_0x29863f,_0x4446db){return _0x29863f[_0xa3b0('0x9')](_0xa3b0('0xa'),attributes,{'tableName':_0xa3b0('0xb'),'paranoid':![],'indexes':[{'name':_0xa3b0('0xc'),'fields':[_0xa3b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f19=['MailTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x8f19,0x161));var _0x98f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x98f1('0x0'));var util=require(_0x98f1('0x1'));var logger=require('../../config/logger')(_0x98f1('0x2'));var moment=require(_0x98f1('0x3'));var BPromise=require(_0x98f1('0x4'));var rp=require(_0x98f1('0x5'));var fs=require('fs');var path=require(_0x98f1('0x6'));var rimraf=require(_0x98f1('0x7'));var config=require(_0x98f1('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x98f1('0x9')]=function(_0x330612,_0x1d204a){return _0x330612[_0x98f1('0xa')](_0x98f1('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x98f1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 2c385c7..f6b0ef6 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 _0x3629=['error','code','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x3629,0x1a8));var _0x9362=function(_0x5d28a3,_0x39fbb5){_0x5d28a3=_0x5d28a3-0x0;var _0x4141f2=_0x3629[_0x5d28a3];return _0x4141f2;};'use strict';var _=require(_0x9362('0x0'));var util=require('util');var moment=require(_0x9362('0x1'));var BPromise=require('bluebird');var rs=require(_0x9362('0x2'));var fs=require('fs');var Redis=require(_0x9362('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9362('0x4'));var logger=require(_0x9362('0x5'))(_0x9362('0x6'));var config=require(_0x9362('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9362('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x322218,_0x424e63,_0x56f686){return new BPromise(function(_0x40f9b0,_0x5c1c57){return client[_0x9362('0x9')](_0x322218,_0x56f686)[_0x9362('0xa')](function(_0x2338a0){logger[_0x9362('0xb')](_0x9362('0xc'),_0x424e63,'request\x20sent');logger[_0x9362('0xd')](_0x9362('0xe'),_0x424e63,'request\x20sent',JSON[_0x9362('0xf')](_0x2338a0));if(_0x2338a0['error']){if(_0x2338a0[_0x9362('0x10')][_0x9362('0x11')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x424e63,_0x2338a0['error'][_0x9362('0x12')]);return _0x5c1c57(_0x2338a0['error'][_0x9362('0x12')]);}logger[_0x9362('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x424e63,_0x2338a0[_0x9362('0x10')][_0x9362('0x12')]);return _0x40f9b0(_0x2338a0['error'][_0x9362('0x12')]);}else{logger[_0x9362('0xb')](_0x9362('0xc'),_0x424e63,_0x9362('0x13'));_0x40f9b0(_0x2338a0[_0x9362('0x14')]['message']);}})[_0x9362('0x15')](function(_0x146abd){logger['error'](_0x9362('0xc'),_0x424e63,_0x146abd);_0x5c1c57(_0x146abd);});});} \ No newline at end of file +var _0xf0fd=['error','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xf0fd,0x192));var _0xdf0f=function(_0x347b9a,_0x2e5277){_0x347b9a=_0x347b9a-0x0;var _0x1918f3=_0xf0fd[_0x347b9a];return _0x1918f3;};'use strict';var _=require(_0xdf0f('0x0'));var util=require(_0xdf0f('0x1'));var moment=require('moment');var BPromise=require(_0xdf0f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf0f('0x3'))['db'];var utils=require(_0xdf0f('0x4'));var logger=require('../../config/logger')(_0xdf0f('0x5'));var config=require('../../config/environment');var jayson=require(_0xdf0f('0x6'));var client=jayson[_0xdf0f('0x7')][_0xdf0f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bec3f,_0xfd769,_0x27f54b){return new BPromise(function(_0x154399,_0x5a5d40){return client[_0xdf0f('0x9')](_0x4bec3f,_0x27f54b)[_0xdf0f('0xa')](function(_0x61c940){logger[_0xdf0f('0xb')](_0xdf0f('0xc'),_0xfd769,_0xdf0f('0xd'));logger[_0xdf0f('0xe')](_0xdf0f('0xf'),_0xfd769,_0xdf0f('0xd'),JSON['stringify'](_0x61c940));if(_0x61c940[_0xdf0f('0x10')]){if(_0x61c940['error']['code']===0x1f4){logger['error'](_0xdf0f('0xc'),_0xfd769,_0x61c940[_0xdf0f('0x10')][_0xdf0f('0x11')]);return _0x5a5d40(_0x61c940[_0xdf0f('0x10')]['message']);}logger['error'](_0xdf0f('0xc'),_0xfd769,_0x61c940['error'][_0xdf0f('0x11')]);return _0x154399(_0x61c940[_0xdf0f('0x10')][_0xdf0f('0x11')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0xfd769,_0xdf0f('0xd'));_0x154399(_0x61c940['result'][_0xdf0f('0x11')]);}})[_0xdf0f('0x12')](function(_0x4ac96f){logger['error'](_0xdf0f('0xc'),_0xfd769,_0x4ac96f);_0x5a5d40(_0x4ac96f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9f566b7..02ee7f2 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 _0x741a=['put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4c1d95,_0x5879a6){var _0x2c1b32=function(_0x4003c3){while(--_0x4003c3){_0x4c1d95['push'](_0x4c1d95['shift']());}};_0x2c1b32(++_0x5879a6);}(_0x741a,0x7b));var _0xa741=function(_0x1cf164,_0x787a72){_0x1cf164=_0x1cf164-0x0;var _0x122c73=_0x741a[_0x1cf164];return _0x122c73;};'use strict';var multer=require(_0xa741('0x0'));var util=require(_0xa741('0x1'));var path=require(_0xa741('0x2'));var timeout=require(_0xa741('0x3'));var express=require('express');var router=express[_0xa741('0x4')]();var fs_extra=require(_0xa741('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa741('0x6'));router[_0xa741('0x7')]('/',auth[_0xa741('0x8')](),controller[_0xa741('0x9')]);router[_0xa741('0x7')](_0xa741('0xa'),auth[_0xa741('0x8')](),controller[_0xa741('0xb')]);router[_0xa741('0x7')](_0xa741('0xc'),auth[_0xa741('0x8')](),controller['show']);router['post']('/',auth[_0xa741('0x8')](),controller['create']);router[_0xa741('0xd')](_0xa741('0xc'),auth[_0xa741('0x8')](),controller[_0xa741('0xe')]);router[_0xa741('0xf')]('/:id',auth[_0xa741('0x8')](),controller[_0xa741('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd819=['create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xd819,0x181));var _0x9d81=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0xd819[_0x34bc94];return _0xee41e7;};'use strict';var multer=require('multer');var util=require(_0x9d81('0x0'));var path=require(_0x9d81('0x1'));var timeout=require(_0x9d81('0x2'));var express=require(_0x9d81('0x3'));var router=express['Router']();var fs_extra=require(_0x9d81('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9d81('0x5'));var config=require('../../config/environment');var controller=require(_0x9d81('0x6'));router[_0x9d81('0x7')]('/',auth[_0x9d81('0x8')](),controller['index']);router[_0x9d81('0x7')](_0x9d81('0x9'),auth[_0x9d81('0x8')](),controller[_0x9d81('0xa')]);router[_0x9d81('0x7')](_0x9d81('0xb'),auth[_0x9d81('0x8')](),controller[_0x9d81('0xc')]);router[_0x9d81('0xd')]('/',auth[_0x9d81('0x8')](),controller[_0x9d81('0xe')]);router[_0x9d81('0xf')](_0x9d81('0xb'),auth[_0x9d81('0x8')](),controller['update']);router[_0x9d81('0x10')](_0x9d81('0xb'),auth['isAuthenticated'](),controller[_0x9d81('0x11')]);module[_0x9d81('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ab1b8c3..c6464f7 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 _0xcd0d=['exitAt','duration','talk:[start]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0x2183bb,_0x582b4f){var _0x501e49=function(_0x52761d){while(--_0x52761d){_0x2183bb['push'](_0x2183bb['shift']());}};_0x501e49(++_0x582b4f);}(_0xcd0d,0x17a));var _0xdcd0=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xcd0d[_0x28d18d];return _0x470640;};'use strict';var Sequelize=require(_0xdcd0('0x0'));var moment=require(_0xdcd0('0x1'));module[_0xdcd0('0x2')]={'channel':{'type':Sequelize[_0xdcd0('0x3')]},'membername':{'type':Sequelize[_0xdcd0('0x3')]},'interface':{'type':Sequelize[_0xdcd0('0x3')]},'type':{'type':Sequelize[_0xdcd0('0x3')],'defaultValue':_0xdcd0('0x4'),'comment':_0xdcd0('0x5')},'duration':{'type':Sequelize[_0xdcd0('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdcd0('0x7')],'set':function(_0x60ef6c){var _0x3442ae=moment(_0x60ef6c);var _0x47f2d6=moment(this[_0xdcd0('0x8')](_0xdcd0('0x9')));var _0x3b9937=_0x3442ae[_0xdcd0('0xa')](_0x47f2d6,_0xdcd0('0xb'));this[_0xdcd0('0xc')](_0xdcd0('0xd'),_0x60ef6c);this[_0xdcd0('0xc')](_0xdcd0('0xe'),_0x3b9937||null);}},'data1':{'type':Sequelize[_0xdcd0('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xdcd0('0x3')],'comment':_0xdcd0('0xf')},'data3':{'type':Sequelize[_0xdcd0('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xdcd0('0x3')],'comment':_0xdcd0('0x10')},'data5':{'type':Sequelize[_0xdcd0('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xdcd0('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xdcd0('0x3')]}}; \ No newline at end of file +var _0x030b=['LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x1b562a,_0x229e6e){var _0x493b59=function(_0xa3c2de){while(--_0xa3c2de){_0x1b562a['push'](_0x1b562a['shift']());}};_0x493b59(++_0x229e6e);}(_0x030b,0x13c));var _0xb030=function(_0x4b6421,_0x4d4b1f){_0x4b6421=_0x4b6421-0x0;var _0x56ddd4=_0x030b[_0x4b6421];return _0x56ddd4;};'use strict';var Sequelize=require(_0xb030('0x0'));var moment=require('moment');module[_0xb030('0x1')]={'channel':{'type':Sequelize[_0xb030('0x2')]},'membername':{'type':Sequelize[_0xb030('0x2')]},'interface':{'type':Sequelize[_0xb030('0x2')]},'type':{'type':Sequelize[_0xb030('0x2')],'defaultValue':_0xb030('0x3'),'comment':_0xb030('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb030('0x5')],'set':function(_0x2e2141){var _0x5ef232=moment(_0x2e2141);var _0x589987=moment(this[_0xb030('0x6')](_0xb030('0x7')));var _0x576a47=_0x5ef232['diff'](_0x589987,'seconds');this[_0xb030('0x8')](_0xb030('0x9'),_0x2e2141);this[_0xb030('0x8')](_0xb030('0xa'),_0x576a47||null);}},'data1':{'type':Sequelize[_0xb030('0x2')],'comment':_0xb030('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xb030('0xc')},'data3':{'type':Sequelize[_0xb030('0x2')],'comment':_0xb030('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0xb030('0xe')},'data5':{'type':Sequelize[_0xb030('0x2')],'comment':_0xb030('0xf')},'role':{'type':Sequelize[_0xb030('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1c8951a..0ab85d9 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 _0xec73=['end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','fieldName','query','keys','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','attributes','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x901f26,_0x3d7dd4){var _0x378315=function(_0x205bfe){while(--_0x205bfe){_0x901f26['push'](_0x901f26['shift']());}};_0x378315(++_0x3d7dd4);}(_0xec73,0xc3));var _0x3ec7=function(_0x3cf261,_0x578763){_0x3cf261=_0x3cf261-0x0;var _0x174f87=_0xec73[_0x3cf261];return _0x174f87;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ec7('0x0'));var zipdir=require(_0x3ec7('0x1'));var jsonpatch=require(_0x3ec7('0x2'));var rp=require(_0x3ec7('0x3'));var moment=require(_0x3ec7('0x4'));var BPromise=require(_0x3ec7('0x5'));var Mustache=require('mustache');var util=require(_0x3ec7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3ec7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ec7('0x8'));var squel=require(_0x3ec7('0x9'));var crypto=require(_0x3ec7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3ec7('0xb'));var toCsv=require(_0x3ec7('0x7'));var querystring=require(_0x3ec7('0xc'));var Papa=require(_0x3ec7('0xd'));var Redis=require(_0x3ec7('0xe'));var authService=require(_0x3ec7('0xf'));var qs=require(_0x3ec7('0x10'));var as=require(_0x3ec7('0x11'));var hardwareService=require(_0x3ec7('0x12'));var logger=require('../../config/logger')(_0x3ec7('0x13'));var utils=require(_0x3ec7('0x14'));var config=require(_0x3ec7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d65f8,_0x387bb2){_0x387bb2=_0x387bb2||0xcc;return function(_0x50030c){if(_0x50030c){return _0x3d65f8[_0x3ec7('0x16')](_0x387bb2);}return _0x3d65f8[_0x3ec7('0x17')](_0x387bb2)[_0x3ec7('0x18')]();};}function respondWithResult(_0x54cb92,_0x5004fb){_0x5004fb=_0x5004fb||0xc8;return function(_0x108142){if(_0x108142){return _0x54cb92[_0x3ec7('0x17')](_0x5004fb)['json'](_0x108142);}};}function respondWithFilteredResult(_0x4bc919,_0xdf6dff){return function(_0x5b882d){if(_0x5b882d){var _0x13f812=typeof _0xdf6dff[_0x3ec7('0x19')]==='undefined'&&typeof _0xdf6dff[_0x3ec7('0x1a')]===_0x3ec7('0x1b');var _0x25f746=_0x5b882d[_0x3ec7('0x1c')];var _0x5b0d7d=_0x13f812?0x0:_0xdf6dff[_0x3ec7('0x19')];var _0x2f73e2=_0x13f812?_0x5b882d[_0x3ec7('0x1c')]:_0xdf6dff['offset']+_0xdf6dff['limit'];var _0x24323a;if(_0x2f73e2>=_0x25f746){_0x2f73e2=_0x25f746;_0x24323a=0xc8;}else{_0x24323a=0xce;}_0x4bc919[_0x3ec7('0x17')](_0x24323a);return _0x4bc919['set'](_0x3ec7('0x1d'),_0x5b0d7d+'-'+_0x2f73e2+'/'+_0x25f746)[_0x3ec7('0x1e')](_0x5b882d);}return null;};}function patchUpdates(_0x5f3333){return function(_0x20a3a5){try{jsonpatch['apply'](_0x20a3a5,_0x5f3333,!![]);}catch(_0x14a7f7){return BPromise[_0x3ec7('0x1f')](_0x14a7f7);}return _0x20a3a5[_0x3ec7('0x20')]();};}function saveUpdates(_0x4a7b5d,_0x56382a){return function(_0x2dd7f5){if(_0x2dd7f5){return _0x2dd7f5[_0x3ec7('0x21')](_0x4a7b5d)[_0x3ec7('0x22')](function(_0x45771c){return _0x45771c;});}return null;};}function removeEntity(_0x252f54,_0x486019){return function(_0x479b83){if(_0x479b83){return _0x479b83[_0x3ec7('0x23')]()[_0x3ec7('0x22')](function(){_0x252f54[_0x3ec7('0x17')](0xcc)[_0x3ec7('0x18')]();});}};}function handleEntityNotFound(_0x346322,_0x18c0ac){return function(_0x36c7cb){if(!_0x36c7cb){_0x346322['sendStatus'](0x194);}return _0x36c7cb;};}function handleError(_0x101c52,_0xdfed88){_0xdfed88=_0xdfed88||0x1f4;return function(_0x227bc8){logger[_0x3ec7('0x24')](_0x227bc8[_0x3ec7('0x25')]);if(_0x227bc8[_0x3ec7('0x26')]){delete _0x227bc8[_0x3ec7('0x26')];}_0x101c52[_0x3ec7('0x17')](_0xdfed88)[_0x3ec7('0x27')](_0x227bc8);};}exports[_0x3ec7('0x28')]=function(_0x5df47c,_0x56ed6e){var _0x56ee89={},_0xadf37c={},_0x393f5a={'count':0x0,'rows':[]};var _0x2aec35=_[_0x3ec7('0x29')](db[_0x3ec7('0x2a')]['rawAttributes'],function(_0x45dd75){return{'name':_0x45dd75[_0x3ec7('0x2b')],'type':_0x45dd75['type']['key']};});_0xadf37c['model']=_[_0x3ec7('0x29')](_0x2aec35,_0x3ec7('0x26'));_0xadf37c[_0x3ec7('0x2c')]=_[_0x3ec7('0x2d')](_0x5df47c[_0x3ec7('0x2c')]);_0xadf37c[_0x3ec7('0x2e')]=_[_0x3ec7('0x2f')](_0xadf37c[_0x3ec7('0x30')],_0xadf37c[_0x3ec7('0x2c')]);_0x56ee89['attributes']=_['intersection'](_0xadf37c[_0x3ec7('0x30')],qs[_0x3ec7('0x31')](_0x5df47c['query'][_0x3ec7('0x31')]));_0x56ee89['attributes']=_0x56ee89['attributes'][_0x3ec7('0x32')]?_0x56ee89['attributes']:_0xadf37c[_0x3ec7('0x30')];if(!_0x5df47c[_0x3ec7('0x2c')][_0x3ec7('0x33')](_0x3ec7('0x34'))){_0x56ee89[_0x3ec7('0x1a')]=qs[_0x3ec7('0x1a')](_0x5df47c[_0x3ec7('0x2c')][_0x3ec7('0x1a')]);_0x56ee89[_0x3ec7('0x19')]=qs[_0x3ec7('0x19')](_0x5df47c[_0x3ec7('0x2c')]['offset']);}_0x56ee89[_0x3ec7('0x35')]=qs['sort'](_0x5df47c[_0x3ec7('0x2c')][_0x3ec7('0x36')]);_0x56ee89['where']=qs[_0x3ec7('0x2e')](_['pick'](_0x5df47c['query'],_0xadf37c[_0x3ec7('0x2e')]),_0x2aec35);if(_0x5df47c[_0x3ec7('0x2c')]['filter']){_0x56ee89[_0x3ec7('0x37')]=_[_0x3ec7('0x38')](_0x56ee89[_0x3ec7('0x37')],{'$or':_[_0x3ec7('0x29')](_0x2aec35,function(_0x47a15e){if(_0x47a15e[_0x3ec7('0x39')]!==_0x3ec7('0x3a')){var _0x42cfa5={};_0x42cfa5[_0x47a15e['name']]={'$like':'%'+_0x5df47c['query'][_0x3ec7('0x3b')]+'%'};return _0x42cfa5;}})});}_0x56ee89=_['merge']({},_0x56ee89,_0x5df47c[_0x3ec7('0x3c')]);var _0xf6b417={'where':_0x56ee89[_0x3ec7('0x37')]};return db[_0x3ec7('0x2a')]['count'](_0xf6b417)[_0x3ec7('0x22')](function(_0x3f9feb){_0x393f5a[_0x3ec7('0x1c')]=_0x3f9feb;if(_0x5df47c[_0x3ec7('0x2c')][_0x3ec7('0x3d')]){_0x56ee89['include']=[{'all':!![]}];}return db[_0x3ec7('0x2a')][_0x3ec7('0x3e')](_0x56ee89);})[_0x3ec7('0x22')](function(_0x239564){_0x393f5a[_0x3ec7('0x3f')]=_0x239564;return _0x393f5a;})[_0x3ec7('0x22')](respondWithFilteredResult(_0x56ed6e,_0x56ee89))['catch'](handleError(_0x56ed6e,null));};exports[_0x3ec7('0x40')]=function(_0x186106,_0x34ffd2){var _0x35ae37={'raw':!![],'where':{'id':_0x186106[_0x3ec7('0x41')]['id']}},_0x5886f7={};_0x5886f7['model']=_[_0x3ec7('0x2d')](db[_0x3ec7('0x2a')]['rawAttributes']);_0x5886f7[_0x3ec7('0x2c')]=_[_0x3ec7('0x2d')](_0x186106[_0x3ec7('0x2c')]);_0x5886f7[_0x3ec7('0x2e')]=_[_0x3ec7('0x2f')](_0x5886f7['model'],_0x5886f7[_0x3ec7('0x2c')]);_0x35ae37['attributes']=_['intersection'](_0x5886f7[_0x3ec7('0x30')],qs[_0x3ec7('0x31')](_0x186106[_0x3ec7('0x2c')]['fields']));_0x35ae37[_0x3ec7('0x42')]=_0x35ae37[_0x3ec7('0x42')][_0x3ec7('0x32')]?_0x35ae37[_0x3ec7('0x42')]:_0x5886f7[_0x3ec7('0x30')];if(_0x186106[_0x3ec7('0x2c')][_0x3ec7('0x3d')]){_0x35ae37[_0x3ec7('0x43')]=[{'all':!![]}];}_0x35ae37=_['merge']({},_0x35ae37,_0x186106[_0x3ec7('0x3c')]);return db[_0x3ec7('0x2a')][_0x3ec7('0x44')](_0x35ae37)[_0x3ec7('0x22')](handleEntityNotFound(_0x34ffd2,null))[_0x3ec7('0x22')](respondWithResult(_0x34ffd2,null))[_0x3ec7('0x45')](handleError(_0x34ffd2,null));};exports[_0x3ec7('0x46')]=function(_0x437105,_0x27b226){return db[_0x3ec7('0x2a')][_0x3ec7('0x46')](_0x437105[_0x3ec7('0x47')],{})['then'](respondWithResult(_0x27b226,0xc9))[_0x3ec7('0x45')](handleError(_0x27b226,null));};exports[_0x3ec7('0x21')]=function(_0xa9a0aa,_0x5da1ad){if(_0xa9a0aa[_0x3ec7('0x47')]['id']){delete _0xa9a0aa['body']['id'];}return db[_0x3ec7('0x2a')][_0x3ec7('0x44')]({'where':{'id':_0xa9a0aa[_0x3ec7('0x41')]['id']}})[_0x3ec7('0x22')](handleEntityNotFound(_0x5da1ad,null))['then'](saveUpdates(_0xa9a0aa[_0x3ec7('0x47')],null))[_0x3ec7('0x22')](respondWithResult(_0x5da1ad,null))['catch'](handleError(_0x5da1ad,null));};exports[_0x3ec7('0x23')]=function(_0x2a09ee,_0x1722c7){return db[_0x3ec7('0x2a')][_0x3ec7('0x44')]({'where':{'id':_0x2a09ee[_0x3ec7('0x41')]['id']}})[_0x3ec7('0x22')](handleEntityNotFound(_0x1722c7,null))[_0x3ec7('0x22')](removeEntity(_0x1722c7,null))[_0x3ec7('0x45')](handleError(_0x1722c7,null));};exports[_0x3ec7('0x48')]=function(_0x24f299,_0x56726d){return db[_0x3ec7('0x2a')][_0x3ec7('0x48')]()[_0x3ec7('0x22')](respondWithResult(_0x56726d,null))[_0x3ec7('0x45')](handleError(_0x56726d,null));}; \ No newline at end of file +var _0x70cb=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','send','index','MemberReport','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x70cb,0x16d));var _0xb70c=function(_0x1c437f,_0x26289d){_0x1c437f=_0x1c437f-0x0;var _0x2f7835=_0x70cb[_0x1c437f];return _0x2f7835;};'use strict';var emlformat=require(_0xb70c('0x0'));var rimraf=require(_0xb70c('0x1'));var zipdir=require(_0xb70c('0x2'));var jsonpatch=require(_0xb70c('0x3'));var rp=require(_0xb70c('0x4'));var moment=require(_0xb70c('0x5'));var BPromise=require(_0xb70c('0x6'));var Mustache=require(_0xb70c('0x7'));var util=require(_0xb70c('0x8'));var path=require(_0xb70c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb70c('0xa'));var fs=require('fs');var fs_extra=require(_0xb70c('0xb'));var _=require(_0xb70c('0xc'));var squel=require(_0xb70c('0xd'));var crypto=require(_0xb70c('0xe'));var jsforce=require(_0xb70c('0xf'));var deskjs=require(_0xb70c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb70c('0x11'));var Redis=require(_0xb70c('0x12'));var authService=require(_0xb70c('0x13'));var qs=require(_0xb70c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb70c('0x15'));var logger=require(_0xb70c('0x16'))(_0xb70c('0x17'));var utils=require(_0xb70c('0x18'));var config=require(_0xb70c('0x19'));var licenseUtil=require(_0xb70c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56ecb3,_0x306205){_0x306205=_0x306205||0xcc;return function(_0x2a48a6){if(_0x2a48a6){return _0x56ecb3[_0xb70c('0x1b')](_0x306205);}return _0x56ecb3[_0xb70c('0x1c')](_0x306205)[_0xb70c('0x1d')]();};}function respondWithResult(_0x34af15,_0x16c15a){_0x16c15a=_0x16c15a||0xc8;return function(_0x3afaec){if(_0x3afaec){return _0x34af15[_0xb70c('0x1c')](_0x16c15a)[_0xb70c('0x1e')](_0x3afaec);}};}function respondWithFilteredResult(_0x1aeda3,_0xef8d8c){return function(_0x4bc7c6){if(_0x4bc7c6){var _0x4cd864=typeof _0xef8d8c[_0xb70c('0x1f')]===_0xb70c('0x20')&&typeof _0xef8d8c[_0xb70c('0x21')]===_0xb70c('0x20');var _0xfc8643=_0x4bc7c6[_0xb70c('0x22')];var _0x533635=_0x4cd864?0x0:_0xef8d8c[_0xb70c('0x1f')];var _0x58d9d6=_0x4cd864?_0x4bc7c6[_0xb70c('0x22')]:_0xef8d8c['offset']+_0xef8d8c[_0xb70c('0x21')];var _0x59d697;if(_0x58d9d6>=_0xfc8643){_0x58d9d6=_0xfc8643;_0x59d697=0xc8;}else{_0x59d697=0xce;}_0x1aeda3['status'](_0x59d697);return _0x1aeda3[_0xb70c('0x23')](_0xb70c('0x24'),_0x533635+'-'+_0x58d9d6+'/'+_0xfc8643)[_0xb70c('0x1e')](_0x4bc7c6);}return null;};}function patchUpdates(_0x87616b){return function(_0x2dec45){try{jsonpatch[_0xb70c('0x25')](_0x2dec45,_0x87616b,!![]);}catch(_0x14a7e2){return BPromise[_0xb70c('0x26')](_0x14a7e2);}return _0x2dec45['save']();};}function saveUpdates(_0x5c1ab6,_0xb44926){return function(_0x31676a){if(_0x31676a){return _0x31676a['update'](_0x5c1ab6)['then'](function(_0x20b4b3){return _0x20b4b3;});}return null;};}function removeEntity(_0xd28d,_0xe4f342){return function(_0x4be106){if(_0x4be106){return _0x4be106['destroy']()[_0xb70c('0x27')](function(){_0xd28d[_0xb70c('0x1c')](0xcc)[_0xb70c('0x1d')]();});}};}function handleEntityNotFound(_0x1c9f8c,_0x18cfe4){return function(_0x530c4b){if(!_0x530c4b){_0x1c9f8c['sendStatus'](0x194);}return _0x530c4b;};}function handleError(_0x11435b,_0x5d2515){_0x5d2515=_0x5d2515||0x1f4;return function(_0x219fb8){logger['error'](_0x219fb8[_0xb70c('0x28')]);if(_0x219fb8[_0xb70c('0x29')]){delete _0x219fb8['name'];}_0x11435b[_0xb70c('0x1c')](_0x5d2515)[_0xb70c('0x2a')](_0x219fb8);};}exports[_0xb70c('0x2b')]=function(_0x50ba4b,_0xc521a7){var _0x4bcf82={},_0x53f1fd={},_0x4c0475={'count':0x0,'rows':[]};var _0xda5088=_['map'](db[_0xb70c('0x2c')][_0xb70c('0x2d')],function(_0x3f7bd7){return{'name':_0x3f7bd7[_0xb70c('0x2e')],'type':_0x3f7bd7['type']['key']};});_0x53f1fd[_0xb70c('0x2f')]=_[_0xb70c('0x30')](_0xda5088,_0xb70c('0x29'));_0x53f1fd['query']=_[_0xb70c('0x31')](_0x50ba4b[_0xb70c('0x32')]);_0x53f1fd[_0xb70c('0x33')]=_[_0xb70c('0x34')](_0x53f1fd[_0xb70c('0x2f')],_0x53f1fd[_0xb70c('0x32')]);_0x4bcf82[_0xb70c('0x35')]=_[_0xb70c('0x34')](_0x53f1fd['model'],qs[_0xb70c('0x36')](_0x50ba4b['query'][_0xb70c('0x36')]));_0x4bcf82[_0xb70c('0x35')]=_0x4bcf82[_0xb70c('0x35')][_0xb70c('0x37')]?_0x4bcf82[_0xb70c('0x35')]:_0x53f1fd['model'];if(!_0x50ba4b[_0xb70c('0x32')][_0xb70c('0x38')](_0xb70c('0x39'))){_0x4bcf82[_0xb70c('0x21')]=qs[_0xb70c('0x21')](_0x50ba4b[_0xb70c('0x32')][_0xb70c('0x21')]);_0x4bcf82[_0xb70c('0x1f')]=qs[_0xb70c('0x1f')](_0x50ba4b[_0xb70c('0x32')]['offset']);}_0x4bcf82[_0xb70c('0x3a')]=qs[_0xb70c('0x3b')](_0x50ba4b[_0xb70c('0x32')][_0xb70c('0x3b')]);_0x4bcf82[_0xb70c('0x3c')]=qs[_0xb70c('0x33')](_[_0xb70c('0x3d')](_0x50ba4b[_0xb70c('0x32')],_0x53f1fd[_0xb70c('0x33')]),_0xda5088);if(_0x50ba4b['query'][_0xb70c('0x3e')]){_0x4bcf82['where']=_[_0xb70c('0x3f')](_0x4bcf82[_0xb70c('0x3c')],{'$or':_[_0xb70c('0x30')](_0xda5088,function(_0x405b75){if(_0x405b75['type']!==_0xb70c('0x40')){var _0x33eecd={};_0x33eecd[_0x405b75[_0xb70c('0x29')]]={'$like':'%'+_0x50ba4b[_0xb70c('0x32')][_0xb70c('0x3e')]+'%'};return _0x33eecd;}})});}_0x4bcf82=_['merge']({},_0x4bcf82,_0x50ba4b[_0xb70c('0x41')]);var _0x5587c6={'where':_0x4bcf82[_0xb70c('0x3c')]};return db[_0xb70c('0x2c')][_0xb70c('0x22')](_0x5587c6)[_0xb70c('0x27')](function(_0x2a37c4){_0x4c0475[_0xb70c('0x22')]=_0x2a37c4;if(_0x50ba4b[_0xb70c('0x32')][_0xb70c('0x42')]){_0x4bcf82[_0xb70c('0x43')]=[{'all':!![]}];}return db[_0xb70c('0x2c')]['findAll'](_0x4bcf82);})['then'](function(_0x51ac20){_0x4c0475['rows']=_0x51ac20;return _0x4c0475;})[_0xb70c('0x27')](respondWithFilteredResult(_0xc521a7,_0x4bcf82))[_0xb70c('0x44')](handleError(_0xc521a7,null));};exports[_0xb70c('0x45')]=function(_0x2356eb,_0x1d3293){var _0x49566f={'raw':!![],'where':{'id':_0x2356eb[_0xb70c('0x46')]['id']}},_0x4f9906={};_0x4f9906['model']=_[_0xb70c('0x31')](db[_0xb70c('0x2c')][_0xb70c('0x2d')]);_0x4f9906[_0xb70c('0x32')]=_[_0xb70c('0x31')](_0x2356eb[_0xb70c('0x32')]);_0x4f9906[_0xb70c('0x33')]=_[_0xb70c('0x34')](_0x4f9906[_0xb70c('0x2f')],_0x4f9906[_0xb70c('0x32')]);_0x49566f[_0xb70c('0x35')]=_[_0xb70c('0x34')](_0x4f9906[_0xb70c('0x2f')],qs[_0xb70c('0x36')](_0x2356eb[_0xb70c('0x32')][_0xb70c('0x36')]));_0x49566f[_0xb70c('0x35')]=_0x49566f[_0xb70c('0x35')][_0xb70c('0x37')]?_0x49566f[_0xb70c('0x35')]:_0x4f9906[_0xb70c('0x2f')];if(_0x2356eb['query'][_0xb70c('0x42')]){_0x49566f[_0xb70c('0x43')]=[{'all':!![]}];}_0x49566f=_[_0xb70c('0x3f')]({},_0x49566f,_0x2356eb['options']);return db[_0xb70c('0x2c')][_0xb70c('0x47')](_0x49566f)[_0xb70c('0x27')](handleEntityNotFound(_0x1d3293,null))[_0xb70c('0x27')](respondWithResult(_0x1d3293,null))['catch'](handleError(_0x1d3293,null));};exports[_0xb70c('0x48')]=function(_0x5ed874,_0x32d6c9){return db[_0xb70c('0x2c')]['create'](_0x5ed874['body'],{})[_0xb70c('0x27')](respondWithResult(_0x32d6c9,0xc9))[_0xb70c('0x44')](handleError(_0x32d6c9,null));};exports[_0xb70c('0x49')]=function(_0x47e2cb,_0x3e5e5e){if(_0x47e2cb[_0xb70c('0x4a')]['id']){delete _0x47e2cb['body']['id'];}return db['MemberReport'][_0xb70c('0x47')]({'where':{'id':_0x47e2cb[_0xb70c('0x46')]['id']}})[_0xb70c('0x27')](handleEntityNotFound(_0x3e5e5e,null))[_0xb70c('0x27')](saveUpdates(_0x47e2cb[_0xb70c('0x4a')],null))[_0xb70c('0x27')](respondWithResult(_0x3e5e5e,null))[_0xb70c('0x44')](handleError(_0x3e5e5e,null));};exports['destroy']=function(_0xb653c5,_0x3afc1b){return db['MemberReport'][_0xb70c('0x47')]({'where':{'id':_0xb653c5[_0xb70c('0x46')]['id']}})[_0xb70c('0x27')](handleEntityNotFound(_0x3afc1b,null))['then'](removeEntity(_0x3afc1b,null))[_0xb70c('0x44')](handleError(_0x3afc1b,null));};exports[_0xb70c('0x4b')]=function(_0x1dc811,_0x2165c5){return db[_0xb70c('0x2c')][_0xb70c('0x4b')]()[_0xb70c('0x27')](respondWithResult(_0x2165c5,null))[_0xb70c('0x44')](handleError(_0x2165c5,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d046857..6ec9410 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 _0xc1ad=['request-promise','path','rimraf','../../config/environment','exports','report_member','lodash','moment'];(function(_0x1b384d,_0x495296){var _0x2e1695=function(_0xff8406){while(--_0xff8406){_0x1b384d['push'](_0x1b384d['shift']());}};_0x2e1695(++_0x495296);}(_0xc1ad,0xde));var _0xdc1a=function(_0x5a6b46,_0x5d016c){_0x5a6b46=_0x5a6b46-0x0;var _0x2a8765=_0xc1ad[_0x5a6b46];return _0x2a8765;};'use strict';var _=require(_0xdc1a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdc1a('0x1'));var BPromise=require('bluebird');var rp=require(_0xdc1a('0x2'));var fs=require('fs');var path=require(_0xdc1a('0x3'));var rimraf=require(_0xdc1a('0x4'));var config=require(_0xdc1a('0x5'));var attributes=require('./memberReport.attributes');module[_0xdc1a('0x6')]=function(_0x2eeda8,_0x5d29ea){return _0x2eeda8['define']('MemberReport',attributes,{'tableName':_0xdc1a('0x7'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d5f=['membername','interface','util','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface'];(function(_0x52bcbd,_0x8dcc55){var _0x2c4072=function(_0x2af410){while(--_0x2af410){_0x52bcbd['push'](_0x52bcbd['shift']());}};_0x2c4072(++_0x8dcc55);}(_0x7d5f,0x1d0));var _0xf7d5=function(_0x5fb2ce,_0x4ab9c3){_0x5fb2ce=_0x5fb2ce-0x0;var _0x459e4a=_0x7d5f[_0x5fb2ce];return _0x459e4a;};'use strict';var _=require('lodash');var util=require(_0xf7d5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf7d5('0x1'));var rp=require(_0xf7d5('0x2'));var fs=require('fs');var path=require(_0xf7d5('0x3'));var rimraf=require(_0xf7d5('0x4'));var config=require(_0xf7d5('0x5'));var attributes=require(_0xf7d5('0x6'));module[_0xf7d5('0x7')]=function(_0x15483b,_0xcb5f42){return _0x15483b[_0xf7d5('0x8')](_0xf7d5('0x9'),attributes,{'tableName':_0xf7d5('0xa'),'paranoid':![],'indexes':[{'name':_0xf7d5('0xb'),'fields':[_0xf7d5('0xc'),_0xf7d5('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 6db5d21..adf8f48 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 _0xfc18=['rpc','../../config/environment','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','limit','include','map','model','attributes','debug','CreateMemberReport','create','raw','UpdateMemberReport','update','body','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xfc18,0xc0));var _0x8fc1=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xfc18[_0x382a62];return _0x490a25;};'use strict';var _=require(_0x8fc1('0x0'));var util=require(_0x8fc1('0x1'));var moment=require(_0x8fc1('0x2'));var BPromise=require(_0x8fc1('0x3'));var rs=require(_0x8fc1('0x4'));var fs=require('fs');var Redis=require(_0x8fc1('0x5'));var db=require(_0x8fc1('0x6'))['db'];var utils=require(_0x8fc1('0x7'));var logger=require('../../config/logger')(_0x8fc1('0x8'));var config=require(_0x8fc1('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8fc1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244f10,_0x37ad3c,_0x344c73){return new BPromise(function(_0x1125bd,_0x30a66f){return client[_0x8fc1('0xb')](_0x244f10,_0x344c73)[_0x8fc1('0xc')](function(_0x51097c){logger[_0x8fc1('0xd')](_0x8fc1('0xe'),_0x37ad3c,_0x8fc1('0xf'));logger['debug'](_0x8fc1('0x10'),_0x37ad3c,_0x8fc1('0xf'),JSON[_0x8fc1('0x11')](_0x51097c));if(_0x51097c[_0x8fc1('0x12')]){if(_0x51097c['error'][_0x8fc1('0x13')]===0x1f4){logger[_0x8fc1('0x12')](_0x8fc1('0xe'),_0x37ad3c,_0x51097c[_0x8fc1('0x12')]['message']);return _0x30a66f(_0x51097c[_0x8fc1('0x12')][_0x8fc1('0x14')]);}logger[_0x8fc1('0x12')]('MemberReport,\x20%s,\x20%s',_0x37ad3c,_0x51097c[_0x8fc1('0x12')][_0x8fc1('0x14')]);return _0x1125bd(_0x51097c[_0x8fc1('0x12')]['message']);}else{logger[_0x8fc1('0xd')](_0x8fc1('0xe'),_0x37ad3c,_0x8fc1('0xf'));_0x1125bd(_0x51097c[_0x8fc1('0x15')]['message']);}})[_0x8fc1('0x16')](function(_0x435c05){logger[_0x8fc1('0x12')](_0x8fc1('0xe'),_0x37ad3c,_0x435c05);_0x30a66f(_0x435c05);});});}exports[_0x8fc1('0x17')]=function(_0xdcc9c5){var _0x446e6c=this;return new Promise(function(_0x38d1c3,_0x2db7fe){return db[_0x8fc1('0x18')][_0x8fc1('0x19')]({'raw':_0xdcc9c5[_0x8fc1('0x1a')]?_0xdcc9c5[_0x8fc1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xdcc9c5[_0x8fc1('0x1a')]?_0xdcc9c5[_0x8fc1('0x1a')]['where']||null:null,'attributes':_0xdcc9c5['options']?_0xdcc9c5[_0x8fc1('0x1a')]['attributes']||null:null,'limit':_0xdcc9c5[_0x8fc1('0x1a')]?_0xdcc9c5['options'][_0x8fc1('0x1b')]||null:null,'include':_0xdcc9c5['options']?_0xdcc9c5['options'][_0x8fc1('0x1c')]?_[_0x8fc1('0x1d')](_0xdcc9c5[_0x8fc1('0x1a')][_0x8fc1('0x1c')],function(_0x3c4da8){return{'model':db[_0x3c4da8[_0x8fc1('0x1e')]],'as':_0x3c4da8['as'],'attributes':_0x3c4da8[_0x8fc1('0x1f')],'include':_0x3c4da8[_0x8fc1('0x1c')]?_[_0x8fc1('0x1d')](_0x3c4da8[_0x8fc1('0x1c')],function(_0x30d9d3){return{'model':db[_0x30d9d3[_0x8fc1('0x1e')]],'as':_0x30d9d3['as'],'attributes':_0x30d9d3[_0x8fc1('0x1f')],'include':_0x30d9d3[_0x8fc1('0x1c')]?_[_0x8fc1('0x1d')](_0x30d9d3[_0x8fc1('0x1c')],function(_0x33b9b9){return{'model':db[_0x33b9b9['model']],'as':_0x33b9b9['as'],'attributes':_0x33b9b9[_0x8fc1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8fc1('0xc')](function(_0x26c651){logger[_0x8fc1('0xd')](_0x8fc1('0x17'),_0xdcc9c5);logger[_0x8fc1('0x20')](_0x8fc1('0x17'),_0xdcc9c5,JSON[_0x8fc1('0x11')](_0x26c651));_0x38d1c3(_0x26c651);})[_0x8fc1('0x16')](function(_0x1b3fbf){logger[_0x8fc1('0x12')](_0x8fc1('0x17'),_0x1b3fbf[_0x8fc1('0x14')],_0xdcc9c5);_0x2db7fe(_0x446e6c[_0x8fc1('0x12')](0x1f4,_0x1b3fbf[_0x8fc1('0x14')]));});});};exports[_0x8fc1('0x21')]=function(_0x197a1a){var _0x179735=this;return new Promise(function(_0x154c56,_0x4704ce){return db[_0x8fc1('0x18')][_0x8fc1('0x22')](_0x197a1a['body'],{'raw':_0x197a1a[_0x8fc1('0x1a')]?_0x197a1a[_0x8fc1('0x1a')][_0x8fc1('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x3abec1){logger[_0x8fc1('0xd')](_0x8fc1('0x21'),_0x197a1a);logger[_0x8fc1('0x20')](_0x8fc1('0x21'),_0x197a1a,JSON[_0x8fc1('0x11')](_0x3abec1));_0x154c56(_0x3abec1);})[_0x8fc1('0x16')](function(_0x31d85f){logger[_0x8fc1('0x12')](_0x8fc1('0x21'),_0x31d85f[_0x8fc1('0x14')],_0x197a1a);_0x4704ce(_0x179735[_0x8fc1('0x12')](0x1f4,_0x31d85f['message']));});});};exports[_0x8fc1('0x24')]=function(_0x2474f0){var _0x38becd=this;return new Promise(function(_0x8dcc3,_0x15e2c0){return db[_0x8fc1('0x18')][_0x8fc1('0x25')](_0x2474f0[_0x8fc1('0x26')],{'raw':_0x2474f0[_0x8fc1('0x1a')]?_0x2474f0[_0x8fc1('0x1a')][_0x8fc1('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2474f0[_0x8fc1('0x1a')]?_0x2474f0['options'][_0x8fc1('0x27')]||null:null,'attributes':_0x2474f0[_0x8fc1('0x1a')]?_0x2474f0[_0x8fc1('0x1a')][_0x8fc1('0x1f')]||null:null,'limit':_0x2474f0[_0x8fc1('0x1a')]?_0x2474f0[_0x8fc1('0x1a')][_0x8fc1('0x1b')]||null:null})[_0x8fc1('0xc')](function(_0xc2b63d){logger[_0x8fc1('0xd')]('UpdateMemberReport',_0x2474f0);logger[_0x8fc1('0x20')]('UpdateMemberReport',_0x2474f0,JSON[_0x8fc1('0x11')](_0xc2b63d));_0x8dcc3(_0xc2b63d);})[_0x8fc1('0x16')](function(_0xeed6a0){logger[_0x8fc1('0x12')](_0x8fc1('0x24'),_0xeed6a0[_0x8fc1('0x14')],_0x2474f0);_0x15e2c0(_0x38becd[_0x8fc1('0x12')](0x1f4,_0xeed6a0['message']));});});}; \ No newline at end of file +var _0x7511=['attributes','include','map','model','CreateMemberReport','create','body','debug','stringify','UpdateMemberReport','update','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7511,0x107));var _0x1751=function(_0x367ac0,_0x5ddbf7){_0x367ac0=_0x367ac0-0x0;var _0x5c6ea7=_0x7511[_0x367ac0];return _0x5c6ea7;};'use strict';var _=require(_0x1751('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1751('0x1'));var rs=require(_0x1751('0x2'));var fs=require('fs');var Redis=require(_0x1751('0x3'));var db=require(_0x1751('0x4'))['db'];var utils=require(_0x1751('0x5'));var logger=require('../../config/logger')(_0x1751('0x6'));var config=require('../../config/environment');var jayson=require(_0x1751('0x7'));var client=jayson[_0x1751('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29559a,_0x38ab46,_0x102f90){return new BPromise(function(_0x66cc61,_0x1912b9){return client[_0x1751('0x9')](_0x29559a,_0x102f90)[_0x1751('0xa')](function(_0x3a22eb){logger[_0x1751('0xb')](_0x1751('0xc'),_0x38ab46,_0x1751('0xd'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x38ab46,_0x1751('0xd'),JSON['stringify'](_0x3a22eb));if(_0x3a22eb[_0x1751('0xe')]){if(_0x3a22eb[_0x1751('0xe')][_0x1751('0xf')]===0x1f4){logger[_0x1751('0xe')](_0x1751('0xc'),_0x38ab46,_0x3a22eb[_0x1751('0xe')][_0x1751('0x10')]);return _0x1912b9(_0x3a22eb[_0x1751('0xe')][_0x1751('0x10')]);}logger['error'](_0x1751('0xc'),_0x38ab46,_0x3a22eb['error'][_0x1751('0x10')]);return _0x66cc61(_0x3a22eb[_0x1751('0xe')][_0x1751('0x10')]);}else{logger[_0x1751('0xb')](_0x1751('0xc'),_0x38ab46,_0x1751('0xd'));_0x66cc61(_0x3a22eb[_0x1751('0x11')][_0x1751('0x10')]);}})[_0x1751('0x12')](function(_0x568fe3){logger[_0x1751('0xe')]('MemberReport,\x20%s,\x20%s',_0x38ab46,_0x568fe3);_0x1912b9(_0x568fe3);});});}exports[_0x1751('0x13')]=function(_0x295bc6){var _0x35220f=this;return new Promise(function(_0x505b20,_0x40b491){return db[_0x1751('0x14')][_0x1751('0x15')]({'raw':_0x295bc6[_0x1751('0x16')]?_0x295bc6[_0x1751('0x16')][_0x1751('0x17')]===undefined?!![]:![]:!![],'where':_0x295bc6['options']?_0x295bc6[_0x1751('0x16')][_0x1751('0x18')]||null:null,'attributes':_0x295bc6[_0x1751('0x16')]?_0x295bc6[_0x1751('0x16')][_0x1751('0x19')]||null:null,'limit':_0x295bc6[_0x1751('0x16')]?_0x295bc6[_0x1751('0x16')]['limit']||null:null,'include':_0x295bc6[_0x1751('0x16')]?_0x295bc6['options'][_0x1751('0x1a')]?_[_0x1751('0x1b')](_0x295bc6['options']['include'],function(_0x4e53d2){return{'model':db[_0x4e53d2[_0x1751('0x1c')]],'as':_0x4e53d2['as'],'attributes':_0x4e53d2['attributes'],'include':_0x4e53d2['include']?_['map'](_0x4e53d2[_0x1751('0x1a')],function(_0x1b304e){return{'model':db[_0x1b304e[_0x1751('0x1c')]],'as':_0x1b304e['as'],'attributes':_0x1b304e[_0x1751('0x19')],'include':_0x1b304e[_0x1751('0x1a')]?_['map'](_0x1b304e[_0x1751('0x1a')],function(_0x2618f7){return{'model':db[_0x2618f7[_0x1751('0x1c')]],'as':_0x2618f7['as'],'attributes':_0x2618f7[_0x1751('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1751('0xa')](function(_0x2d3ecc){logger['info']('GetMemberReport',_0x295bc6);logger['debug'](_0x1751('0x13'),_0x295bc6,JSON['stringify'](_0x2d3ecc));_0x505b20(_0x2d3ecc);})[_0x1751('0x12')](function(_0x12ab75){logger[_0x1751('0xe')](_0x1751('0x13'),_0x12ab75[_0x1751('0x10')],_0x295bc6);_0x40b491(_0x35220f[_0x1751('0xe')](0x1f4,_0x12ab75[_0x1751('0x10')]));});});};exports[_0x1751('0x1d')]=function(_0x1c2ae7){var _0x5c4254=this;return new Promise(function(_0x5691e1,_0x57604b){return db[_0x1751('0x14')][_0x1751('0x1e')](_0x1c2ae7[_0x1751('0x1f')],{'raw':_0x1c2ae7[_0x1751('0x16')]?_0x1c2ae7['options'][_0x1751('0x17')]===undefined?!![]:![]:!![]})[_0x1751('0xa')](function(_0x5b195e){logger[_0x1751('0xb')](_0x1751('0x1d'),_0x1c2ae7);logger[_0x1751('0x20')](_0x1751('0x1d'),_0x1c2ae7,JSON[_0x1751('0x21')](_0x5b195e));_0x5691e1(_0x5b195e);})['catch'](function(_0x15485e){logger[_0x1751('0xe')](_0x1751('0x1d'),_0x15485e['message'],_0x1c2ae7);_0x57604b(_0x5c4254[_0x1751('0xe')](0x1f4,_0x15485e[_0x1751('0x10')]));});});};exports[_0x1751('0x22')]=function(_0xacbd9){var _0x449756=this;return new Promise(function(_0x31222e,_0x1ac338){return db[_0x1751('0x14')][_0x1751('0x23')](_0xacbd9[_0x1751('0x1f')],{'raw':_0xacbd9[_0x1751('0x16')]?_0xacbd9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xacbd9[_0x1751('0x16')]?_0xacbd9['options']['where']||null:null,'attributes':_0xacbd9['options']?_0xacbd9[_0x1751('0x16')][_0x1751('0x19')]||null:null,'limit':_0xacbd9[_0x1751('0x16')]?_0xacbd9[_0x1751('0x16')]['limit']||null:null})[_0x1751('0xa')](function(_0x4f3e3b){logger[_0x1751('0xb')](_0x1751('0x22'),_0xacbd9);logger['debug']('UpdateMemberReport',_0xacbd9,JSON[_0x1751('0x21')](_0x4f3e3b));_0x31222e(_0x4f3e3b);})[_0x1751('0x12')](function(_0x599c49){logger[_0x1751('0xe')](_0x1751('0x22'),_0x599c49[_0x1751('0x10')],_0xacbd9);_0x1ac338(_0x449756['error'](0x1f4,_0x599c49['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4a07048..6416058 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 _0x50a6=['../../components/auth/service','../../components/interaction/service','./migration.controller','exports','multer','util','express','fs-extra'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x50a6,0xa4));var _0x650a=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0x50a6[_0xdbd4f7];return _0x5c3f9d;};'use strict';var multer=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x650a('0x2'));var router=express['Router']();var fs_extra=require(_0x650a('0x3'));var auth=require(_0x650a('0x4'));var interaction=require(_0x650a('0x5'));var config=require('../../config/environment');var controller=require(_0x650a('0x6'));router['get']('/',controller['index']);module[_0x650a('0x7')]=router; \ No newline at end of file +var _0x038b=['../../components/auth/service','../../components/interaction/service','./migration.controller','get','util','path','connect-timeout','Router'];(function(_0x4d0d85,_0x3250d3){var _0x290a74=function(_0x4762db){while(--_0x4762db){_0x4d0d85['push'](_0x4d0d85['shift']());}};_0x290a74(++_0x3250d3);}(_0x038b,0x114));var _0xb038=function(_0x2b8dc0,_0x431126){_0x2b8dc0=_0x2b8dc0-0x0;var _0xf6b33=_0x038b[_0x2b8dc0];return _0xf6b33;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 627ab20..96a0656 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 _0x909e=['exports','version','sequelize'];(function(_0x5884a5,_0x3027d0){var _0x479778=function(_0x484159){while(--_0x484159){_0x5884a5['push'](_0x5884a5['shift']());}};_0x479778(++_0x3027d0);}(_0x909e,0x1a0));var _0xe909=function(_0xc9ea0a,_0x41d553){_0xc9ea0a=_0xc9ea0a-0x0;var _0x6bf251=_0x909e[_0xc9ea0a];return _0x6bf251;};'use strict';var Sequelize=require(_0xe909('0x0'));module[_0xe909('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xe909('0x2')}}; \ No newline at end of file +var _0x14e7=['version','sequelize','exports'];(function(_0x490f68,_0x3bd706){var _0x58fa87=function(_0x4ebfe6){while(--_0x4ebfe6){_0x490f68['push'](_0x490f68['shift']());}};_0x58fa87(++_0x3bd706);}(_0x14e7,0x1b7));var _0x714e=function(_0x963000,_0x594831){_0x963000=_0x963000-0x0;var _0x582fb2=_0x14e7[_0x963000];return _0x582fb2;};'use strict';var Sequelize=require(_0x714e('0x0'));module[_0x714e('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x714e('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 5bffc32..b386055 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 _0xb401=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x267427,_0x11738f){var _0x548091=function(_0x4863bf){while(--_0x4863bf){_0x267427['push'](_0x267427['shift']());}};_0x548091(++_0x11738f);}(_0xb401,0xac));var _0x1b40=function(_0x4e3ebc,_0x5111ea){_0x4e3ebc=_0x4e3ebc-0x0;var _0x4bd1c9=_0xb401[_0x4e3ebc];return _0x4bd1c9;};'use strict';var emlformat=require(_0x1b40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b40('0x1'));var jsonpatch=require(_0x1b40('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b40('0x3'));var Mustache=require(_0x1b40('0x4'));var util=require(_0x1b40('0x5'));var path=require('path');var sox=require(_0x1b40('0x6'));var csv=require(_0x1b40('0x7'));var ejs=require(_0x1b40('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b40('0x9'));var squel=require('squel');var crypto=require(_0x1b40('0xa'));var jsforce=require(_0x1b40('0xb'));var deskjs=require(_0x1b40('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1b40('0xd'));var Papa=require(_0x1b40('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1b40('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b40('0x10'));var logger=require('../../config/logger')(_0x1b40('0x11'));var utils=require(_0x1b40('0x12'));var config=require(_0x1b40('0x13'));var licenseUtil=require(_0x1b40('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4afbc2,_0xbde257){_0xbde257=_0xbde257||0xcc;return function(_0x564e30){if(_0x564e30){return _0x4afbc2[_0x1b40('0x15')](_0xbde257);}return _0x4afbc2[_0x1b40('0x16')](_0xbde257)[_0x1b40('0x17')]();};}function respondWithResult(_0x35e346,_0x32a7d9){_0x32a7d9=_0x32a7d9||0xc8;return function(_0x271b35){if(_0x271b35){return _0x35e346['status'](_0x32a7d9)[_0x1b40('0x18')](_0x271b35);}};}function respondWithFilteredResult(_0x5123a1,_0x20913a){return function(_0x41d6e3){if(_0x41d6e3){var _0x2870c4=typeof _0x20913a[_0x1b40('0x19')]===_0x1b40('0x1a')&&typeof _0x20913a[_0x1b40('0x1b')]==='undefined';var _0x2d5b6d=_0x41d6e3['count'];var _0xa028ba=_0x2870c4?0x0:_0x20913a['offset'];var _0x3cc9bd=_0x2870c4?_0x41d6e3[_0x1b40('0x1c')]:_0x20913a[_0x1b40('0x19')]+_0x20913a[_0x1b40('0x1b')];var _0x154094;if(_0x3cc9bd>=_0x2d5b6d){_0x3cc9bd=_0x2d5b6d;_0x154094=0xc8;}else{_0x154094=0xce;}_0x5123a1[_0x1b40('0x16')](_0x154094);return _0x5123a1['set'](_0x1b40('0x1d'),_0xa028ba+'-'+_0x3cc9bd+'/'+_0x2d5b6d)[_0x1b40('0x18')](_0x41d6e3);}return null;};}function patchUpdates(_0x1de1a4){return function(_0x56fbdb){try{jsonpatch[_0x1b40('0x1e')](_0x56fbdb,_0x1de1a4,!![]);}catch(_0xaf06a4){return BPromise[_0x1b40('0x1f')](_0xaf06a4);}return _0x56fbdb[_0x1b40('0x20')]();};}function saveUpdates(_0x410104,_0x597e19){return function(_0x267b08){if(_0x267b08){return _0x267b08[_0x1b40('0x21')](_0x410104)['then'](function(_0x1f27a0){return _0x1f27a0;});}return null;};}function removeEntity(_0x24f163,_0x161020){return function(_0x50a24b){if(_0x50a24b){return _0x50a24b['destroy']()[_0x1b40('0x22')](function(){_0x24f163[_0x1b40('0x16')](0xcc)[_0x1b40('0x17')]();});}};}function handleEntityNotFound(_0x5c07b9,_0x238bd0){return function(_0x3f11c9){if(!_0x3f11c9){_0x5c07b9[_0x1b40('0x15')](0x194);}return _0x3f11c9;};}function handleError(_0x504401,_0x26db01){_0x26db01=_0x26db01||0x1f4;return function(_0x25b10b){logger[_0x1b40('0x23')](_0x25b10b[_0x1b40('0x24')]);if(_0x25b10b[_0x1b40('0x25')]){delete _0x25b10b[_0x1b40('0x25')];}_0x504401[_0x1b40('0x16')](_0x26db01)[_0x1b40('0x26')](_0x25b10b);};}exports[_0x1b40('0x27')]=function(_0x2e1f63,_0x2f5bf8){var _0x1ea9be={},_0x5d543c={},_0x1c16d3={'count':0x0,'rows':[]};var _0xdb295d=_[_0x1b40('0x28')](db[_0x1b40('0x29')][_0x1b40('0x2a')],function(_0x84f1f7){return{'name':_0x84f1f7[_0x1b40('0x2b')],'type':_0x84f1f7[_0x1b40('0x2c')][_0x1b40('0x2d')]};});_0x5d543c[_0x1b40('0x2e')]=_[_0x1b40('0x28')](_0xdb295d,'name');_0x5d543c[_0x1b40('0x2f')]=_[_0x1b40('0x30')](_0x2e1f63[_0x1b40('0x2f')]);_0x5d543c['filters']=_[_0x1b40('0x31')](_0x5d543c[_0x1b40('0x2e')],_0x5d543c[_0x1b40('0x2f')]);_0x1ea9be[_0x1b40('0x32')]=_['intersection'](_0x5d543c[_0x1b40('0x2e')],qs[_0x1b40('0x33')](_0x2e1f63[_0x1b40('0x2f')][_0x1b40('0x33')]));_0x1ea9be['attributes']=_0x1ea9be['attributes']['length']?_0x1ea9be[_0x1b40('0x32')]:_0x5d543c[_0x1b40('0x2e')];if(!_0x2e1f63[_0x1b40('0x2f')][_0x1b40('0x34')]('nolimit')){_0x1ea9be[_0x1b40('0x1b')]=qs[_0x1b40('0x1b')](_0x2e1f63[_0x1b40('0x2f')][_0x1b40('0x1b')]);_0x1ea9be[_0x1b40('0x19')]=qs[_0x1b40('0x19')](_0x2e1f63[_0x1b40('0x2f')][_0x1b40('0x19')]);}_0x1ea9be['order']=qs[_0x1b40('0x35')](_0x2e1f63[_0x1b40('0x2f')][_0x1b40('0x35')]);_0x1ea9be['where']=qs['filters'](_[_0x1b40('0x36')](_0x2e1f63[_0x1b40('0x2f')],_0x5d543c[_0x1b40('0x37')]),_0xdb295d);if(_0x2e1f63[_0x1b40('0x2f')]['filter']){_0x1ea9be[_0x1b40('0x38')]=_[_0x1b40('0x39')](_0x1ea9be[_0x1b40('0x38')],{'$or':_[_0x1b40('0x28')](_0xdb295d,function(_0x29c934){if(_0x29c934[_0x1b40('0x2c')]!==_0x1b40('0x3a')){var _0x1b5b24={};_0x1b5b24[_0x29c934[_0x1b40('0x25')]]={'$like':'%'+_0x2e1f63[_0x1b40('0x2f')][_0x1b40('0x3b')]+'%'};return _0x1b5b24;}})});}_0x1ea9be=_[_0x1b40('0x39')]({},_0x1ea9be,_0x2e1f63[_0x1b40('0x3c')]);var _0xfea602={'where':_0x1ea9be[_0x1b40('0x38')]};return db[_0x1b40('0x29')]['count'](_0xfea602)[_0x1b40('0x22')](function(_0x1f2db4){_0x1c16d3[_0x1b40('0x1c')]=_0x1f2db4;if(_0x2e1f63['query'][_0x1b40('0x3d')]){_0x1ea9be['include']=[{'all':!![]}];}return db[_0x1b40('0x29')][_0x1b40('0x3e')](_0x1ea9be);})[_0x1b40('0x22')](function(_0x56c2cb){_0x1c16d3[_0x1b40('0x3f')]=_0x56c2cb;return _0x1c16d3;})[_0x1b40('0x22')](respondWithFilteredResult(_0x2f5bf8,_0x1ea9be))['catch'](handleError(_0x2f5bf8,null));}; \ No newline at end of file +var _0x42ed=['nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Migration','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x42ed,0x16f));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd42e('0x0'));var rimraf=require(_0xd42e('0x1'));var zipdir=require(_0xd42e('0x2'));var jsonpatch=require(_0xd42e('0x3'));var rp=require(_0xd42e('0x4'));var moment=require(_0xd42e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd42e('0x6'));var util=require('util');var path=require(_0xd42e('0x7'));var sox=require(_0xd42e('0x8'));var csv=require(_0xd42e('0x9'));var ejs=require(_0xd42e('0xa'));var fs=require('fs');var fs_extra=require(_0xd42e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd42e('0xc'));var jsforce=require(_0xd42e('0xd'));var deskjs=require(_0xd42e('0xe'));var toCsv=require(_0xd42e('0x9'));var querystring=require(_0xd42e('0xf'));var Papa=require('papaparse');var Redis=require(_0xd42e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd42e('0x11'));var as=require(_0xd42e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd42e('0x13'))(_0xd42e('0x14'));var utils=require(_0xd42e('0x15'));var config=require(_0xd42e('0x16'));var licenseUtil=require(_0xd42e('0x17'));var db=require(_0xd42e('0x18'))['db'];function respondWithStatusCode(_0x3e055b,_0x2a28aa){_0x2a28aa=_0x2a28aa||0xcc;return function(_0x32b78d){if(_0x32b78d){return _0x3e055b[_0xd42e('0x19')](_0x2a28aa);}return _0x3e055b[_0xd42e('0x1a')](_0x2a28aa)[_0xd42e('0x1b')]();};}function respondWithResult(_0x417292,_0x138b00){_0x138b00=_0x138b00||0xc8;return function(_0x32f112){if(_0x32f112){return _0x417292[_0xd42e('0x1a')](_0x138b00)[_0xd42e('0x1c')](_0x32f112);}};}function respondWithFilteredResult(_0x10f765,_0x59085b){return function(_0x5ce150){if(_0x5ce150){var _0x4f28c3=typeof _0x59085b['offset']===_0xd42e('0x1d')&&typeof _0x59085b['limit']===_0xd42e('0x1d');var _0x2991c1=_0x5ce150['count'];var _0x1415c0=_0x4f28c3?0x0:_0x59085b[_0xd42e('0x1e')];var _0x31ffc4=_0x4f28c3?_0x5ce150[_0xd42e('0x1f')]:_0x59085b[_0xd42e('0x1e')]+_0x59085b[_0xd42e('0x20')];var _0x5e4d30;if(_0x31ffc4>=_0x2991c1){_0x31ffc4=_0x2991c1;_0x5e4d30=0xc8;}else{_0x5e4d30=0xce;}_0x10f765[_0xd42e('0x1a')](_0x5e4d30);return _0x10f765[_0xd42e('0x21')](_0xd42e('0x22'),_0x1415c0+'-'+_0x31ffc4+'/'+_0x2991c1)[_0xd42e('0x1c')](_0x5ce150);}return null;};}function patchUpdates(_0x243422){return function(_0x1fdaa2){try{jsonpatch[_0xd42e('0x23')](_0x1fdaa2,_0x243422,!![]);}catch(_0x20d1f9){return BPromise[_0xd42e('0x24')](_0x20d1f9);}return _0x1fdaa2[_0xd42e('0x25')]();};}function saveUpdates(_0x5d0082,_0x2736c1){return function(_0x1afdce){if(_0x1afdce){return _0x1afdce[_0xd42e('0x26')](_0x5d0082)[_0xd42e('0x27')](function(_0x407bb9){return _0x407bb9;});}return null;};}function removeEntity(_0x2c5ca0,_0x5098e7){return function(_0x30459f){if(_0x30459f){return _0x30459f[_0xd42e('0x28')]()[_0xd42e('0x27')](function(){_0x2c5ca0[_0xd42e('0x1a')](0xcc)[_0xd42e('0x1b')]();});}};}function handleEntityNotFound(_0x165d52,_0x172c3c){return function(_0x196029){if(!_0x196029){_0x165d52[_0xd42e('0x19')](0x194);}return _0x196029;};}function handleError(_0x4ce512,_0x2c3ae4){_0x2c3ae4=_0x2c3ae4||0x1f4;return function(_0x4c1c84){logger[_0xd42e('0x29')](_0x4c1c84[_0xd42e('0x2a')]);if(_0x4c1c84[_0xd42e('0x2b')]){delete _0x4c1c84['name'];}_0x4ce512['status'](_0x2c3ae4)[_0xd42e('0x2c')](_0x4c1c84);};}exports[_0xd42e('0x2d')]=function(_0x34d076,_0x3ebc4c){var _0x50deca={},_0x500539={},_0x2fde37={'count':0x0,'rows':[]};var _0x32e5a5=_['map'](db[_0xd42e('0x2e')]['rawAttributes'],function(_0x53c2d9){return{'name':_0x53c2d9['fieldName'],'type':_0x53c2d9[_0xd42e('0x2f')][_0xd42e('0x30')]};});_0x500539[_0xd42e('0x31')]=_[_0xd42e('0x32')](_0x32e5a5,_0xd42e('0x2b'));_0x500539[_0xd42e('0x33')]=_[_0xd42e('0x34')](_0x34d076[_0xd42e('0x33')]);_0x500539[_0xd42e('0x35')]=_[_0xd42e('0x36')](_0x500539['model'],_0x500539[_0xd42e('0x33')]);_0x50deca[_0xd42e('0x37')]=_['intersection'](_0x500539[_0xd42e('0x31')],qs[_0xd42e('0x38')](_0x34d076[_0xd42e('0x33')][_0xd42e('0x38')]));_0x50deca['attributes']=_0x50deca['attributes'][_0xd42e('0x39')]?_0x50deca[_0xd42e('0x37')]:_0x500539[_0xd42e('0x31')];if(!_0x34d076[_0xd42e('0x33')][_0xd42e('0x3a')](_0xd42e('0x3b'))){_0x50deca['limit']=qs[_0xd42e('0x20')](_0x34d076['query'][_0xd42e('0x20')]);_0x50deca['offset']=qs[_0xd42e('0x1e')](_0x34d076[_0xd42e('0x33')][_0xd42e('0x1e')]);}_0x50deca[_0xd42e('0x3c')]=qs[_0xd42e('0x3d')](_0x34d076[_0xd42e('0x33')][_0xd42e('0x3d')]);_0x50deca[_0xd42e('0x3e')]=qs[_0xd42e('0x35')](_[_0xd42e('0x3f')](_0x34d076[_0xd42e('0x33')],_0x500539[_0xd42e('0x35')]),_0x32e5a5);if(_0x34d076[_0xd42e('0x33')][_0xd42e('0x40')]){_0x50deca[_0xd42e('0x3e')]=_[_0xd42e('0x41')](_0x50deca[_0xd42e('0x3e')],{'$or':_[_0xd42e('0x32')](_0x32e5a5,function(_0x2f7b43){if(_0x2f7b43[_0xd42e('0x2f')]!=='VIRTUAL'){var _0x44c3d9={};_0x44c3d9[_0x2f7b43['name']]={'$like':'%'+_0x34d076[_0xd42e('0x33')][_0xd42e('0x40')]+'%'};return _0x44c3d9;}})});}_0x50deca=_['merge']({},_0x50deca,_0x34d076['options']);var _0x1c0856={'where':_0x50deca[_0xd42e('0x3e')]};return db['Migration']['count'](_0x1c0856)[_0xd42e('0x27')](function(_0x37e0ab){_0x2fde37[_0xd42e('0x1f')]=_0x37e0ab;if(_0x34d076[_0xd42e('0x33')][_0xd42e('0x42')]){_0x50deca[_0xd42e('0x43')]=[{'all':!![]}];}return db[_0xd42e('0x2e')][_0xd42e('0x44')](_0x50deca);})[_0xd42e('0x27')](function(_0x24226e){_0x2fde37[_0xd42e('0x45')]=_0x24226e;return _0x2fde37;})[_0xd42e('0x27')](respondWithFilteredResult(_0x3ebc4c,_0x50deca))[_0xd42e('0x46')](handleError(_0x3ebc4c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6b2ad43..dc3650c 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 _0x2b8a=['define','migrations','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x22ab78,_0x436ebd){var _0x5dc502=function(_0x544a7c){while(--_0x544a7c){_0x22ab78['push'](_0x22ab78['shift']());}};_0x5dc502(++_0x436ebd);}(_0x2b8a,0x1a0));var _0xa2b8=function(_0xb2d841,_0xd6d7c6){_0xb2d841=_0xb2d841-0x0;var _0x3f186e=_0x2b8a[_0xb2d841];return _0x3f186e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa2b8('0x0'))(_0xa2b8('0x1'));var moment=require(_0xa2b8('0x2'));var BPromise=require('bluebird');var rp=require(_0xa2b8('0x3'));var fs=require('fs');var path=require(_0xa2b8('0x4'));var rimraf=require('rimraf');var config=require(_0xa2b8('0x5'));var attributes=require('./migration.attributes');module[_0xa2b8('0x6')]=function(_0x5007f3,_0x28f8ac){return _0x5007f3[_0xa2b8('0x7')]('Migration',attributes,{'tableName':_0xa2b8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7df1=['Migration','migrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','define'];(function(_0x4cae31,_0x3fc679){var _0x1189d1=function(_0x228266){while(--_0x228266){_0x4cae31['push'](_0x4cae31['shift']());}};_0x1189d1(++_0x3fc679);}(_0x7df1,0xdf));var _0x17df=function(_0x2b7363,_0x3ffa03){_0x2b7363=_0x2b7363-0x0;var _0x58db62=_0x7df1[_0x2b7363];return _0x58db62;};'use strict';var _=require(_0x17df('0x0'));var util=require(_0x17df('0x1'));var logger=require(_0x17df('0x2'))(_0x17df('0x3'));var moment=require('moment');var BPromise=require(_0x17df('0x4'));var rp=require(_0x17df('0x5'));var fs=require('fs');var path=require(_0x17df('0x6'));var rimraf=require('rimraf');var config=require(_0x17df('0x7'));var attributes=require(_0x17df('0x8'));module[_0x17df('0x9')]=function(_0xd7d27c,_0x934143){return _0xd7d27c[_0x17df('0xa')](_0x17df('0xb'),attributes,{'tableName':_0x17df('0xc'),'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 3179511..fb2cd58 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 _0x7726=['request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2df5f3,_0x56a099){var _0x64b6d0=function(_0x62b423){while(--_0x62b423){_0x2df5f3['push'](_0x2df5f3['shift']());}};_0x64b6d0(++_0x56a099);}(_0x7726,0x107));var _0x6772=function(_0x16b0f0,_0x4540f9){_0x16b0f0=_0x16b0f0-0x0;var _0x5f2416=_0x7726[_0x16b0f0];return _0x5f2416;};'use strict';var _=require(_0x6772('0x0'));var util=require(_0x6772('0x1'));var moment=require(_0x6772('0x2'));var BPromise=require(_0x6772('0x3'));var rs=require(_0x6772('0x4'));var fs=require('fs');var Redis=require(_0x6772('0x5'));var db=require(_0x6772('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6772('0x7'))(_0x6772('0x8'));var config=require(_0x6772('0x9'));var jayson=require(_0x6772('0xa'));var client=jayson[_0x6772('0xb')][_0x6772('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f01bc,_0xe27108,_0x4c6205){return new BPromise(function(_0x4d9fcf,_0x1443ad){return client[_0x6772('0xd')](_0x2f01bc,_0x4c6205)[_0x6772('0xe')](function(_0x934ca8){logger[_0x6772('0xf')](_0x6772('0x10'),_0xe27108,_0x6772('0x11'));logger[_0x6772('0x12')](_0x6772('0x13'),_0xe27108,_0x6772('0x11'),JSON['stringify'](_0x934ca8));if(_0x934ca8[_0x6772('0x14')]){if(_0x934ca8[_0x6772('0x14')]['code']===0x1f4){logger[_0x6772('0x14')]('Migration,\x20%s,\x20%s',_0xe27108,_0x934ca8['error'][_0x6772('0x15')]);return _0x1443ad(_0x934ca8['error'][_0x6772('0x15')]);}logger[_0x6772('0x14')](_0x6772('0x10'),_0xe27108,_0x934ca8[_0x6772('0x14')]['message']);return _0x4d9fcf(_0x934ca8[_0x6772('0x14')]['message']);}else{logger[_0x6772('0xf')]('Migration,\x20%s,\x20%s',_0xe27108,_0x6772('0x11'));_0x4d9fcf(_0x934ca8[_0x6772('0x16')]['message']);}})['catch'](function(_0x36edd7){logger[_0x6772('0x14')]('Migration,\x20%s,\x20%s',_0xe27108,_0x36edd7);_0x1443ad(_0x36edd7);});});} \ No newline at end of file +var _0x188f=['util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x139aea,_0x1c6c32){var _0x3b7204=function(_0x3f7aef){while(--_0x3f7aef){_0x139aea['push'](_0x139aea['shift']());}};_0x3b7204(++_0x1c6c32);}(_0x188f,0xc8));var _0xf188=function(_0x35642e,_0x27b5f5){_0x35642e=_0x35642e-0x0;var _0x474ddd=_0x188f[_0x35642e];return _0x474ddd;};'use strict';var _=require('lodash');var util=require(_0xf188('0x0'));var moment=require(_0xf188('0x1'));var BPromise=require(_0xf188('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf188('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf188('0x4'))('rpc');var config=require(_0xf188('0x5'));var jayson=require(_0xf188('0x6'));var client=jayson['client'][_0xf188('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x18a31f,_0x254c51,_0x34ba5f){return new BPromise(function(_0x5822dc,_0x98540d){return client[_0xf188('0x8')](_0x18a31f,_0x34ba5f)[_0xf188('0x9')](function(_0x289220){logger['info'](_0xf188('0xa'),_0x254c51,_0xf188('0xb'));logger[_0xf188('0xc')]('Migration,\x20%s,\x20%s,\x20%s',_0x254c51,'request\x20sent',JSON[_0xf188('0xd')](_0x289220));if(_0x289220['error']){if(_0x289220[_0xf188('0xe')][_0xf188('0xf')]===0x1f4){logger[_0xf188('0xe')](_0xf188('0xa'),_0x254c51,_0x289220[_0xf188('0xe')][_0xf188('0x10')]);return _0x98540d(_0x289220[_0xf188('0xe')]['message']);}logger[_0xf188('0xe')](_0xf188('0xa'),_0x254c51,_0x289220[_0xf188('0xe')][_0xf188('0x10')]);return _0x5822dc(_0x289220[_0xf188('0xe')][_0xf188('0x10')]);}else{logger[_0xf188('0x11')](_0xf188('0xa'),_0x254c51,_0xf188('0xb'));_0x5822dc(_0x289220[_0xf188('0x12')][_0xf188('0x10')]);}})[_0xf188('0x13')](function(_0x273a5b){logger['error'](_0xf188('0xa'),_0x254c51,_0x273a5b);_0x98540d(_0x273a5b);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 4af0650..12b029c 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 _0x41f9=['./network.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x41f9,0x119));var _0x941f=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x41f9[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0x941f('0x0'));var util=require('util');var path=require(_0x941f('0x1'));var timeout=require(_0x941f('0x2'));var express=require('express');var router=express[_0x941f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x941f('0x4'));var interaction=require(_0x941f('0x5'));var config=require(_0x941f('0x6'));var controller=require(_0x941f('0x7'));router[_0x941f('0x8')]('/',auth[_0x941f('0x9')](),controller[_0x941f('0xa')]);router['get'](_0x941f('0xb'),auth['isAuthenticated'](),controller[_0x941f('0xc')]);router['post']('/',auth[_0x941f('0x9')](),controller['create']);router['put'](_0x941f('0xb'),auth[_0x941f('0x9')](),controller[_0x941f('0xd')]);router[_0x941f('0xe')]('/:id',auth[_0x941f('0x9')](),controller[_0x941f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x00fd=['create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','show','post'];(function(_0x1fbe3f,_0x20e81e){var _0x27bf0e=function(_0x2f3d90){while(--_0x2f3d90){_0x1fbe3f['push'](_0x1fbe3f['shift']());}};_0x27bf0e(++_0x20e81e);}(_0x00fd,0x9f));var _0xd00f=function(_0x301df3,_0x548076){_0x301df3=_0x301df3-0x0;var _0x12a9e8=_0x00fd[_0x301df3];return _0x12a9e8;};'use strict';var multer=require(_0xd00f('0x0'));var util=require('util');var path=require(_0xd00f('0x1'));var timeout=require(_0xd00f('0x2'));var express=require(_0xd00f('0x3'));var router=express[_0xd00f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd00f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd00f('0x6'));var controller=require(_0xd00f('0x7'));router[_0xd00f('0x8')]('/',auth[_0xd00f('0x9')](),controller['index']);router[_0xd00f('0x8')]('/:id',auth[_0xd00f('0x9')](),controller[_0xd00f('0xa')]);router[_0xd00f('0xb')]('/',auth[_0xd00f('0x9')](),controller[_0xd00f('0xc')]);router[_0xd00f('0xd')](_0xd00f('0xe'),auth[_0xd00f('0x9')](),controller[_0xd00f('0xf')]);router[_0xd00f('0x10')](_0xd00f('0xe'),auth['isAuthenticated'](),controller[_0xd00f('0x11')]);module[_0xd00f('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 2932970..ea0a289 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(_0x3c5e93,_0x4b883e){var _0x2dc5a9=function(_0x37e70f){while(--_0x37e70f){_0x3c5e93['push'](_0x3c5e93['shift']());}};_0x2dc5a9(++_0x4b883e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x132359,_0x1d5468){var _0x3bc9f5=function(_0x45cbed){while(--_0x45cbed){_0x132359['push'](_0x132359['shift']());}};_0x3bc9f5(++_0x1d5468);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 1d375de..1eb1b73 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 _0xd590=['Reload','res_stun_monitor.so','server/files/templates/network.ejs','toLowerCase','chan_sip.so','render','TURN','/etc/asterisk/sip_xcally_%s.conf','format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','Network,\x20%s,\x20%s','request\x20sent','result','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','Network','includeAll','include','findAll','catch','params','rawAttributes','options','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf'];(function(_0x551666,_0x687957){var _0x4b37ff=function(_0x332ce1){while(--_0x332ce1){_0x551666['push'](_0x551666['shift']());}};_0x4b37ff(++_0x687957);}(_0xd590,0xdb));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d59('0x0'));var zipdir=require(_0x0d59('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d59('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0d59('0x3'));var util=require(_0x0d59('0x4'));var path=require(_0x0d59('0x5'));var sox=require('sox');var csv=require(_0x0d59('0x6'));var ejs=require(_0x0d59('0x7'));var fs=require('fs');var fs_extra=require(_0x0d59('0x8'));var _=require(_0x0d59('0x9'));var squel=require(_0x0d59('0xa'));var crypto=require(_0x0d59('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0d59('0xc'));var toCsv=require(_0x0d59('0x6'));var querystring=require('querystring');var Papa=require(_0x0d59('0xd'));var Redis=require(_0x0d59('0xe'));var authService=require(_0x0d59('0xf'));var qs=require(_0x0d59('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d59('0x11'));var logger=require(_0x0d59('0x12'))(_0x0d59('0x13'));var utils=require(_0x0d59('0x14'));var config=require(_0x0d59('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d59('0x16'))['db'];var jayson=require(_0x0d59('0x17'));var client=jayson[_0x0d59('0x18')][_0x0d59('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x552314,_0x12585e,_0x527dec,_0x40380d){return new BPromise(function(_0x3d9cbb,_0x4dcb24){var _0x50b24c=_0x40380d||client;return _0x50b24c[_0x0d59('0x1a')](_0x552314,_0x527dec)[_0x0d59('0x1b')](function(_0x4fcba3){logger[_0x0d59('0x1c')]('Network,\x20%s,\x20%s',_0x12585e,'request\x20sent');logger[_0x0d59('0x1d')](_0x0d59('0x1e'),_0x12585e,'request\x20sent',JSON[_0x0d59('0x1f')](_0x4fcba3));if(_0x4fcba3['error']){if(_0x4fcba3['error']['code']===0x1f4){logger[_0x0d59('0x20')]('Network,\x20%s,\x20%s',_0x12585e,_0x4fcba3['error'][_0x0d59('0x21')]);return _0x4dcb24(_0x4fcba3['error']['message']);}logger['error'](_0x0d59('0x22'),_0x12585e,_0x4fcba3[_0x0d59('0x20')]['message']);return _0x3d9cbb(_0x4fcba3['error'][_0x0d59('0x21')]);}else{logger[_0x0d59('0x1c')](_0x0d59('0x22'),_0x12585e,_0x0d59('0x23'));_0x3d9cbb(_0x4fcba3[_0x0d59('0x24')][_0x0d59('0x21')]);}})['catch'](function(_0x2ba6c2){logger[_0x0d59('0x20')](_0x0d59('0x22'),_0x12585e,_0x2ba6c2);_0x4dcb24(_0x2ba6c2);});});}function respondWithStatusCode(_0x46dc11,_0x5e538a){_0x5e538a=_0x5e538a||0xcc;return function(_0x33a030){if(_0x33a030){return _0x46dc11['sendStatus'](_0x5e538a);}return _0x46dc11[_0x0d59('0x25')](_0x5e538a)['end']();};}function respondWithResult(_0x282c7f,_0x2d682c){_0x2d682c=_0x2d682c||0xc8;return function(_0x404b9f){if(_0x404b9f){return _0x282c7f[_0x0d59('0x25')](_0x2d682c)[_0x0d59('0x26')](_0x404b9f);}};}function respondWithFilteredResult(_0x18e670,_0xb28b8a){return function(_0xea8e25){if(_0xea8e25){var _0x4dc8b2=typeof _0xb28b8a[_0x0d59('0x27')]===_0x0d59('0x28')&&typeof _0xb28b8a[_0x0d59('0x29')]==='undefined';var _0x56e21a=_0xea8e25[_0x0d59('0x2a')];var _0x21b368=_0x4dc8b2?0x0:_0xb28b8a['offset'];var _0x373ee7=_0x4dc8b2?_0xea8e25[_0x0d59('0x2a')]:_0xb28b8a['offset']+_0xb28b8a['limit'];var _0x136975;if(_0x373ee7>=_0x56e21a){_0x373ee7=_0x56e21a;_0x136975=0xc8;}else{_0x136975=0xce;}_0x18e670['status'](_0x136975);return _0x18e670[_0x0d59('0x2b')]('Content-Range',_0x21b368+'-'+_0x373ee7+'/'+_0x56e21a)['json'](_0xea8e25);}return null;};}function patchUpdates(_0x10a777){return function(_0x540ba0){try{jsonpatch[_0x0d59('0x2c')](_0x540ba0,_0x10a777,!![]);}catch(_0x471906){return BPromise[_0x0d59('0x2d')](_0x471906);}return _0x540ba0[_0x0d59('0x2e')]();};}function saveUpdates(_0x2b2fbc,_0x408905){return function(_0x105c78){if(_0x105c78){return _0x105c78[_0x0d59('0x2f')](_0x2b2fbc)[_0x0d59('0x1b')](function(_0x3a4b16){return _0x3a4b16;});}return null;};}function removeEntity(_0x5a310b,_0x5270e2){return function(_0x5b810c){if(_0x5b810c){return _0x5b810c[_0x0d59('0x30')]()['then'](function(){_0x5a310b[_0x0d59('0x25')](0xcc)[_0x0d59('0x31')]();});}};}function handleEntityNotFound(_0x29eb5c,_0x414afe){return function(_0x48c9cb){if(!_0x48c9cb){_0x29eb5c[_0x0d59('0x32')](0x194);}return _0x48c9cb;};}function handleError(_0x456da1,_0xe921ea){_0xe921ea=_0xe921ea||0x1f4;return function(_0x1fc944){logger[_0x0d59('0x20')](_0x1fc944['stack']);if(_0x1fc944[_0x0d59('0x33')]){delete _0x1fc944[_0x0d59('0x33')];}_0x456da1['status'](_0xe921ea)[_0x0d59('0x34')](_0x1fc944);};}exports[_0x0d59('0x35')]=function(_0x538365,_0x806224){var _0x1a8f10={},_0x49f361={},_0x1e5e87={'count':0x0,'rows':[]};var _0x1d453a=_[_0x0d59('0x36')](db['Network']['rawAttributes'],function(_0x348ea5){return{'name':_0x348ea5[_0x0d59('0x37')],'type':_0x348ea5[_0x0d59('0x38')]['key']};});_0x49f361[_0x0d59('0x39')]=_[_0x0d59('0x36')](_0x1d453a,_0x0d59('0x33'));_0x49f361['query']=_[_0x0d59('0x3a')](_0x538365['query']);_0x49f361[_0x0d59('0x3b')]=_[_0x0d59('0x3c')](_0x49f361['model'],_0x49f361[_0x0d59('0x3d')]);_0x1a8f10[_0x0d59('0x3e')]=_['intersection'](_0x49f361['model'],qs[_0x0d59('0x3f')](_0x538365['query'][_0x0d59('0x3f')]));_0x1a8f10[_0x0d59('0x3e')]=_0x1a8f10[_0x0d59('0x3e')][_0x0d59('0x40')]?_0x1a8f10['attributes']:_0x49f361[_0x0d59('0x39')];if(!_0x538365[_0x0d59('0x3d')][_0x0d59('0x41')]('nolimit')){_0x1a8f10[_0x0d59('0x29')]=qs[_0x0d59('0x29')](_0x538365[_0x0d59('0x3d')]['limit']);_0x1a8f10[_0x0d59('0x27')]=qs[_0x0d59('0x27')](_0x538365[_0x0d59('0x3d')][_0x0d59('0x27')]);}_0x1a8f10[_0x0d59('0x42')]=qs[_0x0d59('0x43')](_0x538365[_0x0d59('0x3d')][_0x0d59('0x43')]);_0x1a8f10[_0x0d59('0x44')]=qs[_0x0d59('0x3b')](_[_0x0d59('0x45')](_0x538365['query'],_0x49f361[_0x0d59('0x3b')]),_0x1d453a);if(_0x538365[_0x0d59('0x3d')][_0x0d59('0x46')]){_0x1a8f10['where']=_[_0x0d59('0x47')](_0x1a8f10['where'],{'$or':_[_0x0d59('0x36')](_0x1d453a,function(_0x4e5ea3){if(_0x4e5ea3[_0x0d59('0x38')]!=='VIRTUAL'){var _0x4afb1e={};_0x4afb1e[_0x4e5ea3[_0x0d59('0x33')]]={'$like':'%'+_0x538365[_0x0d59('0x3d')][_0x0d59('0x46')]+'%'};return _0x4afb1e;}})});}_0x1a8f10=_['merge']({},_0x1a8f10,_0x538365['options']);var _0x408e32={'where':_0x1a8f10[_0x0d59('0x44')]};return db[_0x0d59('0x48')][_0x0d59('0x2a')](_0x408e32)[_0x0d59('0x1b')](function(_0x37c86b){_0x1e5e87['count']=_0x37c86b;if(_0x538365[_0x0d59('0x3d')][_0x0d59('0x49')]){_0x1a8f10[_0x0d59('0x4a')]=[{'all':!![]}];}return db[_0x0d59('0x48')][_0x0d59('0x4b')](_0x1a8f10);})[_0x0d59('0x1b')](function(_0x5e7ee2){_0x1e5e87['rows']=_0x5e7ee2;return _0x1e5e87;})['then'](respondWithFilteredResult(_0x806224,_0x1a8f10))[_0x0d59('0x4c')](handleError(_0x806224,null));};exports['show']=function(_0x33b54d,_0x1ce6e4){var _0x2da1fd={'raw':!![],'where':{'id':_0x33b54d[_0x0d59('0x4d')]['id']}},_0x272e63={};_0x272e63[_0x0d59('0x39')]=_['keys'](db[_0x0d59('0x48')][_0x0d59('0x4e')]);_0x272e63[_0x0d59('0x3d')]=_[_0x0d59('0x3a')](_0x33b54d[_0x0d59('0x3d')]);_0x272e63[_0x0d59('0x3b')]=_['intersection'](_0x272e63['model'],_0x272e63[_0x0d59('0x3d')]);_0x2da1fd[_0x0d59('0x3e')]=_[_0x0d59('0x3c')](_0x272e63['model'],qs[_0x0d59('0x3f')](_0x33b54d[_0x0d59('0x3d')][_0x0d59('0x3f')]));_0x2da1fd['attributes']=_0x2da1fd[_0x0d59('0x3e')][_0x0d59('0x40')]?_0x2da1fd[_0x0d59('0x3e')]:_0x272e63[_0x0d59('0x39')];if(_0x33b54d['query'][_0x0d59('0x49')]){_0x2da1fd[_0x0d59('0x4a')]=[{'all':!![]}];}_0x2da1fd=_[_0x0d59('0x47')]({},_0x2da1fd,_0x33b54d[_0x0d59('0x4f')]);return db[_0x0d59('0x48')][_0x0d59('0x50')](_0x2da1fd)[_0x0d59('0x1b')](handleEntityNotFound(_0x1ce6e4,null))['then'](respondWithResult(_0x1ce6e4,null))[_0x0d59('0x4c')](handleError(_0x1ce6e4,null));};exports[_0x0d59('0x51')]=function(_0x11df76,_0x50d558,_0x3a6ee0){var _0x3e9b29;return db[_0x0d59('0x52')][_0x0d59('0x53')](function(_0x2ff40c){return db[_0x0d59('0x48')][_0x0d59('0x51')](_0x11df76[_0x0d59('0x54')],{'raw':!![]})[_0x0d59('0x1b')](function(_0x3d780c){_0x3e9b29=_0x3d780c;return db[_0x0d59('0x48')][_0x0d59('0x4b')]({'where':{'type':_0x11df76[_0x0d59('0x54')][_0x0d59('0x38')]},'raw':!![]});})['then'](function(_0x441973){if(_0x3e9b29['type'][_0x0d59('0x55')]()==_0x0d59('0x56')){var _0xfb5e00=fs[_0x0d59('0x57')](path[_0x0d59('0x58')](config[_0x0d59('0x59')],_0x0d59('0x5a')),_0x0d59('0x5b'));var _0x2f2d6b=ejs['render'](_0xfb5e00,{'networks':_0x441973||[]});fs[_0x0d59('0x5c')](_0x0d59('0x5d'),_0x2f2d6b);return respondWithRpcPromise('Reload',_0x0d59('0x51'),{'module':'res_stun_monitor.so'});}else if(_0x3e9b29[_0x0d59('0x38')]['toUpperCase']()=='TURN'){var _0x35071e=fs[_0x0d59('0x57')](path[_0x0d59('0x58')](config[_0x0d59('0x59')],_0x0d59('0x5e')),_0x0d59('0x5b'));var _0x4d9c57=ejs['render'](_0x35071e,{'networks':_0x441973||[]});fs[_0x0d59('0x5c')](_0x0d59('0x5f'),_0x4d9c57);return respondWithRpcPromise(_0x0d59('0x60'),_0x0d59('0x51'),{'module':_0x0d59('0x61')});}else{var _0x381c00=fs[_0x0d59('0x57')](path[_0x0d59('0x58')](config[_0x0d59('0x59')],_0x0d59('0x62')),_0x0d59('0x5b'));var _0x59d4a0=ejs['render'](_0x381c00,{'networks':_0x441973||[]});fs[_0x0d59('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x11df76[_0x0d59('0x54')][_0x0d59('0x38')][_0x0d59('0x63')]()),_0x59d4a0);return respondWithRpcPromise(_0x0d59('0x60'),_0x0d59('0x51'),{'module':_0x0d59('0x64')});}return null;})[_0x0d59('0x1b')](function(){return _0x3e9b29;});})[_0x0d59('0x1b')](respondWithResult(_0x50d558,0xc9))['catch'](handleError(_0x50d558,null));};exports['update']=function(_0x5b4d10,_0x1ad66f,_0x1a79fb){var _0x3d75fb;return db['sequelize'][_0x0d59('0x53')](function(_0x2286d7){return db[_0x0d59('0x48')][_0x0d59('0x50')]({'where':{'id':_0x5b4d10[_0x0d59('0x4d')]['id']}})[_0x0d59('0x1b')](handleEntityNotFound(_0x1ad66f,null))[_0x0d59('0x1b')](saveUpdates(_0x5b4d10[_0x0d59('0x54')],null))[_0x0d59('0x1b')](function(_0x26f3b2){if(_0x26f3b2){_0x3d75fb=_0x26f3b2;return db[_0x0d59('0x48')][_0x0d59('0x4b')]({'where':{'type':_0x3d75fb[_0x0d59('0x38')]},'raw':!![]});}return null;})[_0x0d59('0x1b')](function(_0x25dace){if(_0x3d75fb[_0x0d59('0x38')]['toUpperCase']()==_0x0d59('0x56')){var _0x53d933=fs[_0x0d59('0x57')](path[_0x0d59('0x58')](config['root'],_0x0d59('0x5a')),_0x0d59('0x5b'));var _0xc44b4c=ejs[_0x0d59('0x65')](_0x53d933,{'networks':_0x25dace||[]});fs[_0x0d59('0x5c')](_0x0d59('0x5d'),_0xc44b4c);return respondWithRpcPromise('Reload',_0x0d59('0x2f'),{'module':_0x0d59('0x61')});}else if(_0x3d75fb[_0x0d59('0x38')][_0x0d59('0x55')]()==_0x0d59('0x66')){var _0x1d1d5c=fs[_0x0d59('0x57')](path[_0x0d59('0x58')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x53cd40=ejs['render'](_0x1d1d5c,{'networks':_0x25dace||[]});fs[_0x0d59('0x5c')](_0x0d59('0x5f'),_0x53cd40);return respondWithRpcPromise(_0x0d59('0x60'),'update',{'module':_0x0d59('0x61')});}else{var _0x5a5a99=fs[_0x0d59('0x57')](path['join'](config['root'],_0x0d59('0x62')),_0x0d59('0x5b'));var _0x1ae73c=ejs[_0x0d59('0x65')](_0x5a5a99,{'networks':_0x25dace||[]});fs[_0x0d59('0x5c')](util['format'](_0x0d59('0x67'),_0x5b4d10['body'][_0x0d59('0x38')][_0x0d59('0x63')]()),_0x1ae73c);return respondWithRpcPromise(_0x0d59('0x60'),'update',{'module':_0x0d59('0x64')});}return null;})[_0x0d59('0x1b')](function(_0x346d7d){if(_0x346d7d){return _0x3d75fb;}return null;});})[_0x0d59('0x1b')](respondWithResult(_0x1ad66f,null))[_0x0d59('0x4c')](handleError(_0x1ad66f,null));};exports[_0x0d59('0x30')]=function(_0x534ed0,_0x539567,_0x14f65a){var _0x58c47e;return db['Network'][_0x0d59('0x50')]({'where':{'id':_0x534ed0['params']['id']}})[_0x0d59('0x1b')](function(_0x81e2d3){_0x58c47e=_0x81e2d3;return _0x81e2d3;})['then'](handleEntityNotFound(_0x539567,null))[_0x0d59('0x1b')](removeEntity(_0x539567,null))[_0x0d59('0x1b')](function(){if(_0x58c47e){return db[_0x0d59('0x48')][_0x0d59('0x4b')]({'where':{'type':_0x58c47e[_0x0d59('0x38')]},'raw':!![]});}})[_0x0d59('0x1b')](function(_0x4f34c7){if(_0x58c47e['type'][_0x0d59('0x55')]()=='STUN'){var _0x34d478=fs['readFileSync'](path['join'](config[_0x0d59('0x59')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x5e200a=ejs[_0x0d59('0x65')](_0x34d478,{'networks':_0x4f34c7||[]});fs[_0x0d59('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x5e200a);return respondWithRpcPromise(_0x0d59('0x60'),_0x0d59('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x58c47e[_0x0d59('0x38')][_0x0d59('0x55')]()==_0x0d59('0x66')){var _0x3db622=fs[_0x0d59('0x57')](path[_0x0d59('0x58')](config[_0x0d59('0x59')],_0x0d59('0x5e')),'utf8');var _0x6bec21=ejs[_0x0d59('0x65')](_0x3db622,{'networks':_0x4f34c7||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x6bec21);return respondWithRpcPromise(_0x0d59('0x60'),_0x0d59('0x30'),{'module':'res_stun_monitor.so'});}else{var _0x9ceb91=fs[_0x0d59('0x57')](path[_0x0d59('0x58')](config[_0x0d59('0x59')],_0x0d59('0x62')),'utf8');var _0x58e5a1=ejs['render'](_0x9ceb91,{'networks':_0x4f34c7||[]});fs[_0x0d59('0x5c')](util[_0x0d59('0x68')](_0x0d59('0x67'),_0x534ed0['body'][_0x0d59('0x38')][_0x0d59('0x63')]()),_0x58e5a1);return respondWithRpcPromise(_0x0d59('0x60'),_0x0d59('0x30'),{'module':_0x0d59('0x64')});}return null;})[_0x0d59('0x4c')](handleError(_0x539567,null));}; \ No newline at end of file +var _0xe45d=['limit','undefined','count','Content-Range','apply','reject','update','then','end','stack','name','send','index','map','Network','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','options','create','sequelize','transaction','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe45d,0x18c));var _0xde45=function(_0x31e31b,_0x4e91b7){_0x31e31b=_0x31e31b-0x0;var _0x595c48=_0xe45d[_0x31e31b];return _0x595c48;};'use strict';var emlformat=require(_0xde45('0x0'));var rimraf=require(_0xde45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde45('0x2'));var rp=require(_0xde45('0x3'));var moment=require(_0xde45('0x4'));var BPromise=require(_0xde45('0x5'));var Mustache=require(_0xde45('0x6'));var util=require(_0xde45('0x7'));var path=require(_0xde45('0x8'));var sox=require(_0xde45('0x9'));var csv=require(_0xde45('0xa'));var ejs=require(_0xde45('0xb'));var fs=require('fs');var fs_extra=require(_0xde45('0xc'));var _=require(_0xde45('0xd'));var squel=require(_0xde45('0xe'));var crypto=require(_0xde45('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xde45('0x10'));var toCsv=require(_0xde45('0xa'));var querystring=require('querystring');var Papa=require(_0xde45('0x11'));var Redis=require(_0xde45('0x12'));var authService=require(_0xde45('0x13'));var qs=require(_0xde45('0x14'));var as=require(_0xde45('0x15'));var hardwareService=require(_0xde45('0x16'));var logger=require('../../config/logger')(_0xde45('0x17'));var utils=require(_0xde45('0x18'));var config=require(_0xde45('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xde45('0x1a'))['db'];var jayson=require(_0xde45('0x1b'));var client=jayson[_0xde45('0x1c')][_0xde45('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3c0997,_0x369ce9,_0x42fa88,_0x1b9e2d){return new BPromise(function(_0x4d1790,_0x55941e){var _0x3d8f9d=_0x1b9e2d||client;return _0x3d8f9d[_0xde45('0x1e')](_0x3c0997,_0x42fa88)['then'](function(_0x2237d9){logger[_0xde45('0x1f')]('Network,\x20%s,\x20%s',_0x369ce9,_0xde45('0x20'));logger[_0xde45('0x21')](_0xde45('0x22'),_0x369ce9,_0xde45('0x20'),JSON[_0xde45('0x23')](_0x2237d9));if(_0x2237d9[_0xde45('0x24')]){if(_0x2237d9[_0xde45('0x24')]['code']===0x1f4){logger[_0xde45('0x24')](_0xde45('0x25'),_0x369ce9,_0x2237d9[_0xde45('0x24')]['message']);return _0x55941e(_0x2237d9['error'][_0xde45('0x26')]);}logger[_0xde45('0x24')](_0xde45('0x25'),_0x369ce9,_0x2237d9[_0xde45('0x24')][_0xde45('0x26')]);return _0x4d1790(_0x2237d9[_0xde45('0x24')][_0xde45('0x26')]);}else{logger[_0xde45('0x1f')](_0xde45('0x25'),_0x369ce9,_0xde45('0x20'));_0x4d1790(_0x2237d9[_0xde45('0x27')][_0xde45('0x26')]);}})[_0xde45('0x28')](function(_0x4c5bab){logger['error'](_0xde45('0x25'),_0x369ce9,_0x4c5bab);_0x55941e(_0x4c5bab);});});}function respondWithStatusCode(_0x17927e,_0xbd3a9b){_0xbd3a9b=_0xbd3a9b||0xcc;return function(_0x5afb06){if(_0x5afb06){return _0x17927e[_0xde45('0x29')](_0xbd3a9b);}return _0x17927e[_0xde45('0x2a')](_0xbd3a9b)['end']();};}function respondWithResult(_0x5066a8,_0x231afe){_0x231afe=_0x231afe||0xc8;return function(_0x180fab){if(_0x180fab){return _0x5066a8[_0xde45('0x2a')](_0x231afe)[_0xde45('0x2b')](_0x180fab);}};}function respondWithFilteredResult(_0x282873,_0x13d99e){return function(_0x57c110){if(_0x57c110){var _0x4661fa=typeof _0x13d99e['offset']==='undefined'&&typeof _0x13d99e[_0xde45('0x2c')]===_0xde45('0x2d');var _0x5558ff=_0x57c110[_0xde45('0x2e')];var _0x1a24a4=_0x4661fa?0x0:_0x13d99e['offset'];var _0x4dfaf2=_0x4661fa?_0x57c110[_0xde45('0x2e')]:_0x13d99e['offset']+_0x13d99e[_0xde45('0x2c')];var _0x3ac9b9;if(_0x4dfaf2>=_0x5558ff){_0x4dfaf2=_0x5558ff;_0x3ac9b9=0xc8;}else{_0x3ac9b9=0xce;}_0x282873[_0xde45('0x2a')](_0x3ac9b9);return _0x282873['set'](_0xde45('0x2f'),_0x1a24a4+'-'+_0x4dfaf2+'/'+_0x5558ff)[_0xde45('0x2b')](_0x57c110);}return null;};}function patchUpdates(_0x6e83e1){return function(_0x3310b4){try{jsonpatch[_0xde45('0x30')](_0x3310b4,_0x6e83e1,!![]);}catch(_0x5bc839){return BPromise[_0xde45('0x31')](_0x5bc839);}return _0x3310b4['save']();};}function saveUpdates(_0x50d03e,_0x567c30){return function(_0x5c7f40){if(_0x5c7f40){return _0x5c7f40[_0xde45('0x32')](_0x50d03e)[_0xde45('0x33')](function(_0x36d796){return _0x36d796;});}return null;};}function removeEntity(_0x1ac7e3,_0x4c5a3c){return function(_0x35676f){if(_0x35676f){return _0x35676f['destroy']()[_0xde45('0x33')](function(){_0x1ac7e3[_0xde45('0x2a')](0xcc)[_0xde45('0x34')]();});}};}function handleEntityNotFound(_0x1c966d,_0x1ca50d){return function(_0x2aafad){if(!_0x2aafad){_0x1c966d[_0xde45('0x29')](0x194);}return _0x2aafad;};}function handleError(_0x45a340,_0x2c19e6){_0x2c19e6=_0x2c19e6||0x1f4;return function(_0x482303){logger[_0xde45('0x24')](_0x482303[_0xde45('0x35')]);if(_0x482303['name']){delete _0x482303[_0xde45('0x36')];}_0x45a340['status'](_0x2c19e6)[_0xde45('0x37')](_0x482303);};}exports[_0xde45('0x38')]=function(_0x1d2036,_0x4bb30d){var _0x5efaa6={},_0x178fdb={},_0x4f0633={'count':0x0,'rows':[]};var _0x2da4fb=_[_0xde45('0x39')](db[_0xde45('0x3a')][_0xde45('0x3b')],function(_0x49ac9f){return{'name':_0x49ac9f['fieldName'],'type':_0x49ac9f[_0xde45('0x3c')][_0xde45('0x3d')]};});_0x178fdb['model']=_['map'](_0x2da4fb,_0xde45('0x36'));_0x178fdb['query']=_[_0xde45('0x3e')](_0x1d2036[_0xde45('0x3f')]);_0x178fdb[_0xde45('0x40')]=_[_0xde45('0x41')](_0x178fdb['model'],_0x178fdb[_0xde45('0x3f')]);_0x5efaa6['attributes']=_[_0xde45('0x41')](_0x178fdb[_0xde45('0x42')],qs[_0xde45('0x43')](_0x1d2036[_0xde45('0x3f')]['fields']));_0x5efaa6[_0xde45('0x44')]=_0x5efaa6[_0xde45('0x44')][_0xde45('0x45')]?_0x5efaa6[_0xde45('0x44')]:_0x178fdb['model'];if(!_0x1d2036[_0xde45('0x3f')][_0xde45('0x46')]('nolimit')){_0x5efaa6['limit']=qs['limit'](_0x1d2036['query']['limit']);_0x5efaa6[_0xde45('0x47')]=qs[_0xde45('0x47')](_0x1d2036[_0xde45('0x3f')][_0xde45('0x47')]);}_0x5efaa6[_0xde45('0x48')]=qs[_0xde45('0x49')](_0x1d2036['query'][_0xde45('0x49')]);_0x5efaa6[_0xde45('0x4a')]=qs[_0xde45('0x40')](_[_0xde45('0x4b')](_0x1d2036[_0xde45('0x3f')],_0x178fdb[_0xde45('0x40')]),_0x2da4fb);if(_0x1d2036['query'][_0xde45('0x4c')]){_0x5efaa6[_0xde45('0x4a')]=_[_0xde45('0x4d')](_0x5efaa6[_0xde45('0x4a')],{'$or':_[_0xde45('0x39')](_0x2da4fb,function(_0xd50af2){if(_0xd50af2[_0xde45('0x3c')]!==_0xde45('0x4e')){var _0x5afc17={};_0x5afc17[_0xd50af2[_0xde45('0x36')]]={'$like':'%'+_0x1d2036[_0xde45('0x3f')][_0xde45('0x4c')]+'%'};return _0x5afc17;}})});}_0x5efaa6=_[_0xde45('0x4d')]({},_0x5efaa6,_0x1d2036['options']);var _0x2c6961={'where':_0x5efaa6['where']};return db['Network']['count'](_0x2c6961)[_0xde45('0x33')](function(_0x5a9f49){_0x4f0633[_0xde45('0x2e')]=_0x5a9f49;if(_0x1d2036[_0xde45('0x3f')][_0xde45('0x4f')]){_0x5efaa6[_0xde45('0x50')]=[{'all':!![]}];}return db['Network'][_0xde45('0x51')](_0x5efaa6);})[_0xde45('0x33')](function(_0x4cdb65){_0x4f0633['rows']=_0x4cdb65;return _0x4f0633;})['then'](respondWithFilteredResult(_0x4bb30d,_0x5efaa6))[_0xde45('0x28')](handleError(_0x4bb30d,null));};exports['show']=function(_0x4e8ea1,_0x58e6a3){var _0x1793d6={'raw':!![],'where':{'id':_0x4e8ea1[_0xde45('0x52')]['id']}},_0x1dbce7={};_0x1dbce7[_0xde45('0x42')]=_[_0xde45('0x3e')](db[_0xde45('0x3a')][_0xde45('0x3b')]);_0x1dbce7['query']=_[_0xde45('0x3e')](_0x4e8ea1[_0xde45('0x3f')]);_0x1dbce7[_0xde45('0x40')]=_[_0xde45('0x41')](_0x1dbce7[_0xde45('0x42')],_0x1dbce7['query']);_0x1793d6[_0xde45('0x44')]=_[_0xde45('0x41')](_0x1dbce7[_0xde45('0x42')],qs[_0xde45('0x43')](_0x4e8ea1['query'][_0xde45('0x43')]));_0x1793d6[_0xde45('0x44')]=_0x1793d6[_0xde45('0x44')][_0xde45('0x45')]?_0x1793d6[_0xde45('0x44')]:_0x1dbce7[_0xde45('0x42')];if(_0x4e8ea1[_0xde45('0x3f')][_0xde45('0x4f')]){_0x1793d6[_0xde45('0x50')]=[{'all':!![]}];}_0x1793d6=_[_0xde45('0x4d')]({},_0x1793d6,_0x4e8ea1[_0xde45('0x53')]);return db[_0xde45('0x3a')]['find'](_0x1793d6)[_0xde45('0x33')](handleEntityNotFound(_0x58e6a3,null))[_0xde45('0x33')](respondWithResult(_0x58e6a3,null))[_0xde45('0x28')](handleError(_0x58e6a3,null));};exports[_0xde45('0x54')]=function(_0x329893,_0x50bded,_0x140402){var _0x3603d1;return db[_0xde45('0x55')][_0xde45('0x56')](function(_0x28de43){return db[_0xde45('0x3a')]['create'](_0x329893['body'],{'raw':!![]})[_0xde45('0x33')](function(_0x5a6ce3){_0x3603d1=_0x5a6ce3;return db['Network'][_0xde45('0x51')]({'where':{'type':_0x329893['body'][_0xde45('0x3c')]},'raw':!![]});})[_0xde45('0x33')](function(_0x3f2d46){if(_0x3603d1['type'][_0xde45('0x57')]()==_0xde45('0x58')){var _0x42179c=fs[_0xde45('0x59')](path['join'](config[_0xde45('0x5a')],_0xde45('0x5b')),_0xde45('0x5c'));var _0x1b5168=ejs[_0xde45('0x5d')](_0x42179c,{'networks':_0x3f2d46||[]});fs[_0xde45('0x5e')](_0xde45('0x5f'),_0x1b5168);return respondWithRpcPromise(_0xde45('0x60'),_0xde45('0x54'),{'module':_0xde45('0x61')});}else if(_0x3603d1[_0xde45('0x3c')][_0xde45('0x57')]()==_0xde45('0x62')){var _0x208a34=fs[_0xde45('0x59')](path[_0xde45('0x63')](config['root'],_0xde45('0x64')),_0xde45('0x5c'));var _0x528bda=ejs['render'](_0x208a34,{'networks':_0x3f2d46||[]});fs[_0xde45('0x5e')](_0xde45('0x65'),_0x528bda);return respondWithRpcPromise(_0xde45('0x60'),_0xde45('0x54'),{'module':_0xde45('0x61')});}else{var _0x404510=fs[_0xde45('0x59')](path[_0xde45('0x63')](config[_0xde45('0x5a')],_0xde45('0x66')),_0xde45('0x5c'));var _0x5d4322=ejs['render'](_0x404510,{'networks':_0x3f2d46||[]});fs[_0xde45('0x5e')](util[_0xde45('0x67')](_0xde45('0x68'),_0x329893[_0xde45('0x69')][_0xde45('0x3c')][_0xde45('0x6a')]()),_0x5d4322);return respondWithRpcPromise(_0xde45('0x60'),_0xde45('0x54'),{'module':_0xde45('0x6b')});}return null;})[_0xde45('0x33')](function(){return _0x3603d1;});})[_0xde45('0x33')](respondWithResult(_0x50bded,0xc9))[_0xde45('0x28')](handleError(_0x50bded,null));};exports[_0xde45('0x32')]=function(_0x284622,_0x4e0df0,_0x2a7d65){var _0x17cda5;return db[_0xde45('0x55')][_0xde45('0x56')](function(_0x18953b){return db[_0xde45('0x3a')][_0xde45('0x6c')]({'where':{'id':_0x284622[_0xde45('0x52')]['id']}})[_0xde45('0x33')](handleEntityNotFound(_0x4e0df0,null))['then'](saveUpdates(_0x284622['body'],null))[_0xde45('0x33')](function(_0x98c3d3){if(_0x98c3d3){_0x17cda5=_0x98c3d3;return db['Network']['findAll']({'where':{'type':_0x17cda5[_0xde45('0x3c')]},'raw':!![]});}return null;})[_0xde45('0x33')](function(_0x3ca91b){if(_0x17cda5[_0xde45('0x3c')]['toUpperCase']()==_0xde45('0x58')){var _0x224cd5=fs[_0xde45('0x59')](path['join'](config[_0xde45('0x5a')],_0xde45('0x5b')),_0xde45('0x5c'));var _0x52bf40=ejs['render'](_0x224cd5,{'networks':_0x3ca91b||[]});fs[_0xde45('0x5e')](_0xde45('0x5f'),_0x52bf40);return respondWithRpcPromise(_0xde45('0x60'),_0xde45('0x32'),{'module':_0xde45('0x61')});}else if(_0x17cda5[_0xde45('0x3c')]['toUpperCase']()==_0xde45('0x62')){var _0x586126=fs[_0xde45('0x59')](path[_0xde45('0x63')](config[_0xde45('0x5a')],_0xde45('0x64')),'utf8');var _0x131e94=ejs[_0xde45('0x5d')](_0x586126,{'networks':_0x3ca91b||[]});fs[_0xde45('0x5e')](_0xde45('0x65'),_0x131e94);return respondWithRpcPromise(_0xde45('0x60'),_0xde45('0x32'),{'module':_0xde45('0x61')});}else{var _0xcc8e7c=fs[_0xde45('0x59')](path[_0xde45('0x63')](config[_0xde45('0x5a')],_0xde45('0x66')),_0xde45('0x5c'));var _0x578585=ejs[_0xde45('0x5d')](_0xcc8e7c,{'networks':_0x3ca91b||[]});fs[_0xde45('0x5e')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x284622[_0xde45('0x69')][_0xde45('0x3c')][_0xde45('0x6a')]()),_0x578585);return respondWithRpcPromise('Reload','update',{'module':_0xde45('0x6b')});}return null;})[_0xde45('0x33')](function(_0x568ee5){if(_0x568ee5){return _0x17cda5;}return null;});})[_0xde45('0x33')](respondWithResult(_0x4e0df0,null))['catch'](handleError(_0x4e0df0,null));};exports[_0xde45('0x6d')]=function(_0x37cd0e,_0x5e9652,_0x585b67){var _0x47f131;return db[_0xde45('0x3a')][_0xde45('0x6c')]({'where':{'id':_0x37cd0e[_0xde45('0x52')]['id']}})[_0xde45('0x33')](function(_0x49c7da){_0x47f131=_0x49c7da;return _0x49c7da;})[_0xde45('0x33')](handleEntityNotFound(_0x5e9652,null))[_0xde45('0x33')](removeEntity(_0x5e9652,null))[_0xde45('0x33')](function(){if(_0x47f131){return db['Network'][_0xde45('0x51')]({'where':{'type':_0x47f131['type']},'raw':!![]});}})[_0xde45('0x33')](function(_0x55eb38){if(_0x47f131[_0xde45('0x3c')]['toUpperCase']()==_0xde45('0x58')){var _0x293632=fs[_0xde45('0x59')](path[_0xde45('0x63')](config['root'],_0xde45('0x5b')),_0xde45('0x5c'));var _0x18d200=ejs[_0xde45('0x5d')](_0x293632,{'networks':_0x55eb38||[]});fs[_0xde45('0x5e')](_0xde45('0x5f'),_0x18d200);return respondWithRpcPromise(_0xde45('0x60'),_0xde45('0x6d'),{'module':_0xde45('0x61')});}else if(_0x47f131['type'][_0xde45('0x57')]()=='TURN'){var _0x575220=fs[_0xde45('0x59')](path['join'](config[_0xde45('0x5a')],_0xde45('0x64')),_0xde45('0x5c'));var _0x1c0ebd=ejs['render'](_0x575220,{'networks':_0x55eb38||[]});fs[_0xde45('0x5e')](_0xde45('0x65'),_0x1c0ebd);return respondWithRpcPromise(_0xde45('0x60'),_0xde45('0x6d'),{'module':_0xde45('0x61')});}else{var _0x2cfd4f=fs[_0xde45('0x59')](path[_0xde45('0x63')](config[_0xde45('0x5a')],_0xde45('0x66')),_0xde45('0x5c'));var _0x3b931d=ejs[_0xde45('0x5d')](_0x2cfd4f,{'networks':_0x55eb38||[]});fs['writeFileSync'](util[_0xde45('0x67')](_0xde45('0x68'),_0x37cd0e[_0xde45('0x69')][_0xde45('0x3c')][_0xde45('0x6a')]()),_0x3b931d);return respondWithRpcPromise(_0xde45('0x60'),_0xde45('0x6d'),{'module':_0xde45('0x6b')});}return null;})['catch'](handleError(_0x5e9652,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c5c9efb..38814f7 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 _0xf17f=['bluebird','request-promise','path','rimraf','./network.attributes','define','lodash','util','../../config/logger','api'];(function(_0x52e519,_0x3af35a){var _0x2c27d9=function(_0x361769){while(--_0x361769){_0x52e519['push'](_0x52e519['shift']());}};_0x2c27d9(++_0x3af35a);}(_0xf17f,0xe2));var _0xff17=function(_0x4ca3b4,_0x2450bc){_0x4ca3b4=_0x4ca3b4-0x0;var _0x51ea64=_0xf17f[_0x4ca3b4];return _0x51ea64;};'use strict';var _=require(_0xff17('0x0'));var util=require(_0xff17('0x1'));var logger=require(_0xff17('0x2'))(_0xff17('0x3'));var moment=require('moment');var BPromise=require(_0xff17('0x4'));var rp=require(_0xff17('0x5'));var fs=require('fs');var path=require(_0xff17('0x6'));var rimraf=require(_0xff17('0x7'));var config=require('../../config/environment');var attributes=require(_0xff17('0x8'));module['exports']=function(_0x20c491,_0x3d9921){return _0x20c491[_0xff17('0x9')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a38=['Network','network','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0xd7161f,_0x2ec134){var _0x4ad71f=function(_0x8b69ed){while(--_0x8b69ed){_0xd7161f['push'](_0xd7161f['shift']());}};_0x4ad71f(++_0x2ec134);}(_0x1a38,0x12d));var _0x81a3=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x1a38[_0x3c4a7c];return _0xf13d1e;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var logger=require(_0x81a3('0x2'))(_0x81a3('0x3'));var moment=require('moment');var BPromise=require(_0x81a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81a3('0x5'));var rimraf=require(_0x81a3('0x6'));var config=require(_0x81a3('0x7'));var attributes=require(_0x81a3('0x8'));module[_0x81a3('0x9')]=function(_0x30cb78,_0x1ac08c){return _0x30cb78[_0x81a3('0xa')](_0x81a3('0xb'),attributes,{'tableName':_0x81a3('0xc'),'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 395011a..0e45ae1 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 _0x5e0b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','code','error','message','result','catch'];(function(_0x127fac,_0x43468e){var _0x4abd4d=function(_0x44952a){while(--_0x44952a){_0x127fac['push'](_0x127fac['shift']());}};_0x4abd4d(++_0x43468e);}(_0x5e0b,0x78));var _0xb5e0=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0x5e0b[_0x4c630b];return _0x181259;};'use strict';var _=require(_0xb5e0('0x0'));var util=require(_0xb5e0('0x1'));var moment=require(_0xb5e0('0x2'));var BPromise=require(_0xb5e0('0x3'));var rs=require(_0xb5e0('0x4'));var fs=require('fs');var Redis=require(_0xb5e0('0x5'));var db=require(_0xb5e0('0x6'))['db'];var utils=require(_0xb5e0('0x7'));var logger=require(_0xb5e0('0x8'))('rpc');var config=require(_0xb5e0('0x9'));var jayson=require(_0xb5e0('0xa'));var client=jayson[_0xb5e0('0xb')][_0xb5e0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46db17,_0x2031f0,_0x50bd6f){return new BPromise(function(_0x1fab24,_0x5eff1b){return client['request'](_0x46db17,_0x50bd6f)[_0xb5e0('0xd')](function(_0x4cbcd0){logger[_0xb5e0('0xe')](_0xb5e0('0xf'),_0x2031f0,_0xb5e0('0x10'));logger[_0xb5e0('0x11')](_0xb5e0('0x12'),_0x2031f0,'request\x20sent',JSON['stringify'](_0x4cbcd0));if(_0x4cbcd0['error']){if(_0x4cbcd0['error'][_0xb5e0('0x13')]===0x1f4){logger['error'](_0xb5e0('0xf'),_0x2031f0,_0x4cbcd0['error']['message']);return _0x5eff1b(_0x4cbcd0[_0xb5e0('0x14')][_0xb5e0('0x15')]);}logger[_0xb5e0('0x14')](_0xb5e0('0xf'),_0x2031f0,_0x4cbcd0[_0xb5e0('0x14')][_0xb5e0('0x15')]);return _0x1fab24(_0x4cbcd0[_0xb5e0('0x14')]['message']);}else{logger[_0xb5e0('0xe')]('Network,\x20%s,\x20%s',_0x2031f0,_0xb5e0('0x10'));_0x1fab24(_0x4cbcd0[_0xb5e0('0x16')]['message']);}})[_0xb5e0('0x17')](function(_0x39522d){logger[_0xb5e0('0x14')]('Network,\x20%s,\x20%s',_0x2031f0,_0x39522d);_0x5eff1b(_0x39522d);});});} \ No newline at end of file +var _0x95ef=['request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x2faee9,_0x1ca570){var _0x4928ea=function(_0x1b99e6){while(--_0x1b99e6){_0x2faee9['push'](_0x2faee9['shift']());}};_0x4928ea(++_0x1ca570);}(_0x95ef,0x1c6));var _0xf95e=function(_0x20b9ed,_0x528985){_0x20b9ed=_0x20b9ed-0x0;var _0x290b25=_0x95ef[_0x20b9ed];return _0x290b25;};'use strict';var _=require('lodash');var util=require(_0xf95e('0x0'));var moment=require(_0xf95e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf95e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf95e('0x3'));var logger=require('../../config/logger')(_0xf95e('0x4'));var config=require(_0xf95e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf95e('0x6')][_0xf95e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb148bc,_0xea27a2,_0x338f0f){return new BPromise(function(_0x279284,_0x250330){return client[_0xf95e('0x8')](_0xb148bc,_0x338f0f)[_0xf95e('0x9')](function(_0xaea7d){logger[_0xf95e('0xa')]('Network,\x20%s,\x20%s',_0xea27a2,_0xf95e('0xb'));logger[_0xf95e('0xc')](_0xf95e('0xd'),_0xea27a2,_0xf95e('0xb'),JSON[_0xf95e('0xe')](_0xaea7d));if(_0xaea7d['error']){if(_0xaea7d[_0xf95e('0xf')][_0xf95e('0x10')]===0x1f4){logger[_0xf95e('0xf')](_0xf95e('0x11'),_0xea27a2,_0xaea7d['error'][_0xf95e('0x12')]);return _0x250330(_0xaea7d[_0xf95e('0xf')][_0xf95e('0x12')]);}logger[_0xf95e('0xf')](_0xf95e('0x11'),_0xea27a2,_0xaea7d['error'][_0xf95e('0x12')]);return _0x279284(_0xaea7d[_0xf95e('0xf')][_0xf95e('0x12')]);}else{logger[_0xf95e('0xa')]('Network,\x20%s,\x20%s',_0xea27a2,_0xf95e('0xb'));_0x279284(_0xaea7d[_0xf95e('0x13')][_0xf95e('0x12')]);}})[_0xf95e('0x14')](function(_0x472820){logger['error']('Network,\x20%s,\x20%s',_0xea27a2,_0x472820);_0x250330(_0x472820);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 44235bc..67ebb46 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 _0x5fc3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','util'];(function(_0x3ea96b,_0x1171c4){var _0xcae970=function(_0x59d67d){while(--_0x59d67d){_0x3ea96b['push'](_0x3ea96b['shift']());}};_0xcae970(++_0x1171c4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x5fc3[_0x16337a];return _0x422365;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x35fc('0x13')](_0x35fc('0x14'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x13')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x16')]);router[_0x35fc('0x13')]('/:id/notify',controller[_0x35fc('0x17')]);router[_0x35fc('0x13')](_0x35fc('0x10'),auth['isAuthenticated'](),controller[_0x35fc('0x18')]);router[_0x35fc('0x13')](_0x35fc('0x12'),auth['isAuthenticated'](),controller[_0x35fc('0x19')]);router[_0x35fc('0x13')](_0x35fc('0x1a'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1b')]);router[_0x35fc('0x1c')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1d')]);router[_0x35fc('0x1e')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x1f')]);router[_0x35fc('0x1e')](_0x35fc('0x14'),auth[_0x35fc('0xa')](),controller['removeDispositions']);router[_0x35fc('0x1e')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x20')]);router[_0x35fc('0x1e')](_0x35fc('0x12'),auth['isAuthenticated'](),controller[_0x35fc('0x21')]);module['exports']=router; \ No newline at end of file +var _0xabce=['put','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','send'];(function(_0x53b1be,_0x17f233){var _0x1305d0=function(_0x1dc3e7){while(--_0x1dc3e7){_0x53b1be['push'](_0x53b1be['shift']());}};_0x1305d0(++_0x17f233);}(_0xabce,0x103));var _0xeabc=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xabce[_0x411add];return _0x238242;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xeabc('0x15')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post'](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller['addDisposition']);router['post'](_0xeabc('0xe'),auth['isAuthenticated'](),controller[_0xeabc('0x17')]);router[_0xeabc('0x15')](_0xeabc('0x18'),controller[_0xeabc('0x19')]);router[_0xeabc('0x15')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x1a')]);router['post'](_0xeabc('0x14'),auth['isAuthenticated'](),controller[_0xeabc('0x1b')]);router[_0xeabc('0x15')]('/:id/send',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1c')]);router[_0xeabc('0x1d')](_0xeabc('0x1e'),auth[_0xeabc('0x8')](),controller['update']);router[_0xeabc('0x1f')](_0xeabc('0x1e'),auth[_0xeabc('0x8')](),controller['destroy']);router[_0xeabc('0x1f')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x20')]);router['delete'](_0xeabc('0xe'),auth['isAuthenticated'](),controller[_0xeabc('0x21')]);router['delete'](_0xeabc('0x14'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x22')]);module[_0xeabc('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 52f1f72..37d96f2 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 _0x2e8f=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate'];(function(_0xd94498,_0x30a315){var _0x541c94=function(_0x1e102f){while(--_0x1e102f){_0xd94498['push'](_0xd94498['shift']());}};_0x541c94(++_0x30a315);}(_0x2e8f,0x1a8));var _0xf2e8=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x2e8f[_0x5c3ae9];return _0x3f5950;};'use strict';var Sequelize=require(_0xf2e8('0x0'));var rs=require(_0xf2e8('0x1'));module['exports']={'name':{'type':Sequelize[_0xf2e8('0x2')],'unique':_0xf2e8('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf2e8('0x2')],'defaultValue':function(){return rs[_0xf2e8('0x4')]();}},'replyUri':{'type':Sequelize[_0xf2e8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf2e8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf2e8('0x5')],'defaultValue':function(){return _0xf2e8('0x6');}},'notificationSound':{'type':Sequelize[_0xf2e8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf2e8('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf2e8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf2e8('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf2e8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf2e8('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xf2e8('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xf2e8('0x7')],'defaultValue':![],'comment':_0xf2e8('0xa'),'set':function(_0x83c89d){if(!_0x83c89d)this[_0xf2e8('0xb')]('mandatoryDispositionPauseId',null);this[_0xf2e8('0xb')](_0xf2e8('0xc'),_0x83c89d);}}}; \ No newline at end of file +var _0x87b3=['sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x4e7c2,_0x3b3347){var _0x84bb35=function(_0x217b38){while(--_0x217b38){_0x4e7c2['push'](_0x4e7c2['shift']());}};_0x84bb35(++_0x3b3347);}(_0x87b3,0xf0));var _0x387b=function(_0x3daa8e,_0x234e2d){_0x3daa8e=_0x3daa8e-0x0;var _0x5c70e4=_0x87b3[_0x3daa8e];return _0x5c70e4;};'use strict';var Sequelize=require(_0x387b('0x0'));var rs=require(_0x387b('0x1'));module[_0x387b('0x2')]={'name':{'type':Sequelize[_0x387b('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x387b('0x3')]},'token':{'type':Sequelize[_0x387b('0x3')],'defaultValue':function(){return rs[_0x387b('0x4')]();}},'replyUri':{'type':Sequelize[_0x387b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x387b('0x5')],'defaultValue':function(){return _0x387b('0x6');}},'notificationSound':{'type':Sequelize[_0x387b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x387b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x387b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x387b('0x3')]},'queueTransfer':{'type':Sequelize[_0x387b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x387b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x387b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x387b('0x9'),'set':function(_0x56fcea){if(!_0x56fcea)this[_0x387b('0xa')]('mandatoryDispositionPauseId',null);this[_0x387b('0xa')](_0x387b('0xb'),_0x56fcea);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ba9c44d..e9b34b2 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 _0x692e=['where','pick','filter','VIRTUAL','merge','options','OpenchannelAccount','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','getDispositions','findOne','Disposition','OpenchannelAccountId','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','Sequelize','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','from','CmList','List','Contacts','DESC','OpenchannelApplication','account','Applications','list','applications','orderBy','priority','asc','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','Tag','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','out','OpenchannelMessage','Messages','dataValues','rimraf','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','index','Pause','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x692e,0x6c));var _0xe692=function(_0x4c6653,_0x5522ef){_0x4c6653=_0x4c6653-0x0;var _0x14c3dd=_0x692e[_0x4c6653];return _0x14c3dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe692('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe692('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xe692('0x2'));var util=require('util');var path=require(_0xe692('0x3'));var sox=require(_0xe692('0x4'));var csv=require(_0xe692('0x5'));var ejs=require(_0xe692('0x6'));var fs=require('fs');var fs_extra=require(_0xe692('0x7'));var _=require(_0xe692('0x8'));var squel=require('squel');var crypto=require(_0xe692('0x9'));var jsforce=require(_0xe692('0xa'));var deskjs=require(_0xe692('0xb'));var toCsv=require(_0xe692('0x5'));var querystring=require(_0xe692('0xc'));var Papa=require(_0xe692('0xd'));var Redis=require(_0xe692('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe692('0xf'));var logger=require(_0xe692('0x10'))(_0xe692('0x11'));var utils=require(_0xe692('0x12'));var config=require(_0xe692('0x13'));var licenseUtil=require(_0xe692('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe692('0x15')](config[_0xe692('0x16')],{'host':_0xe692('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe692('0x16')]));require(_0xe692('0x18'))['register'](socket);var jayson=require(_0xe692('0x19'));var client=jayson[_0xe692('0x1a')][_0xe692('0x1b')]({'port':0x232c});var client9002=jayson[_0xe692('0x1a')][_0xe692('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x31d460,_0x3e7db2,_0x385e4b,_0x313fc3){return new BPromise(function(_0x1328a4,_0x470923){var _0x32bb2e=_0x313fc3||client;return _0x32bb2e[_0xe692('0x1c')](_0x31d460,_0x385e4b)[_0xe692('0x1d')](function(_0x5d87a8){logger[_0xe692('0x1e')](_0xe692('0x1f'),_0x3e7db2,'request\x20sent');logger[_0xe692('0x20')](_0xe692('0x21'),_0x3e7db2,_0xe692('0x22'),JSON[_0xe692('0x23')](_0x5d87a8));if(_0x5d87a8[_0xe692('0x24')]){if(_0x5d87a8[_0xe692('0x24')][_0xe692('0x25')]===0x1f4){logger[_0xe692('0x24')](_0xe692('0x1f'),_0x3e7db2,_0x5d87a8[_0xe692('0x24')][_0xe692('0x26')]);return _0x470923(_0x5d87a8[_0xe692('0x24')][_0xe692('0x26')]);}logger['error'](_0xe692('0x1f'),_0x3e7db2,_0x5d87a8[_0xe692('0x24')][_0xe692('0x26')]);return _0x1328a4(_0x5d87a8[_0xe692('0x24')][_0xe692('0x26')]);}else{logger['info'](_0xe692('0x1f'),_0x3e7db2,_0xe692('0x22'));_0x1328a4(_0x5d87a8[_0xe692('0x27')]['message']);}})[_0xe692('0x28')](function(_0x359567){logger[_0xe692('0x24')](_0xe692('0x1f'),_0x3e7db2,_0x359567);_0x470923(_0x359567);});});}function respondWithStatusCode(_0x2a32ea,_0x28ed5){_0x28ed5=_0x28ed5||0xcc;return function(_0xdd820f){if(_0xdd820f){return _0x2a32ea['sendStatus'](_0x28ed5);}return _0x2a32ea[_0xe692('0x29')](_0x28ed5)[_0xe692('0x2a')]();};}function respondWithResult(_0x173053,_0x5d438a){_0x5d438a=_0x5d438a||0xc8;return function(_0x56dd9c){if(_0x56dd9c){return _0x173053[_0xe692('0x29')](_0x5d438a)[_0xe692('0x2b')](_0x56dd9c);}};}function respondWithFilteredResult(_0x28da73,_0xecacae){return function(_0x57f060){if(_0x57f060){var _0x5a9fea=typeof _0xecacae['offset']===_0xe692('0x2c')&&typeof _0xecacae[_0xe692('0x2d')]===_0xe692('0x2c');var _0x12b416=_0x57f060[_0xe692('0x2e')];var _0x346a38=_0x5a9fea?0x0:_0xecacae[_0xe692('0x2f')];var _0xa061c6=_0x5a9fea?_0x57f060[_0xe692('0x2e')]:_0xecacae['offset']+_0xecacae['limit'];var _0x94467e;if(_0xa061c6>=_0x12b416){_0xa061c6=_0x12b416;_0x94467e=0xc8;}else{_0x94467e=0xce;}_0x28da73[_0xe692('0x29')](_0x94467e);return _0x28da73['set'](_0xe692('0x30'),_0x346a38+'-'+_0xa061c6+'/'+_0x12b416)[_0xe692('0x2b')](_0x57f060);}return null;};}function patchUpdates(_0x11f91a){return function(_0x5264de){try{jsonpatch[_0xe692('0x31')](_0x5264de,_0x11f91a,!![]);}catch(_0x392907){return BPromise[_0xe692('0x32')](_0x392907);}return _0x5264de['save']();};}function saveUpdates(_0x10b174,_0x15e666){return function(_0x266a8e){if(_0x266a8e){return _0x266a8e[_0xe692('0x33')](_0x10b174)[_0xe692('0x1d')](function(_0x5281ea){return _0x5281ea;});}return null;};}function removeEntity(_0x4c32ea,_0x1169c9){return function(_0x572e84){if(_0x572e84){return _0x572e84['destroy']()[_0xe692('0x1d')](function(){var _0x3d8ce8=_0x572e84[_0xe692('0x34')]({'plain':!![]});var _0x399cb2=_0xe692('0x35');return db[_0xe692('0x36')][_0xe692('0x37')]({'where':{'type':_0x399cb2,'resourceId':_0x3d8ce8['id']}})[_0xe692('0x1d')](function(){return _0x572e84;});})[_0xe692('0x1d')](function(){_0x4c32ea[_0xe692('0x29')](0xcc)[_0xe692('0x2a')]();});}};}function handleEntityNotFound(_0x583e5d,_0x5e071c){return function(_0x23d62d){if(!_0x23d62d){_0x583e5d['sendStatus'](0x194);}return _0x23d62d;};}function handleError(_0x5169f0,_0x1c40b0){_0x1c40b0=_0x1c40b0||0x1f4;return function(_0x5a0937){logger[_0xe692('0x24')](_0x5a0937[_0xe692('0x38')]);if(_0x5a0937[_0xe692('0x39')]){delete _0x5a0937[_0xe692('0x39')];}_0x5169f0[_0xe692('0x29')](_0x1c40b0)['send'](_0x5a0937);};}exports[_0xe692('0x3a')]=function(_0x47b2f0,_0x9d6add){var _0x37ac05={'include':[{'model':db[_0xe692('0x3b')],'as':'mandatoryDispositionPause'}]},_0xeb9350={},_0x5398ed={'count':0x0,'rows':[]};var _0x5dc2f5=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x23eb46){return{'name':_0x23eb46['fieldName'],'type':_0x23eb46[_0xe692('0x3c')][_0xe692('0x3d')]};});_0xeb9350[_0xe692('0x3e')]=_[_0xe692('0x3f')](_0x5dc2f5,'name');_0xeb9350[_0xe692('0x40')]=_[_0xe692('0x41')](_0x47b2f0[_0xe692('0x40')]);_0xeb9350[_0xe692('0x42')]=_['intersection'](_0xeb9350[_0xe692('0x3e')],_0xeb9350[_0xe692('0x40')]);_0x37ac05[_0xe692('0x43')]=_[_0xe692('0x44')](_0xeb9350['model'],qs[_0xe692('0x45')](_0x47b2f0[_0xe692('0x40')][_0xe692('0x45')]));_0x37ac05[_0xe692('0x43')]=_0x37ac05[_0xe692('0x43')][_0xe692('0x46')]?_0x37ac05[_0xe692('0x43')]:_0xeb9350['model'];if(!_0x47b2f0[_0xe692('0x40')][_0xe692('0x47')](_0xe692('0x48'))){_0x37ac05[_0xe692('0x2d')]=qs[_0xe692('0x2d')](_0x47b2f0[_0xe692('0x40')][_0xe692('0x2d')]);_0x37ac05[_0xe692('0x2f')]=qs['offset'](_0x47b2f0['query'][_0xe692('0x2f')]);}_0x37ac05[_0xe692('0x49')]=qs[_0xe692('0x4a')](_0x47b2f0[_0xe692('0x40')]['sort']);_0x37ac05[_0xe692('0x4b')]=qs[_0xe692('0x42')](_[_0xe692('0x4c')](_0x47b2f0[_0xe692('0x40')],_0xeb9350['filters']),_0x5dc2f5);if(_0x47b2f0[_0xe692('0x40')][_0xe692('0x4d')]){_0x37ac05[_0xe692('0x4b')]=_['merge'](_0x37ac05[_0xe692('0x4b')],{'$or':_[_0xe692('0x3f')](_0x5dc2f5,function(_0x1ae891){if(_0x1ae891[_0xe692('0x3c')]!==_0xe692('0x4e')){var _0xa4b457={};_0xa4b457[_0x1ae891[_0xe692('0x39')]]={'$like':'%'+_0x47b2f0[_0xe692('0x40')][_0xe692('0x4d')]+'%'};return _0xa4b457;}})});}_0x37ac05=_[_0xe692('0x4f')]({},_0x37ac05,_0x47b2f0[_0xe692('0x50')]);var _0x42239e={'where':_0x37ac05[_0xe692('0x4b')]};return db[_0xe692('0x51')][_0xe692('0x2e')](_0x42239e)['then'](function(_0x5c8725){_0x5398ed['count']=_0x5c8725;if(_0x47b2f0['query'][_0xe692('0x52')]){_0x37ac05[_0xe692('0x53')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xe692('0x54')](_0x37ac05);})[_0xe692('0x1d')](function(_0x44b911){_0x5398ed[_0xe692('0x55')]=_0x44b911;return _0x5398ed;})['then'](respondWithFilteredResult(_0x9d6add,_0x37ac05))[_0xe692('0x28')](handleError(_0x9d6add,null));};exports[_0xe692('0x56')]=function(_0x440233,_0x20b3ea){var _0x485eb7={'raw':![],'where':{'id':_0x440233[_0xe692('0x57')]['id']},'include':[{'model':db[_0xe692('0x3b')],'as':'mandatoryDispositionPause'}]},_0x194324={};_0x194324[_0xe692('0x3e')]=_[_0xe692('0x41')](db[_0xe692('0x51')][_0xe692('0x58')]);_0x194324['query']=_[_0xe692('0x41')](_0x440233[_0xe692('0x40')]);_0x194324[_0xe692('0x42')]=_[_0xe692('0x44')](_0x194324[_0xe692('0x3e')],_0x194324[_0xe692('0x40')]);_0x485eb7[_0xe692('0x43')]=_[_0xe692('0x44')](_0x194324[_0xe692('0x3e')],qs['fields'](_0x440233[_0xe692('0x40')]['fields']));_0x485eb7['attributes']=_0x485eb7[_0xe692('0x43')]['length']?_0x485eb7[_0xe692('0x43')]:_0x194324[_0xe692('0x3e')];if(_0x440233[_0xe692('0x40')][_0xe692('0x52')]){_0x485eb7[_0xe692('0x53')]=[{'all':!![]}];}_0x485eb7=_[_0xe692('0x4f')]({},_0x485eb7,_0x440233['options']);return db[_0xe692('0x51')][_0xe692('0x59')](_0x485eb7)[_0xe692('0x1d')](handleEntityNotFound(_0x20b3ea,null))[_0xe692('0x1d')](respondWithResult(_0x20b3ea,null))[_0xe692('0x28')](handleError(_0x20b3ea,null));};exports['create']=function(_0x3b6c58,_0x317de0){return db[_0xe692('0x51')][_0xe692('0x5a')](_0x3b6c58[_0xe692('0x5b')],{})[_0xe692('0x1d')](function(_0x35a0bf){var _0x3d0635=_0x3b6c58[_0xe692('0x5c')][_0xe692('0x34')]({'plain':!![]});if(!_0x3d0635)throw new Error(_0xe692('0x5d'));if(_0x3d0635[_0xe692('0x5e')]===_0xe692('0x5c')){var _0x81d8f1=_0x35a0bf[_0xe692('0x34')]({'plain':!![]});var _0x1f72dc=_0xe692('0x35');return db[_0xe692('0x5f')]['find']({'where':{'name':_0x1f72dc,'userProfileId':_0x3d0635['userProfileId']},'raw':!![]})[_0xe692('0x1d')](function(_0x369fb5){if(_0x369fb5&&_0x369fb5[_0xe692('0x60')]===0x0){return db['UserProfileResource'][_0xe692('0x5a')]({'name':_0x81d8f1[_0xe692('0x39')],'resourceId':_0x81d8f1['id'],'type':_0x369fb5[_0xe692('0x39')],'sectionId':_0x369fb5['id']},{})[_0xe692('0x1d')](function(){return _0x35a0bf;});}else{return _0x35a0bf;}})[_0xe692('0x28')](function(_0x406142){logger[_0xe692('0x24')](_0xe692('0x61'),_0x406142);throw _0x406142;});}return _0x35a0bf;})[_0xe692('0x1d')](respondWithResult(_0x317de0,0xc9))[_0xe692('0x28')](handleError(_0x317de0,null));};exports[_0xe692('0x33')]=function(_0x303692,_0x4d6da5){if(_0x303692[_0xe692('0x5b')]['id']){delete _0x303692[_0xe692('0x5b')]['id'];}return db[_0xe692('0x51')][_0xe692('0x59')]({'where':{'id':_0x303692[_0xe692('0x57')]['id']},'include':[{'model':db[_0xe692('0x3b')],'as':_0xe692('0x62')}]})[_0xe692('0x1d')](handleEntityNotFound(_0x4d6da5,null))['then'](saveUpdates(_0x303692[_0xe692('0x5b')],null))[_0xe692('0x1d')](respondWithResult(_0x4d6da5,null))['catch'](handleError(_0x4d6da5,null));};exports['destroy']=function(_0x15cb77,_0x379cb9){return db[_0xe692('0x51')]['find']({'where':{'id':_0x15cb77[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x379cb9,null))[_0xe692('0x1d')](removeEntity(_0x379cb9,null))[_0xe692('0x28')](handleError(_0x379cb9,null));};exports['describe']=function(_0x2441eb,_0x3860af){return db[_0xe692('0x51')][_0xe692('0x63')]()[_0xe692('0x1d')](respondWithResult(_0x3860af,null))['catch'](handleError(_0x3860af,null));};exports['addDisposition']=function(_0x44e9be,_0x67d645,_0x168d9e){if(_0x44e9be[_0xe692('0x5b')]['id']){delete _0x44e9be[_0xe692('0x5b')]['id'];}return db[_0xe692('0x51')][_0xe692('0x59')]({'where':{'id':_0x44e9be['params']['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x67d645,null))[_0xe692('0x1d')](function(_0x3903a9){if(_0x3903a9){_0x44e9be[_0xe692('0x5b')]['OpenchannelAccountId']=_0x3903a9['id'];return db['Disposition'][_0xe692('0x5a')](_0x44e9be[_0xe692('0x5b')]);}})[_0xe692('0x1d')](respondWithResult(_0x67d645,null))[_0xe692('0x28')](handleError(_0x67d645,null));};exports[_0xe692('0x64')]=function(_0x17a3ea,_0x3ea6b0,_0x5a9544){var _0x5dc6ab={'raw':![],'where':{}};var _0x47120b={};var _0x339075={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe692('0x65')]({'where':{'id':_0x17a3ea[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x3ea6b0,null))[_0xe692('0x1d')](function(_0x135c83){if(_0x135c83){_0x47120b[_0xe692('0x3e')]=_[_0xe692('0x41')](db[_0xe692('0x66')][_0xe692('0x58')]);_0x47120b['query']=_[_0xe692('0x41')](_0x17a3ea[_0xe692('0x40')]);_0x47120b[_0xe692('0x42')]=_[_0xe692('0x44')](_0x47120b[_0xe692('0x3e')],_0x47120b[_0xe692('0x40')]);_0x5dc6ab['attributes']=_[_0xe692('0x44')](_0x47120b['model'],qs[_0xe692('0x45')](_0x17a3ea['query']['fields']));_0x5dc6ab[_0xe692('0x43')]=_0x5dc6ab['attributes'][_0xe692('0x46')]?_0x5dc6ab['attributes']:_0x47120b[_0xe692('0x3e')];if(!_0x17a3ea['query'][_0xe692('0x47')](_0xe692('0x48'))){_0x5dc6ab['limit']=qs[_0xe692('0x2d')](_0x17a3ea[_0xe692('0x40')]['limit']);_0x5dc6ab[_0xe692('0x2f')]=qs['offset'](_0x17a3ea[_0xe692('0x40')][_0xe692('0x2f')]);}_0x5dc6ab['order']=qs[_0xe692('0x4a')](_0x17a3ea['query'][_0xe692('0x4a')]);_0x5dc6ab[_0xe692('0x4b')]=qs[_0xe692('0x42')](_[_0xe692('0x4c')](_0x17a3ea[_0xe692('0x40')],_0x47120b[_0xe692('0x42')]));_0x5dc6ab[_0xe692('0x4b')][_0xe692('0x67')]=_0x135c83['id'];if(_0x17a3ea[_0xe692('0x40')]['filter']){_0x5dc6ab[_0xe692('0x4b')]=_[_0xe692('0x4f')](_0x5dc6ab[_0xe692('0x4b')],{'$or':_[_0xe692('0x3f')](_0x5dc6ab[_0xe692('0x43')],function(_0x13b4c2){var _0x3f1643={};_0x3f1643[_0x13b4c2]={'$like':'%'+_0x17a3ea[_0xe692('0x40')][_0xe692('0x4d')]+'%'};return _0x3f1643;})});}_0x5dc6ab=_[_0xe692('0x4f')]({},_0x5dc6ab,_0x17a3ea['options']);return db[_0xe692('0x66')]['count']({'where':_0x5dc6ab['where']})[_0xe692('0x1d')](function(_0x3b48d4){_0x339075[_0xe692('0x2e')]=_0x3b48d4;if(_0x17a3ea[_0xe692('0x40')][_0xe692('0x52')]){_0x5dc6ab[_0xe692('0x53')]=[{'all':!![]}];}return db[_0xe692('0x66')][_0xe692('0x54')](_0x5dc6ab);})[_0xe692('0x1d')](function(_0x549d27){_0x339075['rows']=_0x549d27;return _0x339075;});}})[_0xe692('0x1d')](respondWithFilteredResult(_0x3ea6b0,_0x5dc6ab))[_0xe692('0x28')](handleError(_0x3ea6b0,null));};exports[_0xe692('0x68')]=function(_0xba440d,_0x2b0b98,_0x5cb40a){return db[_0xe692('0x51')]['find']({'where':{'id':_0xba440d[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x2b0b98,null))[_0xe692('0x1d')](function(_0x237477){if(_0x237477){return _0x237477['removeDispositions'](_0xba440d[_0xe692('0x40')][_0xe692('0x69')]);}})[_0xe692('0x1d')](respondWithStatusCode(_0x2b0b98,null))[_0xe692('0x28')](handleError(_0x2b0b98,null));};exports['addAnswer']=function(_0x39127c,_0x393773,_0x1e69f2){if(_0x39127c[_0xe692('0x5b')]['id']){delete _0x39127c[_0xe692('0x5b')]['id'];}return db['OpenchannelAccount'][_0xe692('0x59')]({'where':{'id':_0x39127c[_0xe692('0x57')]['id']}})['then'](handleEntityNotFound(_0x393773,null))[_0xe692('0x1d')](function(_0x23dbf3){if(_0x23dbf3){_0x39127c[_0xe692('0x5b')][_0xe692('0x67')]=_0x23dbf3['id'];return db['CannedAnswer'][_0xe692('0x5a')](_0x39127c['body']);}})['then'](respondWithResult(_0x393773,null))[_0xe692('0x28')](handleError(_0x393773,null));};exports[_0xe692('0x6a')]=function(_0x1ae89d,_0x4f7458,_0x22b8ce){var _0x89f299={'raw':![],'where':{}};var _0x259fc1={};var _0x61df5f={'count':0x0,'rows':[]};return db[_0xe692('0x51')]['findOne']({'where':{'id':_0x1ae89d[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x4f7458,null))['then'](function(_0x3e431c){if(_0x3e431c){_0x259fc1[_0xe692('0x3e')]=_[_0xe692('0x41')](db['CannedAnswer'][_0xe692('0x58')]);_0x259fc1[_0xe692('0x40')]=_['keys'](_0x1ae89d[_0xe692('0x40')]);_0x259fc1['filters']=_[_0xe692('0x44')](_0x259fc1['model'],_0x259fc1[_0xe692('0x40')]);_0x89f299[_0xe692('0x43')]=_[_0xe692('0x44')](_0x259fc1[_0xe692('0x3e')],qs[_0xe692('0x45')](_0x1ae89d[_0xe692('0x40')]['fields']));_0x89f299[_0xe692('0x43')]=_0x89f299[_0xe692('0x43')][_0xe692('0x46')]?_0x89f299[_0xe692('0x43')]:_0x259fc1[_0xe692('0x3e')];if(!_0x1ae89d['query'][_0xe692('0x47')](_0xe692('0x48'))){_0x89f299['limit']=qs[_0xe692('0x2d')](_0x1ae89d[_0xe692('0x40')][_0xe692('0x2d')]);_0x89f299['offset']=qs[_0xe692('0x2f')](_0x1ae89d[_0xe692('0x40')]['offset']);}_0x89f299[_0xe692('0x49')]=qs[_0xe692('0x4a')](_0x1ae89d[_0xe692('0x40')]['sort']);_0x89f299[_0xe692('0x4b')]=qs[_0xe692('0x42')](_['pick'](_0x1ae89d[_0xe692('0x40')],_0x259fc1[_0xe692('0x42')]));_0x89f299[_0xe692('0x4b')][_0xe692('0x67')]=_0x3e431c['id'];if(_0x1ae89d['query'][_0xe692('0x4d')]){_0x89f299[_0xe692('0x4b')]=_[_0xe692('0x4f')](_0x89f299[_0xe692('0x4b')],{'$or':_[_0xe692('0x3f')](_0x89f299[_0xe692('0x43')],function(_0x4b1f4b){var _0x4a3c99={};_0x4a3c99[_0x4b1f4b]={'$like':'%'+_0x1ae89d['query'][_0xe692('0x4d')]+'%'};return _0x4a3c99;})});}_0x89f299=_[_0xe692('0x4f')]({},_0x89f299,_0x1ae89d[_0xe692('0x50')]);return db['CannedAnswer']['count']({'where':_0x89f299[_0xe692('0x4b')]})[_0xe692('0x1d')](function(_0x5871e2){_0x61df5f[_0xe692('0x2e')]=_0x5871e2;if(_0x1ae89d[_0xe692('0x40')][_0xe692('0x52')]){_0x89f299['include']=[{'all':!![]}];}return db[_0xe692('0x6b')][_0xe692('0x54')](_0x89f299);})[_0xe692('0x1d')](function(_0x17d51d){_0x61df5f[_0xe692('0x55')]=_0x17d51d;return _0x61df5f;});}})[_0xe692('0x1d')](respondWithFilteredResult(_0x4f7458,_0x89f299))[_0xe692('0x28')](handleError(_0x4f7458,null));};exports[_0xe692('0x6c')]=function(_0x29a8a1,_0x4d9be8,_0x5db4df){return db[_0xe692('0x51')][_0xe692('0x59')]({'where':{'id':_0x29a8a1[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x4d9be8,null))[_0xe692('0x1d')](function(_0x4d858d){if(_0x4d858d){return _0x4d858d[_0xe692('0x6c')](_0x29a8a1[_0xe692('0x40')][_0xe692('0x69')]);}})[_0xe692('0x1d')](respondWithStatusCode(_0x4d9be8,null))[_0xe692('0x28')](handleError(_0x4d9be8,null));};exports[_0xe692('0x6d')]=function(_0x25284f,_0x2fa818,_0x51b7b1){var _0x431453={'body':_0x25284f[_0xe692('0x5b')],'channel':_0xe692('0x6e')};var _0x14e400=[];var _0x18195f=[];var _0x3cfca3={};var _0x9d3b75=![];return db[_0xe692('0x6f')][_0xe692('0x63')]()[_0xe692('0x1d')](function(_0x31dd16){if(!_0x31dd16){throw new db['Sequelize'][(_0xe692('0x70'))](_0xe692('0x71'));}_0x14e400=_[_0xe692('0x72')](_['keys'](_0x31dd16),[_0xe692('0x73'),_0xe692('0x74')]);_0x18195f=_['difference'](_['keys'](_0x31dd16),[_0xe692('0x73'),_0xe692('0x74'),_0xe692('0x75'),'ListId']);if(_0x25284f[_0xe692('0x5b')]['id']){delete _0x25284f['body']['id'];}if(_['isNil'](_0x25284f[_0xe692('0x5b')]['from'])){throw new db[(_0xe692('0x76'))]['ValidationError'](_0xe692('0x77'));}if(_[_0xe692('0x78')](_0x25284f[_0xe692('0x5b')][_0xe692('0x5b')])||_0x25284f['body'][_0xe692('0x5b')]===''){throw new db['Sequelize'][(_0xe692('0x70'))](_0xe692('0x79'));}if(_['isNil'](_0x25284f[_0xe692('0x5b')][_0xe692('0x7a')])){throw new db[(_0xe692('0x76'))][(_0xe692('0x70'))](_0xe692('0x7b')+_0x18195f);}if(!_[_0xe692('0x7c')](_0x18195f,_0x25284f[_0xe692('0x5b')]['mapKey'])){throw new db[(_0xe692('0x76'))]['ValidationError'](_0xe692('0x7d')+_0x18195f);}_0x3cfca3[_0x25284f[_0xe692('0x5b')]['mapKey']]=_0x25284f[_0xe692('0x5b')][_0xe692('0x7e')];})['then'](function(){return db[_0xe692('0x51')][_0xe692('0x59')]({'where':{'id':_0x25284f[_0xe692('0x57')]['id']},'include':[{'model':db[_0xe692('0x7f')],'as':_0xe692('0x80'),'include':[{'model':db[_0xe692('0x6f')],'as':_0xe692('0x81'),'where':_0x3cfca3,'limit':0x1,'order':[[_0xe692('0x74'),_0xe692('0x82')]]}]},{'model':db[_0xe692('0x83')],'as':'Applications'}]});})[_0xe692('0x1d')](handleEntityNotFound(_0x2fa818,null))[_0xe692('0x1d')](function(_0x4aa7d4){if(_0x4aa7d4&&_0x4aa7d4[_0xe692('0x80')]){_0x431453[_0xe692('0x84')]=_0x4aa7d4;_0x431453['applications']=_0x4aa7d4[_0xe692('0x85')];_0x431453[_0xe692('0x86')]=_0x4aa7d4[_0xe692('0x80')];_0x431453[_0xe692('0x87')]=_[_0xe692('0x88')](_0x431453[_0xe692('0x87')],[_0xe692('0x89')],[_0xe692('0x8a')]);if(_0x431453[_0xe692('0x84')][_0xe692('0x85')]){delete _0x431453['account']['Applications'];}if(_0x431453['account'][_0xe692('0x80')]&&_0x431453[_0xe692('0x84')]['List'][_0xe692('0x81')]['length']){return _0x431453['account'][_0xe692('0x80')][_0xe692('0x81')][0x0];}var _0x49360b=_[_0xe692('0x15')](_0x25284f[_0xe692('0x5b')],{'firstName':_0x25284f[_0xe692('0x5b')][_0xe692('0x7e')],'ListId':_0x4aa7d4[_0xe692('0x8b')]});_0x49360b[_0x25284f[_0xe692('0x5b')][_0xe692('0x7a')]]=_0x25284f[_0xe692('0x5b')][_0xe692('0x7e')];return db[_0xe692('0x6f')]['create'](_0x49360b,{'fields':_0x14e400,'raw':!![]});}})[_0xe692('0x1d')](handleEntityNotFound(_0x2fa818,null))[_0xe692('0x1d')](function(_0x4fa5c5){_0x431453[_0xe692('0x8c')]=_0x4fa5c5;if(_0x4fa5c5){var _0x1d7d5f={'ContactId':_0x4fa5c5['id'],'OpenchannelAccountId':_0x25284f[_0xe692('0x57')]['id'],'from':(_0x4fa5c5[_0xe692('0x8d')]||'')+'\x20'+(_0x4fa5c5[_0xe692('0x8e')]||'')};var _0xefa762={'OpenchannelAccountId':_0x25284f[_0xe692('0x57')]['id'],'closed':![]};if(_0x25284f[_0xe692('0x5b')]['threadId']){_0xefa762[_0xe692('0x8f')]=_0x25284f[_0xe692('0x5b')]['threadId'];return db[_0xe692('0x90')][_0xe692('0x59')]({'where':_0xefa762})[_0xe692('0x1d')](function(_0x1c0071){if(_0x1c0071){return[_0x1c0071,![]];}_0x1d7d5f[_0xe692('0x8f')]=_0x25284f[_0xe692('0x5b')][_0xe692('0x8f')];_0x1d7d5f[_0xe692('0x91')]=_0x25284f['body']['externalUrl'];return db[_0xe692('0x90')][_0xe692('0x5a')](_0x1d7d5f)[_0xe692('0x1d')](function(_0xd38a65){return[_0xd38a65,!![]];});});}else{_0xefa762[_0xe692('0x8f')]=null;}_0xefa762[_0xe692('0x92')]=_0x4fa5c5['id'];return db[_0xe692('0x90')][_0xe692('0x59')]({'where':_0xefa762})['then'](function(_0x1cb1a1){if(_0x1cb1a1){return[_0x1cb1a1,![]];}return db[_0xe692('0x90')][_0xe692('0x5a')](_0x1d7d5f)[_0xe692('0x1d')](function(_0x3fe779){return[_0x3fe779,!![]];});});}})[_0xe692('0x93')](function(_0x4c9ba3,_0x41e2d7){if(_0x4c9ba3){_0x9d3b75=_0x41e2d7;if(!_0x41e2d7){var _0x7c7ab5={'from':(_0x431453[_0xe692('0x8c')][_0xe692('0x8d')]||'')+'\x20'+(_0x431453[_0xe692('0x8c')][_0xe692('0x8e')]||'')};if(_0x25284f[_0xe692('0x5b')][_0xe692('0x8f')]&&_0x25284f[_0xe692('0x5b')]['messageId']&&_0x25284f[_0xe692('0x5b')][_0xe692('0x8f')]!=_0x25284f[_0xe692('0x5b')]['messageId']){_0x7c7ab5[_0xe692('0x8f')]=_0x25284f['body'][_0xe692('0x94')];}return _0x4c9ba3['update'](_0x7c7ab5);}else{return _0x4c9ba3;}}})['then'](function(_0x573be6){_0x431453[_0xe692('0x95')]=_0x573be6['get']({'plain':!![]});_0x431453[_0xe692('0x95')]['created']=_0x9d3b75;if(_0x431453[_0xe692('0x95')][_0xe692('0x96')]){if(_0x431453[_0xe692('0x84')]['autoclose']){_0x431453[_0xe692('0x87')]['push']({'id':0x0,'priority':_0x431453[_0xe692('0x87')][_0xe692('0x46')]+0x1,'app':_0xe692('0x97'),'appdata':_0xe692('0x98'),'interval':_0xe692('0x99')});}}return db['OpenchannelMessage'][_0xe692('0x5a')]({'body':_0x25284f[_0xe692('0x5b')][_0xe692('0x5b')],'OpenchannelAccountId':_0x25284f[_0xe692('0x57')]['id'],'OpenchannelInteractionId':_0x573be6['id'],'direction':'in','ContactId':_0x431453[_0xe692('0x8c')]['id'],'AttachmentId':_0x25284f['body'][_0xe692('0x9a')]});})[_0xe692('0x1d')](function(_0x2a7a87){_0x431453[_0xe692('0x26')]=_0x2a7a87;if(_0x431453['interaction'][_0xe692('0x9b')]){return db[_0xe692('0x9c')][_0xe692('0x59')]({'attributes':['id',_0xe692('0x39')],'where':{'id':_0x431453[_0xe692('0x95')][_0xe692('0x9b')]}})[_0xe692('0x1d')](function(_0x169d54){if(_0x169d54){_0x431453[_0xe692('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x169d54['name']+','+(_0x431453['account'][_0xe692('0x9d')]||0xa),'interval':_0xe692('0x99')});_0x431453['forcedOwnership']=![];}return respondWithRpcPromise(_0xe692('0x9e'),'startRouting',_0x431453);});}return respondWithRpcPromise(_0xe692('0x9e'),'startRouting',_0x431453);})[_0xe692('0x1d')](function(_0x26c803){respondWithRpcPromise(_0xe692('0x9f'),'EventManager',{'event':'notify','message':_0x26c803},client9002);return _0x26c803;})[_0xe692('0x1d')](respondWithResult(_0x2fa818,null))[_0xe692('0x28')](handleError(_0x2fa818,null));};exports[_0xe692('0xa0')]=function(_0x8eb56f,_0x563c8b,_0x58a9dd){return db['OpenchannelAccount'][_0xe692('0x65')]({'where':{'id':_0x8eb56f[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x563c8b,null))[_0xe692('0x1d')](function(_0x105604){if(_0x105604){return db[_0xe692('0xa1')]['transaction'](function(_0x25c79f){return db[_0xe692('0x83')][_0xe692('0x37')]({'where':{'OpenchannelAccountId':_0x8eb56f[_0xe692('0x57')]['id']},'transaction':_0x25c79f})['then'](function(_0x2f5320){var _0x42b084=_['map'](_0x8eb56f[_0xe692('0x5b')],function(_0x314446){_0x314446[_0xe692('0x67')]=_0x8eb56f[_0xe692('0x57')]['id'];return _0x314446;});return db[_0xe692('0x83')][_0xe692('0xa2')](_0x42b084,{'transaction':_0x25c79f});});})[_0xe692('0x1d')](function(){return db[_0xe692('0x83')][_0xe692('0xa3')]({'where':{'OpenchannelAccountId':_0x8eb56f[_0xe692('0x57')]['id']},'order':_0xe692('0x89')});});}})[_0xe692('0x1d')](respondWithResult(_0x563c8b,null))[_0xe692('0x28')](handleError(_0x563c8b,null));};exports[_0xe692('0xa4')]=function(_0xdc5fd1,_0x421827,_0x2e9878){var _0x22c9b7={};var _0x519357={};var _0x301d6f;var _0xa2536c;return db[_0xe692('0x51')]['findOne']({'where':{'id':_0xdc5fd1[_0xe692('0x57')]['id']}})['then'](handleEntityNotFound(_0x421827,null))[_0xe692('0x1d')](function(_0x1f5d7){if(_0x1f5d7){_0x301d6f=_0x1f5d7;_0x519357[_0xe692('0x3e')]=_[_0xe692('0x41')](db[_0xe692('0x83')][_0xe692('0x58')]);_0x519357[_0xe692('0x40')]=_[_0xe692('0x41')](_0xdc5fd1['query']);_0x519357['filters']=_[_0xe692('0x44')](_0x519357['model'],_0x519357[_0xe692('0x40')]);_0x22c9b7[_0xe692('0x43')]=_[_0xe692('0x44')](_0x519357[_0xe692('0x3e')],qs['fields'](_0xdc5fd1['query'][_0xe692('0x45')]));_0x22c9b7[_0xe692('0x43')]=_0x22c9b7[_0xe692('0x43')][_0xe692('0x46')]?_0x22c9b7[_0xe692('0x43')]:_0x519357[_0xe692('0x3e')];_0x22c9b7[_0xe692('0x49')]=qs[_0xe692('0x4a')](_0xdc5fd1['query']['sort']);_0x22c9b7[_0xe692('0x4b')]=qs['filters'](_[_0xe692('0x4c')](_0xdc5fd1['query'],_0x519357[_0xe692('0x42')]));if(_0xdc5fd1[_0xe692('0x40')][_0xe692('0x4d')]){_0x22c9b7[_0xe692('0x4b')]=_['merge'](_0x22c9b7[_0xe692('0x4b')],{'$or':_[_0xe692('0x3f')](_0x22c9b7[_0xe692('0x43')],function(_0x4f7a1c){var _0x1b6d0f={};_0x1b6d0f[_0x4f7a1c]={'$like':'%'+_0xdc5fd1[_0xe692('0x40')][_0xe692('0x4d')]+'%'};return _0x1b6d0f;})});}_0x22c9b7=_[_0xe692('0x4f')]({},_0x22c9b7,_0xdc5fd1[_0xe692('0x50')]);return _0x301d6f[_0xe692('0xa4')](_0x22c9b7);}})[_0xe692('0x1d')](function(_0xc643b2){if(_0xc643b2){_0xa2536c=_0xc643b2[_0xe692('0x46')];if(!_0xdc5fd1['query'][_0xe692('0x47')](_0xe692('0x48'))){_0x22c9b7[_0xe692('0x2d')]=qs[_0xe692('0x2d')](_0xdc5fd1[_0xe692('0x40')][_0xe692('0x2d')]);_0x22c9b7[_0xe692('0x2f')]=qs['offset'](_0xdc5fd1[_0xe692('0x40')][_0xe692('0x2f')]);}return _0x301d6f[_0xe692('0xa4')](_0x22c9b7);}})[_0xe692('0x1d')](function(_0x2e3aac){if(_0x2e3aac){return _0x2e3aac?{'count':_0xa2536c,'rows':_0x2e3aac}:null;}})[_0xe692('0x1d')](respondWithResult(_0x421827,null))['catch'](handleError(_0x421827,null));};exports['getInteractions']=function(_0x42e3b6,_0x331095,_0x4cf42d){var _0x53a4ea={'raw':![],'where':{}};var _0x3e9b54={};var _0x1d1042={'count':0x0,'rows':[]};return db[_0xe692('0x51')][_0xe692('0x65')]({'where':{'id':_0x42e3b6[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x331095,null))[_0xe692('0x1d')](function(_0x102f12){if(_0x102f12){_0x3e9b54[_0xe692('0x3e')]=_['keys'](db[_0xe692('0x90')][_0xe692('0x58')]);_0x3e9b54[_0xe692('0x40')]=_['keys'](_0x42e3b6[_0xe692('0x40')]);_0x3e9b54[_0xe692('0x42')]=_[_0xe692('0x44')](_0x3e9b54[_0xe692('0x3e')],_0x3e9b54[_0xe692('0x40')]);_0x53a4ea[_0xe692('0x43')]=_[_0xe692('0x44')](_0x3e9b54['model'],qs['fields'](_0x42e3b6[_0xe692('0x40')]['fields']));_0x53a4ea[_0xe692('0x43')]=_0x53a4ea[_0xe692('0x43')][_0xe692('0x46')]?_0x53a4ea[_0xe692('0x43')]:_0x3e9b54[_0xe692('0x3e')];if(!_0x42e3b6[_0xe692('0x40')][_0xe692('0x47')](_0xe692('0x48'))){_0x53a4ea[_0xe692('0x2d')]=qs[_0xe692('0x2d')](_0x42e3b6['query'][_0xe692('0x2d')]);_0x53a4ea[_0xe692('0x2f')]=qs[_0xe692('0x2f')](_0x42e3b6['query']['offset']);}_0x53a4ea[_0xe692('0x49')]=qs[_0xe692('0x4a')](_0x42e3b6[_0xe692('0x40')][_0xe692('0x4a')]);_0x53a4ea['where']=qs[_0xe692('0x42')](_[_0xe692('0x4c')](_0x42e3b6['query'],_0x3e9b54[_0xe692('0x42')]));_0x53a4ea['where'][_0xe692('0x67')]=_0x102f12['id'];if(_0x42e3b6[_0xe692('0x40')]['filter']){_0x53a4ea[_0xe692('0x4b')]=_[_0xe692('0x4f')](_0x53a4ea['where'],{'$or':_['map'](_0x53a4ea['attributes'],function(_0x33e8c3){var _0x48ada9={};_0x48ada9[_0x33e8c3]={'$like':'%'+_0x42e3b6[_0xe692('0x40')][_0xe692('0x4d')]+'%'};return _0x48ada9;})});}_0x53a4ea=_[_0xe692('0x4f')]({},_0x53a4ea,_0x42e3b6[_0xe692('0x50')]);return db[_0xe692('0x90')][_0xe692('0x2e')]({'where':_0x53a4ea[_0xe692('0x4b')]})[_0xe692('0x1d')](function(_0x47b0c6){_0x1d1042[_0xe692('0x2e')]=_0x47b0c6;if(_0x42e3b6[_0xe692('0x40')]['includeAll']){_0x53a4ea[_0xe692('0x53')]=[{'model':db[_0xe692('0x6f')],'as':_0xe692('0xa5'),'required':![]},{'model':db['User'],'as':_0xe692('0xa6'),'attributes':[_0xe692('0x39'),_0xe692('0xa7'),'internal'],'required':![]},{'model':db[_0xe692('0xa8')],'as':'Tags','attributes':['id',_0xe692('0x39'),'color'],'where':_0x42e3b6[_0xe692('0x40')][_0xe692('0xa9')]?{'id':_0x42e3b6[_0xe692('0x40')][_0xe692('0xa9')]}:undefined,'required':_0x42e3b6[_0xe692('0x40')][_0xe692('0xa9')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x53a4ea);})['then'](function(_0x240801){_0x1d1042[_0xe692('0x55')]=_0x240801;return _0x1d1042;});}})[_0xe692('0x1d')](respondWithFilteredResult(_0x331095,_0x53a4ea))[_0xe692('0x28')](handleError(_0x331095,null));};exports[_0xe692('0xaa')]=function(_0x297dd8,_0x15e618,_0x13485b){return db['OpenchannelAccount'][_0xe692('0x59')]({'where':{'id':_0x297dd8[_0xe692('0x57')]['id']}})['then'](handleEntityNotFound(_0x15e618,null))[_0xe692('0x1d')](function(_0x27bb0c){if(_0x27bb0c){return _0x27bb0c[_0xe692('0xaa')](_0x297dd8[_0xe692('0x5b')][_0xe692('0x69')],_[_0xe692('0xab')](_0x297dd8[_0xe692('0x5b')],['ids','id'])||{})[_0xe692('0x93')](function(_0x1daaa1){for(var _0x37a49b=0x0;_0x37a49b<_0x297dd8[_0xe692('0x5b')][_0xe692('0x69')]['length'];_0x37a49b+=0x1){socket[_0xe692('0xac')](_0xe692('0xad'),{'UserId':_0x297dd8['body'][_0xe692('0x69')][_0x37a49b],'OpenchannelAccountId':_0x297dd8[_0xe692('0x57')]['id']});}return _0x1daaa1;});}})['then'](respondWithResult(_0x15e618,null))['catch'](handleError(_0x15e618,null));};exports[_0xe692('0xae')]=function(_0xed2dcd,_0x16cdb5,_0x3f950e){return db[_0xe692('0x51')]['find']({'where':{'id':_0xed2dcd[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x16cdb5,null))['then'](function(_0x59b070){if(_0x59b070){return _0x59b070['removeAgents'](_0xed2dcd[_0xe692('0x40')][_0xe692('0x69')])[_0xe692('0x1d')](function(){if(_[_0xe692('0xaf')](_0xed2dcd[_0xe692('0x40')][_0xe692('0x69')])){for(var _0x5170a9=0x0;_0x5170a9<_0xed2dcd[_0xe692('0x40')][_0xe692('0x69')][_0xe692('0x46')];_0x5170a9+=0x1){socket[_0xe692('0xac')](_0xe692('0xb0'),{'UserId':Number(_0xed2dcd['query'][_0xe692('0x69')][_0x5170a9]),'OpenchannelAccountId':Number(_0xed2dcd['params']['id'])});}}else{socket[_0xe692('0xac')](_0xe692('0xb0'),{'UserId':Number(_0xed2dcd[_0xe692('0x40')][_0xe692('0x69')]),'OpenchannelAccountId':Number(_0xed2dcd[_0xe692('0x57')]['id'])});}});}})[_0xe692('0x1d')](respondWithStatusCode(_0x16cdb5,null))[_0xe692('0x28')](handleError(_0x16cdb5,null));};exports[_0xe692('0xb1')]=function(_0xd11039,_0x3d6ca5,_0x593d25){var _0x3d556e={};var _0x3c46c8={};var _0x2e464c;var _0x32c850;return db['OpenchannelAccount'][_0xe692('0x65')]({'where':{'id':_0xd11039[_0xe692('0x57')]['id']}})['then'](handleEntityNotFound(_0x3d6ca5,null))['then'](function(_0x9267d){if(_0x9267d){_0x2e464c=_0x9267d;_0x3c46c8['model']=_[_0xe692('0x41')](db[_0xe692('0x9c')][_0xe692('0x58')]);_0x3c46c8[_0xe692('0x40')]=_[_0xe692('0x41')](_0xd11039['query']);_0x3c46c8[_0xe692('0x42')]=_[_0xe692('0x44')](_0x3c46c8[_0xe692('0x3e')],_0x3c46c8['query']);_0x3d556e[_0xe692('0x43')]=_[_0xe692('0x44')](_0x3c46c8[_0xe692('0x3e')],qs[_0xe692('0x45')](_0xd11039[_0xe692('0x40')][_0xe692('0x45')]));_0x3d556e[_0xe692('0x43')]=_0x3d556e['attributes'][_0xe692('0x46')]?_0x3d556e[_0xe692('0x43')]:_0x3c46c8[_0xe692('0x3e')];_0x3d556e[_0xe692('0x49')]=qs[_0xe692('0x4a')](_0xd11039[_0xe692('0x40')][_0xe692('0x4a')]);_0x3d556e[_0xe692('0x4b')]=qs[_0xe692('0x42')](_[_0xe692('0x4c')](_0xd11039['query'],_0x3c46c8[_0xe692('0x42')]));if(_0xd11039[_0xe692('0x40')][_0xe692('0x4d')]){_0x3d556e[_0xe692('0x4b')]=_['merge'](_0x3d556e['where'],{'$or':_[_0xe692('0x3f')](_0x3d556e[_0xe692('0x43')],function(_0x10945b){var _0x1fba46={};_0x1fba46[_0x10945b]={'$like':'%'+_0xd11039[_0xe692('0x40')][_0xe692('0x4d')]+'%'};return _0x1fba46;})});}_0x3d556e=_[_0xe692('0x4f')]({},_0x3d556e,_0xd11039[_0xe692('0x50')]);return _0x2e464c[_0xe692('0xb1')](_0x3d556e);}})[_0xe692('0x1d')](function(_0x524441){if(_0x524441){_0x32c850=_0x524441['length'];if(!_0xd11039[_0xe692('0x40')][_0xe692('0x47')](_0xe692('0x48'))){_0x3d556e[_0xe692('0x2d')]=qs[_0xe692('0x2d')](_0xd11039[_0xe692('0x40')][_0xe692('0x2d')]);_0x3d556e[_0xe692('0x2f')]=qs[_0xe692('0x2f')](_0xd11039[_0xe692('0x40')]['offset']);}return _0x2e464c[_0xe692('0xb1')](_0x3d556e);}})['then'](function(_0x1b464d){if(_0x1b464d){return _0x1b464d?{'count':_0x32c850,'rows':_0x1b464d}:null;}})[_0xe692('0x1d')](respondWithResult(_0x3d6ca5,null))[_0xe692('0x28')](handleError(_0x3d6ca5,null));};exports[_0xe692('0xb2')]=function(_0x4aac7c,_0x5747dc,_0x425c72){var _0x5ce9bc,_0x26ac46,_0x533676;if(_['isNil'](_0x4aac7c[_0xe692('0x5b')][_0xe692('0x5b')])||_0x4aac7c[_0xe692('0x5b')][_0xe692('0x5b')]===''){throw new db[(_0xe692('0x76'))][(_0xe692('0x70'))](_0xe692('0x79'));}if(_[_0xe692('0x78')](_0x4aac7c[_0xe692('0x5b')]['to'])){}_0x5ce9bc=_0x4aac7c[_0xe692('0x5b')]['to'];return db['OpenchannelAccount'][_0xe692('0x65')]({'where':{'id':_0x4aac7c[_0xe692('0x57')]['id']}})[_0xe692('0x1d')](handleEntityNotFound(_0x5747dc,null))['then'](function(_0x4e8810){if(_0x4e8810){return db['OpenchannelAccount'][_0xe692('0x59')]({'where':{'id':_0x4e8810['id']},'include':[{'model':db[_0xe692('0x7f')],'as':'List','include':[{'model':db[_0xe692('0x6f')],'as':_0xe692('0x81'),'where':{[_0x4e8810[_0xe692('0x7a')]]:_0x5ce9bc},'limit':0x1,'order':[[_0xe692('0x74'),_0xe692('0x82')]]}]}]})[_0xe692('0x1d')](handleEntityNotFound(_0x5747dc,null))['then'](function(_0x5802f8){if(_0x5802f8&&_0x5802f8[_0xe692('0x80')]){_0x26ac46=_0x5802f8['get']({'plain':!![]});if(_0x26ac46[_0xe692('0x80')]&&_0x26ac46['List']['Contacts']['length']){return _0x26ac46['List'][_0xe692('0x81')][0x0];}return db[_0xe692('0x6f')][_0xe692('0x5a')](_['defaults'](_0x4aac7c[_0xe692('0x5b')],{'firstName':_0x5ce9bc,[_0x5802f8[_0xe692('0x7a')]]:_0x5ce9bc,'phone':_0x5ce9bc,'ListId':_0x26ac46[_0xe692('0x8b')]}));}})['then'](handleEntityNotFound(_0x5747dc,null))['then'](function(_0x4ef5f3){if(_0x4ef5f3){_0x533676=_0x4ef5f3;return db[_0xe692('0x90')]['find']({'where':{'ContactId':_0x533676['id'],'closed':![],'OpenchannelAccountId':_0x26ac46['id']}})[_0xe692('0x1d')](function(_0x10f91c){if(_0x10f91c){return[_0x10f91c,![]];}return db['OpenchannelInteraction'][_0xe692('0x5a')]({'UserId':_0x4aac7c[_0xe692('0x5c')]['id'],'ContactId':_0x533676['id'],'OpenchannelAccountId':_0x26ac46['id'],'lastMsgDirection':_0xe692('0xb3'),'Messages':[_['merge'](_0x4aac7c['body'],{'read':![],'body':_0x4aac7c[_0xe692('0x5b')][_0xe692('0x5b')],'OpenchannelAccountId':_0x26ac46['id'],'UserId':_0x4aac7c['user']['id'],'ContactId':_0x533676['id']})]},{'include':[{'model':db[_0xe692('0xb4')],'as':_0xe692('0xb5')}]})[_0xe692('0x1d')](function(_0xc78f6f){return[_0xc78f6f,!![]];});});}})[_0xe692('0x93')](function(_0x4c33ed,_0x215b37){if(_0x215b37){return _0x4c33ed;}return db[_0xe692('0xb4')][_0xe692('0x5a')](_[_0xe692('0x4f')](_0x4aac7c['body'],{'read':![],'body':_0x4aac7c[_0xe692('0x5b')]['body'],'OpenchannelAccountId':_0x26ac46['id'],'OpenchannelInteractionId':_0x4c33ed['id'],'UserId':_0x4aac7c[_0xe692('0x5c')]['id'],'ContactId':_0x533676['id']}))['then'](function(_0xc9eede){_0x4c33ed[_0xe692('0xb6')][_0xe692('0xb5')]=[];_0x4c33ed['dataValues']['Messages']['push'](_0xc9eede[_0xe692('0xb6')]);return _0x4c33ed;});});}})['then'](respondWithResult(_0x5747dc,null))['catch'](handleError(_0x5747dc,null));}; \ No newline at end of file +var _0x55da=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','Pause','map','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelAccount','includeAll','findAll','rows','catch','params','mandatoryDispositionPause','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','created','interaction','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','user','dataValues','Messages','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x37393d,_0x2b39ae){var _0x77ba44=function(_0x267aa2){while(--_0x267aa2){_0x37393d['push'](_0x37393d['shift']());}};_0x77ba44(++_0x2b39ae);}(_0x55da,0x16f));var _0xa55d=function(_0x1717da,_0x28a802){_0x1717da=_0x1717da-0x0;var _0x4559fe=_0x55da[_0x1717da];return _0x4559fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa55d('0x0'));var zipdir=require(_0xa55d('0x1'));var jsonpatch=require(_0xa55d('0x2'));var rp=require(_0xa55d('0x3'));var moment=require(_0xa55d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa55d('0x5'));var util=require(_0xa55d('0x6'));var path=require(_0xa55d('0x7'));var sox=require('sox');var csv=require(_0xa55d('0x8'));var ejs=require(_0xa55d('0x9'));var fs=require('fs');var fs_extra=require(_0xa55d('0xa'));var _=require(_0xa55d('0xb'));var squel=require(_0xa55d('0xc'));var crypto=require(_0xa55d('0xd'));var jsforce=require(_0xa55d('0xe'));var deskjs=require(_0xa55d('0xf'));var toCsv=require(_0xa55d('0x8'));var querystring=require('querystring');var Papa=require(_0xa55d('0x10'));var Redis=require(_0xa55d('0x11'));var authService=require(_0xa55d('0x12'));var qs=require(_0xa55d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa55d('0x14'));var logger=require(_0xa55d('0x15'))(_0xa55d('0x16'));var utils=require(_0xa55d('0x17'));var config=require(_0xa55d('0x18'));var licenseUtil=require(_0xa55d('0x19'));var db=require('../../mysqldb')['db'];config[_0xa55d('0x1a')]=_[_0xa55d('0x1b')](config[_0xa55d('0x1a')],{'host':_0xa55d('0x1c'),'port':0x18eb});var socket=require(_0xa55d('0x1d'))(new Redis(config[_0xa55d('0x1a')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xa55d('0x1e'));var client=jayson['client'][_0xa55d('0x1f')]({'port':0x232c});var client9002=jayson[_0xa55d('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14f4c8,_0x75789f,_0x357a64,_0x3f6ad8){return new BPromise(function(_0x5311eb,_0x1df5d6){var _0x2d47b9=_0x3f6ad8||client;return _0x2d47b9['request'](_0x14f4c8,_0x357a64)['then'](function(_0x4523b2){logger[_0xa55d('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x75789f,_0xa55d('0x22'));logger[_0xa55d('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x75789f,_0xa55d('0x22'),JSON[_0xa55d('0x24')](_0x4523b2));if(_0x4523b2[_0xa55d('0x25')]){if(_0x4523b2[_0xa55d('0x25')][_0xa55d('0x26')]===0x1f4){logger[_0xa55d('0x25')](_0xa55d('0x27'),_0x75789f,_0x4523b2[_0xa55d('0x25')][_0xa55d('0x28')]);return _0x1df5d6(_0x4523b2[_0xa55d('0x25')][_0xa55d('0x28')]);}logger[_0xa55d('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x75789f,_0x4523b2['error'][_0xa55d('0x28')]);return _0x5311eb(_0x4523b2[_0xa55d('0x25')][_0xa55d('0x28')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x75789f,'request\x20sent');_0x5311eb(_0x4523b2['result'][_0xa55d('0x28')]);}})['catch'](function(_0xf68eb7){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x75789f,_0xf68eb7);_0x1df5d6(_0xf68eb7);});});}function respondWithStatusCode(_0x7aeb81,_0x3f3e01){_0x3f3e01=_0x3f3e01||0xcc;return function(_0x4e6963){if(_0x4e6963){return _0x7aeb81[_0xa55d('0x29')](_0x3f3e01);}return _0x7aeb81[_0xa55d('0x2a')](_0x3f3e01)[_0xa55d('0x2b')]();};}function respondWithResult(_0x55cb49,_0x2211c8){_0x2211c8=_0x2211c8||0xc8;return function(_0x11c5d6){if(_0x11c5d6){return _0x55cb49[_0xa55d('0x2a')](_0x2211c8)[_0xa55d('0x2c')](_0x11c5d6);}};}function respondWithFilteredResult(_0x3178cf,_0x330c83){return function(_0x3943ba){if(_0x3943ba){var _0x5233e5=typeof _0x330c83[_0xa55d('0x2d')]==='undefined'&&typeof _0x330c83[_0xa55d('0x2e')]===_0xa55d('0x2f');var _0x2ed474=_0x3943ba[_0xa55d('0x30')];var _0x256f3b=_0x5233e5?0x0:_0x330c83[_0xa55d('0x2d')];var _0x1b575e=_0x5233e5?_0x3943ba['count']:_0x330c83[_0xa55d('0x2d')]+_0x330c83[_0xa55d('0x2e')];var _0x4ceefe;if(_0x1b575e>=_0x2ed474){_0x1b575e=_0x2ed474;_0x4ceefe=0xc8;}else{_0x4ceefe=0xce;}_0x3178cf['status'](_0x4ceefe);return _0x3178cf[_0xa55d('0x31')]('Content-Range',_0x256f3b+'-'+_0x1b575e+'/'+_0x2ed474)['json'](_0x3943ba);}return null;};}function patchUpdates(_0x34bd88){return function(_0x2cee61){try{jsonpatch[_0xa55d('0x32')](_0x2cee61,_0x34bd88,!![]);}catch(_0x577c8a){return BPromise['reject'](_0x577c8a);}return _0x2cee61[_0xa55d('0x33')]();};}function saveUpdates(_0xb5ce1d,_0x2e4d65){return function(_0x2170d2){if(_0x2170d2){return _0x2170d2[_0xa55d('0x34')](_0xb5ce1d)[_0xa55d('0x35')](function(_0x19f781){return _0x19f781;});}return null;};}function removeEntity(_0xa02eba,_0x2a544e){return function(_0x11cb97){if(_0x11cb97){return _0x11cb97[_0xa55d('0x36')]()['then'](function(){var _0x6ed0b=_0x11cb97[_0xa55d('0x37')]({'plain':!![]});var _0x37834d=_0xa55d('0x38');return db[_0xa55d('0x39')]['destroy']({'where':{'type':_0x37834d,'resourceId':_0x6ed0b['id']}})[_0xa55d('0x35')](function(){return _0x11cb97;});})[_0xa55d('0x35')](function(){_0xa02eba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39895e,_0x2719a0){return function(_0x1a2e4b){if(!_0x1a2e4b){_0x39895e[_0xa55d('0x29')](0x194);}return _0x1a2e4b;};}function handleError(_0x10c652,_0x23689c){_0x23689c=_0x23689c||0x1f4;return function(_0x32b553){logger[_0xa55d('0x25')](_0x32b553[_0xa55d('0x3a')]);if(_0x32b553[_0xa55d('0x3b')]){delete _0x32b553[_0xa55d('0x3b')];}_0x10c652[_0xa55d('0x2a')](_0x23689c)['send'](_0x32b553);};}exports['index']=function(_0x20dd7f,_0xf6c607){var _0x16c848={'include':[{'model':db[_0xa55d('0x3c')],'as':'mandatoryDispositionPause'}]},_0x5ec2c8={},_0x24e01f={'count':0x0,'rows':[]};var _0x286cae=_[_0xa55d('0x3d')](db['OpenchannelAccount']['rawAttributes'],function(_0x5c8623){return{'name':_0x5c8623[_0xa55d('0x3e')],'type':_0x5c8623[_0xa55d('0x3f')]['key']};});_0x5ec2c8[_0xa55d('0x40')]=_[_0xa55d('0x3d')](_0x286cae,'name');_0x5ec2c8['query']=_[_0xa55d('0x41')](_0x20dd7f[_0xa55d('0x42')]);_0x5ec2c8['filters']=_[_0xa55d('0x43')](_0x5ec2c8[_0xa55d('0x40')],_0x5ec2c8[_0xa55d('0x42')]);_0x16c848[_0xa55d('0x44')]=_[_0xa55d('0x43')](_0x5ec2c8[_0xa55d('0x40')],qs[_0xa55d('0x45')](_0x20dd7f[_0xa55d('0x42')][_0xa55d('0x45')]));_0x16c848[_0xa55d('0x44')]=_0x16c848[_0xa55d('0x44')][_0xa55d('0x46')]?_0x16c848['attributes']:_0x5ec2c8[_0xa55d('0x40')];if(!_0x20dd7f[_0xa55d('0x42')][_0xa55d('0x47')](_0xa55d('0x48'))){_0x16c848[_0xa55d('0x2e')]=qs[_0xa55d('0x2e')](_0x20dd7f[_0xa55d('0x42')][_0xa55d('0x2e')]);_0x16c848['offset']=qs[_0xa55d('0x2d')](_0x20dd7f[_0xa55d('0x42')]['offset']);}_0x16c848[_0xa55d('0x49')]=qs[_0xa55d('0x4a')](_0x20dd7f[_0xa55d('0x42')][_0xa55d('0x4a')]);_0x16c848[_0xa55d('0x4b')]=qs[_0xa55d('0x4c')](_[_0xa55d('0x4d')](_0x20dd7f[_0xa55d('0x42')],_0x5ec2c8['filters']),_0x286cae);if(_0x20dd7f[_0xa55d('0x42')][_0xa55d('0x4e')]){_0x16c848[_0xa55d('0x4b')]=_[_0xa55d('0x4f')](_0x16c848[_0xa55d('0x4b')],{'$or':_[_0xa55d('0x3d')](_0x286cae,function(_0x42badc){if(_0x42badc['type']!==_0xa55d('0x50')){var _0x5a8d45={};_0x5a8d45[_0x42badc[_0xa55d('0x3b')]]={'$like':'%'+_0x20dd7f[_0xa55d('0x42')][_0xa55d('0x4e')]+'%'};return _0x5a8d45;}})});}_0x16c848=_['merge']({},_0x16c848,_0x20dd7f[_0xa55d('0x51')]);var _0x47de8c={'where':_0x16c848['where']};return db[_0xa55d('0x52')][_0xa55d('0x30')](_0x47de8c)[_0xa55d('0x35')](function(_0x71ebea){_0x24e01f[_0xa55d('0x30')]=_0x71ebea;if(_0x20dd7f[_0xa55d('0x42')][_0xa55d('0x53')]){_0x16c848['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0xa55d('0x54')](_0x16c848);})[_0xa55d('0x35')](function(_0x2e5812){_0x24e01f[_0xa55d('0x55')]=_0x2e5812;return _0x24e01f;})['then'](respondWithFilteredResult(_0xf6c607,_0x16c848))[_0xa55d('0x56')](handleError(_0xf6c607,null));};exports['show']=function(_0xc8714b,_0x5512d0){var _0xfff307={'raw':![],'where':{'id':_0xc8714b[_0xa55d('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xa55d('0x58')}]},_0x1a6651={};_0x1a6651[_0xa55d('0x40')]=_['keys'](db[_0xa55d('0x52')][_0xa55d('0x59')]);_0x1a6651['query']=_[_0xa55d('0x41')](_0xc8714b[_0xa55d('0x42')]);_0x1a6651[_0xa55d('0x4c')]=_[_0xa55d('0x43')](_0x1a6651[_0xa55d('0x40')],_0x1a6651['query']);_0xfff307[_0xa55d('0x44')]=_[_0xa55d('0x43')](_0x1a6651[_0xa55d('0x40')],qs[_0xa55d('0x45')](_0xc8714b[_0xa55d('0x42')][_0xa55d('0x45')]));_0xfff307[_0xa55d('0x44')]=_0xfff307[_0xa55d('0x44')][_0xa55d('0x46')]?_0xfff307['attributes']:_0x1a6651[_0xa55d('0x40')];if(_0xc8714b[_0xa55d('0x42')][_0xa55d('0x53')]){_0xfff307[_0xa55d('0x5a')]=[{'all':!![]}];}_0xfff307=_[_0xa55d('0x4f')]({},_0xfff307,_0xc8714b[_0xa55d('0x51')]);return db[_0xa55d('0x52')]['find'](_0xfff307)['then'](handleEntityNotFound(_0x5512d0,null))[_0xa55d('0x35')](respondWithResult(_0x5512d0,null))[_0xa55d('0x56')](handleError(_0x5512d0,null));};exports[_0xa55d('0x5b')]=function(_0x839a1a,_0x559695){return db[_0xa55d('0x52')]['create'](_0x839a1a[_0xa55d('0x5c')],{})[_0xa55d('0x35')](function(_0x580536){var _0x3fca4e=_0x839a1a['user'][_0xa55d('0x37')]({'plain':!![]});if(!_0x3fca4e)throw new Error(_0xa55d('0x5d'));if(_0x3fca4e[_0xa55d('0x5e')]==='user'){var _0x334dc3=_0x580536[_0xa55d('0x37')]({'plain':!![]});var _0x3c0ca7='OpenchannelAccounts';return db[_0xa55d('0x5f')][_0xa55d('0x60')]({'where':{'name':_0x3c0ca7,'userProfileId':_0x3fca4e[_0xa55d('0x61')]},'raw':!![]})[_0xa55d('0x35')](function(_0x15f62){if(_0x15f62&&_0x15f62['autoAssociation']===0x0){return db[_0xa55d('0x39')][_0xa55d('0x5b')]({'name':_0x334dc3[_0xa55d('0x3b')],'resourceId':_0x334dc3['id'],'type':_0x15f62['name'],'sectionId':_0x15f62['id']},{})[_0xa55d('0x35')](function(){return _0x580536;});}else{return _0x580536;}})[_0xa55d('0x56')](function(_0x43521a){logger[_0xa55d('0x25')](_0xa55d('0x62'),_0x43521a);throw _0x43521a;});}return _0x580536;})[_0xa55d('0x35')](respondWithResult(_0x559695,0xc9))[_0xa55d('0x56')](handleError(_0x559695,null));};exports[_0xa55d('0x34')]=function(_0x313e65,_0x283ff6){if(_0x313e65[_0xa55d('0x5c')]['id']){delete _0x313e65[_0xa55d('0x5c')]['id'];}return db[_0xa55d('0x52')]['find']({'where':{'id':_0x313e65[_0xa55d('0x57')]['id']},'include':[{'model':db[_0xa55d('0x3c')],'as':_0xa55d('0x58')}]})[_0xa55d('0x35')](handleEntityNotFound(_0x283ff6,null))[_0xa55d('0x35')](saveUpdates(_0x313e65['body'],null))[_0xa55d('0x35')](respondWithResult(_0x283ff6,null))['catch'](handleError(_0x283ff6,null));};exports[_0xa55d('0x36')]=function(_0x94fd07,_0xe8d06f){return db['OpenchannelAccount']['find']({'where':{'id':_0x94fd07[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0xe8d06f,null))[_0xa55d('0x35')](removeEntity(_0xe8d06f,null))['catch'](handleError(_0xe8d06f,null));};exports[_0xa55d('0x63')]=function(_0x4efc06,_0x4449fa){return db[_0xa55d('0x52')][_0xa55d('0x63')]()[_0xa55d('0x35')](respondWithResult(_0x4449fa,null))[_0xa55d('0x56')](handleError(_0x4449fa,null));};exports[_0xa55d('0x64')]=function(_0x24fd56,_0x3231a7,_0x512a05){if(_0x24fd56[_0xa55d('0x5c')]['id']){delete _0x24fd56[_0xa55d('0x5c')]['id'];}return db[_0xa55d('0x52')][_0xa55d('0x60')]({'where':{'id':_0x24fd56[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0x3231a7,null))['then'](function(_0x455e6c){if(_0x455e6c){_0x24fd56[_0xa55d('0x5c')]['OpenchannelAccountId']=_0x455e6c['id'];return db[_0xa55d('0x65')][_0xa55d('0x5b')](_0x24fd56[_0xa55d('0x5c')]);}})[_0xa55d('0x35')](respondWithResult(_0x3231a7,null))[_0xa55d('0x56')](handleError(_0x3231a7,null));};exports[_0xa55d('0x66')]=function(_0x5387f8,_0xe97147,_0x5a23c2){var _0x116fdb={'raw':![],'where':{}};var _0x13e565={};var _0x2313d8={'count':0x0,'rows':[]};return db[_0xa55d('0x52')][_0xa55d('0x67')]({'where':{'id':_0x5387f8['params']['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0xe97147,null))[_0xa55d('0x35')](function(_0x30679a){if(_0x30679a){_0x13e565[_0xa55d('0x40')]=_[_0xa55d('0x41')](db[_0xa55d('0x65')][_0xa55d('0x59')]);_0x13e565[_0xa55d('0x42')]=_[_0xa55d('0x41')](_0x5387f8[_0xa55d('0x42')]);_0x13e565[_0xa55d('0x4c')]=_[_0xa55d('0x43')](_0x13e565[_0xa55d('0x40')],_0x13e565[_0xa55d('0x42')]);_0x116fdb['attributes']=_[_0xa55d('0x43')](_0x13e565[_0xa55d('0x40')],qs[_0xa55d('0x45')](_0x5387f8['query']['fields']));_0x116fdb[_0xa55d('0x44')]=_0x116fdb[_0xa55d('0x44')]['length']?_0x116fdb[_0xa55d('0x44')]:_0x13e565[_0xa55d('0x40')];if(!_0x5387f8[_0xa55d('0x42')][_0xa55d('0x47')]('nolimit')){_0x116fdb['limit']=qs[_0xa55d('0x2e')](_0x5387f8['query'][_0xa55d('0x2e')]);_0x116fdb[_0xa55d('0x2d')]=qs[_0xa55d('0x2d')](_0x5387f8[_0xa55d('0x42')][_0xa55d('0x2d')]);}_0x116fdb[_0xa55d('0x49')]=qs[_0xa55d('0x4a')](_0x5387f8[_0xa55d('0x42')]['sort']);_0x116fdb[_0xa55d('0x4b')]=qs[_0xa55d('0x4c')](_[_0xa55d('0x4d')](_0x5387f8[_0xa55d('0x42')],_0x13e565[_0xa55d('0x4c')]));_0x116fdb[_0xa55d('0x4b')]['OpenchannelAccountId']=_0x30679a['id'];if(_0x5387f8[_0xa55d('0x42')][_0xa55d('0x4e')]){_0x116fdb['where']=_[_0xa55d('0x4f')](_0x116fdb['where'],{'$or':_[_0xa55d('0x3d')](_0x116fdb[_0xa55d('0x44')],function(_0x2c95c1){var _0x1215e7={};_0x1215e7[_0x2c95c1]={'$like':'%'+_0x5387f8[_0xa55d('0x42')]['filter']+'%'};return _0x1215e7;})});}_0x116fdb=_[_0xa55d('0x4f')]({},_0x116fdb,_0x5387f8[_0xa55d('0x51')]);return db[_0xa55d('0x65')][_0xa55d('0x30')]({'where':_0x116fdb[_0xa55d('0x4b')]})[_0xa55d('0x35')](function(_0x53164d){_0x2313d8[_0xa55d('0x30')]=_0x53164d;if(_0x5387f8[_0xa55d('0x42')][_0xa55d('0x53')]){_0x116fdb[_0xa55d('0x5a')]=[{'all':!![]}];}return db[_0xa55d('0x65')][_0xa55d('0x54')](_0x116fdb);})[_0xa55d('0x35')](function(_0x33ed53){_0x2313d8[_0xa55d('0x55')]=_0x33ed53;return _0x2313d8;});}})[_0xa55d('0x35')](respondWithFilteredResult(_0xe97147,_0x116fdb))[_0xa55d('0x56')](handleError(_0xe97147,null));};exports['removeDispositions']=function(_0xb8da66,_0x45d1e2,_0x1b7602){return db[_0xa55d('0x52')]['find']({'where':{'id':_0xb8da66['params']['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0x45d1e2,null))[_0xa55d('0x35')](function(_0x3c9440){if(_0x3c9440){return _0x3c9440[_0xa55d('0x68')](_0xb8da66[_0xa55d('0x42')][_0xa55d('0x69')]);}})[_0xa55d('0x35')](respondWithStatusCode(_0x45d1e2,null))[_0xa55d('0x56')](handleError(_0x45d1e2,null));};exports[_0xa55d('0x6a')]=function(_0x5512ee,_0x3f9069,_0xf24c5b){if(_0x5512ee[_0xa55d('0x5c')]['id']){delete _0x5512ee[_0xa55d('0x5c')]['id'];}return db[_0xa55d('0x52')][_0xa55d('0x60')]({'where':{'id':_0x5512ee[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0x3f9069,null))[_0xa55d('0x35')](function(_0x53c2b8){if(_0x53c2b8){_0x5512ee[_0xa55d('0x5c')][_0xa55d('0x6b')]=_0x53c2b8['id'];return db[_0xa55d('0x6c')]['create'](_0x5512ee[_0xa55d('0x5c')]);}})['then'](respondWithResult(_0x3f9069,null))['catch'](handleError(_0x3f9069,null));};exports[_0xa55d('0x6d')]=function(_0x20b92a,_0xd66ef5,_0x1a99d0){var _0xe5cb94={'raw':![],'where':{}};var _0x44f506={};var _0x18f57e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa55d('0x67')]({'where':{'id':_0x20b92a[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0xd66ef5,null))[_0xa55d('0x35')](function(_0x281f29){if(_0x281f29){_0x44f506[_0xa55d('0x40')]=_[_0xa55d('0x41')](db[_0xa55d('0x6c')]['rawAttributes']);_0x44f506[_0xa55d('0x42')]=_[_0xa55d('0x41')](_0x20b92a[_0xa55d('0x42')]);_0x44f506[_0xa55d('0x4c')]=_[_0xa55d('0x43')](_0x44f506[_0xa55d('0x40')],_0x44f506[_0xa55d('0x42')]);_0xe5cb94[_0xa55d('0x44')]=_[_0xa55d('0x43')](_0x44f506[_0xa55d('0x40')],qs['fields'](_0x20b92a[_0xa55d('0x42')][_0xa55d('0x45')]));_0xe5cb94[_0xa55d('0x44')]=_0xe5cb94[_0xa55d('0x44')][_0xa55d('0x46')]?_0xe5cb94[_0xa55d('0x44')]:_0x44f506[_0xa55d('0x40')];if(!_0x20b92a[_0xa55d('0x42')]['hasOwnProperty'](_0xa55d('0x48'))){_0xe5cb94[_0xa55d('0x2e')]=qs[_0xa55d('0x2e')](_0x20b92a['query'][_0xa55d('0x2e')]);_0xe5cb94['offset']=qs[_0xa55d('0x2d')](_0x20b92a[_0xa55d('0x42')][_0xa55d('0x2d')]);}_0xe5cb94['order']=qs[_0xa55d('0x4a')](_0x20b92a[_0xa55d('0x42')][_0xa55d('0x4a')]);_0xe5cb94['where']=qs['filters'](_[_0xa55d('0x4d')](_0x20b92a['query'],_0x44f506['filters']));_0xe5cb94[_0xa55d('0x4b')][_0xa55d('0x6b')]=_0x281f29['id'];if(_0x20b92a[_0xa55d('0x42')][_0xa55d('0x4e')]){_0xe5cb94[_0xa55d('0x4b')]=_[_0xa55d('0x4f')](_0xe5cb94['where'],{'$or':_[_0xa55d('0x3d')](_0xe5cb94['attributes'],function(_0x357d93){var _0x4307ad={};_0x4307ad[_0x357d93]={'$like':'%'+_0x20b92a[_0xa55d('0x42')][_0xa55d('0x4e')]+'%'};return _0x4307ad;})});}_0xe5cb94=_[_0xa55d('0x4f')]({},_0xe5cb94,_0x20b92a[_0xa55d('0x51')]);return db['CannedAnswer'][_0xa55d('0x30')]({'where':_0xe5cb94[_0xa55d('0x4b')]})[_0xa55d('0x35')](function(_0x4c2412){_0x18f57e[_0xa55d('0x30')]=_0x4c2412;if(_0x20b92a[_0xa55d('0x42')][_0xa55d('0x53')]){_0xe5cb94[_0xa55d('0x5a')]=[{'all':!![]}];}return db[_0xa55d('0x6c')][_0xa55d('0x54')](_0xe5cb94);})[_0xa55d('0x35')](function(_0x222133){_0x18f57e[_0xa55d('0x55')]=_0x222133;return _0x18f57e;});}})['then'](respondWithFilteredResult(_0xd66ef5,_0xe5cb94))['catch'](handleError(_0xd66ef5,null));};exports['removeAnswers']=function(_0x2ef849,_0x506c86,_0x54c341){return db['OpenchannelAccount']['find']({'where':{'id':_0x2ef849[_0xa55d('0x57')]['id']}})['then'](handleEntityNotFound(_0x506c86,null))[_0xa55d('0x35')](function(_0x1c3a4c){if(_0x1c3a4c){return _0x1c3a4c['removeAnswers'](_0x2ef849[_0xa55d('0x42')][_0xa55d('0x69')]);}})[_0xa55d('0x35')](respondWithStatusCode(_0x506c86,null))['catch'](handleError(_0x506c86,null));};exports[_0xa55d('0x6e')]=function(_0x42634c,_0x30425e,_0x58ed6d){var _0x58149f={'body':_0x42634c[_0xa55d('0x5c')],'channel':_0xa55d('0x6f')};var _0x1742f6=[];var _0x3e2f50=[];var _0x1814e2={};var _0x39c3f4=![];return db[_0xa55d('0x70')][_0xa55d('0x63')]()['then'](function(_0x2b1b76){if(!_0x2b1b76){throw new db[(_0xa55d('0x71'))][(_0xa55d('0x72'))](_0xa55d('0x73'));}_0x1742f6=_[_0xa55d('0x74')](_[_0xa55d('0x41')](_0x2b1b76),[_0xa55d('0x75'),_0xa55d('0x76')]);_0x3e2f50=_[_0xa55d('0x74')](_[_0xa55d('0x41')](_0x2b1b76),[_0xa55d('0x75'),_0xa55d('0x76'),_0xa55d('0x77'),_0xa55d('0x78')]);if(_0x42634c['body']['id']){delete _0x42634c['body']['id'];}if(_[_0xa55d('0x79')](_0x42634c['body'][_0xa55d('0x7a')])){throw new db[(_0xa55d('0x71'))][(_0xa55d('0x72'))](_0xa55d('0x7b'));}if(_[_0xa55d('0x79')](_0x42634c[_0xa55d('0x5c')][_0xa55d('0x5c')])||_0x42634c[_0xa55d('0x5c')][_0xa55d('0x5c')]===''){throw new db[(_0xa55d('0x71'))][(_0xa55d('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa55d('0x79')](_0x42634c['body']['mapKey'])){throw new db[(_0xa55d('0x71'))][(_0xa55d('0x72'))](_0xa55d('0x7c')+_0x3e2f50);}if(!_[_0xa55d('0x7d')](_0x3e2f50,_0x42634c[_0xa55d('0x5c')][_0xa55d('0x7e')])){throw new db[(_0xa55d('0x71'))][(_0xa55d('0x72'))](_0xa55d('0x7f')+_0x3e2f50);}_0x1814e2[_0x42634c['body'][_0xa55d('0x7e')]]=_0x42634c[_0xa55d('0x5c')][_0xa55d('0x7a')];})[_0xa55d('0x35')](function(){return db[_0xa55d('0x52')][_0xa55d('0x60')]({'where':{'id':_0x42634c[_0xa55d('0x57')]['id']},'include':[{'model':db[_0xa55d('0x80')],'as':_0xa55d('0x81'),'include':[{'model':db[_0xa55d('0x70')],'as':_0xa55d('0x82'),'where':_0x1814e2,'limit':0x1,'order':[[_0xa55d('0x76'),_0xa55d('0x83')]]}]},{'model':db[_0xa55d('0x84')],'as':_0xa55d('0x85')}]});})[_0xa55d('0x35')](handleEntityNotFound(_0x30425e,null))['then'](function(_0x55fe51){if(_0x55fe51&&_0x55fe51['List']){_0x58149f[_0xa55d('0x86')]=_0x55fe51;_0x58149f['applications']=_0x55fe51[_0xa55d('0x85')];_0x58149f[_0xa55d('0x87')]=_0x55fe51['List'];_0x58149f[_0xa55d('0x88')]=_[_0xa55d('0x89')](_0x58149f[_0xa55d('0x88')],['priority'],[_0xa55d('0x8a')]);if(_0x58149f[_0xa55d('0x86')]['Applications']){delete _0x58149f[_0xa55d('0x86')][_0xa55d('0x85')];}if(_0x58149f['account'][_0xa55d('0x81')]&&_0x58149f[_0xa55d('0x86')]['List'][_0xa55d('0x82')][_0xa55d('0x46')]){return _0x58149f['account']['List'][_0xa55d('0x82')][0x0];}var _0x2c8913=_[_0xa55d('0x1b')](_0x42634c[_0xa55d('0x5c')],{'firstName':_0x42634c[_0xa55d('0x5c')][_0xa55d('0x7a')],'ListId':_0x55fe51[_0xa55d('0x78')]});_0x2c8913[_0x42634c['body'][_0xa55d('0x7e')]]=_0x42634c[_0xa55d('0x5c')][_0xa55d('0x7a')];return db[_0xa55d('0x70')][_0xa55d('0x5b')](_0x2c8913,{'fields':_0x1742f6,'raw':!![]});}})['then'](handleEntityNotFound(_0x30425e,null))['then'](function(_0x448429){_0x58149f[_0xa55d('0x8b')]=_0x448429;if(_0x448429){var _0x41454a={'ContactId':_0x448429['id'],'OpenchannelAccountId':_0x42634c[_0xa55d('0x57')]['id'],'from':(_0x448429[_0xa55d('0x8c')]||'')+'\x20'+(_0x448429['lastName']||'')};var _0x1eaaab={'OpenchannelAccountId':_0x42634c[_0xa55d('0x57')]['id'],'closed':![]};if(_0x42634c[_0xa55d('0x5c')][_0xa55d('0x8d')]){_0x1eaaab[_0xa55d('0x8d')]=_0x42634c[_0xa55d('0x5c')][_0xa55d('0x8d')];return db[_0xa55d('0x8e')][_0xa55d('0x60')]({'where':_0x1eaaab})[_0xa55d('0x35')](function(_0x7358fa){if(_0x7358fa){return[_0x7358fa,![]];}_0x41454a[_0xa55d('0x8d')]=_0x42634c[_0xa55d('0x5c')][_0xa55d('0x8d')];_0x41454a[_0xa55d('0x8f')]=_0x42634c['body']['externalUrl'];return db[_0xa55d('0x8e')][_0xa55d('0x5b')](_0x41454a)[_0xa55d('0x35')](function(_0x4fda61){return[_0x4fda61,!![]];});});}else{_0x1eaaab[_0xa55d('0x8d')]=null;}_0x1eaaab[_0xa55d('0x90')]=_0x448429['id'];return db[_0xa55d('0x8e')][_0xa55d('0x60')]({'where':_0x1eaaab})[_0xa55d('0x35')](function(_0x43879a){if(_0x43879a){return[_0x43879a,![]];}return db['OpenchannelInteraction'][_0xa55d('0x5b')](_0x41454a)[_0xa55d('0x35')](function(_0x4ffebf){return[_0x4ffebf,!![]];});});}})[_0xa55d('0x91')](function(_0x2c9bce,_0x18b4b3){if(_0x2c9bce){_0x39c3f4=_0x18b4b3;if(!_0x18b4b3){var _0x589f23={'from':(_0x58149f[_0xa55d('0x8b')][_0xa55d('0x8c')]||'')+'\x20'+(_0x58149f[_0xa55d('0x8b')][_0xa55d('0x92')]||'')};if(_0x42634c['body'][_0xa55d('0x8d')]&&_0x42634c[_0xa55d('0x5c')]['messageId']&&_0x42634c[_0xa55d('0x5c')][_0xa55d('0x8d')]!=_0x42634c[_0xa55d('0x5c')][_0xa55d('0x93')]){_0x589f23[_0xa55d('0x8d')]=_0x42634c[_0xa55d('0x5c')][_0xa55d('0x93')];}return _0x2c9bce[_0xa55d('0x34')](_0x589f23);}else{return _0x2c9bce;}}})['then'](function(_0x5a41e3){_0x58149f['interaction']=_0x5a41e3['get']({'plain':!![]});_0x58149f['interaction'][_0xa55d('0x94')]=_0x39c3f4;if(_0x58149f[_0xa55d('0x95')][_0xa55d('0x94')]){if(_0x58149f[_0xa55d('0x86')][_0xa55d('0x96')]){_0x58149f[_0xa55d('0x88')]['push']({'id':0x0,'priority':_0x58149f[_0xa55d('0x88')][_0xa55d('0x46')]+0x1,'app':_0xa55d('0x97'),'appdata':_0xa55d('0x98'),'interval':_0xa55d('0x99')});}}return db[_0xa55d('0x9a')]['create']({'body':_0x42634c[_0xa55d('0x5c')][_0xa55d('0x5c')],'OpenchannelAccountId':_0x42634c[_0xa55d('0x57')]['id'],'OpenchannelInteractionId':_0x5a41e3['id'],'direction':'in','ContactId':_0x58149f[_0xa55d('0x8b')]['id'],'AttachmentId':_0x42634c[_0xa55d('0x5c')][_0xa55d('0x9b')]});})[_0xa55d('0x35')](function(_0x503bd6){_0x58149f[_0xa55d('0x28')]=_0x503bd6;if(_0x58149f[_0xa55d('0x95')][_0xa55d('0x9c')]){return db[_0xa55d('0x9d')][_0xa55d('0x60')]({'attributes':['id',_0xa55d('0x3b')],'where':{'id':_0x58149f[_0xa55d('0x95')][_0xa55d('0x9c')]}})[_0xa55d('0x35')](function(_0x2cb54c){if(_0x2cb54c){_0x58149f[_0xa55d('0x88')][_0xa55d('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2cb54c['name']+','+(_0x58149f[_0xa55d('0x86')][_0xa55d('0x9f')]||0xa),'interval':'*,*,*,*'});_0x58149f[_0xa55d('0xa0')]=![];}return respondWithRpcPromise('Start',_0xa55d('0xa1'),_0x58149f);});}return respondWithRpcPromise(_0xa55d('0xa2'),_0xa55d('0xa1'),_0x58149f);})[_0xa55d('0x35')](function(_0x47eb4f){respondWithRpcPromise('EventManager',_0xa55d('0xa3'),{'event':_0xa55d('0x6e'),'message':_0x47eb4f},client9002);return _0x47eb4f;})[_0xa55d('0x35')](respondWithResult(_0x30425e,null))[_0xa55d('0x56')](handleError(_0x30425e,null));};exports[_0xa55d('0xa4')]=function(_0x269b67,_0x471270,_0x536130){return db[_0xa55d('0x52')][_0xa55d('0x67')]({'where':{'id':_0x269b67[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0x471270,null))[_0xa55d('0x35')](function(_0x5e90b7){if(_0x5e90b7){return db['sequelize'][_0xa55d('0xa5')](function(_0x4d2774){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x269b67['params']['id']},'transaction':_0x4d2774})[_0xa55d('0x35')](function(_0x43cc40){var _0x25307a=_[_0xa55d('0x3d')](_0x269b67[_0xa55d('0x5c')],function(_0x54d68c){_0x54d68c[_0xa55d('0x6b')]=_0x269b67[_0xa55d('0x57')]['id'];return _0x54d68c;});return db[_0xa55d('0x84')][_0xa55d('0xa6')](_0x25307a,{'transaction':_0x4d2774});});})[_0xa55d('0x35')](function(){return db['OpenchannelApplication'][_0xa55d('0xa7')]({'where':{'OpenchannelAccountId':_0x269b67['params']['id']},'order':_0xa55d('0xa8')});});}})[_0xa55d('0x35')](respondWithResult(_0x471270,null))[_0xa55d('0x56')](handleError(_0x471270,null));};exports['getApplications']=function(_0x5b97ab,_0x34db48,_0x5ef653){var _0x3fb1b8={};var _0x40a2fb={};var _0x3bfa29;var _0x4372c3;return db[_0xa55d('0x52')][_0xa55d('0x67')]({'where':{'id':_0x5b97ab[_0xa55d('0x57')]['id']}})['then'](handleEntityNotFound(_0x34db48,null))[_0xa55d('0x35')](function(_0x47b52e){if(_0x47b52e){_0x3bfa29=_0x47b52e;_0x40a2fb[_0xa55d('0x40')]=_[_0xa55d('0x41')](db[_0xa55d('0x84')][_0xa55d('0x59')]);_0x40a2fb['query']=_[_0xa55d('0x41')](_0x5b97ab[_0xa55d('0x42')]);_0x40a2fb[_0xa55d('0x4c')]=_[_0xa55d('0x43')](_0x40a2fb['model'],_0x40a2fb[_0xa55d('0x42')]);_0x3fb1b8['attributes']=_[_0xa55d('0x43')](_0x40a2fb[_0xa55d('0x40')],qs[_0xa55d('0x45')](_0x5b97ab['query'][_0xa55d('0x45')]));_0x3fb1b8['attributes']=_0x3fb1b8[_0xa55d('0x44')][_0xa55d('0x46')]?_0x3fb1b8[_0xa55d('0x44')]:_0x40a2fb[_0xa55d('0x40')];_0x3fb1b8[_0xa55d('0x49')]=qs[_0xa55d('0x4a')](_0x5b97ab[_0xa55d('0x42')][_0xa55d('0x4a')]);_0x3fb1b8['where']=qs[_0xa55d('0x4c')](_['pick'](_0x5b97ab[_0xa55d('0x42')],_0x40a2fb[_0xa55d('0x4c')]));if(_0x5b97ab[_0xa55d('0x42')][_0xa55d('0x4e')]){_0x3fb1b8[_0xa55d('0x4b')]=_[_0xa55d('0x4f')](_0x3fb1b8[_0xa55d('0x4b')],{'$or':_[_0xa55d('0x3d')](_0x3fb1b8[_0xa55d('0x44')],function(_0x505bb8){var _0x4dc960={};_0x4dc960[_0x505bb8]={'$like':'%'+_0x5b97ab[_0xa55d('0x42')]['filter']+'%'};return _0x4dc960;})});}_0x3fb1b8=_[_0xa55d('0x4f')]({},_0x3fb1b8,_0x5b97ab['options']);return _0x3bfa29[_0xa55d('0xa9')](_0x3fb1b8);}})['then'](function(_0x2130ea){if(_0x2130ea){_0x4372c3=_0x2130ea['length'];if(!_0x5b97ab['query'][_0xa55d('0x47')](_0xa55d('0x48'))){_0x3fb1b8[_0xa55d('0x2e')]=qs[_0xa55d('0x2e')](_0x5b97ab[_0xa55d('0x42')][_0xa55d('0x2e')]);_0x3fb1b8['offset']=qs[_0xa55d('0x2d')](_0x5b97ab[_0xa55d('0x42')]['offset']);}return _0x3bfa29['getApplications'](_0x3fb1b8);}})[_0xa55d('0x35')](function(_0x3a703c){if(_0x3a703c){return _0x3a703c?{'count':_0x4372c3,'rows':_0x3a703c}:null;}})[_0xa55d('0x35')](respondWithResult(_0x34db48,null))[_0xa55d('0x56')](handleError(_0x34db48,null));};exports[_0xa55d('0xaa')]=function(_0x363a98,_0x58b16a,_0x74d6c1){var _0x3f3165={'raw':![],'where':{}};var _0x1b8cf7={};var _0x4c41c1={'count':0x0,'rows':[]};return db[_0xa55d('0x52')][_0xa55d('0x67')]({'where':{'id':_0x363a98[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0x58b16a,null))[_0xa55d('0x35')](function(_0xf28cd6){if(_0xf28cd6){_0x1b8cf7[_0xa55d('0x40')]=_[_0xa55d('0x41')](db[_0xa55d('0x8e')]['rawAttributes']);_0x1b8cf7[_0xa55d('0x42')]=_[_0xa55d('0x41')](_0x363a98['query']);_0x1b8cf7[_0xa55d('0x4c')]=_['intersection'](_0x1b8cf7[_0xa55d('0x40')],_0x1b8cf7[_0xa55d('0x42')]);_0x3f3165[_0xa55d('0x44')]=_[_0xa55d('0x43')](_0x1b8cf7['model'],qs[_0xa55d('0x45')](_0x363a98[_0xa55d('0x42')][_0xa55d('0x45')]));_0x3f3165[_0xa55d('0x44')]=_0x3f3165[_0xa55d('0x44')][_0xa55d('0x46')]?_0x3f3165[_0xa55d('0x44')]:_0x1b8cf7[_0xa55d('0x40')];if(!_0x363a98['query'][_0xa55d('0x47')]('nolimit')){_0x3f3165[_0xa55d('0x2e')]=qs[_0xa55d('0x2e')](_0x363a98[_0xa55d('0x42')][_0xa55d('0x2e')]);_0x3f3165[_0xa55d('0x2d')]=qs[_0xa55d('0x2d')](_0x363a98['query'][_0xa55d('0x2d')]);}_0x3f3165['order']=qs[_0xa55d('0x4a')](_0x363a98[_0xa55d('0x42')]['sort']);_0x3f3165['where']=qs[_0xa55d('0x4c')](_[_0xa55d('0x4d')](_0x363a98[_0xa55d('0x42')],_0x1b8cf7[_0xa55d('0x4c')]));_0x3f3165[_0xa55d('0x4b')]['OpenchannelAccountId']=_0xf28cd6['id'];if(_0x363a98['query'][_0xa55d('0x4e')]){_0x3f3165[_0xa55d('0x4b')]=_[_0xa55d('0x4f')](_0x3f3165['where'],{'$or':_[_0xa55d('0x3d')](_0x3f3165['attributes'],function(_0x166949){var _0x17791e={};_0x17791e[_0x166949]={'$like':'%'+_0x363a98[_0xa55d('0x42')][_0xa55d('0x4e')]+'%'};return _0x17791e;})});}_0x3f3165=_['merge']({},_0x3f3165,_0x363a98[_0xa55d('0x51')]);return db[_0xa55d('0x8e')][_0xa55d('0x30')]({'where':_0x3f3165[_0xa55d('0x4b')]})[_0xa55d('0x35')](function(_0x5f8be){_0x4c41c1['count']=_0x5f8be;if(_0x363a98['query']['includeAll']){_0x3f3165[_0xa55d('0x5a')]=[{'model':db['CmContact'],'as':_0xa55d('0xab'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xa55d('0x3b'),_0xa55d('0xac'),_0xa55d('0xad')],'required':![]},{'model':db[_0xa55d('0xae')],'as':_0xa55d('0xaf'),'attributes':['id','name','color'],'where':_0x363a98[_0xa55d('0x42')]['tag']?{'id':_0x363a98['query'][_0xa55d('0xb0')]}:undefined,'required':_0x363a98[_0xa55d('0x42')][_0xa55d('0xb0')]?!![]:![]}];}return db[_0xa55d('0x8e')][_0xa55d('0x54')](_0x3f3165);})['then'](function(_0x1c03f7){_0x4c41c1[_0xa55d('0x55')]=_0x1c03f7;return _0x4c41c1;});}})[_0xa55d('0x35')](respondWithFilteredResult(_0x58b16a,_0x3f3165))[_0xa55d('0x56')](handleError(_0x58b16a,null));};exports['addAgents']=function(_0x4decb3,_0x213524,_0x661ab8){return db[_0xa55d('0x52')][_0xa55d('0x60')]({'where':{'id':_0x4decb3[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0x213524,null))[_0xa55d('0x35')](function(_0x2b72ed){if(_0x2b72ed){return _0x2b72ed[_0xa55d('0xb1')](_0x4decb3[_0xa55d('0x5c')]['ids'],_[_0xa55d('0xb2')](_0x4decb3[_0xa55d('0x5c')],[_0xa55d('0x69'),'id'])||{})['spread'](function(_0x3faac9){for(var _0x512d94=0x0;_0x512d94<_0x4decb3[_0xa55d('0x5c')][_0xa55d('0x69')][_0xa55d('0x46')];_0x512d94+=0x1){socket['emit'](_0xa55d('0xb3'),{'UserId':_0x4decb3[_0xa55d('0x5c')][_0xa55d('0x69')][_0x512d94],'OpenchannelAccountId':_0x4decb3['params']['id']});}return _0x3faac9;});}})[_0xa55d('0x35')](respondWithResult(_0x213524,null))['catch'](handleError(_0x213524,null));};exports[_0xa55d('0xb4')]=function(_0x5d9e39,_0x85efef,_0x317798){return db[_0xa55d('0x52')][_0xa55d('0x60')]({'where':{'id':_0x5d9e39['params']['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0x85efef,null))[_0xa55d('0x35')](function(_0x513901){if(_0x513901){return _0x513901[_0xa55d('0xb4')](_0x5d9e39[_0xa55d('0x42')][_0xa55d('0x69')])[_0xa55d('0x35')](function(){if(_[_0xa55d('0xb5')](_0x5d9e39['query'][_0xa55d('0x69')])){for(var _0x201edc=0x0;_0x201edc<_0x5d9e39[_0xa55d('0x42')]['ids'][_0xa55d('0x46')];_0x201edc+=0x1){socket[_0xa55d('0xb6')](_0xa55d('0xb7'),{'UserId':Number(_0x5d9e39[_0xa55d('0x42')]['ids'][_0x201edc]),'OpenchannelAccountId':Number(_0x5d9e39[_0xa55d('0x57')]['id'])});}}else{socket[_0xa55d('0xb6')](_0xa55d('0xb7'),{'UserId':Number(_0x5d9e39[_0xa55d('0x42')][_0xa55d('0x69')]),'OpenchannelAccountId':Number(_0x5d9e39['params']['id'])});}});}})[_0xa55d('0x35')](respondWithStatusCode(_0x85efef,null))['catch'](handleError(_0x85efef,null));};exports[_0xa55d('0xb8')]=function(_0x30d1b4,_0xcd058,_0x35bf58){var _0x1c5029={};var _0x2f5fe9={};var _0x2b433e;var _0x4f10b9;return db[_0xa55d('0x52')][_0xa55d('0x67')]({'where':{'id':_0x30d1b4[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0xcd058,null))[_0xa55d('0x35')](function(_0xe1f1cc){if(_0xe1f1cc){_0x2b433e=_0xe1f1cc;_0x2f5fe9[_0xa55d('0x40')]=_[_0xa55d('0x41')](db['User'][_0xa55d('0x59')]);_0x2f5fe9[_0xa55d('0x42')]=_[_0xa55d('0x41')](_0x30d1b4[_0xa55d('0x42')]);_0x2f5fe9[_0xa55d('0x4c')]=_[_0xa55d('0x43')](_0x2f5fe9[_0xa55d('0x40')],_0x2f5fe9[_0xa55d('0x42')]);_0x1c5029[_0xa55d('0x44')]=_[_0xa55d('0x43')](_0x2f5fe9[_0xa55d('0x40')],qs[_0xa55d('0x45')](_0x30d1b4[_0xa55d('0x42')]['fields']));_0x1c5029[_0xa55d('0x44')]=_0x1c5029[_0xa55d('0x44')]['length']?_0x1c5029[_0xa55d('0x44')]:_0x2f5fe9[_0xa55d('0x40')];_0x1c5029[_0xa55d('0x49')]=qs[_0xa55d('0x4a')](_0x30d1b4[_0xa55d('0x42')][_0xa55d('0x4a')]);_0x1c5029['where']=qs[_0xa55d('0x4c')](_[_0xa55d('0x4d')](_0x30d1b4[_0xa55d('0x42')],_0x2f5fe9[_0xa55d('0x4c')]));if(_0x30d1b4['query']['filter']){_0x1c5029['where']=_[_0xa55d('0x4f')](_0x1c5029[_0xa55d('0x4b')],{'$or':_[_0xa55d('0x3d')](_0x1c5029[_0xa55d('0x44')],function(_0x302713){var _0x5f5893={};_0x5f5893[_0x302713]={'$like':'%'+_0x30d1b4[_0xa55d('0x42')][_0xa55d('0x4e')]+'%'};return _0x5f5893;})});}_0x1c5029=_[_0xa55d('0x4f')]({},_0x1c5029,_0x30d1b4[_0xa55d('0x51')]);return _0x2b433e[_0xa55d('0xb8')](_0x1c5029);}})[_0xa55d('0x35')](function(_0x2eac0c){if(_0x2eac0c){_0x4f10b9=_0x2eac0c[_0xa55d('0x46')];if(!_0x30d1b4[_0xa55d('0x42')][_0xa55d('0x47')](_0xa55d('0x48'))){_0x1c5029['limit']=qs[_0xa55d('0x2e')](_0x30d1b4[_0xa55d('0x42')][_0xa55d('0x2e')]);_0x1c5029[_0xa55d('0x2d')]=qs[_0xa55d('0x2d')](_0x30d1b4[_0xa55d('0x42')]['offset']);}return _0x2b433e['getAgents'](_0x1c5029);}})[_0xa55d('0x35')](function(_0x847c){if(_0x847c){return _0x847c?{'count':_0x4f10b9,'rows':_0x847c}:null;}})[_0xa55d('0x35')](respondWithResult(_0xcd058,null))[_0xa55d('0x56')](handleError(_0xcd058,null));};exports[_0xa55d('0xb9')]=function(_0xcfaf7f,_0x556650,_0x1a3252){var _0x235845,_0x48d448,_0x17a1c4;if(_[_0xa55d('0x79')](_0xcfaf7f[_0xa55d('0x5c')][_0xa55d('0x5c')])||_0xcfaf7f['body'][_0xa55d('0x5c')]===''){throw new db[(_0xa55d('0x71'))][(_0xa55d('0x72'))](_0xa55d('0xba'));}if(_[_0xa55d('0x79')](_0xcfaf7f[_0xa55d('0x5c')]['to'])){}_0x235845=_0xcfaf7f[_0xa55d('0x5c')]['to'];return db['OpenchannelAccount'][_0xa55d('0x67')]({'where':{'id':_0xcfaf7f[_0xa55d('0x57')]['id']}})[_0xa55d('0x35')](handleEntityNotFound(_0x556650,null))[_0xa55d('0x35')](function(_0x5d03fc){if(_0x5d03fc){return db[_0xa55d('0x52')][_0xa55d('0x60')]({'where':{'id':_0x5d03fc['id']},'include':[{'model':db['CmList'],'as':_0xa55d('0x81'),'include':[{'model':db[_0xa55d('0x70')],'as':_0xa55d('0x82'),'where':{[_0x5d03fc[_0xa55d('0x7e')]]:_0x235845},'limit':0x1,'order':[[_0xa55d('0x76'),_0xa55d('0x83')]]}]}]})['then'](handleEntityNotFound(_0x556650,null))['then'](function(_0x3420e9){if(_0x3420e9&&_0x3420e9[_0xa55d('0x81')]){_0x48d448=_0x3420e9[_0xa55d('0x37')]({'plain':!![]});if(_0x48d448['List']&&_0x48d448[_0xa55d('0x81')][_0xa55d('0x82')]['length']){return _0x48d448['List'][_0xa55d('0x82')][0x0];}return db[_0xa55d('0x70')][_0xa55d('0x5b')](_[_0xa55d('0x1b')](_0xcfaf7f['body'],{'firstName':_0x235845,[_0x3420e9[_0xa55d('0x7e')]]:_0x235845,'phone':_0x235845,'ListId':_0x48d448[_0xa55d('0x78')]}));}})[_0xa55d('0x35')](handleEntityNotFound(_0x556650,null))['then'](function(_0x21c123){if(_0x21c123){_0x17a1c4=_0x21c123;return db[_0xa55d('0x8e')][_0xa55d('0x60')]({'where':{'ContactId':_0x17a1c4['id'],'closed':![],'OpenchannelAccountId':_0x48d448['id']}})[_0xa55d('0x35')](function(_0x5cef46){if(_0x5cef46){return[_0x5cef46,![]];}return db[_0xa55d('0x8e')][_0xa55d('0x5b')]({'UserId':_0xcfaf7f['user']['id'],'ContactId':_0x17a1c4['id'],'OpenchannelAccountId':_0x48d448['id'],'lastMsgDirection':'out','Messages':[_[_0xa55d('0x4f')](_0xcfaf7f['body'],{'read':![],'body':_0xcfaf7f[_0xa55d('0x5c')]['body'],'OpenchannelAccountId':_0x48d448['id'],'UserId':_0xcfaf7f[_0xa55d('0xbb')]['id'],'ContactId':_0x17a1c4['id']})]},{'include':[{'model':db[_0xa55d('0x9a')],'as':'Messages'}]})[_0xa55d('0x35')](function(_0x252bf2){return[_0x252bf2,!![]];});});}})[_0xa55d('0x91')](function(_0x6ba7ed,_0x4db684){if(_0x4db684){return _0x6ba7ed;}return db[_0xa55d('0x9a')]['create'](_['merge'](_0xcfaf7f[_0xa55d('0x5c')],{'read':![],'body':_0xcfaf7f[_0xa55d('0x5c')]['body'],'OpenchannelAccountId':_0x48d448['id'],'OpenchannelInteractionId':_0x6ba7ed['id'],'UserId':_0xcfaf7f[_0xa55d('0xbb')]['id'],'ContactId':_0x17a1c4['id']}))[_0xa55d('0x35')](function(_0x5711c0){_0x6ba7ed[_0xa55d('0xbc')]['Messages']=[];_0x6ba7ed[_0xa55d('0xbc')][_0xa55d('0xbd')]['push'](_0x5711c0[_0xa55d('0xbc')]);return _0x6ba7ed;});});}})[_0xa55d('0x35')](respondWithResult(_0x556650,null))[_0xa55d('0x56')](handleError(_0x556650,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 36e7a91..24242dc 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 _0x3094=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x21093d,_0x3d86b7){var _0xd6eb70=function(_0x48a380){while(--_0x48a380){_0x21093d['push'](_0x21093d['shift']());}};_0xd6eb70(++_0x3d86b7);}(_0x3094,0x10e));var _0x4309=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3094[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x4309('0x0'));var OpenchannelAccount=require(_0x4309('0x1'))['db'][_0x4309('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4309('0x3')](0x0);var events={'afterCreate':_0x4309('0x4'),'afterUpdate':'update','afterDestroy':_0x4309('0x5')};function emitEvent(_0x593b3c){return function(_0x154398,_0x591d8a,_0x40fcc3){OpenchannelAccountEvents[_0x4309('0x6')](_0x593b3c+':'+_0x154398['id'],_0x154398);OpenchannelAccountEvents['emit'](_0x593b3c,_0x154398);_0x40fcc3(null);};}for(var e in events){if(events[_0x4309('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x4309('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x41c9=['hook','exports','events','OpenchannelAccount','setMaxListeners','emit','hasOwnProperty'];(function(_0x11bd84,_0x22e0eb){var _0x6f0679=function(_0x2351ee){while(--_0x2351ee){_0x11bd84['push'](_0x11bd84['shift']());}};_0x6f0679(++_0x22e0eb);}(_0x41c9,0x19f));var _0x941c=function(_0x5d68f7,_0x2784f5){_0x5d68f7=_0x5d68f7-0x0;var _0x46e1e6=_0x41c9[_0x5d68f7];return _0x46e1e6;};'use strict';var EventEmitter=require(_0x941c('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x941c('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x941c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2daccc){return function(_0x5be0f2,_0x30a61a,_0x5e5571){OpenchannelAccountEvents[_0x941c('0x3')](_0x2daccc+':'+_0x5be0f2['id'],_0x5be0f2);OpenchannelAccountEvents['emit'](_0x2daccc,_0x5be0f2);_0x5e5571(null);};}for(var e in events){if(events[_0x941c('0x4')](e)){var event=events[e];OpenchannelAccount[_0x941c('0x5')](e,emitEvent(event));}}module[_0x941c('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 405e276..a6aedc4 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 _0x81c1=['rimraf','../../config/environment','exports','define','openchannel_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x81c1,0xb9));var _0x181c=function(_0x5edc41,_0x127a1a){_0x5edc41=_0x5edc41-0x0;var _0x3bb9f8=_0x81c1[_0x5edc41];return _0x3bb9f8;};'use strict';var _=require('lodash');var util=require(_0x181c('0x0'));var logger=require(_0x181c('0x1'))(_0x181c('0x2'));var moment=require(_0x181c('0x3'));var BPromise=require(_0x181c('0x4'));var rp=require(_0x181c('0x5'));var fs=require('fs');var path=require(_0x181c('0x6'));var rimraf=require(_0x181c('0x7'));var config=require(_0x181c('0x8'));var attributes=require('./openchannelAccount.attributes');module[_0x181c('0x9')]=function(_0x36e52b,_0x13ab11){return _0x36e52b[_0x181c('0xa')]('OpenchannelAccount',attributes,{'tableName':_0x181c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf02=['openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelAccount.attributes','exports','define','OpenchannelAccount'];(function(_0x3634a0,_0x2faec6){var _0x4656a6=function(_0x28d408){while(--_0x28d408){_0x3634a0['push'](_0x3634a0['shift']());}};_0x4656a6(++_0x2faec6);}(_0xbf02,0x139));var _0x2bf0=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xbf02[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x2bf0('0x0'));var util=require(_0x2bf0('0x1'));var logger=require(_0x2bf0('0x2'))(_0x2bf0('0x3'));var moment=require(_0x2bf0('0x4'));var BPromise=require(_0x2bf0('0x5'));var rp=require(_0x2bf0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2bf0('0x7'));var config=require('../../config/environment');var attributes=require(_0x2bf0('0x8'));module[_0x2bf0('0x9')]=function(_0x24204f,_0x13a4f4){return _0x24204f[_0x2bf0('0xa')](_0x2bf0('0xb'),attributes,{'tableName':_0x2bf0('0xc'),'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 48acc2c..0270884 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 _0x7e2f=['http','defaults','localhost','redis','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f7792,_0x298a54){var _0xa5a6cb=function(_0x379846){while(--_0x379846){_0x1f7792['push'](_0x1f7792['shift']());}};_0xa5a6cb(++_0x298a54);}(_0x7e2f,0x187));var _0xf7e2=function(_0x2c16ab,_0xaa3f47){_0x2c16ab=_0x2c16ab-0x0;var _0x50d50c=_0x7e2f[_0x2c16ab];return _0x50d50c;};'use strict';var _=require('lodash');var util=require(_0xf7e2('0x0'));var moment=require(_0xf7e2('0x1'));var BPromise=require(_0xf7e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7e2('0x3'));var db=require(_0xf7e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf7e2('0x5'))(_0xf7e2('0x6'));var config=require(_0xf7e2('0x7'));var jayson=require(_0xf7e2('0x8'));var client=jayson['client'][_0xf7e2('0x9')]({'port':0x232a});config['redis']=_[_0xf7e2('0xa')](config['redis'],{'host':_0xf7e2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7e2('0xc')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4dd4f7,_0x4969b3,_0x391cb1){return new BPromise(function(_0x4819a7,_0x551ad7){return client[_0xf7e2('0xd')](_0x4dd4f7,_0x391cb1)[_0xf7e2('0xe')](function(_0xdedeb3){logger[_0xf7e2('0xf')](_0xf7e2('0x10'),_0x4969b3,_0xf7e2('0x11'));logger[_0xf7e2('0x12')](_0xf7e2('0x13'),_0x4969b3,_0xf7e2('0x11'),JSON[_0xf7e2('0x14')](_0xdedeb3));if(_0xdedeb3[_0xf7e2('0x15')]){if(_0xdedeb3[_0xf7e2('0x15')][_0xf7e2('0x16')]===0x1f4){logger[_0xf7e2('0x15')](_0xf7e2('0x10'),_0x4969b3,_0xdedeb3[_0xf7e2('0x15')][_0xf7e2('0x17')]);return _0x551ad7(_0xdedeb3['error'][_0xf7e2('0x17')]);}logger[_0xf7e2('0x15')](_0xf7e2('0x10'),_0x4969b3,_0xdedeb3[_0xf7e2('0x15')][_0xf7e2('0x17')]);return _0x4819a7(_0xdedeb3['error'][_0xf7e2('0x17')]);}else{logger[_0xf7e2('0xf')](_0xf7e2('0x10'),_0x4969b3,_0xf7e2('0x11'));_0x4819a7(_0xdedeb3['result'][_0xf7e2('0x17')]);}})[_0xf7e2('0x18')](function(_0x346417){logger[_0xf7e2('0x15')](_0xf7e2('0x10'),_0x4969b3,_0x346417);_0x551ad7(_0x346417);});});} \ No newline at end of file +var _0x54d3=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3d67a3,_0x50c861){var _0x408e7a=function(_0x2a4662){while(--_0x2a4662){_0x3d67a3['push'](_0x3d67a3['shift']());}};_0x408e7a(++_0x50c861);}(_0x54d3,0x198));var _0x354d=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x54d3[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var util=require(_0x354d('0x0'));var moment=require(_0x354d('0x1'));var BPromise=require(_0x354d('0x2'));var rs=require(_0x354d('0x3'));var fs=require('fs');var Redis=require(_0x354d('0x4'));var db=require(_0x354d('0x5'))['db'];var utils=require(_0x354d('0x6'));var logger=require('../../config/logger')(_0x354d('0x7'));var config=require(_0x354d('0x8'));var jayson=require(_0x354d('0x9'));var client=jayson[_0x354d('0xa')]['http']({'port':0x232a});config[_0x354d('0xb')]=_[_0x354d('0xc')](config['redis'],{'host':_0x354d('0xd'),'port':0x18eb});var socket=require(_0x354d('0xe'))(new Redis(config['redis']));require(_0x354d('0xf'))[_0x354d('0x10')](socket);function respondWithRpcPromise(_0x51fd2f,_0xb55667,_0x578245){return new BPromise(function(_0x25edb7,_0x95080a){return client['request'](_0x51fd2f,_0x578245)[_0x354d('0x11')](function(_0x476dc9){logger['info'](_0x354d('0x12'),_0xb55667,_0x354d('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xb55667,_0x354d('0x13'),JSON[_0x354d('0x14')](_0x476dc9));if(_0x476dc9[_0x354d('0x15')]){if(_0x476dc9[_0x354d('0x15')][_0x354d('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xb55667,_0x476dc9['error'][_0x354d('0x17')]);return _0x95080a(_0x476dc9['error'][_0x354d('0x17')]);}logger[_0x354d('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0xb55667,_0x476dc9[_0x354d('0x15')][_0x354d('0x17')]);return _0x25edb7(_0x476dc9[_0x354d('0x15')][_0x354d('0x17')]);}else{logger[_0x354d('0x18')](_0x354d('0x12'),_0xb55667,_0x354d('0x13'));_0x25edb7(_0x476dc9[_0x354d('0x19')][_0x354d('0x17')]);}})['catch'](function(_0x1516d4){logger[_0x354d('0x15')](_0x354d('0x12'),_0xb55667,_0x1516d4);_0x95080a(_0x1516d4);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 58d2025..b7c5eed 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 _0x78a9=['save','remove','emit','removeListener','./openchannelAccount.events'];(function(_0x254de6,_0x35160a){var _0xba633f=function(_0x292e26){while(--_0x292e26){_0x254de6['push'](_0x254de6['shift']());}};_0xba633f(++_0x35160a);}(_0x78a9,0xa9));var _0x978a=function(_0x10ee82,_0x23ea9d){_0x10ee82=_0x10ee82-0x0;var _0x7a4fa3=_0x78a9[_0x10ee82];return _0x7a4fa3;};'use strict';var OpenchannelAccountEvents=require(_0x978a('0x0'));var events=[_0x978a('0x1'),_0x978a('0x2'),'update'];function createListener(_0x372ec6,_0x125570){return function(_0x21a1e8){_0x125570[_0x978a('0x3')](_0x372ec6,_0x21a1e8);};}function removeListener(_0x1a559c,_0x3e767f){return function(){OpenchannelAccountEvents[_0x978a('0x4')](_0x1a559c,_0x3e767f);};}exports['register']=function(_0x452884){for(var _0x21863b=0x0,_0x32e946=events['length'];_0x21863b<_0x32e946;_0x21863b++){var _0x119f85=events[_0x21863b];var _0x24f9fc=createListener('openchannelAccount:'+_0x119f85,_0x452884);OpenchannelAccountEvents['on'](_0x119f85,_0x24f9fc);}}; \ No newline at end of file +var _0xbf2e=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','register'];(function(_0x58ee90,_0x8a0243){var _0x20fade=function(_0x26e1d7){while(--_0x26e1d7){_0x58ee90['push'](_0x58ee90['shift']());}};_0x20fade(++_0x8a0243);}(_0xbf2e,0x1ca));var _0xebf2=function(_0x492e82,_0x2f2779){_0x492e82=_0x492e82-0x0;var _0x2160de=_0xbf2e[_0x492e82];return _0x2160de;};'use strict';var OpenchannelAccountEvents=require(_0xebf2('0x0'));var events=[_0xebf2('0x1'),_0xebf2('0x2'),_0xebf2('0x3')];function createListener(_0x1e099f,_0x5a399b){return function(_0x11b583){_0x5a399b[_0xebf2('0x4')](_0x1e099f,_0x11b583);};}function removeListener(_0xdeaf86,_0x16a74e){return function(){OpenchannelAccountEvents['removeListener'](_0xdeaf86,_0x16a74e);};}exports[_0xebf2('0x5')]=function(_0x4a7890){for(var _0x4ddfb4=0x0,_0xc85e38=events[_0xebf2('0x6')];_0x4ddfb4<_0xc85e38;_0x4ddfb4++){var _0xecb5f9=events[_0x4ddfb4];var _0x5c47f2=createListener(_0xebf2('0x7')+_0xecb5f9,_0x4a7890);OpenchannelAccountEvents['on'](_0xecb5f9,_0x5c47f2);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f343ebe..ec28fa8 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 _0x2d45=['/:id','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','post','isAuthenticated','put'];(function(_0x48ff9b,_0x516bca){var _0x216ae5=function(_0x9eb482){while(--_0x9eb482){_0x48ff9b['push'](_0x48ff9b['shift']());}};_0x216ae5(++_0x516bca);}(_0x2d45,0xb8));var _0x52d4=function(_0xe9ea64,_0x3b2a2b){_0xe9ea64=_0xe9ea64-0x0;var _0x53c70e=_0x2d45[_0xe9ea64];return _0x53c70e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x52d4('0x0'));var timeout=require(_0x52d4('0x1'));var express=require(_0x52d4('0x2'));var router=express[_0x52d4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x52d4('0x4'));var config=require(_0x52d4('0x5'));var controller=require(_0x52d4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x52d4('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x52d4('0x8')]('/',auth[_0x52d4('0x9')](),controller['create']);router[_0x52d4('0xa')](_0x52d4('0xb'),auth[_0x52d4('0x9')](),controller['update']);router['delete'](_0x52d4('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x52d4('0xc')]=router; \ No newline at end of file +var _0x19f0=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x3a3ca6,_0x35cc7d){var _0x542f38=function(_0xd4a441){while(--_0xd4a441){_0x3a3ca6['push'](_0x3a3ca6['shift']());}};_0x542f38(++_0x35cc7d);}(_0x19f0,0x10d));var _0x019f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19f0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x019f('0x0'));var util=require(_0x019f('0x1'));var path=require(_0x019f('0x2'));var timeout=require('connect-timeout');var express=require(_0x019f('0x3'));var router=express[_0x019f('0x4')]();var fs_extra=require(_0x019f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x019f('0x6'));var controller=require(_0x019f('0x7'));router[_0x019f('0x8')]('/',auth[_0x019f('0x9')](),controller[_0x019f('0xa')]);router[_0x019f('0x8')](_0x019f('0xb'),auth[_0x019f('0x9')](),controller[_0x019f('0xc')]);router[_0x019f('0xd')]('/',auth['isAuthenticated'](),controller[_0x019f('0xe')]);router[_0x019f('0xf')](_0x019f('0xb'),auth[_0x019f('0x9')](),controller[_0x019f('0x10')]);router[_0x019f('0x11')](_0x019f('0xb'),auth[_0x019f('0x9')](),controller[_0x019f('0x12')]);module[_0x019f('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index b6ebb3d..8782fd3 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 _0x12bd=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x162048,_0x411f1b){var _0x2339bf=function(_0x4101a2){while(--_0x4101a2){_0x162048['push'](_0x162048['shift']());}};_0x2339bf(++_0x411f1b);}(_0x12bd,0x19f));var _0xd12b=function(_0xc471d2,_0x26ab16){_0xc471d2=_0xc471d2-0x0;var _0x334c68=_0x12bd[_0xc471d2];return _0x334c68;};'use strict';var Sequelize=require(_0xd12b('0x0'));module[_0xd12b('0x1')]={'priority':{'type':Sequelize[_0xd12b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd12b('0x3')],'allowNull':![],'defaultValue':_0xd12b('0x4')},'appdata':{'type':Sequelize[_0xd12b('0x5')]()},'description':{'type':Sequelize[_0xd12b('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd12b('0x6')}}; \ No newline at end of file +var _0x229d=['sequelize','INTEGER','noop','STRING','*,*,*,*'];(function(_0x36e1b7,_0x45dd16){var _0x217468=function(_0x116aa9){while(--_0x116aa9){_0x36e1b7['push'](_0x36e1b7['shift']());}};_0x217468(++_0x45dd16);}(_0x229d,0x12c));var _0xd229=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x229d[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0xd229('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd229('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd229('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd229('0x3')]},'interval':{'type':Sequelize[_0xd229('0x3')],'defaultValue':_0xd229('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e907465..1a9c6ef 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 _0xbd81=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4bea36,_0x5d946e){var _0x5f1bd5=function(_0x53f2ee){while(--_0x53f2ee){_0x4bea36['push'](_0x4bea36['shift']());}};_0x5f1bd5(++_0x5d946e);}(_0xbd81,0x123));var _0x1bd8=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xbd81[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x1bd8('0x0'));var rimraf=require(_0x1bd8('0x1'));var zipdir=require(_0x1bd8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1bd8('0x3'));var moment=require(_0x1bd8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1bd8('0x5'));var util=require(_0x1bd8('0x6'));var path=require(_0x1bd8('0x7'));var sox=require(_0x1bd8('0x8'));var csv=require('to-csv');var ejs=require(_0x1bd8('0x9'));var fs=require('fs');var fs_extra=require(_0x1bd8('0xa'));var _=require(_0x1bd8('0xb'));var squel=require(_0x1bd8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1bd8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1bd8('0xe'));var Papa=require(_0x1bd8('0xf'));var Redis=require(_0x1bd8('0x10'));var authService=require(_0x1bd8('0x11'));var qs=require(_0x1bd8('0x12'));var as=require(_0x1bd8('0x13'));var hardwareService=require(_0x1bd8('0x14'));var logger=require(_0x1bd8('0x15'))(_0x1bd8('0x16'));var utils=require(_0x1bd8('0x17'));var config=require(_0x1bd8('0x18'));var licenseUtil=require(_0x1bd8('0x19'));var db=require(_0x1bd8('0x1a'))['db'];function respondWithStatusCode(_0x2d05f3,_0x518e97){_0x518e97=_0x518e97||0xcc;return function(_0x3c825){if(_0x3c825){return _0x2d05f3[_0x1bd8('0x1b')](_0x518e97);}return _0x2d05f3['status'](_0x518e97)['end']();};}function respondWithResult(_0x4a4c77,_0x3cb640){_0x3cb640=_0x3cb640||0xc8;return function(_0x2c0e08){if(_0x2c0e08){return _0x4a4c77[_0x1bd8('0x1c')](_0x3cb640)[_0x1bd8('0x1d')](_0x2c0e08);}};}function respondWithFilteredResult(_0x49f564,_0x5c4b2c){return function(_0x53bc3c){if(_0x53bc3c){var _0x4b0993=typeof _0x5c4b2c[_0x1bd8('0x1e')]==='undefined'&&typeof _0x5c4b2c[_0x1bd8('0x1f')]===_0x1bd8('0x20');var _0x49d963=_0x53bc3c[_0x1bd8('0x21')];var _0x4466b5=_0x4b0993?0x0:_0x5c4b2c['offset'];var _0x4eda38=_0x4b0993?_0x53bc3c[_0x1bd8('0x21')]:_0x5c4b2c['offset']+_0x5c4b2c['limit'];var _0xac0a34;if(_0x4eda38>=_0x49d963){_0x4eda38=_0x49d963;_0xac0a34=0xc8;}else{_0xac0a34=0xce;}_0x49f564['status'](_0xac0a34);return _0x49f564[_0x1bd8('0x22')](_0x1bd8('0x23'),_0x4466b5+'-'+_0x4eda38+'/'+_0x49d963)[_0x1bd8('0x1d')](_0x53bc3c);}return null;};}function patchUpdates(_0x1c27e8){return function(_0x1e03ec){try{jsonpatch[_0x1bd8('0x24')](_0x1e03ec,_0x1c27e8,!![]);}catch(_0x59d5ca){return BPromise[_0x1bd8('0x25')](_0x59d5ca);}return _0x1e03ec['save']();};}function saveUpdates(_0x4e53da,_0x117375){return function(_0x362e3b){if(_0x362e3b){return _0x362e3b[_0x1bd8('0x26')](_0x4e53da)[_0x1bd8('0x27')](function(_0x5a820d){return _0x5a820d;});}return null;};}function removeEntity(_0x16b3a2,_0x231a35){return function(_0x2d644e){if(_0x2d644e){return _0x2d644e[_0x1bd8('0x28')]()[_0x1bd8('0x27')](function(){_0x16b3a2['status'](0xcc)[_0x1bd8('0x29')]();});}};}function handleEntityNotFound(_0x3dd659,_0x3a18fc){return function(_0x2ea715){if(!_0x2ea715){_0x3dd659['sendStatus'](0x194);}return _0x2ea715;};}function handleError(_0x1f122b,_0x41942d){_0x41942d=_0x41942d||0x1f4;return function(_0x1a91a8){logger[_0x1bd8('0x2a')](_0x1a91a8[_0x1bd8('0x2b')]);if(_0x1a91a8[_0x1bd8('0x2c')]){delete _0x1a91a8[_0x1bd8('0x2c')];}_0x1f122b['status'](_0x41942d)[_0x1bd8('0x2d')](_0x1a91a8);};}exports[_0x1bd8('0x2e')]=function(_0x1b8569,_0x335937){var _0x5c87a1={},_0x549f6e={},_0x4c4b87={'count':0x0,'rows':[]};var _0x5a71e7=_['map'](db[_0x1bd8('0x2f')][_0x1bd8('0x30')],function(_0x297ac1){return{'name':_0x297ac1[_0x1bd8('0x31')],'type':_0x297ac1[_0x1bd8('0x32')][_0x1bd8('0x33')]};});_0x549f6e[_0x1bd8('0x34')]=_['map'](_0x5a71e7,_0x1bd8('0x2c'));_0x549f6e[_0x1bd8('0x35')]=_[_0x1bd8('0x36')](_0x1b8569[_0x1bd8('0x35')]);_0x549f6e[_0x1bd8('0x37')]=_[_0x1bd8('0x38')](_0x549f6e['model'],_0x549f6e['query']);_0x5c87a1[_0x1bd8('0x39')]=_[_0x1bd8('0x38')](_0x549f6e['model'],qs[_0x1bd8('0x3a')](_0x1b8569[_0x1bd8('0x35')]['fields']));_0x5c87a1[_0x1bd8('0x39')]=_0x5c87a1[_0x1bd8('0x39')][_0x1bd8('0x3b')]?_0x5c87a1[_0x1bd8('0x39')]:_0x549f6e[_0x1bd8('0x34')];if(!_0x1b8569[_0x1bd8('0x35')][_0x1bd8('0x3c')](_0x1bd8('0x3d'))){_0x5c87a1['limit']=qs[_0x1bd8('0x1f')](_0x1b8569[_0x1bd8('0x35')][_0x1bd8('0x1f')]);_0x5c87a1[_0x1bd8('0x1e')]=qs[_0x1bd8('0x1e')](_0x1b8569[_0x1bd8('0x35')][_0x1bd8('0x1e')]);}_0x5c87a1[_0x1bd8('0x3e')]=qs['sort'](_0x1b8569['query']['sort']);_0x5c87a1[_0x1bd8('0x3f')]=qs[_0x1bd8('0x37')](_[_0x1bd8('0x40')](_0x1b8569[_0x1bd8('0x35')],_0x549f6e['filters']),_0x5a71e7);if(_0x1b8569[_0x1bd8('0x35')]['filter']){_0x5c87a1[_0x1bd8('0x3f')]=_[_0x1bd8('0x41')](_0x5c87a1[_0x1bd8('0x3f')],{'$or':_['map'](_0x5a71e7,function(_0x3ce2c0){if(_0x3ce2c0[_0x1bd8('0x32')]!==_0x1bd8('0x42')){var _0x598c6c={};_0x598c6c[_0x3ce2c0['name']]={'$like':'%'+_0x1b8569[_0x1bd8('0x35')]['filter']+'%'};return _0x598c6c;}})});}_0x5c87a1=_[_0x1bd8('0x41')]({},_0x5c87a1,_0x1b8569[_0x1bd8('0x43')]);var _0x1280dc={'where':_0x5c87a1[_0x1bd8('0x3f')]};return db['OpenchannelApplication'][_0x1bd8('0x21')](_0x1280dc)[_0x1bd8('0x27')](function(_0x3de712){_0x4c4b87[_0x1bd8('0x21')]=_0x3de712;if(_0x1b8569['query'][_0x1bd8('0x44')]){_0x5c87a1[_0x1bd8('0x45')]=[{'all':!![]}];}return db[_0x1bd8('0x2f')][_0x1bd8('0x46')](_0x5c87a1);})[_0x1bd8('0x27')](function(_0xefc1b){_0x4c4b87[_0x1bd8('0x47')]=_0xefc1b;return _0x4c4b87;})[_0x1bd8('0x27')](respondWithFilteredResult(_0x335937,_0x5c87a1))['catch'](handleError(_0x335937,null));};exports[_0x1bd8('0x48')]=function(_0x57635a,_0x382271){var _0x16f3cd={'raw':!![],'where':{'id':_0x57635a[_0x1bd8('0x49')]['id']}},_0x31cf59={};_0x31cf59[_0x1bd8('0x34')]=_[_0x1bd8('0x36')](db[_0x1bd8('0x2f')][_0x1bd8('0x30')]);_0x31cf59['query']=_[_0x1bd8('0x36')](_0x57635a[_0x1bd8('0x35')]);_0x31cf59[_0x1bd8('0x37')]=_['intersection'](_0x31cf59[_0x1bd8('0x34')],_0x31cf59[_0x1bd8('0x35')]);_0x16f3cd[_0x1bd8('0x39')]=_[_0x1bd8('0x38')](_0x31cf59[_0x1bd8('0x34')],qs[_0x1bd8('0x3a')](_0x57635a[_0x1bd8('0x35')][_0x1bd8('0x3a')]));_0x16f3cd[_0x1bd8('0x39')]=_0x16f3cd[_0x1bd8('0x39')][_0x1bd8('0x3b')]?_0x16f3cd[_0x1bd8('0x39')]:_0x31cf59[_0x1bd8('0x34')];if(_0x57635a[_0x1bd8('0x35')][_0x1bd8('0x44')]){_0x16f3cd[_0x1bd8('0x45')]=[{'all':!![]}];}_0x16f3cd=_['merge']({},_0x16f3cd,_0x57635a[_0x1bd8('0x43')]);return db['OpenchannelApplication'][_0x1bd8('0x4a')](_0x16f3cd)[_0x1bd8('0x27')](handleEntityNotFound(_0x382271,null))[_0x1bd8('0x27')](respondWithResult(_0x382271,null))['catch'](handleError(_0x382271,null));};exports[_0x1bd8('0x4b')]=function(_0x3d10cd,_0x51f86e){return db[_0x1bd8('0x2f')]['create'](_0x3d10cd[_0x1bd8('0x4c')],{})[_0x1bd8('0x27')](respondWithResult(_0x51f86e,0xc9))[_0x1bd8('0x4d')](handleError(_0x51f86e,null));};exports[_0x1bd8('0x26')]=function(_0x1e1292,_0x581b93){if(_0x1e1292[_0x1bd8('0x4c')]['id']){delete _0x1e1292['body']['id'];}return db['OpenchannelApplication'][_0x1bd8('0x4a')]({'where':{'id':_0x1e1292[_0x1bd8('0x49')]['id']}})[_0x1bd8('0x27')](handleEntityNotFound(_0x581b93,null))[_0x1bd8('0x27')](saveUpdates(_0x1e1292[_0x1bd8('0x4c')],null))[_0x1bd8('0x27')](respondWithResult(_0x581b93,null))[_0x1bd8('0x4d')](handleError(_0x581b93,null));};exports[_0x1bd8('0x28')]=function(_0x4801c4,_0x241852){return db[_0x1bd8('0x2f')][_0x1bd8('0x4a')]({'where':{'id':_0x4801c4['params']['id']}})[_0x1bd8('0x27')](handleEntityNotFound(_0x241852,null))[_0x1bd8('0x27')](removeEntity(_0x241852,null))[_0x1bd8('0x4d')](handleError(_0x241852,null));}; \ No newline at end of file +var _0x96f9=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','OpenchannelApplication','catch','show','rawAttributes','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x3a7d5e,_0x4843c7){var _0x34ab97=function(_0x270294){while(--_0x270294){_0x3a7d5e['push'](_0x3a7d5e['shift']());}};_0x34ab97(++_0x4843c7);}(_0x96f9,0xab));var _0x996f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x96f9[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x996f('0x0'));var rimraf=require(_0x996f('0x1'));var zipdir=require(_0x996f('0x2'));var jsonpatch=require(_0x996f('0x3'));var rp=require(_0x996f('0x4'));var moment=require(_0x996f('0x5'));var BPromise=require(_0x996f('0x6'));var Mustache=require(_0x996f('0x7'));var util=require(_0x996f('0x8'));var path=require(_0x996f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x996f('0xa'));var _=require('lodash');var squel=require(_0x996f('0xb'));var crypto=require(_0x996f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x996f('0xd'));var toCsv=require(_0x996f('0xe'));var querystring=require(_0x996f('0xf'));var Papa=require(_0x996f('0x10'));var Redis=require('ioredis');var authService=require(_0x996f('0x11'));var qs=require(_0x996f('0x12'));var as=require(_0x996f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x996f('0x14'));var config=require(_0x996f('0x15'));var licenseUtil=require(_0x996f('0x16'));var db=require(_0x996f('0x17'))['db'];function respondWithStatusCode(_0x5571e9,_0x4ba765){_0x4ba765=_0x4ba765||0xcc;return function(_0x6242c3){if(_0x6242c3){return _0x5571e9[_0x996f('0x18')](_0x4ba765);}return _0x5571e9[_0x996f('0x19')](_0x4ba765)[_0x996f('0x1a')]();};}function respondWithResult(_0x814945,_0x53c467){_0x53c467=_0x53c467||0xc8;return function(_0x1c9470){if(_0x1c9470){return _0x814945['status'](_0x53c467)[_0x996f('0x1b')](_0x1c9470);}};}function respondWithFilteredResult(_0x1c1919,_0x1ed71e){return function(_0x38bb53){if(_0x38bb53){var _0x14b05f=typeof _0x1ed71e[_0x996f('0x1c')]===_0x996f('0x1d')&&typeof _0x1ed71e['limit']===_0x996f('0x1d');var _0xfa7c09=_0x38bb53[_0x996f('0x1e')];var _0x30e89f=_0x14b05f?0x0:_0x1ed71e['offset'];var _0x36b473=_0x14b05f?_0x38bb53[_0x996f('0x1e')]:_0x1ed71e[_0x996f('0x1c')]+_0x1ed71e[_0x996f('0x1f')];var _0x5237b1;if(_0x36b473>=_0xfa7c09){_0x36b473=_0xfa7c09;_0x5237b1=0xc8;}else{_0x5237b1=0xce;}_0x1c1919[_0x996f('0x19')](_0x5237b1);return _0x1c1919[_0x996f('0x20')](_0x996f('0x21'),_0x30e89f+'-'+_0x36b473+'/'+_0xfa7c09)['json'](_0x38bb53);}return null;};}function patchUpdates(_0x4d9de7){return function(_0x4d06a0){try{jsonpatch[_0x996f('0x22')](_0x4d06a0,_0x4d9de7,!![]);}catch(_0x3f0be9){return BPromise[_0x996f('0x23')](_0x3f0be9);}return _0x4d06a0[_0x996f('0x24')]();};}function saveUpdates(_0x387cae,_0x391f42){return function(_0x444ec4){if(_0x444ec4){return _0x444ec4[_0x996f('0x25')](_0x387cae)[_0x996f('0x26')](function(_0x591516){return _0x591516;});}return null;};}function removeEntity(_0x553bea,_0x5b85f2){return function(_0x5f2c71){if(_0x5f2c71){return _0x5f2c71['destroy']()[_0x996f('0x26')](function(){_0x553bea[_0x996f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f3033,_0x2c254c){return function(_0x14520e){if(!_0x14520e){_0x5f3033[_0x996f('0x18')](0x194);}return _0x14520e;};}function handleError(_0x3722fc,_0xe986cf){_0xe986cf=_0xe986cf||0x1f4;return function(_0x24ab59){logger[_0x996f('0x27')](_0x24ab59[_0x996f('0x28')]);if(_0x24ab59[_0x996f('0x29')]){delete _0x24ab59[_0x996f('0x29')];}_0x3722fc[_0x996f('0x19')](_0xe986cf)[_0x996f('0x2a')](_0x24ab59);};}exports[_0x996f('0x2b')]=function(_0x393066,_0x53a6d9){var _0x351d8c={},_0x3e81a8={},_0xaa88de={'count':0x0,'rows':[]};var _0x383fc0=_[_0x996f('0x2c')](db['OpenchannelApplication']['rawAttributes'],function(_0x2a889b){return{'name':_0x2a889b[_0x996f('0x2d')],'type':_0x2a889b[_0x996f('0x2e')][_0x996f('0x2f')]};});_0x3e81a8[_0x996f('0x30')]=_[_0x996f('0x2c')](_0x383fc0,_0x996f('0x29'));_0x3e81a8[_0x996f('0x31')]=_[_0x996f('0x32')](_0x393066[_0x996f('0x31')]);_0x3e81a8[_0x996f('0x33')]=_[_0x996f('0x34')](_0x3e81a8[_0x996f('0x30')],_0x3e81a8['query']);_0x351d8c[_0x996f('0x35')]=_[_0x996f('0x34')](_0x3e81a8[_0x996f('0x30')],qs[_0x996f('0x36')](_0x393066[_0x996f('0x31')]['fields']));_0x351d8c[_0x996f('0x35')]=_0x351d8c[_0x996f('0x35')][_0x996f('0x37')]?_0x351d8c['attributes']:_0x3e81a8['model'];if(!_0x393066[_0x996f('0x31')][_0x996f('0x38')](_0x996f('0x39'))){_0x351d8c[_0x996f('0x1f')]=qs['limit'](_0x393066[_0x996f('0x31')][_0x996f('0x1f')]);_0x351d8c['offset']=qs[_0x996f('0x1c')](_0x393066[_0x996f('0x31')][_0x996f('0x1c')]);}_0x351d8c[_0x996f('0x3a')]=qs[_0x996f('0x3b')](_0x393066['query'][_0x996f('0x3b')]);_0x351d8c[_0x996f('0x3c')]=qs[_0x996f('0x33')](_[_0x996f('0x3d')](_0x393066['query'],_0x3e81a8['filters']),_0x383fc0);if(_0x393066[_0x996f('0x31')][_0x996f('0x3e')]){_0x351d8c[_0x996f('0x3c')]=_[_0x996f('0x3f')](_0x351d8c[_0x996f('0x3c')],{'$or':_[_0x996f('0x2c')](_0x383fc0,function(_0x2882d2){if(_0x2882d2[_0x996f('0x2e')]!==_0x996f('0x40')){var _0x53a123={};_0x53a123[_0x2882d2[_0x996f('0x29')]]={'$like':'%'+_0x393066[_0x996f('0x31')][_0x996f('0x3e')]+'%'};return _0x53a123;}})});}_0x351d8c=_[_0x996f('0x3f')]({},_0x351d8c,_0x393066[_0x996f('0x41')]);var _0xdf9ea={'where':_0x351d8c['where']};return db['OpenchannelApplication'][_0x996f('0x1e')](_0xdf9ea)['then'](function(_0x18799d){_0xaa88de[_0x996f('0x1e')]=_0x18799d;if(_0x393066[_0x996f('0x31')]['includeAll']){_0x351d8c[_0x996f('0x42')]=[{'all':!![]}];}return db[_0x996f('0x43')]['findAll'](_0x351d8c);})['then'](function(_0x139b83){_0xaa88de['rows']=_0x139b83;return _0xaa88de;})[_0x996f('0x26')](respondWithFilteredResult(_0x53a6d9,_0x351d8c))[_0x996f('0x44')](handleError(_0x53a6d9,null));};exports[_0x996f('0x45')]=function(_0x5f32d1,_0x11f075){var _0x59bfba={'raw':!![],'where':{'id':_0x5f32d1['params']['id']}},_0x3715c9={};_0x3715c9['model']=_[_0x996f('0x32')](db['OpenchannelApplication'][_0x996f('0x46')]);_0x3715c9[_0x996f('0x31')]=_[_0x996f('0x32')](_0x5f32d1[_0x996f('0x31')]);_0x3715c9[_0x996f('0x33')]=_[_0x996f('0x34')](_0x3715c9[_0x996f('0x30')],_0x3715c9[_0x996f('0x31')]);_0x59bfba[_0x996f('0x35')]=_[_0x996f('0x34')](_0x3715c9[_0x996f('0x30')],qs[_0x996f('0x36')](_0x5f32d1[_0x996f('0x31')]['fields']));_0x59bfba[_0x996f('0x35')]=_0x59bfba[_0x996f('0x35')][_0x996f('0x37')]?_0x59bfba['attributes']:_0x3715c9[_0x996f('0x30')];if(_0x5f32d1[_0x996f('0x31')]['includeAll']){_0x59bfba[_0x996f('0x42')]=[{'all':!![]}];}_0x59bfba=_[_0x996f('0x3f')]({},_0x59bfba,_0x5f32d1['options']);return db[_0x996f('0x43')]['find'](_0x59bfba)[_0x996f('0x26')](handleEntityNotFound(_0x11f075,null))[_0x996f('0x26')](respondWithResult(_0x11f075,null))[_0x996f('0x44')](handleError(_0x11f075,null));};exports[_0x996f('0x47')]=function(_0x193cf3,_0x2e897c){return db[_0x996f('0x43')][_0x996f('0x47')](_0x193cf3[_0x996f('0x48')],{})['then'](respondWithResult(_0x2e897c,0xc9))['catch'](handleError(_0x2e897c,null));};exports[_0x996f('0x25')]=function(_0x70f84,_0x2c2bb4){if(_0x70f84['body']['id']){delete _0x70f84['body']['id'];}return db[_0x996f('0x43')]['find']({'where':{'id':_0x70f84[_0x996f('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c2bb4,null))['then'](saveUpdates(_0x70f84[_0x996f('0x48')],null))[_0x996f('0x26')](respondWithResult(_0x2c2bb4,null))['catch'](handleError(_0x2c2bb4,null));};exports[_0x996f('0x4a')]=function(_0x408fc8,_0x4e851b){return db['OpenchannelApplication']['find']({'where':{'id':_0x408fc8[_0x996f('0x49')]['id']}})[_0x996f('0x26')](handleEntityNotFound(_0x4e851b,null))[_0x996f('0x26')](removeEntity(_0x4e851b,null))['catch'](handleError(_0x4e851b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 36d1579..dfa5d90 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 _0xc9eb=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications'];(function(_0x20b18f,_0xf29421){var _0x510ea8=function(_0x1b02f8){while(--_0x1b02f8){_0x20b18f['push'](_0x20b18f['shift']());}};_0x510ea8(++_0xf29421);}(_0xc9eb,0x1a6));var _0xbc9e=function(_0x44423d,_0x2e22f3){_0x44423d=_0x44423d-0x0;var _0x314791=_0xc9eb[_0x44423d];return _0x314791;};'use strict';var _=require(_0xbc9e('0x0'));var util=require('util');var logger=require(_0xbc9e('0x1'))(_0xbc9e('0x2'));var moment=require(_0xbc9e('0x3'));var BPromise=require(_0xbc9e('0x4'));var rp=require(_0xbc9e('0x5'));var fs=require('fs');var path=require(_0xbc9e('0x6'));var rimraf=require('rimraf');var config=require(_0xbc9e('0x7'));var attributes=require(_0xbc9e('0x8'));module[_0xbc9e('0x9')]=function(_0x30238b,_0x4799d2){return _0x30238b['define'](_0xbc9e('0xa'),attributes,{'tableName':_0xbc9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc9e('0xc'),'collate':_0xbc9e('0xd')});}; \ No newline at end of file +var _0x5ad3=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x5ad3,0x118));var _0x35ad=function(_0xe4c712,_0x1e26d5){_0xe4c712=_0xe4c712-0x0;var _0x101962=_0x5ad3[_0xe4c712];return _0x101962;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require(_0x35ad('0x4'));var BPromise=require('bluebird');var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));module[_0x35ad('0xa')]=function(_0x4c9a20,_0x1b6c6f){return _0x4c9a20[_0x35ad('0xb')](_0x35ad('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35ad('0xd'),'collate':_0x35ad('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d886046..0f318bf 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(_0x5f26e0,_0x2fb8dd){var _0x70de5a=function(_0x16ed83){while(--_0x16ed83){_0x5f26e0['push'](_0x5f26e0['shift']());}};_0x70de5a(++_0x2fb8dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x344e99,_0x530098){_0x344e99=_0x344e99-0x0;var _0x172d28=_0xb10b[_0x344e99];return _0x172d28;};'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(_0x390361,_0xbf336b){var _0xe3e65e=function(_0x336151){while(--_0x336151){_0x390361['push'](_0x390361['shift']());}};_0xe3e65e(++_0xbf336b);}(_0xb10b,0x12a));var _0xbb10=function(_0x582a04,_0x1ff37e){_0x582a04=_0x582a04-0x0;var _0x546e7a=_0xb10b[_0x582a04];return _0x546e7a;};'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 b3e8ce1..9078f95 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 _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 079b727..2818c37 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 _0x03bc=['exports','DATE','STRING','ENUM','sequelize'];(function(_0x30f0c5,_0x4d34e8){var _0x3b5e80=function(_0x5a5d30){while(--_0x5a5d30){_0x30f0c5['push'](_0x30f0c5['shift']());}};_0x3b5e80(++_0x4d34e8);}(_0x03bc,0x1a8));var _0xc03b=function(_0xf81547,_0x2be058){_0xf81547=_0xf81547-0x0;var _0x5fe859=_0x03bc[_0xf81547];return _0x5fe859;};'use strict';var Sequelize=require(_0xc03b('0x0'));module[_0xc03b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc03b('0x2')]},'disposition':{'type':Sequelize[_0xc03b('0x3')]},'secondDisposition':{'type':Sequelize[_0xc03b('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc03b('0x3')]},'note':{'type':Sequelize[_0xc03b('0x3')]},'read1stAt':{'type':Sequelize[_0xc03b('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xc03b('0x3')]},'lastMsgAt':{'type':Sequelize[_0xc03b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc03b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc03b('0x3')]}}; \ No newline at end of file +var _0x5acb=['ENUM','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x5acb,0x12d));var _0xb5ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5acb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb5ac('0x0'));module[_0xb5ac('0x1')]={'closed':{'type':Sequelize[_0xb5ac('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb5ac('0x3')]},'disposition':{'type':Sequelize[_0xb5ac('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb5ac('0x4')]},'read1stAt':{'type':Sequelize[_0xb5ac('0x3')]},'threadId':{'type':Sequelize[_0xb5ac('0x4')]},'externalUrl':{'type':Sequelize[_0xb5ac('0x4')]},'lastMsgAt':{'type':Sequelize[_0xb5ac('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb5ac('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb5ac('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6a9f6c3..fef9200 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 _0x93bd=['field','u.id','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','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?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','compact','OpenchannelAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','catch','show','params','includeAll','include','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','OpenchannelInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','unix','files','tmp','join','root','server','attachments','format','transcript-%d-%s.zip','User','CmContact','firstName','Messages','createdAt','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','closedAt','Public','Private','Attachment','createReadStream','createWriteStream','basename','out','System','lastName','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','OpenchannelInteraction','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select'];(function(_0x230713,_0x5d135a){var _0x4bf129=function(_0x9db835){while(--_0x9db835){_0x230713['push'](_0x230713['shift']());}};_0x4bf129(++_0x5d135a);}(_0x93bd,0xa4));var _0xd93b=function(_0x5e3656,_0x3d2668){_0x5e3656=_0x5e3656-0x0;var _0x3e6661=_0x93bd[_0x5e3656];return _0x3e6661;};'use strict';var emlformat=require(_0xd93b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd93b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd93b('0x2'));var BPromise=require(_0xd93b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd93b('0x4'));var sox=require(_0xd93b('0x5'));var csv=require(_0xd93b('0x6'));var ejs=require(_0xd93b('0x7'));var fs=require('fs');var fs_extra=require(_0xd93b('0x8'));var _=require('lodash');var squel=require(_0xd93b('0x9'));var crypto=require(_0xd93b('0xa'));var jsforce=require(_0xd93b('0xb'));var deskjs=require(_0xd93b('0xc'));var toCsv=require(_0xd93b('0x6'));var querystring=require(_0xd93b('0xd'));var Papa=require(_0xd93b('0xe'));var Redis=require(_0xd93b('0xf'));var authService=require(_0xd93b('0x10'));var qs=require(_0xd93b('0x11'));var as=require(_0xd93b('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xd93b('0x13'));var logger=require(_0xd93b('0x14'))(_0xd93b('0x15'));var utils=require(_0xd93b('0x16'));var config=require(_0xd93b('0x17'));var licenseUtil=require(_0xd93b('0x18'));var db=require(_0xd93b('0x19'))['db'];config[_0xd93b('0x1a')]=_[_0xd93b('0x1b')](config['redis'],{'host':_0xd93b('0x1c'),'port':0x18eb});var socket=require(_0xd93b('0x1d'))(new Redis(config[_0xd93b('0x1a')]));require(_0xd93b('0x1e'))[_0xd93b('0x1f')](socket);function respondWithStatusCode(_0x2f8ad6,_0x327c5c){_0x327c5c=_0x327c5c||0xcc;return function(_0xb92b1){if(_0xb92b1){return _0x2f8ad6['sendStatus'](_0x327c5c);}return _0x2f8ad6[_0xd93b('0x20')](_0x327c5c)[_0xd93b('0x21')]();};}function respondWithResult(_0xabd86,_0x1b4dfd){_0x1b4dfd=_0x1b4dfd||0xc8;return function(_0x43dbac){if(_0x43dbac){return _0xabd86[_0xd93b('0x20')](_0x1b4dfd)['json'](_0x43dbac);}};}function respondWithFilteredResult(_0x28e37d,_0x389552){return function(_0x542996){if(_0x542996){var _0xd50c03=typeof _0x389552['offset']===_0xd93b('0x22')&&typeof _0x389552[_0xd93b('0x23')]===_0xd93b('0x22');var _0xc1a763=_0x542996[_0xd93b('0x24')];var _0x2a7ce2=_0xd50c03?0x0:_0x389552[_0xd93b('0x25')];var _0x9eb919=_0xd50c03?_0x542996[_0xd93b('0x24')]:_0x389552[_0xd93b('0x25')]+_0x389552[_0xd93b('0x23')];var _0x421981;if(_0x9eb919>=_0xc1a763){_0x9eb919=_0xc1a763;_0x421981=0xc8;}else{_0x421981=0xce;}_0x28e37d[_0xd93b('0x20')](_0x421981);return _0x28e37d[_0xd93b('0x26')](_0xd93b('0x27'),_0x2a7ce2+'-'+_0x9eb919+'/'+_0xc1a763)['json'](_0x542996);}return null;};}function patchUpdates(_0x3388f6){return function(_0x23773e){try{jsonpatch[_0xd93b('0x28')](_0x23773e,_0x3388f6,!![]);}catch(_0x59cad4){return BPromise[_0xd93b('0x29')](_0x59cad4);}return _0x23773e[_0xd93b('0x2a')]();};}function saveUpdates(_0x5dc016,_0x22eefd){return function(_0x50dc34){if(_0x50dc34){return _0x50dc34[_0xd93b('0x2b')](_0x5dc016)[_0xd93b('0x2c')](function(_0x18a6db){return _0x18a6db;});}return null;};}function removeEntity(_0x598b45,_0xd73283){return function(_0x26597b){if(_0x26597b){return _0x26597b[_0xd93b('0x2d')]()['then'](function(){_0x598b45['status'](0xcc)[_0xd93b('0x21')]();});}};}function handleEntityNotFound(_0x5c34bb,_0x349eaf){return function(_0x587aa4){if(!_0x587aa4){_0x5c34bb[_0xd93b('0x2e')](0x194);}return _0x587aa4;};}function handleError(_0xda05f7,_0x575144){_0x575144=_0x575144||0x1f4;return function(_0x100e04){logger['error'](_0x100e04[_0xd93b('0x2f')]);if(_0x100e04[_0xd93b('0x30')]){delete _0x100e04[_0xd93b('0x30')];}_0xda05f7[_0xd93b('0x20')](_0x575144)[_0xd93b('0x31')](_0x100e04);};}function getInteractionUsers(_0x18ba46,_0x5a0b76){return new BPromise(function(_0x43e90a,_0x4acbfa){try{if(_0x5a0b76[_0x18ba46['id']]){_0x18ba46[_0xd93b('0x32')]=_[_0xd93b('0x33')](_0x5a0b76[_0x18ba46['id']],function(_0x5a9b47){return{'id':_0x5a9b47['id'],'fullname':_0x5a9b47[_0xd93b('0x34')]};});}}catch(_0x5692b0){_0x4acbfa(_0x5692b0);}_0x43e90a(_0x18ba46);});}function getInteractionTags(_0x5c78ef,_0x130566){return new BPromise(function(_0x2467bc,_0x2cdf1e){try{if(_0x5c78ef[_0xd93b('0x35')]){_0x5c78ef[_0xd93b('0x36')]=[];_0x5c78ef[_0xd93b('0x35')][_0xd93b('0x37')](',')[_0xd93b('0x38')](function(_0x4616a5){_0x5c78ef[_0xd93b('0x36')][_0xd93b('0x39')](_0x130566[_0x4616a5]);});}delete _0x5c78ef[_0xd93b('0x35')];}catch(_0x459c33){_0x2cdf1e(_0x459c33);}_0x2467bc(_0x5c78ef);});}function updateOpenchannelInteraction(_0x4c1804,_0x1c899d,_0x1ba758){return new BPromise(function(_0x412c5e,_0xb5be7f){return getInteractionUsers(_0x4c1804,_0x1ba758)[_0xd93b('0x2c')](function(_0xc18f07){return getInteractionTags(_0xc18f07,_0x1c899d);})[_0xd93b('0x2c')](function(_0x50f085){_0x412c5e(_0x50f085);})['catch'](function(_0x2b9a6a){_0xb5be7f(_0x2b9a6a);});});}exports[_0xd93b('0x3a')]=function(_0x322206,_0x1ba391){var _0x5db358={},_0xa1a283={},_0x67ccfc={'count':0x0,'rows':[]};var _0x369889=_[_0xd93b('0x33')](db[_0xd93b('0x3b')][_0xd93b('0x3c')],function(_0x36f21b){return{'name':_0x36f21b['fieldName'],'type':_0x36f21b[_0xd93b('0x3d')][_0xd93b('0x3e')]};});_0xa1a283[_0xd93b('0x3f')]=_['map'](_0x369889,_0xd93b('0x30'));_0xa1a283['query']=_[_0xd93b('0x40')](_0x322206[_0xd93b('0x41')]);_0xa1a283['filters']=_[_0xd93b('0x42')](_0xa1a283[_0xd93b('0x3f')],_0xa1a283[_0xd93b('0x41')]);_0x5db358[_0xd93b('0x43')]=_[_0xd93b('0x42')](_0xa1a283['model'],qs[_0xd93b('0x44')](_0x322206[_0xd93b('0x41')][_0xd93b('0x44')]));_0x5db358['attributes']=_0x5db358[_0xd93b('0x43')][_0xd93b('0x45')]?_0x5db358[_0xd93b('0x43')]:_0xa1a283[_0xd93b('0x3f')];if(!_0x322206[_0xd93b('0x41')][_0xd93b('0x46')](_0xd93b('0x47'))){_0x5db358[_0xd93b('0x23')]=qs['limit'](_0x322206[_0xd93b('0x41')]['limit']);_0x5db358['offset']=qs['offset'](_0x322206[_0xd93b('0x41')]['offset']);}_0x5db358[_0xd93b('0x48')]=qs[_0xd93b('0x49')](_0x322206[_0xd93b('0x41')]['sort']);_0x5db358[_0xd93b('0x4a')]=qs['filters'](_['pick'](_0x322206[_0xd93b('0x41')],_0xa1a283[_0xd93b('0x4b')]),_0x369889);var _0x21d697=[];var _0x1e8903=squel[_0xd93b('0x4c')]()[_0xd93b('0x4d')]('id')['field'](_0xd93b('0x30'))[_0xd93b('0x4d')]('color')['from']('tools_tags');var _0x9cb202=squel[_0xd93b('0x4c')]()[_0xd93b('0x4d')](_0xd93b('0x4e'))[_0xd93b('0x4d')]('u.fullname')[_0xd93b('0x4d')](_0xd93b('0x4f'))[_0xd93b('0x50')](_0xd93b('0x51'),'ui')[_0xd93b('0x52')](_0xd93b('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x383bde=squel[_0xd93b('0x4c')]()[_0xd93b('0x50')]('openchannel_interactions','i')[_0xd93b('0x52')](_0xd93b('0x54'),'c',_0xd93b('0x55'))['left_join'](_0xd93b('0x53'),'o','o.id\x20=\x20i.UserId')[_0xd93b('0x52')](_0xd93b('0x56'),'a',_0xd93b('0x57'))['left_join'](_0xd93b('0x58'),'me',_0xd93b('0x59'))[_0xd93b('0x52')](_0xd93b('0x5a'),'it',_0xd93b('0x5b'))[_0xd93b('0x52')](_0xd93b('0x5c'),'t',_0xd93b('0x5d'));var _0xd4081f=squel[_0xd93b('0x5e')]();var _0x43131d=[];var _0x1b3383=squel[_0xd93b('0x5e')]();var _0x90e487;if(_0x322206['query'][_0xd93b('0x5f')]){_0x90e487=as['parseSearch'](_0x322206[_0xd93b('0x41')][_0xd93b('0x5f')]);var _0x9399d2=_0x90e487[_0xd93b('0x60')];for(var _0x139c4e=0x0;_0x139c4e<_0x90e487[_0xd93b('0x61')]['length'];_0x139c4e++){var _0x5d722d=_0x90e487[_0xd93b('0x61')][_0x139c4e];var _0x5949d6='i';var _0x32bdb8=_['find'](_0x369889,[_0xd93b('0x30'),_0x5d722d[_0xd93b('0x4d')]]);if(!_0x32bdb8){switch(_0x5d722d[_0xd93b('0x4d')]){case _0xd93b('0x62'):if(_0x5d722d['value']==0x1){_0x383bde[_0xd93b('0x63')]('`'+_0x5d722d[_0xd93b('0x4d')]+'`\x20=\x200');}else{_0x383bde['having']('`'+_0x5d722d[_0xd93b('0x4d')]+_0xd93b('0x64'));}break;case _0xd93b('0x65'):if(_0x5d722d[_0xd93b('0x66')]==='$substring'){if(_0x5d722d[_0xd93b('0x67')][_0xd93b('0x37')]('\x20')[_0xd93b('0x45')]>0x1){_0xd4081f[_0x9399d2](_0xd93b('0x68'),qs[_0xd93b('0x69')](_0x5d722d[_0xd93b('0x67')]),null);}else{var _0x40eda0='%'+_0x5d722d['value']+'%';_0xd4081f[_0x9399d2](_0xd93b('0x6a'),_0x40eda0,_0x40eda0,_0x40eda0);}}else{_0x32bdb8=_[_0xd93b('0x6b')](_0x369889,[_0xd93b('0x30'),_0xd93b('0x6c')]);_0x5d722d[_0xd93b('0x4d')]=_0xd93b('0x6c');_0x40f91e=as[_0xd93b('0x6d')](_0x5949d6,_0x32bdb8['type'],_0x5d722d);_0xd4081f[_0x9399d2](_0x40f91e[_0xd93b('0x6e')],_0x40f91e['value'][_0xd93b('0x6f')],_0x40f91e[_0xd93b('0x67')][_0xd93b('0x21')]);}break;case _0xd93b('0x70'):var _0x268d61=_0x5d722d['value'][_0xd93b('0x37')](',')[_0xd93b('0x33')](function(_0x129e41){return Number(_0x129e41);});_0x268d61[_0xd93b('0x38')](function(_0x15b6a0){_0x1b3383['or'](_0xd93b('0x71'),'%,'+_0x15b6a0+',%');});_0x43131d=_['union'](_0x43131d,_0x268d61);break;case'User':if(_0x5d722d['operator']===_0xd93b('0x72')){_0xd4081f[_0x9399d2](_0xd93b('0x73'),'%'+_0x5d722d[_0xd93b('0x67')]+'%',null);}else{_0x32bdb8=_[_0xd93b('0x6b')](_0x369889,[_0xd93b('0x30'),_0xd93b('0x74')]);_0x5d722d['field']='UserId';_0x40f91e=as[_0xd93b('0x6d')](_0x5949d6,_0x32bdb8[_0xd93b('0x3d')],_0x5d722d);_0xd4081f[_0x9399d2](_0x40f91e[_0xd93b('0x6e')],_0x40f91e[_0xd93b('0x67')][_0xd93b('0x6f')],_0x40f91e['value'][_0xd93b('0x21')]);}break;case'body':_0x40f91e=as['buildExpression']('me',null,_0x5d722d);_0xd4081f[_0x9399d2](_0x40f91e[_0xd93b('0x6e')],_0x40f91e['value'][_0xd93b('0x6f')],_0x40f91e[_0xd93b('0x67')][_0xd93b('0x21')]);break;}}else{var _0x40f91e=as['buildExpression'](_0x5949d6,_0x32bdb8[_0xd93b('0x3d')],_0x5d722d);_0xd4081f[_0x9399d2](_0x40f91e[_0xd93b('0x6e')],_0x40f91e['value']['start'],_0x40f91e['value'][_0xd93b('0x21')]);}}}else{var _0x5c3abc=_(_0x322206[_0xd93b('0x41')])[_0xd93b('0x40')]()['map'](function(_0xc90624){return _['some'](_0x369889,[_0xd93b('0x30'),_0xc90624])?_0xc90624:undefined;})[_0xd93b('0x75')]()[_0xd93b('0x67')]();if(!_['isEmpty'](_0x5c3abc)){_0x5c3abc['forEach'](function(_0x3f698e){if(_0x3f698e===_0xd93b('0x76')){_0x383bde[_0xd93b('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xd93b('0x77')](_0x322206['query'][_0x3f698e]));}else if(_0x3f698e==='createdAt'){var _0x4878a0=JSON[_0xd93b('0x78')](_0x322206['query'][_0x3f698e])[_0xd93b('0x79')];var _0x18106c=JSON[_0xd93b('0x78')](_0x322206['query'][_0x3f698e])[_0xd93b('0x7a')];_0x383bde[_0xd93b('0x4a')](_0xd93b('0x7b'),_0x4878a0,_0x18106c);}else{if(_0x322206[_0xd93b('0x41')][_0x3f698e]==='null'){_0x383bde['where']('i.'+_0x3f698e+_0xd93b('0x7c'));}else{_0x383bde[_0xd93b('0x4a')]('i.'+_0x3f698e+_0xd93b('0x7d'),_0x322206['query'][_0x3f698e]);}}});}if(_0x322206[_0xd93b('0x41')]['read']){if(_0x322206[_0xd93b('0x41')][_0xd93b('0x7e')]==0x1){_0x383bde[_0xd93b('0x63')](_0xd93b('0x7f'));}else{_0x383bde[_0xd93b('0x63')](_0xd93b('0x80'));}}if(_0x322206[_0xd93b('0x41')][_0xd93b('0x81')]){_0x43131d=_['isArray'](_0x322206[_0xd93b('0x41')][_0xd93b('0x81')])?_0x322206[_0xd93b('0x41')]['tag']:new Array(_0x322206[_0xd93b('0x41')]['tag']);_0x43131d[_0xd93b('0x38')](function(_0x41be64){_0x1b3383['or'](_0xd93b('0x71'),'%,'+_0x41be64+',%');});}if(_0x322206[_0xd93b('0x41')][_0xd93b('0x82')]){var _0x146106=_0x322206[_0xd93b('0x41')][_0xd93b('0x82')]['replace']('\x5c','\x5c\x5c')[_0xd93b('0x83')](/'/g,'\x27\x27');if(qs[_0xd93b('0x84')](_0x146106)){_0xd4081f['or'](_0xd93b('0x85'),_0x146106+'%');}else{_0xd4081f['or'](_0xd93b('0x86'),qs[_0xd93b('0x69')](_0x146106))['or']('i.from\x20LIKE\x20?',_0x146106+'%')['or'](_0xd93b('0x87'),_0x146106+'%');}}}_0x383bde['where'](_0xd4081f);_0x383bde['group']('i.id');var _0x4705c8={'type':db[_0xd93b('0x88')][_0xd93b('0x89')][_0xd93b('0x8a')],'raw':!![]};var _0x416859=_0x383bde[_0xd93b('0x8b')]();_0x416859[_0xd93b('0x4d')](_0xd93b('0x8c'));_0x416859[_0xd93b('0x4d')](_0xd93b('0x8d'),'unreadMessages');if(_0x5db358[_0xd93b('0x48')]){_0x5db358[_0xd93b('0x48')][_0xd93b('0x38')](function(_0x11a133){var _0x20b72e=_0x11a133[0x0]==='contactName'?_0x11a133[0x0]:'i.'+_0x11a133[0x0];_0x383bde[_0xd93b('0x48')](_0x20b72e,_0x11a133[0x1]===_0xd93b('0x8e')?![]:!![]);});}if(!_[_0xd93b('0x8f')](_0x43131d)){_0x383bde[_0xd93b('0x63')](_0x1b3383);_0x416859[_0xd93b('0x4a')]('t.id\x20IN\x20?',_0x43131d);}BPromise['resolve']()[_0xd93b('0x2c')](function(){if(!_0x90e487){if(_0x322206['query'][_0xd93b('0x76')])return;_0x416859['where'](_0xd93b('0x90'));_0x383bde['where'](_0xd93b('0x90'));return;}if(_0x322206[_0xd93b('0x91')][_0xd93b('0x92')]!=='agent')return;return _0x322206[_0xd93b('0x91')][_0xd93b('0x93')]({'attributes':['id'],'raw':!![]})[_0xd93b('0x2c')](function(_0x54f097){if(_[_0xd93b('0x8f')](_0x54f097)){_0x416859[_0xd93b('0x4a')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x383bde[_0xd93b('0x4a')](_0xd93b('0x94'));}else{_0x416859[_0xd93b('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xd93b('0x33')](_0x54f097,'id'));_0x383bde[_0xd93b('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xd93b('0x33')](_0x54f097,'id'));}});})[_0xd93b('0x2c')](function(){if(_0x322206['user'][_0xd93b('0x92')]===_0xd93b('0x95')&&!_0x90e487&&!_0x322206[_0xd93b('0x41')][_0xd93b('0x76')])return[];return db[_0xd93b('0x96')][_0xd93b('0x41')](_0x416859[_0xd93b('0x97')](),_0x4705c8);})[_0xd93b('0x2c')](function(_0x3498d7){_0x67ccfc[_0xd93b('0x24')]=_0x3498d7['length'];if(_0x67ccfc['count']===0x0)return[];return db[_0xd93b('0x96')]['query'](_0x1e8903[_0xd93b('0x97')](),_0x4705c8)[_0xd93b('0x2c')](function(_0x531ba0){_0x21d697=_[_0xd93b('0x98')](_0x531ba0,'id');_0x4705c8=_[_0xd93b('0x99')](_0x4705c8,{'model':db[_0xd93b('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x322206[_0xd93b('0x41')][_0xd93b('0x44')]){_0x5db358[_0xd93b('0x43')][_0xd93b('0x38')](function(_0x49e275){_0x383bde[_0xd93b('0x4d')]('i.'+_0x49e275);});}else{_0x383bde[_0xd93b('0x4d')](_0xd93b('0x8d'),_0xd93b('0x62'));_0x383bde[_0xd93b('0x4d')](_0xd93b('0x9a'),_0xd93b('0x9b'));_0x383bde[_0xd93b('0x4d')](_0xd93b('0x9c'),_0xd93b('0x9d'));_0x383bde[_0xd93b('0x4d')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x383bde[_0xd93b('0x4d')]('i.*');_0x383bde[_0xd93b('0x4d')](_0xd93b('0x9e'),_0xd93b('0x9f'));_0x383bde[_0xd93b('0x4d')]('c.lastName',_0xd93b('0xa0'));_0x383bde[_0xd93b('0x4d')](_0xd93b('0xa1'),_0xd93b('0xa2'));_0x383bde['field'](_0xd93b('0xa3'),_0xd93b('0xa4'));_0x383bde[_0xd93b('0x4d')](_0xd93b('0xa5'),_0xd93b('0xa6'));_0x383bde['field'](_0xd93b('0xa7'),'Contact.fax');_0x383bde[_0xd93b('0x4d')](_0xd93b('0xa8'),'Owner.fullname');_0x383bde[_0xd93b('0x4d')](_0xd93b('0xa9'),_0xd93b('0xaa'));_0x383bde['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd93b('0x35'));}if(_0x5db358['limit'])_0x383bde['limit'](_0x5db358[_0xd93b('0x23')]);if(_0x5db358[_0xd93b('0x25')])_0x383bde[_0xd93b('0x25')](_0x5db358[_0xd93b('0x25')]);return db[_0xd93b('0x96')][_0xd93b('0x41')](_0x383bde[_0xd93b('0x97')](),_0x4705c8);})[_0xd93b('0x2c')](function(_0x50f64e){if(_0x50f64e[_0xd93b('0x45')]>0x0)_0x9cb202[_0xd93b('0x4a')](_0xd93b('0xab'),_[_0xd93b('0x33')](_0x50f64e,'id'));return db[_0xd93b('0x96')]['query'](_0x9cb202[_0xd93b('0x97')](),_0x4705c8)[_0xd93b('0x2c')](function(_0x571856){var _0x57259e=_[_0xd93b('0xac')](_0x571856,'OpenchannelInteractionId');var _0x1450a2=[];_0x50f64e[_0xd93b('0x38')](function(_0x5bd4c9){_0x1450a2[_0xd93b('0x39')](updateOpenchannelInteraction(_0x5bd4c9,_0x21d697,_0x57259e));});return BPromise[_0xd93b('0xad')](_0x1450a2);});});})[_0xd93b('0x2c')](function(_0x525422){_0x67ccfc['rows']=_0x525422;return _0x67ccfc;})[_0xd93b('0x2c')](respondWithFilteredResult(_0x1ba391,_0x5db358))[_0xd93b('0xae')](handleError(_0x1ba391,null));};exports[_0xd93b('0xaf')]=function(_0x4490a0,_0xad199){var _0xfbf01f={};if(_0x4490a0['query'][_0xd93b('0x3d')]&&_0x4490a0['query']['type']===_0xd93b('0x50')){_0xfbf01f['from']=_0x4490a0[_0xd93b('0xb0')]['id'];}else{_0xfbf01f['id']=_0x4490a0[_0xd93b('0xb0')]['id'];}var _0x4b0447={'raw':![],'where':_0xfbf01f},_0x5d108f={};_0x5d108f[_0xd93b('0x3f')]=_[_0xd93b('0x40')](db[_0xd93b('0x3b')]['rawAttributes']);_0x5d108f[_0xd93b('0x41')]=_[_0xd93b('0x40')](_0x4490a0['query']);_0x5d108f[_0xd93b('0x4b')]=_['intersection'](_0x5d108f['model'],_0x5d108f['query']);_0x4b0447[_0xd93b('0x43')]=_['intersection'](_0x5d108f[_0xd93b('0x3f')],qs['fields'](_0x4490a0['query'][_0xd93b('0x44')]));_0x4b0447['attributes']=_0x4b0447[_0xd93b('0x43')][_0xd93b('0x45')]?_0x4b0447[_0xd93b('0x43')]:_0x5d108f[_0xd93b('0x3f')];if(_0x4490a0[_0xd93b('0x41')][_0xd93b('0xb1')]){_0x4b0447[_0xd93b('0xb2')]=[{'all':!![]}];}_0x4b0447=_[_0xd93b('0x99')]({},_0x4b0447,_0x4490a0['options']);return db[_0xd93b('0x3b')]['find'](_0x4b0447)[_0xd93b('0x2c')](handleEntityNotFound(_0xad199,null))[_0xd93b('0x2c')](respondWithResult(_0xad199,null))['catch'](handleError(_0xad199,null));};exports[_0xd93b('0xb3')]=function(_0x30d09d,_0x1482b1){return db['OpenchannelInteraction'][_0xd93b('0xb3')](_0x30d09d[_0xd93b('0xb4')],{})[_0xd93b('0x2c')](respondWithResult(_0x1482b1,0xc9))[_0xd93b('0xae')](handleError(_0x1482b1,null));};exports['update']=function(_0x409de2,_0x1b5c0c){if(_0x409de2[_0xd93b('0xb4')]['id']){delete _0x409de2[_0xd93b('0xb4')]['id'];}return db['OpenchannelInteraction'][_0xd93b('0x6b')]({'where':{'id':_0x409de2['params']['id']}})[_0xd93b('0x2c')](handleEntityNotFound(_0x1b5c0c,null))['then'](saveUpdates(_0x409de2[_0xd93b('0xb4')],null))[_0xd93b('0x2c')](respondWithResult(_0x1b5c0c,null))['catch'](handleError(_0x1b5c0c,null));};exports['destroy']=function(_0x45ff1d,_0x48ca31){return db[_0xd93b('0x3b')][_0xd93b('0x6b')]({'where':{'id':_0x45ff1d[_0xd93b('0xb0')]['id']}})[_0xd93b('0x2c')](handleEntityNotFound(_0x48ca31,null))[_0xd93b('0x2c')](removeEntity(_0x48ca31,null))[_0xd93b('0xae')](handleError(_0x48ca31,null));};exports[_0xd93b('0xb5')]=function(_0x41465d,_0x1a5381){return db[_0xd93b('0x3b')][_0xd93b('0xb5')]()[_0xd93b('0x2c')](respondWithResult(_0x1a5381,null))['catch'](handleError(_0x1a5381,null));};exports[_0xd93b('0xb6')]=function(_0x1f14fb,_0x5f0cef,_0xefbaf0){return db[_0xd93b('0xb7')][_0xd93b('0x6b')]({'where':{'id':_0x1f14fb['params']['id']}})['then'](handleEntityNotFound(_0x5f0cef,null))[_0xd93b('0x2c')](function(_0x55c1d0){if(_0x55c1d0){return _0x55c1d0[_0xd93b('0xb6')](_0x1f14fb[_0xd93b('0xb4')][_0xd93b('0xb8')],_[_0xd93b('0xb9')](_0x1f14fb[_0xd93b('0xb4')],['ids','id'])||{});}})[_0xd93b('0x2c')](respondWithResult(_0x5f0cef,null))[_0xd93b('0xae')](handleError(_0x5f0cef,null));};exports[_0xd93b('0xba')]=function(_0x218e36,_0x58918e,_0x46612d){var _0x4c6a52={'raw':![],'where':{}};var _0x1697b4={};var _0x37911d={'count':0x0,'rows':[]};return db[_0xd93b('0x3b')][_0xd93b('0xbb')]({'where':{'id':_0x218e36['params']['id']}})[_0xd93b('0x2c')](handleEntityNotFound(_0x58918e,null))[_0xd93b('0x2c')](function(_0x56203f){if(_0x56203f){_0x1697b4[_0xd93b('0x3f')]=_[_0xd93b('0x40')](db['OpenchannelMessage'][_0xd93b('0x3c')]);_0x1697b4[_0xd93b('0x41')]=_[_0xd93b('0x40')](_0x218e36[_0xd93b('0x41')]);_0x1697b4[_0xd93b('0x4b')]=_['intersection'](_0x1697b4[_0xd93b('0x3f')],_0x1697b4['query']);_0x4c6a52[_0xd93b('0x43')]=_[_0xd93b('0x42')](_0x1697b4[_0xd93b('0x3f')],qs[_0xd93b('0x44')](_0x218e36[_0xd93b('0x41')][_0xd93b('0x44')]));_0x4c6a52[_0xd93b('0x43')]=_0x4c6a52[_0xd93b('0x43')]['length']?_0x4c6a52[_0xd93b('0x43')]:_0x1697b4[_0xd93b('0x3f')];if(!_0x218e36[_0xd93b('0x41')]['hasOwnProperty'](_0xd93b('0x47'))){_0x4c6a52[_0xd93b('0x23')]=qs['limit'](_0x218e36[_0xd93b('0x41')][_0xd93b('0x23')]);_0x4c6a52[_0xd93b('0x25')]=qs[_0xd93b('0x25')](_0x218e36[_0xd93b('0x41')][_0xd93b('0x25')]);}_0x4c6a52['order']=qs[_0xd93b('0x49')](_0x218e36['query'][_0xd93b('0x49')]);_0x4c6a52[_0xd93b('0x4a')]=qs[_0xd93b('0x4b')](_[_0xd93b('0xbc')](_0x218e36[_0xd93b('0x41')],_0x1697b4[_0xd93b('0x4b')]));_0x4c6a52['where'][_0xd93b('0xbd')]=_0x56203f['id'];if(_0x218e36[_0xd93b('0x41')]['filter']){_0x4c6a52[_0xd93b('0x4a')]=_[_0xd93b('0x99')](_0x4c6a52['where'],{'$or':_[_0xd93b('0x33')](_0x4c6a52[_0xd93b('0x43')],function(_0x4f4ac0){var _0x1351c3={};_0x1351c3[_0x4f4ac0]={'$like':'%'+_0x218e36['query'][_0xd93b('0x82')]+'%'};return _0x1351c3;})});}if(_0x218e36[_0xd93b('0x41')]['$gte']){var _0x27818b=_0x218e36[_0xd93b('0x41')]['$gte'][_0xd93b('0x37')](',');var _0x272c2f={};_0x272c2f[_0x27818b[0x0]]={'$gte':moment(_0x27818b[0x1])['format'](_0xd93b('0xbe'))};_0x4c6a52[_0xd93b('0x4a')]=_[_0xd93b('0x99')](_0x4c6a52[_0xd93b('0x4a')],_0x272c2f);}_0x4c6a52=_[_0xd93b('0x99')]({},_0x4c6a52,_0x218e36[_0xd93b('0xbf')]);return db[_0xd93b('0xb7')][_0xd93b('0x24')]({'where':_0x4c6a52[_0xd93b('0x4a')]})[_0xd93b('0x2c')](function(_0x11c91f){_0x37911d['count']=_0x11c91f;if(_0x218e36[_0xd93b('0x41')]['includeAll']){_0x4c6a52[_0xd93b('0xb2')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xd93b('0xc0')](_0x4c6a52);})[_0xd93b('0x2c')](function(_0x1e5ec9){_0x37911d['rows']=_0x1e5ec9;return _0x37911d;});}})[_0xd93b('0x2c')](respondWithFilteredResult(_0x58918e,_0x4c6a52))[_0xd93b('0xae')](handleError(_0x58918e,null));};exports[_0xd93b('0xc1')]=function(_0x48675b,_0x1839e2,_0x493d47){return db[_0xd93b('0x3b')]['find']({'where':{'id':_0x48675b['params']['id']}})[_0xd93b('0x2c')](handleEntityNotFound(_0x1839e2,null))[_0xd93b('0x2c')](function(_0x2368b7){if(_0x2368b7){return _0x2368b7[_0xd93b('0xc2')](_0x48675b['body']['ids'],_[_0xd93b('0xb9')](_0x48675b[_0xd93b('0xb4')],['ids','id'])||{})[_0xd93b('0xc3')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xd93b('0xc4')],'where':{'id':_0x48675b['body']['ids']}});})[_0xd93b('0x2c')](function(_0x52767b){socket[_0xd93b('0xc5')](_0xd93b('0xc6'),{'id':Number(_0x48675b[_0xd93b('0xb0')]['id']),'tags':_0x52767b||[]});return{'id':Number(_0x48675b[_0xd93b('0xb0')]['id']),'tags':_0x52767b||[]};});}})[_0xd93b('0x2c')](respondWithResult(_0x1839e2,null))[_0xd93b('0xae')](handleError(_0x1839e2,null));};exports[_0xd93b('0xc7')]=function(_0x2d12a6,_0x2822f1,_0x242230){return db[_0xd93b('0x3b')][_0xd93b('0x6b')]({'where':{'id':_0x2d12a6[_0xd93b('0xb0')]['id']}})['then'](handleEntityNotFound(_0x2822f1,null))[_0xd93b('0x2c')](function(_0x102699){if(_0x102699){return _0x102699['removeTags'](_0x2d12a6[_0xd93b('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x2822f1,null))['catch'](handleError(_0x2822f1,null));};exports['download']=function(_0xcccd45,_0x3b2aa3){var _0x2f0099=moment()[_0xd93b('0xc8')]()[_0xd93b('0x97')]();var _0x46c833=path['join'](config['root'],'server',_0xd93b('0xc9'),_0xd93b('0xca'));var _0x197170=path[_0xd93b('0xcb')](config[_0xd93b('0xcc')],_0xd93b('0xcd'),_0xd93b('0xc9'),_0xd93b('0xce'));var _0x2f24b6=path['join'](_0x46c833,_0x2f0099);var _0x22e033=util[_0xd93b('0xcf')](_0xd93b('0xd0'),_0xcccd45[_0xd93b('0xb0')]['id'],_0x2f0099);var _0x1bb034=path['join'](_0x46c833,_0x22e033);var _0x54e1bc=[];_0x54e1bc[_0xd93b('0x39')]({'model':db[_0xd93b('0xd1')],'as':_0xd93b('0xd1'),'attributes':['id',_0xd93b('0x34')],'raw':!![]});_0x54e1bc[_0xd93b('0x39')]({'model':db[_0xd93b('0xd2')],'as':_0xd93b('0x65'),'attributes':['id',_0xd93b('0xd3'),'lastName'],'raw':!![]});if(_0xcccd45[_0xd93b('0x41')][_0xd93b('0xce')]){_0x54e1bc[_0xd93b('0x39')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x1b91e5=[{'model':db[_0xd93b('0xb7')],'as':_0xd93b('0xd4'),'attributes':['id',_0xd93b('0xb4'),_0xd93b('0xd5'),_0xd93b('0xd6'),_0xd93b('0xd7'),_0xd93b('0x7e')],'include':_0x54e1bc}];_0x1b91e5['push']({'model':db[_0xd93b('0xd8')],'as':_0xd93b('0xd9'),'attributes':['id',_0xd93b('0x30')]});_0x1b91e5[_0xd93b('0x39')]({'model':db[_0xd93b('0xd1')],'as':'Owner','attributes':['id',_0xd93b('0x34')]});return db[_0xd93b('0x3b')][_0xd93b('0x6b')]({'where':{'id':_0xcccd45[_0xd93b('0xb0')]['id']},'include':_0x1b91e5})[_0xd93b('0x2c')](handleEntityNotFound(_0x3b2aa3,null))['then'](function(_0xfc2184){if(_0xfc2184){var _0x566e2c=_0xfc2184[_0xd93b('0xda')]({'plain':!![]});fs[_0xd93b('0xdb')](_0x2f24b6);var _0x221fe4={'channel':_0xd93b('0xdc'),'account':_0x566e2c[_0xd93b('0xd9')]['name'],'agent':_0x566e2c[_0xd93b('0xdd')]?_0x566e2c[_0xd93b('0xdd')][_0xd93b('0x34')]:'N.A.','createdAt':moment(_0x566e2c[_0xd93b('0xd5')])[_0xd93b('0xcf')](_0xd93b('0xbe'))[_0xd93b('0x97')](),'closedAt':_0x566e2c['closed']?moment(_0x566e2c[_0xd93b('0xde')])[_0xd93b('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd93b('0x97')]():'','disposition':_0x566e2c['disposition'],'visibility':_0x566e2c['threadId']?_0xd93b('0xdf'):_0xd93b('0xe0'),'messages':_(_0x566e2c[_0xd93b('0xd4')])[_0xd93b('0x82')]({'secret':![]})[_0xd93b('0x33')](function(_0x2f0868){if(_0x2f0868[_0xd93b('0xe1')]){var _0x3fb9dd=path['join'](_0x197170,_0x2f0868[_0xd93b('0xe1')]['basename']);if(fs['existsSync'](_0x3fb9dd)){fs[_0xd93b('0xe2')](_0x3fb9dd)['pipe'](fs[_0xd93b('0xe3')](path[_0xd93b('0xcb')](_0x2f24b6,_0x2f0868[_0xd93b('0xe1')][_0xd93b('0xe4')])));}}return{'date':moment(_0x2f0868[_0xd93b('0xd5')])[_0xd93b('0xcf')](_0xd93b('0xbe'))[_0xd93b('0x97')](),'sender':_0x2f0868[_0xd93b('0xd6')]===_0xd93b('0xe5')?_0x2f0868['User']?_0x2f0868['User'][_0xd93b('0x34')]:_0xd93b('0xe6'):_0x2f0868[_0xd93b('0x65')][_0xd93b('0xd3')]+(_0x2f0868[_0xd93b('0x65')][_0xd93b('0xe7')]?'\x20'+_0x2f0868[_0xd93b('0x65')]['lastName']:''),'body':_0x2f0868[_0xd93b('0xe1')]?_0x2f0868[_0xd93b('0xe1')]['basename']:_0x2f0868[_0xd93b('0xb4')],'direction':_0x2f0868[_0xd93b('0xd6')]===_0xd93b('0xe5')?'A':'C','secret':_0x2f0868[_0xd93b('0xd7')],'read':_0x2f0868[_0xd93b('0x7e')],'attachment':_0x2f0868[_0xd93b('0xe1')]};})[_0xd93b('0x67')]()};return ejs['renderFile'](path['join'](config[_0xd93b('0xcc')],_0xd93b('0xcd'),_0xd93b('0xe8'),_0xd93b('0xe9')),{'interaction':_0x221fe4})['then'](function(_0x55efc6){var _0x2af99d=path[_0xd93b('0xcb')](_0x2f24b6,_0xd93b('0xea')+_0x566e2c['id']+'-'+_0x2f0099+_0xd93b('0xeb'));var _0x310e20={'path':_0x2af99d,'channel':_0xd93b('0xdc'),'interactionId':_0x566e2c['id']};return pdf[_0xd93b('0xec')](_0x55efc6,_0x310e20);})[_0xd93b('0x2c')](function(){return new BPromise(function(_0x326490,_0x46f5c2){zipdir(_0x2f24b6,{'saveTo':_0x1bb034},function(_0x529695,_0x351219){if(_0x529695)return _0x46f5c2(_0x529695);return _0x326490(_0x351219);});})[_0xd93b('0x2c')](function(){return new BPromise(function(_0x5e7efb,_0x4bf355){rimraf(_0x2f24b6,function(_0x21f9ad){if(_0x21f9ad)_0x4bf355(_0x21f9ad);return _0x5e7efb();});});})['then'](function(){return _0x3b2aa3[_0xd93b('0xed')](_0x1bb034,_0x22e033,function(_0x109b08){if(_0x109b08){console[_0xd93b('0xee')](_0xd93b('0xef'),_0x109b08);}else{fs[_0xd93b('0xf0')](_0x1bb034);}});});});}else{return _0x3b2aa3['sendStatus'](0xc8);}})[_0xd93b('0xae')](handleError(_0x3b2aa3,null));}; \ No newline at end of file +var _0x645c=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','Users','map','fullname','TagIds','Tags','split','forEach','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','field','from','tools_tags','u.id','ui.OpenchannelInteractionId','users','u.id\x20=\x20ui.UserId','select','openchannel_interactions','left_join','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','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','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?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','UserId','text','start','keys','some','compact','isEmpty','OpenchannelAccountId','where','concat','createdAt','$gte','parse','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','all','rows','catch','show','params','includeAll','include','options','create','body','destroy','addMessage','OpenchannelMessage','omit','getMessages','findOne','pick','OpenchannelInteractionId','format','findAll','addTags','setTags','ids','spread','color','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','firstName','lastName','Attachment','Messages','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','renderFile','downloadInteraction.html','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1306b7,_0x5d4891){var _0x45ad97=function(_0x1b69f2){while(--_0x1b69f2){_0x1306b7['push'](_0x1306b7['shift']());}};_0x45ad97(++_0x5d4891);}(_0x645c,0x1d6));var _0xc645=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x645c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc645('0x0'));var rimraf=require(_0xc645('0x1'));var zipdir=require(_0xc645('0x2'));var jsonpatch=require(_0xc645('0x3'));var rp=require(_0xc645('0x4'));var moment=require('moment');var BPromise=require(_0xc645('0x5'));var Mustache=require(_0xc645('0x6'));var util=require('util');var path=require(_0xc645('0x7'));var sox=require(_0xc645('0x8'));var csv=require(_0xc645('0x9'));var ejs=require(_0xc645('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc645('0xb'));var squel=require(_0xc645('0xc'));var crypto=require(_0xc645('0xd'));var jsforce=require(_0xc645('0xe'));var deskjs=require(_0xc645('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc645('0x10'));var Redis=require('ioredis');var authService=require(_0xc645('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc645('0x12'));var pdf=require(_0xc645('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc645('0x14'))(_0xc645('0x15'));var utils=require(_0xc645('0x16'));var config=require(_0xc645('0x17'));var licenseUtil=require(_0xc645('0x18'));var db=require(_0xc645('0x19'))['db'];config[_0xc645('0x1a')]=_[_0xc645('0x1b')](config[_0xc645('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc645('0x1a')]));require(_0xc645('0x1c'))[_0xc645('0x1d')](socket);function respondWithStatusCode(_0x5371ee,_0x40a4c9){_0x40a4c9=_0x40a4c9||0xcc;return function(_0xc461c9){if(_0xc461c9){return _0x5371ee['sendStatus'](_0x40a4c9);}return _0x5371ee[_0xc645('0x1e')](_0x40a4c9)[_0xc645('0x1f')]();};}function respondWithResult(_0x340dfe,_0x105468){_0x105468=_0x105468||0xc8;return function(_0x2df6dc){if(_0x2df6dc){return _0x340dfe[_0xc645('0x1e')](_0x105468)[_0xc645('0x20')](_0x2df6dc);}};}function respondWithFilteredResult(_0x10d610,_0x505057){return function(_0x53c89c){if(_0x53c89c){var _0x2aa2f9=typeof _0x505057['offset']==='undefined'&&typeof _0x505057['limit']===_0xc645('0x21');var _0x4005af=_0x53c89c[_0xc645('0x22')];var _0xde0b63=_0x2aa2f9?0x0:_0x505057[_0xc645('0x23')];var _0x2f9c26=_0x2aa2f9?_0x53c89c['count']:_0x505057[_0xc645('0x23')]+_0x505057[_0xc645('0x24')];var _0xba1230;if(_0x2f9c26>=_0x4005af){_0x2f9c26=_0x4005af;_0xba1230=0xc8;}else{_0xba1230=0xce;}_0x10d610[_0xc645('0x1e')](_0xba1230);return _0x10d610[_0xc645('0x25')](_0xc645('0x26'),_0xde0b63+'-'+_0x2f9c26+'/'+_0x4005af)[_0xc645('0x20')](_0x53c89c);}return null;};}function patchUpdates(_0x5dc80e){return function(_0x19a2be){try{jsonpatch[_0xc645('0x27')](_0x19a2be,_0x5dc80e,!![]);}catch(_0x20352d){return BPromise[_0xc645('0x28')](_0x20352d);}return _0x19a2be[_0xc645('0x29')]();};}function saveUpdates(_0x7fd9cf,_0x496903){return function(_0x368d90){if(_0x368d90){return _0x368d90[_0xc645('0x2a')](_0x7fd9cf)[_0xc645('0x2b')](function(_0x27829a){return _0x27829a;});}return null;};}function removeEntity(_0x1628ae,_0x4a7474){return function(_0x283935){if(_0x283935){return _0x283935['destroy']()[_0xc645('0x2b')](function(){_0x1628ae[_0xc645('0x1e')](0xcc)[_0xc645('0x1f')]();});}};}function handleEntityNotFound(_0x38ce7a,_0x5edd55){return function(_0x213efe){if(!_0x213efe){_0x38ce7a[_0xc645('0x2c')](0x194);}return _0x213efe;};}function handleError(_0xb09321,_0x40efd1){_0x40efd1=_0x40efd1||0x1f4;return function(_0x26f30f){logger[_0xc645('0x2d')](_0x26f30f['stack']);if(_0x26f30f[_0xc645('0x2e')]){delete _0x26f30f[_0xc645('0x2e')];}_0xb09321[_0xc645('0x1e')](_0x40efd1)['send'](_0x26f30f);};}function getInteractionUsers(_0x3e9e2c,_0x20e46b){return new BPromise(function(_0x5a11db,_0x28f9e8){try{if(_0x20e46b[_0x3e9e2c['id']]){_0x3e9e2c[_0xc645('0x2f')]=_[_0xc645('0x30')](_0x20e46b[_0x3e9e2c['id']],function(_0x550d31){return{'id':_0x550d31['id'],'fullname':_0x550d31[_0xc645('0x31')]};});}}catch(_0x5831b1){_0x28f9e8(_0x5831b1);}_0x5a11db(_0x3e9e2c);});}function getInteractionTags(_0x47aa3c,_0x8d100a){return new BPromise(function(_0x4496c3,_0xcdb78d){try{if(_0x47aa3c[_0xc645('0x32')]){_0x47aa3c[_0xc645('0x33')]=[];_0x47aa3c[_0xc645('0x32')][_0xc645('0x34')](',')[_0xc645('0x35')](function(_0x3441ca){_0x47aa3c['Tags']['push'](_0x8d100a[_0x3441ca]);});}delete _0x47aa3c[_0xc645('0x32')];}catch(_0xf5bc04){_0xcdb78d(_0xf5bc04);}_0x4496c3(_0x47aa3c);});}function updateOpenchannelInteraction(_0x317266,_0x12efac,_0x219f9a){return new BPromise(function(_0x3eba09,_0x200e60){return getInteractionUsers(_0x317266,_0x219f9a)[_0xc645('0x2b')](function(_0xa477cb){return getInteractionTags(_0xa477cb,_0x12efac);})[_0xc645('0x2b')](function(_0x13e252){_0x3eba09(_0x13e252);})['catch'](function(_0xc3c04){_0x200e60(_0xc3c04);});});}exports[_0xc645('0x36')]=function(_0x10415e,_0x502f0e){var _0x347ed2={},_0x3e63e8={},_0x25328e={'count':0x0,'rows':[]};var _0x32cf5d=_[_0xc645('0x30')](db[_0xc645('0x37')][_0xc645('0x38')],function(_0x5c6fee){return{'name':_0x5c6fee[_0xc645('0x39')],'type':_0x5c6fee[_0xc645('0x3a')][_0xc645('0x3b')]};});_0x3e63e8['model']=_['map'](_0x32cf5d,_0xc645('0x2e'));_0x3e63e8[_0xc645('0x3c')]=_['keys'](_0x10415e[_0xc645('0x3c')]);_0x3e63e8['filters']=_['intersection'](_0x3e63e8[_0xc645('0x3d')],_0x3e63e8[_0xc645('0x3c')]);_0x347ed2[_0xc645('0x3e')]=_[_0xc645('0x3f')](_0x3e63e8[_0xc645('0x3d')],qs[_0xc645('0x40')](_0x10415e['query'][_0xc645('0x40')]));_0x347ed2[_0xc645('0x3e')]=_0x347ed2[_0xc645('0x3e')]['length']?_0x347ed2['attributes']:_0x3e63e8[_0xc645('0x3d')];if(!_0x10415e['query'][_0xc645('0x41')](_0xc645('0x42'))){_0x347ed2[_0xc645('0x24')]=qs[_0xc645('0x24')](_0x10415e[_0xc645('0x3c')][_0xc645('0x24')]);_0x347ed2[_0xc645('0x23')]=qs['offset'](_0x10415e[_0xc645('0x3c')]['offset']);}_0x347ed2[_0xc645('0x43')]=qs['sort'](_0x10415e[_0xc645('0x3c')][_0xc645('0x44')]);_0x347ed2['where']=qs[_0xc645('0x45')](_['pick'](_0x10415e[_0xc645('0x3c')],_0x3e63e8[_0xc645('0x45')]),_0x32cf5d);var _0x4b6f58=[];var _0x2aecf0=squel['select']()[_0xc645('0x46')]('id')[_0xc645('0x46')]('name')['field']('color')[_0xc645('0x47')](_0xc645('0x48'));var _0x52e01f=squel['select']()[_0xc645('0x46')](_0xc645('0x49'))[_0xc645('0x46')]('u.fullname')[_0xc645('0x46')](_0xc645('0x4a'))[_0xc645('0x47')]('user_has_openchannel_interactions','ui')['left_join'](_0xc645('0x4b'),'u',_0xc645('0x4c'));var _0x4b0222=squel[_0xc645('0x4d')]()[_0xc645('0x47')](_0xc645('0x4e'),'i')[_0xc645('0x4f')](_0xc645('0x50'),'c',_0xc645('0x51'))[_0xc645('0x4f')](_0xc645('0x4b'),'o',_0xc645('0x52'))[_0xc645('0x4f')](_0xc645('0x53'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xc645('0x4f')](_0xc645('0x54'),'me',_0xc645('0x55'))[_0xc645('0x4f')](_0xc645('0x56'),'it',_0xc645('0x57'))[_0xc645('0x4f')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x66ca8d=squel[_0xc645('0x58')]();var _0x221a05=[];var _0x6729da=squel['expr']();var _0x31c895;if(_0x10415e[_0xc645('0x3c')][_0xc645('0x59')]){_0x31c895=as[_0xc645('0x5a')](_0x10415e[_0xc645('0x3c')][_0xc645('0x59')]);var _0x222fda=_0x31c895[_0xc645('0x5b')];for(var _0x119c09=0x0;_0x119c09<_0x31c895[_0xc645('0x5c')][_0xc645('0x5d')];_0x119c09++){var _0x1ebed5=_0x31c895['conditions'][_0x119c09];var _0x27010d='i';var _0x5a6710=_[_0xc645('0x5e')](_0x32cf5d,[_0xc645('0x2e'),_0x1ebed5[_0xc645('0x46')]]);if(!_0x5a6710){switch(_0x1ebed5[_0xc645('0x46')]){case _0xc645('0x5f'):if(_0x1ebed5[_0xc645('0x60')]==0x1){_0x4b0222[_0xc645('0x61')]('`'+_0x1ebed5[_0xc645('0x46')]+_0xc645('0x62'));}else{_0x4b0222[_0xc645('0x61')]('`'+_0x1ebed5[_0xc645('0x46')]+_0xc645('0x63'));}break;case _0xc645('0x64'):if(_0x1ebed5[_0xc645('0x65')]==='$substring'){if(_0x1ebed5['value'][_0xc645('0x34')]('\x20')[_0xc645('0x5d')]>0x1){_0x66ca8d[_0x222fda](_0xc645('0x66'),qs[_0xc645('0x67')](_0x1ebed5[_0xc645('0x60')]),null);}else{var _0x39039a='%'+_0x1ebed5['value']+'%';_0x66ca8d[_0x222fda](_0xc645('0x68'),_0x39039a,_0x39039a,_0x39039a);}}else{_0x5a6710=_[_0xc645('0x5e')](_0x32cf5d,[_0xc645('0x2e'),'ContactId']);_0x1ebed5[_0xc645('0x46')]=_0xc645('0x69');_0x1b8988=as[_0xc645('0x6a')](_0x27010d,_0x5a6710[_0xc645('0x3a')],_0x1ebed5);_0x66ca8d[_0x222fda](_0x1b8988['text'],_0x1b8988[_0xc645('0x60')]['start'],_0x1b8988[_0xc645('0x60')][_0xc645('0x1f')]);}break;case _0xc645('0x6b'):var _0x17212f=_0x1ebed5[_0xc645('0x60')]['split'](',')[_0xc645('0x30')](function(_0x24abd4){return Number(_0x24abd4);});_0x17212f['forEach'](function(_0x48c4c3){_0x6729da['or'](_0xc645('0x6c'),'%,'+_0x48c4c3+',%');});_0x221a05=_[_0xc645('0x6d')](_0x221a05,_0x17212f);break;case'User':if(_0x1ebed5[_0xc645('0x65')]===_0xc645('0x6e')){_0x66ca8d[_0x222fda]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ebed5[_0xc645('0x60')]+'%',null);}else{_0x5a6710=_['find'](_0x32cf5d,[_0xc645('0x2e'),'UserId']);_0x1ebed5[_0xc645('0x46')]=_0xc645('0x6f');_0x1b8988=as[_0xc645('0x6a')](_0x27010d,_0x5a6710[_0xc645('0x3a')],_0x1ebed5);_0x66ca8d[_0x222fda](_0x1b8988[_0xc645('0x70')],_0x1b8988[_0xc645('0x60')]['start'],_0x1b8988[_0xc645('0x60')][_0xc645('0x1f')]);}break;case'body':_0x1b8988=as[_0xc645('0x6a')]('me',null,_0x1ebed5);_0x66ca8d[_0x222fda](_0x1b8988[_0xc645('0x70')],_0x1b8988[_0xc645('0x60')][_0xc645('0x71')],_0x1b8988['value'][_0xc645('0x1f')]);break;}}else{var _0x1b8988=as['buildExpression'](_0x27010d,_0x5a6710[_0xc645('0x3a')],_0x1ebed5);_0x66ca8d[_0x222fda](_0x1b8988['text'],_0x1b8988['value'][_0xc645('0x71')],_0x1b8988[_0xc645('0x60')][_0xc645('0x1f')]);}}}else{var _0x414523=_(_0x10415e[_0xc645('0x3c')])[_0xc645('0x72')]()[_0xc645('0x30')](function(_0x32ca8f){return _[_0xc645('0x73')](_0x32cf5d,[_0xc645('0x2e'),_0x32ca8f])?_0x32ca8f:undefined;})[_0xc645('0x74')]()[_0xc645('0x60')]();if(!_[_0xc645('0x75')](_0x414523)){_0x414523[_0xc645('0x35')](function(_0x2d5cca){if(_0x2d5cca===_0xc645('0x76')){_0x4b0222[_0xc645('0x77')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xc645('0x78')](_0x10415e[_0xc645('0x3c')][_0x2d5cca]));}else if(_0x2d5cca===_0xc645('0x79')){var _0x19652d=JSON['parse'](_0x10415e[_0xc645('0x3c')][_0x2d5cca])[_0xc645('0x7a')];var _0x4c50ff=JSON[_0xc645('0x7b')](_0x10415e['query'][_0x2d5cca])['$lte'];_0x4b0222['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19652d,_0x4c50ff);}else{if(_0x10415e[_0xc645('0x3c')][_0x2d5cca]===_0xc645('0x7c')){_0x4b0222[_0xc645('0x77')]('i.'+_0x2d5cca+_0xc645('0x7d'));}else{_0x4b0222['where']('i.'+_0x2d5cca+_0xc645('0x7e'),_0x10415e[_0xc645('0x3c')][_0x2d5cca]);}}});}if(_0x10415e[_0xc645('0x3c')][_0xc645('0x7f')]){if(_0x10415e[_0xc645('0x3c')]['read']==0x1){_0x4b0222[_0xc645('0x61')](_0xc645('0x80'));}else{_0x4b0222[_0xc645('0x61')](_0xc645('0x81'));}}if(_0x10415e[_0xc645('0x3c')][_0xc645('0x82')]){_0x221a05=_['isArray'](_0x10415e[_0xc645('0x3c')][_0xc645('0x82')])?_0x10415e[_0xc645('0x3c')][_0xc645('0x82')]:new Array(_0x10415e['query']['tag']);_0x221a05[_0xc645('0x35')](function(_0x10878a){_0x6729da['or'](_0xc645('0x6c'),'%,'+_0x10878a+',%');});}if(_0x10415e[_0xc645('0x3c')][_0xc645('0x83')]){var _0x52ffb2=_0x10415e[_0xc645('0x3c')][_0xc645('0x83')]['replace']('\x5c','\x5c\x5c')[_0xc645('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x52ffb2)){_0x66ca8d['or'](_0xc645('0x85'),_0x52ffb2+'%');}else{_0x66ca8d['or'](_0xc645('0x86'),qs['getFullTextValue'](_0x52ffb2))['or'](_0xc645('0x87'),_0x52ffb2+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x52ffb2+'%');}}}_0x4b0222[_0xc645('0x77')](_0x66ca8d);_0x4b0222[_0xc645('0x88')](_0xc645('0x89'));var _0x10fc6b={'type':db[_0xc645('0x8a')][_0xc645('0x8b')][_0xc645('0x8c')],'raw':!![]};var _0x4c84c3=_0x4b0222['clone']();_0x4c84c3['field'](_0xc645('0x89'));_0x4c84c3[_0xc645('0x46')](_0xc645('0x8d'),_0xc645('0x5f'));if(_0x347ed2['order']){_0x347ed2[_0xc645('0x43')][_0xc645('0x35')](function(_0x387931){var _0x1d901d=_0x387931[0x0]===_0xc645('0x8e')?_0x387931[0x0]:'i.'+_0x387931[0x0];_0x4b0222[_0xc645('0x43')](_0x1d901d,_0x387931[0x1]===_0xc645('0x8f')?![]:!![]);});}if(!_[_0xc645('0x75')](_0x221a05)){_0x4b0222[_0xc645('0x61')](_0x6729da);_0x4c84c3[_0xc645('0x77')](_0xc645('0x90'),_0x221a05);}BPromise[_0xc645('0x91')]()[_0xc645('0x2b')](function(){if(!_0x31c895){if(_0x10415e['query'][_0xc645('0x76')])return;_0x4c84c3[_0xc645('0x77')](_0xc645('0x92'));_0x4b0222[_0xc645('0x77')](_0xc645('0x92'));return;}if(_0x10415e[_0xc645('0x93')][_0xc645('0x94')]!==_0xc645('0x95'))return;return _0x10415e[_0xc645('0x93')][_0xc645('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0xf171d1){if(_[_0xc645('0x75')](_0xf171d1)){_0x4c84c3[_0xc645('0x77')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x4b0222[_0xc645('0x77')](_0xc645('0x97'));}else{_0x4c84c3[_0xc645('0x77')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xc645('0x30')](_0xf171d1,'id'));_0x4b0222['where'](_0xc645('0x98'),_[_0xc645('0x30')](_0xf171d1,'id'));}});})[_0xc645('0x2b')](function(){if(_0x10415e[_0xc645('0x93')]['role']===_0xc645('0x95')&&!_0x31c895&&!_0x10415e['query']['OpenchannelAccountId'])return[];return db[_0xc645('0x99')][_0xc645('0x3c')](_0x4c84c3[_0xc645('0x9a')](),_0x10fc6b);})[_0xc645('0x2b')](function(_0x2f601b){_0x25328e[_0xc645('0x22')]=_0x2f601b[_0xc645('0x5d')];if(_0x25328e[_0xc645('0x22')]===0x0)return[];return db[_0xc645('0x99')]['query'](_0x2aecf0[_0xc645('0x9a')](),_0x10fc6b)[_0xc645('0x2b')](function(_0x3610ff){_0x4b6f58=_[_0xc645('0x9b')](_0x3610ff,'id');_0x10fc6b=_[_0xc645('0x9c')](_0x10fc6b,{'model':db[_0xc645('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10415e[_0xc645('0x3c')][_0xc645('0x40')]){_0x347ed2[_0xc645('0x3e')]['forEach'](function(_0x3186ac){_0x4b0222[_0xc645('0x46')]('i.'+_0x3186ac);});}else{_0x4b0222[_0xc645('0x46')](_0xc645('0x8d'),_0xc645('0x5f'));_0x4b0222[_0xc645('0x46')](_0xc645('0x9d'),'Account.key');_0x4b0222[_0xc645('0x46')](_0xc645('0x9e'),_0xc645('0x9f'));_0x4b0222[_0xc645('0x46')](_0xc645('0xa0'),_0xc645('0x8e'));_0x4b0222['field'](_0xc645('0xa1'));_0x4b0222[_0xc645('0x46')]('c.firstName','Contact.firstName');_0x4b0222[_0xc645('0x46')](_0xc645('0xa2'),_0xc645('0xa3'));_0x4b0222['field'](_0xc645('0xa4'),'Contact.email');_0x4b0222[_0xc645('0x46')](_0xc645('0xa5'),_0xc645('0xa6'));_0x4b0222['field'](_0xc645('0xa7'),_0xc645('0xa8'));_0x4b0222[_0xc645('0x46')](_0xc645('0xa9'),_0xc645('0xaa'));_0x4b0222['field'](_0xc645('0xab'),_0xc645('0xac'));_0x4b0222[_0xc645('0x46')](_0xc645('0xad'),_0xc645('0xae'));_0x4b0222[_0xc645('0x46')](_0xc645('0xaf'),_0xc645('0x32'));}if(_0x347ed2[_0xc645('0x24')])_0x4b0222[_0xc645('0x24')](_0x347ed2[_0xc645('0x24')]);if(_0x347ed2[_0xc645('0x23')])_0x4b0222[_0xc645('0x23')](_0x347ed2[_0xc645('0x23')]);return db[_0xc645('0x99')]['query'](_0x4b0222[_0xc645('0x9a')](),_0x10fc6b);})[_0xc645('0x2b')](function(_0x35db86){if(_0x35db86['length']>0x0)_0x52e01f[_0xc645('0x77')](_0xc645('0xb0'),_[_0xc645('0x30')](_0x35db86,'id'));return db['sequelize'][_0xc645('0x3c')](_0x52e01f[_0xc645('0x9a')](),_0x10fc6b)[_0xc645('0x2b')](function(_0x2976a5){var _0x2a1d21=_['groupBy'](_0x2976a5,'OpenchannelInteractionId');var _0x25bfbf=[];_0x35db86[_0xc645('0x35')](function(_0x2a9d80){_0x25bfbf['push'](updateOpenchannelInteraction(_0x2a9d80,_0x4b6f58,_0x2a1d21));});return BPromise[_0xc645('0xb1')](_0x25bfbf);});});})[_0xc645('0x2b')](function(_0x3bfcf9){_0x25328e[_0xc645('0xb2')]=_0x3bfcf9;return _0x25328e;})[_0xc645('0x2b')](respondWithFilteredResult(_0x502f0e,_0x347ed2))[_0xc645('0xb3')](handleError(_0x502f0e,null));};exports[_0xc645('0xb4')]=function(_0x100321,_0x2d0b23){var _0x381d65={};if(_0x100321[_0xc645('0x3c')][_0xc645('0x3a')]&&_0x100321[_0xc645('0x3c')][_0xc645('0x3a')]===_0xc645('0x47')){_0x381d65[_0xc645('0x47')]=_0x100321[_0xc645('0xb5')]['id'];}else{_0x381d65['id']=_0x100321[_0xc645('0xb5')]['id'];}var _0x2830d6={'raw':![],'where':_0x381d65},_0x5645ed={};_0x5645ed[_0xc645('0x3d')]=_[_0xc645('0x72')](db[_0xc645('0x37')]['rawAttributes']);_0x5645ed[_0xc645('0x3c')]=_[_0xc645('0x72')](_0x100321[_0xc645('0x3c')]);_0x5645ed[_0xc645('0x45')]=_[_0xc645('0x3f')](_0x5645ed[_0xc645('0x3d')],_0x5645ed['query']);_0x2830d6[_0xc645('0x3e')]=_['intersection'](_0x5645ed['model'],qs[_0xc645('0x40')](_0x100321['query'][_0xc645('0x40')]));_0x2830d6[_0xc645('0x3e')]=_0x2830d6[_0xc645('0x3e')][_0xc645('0x5d')]?_0x2830d6[_0xc645('0x3e')]:_0x5645ed[_0xc645('0x3d')];if(_0x100321[_0xc645('0x3c')][_0xc645('0xb6')]){_0x2830d6[_0xc645('0xb7')]=[{'all':!![]}];}_0x2830d6=_[_0xc645('0x9c')]({},_0x2830d6,_0x100321[_0xc645('0xb8')]);return db[_0xc645('0x37')][_0xc645('0x5e')](_0x2830d6)[_0xc645('0x2b')](handleEntityNotFound(_0x2d0b23,null))[_0xc645('0x2b')](respondWithResult(_0x2d0b23,null))[_0xc645('0xb3')](handleError(_0x2d0b23,null));};exports['create']=function(_0x15bcd1,_0x415af3){return db['OpenchannelInteraction'][_0xc645('0xb9')](_0x15bcd1[_0xc645('0xba')],{})[_0xc645('0x2b')](respondWithResult(_0x415af3,0xc9))[_0xc645('0xb3')](handleError(_0x415af3,null));};exports['update']=function(_0x8b9c62,_0x4480e4){if(_0x8b9c62[_0xc645('0xba')]['id']){delete _0x8b9c62['body']['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x8b9c62['params']['id']}})[_0xc645('0x2b')](handleEntityNotFound(_0x4480e4,null))[_0xc645('0x2b')](saveUpdates(_0x8b9c62[_0xc645('0xba')],null))[_0xc645('0x2b')](respondWithResult(_0x4480e4,null))[_0xc645('0xb3')](handleError(_0x4480e4,null));};exports[_0xc645('0xbb')]=function(_0x3dfe72,_0x52098e){return db[_0xc645('0x37')][_0xc645('0x5e')]({'where':{'id':_0x3dfe72[_0xc645('0xb5')]['id']}})[_0xc645('0x2b')](handleEntityNotFound(_0x52098e,null))['then'](removeEntity(_0x52098e,null))[_0xc645('0xb3')](handleError(_0x52098e,null));};exports['describe']=function(_0x27a6e6,_0x5c196a){return db['OpenchannelInteraction']['describe']()[_0xc645('0x2b')](respondWithResult(_0x5c196a,null))[_0xc645('0xb3')](handleError(_0x5c196a,null));};exports[_0xc645('0xbc')]=function(_0x5667d7,_0x2a06d4,_0x1d7c4f){return db[_0xc645('0xbd')][_0xc645('0x5e')]({'where':{'id':_0x5667d7[_0xc645('0xb5')]['id']}})[_0xc645('0x2b')](handleEntityNotFound(_0x2a06d4,null))[_0xc645('0x2b')](function(_0x202d57){if(_0x202d57){return _0x202d57[_0xc645('0xbc')](_0x5667d7[_0xc645('0xba')]['ids'],_[_0xc645('0xbe')](_0x5667d7[_0xc645('0xba')],['ids','id'])||{});}})[_0xc645('0x2b')](respondWithResult(_0x2a06d4,null))['catch'](handleError(_0x2a06d4,null));};exports[_0xc645('0xbf')]=function(_0x5a8fbf,_0x106080,_0x48a9e2){var _0x462dfa={'raw':![],'where':{}};var _0x4f5dce={};var _0x4a509c={'count':0x0,'rows':[]};return db[_0xc645('0x37')][_0xc645('0xc0')]({'where':{'id':_0x5a8fbf['params']['id']}})[_0xc645('0x2b')](handleEntityNotFound(_0x106080,null))[_0xc645('0x2b')](function(_0x411189){if(_0x411189){_0x4f5dce['model']=_['keys'](db[_0xc645('0xbd')][_0xc645('0x38')]);_0x4f5dce['query']=_[_0xc645('0x72')](_0x5a8fbf[_0xc645('0x3c')]);_0x4f5dce[_0xc645('0x45')]=_['intersection'](_0x4f5dce[_0xc645('0x3d')],_0x4f5dce[_0xc645('0x3c')]);_0x462dfa[_0xc645('0x3e')]=_[_0xc645('0x3f')](_0x4f5dce[_0xc645('0x3d')],qs[_0xc645('0x40')](_0x5a8fbf[_0xc645('0x3c')]['fields']));_0x462dfa['attributes']=_0x462dfa[_0xc645('0x3e')][_0xc645('0x5d')]?_0x462dfa[_0xc645('0x3e')]:_0x4f5dce[_0xc645('0x3d')];if(!_0x5a8fbf[_0xc645('0x3c')][_0xc645('0x41')](_0xc645('0x42'))){_0x462dfa['limit']=qs['limit'](_0x5a8fbf[_0xc645('0x3c')][_0xc645('0x24')]);_0x462dfa[_0xc645('0x23')]=qs[_0xc645('0x23')](_0x5a8fbf[_0xc645('0x3c')][_0xc645('0x23')]);}_0x462dfa[_0xc645('0x43')]=qs[_0xc645('0x44')](_0x5a8fbf[_0xc645('0x3c')][_0xc645('0x44')]);_0x462dfa['where']=qs[_0xc645('0x45')](_[_0xc645('0xc1')](_0x5a8fbf[_0xc645('0x3c')],_0x4f5dce['filters']));_0x462dfa[_0xc645('0x77')][_0xc645('0xc2')]=_0x411189['id'];if(_0x5a8fbf[_0xc645('0x3c')][_0xc645('0x83')]){_0x462dfa['where']=_['merge'](_0x462dfa['where'],{'$or':_[_0xc645('0x30')](_0x462dfa[_0xc645('0x3e')],function(_0x3f0b51){var _0x44d7bc={};_0x44d7bc[_0x3f0b51]={'$like':'%'+_0x5a8fbf['query']['filter']+'%'};return _0x44d7bc;})});}if(_0x5a8fbf[_0xc645('0x3c')][_0xc645('0x7a')]){var _0x2c36a8=_0x5a8fbf[_0xc645('0x3c')]['$gte'][_0xc645('0x34')](',');var _0x2cc497={};_0x2cc497[_0x2c36a8[0x0]]={'$gte':moment(_0x2c36a8[0x1])[_0xc645('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x462dfa[_0xc645('0x77')]=_[_0xc645('0x9c')](_0x462dfa[_0xc645('0x77')],_0x2cc497);}_0x462dfa=_[_0xc645('0x9c')]({},_0x462dfa,_0x5a8fbf[_0xc645('0xb8')]);return db[_0xc645('0xbd')]['count']({'where':_0x462dfa[_0xc645('0x77')]})[_0xc645('0x2b')](function(_0x4065f2){_0x4a509c['count']=_0x4065f2;if(_0x5a8fbf[_0xc645('0x3c')][_0xc645('0xb6')]){_0x462dfa[_0xc645('0xb7')]=[{'all':!![]}];}return db[_0xc645('0xbd')][_0xc645('0xc4')](_0x462dfa);})[_0xc645('0x2b')](function(_0x1959d1){_0x4a509c['rows']=_0x1959d1;return _0x4a509c;});}})['then'](respondWithFilteredResult(_0x106080,_0x462dfa))['catch'](handleError(_0x106080,null));};exports[_0xc645('0xc5')]=function(_0x20de16,_0x46fa60,_0x1ee8ef){return db[_0xc645('0x37')][_0xc645('0x5e')]({'where':{'id':_0x20de16['params']['id']}})[_0xc645('0x2b')](handleEntityNotFound(_0x46fa60,null))['then'](function(_0x4058e1){if(_0x4058e1){return _0x4058e1[_0xc645('0xc6')](_0x20de16[_0xc645('0xba')]['ids'],_['omit'](_0x20de16['body'],[_0xc645('0xc7'),'id'])||{})[_0xc645('0xc8')](function(){return db[_0xc645('0x6b')][_0xc645('0xc4')]({'attributes':['id',_0xc645('0x2e'),_0xc645('0xc9')],'where':{'id':_0x20de16[_0xc645('0xba')][_0xc645('0xc7')]}});})[_0xc645('0x2b')](function(_0x53525d){socket[_0xc645('0xca')]('openchannelInteractionTags:save',{'id':Number(_0x20de16[_0xc645('0xb5')]['id']),'tags':_0x53525d||[]});return{'id':Number(_0x20de16[_0xc645('0xb5')]['id']),'tags':_0x53525d||[]};});}})[_0xc645('0x2b')](respondWithResult(_0x46fa60,null))[_0xc645('0xb3')](handleError(_0x46fa60,null));};exports['removeTags']=function(_0x19b9cc,_0x22487e,_0x48c1ee){return db[_0xc645('0x37')][_0xc645('0x5e')]({'where':{'id':_0x19b9cc[_0xc645('0xb5')]['id']}})['then'](handleEntityNotFound(_0x22487e,null))[_0xc645('0x2b')](function(_0x504dce){if(_0x504dce){return _0x504dce[_0xc645('0xcb')](_0x19b9cc['query']['ids']);}})['then'](respondWithStatusCode(_0x22487e,null))[_0xc645('0xb3')](handleError(_0x22487e,null));};exports[_0xc645('0xcc')]=function(_0x289a7e,_0xd2cac0){var _0x30ce9b=moment()['unix']()[_0xc645('0x9a')]();var _0x5217cd=path[_0xc645('0xcd')](config[_0xc645('0xce')],_0xc645('0xcf'),_0xc645('0xd0'),'tmp');var _0x38e253=path[_0xc645('0xcd')](config[_0xc645('0xce')],_0xc645('0xcf'),_0xc645('0xd0'),_0xc645('0xd1'));var _0x5754ad=path[_0xc645('0xcd')](_0x5217cd,_0x30ce9b);var _0x42aed3=util['format'](_0xc645('0xd2'),_0x289a7e[_0xc645('0xb5')]['id'],_0x30ce9b);var _0x35cab1=path[_0xc645('0xcd')](_0x5217cd,_0x42aed3);var _0x346053=[];_0x346053[_0xc645('0xd3')]({'model':db[_0xc645('0xd4')],'as':_0xc645('0xd4'),'attributes':['id',_0xc645('0x31')],'raw':!![]});_0x346053[_0xc645('0xd3')]({'model':db['CmContact'],'as':_0xc645('0x64'),'attributes':['id',_0xc645('0xd5'),_0xc645('0xd6')],'raw':!![]});if(_0x289a7e['query']['attachments']){_0x346053[_0xc645('0xd3')]({'model':db[_0xc645('0xd7')],'as':_0xc645('0xd7'),'raw':!![]});}var _0x79734c=[{'model':db['OpenchannelMessage'],'as':_0xc645('0xd8'),'attributes':['id',_0xc645('0xba'),_0xc645('0x79'),'direction','secret',_0xc645('0x7f')],'include':_0x346053}];_0x79734c[_0xc645('0xd3')]({'model':db[_0xc645('0xd9')],'as':'Account','attributes':['id','name']});_0x79734c[_0xc645('0xd3')]({'model':db['User'],'as':_0xc645('0xda'),'attributes':['id',_0xc645('0x31')]});return db[_0xc645('0x37')][_0xc645('0x5e')]({'where':{'id':_0x289a7e[_0xc645('0xb5')]['id']},'include':_0x79734c})['then'](handleEntityNotFound(_0xd2cac0,null))[_0xc645('0x2b')](function(_0xdb3c5a){if(_0xdb3c5a){var _0x5489f0=_0xdb3c5a[_0xc645('0xdb')]({'plain':!![]});fs[_0xc645('0xdc')](_0x5754ad);var _0x4d5b67={'channel':_0xc645('0xdd'),'account':_0x5489f0[_0xc645('0xde')][_0xc645('0x2e')],'agent':_0x5489f0[_0xc645('0xda')]?_0x5489f0[_0xc645('0xda')]['fullname']:_0xc645('0xdf'),'createdAt':moment(_0x5489f0[_0xc645('0x79')])['format'](_0xc645('0xe0'))[_0xc645('0x9a')](),'closedAt':_0x5489f0['closed']?moment(_0x5489f0['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5489f0[_0xc645('0xe1')],'visibility':_0x5489f0[_0xc645('0xe2')]?_0xc645('0xe3'):_0xc645('0xe4'),'messages':_(_0x5489f0[_0xc645('0xd8')])[_0xc645('0x83')]({'secret':![]})[_0xc645('0x30')](function(_0xf41429){if(_0xf41429['Attachment']){var _0xdaa198=path[_0xc645('0xcd')](_0x38e253,_0xf41429['Attachment'][_0xc645('0xe5')]);if(fs[_0xc645('0xe6')](_0xdaa198)){fs[_0xc645('0xe7')](_0xdaa198)[_0xc645('0xe8')](fs[_0xc645('0xe9')](path['join'](_0x5754ad,_0xf41429[_0xc645('0xd7')][_0xc645('0xe5')])));}}return{'date':moment(_0xf41429[_0xc645('0x79')])['format'](_0xc645('0xe0'))[_0xc645('0x9a')](),'sender':_0xf41429[_0xc645('0xea')]===_0xc645('0xeb')?_0xf41429[_0xc645('0xd4')]?_0xf41429[_0xc645('0xd4')][_0xc645('0x31')]:_0xc645('0xec'):_0xf41429[_0xc645('0x64')][_0xc645('0xd5')]+(_0xf41429['Contact'][_0xc645('0xd6')]?'\x20'+_0xf41429['Contact'][_0xc645('0xd6')]:''),'body':_0xf41429[_0xc645('0xd7')]?_0xf41429[_0xc645('0xd7')]['basename']:_0xf41429[_0xc645('0xba')],'direction':_0xf41429[_0xc645('0xea')]==='out'?'A':'C','secret':_0xf41429['secret'],'read':_0xf41429['read'],'attachment':_0xf41429['Attachment']};})['value']()};return ejs[_0xc645('0xed')](path[_0xc645('0xcd')](config[_0xc645('0xce')],'server','views',_0xc645('0xee')),{'interaction':_0x4d5b67})[_0xc645('0x2b')](function(_0x589575){var _0x1e19bd=path[_0xc645('0xcd')](_0x5754ad,'transcript-'+_0x5489f0['id']+'-'+_0x30ce9b+_0xc645('0xef'));var _0x55edfa={'path':_0x1e19bd,'channel':'Openchannel','interactionId':_0x5489f0['id']};return pdf[_0xc645('0xf0')](_0x589575,_0x55edfa);})[_0xc645('0x2b')](function(){return new BPromise(function(_0x33817f,_0x25fd65){zipdir(_0x5754ad,{'saveTo':_0x35cab1},function(_0x39d5b4,_0x20c1b0){if(_0x39d5b4)return _0x25fd65(_0x39d5b4);return _0x33817f(_0x20c1b0);});})['then'](function(){return new BPromise(function(_0x29576f,_0x296e5b){rimraf(_0x5754ad,function(_0x4313c0){if(_0x4313c0)_0x296e5b(_0x4313c0);return _0x29576f();});});})[_0xc645('0x2b')](function(){return _0xd2cac0[_0xc645('0xcc')](_0x35cab1,_0x42aed3,function(_0x591643){if(_0x591643){console[_0xc645('0xf1')]('err',_0x591643);}else{fs[_0xc645('0xf2')](_0x35cab1);}});});});}else{return _0xd2cac0[_0xc645('0x2c')](0xc8);}})[_0xc645('0xb3')](handleError(_0xd2cac0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e12972b..3506491 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 _0x6e2f=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x4b173a,_0x5a557a){var _0x518cb1=function(_0x3a52a9){while(--_0x3a52a9){_0x4b173a['push'](_0x4b173a['shift']());}};_0x518cb1(++_0x5a557a);}(_0x6e2f,0xff));var _0xf6e2=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6e2f[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xf6e2('0x0'))['db'][_0xf6e2('0x1')];var OpenchannelMessage=require(_0xf6e2('0x0'))['db'][_0xf6e2('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf6e2('0x3')](0x0);var events={'afterCreate':_0xf6e2('0x4'),'afterUpdate':_0xf6e2('0x5'),'afterDestroy':_0xf6e2('0x6')};function emitEvent(_0x4e32f8){return function(_0x3af0b2,_0x24ee5d,_0x130528){_0x3af0b2[_0xf6e2('0x7')]({'attributes':['id'],'raw':!![]})[_0xf6e2('0x8')](function(_0x395bfc){_0x3af0b2['setDataValue'](_0xf6e2('0x9'),_0x395bfc['map'](function(_0x577820){return{'id':_0x577820['id']};}));return OpenchannelMessage[_0xf6e2('0xa')]({'where':{'OpenchannelInteractionId':_0x3af0b2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf6e2('0x8')](function(_0xb568f9){_0x3af0b2[_0xf6e2('0xb')](_0xf6e2('0xc'),_0xb568f9[_0xf6e2('0xd')]);OpenchannelInteractionEvents['emit'](_0x4e32f8+':'+_0x3af0b2['id'],_0x3af0b2);OpenchannelInteractionEvents[_0xf6e2('0xe')](_0x4e32f8,_0x3af0b2);_0x130528(null);})[_0xf6e2('0xf')](_0x130528(null));};}for(var e in events){if(events[_0xf6e2('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xf6e2('0x11')](e,emitEvent(event));}}module[_0xf6e2('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x8b52=['update','remove','then','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x5c468f,_0x2e5c25){var _0x2136b0=function(_0x56b8a4){while(--_0x56b8a4){_0x5c468f['push'](_0x5c468f['shift']());}};_0x2136b0(++_0x2e5c25);}(_0x8b52,0x6b));var _0x28b5=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8b52[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require(_0x28b5('0x0'));var OpenchannelInteraction=require(_0x28b5('0x1'))['db'][_0x28b5('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x28b5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x28b5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x28b5('0x5'),'afterDestroy':_0x28b5('0x6')};function emitEvent(_0x19c342){return function(_0x27a170,_0x562b46,_0x16bcdf){_0x27a170['getUsers']({'attributes':['id'],'raw':!![]})[_0x28b5('0x7')](function(_0x446045){_0x27a170['setDataValue'](_0x28b5('0x8'),_0x446045['map'](function(_0x5ec81e){return{'id':_0x5ec81e['id']};}));return OpenchannelMessage[_0x28b5('0x9')]({'where':{'OpenchannelInteractionId':_0x27a170['id'],'direction':'in','read':![]},'raw':!![]});})[_0x28b5('0x7')](function(_0x142903){_0x27a170['setDataValue'](_0x28b5('0xa'),_0x142903['length']);OpenchannelInteractionEvents['emit'](_0x19c342+':'+_0x27a170['id'],_0x27a170);OpenchannelInteractionEvents[_0x28b5('0xb')](_0x19c342,_0x27a170);_0x16bcdf(null);})[_0x28b5('0xc')](_0x16bcdf(null));};}for(var e in events){if(events[_0x28b5('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x28b5('0xe')](e,emitEvent(event));}}module[_0x28b5('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9e5e022..cedd309 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 _0xd8b1=['api','moment','request-promise','path','../../config/environment','OpenchannelInteraction','openchannel_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b1,0x105));var _0x1d8b=function(_0x5367b5,_0x5da04c){_0x5367b5=_0x5367b5-0x0;var _0x312928=_0xd8b1[_0x5367b5];return _0x312928;};'use strict';var _=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var logger=require(_0x1d8b('0x2'))(_0x1d8b('0x3'));var moment=require(_0x1d8b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d8b('0x5'));var fs=require('fs');var path=require(_0x1d8b('0x6'));var rimraf=require('rimraf');var config=require(_0x1d8b('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x4d5ba0,_0x27534c){return _0x4d5ba0['define'](_0x1d8b('0x8'),attributes,{'tableName':_0x1d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b28e2,_0x4480cf,_0x51438a){if(_0x2b28e2['changed'](_0x1d8b('0xa'))){_0x2b28e2['closedAt']=moment()['format'](_0x1d8b('0xb'));}_0x51438a(null,_0x2b28e2);}}});}; \ No newline at end of file +var _0xf3cc=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3d88b3,_0x162721){var _0xfb7ac0=function(_0x2141ea){while(--_0x2141ea){_0x3d88b3['push'](_0x3d88b3['shift']());}};_0xfb7ac0(++_0x162721);}(_0xf3cc,0x10d));var _0xcf3c=function(_0xa9f50a,_0x1d3836){_0xa9f50a=_0xa9f50a-0x0;var _0x48d268=_0xf3cc[_0xa9f50a];return _0x48d268;};'use strict';var _=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var logger=require(_0xcf3c('0x2'))(_0xcf3c('0x3'));var moment=require('moment');var BPromise=require(_0xcf3c('0x4'));var rp=require(_0xcf3c('0x5'));var fs=require('fs');var path=require(_0xcf3c('0x6'));var rimraf=require('rimraf');var config=require(_0xcf3c('0x7'));var attributes=require(_0xcf3c('0x8'));module['exports']=function(_0x41f804,_0x2b5cae){return _0x41f804[_0xcf3c('0x9')](_0xcf3c('0xa'),attributes,{'tableName':_0xcf3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x147e12,_0x1a593f,_0x3c1807){if(_0x147e12[_0xcf3c('0xc')](_0xcf3c('0xd'))){_0x147e12['closedAt']=moment()['format'](_0xcf3c('0xe'));}_0x3c1807(null,_0x147e12);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index bb8c8fe..ff1a6d9 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 _0xe72e=['stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x50f452,_0x14a00c){var _0x2804f3=function(_0x245cbe){while(--_0x245cbe){_0x50f452['push'](_0x50f452['shift']());}};_0x2804f3(++_0x14a00c);}(_0xe72e,0x1e3));var _0xee72=function(_0x6bd42c,_0x2e2373){_0x6bd42c=_0x6bd42c-0x0;var _0x49de77=_0xe72e[_0x6bd42c];return _0x49de77;};'use strict';var _=require('lodash');var util=require(_0xee72('0x0'));var moment=require(_0xee72('0x1'));var BPromise=require(_0xee72('0x2'));var rs=require(_0xee72('0x3'));var fs=require('fs');var Redis=require(_0xee72('0x4'));var db=require(_0xee72('0x5'))['db'];var utils=require(_0xee72('0x6'));var logger=require('../../config/logger')(_0xee72('0x7'));var config=require(_0xee72('0x8'));var jayson=require(_0xee72('0x9'));var client=jayson[_0xee72('0xa')][_0xee72('0xb')]({'port':0x232a});config[_0xee72('0xc')]=_[_0xee72('0xd')](config[_0xee72('0xc')],{'host':_0xee72('0xe'),'port':0x18eb});var socket=require(_0xee72('0xf'))(new Redis(config[_0xee72('0xc')]));require(_0xee72('0x10'))[_0xee72('0x11')](socket);function respondWithRpcPromise(_0xfb894a,_0x321ac1,_0xfc9594){return new BPromise(function(_0x12449f,_0x15341d){return client[_0xee72('0x12')](_0xfb894a,_0xfc9594)[_0xee72('0x13')](function(_0x3e5fdf){logger[_0xee72('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x321ac1,_0xee72('0x15'));logger['debug'](_0xee72('0x16'),_0x321ac1,'request\x20sent',JSON[_0xee72('0x17')](_0x3e5fdf));if(_0x3e5fdf[_0xee72('0x18')]){if(_0x3e5fdf[_0xee72('0x18')][_0xee72('0x19')]===0x1f4){logger[_0xee72('0x18')](_0xee72('0x1a'),_0x321ac1,_0x3e5fdf['error'][_0xee72('0x1b')]);return _0x15341d(_0x3e5fdf[_0xee72('0x18')][_0xee72('0x1b')]);}logger[_0xee72('0x18')](_0xee72('0x1a'),_0x321ac1,_0x3e5fdf[_0xee72('0x18')]['message']);return _0x12449f(_0x3e5fdf['error']['message']);}else{logger[_0xee72('0x14')](_0xee72('0x1a'),_0x321ac1,_0xee72('0x15'));_0x12449f(_0x3e5fdf[_0xee72('0x1c')][_0xee72('0x1b')]);}})[_0xee72('0x1d')](function(_0x369227){logger[_0xee72('0x18')](_0xee72('0x1a'),_0x321ac1,_0x369227);_0x15341d(_0x369227);});});}exports[_0xee72('0x1e')]=function(_0x2ea291){var _0x38b2c6=this;return new Promise(function(_0x3239cc,_0x545abd){return db['OpenchannelInteraction'][_0xee72('0x1f')](_0x2ea291[_0xee72('0x20')],{'raw':_0x2ea291[_0xee72('0x21')]?_0x2ea291['options'][_0xee72('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ea291[_0xee72('0x21')]?_0x2ea291['options'][_0xee72('0x23')]||null:null,'attributes':_0x2ea291[_0xee72('0x21')]?_0x2ea291[_0xee72('0x21')][_0xee72('0x24')]||null:null,'limit':_0x2ea291[_0xee72('0x21')]?_0x2ea291[_0xee72('0x21')][_0xee72('0x25')]||null:null})['then'](function(_0x27f030){logger[_0xee72('0x14')](_0xee72('0x1e'),_0x2ea291);logger[_0xee72('0x26')](_0xee72('0x1e'),_0x2ea291,JSON[_0xee72('0x17')](_0x27f030));_0x3239cc(_0x27f030);})[_0xee72('0x1d')](function(_0x50cfbe){logger[_0xee72('0x18')](_0xee72('0x1e'),_0x50cfbe[_0xee72('0x1b')],_0x2ea291);_0x545abd(_0x38b2c6['error'](0x1f4,_0x50cfbe['message']));});});};exports[_0xee72('0x27')]=function(_0x291bd2){return new Promise(function(_0x523b00,_0x4c23c2){return db[_0xee72('0x28')][_0xee72('0x29')]({'where':_0x291bd2[_0xee72('0x21')]?_0x291bd2['options']['where']||null:null})[_0xee72('0x13')](function(_0x34fd68){if(_0x34fd68){return _0x34fd68[_0xee72('0x2a')](_0x291bd2['body'][_0xee72('0x2b')],_['omit'](_0x291bd2[_0xee72('0x20')],[_0xee72('0x2b'),'id'])||{});}})[_0xee72('0x2c')](function(_0x10c15b){logger[_0xee72('0x14')]('AddTags',_0x291bd2);logger[_0xee72('0x26')]('AddTags',_0x291bd2,JSON['stringify'](_0x10c15b));_0x523b00(_0x10c15b);})[_0xee72('0x1d')](function(_0x438221){logger[_0xee72('0x18')](_0xee72('0x2d'),_0x438221[_0xee72('0x1b')],_0x291bd2);_0x4c23c2(_this['error'](0x1f4,_0x438221[_0xee72('0x1b')]));});});}; \ No newline at end of file +var _0x9bcc=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','then','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9bcc,0x170));var _0xc9bc=function(_0x2e4554,_0x13a8f0){_0x2e4554=_0x2e4554-0x0;var _0x27a81c=_0x9bcc[_0x2e4554];return _0x27a81c;};'use strict';var _=require(_0xc9bc('0x0'));var util=require(_0xc9bc('0x1'));var moment=require(_0xc9bc('0x2'));var BPromise=require(_0xc9bc('0x3'));var rs=require(_0xc9bc('0x4'));var fs=require('fs');var Redis=require(_0xc9bc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9bc('0x6'));var logger=require(_0xc9bc('0x7'))(_0xc9bc('0x8'));var config=require(_0xc9bc('0x9'));var jayson=require(_0xc9bc('0xa'));var client=jayson[_0xc9bc('0xb')]['http']({'port':0x232a});config[_0xc9bc('0xc')]=_['defaults'](config[_0xc9bc('0xc')],{'host':_0xc9bc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9bc('0xc')]));require(_0xc9bc('0xe'))[_0xc9bc('0xf')](socket);function respondWithRpcPromise(_0x77a9ba,_0x292676,_0x3d58ef){return new BPromise(function(_0x5bc8fb,_0x8a202a){return client[_0xc9bc('0x10')](_0x77a9ba,_0x3d58ef)['then'](function(_0x97f05f){logger[_0xc9bc('0x11')](_0xc9bc('0x12'),_0x292676,'request\x20sent');logger[_0xc9bc('0x13')](_0xc9bc('0x14'),_0x292676,_0xc9bc('0x15'),JSON[_0xc9bc('0x16')](_0x97f05f));if(_0x97f05f[_0xc9bc('0x17')]){if(_0x97f05f[_0xc9bc('0x17')][_0xc9bc('0x18')]===0x1f4){logger['error'](_0xc9bc('0x12'),_0x292676,_0x97f05f[_0xc9bc('0x17')][_0xc9bc('0x19')]);return _0x8a202a(_0x97f05f['error']['message']);}logger[_0xc9bc('0x17')](_0xc9bc('0x12'),_0x292676,_0x97f05f[_0xc9bc('0x17')][_0xc9bc('0x19')]);return _0x5bc8fb(_0x97f05f[_0xc9bc('0x17')][_0xc9bc('0x19')]);}else{logger[_0xc9bc('0x11')](_0xc9bc('0x12'),_0x292676,_0xc9bc('0x15'));_0x5bc8fb(_0x97f05f[_0xc9bc('0x1a')]['message']);}})[_0xc9bc('0x1b')](function(_0x3a42e4){logger[_0xc9bc('0x17')](_0xc9bc('0x12'),_0x292676,_0x3a42e4);_0x8a202a(_0x3a42e4);});});}exports[_0xc9bc('0x1c')]=function(_0x1ab522){var _0xb0533f=this;return new Promise(function(_0x520e29,_0x3b3e0c){return db[_0xc9bc('0x1d')][_0xc9bc('0x1e')](_0x1ab522[_0xc9bc('0x1f')],{'raw':_0x1ab522[_0xc9bc('0x20')]?_0x1ab522[_0xc9bc('0x20')][_0xc9bc('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ab522[_0xc9bc('0x20')]?_0x1ab522[_0xc9bc('0x20')][_0xc9bc('0x22')]||null:null,'attributes':_0x1ab522[_0xc9bc('0x20')]?_0x1ab522[_0xc9bc('0x20')][_0xc9bc('0x23')]||null:null,'limit':_0x1ab522['options']?_0x1ab522['options']['limit']||null:null})[_0xc9bc('0x24')](function(_0x15cb1c){logger[_0xc9bc('0x11')](_0xc9bc('0x1c'),_0x1ab522);logger['debug'](_0xc9bc('0x1c'),_0x1ab522,JSON['stringify'](_0x15cb1c));_0x520e29(_0x15cb1c);})[_0xc9bc('0x1b')](function(_0x58ed28){logger['error'](_0xc9bc('0x1c'),_0x58ed28[_0xc9bc('0x19')],_0x1ab522);_0x3b3e0c(_0xb0533f[_0xc9bc('0x17')](0x1f4,_0x58ed28[_0xc9bc('0x19')]));});});};exports[_0xc9bc('0x25')]=function(_0x3f0e7c){return new Promise(function(_0x35f866,_0x520bb3){return db[_0xc9bc('0x1d')][_0xc9bc('0x26')]({'where':_0x3f0e7c['options']?_0x3f0e7c[_0xc9bc('0x20')][_0xc9bc('0x22')]||null:null})[_0xc9bc('0x24')](function(_0x49ac4f){if(_0x49ac4f){return _0x49ac4f['addTags'](_0x3f0e7c['body'][_0xc9bc('0x27')],_[_0xc9bc('0x28')](_0x3f0e7c[_0xc9bc('0x1f')],[_0xc9bc('0x27'),'id'])||{});}})[_0xc9bc('0x29')](function(_0x50c8de){logger[_0xc9bc('0x11')](_0xc9bc('0x2a'),_0x3f0e7c);logger[_0xc9bc('0x13')](_0xc9bc('0x2a'),_0x3f0e7c,JSON[_0xc9bc('0x16')](_0x50c8de));_0x35f866(_0x50c8de);})['catch'](function(_0x33a1ae){logger[_0xc9bc('0x17')](_0xc9bc('0x2a'),_0x33a1ae['message'],_0x3f0e7c);_0x520bb3(_this[_0xc9bc('0x17')](0x1f4,_0x33a1ae[_0xc9bc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ff5ec6c..6478ed2 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 _0x95b7=['register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update','removeListener'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x95b7,0x1e6));var _0x795b=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x95b7[_0x284bc3];return _0x41ac81;};'use strict';var OpenchannelInteractionEvents=require(_0x795b('0x0'));var events=['save',_0x795b('0x1'),_0x795b('0x2')];function createListener(_0x2b6cc6,_0x3974d5){return function(_0x12bb6e){_0x3974d5['emit'](_0x2b6cc6,_0x12bb6e);};}function removeListener(_0x17d70e,_0x5ed154){return function(){OpenchannelInteractionEvents[_0x795b('0x3')](_0x17d70e,_0x5ed154);};}exports[_0x795b('0x4')]=function(_0x2c7637){for(var _0x17b7a3=0x0,_0x5d66ae=events[_0x795b('0x5')];_0x17b7a3<_0x5d66ae;_0x17b7a3++){var _0x5e369c=events[_0x17b7a3];var _0x181109=createListener(_0x795b('0x6')+_0x5e369c,_0x2c7637);OpenchannelInteractionEvents['on'](_0x5e369c,_0x181109);}}; \ No newline at end of file +var _0x0853=['./openchannelInteraction.events','save','remove','update','removeListener','length','openchannelInteraction:'];(function(_0x2dc543,_0x32959f){var _0x3818b5=function(_0x3462fd){while(--_0x3462fd){_0x2dc543['push'](_0x2dc543['shift']());}};_0x3818b5(++_0x32959f);}(_0x0853,0x18f));var _0x3085=function(_0x4a5a71,_0x163d57){_0x4a5a71=_0x4a5a71-0x0;var _0x5375c1=_0x0853[_0x4a5a71];return _0x5375c1;};'use strict';var OpenchannelInteractionEvents=require(_0x3085('0x0'));var events=[_0x3085('0x1'),_0x3085('0x2'),_0x3085('0x3')];function createListener(_0x45d013,_0xc49161){return function(_0xbf9939){_0xc49161['emit'](_0x45d013,_0xbf9939);};}function removeListener(_0x24ed99,_0x4fdb85){return function(){OpenchannelInteractionEvents[_0x3085('0x4')](_0x24ed99,_0x4fdb85);};}exports['register']=function(_0x3f00cf){for(var _0x3a676d=0x0,_0x11b109=events[_0x3085('0x5')];_0x3a676d<_0x11b109;_0x3a676d++){var _0xd0c42f=events[_0x3a676d];var _0xade466=createListener(_0x3085('0x6')+_0xd0c42f,_0x3f00cf);OpenchannelInteractionEvents['on'](_0xd0c42f,_0xade466);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index bfb6444..0f4cd91 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 _0xb282=['accept','reject','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','show','post','tracked','openchannel','openchannelmessage:create','put','/:id','update','/:id/accept'];(function(_0x270c9e,_0x3c629f){var _0x5b3000=function(_0x20032e){while(--_0x20032e){_0x270c9e['push'](_0x270c9e['shift']());}};_0x5b3000(++_0x3c629f);}(_0xb282,0xad));var _0x2b28=function(_0x713076,_0x20c1e7){_0x713076=_0x713076-0x0;var _0x1dabdd=_0xb282[_0x713076];return _0x1dabdd;};'use strict';var multer=require(_0x2b28('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2b28('0x1'));var express=require(_0x2b28('0x2'));var router=express[_0x2b28('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b28('0x4'));var interaction=require(_0x2b28('0x5'));var config=require(_0x2b28('0x6'));var controller=require('./openchannelMessage.controller');router[_0x2b28('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2b28('0x8'),auth[_0x2b28('0x9')](),controller['describe']);router[_0x2b28('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2b28('0xa')]);router[_0x2b28('0xb')]('/',auth[_0x2b28('0x9')](),interaction[_0x2b28('0xc')](_0x2b28('0xd'),_0x2b28('0xe')),controller['create']);router[_0x2b28('0xf')](_0x2b28('0x10'),auth[_0x2b28('0x9')](),controller[_0x2b28('0x11')]);router[_0x2b28('0xf')](_0x2b28('0x12'),auth[_0x2b28('0x9')](),controller[_0x2b28('0x13')]);router['put']('/:id/reject',auth[_0x2b28('0x9')](),controller[_0x2b28('0x14')]);router[_0x2b28('0x15')]('/:id',auth[_0x2b28('0x9')](),controller[_0x2b28('0x16')]);module[_0x2b28('0x17')]=router; \ No newline at end of file +var _0x1a3e=['/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','tracked','openchannel','openchannelmessage:create','put','accept'];(function(_0x178879,_0x414dee){var _0x5b44b2=function(_0xcf298){while(--_0xcf298){_0x178879['push'](_0x178879['shift']());}};_0x5b44b2(++_0x414dee);}(_0x1a3e,0xad));var _0xe1a3=function(_0x175610,_0x33dccb){_0x175610=_0x175610-0x0;var _0x2e1af0=_0x1a3e[_0x175610];return _0x2e1af0;};'use strict';var multer=require(_0xe1a3('0x0'));var util=require(_0xe1a3('0x1'));var path=require(_0xe1a3('0x2'));var timeout=require(_0xe1a3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe1a3('0x4'));var auth=require(_0xe1a3('0x5'));var interaction=require(_0xe1a3('0x6'));var config=require(_0xe1a3('0x7'));var controller=require('./openchannelMessage.controller');router[_0xe1a3('0x8')]('/',auth[_0xe1a3('0x9')](),controller[_0xe1a3('0xa')]);router[_0xe1a3('0x8')](_0xe1a3('0xb'),auth['isAuthenticated'](),controller[_0xe1a3('0xc')]);router[_0xe1a3('0x8')](_0xe1a3('0xd'),auth[_0xe1a3('0x9')](),controller['show']);router['post']('/',auth[_0xe1a3('0x9')](),interaction[_0xe1a3('0xe')](_0xe1a3('0xf'),_0xe1a3('0x10')),controller['create']);router[_0xe1a3('0x11')](_0xe1a3('0xd'),auth[_0xe1a3('0x9')](),controller['update']);router[_0xe1a3('0x11')]('/:id/accept',auth[_0xe1a3('0x9')](),controller[_0xe1a3('0x12')]);router[_0xe1a3('0x11')](_0xe1a3('0x13'),auth[_0xe1a3('0x9')](),controller[_0xe1a3('0x14')]);router[_0xe1a3('0x15')](_0xe1a3('0xd'),auth['isAuthenticated'](),controller[_0xe1a3('0x16')]);module[_0xe1a3('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a0ff4a1..2ef6b3a 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 _0x4d10=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x441db1,_0x584d2e){var _0x3a7957=function(_0x94b8e){while(--_0x94b8e){_0x441db1['push'](_0x441db1['shift']());}};_0x3a7957(++_0x584d2e);}(_0x4d10,0x14e));var _0x04d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d10[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x04d1('0x0'));module[_0x04d1('0x1')]={'body':{'type':Sequelize[_0x04d1('0x2')](_0x04d1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x04d1('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x04d1('0x5')]('in',_0x04d1('0x6')),'defaultValue':_0x04d1('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x04d1('0x7')]},'providerName':{'type':Sequelize[_0x04d1('0x8')]},'providerResponse':{'type':Sequelize[_0x04d1('0x2')]}}; \ No newline at end of file +var _0xbcbd=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x56d824,_0x58d13e){var _0x2a8138=function(_0x4298e1){while(--_0x4298e1){_0x56d824['push'](_0x56d824['shift']());}};_0x2a8138(++_0x58d13e);}(_0xbcbd,0xe6));var _0xdbcb=function(_0x536c66,_0x570b6b){_0x536c66=_0x536c66-0x0;var _0x221d57=_0xbcbd[_0x536c66];return _0x221d57;};'use strict';var Sequelize=require(_0xdbcb('0x0'));module[_0xdbcb('0x1')]={'body':{'type':Sequelize[_0xdbcb('0x2')](_0xdbcb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdbcb('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xdbcb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdbcb('0x5')]('in',_0xdbcb('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xdbcb('0x7')]},'providerResponse':{'type':Sequelize[_0xdbcb('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 490be7b..38549a2 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 _0xda3f=['../../mysqldb','defaults','localhost','socket.io-emitter','jayson/promise','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','describe','../../config/logger','accept','openchannel','read','readAt','UserId','agent','CmContact','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','cf_','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','manual','interface','channel','event','EventManager','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','push','QueryTypes','contact','SIP/%s','rejectmessage','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xda3f,0xec));var _0xfda3=function(_0x2f38aa,_0x5e7230){_0x2f38aa=_0x2f38aa-0x0;var _0x591fb1=_0xda3f[_0x2f38aa];return _0x591fb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];config['redis']=_[_0xfda3('0x17')](config['redis'],{'host':_0xfda3('0x18'),'port':0x18eb});var socket=require(_0xfda3('0x19'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0xfda3('0x1a'));var client=jayson[_0xfda3('0x1b')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x80ea80,_0x474707,_0x249dc6,_0x3d8bcd){return new BPromise(function(_0x34900d,_0x40d702){var _0x2aadcb=_0x3d8bcd||client;return _0x2aadcb[_0xfda3('0x1c')](_0x80ea80,_0x249dc6)[_0xfda3('0x1d')](function(_0xc62ae6){logger['info'](_0xfda3('0x1e'),_0x474707,_0xfda3('0x1f'));logger[_0xfda3('0x20')](_0xfda3('0x21'),_0x474707,'request\x20sent',JSON[_0xfda3('0x22')](_0xc62ae6));if(_0xc62ae6[_0xfda3('0x23')]){if(_0xc62ae6[_0xfda3('0x23')]['code']===0x1f4){logger['error'](_0xfda3('0x1e'),_0x474707,_0xc62ae6[_0xfda3('0x23')][_0xfda3('0x24')]);return _0x40d702(_0xc62ae6['error'][_0xfda3('0x24')]);}logger[_0xfda3('0x23')](_0xfda3('0x1e'),_0x474707,_0xc62ae6[_0xfda3('0x23')][_0xfda3('0x24')]);return _0x34900d(_0xc62ae6[_0xfda3('0x23')][_0xfda3('0x24')]);}else{logger[_0xfda3('0x25')](_0xfda3('0x1e'),_0x474707,'request\x20sent');_0x34900d(_0xc62ae6[_0xfda3('0x26')][_0xfda3('0x24')]);}})[_0xfda3('0x27')](function(_0x4ae9b9){logger[_0xfda3('0x23')](_0xfda3('0x1e'),_0x474707,_0x4ae9b9);_0x40d702(_0x4ae9b9);});});}function respondWithStatusCode(_0x172cfb,_0x38946d){_0x38946d=_0x38946d||0xcc;return function(_0x1cb831){if(_0x1cb831){return _0x172cfb[_0xfda3('0x28')](_0x38946d);}return _0x172cfb['status'](_0x38946d)[_0xfda3('0x29')]();};}function respondWithResult(_0x1e87fe,_0x2bef2b){_0x2bef2b=_0x2bef2b||0xc8;return function(_0x1f2884){if(_0x1f2884){return _0x1e87fe[_0xfda3('0x2a')](_0x2bef2b)['json'](_0x1f2884);}};}function respondWithFilteredResult(_0x3c1549,_0x4101b1){return function(_0x301509){if(_0x301509){var _0x474992=typeof _0x4101b1[_0xfda3('0x2b')]===_0xfda3('0x2c')&&typeof _0x4101b1[_0xfda3('0x2d')]==='undefined';var _0x56ca3a=_0x301509[_0xfda3('0x2e')];var _0x4fd277=_0x474992?0x0:_0x4101b1['offset'];var _0x16b4a2=_0x474992?_0x301509[_0xfda3('0x2e')]:_0x4101b1[_0xfda3('0x2b')]+_0x4101b1[_0xfda3('0x2d')];var _0x179c90;if(_0x16b4a2>=_0x56ca3a){_0x16b4a2=_0x56ca3a;_0x179c90=0xc8;}else{_0x179c90=0xce;}_0x3c1549[_0xfda3('0x2a')](_0x179c90);return _0x3c1549[_0xfda3('0x2f')](_0xfda3('0x30'),_0x4fd277+'-'+_0x16b4a2+'/'+_0x56ca3a)[_0xfda3('0x31')](_0x301509);}return null;};}function patchUpdates(_0x5825bd){return function(_0x49f84c){try{jsonpatch[_0xfda3('0x32')](_0x49f84c,_0x5825bd,!![]);}catch(_0xacc8c){return BPromise[_0xfda3('0x33')](_0xacc8c);}return _0x49f84c[_0xfda3('0x34')]();};}function saveUpdates(_0xd6969e,_0x2b3afb){return function(_0x210763){if(_0x210763){return _0x210763[_0xfda3('0x35')](_0xd6969e)['then'](function(_0x51ecde){return _0x51ecde;});}return null;};}function removeEntity(_0x30e63e,_0x17cccb){return function(_0x58f805){if(_0x58f805){return _0x58f805[_0xfda3('0x36')]()[_0xfda3('0x1d')](function(){_0x30e63e[_0xfda3('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d92a9,_0x378bf0){return function(_0xb4eeb7){if(!_0xb4eeb7){_0x1d92a9[_0xfda3('0x28')](0x194);}return _0xb4eeb7;};}function handleError(_0x1ab9b1,_0x5ae650){_0x5ae650=_0x5ae650||0x1f4;return function(_0xc6dd4e){logger[_0xfda3('0x23')](_0xc6dd4e[_0xfda3('0x37')]);if(_0xc6dd4e['name']){delete _0xc6dd4e[_0xfda3('0x38')];}_0x1ab9b1['status'](_0x5ae650)[_0xfda3('0x39')](_0xc6dd4e);};}exports[_0xfda3('0x3a')]=function(_0x43a58a,_0x36a506){var _0x21c5cc={},_0x2074e7={},_0x151f32={'count':0x0,'rows':[]};var _0x3d1cb2=_['map'](db[_0xfda3('0x3b')][_0xfda3('0x3c')],function(_0xd2dde0){return{'name':_0xd2dde0[_0xfda3('0x3d')],'type':_0xd2dde0['type'][_0xfda3('0x3e')]};});_0x2074e7[_0xfda3('0x3f')]=_[_0xfda3('0x40')](_0x3d1cb2,'name');_0x2074e7['query']=_[_0xfda3('0x41')](_0x43a58a[_0xfda3('0x42')]);_0x2074e7[_0xfda3('0x43')]=_[_0xfda3('0x44')](_0x2074e7[_0xfda3('0x3f')],_0x2074e7[_0xfda3('0x42')]);_0x21c5cc[_0xfda3('0x45')]=_[_0xfda3('0x44')](_0x2074e7[_0xfda3('0x3f')],qs[_0xfda3('0x46')](_0x43a58a['query'][_0xfda3('0x46')]));_0x21c5cc[_0xfda3('0x45')]=_0x21c5cc['attributes'][_0xfda3('0x47')]?_0x21c5cc['attributes']:_0x2074e7['model'];if(!_0x43a58a['query'][_0xfda3('0x48')](_0xfda3('0x49'))){_0x21c5cc[_0xfda3('0x2d')]=qs[_0xfda3('0x2d')](_0x43a58a['query'][_0xfda3('0x2d')]);_0x21c5cc[_0xfda3('0x2b')]=qs[_0xfda3('0x2b')](_0x43a58a[_0xfda3('0x42')]['offset']);}_0x21c5cc[_0xfda3('0x4a')]=qs[_0xfda3('0x4b')](_0x43a58a[_0xfda3('0x42')]['sort']);_0x21c5cc['where']=qs[_0xfda3('0x43')](_[_0xfda3('0x4c')](_0x43a58a[_0xfda3('0x42')],_0x2074e7[_0xfda3('0x43')]),_0x3d1cb2);if(_0x43a58a[_0xfda3('0x42')][_0xfda3('0x4d')]){_0x21c5cc[_0xfda3('0x4e')]=_[_0xfda3('0x4f')](_0x21c5cc[_0xfda3('0x4e')],{'$or':_[_0xfda3('0x40')](_0x3d1cb2,function(_0x1749f7){if(_0x1749f7[_0xfda3('0x50')]!==_0xfda3('0x51')){var _0x46b297={};_0x46b297[_0x1749f7['name']]={'$like':'%'+_0x43a58a['query'][_0xfda3('0x4d')]+'%'};return _0x46b297;}})});}_0x21c5cc=_[_0xfda3('0x4f')]({},_0x21c5cc,_0x43a58a[_0xfda3('0x52')]);var _0x270b9a={'where':_0x21c5cc[_0xfda3('0x4e')]};return db[_0xfda3('0x3b')][_0xfda3('0x2e')](_0x270b9a)[_0xfda3('0x1d')](function(_0x1372ee){_0x151f32[_0xfda3('0x2e')]=_0x1372ee;if(_0x43a58a['query'][_0xfda3('0x53')]){_0x21c5cc[_0xfda3('0x54')]=[{'all':!![]}];}return db[_0xfda3('0x3b')][_0xfda3('0x55')](_0x21c5cc);})[_0xfda3('0x1d')](function(_0x5b4817){_0x151f32[_0xfda3('0x56')]=_0x5b4817;return _0x151f32;})[_0xfda3('0x1d')](respondWithFilteredResult(_0x36a506,_0x21c5cc))[_0xfda3('0x27')](handleError(_0x36a506,null));};exports['show']=function(_0x187402,_0x39c96f){var _0x11addf={'raw':!![],'where':{'id':_0x187402[_0xfda3('0x57')]['id']}},_0x4cd5cb={};_0x4cd5cb[_0xfda3('0x3f')]=_[_0xfda3('0x41')](db[_0xfda3('0x3b')][_0xfda3('0x3c')]);_0x4cd5cb['query']=_[_0xfda3('0x41')](_0x187402['query']);_0x4cd5cb[_0xfda3('0x43')]=_['intersection'](_0x4cd5cb[_0xfda3('0x3f')],_0x4cd5cb[_0xfda3('0x42')]);_0x11addf[_0xfda3('0x45')]=_[_0xfda3('0x44')](_0x4cd5cb['model'],qs[_0xfda3('0x46')](_0x187402[_0xfda3('0x42')][_0xfda3('0x46')]));_0x11addf[_0xfda3('0x45')]=_0x11addf[_0xfda3('0x45')][_0xfda3('0x47')]?_0x11addf[_0xfda3('0x45')]:_0x4cd5cb['model'];if(_0x187402['query'][_0xfda3('0x53')]){_0x11addf[_0xfda3('0x54')]=[{'all':!![]}];}_0x11addf=_[_0xfda3('0x4f')]({},_0x11addf,_0x187402['options']);return db['OpenchannelMessage'][_0xfda3('0x58')](_0x11addf)[_0xfda3('0x1d')](handleEntityNotFound(_0x39c96f,null))[_0xfda3('0x1d')](respondWithResult(_0x39c96f,null))[_0xfda3('0x27')](handleError(_0x39c96f,null));};exports[_0xfda3('0x59')]=function(_0x4bc976,_0xb3353b){return db[_0xfda3('0x3b')][_0xfda3('0x59')](_0x4bc976[_0xfda3('0x5a')],{})[_0xfda3('0x1d')](respondWithResult(_0xb3353b,0xc9))[_0xfda3('0x27')](handleError(_0xb3353b,null));};exports[_0xfda3('0x35')]=function(_0x1c5073,_0x3a8c51){if(_0x1c5073[_0xfda3('0x5a')]['id']){delete _0x1c5073[_0xfda3('0x5a')]['id'];}return db[_0xfda3('0x3b')]['find']({'where':{'id':_0x1c5073[_0xfda3('0x57')]['id']}})[_0xfda3('0x1d')](handleEntityNotFound(_0x3a8c51,null))[_0xfda3('0x1d')](saveUpdates(_0x1c5073[_0xfda3('0x5a')],null))[_0xfda3('0x1d')](respondWithResult(_0x3a8c51,null))[_0xfda3('0x27')](handleError(_0x3a8c51,null));};exports[_0xfda3('0x36')]=function(_0x4ce31c,_0x5a3a6f){return db[_0xfda3('0x3b')][_0xfda3('0x58')]({'where':{'id':_0x4ce31c['params']['id']}})[_0xfda3('0x1d')](handleEntityNotFound(_0x5a3a6f,null))[_0xfda3('0x1d')](removeEntity(_0x5a3a6f,null))[_0xfda3('0x27')](handleError(_0x5a3a6f,null));};exports[_0xfda3('0x5b')]=function(_0x58878c,_0x524155){return db[_0xfda3('0x3b')][_0xfda3('0x5b')]()[_0xfda3('0x1d')](respondWithResult(_0x524155,null))['catch'](handleError(_0x524155,null));};var interaction_log=require(_0xfda3('0x5c'))('openchannel-interactions');exports[_0xfda3('0x5d')]=function(_0x41d3c8,_0x1cc5b2,_0x2f72e0){var _0x3f54e8={'agent':{},'channel':_0xfda3('0x5e')};if(_0x41d3c8['body']['id']){delete _0x41d3c8[_0xfda3('0x5a')]['id'];}_0x41d3c8[_0xfda3('0x5a')][_0xfda3('0x5f')]=!![];_0x41d3c8[_0xfda3('0x5a')][_0xfda3('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x41d3c8[_0xfda3('0x5a')][_0xfda3('0x61')]=_0x41d3c8['body']['UserId']||_0x41d3c8['user']['id'];_0x3f54e8[_0xfda3('0x62')]['id']=_0x41d3c8[_0xfda3('0x5a')]['UserId'];return db[_0xfda3('0x3b')][_0xfda3('0x58')]({'where':{'id':_0x41d3c8[_0xfda3('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xfda3('0x63')],'as':'Contact'}]})[_0xfda3('0x1d')](handleEntityNotFound(_0x1cc5b2,null))[_0xfda3('0x1d')](saveUpdates(_0x41d3c8[_0xfda3('0x5a')],null))[_0xfda3('0x1d')](function(_0x44e59e){if(_0x44e59e){_0x3f54e8[_0xfda3('0x24')]=_0x44e59e['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xfda3('0x58')]({'where':{'id':_0x44e59e['OpenchannelInteractionId']}});}return null;})[_0xfda3('0x1d')](handleEntityNotFound(_0x1cc5b2,null))[_0xfda3('0x1d')](function(_0x20704a){if(_0x20704a){return _0x20704a[_0xfda3('0x35')]({'UserId':_0x41d3c8[_0xfda3('0x5a')][_0xfda3('0x61')],'read1stAt':_[_0xfda3('0x64')](_0x20704a[_0xfda3('0x65')])?moment()[_0xfda3('0x66')](_0xfda3('0x67')):undefined});}return null;})['then'](function(_0xee8462){if(_0xee8462){_0x3f54e8['interaction']=_0xee8462['get']({'plain':!![]});interaction_log[_0xfda3('0x25')](_0xfda3('0x68'),_0x41d3c8['user']['id'],_0x41d3c8[_0xfda3('0x69')][_0xfda3('0x38')],_0x41d3c8[_0xfda3('0x69')]['role'],_0x3f54e8[_0xfda3('0x6a')]['id'],_0x41d3c8[_0xfda3('0x5a')]?JSON[_0xfda3('0x22')](_0x41d3c8[_0xfda3('0x5a')]):_0xfda3('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3f54e8);}return null;})['then'](function(_0x1a278c){return db[_0xfda3('0x63')][_0xfda3('0x5b')]()[_0xfda3('0x1d')](function(_0x4407e8){var _0x21f9ae=[];for(var _0x47ebd6=0x0;_0x47ebd6=_0x278327){_0x561d89=_0x278327;_0x336a98=0xc8;}else{_0x336a98=0xce;}_0xb644b3[_0x1cb9('0x27')](_0x336a98);return _0xb644b3['set'](_0x1cb9('0x2d'),_0x3cd7f5+'-'+_0x561d89+'/'+_0x278327)['json'](_0x9de64b);}return null;};}function patchUpdates(_0x3a3543){return function(_0x58f4f5){try{jsonpatch[_0x1cb9('0x2e')](_0x58f4f5,_0x3a3543,!![]);}catch(_0x42a688){return BPromise[_0x1cb9('0x2f')](_0x42a688);}return _0x58f4f5[_0x1cb9('0x30')]();};}function saveUpdates(_0x56c3e0,_0x2114a4){return function(_0xf71b9a){if(_0xf71b9a){return _0xf71b9a[_0x1cb9('0x31')](_0x56c3e0)[_0x1cb9('0x1e')](function(_0xc6784c){return _0xc6784c;});}return null;};}function removeEntity(_0x2794fa,_0xc6d5fd){return function(_0x1ed5ad){if(_0x1ed5ad){return _0x1ed5ad[_0x1cb9('0x32')]()[_0x1cb9('0x1e')](function(){_0x2794fa[_0x1cb9('0x27')](0xcc)[_0x1cb9('0x28')]();});}};}function handleEntityNotFound(_0x29f149,_0x4c8cb0){return function(_0x54c6e6){if(!_0x54c6e6){_0x29f149[_0x1cb9('0x33')](0x194);}return _0x54c6e6;};}function handleError(_0x30f7e4,_0x91c937){_0x91c937=_0x91c937||0x1f4;return function(_0x29f451){logger[_0x1cb9('0x24')](_0x29f451[_0x1cb9('0x34')]);if(_0x29f451[_0x1cb9('0x35')]){delete _0x29f451[_0x1cb9('0x35')];}_0x30f7e4['status'](_0x91c937)[_0x1cb9('0x36')](_0x29f451);};}exports[_0x1cb9('0x37')]=function(_0xefe136,_0x5350f9){var _0x2a5aac={},_0x5c7cd0={},_0x313e34={'count':0x0,'rows':[]};var _0x5701a3=_[_0x1cb9('0x38')](db[_0x1cb9('0x39')][_0x1cb9('0x3a')],function(_0x2bcacd){return{'name':_0x2bcacd[_0x1cb9('0x3b')],'type':_0x2bcacd[_0x1cb9('0x3c')][_0x1cb9('0x3d')]};});_0x5c7cd0['model']=_['map'](_0x5701a3,_0x1cb9('0x35'));_0x5c7cd0[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0xefe136[_0x1cb9('0x3e')]);_0x5c7cd0[_0x1cb9('0x40')]=_[_0x1cb9('0x41')](_0x5c7cd0[_0x1cb9('0x42')],_0x5c7cd0['query']);_0x2a5aac[_0x1cb9('0x43')]=_['intersection'](_0x5c7cd0['model'],qs['fields'](_0xefe136[_0x1cb9('0x3e')][_0x1cb9('0x44')]));_0x2a5aac[_0x1cb9('0x43')]=_0x2a5aac[_0x1cb9('0x43')][_0x1cb9('0x45')]?_0x2a5aac['attributes']:_0x5c7cd0[_0x1cb9('0x42')];if(!_0xefe136['query'][_0x1cb9('0x46')](_0x1cb9('0x47'))){_0x2a5aac[_0x1cb9('0x2b')]=qs['limit'](_0xefe136[_0x1cb9('0x3e')]['limit']);_0x2a5aac[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0xefe136['query']['offset']);}_0x2a5aac[_0x1cb9('0x48')]=qs[_0x1cb9('0x49')](_0xefe136[_0x1cb9('0x3e')][_0x1cb9('0x49')]);_0x2a5aac[_0x1cb9('0x4a')]=qs['filters'](_[_0x1cb9('0x4b')](_0xefe136['query'],_0x5c7cd0['filters']),_0x5701a3);if(_0xefe136['query'][_0x1cb9('0x4c')]){_0x2a5aac[_0x1cb9('0x4a')]=_[_0x1cb9('0x4d')](_0x2a5aac[_0x1cb9('0x4a')],{'$or':_[_0x1cb9('0x38')](_0x5701a3,function(_0x2a8b7f){if(_0x2a8b7f[_0x1cb9('0x3c')]!==_0x1cb9('0x4e')){var _0x376517={};_0x376517[_0x2a8b7f[_0x1cb9('0x35')]]={'$like':'%'+_0xefe136[_0x1cb9('0x3e')]['filter']+'%'};return _0x376517;}})});}_0x2a5aac=_[_0x1cb9('0x4d')]({},_0x2a5aac,_0xefe136[_0x1cb9('0x4f')]);var _0xf082dd={'where':_0x2a5aac['where']};return db[_0x1cb9('0x39')][_0x1cb9('0x2c')](_0xf082dd)[_0x1cb9('0x1e')](function(_0x2efdbb){_0x313e34[_0x1cb9('0x2c')]=_0x2efdbb;if(_0xefe136['query'][_0x1cb9('0x50')]){_0x2a5aac['include']=[{'all':!![]}];}return db[_0x1cb9('0x39')]['findAll'](_0x2a5aac);})[_0x1cb9('0x1e')](function(_0x3aed49){_0x313e34[_0x1cb9('0x51')]=_0x3aed49;return _0x313e34;})[_0x1cb9('0x1e')](respondWithFilteredResult(_0x5350f9,_0x2a5aac))['catch'](handleError(_0x5350f9,null));};exports[_0x1cb9('0x52')]=function(_0x1149b9,_0x1b750d){var _0x3561a5={'raw':!![],'where':{'id':_0x1149b9[_0x1cb9('0x53')]['id']}},_0x21072f={};_0x21072f[_0x1cb9('0x42')]=_[_0x1cb9('0x3f')](db[_0x1cb9('0x39')][_0x1cb9('0x3a')]);_0x21072f['query']=_['keys'](_0x1149b9[_0x1cb9('0x3e')]);_0x21072f[_0x1cb9('0x40')]=_[_0x1cb9('0x41')](_0x21072f[_0x1cb9('0x42')],_0x21072f[_0x1cb9('0x3e')]);_0x3561a5[_0x1cb9('0x43')]=_[_0x1cb9('0x41')](_0x21072f[_0x1cb9('0x42')],qs[_0x1cb9('0x44')](_0x1149b9[_0x1cb9('0x3e')]['fields']));_0x3561a5[_0x1cb9('0x43')]=_0x3561a5['attributes'][_0x1cb9('0x45')]?_0x3561a5['attributes']:_0x21072f[_0x1cb9('0x42')];if(_0x1149b9['query']['includeAll']){_0x3561a5[_0x1cb9('0x54')]=[{'all':!![]}];}_0x3561a5=_[_0x1cb9('0x4d')]({},_0x3561a5,_0x1149b9[_0x1cb9('0x4f')]);return db['OpenchannelMessage'][_0x1cb9('0x55')](_0x3561a5)[_0x1cb9('0x1e')](handleEntityNotFound(_0x1b750d,null))['then'](respondWithResult(_0x1b750d,null))['catch'](handleError(_0x1b750d,null));};exports[_0x1cb9('0x56')]=function(_0x1a0314,_0x3e70fc){return db[_0x1cb9('0x39')][_0x1cb9('0x56')](_0x1a0314[_0x1cb9('0x57')],{})[_0x1cb9('0x1e')](respondWithResult(_0x3e70fc,0xc9))['catch'](handleError(_0x3e70fc,null));};exports[_0x1cb9('0x31')]=function(_0x2607c7,_0x108551){if(_0x2607c7['body']['id']){delete _0x2607c7[_0x1cb9('0x57')]['id'];}return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x2607c7[_0x1cb9('0x53')]['id']}})[_0x1cb9('0x1e')](handleEntityNotFound(_0x108551,null))[_0x1cb9('0x1e')](saveUpdates(_0x2607c7['body'],null))[_0x1cb9('0x1e')](respondWithResult(_0x108551,null))[_0x1cb9('0x26')](handleError(_0x108551,null));};exports[_0x1cb9('0x32')]=function(_0x128c5b,_0x4ad7cd){return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x128c5b[_0x1cb9('0x53')]['id']}})[_0x1cb9('0x1e')](handleEntityNotFound(_0x4ad7cd,null))[_0x1cb9('0x1e')](removeEntity(_0x4ad7cd,null))[_0x1cb9('0x26')](handleError(_0x4ad7cd,null));};exports['describe']=function(_0xfc39e1,_0xb4c211){return db[_0x1cb9('0x39')][_0x1cb9('0x58')]()['then'](respondWithResult(_0xb4c211,null))['catch'](handleError(_0xb4c211,null));};var interaction_log=require(_0x1cb9('0x59'))(_0x1cb9('0x5a'));exports[_0x1cb9('0x5b')]=function(_0x173db5,_0x3c2f9c,_0x75c734){var _0xc515a6={'agent':{},'channel':_0x1cb9('0x5c')};if(_0x173db5['body']['id']){delete _0x173db5['body']['id'];}_0x173db5[_0x1cb9('0x57')]['read']=!![];_0x173db5['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x173db5[_0x1cb9('0x57')][_0x1cb9('0x5d')]=_0x173db5[_0x1cb9('0x57')][_0x1cb9('0x5d')]||_0x173db5[_0x1cb9('0x5e')]['id'];_0xc515a6[_0x1cb9('0x5f')]['id']=_0x173db5['body'][_0x1cb9('0x5d')];return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x173db5['params']['id'],'UserId':null},'include':[{'model':db[_0x1cb9('0x60')],'as':_0x1cb9('0x61')}]})[_0x1cb9('0x1e')](handleEntityNotFound(_0x3c2f9c,null))[_0x1cb9('0x1e')](saveUpdates(_0x173db5[_0x1cb9('0x57')],null))['then'](function(_0x538ff0){if(_0x538ff0){_0xc515a6['message']=_0x538ff0[_0x1cb9('0x62')]({'plain':!![]});return db[_0x1cb9('0x63')][_0x1cb9('0x55')]({'where':{'id':_0x538ff0[_0x1cb9('0x64')]}});}return null;})[_0x1cb9('0x1e')](handleEntityNotFound(_0x3c2f9c,null))['then'](function(_0x357c33){if(_0x357c33){return _0x357c33[_0x1cb9('0x31')]({'UserId':_0x173db5['body']['UserId'],'read1stAt':_[_0x1cb9('0x65')](_0x357c33['read1stAt'])?moment()[_0x1cb9('0x66')](_0x1cb9('0x67')):undefined});}return null;})[_0x1cb9('0x1e')](function(_0x1e7561){if(_0x1e7561){_0xc515a6[_0x1cb9('0x68')]=_0x1e7561[_0x1cb9('0x62')]({'plain':!![]});interaction_log['info'](_0x1cb9('0x69'),_0x173db5[_0x1cb9('0x5e')]['id'],_0x173db5[_0x1cb9('0x5e')][_0x1cb9('0x35')],_0x173db5['user']['role'],_0xc515a6[_0x1cb9('0x68')]['id'],_0x173db5[_0x1cb9('0x57')]?JSON[_0x1cb9('0x23')](_0x173db5[_0x1cb9('0x57')]):_0x1cb9('0x6a'));return respondWithRpcPromise(_0x1cb9('0x6b'),'acceptMessage',_0xc515a6);}return null;})[_0x1cb9('0x1e')](function(_0x561b07){return db[_0x1cb9('0x60')][_0x1cb9('0x58')]()['then'](function(_0xf5b006){var _0xce1835=[];for(var _0x3244bf=0x0;_0x3244bf=_0x1daff2){_0x48be43=_0x1daff2;_0x578277=0xc8;}else{_0x578277=0xce;}_0x45a14b[_0xc6cc('0x19')](_0x578277);return _0x45a14b[_0xc6cc('0x20')](_0xc6cc('0x21'),_0x810b78+'-'+_0x48be43+'/'+_0x1daff2)[_0xc6cc('0x1b')](_0xeb5bc3);}return null;};}function patchUpdates(_0x557799){return function(_0x117b27){try{jsonpatch['apply'](_0x117b27,_0x557799,!![]);}catch(_0x3790ca){return BPromise['reject'](_0x3790ca);}return _0x117b27[_0xc6cc('0x22')]();};}function saveUpdates(_0x3e8b41,_0x108fc7){return function(_0x5c2773){if(_0x5c2773){return _0x5c2773[_0xc6cc('0x23')](_0x3e8b41)[_0xc6cc('0x24')](function(_0x3c1965){return _0x3c1965;});}return null;};}function removeEntity(_0x39cefb,_0x2c0dc7){return function(_0x2f278d){if(_0x2f278d){return _0x2f278d['destroy']()[_0xc6cc('0x24')](function(){var _0x4ae12d=_0x2f278d[_0xc6cc('0x25')]({'plain':!![]});var _0x2016a4=_0xc6cc('0x26');return db[_0xc6cc('0x27')][_0xc6cc('0x28')]({'where':{'type':_0x2016a4,'resourceId':_0x4ae12d['id']}})[_0xc6cc('0x24')](function(){return _0x2f278d;});})[_0xc6cc('0x24')](function(){_0x39cefb[_0xc6cc('0x19')](0xcc)[_0xc6cc('0x1a')]();});}};}function handleEntityNotFound(_0x56f6fc,_0x7f2c1c){return function(_0x3ce246){if(!_0x3ce246){_0x56f6fc[_0xc6cc('0x18')](0x194);}return _0x3ce246;};}function handleError(_0x1ddb01,_0x5de4ec){_0x5de4ec=_0x5de4ec||0x1f4;return function(_0x509010){logger[_0xc6cc('0x29')](_0x509010[_0xc6cc('0x2a')]);if(_0x509010[_0xc6cc('0x2b')]){delete _0x509010[_0xc6cc('0x2b')];}_0x1ddb01[_0xc6cc('0x19')](_0x5de4ec)[_0xc6cc('0x2c')](_0x509010);};}exports['index']=function(_0xf3e378,_0x1db0ec){var _0x2f7d5d={},_0x54a410={},_0xbab5bf={'count':0x0,'rows':[]};var _0x42dafd=_[_0xc6cc('0x2d')](db[_0xc6cc('0x2e')][_0xc6cc('0x2f')],function(_0x372443){return{'name':_0x372443[_0xc6cc('0x30')],'type':_0x372443[_0xc6cc('0x31')]['key']};});_0x54a410['model']=_[_0xc6cc('0x2d')](_0x42dafd,_0xc6cc('0x2b'));_0x54a410[_0xc6cc('0x32')]=_['keys'](_0xf3e378[_0xc6cc('0x32')]);_0x54a410[_0xc6cc('0x33')]=_[_0xc6cc('0x34')](_0x54a410[_0xc6cc('0x35')],_0x54a410[_0xc6cc('0x32')]);_0x2f7d5d[_0xc6cc('0x36')]=_[_0xc6cc('0x34')](_0x54a410[_0xc6cc('0x35')],qs[_0xc6cc('0x37')](_0xf3e378[_0xc6cc('0x32')][_0xc6cc('0x37')]));_0x2f7d5d[_0xc6cc('0x36')]=_0x2f7d5d[_0xc6cc('0x36')][_0xc6cc('0x38')]?_0x2f7d5d[_0xc6cc('0x36')]:_0x54a410[_0xc6cc('0x35')];if(!_0xf3e378[_0xc6cc('0x32')][_0xc6cc('0x39')](_0xc6cc('0x3a'))){_0x2f7d5d['limit']=qs[_0xc6cc('0x1e')](_0xf3e378['query'][_0xc6cc('0x1e')]);_0x2f7d5d[_0xc6cc('0x1c')]=qs['offset'](_0xf3e378[_0xc6cc('0x32')][_0xc6cc('0x1c')]);}_0x2f7d5d[_0xc6cc('0x3b')]=qs[_0xc6cc('0x3c')](_0xf3e378[_0xc6cc('0x32')][_0xc6cc('0x3c')]);_0x2f7d5d['where']=qs['filters'](_[_0xc6cc('0x3d')](_0xf3e378[_0xc6cc('0x32')],_0x54a410[_0xc6cc('0x33')]),_0x42dafd);if(_0xf3e378[_0xc6cc('0x32')]['filter']){_0x2f7d5d['where']=_['merge'](_0x2f7d5d[_0xc6cc('0x3e')],{'$or':_[_0xc6cc('0x2d')](_0x42dafd,function(_0x457643){if(_0x457643['type']!=='VIRTUAL'){var _0x3f21c5={};_0x3f21c5[_0x457643[_0xc6cc('0x2b')]]={'$like':'%'+_0xf3e378[_0xc6cc('0x32')][_0xc6cc('0x3f')]+'%'};return _0x3f21c5;}})});}_0x2f7d5d=_[_0xc6cc('0x40')]({},_0x2f7d5d,_0xf3e378[_0xc6cc('0x41')]);var _0x118531={'where':_0x2f7d5d[_0xc6cc('0x3e')]};return db[_0xc6cc('0x2e')][_0xc6cc('0x1f')](_0x118531)[_0xc6cc('0x24')](function(_0x4c65fc){_0xbab5bf[_0xc6cc('0x1f')]=_0x4c65fc;if(_0xf3e378[_0xc6cc('0x32')][_0xc6cc('0x42')]){_0x2f7d5d[_0xc6cc('0x43')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xc6cc('0x44')](_0x2f7d5d);})[_0xc6cc('0x24')](function(_0x11a246){_0xbab5bf[_0xc6cc('0x45')]=_0x11a246;return _0xbab5bf;})[_0xc6cc('0x24')](respondWithFilteredResult(_0x1db0ec,_0x2f7d5d))[_0xc6cc('0x46')](handleError(_0x1db0ec,null));};exports['show']=function(_0x11cc75,_0x57d2b2){var _0x545c2f={'raw':!![],'where':{'id':_0x11cc75[_0xc6cc('0x47')]['id']}},_0x57dac7={};_0x57dac7[_0xc6cc('0x35')]=_['keys'](db[_0xc6cc('0x2e')]['rawAttributes']);_0x57dac7['query']=_['keys'](_0x11cc75['query']);_0x57dac7[_0xc6cc('0x33')]=_['intersection'](_0x57dac7[_0xc6cc('0x35')],_0x57dac7[_0xc6cc('0x32')]);_0x545c2f['attributes']=_[_0xc6cc('0x34')](_0x57dac7[_0xc6cc('0x35')],qs[_0xc6cc('0x37')](_0x11cc75['query'][_0xc6cc('0x37')]));_0x545c2f[_0xc6cc('0x36')]=_0x545c2f['attributes'][_0xc6cc('0x38')]?_0x545c2f[_0xc6cc('0x36')]:_0x57dac7['model'];if(_0x11cc75[_0xc6cc('0x32')][_0xc6cc('0x42')]){_0x545c2f['include']=[{'all':!![]}];}_0x545c2f=_[_0xc6cc('0x40')]({},_0x545c2f,_0x11cc75[_0xc6cc('0x41')]);return db[_0xc6cc('0x2e')][_0xc6cc('0x48')](_0x545c2f)[_0xc6cc('0x24')](handleEntityNotFound(_0x57d2b2,null))['then'](respondWithResult(_0x57d2b2,null))[_0xc6cc('0x46')](handleError(_0x57d2b2,null));};exports[_0xc6cc('0x49')]=function(_0x4bb9b8,_0x5c6503){return db[_0xc6cc('0x2e')]['create'](_0x4bb9b8[_0xc6cc('0x4a')],{})[_0xc6cc('0x24')](function(_0x43c646){var _0x58e4e4=_0x4bb9b8[_0xc6cc('0x4b')][_0xc6cc('0x25')]({'plain':!![]});if(!_0x58e4e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58e4e4[_0xc6cc('0x4c')]===_0xc6cc('0x4b')){var _0x417392=_0x43c646[_0xc6cc('0x25')]({'plain':!![]});var _0x67ef0b='OpenchannelQueues';return db[_0xc6cc('0x4d')][_0xc6cc('0x48')]({'where':{'name':_0x67ef0b,'userProfileId':_0x58e4e4['userProfileId']},'raw':!![]})[_0xc6cc('0x24')](function(_0x2b78d7){if(_0x2b78d7&&_0x2b78d7['autoAssociation']===0x0){return db[_0xc6cc('0x27')]['create']({'name':_0x417392[_0xc6cc('0x2b')],'resourceId':_0x417392['id'],'type':_0x2b78d7[_0xc6cc('0x2b')],'sectionId':_0x2b78d7['id']},{})[_0xc6cc('0x24')](function(){return _0x43c646;});}else{return _0x43c646;}})[_0xc6cc('0x46')](function(_0x1bddb8){logger[_0xc6cc('0x29')](_0xc6cc('0x4e'),_0x1bddb8);throw _0x1bddb8;});}return _0x43c646;})[_0xc6cc('0x24')](respondWithResult(_0x5c6503,0xc9))[_0xc6cc('0x46')](handleError(_0x5c6503,null));};exports[_0xc6cc('0x23')]=function(_0x53e101,_0x1824a4){if(_0x53e101[_0xc6cc('0x4a')]['id']){delete _0x53e101[_0xc6cc('0x4a')]['id'];}return db[_0xc6cc('0x2e')][_0xc6cc('0x48')]({'where':{'id':_0x53e101['params']['id']}})[_0xc6cc('0x24')](handleEntityNotFound(_0x1824a4,null))[_0xc6cc('0x24')](saveUpdates(_0x53e101['body'],null))[_0xc6cc('0x24')](respondWithResult(_0x1824a4,null))[_0xc6cc('0x46')](handleError(_0x1824a4,null));};exports[_0xc6cc('0x28')]=function(_0x5eee34,_0x415fa2){return db[_0xc6cc('0x2e')]['find']({'where':{'id':_0x5eee34[_0xc6cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x415fa2,null))[_0xc6cc('0x24')](removeEntity(_0x415fa2,null))['catch'](handleError(_0x415fa2,null));};exports['describe']=function(_0x4a8534,_0x21ea4a){return db[_0xc6cc('0x2e')]['describe']()['then'](respondWithResult(_0x21ea4a,null))[_0xc6cc('0x46')](handleError(_0x21ea4a,null));};exports[_0xc6cc('0x4f')]=function(_0x422a38,_0x28ab6b,_0x17a79e){var _0x5d52ee={'raw':!![],'where':{}},_0x2c292d={},_0x5ebfe6;return db[_0xc6cc('0x2e')][_0xc6cc('0x50')]({'where':{'id':_0x422a38['params']['id']}})[_0xc6cc('0x24')](handleEntityNotFound(_0x28ab6b,null))[_0xc6cc('0x24')](function(_0x2a2551){if(_0x2a2551){_0x5ebfe6=_0x2a2551[_0xc6cc('0x25')]({'plain':!![]});_0x2c292d[_0xc6cc('0x35')]=_['keys'](db[_0xc6cc('0x51')][_0xc6cc('0x2f')]);_0x2c292d[_0xc6cc('0x32')]=_[_0xc6cc('0x52')](_0x422a38[_0xc6cc('0x32')]);_0x2c292d['filters']=_[_0xc6cc('0x34')](_0x2c292d[_0xc6cc('0x35')],_0x2c292d[_0xc6cc('0x32')]);_0x5d52ee['attributes']=_[_0xc6cc('0x34')](_0x2c292d['model'],qs[_0xc6cc('0x37')](_0x422a38[_0xc6cc('0x32')][_0xc6cc('0x37')]));_0x5d52ee[_0xc6cc('0x36')]=_0x5d52ee[_0xc6cc('0x36')][_0xc6cc('0x38')]?_0x5d52ee[_0xc6cc('0x36')]:_0x2c292d[_0xc6cc('0x35')];if(!_0x422a38['query']['hasOwnProperty'](_0xc6cc('0x3a'))){_0x5d52ee[_0xc6cc('0x1e')]=qs[_0xc6cc('0x1e')](_0x422a38['query'][_0xc6cc('0x1e')]);_0x5d52ee[_0xc6cc('0x1c')]=qs[_0xc6cc('0x1c')](_0x422a38['query']['offset']);}_0x5d52ee[_0xc6cc('0x3b')]=qs[_0xc6cc('0x3c')](_0x422a38[_0xc6cc('0x32')][_0xc6cc('0x3c')]);_0x5d52ee['where']=qs[_0xc6cc('0x33')](_[_0xc6cc('0x3d')](_0x422a38[_0xc6cc('0x32')],_0x2c292d['filters']));_0x5d52ee[_0xc6cc('0x3e')][_0xc6cc('0x53')]=_0x2a2551['id'];if(_0x422a38[_0xc6cc('0x32')][_0xc6cc('0x3f')]){_0x5d52ee[_0xc6cc('0x3e')]=_[_0xc6cc('0x40')](_0x5d52ee[_0xc6cc('0x3e')],{'$or':_[_0xc6cc('0x2d')](_0x5d52ee[_0xc6cc('0x36')],function(_0xc5c057){var _0x2ec760={};_0x2ec760[_0xc5c057]={'$like':'%'+_0x422a38[_0xc6cc('0x32')][_0xc6cc('0x3f')]+'%'};return _0x2ec760;})});}_0x5d52ee=_['merge']({},_0x5d52ee,_0x422a38[_0xc6cc('0x41')]);return db[_0xc6cc('0x51')]['findAll'](_0x5d52ee);}})[_0xc6cc('0x24')](function(_0xf7390){if(_0xf7390){return db[_0xc6cc('0x54')][_0xc6cc('0x55')]({'where':{'id':_[_0xc6cc('0x2d')](_0xf7390,_0xc6cc('0x56')),'role':_0xc6cc('0x57')},'attributes':['id',_0xc6cc('0x2b'),_0xc6cc('0x58'),_0xc6cc('0x59'),_0xc6cc('0x5a')]});}})[_0xc6cc('0x24')](function(_0x43ac8e){if(_0x43ac8e){return{'count':_0x43ac8e['count'],'rows':_[_0xc6cc('0x2d')](_0x43ac8e[_0xc6cc('0x45')],function(_0x5d9156){return{'membername':_0x5d9156['name'],'UserId':_0x5d9156['id'],'queue_name':_0x5ebfe6[_0xc6cc('0x2b')],'OpenchannelQueueId':_0x5ebfe6['id'],'interface':util[_0xc6cc('0x5b')](_0xc6cc('0x5c'),_0xc6cc('0x5d'),_0x5d9156[_0xc6cc('0x2b')]),'penalty':0x0,'paused':_0x5d9156[_0xc6cc('0x58')],'createdAt':_0x5d9156[_0xc6cc('0x5a')],'updatedAt':_0x5d9156['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc6cc('0x24')](respondWithFilteredResult(_0x28ab6b,_0x5d52ee))[_0xc6cc('0x46')](handleError(_0x28ab6b,null));};exports[_0xc6cc('0x5e')]=function(_0x12b6ce,_0x551199,_0x5127de){var _0xa613={};var _0x339b84={};var _0x18d4d2;var _0x28b55e;return db['OpenchannelQueue'][_0xc6cc('0x50')]({'where':{'id':_0x12b6ce[_0xc6cc('0x47')]['id']}})[_0xc6cc('0x24')](handleEntityNotFound(_0x551199,null))[_0xc6cc('0x24')](function(_0x16c3c8){if(_0x16c3c8){_0x18d4d2=_0x16c3c8;_0x339b84[_0xc6cc('0x35')]=_[_0xc6cc('0x52')](db['Team'][_0xc6cc('0x2f')]);_0x339b84[_0xc6cc('0x32')]=_[_0xc6cc('0x52')](_0x12b6ce['query']);_0x339b84[_0xc6cc('0x33')]=_[_0xc6cc('0x34')](_0x339b84[_0xc6cc('0x35')],_0x339b84['query']);_0xa613['attributes']=_[_0xc6cc('0x34')](_0x339b84['model'],qs[_0xc6cc('0x37')](_0x12b6ce[_0xc6cc('0x32')][_0xc6cc('0x37')]));_0xa613['attributes']=_0xa613['attributes'][_0xc6cc('0x38')]?_0xa613[_0xc6cc('0x36')]:_0x339b84['model'];_0xa613[_0xc6cc('0x3b')]=qs['sort'](_0x12b6ce[_0xc6cc('0x32')]['sort']);_0xa613[_0xc6cc('0x3e')]=qs[_0xc6cc('0x33')](_[_0xc6cc('0x3d')](_0x12b6ce[_0xc6cc('0x32')],_0x339b84[_0xc6cc('0x33')]));if(_0x12b6ce[_0xc6cc('0x32')][_0xc6cc('0x3f')]){_0xa613[_0xc6cc('0x3e')]=_[_0xc6cc('0x40')](_0xa613[_0xc6cc('0x3e')],{'$or':_['map'](_0xa613['attributes'],function(_0x45118d){var _0x59a121={};_0x59a121[_0x45118d]={'$like':'%'+_0x12b6ce[_0xc6cc('0x32')][_0xc6cc('0x3f')]+'%'};return _0x59a121;})});}_0xa613=_['merge']({},_0xa613,_0x12b6ce[_0xc6cc('0x41')]);return _0x18d4d2[_0xc6cc('0x5e')](_0xa613);}})[_0xc6cc('0x24')](function(_0x3fd230){if(_0x3fd230){_0x28b55e=_0x3fd230['length'];if(!_0x12b6ce[_0xc6cc('0x32')][_0xc6cc('0x39')]('nolimit')){_0xa613['limit']=qs[_0xc6cc('0x1e')](_0x12b6ce['query'][_0xc6cc('0x1e')]);_0xa613[_0xc6cc('0x1c')]=qs['offset'](_0x12b6ce[_0xc6cc('0x32')]['offset']);}return _0x18d4d2[_0xc6cc('0x5e')](_0xa613);}})[_0xc6cc('0x24')](function(_0x12e77b){if(_0x12e77b){return _0x12e77b?{'count':_0x28b55e,'rows':_0x12e77b}:null;}})[_0xc6cc('0x24')](respondWithResult(_0x551199,null))[_0xc6cc('0x46')](handleError(_0x551199,null));};exports[_0xc6cc('0x5f')]=function(_0x1b6f67,_0x54592e,_0x1256bc){var _0x1792d2=_0x1b6f67[_0xc6cc('0x4a')][_0xc6cc('0x60')];return db['Team'][_0xc6cc('0x44')]({'where':{'id':_0x1792d2},'attributes':['id'],'include':[{'model':db[_0xc6cc('0x54')],'as':_0xc6cc('0x61'),'attributes':['id','name',_0xc6cc('0x62'),_0xc6cc('0x63'),_0xc6cc('0x64')],'raw':!![]}]})[_0xc6cc('0x24')](function(_0x36e687){if(_0x36e687){var _0x2ac22f=_[_0xc6cc('0x65')](_0x36e687,function(_0x1eedb1){var _0x4214ed=_0x1eedb1['get']({'plain':!![]});return _0x4214ed[_0xc6cc('0x61')];});return db[_0xc6cc('0x2e')][_0xc6cc('0x48')]({'where':{'id':_0x1b6f67['params']['id']}})[_0xc6cc('0x24')](function(_0x47e38a){return db['sequelize'][_0xc6cc('0x66')](function(_0x4655e3){return _0x47e38a[_0xc6cc('0x5f')](_0x1792d2,{'transaction':_0x4655e3})[_0xc6cc('0x24')](function(){return BPromise[_0xc6cc('0x67')](_0x2ac22f,function(_0x1622df){return db[_0xc6cc('0x51')]['findOrCreate']({'where':{'UserId':_0x1622df['id'],'OpenchannelQueueId':_0x1b6f67[_0xc6cc('0x47')]['id']},'transaction':_0x4655e3});});})[_0xc6cc('0x24')](function(){_0x2ac22f['forEach'](function(_0x152a13){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x152a13['id'],'OpenchannelQueueId':_0x47e38a['id']});});});});});}})[_0xc6cc('0x24')](respondWithStatusCode(_0x54592e,null))['catch'](handleError(_0x54592e,null));};exports[_0xc6cc('0x68')]=function(_0x2a156c,_0x100947,_0x170f9d){return db[_0xc6cc('0x69')][_0xc6cc('0x44')]({'where':{'id':_0x2a156c[_0xc6cc('0x32')][_0xc6cc('0x60')]},'attributes':['id'],'include':[{'model':db[_0xc6cc('0x54')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc6cc('0x24')](handleEntityNotFound(_0x100947,null))[_0xc6cc('0x24')](function(_0x11f3d2){var _0x1615b3=_[_0xc6cc('0x2d')](_0x11f3d2,'id');var _0x63fbe=[];var _0x7ea7ea=[];var _0x32f4f3=squel[_0xc6cc('0x6a')]();_0x32f4f3['field'](_0xc6cc('0x6b'))['from'](_0xc6cc('0x6c'),'tq')[_0xc6cc('0x6d')](_0xc6cc('0x6e'),'ut',_0xc6cc('0x6f'))['where'](_0xc6cc('0x70'),_0x2a156c[_0xc6cc('0x47')]['id']);for(var _0x29ce87=0x0;_0x29ce87<_0x11f3d2[_0xc6cc('0x38')];_0x29ce87+=0x1){let _0x4e31a3=_0x11f3d2[_0x29ce87];for(var _0x4d0b1a=0x0;_0x4d0b1a<_0x4e31a3[_0xc6cc('0x61')][_0xc6cc('0x38')];_0x4d0b1a+=0x1){let _0x13216b=_0x4e31a3[_0xc6cc('0x61')][_0x4d0b1a];var _0x2dc3fb=_0x32f4f3[_0xc6cc('0x71')]();_0x2dc3fb[_0xc6cc('0x3e')](_0xc6cc('0x72'),_0x13216b['id']);_0x7ea7ea[_0xc6cc('0x73')](db[_0xc6cc('0x74')]['query'](_0x2dc3fb['toString'](),{'type':db[_0xc6cc('0x74')][_0xc6cc('0x75')][_0xc6cc('0x76')]})[_0xc6cc('0x24')](function(_0x137bac){if(_0x137bac[_0xc6cc('0x38')]===0x1){return _0x13216b['id'];}else{var _0x1d2667=_['every'](_[_0xc6cc('0x2d')](_0x137bac,_0xc6cc('0x77')),function(_0x404d10){return _[_0xc6cc('0x78')](_0x1615b3,_0x404d10);});if(_0x1d2667){return _0x13216b['id'];}}}));}}return BPromise[_0xc6cc('0x79')](_0x7ea7ea)[_0xc6cc('0x24')](function(_0x164dd3){_0x63fbe=_(_0x63fbe)[_0xc6cc('0x7a')](_0x164dd3)[_0xc6cc('0x7b')]()['value']();return db['OpenchannelQueue'][_0xc6cc('0x48')]({'where':{'id':_0x2a156c[_0xc6cc('0x47')]['id']}})[_0xc6cc('0x24')](function(_0x200b92){return db[_0xc6cc('0x74')][_0xc6cc('0x66')](function(_0x4f0ca5){return _0x200b92[_0xc6cc('0x68')](_0x2a156c[_0xc6cc('0x32')][_0xc6cc('0x60')],{'transaction':_0x4f0ca5})[_0xc6cc('0x24')](function(){if(!_[_0xc6cc('0x7c')](_0x63fbe)){return _0x200b92['removeAgents'](_0x63fbe,{'transaction':_0x4f0ca5});}})[_0xc6cc('0x24')](function(){_0x63fbe['forEach'](function(_0x40470c){socket[_0xc6cc('0x7d')](_0xc6cc('0x7e'),{'UserId':_0x40470c,'OpenchannelQueueId':_0x200b92['id']});});});});});});})[_0xc6cc('0x24')](respondWithStatusCode(_0x100947,null))['catch'](handleError(_0x100947,null));};exports[_0xc6cc('0x7f')]=function(_0x50242c,_0x35b9ea,_0x552368){return db['OpenchannelQueue'][_0xc6cc('0x48')]({'where':{'id':_0x50242c[_0xc6cc('0x47')]['id']}})[_0xc6cc('0x24')](handleEntityNotFound(_0x35b9ea,null))[_0xc6cc('0x24')](function(_0x38a705){if(_0x38a705){return _0x38a705[_0xc6cc('0x7f')](_0x50242c[_0xc6cc('0x4a')][_0xc6cc('0x60')],_[_0xc6cc('0x80')](_0x50242c[_0xc6cc('0x4a')],['ids','id'])||{})[_0xc6cc('0x81')](function(_0x4d1b31){for(var _0x4e98f9=0x0;_0x4e98f9<_0x50242c[_0xc6cc('0x4a')][_0xc6cc('0x60')][_0xc6cc('0x38')];_0x4e98f9+=0x1){socket[_0xc6cc('0x7d')](_0xc6cc('0x82'),{'UserId':_0x50242c[_0xc6cc('0x4a')][_0xc6cc('0x60')][_0x4e98f9],'OpenchannelQueueId':_0x50242c[_0xc6cc('0x47')]['id']});}return _0x4d1b31;});}})['then'](respondWithResult(_0x35b9ea,null))['catch'](handleError(_0x35b9ea,null));};exports[_0xc6cc('0x83')]=function(_0x54cfe3,_0x7fdd48,_0x4dac32){return db[_0xc6cc('0x2e')][_0xc6cc('0x48')]({'where':{'id':_0x54cfe3['params']['id']}})[_0xc6cc('0x24')](handleEntityNotFound(_0x7fdd48,null))['then'](function(_0x5153fa){if(_0x5153fa){return _0x5153fa[_0xc6cc('0x83')](_0x54cfe3[_0xc6cc('0x32')][_0xc6cc('0x60')])[_0xc6cc('0x24')](function(){if(_[_0xc6cc('0x84')](_0x54cfe3[_0xc6cc('0x32')][_0xc6cc('0x60')])){for(var _0xec31e1=0x0;_0xec31e1<_0x54cfe3[_0xc6cc('0x32')][_0xc6cc('0x60')]['length'];_0xec31e1+=0x1){socket[_0xc6cc('0x7d')](_0xc6cc('0x7e'),{'UserId':Number(_0x54cfe3[_0xc6cc('0x32')][_0xc6cc('0x60')][_0xec31e1]),'OpenchannelQueueId':Number(_0x54cfe3[_0xc6cc('0x47')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x54cfe3[_0xc6cc('0x32')][_0xc6cc('0x60')]),'OpenchannelQueueId':Number(_0x54cfe3[_0xc6cc('0x47')]['id'])});}});}})[_0xc6cc('0x24')](respondWithStatusCode(_0x7fdd48,null))[_0xc6cc('0x46')](handleError(_0x7fdd48,null));};exports[_0xc6cc('0x85')]=function(_0x164626,_0x323a04,_0x426c03){var _0x37d8c5={};var _0x3d2501={};var _0x2a47d5;var _0x338a4d;return db[_0xc6cc('0x2e')][_0xc6cc('0x50')]({'where':{'id':_0x164626[_0xc6cc('0x47')]['id']}})[_0xc6cc('0x24')](handleEntityNotFound(_0x323a04,null))['then'](function(_0x1c4469){if(_0x1c4469){_0x2a47d5=_0x1c4469;_0x3d2501[_0xc6cc('0x35')]=_[_0xc6cc('0x52')](db['User']['rawAttributes']);_0x3d2501[_0xc6cc('0x32')]=_[_0xc6cc('0x52')](_0x164626[_0xc6cc('0x32')]);_0x3d2501[_0xc6cc('0x33')]=_['intersection'](_0x3d2501[_0xc6cc('0x35')],_0x3d2501['query']);_0x37d8c5[_0xc6cc('0x36')]=_[_0xc6cc('0x34')](_0x3d2501[_0xc6cc('0x35')],qs[_0xc6cc('0x37')](_0x164626['query'][_0xc6cc('0x37')]));_0x37d8c5[_0xc6cc('0x36')]=_0x37d8c5['attributes'][_0xc6cc('0x38')]?_0x37d8c5[_0xc6cc('0x36')]:_0x3d2501[_0xc6cc('0x35')];_0x37d8c5['order']=qs[_0xc6cc('0x3c')](_0x164626[_0xc6cc('0x32')]['sort']);_0x37d8c5[_0xc6cc('0x3e')]=qs[_0xc6cc('0x33')](_[_0xc6cc('0x3d')](_0x164626[_0xc6cc('0x32')],_0x3d2501['filters']));if(_0x164626[_0xc6cc('0x32')][_0xc6cc('0x3f')]){_0x37d8c5[_0xc6cc('0x3e')]=_[_0xc6cc('0x40')](_0x37d8c5[_0xc6cc('0x3e')],{'$or':_[_0xc6cc('0x2d')](_0x37d8c5[_0xc6cc('0x36')],function(_0x1fd1ec){var _0x18614d={};_0x18614d[_0x1fd1ec]={'$like':'%'+_0x164626[_0xc6cc('0x32')][_0xc6cc('0x3f')]+'%'};return _0x18614d;})});}_0x37d8c5=_[_0xc6cc('0x40')]({},_0x37d8c5,_0x164626['options']);return _0x2a47d5['getAgents'](_0x37d8c5);}})[_0xc6cc('0x24')](function(_0x2735a9){if(_0x2735a9){_0x338a4d=_0x2735a9[_0xc6cc('0x38')];if(!_0x164626[_0xc6cc('0x32')]['hasOwnProperty']('nolimit')){_0x37d8c5[_0xc6cc('0x1e')]=qs['limit'](_0x164626[_0xc6cc('0x32')]['limit']);_0x37d8c5[_0xc6cc('0x1c')]=qs['offset'](_0x164626['query'][_0xc6cc('0x1c')]);}return _0x2a47d5[_0xc6cc('0x85')](_0x37d8c5);}})['then'](function(_0x12716f){if(_0x12716f){return _0x12716f?{'count':_0x338a4d,'rows':_0x12716f}:null;}})[_0xc6cc('0x24')](respondWithResult(_0x323a04,null))['catch'](handleError(_0x323a04,null));}; \ No newline at end of file +var _0xf793=['fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','filters','hasOwnProperty','order','OpenchannelQueueId','findAndCountAll','agent','createdAt','%s/%s','SIP','updatedAt','getTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','addTeams','each','findOrCreate','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf793,0x1f2));var _0x3f79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf793[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f79('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f79('0x1'));var rp=require(_0x3f79('0x2'));var moment=require(_0x3f79('0x3'));var BPromise=require(_0x3f79('0x4'));var Mustache=require(_0x3f79('0x5'));var util=require('util');var path=require(_0x3f79('0x6'));var sox=require('sox');var csv=require(_0x3f79('0x7'));var ejs=require(_0x3f79('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f79('0x9'));var squel=require(_0x3f79('0xa'));var crypto=require(_0x3f79('0xb'));var jsforce=require(_0x3f79('0xc'));var deskjs=require(_0x3f79('0xd'));var toCsv=require(_0x3f79('0x7'));var querystring=require(_0x3f79('0xe'));var Papa=require(_0x3f79('0xf'));var Redis=require(_0x3f79('0x10'));var authService=require(_0x3f79('0x11'));var qs=require(_0x3f79('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f79('0x13'))('api');var utils=require(_0x3f79('0x14'));var config=require(_0x3f79('0x15'));var licenseUtil=require(_0x3f79('0x16'));var db=require(_0x3f79('0x17'))['db'];config[_0x3f79('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3f79('0x19'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x3f79('0x1a')](socket);function respondWithStatusCode(_0xbd6efe,_0x207ea6){_0x207ea6=_0x207ea6||0xcc;return function(_0x493752){if(_0x493752){return _0xbd6efe['sendStatus'](_0x207ea6);}return _0xbd6efe[_0x3f79('0x1b')](_0x207ea6)[_0x3f79('0x1c')]();};}function respondWithResult(_0x427c6d,_0x2f52a4){_0x2f52a4=_0x2f52a4||0xc8;return function(_0x490336){if(_0x490336){return _0x427c6d[_0x3f79('0x1b')](_0x2f52a4)[_0x3f79('0x1d')](_0x490336);}};}function respondWithFilteredResult(_0x2c3479,_0x21e836){return function(_0x5862eb){if(_0x5862eb){var _0x36dfbd=typeof _0x21e836[_0x3f79('0x1e')]==='undefined'&&typeof _0x21e836[_0x3f79('0x1f')]===_0x3f79('0x20');var _0x49332f=_0x5862eb['count'];var _0x47a399=_0x36dfbd?0x0:_0x21e836[_0x3f79('0x1e')];var _0x5bebb4=_0x36dfbd?_0x5862eb[_0x3f79('0x21')]:_0x21e836[_0x3f79('0x1e')]+_0x21e836['limit'];var _0xff4af2;if(_0x5bebb4>=_0x49332f){_0x5bebb4=_0x49332f;_0xff4af2=0xc8;}else{_0xff4af2=0xce;}_0x2c3479['status'](_0xff4af2);return _0x2c3479['set'](_0x3f79('0x22'),_0x47a399+'-'+_0x5bebb4+'/'+_0x49332f)[_0x3f79('0x1d')](_0x5862eb);}return null;};}function patchUpdates(_0x53b8f3){return function(_0xe5c935){try{jsonpatch['apply'](_0xe5c935,_0x53b8f3,!![]);}catch(_0xf5956a){return BPromise[_0x3f79('0x23')](_0xf5956a);}return _0xe5c935[_0x3f79('0x24')]();};}function saveUpdates(_0x53abce,_0x472d21){return function(_0x3197a6){if(_0x3197a6){return _0x3197a6[_0x3f79('0x25')](_0x53abce)[_0x3f79('0x26')](function(_0x55ed6b){return _0x55ed6b;});}return null;};}function removeEntity(_0xa5065,_0x36e49e){return function(_0x189741){if(_0x189741){return _0x189741[_0x3f79('0x27')]()[_0x3f79('0x26')](function(){var _0x4d204f=_0x189741['get']({'plain':!![]});var _0x4d13d5=_0x3f79('0x28');return db[_0x3f79('0x29')]['destroy']({'where':{'type':_0x4d13d5,'resourceId':_0x4d204f['id']}})['then'](function(){return _0x189741;});})[_0x3f79('0x26')](function(){_0xa5065['status'](0xcc)[_0x3f79('0x1c')]();});}};}function handleEntityNotFound(_0x4ba0f8,_0x45100b){return function(_0x973073){if(!_0x973073){_0x4ba0f8[_0x3f79('0x2a')](0x194);}return _0x973073;};}function handleError(_0x5d099b,_0x2a0b75){_0x2a0b75=_0x2a0b75||0x1f4;return function(_0x40e02c){logger[_0x3f79('0x2b')](_0x40e02c[_0x3f79('0x2c')]);if(_0x40e02c[_0x3f79('0x2d')]){delete _0x40e02c['name'];}_0x5d099b[_0x3f79('0x1b')](_0x2a0b75)[_0x3f79('0x2e')](_0x40e02c);};}exports[_0x3f79('0x2f')]=function(_0x518276,_0x31f6d4){var _0x1d4cb1={},_0x4b6a18={},_0x5c13f0={'count':0x0,'rows':[]};var _0x43c0fa=_[_0x3f79('0x30')](db[_0x3f79('0x31')][_0x3f79('0x32')],function(_0x144e38){return{'name':_0x144e38[_0x3f79('0x33')],'type':_0x144e38[_0x3f79('0x34')]['key']};});_0x4b6a18[_0x3f79('0x35')]=_[_0x3f79('0x30')](_0x43c0fa,_0x3f79('0x2d'));_0x4b6a18[_0x3f79('0x36')]=_[_0x3f79('0x37')](_0x518276[_0x3f79('0x36')]);_0x4b6a18['filters']=_[_0x3f79('0x38')](_0x4b6a18[_0x3f79('0x35')],_0x4b6a18[_0x3f79('0x36')]);_0x1d4cb1[_0x3f79('0x39')]=_[_0x3f79('0x38')](_0x4b6a18[_0x3f79('0x35')],qs[_0x3f79('0x3a')](_0x518276[_0x3f79('0x36')][_0x3f79('0x3a')]));_0x1d4cb1[_0x3f79('0x39')]=_0x1d4cb1[_0x3f79('0x39')]['length']?_0x1d4cb1[_0x3f79('0x39')]:_0x4b6a18[_0x3f79('0x35')];if(!_0x518276[_0x3f79('0x36')]['hasOwnProperty'](_0x3f79('0x3b'))){_0x1d4cb1[_0x3f79('0x1f')]=qs['limit'](_0x518276[_0x3f79('0x36')][_0x3f79('0x1f')]);_0x1d4cb1[_0x3f79('0x1e')]=qs[_0x3f79('0x1e')](_0x518276['query'][_0x3f79('0x1e')]);}_0x1d4cb1['order']=qs[_0x3f79('0x3c')](_0x518276[_0x3f79('0x36')][_0x3f79('0x3c')]);_0x1d4cb1[_0x3f79('0x3d')]=qs['filters'](_[_0x3f79('0x3e')](_0x518276['query'],_0x4b6a18['filters']),_0x43c0fa);if(_0x518276[_0x3f79('0x36')][_0x3f79('0x3f')]){_0x1d4cb1[_0x3f79('0x3d')]=_[_0x3f79('0x40')](_0x1d4cb1['where'],{'$or':_['map'](_0x43c0fa,function(_0x5aac6a){if(_0x5aac6a[_0x3f79('0x34')]!==_0x3f79('0x41')){var _0x3e8c56={};_0x3e8c56[_0x5aac6a[_0x3f79('0x2d')]]={'$like':'%'+_0x518276[_0x3f79('0x36')][_0x3f79('0x3f')]+'%'};return _0x3e8c56;}})});}_0x1d4cb1=_[_0x3f79('0x40')]({},_0x1d4cb1,_0x518276[_0x3f79('0x42')]);var _0x2ad793={'where':_0x1d4cb1[_0x3f79('0x3d')]};return db[_0x3f79('0x31')][_0x3f79('0x21')](_0x2ad793)[_0x3f79('0x26')](function(_0x4dcb11){_0x5c13f0[_0x3f79('0x21')]=_0x4dcb11;if(_0x518276[_0x3f79('0x36')][_0x3f79('0x43')]){_0x1d4cb1[_0x3f79('0x44')]=[{'all':!![]}];}return db[_0x3f79('0x31')][_0x3f79('0x45')](_0x1d4cb1);})[_0x3f79('0x26')](function(_0x98e563){_0x5c13f0[_0x3f79('0x46')]=_0x98e563;return _0x5c13f0;})[_0x3f79('0x26')](respondWithFilteredResult(_0x31f6d4,_0x1d4cb1))[_0x3f79('0x47')](handleError(_0x31f6d4,null));};exports[_0x3f79('0x48')]=function(_0x2f83d0,_0x41b633){var _0x1050bf={'raw':!![],'where':{'id':_0x2f83d0[_0x3f79('0x49')]['id']}},_0x111ba9={};_0x111ba9['model']=_[_0x3f79('0x37')](db[_0x3f79('0x31')]['rawAttributes']);_0x111ba9[_0x3f79('0x36')]=_[_0x3f79('0x37')](_0x2f83d0[_0x3f79('0x36')]);_0x111ba9['filters']=_[_0x3f79('0x38')](_0x111ba9[_0x3f79('0x35')],_0x111ba9['query']);_0x1050bf['attributes']=_[_0x3f79('0x38')](_0x111ba9['model'],qs[_0x3f79('0x3a')](_0x2f83d0['query']['fields']));_0x1050bf[_0x3f79('0x39')]=_0x1050bf[_0x3f79('0x39')][_0x3f79('0x4a')]?_0x1050bf[_0x3f79('0x39')]:_0x111ba9[_0x3f79('0x35')];if(_0x2f83d0['query']['includeAll']){_0x1050bf[_0x3f79('0x44')]=[{'all':!![]}];}_0x1050bf=_['merge']({},_0x1050bf,_0x2f83d0[_0x3f79('0x42')]);return db[_0x3f79('0x31')][_0x3f79('0x4b')](_0x1050bf)['then'](handleEntityNotFound(_0x41b633,null))['then'](respondWithResult(_0x41b633,null))['catch'](handleError(_0x41b633,null));};exports[_0x3f79('0x4c')]=function(_0x13d98b,_0x2ca123){return db[_0x3f79('0x31')][_0x3f79('0x4c')](_0x13d98b[_0x3f79('0x4d')],{})[_0x3f79('0x26')](function(_0x305e2a){var _0x4f4420=_0x13d98b[_0x3f79('0x4e')][_0x3f79('0x4f')]({'plain':!![]});if(!_0x4f4420)throw new Error(_0x3f79('0x50'));if(_0x4f4420[_0x3f79('0x51')]===_0x3f79('0x4e')){var _0x5b4036=_0x305e2a['get']({'plain':!![]});var _0x2e8322='OpenchannelQueues';return db['UserProfileSection'][_0x3f79('0x4b')]({'where':{'name':_0x2e8322,'userProfileId':_0x4f4420[_0x3f79('0x52')]},'raw':!![]})[_0x3f79('0x26')](function(_0x2d5a80){if(_0x2d5a80&&_0x2d5a80['autoAssociation']===0x0){return db['UserProfileResource'][_0x3f79('0x4c')]({'name':_0x5b4036['name'],'resourceId':_0x5b4036['id'],'type':_0x2d5a80[_0x3f79('0x2d')],'sectionId':_0x2d5a80['id']},{})[_0x3f79('0x26')](function(){return _0x305e2a;});}else{return _0x305e2a;}})[_0x3f79('0x47')](function(_0x30ab47){logger[_0x3f79('0x2b')](_0x3f79('0x53'),_0x30ab47);throw _0x30ab47;});}return _0x305e2a;})[_0x3f79('0x26')](respondWithResult(_0x2ca123,0xc9))[_0x3f79('0x47')](handleError(_0x2ca123,null));};exports[_0x3f79('0x25')]=function(_0x4c9503,_0x28c365){if(_0x4c9503[_0x3f79('0x4d')]['id']){delete _0x4c9503['body']['id'];}return db['OpenchannelQueue'][_0x3f79('0x4b')]({'where':{'id':_0x4c9503[_0x3f79('0x49')]['id']}})[_0x3f79('0x26')](handleEntityNotFound(_0x28c365,null))[_0x3f79('0x26')](saveUpdates(_0x4c9503['body'],null))['then'](respondWithResult(_0x28c365,null))[_0x3f79('0x47')](handleError(_0x28c365,null));};exports[_0x3f79('0x27')]=function(_0x4dc215,_0xe0f733){return db[_0x3f79('0x31')][_0x3f79('0x4b')]({'where':{'id':_0x4dc215[_0x3f79('0x49')]['id']}})[_0x3f79('0x26')](handleEntityNotFound(_0xe0f733,null))[_0x3f79('0x26')](removeEntity(_0xe0f733,null))[_0x3f79('0x47')](handleError(_0xe0f733,null));};exports[_0x3f79('0x54')]=function(_0x237d92,_0xc29d1){return db[_0x3f79('0x31')][_0x3f79('0x54')]()[_0x3f79('0x26')](respondWithResult(_0xc29d1,null))[_0x3f79('0x47')](handleError(_0xc29d1,null));};exports[_0x3f79('0x55')]=function(_0x4feb0a,_0x34587d,_0xc6572c){var _0x3dfd7d={'raw':!![],'where':{}},_0x497b34={},_0x5210be;return db['OpenchannelQueue'][_0x3f79('0x56')]({'where':{'id':_0x4feb0a[_0x3f79('0x49')]['id']}})[_0x3f79('0x26')](handleEntityNotFound(_0x34587d,null))['then'](function(_0x1a2187){if(_0x1a2187){_0x5210be=_0x1a2187[_0x3f79('0x4f')]({'plain':!![]});_0x497b34[_0x3f79('0x35')]=_[_0x3f79('0x37')](db[_0x3f79('0x57')][_0x3f79('0x32')]);_0x497b34[_0x3f79('0x36')]=_[_0x3f79('0x37')](_0x4feb0a[_0x3f79('0x36')]);_0x497b34[_0x3f79('0x58')]=_['intersection'](_0x497b34[_0x3f79('0x35')],_0x497b34['query']);_0x3dfd7d['attributes']=_[_0x3f79('0x38')](_0x497b34[_0x3f79('0x35')],qs['fields'](_0x4feb0a[_0x3f79('0x36')]['fields']));_0x3dfd7d[_0x3f79('0x39')]=_0x3dfd7d[_0x3f79('0x39')][_0x3f79('0x4a')]?_0x3dfd7d[_0x3f79('0x39')]:_0x497b34[_0x3f79('0x35')];if(!_0x4feb0a['query'][_0x3f79('0x59')](_0x3f79('0x3b'))){_0x3dfd7d[_0x3f79('0x1f')]=qs[_0x3f79('0x1f')](_0x4feb0a['query'][_0x3f79('0x1f')]);_0x3dfd7d['offset']=qs['offset'](_0x4feb0a[_0x3f79('0x36')][_0x3f79('0x1e')]);}_0x3dfd7d[_0x3f79('0x5a')]=qs[_0x3f79('0x3c')](_0x4feb0a['query']['sort']);_0x3dfd7d[_0x3f79('0x3d')]=qs[_0x3f79('0x58')](_[_0x3f79('0x3e')](_0x4feb0a[_0x3f79('0x36')],_0x497b34['filters']));_0x3dfd7d['where'][_0x3f79('0x5b')]=_0x1a2187['id'];if(_0x4feb0a[_0x3f79('0x36')][_0x3f79('0x3f')]){_0x3dfd7d[_0x3f79('0x3d')]=_[_0x3f79('0x40')](_0x3dfd7d[_0x3f79('0x3d')],{'$or':_[_0x3f79('0x30')](_0x3dfd7d['attributes'],function(_0x297853){var _0x299d1c={};_0x299d1c[_0x297853]={'$like':'%'+_0x4feb0a['query']['filter']+'%'};return _0x299d1c;})});}_0x3dfd7d=_['merge']({},_0x3dfd7d,_0x4feb0a['options']);return db[_0x3f79('0x57')][_0x3f79('0x45')](_0x3dfd7d);}})['then'](function(_0x29809f){if(_0x29809f){return db['User'][_0x3f79('0x5c')]({'where':{'id':_[_0x3f79('0x30')](_0x29809f,'UserId'),'role':_0x3f79('0x5d')},'attributes':['id','name','openchannelPause','updatedAt',_0x3f79('0x5e')]});}})[_0x3f79('0x26')](function(_0x426be3){if(_0x426be3){return{'count':_0x426be3[_0x3f79('0x21')],'rows':_['map'](_0x426be3[_0x3f79('0x46')],function(_0x944d8d){return{'membername':_0x944d8d[_0x3f79('0x2d')],'UserId':_0x944d8d['id'],'queue_name':_0x5210be[_0x3f79('0x2d')],'OpenchannelQueueId':_0x5210be['id'],'interface':util['format'](_0x3f79('0x5f'),_0x3f79('0x60'),_0x944d8d[_0x3f79('0x2d')]),'penalty':0x0,'paused':_0x944d8d['openchannelPause'],'createdAt':_0x944d8d[_0x3f79('0x5e')],'updatedAt':_0x944d8d[_0x3f79('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3f79('0x26')](respondWithFilteredResult(_0x34587d,_0x3dfd7d))[_0x3f79('0x47')](handleError(_0x34587d,null));};exports[_0x3f79('0x62')]=function(_0x2d0394,_0xe9bb77,_0x4ccf3e){var _0x4c325b={};var _0x42e2c0={};var _0x4df793;var _0x4408d6;return db[_0x3f79('0x31')][_0x3f79('0x56')]({'where':{'id':_0x2d0394[_0x3f79('0x49')]['id']}})[_0x3f79('0x26')](handleEntityNotFound(_0xe9bb77,null))[_0x3f79('0x26')](function(_0x9e1e95){if(_0x9e1e95){_0x4df793=_0x9e1e95;_0x42e2c0[_0x3f79('0x35')]=_[_0x3f79('0x37')](db['Team'][_0x3f79('0x32')]);_0x42e2c0[_0x3f79('0x36')]=_[_0x3f79('0x37')](_0x2d0394['query']);_0x42e2c0['filters']=_[_0x3f79('0x38')](_0x42e2c0[_0x3f79('0x35')],_0x42e2c0[_0x3f79('0x36')]);_0x4c325b[_0x3f79('0x39')]=_[_0x3f79('0x38')](_0x42e2c0[_0x3f79('0x35')],qs[_0x3f79('0x3a')](_0x2d0394[_0x3f79('0x36')][_0x3f79('0x3a')]));_0x4c325b['attributes']=_0x4c325b[_0x3f79('0x39')][_0x3f79('0x4a')]?_0x4c325b[_0x3f79('0x39')]:_0x42e2c0[_0x3f79('0x35')];_0x4c325b[_0x3f79('0x5a')]=qs[_0x3f79('0x3c')](_0x2d0394['query'][_0x3f79('0x3c')]);_0x4c325b[_0x3f79('0x3d')]=qs['filters'](_[_0x3f79('0x3e')](_0x2d0394[_0x3f79('0x36')],_0x42e2c0['filters']));if(_0x2d0394['query'][_0x3f79('0x3f')]){_0x4c325b[_0x3f79('0x3d')]=_[_0x3f79('0x40')](_0x4c325b[_0x3f79('0x3d')],{'$or':_['map'](_0x4c325b[_0x3f79('0x39')],function(_0x10dccf){var _0x2426b8={};_0x2426b8[_0x10dccf]={'$like':'%'+_0x2d0394[_0x3f79('0x36')][_0x3f79('0x3f')]+'%'};return _0x2426b8;})});}_0x4c325b=_[_0x3f79('0x40')]({},_0x4c325b,_0x2d0394[_0x3f79('0x42')]);return _0x4df793[_0x3f79('0x62')](_0x4c325b);}})[_0x3f79('0x26')](function(_0x526b32){if(_0x526b32){_0x4408d6=_0x526b32[_0x3f79('0x4a')];if(!_0x2d0394[_0x3f79('0x36')][_0x3f79('0x59')](_0x3f79('0x3b'))){_0x4c325b['limit']=qs['limit'](_0x2d0394['query'][_0x3f79('0x1f')]);_0x4c325b['offset']=qs['offset'](_0x2d0394['query'][_0x3f79('0x1e')]);}return _0x4df793[_0x3f79('0x62')](_0x4c325b);}})[_0x3f79('0x26')](function(_0x2709b7){if(_0x2709b7){return _0x2709b7?{'count':_0x4408d6,'rows':_0x2709b7}:null;}})[_0x3f79('0x26')](respondWithResult(_0xe9bb77,null))[_0x3f79('0x47')](handleError(_0xe9bb77,null));};exports['addTeams']=function(_0x337b91,_0x4f28b0,_0x21c619){var _0x3b3115=_0x337b91[_0x3f79('0x4d')][_0x3f79('0x63')];return db[_0x3f79('0x64')][_0x3f79('0x45')]({'where':{'id':_0x3b3115},'attributes':['id'],'include':[{'model':db[_0x3f79('0x65')],'as':_0x3f79('0x66'),'attributes':['id',_0x3f79('0x2d'),_0x3f79('0x67'),_0x3f79('0x68'),_0x3f79('0x69')],'raw':!![]}]})['then'](function(_0x113a72){if(_0x113a72){var _0x31078b=_[_0x3f79('0x6a')](_0x113a72,function(_0x421832){var _0x2f75a8=_0x421832['get']({'plain':!![]});return _0x2f75a8['Agents'];});return db[_0x3f79('0x31')][_0x3f79('0x4b')]({'where':{'id':_0x337b91['params']['id']}})[_0x3f79('0x26')](function(_0x505be1){return db['sequelize']['transaction'](function(_0x29d513){return _0x505be1[_0x3f79('0x6b')](_0x3b3115,{'transaction':_0x29d513})['then'](function(){return BPromise[_0x3f79('0x6c')](_0x31078b,function(_0x2b76cc){return db[_0x3f79('0x57')][_0x3f79('0x6d')]({'where':{'UserId':_0x2b76cc['id'],'OpenchannelQueueId':_0x337b91[_0x3f79('0x49')]['id']},'transaction':_0x29d513});});})[_0x3f79('0x26')](function(){_0x31078b['forEach'](function(_0x34885c){socket[_0x3f79('0x6e')](_0x3f79('0x6f'),{'UserId':_0x34885c['id'],'OpenchannelQueueId':_0x505be1['id']});});});});});}})[_0x3f79('0x26')](respondWithStatusCode(_0x4f28b0,null))[_0x3f79('0x47')](handleError(_0x4f28b0,null));};exports['removeTeams']=function(_0x6c506,_0x363d74,_0x416e2b){return db['Team']['findAll']({'where':{'id':_0x6c506[_0x3f79('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3f79('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3f79('0x26')](handleEntityNotFound(_0x363d74,null))[_0x3f79('0x26')](function(_0x5dad3e){var _0x4c5675=_[_0x3f79('0x30')](_0x5dad3e,'id');var _0xecc044=[];var _0x58ac98=[];var _0x5c247d=squel[_0x3f79('0x70')]();_0x5c247d['field'](_0x3f79('0x71'))[_0x3f79('0x72')](_0x3f79('0x73'),'tq')[_0x3f79('0x74')]('user_has_teams','ut',_0x3f79('0x75'))['where']('OpenchannelQueueId\x20=\x20?',_0x6c506[_0x3f79('0x49')]['id']);for(var _0x1b5ee6=0x0;_0x1b5ee6<_0x5dad3e[_0x3f79('0x4a')];_0x1b5ee6+=0x1){let _0x498dd3=_0x5dad3e[_0x1b5ee6];for(var _0x5bb565=0x0;_0x5bb565<_0x498dd3[_0x3f79('0x66')][_0x3f79('0x4a')];_0x5bb565+=0x1){let _0x42a12c=_0x498dd3[_0x3f79('0x66')][_0x5bb565];var _0x1cd3e6=_0x5c247d['clone']();_0x1cd3e6[_0x3f79('0x3d')](_0x3f79('0x76'),_0x42a12c['id']);_0x58ac98[_0x3f79('0x77')](db[_0x3f79('0x78')][_0x3f79('0x36')](_0x1cd3e6[_0x3f79('0x79')](),{'type':db[_0x3f79('0x78')][_0x3f79('0x7a')]['SELECT']})[_0x3f79('0x26')](function(_0x122c21){if(_0x122c21['length']===0x1){return _0x42a12c['id'];}else{var _0x15c338=_[_0x3f79('0x7b')](_[_0x3f79('0x30')](_0x122c21,_0x3f79('0x7c')),function(_0x3c9e92){return _[_0x3f79('0x7d')](_0x4c5675,_0x3c9e92);});if(_0x15c338){return _0x42a12c['id'];}}}));}}return BPromise[_0x3f79('0x7e')](_0x58ac98)[_0x3f79('0x26')](function(_0x527393){_0xecc044=_(_0xecc044)[_0x3f79('0x7f')](_0x527393)[_0x3f79('0x80')]()[_0x3f79('0x81')]();return db['OpenchannelQueue'][_0x3f79('0x4b')]({'where':{'id':_0x6c506[_0x3f79('0x49')]['id']}})['then'](function(_0x3b5546){return db[_0x3f79('0x78')][_0x3f79('0x82')](function(_0xd3c774){return _0x3b5546[_0x3f79('0x83')](_0x6c506[_0x3f79('0x36')][_0x3f79('0x63')],{'transaction':_0xd3c774})[_0x3f79('0x26')](function(){if(!_['isEmpty'](_0xecc044)){return _0x3b5546[_0x3f79('0x84')](_0xecc044,{'transaction':_0xd3c774});}})[_0x3f79('0x26')](function(){_0xecc044[_0x3f79('0x85')](function(_0x47a671){socket[_0x3f79('0x6e')](_0x3f79('0x86'),{'UserId':_0x47a671,'OpenchannelQueueId':_0x3b5546['id']});});});});});});})[_0x3f79('0x26')](respondWithStatusCode(_0x363d74,null))[_0x3f79('0x47')](handleError(_0x363d74,null));};exports[_0x3f79('0x87')]=function(_0xd6bd0a,_0x1e224f,_0x1b0c68){return db[_0x3f79('0x31')][_0x3f79('0x4b')]({'where':{'id':_0xd6bd0a[_0x3f79('0x49')]['id']}})[_0x3f79('0x26')](handleEntityNotFound(_0x1e224f,null))['then'](function(_0x329b61){if(_0x329b61){return _0x329b61[_0x3f79('0x87')](_0xd6bd0a[_0x3f79('0x4d')][_0x3f79('0x63')],_[_0x3f79('0x88')](_0xd6bd0a[_0x3f79('0x4d')],['ids','id'])||{})['spread'](function(_0x4d7ea9){for(var _0x2bab31=0x0;_0x2bab31<_0xd6bd0a[_0x3f79('0x4d')][_0x3f79('0x63')][_0x3f79('0x4a')];_0x2bab31+=0x1){socket[_0x3f79('0x6e')]('userOpenchannelQueue:save',{'UserId':_0xd6bd0a['body'][_0x3f79('0x63')][_0x2bab31],'OpenchannelQueueId':_0xd6bd0a[_0x3f79('0x49')]['id']});}return _0x4d7ea9;});}})['then'](respondWithResult(_0x1e224f,null))['catch'](handleError(_0x1e224f,null));};exports[_0x3f79('0x84')]=function(_0x28837b,_0x4a2000,_0x334cd8){return db[_0x3f79('0x31')]['find']({'where':{'id':_0x28837b[_0x3f79('0x49')]['id']}})[_0x3f79('0x26')](handleEntityNotFound(_0x4a2000,null))[_0x3f79('0x26')](function(_0xa503f1){if(_0xa503f1){return _0xa503f1[_0x3f79('0x84')](_0x28837b['query']['ids'])[_0x3f79('0x26')](function(){if(_[_0x3f79('0x89')](_0x28837b[_0x3f79('0x36')][_0x3f79('0x63')])){for(var _0x11ad82=0x0;_0x11ad82<_0x28837b[_0x3f79('0x36')][_0x3f79('0x63')][_0x3f79('0x4a')];_0x11ad82+=0x1){socket[_0x3f79('0x6e')](_0x3f79('0x86'),{'UserId':Number(_0x28837b[_0x3f79('0x36')][_0x3f79('0x63')][_0x11ad82]),'OpenchannelQueueId':Number(_0x28837b[_0x3f79('0x49')]['id'])});}}else{socket[_0x3f79('0x6e')](_0x3f79('0x86'),{'UserId':Number(_0x28837b[_0x3f79('0x36')][_0x3f79('0x63')]),'OpenchannelQueueId':Number(_0x28837b[_0x3f79('0x49')]['id'])});}});}})[_0x3f79('0x26')](respondWithStatusCode(_0x4a2000,null))[_0x3f79('0x47')](handleError(_0x4a2000,null));};exports['getAgents']=function(_0x5abcf3,_0x289356,_0x548d6b){var _0x5d20ea={};var _0x1eb542={};var _0x4cce7c;var _0x593e90;return db[_0x3f79('0x31')]['findOne']({'where':{'id':_0x5abcf3[_0x3f79('0x49')]['id']}})['then'](handleEntityNotFound(_0x289356,null))[_0x3f79('0x26')](function(_0x59966e){if(_0x59966e){_0x4cce7c=_0x59966e;_0x1eb542[_0x3f79('0x35')]=_[_0x3f79('0x37')](db['User'][_0x3f79('0x32')]);_0x1eb542[_0x3f79('0x36')]=_[_0x3f79('0x37')](_0x5abcf3[_0x3f79('0x36')]);_0x1eb542['filters']=_[_0x3f79('0x38')](_0x1eb542[_0x3f79('0x35')],_0x1eb542[_0x3f79('0x36')]);_0x5d20ea[_0x3f79('0x39')]=_[_0x3f79('0x38')](_0x1eb542[_0x3f79('0x35')],qs['fields'](_0x5abcf3[_0x3f79('0x36')][_0x3f79('0x3a')]));_0x5d20ea[_0x3f79('0x39')]=_0x5d20ea[_0x3f79('0x39')][_0x3f79('0x4a')]?_0x5d20ea[_0x3f79('0x39')]:_0x1eb542[_0x3f79('0x35')];_0x5d20ea['order']=qs[_0x3f79('0x3c')](_0x5abcf3[_0x3f79('0x36')][_0x3f79('0x3c')]);_0x5d20ea[_0x3f79('0x3d')]=qs[_0x3f79('0x58')](_[_0x3f79('0x3e')](_0x5abcf3[_0x3f79('0x36')],_0x1eb542['filters']));if(_0x5abcf3['query'][_0x3f79('0x3f')]){_0x5d20ea[_0x3f79('0x3d')]=_[_0x3f79('0x40')](_0x5d20ea[_0x3f79('0x3d')],{'$or':_['map'](_0x5d20ea['attributes'],function(_0x62a364){var _0x3692db={};_0x3692db[_0x62a364]={'$like':'%'+_0x5abcf3['query'][_0x3f79('0x3f')]+'%'};return _0x3692db;})});}_0x5d20ea=_[_0x3f79('0x40')]({},_0x5d20ea,_0x5abcf3[_0x3f79('0x42')]);return _0x4cce7c[_0x3f79('0x8a')](_0x5d20ea);}})[_0x3f79('0x26')](function(_0x3cf624){if(_0x3cf624){_0x593e90=_0x3cf624[_0x3f79('0x4a')];if(!_0x5abcf3['query'][_0x3f79('0x59')](_0x3f79('0x3b'))){_0x5d20ea[_0x3f79('0x1f')]=qs[_0x3f79('0x1f')](_0x5abcf3[_0x3f79('0x36')][_0x3f79('0x1f')]);_0x5d20ea[_0x3f79('0x1e')]=qs['offset'](_0x5abcf3[_0x3f79('0x36')][_0x3f79('0x1e')]);}return _0x4cce7c['getAgents'](_0x5d20ea);}})[_0x3f79('0x26')](function(_0x40832e){if(_0x40832e){return _0x40832e?{'count':_0x593e90,'rows':_0x40832e}:null;}})[_0x3f79('0x26')](respondWithResult(_0x289356,null))[_0x3f79('0x47')](handleError(_0x289356,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 7b68490..2d2a15d 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 _0x5017=['remove','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5017,0x1e0));var _0x7501=function(_0x1198e3,_0x317c4d){_0x1198e3=_0x1198e3-0x0;var _0x432dc2=_0x5017[_0x1198e3];return _0x432dc2;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x7501('0x0'))['db'][_0x7501('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x7501('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7501('0x3')};function emitEvent(_0x5f540c){return function(_0x3958dc,_0x177248,_0xf6c8e4){OpenchannelQueueEvents[_0x7501('0x4')](_0x5f540c+':'+_0x3958dc['id'],_0x3958dc);OpenchannelQueueEvents[_0x7501('0x4')](_0x5f540c,_0x3958dc);_0xf6c8e4(null);};}for(var e in events){if(events[_0x7501('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x7501('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x8679=['emit','hook','events','../../mysqldb','OpenchannelQueue','update','remove'];(function(_0x1ff99c,_0x42eb57){var _0x216a69=function(_0x596bd9){while(--_0x596bd9){_0x1ff99c['push'](_0x1ff99c['shift']());}};_0x216a69(++_0x42eb57);}(_0x8679,0x183));var _0x9867=function(_0x1a10d4,_0x3161d9){_0x1a10d4=_0x1a10d4-0x0;var _0x5d0cec=_0x8679[_0x1a10d4];return _0x5d0cec;};'use strict';var EventEmitter=require(_0x9867('0x0'));var OpenchannelQueue=require(_0x9867('0x1'))['db'][_0x9867('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9867('0x3'),'afterDestroy':_0x9867('0x4')};function emitEvent(_0x378673){return function(_0x576806,_0x22a804,_0x496413){OpenchannelQueueEvents[_0x9867('0x5')](_0x378673+':'+_0x576806['id'],_0x576806);OpenchannelQueueEvents[_0x9867('0x5')](_0x378673,_0x576806);_0x496413(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x9867('0x6')](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 2ab53ad..9f7b95c 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 _0xd4a0=['OpenchannelQueue','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define'];(function(_0x5afff6,_0x3c2363){var _0x39adb1=function(_0x3768ef){while(--_0x3768ef){_0x5afff6['push'](_0x5afff6['shift']());}};_0x39adb1(++_0x3c2363);}(_0xd4a0,0x187));var _0x0d4a=function(_0x1122d7,_0x457e55){_0x1122d7=_0x1122d7-0x0;var _0x239667=_0xd4a0[_0x1122d7];return _0x239667;};'use strict';var _=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var logger=require(_0x0d4a('0x2'))(_0x0d4a('0x3'));var moment=require('moment');var BPromise=require(_0x0d4a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d4a('0x5'));var rimraf=require('rimraf');var config=require(_0x0d4a('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x0d4a('0x7')]=function(_0x41102a,_0x23cc89){return _0x41102a[_0x0d4a('0x8')](_0x0d4a('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe678=['api','moment','bluebird','request-promise','path','rimraf','exports','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x40eb1c,_0x5bbf43){var _0x15ec71=function(_0x373526){while(--_0x373526){_0x40eb1c['push'](_0x40eb1c['shift']());}};_0x15ec71(++_0x5bbf43);}(_0xe678,0x95));var _0x8e67=function(_0x314d34,_0x2fdffa){_0x314d34=_0x314d34-0x0;var _0x32dc0f=_0xe678[_0x314d34];return _0x32dc0f;};'use strict';var _=require(_0x8e67('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8e67('0x1'));var moment=require(_0x8e67('0x2'));var BPromise=require(_0x8e67('0x3'));var rp=require(_0x8e67('0x4'));var fs=require('fs');var path=require(_0x8e67('0x5'));var rimraf=require(_0x8e67('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x8e67('0x7')]=function(_0x57fac8,_0x347d40){return _0x57fac8['define'](_0x8e67('0x8'),attributes,{'tableName':_0x8e67('0x9'),'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 af8fac8..cb5edd5 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 _0xdc72=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','model','ShowOpenchannelQueue','map','then','util','moment','bluebird'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xdc72,0x165));var _0x2dc7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdc72[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x2dc7('0x0'));var moment=require(_0x2dc7('0x1'));var BPromise=require(_0x2dc7('0x2'));var rs=require(_0x2dc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2dc7('0x4'));var logger=require('../../config/logger')(_0x2dc7('0x5'));var config=require(_0x2dc7('0x6'));var jayson=require(_0x2dc7('0x7'));var client=jayson['client'][_0x2dc7('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2dc7('0x9')],{'host':_0x2dc7('0xa'),'port':0x18eb});var socket=require(_0x2dc7('0xb'))(new Redis(config[_0x2dc7('0x9')]));require(_0x2dc7('0xc'))['register'](socket);function respondWithRpcPromise(_0x9a6981,_0x20133a,_0x3ca24c){return new BPromise(function(_0x1de03c,_0x3df1b1){return client[_0x2dc7('0xd')](_0x9a6981,_0x3ca24c)['then'](function(_0x26cadc){logger[_0x2dc7('0xe')](_0x2dc7('0xf'),_0x20133a,_0x2dc7('0x10'));logger[_0x2dc7('0x11')](_0x2dc7('0x12'),_0x20133a,_0x2dc7('0x10'),JSON[_0x2dc7('0x13')](_0x26cadc));if(_0x26cadc['error']){if(_0x26cadc['error']['code']===0x1f4){logger[_0x2dc7('0x14')](_0x2dc7('0xf'),_0x20133a,_0x26cadc[_0x2dc7('0x14')][_0x2dc7('0x15')]);return _0x3df1b1(_0x26cadc['error'][_0x2dc7('0x15')]);}logger[_0x2dc7('0x14')](_0x2dc7('0xf'),_0x20133a,_0x26cadc[_0x2dc7('0x14')]['message']);return _0x1de03c(_0x26cadc[_0x2dc7('0x14')][_0x2dc7('0x15')]);}else{logger[_0x2dc7('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x20133a,_0x2dc7('0x10'));_0x1de03c(_0x26cadc[_0x2dc7('0x16')]['message']);}})[_0x2dc7('0x17')](function(_0x4fc42c){logger[_0x2dc7('0x14')](_0x2dc7('0xf'),_0x20133a,_0x4fc42c);_0x3df1b1(_0x4fc42c);});});}exports[_0x2dc7('0x18')]=function(_0x3f2da0){var _0x4fb5bd=this;return new Promise(function(_0x5c5f39,_0x16be37){return db[_0x2dc7('0x19')]['findAll']({'raw':_0x3f2da0[_0x2dc7('0x1a')]?_0x3f2da0[_0x2dc7('0x1a')][_0x2dc7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f2da0['options']?_0x3f2da0[_0x2dc7('0x1a')][_0x2dc7('0x1c')]||null:null,'attributes':_0x3f2da0[_0x2dc7('0x1a')]?_0x3f2da0[_0x2dc7('0x1a')][_0x2dc7('0x1d')]||null:null,'limit':_0x3f2da0[_0x2dc7('0x1a')]?_0x3f2da0[_0x2dc7('0x1a')][_0x2dc7('0x1e')]||null:null,'include':_0x3f2da0['options']?_0x3f2da0[_0x2dc7('0x1a')][_0x2dc7('0x1f')]?_['map'](_0x3f2da0[_0x2dc7('0x1a')][_0x2dc7('0x1f')],function(_0x223202){return{'model':db[_0x223202[_0x2dc7('0x20')]],'as':_0x223202['as'],'attributes':_0x223202['attributes'],'include':_0x223202[_0x2dc7('0x1f')]?_['map'](_0x223202[_0x2dc7('0x1f')],function(_0x32c090){return{'model':db[_0x32c090[_0x2dc7('0x20')]],'as':_0x32c090['as'],'attributes':_0x32c090['attributes'],'include':_0x32c090[_0x2dc7('0x1f')]?_['map'](_0x32c090[_0x2dc7('0x1f')],function(_0x14e406){return{'model':db[_0x14e406[_0x2dc7('0x20')]],'as':_0x14e406['as'],'attributes':_0x14e406['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43f3ff){logger[_0x2dc7('0xe')](_0x2dc7('0x18'),_0x3f2da0);logger[_0x2dc7('0x11')]('GetOpenchannelQueue',_0x3f2da0,JSON[_0x2dc7('0x13')](_0x43f3ff));_0x5c5f39(_0x43f3ff);})[_0x2dc7('0x17')](function(_0x38d282){logger[_0x2dc7('0x14')](_0x2dc7('0x18'),_0x38d282[_0x2dc7('0x15')],_0x3f2da0);_0x16be37(_0x4fb5bd[_0x2dc7('0x14')](0x1f4,_0x38d282[_0x2dc7('0x15')]));});});};exports[_0x2dc7('0x21')]=function(_0x379bcf){var _0x427990=this;return new Promise(function(_0xa0cb1d,_0x896b39){return db[_0x2dc7('0x19')]['find']({'raw':_0x379bcf[_0x2dc7('0x1a')]?_0x379bcf[_0x2dc7('0x1a')][_0x2dc7('0x1b')]===undefined?!![]:![]:!![],'where':_0x379bcf[_0x2dc7('0x1a')]?_0x379bcf[_0x2dc7('0x1a')][_0x2dc7('0x1c')]||null:null,'attributes':_0x379bcf[_0x2dc7('0x1a')]?_0x379bcf[_0x2dc7('0x1a')][_0x2dc7('0x1d')]||null:null,'include':_0x379bcf[_0x2dc7('0x1a')]?_0x379bcf[_0x2dc7('0x1a')][_0x2dc7('0x1f')]?_[_0x2dc7('0x22')](_0x379bcf[_0x2dc7('0x1a')]['include'],function(_0x177498){return{'model':db[_0x177498[_0x2dc7('0x20')]],'as':_0x177498['as'],'attributes':_0x177498[_0x2dc7('0x1d')],'include':_0x177498[_0x2dc7('0x1f')]?_[_0x2dc7('0x22')](_0x177498[_0x2dc7('0x1f')],function(_0x20a5f4){return{'model':db[_0x20a5f4['model']],'as':_0x20a5f4['as'],'attributes':_0x20a5f4[_0x2dc7('0x1d')],'include':_0x20a5f4[_0x2dc7('0x1f')]?_[_0x2dc7('0x22')](_0x20a5f4[_0x2dc7('0x1f')],function(_0x158dce){return{'model':db[_0x158dce[_0x2dc7('0x20')]],'as':_0x158dce['as'],'attributes':_0x158dce[_0x2dc7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2dc7('0x23')](function(_0x130db5){logger[_0x2dc7('0xe')](_0x2dc7('0x21'),_0x379bcf);logger[_0x2dc7('0x11')]('ShowOpenchannelQueue',_0x379bcf,JSON[_0x2dc7('0x13')](_0x130db5));_0xa0cb1d(_0x130db5);})[_0x2dc7('0x17')](function(_0x197ccf){logger[_0x2dc7('0x14')](_0x2dc7('0x21'),_0x197ccf['message'],_0x379bcf);_0x896b39(_0x427990[_0x2dc7('0x14')](0x1f4,_0x197ccf['message']));});});}; \ No newline at end of file +var _0x6cff=['limit','include','map','model','then','GetOpenchannelQueue','find','ShowOpenchannelQueue','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','OpenchannelQueue,\x20%s,\x20%s','message','OpenchannelQueue','findAll','options','raw','where','attributes'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x6cff,0x149));var _0xf6cf=function(_0x4a79fd,_0x429333){_0x4a79fd=_0x4a79fd-0x0;var _0xef2f88=_0x6cff[_0x4a79fd];return _0xef2f88;};'use strict';var _=require(_0xf6cf('0x0'));var util=require(_0xf6cf('0x1'));var moment=require(_0xf6cf('0x2'));var BPromise=require(_0xf6cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6cf('0x4'));var db=require(_0xf6cf('0x5'))['db'];var utils=require(_0xf6cf('0x6'));var logger=require('../../config/logger')(_0xf6cf('0x7'));var config=require(_0xf6cf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf6cf('0x9')][_0xf6cf('0xa')]({'port':0x232a});config['redis']=_[_0xf6cf('0xb')](config[_0xf6cf('0xc')],{'host':_0xf6cf('0xd'),'port':0x18eb});var socket=require(_0xf6cf('0xe'))(new Redis(config[_0xf6cf('0xc')]));require(_0xf6cf('0xf'))[_0xf6cf('0x10')](socket);function respondWithRpcPromise(_0x2b6ea5,_0x5c4071,_0x4ec7ab){return new BPromise(function(_0x2e9799,_0x955ea9){return client[_0xf6cf('0x11')](_0x2b6ea5,_0x4ec7ab)['then'](function(_0x2dbc13){logger[_0xf6cf('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x5c4071,_0xf6cf('0x13'));logger[_0xf6cf('0x14')](_0xf6cf('0x15'),_0x5c4071,'request\x20sent',JSON['stringify'](_0x2dbc13));if(_0x2dbc13[_0xf6cf('0x16')]){if(_0x2dbc13[_0xf6cf('0x16')]['code']===0x1f4){logger[_0xf6cf('0x16')](_0xf6cf('0x17'),_0x5c4071,_0x2dbc13[_0xf6cf('0x16')][_0xf6cf('0x18')]);return _0x955ea9(_0x2dbc13['error'][_0xf6cf('0x18')]);}logger[_0xf6cf('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x5c4071,_0x2dbc13[_0xf6cf('0x16')][_0xf6cf('0x18')]);return _0x2e9799(_0x2dbc13[_0xf6cf('0x16')][_0xf6cf('0x18')]);}else{logger[_0xf6cf('0x12')](_0xf6cf('0x17'),_0x5c4071,'request\x20sent');_0x2e9799(_0x2dbc13['result']['message']);}})['catch'](function(_0x37183d){logger[_0xf6cf('0x16')](_0xf6cf('0x17'),_0x5c4071,_0x37183d);_0x955ea9(_0x37183d);});});}exports['GetOpenchannelQueue']=function(_0x481025){var _0x520ff8=this;return new Promise(function(_0x4664c2,_0x5664d5){return db[_0xf6cf('0x19')][_0xf6cf('0x1a')]({'raw':_0x481025[_0xf6cf('0x1b')]?_0x481025['options'][_0xf6cf('0x1c')]===undefined?!![]:![]:!![],'where':_0x481025[_0xf6cf('0x1b')]?_0x481025['options'][_0xf6cf('0x1d')]||null:null,'attributes':_0x481025[_0xf6cf('0x1b')]?_0x481025[_0xf6cf('0x1b')][_0xf6cf('0x1e')]||null:null,'limit':_0x481025[_0xf6cf('0x1b')]?_0x481025[_0xf6cf('0x1b')][_0xf6cf('0x1f')]||null:null,'include':_0x481025['options']?_0x481025[_0xf6cf('0x1b')][_0xf6cf('0x20')]?_[_0xf6cf('0x21')](_0x481025[_0xf6cf('0x1b')][_0xf6cf('0x20')],function(_0x8d0c99){return{'model':db[_0x8d0c99[_0xf6cf('0x22')]],'as':_0x8d0c99['as'],'attributes':_0x8d0c99[_0xf6cf('0x1e')],'include':_0x8d0c99[_0xf6cf('0x20')]?_[_0xf6cf('0x21')](_0x8d0c99[_0xf6cf('0x20')],function(_0x31ef5b){return{'model':db[_0x31ef5b[_0xf6cf('0x22')]],'as':_0x31ef5b['as'],'attributes':_0x31ef5b['attributes'],'include':_0x31ef5b[_0xf6cf('0x20')]?_[_0xf6cf('0x21')](_0x31ef5b[_0xf6cf('0x20')],function(_0x54f3d6){return{'model':db[_0x54f3d6[_0xf6cf('0x22')]],'as':_0x54f3d6['as'],'attributes':_0x54f3d6[_0xf6cf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf6cf('0x23')](function(_0x41f406){logger[_0xf6cf('0x12')](_0xf6cf('0x24'),_0x481025);logger[_0xf6cf('0x14')](_0xf6cf('0x24'),_0x481025,JSON['stringify'](_0x41f406));_0x4664c2(_0x41f406);})['catch'](function(_0x14ec42){logger[_0xf6cf('0x16')]('GetOpenchannelQueue',_0x14ec42[_0xf6cf('0x18')],_0x481025);_0x5664d5(_0x520ff8[_0xf6cf('0x16')](0x1f4,_0x14ec42[_0xf6cf('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0xa5868d){var _0x148205=this;return new Promise(function(_0x396376,_0x544b8f){return db['OpenchannelQueue'][_0xf6cf('0x25')]({'raw':_0xa5868d[_0xf6cf('0x1b')]?_0xa5868d[_0xf6cf('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xa5868d[_0xf6cf('0x1b')]?_0xa5868d[_0xf6cf('0x1b')][_0xf6cf('0x1d')]||null:null,'attributes':_0xa5868d['options']?_0xa5868d[_0xf6cf('0x1b')][_0xf6cf('0x1e')]||null:null,'include':_0xa5868d[_0xf6cf('0x1b')]?_0xa5868d[_0xf6cf('0x1b')]['include']?_[_0xf6cf('0x21')](_0xa5868d[_0xf6cf('0x1b')][_0xf6cf('0x20')],function(_0x5789ba){return{'model':db[_0x5789ba['model']],'as':_0x5789ba['as'],'attributes':_0x5789ba[_0xf6cf('0x1e')],'include':_0x5789ba[_0xf6cf('0x20')]?_[_0xf6cf('0x21')](_0x5789ba['include'],function(_0x3d8a50){return{'model':db[_0x3d8a50['model']],'as':_0x3d8a50['as'],'attributes':_0x3d8a50[_0xf6cf('0x1e')],'include':_0x3d8a50[_0xf6cf('0x20')]?_[_0xf6cf('0x21')](_0x3d8a50['include'],function(_0x192a18){return{'model':db[_0x192a18[_0xf6cf('0x22')]],'as':_0x192a18['as'],'attributes':_0x192a18[_0xf6cf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf6cf('0x23')](function(_0xe5360c){logger[_0xf6cf('0x12')](_0xf6cf('0x26'),_0xa5868d);logger[_0xf6cf('0x14')]('ShowOpenchannelQueue',_0xa5868d,JSON[_0xf6cf('0x27')](_0xe5360c));_0x396376(_0xe5360c);})['catch'](function(_0x4d2561){logger[_0xf6cf('0x16')](_0xf6cf('0x26'),_0x4d2561[_0xf6cf('0x18')],_0xa5868d);_0x544b8f(_0x148205[_0xf6cf('0x16')](0x1f4,_0x4d2561['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index fa6f952..e097199 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 _0x4dce=['remove','update','emit','removeListener','register','save'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x4dce,0xf5));var _0xe4dc=function(_0x1e8bea,_0x47bde9){_0x1e8bea=_0x1e8bea-0x0;var _0x29f756=_0x4dce[_0x1e8bea];return _0x29f756;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xe4dc('0x0'),_0xe4dc('0x1'),_0xe4dc('0x2')];function createListener(_0x6b7a57,_0x37825d){return function(_0x35c52a){_0x37825d[_0xe4dc('0x3')](_0x6b7a57,_0x35c52a);};}function removeListener(_0x1dd58d,_0x37b5f9){return function(){OpenchannelQueueEvents[_0xe4dc('0x4')](_0x1dd58d,_0x37b5f9);};}exports[_0xe4dc('0x5')]=function(_0xbc670e){for(var _0x3fa0ee=0x0,_0x30fb7e=events['length'];_0x3fa0ee<_0x30fb7e;_0x3fa0ee++){var _0x259ed5=events[_0x3fa0ee];var _0x480d3b=createListener('openchannelQueue:'+_0x259ed5,_0xbc670e);OpenchannelQueueEvents['on'](_0x259ed5,_0x480d3b);}}; \ No newline at end of file +var _0x9505=['length','openchannelQueue:','save','remove','emit','removeListener'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0x9505,0x170));var _0x5950=function(_0x454a70,_0xdeb2e9){_0x454a70=_0x454a70-0x0;var _0x5702e2=_0x9505[_0x454a70];return _0x5702e2;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x5950('0x0'),_0x5950('0x1'),'update'];function createListener(_0xf104f1,_0x41add1){return function(_0x40b1a5){_0x41add1[_0x5950('0x2')](_0xf104f1,_0x40b1a5);};}function removeListener(_0x354677,_0x5507d8){return function(){OpenchannelQueueEvents[_0x5950('0x3')](_0x354677,_0x5507d8);};}exports['register']=function(_0x3b2ec4){for(var _0x4e6489=0x0,_0x439f93=events[_0x5950('0x4')];_0x4e6489<_0x439f93;_0x4e6489++){var _0x26255d=events[_0x4e6489];var _0x16a5a5=createListener(_0x5950('0x5')+_0x26255d,_0x3b2ec4);OpenchannelQueueEvents['on'](_0x26255d,_0x16a5a5);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d38b3e2..6824970 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 _0x780e=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x780e,0xc7));var _0xe780=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x780e[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xe780('0x0'));var util=require('util');var path=require(_0xe780('0x1'));var timeout=require(_0xe780('0x2'));var express=require('express');var router=express[_0xe780('0x3')]();var fs_extra=require(_0xe780('0x4'));var auth=require(_0xe780('0x5'));var interaction=require(_0xe780('0x6'));var config=require('../../config/environment');var controller=require(_0xe780('0x7'));router[_0xe780('0x8')]('/',auth[_0xe780('0x9')](),controller[_0xe780('0xa')]);router[_0xe780('0x8')]('/describe',auth[_0xe780('0x9')](),controller['describe']);router[_0xe780('0x8')](_0xe780('0xb'),auth[_0xe780('0x9')](),controller[_0xe780('0xc')]);router['post']('/',auth[_0xe780('0x9')](),controller['create']);router[_0xe780('0xd')](_0xe780('0xb'),auth[_0xe780('0x9')](),controller[_0xe780('0xe')]);router[_0xe780('0xf')](_0xe780('0xb'),auth[_0xe780('0x9')](),controller[_0xe780('0x10')]);module[_0xe780('0x11')]=router; \ No newline at end of file +var _0xc693=['delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xc693,0xd2));var _0x3c69=function(_0x439b65,_0x2d3d0e){_0x439b65=_0x439b65-0x0;var _0x29ab2c=_0xc693[_0x439b65];return _0x29ab2c;};'use strict';var multer=require(_0x3c69('0x0'));var util=require('util');var path=require(_0x3c69('0x1'));var timeout=require(_0x3c69('0x2'));var express=require(_0x3c69('0x3'));var router=express[_0x3c69('0x4')]();var fs_extra=require(_0x3c69('0x5'));var auth=require(_0x3c69('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c69('0x7'));router[_0x3c69('0x8')]('/',auth[_0x3c69('0x9')](),controller[_0x3c69('0xa')]);router[_0x3c69('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x3c69('0xb')]);router[_0x3c69('0x8')](_0x3c69('0xc'),auth['isAuthenticated'](),controller[_0x3c69('0xd')]);router[_0x3c69('0xe')]('/',auth[_0x3c69('0x9')](),controller[_0x3c69('0xf')]);router[_0x3c69('0x10')](_0x3c69('0xc'),auth[_0x3c69('0x9')](),controller[_0x3c69('0x11')]);router[_0x3c69('0x12')](_0x3c69('0xc'),auth[_0x3c69('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 14bd3e9..d3a007b 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 _0x82ad=['DATE','moment','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82ad,0x133));var _0xd82a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82ad[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xd82a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd82a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd82a('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd82a('0x2')]},'exitAt':{'type':Sequelize[_0xd82a('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x782d=['DATE','moment','sequelize','exports','STRING'];(function(_0x1f3bfb,_0x2db1b1){var _0xb87807=function(_0x408d65){while(--_0x408d65){_0x1f3bfb['push'](_0x1f3bfb['shift']());}};_0xb87807(++_0x2db1b1);}(_0x782d,0xa1));var _0xd782=function(_0x1a1f1c,_0x2d5f60){_0x1a1f1c=_0x1a1f1c-0x0;var _0x501b1c=_0x782d[_0x1a1f1c];return _0x501b1c;};'use strict';var moment=require(_0xd782('0x0'));var Sequelize=require(_0xd782('0x1'));module[_0xd782('0x2')]={'uniqueid':{'type':Sequelize[_0xd782('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd782('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd782('0x4')]},'exitAt':{'type':Sequelize[_0xd782('0x4')]},'reason':{'type':Sequelize[_0xd782('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f613b38..95893f7 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 _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','OpenchannelQueueReport','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x897b6f,_0x366557){var _0x2ecba3=function(_0x28b8a0){while(--_0x28b8a0){_0x897b6f['push'](_0x897b6f['shift']());}};_0x2ecba3(++_0x366557);}(_0x4975,0x86));var _0x5497=function(_0x157c22,_0xb8133a){_0x157c22=_0x157c22-0x0;var _0x3fbbea=_0x4975[_0x157c22];return _0x3fbbea;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['OpenchannelQueueReport'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['OpenchannelQueueReport'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file +var _0x1261=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','OpenchannelQueueReport','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x255c0a,_0x10c850){var _0x249c98=function(_0x1f6966){while(--_0x1f6966){_0x255c0a['push'](_0x255c0a['shift']());}};_0x249c98(++_0x10c850);}(_0x1261,0x144));var _0x1126=function(_0x5962b4,_0x84be73){_0x5962b4=_0x5962b4-0x0;var _0xe6443c=_0x1261[_0x5962b4];return _0xe6443c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['OpenchannelQueueReport'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['OpenchannelQueueReport']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));};exports[_0x1126('0x45')]=function(_0x52a9a4,_0x3cb44c){return db[_0x1126('0x29')][_0x1126('0x45')]()[_0x1126('0x25')](respondWithResult(_0x3cb44c,null))['catch'](handleError(_0x3cb44c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 951e5e8..d9b3abe 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 _0xf097=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelQueueReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf097,0x1b2));var _0x7f09=function(_0x15d748,_0x4bd8de){_0x15d748=_0x15d748-0x0;var _0x57ec7f=_0xf097[_0x15d748];return _0x57ec7f;};'use strict';var _=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var logger=require(_0x7f09('0x2'))(_0x7f09('0x3'));var moment=require(_0x7f09('0x4'));var BPromise=require(_0x7f09('0x5'));var rp=require(_0x7f09('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7f09('0x7'));module[_0x7f09('0x8')]=function(_0x3afb02,_0x44ef71){return _0x3afb02[_0x7f09('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0x7f09('0xa'),'paranoid':![],'indexes':[{'name':_0x7f09('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0bde=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe0bd('0x0'));var util=require('util');var logger=require(_0xe0bd('0x1'))(_0xe0bd('0x2'));var moment=require('moment');var BPromise=require(_0xe0bd('0x3'));var rp=require(_0xe0bd('0x4'));var fs=require('fs');var path=require(_0xe0bd('0x5'));var rimraf=require('rimraf');var config=require(_0xe0bd('0x6'));var attributes=require(_0xe0bd('0x7'));module[_0xe0bd('0x8')]=function(_0x3a3cd2,_0x37289f){return _0x3a3cd2[_0xe0bd('0x9')](_0xe0bd('0xa'),attributes,{'tableName':_0xe0bd('0xb'),'paranoid':![],'indexes':[{'name':_0xe0bd('0xc'),'fields':[_0xe0bd('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 5742de6..046bd83 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 _0xab7b=['client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','debug','stringify','UpdateOpenchannelQueueReport','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x11ecd4,_0x377795){var _0x58b0d4=function(_0x36e4f6){while(--_0x36e4f6){_0x11ecd4['push'](_0x11ecd4['shift']());}};_0x58b0d4(++_0x377795);}(_0xab7b,0x137));var _0xbab7=function(_0x4d579b,_0x2327f3){_0x4d579b=_0x4d579b-0x0;var _0x288145=_0xab7b[_0x4d579b];return _0x288145;};'use strict';var _=require(_0xbab7('0x0'));var util=require('util');var moment=require(_0xbab7('0x1'));var BPromise=require(_0xbab7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbab7('0x3'));var db=require(_0xbab7('0x4'))['db'];var utils=require(_0xbab7('0x5'));var logger=require(_0xbab7('0x6'))(_0xbab7('0x7'));var config=require('../../config/environment');var jayson=require(_0xbab7('0x8'));var client=jayson[_0xbab7('0x9')][_0xbab7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x899dbf,_0x152a4a,_0x2d6968){return new BPromise(function(_0x752f4c,_0x2e4027){return client[_0xbab7('0xb')](_0x899dbf,_0x2d6968)['then'](function(_0xd225c3){logger[_0xbab7('0xc')](_0xbab7('0xd'),_0x152a4a,_0xbab7('0xe'));logger['debug'](_0xbab7('0xf'),_0x152a4a,_0xbab7('0xe'),JSON['stringify'](_0xd225c3));if(_0xd225c3['error']){if(_0xd225c3[_0xbab7('0x10')]['code']===0x1f4){logger[_0xbab7('0x10')](_0xbab7('0xd'),_0x152a4a,_0xd225c3[_0xbab7('0x10')][_0xbab7('0x11')]);return _0x2e4027(_0xd225c3[_0xbab7('0x10')][_0xbab7('0x11')]);}logger[_0xbab7('0x10')](_0xbab7('0xd'),_0x152a4a,_0xd225c3[_0xbab7('0x10')][_0xbab7('0x11')]);return _0x752f4c(_0xd225c3['error'][_0xbab7('0x11')]);}else{logger[_0xbab7('0xc')](_0xbab7('0xd'),_0x152a4a,_0xbab7('0xe'));_0x752f4c(_0xd225c3[_0xbab7('0x12')][_0xbab7('0x11')]);}})[_0xbab7('0x13')](function(_0x2362cc){logger[_0xbab7('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x152a4a,_0x2362cc);_0x2e4027(_0x2362cc);});});}exports['CreateOpenchannelQueueReport']=function(_0x35809e){var _0x490d16=this;return new Promise(function(_0x39decc,_0x740c62){return db[_0xbab7('0x14')][_0xbab7('0x15')](_0x35809e[_0xbab7('0x16')],{'raw':_0x35809e['options']?_0x35809e[_0xbab7('0x17')][_0xbab7('0x18')]===undefined?!![]:![]:!![]})[_0xbab7('0x19')](function(_0xc7e4cd){logger['info'](_0xbab7('0x1a'),_0x35809e);logger[_0xbab7('0x1b')](_0xbab7('0x1a'),_0x35809e,JSON[_0xbab7('0x1c')](_0xc7e4cd));_0x39decc(_0xc7e4cd);})['catch'](function(_0xa18fc1){logger[_0xbab7('0x10')](_0xbab7('0x1a'),_0xa18fc1[_0xbab7('0x11')],_0x35809e);_0x740c62(_0x490d16[_0xbab7('0x10')](0x1f4,_0xa18fc1['message']));});});};exports[_0xbab7('0x1d')]=function(_0x32a1fa){var _0x3397aa=this;return new Promise(function(_0x57ba35,_0x36af97){return db[_0xbab7('0x14')]['update'](_0x32a1fa[_0xbab7('0x16')],{'raw':_0x32a1fa[_0xbab7('0x17')]?_0x32a1fa[_0xbab7('0x17')][_0xbab7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32a1fa[_0xbab7('0x17')]?_0x32a1fa[_0xbab7('0x17')][_0xbab7('0x1e')]||null:null,'attributes':_0x32a1fa[_0xbab7('0x17')]?_0x32a1fa[_0xbab7('0x17')]['attributes']||null:null,'limit':_0x32a1fa[_0xbab7('0x17')]?_0x32a1fa[_0xbab7('0x17')][_0xbab7('0x1f')]||null:null})[_0xbab7('0x19')](function(_0x1d77ca){logger['info'](_0xbab7('0x1d'),_0x32a1fa);logger['debug'](_0xbab7('0x1d'),_0x32a1fa,JSON[_0xbab7('0x1c')](_0x1d77ca));_0x57ba35(_0x1d77ca);})[_0xbab7('0x13')](function(_0x1ae1fa){logger[_0xbab7('0x10')](_0xbab7('0x1d'),_0x1ae1fa[_0xbab7('0x11')],_0x32a1fa);_0x36af97(_0x3397aa[_0xbab7('0x10')](0x1f4,_0x1ae1fa[_0xbab7('0x11')]));});});}; \ No newline at end of file +var _0xaf22=['stringify','error','code','message','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x404188,_0x409ffa){var _0x5b4635=function(_0x50037c){while(--_0x50037c){_0x404188['push'](_0x404188['shift']());}};_0x5b4635(++_0x409ffa);}(_0xaf22,0xe6));var _0x2af2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xaf22[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2af2('0x0'));var util=require(_0x2af2('0x1'));var moment=require(_0x2af2('0x2'));var BPromise=require(_0x2af2('0x3'));var rs=require(_0x2af2('0x4'));var fs=require('fs');var Redis=require(_0x2af2('0x5'));var db=require(_0x2af2('0x6'))['db'];var utils=require(_0x2af2('0x7'));var logger=require(_0x2af2('0x8'))(_0x2af2('0x9'));var config=require('../../config/environment');var jayson=require(_0x2af2('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20f0db,_0x51d41c,_0x2ec21f){return new BPromise(function(_0x100c29,_0x56d0d7){return client[_0x2af2('0xb')](_0x20f0db,_0x2ec21f)[_0x2af2('0xc')](function(_0x519810){logger[_0x2af2('0xd')](_0x2af2('0xe'),_0x51d41c,_0x2af2('0xf'));logger[_0x2af2('0x10')](_0x2af2('0x11'),_0x51d41c,_0x2af2('0xf'),JSON[_0x2af2('0x12')](_0x519810));if(_0x519810[_0x2af2('0x13')]){if(_0x519810[_0x2af2('0x13')][_0x2af2('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x51d41c,_0x519810[_0x2af2('0x13')][_0x2af2('0x15')]);return _0x56d0d7(_0x519810['error'][_0x2af2('0x15')]);}logger[_0x2af2('0x13')](_0x2af2('0xe'),_0x51d41c,_0x519810[_0x2af2('0x13')][_0x2af2('0x15')]);return _0x100c29(_0x519810[_0x2af2('0x13')][_0x2af2('0x15')]);}else{logger[_0x2af2('0xd')](_0x2af2('0xe'),_0x51d41c,_0x2af2('0xf'));_0x100c29(_0x519810['result'][_0x2af2('0x15')]);}})[_0x2af2('0x16')](function(_0x18cd6d){logger['error'](_0x2af2('0xe'),_0x51d41c,_0x18cd6d);_0x56d0d7(_0x18cd6d);});});}exports['CreateOpenchannelQueueReport']=function(_0x34c26a){var _0xcd43ff=this;return new Promise(function(_0xb391e4,_0x11e114){return db[_0x2af2('0x17')][_0x2af2('0x18')](_0x34c26a[_0x2af2('0x19')],{'raw':_0x34c26a['options']?_0x34c26a[_0x2af2('0x1a')][_0x2af2('0x1b')]===undefined?!![]:![]:!![]})[_0x2af2('0xc')](function(_0xeac169){logger[_0x2af2('0xd')](_0x2af2('0x1c'),_0x34c26a);logger['debug'](_0x2af2('0x1c'),_0x34c26a,JSON[_0x2af2('0x12')](_0xeac169));_0xb391e4(_0xeac169);})['catch'](function(_0x651e77){logger[_0x2af2('0x13')](_0x2af2('0x1c'),_0x651e77[_0x2af2('0x15')],_0x34c26a);_0x11e114(_0xcd43ff['error'](0x1f4,_0x651e77[_0x2af2('0x15')]));});});};exports[_0x2af2('0x1d')]=function(_0x5ce3e8){var _0x4d24f2=this;return new Promise(function(_0x24c6f5,_0x945f9e){return db[_0x2af2('0x17')]['update'](_0x5ce3e8[_0x2af2('0x19')],{'raw':_0x5ce3e8[_0x2af2('0x1a')]?_0x5ce3e8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ce3e8[_0x2af2('0x1a')]?_0x5ce3e8[_0x2af2('0x1a')]['where']||null:null,'attributes':_0x5ce3e8[_0x2af2('0x1a')]?_0x5ce3e8['options'][_0x2af2('0x1e')]||null:null,'limit':_0x5ce3e8[_0x2af2('0x1a')]?_0x5ce3e8[_0x2af2('0x1a')]['limit']||null:null})[_0x2af2('0xc')](function(_0xf5ff08){logger[_0x2af2('0xd')]('UpdateOpenchannelQueueReport',_0x5ce3e8);logger[_0x2af2('0x10')]('UpdateOpenchannelQueueReport',_0x5ce3e8,JSON[_0x2af2('0x12')](_0xf5ff08));_0x24c6f5(_0xf5ff08);})[_0x2af2('0x16')](function(_0xd6bf00){logger[_0x2af2('0x13')](_0x2af2('0x1d'),_0xd6bf00[_0x2af2('0x15')],_0x5ce3e8);_0x945f9e(_0x4d24f2['error'](0x1f4,_0xd6bf00[_0x2af2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index df5f23d..dbf23fd 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 _0xb5be=['put','update','delete','destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','index','get','isAuthenticated','describe','/:id','show','post','create'];(function(_0x422856,_0x1afce6){var _0x287566=function(_0x20f3c5){while(--_0x20f3c5){_0x422856['push'](_0x422856['shift']());}};_0x287566(++_0x1afce6);}(_0xb5be,0xca));var _0xeb5b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb5be[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0xeb5b('0x0'));var path=require(_0xeb5b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xeb5b('0x2'));var auth=require(_0xeb5b('0x3'));var interaction=require(_0xeb5b('0x4'));var config=require('../../config/environment');var controller=require(_0xeb5b('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xeb5b('0x6')]);router[_0xeb5b('0x7')]('/describe',auth[_0xeb5b('0x8')](),controller[_0xeb5b('0x9')]);router['get'](_0xeb5b('0xa'),auth[_0xeb5b('0x8')](),controller[_0xeb5b('0xb')]);router[_0xeb5b('0xc')]('/',auth[_0xeb5b('0x8')](),controller[_0xeb5b('0xd')]);router[_0xeb5b('0xe')](_0xeb5b('0xa'),auth[_0xeb5b('0x8')](),controller[_0xeb5b('0xf')]);router[_0xeb5b('0x10')](_0xeb5b('0xa'),auth[_0xeb5b('0x8')](),controller[_0xeb5b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x13d2=['multer','util','express','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x43ac11,_0x428c4f){var _0x5914e2=function(_0x2a6018){while(--_0x2a6018){_0x43ac11['push'](_0x43ac11['shift']());}};_0x5914e2(++_0x428c4f);}(_0x13d2,0x66));var _0x213d=function(_0xa176e8,_0x3dabfe){_0xa176e8=_0xa176e8-0x0;var _0x457b7f=_0x13d2[_0xa176e8];return _0x457b7f;};'use strict';var multer=require(_0x213d('0x0'));var util=require(_0x213d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x213d('0x2'));var router=express['Router']();var fs_extra=require(_0x213d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x213d('0x4'));var controller=require(_0x213d('0x5'));router[_0x213d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x213d('0x6')]('/describe',auth[_0x213d('0x7')](),controller[_0x213d('0x8')]);router['get'](_0x213d('0x9'),auth['isAuthenticated'](),controller[_0x213d('0xa')]);router[_0x213d('0xb')]('/',auth[_0x213d('0x7')](),controller[_0x213d('0xc')]);router[_0x213d('0xd')](_0x213d('0x9'),auth[_0x213d('0x7')](),controller[_0x213d('0xe')]);router[_0x213d('0xf')](_0x213d('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x213d('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 7b37730..5d0b20c 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 _0x6131=['queue','DATE','moment','exports','STRING','ENUM','account','agent'];(function(_0x548179,_0x25d87d){var _0x572514=function(_0x53e274){while(--_0x53e274){_0x548179['push'](_0x548179['shift']());}};_0x572514(++_0x25d87d);}(_0x6131,0x192));var _0x1613=function(_0x5db666,_0x239940){_0x5db666=_0x5db666-0x0;var _0x42d839=_0x6131[_0x5db666];return _0x42d839;};'use strict';var moment=require(_0x1613('0x0'));var Sequelize=require('sequelize');module[_0x1613('0x1')]={'uniqueid':{'type':Sequelize[_0x1613('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1613('0x3')](_0x1613('0x4'),_0x1613('0x5'),_0x1613('0x6')),'allowNull':![],'defaultValue':_0x1613('0x6')},'transferredAt':{'type':Sequelize[_0x1613('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x8561=['account','queue','DATE','sequelize','exports','STRING'];(function(_0x3e03b5,_0x108dac){var _0x2f6e47=function(_0x1148d7){while(--_0x1148d7){_0x3e03b5['push'](_0x3e03b5['shift']());}};_0x2f6e47(++_0x108dac);}(_0x8561,0x11d));var _0x1856=function(_0x222b3f,_0x133be7){_0x222b3f=_0x222b3f-0x0;var _0x20b57a=_0x8561[_0x222b3f];return _0x20b57a;};'use strict';var moment=require('moment');var Sequelize=require(_0x1856('0x0'));module[_0x1856('0x1')]={'uniqueid':{'type':Sequelize[_0x1856('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1856('0x3'),'agent',_0x1856('0x4')),'allowNull':![],'defaultValue':_0x1856('0x4')},'transferredAt':{'type':Sequelize[_0x1856('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5f9c053..e9794c5 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 _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':!![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':!![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 21d4484..239d66c 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 _0xd1f2=['rimraf','../../config/environment','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xd1f2,0x90));var _0x2d1f=function(_0x5b572c,_0x280107){_0x5b572c=_0x5b572c-0x0;var _0x42f553=_0xd1f2[_0x5b572c];return _0x42f553;};'use strict';var _=require(_0x2d1f('0x0'));var util=require(_0x2d1f('0x1'));var logger=require(_0x2d1f('0x2'))(_0x2d1f('0x3'));var moment=require('moment');var BPromise=require(_0x2d1f('0x4'));var rp=require(_0x2d1f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d1f('0x6'));var config=require(_0x2d1f('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x37229d,_0x5ce330){return _0x37229d['define']('OpenchannelTransferReport',attributes,{'tableName':_0x2d1f('0x8'),'paranoid':![],'indexes':[{'name':_0x2d1f('0x9'),'fields':[_0x2d1f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2dab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x3a02fd,_0x46646d){var _0x1b7ad9=function(_0x315d34){while(--_0x315d34){_0x3a02fd['push'](_0x3a02fd['shift']());}};_0x1b7ad9(++_0x46646d);}(_0x2dab,0x1b1));var _0xb2da=function(_0x495cfd,_0x1f3a9e){_0x495cfd=_0x495cfd-0x0;var _0x500509=_0x2dab[_0x495cfd];return _0x500509;};'use strict';var _=require(_0xb2da('0x0'));var util=require(_0xb2da('0x1'));var logger=require('../../config/logger')(_0xb2da('0x2'));var moment=require(_0xb2da('0x3'));var BPromise=require(_0xb2da('0x4'));var rp=require(_0xb2da('0x5'));var fs=require('fs');var path=require(_0xb2da('0x6'));var rimraf=require(_0xb2da('0x7'));var config=require(_0xb2da('0x8'));var attributes=require(_0xb2da('0x9'));module[_0xb2da('0xa')]=function(_0x475bd2,_0x52d30e){return _0x475bd2[_0xb2da('0xb')](_0xb2da('0xc'),attributes,{'tableName':_0xb2da('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb2da('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 5d640bb..c54bb70 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 _0xdd23=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1b594a,_0x3af453){var _0x3a1a93=function(_0x5a1b14){while(--_0x5a1b14){_0x1b594a['push'](_0x1b594a['shift']());}};_0x3a1a93(++_0x3af453);}(_0xdd23,0x109));var _0x3dd2=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xdd23[_0x480bc8];return _0x28c245;};'use strict';var _=require(_0x3dd2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3dd2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dd2('0x2'));var db=require(_0x3dd2('0x3'))['db'];var utils=require(_0x3dd2('0x4'));var logger=require('../../config/logger')(_0x3dd2('0x5'));var config=require(_0x3dd2('0x6'));var jayson=require(_0x3dd2('0x7'));var client=jayson[_0x3dd2('0x8')][_0x3dd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x379c00,_0x5c1cbe,_0x4bd2a6){return new BPromise(function(_0x181da7,_0x3c5af){return client['request'](_0x379c00,_0x4bd2a6)['then'](function(_0x410565){logger[_0x3dd2('0xa')](_0x3dd2('0xb'),_0x5c1cbe,_0x3dd2('0xc'));logger['debug'](_0x3dd2('0xd'),_0x5c1cbe,_0x3dd2('0xc'),JSON[_0x3dd2('0xe')](_0x410565));if(_0x410565['error']){if(_0x410565[_0x3dd2('0xf')][_0x3dd2('0x10')]===0x1f4){logger[_0x3dd2('0xf')](_0x3dd2('0xb'),_0x5c1cbe,_0x410565[_0x3dd2('0xf')][_0x3dd2('0x11')]);return _0x3c5af(_0x410565[_0x3dd2('0xf')][_0x3dd2('0x11')]);}logger[_0x3dd2('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5c1cbe,_0x410565[_0x3dd2('0xf')][_0x3dd2('0x11')]);return _0x181da7(_0x410565[_0x3dd2('0xf')][_0x3dd2('0x11')]);}else{logger[_0x3dd2('0xa')](_0x3dd2('0xb'),_0x5c1cbe,_0x3dd2('0xc'));_0x181da7(_0x410565[_0x3dd2('0x12')][_0x3dd2('0x11')]);}})['catch'](function(_0xc7bd1b){logger['error'](_0x3dd2('0xb'),_0x5c1cbe,_0xc7bd1b);_0x3c5af(_0xc7bd1b);});});} \ No newline at end of file +var _0x1c6e=['error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0x1c6e,0x79));var _0xe1c6=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x1c6e[_0xe4bb3d];return _0xd9e51;};'use strict';var _=require(_0xe1c6('0x0'));var util=require(_0xe1c6('0x1'));var moment=require(_0xe1c6('0x2'));var BPromise=require('bluebird');var rs=require(_0xe1c6('0x3'));var fs=require('fs');var Redis=require(_0xe1c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1c6('0x5'));var logger=require(_0xe1c6('0x6'))(_0xe1c6('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1c6('0x8'));var client=jayson[_0xe1c6('0x9')][_0xe1c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6869a2,_0x43cd49,_0x37c384){return new BPromise(function(_0x8a4ea5,_0x4699be){return client[_0xe1c6('0xb')](_0x6869a2,_0x37c384)[_0xe1c6('0xc')](function(_0x315731){logger[_0xe1c6('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x43cd49,'request\x20sent');logger[_0xe1c6('0xe')](_0xe1c6('0xf'),_0x43cd49,'request\x20sent',JSON[_0xe1c6('0x10')](_0x315731));if(_0x315731[_0xe1c6('0x11')]){if(_0x315731[_0xe1c6('0x11')][_0xe1c6('0x12')]===0x1f4){logger[_0xe1c6('0x11')](_0xe1c6('0x13'),_0x43cd49,_0x315731[_0xe1c6('0x11')][_0xe1c6('0x14')]);return _0x4699be(_0x315731[_0xe1c6('0x11')][_0xe1c6('0x14')]);}logger[_0xe1c6('0x11')](_0xe1c6('0x13'),_0x43cd49,_0x315731['error'][_0xe1c6('0x14')]);return _0x8a4ea5(_0x315731[_0xe1c6('0x11')][_0xe1c6('0x14')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x43cd49,_0xe1c6('0x15'));_0x8a4ea5(_0x315731[_0xe1c6('0x16')][_0xe1c6('0x14')]);}})['catch'](function(_0x33486e){logger[_0xe1c6('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x43cd49,_0x33486e);_0x4699be(_0x33486e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b63cbd6..34d1f29 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 _0xf5e2=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./pause.controller','get','isAuthenticated','show','create'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xf5e2,0x180));var _0x2f5e=function(_0x34be40,_0x3cef31){_0x34be40=_0x34be40-0x0;var _0x30cbbf=_0xf5e2[_0x34be40];return _0x30cbbf;};'use strict';var multer=require(_0x2f5e('0x0'));var util=require('util');var path=require(_0x2f5e('0x1'));var timeout=require(_0x2f5e('0x2'));var express=require(_0x2f5e('0x3'));var router=express[_0x2f5e('0x4')]();var fs_extra=require(_0x2f5e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f5e('0x6'));var controller=require(_0x2f5e('0x7'));router[_0x2f5e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2f5e('0x8')]('/:id',auth[_0x2f5e('0x9')](),controller[_0x2f5e('0xa')]);router['post']('/',auth[_0x2f5e('0x9')](),controller[_0x2f5e('0xb')]);router[_0x2f5e('0xc')](_0x2f5e('0xd'),auth['isAuthenticated'](),controller[_0x2f5e('0xe')]);router[_0x2f5e('0xf')](_0x2f5e('0xd'),auth[_0x2f5e('0x9')](),controller[_0x2f5e('0x10')]);module[_0x2f5e('0x11')]=router; \ No newline at end of file +var _0x9dc1=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x4cfcd7,_0x4493d6){var _0xde614f=function(_0xe7c49d){while(--_0xe7c49d){_0x4cfcd7['push'](_0x4cfcd7['shift']());}};_0xde614f(++_0x4493d6);}(_0x9dc1,0x6c));var _0x19dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dc1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x19dc('0x0'));var util=require(_0x19dc('0x1'));var path=require(_0x19dc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x19dc('0x3')]();var fs_extra=require(_0x19dc('0x4'));var auth=require(_0x19dc('0x5'));var interaction=require(_0x19dc('0x6'));var config=require('../../config/environment');var controller=require(_0x19dc('0x7'));router[_0x19dc('0x8')]('/',auth[_0x19dc('0x9')](),controller['index']);router[_0x19dc('0x8')](_0x19dc('0xa'),auth[_0x19dc('0x9')](),controller[_0x19dc('0xb')]);router[_0x19dc('0xc')]('/',auth[_0x19dc('0x9')](),controller[_0x19dc('0xd')]);router['put'](_0x19dc('0xa'),auth[_0x19dc('0x9')](),controller[_0x19dc('0xe')]);router[_0x19dc('0xf')](_0x19dc('0xa'),auth[_0x19dc('0x9')](),controller[_0x19dc('0x10')]);module[_0x19dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 5b15c75..06b7d89 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 _0x1c0f=['STRING','name','sequelize','exports'];(function(_0x1c3631,_0x70ed6a){var _0x4c000a=function(_0x311571){while(--_0x311571){_0x1c3631['push'](_0x1c3631['shift']());}};_0x4c000a(++_0x70ed6a);}(_0x1c0f,0x66));var _0xf1c0=function(_0x26ebf4,_0x4aa152){_0x26ebf4=_0x26ebf4-0x0;var _0x3a6aa8=_0x1c0f[_0x26ebf4];return _0x3a6aa8;};'use strict';var Sequelize=require(_0xf1c0('0x0'));module[_0xf1c0('0x1')]={'name':{'type':Sequelize[_0xf1c0('0x2')],'unique':_0xf1c0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf1c0('0x2')]}}; \ No newline at end of file +var _0xb30d=['exports','name','sequelize'];(function(_0x6aad10,_0x5736de){var _0x51b089=function(_0x4899bb){while(--_0x4899bb){_0x6aad10['push'](_0x6aad10['shift']());}};_0x51b089(++_0x5736de);}(_0xb30d,0x101));var _0xdb30=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xb30d[_0x382e89];return _0x3a1318;};'use strict';var Sequelize=require(_0xdb30('0x0'));module[_0xdb30('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdb30('0x2'),'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 ffeb920..60a2d87 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 _0x7d02=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','get','error','stack','name','send','index','map','Pause','rawAttributes','query','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filters','merge','type','filter','includeAll','findAll','rows','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3839a7,_0x5af8b0){var _0x3309cd=function(_0x23d913){while(--_0x23d913){_0x3839a7['push'](_0x3839a7['shift']());}};_0x3309cd(++_0x5af8b0);}(_0x7d02,0xd5));var _0x27d0=function(_0x51647a,_0x535687){_0x51647a=_0x51647a-0x0;var _0x1732c3=_0x7d02[_0x51647a];return _0x1732c3;};'use strict';var emlformat=require(_0x27d0('0x0'));var rimraf=require(_0x27d0('0x1'));var zipdir=require(_0x27d0('0x2'));var jsonpatch=require(_0x27d0('0x3'));var rp=require(_0x27d0('0x4'));var moment=require(_0x27d0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x27d0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x27d0('0x7'));var ejs=require(_0x27d0('0x8'));var fs=require('fs');var fs_extra=require(_0x27d0('0x9'));var _=require('lodash');var squel=require(_0x27d0('0xa'));var crypto=require(_0x27d0('0xb'));var jsforce=require(_0x27d0('0xc'));var deskjs=require(_0x27d0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x27d0('0xe'));var Papa=require(_0x27d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x27d0('0x10'));var as=require(_0x27d0('0x11'));var hardwareService=require(_0x27d0('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x27d0('0x13'));var config=require(_0x27d0('0x14'));var licenseUtil=require(_0x27d0('0x15'));var db=require(_0x27d0('0x16'))['db'];function respondWithStatusCode(_0x23581b,_0x5d21da){_0x5d21da=_0x5d21da||0xcc;return function(_0x2ece74){if(_0x2ece74){return _0x23581b[_0x27d0('0x17')](_0x5d21da);}return _0x23581b[_0x27d0('0x18')](_0x5d21da)[_0x27d0('0x19')]();};}function respondWithResult(_0x30aeac,_0x3b8577){_0x3b8577=_0x3b8577||0xc8;return function(_0x2a8d23){if(_0x2a8d23){return _0x30aeac[_0x27d0('0x18')](_0x3b8577)[_0x27d0('0x1a')](_0x2a8d23);}};}function respondWithFilteredResult(_0x2a31f3,_0x4db23a){return function(_0x10b250){if(_0x10b250){var _0x44e295=typeof _0x4db23a[_0x27d0('0x1b')]===_0x27d0('0x1c')&&typeof _0x4db23a[_0x27d0('0x1d')]===_0x27d0('0x1c');var _0xfd38df=_0x10b250[_0x27d0('0x1e')];var _0x508f36=_0x44e295?0x0:_0x4db23a[_0x27d0('0x1b')];var _0x15a7ce=_0x44e295?_0x10b250[_0x27d0('0x1e')]:_0x4db23a[_0x27d0('0x1b')]+_0x4db23a[_0x27d0('0x1d')];var _0x25760c;if(_0x15a7ce>=_0xfd38df){_0x15a7ce=_0xfd38df;_0x25760c=0xc8;}else{_0x25760c=0xce;}_0x2a31f3[_0x27d0('0x18')](_0x25760c);return _0x2a31f3[_0x27d0('0x1f')](_0x27d0('0x20'),_0x508f36+'-'+_0x15a7ce+'/'+_0xfd38df)[_0x27d0('0x1a')](_0x10b250);}return null;};}function patchUpdates(_0x499020){return function(_0x20d1a5){try{jsonpatch['apply'](_0x20d1a5,_0x499020,!![]);}catch(_0x3138d0){return BPromise[_0x27d0('0x21')](_0x3138d0);}return _0x20d1a5['save']();};}function saveUpdates(_0x28dc80,_0x4ed881){return function(_0x1cdf3e){if(_0x1cdf3e){return _0x1cdf3e['update'](_0x28dc80)['then'](function(_0x388afe){return _0x388afe;});}return null;};}function removeEntity(_0x4b273c,_0x17a1ce){return function(_0x5c2908){if(_0x5c2908){return _0x5c2908[_0x27d0('0x22')]()[_0x27d0('0x23')](function(){var _0x136eaa=_0x5c2908[_0x27d0('0x24')]({'plain':!![]});var _0x5ef4db='Pauses';return db['UserProfileResource']['destroy']({'where':{'type':_0x5ef4db,'resourceId':_0x136eaa['id']}})[_0x27d0('0x23')](function(){return _0x5c2908;});})[_0x27d0('0x23')](function(){_0x4b273c[_0x27d0('0x18')](0xcc)[_0x27d0('0x19')]();});}};}function handleEntityNotFound(_0x1e0da1,_0xb4e068){return function(_0x3417b0){if(!_0x3417b0){_0x1e0da1['sendStatus'](0x194);}return _0x3417b0;};}function handleError(_0x2fb399,_0x206082){_0x206082=_0x206082||0x1f4;return function(_0xf1b1cd){logger[_0x27d0('0x25')](_0xf1b1cd[_0x27d0('0x26')]);if(_0xf1b1cd['name']){delete _0xf1b1cd[_0x27d0('0x27')];}_0x2fb399[_0x27d0('0x18')](_0x206082)[_0x27d0('0x28')](_0xf1b1cd);};}exports[_0x27d0('0x29')]=function(_0x22490a,_0x2a2caf){var _0x5c0c8c={},_0xb2aae3={},_0x49f748={'count':0x0,'rows':[]};var _0x3a2e3b=_[_0x27d0('0x2a')](db[_0x27d0('0x2b')][_0x27d0('0x2c')],function(_0x1b235f){return{'name':_0x1b235f['fieldName'],'type':_0x1b235f['type']['key']};});_0xb2aae3['model']=_[_0x27d0('0x2a')](_0x3a2e3b,_0x27d0('0x27'));_0xb2aae3['query']=_['keys'](_0x22490a[_0x27d0('0x2d')]);_0xb2aae3['filters']=_[_0x27d0('0x2e')](_0xb2aae3[_0x27d0('0x2f')],_0xb2aae3[_0x27d0('0x2d')]);_0x5c0c8c['attributes']=_['intersection'](_0xb2aae3[_0x27d0('0x2f')],qs[_0x27d0('0x30')](_0x22490a[_0x27d0('0x2d')][_0x27d0('0x30')]));_0x5c0c8c['attributes']=_0x5c0c8c['attributes'][_0x27d0('0x31')]?_0x5c0c8c[_0x27d0('0x32')]:_0xb2aae3[_0x27d0('0x2f')];if(!_0x22490a[_0x27d0('0x2d')][_0x27d0('0x33')]('nolimit')){_0x5c0c8c[_0x27d0('0x1d')]=qs['limit'](_0x22490a[_0x27d0('0x2d')][_0x27d0('0x1d')]);_0x5c0c8c[_0x27d0('0x1b')]=qs[_0x27d0('0x1b')](_0x22490a[_0x27d0('0x2d')][_0x27d0('0x1b')]);}_0x5c0c8c[_0x27d0('0x34')]=qs[_0x27d0('0x35')](_0x22490a['query'][_0x27d0('0x35')]);_0x5c0c8c[_0x27d0('0x36')]=qs['filters'](_[_0x27d0('0x37')](_0x22490a[_0x27d0('0x2d')],_0xb2aae3[_0x27d0('0x38')]),_0x3a2e3b);if(_0x22490a[_0x27d0('0x2d')]['filter']){_0x5c0c8c[_0x27d0('0x36')]=_[_0x27d0('0x39')](_0x5c0c8c['where'],{'$or':_[_0x27d0('0x2a')](_0x3a2e3b,function(_0x161dde){if(_0x161dde[_0x27d0('0x3a')]!=='VIRTUAL'){var _0x20e7ec={};_0x20e7ec[_0x161dde[_0x27d0('0x27')]]={'$like':'%'+_0x22490a[_0x27d0('0x2d')][_0x27d0('0x3b')]+'%'};return _0x20e7ec;}})});}_0x5c0c8c=_['merge']({},_0x5c0c8c,_0x22490a['options']);var _0x195ddb={'where':_0x5c0c8c[_0x27d0('0x36')]};return db[_0x27d0('0x2b')][_0x27d0('0x1e')](_0x195ddb)[_0x27d0('0x23')](function(_0x3858fc){_0x49f748[_0x27d0('0x1e')]=_0x3858fc;if(_0x22490a[_0x27d0('0x2d')][_0x27d0('0x3c')]){_0x5c0c8c['include']=[{'all':!![]}];}return db[_0x27d0('0x2b')][_0x27d0('0x3d')](_0x5c0c8c);})['then'](function(_0x456153){_0x49f748[_0x27d0('0x3e')]=_0x456153;return _0x49f748;})['then'](respondWithFilteredResult(_0x2a2caf,_0x5c0c8c))[_0x27d0('0x3f')](handleError(_0x2a2caf,null));};exports[_0x27d0('0x40')]=function(_0x2ee0df,_0x5c2939){var _0x3d2199={'raw':!![],'where':{'id':_0x2ee0df[_0x27d0('0x41')]['id']}},_0x139dd9={};_0x139dd9[_0x27d0('0x2f')]=_[_0x27d0('0x42')](db[_0x27d0('0x2b')]['rawAttributes']);_0x139dd9[_0x27d0('0x2d')]=_['keys'](_0x2ee0df[_0x27d0('0x2d')]);_0x139dd9[_0x27d0('0x38')]=_[_0x27d0('0x2e')](_0x139dd9[_0x27d0('0x2f')],_0x139dd9[_0x27d0('0x2d')]);_0x3d2199[_0x27d0('0x32')]=_[_0x27d0('0x2e')](_0x139dd9[_0x27d0('0x2f')],qs[_0x27d0('0x30')](_0x2ee0df[_0x27d0('0x2d')][_0x27d0('0x30')]));_0x3d2199[_0x27d0('0x32')]=_0x3d2199['attributes']['length']?_0x3d2199['attributes']:_0x139dd9[_0x27d0('0x2f')];if(_0x2ee0df['query']['includeAll']){_0x3d2199['include']=[{'all':!![]}];}_0x3d2199=_[_0x27d0('0x39')]({},_0x3d2199,_0x2ee0df[_0x27d0('0x43')]);return db[_0x27d0('0x2b')][_0x27d0('0x44')](_0x3d2199)['then'](handleEntityNotFound(_0x5c2939,null))[_0x27d0('0x23')](respondWithResult(_0x5c2939,null))[_0x27d0('0x3f')](handleError(_0x5c2939,null));};exports[_0x27d0('0x45')]=function(_0x39365b,_0x390e8f){return db['Pause']['create'](_0x39365b['body'],{})[_0x27d0('0x23')](function(_0x41be30){var _0x31564f=_0x39365b[_0x27d0('0x46')][_0x27d0('0x24')]({'plain':!![]});if(!_0x31564f)throw new Error(_0x27d0('0x47'));if(_0x31564f['role']===_0x27d0('0x46')){var _0x1f1c6f=_0x41be30[_0x27d0('0x24')]({'plain':!![]});var _0x18cbc1=_0x27d0('0x48');return db[_0x27d0('0x49')]['find']({'where':{'name':_0x18cbc1,'userProfileId':_0x31564f[_0x27d0('0x4a')]},'raw':!![]})[_0x27d0('0x23')](function(_0xcee827){if(_0xcee827&&_0xcee827[_0x27d0('0x4b')]===0x0){return db[_0x27d0('0x4c')][_0x27d0('0x45')]({'name':_0x1f1c6f[_0x27d0('0x27')],'resourceId':_0x1f1c6f['id'],'type':_0xcee827[_0x27d0('0x27')],'sectionId':_0xcee827['id']},{})[_0x27d0('0x23')](function(){return _0x41be30;});}else{return _0x41be30;}})[_0x27d0('0x3f')](function(_0x4ef9a7){logger[_0x27d0('0x25')](_0x27d0('0x4d'),_0x4ef9a7);throw _0x4ef9a7;});}return _0x41be30;})[_0x27d0('0x23')](respondWithResult(_0x390e8f,0xc9))[_0x27d0('0x3f')](handleError(_0x390e8f,null));};exports['update']=function(_0x505ef1,_0x5b8b25){if(_0x505ef1[_0x27d0('0x4e')]['id']){delete _0x505ef1[_0x27d0('0x4e')]['id'];}return db[_0x27d0('0x2b')]['find']({'where':{'id':_0x505ef1[_0x27d0('0x41')]['id']}})[_0x27d0('0x23')](handleEntityNotFound(_0x5b8b25,null))[_0x27d0('0x23')](saveUpdates(_0x505ef1['body'],null))[_0x27d0('0x23')](respondWithResult(_0x5b8b25,null))[_0x27d0('0x3f')](handleError(_0x5b8b25,null));};exports[_0x27d0('0x22')]=function(_0x1e383d,_0x586a9f){return db[_0x27d0('0x2b')][_0x27d0('0x44')]({'where':{'id':_0x1e383d[_0x27d0('0x41')]['id']}})[_0x27d0('0x23')](handleEntityNotFound(_0x586a9f,null))[_0x27d0('0x23')](removeEntity(_0x586a9f,null))[_0x27d0('0x3f')](handleError(_0x586a9f,null));}; \ No newline at end of file +var _0xe7fd=['catch','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','UserProfileResource','sendStatus','error','name','send','index','Pause','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x23d68e,_0x16d36d){var _0x2bbae1=function(_0x25db66){while(--_0x25db66){_0x23d68e['push'](_0x23d68e['shift']());}};_0x2bbae1(++_0x16d36d);}(_0xe7fd,0xf5));var _0xde7f=function(_0x484b7c,_0x15bc3c){_0x484b7c=_0x484b7c-0x0;var _0xe8105f=_0xe7fd[_0x484b7c];return _0xe8105f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde7f('0x0'));var zipdir=require(_0xde7f('0x1'));var jsonpatch=require(_0xde7f('0x2'));var rp=require(_0xde7f('0x3'));var moment=require('moment');var BPromise=require(_0xde7f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xde7f('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde7f('0x6'));var _=require('lodash');var squel=require(_0xde7f('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xde7f('0x8'));var toCsv=require(_0xde7f('0x9'));var querystring=require(_0xde7f('0xa'));var Papa=require(_0xde7f('0xb'));var Redis=require(_0xde7f('0xc'));var authService=require(_0xde7f('0xd'));var qs=require(_0xde7f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xde7f('0xf'))(_0xde7f('0x10'));var utils=require(_0xde7f('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48f10b,_0x155049){_0x155049=_0x155049||0xcc;return function(_0x59cfba){if(_0x59cfba){return _0x48f10b['sendStatus'](_0x155049);}return _0x48f10b[_0xde7f('0x12')](_0x155049)[_0xde7f('0x13')]();};}function respondWithResult(_0x28e946,_0x430ee2){_0x430ee2=_0x430ee2||0xc8;return function(_0x79d346){if(_0x79d346){return _0x28e946['status'](_0x430ee2)[_0xde7f('0x14')](_0x79d346);}};}function respondWithFilteredResult(_0x4adc23,_0x493b67){return function(_0x4c62ee){if(_0x4c62ee){var _0xcd35c7=typeof _0x493b67[_0xde7f('0x15')]===_0xde7f('0x16')&&typeof _0x493b67[_0xde7f('0x17')]===_0xde7f('0x16');var _0x29439b=_0x4c62ee['count'];var _0x252616=_0xcd35c7?0x0:_0x493b67[_0xde7f('0x15')];var _0x3839d2=_0xcd35c7?_0x4c62ee[_0xde7f('0x18')]:_0x493b67[_0xde7f('0x15')]+_0x493b67[_0xde7f('0x17')];var _0x36381a;if(_0x3839d2>=_0x29439b){_0x3839d2=_0x29439b;_0x36381a=0xc8;}else{_0x36381a=0xce;}_0x4adc23[_0xde7f('0x12')](_0x36381a);return _0x4adc23[_0xde7f('0x19')](_0xde7f('0x1a'),_0x252616+'-'+_0x3839d2+'/'+_0x29439b)['json'](_0x4c62ee);}return null;};}function patchUpdates(_0x4e09a1){return function(_0x12722d){try{jsonpatch[_0xde7f('0x1b')](_0x12722d,_0x4e09a1,!![]);}catch(_0x1affc6){return BPromise['reject'](_0x1affc6);}return _0x12722d[_0xde7f('0x1c')]();};}function saveUpdates(_0x5c7563,_0x5f3de5){return function(_0x5c972a){if(_0x5c972a){return _0x5c972a[_0xde7f('0x1d')](_0x5c7563)['then'](function(_0x3bef07){return _0x3bef07;});}return null;};}function removeEntity(_0x1a8369,_0x2d172b){return function(_0x42aca1){if(_0x42aca1){return _0x42aca1[_0xde7f('0x1e')]()[_0xde7f('0x1f')](function(){var _0x378cc8=_0x42aca1['get']({'plain':!![]});var _0x5c5288='Pauses';return db[_0xde7f('0x20')][_0xde7f('0x1e')]({'where':{'type':_0x5c5288,'resourceId':_0x378cc8['id']}})[_0xde7f('0x1f')](function(){return _0x42aca1;});})['then'](function(){_0x1a8369[_0xde7f('0x12')](0xcc)[_0xde7f('0x13')]();});}};}function handleEntityNotFound(_0x4a0c96,_0x3b1cb9){return function(_0x15231f){if(!_0x15231f){_0x4a0c96[_0xde7f('0x21')](0x194);}return _0x15231f;};}function handleError(_0x4fc04e,_0x33dee6){_0x33dee6=_0x33dee6||0x1f4;return function(_0xe3a66){logger[_0xde7f('0x22')](_0xe3a66['stack']);if(_0xe3a66[_0xde7f('0x23')]){delete _0xe3a66[_0xde7f('0x23')];}_0x4fc04e[_0xde7f('0x12')](_0x33dee6)[_0xde7f('0x24')](_0xe3a66);};}exports[_0xde7f('0x25')]=function(_0x1641d0,_0xca19f4){var _0x3de4f2={},_0x175410={},_0x249e86={'count':0x0,'rows':[]};var _0x117b4a=_['map'](db[_0xde7f('0x26')][_0xde7f('0x27')],function(_0x3b9920){return{'name':_0x3b9920[_0xde7f('0x28')],'type':_0x3b9920[_0xde7f('0x29')][_0xde7f('0x2a')]};});_0x175410['model']=_[_0xde7f('0x2b')](_0x117b4a,_0xde7f('0x23'));_0x175410[_0xde7f('0x2c')]=_[_0xde7f('0x2d')](_0x1641d0[_0xde7f('0x2c')]);_0x175410[_0xde7f('0x2e')]=_['intersection'](_0x175410[_0xde7f('0x2f')],_0x175410['query']);_0x3de4f2[_0xde7f('0x30')]=_[_0xde7f('0x31')](_0x175410[_0xde7f('0x2f')],qs[_0xde7f('0x32')](_0x1641d0['query'][_0xde7f('0x32')]));_0x3de4f2[_0xde7f('0x30')]=_0x3de4f2[_0xde7f('0x30')][_0xde7f('0x33')]?_0x3de4f2['attributes']:_0x175410[_0xde7f('0x2f')];if(!_0x1641d0[_0xde7f('0x2c')][_0xde7f('0x34')](_0xde7f('0x35'))){_0x3de4f2['limit']=qs['limit'](_0x1641d0[_0xde7f('0x2c')][_0xde7f('0x17')]);_0x3de4f2[_0xde7f('0x15')]=qs['offset'](_0x1641d0['query'][_0xde7f('0x15')]);}_0x3de4f2['order']=qs['sort'](_0x1641d0['query']['sort']);_0x3de4f2[_0xde7f('0x36')]=qs['filters'](_[_0xde7f('0x37')](_0x1641d0[_0xde7f('0x2c')],_0x175410['filters']),_0x117b4a);if(_0x1641d0[_0xde7f('0x2c')][_0xde7f('0x38')]){_0x3de4f2[_0xde7f('0x36')]=_['merge'](_0x3de4f2[_0xde7f('0x36')],{'$or':_[_0xde7f('0x2b')](_0x117b4a,function(_0x397b41){if(_0x397b41[_0xde7f('0x29')]!==_0xde7f('0x39')){var _0x4b168b={};_0x4b168b[_0x397b41[_0xde7f('0x23')]]={'$like':'%'+_0x1641d0[_0xde7f('0x2c')][_0xde7f('0x38')]+'%'};return _0x4b168b;}})});}_0x3de4f2=_['merge']({},_0x3de4f2,_0x1641d0[_0xde7f('0x3a')]);var _0x4cb676={'where':_0x3de4f2[_0xde7f('0x36')]};return db[_0xde7f('0x26')]['count'](_0x4cb676)[_0xde7f('0x1f')](function(_0x4de2b4){_0x249e86[_0xde7f('0x18')]=_0x4de2b4;if(_0x1641d0[_0xde7f('0x2c')][_0xde7f('0x3b')]){_0x3de4f2[_0xde7f('0x3c')]=[{'all':!![]}];}return db[_0xde7f('0x26')][_0xde7f('0x3d')](_0x3de4f2);})['then'](function(_0x139923){_0x249e86[_0xde7f('0x3e')]=_0x139923;return _0x249e86;})[_0xde7f('0x1f')](respondWithFilteredResult(_0xca19f4,_0x3de4f2))[_0xde7f('0x3f')](handleError(_0xca19f4,null));};exports['show']=function(_0x8bf9fd,_0x4cb19b){var _0x2bd2ff={'raw':!![],'where':{'id':_0x8bf9fd['params']['id']}},_0x42dac8={};_0x42dac8['model']=_['keys'](db[_0xde7f('0x26')][_0xde7f('0x27')]);_0x42dac8[_0xde7f('0x2c')]=_[_0xde7f('0x2d')](_0x8bf9fd['query']);_0x42dac8[_0xde7f('0x2e')]=_[_0xde7f('0x31')](_0x42dac8[_0xde7f('0x2f')],_0x42dac8[_0xde7f('0x2c')]);_0x2bd2ff[_0xde7f('0x30')]=_[_0xde7f('0x31')](_0x42dac8['model'],qs[_0xde7f('0x32')](_0x8bf9fd[_0xde7f('0x2c')][_0xde7f('0x32')]));_0x2bd2ff[_0xde7f('0x30')]=_0x2bd2ff[_0xde7f('0x30')][_0xde7f('0x33')]?_0x2bd2ff[_0xde7f('0x30')]:_0x42dac8[_0xde7f('0x2f')];if(_0x8bf9fd[_0xde7f('0x2c')][_0xde7f('0x3b')]){_0x2bd2ff[_0xde7f('0x3c')]=[{'all':!![]}];}_0x2bd2ff=_[_0xde7f('0x40')]({},_0x2bd2ff,_0x8bf9fd[_0xde7f('0x3a')]);return db['Pause'][_0xde7f('0x41')](_0x2bd2ff)[_0xde7f('0x1f')](handleEntityNotFound(_0x4cb19b,null))[_0xde7f('0x1f')](respondWithResult(_0x4cb19b,null))['catch'](handleError(_0x4cb19b,null));};exports[_0xde7f('0x42')]=function(_0x8257f0,_0x57bac8){return db[_0xde7f('0x26')][_0xde7f('0x42')](_0x8257f0['body'],{})[_0xde7f('0x1f')](function(_0x413167){var _0x327cf6=_0x8257f0[_0xde7f('0x43')]['get']({'plain':!![]});if(!_0x327cf6)throw new Error(_0xde7f('0x44'));if(_0x327cf6[_0xde7f('0x45')]==='user'){var _0x5efaaf=_0x413167['get']({'plain':!![]});var _0x21f410=_0xde7f('0x46');return db[_0xde7f('0x47')][_0xde7f('0x41')]({'where':{'name':_0x21f410,'userProfileId':_0x327cf6[_0xde7f('0x48')]},'raw':!![]})[_0xde7f('0x1f')](function(_0x4dcc1d){if(_0x4dcc1d&&_0x4dcc1d[_0xde7f('0x49')]===0x0){return db[_0xde7f('0x20')][_0xde7f('0x42')]({'name':_0x5efaaf[_0xde7f('0x23')],'resourceId':_0x5efaaf['id'],'type':_0x4dcc1d[_0xde7f('0x23')],'sectionId':_0x4dcc1d['id']},{})['then'](function(){return _0x413167;});}else{return _0x413167;}})[_0xde7f('0x3f')](function(_0x440840){logger[_0xde7f('0x22')](_0xde7f('0x4a'),_0x440840);throw _0x440840;});}return _0x413167;})['then'](respondWithResult(_0x57bac8,0xc9))[_0xde7f('0x3f')](handleError(_0x57bac8,null));};exports[_0xde7f('0x1d')]=function(_0x5dca7f,_0x18dacb){if(_0x5dca7f[_0xde7f('0x4b')]['id']){delete _0x5dca7f[_0xde7f('0x4b')]['id'];}return db[_0xde7f('0x26')]['find']({'where':{'id':_0x5dca7f['params']['id']}})['then'](handleEntityNotFound(_0x18dacb,null))[_0xde7f('0x1f')](saveUpdates(_0x5dca7f['body'],null))['then'](respondWithResult(_0x18dacb,null))['catch'](handleError(_0x18dacb,null));};exports[_0xde7f('0x1e')]=function(_0x293dc0,_0x5e8411){return db[_0xde7f('0x26')][_0xde7f('0x41')]({'where':{'id':_0x293dc0[_0xde7f('0x4c')]['id']}})[_0xde7f('0x1f')](handleEntityNotFound(_0x5e8411,null))[_0xde7f('0x1f')](removeEntity(_0x5e8411,null))[_0xde7f('0x3f')](handleError(_0x5e8411,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 8713da8..f766491 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 _0x9d5b=['exports','Pause','tools_pauses','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./pause.attributes'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x24ca44,_0x387c3b){_0x24ca44=_0x24ca44-0x0;var _0x23e66f=_0x9d5b[_0x24ca44];return _0x23e66f;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var logger=require(_0xb9d5('0x1'))(_0xb9d5('0x2'));var moment=require(_0xb9d5('0x3'));var BPromise=require(_0xb9d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9d5('0x5'));var rimraf=require('rimraf');var config=require(_0xb9d5('0x6'));var attributes=require(_0xb9d5('0x7'));module[_0xb9d5('0x8')]=function(_0x39d8fe,_0x422a92){return _0x39d8fe['define'](_0xb9d5('0x9'),attributes,{'tableName':_0xb9d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b12=['tools_pauses','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','Pause'];(function(_0x4fb121,_0x36da49){var _0x18550d=function(_0x4be148){while(--_0x4be148){_0x4fb121['push'](_0x4fb121['shift']());}};_0x18550d(++_0x36da49);}(_0x5b12,0xa3));var _0x25b1=function(_0x59e867,_0x3e959a){_0x59e867=_0x59e867-0x0;var _0x4d6ec8=_0x5b12[_0x59e867];return _0x4d6ec8;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var logger=require(_0x25b1('0x2'))('api');var moment=require(_0x25b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x25b1('0x4'));var fs=require('fs');var path=require(_0x25b1('0x5'));var rimraf=require('rimraf');var config=require(_0x25b1('0x6'));var attributes=require('./pause.attributes');module['exports']=function(_0x35d90b,_0x5523c9){return _0x35d90b['define'](_0x25b1('0x7'),attributes,{'tableName':_0x25b1('0x8'),'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 88b52db..909b158 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 _0x4f32=['message','result','catch','Pause','find','options','raw','where','include','model','map','attributes','ShowPause','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x54e167,_0x2fb491){var _0x2ffddd=function(_0x13f80b){while(--_0x13f80b){_0x54e167['push'](_0x54e167['shift']());}};_0x2ffddd(++_0x2fb491);}(_0x4f32,0x11b));var _0x24f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x24f3('0x0'));var moment=require(_0x24f3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24f3('0x2'));var db=require(_0x24f3('0x3'))['db'];var utils=require(_0x24f3('0x4'));var logger=require(_0x24f3('0x5'))('rpc');var config=require(_0x24f3('0x6'));var jayson=require(_0x24f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42ac07,_0x518b88,_0x13c9c8){return new BPromise(function(_0x39c9e8,_0x368ba){return client['request'](_0x42ac07,_0x13c9c8)[_0x24f3('0x8')](function(_0x244a5d){logger[_0x24f3('0x9')](_0x24f3('0xa'),_0x518b88,_0x24f3('0xb'));logger[_0x24f3('0xc')](_0x24f3('0xd'),_0x518b88,_0x24f3('0xb'),JSON[_0x24f3('0xe')](_0x244a5d));if(_0x244a5d[_0x24f3('0xf')]){if(_0x244a5d[_0x24f3('0xf')][_0x24f3('0x10')]===0x1f4){logger[_0x24f3('0xf')]('Pause,\x20%s,\x20%s',_0x518b88,_0x244a5d[_0x24f3('0xf')][_0x24f3('0x11')]);return _0x368ba(_0x244a5d[_0x24f3('0xf')][_0x24f3('0x11')]);}logger[_0x24f3('0xf')](_0x24f3('0xa'),_0x518b88,_0x244a5d[_0x24f3('0xf')][_0x24f3('0x11')]);return _0x39c9e8(_0x244a5d[_0x24f3('0xf')][_0x24f3('0x11')]);}else{logger['info'](_0x24f3('0xa'),_0x518b88,_0x24f3('0xb'));_0x39c9e8(_0x244a5d[_0x24f3('0x12')][_0x24f3('0x11')]);}})[_0x24f3('0x13')](function(_0x324ff2){logger[_0x24f3('0xf')](_0x24f3('0xa'),_0x518b88,_0x324ff2);_0x368ba(_0x324ff2);});});}exports['ShowPause']=function(_0x307d8d){var _0x4086fa=this;return new Promise(function(_0x5c215a,_0x10b4f1){return db[_0x24f3('0x14')][_0x24f3('0x15')]({'raw':_0x307d8d[_0x24f3('0x16')]?_0x307d8d[_0x24f3('0x16')][_0x24f3('0x17')]===undefined?!![]:![]:!![],'where':_0x307d8d[_0x24f3('0x16')]?_0x307d8d[_0x24f3('0x16')][_0x24f3('0x18')]||null:null,'attributes':_0x307d8d[_0x24f3('0x16')]?_0x307d8d[_0x24f3('0x16')]['attributes']||null:null,'include':_0x307d8d[_0x24f3('0x16')]?_0x307d8d[_0x24f3('0x16')][_0x24f3('0x19')]?_['map'](_0x307d8d[_0x24f3('0x16')][_0x24f3('0x19')],function(_0x1ffa69){return{'model':db[_0x1ffa69[_0x24f3('0x1a')]],'as':_0x1ffa69['as'],'attributes':_0x1ffa69['attributes'],'include':_0x1ffa69['include']?_[_0x24f3('0x1b')](_0x1ffa69[_0x24f3('0x19')],function(_0x3fb515){return{'model':db[_0x3fb515[_0x24f3('0x1a')]],'as':_0x3fb515['as'],'attributes':_0x3fb515[_0x24f3('0x1c')],'include':_0x3fb515[_0x24f3('0x19')]?_[_0x24f3('0x1b')](_0x3fb515['include'],function(_0x53ba43){return{'model':db[_0x53ba43[_0x24f3('0x1a')]],'as':_0x53ba43['as'],'attributes':_0x53ba43[_0x24f3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x24f3('0x8')](function(_0x23c260){logger[_0x24f3('0x9')](_0x24f3('0x1d'),_0x307d8d);logger[_0x24f3('0xc')](_0x24f3('0x1d'),_0x307d8d,JSON[_0x24f3('0xe')](_0x23c260));_0x5c215a(_0x23c260);})['catch'](function(_0x4a841f){logger[_0x24f3('0xf')](_0x24f3('0x1d'),_0x4a841f[_0x24f3('0x11')],_0x307d8d);_0x10b4f1(_0x4086fa[_0x24f3('0xf')](0x1f4,_0x4a841f['message']));});});}; \ No newline at end of file +var _0xba0b=['message','catch','ShowPause','find','options','where','attributes','include','map','model','stringify','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x287b6a,_0x3b181d){var _0x4c070e=function(_0x5700ba){while(--_0x5700ba){_0x287b6a['push'](_0x287b6a['shift']());}};_0x4c070e(++_0x3b181d);}(_0xba0b,0x110));var _0xbba0=function(_0x2f4bbd,_0x2fde8c){_0x2f4bbd=_0x2f4bbd-0x0;var _0xd85373=_0xba0b[_0x2f4bbd];return _0xd85373;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbba0('0x0'));var rs=require(_0xbba0('0x1'));var fs=require('fs');var Redis=require(_0xbba0('0x2'));var db=require(_0xbba0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbba0('0x4'))(_0xbba0('0x5'));var config=require(_0xbba0('0x6'));var jayson=require(_0xbba0('0x7'));var client=jayson[_0xbba0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x749166,_0x75fb2b,_0xabf62d){return new BPromise(function(_0x574498,_0x32d691){return client[_0xbba0('0x9')](_0x749166,_0xabf62d)[_0xbba0('0xa')](function(_0xb645af){logger[_0xbba0('0xb')](_0xbba0('0xc'),_0x75fb2b,_0xbba0('0xd'));logger[_0xbba0('0xe')](_0xbba0('0xf'),_0x75fb2b,_0xbba0('0xd'),JSON['stringify'](_0xb645af));if(_0xb645af[_0xbba0('0x10')]){if(_0xb645af[_0xbba0('0x10')][_0xbba0('0x11')]===0x1f4){logger[_0xbba0('0x10')](_0xbba0('0xc'),_0x75fb2b,_0xb645af[_0xbba0('0x10')][_0xbba0('0x12')]);return _0x32d691(_0xb645af['error'][_0xbba0('0x12')]);}logger[_0xbba0('0x10')](_0xbba0('0xc'),_0x75fb2b,_0xb645af[_0xbba0('0x10')][_0xbba0('0x12')]);return _0x574498(_0xb645af['error']['message']);}else{logger[_0xbba0('0xb')]('Pause,\x20%s,\x20%s',_0x75fb2b,_0xbba0('0xd'));_0x574498(_0xb645af['result'][_0xbba0('0x12')]);}})[_0xbba0('0x13')](function(_0x3574f2){logger[_0xbba0('0x10')](_0xbba0('0xc'),_0x75fb2b,_0x3574f2);_0x32d691(_0x3574f2);});});}exports[_0xbba0('0x14')]=function(_0x1605c5){var _0x14b147=this;return new Promise(function(_0x32a15a,_0x14b967){return db['Pause'][_0xbba0('0x15')]({'raw':_0x1605c5[_0xbba0('0x16')]?_0x1605c5[_0xbba0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1605c5[_0xbba0('0x16')]?_0x1605c5[_0xbba0('0x16')][_0xbba0('0x17')]||null:null,'attributes':_0x1605c5[_0xbba0('0x16')]?_0x1605c5['options'][_0xbba0('0x18')]||null:null,'include':_0x1605c5[_0xbba0('0x16')]?_0x1605c5['options'][_0xbba0('0x19')]?_[_0xbba0('0x1a')](_0x1605c5[_0xbba0('0x16')][_0xbba0('0x19')],function(_0x153e78){return{'model':db[_0x153e78[_0xbba0('0x1b')]],'as':_0x153e78['as'],'attributes':_0x153e78['attributes'],'include':_0x153e78['include']?_[_0xbba0('0x1a')](_0x153e78[_0xbba0('0x19')],function(_0x20b1d1){return{'model':db[_0x20b1d1[_0xbba0('0x1b')]],'as':_0x20b1d1['as'],'attributes':_0x20b1d1['attributes'],'include':_0x20b1d1['include']?_[_0xbba0('0x1a')](_0x20b1d1['include'],function(_0xf8d48){return{'model':db[_0xf8d48[_0xbba0('0x1b')]],'as':_0xf8d48['as'],'attributes':_0xf8d48['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2981ce){logger[_0xbba0('0xb')](_0xbba0('0x14'),_0x1605c5);logger[_0xbba0('0xe')](_0xbba0('0x14'),_0x1605c5,JSON[_0xbba0('0x1c')](_0x2981ce));_0x32a15a(_0x2981ce);})[_0xbba0('0x13')](function(_0xd9bb34){logger[_0xbba0('0x10')]('ShowPause',_0xd9bb34[_0xbba0('0x12')],_0x1605c5);_0x14b967(_0x14b147[_0xbba0('0x10')](0x1f4,_0xd9bb34[_0xbba0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index afdd6dc..3bf72fc 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 _0x0a93=['originalname','replace','format','%s-%s%s','basename','extname','now','post','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x0a93,0x1db));var _0x30a9=function(_0xd49f5,_0x6b33f3){_0xd49f5=_0xd49f5-0x0;var _0x2b14d3=_0x0a93[_0xd49f5];return _0x2b14d3;};'use strict';var multer=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var path=require(_0x30a9('0x2'));var timeout=require(_0x30a9('0x3'));var express=require(_0x30a9('0x4'));var router=express[_0x30a9('0x5')]();var fs_extra=require(_0x30a9('0x6'));var auth=require(_0x30a9('0x7'));var interaction=require(_0x30a9('0x8'));var config=require(_0x30a9('0x9'));var controller=require('./plugin.controller');router['get']('/',auth[_0x30a9('0xa')](),controller['index']);router['get'](_0x30a9('0xb'),controller[_0x30a9('0xc')]);router['get'](_0x30a9('0xd'),auth[_0x30a9('0xa')](),controller[_0x30a9('0xe')]);router['get'](_0x30a9('0xf'),auth[_0x30a9('0xa')](),controller[_0x30a9('0x10')]);var upload=multer({'storage':multer[_0x30a9('0x11')]({'destination':function(_0x51f330,_0x181be9,_0x324688){_0x324688(null,path[_0x30a9('0x12')](config[_0x30a9('0x13')],_0x30a9('0x14')));},'filename':function(_0x279f8f,_0x228376,_0x9039b3){_0x228376[_0x30a9('0x15')]=_0x228376['originalname'][_0x30a9('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9039b3(null,util[_0x30a9('0x17')](_0x30a9('0x18'),path[_0x30a9('0x19')](_0x228376[_0x30a9('0x15')],path[_0x30a9('0x1a')](_0x228376[_0x30a9('0x15')])),Date[_0x30a9('0x1b')](),path[_0x30a9('0x1a')](_0x228376[_0x30a9('0x15')])));}})});router['post']('/',upload['single']('file'),controller['upload']);router[_0x30a9('0x1c')](_0x30a9('0xb'),controller['webhookPost']);router[_0x30a9('0x1d')](_0x30a9('0xd'),auth['isAuthenticated'](),controller[_0x30a9('0x1e')]);router['delete'](_0x30a9('0xd'),auth[_0x30a9('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x3582=['../../config/environment','./plugin.controller','isAuthenticated','index','/webhook','webhookGet','get','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','format','basename','post','single','file','webhookPost','update','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x3582,0x108));var _0x2358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3582[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2358('0x0'));var util=require(_0x2358('0x1'));var path=require(_0x2358('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2358('0x3')]();var fs_extra=require(_0x2358('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2358('0x5'));var config=require(_0x2358('0x6'));var controller=require(_0x2358('0x7'));router['get']('/',auth[_0x2358('0x8')](),controller[_0x2358('0x9')]);router['get'](_0x2358('0xa'),controller[_0x2358('0xb')]);router[_0x2358('0xc')](_0x2358('0xd'),auth[_0x2358('0x8')](),controller['show']);router[_0x2358('0xc')](_0x2358('0xe'),auth['isAuthenticated'](),controller[_0x2358('0xf')]);var upload=multer({'storage':multer[_0x2358('0x10')]({'destination':function(_0x1a18e7,_0x14d522,_0x45b167){_0x45b167(null,path[_0x2358('0x11')](config['root'],_0x2358('0x12')));},'filename':function(_0x49305c,_0x5e7fd6,_0x250523){_0x5e7fd6['originalname']=_0x5e7fd6[_0x2358('0x13')][_0x2358('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x250523(null,util[_0x2358('0x15')]('%s-%s%s',path[_0x2358('0x16')](_0x5e7fd6[_0x2358('0x13')],path['extname'](_0x5e7fd6[_0x2358('0x13')])),Date['now'](),path['extname'](_0x5e7fd6[_0x2358('0x13')])));}})});router[_0x2358('0x17')]('/',upload[_0x2358('0x18')](_0x2358('0x19')),controller['upload']);router[_0x2358('0x17')](_0x2358('0xa'),controller[_0x2358('0x1a')]);router['put']('/:id',auth[_0x2358('0x8')](),controller[_0x2358('0x1b')]);router['delete'](_0x2358('0xd'),auth[_0x2358('0x8')](),controller[_0x2358('0x1c')]);module[_0x2358('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 853071f..e53ab38 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 _0xbc1a=['never','sequelize','exports','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always'];(function(_0x52aae9,_0x638e63){var _0xd86a41=function(_0x466c59){while(--_0x466c59){_0x52aae9['push'](_0x52aae9['shift']());}};_0xd86a41(++_0x638e63);}(_0xbc1a,0x1e5));var _0xabc1=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xbc1a[_0x4a3898];return _0x25ceb0;};'use strict';var Sequelize=require(_0xabc1('0x0'));module[_0xabc1('0x1')]={'name':{'type':Sequelize[_0xabc1('0x2')]},'type':{'type':Sequelize['ENUM']('html','script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xabc1('0x2')],'comment':_0xabc1('0x3')},'active':{'type':Sequelize[_0xabc1('0x4')],'defaultValue':0x0,'comment':_0xabc1('0x5')},'sidebar':{'type':Sequelize[_0xabc1('0x6')](_0xabc1('0x7'),_0xabc1('0x8'),_0xabc1('0x9'),_0xabc1('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xabc1('0x2')]},'agentUrl':{'type':Sequelize[_0xabc1('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xabc1('0x2')]}}; \ No newline at end of file +var _0xd272=['exports','STRING','ENUM','script','TEXT','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x14f0b9,_0x136dcb){var _0x8be29c=function(_0x38cae1){while(--_0x38cae1){_0x14f0b9['push'](_0x14f0b9['shift']());}};_0x8be29c(++_0x136dcb);}(_0xd272,0x1c1));var _0x2d27=function(_0x5b2024,_0xccd8c){_0x5b2024=_0x5b2024-0x0;var _0x5d947a=_0xd272[_0x5b2024];return _0x5d947a;};'use strict';var Sequelize=require(_0x2d27('0x0'));module[_0x2d27('0x1')]={'name':{'type':Sequelize[_0x2d27('0x2')]},'type':{'type':Sequelize[_0x2d27('0x3')]('html',_0x2d27('0x4'))},'description':{'type':Sequelize[_0x2d27('0x5')]},'version':{'type':Sequelize[_0x2d27('0x5')]},'path':{'type':Sequelize[_0x2d27('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x2d27('0x3')](_0x2d27('0x6'),'agentOnly',_0x2d27('0x7'),_0x2d27('0x8')),'defaultValue':_0x2d27('0x7'),'comment':_0x2d27('0x9')},'icon':{'type':Sequelize[_0x2d27('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x2d27('0x2')]},'scriptPath':{'type':Sequelize[_0x2d27('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 70b5767..715e504 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 _0x98d8=['always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptName','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','find','delete','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','hostname','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Plugins','UserProfileResource','sendStatus','name','send','Plugin','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','chmodSync','0777','readdirSync','error','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','parameters','views','admin','script','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar'];(function(_0x76cd1d,_0x21d168){var _0x469d43=function(_0x2ca454){while(--_0x2ca454){_0x76cd1d['push'](_0x76cd1d['shift']());}};_0x469d43(++_0x21d168);}(_0x98d8,0xce));var _0x898d=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x98d8[_0x1ebc6c];return _0x3a826d;};'use strict';var emlformat=require(_0x898d('0x0'));var rimraf=require(_0x898d('0x1'));var zipdir=require(_0x898d('0x2'));var jsonpatch=require(_0x898d('0x3'));var rp=require(_0x898d('0x4'));var moment=require(_0x898d('0x5'));var BPromise=require(_0x898d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x898d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x898d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898d('0x9'));var squel=require('squel');var crypto=require(_0x898d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x898d('0xb'));var toCsv=require(_0x898d('0xc'));var querystring=require(_0x898d('0xd'));var Papa=require(_0x898d('0xe'));var extract=require(_0x898d('0xf'));var rimraf=require(_0x898d('0x1'));var archiver=require(_0x898d('0x10'));var Redis=require(_0x898d('0x11'));var authService=require(_0x898d('0x12'));var qs=require(_0x898d('0x13'));var as=require(_0x898d('0x14'));var hardwareService=require(_0x898d('0x15'));var logger=require(_0x898d('0x16'))(_0x898d('0x17'));var utils=require(_0x898d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x898d('0x19'));var db=require(_0x898d('0x1a'))['db'];config['redis']=_[_0x898d('0x1b')](config[_0x898d('0x1c')],{'host':_0x898d('0x1d'),'port':0x18eb});var socket=require(_0x898d('0x1e'))(new Redis(config[_0x898d('0x1c')]));require(_0x898d('0x1f'))[_0x898d('0x20')](socket);function respondWithStatusCode(_0x50634f,_0x15fafc){_0x15fafc=_0x15fafc||0xcc;return function(_0xccd1a9){if(_0xccd1a9){return _0x50634f['sendStatus'](_0x15fafc);}return _0x50634f['status'](_0x15fafc)[_0x898d('0x21')]();};}function respondWithResult(_0x42a098,_0x1ff50b){_0x1ff50b=_0x1ff50b||0xc8;return function(_0x4202f0){if(_0x4202f0){return _0x42a098[_0x898d('0x22')](_0x1ff50b)[_0x898d('0x23')](_0x4202f0);}};}function respondWithFilteredResult(_0x514c47,_0x47c188){return function(_0x26be5a){if(_0x26be5a){var _0x3d040a=typeof _0x47c188[_0x898d('0x24')]===_0x898d('0x25')&&typeof _0x47c188[_0x898d('0x26')]===_0x898d('0x25');var _0x3db3a7=_0x26be5a[_0x898d('0x27')];var _0x12e72c=_0x3d040a?0x0:_0x47c188[_0x898d('0x24')];var _0x220d7b=_0x3d040a?_0x26be5a['count']:_0x47c188[_0x898d('0x24')]+_0x47c188[_0x898d('0x26')];var _0x7113ca;if(_0x220d7b>=_0x3db3a7){_0x220d7b=_0x3db3a7;_0x7113ca=0xc8;}else{_0x7113ca=0xce;}_0x514c47['status'](_0x7113ca);return _0x514c47['set'](_0x898d('0x28'),_0x12e72c+'-'+_0x220d7b+'/'+_0x3db3a7)[_0x898d('0x23')](_0x26be5a);}return null;};}function patchUpdates(_0xa4fc71){return function(_0x10290f){try{jsonpatch[_0x898d('0x29')](_0x10290f,_0xa4fc71,!![]);}catch(_0x3fc201){return BPromise[_0x898d('0x2a')](_0x3fc201);}return _0x10290f[_0x898d('0x2b')]();};}function saveUpdates(_0x30c415,_0x493a60){return function(_0x543fc3){if(_0x543fc3){return _0x543fc3[_0x898d('0x2c')](_0x30c415)[_0x898d('0x2d')](function(_0x308b13){return _0x308b13;});}return null;};}function removeEntity(_0x39b61e,_0x244d3a){return function(_0xef200a){if(_0xef200a){return _0xef200a[_0x898d('0x2e')]()['then'](function(){var _0x7873=_0xef200a['get']({'plain':!![]});var _0xaa0054=_0x898d('0x2f');return db[_0x898d('0x30')][_0x898d('0x2e')]({'where':{'type':_0xaa0054,'resourceId':_0x7873['id']}})[_0x898d('0x2d')](function(){return _0xef200a;});})[_0x898d('0x2d')](function(){_0x39b61e['status'](0xcc)[_0x898d('0x21')]();});}};}function handleEntityNotFound(_0xfcae2d,_0x1baec7){return function(_0x47ea99){if(!_0x47ea99){_0xfcae2d[_0x898d('0x31')](0x194);}return _0x47ea99;};}function handleError(_0x15b0fb,_0x417c8e){_0x417c8e=_0x417c8e||0x1f4;return function(_0x8e2e5b){logger['error'](_0x8e2e5b['stack']);if(_0x8e2e5b['name']){delete _0x8e2e5b[_0x898d('0x32')];}_0x15b0fb[_0x898d('0x22')](_0x417c8e)[_0x898d('0x33')](_0x8e2e5b);};}exports['index']=function(_0x3325bc,_0x252d3a){var _0x1b8eb2={},_0xf520fa={},_0x5e6df7={'count':0x0,'rows':[]};var _0x1a5dc2=_['map'](db[_0x898d('0x34')][_0x898d('0x35')],function(_0x30b5b0){return{'name':_0x30b5b0[_0x898d('0x36')],'type':_0x30b5b0[_0x898d('0x37')]['key']};});_0xf520fa['model']=_[_0x898d('0x38')](_0x1a5dc2,_0x898d('0x32'));_0xf520fa['query']=_[_0x898d('0x39')](_0x3325bc[_0x898d('0x3a')]);_0xf520fa[_0x898d('0x3b')]=_[_0x898d('0x3c')](_0xf520fa[_0x898d('0x3d')],_0xf520fa[_0x898d('0x3a')]);_0x1b8eb2['attributes']=_[_0x898d('0x3c')](_0xf520fa[_0x898d('0x3d')],qs[_0x898d('0x3e')](_0x3325bc['query'][_0x898d('0x3e')]));_0x1b8eb2[_0x898d('0x3f')]=_0x1b8eb2[_0x898d('0x3f')]['length']?_0x1b8eb2[_0x898d('0x3f')]:_0xf520fa[_0x898d('0x3d')];if(!_0x3325bc[_0x898d('0x3a')][_0x898d('0x40')](_0x898d('0x41'))){_0x1b8eb2[_0x898d('0x26')]=qs[_0x898d('0x26')](_0x3325bc['query']['limit']);_0x1b8eb2[_0x898d('0x24')]=qs[_0x898d('0x24')](_0x3325bc['query'][_0x898d('0x24')]);}_0x1b8eb2[_0x898d('0x42')]=qs[_0x898d('0x43')](_0x3325bc[_0x898d('0x3a')][_0x898d('0x43')]);_0x1b8eb2[_0x898d('0x44')]=qs[_0x898d('0x3b')](_[_0x898d('0x45')](_0x3325bc[_0x898d('0x3a')],_0xf520fa[_0x898d('0x3b')]),_0x1a5dc2);if(_0x3325bc[_0x898d('0x3a')][_0x898d('0x46')]){_0x1b8eb2[_0x898d('0x44')]=_[_0x898d('0x47')](_0x1b8eb2['where'],{'$or':_[_0x898d('0x38')](_0x1a5dc2,function(_0x23e87b){if(_0x23e87b['type']!==_0x898d('0x48')){var _0x1e77b2={};_0x1e77b2[_0x23e87b['name']]={'$like':'%'+_0x3325bc[_0x898d('0x3a')][_0x898d('0x46')]+'%'};return _0x1e77b2;}})});}_0x1b8eb2=_[_0x898d('0x47')]({},_0x1b8eb2,_0x3325bc[_0x898d('0x49')]);var _0x413b18={'where':_0x1b8eb2['where']};return db[_0x898d('0x34')][_0x898d('0x27')](_0x413b18)[_0x898d('0x2d')](function(_0x233c71){_0x5e6df7[_0x898d('0x27')]=_0x233c71;if(_0x3325bc[_0x898d('0x3a')][_0x898d('0x4a')]){_0x1b8eb2[_0x898d('0x4b')]=[{'all':!![]}];}return db['Plugin'][_0x898d('0x4c')](_0x1b8eb2);})['then'](function(_0x3b6b69){_0x5e6df7[_0x898d('0x4d')]=_0x3b6b69;return _0x5e6df7;})['then'](respondWithFilteredResult(_0x252d3a,_0x1b8eb2))[_0x898d('0x4e')](handleError(_0x252d3a,null));};exports[_0x898d('0x4f')]=function(_0x43ee93,_0x4634f7){var _0x41a746={'raw':!![],'where':{'id':_0x43ee93[_0x898d('0x50')]['id']}},_0x2f834b={};_0x2f834b[_0x898d('0x3d')]=_[_0x898d('0x39')](db[_0x898d('0x34')][_0x898d('0x35')]);_0x2f834b[_0x898d('0x3a')]=_[_0x898d('0x39')](_0x43ee93[_0x898d('0x3a')]);_0x2f834b[_0x898d('0x3b')]=_[_0x898d('0x3c')](_0x2f834b['model'],_0x2f834b[_0x898d('0x3a')]);_0x41a746['attributes']=_[_0x898d('0x3c')](_0x2f834b[_0x898d('0x3d')],qs[_0x898d('0x3e')](_0x43ee93[_0x898d('0x3a')][_0x898d('0x3e')]));_0x41a746[_0x898d('0x3f')]=_0x41a746['attributes'][_0x898d('0x51')]?_0x41a746[_0x898d('0x3f')]:_0x2f834b[_0x898d('0x3d')];if(_0x43ee93[_0x898d('0x3a')][_0x898d('0x4a')]){_0x41a746[_0x898d('0x4b')]=[{'all':!![]}];}_0x41a746=_[_0x898d('0x47')]({},_0x41a746,_0x43ee93[_0x898d('0x49')]);return db[_0x898d('0x34')]['find'](_0x41a746)['then'](handleEntityNotFound(_0x4634f7,null))['then'](respondWithResult(_0x4634f7,null))[_0x898d('0x4e')](handleError(_0x4634f7,null));};exports[_0x898d('0x52')]=function(_0x1d0905,_0x3badbe,_0x5ec4d6){return db[_0x898d('0x34')]['find']({'where':{'id':_0x1d0905[_0x898d('0x50')]['id']},'attributes':['name',_0x898d('0x7')],'raw':!![]})[_0x898d('0x2d')](handleEntityNotFound(_0x3badbe,null))['then'](function(_0x2f3514){if(_0x2f3514){var _0x44cbea=path[_0x898d('0x53')](config['root'],_0x898d('0x54'),util[_0x898d('0x55')](_0x898d('0x56'),path[_0x898d('0x57')](_0x2f3514['path'])));var _0x48679e=fs[_0x898d('0x58')](_0x44cbea);var _0x1858e5=archiver(_0x898d('0x59'),{'zlib':{'level':0x9}});_0x1858e5['on'](_0x898d('0x5a'),function(_0x497c85){if(_0x497c85[_0x898d('0x5b')]==='ENOENT'){logger['error'](_0x497c85);}else{throw new db[(_0x898d('0x5c'))][(_0x898d('0x5d'))](_0x898d('0x5e'));}});_0x1858e5['on']('error',function(_0x582387){throw new db['Sequelize'][(_0x898d('0x5d'))](_0x898d('0x5e'));});_0x1858e5[_0x898d('0x5f')](_0x48679e);_0x1858e5[_0x898d('0x60')](_0x898d('0x61'),{'cwd':path['join'](config[_0x898d('0x62')],_0x898d('0x54'),path[_0x898d('0x63')](_0x2f3514[_0x898d('0x7')])),'ignore':[path[_0x898d('0x53')](path[_0x898d('0x57')](_0x2f3514[_0x898d('0x7')]),_0x898d('0x64')),path['join'](path[_0x898d('0x57')](_0x2f3514['path']),_0x898d('0x65'))],'nodir':!![]})['finalize']();_0x48679e['on'](_0x898d('0x66'),function(){if(!fs[_0x898d('0x67')](_0x44cbea)){throw new db[(_0x898d('0x5c'))][(_0x898d('0x5d'))](_0x898d('0x68'));}return _0x3badbe[_0x898d('0x52')](_0x44cbea,util[_0x898d('0x55')](_0x898d('0x56'),path[_0x898d('0x57')](_0x2f3514[_0x898d('0x7')])),function(_0x4d7c14){if(_0x4d7c14){throw new db[(_0x898d('0x5c'))][(_0x898d('0x5d'))](_0x898d('0x69'));}fs[_0x898d('0x6a')](_0x44cbea);logger['info']('Download\x20completed');logger[_0x898d('0x6b')](_0x898d('0x6c'));});});}return null;})[_0x898d('0x4e')](handleError(_0x3badbe,null));};exports['upload']=function(_0x207bf8,_0x5741ae,_0x58c6cb){var _0x231b24=path['basename'](_0x207bf8[_0x898d('0x6d')]['filename'],path['extname'](_0x207bf8['file'][_0x898d('0x6e')]));var _0x3f45d6=path['join'](config[_0x898d('0x62')],_0x898d('0x54'),_0x207bf8[_0x898d('0x6d')][_0x898d('0x6e')]);var _0xf054d0=path[_0x898d('0x53')](config['root'],_0x898d('0x54'),_0x231b24);logger[_0x898d('0x6b')]('Plugin\x20upload\x20filepath:\x20%s',_0x3f45d6);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0xf054d0);try{fs[_0x898d('0x6f')](_0x3f45d6,parseInt(_0x898d('0x70'),0x8));extract(_0x3f45d6,{'dir':_0xf054d0},function(_0x3d4b93){if(_0x3d4b93){logger['error'](_0x3d4b93);handleError(_0x3d4b93,!![]);};var _0x15b803=fs[_0x898d('0x71')](_0xf054d0);if(_0x15b803[_0x898d('0x51')]>0x1){removeReferences(_0x3f45d6,_0xf054d0);logger[_0x898d('0x72')](_0x898d('0x73'));return _0x58c6cb(new Error('Invalid\x20plugin\x20structure'));}var _0x25b19c=fs[_0x898d('0x74')](path['join'](_0xf054d0,_0x15b803[0x0]));if(_0x25b19c[_0x898d('0x75')]()){removeReferences(_0x3f45d6,_0xf054d0);logger[_0x898d('0x72')](_0x898d('0x73'));return _0x58c6cb(new Error(_0x898d('0x73')));}if(_0x25b19c[_0x898d('0x76')]()){var _0x5cfd65=fs['readdirSync'](path[_0x898d('0x53')](_0xf054d0,_0x15b803[0x0]));if(_0x5cfd65[_0x898d('0x51')]===0x0){removeReferences(_0x3f45d6,_0xf054d0);logger[_0x898d('0x72')](_0x898d('0x73'));return _0x58c6cb(new Error('Invalid\x20plugin\x20structure'));}var _0x3fc14b=_0x5cfd65['some'](function(_0x19d7a6){return _0x19d7a6===_0x898d('0x77');});if(!_0x3fc14b){return _0x58c6cb(new Error('Plugin\x20manifest\x20missing'));}var _0x2db22c=fs['readFileSync'](path[_0x898d('0x53')](_0xf054d0,_0x15b803[0x0],_0x898d('0x77')));var _0x3fc2ab=JSON[_0x898d('0x78')](_0x2db22c);if(_0x898d('0x25')==typeof _0x3fc2ab['name']){return _0x58c6cb(new Error(_0x898d('0x79')));}if(_0x898d('0x25')==typeof _0x3fc2ab[_0x898d('0x37')]){return _0x58c6cb(new Error(_0x898d('0x7a')));}if(_0x898d('0x25')==typeof _0x3fc2ab['version']){return _0x58c6cb(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x898d('0x25')==typeof _0x3fc2ab['parameters']){return _0x58c6cb(new Error(_0x898d('0x7b')));}if(_0x3fc2ab[_0x898d('0x37')]==='html'){if(_0x898d('0x25')==typeof _0x3fc2ab['parameters']['views']){return _0x58c6cb(new Error(_0x898d('0x7c')));}if('undefined'==typeof _0x3fc2ab[_0x898d('0x7d')][_0x898d('0x7e')][_0x898d('0x7f')]&&_0x898d('0x25')==typeof _0x3fc2ab['parameters']['views']['agent']){return _0x58c6cb(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3fc2ab[_0x898d('0x37')]===_0x898d('0x80')){if('undefined'==typeof _0x3fc2ab['parameters']['scriptName']){return _0x58c6cb(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x898d('0x25')==typeof _0x3fc2ab['parameters']['scriptPath']){return _0x58c6cb(new Error(_0x898d('0x81')));}}else{return _0x58c6cb(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x552f48=_0x3fc2ab['name'];var _0x603c47=_0x3fc2ab[_0x898d('0x82')];var _0xa652fb=_0x3fc2ab[_0x898d('0x37')];var _0xe969ad=_0x3fc2ab[_0x898d('0x83')]?_0x3fc2ab[_0x898d('0x83')]:_0x898d('0x84');var _0x28f535=_0x3fc2ab['icon']?_0x3fc2ab[_0x898d('0x85')]:'icon-apps';var _0x3c4f8d='';var _0x25d0ab='';var _0x323566='';var _0xd8bd46='';var _0x4228a3=_0x3fc2ab['version'];if(_0xa652fb==='html'){if(_0x898d('0x25')!=typeof _0x3fc2ab[_0x898d('0x7d')][_0x898d('0x7e')][_0x898d('0x7f')]){var _0x1e6513=_0x3fc2ab[_0x898d('0x7d')][_0x898d('0x7e')][_0x898d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x898d('0x86')](_0x1e6513)){_0x3c4f8d=path[_0x898d('0x53')](_0x898d('0x87'),_0x231b24,_0x15b803[0x0],_0x1e6513);}else{_0x3c4f8d=_0x1e6513;}}else{logger['info'](_0x898d('0x88'));}if('undefined'!=typeof _0x3fc2ab['parameters']['views'][_0x898d('0x89')]){var _0xfa807b=_0x3fc2ab['parameters'][_0x898d('0x7e')][_0x898d('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x898d('0x86')](_0xfa807b)){_0x25d0ab=path[_0x898d('0x53')]('plugins',_0x231b24,_0x15b803[0x0],_0xfa807b);}else{_0x25d0ab=_0xfa807b;}}else{logger[_0x898d('0x6b')](_0x898d('0x8a'));}}else if(_0xa652fb===_0x898d('0x80')){_0x323566=_0x3fc2ab[_0x898d('0x7d')][_0x898d('0x8b')];_0xd8bd46=_0x3fc2ab[_0x898d('0x7d')][_0x898d('0x8c')];if(_0x898d('0x25')!=typeof _0x3fc2ab[_0x898d('0x7d')]['views']){if(_0x898d('0x25')!=typeof _0x3fc2ab[_0x898d('0x7d')]['views']['admin']){var _0x1e6513=_0x3fc2ab['parameters'][_0x898d('0x7e')][_0x898d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x898d('0x86')](_0x1e6513)){_0x3c4f8d=path[_0x898d('0x53')](_0x898d('0x87'),_0x231b24,_0x15b803[0x0],_0x1e6513);}else{_0x3c4f8d=_0x1e6513;}}if(_0x898d('0x25')!=typeof _0x3fc2ab['parameters'][_0x898d('0x7e')]['agent']){var _0xfa807b=_0x3fc2ab[_0x898d('0x7d')][_0x898d('0x7e')][_0x898d('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x898d('0x86')](_0xfa807b)){_0x25d0ab=path[_0x898d('0x53')](_0x898d('0x87'),_0x231b24,_0x15b803[0x0],_0xfa807b);}else{_0x25d0ab=_0xfa807b;}}}}var _0x901ee8={'name':_0x552f48,'description':_0x603c47,'path':path[_0x898d('0x53')](_0x231b24,_0x15b803[0x0]),'type':_0xa652fb,'sidebar':_0xe969ad,'icon':_0x28f535,'adminUrl':_0x3c4f8d,'agentUrl':_0x25d0ab,'scriptName':_0x323566,'scriptPath':_0xd8bd46,'version':_0x4228a3};removeReferences(_0x3f45d6,null);return db[_0x898d('0x34')][_0x898d('0x8d')](_0x901ee8)['then'](function(_0x8c5d60){var _0xdc42bd={'role':_0x207bf8[_0x898d('0x8e')][_0x898d('0x8f')],'userProfileId':_0x207bf8[_0x898d('0x8e')][_0x898d('0x90')]};if(!_0xdc42bd)throw new Error(_0x898d('0x91'));if(_0xdc42bd[_0x898d('0x8f')]===_0x898d('0x92')){var _0x272fcb=_0x8c5d60['get']({'plain':!![]});return db[_0x898d('0x93')]['find']({'where':{'name':_0x898d('0x2f'),'userProfileId':_0xdc42bd[_0x898d('0x90')]},'raw':!![]})[_0x898d('0x2d')](function(_0x5eda97){if(_0x5eda97&&_0x5eda97[_0x898d('0x94')]===0x0){return db[_0x898d('0x30')]['create']({'name':_0x272fcb[_0x898d('0x32')],'resourceId':_0x272fcb['id'],'type':_0x5eda97[_0x898d('0x32')],'sectionId':_0x5eda97['id']},{})[_0x898d('0x2d')](function(){return _0x8c5d60;});}else{return _0x8c5d60;}})[_0x898d('0x4e')](function(_0xd17946){logger[_0x898d('0x72')](_0x898d('0x95'),_0xd17946);throw _0xd17946;});}return _0x8c5d60;})[_0x898d('0x2d')](respondWithResult(_0x5741ae,null))[_0x898d('0x4e')](handleError(_0x5741ae,null));}});}catch(_0xd0e3f0){_0x5741ae[_0x898d('0x22')](0x1f4)[_0x898d('0x33')](_0xd0e3f0);}};function removeReferences(_0x54f698,_0x5d70dd){try{if(_0x54f698){fs[_0x898d('0x6a')](_0x54f698);logger[_0x898d('0x6b')]('Zip\x20archive\x20removed');}if(_0x5d70dd){rimraf(_0x5d70dd,function(){});logger[_0x898d('0x6b')](_0x898d('0x96'));}}catch(_0x3a3cf7){logger[_0x898d('0x72')](_0x3a3cf7);}}exports[_0x898d('0x2c')]=function(_0x46813d,_0x29e07a,_0x2b7998){return db[_0x898d('0x34')][_0x898d('0x97')]({'where':{'id':_0x46813d['params']['id']}})[_0x898d('0x2d')](handleEntityNotFound(_0x29e07a,null))[_0x898d('0x2d')](saveUpdates(_0x46813d[_0x898d('0x8e')],null))[_0x898d('0x2d')](respondWithResult(_0x29e07a,null))[_0x898d('0x4e')](handleError(_0x29e07a,null));};exports[_0x898d('0x98')]=function(_0x58fd21,_0x1e488b,_0xb4d6d4){return db[_0x898d('0x34')][_0x898d('0x97')]({'where':{'id':_0x58fd21[_0x898d('0x50')]['id']}})[_0x898d('0x2d')](function(_0x2d75ca){if(_0x2d75ca){return _0x2d75ca[_0x898d('0x2e')]();}})['then'](function(_0x300421){rimraf(path['join'](config[_0x898d('0x62')],_0x898d('0x54'),path['dirname'](_0x300421['path'])),function(){});return _0x300421;})[_0x898d('0x2d')](handleEntityNotFound(_0x1e488b,null))[_0x898d('0x2d')](respondWithStatusCode(_0x1e488b,null))[_0x898d('0x4e')](handleError(_0x1e488b,null));};exports['webhookGet']=function(_0xeabbe5,_0x214256,_0x19b6fb){return BPromise['resolve']()[_0x898d('0x2d')](function(){if(!_0xeabbe5[_0x898d('0x3a')][_0x898d('0x7')]){throw new Error(_0x898d('0x99'));}if(!_0xeabbe5[_0x898d('0x3a')]['port']){throw new Error(_0x898d('0x9a'));}var _0xe10947=_0xeabbe5[_0x898d('0x3a')]['hostname']?_0xeabbe5['query']['hostname']+':'+_0xeabbe5[_0x898d('0x3a')][_0x898d('0x9b')]:_0x898d('0x9c')+_0xeabbe5[_0x898d('0x3a')][_0x898d('0x9b')];var _0x3ffebf=_0xeabbe5[_0x898d('0x3a')][_0x898d('0x23')]?_0xeabbe5[_0x898d('0x3a')][_0x898d('0x23')]:!![];var _0x44b39f=_0xeabbe5[_0x898d('0x3a')][_0x898d('0x9d')]?_0xeabbe5['query'][_0x898d('0x9d')]:null;var _0x509130={'method':_0xeabbe5[_0x898d('0x9e')],'uri':util['format']('%s%s',_0xe10947,_0xeabbe5[_0x898d('0x3a')][_0x898d('0x7')]),'json':_0x3ffebf,'resolveWithFullResponse':!![],'encoding':_0x44b39f,'qs':_0xeabbe5['query']};if(_0xeabbe5[_0x898d('0x9f')]){_0x509130[_0x898d('0x9f')]=_0xeabbe5[_0x898d('0x9f')];if(_0x509130['headers'][_0x898d('0xa0')]){delete _0x509130[_0x898d('0x9f')][_0x898d('0xa0')];}}if(_0x509130['headers']['content-type']){delete _0x509130['headers'][_0x898d('0xa1')];}return rp(_0x509130);})['then'](function(_0x214457){if(_0x214457){_0x214256[_0x898d('0xa2')](_0x214457[_0x898d('0x9f')]);logger[_0x898d('0x6b')](_0x214457[_0x898d('0x8e')]);if(_[_0x898d('0xa3')](_0xeabbe5[_0x898d('0x3a')][_0x898d('0x7')],_0x898d('0x52'))&&_0x214457[_0x898d('0xa4')]==0x1f4){return _0x214256[_0x898d('0x31')](_0x214457[_0x898d('0xa4')]);}else{return _0x214256[_0x898d('0x22')](_0x214457[_0x898d('0xa4')])[_0x898d('0x33')](_0x214457[_0x898d('0x8e')]);}}else{return _0x214256['sendStatus'](0xc8);}})[_0x898d('0x4e')](handleError(_0x214256,null));};exports[_0x898d('0xa5')]=function(_0x14d5e6,_0x17b478,_0x5dbf67){return BPromise[_0x898d('0xa6')]()[_0x898d('0x2d')](function(){if(!_0x14d5e6[_0x898d('0x3a')][_0x898d('0x7')]){throw new Error(_0x898d('0x99'));}if(!_0x14d5e6[_0x898d('0x3a')][_0x898d('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2ff95b=_0x14d5e6[_0x898d('0x3a')][_0x898d('0xa7')]?_0x14d5e6['query'][_0x898d('0xa7')]+':'+_0x14d5e6[_0x898d('0x3a')]['port']:_0x898d('0x9c')+_0x14d5e6['query'][_0x898d('0x9b')];var _0x304eb6=_0x14d5e6[_0x898d('0x3a')]['json']?_0x14d5e6[_0x898d('0x3a')][_0x898d('0x23')]:!![];var _0x3ffb85=_0x14d5e6['query'][_0x898d('0x9d')]?_0x14d5e6['query'][_0x898d('0x9d')]:null;var _0x103b84={'method':_0x14d5e6[_0x898d('0x9e')],'uri':util['format'](_0x898d('0xa8'),_0x2ff95b,_0x14d5e6[_0x898d('0x3a')][_0x898d('0x7')]),'json':_0x304eb6,'resolveWithFullResponse':!![],'encoding':_0x3ffb85,'body':_0x14d5e6[_0x898d('0x8e')]};if(_0x14d5e6['headers']){_0x103b84[_0x898d('0x9f')]=_0x14d5e6[_0x898d('0x9f')];if(_0x103b84[_0x898d('0x9f')][_0x898d('0xa0')]){delete _0x103b84[_0x898d('0x9f')][_0x898d('0xa0')];}}if(_0x103b84[_0x898d('0x9f')][_0x898d('0xa1')]){delete _0x103b84[_0x898d('0x9f')][_0x898d('0xa1')];}return rp(_0x103b84);})[_0x898d('0x2d')](function(_0x479b51){if(_0x479b51){_0x17b478['set'](_0x479b51[_0x898d('0x9f')]);logger[_0x898d('0x6b')](_0x479b51[_0x898d('0x8e')]);return _0x17b478[_0x898d('0x22')](_0x479b51[_0x898d('0xa4')])[_0x898d('0x33')](_0x479b51['body']);}else{return _0x17b478[_0x898d('0x31')](0xc8);}})['catch'](handleError(_0x17b478,null));}; \ No newline at end of file +var _0x63ad=['destroy','then','end','sendStatus','error','stack','send','Plugin','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','name','options','rows','catch','show','include','find','download','path','join','root','server/files/plugins','format','%s.zip','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','Plugins','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','params','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','rimraf','zip-dir','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','extract-zip','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','status','json','offset','limit','undefined','count','set','apply','reject','save','update'];(function(_0x490208,_0x46f559){var _0x56f3d7=function(_0x5ebd2b){while(--_0x5ebd2b){_0x490208['push'](_0x490208['shift']());}};_0x56f3d7(++_0x46f559);}(_0x63ad,0x7d));var _0xd63a=function(_0x4f1d39,_0x2eb737){_0x4f1d39=_0x4f1d39-0x0;var _0x56134f=_0x63ad[_0x4f1d39];return _0x56134f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd63a('0x0'));var zipdir=require(_0xd63a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd63a('0x2'));var util=require(_0xd63a('0x3'));var path=require('path');var sox=require(_0xd63a('0x4'));var csv=require(_0xd63a('0x5'));var ejs=require(_0xd63a('0x6'));var fs=require('fs');var fs_extra=require(_0xd63a('0x7'));var _=require(_0xd63a('0x8'));var squel=require(_0xd63a('0x9'));var crypto=require('crypto');var jsforce=require(_0xd63a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd63a('0x5'));var querystring=require('querystring');var Papa=require(_0xd63a('0xb'));var extract=require(_0xd63a('0xc'));var rimraf=require(_0xd63a('0x0'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd63a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd63a('0xe'));var logger=require(_0xd63a('0xf'))('api');var utils=require(_0xd63a('0x10'));var config=require(_0xd63a('0x11'));var licenseUtil=require(_0xd63a('0x12'));var db=require(_0xd63a('0x13'))['db'];config[_0xd63a('0x14')]=_[_0xd63a('0x15')](config[_0xd63a('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xd63a('0x16'))(new Redis(config[_0xd63a('0x14')]));require(_0xd63a('0x17'))[_0xd63a('0x18')](socket);function respondWithStatusCode(_0x1284cf,_0x2c4ff8){_0x2c4ff8=_0x2c4ff8||0xcc;return function(_0x2d9b2b){if(_0x2d9b2b){return _0x1284cf['sendStatus'](_0x2c4ff8);}return _0x1284cf[_0xd63a('0x19')](_0x2c4ff8)['end']();};}function respondWithResult(_0x11c164,_0x12ba93){_0x12ba93=_0x12ba93||0xc8;return function(_0x3cb525){if(_0x3cb525){return _0x11c164[_0xd63a('0x19')](_0x12ba93)[_0xd63a('0x1a')](_0x3cb525);}};}function respondWithFilteredResult(_0x156e9d,_0x23bdc8){return function(_0x10a3ea){if(_0x10a3ea){var _0x4a02e8=typeof _0x23bdc8[_0xd63a('0x1b')]==='undefined'&&typeof _0x23bdc8[_0xd63a('0x1c')]===_0xd63a('0x1d');var _0x529f8e=_0x10a3ea['count'];var _0x39c30f=_0x4a02e8?0x0:_0x23bdc8[_0xd63a('0x1b')];var _0x1eccf6=_0x4a02e8?_0x10a3ea[_0xd63a('0x1e')]:_0x23bdc8['offset']+_0x23bdc8[_0xd63a('0x1c')];var _0x36dd33;if(_0x1eccf6>=_0x529f8e){_0x1eccf6=_0x529f8e;_0x36dd33=0xc8;}else{_0x36dd33=0xce;}_0x156e9d[_0xd63a('0x19')](_0x36dd33);return _0x156e9d[_0xd63a('0x1f')]('Content-Range',_0x39c30f+'-'+_0x1eccf6+'/'+_0x529f8e)[_0xd63a('0x1a')](_0x10a3ea);}return null;};}function patchUpdates(_0x5059c8){return function(_0x1c19c2){try{jsonpatch[_0xd63a('0x20')](_0x1c19c2,_0x5059c8,!![]);}catch(_0x5e3148){return BPromise[_0xd63a('0x21')](_0x5e3148);}return _0x1c19c2[_0xd63a('0x22')]();};}function saveUpdates(_0x1924c6,_0x5689bf){return function(_0x50ea2d){if(_0x50ea2d){return _0x50ea2d[_0xd63a('0x23')](_0x1924c6)['then'](function(_0x4e56be){return _0x4e56be;});}return null;};}function removeEntity(_0x184ea8,_0x26462c){return function(_0x12b1b4){if(_0x12b1b4){return _0x12b1b4[_0xd63a('0x24')]()[_0xd63a('0x25')](function(){var _0x14ada0=_0x12b1b4['get']({'plain':!![]});var _0x2ffd64='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x2ffd64,'resourceId':_0x14ada0['id']}})['then'](function(){return _0x12b1b4;});})[_0xd63a('0x25')](function(){_0x184ea8[_0xd63a('0x19')](0xcc)[_0xd63a('0x26')]();});}};}function handleEntityNotFound(_0x8409ae,_0x2b1a0d){return function(_0x5dd045){if(!_0x5dd045){_0x8409ae[_0xd63a('0x27')](0x194);}return _0x5dd045;};}function handleError(_0x12ddb5,_0x2735af){_0x2735af=_0x2735af||0x1f4;return function(_0x403911){logger[_0xd63a('0x28')](_0x403911[_0xd63a('0x29')]);if(_0x403911['name']){delete _0x403911['name'];}_0x12ddb5[_0xd63a('0x19')](_0x2735af)[_0xd63a('0x2a')](_0x403911);};}exports['index']=function(_0x23c274,_0x539ec6){var _0x5db20c={},_0x4e8030={},_0x5ab122={'count':0x0,'rows':[]};var _0x44dc9c=_['map'](db[_0xd63a('0x2b')][_0xd63a('0x2c')],function(_0x58dded){return{'name':_0x58dded[_0xd63a('0x2d')],'type':_0x58dded[_0xd63a('0x2e')]['key']};});_0x4e8030[_0xd63a('0x2f')]=_[_0xd63a('0x30')](_0x44dc9c,'name');_0x4e8030[_0xd63a('0x31')]=_[_0xd63a('0x32')](_0x23c274[_0xd63a('0x31')]);_0x4e8030['filters']=_[_0xd63a('0x33')](_0x4e8030[_0xd63a('0x2f')],_0x4e8030[_0xd63a('0x31')]);_0x5db20c[_0xd63a('0x34')]=_[_0xd63a('0x33')](_0x4e8030[_0xd63a('0x2f')],qs[_0xd63a('0x35')](_0x23c274[_0xd63a('0x31')][_0xd63a('0x35')]));_0x5db20c['attributes']=_0x5db20c[_0xd63a('0x34')][_0xd63a('0x36')]?_0x5db20c['attributes']:_0x4e8030[_0xd63a('0x2f')];if(!_0x23c274[_0xd63a('0x31')][_0xd63a('0x37')](_0xd63a('0x38'))){_0x5db20c[_0xd63a('0x1c')]=qs[_0xd63a('0x1c')](_0x23c274[_0xd63a('0x31')]['limit']);_0x5db20c['offset']=qs[_0xd63a('0x1b')](_0x23c274[_0xd63a('0x31')]['offset']);}_0x5db20c[_0xd63a('0x39')]=qs[_0xd63a('0x3a')](_0x23c274['query'][_0xd63a('0x3a')]);_0x5db20c[_0xd63a('0x3b')]=qs['filters'](_[_0xd63a('0x3c')](_0x23c274[_0xd63a('0x31')],_0x4e8030[_0xd63a('0x3d')]),_0x44dc9c);if(_0x23c274[_0xd63a('0x31')][_0xd63a('0x3e')]){_0x5db20c[_0xd63a('0x3b')]=_[_0xd63a('0x3f')](_0x5db20c[_0xd63a('0x3b')],{'$or':_[_0xd63a('0x30')](_0x44dc9c,function(_0x1a65b4){if(_0x1a65b4[_0xd63a('0x2e')]!==_0xd63a('0x40')){var _0x2d2112={};_0x2d2112[_0x1a65b4[_0xd63a('0x41')]]={'$like':'%'+_0x23c274[_0xd63a('0x31')]['filter']+'%'};return _0x2d2112;}})});}_0x5db20c=_[_0xd63a('0x3f')]({},_0x5db20c,_0x23c274[_0xd63a('0x42')]);var _0x5e137c={'where':_0x5db20c[_0xd63a('0x3b')]};return db[_0xd63a('0x2b')][_0xd63a('0x1e')](_0x5e137c)[_0xd63a('0x25')](function(_0x3a560d){_0x5ab122[_0xd63a('0x1e')]=_0x3a560d;if(_0x23c274[_0xd63a('0x31')]['includeAll']){_0x5db20c['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x5db20c);})[_0xd63a('0x25')](function(_0x45241d){_0x5ab122[_0xd63a('0x43')]=_0x45241d;return _0x5ab122;})['then'](respondWithFilteredResult(_0x539ec6,_0x5db20c))[_0xd63a('0x44')](handleError(_0x539ec6,null));};exports[_0xd63a('0x45')]=function(_0x38abd0,_0xfa71bb){var _0x32f5c1={'raw':!![],'where':{'id':_0x38abd0['params']['id']}},_0x1c5993={};_0x1c5993[_0xd63a('0x2f')]=_[_0xd63a('0x32')](db[_0xd63a('0x2b')][_0xd63a('0x2c')]);_0x1c5993['query']=_[_0xd63a('0x32')](_0x38abd0[_0xd63a('0x31')]);_0x1c5993[_0xd63a('0x3d')]=_[_0xd63a('0x33')](_0x1c5993[_0xd63a('0x2f')],_0x1c5993[_0xd63a('0x31')]);_0x32f5c1['attributes']=_[_0xd63a('0x33')](_0x1c5993['model'],qs['fields'](_0x38abd0[_0xd63a('0x31')]['fields']));_0x32f5c1[_0xd63a('0x34')]=_0x32f5c1[_0xd63a('0x34')][_0xd63a('0x36')]?_0x32f5c1['attributes']:_0x1c5993[_0xd63a('0x2f')];if(_0x38abd0[_0xd63a('0x31')]['includeAll']){_0x32f5c1[_0xd63a('0x46')]=[{'all':!![]}];}_0x32f5c1=_['merge']({},_0x32f5c1,_0x38abd0['options']);return db[_0xd63a('0x2b')][_0xd63a('0x47')](_0x32f5c1)[_0xd63a('0x25')](handleEntityNotFound(_0xfa71bb,null))['then'](respondWithResult(_0xfa71bb,null))[_0xd63a('0x44')](handleError(_0xfa71bb,null));};exports[_0xd63a('0x48')]=function(_0x33fcca,_0x1f1294,_0x11fa4d){return db[_0xd63a('0x2b')][_0xd63a('0x47')]({'where':{'id':_0x33fcca['params']['id']},'attributes':[_0xd63a('0x41'),_0xd63a('0x49')],'raw':!![]})[_0xd63a('0x25')](handleEntityNotFound(_0x1f1294,null))['then'](function(_0x3856ee){if(_0x3856ee){var _0x590ab1=path[_0xd63a('0x4a')](config[_0xd63a('0x4b')],_0xd63a('0x4c'),util[_0xd63a('0x4d')](_0xd63a('0x4e'),path['basename'](_0x3856ee[_0xd63a('0x49')])));var _0x514331=fs['createWriteStream'](_0x590ab1);var _0x1ebac2=archiver(_0xd63a('0x4f'),{'zlib':{'level':0x9}});_0x1ebac2['on'](_0xd63a('0x50'),function(_0x12a8e4){if(_0x12a8e4['code']==='ENOENT'){logger[_0xd63a('0x28')](_0x12a8e4);}else{throw new db[(_0xd63a('0x51'))][(_0xd63a('0x52'))](_0xd63a('0x53'));}});_0x1ebac2['on'](_0xd63a('0x28'),function(_0x111d3e){throw new db[(_0xd63a('0x51'))][(_0xd63a('0x52'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x1ebac2[_0xd63a('0x54')](_0x514331);_0x1ebac2[_0xd63a('0x55')](_0xd63a('0x56'),{'cwd':path[_0xd63a('0x4a')](config['root'],'server/files/plugins',path[_0xd63a('0x57')](_0x3856ee[_0xd63a('0x49')])),'ignore':[path[_0xd63a('0x4a')](path[_0xd63a('0x58')](_0x3856ee[_0xd63a('0x49')]),_0xd63a('0x59')),path['join'](path['basename'](_0x3856ee[_0xd63a('0x49')]),_0xd63a('0x5a'))],'nodir':!![]})[_0xd63a('0x5b')]();_0x514331['on']('close',function(){if(!fs['existsSync'](_0x590ab1)){throw new db[(_0xd63a('0x51'))][(_0xd63a('0x52'))](_0xd63a('0x5c'));}return _0x1f1294[_0xd63a('0x48')](_0x590ab1,util[_0xd63a('0x4d')](_0xd63a('0x4e'),path[_0xd63a('0x58')](_0x3856ee[_0xd63a('0x49')])),function(_0x56dddd){if(_0x56dddd){throw new db[(_0xd63a('0x51'))][(_0xd63a('0x52'))](_0xd63a('0x5d'));}fs['unlinkSync'](_0x590ab1);logger[_0xd63a('0x5e')]('Download\x20completed');logger['info'](_0xd63a('0x5f'));});});}return null;})[_0xd63a('0x44')](handleError(_0x1f1294,null));};exports[_0xd63a('0x60')]=function(_0x4a4fa5,_0x2ea550,_0xe07ff4){var _0x437e6a=path[_0xd63a('0x58')](_0x4a4fa5['file']['filename'],path['extname'](_0x4a4fa5[_0xd63a('0x61')]['filename']));var _0x45fe68=path[_0xd63a('0x4a')](config['root'],_0xd63a('0x4c'),_0x4a4fa5[_0xd63a('0x61')][_0xd63a('0x62')]);var _0x1ad826=path[_0xd63a('0x4a')](config['root'],_0xd63a('0x4c'),_0x437e6a);logger['info'](_0xd63a('0x63'),_0x45fe68);logger[_0xd63a('0x5e')](_0xd63a('0x64'),_0x1ad826);try{fs[_0xd63a('0x65')](_0x45fe68,parseInt('0777',0x8));extract(_0x45fe68,{'dir':_0x1ad826},function(_0x4b402d){if(_0x4b402d){logger[_0xd63a('0x28')](_0x4b402d);handleError(_0x4b402d,!![]);};var _0x1134b0=fs['readdirSync'](_0x1ad826);if(_0x1134b0['length']>0x1){removeReferences(_0x45fe68,_0x1ad826);logger[_0xd63a('0x28')]('Invalid\x20plugin\x20structure');return _0xe07ff4(new Error(_0xd63a('0x66')));}var _0x212934=fs[_0xd63a('0x67')](path[_0xd63a('0x4a')](_0x1ad826,_0x1134b0[0x0]));if(_0x212934['isFile']()){removeReferences(_0x45fe68,_0x1ad826);logger[_0xd63a('0x28')](_0xd63a('0x66'));return _0xe07ff4(new Error(_0xd63a('0x66')));}if(_0x212934[_0xd63a('0x68')]()){var _0xe9b54b=fs[_0xd63a('0x69')](path[_0xd63a('0x4a')](_0x1ad826,_0x1134b0[0x0]));if(_0xe9b54b[_0xd63a('0x36')]===0x0){removeReferences(_0x45fe68,_0x1ad826);logger['error'](_0xd63a('0x66'));return _0xe07ff4(new Error(_0xd63a('0x66')));}var _0x589d96=_0xe9b54b[_0xd63a('0x6a')](function(_0x54b47a){return _0x54b47a===_0xd63a('0x6b');});if(!_0x589d96){return _0xe07ff4(new Error(_0xd63a('0x6c')));}var _0x9d3634=fs[_0xd63a('0x6d')](path[_0xd63a('0x4a')](_0x1ad826,_0x1134b0[0x0],_0xd63a('0x6b')));var _0x2a6ce4=JSON[_0xd63a('0x6e')](_0x9d3634);if(_0xd63a('0x1d')==typeof _0x2a6ce4[_0xd63a('0x41')]){return _0xe07ff4(new Error(_0xd63a('0x6f')));}if('undefined'==typeof _0x2a6ce4[_0xd63a('0x2e')]){return _0xe07ff4(new Error(_0xd63a('0x70')));}if('undefined'==typeof _0x2a6ce4[_0xd63a('0x71')]){return _0xe07ff4(new Error(_0xd63a('0x72')));}if(_0xd63a('0x1d')==typeof _0x2a6ce4[_0xd63a('0x73')]){return _0xe07ff4(new Error(_0xd63a('0x74')));}if(_0x2a6ce4['type']==='html'){if('undefined'==typeof _0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')]){return _0xe07ff4(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')][_0xd63a('0x76')]&&_0xd63a('0x1d')==typeof _0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')][_0xd63a('0x77')]){return _0xe07ff4(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x2a6ce4[_0xd63a('0x2e')]===_0xd63a('0x78')){if('undefined'==typeof _0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x79')]){return _0xe07ff4(new Error(_0xd63a('0x7a')));}if(_0xd63a('0x1d')==typeof _0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x7b')]){return _0xe07ff4(new Error(_0xd63a('0x7c')));}}else{return _0xe07ff4(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x104165=_0x2a6ce4[_0xd63a('0x41')];var _0x10abaa=_0x2a6ce4['description'];var _0x10dc2e=_0x2a6ce4[_0xd63a('0x2e')];var _0x1f09f9=_0x2a6ce4[_0xd63a('0x7d')]?_0x2a6ce4[_0xd63a('0x7d')]:'always';var _0x5a7d85=_0x2a6ce4[_0xd63a('0x7e')]?_0x2a6ce4[_0xd63a('0x7e')]:'icon-apps';var _0x3e5b24='';var _0x49d40e='';var _0x29bd42='';var _0x4db37b='';var _0x550cf5=_0x2a6ce4['version'];if(_0x10dc2e==='html'){if('undefined'!=typeof _0x2a6ce4[_0xd63a('0x73')]['views'][_0xd63a('0x76')]){var _0x87849d=_0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')][_0xd63a('0x76')];if(!/^(f|ht)tps?:\/\//i[_0xd63a('0x7f')](_0x87849d)){_0x3e5b24=path[_0xd63a('0x4a')](_0xd63a('0x80'),_0x437e6a,_0x1134b0[0x0],_0x87849d);}else{_0x3e5b24=_0x87849d;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x2a6ce4['parameters'][_0xd63a('0x75')]['agent']){var _0xe90e5b=_0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')][_0xd63a('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xd63a('0x7f')](_0xe90e5b)){_0x49d40e=path[_0xd63a('0x4a')]('plugins',_0x437e6a,_0x1134b0[0x0],_0xe90e5b);}else{_0x49d40e=_0xe90e5b;}}else{logger[_0xd63a('0x5e')](_0xd63a('0x81'));}}else if(_0x10dc2e===_0xd63a('0x78')){_0x29bd42=_0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x79')];_0x4db37b=_0x2a6ce4['parameters'][_0xd63a('0x7b')];if(_0xd63a('0x1d')!=typeof _0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')]){if(_0xd63a('0x1d')!=typeof _0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')]['admin']){var _0x87849d=_0x2a6ce4[_0xd63a('0x73')]['views'][_0xd63a('0x76')];if(!/^(f|ht)tps?:\/\//i['test'](_0x87849d)){_0x3e5b24=path['join'](_0xd63a('0x80'),_0x437e6a,_0x1134b0[0x0],_0x87849d);}else{_0x3e5b24=_0x87849d;}}if(_0xd63a('0x1d')!=typeof _0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')][_0xd63a('0x77')]){var _0xe90e5b=_0x2a6ce4[_0xd63a('0x73')][_0xd63a('0x75')][_0xd63a('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xd63a('0x7f')](_0xe90e5b)){_0x49d40e=path[_0xd63a('0x4a')]('plugins',_0x437e6a,_0x1134b0[0x0],_0xe90e5b);}else{_0x49d40e=_0xe90e5b;}}}}var _0x2b8761={'name':_0x104165,'description':_0x10abaa,'path':path[_0xd63a('0x4a')](_0x437e6a,_0x1134b0[0x0]),'type':_0x10dc2e,'sidebar':_0x1f09f9,'icon':_0x5a7d85,'adminUrl':_0x3e5b24,'agentUrl':_0x49d40e,'scriptName':_0x29bd42,'scriptPath':_0x4db37b,'version':_0x550cf5};removeReferences(_0x45fe68,null);return db[_0xd63a('0x2b')][_0xd63a('0x82')](_0x2b8761)[_0xd63a('0x25')](function(_0x11d163){var _0x17cc95={'role':_0x4a4fa5[_0xd63a('0x83')]['role'],'userProfileId':_0x4a4fa5['body'][_0xd63a('0x84')]};if(!_0x17cc95)throw new Error(_0xd63a('0x85'));if(_0x17cc95['role']==='user'){var _0x12cf89=_0x11d163[_0xd63a('0x86')]({'plain':!![]});return db[_0xd63a('0x87')]['find']({'where':{'name':_0xd63a('0x88'),'userProfileId':_0x17cc95[_0xd63a('0x84')]},'raw':!![]})['then'](function(_0x1bbe0e){if(_0x1bbe0e&&_0x1bbe0e[_0xd63a('0x89')]===0x0){return db[_0xd63a('0x8a')][_0xd63a('0x82')]({'name':_0x12cf89[_0xd63a('0x41')],'resourceId':_0x12cf89['id'],'type':_0x1bbe0e['name'],'sectionId':_0x1bbe0e['id']},{})[_0xd63a('0x25')](function(){return _0x11d163;});}else{return _0x11d163;}})[_0xd63a('0x44')](function(_0x1d20e6){logger[_0xd63a('0x28')](_0xd63a('0x8b'),_0x1d20e6);throw _0x1d20e6;});}return _0x11d163;})[_0xd63a('0x25')](respondWithResult(_0x2ea550,null))[_0xd63a('0x44')](handleError(_0x2ea550,null));}});}catch(_0x4a17da){_0x2ea550[_0xd63a('0x19')](0x1f4)[_0xd63a('0x2a')](_0x4a17da);}};function removeReferences(_0xe23652,_0x1e31f1){try{if(_0xe23652){fs[_0xd63a('0x8c')](_0xe23652);logger[_0xd63a('0x5e')](_0xd63a('0x8d'));}if(_0x1e31f1){rimraf(_0x1e31f1,function(){});logger[_0xd63a('0x5e')](_0xd63a('0x8e'));}}catch(_0x32b367){logger[_0xd63a('0x28')](_0x32b367);}}exports['update']=function(_0x3437e3,_0x5dbd33,_0x50e5ce){return db[_0xd63a('0x2b')][_0xd63a('0x47')]({'where':{'id':_0x3437e3['params']['id']}})[_0xd63a('0x25')](handleEntityNotFound(_0x5dbd33,null))[_0xd63a('0x25')](saveUpdates(_0x3437e3[_0xd63a('0x83')],null))[_0xd63a('0x25')](respondWithResult(_0x5dbd33,null))['catch'](handleError(_0x5dbd33,null));};exports[_0xd63a('0x8f')]=function(_0x37d85d,_0x583d63,_0xd9e96e){return db[_0xd63a('0x2b')][_0xd63a('0x47')]({'where':{'id':_0x37d85d[_0xd63a('0x90')]['id']}})[_0xd63a('0x25')](function(_0x3a6b4b){if(_0x3a6b4b){return _0x3a6b4b[_0xd63a('0x24')]();}})[_0xd63a('0x25')](function(_0x182080){rimraf(path[_0xd63a('0x4a')](config[_0xd63a('0x4b')],_0xd63a('0x4c'),path[_0xd63a('0x57')](_0x182080[_0xd63a('0x49')])),function(){});return _0x182080;})[_0xd63a('0x25')](handleEntityNotFound(_0x583d63,null))[_0xd63a('0x25')](respondWithStatusCode(_0x583d63,null))['catch'](handleError(_0x583d63,null));};exports[_0xd63a('0x91')]=function(_0x55bf4d,_0xa2eba7,_0x59fccc){return BPromise[_0xd63a('0x92')]()['then'](function(){if(!_0x55bf4d['query'][_0xd63a('0x49')]){throw new Error(_0xd63a('0x93'));}if(!_0x55bf4d[_0xd63a('0x31')]['port']){throw new Error(_0xd63a('0x94'));}var _0x550998=_0x55bf4d[_0xd63a('0x31')][_0xd63a('0x95')]?_0x55bf4d[_0xd63a('0x31')][_0xd63a('0x95')]+':'+_0x55bf4d[_0xd63a('0x31')][_0xd63a('0x96')]:_0xd63a('0x97')+_0x55bf4d[_0xd63a('0x31')][_0xd63a('0x96')];var _0x596174=_0x55bf4d['query'][_0xd63a('0x1a')]?_0x55bf4d[_0xd63a('0x31')]['json']:!![];var _0x3087a2=_0x55bf4d[_0xd63a('0x31')][_0xd63a('0x98')]?_0x55bf4d[_0xd63a('0x31')][_0xd63a('0x98')]:null;var _0x13c218={'method':_0x55bf4d[_0xd63a('0x99')],'uri':util['format'](_0xd63a('0x9a'),_0x550998,_0x55bf4d[_0xd63a('0x31')]['path']),'json':_0x596174,'resolveWithFullResponse':!![],'encoding':_0x3087a2,'qs':_0x55bf4d[_0xd63a('0x31')]};if(_0x55bf4d[_0xd63a('0x9b')]){_0x13c218[_0xd63a('0x9b')]=_0x55bf4d[_0xd63a('0x9b')];if(_0x13c218[_0xd63a('0x9b')][_0xd63a('0x9c')]){delete _0x13c218[_0xd63a('0x9b')][_0xd63a('0x9c')];}}if(_0x13c218[_0xd63a('0x9b')][_0xd63a('0x9d')]){delete _0x13c218[_0xd63a('0x9b')][_0xd63a('0x9d')];}return rp(_0x13c218);})['then'](function(_0x21f0bb){if(_0x21f0bb){_0xa2eba7[_0xd63a('0x1f')](_0x21f0bb[_0xd63a('0x9b')]);logger['info'](_0x21f0bb[_0xd63a('0x83')]);if(_[_0xd63a('0x9e')](_0x55bf4d['query'][_0xd63a('0x49')],_0xd63a('0x48'))&&_0x21f0bb[_0xd63a('0x9f')]==0x1f4){return _0xa2eba7[_0xd63a('0x27')](_0x21f0bb['statusCode']);}else{return _0xa2eba7['status'](_0x21f0bb[_0xd63a('0x9f')])[_0xd63a('0x2a')](_0x21f0bb[_0xd63a('0x83')]);}}else{return _0xa2eba7['sendStatus'](0xc8);}})[_0xd63a('0x44')](handleError(_0xa2eba7,null));};exports[_0xd63a('0xa0')]=function(_0x4d69ed,_0x30d53e,_0x2de7e6){return BPromise[_0xd63a('0x92')]()[_0xd63a('0x25')](function(){if(!_0x4d69ed[_0xd63a('0x31')][_0xd63a('0x49')]){throw new Error(_0xd63a('0x93'));}if(!_0x4d69ed[_0xd63a('0x31')][_0xd63a('0x96')]){throw new Error(_0xd63a('0x94'));}var _0x3ee5d2=_0x4d69ed[_0xd63a('0x31')][_0xd63a('0x95')]?_0x4d69ed[_0xd63a('0x31')]['hostname']+':'+_0x4d69ed[_0xd63a('0x31')]['port']:_0xd63a('0x97')+_0x4d69ed[_0xd63a('0x31')][_0xd63a('0x96')];var _0x1cea98=_0x4d69ed['query'][_0xd63a('0x1a')]?_0x4d69ed[_0xd63a('0x31')][_0xd63a('0x1a')]:!![];var _0x3f8d1c=_0x4d69ed['query']['encoding']?_0x4d69ed[_0xd63a('0x31')][_0xd63a('0x98')]:null;var _0x1a1b31={'method':_0x4d69ed['method'],'uri':util[_0xd63a('0x4d')](_0xd63a('0x9a'),_0x3ee5d2,_0x4d69ed[_0xd63a('0x31')][_0xd63a('0x49')]),'json':_0x1cea98,'resolveWithFullResponse':!![],'encoding':_0x3f8d1c,'body':_0x4d69ed[_0xd63a('0x83')]};if(_0x4d69ed[_0xd63a('0x9b')]){_0x1a1b31[_0xd63a('0x9b')]=_0x4d69ed[_0xd63a('0x9b')];if(_0x1a1b31[_0xd63a('0x9b')][_0xd63a('0x9c')]){delete _0x1a1b31[_0xd63a('0x9b')][_0xd63a('0x9c')];}}if(_0x1a1b31[_0xd63a('0x9b')][_0xd63a('0x9d')]){delete _0x1a1b31[_0xd63a('0x9b')][_0xd63a('0x9d')];}return rp(_0x1a1b31);})['then'](function(_0x38ee8a){if(_0x38ee8a){_0x30d53e[_0xd63a('0x1f')](_0x38ee8a[_0xd63a('0x9b')]);logger['info'](_0x38ee8a[_0xd63a('0x83')]);return _0x30d53e[_0xd63a('0x19')](_0x38ee8a[_0xd63a('0x9f')])[_0xd63a('0x2a')](_0x38ee8a[_0xd63a('0x83')]);}else{return _0x30d53e[_0xd63a('0x27')](0xc8);}})['catch'](handleError(_0x30d53e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3336519..6a64a93 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 _0x524e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','Plugin'];(function(_0x1955fa,_0x407016){var _0x23a5e4=function(_0x33b00d){while(--_0x33b00d){_0x1955fa['push'](_0x1955fa['shift']());}};_0x23a5e4(++_0x407016);}(_0x524e,0x15e));var _0xe524=function(_0x15f63e,_0x148e2e){_0x15f63e=_0x15f63e-0x0;var _0x3a6bf0=_0x524e[_0x15f63e];return _0x3a6bf0;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0xe524('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0xe524('0x1')](0x0);var events={'afterCreate':_0xe524('0x2'),'afterUpdate':_0xe524('0x3'),'afterDestroy':_0xe524('0x4')};function emitEvent(_0x379eb1){return function(_0xabd694,_0x32c90b,_0x10d37a){PluginEvents[_0xe524('0x5')](_0x379eb1+':'+_0xabd694['id'],_0xabd694);PluginEvents['emit'](_0x379eb1,_0xabd694);_0x10d37a(null);};}for(var e in events){if(events[_0xe524('0x6')](e)){var event=events[e];Plugin[_0xe524('0x7')](e,emitEvent(event));}}module[_0xe524('0x8')]=PluginEvents; \ No newline at end of file +var _0x5204=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5204,0xdf));var _0x4520=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x5204[_0xb65e77];return _0x38134b;};'use strict';var EventEmitter=require(_0x4520('0x0'));var Plugin=require(_0x4520('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x4520('0x2')](0x0);var events={'afterCreate':_0x4520('0x3'),'afterUpdate':_0x4520('0x4'),'afterDestroy':_0x4520('0x5')};function emitEvent(_0x3db6fc){return function(_0x592fe0,_0x41d89c,_0x58b8a8){PluginEvents[_0x4520('0x6')](_0x3db6fc+':'+_0x592fe0['id'],_0x592fe0);PluginEvents[_0x4520('0x6')](_0x3db6fc,_0x592fe0);_0x58b8a8(null);};}for(var e in events){if(events[_0x4520('0x7')](e)){var event=events[e];Plugin[_0x4520('0x8')](e,emitEvent(event));}}module[_0x4520('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 821b6dd..95ce15f 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 _0x81bd=['../../config/environment','./plugin.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x56b31d,_0x58b0f5){var _0x674191=function(_0x97944b){while(--_0x97944b){_0x56b31d['push'](_0x56b31d['shift']());}};_0x674191(++_0x58b0f5);}(_0x81bd,0x7c));var _0xd81b=function(_0x9ab282,_0x224526){_0x9ab282=_0x9ab282-0x0;var _0x3ae406=_0x81bd[_0x9ab282];return _0x3ae406;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['define','Plugin','plugins','util','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x244726,_0x46ed32){var _0x85bab9=function(_0x4cd3ab){while(--_0x4cd3ab){_0x244726['push'](_0x244726['shift']());}};_0x85bab9(++_0x46ed32);}(_0x8958,0x93));var _0x8895=function(_0x599599,_0x5cc938){_0x599599=_0x599599-0x0;var _0x1dc922=_0x8958[_0x599599];return _0x1dc922;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'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 7c5e229..95cae8f 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 _0x805b=['body','raw','then','debug','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreatePlugin','Plugin','create'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x805b,0x13b));var _0xb805=function(_0x218f12,_0xbf0194){_0x218f12=_0x218f12-0x0;var _0x3f5dd0=_0x805b[_0x218f12];return _0x3f5dd0;};'use strict';var _=require(_0xb805('0x0'));var util=require('util');var moment=require(_0xb805('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb805('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb805('0x3'));var logger=require(_0xb805('0x4'))(_0xb805('0x5'));var config=require(_0xb805('0x6'));var jayson=require(_0xb805('0x7'));var client=jayson[_0xb805('0x8')][_0xb805('0x9')]({'port':0x232a});config[_0xb805('0xa')]=_[_0xb805('0xb')](config['redis'],{'host':_0xb805('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0xb805('0xd')](socket);function respondWithRpcPromise(_0x55ca0e,_0x36932e,_0x24a042){return new BPromise(function(_0x329dee,_0x3fa655){return client[_0xb805('0xe')](_0x55ca0e,_0x24a042)['then'](function(_0x567a39){logger[_0xb805('0xf')](_0xb805('0x10'),_0x36932e,'request\x20sent');logger['debug'](_0xb805('0x11'),_0x36932e,_0xb805('0x12'),JSON[_0xb805('0x13')](_0x567a39));if(_0x567a39['error']){if(_0x567a39['error']['code']===0x1f4){logger[_0xb805('0x14')]('Plugin,\x20%s,\x20%s',_0x36932e,_0x567a39[_0xb805('0x14')][_0xb805('0x15')]);return _0x3fa655(_0x567a39['error'][_0xb805('0x15')]);}logger['error'](_0xb805('0x10'),_0x36932e,_0x567a39[_0xb805('0x14')][_0xb805('0x15')]);return _0x329dee(_0x567a39[_0xb805('0x14')][_0xb805('0x15')]);}else{logger[_0xb805('0xf')](_0xb805('0x10'),_0x36932e,_0xb805('0x12'));_0x329dee(_0x567a39[_0xb805('0x16')][_0xb805('0x15')]);}})['catch'](function(_0x3a990f){logger[_0xb805('0x14')](_0xb805('0x10'),_0x36932e,_0x3a990f);_0x3fa655(_0x3a990f);});});}exports[_0xb805('0x17')]=function(_0x10b690){var _0x5f3600=this;return new Promise(function(_0x105594,_0x43a9e0){return db[_0xb805('0x18')][_0xb805('0x19')](_0x10b690[_0xb805('0x1a')],{'raw':_0x10b690['options']?_0x10b690['options'][_0xb805('0x1b')]===undefined?!![]:![]:!![]})[_0xb805('0x1c')](function(_0x475a73){logger[_0xb805('0xf')](_0xb805('0x17'),_0x10b690);logger[_0xb805('0x1d')](_0xb805('0x17'),_0x10b690,JSON[_0xb805('0x13')](_0x475a73));_0x105594(_0x475a73);})[_0xb805('0x1e')](function(_0x46b34d){logger[_0xb805('0x14')](_0xb805('0x17'),_0x46b34d[_0xb805('0x15')],_0x10b690);_0x43a9e0(_0x5f3600[_0xb805('0x14')](0x1f4,_0x46b34d[_0xb805('0x15')]));});});}; \ No newline at end of file +var _0xde88=['body','options','CreatePlugin','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','Plugin','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xde88,0x12c));var _0x8de8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xde88[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x8de8('0x0'));var moment=require(_0x8de8('0x1'));var BPromise=require(_0x8de8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8de8('0x3'));var db=require(_0x8de8('0x4'))['db'];var utils=require(_0x8de8('0x5'));var logger=require('../../config/logger')(_0x8de8('0x6'));var config=require(_0x8de8('0x7'));var jayson=require(_0x8de8('0x8'));var client=jayson[_0x8de8('0x9')][_0x8de8('0xa')]({'port':0x232a});config[_0x8de8('0xb')]=_[_0x8de8('0xc')](config[_0x8de8('0xb')],{'host':_0x8de8('0xd'),'port':0x18eb});var socket=require(_0x8de8('0xe'))(new Redis(config[_0x8de8('0xb')]));require(_0x8de8('0xf'))[_0x8de8('0x10')](socket);function respondWithRpcPromise(_0x42da69,_0x50e69e,_0xcb6424){return new BPromise(function(_0x1110da,_0x3b49c5){return client[_0x8de8('0x11')](_0x42da69,_0xcb6424)[_0x8de8('0x12')](function(_0x287762){logger['info'](_0x8de8('0x13'),_0x50e69e,'request\x20sent');logger['debug'](_0x8de8('0x14'),_0x50e69e,_0x8de8('0x15'),JSON['stringify'](_0x287762));if(_0x287762[_0x8de8('0x16')]){if(_0x287762[_0x8de8('0x16')][_0x8de8('0x17')]===0x1f4){logger[_0x8de8('0x16')](_0x8de8('0x13'),_0x50e69e,_0x287762['error'][_0x8de8('0x18')]);return _0x3b49c5(_0x287762['error'][_0x8de8('0x18')]);}logger[_0x8de8('0x16')]('Plugin,\x20%s,\x20%s',_0x50e69e,_0x287762[_0x8de8('0x16')][_0x8de8('0x18')]);return _0x1110da(_0x287762['error'][_0x8de8('0x18')]);}else{logger[_0x8de8('0x19')]('Plugin,\x20%s,\x20%s',_0x50e69e,'request\x20sent');_0x1110da(_0x287762[_0x8de8('0x1a')][_0x8de8('0x18')]);}})[_0x8de8('0x1b')](function(_0x5caf6a){logger[_0x8de8('0x16')](_0x8de8('0x13'),_0x50e69e,_0x5caf6a);_0x3b49c5(_0x5caf6a);});});}exports['CreatePlugin']=function(_0x31c2cb){var _0x3cfc07=this;return new Promise(function(_0x26d319,_0x6f66b2){return db[_0x8de8('0x1c')][_0x8de8('0x1d')](_0x31c2cb[_0x8de8('0x1e')],{'raw':_0x31c2cb[_0x8de8('0x1f')]?_0x31c2cb[_0x8de8('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x8de8('0x12')](function(_0x27c8ed){logger['info']('CreatePlugin',_0x31c2cb);logger['debug'](_0x8de8('0x20'),_0x31c2cb,JSON['stringify'](_0x27c8ed));_0x26d319(_0x27c8ed);})[_0x8de8('0x1b')](function(_0x1c94e4){logger[_0x8de8('0x16')](_0x8de8('0x20'),_0x1c94e4[_0x8de8('0x18')],_0x31c2cb);_0x6f66b2(_0x3cfc07[_0x8de8('0x16')](0x1f4,_0x1c94e4[_0x8de8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b2b21c3..69724ff 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 _0xe54c=['register','./plugin.events','save','remove','update','emit'];(function(_0x10443f,_0x26da3a){var _0x48efad=function(_0x13f3b1){while(--_0x13f3b1){_0x10443f['push'](_0x10443f['shift']());}};_0x48efad(++_0x26da3a);}(_0xe54c,0x79));var _0xce54=function(_0x20006a,_0x30e3a9){_0x20006a=_0x20006a-0x0;var _0x5e26ac=_0xe54c[_0x20006a];return _0x5e26ac;};'use strict';var PluginEvents=require(_0xce54('0x0'));var events=[_0xce54('0x1'),_0xce54('0x2'),_0xce54('0x3')];function createListener(_0x1aa88f,_0xbed9ae){return function(_0x259aa2){_0xbed9ae[_0xce54('0x4')](_0x1aa88f,_0x259aa2);};}function removeListener(_0x55213c,_0x4472f5){return function(){PluginEvents['removeListener'](_0x55213c,_0x4472f5);};}exports[_0xce54('0x5')]=function(_0x2f47e9){for(var _0x48e7bb=0x0,_0x50941=events['length'];_0x48e7bb<_0x50941;_0x48e7bb++){var _0x2b192d=events[_0x48e7bb];var _0x2d9821=createListener('plugin:'+_0x2b192d,_0x2f47e9);PluginEvents['on'](_0x2b192d,_0x2d9821);}}; \ No newline at end of file +var _0xcc6d=['remove','update','register','length','plugin:','./plugin.events','save'];(function(_0x2793cc,_0x1973c4){var _0xc0505f=function(_0x1b330c){while(--_0x1b330c){_0x2793cc['push'](_0x2793cc['shift']());}};_0xc0505f(++_0x1973c4);}(_0xcc6d,0x1a9));var _0xdcc6=function(_0x5b3273,_0x281564){_0x5b3273=_0x5b3273-0x0;var _0x1b4032=_0xcc6d[_0x5b3273];return _0x1b4032;};'use strict';var PluginEvents=require(_0xdcc6('0x0'));var events=[_0xdcc6('0x1'),_0xdcc6('0x2'),_0xdcc6('0x3')];function createListener(_0x41f682,_0x4a6254){return function(_0x12c9da){_0x4a6254['emit'](_0x41f682,_0x12c9da);};}function removeListener(_0x51da16,_0x1354e5){return function(){PluginEvents['removeListener'](_0x51da16,_0x1354e5);};}exports[_0xdcc6('0x4')]=function(_0x562ed5){for(var _0x5d546a=0x0,_0x47ec37=events[_0xdcc6('0x5')];_0x5d546a<_0x47ec37;_0x5d546a++){var _0x47cc5a=events[_0x5d546a];var _0x393524=createListener(_0xdcc6('0x6')+_0x47cc5a,_0x562ed5);PluginEvents['on'](_0x47cc5a,_0x393524);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e2ae728..f22cc61 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 _0xb2c9=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb2c9,0x145));var _0x9b2c=function(_0x3f4f3b,_0x2d7be2){_0x3f4f3b=_0x3f4f3b-0x0;var _0xfc6f02=_0xb2c9[_0x3f4f3b];return _0xfc6f02;};'use strict';var express=require(_0x9b2c('0x0'));var router=express[_0x9b2c('0x1')]();var auth=require(_0x9b2c('0x2'));var controller=require(_0x9b2c('0x3'));router[_0x9b2c('0x4')]('/',auth[_0x9b2c('0x5')](),controller[_0x9b2c('0x6')]);router[_0x9b2c('0x4')](_0x9b2c('0x7'),auth[_0x9b2c('0x5')](),controller[_0x9b2c('0x8')]);router[_0x9b2c('0x9')]('/',auth[_0x9b2c('0x5')](),controller[_0x9b2c('0xa')]);router[_0x9b2c('0xb')](_0x9b2c('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x9b2c('0xc')](_0x9b2c('0x7'),auth[_0x9b2c('0x5')](),controller[_0x9b2c('0xd')]);module[_0x9b2c('0xe')]=router; \ No newline at end of file +var _0x922f=['create','put','update','delete','destroy','express','get','isAuthenticated','index','/:id','show','post'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x922f,0x101));var _0xf922=function(_0x585221,_0xb7e318){_0x585221=_0x585221-0x0;var _0x17111b=_0x922f[_0x585221];return _0x17111b;};'use strict';var express=require(_0xf922('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0xf922('0x1')]('/',auth[_0xf922('0x2')](),controller[_0xf922('0x3')]);router[_0xf922('0x1')](_0xf922('0x4'),auth[_0xf922('0x2')](),controller[_0xf922('0x5')]);router[_0xf922('0x6')]('/',auth['isAuthenticated'](),controller[_0xf922('0x7')]);router[_0xf922('0x8')]('/:id',auth[_0xf922('0x2')](),controller[_0xf922('0x9')]);router[_0xf922('0xa')](_0xf922('0x4'),auth[_0xf922('0x2')](),controller[_0xf922('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 8556882..07956fc 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 _0x4a2f=['send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','describe','params','body','script','cwd','chdir','dirname','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','bluebird','status','json','error','name'];(function(_0x4906da,_0x1cac45){var _0x4c2510=function(_0x1c3bc9){while(--_0x1c3bc9){_0x4906da['push'](_0x4906da['shift']());}};_0x4c2510(++_0x1cac45);}(_0x4a2f,0x182));var _0xf4a2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4a2f[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf4a2('0x0'));var pm2=require(_0xf4a2('0x1'));var logger=require(_0xf4a2('0x2'))('api');var path=require(_0xf4a2('0x3'));var exec=require(_0xf4a2('0x4'))['exec'];var BPromise=require(_0xf4a2('0x5'));function handleEntityNotFound(_0x560713,_0x577454){return function(_0x10595b){if(!_0x10595b){_0x560713['sendStatus'](0x194);;}return _0x10595b;};}function respondWithResult(_0x17f5aa,_0x4b3373){_0x4b3373=_0x4b3373||0xc8;return function(_0x1736a3){if(_0x1736a3){return _0x17f5aa[_0xf4a2('0x6')](_0x4b3373)[_0xf4a2('0x7')](_0x1736a3);}return null;};}function handleError(_0x255f77,_0x6ed9b9){_0x6ed9b9=_0x6ed9b9||0x1f4;return function(_0x14f160){logger[_0xf4a2('0x8')](_0x14f160['stack']);if(_0x14f160[_0xf4a2('0x9')]){delete _0x14f160[_0xf4a2('0x9')];}_0x255f77[_0xf4a2('0x6')](_0x6ed9b9)[_0xf4a2('0xa')](_0x14f160);};}function execChildProcess(){return new BPromise(function(_0x2fa9ef,_0x53016d){exec(_0xf4a2('0xb'),function(_0x1295b3,_0x147271,_0x381a7f){logger[_0xf4a2('0xc')](_0x147271);logger[_0xf4a2('0xc')](_0x381a7f);if(_0x1295b3){logger['error'](_0x1295b3);return _0x53016d(_0x1295b3);}return _0x2fa9ef(_0x147271);});});}exports[_0xf4a2('0xd')]=function(_0x3c84b0,_0x16f15e){return pm2[_0xf4a2('0xe')]()[_0xf4a2('0xf')](function(_0x59b6cf){if(_0x59b6cf){var _0x52bba9=_[_0xf4a2('0x10')](_0x59b6cf,function(_0x2d639f){return _0x2d639f['name']===_0xf4a2('0x11')||_0x2d639f['name']===_0xf4a2('0x12');});return{'rows':_0x52bba9,'count':_0x52bba9['length']};}return null;})[_0xf4a2('0xf')](respondWithResult(_0x16f15e,null))[_0xf4a2('0x13')](handleError(_0x16f15e,null));};exports[_0xf4a2('0x14')]=function(_0x3efe51,_0xdf012){return pm2[_0xf4a2('0x15')](_0x3efe51[_0xf4a2('0x16')]['id'])[_0xf4a2('0xf')](respondWithResult(_0xdf012,null))[_0xf4a2('0xf')](handleEntityNotFound(_0xdf012,null))[_0xf4a2('0x13')](handleError(_0xdf012,null));};exports['create']=function(_0x358ec3,_0x3f951e){if(_0x358ec3[_0xf4a2('0x17')][_0xf4a2('0x9')]&&_0x358ec3['body'][_0xf4a2('0x18')]){var _0x5e42fa=path['join'](__dirname,'../../files/plugins',_0x358ec3['body'][_0xf4a2('0x18')]);var _0x2ece81=process[_0xf4a2('0x19')]();process[_0xf4a2('0x1a')](path[_0xf4a2('0x1b')](_0x5e42fa));return execChildProcess()[_0xf4a2('0xf')](function(_0x521746){process['chdir'](_0x2ece81);return pm2['start']({'name':_0x358ec3['body']['name'],'script':_0x5e42fa});})[_0xf4a2('0xf')](function(_0x3303af){pm2['dump']();return _0x3303af[0x0];})['then'](respondWithResult(_0x3f951e,0xc9))[_0xf4a2('0x13')](handleError(_0x3f951e,null));}else{return _0x3f951e[_0xf4a2('0x6')](0x1f4)[_0xf4a2('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xf4a2('0x1c')]=function(_0x42933b,_0x38fbf7){if(_0x42933b[_0xf4a2('0x17')]['id']){delete _0x42933b[_0xf4a2('0x17')]['id'];}var _0x193b54={'online':_0xf4a2('0x1d'),'stopped':_0xf4a2('0x1e')};if(_0x193b54[_0xf4a2('0x1f')](_0x42933b['body'][_0xf4a2('0x6')])){return pm2[_0x193b54[_0x42933b['body'][_0xf4a2('0x6')]]](_0x42933b[_0xf4a2('0x16')]['id'])[_0xf4a2('0xf')](respondWithResult(_0x38fbf7,0xc8))[_0xf4a2('0x13')](handleError(_0x38fbf7,null));}else{return _0x38fbf7['status'](0x1f4)[_0xf4a2('0xa')]({'message':_0xf4a2('0x20')});}};exports['destroy']=function(_0x4a3220,_0x2fcf03){if(_0x4a3220[_0xf4a2('0x17')]['id']){delete _0x4a3220[_0xf4a2('0x17')]['id'];}if(_0x4a3220[_0xf4a2('0x16')]['id']){return pm2[_0xf4a2('0x21')](_0x4a3220[_0xf4a2('0x16')]['id'])[_0xf4a2('0xf')](function(_0x4c0511){pm2[_0xf4a2('0x22')]();return _0x4c0511[0x0];})['then'](respondWithResult(_0x2fcf03,null))['catch'](handleError(_0x2fcf03,null));}else{return _0x2fcf03['status'](0x1f4)[_0xf4a2('0xa')]({'message':_0xf4a2('0x23')});}}; \ No newline at end of file +var _0x89e9=['Unknown\x20status','delete','lodash','../../config/pm2','../../config/logger','api','path','bluebird','json','error','stack','name','status','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','update','stop','hasOwnProperty'];(function(_0x2f36d2,_0x24285c){var _0x147f7f=function(_0x41db50){while(--_0x41db50){_0x2f36d2['push'](_0x2f36d2['shift']());}};_0x147f7f(++_0x24285c);}(_0x89e9,0x16a));var _0x989e=function(_0x5e03a0,_0x5b6d14){_0x5e03a0=_0x5e03a0-0x0;var _0x313a99=_0x89e9[_0x5e03a0];return _0x313a99;};'use strict';var _=require(_0x989e('0x0'));var pm2=require(_0x989e('0x1'));var logger=require(_0x989e('0x2'))(_0x989e('0x3'));var path=require(_0x989e('0x4'));var exec=require('child_process')['exec'];var BPromise=require(_0x989e('0x5'));function handleEntityNotFound(_0x4d93cf,_0x508d59){return function(_0x1da975){if(!_0x1da975){_0x4d93cf['sendStatus'](0x194);;}return _0x1da975;};}function respondWithResult(_0x34b643,_0x5af973){_0x5af973=_0x5af973||0xc8;return function(_0x67e59e){if(_0x67e59e){return _0x34b643['status'](_0x5af973)[_0x989e('0x6')](_0x67e59e);}return null;};}function handleError(_0xb32064,_0x14eeae){_0x14eeae=_0x14eeae||0x1f4;return function(_0x30cc55){logger[_0x989e('0x7')](_0x30cc55[_0x989e('0x8')]);if(_0x30cc55[_0x989e('0x9')]){delete _0x30cc55[_0x989e('0x9')];}_0xb32064[_0x989e('0xa')](_0x14eeae)[_0x989e('0xb')](_0x30cc55);};}function execChildProcess(){return new BPromise(function(_0x2b457d,_0xba04c){exec(_0x989e('0xc'),function(_0x402c4d,_0x5eb45c,_0x3a8400){logger[_0x989e('0xd')](_0x5eb45c);logger[_0x989e('0xd')](_0x3a8400);if(_0x402c4d){logger[_0x989e('0x7')](_0x402c4d);return _0xba04c(_0x402c4d);}return _0x2b457d(_0x5eb45c);});});}exports[_0x989e('0xe')]=function(_0x2a9d4c,_0x286297){return pm2[_0x989e('0xf')]()[_0x989e('0x10')](function(_0x478656){if(_0x478656){var _0x4771ff=_[_0x989e('0x11')](_0x478656,function(_0x1153e6){return _0x1153e6[_0x989e('0x9')]===_0x989e('0x12')||_0x1153e6['name']===_0x989e('0x13');});return{'rows':_0x4771ff,'count':_0x4771ff[_0x989e('0x14')]};}return null;})[_0x989e('0x10')](respondWithResult(_0x286297,null))[_0x989e('0x15')](handleError(_0x286297,null));};exports[_0x989e('0x16')]=function(_0x2a7cf7,_0x42db67){return pm2[_0x989e('0x17')](_0x2a7cf7[_0x989e('0x18')]['id'])[_0x989e('0x10')](respondWithResult(_0x42db67,null))['then'](handleEntityNotFound(_0x42db67,null))['catch'](handleError(_0x42db67,null));};exports[_0x989e('0x19')]=function(_0x206e6e,_0x158326){if(_0x206e6e['body'][_0x989e('0x9')]&&_0x206e6e[_0x989e('0x1a')]['script']){var _0x404a60=path[_0x989e('0x1b')](__dirname,_0x989e('0x1c'),_0x206e6e[_0x989e('0x1a')][_0x989e('0x1d')]);var _0x130732=process[_0x989e('0x1e')]();process[_0x989e('0x1f')](path[_0x989e('0x20')](_0x404a60));return execChildProcess()[_0x989e('0x10')](function(_0x529c40){process['chdir'](_0x130732);return pm2[_0x989e('0x21')]({'name':_0x206e6e[_0x989e('0x1a')][_0x989e('0x9')],'script':_0x404a60});})['then'](function(_0x92b419){pm2[_0x989e('0x22')]();return _0x92b419[0x0];})[_0x989e('0x10')](respondWithResult(_0x158326,0xc9))['catch'](handleError(_0x158326,null));}else{return _0x158326[_0x989e('0xa')](0x1f4)[_0x989e('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x989e('0x23')]=function(_0x13e30a,_0x517fab){if(_0x13e30a[_0x989e('0x1a')]['id']){delete _0x13e30a[_0x989e('0x1a')]['id'];}var _0x33cd9b={'online':'restart','stopped':_0x989e('0x24')};if(_0x33cd9b[_0x989e('0x25')](_0x13e30a[_0x989e('0x1a')][_0x989e('0xa')])){return pm2[_0x33cd9b[_0x13e30a[_0x989e('0x1a')]['status']]](_0x13e30a[_0x989e('0x18')]['id'])['then'](respondWithResult(_0x517fab,0xc8))[_0x989e('0x15')](handleError(_0x517fab,null));}else{return _0x517fab[_0x989e('0xa')](0x1f4)['send']({'message':_0x989e('0x26')});}};exports['destroy']=function(_0x392056,_0x2edd47){if(_0x392056[_0x989e('0x1a')]['id']){delete _0x392056['body']['id'];}if(_0x392056[_0x989e('0x18')]['id']){return pm2[_0x989e('0x27')](_0x392056[_0x989e('0x18')]['id'])[_0x989e('0x10')](function(_0x94a350){pm2[_0x989e('0x22')]();return _0x94a350[0x0];})[_0x989e('0x10')](respondWithResult(_0x2edd47,null))['catch'](handleError(_0x2edd47,null));}else{return _0x2edd47['status'](0x1f4)[_0x989e('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 3f3b551..72971fb 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 _0xd547=['connect-timeout','express','Router','../../components/interaction/service','exports','path'];(function(_0x1256d1,_0xb3daf7){var _0x5c81b7=function(_0x1b4f16){while(--_0x1b4f16){_0x1256d1['push'](_0x1256d1['shift']());}};_0x5c81b7(++_0xb3daf7);}(_0xd547,0x1c1));var _0x7d54=function(_0x3e86d8,_0xaf6e5c){_0x3e86d8=_0x3e86d8-0x0;var _0x52daf1=_0xd547[_0x3e86d8];return _0x52daf1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7d54('0x0'));var timeout=require(_0x7d54('0x1'));var express=require(_0x7d54('0x2'));var router=express[_0x7d54('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7d54('0x4'));var config=require('../../config/environment');module[_0x7d54('0x5')]=router; \ No newline at end of file +var _0xa71c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x16afae,_0x56e1eb){var _0x231601=function(_0x25ee34){while(--_0x25ee34){_0x16afae['push'](_0x16afae['shift']());}};_0x231601(++_0x56e1eb);}(_0xa71c,0x12a));var _0xca71=function(_0x50624c,_0x1d1489){_0x50624c=_0x50624c-0x0;var _0x200201=_0xa71c[_0x50624c];return _0x200201;};'use strict';var multer=require(_0xca71('0x0'));var util=require(_0xca71('0x1'));var path=require(_0xca71('0x2'));var timeout=require(_0xca71('0x3'));var express=require(_0xca71('0x4'));var router=express['Router']();var fs_extra=require(_0xca71('0x5'));var auth=require(_0xca71('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca71('0x7'));module[_0xca71('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 66eceb7..a11ece5 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 _0x81a5=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x6609a7,_0x57c7f5){var _0x4e96c9=function(_0x9d5f8a){while(--_0x9d5f8a){_0x6609a7['push'](_0x6609a7['shift']());}};_0x4e96c9(++_0x57c7f5);}(_0x81a5,0x84));var _0x581a=function(_0xd14e18,_0x57a24a){_0xd14e18=_0xd14e18-0x0;var _0x346c62=_0x81a5[_0xd14e18];return _0x346c62;};'use strict';var Sequelize=require(_0x581a('0x0'));module[_0x581a('0x1')]={'state':{'type':Sequelize[_0x581a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x581a('0x3')]},'scheduledat':{'type':Sequelize[_0x581a('0x4')]},'uniqueid':{'type':Sequelize[_0x581a('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x581a('0x4')]},'ringtime':{'type':Sequelize[_0x581a('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x581a('0x3')]},'campaigntype':{'type':Sequelize[_0x581a('0x3')]},'membername':{'type':Sequelize[_0x581a('0x3')]}}; \ No newline at end of file +var _0x4590=['DATE','sequelize','INTEGER','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4590,0xe1));var _0x0459=function(_0x150792,_0x187824){_0x150792=_0x150792-0x0;var _0x5f2974=_0x4590[_0x150792];return _0x5f2974;};'use strict';var Sequelize=require(_0x0459('0x0'));module['exports']={'state':{'type':Sequelize[_0x0459('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0459('0x2')]},'scheduledat':{'type':Sequelize[_0x0459('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0459('0x3')]},'responsetime':{'type':Sequelize[_0x0459('0x3')]},'ringtime':{'type':Sequelize[_0x0459('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0459('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0459('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 55eb26f..ed422ea 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 _0x0762=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x6a7aba,_0x224b7f){var _0x4d5644=function(_0x59bc54){while(--_0x59bc54){_0x6a7aba['push'](_0x6a7aba['shift']());}};_0x4d5644(++_0x224b7f);}(_0x0762,0x7a));var _0x2076=function(_0x1a1b9d,_0x570841){_0x1a1b9d=_0x1a1b9d-0x0;var _0x1bfb73=_0x0762[_0x1a1b9d];return _0x1bfb73;};'use strict';var _=require(_0x2076('0x0'));var util=require(_0x2076('0x1'));var logger=require(_0x2076('0x2'))(_0x2076('0x3'));var moment=require('moment');var BPromise=require(_0x2076('0x4'));var rp=require(_0x2076('0x5'));var fs=require('fs');var path=require(_0x2076('0x6'));var rimraf=require('rimraf');var config=require(_0x2076('0x7'));var attributes=require(_0x2076('0x8'));module[_0x2076('0x9')]=function(_0xf040fd,_0x5c7ae1){return _0xf040fd[_0x2076('0xa')](_0x2076('0xb'),attributes,{'tableName':_0x2076('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6724=['rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','../../config/logger','api','bluebird','request-promise','path'];(function(_0x34be7c,_0x4a2ba1){var _0xcba663=function(_0x274061){while(--_0x274061){_0x34be7c['push'](_0x34be7c['shift']());}};_0xcba663(++_0x4a2ba1);}(_0x6724,0xd7));var _0x4672=function(_0x45577b,_0x2e438a){_0x45577b=_0x45577b-0x0;var _0x2f05b1=_0x6724[_0x45577b];return _0x2f05b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4672('0x0'))(_0x4672('0x1'));var moment=require('moment');var BPromise=require(_0x4672('0x2'));var rp=require(_0x4672('0x3'));var fs=require('fs');var path=require(_0x4672('0x4'));var rimraf=require(_0x4672('0x5'));var config=require(_0x4672('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x4672('0x7')]=function(_0x2b27c9,_0x2d6ea9){return _0x2b27c9[_0x4672('0x8')](_0x4672('0x9'),attributes,{'tableName':_0x4672('0xa'),'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 6e6f163..12a80a6 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 _0x86aa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','debug','catch','util','bluebird','randomstring'];(function(_0x45baac,_0x19fda3){var _0x28102c=function(_0x57faab){while(--_0x57faab){_0x45baac['push'](_0x45baac['shift']());}};_0x28102c(++_0x19fda3);}(_0x86aa,0x1c8));var _0xa86a=function(_0x7f56a3,_0x2ac5d3){_0x7f56a3=_0x7f56a3-0x0;var _0x57afda=_0x86aa[_0x7f56a3];return _0x57afda;};'use strict';var _=require('lodash');var util=require(_0xa86a('0x0'));var moment=require('moment');var BPromise=require(_0xa86a('0x1'));var rs=require(_0xa86a('0x2'));var fs=require('fs');var Redis=require(_0xa86a('0x3'));var db=require(_0xa86a('0x4'))['db'];var utils=require(_0xa86a('0x5'));var logger=require(_0xa86a('0x6'))(_0xa86a('0x7'));var config=require('../../config/environment');var jayson=require(_0xa86a('0x8'));var client=jayson[_0xa86a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cbb16,_0x444d1e,_0x188f75){return new BPromise(function(_0x5a2d01,_0x4f1f76){return client['request'](_0x3cbb16,_0x188f75)[_0xa86a('0xa')](function(_0x1b5391){logger['info'](_0xa86a('0xb'),_0x444d1e,'request\x20sent');logger['debug'](_0xa86a('0xc'),_0x444d1e,_0xa86a('0xd'),JSON[_0xa86a('0xe')](_0x1b5391));if(_0x1b5391[_0xa86a('0xf')]){if(_0x1b5391['error'][_0xa86a('0x10')]===0x1f4){logger['error'](_0xa86a('0xb'),_0x444d1e,_0x1b5391[_0xa86a('0xf')][_0xa86a('0x11')]);return _0x4f1f76(_0x1b5391[_0xa86a('0xf')][_0xa86a('0x11')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x444d1e,_0x1b5391[_0xa86a('0xf')][_0xa86a('0x11')]);return _0x5a2d01(_0x1b5391['error'][_0xa86a('0x11')]);}else{logger[_0xa86a('0x12')](_0xa86a('0xb'),_0x444d1e,_0xa86a('0xd'));_0x5a2d01(_0x1b5391[_0xa86a('0x13')][_0xa86a('0x11')]);}})['catch'](function(_0x3491f3){logger[_0xa86a('0xf')](_0xa86a('0xb'),_0x444d1e,_0x3491f3);_0x4f1f76(_0x3491f3);});});}exports[_0xa86a('0x14')]=function(_0xcb9bd3){var _0x1619cc=this;return new Promise(function(_0x23f959,_0x5ab296){return db[_0xa86a('0x15')][_0xa86a('0x16')](_0xcb9bd3['body'],{'raw':_0xcb9bd3[_0xa86a('0x17')]?_0xcb9bd3['options'][_0xa86a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4f1164){logger[_0xa86a('0x12')]('CreateReportAgentPreview',_0xcb9bd3);logger[_0xa86a('0x19')](_0xa86a('0x14'),_0xcb9bd3,JSON[_0xa86a('0xe')](_0x4f1164));_0x23f959(_0x4f1164);})[_0xa86a('0x1a')](function(_0x8ff4dd){logger[_0xa86a('0xf')]('CreateReportAgentPreview',_0x8ff4dd['message'],_0xcb9bd3);_0x5ab296(_0x1619cc[_0xa86a('0xf')](0x1f4,_0x8ff4dd[_0xa86a('0x11')]));});});}; \ No newline at end of file +var _0x5a0a=['then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','message','ReportAgentPreview,\x20%s,\x20%s','catch','CreateReportAgentPreview','create','body','options','raw'];(function(_0x1d88fd,_0x215042){var _0x1ca056=function(_0x49d669){while(--_0x49d669){_0x1d88fd['push'](_0x1d88fd['shift']());}};_0x1ca056(++_0x215042);}(_0x5a0a,0x160));var _0xa5a0=function(_0x1153c9,_0x156e57){_0x1153c9=_0x1153c9-0x0;var _0x4983c5=_0x5a0a[_0x1153c9];return _0x4983c5;};'use strict';var _=require(_0xa5a0('0x0'));var util=require('util');var moment=require(_0xa5a0('0x1'));var BPromise=require(_0xa5a0('0x2'));var rs=require(_0xa5a0('0x3'));var fs=require('fs');var Redis=require(_0xa5a0('0x4'));var db=require(_0xa5a0('0x5'))['db'];var utils=require(_0xa5a0('0x6'));var logger=require(_0xa5a0('0x7'))(_0xa5a0('0x8'));var config=require(_0xa5a0('0x9'));var jayson=require(_0xa5a0('0xa'));var client=jayson[_0xa5a0('0xb')][_0xa5a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59e5c7,_0x316c5a,_0x32acfb){return new BPromise(function(_0x3bc8c1,_0x23a6b4){return client[_0xa5a0('0xd')](_0x59e5c7,_0x32acfb)['then'](function(_0x37e1b9){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x316c5a,_0xa5a0('0xe'));logger[_0xa5a0('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x316c5a,_0xa5a0('0xe'),JSON[_0xa5a0('0x10')](_0x37e1b9));if(_0x37e1b9[_0xa5a0('0x11')]){if(_0x37e1b9['error']['code']===0x1f4){logger[_0xa5a0('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x316c5a,_0x37e1b9[_0xa5a0('0x11')][_0xa5a0('0x12')]);return _0x23a6b4(_0x37e1b9[_0xa5a0('0x11')]['message']);}logger[_0xa5a0('0x11')](_0xa5a0('0x13'),_0x316c5a,_0x37e1b9[_0xa5a0('0x11')][_0xa5a0('0x12')]);return _0x3bc8c1(_0x37e1b9[_0xa5a0('0x11')][_0xa5a0('0x12')]);}else{logger['info'](_0xa5a0('0x13'),_0x316c5a,_0xa5a0('0xe'));_0x3bc8c1(_0x37e1b9['result']['message']);}})[_0xa5a0('0x14')](function(_0x34c8aa){logger['error'](_0xa5a0('0x13'),_0x316c5a,_0x34c8aa);_0x23a6b4(_0x34c8aa);});});}exports[_0xa5a0('0x15')]=function(_0x40e59b){var _0x10beee=this;return new Promise(function(_0x5c66f8,_0x1b483c){return db['ReportAgentPreview'][_0xa5a0('0x16')](_0x40e59b[_0xa5a0('0x17')],{'raw':_0x40e59b[_0xa5a0('0x18')]?_0x40e59b[_0xa5a0('0x18')][_0xa5a0('0x19')]===undefined?!![]:![]:!![]})[_0xa5a0('0x1a')](function(_0x4e4fd4){logger['info'](_0xa5a0('0x15'),_0x40e59b);logger[_0xa5a0('0xf')]('CreateReportAgentPreview',_0x40e59b,JSON[_0xa5a0('0x10')](_0x4e4fd4));_0x5c66f8(_0x4e4fd4);})['catch'](function(_0x39c097){logger['error'](_0xa5a0('0x15'),_0x39c097[_0xa5a0('0x12')],_0x40e59b);_0x1b483c(_0x10beee[_0xa5a0('0x11')](0x1f4,_0x39c097[_0xa5a0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c4b55c1..9b00130 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 _0x8822=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/fax/queues','faxQueues'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x8822,0x131));var _0x2882=function(_0x130d61,_0x3bd66c){_0x130d61=_0x130d61-0x0;var _0xd362f0=_0x8822[_0x130d61];return _0xd362f0;};'use strict';var multer=require(_0x2882('0x0'));var util=require('util');var path=require(_0x2882('0x1'));var express=require(_0x2882('0x2'));var router=express[_0x2882('0x3')]();var auth=require(_0x2882('0x4'));var controller=require(_0x2882('0x5'));router['get']('/voice/channels',auth[_0x2882('0x6')](),controller['voiceChannels']);router[_0x2882('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x2882('0x6')](),controller[_0x2882('0x8')]);router[_0x2882('0x7')](_0x2882('0x9'),auth[_0x2882('0x6')](),controller[_0x2882('0xa')]);router['get'](_0x2882('0xb'),auth[_0x2882('0x6')](),controller[_0x2882('0xc')]);router[_0x2882('0x7')](_0x2882('0xd'),auth[_0x2882('0x6')](),controller[_0x2882('0xe')]);router[_0x2882('0x7')](_0x2882('0xf'),auth[_0x2882('0x6')](),controller[_0x2882('0x10')]);router[_0x2882('0x7')](_0x2882('0x11'),auth[_0x2882('0x6')](),controller[_0x2882('0x12')]);router[_0x2882('0x7')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x2882('0x13')]);router[_0x2882('0x7')]('/sms/queues',auth[_0x2882('0x6')](),controller[_0x2882('0x14')]);router[_0x2882('0x7')]('/whatsapp/queues',auth[_0x2882('0x6')](),controller['whatsappQueues']);router[_0x2882('0x7')](_0x2882('0x15'),auth[_0x2882('0x6')](),controller[_0x2882('0x16')]);router[_0x2882('0x7')](_0x2882('0x17'),auth[_0x2882('0x6')](),controller[_0x2882('0x18')]);router['get'](_0x2882('0x19'),auth[_0x2882('0x6')](),controller[_0x2882('0x1a')]);router[_0x2882('0x7')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x2882('0x1b')]);router[_0x2882('0x7')](_0x2882('0x1c'),auth['isAuthenticated'](),controller[_0x2882('0x1d')]);router[_0x2882('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x2882('0x6')](),controller[_0x2882('0x1e')]);router[_0x2882('0x7')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x2882('0x1f')]);router['put'](_0x2882('0x20'),auth['isAuthenticated'](),controller[_0x2882('0x21')]);router['get'](_0x2882('0x22'),auth[_0x2882('0x6')](),controller['outbound']);router[_0x2882('0x7')](_0x2882('0x23'),auth[_0x2882('0x6')](),controller[_0x2882('0x24')]);router['get'](_0x2882('0x25'),auth['isAuthenticated'](),controller[_0x2882('0x26')]);router[_0x2882('0x27')](_0x2882('0x28'),auth[_0x2882('0x6')](),controller['agentCapacity']);router[_0x2882('0x7')](_0x2882('0x29'),auth['isAuthenticated'](),controller[_0x2882('0x2a')]);router[_0x2882('0x7')](_0x2882('0x2b'),auth[_0x2882('0x6')](),controller[_0x2882('0x2c')]);router[_0x2882('0x7')](_0x2882('0x2d'),auth[_0x2882('0x6')](),controller[_0x2882('0x2e')]);router[_0x2882('0x7')](_0x2882('0x2f'),auth['isAuthenticated'](),controller[_0x2882('0x30')]);router['get']('/chat/queues/waitinginteractions',auth[_0x2882('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x2882('0x7')]('/mail/queues/waitinginteractions',auth[_0x2882('0x6')](),controller[_0x2882('0x31')]);router[_0x2882('0x7')](_0x2882('0x32'),auth[_0x2882('0x6')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x2882('0x33'),auth[_0x2882('0x6')](),controller[_0x2882('0x34')]);router[_0x2882('0x7')](_0x2882('0x35'),auth[_0x2882('0x6')](),controller[_0x2882('0x36')]);router[_0x2882('0x7')](_0x2882('0x37'),auth[_0x2882('0x6')](),controller[_0x2882('0x38')]);router['get'](_0x2882('0x39'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x2882('0x3a')](_0x2882('0x3b'),auth[_0x2882('0x6')](),controller[_0x2882('0x3c')]('mail'));router[_0x2882('0x7')](_0x2882('0x3d'),auth[_0x2882('0x6')](),controller[_0x2882('0x3e')]);router[_0x2882('0x3a')](_0x2882('0x3f'),auth[_0x2882('0x6')](),controller[_0x2882('0x3c')](_0x2882('0x40')));router[_0x2882('0x7')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x2882('0x41')]);router[_0x2882('0x3a')](_0x2882('0x42'),auth['isAuthenticated'](),controller[_0x2882('0x3c')]('fax'));router['get'](_0x2882('0x43'),auth[_0x2882('0x6')](),controller[_0x2882('0x44')]);router[_0x2882('0x3a')](_0x2882('0x45'),auth[_0x2882('0x6')](),controller['queueNotify'](_0x2882('0x46')));router[_0x2882('0x7')](_0x2882('0x47'),auth[_0x2882('0x6')](),controller[_0x2882('0x48')]);router[_0x2882('0x3a')](_0x2882('0x49'),auth[_0x2882('0x6')](),controller['queueNotify'](_0x2882('0x4a')));router[_0x2882('0x3a')]('/whatsapp/queues/:id/notify',auth[_0x2882('0x6')](),controller[_0x2882('0x3c')]('whatsapp'));router['get'](_0x2882('0x4b'),auth['isAuthenticated'](),controller[_0x2882('0x4c')]);router[_0x2882('0x7')](_0x2882('0x4d'),auth[_0x2882('0x6')](),controller[_0x2882('0x4e')]);router[_0x2882('0x3a')](_0x2882('0x4f'),auth['isAuthenticated'](),controller[_0x2882('0x50')]);module[_0x2882('0x51')]=router; \ No newline at end of file +var _0xc669=['/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues'];(function(_0x5f0225,_0x52631a){var _0x2cef4b=function(_0x5a29c6){while(--_0x5a29c6){_0x5f0225['push'](_0x5f0225['shift']());}};_0x2cef4b(++_0x52631a);}(_0xc669,0x92));var _0x9c66=function(_0x430de4,_0x1bba23){_0x430de4=_0x430de4-0x0;var _0x4019d9=_0xc669[_0x430de4];return _0x4019d9;};'use strict';var multer=require(_0x9c66('0x0'));var util=require(_0x9c66('0x1'));var path=require(_0x9c66('0x2'));var express=require(_0x9c66('0x3'));var router=express[_0x9c66('0x4')]();var auth=require(_0x9c66('0x5'));var controller=require(_0x9c66('0x6'));router[_0x9c66('0x7')](_0x9c66('0x8'),auth[_0x9c66('0x9')](),controller['voiceChannels']);router['get'](_0x9c66('0xa'),auth['isAuthenticated'](),controller[_0x9c66('0xb')]);router[_0x9c66('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x9c66('0x9')](),controller[_0x9c66('0xc')]);router[_0x9c66('0x7')](_0x9c66('0xd'),auth[_0x9c66('0x9')](),controller[_0x9c66('0xe')]);router[_0x9c66('0x7')](_0x9c66('0xf'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x10')]);router['get'](_0x9c66('0x11'),auth['isAuthenticated'](),controller[_0x9c66('0x12')]);router[_0x9c66('0x7')](_0x9c66('0x13'),auth['isAuthenticated'](),controller[_0x9c66('0x14')]);router[_0x9c66('0x7')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x9c66('0x15')]);router[_0x9c66('0x7')](_0x9c66('0x16'),auth[_0x9c66('0x9')](),controller['smsQueues']);router[_0x9c66('0x7')](_0x9c66('0x17'),auth['isAuthenticated'](),controller[_0x9c66('0x18')]);router[_0x9c66('0x7')](_0x9c66('0x19'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x1a')]);router[_0x9c66('0x7')]('/voice/queues/preview/:id',auth[_0x9c66('0x9')](),controller[_0x9c66('0x1b')]);router['get'](_0x9c66('0x1c'),auth[_0x9c66('0x9')](),controller['voiceQueuesChannels']);router[_0x9c66('0x7')](_0x9c66('0x1d'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x1e')]);router[_0x9c66('0x7')](_0x9c66('0x1f'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x20')]);router[_0x9c66('0x7')](_0x9c66('0x21'),auth[_0x9c66('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0x9c66('0x7')](_0x9c66('0x22'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x23')]);router[_0x9c66('0x24')](_0x9c66('0x22'),auth['isAuthenticated'](),controller[_0x9c66('0x25')]);router[_0x9c66('0x7')](_0x9c66('0x26'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x27')]);router[_0x9c66('0x7')](_0x9c66('0x28'),auth[_0x9c66('0x9')](),controller['outboundChannels']);router[_0x9c66('0x7')](_0x9c66('0x29'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x2a')]);router[_0x9c66('0x24')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x9c66('0x2b')]);router[_0x9c66('0x7')](_0x9c66('0x2c'),auth['isAuthenticated'](),controller[_0x9c66('0x2d')]);router['get'](_0x9c66('0x2e'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x2f')]);router[_0x9c66('0x7')](_0x9c66('0x30'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x31')]);router['get'](_0x9c66('0x32'),auth['isAuthenticated'](),controller[_0x9c66('0x33')]);router[_0x9c66('0x7')](_0x9c66('0x34'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x35')]);router['get']('/mail/queues/waitinginteractions',auth[_0x9c66('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0x9c66('0x7')](_0x9c66('0x36'),auth['isAuthenticated'](),controller[_0x9c66('0x37')]);router[_0x9c66('0x7')](_0x9c66('0x38'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x39')]);router[_0x9c66('0x7')]('/sms/queues/waitinginteractions',auth[_0x9c66('0x9')](),controller[_0x9c66('0x3a')]);router[_0x9c66('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x9c66('0x9')](),controller[_0x9c66('0x3b')]);router[_0x9c66('0x7')](_0x9c66('0x3c'),auth['isAuthenticated'](),controller[_0x9c66('0x3d')]);router['post'](_0x9c66('0x3e'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x3f')]('mail'));router['get'](_0x9c66('0x40'),auth[_0x9c66('0x9')](),controller['showMailQueues']);router['post'](_0x9c66('0x41'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x3f')]('chat'));router[_0x9c66('0x7')](_0x9c66('0x42'),auth['isAuthenticated'](),controller[_0x9c66('0x43')]);router[_0x9c66('0x44')](_0x9c66('0x45'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x3f')](_0x9c66('0x46')));router[_0x9c66('0x7')]('/fax/queues/:id',auth[_0x9c66('0x9')](),controller[_0x9c66('0x47')]);router['post'](_0x9c66('0x48'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x3f')](_0x9c66('0x49')));router[_0x9c66('0x7')](_0x9c66('0x4a'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x4b')]);router[_0x9c66('0x44')](_0x9c66('0x4c'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x3f')](_0x9c66('0x4d')));router['post'](_0x9c66('0x4e'),auth[_0x9c66('0x9')](),controller['queueNotify'](_0x9c66('0x4f')));router[_0x9c66('0x7')](_0x9c66('0x50'),auth[_0x9c66('0x9')](),controller['showSmsQueues']);router[_0x9c66('0x7')]('/whatsapp/queues/:id',auth[_0x9c66('0x9')](),controller[_0x9c66('0x51')]);router[_0x9c66('0x44')](_0x9c66('0x52'),auth[_0x9c66('0x9')](),controller[_0x9c66('0x53')]);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 97291d1..43cde98 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 _0xee65=['name','send','isNil','rows','find','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','From','Start','agentTransferTimeout','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','status','json'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xee65,0x72));var _0x5ee6=function(_0x30d18b,_0x52dd2c){_0x30d18b=_0x30d18b-0x0;var _0x4bcd4d=_0xee65[_0x30d18b];return _0x4bcd4d;};'use strict';var BPromise=require(_0x5ee6('0x0'));var moment=require(_0x5ee6('0x1'));var _=require(_0x5ee6('0x2'));var util=require(_0x5ee6('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x5ee6('0x4'));var amiClient=jayson[_0x5ee6('0x5')][_0x5ee6('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x5ee6('0x6')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2e81e7,_0x1ac6f4,_0x6435a9){return new BPromise(function(_0x31282a,_0x123c0c){var _0x41623e=_0x6435a9?_0x6435a9:amiClient;return _0x41623e[_0x5ee6('0x7')](_0x2e81e7,_0x1ac6f4)[_0x5ee6('0x8')](function(_0x32bf58){if(_0x32bf58[_0x5ee6('0x9')]){if(_0x32bf58[_0x5ee6('0x9')]['code']===0x1f4){return _0x123c0c(_0x32bf58['error'][_0x5ee6('0xa')]);}return _0x31282a(_0x32bf58['error'][_0x5ee6('0xa')]);}else{_0x31282a(_0x32bf58['result']);}})['catch'](function(_0x4e12a2){_0x123c0c(_0x4e12a2);});});}function respondWithResult(_0x246271,_0x564f7c){_0x564f7c=_0x564f7c||0xc8;return function(_0x74345c){if(_0x74345c){return _0x246271[_0x5ee6('0xb')](_0x564f7c)[_0x5ee6('0xc')](_0x74345c);}return _0x246271['sendStatus'](0x194);};}function handleError(_0x5a5f22,_0x5f3fcb){_0x5f3fcb=_0x5f3fcb||0x1f4;return function(_0x443d2b){logger[_0x5ee6('0x9')](_0x443d2b['stack']);if(_0x443d2b[_0x5ee6('0xd')]){delete _0x443d2b[_0x5ee6('0xd')];}_0x5a5f22[_0x5ee6('0xb')](_0x5f3fcb)[_0x5ee6('0xe')](_0x443d2b);};}function findById(_0x285850){return function(_0x4f765c){if(!_[_0x5ee6('0xf')](_0x285850)&&!_['isNil'](_0x4f765c)&&!_['isNil'](_0x4f765c[_0x5ee6('0x10')])){return _[_0x5ee6('0x11')](_0x4f765c[_0x5ee6('0x10')],function(_0x5e7e21){return _0x5e7e21['id']==_0x285850;});}return null;};}exports['voiceChannels']=function(_0x15bc47,_0x406c6d){return respondWithRpcPromise(_0x5ee6('0x12'),_0x15bc47[_0x5ee6('0x13')])[_0x5ee6('0x8')](respondWithResult(_0x406c6d,null))[_0x5ee6('0x14')](handleError(_0x406c6d,null));};exports[_0x5ee6('0x15')]=function(_0xfee59d,_0x4ac0){return respondWithRpcPromise(_0x5ee6('0x16'),_['merge'](_0xfee59d[_0x5ee6('0x13')],_0xfee59d[_0x5ee6('0x17')]))[_0x5ee6('0x8')](respondWithResult(_0x4ac0,null))[_0x5ee6('0x14')](handleError(_0x4ac0,null));};exports[_0x5ee6('0x18')]=function(_0x5c82a4,_0x3297ac){return respondWithRpcPromise(_0x5ee6('0x19'),_[_0x5ee6('0x1a')](_0x5c82a4['query'],_0x5c82a4[_0x5ee6('0x17')]))['then'](respondWithResult(_0x3297ac,null))['catch'](handleError(_0x3297ac,null));};exports[_0x5ee6('0x1b')]=function(_0x1ff5b3,_0x2b9dbf){return respondWithRpcPromise(_0x5ee6('0x1c'),_0x1ff5b3[_0x5ee6('0x13')])[_0x5ee6('0x8')](respondWithResult(_0x2b9dbf,null))[_0x5ee6('0x14')](handleError(_0x2b9dbf,null));};exports[_0x5ee6('0x1d')]=function(_0x11f4f2,_0x54da39){return respondWithRpcPromise(_0x5ee6('0x1c'),_0x11f4f2[_0x5ee6('0x13')])['then'](findById(_0x11f4f2['params']['id']))[_0x5ee6('0x8')](respondWithResult(_0x54da39,null))['catch'](handleError(_0x54da39,null));};exports['updateVoiceQueue']=function(_0x9c7893,_0xbd0dea){return respondWithRpcPromise(_0x5ee6('0x1e'),_['merge'](_0x9c7893['body'],_0x9c7893[_0x5ee6('0x17')]))[_0x5ee6('0x8')](respondWithResult(_0xbd0dea,null))[_0x5ee6('0x14')](handleError(_0xbd0dea,null));};exports[_0x5ee6('0x1f')]=function(_0x191321,_0x5b70d2){return respondWithRpcPromise(_0x5ee6('0x20'),_[_0x5ee6('0x1a')](_0x191321[_0x5ee6('0x13')],_0x191321[_0x5ee6('0x17')]))[_0x5ee6('0x8')](respondWithResult(_0x5b70d2,null))[_0x5ee6('0x14')](handleError(_0x5b70d2,null));};exports[_0x5ee6('0x21')]=function(_0x15597b,_0x291fb0){return respondWithRpcPromise('VoiceQueuesChannels',_0x15597b[_0x5ee6('0x13')])[_0x5ee6('0x8')](respondWithResult(_0x291fb0,null))['catch'](handleError(_0x291fb0,null));};exports[_0x5ee6('0x22')]=function(_0x3ef54a,_0x457aae){return respondWithRpcPromise(_0x5ee6('0x23'),_[_0x5ee6('0x1a')](_0x3ef54a[_0x5ee6('0x13')],_0x3ef54a[_0x5ee6('0x17')]))[_0x5ee6('0x8')](respondWithResult(_0x457aae,null))[_0x5ee6('0x14')](handleError(_0x457aae,null));};exports[_0x5ee6('0x24')]=function(_0x3cdf45,_0x56079d){return respondWithRpcPromise(_0x5ee6('0x25'),_['merge'](_0x3cdf45[_0x5ee6('0x13')],_0x3cdf45[_0x5ee6('0x17')]))['then'](respondWithResult(_0x56079d,null))[_0x5ee6('0x14')](handleError(_0x56079d,null));};exports[_0x5ee6('0x26')]=function(_0x15637d,_0x7a9c73){return respondWithRpcPromise(_0x5ee6('0x27'),_[_0x5ee6('0x1a')](_0x15637d[_0x5ee6('0x13')],_0x15637d[_0x5ee6('0x17')]))['then'](respondWithResult(_0x7a9c73,null))[_0x5ee6('0x14')](handleError(_0x7a9c73,null));};exports[_0x5ee6('0x28')]=function(_0x3ba4b2,_0x5eca5c){return respondWithRpcPromise(_0x5ee6('0x29'),_0x3ba4b2[_0x5ee6('0x13')])[_0x5ee6('0x8')](respondWithResult(_0x5eca5c,null))[_0x5ee6('0x14')](handleError(_0x5eca5c,null));};exports[_0x5ee6('0x2a')]=function(_0x2bdb6a,_0x32e1e1){return respondWithRpcPromise(_0x5ee6('0x2b'),_0x2bdb6a[_0x5ee6('0x13')])[_0x5ee6('0x8')](respondWithResult(_0x32e1e1,null))[_0x5ee6('0x14')](handleError(_0x32e1e1,null));};exports[_0x5ee6('0x2c')]=function(_0x2df6e3,_0x3622e2){var _0x4e5e14;return respondWithRpcPromise(_0x5ee6('0x2d'),_0x2df6e3[_0x5ee6('0x13')])[_0x5ee6('0x8')](function(_0x193418){_0x4e5e14=_0x193418;return respondWithRpcPromise(_0x5ee6('0x2d'),_0x2df6e3[_0x5ee6('0x13')],routingClient);})[_0x5ee6('0x8')](function(_0x34784c){return _[_0x5ee6('0x1a')]({},_0x34784c,_0x4e5e14);})['then'](respondWithResult(_0x3622e2,null))[_0x5ee6('0x14')](handleError(_0x3622e2,null));};exports[_0x5ee6('0x2e')]=function(_0x4b6077,_0x37f9cd){if(_0x4b6077[_0x5ee6('0x2f')]&&_0x4b6077[_0x5ee6('0x2f')]['interaction']&&_0x4b6077['user']&&_0x4b6077[_0x5ee6('0x30')][_0x5ee6('0xd')]){for(var _0x16a551 in _0x4b6077[_0x5ee6('0x2f')][_0x5ee6('0x31')]){if(_0x4b6077[_0x5ee6('0x2f')][_0x5ee6('0x31')][_0x5ee6('0x32')](_0x16a551)){db[_0x5ee6('0x33')][_0x5ee6('0x34')]({'where':{'channel':_0x16a551,'membername':_0x4b6077[_0x5ee6('0x30')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4b6077['body'][_0x5ee6('0x31')][_0x16a551]&&_0x4b6077[_0x5ee6('0x2f')][_0x5ee6('0x31')][_0x16a551]['length']?{'$notIn':_0x4b6077['body']['interaction'][_0x16a551]}:{'$ne':null}}})[_0x5ee6('0x8')](function(_0x3eaee2){var _0x43b098=moment()[_0x5ee6('0x35')](_0x5ee6('0x36'));for(var _0x35e317=0x0,_0x3c1207=_0x3eaee2[_0x5ee6('0x37')];_0x35e317<_0x3c1207;_0x35e317+=0x1){_0x3eaee2[_0x35e317]['updateAttributes']({'exitAt':_0x43b098});}});for(var _0x6d197=0x0;_0x6d197<_0x4b6077[_0x5ee6('0x2f')][_0x5ee6('0x31')][_0x16a551]['length'];_0x6d197+=0x1){db[_0x5ee6('0x33')][_0x5ee6('0x38')]({'where':{'channel':_0x16a551,'membername':_0x4b6077['user']['name'],'type':_0x5ee6('0x39'),'uniqueid':_0x4b6077['body'][_0x5ee6('0x31')][_0x16a551][_0x6d197],'exitAt':null},'defaults':{'channel':_0x16a551,'membername':_0x4b6077['user'][_0x5ee6('0xd')],'interface':_['isNil'](_0x4b6077[_0x5ee6('0x30')][_0x5ee6('0x3a')])?util[_0x5ee6('0x35')](_0x5ee6('0x3b'),_0x4b6077[_0x5ee6('0x30')][_0x5ee6('0xd')]):_0x4b6077[_0x5ee6('0x30')][_0x5ee6('0x3a')],'type':_0x5ee6('0x39'),'enterAt':moment()[_0x5ee6('0x35')](_0x5ee6('0x36')),'role':_0x5ee6('0x3c'),'internal':_0x4b6077['user'][_0x5ee6('0x3d')],'uniqueid':_0x4b6077[_0x5ee6('0x2f')][_0x5ee6('0x31')][_0x16a551][_0x6d197]}});}}}}return respondWithRpcPromise(_0x5ee6('0x3e'),{'id':_0x4b6077['params']['id'],'capacity':_0x4b6077[_0x5ee6('0x2f')][_0x5ee6('0x3f')]},routingClient)[_0x5ee6('0x8')](respondWithResult(_0x37f9cd,null))[_0x5ee6('0x14')](handleError(_0x37f9cd,null));};exports[_0x5ee6('0x40')]=function(_0x3105ed,_0x31ef37){return respondWithRpcPromise('Telephones',_0x3105ed[_0x5ee6('0x13')])[_0x5ee6('0x8')](respondWithResult(_0x31ef37,null))['catch'](handleError(_0x31ef37,null));};exports[_0x5ee6('0x41')]=function(_0x905bfd,_0x58e6b1){return respondWithRpcPromise(_0x5ee6('0x42'),_0x905bfd[_0x5ee6('0x13')])[_0x5ee6('0x8')](respondWithResult(_0x58e6b1,null))[_0x5ee6('0x14')](handleError(_0x58e6b1,null));};exports['campaigns']=function(_0x529b02,_0x42ca85){return respondWithRpcPromise(_0x5ee6('0x43'),_0x529b02[_0x5ee6('0x13')])['then'](respondWithResult(_0x42ca85,null))[_0x5ee6('0x14')](handleError(_0x42ca85,null));};exports[_0x5ee6('0x44')]=function(_0x3bf22e,_0x4f16ce){return respondWithRpcPromise(_0x5ee6('0x45'),_0x3bf22e[_0x5ee6('0x13')],routingClient)['then'](respondWithResult(_0x4f16ce,null))[_0x5ee6('0x14')](handleError(_0x4f16ce,null));};exports[_0x5ee6('0x46')]=function(_0x447738,_0x3aaa39){return respondWithRpcPromise('ChatQueues',_0x447738[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](findById(_0x447738[_0x5ee6('0x17')]['id']))[_0x5ee6('0x8')](respondWithResult(_0x3aaa39,null))[_0x5ee6('0x14')](handleError(_0x3aaa39,null));};exports['mailQueues']=function(_0x38c864,_0x2ef453){return respondWithRpcPromise(_0x5ee6('0x47'),_0x38c864[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](respondWithResult(_0x2ef453,null))[_0x5ee6('0x14')](handleError(_0x2ef453,null));};exports[_0x5ee6('0x48')]=function(_0x21f0b4,_0x1f90d1){return respondWithRpcPromise('MailQueues',_0x21f0b4[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](findById(_0x21f0b4[_0x5ee6('0x17')]['id']))['then'](respondWithResult(_0x1f90d1,null))[_0x5ee6('0x14')](handleError(_0x1f90d1,null));};exports[_0x5ee6('0x49')]=function(_0x182322,_0x18456e){return respondWithRpcPromise(_0x5ee6('0x4a'),_0x182322['query'],mailClient)[_0x5ee6('0x8')](respondWithResult(_0x18456e,null))['catch'](handleError(_0x18456e,null));};exports[_0x5ee6('0x4b')]=function(_0x587266,_0x2f5cbc){return respondWithRpcPromise('OpenchannelQueues',_0x587266[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](respondWithResult(_0x2f5cbc,null))['catch'](handleError(_0x2f5cbc,null));};exports[_0x5ee6('0x4c')]=function(_0x30e96c,_0x1893bd){return respondWithRpcPromise('OpenchannelQueues',_0x30e96c[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](findById(_0x30e96c[_0x5ee6('0x17')]['id']))[_0x5ee6('0x8')](respondWithResult(_0x1893bd,null))['catch'](handleError(_0x1893bd,null));};exports[_0x5ee6('0x4d')]=function(_0x4406fa,_0x23845e){return respondWithRpcPromise(_0x5ee6('0x4e'),_0x4406fa['query'],routingClient)[_0x5ee6('0x8')](respondWithResult(_0x23845e,null))[_0x5ee6('0x14')](handleError(_0x23845e,null));};exports[_0x5ee6('0x4f')]=function(_0xb86c4e,_0x254436){return respondWithRpcPromise(_0x5ee6('0x4e'),_0xb86c4e[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](findById(_0xb86c4e['params']['id']))[_0x5ee6('0x8')](respondWithResult(_0x254436,null))[_0x5ee6('0x14')](handleError(_0x254436,null));};exports[_0x5ee6('0x50')]=function(_0x549e60,_0xc98d79){return respondWithRpcPromise(_0x5ee6('0x51'),_0x549e60['query'],routingClient)[_0x5ee6('0x8')](respondWithResult(_0xc98d79,null))[_0x5ee6('0x14')](handleError(_0xc98d79,null));};exports['showWhatsappQueues']=function(_0x10cab6,_0x615226){return respondWithRpcPromise(_0x5ee6('0x51'),_0x10cab6[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](findById(_0x10cab6[_0x5ee6('0x17')]['id']))[_0x5ee6('0x8')](respondWithResult(_0x615226,null))['catch'](handleError(_0x615226,null));};exports['faxQueues']=function(_0x1dc729,_0x57ad4a){return respondWithRpcPromise(_0x5ee6('0x52'),_0x1dc729[_0x5ee6('0x13')],routingClient)['then'](respondWithResult(_0x57ad4a,null))[_0x5ee6('0x14')](handleError(_0x57ad4a,null));};exports[_0x5ee6('0x53')]=function(_0xfccf8c,_0x19b19a){return respondWithRpcPromise(_0x5ee6('0x52'),_0xfccf8c[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](findById(_0xfccf8c[_0x5ee6('0x17')]['id']))[_0x5ee6('0x8')](respondWithResult(_0x19b19a,null))[_0x5ee6('0x14')](handleError(_0x19b19a,null));};exports[_0x5ee6('0x54')]=function(_0x6d96a8,_0x4127f3){return respondWithRpcPromise(_0x5ee6('0x55'),_0x6d96a8[_0x5ee6('0x13')])[_0x5ee6('0x8')](respondWithResult(_0x4127f3,null))[_0x5ee6('0x14')](handleError(_0x4127f3,null));};exports[_0x5ee6('0x56')]=function(_0x5a0fd1,_0x14731d){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5a0fd1[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](respondWithResult(_0x14731d,null))[_0x5ee6('0x14')](handleError(_0x14731d,null));};exports[_0x5ee6('0x57')]=function(_0x253ae3,_0x328d42){return respondWithRpcPromise(_0x5ee6('0x58'),_0x253ae3[_0x5ee6('0x13')],routingClient)['then'](respondWithResult(_0x328d42,null))[_0x5ee6('0x14')](handleError(_0x328d42,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x609100,_0x36cbc2){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x609100['query'],routingClient)['then'](respondWithResult(_0x36cbc2,null))['catch'](handleError(_0x36cbc2,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x3117a7,_0x565b7a){return respondWithRpcPromise(_0x5ee6('0x59'),_0x3117a7['query'],routingClient)['then'](function(_0x1d0180){if(_0x3117a7[_0x5ee6('0x13')][_0x5ee6('0x5a')]!==undefined){var _0x4b430c=_(_0x1d0180[_0x5ee6('0x10')])['filter']([_0x3117a7[_0x5ee6('0x13')][_0x5ee6('0x5a')],_0x3117a7['params']['id']])[_0x5ee6('0x5b')](_0x5ee6('0x5c'))['uniq']()['value']();return _0x1d0180[_0x5ee6('0x10')][_0x5ee6('0x5d')](function(_0x3bc0be){return _0x4b430c[_0x5ee6('0x5e')](_0x3bc0be[_0x5ee6('0x5c')])>-0x1;});}else{return _0x1d0180[_0x5ee6('0x10')]['filter'](function(_0x3f55b4){return _0x3f55b4[_0x5ee6('0x5c')]===parseInt(_0x3117a7['params']['id']);});}})[_0x5ee6('0x8')](respondWithResult(_0x565b7a,null))[_0x5ee6('0x14')](handleError(_0x565b7a,null));};exports[_0x5ee6('0x5f')]=function(_0x53b09e,_0xfb19a4){return respondWithRpcPromise(_0x5ee6('0x60'),_0x53b09e[_0x5ee6('0x13')],routingClient)['then'](respondWithResult(_0xfb19a4,null))[_0x5ee6('0x14')](handleError(_0xfb19a4,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x218e0a,_0x373b20){return respondWithRpcPromise(_0x5ee6('0x61'),_0x218e0a[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](respondWithResult(_0x373b20,null))['catch'](handleError(_0x373b20,null));};exports[_0x5ee6('0x62')]=function(_0x37c8a8,_0x3d08eb){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x37c8a8[_0x5ee6('0x13')],routingClient)[_0x5ee6('0x8')](respondWithResult(_0x3d08eb,null))[_0x5ee6('0x14')](handleError(_0x3d08eb,null));};exports[_0x5ee6('0x63')]=function(_0x177b66){return function(_0xe718cf,_0x3babf8){var _0x4e5406,_0x5d98ba;var _0x548a05=_[_0x5ee6('0x64')](_0x177b66);var _0xe40a06=_0x177b66==='chat'?_0x5ee6('0x65'):'Account';return db[_0x548a05+_0x5ee6('0x66')]['findOne']({'raw':!![],'where':{'id':_0xe718cf[_0x5ee6('0x17')]['id']}})[_0x5ee6('0x8')](function(_0x179c08){if(_[_0x5ee6('0xf')](_0x179c08)){throw new Error(_0x548a05+_0x5ee6('0x67'));}_0x4e5406=_0x179c08;return db[_0x548a05+_0x5ee6('0x68')][_0x5ee6('0x69')]({'where':{'id':_0xe718cf[_0x5ee6('0x2f')][_0x5ee6('0x6a')]},'include':[{'model':db[_0x548a05+_0x5ee6('0x6b')],'as':_0x5ee6('0x6b')},{'model':db[_0x548a05+_0xe40a06],'as':_0x5ee6('0x6c')}]});})[_0x5ee6('0x8')](function(_0x22c2ea){if(_[_0x5ee6('0xf')](_0x22c2ea)){throw new Error(_0x548a05+_0x5ee6('0x6d'));}_0x5d98ba=_0x22c2ea;return _0x22c2ea[_0x5ee6('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5ee6('0x8')](function(){var _0x108d2c={'uniqueid':_0x177b66+'.'+_0x5d98ba['id']+'.'+_0x5d98ba[_0x5ee6('0x6b')]['id'],'FromUserId':_0xe718cf[_0x5ee6('0x30')]['id'],'type':_0x5ee6('0x6f')};_0x108d2c[_0x548a05+_0x5ee6('0x70')]=_0x5d98ba['id'];_0x108d2c[_0x548a05+_0x5ee6('0x71')]=_0x5d98ba[_0x5ee6('0x6b')]['id'];_0x108d2c['From'+_0x548a05+_0xe40a06+'Id']=_0x5d98ba[_0x5ee6('0x6c')]['id'];_0x108d2c['To'+_0x548a05+_0x5ee6('0x72')]=_0x4e5406['id'];return db[_0x548a05+_0x5ee6('0x73')][_0x5ee6('0x74')](_0x108d2c);})[_0x5ee6('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x177b66,'interaction':_0x5d98ba[_0x5ee6('0x6b')],'message':_0x5d98ba,'account':_0x5d98ba[_0x5ee6('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5ee6('0x6f'),'appdata':_0x4e5406[_0x5ee6('0xd')]+','+(_0x5d98ba[_0x5ee6('0x6c')][_0x5ee6('0x75')]||0x12c),'interval':_0x5ee6('0x76')}]},routingClient);})[_0x5ee6('0x8')](respondWithResult(_0x3babf8,null))[_0x5ee6('0x14')](handleError(_0x3babf8,null));};};exports[_0x5ee6('0x77')]=function(_0xff207f,_0x4fd594){var _0x5eefdd,_0x735f82;if(_['isNil'](_0xff207f['body'][_0x5ee6('0x78')])){throw new Error(_0x5ee6('0x79'));}var _0x35dadb=_0xff207f[_0x5ee6('0x2f')][_0x5ee6('0x78')];var _0x1853f8=_['capitalize'](_0x35dadb);var _0x1e5efb=_0x35dadb==='chat'?_0x5ee6('0x65'):_0x5ee6('0x6c');return db[_0x5ee6('0x7a')][_0x5ee6('0x69')]({'raw':!![],'where':{'id':_0xff207f[_0x5ee6('0x17')]['id'],'role':_0x5ee6('0x3c')}})[_0x5ee6('0x8')](function(_0x410152){if(_[_0x5ee6('0xf')](_0x410152)){throw new Error(_0x5ee6('0x7b'));}_0x5eefdd=_0x410152;return db[_0x1853f8+_0x5ee6('0x68')][_0x5ee6('0x69')]({'where':{'id':_0xff207f[_0x5ee6('0x2f')]['messageId']},'include':[{'model':db[_0x1853f8+_0x5ee6('0x6b')],'as':_0x5ee6('0x6b')},{'model':db[_0x1853f8+_0x1e5efb],'as':'Account'}]});})[_0x5ee6('0x8')](function(_0x115311){if(_[_0x5ee6('0xf')](_0x115311)){throw new Error(_0x1853f8+_0x5ee6('0x6d'));}_0x735f82=_0x115311;return _0x115311['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5ee6('0x8')](function(){var _0x5d8f1={'uniqueid':_0x35dadb+'.'+_0x735f82['id']+'.'+_0x735f82[_0x5ee6('0x6b')]['id'],'FromUserId':_0xff207f[_0x5ee6('0x30')]['id'],'type':'queue','ToUserId':_0x5eefdd['id']};_0x5d8f1[_0x1853f8+'MessageId']=_0x735f82['id'];_0x5d8f1[_0x1853f8+_0x5ee6('0x71')]=_0x735f82[_0x5ee6('0x6b')]['id'];_0x5d8f1[_0x5ee6('0x7c')+_0x1853f8+_0x1e5efb+'Id']=_0x735f82[_0x5ee6('0x6c')]['id'];return db[_0x1853f8+_0x5ee6('0x73')][_0x5ee6('0x74')](_0x5d8f1);})[_0x5ee6('0x8')](function(){return respondWithRpcPromise(_0x5ee6('0x7d'),{'channel':_0x35dadb,'interaction':_0x735f82[_0x5ee6('0x6b')],'message':_0x735f82,'account':_0x735f82['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x5ee6('0x3c'),'appdata':_0x5eefdd[_0x5ee6('0xd')]+','+(_0x735f82['Account'][_0x5ee6('0x7e')]||0x12c),'interval':_0x5ee6('0x76')}]},routingClient);})[_0x5ee6('0x8')](respondWithResult(_0x4fd594,null))[_0x5ee6('0x14')](handleError(_0x4fd594,null));}; \ No newline at end of file +var _0x478c=['merge','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','interface','SIP/%s','format','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','../../mysqldb','api','jayson/promise','http','request','then','error','message','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','query','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue'];(function(_0x47172b,_0x191fe0){var _0x1c812d=function(_0x5647fc){while(--_0x5647fc){_0x47172b['push'](_0x47172b['shift']());}};_0x1c812d(++_0x191fe0);}(_0x478c,0x1e9));var _0xc478=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x478c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xc478('0x0'));var moment=require(_0xc478('0x1'));var _=require('lodash');var util=require('util');var db=require(_0xc478('0x2'))['db'];var logger=require('../../config/logger')(_0xc478('0x3'));var jayson=require(_0xc478('0x4'));var amiClient=jayson['client'][_0xc478('0x5')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x34b46d,_0x398dba,_0x5d0ade){return new BPromise(function(_0x35b5af,_0x547a43){var _0x4f549d=_0x5d0ade?_0x5d0ade:amiClient;return _0x4f549d[_0xc478('0x6')](_0x34b46d,_0x398dba)[_0xc478('0x7')](function(_0x132c08){if(_0x132c08['error']){if(_0x132c08[_0xc478('0x8')]['code']===0x1f4){return _0x547a43(_0x132c08[_0xc478('0x8')][_0xc478('0x9')]);}return _0x35b5af(_0x132c08[_0xc478('0x8')][_0xc478('0x9')]);}else{_0x35b5af(_0x132c08['result']);}})['catch'](function(_0x3e0eb3){_0x547a43(_0x3e0eb3);});});}function respondWithResult(_0x2f5776,_0x3fc8b2){_0x3fc8b2=_0x3fc8b2||0xc8;return function(_0x14bc22){if(_0x14bc22){return _0x2f5776[_0xc478('0xa')](_0x3fc8b2)[_0xc478('0xb')](_0x14bc22);}return _0x2f5776[_0xc478('0xc')](0x194);};}function handleError(_0x127dba,_0x34e93a){_0x34e93a=_0x34e93a||0x1f4;return function(_0xbc45a1){logger[_0xc478('0x8')](_0xbc45a1[_0xc478('0xd')]);if(_0xbc45a1['name']){delete _0xbc45a1[_0xc478('0xe')];}_0x127dba[_0xc478('0xa')](_0x34e93a)[_0xc478('0xf')](_0xbc45a1);};}function findById(_0x59b08f){return function(_0x11510c){if(!_[_0xc478('0x10')](_0x59b08f)&&!_[_0xc478('0x10')](_0x11510c)&&!_[_0xc478('0x10')](_0x11510c[_0xc478('0x11')])){return _[_0xc478('0x12')](_0x11510c[_0xc478('0x11')],function(_0x27d207){return _0x27d207['id']==_0x59b08f;});}return null;};}exports[_0xc478('0x13')]=function(_0x3cd1f0,_0x4d0950){return respondWithRpcPromise(_0xc478('0x14'),_0x3cd1f0['query'])[_0xc478('0x7')](respondWithResult(_0x4d0950,null))[_0xc478('0x15')](handleError(_0x4d0950,null));};exports[_0xc478('0x16')]=function(_0x103b22,_0x302d38){return respondWithRpcPromise('VoiceChannelMixMonitor',_['merge'](_0x103b22['query'],_0x103b22[_0xc478('0x17')]))[_0xc478('0x7')](respondWithResult(_0x302d38,null))[_0xc478('0x15')](handleError(_0x302d38,null));};exports[_0xc478('0x18')]=function(_0x26916f,_0x2227b9){return respondWithRpcPromise(_0xc478('0x19'),_['merge'](_0x26916f[_0xc478('0x1a')],_0x26916f[_0xc478('0x17')]))[_0xc478('0x7')](respondWithResult(_0x2227b9,null))['catch'](handleError(_0x2227b9,null));};exports[_0xc478('0x1b')]=function(_0x13a2c9,_0x1b6eb4){return respondWithRpcPromise('VoiceQueues',_0x13a2c9[_0xc478('0x1a')])['then'](respondWithResult(_0x1b6eb4,null))['catch'](handleError(_0x1b6eb4,null));};exports[_0xc478('0x1c')]=function(_0x4d22b0,_0x170a52){return respondWithRpcPromise(_0xc478('0x1d'),_0x4d22b0[_0xc478('0x1a')])[_0xc478('0x7')](findById(_0x4d22b0[_0xc478('0x17')]['id']))['then'](respondWithResult(_0x170a52,null))[_0xc478('0x15')](handleError(_0x170a52,null));};exports['updateVoiceQueue']=function(_0x179cc4,_0x1158f5){return respondWithRpcPromise(_0xc478('0x1e'),_[_0xc478('0x1f')](_0x179cc4[_0xc478('0x20')],_0x179cc4['params']))[_0xc478('0x7')](respondWithResult(_0x1158f5,null))[_0xc478('0x15')](handleError(_0x1158f5,null));};exports[_0xc478('0x21')]=function(_0x28ab3c,_0x37d000){return respondWithRpcPromise(_0xc478('0x22'),_[_0xc478('0x1f')](_0x28ab3c[_0xc478('0x1a')],_0x28ab3c[_0xc478('0x17')]))[_0xc478('0x7')](respondWithResult(_0x37d000,null))[_0xc478('0x15')](handleError(_0x37d000,null));};exports['voiceQueuesChannels']=function(_0x32f5c2,_0x2b9890){return respondWithRpcPromise(_0xc478('0x23'),_0x32f5c2[_0xc478('0x1a')])[_0xc478('0x7')](respondWithResult(_0x2b9890,null))[_0xc478('0x15')](handleError(_0x2b9890,null));};exports[_0xc478('0x24')]=function(_0x2d76b4,_0x1f60cc){return respondWithRpcPromise(_0xc478('0x25'),_['merge'](_0x2d76b4[_0xc478('0x1a')],_0x2d76b4[_0xc478('0x17')]))[_0xc478('0x7')](respondWithResult(_0x1f60cc,null))['catch'](handleError(_0x1f60cc,null));};exports['voiceQueuesChannelHangup']=function(_0x242bc0,_0x7763d0){return respondWithRpcPromise(_0xc478('0x26'),_[_0xc478('0x1f')](_0x242bc0['query'],_0x242bc0[_0xc478('0x17')]))[_0xc478('0x7')](respondWithResult(_0x7763d0,null))['catch'](handleError(_0x7763d0,null));};exports[_0xc478('0x27')]=function(_0x1a8dc0,_0x5d9de6){return respondWithRpcPromise(_0xc478('0x28'),_[_0xc478('0x1f')](_0x1a8dc0['query'],_0x1a8dc0[_0xc478('0x17')]))[_0xc478('0x7')](respondWithResult(_0x5d9de6,null))[_0xc478('0x15')](handleError(_0x5d9de6,null));};exports[_0xc478('0x29')]=function(_0x16d8a7,_0x692ff0){return respondWithRpcPromise('Outbound',_0x16d8a7[_0xc478('0x1a')])[_0xc478('0x7')](respondWithResult(_0x692ff0,null))[_0xc478('0x15')](handleError(_0x692ff0,null));};exports[_0xc478('0x2a')]=function(_0xf204c8,_0xe87463){return respondWithRpcPromise('OutboundChannels',_0xf204c8[_0xc478('0x1a')])[_0xc478('0x7')](respondWithResult(_0xe87463,null))[_0xc478('0x15')](handleError(_0xe87463,null));};exports[_0xc478('0x2b')]=function(_0x1b09fe,_0x3862ed){var _0x473e5b;return respondWithRpcPromise(_0xc478('0x2c'),_0x1b09fe[_0xc478('0x1a')])[_0xc478('0x7')](function(_0x83999e){_0x473e5b=_0x83999e;return respondWithRpcPromise(_0xc478('0x2c'),_0x1b09fe[_0xc478('0x1a')],routingClient);})['then'](function(_0x12b898){return _['merge']({},_0x12b898,_0x473e5b);})[_0xc478('0x7')](respondWithResult(_0x3862ed,null))['catch'](handleError(_0x3862ed,null));};exports[_0xc478('0x2d')]=function(_0x5f309f,_0x386a9f){if(_0x5f309f[_0xc478('0x20')]&&_0x5f309f[_0xc478('0x20')][_0xc478('0x2e')]&&_0x5f309f[_0xc478('0x2f')]&&_0x5f309f[_0xc478('0x2f')][_0xc478('0xe')]){for(var _0x437cf1 in _0x5f309f[_0xc478('0x20')][_0xc478('0x2e')]){if(_0x5f309f[_0xc478('0x20')]['interaction'][_0xc478('0x30')](_0x437cf1)){db['MemberReport'][_0xc478('0x31')]({'where':{'channel':_0x437cf1,'membername':_0x5f309f[_0xc478('0x2f')][_0xc478('0xe')],'type':_0xc478('0x32'),'exitAt':null,'uniqueid':_0x5f309f['body'][_0xc478('0x2e')][_0x437cf1]&&_0x5f309f[_0xc478('0x20')]['interaction'][_0x437cf1][_0xc478('0x33')]?{'$notIn':_0x5f309f[_0xc478('0x20')][_0xc478('0x2e')][_0x437cf1]}:{'$ne':null}}})[_0xc478('0x7')](function(_0x3929c9){var _0xf08696=moment()['format'](_0xc478('0x34'));for(var _0x10b5a3=0x0,_0x5571a4=_0x3929c9['length'];_0x10b5a3<_0x5571a4;_0x10b5a3+=0x1){_0x3929c9[_0x10b5a3][_0xc478('0x35')]({'exitAt':_0xf08696});}});for(var _0x2d9aa5=0x0;_0x2d9aa5<_0x5f309f[_0xc478('0x20')]['interaction'][_0x437cf1]['length'];_0x2d9aa5+=0x1){db[_0xc478('0x36')]['findOrCreate']({'where':{'channel':_0x437cf1,'membername':_0x5f309f[_0xc478('0x2f')][_0xc478('0xe')],'type':'INTERACTION','uniqueid':_0x5f309f[_0xc478('0x20')][_0xc478('0x2e')][_0x437cf1][_0x2d9aa5],'exitAt':null},'defaults':{'channel':_0x437cf1,'membername':_0x5f309f[_0xc478('0x2f')][_0xc478('0xe')],'interface':_[_0xc478('0x10')](_0x5f309f['user'][_0xc478('0x37')])?util['format'](_0xc478('0x38'),_0x5f309f[_0xc478('0x2f')][_0xc478('0xe')]):_0x5f309f[_0xc478('0x2f')][_0xc478('0x37')],'type':_0xc478('0x32'),'enterAt':moment()[_0xc478('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xc478('0x3a'),'internal':_0x5f309f[_0xc478('0x2f')][_0xc478('0x3b')],'uniqueid':_0x5f309f[_0xc478('0x20')][_0xc478('0x2e')][_0x437cf1][_0x2d9aa5]}});}}}}return respondWithRpcPromise(_0xc478('0x3c'),{'id':_0x5f309f[_0xc478('0x17')]['id'],'capacity':_0x5f309f[_0xc478('0x20')][_0xc478('0x3d')]},routingClient)[_0xc478('0x7')](respondWithResult(_0x386a9f,null))[_0xc478('0x15')](handleError(_0x386a9f,null));};exports['telephones']=function(_0x5eff81,_0x3261aa){return respondWithRpcPromise(_0xc478('0x3e'),_0x5eff81[_0xc478('0x1a')])[_0xc478('0x7')](respondWithResult(_0x3261aa,null))[_0xc478('0x15')](handleError(_0x3261aa,null));};exports[_0xc478('0x3f')]=function(_0x57f945,_0x25cfaf){return respondWithRpcPromise(_0xc478('0x40'),_0x57f945[_0xc478('0x1a')])[_0xc478('0x7')](respondWithResult(_0x25cfaf,null))[_0xc478('0x15')](handleError(_0x25cfaf,null));};exports[_0xc478('0x41')]=function(_0x4627f5,_0x4926be){return respondWithRpcPromise(_0xc478('0x42'),_0x4627f5['query'])[_0xc478('0x7')](respondWithResult(_0x4926be,null))['catch'](handleError(_0x4926be,null));};exports[_0xc478('0x43')]=function(_0xebdae3,_0x24709e){return respondWithRpcPromise(_0xc478('0x44'),_0xebdae3[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](respondWithResult(_0x24709e,null))[_0xc478('0x15')](handleError(_0x24709e,null));};exports[_0xc478('0x45')]=function(_0x436619,_0xecd527){return respondWithRpcPromise(_0xc478('0x44'),_0x436619[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](findById(_0x436619[_0xc478('0x17')]['id']))['then'](respondWithResult(_0xecd527,null))['catch'](handleError(_0xecd527,null));};exports[_0xc478('0x46')]=function(_0x167334,_0x53ece9){return respondWithRpcPromise(_0xc478('0x47'),_0x167334['query'],routingClient)[_0xc478('0x7')](respondWithResult(_0x53ece9,null))[_0xc478('0x15')](handleError(_0x53ece9,null));};exports[_0xc478('0x48')]=function(_0x5c1304,_0x3fc436){return respondWithRpcPromise(_0xc478('0x47'),_0x5c1304[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](findById(_0x5c1304['params']['id']))[_0xc478('0x7')](respondWithResult(_0x3fc436,null))['catch'](handleError(_0x3fc436,null));};exports[_0xc478('0x49')]=function(_0x47e9a0,_0x2fd480){return respondWithRpcPromise(_0xc478('0x4a'),_0x47e9a0[_0xc478('0x1a')],mailClient)['then'](respondWithResult(_0x2fd480,null))[_0xc478('0x15')](handleError(_0x2fd480,null));};exports['openchannelQueues']=function(_0x2d50e8,_0xdd353f){return respondWithRpcPromise(_0xc478('0x4b'),_0x2d50e8[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](respondWithResult(_0xdd353f,null))['catch'](handleError(_0xdd353f,null));};exports['showOpenchannelQueues']=function(_0x11ea1e,_0x25ba01){return respondWithRpcPromise(_0xc478('0x4b'),_0x11ea1e[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](findById(_0x11ea1e[_0xc478('0x17')]['id']))[_0xc478('0x7')](respondWithResult(_0x25ba01,null))[_0xc478('0x15')](handleError(_0x25ba01,null));};exports[_0xc478('0x4c')]=function(_0x5cb2b8,_0x5d5455){return respondWithRpcPromise('SmsQueues',_0x5cb2b8['query'],routingClient)[_0xc478('0x7')](respondWithResult(_0x5d5455,null))[_0xc478('0x15')](handleError(_0x5d5455,null));};exports[_0xc478('0x4d')]=function(_0x162172,_0x487922){return respondWithRpcPromise(_0xc478('0x4e'),_0x162172[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](findById(_0x162172[_0xc478('0x17')]['id']))['then'](respondWithResult(_0x487922,null))[_0xc478('0x15')](handleError(_0x487922,null));};exports['whatsappQueues']=function(_0x155a1c,_0x4addc9){return respondWithRpcPromise(_0xc478('0x4f'),_0x155a1c[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](respondWithResult(_0x4addc9,null))[_0xc478('0x15')](handleError(_0x4addc9,null));};exports[_0xc478('0x50')]=function(_0x243205,_0x46d4ff){return respondWithRpcPromise('WhatsappQueues',_0x243205['query'],routingClient)[_0xc478('0x7')](findById(_0x243205['params']['id']))['then'](respondWithResult(_0x46d4ff,null))[_0xc478('0x15')](handleError(_0x46d4ff,null));};exports[_0xc478('0x51')]=function(_0x26c7f3,_0x42876c){return respondWithRpcPromise('FaxQueues',_0x26c7f3['query'],routingClient)[_0xc478('0x7')](respondWithResult(_0x42876c,null))[_0xc478('0x15')](handleError(_0x42876c,null));};exports[_0xc478('0x52')]=function(_0x550bab,_0x2d2e1a){return respondWithRpcPromise(_0xc478('0x53'),_0x550bab['query'],routingClient)[_0xc478('0x7')](findById(_0x550bab['params']['id']))['then'](respondWithResult(_0x2d2e1a,null))[_0xc478('0x15')](handleError(_0x2d2e1a,null));};exports['faxAccounts']=function(_0x32d6b9,_0x114456){return respondWithRpcPromise(_0xc478('0x54'),_0x32d6b9[_0xc478('0x1a')])[_0xc478('0x7')](respondWithResult(_0x114456,null))[_0xc478('0x15')](handleError(_0x114456,null));};exports[_0xc478('0x55')]=function(_0x4731ca,_0x2ad4e9){return respondWithRpcPromise(_0xc478('0x56'),_0x4731ca[_0xc478('0x1a')],routingClient)['then'](respondWithResult(_0x2ad4e9,null))['catch'](handleError(_0x2ad4e9,null));};exports[_0xc478('0x57')]=function(_0x357cac,_0x41a91d){return respondWithRpcPromise(_0xc478('0x58'),_0x357cac['query'],routingClient)['then'](respondWithResult(_0x41a91d,null))['catch'](handleError(_0x41a91d,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2da1bd,_0x345b2d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2da1bd[_0xc478('0x1a')],routingClient)['then'](respondWithResult(_0x345b2d,null))[_0xc478('0x15')](handleError(_0x345b2d,null));};exports[_0xc478('0x59')]=function(_0x262b8b,_0x1187a8){return respondWithRpcPromise(_0xc478('0x5a'),_0x262b8b[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](function(_0x2e31af){if(_0x262b8b[_0xc478('0x1a')]['type']!==undefined){var _0x28e308=_(_0x2e31af[_0xc478('0x11')])[_0xc478('0x5b')]([_0x262b8b[_0xc478('0x1a')][_0xc478('0x5c')],_0x262b8b['params']['id']])[_0xc478('0x5d')](_0xc478('0x5e'))[_0xc478('0x5f')]()['value']();return _0x2e31af['rows'][_0xc478('0x5b')](function(_0x5bdc4a){return _0x28e308[_0xc478('0x60')](_0x5bdc4a[_0xc478('0x5e')])>-0x1;});}else{return _0x2e31af[_0xc478('0x11')][_0xc478('0x5b')](function(_0x77e28e){return _0x77e28e[_0xc478('0x5e')]===parseInt(_0x262b8b[_0xc478('0x17')]['id']);});}})['then'](respondWithResult(_0x1187a8,null))[_0xc478('0x15')](handleError(_0x1187a8,null));};exports[_0xc478('0x61')]=function(_0x527199,_0x1e47e5){return respondWithRpcPromise(_0xc478('0x62'),_0x527199[_0xc478('0x1a')],routingClient)[_0xc478('0x7')](respondWithResult(_0x1e47e5,null))[_0xc478('0x15')](handleError(_0x1e47e5,null));};exports[_0xc478('0x63')]=function(_0x5186a1,_0x221240){return respondWithRpcPromise(_0xc478('0x64'),_0x5186a1['query'],routingClient)['then'](respondWithResult(_0x221240,null))[_0xc478('0x15')](handleError(_0x221240,null));};exports['faxQueuesWaitingInteractions']=function(_0x291c9a,_0x51672a){return respondWithRpcPromise(_0xc478('0x65'),_0x291c9a[_0xc478('0x1a')],routingClient)['then'](respondWithResult(_0x51672a,null))[_0xc478('0x15')](handleError(_0x51672a,null));};exports[_0xc478('0x66')]=function(_0x3e220e){return function(_0xe9fb24,_0x3bc6d6){var _0x29bfac,_0x1d8198;var _0x55741d=_[_0xc478('0x67')](_0x3e220e);var _0x230b8c=_0x3e220e==='chat'?_0xc478('0x68'):'Account';return db[_0x55741d+_0xc478('0x69')][_0xc478('0x6a')]({'raw':!![],'where':{'id':_0xe9fb24[_0xc478('0x17')]['id']}})[_0xc478('0x7')](function(_0x5d562d){if(_[_0xc478('0x10')](_0x5d562d)){throw new Error(_0x55741d+_0xc478('0x6b'));}_0x29bfac=_0x5d562d;return db[_0x55741d+_0xc478('0x6c')][_0xc478('0x6a')]({'where':{'id':_0xe9fb24[_0xc478('0x20')][_0xc478('0x6d')]},'include':[{'model':db[_0x55741d+_0xc478('0x6e')],'as':_0xc478('0x6e')},{'model':db[_0x55741d+_0x230b8c],'as':_0xc478('0x6f')}]});})['then'](function(_0x1a182d){if(_[_0xc478('0x10')](_0x1a182d)){throw new Error(_0x55741d+'\x20Message\x20not\x20found');}_0x1d8198=_0x1a182d;return _0x1a182d[_0xc478('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xc478('0x7')](function(){var _0x5929fd={'uniqueid':_0x3e220e+'.'+_0x1d8198['id']+'.'+_0x1d8198[_0xc478('0x6e')]['id'],'FromUserId':_0xe9fb24['user']['id'],'type':_0xc478('0x71')};_0x5929fd[_0x55741d+_0xc478('0x72')]=_0x1d8198['id'];_0x5929fd[_0x55741d+_0xc478('0x73')]=_0x1d8198[_0xc478('0x6e')]['id'];_0x5929fd[_0xc478('0x74')+_0x55741d+_0x230b8c+'Id']=_0x1d8198['Account']['id'];_0x5929fd['To'+_0x55741d+_0xc478('0x75')]=_0x29bfac['id'];return db[_0x55741d+_0xc478('0x76')]['create'](_0x5929fd);})[_0xc478('0x7')](function(){return respondWithRpcPromise(_0xc478('0x77'),{'channel':_0x3e220e,'interaction':_0x1d8198[_0xc478('0x6e')],'message':_0x1d8198,'account':_0x1d8198[_0xc478('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xc478('0x71'),'appdata':_0x29bfac['name']+','+(_0x1d8198['Account'][_0xc478('0x78')]||0x12c),'interval':_0xc478('0x79')}]},routingClient);})[_0xc478('0x7')](respondWithResult(_0x3bc6d6,null))[_0xc478('0x15')](handleError(_0x3bc6d6,null));};};exports[_0xc478('0x7a')]=function(_0x38d21e,_0x255f32){var _0x2df007,_0x453208;if(_[_0xc478('0x10')](_0x38d21e[_0xc478('0x20')][_0xc478('0x7b')])){throw new Error(_0xc478('0x7c'));}var _0x1e7da0=_0x38d21e[_0xc478('0x20')][_0xc478('0x7b')];var _0x5e56ed=_[_0xc478('0x67')](_0x1e7da0);var _0x1a178e=_0x1e7da0===_0xc478('0x7d')?_0xc478('0x68'):'Account';return db[_0xc478('0x7e')][_0xc478('0x6a')]({'raw':!![],'where':{'id':_0x38d21e['params']['id'],'role':_0xc478('0x3a')}})[_0xc478('0x7')](function(_0x3128e4){if(_[_0xc478('0x10')](_0x3128e4)){throw new Error(_0xc478('0x7f'));}_0x2df007=_0x3128e4;return db[_0x5e56ed+'Message'][_0xc478('0x6a')]({'where':{'id':_0x38d21e[_0xc478('0x20')][_0xc478('0x6d')]},'include':[{'model':db[_0x5e56ed+'Interaction'],'as':_0xc478('0x6e')},{'model':db[_0x5e56ed+_0x1a178e],'as':_0xc478('0x6f')}]});})[_0xc478('0x7')](function(_0x55f731){if(_[_0xc478('0x10')](_0x55f731)){throw new Error(_0x5e56ed+_0xc478('0x80'));}_0x453208=_0x55f731;return _0x55f731['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xc478('0x7')](function(){var _0x4a4ab3={'uniqueid':_0x1e7da0+'.'+_0x453208['id']+'.'+_0x453208[_0xc478('0x6e')]['id'],'FromUserId':_0x38d21e[_0xc478('0x2f')]['id'],'type':_0xc478('0x71'),'ToUserId':_0x2df007['id']};_0x4a4ab3[_0x5e56ed+_0xc478('0x72')]=_0x453208['id'];_0x4a4ab3[_0x5e56ed+_0xc478('0x73')]=_0x453208[_0xc478('0x6e')]['id'];_0x4a4ab3[_0xc478('0x74')+_0x5e56ed+_0x1a178e+'Id']=_0x453208[_0xc478('0x6f')]['id'];return db[_0x5e56ed+_0xc478('0x76')]['create'](_0x4a4ab3);})[_0xc478('0x7')](function(){return respondWithRpcPromise(_0xc478('0x77'),{'channel':_0x1e7da0,'interaction':_0x453208[_0xc478('0x6e')],'message':_0x453208,'account':_0x453208[_0xc478('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xc478('0x3a'),'appdata':_0x2df007['name']+','+(_0x453208['Account'][_0xc478('0x81')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xc478('0x7')](respondWithResult(_0x255f32,null))[_0xc478('0x15')](handleError(_0x255f32,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 5da36c3..64075af 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 _0x0646=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','run','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x4c76ad,_0x24bdab){var _0xde0a18=function(_0x575d21){while(--_0x575d21){_0x4c76ad['push'](_0x4c76ad['shift']());}};_0xde0a18(++_0x24bdab);}(_0x0646,0x82));var _0x6064=function(_0xef2860,_0x20dbaa){_0xef2860=_0xef2860-0x0;var _0x526018=_0x0646[_0xef2860];return _0x526018;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6064('0x0'));var timeout=require(_0x6064('0x1'));var express=require(_0x6064('0x2'));var router=express[_0x6064('0x3')]();var fs_extra=require(_0x6064('0x4'));var auth=require(_0x6064('0x5'));var interaction=require(_0x6064('0x6'));var config=require(_0x6064('0x7'));var controller=require('./schedule.controller');router[_0x6064('0x8')]('/',auth[_0x6064('0x9')](),controller[_0x6064('0xa')]);router['get'](_0x6064('0xb'),auth[_0x6064('0x9')](),controller[_0x6064('0xc')]);router[_0x6064('0x8')]('/:id/run',auth[_0x6064('0x9')](),controller[_0x6064('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6064('0xe')](_0x6064('0xb'),auth[_0x6064('0x9')](),controller[_0x6064('0xf')]);router[_0x6064('0x10')](_0x6064('0xb'),auth['isAuthenticated'](),controller[_0x6064('0x11')]);module[_0x6064('0x12')]=router; \ No newline at end of file +var _0x6950=['../../components/auth/service','./schedule.controller','get','index','/:id','isAuthenticated','run','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0xb5da,_0x315c36){var _0x1f2092=function(_0x4fcd55){while(--_0x4fcd55){_0xb5da['push'](_0xb5da['shift']());}};_0x1f2092(++_0x315c36);}(_0x6950,0x194));var _0x0695=function(_0x641bfc,_0x540afa){_0x641bfc=_0x641bfc-0x0;var _0x135864=_0x6950[_0x641bfc];return _0x135864;};'use strict';var multer=require(_0x0695('0x0'));var util=require('util');var path=require(_0x0695('0x1'));var timeout=require(_0x0695('0x2'));var express=require(_0x0695('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0695('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0695('0x5'));router[_0x0695('0x6')]('/',auth['isAuthenticated'](),controller[_0x0695('0x7')]);router[_0x0695('0x6')](_0x0695('0x8'),auth[_0x0695('0x9')](),controller['show']);router[_0x0695('0x6')]('/:id/run',auth[_0x0695('0x9')](),controller[_0x0695('0xa')]);router[_0x0695('0xb')]('/',auth[_0x0695('0x9')](),controller[_0x0695('0xc')]);router[_0x0695('0xd')](_0x0695('0x8'),auth[_0x0695('0x9')](),controller[_0x0695('0xe')]);router['delete'](_0x0695('0x8'),auth[_0x0695('0x9')](),controller[_0x0695('0xf')]);module[_0x0695('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e4393b3..a2bde4f 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 _0x446c=['BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters','months','hours','minutes','days','ENUM','csv','xlsx','custom'];(function(_0x227518,_0x552a38){var _0x3aae94=function(_0x6866c4){while(--_0x6866c4){_0x227518['push'](_0x227518['shift']());}};_0x3aae94(++_0x552a38);}(_0x446c,0x156));var _0xc446=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x446c[_0x246148];return _0x453d94;};'use strict';var Sequelize=require(_0xc446('0x0'));module[_0xc446('0x1')]={'name':{'type':Sequelize[_0xc446('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc446('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc446('0x2')],'allowNull':![],'defaultValue':_0xc446('0x3')},'startAt':{'type':Sequelize[_0xc446('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc446('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xc446('0x6'),_0xc446('0x7'),'weeks','days',_0xc446('0x8'),_0xc446('0x9')),'allowNull':![],'defaultValue':_0xc446('0xa')},'output':{'type':Sequelize[_0xc446('0xb')](_0xc446('0xc'),'pdf',_0xc446('0xd')),'allowNull':![],'defaultValue':_0xc446('0xc')},'type':{'type':Sequelize[_0xc446('0xb')](_0xc446('0xe'),'default'),'allowNull':![],'defaultValue':_0xc446('0xe')},'sendMail':{'type':Sequelize[_0xc446('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0xc446('0x2')]},'cc':{'type':Sequelize[_0xc446('0x10')]},'bcc':{'type':Sequelize[_0xc446('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xc446('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4148=['days','ENUM','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','months','hours','minutes'];(function(_0x36ed82,_0x322013){var _0x763c2a=function(_0x288879){while(--_0x288879){_0x36ed82['push'](_0x36ed82['shift']());}};_0x763c2a(++_0x322013);}(_0x4148,0xc6));var _0x8414=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x4148[_0x2706da];return _0x3ba87e;};'use strict';var Sequelize=require(_0x8414('0x0'));module[_0x8414('0x1')]={'name':{'type':Sequelize[_0x8414('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8414('0x2')]},'active':{'type':Sequelize[_0x8414('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8414('0x4')},'startAt':{'type':Sequelize[_0x8414('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8414('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8414('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x8414('0x7'),'quarters',_0x8414('0x8'),'weeks','days',_0x8414('0x9'),_0x8414('0xa')),'allowNull':![],'defaultValue':_0x8414('0xb')},'output':{'type':Sequelize[_0x8414('0xc')](_0x8414('0xd'),_0x8414('0xe'),_0x8414('0xf')),'allowNull':![],'defaultValue':_0x8414('0xd')},'type':{'type':Sequelize[_0x8414('0xc')](_0x8414('0x10'),_0x8414('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x8414('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8414('0x12')]},'bcc':{'type':Sequelize[_0x8414('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x8414('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 2842a58..3638af3 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 _0x46ed=['findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','Schedule','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','options','count','includeAll','include'];(function(_0x3303a5,_0x362dd6){var _0x343f07=function(_0x4c346e){while(--_0x4c346e){_0x3303a5['push'](_0x3303a5['shift']());}};_0x343f07(++_0x362dd6);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Scheduler';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));};exports[_0xd46e('0x54')]=function(_0x2bcb2b,_0x402df2,_0x47a86c){var _0x3ec709=require(_0xd46e('0x55'));return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2bcb2b['params']['id']},'raw':!![]})[_0xd46e('0x25')](handleEntityNotFound(_0x402df2,null))[_0xd46e('0x25')](function(){_0x3ec709[_0xd46e('0x54')](_0x2bcb2b[_0xd46e('0x48')]['id']);})['then'](respondWithStatusCode(_0x402df2,null))[_0xd46e('0x4b')](handleError(_0x402df2,null));}; \ No newline at end of file +var _0x7217=['then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','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','run','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0x7217,0x19e));var _0x7721=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x7217[_0xf0bcac];return _0x4e4c65;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));};exports[_0x7721('0x5a')]=function(_0x577f47,_0x50e9e9,_0x4e112e){var _0x885a3a=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x577f47['params']['id']},'raw':!![]})[_0x7721('0x29')](handleEntityNotFound(_0x50e9e9,null))[_0x7721('0x29')](function(){_0x885a3a[_0x7721('0x5a')](_0x577f47['params']['id']);})[_0x7721('0x29')](respondWithStatusCode(_0x50e9e9,null))['catch'](handleError(_0x50e9e9,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 95f91d3..3fa5fc0 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 _0xad33=['Schedule','tools_schedules','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x957739,_0x2785ef){var _0x11c46a=function(_0x2f2183){while(--_0x2f2183){_0x957739['push'](_0x957739['shift']());}};_0x11c46a(++_0x2785ef);}(_0xad33,0x154));var _0x3ad3=function(_0x53feda,_0x8d5d13){_0x53feda=_0x53feda-0x0;var _0x2c0b4f=_0xad33[_0x53feda];return _0x2c0b4f;};'use strict';var _=require(_0x3ad3('0x0'));var util=require(_0x3ad3('0x1'));var logger=require('../../config/logger')(_0x3ad3('0x2'));var moment=require(_0x3ad3('0x3'));var BPromise=require(_0x3ad3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ad3('0x5'));var rimraf=require(_0x3ad3('0x6'));var config=require(_0x3ad3('0x7'));var attributes=require(_0x3ad3('0x8'));module[_0x3ad3('0x9')]=function(_0x11b3a0,_0x4e5578){return _0x11b3a0[_0x3ad3('0xa')](_0x3ad3('0xb'),attributes,{'tableName':_0x3ad3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97e9=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util'];(function(_0xecc8d9,_0x1a7947){var _0x564cf8=function(_0x18c4a1){while(--_0x18c4a1){_0xecc8d9['push'](_0xecc8d9['shift']());}};_0x564cf8(++_0x1a7947);}(_0x97e9,0x9a));var _0x997e=function(_0x5cbc47,_0x52a3c4){_0x5cbc47=_0x5cbc47-0x0;var _0x3f3a81=_0x97e9[_0x5cbc47];return _0x3f3a81;};'use strict';var _=require(_0x997e('0x0'));var util=require(_0x997e('0x1'));var logger=require('../../config/logger')(_0x997e('0x2'));var moment=require(_0x997e('0x3'));var BPromise=require(_0x997e('0x4'));var rp=require(_0x997e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x997e('0x6'));var config=require(_0x997e('0x7'));var attributes=require(_0x997e('0x8'));module[_0x997e('0x9')]=function(_0x82a596,_0x565820){return _0x82a596[_0x997e('0xa')](_0x997e('0xb'),attributes,{'tableName':_0x997e('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 67b3deb..34594eb 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 _0xbb02=['client','http','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0xbb02,0x98));var _0x2bb0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbb02[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x2bb0('0x0'));var moment=require(_0x2bb0('0x1'));var BPromise=require(_0x2bb0('0x2'));var rs=require(_0x2bb0('0x3'));var fs=require('fs');var Redis=require(_0x2bb0('0x4'));var db=require(_0x2bb0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2bb0('0x6'));var config=require(_0x2bb0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2bb0('0x8')][_0x2bb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b4cc5,_0x256e4d,_0x48db70){return new BPromise(function(_0x4855ab,_0x3f93db){return client[_0x2bb0('0xa')](_0x5b4cc5,_0x48db70)['then'](function(_0x25a2c0){logger[_0x2bb0('0xb')](_0x2bb0('0xc'),_0x256e4d,'request\x20sent');logger[_0x2bb0('0xd')](_0x2bb0('0xe'),_0x256e4d,_0x2bb0('0xf'),JSON[_0x2bb0('0x10')](_0x25a2c0));if(_0x25a2c0['error']){if(_0x25a2c0[_0x2bb0('0x11')]['code']===0x1f4){logger['error'](_0x2bb0('0xc'),_0x256e4d,_0x25a2c0[_0x2bb0('0x11')][_0x2bb0('0x12')]);return _0x3f93db(_0x25a2c0['error'][_0x2bb0('0x12')]);}logger['error'](_0x2bb0('0xc'),_0x256e4d,_0x25a2c0['error']['message']);return _0x4855ab(_0x25a2c0[_0x2bb0('0x11')]['message']);}else{logger[_0x2bb0('0xb')](_0x2bb0('0xc'),_0x256e4d,_0x2bb0('0xf'));_0x4855ab(_0x25a2c0['result'][_0x2bb0('0x12')]);}})[_0x2bb0('0x13')](function(_0x49c887){logger['error'](_0x2bb0('0xc'),_0x256e4d,_0x49c887);_0x3f93db(_0x49c887);});});} \ No newline at end of file +var _0xf754=['then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf754,0x114));var _0x4f75=function(_0x5cdd53,_0x849bac){_0x5cdd53=_0x5cdd53-0x0;var _0x1d6f53=_0xf754[_0x5cdd53];return _0x1d6f53;};'use strict';var _=require(_0x4f75('0x0'));var util=require('util');var moment=require(_0x4f75('0x1'));var BPromise=require(_0x4f75('0x2'));var rs=require(_0x4f75('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f75('0x4'))['db'];var utils=require(_0x4f75('0x5'));var logger=require(_0x4f75('0x6'))('rpc');var config=require(_0x4f75('0x7'));var jayson=require(_0x4f75('0x8'));var client=jayson[_0x4f75('0x9')][_0x4f75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x475aec,_0x168cea,_0xc33a1a){return new BPromise(function(_0x15d620,_0x13a554){return client[_0x4f75('0xb')](_0x475aec,_0xc33a1a)[_0x4f75('0xc')](function(_0x3df2bd){logger[_0x4f75('0xd')](_0x4f75('0xe'),_0x168cea,_0x4f75('0xf'));logger[_0x4f75('0x10')](_0x4f75('0x11'),_0x168cea,'request\x20sent',JSON[_0x4f75('0x12')](_0x3df2bd));if(_0x3df2bd[_0x4f75('0x13')]){if(_0x3df2bd[_0x4f75('0x13')][_0x4f75('0x14')]===0x1f4){logger[_0x4f75('0x13')](_0x4f75('0xe'),_0x168cea,_0x3df2bd[_0x4f75('0x13')][_0x4f75('0x15')]);return _0x13a554(_0x3df2bd[_0x4f75('0x13')][_0x4f75('0x15')]);}logger[_0x4f75('0x13')](_0x4f75('0xe'),_0x168cea,_0x3df2bd['error'][_0x4f75('0x15')]);return _0x15d620(_0x3df2bd[_0x4f75('0x13')][_0x4f75('0x15')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x168cea,_0x4f75('0xf'));_0x15d620(_0x3df2bd[_0x4f75('0x16')]['message']);}})[_0x4f75('0x17')](function(_0x3d8d1e){logger[_0x4f75('0x13')](_0x4f75('0xe'),_0x168cea,_0x3d8d1e);_0x13a554(_0x3d8d1e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2fb6bb1..cde41dc 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 _0x00b4=['../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x00b4,0x18a));var _0x400b=function(_0x21df39,_0x432f7b){_0x21df39=_0x21df39-0x0;var _0x11b500=_0x00b4[_0x21df39];return _0x11b500;};'use strict';var multer=require(_0x400b('0x0'));var util=require(_0x400b('0x1'));var path=require('path');var timeout=require(_0x400b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x400b('0x3'));var auth=require(_0x400b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x400b('0x5'));var controller=require(_0x400b('0x6'));router[_0x400b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x400b('0x7')](_0x400b('0x8'),auth[_0x400b('0x9')](),controller[_0x400b('0xa')]);router[_0x400b('0x7')](_0x400b('0xb'),auth[_0x400b('0x9')](),controller[_0x400b('0xc')]);router[_0x400b('0x7')](_0x400b('0xd'),auth[_0x400b('0x9')](),controller[_0x400b('0xe')]);router[_0x400b('0xf')]('/',auth[_0x400b('0x9')](),controller[_0x400b('0x10')]);router[_0x400b('0x11')](_0x400b('0xb'),auth[_0x400b('0x9')](),controller[_0x400b('0x12')]);router['delete'](_0x400b('0xb'),auth[_0x400b('0x9')](),controller[_0x400b('0x13')]);module[_0x400b('0x14')]=router; \ No newline at end of file +var _0x05ac=['../../config/environment','isAuthenticated','get','describe','/:id','show','/:id/download','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2c8a4e,_0x98eafd){var _0x456157=function(_0x3e6720){while(--_0x3e6720){_0x2c8a4e['push'](_0x2c8a4e['shift']());}};_0x456157(++_0x98eafd);}(_0x05ac,0x171));var _0xc05a=function(_0x2716be,_0x44cf38){_0x2716be=_0x2716be-0x0;var _0x3b6c23=_0x05ac[_0x2716be];return _0x3b6c23;};'use strict';var multer=require(_0xc05a('0x0'));var util=require(_0xc05a('0x1'));var path=require(_0xc05a('0x2'));var timeout=require(_0xc05a('0x3'));var express=require(_0xc05a('0x4'));var router=express[_0xc05a('0x5')]();var fs_extra=require(_0xc05a('0x6'));var auth=require(_0xc05a('0x7'));var interaction=require(_0xc05a('0x8'));var config=require(_0xc05a('0x9'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xc05a('0xa')](),controller['index']);router[_0xc05a('0xb')]('/describe',auth[_0xc05a('0xa')](),controller[_0xc05a('0xc')]);router[_0xc05a('0xb')](_0xc05a('0xd'),auth[_0xc05a('0xa')](),controller[_0xc05a('0xe')]);router[_0xc05a('0xb')](_0xc05a('0xf'),auth[_0xc05a('0xa')](),controller['download']);router[_0xc05a('0x10')]('/',auth[_0xc05a('0xa')](),controller['create']);router[_0xc05a('0x11')]('/:id',auth[_0xc05a('0xa')](),controller[_0xc05a('0x12')]);router[_0xc05a('0x13')](_0xc05a('0xd'),auth[_0xc05a('0xa')](),controller['destroy']);module[_0xc05a('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8a3aa2b..d5b3baf 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 _0x7da7=['startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','value','INTEGER'];(function(_0x5e59d9,_0x550387){var _0x491f76=function(_0x445f9e){while(--_0x445f9e){_0x5e59d9['push'](_0x5e59d9['shift']());}};_0x491f76(++_0x550387);}(_0x7da7,0x10d));var _0x77da=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x7da7[_0x420d8d];return _0x4865d7;};'use strict';var Sequelize=require(_0x77da('0x0'));var moment=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x77da('0x3')],'get':function(){return this[_0x77da('0x4')]('value')?path[_0x77da('0x5')](this[_0x77da('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x77da('0x6')]},'channel':{'type':Sequelize[_0x77da('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x30afe0){var _0x47cf1d=_0x30afe0[_0x77da('0x7')](/\\/g,'/');this[_0x77da('0x8')](_0x77da('0x9'),_0x47cf1d);}},'rating':{'type':Sequelize[_0x77da('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x77da('0xa')],'set':function(_0x58f3fe){this[_0x77da('0x8')](_0x77da('0xb'),moment()[_0x77da('0xc')](_0x58f3fe,'ms'));this['setDataValue'](_0x77da('0xd'),moment());this[_0x77da('0x8')](_0x77da('0xe'),_0x58f3fe);}},'startedAt':{'type':Sequelize[_0x77da('0xf')],'get':function(){return moment(this['getDataValue'](_0x77da('0xb')))[_0x77da('0x10')](_0x77da('0x11'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x77da('0x4')](_0x77da('0xd')))['format'](_0x77da('0x11'))[_0x77da('0x12')]();}},'createdAt':{'type':Sequelize[_0x77da('0xf')],'get':function(){return moment(this[_0x77da('0x4')]('createdAt'))[_0x77da('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x77da('0x12')]();}},'updatedAt':{'type':Sequelize[_0x77da('0xf')],'get':function(){return moment(this[_0x77da('0x4')](_0x77da('0x13')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0xdc97=['startedAt','subtract','closedAt','duration','DATE','toString','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','path','exports','getDataValue','value','STRING','setDataValue','INTEGER'];(function(_0x2acfa0,_0x3b5933){var _0xbdeef4=function(_0x532f41){while(--_0x532f41){_0x2acfa0['push'](_0x2acfa0['shift']());}};_0xbdeef4(++_0x3b5933);}(_0xdc97,0x13b));var _0x7dc9=function(_0x148dc5,_0x13ab99){_0x148dc5=_0x148dc5-0x0;var _0x42bfa5=_0xdc97[_0x148dc5];return _0x42bfa5;};'use strict';var Sequelize=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var config=require('../../config/environment');module[_0x7dc9('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7dc9('0x4')](_0x7dc9('0x5'))?path['extname'](this[_0x7dc9('0x4')](_0x7dc9('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x7dc9('0x6')]},'channel':{'type':Sequelize[_0x7dc9('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2636ef){var _0x4f91c7=_0x2636ef['replace'](/\\/g,'/');this[_0x7dc9('0x7')](_0x7dc9('0x5'),_0x4f91c7);}},'rating':{'type':Sequelize[_0x7dc9('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7dc9('0x8')],'set':function(_0x3dd07e){this['setDataValue'](_0x7dc9('0x9'),moment()[_0x7dc9('0xa')](_0x3dd07e,'ms'));this[_0x7dc9('0x7')](_0x7dc9('0xb'),moment());this[_0x7dc9('0x7')](_0x7dc9('0xc'),_0x3dd07e);}},'startedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this['getDataValue']('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x7dc9('0xe')]();}},'closedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this['getDataValue'](_0x7dc9('0xb')))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}},'createdAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this[_0x7dc9('0x4')]('createdAt'))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}},'updatedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this[_0x7dc9('0x4')](_0x7dc9('0x11')))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2fe07c5..304cd28 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 _0x93dc=['send','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','params','create','body','createdAt','closedAt','value','find','describe','catch','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','Not\x20found','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','update','then','destroy','error','stack','name'];(function(_0x47241a,_0x1907c6){var _0x4f5df5=function(_0x5221bf){while(--_0x5221bf){_0x47241a['push'](_0x47241a['shift']());}};_0x4f5df5(++_0x1907c6);}(_0x93dc,0xfc));var _0xc93d=function(_0x174fa8,_0x1c00c4){_0x174fa8=_0x174fa8-0x0;var _0x4da512=_0x93dc[_0x174fa8];return _0x4da512;};'use strict';var emlformat=require(_0xc93d('0x0'));var rimraf=require(_0xc93d('0x1'));var zipdir=require(_0xc93d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc93d('0x3'));var moment=require('moment');var BPromise=require(_0xc93d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc93d('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc93d('0x6'));var _=require(_0xc93d('0x7'));var squel=require(_0xc93d('0x8'));var crypto=require(_0xc93d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc93d('0xa'));var toCsv=require(_0xc93d('0x5'));var querystring=require(_0xc93d('0xb'));var Papa=require(_0xc93d('0xc'));var Redis=require(_0xc93d('0xd'));var authService=require(_0xc93d('0xe'));var qs=require(_0xc93d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc93d('0x10'));var logger=require(_0xc93d('0x11'))(_0xc93d('0x12'));var utils=require(_0xc93d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc93d('0x14'));var db=require(_0xc93d('0x15'))['db'];function respondWithStatusCode(_0x58233e,_0x33dd3c){_0x33dd3c=_0x33dd3c||0xcc;return function(_0x2b06aa){if(_0x2b06aa){return _0x58233e[_0xc93d('0x16')](_0x33dd3c);}return _0x58233e[_0xc93d('0x17')](_0x33dd3c)[_0xc93d('0x18')]();};}function respondWithResult(_0x5f1c7c,_0x395ca4){_0x395ca4=_0x395ca4||0xc8;return function(_0x3f7f0a){if(_0x3f7f0a){return _0x5f1c7c[_0xc93d('0x17')](_0x395ca4)['json'](_0x3f7f0a);}};}function respondWithFilteredResult(_0x36cfda,_0x2e5a7b){return function(_0x234a24){if(_0x234a24){var _0xb38f85=typeof _0x2e5a7b[_0xc93d('0x19')]==='undefined'&&typeof _0x2e5a7b[_0xc93d('0x1a')]===_0xc93d('0x1b');var _0x945f3a=_0x234a24[_0xc93d('0x1c')];var _0x149f5f=_0xb38f85?0x0:_0x2e5a7b[_0xc93d('0x19')];var _0x20342e=_0xb38f85?_0x234a24[_0xc93d('0x1c')]:_0x2e5a7b[_0xc93d('0x19')]+_0x2e5a7b[_0xc93d('0x1a')];var _0x5b0d2c;if(_0x20342e>=_0x945f3a){_0x20342e=_0x945f3a;_0x5b0d2c=0xc8;}else{_0x5b0d2c=0xce;}_0x36cfda[_0xc93d('0x17')](_0x5b0d2c);return _0x36cfda[_0xc93d('0x1d')]('Content-Range',_0x149f5f+'-'+_0x20342e+'/'+_0x945f3a)['json'](_0x234a24);}return null;};}function patchUpdates(_0x21150b){return function(_0x403d1c){try{jsonpatch['apply'](_0x403d1c,_0x21150b,!![]);}catch(_0x431393){return BPromise['reject'](_0x431393);}return _0x403d1c['save']();};}function saveUpdates(_0x3ef375,_0x9ba2bc){return function(_0x2d7c81){if(_0x2d7c81){return _0x2d7c81[_0xc93d('0x1e')](_0x3ef375)[_0xc93d('0x1f')](function(_0x1a03de){return _0x1a03de;});}return null;};}function removeEntity(_0x1b4eca,_0x1db0dc){return function(_0x1f2c1c){if(_0x1f2c1c){return _0x1f2c1c[_0xc93d('0x20')]()['then'](function(){_0x1b4eca['status'](0xcc)[_0xc93d('0x18')]();});}};}function handleEntityNotFound(_0x1f5838,_0x270b4a){return function(_0x35934d){if(!_0x35934d){_0x1f5838['sendStatus'](0x194);}return _0x35934d;};}function handleError(_0x3d767b,_0x103f52){_0x103f52=_0x103f52||0x1f4;return function(_0x3a1559){logger[_0xc93d('0x21')](_0x3a1559[_0xc93d('0x22')]);if(_0x3a1559['name']){delete _0x3a1559[_0xc93d('0x23')];}_0x3d767b['status'](_0x103f52)[_0xc93d('0x24')](_0x3a1559);};}exports['index']=function(_0x2caaa1,_0x242033){var _0x308159={},_0x574940={},_0x4f4af4={'count':0x0,'rows':[]};var _0x27b93b=_['map'](db[_0xc93d('0x25')]['rawAttributes'],function(_0x2d45e2){return{'name':_0x2d45e2['fieldName'],'type':_0x2d45e2[_0xc93d('0x26')][_0xc93d('0x27')]};});_0x574940[_0xc93d('0x28')]=_[_0xc93d('0x29')](_['map'](_0x27b93b,_0xc93d('0x23')),[_0xc93d('0x2a')]);_0x574940[_0xc93d('0x2b')]=_[_0xc93d('0x2c')](_0x2caaa1[_0xc93d('0x2b')]);_0x574940[_0xc93d('0x2d')]=_[_0xc93d('0x2e')](_0x574940[_0xc93d('0x28')],_0x574940[_0xc93d('0x2b')]);_0x308159[_0xc93d('0x2f')]=_['intersection'](_0x574940[_0xc93d('0x28')],qs[_0xc93d('0x30')](_0x2caaa1[_0xc93d('0x2b')][_0xc93d('0x30')]));_0x308159[_0xc93d('0x2f')]=_0x308159[_0xc93d('0x2f')][_0xc93d('0x31')]?_0x308159['attributes']:_0x574940[_0xc93d('0x28')];if(!_0x2caaa1[_0xc93d('0x2b')][_0xc93d('0x32')](_0xc93d('0x33'))){_0x308159[_0xc93d('0x1a')]=qs['limit'](_0x2caaa1[_0xc93d('0x2b')][_0xc93d('0x1a')]);_0x308159['offset']=qs['offset'](_0x2caaa1['query'][_0xc93d('0x19')]);}_0x308159[_0xc93d('0x34')]=qs[_0xc93d('0x35')](_0x2caaa1[_0xc93d('0x2b')][_0xc93d('0x35')]);_0x308159[_0xc93d('0x36')]=qs['filters'](_[_0xc93d('0x37')](_0x2caaa1['query'],_0x574940[_0xc93d('0x2d')]),_0x27b93b);if(_0x2caaa1[_0xc93d('0x2b')][_0xc93d('0x38')]){_0x308159['where']=_[_0xc93d('0x39')](_0x308159[_0xc93d('0x36')],{'$or':_[_0xc93d('0x3a')](_0x27b93b,function(_0x199134){if(_0x199134[_0xc93d('0x26')]!=='VIRTUAL'){var _0x130c04={};_0x130c04[_0x199134[_0xc93d('0x23')]]={'$like':'%'+_0x2caaa1['query'][_0xc93d('0x38')]+'%'};return _0x130c04;}})});}_0x308159=_[_0xc93d('0x39')]({},_0x308159,_0x2caaa1[_0xc93d('0x3b')]);var _0x3abed={'where':_0x308159[_0xc93d('0x36')]};return db[_0xc93d('0x25')][_0xc93d('0x1c')](_0x3abed)['then'](function(_0xda07ea){_0x4f4af4[_0xc93d('0x1c')]=_0xda07ea;if(_0x2caaa1[_0xc93d('0x2b')][_0xc93d('0x3c')]){_0x308159[_0xc93d('0x3d')]=[{'all':!![]}];}return db[_0xc93d('0x25')][_0xc93d('0x3e')](_0x308159);})['then'](function(_0xab6288){_0x4f4af4[_0xc93d('0x3f')]=_0xab6288;return _0x4f4af4;})['then'](respondWithFilteredResult(_0x242033,_0x308159))['catch'](handleError(_0x242033,null));};exports[_0xc93d('0x40')]=function(_0x4fe4b2,_0x5114dd){var _0x288b20={'raw':![],'where':{'id':_0x4fe4b2[_0xc93d('0x41')]['id']}},_0x5bbaa7={};_0x5bbaa7['model']=_[_0xc93d('0x2c')](db[_0xc93d('0x25')]['rawAttributes']);_0x5bbaa7['query']=_[_0xc93d('0x2c')](_0x4fe4b2[_0xc93d('0x2b')]);_0x5bbaa7[_0xc93d('0x2d')]=_['intersection'](_0x5bbaa7[_0xc93d('0x28')],_0x5bbaa7[_0xc93d('0x2b')]);_0x288b20[_0xc93d('0x2f')]=_[_0xc93d('0x2e')](_0x5bbaa7[_0xc93d('0x28')],qs[_0xc93d('0x30')](_0x4fe4b2[_0xc93d('0x2b')]['fields']));_0x288b20[_0xc93d('0x2f')]=_0x288b20['attributes'][_0xc93d('0x31')]?_0x288b20[_0xc93d('0x2f')]:_0x5bbaa7['model'];if(_0x4fe4b2['query'][_0xc93d('0x3c')]){_0x288b20[_0xc93d('0x3d')]=[{'all':!![]}];}_0x288b20=_['merge']({},_0x288b20,_0x4fe4b2[_0xc93d('0x3b')]);return db['ScreenRecording']['find'](_0x288b20)[_0xc93d('0x1f')](handleEntityNotFound(_0x5114dd,null))[_0xc93d('0x1f')](respondWithResult(_0x5114dd,null))['catch'](handleError(_0x5114dd,null));};exports[_0xc93d('0x42')]=function(_0x2d3c73,_0x3b0336){return db[_0xc93d('0x25')][_0xc93d('0x42')](_0x2d3c73[_0xc93d('0x43')],{})[_0xc93d('0x1f')](respondWithResult(_0x3b0336,0xc9))['catch'](handleError(_0x3b0336,null));};exports[_0xc93d('0x1e')]=function(_0x15d260,_0x5c875c){if(_0x15d260['body']['id']){delete _0x15d260[_0xc93d('0x43')]['id'];}delete _0x15d260['body']['duration'];delete _0x15d260['body'][_0xc93d('0x44')];delete _0x15d260[_0xc93d('0x43')][_0xc93d('0x45')];delete _0x15d260[_0xc93d('0x43')][_0xc93d('0x46')];return db[_0xc93d('0x25')][_0xc93d('0x47')]({'where':{'id':_0x15d260[_0xc93d('0x41')]['id']}})[_0xc93d('0x1f')](handleEntityNotFound(_0x5c875c,null))[_0xc93d('0x1f')](saveUpdates(_0x15d260[_0xc93d('0x43')],null))[_0xc93d('0x1f')](respondWithResult(_0x5c875c,null))['catch'](handleError(_0x5c875c,null));};exports[_0xc93d('0x48')]=function(_0x153885,_0x14862b){return db['ScreenRecording']['describe']()[_0xc93d('0x1f')](respondWithResult(_0x14862b,null))[_0xc93d('0x49')](handleError(_0x14862b,null));};exports['download']=function(_0x1789fa,_0x3a2927,_0x5b4b0e){var _0x2e4826=require(_0xc93d('0x4a'));var _0x450ca9=![];var _0x5d00b5={};if(_0x1789fa[_0xc93d('0x2b')][_0xc93d('0x26')]&&_0x1789fa[_0xc93d('0x2b')][_0xc93d('0x26')]===_0xc93d('0x4b')){_0x5d00b5[_0xc93d('0x4b')]=_0x1789fa[_0xc93d('0x41')]['id'];}else{_0x5d00b5['id']=_0x1789fa[_0xc93d('0x41')]['id'];}return db[_0xc93d('0x25')][_0xc93d('0x47')]({'where':_0x5d00b5,'attributes':['id','value'],'raw':!![]})[_0xc93d('0x1f')](handleEntityNotFound(_0x3a2927,null))['then'](function(_0x14fcb5){if(_0x14fcb5){var _0x3717e1=path[_0xc93d('0x4c')](config[_0xc93d('0x4d')],'server/files/screen_recordings',_0x14fcb5[_0xc93d('0x46')]);var _0x4fc8d4=util[_0xc93d('0x2a')](_0xc93d('0x4e'),_0x3717e1);if(fs[_0xc93d('0x4f')](_0x4fc8d4)){_0x450ca9=!![];return _0x2e4826[_0xc93d('0x50')](_0x4fc8d4,_0x3717e1,config[_0xc93d('0x51')][_0xc93d('0x52')])['then'](function(){return _0x14fcb5;});}return _0x14fcb5;}})['then'](function(_0x2b6132){if(_0x2b6132){var _0x3ff95d=path['join'](config[_0xc93d('0x4d')],_0xc93d('0x53'),_0x2b6132['value']);if(!fs['existsSync'](_0x3ff95d)){throw new db['Sequelize'][(_0xc93d('0x54'))](_0xc93d('0x55'));}if(_0x2b6132[_0xc93d('0x56')]){return _0x3a2927[_0xc93d('0x57')](_0x3ff95d,_0x2b6132[_0xc93d('0x56')]+path[_0xc93d('0x58')](_0x3ff95d),function(){if(_0x450ca9){fs[_0xc93d('0x59')](_0x3ff95d);}});}else{return _0x3a2927[_0xc93d('0x57')](_0x3ff95d,function(_0x4f21d0){if(_0x450ca9){fs[_0xc93d('0x59')](_0x3ff95d);}});}}})['catch'](function(_0x479a75){if(_0x479a75['message']===_0xc93d('0x55')){_0x3a2927['status'](0x194)[_0xc93d('0x24')](_0xc93d('0x5a'));}else{return handleError(_0x3a2927,null);}});};exports[_0xc93d('0x20')]=function(_0x22efbd,_0x1133e6){return db[_0xc93d('0x25')][_0xc93d('0x47')]({'where':{'id':_0x22efbd[_0xc93d('0x41')]['id']}})[_0xc93d('0x1f')](function(_0x9f6bfc){if(_[_0xc93d('0x5b')](_0x9f6bfc)){throw new ReferenceError('Entity\x20not\x20found');}return _0x9f6bfc;})[_0xc93d('0x1f')](function(_0x488ff5){var _0x29613c=path[_0xc93d('0x4c')](config[_0xc93d('0x4d')],_0xc93d('0x53'),_0x488ff5[_0xc93d('0x46')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x29613c);if(!_[_0xc93d('0x5b')](_0x488ff5[_0xc93d('0x46')])&&fs[_0xc93d('0x4f')](_0x29613c)){logger[_0xc93d('0x5c')]('File:\x20\x22'+_0x29613c+_0xc93d('0x5d'));fs[_0xc93d('0x5e')](_0x29613c);}_0x29613c=_0x29613c+'.cypher';if(!_['isNil'](_0x488ff5['value'])&&fs[_0xc93d('0x4f')](_0x29613c)){logger[_0xc93d('0x5c')](_0xc93d('0x5f')+_0x29613c+_0xc93d('0x5d'));fs[_0xc93d('0x5e')](_0x29613c);}return _0x488ff5;})[_0xc93d('0x1f')](function(_0x403bb3){if(!_0x403bb3)throw new InternalError();return _0x403bb3['destroy']();})[_0xc93d('0x1f')](function(){_0x1133e6[_0xc93d('0x17')](0xcc)[_0xc93d('0x18')]();})[_0xc93d('0x49')](handleError(_0x1133e6,null));}; \ No newline at end of file +var _0x8306=['describe','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','update','body','duration','createdAt','closedAt'];(function(_0x54e333,_0x4ba478){var _0x47279e=function(_0x8e4f0b){while(--_0x8e4f0b){_0x54e333['push'](_0x54e333['shift']());}};_0x47279e(++_0x4ba478);}(_0x8306,0x1bb));var _0x6830=function(_0x5a9990,_0x31aad7){_0x5a9990=_0x5a9990-0x0;var _0x2de2f7=_0x8306[_0x5a9990];return _0x2de2f7;};'use strict';var emlformat=require(_0x6830('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6830('0x1'));var jsonpatch=require(_0x6830('0x2'));var rp=require(_0x6830('0x3'));var moment=require(_0x6830('0x4'));var BPromise=require(_0x6830('0x5'));var Mustache=require(_0x6830('0x6'));var util=require(_0x6830('0x7'));var path=require(_0x6830('0x8'));var sox=require(_0x6830('0x9'));var csv=require(_0x6830('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6830('0xb'));var _=require(_0x6830('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6830('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6830('0xa'));var querystring=require(_0x6830('0xe'));var Papa=require(_0x6830('0xf'));var Redis=require(_0x6830('0x10'));var authService=require(_0x6830('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6830('0x12'));var hardwareService=require(_0x6830('0x13'));var logger=require(_0x6830('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6830('0x15'));var licenseUtil=require(_0x6830('0x16'));var db=require(_0x6830('0x17'))['db'];function respondWithStatusCode(_0x3823ee,_0xe368ce){_0xe368ce=_0xe368ce||0xcc;return function(_0x17718c){if(_0x17718c){return _0x3823ee[_0x6830('0x18')](_0xe368ce);}return _0x3823ee[_0x6830('0x19')](_0xe368ce)[_0x6830('0x1a')]();};}function respondWithResult(_0x5099ba,_0x2a6254){_0x2a6254=_0x2a6254||0xc8;return function(_0x5f467b){if(_0x5f467b){return _0x5099ba[_0x6830('0x19')](_0x2a6254)['json'](_0x5f467b);}};}function respondWithFilteredResult(_0x513e25,_0xdd1f3f){return function(_0x10fbcd){if(_0x10fbcd){var _0x1031a0=typeof _0xdd1f3f[_0x6830('0x1b')]==='undefined'&&typeof _0xdd1f3f['limit']===_0x6830('0x1c');var _0x3525ed=_0x10fbcd[_0x6830('0x1d')];var _0x57b0f5=_0x1031a0?0x0:_0xdd1f3f[_0x6830('0x1b')];var _0x5c2214=_0x1031a0?_0x10fbcd[_0x6830('0x1d')]:_0xdd1f3f['offset']+_0xdd1f3f[_0x6830('0x1e')];var _0x4d59bb;if(_0x5c2214>=_0x3525ed){_0x5c2214=_0x3525ed;_0x4d59bb=0xc8;}else{_0x4d59bb=0xce;}_0x513e25[_0x6830('0x19')](_0x4d59bb);return _0x513e25[_0x6830('0x1f')](_0x6830('0x20'),_0x57b0f5+'-'+_0x5c2214+'/'+_0x3525ed)[_0x6830('0x21')](_0x10fbcd);}return null;};}function patchUpdates(_0x3534ad){return function(_0x1c75b9){try{jsonpatch[_0x6830('0x22')](_0x1c75b9,_0x3534ad,!![]);}catch(_0x185941){return BPromise[_0x6830('0x23')](_0x185941);}return _0x1c75b9[_0x6830('0x24')]();};}function saveUpdates(_0x30a411,_0x27dd76){return function(_0x488cd7){if(_0x488cd7){return _0x488cd7['update'](_0x30a411)[_0x6830('0x25')](function(_0x1c4fb3){return _0x1c4fb3;});}return null;};}function removeEntity(_0x1ef6e6,_0x437e99){return function(_0x5f3d2e){if(_0x5f3d2e){return _0x5f3d2e['destroy']()[_0x6830('0x25')](function(){_0x1ef6e6['status'](0xcc)[_0x6830('0x1a')]();});}};}function handleEntityNotFound(_0x6844f8,_0x241898){return function(_0x31327e){if(!_0x31327e){_0x6844f8[_0x6830('0x18')](0x194);}return _0x31327e;};}function handleError(_0x36d384,_0xb3fc55){_0xb3fc55=_0xb3fc55||0x1f4;return function(_0x1fd1da){logger['error'](_0x1fd1da['stack']);if(_0x1fd1da[_0x6830('0x26')]){delete _0x1fd1da[_0x6830('0x26')];}_0x36d384[_0x6830('0x19')](_0xb3fc55)[_0x6830('0x27')](_0x1fd1da);};}exports['index']=function(_0x3fd365,_0x3ed813){var _0x44cb69={},_0x293852={},_0x507daa={'count':0x0,'rows':[]};var _0x1126ab=_[_0x6830('0x28')](db[_0x6830('0x29')][_0x6830('0x2a')],function(_0x5e5e5a){return{'name':_0x5e5e5a[_0x6830('0x2b')],'type':_0x5e5e5a[_0x6830('0x2c')][_0x6830('0x2d')]};});_0x293852[_0x6830('0x2e')]=_['differenceBy'](_['map'](_0x1126ab,'name'),['format']);_0x293852[_0x6830('0x2f')]=_[_0x6830('0x30')](_0x3fd365[_0x6830('0x2f')]);_0x293852['filters']=_[_0x6830('0x31')](_0x293852[_0x6830('0x2e')],_0x293852[_0x6830('0x2f')]);_0x44cb69['attributes']=_['intersection'](_0x293852[_0x6830('0x2e')],qs[_0x6830('0x32')](_0x3fd365[_0x6830('0x2f')][_0x6830('0x32')]));_0x44cb69[_0x6830('0x33')]=_0x44cb69['attributes'][_0x6830('0x34')]?_0x44cb69[_0x6830('0x33')]:_0x293852[_0x6830('0x2e')];if(!_0x3fd365[_0x6830('0x2f')]['hasOwnProperty'](_0x6830('0x35'))){_0x44cb69[_0x6830('0x1e')]=qs[_0x6830('0x1e')](_0x3fd365['query'][_0x6830('0x1e')]);_0x44cb69['offset']=qs[_0x6830('0x1b')](_0x3fd365[_0x6830('0x2f')][_0x6830('0x1b')]);}_0x44cb69[_0x6830('0x36')]=qs[_0x6830('0x37')](_0x3fd365[_0x6830('0x2f')][_0x6830('0x37')]);_0x44cb69[_0x6830('0x38')]=qs[_0x6830('0x39')](_[_0x6830('0x3a')](_0x3fd365[_0x6830('0x2f')],_0x293852[_0x6830('0x39')]),_0x1126ab);if(_0x3fd365[_0x6830('0x2f')][_0x6830('0x3b')]){_0x44cb69['where']=_[_0x6830('0x3c')](_0x44cb69[_0x6830('0x38')],{'$or':_[_0x6830('0x28')](_0x1126ab,function(_0x37f0cb){if(_0x37f0cb[_0x6830('0x2c')]!==_0x6830('0x3d')){var _0xfcd8b7={};_0xfcd8b7[_0x37f0cb[_0x6830('0x26')]]={'$like':'%'+_0x3fd365[_0x6830('0x2f')][_0x6830('0x3b')]+'%'};return _0xfcd8b7;}})});}_0x44cb69=_[_0x6830('0x3c')]({},_0x44cb69,_0x3fd365[_0x6830('0x3e')]);var _0x3e16be={'where':_0x44cb69[_0x6830('0x38')]};return db[_0x6830('0x29')]['count'](_0x3e16be)[_0x6830('0x25')](function(_0x2668ac){_0x507daa[_0x6830('0x1d')]=_0x2668ac;if(_0x3fd365[_0x6830('0x2f')][_0x6830('0x3f')]){_0x44cb69[_0x6830('0x40')]=[{'all':!![]}];}return db[_0x6830('0x29')][_0x6830('0x41')](_0x44cb69);})[_0x6830('0x25')](function(_0x5f504d){_0x507daa[_0x6830('0x42')]=_0x5f504d;return _0x507daa;})[_0x6830('0x25')](respondWithFilteredResult(_0x3ed813,_0x44cb69))['catch'](handleError(_0x3ed813,null));};exports[_0x6830('0x43')]=function(_0x419d8a,_0x5ec7f4){var _0x27f02d={'raw':![],'where':{'id':_0x419d8a[_0x6830('0x44')]['id']}},_0x2be699={};_0x2be699[_0x6830('0x2e')]=_[_0x6830('0x30')](db[_0x6830('0x29')][_0x6830('0x2a')]);_0x2be699['query']=_[_0x6830('0x30')](_0x419d8a[_0x6830('0x2f')]);_0x2be699[_0x6830('0x39')]=_[_0x6830('0x31')](_0x2be699['model'],_0x2be699[_0x6830('0x2f')]);_0x27f02d['attributes']=_['intersection'](_0x2be699['model'],qs[_0x6830('0x32')](_0x419d8a['query'][_0x6830('0x32')]));_0x27f02d[_0x6830('0x33')]=_0x27f02d[_0x6830('0x33')]['length']?_0x27f02d['attributes']:_0x2be699[_0x6830('0x2e')];if(_0x419d8a[_0x6830('0x2f')]['includeAll']){_0x27f02d['include']=[{'all':!![]}];}_0x27f02d=_[_0x6830('0x3c')]({},_0x27f02d,_0x419d8a[_0x6830('0x3e')]);return db[_0x6830('0x29')][_0x6830('0x45')](_0x27f02d)['then'](handleEntityNotFound(_0x5ec7f4,null))[_0x6830('0x25')](respondWithResult(_0x5ec7f4,null))[_0x6830('0x46')](handleError(_0x5ec7f4,null));};exports['create']=function(_0x2bb388,_0x3cba5a){return db['ScreenRecording'][_0x6830('0x47')](_0x2bb388['body'],{})[_0x6830('0x25')](respondWithResult(_0x3cba5a,0xc9))[_0x6830('0x46')](handleError(_0x3cba5a,null));};exports[_0x6830('0x48')]=function(_0x1976e4,_0x1a3f8f){if(_0x1976e4[_0x6830('0x49')]['id']){delete _0x1976e4['body']['id'];}delete _0x1976e4[_0x6830('0x49')][_0x6830('0x4a')];delete _0x1976e4['body'][_0x6830('0x4b')];delete _0x1976e4[_0x6830('0x49')][_0x6830('0x4c')];delete _0x1976e4[_0x6830('0x49')]['value'];return db[_0x6830('0x29')][_0x6830('0x45')]({'where':{'id':_0x1976e4[_0x6830('0x44')]['id']}})[_0x6830('0x25')](handleEntityNotFound(_0x1a3f8f,null))['then'](saveUpdates(_0x1976e4['body'],null))[_0x6830('0x25')](respondWithResult(_0x1a3f8f,null))[_0x6830('0x46')](handleError(_0x1a3f8f,null));};exports[_0x6830('0x4d')]=function(_0x3f6293,_0x575d52){return db[_0x6830('0x29')]['describe']()[_0x6830('0x25')](respondWithResult(_0x575d52,null))['catch'](handleError(_0x575d52,null));};exports['download']=function(_0x188428,_0x53d695,_0x47d0e2){var _0x224e15=require(_0x6830('0x4e'));var _0x54b73d=![];var _0x5c1f98={};if(_0x188428[_0x6830('0x2f')][_0x6830('0x2c')]&&_0x188428[_0x6830('0x2f')][_0x6830('0x2c')]===_0x6830('0x4f')){_0x5c1f98[_0x6830('0x4f')]=_0x188428[_0x6830('0x44')]['id'];}else{_0x5c1f98['id']=_0x188428['params']['id'];}return db[_0x6830('0x29')][_0x6830('0x45')]({'where':_0x5c1f98,'attributes':['id',_0x6830('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x53d695,null))[_0x6830('0x25')](function(_0x401ad5){if(_0x401ad5){var _0x46629b=path[_0x6830('0x51')](config['root'],_0x6830('0x52'),_0x401ad5[_0x6830('0x50')]);var _0x3b8173=util[_0x6830('0x53')](_0x6830('0x54'),_0x46629b);if(fs[_0x6830('0x55')](_0x3b8173)){_0x54b73d=!![];return _0x224e15[_0x6830('0x56')](_0x3b8173,_0x46629b,config[_0x6830('0x57')]['recording'])[_0x6830('0x25')](function(){return _0x401ad5;});}return _0x401ad5;}})[_0x6830('0x25')](function(_0x3c02fb){if(_0x3c02fb){var _0x5359cf=path[_0x6830('0x51')](config[_0x6830('0x58')],'server/files/screen_recordings',_0x3c02fb[_0x6830('0x50')]);if(!fs[_0x6830('0x55')](_0x5359cf)){throw new db[(_0x6830('0x59'))][(_0x6830('0x5a'))](_0x6830('0x5b'));}if(_0x3c02fb['filename']){return _0x53d695[_0x6830('0x5c')](_0x5359cf,_0x3c02fb['filename']+path['extname'](_0x5359cf),function(){if(_0x54b73d){fs['unlink'](_0x5359cf);}});}else{return _0x53d695['download'](_0x5359cf,function(_0x26cc91){if(_0x54b73d){fs[_0x6830('0x5d')](_0x5359cf);}});}}})[_0x6830('0x46')](function(_0x39763c){if(_0x39763c[_0x6830('0x5e')]===_0x6830('0x5b')){_0x53d695[_0x6830('0x19')](0x194)[_0x6830('0x27')](_0x6830('0x5f'));}else{return handleError(_0x53d695,null);}});};exports[_0x6830('0x60')]=function(_0x54e8d5,_0x1ac0f0){return db['ScreenRecording'][_0x6830('0x45')]({'where':{'id':_0x54e8d5[_0x6830('0x44')]['id']}})['then'](function(_0x151a6c){if(_[_0x6830('0x61')](_0x151a6c)){throw new ReferenceError(_0x6830('0x62'));}return _0x151a6c;})[_0x6830('0x25')](function(_0x28be3e){var _0x1e13af=path[_0x6830('0x51')](config[_0x6830('0x58')],_0x6830('0x52'),_0x28be3e[_0x6830('0x50')]);logger[_0x6830('0x63')](_0x6830('0x64'),_0x1e13af);if(!_[_0x6830('0x61')](_0x28be3e[_0x6830('0x50')])&&fs[_0x6830('0x55')](_0x1e13af)){logger['info'](_0x6830('0x65')+_0x1e13af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1e13af);}_0x1e13af=_0x1e13af+_0x6830('0x66');if(!_[_0x6830('0x61')](_0x28be3e[_0x6830('0x50')])&&fs[_0x6830('0x55')](_0x1e13af)){logger['info'](_0x6830('0x65')+_0x1e13af+_0x6830('0x67'));fs['unlinkSync'](_0x1e13af);}return _0x28be3e;})[_0x6830('0x25')](function(_0x11482){if(!_0x11482)throw new InternalError();return _0x11482['destroy']();})[_0x6830('0x25')](function(){_0x1ac0f0[_0x6830('0x19')](0xcc)['end']();})['catch'](handleError(_0x1ac0f0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2b13d3b..46d3cdd 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 _0x8ffe=['./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x418c91,_0x4fcfbc){var _0x1bbf20=function(_0x91aeab){while(--_0x91aeab){_0x418c91['push'](_0x418c91['shift']());}};_0x1bbf20(++_0x4fcfbc);}(_0x8ffe,0x1cc));var _0xe8ff=function(_0x23444a,_0x58d93e){_0x23444a=_0x23444a-0x0;var _0x5185bf=_0x8ffe[_0x23444a];return _0x5185bf;};'use strict';var _=require('lodash');var util=require(_0xe8ff('0x0'));var logger=require('../../config/logger')(_0xe8ff('0x1'));var moment=require(_0xe8ff('0x2'));var BPromise=require(_0xe8ff('0x3'));var rp=require(_0xe8ff('0x4'));var fs=require('fs');var path=require(_0xe8ff('0x5'));var rimraf=require(_0xe8ff('0x6'));var config=require(_0xe8ff('0x7'));var attributes=require(_0xe8ff('0x8'));module[_0xe8ff('0x9')]=function(_0x15b7a9,_0x32c2a8){return _0x15b7a9[_0xe8ff('0xa')]('ScreenRecording',attributes,{'tableName':_0xe8ff('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xe8ff('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32ad=['ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','moment','path','../../config/environment','./screenRecording.attributes'];(function(_0x2427de,_0x321732){var _0x257fab=function(_0x2b72f7){while(--_0x2b72f7){_0x2427de['push'](_0x2427de['shift']());}};_0x257fab(++_0x321732);}(_0x32ad,0x1f2));var _0xd32a=function(_0x28e52f,_0x2c4c92){_0x28e52f=_0x28e52f-0x0;var _0x3ee591=_0x32ad[_0x28e52f];return _0x3ee591;};'use strict';var _=require(_0xd32a('0x0'));var util=require('util');var logger=require(_0xd32a('0x1'))('api');var moment=require(_0xd32a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd32a('0x3'));var rimraf=require('rimraf');var config=require(_0xd32a('0x4'));var attributes=require(_0xd32a('0x5'));module['exports']=function(_0x1a1e63,_0x2c80e0){return _0x1a1e63['define'](_0xd32a('0x6'),attributes,{'tableName':_0xd32a('0x7'),'paranoid':![],'indexes':[{'name':_0xd32a('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9e72cbc..23dba2d 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(_0x13b0cc,_0x118ff2){var _0x2c9dee=function(_0x4beaa4){while(--_0x4beaa4){_0x13b0cc['push'](_0x13b0cc['shift']());}};_0x2c9dee(++_0x118ff2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x2b8484,_0x2a2380){var _0x357985=function(_0x50c41f){while(--_0x50c41f){_0x2b8484['push'](_0x2b8484['shift']());}};_0x357985(++_0x2a2380);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 49a390b..2d4af35 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 _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x3dc274,_0x46be09){var _0x1672f4=function(_0x4da3b5){while(--_0x4da3b5){_0x3dc274['push'](_0x3dc274['shift']());}};_0x1672f4(++_0x46be09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x9635be,_0xddfa8e){var _0x905258=function(_0x353fa4){while(--_0x353fa4){_0x9635be['push'](_0x9635be['shift']());}};_0x905258(++_0xddfa8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a114ae9..73c3ef4 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 _0x0438=['alternate','UNSIGNED','sequelize','exports','min_internal','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN'];(function(_0x4ca536,_0x57c8de){var _0x3bd35f=function(_0x26d91d){while(--_0x26d91d){_0x4ca536['push'](_0x4ca536['shift']());}};_0x3bd35f(++_0x57c8de);}(_0x0438,0xb6));var _0x8043=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x0438[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x8043('0x0'));module[_0x8043('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x8043('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x8043('0x3')](0xb),'unique':_0x8043('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8043('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x8043('0x5')},'logo':{'type':Sequelize[_0x8043('0x6')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8043('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x8043('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8043('0x6')]},'turnaddr':{'type':Sequelize[_0x8043('0x6')]},'turnusername':{'type':Sequelize[_0x8043('0x6')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8043('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x8043('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x8043('0x6')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x8043('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8043('0x6')],'defaultValue':_0x8043('0x8')},'chatTimeout':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8043('0x6')]},'defaultPreferred':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8043('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x8043('0x6')]},'defaultFavicon':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8043('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x8043('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8043('0x3')]},'transcribeRegion':{'type':Sequelize[_0x8043('0x6')]},'sentiment':{'type':Sequelize[_0x8043('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x8043('0x6')]},'language':{'type':Sequelize[_0x8043('0x6')]},'bucket':{'type':Sequelize[_0x8043('0x6')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x8043('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x8043('0x3')](0x2)[_0x8043('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x8043('0x3')](0x2)[_0x8043('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x8043('0x3')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x8043('0x3')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x8043('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x8043('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x390b=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED'];(function(_0x5d142b,_0x3348e3){var _0x4dd402=function(_0x8d7f88){while(--_0x8d7f88){_0x5d142b['push'](_0x5d142b['shift']());}};_0x4dd402(++_0x3348e3);}(_0x390b,0x144));var _0xb390=function(_0x11dc31,_0x37e0ae){_0x11dc31=_0x11dc31-0x0;var _0x40f116=_0x390b[_0x11dc31];return _0x40f116;};'use strict';var Sequelize=require(_0xb390('0x0'));module[_0xb390('0x1')]={'min_internal':{'type':Sequelize[_0xb390('0x2')](0xb),'unique':_0xb390('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xb390('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb390('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xb390('0x5')]},'defaultLogo':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xb390('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb390('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb390('0x5')]},'turnaddr':{'type':Sequelize[_0xb390('0x5')]},'turnusername':{'type':Sequelize[_0xb390('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb390('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb390('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb390('0x5')],'defaultValue':_0xb390('0x7')},'chatTimeout':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb390('0x5')]},'defaultPreferred':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb390('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb390('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb390('0x5')]},'defaultFavicon':{'type':Sequelize[_0xb390('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb390('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb390('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xb390('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb390('0x2')]},'sentimentRegion':{'type':Sequelize[_0xb390('0x5')]},'language':{'type':Sequelize[_0xb390('0x5')]},'bucket':{'type':Sequelize[_0xb390('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xb390('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb390('0x2')](0x2)[_0xb390('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xb390('0x2')](0x2)[_0xb390('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xb390('0x2')](0x2)[_0xb390('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb390('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xb390('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 54c50e9..8b3fde0 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 _0xd6c1=['download','getLogoLogin','defaultLoginLogo','defaultPreferred','existsSync','default_loginLogo.svg','gdpr','securePassword','addPreferred','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','merge','find','body','params','file','logo','filename','../../config/license/util','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd6c1,0x178));var _0x1d6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6c1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1d6c('0x0'));var jsonpatch=require(_0x1d6c('0x1'));var rp=require(_0x1d6c('0x2'));var moment=require('moment');var BPromise=require(_0x1d6c('0x3'));var Mustache=require(_0x1d6c('0x4'));var util=require('util');var path=require(_0x1d6c('0x5'));var sox=require(_0x1d6c('0x6'));var csv=require(_0x1d6c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d6c('0x8'));var _=require(_0x1d6c('0x9'));var squel=require('squel');var crypto=require(_0x1d6c('0xa'));var jsforce=require(_0x1d6c('0xb'));var deskjs=require(_0x1d6c('0xc'));var toCsv=require(_0x1d6c('0x7'));var querystring=require('querystring');var Papa=require(_0x1d6c('0xd'));var Redis=require(_0x1d6c('0xe'));var authService=require(_0x1d6c('0xf'));var qs=require(_0x1d6c('0x10'));var as=require(_0x1d6c('0x11'));var hardwareService=require(_0x1d6c('0x12'));var logger=require(_0x1d6c('0x13'))(_0x1d6c('0x14'));var utils=require(_0x1d6c('0x15'));var config=require(_0x1d6c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x1d6c('0x17'));var client=jayson[_0x1d6c('0x18')][_0x1d6c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4de9eb,_0x3f74bf,_0x55e416,_0xe0f699){return new BPromise(function(_0x4cd6dd,_0x5124af){var _0x36e914=_0xe0f699||client;return _0x36e914[_0x1d6c('0x1a')](_0x4de9eb,_0x55e416)[_0x1d6c('0x1b')](function(_0x173108){logger['info']('Setting,\x20%s,\x20%s',_0x3f74bf,'request\x20sent');logger[_0x1d6c('0x1c')](_0x1d6c('0x1d'),_0x3f74bf,_0x1d6c('0x1e'),JSON[_0x1d6c('0x1f')](_0x173108));if(_0x173108[_0x1d6c('0x20')]){if(_0x173108['error'][_0x1d6c('0x21')]===0x1f4){logger['error'](_0x1d6c('0x22'),_0x3f74bf,_0x173108[_0x1d6c('0x20')]['message']);return _0x5124af(_0x173108[_0x1d6c('0x20')][_0x1d6c('0x23')]);}logger[_0x1d6c('0x20')](_0x1d6c('0x22'),_0x3f74bf,_0x173108[_0x1d6c('0x20')][_0x1d6c('0x23')]);return _0x4cd6dd(_0x173108[_0x1d6c('0x20')][_0x1d6c('0x23')]);}else{logger['info'](_0x1d6c('0x22'),_0x3f74bf,_0x1d6c('0x1e'));_0x4cd6dd(_0x173108[_0x1d6c('0x24')][_0x1d6c('0x23')]);}})['catch'](function(_0xf0e48d){logger[_0x1d6c('0x20')](_0x1d6c('0x22'),_0x3f74bf,_0xf0e48d);_0x5124af(_0xf0e48d);});});}function respondWithStatusCode(_0x5348b,_0x1c8565){_0x1c8565=_0x1c8565||0xcc;return function(_0x1873bc){if(_0x1873bc){return _0x5348b[_0x1d6c('0x25')](_0x1c8565);}return _0x5348b[_0x1d6c('0x26')](_0x1c8565)['end']();};}function respondWithResult(_0x37d976,_0x41dfde){_0x41dfde=_0x41dfde||0xc8;return function(_0x312543){if(_0x312543){return _0x37d976[_0x1d6c('0x26')](_0x41dfde)['json'](_0x312543);}};}function respondWithFilteredResult(_0x5185d2,_0x368c7c){return function(_0x5ef533){if(_0x5ef533){var _0x1b7915=typeof _0x368c7c['offset']===_0x1d6c('0x27')&&typeof _0x368c7c[_0x1d6c('0x28')]===_0x1d6c('0x27');var _0x27cbe7=_0x5ef533[_0x1d6c('0x29')];var _0xc41048=_0x1b7915?0x0:_0x368c7c[_0x1d6c('0x2a')];var _0x542ff0=_0x1b7915?_0x5ef533[_0x1d6c('0x29')]:_0x368c7c['offset']+_0x368c7c['limit'];var _0x1c24f4;if(_0x542ff0>=_0x27cbe7){_0x542ff0=_0x27cbe7;_0x1c24f4=0xc8;}else{_0x1c24f4=0xce;}_0x5185d2['status'](_0x1c24f4);return _0x5185d2[_0x1d6c('0x2b')](_0x1d6c('0x2c'),_0xc41048+'-'+_0x542ff0+'/'+_0x27cbe7)[_0x1d6c('0x2d')](_0x5ef533);}return null;};}function patchUpdates(_0x21e08b){return function(_0x40f4b0){try{jsonpatch['apply'](_0x40f4b0,_0x21e08b,!![]);}catch(_0x194726){return BPromise['reject'](_0x194726);}return _0x40f4b0[_0x1d6c('0x2e')]();};}function saveUpdates(_0x3dda64,_0x59f4df){return function(_0x37f006){if(_0x37f006){return _0x37f006[_0x1d6c('0x2f')](_0x3dda64)[_0x1d6c('0x1b')](function(_0x48802a){return _0x48802a;});}return null;};}function removeEntity(_0x1c411f,_0x3735c5){return function(_0x44c921){if(_0x44c921){return _0x44c921[_0x1d6c('0x30')]()[_0x1d6c('0x1b')](function(){_0x1c411f[_0x1d6c('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fa43,_0x4521e7){return function(_0x21f173){if(!_0x21f173){_0x36fa43['sendStatus'](0x194);}return _0x21f173;};}function handleError(_0x4c386a,_0x1b7816){_0x1b7816=_0x1b7816||0x1f4;return function(_0x24b7e5){logger['error'](_0x24b7e5[_0x1d6c('0x31')]);if(_0x24b7e5['name']){delete _0x24b7e5[_0x1d6c('0x32')];}_0x4c386a['status'](_0x1b7816)[_0x1d6c('0x33')](_0x24b7e5);};}exports['index']=function(_0x1e1039,_0x42254){var _0x35a42d={},_0x32c3d9={},_0x2535c3={'count':0x0,'rows':[]};var _0x4012fd=_[_0x1d6c('0x34')](db[_0x1d6c('0x35')][_0x1d6c('0x36')],function(_0x5d145f){return{'name':_0x5d145f[_0x1d6c('0x37')],'type':_0x5d145f['type'][_0x1d6c('0x38')]};});_0x32c3d9[_0x1d6c('0x39')]=_[_0x1d6c('0x34')](_0x4012fd,_0x1d6c('0x32'));_0x32c3d9[_0x1d6c('0x3a')]=_[_0x1d6c('0x3b')](_0x1e1039['query']);_0x32c3d9['filters']=_[_0x1d6c('0x3c')](_0x32c3d9[_0x1d6c('0x39')],_0x32c3d9[_0x1d6c('0x3a')]);_0x35a42d[_0x1d6c('0x3d')]=_[_0x1d6c('0x3c')](_0x32c3d9[_0x1d6c('0x39')],qs['fields'](_0x1e1039[_0x1d6c('0x3a')][_0x1d6c('0x3e')]));_0x35a42d[_0x1d6c('0x3d')]=_0x35a42d[_0x1d6c('0x3d')][_0x1d6c('0x3f')]?_0x35a42d[_0x1d6c('0x3d')]:_0x32c3d9[_0x1d6c('0x39')];if(!_0x1e1039[_0x1d6c('0x3a')][_0x1d6c('0x40')](_0x1d6c('0x41'))){_0x35a42d['limit']=qs[_0x1d6c('0x28')](_0x1e1039['query'][_0x1d6c('0x28')]);_0x35a42d['offset']=qs[_0x1d6c('0x2a')](_0x1e1039[_0x1d6c('0x3a')][_0x1d6c('0x2a')]);}_0x35a42d[_0x1d6c('0x42')]=qs['sort'](_0x1e1039[_0x1d6c('0x3a')]['sort']);_0x35a42d[_0x1d6c('0x43')]=qs[_0x1d6c('0x44')](_[_0x1d6c('0x45')](_0x1e1039[_0x1d6c('0x3a')],_0x32c3d9[_0x1d6c('0x44')]),_0x4012fd);if(_0x1e1039[_0x1d6c('0x3a')][_0x1d6c('0x46')]){_0x35a42d[_0x1d6c('0x43')]=_['merge'](_0x35a42d[_0x1d6c('0x43')],{'$or':_[_0x1d6c('0x34')](_0x4012fd,function(_0x470eac){if(_0x470eac['type']!==_0x1d6c('0x47')){var _0x3f6681={};_0x3f6681[_0x470eac[_0x1d6c('0x32')]]={'$like':'%'+_0x1e1039[_0x1d6c('0x3a')][_0x1d6c('0x46')]+'%'};return _0x3f6681;}})});}_0x35a42d=_['merge']({},_0x35a42d,_0x1e1039[_0x1d6c('0x48')]);var _0x564fc6={'where':_0x35a42d['where']};return db[_0x1d6c('0x35')]['count'](_0x564fc6)[_0x1d6c('0x1b')](function(_0x23d236){_0x2535c3['count']=_0x23d236;if(_0x1e1039['query']['includeAll']){_0x35a42d[_0x1d6c('0x49')]=[{'all':!![]}];}return db['Setting'][_0x1d6c('0x4a')](_0x35a42d);})[_0x1d6c('0x1b')](function(_0x190b1e){_0x2535c3[_0x1d6c('0x4b')]=_0x190b1e;return _0x2535c3;})['then'](respondWithFilteredResult(_0x42254,_0x35a42d))[_0x1d6c('0x4c')](handleError(_0x42254,null));};exports[_0x1d6c('0x4d')]=function(_0x198933,_0x2f0e5f){var _0x1adadd={'raw':![],'where':{'id':_0x198933['params']['id']}},_0x4f6116={};_0x4f6116['model']=_[_0x1d6c('0x3b')](db[_0x1d6c('0x35')][_0x1d6c('0x36')]);_0x4f6116['query']=_[_0x1d6c('0x3b')](_0x198933[_0x1d6c('0x3a')]);_0x4f6116['filters']=_['intersection'](_0x4f6116[_0x1d6c('0x39')],_0x4f6116[_0x1d6c('0x3a')]);_0x1adadd[_0x1d6c('0x3d')]=_['intersection'](_0x4f6116[_0x1d6c('0x39')],qs[_0x1d6c('0x3e')](_0x198933[_0x1d6c('0x3a')][_0x1d6c('0x3e')]));_0x1adadd[_0x1d6c('0x3d')]=_0x1adadd[_0x1d6c('0x3d')][_0x1d6c('0x3f')]?_0x1adadd['attributes']:_0x4f6116[_0x1d6c('0x39')];if(_0x198933[_0x1d6c('0x3a')][_0x1d6c('0x4e')]){_0x1adadd[_0x1d6c('0x49')]=[{'all':!![]}];}_0x1adadd=_[_0x1d6c('0x4f')]({},_0x1adadd,_0x198933[_0x1d6c('0x48')]);return db[_0x1d6c('0x35')][_0x1d6c('0x50')](_0x1adadd)[_0x1d6c('0x1b')](handleEntityNotFound(_0x2f0e5f,null))[_0x1d6c('0x1b')](respondWithResult(_0x2f0e5f,null))['catch'](handleError(_0x2f0e5f,null));};exports[_0x1d6c('0x2f')]=function(_0x1bb444,_0x188fc0){if(_0x1bb444[_0x1d6c('0x51')]['id']){delete _0x1bb444[_0x1d6c('0x51')]['id'];}return db[_0x1d6c('0x35')][_0x1d6c('0x50')]({'where':{'id':_0x1bb444[_0x1d6c('0x52')]['id']}})[_0x1d6c('0x1b')](handleEntityNotFound(_0x188fc0,null))[_0x1d6c('0x1b')](saveUpdates(_0x1bb444[_0x1d6c('0x51')],null))['then'](respondWithResult(_0x188fc0,null))[_0x1d6c('0x4c')](handleError(_0x188fc0,null));};exports['addLogo']=function(_0xe549ce,_0x1be057,_0x2b11f4){if(_0xe549ce[_0x1d6c('0x53')]&&_0xe549ce['file']['filename']){_0xe549ce['body'][_0x1d6c('0x54')]=_0xe549ce[_0x1d6c('0x53')]['filename'];}return db[_0x1d6c('0x35')][_0x1d6c('0x50')]({'where':{'id':_0xe549ce[_0x1d6c('0x52')]['id']}})['then'](handleEntityNotFound(_0x1be057,null))['then'](saveUpdates(_0xe549ce['body'],null))['then'](respondWithResult(_0x1be057,null))[_0x1d6c('0x4c')](handleError(_0x1be057,null));};exports['addLogoLogin']=function(_0x39b43c,_0x3a0e77,_0x791261){if(_0x39b43c['file']&&_0x39b43c['file'][_0x1d6c('0x55')]){_0x39b43c[_0x1d6c('0x51')]['loginLogo']=_0x39b43c[_0x1d6c('0x53')][_0x1d6c('0x55')];}return db[_0x1d6c('0x35')][_0x1d6c('0x50')]({'where':{'id':_0x39b43c[_0x1d6c('0x52')]['id']}})['then'](handleEntityNotFound(_0x3a0e77,null))['then'](saveUpdates(_0x39b43c[_0x1d6c('0x51')],null))['then'](respondWithResult(_0x3a0e77,null))[_0x1d6c('0x4c')](handleError(_0x3a0e77,null));};var utilLicense=require(_0x1d6c('0x56'));exports['getLogo']=function(_0x4821be,_0x8b9aa5,_0x4f909a){var _0x5af9cc=_0x1d6c('0x57');var _0x14a56b={'custom':![]};return utilLicense[_0x1d6c('0x58')]()['then'](function(_0x68035d){if(_0x68035d){_0x14a56b=_0x68035d;}return db[_0x1d6c('0x35')][_0x1d6c('0x50')]({'where':{'id':_0x4821be[_0x1d6c('0x52')]['id']},'attributes':['logo',_0x1d6c('0x59'),_0x1d6c('0x5a'),_0x1d6c('0x5b'),_0x1d6c('0x5c'),'defaultLoginLogo','defaultPreferred',_0x1d6c('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x8b9aa5,null))[_0x1d6c('0x1b')](function(_0x2b0a60){if(_0x2b0a60){var _0x46765c=_0x2b0a60[_0x1d6c('0x54')]&&fs['existsSync'](path[_0x1d6c('0x5e')](config[_0x1d6c('0x5f')],_0x5af9cc,_[_0x1d6c('0x60')](_0x2b0a60[_0x1d6c('0x54')])))?path['join'](config[_0x1d6c('0x5f')],_0x5af9cc,_[_0x1d6c('0x60')](_0x2b0a60[_0x1d6c('0x54')])):path[_0x1d6c('0x5e')](config['root'],_0x5af9cc,_[_0x1d6c('0x60')](_0x1d6c('0x61')));var _0x46bee5=_0x1d6c('0x62')+_[_0x1d6c('0x63')]('logo');if(_0x2b0a60[_0x46bee5]||!_0x14a56b[_0x1d6c('0x64')]){_0x46765c=path[_0x1d6c('0x5e')](config[_0x1d6c('0x5f')],_0x5af9cc,_[_0x1d6c('0x60')](_0x1d6c('0x61')));}if(!fs['existsSync'](_0x46765c)){throw new db[(_0x1d6c('0x65'))][(_0x1d6c('0x66'))](_[_0x1d6c('0x63')](_0x1d6c('0x54'))+_0x1d6c('0x67'));}return _0x8b9aa5[_0x1d6c('0x68')](_0x46765c);}})[_0x1d6c('0x4c')](handleError(_0x8b9aa5,null));};var utilLicense=require(_0x1d6c('0x56'));exports[_0x1d6c('0x69')]=function(_0x229fd5,_0x1c3ef2,_0x49856e){var _0x265415='server/files/images/logos';var _0x48eefc={'custom':![]};return utilLicense[_0x1d6c('0x58')]()[_0x1d6c('0x1b')](function(_0x15eb53){if(_0x15eb53){_0x48eefc=_0x15eb53;}return db[_0x1d6c('0x35')][_0x1d6c('0x50')]({'where':{'id':_0x229fd5[_0x1d6c('0x52')]['id']},'attributes':[_0x1d6c('0x54'),_0x1d6c('0x59'),'preferred',_0x1d6c('0x5b'),'defaultLogo',_0x1d6c('0x6a'),_0x1d6c('0x6b'),_0x1d6c('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x1c3ef2,null))[_0x1d6c('0x1b')](function(_0x44ecee){if(_0x44ecee){var _0x109bf3=_0x44ecee[_0x1d6c('0x59')]&&fs[_0x1d6c('0x6c')](path[_0x1d6c('0x5e')](config['root'],_0x265415,_[_0x1d6c('0x60')](_0x44ecee[_0x1d6c('0x59')])))?path[_0x1d6c('0x5e')](config[_0x1d6c('0x5f')],_0x265415,_[_0x1d6c('0x60')](_0x44ecee[_0x1d6c('0x59')])):path[_0x1d6c('0x5e')](config[_0x1d6c('0x5f')],_0x265415,_[_0x1d6c('0x60')](_0x1d6c('0x6d')));var _0x3ffab4=_0x1d6c('0x62')+_[_0x1d6c('0x63')](_0x1d6c('0x59'));if(_0x44ecee[_0x3ffab4]||!_0x48eefc['custom']){_0x109bf3=path[_0x1d6c('0x5e')](config['root'],_0x265415,_['toLower'](_0x1d6c('0x6d')));}if(!fs[_0x1d6c('0x6c')](_0x109bf3)){throw new db[(_0x1d6c('0x65'))]['ValidationError'](_[_0x1d6c('0x63')](_0x1d6c('0x59'))+'\x20not\x20found');}return _0x1c3ef2[_0x1d6c('0x68')](_0x109bf3);}})[_0x1d6c('0x4c')](handleError(_0x1c3ef2,null));};exports[_0x1d6c('0x6e')]=function(_0x178468,_0x4068b7){return db[_0x1d6c('0x35')]['find']({'where':{'id':_0x178468['params']['id']},'attributes':[_0x1d6c('0x6f')]})[_0x1d6c('0x1b')](respondWithResult(_0x4068b7,null))[_0x1d6c('0x4c')](handleError(_0x4068b7,null));};exports[_0x1d6c('0x70')]=function(_0xf56ac1,_0x390bd2,_0x49d75a){if(_0xf56ac1[_0x1d6c('0x53')]&&_0xf56ac1[_0x1d6c('0x53')][_0x1d6c('0x55')]){_0xf56ac1[_0x1d6c('0x51')][_0x1d6c('0x5a')]=_0xf56ac1['file'][_0x1d6c('0x55')];}return db[_0x1d6c('0x35')]['find']({'where':{'id':_0xf56ac1[_0x1d6c('0x52')]['id']}})[_0x1d6c('0x1b')](handleEntityNotFound(_0x390bd2,null))[_0x1d6c('0x1b')](saveUpdates(_0xf56ac1[_0x1d6c('0x51')],null))[_0x1d6c('0x1b')](respondWithResult(_0x390bd2,null))[_0x1d6c('0x4c')](handleError(_0x390bd2,null));};var utilLicense=require(_0x1d6c('0x56'));exports['getPreferred']=function(_0x238d9b,_0x24143c,_0xc639aa){var _0x6d2186=_0x1d6c('0x57');var _0x5ca8d0={'custom':![]};return utilLicense['getLicense']()[_0x1d6c('0x1b')](function(_0x42bf28){if(_0x42bf28){_0x5ca8d0=_0x42bf28;}return db[_0x1d6c('0x35')][_0x1d6c('0x50')]({'where':{'id':_0x238d9b['params']['id']},'attributes':[_0x1d6c('0x54'),_0x1d6c('0x59'),_0x1d6c('0x5a'),_0x1d6c('0x5b'),_0x1d6c('0x5c'),'defaultLoginLogo',_0x1d6c('0x6b'),_0x1d6c('0x5d')],'raw':!![]});})[_0x1d6c('0x1b')](handleEntityNotFound(_0x24143c,null))[_0x1d6c('0x1b')](function(_0x232807){if(_0x232807){var _0x4003bb=_0x232807[_0x1d6c('0x5a')]&&fs[_0x1d6c('0x6c')](path[_0x1d6c('0x5e')](config['root'],_0x6d2186,_[_0x1d6c('0x60')](_0x232807[_0x1d6c('0x5a')])))?path['join'](config[_0x1d6c('0x5f')],_0x6d2186,_[_0x1d6c('0x60')](_0x232807[_0x1d6c('0x5a')])):path[_0x1d6c('0x5e')](config[_0x1d6c('0x5f')],_0x6d2186,_[_0x1d6c('0x60')]('default_preferred.png'));var _0x3bcbdd='default'+_[_0x1d6c('0x63')](_0x1d6c('0x5a'));if(_0x232807[_0x3bcbdd]||!_0x5ca8d0[_0x1d6c('0x64')]||!_0x5ca8d0[_0x1d6c('0x5a')]){_0x4003bb=path['join'](config[_0x1d6c('0x5f')],_0x6d2186,_[_0x1d6c('0x60')]('default_preferred.png'));}if(!fs[_0x1d6c('0x6c')](_0x4003bb)){throw new db[(_0x1d6c('0x65'))]['ValidationError'](_[_0x1d6c('0x63')]('preferred')+_0x1d6c('0x67'));}return _0x24143c[_0x1d6c('0x68')](_0x4003bb);}})[_0x1d6c('0x4c')](handleError(_0x24143c,null));};exports['addFavicon']=function(_0x2e19ef,_0x56da3b,_0x491c06){if(_0x2e19ef[_0x1d6c('0x53')]&&_0x2e19ef[_0x1d6c('0x53')][_0x1d6c('0x55')]){_0x2e19ef['body']['favicon']=_0x2e19ef[_0x1d6c('0x53')][_0x1d6c('0x55')];}return db['Setting'][_0x1d6c('0x50')]({'where':{'id':_0x2e19ef['params']['id']}})[_0x1d6c('0x1b')](handleEntityNotFound(_0x56da3b,null))[_0x1d6c('0x1b')](saveUpdates(_0x2e19ef[_0x1d6c('0x51')],null))[_0x1d6c('0x1b')](respondWithResult(_0x56da3b,null))[_0x1d6c('0x4c')](handleError(_0x56da3b,null));};var utilLicense=require(_0x1d6c('0x56'));exports[_0x1d6c('0x71')]=function(_0x31479b,_0x2ed0c3,_0x4a5a5c){var _0x27bfa5=_0x1d6c('0x57');var _0x598b23={'custom':![]};return utilLicense[_0x1d6c('0x58')]()[_0x1d6c('0x1b')](function(_0x11e578){if(_0x11e578){_0x598b23=_0x11e578;}return db['Setting'][_0x1d6c('0x50')]({'where':{'id':_0x31479b[_0x1d6c('0x52')]['id']},'attributes':[_0x1d6c('0x54'),_0x1d6c('0x59'),_0x1d6c('0x5a'),'favicon',_0x1d6c('0x5c'),'defaultLoginLogo',_0x1d6c('0x6b'),_0x1d6c('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x2ed0c3,null))['then'](function(_0x488c0c){if(_0x488c0c){var _0x29367c=_0x488c0c[_0x1d6c('0x5b')]&&fs[_0x1d6c('0x6c')](path['join'](config[_0x1d6c('0x5f')],_0x27bfa5,_[_0x1d6c('0x60')](_0x488c0c[_0x1d6c('0x5b')])))?path[_0x1d6c('0x5e')](config[_0x1d6c('0x5f')],_0x27bfa5,_['toLower'](_0x488c0c[_0x1d6c('0x5b')])):path[_0x1d6c('0x5e')](config[_0x1d6c('0x5f')],_0x27bfa5,_[_0x1d6c('0x60')](_0x1d6c('0x72')));var _0xdcc2e7=_0x1d6c('0x62')+_[_0x1d6c('0x63')]('favicon');if(_0x488c0c[_0xdcc2e7]||!_0x598b23['custom']){_0x29367c=path['join'](config['root'],_0x27bfa5,_[_0x1d6c('0x60')](_0x1d6c('0x72')));}if(!fs['existsSync'](_0x29367c)){throw new db[(_0x1d6c('0x65'))][(_0x1d6c('0x66'))](_[_0x1d6c('0x63')]('favicon')+_0x1d6c('0x67'));}return _0x2ed0c3[_0x1d6c('0x68')](_0x29367c);}})['catch'](handleError(_0x2ed0c3,null));};exports[_0x1d6c('0x73')]=function(_0x6b420f,_0x23af1e){var _0x33524a={'offset':moment()[_0x1d6c('0x74')]()};_0x33524a[_0x1d6c('0x75')]=moment()['utcOffset'](_0x33524a[_0x1d6c('0x2a')])[_0x1d6c('0x76')](_0x1d6c('0x77'));return _0x23af1e[_0x1d6c('0x26')](0xc8)[_0x1d6c('0x33')](_0x33524a);}; \ No newline at end of file +var _0x6cfe=['getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Setting','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','join','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','getLogoLogin','defaultLogo','default_loginLogo.svg','Sequelize','download','gdpr','addPreferred'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0x6cfe,0x87));var _0xe6cf=function(_0x1b78ec,_0x592b5f){_0x1b78ec=_0x1b78ec-0x0;var _0x1358df=_0x6cfe[_0x1b78ec];return _0x1358df;};'use strict';var emlformat=require(_0xe6cf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6cf('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe6cf('0x2'));var Mustache=require(_0xe6cf('0x3'));var util=require(_0xe6cf('0x4'));var path=require(_0xe6cf('0x5'));var sox=require(_0xe6cf('0x6'));var csv=require(_0xe6cf('0x7'));var ejs=require(_0xe6cf('0x8'));var fs=require('fs');var fs_extra=require(_0xe6cf('0x9'));var _=require(_0xe6cf('0xa'));var squel=require(_0xe6cf('0xb'));var crypto=require(_0xe6cf('0xc'));var jsforce=require(_0xe6cf('0xd'));var deskjs=require(_0xe6cf('0xe'));var toCsv=require(_0xe6cf('0x7'));var querystring=require(_0xe6cf('0xf'));var Papa=require('papaparse');var Redis=require(_0xe6cf('0x10'));var authService=require(_0xe6cf('0x11'));var qs=require(_0xe6cf('0x12'));var as=require(_0xe6cf('0x13'));var hardwareService=require(_0xe6cf('0x14'));var logger=require(_0xe6cf('0x15'))(_0xe6cf('0x16'));var utils=require(_0xe6cf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe6cf('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe6cf('0x19'));var client=jayson[_0xe6cf('0x1a')][_0xe6cf('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4727df,_0x54be77,_0x169ab1,_0x217428){return new BPromise(function(_0x2e4f3c,_0x4d6c3d){var _0x287a7c=_0x217428||client;return _0x287a7c[_0xe6cf('0x1c')](_0x4727df,_0x169ab1)['then'](function(_0x432385){logger[_0xe6cf('0x1d')](_0xe6cf('0x1e'),_0x54be77,_0xe6cf('0x1f'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x54be77,'request\x20sent',JSON[_0xe6cf('0x20')](_0x432385));if(_0x432385[_0xe6cf('0x21')]){if(_0x432385[_0xe6cf('0x21')][_0xe6cf('0x22')]===0x1f4){logger[_0xe6cf('0x21')](_0xe6cf('0x1e'),_0x54be77,_0x432385[_0xe6cf('0x21')]['message']);return _0x4d6c3d(_0x432385[_0xe6cf('0x21')][_0xe6cf('0x23')]);}logger['error'](_0xe6cf('0x1e'),_0x54be77,_0x432385[_0xe6cf('0x21')][_0xe6cf('0x23')]);return _0x2e4f3c(_0x432385[_0xe6cf('0x21')]['message']);}else{logger['info'](_0xe6cf('0x1e'),_0x54be77,_0xe6cf('0x1f'));_0x2e4f3c(_0x432385[_0xe6cf('0x24')][_0xe6cf('0x23')]);}})['catch'](function(_0x5517b2){logger[_0xe6cf('0x21')](_0xe6cf('0x1e'),_0x54be77,_0x5517b2);_0x4d6c3d(_0x5517b2);});});}function respondWithStatusCode(_0x54d2cb,_0x36ce5e){_0x36ce5e=_0x36ce5e||0xcc;return function(_0x1d4617){if(_0x1d4617){return _0x54d2cb['sendStatus'](_0x36ce5e);}return _0x54d2cb[_0xe6cf('0x25')](_0x36ce5e)[_0xe6cf('0x26')]();};}function respondWithResult(_0x3dbc1d,_0x5ec92e){_0x5ec92e=_0x5ec92e||0xc8;return function(_0x27cba5){if(_0x27cba5){return _0x3dbc1d[_0xe6cf('0x25')](_0x5ec92e)[_0xe6cf('0x27')](_0x27cba5);}};}function respondWithFilteredResult(_0xe3d31,_0x5e96a7){return function(_0x453843){if(_0x453843){var _0x512bfa=typeof _0x5e96a7[_0xe6cf('0x28')]===_0xe6cf('0x29')&&typeof _0x5e96a7[_0xe6cf('0x2a')]===_0xe6cf('0x29');var _0x103de2=_0x453843['count'];var _0x5305b2=_0x512bfa?0x0:_0x5e96a7[_0xe6cf('0x28')];var _0x17df0c=_0x512bfa?_0x453843[_0xe6cf('0x2b')]:_0x5e96a7[_0xe6cf('0x28')]+_0x5e96a7[_0xe6cf('0x2a')];var _0x414a1a;if(_0x17df0c>=_0x103de2){_0x17df0c=_0x103de2;_0x414a1a=0xc8;}else{_0x414a1a=0xce;}_0xe3d31['status'](_0x414a1a);return _0xe3d31[_0xe6cf('0x2c')](_0xe6cf('0x2d'),_0x5305b2+'-'+_0x17df0c+'/'+_0x103de2)[_0xe6cf('0x27')](_0x453843);}return null;};}function patchUpdates(_0x31c36d){return function(_0x3dcb78){try{jsonpatch[_0xe6cf('0x2e')](_0x3dcb78,_0x31c36d,!![]);}catch(_0x5cd07f){return BPromise[_0xe6cf('0x2f')](_0x5cd07f);}return _0x3dcb78[_0xe6cf('0x30')]();};}function saveUpdates(_0x5e46c6,_0x56878d){return function(_0xa65946){if(_0xa65946){return _0xa65946[_0xe6cf('0x31')](_0x5e46c6)[_0xe6cf('0x32')](function(_0x540454){return _0x540454;});}return null;};}function removeEntity(_0x134563,_0x208c22){return function(_0xfb4d76){if(_0xfb4d76){return _0xfb4d76[_0xe6cf('0x33')]()[_0xe6cf('0x32')](function(){_0x134563[_0xe6cf('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b467e,_0x533d87){return function(_0x260201){if(!_0x260201){_0x4b467e[_0xe6cf('0x34')](0x194);}return _0x260201;};}function handleError(_0x3f425c,_0x51bc63){_0x51bc63=_0x51bc63||0x1f4;return function(_0x550754){logger[_0xe6cf('0x21')](_0x550754[_0xe6cf('0x35')]);if(_0x550754[_0xe6cf('0x36')]){delete _0x550754['name'];}_0x3f425c[_0xe6cf('0x25')](_0x51bc63)[_0xe6cf('0x37')](_0x550754);};}exports[_0xe6cf('0x38')]=function(_0x3e9665,_0x2e829d){var _0x3e8ce1={},_0x3350df={},_0x29629e={'count':0x0,'rows':[]};var _0x304366=_[_0xe6cf('0x39')](db[_0xe6cf('0x3a')]['rawAttributes'],function(_0x3028e1){return{'name':_0x3028e1[_0xe6cf('0x3b')],'type':_0x3028e1[_0xe6cf('0x3c')][_0xe6cf('0x3d')]};});_0x3350df[_0xe6cf('0x3e')]=_[_0xe6cf('0x39')](_0x304366,'name');_0x3350df[_0xe6cf('0x3f')]=_['keys'](_0x3e9665[_0xe6cf('0x3f')]);_0x3350df['filters']=_[_0xe6cf('0x40')](_0x3350df[_0xe6cf('0x3e')],_0x3350df[_0xe6cf('0x3f')]);_0x3e8ce1[_0xe6cf('0x41')]=_[_0xe6cf('0x40')](_0x3350df[_0xe6cf('0x3e')],qs[_0xe6cf('0x42')](_0x3e9665[_0xe6cf('0x3f')]['fields']));_0x3e8ce1[_0xe6cf('0x41')]=_0x3e8ce1[_0xe6cf('0x41')]['length']?_0x3e8ce1[_0xe6cf('0x41')]:_0x3350df[_0xe6cf('0x3e')];if(!_0x3e9665[_0xe6cf('0x3f')]['hasOwnProperty'](_0xe6cf('0x43'))){_0x3e8ce1[_0xe6cf('0x2a')]=qs['limit'](_0x3e9665['query']['limit']);_0x3e8ce1[_0xe6cf('0x28')]=qs[_0xe6cf('0x28')](_0x3e9665[_0xe6cf('0x3f')][_0xe6cf('0x28')]);}_0x3e8ce1[_0xe6cf('0x44')]=qs['sort'](_0x3e9665[_0xe6cf('0x3f')]['sort']);_0x3e8ce1[_0xe6cf('0x45')]=qs[_0xe6cf('0x46')](_[_0xe6cf('0x47')](_0x3e9665[_0xe6cf('0x3f')],_0x3350df[_0xe6cf('0x46')]),_0x304366);if(_0x3e9665[_0xe6cf('0x3f')]['filter']){_0x3e8ce1[_0xe6cf('0x45')]=_[_0xe6cf('0x48')](_0x3e8ce1[_0xe6cf('0x45')],{'$or':_[_0xe6cf('0x39')](_0x304366,function(_0x24fdb6){if(_0x24fdb6[_0xe6cf('0x3c')]!==_0xe6cf('0x49')){var _0x4f68b3={};_0x4f68b3[_0x24fdb6[_0xe6cf('0x36')]]={'$like':'%'+_0x3e9665[_0xe6cf('0x3f')]['filter']+'%'};return _0x4f68b3;}})});}_0x3e8ce1=_[_0xe6cf('0x48')]({},_0x3e8ce1,_0x3e9665[_0xe6cf('0x4a')]);var _0x56fd40={'where':_0x3e8ce1[_0xe6cf('0x45')]};return db['Setting']['count'](_0x56fd40)[_0xe6cf('0x32')](function(_0x14620d){_0x29629e[_0xe6cf('0x2b')]=_0x14620d;if(_0x3e9665[_0xe6cf('0x3f')]['includeAll']){_0x3e8ce1[_0xe6cf('0x4b')]=[{'all':!![]}];}return db[_0xe6cf('0x3a')][_0xe6cf('0x4c')](_0x3e8ce1);})['then'](function(_0x131afd){_0x29629e[_0xe6cf('0x4d')]=_0x131afd;return _0x29629e;})[_0xe6cf('0x32')](respondWithFilteredResult(_0x2e829d,_0x3e8ce1))[_0xe6cf('0x4e')](handleError(_0x2e829d,null));};exports[_0xe6cf('0x4f')]=function(_0x1731da,_0x482304){var _0x47bcdf={'raw':![],'where':{'id':_0x1731da[_0xe6cf('0x50')]['id']}},_0x509027={};_0x509027[_0xe6cf('0x3e')]=_[_0xe6cf('0x51')](db['Setting'][_0xe6cf('0x52')]);_0x509027[_0xe6cf('0x3f')]=_[_0xe6cf('0x51')](_0x1731da['query']);_0x509027[_0xe6cf('0x46')]=_[_0xe6cf('0x40')](_0x509027[_0xe6cf('0x3e')],_0x509027[_0xe6cf('0x3f')]);_0x47bcdf[_0xe6cf('0x41')]=_[_0xe6cf('0x40')](_0x509027[_0xe6cf('0x3e')],qs[_0xe6cf('0x42')](_0x1731da['query'][_0xe6cf('0x42')]));_0x47bcdf['attributes']=_0x47bcdf[_0xe6cf('0x41')][_0xe6cf('0x53')]?_0x47bcdf[_0xe6cf('0x41')]:_0x509027['model'];if(_0x1731da[_0xe6cf('0x3f')][_0xe6cf('0x54')]){_0x47bcdf['include']=[{'all':!![]}];}_0x47bcdf=_[_0xe6cf('0x48')]({},_0x47bcdf,_0x1731da[_0xe6cf('0x4a')]);return db[_0xe6cf('0x3a')][_0xe6cf('0x55')](_0x47bcdf)[_0xe6cf('0x32')](handleEntityNotFound(_0x482304,null))[_0xe6cf('0x32')](respondWithResult(_0x482304,null))[_0xe6cf('0x4e')](handleError(_0x482304,null));};exports[_0xe6cf('0x31')]=function(_0x3894f6,_0x50ec73){if(_0x3894f6[_0xe6cf('0x56')]['id']){delete _0x3894f6[_0xe6cf('0x56')]['id'];}return db[_0xe6cf('0x3a')][_0xe6cf('0x55')]({'where':{'id':_0x3894f6[_0xe6cf('0x50')]['id']}})[_0xe6cf('0x32')](handleEntityNotFound(_0x50ec73,null))[_0xe6cf('0x32')](saveUpdates(_0x3894f6[_0xe6cf('0x56')],null))[_0xe6cf('0x32')](respondWithResult(_0x50ec73,null))[_0xe6cf('0x4e')](handleError(_0x50ec73,null));};exports[_0xe6cf('0x57')]=function(_0x22d23c,_0x5b8d40,_0x56dc08){if(_0x22d23c[_0xe6cf('0x58')]&&_0x22d23c[_0xe6cf('0x58')][_0xe6cf('0x59')]){_0x22d23c[_0xe6cf('0x56')]['logo']=_0x22d23c[_0xe6cf('0x58')]['filename'];}return db[_0xe6cf('0x3a')]['find']({'where':{'id':_0x22d23c[_0xe6cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x5b8d40,null))['then'](saveUpdates(_0x22d23c[_0xe6cf('0x56')],null))[_0xe6cf('0x32')](respondWithResult(_0x5b8d40,null))[_0xe6cf('0x4e')](handleError(_0x5b8d40,null));};exports[_0xe6cf('0x5a')]=function(_0x47eea7,_0xe42b4c,_0x55bd6a){if(_0x47eea7[_0xe6cf('0x58')]&&_0x47eea7[_0xe6cf('0x58')]['filename']){_0x47eea7[_0xe6cf('0x56')][_0xe6cf('0x5b')]=_0x47eea7[_0xe6cf('0x58')][_0xe6cf('0x59')];}return db[_0xe6cf('0x3a')][_0xe6cf('0x55')]({'where':{'id':_0x47eea7[_0xe6cf('0x50')]['id']}})[_0xe6cf('0x32')](handleEntityNotFound(_0xe42b4c,null))[_0xe6cf('0x32')](saveUpdates(_0x47eea7[_0xe6cf('0x56')],null))[_0xe6cf('0x32')](respondWithResult(_0xe42b4c,null))[_0xe6cf('0x4e')](handleError(_0xe42b4c,null));};var utilLicense=require(_0xe6cf('0x18'));exports[_0xe6cf('0x5c')]=function(_0x6eabc3,_0xb24ff4,_0x2ee4e7){var _0x20274c=_0xe6cf('0x5d');var _0x10538a={'custom':![]};return utilLicense[_0xe6cf('0x5e')]()['then'](function(_0x1540a8){if(_0x1540a8){_0x10538a=_0x1540a8;}return db['Setting']['find']({'where':{'id':_0x6eabc3['params']['id']},'attributes':[_0xe6cf('0x5f'),_0xe6cf('0x5b'),_0xe6cf('0x60'),_0xe6cf('0x61'),'defaultLogo',_0xe6cf('0x62'),_0xe6cf('0x63'),_0xe6cf('0x64')],'raw':!![]});})[_0xe6cf('0x32')](handleEntityNotFound(_0xb24ff4,null))[_0xe6cf('0x32')](function(_0x354e32){if(_0x354e32){var _0x16de1d=_0x354e32[_0xe6cf('0x5f')]&&fs[_0xe6cf('0x65')](path['join'](config[_0xe6cf('0x66')],_0x20274c,_['toLower'](_0x354e32['logo'])))?path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x20274c,_[_0xe6cf('0x68')](_0x354e32[_0xe6cf('0x5f')])):path['join'](config[_0xe6cf('0x66')],_0x20274c,_[_0xe6cf('0x68')](_0xe6cf('0x69')));var _0x484a47=_0xe6cf('0x6a')+_[_0xe6cf('0x6b')](_0xe6cf('0x5f'));if(_0x354e32[_0x484a47]||!_0x10538a[_0xe6cf('0x6c')]){_0x16de1d=path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x20274c,_[_0xe6cf('0x68')](_0xe6cf('0x69')));}if(!fs['existsSync'](_0x16de1d)){throw new db['Sequelize'][(_0xe6cf('0x6d'))](_['upperFirst'](_0xe6cf('0x5f'))+'\x20not\x20found');}return _0xb24ff4['download'](_0x16de1d);}})[_0xe6cf('0x4e')](handleError(_0xb24ff4,null));};var utilLicense=require(_0xe6cf('0x18'));exports[_0xe6cf('0x6e')]=function(_0x49cf66,_0x26eaf4,_0x10f969){var _0x4d896f='server/files/images/logos';var _0x55ebfe={'custom':![]};return utilLicense[_0xe6cf('0x5e')]()[_0xe6cf('0x32')](function(_0x1d4af4){if(_0x1d4af4){_0x55ebfe=_0x1d4af4;}return db['Setting'][_0xe6cf('0x55')]({'where':{'id':_0x49cf66[_0xe6cf('0x50')]['id']},'attributes':[_0xe6cf('0x5f'),_0xe6cf('0x5b'),_0xe6cf('0x60'),_0xe6cf('0x61'),_0xe6cf('0x6f'),_0xe6cf('0x62'),'defaultPreferred',_0xe6cf('0x64')],'raw':!![]});})[_0xe6cf('0x32')](handleEntityNotFound(_0x26eaf4,null))[_0xe6cf('0x32')](function(_0x29120c){if(_0x29120c){var _0xa493ba=_0x29120c[_0xe6cf('0x5b')]&&fs[_0xe6cf('0x65')](path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x4d896f,_[_0xe6cf('0x68')](_0x29120c[_0xe6cf('0x5b')])))?path['join'](config[_0xe6cf('0x66')],_0x4d896f,_[_0xe6cf('0x68')](_0x29120c[_0xe6cf('0x5b')])):path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x4d896f,_[_0xe6cf('0x68')](_0xe6cf('0x70')));var _0x41f8e9=_0xe6cf('0x6a')+_['upperFirst'](_0xe6cf('0x5b'));if(_0x29120c[_0x41f8e9]||!_0x55ebfe[_0xe6cf('0x6c')]){_0xa493ba=path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x4d896f,_[_0xe6cf('0x68')](_0xe6cf('0x70')));}if(!fs[_0xe6cf('0x65')](_0xa493ba)){throw new db[(_0xe6cf('0x71'))][(_0xe6cf('0x6d'))](_[_0xe6cf('0x6b')](_0xe6cf('0x5b'))+'\x20not\x20found');}return _0x26eaf4[_0xe6cf('0x72')](_0xa493ba);}})[_0xe6cf('0x4e')](handleError(_0x26eaf4,null));};exports[_0xe6cf('0x73')]=function(_0x2494ff,_0x1e538c){return db['Setting'][_0xe6cf('0x55')]({'where':{'id':_0x2494ff[_0xe6cf('0x50')]['id']},'attributes':['securePassword']})[_0xe6cf('0x32')](respondWithResult(_0x1e538c,null))['catch'](handleError(_0x1e538c,null));};exports[_0xe6cf('0x74')]=function(_0x2263b8,_0x4ddd9f,_0x5a5820){if(_0x2263b8['file']&&_0x2263b8[_0xe6cf('0x58')][_0xe6cf('0x59')]){_0x2263b8[_0xe6cf('0x56')]['preferred']=_0x2263b8[_0xe6cf('0x58')][_0xe6cf('0x59')];}return db[_0xe6cf('0x3a')]['find']({'where':{'id':_0x2263b8['params']['id']}})[_0xe6cf('0x32')](handleEntityNotFound(_0x4ddd9f,null))['then'](saveUpdates(_0x2263b8['body'],null))[_0xe6cf('0x32')](respondWithResult(_0x4ddd9f,null))['catch'](handleError(_0x4ddd9f,null));};var utilLicense=require(_0xe6cf('0x18'));exports[_0xe6cf('0x75')]=function(_0x16e649,_0x560948,_0x4b1b7d){var _0x1de9c1=_0xe6cf('0x5d');var _0x288be7={'custom':![]};return utilLicense[_0xe6cf('0x5e')]()['then'](function(_0xf1285c){if(_0xf1285c){_0x288be7=_0xf1285c;}return db[_0xe6cf('0x3a')][_0xe6cf('0x55')]({'where':{'id':_0x16e649[_0xe6cf('0x50')]['id']},'attributes':[_0xe6cf('0x5f'),_0xe6cf('0x5b'),'preferred',_0xe6cf('0x61'),_0xe6cf('0x6f'),_0xe6cf('0x62'),_0xe6cf('0x63'),_0xe6cf('0x64')],'raw':!![]});})[_0xe6cf('0x32')](handleEntityNotFound(_0x560948,null))[_0xe6cf('0x32')](function(_0x532459){if(_0x532459){var _0x315de1=_0x532459[_0xe6cf('0x60')]&&fs['existsSync'](path['join'](config['root'],_0x1de9c1,_[_0xe6cf('0x68')](_0x532459[_0xe6cf('0x60')])))?path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x1de9c1,_[_0xe6cf('0x68')](_0x532459[_0xe6cf('0x60')])):path[_0xe6cf('0x67')](config['root'],_0x1de9c1,_['toLower'](_0xe6cf('0x76')));var _0x26edbb=_0xe6cf('0x6a')+_['upperFirst'](_0xe6cf('0x60'));if(_0x532459[_0x26edbb]||!_0x288be7[_0xe6cf('0x6c')]||!_0x288be7['preferred']){_0x315de1=path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x1de9c1,_[_0xe6cf('0x68')](_0xe6cf('0x76')));}if(!fs[_0xe6cf('0x65')](_0x315de1)){throw new db['Sequelize'][(_0xe6cf('0x6d'))](_[_0xe6cf('0x6b')](_0xe6cf('0x60'))+_0xe6cf('0x77'));}return _0x560948[_0xe6cf('0x72')](_0x315de1);}})[_0xe6cf('0x4e')](handleError(_0x560948,null));};exports[_0xe6cf('0x78')]=function(_0x58d385,_0xd03aa,_0x42f291){if(_0x58d385[_0xe6cf('0x58')]&&_0x58d385[_0xe6cf('0x58')]['filename']){_0x58d385['body']['favicon']=_0x58d385[_0xe6cf('0x58')][_0xe6cf('0x59')];}return db[_0xe6cf('0x3a')][_0xe6cf('0x55')]({'where':{'id':_0x58d385[_0xe6cf('0x50')]['id']}})['then'](handleEntityNotFound(_0xd03aa,null))[_0xe6cf('0x32')](saveUpdates(_0x58d385['body'],null))[_0xe6cf('0x32')](respondWithResult(_0xd03aa,null))[_0xe6cf('0x4e')](handleError(_0xd03aa,null));};var utilLicense=require(_0xe6cf('0x18'));exports[_0xe6cf('0x79')]=function(_0x39b8c2,_0x591f76,_0x2a6c73){var _0x1fcb60=_0xe6cf('0x5d');var _0x356262={'custom':![]};return utilLicense['getLicense']()[_0xe6cf('0x32')](function(_0xdcb1fe){if(_0xdcb1fe){_0x356262=_0xdcb1fe;}return db['Setting'][_0xe6cf('0x55')]({'where':{'id':_0x39b8c2[_0xe6cf('0x50')]['id']},'attributes':[_0xe6cf('0x5f'),_0xe6cf('0x5b'),'preferred',_0xe6cf('0x61'),_0xe6cf('0x6f'),_0xe6cf('0x62'),_0xe6cf('0x63'),_0xe6cf('0x64')],'raw':!![]});})[_0xe6cf('0x32')](handleEntityNotFound(_0x591f76,null))[_0xe6cf('0x32')](function(_0xce0d5f){if(_0xce0d5f){var _0x159004=_0xce0d5f[_0xe6cf('0x61')]&&fs[_0xe6cf('0x65')](path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x1fcb60,_['toLower'](_0xce0d5f[_0xe6cf('0x61')])))?path['join'](config[_0xe6cf('0x66')],_0x1fcb60,_[_0xe6cf('0x68')](_0xce0d5f[_0xe6cf('0x61')])):path[_0xe6cf('0x67')](config['root'],_0x1fcb60,_[_0xe6cf('0x68')](_0xe6cf('0x7a')));var _0x2d6184=_0xe6cf('0x6a')+_[_0xe6cf('0x6b')](_0xe6cf('0x61'));if(_0xce0d5f[_0x2d6184]||!_0x356262[_0xe6cf('0x6c')]){_0x159004=path[_0xe6cf('0x67')](config[_0xe6cf('0x66')],_0x1fcb60,_[_0xe6cf('0x68')]('default_favicon.ico'));}if(!fs[_0xe6cf('0x65')](_0x159004)){throw new db[(_0xe6cf('0x71'))][(_0xe6cf('0x6d'))](_[_0xe6cf('0x6b')](_0xe6cf('0x61'))+'\x20not\x20found');}return _0x591f76[_0xe6cf('0x72')](_0x159004);}})['catch'](handleError(_0x591f76,null));};exports[_0xe6cf('0x7b')]=function(_0x101f5f,_0x374249){var _0x1c7daf={'offset':moment()[_0xe6cf('0x7c')]()};_0x1c7daf['now']=moment()[_0xe6cf('0x7c')](_0x1c7daf[_0xe6cf('0x28')])[_0xe6cf('0x7d')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x374249['status'](0xc8)[_0xe6cf('0x37')](_0x1c7daf);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 588f55f..2428e9d 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 _0xdabb=['exports','Setting','settings','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e4535,_0x37cf32){var _0x4d8658=function(_0x15509a){while(--_0x15509a){_0x1e4535['push'](_0x1e4535['shift']());}};_0x4d8658(++_0x37cf32);}(_0xdabb,0x19a));var _0xbdab=function(_0x262548,_0x15dc38){_0x262548=_0x262548-0x0;var _0x4d16aa=_0xdabb[_0x262548];return _0x4d16aa;};'use strict';var _=require(_0xbdab('0x0'));var util=require('util');var logger=require(_0xbdab('0x1'))(_0xbdab('0x2'));var moment=require('moment');var BPromise=require(_0xbdab('0x3'));var rp=require(_0xbdab('0x4'));var fs=require('fs');var path=require(_0xbdab('0x5'));var rimraf=require(_0xbdab('0x6'));var config=require(_0xbdab('0x7'));var attributes=require('./setting.attributes');module[_0xbdab('0x8')]=function(_0x43f238,_0x5d5221){return _0x43f238['define'](_0xbdab('0x9'),attributes,{'tableName':_0xbdab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4aa=['lodash','api','bluebird','path','rimraf','../../config/environment','./setting.attributes','exports','define','Setting'];(function(_0x1fd3d9,_0x58cb15){var _0x7119c8=function(_0x30c8fd){while(--_0x30c8fd){_0x1fd3d9['push'](_0x1fd3d9['shift']());}};_0x7119c8(++_0x58cb15);}(_0xb4aa,0x172));var _0xab4a=function(_0x33596c,_0x5e733e){_0x33596c=_0x33596c-0x0;var _0x8ef6f4=_0xb4aa[_0x33596c];return _0x8ef6f4;};'use strict';var _=require(_0xab4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab4a('0x1'));var moment=require('moment');var BPromise=require(_0xab4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab4a('0x3'));var rimraf=require(_0xab4a('0x4'));var config=require(_0xab4a('0x5'));var attributes=require(_0xab4a('0x6'));module[_0xab4a('0x7')]=function(_0x1796b6,_0x3217da){return _0x1796b6[_0xab4a('0x8')](_0xab4a('0x9'),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 6d13ada..8a73b92 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 _0x5f1a=['info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','then','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x593111,_0x3b62bf){var _0x1ee3bb=function(_0x53be4d){while(--_0x53be4d){_0x593111['push'](_0x593111['shift']());}};_0x1ee3bb(++_0x3b62bf);}(_0x5f1a,0xda));var _0xa5f1=function(_0x31a35e,_0x55f4b1){_0x31a35e=_0x31a35e-0x0;var _0x5abea4=_0x5f1a[_0x31a35e];return _0x5abea4;};'use strict';var _=require(_0xa5f1('0x0'));var util=require(_0xa5f1('0x1'));var moment=require(_0xa5f1('0x2'));var BPromise=require(_0xa5f1('0x3'));var rs=require(_0xa5f1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5f1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5f1('0x6'))(_0xa5f1('0x7'));var config=require(_0xa5f1('0x8'));var jayson=require(_0xa5f1('0x9'));var client=jayson[_0xa5f1('0xa')][_0xa5f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5825c8,_0x23cd0b,_0x45fd40){return new BPromise(function(_0x842254,_0x50518b){return client[_0xa5f1('0xc')](_0x5825c8,_0x45fd40)['then'](function(_0xf7eafc){logger[_0xa5f1('0xd')](_0xa5f1('0xe'),_0x23cd0b,_0xa5f1('0xf'));logger['debug'](_0xa5f1('0x10'),_0x23cd0b,_0xa5f1('0xf'),JSON['stringify'](_0xf7eafc));if(_0xf7eafc['error']){if(_0xf7eafc[_0xa5f1('0x11')]['code']===0x1f4){logger[_0xa5f1('0x11')](_0xa5f1('0xe'),_0x23cd0b,_0xf7eafc[_0xa5f1('0x11')][_0xa5f1('0x12')]);return _0x50518b(_0xf7eafc[_0xa5f1('0x11')][_0xa5f1('0x12')]);}logger[_0xa5f1('0x11')](_0xa5f1('0xe'),_0x23cd0b,_0xf7eafc[_0xa5f1('0x11')][_0xa5f1('0x12')]);return _0x842254(_0xf7eafc[_0xa5f1('0x11')][_0xa5f1('0x12')]);}else{logger[_0xa5f1('0xd')](_0xa5f1('0xe'),_0x23cd0b,_0xa5f1('0xf'));_0x842254(_0xf7eafc[_0xa5f1('0x13')][_0xa5f1('0x12')]);}})[_0xa5f1('0x14')](function(_0x5932da){logger[_0xa5f1('0x11')](_0xa5f1('0xe'),_0x23cd0b,_0x5932da);_0x50518b(_0x5932da);});});}exports[_0xa5f1('0x15')]=function(_0x444869){var _0x5956c2=this;return new Promise(function(_0x18ca8f,_0xafe572){return db[_0xa5f1('0x16')][_0xa5f1('0x17')]({'raw':_0x444869[_0xa5f1('0x18')]?_0x444869[_0xa5f1('0x18')][_0xa5f1('0x19')]===undefined?!![]:![]:!![],'where':_0x444869[_0xa5f1('0x18')]?_0x444869['options'][_0xa5f1('0x1a')]||null:null,'attributes':_0x444869[_0xa5f1('0x18')]?_0x444869['options'][_0xa5f1('0x1b')]||null:null,'include':_0x444869[_0xa5f1('0x18')]?_0x444869[_0xa5f1('0x18')][_0xa5f1('0x1c')]?_[_0xa5f1('0x1d')](_0x444869[_0xa5f1('0x18')][_0xa5f1('0x1c')],function(_0x52f88b){return{'model':db[_0x52f88b['model']],'as':_0x52f88b['as'],'attributes':_0x52f88b[_0xa5f1('0x1b')],'include':_0x52f88b[_0xa5f1('0x1c')]?_[_0xa5f1('0x1d')](_0x52f88b[_0xa5f1('0x1c')],function(_0x2e5668){return{'model':db[_0x2e5668[_0xa5f1('0x1e')]],'as':_0x2e5668['as'],'attributes':_0x2e5668['attributes'],'include':_0x2e5668['include']?_[_0xa5f1('0x1d')](_0x2e5668[_0xa5f1('0x1c')],function(_0x40aaae){return{'model':db[_0x40aaae['model']],'as':_0x40aaae['as'],'attributes':_0x40aaae[_0xa5f1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa5f1('0x1f')](function(_0x2f3c0f){logger[_0xa5f1('0xd')]('ShowSetting',_0x444869);logger['debug'](_0xa5f1('0x15'),_0x444869,JSON[_0xa5f1('0x20')](_0x2f3c0f));_0x18ca8f(_0x2f3c0f);})[_0xa5f1('0x14')](function(_0x3644a3){logger[_0xa5f1('0x11')](_0xa5f1('0x15'),_0x3644a3[_0xa5f1('0x12')],_0x444869);_0xafe572(_0x5956c2[_0xa5f1('0x11')](0x1f4,_0x3644a3[_0xa5f1('0x12')]));});});}; \ No newline at end of file +var _0xccd2=['ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','find','options','raw','attributes','include','map','model','bluebird','randomstring'];(function(_0x1df7b8,_0x1ea2df){var _0x4e57c3=function(_0x519925){while(--_0x519925){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x4e57c3(++_0x1ea2df);}(_0xccd2,0x8a));var _0x2ccd=function(_0x1a53c5,_0x4b4b6e){_0x1a53c5=_0x1a53c5-0x0;var _0x4b7d64=_0xccd2[_0x1a53c5];return _0x4b7d64;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2ccd('0x0'));var rs=require(_0x2ccd('0x1'));var fs=require('fs');var Redis=require(_0x2ccd('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2ccd('0x3'))(_0x2ccd('0x4'));var config=require(_0x2ccd('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2ccd('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2d8f,_0x222d9a,_0x264928){return new BPromise(function(_0x2b73bf,_0xc72d09){return client[_0x2ccd('0x7')](_0x2d2d8f,_0x264928)[_0x2ccd('0x8')](function(_0x32f6d9){logger[_0x2ccd('0x9')](_0x2ccd('0xa'),_0x222d9a,_0x2ccd('0xb'));logger[_0x2ccd('0xc')](_0x2ccd('0xd'),_0x222d9a,_0x2ccd('0xb'),JSON[_0x2ccd('0xe')](_0x32f6d9));if(_0x32f6d9[_0x2ccd('0xf')]){if(_0x32f6d9[_0x2ccd('0xf')][_0x2ccd('0x10')]===0x1f4){logger[_0x2ccd('0xf')](_0x2ccd('0xa'),_0x222d9a,_0x32f6d9[_0x2ccd('0xf')][_0x2ccd('0x11')]);return _0xc72d09(_0x32f6d9[_0x2ccd('0xf')][_0x2ccd('0x11')]);}logger[_0x2ccd('0xf')](_0x2ccd('0xa'),_0x222d9a,_0x32f6d9[_0x2ccd('0xf')]['message']);return _0x2b73bf(_0x32f6d9[_0x2ccd('0xf')][_0x2ccd('0x11')]);}else{logger[_0x2ccd('0x9')](_0x2ccd('0xa'),_0x222d9a,_0x2ccd('0xb'));_0x2b73bf(_0x32f6d9['result']['message']);}})[_0x2ccd('0x12')](function(_0x4bc79d){logger[_0x2ccd('0xf')](_0x2ccd('0xa'),_0x222d9a,_0x4bc79d);_0xc72d09(_0x4bc79d);});});}exports[_0x2ccd('0x13')]=function(_0x69383f){var _0x2a6972=this;return new Promise(function(_0x1682b4,_0x1b44dc){return db[_0x2ccd('0x14')][_0x2ccd('0x15')]({'raw':_0x69383f[_0x2ccd('0x16')]?_0x69383f['options'][_0x2ccd('0x17')]===undefined?!![]:![]:!![],'where':_0x69383f['options']?_0x69383f[_0x2ccd('0x16')]['where']||null:null,'attributes':_0x69383f['options']?_0x69383f[_0x2ccd('0x16')][_0x2ccd('0x18')]||null:null,'include':_0x69383f[_0x2ccd('0x16')]?_0x69383f[_0x2ccd('0x16')][_0x2ccd('0x19')]?_[_0x2ccd('0x1a')](_0x69383f[_0x2ccd('0x16')][_0x2ccd('0x19')],function(_0x2bb48e){return{'model':db[_0x2bb48e[_0x2ccd('0x1b')]],'as':_0x2bb48e['as'],'attributes':_0x2bb48e[_0x2ccd('0x18')],'include':_0x2bb48e['include']?_[_0x2ccd('0x1a')](_0x2bb48e['include'],function(_0x5828f9){return{'model':db[_0x5828f9[_0x2ccd('0x1b')]],'as':_0x5828f9['as'],'attributes':_0x5828f9[_0x2ccd('0x18')],'include':_0x5828f9[_0x2ccd('0x19')]?_['map'](_0x5828f9['include'],function(_0x40c767){return{'model':db[_0x40c767[_0x2ccd('0x1b')]],'as':_0x40c767['as'],'attributes':_0x40c767[_0x2ccd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2ccd('0x8')](function(_0x53325d){logger[_0x2ccd('0x9')](_0x2ccd('0x13'),_0x69383f);logger[_0x2ccd('0xc')](_0x2ccd('0x13'),_0x69383f,JSON[_0x2ccd('0xe')](_0x53325d));_0x1682b4(_0x53325d);})[_0x2ccd('0x12')](function(_0x7b8da3){logger['error']('ShowSetting',_0x7b8da3['message'],_0x69383f);_0x1b44dc(_0x2a6972['error'](0x1f4,_0x7b8da3[_0x2ccd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 98c3ab4..1c98446 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 _0xa1d3=['status','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send'];(function(_0xfbcaf5,_0x4c4d1d){var _0x57f9f5=function(_0x619e6d){while(--_0x619e6d){_0xfbcaf5['push'](_0xfbcaf5['shift']());}};_0x57f9f5(++_0x4c4d1d);}(_0xa1d3,0x179));var _0x3a1d=function(_0x245d40,_0x455ece){_0x245d40=_0x245d40-0x0;var _0x245534=_0xa1d3[_0x245d40];return _0x245534;};'use strict';var multer=require(_0x3a1d('0x0'));var util=require(_0x3a1d('0x1'));var path=require(_0x3a1d('0x2'));var timeout=require(_0x3a1d('0x3'));var express=require(_0x3a1d('0x4'));var router=express[_0x3a1d('0x5')]();var fs_extra=require(_0x3a1d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3a1d('0x7'));var config=require(_0x3a1d('0x8'));var controller=require(_0x3a1d('0x9'));router[_0x3a1d('0xa')]('/',auth[_0x3a1d('0xb')](),controller[_0x3a1d('0xc')]);router['get'](_0x3a1d('0xd'),auth['isAuthenticated'](),controller[_0x3a1d('0xe')]);router['get'](_0x3a1d('0xf'),auth[_0x3a1d('0xb')](),controller['show']);router[_0x3a1d('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3a1d('0x10')]);router[_0x3a1d('0xa')](_0x3a1d('0x11'),auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x12')]);router['get'](_0x3a1d('0x13'),auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x14')]);router[_0x3a1d('0xa')](_0x3a1d('0x15'),auth['isAuthenticated'](),controller[_0x3a1d('0x16')]);router['get'](_0x3a1d('0x17'),controller[_0x3a1d('0x18')]);router[_0x3a1d('0xa')](_0x3a1d('0x19'),auth['isAuthenticated'](),controller[_0x3a1d('0x1a')]);router[_0x3a1d('0x1b')]('/',auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x1c')]);router[_0x3a1d('0x1b')](_0x3a1d('0x1d'),auth['isAuthenticated'](),controller[_0x3a1d('0x1e')]);router[_0x3a1d('0x1b')](_0x3a1d('0x11'),auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x1f')]);router[_0x3a1d('0x1b')](_0x3a1d('0x20'),controller[_0x3a1d('0x21')]);router[_0x3a1d('0x1b')](_0x3a1d('0x13'),auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x22')]);router['post'](_0x3a1d('0x23'),auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x24')]);router[_0x3a1d('0x1b')](_0x3a1d('0x17'),controller[_0x3a1d('0x25')]);router[_0x3a1d('0x1b')](_0x3a1d('0x19'),auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x26')]);router[_0x3a1d('0x27')](_0x3a1d('0xf'),auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x28')]);router[_0x3a1d('0x29')]('/:id',auth[_0x3a1d('0xb')](),controller[_0x3a1d('0x2a')]);router[_0x3a1d('0x29')](_0x3a1d('0x1d'),auth['isAuthenticated'](),controller[_0x3a1d('0x2b')]);router[_0x3a1d('0x29')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x3a1d('0x29')](_0x3a1d('0x19'),auth['isAuthenticated'](),controller[_0x3a1d('0x2c')]);module[_0x3a1d('0x2d')]=router; \ No newline at end of file +var _0xd57c=['post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/send','send','/:id/status','status','addAgents','put','update','delete','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents'];(function(_0xf8b0d4,_0x13cdd2){var _0x323c68=function(_0x2c10a5){while(--_0x2c10a5){_0xf8b0d4['push'](_0xf8b0d4['shift']());}};_0x323c68(++_0x13cdd2);}(_0xd57c,0x108));var _0xcd57=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xd57c[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0xcd57('0x0'));var util=require(_0xcd57('0x1'));var path=require('path');var timeout=require(_0xcd57('0x2'));var express=require('express');var router=express[_0xcd57('0x3')]();var fs_extra=require(_0xcd57('0x4'));var auth=require(_0xcd57('0x5'));var interaction=require(_0xcd57('0x6'));var config=require('../../config/environment');var controller=require(_0xcd57('0x7'));router[_0xcd57('0x8')]('/',auth[_0xcd57('0x9')](),controller[_0xcd57('0xa')]);router['get']('/describe',auth[_0xcd57('0x9')](),controller[_0xcd57('0xb')]);router[_0xcd57('0x8')](_0xcd57('0xc'),auth[_0xcd57('0x9')](),controller[_0xcd57('0xd')]);router['get'](_0xcd57('0xe'),auth[_0xcd57('0x9')](),controller[_0xcd57('0xf')]);router['get']('/:id/canned_answers',auth[_0xcd57('0x9')](),controller[_0xcd57('0x10')]);router[_0xcd57('0x8')](_0xcd57('0x11'),auth[_0xcd57('0x9')](),controller[_0xcd57('0x12')]);router[_0xcd57('0x8')](_0xcd57('0x13'),auth[_0xcd57('0x9')](),controller[_0xcd57('0x14')]);router[_0xcd57('0x8')]('/:id/status',controller['statusGet']);router[_0xcd57('0x8')](_0xcd57('0x15'),auth['isAuthenticated'](),controller[_0xcd57('0x16')]);router[_0xcd57('0x17')]('/',auth['isAuthenticated'](),controller[_0xcd57('0x18')]);router[_0xcd57('0x17')](_0xcd57('0xe'),auth[_0xcd57('0x9')](),controller[_0xcd57('0x19')]);router[_0xcd57('0x17')]('/:id/canned_answers',auth[_0xcd57('0x9')](),controller[_0xcd57('0x1a')]);router['post'](_0xcd57('0x1b'),controller[_0xcd57('0x1c')]);router[_0xcd57('0x17')](_0xcd57('0x11'),auth[_0xcd57('0x9')](),controller['addApplications']);router[_0xcd57('0x17')](_0xcd57('0x1d'),auth[_0xcd57('0x9')](),controller[_0xcd57('0x1e')]);router[_0xcd57('0x17')](_0xcd57('0x1f'),controller[_0xcd57('0x20')]);router[_0xcd57('0x17')](_0xcd57('0x15'),auth[_0xcd57('0x9')](),controller[_0xcd57('0x21')]);router[_0xcd57('0x22')](_0xcd57('0xc'),auth['isAuthenticated'](),controller[_0xcd57('0x23')]);router[_0xcd57('0x24')](_0xcd57('0xc'),auth[_0xcd57('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xcd57('0x24')](_0xcd57('0x25'),auth[_0xcd57('0x9')](),controller[_0xcd57('0x26')]);router[_0xcd57('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0xcd57('0x27')]);module[_0xcd57('0x28')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 245ed06..4c649b6 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 _0x0936=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','connectel','clicksend','plivo','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2c00b3,_0x29b200){var _0x595512=function(_0x33401e){while(--_0x33401e){_0x2c00b3['push'](_0x2c00b3['shift']());}};_0x595512(++_0x29b200);}(_0x0936,0xde));var _0x6093=function(_0x1fadc1,_0xc0f9d9){_0x1fadc1=_0x1fadc1-0x0;var _0x246526=_0x0936[_0x1fadc1];return _0x246526;};'use strict';var Sequelize=require(_0x6093('0x0'));var rs=require(_0x6093('0x1'));module[_0x6093('0x2')]={'name':{'type':Sequelize[_0x6093('0x3')],'unique':_0x6093('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x6093('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6093('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x6093('0x3')]},'type':{'type':Sequelize[_0x6093('0x5')](_0x6093('0x6'),_0x6093('0x7'),_0x6093('0x8'),_0x6093('0x9'),_0x6093('0xa'),'clickatell','bandwidth',_0x6093('0xb'),_0x6093('0xc'),_0x6093('0xd'))},'accountSid':{'type':Sequelize[_0x6093('0x3')]},'authId':{'type':Sequelize[_0x6093('0x3')]},'authToken':{'type':Sequelize[_0x6093('0x3')]},'smsMethod':{'type':Sequelize[_0x6093('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6093('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x6093('0x3')]},'accountId':{'type':Sequelize[_0x6093('0x3')]},'senderString':{'type':Sequelize[_0x6093('0x3')]},'deliveryReport':{'type':Sequelize[_0x6093('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x6093('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6093('0xf')],'defaultValue':function(){return _0x6093('0x10');}},'notificationSound':{'type':Sequelize[_0x6093('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6093('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6093('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6093('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6093('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6093('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6093('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6093('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6093('0x11')],'comment':_0x6093('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6093('0xe')],'defaultValue':![],'comment':_0x6093('0x13'),'set':function(_0x214118){if(!_0x214118)this[_0x6093('0x14')](_0x6093('0x15'),null);this['setDataValue']('mandatoryDisposition',_0x214118);}}}; \ No newline at end of file +var _0x726f=['mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x2f8619,_0x195689){var _0x13b303=function(_0x31c236){while(--_0x31c236){_0x2f8619['push'](_0x2f8619['shift']());}};_0x13b303(++_0x195689);}(_0x726f,0xa2));var _0xf726=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x726f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xf726('0x0'));var rs=require(_0xf726('0x1'));module['exports']={'name':{'type':Sequelize[_0xf726('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xf726('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xf726('0x2')],'defaultValue':function(){return rs[_0xf726('0x3')]();}},'phone':{'type':Sequelize[_0xf726('0x2')]},'type':{'type':Sequelize[_0xf726('0x4')](_0xf726('0x5'),_0xf726('0x6'),_0xf726('0x7'),_0xf726('0x8'),_0xf726('0x9'),_0xf726('0xa'),_0xf726('0xb'),_0xf726('0xc'),_0xf726('0xd'),_0xf726('0xe'))},'accountSid':{'type':Sequelize[_0xf726('0x2')]},'authId':{'type':Sequelize[_0xf726('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf726('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xf726('0x2')]},'senderString':{'type':Sequelize[_0xf726('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xf726('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf726('0xf')],'defaultValue':function(){return _0xf726('0x10');}},'notificationSound':{'type':Sequelize[_0xf726('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf726('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf726('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf726('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf726('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf726('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf726('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xf726('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x942f6c){if(!_0x942f6c)this[_0xf726('0x14')](_0xf726('0x15'),null);this['setDataValue'](_0xf726('0x16'),_0x942f6c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 0d01aae..efcbaa7 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 _0xfcc7=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','get','role','user','SmsAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','SmsAccountId','Disposition','getDispositions','nolimit','rows','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','pick','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','Text','MessageUUID','infobip','results','csc','segmentedMessage','fromNumber','replyMessageId','bandwidth','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','addApplications','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','Tag','Tags','color','tag','List','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','status_code','groupName','DELIVERED','clickatell','redif','error_code','intelepeer','DELIVRD','ACCEPTD','statusGet','debug','message-id','state','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xfcc7,0x1af));var _0x7fcc=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0xfcc7[_0x3cc05d];return _0x28b736;};'use strict';var emlformat=require(_0x7fcc('0x0'));var rimraf=require(_0x7fcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fcc('0x2'));var rp=require(_0x7fcc('0x3'));var moment=require(_0x7fcc('0x4'));var BPromise=require(_0x7fcc('0x5'));var Mustache=require('mustache');var util=require(_0x7fcc('0x6'));var path=require(_0x7fcc('0x7'));var sox=require(_0x7fcc('0x8'));var csv=require('to-csv');var ejs=require(_0x7fcc('0x9'));var fs=require('fs');var fs_extra=require(_0x7fcc('0xa'));var _=require(_0x7fcc('0xb'));var squel=require(_0x7fcc('0xc'));var crypto=require('crypto');var jsforce=require(_0x7fcc('0xd'));var deskjs=require(_0x7fcc('0xe'));var toCsv=require(_0x7fcc('0xf'));var querystring=require(_0x7fcc('0x10'));var Papa=require(_0x7fcc('0x11'));var Redis=require(_0x7fcc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7fcc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fcc('0x14'));var logger=require('../../config/logger')(_0x7fcc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7fcc('0x16'))['db'];config[_0x7fcc('0x17')]=_[_0x7fcc('0x18')](config['redis'],{'host':_0x7fcc('0x19'),'port':0x18eb});var socket=require(_0x7fcc('0x1a'))(new Redis(config[_0x7fcc('0x17')]));require('./smsAccount.socket')[_0x7fcc('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7fcc('0x1c')][_0x7fcc('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x17d5df,_0xddd647,_0x5bd493,_0x40a505){return new BPromise(function(_0x53114a,_0x2f06ab){var _0x302a02=_0x40a505||client;return _0x302a02[_0x7fcc('0x1e')](_0x17d5df,_0x5bd493)[_0x7fcc('0x1f')](function(_0xba9bb9){logger[_0x7fcc('0x20')](_0x7fcc('0x21'),_0xddd647,_0x7fcc('0x22'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xddd647,_0x7fcc('0x22'),JSON[_0x7fcc('0x23')](_0xba9bb9));if(_0xba9bb9['error']){if(_0xba9bb9[_0x7fcc('0x24')]['code']===0x1f4){logger[_0x7fcc('0x24')](_0x7fcc('0x21'),_0xddd647,_0xba9bb9[_0x7fcc('0x24')][_0x7fcc('0x25')]);return _0x2f06ab(_0xba9bb9[_0x7fcc('0x24')][_0x7fcc('0x25')]);}logger[_0x7fcc('0x24')]('SmsAccount,\x20%s,\x20%s',_0xddd647,_0xba9bb9[_0x7fcc('0x24')][_0x7fcc('0x25')]);return _0x53114a(_0xba9bb9[_0x7fcc('0x24')][_0x7fcc('0x25')]);}else{logger[_0x7fcc('0x20')]('SmsAccount,\x20%s,\x20%s',_0xddd647,'request\x20sent');_0x53114a(_0xba9bb9[_0x7fcc('0x26')][_0x7fcc('0x25')]);}})[_0x7fcc('0x27')](function(_0x645b0){logger[_0x7fcc('0x24')](_0x7fcc('0x21'),_0xddd647,_0x645b0);_0x2f06ab(_0x645b0);});});}function respondWithStatusCode(_0x2887f9,_0x46d159){_0x46d159=_0x46d159||0xcc;return function(_0xadc584){if(_0xadc584){return _0x2887f9[_0x7fcc('0x28')](_0x46d159);}return _0x2887f9['status'](_0x46d159)[_0x7fcc('0x29')]();};}function respondWithResult(_0x4cc2af,_0x1a6ecb){_0x1a6ecb=_0x1a6ecb||0xc8;return function(_0x5f34dd){if(_0x5f34dd){return _0x4cc2af['status'](_0x1a6ecb)[_0x7fcc('0x2a')](_0x5f34dd);}};}function respondWithFilteredResult(_0x32ad48,_0xafff96){return function(_0x4c185f){if(_0x4c185f){var _0x5c5e78=typeof _0xafff96['offset']===_0x7fcc('0x2b')&&typeof _0xafff96['limit']===_0x7fcc('0x2b');var _0x458487=_0x4c185f[_0x7fcc('0x2c')];var _0x54a9bc=_0x5c5e78?0x0:_0xafff96[_0x7fcc('0x2d')];var _0x758b6d=_0x5c5e78?_0x4c185f[_0x7fcc('0x2c')]:_0xafff96[_0x7fcc('0x2d')]+_0xafff96['limit'];var _0x42cf12;if(_0x758b6d>=_0x458487){_0x758b6d=_0x458487;_0x42cf12=0xc8;}else{_0x42cf12=0xce;}_0x32ad48[_0x7fcc('0x2e')](_0x42cf12);return _0x32ad48[_0x7fcc('0x2f')](_0x7fcc('0x30'),_0x54a9bc+'-'+_0x758b6d+'/'+_0x458487)[_0x7fcc('0x2a')](_0x4c185f);}return null;};}function patchUpdates(_0x4abc21){return function(_0xa497ef){try{jsonpatch[_0x7fcc('0x31')](_0xa497ef,_0x4abc21,!![]);}catch(_0x227346){return BPromise[_0x7fcc('0x32')](_0x227346);}return _0xa497ef[_0x7fcc('0x33')]();};}function saveUpdates(_0x28da15,_0x3a6c8b){return function(_0x3878fe){if(_0x3878fe){return _0x3878fe[_0x7fcc('0x34')](_0x28da15)[_0x7fcc('0x1f')](function(_0x3777){return _0x3777;});}return null;};}function removeEntity(_0x57ddaa,_0xd842f){return function(_0xf1fb4a){if(_0xf1fb4a){return _0xf1fb4a['destroy']()[_0x7fcc('0x1f')](function(){var _0x66e14a=_0xf1fb4a['get']({'plain':!![]});var _0x4a9b74='SmsAccounts';return db[_0x7fcc('0x35')]['destroy']({'where':{'type':_0x4a9b74,'resourceId':_0x66e14a['id']}})[_0x7fcc('0x1f')](function(){return _0xf1fb4a;});})[_0x7fcc('0x1f')](function(){_0x57ddaa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37830a,_0xf6df28){return function(_0x23ff6a){if(!_0x23ff6a){_0x37830a[_0x7fcc('0x28')](0x194);}return _0x23ff6a;};}function handleError(_0xc27a7d,_0x1e77a7){_0x1e77a7=_0x1e77a7||0x1f4;return function(_0x3cd85f){logger['error'](_0x3cd85f['stack']);if(_0x3cd85f[_0x7fcc('0x36')]){delete _0x3cd85f['name'];}_0xc27a7d['status'](_0x1e77a7)[_0x7fcc('0x37')](_0x3cd85f);};}exports['index']=function(_0x430626,_0x5f183f){var _0xc1de7={'include':[{'model':db[_0x7fcc('0x38')],'as':_0x7fcc('0x39')}]},_0x30b2ee={},_0x2b970f={'count':0x0,'rows':[]};var _0x14dcb7=_[_0x7fcc('0x3a')](db[_0x7fcc('0x3b')][_0x7fcc('0x3c')],function(_0x22bdf1){return{'name':_0x22bdf1['fieldName'],'type':_0x22bdf1[_0x7fcc('0x3d')]['key']};});_0x30b2ee[_0x7fcc('0x3e')]=_[_0x7fcc('0x3a')](_0x14dcb7,_0x7fcc('0x36'));_0x30b2ee[_0x7fcc('0x3f')]=_[_0x7fcc('0x40')](_0x430626[_0x7fcc('0x3f')]);_0x30b2ee[_0x7fcc('0x41')]=_[_0x7fcc('0x42')](_0x30b2ee[_0x7fcc('0x3e')],_0x30b2ee[_0x7fcc('0x3f')]);_0xc1de7[_0x7fcc('0x43')]=_[_0x7fcc('0x42')](_0x30b2ee['model'],qs[_0x7fcc('0x44')](_0x430626['query'][_0x7fcc('0x44')]));_0xc1de7[_0x7fcc('0x43')]=_0xc1de7[_0x7fcc('0x43')][_0x7fcc('0x45')]?_0xc1de7[_0x7fcc('0x43')]:_0x30b2ee[_0x7fcc('0x3e')];if(!_0x430626[_0x7fcc('0x3f')][_0x7fcc('0x46')]('nolimit')){_0xc1de7['limit']=qs[_0x7fcc('0x47')](_0x430626[_0x7fcc('0x3f')][_0x7fcc('0x47')]);_0xc1de7[_0x7fcc('0x2d')]=qs[_0x7fcc('0x2d')](_0x430626[_0x7fcc('0x3f')][_0x7fcc('0x2d')]);}_0xc1de7[_0x7fcc('0x48')]=qs[_0x7fcc('0x49')](_0x430626[_0x7fcc('0x3f')][_0x7fcc('0x49')]);_0xc1de7[_0x7fcc('0x4a')]=qs[_0x7fcc('0x41')](_['pick'](_0x430626[_0x7fcc('0x3f')],_0x30b2ee[_0x7fcc('0x41')]),_0x14dcb7);if(_0x430626[_0x7fcc('0x3f')][_0x7fcc('0x4b')]){_0xc1de7['where']=_[_0x7fcc('0x4c')](_0xc1de7[_0x7fcc('0x4a')],{'$or':_[_0x7fcc('0x3a')](_0x14dcb7,function(_0x1c3413){if(_0x1c3413[_0x7fcc('0x3d')]!==_0x7fcc('0x4d')){var _0x167582={};_0x167582[_0x1c3413[_0x7fcc('0x36')]]={'$like':'%'+_0x430626[_0x7fcc('0x3f')]['filter']+'%'};return _0x167582;}})});}_0xc1de7=_[_0x7fcc('0x4c')]({},_0xc1de7,_0x430626[_0x7fcc('0x4e')]);var _0x39edfb={'where':_0xc1de7[_0x7fcc('0x4a')]};return db[_0x7fcc('0x3b')][_0x7fcc('0x2c')](_0x39edfb)[_0x7fcc('0x1f')](function(_0x38f93f){_0x2b970f['count']=_0x38f93f;if(_0x430626[_0x7fcc('0x3f')][_0x7fcc('0x4f')]){_0xc1de7[_0x7fcc('0x50')]=[{'all':!![]}];}return db[_0x7fcc('0x3b')][_0x7fcc('0x51')](_0xc1de7);})[_0x7fcc('0x1f')](function(_0x4035ed){_0x2b970f['rows']=_0x4035ed;return _0x2b970f;})[_0x7fcc('0x1f')](respondWithFilteredResult(_0x5f183f,_0xc1de7))[_0x7fcc('0x27')](handleError(_0x5f183f,null));};exports[_0x7fcc('0x52')]=function(_0x3e8f8c,_0x41d498){var _0x5ef29a={'raw':![],'where':{'id':_0x3e8f8c[_0x7fcc('0x53')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2750ce={};_0x2750ce[_0x7fcc('0x3e')]=_[_0x7fcc('0x40')](db[_0x7fcc('0x3b')][_0x7fcc('0x3c')]);_0x2750ce['query']=_[_0x7fcc('0x40')](_0x3e8f8c[_0x7fcc('0x3f')]);_0x2750ce[_0x7fcc('0x41')]=_[_0x7fcc('0x42')](_0x2750ce[_0x7fcc('0x3e')],_0x2750ce[_0x7fcc('0x3f')]);_0x5ef29a[_0x7fcc('0x43')]=_[_0x7fcc('0x42')](_0x2750ce['model'],qs[_0x7fcc('0x44')](_0x3e8f8c['query'][_0x7fcc('0x44')]));_0x5ef29a[_0x7fcc('0x43')]=_0x5ef29a['attributes'][_0x7fcc('0x45')]?_0x5ef29a[_0x7fcc('0x43')]:_0x2750ce[_0x7fcc('0x3e')];if(_0x3e8f8c[_0x7fcc('0x3f')][_0x7fcc('0x4f')]){_0x5ef29a[_0x7fcc('0x50')]=[{'all':!![]}];}_0x5ef29a=_[_0x7fcc('0x4c')]({},_0x5ef29a,_0x3e8f8c['options']);return db[_0x7fcc('0x3b')][_0x7fcc('0x54')](_0x5ef29a)[_0x7fcc('0x1f')](handleEntityNotFound(_0x41d498,null))[_0x7fcc('0x1f')](respondWithResult(_0x41d498,null))[_0x7fcc('0x27')](handleError(_0x41d498,null));};exports[_0x7fcc('0x55')]=function(_0x496e9e,_0x4fb4cf){return db[_0x7fcc('0x3b')]['create'](_0x496e9e[_0x7fcc('0x56')],{})[_0x7fcc('0x1f')](function(_0x54a8b6){var _0x11ea84=_0x496e9e['user'][_0x7fcc('0x57')]({'plain':!![]});if(!_0x11ea84)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11ea84[_0x7fcc('0x58')]===_0x7fcc('0x59')){var _0x5d32e0=_0x54a8b6[_0x7fcc('0x57')]({'plain':!![]});var _0x40a99a=_0x7fcc('0x5a');return db['UserProfileSection'][_0x7fcc('0x54')]({'where':{'name':_0x40a99a,'userProfileId':_0x11ea84[_0x7fcc('0x5b')]},'raw':!![]})[_0x7fcc('0x1f')](function(_0x4f5a0f){if(_0x4f5a0f&&_0x4f5a0f[_0x7fcc('0x5c')]===0x0){return db[_0x7fcc('0x35')][_0x7fcc('0x55')]({'name':_0x5d32e0[_0x7fcc('0x36')],'resourceId':_0x5d32e0['id'],'type':_0x4f5a0f['name'],'sectionId':_0x4f5a0f['id']},{})[_0x7fcc('0x1f')](function(){return _0x54a8b6;});}else{return _0x54a8b6;}})[_0x7fcc('0x27')](function(_0x1f2c55){logger[_0x7fcc('0x24')](_0x7fcc('0x5d'),_0x1f2c55);throw _0x1f2c55;});}return _0x54a8b6;})[_0x7fcc('0x1f')](respondWithResult(_0x4fb4cf,0xc9))['catch'](handleError(_0x4fb4cf,null));};exports[_0x7fcc('0x34')]=function(_0x423417,_0x13b12e){if(_0x423417[_0x7fcc('0x56')]['id']){delete _0x423417['body']['id'];}return db[_0x7fcc('0x3b')]['find']({'where':{'id':_0x423417[_0x7fcc('0x53')]['id']},'include':[{'model':db[_0x7fcc('0x38')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x13b12e,null))['then'](saveUpdates(_0x423417['body'],null))[_0x7fcc('0x1f')](respondWithResult(_0x13b12e,null))[_0x7fcc('0x27')](handleError(_0x13b12e,null));};exports[_0x7fcc('0x5e')]=function(_0x4eb60a,_0x3ea22e){return db[_0x7fcc('0x3b')][_0x7fcc('0x54')]({'where':{'id':_0x4eb60a[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x3ea22e,null))['then'](removeEntity(_0x3ea22e,null))['catch'](handleError(_0x3ea22e,null));};exports[_0x7fcc('0x5f')]=function(_0x511797,_0x4c5729){return db[_0x7fcc('0x3b')][_0x7fcc('0x5f')]()[_0x7fcc('0x1f')](respondWithResult(_0x4c5729,null))[_0x7fcc('0x27')](handleError(_0x4c5729,null));};exports['addDisposition']=function(_0x1505e5,_0x4530fe,_0x1e4cea){if(_0x1505e5[_0x7fcc('0x56')]['id']){delete _0x1505e5[_0x7fcc('0x56')]['id'];}return db[_0x7fcc('0x3b')][_0x7fcc('0x54')]({'where':{'id':_0x1505e5[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x4530fe,null))[_0x7fcc('0x1f')](function(_0x265350){if(_0x265350){_0x1505e5[_0x7fcc('0x56')][_0x7fcc('0x60')]=_0x265350['id'];return db[_0x7fcc('0x61')]['create'](_0x1505e5[_0x7fcc('0x56')]);}})[_0x7fcc('0x1f')](respondWithResult(_0x4530fe,null))[_0x7fcc('0x27')](handleError(_0x4530fe,null));};exports[_0x7fcc('0x62')]=function(_0x2360e2,_0x148df1,_0x552112){var _0x554bb2={'raw':![],'where':{}};var _0x348a4b={};var _0x31b7bb={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x2360e2[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x148df1,null))[_0x7fcc('0x1f')](function(_0x3e8c58){if(_0x3e8c58){_0x348a4b['model']=_[_0x7fcc('0x40')](db['Disposition']['rawAttributes']);_0x348a4b['query']=_['keys'](_0x2360e2[_0x7fcc('0x3f')]);_0x348a4b[_0x7fcc('0x41')]=_[_0x7fcc('0x42')](_0x348a4b[_0x7fcc('0x3e')],_0x348a4b['query']);_0x554bb2[_0x7fcc('0x43')]=_['intersection'](_0x348a4b[_0x7fcc('0x3e')],qs[_0x7fcc('0x44')](_0x2360e2[_0x7fcc('0x3f')][_0x7fcc('0x44')]));_0x554bb2[_0x7fcc('0x43')]=_0x554bb2[_0x7fcc('0x43')][_0x7fcc('0x45')]?_0x554bb2[_0x7fcc('0x43')]:_0x348a4b['model'];if(!_0x2360e2[_0x7fcc('0x3f')][_0x7fcc('0x46')](_0x7fcc('0x63'))){_0x554bb2[_0x7fcc('0x47')]=qs[_0x7fcc('0x47')](_0x2360e2[_0x7fcc('0x3f')][_0x7fcc('0x47')]);_0x554bb2['offset']=qs[_0x7fcc('0x2d')](_0x2360e2[_0x7fcc('0x3f')]['offset']);}_0x554bb2[_0x7fcc('0x48')]=qs[_0x7fcc('0x49')](_0x2360e2[_0x7fcc('0x3f')][_0x7fcc('0x49')]);_0x554bb2['where']=qs['filters'](_['pick'](_0x2360e2[_0x7fcc('0x3f')],_0x348a4b['filters']));_0x554bb2[_0x7fcc('0x4a')][_0x7fcc('0x60')]=_0x3e8c58['id'];if(_0x2360e2['query'][_0x7fcc('0x4b')]){_0x554bb2[_0x7fcc('0x4a')]=_['merge'](_0x554bb2[_0x7fcc('0x4a')],{'$or':_['map'](_0x554bb2[_0x7fcc('0x43')],function(_0x549073){var _0x17d643={};_0x17d643[_0x549073]={'$like':'%'+_0x2360e2[_0x7fcc('0x3f')][_0x7fcc('0x4b')]+'%'};return _0x17d643;})});}_0x554bb2=_[_0x7fcc('0x4c')]({},_0x554bb2,_0x2360e2['options']);return db[_0x7fcc('0x61')][_0x7fcc('0x2c')]({'where':_0x554bb2['where']})[_0x7fcc('0x1f')](function(_0x384c90){_0x31b7bb['count']=_0x384c90;if(_0x2360e2[_0x7fcc('0x3f')]['includeAll']){_0x554bb2['include']=[{'all':!![]}];}return db[_0x7fcc('0x61')][_0x7fcc('0x51')](_0x554bb2);})[_0x7fcc('0x1f')](function(_0x2fbae9){_0x31b7bb[_0x7fcc('0x64')]=_0x2fbae9;return _0x31b7bb;});}})[_0x7fcc('0x1f')](respondWithFilteredResult(_0x148df1,_0x554bb2))[_0x7fcc('0x27')](handleError(_0x148df1,null));};exports[_0x7fcc('0x65')]=function(_0x262ff5,_0x12eb26,_0x5a78e0){return db['SmsAccount']['find']({'where':{'id':_0x262ff5[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x12eb26,null))['then'](function(_0x5de723){if(_0x5de723){return _0x5de723[_0x7fcc('0x65')](_0x262ff5['query']['ids']);}})[_0x7fcc('0x1f')](respondWithStatusCode(_0x12eb26,null))[_0x7fcc('0x27')](handleError(_0x12eb26,null));};exports[_0x7fcc('0x66')]=function(_0x2041aa,_0x1b848f,_0x3a31b8){if(_0x2041aa[_0x7fcc('0x56')]['id']){delete _0x2041aa[_0x7fcc('0x56')]['id'];}return db[_0x7fcc('0x3b')][_0x7fcc('0x54')]({'where':{'id':_0x2041aa[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x1b848f,null))['then'](function(_0x5878c3){if(_0x5878c3){_0x2041aa[_0x7fcc('0x56')][_0x7fcc('0x60')]=_0x5878c3['id'];return db['CannedAnswer'][_0x7fcc('0x55')](_0x2041aa['body']);}})['then'](respondWithResult(_0x1b848f,null))[_0x7fcc('0x27')](handleError(_0x1b848f,null));};exports[_0x7fcc('0x67')]=function(_0x298e99,_0x472b71,_0x4996f4){var _0x1015e8={'raw':![],'where':{}};var _0xf58954={};var _0x20c0bd={'count':0x0,'rows':[]};return db[_0x7fcc('0x3b')][_0x7fcc('0x68')]({'where':{'id':_0x298e99[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x472b71,null))[_0x7fcc('0x1f')](function(_0x9855d2){if(_0x9855d2){_0xf58954['model']=_[_0x7fcc('0x40')](db[_0x7fcc('0x69')][_0x7fcc('0x3c')]);_0xf58954[_0x7fcc('0x3f')]=_[_0x7fcc('0x40')](_0x298e99[_0x7fcc('0x3f')]);_0xf58954[_0x7fcc('0x41')]=_['intersection'](_0xf58954['model'],_0xf58954[_0x7fcc('0x3f')]);_0x1015e8[_0x7fcc('0x43')]=_[_0x7fcc('0x42')](_0xf58954[_0x7fcc('0x3e')],qs['fields'](_0x298e99[_0x7fcc('0x3f')]['fields']));_0x1015e8[_0x7fcc('0x43')]=_0x1015e8[_0x7fcc('0x43')][_0x7fcc('0x45')]?_0x1015e8[_0x7fcc('0x43')]:_0xf58954[_0x7fcc('0x3e')];if(!_0x298e99[_0x7fcc('0x3f')][_0x7fcc('0x46')]('nolimit')){_0x1015e8[_0x7fcc('0x47')]=qs[_0x7fcc('0x47')](_0x298e99[_0x7fcc('0x3f')][_0x7fcc('0x47')]);_0x1015e8[_0x7fcc('0x2d')]=qs['offset'](_0x298e99[_0x7fcc('0x3f')][_0x7fcc('0x2d')]);}_0x1015e8[_0x7fcc('0x48')]=qs['sort'](_0x298e99[_0x7fcc('0x3f')][_0x7fcc('0x49')]);_0x1015e8['where']=qs[_0x7fcc('0x41')](_[_0x7fcc('0x6a')](_0x298e99[_0x7fcc('0x3f')],_0xf58954[_0x7fcc('0x41')]));_0x1015e8[_0x7fcc('0x4a')][_0x7fcc('0x60')]=_0x9855d2['id'];if(_0x298e99['query'][_0x7fcc('0x4b')]){_0x1015e8['where']=_[_0x7fcc('0x4c')](_0x1015e8[_0x7fcc('0x4a')],{'$or':_[_0x7fcc('0x3a')](_0x1015e8['attributes'],function(_0x5f9f58){var _0x4ca482={};_0x4ca482[_0x5f9f58]={'$like':'%'+_0x298e99[_0x7fcc('0x3f')][_0x7fcc('0x4b')]+'%'};return _0x4ca482;})});}_0x1015e8=_['merge']({},_0x1015e8,_0x298e99['options']);return db[_0x7fcc('0x69')]['count']({'where':_0x1015e8[_0x7fcc('0x4a')]})[_0x7fcc('0x1f')](function(_0x25a7c0){_0x20c0bd[_0x7fcc('0x2c')]=_0x25a7c0;if(_0x298e99[_0x7fcc('0x3f')]['includeAll']){_0x1015e8[_0x7fcc('0x50')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1015e8);})[_0x7fcc('0x1f')](function(_0x2f1b1e){_0x20c0bd['rows']=_0x2f1b1e;return _0x20c0bd;});}})[_0x7fcc('0x1f')](respondWithFilteredResult(_0x472b71,_0x1015e8))[_0x7fcc('0x27')](handleError(_0x472b71,null));};exports[_0x7fcc('0x6b')]=function(_0x57b116,_0x29cb33,_0xb0fdfa){return db['SmsAccount'][_0x7fcc('0x54')]({'where':{'id':_0x57b116[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x29cb33,null))[_0x7fcc('0x1f')](function(_0x5f3daa){if(_0x5f3daa){return _0x5f3daa['removeAnswers'](_0x57b116['query'][_0x7fcc('0x6c')]);}})[_0x7fcc('0x1f')](respondWithStatusCode(_0x29cb33,null))[_0x7fcc('0x27')](handleError(_0x29cb33,null));};exports[_0x7fcc('0x6d')]=function(_0x3a96ad,_0x21debf,_0xf95147){var _0x28d7a1={'channel':_0x7fcc('0x6e')};var _0x34f120=[];var _0x287805=[];var _0x2a58bf={};return db['SmsAccount'][_0x7fcc('0x54')]({'where':{'id':_0x3a96ad[_0x7fcc('0x53')]['id']},'include':[{'model':db[_0x7fcc('0x6f')],'as':_0x7fcc('0x70')}]})['then'](handleEntityNotFound(_0x21debf,null))[_0x7fcc('0x1f')](function(_0x35496e){_0x28d7a1[_0x7fcc('0x71')]=_0x35496e;_0x28d7a1['applications']=_[_0x7fcc('0x72')](_0x35496e[_0x7fcc('0x70')],[_0x7fcc('0x73')],[_0x7fcc('0x74')]);if(_0x28d7a1[_0x7fcc('0x71')]['Applications']){delete _0x28d7a1['account'][_0x7fcc('0x70')];}return db[_0x7fcc('0x75')][_0x7fcc('0x5f')]();})['then'](function(_0x1e2233){if(!_0x1e2233){throw new db[(_0x7fcc('0x76'))][(_0x7fcc('0x77'))](_0x7fcc('0x78'));}_0x34f120=_[_0x7fcc('0x79')](_[_0x7fcc('0x40')](_0x1e2233),[_0x7fcc('0x7a'),_0x7fcc('0x7b')]);_0x287805=_['difference'](_['keys'](_0x1e2233),[_0x7fcc('0x7a'),_0x7fcc('0x7b'),_0x7fcc('0x7c'),_0x7fcc('0x7d')]);_0x28d7a1['body']={'mapKey':_0x7fcc('0x7e')};if(_0x28d7a1[_0x7fcc('0x71')][_0x7fcc('0x3d')]){switch(_0x28d7a1[_0x7fcc('0x71')][_0x7fcc('0x3d')]){case _0x7fcc('0x7f'):_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x80')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x81')];_0x28d7a1['body'][_0x7fcc('0x56')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x82')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x83')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x84')];break;case'skebby':_0x28d7a1['body']['from']='+'+_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x85')];_0x28d7a1['body'][_0x7fcc('0x56')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x86')];break;case'connectel':_0x28d7a1['body']['from']=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x80')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x56')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x25')];break;case _0x7fcc('0x87'):_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x80')]=_0x3a96ad['body'][_0x7fcc('0x80')];_0x28d7a1['body'][_0x7fcc('0x56')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x56')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x83')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x88')];break;case'plivo':_0x28d7a1['body'][_0x7fcc('0x80')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x81')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x56')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x89')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x83')]=_0x3a96ad['body'][_0x7fcc('0x8a')];break;case _0x7fcc('0x8b'):_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x80')]='+'+_0x3a96ad[_0x7fcc('0x56')]['results'][0x0][_0x7fcc('0x80')];_0x28d7a1[_0x7fcc('0x56')]['body']=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x8c')][0x0][_0x7fcc('0x86')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x83')]=_0x3a96ad['body'][_0x7fcc('0x8c')][0x0][_0x7fcc('0x83')];break;case _0x7fcc('0x8d'):_0x28d7a1['body']['from']=_0x3a96ad[_0x7fcc('0x56')]['originatingAddress'];_0x28d7a1['body']['body']=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x8e')][_0x7fcc('0x25')];break;case'clickatell':_0x28d7a1[_0x7fcc('0x56')]['from']=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x8f')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x56')]=_0x3a96ad['body']['text'];_0x28d7a1['body'][_0x7fcc('0x83')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x90')];break;case _0x7fcc('0x91'):_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x83')]=_0x3a96ad[_0x7fcc('0x56')][0x0][_0x7fcc('0x25')]['id'];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x80')]=_0x3a96ad[_0x7fcc('0x56')][0x0]['message'][_0x7fcc('0x80')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x56')]=_0x3a96ad[_0x7fcc('0x56')][0x0][_0x7fcc('0x25')][_0x7fcc('0x86')];break;case'intelepeer':_0x28d7a1['body'][_0x7fcc('0x80')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x80')];_0x28d7a1['body'][_0x7fcc('0x56')]=_0x3a96ad[_0x7fcc('0x56')][_0x7fcc('0x25')];_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x83')]=_0x3a96ad[_0x7fcc('0x56')]['refid'];break;}}if(_0x28d7a1[_0x7fcc('0x56')]['id']){delete _0x28d7a1[_0x7fcc('0x56')]['id'];}if(_[_0x7fcc('0x92')](_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x80')])){throw new db[(_0x7fcc('0x76'))][(_0x7fcc('0x77'))](_0x7fcc('0x93'));}if(_['isNil'](_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x56')])||_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x56')]===''){throw new db[(_0x7fcc('0x76'))][(_0x7fcc('0x77'))](_0x7fcc('0x94'));}if(_['isNil'](_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x95')])){throw new db['Sequelize'][(_0x7fcc('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x287805);}if(!_[_0x7fcc('0x96')](_0x287805,_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x95')])){throw new db['Sequelize'][(_0x7fcc('0x77'))](_0x7fcc('0x97')+_0x287805);}_0x2a58bf[_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x95')]]=_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x80')];return db[_0x7fcc('0x98')][_0x7fcc('0x54')]({'where':{'id':_0x28d7a1[_0x7fcc('0x71')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x7fcc('0x99'),'where':_0x2a58bf,'limit':0x1,'order':[[_0x7fcc('0x7b'),_0x7fcc('0x9a')]]}]});})[_0x7fcc('0x1f')](handleEntityNotFound(_0x21debf,null))[_0x7fcc('0x1f')](function(_0x241728){if(_0x241728){_0x28d7a1[_0x7fcc('0x9b')]=_[_0x7fcc('0x9c')](_0x241728,['Contacts']);if(_0x241728['Contacts'][_0x7fcc('0x45')]){return _0x241728[_0x7fcc('0x99')][0x0];}var _0x21291e=_['defaults'](_0x28d7a1['body'],{'firstName':_0x28d7a1['body'][_0x7fcc('0x80')],'ListId':_0x241728['id']});_0x21291e[_0x28d7a1[_0x7fcc('0x56')]['mapKey']]=_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x80')];return db[_0x7fcc('0x75')][_0x7fcc('0x55')](_0x21291e,{'fields':_0x34f120,'raw':!![]});}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x21debf,null))[_0x7fcc('0x1f')](function(_0x5e32b8){if(_0x5e32b8){_0x28d7a1[_0x7fcc('0x9d')]=_0x5e32b8;var _0x54a097={'ContactId':_0x5e32b8['id'],'phone':_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x80')],'SmsAccountId':_0x3a96ad[_0x7fcc('0x53')]['id']};var _0x26ee27={'ContactId':_0x5e32b8['id'],'SmsAccountId':_0x3a96ad[_0x7fcc('0x53')]['id'],'closed':![]};return db[_0x7fcc('0x9e')][_0x7fcc('0x54')]({'where':_0x26ee27})[_0x7fcc('0x1f')](function(_0xe8452d){if(_0xe8452d){return[_0xe8452d,![]];}return db['SmsInteraction'][_0x7fcc('0x55')](_0x54a097)[_0x7fcc('0x1f')](function(_0x4bedcd){return[_0x4bedcd,!![]];});});}})[_0x7fcc('0x9f')](function(_0x9d0e8e,_0x8b1fae){_0x28d7a1[_0x7fcc('0xa0')]=_0x9d0e8e['get']({'plain':!![]});_0x28d7a1[_0x7fcc('0xa0')][_0x7fcc('0xa1')]=![];if(_0x8b1fae){if(_0x28d7a1['account'][_0x7fcc('0xa2')]){_0x28d7a1[_0x7fcc('0xa3')][_0x7fcc('0xa4')]({'id':0x0,'priority':_0x28d7a1[_0x7fcc('0xa3')][_0x7fcc('0x45')]+0x1,'app':_0x7fcc('0xa5'),'appdata':_0x7fcc('0xa6'),'interval':_0x7fcc('0xa7')});}_0x28d7a1[_0x7fcc('0xa0')][_0x7fcc('0xa1')]=!![];}return db[_0x7fcc('0xa8')]['create']({'phone':_0x28d7a1['body'][_0x7fcc('0x80')],'messageId':_0x28d7a1['body'][_0x7fcc('0x83')],'body':_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0x56')],'SmsAccountId':_0x3a96ad[_0x7fcc('0x53')]['id'],'SmsInteractionId':_0x9d0e8e['id'],'direction':'in','ContactId':_0x9d0e8e[_0x7fcc('0xa9')],'AttachmentId':_0x28d7a1[_0x7fcc('0x56')][_0x7fcc('0xaa')]});})['then'](function(_0x1020a5){_0x28d7a1[_0x7fcc('0x25')]=_0x1020a5;if(_0x28d7a1[_0x7fcc('0xa0')][_0x7fcc('0xab')]){return db[_0x7fcc('0xac')][_0x7fcc('0x54')]({'attributes':['id',_0x7fcc('0x36')],'where':{'id':_0x28d7a1[_0x7fcc('0xa0')][_0x7fcc('0xab')]}})[_0x7fcc('0x1f')](function(_0x406fd5){if(_0x406fd5){_0x28d7a1['applications'][_0x7fcc('0xad')]({'id':0x0,'priority':0x0,'app':_0x7fcc('0xae'),'appdata':_0x406fd5[_0x7fcc('0x36')]+','+(_0x28d7a1[_0x7fcc('0x71')][_0x7fcc('0xaf')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7fcc('0xb0'),_0x7fcc('0xb1'),_0x28d7a1);});}return respondWithRpcPromise(_0x7fcc('0xb0'),'startRouting',_0x28d7a1);})[_0x7fcc('0x1f')](function(_0x420001){if(_0x420001){var _0x1fb954=0xc8;var _0x4460e1=_0x7fcc('0xb2');logger[_0x7fcc('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4460e1,_0x1fb954,'entity\x20found');logger['debug'](_0x7fcc('0xb3'),_0x4460e1,_0x1fb954,_0x7fcc('0xb4'),JSON[_0x7fcc('0x23')](_0x420001));if(_0x28d7a1[_0x7fcc('0x71')][_0x7fcc('0x3d')]===_0x7fcc('0x7f')){return _0x21debf[_0x7fcc('0x2e')](_0x1fb954)['set'](_0x7fcc('0xb5'),_0x7fcc('0xb6'))['send']('\x0a');}else{return _0x21debf['status'](_0x1fb954)['json'](_0x420001);}}})['catch'](handleError(_0x21debf,null));};exports[_0x7fcc('0xb7')]=function(_0x294dca,_0x383731,_0x1b75b2){return db['SmsAccount'][_0x7fcc('0x68')]({'where':{'id':_0x294dca['params']['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x383731,null))['then'](function(_0x230194){if(_0x230194){return db['sequelize']['transaction'](function(_0x448871){return db[_0x7fcc('0x6f')]['destroy']({'where':{'SmsAccountId':_0x294dca[_0x7fcc('0x53')]['id']},'transaction':_0x448871})[_0x7fcc('0x1f')](function(_0x30618f){var _0x1ab44f=_[_0x7fcc('0x3a')](_0x294dca['body'],function(_0x444100){_0x444100['SmsAccountId']=_0x294dca['params']['id'];return _0x444100;});return db[_0x7fcc('0x6f')][_0x7fcc('0xb8')](_0x1ab44f,{'transaction':_0x448871});});})[_0x7fcc('0x1f')](function(){return db[_0x7fcc('0x6f')][_0x7fcc('0xb9')]({'where':{'SmsAccountId':_0x294dca[_0x7fcc('0x53')]['id']},'order':_0x7fcc('0x73')});});}})['then'](respondWithResult(_0x383731,null))[_0x7fcc('0x27')](handleError(_0x383731,null));};exports['getApplications']=function(_0x2d9ff6,_0x24efc0,_0x25eb96){var _0x27e196={};var _0x33340f={};var _0x27e42f;var _0x112e49;return db['SmsAccount'][_0x7fcc('0x68')]({'where':{'id':_0x2d9ff6[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x24efc0,null))[_0x7fcc('0x1f')](function(_0x208ec0){if(_0x208ec0){_0x27e42f=_0x208ec0;_0x33340f[_0x7fcc('0x3e')]=_[_0x7fcc('0x40')](db['SmsApplication'][_0x7fcc('0x3c')]);_0x33340f[_0x7fcc('0x3f')]=_['keys'](_0x2d9ff6[_0x7fcc('0x3f')]);_0x33340f[_0x7fcc('0x41')]=_[_0x7fcc('0x42')](_0x33340f[_0x7fcc('0x3e')],_0x33340f[_0x7fcc('0x3f')]);_0x27e196[_0x7fcc('0x43')]=_[_0x7fcc('0x42')](_0x33340f['model'],qs[_0x7fcc('0x44')](_0x2d9ff6[_0x7fcc('0x3f')][_0x7fcc('0x44')]));_0x27e196['attributes']=_0x27e196[_0x7fcc('0x43')][_0x7fcc('0x45')]?_0x27e196['attributes']:_0x33340f[_0x7fcc('0x3e')];_0x27e196[_0x7fcc('0x48')]=qs[_0x7fcc('0x49')](_0x2d9ff6[_0x7fcc('0x3f')]['sort']);_0x27e196[_0x7fcc('0x4a')]=qs[_0x7fcc('0x41')](_[_0x7fcc('0x6a')](_0x2d9ff6[_0x7fcc('0x3f')],_0x33340f[_0x7fcc('0x41')]));if(_0x2d9ff6[_0x7fcc('0x3f')]['filter']){_0x27e196[_0x7fcc('0x4a')]=_[_0x7fcc('0x4c')](_0x27e196['where'],{'$or':_['map'](_0x27e196['attributes'],function(_0x1daa4d){var _0x4c0763={};_0x4c0763[_0x1daa4d]={'$like':'%'+_0x2d9ff6[_0x7fcc('0x3f')][_0x7fcc('0x4b')]+'%'};return _0x4c0763;})});}_0x27e196=_[_0x7fcc('0x4c')]({},_0x27e196,_0x2d9ff6[_0x7fcc('0x4e')]);return _0x27e42f[_0x7fcc('0xba')](_0x27e196);}})[_0x7fcc('0x1f')](function(_0x6ebd18){if(_0x6ebd18){_0x112e49=_0x6ebd18[_0x7fcc('0x45')];if(!_0x2d9ff6[_0x7fcc('0x3f')][_0x7fcc('0x46')](_0x7fcc('0x63'))){_0x27e196[_0x7fcc('0x47')]=qs['limit'](_0x2d9ff6[_0x7fcc('0x3f')]['limit']);_0x27e196[_0x7fcc('0x2d')]=qs[_0x7fcc('0x2d')](_0x2d9ff6['query'][_0x7fcc('0x2d')]);}return _0x27e42f[_0x7fcc('0xba')](_0x27e196);}})[_0x7fcc('0x1f')](function(_0x43849c){if(_0x43849c){return _0x43849c?{'count':_0x112e49,'rows':_0x43849c}:null;}})[_0x7fcc('0x1f')](respondWithResult(_0x24efc0,null))['catch'](handleError(_0x24efc0,null));};exports[_0x7fcc('0xbb')]=function(_0x435553,_0x414675,_0x25ebc8){var _0x45083e={'raw':![],'where':{}};var _0x33de54={};var _0x22b980={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x435553[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x414675,null))[_0x7fcc('0x1f')](function(_0x46e5db){if(_0x46e5db){_0x33de54[_0x7fcc('0x3e')]=_['keys'](db[_0x7fcc('0x9e')][_0x7fcc('0x3c')]);_0x33de54[_0x7fcc('0x3f')]=_[_0x7fcc('0x40')](_0x435553['query']);_0x33de54[_0x7fcc('0x41')]=_[_0x7fcc('0x42')](_0x33de54[_0x7fcc('0x3e')],_0x33de54['query']);_0x45083e[_0x7fcc('0x43')]=_[_0x7fcc('0x42')](_0x33de54['model'],qs[_0x7fcc('0x44')](_0x435553['query'][_0x7fcc('0x44')]));_0x45083e['attributes']=_0x45083e[_0x7fcc('0x43')][_0x7fcc('0x45')]?_0x45083e[_0x7fcc('0x43')]:_0x33de54[_0x7fcc('0x3e')];if(!_0x435553[_0x7fcc('0x3f')][_0x7fcc('0x46')](_0x7fcc('0x63'))){_0x45083e[_0x7fcc('0x47')]=qs[_0x7fcc('0x47')](_0x435553['query'][_0x7fcc('0x47')]);_0x45083e[_0x7fcc('0x2d')]=qs[_0x7fcc('0x2d')](_0x435553[_0x7fcc('0x3f')]['offset']);}_0x45083e[_0x7fcc('0x48')]=qs['sort'](_0x435553[_0x7fcc('0x3f')][_0x7fcc('0x49')]);_0x45083e[_0x7fcc('0x4a')]=qs[_0x7fcc('0x41')](_[_0x7fcc('0x6a')](_0x435553[_0x7fcc('0x3f')],_0x33de54[_0x7fcc('0x41')]));_0x45083e[_0x7fcc('0x4a')]['SmsAccountId']=_0x46e5db['id'];if(_0x435553[_0x7fcc('0x3f')][_0x7fcc('0x4b')]){_0x45083e[_0x7fcc('0x4a')]=_['merge'](_0x45083e['where'],{'$or':_[_0x7fcc('0x3a')](_0x45083e[_0x7fcc('0x43')],function(_0x2d9ec1){var _0x54ad0d={};_0x54ad0d[_0x2d9ec1]={'$like':'%'+_0x435553[_0x7fcc('0x3f')][_0x7fcc('0x4b')]+'%'};return _0x54ad0d;})});}_0x45083e=_[_0x7fcc('0x4c')]({},_0x45083e,_0x435553[_0x7fcc('0x4e')]);return db[_0x7fcc('0x9e')][_0x7fcc('0x2c')]({'where':_0x45083e[_0x7fcc('0x4a')]})['then'](function(_0x31025d){_0x22b980[_0x7fcc('0x2c')]=_0x31025d;if(_0x435553[_0x7fcc('0x3f')][_0x7fcc('0x4f')]){_0x45083e[_0x7fcc('0x50')]=[{'model':db[_0x7fcc('0x75')],'as':_0x7fcc('0xbc'),'required':![]},{'model':db[_0x7fcc('0xac')],'as':'Owner','attributes':[_0x7fcc('0x36'),_0x7fcc('0xbd'),'internal'],'required':![]},{'model':db[_0x7fcc('0xbe')],'as':_0x7fcc('0xbf'),'attributes':['id',_0x7fcc('0x36'),_0x7fcc('0xc0')],'where':_0x435553[_0x7fcc('0x3f')][_0x7fcc('0xc1')]?{'id':_0x435553[_0x7fcc('0x3f')][_0x7fcc('0xc1')]}:undefined,'required':_0x435553['query'][_0x7fcc('0xc1')]?!![]:![]}];}return db['SmsInteraction'][_0x7fcc('0x51')](_0x45083e);})[_0x7fcc('0x1f')](function(_0x1be37d){_0x22b980[_0x7fcc('0x64')]=_0x1be37d;return _0x22b980;});}})[_0x7fcc('0x1f')](respondWithFilteredResult(_0x414675,_0x45083e))[_0x7fcc('0x27')](handleError(_0x414675,null));};exports[_0x7fcc('0x37')]=function(_0x5de8be,_0xa3a65e,_0x5325eb){var _0x2052de,_0x1d3727,_0x25b678;if(_['isNil'](_0x5de8be[_0x7fcc('0x56')][_0x7fcc('0x56')])||_0x5de8be[_0x7fcc('0x56')][_0x7fcc('0x56')]===''){throw new db[(_0x7fcc('0x76'))][(_0x7fcc('0x77'))](_0x7fcc('0x94'));}if(_['isNil'](_0x5de8be[_0x7fcc('0x56')]['to'])){throw new db[(_0x7fcc('0x76'))][(_0x7fcc('0x77'))]('to\x20is\x20mandatory');}_0x2052de=_0x5de8be['body']['to'];return db[_0x7fcc('0x3b')][_0x7fcc('0x54')]({'where':{'id':_0x5de8be['params']['id']},'include':[{'model':db['CmList'],'as':_0x7fcc('0xc2'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x2052de},'limit':0x1,'order':[['updatedAt',_0x7fcc('0x9a')]]}]}]})[_0x7fcc('0x1f')](handleEntityNotFound(_0xa3a65e,null))['then'](function(_0x48a40c){if(_0x48a40c&&_0x48a40c[_0x7fcc('0xc2')]){_0x1d3727=_0x48a40c[_0x7fcc('0x57')]({'plain':!![]});if(_0x1d3727['List']&&_0x1d3727[_0x7fcc('0xc2')]['Contacts']['length']){return _0x1d3727[_0x7fcc('0xc2')][_0x7fcc('0x99')][0x0];}return db[_0x7fcc('0x75')][_0x7fcc('0x55')](_[_0x7fcc('0x18')](_0x5de8be['body'],{'firstName':_0x2052de,'mobile':_0x2052de,'phone':_0x2052de,'ListId':_0x1d3727['ListId']}));}})['then'](handleEntityNotFound(_0xa3a65e,null))[_0x7fcc('0x1f')](function(_0xc652c7){if(_0xc652c7){_0x25b678=_0xc652c7;return db['SmsInteraction'][_0x7fcc('0x54')]({'where':{'ContactId':_0x25b678['id'],'closed':![],'SmsAccountId':_0x1d3727['id']}})['then'](function(_0x4a6e65){if(_0x4a6e65){return[_0x4a6e65,![]];}return db[_0x7fcc('0x9e')][_0x7fcc('0x55')]({'UserId':_0x5de8be[_0x7fcc('0x59')]['id'],'ContactId':_0x25b678['id'],'SmsAccountId':_0x1d3727['id'],'phone':_0x2052de,'firstMsgDirection':'out','Messages':[_['merge'](_0x5de8be[_0x7fcc('0x56')],{'read':![],'body':_0x5de8be[_0x7fcc('0x56')][_0x7fcc('0x56')],'phone':_0x2052de,'SmsAccountId':_0x1d3727['id'],'UserId':_0x5de8be[_0x7fcc('0x59')]['id'],'ContactId':_0x25b678['id']})]},{'include':[{'model':db[_0x7fcc('0xa8')],'as':_0x7fcc('0xc3')}]})[_0x7fcc('0x1f')](function(_0x17a73a){return[_0x17a73a,!![]];});});}})[_0x7fcc('0x9f')](function(_0x56be84,_0x2a4fc4){if(_0x2a4fc4){return _0x56be84;}return db[_0x7fcc('0xa8')]['create'](_[_0x7fcc('0x4c')](_0x5de8be[_0x7fcc('0x56')],{'read':![],'body':_0x5de8be[_0x7fcc('0x56')][_0x7fcc('0x56')],'phone':_0x2052de,'SmsAccountId':_0x1d3727['id'],'SmsInteractionId':_0x56be84['id'],'UserId':_0x5de8be[_0x7fcc('0x59')]['id'],'ContactId':_0x25b678['id']}))[_0x7fcc('0x1f')](function(_0x1b0cff){_0x56be84[_0x7fcc('0xc4')]['Messages']=[];_0x56be84['dataValues'][_0x7fcc('0xc3')][_0x7fcc('0xa4')](_0x1b0cff[_0x7fcc('0xc4')]);return _0x56be84;});})[_0x7fcc('0x1f')](respondWithResult(_0xa3a65e,null))[_0x7fcc('0x27')](handleError(_0xa3a65e,null));};exports[_0x7fcc('0x2e')]=function(_0x3fbc20,_0x3bc903,_0xb54074){if(_0x3fbc20[_0x7fcc('0x56')]['id']){delete _0x3fbc20[_0x7fcc('0x56')]['id'];}var _0x182a56,_0x416633,_0x5a470a;return db[_0x7fcc('0x3b')][_0x7fcc('0x54')]({'where':{'id':_0x3fbc20['params']['id']}})['then'](handleEntityNotFound(_0x3bc903,null))['then'](function(_0x17404f){if(_0x17404f){_0x5a470a=_0x17404f;logger['debug'](_0x7fcc('0xc5'),_0x7fcc('0x2e'),_0x7fcc('0xc6'),_0x17404f[_0x7fcc('0x3d')],util[_0x7fcc('0xc7')](_0x3fbc20[_0x7fcc('0x56')],{'showHidden':![],'depth':null}));switch(_0x17404f[_0x7fcc('0x3d')]){case _0x7fcc('0xc8'):if(_0x3fbc20[_0x7fcc('0x56')]['skebby_dispatch_id']&&_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0x2e')]){_0x416633=_0x3fbc20['body']['status'];return db[_0x7fcc('0xa8')]['find']({'where':{'messageId':_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0xc9')]}});}break;case _0x7fcc('0xca'):if(_0x3fbc20[_0x7fcc('0x56')]['requestid']&&_0x3fbc20[_0x7fcc('0x56')]['statusInt']){_0x416633=_0x3fbc20['body']['statusInt'];return db[_0x7fcc('0xa8')][_0x7fcc('0x54')]({'where':{'messageId':_0x3fbc20['body']['requestid']}});}break;case'clicksend':if(_0x3fbc20['body'][_0x7fcc('0x88')]&&_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0xcb')]){_0x416633=_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0xcb')];return db['SmsMessage']['find']({'where':{'messageId':_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0x88')]}});}break;case _0x7fcc('0x8b'):var _0xda140f=_0x3fbc20['body']['results'][0x0];if(_0xda140f['messageId']&&_0xda140f['status'][_0x7fcc('0xcc')]===_0x7fcc('0xcd')){_0x416633=_0xda140f[_0x7fcc('0x2e')][_0x7fcc('0xcc')];return db['SmsMessage'][_0x7fcc('0x54')]({'where':{'messageId':_0xda140f['messageId']}});}break;case _0x7fcc('0xce'):if(_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0x83')]&&_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0x2e')]){_0x416633=_0x3fbc20[_0x7fcc('0x56')]['status'];return db[_0x7fcc('0xa8')]['find']({'where':{'messageId':_0x3fbc20['body'][_0x7fcc('0x83')]}});}break;case _0x7fcc('0x91'):if(_0x3fbc20[_0x7fcc('0x56')][0x0][_0x7fcc('0x25')]['id']){_0x416633=_0x3fbc20[_0x7fcc('0x56')][0x0][_0x7fcc('0x3d')];return db[_0x7fcc('0xa8')]['find']({'where':{'messageId':_0x3fbc20[_0x7fcc('0x56')][0x0][_0x7fcc('0x25')]['id']}});}break;case'intelepeer':if(_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0xcf')]&&_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0x2e')]){_0x416633=_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0x2e')];return db['SmsMessage'][_0x7fcc('0x54')]({'where':{'messageId':_0x3fbc20['body'][_0x7fcc('0xcf')]}});}break;}}})['then'](handleEntityNotFound(_0x3bc903,null))[_0x7fcc('0x1f')](function(_0x562826){if(_0x562826){_0x182a56=_0x562826;switch(_0x5a470a[_0x7fcc('0x3d')]){case _0x7fcc('0xc8'):if(_0x416633==='DELIVERED'){return _0x182a56[_0x7fcc('0x34')]({'read':!![]});}else{logger[_0x7fcc('0x24')](_0x7fcc('0xc5'),_0x7fcc('0x2e'),_0x7fcc('0xc8'),util[_0x7fcc('0xc7')](_0x3fbc20[_0x7fcc('0x56')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x416633==='1'){return _0x182a56[_0x7fcc('0x34')]({'read':!![]});}else{logger[_0x7fcc('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7fcc('0x2e'),_0x7fcc('0xc8'),util[_0x7fcc('0xc7')](_0x3fbc20['body'],{'showHidden':![],'depth':null}));}break;case _0x7fcc('0x87'):if(!_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0xd0')]&&_0x416633>=0xc8&&_0x416633<=0xce){return _0x182a56[_0x7fcc('0x34')]({'read':!![]});}else{logger[_0x7fcc('0x24')](_0x7fcc('0xc5'),_0x7fcc('0x2e'),_0x7fcc('0x87'),util[_0x7fcc('0xc7')](_0x3fbc20['body'],{'showHidden':![],'depth':null}));}break;case _0x7fcc('0x8b'):var _0xbcfaf9=_0x3fbc20[_0x7fcc('0x56')][_0x7fcc('0x8c')][0x0];if(_0xbcfaf9[_0x7fcc('0x2e')][_0x7fcc('0xcc')]===_0x7fcc('0xcd')){return _0x182a56[_0x7fcc('0x34')]({'read':!![]});}else{logger['error'](_0x7fcc('0xc5'),_0x7fcc('0x2e'),_0x7fcc('0x8b'),util[_0x7fcc('0xc7')](_0x3fbc20[_0x7fcc('0x56')],{'showHidden':![],'depth':null}));}break;case _0x7fcc('0xce'):if(_0x416633=='DELIVERED_TO_GATEWAY'||_0x416633=='RECEIVED_BY_RECIPIENT'){return _0x182a56[_0x7fcc('0x34')]({'read':!![]});}else{logger[_0x7fcc('0x24')](_0x7fcc('0xc5'),_0x7fcc('0x2e'),_0x7fcc('0xce'),util['inspect'](_0x3fbc20[_0x7fcc('0x56')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x416633=='message-delivered'){return _0x182a56[_0x7fcc('0x34')]({'read':!![]});}else{logger[_0x7fcc('0x24')](_0x7fcc('0xc5'),_0x7fcc('0x2e'),_0x7fcc('0x91'),util[_0x7fcc('0xc7')](_0x3fbc20[_0x7fcc('0x56')],{'showHidden':![],'depth':null}));}break;case _0x7fcc('0xd1'):if(_0x416633===_0x7fcc('0xd2')||_0x416633===_0x7fcc('0xd3')){return _0x182a56['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7fcc('0x2e'),_0x7fcc('0xd1'),util[_0x7fcc('0xc7')](_0x3fbc20[_0x7fcc('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x182a56;}})['then'](respondWithResult(_0x3bc903,null))[_0x7fcc('0x27')](handleError(_0x3bc903,null));};exports[_0x7fcc('0xd4')]=function(_0xd234c0,_0x582b87,_0x52e004){var _0x2de87c,_0x2efa57,_0x4f9f1a;return db['SmsAccount']['find']({'where':{'id':_0xd234c0['params']['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x582b87,null))[_0x7fcc('0x1f')](function(_0x44ced5){if(_0x44ced5){_0x4f9f1a=_0x44ced5;logger[_0x7fcc('0xd5')](_0x7fcc('0xc5'),_0x7fcc('0x2e'),_0x7fcc('0xc6'),_0x44ced5[_0x7fcc('0x3d')],util[_0x7fcc('0xc7')](_0xd234c0[_0x7fcc('0x3f')],{'showHidden':![],'depth':null}));switch(_0x44ced5['type']){case'csc':if(_0xd234c0[_0x7fcc('0x3f')][_0x7fcc('0xd6')]&&_0xd234c0['query'][_0x7fcc('0xd7')]){_0x2efa57=_0xd234c0[_0x7fcc('0x3f')][_0x7fcc('0xd7')];return db[_0x7fcc('0xa8')][_0x7fcc('0x54')]({'where':{'messageId':_0xd234c0[_0x7fcc('0x3f')][_0x7fcc('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x582b87,null))[_0x7fcc('0x1f')](function(_0x5670ca){if(_0x5670ca){_0x2de87c=_0x5670ca;switch(_0x4f9f1a[_0x7fcc('0x3d')]){case _0x7fcc('0x8d'):if(_0x2efa57==='2'||_0x2efa57==='6'){return _0x2de87c[_0x7fcc('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7fcc('0x2e'),_0x7fcc('0x8d'),util['inspect'](_0xd234c0[_0x7fcc('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x2de87c;}})[_0x7fcc('0x1f')](respondWithResult(_0x582b87,null))['catch'](handleError(_0x582b87,null));};exports['addAgents']=function(_0x38469a,_0x246227,_0x55dada){return db[_0x7fcc('0x3b')]['find']({'where':{'id':_0x38469a['params']['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x246227,null))['then'](function(_0x19e9eb){if(_0x19e9eb){return _0x19e9eb['addAgents'](_0x38469a[_0x7fcc('0x56')][_0x7fcc('0x6c')],_['omit'](_0x38469a[_0x7fcc('0x56')],['ids','id'])||{})[_0x7fcc('0x9f')](function(_0x557aba){for(var _0x335ae1=0x0;_0x335ae1<_0x38469a[_0x7fcc('0x56')][_0x7fcc('0x6c')][_0x7fcc('0x45')];_0x335ae1+=0x1){socket[_0x7fcc('0xd8')](_0x7fcc('0xd9'),{'UserId':_0x38469a['body'][_0x7fcc('0x6c')][_0x335ae1],'SmsAccountId':_0x38469a[_0x7fcc('0x53')]['id']});}return _0x557aba;});}})[_0x7fcc('0x1f')](respondWithResult(_0x246227,null))[_0x7fcc('0x27')](handleError(_0x246227,null));};exports[_0x7fcc('0xda')]=function(_0x1021ca,_0x3dfc2e,_0x1c1276){return db['SmsAccount']['find']({'where':{'id':_0x1021ca['params']['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x3dfc2e,null))[_0x7fcc('0x1f')](function(_0x1cbbd8){if(_0x1cbbd8){return _0x1cbbd8[_0x7fcc('0xda')](_0x1021ca[_0x7fcc('0x3f')]['ids'])['then'](function(){if(_[_0x7fcc('0xdb')](_0x1021ca[_0x7fcc('0x3f')]['ids'])){for(var _0x2c0875=0x0;_0x2c0875<_0x1021ca[_0x7fcc('0x3f')][_0x7fcc('0x6c')]['length'];_0x2c0875+=0x1){socket['emit'](_0x7fcc('0xdc'),{'UserId':Number(_0x1021ca[_0x7fcc('0x3f')][_0x7fcc('0x6c')][_0x2c0875]),'SmsAccountId':Number(_0x1021ca['params']['id'])});}}else{socket[_0x7fcc('0xd8')](_0x7fcc('0xdc'),{'UserId':Number(_0x1021ca[_0x7fcc('0x3f')][_0x7fcc('0x6c')]),'SmsAccountId':Number(_0x1021ca[_0x7fcc('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x3dfc2e,null))['catch'](handleError(_0x3dfc2e,null));};exports['getAgents']=function(_0x3dd21e,_0x52d10c,_0x10dfdc){var _0x683f87={};var _0xde303f={};var _0x30da97;var _0xde1147;return db[_0x7fcc('0x3b')][_0x7fcc('0x68')]({'where':{'id':_0x3dd21e[_0x7fcc('0x53')]['id']}})[_0x7fcc('0x1f')](handleEntityNotFound(_0x52d10c,null))[_0x7fcc('0x1f')](function(_0xf14698){if(_0xf14698){_0x30da97=_0xf14698;_0xde303f[_0x7fcc('0x3e')]=_[_0x7fcc('0x40')](db['User']['rawAttributes']);_0xde303f[_0x7fcc('0x3f')]=_['keys'](_0x3dd21e['query']);_0xde303f['filters']=_[_0x7fcc('0x42')](_0xde303f[_0x7fcc('0x3e')],_0xde303f['query']);_0x683f87[_0x7fcc('0x43')]=_[_0x7fcc('0x42')](_0xde303f[_0x7fcc('0x3e')],qs[_0x7fcc('0x44')](_0x3dd21e[_0x7fcc('0x3f')][_0x7fcc('0x44')]));_0x683f87[_0x7fcc('0x43')]=_0x683f87[_0x7fcc('0x43')][_0x7fcc('0x45')]?_0x683f87[_0x7fcc('0x43')]:_0xde303f[_0x7fcc('0x3e')];_0x683f87[_0x7fcc('0x48')]=qs[_0x7fcc('0x49')](_0x3dd21e[_0x7fcc('0x3f')][_0x7fcc('0x49')]);_0x683f87[_0x7fcc('0x4a')]=qs[_0x7fcc('0x41')](_[_0x7fcc('0x6a')](_0x3dd21e[_0x7fcc('0x3f')],_0xde303f[_0x7fcc('0x41')]));if(_0x3dd21e['query'][_0x7fcc('0x4b')]){_0x683f87[_0x7fcc('0x4a')]=_[_0x7fcc('0x4c')](_0x683f87['where'],{'$or':_[_0x7fcc('0x3a')](_0x683f87[_0x7fcc('0x43')],function(_0x407c46){var _0x3e9d6b={};_0x3e9d6b[_0x407c46]={'$like':'%'+_0x3dd21e[_0x7fcc('0x3f')][_0x7fcc('0x4b')]+'%'};return _0x3e9d6b;})});}_0x683f87=_[_0x7fcc('0x4c')]({},_0x683f87,_0x3dd21e['options']);return _0x30da97[_0x7fcc('0xdd')](_0x683f87);}})[_0x7fcc('0x1f')](function(_0xf09156){if(_0xf09156){_0xde1147=_0xf09156[_0x7fcc('0x45')];if(!_0x3dd21e[_0x7fcc('0x3f')][_0x7fcc('0x46')](_0x7fcc('0x63'))){_0x683f87[_0x7fcc('0x47')]=qs['limit'](_0x3dd21e['query']['limit']);_0x683f87[_0x7fcc('0x2d')]=qs[_0x7fcc('0x2d')](_0x3dd21e['query'][_0x7fcc('0x2d')]);}return _0x30da97['getAgents'](_0x683f87);}})[_0x7fcc('0x1f')](function(_0x1e4d21){if(_0x1e4d21){return _0x1e4d21?{'count':_0xde1147,'rows':_0x1e4d21}:null;}})['then'](respondWithResult(_0x52d10c,null))['catch'](handleError(_0x52d10c,null));}; \ No newline at end of file +var _0xb931=['SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','json','addApplications','sequelize','transaction','getApplications','User','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','request','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','SmsAccounts','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','Body','messageId','skebby','sender','text','clicksend','message_id','plivo','From','MessageUUID','results','csc','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','autoclose','push','unmanaged'];(function(_0x1a8a39,_0x3ab2b5){var _0x1f7c6c=function(_0x2c1657){while(--_0x2c1657){_0x1a8a39['push'](_0x1a8a39['shift']());}};_0x1f7c6c(++_0x3ab2b5);}(_0xb931,0x117));var _0x1b93=function(_0x503867,_0x2a9ebc){_0x503867=_0x503867-0x0;var _0x37c47a=_0xb931[_0x503867];return _0x37c47a;};'use strict';var emlformat=require(_0x1b93('0x0'));var rimraf=require(_0x1b93('0x1'));var zipdir=require(_0x1b93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b93('0x3'));var moment=require(_0x1b93('0x4'));var BPromise=require(_0x1b93('0x5'));var Mustache=require(_0x1b93('0x6'));var util=require(_0x1b93('0x7'));var path=require('path');var sox=require(_0x1b93('0x8'));var csv=require(_0x1b93('0x9'));var ejs=require(_0x1b93('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1b93('0xb'));var jsforce=require(_0x1b93('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1b93('0xd'));var Papa=require(_0x1b93('0xe'));var Redis=require(_0x1b93('0xf'));var authService=require(_0x1b93('0x10'));var qs=require(_0x1b93('0x11'));var as=require(_0x1b93('0x12'));var hardwareService=require(_0x1b93('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1b93('0x14'));var config=require(_0x1b93('0x15'));var licenseUtil=require(_0x1b93('0x16'));var db=require('../../mysqldb')['db'];config[_0x1b93('0x17')]=_[_0x1b93('0x18')](config[_0x1b93('0x17')],{'host':_0x1b93('0x19'),'port':0x18eb});var socket=require(_0x1b93('0x1a'))(new Redis(config[_0x1b93('0x17')]));require(_0x1b93('0x1b'))['register'](socket);var jayson=require(_0x1b93('0x1c'));var client=jayson[_0x1b93('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x41a0b6,_0x4f950d,_0x322547,_0xe3c75a){return new BPromise(function(_0x3c02e2,_0x48d28a){var _0xe262aa=_0xe3c75a||client;return _0xe262aa[_0x1b93('0x1e')](_0x41a0b6,_0x322547)['then'](function(_0x25cf03){logger[_0x1b93('0x1f')](_0x1b93('0x20'),_0x4f950d,'request\x20sent');logger[_0x1b93('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4f950d,_0x1b93('0x22'),JSON[_0x1b93('0x23')](_0x25cf03));if(_0x25cf03[_0x1b93('0x24')]){if(_0x25cf03[_0x1b93('0x24')]['code']===0x1f4){logger['error'](_0x1b93('0x20'),_0x4f950d,_0x25cf03[_0x1b93('0x24')][_0x1b93('0x25')]);return _0x48d28a(_0x25cf03['error'][_0x1b93('0x25')]);}logger[_0x1b93('0x24')](_0x1b93('0x20'),_0x4f950d,_0x25cf03[_0x1b93('0x24')][_0x1b93('0x25')]);return _0x3c02e2(_0x25cf03[_0x1b93('0x24')][_0x1b93('0x25')]);}else{logger[_0x1b93('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x4f950d,_0x1b93('0x22'));_0x3c02e2(_0x25cf03[_0x1b93('0x26')][_0x1b93('0x25')]);}})[_0x1b93('0x27')](function(_0x438882){logger[_0x1b93('0x24')]('SmsAccount,\x20%s,\x20%s',_0x4f950d,_0x438882);_0x48d28a(_0x438882);});});}function respondWithStatusCode(_0x4b57d3,_0x30382a){_0x30382a=_0x30382a||0xcc;return function(_0x1b883d){if(_0x1b883d){return _0x4b57d3[_0x1b93('0x28')](_0x30382a);}return _0x4b57d3[_0x1b93('0x29')](_0x30382a)[_0x1b93('0x2a')]();};}function respondWithResult(_0x329879,_0x3e3725){_0x3e3725=_0x3e3725||0xc8;return function(_0x47b8c5){if(_0x47b8c5){return _0x329879[_0x1b93('0x29')](_0x3e3725)['json'](_0x47b8c5);}};}function respondWithFilteredResult(_0x4fc1fe,_0x1c9479){return function(_0x2d083f){if(_0x2d083f){var _0x22146e=typeof _0x1c9479[_0x1b93('0x2b')]===_0x1b93('0x2c')&&typeof _0x1c9479[_0x1b93('0x2d')]===_0x1b93('0x2c');var _0x4a1da5=_0x2d083f[_0x1b93('0x2e')];var _0x8092ae=_0x22146e?0x0:_0x1c9479[_0x1b93('0x2b')];var _0x4cc8e7=_0x22146e?_0x2d083f[_0x1b93('0x2e')]:_0x1c9479[_0x1b93('0x2b')]+_0x1c9479[_0x1b93('0x2d')];var _0xffdf47;if(_0x4cc8e7>=_0x4a1da5){_0x4cc8e7=_0x4a1da5;_0xffdf47=0xc8;}else{_0xffdf47=0xce;}_0x4fc1fe[_0x1b93('0x29')](_0xffdf47);return _0x4fc1fe[_0x1b93('0x2f')]('Content-Range',_0x8092ae+'-'+_0x4cc8e7+'/'+_0x4a1da5)['json'](_0x2d083f);}return null;};}function patchUpdates(_0x1634ff){return function(_0x3aa79b){try{jsonpatch[_0x1b93('0x30')](_0x3aa79b,_0x1634ff,!![]);}catch(_0x132c30){return BPromise['reject'](_0x132c30);}return _0x3aa79b[_0x1b93('0x31')]();};}function saveUpdates(_0x36c74a,_0x220d42){return function(_0x274856){if(_0x274856){return _0x274856[_0x1b93('0x32')](_0x36c74a)[_0x1b93('0x33')](function(_0x2c9545){return _0x2c9545;});}return null;};}function removeEntity(_0x6fdf51,_0x5f785b){return function(_0x159ef3){if(_0x159ef3){return _0x159ef3[_0x1b93('0x34')]()[_0x1b93('0x33')](function(){var _0x4550c4=_0x159ef3[_0x1b93('0x35')]({'plain':!![]});var _0x5987dc=_0x1b93('0x36');return db['UserProfileResource'][_0x1b93('0x34')]({'where':{'type':_0x5987dc,'resourceId':_0x4550c4['id']}})['then'](function(){return _0x159ef3;});})[_0x1b93('0x33')](function(){_0x6fdf51[_0x1b93('0x29')](0xcc)[_0x1b93('0x2a')]();});}};}function handleEntityNotFound(_0x591bea,_0x2fe78f){return function(_0x1ae11e){if(!_0x1ae11e){_0x591bea[_0x1b93('0x28')](0x194);}return _0x1ae11e;};}function handleError(_0x7503a,_0x1ed380){_0x1ed380=_0x1ed380||0x1f4;return function(_0x439cda){logger[_0x1b93('0x24')](_0x439cda['stack']);if(_0x439cda['name']){delete _0x439cda[_0x1b93('0x37')];}_0x7503a[_0x1b93('0x29')](_0x1ed380)[_0x1b93('0x38')](_0x439cda);};}exports[_0x1b93('0x39')]=function(_0x279320,_0x1ce6c0){var _0x217712={'include':[{'model':db[_0x1b93('0x3a')],'as':_0x1b93('0x3b')}]},_0x149397={},_0x3b9d77={'count':0x0,'rows':[]};var _0x2cac23=_[_0x1b93('0x3c')](db[_0x1b93('0x3d')][_0x1b93('0x3e')],function(_0x108df1){return{'name':_0x108df1['fieldName'],'type':_0x108df1[_0x1b93('0x3f')]['key']};});_0x149397[_0x1b93('0x40')]=_['map'](_0x2cac23,_0x1b93('0x37'));_0x149397[_0x1b93('0x41')]=_[_0x1b93('0x42')](_0x279320[_0x1b93('0x41')]);_0x149397[_0x1b93('0x43')]=_[_0x1b93('0x44')](_0x149397[_0x1b93('0x40')],_0x149397[_0x1b93('0x41')]);_0x217712[_0x1b93('0x45')]=_[_0x1b93('0x44')](_0x149397[_0x1b93('0x40')],qs[_0x1b93('0x46')](_0x279320[_0x1b93('0x41')][_0x1b93('0x46')]));_0x217712['attributes']=_0x217712[_0x1b93('0x45')][_0x1b93('0x47')]?_0x217712['attributes']:_0x149397[_0x1b93('0x40')];if(!_0x279320['query'][_0x1b93('0x48')]('nolimit')){_0x217712[_0x1b93('0x2d')]=qs[_0x1b93('0x2d')](_0x279320['query'][_0x1b93('0x2d')]);_0x217712[_0x1b93('0x2b')]=qs[_0x1b93('0x2b')](_0x279320[_0x1b93('0x41')]['offset']);}_0x217712[_0x1b93('0x49')]=qs[_0x1b93('0x4a')](_0x279320['query']['sort']);_0x217712[_0x1b93('0x4b')]=qs[_0x1b93('0x43')](_[_0x1b93('0x4c')](_0x279320[_0x1b93('0x41')],_0x149397['filters']),_0x2cac23);if(_0x279320[_0x1b93('0x41')][_0x1b93('0x4d')]){_0x217712[_0x1b93('0x4b')]=_['merge'](_0x217712[_0x1b93('0x4b')],{'$or':_[_0x1b93('0x3c')](_0x2cac23,function(_0x1a82c0){if(_0x1a82c0[_0x1b93('0x3f')]!==_0x1b93('0x4e')){var _0x23a0d2={};_0x23a0d2[_0x1a82c0[_0x1b93('0x37')]]={'$like':'%'+_0x279320[_0x1b93('0x41')][_0x1b93('0x4d')]+'%'};return _0x23a0d2;}})});}_0x217712=_[_0x1b93('0x4f')]({},_0x217712,_0x279320[_0x1b93('0x50')]);var _0x231b2f={'where':_0x217712['where']};return db[_0x1b93('0x3d')][_0x1b93('0x2e')](_0x231b2f)[_0x1b93('0x33')](function(_0x5305a1){_0x3b9d77['count']=_0x5305a1;if(_0x279320[_0x1b93('0x41')][_0x1b93('0x51')]){_0x217712[_0x1b93('0x52')]=[{'all':!![]}];}return db[_0x1b93('0x3d')][_0x1b93('0x53')](_0x217712);})[_0x1b93('0x33')](function(_0x270d53){_0x3b9d77[_0x1b93('0x54')]=_0x270d53;return _0x3b9d77;})[_0x1b93('0x33')](respondWithFilteredResult(_0x1ce6c0,_0x217712))[_0x1b93('0x27')](handleError(_0x1ce6c0,null));};exports[_0x1b93('0x55')]=function(_0x151607,_0x53cedd){var _0x10b1e3={'raw':![],'where':{'id':_0x151607[_0x1b93('0x56')]['id']},'include':[{'model':db[_0x1b93('0x3a')],'as':'mandatoryDispositionPause'}]},_0x3ffe9e={};_0x3ffe9e[_0x1b93('0x40')]=_[_0x1b93('0x42')](db['SmsAccount'][_0x1b93('0x3e')]);_0x3ffe9e[_0x1b93('0x41')]=_[_0x1b93('0x42')](_0x151607[_0x1b93('0x41')]);_0x3ffe9e[_0x1b93('0x43')]=_[_0x1b93('0x44')](_0x3ffe9e[_0x1b93('0x40')],_0x3ffe9e[_0x1b93('0x41')]);_0x10b1e3[_0x1b93('0x45')]=_[_0x1b93('0x44')](_0x3ffe9e['model'],qs[_0x1b93('0x46')](_0x151607[_0x1b93('0x41')]['fields']));_0x10b1e3[_0x1b93('0x45')]=_0x10b1e3[_0x1b93('0x45')]['length']?_0x10b1e3['attributes']:_0x3ffe9e[_0x1b93('0x40')];if(_0x151607[_0x1b93('0x41')][_0x1b93('0x51')]){_0x10b1e3['include']=[{'all':!![]}];}_0x10b1e3=_['merge']({},_0x10b1e3,_0x151607[_0x1b93('0x50')]);return db['SmsAccount'][_0x1b93('0x57')](_0x10b1e3)[_0x1b93('0x33')](handleEntityNotFound(_0x53cedd,null))[_0x1b93('0x33')](respondWithResult(_0x53cedd,null))[_0x1b93('0x27')](handleError(_0x53cedd,null));};exports[_0x1b93('0x58')]=function(_0x2cf77b,_0x5607b0){return db[_0x1b93('0x3d')][_0x1b93('0x58')](_0x2cf77b[_0x1b93('0x59')],{})['then'](function(_0x456bf2){var _0x3c45cd=_0x2cf77b['user'][_0x1b93('0x35')]({'plain':!![]});if(!_0x3c45cd)throw new Error(_0x1b93('0x5a'));if(_0x3c45cd[_0x1b93('0x5b')]===_0x1b93('0x5c')){var _0x56b771=_0x456bf2[_0x1b93('0x35')]({'plain':!![]});var _0x3887c6='SmsAccounts';return db[_0x1b93('0x5d')][_0x1b93('0x57')]({'where':{'name':_0x3887c6,'userProfileId':_0x3c45cd['userProfileId']},'raw':!![]})['then'](function(_0x2e6ab8){if(_0x2e6ab8&&_0x2e6ab8[_0x1b93('0x5e')]===0x0){return db[_0x1b93('0x5f')][_0x1b93('0x58')]({'name':_0x56b771[_0x1b93('0x37')],'resourceId':_0x56b771['id'],'type':_0x2e6ab8['name'],'sectionId':_0x2e6ab8['id']},{})[_0x1b93('0x33')](function(){return _0x456bf2;});}else{return _0x456bf2;}})[_0x1b93('0x27')](function(_0x4d3d3b){logger[_0x1b93('0x24')](_0x1b93('0x60'),_0x4d3d3b);throw _0x4d3d3b;});}return _0x456bf2;})[_0x1b93('0x33')](respondWithResult(_0x5607b0,0xc9))[_0x1b93('0x27')](handleError(_0x5607b0,null));};exports[_0x1b93('0x32')]=function(_0x19d548,_0x37b28c){if(_0x19d548[_0x1b93('0x59')]['id']){delete _0x19d548[_0x1b93('0x59')]['id'];}return db[_0x1b93('0x3d')][_0x1b93('0x57')]({'where':{'id':_0x19d548[_0x1b93('0x56')]['id']},'include':[{'model':db[_0x1b93('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x37b28c,null))[_0x1b93('0x33')](saveUpdates(_0x19d548[_0x1b93('0x59')],null))[_0x1b93('0x33')](respondWithResult(_0x37b28c,null))[_0x1b93('0x27')](handleError(_0x37b28c,null));};exports[_0x1b93('0x34')]=function(_0x1afc83,_0x5f073a){return db['SmsAccount'][_0x1b93('0x57')]({'where':{'id':_0x1afc83[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x5f073a,null))[_0x1b93('0x33')](removeEntity(_0x5f073a,null))['catch'](handleError(_0x5f073a,null));};exports[_0x1b93('0x61')]=function(_0x394bf5,_0x3845bd){return db['SmsAccount'][_0x1b93('0x61')]()[_0x1b93('0x33')](respondWithResult(_0x3845bd,null))['catch'](handleError(_0x3845bd,null));};exports[_0x1b93('0x62')]=function(_0x1ba5bd,_0x5d705e,_0x39d0b6){if(_0x1ba5bd[_0x1b93('0x59')]['id']){delete _0x1ba5bd[_0x1b93('0x59')]['id'];}return db[_0x1b93('0x3d')][_0x1b93('0x57')]({'where':{'id':_0x1ba5bd[_0x1b93('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d705e,null))[_0x1b93('0x33')](function(_0x384b58){if(_0x384b58){_0x1ba5bd[_0x1b93('0x59')][_0x1b93('0x63')]=_0x384b58['id'];return db[_0x1b93('0x64')][_0x1b93('0x58')](_0x1ba5bd[_0x1b93('0x59')]);}})[_0x1b93('0x33')](respondWithResult(_0x5d705e,null))[_0x1b93('0x27')](handleError(_0x5d705e,null));};exports[_0x1b93('0x65')]=function(_0x5b95ac,_0x463765,_0x3cb8b7){var _0x1c24e5={'raw':![],'where':{}};var _0x51f564={};var _0x331d57={'count':0x0,'rows':[]};return db[_0x1b93('0x3d')][_0x1b93('0x66')]({'where':{'id':_0x5b95ac[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x463765,null))[_0x1b93('0x33')](function(_0x1efb7f){if(_0x1efb7f){_0x51f564[_0x1b93('0x40')]=_[_0x1b93('0x42')](db['Disposition']['rawAttributes']);_0x51f564[_0x1b93('0x41')]=_['keys'](_0x5b95ac[_0x1b93('0x41')]);_0x51f564['filters']=_['intersection'](_0x51f564[_0x1b93('0x40')],_0x51f564[_0x1b93('0x41')]);_0x1c24e5[_0x1b93('0x45')]=_['intersection'](_0x51f564[_0x1b93('0x40')],qs[_0x1b93('0x46')](_0x5b95ac[_0x1b93('0x41')][_0x1b93('0x46')]));_0x1c24e5[_0x1b93('0x45')]=_0x1c24e5[_0x1b93('0x45')][_0x1b93('0x47')]?_0x1c24e5[_0x1b93('0x45')]:_0x51f564[_0x1b93('0x40')];if(!_0x5b95ac[_0x1b93('0x41')]['hasOwnProperty'](_0x1b93('0x67'))){_0x1c24e5[_0x1b93('0x2d')]=qs[_0x1b93('0x2d')](_0x5b95ac['query'][_0x1b93('0x2d')]);_0x1c24e5[_0x1b93('0x2b')]=qs[_0x1b93('0x2b')](_0x5b95ac['query'][_0x1b93('0x2b')]);}_0x1c24e5[_0x1b93('0x49')]=qs[_0x1b93('0x4a')](_0x5b95ac[_0x1b93('0x41')][_0x1b93('0x4a')]);_0x1c24e5[_0x1b93('0x4b')]=qs[_0x1b93('0x43')](_['pick'](_0x5b95ac['query'],_0x51f564[_0x1b93('0x43')]));_0x1c24e5[_0x1b93('0x4b')][_0x1b93('0x63')]=_0x1efb7f['id'];if(_0x5b95ac['query'][_0x1b93('0x4d')]){_0x1c24e5['where']=_[_0x1b93('0x4f')](_0x1c24e5[_0x1b93('0x4b')],{'$or':_[_0x1b93('0x3c')](_0x1c24e5[_0x1b93('0x45')],function(_0x3d3916){var _0x54ac5a={};_0x54ac5a[_0x3d3916]={'$like':'%'+_0x5b95ac['query'][_0x1b93('0x4d')]+'%'};return _0x54ac5a;})});}_0x1c24e5=_[_0x1b93('0x4f')]({},_0x1c24e5,_0x5b95ac['options']);return db['Disposition']['count']({'where':_0x1c24e5[_0x1b93('0x4b')]})[_0x1b93('0x33')](function(_0x40cef2){_0x331d57[_0x1b93('0x2e')]=_0x40cef2;if(_0x5b95ac[_0x1b93('0x41')][_0x1b93('0x51')]){_0x1c24e5[_0x1b93('0x52')]=[{'all':!![]}];}return db[_0x1b93('0x64')][_0x1b93('0x53')](_0x1c24e5);})[_0x1b93('0x33')](function(_0x2c6a87){_0x331d57[_0x1b93('0x54')]=_0x2c6a87;return _0x331d57;});}})[_0x1b93('0x33')](respondWithFilteredResult(_0x463765,_0x1c24e5))['catch'](handleError(_0x463765,null));};exports['removeDispositions']=function(_0x1b0331,_0x45c791,_0x23737c){return db[_0x1b93('0x3d')]['find']({'where':{'id':_0x1b0331[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x45c791,null))[_0x1b93('0x33')](function(_0x3ab634){if(_0x3ab634){return _0x3ab634[_0x1b93('0x68')](_0x1b0331[_0x1b93('0x41')][_0x1b93('0x69')]);}})[_0x1b93('0x33')](respondWithStatusCode(_0x45c791,null))[_0x1b93('0x27')](handleError(_0x45c791,null));};exports['addAnswer']=function(_0x292ba4,_0x37c791,_0x184577){if(_0x292ba4['body']['id']){delete _0x292ba4[_0x1b93('0x59')]['id'];}return db[_0x1b93('0x3d')]['find']({'where':{'id':_0x292ba4[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x37c791,null))[_0x1b93('0x33')](function(_0x4eb0d0){if(_0x4eb0d0){_0x292ba4[_0x1b93('0x59')]['SmsAccountId']=_0x4eb0d0['id'];return db[_0x1b93('0x6a')]['create'](_0x292ba4['body']);}})['then'](respondWithResult(_0x37c791,null))[_0x1b93('0x27')](handleError(_0x37c791,null));};exports['getAnswers']=function(_0x103513,_0x59f8ba,_0x23d228){var _0x324c84={'raw':![],'where':{}};var _0x508929={};var _0x43ed2f={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1b93('0x66')]({'where':{'id':_0x103513[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x59f8ba,null))[_0x1b93('0x33')](function(_0x1dc06e){if(_0x1dc06e){_0x508929[_0x1b93('0x40')]=_[_0x1b93('0x42')](db['CannedAnswer'][_0x1b93('0x3e')]);_0x508929[_0x1b93('0x41')]=_[_0x1b93('0x42')](_0x103513[_0x1b93('0x41')]);_0x508929[_0x1b93('0x43')]=_[_0x1b93('0x44')](_0x508929[_0x1b93('0x40')],_0x508929[_0x1b93('0x41')]);_0x324c84[_0x1b93('0x45')]=_['intersection'](_0x508929['model'],qs[_0x1b93('0x46')](_0x103513[_0x1b93('0x41')][_0x1b93('0x46')]));_0x324c84[_0x1b93('0x45')]=_0x324c84[_0x1b93('0x45')][_0x1b93('0x47')]?_0x324c84[_0x1b93('0x45')]:_0x508929['model'];if(!_0x103513['query']['hasOwnProperty'](_0x1b93('0x67'))){_0x324c84[_0x1b93('0x2d')]=qs['limit'](_0x103513[_0x1b93('0x41')][_0x1b93('0x2d')]);_0x324c84[_0x1b93('0x2b')]=qs['offset'](_0x103513[_0x1b93('0x41')][_0x1b93('0x2b')]);}_0x324c84[_0x1b93('0x49')]=qs['sort'](_0x103513[_0x1b93('0x41')][_0x1b93('0x4a')]);_0x324c84[_0x1b93('0x4b')]=qs['filters'](_[_0x1b93('0x4c')](_0x103513[_0x1b93('0x41')],_0x508929['filters']));_0x324c84[_0x1b93('0x4b')]['SmsAccountId']=_0x1dc06e['id'];if(_0x103513[_0x1b93('0x41')][_0x1b93('0x4d')]){_0x324c84['where']=_[_0x1b93('0x4f')](_0x324c84[_0x1b93('0x4b')],{'$or':_[_0x1b93('0x3c')](_0x324c84[_0x1b93('0x45')],function(_0x2c2f0f){var _0xe9cf2e={};_0xe9cf2e[_0x2c2f0f]={'$like':'%'+_0x103513[_0x1b93('0x41')]['filter']+'%'};return _0xe9cf2e;})});}_0x324c84=_['merge']({},_0x324c84,_0x103513[_0x1b93('0x50')]);return db['CannedAnswer']['count']({'where':_0x324c84[_0x1b93('0x4b')]})[_0x1b93('0x33')](function(_0x27ad3c){_0x43ed2f[_0x1b93('0x2e')]=_0x27ad3c;if(_0x103513[_0x1b93('0x41')][_0x1b93('0x51')]){_0x324c84[_0x1b93('0x52')]=[{'all':!![]}];}return db[_0x1b93('0x6a')][_0x1b93('0x53')](_0x324c84);})['then'](function(_0x1e1a4b){_0x43ed2f[_0x1b93('0x54')]=_0x1e1a4b;return _0x43ed2f;});}})[_0x1b93('0x33')](respondWithFilteredResult(_0x59f8ba,_0x324c84))['catch'](handleError(_0x59f8ba,null));};exports[_0x1b93('0x6b')]=function(_0x5b37ac,_0x425c7c,_0x485efe){return db[_0x1b93('0x3d')]['find']({'where':{'id':_0x5b37ac[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x425c7c,null))['then'](function(_0x5a5bf1){if(_0x5a5bf1){return _0x5a5bf1[_0x1b93('0x6b')](_0x5b37ac[_0x1b93('0x41')]['ids']);}})[_0x1b93('0x33')](respondWithStatusCode(_0x425c7c,null))['catch'](handleError(_0x425c7c,null));};exports[_0x1b93('0x6c')]=function(_0x36f636,_0x33583c,_0x44be42){var _0x62e2bf={'channel':_0x1b93('0x6d')};var _0x19d11f=[];var _0x64748c=[];var _0x300a82={};return db['SmsAccount'][_0x1b93('0x57')]({'where':{'id':_0x36f636[_0x1b93('0x56')]['id']},'include':[{'model':db[_0x1b93('0x6e')],'as':_0x1b93('0x6f')}]})[_0x1b93('0x33')](handleEntityNotFound(_0x33583c,null))[_0x1b93('0x33')](function(_0x4e1f4e){_0x62e2bf[_0x1b93('0x70')]=_0x4e1f4e;_0x62e2bf[_0x1b93('0x71')]=_[_0x1b93('0x72')](_0x4e1f4e[_0x1b93('0x6f')],[_0x1b93('0x73')],['asc']);if(_0x62e2bf[_0x1b93('0x70')][_0x1b93('0x6f')]){delete _0x62e2bf[_0x1b93('0x70')][_0x1b93('0x6f')];}return db[_0x1b93('0x74')][_0x1b93('0x61')]();})[_0x1b93('0x33')](function(_0x3ab3b4){if(!_0x3ab3b4){throw new db[(_0x1b93('0x75'))][(_0x1b93('0x76'))](_0x1b93('0x77'));}_0x19d11f=_['difference'](_[_0x1b93('0x42')](_0x3ab3b4),[_0x1b93('0x78'),_0x1b93('0x79')]);_0x64748c=_[_0x1b93('0x7a')](_[_0x1b93('0x42')](_0x3ab3b4),[_0x1b93('0x78'),_0x1b93('0x79'),_0x1b93('0x7b'),_0x1b93('0x7c')]);_0x62e2bf['body']={'mapKey':_0x1b93('0x7d')};if(_0x62e2bf[_0x1b93('0x70')][_0x1b93('0x3f')]){switch(_0x62e2bf['account']['type']){case _0x1b93('0x7e'):_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x7f')]=_0x36f636[_0x1b93('0x59')]['From'];_0x62e2bf[_0x1b93('0x59')]['body']=_0x36f636[_0x1b93('0x59')][_0x1b93('0x80')];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x81')]=_0x36f636[_0x1b93('0x59')]['MessageSid'];break;case _0x1b93('0x82'):_0x62e2bf['body']['from']='+'+_0x36f636[_0x1b93('0x59')][_0x1b93('0x83')];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x59')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x84')];break;case'connectel':_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x7f')]=_0x36f636['body'][_0x1b93('0x7f')];_0x62e2bf['body'][_0x1b93('0x59')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x25')];break;case _0x1b93('0x85'):_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x7f')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x7f')];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x59')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x59')];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x81')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x86')];break;case _0x1b93('0x87'):_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x7f')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x88')];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x59')]=_0x36f636[_0x1b93('0x59')]['Text'];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x81')]=_0x36f636['body'][_0x1b93('0x89')];break;case'infobip':_0x62e2bf['body'][_0x1b93('0x7f')]='+'+_0x36f636[_0x1b93('0x59')]['results'][0x0]['from'];_0x62e2bf[_0x1b93('0x59')]['body']=_0x36f636[_0x1b93('0x59')][_0x1b93('0x8a')][0x0][_0x1b93('0x84')];_0x62e2bf['body'][_0x1b93('0x81')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x8a')][0x0][_0x1b93('0x81')];break;case _0x1b93('0x8b'):_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x7f')]=_0x36f636[_0x1b93('0x59')]['originatingAddress'];_0x62e2bf['body'][_0x1b93('0x59')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x8c')][_0x1b93('0x25')];break;case'clickatell':_0x62e2bf[_0x1b93('0x59')]['from']=_0x36f636[_0x1b93('0x59')][_0x1b93('0x8d')];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x59')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x84')];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x81')]=_0x36f636[_0x1b93('0x59')][_0x1b93('0x8e')];break;case _0x1b93('0x8f'):_0x62e2bf[_0x1b93('0x59')]['messageId']=_0x36f636[_0x1b93('0x59')][0x0]['message']['id'];_0x62e2bf['body']['from']=_0x36f636[_0x1b93('0x59')][0x0][_0x1b93('0x25')][_0x1b93('0x7f')];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x59')]=_0x36f636['body'][0x0][_0x1b93('0x25')][_0x1b93('0x84')];break;case _0x1b93('0x90'):_0x62e2bf['body'][_0x1b93('0x7f')]=_0x36f636['body'][_0x1b93('0x7f')];_0x62e2bf[_0x1b93('0x59')]['body']=_0x36f636[_0x1b93('0x59')]['message'];_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x81')]=_0x36f636[_0x1b93('0x59')]['refid'];break;}}if(_0x62e2bf['body']['id']){delete _0x62e2bf[_0x1b93('0x59')]['id'];}if(_['isNil'](_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x7f')])){throw new db['Sequelize'][(_0x1b93('0x76'))](_0x1b93('0x91'));}if(_[_0x1b93('0x92')](_0x62e2bf['body'][_0x1b93('0x59')])||_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x59')]===''){throw new db[(_0x1b93('0x75'))][(_0x1b93('0x76'))](_0x1b93('0x93'));}if(_[_0x1b93('0x92')](_0x62e2bf['body'][_0x1b93('0x94')])){throw new db['Sequelize']['ValidationError'](_0x1b93('0x95')+_0x64748c);}if(!_[_0x1b93('0x96')](_0x64748c,_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x94')])){throw new db[(_0x1b93('0x75'))][(_0x1b93('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x64748c);}_0x300a82[_0x62e2bf[_0x1b93('0x59')]['mapKey']]=_0x62e2bf[_0x1b93('0x59')]['from'];return db[_0x1b93('0x97')][_0x1b93('0x57')]({'where':{'id':_0x62e2bf['account'][_0x1b93('0x7c')]},'include':[{'model':db[_0x1b93('0x74')],'as':'Contacts','where':_0x300a82,'limit':0x1,'order':[[_0x1b93('0x79'),_0x1b93('0x98')]]}]});})[_0x1b93('0x33')](handleEntityNotFound(_0x33583c,null))['then'](function(_0x471020){if(_0x471020){_0x62e2bf[_0x1b93('0x99')]=_[_0x1b93('0x9a')](_0x471020,[_0x1b93('0x9b')]);if(_0x471020[_0x1b93('0x9b')][_0x1b93('0x47')]){return _0x471020[_0x1b93('0x9b')][0x0];}var _0x38df3d=_['defaults'](_0x62e2bf[_0x1b93('0x59')],{'firstName':_0x62e2bf['body'][_0x1b93('0x7f')],'ListId':_0x471020['id']});_0x38df3d[_0x62e2bf[_0x1b93('0x59')]['mapKey']]=_0x62e2bf[_0x1b93('0x59')]['from'];return db[_0x1b93('0x74')][_0x1b93('0x58')](_0x38df3d,{'fields':_0x19d11f,'raw':!![]});}})[_0x1b93('0x33')](handleEntityNotFound(_0x33583c,null))[_0x1b93('0x33')](function(_0x1240a1){if(_0x1240a1){_0x62e2bf[_0x1b93('0x9c')]=_0x1240a1;var _0x5df7df={'ContactId':_0x1240a1['id'],'phone':_0x62e2bf['body'][_0x1b93('0x7f')],'SmsAccountId':_0x36f636[_0x1b93('0x56')]['id']};var _0x5b59b7={'ContactId':_0x1240a1['id'],'SmsAccountId':_0x36f636[_0x1b93('0x56')]['id'],'closed':![]};return db[_0x1b93('0x9d')][_0x1b93('0x57')]({'where':_0x5b59b7})['then'](function(_0x4f3086){if(_0x4f3086){return[_0x4f3086,![]];}return db[_0x1b93('0x9d')][_0x1b93('0x58')](_0x5df7df)['then'](function(_0x188576){return[_0x188576,!![]];});});}})[_0x1b93('0x9e')](function(_0xa5b64a,_0x188732){_0x62e2bf['interaction']=_0xa5b64a['get']({'plain':!![]});_0x62e2bf[_0x1b93('0x9f')]['created']=![];if(_0x188732){if(_0x62e2bf[_0x1b93('0x70')][_0x1b93('0xa0')]){_0x62e2bf[_0x1b93('0x71')][_0x1b93('0xa1')]({'id':0x0,'priority':_0x62e2bf[_0x1b93('0x71')][_0x1b93('0x47')]+0x1,'app':'close','appdata':_0x1b93('0xa2'),'interval':'*,*,*,*'});}_0x62e2bf['interaction']['created']=!![];}return db[_0x1b93('0xa3')][_0x1b93('0x58')]({'phone':_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x7f')],'messageId':_0x62e2bf[_0x1b93('0x59')][_0x1b93('0x81')],'body':_0x62e2bf[_0x1b93('0x59')]['body'],'SmsAccountId':_0x36f636[_0x1b93('0x56')]['id'],'SmsInteractionId':_0xa5b64a['id'],'direction':'in','ContactId':_0xa5b64a[_0x1b93('0xa4')],'AttachmentId':_0x62e2bf['body'][_0x1b93('0xa5')]});})[_0x1b93('0x33')](function(_0x46f956){_0x62e2bf['message']=_0x46f956;if(_0x62e2bf[_0x1b93('0x9f')][_0x1b93('0xa6')]){return db['User'][_0x1b93('0x57')]({'attributes':['id',_0x1b93('0x37')],'where':{'id':_0x62e2bf[_0x1b93('0x9f')][_0x1b93('0xa6')]}})[_0x1b93('0x33')](function(_0x2638d5){if(_0x2638d5){_0x62e2bf[_0x1b93('0x71')][_0x1b93('0xa7')]({'id':0x0,'priority':0x0,'app':_0x1b93('0xa8'),'appdata':_0x2638d5[_0x1b93('0x37')]+','+(_0x62e2bf[_0x1b93('0x70')]['waitForTheAssignedAgent']||0xa),'interval':_0x1b93('0xa9')});}return respondWithRpcPromise(_0x1b93('0xaa'),_0x1b93('0xab'),_0x62e2bf);});}return respondWithRpcPromise(_0x1b93('0xaa'),_0x1b93('0xab'),_0x62e2bf);})[_0x1b93('0x33')](function(_0x1bb8e4){if(_0x1bb8e4){var _0xcb4b82=0xc8;var _0x357500=_0x1b93('0xac');logger['info'](_0x1b93('0xad'),_0x357500,_0xcb4b82,_0x1b93('0xae'));logger[_0x1b93('0x21')](_0x1b93('0xaf'),_0x357500,_0xcb4b82,_0x1b93('0xae'),JSON[_0x1b93('0x23')](_0x1bb8e4));if(_0x62e2bf[_0x1b93('0x70')][_0x1b93('0x3f')]==='twilio'){return _0x33583c[_0x1b93('0x29')](_0xcb4b82)[_0x1b93('0x2f')](_0x1b93('0xb0'),_0x1b93('0xb1'))[_0x1b93('0x38')](_0x1b93('0xb2'));}else{return _0x33583c[_0x1b93('0x29')](_0xcb4b82)[_0x1b93('0xb3')](_0x1bb8e4);}}})[_0x1b93('0x27')](handleError(_0x33583c,null));};exports[_0x1b93('0xb4')]=function(_0x1b8777,_0x193d3d,_0x4b6e0c){return db[_0x1b93('0x3d')][_0x1b93('0x66')]({'where':{'id':_0x1b8777[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x193d3d,null))[_0x1b93('0x33')](function(_0x226c1b){if(_0x226c1b){return db[_0x1b93('0xb5')][_0x1b93('0xb6')](function(_0x38f6d2){return db['SmsApplication'][_0x1b93('0x34')]({'where':{'SmsAccountId':_0x1b8777[_0x1b93('0x56')]['id']},'transaction':_0x38f6d2})[_0x1b93('0x33')](function(_0x55ae0b){var _0xe46b64=_[_0x1b93('0x3c')](_0x1b8777[_0x1b93('0x59')],function(_0x3a5b50){_0x3a5b50[_0x1b93('0x63')]=_0x1b8777[_0x1b93('0x56')]['id'];return _0x3a5b50;});return db[_0x1b93('0x6e')]['bulkCreate'](_0xe46b64,{'transaction':_0x38f6d2});});})[_0x1b93('0x33')](function(){return db[_0x1b93('0x6e')]['findAndCountAll']({'where':{'SmsAccountId':_0x1b8777[_0x1b93('0x56')]['id']},'order':_0x1b93('0x73')});});}})[_0x1b93('0x33')](respondWithResult(_0x193d3d,null))[_0x1b93('0x27')](handleError(_0x193d3d,null));};exports['getApplications']=function(_0x5f4e0c,_0x1c7294,_0x2f9588){var _0x209c06={};var _0x103f9b={};var _0x46e75e;var _0x330dfa;return db[_0x1b93('0x3d')][_0x1b93('0x66')]({'where':{'id':_0x5f4e0c[_0x1b93('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c7294,null))['then'](function(_0x4e5089){if(_0x4e5089){_0x46e75e=_0x4e5089;_0x103f9b[_0x1b93('0x40')]=_[_0x1b93('0x42')](db['SmsApplication']['rawAttributes']);_0x103f9b['query']=_['keys'](_0x5f4e0c['query']);_0x103f9b[_0x1b93('0x43')]=_[_0x1b93('0x44')](_0x103f9b[_0x1b93('0x40')],_0x103f9b['query']);_0x209c06['attributes']=_[_0x1b93('0x44')](_0x103f9b[_0x1b93('0x40')],qs[_0x1b93('0x46')](_0x5f4e0c['query'][_0x1b93('0x46')]));_0x209c06[_0x1b93('0x45')]=_0x209c06[_0x1b93('0x45')][_0x1b93('0x47')]?_0x209c06[_0x1b93('0x45')]:_0x103f9b[_0x1b93('0x40')];_0x209c06[_0x1b93('0x49')]=qs[_0x1b93('0x4a')](_0x5f4e0c['query']['sort']);_0x209c06[_0x1b93('0x4b')]=qs[_0x1b93('0x43')](_[_0x1b93('0x4c')](_0x5f4e0c[_0x1b93('0x41')],_0x103f9b['filters']));if(_0x5f4e0c[_0x1b93('0x41')]['filter']){_0x209c06[_0x1b93('0x4b')]=_[_0x1b93('0x4f')](_0x209c06[_0x1b93('0x4b')],{'$or':_[_0x1b93('0x3c')](_0x209c06[_0x1b93('0x45')],function(_0x4f9554){var _0x1ba8ed={};_0x1ba8ed[_0x4f9554]={'$like':'%'+_0x5f4e0c[_0x1b93('0x41')][_0x1b93('0x4d')]+'%'};return _0x1ba8ed;})});}_0x209c06=_['merge']({},_0x209c06,_0x5f4e0c['options']);return _0x46e75e[_0x1b93('0xb7')](_0x209c06);}})[_0x1b93('0x33')](function(_0x5f0447){if(_0x5f0447){_0x330dfa=_0x5f0447['length'];if(!_0x5f4e0c[_0x1b93('0x41')][_0x1b93('0x48')](_0x1b93('0x67'))){_0x209c06[_0x1b93('0x2d')]=qs[_0x1b93('0x2d')](_0x5f4e0c[_0x1b93('0x41')][_0x1b93('0x2d')]);_0x209c06[_0x1b93('0x2b')]=qs[_0x1b93('0x2b')](_0x5f4e0c[_0x1b93('0x41')]['offset']);}return _0x46e75e[_0x1b93('0xb7')](_0x209c06);}})[_0x1b93('0x33')](function(_0x36be7c){if(_0x36be7c){return _0x36be7c?{'count':_0x330dfa,'rows':_0x36be7c}:null;}})[_0x1b93('0x33')](respondWithResult(_0x1c7294,null))[_0x1b93('0x27')](handleError(_0x1c7294,null));};exports['getInteractions']=function(_0x48dd17,_0x12a458,_0xe52bef){var _0x414f6d={'raw':![],'where':{}};var _0x22760f={};var _0x506eac={'count':0x0,'rows':[]};return db[_0x1b93('0x3d')]['findOne']({'where':{'id':_0x48dd17[_0x1b93('0x56')]['id']}})['then'](handleEntityNotFound(_0x12a458,null))[_0x1b93('0x33')](function(_0x76ac4e){if(_0x76ac4e){_0x22760f[_0x1b93('0x40')]=_[_0x1b93('0x42')](db[_0x1b93('0x9d')][_0x1b93('0x3e')]);_0x22760f[_0x1b93('0x41')]=_[_0x1b93('0x42')](_0x48dd17[_0x1b93('0x41')]);_0x22760f[_0x1b93('0x43')]=_[_0x1b93('0x44')](_0x22760f[_0x1b93('0x40')],_0x22760f['query']);_0x414f6d[_0x1b93('0x45')]=_[_0x1b93('0x44')](_0x22760f[_0x1b93('0x40')],qs[_0x1b93('0x46')](_0x48dd17['query']['fields']));_0x414f6d['attributes']=_0x414f6d['attributes']['length']?_0x414f6d[_0x1b93('0x45')]:_0x22760f[_0x1b93('0x40')];if(!_0x48dd17[_0x1b93('0x41')][_0x1b93('0x48')](_0x1b93('0x67'))){_0x414f6d['limit']=qs[_0x1b93('0x2d')](_0x48dd17[_0x1b93('0x41')][_0x1b93('0x2d')]);_0x414f6d[_0x1b93('0x2b')]=qs[_0x1b93('0x2b')](_0x48dd17['query'][_0x1b93('0x2b')]);}_0x414f6d[_0x1b93('0x49')]=qs[_0x1b93('0x4a')](_0x48dd17[_0x1b93('0x41')][_0x1b93('0x4a')]);_0x414f6d[_0x1b93('0x4b')]=qs[_0x1b93('0x43')](_['pick'](_0x48dd17[_0x1b93('0x41')],_0x22760f[_0x1b93('0x43')]));_0x414f6d[_0x1b93('0x4b')][_0x1b93('0x63')]=_0x76ac4e['id'];if(_0x48dd17[_0x1b93('0x41')][_0x1b93('0x4d')]){_0x414f6d[_0x1b93('0x4b')]=_['merge'](_0x414f6d[_0x1b93('0x4b')],{'$or':_[_0x1b93('0x3c')](_0x414f6d['attributes'],function(_0x187f38){var _0x29d330={};_0x29d330[_0x187f38]={'$like':'%'+_0x48dd17[_0x1b93('0x41')][_0x1b93('0x4d')]+'%'};return _0x29d330;})});}_0x414f6d=_[_0x1b93('0x4f')]({},_0x414f6d,_0x48dd17[_0x1b93('0x50')]);return db[_0x1b93('0x9d')][_0x1b93('0x2e')]({'where':_0x414f6d[_0x1b93('0x4b')]})[_0x1b93('0x33')](function(_0x1c436e){_0x506eac['count']=_0x1c436e;if(_0x48dd17['query'][_0x1b93('0x51')]){_0x414f6d[_0x1b93('0x52')]=[{'model':db[_0x1b93('0x74')],'as':'Contact','required':![]},{'model':db[_0x1b93('0xb8')],'as':_0x1b93('0xb9'),'attributes':['name',_0x1b93('0xba'),_0x1b93('0xbb')],'required':![]},{'model':db[_0x1b93('0xbc')],'as':_0x1b93('0xbd'),'attributes':['id',_0x1b93('0x37'),_0x1b93('0xbe')],'where':_0x48dd17['query'][_0x1b93('0xbf')]?{'id':_0x48dd17['query'][_0x1b93('0xbf')]}:undefined,'required':_0x48dd17[_0x1b93('0x41')][_0x1b93('0xbf')]?!![]:![]}];}return db[_0x1b93('0x9d')][_0x1b93('0x53')](_0x414f6d);})[_0x1b93('0x33')](function(_0x50c9d9){_0x506eac[_0x1b93('0x54')]=_0x50c9d9;return _0x506eac;});}})[_0x1b93('0x33')](respondWithFilteredResult(_0x12a458,_0x414f6d))[_0x1b93('0x27')](handleError(_0x12a458,null));};exports[_0x1b93('0x38')]=function(_0x6cd14d,_0x295bdd,_0x4dc625){var _0x5c7cd2,_0xdd552a,_0x2371c9;if(_[_0x1b93('0x92')](_0x6cd14d[_0x1b93('0x59')]['body'])||_0x6cd14d[_0x1b93('0x59')]['body']===''){throw new db[(_0x1b93('0x75'))][(_0x1b93('0x76'))](_0x1b93('0x93'));}if(_['isNil'](_0x6cd14d['body']['to'])){throw new db[(_0x1b93('0x75'))][(_0x1b93('0x76'))](_0x1b93('0xc0'));}_0x5c7cd2=_0x6cd14d['body']['to'];return db[_0x1b93('0x3d')]['find']({'where':{'id':_0x6cd14d[_0x1b93('0x56')]['id']},'include':[{'model':db[_0x1b93('0x97')],'as':_0x1b93('0xc1'),'include':[{'model':db[_0x1b93('0x74')],'as':_0x1b93('0x9b'),'where':{'mobile':_0x5c7cd2},'limit':0x1,'order':[[_0x1b93('0x79'),'DESC']]}]}]})[_0x1b93('0x33')](handleEntityNotFound(_0x295bdd,null))[_0x1b93('0x33')](function(_0xa3d76a){if(_0xa3d76a&&_0xa3d76a[_0x1b93('0xc1')]){_0xdd552a=_0xa3d76a[_0x1b93('0x35')]({'plain':!![]});if(_0xdd552a[_0x1b93('0xc1')]&&_0xdd552a[_0x1b93('0xc1')][_0x1b93('0x9b')][_0x1b93('0x47')]){return _0xdd552a[_0x1b93('0xc1')][_0x1b93('0x9b')][0x0];}return db['CmContact'][_0x1b93('0x58')](_[_0x1b93('0x18')](_0x6cd14d[_0x1b93('0x59')],{'firstName':_0x5c7cd2,'mobile':_0x5c7cd2,'phone':_0x5c7cd2,'ListId':_0xdd552a[_0x1b93('0x7c')]}));}})[_0x1b93('0x33')](handleEntityNotFound(_0x295bdd,null))[_0x1b93('0x33')](function(_0x64f7ae){if(_0x64f7ae){_0x2371c9=_0x64f7ae;return db['SmsInteraction']['find']({'where':{'ContactId':_0x2371c9['id'],'closed':![],'SmsAccountId':_0xdd552a['id']}})[_0x1b93('0x33')](function(_0x361e46){if(_0x361e46){return[_0x361e46,![]];}return db['SmsInteraction'][_0x1b93('0x58')]({'UserId':_0x6cd14d[_0x1b93('0x5c')]['id'],'ContactId':_0x2371c9['id'],'SmsAccountId':_0xdd552a['id'],'phone':_0x5c7cd2,'firstMsgDirection':'out','Messages':[_[_0x1b93('0x4f')](_0x6cd14d[_0x1b93('0x59')],{'read':![],'body':_0x6cd14d[_0x1b93('0x59')][_0x1b93('0x59')],'phone':_0x5c7cd2,'SmsAccountId':_0xdd552a['id'],'UserId':_0x6cd14d[_0x1b93('0x5c')]['id'],'ContactId':_0x2371c9['id']})]},{'include':[{'model':db[_0x1b93('0xa3')],'as':_0x1b93('0xc2')}]})[_0x1b93('0x33')](function(_0x5483d0){return[_0x5483d0,!![]];});});}})[_0x1b93('0x9e')](function(_0x3fdb8b,_0x7a4933){if(_0x7a4933){return _0x3fdb8b;}return db[_0x1b93('0xa3')][_0x1b93('0x58')](_['merge'](_0x6cd14d[_0x1b93('0x59')],{'read':![],'body':_0x6cd14d[_0x1b93('0x59')][_0x1b93('0x59')],'phone':_0x5c7cd2,'SmsAccountId':_0xdd552a['id'],'SmsInteractionId':_0x3fdb8b['id'],'UserId':_0x6cd14d[_0x1b93('0x5c')]['id'],'ContactId':_0x2371c9['id']}))[_0x1b93('0x33')](function(_0x81fd80){_0x3fdb8b[_0x1b93('0xc3')][_0x1b93('0xc2')]=[];_0x3fdb8b[_0x1b93('0xc3')]['Messages'][_0x1b93('0xa1')](_0x81fd80[_0x1b93('0xc3')]);return _0x3fdb8b;});})['then'](respondWithResult(_0x295bdd,null))[_0x1b93('0x27')](handleError(_0x295bdd,null));};exports[_0x1b93('0x29')]=function(_0x2bb49d,_0xe4e839,_0x357c32){if(_0x2bb49d[_0x1b93('0x59')]['id']){delete _0x2bb49d[_0x1b93('0x59')]['id'];}var _0x1d8424,_0x31d8d1,_0x5d39b8;return db[_0x1b93('0x3d')][_0x1b93('0x57')]({'where':{'id':_0x2bb49d['params']['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0xe4e839,null))[_0x1b93('0x33')](function(_0x58febd){if(_0x58febd){_0x5d39b8=_0x58febd;logger[_0x1b93('0x21')](_0x1b93('0xad'),'status',_0x1b93('0xc4'),_0x58febd[_0x1b93('0x3f')],util[_0x1b93('0xc5')](_0x2bb49d[_0x1b93('0x59')],{'showHidden':![],'depth':null}));switch(_0x58febd[_0x1b93('0x3f')]){case _0x1b93('0x82'):if(_0x2bb49d['body'][_0x1b93('0xc6')]&&_0x2bb49d['body']['status']){_0x31d8d1=_0x2bb49d[_0x1b93('0x59')]['status'];return db[_0x1b93('0xa3')][_0x1b93('0x57')]({'where':{'messageId':_0x2bb49d[_0x1b93('0x59')][_0x1b93('0xc6')]}});}break;case'connectel':if(_0x2bb49d[_0x1b93('0x59')][_0x1b93('0xc7')]&&_0x2bb49d[_0x1b93('0x59')]['statusInt']){_0x31d8d1=_0x2bb49d[_0x1b93('0x59')][_0x1b93('0xc8')];return db[_0x1b93('0xa3')][_0x1b93('0x57')]({'where':{'messageId':_0x2bb49d[_0x1b93('0x59')][_0x1b93('0xc7')]}});}break;case _0x1b93('0x85'):if(_0x2bb49d[_0x1b93('0x59')][_0x1b93('0x86')]&&_0x2bb49d['body']['status_code']){_0x31d8d1=_0x2bb49d[_0x1b93('0x59')][_0x1b93('0xc9')];return db['SmsMessage'][_0x1b93('0x57')]({'where':{'messageId':_0x2bb49d['body']['message_id']}});}break;case'infobip':var _0x3c4d89=_0x2bb49d[_0x1b93('0x59')][_0x1b93('0x8a')][0x0];if(_0x3c4d89['messageId']&&_0x3c4d89[_0x1b93('0x29')][_0x1b93('0xca')]===_0x1b93('0xcb')){_0x31d8d1=_0x3c4d89[_0x1b93('0x29')][_0x1b93('0xca')];return db[_0x1b93('0xa3')][_0x1b93('0x57')]({'where':{'messageId':_0x3c4d89['messageId']}});}break;case _0x1b93('0xcc'):if(_0x2bb49d[_0x1b93('0x59')]['messageId']&&_0x2bb49d[_0x1b93('0x59')][_0x1b93('0x29')]){_0x31d8d1=_0x2bb49d['body'][_0x1b93('0x29')];return db[_0x1b93('0xa3')]['find']({'where':{'messageId':_0x2bb49d[_0x1b93('0x59')]['messageId']}});}break;case _0x1b93('0x8f'):if(_0x2bb49d[_0x1b93('0x59')][0x0][_0x1b93('0x25')]['id']){_0x31d8d1=_0x2bb49d['body'][0x0]['type'];return db[_0x1b93('0xa3')][_0x1b93('0x57')]({'where':{'messageId':_0x2bb49d[_0x1b93('0x59')][0x0][_0x1b93('0x25')]['id']}});}break;case _0x1b93('0x90'):if(_0x2bb49d[_0x1b93('0x59')]['redif']&&_0x2bb49d[_0x1b93('0x59')]['status']){_0x31d8d1=_0x2bb49d['body'][_0x1b93('0x29')];return db['SmsMessage'][_0x1b93('0x57')]({'where':{'messageId':_0x2bb49d[_0x1b93('0x59')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0xe4e839,null))[_0x1b93('0x33')](function(_0x2c135e){if(_0x2c135e){_0x1d8424=_0x2c135e;switch(_0x5d39b8['type']){case'skebby':if(_0x31d8d1===_0x1b93('0xcb')){return _0x1d8424[_0x1b93('0x32')]({'read':!![]});}else{logger['error'](_0x1b93('0xad'),'status',_0x1b93('0x82'),util[_0x1b93('0xc5')](_0x2bb49d[_0x1b93('0x59')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x31d8d1==='1'){return _0x1d8424[_0x1b93('0x32')]({'read':!![]});}else{logger[_0x1b93('0x24')](_0x1b93('0xad'),'status',_0x1b93('0x82'),util[_0x1b93('0xc5')](_0x2bb49d[_0x1b93('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1b93('0x85'):if(!_0x2bb49d[_0x1b93('0x59')][_0x1b93('0xcd')]&&_0x31d8d1>=0xc8&&_0x31d8d1<=0xce){return _0x1d8424['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b93('0x29'),_0x1b93('0x85'),util['inspect'](_0x2bb49d[_0x1b93('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1b93('0xce'):var _0x25fa33=_0x2bb49d[_0x1b93('0x59')][_0x1b93('0x8a')][0x0];if(_0x25fa33[_0x1b93('0x29')][_0x1b93('0xca')]===_0x1b93('0xcb')){return _0x1d8424['update']({'read':!![]});}else{logger[_0x1b93('0x24')](_0x1b93('0xad'),'status',_0x1b93('0xce'),util[_0x1b93('0xc5')](_0x2bb49d[_0x1b93('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1b93('0xcc'):if(_0x31d8d1==_0x1b93('0xcf')||_0x31d8d1==_0x1b93('0xd0')){return _0x1d8424[_0x1b93('0x32')]({'read':!![]});}else{logger[_0x1b93('0x24')](_0x1b93('0xad'),'status',_0x1b93('0xcc'),util['inspect'](_0x2bb49d[_0x1b93('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1b93('0x8f'):if(_0x31d8d1==_0x1b93('0xd1')){return _0x1d8424[_0x1b93('0x32')]({'read':!![]});}else{logger[_0x1b93('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','bandwidth',util[_0x1b93('0xc5')](_0x2bb49d['body'],{'showHidden':![],'depth':null}));}break;case _0x1b93('0x90'):if(_0x31d8d1===_0x1b93('0xd2')||_0x31d8d1===_0x1b93('0xd3')){return _0x1d8424[_0x1b93('0x32')]({'read':!![]});}else{logger[_0x1b93('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b93('0x29'),'intelepeer',util[_0x1b93('0xc5')](_0x2bb49d['body'],{'showHidden':![],'depth':null}));}break;}return _0x1d8424;}})[_0x1b93('0x33')](respondWithResult(_0xe4e839,null))[_0x1b93('0x27')](handleError(_0xe4e839,null));};exports[_0x1b93('0xd4')]=function(_0x4fa441,_0x4c837b,_0x6571bc){var _0x223c6d,_0x339b08,_0x10b93b;return db[_0x1b93('0x3d')][_0x1b93('0x57')]({'where':{'id':_0x4fa441['params']['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x4c837b,null))[_0x1b93('0x33')](function(_0x2df56e){if(_0x2df56e){_0x10b93b=_0x2df56e;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b93('0x29'),'received\x20delivery\x20report\x20from',_0x2df56e[_0x1b93('0x3f')],util['inspect'](_0x4fa441[_0x1b93('0x41')],{'showHidden':![],'depth':null}));switch(_0x2df56e[_0x1b93('0x3f')]){case'csc':if(_0x4fa441[_0x1b93('0x41')]['message-id']&&_0x4fa441['query']['state']){_0x339b08=_0x4fa441['query'][_0x1b93('0xd5')];return db[_0x1b93('0xa3')][_0x1b93('0x57')]({'where':{'messageId':_0x4fa441['query'][_0x1b93('0xd6')]}});}break;}}})[_0x1b93('0x33')](handleEntityNotFound(_0x4c837b,null))[_0x1b93('0x33')](function(_0x5da09c){if(_0x5da09c){_0x223c6d=_0x5da09c;switch(_0x10b93b[_0x1b93('0x3f')]){case _0x1b93('0x8b'):if(_0x339b08==='2'||_0x339b08==='6'){return _0x223c6d[_0x1b93('0x32')]({'read':!![]});}else{logger[_0x1b93('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b93('0x29'),'csc',util[_0x1b93('0xc5')](_0x4fa441['query'],{'showHidden':![],'depth':null}));};break;}return _0x223c6d;}})[_0x1b93('0x33')](respondWithResult(_0x4c837b,null))[_0x1b93('0x27')](handleError(_0x4c837b,null));};exports['addAgents']=function(_0x1ec5e3,_0x29e50d,_0x3a2b4c){return db[_0x1b93('0x3d')][_0x1b93('0x57')]({'where':{'id':_0x1ec5e3[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x29e50d,null))['then'](function(_0x217269){if(_0x217269){return _0x217269[_0x1b93('0xd7')](_0x1ec5e3[_0x1b93('0x59')]['ids'],_[_0x1b93('0x9a')](_0x1ec5e3[_0x1b93('0x59')],[_0x1b93('0x69'),'id'])||{})[_0x1b93('0x9e')](function(_0x32ad24){for(var _0x3b06c8=0x0;_0x3b06c8<_0x1ec5e3[_0x1b93('0x59')][_0x1b93('0x69')][_0x1b93('0x47')];_0x3b06c8+=0x1){socket[_0x1b93('0xd8')](_0x1b93('0xd9'),{'UserId':_0x1ec5e3['body'][_0x1b93('0x69')][_0x3b06c8],'SmsAccountId':_0x1ec5e3[_0x1b93('0x56')]['id']});}return _0x32ad24;});}})[_0x1b93('0x33')](respondWithResult(_0x29e50d,null))[_0x1b93('0x27')](handleError(_0x29e50d,null));};exports['removeAgents']=function(_0x190fc1,_0x490c52,_0x45bc38){return db[_0x1b93('0x3d')][_0x1b93('0x57')]({'where':{'id':_0x190fc1[_0x1b93('0x56')]['id']}})[_0x1b93('0x33')](handleEntityNotFound(_0x490c52,null))[_0x1b93('0x33')](function(_0x4604d9){if(_0x4604d9){return _0x4604d9[_0x1b93('0xda')](_0x190fc1[_0x1b93('0x41')]['ids'])[_0x1b93('0x33')](function(){if(_['isArray'](_0x190fc1['query'][_0x1b93('0x69')])){for(var _0x5842d9=0x0;_0x5842d9<_0x190fc1[_0x1b93('0x41')][_0x1b93('0x69')][_0x1b93('0x47')];_0x5842d9+=0x1){socket[_0x1b93('0xd8')](_0x1b93('0xdb'),{'UserId':Number(_0x190fc1['query'][_0x1b93('0x69')][_0x5842d9]),'SmsAccountId':Number(_0x190fc1[_0x1b93('0x56')]['id'])});}}else{socket['emit'](_0x1b93('0xdb'),{'UserId':Number(_0x190fc1[_0x1b93('0x41')]['ids']),'SmsAccountId':Number(_0x190fc1[_0x1b93('0x56')]['id'])});}});}})[_0x1b93('0x33')](respondWithStatusCode(_0x490c52,null))['catch'](handleError(_0x490c52,null));};exports[_0x1b93('0xdc')]=function(_0x4fac56,_0x52cd07,_0x2b5bd0){var _0x4235f9={};var _0x5265e5={};var _0x5b1f93;var _0x87d318;return db[_0x1b93('0x3d')]['findOne']({'where':{'id':_0x4fac56['params']['id']}})['then'](handleEntityNotFound(_0x52cd07,null))['then'](function(_0xd9e0a2){if(_0xd9e0a2){_0x5b1f93=_0xd9e0a2;_0x5265e5['model']=_['keys'](db[_0x1b93('0xb8')][_0x1b93('0x3e')]);_0x5265e5[_0x1b93('0x41')]=_[_0x1b93('0x42')](_0x4fac56[_0x1b93('0x41')]);_0x5265e5[_0x1b93('0x43')]=_[_0x1b93('0x44')](_0x5265e5[_0x1b93('0x40')],_0x5265e5['query']);_0x4235f9[_0x1b93('0x45')]=_[_0x1b93('0x44')](_0x5265e5[_0x1b93('0x40')],qs[_0x1b93('0x46')](_0x4fac56['query']['fields']));_0x4235f9[_0x1b93('0x45')]=_0x4235f9[_0x1b93('0x45')]['length']?_0x4235f9[_0x1b93('0x45')]:_0x5265e5[_0x1b93('0x40')];_0x4235f9[_0x1b93('0x49')]=qs[_0x1b93('0x4a')](_0x4fac56[_0x1b93('0x41')][_0x1b93('0x4a')]);_0x4235f9[_0x1b93('0x4b')]=qs['filters'](_['pick'](_0x4fac56[_0x1b93('0x41')],_0x5265e5[_0x1b93('0x43')]));if(_0x4fac56['query']['filter']){_0x4235f9[_0x1b93('0x4b')]=_[_0x1b93('0x4f')](_0x4235f9[_0x1b93('0x4b')],{'$or':_[_0x1b93('0x3c')](_0x4235f9[_0x1b93('0x45')],function(_0x296d77){var _0x42bb5c={};_0x42bb5c[_0x296d77]={'$like':'%'+_0x4fac56[_0x1b93('0x41')][_0x1b93('0x4d')]+'%'};return _0x42bb5c;})});}_0x4235f9=_[_0x1b93('0x4f')]({},_0x4235f9,_0x4fac56[_0x1b93('0x50')]);return _0x5b1f93['getAgents'](_0x4235f9);}})[_0x1b93('0x33')](function(_0x16f5dd){if(_0x16f5dd){_0x87d318=_0x16f5dd[_0x1b93('0x47')];if(!_0x4fac56['query']['hasOwnProperty']('nolimit')){_0x4235f9[_0x1b93('0x2d')]=qs[_0x1b93('0x2d')](_0x4fac56[_0x1b93('0x41')][_0x1b93('0x2d')]);_0x4235f9[_0x1b93('0x2b')]=qs[_0x1b93('0x2b')](_0x4fac56[_0x1b93('0x41')][_0x1b93('0x2b')]);}return _0x5b1f93[_0x1b93('0xdc')](_0x4235f9);}})[_0x1b93('0x33')](function(_0x52aff0){if(_0x52aff0){return _0x52aff0?{'count':_0x87d318,'rows':_0x52aff0}:null;}})[_0x1b93('0x33')](respondWithResult(_0x52cd07,null))['catch'](handleError(_0x52cd07,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 8468f27..3489980 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 _0x608e=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x39daa5,_0x5e9e53){var _0x347722=function(_0x2d1817){while(--_0x2d1817){_0x39daa5['push'](_0x39daa5['shift']());}};_0x347722(++_0x5e9e53);}(_0x608e,0x16e));var _0xe608=function(_0x26768d,_0x21107a){_0x26768d=_0x26768d-0x0;var _0x4cc6a3=_0x608e[_0x26768d];return _0x4cc6a3;};'use strict';var EventEmitter=require(_0xe608('0x0'));var SmsAccount=require(_0xe608('0x1'))['db'][_0xe608('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe608('0x3')](0x0);var events={'afterCreate':_0xe608('0x4'),'afterUpdate':_0xe608('0x5'),'afterDestroy':'remove'};function emitEvent(_0x50d7e2){return function(_0x434485,_0x3628a3,_0x55d885){SmsAccountEvents[_0xe608('0x6')](_0x50d7e2+':'+_0x434485['id'],_0x434485);SmsAccountEvents['emit'](_0x50d7e2,_0x434485);_0x55d885(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xe608('0x7')](e,emitEvent(event));}}module[_0xe608('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xd107=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x2540db,_0x9b7318){var _0xbf6e9f=function(_0x5be1c6){while(--_0x5be1c6){_0x2540db['push'](_0x2540db['shift']());}};_0xbf6e9f(++_0x9b7318);}(_0xd107,0x7c));var _0x7d10=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd107[_0x46e363];return _0x3fb059;};'use strict';var EventEmitter=require(_0x7d10('0x0'));var SmsAccount=require(_0x7d10('0x1'))['db'][_0x7d10('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7d10('0x3')](0x0);var events={'afterCreate':_0x7d10('0x4'),'afterUpdate':_0x7d10('0x5'),'afterDestroy':_0x7d10('0x6')};function emitEvent(_0x33a859){return function(_0x74d50d,_0x430de7,_0x5c8867){SmsAccountEvents[_0x7d10('0x7')](_0x33a859+':'+_0x74d50d['id'],_0x74d50d);SmsAccountEvents[_0x7d10('0x7')](_0x33a859,_0x74d50d);_0x5c8867(null);};}for(var e in events){if(events[_0x7d10('0x8')](e)){var event=events[e];SmsAccount[_0x7d10('0x9')](e,emitEvent(event));}}module[_0x7d10('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 06e5546..40a84c7 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 _0x66e6=['util','../../config/logger','api','moment','path','rimraf','./smsAccount.attributes','SmsAccount','sms_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66e6,0x77));var _0x666e=function(_0x3331da,_0x5d58b4){_0x3331da=_0x3331da-0x0;var _0x2df004=_0x66e6[_0x3331da];return _0x2df004;};'use strict';var _=require(_0x666e('0x0'));var util=require(_0x666e('0x1'));var logger=require(_0x666e('0x2'))(_0x666e('0x3'));var moment=require(_0x666e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x666e('0x5'));var rimraf=require(_0x666e('0x6'));var config=require('../../config/environment');var attributes=require(_0x666e('0x7'));module['exports']=function(_0x5932c0,_0x4ba02e){return _0x5932c0['define'](_0x666e('0x8'),attributes,{'tableName':_0x666e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5543=['util','../../config/logger','api','moment','request-promise','path','rimraf','define','SmsAccount','sms_accounts','lodash'];(function(_0x292940,_0x4e0674){var _0xb80ed8=function(_0x5d0adb){while(--_0x5d0adb){_0x292940['push'](_0x292940['shift']());}};_0xb80ed8(++_0x4e0674);}(_0x5543,0x1b7));var _0x3554=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x5543[_0x17406e];return _0x2bfc5a;};'use strict';var _=require(_0x3554('0x0'));var util=require(_0x3554('0x1'));var logger=require(_0x3554('0x2'))(_0x3554('0x3'));var moment=require(_0x3554('0x4'));var BPromise=require('bluebird');var rp=require(_0x3554('0x5'));var fs=require('fs');var path=require(_0x3554('0x6'));var rimraf=require(_0x3554('0x7'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x516d84,_0x4f2983){return _0x516d84[_0x3554('0x8')](_0x3554('0x9'),attributes,{'tableName':_0x3554('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 3b9f41a..2b51daf 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 _0x0416=['then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','attributes','model','map','include','debug','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','register','request'];(function(_0x561f29,_0x465d8a){var _0x498c76=function(_0x556c30){while(--_0x556c30){_0x561f29['push'](_0x561f29['shift']());}};_0x498c76(++_0x465d8a);}(_0x0416,0x15d));var _0x6041=function(_0x452de8,_0x5a7fe7){_0x452de8=_0x452de8-0x0;var _0x3dd306=_0x0416[_0x452de8];return _0x3dd306;};'use strict';var _=require('lodash');var util=require(_0x6041('0x0'));var moment=require(_0x6041('0x1'));var BPromise=require(_0x6041('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6041('0x3'));var db=require(_0x6041('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6041('0x5'));var config=require(_0x6041('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6041('0x7')]({'port':0x232a});config['redis']=_[_0x6041('0x8')](config['redis'],{'host':_0x6041('0x9'),'port':0x18eb});var socket=require(_0x6041('0xa'))(new Redis(config[_0x6041('0xb')]));require('./smsAccount.socket')[_0x6041('0xc')](socket);function respondWithRpcPromise(_0x14369b,_0x443d5c,_0x30007e){return new BPromise(function(_0x42817c,_0x1403a5){return client[_0x6041('0xd')](_0x14369b,_0x30007e)[_0x6041('0xe')](function(_0xcc7465){logger[_0x6041('0xf')](_0x6041('0x10'),_0x443d5c,_0x6041('0x11'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x443d5c,_0x6041('0x11'),JSON[_0x6041('0x12')](_0xcc7465));if(_0xcc7465[_0x6041('0x13')]){if(_0xcc7465[_0x6041('0x13')][_0x6041('0x14')]===0x1f4){logger[_0x6041('0x13')]('SmsAccount,\x20%s,\x20%s',_0x443d5c,_0xcc7465[_0x6041('0x13')]['message']);return _0x1403a5(_0xcc7465[_0x6041('0x13')][_0x6041('0x15')]);}logger[_0x6041('0x13')](_0x6041('0x10'),_0x443d5c,_0xcc7465[_0x6041('0x13')][_0x6041('0x15')]);return _0x42817c(_0xcc7465[_0x6041('0x13')][_0x6041('0x15')]);}else{logger[_0x6041('0xf')](_0x6041('0x10'),_0x443d5c,_0x6041('0x11'));_0x42817c(_0xcc7465[_0x6041('0x16')][_0x6041('0x15')]);}})[_0x6041('0x17')](function(_0x42ba7b){logger[_0x6041('0x13')](_0x6041('0x10'),_0x443d5c,_0x42ba7b);_0x1403a5(_0x42ba7b);});});}exports[_0x6041('0x18')]=function(_0x5a94d7){var _0x5d3d20=this;return new Promise(function(_0x394b97,_0x1e71ff){return db['SmsAccount'][_0x6041('0x19')]({'raw':_0x5a94d7[_0x6041('0x1a')]?_0x5a94d7['options'][_0x6041('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a94d7[_0x6041('0x1a')]?_0x5a94d7['options']['where']||null:null,'attributes':_0x5a94d7[_0x6041('0x1a')]?_0x5a94d7['options'][_0x6041('0x1c')]||null:null,'include':_0x5a94d7[_0x6041('0x1a')]?_0x5a94d7[_0x6041('0x1a')]['include']?_['map'](_0x5a94d7['options']['include'],function(_0x1a061e){return{'model':db[_0x1a061e[_0x6041('0x1d')]],'as':_0x1a061e['as'],'attributes':_0x1a061e[_0x6041('0x1c')],'include':_0x1a061e['include']?_[_0x6041('0x1e')](_0x1a061e[_0x6041('0x1f')],function(_0x14a89d){return{'model':db[_0x14a89d[_0x6041('0x1d')]],'as':_0x14a89d['as'],'attributes':_0x14a89d['attributes'],'include':_0x14a89d['include']?_[_0x6041('0x1e')](_0x14a89d[_0x6041('0x1f')],function(_0x535bf3){return{'model':db[_0x535bf3['model']],'as':_0x535bf3['as'],'attributes':_0x535bf3[_0x6041('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6041('0xe')](function(_0x256b21){logger[_0x6041('0xf')](_0x6041('0x18'),_0x5a94d7);logger[_0x6041('0x20')]('ShowSmsAccount',_0x5a94d7,JSON[_0x6041('0x12')](_0x256b21));_0x394b97(_0x256b21);})[_0x6041('0x17')](function(_0x317c36){logger[_0x6041('0x13')]('ShowSmsAccount',_0x317c36[_0x6041('0x15')],_0x5a94d7);_0x1e71ff(_0x5d3d20[_0x6041('0x13')](0x1f4,_0x317c36[_0x6041('0x15')]));});});}; \ No newline at end of file +var _0x2342=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','redis','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','model','map','lodash','util'];(function(_0x598310,_0x30648f){var _0x1e383d=function(_0x19f592){while(--_0x19f592){_0x598310['push'](_0x598310['shift']());}};_0x1e383d(++_0x30648f);}(_0x2342,0xd0));var _0x2234=function(_0x44e4c9,_0x2ca1f4){_0x44e4c9=_0x44e4c9-0x0;var _0x507154=_0x2342[_0x44e4c9];return _0x507154;};'use strict';var _=require(_0x2234('0x0'));var util=require(_0x2234('0x1'));var moment=require(_0x2234('0x2'));var BPromise=require('bluebird');var rs=require(_0x2234('0x3'));var fs=require('fs');var Redis=require(_0x2234('0x4'));var db=require(_0x2234('0x5'))['db'];var utils=require(_0x2234('0x6'));var logger=require('../../config/logger')(_0x2234('0x7'));var config=require(_0x2234('0x8'));var jayson=require(_0x2234('0x9'));var client=jayson['client'][_0x2234('0xa')]({'port':0x232a});config['redis']=_[_0x2234('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2234('0xc'))(new Redis(config[_0x2234('0xd')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x260a95,_0x5d56af,_0x463342){return new BPromise(function(_0x2784c1,_0x1ff76a){return client[_0x2234('0xe')](_0x260a95,_0x463342)[_0x2234('0xf')](function(_0x266f42){logger[_0x2234('0x10')](_0x2234('0x11'),_0x5d56af,_0x2234('0x12'));logger[_0x2234('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5d56af,_0x2234('0x12'),JSON[_0x2234('0x14')](_0x266f42));if(_0x266f42[_0x2234('0x15')]){if(_0x266f42[_0x2234('0x15')][_0x2234('0x16')]===0x1f4){logger['error'](_0x2234('0x11'),_0x5d56af,_0x266f42[_0x2234('0x15')][_0x2234('0x17')]);return _0x1ff76a(_0x266f42[_0x2234('0x15')][_0x2234('0x17')]);}logger[_0x2234('0x15')]('SmsAccount,\x20%s,\x20%s',_0x5d56af,_0x266f42[_0x2234('0x15')][_0x2234('0x17')]);return _0x2784c1(_0x266f42['error'][_0x2234('0x17')]);}else{logger[_0x2234('0x10')]('SmsAccount,\x20%s,\x20%s',_0x5d56af,_0x2234('0x12'));_0x2784c1(_0x266f42[_0x2234('0x18')][_0x2234('0x17')]);}})[_0x2234('0x19')](function(_0x4386d3){logger['error'](_0x2234('0x11'),_0x5d56af,_0x4386d3);_0x1ff76a(_0x4386d3);});});}exports[_0x2234('0x1a')]=function(_0x2ed47c){var _0x2a3e76=this;return new Promise(function(_0x55dd12,_0x3de480){return db[_0x2234('0x1b')][_0x2234('0x1c')]({'raw':_0x2ed47c[_0x2234('0x1d')]?_0x2ed47c['options'][_0x2234('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ed47c[_0x2234('0x1d')]?_0x2ed47c[_0x2234('0x1d')]['where']||null:null,'attributes':_0x2ed47c[_0x2234('0x1d')]?_0x2ed47c[_0x2234('0x1d')][_0x2234('0x1f')]||null:null,'include':_0x2ed47c[_0x2234('0x1d')]?_0x2ed47c[_0x2234('0x1d')][_0x2234('0x20')]?_['map'](_0x2ed47c[_0x2234('0x1d')][_0x2234('0x20')],function(_0x5555b8){return{'model':db[_0x5555b8[_0x2234('0x21')]],'as':_0x5555b8['as'],'attributes':_0x5555b8[_0x2234('0x1f')],'include':_0x5555b8[_0x2234('0x20')]?_[_0x2234('0x22')](_0x5555b8[_0x2234('0x20')],function(_0x4a39fa){return{'model':db[_0x4a39fa[_0x2234('0x21')]],'as':_0x4a39fa['as'],'attributes':_0x4a39fa[_0x2234('0x1f')],'include':_0x4a39fa[_0x2234('0x20')]?_['map'](_0x4a39fa['include'],function(_0x1f376b){return{'model':db[_0x1f376b[_0x2234('0x21')]],'as':_0x1f376b['as'],'attributes':_0x1f376b[_0x2234('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2234('0xf')](function(_0xdb3ae7){logger[_0x2234('0x10')](_0x2234('0x1a'),_0x2ed47c);logger[_0x2234('0x13')](_0x2234('0x1a'),_0x2ed47c,JSON[_0x2234('0x14')](_0xdb3ae7));_0x55dd12(_0xdb3ae7);})[_0x2234('0x19')](function(_0x5be69d){logger[_0x2234('0x15')](_0x2234('0x1a'),_0x5be69d[_0x2234('0x17')],_0x2ed47c);_0x3de480(_0x2a3e76['error'](0x1f4,_0x5be69d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 12521e0..54d99c3 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 _0x4dfc=['emit','smsAccount:','update'];(function(_0xcf3ff1,_0x2dcb3d){var _0x2cc0ce=function(_0x5378e4){while(--_0x5378e4){_0xcf3ff1['push'](_0xcf3ff1['shift']());}};_0x2cc0ce(++_0x2dcb3d);}(_0x4dfc,0xda));var _0xc4df=function(_0x502ca3,_0x36be36){_0x502ca3=_0x502ca3-0x0;var _0x27f42c=_0x4dfc[_0x502ca3];return _0x27f42c;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save','remove',_0xc4df('0x0')];function createListener(_0x161fcd,_0x3571ba){return function(_0x18ec70){_0x3571ba[_0xc4df('0x1')](_0x161fcd,_0x18ec70);};}function removeListener(_0x254490,_0x29c2ba){return function(){SmsAccountEvents['removeListener'](_0x254490,_0x29c2ba);};}exports['register']=function(_0x5814de){for(var _0x27d2b2=0x0,_0x269c26=events['length'];_0x27d2b2<_0x269c26;_0x27d2b2++){var _0x430aee=events[_0x27d2b2];var _0xfa8c5c=createListener(_0xc4df('0x2')+_0x430aee,_0x5814de);SmsAccountEvents['on'](_0x430aee,_0xfa8c5c);}}; \ No newline at end of file +var _0x624d=['register','length','smsAccount:','remove','update'];(function(_0x544138,_0x565be0){var _0x1fcc1a=function(_0x2db7dc){while(--_0x2db7dc){_0x544138['push'](_0x544138['shift']());}};_0x1fcc1a(++_0x565be0);}(_0x624d,0xbc));var _0xd624=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x624d[_0x49ca18];return _0x145d54;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0xd624('0x0'),_0xd624('0x1')];function createListener(_0x5d91f5,_0x49b3a2){return function(_0x285692){_0x49b3a2['emit'](_0x5d91f5,_0x285692);};}function removeListener(_0x1be98e,_0x25e2a8){return function(){SmsAccountEvents['removeListener'](_0x1be98e,_0x25e2a8);};}exports[_0xd624('0x2')]=function(_0x316883){for(var _0x5c3c71=0x0,_0x4a8caf=events[_0xd624('0x3')];_0x5c3c71<_0x4a8caf;_0x5c3c71++){var _0xd6aa13=events[_0x5c3c71];var _0x1f38a8=createListener(_0xd624('0x4')+_0xd6aa13,_0x316883);SmsAccountEvents['on'](_0xd6aa13,_0x1f38a8);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 0e468a5..aa99c45 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 _0x82e6=['create','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x3aa5df,_0x336f31){var _0x1effe0=function(_0x39218e){while(--_0x39218e){_0x3aa5df['push'](_0x3aa5df['shift']());}};_0x1effe0(++_0x336f31);}(_0x82e6,0x94));var _0x682e=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0x82e6[_0x4cfa2e];return _0x279b50;};'use strict';var multer=require('multer');var util=require(_0x682e('0x0'));var path=require(_0x682e('0x1'));var timeout=require(_0x682e('0x2'));var express=require('express');var router=express[_0x682e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x682e('0x4'));var interaction=require(_0x682e('0x5'));var config=require(_0x682e('0x6'));var controller=require('./smsApplication.controller');router[_0x682e('0x7')]('/',auth[_0x682e('0x8')](),controller[_0x682e('0x9')]);router['get'](_0x682e('0xa'),auth[_0x682e('0x8')](),controller['show']);router[_0x682e('0xb')]('/',auth[_0x682e('0x8')](),controller[_0x682e('0xc')]);router['put'](_0x682e('0xa'),auth[_0x682e('0x8')](),controller['update']);router[_0x682e('0xd')]('/:id',auth[_0x682e('0x8')](),controller[_0x682e('0xe')]);module[_0x682e('0xf')]=router; \ No newline at end of file +var _0x7834=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated','get','/:id','post','create','put','delete','destroy','exports','util','express'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x7834,0x1ee));var _0x4783=function(_0x1b7707,_0x2a84e1){_0x1b7707=_0x1b7707-0x0;var _0x985bbd=_0x7834[_0x1b7707];return _0x985bbd;};'use strict';var multer=require('multer');var util=require(_0x4783('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4783('0x1'));var router=express['Router']();var fs_extra=require(_0x4783('0x2'));var auth=require(_0x4783('0x3'));var interaction=require(_0x4783('0x4'));var config=require(_0x4783('0x5'));var controller=require(_0x4783('0x6'));router['get']('/',auth[_0x4783('0x7')](),controller['index']);router[_0x4783('0x8')](_0x4783('0x9'),auth[_0x4783('0x7')](),controller['show']);router[_0x4783('0xa')]('/',auth[_0x4783('0x7')](),controller[_0x4783('0xb')]);router[_0x4783('0xc')](_0x4783('0x9'),auth[_0x4783('0x7')](),controller['update']);router[_0x4783('0xd')](_0x4783('0x9'),auth['isAuthenticated'](),controller[_0x4783('0xe')]);module[_0x4783('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d543140..e12f264 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 _0x653f=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x5f0ea6,_0x4245c7){var _0x324271=function(_0x443494){while(--_0x443494){_0x5f0ea6['push'](_0x5f0ea6['shift']());}};_0x324271(++_0x4245c7);}(_0x653f,0x113));var _0xf653=function(_0x554426,_0x1c6d02){_0x554426=_0x554426-0x0;var _0x56d296=_0x653f[_0x554426];return _0x56d296;};'use strict';var Sequelize=require(_0xf653('0x0'));module[_0xf653('0x1')]={'priority':{'type':Sequelize[_0xf653('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf653('0x3')],'allowNull':![],'defaultValue':_0xf653('0x4')},'appdata':{'type':Sequelize[_0xf653('0x5')]()},'description':{'type':Sequelize[_0xf653('0x3')]},'interval':{'type':Sequelize[_0xf653('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfb0a=['STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x318bea,_0x388c3a){var _0x1d03a8=function(_0x2d5509){while(--_0x2d5509){_0x318bea['push'](_0x318bea['shift']());}};_0x1d03a8(++_0x388c3a);}(_0xfb0a,0xd2));var _0xafb0=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xfb0a[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0xafb0('0x0'));module['exports']={'priority':{'type':Sequelize[_0xafb0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xafb0('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xafb0('0x2')]},'interval':{'type':Sequelize[_0xafb0('0x2')],'defaultValue':_0xafb0('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 67605f5..f3dc572 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 _0xd05d=['fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','offset','limit','undefined','count','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xd05d,0xe6));var _0xdd05=function(_0x234677,_0x19baec){_0x234677=_0x234677-0x0;var _0x47ec4f=_0xd05d[_0x234677];return _0x47ec4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd05('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd05('0x1'));var rp=require(_0xdd05('0x2'));var moment=require(_0xdd05('0x3'));var BPromise=require(_0xdd05('0x4'));var Mustache=require(_0xdd05('0x5'));var util=require(_0xdd05('0x6'));var path=require(_0xdd05('0x7'));var sox=require('sox');var csv=require(_0xdd05('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd05('0x9'));var crypto=require(_0xdd05('0xa'));var jsforce=require(_0xdd05('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd05('0x8'));var querystring=require(_0xdd05('0xc'));var Papa=require(_0xdd05('0xd'));var Redis=require('ioredis');var authService=require(_0xdd05('0xe'));var qs=require(_0xdd05('0xf'));var as=require(_0xdd05('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd05('0x11'))(_0xdd05('0x12'));var utils=require(_0xdd05('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e1e14,_0x18a792){_0x18a792=_0x18a792||0xcc;return function(_0x271042){if(_0x271042){return _0x5e1e14[_0xdd05('0x14')](_0x18a792);}return _0x5e1e14[_0xdd05('0x15')](_0x18a792)['end']();};}function respondWithResult(_0x17fca0,_0x437ed3){_0x437ed3=_0x437ed3||0xc8;return function(_0x3f1c65){if(_0x3f1c65){return _0x17fca0[_0xdd05('0x15')](_0x437ed3)['json'](_0x3f1c65);}};}function respondWithFilteredResult(_0x22d835,_0x48335c){return function(_0xa4248d){if(_0xa4248d){var _0x4ae8db=typeof _0x48335c[_0xdd05('0x16')]==='undefined'&&typeof _0x48335c[_0xdd05('0x17')]===_0xdd05('0x18');var _0x279990=_0xa4248d['count'];var _0xaf2ac5=_0x4ae8db?0x0:_0x48335c['offset'];var _0x44b8e5=_0x4ae8db?_0xa4248d[_0xdd05('0x19')]:_0x48335c[_0xdd05('0x16')]+_0x48335c[_0xdd05('0x17')];var _0x1beb3a;if(_0x44b8e5>=_0x279990){_0x44b8e5=_0x279990;_0x1beb3a=0xc8;}else{_0x1beb3a=0xce;}_0x22d835['status'](_0x1beb3a);return _0x22d835[_0xdd05('0x1a')]('Content-Range',_0xaf2ac5+'-'+_0x44b8e5+'/'+_0x279990)['json'](_0xa4248d);}return null;};}function patchUpdates(_0x5e4ab4){return function(_0x240f9a){try{jsonpatch['apply'](_0x240f9a,_0x5e4ab4,!![]);}catch(_0x1ef291){return BPromise[_0xdd05('0x1b')](_0x1ef291);}return _0x240f9a[_0xdd05('0x1c')]();};}function saveUpdates(_0x491cde,_0x2ef844){return function(_0x26cfd3){if(_0x26cfd3){return _0x26cfd3[_0xdd05('0x1d')](_0x491cde)[_0xdd05('0x1e')](function(_0x2d6b77){return _0x2d6b77;});}return null;};}function removeEntity(_0x19f822,_0x4f8c9a){return function(_0x11a8f3){if(_0x11a8f3){return _0x11a8f3[_0xdd05('0x1f')]()[_0xdd05('0x1e')](function(){_0x19f822['status'](0xcc)[_0xdd05('0x20')]();});}};}function handleEntityNotFound(_0x4c6047,_0x32b2b9){return function(_0x1620c4){if(!_0x1620c4){_0x4c6047['sendStatus'](0x194);}return _0x1620c4;};}function handleError(_0x43796d,_0x1213d8){_0x1213d8=_0x1213d8||0x1f4;return function(_0x1a66dd){logger[_0xdd05('0x21')](_0x1a66dd[_0xdd05('0x22')]);if(_0x1a66dd['name']){delete _0x1a66dd[_0xdd05('0x23')];}_0x43796d[_0xdd05('0x15')](_0x1213d8)[_0xdd05('0x24')](_0x1a66dd);};}exports[_0xdd05('0x25')]=function(_0x5c4f8d,_0x1eceea){var _0x4bc484={},_0x116a65={},_0x3d7d95={'count':0x0,'rows':[]};var _0x3d3844=_[_0xdd05('0x26')](db[_0xdd05('0x27')][_0xdd05('0x28')],function(_0x3a689c){return{'name':_0x3a689c[_0xdd05('0x29')],'type':_0x3a689c[_0xdd05('0x2a')][_0xdd05('0x2b')]};});_0x116a65['model']=_[_0xdd05('0x26')](_0x3d3844,_0xdd05('0x23'));_0x116a65['query']=_[_0xdd05('0x2c')](_0x5c4f8d[_0xdd05('0x2d')]);_0x116a65[_0xdd05('0x2e')]=_[_0xdd05('0x2f')](_0x116a65[_0xdd05('0x30')],_0x116a65[_0xdd05('0x2d')]);_0x4bc484[_0xdd05('0x31')]=_[_0xdd05('0x2f')](_0x116a65[_0xdd05('0x30')],qs[_0xdd05('0x32')](_0x5c4f8d[_0xdd05('0x2d')][_0xdd05('0x32')]));_0x4bc484[_0xdd05('0x31')]=_0x4bc484[_0xdd05('0x31')]['length']?_0x4bc484[_0xdd05('0x31')]:_0x116a65[_0xdd05('0x30')];if(!_0x5c4f8d[_0xdd05('0x2d')]['hasOwnProperty'](_0xdd05('0x33'))){_0x4bc484[_0xdd05('0x17')]=qs['limit'](_0x5c4f8d['query'][_0xdd05('0x17')]);_0x4bc484[_0xdd05('0x16')]=qs[_0xdd05('0x16')](_0x5c4f8d['query'][_0xdd05('0x16')]);}_0x4bc484[_0xdd05('0x34')]=qs[_0xdd05('0x35')](_0x5c4f8d[_0xdd05('0x2d')][_0xdd05('0x35')]);_0x4bc484[_0xdd05('0x36')]=qs[_0xdd05('0x2e')](_[_0xdd05('0x37')](_0x5c4f8d[_0xdd05('0x2d')],_0x116a65[_0xdd05('0x2e')]),_0x3d3844);if(_0x5c4f8d['query'][_0xdd05('0x38')]){_0x4bc484['where']=_[_0xdd05('0x39')](_0x4bc484['where'],{'$or':_[_0xdd05('0x26')](_0x3d3844,function(_0x584a7f){if(_0x584a7f[_0xdd05('0x2a')]!==_0xdd05('0x3a')){var _0x520a68={};_0x520a68[_0x584a7f[_0xdd05('0x23')]]={'$like':'%'+_0x5c4f8d['query'][_0xdd05('0x38')]+'%'};return _0x520a68;}})});}_0x4bc484=_[_0xdd05('0x39')]({},_0x4bc484,_0x5c4f8d['options']);var _0x3f17aa={'where':_0x4bc484[_0xdd05('0x36')]};return db[_0xdd05('0x27')][_0xdd05('0x19')](_0x3f17aa)[_0xdd05('0x1e')](function(_0xbc8e4b){_0x3d7d95[_0xdd05('0x19')]=_0xbc8e4b;if(_0x5c4f8d['query'][_0xdd05('0x3b')]){_0x4bc484[_0xdd05('0x3c')]=[{'all':!![]}];}return db[_0xdd05('0x27')][_0xdd05('0x3d')](_0x4bc484);})[_0xdd05('0x1e')](function(_0x4e5b0f){_0x3d7d95[_0xdd05('0x3e')]=_0x4e5b0f;return _0x3d7d95;})[_0xdd05('0x1e')](respondWithFilteredResult(_0x1eceea,_0x4bc484))['catch'](handleError(_0x1eceea,null));};exports[_0xdd05('0x3f')]=function(_0x5eb0b8,_0x1eee3e){var _0xa425d7={'raw':!![],'where':{'id':_0x5eb0b8['params']['id']}},_0x4e563b={};_0x4e563b[_0xdd05('0x30')]=_[_0xdd05('0x2c')](db[_0xdd05('0x27')][_0xdd05('0x28')]);_0x4e563b[_0xdd05('0x2d')]=_[_0xdd05('0x2c')](_0x5eb0b8[_0xdd05('0x2d')]);_0x4e563b['filters']=_[_0xdd05('0x2f')](_0x4e563b['model'],_0x4e563b['query']);_0xa425d7[_0xdd05('0x31')]=_[_0xdd05('0x2f')](_0x4e563b['model'],qs[_0xdd05('0x32')](_0x5eb0b8['query'][_0xdd05('0x32')]));_0xa425d7['attributes']=_0xa425d7['attributes']['length']?_0xa425d7[_0xdd05('0x31')]:_0x4e563b['model'];if(_0x5eb0b8[_0xdd05('0x2d')]['includeAll']){_0xa425d7[_0xdd05('0x3c')]=[{'all':!![]}];}_0xa425d7=_[_0xdd05('0x39')]({},_0xa425d7,_0x5eb0b8[_0xdd05('0x40')]);return db[_0xdd05('0x27')][_0xdd05('0x41')](_0xa425d7)[_0xdd05('0x1e')](handleEntityNotFound(_0x1eee3e,null))[_0xdd05('0x1e')](respondWithResult(_0x1eee3e,null))[_0xdd05('0x42')](handleError(_0x1eee3e,null));};exports['create']=function(_0x3af54c,_0x23c453){return db[_0xdd05('0x27')][_0xdd05('0x43')](_0x3af54c['body'],{})[_0xdd05('0x1e')](respondWithResult(_0x23c453,0xc9))['catch'](handleError(_0x23c453,null));};exports[_0xdd05('0x1d')]=function(_0x2582df,_0x15861e){if(_0x2582df[_0xdd05('0x44')]['id']){delete _0x2582df[_0xdd05('0x44')]['id'];}return db[_0xdd05('0x27')]['find']({'where':{'id':_0x2582df['params']['id']}})[_0xdd05('0x1e')](handleEntityNotFound(_0x15861e,null))[_0xdd05('0x1e')](saveUpdates(_0x2582df[_0xdd05('0x44')],null))[_0xdd05('0x1e')](respondWithResult(_0x15861e,null))[_0xdd05('0x42')](handleError(_0x15861e,null));};exports[_0xdd05('0x1f')]=function(_0x14c1fc,_0x25ae8e){return db['SmsApplication'][_0xdd05('0x41')]({'where':{'id':_0x14c1fc[_0xdd05('0x45')]['id']}})['then'](handleEntityNotFound(_0x25ae8e,null))['then'](removeEntity(_0x25ae8e,null))['catch'](handleError(_0x25ae8e,null));}; \ No newline at end of file +var _0xb16b=['type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','fieldName'];(function(_0x4f0b46,_0x356c7d){var _0x2307e6=function(_0x40793d){while(--_0x40793d){_0x4f0b46['push'](_0x4f0b46['shift']());}};_0x2307e6(++_0x356c7d);}(_0xb16b,0x109));var _0xbb16=function(_0x3af480,_0x455eff){_0x3af480=_0x3af480-0x0;var _0x3f317a=_0xb16b[_0x3af480];return _0x3f317a;};'use strict';var emlformat=require(_0xbb16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb16('0x1'));var jsonpatch=require(_0xbb16('0x2'));var rp=require(_0xbb16('0x3'));var moment=require(_0xbb16('0x4'));var BPromise=require(_0xbb16('0x5'));var Mustache=require(_0xbb16('0x6'));var util=require(_0xbb16('0x7'));var path=require(_0xbb16('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb16('0x9'));var fs=require('fs');var fs_extra=require(_0xbb16('0xa'));var _=require(_0xbb16('0xb'));var squel=require(_0xbb16('0xc'));var crypto=require(_0xbb16('0xd'));var jsforce=require(_0xbb16('0xe'));var deskjs=require(_0xbb16('0xf'));var toCsv=require(_0xbb16('0x10'));var querystring=require(_0xbb16('0x11'));var Papa=require(_0xbb16('0x12'));var Redis=require(_0xbb16('0x13'));var authService=require(_0xbb16('0x14'));var qs=require(_0xbb16('0x15'));var as=require(_0xbb16('0x16'));var hardwareService=require(_0xbb16('0x17'));var logger=require(_0xbb16('0x18'))(_0xbb16('0x19'));var utils=require(_0xbb16('0x1a'));var config=require(_0xbb16('0x1b'));var licenseUtil=require(_0xbb16('0x1c'));var db=require(_0xbb16('0x1d'))['db'];function respondWithStatusCode(_0x179ed0,_0xf0426c){_0xf0426c=_0xf0426c||0xcc;return function(_0x404df6){if(_0x404df6){return _0x179ed0['sendStatus'](_0xf0426c);}return _0x179ed0[_0xbb16('0x1e')](_0xf0426c)[_0xbb16('0x1f')]();};}function respondWithResult(_0x5f3fb5,_0x6b461){_0x6b461=_0x6b461||0xc8;return function(_0x3e8bcf){if(_0x3e8bcf){return _0x5f3fb5[_0xbb16('0x1e')](_0x6b461)[_0xbb16('0x20')](_0x3e8bcf);}};}function respondWithFilteredResult(_0x512c43,_0x3f02e9){return function(_0x4812d2){if(_0x4812d2){var _0x8b5283=typeof _0x3f02e9[_0xbb16('0x21')]===_0xbb16('0x22')&&typeof _0x3f02e9[_0xbb16('0x23')]===_0xbb16('0x22');var _0x4b34a1=_0x4812d2[_0xbb16('0x24')];var _0x257507=_0x8b5283?0x0:_0x3f02e9[_0xbb16('0x21')];var _0xfde63=_0x8b5283?_0x4812d2[_0xbb16('0x24')]:_0x3f02e9[_0xbb16('0x21')]+_0x3f02e9[_0xbb16('0x23')];var _0x536308;if(_0xfde63>=_0x4b34a1){_0xfde63=_0x4b34a1;_0x536308=0xc8;}else{_0x536308=0xce;}_0x512c43[_0xbb16('0x1e')](_0x536308);return _0x512c43['set'](_0xbb16('0x25'),_0x257507+'-'+_0xfde63+'/'+_0x4b34a1)['json'](_0x4812d2);}return null;};}function patchUpdates(_0x5bef4c){return function(_0x3deb3c){try{jsonpatch[_0xbb16('0x26')](_0x3deb3c,_0x5bef4c,!![]);}catch(_0x2ac125){return BPromise['reject'](_0x2ac125);}return _0x3deb3c[_0xbb16('0x27')]();};}function saveUpdates(_0x48bf69,_0x361327){return function(_0x5c9e42){if(_0x5c9e42){return _0x5c9e42[_0xbb16('0x28')](_0x48bf69)[_0xbb16('0x29')](function(_0x4f39af){return _0x4f39af;});}return null;};}function removeEntity(_0x32dda3,_0x3f5e99){return function(_0x5de078){if(_0x5de078){return _0x5de078[_0xbb16('0x2a')]()[_0xbb16('0x29')](function(){_0x32dda3['status'](0xcc)[_0xbb16('0x1f')]();});}};}function handleEntityNotFound(_0x483063,_0xd04768){return function(_0x34d8c2){if(!_0x34d8c2){_0x483063['sendStatus'](0x194);}return _0x34d8c2;};}function handleError(_0x23da6d,_0x11fb41){_0x11fb41=_0x11fb41||0x1f4;return function(_0x33d9c7){logger[_0xbb16('0x2b')](_0x33d9c7[_0xbb16('0x2c')]);if(_0x33d9c7[_0xbb16('0x2d')]){delete _0x33d9c7[_0xbb16('0x2d')];}_0x23da6d[_0xbb16('0x1e')](_0x11fb41)[_0xbb16('0x2e')](_0x33d9c7);};}exports[_0xbb16('0x2f')]=function(_0xc4c86d,_0x5dd501){var _0x43452f={},_0x94eb51={},_0x333811={'count':0x0,'rows':[]};var _0x2dab70=_[_0xbb16('0x30')](db[_0xbb16('0x31')]['rawAttributes'],function(_0x1edb30){return{'name':_0x1edb30[_0xbb16('0x32')],'type':_0x1edb30[_0xbb16('0x33')][_0xbb16('0x34')]};});_0x94eb51['model']=_[_0xbb16('0x30')](_0x2dab70,_0xbb16('0x2d'));_0x94eb51[_0xbb16('0x35')]=_[_0xbb16('0x36')](_0xc4c86d[_0xbb16('0x35')]);_0x94eb51['filters']=_[_0xbb16('0x37')](_0x94eb51[_0xbb16('0x38')],_0x94eb51[_0xbb16('0x35')]);_0x43452f[_0xbb16('0x39')]=_[_0xbb16('0x37')](_0x94eb51[_0xbb16('0x38')],qs[_0xbb16('0x3a')](_0xc4c86d[_0xbb16('0x35')][_0xbb16('0x3a')]));_0x43452f[_0xbb16('0x39')]=_0x43452f[_0xbb16('0x39')]['length']?_0x43452f[_0xbb16('0x39')]:_0x94eb51[_0xbb16('0x38')];if(!_0xc4c86d[_0xbb16('0x35')][_0xbb16('0x3b')]('nolimit')){_0x43452f[_0xbb16('0x23')]=qs['limit'](_0xc4c86d[_0xbb16('0x35')][_0xbb16('0x23')]);_0x43452f[_0xbb16('0x21')]=qs[_0xbb16('0x21')](_0xc4c86d[_0xbb16('0x35')][_0xbb16('0x21')]);}_0x43452f['order']=qs[_0xbb16('0x3c')](_0xc4c86d[_0xbb16('0x35')]['sort']);_0x43452f[_0xbb16('0x3d')]=qs['filters'](_['pick'](_0xc4c86d[_0xbb16('0x35')],_0x94eb51[_0xbb16('0x3e')]),_0x2dab70);if(_0xc4c86d[_0xbb16('0x35')][_0xbb16('0x3f')]){_0x43452f[_0xbb16('0x3d')]=_[_0xbb16('0x40')](_0x43452f[_0xbb16('0x3d')],{'$or':_[_0xbb16('0x30')](_0x2dab70,function(_0x5cf86a){if(_0x5cf86a[_0xbb16('0x33')]!==_0xbb16('0x41')){var _0x5a6106={};_0x5a6106[_0x5cf86a[_0xbb16('0x2d')]]={'$like':'%'+_0xc4c86d['query'][_0xbb16('0x3f')]+'%'};return _0x5a6106;}})});}_0x43452f=_[_0xbb16('0x40')]({},_0x43452f,_0xc4c86d[_0xbb16('0x42')]);var _0x460625={'where':_0x43452f[_0xbb16('0x3d')]};return db[_0xbb16('0x31')][_0xbb16('0x24')](_0x460625)['then'](function(_0x49d7b2){_0x333811[_0xbb16('0x24')]=_0x49d7b2;if(_0xc4c86d[_0xbb16('0x35')][_0xbb16('0x43')]){_0x43452f[_0xbb16('0x44')]=[{'all':!![]}];}return db[_0xbb16('0x31')][_0xbb16('0x45')](_0x43452f);})[_0xbb16('0x29')](function(_0x5e14e0){_0x333811[_0xbb16('0x46')]=_0x5e14e0;return _0x333811;})[_0xbb16('0x29')](respondWithFilteredResult(_0x5dd501,_0x43452f))[_0xbb16('0x47')](handleError(_0x5dd501,null));};exports[_0xbb16('0x48')]=function(_0x3e3fca,_0x236c48){var _0x2c5d3d={'raw':!![],'where':{'id':_0x3e3fca[_0xbb16('0x49')]['id']}},_0x2116e1={};_0x2116e1[_0xbb16('0x38')]=_[_0xbb16('0x36')](db['SmsApplication'][_0xbb16('0x4a')]);_0x2116e1[_0xbb16('0x35')]=_[_0xbb16('0x36')](_0x3e3fca['query']);_0x2116e1[_0xbb16('0x3e')]=_[_0xbb16('0x37')](_0x2116e1[_0xbb16('0x38')],_0x2116e1[_0xbb16('0x35')]);_0x2c5d3d['attributes']=_[_0xbb16('0x37')](_0x2116e1[_0xbb16('0x38')],qs[_0xbb16('0x3a')](_0x3e3fca[_0xbb16('0x35')][_0xbb16('0x3a')]));_0x2c5d3d['attributes']=_0x2c5d3d['attributes'][_0xbb16('0x4b')]?_0x2c5d3d[_0xbb16('0x39')]:_0x2116e1[_0xbb16('0x38')];if(_0x3e3fca[_0xbb16('0x35')][_0xbb16('0x43')]){_0x2c5d3d[_0xbb16('0x44')]=[{'all':!![]}];}_0x2c5d3d=_['merge']({},_0x2c5d3d,_0x3e3fca[_0xbb16('0x42')]);return db[_0xbb16('0x31')][_0xbb16('0x4c')](_0x2c5d3d)[_0xbb16('0x29')](handleEntityNotFound(_0x236c48,null))[_0xbb16('0x29')](respondWithResult(_0x236c48,null))[_0xbb16('0x47')](handleError(_0x236c48,null));};exports['create']=function(_0xd154aa,_0x4bfcac){return db[_0xbb16('0x31')][_0xbb16('0x4d')](_0xd154aa[_0xbb16('0x4e')],{})[_0xbb16('0x29')](respondWithResult(_0x4bfcac,0xc9))[_0xbb16('0x47')](handleError(_0x4bfcac,null));};exports[_0xbb16('0x28')]=function(_0x3b18c4,_0x5b5a71){if(_0x3b18c4[_0xbb16('0x4e')]['id']){delete _0x3b18c4[_0xbb16('0x4e')]['id'];}return db['SmsApplication'][_0xbb16('0x4c')]({'where':{'id':_0x3b18c4[_0xbb16('0x49')]['id']}})[_0xbb16('0x29')](handleEntityNotFound(_0x5b5a71,null))[_0xbb16('0x29')](saveUpdates(_0x3b18c4['body'],null))['then'](respondWithResult(_0x5b5a71,null))[_0xbb16('0x47')](handleError(_0x5b5a71,null));};exports[_0xbb16('0x2a')]=function(_0x2fe371,_0x5a1e1c){return db[_0xbb16('0x31')][_0xbb16('0x4c')]({'where':{'id':_0x2fe371[_0xbb16('0x49')]['id']}})[_0xbb16('0x29')](handleEntityNotFound(_0x5a1e1c,null))[_0xbb16('0x29')](removeEntity(_0x5a1e1c,null))[_0xbb16('0x47')](handleError(_0x5a1e1c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 11197f3..def0001 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 _0xcb26=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xcb26,0x95));var _0x6cb2=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xcb26[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var util=require(_0x6cb2('0x0'));var logger=require(_0x6cb2('0x1'))(_0x6cb2('0x2'));var moment=require(_0x6cb2('0x3'));var BPromise=require(_0x6cb2('0x4'));var rp=require(_0x6cb2('0x5'));var fs=require('fs');var path=require(_0x6cb2('0x6'));var rimraf=require(_0x6cb2('0x7'));var config=require(_0x6cb2('0x8'));var attributes=require(_0x6cb2('0x9'));module[_0x6cb2('0xa')]=function(_0x4c606c,_0x47eb5a){return _0x4c606c[_0x6cb2('0xb')](_0x6cb2('0xc'),attributes,{'tableName':_0x6cb2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6cb2('0xe'),'collate':_0x6cb2('0xf')});}; \ No newline at end of file +var _0xbadb=['path','rimraf','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0xbadb,0xb0));var _0xbbad=function(_0x54568f,_0x58f796){_0x54568f=_0x54568f-0x0;var _0x582867=_0xbadb[_0x54568f];return _0x582867;};'use strict';var _=require(_0xbbad('0x0'));var util=require(_0xbbad('0x1'));var logger=require(_0xbbad('0x2'))(_0xbbad('0x3'));var moment=require('moment');var BPromise=require(_0xbbad('0x4'));var rp=require(_0xbbad('0x5'));var fs=require('fs');var path=require(_0xbbad('0x6'));var rimraf=require(_0xbbad('0x7'));var config=require(_0xbbad('0x8'));var attributes=require('./smsApplication.attributes');module[_0xbbad('0x9')]=function(_0x4f5bdd,_0x3eb329){return _0x4f5bdd['define'](_0xbbad('0xa'),attributes,{'tableName':_0xbbad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbbad('0xc'),'collate':_0xbbad('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 47bef7c..3ad6859 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 _0x0cd6=['../../config/utils','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x418060,_0xd3b3b7){var _0x21f56b=function(_0x1fd89e){while(--_0x1fd89e){_0x418060['push'](_0x418060['shift']());}};_0x21f56b(++_0xd3b3b7);}(_0x0cd6,0x113));var _0x60cd=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x0cd6[_0x2cd1fb];return _0x48fd2b;};'use strict';var _=require(_0x60cd('0x0'));var util=require(_0x60cd('0x1'));var moment=require('moment');var BPromise=require(_0x60cd('0x2'));var rs=require(_0x60cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60cd('0x4'))['db'];var utils=require(_0x60cd('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x60cd('0x6'));var jayson=require(_0x60cd('0x7'));var client=jayson[_0x60cd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x381044,_0x4b66cd,_0x1249cb){return new BPromise(function(_0x2c973,_0x160a7f){return client[_0x60cd('0x9')](_0x381044,_0x1249cb)[_0x60cd('0xa')](function(_0x3f2991){logger[_0x60cd('0xb')](_0x60cd('0xc'),_0x4b66cd,_0x60cd('0xd'));logger['debug'](_0x60cd('0xe'),_0x4b66cd,_0x60cd('0xd'),JSON['stringify'](_0x3f2991));if(_0x3f2991[_0x60cd('0xf')]){if(_0x3f2991['error'][_0x60cd('0x10')]===0x1f4){logger[_0x60cd('0xf')]('SmsApplication,\x20%s,\x20%s',_0x4b66cd,_0x3f2991[_0x60cd('0xf')][_0x60cd('0x11')]);return _0x160a7f(_0x3f2991[_0x60cd('0xf')]['message']);}logger[_0x60cd('0xf')](_0x60cd('0xc'),_0x4b66cd,_0x3f2991['error'][_0x60cd('0x11')]);return _0x2c973(_0x3f2991['error'][_0x60cd('0x11')]);}else{logger[_0x60cd('0xb')]('SmsApplication,\x20%s,\x20%s',_0x4b66cd,'request\x20sent');_0x2c973(_0x3f2991[_0x60cd('0x12')][_0x60cd('0x11')]);}})[_0x60cd('0x13')](function(_0x5d0125){logger[_0x60cd('0xf')](_0x60cd('0xc'),_0x4b66cd,_0x5d0125);_0x160a7f(_0x5d0125);});});} \ No newline at end of file +var _0x9658=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0xc6bf3b,_0x7e87f6){var _0xc3bbd8=function(_0x608338){while(--_0x608338){_0xc6bf3b['push'](_0xc6bf3b['shift']());}};_0xc3bbd8(++_0x7e87f6);}(_0x9658,0x6f));var _0x8965=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x9658[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require(_0x8965('0x0'));var util=require('util');var moment=require(_0x8965('0x1'));var BPromise=require(_0x8965('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8965('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8965('0x4'));var logger=require(_0x8965('0x5'))(_0x8965('0x6'));var config=require('../../config/environment');var jayson=require(_0x8965('0x7'));var client=jayson[_0x8965('0x8')][_0x8965('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x290f30,_0x271060,_0x27b334){return new BPromise(function(_0x1e7d61,_0xe14503){return client[_0x8965('0xa')](_0x290f30,_0x27b334)[_0x8965('0xb')](function(_0x214249){logger[_0x8965('0xc')](_0x8965('0xd'),_0x271060,_0x8965('0xe'));logger[_0x8965('0xf')](_0x8965('0x10'),_0x271060,_0x8965('0xe'),JSON[_0x8965('0x11')](_0x214249));if(_0x214249[_0x8965('0x12')]){if(_0x214249['error'][_0x8965('0x13')]===0x1f4){logger[_0x8965('0x12')](_0x8965('0xd'),_0x271060,_0x214249[_0x8965('0x12')][_0x8965('0x14')]);return _0xe14503(_0x214249[_0x8965('0x12')][_0x8965('0x14')]);}logger[_0x8965('0x12')]('SmsApplication,\x20%s,\x20%s',_0x271060,_0x214249[_0x8965('0x12')][_0x8965('0x14')]);return _0x1e7d61(_0x214249[_0x8965('0x12')][_0x8965('0x14')]);}else{logger[_0x8965('0xc')]('SmsApplication,\x20%s,\x20%s',_0x271060,_0x8965('0xe'));_0x1e7d61(_0x214249[_0x8965('0x15')][_0x8965('0x14')]);}})[_0x8965('0x16')](function(_0x5c7d55){logger[_0x8965('0x12')](_0x8965('0xd'),_0x271060,_0x5c7d55);_0xe14503(_0x5c7d55);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 311b66c..62af7ca 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 _0x7da6=['get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','sms','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x2e1ca6,_0x18faa7){var _0x584380=function(_0x4d5048){while(--_0x4d5048){_0x2e1ca6['push'](_0x2e1ca6['shift']());}};_0x584380(++_0x18faa7);}(_0x7da6,0x124));var _0x67da=function(_0xdc356f,_0x3003d0){_0xdc356f=_0xdc356f-0x0;var _0x339eaa=_0x7da6[_0xdc356f];return _0x339eaa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x67da('0x0'));var timeout=require(_0x67da('0x1'));var express=require(_0x67da('0x2'));var router=express[_0x67da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x67da('0x4'));var interaction=require(_0x67da('0x5'));var config=require(_0x67da('0x6'));var controller=require(_0x67da('0x7'));router[_0x67da('0x8')]('/',auth[_0x67da('0x9')](),controller['index']);router[_0x67da('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x67da('0xa')]);router['get'](_0x67da('0xb'),auth['isAuthenticated'](),controller[_0x67da('0xc')]);router[_0x67da('0x8')](_0x67da('0xd'),auth[_0x67da('0x9')](),controller[_0x67da('0xe')]);router[_0x67da('0x8')](_0x67da('0xf'),auth['isAuthenticated'](),controller[_0x67da('0x10')]);router[_0x67da('0x11')]('/',auth[_0x67da('0x9')](),controller[_0x67da('0x12')]);router[_0x67da('0x11')](_0x67da('0xd'),auth['isAuthenticated'](),controller[_0x67da('0x13')]);router[_0x67da('0x11')](_0x67da('0x14'),auth[_0x67da('0x9')](),interaction[_0x67da('0x15')]('sms',_0x67da('0x16')),controller[_0x67da('0x17')]);router['put'](_0x67da('0xb'),auth[_0x67da('0x9')](),interaction[_0x67da('0x15')](_0x67da('0x18'),_0x67da('0x19')),controller[_0x67da('0x1a')]);router[_0x67da('0x1b')](_0x67da('0xb'),auth['isAuthenticated'](),interaction[_0x67da('0x15')]('sms',_0x67da('0x1c')),controller['destroy']);router[_0x67da('0x1b')](_0x67da('0x14'),auth[_0x67da('0x9')](),controller[_0x67da('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xd3e3=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','delete','smsinteraction:destroy','exports','multer','util','path'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x27c08c,_0x4cc38c){_0x27c08c=_0x27c08c-0x0;var _0x138305=_0xd3e3[_0x27c08c];return _0x138305;};'use strict';var multer=require(_0x3d3e('0x0'));var util=require(_0x3d3e('0x1'));var path=require(_0x3d3e('0x2'));var timeout=require(_0x3d3e('0x3'));var express=require('express');var router=express[_0x3d3e('0x4')]();var fs_extra=require(_0x3d3e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d3e('0x6'));var config=require(_0x3d3e('0x7'));var controller=require('./smsInteraction.controller');router[_0x3d3e('0x8')]('/',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xa')]);router[_0x3d3e('0x8')](_0x3d3e('0xb'),auth['isAuthenticated'](),controller[_0x3d3e('0xc')]);router[_0x3d3e('0x8')](_0x3d3e('0xd'),auth['isAuthenticated'](),controller[_0x3d3e('0xe')]);router[_0x3d3e('0x8')](_0x3d3e('0xf'),auth[_0x3d3e('0x9')](),controller['getMessages']);router[_0x3d3e('0x8')]('/:id/download',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0x10')]);router[_0x3d3e('0x11')]('/',auth[_0x3d3e('0x9')](),controller['create']);router[_0x3d3e('0x11')](_0x3d3e('0xf'),auth['isAuthenticated'](),controller[_0x3d3e('0x12')]);router[_0x3d3e('0x11')](_0x3d3e('0x13'),auth[_0x3d3e('0x9')](),interaction[_0x3d3e('0x14')](_0x3d3e('0x15'),_0x3d3e('0x16')),controller[_0x3d3e('0x17')]);router[_0x3d3e('0x18')]('/:id',auth[_0x3d3e('0x9')](),interaction[_0x3d3e('0x14')](_0x3d3e('0x15'),'smsinteraction:update'),controller['update']);router[_0x3d3e('0x19')]('/:id',auth[_0x3d3e('0x9')](),interaction[_0x3d3e('0x14')](_0x3d3e('0x15'),_0x3d3e('0x1a')),controller['destroy']);router['delete'](_0x3d3e('0x13'),auth[_0x3d3e('0x9')](),controller['removeTags']);module[_0x3d3e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index ff92033..d2f9c09 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 _0x1f35=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x316af1,_0x13757a){var _0x450661=function(_0x2774f8){while(--_0x2774f8){_0x316af1['push'](_0x316af1['shift']());}};_0x450661(++_0x13757a);}(_0x1f35,0x189));var _0x51f3=function(_0x59b65f,_0x1c9a24){_0x59b65f=_0x59b65f-0x0;var _0x4d8b76=_0x1f35[_0x59b65f];return _0x4d8b76;};'use strict';var Sequelize=require(_0x51f3('0x0'));var moment=require(_0x51f3('0x1'));module[_0x51f3('0x2')]={'closed':{'type':Sequelize[_0x51f3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x51f3('0x4')]},'disposition':{'type':Sequelize[_0x51f3('0x5')]},'secondDisposition':{'type':Sequelize[_0x51f3('0x5')]},'thirdDisposition':{'type':Sequelize[_0x51f3('0x5')]},'note':{'type':Sequelize[_0x51f3('0x5')]},'phone':{'type':Sequelize[_0x51f3('0x5')]},'read1stAt':{'type':Sequelize[_0x51f3('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x51f3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x51f3('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x51f3('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe8c4=['STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x6891f7,_0x4747a6){var _0x45c5c8=function(_0x38e643){while(--_0x38e643){_0x6891f7['push'](_0x6891f7['shift']());}};_0x45c5c8(++_0x4747a6);}(_0xe8c4,0x1dd));var _0x4e8c=function(_0x253d7a,_0x2a16dd){_0x253d7a=_0x253d7a-0x0;var _0x29d3f2=_0xe8c4[_0x253d7a];return _0x29d3f2;};'use strict';var Sequelize=require(_0x4e8c('0x0'));var moment=require('moment');module[_0x4e8c('0x1')]={'closed':{'type':Sequelize[_0x4e8c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4e8c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4e8c('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4e8c('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4e8c('0x4')]('in',_0x4e8c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4e8c('0x4')]('in',_0x4e8c('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 06474e1..6680c8c 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 _0x0eeb=['limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','Users','map','TagIds','Tags','forEach','push','catch','SmsInteraction','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','resolve','then','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','toString','keyBy','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','show','params','fields','includeAll','merge','options','create','describe','addMessage','SmsMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','Messages','createdAt','direction','secret','SmsAccount','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','out','System','lastName','renderFile','views','downloadInteraction.html','transcript-','Sms','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./smsInteraction.socket','sendStatus','status','end','json','undefined'];(function(_0x245ba1,_0x5b1fd3){var _0x4840f1=function(_0x4de2ad){while(--_0x4de2ad){_0x245ba1['push'](_0x245ba1['shift']());}};_0x4840f1(++_0x5b1fd3);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0eeb[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xb0ee('0x0'));var rimraf=require(_0xb0ee('0x1'));var zipdir=require(_0xb0ee('0x2'));var jsonpatch=require(_0xb0ee('0x3'));var rp=require(_0xb0ee('0x4'));var moment=require(_0xb0ee('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb0ee('0x6'));var path=require(_0xb0ee('0x7'));var sox=require(_0xb0ee('0x8'));var csv=require(_0xb0ee('0x9'));var ejs=require(_0xb0ee('0xa'));var fs=require('fs');var fs_extra=require(_0xb0ee('0xb'));var _=require(_0xb0ee('0xc'));var squel=require('squel');var crypto=require(_0xb0ee('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb0ee('0xe'));var toCsv=require(_0xb0ee('0x9'));var querystring=require(_0xb0ee('0xf'));var Papa=require(_0xb0ee('0x10'));var Redis=require(_0xb0ee('0x11'));var authService=require(_0xb0ee('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xb0ee('0x13'));var hardwareService=require(_0xb0ee('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb0ee('0x15'));var config=require(_0xb0ee('0x16'));var licenseUtil=require(_0xb0ee('0x17'));var db=require(_0xb0ee('0x18'))['db'];config['redis']=_[_0xb0ee('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0ee('0x1a')]));require(_0xb0ee('0x1b'))['register'](socket);function respondWithStatusCode(_0x3f206f,_0x5fb11b){_0x5fb11b=_0x5fb11b||0xcc;return function(_0x347c18){if(_0x347c18){return _0x3f206f[_0xb0ee('0x1c')](_0x5fb11b);}return _0x3f206f[_0xb0ee('0x1d')](_0x5fb11b)[_0xb0ee('0x1e')]();};}function respondWithResult(_0xca0c6f,_0x265a86){_0x265a86=_0x265a86||0xc8;return function(_0x549e64){if(_0x549e64){return _0xca0c6f['status'](_0x265a86)[_0xb0ee('0x1f')](_0x549e64);}};}function respondWithFilteredResult(_0x5702d8,_0x1a2018){return function(_0x35ec11){if(_0x35ec11){var _0x480e51=typeof _0x1a2018['offset']===_0xb0ee('0x20')&&typeof _0x1a2018[_0xb0ee('0x21')]===_0xb0ee('0x20');var _0x4ce528=_0x35ec11[_0xb0ee('0x22')];var _0x3b4c19=_0x480e51?0x0:_0x1a2018[_0xb0ee('0x23')];var _0x723146=_0x480e51?_0x35ec11['count']:_0x1a2018[_0xb0ee('0x23')]+_0x1a2018[_0xb0ee('0x21')];var _0x26a3ee;if(_0x723146>=_0x4ce528){_0x723146=_0x4ce528;_0x26a3ee=0xc8;}else{_0x26a3ee=0xce;}_0x5702d8[_0xb0ee('0x1d')](_0x26a3ee);return _0x5702d8[_0xb0ee('0x24')](_0xb0ee('0x25'),_0x3b4c19+'-'+_0x723146+'/'+_0x4ce528)[_0xb0ee('0x1f')](_0x35ec11);}return null;};}function patchUpdates(_0x2b19f2){return function(_0x3acb4f){try{jsonpatch[_0xb0ee('0x26')](_0x3acb4f,_0x2b19f2,!![]);}catch(_0x9f1455){return BPromise[_0xb0ee('0x27')](_0x9f1455);}return _0x3acb4f[_0xb0ee('0x28')]();};}function saveUpdates(_0x2a0c1b,_0x9197cb){return function(_0x5a1197){if(_0x5a1197){return _0x5a1197[_0xb0ee('0x29')](_0x2a0c1b)['then'](function(_0x53bccd){return _0x53bccd;});}return null;};}function removeEntity(_0x3442b7,_0x18b1d7){return function(_0x18935b){if(_0x18935b){return _0x18935b[_0xb0ee('0x2a')]()['then'](function(){_0x3442b7[_0xb0ee('0x1d')](0xcc)[_0xb0ee('0x1e')]();});}};}function handleEntityNotFound(_0x1e5e62,_0xd556e6){return function(_0x4b5308){if(!_0x4b5308){_0x1e5e62['sendStatus'](0x194);}return _0x4b5308;};}function handleError(_0x9fbe95,_0x40e38d){_0x40e38d=_0x40e38d||0x1f4;return function(_0x224c3b){logger[_0xb0ee('0x2b')](_0x224c3b[_0xb0ee('0x2c')]);if(_0x224c3b['name']){delete _0x224c3b['name'];}_0x9fbe95[_0xb0ee('0x1d')](_0x40e38d)[_0xb0ee('0x2d')](_0x224c3b);};}function getInteractionUsers(_0x1a32dc,_0x88ec6){return new BPromise(function(_0x1f0db8,_0x34bb9d){try{if(_0x88ec6[_0x1a32dc['id']]){_0x1a32dc[_0xb0ee('0x2e')]=_[_0xb0ee('0x2f')](_0x88ec6[_0x1a32dc['id']],function(_0x21d3ae){return{'id':_0x21d3ae['id'],'fullname':_0x21d3ae['fullname']};});}}catch(_0x698d9f){_0x34bb9d(_0x698d9f);}_0x1f0db8(_0x1a32dc);});}function getInteractionTags(_0x450f5b,_0x1a4b5e){return new BPromise(function(_0x5aa0d4,_0x43c9aa){try{if(_0x450f5b[_0xb0ee('0x30')]){_0x450f5b[_0xb0ee('0x31')]=[];_0x450f5b[_0xb0ee('0x30')]['split'](',')[_0xb0ee('0x32')](function(_0x49d019){_0x450f5b[_0xb0ee('0x31')][_0xb0ee('0x33')](_0x1a4b5e[_0x49d019]);});}delete _0x450f5b[_0xb0ee('0x30')];}catch(_0x59de20){_0x43c9aa(_0x59de20);}_0x5aa0d4(_0x450f5b);});}function updateSmsInteraction(_0x49e5a6,_0x4bb33e,_0x4b2a0c){return new BPromise(function(_0x17ba9c,_0xe0daaa){return getInteractionUsers(_0x49e5a6,_0x4b2a0c)['then'](function(_0xe4b1cc){return getInteractionTags(_0xe4b1cc,_0x4bb33e);})['then'](function(_0x57d80a){_0x17ba9c(_0x57d80a);})[_0xb0ee('0x34')](function(_0x4bbf6d){_0xe0daaa(_0x4bbf6d);});});}exports['index']=function(_0x5402ca,_0x3b21b7){var _0x3ee12c={},_0x4dd04b={},_0x354bdc={'count':0x0,'rows':[]};var _0x1ab2d0=_[_0xb0ee('0x2f')](db[_0xb0ee('0x35')][_0xb0ee('0x36')],function(_0x12be86){return{'name':_0x12be86[_0xb0ee('0x37')],'type':_0x12be86[_0xb0ee('0x38')][_0xb0ee('0x39')]};});_0x4dd04b[_0xb0ee('0x3a')]=_[_0xb0ee('0x2f')](_0x1ab2d0,_0xb0ee('0x3b'));_0x4dd04b[_0xb0ee('0x3c')]=_[_0xb0ee('0x3d')](_0x5402ca[_0xb0ee('0x3c')]);_0x4dd04b[_0xb0ee('0x3e')]=_[_0xb0ee('0x3f')](_0x4dd04b[_0xb0ee('0x3a')],_0x4dd04b[_0xb0ee('0x3c')]);_0x3ee12c[_0xb0ee('0x40')]=_[_0xb0ee('0x3f')](_0x4dd04b['model'],qs['fields'](_0x5402ca[_0xb0ee('0x3c')]['fields']));_0x3ee12c[_0xb0ee('0x40')]=_0x3ee12c[_0xb0ee('0x40')][_0xb0ee('0x41')]?_0x3ee12c[_0xb0ee('0x40')]:_0x4dd04b[_0xb0ee('0x3a')];if(!_0x5402ca['query'][_0xb0ee('0x42')](_0xb0ee('0x43'))){_0x3ee12c['limit']=qs[_0xb0ee('0x21')](_0x5402ca[_0xb0ee('0x3c')][_0xb0ee('0x21')]);_0x3ee12c[_0xb0ee('0x23')]=qs[_0xb0ee('0x23')](_0x5402ca[_0xb0ee('0x3c')][_0xb0ee('0x23')]);}_0x3ee12c['order']=qs[_0xb0ee('0x44')](_0x5402ca[_0xb0ee('0x3c')]['sort']);_0x3ee12c[_0xb0ee('0x45')]=qs['filters'](_[_0xb0ee('0x46')](_0x5402ca['query'],_0x4dd04b[_0xb0ee('0x3e')]),_0x1ab2d0);var _0x5328a9=[];var _0x265a29=squel[_0xb0ee('0x47')]()[_0xb0ee('0x48')]('id')[_0xb0ee('0x48')](_0xb0ee('0x3b'))[_0xb0ee('0x48')](_0xb0ee('0x49'))[_0xb0ee('0x4a')](_0xb0ee('0x4b'));var _0x203db5=squel[_0xb0ee('0x47')]()[_0xb0ee('0x48')](_0xb0ee('0x4c'))[_0xb0ee('0x48')](_0xb0ee('0x4d'))[_0xb0ee('0x48')]('ui.SmsInteractionId')['from'](_0xb0ee('0x4e'),'ui')[_0xb0ee('0x4f')]('users','u',_0xb0ee('0x50'));var _0x524e15=squel[_0xb0ee('0x47')]()[_0xb0ee('0x4a')](_0xb0ee('0x51'),'i')[_0xb0ee('0x4f')](_0xb0ee('0x52'),'c',_0xb0ee('0x53'))[_0xb0ee('0x4f')](_0xb0ee('0x54'),'o',_0xb0ee('0x55'))[_0xb0ee('0x4f')](_0xb0ee('0x56'),'a','a.id\x20=\x20i.SmsAccountId')['left_join']('sms_messages','me',_0xb0ee('0x57'))[_0xb0ee('0x4f')]('sms_interaction_has_tags','it',_0xb0ee('0x58'))[_0xb0ee('0x4f')](_0xb0ee('0x4b'),'t',_0xb0ee('0x59'));var _0x26be18=squel[_0xb0ee('0x5a')]();var _0x4a12d6=[];var _0x1d0e42=squel[_0xb0ee('0x5a')]();var _0x56620c;if(_0x5402ca[_0xb0ee('0x3c')]['search']){_0x56620c=as[_0xb0ee('0x5b')](_0x5402ca[_0xb0ee('0x3c')][_0xb0ee('0x5c')]);var _0x599412=_0x56620c['sqlOperator'];for(var _0x324110=0x0;_0x324110<_0x56620c['conditions'][_0xb0ee('0x41')];_0x324110++){var _0xfd2f60=_0x56620c[_0xb0ee('0x5d')][_0x324110];var _0x204c70='i';var _0x8e55dc=_[_0xb0ee('0x5e')](_0x1ab2d0,['name',_0xfd2f60[_0xb0ee('0x48')]]);if(!_0x8e55dc){switch(_0xfd2f60[_0xb0ee('0x48')]){case'unreadMessages':if(_0xfd2f60[_0xb0ee('0x5f')]==0x1){_0x524e15[_0xb0ee('0x60')]('`'+_0xfd2f60[_0xb0ee('0x48')]+_0xb0ee('0x61'));}else{_0x524e15[_0xb0ee('0x60')]('`'+_0xfd2f60[_0xb0ee('0x48')]+_0xb0ee('0x62'));}break;case'Contact':if(_0xfd2f60[_0xb0ee('0x63')]===_0xb0ee('0x64')){if(_0xfd2f60[_0xb0ee('0x5f')]['split']('\x20')[_0xb0ee('0x41')]>0x1){_0x26be18[_0x599412](_0xb0ee('0x65'),qs[_0xb0ee('0x66')](_0xfd2f60[_0xb0ee('0x5f')]),null);}else{var _0x4a51b6='%'+_0xfd2f60[_0xb0ee('0x5f')]+'%';_0x26be18[_0x599412](_0xb0ee('0x67'),_0x4a51b6,_0x4a51b6,_0x4a51b6);}}else{_0x8e55dc=_[_0xb0ee('0x5e')](_0x1ab2d0,['name',_0xb0ee('0x68')]);_0xfd2f60[_0xb0ee('0x48')]=_0xb0ee('0x68');_0x37dc12=as[_0xb0ee('0x69')](_0x204c70,_0x8e55dc[_0xb0ee('0x38')],_0xfd2f60);_0x26be18[_0x599412](_0x37dc12[_0xb0ee('0x6a')],_0x37dc12[_0xb0ee('0x5f')][_0xb0ee('0x6b')],_0x37dc12['value']['end']);}break;case _0xb0ee('0x6c'):var _0x40b4e4=_0xfd2f60[_0xb0ee('0x5f')][_0xb0ee('0x6d')](',')[_0xb0ee('0x2f')](function(_0x540461){return Number(_0x540461);});_0x40b4e4[_0xb0ee('0x32')](function(_0x5d1361){_0x1d0e42['or'](_0xb0ee('0x6e'),'%,'+_0x5d1361+',%');});_0x4a12d6=_['union'](_0x4a12d6,_0x40b4e4);break;case'User':if(_0xfd2f60[_0xb0ee('0x63')]===_0xb0ee('0x64')){_0x26be18[_0x599412](_0xb0ee('0x6f'),'%'+_0xfd2f60[_0xb0ee('0x5f')]+'%',null);}else{_0x8e55dc=_[_0xb0ee('0x5e')](_0x1ab2d0,[_0xb0ee('0x3b'),_0xb0ee('0x70')]);_0xfd2f60[_0xb0ee('0x48')]=_0xb0ee('0x70');_0x37dc12=as[_0xb0ee('0x69')](_0x204c70,_0x8e55dc[_0xb0ee('0x38')],_0xfd2f60);_0x26be18[_0x599412](_0x37dc12['text'],_0x37dc12['value']['start'],_0x37dc12[_0xb0ee('0x5f')]['end']);}break;case _0xb0ee('0x71'):_0x37dc12=as['buildExpression']('me',null,_0xfd2f60);_0x26be18[_0x599412](_0x37dc12['text'],_0x37dc12[_0xb0ee('0x5f')][_0xb0ee('0x6b')],_0x37dc12['value'][_0xb0ee('0x1e')]);break;}}else{var _0x37dc12=as[_0xb0ee('0x69')](_0x204c70,_0x8e55dc['type'],_0xfd2f60);_0x26be18[_0x599412](_0x37dc12[_0xb0ee('0x6a')],_0x37dc12[_0xb0ee('0x5f')][_0xb0ee('0x6b')],_0x37dc12[_0xb0ee('0x5f')][_0xb0ee('0x1e')]);}}}else{var _0x285499=_(_0x5402ca[_0xb0ee('0x3c')])['keys']()['map'](function(_0x10a542){return _[_0xb0ee('0x72')](_0x1ab2d0,[_0xb0ee('0x3b'),_0x10a542])?_0x10a542:undefined;})[_0xb0ee('0x73')]()[_0xb0ee('0x5f')]();if(!_[_0xb0ee('0x74')](_0x285499)){_0x285499['forEach'](function(_0x2ceeac){if(_0x2ceeac==='SmsAccountId'){_0x524e15[_0xb0ee('0x45')](_0xb0ee('0x75'),[][_0xb0ee('0x76')](_0x5402ca['query'][_0x2ceeac]));}else if(_0x2ceeac==='createdAt'){var _0x337aba=JSON[_0xb0ee('0x77')](_0x5402ca[_0xb0ee('0x3c')][_0x2ceeac])[_0xb0ee('0x78')];var _0x1865b7=JSON[_0xb0ee('0x77')](_0x5402ca[_0xb0ee('0x3c')][_0x2ceeac])[_0xb0ee('0x79')];_0x524e15[_0xb0ee('0x45')](_0xb0ee('0x7a'),_0x337aba,_0x1865b7);}else{if(_0x5402ca[_0xb0ee('0x3c')][_0x2ceeac]==='null'){_0x524e15[_0xb0ee('0x45')]('i.'+_0x2ceeac+'\x20IS\x20NULL');}else{_0x524e15[_0xb0ee('0x45')]('i.'+_0x2ceeac+_0xb0ee('0x7b'),_0x5402ca[_0xb0ee('0x3c')][_0x2ceeac]);}}});}if(_0x5402ca[_0xb0ee('0x3c')][_0xb0ee('0x7c')]){if(_0x5402ca[_0xb0ee('0x3c')][_0xb0ee('0x7c')]==0x1){_0x524e15['having'](_0xb0ee('0x7d'));}else{_0x524e15[_0xb0ee('0x60')](_0xb0ee('0x7e'));}}if(_0x5402ca['query'][_0xb0ee('0x7f')]){_0x4a12d6=_[_0xb0ee('0x80')](_0x5402ca[_0xb0ee('0x3c')][_0xb0ee('0x7f')])?_0x5402ca['query'][_0xb0ee('0x7f')]:new Array(_0x5402ca[_0xb0ee('0x3c')]['tag']);_0x4a12d6[_0xb0ee('0x32')](function(_0x59caab){_0x1d0e42['or'](_0xb0ee('0x6e'),'%,'+_0x59caab+',%');});}if(_0x5402ca[_0xb0ee('0x3c')][_0xb0ee('0x81')]){var _0x24aebf=_0x5402ca[_0xb0ee('0x3c')][_0xb0ee('0x81')][_0xb0ee('0x82')]('\x5c','\x5c\x5c')[_0xb0ee('0x82')](/'/g,'\x27\x27');if(qs[_0xb0ee('0x83')](_0x24aebf)){_0x26be18['or'](_0xb0ee('0x84'),_0x24aebf+'%')['or'](_0xb0ee('0x85'),_0x24aebf+'%');}else{_0x26be18['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb0ee('0x66')](_0x24aebf))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x24aebf+'%');}}}_0x524e15[_0xb0ee('0x45')](_0x26be18);_0x524e15['group'](_0xb0ee('0x86'));var _0x3b52b0={'type':db[_0xb0ee('0x87')][_0xb0ee('0x88')]['SELECT'],'raw':!![]};var _0x3d2cf3=_0x524e15['clone']();_0x3d2cf3['field'](_0xb0ee('0x86'));_0x3d2cf3['field'](_0xb0ee('0x89'),_0xb0ee('0x8a'));if(_0x3ee12c[_0xb0ee('0x8b')]){_0x3ee12c['order'][_0xb0ee('0x32')](function(_0x12219d){var _0xd22729=_0x12219d[0x0]===_0xb0ee('0x8c')?_0x12219d[0x0]:'i.'+_0x12219d[0x0];_0x524e15[_0xb0ee('0x8b')](_0xd22729,_0x12219d[0x1]===_0xb0ee('0x8d')?![]:!![]);});}if(!_[_0xb0ee('0x74')](_0x4a12d6)){_0x524e15[_0xb0ee('0x60')](_0x1d0e42);_0x3d2cf3[_0xb0ee('0x45')](_0xb0ee('0x8e'),_0x4a12d6);}BPromise[_0xb0ee('0x8f')]()[_0xb0ee('0x90')](function(){if(!_0x56620c){if(_0x5402ca['query']['SmsAccountId'])return;_0x3d2cf3[_0xb0ee('0x45')](_0xb0ee('0x91'));_0x524e15[_0xb0ee('0x45')](_0xb0ee('0x91'));return;}if(_0x5402ca[_0xb0ee('0x92')]['role']!==_0xb0ee('0x93'))return;return _0x5402ca[_0xb0ee('0x92')][_0xb0ee('0x94')]({'attributes':['id'],'raw':!![]})[_0xb0ee('0x90')](function(_0x40b397){if(_[_0xb0ee('0x74')](_0x40b397)){_0x3d2cf3[_0xb0ee('0x45')](_0xb0ee('0x95'));_0x524e15['where'](_0xb0ee('0x95'));}else{_0x3d2cf3[_0xb0ee('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0xb0ee('0x2f')](_0x40b397,'id'));_0x524e15[_0xb0ee('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0xb0ee('0x2f')](_0x40b397,'id'));}});})[_0xb0ee('0x90')](function(){if(_0x5402ca['user'][_0xb0ee('0x96')]===_0xb0ee('0x93')&&!_0x56620c&&!_0x5402ca[_0xb0ee('0x3c')]['SmsAccountId'])return[];return db['sequelize'][_0xb0ee('0x3c')](_0x3d2cf3[_0xb0ee('0x97')](),_0x3b52b0);})[_0xb0ee('0x90')](function(_0x4cc458){_0x354bdc[_0xb0ee('0x22')]=_0x4cc458[_0xb0ee('0x41')];if(_0x354bdc['count']===0x0)return[];return db['sequelize']['query'](_0x265a29['toString'](),_0x3b52b0)[_0xb0ee('0x90')](function(_0x3066b6){_0x5328a9=_[_0xb0ee('0x98')](_0x3066b6,'id');_0x3b52b0=_['merge'](_0x3b52b0,{'model':db[_0xb0ee('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5402ca['query']['fields']){_0x3ee12c['attributes']['forEach'](function(_0x2b2597){_0x524e15[_0xb0ee('0x48')]('i.'+_0x2b2597);});}else{_0x524e15['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb0ee('0x8a'));_0x524e15[_0xb0ee('0x48')]('a.key','Account.key');_0x524e15[_0xb0ee('0x48')](_0xb0ee('0x99'),'Account.mandatoryDisposition');_0x524e15['field'](_0xb0ee('0x9a'),'contactName');_0x524e15['field'](_0xb0ee('0x9b'));_0x524e15[_0xb0ee('0x48')](_0xb0ee('0x9c'),_0xb0ee('0x9d'));_0x524e15[_0xb0ee('0x48')](_0xb0ee('0x9e'),'Contact.lastName');_0x524e15[_0xb0ee('0x48')](_0xb0ee('0x9f'),_0xb0ee('0xa0'));_0x524e15['field'](_0xb0ee('0xa1'),'Contact.phone');_0x524e15[_0xb0ee('0x48')]('c.mobile','Contact.mobile');_0x524e15[_0xb0ee('0x48')](_0xb0ee('0xa2'),'Contact.fax');_0x524e15[_0xb0ee('0x48')](_0xb0ee('0xa3'),_0xb0ee('0xa4'));_0x524e15[_0xb0ee('0x48')](_0xb0ee('0xa5'),_0xb0ee('0xa6'));_0x524e15[_0xb0ee('0x48')](_0xb0ee('0xa7'),_0xb0ee('0x30'));}if(_0x3ee12c[_0xb0ee('0x21')])_0x524e15[_0xb0ee('0x21')](_0x3ee12c[_0xb0ee('0x21')]);if(_0x3ee12c[_0xb0ee('0x23')])_0x524e15[_0xb0ee('0x23')](_0x3ee12c['offset']);return db[_0xb0ee('0xa8')][_0xb0ee('0x3c')](_0x524e15['toString'](),_0x3b52b0);})[_0xb0ee('0x90')](function(_0x554405){if(_0x554405[_0xb0ee('0x41')]>0x0)_0x203db5['where'](_0xb0ee('0xa9'),_['map'](_0x554405,'id'));return db[_0xb0ee('0xa8')][_0xb0ee('0x3c')](_0x203db5[_0xb0ee('0x97')](),_0x3b52b0)[_0xb0ee('0x90')](function(_0x96d5c6){var _0xf74391=_['groupBy'](_0x96d5c6,_0xb0ee('0xaa'));var _0x186894=[];_0x554405[_0xb0ee('0x32')](function(_0x11b60e){_0x186894['push'](updateSmsInteraction(_0x11b60e,_0x5328a9,_0xf74391));});return BPromise[_0xb0ee('0xab')](_0x186894);});});})['then'](function(_0x469490){_0x354bdc[_0xb0ee('0xac')]=_0x469490;return _0x354bdc;})['then'](respondWithFilteredResult(_0x3b21b7,_0x3ee12c))[_0xb0ee('0x34')](handleError(_0x3b21b7,null));};exports[_0xb0ee('0xad')]=function(_0x52366b,_0x249c57){var _0x5c2d8e={'raw':![],'where':{'id':_0x52366b[_0xb0ee('0xae')]['id']}},_0x20c8cc={};_0x20c8cc['model']=_['keys'](db[_0xb0ee('0x35')][_0xb0ee('0x36')]);_0x20c8cc[_0xb0ee('0x3c')]=_[_0xb0ee('0x3d')](_0x52366b['query']);_0x20c8cc[_0xb0ee('0x3e')]=_[_0xb0ee('0x3f')](_0x20c8cc[_0xb0ee('0x3a')],_0x20c8cc[_0xb0ee('0x3c')]);_0x5c2d8e[_0xb0ee('0x40')]=_['intersection'](_0x20c8cc['model'],qs[_0xb0ee('0xaf')](_0x52366b['query'][_0xb0ee('0xaf')]));_0x5c2d8e[_0xb0ee('0x40')]=_0x5c2d8e[_0xb0ee('0x40')][_0xb0ee('0x41')]?_0x5c2d8e['attributes']:_0x20c8cc[_0xb0ee('0x3a')];if(_0x52366b[_0xb0ee('0x3c')][_0xb0ee('0xb0')]){_0x5c2d8e['include']=[{'all':!![]}];}_0x5c2d8e=_[_0xb0ee('0xb1')]({},_0x5c2d8e,_0x52366b[_0xb0ee('0xb2')]);return db[_0xb0ee('0x35')][_0xb0ee('0x5e')](_0x5c2d8e)[_0xb0ee('0x90')](handleEntityNotFound(_0x249c57,null))[_0xb0ee('0x90')](respondWithResult(_0x249c57,null))['catch'](handleError(_0x249c57,null));};exports[_0xb0ee('0xb3')]=function(_0x2bd6a7,_0x5bcb81){return db[_0xb0ee('0x35')][_0xb0ee('0xb3')](_0x2bd6a7[_0xb0ee('0x71')],{})[_0xb0ee('0x90')](respondWithResult(_0x5bcb81,0xc9))[_0xb0ee('0x34')](handleError(_0x5bcb81,null));};exports['update']=function(_0x57a102,_0x34658d){if(_0x57a102[_0xb0ee('0x71')]['id']){delete _0x57a102[_0xb0ee('0x71')]['id'];}return db['SmsInteraction'][_0xb0ee('0x5e')]({'where':{'id':_0x57a102[_0xb0ee('0xae')]['id']}})[_0xb0ee('0x90')](handleEntityNotFound(_0x34658d,null))[_0xb0ee('0x90')](saveUpdates(_0x57a102['body'],null))['then'](respondWithResult(_0x34658d,null))['catch'](handleError(_0x34658d,null));};exports[_0xb0ee('0x2a')]=function(_0x350949,_0x4c810c){return db[_0xb0ee('0x35')][_0xb0ee('0x5e')]({'where':{'id':_0x350949[_0xb0ee('0xae')]['id']}})[_0xb0ee('0x90')](handleEntityNotFound(_0x4c810c,null))[_0xb0ee('0x90')](removeEntity(_0x4c810c,null))['catch'](handleError(_0x4c810c,null));};exports[_0xb0ee('0xb4')]=function(_0x5e8e2f,_0x21c451){return db[_0xb0ee('0x35')]['describe']()[_0xb0ee('0x90')](respondWithResult(_0x21c451,null))[_0xb0ee('0x34')](handleError(_0x21c451,null));};exports[_0xb0ee('0xb5')]=function(_0x4503b0,_0x39ed3d,_0x503c0b){return db[_0xb0ee('0xb6')][_0xb0ee('0x5e')]({'where':{'id':_0x4503b0['params']['id']}})[_0xb0ee('0x90')](handleEntityNotFound(_0x39ed3d,null))[_0xb0ee('0x90')](function(_0x2b1239){if(_0x2b1239){return _0x2b1239[_0xb0ee('0xb5')](_0x4503b0[_0xb0ee('0x71')]['ids'],_['omit'](_0x4503b0['body'],[_0xb0ee('0xb7'),'id'])||{});}})[_0xb0ee('0x90')](respondWithResult(_0x39ed3d,null))[_0xb0ee('0x34')](handleError(_0x39ed3d,null));};exports[_0xb0ee('0xb8')]=function(_0xa0443c,_0x565643,_0x512c2a){var _0xd85328={'raw':![],'where':{}};var _0x4e7b39={};var _0x11e848={'count':0x0,'rows':[]};return db[_0xb0ee('0x35')][_0xb0ee('0xb9')]({'where':{'id':_0xa0443c[_0xb0ee('0xae')]['id']}})['then'](handleEntityNotFound(_0x565643,null))[_0xb0ee('0x90')](function(_0x23ba46){if(_0x23ba46){_0x4e7b39[_0xb0ee('0x3a')]=_[_0xb0ee('0x3d')](db[_0xb0ee('0xb6')][_0xb0ee('0x36')]);_0x4e7b39[_0xb0ee('0x3c')]=_[_0xb0ee('0x3d')](_0xa0443c['query']);_0x4e7b39[_0xb0ee('0x3e')]=_[_0xb0ee('0x3f')](_0x4e7b39[_0xb0ee('0x3a')],_0x4e7b39[_0xb0ee('0x3c')]);_0xd85328[_0xb0ee('0x40')]=_['intersection'](_0x4e7b39['model'],qs[_0xb0ee('0xaf')](_0xa0443c['query'][_0xb0ee('0xaf')]));_0xd85328[_0xb0ee('0x40')]=_0xd85328[_0xb0ee('0x40')][_0xb0ee('0x41')]?_0xd85328['attributes']:_0x4e7b39[_0xb0ee('0x3a')];if(!_0xa0443c[_0xb0ee('0x3c')][_0xb0ee('0x42')](_0xb0ee('0x43'))){_0xd85328['limit']=qs[_0xb0ee('0x21')](_0xa0443c[_0xb0ee('0x3c')][_0xb0ee('0x21')]);_0xd85328[_0xb0ee('0x23')]=qs[_0xb0ee('0x23')](_0xa0443c[_0xb0ee('0x3c')][_0xb0ee('0x23')]);}_0xd85328['order']=qs[_0xb0ee('0x44')](_0xa0443c[_0xb0ee('0x3c')][_0xb0ee('0x44')]);_0xd85328['where']=qs[_0xb0ee('0x3e')](_['pick'](_0xa0443c[_0xb0ee('0x3c')],_0x4e7b39[_0xb0ee('0x3e')]));_0xd85328['where']['SmsInteractionId']=_0x23ba46['id'];if(_0xa0443c[_0xb0ee('0x3c')][_0xb0ee('0x81')]){_0xd85328[_0xb0ee('0x45')]=_['merge'](_0xd85328[_0xb0ee('0x45')],{'$or':_['map'](_0xd85328[_0xb0ee('0x40')],function(_0x23025b){var _0x251aa2={};_0x251aa2[_0x23025b]={'$like':'%'+_0xa0443c['query']['filter']+'%'};return _0x251aa2;})});}if(_0xa0443c['query'][_0xb0ee('0x78')]){var _0x27a748=_0xa0443c['query'][_0xb0ee('0x78')][_0xb0ee('0x6d')](',');var _0x2d7da0={};_0x2d7da0[_0x27a748[0x0]]={'$gte':moment(_0x27a748[0x1])[_0xb0ee('0xba')](_0xb0ee('0xbb'))};_0xd85328[_0xb0ee('0x45')]=_[_0xb0ee('0xb1')](_0xd85328['where'],_0x2d7da0);}_0xd85328=_[_0xb0ee('0xb1')]({},_0xd85328,_0xa0443c[_0xb0ee('0xb2')]);return db[_0xb0ee('0xb6')][_0xb0ee('0x22')]({'where':_0xd85328[_0xb0ee('0x45')]})[_0xb0ee('0x90')](function(_0x3a73d9){_0x11e848[_0xb0ee('0x22')]=_0x3a73d9;if(_0xa0443c[_0xb0ee('0x3c')]['includeAll']){_0xd85328['include']=[{'all':!![]}];}return db[_0xb0ee('0xb6')][_0xb0ee('0xbc')](_0xd85328);})[_0xb0ee('0x90')](function(_0x4da46b){_0x11e848[_0xb0ee('0xac')]=_0x4da46b;return _0x11e848;});}})[_0xb0ee('0x90')](respondWithFilteredResult(_0x565643,_0xd85328))[_0xb0ee('0x34')](handleError(_0x565643,null));};exports['addTags']=function(_0x13a646,_0x3134b6,_0x1ad0bf){return db[_0xb0ee('0x35')][_0xb0ee('0x5e')]({'where':{'id':_0x13a646[_0xb0ee('0xae')]['id']}})[_0xb0ee('0x90')](handleEntityNotFound(_0x3134b6,null))[_0xb0ee('0x90')](function(_0x3a0989){if(_0x3a0989){return _0x3a0989[_0xb0ee('0xbd')](_0x13a646[_0xb0ee('0x71')][_0xb0ee('0xb7')],_[_0xb0ee('0xbe')](_0x13a646[_0xb0ee('0x71')],[_0xb0ee('0xb7'),'id'])||{})[_0xb0ee('0xbf')](function(){return db[_0xb0ee('0x6c')]['findAll']({'attributes':['id',_0xb0ee('0x3b'),_0xb0ee('0x49')],'where':{'id':_0x13a646['body']['ids']}});})[_0xb0ee('0x90')](function(_0x5053f8){socket[_0xb0ee('0xc0')](_0xb0ee('0xc1'),{'id':Number(_0x13a646['params']['id']),'tags':_0x5053f8||[]});return{'id':Number(_0x13a646[_0xb0ee('0xae')]['id']),'tags':_0x5053f8||[]};});}})[_0xb0ee('0x90')](respondWithResult(_0x3134b6,null))[_0xb0ee('0x34')](handleError(_0x3134b6,null));};exports[_0xb0ee('0xc2')]=function(_0x5d3190,_0x644ace,_0x596464){return db[_0xb0ee('0x35')][_0xb0ee('0x5e')]({'where':{'id':_0x5d3190[_0xb0ee('0xae')]['id']}})[_0xb0ee('0x90')](handleEntityNotFound(_0x644ace,null))['then'](function(_0x9d060d){if(_0x9d060d){return _0x9d060d[_0xb0ee('0xc2')](_0x5d3190[_0xb0ee('0x3c')]['ids']);}})[_0xb0ee('0x90')](respondWithStatusCode(_0x644ace,null))['catch'](handleError(_0x644ace,null));};exports[_0xb0ee('0xc3')]=function(_0x658140,_0x24104e){var _0x2d2622=moment()['unix']()[_0xb0ee('0x97')]();var _0x132187=path[_0xb0ee('0xc4')](config[_0xb0ee('0xc5')],'server',_0xb0ee('0xc6'),_0xb0ee('0xc7'));var _0x3ad553=path[_0xb0ee('0xc4')](config['root'],_0xb0ee('0xc8'),_0xb0ee('0xc6'),_0xb0ee('0xc9'));var _0x47673e=path[_0xb0ee('0xc4')](_0x132187,_0x2d2622);var _0xd603b2=util[_0xb0ee('0xba')](_0xb0ee('0xca'),_0x658140[_0xb0ee('0xae')]['id'],_0x2d2622);var _0x5669ba=path[_0xb0ee('0xc4')](_0x132187,_0xd603b2);var _0x480743=[];_0x480743['push']({'model':db[_0xb0ee('0xcb')],'as':_0xb0ee('0xcb'),'attributes':['id',_0xb0ee('0xcc')],'raw':!![]});_0x480743['push']({'model':db['CmContact'],'as':_0xb0ee('0xcd'),'attributes':['id',_0xb0ee('0xce'),'lastName'],'raw':!![]});var _0x5b8d50=[{'model':db[_0xb0ee('0xb6')],'as':_0xb0ee('0xcf'),'attributes':['id',_0xb0ee('0x71'),_0xb0ee('0xd0'),_0xb0ee('0xd1'),_0xb0ee('0xd2'),_0xb0ee('0x7c')],'include':_0x480743}];_0x5b8d50['push']({'model':db[_0xb0ee('0xd3')],'as':'Account','attributes':['id','name']});_0x5b8d50[_0xb0ee('0x33')]({'model':db[_0xb0ee('0xcb')],'as':_0xb0ee('0xd4'),'attributes':['id',_0xb0ee('0xcc')]});return db[_0xb0ee('0x35')][_0xb0ee('0x5e')]({'where':{'id':_0x658140[_0xb0ee('0xae')]['id']},'include':_0x5b8d50})[_0xb0ee('0x90')](handleEntityNotFound(_0x24104e,null))[_0xb0ee('0x90')](function(_0x173cc0){if(_0x173cc0){var _0x140853=_0x173cc0[_0xb0ee('0xd5')]({'plain':!![]});fs[_0xb0ee('0xd6')](_0x47673e);var _0x1f1f60={'channel':'Sms','account':_0x140853['Account'][_0xb0ee('0x3b')],'agent':_0x140853[_0xb0ee('0xd4')]?_0x140853[_0xb0ee('0xd4')][_0xb0ee('0xcc')]:_0xb0ee('0xd7'),'createdAt':moment(_0x140853[_0xb0ee('0xd0')])[_0xb0ee('0xba')](_0xb0ee('0xbb'))[_0xb0ee('0x97')](),'closedAt':_0x140853[_0xb0ee('0xd8')]?moment(_0x140853[_0xb0ee('0xd9')])['format'](_0xb0ee('0xbb'))[_0xb0ee('0x97')]():'','disposition':_0x140853[_0xb0ee('0xda')],'messages':_(_0x140853[_0xb0ee('0xcf')])[_0xb0ee('0x81')]({'secret':![]})[_0xb0ee('0x2f')](function(_0x2b0df7){return{'date':moment(_0x2b0df7[_0xb0ee('0xd0')])[_0xb0ee('0xba')](_0xb0ee('0xbb'))[_0xb0ee('0x97')](),'sender':_0x2b0df7[_0xb0ee('0xd1')]===_0xb0ee('0xdb')?_0x2b0df7[_0xb0ee('0xcb')]?_0x2b0df7[_0xb0ee('0xcb')][_0xb0ee('0xcc')]:_0xb0ee('0xdc'):_0x2b0df7[_0xb0ee('0xcd')][_0xb0ee('0xce')]+(_0x2b0df7['Contact'][_0xb0ee('0xdd')]?'\x20'+_0x2b0df7[_0xb0ee('0xcd')][_0xb0ee('0xdd')]:''),'body':_0x2b0df7[_0xb0ee('0x71')],'direction':_0x2b0df7[_0xb0ee('0xd1')]==='out'?'A':'C','secret':_0x2b0df7[_0xb0ee('0xd2')],'read':_0x2b0df7[_0xb0ee('0x7c')]};})[_0xb0ee('0x5f')]()};return ejs[_0xb0ee('0xde')](path[_0xb0ee('0xc4')](config[_0xb0ee('0xc5')],'server',_0xb0ee('0xdf'),_0xb0ee('0xe0')),{'interaction':_0x1f1f60})[_0xb0ee('0x90')](function(_0xacdd40){var _0x4fda44=path['join'](_0x47673e,_0xb0ee('0xe1')+_0x140853['id']+'-'+_0x2d2622+'.pdf');var _0x449f1b={'path':_0x4fda44,'channel':_0xb0ee('0xe2'),'interactionId':_0x140853['id']};return pdf[_0xb0ee('0xe3')](_0xacdd40,_0x449f1b);})['then'](function(){return new BPromise(function(_0x481226,_0x1d8c5a){zipdir(_0x47673e,{'saveTo':_0x5669ba},function(_0x2a3851,_0x2fe46d){if(_0x2a3851)return _0x1d8c5a(_0x2a3851);return _0x481226(_0x2fe46d);});})[_0xb0ee('0x90')](function(){return new BPromise(function(_0x440213,_0x546ea6){rimraf(_0x47673e,function(_0x2f7afa){if(_0x2f7afa)_0x546ea6(_0x2f7afa);return _0x440213();});});})[_0xb0ee('0x90')](function(){return _0x24104e['download'](_0x5669ba,_0xd603b2,function(_0x58ae57){if(_0x58ae57){console[_0xb0ee('0xe4')]('err',_0x58ae57);}else{fs[_0xb0ee('0xe5')](_0x5669ba);}});});});}else{return _0x24104e['sendStatus'](0xc8);}})['catch'](handleError(_0x24104e,null));}; \ No newline at end of file +var _0x04e7=['ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','show','params','includeAll','options','find','create','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','merge','include','findAll','addTags','setTags','smsInteractionTags:save','removeTags','download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','format','closedAt','disposition','Messages','direction','out','lastName','server','views','transcript-','.pdf','createPdfFromHTML','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','Users','fullname','TagIds','Tags','split','push','catch','index','SmsInteraction','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','expr','search','parseSearch','conditions','unreadMessages','`\x20=\x200','having','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','some','compact','isEmpty','SmsAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x04e7,0x121));var _0x704e=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x04e7[_0x1e4a8e];return _0x5408f9;};'use strict';var emlformat=require(_0x704e('0x0'));var rimraf=require(_0x704e('0x1'));var zipdir=require(_0x704e('0x2'));var jsonpatch=require(_0x704e('0x3'));var rp=require(_0x704e('0x4'));var moment=require(_0x704e('0x5'));var BPromise=require(_0x704e('0x6'));var Mustache=require(_0x704e('0x7'));var util=require(_0x704e('0x8'));var path=require(_0x704e('0x9'));var sox=require(_0x704e('0xa'));var csv=require(_0x704e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x704e('0xc'));var _=require(_0x704e('0xd'));var squel=require(_0x704e('0xe'));var crypto=require(_0x704e('0xf'));var jsforce=require(_0x704e('0x10'));var deskjs=require(_0x704e('0x11'));var toCsv=require(_0x704e('0xb'));var querystring=require(_0x704e('0x12'));var Papa=require(_0x704e('0x13'));var Redis=require(_0x704e('0x14'));var authService=require(_0x704e('0x15'));var qs=require(_0x704e('0x16'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x704e('0x17'));var hardwareService=require(_0x704e('0x18'));var logger=require(_0x704e('0x19'))(_0x704e('0x1a'));var utils=require(_0x704e('0x1b'));var config=require(_0x704e('0x1c'));var licenseUtil=require(_0x704e('0x1d'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x704e('0x1e')](config[_0x704e('0x1f')],{'host':_0x704e('0x20'),'port':0x18eb});var socket=require(_0x704e('0x21'))(new Redis(config[_0x704e('0x1f')]));require(_0x704e('0x22'))[_0x704e('0x23')](socket);function respondWithStatusCode(_0x33a743,_0x57a907){_0x57a907=_0x57a907||0xcc;return function(_0xed4c87){if(_0xed4c87){return _0x33a743[_0x704e('0x24')](_0x57a907);}return _0x33a743[_0x704e('0x25')](_0x57a907)['end']();};}function respondWithResult(_0x2b203b,_0x35a3e9){_0x35a3e9=_0x35a3e9||0xc8;return function(_0x3fd07d){if(_0x3fd07d){return _0x2b203b['status'](_0x35a3e9)[_0x704e('0x26')](_0x3fd07d);}};}function respondWithFilteredResult(_0x1bd0cf,_0x315636){return function(_0x340bde){if(_0x340bde){var _0x3d10ba=typeof _0x315636['offset']===_0x704e('0x27')&&typeof _0x315636['limit']===_0x704e('0x27');var _0x5b604a=_0x340bde['count'];var _0x5bd786=_0x3d10ba?0x0:_0x315636[_0x704e('0x28')];var _0x361cb7=_0x3d10ba?_0x340bde[_0x704e('0x29')]:_0x315636['offset']+_0x315636['limit'];var _0x2f56b5;if(_0x361cb7>=_0x5b604a){_0x361cb7=_0x5b604a;_0x2f56b5=0xc8;}else{_0x2f56b5=0xce;}_0x1bd0cf[_0x704e('0x25')](_0x2f56b5);return _0x1bd0cf[_0x704e('0x2a')](_0x704e('0x2b'),_0x5bd786+'-'+_0x361cb7+'/'+_0x5b604a)[_0x704e('0x26')](_0x340bde);}return null;};}function patchUpdates(_0x3cafe7){return function(_0x30a391){try{jsonpatch[_0x704e('0x2c')](_0x30a391,_0x3cafe7,!![]);}catch(_0x30bcf4){return BPromise[_0x704e('0x2d')](_0x30bcf4);}return _0x30a391[_0x704e('0x2e')]();};}function saveUpdates(_0x5554d0,_0x5cae04){return function(_0x2bb286){if(_0x2bb286){return _0x2bb286[_0x704e('0x2f')](_0x5554d0)[_0x704e('0x30')](function(_0xc431e6){return _0xc431e6;});}return null;};}function removeEntity(_0x36b851,_0x243901){return function(_0xa6a751){if(_0xa6a751){return _0xa6a751[_0x704e('0x31')]()['then'](function(){_0x36b851[_0x704e('0x25')](0xcc)[_0x704e('0x32')]();});}};}function handleEntityNotFound(_0x3eef0a,_0x50d3ab){return function(_0x3b2b13){if(!_0x3b2b13){_0x3eef0a['sendStatus'](0x194);}return _0x3b2b13;};}function handleError(_0x24829b,_0x123e61){_0x123e61=_0x123e61||0x1f4;return function(_0x39e535){logger[_0x704e('0x33')](_0x39e535['stack']);if(_0x39e535['name']){delete _0x39e535[_0x704e('0x34')];}_0x24829b['status'](_0x123e61)['send'](_0x39e535);};}function getInteractionUsers(_0x162c4a,_0x247dee){return new BPromise(function(_0x31a04b,_0x3b430c){try{if(_0x247dee[_0x162c4a['id']]){_0x162c4a[_0x704e('0x35')]=_['map'](_0x247dee[_0x162c4a['id']],function(_0x5737d0){return{'id':_0x5737d0['id'],'fullname':_0x5737d0[_0x704e('0x36')]};});}}catch(_0x5b4c97){_0x3b430c(_0x5b4c97);}_0x31a04b(_0x162c4a);});}function getInteractionTags(_0x4b3a42,_0x2fffcc){return new BPromise(function(_0xe57be,_0x2e6de1){try{if(_0x4b3a42[_0x704e('0x37')]){_0x4b3a42[_0x704e('0x38')]=[];_0x4b3a42[_0x704e('0x37')][_0x704e('0x39')](',')['forEach'](function(_0x1a6d09){_0x4b3a42['Tags'][_0x704e('0x3a')](_0x2fffcc[_0x1a6d09]);});}delete _0x4b3a42['TagIds'];}catch(_0x18823d){_0x2e6de1(_0x18823d);}_0xe57be(_0x4b3a42);});}function updateSmsInteraction(_0x1a41e4,_0x44bcc5,_0x84f466){return new BPromise(function(_0xe2ec61,_0x81ad4e){return getInteractionUsers(_0x1a41e4,_0x84f466)[_0x704e('0x30')](function(_0x1da7be){return getInteractionTags(_0x1da7be,_0x44bcc5);})[_0x704e('0x30')](function(_0x491d9f){_0xe2ec61(_0x491d9f);})[_0x704e('0x3b')](function(_0x542249){_0x81ad4e(_0x542249);});});}exports[_0x704e('0x3c')]=function(_0x581b52,_0x4a21c2){var _0x3491f3={},_0x3a49c2={},_0x5eb0f8={'count':0x0,'rows':[]};var _0x1dee62=_['map'](db[_0x704e('0x3d')][_0x704e('0x3e')],function(_0x2d6267){return{'name':_0x2d6267['fieldName'],'type':_0x2d6267[_0x704e('0x3f')][_0x704e('0x40')]};});_0x3a49c2[_0x704e('0x41')]=_[_0x704e('0x42')](_0x1dee62,_0x704e('0x34'));_0x3a49c2[_0x704e('0x43')]=_[_0x704e('0x44')](_0x581b52[_0x704e('0x43')]);_0x3a49c2[_0x704e('0x45')]=_['intersection'](_0x3a49c2['model'],_0x3a49c2[_0x704e('0x43')]);_0x3491f3[_0x704e('0x46')]=_[_0x704e('0x47')](_0x3a49c2['model'],qs[_0x704e('0x48')](_0x581b52[_0x704e('0x43')][_0x704e('0x48')]));_0x3491f3[_0x704e('0x46')]=_0x3491f3[_0x704e('0x46')][_0x704e('0x49')]?_0x3491f3[_0x704e('0x46')]:_0x3a49c2[_0x704e('0x41')];if(!_0x581b52['query'][_0x704e('0x4a')](_0x704e('0x4b'))){_0x3491f3[_0x704e('0x4c')]=qs['limit'](_0x581b52['query'][_0x704e('0x4c')]);_0x3491f3[_0x704e('0x28')]=qs[_0x704e('0x28')](_0x581b52[_0x704e('0x43')][_0x704e('0x28')]);}_0x3491f3['order']=qs[_0x704e('0x4d')](_0x581b52['query']['sort']);_0x3491f3['where']=qs[_0x704e('0x45')](_[_0x704e('0x4e')](_0x581b52['query'],_0x3a49c2[_0x704e('0x45')]),_0x1dee62);var _0xf2bfdb=[];var _0xe6df5e=squel[_0x704e('0x4f')]()[_0x704e('0x50')]('id')[_0x704e('0x50')]('name')[_0x704e('0x50')](_0x704e('0x51'))[_0x704e('0x52')](_0x704e('0x53'));var _0x49d799=squel[_0x704e('0x4f')]()[_0x704e('0x50')](_0x704e('0x54'))['field'](_0x704e('0x55'))[_0x704e('0x50')]('ui.SmsInteractionId')[_0x704e('0x52')](_0x704e('0x56'),'ui')[_0x704e('0x57')](_0x704e('0x58'),'u',_0x704e('0x59'));var _0x2b5a8a=squel[_0x704e('0x4f')]()[_0x704e('0x52')]('sms_interactions','i')['left_join'](_0x704e('0x5a'),'c',_0x704e('0x5b'))['left_join']('users','o',_0x704e('0x5c'))[_0x704e('0x57')](_0x704e('0x5d'),'a',_0x704e('0x5e'))[_0x704e('0x57')](_0x704e('0x5f'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x704e('0x57')](_0x704e('0x60'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x704e('0x57')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x344d2b=squel[_0x704e('0x61')]();var _0x4f21b2=[];var _0x1ba5ec=squel[_0x704e('0x61')]();var _0x49db54;if(_0x581b52[_0x704e('0x43')][_0x704e('0x62')]){_0x49db54=as[_0x704e('0x63')](_0x581b52[_0x704e('0x43')][_0x704e('0x62')]);var _0x18fedf=_0x49db54['sqlOperator'];for(var _0x68ae0c=0x0;_0x68ae0c<_0x49db54[_0x704e('0x64')][_0x704e('0x49')];_0x68ae0c++){var _0x2a0c08=_0x49db54['conditions'][_0x68ae0c];var _0x26660d='i';var _0xff9801=_['find'](_0x1dee62,[_0x704e('0x34'),_0x2a0c08[_0x704e('0x50')]]);if(!_0xff9801){switch(_0x2a0c08[_0x704e('0x50')]){case _0x704e('0x65'):if(_0x2a0c08['value']==0x1){_0x2b5a8a['having']('`'+_0x2a0c08[_0x704e('0x50')]+_0x704e('0x66'));}else{_0x2b5a8a[_0x704e('0x67')]('`'+_0x2a0c08['field']+'`\x20>\x200');}break;case _0x704e('0x68'):if(_0x2a0c08['operator']===_0x704e('0x69')){if(_0x2a0c08['value'][_0x704e('0x39')]('\x20')['length']>0x1){_0x344d2b[_0x18fedf](_0x704e('0x6a'),qs[_0x704e('0x6b')](_0x2a0c08[_0x704e('0x6c')]),null);}else{var _0x4bf9c1='%'+_0x2a0c08[_0x704e('0x6c')]+'%';_0x344d2b[_0x18fedf]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4bf9c1,_0x4bf9c1,_0x4bf9c1);}}else{_0xff9801=_['find'](_0x1dee62,[_0x704e('0x34'),'ContactId']);_0x2a0c08[_0x704e('0x50')]=_0x704e('0x6d');_0x1b3628=as['buildExpression'](_0x26660d,_0xff9801['type'],_0x2a0c08);_0x344d2b[_0x18fedf](_0x1b3628[_0x704e('0x6e')],_0x1b3628[_0x704e('0x6c')][_0x704e('0x6f')],_0x1b3628[_0x704e('0x6c')][_0x704e('0x32')]);}break;case _0x704e('0x70'):var _0x3412ea=_0x2a0c08[_0x704e('0x6c')][_0x704e('0x39')](',')['map'](function(_0x373ad5){return Number(_0x373ad5);});_0x3412ea['forEach'](function(_0x1f9a5e){_0x1ba5ec['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1f9a5e+',%');});_0x4f21b2=_['union'](_0x4f21b2,_0x3412ea);break;case _0x704e('0x71'):if(_0x2a0c08['operator']===_0x704e('0x69')){_0x344d2b[_0x18fedf](_0x704e('0x72'),'%'+_0x2a0c08['value']+'%',null);}else{_0xff9801=_['find'](_0x1dee62,[_0x704e('0x34'),_0x704e('0x73')]);_0x2a0c08[_0x704e('0x50')]=_0x704e('0x73');_0x1b3628=as['buildExpression'](_0x26660d,_0xff9801['type'],_0x2a0c08);_0x344d2b[_0x18fedf](_0x1b3628[_0x704e('0x6e')],_0x1b3628[_0x704e('0x6c')]['start'],_0x1b3628[_0x704e('0x6c')]['end']);}break;case _0x704e('0x74'):_0x1b3628=as[_0x704e('0x75')]('me',null,_0x2a0c08);_0x344d2b[_0x18fedf](_0x1b3628[_0x704e('0x6e')],_0x1b3628['value']['start'],_0x1b3628[_0x704e('0x6c')][_0x704e('0x32')]);break;}}else{var _0x1b3628=as[_0x704e('0x75')](_0x26660d,_0xff9801['type'],_0x2a0c08);_0x344d2b[_0x18fedf](_0x1b3628[_0x704e('0x6e')],_0x1b3628[_0x704e('0x6c')]['start'],_0x1b3628['value']['end']);}}}else{var _0x45d849=_(_0x581b52[_0x704e('0x43')])[_0x704e('0x44')]()[_0x704e('0x42')](function(_0x1baa37){return _[_0x704e('0x76')](_0x1dee62,[_0x704e('0x34'),_0x1baa37])?_0x1baa37:undefined;})[_0x704e('0x77')]()[_0x704e('0x6c')]();if(!_[_0x704e('0x78')](_0x45d849)){_0x45d849['forEach'](function(_0x5944b3){if(_0x5944b3===_0x704e('0x79')){_0x2b5a8a['where']('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x581b52[_0x704e('0x43')][_0x5944b3]));}else if(_0x5944b3===_0x704e('0x7a')){var _0x291f03=JSON[_0x704e('0x7b')](_0x581b52[_0x704e('0x43')][_0x5944b3])[_0x704e('0x7c')];var _0x599164=JSON[_0x704e('0x7b')](_0x581b52[_0x704e('0x43')][_0x5944b3])[_0x704e('0x7d')];_0x2b5a8a['where'](_0x704e('0x7e'),_0x291f03,_0x599164);}else{if(_0x581b52[_0x704e('0x43')][_0x5944b3]===_0x704e('0x7f')){_0x2b5a8a[_0x704e('0x80')]('i.'+_0x5944b3+'\x20IS\x20NULL');}else{_0x2b5a8a[_0x704e('0x80')]('i.'+_0x5944b3+_0x704e('0x81'),_0x581b52[_0x704e('0x43')][_0x5944b3]);}}});}if(_0x581b52[_0x704e('0x43')][_0x704e('0x82')]){if(_0x581b52['query']['read']==0x1){_0x2b5a8a['having'](_0x704e('0x83'));}else{_0x2b5a8a[_0x704e('0x67')](_0x704e('0x84'));}}if(_0x581b52[_0x704e('0x43')]['tag']){_0x4f21b2=_[_0x704e('0x85')](_0x581b52[_0x704e('0x43')][_0x704e('0x86')])?_0x581b52[_0x704e('0x43')][_0x704e('0x86')]:new Array(_0x581b52['query'][_0x704e('0x86')]);_0x4f21b2[_0x704e('0x87')](function(_0x225d4a){_0x1ba5ec['or'](_0x704e('0x88'),'%,'+_0x225d4a+',%');});}if(_0x581b52[_0x704e('0x43')][_0x704e('0x89')]){var _0x417a71=_0x581b52[_0x704e('0x43')][_0x704e('0x89')][_0x704e('0x8a')]('\x5c','\x5c\x5c')[_0x704e('0x8a')](/'/g,'\x27\x27');if(qs[_0x704e('0x8b')](_0x417a71)){_0x344d2b['or'](_0x704e('0x8c'),_0x417a71+'%')['or'](_0x704e('0x8d'),_0x417a71+'%');}else{_0x344d2b['or'](_0x704e('0x8e'),qs[_0x704e('0x6b')](_0x417a71))['or'](_0x704e('0x8f'),_0x417a71+'%');}}}_0x2b5a8a[_0x704e('0x80')](_0x344d2b);_0x2b5a8a[_0x704e('0x90')](_0x704e('0x91'));var _0x98fa66={'type':db[_0x704e('0x92')][_0x704e('0x93')][_0x704e('0x94')],'raw':!![]};var _0x547363=_0x2b5a8a[_0x704e('0x95')]();_0x547363['field'](_0x704e('0x91'));_0x547363[_0x704e('0x50')](_0x704e('0x96'),'unreadMessages');if(_0x3491f3[_0x704e('0x97')]){_0x3491f3[_0x704e('0x97')][_0x704e('0x87')](function(_0x1c9c55){var _0x408f0f=_0x1c9c55[0x0]===_0x704e('0x98')?_0x1c9c55[0x0]:'i.'+_0x1c9c55[0x0];_0x2b5a8a[_0x704e('0x97')](_0x408f0f,_0x1c9c55[0x1]===_0x704e('0x99')?![]:!![]);});}if(!_[_0x704e('0x78')](_0x4f21b2)){_0x2b5a8a[_0x704e('0x67')](_0x1ba5ec);_0x547363['where']('t.id\x20IN\x20?',_0x4f21b2);}BPromise[_0x704e('0x9a')]()[_0x704e('0x30')](function(){if(!_0x49db54){if(_0x581b52[_0x704e('0x43')][_0x704e('0x79')])return;_0x547363[_0x704e('0x80')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x2b5a8a['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x581b52[_0x704e('0x9b')]['role']!==_0x704e('0x9c'))return;return _0x581b52[_0x704e('0x9b')][_0x704e('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x33ef21){if(_[_0x704e('0x78')](_0x33ef21)){_0x547363[_0x704e('0x80')](_0x704e('0x9e'));_0x2b5a8a[_0x704e('0x80')](_0x704e('0x9e'));}else{_0x547363[_0x704e('0x80')](_0x704e('0x9f'),_[_0x704e('0x42')](_0x33ef21,'id'));_0x2b5a8a[_0x704e('0x80')](_0x704e('0x9f'),_[_0x704e('0x42')](_0x33ef21,'id'));}});})[_0x704e('0x30')](function(){if(_0x581b52[_0x704e('0x9b')]['role']==='agent'&&!_0x49db54&&!_0x581b52[_0x704e('0x43')][_0x704e('0x79')])return[];return db[_0x704e('0xa0')][_0x704e('0x43')](_0x547363[_0x704e('0xa1')](),_0x98fa66);})['then'](function(_0x5c9b38){_0x5eb0f8[_0x704e('0x29')]=_0x5c9b38['length'];if(_0x5eb0f8[_0x704e('0x29')]===0x0)return[];return db[_0x704e('0xa0')]['query'](_0xe6df5e[_0x704e('0xa1')](),_0x98fa66)['then'](function(_0x3b7309){_0xf2bfdb=_[_0x704e('0xa2')](_0x3b7309,'id');_0x98fa66=_['merge'](_0x98fa66,{'model':db[_0x704e('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x581b52['query']['fields']){_0x3491f3[_0x704e('0x46')]['forEach'](function(_0x2c111e){_0x2b5a8a[_0x704e('0x50')]('i.'+_0x2c111e);});}else{_0x2b5a8a[_0x704e('0x50')](_0x704e('0x96'),_0x704e('0x65'));_0x2b5a8a[_0x704e('0x50')](_0x704e('0xa3'),_0x704e('0xa4'));_0x2b5a8a[_0x704e('0x50')](_0x704e('0xa5'),'Account.mandatoryDisposition');_0x2b5a8a[_0x704e('0x50')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x704e('0x98'));_0x2b5a8a[_0x704e('0x50')]('i.*');_0x2b5a8a[_0x704e('0x50')](_0x704e('0xa6'),_0x704e('0xa7'));_0x2b5a8a[_0x704e('0x50')](_0x704e('0xa8'),_0x704e('0xa9'));_0x2b5a8a[_0x704e('0x50')](_0x704e('0xaa'),_0x704e('0xab'));_0x2b5a8a[_0x704e('0x50')](_0x704e('0xac'),_0x704e('0xad'));_0x2b5a8a['field'](_0x704e('0xae'),_0x704e('0xaf'));_0x2b5a8a['field'](_0x704e('0xb0'),_0x704e('0xb1'));_0x2b5a8a[_0x704e('0x50')](_0x704e('0xb2'),_0x704e('0xb3'));_0x2b5a8a[_0x704e('0x50')](_0x704e('0xb4'),_0x704e('0xb5'));_0x2b5a8a[_0x704e('0x50')](_0x704e('0xb6'),_0x704e('0x37'));}if(_0x3491f3[_0x704e('0x4c')])_0x2b5a8a[_0x704e('0x4c')](_0x3491f3['limit']);if(_0x3491f3[_0x704e('0x28')])_0x2b5a8a['offset'](_0x3491f3[_0x704e('0x28')]);return db['sequelize'][_0x704e('0x43')](_0x2b5a8a[_0x704e('0xa1')](),_0x98fa66);})[_0x704e('0x30')](function(_0x42325e){if(_0x42325e[_0x704e('0x49')]>0x0)_0x49d799['where'](_0x704e('0xb7'),_[_0x704e('0x42')](_0x42325e,'id'));return db[_0x704e('0xa0')]['query'](_0x49d799[_0x704e('0xa1')](),_0x98fa66)[_0x704e('0x30')](function(_0x2b4266){var _0x3d16ca=_[_0x704e('0xb8')](_0x2b4266,_0x704e('0xb9'));var _0x2915a6=[];_0x42325e[_0x704e('0x87')](function(_0x1cfcd9){_0x2915a6['push'](updateSmsInteraction(_0x1cfcd9,_0xf2bfdb,_0x3d16ca));});return BPromise['all'](_0x2915a6);});});})[_0x704e('0x30')](function(_0x28dea7){_0x5eb0f8['rows']=_0x28dea7;return _0x5eb0f8;})[_0x704e('0x30')](respondWithFilteredResult(_0x4a21c2,_0x3491f3))[_0x704e('0x3b')](handleError(_0x4a21c2,null));};exports[_0x704e('0xba')]=function(_0x12024b,_0x920c4b){var _0x584fdc={'raw':![],'where':{'id':_0x12024b[_0x704e('0xbb')]['id']}},_0x5af510={};_0x5af510['model']=_[_0x704e('0x44')](db[_0x704e('0x3d')][_0x704e('0x3e')]);_0x5af510[_0x704e('0x43')]=_[_0x704e('0x44')](_0x12024b['query']);_0x5af510['filters']=_[_0x704e('0x47')](_0x5af510[_0x704e('0x41')],_0x5af510['query']);_0x584fdc[_0x704e('0x46')]=_[_0x704e('0x47')](_0x5af510[_0x704e('0x41')],qs['fields'](_0x12024b[_0x704e('0x43')][_0x704e('0x48')]));_0x584fdc[_0x704e('0x46')]=_0x584fdc[_0x704e('0x46')][_0x704e('0x49')]?_0x584fdc[_0x704e('0x46')]:_0x5af510[_0x704e('0x41')];if(_0x12024b[_0x704e('0x43')][_0x704e('0xbc')]){_0x584fdc['include']=[{'all':!![]}];}_0x584fdc=_['merge']({},_0x584fdc,_0x12024b[_0x704e('0xbd')]);return db[_0x704e('0x3d')][_0x704e('0xbe')](_0x584fdc)['then'](handleEntityNotFound(_0x920c4b,null))[_0x704e('0x30')](respondWithResult(_0x920c4b,null))[_0x704e('0x3b')](handleError(_0x920c4b,null));};exports[_0x704e('0xbf')]=function(_0x58c343,_0x3f2bbe){return db[_0x704e('0x3d')][_0x704e('0xbf')](_0x58c343[_0x704e('0x74')],{})[_0x704e('0x30')](respondWithResult(_0x3f2bbe,0xc9))[_0x704e('0x3b')](handleError(_0x3f2bbe,null));};exports[_0x704e('0x2f')]=function(_0x2a23ce,_0x52b253){if(_0x2a23ce[_0x704e('0x74')]['id']){delete _0x2a23ce['body']['id'];}return db[_0x704e('0x3d')][_0x704e('0xbe')]({'where':{'id':_0x2a23ce[_0x704e('0xbb')]['id']}})[_0x704e('0x30')](handleEntityNotFound(_0x52b253,null))[_0x704e('0x30')](saveUpdates(_0x2a23ce['body'],null))[_0x704e('0x30')](respondWithResult(_0x52b253,null))[_0x704e('0x3b')](handleError(_0x52b253,null));};exports[_0x704e('0x31')]=function(_0x4051cf,_0x544ae2){return db[_0x704e('0x3d')][_0x704e('0xbe')]({'where':{'id':_0x4051cf['params']['id']}})[_0x704e('0x30')](handleEntityNotFound(_0x544ae2,null))[_0x704e('0x30')](removeEntity(_0x544ae2,null))[_0x704e('0x3b')](handleError(_0x544ae2,null));};exports['describe']=function(_0x56945f,_0x16d70b){return db[_0x704e('0x3d')][_0x704e('0xc0')]()['then'](respondWithResult(_0x16d70b,null))[_0x704e('0x3b')](handleError(_0x16d70b,null));};exports[_0x704e('0xc1')]=function(_0x2b3aaa,_0x5f23cd,_0x33dba7){return db[_0x704e('0xc2')][_0x704e('0xbe')]({'where':{'id':_0x2b3aaa[_0x704e('0xbb')]['id']}})[_0x704e('0x30')](handleEntityNotFound(_0x5f23cd,null))[_0x704e('0x30')](function(_0x37c3a6){if(_0x37c3a6){return _0x37c3a6[_0x704e('0xc1')](_0x2b3aaa[_0x704e('0x74')]['ids'],_[_0x704e('0xc3')](_0x2b3aaa[_0x704e('0x74')],[_0x704e('0xc4'),'id'])||{});}})[_0x704e('0x30')](respondWithResult(_0x5f23cd,null))[_0x704e('0x3b')](handleError(_0x5f23cd,null));};exports[_0x704e('0xc5')]=function(_0x1c6f3c,_0x2859ae,_0x523f8d){var _0x207d70={'raw':![],'where':{}};var _0x5b22fb={};var _0x2bae4c={'count':0x0,'rows':[]};return db[_0x704e('0x3d')][_0x704e('0xc6')]({'where':{'id':_0x1c6f3c[_0x704e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2859ae,null))[_0x704e('0x30')](function(_0x54b09f){if(_0x54b09f){_0x5b22fb[_0x704e('0x41')]=_[_0x704e('0x44')](db[_0x704e('0xc2')][_0x704e('0x3e')]);_0x5b22fb['query']=_['keys'](_0x1c6f3c[_0x704e('0x43')]);_0x5b22fb['filters']=_[_0x704e('0x47')](_0x5b22fb[_0x704e('0x41')],_0x5b22fb[_0x704e('0x43')]);_0x207d70[_0x704e('0x46')]=_[_0x704e('0x47')](_0x5b22fb['model'],qs['fields'](_0x1c6f3c[_0x704e('0x43')][_0x704e('0x48')]));_0x207d70[_0x704e('0x46')]=_0x207d70[_0x704e('0x46')][_0x704e('0x49')]?_0x207d70[_0x704e('0x46')]:_0x5b22fb[_0x704e('0x41')];if(!_0x1c6f3c[_0x704e('0x43')][_0x704e('0x4a')]('nolimit')){_0x207d70['limit']=qs[_0x704e('0x4c')](_0x1c6f3c['query'][_0x704e('0x4c')]);_0x207d70[_0x704e('0x28')]=qs['offset'](_0x1c6f3c[_0x704e('0x43')][_0x704e('0x28')]);}_0x207d70[_0x704e('0x97')]=qs[_0x704e('0x4d')](_0x1c6f3c[_0x704e('0x43')][_0x704e('0x4d')]);_0x207d70[_0x704e('0x80')]=qs[_0x704e('0x45')](_[_0x704e('0x4e')](_0x1c6f3c[_0x704e('0x43')],_0x5b22fb[_0x704e('0x45')]));_0x207d70['where'][_0x704e('0xb9')]=_0x54b09f['id'];if(_0x1c6f3c[_0x704e('0x43')][_0x704e('0x89')]){_0x207d70['where']=_['merge'](_0x207d70[_0x704e('0x80')],{'$or':_[_0x704e('0x42')](_0x207d70[_0x704e('0x46')],function(_0x20d56a){var _0x3ed940={};_0x3ed940[_0x20d56a]={'$like':'%'+_0x1c6f3c[_0x704e('0x43')]['filter']+'%'};return _0x3ed940;})});}if(_0x1c6f3c['query'][_0x704e('0x7c')]){var _0x8bcb7e=_0x1c6f3c[_0x704e('0x43')][_0x704e('0x7c')][_0x704e('0x39')](',');var _0x471616={};_0x471616[_0x8bcb7e[0x0]]={'$gte':moment(_0x8bcb7e[0x1])['format'](_0x704e('0xc7'))};_0x207d70['where']=_['merge'](_0x207d70['where'],_0x471616);}_0x207d70=_[_0x704e('0xc8')]({},_0x207d70,_0x1c6f3c[_0x704e('0xbd')]);return db[_0x704e('0xc2')][_0x704e('0x29')]({'where':_0x207d70[_0x704e('0x80')]})[_0x704e('0x30')](function(_0x3562c6){_0x2bae4c[_0x704e('0x29')]=_0x3562c6;if(_0x1c6f3c[_0x704e('0x43')][_0x704e('0xbc')]){_0x207d70[_0x704e('0xc9')]=[{'all':!![]}];}return db[_0x704e('0xc2')][_0x704e('0xca')](_0x207d70);})[_0x704e('0x30')](function(_0x2329d5){_0x2bae4c['rows']=_0x2329d5;return _0x2bae4c;});}})[_0x704e('0x30')](respondWithFilteredResult(_0x2859ae,_0x207d70))[_0x704e('0x3b')](handleError(_0x2859ae,null));};exports[_0x704e('0xcb')]=function(_0x547405,_0x28c5ec,_0x3bcede){return db[_0x704e('0x3d')][_0x704e('0xbe')]({'where':{'id':_0x547405[_0x704e('0xbb')]['id']}})[_0x704e('0x30')](handleEntityNotFound(_0x28c5ec,null))[_0x704e('0x30')](function(_0x1271c6){if(_0x1271c6){return _0x1271c6[_0x704e('0xcc')](_0x547405['body']['ids'],_[_0x704e('0xc3')](_0x547405[_0x704e('0x74')],[_0x704e('0xc4'),'id'])||{})['spread'](function(){return db[_0x704e('0x70')][_0x704e('0xca')]({'attributes':['id',_0x704e('0x34'),'color'],'where':{'id':_0x547405[_0x704e('0x74')][_0x704e('0xc4')]}});})[_0x704e('0x30')](function(_0x3e280c){socket['emit'](_0x704e('0xcd'),{'id':Number(_0x547405[_0x704e('0xbb')]['id']),'tags':_0x3e280c||[]});return{'id':Number(_0x547405[_0x704e('0xbb')]['id']),'tags':_0x3e280c||[]};});}})[_0x704e('0x30')](respondWithResult(_0x28c5ec,null))[_0x704e('0x3b')](handleError(_0x28c5ec,null));};exports[_0x704e('0xce')]=function(_0x2fcd91,_0x437ada,_0x4b54ef){return db['SmsInteraction'][_0x704e('0xbe')]({'where':{'id':_0x2fcd91[_0x704e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x437ada,null))[_0x704e('0x30')](function(_0x13ddc6){if(_0x13ddc6){return _0x13ddc6['removeTags'](_0x2fcd91[_0x704e('0x43')]['ids']);}})[_0x704e('0x30')](respondWithStatusCode(_0x437ada,null))[_0x704e('0x3b')](handleError(_0x437ada,null));};exports[_0x704e('0xcf')]=function(_0x2c8a1b,_0x131827){var _0xda84d5=moment()[_0x704e('0xd0')]()[_0x704e('0xa1')]();var _0x37a1c1=path[_0x704e('0xd1')](config[_0x704e('0xd2')],'server',_0x704e('0xd3'),_0x704e('0xd4'));var _0x3c9d25=path[_0x704e('0xd1')](config['root'],'server',_0x704e('0xd3'),_0x704e('0xd5'));var _0x4b1b10=path[_0x704e('0xd1')](_0x37a1c1,_0xda84d5);var _0x1650dc=util['format'](_0x704e('0xd6'),_0x2c8a1b[_0x704e('0xbb')]['id'],_0xda84d5);var _0x16acf2=path['join'](_0x37a1c1,_0x1650dc);var _0x39fe38=[];_0x39fe38['push']({'model':db[_0x704e('0x71')],'as':'User','attributes':['id',_0x704e('0x36')],'raw':!![]});_0x39fe38[_0x704e('0x3a')]({'model':db[_0x704e('0xd7')],'as':'Contact','attributes':['id',_0x704e('0xd8'),'lastName'],'raw':!![]});var _0x668477=[{'model':db[_0x704e('0xc2')],'as':'Messages','attributes':['id',_0x704e('0x74'),_0x704e('0x7a'),'direction',_0x704e('0xd9'),'read'],'include':_0x39fe38}];_0x668477[_0x704e('0x3a')]({'model':db[_0x704e('0xda')],'as':_0x704e('0xdb'),'attributes':['id','name']});_0x668477[_0x704e('0x3a')]({'model':db[_0x704e('0x71')],'as':'Owner','attributes':['id',_0x704e('0x36')]});return db['SmsInteraction'][_0x704e('0xbe')]({'where':{'id':_0x2c8a1b[_0x704e('0xbb')]['id']},'include':_0x668477})[_0x704e('0x30')](handleEntityNotFound(_0x131827,null))[_0x704e('0x30')](function(_0x3bd9c5){if(_0x3bd9c5){var _0x10ef58=_0x3bd9c5[_0x704e('0xdc')]({'plain':!![]});fs[_0x704e('0xdd')](_0x4b1b10);var _0x3cda70={'channel':_0x704e('0xde'),'account':_0x10ef58[_0x704e('0xdb')][_0x704e('0x34')],'agent':_0x10ef58[_0x704e('0xdf')]?_0x10ef58[_0x704e('0xdf')][_0x704e('0x36')]:'N.A.','createdAt':moment(_0x10ef58['createdAt'])[_0x704e('0xe0')](_0x704e('0xc7'))[_0x704e('0xa1')](),'closedAt':_0x10ef58['closed']?moment(_0x10ef58[_0x704e('0xe1')])[_0x704e('0xe0')](_0x704e('0xc7'))[_0x704e('0xa1')]():'','disposition':_0x10ef58[_0x704e('0xe2')],'messages':_(_0x10ef58[_0x704e('0xe3')])[_0x704e('0x89')]({'secret':![]})['map'](function(_0x1868b5){return{'date':moment(_0x1868b5[_0x704e('0x7a')])[_0x704e('0xe0')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1868b5[_0x704e('0xe4')]===_0x704e('0xe5')?_0x1868b5['User']?_0x1868b5[_0x704e('0x71')][_0x704e('0x36')]:'System':_0x1868b5[_0x704e('0x68')][_0x704e('0xd8')]+(_0x1868b5[_0x704e('0x68')]['lastName']?'\x20'+_0x1868b5[_0x704e('0x68')][_0x704e('0xe6')]:''),'body':_0x1868b5[_0x704e('0x74')],'direction':_0x1868b5[_0x704e('0xe4')]===_0x704e('0xe5')?'A':'C','secret':_0x1868b5[_0x704e('0xd9')],'read':_0x1868b5[_0x704e('0x82')]};})[_0x704e('0x6c')]()};return ejs['renderFile'](path['join'](config['root'],_0x704e('0xe7'),_0x704e('0xe8'),'downloadInteraction.html'),{'interaction':_0x3cda70})[_0x704e('0x30')](function(_0x1088eb){var _0x376db0=path[_0x704e('0xd1')](_0x4b1b10,_0x704e('0xe9')+_0x10ef58['id']+'-'+_0xda84d5+_0x704e('0xea'));var _0x3c4b68={'path':_0x376db0,'channel':_0x704e('0xde'),'interactionId':_0x10ef58['id']};return pdf[_0x704e('0xeb')](_0x1088eb,_0x3c4b68);})[_0x704e('0x30')](function(){return new BPromise(function(_0x17a7de,_0x3a0c5d){zipdir(_0x4b1b10,{'saveTo':_0x16acf2},function(_0x36d53e,_0x4c4946){if(_0x36d53e)return _0x3a0c5d(_0x36d53e);return _0x17a7de(_0x4c4946);});})[_0x704e('0x30')](function(){return new BPromise(function(_0x5c4994,_0x532b02){rimraf(_0x4b1b10,function(_0x319649){if(_0x319649)_0x532b02(_0x319649);return _0x5c4994();});});})[_0x704e('0x30')](function(){return _0x131827[_0x704e('0xcf')](_0x16acf2,_0x1650dc,function(_0x3afb84){if(_0x3afb84){console['log']('err',_0x3afb84);}else{fs['unlinkSync'](_0x16acf2);}});});});}else{return _0x131827[_0x704e('0x24')](0xc8);}})[_0x704e('0x3b')](handleError(_0x131827,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index af1de7e..124d6fe 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 _0xf767=['findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map'];(function(_0xd5b7b7,_0x2a1c58){var _0x919156=function(_0x2d4d7d){while(--_0x2d4d7d){_0xd5b7b7['push'](_0xd5b7b7['shift']());}};_0x919156(++_0x2a1c58);}(_0xf767,0x76));var _0x7f76=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xf767[_0x343e44];return _0xa5130e;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x7f76('0x0'))['db'][_0x7f76('0x1')];var SmsMessage=require(_0x7f76('0x0'))['db'][_0x7f76('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7f76('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f76('0x4'),'afterDestroy':_0x7f76('0x5')};function emitEvent(_0x40ba50){return function(_0x25cd62,_0x5922e5,_0x23c243){_0x25cd62[_0x7f76('0x6')]({'attributes':['id'],'raw':!![]})[_0x7f76('0x7')](function(_0x1eeb08){_0x25cd62[_0x7f76('0x8')]('Users',_0x1eeb08[_0x7f76('0x9')](function(_0x109950){return{'id':_0x109950['id']};}));return SmsMessage[_0x7f76('0xa')]({'where':{'SmsInteractionId':_0x25cd62['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f76('0x7')](function(_0x4c5f88){_0x25cd62[_0x7f76('0x8')]('unreadMessages',_0x4c5f88[_0x7f76('0xb')]);SmsInteractionEvents[_0x7f76('0xc')](_0x40ba50+':'+_0x25cd62['id'],_0x25cd62);SmsInteractionEvents[_0x7f76('0xc')](_0x40ba50,_0x25cd62);_0x23c243(null);})[_0x7f76('0xd')](_0x23c243(null));};}for(var e in events){if(events[_0x7f76('0xe')](e)){var event=events[e];SmsInteraction[_0x7f76('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xee24=['setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0xfb7cc7,_0x41b7b5){var _0xf6d987=function(_0x251d46){while(--_0x251d46){_0xfb7cc7['push'](_0xfb7cc7['shift']());}};_0xf6d987(++_0x41b7b5);}(_0xee24,0x1a6));var _0x4ee2=function(_0x30ab77,_0x1bc21c){_0x30ab77=_0x30ab77-0x0;var _0x76e91b=_0xee24[_0x30ab77];return _0x76e91b;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x4ee2('0x0'))['db'][_0x4ee2('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x4ee2('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4ee2('0x3')](0x0);var events={'afterCreate':_0x4ee2('0x4'),'afterUpdate':_0x4ee2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1aee89){return function(_0x179bfa,_0x477664,_0x1993de){_0x179bfa['getUsers']({'attributes':['id'],'raw':!![]})[_0x4ee2('0x6')](function(_0x319d9d){_0x179bfa[_0x4ee2('0x7')](_0x4ee2('0x8'),_0x319d9d[_0x4ee2('0x9')](function(_0x15f436){return{'id':_0x15f436['id']};}));return SmsMessage[_0x4ee2('0xa')]({'where':{'SmsInteractionId':_0x179bfa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4ee2('0x6')](function(_0x550e8d){_0x179bfa['setDataValue'](_0x4ee2('0xb'),_0x550e8d[_0x4ee2('0xc')]);SmsInteractionEvents[_0x4ee2('0xd')](_0x1aee89+':'+_0x179bfa['id'],_0x179bfa);SmsInteractionEvents[_0x4ee2('0xd')](_0x1aee89,_0x179bfa);_0x1993de(null);})[_0x4ee2('0xe')](_0x1993de(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x4ee2('0xf')](e,emitEvent(event));}}module[_0x4ee2('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index decb48e..b305ee6 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 _0xd55c=['../../config/logger','moment','bluebird','../../config/environment','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','util'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0xd55c,0x17f));var _0xcd55=function(_0x30a3ac,_0x4da7d2){_0x30a3ac=_0x30a3ac-0x0;var _0x31e5b0=_0xd55c[_0x30a3ac];return _0x31e5b0;};'use strict';var _=require('lodash');var util=require(_0xcd55('0x0'));var logger=require(_0xcd55('0x1'))('api');var moment=require(_0xcd55('0x2'));var BPromise=require(_0xcd55('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcd55('0x4'));var attributes=require('./smsInteraction.attributes');module[_0xcd55('0x5')]=function(_0x396a14,_0x4130d5){return _0x396a14['define'](_0xcd55('0x6'),attributes,{'tableName':_0xcd55('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e78e9,_0x45e56e,_0x46732f){if(_0x1e78e9[_0xcd55('0x8')](_0xcd55('0x9'))){_0x1e78e9[_0xcd55('0xa')]=moment()[_0xcd55('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x46732f(null,_0x1e78e9);}}});}; \ No newline at end of file +var _0xe5db=['sms_interactions','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0x5554bf,_0x2b85b3){var _0x3119d1=function(_0x2f8397){while(--_0x2f8397){_0x5554bf['push'](_0x5554bf['shift']());}};_0x3119d1(++_0x2b85b3);}(_0xe5db,0x113));var _0xbe5d=function(_0x57056f,_0x534b3b){_0x57056f=_0x57056f-0x0;var _0x2b8293=_0xe5db[_0x57056f];return _0x2b8293;};'use strict';var _=require(_0xbe5d('0x0'));var util=require('util');var logger=require(_0xbe5d('0x1'))(_0xbe5d('0x2'));var moment=require(_0xbe5d('0x3'));var BPromise=require('bluebird');var rp=require(_0xbe5d('0x4'));var fs=require('fs');var path=require(_0xbe5d('0x5'));var rimraf=require(_0xbe5d('0x6'));var config=require(_0xbe5d('0x7'));var attributes=require(_0xbe5d('0x8'));module[_0xbe5d('0x9')]=function(_0x3d7d8e,_0x3952e7){return _0x3d7d8e['define'](_0xbe5d('0xa'),attributes,{'tableName':_0xbe5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23abc3,_0x34fb19,_0x460238){if(_0x23abc3['changed']('closed')){_0x23abc3['closedAt']=moment()['format'](_0xbe5d('0xc'));}_0x460238(null,_0x23abc3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 67019f5..ace2909 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 _0x289d=['socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','AddTagsToSmsInteraction','addTags','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x30d849,_0x3c9499){var _0x9422d2=function(_0x353fcc){while(--_0x353fcc){_0x30d849['push'](_0x30d849['shift']());}};_0x9422d2(++_0x3c9499);}(_0x289d,0x1ac));var _0xd289=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x289d[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd289('0x0'));var BPromise=require(_0xd289('0x1'));var rs=require(_0xd289('0x2'));var fs=require('fs');var Redis=require(_0xd289('0x3'));var db=require(_0xd289('0x4'))['db'];var utils=require(_0xd289('0x5'));var logger=require(_0xd289('0x6'))(_0xd289('0x7'));var config=require('../../config/environment');var jayson=require(_0xd289('0x8'));var client=jayson[_0xd289('0x9')]['http']({'port':0x232a});config[_0xd289('0xa')]=_[_0xd289('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd289('0xc'))(new Redis(config[_0xd289('0xa')]));require(_0xd289('0xd'))[_0xd289('0xe')](socket);function respondWithRpcPromise(_0x1cabc0,_0x99320c,_0x5484ef){return new BPromise(function(_0x6e86f0,_0x2b26d9){return client[_0xd289('0xf')](_0x1cabc0,_0x5484ef)[_0xd289('0x10')](function(_0x5091d1){logger[_0xd289('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x99320c,_0xd289('0x12'));logger['debug'](_0xd289('0x13'),_0x99320c,_0xd289('0x12'),JSON[_0xd289('0x14')](_0x5091d1));if(_0x5091d1[_0xd289('0x15')]){if(_0x5091d1[_0xd289('0x15')][_0xd289('0x16')]===0x1f4){logger[_0xd289('0x15')](_0xd289('0x17'),_0x99320c,_0x5091d1['error'][_0xd289('0x18')]);return _0x2b26d9(_0x5091d1[_0xd289('0x15')][_0xd289('0x18')]);}logger[_0xd289('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x99320c,_0x5091d1[_0xd289('0x15')][_0xd289('0x18')]);return _0x6e86f0(_0x5091d1[_0xd289('0x15')][_0xd289('0x18')]);}else{logger['info'](_0xd289('0x17'),_0x99320c,_0xd289('0x12'));_0x6e86f0(_0x5091d1[_0xd289('0x19')]['message']);}})[_0xd289('0x1a')](function(_0xbe579d){logger[_0xd289('0x15')](_0xd289('0x17'),_0x99320c,_0xbe579d);_0x2b26d9(_0xbe579d);});});}exports[_0xd289('0x1b')]=function(_0xf02abb){var _0x4c8e9f=this;return new Promise(function(_0x3855c2,_0x3dbc43){return db[_0xd289('0x1c')][_0xd289('0x1d')](_0xf02abb[_0xd289('0x1e')],{'raw':_0xf02abb[_0xd289('0x1f')]?_0xf02abb[_0xd289('0x1f')][_0xd289('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf02abb[_0xd289('0x1f')]?_0xf02abb[_0xd289('0x1f')][_0xd289('0x21')]||null:null,'attributes':_0xf02abb[_0xd289('0x1f')]?_0xf02abb[_0xd289('0x1f')][_0xd289('0x22')]||null:null,'limit':_0xf02abb['options']?_0xf02abb['options']['limit']||null:null})['then'](function(_0x3cc63a){logger[_0xd289('0x11')]('UpdateSmsInteraction',_0xf02abb);logger['debug'](_0xd289('0x1b'),_0xf02abb,JSON[_0xd289('0x14')](_0x3cc63a));_0x3855c2(_0x3cc63a);})[_0xd289('0x1a')](function(_0x420276){logger['error']('UpdateSmsInteraction',_0x420276[_0xd289('0x18')],_0xf02abb);_0x3dbc43(_0x4c8e9f[_0xd289('0x15')](0x1f4,_0x420276[_0xd289('0x18')]));});});};exports[_0xd289('0x23')]=function(_0x2c1f63){return new Promise(function(_0x25d3ec,_0x30b51e){return db[_0xd289('0x1c')]['find']({'where':_0x2c1f63[_0xd289('0x1f')]?_0x2c1f63[_0xd289('0x1f')][_0xd289('0x21')]||null:null})[_0xd289('0x10')](function(_0x239b23){if(_0x239b23){return _0x239b23[_0xd289('0x24')](_0x2c1f63['body']['ids'],_[_0xd289('0x25')](_0x2c1f63[_0xd289('0x1e')],['ids','id'])||{});}})[_0xd289('0x26')](function(_0x50ca1b){logger[_0xd289('0x11')]('AddTags',_0x2c1f63);logger['debug'](_0xd289('0x27'),_0x2c1f63,JSON[_0xd289('0x14')](_0x50ca1b));_0x25d3ec(_0x50ca1b);})[_0xd289('0x1a')](function(_0x66618b){logger[_0xd289('0x15')](_0xd289('0x27'),_0x66618b[_0xd289('0x18')],_0x2c1f63);_0x30b51e(_this[_0xd289('0x15')](0x1f4,_0x66618b[_0xd289('0x18')]));});});}; \ No newline at end of file +var _0xd96d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','limit','catch','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd96d,0x1f1));var _0xdd96=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xd96d[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xdd96('0x0'));var util=require(_0xdd96('0x1'));var moment=require('moment');var BPromise=require(_0xdd96('0x2'));var rs=require(_0xdd96('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd96('0x4'))['db'];var utils=require(_0xdd96('0x5'));var logger=require('../../config/logger')(_0xdd96('0x6'));var config=require(_0xdd96('0x7'));var jayson=require(_0xdd96('0x8'));var client=jayson[_0xdd96('0x9')][_0xdd96('0xa')]({'port':0x232a});config[_0xdd96('0xb')]=_[_0xdd96('0xc')](config[_0xdd96('0xb')],{'host':_0xdd96('0xd'),'port':0x18eb});var socket=require(_0xdd96('0xe'))(new Redis(config[_0xdd96('0xb')]));require(_0xdd96('0xf'))['register'](socket);function respondWithRpcPromise(_0x46c7a6,_0x17065b,_0x2eadad){return new BPromise(function(_0x27a2cb,_0x47d91b){return client[_0xdd96('0x10')](_0x46c7a6,_0x2eadad)[_0xdd96('0x11')](function(_0x14aa67){logger[_0xdd96('0x12')](_0xdd96('0x13'),_0x17065b,_0xdd96('0x14'));logger[_0xdd96('0x15')](_0xdd96('0x16'),_0x17065b,_0xdd96('0x14'),JSON[_0xdd96('0x17')](_0x14aa67));if(_0x14aa67['error']){if(_0x14aa67[_0xdd96('0x18')][_0xdd96('0x19')]===0x1f4){logger[_0xdd96('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x17065b,_0x14aa67['error'][_0xdd96('0x1a')]);return _0x47d91b(_0x14aa67[_0xdd96('0x18')][_0xdd96('0x1a')]);}logger['error'](_0xdd96('0x13'),_0x17065b,_0x14aa67[_0xdd96('0x18')][_0xdd96('0x1a')]);return _0x27a2cb(_0x14aa67[_0xdd96('0x18')][_0xdd96('0x1a')]);}else{logger[_0xdd96('0x12')](_0xdd96('0x13'),_0x17065b,_0xdd96('0x14'));_0x27a2cb(_0x14aa67[_0xdd96('0x1b')][_0xdd96('0x1a')]);}})['catch'](function(_0x311fb2){logger[_0xdd96('0x18')](_0xdd96('0x13'),_0x17065b,_0x311fb2);_0x47d91b(_0x311fb2);});});}exports[_0xdd96('0x1c')]=function(_0x1fbcbc){var _0x5389e3=this;return new Promise(function(_0x30fe94,_0x26bbb4){return db[_0xdd96('0x1d')]['update'](_0x1fbcbc[_0xdd96('0x1e')],{'raw':_0x1fbcbc['options']?_0x1fbcbc[_0xdd96('0x1f')][_0xdd96('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fbcbc['options']?_0x1fbcbc[_0xdd96('0x1f')][_0xdd96('0x21')]||null:null,'attributes':_0x1fbcbc[_0xdd96('0x1f')]?_0x1fbcbc[_0xdd96('0x1f')]['attributes']||null:null,'limit':_0x1fbcbc[_0xdd96('0x1f')]?_0x1fbcbc['options'][_0xdd96('0x22')]||null:null})[_0xdd96('0x11')](function(_0x5d961d){logger[_0xdd96('0x12')]('UpdateSmsInteraction',_0x1fbcbc);logger[_0xdd96('0x15')](_0xdd96('0x1c'),_0x1fbcbc,JSON[_0xdd96('0x17')](_0x5d961d));_0x30fe94(_0x5d961d);})[_0xdd96('0x23')](function(_0x473e56){logger[_0xdd96('0x18')](_0xdd96('0x1c'),_0x473e56[_0xdd96('0x1a')],_0x1fbcbc);_0x26bbb4(_0x5389e3[_0xdd96('0x18')](0x1f4,_0x473e56[_0xdd96('0x1a')]));});});};exports[_0xdd96('0x24')]=function(_0x3f49be){return new Promise(function(_0x5d59e1,_0x4de9f1){return db['SmsInteraction'][_0xdd96('0x25')]({'where':_0x3f49be[_0xdd96('0x1f')]?_0x3f49be[_0xdd96('0x1f')][_0xdd96('0x21')]||null:null})[_0xdd96('0x11')](function(_0x33984e){if(_0x33984e){return _0x33984e[_0xdd96('0x26')](_0x3f49be[_0xdd96('0x1e')][_0xdd96('0x27')],_['omit'](_0x3f49be[_0xdd96('0x1e')],[_0xdd96('0x27'),'id'])||{});}})[_0xdd96('0x28')](function(_0x4db30b){logger[_0xdd96('0x12')](_0xdd96('0x29'),_0x3f49be);logger[_0xdd96('0x15')](_0xdd96('0x29'),_0x3f49be,JSON[_0xdd96('0x17')](_0x4db30b));_0x5d59e1(_0x4db30b);})['catch'](function(_0x2a8091){logger['error']('AddTags',_0x2a8091[_0xdd96('0x1a')],_0x3f49be);_0x4de9f1(_this[_0xdd96('0x18')](0x1f4,_0x2a8091['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index bfbb861..2ac8916 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 _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x4b373f,_0x28cc1f){var _0x3204bc=function(_0x3b08be){while(--_0x3b08be){_0x4b373f['push'](_0x4b373f['shift']());}};_0x3204bc(++_0x28cc1f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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 +var _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0x111fea,_0x511396){var _0x363b74=function(_0x31bee6){while(--_0x31bee6){_0x111fea['push'](_0x111fea['shift']());}};_0x363b74(++_0x511396);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 19e5fe4..5a10339 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 _0x0bf3=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','sms','smsmessage:create','status','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','path'];(function(_0x1ad9a6,_0x17dc8e){var _0x3f836e=function(_0x10fd71){while(--_0x10fd71){_0x1ad9a6['push'](_0x1ad9a6['shift']());}};_0x3f836e(++_0x17dc8e);}(_0x0bf3,0x1a7));var _0x30bf=function(_0x20d629,_0x465e33){_0x20d629=_0x20d629-0x0;var _0x4322b0=_0x0bf3[_0x20d629];return _0x4322b0;};'use strict';var multer=require(_0x30bf('0x0'));var util=require('util');var path=require(_0x30bf('0x1'));var timeout=require(_0x30bf('0x2'));var express=require(_0x30bf('0x3'));var router=express['Router']();var fs_extra=require(_0x30bf('0x4'));var auth=require(_0x30bf('0x5'));var interaction=require(_0x30bf('0x6'));var config=require(_0x30bf('0x7'));var controller=require(_0x30bf('0x8'));router[_0x30bf('0x9')]('/',auth[_0x30bf('0xa')](),controller[_0x30bf('0xb')]);router[_0x30bf('0x9')](_0x30bf('0xc'),auth[_0x30bf('0xa')](),controller[_0x30bf('0xd')]);router['get'](_0x30bf('0xe'),auth[_0x30bf('0xa')](),controller['show']);router[_0x30bf('0xf')]('/',auth[_0x30bf('0xa')](),interaction['tracked'](_0x30bf('0x10'),_0x30bf('0x11')),controller['create']);router[_0x30bf('0xf')]('/:id/status',controller[_0x30bf('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x30bf('0x13')]);router['put'](_0x30bf('0x14'),auth[_0x30bf('0xa')](),controller[_0x30bf('0x15')]);router['put'](_0x30bf('0x16'),auth[_0x30bf('0xa')](),controller['reject']);router[_0x30bf('0x17')](_0x30bf('0xe'),auth['isAuthenticated'](),controller[_0x30bf('0x18')]);module['exports']=router; \ No newline at end of file +var _0xbe1d=['isAuthenticated','index','/:id','show','tracked','sms','smsmessage:create','create','post','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x526cb8,_0x1d897c){var _0x3f140d=function(_0x5273d7){while(--_0x5273d7){_0x526cb8['push'](_0x526cb8['shift']());}};_0x3f140d(++_0x1d897c);}(_0xbe1d,0xd6));var _0xdbe1=function(_0x195270,_0x412abb){_0x195270=_0x195270-0x0;var _0x5398dd=_0xbe1d[_0x195270];return _0x5398dd;};'use strict';var multer=require(_0xdbe1('0x0'));var util=require(_0xdbe1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdbe1('0x2'));var router=express[_0xdbe1('0x3')]();var fs_extra=require(_0xdbe1('0x4'));var auth=require(_0xdbe1('0x5'));var interaction=require(_0xdbe1('0x6'));var config=require(_0xdbe1('0x7'));var controller=require(_0xdbe1('0x8'));router[_0xdbe1('0x9')]('/',auth[_0xdbe1('0xa')](),controller[_0xdbe1('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xdbe1('0x9')](_0xdbe1('0xc'),auth['isAuthenticated'](),controller[_0xdbe1('0xd')]);router['post']('/',auth[_0xdbe1('0xa')](),interaction[_0xdbe1('0xe')](_0xdbe1('0xf'),_0xdbe1('0x10')),controller[_0xdbe1('0x11')]);router[_0xdbe1('0x12')]('/:id/status',controller[_0xdbe1('0x13')]);router[_0xdbe1('0x14')](_0xdbe1('0xc'),auth[_0xdbe1('0xa')](),controller[_0xdbe1('0x15')]);router[_0xdbe1('0x14')](_0xdbe1('0x16'),auth[_0xdbe1('0xa')](),controller[_0xdbe1('0x17')]);router[_0xdbe1('0x14')](_0xdbe1('0x18'),auth[_0xdbe1('0xa')](),controller['reject']);router[_0xdbe1('0x19')](_0xdbe1('0xc'),auth[_0xdbe1('0xa')](),controller[_0xdbe1('0x1a')]);module[_0xdbe1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d83fc94..97965f6 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 _0x6085=['ENUM','out','STRING','BOOLEAN','exports','TEXT','medium'];(function(_0x57cf92,_0x2c6f80){var _0x20b0d3=function(_0x544076){while(--_0x544076){_0x57cf92['push'](_0x57cf92['shift']());}};_0x20b0d3(++_0x2c6f80);}(_0x6085,0xba));var _0x5608=function(_0x529f36,_0x537390){_0x529f36=_0x529f36-0x0;var _0x36e904=_0x6085[_0x529f36];return _0x36e904;};'use strict';var Sequelize=require('sequelize');module[_0x5608('0x0')]={'body':{'type':Sequelize[_0x5608('0x1')](_0x5608('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5608('0x3')]('in',_0x5608('0x4')),'defaultValue':_0x5608('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5608('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5608('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5608('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5608('0x5')]},'providerResponse':{'type':Sequelize[_0x5608('0x1')]}}; \ No newline at end of file +var _0x7a7a=['out','STRING','DATE','sequelize','exports','TEXT','medium','ENUM'];(function(_0x321e39,_0x2f99c8){var _0x2e5be2=function(_0x14fa6a){while(--_0x14fa6a){_0x321e39['push'](_0x321e39['shift']());}};_0x2e5be2(++_0x2f99c8);}(_0x7a7a,0x19b));var _0xa7a7=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x7a7a[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require(_0xa7a7('0x0'));module[_0xa7a7('0x1')]={'body':{'type':Sequelize[_0xa7a7('0x2')](_0xa7a7('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa7a7('0x4')]('in',_0xa7a7('0x5')),'defaultValue':_0xa7a7('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa7a7('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa7a7('0x6')]},'readAt':{'type':Sequelize[_0xa7a7('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa7a7('0x6')]},'providerResponse':{'type':Sequelize[_0xa7a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index fcd5d08..fb235e5 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 _0x5d12=['acceptMessage','startsWith','cf_','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','push','contact','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','infobip','results','DELIVERED','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','request','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','create','body','find','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage'];(function(_0x2052e5,_0x3d0371){var _0x1d02de=function(_0x2eb52d){while(--_0x2eb52d){_0x2052e5['push'](_0x2052e5['shift']());}};_0x1d02de(++_0x3d0371);}(_0x5d12,0x1d1));var _0x25d1=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x5d12[_0x599e60];return _0x468e19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x25d1('0x0'));var jsonpatch=require(_0x25d1('0x1'));var rp=require(_0x25d1('0x2'));var moment=require(_0x25d1('0x3'));var BPromise=require(_0x25d1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x25d1('0x5'));var sox=require('sox');var csv=require(_0x25d1('0x6'));var ejs=require(_0x25d1('0x7'));var fs=require('fs');var fs_extra=require(_0x25d1('0x8'));var _=require('lodash');var squel=require(_0x25d1('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x25d1('0x6'));var querystring=require(_0x25d1('0xa'));var Papa=require(_0x25d1('0xb'));var Redis=require(_0x25d1('0xc'));var authService=require(_0x25d1('0xd'));var qs=require(_0x25d1('0xe'));var as=require(_0x25d1('0xf'));var hardwareService=require(_0x25d1('0x10'));var logger=require(_0x25d1('0x11'))(_0x25d1('0x12'));var utils=require('../../config/utils');var config=require(_0x25d1('0x13'));var licenseUtil=require(_0x25d1('0x14'));var db=require(_0x25d1('0x15'))['db'];config[_0x25d1('0x16')]=_[_0x25d1('0x17')](config[_0x25d1('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25d1('0x16')]));require('./smsMessage.socket')[_0x25d1('0x18')](socket);var jayson=require(_0x25d1('0x19'));var client=jayson[_0x25d1('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x25d1('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f4b4b,_0x4132a6,_0x336186,_0x245fc8){return new BPromise(function(_0x58cc52,_0x504edb){var _0x2864b1=_0x245fc8||client;return _0x2864b1[_0x25d1('0x1b')](_0x3f4b4b,_0x336186)['then'](function(_0x36218c){logger[_0x25d1('0x1c')]('SmsMessage,\x20%s,\x20%s',_0x4132a6,'request\x20sent');logger[_0x25d1('0x1d')](_0x25d1('0x1e'),_0x4132a6,_0x25d1('0x1f'),JSON[_0x25d1('0x20')](_0x36218c));if(_0x36218c[_0x25d1('0x21')]){if(_0x36218c['error']['code']===0x1f4){logger[_0x25d1('0x21')](_0x25d1('0x22'),_0x4132a6,_0x36218c[_0x25d1('0x21')][_0x25d1('0x23')]);return _0x504edb(_0x36218c[_0x25d1('0x21')][_0x25d1('0x23')]);}logger[_0x25d1('0x21')](_0x25d1('0x22'),_0x4132a6,_0x36218c[_0x25d1('0x21')][_0x25d1('0x23')]);return _0x58cc52(_0x36218c[_0x25d1('0x21')][_0x25d1('0x23')]);}else{logger['info'](_0x25d1('0x22'),_0x4132a6,'request\x20sent');_0x58cc52(_0x36218c[_0x25d1('0x24')][_0x25d1('0x23')]);}})[_0x25d1('0x25')](function(_0xe39a58){logger['error'](_0x25d1('0x22'),_0x4132a6,_0xe39a58);_0x504edb(_0xe39a58);});});}function respondWithStatusCode(_0x2bed60,_0x312652){_0x312652=_0x312652||0xcc;return function(_0x16e7c4){if(_0x16e7c4){return _0x2bed60[_0x25d1('0x26')](_0x312652);}return _0x2bed60[_0x25d1('0x27')](_0x312652)['end']();};}function respondWithResult(_0x232ae1,_0x1332ba){_0x1332ba=_0x1332ba||0xc8;return function(_0x532868){if(_0x532868){return _0x232ae1[_0x25d1('0x27')](_0x1332ba)[_0x25d1('0x28')](_0x532868);}};}function respondWithFilteredResult(_0x4bb438,_0x4e2f09){return function(_0x1d61b2){if(_0x1d61b2){var _0x3a675e=typeof _0x4e2f09[_0x25d1('0x29')]===_0x25d1('0x2a')&&typeof _0x4e2f09[_0x25d1('0x2b')]===_0x25d1('0x2a');var _0x2c419f=_0x1d61b2[_0x25d1('0x2c')];var _0x127de8=_0x3a675e?0x0:_0x4e2f09[_0x25d1('0x29')];var _0x4a2d30=_0x3a675e?_0x1d61b2['count']:_0x4e2f09['offset']+_0x4e2f09[_0x25d1('0x2b')];var _0x2116be;if(_0x4a2d30>=_0x2c419f){_0x4a2d30=_0x2c419f;_0x2116be=0xc8;}else{_0x2116be=0xce;}_0x4bb438[_0x25d1('0x27')](_0x2116be);return _0x4bb438[_0x25d1('0x2d')](_0x25d1('0x2e'),_0x127de8+'-'+_0x4a2d30+'/'+_0x2c419f)[_0x25d1('0x28')](_0x1d61b2);}return null;};}function patchUpdates(_0x336979){return function(_0x3caf91){try{jsonpatch['apply'](_0x3caf91,_0x336979,!![]);}catch(_0x5e001b){return BPromise[_0x25d1('0x2f')](_0x5e001b);}return _0x3caf91[_0x25d1('0x30')]();};}function saveUpdates(_0x45b8e8,_0x3c9de0){return function(_0x577f02){if(_0x577f02){return _0x577f02[_0x25d1('0x31')](_0x45b8e8)[_0x25d1('0x32')](function(_0x2d8bed){return _0x2d8bed;});}return null;};}function removeEntity(_0x436b2d,_0x57e036){return function(_0x553296){if(_0x553296){return _0x553296[_0x25d1('0x33')]()[_0x25d1('0x32')](function(){_0x436b2d[_0x25d1('0x27')](0xcc)[_0x25d1('0x34')]();});}};}function handleEntityNotFound(_0x2f679d,_0x47d7bb){return function(_0x324995){if(!_0x324995){_0x2f679d[_0x25d1('0x26')](0x194);}return _0x324995;};}function handleError(_0xd2bce1,_0x17deec){_0x17deec=_0x17deec||0x1f4;return function(_0x4b9281){logger['error'](_0x4b9281[_0x25d1('0x35')]);if(_0x4b9281[_0x25d1('0x36')]){delete _0x4b9281[_0x25d1('0x36')];}_0xd2bce1[_0x25d1('0x27')](_0x17deec)[_0x25d1('0x37')](_0x4b9281);};}exports[_0x25d1('0x38')]=function(_0x364e07,_0x4b9ac4){var _0x43d527={},_0x5469d8={},_0xe74bfd={'count':0x0,'rows':[]};var _0x1f8bdf=_[_0x25d1('0x39')](db[_0x25d1('0x3a')][_0x25d1('0x3b')],function(_0x3add5f){return{'name':_0x3add5f['fieldName'],'type':_0x3add5f[_0x25d1('0x3c')]['key']};});_0x5469d8[_0x25d1('0x3d')]=_[_0x25d1('0x39')](_0x1f8bdf,_0x25d1('0x36'));_0x5469d8[_0x25d1('0x3e')]=_[_0x25d1('0x3f')](_0x364e07[_0x25d1('0x3e')]);_0x5469d8[_0x25d1('0x40')]=_['intersection'](_0x5469d8[_0x25d1('0x3d')],_0x5469d8[_0x25d1('0x3e')]);_0x43d527[_0x25d1('0x41')]=_['intersection'](_0x5469d8[_0x25d1('0x3d')],qs['fields'](_0x364e07[_0x25d1('0x3e')][_0x25d1('0x42')]));_0x43d527[_0x25d1('0x41')]=_0x43d527[_0x25d1('0x41')][_0x25d1('0x43')]?_0x43d527[_0x25d1('0x41')]:_0x5469d8[_0x25d1('0x3d')];if(!_0x364e07['query'][_0x25d1('0x44')]('nolimit')){_0x43d527[_0x25d1('0x2b')]=qs[_0x25d1('0x2b')](_0x364e07[_0x25d1('0x3e')][_0x25d1('0x2b')]);_0x43d527['offset']=qs[_0x25d1('0x29')](_0x364e07[_0x25d1('0x3e')][_0x25d1('0x29')]);}_0x43d527[_0x25d1('0x45')]=qs[_0x25d1('0x46')](_0x364e07['query'][_0x25d1('0x46')]);_0x43d527[_0x25d1('0x47')]=qs[_0x25d1('0x40')](_[_0x25d1('0x48')](_0x364e07[_0x25d1('0x3e')],_0x5469d8[_0x25d1('0x40')]),_0x1f8bdf);if(_0x364e07[_0x25d1('0x3e')][_0x25d1('0x49')]){_0x43d527['where']=_[_0x25d1('0x4a')](_0x43d527[_0x25d1('0x47')],{'$or':_[_0x25d1('0x39')](_0x1f8bdf,function(_0x204806){if(_0x204806[_0x25d1('0x3c')]!==_0x25d1('0x4b')){var _0x2e575c={};_0x2e575c[_0x204806[_0x25d1('0x36')]]={'$like':'%'+_0x364e07[_0x25d1('0x3e')][_0x25d1('0x49')]+'%'};return _0x2e575c;}})});}_0x43d527=_[_0x25d1('0x4a')]({},_0x43d527,_0x364e07[_0x25d1('0x4c')]);var _0x419b28={'where':_0x43d527[_0x25d1('0x47')]};return db[_0x25d1('0x3a')][_0x25d1('0x2c')](_0x419b28)[_0x25d1('0x32')](function(_0xcf9d10){_0xe74bfd[_0x25d1('0x2c')]=_0xcf9d10;if(_0x364e07[_0x25d1('0x3e')][_0x25d1('0x4d')]){_0x43d527[_0x25d1('0x4e')]=[{'all':!![]}];}return db['SmsMessage'][_0x25d1('0x4f')](_0x43d527);})[_0x25d1('0x32')](function(_0x3cb360){_0xe74bfd[_0x25d1('0x50')]=_0x3cb360;return _0xe74bfd;})[_0x25d1('0x32')](respondWithFilteredResult(_0x4b9ac4,_0x43d527))[_0x25d1('0x25')](handleError(_0x4b9ac4,null));};exports[_0x25d1('0x51')]=function(_0x2ba9d4,_0x1b90a5){var _0x3c0052={'raw':!![],'where':{'id':_0x2ba9d4[_0x25d1('0x52')]['id']}},_0x5eebde={};_0x5eebde[_0x25d1('0x3d')]=_[_0x25d1('0x3f')](db[_0x25d1('0x3a')]['rawAttributes']);_0x5eebde[_0x25d1('0x3e')]=_[_0x25d1('0x3f')](_0x2ba9d4[_0x25d1('0x3e')]);_0x5eebde[_0x25d1('0x40')]=_[_0x25d1('0x53')](_0x5eebde[_0x25d1('0x3d')],_0x5eebde[_0x25d1('0x3e')]);_0x3c0052['attributes']=_['intersection'](_0x5eebde['model'],qs[_0x25d1('0x42')](_0x2ba9d4[_0x25d1('0x3e')][_0x25d1('0x42')]));_0x3c0052[_0x25d1('0x41')]=_0x3c0052[_0x25d1('0x41')][_0x25d1('0x43')]?_0x3c0052[_0x25d1('0x41')]:_0x5eebde['model'];if(_0x2ba9d4[_0x25d1('0x3e')][_0x25d1('0x4d')]){_0x3c0052[_0x25d1('0x4e')]=[{'all':!![]}];}_0x3c0052=_[_0x25d1('0x4a')]({},_0x3c0052,_0x2ba9d4[_0x25d1('0x4c')]);return db[_0x25d1('0x3a')]['find'](_0x3c0052)['then'](handleEntityNotFound(_0x1b90a5,null))[_0x25d1('0x32')](respondWithResult(_0x1b90a5,null))['catch'](handleError(_0x1b90a5,null));};exports[_0x25d1('0x54')]=function(_0x4ee458,_0x3c66a7){return db[_0x25d1('0x3a')][_0x25d1('0x54')](_0x4ee458['body'],{})['then'](respondWithResult(_0x3c66a7,0xc9))[_0x25d1('0x25')](handleError(_0x3c66a7,null));};exports[_0x25d1('0x31')]=function(_0x509da3,_0x1a4c6f){if(_0x509da3[_0x25d1('0x55')]['id']){delete _0x509da3[_0x25d1('0x55')]['id'];}return db['SmsMessage'][_0x25d1('0x56')]({'where':{'id':_0x509da3[_0x25d1('0x52')]['id']}})[_0x25d1('0x32')](handleEntityNotFound(_0x1a4c6f,null))['then'](saveUpdates(_0x509da3[_0x25d1('0x55')],null))[_0x25d1('0x32')](respondWithResult(_0x1a4c6f,null))['catch'](handleError(_0x1a4c6f,null));};exports[_0x25d1('0x33')]=function(_0x3f422a,_0x4a590d){return db[_0x25d1('0x3a')][_0x25d1('0x56')]({'where':{'id':_0x3f422a['params']['id']}})[_0x25d1('0x32')](handleEntityNotFound(_0x4a590d,null))[_0x25d1('0x32')](removeEntity(_0x4a590d,null))[_0x25d1('0x25')](handleError(_0x4a590d,null));};exports[_0x25d1('0x57')]=function(_0x4f9a2d,_0x3adec4){return db[_0x25d1('0x3a')][_0x25d1('0x57')]()[_0x25d1('0x32')](respondWithResult(_0x3adec4,null))['catch'](handleError(_0x3adec4,null));};var interaction_log=require(_0x25d1('0x11'))('sms-interactions');exports[_0x25d1('0x58')]=function(_0x1f394a,_0x5cfe4b,_0x2019eb){var _0x7fa7e8={'agent':{},'channel':_0x25d1('0x59')};if(_0x1f394a['body']['id']){delete _0x1f394a['body']['id'];}_0x1f394a[_0x25d1('0x55')][_0x25d1('0x5a')]=!![];_0x1f394a[_0x25d1('0x55')][_0x25d1('0x5b')]=moment()[_0x25d1('0x5c')](_0x25d1('0x5d'));_0x1f394a[_0x25d1('0x55')][_0x25d1('0x5e')]=_0x1f394a[_0x25d1('0x55')][_0x25d1('0x5e')]||_0x1f394a['user']['id'];_0x7fa7e8[_0x25d1('0x5f')]['id']=_0x1f394a[_0x25d1('0x55')][_0x25d1('0x5e')];return db[_0x25d1('0x3a')]['find']({'where':{'id':_0x1f394a[_0x25d1('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x25d1('0x60')],'as':_0x25d1('0x61')}]})[_0x25d1('0x32')](handleEntityNotFound(_0x5cfe4b,null))[_0x25d1('0x32')](saveUpdates(_0x1f394a[_0x25d1('0x55')],null))[_0x25d1('0x32')](function(_0x49855d){if(_0x49855d){_0x7fa7e8['message']=_0x49855d['get']({'plain':!![]});return db['SmsInteraction'][_0x25d1('0x56')]({'where':{'id':_0x49855d['SmsInteractionId']}});}return null;})[_0x25d1('0x32')](handleEntityNotFound(_0x5cfe4b,null))['then'](function(_0x4ff3d4){if(_0x4ff3d4){return _0x4ff3d4[_0x25d1('0x31')]({'UserId':_0x1f394a['body'][_0x25d1('0x5e')],'read1stAt':_[_0x25d1('0x62')](_0x4ff3d4[_0x25d1('0x63')])?moment()[_0x25d1('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x25d1('0x32')](function(_0x20ce2a){if(_0x20ce2a){_0x7fa7e8['interaction']=_0x20ce2a[_0x25d1('0x64')]({'plain':!![]});interaction_log[_0x25d1('0x1c')](_0x25d1('0x65'),_0x1f394a['user']['id'],_0x1f394a['user'][_0x25d1('0x36')],_0x1f394a[_0x25d1('0x66')][_0x25d1('0x67')],_0x7fa7e8[_0x25d1('0x68')]['id'],_0x1f394a['body']?JSON['stringify'](_0x1f394a[_0x25d1('0x55')]):_0x25d1('0x69'));return respondWithRpcPromise(_0x25d1('0x6a'),_0x25d1('0x6b'),_0x7fa7e8);}return null;})['then'](function(_0x5c1b04){return db[_0x25d1('0x60')][_0x25d1('0x57')]()[_0x25d1('0x32')](function(_0x21a062){var _0x2fc664=[];for(var _0x467575=0x0;_0x467575=0x0){return _0x275326['update']({'read':!![]});}else{logger[_0x25d1('0x21')](_0x25d1('0x86'),_0x25d1('0x27'),'plivio',util[_0x25d1('0x82')](_0x2b6590[_0x25d1('0x55')],{'showHidden':![],'depth':null}));}break;case _0x25d1('0x8c'):var _0x28ad32=_0x2b6590['body'][_0x25d1('0x8d')][0x0];if(_0x28ad32[_0x25d1('0x27')]['groupName']===_0x25d1('0x8e')){return _0x275326[_0x25d1('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x25d1('0x27'),_0x25d1('0x8c'),util[_0x25d1('0x82')](_0x2b6590[_0x25d1('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x275326;}})['then'](respondWithResult(_0x1a3f58,null))[_0x25d1('0x25')](handleError(_0x1a3f58,null));}; \ No newline at end of file +var _0x99c3=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','then','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','SmsMessage','find','create','body','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','SmsInteraction','SmsInteractionId','update','interaction','AcceptMessage','acceptMessage','startsWith','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','ContactId','SELECT','contact','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x99c3,0x85));var _0x399c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x99c3[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x399c('0x0'));var rimraf=require(_0x399c('0x1'));var zipdir=require(_0x399c('0x2'));var jsonpatch=require(_0x399c('0x3'));var rp=require(_0x399c('0x4'));var moment=require(_0x399c('0x5'));var BPromise=require(_0x399c('0x6'));var Mustache=require(_0x399c('0x7'));var util=require('util');var path=require(_0x399c('0x8'));var sox=require(_0x399c('0x9'));var csv=require(_0x399c('0xa'));var ejs=require(_0x399c('0xb'));var fs=require('fs');var fs_extra=require(_0x399c('0xc'));var _=require(_0x399c('0xd'));var squel=require(_0x399c('0xe'));var crypto=require(_0x399c('0xf'));var jsforce=require(_0x399c('0x10'));var deskjs=require(_0x399c('0x11'));var toCsv=require(_0x399c('0xa'));var querystring=require(_0x399c('0x12'));var Papa=require(_0x399c('0x13'));var Redis=require(_0x399c('0x14'));var authService=require(_0x399c('0x15'));var qs=require(_0x399c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x399c('0x17'));var logger=require(_0x399c('0x18'))(_0x399c('0x19'));var utils=require(_0x399c('0x1a'));var config=require(_0x399c('0x1b'));var licenseUtil=require(_0x399c('0x1c'));var db=require(_0x399c('0x1d'))['db'];config[_0x399c('0x1e')]=_['defaults'](config[_0x399c('0x1e')],{'host':_0x399c('0x1f'),'port':0x18eb});var socket=require(_0x399c('0x20'))(new Redis(config[_0x399c('0x1e')]));require(_0x399c('0x21'))[_0x399c('0x22')](socket);var jayson=require(_0x399c('0x23'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bfb3f,_0x3ef805,_0x4d96d4,_0x58fa22){return new BPromise(function(_0x781e8e,_0x9eb68b){var _0x546fc0=_0x58fa22||client;return _0x546fc0['request'](_0x1bfb3f,_0x4d96d4)[_0x399c('0x24')](function(_0xb62de5){logger['info']('SmsMessage,\x20%s,\x20%s',_0x3ef805,'request\x20sent');logger[_0x399c('0x25')](_0x399c('0x26'),_0x3ef805,_0x399c('0x27'),JSON[_0x399c('0x28')](_0xb62de5));if(_0xb62de5[_0x399c('0x29')]){if(_0xb62de5[_0x399c('0x29')][_0x399c('0x2a')]===0x1f4){logger[_0x399c('0x29')](_0x399c('0x2b'),_0x3ef805,_0xb62de5[_0x399c('0x29')][_0x399c('0x2c')]);return _0x9eb68b(_0xb62de5[_0x399c('0x29')]['message']);}logger[_0x399c('0x29')]('SmsMessage,\x20%s,\x20%s',_0x3ef805,_0xb62de5['error'][_0x399c('0x2c')]);return _0x781e8e(_0xb62de5['error'][_0x399c('0x2c')]);}else{logger[_0x399c('0x2d')](_0x399c('0x2b'),_0x3ef805,'request\x20sent');_0x781e8e(_0xb62de5[_0x399c('0x2e')][_0x399c('0x2c')]);}})['catch'](function(_0x5f52e6){logger[_0x399c('0x29')](_0x399c('0x2b'),_0x3ef805,_0x5f52e6);_0x9eb68b(_0x5f52e6);});});}function respondWithStatusCode(_0xc75b90,_0x5b71ae){_0x5b71ae=_0x5b71ae||0xcc;return function(_0x4dadc1){if(_0x4dadc1){return _0xc75b90['sendStatus'](_0x5b71ae);}return _0xc75b90[_0x399c('0x2f')](_0x5b71ae)[_0x399c('0x30')]();};}function respondWithResult(_0x3332fb,_0x5797b4){_0x5797b4=_0x5797b4||0xc8;return function(_0x210f49){if(_0x210f49){return _0x3332fb[_0x399c('0x2f')](_0x5797b4)[_0x399c('0x31')](_0x210f49);}};}function respondWithFilteredResult(_0xd132aa,_0x42b14f){return function(_0x41e02a){if(_0x41e02a){var _0x3f79db=typeof _0x42b14f['offset']===_0x399c('0x32')&&typeof _0x42b14f[_0x399c('0x33')]===_0x399c('0x32');var _0x42a07a=_0x41e02a[_0x399c('0x34')];var _0x1158a2=_0x3f79db?0x0:_0x42b14f[_0x399c('0x35')];var _0x4167af=_0x3f79db?_0x41e02a[_0x399c('0x34')]:_0x42b14f[_0x399c('0x35')]+_0x42b14f[_0x399c('0x33')];var _0x544d96;if(_0x4167af>=_0x42a07a){_0x4167af=_0x42a07a;_0x544d96=0xc8;}else{_0x544d96=0xce;}_0xd132aa[_0x399c('0x2f')](_0x544d96);return _0xd132aa[_0x399c('0x36')](_0x399c('0x37'),_0x1158a2+'-'+_0x4167af+'/'+_0x42a07a)[_0x399c('0x31')](_0x41e02a);}return null;};}function patchUpdates(_0x575685){return function(_0x5d06ef){try{jsonpatch[_0x399c('0x38')](_0x5d06ef,_0x575685,!![]);}catch(_0x34092b){return BPromise[_0x399c('0x39')](_0x34092b);}return _0x5d06ef[_0x399c('0x3a')]();};}function saveUpdates(_0x4900c2,_0x2a3c29){return function(_0x339133){if(_0x339133){return _0x339133['update'](_0x4900c2)[_0x399c('0x24')](function(_0x20f302){return _0x20f302;});}return null;};}function removeEntity(_0x3270e9,_0x31f07b){return function(_0x13cb5d){if(_0x13cb5d){return _0x13cb5d[_0x399c('0x3b')]()[_0x399c('0x24')](function(){_0x3270e9[_0x399c('0x2f')](0xcc)[_0x399c('0x30')]();});}};}function handleEntityNotFound(_0x40efde,_0x71489d){return function(_0x4e28e5){if(!_0x4e28e5){_0x40efde['sendStatus'](0x194);}return _0x4e28e5;};}function handleError(_0x182cdc,_0x5272e1){_0x5272e1=_0x5272e1||0x1f4;return function(_0xd7bf19){logger[_0x399c('0x29')](_0xd7bf19[_0x399c('0x3c')]);if(_0xd7bf19['name']){delete _0xd7bf19[_0x399c('0x3d')];}_0x182cdc['status'](_0x5272e1)[_0x399c('0x3e')](_0xd7bf19);};}exports[_0x399c('0x3f')]=function(_0x33ee79,_0x1a70f7){var _0x3692a6={},_0x440f44={},_0x28264f={'count':0x0,'rows':[]};var _0x1f8c1d=_[_0x399c('0x40')](db['SmsMessage'][_0x399c('0x41')],function(_0x8b08a9){return{'name':_0x8b08a9[_0x399c('0x42')],'type':_0x8b08a9[_0x399c('0x43')]['key']};});_0x440f44['model']=_[_0x399c('0x40')](_0x1f8c1d,_0x399c('0x3d'));_0x440f44[_0x399c('0x44')]=_[_0x399c('0x45')](_0x33ee79[_0x399c('0x44')]);_0x440f44[_0x399c('0x46')]=_[_0x399c('0x47')](_0x440f44[_0x399c('0x48')],_0x440f44[_0x399c('0x44')]);_0x3692a6['attributes']=_[_0x399c('0x47')](_0x440f44['model'],qs['fields'](_0x33ee79[_0x399c('0x44')][_0x399c('0x49')]));_0x3692a6[_0x399c('0x4a')]=_0x3692a6[_0x399c('0x4a')][_0x399c('0x4b')]?_0x3692a6[_0x399c('0x4a')]:_0x440f44[_0x399c('0x48')];if(!_0x33ee79[_0x399c('0x44')]['hasOwnProperty'](_0x399c('0x4c'))){_0x3692a6[_0x399c('0x33')]=qs[_0x399c('0x33')](_0x33ee79[_0x399c('0x44')]['limit']);_0x3692a6[_0x399c('0x35')]=qs[_0x399c('0x35')](_0x33ee79[_0x399c('0x44')][_0x399c('0x35')]);}_0x3692a6[_0x399c('0x4d')]=qs[_0x399c('0x4e')](_0x33ee79[_0x399c('0x44')]['sort']);_0x3692a6[_0x399c('0x4f')]=qs[_0x399c('0x46')](_[_0x399c('0x50')](_0x33ee79[_0x399c('0x44')],_0x440f44['filters']),_0x1f8c1d);if(_0x33ee79['query'][_0x399c('0x51')]){_0x3692a6['where']=_['merge'](_0x3692a6[_0x399c('0x4f')],{'$or':_['map'](_0x1f8c1d,function(_0x437052){if(_0x437052[_0x399c('0x43')]!==_0x399c('0x52')){var _0x2e157c={};_0x2e157c[_0x437052['name']]={'$like':'%'+_0x33ee79[_0x399c('0x44')][_0x399c('0x51')]+'%'};return _0x2e157c;}})});}_0x3692a6=_[_0x399c('0x53')]({},_0x3692a6,_0x33ee79[_0x399c('0x54')]);var _0x18953b={'where':_0x3692a6[_0x399c('0x4f')]};return db['SmsMessage'][_0x399c('0x34')](_0x18953b)[_0x399c('0x24')](function(_0x3a836a){_0x28264f['count']=_0x3a836a;if(_0x33ee79[_0x399c('0x44')][_0x399c('0x55')]){_0x3692a6[_0x399c('0x56')]=[{'all':!![]}];}return db['SmsMessage'][_0x399c('0x57')](_0x3692a6);})[_0x399c('0x24')](function(_0x28300f){_0x28264f['rows']=_0x28300f;return _0x28264f;})[_0x399c('0x24')](respondWithFilteredResult(_0x1a70f7,_0x3692a6))[_0x399c('0x58')](handleError(_0x1a70f7,null));};exports[_0x399c('0x59')]=function(_0xf2fafb,_0x24d8a6){var _0x1d7cb9={'raw':!![],'where':{'id':_0xf2fafb[_0x399c('0x5a')]['id']}},_0x4d93bc={};_0x4d93bc[_0x399c('0x48')]=_['keys'](db['SmsMessage'][_0x399c('0x41')]);_0x4d93bc[_0x399c('0x44')]=_['keys'](_0xf2fafb['query']);_0x4d93bc['filters']=_['intersection'](_0x4d93bc[_0x399c('0x48')],_0x4d93bc[_0x399c('0x44')]);_0x1d7cb9[_0x399c('0x4a')]=_['intersection'](_0x4d93bc[_0x399c('0x48')],qs[_0x399c('0x49')](_0xf2fafb[_0x399c('0x44')]['fields']));_0x1d7cb9['attributes']=_0x1d7cb9[_0x399c('0x4a')][_0x399c('0x4b')]?_0x1d7cb9[_0x399c('0x4a')]:_0x4d93bc[_0x399c('0x48')];if(_0xf2fafb[_0x399c('0x44')][_0x399c('0x55')]){_0x1d7cb9[_0x399c('0x56')]=[{'all':!![]}];}_0x1d7cb9=_['merge']({},_0x1d7cb9,_0xf2fafb[_0x399c('0x54')]);return db[_0x399c('0x5b')][_0x399c('0x5c')](_0x1d7cb9)[_0x399c('0x24')](handleEntityNotFound(_0x24d8a6,null))['then'](respondWithResult(_0x24d8a6,null))['catch'](handleError(_0x24d8a6,null));};exports[_0x399c('0x5d')]=function(_0x433330,_0xe136a0){return db[_0x399c('0x5b')][_0x399c('0x5d')](_0x433330[_0x399c('0x5e')],{})[_0x399c('0x24')](respondWithResult(_0xe136a0,0xc9))['catch'](handleError(_0xe136a0,null));};exports['update']=function(_0x51984f,_0x5564b8){if(_0x51984f[_0x399c('0x5e')]['id']){delete _0x51984f[_0x399c('0x5e')]['id'];}return db[_0x399c('0x5b')]['find']({'where':{'id':_0x51984f[_0x399c('0x5a')]['id']}})[_0x399c('0x24')](handleEntityNotFound(_0x5564b8,null))[_0x399c('0x24')](saveUpdates(_0x51984f[_0x399c('0x5e')],null))[_0x399c('0x24')](respondWithResult(_0x5564b8,null))[_0x399c('0x58')](handleError(_0x5564b8,null));};exports[_0x399c('0x3b')]=function(_0x6d8232,_0xdf1c1d){return db['SmsMessage'][_0x399c('0x5c')]({'where':{'id':_0x6d8232[_0x399c('0x5a')]['id']}})[_0x399c('0x24')](handleEntityNotFound(_0xdf1c1d,null))[_0x399c('0x24')](removeEntity(_0xdf1c1d,null))[_0x399c('0x58')](handleError(_0xdf1c1d,null));};exports[_0x399c('0x5f')]=function(_0x3852c3,_0x4be0eb){return db[_0x399c('0x5b')][_0x399c('0x5f')]()[_0x399c('0x24')](respondWithResult(_0x4be0eb,null))[_0x399c('0x58')](handleError(_0x4be0eb,null));};var interaction_log=require(_0x399c('0x18'))(_0x399c('0x60'));exports[_0x399c('0x61')]=function(_0x481fc3,_0x2eed59,_0x4d525c){var _0x11d628={'agent':{},'channel':'sms'};if(_0x481fc3[_0x399c('0x5e')]['id']){delete _0x481fc3[_0x399c('0x5e')]['id'];}_0x481fc3[_0x399c('0x5e')][_0x399c('0x62')]=!![];_0x481fc3[_0x399c('0x5e')][_0x399c('0x63')]=moment()[_0x399c('0x64')](_0x399c('0x65'));_0x481fc3[_0x399c('0x5e')][_0x399c('0x66')]=_0x481fc3[_0x399c('0x5e')]['UserId']||_0x481fc3[_0x399c('0x67')]['id'];_0x11d628[_0x399c('0x68')]['id']=_0x481fc3[_0x399c('0x5e')]['UserId'];return db[_0x399c('0x5b')][_0x399c('0x5c')]({'where':{'id':_0x481fc3[_0x399c('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x399c('0x69')],'as':_0x399c('0x6a')}]})['then'](handleEntityNotFound(_0x2eed59,null))['then'](saveUpdates(_0x481fc3['body'],null))['then'](function(_0x27e616){if(_0x27e616){_0x11d628[_0x399c('0x2c')]=_0x27e616[_0x399c('0x6b')]({'plain':!![]});return db[_0x399c('0x6c')][_0x399c('0x5c')]({'where':{'id':_0x27e616[_0x399c('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x2eed59,null))['then'](function(_0x2bbb90){if(_0x2bbb90){return _0x2bbb90[_0x399c('0x6e')]({'UserId':_0x481fc3['body']['UserId'],'read1stAt':_['isNil'](_0x2bbb90['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x399c('0x24')](function(_0x255fda){if(_0x255fda){_0x11d628[_0x399c('0x6f')]=_0x255fda[_0x399c('0x6b')]({'plain':!![]});interaction_log[_0x399c('0x2d')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x481fc3['user']['id'],_0x481fc3['user'][_0x399c('0x3d')],_0x481fc3[_0x399c('0x67')]['role'],_0x11d628['interaction']['id'],_0x481fc3[_0x399c('0x5e')]?JSON[_0x399c('0x28')](_0x481fc3[_0x399c('0x5e')]):'null');return respondWithRpcPromise(_0x399c('0x70'),_0x399c('0x71'),_0x11d628);}return null;})[_0x399c('0x24')](function(_0x402304){return db['CmContact'][_0x399c('0x5f')]()[_0x399c('0x24')](function(_0x2b8bca){var _0x2c5d70=[];for(var _0x46a808=0x0;_0x46a808=0x0){return _0x63a542[_0x399c('0x6e')]({'read':!![]});}else{logger[_0x399c('0x29')](_0x399c('0x95'),_0x399c('0x2f'),'plivio',util[_0x399c('0x8c')](_0x350789['body'],{'showHidden':![],'depth':null}));}break;case _0x399c('0x96'):var _0x278869=_0x350789[_0x399c('0x5e')][_0x399c('0x97')][0x0];if(_0x278869['status']['groupName']===_0x399c('0x98')){return _0x63a542['update']({'read':!![]});}else{logger[_0x399c('0x29')](_0x399c('0x95'),'status',_0x399c('0x96'),util[_0x399c('0x8c')](_0x350789['body'],{'showHidden':![],'depth':null}));}break;}return _0x63a542;}})['then'](respondWithResult(_0x1538f9,null))[_0x399c('0x58')](handleError(_0x1538f9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 84ac99f..75b986e 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 _0x287f=['save','update','remove','emit','hook','exports','../../mysqldb','SmsMessage'];(function(_0x593cad,_0x2770de){var _0x348b4e=function(_0x5664cd){while(--_0x5664cd){_0x593cad['push'](_0x593cad['shift']());}};_0x348b4e(++_0x2770de);}(_0x287f,0x1d6));var _0xf287=function(_0x7977a1,_0xebeea8){_0x7977a1=_0x7977a1-0x0;var _0x3588e3=_0x287f[_0x7977a1];return _0x3588e3;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xf287('0x0'))['db'][_0xf287('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf287('0x2'),'afterUpdate':_0xf287('0x3'),'afterDestroy':_0xf287('0x4')};function emitEvent(_0x4a84ee){return function(_0x45e35b,_0x1efd61,_0xab8178){SmsMessageEvents[_0xf287('0x5')](_0x4a84ee+':'+_0x45e35b['id'],_0x45e35b);SmsMessageEvents[_0xf287('0x5')](_0x4a84ee,_0x45e35b);_0xab8178(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xf287('0x6')](e,emitEvent(event));}}module[_0xf287('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x3c93=['setMaxListeners','update','emit','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c93,0x16d));var _0x33c9=function(_0x102408,_0x28826d){_0x102408=_0x102408-0x0;var _0x18f426=_0x3c93[_0x102408];return _0x18f426;};'use strict';var EventEmitter=require(_0x33c9('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x33c9('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x33c9('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2eff0e){return function(_0x2d61e4,_0x2f7dd7,_0x368854){SmsMessageEvents['emit'](_0x2eff0e+':'+_0x2d61e4['id'],_0x2d61e4);SmsMessageEvents[_0x33c9('0x3')](_0x2eff0e,_0x2d61e4);_0x368854(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x33c9('0x4')](e,emitEvent(event));}}module[_0x33c9('0x5')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 74af695..cf22807 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 _0x3489=['deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','clickSend','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','sort','length','createHash','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','/messages','applicationId','intelepeer','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','out','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id'];(function(_0xeea930,_0x5433c9){var _0x3eab89=function(_0x1a8fc6){while(--_0x1a8fc6){_0xeea930['push'](_0xeea930['shift']());}};_0x3eab89(++_0x5433c9);}(_0x3489,0x1ac));var _0x9348=function(_0x488a47,_0x21d367){_0x488a47=_0x488a47-0x0;var _0x120fe0=_0x3489[_0x488a47];return _0x120fe0;};'use strict';var _=require('lodash');var util=require(_0x9348('0x0'));var logger=require('../../config/logger')(_0x9348('0x1'));var moment=require('moment');var BPromise=require(_0x9348('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9348('0x3'));var rimraf=require(_0x9348('0x4'));var config=require(_0x9348('0x5'));var attributes=require(_0x9348('0x6'));module['exports']=function(_0x2a1e5b,_0x13d914){return _0x2a1e5b['define']('SmsMessage',attributes,{'tableName':_0x9348('0x7'),'paranoid':![],'indexes':[{'name':_0x9348('0x8'),'fields':[_0x9348('0x8')]},{'name':_0x9348('0x9'),'fields':[_0x9348('0xa')],'type':_0x9348('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x416542,_0x187f86,_0x478912){var _0x44eba7=_0x2a1e5b[_0x9348('0xc')];var _0x24e4f6=_0x416542[_0x9348('0xd')]({'plain':!![]});if(_0x24e4f6[_0x9348('0xe')][_0x9348('0xf')]()==='in'||_0x24e4f6[_0x9348('0xe')]['toLowerCase']()==='out'&&!_0x24e4f6[_0x9348('0x10')]&&!_[_0x9348('0x11')](_0x24e4f6[_0x9348('0x12')])){_0x44eba7[_0x9348('0x13')][_0x9348('0x14')]({'where':{'id':_0x24e4f6[_0x9348('0x15')]}})['then'](function(_0x414ce3){if(_0x414ce3){_0x414ce3[_0x9348('0x16')]({'lastMsgAt':_0x24e4f6['createdAt'],'lastMsgDirection':_0x24e4f6[_0x9348('0xe')]['toLowerCase']()});}})['catch'](function(_0x9ea209){console['error'](_0x9ea209);});}if(_0x24e4f6[_0x9348('0xe')]===_0x9348('0x17')&&!_0x24e4f6['secret']){var _0x3b4c48;_0x44eba7[_0x9348('0x18')][_0x9348('0x19')]({'where':{'id':_0x24e4f6[_0x9348('0x1a')]},'raw':!![]})[_0x9348('0x1b')](function(_0x5df2b1){_0x3b4c48=_0x5df2b1;if(_0x3b4c48&&_0x3b4c48[_0x9348('0x1c')]){switch(_0x3b4c48[_0x9348('0x1c')]){case'twilio':var _0x348ee4=require(_0x9348('0x1d'));if(_0x3b4c48[_0x9348('0x1e')]&&_0x3b4c48[_0x9348('0x1f')]&&_0x3b4c48['phone']){var _0x1ac977=new _0x348ee4(_0x3b4c48[_0x9348('0x1e')],_0x3b4c48[_0x9348('0x1f')]);_0x1ac977[_0x9348('0x20')][_0x9348('0x21')]({'body':_0x24e4f6[_0x9348('0xa')],'to':_0x24e4f6[_0x9348('0x22')],'from':_0x3b4c48[_0x9348('0x22')],'statusCallback':_0x3b4c48[_0x9348('0x23')]+_0x9348('0x24')+_0x24e4f6['id']+_0x9348('0x25')+_0x3b4c48[_0x9348('0x26')]})['then'](function(_0x6c4a18){if(_0x6c4a18[_0x9348('0x27')]){return _0x416542[_0x9348('0x16')]({'messageId':_0x6c4a18[_0x9348('0x27')]});}})[_0x9348('0x28')](function(_0x3d77e4){logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x1d'),util[_0x9348('0x2c')](_0x3d77e4,{'showHidden':![],'depth':null}));});}else{logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),'twilio',_0x9348('0x2d'));}break;case'skebby':var _0x53ed55=_0x9348('0x2e');if(_0x3b4c48[_0x9348('0x2f')]&&_0x3b4c48[_0x9348('0x30')]){var _0x4ac2fc={'recipient':[_0x24e4f6['phone']],'message':_0x24e4f6[_0x9348('0xa')],'message_type':_0x3b4c48['smsMethod']};if(_0x3b4c48[_0x9348('0x31')]&&_0x3b4c48[_0x9348('0x31')]!=='SI'){_0x4ac2fc[_0x9348('0x32')]=_0x3b4c48['phone'];}var _0x29a8da={'url':_0x53ed55+_0x9348('0x33')+_0x3b4c48[_0x9348('0x2f')]+'&password='+_0x3b4c48[_0x9348('0x30')],'method':_0x9348('0x34')};rp(_0x29a8da)[_0x9348('0x1b')](function(_0x300e88){var _0x5da137=_0x300e88[_0x9348('0x35')](';');var _0x4bca73={'user_key':_0x5da137[0x0],'session_key':_0x5da137[0x1]};_0x29a8da={'url':_0x53ed55+_0x9348('0x36'),'method':_0x9348('0x37'),'headers':{'user_key':_0x4bca73[_0x9348('0x38')],'Session_key':_0x4bca73[_0x9348('0x39')]},'json':!![],'body':_0x4ac2fc};return rp(_0x29a8da);})['then'](function(_0x1c3825){if(_0x1c3825[_0x9348('0x3a')]>=0x1){var _0x877237={'messageId':_0x1c3825[_0x9348('0x3b')]};if(_0x3b4c48[_0x9348('0x31')]!=='GP'||!_0x3b4c48[_0x9348('0x3c')]){_0x877237[_0x9348('0x3d')]=!![];}return _0x416542[_0x9348('0x16')](_0x877237);}else{return logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x3e'),util[_0x9348('0x2c')](_0x1c3825,{'showHidden':![],'depth':null}));}})[_0x9348('0x28')](function(_0x34bb5a){return logger[_0x9348('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9348('0x2b'),_0x9348('0x3e'),util[_0x9348('0x2c')](_0x34bb5a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9348('0x2a'),_0x9348('0x2b'),'skebby',_0x9348('0x3f'));}break;case _0x9348('0x40'):if(_0x3b4c48[_0x9348('0x1f')]){var _0x182bf2={'recipient':_0x24e4f6['phone'],'message':_0x24e4f6[_0x9348('0xa')],'sender':_0x3b4c48[_0x9348('0x41')]||_0x3b4c48[_0x9348('0x22')],'authorization':_0x3b4c48[_0x9348('0x1f')]};var _0x187f86={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x182bf2,'json':!![]};rp(_0x187f86)[_0x9348('0x1b')](function(_0x46a7c9){var _0x5deef9={'messageId':_0x46a7c9[_0x9348('0x42')]};if(!_0x3b4c48[_0x9348('0x3c')]){_0x5deef9[_0x9348('0x3d')]=!![];}return _0x416542[_0x9348('0x16')](_0x5deef9);})[_0x9348('0x28')](function(_0x250eeb){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9348('0x40'),util[_0x9348('0x2c')](_0x250eeb,{'showHidden':![],'depth':null}));});}else{logger[_0x9348('0x29')](_0x9348('0x2a'),'afterCreate',_0x9348('0x40'),_0x9348('0x43'));}break;case _0x9348('0x44'):if(_0x3b4c48[_0x9348('0x2f')]&&_0x3b4c48[_0x9348('0x30')]){var _0x182bf2={'messages':[{'source':_0x9348('0x45'),'to':_0x24e4f6[_0x9348('0x22')],'body':_0x24e4f6['body'],'from':_0x3b4c48[_0x9348('0x41')]||_0x3b4c48[_0x9348('0x22')]}]};var _0x3295fc=util[_0x9348('0x46')]('%s:%s',_0x3b4c48[_0x9348('0x2f')],_0x3b4c48['password']);var _0x187f86={'method':_0x9348('0x37'),'uri':_0x9348('0x47'),'body':_0x182bf2,'headers':{'Authorization':util['format'](_0x9348('0x48'),new Buffer(_0x3295fc)[_0x9348('0x49')](_0x9348('0x4a')))},'json':!![]};rp(_0x187f86)[_0x9348('0x1b')](function(_0x1523c5){if(_0x1523c5[_0x9348('0x4b')]>=0xc8&&_0x1523c5[_0x9348('0x4b')]<=0xce){if(_0x1523c5['data']&&_0x1523c5['data']['queued_count']>0x0){var _0xe2ccda=_['head'](_0x1523c5[_0x9348('0x4c')][_0x9348('0x20')]);var _0x18a5ed={'messageId':_0xe2ccda['message_id']};if(!_0x3b4c48['deliveryReport']){_0x18a5ed[_0x9348('0x3d')]=!![];}return _0x416542['update'](_0x18a5ed);}else{logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),'clickSend',util[_0x9348('0x2c')](_0x1523c5,{'showHidden':![],'depth':null}));}}else{logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x4d'),util[_0x9348('0x2c')](_0x1523c5,{'showHidden':![],'depth':null}));}})[_0x9348('0x28')](function(_0x439d9f){logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),'clickSend',util['inspect'](_0x439d9f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x4d'),_0x9348('0x3f'));}break;case'plivo':if(_0x3b4c48[_0x9348('0x4e')]&&_0x3b4c48['authToken']){var _0x182bf2={'dst':_0x24e4f6[_0x9348('0x22')],'text':_0x24e4f6[_0x9348('0xa')],'src':_0x3b4c48[_0x9348('0x41')]||_0x3b4c48[_0x9348('0x22')],'url':_0x3b4c48['remote']+_0x9348('0x24')+_0x24e4f6['id']+_0x9348('0x25')+_0x3b4c48[_0x9348('0x26')]};var _0x3295fc=util['format'](_0x9348('0x4f'),_0x3b4c48[_0x9348('0x4e')],_0x3b4c48['authToken']);var _0x187f86={'method':_0x9348('0x37'),'uri':util[_0x9348('0x46')](_0x9348('0x50'),_0x3b4c48[_0x9348('0x4e')]),'body':_0x182bf2,'headers':{'Authorization':util['format'](_0x9348('0x48'),new Buffer(_0x3295fc)['toString'](_0x9348('0x4a')))},'json':!![]};rp(_0x187f86)[_0x9348('0x1b')](function(_0xa8f9fc){var _0x1651b4={'messageId':_0xa8f9fc[_0x9348('0x51')][0x0]};return _0x416542[_0x9348('0x16')](_0x1651b4);})['catch'](function(_0x556222){logger['error'](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x52'),util['inspect'](_0x556222,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x9348('0x53'):if(_0x3b4c48['username']&&_0x3b4c48[_0x9348('0x30')]){if(_0x3b4c48[_0x9348('0x54')]){var _0x3edd74={'method':'POST','uri':_0x3b4c48[_0x9348('0x54')]+_0x9348('0x55'),'body':{'username':_0x3b4c48['username'],'password':_0x3b4c48[_0x9348('0x30')]},'json':!![]};return rp(_0x3edd74)[_0x9348('0x1b')](function(_0x2962c0){var _0x663d79={'method':_0x9348('0x37'),'uri':_0x3b4c48[_0x9348('0x54')]+_0x9348('0x56'),'body':{'messages':[{'from':_0x3b4c48[_0x9348('0x22')],'destinations':[{'to':_0x24e4f6[_0x9348('0x22')]}],'text':_0x24e4f6[_0x9348('0xa')],'notifyUrl':_0x3b4c48[_0x9348('0x23')]+_0x9348('0x24')+_0x24e4f6['id']+_0x9348('0x25')+_0x3b4c48[_0x9348('0x26')],'notifyContentType':_0x9348('0x57'),'callbackData':_0x3b4c48['phone']+';'+_0x24e4f6['body']}]},'headers':{'Authorization':_0x9348('0x58')+_0x2962c0[_0x9348('0x26')]},'json':!![]};return rp(_0x663d79)[_0x9348('0x1b')](function(_0x2976f4){if(_0x2976f4[_0x9348('0x20')]){var _0x14ba2b={'messageId':_0x2976f4[_0x9348('0x20')][0x0]['messageId']};if(!_0x3b4c48[_0x9348('0x3c')]){_0x14ba2b['read']=!![];}return _0x416542['update'](_0x14ba2b);}else{return logger[_0x9348('0x29')](_0x9348('0x2a'),'afterCreate',_0x9348('0x53'),util[_0x9348('0x2c')](_0x2976f4,{'showHidden':![],'depth':null}));}});})[_0x9348('0x28')](function(_0x44ab46){return logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),'infobip',util[_0x9348('0x2c')](_0x44ab46,{'showHidden':![],'depth':null}));});}else{logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x53'),_0x9348('0x59'));}}else{logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x53'),_0x9348('0x3f'));}break;case _0x9348('0x5a'):var _0x24a5fa=require(_0x9348('0x5b'));if(_0x3b4c48[_0x9348('0x5c')]){var _0x27168e={};_0x27168e[_0x9348('0x5d')]=_0x3b4c48[_0x9348('0x2f')];_0x27168e['phone']=_0x24e4f6[_0x9348('0x22')];_0x27168e['sender']=_0x3b4c48[_0x9348('0x22')];_0x27168e['text']=_0x24e4f6['body'];_0x27168e[_0x9348('0x5e')]=+new Date();var _0x52fd68='';var _0x47965c='';var _0x59847c=Object['keys'](_0x27168e);_0x59847c[_0x9348('0x5f')]();for(var _0x467b21=0x0;_0x467b21<_0x59847c[_0x9348('0x60')];_0x467b21++){if(_0x52fd68!=''){_0x52fd68+='&';}_0x52fd68+=_0x59847c[_0x467b21]+'='+encodeURIComponent(_0x27168e[_0x59847c[_0x467b21]]);_0x47965c+=_0x27168e[_0x59847c[_0x467b21]];}_0x47965c+=_0x3b4c48[_0x9348('0x5c')];_0x47965c=_0x24a5fa[_0x9348('0x61')]('md5')[_0x9348('0x16')](_0x47965c)['digest'](_0x9348('0x62'));if(_0x52fd68!==''){_0x52fd68+='&';}_0x52fd68+=_0x9348('0x63')+_0x47965c;var _0x29a8da={'method':_0x9348('0x34'),'uri':_0x3b4c48[_0x9348('0x54')]+_0x9348('0x64')+_0x52fd68,'json':!![]};return rp(_0x29a8da)[_0x9348('0x1b')](function(_0x516adf){var _0x13a735=Object[_0x9348('0x65')](_0x516adf);if(_0x516adf[_0x13a735[0x0]]['error']&&parseInt(_0x516adf[_0x13a735[0x0]][_0x9348('0x29')])===0x0){var _0x69a92e={'messageId':_0x516adf[_0x13a735[0x0]][_0x9348('0x66')]};if(!_0x3b4c48[_0x9348('0x3c')]){_0x69a92e['read']=!![];}return _0x416542[_0x9348('0x16')](_0x69a92e);}else{return logger[_0x9348('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9348('0x2b'),_0x9348('0x5a'),util[_0x9348('0x2c')](_0x516adf['error'],{'showHidden':![],'depth':null}));}})[_0x9348('0x28')](function(_0x18a674){return logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x5a'),util['inspect'](_0x18a674,{'showHidden':![],'depth':null}));});}else{logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x5a'),_0x9348('0x67'));}break;case _0x9348('0x68'):if(_0x3b4c48[_0x9348('0x5c')]){var _0x2171e1={'method':_0x9348('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3b4c48[_0x9348('0x5c')]},'body':{'content':_0x24e4f6[_0x9348('0xa')],'to':[_0x24e4f6[_0x9348('0x22')]],'from':_0x3b4c48[_0x9348('0x22')],'binary':![],'clientMessageId':_0x9348('0x69'),'charset':_0x9348('0x6a')},'json':!![]};rp(_0x2171e1)[_0x9348('0x1b')](function(_0x22c581){if(!_0x22c581[_0x9348('0x29')]){var _0xcaea87={'messageId':_0x22c581['messages'][0x0][_0x9348('0x6b')]};if(!_0x3b4c48[_0x9348('0x3c')]){_0xcaea87[_0x9348('0x3d')]=!![];}return _0x416542[_0x9348('0x16')](_0xcaea87);}else{return logger[_0x9348('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9348('0x2b'),_0x9348('0x68'),util['inspect'](_0x22c581['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x34d91b){return logger[_0x9348('0x29')](_0x9348('0x2a'),'afterCreate',_0x9348('0x68'),util['inspect'](_0x34d91b,{'showHidden':![],'depth':null}));});}else{logger[_0x9348('0x29')](_0x9348('0x2a'),'afterCreate',_0x9348('0x68'),_0x9348('0x67'));}break;case _0x9348('0x6c'):if(_0x3b4c48[_0x9348('0x2f')]&&_0x3b4c48['password']){var _0x3295fc=util[_0x9348('0x46')](_0x9348('0x4f'),_0x3b4c48[_0x9348('0x2f')],_0x3b4c48[_0x9348('0x30')]);var _0x187f86={'method':_0x9348('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3b4c48['accountId']+_0x9348('0x6d'),'body':{'to':[_0x24e4f6[_0x9348('0x22')]],'text':_0x24e4f6[_0x9348('0xa')],'from':_0x3b4c48['phone'],'applicationId':_0x3b4c48[_0x9348('0x6e')]},'headers':{'Authorization':util['format'](_0x9348('0x48'),new Buffer(_0x3295fc)[_0x9348('0x49')]('base64'))},'json':!![]};rp(_0x187f86)[_0x9348('0x1b')](function(_0x4a5dc0){if(_0x4a5dc0['id']){var _0x339e34={'messageId':_0x4a5dc0['id']};return _0x416542[_0x9348('0x16')](_0x339e34);}else{logger['error'](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x6c'),util['inspect'](_0x4a5dc0,{'showHidden':![],'depth':null}));}})[_0x9348('0x28')](function(_0x3c5905){logger['error'](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x6c'),util['inspect'](_0x3c5905,{'showHidden':![],'depth':null}));});}else{logger[_0x9348('0x29')](_0x9348('0x2a'),'afterCreate',_0x9348('0x6c'),_0x9348('0x3f'));}break;case _0x9348('0x6f'):if(_0x3b4c48[_0x9348('0x5c')]){var _0x533d7e={};var _0x29a8da={'method':_0x9348('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x3b4c48[_0x9348('0x5c')],'Content-Type':_0x9348('0x57')},'body':{'from':_0x3b4c48[_0x9348('0x22')],'to':_0x24e4f6[_0x9348('0x22')],'text':_0x24e4f6[_0x9348('0xa')]},'json':!![]};return rp(_0x29a8da)[_0x9348('0x1b')](function(_0x1c05e3){if(_0x1c05e3[_0x9348('0x70')]==0xca){_0x533d7e['message']=_0x1c05e3;var _0x33cc2c={'method':_0x9348('0x37'),'uri':_0x9348('0x71'),'headers':{'Authorization':_0x9348('0x72')+_0x3b4c48[_0x9348('0x5c')],'Content-Type':_0x9348('0x57')},'body':{'refid':_0x533d7e[_0x9348('0x73')][_0x9348('0x74')]},'json':!![]};return rp(_0x33cc2c)[_0x9348('0x1b')](function(_0x56559e){_0x533d7e[_0x9348('0x75')]=_0x56559e;var _0x9d1567={'messageId':_0x533d7e['message'][_0x9348('0x74')],'read':!![]};return _0x416542['update'](_0x9d1567);});}else{return logger['error'](_0x9348('0x2a'),'afterCreate',_0x9348('0x6f'),util[_0x9348('0x2c')](_0x1c05e3,{'showHidden':![],'depth':null}));}})[_0x9348('0x28')](function(_0x55e7fd){return logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x6f'),util['inspect'](_0x55e7fd,{'showHidden':![],'depth':null}));});}else{return logger[_0x9348('0x29')](_0x9348('0x2a'),_0x9348('0x2b'),_0x9348('0x6f'),_0x9348('0x76'));}break;}}})[_0x9348('0x77')](function(){_0x478912();});}else{_0x478912();}}},'charset':_0x9348('0x78'),'collate':_0x9348('0x79')});}; \ No newline at end of file +var _0x31f0=['api','moment','bluebird','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','then','update','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','phone','authToken','messages','body','/api/sms/messages/','/status?token=','token','sid','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','clickSend','plivo','remote','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','baseUrl','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','crypto','apiKey','login','text','timestamp','keys','sort','length','md5','hex','signature=','GET','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','finally','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x31f0,0x1da));var _0x031f=function(_0x239e99,_0x58e59a){_0x239e99=_0x239e99-0x0;var _0x288bbd=_0x31f0[_0x239e99];return _0x288bbd;};'use strict';var _=require(_0x031f('0x0'));var util=require(_0x031f('0x1'));var logger=require('../../config/logger')(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require(_0x031f('0x6'));var config=require('../../config/environment');var attributes=require(_0x031f('0x7'));module[_0x031f('0x8')]=function(_0x2f6744,_0x22a4eb){return _0x2f6744[_0x031f('0x9')](_0x031f('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x031f('0xb'),'fields':['messageId']},{'name':_0x031f('0xc'),'fields':['body'],'type':_0x031f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47c590,_0x46c748,_0x50ea0e){var _0x607ae7=_0x2f6744[_0x031f('0xe')];var _0x4b761b=_0x47c590['get']({'plain':!![]});if(_0x4b761b[_0x031f('0xf')][_0x031f('0x10')]()==='in'||_0x4b761b['direction'][_0x031f('0x10')]()==='out'&&!_0x4b761b[_0x031f('0x11')]&&!_[_0x031f('0x12')](_0x4b761b[_0x031f('0x13')])){_0x607ae7['SmsInteraction']['findOne']({'where':{'id':_0x4b761b['SmsInteractionId']}})[_0x031f('0x14')](function(_0x3b5aab){if(_0x3b5aab){_0x3b5aab[_0x031f('0x15')]({'lastMsgAt':_0x4b761b[_0x031f('0x16')],'lastMsgDirection':_0x4b761b[_0x031f('0xf')][_0x031f('0x10')]()});}})[_0x031f('0x17')](function(_0xe26e8c){console[_0x031f('0x18')](_0xe26e8c);});}if(_0x4b761b[_0x031f('0xf')]==='out'&&!_0x4b761b[_0x031f('0x11')]){var _0x3c9ae5;_0x607ae7[_0x031f('0x19')][_0x031f('0x1a')]({'where':{'id':_0x4b761b['SmsAccountId']},'raw':!![]})[_0x031f('0x14')](function(_0x29e4d6){_0x3c9ae5=_0x29e4d6;if(_0x3c9ae5&&_0x3c9ae5[_0x031f('0x1b')]){switch(_0x3c9ae5[_0x031f('0x1b')]){case _0x031f('0x1c'):var _0x4f243f=require(_0x031f('0x1c'));if(_0x3c9ae5[_0x031f('0x1d')]&&_0x3c9ae5['authToken']&&_0x3c9ae5[_0x031f('0x1e')]){var _0x4b5e39=new _0x4f243f(_0x3c9ae5[_0x031f('0x1d')],_0x3c9ae5[_0x031f('0x1f')]);_0x4b5e39[_0x031f('0x20')]['create']({'body':_0x4b761b[_0x031f('0x21')],'to':_0x4b761b['phone'],'from':_0x3c9ae5['phone'],'statusCallback':_0x3c9ae5['remote']+_0x031f('0x22')+_0x4b761b['id']+_0x031f('0x23')+_0x3c9ae5[_0x031f('0x24')]})[_0x031f('0x14')](function(_0x30f5c3){if(_0x30f5c3[_0x031f('0x25')]){return _0x47c590[_0x031f('0x15')]({'messageId':_0x30f5c3[_0x031f('0x25')]});}})[_0x031f('0x17')](function(_0x147163){logger[_0x031f('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x031f('0x26'),_0x031f('0x1c'),util['inspect'](_0x147163,{'showHidden':![],'depth':null}));});}else{logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),'twilio',_0x031f('0x28'));}break;case _0x031f('0x29'):var _0x2dcfa1=_0x031f('0x2a');if(_0x3c9ae5[_0x031f('0x2b')]&&_0x3c9ae5[_0x031f('0x2c')]){var _0xe3f79e={'recipient':[_0x4b761b[_0x031f('0x1e')]],'message':_0x4b761b['body'],'message_type':_0x3c9ae5[_0x031f('0x2d')]};if(_0x3c9ae5[_0x031f('0x2d')]&&_0x3c9ae5[_0x031f('0x2d')]!=='SI'){_0xe3f79e['sender']=_0x3c9ae5[_0x031f('0x1e')];}var _0x5c0e69={'url':_0x2dcfa1+_0x031f('0x2e')+_0x3c9ae5['username']+_0x031f('0x2f')+_0x3c9ae5[_0x031f('0x2c')],'method':'GET'};rp(_0x5c0e69)[_0x031f('0x14')](function(_0x237fa6){var _0x58a4cb=_0x237fa6[_0x031f('0x30')](';');var _0xbb5606={'user_key':_0x58a4cb[0x0],'session_key':_0x58a4cb[0x1]};_0x5c0e69={'url':_0x2dcfa1+_0x031f('0x31'),'method':_0x031f('0x32'),'headers':{'user_key':_0xbb5606['user_key'],'Session_key':_0xbb5606[_0x031f('0x33')]},'json':!![],'body':_0xe3f79e};return rp(_0x5c0e69);})[_0x031f('0x14')](function(_0x298735){if(_0x298735[_0x031f('0x34')]>=0x1){var _0x5f573e={'messageId':_0x298735[_0x031f('0x35')]};if(_0x3c9ae5['smsMethod']!=='GP'||!_0x3c9ae5[_0x031f('0x36')]){_0x5f573e[_0x031f('0x37')]=!![];}return _0x47c590['update'](_0x5f573e);}else{return logger['error'](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x29'),util[_0x031f('0x38')](_0x298735,{'showHidden':![],'depth':null}));}})[_0x031f('0x17')](function(_0x5ac8d8){return logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),'skebby',util[_0x031f('0x38')](_0x5ac8d8,{'showHidden':![],'depth':null}));});}else{logger[_0x031f('0x18')](_0x031f('0x27'),'afterCreate',_0x031f('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x031f('0x39'):if(_0x3c9ae5[_0x031f('0x1f')]){var _0x367692={'recipient':_0x4b761b['phone'],'message':_0x4b761b[_0x031f('0x21')],'sender':_0x3c9ae5[_0x031f('0x3a')]||_0x3c9ae5[_0x031f('0x1e')],'authorization':_0x3c9ae5['authToken']};var _0x46c748={'method':'POST','uri':_0x031f('0x3b'),'body':_0x367692,'json':!![]};rp(_0x46c748)[_0x031f('0x14')](function(_0x271339){var _0x1ddd50={'messageId':_0x271339[_0x031f('0x3c')]};if(!_0x3c9ae5[_0x031f('0x36')]){_0x1ddd50[_0x031f('0x37')]=!![];}return _0x47c590[_0x031f('0x15')](_0x1ddd50);})[_0x031f('0x17')](function(_0x4680b4){logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x39'),util[_0x031f('0x38')](_0x4680b4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x031f('0x27'),_0x031f('0x26'),'connectel',_0x031f('0x3d'));}break;case'clicksend':if(_0x3c9ae5['username']&&_0x3c9ae5['password']){var _0x367692={'messages':[{'source':_0x031f('0x3e'),'to':_0x4b761b[_0x031f('0x1e')],'body':_0x4b761b['body'],'from':_0x3c9ae5[_0x031f('0x3a')]||_0x3c9ae5[_0x031f('0x1e')]}]};var _0x207234=util[_0x031f('0x3f')]('%s:%s',_0x3c9ae5[_0x031f('0x2b')],_0x3c9ae5[_0x031f('0x2c')]);var _0x46c748={'method':_0x031f('0x32'),'uri':_0x031f('0x40'),'body':_0x367692,'headers':{'Authorization':util[_0x031f('0x3f')](_0x031f('0x41'),new Buffer(_0x207234)[_0x031f('0x42')]('base64'))},'json':!![]};rp(_0x46c748)[_0x031f('0x14')](function(_0x29c650){if(_0x29c650[_0x031f('0x43')]>=0xc8&&_0x29c650[_0x031f('0x43')]<=0xce){if(_0x29c650[_0x031f('0x44')]&&_0x29c650[_0x031f('0x44')]['queued_count']>0x0){var _0x3f3c02=_[_0x031f('0x45')](_0x29c650[_0x031f('0x44')]['messages']);var _0x3002a4={'messageId':_0x3f3c02['message_id']};if(!_0x3c9ae5['deliveryReport']){_0x3002a4['read']=!![];}return _0x47c590[_0x031f('0x15')](_0x3002a4);}else{logger['error'](_0x031f('0x27'),'afterCreate',_0x031f('0x46'),util[_0x031f('0x38')](_0x29c650,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x46'),util[_0x031f('0x38')](_0x29c650,{'showHidden':![],'depth':null}));}})[_0x031f('0x17')](function(_0x94ed3){logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x46'),util[_0x031f('0x38')](_0x94ed3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x46'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x031f('0x47'):if(_0x3c9ae5['authId']&&_0x3c9ae5[_0x031f('0x1f')]){var _0x367692={'dst':_0x4b761b[_0x031f('0x1e')],'text':_0x4b761b[_0x031f('0x21')],'src':_0x3c9ae5[_0x031f('0x3a')]||_0x3c9ae5['phone'],'url':_0x3c9ae5[_0x031f('0x48')]+'/api/sms/messages/'+_0x4b761b['id']+_0x031f('0x23')+_0x3c9ae5[_0x031f('0x24')]};var _0x207234=util['format'](_0x031f('0x49'),_0x3c9ae5[_0x031f('0x4a')],_0x3c9ae5[_0x031f('0x1f')]);var _0x46c748={'method':_0x031f('0x32'),'uri':util['format'](_0x031f('0x4b'),_0x3c9ae5[_0x031f('0x4a')]),'body':_0x367692,'headers':{'Authorization':util[_0x031f('0x3f')]('Basic\x20%s',new Buffer(_0x207234)[_0x031f('0x42')](_0x031f('0x4c')))},'json':!![]};rp(_0x46c748)[_0x031f('0x14')](function(_0x467121){var _0x151841={'messageId':_0x467121[_0x031f('0x4d')][0x0]};return _0x47c590[_0x031f('0x15')](_0x151841);})[_0x031f('0x17')](function(_0x29ae95){logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x47'),util['inspect'](_0x29ae95,{'showHidden':![],'depth':null}));});}else{logger[_0x031f('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x031f('0x47'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x3c9ae5[_0x031f('0x2b')]&&_0x3c9ae5[_0x031f('0x2c')]){if(_0x3c9ae5[_0x031f('0x4e')]){var _0x4c80d6={'method':'POST','uri':_0x3c9ae5[_0x031f('0x4e')]+'/auth/1/session','body':{'username':_0x3c9ae5[_0x031f('0x2b')],'password':_0x3c9ae5['password']},'json':!![]};return rp(_0x4c80d6)[_0x031f('0x14')](function(_0x208a7a){var _0x1af3ad={'method':_0x031f('0x32'),'uri':_0x3c9ae5['baseUrl']+_0x031f('0x4f'),'body':{'messages':[{'from':_0x3c9ae5['phone'],'destinations':[{'to':_0x4b761b[_0x031f('0x1e')]}],'text':_0x4b761b['body'],'notifyUrl':_0x3c9ae5[_0x031f('0x48')]+_0x031f('0x22')+_0x4b761b['id']+_0x031f('0x23')+_0x3c9ae5[_0x031f('0x24')],'notifyContentType':'application/json','callbackData':_0x3c9ae5['phone']+';'+_0x4b761b[_0x031f('0x21')]}]},'headers':{'Authorization':_0x031f('0x50')+_0x208a7a[_0x031f('0x24')]},'json':!![]};return rp(_0x1af3ad)[_0x031f('0x14')](function(_0x2bb036){if(_0x2bb036['messages']){var _0x16a32a={'messageId':_0x2bb036[_0x031f('0x20')][0x0][_0x031f('0xb')]};if(!_0x3c9ae5[_0x031f('0x36')]){_0x16a32a[_0x031f('0x37')]=!![];}return _0x47c590[_0x031f('0x15')](_0x16a32a);}else{return logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x51'),util['inspect'](_0x2bb036,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x575f1e){return logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),'infobip',util[_0x031f('0x38')](_0x575f1e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x51'),_0x031f('0x52'));}}else{logger[_0x031f('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0x031f('0x53'));}break;case'csc':var _0x3f7c82=require(_0x031f('0x54'));if(_0x3c9ae5[_0x031f('0x55')]){var _0x2d077a={};_0x2d077a[_0x031f('0x56')]=_0x3c9ae5[_0x031f('0x2b')];_0x2d077a[_0x031f('0x1e')]=_0x4b761b['phone'];_0x2d077a['sender']=_0x3c9ae5['phone'];_0x2d077a[_0x031f('0x57')]=_0x4b761b[_0x031f('0x21')];_0x2d077a[_0x031f('0x58')]=+new Date();var _0x1fbda7='';var _0x3e1d60='';var _0x8796a=Object[_0x031f('0x59')](_0x2d077a);_0x8796a[_0x031f('0x5a')]();for(var _0x3c8ca2=0x0;_0x3c8ca2<_0x8796a[_0x031f('0x5b')];_0x3c8ca2++){if(_0x1fbda7!=''){_0x1fbda7+='&';}_0x1fbda7+=_0x8796a[_0x3c8ca2]+'='+encodeURIComponent(_0x2d077a[_0x8796a[_0x3c8ca2]]);_0x3e1d60+=_0x2d077a[_0x8796a[_0x3c8ca2]];}_0x3e1d60+=_0x3c9ae5[_0x031f('0x55')];_0x3e1d60=_0x3f7c82['createHash'](_0x031f('0x5c'))[_0x031f('0x15')](_0x3e1d60)['digest'](_0x031f('0x5d'));if(_0x1fbda7!==''){_0x1fbda7+='&';}_0x1fbda7+=_0x031f('0x5e')+_0x3e1d60;var _0x5c0e69={'method':_0x031f('0x5f'),'uri':_0x3c9ae5[_0x031f('0x4e')]+_0x031f('0x60')+_0x1fbda7,'json':!![]};return rp(_0x5c0e69)[_0x031f('0x14')](function(_0x4481c9){var _0x5aa8ef=Object[_0x031f('0x59')](_0x4481c9);if(_0x4481c9[_0x5aa8ef[0x0]][_0x031f('0x18')]&&parseInt(_0x4481c9[_0x5aa8ef[0x0]][_0x031f('0x18')])===0x0){var _0x2ad432={'messageId':_0x4481c9[_0x5aa8ef[0x0]][_0x031f('0x61')]};if(!_0x3c9ae5[_0x031f('0x36')]){_0x2ad432[_0x031f('0x37')]=!![];}return _0x47c590['update'](_0x2ad432);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x031f('0x26'),_0x031f('0x62'),util[_0x031f('0x38')](_0x4481c9[_0x031f('0x18')],{'showHidden':![],'depth':null}));}})[_0x031f('0x17')](function(_0x40aee8){return logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x62'),util[_0x031f('0x38')](_0x40aee8,{'showHidden':![],'depth':null}));});}else{logger[_0x031f('0x18')](_0x031f('0x27'),'afterCreate',_0x031f('0x62'),_0x031f('0x63'));}break;case _0x031f('0x64'):if(_0x3c9ae5[_0x031f('0x55')]){var _0x42df34={'method':_0x031f('0x32'),'uri':_0x031f('0x65'),'headers':{'Authorization':_0x3c9ae5[_0x031f('0x55')]},'body':{'content':_0x4b761b[_0x031f('0x21')],'to':[_0x4b761b['phone']],'from':_0x3c9ae5[_0x031f('0x1e')],'binary':![],'clientMessageId':_0x031f('0x66'),'charset':_0x031f('0x67')},'json':!![]};rp(_0x42df34)['then'](function(_0x6e6f20){if(!_0x6e6f20[_0x031f('0x18')]){var _0x550c49={'messageId':_0x6e6f20[_0x031f('0x20')][0x0][_0x031f('0x68')]};if(!_0x3c9ae5[_0x031f('0x36')]){_0x550c49['read']=!![];}return _0x47c590['update'](_0x550c49);}else{return logger[_0x031f('0x18')](_0x031f('0x27'),'afterCreate',_0x031f('0x64'),util[_0x031f('0x38')](_0x6e6f20[_0x031f('0x18')],{'showHidden':![],'depth':null}));}})[_0x031f('0x17')](function(_0x2423cd){return logger[_0x031f('0x18')](_0x031f('0x27'),'afterCreate',_0x031f('0x64'),util['inspect'](_0x2423cd,{'showHidden':![],'depth':null}));});}else{logger[_0x031f('0x18')](_0x031f('0x27'),'afterCreate',_0x031f('0x64'),'Missing\x20parameters:\x20apiKey');}break;case _0x031f('0x69'):if(_0x3c9ae5[_0x031f('0x2b')]&&_0x3c9ae5[_0x031f('0x2c')]){var _0x207234=util['format']('%s:%s',_0x3c9ae5[_0x031f('0x2b')],_0x3c9ae5[_0x031f('0x2c')]);var _0x46c748={'method':_0x031f('0x32'),'uri':_0x031f('0x6a')+_0x3c9ae5['accountId']+_0x031f('0x6b'),'body':{'to':[_0x4b761b[_0x031f('0x1e')]],'text':_0x4b761b[_0x031f('0x21')],'from':_0x3c9ae5[_0x031f('0x1e')],'applicationId':_0x3c9ae5[_0x031f('0x6c')]},'headers':{'Authorization':util[_0x031f('0x3f')](_0x031f('0x41'),new Buffer(_0x207234)[_0x031f('0x42')]('base64'))},'json':!![]};rp(_0x46c748)['then'](function(_0x1c50df){if(_0x1c50df['id']){var _0x4060ad={'messageId':_0x1c50df['id']};return _0x47c590[_0x031f('0x15')](_0x4060ad);}else{logger[_0x031f('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x031f('0x26'),_0x031f('0x69'),util['inspect'](_0x1c50df,{'showHidden':![],'depth':null}));}})['catch'](function(_0x20f4dc){logger[_0x031f('0x18')](_0x031f('0x27'),'afterCreate',_0x031f('0x69'),util[_0x031f('0x38')](_0x20f4dc,{'showHidden':![],'depth':null}));});}else{logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x69'),_0x031f('0x53'));}break;case _0x031f('0x6d'):if(_0x3c9ae5['apiKey']){var _0x540c50={};var _0x5c0e69={'method':_0x031f('0x32'),'uri':_0x031f('0x6e'),'headers':{'Authorization':'Bearer\x20'+_0x3c9ae5[_0x031f('0x55')],'Content-Type':'application/json'},'body':{'from':_0x3c9ae5[_0x031f('0x1e')],'to':_0x4b761b[_0x031f('0x1e')],'text':_0x4b761b[_0x031f('0x21')]},'json':!![]};return rp(_0x5c0e69)[_0x031f('0x14')](function(_0x475362){if(_0x475362[_0x031f('0x6f')]==0xca){_0x540c50[_0x031f('0x70')]=_0x475362;var _0xe5bc21={'method':_0x031f('0x32'),'uri':_0x031f('0x71'),'headers':{'Authorization':_0x031f('0x72')+_0x3c9ae5['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x540c50[_0x031f('0x70')][_0x031f('0x73')]},'json':!![]};return rp(_0xe5bc21)['then'](function(_0x110287){_0x540c50[_0x031f('0x74')]=_0x110287;var _0x444a1b={'messageId':_0x540c50['message'][_0x031f('0x73')],'read':!![]};return _0x47c590[_0x031f('0x15')](_0x444a1b);});}else{return logger[_0x031f('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x031f('0x26'),_0x031f('0x6d'),util[_0x031f('0x38')](_0x475362,{'showHidden':![],'depth':null}));}})['catch'](function(_0x42c78e){return logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x6d'),util[_0x031f('0x38')](_0x42c78e,{'showHidden':![],'depth':null}));});}else{return logger[_0x031f('0x18')](_0x031f('0x27'),_0x031f('0x26'),_0x031f('0x6d'),_0x031f('0x75'));}break;}}})[_0x031f('0x76')](function(){_0x50ea0e();});}else{_0x50ea0e();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 14b711d..058e4e0 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 _0x18b4=['stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','util','moment','randomstring','ioredis','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x449a4a,_0x34fcf8){var _0x49dca3=function(_0x261d82){while(--_0x261d82){_0x449a4a['push'](_0x449a4a['shift']());}};_0x49dca3(++_0x34fcf8);}(_0x18b4,0x12c));var _0x418b=function(_0x1d0b4c,_0x2ef766){_0x1d0b4c=_0x1d0b4c-0x0;var _0x57a6f4=_0x18b4[_0x1d0b4c];return _0x57a6f4;};'use strict';var _=require('lodash');var util=require(_0x418b('0x0'));var moment=require(_0x418b('0x1'));var BPromise=require('bluebird');var rs=require(_0x418b('0x2'));var fs=require('fs');var Redis=require(_0x418b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x418b('0x4'));var config=require(_0x418b('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x418b('0x6')]({'port':0x232a});config[_0x418b('0x7')]=_[_0x418b('0x8')](config[_0x418b('0x7')],{'host':_0x418b('0x9'),'port':0x18eb});var socket=require(_0x418b('0xa'))(new Redis(config[_0x418b('0x7')]));require(_0x418b('0xb'))[_0x418b('0xc')](socket);function respondWithRpcPromise(_0x2f9df7,_0x56cc03,_0x29a1e2){return new BPromise(function(_0x1ec678,_0x424886){return client['request'](_0x2f9df7,_0x29a1e2)[_0x418b('0xd')](function(_0x5ba1ab){logger[_0x418b('0xe')](_0x418b('0xf'),_0x56cc03,_0x418b('0x10'));logger[_0x418b('0x11')](_0x418b('0x12'),_0x56cc03,_0x418b('0x10'),JSON[_0x418b('0x13')](_0x5ba1ab));if(_0x5ba1ab[_0x418b('0x14')]){if(_0x5ba1ab['error'][_0x418b('0x15')]===0x1f4){logger['error'](_0x418b('0xf'),_0x56cc03,_0x5ba1ab[_0x418b('0x14')]['message']);return _0x424886(_0x5ba1ab[_0x418b('0x14')][_0x418b('0x16')]);}logger[_0x418b('0x14')](_0x418b('0xf'),_0x56cc03,_0x5ba1ab[_0x418b('0x14')][_0x418b('0x16')]);return _0x1ec678(_0x5ba1ab['error'][_0x418b('0x16')]);}else{logger[_0x418b('0xe')](_0x418b('0xf'),_0x56cc03,_0x418b('0x10'));_0x1ec678(_0x5ba1ab['result']['message']);}})[_0x418b('0x17')](function(_0x436dba){logger[_0x418b('0x14')](_0x418b('0xf'),_0x56cc03,_0x436dba);_0x424886(_0x436dba);});});}exports[_0x418b('0x18')]=function(_0x56db48){var _0x326c95=this;return new Promise(function(_0x3b1f25,_0x21fe81){return db[_0x418b('0x19')][_0x418b('0x1a')](_0x56db48[_0x418b('0x1b')],{'raw':_0x56db48['options']?_0x56db48[_0x418b('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x418b('0xd')](function(_0x24b5e6){logger[_0x418b('0xe')](_0x418b('0x18'),_0x56db48);logger[_0x418b('0x11')]('CreateSmsMessage',_0x56db48,JSON[_0x418b('0x13')](_0x24b5e6));_0x3b1f25(_0x24b5e6);})[_0x418b('0x17')](function(_0x115c9f){logger[_0x418b('0x14')](_0x418b('0x18'),_0x115c9f[_0x418b('0x16')],_0x56db48);_0x21fe81(_0x326c95[_0x418b('0x14')](0x1f4,_0x115c9f[_0x418b('0x16')]));});});}; \ No newline at end of file +var _0x01b9=['then','CreateSmsMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','SmsMessage','body','options','raw'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x01b9,0xb1));var _0x901b=function(_0x176bc7,_0x3514d9){_0x176bc7=_0x176bc7-0x0;var _0xa0f1f5=_0x01b9[_0x176bc7];return _0xa0f1f5;};'use strict';var _=require(_0x901b('0x0'));var util=require(_0x901b('0x1'));var moment=require(_0x901b('0x2'));var BPromise=require('bluebird');var rs=require(_0x901b('0x3'));var fs=require('fs');var Redis=require(_0x901b('0x4'));var db=require(_0x901b('0x5'))['db'];var utils=require(_0x901b('0x6'));var logger=require(_0x901b('0x7'))(_0x901b('0x8'));var config=require(_0x901b('0x9'));var jayson=require(_0x901b('0xa'));var client=jayson[_0x901b('0xb')]['http']({'port':0x232a});config[_0x901b('0xc')]=_[_0x901b('0xd')](config['redis'],{'host':_0x901b('0xe'),'port':0x18eb});var socket=require(_0x901b('0xf'))(new Redis(config[_0x901b('0xc')]));require(_0x901b('0x10'))[_0x901b('0x11')](socket);function respondWithRpcPromise(_0x265fa6,_0x4c06e8,_0x1b326f){return new BPromise(function(_0x5ce81a,_0x12805c){return client[_0x901b('0x12')](_0x265fa6,_0x1b326f)['then'](function(_0xd091b2){logger[_0x901b('0x13')](_0x901b('0x14'),_0x4c06e8,_0x901b('0x15'));logger[_0x901b('0x16')](_0x901b('0x17'),_0x4c06e8,_0x901b('0x15'),JSON[_0x901b('0x18')](_0xd091b2));if(_0xd091b2['error']){if(_0xd091b2['error'][_0x901b('0x19')]===0x1f4){logger[_0x901b('0x1a')](_0x901b('0x14'),_0x4c06e8,_0xd091b2[_0x901b('0x1a')][_0x901b('0x1b')]);return _0x12805c(_0xd091b2['error'][_0x901b('0x1b')]);}logger['error'](_0x901b('0x14'),_0x4c06e8,_0xd091b2[_0x901b('0x1a')][_0x901b('0x1b')]);return _0x5ce81a(_0xd091b2[_0x901b('0x1a')]['message']);}else{logger['info'](_0x901b('0x14'),_0x4c06e8,'request\x20sent');_0x5ce81a(_0xd091b2['result'][_0x901b('0x1b')]);}})[_0x901b('0x1c')](function(_0x3c0568){logger[_0x901b('0x1a')](_0x901b('0x14'),_0x4c06e8,_0x3c0568);_0x12805c(_0x3c0568);});});}exports['CreateSmsMessage']=function(_0x145881){var _0x1016be=this;return new Promise(function(_0x276fd4,_0x1d08e7){return db[_0x901b('0x1d')]['create'](_0x145881[_0x901b('0x1e')],{'raw':_0x145881[_0x901b('0x1f')]?_0x145881[_0x901b('0x1f')][_0x901b('0x20')]===undefined?!![]:![]:!![]})[_0x901b('0x21')](function(_0x54a9f8){logger[_0x901b('0x13')](_0x901b('0x22'),_0x145881);logger['debug']('CreateSmsMessage',_0x145881,JSON[_0x901b('0x18')](_0x54a9f8));_0x276fd4(_0x54a9f8);})[_0x901b('0x1c')](function(_0x290fda){logger[_0x901b('0x1a')]('CreateSmsMessage',_0x290fda[_0x901b('0x1b')],_0x145881);_0x1d08e7(_0x1016be['error'](0x1f4,_0x290fda[_0x901b('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e3b9d2d..deae15c 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 _0x62ac=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x4eeca3,_0x12a5de){var _0x23a397=function(_0x1cf25d){while(--_0x1cf25d){_0x4eeca3['push'](_0x4eeca3['shift']());}};_0x23a397(++_0x12a5de);}(_0x62ac,0x1c8));var _0xc62a=function(_0x3df186,_0x12592c){_0x3df186=_0x3df186-0x0;var _0x5440fc=_0x62ac[_0x3df186];return _0x5440fc;};'use strict';var SmsMessageEvents=require(_0xc62a('0x0'));var events=[_0xc62a('0x1'),_0xc62a('0x2'),_0xc62a('0x3')];function createListener(_0x531d52,_0xec325d){return function(_0x19dd58){_0xec325d[_0xc62a('0x4')](_0x531d52,_0x19dd58);};}function removeListener(_0xddf32d,_0x69070){return function(){SmsMessageEvents[_0xc62a('0x5')](_0xddf32d,_0x69070);};}exports[_0xc62a('0x6')]=function(_0x299b23){for(var _0x1ddb87=0x0,_0x1518a5=events[_0xc62a('0x7')];_0x1ddb87<_0x1518a5;_0x1ddb87++){var _0x215bd7=events[_0x1ddb87];var _0x5ca070=createListener(_0xc62a('0x8')+_0x215bd7,_0x299b23);SmsMessageEvents['on'](_0x215bd7,_0x5ca070);}}; \ No newline at end of file +var _0x8761=['smsMessage:','./smsMessage.events','save','remove','emit','length'];(function(_0x543921,_0x2cea50){var _0x4bbc38=function(_0x1da19e){while(--_0x1da19e){_0x543921['push'](_0x543921['shift']());}};_0x4bbc38(++_0x2cea50);}(_0x8761,0x181));var _0x1876=function(_0x26c03a,_0x37af67){_0x26c03a=_0x26c03a-0x0;var _0x1743b8=_0x8761[_0x26c03a];return _0x1743b8;};'use strict';var SmsMessageEvents=require(_0x1876('0x0'));var events=[_0x1876('0x1'),_0x1876('0x2'),'update'];function createListener(_0x4f1fb0,_0xce8d95){return function(_0x2f78b3){_0xce8d95[_0x1876('0x3')](_0x4f1fb0,_0x2f78b3);};}function removeListener(_0x3ad125,_0x5ddfaf){return function(){SmsMessageEvents['removeListener'](_0x3ad125,_0x5ddfaf);};}exports['register']=function(_0x5cf85c){for(var _0x5c12bb=0x0,_0x219d3a=events[_0x1876('0x4')];_0x5c12bb<_0x219d3a;_0x5c12bb++){var _0x379e4f=events[_0x5c12bb];var _0x1ae165=createListener(_0x1876('0x5')+_0x379e4f,_0x5cf85c);SmsMessageEvents['on'](_0x379e4f,_0x1ae165);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0790443..6269dcf 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 _0x141c=['/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers'];(function(_0x3299c7,_0x493783){var _0x32e0e8=function(_0xcc75df){while(--_0xcc75df){_0x3299c7['push'](_0x3299c7['shift']());}};_0x32e0e8(++_0x493783);}(_0x141c,0x143));var _0xc141=function(_0x40175a,_0x531800){_0x40175a=_0x40175a-0x0;var _0x3dd77d=_0x141c[_0x40175a];return _0x3dd77d;};'use strict';var multer=require(_0xc141('0x0'));var util=require(_0xc141('0x1'));var path=require(_0xc141('0x2'));var timeout=require('connect-timeout');var express=require(_0xc141('0x3'));var router=express[_0xc141('0x4')]();var fs_extra=require(_0xc141('0x5'));var auth=require(_0xc141('0x6'));var interaction=require(_0xc141('0x7'));var config=require(_0xc141('0x8'));var controller=require(_0xc141('0x9'));router[_0xc141('0xa')]('/',auth[_0xc141('0xb')](),controller[_0xc141('0xc')]);router[_0xc141('0xa')](_0xc141('0xd'),auth['isAuthenticated'](),controller[_0xc141('0xe')]);router[_0xc141('0xa')]('/:id',auth[_0xc141('0xb')](),controller[_0xc141('0xf')]);router[_0xc141('0xa')](_0xc141('0x10'),auth[_0xc141('0xb')](),controller[_0xc141('0x11')]);router['get'](_0xc141('0x12'),auth['isAuthenticated'](),controller[_0xc141('0x13')]);router['get'](_0xc141('0x14'),auth['isAuthenticated'](),controller[_0xc141('0x15')]);router['post']('/',auth[_0xc141('0xb')](),controller[_0xc141('0x16')]);router[_0xc141('0x17')]('/:id/teams',auth[_0xc141('0xb')](),controller[_0xc141('0x18')]);router[_0xc141('0x17')](_0xc141('0x14'),auth[_0xc141('0xb')](),controller['addAgents']);router[_0xc141('0x19')](_0xc141('0x1a'),auth[_0xc141('0xb')](),controller[_0xc141('0x1b')]);router[_0xc141('0x1c')](_0xc141('0x1a'),auth[_0xc141('0xb')](),controller[_0xc141('0x1d')]);router['delete'](_0xc141('0x12'),auth[_0xc141('0xb')](),controller['removeTeams']);router[_0xc141('0x1c')](_0xc141('0x14'),auth[_0xc141('0xb')](),controller['removeAgents']);module[_0xc141('0x1e')]=router; \ No newline at end of file +var _0x60b1=['addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','show','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams'];(function(_0x2e99c3,_0x246189){var _0x149af8=function(_0x24c39a){while(--_0x24c39a){_0x2e99c3['push'](_0x2e99c3['shift']());}};_0x149af8(++_0x246189);}(_0x60b1,0x116));var _0x160b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60b1[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x160b('0x0'));var util=require(_0x160b('0x1'));var path=require(_0x160b('0x2'));var timeout=require('connect-timeout');var express=require(_0x160b('0x3'));var router=express['Router']();var fs_extra=require(_0x160b('0x4'));var auth=require(_0x160b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x160b('0x6'));var controller=require(_0x160b('0x7'));router[_0x160b('0x8')]('/',auth[_0x160b('0x9')](),controller[_0x160b('0xa')]);router[_0x160b('0x8')]('/describe',auth[_0x160b('0x9')](),controller['describe']);router[_0x160b('0x8')]('/:id',auth[_0x160b('0x9')](),controller[_0x160b('0xb')]);router[_0x160b('0x8')]('/:id/members',auth[_0x160b('0x9')](),controller['getMembers']);router[_0x160b('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x160b('0xc')]);router[_0x160b('0x8')](_0x160b('0xd'),auth[_0x160b('0x9')](),controller[_0x160b('0xe')]);router[_0x160b('0xf')]('/',auth['isAuthenticated'](),controller[_0x160b('0x10')]);router[_0x160b('0xf')](_0x160b('0x11'),auth[_0x160b('0x9')](),controller[_0x160b('0x12')]);router[_0x160b('0xf')](_0x160b('0xd'),auth[_0x160b('0x9')](),controller[_0x160b('0x13')]);router[_0x160b('0x14')](_0x160b('0x15'),auth['isAuthenticated'](),controller[_0x160b('0x16')]);router[_0x160b('0x17')](_0x160b('0x15'),auth[_0x160b('0x9')](),controller[_0x160b('0x18')]);router['delete'](_0x160b('0x11'),auth['isAuthenticated'](),controller[_0x160b('0x19')]);router['delete'](_0x160b('0xd'),auth[_0x160b('0x9')](),controller[_0x160b('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 07eac88..6555dc5 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 _0x7a97=['rrmemory','roundrobin','exports','name','INTEGER','ENUM'];(function(_0x11f457,_0x502026){var _0x3e78e9=function(_0x320d11){while(--_0x320d11){_0x11f457['push'](_0x11f457['shift']());}};_0x3e78e9(++_0x502026);}(_0x7a97,0x7a));var _0x77a9=function(_0x57b00b,_0x23d168){_0x57b00b=_0x57b00b-0x0;var _0x4c0d6a=_0x7a97[_0x57b00b];return _0x4c0d6a;};'use strict';var Sequelize=require('sequelize');module[_0x77a9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x77a9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x77a9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x77a9('0x3')](_0x77a9('0x4'),'beepall',_0x77a9('0x5'))}}; \ No newline at end of file +var _0x820d=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x820d,0x1ad));var _0xd820=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x820d[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require(_0xd820('0x0'));module[_0xd820('0x1')]={'name':{'type':Sequelize[_0xd820('0x2')],'unique':_0xd820('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd820('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd820('0x5')](_0xd820('0x6'),_0xd820('0x7'),_0xd820('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5c07727..704bfbd 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 _0x59b1=['fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','rawAttributes','includeAll','find','create','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','options','findAll','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','body','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','ids','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','status','end','json','undefined','count','offset','limit','set','apply','reject','update','then','get','SmsQueues','destroy','sendStatus','stack','name','SmsQueue','fieldName','map','query','keys','model','attributes','intersection'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x59b1,0xda));var _0x159b=function(_0x338bcb,_0x4e3ba3){_0x338bcb=_0x338bcb-0x0;var _0x2e6ab7=_0x59b1[_0x338bcb];return _0x2e6ab7;};'use strict';var emlformat=require(_0x159b('0x0'));var rimraf=require(_0x159b('0x1'));var zipdir=require(_0x159b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x159b('0x3'));var moment=require(_0x159b('0x4'));var BPromise=require(_0x159b('0x5'));var Mustache=require(_0x159b('0x6'));var util=require(_0x159b('0x7'));var path=require(_0x159b('0x8'));var sox=require(_0x159b('0x9'));var csv=require(_0x159b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x159b('0xb'));var _=require('lodash');var squel=require(_0x159b('0xc'));var crypto=require(_0x159b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x159b('0xe'));var toCsv=require(_0x159b('0xa'));var querystring=require('querystring');var Papa=require(_0x159b('0xf'));var Redis=require(_0x159b('0x10'));var authService=require(_0x159b('0x11'));var qs=require(_0x159b('0x12'));var as=require(_0x159b('0x13'));var hardwareService=require(_0x159b('0x14'));var logger=require('../../config/logger')(_0x159b('0x15'));var utils=require(_0x159b('0x16'));var config=require(_0x159b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x159b('0x18')](config[_0x159b('0x19')],{'host':_0x159b('0x1a'),'port':0x18eb});var socket=require(_0x159b('0x1b'))(new Redis(config[_0x159b('0x19')]));require(_0x159b('0x1c'))[_0x159b('0x1d')](socket);function respondWithStatusCode(_0x508bb5,_0x26ab4d){_0x26ab4d=_0x26ab4d||0xcc;return function(_0x35c88c){if(_0x35c88c){return _0x508bb5['sendStatus'](_0x26ab4d);}return _0x508bb5[_0x159b('0x1e')](_0x26ab4d)[_0x159b('0x1f')]();};}function respondWithResult(_0x1ee5ea,_0x4aa3a0){_0x4aa3a0=_0x4aa3a0||0xc8;return function(_0x4db4a9){if(_0x4db4a9){return _0x1ee5ea[_0x159b('0x1e')](_0x4aa3a0)[_0x159b('0x20')](_0x4db4a9);}};}function respondWithFilteredResult(_0x62a8c,_0x16d148){return function(_0x1c40f2){if(_0x1c40f2){var _0x2eccd0=typeof _0x16d148['offset']==='undefined'&&typeof _0x16d148['limit']===_0x159b('0x21');var _0xf15bbd=_0x1c40f2[_0x159b('0x22')];var _0x492ef5=_0x2eccd0?0x0:_0x16d148[_0x159b('0x23')];var _0x3ec10a=_0x2eccd0?_0x1c40f2[_0x159b('0x22')]:_0x16d148['offset']+_0x16d148[_0x159b('0x24')];var _0x5af34c;if(_0x3ec10a>=_0xf15bbd){_0x3ec10a=_0xf15bbd;_0x5af34c=0xc8;}else{_0x5af34c=0xce;}_0x62a8c[_0x159b('0x1e')](_0x5af34c);return _0x62a8c[_0x159b('0x25')]('Content-Range',_0x492ef5+'-'+_0x3ec10a+'/'+_0xf15bbd)[_0x159b('0x20')](_0x1c40f2);}return null;};}function patchUpdates(_0xae4cf8){return function(_0xad803c){try{jsonpatch[_0x159b('0x26')](_0xad803c,_0xae4cf8,!![]);}catch(_0x127683){return BPromise[_0x159b('0x27')](_0x127683);}return _0xad803c['save']();};}function saveUpdates(_0x1abb9b,_0x598edd){return function(_0x3d177d){if(_0x3d177d){return _0x3d177d[_0x159b('0x28')](_0x1abb9b)[_0x159b('0x29')](function(_0x3c8af7){return _0x3c8af7;});}return null;};}function removeEntity(_0x5f49ea,_0x1941c1){return function(_0x20fd60){if(_0x20fd60){return _0x20fd60['destroy']()[_0x159b('0x29')](function(){var _0x37158a=_0x20fd60[_0x159b('0x2a')]({'plain':!![]});var _0x1c6fca=_0x159b('0x2b');return db['UserProfileResource'][_0x159b('0x2c')]({'where':{'type':_0x1c6fca,'resourceId':_0x37158a['id']}})[_0x159b('0x29')](function(){return _0x20fd60;});})['then'](function(){_0x5f49ea[_0x159b('0x1e')](0xcc)[_0x159b('0x1f')]();});}};}function handleEntityNotFound(_0xce5f20,_0x5dab4b){return function(_0x2592f4){if(!_0x2592f4){_0xce5f20[_0x159b('0x2d')](0x194);}return _0x2592f4;};}function handleError(_0x8ee29c,_0x5b164c){_0x5b164c=_0x5b164c||0x1f4;return function(_0x2e653d){logger['error'](_0x2e653d[_0x159b('0x2e')]);if(_0x2e653d[_0x159b('0x2f')]){delete _0x2e653d[_0x159b('0x2f')];}_0x8ee29c['status'](_0x5b164c)['send'](_0x2e653d);};}exports['index']=function(_0x3e677d,_0x518f18){var _0x372577={},_0x4d2772={},_0x2fe6ea={'count':0x0,'rows':[]};var _0x2e1424=_['map'](db[_0x159b('0x30')]['rawAttributes'],function(_0xe92ec4){return{'name':_0xe92ec4[_0x159b('0x31')],'type':_0xe92ec4['type']['key']};});_0x4d2772['model']=_[_0x159b('0x32')](_0x2e1424,_0x159b('0x2f'));_0x4d2772[_0x159b('0x33')]=_[_0x159b('0x34')](_0x3e677d[_0x159b('0x33')]);_0x4d2772['filters']=_['intersection'](_0x4d2772[_0x159b('0x35')],_0x4d2772[_0x159b('0x33')]);_0x372577[_0x159b('0x36')]=_[_0x159b('0x37')](_0x4d2772[_0x159b('0x35')],qs[_0x159b('0x38')](_0x3e677d[_0x159b('0x33')]['fields']));_0x372577[_0x159b('0x36')]=_0x372577[_0x159b('0x36')][_0x159b('0x39')]?_0x372577[_0x159b('0x36')]:_0x4d2772[_0x159b('0x35')];if(!_0x3e677d[_0x159b('0x33')][_0x159b('0x3a')](_0x159b('0x3b'))){_0x372577[_0x159b('0x24')]=qs['limit'](_0x3e677d[_0x159b('0x33')]['limit']);_0x372577['offset']=qs[_0x159b('0x23')](_0x3e677d[_0x159b('0x33')][_0x159b('0x23')]);}_0x372577[_0x159b('0x3c')]=qs[_0x159b('0x3d')](_0x3e677d[_0x159b('0x33')][_0x159b('0x3d')]);_0x372577['where']=qs[_0x159b('0x3e')](_[_0x159b('0x3f')](_0x3e677d[_0x159b('0x33')],_0x4d2772['filters']),_0x2e1424);if(_0x3e677d[_0x159b('0x33')][_0x159b('0x40')]){_0x372577[_0x159b('0x41')]=_[_0x159b('0x42')](_0x372577['where'],{'$or':_['map'](_0x2e1424,function(_0x13c5eb){if(_0x13c5eb['type']!==_0x159b('0x43')){var _0xe40f38={};_0xe40f38[_0x13c5eb[_0x159b('0x2f')]]={'$like':'%'+_0x3e677d[_0x159b('0x33')][_0x159b('0x40')]+'%'};return _0xe40f38;}})});}_0x372577=_[_0x159b('0x42')]({},_0x372577,_0x3e677d['options']);var _0x17fa3d={'where':_0x372577[_0x159b('0x41')]};return db[_0x159b('0x30')][_0x159b('0x22')](_0x17fa3d)[_0x159b('0x29')](function(_0x3a601d){_0x2fe6ea[_0x159b('0x22')]=_0x3a601d;if(_0x3e677d['query']['includeAll']){_0x372577[_0x159b('0x44')]=[{'all':!![]}];}return db[_0x159b('0x30')]['findAll'](_0x372577);})['then'](function(_0x444abf){_0x2fe6ea[_0x159b('0x45')]=_0x444abf;return _0x2fe6ea;})['then'](respondWithFilteredResult(_0x518f18,_0x372577))[_0x159b('0x46')](handleError(_0x518f18,null));};exports[_0x159b('0x47')]=function(_0x5ac09c,_0x3522e6){var _0x21ffdb={'raw':!![],'where':{'id':_0x5ac09c[_0x159b('0x48')]['id']}},_0x5e28f9={};_0x5e28f9[_0x159b('0x35')]=_[_0x159b('0x34')](db[_0x159b('0x30')][_0x159b('0x49')]);_0x5e28f9[_0x159b('0x33')]=_['keys'](_0x5ac09c[_0x159b('0x33')]);_0x5e28f9[_0x159b('0x3e')]=_[_0x159b('0x37')](_0x5e28f9[_0x159b('0x35')],_0x5e28f9['query']);_0x21ffdb['attributes']=_[_0x159b('0x37')](_0x5e28f9[_0x159b('0x35')],qs[_0x159b('0x38')](_0x5ac09c[_0x159b('0x33')]['fields']));_0x21ffdb[_0x159b('0x36')]=_0x21ffdb[_0x159b('0x36')][_0x159b('0x39')]?_0x21ffdb['attributes']:_0x5e28f9[_0x159b('0x35')];if(_0x5ac09c[_0x159b('0x33')][_0x159b('0x4a')]){_0x21ffdb['include']=[{'all':!![]}];}_0x21ffdb=_['merge']({},_0x21ffdb,_0x5ac09c['options']);return db['SmsQueue'][_0x159b('0x4b')](_0x21ffdb)[_0x159b('0x29')](handleEntityNotFound(_0x3522e6,null))[_0x159b('0x29')](respondWithResult(_0x3522e6,null))[_0x159b('0x46')](handleError(_0x3522e6,null));};exports[_0x159b('0x4c')]=function(_0x52ed83,_0x3ae3fa){return db['SmsQueue'][_0x159b('0x4c')](_0x52ed83['body'],{})[_0x159b('0x29')](function(_0x2a762b){var _0x24c77e=_0x52ed83[_0x159b('0x4d')][_0x159b('0x2a')]({'plain':!![]});if(!_0x24c77e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24c77e[_0x159b('0x4e')]===_0x159b('0x4d')){var _0x921742=_0x2a762b[_0x159b('0x2a')]({'plain':!![]});var _0x3a4dff=_0x159b('0x2b');return db[_0x159b('0x4f')][_0x159b('0x4b')]({'where':{'name':_0x3a4dff,'userProfileId':_0x24c77e['userProfileId']},'raw':!![]})[_0x159b('0x29')](function(_0x5ca8fd){if(_0x5ca8fd&&_0x5ca8fd[_0x159b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x921742['name'],'resourceId':_0x921742['id'],'type':_0x5ca8fd[_0x159b('0x2f')],'sectionId':_0x5ca8fd['id']},{})[_0x159b('0x29')](function(){return _0x2a762b;});}else{return _0x2a762b;}})[_0x159b('0x46')](function(_0x44b259){logger[_0x159b('0x51')](_0x159b('0x52'),_0x44b259);throw _0x44b259;});}return _0x2a762b;})[_0x159b('0x29')](respondWithResult(_0x3ae3fa,0xc9))[_0x159b('0x46')](handleError(_0x3ae3fa,null));};exports[_0x159b('0x28')]=function(_0x217fca,_0x46169c){if(_0x217fca['body']['id']){delete _0x217fca['body']['id'];}return db[_0x159b('0x30')][_0x159b('0x4b')]({'where':{'id':_0x217fca['params']['id']}})[_0x159b('0x29')](handleEntityNotFound(_0x46169c,null))[_0x159b('0x29')](saveUpdates(_0x217fca['body'],null))[_0x159b('0x29')](respondWithResult(_0x46169c,null))['catch'](handleError(_0x46169c,null));};exports['destroy']=function(_0x26da23,_0x2e7e12){return db[_0x159b('0x30')][_0x159b('0x4b')]({'where':{'id':_0x26da23[_0x159b('0x48')]['id']}})[_0x159b('0x29')](handleEntityNotFound(_0x2e7e12,null))['then'](removeEntity(_0x2e7e12,null))[_0x159b('0x46')](handleError(_0x2e7e12,null));};exports[_0x159b('0x53')]=function(_0x185c62,_0x41b70b){return db[_0x159b('0x30')]['describe']()[_0x159b('0x29')](respondWithResult(_0x41b70b,null))[_0x159b('0x46')](handleError(_0x41b70b,null));};exports[_0x159b('0x54')]=function(_0x2c1fa7,_0x4e119f,_0x2ee1d0){var _0xc82e1c={'raw':!![],'where':{}},_0x347df9={},_0x25dc79;return db[_0x159b('0x30')][_0x159b('0x55')]({'where':{'id':_0x2c1fa7[_0x159b('0x48')]['id']}})[_0x159b('0x29')](handleEntityNotFound(_0x4e119f,null))[_0x159b('0x29')](function(_0x2bc4c2){if(_0x2bc4c2){_0x25dc79=_0x2bc4c2[_0x159b('0x2a')]({'plain':!![]});_0x347df9[_0x159b('0x35')]=_[_0x159b('0x34')](db[_0x159b('0x56')][_0x159b('0x49')]);_0x347df9['query']=_[_0x159b('0x34')](_0x2c1fa7['query']);_0x347df9['filters']=_[_0x159b('0x37')](_0x347df9[_0x159b('0x35')],_0x347df9[_0x159b('0x33')]);_0xc82e1c[_0x159b('0x36')]=_['intersection'](_0x347df9[_0x159b('0x35')],qs[_0x159b('0x38')](_0x2c1fa7[_0x159b('0x33')]['fields']));_0xc82e1c[_0x159b('0x36')]=_0xc82e1c[_0x159b('0x36')][_0x159b('0x39')]?_0xc82e1c[_0x159b('0x36')]:_0x347df9[_0x159b('0x35')];if(!_0x2c1fa7['query'][_0x159b('0x3a')](_0x159b('0x3b'))){_0xc82e1c[_0x159b('0x24')]=qs[_0x159b('0x24')](_0x2c1fa7[_0x159b('0x33')][_0x159b('0x24')]);_0xc82e1c[_0x159b('0x23')]=qs['offset'](_0x2c1fa7[_0x159b('0x33')][_0x159b('0x23')]);}_0xc82e1c[_0x159b('0x3c')]=qs[_0x159b('0x3d')](_0x2c1fa7[_0x159b('0x33')][_0x159b('0x3d')]);_0xc82e1c[_0x159b('0x41')]=qs[_0x159b('0x3e')](_[_0x159b('0x3f')](_0x2c1fa7[_0x159b('0x33')],_0x347df9[_0x159b('0x3e')]));_0xc82e1c[_0x159b('0x41')][_0x159b('0x57')]=_0x2bc4c2['id'];if(_0x2c1fa7['query'][_0x159b('0x40')]){_0xc82e1c['where']=_[_0x159b('0x42')](_0xc82e1c[_0x159b('0x41')],{'$or':_[_0x159b('0x32')](_0xc82e1c[_0x159b('0x36')],function(_0x2278f3){var _0x1e2503={};_0x1e2503[_0x2278f3]={'$like':'%'+_0x2c1fa7['query'][_0x159b('0x40')]+'%'};return _0x1e2503;})});}_0xc82e1c=_[_0x159b('0x42')]({},_0xc82e1c,_0x2c1fa7[_0x159b('0x58')]);return db[_0x159b('0x56')][_0x159b('0x59')](_0xc82e1c);}})[_0x159b('0x29')](function(_0x1f9883){if(_0x1f9883){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x1f9883,'UserId'),'role':'agent'},'attributes':['id',_0x159b('0x2f'),_0x159b('0x5a'),_0x159b('0x5b'),_0x159b('0x5c')]});}})[_0x159b('0x29')](function(_0x241da4){if(_0x241da4){return{'count':_0x241da4[_0x159b('0x22')],'rows':_[_0x159b('0x32')](_0x241da4['rows'],function(_0x417d12){return{'membername':_0x417d12['name'],'UserId':_0x417d12['id'],'queue_name':_0x25dc79[_0x159b('0x2f')],'SmsQueueId':_0x25dc79['id'],'interface':util[_0x159b('0x5d')](_0x159b('0x5e'),_0x159b('0x5f'),_0x417d12[_0x159b('0x2f')]),'penalty':0x0,'paused':_0x417d12[_0x159b('0x5a')],'createdAt':_0x417d12['createdAt'],'updatedAt':_0x417d12['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x159b('0x29')](respondWithFilteredResult(_0x4e119f,_0xc82e1c))[_0x159b('0x46')](handleError(_0x4e119f,null));};exports[_0x159b('0x60')]=function(_0xf41a1c,_0x7eac8a,_0x21faa0){var _0x2347df={};var _0x5e9a7d={};var _0x482130;var _0x9a9a87;return db[_0x159b('0x30')]['findOne']({'where':{'id':_0xf41a1c[_0x159b('0x48')]['id']}})[_0x159b('0x29')](handleEntityNotFound(_0x7eac8a,null))[_0x159b('0x29')](function(_0x128090){if(_0x128090){_0x482130=_0x128090;_0x5e9a7d['model']=_[_0x159b('0x34')](db[_0x159b('0x61')]['rawAttributes']);_0x5e9a7d[_0x159b('0x33')]=_[_0x159b('0x34')](_0xf41a1c[_0x159b('0x33')]);_0x5e9a7d[_0x159b('0x3e')]=_['intersection'](_0x5e9a7d[_0x159b('0x35')],_0x5e9a7d[_0x159b('0x33')]);_0x2347df[_0x159b('0x36')]=_[_0x159b('0x37')](_0x5e9a7d[_0x159b('0x35')],qs[_0x159b('0x38')](_0xf41a1c[_0x159b('0x33')][_0x159b('0x38')]));_0x2347df[_0x159b('0x36')]=_0x2347df['attributes'][_0x159b('0x39')]?_0x2347df[_0x159b('0x36')]:_0x5e9a7d['model'];_0x2347df[_0x159b('0x3c')]=qs[_0x159b('0x3d')](_0xf41a1c['query'][_0x159b('0x3d')]);_0x2347df['where']=qs[_0x159b('0x3e')](_[_0x159b('0x3f')](_0xf41a1c['query'],_0x5e9a7d[_0x159b('0x3e')]));if(_0xf41a1c[_0x159b('0x33')][_0x159b('0x40')]){_0x2347df[_0x159b('0x41')]=_[_0x159b('0x42')](_0x2347df['where'],{'$or':_[_0x159b('0x32')](_0x2347df['attributes'],function(_0x1b674c){var _0x366c4a={};_0x366c4a[_0x1b674c]={'$like':'%'+_0xf41a1c[_0x159b('0x33')][_0x159b('0x40')]+'%'};return _0x366c4a;})});}_0x2347df=_[_0x159b('0x42')]({},_0x2347df,_0xf41a1c['options']);return _0x482130[_0x159b('0x60')](_0x2347df);}})['then'](function(_0x211863){if(_0x211863){_0x9a9a87=_0x211863[_0x159b('0x39')];if(!_0xf41a1c[_0x159b('0x33')][_0x159b('0x3a')](_0x159b('0x3b'))){_0x2347df[_0x159b('0x24')]=qs[_0x159b('0x24')](_0xf41a1c[_0x159b('0x33')][_0x159b('0x24')]);_0x2347df[_0x159b('0x23')]=qs[_0x159b('0x23')](_0xf41a1c['query'][_0x159b('0x23')]);}return _0x482130[_0x159b('0x60')](_0x2347df);}})[_0x159b('0x29')](function(_0x5fa3f9){if(_0x5fa3f9){return _0x5fa3f9?{'count':_0x9a9a87,'rows':_0x5fa3f9}:null;}})[_0x159b('0x29')](respondWithResult(_0x7eac8a,null))[_0x159b('0x46')](handleError(_0x7eac8a,null));};exports['addTeams']=function(_0x23d9d3,_0xd8fd9d,_0x148e27){var _0x44ceef=_0x23d9d3[_0x159b('0x62')]['ids'];return db[_0x159b('0x61')][_0x159b('0x59')]({'where':{'id':_0x44ceef},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x159b('0x2f'),_0x159b('0x63'),_0x159b('0x64'),_0x159b('0x65')],'raw':!![]}]})[_0x159b('0x29')](function(_0x3b4d64){if(_0x3b4d64){var _0x28a6dd=_[_0x159b('0x66')](_0x3b4d64,function(_0x50dcf5){var _0x3a7027=_0x50dcf5['get']({'plain':!![]});return _0x3a7027[_0x159b('0x67')];});return db['SmsQueue'][_0x159b('0x4b')]({'where':{'id':_0x23d9d3[_0x159b('0x48')]['id']}})[_0x159b('0x29')](function(_0x44c724){return db[_0x159b('0x68')][_0x159b('0x69')](function(_0x52d7c9){return _0x44c724[_0x159b('0x6a')](_0x44ceef,{'transaction':_0x52d7c9})[_0x159b('0x29')](function(){return BPromise['each'](_0x28a6dd,function(_0x352895){return db['UserSmsQueue'][_0x159b('0x6b')]({'where':{'UserId':_0x352895['id'],'SmsQueueId':_0x23d9d3[_0x159b('0x48')]['id']},'transaction':_0x52d7c9});});})['then'](function(){_0x28a6dd[_0x159b('0x6c')](function(_0x24f78d){socket[_0x159b('0x6d')](_0x159b('0x6e'),{'UserId':_0x24f78d['id'],'SmsQueueId':_0x44c724['id']});});});});});}})[_0x159b('0x29')](respondWithStatusCode(_0xd8fd9d,null))[_0x159b('0x46')](handleError(_0xd8fd9d,null));};exports['removeTeams']=function(_0xc33bc5,_0x2f309e,_0x1e8af7){return db[_0x159b('0x61')][_0x159b('0x59')]({'where':{'id':_0xc33bc5[_0x159b('0x33')][_0x159b('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x159b('0x70')],'as':_0x159b('0x67'),'attributes':['id'],'raw':!![]}]})[_0x159b('0x29')](handleEntityNotFound(_0x2f309e,null))[_0x159b('0x29')](function(_0x4bd1f9){var _0x3d91aa=_['map'](_0x4bd1f9,'id');var _0x29e46b=[];var _0x954cfd=[];var _0x4230bc=squel['select']();_0x4230bc[_0x159b('0x71')]('tq.TeamId')[_0x159b('0x72')]('team_has_sms_queues','tq')[_0x159b('0x73')](_0x159b('0x74'),'ut',_0x159b('0x75'))['where'](_0x159b('0x76'),_0xc33bc5[_0x159b('0x48')]['id']);for(var _0x3645cc=0x0;_0x3645cc<_0x4bd1f9[_0x159b('0x39')];_0x3645cc+=0x1){let _0x3a8f9f=_0x4bd1f9[_0x3645cc];for(var _0x2b8047=0x0;_0x2b8047<_0x3a8f9f[_0x159b('0x67')][_0x159b('0x39')];_0x2b8047+=0x1){let _0x2fb2c1=_0x3a8f9f['Agents'][_0x2b8047];var _0x5327a9=_0x4230bc[_0x159b('0x77')]();_0x5327a9['where'](_0x159b('0x78'),_0x2fb2c1['id']);_0x954cfd[_0x159b('0x79')](db[_0x159b('0x68')]['query'](_0x5327a9[_0x159b('0x7a')](),{'type':db[_0x159b('0x68')][_0x159b('0x7b')][_0x159b('0x7c')]})[_0x159b('0x29')](function(_0x2d8a0d){if(_0x2d8a0d[_0x159b('0x39')]===0x1){return _0x2fb2c1['id'];}else{var _0x1fd4fd=_[_0x159b('0x7d')](_[_0x159b('0x32')](_0x2d8a0d,'TeamId'),function(_0x47c935){return _['includes'](_0x3d91aa,_0x47c935);});if(_0x1fd4fd){return _0x2fb2c1['id'];}}}));}}return BPromise[_0x159b('0x7e')](_0x954cfd)['then'](function(_0x52b83e){_0x29e46b=_(_0x29e46b)['union'](_0x52b83e)['compact']()[_0x159b('0x7f')]();return db['SmsQueue']['find']({'where':{'id':_0xc33bc5[_0x159b('0x48')]['id']}})['then'](function(_0xa39111){return db[_0x159b('0x68')][_0x159b('0x69')](function(_0x2656d6){return _0xa39111[_0x159b('0x80')](_0xc33bc5[_0x159b('0x33')][_0x159b('0x6f')],{'transaction':_0x2656d6})[_0x159b('0x29')](function(){if(!_[_0x159b('0x81')](_0x29e46b)){return _0xa39111[_0x159b('0x82')](_0x29e46b,{'transaction':_0x2656d6});}})['then'](function(){_0x29e46b[_0x159b('0x6c')](function(_0x5e7b80){socket[_0x159b('0x6d')](_0x159b('0x83'),{'UserId':_0x5e7b80,'SmsQueueId':_0xa39111['id']});});});});});});})[_0x159b('0x29')](respondWithStatusCode(_0x2f309e,null))[_0x159b('0x46')](handleError(_0x2f309e,null));};exports[_0x159b('0x84')]=function(_0x5daada,_0x37c272,_0x18eeed){return db['SmsQueue'][_0x159b('0x4b')]({'where':{'id':_0x5daada['params']['id']}})[_0x159b('0x29')](handleEntityNotFound(_0x37c272,null))[_0x159b('0x29')](function(_0x6a6f0a){if(_0x6a6f0a){return _0x6a6f0a['addAgents'](_0x5daada['body'][_0x159b('0x6f')],_[_0x159b('0x85')](_0x5daada[_0x159b('0x62')],[_0x159b('0x6f'),'id'])||{})[_0x159b('0x86')](function(_0x174a47){for(var _0x18f72d=0x0;_0x18f72d<_0x5daada[_0x159b('0x62')][_0x159b('0x6f')][_0x159b('0x39')];_0x18f72d+=0x1){socket[_0x159b('0x6d')](_0x159b('0x6e'),{'UserId':_0x5daada[_0x159b('0x62')][_0x159b('0x6f')][_0x18f72d],'SmsQueueId':_0x5daada[_0x159b('0x48')]['id']});}return _0x174a47;});}})['then'](respondWithResult(_0x37c272,null))['catch'](handleError(_0x37c272,null));};exports[_0x159b('0x82')]=function(_0x2d1973,_0x4635a0,_0x20d2b0){return db[_0x159b('0x30')][_0x159b('0x4b')]({'where':{'id':_0x2d1973[_0x159b('0x48')]['id']}})[_0x159b('0x29')](handleEntityNotFound(_0x4635a0,null))['then'](function(_0x5bcfb1){if(_0x5bcfb1){return _0x5bcfb1['removeAgents'](_0x2d1973[_0x159b('0x33')]['ids'])[_0x159b('0x29')](function(){if(_[_0x159b('0x87')](_0x2d1973['query'][_0x159b('0x6f')])){for(var _0x409ed7=0x0;_0x409ed7<_0x2d1973[_0x159b('0x33')][_0x159b('0x6f')][_0x159b('0x39')];_0x409ed7+=0x1){socket[_0x159b('0x6d')](_0x159b('0x83'),{'UserId':Number(_0x2d1973[_0x159b('0x33')][_0x159b('0x6f')][_0x409ed7]),'SmsQueueId':Number(_0x2d1973[_0x159b('0x48')]['id'])});}}else{socket['emit'](_0x159b('0x83'),{'UserId':Number(_0x2d1973[_0x159b('0x33')]['ids']),'SmsQueueId':Number(_0x2d1973['params']['id'])});}});}})[_0x159b('0x29')](respondWithStatusCode(_0x4635a0,null))['catch'](handleError(_0x4635a0,null));};exports[_0x159b('0x88')]=function(_0x464d74,_0x1b2f6e,_0x39c533){var _0x295aea={};var _0x154f58={};var _0x38e5d1;var _0x20dd6b;return db[_0x159b('0x30')][_0x159b('0x55')]({'where':{'id':_0x464d74['params']['id']}})[_0x159b('0x29')](handleEntityNotFound(_0x1b2f6e,null))[_0x159b('0x29')](function(_0x445259){if(_0x445259){_0x38e5d1=_0x445259;_0x154f58['model']=_[_0x159b('0x34')](db[_0x159b('0x70')]['rawAttributes']);_0x154f58[_0x159b('0x33')]=_[_0x159b('0x34')](_0x464d74[_0x159b('0x33')]);_0x154f58[_0x159b('0x3e')]=_[_0x159b('0x37')](_0x154f58[_0x159b('0x35')],_0x154f58['query']);_0x295aea['attributes']=_[_0x159b('0x37')](_0x154f58[_0x159b('0x35')],qs[_0x159b('0x38')](_0x464d74[_0x159b('0x33')][_0x159b('0x38')]));_0x295aea[_0x159b('0x36')]=_0x295aea['attributes'][_0x159b('0x39')]?_0x295aea[_0x159b('0x36')]:_0x154f58['model'];_0x295aea[_0x159b('0x3c')]=qs['sort'](_0x464d74[_0x159b('0x33')]['sort']);_0x295aea['where']=qs[_0x159b('0x3e')](_['pick'](_0x464d74[_0x159b('0x33')],_0x154f58[_0x159b('0x3e')]));if(_0x464d74[_0x159b('0x33')][_0x159b('0x40')]){_0x295aea[_0x159b('0x41')]=_[_0x159b('0x42')](_0x295aea[_0x159b('0x41')],{'$or':_[_0x159b('0x32')](_0x295aea['attributes'],function(_0x26c83c){var _0x17a58b={};_0x17a58b[_0x26c83c]={'$like':'%'+_0x464d74[_0x159b('0x33')]['filter']+'%'};return _0x17a58b;})});}_0x295aea=_['merge']({},_0x295aea,_0x464d74['options']);return _0x38e5d1[_0x159b('0x88')](_0x295aea);}})['then'](function(_0x5cf5a9){if(_0x5cf5a9){_0x20dd6b=_0x5cf5a9[_0x159b('0x39')];if(!_0x464d74[_0x159b('0x33')]['hasOwnProperty'](_0x159b('0x3b'))){_0x295aea[_0x159b('0x24')]=qs[_0x159b('0x24')](_0x464d74[_0x159b('0x33')]['limit']);_0x295aea['offset']=qs[_0x159b('0x23')](_0x464d74[_0x159b('0x33')][_0x159b('0x23')]);}return _0x38e5d1[_0x159b('0x88')](_0x295aea);}})[_0x159b('0x29')](function(_0x34014b){if(_0x34014b){return _0x34014b?{'count':_0x20dd6b,'rows':_0x34014b}:null;}})[_0x159b('0x29')](respondWithResult(_0x1b2f6e,null))[_0x159b('0x46')](handleError(_0x1b2f6e,null));}; \ No newline at end of file +var _0x23d9=['save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','length','User','agent','smsPause','updatedAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','UserSmsQueue','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','user_has_teams','clone','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x18e213,_0x4d8a82){var _0x2a160e=function(_0x4f234e){while(--_0x4f234e){_0x18e213['push'](_0x18e213['shift']());}};_0x2a160e(++_0x4d8a82);}(_0x23d9,0x65));var _0x923d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x23d9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x923d('0x0'));var rimraf=require(_0x923d('0x1'));var zipdir=require(_0x923d('0x2'));var jsonpatch=require(_0x923d('0x3'));var rp=require(_0x923d('0x4'));var moment=require(_0x923d('0x5'));var BPromise=require(_0x923d('0x6'));var Mustache=require(_0x923d('0x7'));var util=require(_0x923d('0x8'));var path=require('path');var sox=require(_0x923d('0x9'));var csv=require(_0x923d('0xa'));var ejs=require(_0x923d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x923d('0xc'));var squel=require(_0x923d('0xd'));var crypto=require(_0x923d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x923d('0xa'));var querystring=require('querystring');var Papa=require(_0x923d('0xf'));var Redis=require('ioredis');var authService=require(_0x923d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x923d('0x11'));var logger=require('../../config/logger')(_0x923d('0x12'));var utils=require(_0x923d('0x13'));var config=require(_0x923d('0x14'));var licenseUtil=require(_0x923d('0x15'));var db=require(_0x923d('0x16'))['db'];config[_0x923d('0x17')]=_[_0x923d('0x18')](config['redis'],{'host':_0x923d('0x19'),'port':0x18eb});var socket=require(_0x923d('0x1a'))(new Redis(config[_0x923d('0x17')]));require(_0x923d('0x1b'))['register'](socket);function respondWithStatusCode(_0x382bbf,_0x2196c0){_0x2196c0=_0x2196c0||0xcc;return function(_0x394dbf){if(_0x394dbf){return _0x382bbf[_0x923d('0x1c')](_0x2196c0);}return _0x382bbf[_0x923d('0x1d')](_0x2196c0)[_0x923d('0x1e')]();};}function respondWithResult(_0x4cc35c,_0x541dc6){_0x541dc6=_0x541dc6||0xc8;return function(_0x51d7ff){if(_0x51d7ff){return _0x4cc35c[_0x923d('0x1d')](_0x541dc6)[_0x923d('0x1f')](_0x51d7ff);}};}function respondWithFilteredResult(_0x17040a,_0x14f6ea){return function(_0x3c3403){if(_0x3c3403){var _0x9dfd5c=typeof _0x14f6ea[_0x923d('0x20')]==='undefined'&&typeof _0x14f6ea[_0x923d('0x21')]===_0x923d('0x22');var _0x529ec5=_0x3c3403[_0x923d('0x23')];var _0xf2cd48=_0x9dfd5c?0x0:_0x14f6ea[_0x923d('0x20')];var _0x40dd6f=_0x9dfd5c?_0x3c3403[_0x923d('0x23')]:_0x14f6ea[_0x923d('0x20')]+_0x14f6ea['limit'];var _0x526d8f;if(_0x40dd6f>=_0x529ec5){_0x40dd6f=_0x529ec5;_0x526d8f=0xc8;}else{_0x526d8f=0xce;}_0x17040a[_0x923d('0x1d')](_0x526d8f);return _0x17040a[_0x923d('0x24')](_0x923d('0x25'),_0xf2cd48+'-'+_0x40dd6f+'/'+_0x529ec5)[_0x923d('0x1f')](_0x3c3403);}return null;};}function patchUpdates(_0xdc297b){return function(_0x4ed71f){try{jsonpatch[_0x923d('0x26')](_0x4ed71f,_0xdc297b,!![]);}catch(_0x1de04a){return BPromise[_0x923d('0x27')](_0x1de04a);}return _0x4ed71f[_0x923d('0x28')]();};}function saveUpdates(_0x164de6,_0x38170d){return function(_0x360ec9){if(_0x360ec9){return _0x360ec9[_0x923d('0x29')](_0x164de6)[_0x923d('0x2a')](function(_0x3f9d7b){return _0x3f9d7b;});}return null;};}function removeEntity(_0x2e7e4b,_0x873afd){return function(_0x27f100){if(_0x27f100){return _0x27f100[_0x923d('0x2b')]()[_0x923d('0x2a')](function(){var _0xb3deeb=_0x27f100[_0x923d('0x2c')]({'plain':!![]});var _0x3af985='SmsQueues';return db[_0x923d('0x2d')]['destroy']({'where':{'type':_0x3af985,'resourceId':_0xb3deeb['id']}})[_0x923d('0x2a')](function(){return _0x27f100;});})['then'](function(){_0x2e7e4b[_0x923d('0x1d')](0xcc)[_0x923d('0x1e')]();});}};}function handleEntityNotFound(_0x223a6d,_0xfade92){return function(_0xd966d5){if(!_0xd966d5){_0x223a6d[_0x923d('0x1c')](0x194);}return _0xd966d5;};}function handleError(_0x51b2b0,_0x132049){_0x132049=_0x132049||0x1f4;return function(_0x1df318){logger['error'](_0x1df318[_0x923d('0x2e')]);if(_0x1df318[_0x923d('0x2f')]){delete _0x1df318[_0x923d('0x2f')];}_0x51b2b0[_0x923d('0x1d')](_0x132049)[_0x923d('0x30')](_0x1df318);};}exports[_0x923d('0x31')]=function(_0xf845d0,_0x285f05){var _0x2d0fdc={},_0x38d6f0={},_0x1b1050={'count':0x0,'rows':[]};var _0x432f06=_[_0x923d('0x32')](db[_0x923d('0x33')][_0x923d('0x34')],function(_0x3642cd){return{'name':_0x3642cd[_0x923d('0x35')],'type':_0x3642cd[_0x923d('0x36')][_0x923d('0x37')]};});_0x38d6f0['model']=_['map'](_0x432f06,_0x923d('0x2f'));_0x38d6f0['query']=_[_0x923d('0x38')](_0xf845d0['query']);_0x38d6f0['filters']=_[_0x923d('0x39')](_0x38d6f0[_0x923d('0x3a')],_0x38d6f0[_0x923d('0x3b')]);_0x2d0fdc[_0x923d('0x3c')]=_[_0x923d('0x39')](_0x38d6f0[_0x923d('0x3a')],qs['fields'](_0xf845d0['query'][_0x923d('0x3d')]));_0x2d0fdc[_0x923d('0x3c')]=_0x2d0fdc[_0x923d('0x3c')]['length']?_0x2d0fdc[_0x923d('0x3c')]:_0x38d6f0[_0x923d('0x3a')];if(!_0xf845d0[_0x923d('0x3b')][_0x923d('0x3e')](_0x923d('0x3f'))){_0x2d0fdc['limit']=qs[_0x923d('0x21')](_0xf845d0[_0x923d('0x3b')][_0x923d('0x21')]);_0x2d0fdc[_0x923d('0x20')]=qs[_0x923d('0x20')](_0xf845d0[_0x923d('0x3b')][_0x923d('0x20')]);}_0x2d0fdc[_0x923d('0x40')]=qs[_0x923d('0x41')](_0xf845d0[_0x923d('0x3b')][_0x923d('0x41')]);_0x2d0fdc[_0x923d('0x42')]=qs[_0x923d('0x43')](_[_0x923d('0x44')](_0xf845d0[_0x923d('0x3b')],_0x38d6f0[_0x923d('0x43')]),_0x432f06);if(_0xf845d0[_0x923d('0x3b')][_0x923d('0x45')]){_0x2d0fdc[_0x923d('0x42')]=_[_0x923d('0x46')](_0x2d0fdc[_0x923d('0x42')],{'$or':_[_0x923d('0x32')](_0x432f06,function(_0x5da981){if(_0x5da981[_0x923d('0x36')]!==_0x923d('0x47')){var _0x14fd55={};_0x14fd55[_0x5da981[_0x923d('0x2f')]]={'$like':'%'+_0xf845d0['query'][_0x923d('0x45')]+'%'};return _0x14fd55;}})});}_0x2d0fdc=_[_0x923d('0x46')]({},_0x2d0fdc,_0xf845d0[_0x923d('0x48')]);var _0x7ba29a={'where':_0x2d0fdc['where']};return db[_0x923d('0x33')][_0x923d('0x23')](_0x7ba29a)['then'](function(_0x4151bd){_0x1b1050[_0x923d('0x23')]=_0x4151bd;if(_0xf845d0['query'][_0x923d('0x49')]){_0x2d0fdc['include']=[{'all':!![]}];}return db[_0x923d('0x33')][_0x923d('0x4a')](_0x2d0fdc);})['then'](function(_0x4cb809){_0x1b1050[_0x923d('0x4b')]=_0x4cb809;return _0x1b1050;})[_0x923d('0x2a')](respondWithFilteredResult(_0x285f05,_0x2d0fdc))[_0x923d('0x4c')](handleError(_0x285f05,null));};exports[_0x923d('0x4d')]=function(_0x155c44,_0x5159cd){var _0x4b40c8={'raw':!![],'where':{'id':_0x155c44[_0x923d('0x4e')]['id']}},_0xe0b1e={};_0xe0b1e[_0x923d('0x3a')]=_[_0x923d('0x38')](db[_0x923d('0x33')]['rawAttributes']);_0xe0b1e[_0x923d('0x3b')]=_[_0x923d('0x38')](_0x155c44['query']);_0xe0b1e[_0x923d('0x43')]=_[_0x923d('0x39')](_0xe0b1e[_0x923d('0x3a')],_0xe0b1e['query']);_0x4b40c8['attributes']=_[_0x923d('0x39')](_0xe0b1e[_0x923d('0x3a')],qs[_0x923d('0x3d')](_0x155c44[_0x923d('0x3b')][_0x923d('0x3d')]));_0x4b40c8['attributes']=_0x4b40c8[_0x923d('0x3c')]['length']?_0x4b40c8[_0x923d('0x3c')]:_0xe0b1e['model'];if(_0x155c44[_0x923d('0x3b')][_0x923d('0x49')]){_0x4b40c8[_0x923d('0x4f')]=[{'all':!![]}];}_0x4b40c8=_[_0x923d('0x46')]({},_0x4b40c8,_0x155c44[_0x923d('0x48')]);return db['SmsQueue'][_0x923d('0x50')](_0x4b40c8)['then'](handleEntityNotFound(_0x5159cd,null))[_0x923d('0x2a')](respondWithResult(_0x5159cd,null))['catch'](handleError(_0x5159cd,null));};exports[_0x923d('0x51')]=function(_0x2c52ec,_0x2b3570){return db[_0x923d('0x33')][_0x923d('0x51')](_0x2c52ec['body'],{})[_0x923d('0x2a')](function(_0x2a89d1){var _0x548355=_0x2c52ec[_0x923d('0x52')][_0x923d('0x2c')]({'plain':!![]});if(!_0x548355)throw new Error(_0x923d('0x53'));if(_0x548355[_0x923d('0x54')]==='user'){var _0x10979c=_0x2a89d1[_0x923d('0x2c')]({'plain':!![]});var _0x5fbe1b=_0x923d('0x55');return db['UserProfileSection']['find']({'where':{'name':_0x5fbe1b,'userProfileId':_0x548355[_0x923d('0x56')]},'raw':!![]})[_0x923d('0x2a')](function(_0x14313b){if(_0x14313b&&_0x14313b['autoAssociation']===0x0){return db['UserProfileResource'][_0x923d('0x51')]({'name':_0x10979c['name'],'resourceId':_0x10979c['id'],'type':_0x14313b['name'],'sectionId':_0x14313b['id']},{})['then'](function(){return _0x2a89d1;});}else{return _0x2a89d1;}})[_0x923d('0x4c')](function(_0x1d880a){logger[_0x923d('0x57')](_0x923d('0x58'),_0x1d880a);throw _0x1d880a;});}return _0x2a89d1;})[_0x923d('0x2a')](respondWithResult(_0x2b3570,0xc9))[_0x923d('0x4c')](handleError(_0x2b3570,null));};exports[_0x923d('0x29')]=function(_0x114c38,_0x45d9cd){if(_0x114c38[_0x923d('0x59')]['id']){delete _0x114c38['body']['id'];}return db['SmsQueue'][_0x923d('0x50')]({'where':{'id':_0x114c38[_0x923d('0x4e')]['id']}})[_0x923d('0x2a')](handleEntityNotFound(_0x45d9cd,null))['then'](saveUpdates(_0x114c38['body'],null))[_0x923d('0x2a')](respondWithResult(_0x45d9cd,null))[_0x923d('0x4c')](handleError(_0x45d9cd,null));};exports['destroy']=function(_0xcbc0c1,_0x218355){return db[_0x923d('0x33')][_0x923d('0x50')]({'where':{'id':_0xcbc0c1['params']['id']}})['then'](handleEntityNotFound(_0x218355,null))['then'](removeEntity(_0x218355,null))[_0x923d('0x4c')](handleError(_0x218355,null));};exports[_0x923d('0x5a')]=function(_0x4055fb,_0x148184){return db[_0x923d('0x33')]['describe']()[_0x923d('0x2a')](respondWithResult(_0x148184,null))[_0x923d('0x4c')](handleError(_0x148184,null));};exports[_0x923d('0x5b')]=function(_0xc0e386,_0x2cddd2,_0x3edfe7){var _0x2ebd7d={'raw':!![],'where':{}},_0x35a3a6={},_0x5526d3;return db['SmsQueue'][_0x923d('0x5c')]({'where':{'id':_0xc0e386[_0x923d('0x4e')]['id']}})[_0x923d('0x2a')](handleEntityNotFound(_0x2cddd2,null))[_0x923d('0x2a')](function(_0x3f2c5e){if(_0x3f2c5e){_0x5526d3=_0x3f2c5e['get']({'plain':!![]});_0x35a3a6['model']=_[_0x923d('0x38')](db['UserSmsQueue'][_0x923d('0x34')]);_0x35a3a6[_0x923d('0x3b')]=_[_0x923d('0x38')](_0xc0e386['query']);_0x35a3a6[_0x923d('0x43')]=_[_0x923d('0x39')](_0x35a3a6['model'],_0x35a3a6[_0x923d('0x3b')]);_0x2ebd7d[_0x923d('0x3c')]=_[_0x923d('0x39')](_0x35a3a6[_0x923d('0x3a')],qs[_0x923d('0x3d')](_0xc0e386[_0x923d('0x3b')][_0x923d('0x3d')]));_0x2ebd7d[_0x923d('0x3c')]=_0x2ebd7d[_0x923d('0x3c')][_0x923d('0x5d')]?_0x2ebd7d[_0x923d('0x3c')]:_0x35a3a6['model'];if(!_0xc0e386['query'][_0x923d('0x3e')](_0x923d('0x3f'))){_0x2ebd7d[_0x923d('0x21')]=qs[_0x923d('0x21')](_0xc0e386[_0x923d('0x3b')]['limit']);_0x2ebd7d['offset']=qs['offset'](_0xc0e386['query'][_0x923d('0x20')]);}_0x2ebd7d['order']=qs[_0x923d('0x41')](_0xc0e386[_0x923d('0x3b')][_0x923d('0x41')]);_0x2ebd7d[_0x923d('0x42')]=qs[_0x923d('0x43')](_[_0x923d('0x44')](_0xc0e386[_0x923d('0x3b')],_0x35a3a6[_0x923d('0x43')]));_0x2ebd7d[_0x923d('0x42')]['SmsQueueId']=_0x3f2c5e['id'];if(_0xc0e386[_0x923d('0x3b')][_0x923d('0x45')]){_0x2ebd7d[_0x923d('0x42')]=_[_0x923d('0x46')](_0x2ebd7d[_0x923d('0x42')],{'$or':_[_0x923d('0x32')](_0x2ebd7d['attributes'],function(_0x157d4d){var _0x29946b={};_0x29946b[_0x157d4d]={'$like':'%'+_0xc0e386[_0x923d('0x3b')]['filter']+'%'};return _0x29946b;})});}_0x2ebd7d=_['merge']({},_0x2ebd7d,_0xc0e386[_0x923d('0x48')]);return db['UserSmsQueue'][_0x923d('0x4a')](_0x2ebd7d);}})[_0x923d('0x2a')](function(_0x3eedda){if(_0x3eedda){return db[_0x923d('0x5e')]['findAndCountAll']({'where':{'id':_[_0x923d('0x32')](_0x3eedda,'UserId'),'role':_0x923d('0x5f')},'attributes':['id',_0x923d('0x2f'),_0x923d('0x60'),_0x923d('0x61'),'createdAt']});}})[_0x923d('0x2a')](function(_0x7e5c77){if(_0x7e5c77){return{'count':_0x7e5c77[_0x923d('0x23')],'rows':_[_0x923d('0x32')](_0x7e5c77[_0x923d('0x4b')],function(_0x1bfed3){return{'membername':_0x1bfed3[_0x923d('0x2f')],'UserId':_0x1bfed3['id'],'queue_name':_0x5526d3['name'],'SmsQueueId':_0x5526d3['id'],'interface':util[_0x923d('0x62')](_0x923d('0x63'),_0x923d('0x64'),_0x1bfed3[_0x923d('0x2f')]),'penalty':0x0,'paused':_0x1bfed3[_0x923d('0x60')],'createdAt':_0x1bfed3['createdAt'],'updatedAt':_0x1bfed3[_0x923d('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x923d('0x2a')](respondWithFilteredResult(_0x2cddd2,_0x2ebd7d))[_0x923d('0x4c')](handleError(_0x2cddd2,null));};exports[_0x923d('0x65')]=function(_0x6af06a,_0x4dc006,_0x401876){var _0x40668c={};var _0x5e31ba={};var _0x3840b6;var _0x1492ae;return db[_0x923d('0x33')]['findOne']({'where':{'id':_0x6af06a['params']['id']}})[_0x923d('0x2a')](handleEntityNotFound(_0x4dc006,null))[_0x923d('0x2a')](function(_0x4e22c6){if(_0x4e22c6){_0x3840b6=_0x4e22c6;_0x5e31ba['model']=_[_0x923d('0x38')](db['Team'][_0x923d('0x34')]);_0x5e31ba[_0x923d('0x3b')]=_[_0x923d('0x38')](_0x6af06a[_0x923d('0x3b')]);_0x5e31ba[_0x923d('0x43')]=_[_0x923d('0x39')](_0x5e31ba['model'],_0x5e31ba[_0x923d('0x3b')]);_0x40668c[_0x923d('0x3c')]=_['intersection'](_0x5e31ba['model'],qs[_0x923d('0x3d')](_0x6af06a[_0x923d('0x3b')][_0x923d('0x3d')]));_0x40668c[_0x923d('0x3c')]=_0x40668c[_0x923d('0x3c')][_0x923d('0x5d')]?_0x40668c['attributes']:_0x5e31ba['model'];_0x40668c[_0x923d('0x40')]=qs[_0x923d('0x41')](_0x6af06a[_0x923d('0x3b')][_0x923d('0x41')]);_0x40668c[_0x923d('0x42')]=qs[_0x923d('0x43')](_['pick'](_0x6af06a[_0x923d('0x3b')],_0x5e31ba[_0x923d('0x43')]));if(_0x6af06a[_0x923d('0x3b')][_0x923d('0x45')]){_0x40668c[_0x923d('0x42')]=_[_0x923d('0x46')](_0x40668c[_0x923d('0x42')],{'$or':_[_0x923d('0x32')](_0x40668c[_0x923d('0x3c')],function(_0x1928e2){var _0x372ff1={};_0x372ff1[_0x1928e2]={'$like':'%'+_0x6af06a['query'][_0x923d('0x45')]+'%'};return _0x372ff1;})});}_0x40668c=_[_0x923d('0x46')]({},_0x40668c,_0x6af06a['options']);return _0x3840b6[_0x923d('0x65')](_0x40668c);}})[_0x923d('0x2a')](function(_0x31e2f2){if(_0x31e2f2){_0x1492ae=_0x31e2f2[_0x923d('0x5d')];if(!_0x6af06a[_0x923d('0x3b')][_0x923d('0x3e')](_0x923d('0x3f'))){_0x40668c[_0x923d('0x21')]=qs['limit'](_0x6af06a['query'][_0x923d('0x21')]);_0x40668c['offset']=qs[_0x923d('0x20')](_0x6af06a['query']['offset']);}return _0x3840b6['getTeams'](_0x40668c);}})[_0x923d('0x2a')](function(_0x480a7a){if(_0x480a7a){return _0x480a7a?{'count':_0x1492ae,'rows':_0x480a7a}:null;}})[_0x923d('0x2a')](respondWithResult(_0x4dc006,null))[_0x923d('0x4c')](handleError(_0x4dc006,null));};exports[_0x923d('0x66')]=function(_0x40760c,_0x1fe989,_0x5d6788){var _0x4d6c83=_0x40760c[_0x923d('0x59')][_0x923d('0x67')];return db[_0x923d('0x68')][_0x923d('0x4a')]({'where':{'id':_0x4d6c83},'attributes':['id'],'include':[{'model':db['User'],'as':_0x923d('0x69'),'attributes':['id',_0x923d('0x2f'),_0x923d('0x6a'),_0x923d('0x6b'),_0x923d('0x6c')],'raw':!![]}]})[_0x923d('0x2a')](function(_0x1ab4e0){if(_0x1ab4e0){var _0x2d0997=_[_0x923d('0x6d')](_0x1ab4e0,function(_0x3c77b5){var _0x36aa18=_0x3c77b5['get']({'plain':!![]});return _0x36aa18['Agents'];});return db[_0x923d('0x33')][_0x923d('0x50')]({'where':{'id':_0x40760c['params']['id']}})[_0x923d('0x2a')](function(_0x465016){return db[_0x923d('0x6e')]['transaction'](function(_0x2d0d3d){return _0x465016[_0x923d('0x66')](_0x4d6c83,{'transaction':_0x2d0d3d})[_0x923d('0x2a')](function(){return BPromise['each'](_0x2d0997,function(_0x39f32a){return db[_0x923d('0x6f')][_0x923d('0x70')]({'where':{'UserId':_0x39f32a['id'],'SmsQueueId':_0x40760c[_0x923d('0x4e')]['id']},'transaction':_0x2d0d3d});});})['then'](function(){_0x2d0997[_0x923d('0x71')](function(_0x137497){socket[_0x923d('0x72')](_0x923d('0x73'),{'UserId':_0x137497['id'],'SmsQueueId':_0x465016['id']});});});});});}})[_0x923d('0x2a')](respondWithStatusCode(_0x1fe989,null))['catch'](handleError(_0x1fe989,null));};exports[_0x923d('0x74')]=function(_0x2749ec,_0x5ee6d1,_0x5ea6b7){return db['Team'][_0x923d('0x4a')]({'where':{'id':_0x2749ec['query'][_0x923d('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x923d('0x2a')](handleEntityNotFound(_0x5ee6d1,null))[_0x923d('0x2a')](function(_0x297710){var _0x2c6ce=_['map'](_0x297710,'id');var _0x203b0b=[];var _0x2cf5fb=[];var _0x1e4190=squel[_0x923d('0x75')]();_0x1e4190[_0x923d('0x76')]('tq.TeamId')[_0x923d('0x77')](_0x923d('0x78'),'tq')[_0x923d('0x79')](_0x923d('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x923d('0x42')]('SmsQueueId\x20=\x20?',_0x2749ec['params']['id']);for(var _0x826e52=0x0;_0x826e52<_0x297710[_0x923d('0x5d')];_0x826e52+=0x1){let _0x36504e=_0x297710[_0x826e52];for(var _0x416405=0x0;_0x416405<_0x36504e[_0x923d('0x69')][_0x923d('0x5d')];_0x416405+=0x1){let _0x4fbd60=_0x36504e[_0x923d('0x69')][_0x416405];var _0x2b4481=_0x1e4190[_0x923d('0x7b')]();_0x2b4481['where']('ut.UserId\x20=\x20?',_0x4fbd60['id']);_0x2cf5fb[_0x923d('0x7c')](db[_0x923d('0x6e')][_0x923d('0x3b')](_0x2b4481[_0x923d('0x7d')](),{'type':db[_0x923d('0x6e')][_0x923d('0x7e')]['SELECT']})[_0x923d('0x2a')](function(_0x4ce846){if(_0x4ce846[_0x923d('0x5d')]===0x1){return _0x4fbd60['id'];}else{var _0x17aa66=_[_0x923d('0x7f')](_[_0x923d('0x32')](_0x4ce846,_0x923d('0x80')),function(_0x286435){return _[_0x923d('0x81')](_0x2c6ce,_0x286435);});if(_0x17aa66){return _0x4fbd60['id'];}}}));}}return BPromise[_0x923d('0x82')](_0x2cf5fb)[_0x923d('0x2a')](function(_0xdb9f60){_0x203b0b=_(_0x203b0b)['union'](_0xdb9f60)[_0x923d('0x83')]()[_0x923d('0x84')]();return db[_0x923d('0x33')][_0x923d('0x50')]({'where':{'id':_0x2749ec[_0x923d('0x4e')]['id']}})['then'](function(_0x424461){return db[_0x923d('0x6e')][_0x923d('0x85')](function(_0x2cf656){return _0x424461['removeTeams'](_0x2749ec[_0x923d('0x3b')]['ids'],{'transaction':_0x2cf656})[_0x923d('0x2a')](function(){if(!_['isEmpty'](_0x203b0b)){return _0x424461[_0x923d('0x86')](_0x203b0b,{'transaction':_0x2cf656});}})[_0x923d('0x2a')](function(){_0x203b0b[_0x923d('0x71')](function(_0x1c807a){socket['emit'](_0x923d('0x87'),{'UserId':_0x1c807a,'SmsQueueId':_0x424461['id']});});});});});});})[_0x923d('0x2a')](respondWithStatusCode(_0x5ee6d1,null))[_0x923d('0x4c')](handleError(_0x5ee6d1,null));};exports[_0x923d('0x88')]=function(_0x4b7f1a,_0x32440f,_0x30c55f){return db['SmsQueue']['find']({'where':{'id':_0x4b7f1a[_0x923d('0x4e')]['id']}})[_0x923d('0x2a')](handleEntityNotFound(_0x32440f,null))[_0x923d('0x2a')](function(_0xb8963e){if(_0xb8963e){return _0xb8963e[_0x923d('0x88')](_0x4b7f1a[_0x923d('0x59')]['ids'],_[_0x923d('0x89')](_0x4b7f1a['body'],[_0x923d('0x67'),'id'])||{})[_0x923d('0x8a')](function(_0x517ec5){for(var _0xfe0832=0x0;_0xfe0832<_0x4b7f1a['body']['ids'][_0x923d('0x5d')];_0xfe0832+=0x1){socket[_0x923d('0x72')](_0x923d('0x73'),{'UserId':_0x4b7f1a[_0x923d('0x59')][_0x923d('0x67')][_0xfe0832],'SmsQueueId':_0x4b7f1a[_0x923d('0x4e')]['id']});}return _0x517ec5;});}})[_0x923d('0x2a')](respondWithResult(_0x32440f,null))[_0x923d('0x4c')](handleError(_0x32440f,null));};exports[_0x923d('0x86')]=function(_0xdfe65c,_0xd607d8,_0x3fbef1){return db[_0x923d('0x33')][_0x923d('0x50')]({'where':{'id':_0xdfe65c[_0x923d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd607d8,null))[_0x923d('0x2a')](function(_0x8430){if(_0x8430){return _0x8430[_0x923d('0x86')](_0xdfe65c[_0x923d('0x3b')][_0x923d('0x67')])[_0x923d('0x2a')](function(){if(_[_0x923d('0x8b')](_0xdfe65c[_0x923d('0x3b')][_0x923d('0x67')])){for(var _0x5555b4=0x0;_0x5555b4<_0xdfe65c[_0x923d('0x3b')]['ids'][_0x923d('0x5d')];_0x5555b4+=0x1){socket['emit'](_0x923d('0x87'),{'UserId':Number(_0xdfe65c[_0x923d('0x3b')][_0x923d('0x67')][_0x5555b4]),'SmsQueueId':Number(_0xdfe65c['params']['id'])});}}else{socket['emit'](_0x923d('0x87'),{'UserId':Number(_0xdfe65c[_0x923d('0x3b')]['ids']),'SmsQueueId':Number(_0xdfe65c[_0x923d('0x4e')]['id'])});}});}})[_0x923d('0x2a')](respondWithStatusCode(_0xd607d8,null))[_0x923d('0x4c')](handleError(_0xd607d8,null));};exports[_0x923d('0x8c')]=function(_0x19f437,_0x3a439c,_0x52f84f){var _0x248d0f={};var _0x264aaf={};var _0x5cf3e9;var _0x57ef99;return db['SmsQueue'][_0x923d('0x5c')]({'where':{'id':_0x19f437[_0x923d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a439c,null))[_0x923d('0x2a')](function(_0x226b2b){if(_0x226b2b){_0x5cf3e9=_0x226b2b;_0x264aaf['model']=_[_0x923d('0x38')](db[_0x923d('0x5e')][_0x923d('0x34')]);_0x264aaf[_0x923d('0x3b')]=_[_0x923d('0x38')](_0x19f437['query']);_0x264aaf[_0x923d('0x43')]=_[_0x923d('0x39')](_0x264aaf['model'],_0x264aaf[_0x923d('0x3b')]);_0x248d0f[_0x923d('0x3c')]=_['intersection'](_0x264aaf[_0x923d('0x3a')],qs[_0x923d('0x3d')](_0x19f437['query'][_0x923d('0x3d')]));_0x248d0f[_0x923d('0x3c')]=_0x248d0f[_0x923d('0x3c')][_0x923d('0x5d')]?_0x248d0f[_0x923d('0x3c')]:_0x264aaf['model'];_0x248d0f[_0x923d('0x40')]=qs[_0x923d('0x41')](_0x19f437[_0x923d('0x3b')][_0x923d('0x41')]);_0x248d0f[_0x923d('0x42')]=qs[_0x923d('0x43')](_[_0x923d('0x44')](_0x19f437[_0x923d('0x3b')],_0x264aaf[_0x923d('0x43')]));if(_0x19f437[_0x923d('0x3b')]['filter']){_0x248d0f[_0x923d('0x42')]=_['merge'](_0x248d0f[_0x923d('0x42')],{'$or':_['map'](_0x248d0f[_0x923d('0x3c')],function(_0x3c019b){var _0xfeec89={};_0xfeec89[_0x3c019b]={'$like':'%'+_0x19f437[_0x923d('0x3b')][_0x923d('0x45')]+'%'};return _0xfeec89;})});}_0x248d0f=_[_0x923d('0x46')]({},_0x248d0f,_0x19f437[_0x923d('0x48')]);return _0x5cf3e9[_0x923d('0x8c')](_0x248d0f);}})[_0x923d('0x2a')](function(_0x556f4b){if(_0x556f4b){_0x57ef99=_0x556f4b[_0x923d('0x5d')];if(!_0x19f437['query'][_0x923d('0x3e')](_0x923d('0x3f'))){_0x248d0f[_0x923d('0x21')]=qs[_0x923d('0x21')](_0x19f437[_0x923d('0x3b')][_0x923d('0x21')]);_0x248d0f[_0x923d('0x20')]=qs['offset'](_0x19f437[_0x923d('0x3b')][_0x923d('0x20')]);}return _0x5cf3e9['getAgents'](_0x248d0f);}})[_0x923d('0x2a')](function(_0x11be11){if(_0x11be11){return _0x11be11?{'count':_0x57ef99,'rows':_0x11be11}:null;}})[_0x923d('0x2a')](respondWithResult(_0x3a439c,null))[_0x923d('0x4c')](handleError(_0x3a439c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 0e5d969..81406d5 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 _0xebec=['update','remove','emit','hasOwnProperty','hook','SmsQueue','save'];(function(_0x128cea,_0x615e4b){var _0x358597=function(_0x561acb){while(--_0x561acb){_0x128cea['push'](_0x128cea['shift']());}};_0x358597(++_0x615e4b);}(_0xebec,0xc2));var _0xcebe=function(_0x5880d4,_0x58c5e9){_0x5880d4=_0x5880d4-0x0;var _0x2d41c4=_0xebec[_0x5880d4];return _0x2d41c4;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0xcebe('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcebe('0x1'),'afterUpdate':_0xcebe('0x2'),'afterDestroy':_0xcebe('0x3')};function emitEvent(_0x97c16){return function(_0x494ac3,_0xf75577,_0x4da0ea){SmsQueueEvents[_0xcebe('0x4')](_0x97c16+':'+_0x494ac3['id'],_0x494ac3);SmsQueueEvents[_0xcebe('0x4')](_0x97c16,_0x494ac3);_0x4da0ea(null);};}for(var e in events){if(events[_0xcebe('0x5')](e)){var event=events[e];SmsQueue[_0xcebe('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x94db=['save','remove','emit','hasOwnProperty','hook','exports','events','SmsQueue'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0x94db,0xd6));var _0xb94d=function(_0x469a79,_0x36e076){_0x469a79=_0x469a79-0x0;var _0x17b5fe=_0x94db[_0x469a79];return _0x17b5fe;};'use strict';var EventEmitter=require(_0xb94d('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xb94d('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb94d('0x2'),'afterUpdate':'update','afterDestroy':_0xb94d('0x3')};function emitEvent(_0x21782a){return function(_0xbfbd52,_0x3637ab,_0x3e0b8b){SmsQueueEvents[_0xb94d('0x4')](_0x21782a+':'+_0xbfbd52['id'],_0xbfbd52);SmsQueueEvents[_0xb94d('0x4')](_0x21782a,_0xbfbd52);_0x3e0b8b(null);};}for(var e in events){if(events[_0xb94d('0x5')](e)){var event=events[e];SmsQueue[_0xb94d('0x6')](e,emitEvent(event));}}module[_0xb94d('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 46fdd4b..e241167 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 _0xa3cf=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash'];(function(_0x45e21a,_0x384a52){var _0x3b021e=function(_0x4a6708){while(--_0x4a6708){_0x45e21a['push'](_0x45e21a['shift']());}};_0x3b021e(++_0x384a52);}(_0xa3cf,0xc5));var _0xfa3c=function(_0x228295,_0x57d2ec){_0x228295=_0x228295-0x0;var _0x1a8da0=_0xa3cf[_0x228295];return _0x1a8da0;};'use strict';var _=require(_0xfa3c('0x0'));var util=require(_0xfa3c('0x1'));var logger=require(_0xfa3c('0x2'))('api');var moment=require(_0xfa3c('0x3'));var BPromise=require(_0xfa3c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfa3c('0x5'));var config=require(_0xfa3c('0x6'));var attributes=require(_0xfa3c('0x7'));module[_0xfa3c('0x8')]=function(_0x30519f,_0x345423){return _0x30519f[_0xfa3c('0x9')](_0xfa3c('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f9c=['exports','SmsQueue','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x52ea91,_0x1dfb06){var _0x1fced0=function(_0x58bbee){while(--_0x58bbee){_0x52ea91['push'](_0x52ea91['shift']());}};_0x1fced0(++_0x1dfb06);}(_0x3f9c,0x1bb));var _0xc3f9=function(_0x3060f7,_0x4f3224){_0x3060f7=_0x3060f7-0x0;var _0x381042=_0x3f9c[_0x3060f7];return _0x381042;};'use strict';var _=require(_0xc3f9('0x0'));var util=require('util');var logger=require(_0xc3f9('0x1'))(_0xc3f9('0x2'));var moment=require('moment');var BPromise=require(_0xc3f9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc3f9('0x4'));var config=require(_0xc3f9('0x5'));var attributes=require(_0xc3f9('0x6'));module[_0xc3f9('0x7')]=function(_0x33a2f7,_0x4c11f6){return _0x33a2f7['define'](_0xc3f9('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 1a21e58..37c1e42 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 _0xff1a=['jayson/promise','http','redis','localhost','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','map','ShowSmsQueue','find','model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff1a,0x13d));var _0xaff1=function(_0x4ec099,_0x27e8cc){_0x4ec099=_0x4ec099-0x0;var _0x47d097=_0xff1a[_0x4ec099];return _0x47d097;};'use strict';var _=require(_0xaff1('0x0'));var util=require(_0xaff1('0x1'));var moment=require('moment');var BPromise=require(_0xaff1('0x2'));var rs=require(_0xaff1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaff1('0x4'))['db'];var utils=require(_0xaff1('0x5'));var logger=require(_0xaff1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaff1('0x7'));var client=jayson['client'][_0xaff1('0x8')]({'port':0x232a});config[_0xaff1('0x9')]=_['defaults'](config[_0xaff1('0x9')],{'host':_0xaff1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaff1('0x9')]));require(_0xaff1('0xb'))['register'](socket);function respondWithRpcPromise(_0x438ab4,_0x1ab260,_0x132f0c){return new BPromise(function(_0x381340,_0x167f46){return client[_0xaff1('0xc')](_0x438ab4,_0x132f0c)[_0xaff1('0xd')](function(_0x17cbb1){logger[_0xaff1('0xe')](_0xaff1('0xf'),_0x1ab260,_0xaff1('0x10'));logger[_0xaff1('0x11')](_0xaff1('0x12'),_0x1ab260,'request\x20sent',JSON[_0xaff1('0x13')](_0x17cbb1));if(_0x17cbb1[_0xaff1('0x14')]){if(_0x17cbb1['error']['code']===0x1f4){logger[_0xaff1('0x14')](_0xaff1('0xf'),_0x1ab260,_0x17cbb1[_0xaff1('0x14')]['message']);return _0x167f46(_0x17cbb1[_0xaff1('0x14')]['message']);}logger[_0xaff1('0x14')](_0xaff1('0xf'),_0x1ab260,_0x17cbb1[_0xaff1('0x14')][_0xaff1('0x15')]);return _0x381340(_0x17cbb1['error'][_0xaff1('0x15')]);}else{logger[_0xaff1('0xe')](_0xaff1('0xf'),_0x1ab260,_0xaff1('0x10'));_0x381340(_0x17cbb1[_0xaff1('0x16')][_0xaff1('0x15')]);}})[_0xaff1('0x17')](function(_0xec0a85){logger[_0xaff1('0x14')](_0xaff1('0xf'),_0x1ab260,_0xec0a85);_0x167f46(_0xec0a85);});});}exports[_0xaff1('0x18')]=function(_0x3b67c5){var _0x59ec96=this;return new Promise(function(_0x300a0,_0x5bc558){return db[_0xaff1('0x19')][_0xaff1('0x1a')]({'raw':_0x3b67c5['options']?_0x3b67c5[_0xaff1('0x1b')][_0xaff1('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b67c5[_0xaff1('0x1b')]?_0x3b67c5['options'][_0xaff1('0x1d')]||null:null,'attributes':_0x3b67c5['options']?_0x3b67c5['options'][_0xaff1('0x1e')]||null:null,'limit':_0x3b67c5[_0xaff1('0x1b')]?_0x3b67c5[_0xaff1('0x1b')]['limit']||null:null,'include':_0x3b67c5[_0xaff1('0x1b')]?_0x3b67c5[_0xaff1('0x1b')][_0xaff1('0x1f')]?_[_0xaff1('0x20')](_0x3b67c5[_0xaff1('0x1b')][_0xaff1('0x1f')],function(_0x11db90){return{'model':db[_0x11db90['model']],'as':_0x11db90['as'],'attributes':_0x11db90[_0xaff1('0x1e')],'include':_0x11db90[_0xaff1('0x1f')]?_[_0xaff1('0x20')](_0x11db90[_0xaff1('0x1f')],function(_0x5b8e5d){return{'model':db[_0x5b8e5d['model']],'as':_0x5b8e5d['as'],'attributes':_0x5b8e5d['attributes'],'include':_0x5b8e5d[_0xaff1('0x1f')]?_[_0xaff1('0x20')](_0x5b8e5d[_0xaff1('0x1f')],function(_0x53ed93){return{'model':db[_0x53ed93['model']],'as':_0x53ed93['as'],'attributes':_0x53ed93[_0xaff1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaff1('0xd')](function(_0x258809){logger[_0xaff1('0xe')]('GetSmsQueue',_0x3b67c5);logger['debug']('GetSmsQueue',_0x3b67c5,JSON['stringify'](_0x258809));_0x300a0(_0x258809);})[_0xaff1('0x17')](function(_0x30c0df){logger[_0xaff1('0x14')](_0xaff1('0x18'),_0x30c0df[_0xaff1('0x15')],_0x3b67c5);_0x5bc558(_0x59ec96[_0xaff1('0x14')](0x1f4,_0x30c0df[_0xaff1('0x15')]));});});};exports[_0xaff1('0x21')]=function(_0x5c02ef){var _0x585bc3=this;return new Promise(function(_0x2cc209,_0x3d2533){return db[_0xaff1('0x19')][_0xaff1('0x22')]({'raw':_0x5c02ef[_0xaff1('0x1b')]?_0x5c02ef[_0xaff1('0x1b')][_0xaff1('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c02ef[_0xaff1('0x1b')]?_0x5c02ef[_0xaff1('0x1b')][_0xaff1('0x1d')]||null:null,'attributes':_0x5c02ef[_0xaff1('0x1b')]?_0x5c02ef[_0xaff1('0x1b')]['attributes']||null:null,'include':_0x5c02ef[_0xaff1('0x1b')]?_0x5c02ef[_0xaff1('0x1b')][_0xaff1('0x1f')]?_[_0xaff1('0x20')](_0x5c02ef['options']['include'],function(_0x32e52b){return{'model':db[_0x32e52b[_0xaff1('0x23')]],'as':_0x32e52b['as'],'attributes':_0x32e52b['attributes'],'include':_0x32e52b[_0xaff1('0x1f')]?_[_0xaff1('0x20')](_0x32e52b[_0xaff1('0x1f')],function(_0x5329b6){return{'model':db[_0x5329b6[_0xaff1('0x23')]],'as':_0x5329b6['as'],'attributes':_0x5329b6['attributes'],'include':_0x5329b6['include']?_[_0xaff1('0x20')](_0x5329b6[_0xaff1('0x1f')],function(_0x1a62be){return{'model':db[_0x1a62be[_0xaff1('0x23')]],'as':_0x1a62be['as'],'attributes':_0x1a62be[_0xaff1('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x222a3d){logger[_0xaff1('0xe')](_0xaff1('0x21'),_0x5c02ef);logger['debug'](_0xaff1('0x21'),_0x5c02ef,JSON[_0xaff1('0x13')](_0x222a3d));_0x2cc209(_0x222a3d);})[_0xaff1('0x17')](function(_0x536a83){logger[_0xaff1('0x14')](_0xaff1('0x21'),_0x536a83['message'],_0x5c02ef);_0x3d2533(_0x585bc3[_0xaff1('0x14')](0x1f4,_0x536a83[_0xaff1('0x15')]));});});}; \ No newline at end of file +var _0xb994=['catch','GetSmsQueue','SmsQueue','options','raw','attributes','limit','include','map','model','then','ShowSmsQueue','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x1f6f98,_0x140cf8){var _0xd2e973=function(_0x402809){while(--_0x402809){_0x1f6f98['push'](_0x1f6f98['shift']());}};_0xd2e973(++_0x140cf8);}(_0xb994,0xfd));var _0x4b99=function(_0x3ab193,_0x51dc97){_0x3ab193=_0x3ab193-0x0;var _0x285833=_0xb994[_0x3ab193];return _0x285833;};'use strict';var _=require(_0x4b99('0x0'));var util=require(_0x4b99('0x1'));var moment=require(_0x4b99('0x2'));var BPromise=require(_0x4b99('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b99('0x4'));var db=require(_0x4b99('0x5'))['db'];var utils=require(_0x4b99('0x6'));var logger=require(_0x4b99('0x7'))(_0x4b99('0x8'));var config=require(_0x4b99('0x9'));var jayson=require(_0x4b99('0xa'));var client=jayson[_0x4b99('0xb')][_0x4b99('0xc')]({'port':0x232a});config['redis']=_[_0x4b99('0xd')](config[_0x4b99('0xe')],{'host':_0x4b99('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x4b99('0x10')](socket);function respondWithRpcPromise(_0x51f7d3,_0x232f1f,_0x204a56){return new BPromise(function(_0x33fc6e,_0x468969){return client[_0x4b99('0x11')](_0x51f7d3,_0x204a56)['then'](function(_0x67d601){logger[_0x4b99('0x12')](_0x4b99('0x13'),_0x232f1f,_0x4b99('0x14'));logger[_0x4b99('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x232f1f,_0x4b99('0x14'),JSON[_0x4b99('0x16')](_0x67d601));if(_0x67d601['error']){if(_0x67d601[_0x4b99('0x17')][_0x4b99('0x18')]===0x1f4){logger[_0x4b99('0x17')](_0x4b99('0x13'),_0x232f1f,_0x67d601[_0x4b99('0x17')]['message']);return _0x468969(_0x67d601[_0x4b99('0x17')]['message']);}logger[_0x4b99('0x17')](_0x4b99('0x13'),_0x232f1f,_0x67d601['error']['message']);return _0x33fc6e(_0x67d601['error'][_0x4b99('0x19')]);}else{logger[_0x4b99('0x12')]('SmsQueue,\x20%s,\x20%s',_0x232f1f,_0x4b99('0x14'));_0x33fc6e(_0x67d601[_0x4b99('0x1a')]['message']);}})[_0x4b99('0x1b')](function(_0x6cc2f9){logger[_0x4b99('0x17')]('SmsQueue,\x20%s,\x20%s',_0x232f1f,_0x6cc2f9);_0x468969(_0x6cc2f9);});});}exports[_0x4b99('0x1c')]=function(_0x3005c7){var _0x4c3a98=this;return new Promise(function(_0x2dcf95,_0x4403a1){return db[_0x4b99('0x1d')]['findAll']({'raw':_0x3005c7[_0x4b99('0x1e')]?_0x3005c7[_0x4b99('0x1e')][_0x4b99('0x1f')]===undefined?!![]:![]:!![],'where':_0x3005c7['options']?_0x3005c7[_0x4b99('0x1e')]['where']||null:null,'attributes':_0x3005c7[_0x4b99('0x1e')]?_0x3005c7[_0x4b99('0x1e')][_0x4b99('0x20')]||null:null,'limit':_0x3005c7[_0x4b99('0x1e')]?_0x3005c7[_0x4b99('0x1e')][_0x4b99('0x21')]||null:null,'include':_0x3005c7[_0x4b99('0x1e')]?_0x3005c7[_0x4b99('0x1e')][_0x4b99('0x22')]?_[_0x4b99('0x23')](_0x3005c7[_0x4b99('0x1e')][_0x4b99('0x22')],function(_0x1e804f){return{'model':db[_0x1e804f['model']],'as':_0x1e804f['as'],'attributes':_0x1e804f[_0x4b99('0x20')],'include':_0x1e804f[_0x4b99('0x22')]?_['map'](_0x1e804f[_0x4b99('0x22')],function(_0x144afa){return{'model':db[_0x144afa[_0x4b99('0x24')]],'as':_0x144afa['as'],'attributes':_0x144afa[_0x4b99('0x20')],'include':_0x144afa['include']?_[_0x4b99('0x23')](_0x144afa[_0x4b99('0x22')],function(_0x2d8afb){return{'model':db[_0x2d8afb[_0x4b99('0x24')]],'as':_0x2d8afb['as'],'attributes':_0x2d8afb[_0x4b99('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4b99('0x25')](function(_0x333782){logger[_0x4b99('0x12')](_0x4b99('0x1c'),_0x3005c7);logger[_0x4b99('0x15')](_0x4b99('0x1c'),_0x3005c7,JSON[_0x4b99('0x16')](_0x333782));_0x2dcf95(_0x333782);})[_0x4b99('0x1b')](function(_0x1e90b4){logger[_0x4b99('0x17')](_0x4b99('0x1c'),_0x1e90b4[_0x4b99('0x19')],_0x3005c7);_0x4403a1(_0x4c3a98['error'](0x1f4,_0x1e90b4['message']));});});};exports[_0x4b99('0x26')]=function(_0x111acc){var _0x377687=this;return new Promise(function(_0x2befc7,_0x494be2){return db['SmsQueue']['find']({'raw':_0x111acc[_0x4b99('0x1e')]?_0x111acc['options']['raw']===undefined?!![]:![]:!![],'where':_0x111acc['options']?_0x111acc[_0x4b99('0x1e')][_0x4b99('0x27')]||null:null,'attributes':_0x111acc['options']?_0x111acc[_0x4b99('0x1e')]['attributes']||null:null,'include':_0x111acc[_0x4b99('0x1e')]?_0x111acc[_0x4b99('0x1e')]['include']?_['map'](_0x111acc[_0x4b99('0x1e')]['include'],function(_0x2b9556){return{'model':db[_0x2b9556[_0x4b99('0x24')]],'as':_0x2b9556['as'],'attributes':_0x2b9556[_0x4b99('0x20')],'include':_0x2b9556[_0x4b99('0x22')]?_[_0x4b99('0x23')](_0x2b9556[_0x4b99('0x22')],function(_0x2e323e){return{'model':db[_0x2e323e['model']],'as':_0x2e323e['as'],'attributes':_0x2e323e[_0x4b99('0x20')],'include':_0x2e323e[_0x4b99('0x22')]?_[_0x4b99('0x23')](_0x2e323e['include'],function(_0x17354b){return{'model':db[_0x17354b[_0x4b99('0x24')]],'as':_0x17354b['as'],'attributes':_0x17354b[_0x4b99('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4b99('0x25')](function(_0x34ec33){logger[_0x4b99('0x12')]('ShowSmsQueue',_0x111acc);logger['debug'](_0x4b99('0x26'),_0x111acc,JSON[_0x4b99('0x16')](_0x34ec33));_0x2befc7(_0x34ec33);})[_0x4b99('0x1b')](function(_0x37c8fb){logger[_0x4b99('0x17')](_0x4b99('0x26'),_0x37c8fb[_0x4b99('0x19')],_0x111acc);_0x494be2(_0x377687['error'](0x1f4,_0x37c8fb[_0x4b99('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index d13d597..f7e6c2a 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 _0xae79=['emit','removeListener','register','length','smsQueue:','save','update'];(function(_0x81972,_0x40e911){var _0x8608e8=function(_0x799332){while(--_0x799332){_0x81972['push'](_0x81972['shift']());}};_0x8608e8(++_0x40e911);}(_0xae79,0x1a2));var _0x9ae7=function(_0x2d4245,_0x556774){_0x2d4245=_0x2d4245-0x0;var _0x29f6d8=_0xae79[_0x2d4245];return _0x29f6d8;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x9ae7('0x0'),'remove',_0x9ae7('0x1')];function createListener(_0x4f6e94,_0x4be40e){return function(_0x4126bf){_0x4be40e[_0x9ae7('0x2')](_0x4f6e94,_0x4126bf);};}function removeListener(_0x5be6f7,_0x1f80e5){return function(){SmsQueueEvents[_0x9ae7('0x3')](_0x5be6f7,_0x1f80e5);};}exports[_0x9ae7('0x4')]=function(_0x4aecd8){for(var _0x4481e8=0x0,_0x346d77=events[_0x9ae7('0x5')];_0x4481e8<_0x346d77;_0x4481e8++){var _0x2abb28=events[_0x4481e8];var _0x6d7347=createListener(_0x9ae7('0x6')+_0x2abb28,_0x4aecd8);SmsQueueEvents['on'](_0x2abb28,_0x6d7347);}}; \ No newline at end of file +var _0x00d7=['register','length','smsQueue:','save','remove','update','emit'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x00d7,0x14c));var _0x700d=function(_0x3aa136,_0x5121e9){_0x3aa136=_0x3aa136-0x0;var _0x14220e=_0x00d7[_0x3aa136];return _0x14220e;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x700d('0x0'),_0x700d('0x1'),_0x700d('0x2')];function createListener(_0x2597fa,_0xa2edab){return function(_0x49f873){_0xa2edab[_0x700d('0x3')](_0x2597fa,_0x49f873);};}function removeListener(_0x7531d3,_0x34aaf1){return function(){SmsQueueEvents['removeListener'](_0x7531d3,_0x34aaf1);};}exports[_0x700d('0x4')]=function(_0x536e2e){for(var _0x7f63aa=0x0,_0x5c8c5d=events[_0x700d('0x5')];_0x7f63aa<_0x5c8c5d;_0x7f63aa++){var _0xf9b66=events[_0x7f63aa];var _0x342bf9=createListener(_0x700d('0x6')+_0xf9b66,_0x536e2e);SmsQueueEvents['on'](_0xf9b66,_0x342bf9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 229b46a..be7fd31 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 _0x506e=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','create'];(function(_0x1dc174,_0x501282){var _0x5b627c=function(_0xf40264){while(--_0xf40264){_0x1dc174['push'](_0x1dc174['shift']());}};_0x5b627c(++_0x501282);}(_0x506e,0x68));var _0xe506=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x506e[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xe506('0x0'));var util=require(_0xe506('0x1'));var path=require(_0xe506('0x2'));var timeout=require(_0xe506('0x3'));var express=require(_0xe506('0x4'));var router=express[_0xe506('0x5')]();var fs_extra=require(_0xe506('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe506('0x7'));var config=require(_0xe506('0x8'));var controller=require(_0xe506('0x9'));router[_0xe506('0xa')]('/',auth[_0xe506('0xb')](),controller[_0xe506('0xc')]);router[_0xe506('0xa')]('/describe',auth[_0xe506('0xb')](),controller[_0xe506('0xd')]);router[_0xe506('0xa')](_0xe506('0xe'),auth[_0xe506('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe506('0xf')]);router[_0xe506('0x10')]('/:id',auth[_0xe506('0xb')](),controller[_0xe506('0x11')]);router[_0xe506('0x12')]('/:id',auth[_0xe506('0xb')](),controller[_0xe506('0x13')]);module['exports']=router; \ No newline at end of file +var _0x231b=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated'];(function(_0x4b1d21,_0x5ce01f){var _0x281600=function(_0x1c8864){while(--_0x1c8864){_0x4b1d21['push'](_0x4b1d21['shift']());}};_0x281600(++_0x5ce01f);}(_0x231b,0x1bc));var _0xb231=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x231b[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0xb231('0x0'));var util=require('util');var path=require(_0xb231('0x1'));var timeout=require(_0xb231('0x2'));var express=require(_0xb231('0x3'));var router=express[_0xb231('0x4')]();var fs_extra=require(_0xb231('0x5'));var auth=require(_0xb231('0x6'));var interaction=require(_0xb231('0x7'));var config=require(_0xb231('0x8'));var controller=require(_0xb231('0x9'));router[_0xb231('0xa')]('/',auth[_0xb231('0xb')](),controller[_0xb231('0xc')]);router[_0xb231('0xa')](_0xb231('0xd'),auth[_0xb231('0xb')](),controller[_0xb231('0xe')]);router[_0xb231('0xa')](_0xb231('0xf'),auth['isAuthenticated'](),controller[_0xb231('0x10')]);router[_0xb231('0x11')]('/',auth['isAuthenticated'](),controller[_0xb231('0x12')]);router[_0xb231('0x13')](_0xb231('0xf'),auth[_0xb231('0xb')](),controller[_0xb231('0x14')]);router[_0xb231('0x15')](_0xb231('0xf'),auth[_0xb231('0xb')](),controller[_0xb231('0x16')]);module[_0xb231('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 96704d6..bf86e90 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 _0xe119=['sequelize','exports','STRING','DATE'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe119,0x10c));var _0x9e11=function(_0x3a86a7,_0x12ade0){_0x3a86a7=_0x3a86a7-0x0;var _0x19b1b6=_0xe119[_0x3a86a7];return _0x19b1b6;};'use strict';var moment=require('moment');var Sequelize=require(_0x9e11('0x0'));module[_0x9e11('0x1')]={'uniqueid':{'type':Sequelize[_0x9e11('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9e11('0x2')]},'joinAt':{'type':Sequelize[_0x9e11('0x3')]},'leaveAt':{'type':Sequelize[_0x9e11('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9e11('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca9f=['DATE','moment','sequelize','exports','STRING'];(function(_0x4aa7a9,_0xaed7f9){var _0x426bb8=function(_0x2ed029){while(--_0x2ed029){_0x4aa7a9['push'](_0x4aa7a9['shift']());}};_0x426bb8(++_0xaed7f9);}(_0xca9f,0xd8));var _0xfca9=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0xca9f[_0x5302fb];return _0x43e6a4;};'use strict';var moment=require(_0xfca9('0x0'));var Sequelize=require(_0xfca9('0x1'));module[_0xfca9('0x2')]={'uniqueid':{'type':Sequelize[_0xfca9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfca9('0x3')]},'joinAt':{'type':Sequelize[_0xfca9('0x4')]},'leaveAt':{'type':Sequelize[_0xfca9('0x4')]},'acceptAt':{'type':Sequelize[_0xfca9('0x4')]},'exitAt':{'type':Sequelize[_0xfca9('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 cd49081..038d8ea 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 _0xe713=['catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','set','Content-Range','json','save','then','destroy','error','stack','name','index','map','SmsQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','limit','offset','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','find'];(function(_0x481a0f,_0x37e86b){var _0x4cfb39=function(_0xa62b76){while(--_0xa62b76){_0x481a0f['push'](_0x481a0f['shift']());}};_0x4cfb39(++_0x37e86b);}(_0xe713,0x125));var _0x3e71=function(_0x1035eb,_0x4023d7){_0x1035eb=_0x1035eb-0x0;var _0x35a2db=_0xe713[_0x1035eb];return _0x35a2db;};'use strict';var emlformat=require(_0x3e71('0x0'));var rimraf=require(_0x3e71('0x1'));var zipdir=require(_0x3e71('0x2'));var jsonpatch=require(_0x3e71('0x3'));var rp=require(_0x3e71('0x4'));var moment=require('moment');var BPromise=require(_0x3e71('0x5'));var Mustache=require(_0x3e71('0x6'));var util=require(_0x3e71('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e71('0x8'));var fs=require('fs');var fs_extra=require(_0x3e71('0x9'));var _=require(_0x3e71('0xa'));var squel=require(_0x3e71('0xb'));var crypto=require(_0x3e71('0xc'));var jsforce=require(_0x3e71('0xd'));var deskjs=require(_0x3e71('0xe'));var toCsv=require(_0x3e71('0xf'));var querystring=require('querystring');var Papa=require(_0x3e71('0x10'));var Redis=require('ioredis');var authService=require(_0x3e71('0x11'));var qs=require(_0x3e71('0x12'));var as=require(_0x3e71('0x13'));var hardwareService=require(_0x3e71('0x14'));var logger=require('../../config/logger')(_0x3e71('0x15'));var utils=require(_0x3e71('0x16'));var config=require(_0x3e71('0x17'));var licenseUtil=require(_0x3e71('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b5585,_0xd7c005){_0xd7c005=_0xd7c005||0xcc;return function(_0x2a2511){if(_0x2a2511){return _0x2b5585[_0x3e71('0x19')](_0xd7c005);}return _0x2b5585[_0x3e71('0x1a')](_0xd7c005)[_0x3e71('0x1b')]();};}function respondWithResult(_0x57dabc,_0x26f194){_0x26f194=_0x26f194||0xc8;return function(_0x36459b){if(_0x36459b){return _0x57dabc[_0x3e71('0x1a')](_0x26f194)['json'](_0x36459b);}};}function respondWithFilteredResult(_0x169e26,_0x7e22bc){return function(_0x219172){if(_0x219172){var _0x2865bb=typeof _0x7e22bc['offset']===_0x3e71('0x1c')&&typeof _0x7e22bc['limit']===_0x3e71('0x1c');var _0x49df03=_0x219172['count'];var _0xa8e2ba=_0x2865bb?0x0:_0x7e22bc['offset'];var _0x499c60=_0x2865bb?_0x219172[_0x3e71('0x1d')]:_0x7e22bc['offset']+_0x7e22bc['limit'];var _0x4d466c;if(_0x499c60>=_0x49df03){_0x499c60=_0x49df03;_0x4d466c=0xc8;}else{_0x4d466c=0xce;}_0x169e26['status'](_0x4d466c);return _0x169e26[_0x3e71('0x1e')](_0x3e71('0x1f'),_0xa8e2ba+'-'+_0x499c60+'/'+_0x49df03)[_0x3e71('0x20')](_0x219172);}return null;};}function patchUpdates(_0x3ab46b){return function(_0x4895f0){try{jsonpatch['apply'](_0x4895f0,_0x3ab46b,!![]);}catch(_0x135af4){return BPromise['reject'](_0x135af4);}return _0x4895f0[_0x3e71('0x21')]();};}function saveUpdates(_0xc33b85,_0x554c5b){return function(_0x5680ea){if(_0x5680ea){return _0x5680ea['update'](_0xc33b85)[_0x3e71('0x22')](function(_0x364e56){return _0x364e56;});}return null;};}function removeEntity(_0x3b7325,_0x453ae3){return function(_0x5de725){if(_0x5de725){return _0x5de725[_0x3e71('0x23')]()[_0x3e71('0x22')](function(){_0x3b7325[_0x3e71('0x1a')](0xcc)[_0x3e71('0x1b')]();});}};}function handleEntityNotFound(_0xb98668,_0x2de4a5){return function(_0x1cb161){if(!_0x1cb161){_0xb98668['sendStatus'](0x194);}return _0x1cb161;};}function handleError(_0x57b6c1,_0x27e355){_0x27e355=_0x27e355||0x1f4;return function(_0x454012){logger[_0x3e71('0x24')](_0x454012[_0x3e71('0x25')]);if(_0x454012[_0x3e71('0x26')]){delete _0x454012[_0x3e71('0x26')];}_0x57b6c1[_0x3e71('0x1a')](_0x27e355)['send'](_0x454012);};}exports[_0x3e71('0x27')]=function(_0x21ff3c,_0x577b93){var _0xb7f549={},_0x282d82={},_0x2fa571={'count':0x0,'rows':[]};var _0x13fcc0=_[_0x3e71('0x28')](db[_0x3e71('0x29')][_0x3e71('0x2a')],function(_0x4cea84){return{'name':_0x4cea84['fieldName'],'type':_0x4cea84[_0x3e71('0x2b')]['key']};});_0x282d82[_0x3e71('0x2c')]=_[_0x3e71('0x28')](_0x13fcc0,_0x3e71('0x26'));_0x282d82[_0x3e71('0x2d')]=_[_0x3e71('0x2e')](_0x21ff3c[_0x3e71('0x2d')]);_0x282d82['filters']=_[_0x3e71('0x2f')](_0x282d82[_0x3e71('0x2c')],_0x282d82[_0x3e71('0x2d')]);_0xb7f549[_0x3e71('0x30')]=_['intersection'](_0x282d82[_0x3e71('0x2c')],qs[_0x3e71('0x31')](_0x21ff3c['query']['fields']));_0xb7f549[_0x3e71('0x30')]=_0xb7f549[_0x3e71('0x30')][_0x3e71('0x32')]?_0xb7f549['attributes']:_0x282d82[_0x3e71('0x2c')];if(!_0x21ff3c[_0x3e71('0x2d')]['hasOwnProperty']('nolimit')){_0xb7f549['limit']=qs[_0x3e71('0x33')](_0x21ff3c[_0x3e71('0x2d')]['limit']);_0xb7f549['offset']=qs[_0x3e71('0x34')](_0x21ff3c[_0x3e71('0x2d')]['offset']);}_0xb7f549[_0x3e71('0x35')]=qs[_0x3e71('0x36')](_0x21ff3c[_0x3e71('0x2d')]['sort']);_0xb7f549[_0x3e71('0x37')]=qs['filters'](_[_0x3e71('0x38')](_0x21ff3c['query'],_0x282d82[_0x3e71('0x39')]),_0x13fcc0);if(_0x21ff3c[_0x3e71('0x2d')]['filter']){_0xb7f549[_0x3e71('0x37')]=_[_0x3e71('0x3a')](_0xb7f549['where'],{'$or':_[_0x3e71('0x28')](_0x13fcc0,function(_0x3a120b){if(_0x3a120b[_0x3e71('0x2b')]!==_0x3e71('0x3b')){var _0x19677c={};_0x19677c[_0x3a120b[_0x3e71('0x26')]]={'$like':'%'+_0x21ff3c[_0x3e71('0x2d')][_0x3e71('0x3c')]+'%'};return _0x19677c;}})});}_0xb7f549=_[_0x3e71('0x3a')]({},_0xb7f549,_0x21ff3c[_0x3e71('0x3d')]);var _0x482a5a={'where':_0xb7f549[_0x3e71('0x37')]};return db[_0x3e71('0x29')][_0x3e71('0x1d')](_0x482a5a)[_0x3e71('0x22')](function(_0x4f3f14){_0x2fa571[_0x3e71('0x1d')]=_0x4f3f14;if(_0x21ff3c[_0x3e71('0x2d')][_0x3e71('0x3e')]){_0xb7f549[_0x3e71('0x3f')]=[{'all':!![]}];}return db[_0x3e71('0x29')][_0x3e71('0x40')](_0xb7f549);})[_0x3e71('0x22')](function(_0x28487b){_0x2fa571['rows']=_0x28487b;return _0x2fa571;})[_0x3e71('0x22')](respondWithFilteredResult(_0x577b93,_0xb7f549))['catch'](handleError(_0x577b93,null));};exports['show']=function(_0xb6811f,_0x58e480){var _0x2e6510={'raw':!![],'where':{'id':_0xb6811f[_0x3e71('0x41')]['id']}},_0x1cc916={};_0x1cc916['model']=_[_0x3e71('0x2e')](db[_0x3e71('0x29')][_0x3e71('0x2a')]);_0x1cc916[_0x3e71('0x2d')]=_[_0x3e71('0x2e')](_0xb6811f[_0x3e71('0x2d')]);_0x1cc916['filters']=_[_0x3e71('0x2f')](_0x1cc916['model'],_0x1cc916['query']);_0x2e6510[_0x3e71('0x30')]=_[_0x3e71('0x2f')](_0x1cc916[_0x3e71('0x2c')],qs[_0x3e71('0x31')](_0xb6811f['query'][_0x3e71('0x31')]));_0x2e6510[_0x3e71('0x30')]=_0x2e6510['attributes'][_0x3e71('0x32')]?_0x2e6510['attributes']:_0x1cc916[_0x3e71('0x2c')];if(_0xb6811f['query'][_0x3e71('0x3e')]){_0x2e6510['include']=[{'all':!![]}];}_0x2e6510=_[_0x3e71('0x3a')]({},_0x2e6510,_0xb6811f['options']);return db[_0x3e71('0x29')][_0x3e71('0x42')](_0x2e6510)[_0x3e71('0x22')](handleEntityNotFound(_0x58e480,null))[_0x3e71('0x22')](respondWithResult(_0x58e480,null))[_0x3e71('0x43')](handleError(_0x58e480,null));};exports[_0x3e71('0x44')]=function(_0xf22e4d,_0x4388d2){return db['SmsQueueReport']['create'](_0xf22e4d[_0x3e71('0x45')],{})['then'](respondWithResult(_0x4388d2,0xc9))['catch'](handleError(_0x4388d2,null));};exports[_0x3e71('0x46')]=function(_0x3d46ae,_0x344915){if(_0x3d46ae[_0x3e71('0x45')]['id']){delete _0x3d46ae[_0x3e71('0x45')]['id'];}return db[_0x3e71('0x29')][_0x3e71('0x42')]({'where':{'id':_0x3d46ae[_0x3e71('0x41')]['id']}})[_0x3e71('0x22')](handleEntityNotFound(_0x344915,null))[_0x3e71('0x22')](saveUpdates(_0x3d46ae[_0x3e71('0x45')],null))[_0x3e71('0x22')](respondWithResult(_0x344915,null))[_0x3e71('0x43')](handleError(_0x344915,null));};exports[_0x3e71('0x23')]=function(_0x3086a0,_0x1eab4e){return db[_0x3e71('0x29')]['find']({'where':{'id':_0x3086a0[_0x3e71('0x41')]['id']}})['then'](handleEntityNotFound(_0x1eab4e,null))[_0x3e71('0x22')](removeEntity(_0x1eab4e,null))['catch'](handleError(_0x1eab4e,null));};exports['describe']=function(_0x1d90bb,_0xf59df5){return db['SmsQueueReport'][_0x3e71('0x47')]()[_0x3e71('0x22')](respondWithResult(_0xf59df5,null))['catch'](handleError(_0xf59df5,null));}; \ No newline at end of file +var _0xbde9=['where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0xbde9,0x1f0));var _0x9bde=function(_0x5a8c77,_0x6bba75){_0x5a8c77=_0x5a8c77-0x0;var _0x155544=_0xbde9[_0x5a8c77];return _0x155544;};'use strict';var emlformat=require(_0x9bde('0x0'));var rimraf=require(_0x9bde('0x1'));var zipdir=require(_0x9bde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9bde('0x3'));var moment=require('moment');var BPromise=require(_0x9bde('0x4'));var Mustache=require(_0x9bde('0x5'));var util=require(_0x9bde('0x6'));var path=require(_0x9bde('0x7'));var sox=require('sox');var csv=require(_0x9bde('0x8'));var ejs=require(_0x9bde('0x9'));var fs=require('fs');var fs_extra=require(_0x9bde('0xa'));var _=require('lodash');var squel=require(_0x9bde('0xb'));var crypto=require(_0x9bde('0xc'));var jsforce=require(_0x9bde('0xd'));var deskjs=require(_0x9bde('0xe'));var toCsv=require(_0x9bde('0x8'));var querystring=require(_0x9bde('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9bde('0x10'));var qs=require(_0x9bde('0x11'));var as=require(_0x9bde('0x12'));var hardwareService=require(_0x9bde('0x13'));var logger=require(_0x9bde('0x14'))(_0x9bde('0x15'));var utils=require(_0x9bde('0x16'));var config=require(_0x9bde('0x17'));var licenseUtil=require(_0x9bde('0x18'));var db=require(_0x9bde('0x19'))['db'];function respondWithStatusCode(_0x32d425,_0x1fbac8){_0x1fbac8=_0x1fbac8||0xcc;return function(_0x24ada5){if(_0x24ada5){return _0x32d425['sendStatus'](_0x1fbac8);}return _0x32d425[_0x9bde('0x1a')](_0x1fbac8)[_0x9bde('0x1b')]();};}function respondWithResult(_0x4d76c2,_0x5b7787){_0x5b7787=_0x5b7787||0xc8;return function(_0x146e08){if(_0x146e08){return _0x4d76c2[_0x9bde('0x1a')](_0x5b7787)[_0x9bde('0x1c')](_0x146e08);}};}function respondWithFilteredResult(_0x23d69c,_0x1a9440){return function(_0x1e928b){if(_0x1e928b){var _0x19860a=typeof _0x1a9440[_0x9bde('0x1d')]==='undefined'&&typeof _0x1a9440[_0x9bde('0x1e')]===_0x9bde('0x1f');var _0x5ef7a9=_0x1e928b['count'];var _0x18b125=_0x19860a?0x0:_0x1a9440[_0x9bde('0x1d')];var _0x540935=_0x19860a?_0x1e928b[_0x9bde('0x20')]:_0x1a9440[_0x9bde('0x1d')]+_0x1a9440[_0x9bde('0x1e')];var _0x4995c8;if(_0x540935>=_0x5ef7a9){_0x540935=_0x5ef7a9;_0x4995c8=0xc8;}else{_0x4995c8=0xce;}_0x23d69c[_0x9bde('0x1a')](_0x4995c8);return _0x23d69c[_0x9bde('0x21')](_0x9bde('0x22'),_0x18b125+'-'+_0x540935+'/'+_0x5ef7a9)['json'](_0x1e928b);}return null;};}function patchUpdates(_0x1f0522){return function(_0x23ed04){try{jsonpatch[_0x9bde('0x23')](_0x23ed04,_0x1f0522,!![]);}catch(_0x300534){return BPromise['reject'](_0x300534);}return _0x23ed04[_0x9bde('0x24')]();};}function saveUpdates(_0x2a0384,_0x3547dd){return function(_0x2739a6){if(_0x2739a6){return _0x2739a6['update'](_0x2a0384)['then'](function(_0x4247a4){return _0x4247a4;});}return null;};}function removeEntity(_0x2631f4,_0x484143){return function(_0x5e8d0f){if(_0x5e8d0f){return _0x5e8d0f['destroy']()[_0x9bde('0x25')](function(){_0x2631f4['status'](0xcc)[_0x9bde('0x1b')]();});}};}function handleEntityNotFound(_0x19e2af,_0x218945){return function(_0x2a7fed){if(!_0x2a7fed){_0x19e2af['sendStatus'](0x194);}return _0x2a7fed;};}function handleError(_0x3019c5,_0x12731b){_0x12731b=_0x12731b||0x1f4;return function(_0x556f85){logger['error'](_0x556f85[_0x9bde('0x26')]);if(_0x556f85[_0x9bde('0x27')]){delete _0x556f85['name'];}_0x3019c5[_0x9bde('0x1a')](_0x12731b)[_0x9bde('0x28')](_0x556f85);};}exports[_0x9bde('0x29')]=function(_0x39a05a,_0x14f110){var _0x5c8edf={},_0x2152e4={},_0xf5b506={'count':0x0,'rows':[]};var _0x3b66ff=_[_0x9bde('0x2a')](db[_0x9bde('0x2b')][_0x9bde('0x2c')],function(_0x56e4f2){return{'name':_0x56e4f2[_0x9bde('0x2d')],'type':_0x56e4f2['type'][_0x9bde('0x2e')]};});_0x2152e4[_0x9bde('0x2f')]=_[_0x9bde('0x2a')](_0x3b66ff,'name');_0x2152e4[_0x9bde('0x30')]=_['keys'](_0x39a05a['query']);_0x2152e4['filters']=_[_0x9bde('0x31')](_0x2152e4[_0x9bde('0x2f')],_0x2152e4[_0x9bde('0x30')]);_0x5c8edf[_0x9bde('0x32')]=_['intersection'](_0x2152e4[_0x9bde('0x2f')],qs['fields'](_0x39a05a[_0x9bde('0x30')][_0x9bde('0x33')]));_0x5c8edf[_0x9bde('0x32')]=_0x5c8edf[_0x9bde('0x32')][_0x9bde('0x34')]?_0x5c8edf['attributes']:_0x2152e4[_0x9bde('0x2f')];if(!_0x39a05a[_0x9bde('0x30')][_0x9bde('0x35')](_0x9bde('0x36'))){_0x5c8edf['limit']=qs[_0x9bde('0x1e')](_0x39a05a['query']['limit']);_0x5c8edf[_0x9bde('0x1d')]=qs['offset'](_0x39a05a[_0x9bde('0x30')][_0x9bde('0x1d')]);}_0x5c8edf[_0x9bde('0x37')]=qs[_0x9bde('0x38')](_0x39a05a[_0x9bde('0x30')][_0x9bde('0x38')]);_0x5c8edf[_0x9bde('0x39')]=qs[_0x9bde('0x3a')](_[_0x9bde('0x3b')](_0x39a05a['query'],_0x2152e4[_0x9bde('0x3a')]),_0x3b66ff);if(_0x39a05a[_0x9bde('0x30')][_0x9bde('0x3c')]){_0x5c8edf[_0x9bde('0x39')]=_[_0x9bde('0x3d')](_0x5c8edf[_0x9bde('0x39')],{'$or':_[_0x9bde('0x2a')](_0x3b66ff,function(_0x23176e){if(_0x23176e[_0x9bde('0x3e')]!==_0x9bde('0x3f')){var _0x123efc={};_0x123efc[_0x23176e['name']]={'$like':'%'+_0x39a05a[_0x9bde('0x30')][_0x9bde('0x3c')]+'%'};return _0x123efc;}})});}_0x5c8edf=_[_0x9bde('0x3d')]({},_0x5c8edf,_0x39a05a[_0x9bde('0x40')]);var _0x58c6ea={'where':_0x5c8edf[_0x9bde('0x39')]};return db[_0x9bde('0x2b')][_0x9bde('0x20')](_0x58c6ea)['then'](function(_0x23b34c){_0xf5b506['count']=_0x23b34c;if(_0x39a05a['query'][_0x9bde('0x41')]){_0x5c8edf[_0x9bde('0x42')]=[{'all':!![]}];}return db[_0x9bde('0x2b')][_0x9bde('0x43')](_0x5c8edf);})[_0x9bde('0x25')](function(_0x22585e){_0xf5b506[_0x9bde('0x44')]=_0x22585e;return _0xf5b506;})[_0x9bde('0x25')](respondWithFilteredResult(_0x14f110,_0x5c8edf))[_0x9bde('0x45')](handleError(_0x14f110,null));};exports[_0x9bde('0x46')]=function(_0x4e293a,_0x100659){var _0x500340={'raw':!![],'where':{'id':_0x4e293a[_0x9bde('0x47')]['id']}},_0xbc0e60={};_0xbc0e60[_0x9bde('0x2f')]=_[_0x9bde('0x48')](db[_0x9bde('0x2b')][_0x9bde('0x2c')]);_0xbc0e60[_0x9bde('0x30')]=_['keys'](_0x4e293a[_0x9bde('0x30')]);_0xbc0e60[_0x9bde('0x3a')]=_[_0x9bde('0x31')](_0xbc0e60[_0x9bde('0x2f')],_0xbc0e60['query']);_0x500340['attributes']=_[_0x9bde('0x31')](_0xbc0e60[_0x9bde('0x2f')],qs[_0x9bde('0x33')](_0x4e293a[_0x9bde('0x30')][_0x9bde('0x33')]));_0x500340[_0x9bde('0x32')]=_0x500340[_0x9bde('0x32')][_0x9bde('0x34')]?_0x500340['attributes']:_0xbc0e60[_0x9bde('0x2f')];if(_0x4e293a[_0x9bde('0x30')][_0x9bde('0x41')]){_0x500340[_0x9bde('0x42')]=[{'all':!![]}];}_0x500340=_['merge']({},_0x500340,_0x4e293a[_0x9bde('0x40')]);return db[_0x9bde('0x2b')]['find'](_0x500340)[_0x9bde('0x25')](handleEntityNotFound(_0x100659,null))['then'](respondWithResult(_0x100659,null))[_0x9bde('0x45')](handleError(_0x100659,null));};exports[_0x9bde('0x49')]=function(_0x4b056d,_0x3fce6e){return db[_0x9bde('0x2b')]['create'](_0x4b056d[_0x9bde('0x4a')],{})[_0x9bde('0x25')](respondWithResult(_0x3fce6e,0xc9))[_0x9bde('0x45')](handleError(_0x3fce6e,null));};exports[_0x9bde('0x4b')]=function(_0x2332a4,_0x2138a6){if(_0x2332a4[_0x9bde('0x4a')]['id']){delete _0x2332a4['body']['id'];}return db['SmsQueueReport'][_0x9bde('0x4c')]({'where':{'id':_0x2332a4[_0x9bde('0x47')]['id']}})[_0x9bde('0x25')](handleEntityNotFound(_0x2138a6,null))['then'](saveUpdates(_0x2332a4[_0x9bde('0x4a')],null))[_0x9bde('0x25')](respondWithResult(_0x2138a6,null))[_0x9bde('0x45')](handleError(_0x2138a6,null));};exports[_0x9bde('0x4d')]=function(_0x34f640,_0x3ff39a){return db[_0x9bde('0x2b')][_0x9bde('0x4c')]({'where':{'id':_0x34f640[_0x9bde('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ff39a,null))[_0x9bde('0x25')](removeEntity(_0x3ff39a,null))['catch'](handleError(_0x3ff39a,null));};exports[_0x9bde('0x4e')]=function(_0x87d165,_0x509006){return db[_0x9bde('0x2b')][_0x9bde('0x4e')]()[_0x9bde('0x25')](respondWithResult(_0x509006,null))[_0x9bde('0x45')](handleError(_0x509006,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index f027d25..de4799e 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 _0xc507=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','exports','SmsQueueReport','report_sms_queue'];(function(_0x5dc409,_0x2255db){var _0x3cdbfd=function(_0x34e2e0){while(--_0x34e2e0){_0x5dc409['push'](_0x5dc409['shift']());}};_0x3cdbfd(++_0x2255db);}(_0xc507,0x8d));var _0x7c50=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xc507[_0x1bf809];return _0x1caa4e;};'use strict';var _=require(_0x7c50('0x0'));var util=require(_0x7c50('0x1'));var logger=require(_0x7c50('0x2'))(_0x7c50('0x3'));var moment=require(_0x7c50('0x4'));var BPromise=require(_0x7c50('0x5'));var rp=require(_0x7c50('0x6'));var fs=require('fs');var path=require(_0x7c50('0x7'));var rimraf=require(_0x7c50('0x8'));var config=require('../../config/environment');var attributes=require(_0x7c50('0x9'));module[_0x7c50('0xa')]=function(_0x16af99,_0x44c8cf){return _0x16af99['define'](_0x7c50('0xb'),attributes,{'tableName':_0x7c50('0xc'),'paranoid':![],'indexes':[{'name':_0x7c50('0xd'),'fields':[_0x7c50('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9099=['path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a4113,_0x466a19){var _0x50de17=function(_0x1f7507){while(--_0x1f7507){_0x5a4113['push'](_0x5a4113['shift']());}};_0x50de17(++_0x466a19);}(_0x9099,0x1ac));var _0x9909=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0x9099[_0x1ee9a1];return _0x21270f;};'use strict';var _=require(_0x9909('0x0'));var util=require('util');var logger=require(_0x9909('0x1'))(_0x9909('0x2'));var moment=require(_0x9909('0x3'));var BPromise=require(_0x9909('0x4'));var rp=require(_0x9909('0x5'));var fs=require('fs');var path=require(_0x9909('0x6'));var rimraf=require(_0x9909('0x7'));var config=require(_0x9909('0x8'));var attributes=require(_0x9909('0x9'));module[_0x9909('0xa')]=function(_0x3947ed,_0x41c07e){return _0x3947ed[_0x9909('0xb')](_0x9909('0xc'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x9909('0xd'),'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 9222999..7357708 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 _0xb756=['attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','message','request\x20sent','catch','create','body','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update','where'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xb756,0x1c2));var _0x6b75=function(_0x300424,_0x160dd5){_0x300424=_0x300424-0x0;var _0x2e6d05=_0xb756[_0x300424];return _0x2e6d05;};'use strict';var _=require(_0x6b75('0x0'));var util=require('util');var moment=require(_0x6b75('0x1'));var BPromise=require(_0x6b75('0x2'));var rs=require(_0x6b75('0x3'));var fs=require('fs');var Redis=require(_0x6b75('0x4'));var db=require(_0x6b75('0x5'))['db'];var utils=require(_0x6b75('0x6'));var logger=require(_0x6b75('0x7'))(_0x6b75('0x8'));var config=require(_0x6b75('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6b75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8313d1,_0x4fe3bf,_0xd5ec0e){return new BPromise(function(_0x54a401,_0x49bd4c){return client['request'](_0x8313d1,_0xd5ec0e)['then'](function(_0x2587a2){logger[_0x6b75('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x4fe3bf,'request\x20sent');logger[_0x6b75('0xc')](_0x6b75('0xd'),_0x4fe3bf,'request\x20sent',JSON['stringify'](_0x2587a2));if(_0x2587a2[_0x6b75('0xe')]){if(_0x2587a2['error'][_0x6b75('0xf')]===0x1f4){logger['error'](_0x6b75('0x10'),_0x4fe3bf,_0x2587a2['error'][_0x6b75('0x11')]);return _0x49bd4c(_0x2587a2[_0x6b75('0xe')][_0x6b75('0x11')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x4fe3bf,_0x2587a2[_0x6b75('0xe')][_0x6b75('0x11')]);return _0x54a401(_0x2587a2[_0x6b75('0xe')][_0x6b75('0x11')]);}else{logger[_0x6b75('0xb')](_0x6b75('0x10'),_0x4fe3bf,_0x6b75('0x12'));_0x54a401(_0x2587a2['result'][_0x6b75('0x11')]);}})[_0x6b75('0x13')](function(_0x431223){logger[_0x6b75('0xe')](_0x6b75('0x10'),_0x4fe3bf,_0x431223);_0x49bd4c(_0x431223);});});}exports['CreateSmsQueueReport']=function(_0x35c9f1){var _0x805c71=this;return new Promise(function(_0x39eab4,_0x2fdc8e){return db['SmsQueueReport'][_0x6b75('0x14')](_0x35c9f1[_0x6b75('0x15')],{'raw':_0x35c9f1[_0x6b75('0x16')]?_0x35c9f1[_0x6b75('0x16')][_0x6b75('0x17')]===undefined?!![]:![]:!![]})[_0x6b75('0x18')](function(_0x20e5da){logger['info']('CreateSmsQueueReport',_0x35c9f1);logger['debug']('CreateSmsQueueReport',_0x35c9f1,JSON['stringify'](_0x20e5da));_0x39eab4(_0x20e5da);})['catch'](function(_0x59ee16){logger['error'](_0x6b75('0x19'),_0x59ee16[_0x6b75('0x11')],_0x35c9f1);_0x2fdc8e(_0x805c71[_0x6b75('0xe')](0x1f4,_0x59ee16['message']));});});};exports[_0x6b75('0x1a')]=function(_0x5a71ba){var _0x1c2852=this;return new Promise(function(_0x2e278a,_0x134578){return db[_0x6b75('0x1b')][_0x6b75('0x1c')](_0x5a71ba['body'],{'raw':_0x5a71ba[_0x6b75('0x16')]?_0x5a71ba['options'][_0x6b75('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a71ba[_0x6b75('0x16')]?_0x5a71ba[_0x6b75('0x16')][_0x6b75('0x1d')]||null:null,'attributes':_0x5a71ba[_0x6b75('0x16')]?_0x5a71ba[_0x6b75('0x16')][_0x6b75('0x1e')]||null:null,'limit':_0x5a71ba[_0x6b75('0x16')]?_0x5a71ba[_0x6b75('0x16')]['limit']||null:null})[_0x6b75('0x18')](function(_0x336846){logger[_0x6b75('0xb')](_0x6b75('0x1a'),_0x5a71ba);logger[_0x6b75('0xc')]('UpdateSmsQueueReport',_0x5a71ba,JSON[_0x6b75('0x1f')](_0x336846));_0x2e278a(_0x336846);})[_0x6b75('0x13')](function(_0x122a85){logger[_0x6b75('0xe')](_0x6b75('0x1a'),_0x122a85[_0x6b75('0x11')],_0x5a71ba);_0x134578(_0x1c2852[_0x6b75('0xe')](0x1f4,_0x122a85[_0x6b75('0x11')]));});});}; \ No newline at end of file +var _0xeb3f=['debug','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','then','UpdateSmsQueueReport','update','options','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xeb3f,0xda));var _0xfeb3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeb3f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfeb3('0x0'));var BPromise=require(_0xfeb3('0x1'));var rs=require(_0xfeb3('0x2'));var fs=require('fs');var Redis=require(_0xfeb3('0x3'));var db=require(_0xfeb3('0x4'))['db'];var utils=require(_0xfeb3('0x5'));var logger=require(_0xfeb3('0x6'))(_0xfeb3('0x7'));var config=require(_0xfeb3('0x8'));var jayson=require(_0xfeb3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a05f1,_0x5f04be,_0x41a8e3){return new BPromise(function(_0x2e6e29,_0x4d3f85){return client[_0xfeb3('0xa')](_0x1a05f1,_0x41a8e3)['then'](function(_0x1f58dc){logger['info'](_0xfeb3('0xb'),_0x5f04be,_0xfeb3('0xc'));logger[_0xfeb3('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5f04be,'request\x20sent',JSON[_0xfeb3('0xe')](_0x1f58dc));if(_0x1f58dc[_0xfeb3('0xf')]){if(_0x1f58dc[_0xfeb3('0xf')][_0xfeb3('0x10')]===0x1f4){logger[_0xfeb3('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x5f04be,_0x1f58dc[_0xfeb3('0xf')]['message']);return _0x4d3f85(_0x1f58dc[_0xfeb3('0xf')]['message']);}logger[_0xfeb3('0xf')](_0xfeb3('0xb'),_0x5f04be,_0x1f58dc['error'][_0xfeb3('0x11')]);return _0x2e6e29(_0x1f58dc[_0xfeb3('0xf')][_0xfeb3('0x11')]);}else{logger[_0xfeb3('0x12')](_0xfeb3('0xb'),_0x5f04be,_0xfeb3('0xc'));_0x2e6e29(_0x1f58dc[_0xfeb3('0x13')][_0xfeb3('0x11')]);}})[_0xfeb3('0x14')](function(_0x50f235){logger[_0xfeb3('0xf')](_0xfeb3('0xb'),_0x5f04be,_0x50f235);_0x4d3f85(_0x50f235);});});}exports[_0xfeb3('0x15')]=function(_0xe7738a){var _0x15dd9e=this;return new Promise(function(_0x402dec,_0x538862){return db[_0xfeb3('0x16')][_0xfeb3('0x17')](_0xe7738a[_0xfeb3('0x18')],{'raw':_0xe7738a['options']?_0xe7738a['options']['raw']===undefined?!![]:![]:!![]})[_0xfeb3('0x19')](function(_0x38ea7f){logger['info'](_0xfeb3('0x15'),_0xe7738a);logger['debug'](_0xfeb3('0x15'),_0xe7738a,JSON[_0xfeb3('0xe')](_0x38ea7f));_0x402dec(_0x38ea7f);})[_0xfeb3('0x14')](function(_0x47c003){logger[_0xfeb3('0xf')](_0xfeb3('0x15'),_0x47c003[_0xfeb3('0x11')],_0xe7738a);_0x538862(_0x15dd9e[_0xfeb3('0xf')](0x1f4,_0x47c003['message']));});});};exports[_0xfeb3('0x1a')]=function(_0x42a0b3){var _0x30f2ae=this;return new Promise(function(_0x2ff4da,_0x430044){return db[_0xfeb3('0x16')][_0xfeb3('0x1b')](_0x42a0b3[_0xfeb3('0x18')],{'raw':_0x42a0b3[_0xfeb3('0x1c')]?_0x42a0b3['options'][_0xfeb3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42a0b3[_0xfeb3('0x1c')]?_0x42a0b3['options'][_0xfeb3('0x1e')]||null:null,'attributes':_0x42a0b3[_0xfeb3('0x1c')]?_0x42a0b3['options'][_0xfeb3('0x1f')]||null:null,'limit':_0x42a0b3[_0xfeb3('0x1c')]?_0x42a0b3[_0xfeb3('0x1c')][_0xfeb3('0x20')]||null:null})[_0xfeb3('0x19')](function(_0x31541b){logger[_0xfeb3('0x12')](_0xfeb3('0x1a'),_0x42a0b3);logger[_0xfeb3('0xd')](_0xfeb3('0x1a'),_0x42a0b3,JSON[_0xfeb3('0xe')](_0x31541b));_0x2ff4da(_0x31541b);})[_0xfeb3('0x14')](function(_0x518827){logger[_0xfeb3('0xf')](_0xfeb3('0x1a'),_0x518827[_0xfeb3('0x11')],_0x42a0b3);_0x430044(_0x30f2ae[_0xfeb3('0xf')](0x1f4,_0x518827['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a77176f..eca0bf8 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 _0x810d=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','put','delete','destroy','exports'];(function(_0x64790e,_0x1cf04c){var _0xcb06cb=function(_0x3e6fc6){while(--_0x3e6fc6){_0x64790e['push'](_0x64790e['shift']());}};_0xcb06cb(++_0x1cf04c);}(_0x810d,0xc6));var _0xd810=function(_0x4e2515,_0x5a755b){_0x4e2515=_0x4e2515-0x0;var _0xc6b1de=_0x810d[_0x4e2515];return _0xc6b1de;};'use strict';var multer=require(_0xd810('0x0'));var util=require(_0xd810('0x1'));var path=require('path');var timeout=require(_0xd810('0x2'));var express=require(_0xd810('0x3'));var router=express['Router']();var fs_extra=require(_0xd810('0x4'));var auth=require(_0xd810('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd810('0x6'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xd810('0x7')](),controller[_0xd810('0x8')]);router[_0xd810('0x9')](_0xd810('0xa'),auth[_0xd810('0x7')](),controller['describe']);router[_0xd810('0x9')](_0xd810('0xb'),auth[_0xd810('0x7')](),controller[_0xd810('0xc')]);router[_0xd810('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd810('0xe')](_0xd810('0xb'),auth[_0xd810('0x7')](),controller['update']);router[_0xd810('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd810('0x10')]);module[_0xd810('0x11')]=router; \ No newline at end of file +var _0xf7ad=['isAuthenticated','index','/describe','describe','/:id','create','put','update','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x192ee4,_0x1cb5c9){var _0x275d01=function(_0x4d06c6){while(--_0x4d06c6){_0x192ee4['push'](_0x192ee4['shift']());}};_0x275d01(++_0x1cb5c9);}(_0xf7ad,0x184));var _0xdf7a=function(_0x2a6147,_0x287f5a){_0x2a6147=_0x2a6147-0x0;var _0x499b74=_0xf7ad[_0x2a6147];return _0x499b74;};'use strict';var multer=require(_0xdf7a('0x0'));var util=require(_0xdf7a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdf7a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf7a('0x3'));var interaction=require(_0xdf7a('0x4'));var config=require(_0xdf7a('0x5'));var controller=require(_0xdf7a('0x6'));router[_0xdf7a('0x7')]('/',auth[_0xdf7a('0x8')](),controller[_0xdf7a('0x9')]);router[_0xdf7a('0x7')](_0xdf7a('0xa'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0xb')]);router[_0xdf7a('0x7')](_0xdf7a('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xdf7a('0x8')](),controller[_0xdf7a('0xd')]);router[_0xdf7a('0xe')]('/:id',auth[_0xdf7a('0x8')](),controller[_0xdf7a('0xf')]);router['delete'](_0xdf7a('0xc'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0x10')]);module[_0xdf7a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 8738f47..774fe5c 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 _0x8cf6=['NOW','moment','sequelize','account','queue','DATE'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x8cf6,0x17b));var _0x68cf=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x8cf6[_0x810e4d];return _0x13f01c;};'use strict';var moment=require(_0x68cf('0x0'));var Sequelize=require(_0x68cf('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x68cf('0x2'),'agent',_0x68cf('0x3')),'allowNull':![],'defaultValue':_0x68cf('0x3')},'transferredAt':{'type':Sequelize[_0x68cf('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x68cf('0x5')]}}; \ No newline at end of file +var _0xb4b1=['DATE','NOW','moment','sequelize','exports','queue'];(function(_0x13081d,_0xfd04f0){var _0x176ede=function(_0x477f02){while(--_0x477f02){_0x13081d['push'](_0x13081d['shift']());}};_0x176ede(++_0xfd04f0);}(_0xb4b1,0x128));var _0x1b4b=function(_0x2eb874,_0x4fef8c){_0x2eb874=_0x2eb874-0x0;var _0x1c1294=_0xb4b1[_0x2eb874];return _0x1c1294;};'use strict';var moment=require(_0x1b4b('0x0'));var Sequelize=require(_0x1b4b('0x1'));module[_0x1b4b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0x1b4b('0x3')),'allowNull':![],'defaultValue':_0x1b4b('0x3')},'transferredAt':{'type':Sequelize[_0x1b4b('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x1b4b('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 66a277f..dd0e183 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 _0xcf30=['catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','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/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','include','options'];(function(_0x15f529,_0x40098b){var _0x2a2839=function(_0x35ac5f){while(--_0x35ac5f){_0x15f529['push'](_0x15f529['shift']());}};_0x2a2839(++_0x40098b);}(_0xcf30,0x128));var _0x0cf3=function(_0xb7d17,_0x463270){_0xb7d17=_0xb7d17-0x0;var _0x5da76a=_0xcf30[_0xb7d17];return _0x5da76a;};'use strict';var emlformat=require(_0x0cf3('0x0'));var rimraf=require(_0x0cf3('0x1'));var zipdir=require(_0x0cf3('0x2'));var jsonpatch=require(_0x0cf3('0x3'));var rp=require('request-promise');var moment=require(_0x0cf3('0x4'));var BPromise=require(_0x0cf3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0cf3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cf3('0x7'));var squel=require(_0x0cf3('0x8'));var crypto=require(_0x0cf3('0x9'));var jsforce=require(_0x0cf3('0xa'));var deskjs=require(_0x0cf3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0cf3('0xc'));var Papa=require('papaparse');var Redis=require(_0x0cf3('0xd'));var authService=require(_0x0cf3('0xe'));var qs=require(_0x0cf3('0xf'));var as=require(_0x0cf3('0x10'));var hardwareService=require(_0x0cf3('0x11'));var logger=require(_0x0cf3('0x12'))(_0x0cf3('0x13'));var utils=require(_0x0cf3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0cf3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50df01,_0x5ecbe5){_0x5ecbe5=_0x5ecbe5||0xcc;return function(_0x24d1d4){if(_0x24d1d4){return _0x50df01[_0x0cf3('0x16')](_0x5ecbe5);}return _0x50df01['status'](_0x5ecbe5)['end']();};}function respondWithResult(_0x4d145c,_0x33a7a3){_0x33a7a3=_0x33a7a3||0xc8;return function(_0x20b7b0){if(_0x20b7b0){return _0x4d145c[_0x0cf3('0x17')](_0x33a7a3)[_0x0cf3('0x18')](_0x20b7b0);}};}function respondWithFilteredResult(_0x41d672,_0x4a5b42){return function(_0xdcaf22){if(_0xdcaf22){var _0x86f0d5=typeof _0x4a5b42['offset']===_0x0cf3('0x19')&&typeof _0x4a5b42[_0x0cf3('0x1a')]===_0x0cf3('0x19');var _0x431fde=_0xdcaf22[_0x0cf3('0x1b')];var _0x2ab930=_0x86f0d5?0x0:_0x4a5b42[_0x0cf3('0x1c')];var _0x139325=_0x86f0d5?_0xdcaf22['count']:_0x4a5b42[_0x0cf3('0x1c')]+_0x4a5b42[_0x0cf3('0x1a')];var _0x4e06f6;if(_0x139325>=_0x431fde){_0x139325=_0x431fde;_0x4e06f6=0xc8;}else{_0x4e06f6=0xce;}_0x41d672[_0x0cf3('0x17')](_0x4e06f6);return _0x41d672[_0x0cf3('0x1d')](_0x0cf3('0x1e'),_0x2ab930+'-'+_0x139325+'/'+_0x431fde)[_0x0cf3('0x18')](_0xdcaf22);}return null;};}function patchUpdates(_0x327694){return function(_0x5bb14e){try{jsonpatch[_0x0cf3('0x1f')](_0x5bb14e,_0x327694,!![]);}catch(_0x5cf070){return BPromise[_0x0cf3('0x20')](_0x5cf070);}return _0x5bb14e[_0x0cf3('0x21')]();};}function saveUpdates(_0x306307,_0x5ed4ba){return function(_0x267c28){if(_0x267c28){return _0x267c28[_0x0cf3('0x22')](_0x306307)['then'](function(_0x46d85a){return _0x46d85a;});}return null;};}function removeEntity(_0x5b9024,_0x45ae4f){return function(_0x4a6ed1){if(_0x4a6ed1){return _0x4a6ed1[_0x0cf3('0x23')]()[_0x0cf3('0x24')](function(){_0x5b9024['status'](0xcc)[_0x0cf3('0x25')]();});}};}function handleEntityNotFound(_0x3205c0,_0x57dc10){return function(_0x28c81){if(!_0x28c81){_0x3205c0[_0x0cf3('0x16')](0x194);}return _0x28c81;};}function handleError(_0x5be8c9,_0x5aed05){_0x5aed05=_0x5aed05||0x1f4;return function(_0x2ce8d9){logger[_0x0cf3('0x26')](_0x2ce8d9[_0x0cf3('0x27')]);if(_0x2ce8d9[_0x0cf3('0x28')]){delete _0x2ce8d9['name'];}_0x5be8c9[_0x0cf3('0x17')](_0x5aed05)[_0x0cf3('0x29')](_0x2ce8d9);};}exports['index']=function(_0x1a1e94,_0x19f1cf){var _0x4b78a0={},_0x1c2c1c={},_0x38a3c9={'count':0x0,'rows':[]};var _0x23707d=_[_0x0cf3('0x2a')](db[_0x0cf3('0x2b')][_0x0cf3('0x2c')],function(_0x4bd471){return{'name':_0x4bd471[_0x0cf3('0x2d')],'type':_0x4bd471[_0x0cf3('0x2e')][_0x0cf3('0x2f')]};});_0x1c2c1c[_0x0cf3('0x30')]=_['map'](_0x23707d,_0x0cf3('0x28'));_0x1c2c1c[_0x0cf3('0x31')]=_[_0x0cf3('0x32')](_0x1a1e94[_0x0cf3('0x31')]);_0x1c2c1c[_0x0cf3('0x33')]=_[_0x0cf3('0x34')](_0x1c2c1c[_0x0cf3('0x30')],_0x1c2c1c[_0x0cf3('0x31')]);_0x4b78a0['attributes']=_[_0x0cf3('0x34')](_0x1c2c1c[_0x0cf3('0x30')],qs['fields'](_0x1a1e94[_0x0cf3('0x31')][_0x0cf3('0x35')]));_0x4b78a0['attributes']=_0x4b78a0[_0x0cf3('0x36')]['length']?_0x4b78a0['attributes']:_0x1c2c1c['model'];if(!_0x1a1e94[_0x0cf3('0x31')][_0x0cf3('0x37')]('nolimit')){_0x4b78a0['limit']=qs[_0x0cf3('0x1a')](_0x1a1e94['query']['limit']);_0x4b78a0[_0x0cf3('0x1c')]=qs[_0x0cf3('0x1c')](_0x1a1e94[_0x0cf3('0x31')][_0x0cf3('0x1c')]);}_0x4b78a0[_0x0cf3('0x38')]=qs['sort'](_0x1a1e94['query'][_0x0cf3('0x39')]);_0x4b78a0[_0x0cf3('0x3a')]=qs['filters'](_[_0x0cf3('0x3b')](_0x1a1e94['query'],_0x1c2c1c[_0x0cf3('0x33')]),_0x23707d);if(_0x1a1e94['query'][_0x0cf3('0x3c')]){_0x4b78a0[_0x0cf3('0x3a')]=_['merge'](_0x4b78a0[_0x0cf3('0x3a')],{'$or':_[_0x0cf3('0x2a')](_0x23707d,function(_0x21dd80){if(_0x21dd80[_0x0cf3('0x2e')]!=='VIRTUAL'){var _0x2c3c89={};_0x2c3c89[_0x21dd80[_0x0cf3('0x28')]]={'$like':'%'+_0x1a1e94['query'][_0x0cf3('0x3c')]+'%'};return _0x2c3c89;}})});}_0x4b78a0=_[_0x0cf3('0x3d')]({},_0x4b78a0,_0x1a1e94['options']);var _0x15ee24={'where':_0x4b78a0['where']};return db['SmsTransferReport']['count'](_0x15ee24)[_0x0cf3('0x24')](function(_0x4dac1b){_0x38a3c9[_0x0cf3('0x1b')]=_0x4dac1b;if(_0x1a1e94[_0x0cf3('0x31')][_0x0cf3('0x3e')]){_0x4b78a0['include']=[{'all':!![]}];}return db[_0x0cf3('0x2b')][_0x0cf3('0x3f')](_0x4b78a0);})[_0x0cf3('0x24')](function(_0xc6da07){_0x38a3c9[_0x0cf3('0x40')]=_0xc6da07;return _0x38a3c9;})[_0x0cf3('0x24')](respondWithFilteredResult(_0x19f1cf,_0x4b78a0))['catch'](handleError(_0x19f1cf,null));};exports[_0x0cf3('0x41')]=function(_0x434158,_0x2b29eb){var _0x4198ec={'raw':!![],'where':{'id':_0x434158[_0x0cf3('0x42')]['id']}},_0x3a487c={};_0x3a487c[_0x0cf3('0x30')]=_[_0x0cf3('0x32')](db['SmsTransferReport'][_0x0cf3('0x2c')]);_0x3a487c['query']=_['keys'](_0x434158['query']);_0x3a487c[_0x0cf3('0x33')]=_[_0x0cf3('0x34')](_0x3a487c[_0x0cf3('0x30')],_0x3a487c[_0x0cf3('0x31')]);_0x4198ec[_0x0cf3('0x36')]=_[_0x0cf3('0x34')](_0x3a487c['model'],qs[_0x0cf3('0x35')](_0x434158[_0x0cf3('0x31')][_0x0cf3('0x35')]));_0x4198ec[_0x0cf3('0x36')]=_0x4198ec[_0x0cf3('0x36')]['length']?_0x4198ec[_0x0cf3('0x36')]:_0x3a487c[_0x0cf3('0x30')];if(_0x434158[_0x0cf3('0x31')]['includeAll']){_0x4198ec[_0x0cf3('0x43')]=[{'all':!![]}];}_0x4198ec=_[_0x0cf3('0x3d')]({},_0x4198ec,_0x434158[_0x0cf3('0x44')]);return db['SmsTransferReport']['find'](_0x4198ec)['then'](handleEntityNotFound(_0x2b29eb,null))[_0x0cf3('0x24')](respondWithResult(_0x2b29eb,null))[_0x0cf3('0x45')](handleError(_0x2b29eb,null));};exports[_0x0cf3('0x46')]=function(_0x2c4819,_0xafeb5){return db['SmsTransferReport'][_0x0cf3('0x46')](_0x2c4819[_0x0cf3('0x47')],{})[_0x0cf3('0x24')](respondWithResult(_0xafeb5,0xc9))[_0x0cf3('0x45')](handleError(_0xafeb5,null));};exports['update']=function(_0x533f94,_0x1a3ef1){if(_0x533f94[_0x0cf3('0x47')]['id']){delete _0x533f94[_0x0cf3('0x47')]['id'];}return db[_0x0cf3('0x2b')][_0x0cf3('0x48')]({'where':{'id':_0x533f94['params']['id']}})[_0x0cf3('0x24')](handleEntityNotFound(_0x1a3ef1,null))[_0x0cf3('0x24')](saveUpdates(_0x533f94[_0x0cf3('0x47')],null))['then'](respondWithResult(_0x1a3ef1,null))[_0x0cf3('0x45')](handleError(_0x1a3ef1,null));};exports[_0x0cf3('0x23')]=function(_0x270a59,_0x4eb29a){return db[_0x0cf3('0x2b')][_0x0cf3('0x48')]({'where':{'id':_0x270a59[_0x0cf3('0x42')]['id']}})[_0x0cf3('0x24')](handleEntityNotFound(_0x4eb29a,null))['then'](removeEntity(_0x4eb29a,null))[_0x0cf3('0x45')](handleError(_0x4eb29a,null));};exports['describe']=function(_0x5cecc2,_0x513f88){return db[_0x0cf3('0x2b')]['describe']()[_0x0cf3('0x24')](respondWithResult(_0x513f88,null))[_0x0cf3('0x45')](handleError(_0x513f88,null));}; \ No newline at end of file +var _0x8892=['sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','reject','save','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','SmsTransferReport','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','util','path'];(function(_0x30282d,_0x2b7860){var _0x142388=function(_0x386f6c){while(--_0x386f6c){_0x30282d['push'](_0x30282d['shift']());}};_0x142388(++_0x2b7860);}(_0x8892,0x14f));var _0x2889=function(_0x5b6f72,_0x327b67){_0x5b6f72=_0x5b6f72-0x0;var _0xf69b16=_0x8892[_0x5b6f72];return _0xf69b16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2889('0x0'));var zipdir=require(_0x2889('0x1'));var jsonpatch=require(_0x2889('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2889('0x3'));var path=require(_0x2889('0x4'));var sox=require(_0x2889('0x5'));var csv=require(_0x2889('0x6'));var ejs=require(_0x2889('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2889('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2889('0x9'));var deskjs=require(_0x2889('0xa'));var toCsv=require(_0x2889('0x6'));var querystring=require(_0x2889('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2889('0xc'));var qs=require(_0x2889('0xd'));var as=require(_0x2889('0xe'));var hardwareService=require(_0x2889('0xf'));var logger=require(_0x2889('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x2889('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x2889('0x12'))['db'];function respondWithStatusCode(_0x378382,_0x42cef7){_0x42cef7=_0x42cef7||0xcc;return function(_0x105f91){if(_0x105f91){return _0x378382[_0x2889('0x13')](_0x42cef7);}return _0x378382[_0x2889('0x14')](_0x42cef7)[_0x2889('0x15')]();};}function respondWithResult(_0x3f5f4d,_0x15b19e){_0x15b19e=_0x15b19e||0xc8;return function(_0x4808ba){if(_0x4808ba){return _0x3f5f4d['status'](_0x15b19e)[_0x2889('0x16')](_0x4808ba);}};}function respondWithFilteredResult(_0x3b14c6,_0x40c40a){return function(_0x365e46){if(_0x365e46){var _0x4ddd63=typeof _0x40c40a['offset']==='undefined'&&typeof _0x40c40a[_0x2889('0x17')]==='undefined';var _0x5d9123=_0x365e46[_0x2889('0x18')];var _0x3ede13=_0x4ddd63?0x0:_0x40c40a[_0x2889('0x19')];var _0x342be0=_0x4ddd63?_0x365e46[_0x2889('0x18')]:_0x40c40a[_0x2889('0x19')]+_0x40c40a[_0x2889('0x17')];var _0x42b853;if(_0x342be0>=_0x5d9123){_0x342be0=_0x5d9123;_0x42b853=0xc8;}else{_0x42b853=0xce;}_0x3b14c6[_0x2889('0x14')](_0x42b853);return _0x3b14c6[_0x2889('0x1a')]('Content-Range',_0x3ede13+'-'+_0x342be0+'/'+_0x5d9123)[_0x2889('0x16')](_0x365e46);}return null;};}function patchUpdates(_0x465477){return function(_0x541c4e){try{jsonpatch[_0x2889('0x1b')](_0x541c4e,_0x465477,!![]);}catch(_0x5a1e89){return BPromise[_0x2889('0x1c')](_0x5a1e89);}return _0x541c4e[_0x2889('0x1d')]();};}function saveUpdates(_0x2b46d5,_0x507d47){return function(_0x2a40af){if(_0x2a40af){return _0x2a40af['update'](_0x2b46d5)['then'](function(_0x1173f0){return _0x1173f0;});}return null;};}function removeEntity(_0x3ef0be,_0x558e65){return function(_0x2aa2e6){if(_0x2aa2e6){return _0x2aa2e6[_0x2889('0x1e')]()[_0x2889('0x1f')](function(){_0x3ef0be[_0x2889('0x14')](0xcc)[_0x2889('0x15')]();});}};}function handleEntityNotFound(_0x14a015,_0xa6f56b){return function(_0x44fa92){if(!_0x44fa92){_0x14a015[_0x2889('0x13')](0x194);}return _0x44fa92;};}function handleError(_0x2a4625,_0x37c62b){_0x37c62b=_0x37c62b||0x1f4;return function(_0x2dcfef){logger['error'](_0x2dcfef[_0x2889('0x20')]);if(_0x2dcfef[_0x2889('0x21')]){delete _0x2dcfef[_0x2889('0x21')];}_0x2a4625[_0x2889('0x14')](_0x37c62b)['send'](_0x2dcfef);};}exports[_0x2889('0x22')]=function(_0xb3167a,_0x128658){var _0x1aa9b8={},_0x373f47={},_0x4d37fb={'count':0x0,'rows':[]};var _0x108123=_[_0x2889('0x23')](db['SmsTransferReport'][_0x2889('0x24')],function(_0x1f6d91){return{'name':_0x1f6d91[_0x2889('0x25')],'type':_0x1f6d91[_0x2889('0x26')][_0x2889('0x27')]};});_0x373f47[_0x2889('0x28')]=_[_0x2889('0x23')](_0x108123,_0x2889('0x21'));_0x373f47[_0x2889('0x29')]=_['keys'](_0xb3167a[_0x2889('0x29')]);_0x373f47[_0x2889('0x2a')]=_[_0x2889('0x2b')](_0x373f47[_0x2889('0x28')],_0x373f47[_0x2889('0x29')]);_0x1aa9b8[_0x2889('0x2c')]=_[_0x2889('0x2b')](_0x373f47[_0x2889('0x28')],qs['fields'](_0xb3167a[_0x2889('0x29')][_0x2889('0x2d')]));_0x1aa9b8[_0x2889('0x2c')]=_0x1aa9b8[_0x2889('0x2c')]['length']?_0x1aa9b8[_0x2889('0x2c')]:_0x373f47['model'];if(!_0xb3167a[_0x2889('0x29')][_0x2889('0x2e')](_0x2889('0x2f'))){_0x1aa9b8[_0x2889('0x17')]=qs['limit'](_0xb3167a[_0x2889('0x29')]['limit']);_0x1aa9b8[_0x2889('0x19')]=qs[_0x2889('0x19')](_0xb3167a[_0x2889('0x29')][_0x2889('0x19')]);}_0x1aa9b8['order']=qs[_0x2889('0x30')](_0xb3167a[_0x2889('0x29')][_0x2889('0x30')]);_0x1aa9b8[_0x2889('0x31')]=qs[_0x2889('0x2a')](_[_0x2889('0x32')](_0xb3167a[_0x2889('0x29')],_0x373f47['filters']),_0x108123);if(_0xb3167a['query'][_0x2889('0x33')]){_0x1aa9b8[_0x2889('0x31')]=_[_0x2889('0x34')](_0x1aa9b8[_0x2889('0x31')],{'$or':_[_0x2889('0x23')](_0x108123,function(_0x3673a1){if(_0x3673a1[_0x2889('0x26')]!=='VIRTUAL'){var _0x5b2e0f={};_0x5b2e0f[_0x3673a1[_0x2889('0x21')]]={'$like':'%'+_0xb3167a[_0x2889('0x29')]['filter']+'%'};return _0x5b2e0f;}})});}_0x1aa9b8=_[_0x2889('0x34')]({},_0x1aa9b8,_0xb3167a[_0x2889('0x35')]);var _0x132214={'where':_0x1aa9b8[_0x2889('0x31')]};return db[_0x2889('0x36')][_0x2889('0x18')](_0x132214)['then'](function(_0x29c857){_0x4d37fb[_0x2889('0x18')]=_0x29c857;if(_0xb3167a[_0x2889('0x29')][_0x2889('0x37')]){_0x1aa9b8['include']=[{'all':!![]}];}return db[_0x2889('0x36')][_0x2889('0x38')](_0x1aa9b8);})[_0x2889('0x1f')](function(_0x302a45){_0x4d37fb['rows']=_0x302a45;return _0x4d37fb;})[_0x2889('0x1f')](respondWithFilteredResult(_0x128658,_0x1aa9b8))[_0x2889('0x39')](handleError(_0x128658,null));};exports[_0x2889('0x3a')]=function(_0x2c7a67,_0x3185cd){var _0x427205={'raw':!![],'where':{'id':_0x2c7a67[_0x2889('0x3b')]['id']}},_0xbea48e={};_0xbea48e[_0x2889('0x28')]=_[_0x2889('0x3c')](db[_0x2889('0x36')][_0x2889('0x24')]);_0xbea48e['query']=_['keys'](_0x2c7a67[_0x2889('0x29')]);_0xbea48e['filters']=_[_0x2889('0x2b')](_0xbea48e['model'],_0xbea48e[_0x2889('0x29')]);_0x427205['attributes']=_[_0x2889('0x2b')](_0xbea48e[_0x2889('0x28')],qs[_0x2889('0x2d')](_0x2c7a67['query'][_0x2889('0x2d')]));_0x427205['attributes']=_0x427205[_0x2889('0x2c')][_0x2889('0x3d')]?_0x427205[_0x2889('0x2c')]:_0xbea48e[_0x2889('0x28')];if(_0x2c7a67[_0x2889('0x29')]['includeAll']){_0x427205[_0x2889('0x3e')]=[{'all':!![]}];}_0x427205=_[_0x2889('0x34')]({},_0x427205,_0x2c7a67[_0x2889('0x35')]);return db[_0x2889('0x36')][_0x2889('0x3f')](_0x427205)[_0x2889('0x1f')](handleEntityNotFound(_0x3185cd,null))[_0x2889('0x1f')](respondWithResult(_0x3185cd,null))[_0x2889('0x39')](handleError(_0x3185cd,null));};exports[_0x2889('0x40')]=function(_0x2b43de,_0x120ec6){return db[_0x2889('0x36')][_0x2889('0x40')](_0x2b43de[_0x2889('0x41')],{})['then'](respondWithResult(_0x120ec6,0xc9))[_0x2889('0x39')](handleError(_0x120ec6,null));};exports[_0x2889('0x42')]=function(_0x5da4ad,_0x4d35f9){if(_0x5da4ad[_0x2889('0x41')]['id']){delete _0x5da4ad[_0x2889('0x41')]['id'];}return db[_0x2889('0x36')][_0x2889('0x3f')]({'where':{'id':_0x5da4ad[_0x2889('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4d35f9,null))[_0x2889('0x1f')](saveUpdates(_0x5da4ad[_0x2889('0x41')],null))[_0x2889('0x1f')](respondWithResult(_0x4d35f9,null))[_0x2889('0x39')](handleError(_0x4d35f9,null));};exports[_0x2889('0x1e')]=function(_0x5c0a8e,_0x298a39){return db['SmsTransferReport']['find']({'where':{'id':_0x5c0a8e[_0x2889('0x3b')]['id']}})['then'](handleEntityNotFound(_0x298a39,null))['then'](removeEntity(_0x298a39,null))['catch'](handleError(_0x298a39,null));};exports[_0x2889('0x43')]=function(_0x2d3996,_0x58ab89){return db[_0x2889('0x36')][_0x2889('0x43')]()[_0x2889('0x1f')](respondWithResult(_0x58ab89,null))[_0x2889('0x39')](handleError(_0x58ab89,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1e3b734..a84809b 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 _0xafb9=['moment','bluebird','request-promise','path','rimraf','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0xafb9,0x68));var _0x9afb=function(_0x18dda4,_0x4ac941){_0x18dda4=_0x18dda4-0x0;var _0x5d74b7=_0xafb9[_0x18dda4];return _0x5d74b7;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var fs=require('fs');var path=require(_0x9afb('0x7'));var rimraf=require(_0x9afb('0x8'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x9afb('0x9')]=function(_0x56a139,_0x1ccf93){return _0x56a139['define']('SmsTransferReport',attributes,{'tableName':_0x9afb('0xa'),'paranoid':![],'indexes':[{'name':_0x9afb('0xb'),'fields':[_0x9afb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','util','../../config/logger','api','request-promise','rimraf'];(function(_0x584683,_0x46a0a4){var _0x57bbf4=function(_0x3180c6){while(--_0x3180c6){_0x584683['push'](_0x584683['shift']());}};_0x57bbf4(++_0x46a0a4);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x86d3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 74b3e87..65ef9b6 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 _0x497c=['code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55fd40,_0x225b77){var _0x7979f1=function(_0x1d21c1){while(--_0x1d21c1){_0x55fd40['push'](_0x55fd40['shift']());}};_0x7979f1(++_0x225b77);}(_0x497c,0x155));var _0xc497=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x497c[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xc497('0x0'));var util=require(_0xc497('0x1'));var moment=require('moment');var BPromise=require(_0xc497('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc497('0x3'));var db=require(_0xc497('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc497('0x5'))(_0xc497('0x6'));var config=require(_0xc497('0x7'));var jayson=require(_0xc497('0x8'));var client=jayson[_0xc497('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a0b30,_0x2dec4b,_0x55410a){return new BPromise(function(_0x34df36,_0x379929){return client[_0xc497('0xa')](_0x1a0b30,_0x55410a)['then'](function(_0x83a7e8){logger['info'](_0xc497('0xb'),_0x2dec4b,_0xc497('0xc'));logger['debug'](_0xc497('0xd'),_0x2dec4b,_0xc497('0xc'),JSON[_0xc497('0xe')](_0x83a7e8));if(_0x83a7e8[_0xc497('0xf')]){if(_0x83a7e8[_0xc497('0xf')][_0xc497('0x10')]===0x1f4){logger['error'](_0xc497('0xb'),_0x2dec4b,_0x83a7e8[_0xc497('0xf')][_0xc497('0x11')]);return _0x379929(_0x83a7e8['error']['message']);}logger[_0xc497('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x2dec4b,_0x83a7e8[_0xc497('0xf')][_0xc497('0x11')]);return _0x34df36(_0x83a7e8[_0xc497('0xf')][_0xc497('0x11')]);}else{logger[_0xc497('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x2dec4b,_0xc497('0xc'));_0x34df36(_0x83a7e8[_0xc497('0x13')][_0xc497('0x11')]);}})[_0xc497('0x14')](function(_0x2f245c){logger['error'](_0xc497('0xb'),_0x2dec4b,_0x2f245c);_0x379929(_0x2f245c);});});} \ No newline at end of file +var _0x2cd5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment'];(function(_0x4d77d5,_0xf3c18){var _0x4d590d=function(_0xecad69){while(--_0xecad69){_0x4d77d5['push'](_0x4d77d5['shift']());}};_0x4d590d(++_0xf3c18);}(_0x2cd5,0x16d));var _0x52cd=function(_0x4ca502,_0x54660f){_0x4ca502=_0x4ca502-0x0;var _0x4bd119=_0x2cd5[_0x4ca502];return _0x4bd119;};'use strict';var _=require(_0x52cd('0x0'));var util=require(_0x52cd('0x1'));var moment=require(_0x52cd('0x2'));var BPromise=require(_0x52cd('0x3'));var rs=require(_0x52cd('0x4'));var fs=require('fs');var Redis=require(_0x52cd('0x5'));var db=require(_0x52cd('0x6'))['db'];var utils=require(_0x52cd('0x7'));var logger=require(_0x52cd('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x52cd('0x9'));var client=jayson['client'][_0x52cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fc8e8,_0x462c25,_0x5c6d40){return new BPromise(function(_0x56222d,_0x35d7bf){return client[_0x52cd('0xb')](_0x2fc8e8,_0x5c6d40)[_0x52cd('0xc')](function(_0x506706){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x462c25,_0x52cd('0xd'));logger[_0x52cd('0xe')](_0x52cd('0xf'),_0x462c25,_0x52cd('0xd'),JSON[_0x52cd('0x10')](_0x506706));if(_0x506706[_0x52cd('0x11')]){if(_0x506706[_0x52cd('0x11')][_0x52cd('0x12')]===0x1f4){logger['error'](_0x52cd('0x13'),_0x462c25,_0x506706[_0x52cd('0x11')]['message']);return _0x35d7bf(_0x506706[_0x52cd('0x11')][_0x52cd('0x14')]);}logger[_0x52cd('0x11')](_0x52cd('0x13'),_0x462c25,_0x506706[_0x52cd('0x11')]['message']);return _0x56222d(_0x506706[_0x52cd('0x11')][_0x52cd('0x14')]);}else{logger[_0x52cd('0x15')](_0x52cd('0x13'),_0x462c25,'request\x20sent');_0x56222d(_0x506706['result'][_0x52cd('0x14')]);}})[_0x52cd('0x16')](function(_0x566bf4){logger[_0x52cd('0x11')](_0x52cd('0x13'),_0x462c25,_0x566bf4);_0x35d7bf(_0x566bf4);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9c275dc..ab2dac2 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 _0x7c86=['isAuthenticated','index','download','diskStorage','join','root','originalname','format','extname','now','post','single','file','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get'];(function(_0xe1c87f,_0x35000d){var _0x2960ae=function(_0x440103){while(--_0x440103){_0xe1c87f['push'](_0xe1c87f['shift']());}};_0x2960ae(++_0x35000d);}(_0x7c86,0x1a7));var _0x67c8=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7c86[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x67c8('0x0'));var util=require(_0x67c8('0x1'));var path=require(_0x67c8('0x2'));var timeout=require(_0x67c8('0x3'));var express=require(_0x67c8('0x4'));var router=express[_0x67c8('0x5')]();var fs_extra=require(_0x67c8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x67c8('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x67c8('0x8')]('/',auth[_0x67c8('0x9')](),controller[_0x67c8('0xa')]);router[_0x67c8('0x8')]('/:id',auth[_0x67c8('0x9')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x67c8('0xb')]);var upload=multer({'storage':multer[_0x67c8('0xc')]({'destination':function(_0x14da37,_0x257e78,_0x3e15cc){_0x3e15cc(null,path[_0x67c8('0xd')](config[_0x67c8('0xe')],'server/files/sounds/original/'));},'filename':function(_0x37aebf,_0x43f0e0,_0x443570){_0x43f0e0[_0x67c8('0xf')]=_0x43f0e0[_0x67c8('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x443570(null,util[_0x67c8('0x10')]('%s-%s%s',path['basename'](_0x43f0e0[_0x67c8('0xf')],path[_0x67c8('0x11')](_0x43f0e0[_0x67c8('0xf')])),Date[_0x67c8('0x12')](),path[_0x67c8('0x11')](_0x43f0e0[_0x67c8('0xf')])));}})});router[_0x67c8('0x13')]('/',upload[_0x67c8('0x14')](_0x67c8('0x15')),controller[_0x67c8('0x16')]);router['put'](_0x67c8('0x17'),auth[_0x67c8('0x9')](),controller[_0x67c8('0x18')]);router['delete'](_0x67c8('0x17'),auth[_0x67c8('0x9')](),controller[_0x67c8('0x19')]);module[_0x67c8('0x1a')]=router; \ No newline at end of file +var _0xfcba=['Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','now','post','single','file','put','delete','util','path','connect-timeout','express'];(function(_0x10fb03,_0x3d3926){var _0x506f34=function(_0x1e9c87){while(--_0x1e9c87){_0x10fb03['push'](_0x10fb03['shift']());}};_0x506f34(++_0x3d3926);}(_0xfcba,0xb9));var _0xafcb=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xfcba[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require('multer');var util=require(_0xafcb('0x0'));var path=require(_0xafcb('0x1'));var timeout=require(_0xafcb('0x2'));var express=require(_0xafcb('0x3'));var router=express[_0xafcb('0x4')]();var fs_extra=require(_0xafcb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xafcb('0x6'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0xafcb('0x7')](),controller[_0xafcb('0x8')]);router[_0xafcb('0x9')](_0xafcb('0xa'),auth[_0xafcb('0x7')](),controller[_0xafcb('0xb')]);router[_0xafcb('0x9')](_0xafcb('0xc'),auth[_0xafcb('0x7')](),controller[_0xafcb('0xd')]);var upload=multer({'storage':multer[_0xafcb('0xe')]({'destination':function(_0xed0412,_0x164b01,_0x5de24c){_0x5de24c(null,path['join'](config[_0xafcb('0xf')],_0xafcb('0x10')));},'filename':function(_0x3e9037,_0x421f63,_0x46ccc5){_0x421f63[_0xafcb('0x11')]=_0x421f63[_0xafcb('0x11')][_0xafcb('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x46ccc5(null,util[_0xafcb('0x13')](_0xafcb('0x14'),path['basename'](_0x421f63[_0xafcb('0x11')],path['extname'](_0x421f63[_0xafcb('0x11')])),Date[_0xafcb('0x15')](),path['extname'](_0x421f63[_0xafcb('0x11')])));}})});router[_0xafcb('0x16')]('/',upload[_0xafcb('0x17')](_0xafcb('0x18')),controller['create']);router[_0xafcb('0x19')]('/:id',auth[_0xafcb('0x7')](),controller['update']);router[_0xafcb('0x1a')](_0xafcb('0xa'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c0f8eea..71ab944 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 _0x55cc=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x55cc,0x1f3));var _0xc55c=function(_0x5ccfb9,_0x5d4a9d){_0x5ccfb9=_0x5ccfb9-0x0;var _0x1f127d=_0x55cc[_0x5ccfb9];return _0x1f127d;};'use strict';var Sequelize=require(_0xc55c('0x0'));module[_0xc55c('0x1')]={'name':{'type':Sequelize[_0xc55c('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xc55c('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xc55c('0x2')]},'original_format':{'type':Sequelize[_0xc55c('0x2')]},'original_duration':{'type':Sequelize[_0xc55c('0x3')]},'original_sampleCount':{'type':Sequelize[_0xc55c('0x4')]},'original_channelCount':{'type':Sequelize[_0xc55c('0x5')]},'original_bitRate':{'type':Sequelize[_0xc55c('0x4')]},'original_sampleRate':{'type':Sequelize[_0xc55c('0x5')]},'converted_format':{'type':Sequelize[_0xc55c('0x2')]},'converted_duration':{'type':Sequelize[_0xc55c('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xc55c('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xc55c('0x5')]}}; \ No newline at end of file +var _0x0333=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x0333,0x11f));var _0x3033=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0x0333[_0x158a58];return _0x4935d9;};'use strict';var Sequelize=require(_0x3033('0x0'));module['exports']={'name':{'type':Sequelize[_0x3033('0x1')],'unique':_0x3033('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3033('0x1')]},'display_name':{'type':Sequelize[_0x3033('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x3033('0x1')]},'original_format':{'type':Sequelize[_0x3033('0x1')]},'original_duration':{'type':Sequelize[_0x3033('0x3')]},'original_sampleCount':{'type':Sequelize[_0x3033('0x4')]},'original_channelCount':{'type':Sequelize[_0x3033('0x5')]},'original_bitRate':{'type':Sequelize[_0x3033('0x4')]},'original_sampleRate':{'type':Sequelize[_0x3033('0x5')]},'converted_format':{'type':Sequelize[_0x3033('0x1')]},'converted_duration':{'type':Sequelize[_0x3033('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x3033('0x4')]},'converted_channelCount':{'type':Sequelize[_0x3033('0x5')]},'converted_bitRate':{'type':Sequelize[_0x3033('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 37fb4a7..14a0743 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 _0x5d42=['root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','original_format','unlinkSync','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','Sound','fieldName','type','model','map','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','download','save_name','converted_format','join'];(function(_0xdbdae5,_0x379f60){var _0x5b09b2=function(_0x2b9cfd){while(--_0x2b9cfd){_0xdbdae5['push'](_0xdbdae5['shift']());}};_0x5b09b2(++_0x379f60);}(_0x5d42,0xa3));var _0x25d4=function(_0x347cc4,_0x1967e2){_0x347cc4=_0x347cc4-0x0;var _0x3002c3=_0x5d42[_0x347cc4];return _0x3002c3;};'use strict';var emlformat=require(_0x25d4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x25d4('0x1'));var rp=require(_0x25d4('0x2'));var moment=require('moment');var BPromise=require(_0x25d4('0x3'));var Mustache=require(_0x25d4('0x4'));var util=require('util');var path=require(_0x25d4('0x5'));var sox=require(_0x25d4('0x6'));var csv=require(_0x25d4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25d4('0x8'));var _=require(_0x25d4('0x9'));var squel=require(_0x25d4('0xa'));var crypto=require('crypto');var jsforce=require(_0x25d4('0xb'));var deskjs=require(_0x25d4('0xc'));var toCsv=require(_0x25d4('0x7'));var querystring=require('querystring');var Papa=require(_0x25d4('0xd'));var Redis=require('ioredis');var authService=require(_0x25d4('0xe'));var qs=require(_0x25d4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25d4('0x10'));var logger=require(_0x25d4('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x25d4('0x12'));var licenseUtil=require(_0x25d4('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c7e38,_0x43d864){_0x43d864=_0x43d864||0xcc;return function(_0x40b448){if(_0x40b448){return _0x5c7e38[_0x25d4('0x14')](_0x43d864);}return _0x5c7e38['status'](_0x43d864)[_0x25d4('0x15')]();};}function respondWithResult(_0x3e6f87,_0x53fbb5){_0x53fbb5=_0x53fbb5||0xc8;return function(_0xde41c3){if(_0xde41c3){return _0x3e6f87[_0x25d4('0x16')](_0x53fbb5)['json'](_0xde41c3);}};}function respondWithFilteredResult(_0x5078a9,_0x3e7321){return function(_0x376160){if(_0x376160){var _0x7839bf=typeof _0x3e7321[_0x25d4('0x17')]==='undefined'&&typeof _0x3e7321[_0x25d4('0x18')]==='undefined';var _0x8e962b=_0x376160[_0x25d4('0x19')];var _0x507914=_0x7839bf?0x0:_0x3e7321['offset'];var _0x2d3338=_0x7839bf?_0x376160[_0x25d4('0x19')]:_0x3e7321['offset']+_0x3e7321[_0x25d4('0x18')];var _0x138ab2;if(_0x2d3338>=_0x8e962b){_0x2d3338=_0x8e962b;_0x138ab2=0xc8;}else{_0x138ab2=0xce;}_0x5078a9[_0x25d4('0x16')](_0x138ab2);return _0x5078a9[_0x25d4('0x1a')](_0x25d4('0x1b'),_0x507914+'-'+_0x2d3338+'/'+_0x8e962b)[_0x25d4('0x1c')](_0x376160);}return null;};}function patchUpdates(_0x1c0a2e){return function(_0xdf0e79){try{jsonpatch['apply'](_0xdf0e79,_0x1c0a2e,!![]);}catch(_0x2e7358){return BPromise[_0x25d4('0x1d')](_0x2e7358);}return _0xdf0e79[_0x25d4('0x1e')]();};}function saveUpdates(_0x30e429,_0x42880b){return function(_0x1a2086){if(_0x1a2086){return _0x1a2086[_0x25d4('0x1f')](_0x30e429)[_0x25d4('0x20')](function(_0x43e291){return _0x43e291;});}return null;};}function removeEntity(_0x4708a3,_0x2302b2){return function(_0x5bf9f4){if(_0x5bf9f4){return _0x5bf9f4[_0x25d4('0x21')]()['then'](function(){var _0x5f2706=_0x5bf9f4[_0x25d4('0x22')]({'plain':!![]});var _0x52808b=_0x25d4('0x23');return db[_0x25d4('0x24')][_0x25d4('0x21')]({'where':{'type':_0x52808b,'resourceId':_0x5f2706['id']}})[_0x25d4('0x20')](function(){return _0x5bf9f4;});})[_0x25d4('0x20')](function(){_0x4708a3[_0x25d4('0x16')](0xcc)[_0x25d4('0x15')]();});}};}function handleEntityNotFound(_0x17f9d4,_0x4c849e){return function(_0x3af26e){if(!_0x3af26e){_0x17f9d4[_0x25d4('0x14')](0x194);}return _0x3af26e;};}function handleError(_0x58a20c,_0x1384a6){_0x1384a6=_0x1384a6||0x1f4;return function(_0x2715ee){logger[_0x25d4('0x25')](_0x2715ee[_0x25d4('0x26')]);if(_0x2715ee[_0x25d4('0x27')]){delete _0x2715ee['name'];}_0x58a20c[_0x25d4('0x16')](_0x1384a6)[_0x25d4('0x28')](_0x2715ee);};}exports[_0x25d4('0x29')]=function(_0x34eb6f,_0x13a3ea){var _0x2dbfe3={},_0x201261={},_0x37344e={'count':0x0,'rows':[]};var _0x158e5b=_['map'](db[_0x25d4('0x2a')]['rawAttributes'],function(_0x11f48c){return{'name':_0x11f48c[_0x25d4('0x2b')],'type':_0x11f48c[_0x25d4('0x2c')]['key']};});_0x201261[_0x25d4('0x2d')]=_[_0x25d4('0x2e')](_0x158e5b,_0x25d4('0x27'));_0x201261[_0x25d4('0x2f')]=_[_0x25d4('0x30')](_0x34eb6f[_0x25d4('0x2f')]);_0x201261[_0x25d4('0x31')]=_['intersection'](_0x201261[_0x25d4('0x2d')],_0x201261[_0x25d4('0x2f')]);_0x2dbfe3[_0x25d4('0x32')]=_[_0x25d4('0x33')](_0x201261[_0x25d4('0x2d')],qs['fields'](_0x34eb6f[_0x25d4('0x2f')]['fields']));_0x2dbfe3['attributes']=_0x2dbfe3[_0x25d4('0x32')]['length']?_0x2dbfe3[_0x25d4('0x32')]:_0x201261[_0x25d4('0x2d')];if(!_0x34eb6f[_0x25d4('0x2f')][_0x25d4('0x34')](_0x25d4('0x35'))){_0x2dbfe3[_0x25d4('0x18')]=qs['limit'](_0x34eb6f[_0x25d4('0x2f')]['limit']);_0x2dbfe3[_0x25d4('0x17')]=qs['offset'](_0x34eb6f[_0x25d4('0x2f')][_0x25d4('0x17')]);}_0x2dbfe3['order']=qs[_0x25d4('0x36')](_0x34eb6f[_0x25d4('0x2f')][_0x25d4('0x36')]);_0x2dbfe3[_0x25d4('0x37')]=qs[_0x25d4('0x31')](_[_0x25d4('0x38')](_0x34eb6f[_0x25d4('0x2f')],_0x201261[_0x25d4('0x31')]),_0x158e5b);if(_0x34eb6f[_0x25d4('0x2f')][_0x25d4('0x39')]){_0x2dbfe3[_0x25d4('0x37')]=_[_0x25d4('0x3a')](_0x2dbfe3[_0x25d4('0x37')],{'$or':_[_0x25d4('0x2e')](_0x158e5b,function(_0x5bbd77){if(_0x5bbd77[_0x25d4('0x2c')]!==_0x25d4('0x3b')){var _0x4dba52={};_0x4dba52[_0x5bbd77[_0x25d4('0x27')]]={'$like':'%'+_0x34eb6f[_0x25d4('0x2f')][_0x25d4('0x39')]+'%'};return _0x4dba52;}})});}_0x2dbfe3=_['merge']({},_0x2dbfe3,_0x34eb6f[_0x25d4('0x3c')]);var _0x263fa3={'where':_0x2dbfe3['where']};return db['Sound']['count'](_0x263fa3)[_0x25d4('0x20')](function(_0x3831ad){_0x37344e[_0x25d4('0x19')]=_0x3831ad;if(_0x34eb6f['query'][_0x25d4('0x3d')]){_0x2dbfe3[_0x25d4('0x3e')]=[{'all':!![]}];}return db[_0x25d4('0x2a')][_0x25d4('0x3f')](_0x2dbfe3);})[_0x25d4('0x20')](function(_0x21d00e){_0x37344e[_0x25d4('0x40')]=_0x21d00e;return _0x37344e;})['then'](respondWithFilteredResult(_0x13a3ea,_0x2dbfe3))[_0x25d4('0x41')](handleError(_0x13a3ea,null));};exports[_0x25d4('0x42')]=function(_0x5e5326,_0x17413e){var _0x18afb1={'raw':!![],'where':{'id':_0x5e5326[_0x25d4('0x43')]['id']}},_0x1e94e2={};_0x1e94e2['model']=_[_0x25d4('0x30')](db[_0x25d4('0x2a')][_0x25d4('0x44')]);_0x1e94e2[_0x25d4('0x2f')]=_[_0x25d4('0x30')](_0x5e5326['query']);_0x1e94e2[_0x25d4('0x31')]=_[_0x25d4('0x33')](_0x1e94e2[_0x25d4('0x2d')],_0x1e94e2[_0x25d4('0x2f')]);_0x18afb1['attributes']=_[_0x25d4('0x33')](_0x1e94e2[_0x25d4('0x2d')],qs[_0x25d4('0x45')](_0x5e5326[_0x25d4('0x2f')]['fields']));_0x18afb1[_0x25d4('0x32')]=_0x18afb1[_0x25d4('0x32')]['length']?_0x18afb1[_0x25d4('0x32')]:_0x1e94e2[_0x25d4('0x2d')];if(_0x5e5326[_0x25d4('0x2f')][_0x25d4('0x3d')]){_0x18afb1[_0x25d4('0x3e')]=[{'all':!![]}];}_0x18afb1=_[_0x25d4('0x3a')]({},_0x18afb1,_0x5e5326[_0x25d4('0x3c')]);return db[_0x25d4('0x2a')][_0x25d4('0x46')](_0x18afb1)[_0x25d4('0x20')](handleEntityNotFound(_0x17413e,null))[_0x25d4('0x20')](respondWithResult(_0x17413e,null))['catch'](handleError(_0x17413e,null));};exports[_0x25d4('0x47')]=function(_0x4cc42c,_0x3aaa0d,_0x459ed4){return db[_0x25d4('0x2a')][_0x25d4('0x46')]({'where':{'id':_0x4cc42c[_0x25d4('0x43')]['id']},'attributes':[_0x25d4('0x27'),_0x25d4('0x48'),_0x25d4('0x49')],'raw':!![]})[_0x25d4('0x20')](handleEntityNotFound(_0x3aaa0d,null))[_0x25d4('0x20')](function(_0x212e2d){if(_0x212e2d){if(!fs['existsSync'](path[_0x25d4('0x4a')](config[_0x25d4('0x4b')],_0x25d4('0x4c'),_0x212e2d[_0x25d4('0x48')]+'.'+_0x212e2d['converted_format']))){throw new db[(_0x25d4('0x4d'))][(_0x25d4('0x4e'))](_0x25d4('0x4f'));}return _0x3aaa0d[_0x25d4('0x47')](path[_0x25d4('0x4a')](config[_0x25d4('0x4b')],'server/files/sounds/converted',util[_0x25d4('0x50')]('%s.%s',_0x212e2d[_0x25d4('0x48')],_0x212e2d[_0x25d4('0x49')])),util[_0x25d4('0x50')]('%s.%s',_0x212e2d[_0x25d4('0x27')],_0x212e2d[_0x25d4('0x49')]));}return null;})[_0x25d4('0x41')](handleError(_0x3aaa0d,null));};exports[_0x25d4('0x51')]=function(_0x4304e8,_0x23e1ff,_0x25a236){var _0x251e8d={'name':path[_0x25d4('0x52')](_0x4304e8[_0x25d4('0x53')][_0x25d4('0x54')],path[_0x25d4('0x55')](_0x4304e8[_0x25d4('0x53')][_0x25d4('0x54')])),'save_name':path[_0x25d4('0x52')](_0x4304e8[_0x25d4('0x53')][_0x25d4('0x56')],path[_0x25d4('0x55')](_0x4304e8[_0x25d4('0x53')]['filename'])),'original_format':path[_0x25d4('0x55')](_0x4304e8['file']['originalname'])[_0x25d4('0x57')](0x1),'converted_format':'wav'};var _0x10c4c5=path['join'](config['root'],_0x25d4('0x58'),_0x4304e8['file']['filename']);var _0x1a9c66=path[_0x25d4('0x4a')](config[_0x25d4('0x4b')],'server/files/sounds/converted',util[_0x25d4('0x50')](_0x25d4('0x59'),path['basename'](_0x4304e8['file'][_0x25d4('0x56')],path[_0x25d4('0x55')](_0x4304e8[_0x25d4('0x53')][_0x25d4('0x56')])),_0x251e8d[_0x25d4('0x49')]));logger[_0x25d4('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x10c4c5);logger['info'](_0x25d4('0x5b'),_0x1a9c66);try{fs[_0x25d4('0x5c')](_0x10c4c5,parseInt(_0x25d4('0x5d'),0x8));var _0x2431c4=sox[_0x25d4('0x5e')](_0x10c4c5,_0x1a9c66,{'sampleRate':0x1f40,'format':_0x25d4('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2431c4['on'](_0x25d4('0x25'),function(_0x4ad5e7){fs['unlinkSync'](_0x10c4c5);_0x23e1ff[_0x25d4('0x16')](0x1f4)[_0x25d4('0x28')](_0x4ad5e7);});_0x2431c4['on']('src',function(_0x1765aa){_0x251e8d[_0x25d4('0x60')]=isNaN(_0x1765aa['duration'])?null:_0x1765aa[_0x25d4('0x61')]*0x3e8;_0x251e8d[_0x25d4('0x62')]=isNaN(_0x1765aa[_0x25d4('0x63')])?null:_0x1765aa[_0x25d4('0x63')];_0x251e8d[_0x25d4('0x64')]=isNaN(_0x1765aa[_0x25d4('0x65')])?null:_0x1765aa[_0x25d4('0x65')];_0x251e8d[_0x25d4('0x66')]=isNaN(_0x1765aa['bitRate'])?null:_0x1765aa['bitRate'];_0x251e8d[_0x25d4('0x67')]=isNaN(_0x1765aa[_0x25d4('0x68')])?null:_0x1765aa[_0x25d4('0x68')];});_0x2431c4['on'](_0x25d4('0x69'),function(_0x33f7a3){_0x251e8d[_0x25d4('0x6a')]=isNaN(_0x33f7a3['duration'])?null:_0x33f7a3[_0x25d4('0x61')]*0x3e8;_0x251e8d[_0x25d4('0x6b')]=isNaN(_0x33f7a3[_0x25d4('0x63')])?null:_0x33f7a3[_0x25d4('0x63')];_0x251e8d['converted_channelCount']=isNaN(_0x33f7a3[_0x25d4('0x65')])?null:_0x33f7a3[_0x25d4('0x65')];_0x251e8d[_0x25d4('0x6c')]=isNaN(_0x33f7a3[_0x25d4('0x6d')])?null:_0x33f7a3[_0x25d4('0x6d')];_0x251e8d[_0x25d4('0x6e')]=isNaN(_0x33f7a3['sampleRate'])?null:_0x33f7a3[_0x25d4('0x68')];});_0x2431c4['on']('end',function(){fs[_0x25d4('0x5c')](_0x1a9c66,parseInt('0777',0x8));return db[_0x25d4('0x2a')]['create'](_0x251e8d)[_0x25d4('0x20')](function(_0x553e72){var _0x483ca1={'role':_0x4304e8[_0x25d4('0x6f')]['role'],'userProfileId':_0x4304e8[_0x25d4('0x6f')]['userProfileId']};if(!_0x483ca1)throw new Error(_0x25d4('0x70'));if(_0x483ca1['role']==='user'){var _0x2b9e3a=_0x553e72[_0x25d4('0x22')]({'plain':!![]});return db[_0x25d4('0x71')]['find']({'where':{'name':'Sounds','userProfileId':_0x483ca1['userProfileId']},'raw':!![]})[_0x25d4('0x20')](function(_0x53d339){if(_0x53d339&&_0x53d339[_0x25d4('0x72')]===0x0){return db['UserProfileResource'][_0x25d4('0x51')]({'name':_0x2b9e3a[_0x25d4('0x27')],'resourceId':_0x2b9e3a['id'],'type':_0x53d339['name'],'sectionId':_0x53d339['id']},{})['then'](function(){return _0x553e72;});}else{return _0x553e72;}})[_0x25d4('0x41')](function(_0x3e83f1){logger[_0x25d4('0x25')](_0x25d4('0x73'),_0x3e83f1);throw _0x3e83f1;});}return _0x553e72;})[_0x25d4('0x20')](respondWithResult(_0x23e1ff,null))[_0x25d4('0x41')](handleError(_0x23e1ff,null));});_0x2431c4['start']();}catch(_0x85597a){_0x23e1ff[_0x25d4('0x16')](0x1f4)['send'](_0x85597a);}};exports[_0x25d4('0x1f')]=function(_0xd5d55c,_0x180db8,_0x5a61c1){return db[_0x25d4('0x2a')][_0x25d4('0x46')]({'where':{'id':_0xd5d55c[_0x25d4('0x43')]['id']}})[_0x25d4('0x20')](handleEntityNotFound(_0x180db8,null))[_0x25d4('0x20')](saveUpdates(_[_0x25d4('0x38')](_0xd5d55c[_0x25d4('0x6f')],['name',_0x25d4('0x74')]),null))[_0x25d4('0x20')](respondWithResult(_0x180db8,null))[_0x25d4('0x41')](handleError(_0x180db8,null));};exports['delete']=function(_0x628f0f,_0x178539,_0x5b7510){return db[_0x25d4('0x2a')][_0x25d4('0x46')]({'where':{'id':_0x628f0f['params']['id']}})['then'](function(_0x891fff){if(_0x891fff){return _0x891fff[_0x25d4('0x21')]();}})[_0x25d4('0x20')](function(_0x3d4a9d){var _0x5c7d81=path[_0x25d4('0x4a')](config[_0x25d4('0x4b')],_0x25d4('0x58'),util[_0x25d4('0x50')](_0x25d4('0x59'),_0x3d4a9d[_0x25d4('0x48')],_0x3d4a9d[_0x25d4('0x75')]));var _0x7aece0=path[_0x25d4('0x4a')](config[_0x25d4('0x4b')],_0x25d4('0x4c'),util['format'](_0x25d4('0x59'),_0x3d4a9d['save_name'],_0x3d4a9d[_0x25d4('0x49')]));fs[_0x25d4('0x76')](_0x5c7d81);fs[_0x25d4('0x76')](_0x7aece0);return _0x3d4a9d;})[_0x25d4('0x20')](function(_0x58ab6f){if(_0x58ab6f){return _0x178539[_0x25d4('0x16')](0xcc)[_0x25d4('0x15')]();}})[_0x25d4('0x20')](handleEntityNotFound(_0x178539,null))[_0x25d4('0x41')](handleError(_0x178539,null));}; \ No newline at end of file +var _0x8599=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','reject','update','then','destroy','get','Sounds','error','name','send','index','Sound','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','download','save_name','converted_format','join','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','to-csv','fs-extra','squel','crypto','desk.js','ioredis'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x8599,0x159));var _0x9859=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8599[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x9859('0x0'));var rimraf=require(_0x9859('0x1'));var zipdir=require(_0x9859('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9859('0x3'));var moment=require(_0x9859('0x4'));var BPromise=require(_0x9859('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9859('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9859('0x7'));var _=require('lodash');var squel=require(_0x9859('0x8'));var crypto=require(_0x9859('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9859('0xa'));var toCsv=require(_0x9859('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9859('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x9859('0xc'));var as=require(_0x9859('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9859('0xe'))(_0x9859('0xf'));var utils=require(_0x9859('0x10'));var config=require(_0x9859('0x11'));var licenseUtil=require(_0x9859('0x12'));var db=require(_0x9859('0x13'))['db'];function respondWithStatusCode(_0x1cbf54,_0x41fb40){_0x41fb40=_0x41fb40||0xcc;return function(_0x18c893){if(_0x18c893){return _0x1cbf54[_0x9859('0x14')](_0x41fb40);}return _0x1cbf54[_0x9859('0x15')](_0x41fb40)[_0x9859('0x16')]();};}function respondWithResult(_0x36a8a2,_0x29c82b){_0x29c82b=_0x29c82b||0xc8;return function(_0x2f199b){if(_0x2f199b){return _0x36a8a2['status'](_0x29c82b)['json'](_0x2f199b);}};}function respondWithFilteredResult(_0x4e46a2,_0x572c52){return function(_0x1c85a1){if(_0x1c85a1){var _0x47a051=typeof _0x572c52['offset']===_0x9859('0x17')&&typeof _0x572c52['limit']===_0x9859('0x17');var _0x356a89=_0x1c85a1[_0x9859('0x18')];var _0x35c3f9=_0x47a051?0x0:_0x572c52[_0x9859('0x19')];var _0x2aecb5=_0x47a051?_0x1c85a1[_0x9859('0x18')]:_0x572c52[_0x9859('0x19')]+_0x572c52[_0x9859('0x1a')];var _0x500005;if(_0x2aecb5>=_0x356a89){_0x2aecb5=_0x356a89;_0x500005=0xc8;}else{_0x500005=0xce;}_0x4e46a2[_0x9859('0x15')](_0x500005);return _0x4e46a2['set'](_0x9859('0x1b'),_0x35c3f9+'-'+_0x2aecb5+'/'+_0x356a89)[_0x9859('0x1c')](_0x1c85a1);}return null;};}function patchUpdates(_0x582446){return function(_0x2b9adb){try{jsonpatch['apply'](_0x2b9adb,_0x582446,!![]);}catch(_0x5b8f3c){return BPromise[_0x9859('0x1d')](_0x5b8f3c);}return _0x2b9adb['save']();};}function saveUpdates(_0x541917,_0x1063cf){return function(_0x53a6f0){if(_0x53a6f0){return _0x53a6f0[_0x9859('0x1e')](_0x541917)[_0x9859('0x1f')](function(_0x51e87b){return _0x51e87b;});}return null;};}function removeEntity(_0x5eb2c9,_0x32e6b2){return function(_0x572ef6){if(_0x572ef6){return _0x572ef6[_0x9859('0x20')]()['then'](function(){var _0x77fd45=_0x572ef6[_0x9859('0x21')]({'plain':!![]});var _0x4e382d=_0x9859('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e382d,'resourceId':_0x77fd45['id']}})[_0x9859('0x1f')](function(){return _0x572ef6;});})['then'](function(){_0x5eb2c9[_0x9859('0x15')](0xcc)[_0x9859('0x16')]();});}};}function handleEntityNotFound(_0x39e080,_0x5a5dd7){return function(_0x6367ad){if(!_0x6367ad){_0x39e080[_0x9859('0x14')](0x194);}return _0x6367ad;};}function handleError(_0x36440e,_0xfc6aa8){_0xfc6aa8=_0xfc6aa8||0x1f4;return function(_0x5f0422){logger[_0x9859('0x23')](_0x5f0422['stack']);if(_0x5f0422['name']){delete _0x5f0422[_0x9859('0x24')];}_0x36440e['status'](_0xfc6aa8)[_0x9859('0x25')](_0x5f0422);};}exports[_0x9859('0x26')]=function(_0x34212b,_0x468223){var _0x7d2c7e={},_0x4c82a0={},_0x3ad5a2={'count':0x0,'rows':[]};var _0x18d132=_['map'](db[_0x9859('0x27')][_0x9859('0x28')],function(_0x52b5e3){return{'name':_0x52b5e3[_0x9859('0x29')],'type':_0x52b5e3[_0x9859('0x2a')][_0x9859('0x2b')]};});_0x4c82a0['model']=_[_0x9859('0x2c')](_0x18d132,_0x9859('0x24'));_0x4c82a0[_0x9859('0x2d')]=_[_0x9859('0x2e')](_0x34212b['query']);_0x4c82a0['filters']=_[_0x9859('0x2f')](_0x4c82a0[_0x9859('0x30')],_0x4c82a0[_0x9859('0x2d')]);_0x7d2c7e['attributes']=_[_0x9859('0x2f')](_0x4c82a0[_0x9859('0x30')],qs[_0x9859('0x31')](_0x34212b[_0x9859('0x2d')]['fields']));_0x7d2c7e[_0x9859('0x32')]=_0x7d2c7e[_0x9859('0x32')][_0x9859('0x33')]?_0x7d2c7e[_0x9859('0x32')]:_0x4c82a0[_0x9859('0x30')];if(!_0x34212b[_0x9859('0x2d')][_0x9859('0x34')](_0x9859('0x35'))){_0x7d2c7e[_0x9859('0x1a')]=qs[_0x9859('0x1a')](_0x34212b[_0x9859('0x2d')][_0x9859('0x1a')]);_0x7d2c7e[_0x9859('0x19')]=qs[_0x9859('0x19')](_0x34212b[_0x9859('0x2d')]['offset']);}_0x7d2c7e[_0x9859('0x36')]=qs[_0x9859('0x37')](_0x34212b[_0x9859('0x2d')][_0x9859('0x37')]);_0x7d2c7e[_0x9859('0x38')]=qs[_0x9859('0x39')](_[_0x9859('0x3a')](_0x34212b[_0x9859('0x2d')],_0x4c82a0[_0x9859('0x39')]),_0x18d132);if(_0x34212b[_0x9859('0x2d')][_0x9859('0x3b')]){_0x7d2c7e['where']=_[_0x9859('0x3c')](_0x7d2c7e[_0x9859('0x38')],{'$or':_[_0x9859('0x2c')](_0x18d132,function(_0x2a95c7){if(_0x2a95c7[_0x9859('0x2a')]!==_0x9859('0x3d')){var _0x5caa38={};_0x5caa38[_0x2a95c7[_0x9859('0x24')]]={'$like':'%'+_0x34212b[_0x9859('0x2d')][_0x9859('0x3b')]+'%'};return _0x5caa38;}})});}_0x7d2c7e=_[_0x9859('0x3c')]({},_0x7d2c7e,_0x34212b['options']);var _0x11d87c={'where':_0x7d2c7e[_0x9859('0x38')]};return db[_0x9859('0x27')]['count'](_0x11d87c)['then'](function(_0x12f433){_0x3ad5a2[_0x9859('0x18')]=_0x12f433;if(_0x34212b[_0x9859('0x2d')][_0x9859('0x3e')]){_0x7d2c7e['include']=[{'all':!![]}];}return db[_0x9859('0x27')]['findAll'](_0x7d2c7e);})[_0x9859('0x1f')](function(_0x74b63a){_0x3ad5a2[_0x9859('0x3f')]=_0x74b63a;return _0x3ad5a2;})[_0x9859('0x1f')](respondWithFilteredResult(_0x468223,_0x7d2c7e))[_0x9859('0x40')](handleError(_0x468223,null));};exports[_0x9859('0x41')]=function(_0x1bb93e,_0x4a1f1f){var _0x424ede={'raw':!![],'where':{'id':_0x1bb93e[_0x9859('0x42')]['id']}},_0x213676={};_0x213676[_0x9859('0x30')]=_['keys'](db[_0x9859('0x27')]['rawAttributes']);_0x213676[_0x9859('0x2d')]=_[_0x9859('0x2e')](_0x1bb93e[_0x9859('0x2d')]);_0x213676[_0x9859('0x39')]=_[_0x9859('0x2f')](_0x213676[_0x9859('0x30')],_0x213676[_0x9859('0x2d')]);_0x424ede['attributes']=_[_0x9859('0x2f')](_0x213676[_0x9859('0x30')],qs[_0x9859('0x31')](_0x1bb93e[_0x9859('0x2d')][_0x9859('0x31')]));_0x424ede[_0x9859('0x32')]=_0x424ede[_0x9859('0x32')]['length']?_0x424ede[_0x9859('0x32')]:_0x213676[_0x9859('0x30')];if(_0x1bb93e[_0x9859('0x2d')][_0x9859('0x3e')]){_0x424ede[_0x9859('0x43')]=[{'all':!![]}];}_0x424ede=_[_0x9859('0x3c')]({},_0x424ede,_0x1bb93e[_0x9859('0x44')]);return db[_0x9859('0x27')][_0x9859('0x45')](_0x424ede)[_0x9859('0x1f')](handleEntityNotFound(_0x4a1f1f,null))[_0x9859('0x1f')](respondWithResult(_0x4a1f1f,null))[_0x9859('0x40')](handleError(_0x4a1f1f,null));};exports[_0x9859('0x46')]=function(_0x141733,_0x4ff836,_0x590134){return db[_0x9859('0x27')][_0x9859('0x45')]({'where':{'id':_0x141733['params']['id']},'attributes':[_0x9859('0x24'),_0x9859('0x47'),_0x9859('0x48')],'raw':!![]})[_0x9859('0x1f')](handleEntityNotFound(_0x4ff836,null))['then'](function(_0x45a0e1){if(_0x45a0e1){if(!fs['existsSync'](path[_0x9859('0x49')](config['root'],_0x9859('0x4a'),_0x45a0e1['save_name']+'.'+_0x45a0e1[_0x9859('0x48')]))){throw new db['Sequelize'][(_0x9859('0x4b'))](_0x9859('0x4c'));}return _0x4ff836[_0x9859('0x46')](path[_0x9859('0x49')](config[_0x9859('0x4d')],_0x9859('0x4a'),util[_0x9859('0x4e')]('%s.%s',_0x45a0e1['save_name'],_0x45a0e1['converted_format'])),util[_0x9859('0x4e')](_0x9859('0x4f'),_0x45a0e1[_0x9859('0x24')],_0x45a0e1[_0x9859('0x48')]));}return null;})[_0x9859('0x40')](handleError(_0x4ff836,null));};exports[_0x9859('0x50')]=function(_0x1d14ff,_0x37d50f,_0x4300a5){var _0x963761={'name':path[_0x9859('0x51')](_0x1d14ff[_0x9859('0x52')][_0x9859('0x53')],path[_0x9859('0x54')](_0x1d14ff[_0x9859('0x52')][_0x9859('0x53')])),'save_name':path['basename'](_0x1d14ff['file'][_0x9859('0x55')],path[_0x9859('0x54')](_0x1d14ff[_0x9859('0x52')][_0x9859('0x55')])),'original_format':path[_0x9859('0x54')](_0x1d14ff['file'][_0x9859('0x53')])[_0x9859('0x56')](0x1),'converted_format':_0x9859('0x57')};var _0x1958f7=path[_0x9859('0x49')](config[_0x9859('0x4d')],_0x9859('0x58'),_0x1d14ff[_0x9859('0x52')]['filename']);var _0x1011b9=path[_0x9859('0x49')](config[_0x9859('0x4d')],'server/files/sounds/converted',util[_0x9859('0x4e')](_0x9859('0x4f'),path['basename'](_0x1d14ff[_0x9859('0x52')]['filename'],path['extname'](_0x1d14ff[_0x9859('0x52')]['filename'])),_0x963761[_0x9859('0x48')]));logger[_0x9859('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x1958f7);logger[_0x9859('0x59')](_0x9859('0x5a'),_0x1011b9);try{fs[_0x9859('0x5b')](_0x1958f7,parseInt(_0x9859('0x5c'),0x8));var _0x224df1=sox[_0x9859('0x5d')](_0x1958f7,_0x1011b9,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x224df1['on'](_0x9859('0x23'),function(_0x26ce15){fs[_0x9859('0x5e')](_0x1958f7);_0x37d50f[_0x9859('0x15')](0x1f4)[_0x9859('0x25')](_0x26ce15);});_0x224df1['on'](_0x9859('0x5f'),function(_0x375a66){_0x963761[_0x9859('0x60')]=isNaN(_0x375a66[_0x9859('0x61')])?null:_0x375a66['duration']*0x3e8;_0x963761[_0x9859('0x62')]=isNaN(_0x375a66[_0x9859('0x63')])?null:_0x375a66[_0x9859('0x63')];_0x963761[_0x9859('0x64')]=isNaN(_0x375a66[_0x9859('0x65')])?null:_0x375a66[_0x9859('0x65')];_0x963761[_0x9859('0x66')]=isNaN(_0x375a66[_0x9859('0x67')])?null:_0x375a66['bitRate'];_0x963761[_0x9859('0x68')]=isNaN(_0x375a66[_0x9859('0x69')])?null:_0x375a66[_0x9859('0x69')];});_0x224df1['on'](_0x9859('0x6a'),function(_0x19f007){_0x963761[_0x9859('0x6b')]=isNaN(_0x19f007['duration'])?null:_0x19f007['duration']*0x3e8;_0x963761['converted_sampleCount']=isNaN(_0x19f007[_0x9859('0x63')])?null:_0x19f007[_0x9859('0x63')];_0x963761[_0x9859('0x6c')]=isNaN(_0x19f007[_0x9859('0x65')])?null:_0x19f007[_0x9859('0x65')];_0x963761[_0x9859('0x6d')]=isNaN(_0x19f007[_0x9859('0x67')])?null:_0x19f007[_0x9859('0x67')];_0x963761[_0x9859('0x6e')]=isNaN(_0x19f007[_0x9859('0x69')])?null:_0x19f007[_0x9859('0x69')];});_0x224df1['on'](_0x9859('0x16'),function(){fs['chmodSync'](_0x1011b9,parseInt(_0x9859('0x5c'),0x8));return db[_0x9859('0x27')][_0x9859('0x50')](_0x963761)['then'](function(_0x3c12d1){var _0x5cb8c7={'role':_0x1d14ff[_0x9859('0x6f')][_0x9859('0x70')],'userProfileId':_0x1d14ff[_0x9859('0x6f')][_0x9859('0x71')]};if(!_0x5cb8c7)throw new Error(_0x9859('0x72'));if(_0x5cb8c7['role']==='user'){var _0x1a5b74=_0x3c12d1['get']({'plain':!![]});return db['UserProfileSection'][_0x9859('0x45')]({'where':{'name':_0x9859('0x22'),'userProfileId':_0x5cb8c7[_0x9859('0x71')]},'raw':!![]})[_0x9859('0x1f')](function(_0x65448e){if(_0x65448e&&_0x65448e[_0x9859('0x73')]===0x0){return db['UserProfileResource'][_0x9859('0x50')]({'name':_0x1a5b74['name'],'resourceId':_0x1a5b74['id'],'type':_0x65448e['name'],'sectionId':_0x65448e['id']},{})[_0x9859('0x1f')](function(){return _0x3c12d1;});}else{return _0x3c12d1;}})[_0x9859('0x40')](function(_0x1cab21){logger[_0x9859('0x23')](_0x9859('0x74'),_0x1cab21);throw _0x1cab21;});}return _0x3c12d1;})[_0x9859('0x1f')](respondWithResult(_0x37d50f,null))[_0x9859('0x40')](handleError(_0x37d50f,null));});_0x224df1['start']();}catch(_0x137089){_0x37d50f[_0x9859('0x15')](0x1f4)[_0x9859('0x25')](_0x137089);}};exports[_0x9859('0x1e')]=function(_0x1732b3,_0x21b46b,_0x56d57c){return db['Sound'][_0x9859('0x45')]({'where':{'id':_0x1732b3['params']['id']}})[_0x9859('0x1f')](handleEntityNotFound(_0x21b46b,null))['then'](saveUpdates(_[_0x9859('0x3a')](_0x1732b3['body'],[_0x9859('0x24'),'description']),null))[_0x9859('0x1f')](respondWithResult(_0x21b46b,null))['catch'](handleError(_0x21b46b,null));};exports[_0x9859('0x75')]=function(_0x4266f8,_0x46459f,_0x12711e){return db[_0x9859('0x27')][_0x9859('0x45')]({'where':{'id':_0x4266f8[_0x9859('0x42')]['id']}})[_0x9859('0x1f')](function(_0x39ee15){if(_0x39ee15){return _0x39ee15[_0x9859('0x20')]();}})['then'](function(_0x4c77f2){var _0x2b38ec=path['join'](config['root'],_0x9859('0x58'),util['format'](_0x9859('0x4f'),_0x4c77f2['save_name'],_0x4c77f2[_0x9859('0x76')]));var _0x47dee0=path['join'](config[_0x9859('0x4d')],_0x9859('0x4a'),util[_0x9859('0x4e')](_0x9859('0x4f'),_0x4c77f2[_0x9859('0x47')],_0x4c77f2[_0x9859('0x48')]));fs[_0x9859('0x5e')](_0x2b38ec);fs['unlinkSync'](_0x47dee0);return _0x4c77f2;})[_0x9859('0x1f')](function(_0x286a23){if(_0x286a23){return _0x46459f[_0x9859('0x15')](0xcc)[_0x9859('0x16')]();}})[_0x9859('0x1f')](handleEntityNotFound(_0x46459f,null))[_0x9859('0x40')](handleError(_0x46459f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a8bfe7a..b096de9 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 _0x7454=['exports','define','Sound','tools_sounds','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes'];(function(_0x39554a,_0x94a3b1){var _0x1378a5=function(_0x4670d6){while(--_0x4670d6){_0x39554a['push'](_0x39554a['shift']());}};_0x1378a5(++_0x94a3b1);}(_0x7454,0x1d8));var _0x4745=function(_0x2584bc,_0x35d9f5){_0x2584bc=_0x2584bc-0x0;var _0x405f2c=_0x7454[_0x2584bc];return _0x405f2c;};'use strict';var _=require(_0x4745('0x0'));var util=require(_0x4745('0x1'));var logger=require('../../config/logger')(_0x4745('0x2'));var moment=require(_0x4745('0x3'));var BPromise=require(_0x4745('0x4'));var rp=require(_0x4745('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4745('0x6'));var config=require(_0x4745('0x7'));var attributes=require(_0x4745('0x8'));module[_0x4745('0x9')]=function(_0x5e6dc8,_0x4ccc2a){return _0x5e6dc8[_0x4745('0xa')](_0x4745('0xb'),attributes,{'tableName':_0x4745('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash'];(function(_0x368322,_0x15dc23){var _0x56bdd9=function(_0x2f416e){while(--_0x2f416e){_0x368322['push'](_0x368322['shift']());}};_0x56bdd9(++_0x15dc23);}(_0x0b0e,0xb5));var _0xe0b0=function(_0x1d006a,_0x2812b5){_0x1d006a=_0x1d006a-0x0;var _0x20a76b=_0x0b0e[_0x1d006a];return _0x20a76b;};'use strict';var _=require(_0xe0b0('0x0'));var util=require(_0xe0b0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x1f8a90,_0x315891){return _0x1f8a90[_0xe0b0('0xa')](_0xe0b0('0xb'),attributes,{'tableName':_0xe0b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 9d8246c..caf79e4 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 _0x4579=['../../config/logger','rpc','jayson/promise','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','ShowSound','Sound','options','raw','where','map','include','model','attributes','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1fae9d,_0x1bde38){var _0x345c5e=function(_0x25fa69){while(--_0x25fa69){_0x1fae9d['push'](_0x1fae9d['shift']());}};_0x345c5e(++_0x1bde38);}(_0x4579,0xd8));var _0x9457=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4579[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9457('0x0'));var util=require(_0x9457('0x1'));var moment=require(_0x9457('0x2'));var BPromise=require(_0x9457('0x3'));var rs=require(_0x9457('0x4'));var fs=require('fs');var Redis=require(_0x9457('0x5'));var db=require(_0x9457('0x6'))['db'];var utils=require(_0x9457('0x7'));var logger=require(_0x9457('0x8'))(_0x9457('0x9'));var config=require('../../config/environment');var jayson=require(_0x9457('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fad0b,_0x1d2374,_0x18d36e){return new BPromise(function(_0x579a0f,_0x55f88b){return client[_0x9457('0xb')](_0x2fad0b,_0x18d36e)[_0x9457('0xc')](function(_0x40494b){logger[_0x9457('0xd')](_0x9457('0xe'),_0x1d2374,_0x9457('0xf'));logger[_0x9457('0x10')](_0x9457('0x11'),_0x1d2374,_0x9457('0xf'),JSON['stringify'](_0x40494b));if(_0x40494b['error']){if(_0x40494b[_0x9457('0x12')][_0x9457('0x13')]===0x1f4){logger[_0x9457('0x12')]('Sound,\x20%s,\x20%s',_0x1d2374,_0x40494b[_0x9457('0x12')][_0x9457('0x14')]);return _0x55f88b(_0x40494b['error'][_0x9457('0x14')]);}logger['error']('Sound,\x20%s,\x20%s',_0x1d2374,_0x40494b[_0x9457('0x12')][_0x9457('0x14')]);return _0x579a0f(_0x40494b[_0x9457('0x12')][_0x9457('0x14')]);}else{logger['info'](_0x9457('0xe'),_0x1d2374,_0x9457('0xf'));_0x579a0f(_0x40494b['result'][_0x9457('0x14')]);}})['catch'](function(_0x10df2c){logger[_0x9457('0x12')]('Sound,\x20%s,\x20%s',_0x1d2374,_0x10df2c);_0x55f88b(_0x10df2c);});});}exports[_0x9457('0x15')]=function(_0x3b532a){var _0x590eca=this;return new Promise(function(_0x463eb4,_0x1372bc){return db[_0x9457('0x16')]['find']({'raw':_0x3b532a['options']?_0x3b532a[_0x9457('0x17')][_0x9457('0x18')]===undefined?!![]:![]:!![],'where':_0x3b532a[_0x9457('0x17')]?_0x3b532a[_0x9457('0x17')][_0x9457('0x19')]||null:null,'attributes':_0x3b532a['options']?_0x3b532a[_0x9457('0x17')]['attributes']||null:null,'include':_0x3b532a[_0x9457('0x17')]?_0x3b532a['options']['include']?_[_0x9457('0x1a')](_0x3b532a[_0x9457('0x17')][_0x9457('0x1b')],function(_0x4ef816){return{'model':db[_0x4ef816[_0x9457('0x1c')]],'as':_0x4ef816['as'],'attributes':_0x4ef816[_0x9457('0x1d')],'include':_0x4ef816[_0x9457('0x1b')]?_[_0x9457('0x1a')](_0x4ef816['include'],function(_0x4d9c16){return{'model':db[_0x4d9c16['model']],'as':_0x4d9c16['as'],'attributes':_0x4d9c16['attributes'],'include':_0x4d9c16[_0x9457('0x1b')]?_['map'](_0x4d9c16[_0x9457('0x1b')],function(_0x4668c9){return{'model':db[_0x4668c9[_0x9457('0x1c')]],'as':_0x4668c9['as'],'attributes':_0x4668c9[_0x9457('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5996bf){logger[_0x9457('0xd')](_0x9457('0x15'),_0x3b532a);logger[_0x9457('0x10')](_0x9457('0x15'),_0x3b532a,JSON[_0x9457('0x1e')](_0x5996bf));_0x463eb4(_0x5996bf);})[_0x9457('0x1f')](function(_0x24c10e){logger[_0x9457('0x12')](_0x9457('0x15'),_0x24c10e[_0x9457('0x14')],_0x3b532a);_0x1372bc(_0x590eca[_0x9457('0x12')](0x1f4,_0x24c10e['message']));});});}; \ No newline at end of file +var _0xaf43=['then','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','Sound','options','where','include','model','attributes','map'];(function(_0x11062a,_0x286e8d){var _0x511a54=function(_0x36207a){while(--_0x36207a){_0x11062a['push'](_0x11062a['shift']());}};_0x511a54(++_0x286e8d);}(_0xaf43,0x1c4));var _0x3af4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaf43[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3af4('0x0'));var moment=require(_0x3af4('0x1'));var BPromise=require(_0x3af4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3af4('0x3'));var db=require(_0x3af4('0x4'))['db'];var utils=require(_0x3af4('0x5'));var logger=require('../../config/logger')(_0x3af4('0x6'));var config=require('../../config/environment');var jayson=require(_0x3af4('0x7'));var client=jayson[_0x3af4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21705b,_0x495b3e,_0x9c74e0){return new BPromise(function(_0x446a62,_0x25fba1){return client[_0x3af4('0x9')](_0x21705b,_0x9c74e0)['then'](function(_0x5b9b2b){logger[_0x3af4('0xa')](_0x3af4('0xb'),_0x495b3e,_0x3af4('0xc'));logger[_0x3af4('0xd')](_0x3af4('0xe'),_0x495b3e,_0x3af4('0xc'),JSON['stringify'](_0x5b9b2b));if(_0x5b9b2b['error']){if(_0x5b9b2b[_0x3af4('0xf')][_0x3af4('0x10')]===0x1f4){logger['error'](_0x3af4('0xb'),_0x495b3e,_0x5b9b2b[_0x3af4('0xf')][_0x3af4('0x11')]);return _0x25fba1(_0x5b9b2b[_0x3af4('0xf')]['message']);}logger['error'](_0x3af4('0xb'),_0x495b3e,_0x5b9b2b[_0x3af4('0xf')][_0x3af4('0x11')]);return _0x446a62(_0x5b9b2b['error'][_0x3af4('0x11')]);}else{logger[_0x3af4('0xa')](_0x3af4('0xb'),_0x495b3e,_0x3af4('0xc'));_0x446a62(_0x5b9b2b[_0x3af4('0x12')]['message']);}})[_0x3af4('0x13')](function(_0x38c689){logger[_0x3af4('0xf')]('Sound,\x20%s,\x20%s',_0x495b3e,_0x38c689);_0x25fba1(_0x38c689);});});}exports[_0x3af4('0x14')]=function(_0x30b4a3){var _0x2fe9fb=this;return new Promise(function(_0x4e5302,_0x45214a){return db[_0x3af4('0x15')]['find']({'raw':_0x30b4a3['options']?_0x30b4a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x30b4a3[_0x3af4('0x16')]?_0x30b4a3[_0x3af4('0x16')][_0x3af4('0x17')]||null:null,'attributes':_0x30b4a3[_0x3af4('0x16')]?_0x30b4a3[_0x3af4('0x16')]['attributes']||null:null,'include':_0x30b4a3[_0x3af4('0x16')]?_0x30b4a3[_0x3af4('0x16')][_0x3af4('0x18')]?_['map'](_0x30b4a3['options'][_0x3af4('0x18')],function(_0x2e9dbd){return{'model':db[_0x2e9dbd[_0x3af4('0x19')]],'as':_0x2e9dbd['as'],'attributes':_0x2e9dbd[_0x3af4('0x1a')],'include':_0x2e9dbd['include']?_[_0x3af4('0x1b')](_0x2e9dbd['include'],function(_0x70579e){return{'model':db[_0x70579e['model']],'as':_0x70579e['as'],'attributes':_0x70579e[_0x3af4('0x1a')],'include':_0x70579e[_0x3af4('0x18')]?_[_0x3af4('0x1b')](_0x70579e[_0x3af4('0x18')],function(_0x4c0397){return{'model':db[_0x4c0397[_0x3af4('0x19')]],'as':_0x4c0397['as'],'attributes':_0x4c0397[_0x3af4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3af4('0x1c')](function(_0x53d800){logger[_0x3af4('0xa')](_0x3af4('0x14'),_0x30b4a3);logger[_0x3af4('0xd')](_0x3af4('0x14'),_0x30b4a3,JSON[_0x3af4('0x1d')](_0x53d800));_0x4e5302(_0x53d800);})[_0x3af4('0x13')](function(_0x4fc658){logger[_0x3af4('0xf')]('ShowSound',_0x4fc658[_0x3af4('0x11')],_0x30b4a3);_0x45214a(_0x2fe9fb[_0x3af4('0xf')](0x1f4,_0x4fc658['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b1464d6..11d907f 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 _0xa40b=['/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','put'];(function(_0x147d3f,_0x225534){var _0x111112=function(_0x4a0553){while(--_0x4a0553){_0x147d3f['push'](_0x147d3f['shift']());}};_0x111112(++_0x225534);}(_0xa40b,0x147));var _0xba40=function(_0x55e0cf,_0x5ee531){_0x55e0cf=_0x55e0cf-0x0;var _0x1a94fc=_0xa40b[_0x55e0cf];return _0x1a94fc;};'use strict';var multer=require(_0xba40('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba40('0x1'));var express=require(_0xba40('0x2'));var router=express[_0xba40('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xba40('0x4'));var interaction=require(_0xba40('0x5'));var config=require(_0xba40('0x6'));var controller=require(_0xba40('0x7'));router['get']('/',auth[_0xba40('0x8')](),controller['index']);router[_0xba40('0x9')]('/:id',auth[_0xba40('0x8')](),controller[_0xba40('0xa')]);router['post']('/',auth[_0xba40('0x8')](),controller[_0xba40('0xb')]);router[_0xba40('0xc')](_0xba40('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xba40('0xe')](_0xba40('0xd'),auth['isAuthenticated'](),controller[_0xba40('0xf')]);module[_0xba40('0x10')]=router; \ No newline at end of file +var _0xc524=['show','post','create','put','delete','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x54c142,_0x12edf1){var _0x68c71b=function(_0x4456da){while(--_0x4456da){_0x54c142['push'](_0x54c142['shift']());}};_0x68c71b(++_0x12edf1);}(_0xc524,0x140));var _0x4c52=function(_0x13f141,_0x4b1c12){_0x13f141=_0x13f141-0x0;var _0x4bd1fe=_0xc524[_0x13f141];return _0x4bd1fe;};'use strict';var multer=require('multer');var util=require(_0x4c52('0x0'));var path=require('path');var timeout=require(_0x4c52('0x1'));var express=require('express');var router=express[_0x4c52('0x2')]();var fs_extra=require(_0x4c52('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4c52('0x4'));var config=require(_0x4c52('0x5'));var controller=require('./squareMessage.controller');router[_0x4c52('0x6')]('/',auth['isAuthenticated'](),controller[_0x4c52('0x7')]);router[_0x4c52('0x6')](_0x4c52('0x8'),auth[_0x4c52('0x9')](),controller[_0x4c52('0xa')]);router[_0x4c52('0xb')]('/',auth['isAuthenticated'](),controller[_0x4c52('0xc')]);router[_0x4c52('0xd')](_0x4c52('0x8'),auth[_0x4c52('0x9')](),controller['update']);router[_0x4c52('0xe')](_0x4c52('0x8'),auth[_0x4c52('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index c54a17a..4f724f4 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 _0x277c=['medium','ENUM','out','sequelize','STRING','TEXT'];(function(_0x2cedce,_0x27a0f7){var _0xfcffb6=function(_0x18aba0){while(--_0x18aba0){_0x2cedce['push'](_0x2cedce['shift']());}};_0xfcffb6(++_0x27a0f7);}(_0x277c,0x153));var _0xc277=function(_0x419835,_0x1a3f77){_0x419835=_0x419835-0x0;var _0xace1f6=_0x277c[_0x419835];return _0xace1f6;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc277('0x1')]},'body':{'type':Sequelize[_0xc277('0x2')](_0xc277('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xc277('0x4')]('in',_0xc277('0x5')),'defaultValue':_0xc277('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xc277('0x1')]},'providerResponse':{'type':Sequelize[_0xc277('0x2')]}}; \ No newline at end of file +var _0x7bae=['TEXT','ENUM','out','STRING'];(function(_0x382066,_0x5bef22){var _0x4c4e1f=function(_0x10add5){while(--_0x10add5){_0x382066['push'](_0x382066['shift']());}};_0x4c4e1f(++_0x5bef22);}(_0x7bae,0x13b));var _0xe7ba=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x7bae[_0x13ce0c];return _0x4388fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7ba('0x0')]},'body':{'type':Sequelize[_0xe7ba('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xe7ba('0x2')]('in','out'),'defaultValue':_0xe7ba('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe7ba('0x0')]},'providerResponse':{'type':Sequelize[_0xe7ba('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0cbaabb..4016d0a 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 _0xafe9=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafe9,0x163));var _0x9afe=function(_0x463555,_0x286ee6){_0x463555=_0x463555-0x0;var _0x1e696b=_0xafe9[_0x463555];return _0x1e696b;};'use strict';var emlformat=require(_0x9afe('0x0'));var rimraf=require(_0x9afe('0x1'));var zipdir=require(_0x9afe('0x2'));var jsonpatch=require(_0x9afe('0x3'));var rp=require(_0x9afe('0x4'));var moment=require(_0x9afe('0x5'));var BPromise=require(_0x9afe('0x6'));var Mustache=require(_0x9afe('0x7'));var util=require(_0x9afe('0x8'));var path=require(_0x9afe('0x9'));var sox=require(_0x9afe('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9afe('0xb'));var _=require(_0x9afe('0xc'));var squel=require(_0x9afe('0xd'));var crypto=require(_0x9afe('0xe'));var jsforce=require(_0x9afe('0xf'));var deskjs=require(_0x9afe('0x10'));var toCsv=require(_0x9afe('0x11'));var querystring=require('querystring');var Papa=require(_0x9afe('0x12'));var Redis=require('ioredis');var authService=require(_0x9afe('0x13'));var qs=require(_0x9afe('0x14'));var as=require(_0x9afe('0x15'));var hardwareService=require(_0x9afe('0x16'));var logger=require('../../config/logger')(_0x9afe('0x17'));var utils=require(_0x9afe('0x18'));var config=require(_0x9afe('0x19'));var licenseUtil=require(_0x9afe('0x1a'));var db=require(_0x9afe('0x1b'))['db'];function respondWithStatusCode(_0x33092c,_0x34adbe){_0x34adbe=_0x34adbe||0xcc;return function(_0x485851){if(_0x485851){return _0x33092c[_0x9afe('0x1c')](_0x34adbe);}return _0x33092c[_0x9afe('0x1d')](_0x34adbe)['end']();};}function respondWithResult(_0x3b74c7,_0x278334){_0x278334=_0x278334||0xc8;return function(_0x2ec260){if(_0x2ec260){return _0x3b74c7[_0x9afe('0x1d')](_0x278334)[_0x9afe('0x1e')](_0x2ec260);}};}function respondWithFilteredResult(_0x89d01c,_0x629a89){return function(_0x54a051){if(_0x54a051){var _0x1b3909=typeof _0x629a89[_0x9afe('0x1f')]===_0x9afe('0x20')&&typeof _0x629a89[_0x9afe('0x21')]===_0x9afe('0x20');var _0x8a3a56=_0x54a051['count'];var _0x1fe59c=_0x1b3909?0x0:_0x629a89['offset'];var _0x3008f=_0x1b3909?_0x54a051[_0x9afe('0x22')]:_0x629a89[_0x9afe('0x1f')]+_0x629a89['limit'];var _0x5dfbc3;if(_0x3008f>=_0x8a3a56){_0x3008f=_0x8a3a56;_0x5dfbc3=0xc8;}else{_0x5dfbc3=0xce;}_0x89d01c['status'](_0x5dfbc3);return _0x89d01c['set'](_0x9afe('0x23'),_0x1fe59c+'-'+_0x3008f+'/'+_0x8a3a56)[_0x9afe('0x1e')](_0x54a051);}return null;};}function patchUpdates(_0x30731f){return function(_0x15a98c){try{jsonpatch[_0x9afe('0x24')](_0x15a98c,_0x30731f,!![]);}catch(_0x13447a){return BPromise['reject'](_0x13447a);}return _0x15a98c[_0x9afe('0x25')]();};}function saveUpdates(_0x371edb,_0x3335bc){return function(_0x4d47f9){if(_0x4d47f9){return _0x4d47f9[_0x9afe('0x26')](_0x371edb)[_0x9afe('0x27')](function(_0x4d5988){return _0x4d5988;});}return null;};}function removeEntity(_0xcdcdb9,_0xc233cd){return function(_0x116e73){if(_0x116e73){return _0x116e73['destroy']()['then'](function(){_0xcdcdb9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x427e71,_0x55f766){return function(_0x464855){if(!_0x464855){_0x427e71[_0x9afe('0x1c')](0x194);}return _0x464855;};}function handleError(_0x3e0b71,_0x96bd9e){_0x96bd9e=_0x96bd9e||0x1f4;return function(_0x225e9b){logger[_0x9afe('0x28')](_0x225e9b['stack']);if(_0x225e9b['name']){delete _0x225e9b[_0x9afe('0x29')];}_0x3e0b71[_0x9afe('0x1d')](_0x96bd9e)[_0x9afe('0x2a')](_0x225e9b);};}exports['index']=function(_0xcbaf5d,_0x262aca){var _0x5155a2={},_0x266682={},_0x406939={'count':0x0,'rows':[]};var _0x1f725c=_[_0x9afe('0x2b')](db[_0x9afe('0x2c')][_0x9afe('0x2d')],function(_0x56e542){return{'name':_0x56e542[_0x9afe('0x2e')],'type':_0x56e542[_0x9afe('0x2f')][_0x9afe('0x30')]};});_0x266682[_0x9afe('0x31')]=_[_0x9afe('0x2b')](_0x1f725c,_0x9afe('0x29'));_0x266682[_0x9afe('0x32')]=_[_0x9afe('0x33')](_0xcbaf5d[_0x9afe('0x32')]);_0x266682[_0x9afe('0x34')]=_[_0x9afe('0x35')](_0x266682[_0x9afe('0x31')],_0x266682[_0x9afe('0x32')]);_0x5155a2[_0x9afe('0x36')]=_['intersection'](_0x266682[_0x9afe('0x31')],qs[_0x9afe('0x37')](_0xcbaf5d[_0x9afe('0x32')][_0x9afe('0x37')]));_0x5155a2[_0x9afe('0x36')]=_0x5155a2[_0x9afe('0x36')][_0x9afe('0x38')]?_0x5155a2[_0x9afe('0x36')]:_0x266682[_0x9afe('0x31')];if(!_0xcbaf5d[_0x9afe('0x32')][_0x9afe('0x39')]('nolimit')){_0x5155a2[_0x9afe('0x21')]=qs[_0x9afe('0x21')](_0xcbaf5d[_0x9afe('0x32')][_0x9afe('0x21')]);_0x5155a2[_0x9afe('0x1f')]=qs[_0x9afe('0x1f')](_0xcbaf5d[_0x9afe('0x32')][_0x9afe('0x1f')]);}_0x5155a2[_0x9afe('0x3a')]=qs['sort'](_0xcbaf5d[_0x9afe('0x32')][_0x9afe('0x3b')]);_0x5155a2[_0x9afe('0x3c')]=qs[_0x9afe('0x34')](_[_0x9afe('0x3d')](_0xcbaf5d[_0x9afe('0x32')],_0x266682['filters']),_0x1f725c);if(_0xcbaf5d[_0x9afe('0x32')]['filter']){_0x5155a2[_0x9afe('0x3c')]=_[_0x9afe('0x3e')](_0x5155a2[_0x9afe('0x3c')],{'$or':_['map'](_0x1f725c,function(_0x3c9bfd){if(_0x3c9bfd['type']!==_0x9afe('0x3f')){var _0x1cd53e={};_0x1cd53e[_0x3c9bfd['name']]={'$like':'%'+_0xcbaf5d['query'][_0x9afe('0x40')]+'%'};return _0x1cd53e;}})});}_0x5155a2=_[_0x9afe('0x3e')]({},_0x5155a2,_0xcbaf5d['options']);var _0x5aac24={'where':_0x5155a2[_0x9afe('0x3c')]};return db[_0x9afe('0x2c')][_0x9afe('0x22')](_0x5aac24)[_0x9afe('0x27')](function(_0x578e6b){_0x406939[_0x9afe('0x22')]=_0x578e6b;if(_0xcbaf5d['query']['includeAll']){_0x5155a2[_0x9afe('0x41')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x5155a2);})[_0x9afe('0x27')](function(_0x30c1a2){_0x406939[_0x9afe('0x42')]=_0x30c1a2;return _0x406939;})[_0x9afe('0x27')](respondWithFilteredResult(_0x262aca,_0x5155a2))[_0x9afe('0x43')](handleError(_0x262aca,null));};exports[_0x9afe('0x44')]=function(_0x5656a9,_0x504bc1){var _0x108ff7={'raw':!![],'where':{'id':_0x5656a9[_0x9afe('0x45')]['id']}},_0x26842a={};_0x26842a[_0x9afe('0x31')]=_[_0x9afe('0x33')](db[_0x9afe('0x2c')]['rawAttributes']);_0x26842a[_0x9afe('0x32')]=_[_0x9afe('0x33')](_0x5656a9[_0x9afe('0x32')]);_0x26842a[_0x9afe('0x34')]=_[_0x9afe('0x35')](_0x26842a['model'],_0x26842a[_0x9afe('0x32')]);_0x108ff7['attributes']=_['intersection'](_0x26842a[_0x9afe('0x31')],qs['fields'](_0x5656a9[_0x9afe('0x32')][_0x9afe('0x37')]));_0x108ff7['attributes']=_0x108ff7['attributes'][_0x9afe('0x38')]?_0x108ff7[_0x9afe('0x36')]:_0x26842a[_0x9afe('0x31')];if(_0x5656a9[_0x9afe('0x32')][_0x9afe('0x46')]){_0x108ff7['include']=[{'all':!![]}];}_0x108ff7=_[_0x9afe('0x3e')]({},_0x108ff7,_0x5656a9[_0x9afe('0x47')]);return db[_0x9afe('0x2c')][_0x9afe('0x48')](_0x108ff7)['then'](handleEntityNotFound(_0x504bc1,null))['then'](respondWithResult(_0x504bc1,null))[_0x9afe('0x43')](handleError(_0x504bc1,null));};exports[_0x9afe('0x49')]=function(_0x24a7eb,_0x3ecf15){return db[_0x9afe('0x2c')][_0x9afe('0x49')](_0x24a7eb[_0x9afe('0x4a')],{})[_0x9afe('0x27')](respondWithResult(_0x3ecf15,0xc9))[_0x9afe('0x43')](handleError(_0x3ecf15,null));};exports[_0x9afe('0x26')]=function(_0x125c27,_0x2bf41d){if(_0x125c27[_0x9afe('0x4a')]['id']){delete _0x125c27[_0x9afe('0x4a')]['id'];}return db[_0x9afe('0x2c')]['find']({'where':{'id':_0x125c27[_0x9afe('0x45')]['id']}})['then'](handleEntityNotFound(_0x2bf41d,null))[_0x9afe('0x27')](saveUpdates(_0x125c27['body'],null))[_0x9afe('0x27')](respondWithResult(_0x2bf41d,null))[_0x9afe('0x43')](handleError(_0x2bf41d,null));};exports['destroy']=function(_0xc8ed6d,_0x45626d){return db[_0x9afe('0x2c')]['find']({'where':{'id':_0xc8ed6d['params']['id']}})['then'](handleEntityNotFound(_0x45626d,null))[_0x9afe('0x27')](removeEntity(_0x45626d,null))['catch'](handleError(_0x45626d,null));}; \ No newline at end of file +var _0x440c=['eml-format','fast-json-patch','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','reject','save','update','destroy','then','sendStatus','error','send','index','SquareMessage','type','key','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','findAll','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body'];(function(_0x1c3c80,_0x5be85a){var _0x1454d4=function(_0x2845eb){while(--_0x2845eb){_0x1c3c80['push'](_0x1c3c80['shift']());}};_0x1454d4(++_0x5be85a);}(_0x440c,0x192));var _0xc440=function(_0x50e832,_0x29cde6){_0x50e832=_0x50e832-0x0;var _0x30da44=_0x440c[_0x50e832];return _0x30da44;};'use strict';var emlformat=require(_0xc440('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc440('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc440('0x2'));var util=require(_0xc440('0x3'));var path=require(_0xc440('0x4'));var sox=require(_0xc440('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc440('0x6'));var _=require('lodash');var squel=require(_0xc440('0x7'));var crypto=require(_0xc440('0x8'));var jsforce=require(_0xc440('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xc440('0xa'));var querystring=require('querystring');var Papa=require(_0xc440('0xb'));var Redis=require(_0xc440('0xc'));var authService=require(_0xc440('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc440('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc440('0xf'));var utils=require(_0xc440('0x10'));var config=require(_0xc440('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc440('0x12'))['db'];function respondWithStatusCode(_0x10893c,_0x4d134f){_0x4d134f=_0x4d134f||0xcc;return function(_0x5ca265){if(_0x5ca265){return _0x10893c['sendStatus'](_0x4d134f);}return _0x10893c[_0xc440('0x13')](_0x4d134f)[_0xc440('0x14')]();};}function respondWithResult(_0x2451b0,_0x4e57c1){_0x4e57c1=_0x4e57c1||0xc8;return function(_0x287aed){if(_0x287aed){return _0x2451b0[_0xc440('0x13')](_0x4e57c1)[_0xc440('0x15')](_0x287aed);}};}function respondWithFilteredResult(_0x611e68,_0xe51b1){return function(_0x7fd203){if(_0x7fd203){var _0x4f4424=typeof _0xe51b1['offset']===_0xc440('0x16')&&typeof _0xe51b1['limit']===_0xc440('0x16');var _0x326dc2=_0x7fd203[_0xc440('0x17')];var _0x555f30=_0x4f4424?0x0:_0xe51b1['offset'];var _0xf711c3=_0x4f4424?_0x7fd203[_0xc440('0x17')]:_0xe51b1[_0xc440('0x18')]+_0xe51b1[_0xc440('0x19')];var _0x37e7d7;if(_0xf711c3>=_0x326dc2){_0xf711c3=_0x326dc2;_0x37e7d7=0xc8;}else{_0x37e7d7=0xce;}_0x611e68[_0xc440('0x13')](_0x37e7d7);return _0x611e68['set']('Content-Range',_0x555f30+'-'+_0xf711c3+'/'+_0x326dc2)[_0xc440('0x15')](_0x7fd203);}return null;};}function patchUpdates(_0x398d73){return function(_0x1629f3){try{jsonpatch['apply'](_0x1629f3,_0x398d73,!![]);}catch(_0x353656){return BPromise[_0xc440('0x1a')](_0x353656);}return _0x1629f3[_0xc440('0x1b')]();};}function saveUpdates(_0x480b93,_0x5c2749){return function(_0x5abb6d){if(_0x5abb6d){return _0x5abb6d[_0xc440('0x1c')](_0x480b93)['then'](function(_0x124850){return _0x124850;});}return null;};}function removeEntity(_0x269de7,_0x47f8d1){return function(_0x228824){if(_0x228824){return _0x228824[_0xc440('0x1d')]()[_0xc440('0x1e')](function(){_0x269de7[_0xc440('0x13')](0xcc)[_0xc440('0x14')]();});}};}function handleEntityNotFound(_0x1f2989,_0x4f9f5a){return function(_0x20b0ce){if(!_0x20b0ce){_0x1f2989[_0xc440('0x1f')](0x194);}return _0x20b0ce;};}function handleError(_0x442345,_0x431768){_0x431768=_0x431768||0x1f4;return function(_0x2858d6){logger[_0xc440('0x20')](_0x2858d6['stack']);if(_0x2858d6['name']){delete _0x2858d6['name'];}_0x442345['status'](_0x431768)[_0xc440('0x21')](_0x2858d6);};}exports[_0xc440('0x22')]=function(_0x44c3c5,_0x70c1e1){var _0x501234={},_0x4d6ac2={},_0x56868e={'count':0x0,'rows':[]};var _0x4d6188=_['map'](db[_0xc440('0x23')]['rawAttributes'],function(_0x52a76f){return{'name':_0x52a76f['fieldName'],'type':_0x52a76f[_0xc440('0x24')][_0xc440('0x25')]};});_0x4d6ac2[_0xc440('0x26')]=_[_0xc440('0x27')](_0x4d6188,_0xc440('0x28'));_0x4d6ac2[_0xc440('0x29')]=_[_0xc440('0x2a')](_0x44c3c5[_0xc440('0x29')]);_0x4d6ac2['filters']=_[_0xc440('0x2b')](_0x4d6ac2['model'],_0x4d6ac2['query']);_0x501234[_0xc440('0x2c')]=_[_0xc440('0x2b')](_0x4d6ac2['model'],qs[_0xc440('0x2d')](_0x44c3c5['query'][_0xc440('0x2d')]));_0x501234[_0xc440('0x2c')]=_0x501234[_0xc440('0x2c')][_0xc440('0x2e')]?_0x501234[_0xc440('0x2c')]:_0x4d6ac2['model'];if(!_0x44c3c5[_0xc440('0x29')][_0xc440('0x2f')](_0xc440('0x30'))){_0x501234[_0xc440('0x19')]=qs['limit'](_0x44c3c5[_0xc440('0x29')][_0xc440('0x19')]);_0x501234[_0xc440('0x18')]=qs['offset'](_0x44c3c5[_0xc440('0x29')][_0xc440('0x18')]);}_0x501234[_0xc440('0x31')]=qs['sort'](_0x44c3c5[_0xc440('0x29')][_0xc440('0x32')]);_0x501234[_0xc440('0x33')]=qs[_0xc440('0x34')](_['pick'](_0x44c3c5['query'],_0x4d6ac2['filters']),_0x4d6188);if(_0x44c3c5[_0xc440('0x29')][_0xc440('0x35')]){_0x501234[_0xc440('0x33')]=_[_0xc440('0x36')](_0x501234[_0xc440('0x33')],{'$or':_[_0xc440('0x27')](_0x4d6188,function(_0x55f1a1){if(_0x55f1a1[_0xc440('0x24')]!=='VIRTUAL'){var _0x580dd4={};_0x580dd4[_0x55f1a1[_0xc440('0x28')]]={'$like':'%'+_0x44c3c5[_0xc440('0x29')]['filter']+'%'};return _0x580dd4;}})});}_0x501234=_[_0xc440('0x36')]({},_0x501234,_0x44c3c5['options']);var _0xa27594={'where':_0x501234['where']};return db[_0xc440('0x23')][_0xc440('0x17')](_0xa27594)[_0xc440('0x1e')](function(_0x5a7d28){_0x56868e[_0xc440('0x17')]=_0x5a7d28;if(_0x44c3c5[_0xc440('0x29')]['includeAll']){_0x501234['include']=[{'all':!![]}];}return db['SquareMessage'][_0xc440('0x37')](_0x501234);})[_0xc440('0x1e')](function(_0x594155){_0x56868e[_0xc440('0x38')]=_0x594155;return _0x56868e;})[_0xc440('0x1e')](respondWithFilteredResult(_0x70c1e1,_0x501234))[_0xc440('0x39')](handleError(_0x70c1e1,null));};exports[_0xc440('0x3a')]=function(_0x4ae17a,_0x50a75d){var _0x17787d={'raw':!![],'where':{'id':_0x4ae17a[_0xc440('0x3b')]['id']}},_0x1b008c={};_0x1b008c[_0xc440('0x26')]=_['keys'](db['SquareMessage'][_0xc440('0x3c')]);_0x1b008c[_0xc440('0x29')]=_[_0xc440('0x2a')](_0x4ae17a[_0xc440('0x29')]);_0x1b008c[_0xc440('0x34')]=_[_0xc440('0x2b')](_0x1b008c[_0xc440('0x26')],_0x1b008c[_0xc440('0x29')]);_0x17787d[_0xc440('0x2c')]=_['intersection'](_0x1b008c[_0xc440('0x26')],qs['fields'](_0x4ae17a[_0xc440('0x29')]['fields']));_0x17787d[_0xc440('0x2c')]=_0x17787d[_0xc440('0x2c')][_0xc440('0x2e')]?_0x17787d[_0xc440('0x2c')]:_0x1b008c[_0xc440('0x26')];if(_0x4ae17a['query'][_0xc440('0x3d')]){_0x17787d[_0xc440('0x3e')]=[{'all':!![]}];}_0x17787d=_['merge']({},_0x17787d,_0x4ae17a[_0xc440('0x3f')]);return db[_0xc440('0x23')][_0xc440('0x40')](_0x17787d)['then'](handleEntityNotFound(_0x50a75d,null))[_0xc440('0x1e')](respondWithResult(_0x50a75d,null))[_0xc440('0x39')](handleError(_0x50a75d,null));};exports[_0xc440('0x41')]=function(_0x1d18ab,_0x3607bc){return db['SquareMessage'][_0xc440('0x41')](_0x1d18ab['body'],{})[_0xc440('0x1e')](respondWithResult(_0x3607bc,0xc9))[_0xc440('0x39')](handleError(_0x3607bc,null));};exports[_0xc440('0x1c')]=function(_0x52c5b4,_0x380a5b){if(_0x52c5b4[_0xc440('0x42')]['id']){delete _0x52c5b4[_0xc440('0x42')]['id'];}return db[_0xc440('0x23')]['find']({'where':{'id':_0x52c5b4['params']['id']}})[_0xc440('0x1e')](handleEntityNotFound(_0x380a5b,null))['then'](saveUpdates(_0x52c5b4[_0xc440('0x42')],null))[_0xc440('0x1e')](respondWithResult(_0x380a5b,null))[_0xc440('0x39')](handleError(_0x380a5b,null));};exports[_0xc440('0x1d')]=function(_0x5b668c,_0x4e2039){return db[_0xc440('0x23')]['find']({'where':{'id':_0x5b668c[_0xc440('0x3b')]['id']}})[_0xc440('0x1e')](handleEntityNotFound(_0x4e2039,null))[_0xc440('0x1e')](removeEntity(_0x4e2039,null))[_0xc440('0x39')](handleError(_0x4e2039,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f6df2eb..efdfdbd 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 _0xdac5=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','define','square_messages','lodash'];(function(_0x52c277,_0x1c33a3){var _0x595bd2=function(_0x51335b){while(--_0x51335b){_0x52c277['push'](_0x52c277['shift']());}};_0x595bd2(++_0x1c33a3);}(_0xdac5,0x17b));var _0x5dac=function(_0x2facf5,_0x1e0a03){_0x2facf5=_0x2facf5-0x0;var _0x10c3b1=_0xdac5[_0x2facf5];return _0x10c3b1;};'use strict';var _=require(_0x5dac('0x0'));var util=require(_0x5dac('0x1'));var logger=require(_0x5dac('0x2'))(_0x5dac('0x3'));var moment=require('moment');var BPromise=require(_0x5dac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dac('0x5'));var rimraf=require(_0x5dac('0x6'));var config=require(_0x5dac('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x47be86,_0xae53f2){return _0x47be86[_0x5dac('0x8')]('SquareMessage',attributes,{'tableName':_0x5dac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff0=['bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbff0,0x1c6));var _0x0bff=function(_0x23f18c,_0x2638c8){_0x23f18c=_0x23f18c-0x0;var _0x4a42e6=_0xbff0[_0x23f18c];return _0x4a42e6;};'use strict';var _=require('lodash');var util=require(_0x0bff('0x0'));var logger=require(_0x0bff('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0bff('0x2'));var rp=require(_0x0bff('0x3'));var fs=require('fs');var path=require(_0x0bff('0x4'));var rimraf=require(_0x0bff('0x5'));var config=require(_0x0bff('0x6'));var attributes=require(_0x0bff('0x7'));module[_0x0bff('0x8')]=function(_0x5ab602,_0x2b0207){return _0x5ab602[_0x0bff('0x9')](_0x0bff('0xa'),attributes,{'tableName':_0x0bff('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 84becdc..066a2db 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x10eb6c,_0x1d2a80){var _0x38a740=function(_0x503465){while(--_0x503465){_0x10eb6c['push'](_0x10eb6c['shift']());}};_0x38a740(++_0x1d2a80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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['CreateSquareMessage']=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?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x18032c,_0x58f3b3){var _0x4b02ab=function(_0x2d5012){while(--_0x2d5012){_0x18032c['push'](_0x18032c['shift']());}};_0x4b02ab(++_0x58f3b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=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?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 68a8b40..9109a83 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 _0x2f7e=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','post','create','put','destroy','exports','multer'];(function(_0x49f213,_0x1d72e8){var _0x37c489=function(_0x2daf3a){while(--_0x2daf3a){_0x49f213['push'](_0x49f213['shift']());}};_0x37c489(++_0x1d72e8);}(_0x2f7e,0xc7));var _0xe2f7=function(_0x2301f2,_0x252f65){_0x2301f2=_0x2301f2-0x0;var _0xc2e9ef=_0x2f7e[_0x2301f2];return _0xc2e9ef;};'use strict';var multer=require(_0xe2f7('0x0'));var util=require(_0xe2f7('0x1'));var path=require(_0xe2f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xe2f7('0x3'));var router=express[_0xe2f7('0x4')]();var fs_extra=require(_0xe2f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2f7('0x6'));var config=require(_0xe2f7('0x7'));var controller=require(_0xe2f7('0x8'));router[_0xe2f7('0x9')]('/',auth[_0xe2f7('0xa')](),controller['index']);router['get'](_0xe2f7('0xb'),auth[_0xe2f7('0xa')](),controller[_0xe2f7('0xc')]);router[_0xe2f7('0x9')](_0xe2f7('0xd'),auth[_0xe2f7('0xa')](),timeout(_0xe2f7('0xe')),controller['test']);router[_0xe2f7('0xf')]('/',auth[_0xe2f7('0xa')](),controller[_0xe2f7('0x10')]);router[_0xe2f7('0x11')](_0xe2f7('0xb'),auth[_0xe2f7('0xa')](),controller['update']);router['delete'](_0xe2f7('0xb'),auth[_0xe2f7('0xa')](),controller[_0xe2f7('0x12')]);module[_0xe2f7('0x13')]=router; \ No newline at end of file +var _0xd7b4=['test','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0xd7b4,0x145));var _0x4d7b=function(_0x29f6f8,_0x370292){_0x29f6f8=_0x29f6f8-0x0;var _0x379929=_0xd7b4[_0x29f6f8];return _0x379929;};'use strict';var multer=require(_0x4d7b('0x0'));var util=require(_0x4d7b('0x1'));var path=require('path');var timeout=require(_0x4d7b('0x2'));var express=require(_0x4d7b('0x3'));var router=express[_0x4d7b('0x4')]();var fs_extra=require(_0x4d7b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4d7b('0x6'));var config=require(_0x4d7b('0x7'));var controller=require(_0x4d7b('0x8'));router[_0x4d7b('0x9')]('/',auth[_0x4d7b('0xa')](),controller[_0x4d7b('0xb')]);router['get'](_0x4d7b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4d7b('0x9')](_0x4d7b('0xd'),auth[_0x4d7b('0xa')](),timeout(_0x4d7b('0xe')),controller[_0x4d7b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4d7b('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4d7b('0x11')](_0x4d7b('0xc'),auth[_0x4d7b('0xa')](),controller[_0x4d7b('0x12')]);module[_0x4d7b('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index bfea999..69df55f 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 _0xa477=['name','sequelize','exports','STRING'];(function(_0x6262fd,_0x343a3d){var _0x256b20=function(_0x39f6c4){while(--_0x39f6c4){_0x6262fd['push'](_0x6262fd['shift']());}};_0x256b20(++_0x343a3d);}(_0xa477,0x191));var _0x7a47=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xa477[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x7a47('0x0'));module[_0x7a47('0x1')]={'name':{'type':Sequelize[_0x7a47('0x2')],'unique':_0x7a47('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7a47('0x2')]},'description':{'type':Sequelize[_0x7a47('0x2')]}}; \ No newline at end of file +var _0xc785=['STRING','name','sequelize','exports'];(function(_0x327c23,_0x10d0e4){var _0x1fcdae=function(_0x4acdf2){while(--_0x4acdf2){_0x327c23['push'](_0x327c23['shift']());}};_0x1fcdae(++_0x10d0e4);}(_0xc785,0x14e));var _0x5c78=function(_0x3ccc25,_0x22a769){_0x3ccc25=_0x3ccc25-0x0;var _0x1b43d2=_0xc785[_0x3ccc25];return _0x1b43d2;};'use strict';var Sequelize=require(_0x5c78('0x0'));module[_0x5c78('0x1')]={'name':{'type':Sequelize[_0x5c78('0x2')],'unique':_0x5c78('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5c78('0x2')]},'description':{'type':Sequelize[_0x5c78('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 8e09be6..cb8b09e 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 _0x5f5d=['type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','keys','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','ODBC','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName'];(function(_0x40c611,_0x13febe){var _0x126bc0=function(_0x671904){while(--_0x671904){_0x40c611['push'](_0x40c611['shift']());}};_0x126bc0(++_0x13febe);}(_0x5f5d,0xd5));var _0xd5f5=function(_0x1cbe27,_0x39d008){_0x1cbe27=_0x1cbe27-0x0;var _0x1bb6bc=_0x5f5d[_0x1cbe27];return _0x1bb6bc;};'use strict';var emlformat=require(_0xd5f5('0x0'));var rimraf=require(_0xd5f5('0x1'));var zipdir=require(_0xd5f5('0x2'));var jsonpatch=require(_0xd5f5('0x3'));var rp=require('request-promise');var moment=require(_0xd5f5('0x4'));var BPromise=require(_0xd5f5('0x5'));var Mustache=require(_0xd5f5('0x6'));var util=require(_0xd5f5('0x7'));var path=require('path');var sox=require(_0xd5f5('0x8'));var csv=require(_0xd5f5('0x9'));var ejs=require(_0xd5f5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5f5('0xb'));var squel=require(_0xd5f5('0xc'));var crypto=require(_0xd5f5('0xd'));var jsforce=require(_0xd5f5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd5f5('0x9'));var querystring=require(_0xd5f5('0xf'));var Papa=require(_0xd5f5('0x10'));var Redis=require('ioredis');var authService=require(_0xd5f5('0x11'));var qs=require(_0xd5f5('0x12'));var as=require(_0xd5f5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5f5('0x14'))(_0xd5f5('0x15'));var utils=require(_0xd5f5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd5f5('0x17'))['db'];function respondWithStatusCode(_0x4ff006,_0x5717fc){_0x5717fc=_0x5717fc||0xcc;return function(_0x581f12){if(_0x581f12){return _0x4ff006['sendStatus'](_0x5717fc);}return _0x4ff006[_0xd5f5('0x18')](_0x5717fc)[_0xd5f5('0x19')]();};}function respondWithResult(_0x2991ed,_0x56a7b1){_0x56a7b1=_0x56a7b1||0xc8;return function(_0xe5ec83){if(_0xe5ec83){return _0x2991ed[_0xd5f5('0x18')](_0x56a7b1)[_0xd5f5('0x1a')](_0xe5ec83);}};}function respondWithFilteredResult(_0x1bb516,_0x474fcc){return function(_0x3eb49a){if(_0x3eb49a){var _0x16bf5b=typeof _0x474fcc[_0xd5f5('0x1b')]===_0xd5f5('0x1c')&&typeof _0x474fcc[_0xd5f5('0x1d')]===_0xd5f5('0x1c');var _0x2b0d2b=_0x3eb49a[_0xd5f5('0x1e')];var _0x1e3eae=_0x16bf5b?0x0:_0x474fcc[_0xd5f5('0x1b')];var _0x31720a=_0x16bf5b?_0x3eb49a[_0xd5f5('0x1e')]:_0x474fcc[_0xd5f5('0x1b')]+_0x474fcc[_0xd5f5('0x1d')];var _0x14ad33;if(_0x31720a>=_0x2b0d2b){_0x31720a=_0x2b0d2b;_0x14ad33=0xc8;}else{_0x14ad33=0xce;}_0x1bb516['status'](_0x14ad33);return _0x1bb516[_0xd5f5('0x1f')](_0xd5f5('0x20'),_0x1e3eae+'-'+_0x31720a+'/'+_0x2b0d2b)[_0xd5f5('0x1a')](_0x3eb49a);}return null;};}function patchUpdates(_0x16ef2d){return function(_0x57cee3){try{jsonpatch[_0xd5f5('0x21')](_0x57cee3,_0x16ef2d,!![]);}catch(_0x1e8e90){return BPromise[_0xd5f5('0x22')](_0x1e8e90);}return _0x57cee3[_0xd5f5('0x23')]();};}function saveUpdates(_0x314a42,_0x42afa){return function(_0x547bdf){if(_0x547bdf){return _0x547bdf[_0xd5f5('0x24')](_0x314a42)['then'](function(_0x252a82){return _0x252a82;});}return null;};}function removeEntity(_0x23a1e3,_0x503163){return function(_0x4383da){if(_0x4383da){return _0x4383da[_0xd5f5('0x25')]()[_0xd5f5('0x26')](function(){var _0x28ed51=_0x4383da['get']({'plain':!![]});var _0x2d49e4=_0xd5f5('0x27');return db[_0xd5f5('0x28')]['destroy']({'where':{'type':_0x2d49e4,'resourceId':_0x28ed51['id']}})[_0xd5f5('0x26')](function(){return _0x4383da;});})[_0xd5f5('0x26')](function(){_0x23a1e3['status'](0xcc)[_0xd5f5('0x19')]();});}};}function handleEntityNotFound(_0x524f60,_0x15d486){return function(_0x196fbd){if(!_0x196fbd){_0x524f60[_0xd5f5('0x29')](0x194);}return _0x196fbd;};}function handleError(_0x22fe01,_0x5a6032){_0x5a6032=_0x5a6032||0x1f4;return function(_0xe81a8e){logger[_0xd5f5('0x2a')](_0xe81a8e[_0xd5f5('0x2b')]);if(_0xe81a8e[_0xd5f5('0x2c')]){delete _0xe81a8e['name'];}_0x22fe01['status'](_0x5a6032)[_0xd5f5('0x2d')](_0xe81a8e);};}exports[_0xd5f5('0x2e')]=function(_0x535aa2,_0x5432b1){var _0x283156={},_0x1eb182={},_0x31f9a6={'count':0x0,'rows':[]};var _0x25423f=_[_0xd5f5('0x2f')](db[_0xd5f5('0x30')][_0xd5f5('0x31')],function(_0x393e8b){return{'name':_0x393e8b[_0xd5f5('0x32')],'type':_0x393e8b[_0xd5f5('0x33')][_0xd5f5('0x34')]};});_0x1eb182[_0xd5f5('0x35')]=_[_0xd5f5('0x2f')](_0x25423f,_0xd5f5('0x2c'));_0x1eb182[_0xd5f5('0x36')]=_['keys'](_0x535aa2[_0xd5f5('0x36')]);_0x1eb182[_0xd5f5('0x37')]=_['intersection'](_0x1eb182[_0xd5f5('0x35')],_0x1eb182['query']);_0x283156['attributes']=_[_0xd5f5('0x38')](_0x1eb182[_0xd5f5('0x35')],qs[_0xd5f5('0x39')](_0x535aa2[_0xd5f5('0x36')][_0xd5f5('0x39')]));_0x283156['attributes']=_0x283156[_0xd5f5('0x3a')][_0xd5f5('0x3b')]?_0x283156[_0xd5f5('0x3a')]:_0x1eb182[_0xd5f5('0x35')];if(!_0x535aa2[_0xd5f5('0x36')][_0xd5f5('0x3c')](_0xd5f5('0x3d'))){_0x283156[_0xd5f5('0x1d')]=qs[_0xd5f5('0x1d')](_0x535aa2[_0xd5f5('0x36')][_0xd5f5('0x1d')]);_0x283156['offset']=qs[_0xd5f5('0x1b')](_0x535aa2[_0xd5f5('0x36')][_0xd5f5('0x1b')]);}_0x283156[_0xd5f5('0x3e')]=qs[_0xd5f5('0x3f')](_0x535aa2[_0xd5f5('0x36')]['sort']);_0x283156[_0xd5f5('0x40')]=qs['filters'](_[_0xd5f5('0x41')](_0x535aa2[_0xd5f5('0x36')],_0x1eb182[_0xd5f5('0x37')]),_0x25423f);if(_0x535aa2['query'][_0xd5f5('0x42')]){_0x283156[_0xd5f5('0x40')]=_[_0xd5f5('0x43')](_0x283156['where'],{'$or':_[_0xd5f5('0x2f')](_0x25423f,function(_0x1fb363){if(_0x1fb363['type']!=='VIRTUAL'){var _0x5d471d={};_0x5d471d[_0x1fb363[_0xd5f5('0x2c')]]={'$like':'%'+_0x535aa2[_0xd5f5('0x36')][_0xd5f5('0x42')]+'%'};return _0x5d471d;}})});}_0x283156=_[_0xd5f5('0x43')]({},_0x283156,_0x535aa2['options']);var _0x1594c9={'where':_0x283156['where']};return db[_0xd5f5('0x30')][_0xd5f5('0x1e')](_0x1594c9)[_0xd5f5('0x26')](function(_0x1f24db){_0x31f9a6['count']=_0x1f24db;if(_0x535aa2[_0xd5f5('0x36')][_0xd5f5('0x44')]){_0x283156['include']=[{'all':!![]}];}return db[_0xd5f5('0x30')]['findAll'](_0x283156);})['then'](function(_0x7ff9f0){_0x31f9a6[_0xd5f5('0x45')]=_0x7ff9f0;return _0x31f9a6;})[_0xd5f5('0x26')](respondWithFilteredResult(_0x5432b1,_0x283156))[_0xd5f5('0x46')](handleError(_0x5432b1,null));};exports[_0xd5f5('0x47')]=function(_0xcb417c,_0x322658){var _0x4bb521={'raw':!![],'where':{'id':_0xcb417c[_0xd5f5('0x48')]['id']}},_0x172171={};_0x172171[_0xd5f5('0x35')]=_['keys'](db[_0xd5f5('0x30')]['rawAttributes']);_0x172171['query']=_[_0xd5f5('0x49')](_0xcb417c['query']);_0x172171[_0xd5f5('0x37')]=_[_0xd5f5('0x38')](_0x172171['model'],_0x172171[_0xd5f5('0x36')]);_0x4bb521[_0xd5f5('0x3a')]=_[_0xd5f5('0x38')](_0x172171[_0xd5f5('0x35')],qs[_0xd5f5('0x39')](_0xcb417c[_0xd5f5('0x36')][_0xd5f5('0x39')]));_0x4bb521[_0xd5f5('0x3a')]=_0x4bb521[_0xd5f5('0x3a')][_0xd5f5('0x3b')]?_0x4bb521[_0xd5f5('0x3a')]:_0x172171['model'];if(_0xcb417c['query'][_0xd5f5('0x44')]){_0x4bb521[_0xd5f5('0x4a')]=[{'all':!![]}];}_0x4bb521=_['merge']({},_0x4bb521,_0xcb417c['options']);return db[_0xd5f5('0x30')][_0xd5f5('0x4b')](_0x4bb521)[_0xd5f5('0x26')](handleEntityNotFound(_0x322658,null))[_0xd5f5('0x26')](respondWithResult(_0x322658,null))[_0xd5f5('0x46')](handleError(_0x322658,null));};exports[_0xd5f5('0x4c')]=function(_0x10bd7e,_0x1466d8){return db['SquareOdbc']['create'](_0x10bd7e['body'],{})[_0xd5f5('0x26')](function(_0x4377f6){var _0x479190=_0x10bd7e[_0xd5f5('0x4d')][_0xd5f5('0x4e')]({'plain':!![]});if(!_0x479190)throw new Error(_0xd5f5('0x4f'));if(_0x479190[_0xd5f5('0x50')]==='user'){var _0x4bdc5c=_0x4377f6[_0xd5f5('0x4e')]({'plain':!![]});var _0x3c1a1e='ODBC';return db['UserProfileSection']['find']({'where':{'name':_0x3c1a1e,'userProfileId':_0x479190['userProfileId']},'raw':!![]})['then'](function(_0x3ee0d4){if(_0x3ee0d4&&_0x3ee0d4[_0xd5f5('0x51')]===0x0){return db[_0xd5f5('0x28')]['create']({'name':_0x4bdc5c[_0xd5f5('0x2c')],'resourceId':_0x4bdc5c['id'],'type':_0x3ee0d4[_0xd5f5('0x2c')],'sectionId':_0x3ee0d4['id']},{})[_0xd5f5('0x26')](function(){return _0x4377f6;});}else{return _0x4377f6;}})[_0xd5f5('0x46')](function(_0x39767b){logger[_0xd5f5('0x2a')](_0xd5f5('0x52'),_0x39767b);throw _0x39767b;});}return _0x4377f6;})[_0xd5f5('0x26')](respondWithResult(_0x1466d8,0xc9))['catch'](handleError(_0x1466d8,null));};exports[_0xd5f5('0x24')]=function(_0x334e9d,_0xf2bb40){if(_0x334e9d[_0xd5f5('0x53')]['id']){delete _0x334e9d['body']['id'];}return db[_0xd5f5('0x30')][_0xd5f5('0x4b')]({'where':{'id':_0x334e9d[_0xd5f5('0x48')]['id']}})[_0xd5f5('0x26')](handleEntityNotFound(_0xf2bb40,null))[_0xd5f5('0x26')](saveUpdates(_0x334e9d[_0xd5f5('0x53')],null))[_0xd5f5('0x26')](respondWithResult(_0xf2bb40,null))['catch'](handleError(_0xf2bb40,null));};exports['destroy']=function(_0x1fd29c,_0x189960){return db[_0xd5f5('0x30')][_0xd5f5('0x4b')]({'where':{'id':_0x1fd29c[_0xd5f5('0x48')]['id']}})[_0xd5f5('0x26')](handleEntityNotFound(_0x189960,null))['then'](removeEntity(_0x189960,null))[_0xd5f5('0x46')](handleError(_0x189960,null));};exports[_0xd5f5('0x54')]=function(_0x5fdbec,_0x36865c,_0x31a3ae){var _0x97cd92;return db[_0xd5f5('0x30')][_0xd5f5('0x4b')]({'where':{'id':_0x5fdbec['params']['id']},'attributes':['id',_0xd5f5('0x55')]})[_0xd5f5('0x26')](handleEntityNotFound(_0x36865c,null))[_0xd5f5('0x26')](function(_0x4ccd8d){if(_0x4ccd8d){var _0x4916c8=require('odbc')();_0x4916c8[_0xd5f5('0x56')](_0x4ccd8d[_0xd5f5('0x55')]);_0x4916c8[_0xd5f5('0x57')]();return _0x4ccd8d;}})[_0xd5f5('0x26')](respondWithResult(_0x36865c,null))['catch'](handleError(_0x36865c,null));}; \ No newline at end of file +var _0x1725=['update','then','destroy','get','UserProfileResource','error','name','send','map','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','SquareOdbc','findAll','rows','catch','show','rawAttributes','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x1725,0x88));var _0x5172=function(_0x1c31f4,_0x8e8aeb){_0x1c31f4=_0x1c31f4-0x0;var _0x5a3f66=_0x1725[_0x1c31f4];return _0x5a3f66;};'use strict';var emlformat=require(_0x5172('0x0'));var rimraf=require(_0x5172('0x1'));var zipdir=require(_0x5172('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5172('0x3'));var Mustache=require(_0x5172('0x4'));var util=require('util');var path=require(_0x5172('0x5'));var sox=require(_0x5172('0x6'));var csv=require(_0x5172('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5172('0x8'));var _=require(_0x5172('0x9'));var squel=require('squel');var crypto=require(_0x5172('0xa'));var jsforce=require(_0x5172('0xb'));var deskjs=require(_0x5172('0xc'));var toCsv=require(_0x5172('0x7'));var querystring=require(_0x5172('0xd'));var Papa=require(_0x5172('0xe'));var Redis=require(_0x5172('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5172('0x10'));var as=require(_0x5172('0x11'));var hardwareService=require(_0x5172('0x12'));var logger=require('../../config/logger')(_0x5172('0x13'));var utils=require(_0x5172('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5172('0x15'));var db=require(_0x5172('0x16'))['db'];function respondWithStatusCode(_0x3c0e15,_0x5de304){_0x5de304=_0x5de304||0xcc;return function(_0x1d7119){if(_0x1d7119){return _0x3c0e15[_0x5172('0x17')](_0x5de304);}return _0x3c0e15[_0x5172('0x18')](_0x5de304)[_0x5172('0x19')]();};}function respondWithResult(_0x10aca0,_0x23fdb4){_0x23fdb4=_0x23fdb4||0xc8;return function(_0x34b920){if(_0x34b920){return _0x10aca0[_0x5172('0x18')](_0x23fdb4)[_0x5172('0x1a')](_0x34b920);}};}function respondWithFilteredResult(_0x2af59f,_0x162964){return function(_0x2f9238){if(_0x2f9238){var _0x2712ef=typeof _0x162964[_0x5172('0x1b')]===_0x5172('0x1c')&&typeof _0x162964[_0x5172('0x1d')]==='undefined';var _0x50d4c1=_0x2f9238[_0x5172('0x1e')];var _0x5a944b=_0x2712ef?0x0:_0x162964[_0x5172('0x1b')];var _0x54b95b=_0x2712ef?_0x2f9238[_0x5172('0x1e')]:_0x162964['offset']+_0x162964[_0x5172('0x1d')];var _0x2cf88b;if(_0x54b95b>=_0x50d4c1){_0x54b95b=_0x50d4c1;_0x2cf88b=0xc8;}else{_0x2cf88b=0xce;}_0x2af59f[_0x5172('0x18')](_0x2cf88b);return _0x2af59f[_0x5172('0x1f')](_0x5172('0x20'),_0x5a944b+'-'+_0x54b95b+'/'+_0x50d4c1)[_0x5172('0x1a')](_0x2f9238);}return null;};}function patchUpdates(_0x50d3fe){return function(_0x356c07){try{jsonpatch[_0x5172('0x21')](_0x356c07,_0x50d3fe,!![]);}catch(_0x3ebfd8){return BPromise[_0x5172('0x22')](_0x3ebfd8);}return _0x356c07[_0x5172('0x23')]();};}function saveUpdates(_0x49f017,_0x7b0976){return function(_0x391646){if(_0x391646){return _0x391646[_0x5172('0x24')](_0x49f017)[_0x5172('0x25')](function(_0x46b378){return _0x46b378;});}return null;};}function removeEntity(_0x202f01,_0x257320){return function(_0x303aad){if(_0x303aad){return _0x303aad[_0x5172('0x26')]()[_0x5172('0x25')](function(){var _0x4a8a1d=_0x303aad[_0x5172('0x27')]({'plain':!![]});var _0x4511e7='ODBC';return db[_0x5172('0x28')][_0x5172('0x26')]({'where':{'type':_0x4511e7,'resourceId':_0x4a8a1d['id']}})[_0x5172('0x25')](function(){return _0x303aad;});})[_0x5172('0x25')](function(){_0x202f01[_0x5172('0x18')](0xcc)[_0x5172('0x19')]();});}};}function handleEntityNotFound(_0x4afa6b,_0x5f1db8){return function(_0x3505d7){if(!_0x3505d7){_0x4afa6b[_0x5172('0x17')](0x194);}return _0x3505d7;};}function handleError(_0x2817cd,_0x581c49){_0x581c49=_0x581c49||0x1f4;return function(_0x287be2){logger[_0x5172('0x29')](_0x287be2['stack']);if(_0x287be2[_0x5172('0x2a')]){delete _0x287be2['name'];}_0x2817cd[_0x5172('0x18')](_0x581c49)[_0x5172('0x2b')](_0x287be2);};}exports['index']=function(_0xf3a0c5,_0x57eb65){var _0x17bf2a={},_0x27bf35={},_0x5f387b={'count':0x0,'rows':[]};var _0x44f917=_[_0x5172('0x2c')](db['SquareOdbc']['rawAttributes'],function(_0x4dee2f){return{'name':_0x4dee2f['fieldName'],'type':_0x4dee2f[_0x5172('0x2d')]['key']};});_0x27bf35[_0x5172('0x2e')]=_[_0x5172('0x2c')](_0x44f917,_0x5172('0x2a'));_0x27bf35[_0x5172('0x2f')]=_['keys'](_0xf3a0c5[_0x5172('0x2f')]);_0x27bf35[_0x5172('0x30')]=_[_0x5172('0x31')](_0x27bf35['model'],_0x27bf35[_0x5172('0x2f')]);_0x17bf2a[_0x5172('0x32')]=_[_0x5172('0x31')](_0x27bf35['model'],qs['fields'](_0xf3a0c5[_0x5172('0x2f')][_0x5172('0x33')]));_0x17bf2a['attributes']=_0x17bf2a[_0x5172('0x32')]['length']?_0x17bf2a[_0x5172('0x32')]:_0x27bf35['model'];if(!_0xf3a0c5[_0x5172('0x2f')]['hasOwnProperty'](_0x5172('0x34'))){_0x17bf2a[_0x5172('0x1d')]=qs['limit'](_0xf3a0c5[_0x5172('0x2f')][_0x5172('0x1d')]);_0x17bf2a['offset']=qs['offset'](_0xf3a0c5[_0x5172('0x2f')][_0x5172('0x1b')]);}_0x17bf2a[_0x5172('0x35')]=qs[_0x5172('0x36')](_0xf3a0c5[_0x5172('0x2f')][_0x5172('0x36')]);_0x17bf2a['where']=qs['filters'](_[_0x5172('0x37')](_0xf3a0c5[_0x5172('0x2f')],_0x27bf35[_0x5172('0x30')]),_0x44f917);if(_0xf3a0c5[_0x5172('0x2f')][_0x5172('0x38')]){_0x17bf2a['where']=_[_0x5172('0x39')](_0x17bf2a[_0x5172('0x3a')],{'$or':_[_0x5172('0x2c')](_0x44f917,function(_0x4fde5b){if(_0x4fde5b[_0x5172('0x2d')]!=='VIRTUAL'){var _0x5d3950={};_0x5d3950[_0x4fde5b['name']]={'$like':'%'+_0xf3a0c5[_0x5172('0x2f')]['filter']+'%'};return _0x5d3950;}})});}_0x17bf2a=_[_0x5172('0x39')]({},_0x17bf2a,_0xf3a0c5[_0x5172('0x3b')]);var _0x5511c0={'where':_0x17bf2a[_0x5172('0x3a')]};return db['SquareOdbc'][_0x5172('0x1e')](_0x5511c0)['then'](function(_0x382ebd){_0x5f387b[_0x5172('0x1e')]=_0x382ebd;if(_0xf3a0c5[_0x5172('0x2f')][_0x5172('0x3c')]){_0x17bf2a[_0x5172('0x3d')]=[{'all':!![]}];}return db[_0x5172('0x3e')][_0x5172('0x3f')](_0x17bf2a);})['then'](function(_0x5e6415){_0x5f387b[_0x5172('0x40')]=_0x5e6415;return _0x5f387b;})[_0x5172('0x25')](respondWithFilteredResult(_0x57eb65,_0x17bf2a))[_0x5172('0x41')](handleError(_0x57eb65,null));};exports[_0x5172('0x42')]=function(_0x4b5d3b,_0xe2ed6){var _0x18aa59={'raw':!![],'where':{'id':_0x4b5d3b['params']['id']}},_0x49ac5a={};_0x49ac5a[_0x5172('0x2e')]=_['keys'](db[_0x5172('0x3e')][_0x5172('0x43')]);_0x49ac5a[_0x5172('0x2f')]=_[_0x5172('0x44')](_0x4b5d3b[_0x5172('0x2f')]);_0x49ac5a[_0x5172('0x30')]=_['intersection'](_0x49ac5a['model'],_0x49ac5a[_0x5172('0x2f')]);_0x18aa59[_0x5172('0x32')]=_['intersection'](_0x49ac5a[_0x5172('0x2e')],qs[_0x5172('0x33')](_0x4b5d3b[_0x5172('0x2f')][_0x5172('0x33')]));_0x18aa59['attributes']=_0x18aa59['attributes'][_0x5172('0x45')]?_0x18aa59[_0x5172('0x32')]:_0x49ac5a[_0x5172('0x2e')];if(_0x4b5d3b[_0x5172('0x2f')][_0x5172('0x3c')]){_0x18aa59[_0x5172('0x3d')]=[{'all':!![]}];}_0x18aa59=_[_0x5172('0x39')]({},_0x18aa59,_0x4b5d3b[_0x5172('0x3b')]);return db[_0x5172('0x3e')][_0x5172('0x46')](_0x18aa59)[_0x5172('0x25')](handleEntityNotFound(_0xe2ed6,null))[_0x5172('0x25')](respondWithResult(_0xe2ed6,null))[_0x5172('0x41')](handleError(_0xe2ed6,null));};exports['create']=function(_0x18e17e,_0x33babc){return db['SquareOdbc'][_0x5172('0x47')](_0x18e17e[_0x5172('0x48')],{})[_0x5172('0x25')](function(_0x32b562){var _0x2d8125=_0x18e17e[_0x5172('0x49')]['get']({'plain':!![]});if(!_0x2d8125)throw new Error(_0x5172('0x4a'));if(_0x2d8125[_0x5172('0x4b')]===_0x5172('0x49')){var _0x36e919=_0x32b562[_0x5172('0x27')]({'plain':!![]});var _0x3c6708='ODBC';return db[_0x5172('0x4c')]['find']({'where':{'name':_0x3c6708,'userProfileId':_0x2d8125[_0x5172('0x4d')]},'raw':!![]})[_0x5172('0x25')](function(_0x16899e){if(_0x16899e&&_0x16899e[_0x5172('0x4e')]===0x0){return db[_0x5172('0x28')][_0x5172('0x47')]({'name':_0x36e919['name'],'resourceId':_0x36e919['id'],'type':_0x16899e[_0x5172('0x2a')],'sectionId':_0x16899e['id']},{})[_0x5172('0x25')](function(){return _0x32b562;});}else{return _0x32b562;}})[_0x5172('0x41')](function(_0x1f3326){logger[_0x5172('0x29')](_0x5172('0x4f'),_0x1f3326);throw _0x1f3326;});}return _0x32b562;})[_0x5172('0x25')](respondWithResult(_0x33babc,0xc9))[_0x5172('0x41')](handleError(_0x33babc,null));};exports[_0x5172('0x24')]=function(_0x523846,_0x3ee542){if(_0x523846['body']['id']){delete _0x523846['body']['id'];}return db[_0x5172('0x3e')]['find']({'where':{'id':_0x523846[_0x5172('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ee542,null))[_0x5172('0x25')](saveUpdates(_0x523846[_0x5172('0x48')],null))[_0x5172('0x25')](respondWithResult(_0x3ee542,null))[_0x5172('0x41')](handleError(_0x3ee542,null));};exports['destroy']=function(_0x292461,_0x3f75fa){return db[_0x5172('0x3e')]['find']({'where':{'id':_0x292461[_0x5172('0x50')]['id']}})[_0x5172('0x25')](handleEntityNotFound(_0x3f75fa,null))['then'](removeEntity(_0x3f75fa,null))[_0x5172('0x41')](handleError(_0x3f75fa,null));};exports[_0x5172('0x51')]=function(_0x472163,_0x88494d,_0xdb5829){var _0x8fd20e;return db[_0x5172('0x3e')][_0x5172('0x46')]({'where':{'id':_0x472163[_0x5172('0x50')]['id']},'attributes':['id',_0x5172('0x52')]})[_0x5172('0x25')](handleEntityNotFound(_0x88494d,null))[_0x5172('0x25')](function(_0x353425){if(_0x353425){var _0x9570fb=require(_0x5172('0x53'))();_0x9570fb[_0x5172('0x54')](_0x353425['dsn']);_0x9570fb[_0x5172('0x55')]();return _0x353425;}})[_0x5172('0x25')](respondWithResult(_0x88494d,null))[_0x5172('0x41')](handleError(_0x88494d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 63a2811..03fc6ff 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 _0xb1fa=['./squareOdbc.attributes','define','square_odbc','../../config/logger','moment'];(function(_0x399cb9,_0x93301f){var _0x1f196c=function(_0x48eb20){while(--_0x48eb20){_0x399cb9['push'](_0x399cb9['shift']());}};_0x1f196c(++_0x93301f);}(_0xb1fa,0x9e));var _0xab1f=function(_0x2d48a2,_0x99032b){_0x2d48a2=_0x2d48a2-0x0;var _0x4d768e=_0xb1fa[_0x2d48a2];return _0x4d768e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab1f('0x0'))('api');var moment=require(_0xab1f('0x1'));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(_0xab1f('0x2'));module['exports']=function(_0x50ada8,_0x4ee73b){return _0x50ada8[_0xab1f('0x3')]('SquareOdbc',attributes,{'tableName':_0xab1f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ce=['SquareOdbc','square_odbc','lodash','api','moment','bluebird','request-promise','define'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xf4ce,0xf2));var _0xef4c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf4ce[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xef4c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef4c('0x1'));var moment=require(_0xef4c('0x2'));var BPromise=require(_0xef4c('0x3'));var rp=require(_0xef4c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x2488f4,_0x3e7b2a){return _0x2488f4[_0xef4c('0x5')](_0xef4c('0x6'),attributes,{'tableName':_0xef4c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index a745d05..f451223 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 _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(_0x10a578,_0x581165){var _0x5d991b=function(_0x4c7758){while(--_0x4c7758){_0x10a578['push'](_0x10a578['shift']());}};_0x5d991b(++_0x581165);}(_0x7217,0x19e));var _0x7721=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7217[_0x92c450];return _0x2a9599;};'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 +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x30d3c1,_0xa3da89){var _0x571ee9=function(_0xcbe38d){while(--_0xcbe38d){_0x30d3c1['push'](_0x30d3c1['shift']());}};_0x571ee9(++_0xa3da89);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x5fc3[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 86ed05e..fa99c49 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 _0x087e=['getUsers','post','create','addUsers','update','delete','removeUsers','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x087e,0x18f));var _0xe087=function(_0x5b32d9,_0x59b4a7){_0x5b32d9=_0x5b32d9-0x0;var _0x136cb7=_0x087e[_0x5b32d9];return _0x136cb7;};'use strict';var multer=require('multer');var util=require(_0xe087('0x0'));var path=require(_0xe087('0x1'));var timeout=require(_0xe087('0x2'));var express=require('express');var router=express[_0xe087('0x3')]();var fs_extra=require(_0xe087('0x4'));var auth=require(_0xe087('0x5'));var interaction=require(_0xe087('0x6'));var config=require(_0xe087('0x7'));var controller=require(_0xe087('0x8'));router[_0xe087('0x9')]('/',auth[_0xe087('0xa')](),controller[_0xe087('0xb')]);router[_0xe087('0x9')](_0xe087('0xc'),auth['isAuthenticated'](),controller[_0xe087('0xd')]);router['get'](_0xe087('0xe'),auth[_0xe087('0xa')](),controller[_0xe087('0xf')]);router[_0xe087('0x10')]('/',auth[_0xe087('0xa')](),controller[_0xe087('0x11')]);router[_0xe087('0x10')](_0xe087('0xe'),auth[_0xe087('0xa')](),controller[_0xe087('0x12')]);router['put'](_0xe087('0xc'),auth[_0xe087('0xa')](),controller[_0xe087('0x13')]);router[_0xe087('0x14')](_0xe087('0xc'),auth[_0xe087('0xa')](),controller['destroy']);router[_0xe087('0x14')](_0xe087('0xe'),auth[_0xe087('0xa')](),controller[_0xe087('0x15')]);module[_0xe087('0x16')]=router; \ No newline at end of file +var _0x2816=['../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5e2a0f,_0x447ab4){var _0x3e8c10=function(_0x56dd4e){while(--_0x56dd4e){_0x5e2a0f['push'](_0x5e2a0f['shift']());}};_0x3e8c10(++_0x447ab4);}(_0x2816,0x117));var _0x6281=function(_0x121050,_0x4d7b5a){_0x121050=_0x121050-0x0;var _0x533103=_0x2816[_0x121050];return _0x533103;};'use strict';var multer=require(_0x6281('0x0'));var util=require(_0x6281('0x1'));var path=require(_0x6281('0x2'));var timeout=require(_0x6281('0x3'));var express=require('express');var router=express[_0x6281('0x4')]();var fs_extra=require(_0x6281('0x5'));var auth=require(_0x6281('0x6'));var interaction=require(_0x6281('0x7'));var config=require(_0x6281('0x8'));var controller=require(_0x6281('0x9'));router[_0x6281('0xa')]('/',auth[_0x6281('0xb')](),controller[_0x6281('0xc')]);router[_0x6281('0xa')](_0x6281('0xd'),auth['isAuthenticated'](),controller[_0x6281('0xe')]);router[_0x6281('0xa')](_0x6281('0xf'),auth['isAuthenticated'](),controller[_0x6281('0x10')]);router[_0x6281('0x11')]('/',auth[_0x6281('0xb')](),controller['create']);router[_0x6281('0x11')](_0x6281('0xf'),auth[_0x6281('0xb')](),controller[_0x6281('0x12')]);router[_0x6281('0x13')](_0x6281('0xd'),auth[_0x6281('0xb')](),controller['update']);router[_0x6281('0x14')]('/:id',auth[_0x6281('0xb')](),controller['destroy']);router[_0x6281('0x14')](_0x6281('0xf'),auth[_0x6281('0xb')](),controller['removeUsers']);module[_0x6281('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index c8dce3a..589f859 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 _0xe493=['preproduction','toString','utf8','getDataValue','DATE','sequelize','exports','STRING','name','BLOB','long'];(function(_0x468027,_0x2b07b3){var _0x36821e=function(_0x188bc8){while(--_0x188bc8){_0x468027['push'](_0x468027['shift']());}};_0x36821e(++_0x2b07b3);}(_0xe493,0x7e));var _0x3e49=function(_0x3f20d3,_0x4d0a10){_0x3f20d3=_0x3f20d3-0x0;var _0x5d1fa4=_0xe493[_0x3f20d3];return _0x5d1fa4;};'use strict';var Sequelize=require(_0x3e49('0x0'));module[_0x3e49('0x1')]={'name':{'type':Sequelize[_0x3e49('0x2')],'unique':_0x3e49('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3e49('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x3e49('0x4')](_0x3e49('0x5')),'get':function(){if(this['getDataValue'](_0x3e49('0x6'))){return this['getDataValue'](_0x3e49('0x6'))[_0x3e49('0x7')](_0x3e49('0x8'));}}},'production':{'type':Sequelize[_0x3e49('0x4')](_0x3e49('0x5')),'get':function(){if(this[_0x3e49('0x9')]('production')){return this['getDataValue']('production')[_0x3e49('0x7')](_0x3e49('0x8'));}}},'savedAt':{'type':Sequelize[_0x3e49('0xa')]},'publishedAt':{'type':Sequelize[_0x3e49('0xa')]}}; \ No newline at end of file +var _0x769d=['long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x4cbb56,_0x4454ef){var _0x104909=function(_0x3c8ad1){while(--_0x3c8ad1){_0x4cbb56['push'](_0x4cbb56['shift']());}};_0x104909(++_0x4454ef);}(_0x769d,0x132));var _0xd769=function(_0x49efc8,_0x2497a5){_0x49efc8=_0x49efc8-0x0;var _0x2b3b84=_0x769d[_0x49efc8];return _0x2b3b84;};'use strict';var Sequelize=require(_0xd769('0x0'));module[_0xd769('0x1')]={'name':{'type':Sequelize[_0xd769('0x2')],'unique':_0xd769('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd769('0x2')]},'notes':{'type':Sequelize[_0xd769('0x4')]},'preproduction':{'type':Sequelize[_0xd769('0x5')](_0xd769('0x6')),'get':function(){if(this[_0xd769('0x7')](_0xd769('0x8'))){return this['getDataValue'](_0xd769('0x8'))[_0xd769('0x9')](_0xd769('0xa'));}}},'production':{'type':Sequelize[_0xd769('0x5')](_0xd769('0x6')),'get':function(){if(this[_0xd769('0x7')](_0xd769('0xb'))){return this['getDataValue']('production')['toString'](_0xd769('0xa'));}}},'savedAt':{'type':Sequelize[_0xd769('0xc')]},'publishedAt':{'type':Sequelize[_0xd769('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index fbb5ebb..527e969 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 _0x50a6=['register','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','SquareProject','rawAttributes','model','map','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','length','userSquareProject:remove','getUsers','findOne','User','pick','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./squareProject.socket'];(function(_0x1aa748,_0x22617e){var _0x4f885a=function(_0x12f73d){while(--_0x12f73d){_0x1aa748['push'](_0x1aa748['shift']());}};_0x4f885a(++_0x22617e);}(_0x50a6,0xa4));var _0x650a=function(_0x13a913,_0x400d93){_0x13a913=_0x13a913-0x0;var _0xbf71de=_0x50a6[_0x13a913];return _0xbf71de;};'use strict';var emlformat=require(_0x650a('0x0'));var rimraf=require(_0x650a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x650a('0x2'));var moment=require('moment');var BPromise=require(_0x650a('0x3'));var Mustache=require(_0x650a('0x4'));var util=require(_0x650a('0x5'));var path=require('path');var sox=require(_0x650a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x650a('0x7'));var _=require(_0x650a('0x8'));var squel=require(_0x650a('0x9'));var crypto=require(_0x650a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x650a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x650a('0xc'));var Papa=require(_0x650a('0xd'));var Redis=require('ioredis');var authService=require(_0x650a('0xe'));var qs=require(_0x650a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x650a('0x10'));var logger=require('../../config/logger')(_0x650a('0x11'));var utils=require('../../config/utils');var config=require(_0x650a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x650a('0x13'))['db'];config['redis']=_[_0x650a('0x14')](config[_0x650a('0x15')],{'host':_0x650a('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x650a('0x15')]));require(_0x650a('0x17'))[_0x650a('0x18')](socket);function respondWithStatusCode(_0x15f2fd,_0x35c6dc){_0x35c6dc=_0x35c6dc||0xcc;return function(_0x24f11f){if(_0x24f11f){return _0x15f2fd['sendStatus'](_0x35c6dc);}return _0x15f2fd[_0x650a('0x19')](_0x35c6dc)['end']();};}function respondWithResult(_0x1f94ab,_0x3c2206){_0x3c2206=_0x3c2206||0xc8;return function(_0x348fda){if(_0x348fda){return _0x1f94ab['status'](_0x3c2206)['json'](_0x348fda);}};}function respondWithFilteredResult(_0x5285e0,_0x52e5bb){return function(_0x2ad2d7){if(_0x2ad2d7){var _0x359314=typeof _0x52e5bb[_0x650a('0x1a')]===_0x650a('0x1b')&&typeof _0x52e5bb[_0x650a('0x1c')]==='undefined';var _0x4eba86=_0x2ad2d7[_0x650a('0x1d')];var _0x1c65f6=_0x359314?0x0:_0x52e5bb['offset'];var _0x2e2761=_0x359314?_0x2ad2d7[_0x650a('0x1d')]:_0x52e5bb['offset']+_0x52e5bb[_0x650a('0x1c')];var _0x1ceedd;if(_0x2e2761>=_0x4eba86){_0x2e2761=_0x4eba86;_0x1ceedd=0xc8;}else{_0x1ceedd=0xce;}_0x5285e0[_0x650a('0x19')](_0x1ceedd);return _0x5285e0[_0x650a('0x1e')](_0x650a('0x1f'),_0x1c65f6+'-'+_0x2e2761+'/'+_0x4eba86)['json'](_0x2ad2d7);}return null;};}function patchUpdates(_0x88531d){return function(_0x5d547f){try{jsonpatch[_0x650a('0x20')](_0x5d547f,_0x88531d,!![]);}catch(_0x1d471d){return BPromise[_0x650a('0x21')](_0x1d471d);}return _0x5d547f[_0x650a('0x22')]();};}function saveUpdates(_0x2ed256,_0x326d60){return function(_0x40117a){if(_0x40117a){return _0x40117a[_0x650a('0x23')](_0x2ed256)[_0x650a('0x24')](function(_0x2761a8){return _0x2761a8;});}return null;};}function removeEntity(_0xa902e6,_0x234fce){return function(_0xd89a9e){if(_0xd89a9e){return _0xd89a9e[_0x650a('0x25')]()[_0x650a('0x24')](function(){var _0x39a155=_0xd89a9e[_0x650a('0x26')]({'plain':!![]});var _0x12fdb4='SquareProjects';return db[_0x650a('0x27')][_0x650a('0x25')]({'where':{'type':_0x12fdb4,'resourceId':_0x39a155['id']}})[_0x650a('0x24')](function(){return _0xd89a9e;});})['then'](function(){_0xa902e6[_0x650a('0x19')](0xcc)[_0x650a('0x28')]();});}};}function handleEntityNotFound(_0x454ff8,_0x783509){return function(_0x3c5bd4){if(!_0x3c5bd4){_0x454ff8[_0x650a('0x29')](0x194);}return _0x3c5bd4;};}function handleError(_0x4d0848,_0x190a65){_0x190a65=_0x190a65||0x1f4;return function(_0x1c8621){logger[_0x650a('0x2a')](_0x1c8621[_0x650a('0x2b')]);if(_0x1c8621[_0x650a('0x2c')]){delete _0x1c8621[_0x650a('0x2c')];}_0x4d0848[_0x650a('0x19')](_0x190a65)[_0x650a('0x2d')](_0x1c8621);};}exports['index']=function(_0x614b0e,_0x3c2eda){var _0x2e0370={},_0x5123c9={},_0x12d846={'count':0x0,'rows':[]};var _0x1c0770=_['map'](db[_0x650a('0x2e')][_0x650a('0x2f')],function(_0x41cdc6){return{'name':_0x41cdc6['fieldName'],'type':_0x41cdc6['type']['key']};});_0x5123c9[_0x650a('0x30')]=_[_0x650a('0x31')](_0x1c0770,_0x650a('0x2c'));_0x5123c9[_0x650a('0x32')]=_['keys'](_0x614b0e[_0x650a('0x32')]);_0x5123c9[_0x650a('0x33')]=_['intersection'](_0x5123c9[_0x650a('0x30')],_0x5123c9[_0x650a('0x32')]);_0x2e0370[_0x650a('0x34')]=_[_0x650a('0x35')](_0x5123c9[_0x650a('0x30')],qs['fields'](_0x614b0e[_0x650a('0x32')]['fields']));_0x2e0370[_0x650a('0x34')]=_0x2e0370[_0x650a('0x34')]['length']?_0x2e0370[_0x650a('0x34')]:_0x5123c9[_0x650a('0x30')];if(!_0x614b0e['query'][_0x650a('0x36')](_0x650a('0x37'))){_0x2e0370[_0x650a('0x1c')]=qs['limit'](_0x614b0e[_0x650a('0x32')][_0x650a('0x1c')]);_0x2e0370[_0x650a('0x1a')]=qs[_0x650a('0x1a')](_0x614b0e['query'][_0x650a('0x1a')]);}_0x2e0370[_0x650a('0x38')]=qs[_0x650a('0x39')](_0x614b0e['query']['sort']);_0x2e0370[_0x650a('0x3a')]=qs[_0x650a('0x33')](_['pick'](_0x614b0e[_0x650a('0x32')],_0x5123c9['filters']),_0x1c0770);if(_0x614b0e[_0x650a('0x32')][_0x650a('0x3b')]){_0x2e0370[_0x650a('0x3a')]=_[_0x650a('0x3c')](_0x2e0370[_0x650a('0x3a')],{'$or':_['map'](_0x1c0770,function(_0x20ba76){if(_0x20ba76['type']!==_0x650a('0x3d')){var _0x1d65b4={};_0x1d65b4[_0x20ba76[_0x650a('0x2c')]]={'$like':'%'+_0x614b0e[_0x650a('0x32')][_0x650a('0x3b')]+'%'};return _0x1d65b4;}})});}_0x2e0370=_[_0x650a('0x3c')]({},_0x2e0370,_0x614b0e[_0x650a('0x3e')]);var _0x4c75fe={'where':_0x2e0370['where']};return db[_0x650a('0x2e')]['count'](_0x4c75fe)['then'](function(_0x1e0868){_0x12d846['count']=_0x1e0868;if(_0x614b0e[_0x650a('0x32')]['includeAll']){_0x2e0370[_0x650a('0x3f')]=[{'all':!![]}];}return db[_0x650a('0x2e')][_0x650a('0x40')](_0x2e0370);})[_0x650a('0x24')](function(_0x409495){_0x12d846[_0x650a('0x41')]=_0x409495;return _0x12d846;})[_0x650a('0x24')](respondWithFilteredResult(_0x3c2eda,_0x2e0370))[_0x650a('0x42')](handleError(_0x3c2eda,null));};exports[_0x650a('0x43')]=function(_0x25c0a2,_0x205dfe){var _0x381632={'raw':![],'where':{'id':_0x25c0a2[_0x650a('0x44')]['id']}},_0x4ac78e={};_0x4ac78e[_0x650a('0x30')]=_[_0x650a('0x45')](db[_0x650a('0x2e')][_0x650a('0x2f')]);_0x4ac78e[_0x650a('0x32')]=_['keys'](_0x25c0a2[_0x650a('0x32')]);_0x4ac78e[_0x650a('0x33')]=_[_0x650a('0x35')](_0x4ac78e[_0x650a('0x30')],_0x4ac78e[_0x650a('0x32')]);_0x381632[_0x650a('0x34')]=_['intersection'](_0x4ac78e['model'],qs[_0x650a('0x46')](_0x25c0a2[_0x650a('0x32')][_0x650a('0x46')]));_0x381632['attributes']=_0x381632[_0x650a('0x34')]['length']?_0x381632[_0x650a('0x34')]:_0x4ac78e[_0x650a('0x30')];if(_0x25c0a2['query'][_0x650a('0x47')]){_0x381632[_0x650a('0x3f')]=[{'all':!![]}];}_0x381632=_[_0x650a('0x3c')]({},_0x381632,_0x25c0a2['options']);return db[_0x650a('0x2e')][_0x650a('0x48')](_0x381632)[_0x650a('0x24')](handleEntityNotFound(_0x205dfe,null))['then'](respondWithResult(_0x205dfe,null))[_0x650a('0x42')](handleError(_0x205dfe,null));};exports[_0x650a('0x49')]=function(_0x34fa7a,_0x11bb6b){return db[_0x650a('0x2e')]['create'](_0x34fa7a['body'],{})[_0x650a('0x24')](function(_0x34fdcf){var _0x5b2907=_0x34fa7a[_0x650a('0x4a')][_0x650a('0x26')]({'plain':!![]});if(!_0x5b2907)throw new Error(_0x650a('0x4b'));if(_0x5b2907[_0x650a('0x4c')]===_0x650a('0x4a')){var _0x8bef2c=_0x34fdcf['get']({'plain':!![]});var _0x1e1996=_0x650a('0x4d');return db[_0x650a('0x4e')][_0x650a('0x48')]({'where':{'name':_0x1e1996,'userProfileId':_0x5b2907[_0x650a('0x4f')]},'raw':!![]})['then'](function(_0x45346f){if(_0x45346f&&_0x45346f[_0x650a('0x50')]===0x0){return db[_0x650a('0x27')][_0x650a('0x49')]({'name':_0x8bef2c['name'],'resourceId':_0x8bef2c['id'],'type':_0x45346f['name'],'sectionId':_0x45346f['id']},{})[_0x650a('0x24')](function(){return _0x34fdcf;});}else{return _0x34fdcf;}})[_0x650a('0x42')](function(_0x5c2be4){logger[_0x650a('0x2a')](_0x650a('0x51'),_0x5c2be4);throw _0x5c2be4;});}return _0x34fdcf;})[_0x650a('0x24')](respondWithResult(_0x11bb6b,0xc9))[_0x650a('0x42')](handleError(_0x11bb6b,null));};exports[_0x650a('0x23')]=function(_0x459f29,_0x36c517){if(_0x459f29[_0x650a('0x52')]['id']){delete _0x459f29[_0x650a('0x52')]['id'];}return db[_0x650a('0x2e')][_0x650a('0x48')]({'where':{'id':_0x459f29[_0x650a('0x44')]['id']}})[_0x650a('0x24')](handleEntityNotFound(_0x36c517,null))[_0x650a('0x24')](saveUpdates(_0x459f29[_0x650a('0x52')],null))['then'](respondWithResult(_0x36c517,null))['catch'](handleError(_0x36c517,null));};exports[_0x650a('0x25')]=function(_0x2abb94,_0x4ff3da){return db['SquareProject'][_0x650a('0x48')]({'where':{'id':_0x2abb94['params']['id']}})[_0x650a('0x24')](handleEntityNotFound(_0x4ff3da,null))['then'](removeEntity(_0x4ff3da,null))['catch'](handleError(_0x4ff3da,null));};exports[_0x650a('0x53')]=function(_0x508e45,_0x449dbf,_0x308419){return db['SquareProject'][_0x650a('0x48')]({'where':{'id':_0x508e45[_0x650a('0x44')]['id']}})[_0x650a('0x24')](handleEntityNotFound(_0x449dbf,null))[_0x650a('0x24')](function(_0x22d6eb){if(_0x22d6eb){return _0x22d6eb[_0x650a('0x53')](_0x508e45['body'][_0x650a('0x54')],_[_0x650a('0x55')](_0x508e45[_0x650a('0x52')],['ids','id'])||{});}})[_0x650a('0x24')](respondWithResult(_0x449dbf,null))[_0x650a('0x42')](handleError(_0x449dbf,null));};exports[_0x650a('0x56')]=function(_0x5920a6,_0x581ead,_0x1cf56e){return db[_0x650a('0x2e')]['find']({'where':{'id':_0x5920a6[_0x650a('0x44')]['id']}})[_0x650a('0x24')](handleEntityNotFound(_0x581ead,null))[_0x650a('0x24')](function(_0x3624ee){if(_0x3624ee){return _0x3624ee[_0x650a('0x56')](_0x5920a6[_0x650a('0x32')]['ids'])[_0x650a('0x24')](function(){if(_[_0x650a('0x57')](_0x5920a6[_0x650a('0x32')]['ids'])){for(var _0x436531=0x0;_0x436531<_0x5920a6[_0x650a('0x32')]['ids'][_0x650a('0x58')];_0x436531+=0x1){socket['emit'](_0x650a('0x59'),{'UserId':Number(_0x5920a6['query'][_0x650a('0x54')][_0x436531]),'SquareProjectId':Number(_0x5920a6[_0x650a('0x44')]['id'])});}}else{socket['emit'](_0x650a('0x59'),{'UserId':Number(_0x5920a6[_0x650a('0x32')][_0x650a('0x54')]),'SquareProjectId':Number(_0x5920a6[_0x650a('0x44')]['id'])});}});}})[_0x650a('0x24')](respondWithStatusCode(_0x581ead,null))[_0x650a('0x42')](handleError(_0x581ead,null));};exports[_0x650a('0x5a')]=function(_0x338841,_0x5a08d9,_0x180854){var _0x1eb780={};var _0x34cfb0={};var _0xba1b88;var _0x4bbccd;return db['SquareProject'][_0x650a('0x5b')]({'where':{'id':_0x338841['params']['id']}})[_0x650a('0x24')](handleEntityNotFound(_0x5a08d9,null))[_0x650a('0x24')](function(_0x42689c){if(_0x42689c){_0xba1b88=_0x42689c;_0x34cfb0[_0x650a('0x30')]=_[_0x650a('0x45')](db[_0x650a('0x5c')]['rawAttributes']);_0x34cfb0[_0x650a('0x32')]=_['keys'](_0x338841[_0x650a('0x32')]);_0x34cfb0[_0x650a('0x33')]=_[_0x650a('0x35')](_0x34cfb0[_0x650a('0x30')],_0x34cfb0[_0x650a('0x32')]);_0x1eb780['attributes']=_[_0x650a('0x35')](_0x34cfb0[_0x650a('0x30')],qs[_0x650a('0x46')](_0x338841[_0x650a('0x32')][_0x650a('0x46')]));_0x1eb780[_0x650a('0x34')]=_0x1eb780[_0x650a('0x34')][_0x650a('0x58')]?_0x1eb780[_0x650a('0x34')]:_0x34cfb0[_0x650a('0x30')];_0x1eb780['order']=qs['sort'](_0x338841['query'][_0x650a('0x39')]);_0x1eb780[_0x650a('0x3a')]=qs['filters'](_[_0x650a('0x5d')](_0x338841[_0x650a('0x32')],_0x34cfb0[_0x650a('0x33')]));if(_0x338841['query'][_0x650a('0x3b')]){_0x1eb780['where']=_[_0x650a('0x3c')](_0x1eb780[_0x650a('0x3a')],{'$or':_[_0x650a('0x31')](_0x1eb780[_0x650a('0x34')],function(_0x434456){var _0x5245f5={};_0x5245f5[_0x434456]={'$like':'%'+_0x338841['query'][_0x650a('0x3b')]+'%'};return _0x5245f5;})});}_0x1eb780=_[_0x650a('0x3c')]({},_0x1eb780,_0x338841[_0x650a('0x3e')]);return _0xba1b88['getUsers'](_0x1eb780);}})[_0x650a('0x24')](function(_0x5dc433){if(_0x5dc433){_0x4bbccd=_0x5dc433['length'];if(!_0x338841[_0x650a('0x32')][_0x650a('0x36')](_0x650a('0x37'))){_0x1eb780[_0x650a('0x1c')]=qs[_0x650a('0x1c')](_0x338841['query'][_0x650a('0x1c')]);_0x1eb780[_0x650a('0x1a')]=qs[_0x650a('0x1a')](_0x338841['query']['offset']);}return _0xba1b88[_0x650a('0x5a')](_0x1eb780);}})['then'](function(_0x50f277){if(_0x50f277){return _0x50f277?{'count':_0x4bbccd,'rows':_0x50f277}:null;}})['then'](respondWithResult(_0x5a08d9,null))[_0x650a('0x42')](handleError(_0x5a08d9,null));}; \ No newline at end of file +var _0xfefb=['mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','save','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','limit','order','sort','where','pick','merge','options','includeAll','include','show','params','SquareProject','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','getUsers','findOne','User','filter','nolimit','rimraf','zip-dir','moment'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xfefb,0x1c9));var _0xbfef=function(_0x10a6e4,_0x3f4b21){_0x10a6e4=_0x10a6e4-0x0;var _0x4c3589=_0xfefb[_0x10a6e4];return _0x4c3589;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbfef('0x0'));var zipdir=require(_0xbfef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfef('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbfef('0x3'));var util=require('util');var path=require(_0xbfef('0x4'));var sox=require('sox');var csv=require(_0xbfef('0x5'));var ejs=require(_0xbfef('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbfef('0x7'));var squel=require(_0xbfef('0x8'));var crypto=require(_0xbfef('0x9'));var jsforce=require(_0xbfef('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbfef('0x5'));var querystring=require('querystring');var Papa=require(_0xbfef('0xb'));var Redis=require(_0xbfef('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfef('0xd'));var logger=require(_0xbfef('0xe'))(_0xbfef('0xf'));var utils=require(_0xbfef('0x10'));var config=require(_0xbfef('0x11'));var licenseUtil=require(_0xbfef('0x12'));var db=require(_0xbfef('0x13'))['db'];config[_0xbfef('0x14')]=_[_0xbfef('0x15')](config[_0xbfef('0x14')],{'host':_0xbfef('0x16'),'port':0x18eb});var socket=require(_0xbfef('0x17'))(new Redis(config['redis']));require(_0xbfef('0x18'))['register'](socket);function respondWithStatusCode(_0x4c3f1c,_0x304f43){_0x304f43=_0x304f43||0xcc;return function(_0x350130){if(_0x350130){return _0x4c3f1c[_0xbfef('0x19')](_0x304f43);}return _0x4c3f1c['status'](_0x304f43)[_0xbfef('0x1a')]();};}function respondWithResult(_0x5be851,_0x1bad07){_0x1bad07=_0x1bad07||0xc8;return function(_0x53b4d4){if(_0x53b4d4){return _0x5be851[_0xbfef('0x1b')](_0x1bad07)[_0xbfef('0x1c')](_0x53b4d4);}};}function respondWithFilteredResult(_0x2a5c64,_0x37c761){return function(_0x12ad32){if(_0x12ad32){var _0x2b115f=typeof _0x37c761[_0xbfef('0x1d')]===_0xbfef('0x1e')&&typeof _0x37c761['limit']===_0xbfef('0x1e');var _0x5a11b9=_0x12ad32[_0xbfef('0x1f')];var _0x21f718=_0x2b115f?0x0:_0x37c761['offset'];var _0x54dbbd=_0x2b115f?_0x12ad32[_0xbfef('0x1f')]:_0x37c761['offset']+_0x37c761['limit'];var _0x2dbf7b;if(_0x54dbbd>=_0x5a11b9){_0x54dbbd=_0x5a11b9;_0x2dbf7b=0xc8;}else{_0x2dbf7b=0xce;}_0x2a5c64[_0xbfef('0x1b')](_0x2dbf7b);return _0x2a5c64['set'](_0xbfef('0x20'),_0x21f718+'-'+_0x54dbbd+'/'+_0x5a11b9)[_0xbfef('0x1c')](_0x12ad32);}return null;};}function patchUpdates(_0x4d5953){return function(_0x5662dc){try{jsonpatch['apply'](_0x5662dc,_0x4d5953,!![]);}catch(_0x9362bb){return BPromise[_0xbfef('0x21')](_0x9362bb);}return _0x5662dc[_0xbfef('0x22')]();};}function saveUpdates(_0x4335f6,_0x33e430){return function(_0x24182b){if(_0x24182b){return _0x24182b['update'](_0x4335f6)[_0xbfef('0x23')](function(_0x1f94b0){return _0x1f94b0;});}return null;};}function removeEntity(_0x1bc103,_0x54193e){return function(_0x3ddd9a){if(_0x3ddd9a){return _0x3ddd9a[_0xbfef('0x24')]()['then'](function(){var _0x2f6961=_0x3ddd9a[_0xbfef('0x25')]({'plain':!![]});var _0x4ede6b=_0xbfef('0x26');return db[_0xbfef('0x27')][_0xbfef('0x24')]({'where':{'type':_0x4ede6b,'resourceId':_0x2f6961['id']}})[_0xbfef('0x23')](function(){return _0x3ddd9a;});})['then'](function(){_0x1bc103[_0xbfef('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a94c,_0x302152){return function(_0x54bc3e){if(!_0x54bc3e){_0x28a94c['sendStatus'](0x194);}return _0x54bc3e;};}function handleError(_0x4b1481,_0xecab71){_0xecab71=_0xecab71||0x1f4;return function(_0x19671c){logger[_0xbfef('0x28')](_0x19671c[_0xbfef('0x29')]);if(_0x19671c['name']){delete _0x19671c[_0xbfef('0x2a')];}_0x4b1481[_0xbfef('0x1b')](_0xecab71)[_0xbfef('0x2b')](_0x19671c);};}exports[_0xbfef('0x2c')]=function(_0x58a711,_0x417383){var _0x13f159={},_0x24d6dc={},_0x5c0882={'count':0x0,'rows':[]};var _0x2e109e=_[_0xbfef('0x2d')](db['SquareProject'][_0xbfef('0x2e')],function(_0x2aff18){return{'name':_0x2aff18['fieldName'],'type':_0x2aff18[_0xbfef('0x2f')][_0xbfef('0x30')]};});_0x24d6dc[_0xbfef('0x31')]=_['map'](_0x2e109e,_0xbfef('0x2a'));_0x24d6dc[_0xbfef('0x32')]=_[_0xbfef('0x33')](_0x58a711[_0xbfef('0x32')]);_0x24d6dc[_0xbfef('0x34')]=_[_0xbfef('0x35')](_0x24d6dc[_0xbfef('0x31')],_0x24d6dc[_0xbfef('0x32')]);_0x13f159['attributes']=_[_0xbfef('0x35')](_0x24d6dc[_0xbfef('0x31')],qs[_0xbfef('0x36')](_0x58a711['query'][_0xbfef('0x36')]));_0x13f159['attributes']=_0x13f159['attributes'][_0xbfef('0x37')]?_0x13f159[_0xbfef('0x38')]:_0x24d6dc[_0xbfef('0x31')];if(!_0x58a711[_0xbfef('0x32')][_0xbfef('0x39')]('nolimit')){_0x13f159['limit']=qs[_0xbfef('0x3a')](_0x58a711['query'][_0xbfef('0x3a')]);_0x13f159[_0xbfef('0x1d')]=qs['offset'](_0x58a711[_0xbfef('0x32')]['offset']);}_0x13f159[_0xbfef('0x3b')]=qs[_0xbfef('0x3c')](_0x58a711[_0xbfef('0x32')]['sort']);_0x13f159[_0xbfef('0x3d')]=qs[_0xbfef('0x34')](_[_0xbfef('0x3e')](_0x58a711[_0xbfef('0x32')],_0x24d6dc[_0xbfef('0x34')]),_0x2e109e);if(_0x58a711[_0xbfef('0x32')]['filter']){_0x13f159[_0xbfef('0x3d')]=_[_0xbfef('0x3f')](_0x13f159[_0xbfef('0x3d')],{'$or':_[_0xbfef('0x2d')](_0x2e109e,function(_0x2f789c){if(_0x2f789c[_0xbfef('0x2f')]!=='VIRTUAL'){var _0x3f039b={};_0x3f039b[_0x2f789c[_0xbfef('0x2a')]]={'$like':'%'+_0x58a711[_0xbfef('0x32')]['filter']+'%'};return _0x3f039b;}})});}_0x13f159=_[_0xbfef('0x3f')]({},_0x13f159,_0x58a711[_0xbfef('0x40')]);var _0x36ed43={'where':_0x13f159['where']};return db['SquareProject'][_0xbfef('0x1f')](_0x36ed43)['then'](function(_0x42b9a9){_0x5c0882[_0xbfef('0x1f')]=_0x42b9a9;if(_0x58a711['query'][_0xbfef('0x41')]){_0x13f159[_0xbfef('0x42')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x13f159);})[_0xbfef('0x23')](function(_0x337f58){_0x5c0882['rows']=_0x337f58;return _0x5c0882;})[_0xbfef('0x23')](respondWithFilteredResult(_0x417383,_0x13f159))['catch'](handleError(_0x417383,null));};exports[_0xbfef('0x43')]=function(_0x1d2e3f,_0x438f31){var _0xd79336={'raw':![],'where':{'id':_0x1d2e3f[_0xbfef('0x44')]['id']}},_0x2afc6b={};_0x2afc6b['model']=_[_0xbfef('0x33')](db[_0xbfef('0x45')][_0xbfef('0x2e')]);_0x2afc6b['query']=_[_0xbfef('0x33')](_0x1d2e3f[_0xbfef('0x32')]);_0x2afc6b[_0xbfef('0x34')]=_[_0xbfef('0x35')](_0x2afc6b[_0xbfef('0x31')],_0x2afc6b[_0xbfef('0x32')]);_0xd79336[_0xbfef('0x38')]=_[_0xbfef('0x35')](_0x2afc6b[_0xbfef('0x31')],qs[_0xbfef('0x36')](_0x1d2e3f['query']['fields']));_0xd79336[_0xbfef('0x38')]=_0xd79336[_0xbfef('0x38')]['length']?_0xd79336[_0xbfef('0x38')]:_0x2afc6b[_0xbfef('0x31')];if(_0x1d2e3f[_0xbfef('0x32')][_0xbfef('0x41')]){_0xd79336[_0xbfef('0x42')]=[{'all':!![]}];}_0xd79336=_[_0xbfef('0x3f')]({},_0xd79336,_0x1d2e3f[_0xbfef('0x40')]);return db['SquareProject'][_0xbfef('0x46')](_0xd79336)[_0xbfef('0x23')](handleEntityNotFound(_0x438f31,null))[_0xbfef('0x23')](respondWithResult(_0x438f31,null))['catch'](handleError(_0x438f31,null));};exports['create']=function(_0xfca766,_0x14c401){return db[_0xbfef('0x45')][_0xbfef('0x47')](_0xfca766[_0xbfef('0x48')],{})[_0xbfef('0x23')](function(_0x352a32){var _0x28b478=_0xfca766[_0xbfef('0x49')][_0xbfef('0x25')]({'plain':!![]});if(!_0x28b478)throw new Error(_0xbfef('0x4a'));if(_0x28b478[_0xbfef('0x4b')]===_0xbfef('0x49')){var _0xd9b55b=_0x352a32[_0xbfef('0x25')]({'plain':!![]});var _0x2647b6=_0xbfef('0x26');return db[_0xbfef('0x4c')][_0xbfef('0x46')]({'where':{'name':_0x2647b6,'userProfileId':_0x28b478[_0xbfef('0x4d')]},'raw':!![]})[_0xbfef('0x23')](function(_0x13ef7a){if(_0x13ef7a&&_0x13ef7a['autoAssociation']===0x0){return db['UserProfileResource'][_0xbfef('0x47')]({'name':_0xd9b55b[_0xbfef('0x2a')],'resourceId':_0xd9b55b['id'],'type':_0x13ef7a[_0xbfef('0x2a')],'sectionId':_0x13ef7a['id']},{})['then'](function(){return _0x352a32;});}else{return _0x352a32;}})[_0xbfef('0x4e')](function(_0x3764ac){logger[_0xbfef('0x28')](_0xbfef('0x4f'),_0x3764ac);throw _0x3764ac;});}return _0x352a32;})['then'](respondWithResult(_0x14c401,0xc9))['catch'](handleError(_0x14c401,null));};exports[_0xbfef('0x50')]=function(_0x5373d1,_0x3ae1b4){if(_0x5373d1['body']['id']){delete _0x5373d1[_0xbfef('0x48')]['id'];}return db['SquareProject'][_0xbfef('0x46')]({'where':{'id':_0x5373d1['params']['id']}})['then'](handleEntityNotFound(_0x3ae1b4,null))[_0xbfef('0x23')](saveUpdates(_0x5373d1[_0xbfef('0x48')],null))[_0xbfef('0x23')](respondWithResult(_0x3ae1b4,null))[_0xbfef('0x4e')](handleError(_0x3ae1b4,null));};exports['destroy']=function(_0x61ce17,_0x4847bd){return db[_0xbfef('0x45')][_0xbfef('0x46')]({'where':{'id':_0x61ce17[_0xbfef('0x44')]['id']}})[_0xbfef('0x23')](handleEntityNotFound(_0x4847bd,null))[_0xbfef('0x23')](removeEntity(_0x4847bd,null))['catch'](handleError(_0x4847bd,null));};exports[_0xbfef('0x51')]=function(_0x41b5b4,_0x1048b8,_0x6bc74e){return db['SquareProject'][_0xbfef('0x46')]({'where':{'id':_0x41b5b4['params']['id']}})[_0xbfef('0x23')](handleEntityNotFound(_0x1048b8,null))['then'](function(_0x20b5b1){if(_0x20b5b1){return _0x20b5b1[_0xbfef('0x51')](_0x41b5b4[_0xbfef('0x48')][_0xbfef('0x52')],_[_0xbfef('0x53')](_0x41b5b4['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1048b8,null))['catch'](handleError(_0x1048b8,null));};exports[_0xbfef('0x54')]=function(_0x3e1a56,_0x8d121a,_0x27efe5){return db['SquareProject']['find']({'where':{'id':_0x3e1a56[_0xbfef('0x44')]['id']}})[_0xbfef('0x23')](handleEntityNotFound(_0x8d121a,null))[_0xbfef('0x23')](function(_0x44ffbd){if(_0x44ffbd){return _0x44ffbd[_0xbfef('0x54')](_0x3e1a56[_0xbfef('0x32')][_0xbfef('0x52')])[_0xbfef('0x23')](function(){if(_[_0xbfef('0x55')](_0x3e1a56[_0xbfef('0x32')]['ids'])){for(var _0x28dcef=0x0;_0x28dcef<_0x3e1a56[_0xbfef('0x32')][_0xbfef('0x52')][_0xbfef('0x37')];_0x28dcef+=0x1){socket['emit'](_0xbfef('0x56'),{'UserId':Number(_0x3e1a56['query'][_0xbfef('0x52')][_0x28dcef]),'SquareProjectId':Number(_0x3e1a56[_0xbfef('0x44')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x3e1a56[_0xbfef('0x32')][_0xbfef('0x52')]),'SquareProjectId':Number(_0x3e1a56[_0xbfef('0x44')]['id'])});}});}})[_0xbfef('0x23')](respondWithStatusCode(_0x8d121a,null))[_0xbfef('0x4e')](handleError(_0x8d121a,null));};exports[_0xbfef('0x57')]=function(_0x425a7a,_0x57bb6a,_0x151074){var _0x7f7694={};var _0x5566f3={};var _0x222b2f;var _0x2930bc;return db[_0xbfef('0x45')][_0xbfef('0x58')]({'where':{'id':_0x425a7a[_0xbfef('0x44')]['id']}})[_0xbfef('0x23')](handleEntityNotFound(_0x57bb6a,null))[_0xbfef('0x23')](function(_0x23fdc2){if(_0x23fdc2){_0x222b2f=_0x23fdc2;_0x5566f3[_0xbfef('0x31')]=_['keys'](db[_0xbfef('0x59')][_0xbfef('0x2e')]);_0x5566f3['query']=_[_0xbfef('0x33')](_0x425a7a['query']);_0x5566f3[_0xbfef('0x34')]=_['intersection'](_0x5566f3[_0xbfef('0x31')],_0x5566f3[_0xbfef('0x32')]);_0x7f7694[_0xbfef('0x38')]=_[_0xbfef('0x35')](_0x5566f3[_0xbfef('0x31')],qs[_0xbfef('0x36')](_0x425a7a[_0xbfef('0x32')][_0xbfef('0x36')]));_0x7f7694[_0xbfef('0x38')]=_0x7f7694[_0xbfef('0x38')][_0xbfef('0x37')]?_0x7f7694['attributes']:_0x5566f3[_0xbfef('0x31')];_0x7f7694[_0xbfef('0x3b')]=qs[_0xbfef('0x3c')](_0x425a7a[_0xbfef('0x32')][_0xbfef('0x3c')]);_0x7f7694[_0xbfef('0x3d')]=qs['filters'](_[_0xbfef('0x3e')](_0x425a7a['query'],_0x5566f3[_0xbfef('0x34')]));if(_0x425a7a['query'][_0xbfef('0x5a')]){_0x7f7694[_0xbfef('0x3d')]=_[_0xbfef('0x3f')](_0x7f7694[_0xbfef('0x3d')],{'$or':_[_0xbfef('0x2d')](_0x7f7694[_0xbfef('0x38')],function(_0x54fa06){var _0xcc51e4={};_0xcc51e4[_0x54fa06]={'$like':'%'+_0x425a7a['query'][_0xbfef('0x5a')]+'%'};return _0xcc51e4;})});}_0x7f7694=_[_0xbfef('0x3f')]({},_0x7f7694,_0x425a7a[_0xbfef('0x40')]);return _0x222b2f['getUsers'](_0x7f7694);}})[_0xbfef('0x23')](function(_0x314965){if(_0x314965){_0x2930bc=_0x314965[_0xbfef('0x37')];if(!_0x425a7a[_0xbfef('0x32')][_0xbfef('0x39')](_0xbfef('0x5b'))){_0x7f7694[_0xbfef('0x3a')]=qs[_0xbfef('0x3a')](_0x425a7a[_0xbfef('0x32')]['limit']);_0x7f7694[_0xbfef('0x1d')]=qs['offset'](_0x425a7a[_0xbfef('0x32')]['offset']);}return _0x222b2f[_0xbfef('0x57')](_0x7f7694);}})[_0xbfef('0x23')](function(_0x54a182){if(_0x54a182){return _0x54a182?{'count':_0x2930bc,'rows':_0x54a182}:null;}})['then'](respondWithResult(_0x57bb6a,null))[_0xbfef('0x4e')](handleError(_0x57bb6a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 743877f..76b9224 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 _0x9d92=['setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x9d92,0xdf));var _0x29d9=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x9d92[_0x57014b];return _0x2b258a;};'use strict';var EventEmitter=require(_0x29d9('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x29d9('0x1')](0x0);var events={'afterCreate':_0x29d9('0x2'),'afterUpdate':'update','afterDestroy':_0x29d9('0x3')};function emitEvent(_0x1664bf){return function(_0x18371b,_0x6e12eb,_0x19f284){SquareProjectEvents[_0x29d9('0x4')](_0x1664bf+':'+_0x18371b['id'],_0x18371b);SquareProjectEvents[_0x29d9('0x4')](_0x1664bf,_0x18371b);_0x19f284(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x29d9('0x5')](e,emitEvent(event));}}module[_0x29d9('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x075e=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x2a43aa,_0x39d2a1){var _0x307f98=function(_0x2cad0c){while(--_0x2cad0c){_0x2a43aa['push'](_0x2a43aa['shift']());}};_0x307f98(++_0x39d2a1);}(_0x075e,0x92));var _0xe075=function(_0x5f5d09,_0x598717){_0x5f5d09=_0x5f5d09-0x0;var _0x1bb5d1=_0x075e[_0x5f5d09];return _0x1bb5d1;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xe075('0x0'))['db'][_0xe075('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe075('0x2')](0x0);var events={'afterCreate':_0xe075('0x3'),'afterUpdate':_0xe075('0x4'),'afterDestroy':_0xe075('0x5')};function emitEvent(_0x15bef2){return function(_0x422c3a,_0x5eddf4,_0xc28e9d){SquareProjectEvents[_0xe075('0x6')](_0x15bef2+':'+_0x422c3a['id'],_0x422c3a);SquareProjectEvents['emit'](_0x15bef2,_0x422c3a);_0xc28e9d(null);};}for(var e in events){if(events[_0xe075('0x7')](e)){var event=events[e];SquareProject[_0xe075('0x8')](e,emitEvent(event));}}module[_0xe075('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 440bf62..1093bf2 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 _0x37a4=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x37a4,0xcb));var _0x437a=function(_0x164101,_0x2b31af){_0x164101=_0x164101-0x0;var _0x35a9b4=_0x37a4[_0x164101];return _0x35a9b4;};'use strict';var _=require(_0x437a('0x0'));var util=require('util');var logger=require(_0x437a('0x1'))('api');var moment=require(_0x437a('0x2'));var BPromise=require(_0x437a('0x3'));var rp=require(_0x437a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x437a('0x5'));var attributes=require(_0x437a('0x6'));module[_0x437a('0x7')]=function(_0x1b637a,_0x5f5067){return _0x1b637a[_0x437a('0x8')](_0x437a('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36270b,_0x15ac16,_0x2fe1a5){if(_0x36270b[_0x437a('0xa')](_0x437a('0xb'))){_0x36270b[_0x437a('0xc')]=moment()[_0x437a('0xd')](_0x437a('0xe'));}if(_0x36270b[_0x437a('0xa')](_0x437a('0xf'))){_0x36270b[_0x437a('0x10')]=moment()['format'](_0x437a('0xe'));}_0x2fe1a5(null,_0x36270b);}}});}; \ No newline at end of file +var _0x4abf=['preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','api','path','rimraf','exports','define','square_projects'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0x4abf,0xac));var _0xf4ab=function(_0x1f6dd6,_0x325b9a){_0x1f6dd6=_0x1f6dd6-0x0;var _0x349a1b=_0x4abf[_0x1f6dd6];return _0x349a1b;};'use strict';var _=require(_0xf4ab('0x0'));var util=require(_0xf4ab('0x1'));var logger=require('../../config/logger')(_0xf4ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4ab('0x3'));var rimraf=require(_0xf4ab('0x4'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xf4ab('0x5')]=function(_0x4160fb,_0x2e6efe){return _0x4160fb[_0xf4ab('0x6')]('SquareProject',attributes,{'tableName':_0xf4ab('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c7b8b,_0x585b8b,_0x45b134){if(_0x3c7b8b['changed'](_0xf4ab('0x8'))){_0x3c7b8b[_0xf4ab('0x9')]=moment()[_0xf4ab('0xa')](_0xf4ab('0xb'));}if(_0x3c7b8b[_0xf4ab('0xc')](_0xf4ab('0xd'))){_0x3c7b8b[_0xf4ab('0xe')]=moment()[_0xf4ab('0xa')](_0xf4ab('0xb'));}_0x45b134(null,_0x3c7b8b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 45749f5..e53ab2b 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 _0x4055=['ShowSquareProject','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./squareProject.socket','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','SquareProject,\x20%s,\x20%s','message','result','catch','SquareProject','find','options','raw','where','attributes','include','model','map'];(function(_0x187c30,_0x2bc154){var _0x3b0cf3=function(_0x77cd03){while(--_0x77cd03){_0x187c30['push'](_0x187c30['shift']());}};_0x3b0cf3(++_0x2bc154);}(_0x4055,0x8e));var _0x5405=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x4055[_0x5cc3d4];return _0x17ca31;};'use strict';var _=require(_0x5405('0x0'));var util=require('util');var moment=require(_0x5405('0x1'));var BPromise=require(_0x5405('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5405('0x3'));var db=require(_0x5405('0x4'))['db'];var utils=require(_0x5405('0x5'));var logger=require(_0x5405('0x6'))(_0x5405('0x7'));var config=require(_0x5405('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5405('0x9')][_0x5405('0xa')]({'port':0x232a});config[_0x5405('0xb')]=_[_0x5405('0xc')](config[_0x5405('0xb')],{'host':_0x5405('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5405('0xe'))['register'](socket);function respondWithRpcPromise(_0xa06108,_0x178183,_0x9f8111){return new BPromise(function(_0x5ecda1,_0x3c84b8){return client['request'](_0xa06108,_0x9f8111)[_0x5405('0xf')](function(_0x5a7d1d){logger[_0x5405('0x10')]('SquareProject,\x20%s,\x20%s',_0x178183,'request\x20sent');logger[_0x5405('0x11')](_0x5405('0x12'),_0x178183,'request\x20sent',JSON['stringify'](_0x5a7d1d));if(_0x5a7d1d[_0x5405('0x13')]){if(_0x5a7d1d[_0x5405('0x13')]['code']===0x1f4){logger[_0x5405('0x13')](_0x5405('0x14'),_0x178183,_0x5a7d1d[_0x5405('0x13')][_0x5405('0x15')]);return _0x3c84b8(_0x5a7d1d['error'][_0x5405('0x15')]);}logger[_0x5405('0x13')](_0x5405('0x14'),_0x178183,_0x5a7d1d['error']['message']);return _0x5ecda1(_0x5a7d1d[_0x5405('0x13')][_0x5405('0x15')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x178183,'request\x20sent');_0x5ecda1(_0x5a7d1d[_0x5405('0x16')]['message']);}})[_0x5405('0x17')](function(_0x58adba){logger[_0x5405('0x13')](_0x5405('0x14'),_0x178183,_0x58adba);_0x3c84b8(_0x58adba);});});}exports['ShowSquareProject']=function(_0x3ceba4){var _0x14b08a=this;return new Promise(function(_0x23e922,_0x455cd8){return db[_0x5405('0x18')][_0x5405('0x19')]({'raw':_0x3ceba4[_0x5405('0x1a')]?_0x3ceba4[_0x5405('0x1a')][_0x5405('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ceba4[_0x5405('0x1a')]?_0x3ceba4[_0x5405('0x1a')][_0x5405('0x1c')]||null:null,'attributes':_0x3ceba4[_0x5405('0x1a')]?_0x3ceba4[_0x5405('0x1a')][_0x5405('0x1d')]||null:null,'include':_0x3ceba4['options']?_0x3ceba4[_0x5405('0x1a')][_0x5405('0x1e')]?_['map'](_0x3ceba4[_0x5405('0x1a')]['include'],function(_0x1d00fc){return{'model':db[_0x1d00fc[_0x5405('0x1f')]],'as':_0x1d00fc['as'],'attributes':_0x1d00fc[_0x5405('0x1d')],'include':_0x1d00fc['include']?_[_0x5405('0x20')](_0x1d00fc['include'],function(_0x3a3c09){return{'model':db[_0x3a3c09[_0x5405('0x1f')]],'as':_0x3a3c09['as'],'attributes':_0x3a3c09[_0x5405('0x1d')],'include':_0x3a3c09['include']?_[_0x5405('0x20')](_0x3a3c09[_0x5405('0x1e')],function(_0x5b2e0d){return{'model':db[_0x5b2e0d[_0x5405('0x1f')]],'as':_0x5b2e0d['as'],'attributes':_0x5b2e0d[_0x5405('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5405('0xf')](function(_0x4f6550){logger[_0x5405('0x10')](_0x5405('0x21'),_0x3ceba4);logger[_0x5405('0x11')](_0x5405('0x21'),_0x3ceba4,JSON[_0x5405('0x22')](_0x4f6550));_0x23e922(_0x4f6550);})[_0x5405('0x17')](function(_0x212d9a){logger[_0x5405('0x13')](_0x5405('0x21'),_0x212d9a[_0x5405('0x15')],_0x3ceba4);_0x455cd8(_0x14b08a['error'](0x1f4,_0x212d9a['message']));});});}; \ No newline at end of file +var _0x9458=['moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SquareProject,\x20%s,\x20%s','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','include','model','map','attributes','lodash'];(function(_0x2f50db,_0x29205b){var _0x345e51=function(_0x511551){while(--_0x511551){_0x2f50db['push'](_0x2f50db['shift']());}};_0x345e51(++_0x29205b);}(_0x9458,0x15d));var _0x8945=function(_0x1ba81f,_0x3e65d0){_0x1ba81f=_0x1ba81f-0x0;var _0x2aa9aa=_0x9458[_0x1ba81f];return _0x2aa9aa;};'use strict';var _=require(_0x8945('0x0'));var util=require('util');var moment=require(_0x8945('0x1'));var BPromise=require(_0x8945('0x2'));var rs=require(_0x8945('0x3'));var fs=require('fs');var Redis=require(_0x8945('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8945('0x5'));var jayson=require(_0x8945('0x6'));var client=jayson[_0x8945('0x7')][_0x8945('0x8')]({'port':0x232a});config['redis']=_[_0x8945('0x9')](config[_0x8945('0xa')],{'host':_0x8945('0xb'),'port':0x18eb});var socket=require(_0x8945('0xc'))(new Redis(config[_0x8945('0xa')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x4e2963,_0xd9e101,_0x1173e7){return new BPromise(function(_0xe18176,_0x4a8aa0){return client[_0x8945('0xd')](_0x4e2963,_0x1173e7)[_0x8945('0xe')](function(_0x4ec002){logger[_0x8945('0xf')]('SquareProject,\x20%s,\x20%s',_0xd9e101,'request\x20sent');logger[_0x8945('0x10')](_0x8945('0x11'),_0xd9e101,_0x8945('0x12'),JSON[_0x8945('0x13')](_0x4ec002));if(_0x4ec002[_0x8945('0x14')]){if(_0x4ec002['error']['code']===0x1f4){logger[_0x8945('0x14')]('SquareProject,\x20%s,\x20%s',_0xd9e101,_0x4ec002[_0x8945('0x14')][_0x8945('0x15')]);return _0x4a8aa0(_0x4ec002[_0x8945('0x14')][_0x8945('0x15')]);}logger[_0x8945('0x14')](_0x8945('0x16'),_0xd9e101,_0x4ec002[_0x8945('0x14')][_0x8945('0x15')]);return _0xe18176(_0x4ec002[_0x8945('0x14')][_0x8945('0x15')]);}else{logger['info'](_0x8945('0x16'),_0xd9e101,_0x8945('0x12'));_0xe18176(_0x4ec002[_0x8945('0x17')]['message']);}})[_0x8945('0x18')](function(_0x2e4bb0){logger[_0x8945('0x14')](_0x8945('0x16'),_0xd9e101,_0x2e4bb0);_0x4a8aa0(_0x2e4bb0);});});}exports[_0x8945('0x19')]=function(_0x1b55ad){var _0x578fc2=this;return new Promise(function(_0x5f986e,_0x4b79d9){return db[_0x8945('0x1a')][_0x8945('0x1b')]({'raw':_0x1b55ad[_0x8945('0x1c')]?_0x1b55ad[_0x8945('0x1c')][_0x8945('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b55ad['options']?_0x1b55ad[_0x8945('0x1c')][_0x8945('0x1e')]||null:null,'attributes':_0x1b55ad['options']?_0x1b55ad[_0x8945('0x1c')]['attributes']||null:null,'include':_0x1b55ad[_0x8945('0x1c')]?_0x1b55ad['options'][_0x8945('0x1f')]?_['map'](_0x1b55ad['options'][_0x8945('0x1f')],function(_0x50d4d3){return{'model':db[_0x50d4d3[_0x8945('0x20')]],'as':_0x50d4d3['as'],'attributes':_0x50d4d3['attributes'],'include':_0x50d4d3[_0x8945('0x1f')]?_[_0x8945('0x21')](_0x50d4d3['include'],function(_0x23cd7d){return{'model':db[_0x23cd7d[_0x8945('0x20')]],'as':_0x23cd7d['as'],'attributes':_0x23cd7d['attributes'],'include':_0x23cd7d['include']?_[_0x8945('0x21')](_0x23cd7d[_0x8945('0x1f')],function(_0x3a7b6a){return{'model':db[_0x3a7b6a[_0x8945('0x20')]],'as':_0x3a7b6a['as'],'attributes':_0x3a7b6a[_0x8945('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ce9ab){logger[_0x8945('0xf')](_0x8945('0x19'),_0x1b55ad);logger[_0x8945('0x10')](_0x8945('0x19'),_0x1b55ad,JSON[_0x8945('0x13')](_0x2ce9ab));_0x5f986e(_0x2ce9ab);})[_0x8945('0x18')](function(_0x1313ed){logger[_0x8945('0x14')](_0x8945('0x19'),_0x1313ed[_0x8945('0x15')],_0x1b55ad);_0x4b79d9(_0x578fc2['error'](0x1f4,_0x1313ed[_0x8945('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 47126fd..ba168ca 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 _0x2a07=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x40ad2a,_0x4518cc){var _0x40423a=function(_0x730081){while(--_0x730081){_0x40ad2a['push'](_0x40ad2a['shift']());}};_0x40423a(++_0x4518cc);}(_0x2a07,0x74));var _0x72a0=function(_0x4944f1,_0x482a52){_0x4944f1=_0x4944f1-0x0;var _0x433494=_0x2a07[_0x4944f1];return _0x433494;};'use strict';var SquareProjectEvents=require(_0x72a0('0x0'));var events=[_0x72a0('0x1'),_0x72a0('0x2'),_0x72a0('0x3')];function createListener(_0x1cad29,_0x548164){return function(_0x335b7c){_0x548164[_0x72a0('0x4')](_0x1cad29,_0x335b7c);};}function removeListener(_0x135982,_0x45b155){return function(){SquareProjectEvents[_0x72a0('0x5')](_0x135982,_0x45b155);};}exports[_0x72a0('0x6')]=function(_0x3ccf6d){for(var _0x20dab9=0x0,_0x193e3b=events[_0x72a0('0x7')];_0x20dab9<_0x193e3b;_0x20dab9++){var _0x21c819=events[_0x20dab9];var _0x2c04eb=createListener(_0x72a0('0x8')+_0x21c819,_0x3ccf6d);SquareProjectEvents['on'](_0x21c819,_0x2c04eb);}}; \ No newline at end of file +var _0x1623=['removeListener','length','squareProject:','./squareProject.events','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x369dca,_0x528e32){_0x369dca=_0x369dca-0x0;var _0x3abaea=_0x1623[_0x369dca];return _0x3abaea;};'use strict';var SquareProjectEvents=require(_0x3162('0x0'));var events=['save','remove',_0x3162('0x1')];function createListener(_0x27ee21,_0x36ccc3){return function(_0x2cc4d7){_0x36ccc3[_0x3162('0x2')](_0x27ee21,_0x2cc4d7);};}function removeListener(_0x4ce2bd,_0x5d49d0){return function(){SquareProjectEvents[_0x3162('0x3')](_0x4ce2bd,_0x5d49d0);};}exports['register']=function(_0x1b55f2){for(var _0x428de6=0x0,_0x53260d=events[_0x3162('0x4')];_0x428de6<_0x53260d;_0x428de6++){var _0x2dc07e=events[_0x428de6];var _0x26ee32=createListener(_0x3162('0x5')+_0x2dc07e,_0x1b55f2);SquareProjectEvents['on'](_0x2dc07e,_0x26ee32);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f3e6ee0..cdaedeb 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 _0xcefd=['index','get','/:id','show','/:id/download','post','create','put','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated'];(function(_0x22df4d,_0xa4790a){var _0x6a2020=function(_0x215c88){while(--_0x215c88){_0x22df4d['push'](_0x22df4d['shift']());}};_0x6a2020(++_0xa4790a);}(_0xcefd,0x126));var _0xdcef=function(_0xfd49ed,_0x1272e1){_0xfd49ed=_0xfd49ed-0x0;var _0x355f54=_0xcefd[_0xfd49ed];return _0x355f54;};'use strict';var multer=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var path=require(_0xdcef('0x2'));var timeout=require('connect-timeout');var express=require(_0xdcef('0x3'));var router=express[_0xdcef('0x4')]();var fs_extra=require(_0xdcef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdcef('0x6'));var config=require(_0xdcef('0x7'));var controller=require(_0xdcef('0x8'));router['get']('/',auth[_0xdcef('0x9')](),controller[_0xdcef('0xa')]);router[_0xdcef('0xb')](_0xdcef('0xc'),auth['isAuthenticated'](),controller[_0xdcef('0xd')]);router[_0xdcef('0xb')](_0xdcef('0xe'),auth[_0xdcef('0x9')](),controller['download']);router[_0xdcef('0xf')]('/',auth[_0xdcef('0x9')](),controller[_0xdcef('0x10')]);router[_0xdcef('0x11')](_0xdcef('0xc'),auth[_0xdcef('0x9')](),controller['update']);router['delete'](_0xdcef('0xc'),auth[_0xdcef('0x9')](),controller['destroy']);module[_0xdcef('0x12')]=router; \ No newline at end of file +var _0x8a21=['Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','exports','multer','connect-timeout','express'];(function(_0x21d9b4,_0x164e06){var _0x4c327b=function(_0xa355f2){while(--_0xa355f2){_0x21d9b4['push'](_0x21d9b4['shift']());}};_0x4c327b(++_0x164e06);}(_0x8a21,0x1d8));var _0x18a2=function(_0xf58718,_0x33541a){_0xf58718=_0xf58718-0x0;var _0x5aea10=_0x8a21[_0xf58718];return _0x5aea10;};'use strict';var multer=require(_0x18a2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x18a2('0x1'));var express=require(_0x18a2('0x2'));var router=express[_0x18a2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x18a2('0x4'));var config=require(_0x18a2('0x5'));var controller=require(_0x18a2('0x6'));router[_0x18a2('0x7')]('/',auth[_0x18a2('0x8')](),controller[_0x18a2('0x9')]);router[_0x18a2('0x7')](_0x18a2('0xa'),auth['isAuthenticated'](),controller[_0x18a2('0xb')]);router[_0x18a2('0x7')](_0x18a2('0xc'),auth['isAuthenticated'](),controller[_0x18a2('0xd')]);router[_0x18a2('0xe')]('/',auth[_0x18a2('0x8')](),controller[_0x18a2('0xf')]);router[_0x18a2('0x10')]('/:id',auth[_0x18a2('0x8')](),controller[_0x18a2('0x11')]);router['delete'](_0x18a2('0xa'),auth[_0x18a2('0x8')](),controller['destroy']);module[_0x18a2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a447a16..34cb8bd 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 _0x0ecc=['savePath','exports','STRING','VIRTUAL','getDataValue'];(function(_0x15c6db,_0x553328){var _0x500851=function(_0x548623){while(--_0x548623){_0x15c6db['push'](_0x15c6db['shift']());}};_0x500851(++_0x553328);}(_0x0ecc,0x146));var _0xc0ec=function(_0x4066b0,_0x525523){_0x4066b0=_0x4066b0-0x0;var _0x558d83=_0x0ecc[_0x4066b0];return _0x558d83;};'use strict';var Sequelize=require('sequelize');module[_0xc0ec('0x0')]={'uniqueid':{'type':Sequelize[_0xc0ec('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc0ec('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc0ec('0x1')]},'dnid':{'type':Sequelize[_0xc0ec('0x1')]},'projectName':{'type':Sequelize[_0xc0ec('0x1')]},'saveName':{'type':Sequelize[_0xc0ec('0x1')]},'filename':{'type':Sequelize[_0xc0ec('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xc0ec('0x2')],'get':function(){var _0x22142c='';var _0x14404=this[_0xc0ec('0x3')](_0xc0ec('0x4'));if(_0x14404){_0x22142c=_0x14404['substring'](_0x14404['lastIndexOf']('.'));}return _0x22142c;}}}; \ No newline at end of file +var _0xcfb5=['substring','lastIndexOf','sequelize','exports','STRING','getDataValue','savePath'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0xcfb5,0x6b));var _0x5cfb=function(_0x522957,_0x9dfe2b){_0x522957=_0x522957-0x0;var _0x3287ad=_0xcfb5[_0x522957];return _0x3287ad;};'use strict';var Sequelize=require(_0x5cfb('0x0'));module[_0x5cfb('0x1')]={'uniqueid':{'type':Sequelize[_0x5cfb('0x2')]},'callerid':{'type':Sequelize[_0x5cfb('0x2')]},'calleridname':{'type':Sequelize[_0x5cfb('0x2')]},'context':{'type':Sequelize[_0x5cfb('0x2')]},'extension':{'type':Sequelize[_0x5cfb('0x2')]},'priority':{'type':Sequelize[_0x5cfb('0x2')]},'accountcode':{'type':Sequelize[_0x5cfb('0x2')]},'dnid':{'type':Sequelize[_0x5cfb('0x2')]},'projectName':{'type':Sequelize[_0x5cfb('0x2')]},'saveName':{'type':Sequelize[_0x5cfb('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x551c3b='';var _0x5b81f0=this[_0x5cfb('0x3')](_0x5cfb('0x4'));if(_0x5b81f0){_0x551c3b=_0x5b81f0[_0x5cfb('0x5')](_0x5b81f0[_0x5cfb('0x6')]('.'));}return _0x551c3b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 2f3d2e5..9b8994d 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 _0x4f55=['model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','send','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','apply','reject','save','update','then','destroy','error','stack','name','index','SquareRecording','rawAttributes','fieldName','type'];(function(_0x37dc5a,_0x595680){var _0x10c64b=function(_0x82f055){while(--_0x82f055){_0x37dc5a['push'](_0x37dc5a['shift']());}};_0x10c64b(++_0x595680);}(_0x4f55,0x95));var _0x54f5=function(_0x53be43,_0x4b2430){_0x53be43=_0x53be43-0x0;var _0x1ac27b=_0x4f55[_0x53be43];return _0x1ac27b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54f5('0x0'));var zipdir=require(_0x54f5('0x1'));var jsonpatch=require(_0x54f5('0x2'));var rp=require(_0x54f5('0x3'));var moment=require('moment');var BPromise=require(_0x54f5('0x4'));var Mustache=require(_0x54f5('0x5'));var util=require(_0x54f5('0x6'));var path=require(_0x54f5('0x7'));var sox=require(_0x54f5('0x8'));var csv=require('to-csv');var ejs=require(_0x54f5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54f5('0xa'));var squel=require('squel');var crypto=require(_0x54f5('0xb'));var jsforce=require(_0x54f5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x54f5('0xd'));var querystring=require(_0x54f5('0xe'));var Papa=require(_0x54f5('0xf'));var Redis=require(_0x54f5('0x10'));var authService=require(_0x54f5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x54f5('0x12'));var hardwareService=require(_0x54f5('0x13'));var logger=require(_0x54f5('0x14'))(_0x54f5('0x15'));var utils=require(_0x54f5('0x16'));var config=require(_0x54f5('0x17'));var licenseUtil=require(_0x54f5('0x18'));var db=require(_0x54f5('0x19'))['db'];function respondWithStatusCode(_0x1746bd,_0x1b54ba){_0x1b54ba=_0x1b54ba||0xcc;return function(_0x27902f){if(_0x27902f){return _0x1746bd[_0x54f5('0x1a')](_0x1b54ba);}return _0x1746bd['status'](_0x1b54ba)[_0x54f5('0x1b')]();};}function respondWithResult(_0x274827,_0x502d13){_0x502d13=_0x502d13||0xc8;return function(_0x54e963){if(_0x54e963){return _0x274827[_0x54f5('0x1c')](_0x502d13)[_0x54f5('0x1d')](_0x54e963);}};}function respondWithFilteredResult(_0x15e215,_0x198c4f){return function(_0x203fd8){if(_0x203fd8){var _0x2140fd=typeof _0x198c4f[_0x54f5('0x1e')]==='undefined'&&typeof _0x198c4f['limit']===_0x54f5('0x1f');var _0x176f4d=_0x203fd8['count'];var _0x220c4e=_0x2140fd?0x0:_0x198c4f[_0x54f5('0x1e')];var _0x46abd7=_0x2140fd?_0x203fd8['count']:_0x198c4f['offset']+_0x198c4f[_0x54f5('0x20')];var _0x408792;if(_0x46abd7>=_0x176f4d){_0x46abd7=_0x176f4d;_0x408792=0xc8;}else{_0x408792=0xce;}_0x15e215[_0x54f5('0x1c')](_0x408792);return _0x15e215['set']('Content-Range',_0x220c4e+'-'+_0x46abd7+'/'+_0x176f4d)[_0x54f5('0x1d')](_0x203fd8);}return null;};}function patchUpdates(_0x2ad9e3){return function(_0x56506a){try{jsonpatch[_0x54f5('0x21')](_0x56506a,_0x2ad9e3,!![]);}catch(_0x40e147){return BPromise[_0x54f5('0x22')](_0x40e147);}return _0x56506a[_0x54f5('0x23')]();};}function saveUpdates(_0x46f18c,_0x334a1b){return function(_0x3e6412){if(_0x3e6412){return _0x3e6412[_0x54f5('0x24')](_0x46f18c)[_0x54f5('0x25')](function(_0x1800da){return _0x1800da;});}return null;};}function removeEntity(_0x579cff,_0x7a065f){return function(_0x3ab1e0){if(_0x3ab1e0){return _0x3ab1e0[_0x54f5('0x26')]()[_0x54f5('0x25')](function(){_0x579cff[_0x54f5('0x1c')](0xcc)[_0x54f5('0x1b')]();});}};}function handleEntityNotFound(_0x45347d,_0x428dbc){return function(_0x222136){if(!_0x222136){_0x45347d[_0x54f5('0x1a')](0x194);}return _0x222136;};}function handleError(_0x4ac681,_0x5a7b87){_0x5a7b87=_0x5a7b87||0x1f4;return function(_0x26f16d){logger[_0x54f5('0x27')](_0x26f16d[_0x54f5('0x28')]);if(_0x26f16d[_0x54f5('0x29')]){delete _0x26f16d[_0x54f5('0x29')];}_0x4ac681[_0x54f5('0x1c')](_0x5a7b87)['send'](_0x26f16d);};}exports[_0x54f5('0x2a')]=function(_0x1a1c40,_0x5d9c86){var _0xb101ca={},_0x487599={},_0x5f61d8={'count':0x0,'rows':[]};var _0x1b9602=_['map'](db[_0x54f5('0x2b')][_0x54f5('0x2c')],function(_0x2a7ac1){return{'name':_0x2a7ac1[_0x54f5('0x2d')],'type':_0x2a7ac1[_0x54f5('0x2e')]['key']};});_0x487599[_0x54f5('0x2f')]=_[_0x54f5('0x30')](_0x1b9602,_0x54f5('0x29'));_0x487599[_0x54f5('0x31')]=_['keys'](_0x1a1c40[_0x54f5('0x31')]);_0x487599[_0x54f5('0x32')]=_[_0x54f5('0x33')](_0x487599[_0x54f5('0x2f')],_0x487599[_0x54f5('0x31')]);_0xb101ca[_0x54f5('0x34')]=_['intersection'](_0x487599[_0x54f5('0x2f')],qs[_0x54f5('0x35')](_0x1a1c40[_0x54f5('0x31')][_0x54f5('0x35')]));_0xb101ca[_0x54f5('0x34')]=_0xb101ca[_0x54f5('0x34')][_0x54f5('0x36')]?_0xb101ca['attributes']:_0x487599[_0x54f5('0x2f')];if(!_0x1a1c40[_0x54f5('0x31')]['hasOwnProperty'](_0x54f5('0x37'))){_0xb101ca[_0x54f5('0x20')]=qs[_0x54f5('0x20')](_0x1a1c40['query']['limit']);_0xb101ca[_0x54f5('0x1e')]=qs['offset'](_0x1a1c40[_0x54f5('0x31')][_0x54f5('0x1e')]);}_0xb101ca[_0x54f5('0x38')]=qs[_0x54f5('0x39')](_0x1a1c40[_0x54f5('0x31')][_0x54f5('0x39')]);_0xb101ca[_0x54f5('0x3a')]=qs[_0x54f5('0x32')](_[_0x54f5('0x3b')](_0x1a1c40['query'],_0x487599[_0x54f5('0x32')]),_0x1b9602);if(_0x1a1c40[_0x54f5('0x31')][_0x54f5('0x3c')]){_0xb101ca[_0x54f5('0x3a')]=_[_0x54f5('0x3d')](_0xb101ca[_0x54f5('0x3a')],{'$or':_[_0x54f5('0x30')](_0x1b9602,function(_0x2744cb){if(_0x2744cb[_0x54f5('0x2e')]!==_0x54f5('0x3e')){var _0xe65cbb={};_0xe65cbb[_0x2744cb[_0x54f5('0x29')]]={'$like':'%'+_0x1a1c40['query'][_0x54f5('0x3c')]+'%'};return _0xe65cbb;}})});}_0xb101ca=_['merge']({},_0xb101ca,_0x1a1c40[_0x54f5('0x3f')]);var _0x1e010c={'where':_0xb101ca[_0x54f5('0x3a')]};return db['SquareRecording'][_0x54f5('0x40')](_0x1e010c)[_0x54f5('0x25')](function(_0x310ce9){_0x5f61d8[_0x54f5('0x40')]=_0x310ce9;if(_0x1a1c40[_0x54f5('0x31')][_0x54f5('0x41')]){_0xb101ca['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0xb101ca);})[_0x54f5('0x25')](function(_0x3cba75){_0x5f61d8[_0x54f5('0x42')]=_0x3cba75;return _0x5f61d8;})[_0x54f5('0x25')](respondWithFilteredResult(_0x5d9c86,_0xb101ca))[_0x54f5('0x43')](handleError(_0x5d9c86,null));};exports[_0x54f5('0x44')]=function(_0x4caccc,_0x26b6ba){var _0x3b51b5={'raw':!![],'where':{'id':_0x4caccc[_0x54f5('0x45')]['id']}},_0x114d2e={};_0x114d2e[_0x54f5('0x2f')]=_[_0x54f5('0x46')](db[_0x54f5('0x2b')][_0x54f5('0x2c')]);_0x114d2e[_0x54f5('0x31')]=_[_0x54f5('0x46')](_0x4caccc[_0x54f5('0x31')]);_0x114d2e[_0x54f5('0x32')]=_[_0x54f5('0x33')](_0x114d2e[_0x54f5('0x2f')],_0x114d2e['query']);_0x3b51b5['attributes']=_[_0x54f5('0x33')](_0x114d2e['model'],qs[_0x54f5('0x35')](_0x4caccc['query'][_0x54f5('0x35')]));_0x3b51b5[_0x54f5('0x34')]=_0x3b51b5['attributes']['length']?_0x3b51b5[_0x54f5('0x34')]:_0x114d2e['model'];if(_0x4caccc['query'][_0x54f5('0x41')]){_0x3b51b5['include']=[{'all':!![]}];}_0x3b51b5=_[_0x54f5('0x3d')]({},_0x3b51b5,_0x4caccc[_0x54f5('0x3f')]);return db['SquareRecording'][_0x54f5('0x47')](_0x3b51b5)['then'](handleEntityNotFound(_0x26b6ba,null))[_0x54f5('0x25')](respondWithResult(_0x26b6ba,null))[_0x54f5('0x43')](handleError(_0x26b6ba,null));};exports[_0x54f5('0x48')]=function(_0x3d9405,_0x37c8ed){return db[_0x54f5('0x2b')]['create'](_0x3d9405['body'],{})[_0x54f5('0x25')](respondWithResult(_0x37c8ed,0xc9))[_0x54f5('0x43')](handleError(_0x37c8ed,null));};exports['update']=function(_0x433ea1,_0x54d1aa){if(_0x433ea1[_0x54f5('0x49')]['id']){delete _0x433ea1[_0x54f5('0x49')]['id'];}return db[_0x54f5('0x2b')][_0x54f5('0x47')]({'where':{'id':_0x433ea1['params']['id']}})[_0x54f5('0x25')](handleEntityNotFound(_0x54d1aa,null))['then'](saveUpdates(_0x433ea1[_0x54f5('0x49')],null))[_0x54f5('0x25')](respondWithResult(_0x54d1aa,null))[_0x54f5('0x43')](handleError(_0x54d1aa,null));};exports[_0x54f5('0x4a')]=function(_0x54bbc8,_0x58c152,_0x2313a7){var _0x2fae81=require(_0x54f5('0x4b'));var _0x53bfe7=![];var _0x16f4ae={};if(_0x54bbc8[_0x54f5('0x31')]['type']&&_0x54bbc8['query'][_0x54f5('0x2e')]===_0x54f5('0x4c')){_0x16f4ae[_0x54f5('0x4c')]=_0x54bbc8[_0x54f5('0x45')]['id'];}else{_0x16f4ae['id']=_0x54bbc8[_0x54f5('0x45')]['id'];}return db[_0x54f5('0x2b')]['find']({'where':_0x16f4ae,'attributes':['id',_0x54f5('0x4d'),_0x54f5('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x58c152,null))[_0x54f5('0x25')](function(_0x21bfcb){if(_0x21bfcb){var _0x11a4bb=_0x21bfcb[_0x54f5('0x4d')];var _0x4aa836=util[_0x54f5('0x4f')](_0x54f5('0x50'),_0x11a4bb);if(fs[_0x54f5('0x51')](_0x4aa836)){_0x53bfe7=!![];return _0x2fae81[_0x54f5('0x52')](_0x4aa836,_0x11a4bb,config[_0x54f5('0x53')][_0x54f5('0x54')])['then'](function(){return _0x21bfcb;});}return _0x21bfcb;}})[_0x54f5('0x25')](function(_0x5b9cac){if(_0x5b9cac){var _0x1a8af1=_0x5b9cac[_0x54f5('0x4d')];if(!fs[_0x54f5('0x51')](_0x1a8af1)){throw new db[(_0x54f5('0x55'))][(_0x54f5('0x56'))](_0x54f5('0x57'));}if(_0x5b9cac['filename']){return _0x58c152[_0x54f5('0x4a')](_0x1a8af1,_0x5b9cac[_0x54f5('0x4e')]+path[_0x54f5('0x58')](_0x1a8af1),function(){if(_0x53bfe7){fs[_0x54f5('0x59')](_0x1a8af1);}});}else{return _0x58c152[_0x54f5('0x4a')](_0x1a8af1,function(_0x15d3ce){if(_0x53bfe7){fs[_0x54f5('0x59')](_0x1a8af1);}});}}})['catch'](function(_0x382e09){if(_0x382e09['message']===_0x54f5('0x57')){_0x58c152['status'](0x194)[_0x54f5('0x5a')]('Not\x20found');}else{return handleError(_0x58c152,null);}});};exports[_0x54f5('0x26')]=function(_0x1f0413,_0x4fa629){return db[_0x54f5('0x2b')][_0x54f5('0x47')]({'where':{'id':_0x1f0413[_0x54f5('0x45')]['id']}})[_0x54f5('0x25')](function(_0x598b04){if(_['isNil'](_0x598b04)){throw new ReferenceError(_0x54f5('0x5b'));}return _0x598b04;})[_0x54f5('0x25')](function(_0x28f0ac){var _0x4e31da=_0x28f0ac['savePath'];logger[_0x54f5('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0x4e31da);if(!_[_0x54f5('0x5d')](_0x28f0ac[_0x54f5('0x4d')])&&fs['existsSync'](_0x4e31da)){logger[_0x54f5('0x5c')](_0x54f5('0x5e')+_0x4e31da+_0x54f5('0x5f'));fs[_0x54f5('0x60')](_0x4e31da);}_0x4e31da=_0x4e31da+_0x54f5('0x61');if(!_[_0x54f5('0x5d')](_0x28f0ac[_0x54f5('0x4d')])&&fs[_0x54f5('0x51')](_0x4e31da)){logger[_0x54f5('0x5c')](_0x54f5('0x5e')+_0x4e31da+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4e31da);}return _0x28f0ac;})[_0x54f5('0x25')](function(_0x91ebca){if(!_0x91ebca)throw new InternalError();return _0x91ebca[_0x54f5('0x26')]();})['then'](function(){_0x4fa629[_0x54f5('0x1c')](0xcc)[_0x54f5('0x1b')]();})[_0x54f5('0x43')](handleError(_0x4fa629,null));}; \ No newline at end of file +var _0xb3dd=['catch','show','find','create','body','params','../../components/encryptor','savePath','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows'];(function(_0x41b6eb,_0x4f84b7){var _0xb44dda=function(_0x309dc8){while(--_0x309dc8){_0x41b6eb['push'](_0x41b6eb['shift']());}};_0xb44dda(++_0x4f84b7);}(_0xb3dd,0x82));var _0xdb3d=function(_0xab1b45,_0x38b545){_0xab1b45=_0xab1b45-0x0;var _0x505d06=_0xb3dd[_0xab1b45];return _0x505d06;};'use strict';var emlformat=require(_0xdb3d('0x0'));var rimraf=require(_0xdb3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdb3d('0x2'));var moment=require('moment');var BPromise=require(_0xdb3d('0x3'));var Mustache=require(_0xdb3d('0x4'));var util=require(_0xdb3d('0x5'));var path=require(_0xdb3d('0x6'));var sox=require(_0xdb3d('0x7'));var csv=require(_0xdb3d('0x8'));var ejs=require(_0xdb3d('0x9'));var fs=require('fs');var fs_extra=require(_0xdb3d('0xa'));var _=require(_0xdb3d('0xb'));var squel=require('squel');var crypto=require(_0xdb3d('0xc'));var jsforce=require(_0xdb3d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdb3d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdb3d('0xe'));var qs=require(_0xdb3d('0xf'));var as=require(_0xdb3d('0x10'));var hardwareService=require(_0xdb3d('0x11'));var logger=require(_0xdb3d('0x12'))(_0xdb3d('0x13'));var utils=require(_0xdb3d('0x14'));var config=require(_0xdb3d('0x15'));var licenseUtil=require(_0xdb3d('0x16'));var db=require(_0xdb3d('0x17'))['db'];function respondWithStatusCode(_0x10958a,_0x2006c0){_0x2006c0=_0x2006c0||0xcc;return function(_0x445ab4){if(_0x445ab4){return _0x10958a[_0xdb3d('0x18')](_0x2006c0);}return _0x10958a[_0xdb3d('0x19')](_0x2006c0)[_0xdb3d('0x1a')]();};}function respondWithResult(_0x2739e9,_0x212d2c){_0x212d2c=_0x212d2c||0xc8;return function(_0x33be9f){if(_0x33be9f){return _0x2739e9[_0xdb3d('0x19')](_0x212d2c)[_0xdb3d('0x1b')](_0x33be9f);}};}function respondWithFilteredResult(_0xc63651,_0x5265b1){return function(_0x14abf0){if(_0x14abf0){var _0x1a495f=typeof _0x5265b1[_0xdb3d('0x1c')]===_0xdb3d('0x1d')&&typeof _0x5265b1['limit']==='undefined';var _0xd7db75=_0x14abf0['count'];var _0x373818=_0x1a495f?0x0:_0x5265b1[_0xdb3d('0x1c')];var _0x94269a=_0x1a495f?_0x14abf0['count']:_0x5265b1[_0xdb3d('0x1c')]+_0x5265b1[_0xdb3d('0x1e')];var _0x4f8249;if(_0x94269a>=_0xd7db75){_0x94269a=_0xd7db75;_0x4f8249=0xc8;}else{_0x4f8249=0xce;}_0xc63651[_0xdb3d('0x19')](_0x4f8249);return _0xc63651[_0xdb3d('0x1f')](_0xdb3d('0x20'),_0x373818+'-'+_0x94269a+'/'+_0xd7db75)[_0xdb3d('0x1b')](_0x14abf0);}return null;};}function patchUpdates(_0x2d3f09){return function(_0x307463){try{jsonpatch[_0xdb3d('0x21')](_0x307463,_0x2d3f09,!![]);}catch(_0x19d3f3){return BPromise[_0xdb3d('0x22')](_0x19d3f3);}return _0x307463[_0xdb3d('0x23')]();};}function saveUpdates(_0x8afa23,_0x3594df){return function(_0x1ac3cc){if(_0x1ac3cc){return _0x1ac3cc[_0xdb3d('0x24')](_0x8afa23)[_0xdb3d('0x25')](function(_0xe65874){return _0xe65874;});}return null;};}function removeEntity(_0x52ba7b,_0x206fbf){return function(_0x470108){if(_0x470108){return _0x470108['destroy']()[_0xdb3d('0x25')](function(){_0x52ba7b[_0xdb3d('0x19')](0xcc)[_0xdb3d('0x1a')]();});}};}function handleEntityNotFound(_0x596d22,_0x2d78d5){return function(_0x268ab1){if(!_0x268ab1){_0x596d22[_0xdb3d('0x18')](0x194);}return _0x268ab1;};}function handleError(_0x10fde3,_0x2b59fb){_0x2b59fb=_0x2b59fb||0x1f4;return function(_0x1597cf){logger[_0xdb3d('0x26')](_0x1597cf[_0xdb3d('0x27')]);if(_0x1597cf[_0xdb3d('0x28')]){delete _0x1597cf[_0xdb3d('0x28')];}_0x10fde3[_0xdb3d('0x19')](_0x2b59fb)[_0xdb3d('0x29')](_0x1597cf);};}exports[_0xdb3d('0x2a')]=function(_0x591d17,_0x6eb296){var _0x42b869={},_0x41f147={},_0xf3321e={'count':0x0,'rows':[]};var _0x15a0da=_[_0xdb3d('0x2b')](db[_0xdb3d('0x2c')][_0xdb3d('0x2d')],function(_0x1feb91){return{'name':_0x1feb91[_0xdb3d('0x2e')],'type':_0x1feb91[_0xdb3d('0x2f')]['key']};});_0x41f147['model']=_[_0xdb3d('0x2b')](_0x15a0da,_0xdb3d('0x28'));_0x41f147['query']=_[_0xdb3d('0x30')](_0x591d17[_0xdb3d('0x31')]);_0x41f147[_0xdb3d('0x32')]=_[_0xdb3d('0x33')](_0x41f147[_0xdb3d('0x34')],_0x41f147[_0xdb3d('0x31')]);_0x42b869[_0xdb3d('0x35')]=_['intersection'](_0x41f147[_0xdb3d('0x34')],qs[_0xdb3d('0x36')](_0x591d17[_0xdb3d('0x31')][_0xdb3d('0x36')]));_0x42b869[_0xdb3d('0x35')]=_0x42b869[_0xdb3d('0x35')][_0xdb3d('0x37')]?_0x42b869['attributes']:_0x41f147[_0xdb3d('0x34')];if(!_0x591d17[_0xdb3d('0x31')]['hasOwnProperty'](_0xdb3d('0x38'))){_0x42b869[_0xdb3d('0x1e')]=qs[_0xdb3d('0x1e')](_0x591d17['query'][_0xdb3d('0x1e')]);_0x42b869[_0xdb3d('0x1c')]=qs['offset'](_0x591d17['query'][_0xdb3d('0x1c')]);}_0x42b869[_0xdb3d('0x39')]=qs[_0xdb3d('0x3a')](_0x591d17[_0xdb3d('0x31')][_0xdb3d('0x3a')]);_0x42b869[_0xdb3d('0x3b')]=qs[_0xdb3d('0x32')](_[_0xdb3d('0x3c')](_0x591d17['query'],_0x41f147[_0xdb3d('0x32')]),_0x15a0da);if(_0x591d17[_0xdb3d('0x31')][_0xdb3d('0x3d')]){_0x42b869['where']=_['merge'](_0x42b869['where'],{'$or':_['map'](_0x15a0da,function(_0x15af1f){if(_0x15af1f[_0xdb3d('0x2f')]!==_0xdb3d('0x3e')){var _0x18a11c={};_0x18a11c[_0x15af1f[_0xdb3d('0x28')]]={'$like':'%'+_0x591d17[_0xdb3d('0x31')][_0xdb3d('0x3d')]+'%'};return _0x18a11c;}})});}_0x42b869=_[_0xdb3d('0x3f')]({},_0x42b869,_0x591d17[_0xdb3d('0x40')]);var _0x12b12d={'where':_0x42b869[_0xdb3d('0x3b')]};return db[_0xdb3d('0x2c')]['count'](_0x12b12d)[_0xdb3d('0x25')](function(_0x25f773){_0xf3321e[_0xdb3d('0x41')]=_0x25f773;if(_0x591d17[_0xdb3d('0x31')][_0xdb3d('0x42')]){_0x42b869[_0xdb3d('0x43')]=[{'all':!![]}];}return db[_0xdb3d('0x2c')][_0xdb3d('0x44')](_0x42b869);})['then'](function(_0x1b399b){_0xf3321e[_0xdb3d('0x45')]=_0x1b399b;return _0xf3321e;})[_0xdb3d('0x25')](respondWithFilteredResult(_0x6eb296,_0x42b869))[_0xdb3d('0x46')](handleError(_0x6eb296,null));};exports[_0xdb3d('0x47')]=function(_0x29f867,_0x359443){var _0x47ff8a={'raw':!![],'where':{'id':_0x29f867['params']['id']}},_0x3df50b={};_0x3df50b[_0xdb3d('0x34')]=_['keys'](db[_0xdb3d('0x2c')]['rawAttributes']);_0x3df50b[_0xdb3d('0x31')]=_[_0xdb3d('0x30')](_0x29f867[_0xdb3d('0x31')]);_0x3df50b[_0xdb3d('0x32')]=_[_0xdb3d('0x33')](_0x3df50b[_0xdb3d('0x34')],_0x3df50b['query']);_0x47ff8a['attributes']=_[_0xdb3d('0x33')](_0x3df50b['model'],qs['fields'](_0x29f867['query'][_0xdb3d('0x36')]));_0x47ff8a[_0xdb3d('0x35')]=_0x47ff8a[_0xdb3d('0x35')][_0xdb3d('0x37')]?_0x47ff8a['attributes']:_0x3df50b[_0xdb3d('0x34')];if(_0x29f867['query'][_0xdb3d('0x42')]){_0x47ff8a['include']=[{'all':!![]}];}_0x47ff8a=_[_0xdb3d('0x3f')]({},_0x47ff8a,_0x29f867[_0xdb3d('0x40')]);return db[_0xdb3d('0x2c')][_0xdb3d('0x48')](_0x47ff8a)[_0xdb3d('0x25')](handleEntityNotFound(_0x359443,null))[_0xdb3d('0x25')](respondWithResult(_0x359443,null))['catch'](handleError(_0x359443,null));};exports[_0xdb3d('0x49')]=function(_0x2803a6,_0x28280c){return db[_0xdb3d('0x2c')]['create'](_0x2803a6[_0xdb3d('0x4a')],{})[_0xdb3d('0x25')](respondWithResult(_0x28280c,0xc9))['catch'](handleError(_0x28280c,null));};exports['update']=function(_0x5ddcc8,_0x2df762){if(_0x5ddcc8['body']['id']){delete _0x5ddcc8['body']['id'];}return db[_0xdb3d('0x2c')][_0xdb3d('0x48')]({'where':{'id':_0x5ddcc8[_0xdb3d('0x4b')]['id']}})[_0xdb3d('0x25')](handleEntityNotFound(_0x2df762,null))[_0xdb3d('0x25')](saveUpdates(_0x5ddcc8[_0xdb3d('0x4a')],null))[_0xdb3d('0x25')](respondWithResult(_0x2df762,null))[_0xdb3d('0x46')](handleError(_0x2df762,null));};exports['download']=function(_0x5dba47,_0x56e3e2,_0x5994b2){var _0x47c7dc=require(_0xdb3d('0x4c'));var _0x5cd1d8=![];var _0x160ed0={};if(_0x5dba47[_0xdb3d('0x31')][_0xdb3d('0x2f')]&&_0x5dba47[_0xdb3d('0x31')][_0xdb3d('0x2f')]==='uniqueid'){_0x160ed0['uniqueid']=_0x5dba47[_0xdb3d('0x4b')]['id'];}else{_0x160ed0['id']=_0x5dba47[_0xdb3d('0x4b')]['id'];}return db[_0xdb3d('0x2c')][_0xdb3d('0x48')]({'where':_0x160ed0,'attributes':['id',_0xdb3d('0x4d'),_0xdb3d('0x4e')],'raw':!![]})[_0xdb3d('0x25')](handleEntityNotFound(_0x56e3e2,null))[_0xdb3d('0x25')](function(_0x5d853d){if(_0x5d853d){var _0x195d6d=_0x5d853d['savePath'];var _0x341af5=util[_0xdb3d('0x4f')]('%s.cypher',_0x195d6d);if(fs[_0xdb3d('0x50')](_0x341af5)){_0x5cd1d8=!![];return _0x47c7dc[_0xdb3d('0x51')](_0x341af5,_0x195d6d,config[_0xdb3d('0x52')][_0xdb3d('0x53')])['then'](function(){return _0x5d853d;});}return _0x5d853d;}})['then'](function(_0x55c7dc){if(_0x55c7dc){var _0x455365=_0x55c7dc[_0xdb3d('0x4d')];if(!fs[_0xdb3d('0x50')](_0x455365)){throw new db[(_0xdb3d('0x54'))][(_0xdb3d('0x55'))](_0xdb3d('0x56'));}if(_0x55c7dc['filename']){return _0x56e3e2[_0xdb3d('0x57')](_0x455365,_0x55c7dc['filename']+path[_0xdb3d('0x58')](_0x455365),function(){if(_0x5cd1d8){fs[_0xdb3d('0x59')](_0x455365);}});}else{return _0x56e3e2['download'](_0x455365,function(_0x43efe4){if(_0x5cd1d8){fs[_0xdb3d('0x59')](_0x455365);}});}}})[_0xdb3d('0x46')](function(_0x17745c){if(_0x17745c[_0xdb3d('0x5a')]==='SquareRecording\x20not\x20found'){_0x56e3e2[_0xdb3d('0x19')](0x194)[_0xdb3d('0x29')](_0xdb3d('0x5b'));}else{return handleError(_0x56e3e2,null);}});};exports[_0xdb3d('0x5c')]=function(_0x51df9b,_0x2964fa){return db[_0xdb3d('0x2c')][_0xdb3d('0x48')]({'where':{'id':_0x51df9b['params']['id']}})[_0xdb3d('0x25')](function(_0x4814ba){if(_[_0xdb3d('0x5d')](_0x4814ba)){throw new ReferenceError(_0xdb3d('0x5e'));}return _0x4814ba;})[_0xdb3d('0x25')](function(_0x2d19f4){var _0x388980=_0x2d19f4[_0xdb3d('0x4d')];logger[_0xdb3d('0x5f')](_0xdb3d('0x60'),_0x388980);if(!_[_0xdb3d('0x5d')](_0x2d19f4[_0xdb3d('0x4d')])&&fs[_0xdb3d('0x50')](_0x388980)){logger[_0xdb3d('0x5f')]('File:\x20\x22'+_0x388980+_0xdb3d('0x61'));fs[_0xdb3d('0x62')](_0x388980);}_0x388980=_0x388980+'.cypher';if(!_[_0xdb3d('0x5d')](_0x2d19f4[_0xdb3d('0x4d')])&&fs[_0xdb3d('0x50')](_0x388980)){logger['info'](_0xdb3d('0x63')+_0x388980+_0xdb3d('0x61'));fs[_0xdb3d('0x62')](_0x388980);}return _0x2d19f4;})[_0xdb3d('0x25')](function(_0x4a2e77){if(!_0x4a2e77)throw new InternalError();return _0x4a2e77[_0xdb3d('0x5c')]();})[_0xdb3d('0x25')](function(){_0x2964fa[_0xdb3d('0x19')](0xcc)['end']();})[_0xdb3d('0x46')](handleError(_0x2964fa,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c15d977..4643699 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 _0x117c=['../../config/environment','./squareRecording.attributes','exports','define','square_recordings','api','request-promise','path','rimraf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x117c,0x71));var _0xc117=function(_0x5807d4,_0x29306b){_0x5807d4=_0x5807d4-0x0;var _0x5ddf9b=_0x117c[_0x5807d4];return _0x5ddf9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc117('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc117('0x1'));var fs=require('fs');var path=require(_0xc117('0x2'));var rimraf=require(_0xc117('0x3'));var config=require(_0xc117('0x4'));var attributes=require(_0xc117('0x5'));module[_0xc117('0x6')]=function(_0x52d09e,_0x3bb859){return _0x52d09e[_0xc117('0x7')]('SquareRecording',attributes,{'tableName':_0xc117('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63a5=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','SquareRecording','lodash','util'];(function(_0x267d29,_0x27f1fe){var _0x4cd7c9=function(_0x4526d4){while(--_0x4526d4){_0x267d29['push'](_0x267d29['shift']());}};_0x4cd7c9(++_0x27f1fe);}(_0x63a5,0x18e));var _0x563a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x63a5[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var logger=require(_0x563a('0x2'))('api');var moment=require(_0x563a('0x3'));var BPromise=require('bluebird');var rp=require(_0x563a('0x4'));var fs=require('fs');var path=require(_0x563a('0x5'));var rimraf=require(_0x563a('0x6'));var config=require(_0x563a('0x7'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x1fdcb0,_0x5a6458){return _0x1fdcb0[_0x563a('0x8')](_0x563a('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 4144a32..7c9ff22 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 _0x3def=['result','catch','CreateSquareRecording','SquareRecording','create','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x90ae53,_0x36ca18){var _0x329ac6=function(_0x2165a4){while(--_0x2165a4){_0x90ae53['push'](_0x90ae53['shift']());}};_0x329ac6(++_0x36ca18);}(_0x3def,0x101));var _0xf3de=function(_0x30ea12,_0x519177){_0x30ea12=_0x30ea12-0x0;var _0xbe4fc2=_0x3def[_0x30ea12];return _0xbe4fc2;};'use strict';var _=require(_0xf3de('0x0'));var util=require(_0xf3de('0x1'));var moment=require(_0xf3de('0x2'));var BPromise=require(_0xf3de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3de('0x4'));var db=require(_0xf3de('0x5'))['db'];var utils=require(_0xf3de('0x6'));var logger=require(_0xf3de('0x7'))('rpc');var config=require(_0xf3de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf3de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53775f,_0x5833cd,_0x2e3002){return new BPromise(function(_0x4776ab,_0x1c7bab){return client['request'](_0x53775f,_0x2e3002)[_0xf3de('0xa')](function(_0x18d670){logger[_0xf3de('0xb')](_0xf3de('0xc'),_0x5833cd,_0xf3de('0xd'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5833cd,_0xf3de('0xd'),JSON[_0xf3de('0xe')](_0x18d670));if(_0x18d670[_0xf3de('0xf')]){if(_0x18d670[_0xf3de('0xf')][_0xf3de('0x10')]===0x1f4){logger[_0xf3de('0xf')](_0xf3de('0xc'),_0x5833cd,_0x18d670['error'][_0xf3de('0x11')]);return _0x1c7bab(_0x18d670['error'][_0xf3de('0x11')]);}logger[_0xf3de('0xf')](_0xf3de('0xc'),_0x5833cd,_0x18d670[_0xf3de('0xf')]['message']);return _0x4776ab(_0x18d670['error'][_0xf3de('0x11')]);}else{logger[_0xf3de('0xb')](_0xf3de('0xc'),_0x5833cd,_0xf3de('0xd'));_0x4776ab(_0x18d670[_0xf3de('0x12')]['message']);}})[_0xf3de('0x13')](function(_0xed47d1){logger[_0xf3de('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5833cd,_0xed47d1);_0x1c7bab(_0xed47d1);});});}exports[_0xf3de('0x14')]=function(_0x905efd){var _0x4c04e0=this;return new Promise(function(_0x1330ed,_0x36e392){return db[_0xf3de('0x15')][_0xf3de('0x16')](_0x905efd['body'],{'raw':_0x905efd[_0xf3de('0x17')]?_0x905efd[_0xf3de('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5b29ff){logger[_0xf3de('0xb')](_0xf3de('0x14'),_0x905efd);logger[_0xf3de('0x18')](_0xf3de('0x14'),_0x905efd,JSON[_0xf3de('0xe')](_0x5b29ff));_0x1330ed(_0x5b29ff);})[_0xf3de('0x13')](function(_0x4f1ade){logger[_0xf3de('0xf')](_0xf3de('0x14'),_0x4f1ade['message'],_0x905efd);_0x36e392(_0x4c04e0[_0xf3de('0xf')](0x1f4,_0x4f1ade[_0xf3de('0x11')]));});});}; \ No newline at end of file +var _0xf464=['SquareRecording,\x20%s,\x20%s','message','info','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error'];(function(_0x538cac,_0x581ad1){var _0x554759=function(_0x25eb48){while(--_0x25eb48){_0x538cac['push'](_0x538cac['shift']());}};_0x554759(++_0x581ad1);}(_0xf464,0x76));var _0x4f46=function(_0x54ee3f,_0x3874a6){_0x54ee3f=_0x54ee3f-0x0;var _0xf1b9eb=_0xf464[_0x54ee3f];return _0xf1b9eb;};'use strict';var _=require(_0x4f46('0x0'));var util=require(_0x4f46('0x1'));var moment=require(_0x4f46('0x2'));var BPromise=require(_0x4f46('0x3'));var rs=require(_0x4f46('0x4'));var fs=require('fs');var Redis=require(_0x4f46('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f46('0x6'));var logger=require(_0x4f46('0x7'))(_0x4f46('0x8'));var config=require('../../config/environment');var jayson=require(_0x4f46('0x9'));var client=jayson[_0x4f46('0xa')][_0x4f46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d496,_0x17812f,_0x3e5dd5){return new BPromise(function(_0x4ecdd7,_0x17282c){return client['request'](_0x32d496,_0x3e5dd5)[_0x4f46('0xc')](function(_0x19ccc2){logger['info']('SquareRecording,\x20%s,\x20%s',_0x17812f,_0x4f46('0xd'));logger[_0x4f46('0xe')](_0x4f46('0xf'),_0x17812f,_0x4f46('0xd'),JSON['stringify'](_0x19ccc2));if(_0x19ccc2[_0x4f46('0x10')]){if(_0x19ccc2[_0x4f46('0x10')]['code']===0x1f4){logger[_0x4f46('0x10')](_0x4f46('0x11'),_0x17812f,_0x19ccc2[_0x4f46('0x10')][_0x4f46('0x12')]);return _0x17282c(_0x19ccc2[_0x4f46('0x10')][_0x4f46('0x12')]);}logger[_0x4f46('0x10')](_0x4f46('0x11'),_0x17812f,_0x19ccc2[_0x4f46('0x10')]['message']);return _0x4ecdd7(_0x19ccc2['error'][_0x4f46('0x12')]);}else{logger[_0x4f46('0x13')]('SquareRecording,\x20%s,\x20%s',_0x17812f,_0x4f46('0xd'));_0x4ecdd7(_0x19ccc2['result']['message']);}})[_0x4f46('0x14')](function(_0x263298){logger[_0x4f46('0x10')](_0x4f46('0x11'),_0x17812f,_0x263298);_0x17282c(_0x263298);});});}exports[_0x4f46('0x15')]=function(_0x4309c9){var _0x4cb9a0=this;return new Promise(function(_0x58b1f6,_0x1741e8){return db[_0x4f46('0x16')][_0x4f46('0x17')](_0x4309c9[_0x4f46('0x18')],{'raw':_0x4309c9[_0x4f46('0x19')]?_0x4309c9[_0x4f46('0x19')][_0x4f46('0x1a')]===undefined?!![]:![]:!![]})[_0x4f46('0xc')](function(_0x2d9a87){logger[_0x4f46('0x13')](_0x4f46('0x15'),_0x4309c9);logger[_0x4f46('0xe')]('CreateSquareRecording',_0x4309c9,JSON['stringify'](_0x2d9a87));_0x58b1f6(_0x2d9a87);})['catch'](function(_0x2daaca){logger['error'](_0x4f46('0x15'),_0x2daaca[_0x4f46('0x12')],_0x4309c9);_0x1741e8(_0x4cb9a0[_0x4f46('0x10')](0x1f4,_0x2daaca['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0d79164..7d5bd17 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 _0x2c9b=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReport.controller','isAuthenticated','index','get','/describe','show','post','create','put','/:id','update','destroy'];(function(_0x20feae,_0x31e753){var _0x5c3dd2=function(_0x114638){while(--_0x114638){_0x20feae['push'](_0x20feae['shift']());}};_0x5c3dd2(++_0x31e753);}(_0x2c9b,0x141));var _0xb2c9=function(_0x34d15a,_0x2a2853){_0x34d15a=_0x34d15a-0x0;var _0x557a19=_0x2c9b[_0x34d15a];return _0x557a19;};'use strict';var multer=require(_0xb2c9('0x0'));var util=require(_0xb2c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb2c9('0x2'));var router=express[_0xb2c9('0x3')]();var fs_extra=require(_0xb2c9('0x4'));var auth=require(_0xb2c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb2c9('0x6'));var controller=require(_0xb2c9('0x7'));router['get']('/',auth[_0xb2c9('0x8')](),controller[_0xb2c9('0x9')]);router[_0xb2c9('0xa')](_0xb2c9('0xb'),auth[_0xb2c9('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb2c9('0xc')]);router[_0xb2c9('0xd')]('/',auth[_0xb2c9('0x8')](),controller[_0xb2c9('0xe')]);router[_0xb2c9('0xf')](_0xb2c9('0x10'),auth[_0xb2c9('0x8')](),controller[_0xb2c9('0x11')]);router['delete']('/:id',auth[_0xb2c9('0x8')](),controller[_0xb2c9('0x12')]);module[_0xb2c9('0x13')]=router; \ No newline at end of file +var _0x1807=['../../components/interaction/service','./squareReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5c2c39,_0x4f93d2){var _0x237f67=function(_0x155e8c){while(--_0x155e8c){_0x5c2c39['push'](_0x5c2c39['shift']());}};_0x237f67(++_0x4f93d2);}(_0x1807,0xdb));var _0x7180=function(_0x482913,_0x38462a){_0x482913=_0x482913-0x0;var _0x49f170=_0x1807[_0x482913];return _0x49f170;};'use strict';var multer=require(_0x7180('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7180('0x1'));var express=require(_0x7180('0x2'));var router=express['Router']();var fs_extra=require(_0x7180('0x3'));var auth=require(_0x7180('0x4'));var interaction=require(_0x7180('0x5'));var config=require('../../config/environment');var controller=require(_0x7180('0x6'));router[_0x7180('0x7')]('/',auth[_0x7180('0x8')](),controller['index']);router[_0x7180('0x7')](_0x7180('0x9'),auth[_0x7180('0x8')](),controller[_0x7180('0xa')]);router[_0x7180('0x7')](_0x7180('0xb'),auth[_0x7180('0x8')](),controller['show']);router[_0x7180('0xc')]('/',auth['isAuthenticated'](),controller[_0x7180('0xd')]);router[_0x7180('0xe')](_0x7180('0xb'),auth[_0x7180('0x8')](),controller['update']);router[_0x7180('0xf')](_0x7180('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 6f4eb50..3f9f84b 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 _0x052b=['STRING','DATE','BOOLEAN','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x052b,0x117));var _0xb052=function(_0x214dfa,_0x302b9f){_0x214dfa=_0x214dfa-0x0;var _0xb30951=_0x052b[_0x214dfa];return _0xb30951;};'use strict';var Sequelize=require('sequelize');module[_0xb052('0x0')]={'network':{'type':Sequelize[_0xb052('0x1')]},'network_script':{'type':Sequelize[_0xb052('0x1')]},'request':{'type':Sequelize[_0xb052('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb052('0x1')]},'uniqueid':{'type':Sequelize[_0xb052('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb052('0x1')]},'calleridname':{'type':Sequelize[_0xb052('0x1')]},'callingpres':{'type':Sequelize[_0xb052('0x1')]},'callingani2':{'type':Sequelize[_0xb052('0x1')]},'callington':{'type':Sequelize[_0xb052('0x1')]},'callingtns':{'type':Sequelize[_0xb052('0x1')]},'dnid':{'type':Sequelize[_0xb052('0x1')]},'rdnis':{'type':Sequelize[_0xb052('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xb052('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xb052('0x1')]},'project_name':{'type':Sequelize[_0xb052('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb052('0x2')]},'bot':{'type':Sequelize[_0xb052('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x823c=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x19865b,_0x279613){var _0x186b3a=function(_0xe8278a){while(--_0xe8278a){_0x19865b['push'](_0x19865b['shift']());}};_0x186b3a(++_0x279613);}(_0x823c,0x92));var _0xc823=function(_0xa2deee,_0x3b6c4c){_0xa2deee=_0xa2deee-0x0;var _0x356907=_0x823c[_0xa2deee];return _0x356907;};'use strict';var Sequelize=require(_0xc823('0x0'));module['exports']={'network':{'type':Sequelize[_0xc823('0x1')]},'network_script':{'type':Sequelize[_0xc823('0x1')]},'request':{'type':Sequelize[_0xc823('0x1')]},'channel':{'type':Sequelize[_0xc823('0x1')]},'language':{'type':Sequelize[_0xc823('0x1')]},'type':{'type':Sequelize[_0xc823('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc823('0x1')]},'calleridname':{'type':Sequelize[_0xc823('0x1')]},'callingpres':{'type':Sequelize[_0xc823('0x1')]},'callingani2':{'type':Sequelize[_0xc823('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xc823('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xc823('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xc823('0x1')]},'priority':{'type':Sequelize[_0xc823('0x1')]},'enhanced':{'type':Sequelize[_0xc823('0x1')]},'accountcode':{'type':Sequelize[_0xc823('0x1')]},'threadid':{'type':Sequelize[_0xc823('0x1')]},'project_name':{'type':Sequelize[_0xc823('0x1')]},'joinAt':{'type':Sequelize[_0xc823('0x2')]},'leaveAt':{'type':Sequelize[_0xc823('0x2')]},'bot':{'type':Sequelize[_0xc823('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index cd2a294..9e8496d 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 _0xa30a=['destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','includeAll','find','body'];(function(_0x2eee62,_0x170242){var _0x26467b=function(_0x8018f){while(--_0x8018f){_0x2eee62['push'](_0x2eee62['shift']());}};_0x26467b(++_0x170242);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');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('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){_0x13128a[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x12da2f,_0x97b038){return function(_0x2a59ce){if(!_0x2a59ce){_0x12da2f['sendStatus'](0x194);}return _0x2a59ce;};}function handleError(_0x467850,_0x465701){_0x465701=_0x465701||0x1f4;return function(_0x5d4da8){logger[_0xaa30('0x24')](_0x5d4da8['stack']);if(_0x5d4da8[_0xaa30('0x25')]){delete _0x5d4da8[_0xaa30('0x25')];}_0x467850[_0xaa30('0x19')](_0x465701)[_0xaa30('0x26')](_0x5d4da8);};}exports[_0xaa30('0x27')]=function(_0xc10b8f,_0x6ff09a){var _0x39f708={},_0x1f288c={},_0x43fb30={'count':0x0,'rows':[]};var _0x44aa9b=_[_0xaa30('0x28')](db[_0xaa30('0x29')][_0xaa30('0x2a')],function(_0x40e4ee){return{'name':_0x40e4ee[_0xaa30('0x2b')],'type':_0x40e4ee[_0xaa30('0x2c')][_0xaa30('0x2d')]};});_0x1f288c['model']=_[_0xaa30('0x28')](_0x44aa9b,_0xaa30('0x25'));_0x1f288c[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0xc10b8f[_0xaa30('0x2e')]);_0x1f288c[_0xaa30('0x30')]=_['intersection'](_0x1f288c['model'],_0x1f288c['query']);_0x39f708[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x1f288c[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0xc10b8f[_0xaa30('0x2e')]['fields']));_0x39f708['attributes']=_0x39f708[_0xaa30('0x31')][_0xaa30('0x35')]?_0x39f708['attributes']:_0x1f288c[_0xaa30('0x33')];if(!_0xc10b8f['query'][_0xaa30('0x36')]('nolimit')){_0x39f708[_0xaa30('0x1f')]=qs[_0xaa30('0x1f')](_0xc10b8f['query'][_0xaa30('0x1f')]);_0x39f708[_0xaa30('0x1c')]=qs[_0xaa30('0x1c')](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x1c')]);}_0x39f708[_0xaa30('0x37')]=qs['sort'](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x38')]);_0x39f708['where']=qs[_0xaa30('0x30')](_[_0xaa30('0x39')](_0xc10b8f[_0xaa30('0x2e')],_0x1f288c['filters']),_0x44aa9b);if(_0xc10b8f['query'][_0xaa30('0x3a')]){_0x39f708[_0xaa30('0x3b')]=_[_0xaa30('0x3c')](_0x39f708[_0xaa30('0x3b')],{'$or':_[_0xaa30('0x28')](_0x44aa9b,function(_0x291854){if(_0x291854['type']!=='VIRTUAL'){var _0x120c43={};_0x120c43[_0x291854[_0xaa30('0x25')]]={'$like':'%'+_0xc10b8f[_0xaa30('0x2e')]['filter']+'%'};return _0x120c43;}})});}_0x39f708=_[_0xaa30('0x3c')]({},_0x39f708,_0xc10b8f[_0xaa30('0x3d')]);var _0x8fb95e={'where':_0x39f708[_0xaa30('0x3b')]};return db['SquareReport'][_0xaa30('0x1e')](_0x8fb95e)[_0xaa30('0x23')](function(_0x2c5ddb){_0x43fb30[_0xaa30('0x1e')]=_0x2c5ddb;if(_0xc10b8f[_0xaa30('0x2e')]['includeAll']){_0x39f708[_0xaa30('0x3e')]=[{'all':!![]}];}return db[_0xaa30('0x29')][_0xaa30('0x3f')](_0x39f708);})[_0xaa30('0x23')](function(_0x13f08f){_0x43fb30[_0xaa30('0x40')]=_0x13f08f;return _0x43fb30;})[_0xaa30('0x23')](respondWithFilteredResult(_0x6ff09a,_0x39f708))[_0xaa30('0x41')](handleError(_0x6ff09a,null));};exports['show']=function(_0x59ef25,_0x18771d){var _0x4a170a={'raw':!![],'where':{'id':_0x59ef25['params']['id']}},_0x5208f8={};_0x5208f8[_0xaa30('0x33')]=_['keys'](db[_0xaa30('0x29')]['rawAttributes']);_0x5208f8[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x59ef25[_0xaa30('0x2e')]);_0x5208f8[_0xaa30('0x30')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],_0x5208f8[_0xaa30('0x2e')]);_0x4a170a[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0x59ef25['query'][_0xaa30('0x34')]));_0x4a170a[_0xaa30('0x31')]=_0x4a170a[_0xaa30('0x31')][_0xaa30('0x35')]?_0x4a170a[_0xaa30('0x31')]:_0x5208f8['model'];if(_0x59ef25['query'][_0xaa30('0x42')]){_0x4a170a['include']=[{'all':!![]}];}_0x4a170a=_[_0xaa30('0x3c')]({},_0x4a170a,_0x59ef25[_0xaa30('0x3d')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x4a170a)[_0xaa30('0x23')](handleEntityNotFound(_0x18771d,null))[_0xaa30('0x23')](respondWithResult(_0x18771d,null))[_0xaa30('0x41')](handleError(_0x18771d,null));};exports['create']=function(_0x3cf0bb,_0x6c9da6){return db[_0xaa30('0x29')]['create'](_0x3cf0bb[_0xaa30('0x44')],{})[_0xaa30('0x23')](respondWithResult(_0x6c9da6,0xc9))['catch'](handleError(_0x6c9da6,null));};exports[_0xaa30('0x22')]=function(_0x4a8fcc,_0x25d227){if(_0x4a8fcc['body']['id']){delete _0x4a8fcc['body']['id'];}return db[_0xaa30('0x29')]['find']({'where':{'id':_0x4a8fcc['params']['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x25d227,null))[_0xaa30('0x23')](saveUpdates(_0x4a8fcc[_0xaa30('0x44')],null))[_0xaa30('0x23')](respondWithResult(_0x25d227,null))[_0xaa30('0x41')](handleError(_0x25d227,null));};exports[_0xaa30('0x45')]=function(_0x5616cd,_0x17d75d){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x5616cd['params']['id']}})['then'](handleEntityNotFound(_0x17d75d,null))['then'](removeEntity(_0x17d75d,null))['catch'](handleError(_0x17d75d,null));};exports[_0xaa30('0x46')]=function(_0x1ba164,_0xdc32bc){return db[_0xaa30('0x29')][_0xaa30('0x46')]()[_0xaa30('0x23')](respondWithResult(_0xdc32bc,null))['catch'](handleError(_0xdc32bc,null));}; \ No newline at end of file +var _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0xad7ad,_0x42993b){var _0x88f87a=function(_0x6a32f0){while(--_0x6a32f0){_0xad7ad['push'](_0xad7ad['shift']());}};_0x88f87a(++_0x42993b);}(_0x9582,0x95));var _0x2958=function(_0x21c741,_0x140920){_0x21c741=_0x21c741-0x0;var _0x1313f5=_0x9582[_0x21c741];return _0x1313f5;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':!![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['SquareReport'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 81d788e..fab32f5 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 _0xd5f2=['leaveAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./squareReport.attributes','define','SquareReport','report_square','uid_pname'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd5f2,0xb7));var _0x2d5f=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xd5f2[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x2d5f('0x0'));var util=require(_0x2d5f('0x1'));var logger=require(_0x2d5f('0x2'))(_0x2d5f('0x3'));var moment=require(_0x2d5f('0x4'));var BPromise=require('bluebird');var rp=require(_0x2d5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d5f('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d5f('0x7'));module['exports']=function(_0x15dce2,_0x3880fc){return _0x15dce2[_0x2d5f('0x8')](_0x2d5f('0x9'),attributes,{'tableName':_0x2d5f('0xa'),'paranoid':![],'indexes':[{'name':_0x2d5f('0xb'),'fields':['uniqueid','project_name']},{'name':_0x2d5f('0xc'),'fields':[_0x2d5f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d01=['request-promise','path','./squareReport.attributes','exports','define','report_square','uniqueid','leaveAt','lodash','util','api','moment','bluebird'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x5d01,0xe5));var _0x15d0=function(_0x4f252e,_0x20cc01){_0x4f252e=_0x4f252e-0x0;var _0x264643=_0x5d01[_0x4f252e];return _0x264643;};'use strict';var _=require(_0x15d0('0x0'));var util=require(_0x15d0('0x1'));var logger=require('../../config/logger')(_0x15d0('0x2'));var moment=require(_0x15d0('0x3'));var BPromise=require(_0x15d0('0x4'));var rp=require(_0x15d0('0x5'));var fs=require('fs');var path=require(_0x15d0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x15d0('0x7'));module[_0x15d0('0x8')]=function(_0x53ceec,_0xd321de){return _0x53ceec[_0x15d0('0x9')]('SquareReport',attributes,{'tableName':_0x15d0('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x15d0('0xb'),'project_name']},{'name':'leaveAt','fields':[_0x15d0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ca987cd..6c35fb9 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 _0x7fbe=['stringify','error','code','message','result','catch','SquareReport','create','options','raw','CreateSquareReport','update','where','limit','info','UpdateSquareReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x299721,_0x2f27c4){_0x299721=_0x299721-0x0;var _0x50a594=_0x7fbe[_0x299721];return _0x50a594;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['CreateSquareReport']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')](_0x293a47['body'],{'raw':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x15f7a4){logger['info'](_0xe7fb('0x1c'),_0x293a47);logger[_0xe7fb('0x10')]('CreateSquareReport',_0x293a47,JSON[_0xe7fb('0x12')](_0x15f7a4));_0x1e77fd(_0x15f7a4);})[_0xe7fb('0x17')](function(_0x3ae8f1){logger['error'](_0xe7fb('0x1c'),_0x3ae8f1[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463['error'](0x1f4,_0x3ae8f1['message']));});});};exports['UpdateSquareReport']=function(_0x35e4db){var _0x53c43a=this;return new Promise(function(_0x49b219,_0x4026b1){return db[_0xe7fb('0x18')][_0xe7fb('0x1d')](_0x35e4db['body'],{'raw':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1e')]||null:null,'attributes':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db['options']['attributes']||null:null,'limit':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1f')]||null:null})['then'](function(_0xb1f2f4){logger[_0xe7fb('0x20')](_0xe7fb('0x21'),_0x35e4db);logger[_0xe7fb('0x10')](_0xe7fb('0x21'),_0x35e4db,JSON[_0xe7fb('0x12')](_0xb1f2f4));_0x49b219(_0xb1f2f4);})[_0xe7fb('0x17')](function(_0x3dd0be){logger['error'](_0xe7fb('0x21'),_0x3dd0be[_0xe7fb('0x15')],_0x35e4db);_0x4026b1(_0x53c43a[_0xe7fb('0x13')](0x1f4,_0x3dd0be['message']));});});}; \ No newline at end of file +var _0xa41a=['result','catch','CreateSquareReport','body','options','stringify','UpdateSquareReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2f7f8e,_0xb8a724){var _0x16ca0f=function(_0x292b9b){while(--_0x292b9b){_0x2f7f8e['push'](_0x2f7f8e['shift']());}};_0x16ca0f(++_0xb8a724);}(_0xa41a,0x6b));var _0xaa41=function(_0x61c8a4,_0x4494ef){_0x61c8a4=_0x61c8a4-0x0;var _0x272b53=_0xa41a[_0x61c8a4];return _0x272b53;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['SquareReport']['create'](_0xd20ddf[_0xaa41('0x18')],{'raw':_0xd20ddf[_0xaa41('0x19')]?_0xd20ddf[_0xaa41('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xaa41('0xd')](function(_0x1f692b){logger['info']('CreateSquareReport',_0xd20ddf);logger[_0xaa41('0x11')]('CreateSquareReport',_0xd20ddf,JSON[_0xaa41('0x1a')](_0x1f692b));_0x46e6d3(_0x1f692b);})[_0xaa41('0x16')](function(_0x3e2175){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x3e2175['message'],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x3e2175[_0xaa41('0x14')]));});});};exports[_0xaa41('0x1b')]=function(_0x21f596){var _0x274630=this;return new Promise(function(_0xa1f024,_0x5c3074){return db['SquareReport'][_0xaa41('0x1c')](_0x21f596['body'],{'raw':_0x21f596['options']?_0x21f596[_0xaa41('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21f596['options']?_0x21f596[_0xaa41('0x19')][_0xaa41('0x1d')]||null:null,'attributes':_0x21f596[_0xaa41('0x19')]?_0x21f596[_0xaa41('0x19')][_0xaa41('0x1e')]||null:null,'limit':_0x21f596[_0xaa41('0x19')]?_0x21f596['options'][_0xaa41('0x1f')]||null:null})[_0xaa41('0xd')](function(_0x63c18c){logger[_0xaa41('0xe')](_0xaa41('0x1b'),_0x21f596);logger[_0xaa41('0x11')](_0xaa41('0x1b'),_0x21f596,JSON[_0xaa41('0x1a')](_0x63c18c));_0xa1f024(_0x63c18c);})['catch'](function(_0x377add){logger['error']('UpdateSquareReport',_0x377add[_0xaa41('0x14')],_0x21f596);_0x5c3074(_0x274630[_0xaa41('0x13')](0x1f4,_0x377add['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index dabc315..ad05936 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 _0x2baf=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','exports','util','path'];(function(_0x581152,_0x5b383c){var _0x478434=function(_0x138374){while(--_0x138374){_0x581152['push'](_0x581152['shift']());}};_0x478434(++_0x5b383c);}(_0x2baf,0xbc));var _0xf2ba=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x2baf[_0x38ce4c];return _0x5d4544;};'use strict';var multer=require('multer');var util=require(_0xf2ba('0x0'));var path=require(_0xf2ba('0x1'));var timeout=require(_0xf2ba('0x2'));var express=require(_0xf2ba('0x3'));var router=express[_0xf2ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf2ba('0x5'));var interaction=require(_0xf2ba('0x6'));var config=require(_0xf2ba('0x7'));var controller=require(_0xf2ba('0x8'));router[_0xf2ba('0x9')]('/',auth[_0xf2ba('0xa')](),controller[_0xf2ba('0xb')]);router[_0xf2ba('0x9')](_0xf2ba('0xc'),auth[_0xf2ba('0xa')](),controller['describe']);router[_0xf2ba('0x9')](_0xf2ba('0xd'),auth[_0xf2ba('0xa')](),controller['show']);router[_0xf2ba('0xe')]('/',auth[_0xf2ba('0xa')](),controller[_0xf2ba('0xf')]);router['put'](_0xf2ba('0xd'),auth['isAuthenticated'](),controller[_0xf2ba('0x10')]);router[_0xf2ba('0x11')](_0xf2ba('0xd'),auth[_0xf2ba('0xa')](),controller['destroy']);module[_0xf2ba('0x12')]=router; \ No newline at end of file +var _0x8331=['show','post','create','put','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x463021,_0x7a413b){var _0x2ca6da=function(_0x5637a1){while(--_0x5637a1){_0x463021['push'](_0x463021['shift']());}};_0x2ca6da(++_0x7a413b);}(_0x8331,0x1f3));var _0x1833=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x8331[_0x33554b];return _0x256954;};'use strict';var multer=require(_0x1833('0x0'));var util=require('util');var path=require(_0x1833('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1833('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1833('0x3'));var interaction=require(_0x1833('0x4'));var config=require('../../config/environment');var controller=require(_0x1833('0x5'));router[_0x1833('0x6')]('/',auth[_0x1833('0x7')](),controller[_0x1833('0x8')]);router[_0x1833('0x6')](_0x1833('0x9'),auth[_0x1833('0x7')](),controller['describe']);router['get'](_0x1833('0xa'),auth[_0x1833('0x7')](),controller[_0x1833('0xb')]);router[_0x1833('0xc')]('/',auth['isAuthenticated'](),controller[_0x1833('0xd')]);router[_0x1833('0xe')](_0x1833('0xa'),auth[_0x1833('0x7')](),controller['update']);router[_0x1833('0xf')](_0x1833('0xa'),auth[_0x1833('0x7')](),controller[_0x1833('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7f7f37c..4e70f99 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 _0x2a28=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a28,0xf6));var _0x82a2=function(_0x17a9fd,_0x11d581){_0x17a9fd=_0x17a9fd-0x0;var _0x59ce89=_0x2a28[_0x17a9fd];return _0x59ce89;};'use strict';var Sequelize=require('sequelize');module[_0x82a2('0x0')]={'uniqueid':{'type':Sequelize[_0x82a2('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x82a2('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x82a2('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbbbc=['STRING','sequelize'];(function(_0x31af10,_0x4ffe8f){var _0x5cbb06=function(_0x698260){while(--_0x698260){_0x31af10['push'](_0x31af10['shift']());}};_0x5cbb06(++_0x4ffe8f);}(_0xbbbc,0x105));var _0xcbbb=function(_0x459017,_0x2e46b5){_0x459017=_0x459017-0x0;var _0x870ff7=_0xbbbc[_0x459017];return _0x870ff7;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xcbbb('0x1')]},'application':{'type':Sequelize[_0xcbbb('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xcbbb('0x1')]},'callerid':{'type':Sequelize[_0xcbbb('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index ab09a64..d102e7f 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 _0x27ac=['where','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','util','path','sox','lodash','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort'];(function(_0x18b176,_0x3a4ffb){var _0x4a0d26=function(_0x2e2b89){while(--_0x2e2b89){_0x18b176['push'](_0x18b176['shift']());}};_0x4a0d26(++_0x3a4ffb);}(_0x27ac,0x112));var _0xc27a=function(_0x2fa2d6,_0x5d7dc8){_0x2fa2d6=_0x2fa2d6-0x0;var _0x3eb8ab=_0x27ac[_0x2fa2d6];return _0x3eb8ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc27a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc27a('0x1'));var rp=require(_0xc27a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc27a('0x3'));var path=require(_0xc27a('0x4'));var sox=require(_0xc27a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc27a('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc27a('0x7'));var querystring=require(_0xc27a('0x8'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc27a('0x9'));var qs=require(_0xc27a('0xa'));var as=require(_0xc27a('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc27a('0xc'))(_0xc27a('0xd'));var utils=require(_0xc27a('0xe'));var config=require(_0xc27a('0xf'));var licenseUtil=require(_0xc27a('0x10'));var db=require(_0xc27a('0x11'))['db'];function respondWithStatusCode(_0x7e1f5d,_0x437846){_0x437846=_0x437846||0xcc;return function(_0x37bb57){if(_0x37bb57){return _0x7e1f5d[_0xc27a('0x12')](_0x437846);}return _0x7e1f5d[_0xc27a('0x13')](_0x437846)['end']();};}function respondWithResult(_0x52515c,_0x1dcc67){_0x1dcc67=_0x1dcc67||0xc8;return function(_0x46c95f){if(_0x46c95f){return _0x52515c[_0xc27a('0x13')](_0x1dcc67)[_0xc27a('0x14')](_0x46c95f);}};}function respondWithFilteredResult(_0x338d56,_0x4c4aae){return function(_0x342ee6){if(_0x342ee6){var _0x464e84=typeof _0x4c4aae['offset']===_0xc27a('0x15')&&typeof _0x4c4aae['limit']===_0xc27a('0x15');var _0x189ae5=_0x342ee6[_0xc27a('0x16')];var _0x22c5dd=_0x464e84?0x0:_0x4c4aae[_0xc27a('0x17')];var _0x215de9=_0x464e84?_0x342ee6['count']:_0x4c4aae['offset']+_0x4c4aae[_0xc27a('0x18')];var _0x4f2a88;if(_0x215de9>=_0x189ae5){_0x215de9=_0x189ae5;_0x4f2a88=0xc8;}else{_0x4f2a88=0xce;}_0x338d56[_0xc27a('0x13')](_0x4f2a88);return _0x338d56['set'](_0xc27a('0x19'),_0x22c5dd+'-'+_0x215de9+'/'+_0x189ae5)['json'](_0x342ee6);}return null;};}function patchUpdates(_0x381787){return function(_0x435672){try{jsonpatch[_0xc27a('0x1a')](_0x435672,_0x381787,!![]);}catch(_0x305880){return BPromise[_0xc27a('0x1b')](_0x305880);}return _0x435672[_0xc27a('0x1c')]();};}function saveUpdates(_0x1db294,_0x452510){return function(_0x586887){if(_0x586887){return _0x586887[_0xc27a('0x1d')](_0x1db294)[_0xc27a('0x1e')](function(_0x2c2e60){return _0x2c2e60;});}return null;};}function removeEntity(_0x599897,_0x38a4f8){return function(_0x5aee02){if(_0x5aee02){return _0x5aee02[_0xc27a('0x1f')]()[_0xc27a('0x1e')](function(){_0x599897['status'](0xcc)[_0xc27a('0x20')]();});}};}function handleEntityNotFound(_0x2d8989,_0x187546){return function(_0x5d01e4){if(!_0x5d01e4){_0x2d8989['sendStatus'](0x194);}return _0x5d01e4;};}function handleError(_0x28a2b4,_0x303d44){_0x303d44=_0x303d44||0x1f4;return function(_0x41c2f3){logger['error'](_0x41c2f3[_0xc27a('0x21')]);if(_0x41c2f3[_0xc27a('0x22')]){delete _0x41c2f3[_0xc27a('0x22')];}_0x28a2b4[_0xc27a('0x13')](_0x303d44)[_0xc27a('0x23')](_0x41c2f3);};}exports['index']=function(_0x661e96,_0x7d7a2c){var _0x5935e5={},_0x3f65f5={},_0x4cdf94={'count':0x0,'rows':[]};var _0x27ed3a=_['map'](db[_0xc27a('0x24')][_0xc27a('0x25')],function(_0x5373f1){return{'name':_0x5373f1[_0xc27a('0x26')],'type':_0x5373f1[_0xc27a('0x27')]['key']};});_0x3f65f5[_0xc27a('0x28')]=_[_0xc27a('0x29')](_0x27ed3a,_0xc27a('0x22'));_0x3f65f5[_0xc27a('0x2a')]=_[_0xc27a('0x2b')](_0x661e96[_0xc27a('0x2a')]);_0x3f65f5[_0xc27a('0x2c')]=_[_0xc27a('0x2d')](_0x3f65f5['model'],_0x3f65f5[_0xc27a('0x2a')]);_0x5935e5[_0xc27a('0x2e')]=_[_0xc27a('0x2d')](_0x3f65f5[_0xc27a('0x28')],qs[_0xc27a('0x2f')](_0x661e96['query'][_0xc27a('0x2f')]));_0x5935e5['attributes']=_0x5935e5[_0xc27a('0x2e')][_0xc27a('0x30')]?_0x5935e5[_0xc27a('0x2e')]:_0x3f65f5['model'];if(!_0x661e96[_0xc27a('0x2a')]['hasOwnProperty']('nolimit')){_0x5935e5[_0xc27a('0x18')]=qs['limit'](_0x661e96['query']['limit']);_0x5935e5['offset']=qs[_0xc27a('0x17')](_0x661e96[_0xc27a('0x2a')][_0xc27a('0x17')]);}_0x5935e5[_0xc27a('0x31')]=qs[_0xc27a('0x32')](_0x661e96[_0xc27a('0x2a')]['sort']);_0x5935e5[_0xc27a('0x33')]=qs[_0xc27a('0x2c')](_['pick'](_0x661e96[_0xc27a('0x2a')],_0x3f65f5[_0xc27a('0x2c')]),_0x27ed3a);if(_0x661e96[_0xc27a('0x2a')][_0xc27a('0x34')]){_0x5935e5[_0xc27a('0x33')]=_['merge'](_0x5935e5['where'],{'$or':_[_0xc27a('0x29')](_0x27ed3a,function(_0xed7630){if(_0xed7630[_0xc27a('0x27')]!==_0xc27a('0x35')){var _0x2c2e9d={};_0x2c2e9d[_0xed7630['name']]={'$like':'%'+_0x661e96['query']['filter']+'%'};return _0x2c2e9d;}})});}_0x5935e5=_[_0xc27a('0x36')]({},_0x5935e5,_0x661e96[_0xc27a('0x37')]);var _0x53df53={'where':_0x5935e5[_0xc27a('0x33')]};return db[_0xc27a('0x24')][_0xc27a('0x16')](_0x53df53)[_0xc27a('0x1e')](function(_0x2cf754){_0x4cdf94['count']=_0x2cf754;if(_0x661e96[_0xc27a('0x2a')][_0xc27a('0x38')]){_0x5935e5[_0xc27a('0x39')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x5935e5);})[_0xc27a('0x1e')](function(_0x24f6d1){_0x4cdf94['rows']=_0x24f6d1;return _0x4cdf94;})[_0xc27a('0x1e')](respondWithFilteredResult(_0x7d7a2c,_0x5935e5))[_0xc27a('0x3a')](handleError(_0x7d7a2c,null));};exports[_0xc27a('0x3b')]=function(_0x3a11e1,_0x8fe041){var _0x585a98={'raw':!![],'where':{'id':_0x3a11e1[_0xc27a('0x3c')]['id']}},_0x40af5b={};_0x40af5b[_0xc27a('0x28')]=_[_0xc27a('0x2b')](db[_0xc27a('0x24')][_0xc27a('0x25')]);_0x40af5b[_0xc27a('0x2a')]=_['keys'](_0x3a11e1[_0xc27a('0x2a')]);_0x40af5b[_0xc27a('0x2c')]=_[_0xc27a('0x2d')](_0x40af5b[_0xc27a('0x28')],_0x40af5b[_0xc27a('0x2a')]);_0x585a98[_0xc27a('0x2e')]=_[_0xc27a('0x2d')](_0x40af5b[_0xc27a('0x28')],qs[_0xc27a('0x2f')](_0x3a11e1[_0xc27a('0x2a')]['fields']));_0x585a98['attributes']=_0x585a98[_0xc27a('0x2e')][_0xc27a('0x30')]?_0x585a98[_0xc27a('0x2e')]:_0x40af5b[_0xc27a('0x28')];if(_0x3a11e1[_0xc27a('0x2a')]['includeAll']){_0x585a98['include']=[{'all':!![]}];}_0x585a98=_[_0xc27a('0x36')]({},_0x585a98,_0x3a11e1['options']);return db[_0xc27a('0x24')][_0xc27a('0x3d')](_0x585a98)[_0xc27a('0x1e')](handleEntityNotFound(_0x8fe041,null))[_0xc27a('0x1e')](respondWithResult(_0x8fe041,null))['catch'](handleError(_0x8fe041,null));};exports[_0xc27a('0x3e')]=function(_0x1ff71f,_0x395c37){return db[_0xc27a('0x24')]['create'](_0x1ff71f[_0xc27a('0x3f')],{})[_0xc27a('0x1e')](respondWithResult(_0x395c37,0xc9))[_0xc27a('0x3a')](handleError(_0x395c37,null));};exports[_0xc27a('0x1d')]=function(_0x56bb26,_0x61d19f){if(_0x56bb26[_0xc27a('0x3f')]['id']){delete _0x56bb26[_0xc27a('0x3f')]['id'];}return db[_0xc27a('0x24')][_0xc27a('0x3d')]({'where':{'id':_0x56bb26['params']['id']}})[_0xc27a('0x1e')](handleEntityNotFound(_0x61d19f,null))[_0xc27a('0x1e')](saveUpdates(_0x56bb26[_0xc27a('0x3f')],null))['then'](respondWithResult(_0x61d19f,null))['catch'](handleError(_0x61d19f,null));};exports[_0xc27a('0x1f')]=function(_0x3bcf65,_0x4b8e0b){return db[_0xc27a('0x24')]['find']({'where':{'id':_0x3bcf65[_0xc27a('0x3c')]['id']}})[_0xc27a('0x1e')](handleEntityNotFound(_0x4b8e0b,null))[_0xc27a('0x1e')](removeEntity(_0x4b8e0b,null))[_0xc27a('0x3a')](handleError(_0x4b8e0b,null));};exports[_0xc27a('0x40')]=function(_0x473821,_0x42c8e7){return db[_0xc27a('0x24')][_0xc27a('0x40')]()[_0xc27a('0x1e')](respondWithResult(_0x42c8e7,null))[_0xc27a('0x3a')](handleError(_0x42c8e7,null));}; \ No newline at end of file +var _0x8c6f=['end','json','undefined','limit','count','offset','set','Content-Range','save','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status'];(function(_0x192124,_0x395236){var _0x11ef29=function(_0x2ad42a){while(--_0x2ad42a){_0x192124['push'](_0x192124['shift']());}};_0x11ef29(++_0x395236);}(_0x8c6f,0x1b8));var _0xf8c6=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x8c6f[_0x344a3f];return _0x264712;};'use strict';var emlformat=require(_0xf8c6('0x0'));var rimraf=require(_0xf8c6('0x1'));var zipdir=require(_0xf8c6('0x2'));var jsonpatch=require(_0xf8c6('0x3'));var rp=require(_0xf8c6('0x4'));var moment=require(_0xf8c6('0x5'));var BPromise=require(_0xf8c6('0x6'));var Mustache=require(_0xf8c6('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf8c6('0x8'));var csv=require(_0xf8c6('0x9'));var ejs=require(_0xf8c6('0xa'));var fs=require('fs');var fs_extra=require(_0xf8c6('0xb'));var _=require(_0xf8c6('0xc'));var squel=require('squel');var crypto=require(_0xf8c6('0xd'));var jsforce=require(_0xf8c6('0xe'));var deskjs=require(_0xf8c6('0xf'));var toCsv=require(_0xf8c6('0x9'));var querystring=require(_0xf8c6('0x10'));var Papa=require(_0xf8c6('0x11'));var Redis=require(_0xf8c6('0x12'));var authService=require(_0xf8c6('0x13'));var qs=require(_0xf8c6('0x14'));var as=require(_0xf8c6('0x15'));var hardwareService=require(_0xf8c6('0x16'));var logger=require(_0xf8c6('0x17'))(_0xf8c6('0x18'));var utils=require('../../config/utils');var config=require(_0xf8c6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fa496,_0x5846df){_0x5846df=_0x5846df||0xcc;return function(_0x36367c){if(_0x36367c){return _0x2fa496[_0xf8c6('0x1a')](_0x5846df);}return _0x2fa496[_0xf8c6('0x1b')](_0x5846df)[_0xf8c6('0x1c')]();};}function respondWithResult(_0x477cba,_0x48f0f6){_0x48f0f6=_0x48f0f6||0xc8;return function(_0x10ea15){if(_0x10ea15){return _0x477cba[_0xf8c6('0x1b')](_0x48f0f6)[_0xf8c6('0x1d')](_0x10ea15);}};}function respondWithFilteredResult(_0xe623a3,_0x12ed2b){return function(_0xef1401){if(_0xef1401){var _0x17e8a=typeof _0x12ed2b['offset']===_0xf8c6('0x1e')&&typeof _0x12ed2b[_0xf8c6('0x1f')]===_0xf8c6('0x1e');var _0x5679bd=_0xef1401[_0xf8c6('0x20')];var _0xda1d56=_0x17e8a?0x0:_0x12ed2b[_0xf8c6('0x21')];var _0x50421b=_0x17e8a?_0xef1401[_0xf8c6('0x20')]:_0x12ed2b['offset']+_0x12ed2b[_0xf8c6('0x1f')];var _0x2aa798;if(_0x50421b>=_0x5679bd){_0x50421b=_0x5679bd;_0x2aa798=0xc8;}else{_0x2aa798=0xce;}_0xe623a3[_0xf8c6('0x1b')](_0x2aa798);return _0xe623a3[_0xf8c6('0x22')](_0xf8c6('0x23'),_0xda1d56+'-'+_0x50421b+'/'+_0x5679bd)[_0xf8c6('0x1d')](_0xef1401);}return null;};}function patchUpdates(_0x51c5d7){return function(_0x3d2fd9){try{jsonpatch['apply'](_0x3d2fd9,_0x51c5d7,!![]);}catch(_0x2df53b){return BPromise['reject'](_0x2df53b);}return _0x3d2fd9[_0xf8c6('0x24')]();};}function saveUpdates(_0x4ae7d,_0x34785c){return function(_0x209ec5){if(_0x209ec5){return _0x209ec5['update'](_0x4ae7d)[_0xf8c6('0x25')](function(_0x4e4ee4){return _0x4e4ee4;});}return null;};}function removeEntity(_0xc8b98d,_0x29698c){return function(_0x2786d9){if(_0x2786d9){return _0x2786d9[_0xf8c6('0x26')]()[_0xf8c6('0x25')](function(){_0xc8b98d['status'](0xcc)[_0xf8c6('0x1c')]();});}};}function handleEntityNotFound(_0x16966e,_0x22f0d1){return function(_0x430c45){if(!_0x430c45){_0x16966e[_0xf8c6('0x1a')](0x194);}return _0x430c45;};}function handleError(_0x1d57da,_0x32ead7){_0x32ead7=_0x32ead7||0x1f4;return function(_0x539540){logger[_0xf8c6('0x27')](_0x539540[_0xf8c6('0x28')]);if(_0x539540[_0xf8c6('0x29')]){delete _0x539540[_0xf8c6('0x29')];}_0x1d57da[_0xf8c6('0x1b')](_0x32ead7)[_0xf8c6('0x2a')](_0x539540);};}exports[_0xf8c6('0x2b')]=function(_0x2f4a63,_0x179299){var _0x596d33={},_0x571068={},_0x4f75cf={'count':0x0,'rows':[]};var _0x4f72ed=_['map'](db[_0xf8c6('0x2c')][_0xf8c6('0x2d')],function(_0x5baebf){return{'name':_0x5baebf[_0xf8c6('0x2e')],'type':_0x5baebf[_0xf8c6('0x2f')][_0xf8c6('0x30')]};});_0x571068[_0xf8c6('0x31')]=_[_0xf8c6('0x32')](_0x4f72ed,_0xf8c6('0x29'));_0x571068[_0xf8c6('0x33')]=_[_0xf8c6('0x34')](_0x2f4a63[_0xf8c6('0x33')]);_0x571068[_0xf8c6('0x35')]=_[_0xf8c6('0x36')](_0x571068[_0xf8c6('0x31')],_0x571068['query']);_0x596d33['attributes']=_[_0xf8c6('0x36')](_0x571068['model'],qs[_0xf8c6('0x37')](_0x2f4a63[_0xf8c6('0x33')][_0xf8c6('0x37')]));_0x596d33[_0xf8c6('0x38')]=_0x596d33[_0xf8c6('0x38')][_0xf8c6('0x39')]?_0x596d33[_0xf8c6('0x38')]:_0x571068[_0xf8c6('0x31')];if(!_0x2f4a63[_0xf8c6('0x33')][_0xf8c6('0x3a')](_0xf8c6('0x3b'))){_0x596d33[_0xf8c6('0x1f')]=qs[_0xf8c6('0x1f')](_0x2f4a63[_0xf8c6('0x33')]['limit']);_0x596d33['offset']=qs[_0xf8c6('0x21')](_0x2f4a63['query'][_0xf8c6('0x21')]);}_0x596d33['order']=qs['sort'](_0x2f4a63['query'][_0xf8c6('0x3c')]);_0x596d33[_0xf8c6('0x3d')]=qs[_0xf8c6('0x35')](_[_0xf8c6('0x3e')](_0x2f4a63['query'],_0x571068[_0xf8c6('0x35')]),_0x4f72ed);if(_0x2f4a63[_0xf8c6('0x33')][_0xf8c6('0x3f')]){_0x596d33['where']=_[_0xf8c6('0x40')](_0x596d33[_0xf8c6('0x3d')],{'$or':_[_0xf8c6('0x32')](_0x4f72ed,function(_0x4b49b9){if(_0x4b49b9[_0xf8c6('0x2f')]!==_0xf8c6('0x41')){var _0x58c3e9={};_0x58c3e9[_0x4b49b9[_0xf8c6('0x29')]]={'$like':'%'+_0x2f4a63['query'][_0xf8c6('0x3f')]+'%'};return _0x58c3e9;}})});}_0x596d33=_['merge']({},_0x596d33,_0x2f4a63['options']);var _0x4d1045={'where':_0x596d33[_0xf8c6('0x3d')]};return db[_0xf8c6('0x2c')][_0xf8c6('0x20')](_0x4d1045)[_0xf8c6('0x25')](function(_0x43d07b){_0x4f75cf['count']=_0x43d07b;if(_0x2f4a63[_0xf8c6('0x33')][_0xf8c6('0x42')]){_0x596d33[_0xf8c6('0x43')]=[{'all':!![]}];}return db[_0xf8c6('0x2c')][_0xf8c6('0x44')](_0x596d33);})[_0xf8c6('0x25')](function(_0xb6598a){_0x4f75cf[_0xf8c6('0x45')]=_0xb6598a;return _0x4f75cf;})['then'](respondWithFilteredResult(_0x179299,_0x596d33))[_0xf8c6('0x46')](handleError(_0x179299,null));};exports[_0xf8c6('0x47')]=function(_0x1d1936,_0x36dd55){var _0x2ac4b4={'raw':!![],'where':{'id':_0x1d1936[_0xf8c6('0x48')]['id']}},_0x188474={};_0x188474['model']=_[_0xf8c6('0x34')](db[_0xf8c6('0x2c')][_0xf8c6('0x2d')]);_0x188474['query']=_[_0xf8c6('0x34')](_0x1d1936[_0xf8c6('0x33')]);_0x188474[_0xf8c6('0x35')]=_[_0xf8c6('0x36')](_0x188474[_0xf8c6('0x31')],_0x188474[_0xf8c6('0x33')]);_0x2ac4b4[_0xf8c6('0x38')]=_[_0xf8c6('0x36')](_0x188474[_0xf8c6('0x31')],qs[_0xf8c6('0x37')](_0x1d1936[_0xf8c6('0x33')][_0xf8c6('0x37')]));_0x2ac4b4['attributes']=_0x2ac4b4[_0xf8c6('0x38')][_0xf8c6('0x39')]?_0x2ac4b4['attributes']:_0x188474[_0xf8c6('0x31')];if(_0x1d1936['query'][_0xf8c6('0x42')]){_0x2ac4b4['include']=[{'all':!![]}];}_0x2ac4b4=_['merge']({},_0x2ac4b4,_0x1d1936[_0xf8c6('0x49')]);return db[_0xf8c6('0x2c')][_0xf8c6('0x4a')](_0x2ac4b4)[_0xf8c6('0x25')](handleEntityNotFound(_0x36dd55,null))[_0xf8c6('0x25')](respondWithResult(_0x36dd55,null))[_0xf8c6('0x46')](handleError(_0x36dd55,null));};exports['create']=function(_0x3e873e,_0x54b124){return db[_0xf8c6('0x2c')]['create'](_0x3e873e[_0xf8c6('0x4b')],{})[_0xf8c6('0x25')](respondWithResult(_0x54b124,0xc9))[_0xf8c6('0x46')](handleError(_0x54b124,null));};exports[_0xf8c6('0x4c')]=function(_0x40e3b1,_0x4f155f){if(_0x40e3b1[_0xf8c6('0x4b')]['id']){delete _0x40e3b1[_0xf8c6('0x4b')]['id'];}return db[_0xf8c6('0x2c')]['find']({'where':{'id':_0x40e3b1[_0xf8c6('0x48')]['id']}})[_0xf8c6('0x25')](handleEntityNotFound(_0x4f155f,null))[_0xf8c6('0x25')](saveUpdates(_0x40e3b1[_0xf8c6('0x4b')],null))[_0xf8c6('0x25')](respondWithResult(_0x4f155f,null))['catch'](handleError(_0x4f155f,null));};exports[_0xf8c6('0x26')]=function(_0x276f79,_0x189bc2){return db[_0xf8c6('0x2c')]['find']({'where':{'id':_0x276f79[_0xf8c6('0x48')]['id']}})[_0xf8c6('0x25')](handleEntityNotFound(_0x189bc2,null))[_0xf8c6('0x25')](removeEntity(_0x189bc2,null))[_0xf8c6('0x46')](handleError(_0x189bc2,null));};exports['describe']=function(_0x54aa42,_0x5acbd8){return db[_0xf8c6('0x2c')][_0xf8c6('0x4d')]()[_0xf8c6('0x25')](respondWithResult(_0x5acbd8,null))['catch'](handleError(_0x5acbd8,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b2579c5..992cc26 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 _0xd73f=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x32c3bc,_0x255ccc){var _0xa0d288=function(_0xc13ee7){while(--_0xc13ee7){_0x32c3bc['push'](_0x32c3bc['shift']());}};_0xa0d288(++_0x255ccc);}(_0xd73f,0x199));var _0xfd73=function(_0x154940,_0x1b13bb){_0x154940=_0x154940-0x0;var _0x3741af=_0xd73f[_0x154940];return _0x3741af;};'use strict';var _=require(_0xfd73('0x0'));var util=require(_0xfd73('0x1'));var logger=require(_0xfd73('0x2'))(_0xfd73('0x3'));var moment=require(_0xfd73('0x4'));var BPromise=require(_0xfd73('0x5'));var rp=require(_0xfd73('0x6'));var fs=require('fs');var path=require(_0xfd73('0x7'));var rimraf=require(_0xfd73('0x8'));var config=require(_0xfd73('0x9'));var attributes=require(_0xfd73('0xa'));module[_0xfd73('0xb')]=function(_0x4c26e0,_0x227079){return _0x4c26e0[_0xfd73('0xc')](_0xfd73('0xd'),attributes,{'tableName':_0xfd73('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc080=['lodash','util','moment','bluebird','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x1f98c3,_0x112ca6){var _0x4f0552=function(_0x19543f){while(--_0x19543f){_0x1f98c3['push'](_0x1f98c3['shift']());}};_0x4f0552(++_0x112ca6);}(_0xc080,0x16b));var _0x0c08=function(_0x4efe50,_0x566786){_0x4efe50=_0x4efe50-0x0;var _0x11cd3a=_0xc080[_0x4efe50];return _0x11cd3a;};'use strict';var _=require(_0x0c08('0x0'));var util=require(_0x0c08('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c08('0x2'));var BPromise=require(_0x0c08('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0c08('0x4'));var config=require(_0x0c08('0x5'));var attributes=require(_0x0c08('0x6'));module[_0x0c08('0x7')]=function(_0x4fed9b,_0x5d52a0){return _0x4fed9b[_0x0c08('0x8')](_0x0c08('0x9'),attributes,{'tableName':_0x0c08('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 12796b9..3ea8243 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 _0xdf05=['../../config/logger','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','util','moment','bluebird','ioredis'];(function(_0x5a9853,_0x1e4923){var _0x2ee1eb=function(_0x501fbc){while(--_0x501fbc){_0x5a9853['push'](_0x5a9853['shift']());}};_0x2ee1eb(++_0x1e4923);}(_0xdf05,0x1be));var _0x5df0=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0xdf05[_0x265003];return _0x33c743;};'use strict';var _=require('lodash');var util=require(_0x5df0('0x0'));var moment=require(_0x5df0('0x1'));var BPromise=require(_0x5df0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5df0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5df0('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5df0('0x5'));var client=jayson[_0x5df0('0x6')][_0x5df0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x195d2b,_0x290dc5,_0x514969){return new BPromise(function(_0x160f21,_0x582f40){return client[_0x5df0('0x8')](_0x195d2b,_0x514969)[_0x5df0('0x9')](function(_0x5c4c15){logger[_0x5df0('0xa')](_0x5df0('0xb'),_0x290dc5,'request\x20sent');logger[_0x5df0('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x290dc5,'request\x20sent',JSON[_0x5df0('0xd')](_0x5c4c15));if(_0x5c4c15['error']){if(_0x5c4c15[_0x5df0('0xe')][_0x5df0('0xf')]===0x1f4){logger['error'](_0x5df0('0xb'),_0x290dc5,_0x5c4c15['error']['message']);return _0x582f40(_0x5c4c15[_0x5df0('0xe')][_0x5df0('0x10')]);}logger['error'](_0x5df0('0xb'),_0x290dc5,_0x5c4c15[_0x5df0('0xe')]['message']);return _0x160f21(_0x5c4c15['error']['message']);}else{logger[_0x5df0('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x290dc5,_0x5df0('0x11'));_0x160f21(_0x5c4c15[_0x5df0('0x12')]['message']);}})[_0x5df0('0x13')](function(_0xc6841){logger[_0x5df0('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x290dc5,_0xc6841);_0x582f40(_0xc6841);});});}exports[_0x5df0('0x14')]=function(_0x17522c){var _0x5ac404=this;return new Promise(function(_0x3574ce,_0x13b1fd){return db[_0x5df0('0x15')][_0x5df0('0x16')](_0x17522c['body'],{'raw':_0x17522c[_0x5df0('0x17')]?_0x17522c['options'][_0x5df0('0x18')]===undefined?!![]:![]:!![]})[_0x5df0('0x9')](function(_0x5488ed){logger[_0x5df0('0xa')](_0x5df0('0x14'),_0x17522c);logger[_0x5df0('0xc')](_0x5df0('0x14'),_0x17522c,JSON['stringify'](_0x5488ed));_0x3574ce(_0x5488ed);})[_0x5df0('0x13')](function(_0x1c8bb2){logger['error'](_0x5df0('0x14'),_0x1c8bb2[_0x5df0('0x10')],_0x17522c);_0x13b1fd(_0x5ac404[_0x5df0('0xe')](0x1f4,_0x1c8bb2[_0x5df0('0x10')]));});});}; \ No newline at end of file +var _0xefc1=['jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1cce7a,_0x926da){var _0x4bcd59=function(_0x303577){while(--_0x303577){_0x1cce7a['push'](_0x1cce7a['shift']());}};_0x4bcd59(++_0x926da);}(_0xefc1,0x129));var _0x1efc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xefc1[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x1efc('0x0'));var util=require(_0x1efc('0x1'));var moment=require(_0x1efc('0x2'));var BPromise=require(_0x1efc('0x3'));var rs=require(_0x1efc('0x4'));var fs=require('fs');var Redis=require(_0x1efc('0x5'));var db=require(_0x1efc('0x6'))['db'];var utils=require(_0x1efc('0x7'));var logger=require(_0x1efc('0x8'))(_0x1efc('0x9'));var config=require(_0x1efc('0xa'));var jayson=require(_0x1efc('0xb'));var client=jayson['client'][_0x1efc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18bae5,_0x372ba2,_0x3e1fe5){return new BPromise(function(_0x3e562a,_0x47835b){return client[_0x1efc('0xd')](_0x18bae5,_0x3e1fe5)[_0x1efc('0xe')](function(_0x107977){logger[_0x1efc('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x372ba2,_0x1efc('0x10'));logger[_0x1efc('0x11')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x372ba2,_0x1efc('0x10'),JSON[_0x1efc('0x12')](_0x107977));if(_0x107977[_0x1efc('0x13')]){if(_0x107977[_0x1efc('0x13')][_0x1efc('0x14')]===0x1f4){logger[_0x1efc('0x13')](_0x1efc('0x15'),_0x372ba2,_0x107977[_0x1efc('0x13')][_0x1efc('0x16')]);return _0x47835b(_0x107977[_0x1efc('0x13')][_0x1efc('0x16')]);}logger[_0x1efc('0x13')](_0x1efc('0x15'),_0x372ba2,_0x107977[_0x1efc('0x13')][_0x1efc('0x16')]);return _0x3e562a(_0x107977['error'][_0x1efc('0x16')]);}else{logger[_0x1efc('0xf')](_0x1efc('0x15'),_0x372ba2,_0x1efc('0x10'));_0x3e562a(_0x107977['result'][_0x1efc('0x16')]);}})[_0x1efc('0x17')](function(_0x2a8497){logger[_0x1efc('0x13')](_0x1efc('0x15'),_0x372ba2,_0x2a8497);_0x47835b(_0x2a8497);});});}exports[_0x1efc('0x18')]=function(_0x2e8913){var _0x1ad86b=this;return new Promise(function(_0x158b94,_0x282872){return db['SquareDetailsReport'][_0x1efc('0x19')](_0x2e8913[_0x1efc('0x1a')],{'raw':_0x2e8913['options']?_0x2e8913[_0x1efc('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2b1305){logger[_0x1efc('0xf')](_0x1efc('0x18'),_0x2e8913);logger[_0x1efc('0x11')](_0x1efc('0x18'),_0x2e8913,JSON[_0x1efc('0x12')](_0x2b1305));_0x158b94(_0x2b1305);})[_0x1efc('0x17')](function(_0x27798e){logger[_0x1efc('0x13')](_0x1efc('0x18'),_0x27798e['message'],_0x2e8913);_0x282872(_0x1ad86b[_0x1efc('0x13')](0x1f4,_0x27798e['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 2994c6b..d87eb6f 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 _0xc9a3=['get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router','./system.controller'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xc9a3,0x155));var _0x3c9a=function(_0x5d386d,_0x4b99f4){_0x5d386d=_0x5d386d-0x0;var _0x5891b5=_0xc9a3[_0x5d386d];return _0x5891b5;};'use strict';var express=require(_0x3c9a('0x0'));var router=express[_0x3c9a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3c9a('0x2'));router[_0x3c9a('0x3')]('/',auth[_0x3c9a('0x4')](),controller['index']);router[_0x3c9a('0x3')](_0x3c9a('0x5'),auth[_0x3c9a('0x4')](),controller[_0x3c9a('0x6')]);module[_0x3c9a('0x7')]=router; \ No newline at end of file +var _0xbb16=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','exports','express'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xbb16,0x177));var _0x6bb1=function(_0x162f66,_0x47d3e4){_0x162f66=_0x162f66-0x0;var _0x1dfeb8=_0xbb16[_0x162f66];return _0x1dfeb8;};'use strict';var express=require(_0x6bb1('0x0'));var router=express[_0x6bb1('0x1')]();var auth=require(_0x6bb1('0x2'));var controller=require(_0x6bb1('0x3'));router[_0x6bb1('0x4')]('/',auth[_0x6bb1('0x5')](),controller[_0x6bb1('0x6')]);router['get']('/process/:pid/kill',auth[_0x6bb1('0x5')](),controller['killProcess']);module[_0x6bb1('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8955cf0..0a94113 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 _0x9147=['format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','inspect','status','getAllData','catch','json','killProcess','components/import/cm'];(function(_0x15f449,_0x2f1388){var _0x517ab6=function(_0x1b6b27){while(--_0x1b6b27){_0x15f449['push'](_0x15f449['shift']());}};_0x517ab6(++_0x2f1388);}(_0x9147,0x81));var _0x7914=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9147[_0x2dafbe];return _0x58a45a;};'use strict';var info=require(_0x7914('0x0'));var exec=require(_0x7914('0x1'))[_0x7914('0x2')];var logger=require(_0x7914('0x3'))(_0x7914('0x4'));var util=require(_0x7914('0x5'));var BPromise=require(_0x7914('0x6'));var _=require('lodash');function handleError(_0x21cae6,_0x1de2bc,_0x1f8716){_0x1de2bc=_0x1de2bc||0x1f4;return function(_0x280cdb){logger[_0x7914('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x1f8716,_0x1de2bc,util[_0x7914('0x8')](_0x280cdb,{'showHidden':![],'depth':null}));delete _0x280cdb['name'];_0x21cae6[_0x7914('0x9')](_0x1de2bc)['send'](_0x280cdb);};}exports['index']=function(_0xa22f08,_0x8ce32){return info[_0x7914('0xa')]()['then'](function(_0x104e12){return _0x8ce32[_0x7914('0x9')](0xc8)['json'](_0x104e12);})[_0x7914('0xb')](function(_0x48d5c9){return _0x8ce32[_0x7914('0x9')](0x1f4)[_0x7914('0xc')](_0x48d5c9);});};exports[_0x7914('0xd')]=function(_0x417299,_0x502d5e){var _0x58a902=[_0x7914('0xe')];return new BPromise(function(_0x2fc465,_0x555924){return exec(util[_0x7914('0xf')](_0x7914('0x10'),_0x417299[_0x7914('0x11')][_0x7914('0x12')]),function(_0x42a5a0,_0xefbdbb,_0x43c791){if(_0x42a5a0){return _0x555924(_0x42a5a0);}return _0x2fc465(_0xefbdbb);});})['then'](function(_0x289740){var _0x26561a=![];var _0x590e1e=_0x289740[_0x7914('0x13')](/\n/);for(var _0x228e33=0x0,_0xb62f5f=_0x58a902[_0x7914('0x14')];_0x228e33<_0xb62f5f,_0x26561a===![];_0x228e33+=0x1){if(_0x289740[_0x7914('0x15')](_0x58a902[_0x228e33])>=0x0){_0x26561a=!![];}}if(!_0x26561a){throw new Error(util[_0x7914('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x417299[_0x7914('0x11')][_0x7914('0x12')]));}process[_0x7914('0x16')](_0x417299[_0x7914('0x11')][_0x7914('0x12')],_0x7914('0x17'));return _0x502d5e['status'](0xc8)[_0x7914('0xc')]({'message':util[_0x7914('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x417299[_0x7914('0x11')][_0x7914('0x12')])});})[_0x7914('0xb')](handleError(_0x502d5e,null,_0x7914('0xd')));}; \ No newline at end of file +var _0xf51f=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','catch','systeminformation','child_process','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','then','status','json','killProcess','components/import/cm','format'];(function(_0x1a7244,_0x3d99d9){var _0x5c4e9f=function(_0xe168b8){while(--_0xe168b8){_0x1a7244['push'](_0x1a7244['shift']());}};_0x5c4e9f(++_0x3d99d9);}(_0xf51f,0x19f));var _0xff51=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0xf51f[_0x3987a1];return _0xe2596e;};'use strict';var info=require(_0xff51('0x0'));var exec=require(_0xff51('0x1'))['exec'];var logger=require(_0xff51('0x2'))(_0xff51('0x3'));var util=require('util');var BPromise=require(_0xff51('0x4'));var _=require(_0xff51('0x5'));function handleError(_0x1a8ecb,_0x1b0cb9,_0x43dd1f){_0x1b0cb9=_0x1b0cb9||0x1f4;return function(_0x4ec55b){logger[_0xff51('0x6')](_0xff51('0x7'),_0x43dd1f,_0x1b0cb9,util[_0xff51('0x8')](_0x4ec55b,{'showHidden':![],'depth':null}));delete _0x4ec55b[_0xff51('0x9')];_0x1a8ecb['status'](_0x1b0cb9)['send'](_0x4ec55b);};}exports[_0xff51('0xa')]=function(_0x213e13,_0x144efb){return info['getAllData']()[_0xff51('0xb')](function(_0x450122){return _0x144efb[_0xff51('0xc')](0xc8)[_0xff51('0xd')](_0x450122);})['catch'](function(_0x2e9493){return _0x144efb['status'](0x1f4)[_0xff51('0xd')](_0x2e9493);});};exports[_0xff51('0xe')]=function(_0xe7566f,_0x5a734d){var _0x391dc8=[_0xff51('0xf')];return new BPromise(function(_0x474fc4,_0x17e598){return exec(util[_0xff51('0x10')](_0xff51('0x11'),_0xe7566f['params'][_0xff51('0x12')]),function(_0xf899eb,_0x176a64,_0x3e04df){if(_0xf899eb){return _0x17e598(_0xf899eb);}return _0x474fc4(_0x176a64);});})[_0xff51('0xb')](function(_0x4404e0){var _0x5edc43=![];var _0x6606c2=_0x4404e0['split'](/\n/);for(var _0x4ac4f4=0x0,_0x1453e9=_0x391dc8['length'];_0x4ac4f4<_0x1453e9,_0x5edc43===![];_0x4ac4f4+=0x1){if(_0x4404e0['indexOf'](_0x391dc8[_0x4ac4f4])>=0x0){_0x5edc43=!![];}}if(!_0x5edc43){throw new Error(util['format'](_0xff51('0x13'),_0xe7566f[_0xff51('0x14')][_0xff51('0x12')]));}process[_0xff51('0x15')](_0xe7566f[_0xff51('0x14')][_0xff51('0x12')],_0xff51('0x16'));return _0x5a734d['status'](0xc8)[_0xff51('0xd')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0xe7566f['params'][_0xff51('0x12')])});})[_0xff51('0x17')](handleError(_0x5a734d,null,_0xff51('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index bb660b5..6b9cdf2 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 _0x4c58=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0x3abe6a,_0xdd7b1a){var _0x2fc39e=function(_0x13911e){while(--_0x13911e){_0x3abe6a['push'](_0x3abe6a['shift']());}};_0x2fc39e(++_0xdd7b1a);}(_0x4c58,0xed));var _0x84c5=function(_0x39aae5,_0xfd2f27){_0x39aae5=_0x39aae5-0x0;var _0x266f9f=_0x4c58[_0x39aae5];return _0x266f9f;};'use strict';var multer=require(_0x84c5('0x0'));var util=require('util');var path=require(_0x84c5('0x1'));var timeout=require(_0x84c5('0x2'));var express=require(_0x84c5('0x3'));var router=express[_0x84c5('0x4')]();var fs_extra=require(_0x84c5('0x5'));var auth=require(_0x84c5('0x6'));var interaction=require(_0x84c5('0x7'));var config=require('../../config/environment');var controller=require(_0x84c5('0x8'));router[_0x84c5('0x9')]('/',auth[_0x84c5('0xa')](),controller[_0x84c5('0xb')]);router[_0x84c5('0x9')](_0x84c5('0xc'),auth[_0x84c5('0xa')](),controller[_0x84c5('0xd')]);router[_0x84c5('0xe')]('/',auth[_0x84c5('0xa')](),controller[_0x84c5('0xf')]);router[_0x84c5('0x10')](_0x84c5('0xc'),auth[_0x84c5('0xa')](),controller[_0x84c5('0x11')]);router['delete'](_0x84c5('0xc'),auth[_0x84c5('0xa')](),controller[_0x84c5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5562=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express'];(function(_0x58819b,_0x418dac){var _0x32d37c=function(_0x486a9c){while(--_0x486a9c){_0x58819b['push'](_0x58819b['shift']());}};_0x32d37c(++_0x418dac);}(_0x5562,0x8b));var _0x2556=function(_0x4fd71e,_0x3ec6d5){_0x4fd71e=_0x4fd71e-0x0;var _0x7cf1dc=_0x5562[_0x4fd71e];return _0x7cf1dc;};'use strict';var multer=require(_0x2556('0x0'));var util=require(_0x2556('0x1'));var path=require(_0x2556('0x2'));var timeout=require(_0x2556('0x3'));var express=require(_0x2556('0x4'));var router=express[_0x2556('0x5')]();var fs_extra=require(_0x2556('0x6'));var auth=require(_0x2556('0x7'));var interaction=require(_0x2556('0x8'));var config=require(_0x2556('0x9'));var controller=require('./tag.controller');router[_0x2556('0xa')]('/',auth[_0x2556('0xb')](),controller['index']);router[_0x2556('0xa')](_0x2556('0xc'),auth[_0x2556('0xb')](),controller[_0x2556('0xd')]);router['post']('/',auth[_0x2556('0xb')](),controller[_0x2556('0xe')]);router[_0x2556('0xf')](_0x2556('0xc'),auth[_0x2556('0xb')](),controller[_0x2556('0x10')]);router[_0x2556('0x11')](_0x2556('0xc'),auth[_0x2556('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6564134..81f8e0a 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 _0x2032=['#0091EA','exports','STRING','name'];(function(_0x5b935a,_0x38a394){var _0x14c17b=function(_0x4e9d5b){while(--_0x4e9d5b){_0x5b935a['push'](_0x5b935a['shift']());}};_0x14c17b(++_0x38a394);}(_0x2032,0xd9));var _0x2203=function(_0x5e64fa,_0x166961){_0x5e64fa=_0x5e64fa-0x0;var _0x4cb39a=_0x2032[_0x5e64fa];return _0x4cb39a;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'unique':_0x2203('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x3')},'description':{'type':Sequelize[_0x2203('0x1')]}}; \ No newline at end of file +var _0xac4a=['exports','STRING','name','#0091EA','sequelize'];(function(_0x5221d5,_0xa1e8f8){var _0x222a6d=function(_0x40c6dd){while(--_0x40c6dd){_0x5221d5['push'](_0x5221d5['shift']());}};_0x222a6d(++_0xa1e8f8);}(_0xac4a,0x13f));var _0xaac4=function(_0x74faf2,_0x611940){_0x74faf2=_0x74faf2-0x0;var _0x5109f5=_0xac4a[_0x74faf2];return _0x5109f5;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'unique':_0xaac4('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e718740..23b9ee9 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 _0x54e9=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','end','error','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','Tag','findAll','rows','catch','show','rawAttributes','include','user','get','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','create','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs'];(function(_0x58497a,_0x5be5f8){var _0x399810=function(_0x3e5b5b){while(--_0x3e5b5b){_0x58497a['push'](_0x58497a['shift']());}};_0x399810(++_0x5be5f8);}(_0x54e9,0x1d5));var _0x954e=function(_0xa20d3d,_0x26685c){_0xa20d3d=_0xa20d3d-0x0;var _0x292aed=_0x54e9[_0xa20d3d];return _0x292aed;};'use strict';var emlformat=require(_0x954e('0x0'));var rimraf=require(_0x954e('0x1'));var zipdir=require(_0x954e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x954e('0x3'));var BPromise=require(_0x954e('0x4'));var Mustache=require(_0x954e('0x5'));var util=require(_0x954e('0x6'));var path=require('path');var sox=require(_0x954e('0x7'));var csv=require(_0x954e('0x8'));var ejs=require(_0x954e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x954e('0xa'));var squel=require(_0x954e('0xb'));var crypto=require(_0x954e('0xc'));var jsforce=require(_0x954e('0xd'));var deskjs=require(_0x954e('0xe'));var toCsv=require(_0x954e('0x8'));var querystring=require('querystring');var Papa=require(_0x954e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x954e('0x10'));var as=require(_0x954e('0x11'));var hardwareService=require(_0x954e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x954e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x954e('0x14'));var db=require(_0x954e('0x15'))['db'];function respondWithStatusCode(_0x26c8aa,_0x15d557){_0x15d557=_0x15d557||0xcc;return function(_0x2345b9){if(_0x2345b9){return _0x26c8aa[_0x954e('0x16')](_0x15d557);}return _0x26c8aa[_0x954e('0x17')](_0x15d557)['end']();};}function respondWithResult(_0x106e72,_0x477ea9){_0x477ea9=_0x477ea9||0xc8;return function(_0x52e736){if(_0x52e736){return _0x106e72['status'](_0x477ea9)[_0x954e('0x18')](_0x52e736);}};}function respondWithFilteredResult(_0x3fa0e1,_0x1f4bf4){return function(_0x441c9a){if(_0x441c9a){var _0x52bfcb=typeof _0x1f4bf4['offset']===_0x954e('0x19')&&typeof _0x1f4bf4[_0x954e('0x1a')]===_0x954e('0x19');var _0x4e584a=_0x441c9a['count'];var _0x6a2b3c=_0x52bfcb?0x0:_0x1f4bf4['offset'];var _0xcdbbf6=_0x52bfcb?_0x441c9a['count']:_0x1f4bf4[_0x954e('0x1b')]+_0x1f4bf4[_0x954e('0x1a')];var _0x2ae0f2;if(_0xcdbbf6>=_0x4e584a){_0xcdbbf6=_0x4e584a;_0x2ae0f2=0xc8;}else{_0x2ae0f2=0xce;}_0x3fa0e1['status'](_0x2ae0f2);return _0x3fa0e1[_0x954e('0x1c')](_0x954e('0x1d'),_0x6a2b3c+'-'+_0xcdbbf6+'/'+_0x4e584a)[_0x954e('0x18')](_0x441c9a);}return null;};}function patchUpdates(_0x2880d3){return function(_0x51638a){try{jsonpatch[_0x954e('0x1e')](_0x51638a,_0x2880d3,!![]);}catch(_0x4490ec){return BPromise[_0x954e('0x1f')](_0x4490ec);}return _0x51638a[_0x954e('0x20')]();};}function saveUpdates(_0xd4166a,_0x1993bf){return function(_0x19bfaa){if(_0x19bfaa){return _0x19bfaa[_0x954e('0x21')](_0xd4166a)['then'](function(_0x4187d2){return _0x4187d2;});}return null;};}function removeEntity(_0xd3787e,_0x48d5da){return function(_0x5844ce){if(_0x5844ce){return _0x5844ce[_0x954e('0x22')]()[_0x954e('0x23')](function(){var _0x358522=_0x5844ce['get']({'plain':!![]});var _0x3d09e1='Tags';return db[_0x954e('0x24')]['destroy']({'where':{'type':_0x3d09e1,'resourceId':_0x358522['id']}})[_0x954e('0x23')](function(){return _0x5844ce;});})[_0x954e('0x23')](function(){_0xd3787e[_0x954e('0x17')](0xcc)[_0x954e('0x25')]();});}};}function handleEntityNotFound(_0x474a01,_0x57a3af){return function(_0x4fbbe2){if(!_0x4fbbe2){_0x474a01[_0x954e('0x16')](0x194);}return _0x4fbbe2;};}function handleError(_0xe925a5,_0x170f07){_0x170f07=_0x170f07||0x1f4;return function(_0x49f27f){logger[_0x954e('0x26')](_0x49f27f['stack']);if(_0x49f27f['name']){delete _0x49f27f[_0x954e('0x27')];}_0xe925a5['status'](_0x170f07)[_0x954e('0x28')](_0x49f27f);};}exports[_0x954e('0x29')]=function(_0x1cc09b,_0x4ff121){var _0x2c618c={},_0x4d0429={},_0x49da77={'count':0x0,'rows':[]};var _0x10728d=_[_0x954e('0x2a')](db['Tag']['rawAttributes'],function(_0x223d55){return{'name':_0x223d55['fieldName'],'type':_0x223d55[_0x954e('0x2b')][_0x954e('0x2c')]};});_0x4d0429[_0x954e('0x2d')]=_[_0x954e('0x2a')](_0x10728d,_0x954e('0x27'));_0x4d0429[_0x954e('0x2e')]=_[_0x954e('0x2f')](_0x1cc09b['query']);_0x4d0429[_0x954e('0x30')]=_['intersection'](_0x4d0429[_0x954e('0x2d')],_0x4d0429[_0x954e('0x2e')]);_0x2c618c[_0x954e('0x31')]=_[_0x954e('0x32')](_0x4d0429[_0x954e('0x2d')],qs['fields'](_0x1cc09b['query'][_0x954e('0x33')]));_0x2c618c[_0x954e('0x31')]=_0x2c618c[_0x954e('0x31')][_0x954e('0x34')]?_0x2c618c[_0x954e('0x31')]:_0x4d0429[_0x954e('0x2d')];if(!_0x1cc09b[_0x954e('0x2e')][_0x954e('0x35')](_0x954e('0x36'))){_0x2c618c[_0x954e('0x1a')]=qs['limit'](_0x1cc09b[_0x954e('0x2e')][_0x954e('0x1a')]);_0x2c618c[_0x954e('0x1b')]=qs[_0x954e('0x1b')](_0x1cc09b[_0x954e('0x2e')][_0x954e('0x1b')]);}_0x2c618c['order']=qs[_0x954e('0x37')](_0x1cc09b[_0x954e('0x2e')][_0x954e('0x37')]);_0x2c618c[_0x954e('0x38')]=qs['filters'](_[_0x954e('0x39')](_0x1cc09b[_0x954e('0x2e')],_0x4d0429[_0x954e('0x30')]),_0x10728d);if(_0x1cc09b[_0x954e('0x2e')][_0x954e('0x3a')]){_0x2c618c['where']=_[_0x954e('0x3b')](_0x2c618c[_0x954e('0x38')],{'$or':_['map'](_0x10728d,function(_0xdd6774){if(_0xdd6774[_0x954e('0x2b')]!=='VIRTUAL'){var _0x3278ea={};_0x3278ea[_0xdd6774[_0x954e('0x27')]]={'$like':'%'+_0x1cc09b[_0x954e('0x2e')][_0x954e('0x3a')]+'%'};return _0x3278ea;}})});}_0x2c618c=_[_0x954e('0x3b')]({},_0x2c618c,_0x1cc09b[_0x954e('0x3c')]);var _0x3e4b47={'where':_0x2c618c['where']};return db['Tag'][_0x954e('0x3d')](_0x3e4b47)['then'](function(_0xe6e245){_0x49da77['count']=_0xe6e245;if(_0x1cc09b['query'][_0x954e('0x3e')]){_0x2c618c['include']=[{'all':!![]}];}return db[_0x954e('0x3f')][_0x954e('0x40')](_0x2c618c);})['then'](function(_0xd8ab6c){_0x49da77[_0x954e('0x41')]=_0xd8ab6c;return _0x49da77;})['then'](respondWithFilteredResult(_0x4ff121,_0x2c618c))[_0x954e('0x42')](handleError(_0x4ff121,null));};exports[_0x954e('0x43')]=function(_0xde0235,_0x1a9184){var _0x532331={'raw':!![],'where':{'id':_0xde0235['params']['id']}},_0x545384={};_0x545384[_0x954e('0x2d')]=_[_0x954e('0x2f')](db['Tag'][_0x954e('0x44')]);_0x545384['query']=_['keys'](_0xde0235[_0x954e('0x2e')]);_0x545384[_0x954e('0x30')]=_['intersection'](_0x545384[_0x954e('0x2d')],_0x545384[_0x954e('0x2e')]);_0x532331[_0x954e('0x31')]=_[_0x954e('0x32')](_0x545384[_0x954e('0x2d')],qs['fields'](_0xde0235[_0x954e('0x2e')]['fields']));_0x532331[_0x954e('0x31')]=_0x532331['attributes'][_0x954e('0x34')]?_0x532331['attributes']:_0x545384['model'];if(_0xde0235['query'][_0x954e('0x3e')]){_0x532331[_0x954e('0x45')]=[{'all':!![]}];}_0x532331=_['merge']({},_0x532331,_0xde0235[_0x954e('0x3c')]);return db[_0x954e('0x3f')]['find'](_0x532331)[_0x954e('0x23')](handleEntityNotFound(_0x1a9184,null))[_0x954e('0x23')](respondWithResult(_0x1a9184,null))[_0x954e('0x42')](handleError(_0x1a9184,null));};exports['create']=function(_0x3644b7,_0x5c3542){return db[_0x954e('0x3f')]['create'](_0x3644b7['body'],{})[_0x954e('0x23')](function(_0x51b109){var _0x47be70=_0x3644b7[_0x954e('0x46')][_0x954e('0x47')]({'plain':!![]});if(!_0x47be70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47be70[_0x954e('0x48')]==='user'){var _0x1d5fd3=_0x51b109[_0x954e('0x47')]({'plain':!![]});var _0x2c6f63=_0x954e('0x49');return db[_0x954e('0x4a')][_0x954e('0x4b')]({'where':{'name':_0x2c6f63,'userProfileId':_0x47be70[_0x954e('0x4c')]},'raw':!![]})['then'](function(_0x52b0f4){if(_0x52b0f4&&_0x52b0f4[_0x954e('0x4d')]===0x0){return db[_0x954e('0x24')][_0x954e('0x4e')]({'name':_0x1d5fd3[_0x954e('0x27')],'resourceId':_0x1d5fd3['id'],'type':_0x52b0f4[_0x954e('0x27')],'sectionId':_0x52b0f4['id']},{})[_0x954e('0x23')](function(){return _0x51b109;});}else{return _0x51b109;}})['catch'](function(_0x430cde){logger[_0x954e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x430cde);throw _0x430cde;});}return _0x51b109;})[_0x954e('0x23')](respondWithResult(_0x5c3542,0xc9))[_0x954e('0x42')](handleError(_0x5c3542,null));};exports[_0x954e('0x21')]=function(_0x528a5b,_0x4e5b5b){if(_0x528a5b['body']['id']){delete _0x528a5b[_0x954e('0x4f')]['id'];}return db['Tag'][_0x954e('0x4b')]({'where':{'id':_0x528a5b[_0x954e('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e5b5b,null))[_0x954e('0x23')](saveUpdates(_0x528a5b['body'],null))[_0x954e('0x23')](respondWithResult(_0x4e5b5b,null))[_0x954e('0x42')](handleError(_0x4e5b5b,null));};exports[_0x954e('0x22')]=function(_0x553a06,_0x20ac96){return db[_0x954e('0x3f')]['find']({'where':{'id':_0x553a06[_0x954e('0x50')]['id']}})['then'](handleEntityNotFound(_0x20ac96,null))['then'](removeEntity(_0x20ac96,null))['catch'](handleError(_0x20ac96,null));}; \ No newline at end of file +var _0x8a75=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','error','name','send','map','Tag','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring'];(function(_0x17b47b,_0x1297b5){var _0x192ea3=function(_0x201a51){while(--_0x201a51){_0x17b47b['push'](_0x17b47b['shift']());}};_0x192ea3(++_0x1297b5);}(_0x8a75,0x9d));var _0x58a7=function(_0x1d0056,_0x497101){_0x1d0056=_0x1d0056-0x0;var _0x50f79c=_0x8a75[_0x1d0056];return _0x50f79c;};'use strict';var emlformat=require(_0x58a7('0x0'));var rimraf=require(_0x58a7('0x1'));var zipdir=require(_0x58a7('0x2'));var jsonpatch=require(_0x58a7('0x3'));var rp=require(_0x58a7('0x4'));var moment=require(_0x58a7('0x5'));var BPromise=require(_0x58a7('0x6'));var Mustache=require(_0x58a7('0x7'));var util=require(_0x58a7('0x8'));var path=require(_0x58a7('0x9'));var sox=require(_0x58a7('0xa'));var csv=require('to-csv');var ejs=require(_0x58a7('0xb'));var fs=require('fs');var fs_extra=require(_0x58a7('0xc'));var _=require(_0x58a7('0xd'));var squel=require(_0x58a7('0xe'));var crypto=require(_0x58a7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x58a7('0x10'));var toCsv=require(_0x58a7('0x11'));var querystring=require(_0x58a7('0x12'));var Papa=require(_0x58a7('0x13'));var Redis=require(_0x58a7('0x14'));var authService=require(_0x58a7('0x15'));var qs=require(_0x58a7('0x16'));var as=require(_0x58a7('0x17'));var hardwareService=require(_0x58a7('0x18'));var logger=require(_0x58a7('0x19'))(_0x58a7('0x1a'));var utils=require(_0x58a7('0x1b'));var config=require(_0x58a7('0x1c'));var licenseUtil=require(_0x58a7('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fa8d6,_0x4b99aa){_0x4b99aa=_0x4b99aa||0xcc;return function(_0x5817ee){if(_0x5817ee){return _0x4fa8d6[_0x58a7('0x1e')](_0x4b99aa);}return _0x4fa8d6[_0x58a7('0x1f')](_0x4b99aa)['end']();};}function respondWithResult(_0x1b2a33,_0x5d7847){_0x5d7847=_0x5d7847||0xc8;return function(_0x1304b6){if(_0x1304b6){return _0x1b2a33[_0x58a7('0x1f')](_0x5d7847)[_0x58a7('0x20')](_0x1304b6);}};}function respondWithFilteredResult(_0x1f3607,_0x3e9b0c){return function(_0x52e40c){if(_0x52e40c){var _0x209dc4=typeof _0x3e9b0c[_0x58a7('0x21')]===_0x58a7('0x22')&&typeof _0x3e9b0c[_0x58a7('0x23')]==='undefined';var _0x437d13=_0x52e40c[_0x58a7('0x24')];var _0x3191f5=_0x209dc4?0x0:_0x3e9b0c['offset'];var _0x3e2596=_0x209dc4?_0x52e40c[_0x58a7('0x24')]:_0x3e9b0c['offset']+_0x3e9b0c['limit'];var _0x5bae99;if(_0x3e2596>=_0x437d13){_0x3e2596=_0x437d13;_0x5bae99=0xc8;}else{_0x5bae99=0xce;}_0x1f3607[_0x58a7('0x1f')](_0x5bae99);return _0x1f3607[_0x58a7('0x25')](_0x58a7('0x26'),_0x3191f5+'-'+_0x3e2596+'/'+_0x437d13)[_0x58a7('0x20')](_0x52e40c);}return null;};}function patchUpdates(_0x550908){return function(_0x1910b7){try{jsonpatch[_0x58a7('0x27')](_0x1910b7,_0x550908,!![]);}catch(_0x14ee21){return BPromise[_0x58a7('0x28')](_0x14ee21);}return _0x1910b7[_0x58a7('0x29')]();};}function saveUpdates(_0x22924d,_0x335814){return function(_0x52982a){if(_0x52982a){return _0x52982a[_0x58a7('0x2a')](_0x22924d)[_0x58a7('0x2b')](function(_0x16c861){return _0x16c861;});}return null;};}function removeEntity(_0x945f4,_0xd9debd){return function(_0x5f2fc2){if(_0x5f2fc2){return _0x5f2fc2[_0x58a7('0x2c')]()[_0x58a7('0x2b')](function(){var _0x584a5d=_0x5f2fc2['get']({'plain':!![]});var _0x4ef601='Tags';return db[_0x58a7('0x2d')][_0x58a7('0x2c')]({'where':{'type':_0x4ef601,'resourceId':_0x584a5d['id']}})[_0x58a7('0x2b')](function(){return _0x5f2fc2;});})['then'](function(){_0x945f4[_0x58a7('0x1f')](0xcc)[_0x58a7('0x2e')]();});}};}function handleEntityNotFound(_0x44d67b,_0xd2c114){return function(_0x58a244){if(!_0x58a244){_0x44d67b['sendStatus'](0x194);}return _0x58a244;};}function handleError(_0x1e0ca0,_0xbb07d0){_0xbb07d0=_0xbb07d0||0x1f4;return function(_0x12c907){logger[_0x58a7('0x2f')](_0x12c907['stack']);if(_0x12c907['name']){delete _0x12c907[_0x58a7('0x30')];}_0x1e0ca0[_0x58a7('0x1f')](_0xbb07d0)[_0x58a7('0x31')](_0x12c907);};}exports['index']=function(_0x3f0d07,_0x4ec3c0){var _0x24bbb2={},_0x9ee779={},_0x3c09f5={'count':0x0,'rows':[]};var _0x26a572=_[_0x58a7('0x32')](db[_0x58a7('0x33')]['rawAttributes'],function(_0x57b7e0){return{'name':_0x57b7e0['fieldName'],'type':_0x57b7e0[_0x58a7('0x34')][_0x58a7('0x35')]};});_0x9ee779['model']=_[_0x58a7('0x32')](_0x26a572,_0x58a7('0x30'));_0x9ee779[_0x58a7('0x36')]=_[_0x58a7('0x37')](_0x3f0d07[_0x58a7('0x36')]);_0x9ee779['filters']=_[_0x58a7('0x38')](_0x9ee779[_0x58a7('0x39')],_0x9ee779['query']);_0x24bbb2[_0x58a7('0x3a')]=_[_0x58a7('0x38')](_0x9ee779[_0x58a7('0x39')],qs['fields'](_0x3f0d07[_0x58a7('0x36')][_0x58a7('0x3b')]));_0x24bbb2['attributes']=_0x24bbb2[_0x58a7('0x3a')][_0x58a7('0x3c')]?_0x24bbb2[_0x58a7('0x3a')]:_0x9ee779[_0x58a7('0x39')];if(!_0x3f0d07['query'][_0x58a7('0x3d')](_0x58a7('0x3e'))){_0x24bbb2[_0x58a7('0x23')]=qs[_0x58a7('0x23')](_0x3f0d07['query'][_0x58a7('0x23')]);_0x24bbb2[_0x58a7('0x21')]=qs[_0x58a7('0x21')](_0x3f0d07['query'][_0x58a7('0x21')]);}_0x24bbb2['order']=qs[_0x58a7('0x3f')](_0x3f0d07[_0x58a7('0x36')]['sort']);_0x24bbb2[_0x58a7('0x40')]=qs[_0x58a7('0x41')](_[_0x58a7('0x42')](_0x3f0d07[_0x58a7('0x36')],_0x9ee779[_0x58a7('0x41')]),_0x26a572);if(_0x3f0d07['query'][_0x58a7('0x43')]){_0x24bbb2[_0x58a7('0x40')]=_[_0x58a7('0x44')](_0x24bbb2[_0x58a7('0x40')],{'$or':_[_0x58a7('0x32')](_0x26a572,function(_0x44d129){if(_0x44d129[_0x58a7('0x34')]!==_0x58a7('0x45')){var _0x7d7119={};_0x7d7119[_0x44d129[_0x58a7('0x30')]]={'$like':'%'+_0x3f0d07[_0x58a7('0x36')]['filter']+'%'};return _0x7d7119;}})});}_0x24bbb2=_[_0x58a7('0x44')]({},_0x24bbb2,_0x3f0d07[_0x58a7('0x46')]);var _0x3f247a={'where':_0x24bbb2[_0x58a7('0x40')]};return db[_0x58a7('0x33')][_0x58a7('0x24')](_0x3f247a)[_0x58a7('0x2b')](function(_0x25c167){_0x3c09f5[_0x58a7('0x24')]=_0x25c167;if(_0x3f0d07[_0x58a7('0x36')][_0x58a7('0x47')]){_0x24bbb2[_0x58a7('0x48')]=[{'all':!![]}];}return db[_0x58a7('0x33')][_0x58a7('0x49')](_0x24bbb2);})[_0x58a7('0x2b')](function(_0x5f4d3b){_0x3c09f5[_0x58a7('0x4a')]=_0x5f4d3b;return _0x3c09f5;})[_0x58a7('0x2b')](respondWithFilteredResult(_0x4ec3c0,_0x24bbb2))[_0x58a7('0x4b')](handleError(_0x4ec3c0,null));};exports['show']=function(_0x4cd138,_0x394f0b){var _0x2870f3={'raw':!![],'where':{'id':_0x4cd138['params']['id']}},_0x495c23={};_0x495c23['model']=_[_0x58a7('0x37')](db[_0x58a7('0x33')][_0x58a7('0x4c')]);_0x495c23[_0x58a7('0x36')]=_['keys'](_0x4cd138['query']);_0x495c23['filters']=_[_0x58a7('0x38')](_0x495c23['model'],_0x495c23['query']);_0x2870f3[_0x58a7('0x3a')]=_[_0x58a7('0x38')](_0x495c23[_0x58a7('0x39')],qs['fields'](_0x4cd138[_0x58a7('0x36')]['fields']));_0x2870f3[_0x58a7('0x3a')]=_0x2870f3[_0x58a7('0x3a')][_0x58a7('0x3c')]?_0x2870f3[_0x58a7('0x3a')]:_0x495c23[_0x58a7('0x39')];if(_0x4cd138[_0x58a7('0x36')][_0x58a7('0x47')]){_0x2870f3[_0x58a7('0x48')]=[{'all':!![]}];}_0x2870f3=_[_0x58a7('0x44')]({},_0x2870f3,_0x4cd138[_0x58a7('0x46')]);return db[_0x58a7('0x33')][_0x58a7('0x4d')](_0x2870f3)[_0x58a7('0x2b')](handleEntityNotFound(_0x394f0b,null))['then'](respondWithResult(_0x394f0b,null))[_0x58a7('0x4b')](handleError(_0x394f0b,null));};exports[_0x58a7('0x4e')]=function(_0x2efccc,_0x401873){return db[_0x58a7('0x33')][_0x58a7('0x4e')](_0x2efccc['body'],{})[_0x58a7('0x2b')](function(_0xf22147){var _0x551526=_0x2efccc[_0x58a7('0x4f')][_0x58a7('0x50')]({'plain':!![]});if(!_0x551526)throw new Error(_0x58a7('0x51'));if(_0x551526['role']===_0x58a7('0x4f')){var _0x4d5c23=_0xf22147['get']({'plain':!![]});var _0x31473e=_0x58a7('0x52');return db[_0x58a7('0x53')][_0x58a7('0x4d')]({'where':{'name':_0x31473e,'userProfileId':_0x551526['userProfileId']},'raw':!![]})['then'](function(_0x26dbbf){if(_0x26dbbf&&_0x26dbbf[_0x58a7('0x54')]===0x0){return db[_0x58a7('0x2d')]['create']({'name':_0x4d5c23[_0x58a7('0x30')],'resourceId':_0x4d5c23['id'],'type':_0x26dbbf[_0x58a7('0x30')],'sectionId':_0x26dbbf['id']},{})['then'](function(){return _0xf22147;});}else{return _0xf22147;}})[_0x58a7('0x4b')](function(_0x51f207){logger['error'](_0x58a7('0x55'),_0x51f207);throw _0x51f207;});}return _0xf22147;})[_0x58a7('0x2b')](respondWithResult(_0x401873,0xc9))['catch'](handleError(_0x401873,null));};exports[_0x58a7('0x2a')]=function(_0x3003a1,_0x3b5709){if(_0x3003a1['body']['id']){delete _0x3003a1[_0x58a7('0x56')]['id'];}return db['Tag'][_0x58a7('0x4d')]({'where':{'id':_0x3003a1[_0x58a7('0x57')]['id']}})[_0x58a7('0x2b')](handleEntityNotFound(_0x3b5709,null))[_0x58a7('0x2b')](saveUpdates(_0x3003a1['body'],null))['then'](respondWithResult(_0x3b5709,null))[_0x58a7('0x4b')](handleError(_0x3b5709,null));};exports[_0x58a7('0x2c')]=function(_0x213c09,_0x5073df){return db[_0x58a7('0x33')][_0x58a7('0x4d')]({'where':{'id':_0x213c09[_0x58a7('0x57')]['id']}})['then'](handleEntityNotFound(_0x5073df,null))['then'](removeEntity(_0x5073df,null))[_0x58a7('0x4b')](handleError(_0x5073df,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f9643e2..99053a1 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 _0x4f8b=['rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','moment','bluebird','request-promise','path'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4f8b,0x12e));var _0xb4f8=function(_0x424568,_0x5982f4){_0x424568=_0x424568-0x0;var _0x9aed1b=_0x4f8b[_0x424568];return _0x9aed1b;};'use strict';var _=require(_0xb4f8('0x0'));var util=require(_0xb4f8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4f8('0x2'));var BPromise=require(_0xb4f8('0x3'));var rp=require(_0xb4f8('0x4'));var fs=require('fs');var path=require(_0xb4f8('0x5'));var rimraf=require(_0xb4f8('0x6'));var config=require('../../config/environment');var attributes=require(_0xb4f8('0x7'));module[_0xb4f8('0x8')]=function(_0x4851f2,_0x2768ba){return _0x4851f2[_0xb4f8('0x9')]('Tag',attributes,{'tableName':_0xb4f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf503=['moment','bluebird','request-promise','path','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger','api'];(function(_0x345014,_0x3d87c7){var _0x34b224=function(_0xb44ca1){while(--_0xb44ca1){_0x345014['push'](_0x345014['shift']());}};_0x34b224(++_0x3d87c7);}(_0xf503,0x11a));var _0x3f50=function(_0x4d6049,_0x6fa762){_0x4d6049=_0x4d6049-0x0;var _0x1d4f4c=_0xf503[_0x4d6049];return _0x1d4f4c;};'use strict';var _=require(_0x3f50('0x0'));var util=require(_0x3f50('0x1'));var logger=require(_0x3f50('0x2'))(_0x3f50('0x3'));var moment=require(_0x3f50('0x4'));var BPromise=require(_0x3f50('0x5'));var rp=require(_0x3f50('0x6'));var fs=require('fs');var path=require(_0x3f50('0x7'));var rimraf=require('rimraf');var config=require(_0x3f50('0x8'));var attributes=require(_0x3f50('0x9'));module['exports']=function(_0x4ef6da,_0x4afb1a){return _0x4ef6da[_0x3f50('0xa')](_0x3f50('0xb'),attributes,{'tableName':_0x3f50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 4b725d5..80fa67c 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 _0x2bc6=['../../config/environment','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','lodash','util','moment','../../config/utils','rpc'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0x2bc6,0x163));var _0x62bc=function(_0x77add,_0x2016b8){_0x77add=_0x77add-0x0;var _0xa1b62d=_0x2bc6[_0x77add];return _0xa1b62d;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var moment=require(_0x62bc('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(_0x62bc('0x3'));var logger=require('../../config/logger')(_0x62bc('0x4'));var config=require(_0x62bc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x62bc('0x6')][_0x62bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40af10,_0x3f3dc9,_0x3ed6ad){return new BPromise(function(_0x3f625c,_0x5bedeb){return client[_0x62bc('0x8')](_0x40af10,_0x3ed6ad)[_0x62bc('0x9')](function(_0x1917e1){logger[_0x62bc('0xa')]('Tag,\x20%s,\x20%s',_0x3f3dc9,_0x62bc('0xb'));logger[_0x62bc('0xc')](_0x62bc('0xd'),_0x3f3dc9,'request\x20sent',JSON[_0x62bc('0xe')](_0x1917e1));if(_0x1917e1[_0x62bc('0xf')]){if(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x10')]===0x1f4){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')]['message']);return _0x5bedeb(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);}logger['error'](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);return _0x3f625c(_0x1917e1['error'][_0x62bc('0x12')]);}else{logger[_0x62bc('0xa')]('Tag,\x20%s,\x20%s',_0x3f3dc9,'request\x20sent');_0x3f625c(_0x1917e1[_0x62bc('0x13')][_0x62bc('0x12')]);}})['catch'](function(_0x278893){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x278893);_0x5bedeb(_0x278893);});});} \ No newline at end of file +var _0xa5fa=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','Tag,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment'];(function(_0xe25bce,_0xa01215){var _0x57917f=function(_0x1199e1){while(--_0x1199e1){_0xe25bce['push'](_0xe25bce['shift']());}};_0x57917f(++_0xa01215);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x4baacb,_0x490c83){_0x4baacb=_0x4baacb-0x0;var _0x42752a=_0xa5fa[_0x4baacb];return _0x42752a;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('Tag,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 2385329..6c41b59 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 _0xa819=['isAuthenticated','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put','update','delete','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./team.controller','get'];(function(_0x1d8f23,_0x1d4573){var _0x9499d7=function(_0x32af9b){while(--_0x32af9b){_0x1d8f23['push'](_0x1d8f23['shift']());}};_0x9499d7(++_0x1d4573);}(_0xa819,0x93));var _0x9a81=function(_0x4c0b35,_0x33eaed){_0x4c0b35=_0x4c0b35-0x0;var _0x232467=_0xa819[_0x4c0b35];return _0x232467;};'use strict';var multer=require(_0x9a81('0x0'));var util=require(_0x9a81('0x1'));var path=require(_0x9a81('0x2'));var timeout=require(_0x9a81('0x3'));var express=require(_0x9a81('0x4'));var router=express[_0x9a81('0x5')]();var fs_extra=require(_0x9a81('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a81('0x7'));router[_0x9a81('0x8')]('/',auth[_0x9a81('0x9')](),controller['index']);router[_0x9a81('0x8')](_0x9a81('0xa'),auth[_0x9a81('0x9')](),controller[_0x9a81('0xb')]);router[_0x9a81('0x8')](_0x9a81('0xc'),auth[_0x9a81('0x9')](),controller[_0x9a81('0xd')]);router[_0x9a81('0x8')](_0x9a81('0xe'),auth[_0x9a81('0x9')](),controller[_0x9a81('0xf')]);router[_0x9a81('0x10')]('/',auth[_0x9a81('0x9')](),controller[_0x9a81('0x11')]);router[_0x9a81('0x10')]('/:id/queues',auth[_0x9a81('0x9')](),controller[_0x9a81('0x12')]);router[_0x9a81('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x9a81('0x13')]);router[_0x9a81('0x14')](_0x9a81('0xa'),auth[_0x9a81('0x9')](),controller[_0x9a81('0x15')]);router[_0x9a81('0x16')](_0x9a81('0xa'),auth[_0x9a81('0x9')](),controller['destroy']);router['delete'](_0x9a81('0xc'),auth['isAuthenticated'](),controller[_0x9a81('0x17')]);router[_0x9a81('0x16')](_0x9a81('0xe'),auth[_0x9a81('0x9')](),controller[_0x9a81('0x18')]);module[_0x9a81('0x19')]=router; \ No newline at end of file +var _0x8d33=['removeAgents','exports','multer','express','fs-extra','../../components/interaction/service','./team.controller','get','isAuthenticated','show','getQueues','/:id/users','getAgents','create','post','/:id/queues','addAgents','/:id','delete','destroy','removeQueues'];(function(_0xf24f30,_0x77205b){var _0x364bea=function(_0x562a10){while(--_0x562a10){_0xf24f30['push'](_0xf24f30['shift']());}};_0x364bea(++_0x77205b);}(_0x8d33,0x17c));var _0x38d3=function(_0x5b5122,_0x202e22){_0x5b5122=_0x5b5122-0x0;var _0x28adb6=_0x8d33[_0x5b5122];return _0x28adb6;};'use strict';var multer=require(_0x38d3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x38d3('0x1'));var router=express['Router']();var fs_extra=require(_0x38d3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x38d3('0x3'));var config=require('../../config/environment');var controller=require(_0x38d3('0x4'));router[_0x38d3('0x5')]('/',auth[_0x38d3('0x6')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x38d3('0x7')]);router[_0x38d3('0x5')]('/:id/queues',auth[_0x38d3('0x6')](),controller[_0x38d3('0x8')]);router[_0x38d3('0x5')](_0x38d3('0x9'),auth[_0x38d3('0x6')](),controller[_0x38d3('0xa')]);router['post']('/',auth[_0x38d3('0x6')](),controller[_0x38d3('0xb')]);router[_0x38d3('0xc')](_0x38d3('0xd'),auth[_0x38d3('0x6')](),controller['addQueues']);router['post'](_0x38d3('0x9'),auth[_0x38d3('0x6')](),controller[_0x38d3('0xe')]);router['put'](_0x38d3('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x38d3('0x10')](_0x38d3('0xf'),auth[_0x38d3('0x6')](),controller[_0x38d3('0x11')]);router['delete'](_0x38d3('0xd'),auth[_0x38d3('0x6')](),controller[_0x38d3('0x12')]);router[_0x38d3('0x10')]('/:id/users',auth[_0x38d3('0x6')](),controller[_0x38d3('0x13')]);module[_0x38d3('0x14')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 0db47f4..99d6925 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 _0x19d1=['exports','STRING'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x19d1,0x1bc));var _0x119d=function(_0x552946,_0x52167d){_0x552946=_0x552946-0x0;var _0x5e38cc=_0x19d1[_0x552946];return _0x5e38cc;};'use strict';var Sequelize=require('sequelize');module[_0x119d('0x0')]={'name':{'type':Sequelize[_0x119d('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x119d('0x1')]}}; \ No newline at end of file +var _0xf4b7=['exports','STRING','name'];(function(_0x25961d,_0x2445fd){var _0xc9932b=function(_0x2bc5ee){while(--_0x2bc5ee){_0x25961d['push'](_0x25961d['shift']());}};_0xc9932b(++_0x2445fd);}(_0xf4b7,0x159));var _0x7f4b=function(_0x5258d7,_0x3ec013){_0x5258d7=_0x5258d7-0x0;var _0x27a2c3=_0xf4b7[_0x5258d7];return _0x27a2c3;};'use strict';var Sequelize=require('sequelize');module[_0x7f4b('0x0')]={'name':{'type':Sequelize[_0x7f4b('0x1')],'allowNull':![],'unique':_0x7f4b('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a3126c7..13a4608 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 _0x1a85=['squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','Teams','UserProfileResource','sendStatus','error','stack','name','index','map','Team','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','isValidChannel','add','removeQueues','findOne','remove','ids','addAgents','Mail','Sms','Fax','Whatsapp','sequelize','transaction','Voice','through','penalty','TeamVoiceQueue','findOrCreate','emit','Queue:save','QueueId','online','interface','isNil','format','SIP/%s','voicePause','all','spread','removeAgents','Openchannel','parse','Queue:remove','UserVoiceQueueRt','getAgents','User','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra'];(function(_0x4e0db4,_0x5e58bf){var _0x5d0c7e=function(_0x4dbb13){while(--_0x4dbb13){_0x4e0db4['push'](_0x4e0db4['shift']());}};_0x5d0c7e(++_0x5e58bf);}(_0x1a85,0x178));var _0x51a8=function(_0x2947d1,_0x5e70b0){_0x2947d1=_0x2947d1-0x0;var _0x2b36a5=_0x1a85[_0x2947d1];return _0x2b36a5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=typeof _0x1c2f25[_0x51a8('0x20')]===_0x51a8('0x21')&&typeof _0x1c2f25[_0x51a8('0x22')]==='undefined';var _0x1df8c2=_0x45a433[_0x51a8('0x23')];var _0x2217ce=_0xd52230?0x0:_0x1c2f25[_0x51a8('0x20')];var _0x2a4c4c=_0xd52230?_0x45a433[_0x51a8('0x23')]:_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x22')];var _0x5ac1c0;if(_0x2a4c4c>=_0x1df8c2){_0x2a4c4c=_0x1df8c2;_0x5ac1c0=0xc8;}else{_0x5ac1c0=0xce;}_0x516abc[_0x51a8('0x1d')](_0x5ac1c0);return _0x516abc['set'](_0x51a8('0x24'),_0x2217ce+'-'+_0x2a4c4c+'/'+_0x1df8c2)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x8bda40){return function(_0x3759d6){try{jsonpatch['apply'](_0x3759d6,_0x8bda40,!![]);}catch(_0xae3588){return BPromise['reject'](_0xae3588);}return _0x3759d6['save']();};}function saveUpdates(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x25')](_0x23d26a)[_0x51a8('0x26')](function(_0x18e2f3){return _0x18e2f3;});}return null;};}function removeEntity(_0x157554,_0x2f2f05){return function(_0x291ed6){if(_0x291ed6){return _0x291ed6[_0x51a8('0x27')]()['then'](function(){var _0x273ce2=_0x291ed6[_0x51a8('0x28')]({'plain':!![]});var _0xca5746=_0x51a8('0x29');return db[_0x51a8('0x2a')][_0x51a8('0x27')]({'where':{'type':_0xca5746,'resourceId':_0x273ce2['id']}})[_0x51a8('0x26')](function(){return _0x291ed6;});})[_0x51a8('0x26')](function(){_0x157554[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0x20c6b5,_0x347a02){return function(_0x4a1548){if(!_0x4a1548){_0x20c6b5[_0x51a8('0x2b')](0x194);}return _0x4a1548;};}function handleError(_0x58cba0,_0x276424){_0x276424=_0x276424||0x1f4;return function(_0x3bc19a){logger[_0x51a8('0x2c')](_0x3bc19a[_0x51a8('0x2d')]);if(_0x3bc19a[_0x51a8('0x2e')]){delete _0x3bc19a['name'];}_0x58cba0[_0x51a8('0x1d')](_0x276424)['send'](_0x3bc19a);};}exports[_0x51a8('0x2f')]=function(_0x24b39a,_0x253a59){var _0x4b19c8={},_0x2080a1={},_0x499a43={'count':0x0,'rows':[]};var _0x25a858=_[_0x51a8('0x30')](db[_0x51a8('0x31')][_0x51a8('0x32')],function(_0x193e0f){return{'name':_0x193e0f['fieldName'],'type':_0x193e0f[_0x51a8('0x33')]['key']};});_0x2080a1[_0x51a8('0x34')]=_[_0x51a8('0x30')](_0x25a858,_0x51a8('0x2e'));_0x2080a1['query']=_[_0x51a8('0x35')](_0x24b39a[_0x51a8('0x36')]);_0x2080a1[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x2080a1[_0x51a8('0x34')],_0x2080a1['query']);_0x4b19c8['attributes']=_['intersection'](_0x2080a1[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x24b39a['query'][_0x51a8('0x39')]));_0x4b19c8['attributes']=_0x4b19c8[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x4b19c8[_0x51a8('0x3a')]:_0x2080a1[_0x51a8('0x34')];if(!_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x4b19c8['limit']=qs[_0x51a8('0x22')](_0x24b39a['query']['limit']);_0x4b19c8['offset']=qs[_0x51a8('0x20')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x20')]);}_0x4b19c8['order']=qs[_0x51a8('0x3d')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3d')]);_0x4b19c8[_0x51a8('0x3e')]=qs['filters'](_[_0x51a8('0x3f')](_0x24b39a[_0x51a8('0x36')],_0x2080a1[_0x51a8('0x37')]),_0x25a858);if(_0x24b39a['query'][_0x51a8('0x40')]){_0x4b19c8['where']=_[_0x51a8('0x41')](_0x4b19c8[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x25a858,function(_0x37d50b){if(_0x37d50b['type']!==_0x51a8('0x42')){var _0x3da2cf={};_0x3da2cf[_0x37d50b[_0x51a8('0x2e')]]={'$like':'%'+_0x24b39a[_0x51a8('0x36')][_0x51a8('0x40')]+'%'};return _0x3da2cf;}})});}_0x4b19c8=_[_0x51a8('0x41')]({},_0x4b19c8,_0x24b39a[_0x51a8('0x43')]);var _0x1cdec6={'where':_0x4b19c8[_0x51a8('0x3e')]};return db['Team'][_0x51a8('0x23')](_0x1cdec6)[_0x51a8('0x26')](function(_0x4c7c67){_0x499a43['count']=_0x4c7c67;if(_0x24b39a[_0x51a8('0x36')][_0x51a8('0x44')]){_0x4b19c8[_0x51a8('0x45')]=[{'all':!![]}];}return db[_0x51a8('0x31')][_0x51a8('0x46')](_0x4b19c8);})[_0x51a8('0x26')](function(_0x28f5b3){_0x499a43[_0x51a8('0x47')]=_0x28f5b3;return _0x499a43;})[_0x51a8('0x26')](respondWithFilteredResult(_0x253a59,_0x4b19c8))[_0x51a8('0x48')](handleError(_0x253a59,null));};exports['show']=function(_0x416988,_0x218ae0){var _0x190d52={'raw':![],'where':{'id':_0x416988[_0x51a8('0x49')]['id']}},_0x444b0b={};_0x444b0b[_0x51a8('0x34')]=_['keys'](db[_0x51a8('0x31')]['rawAttributes']);_0x444b0b[_0x51a8('0x36')]=_[_0x51a8('0x35')](_0x416988[_0x51a8('0x36')]);_0x444b0b[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x444b0b['model'],_0x444b0b['query']);_0x190d52[_0x51a8('0x3a')]=_[_0x51a8('0x38')](_0x444b0b[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x416988[_0x51a8('0x36')]['fields']));_0x190d52['attributes']=_0x190d52[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x190d52[_0x51a8('0x3a')]:_0x444b0b[_0x51a8('0x34')];if(_0x416988[_0x51a8('0x36')][_0x51a8('0x44')]){_0x190d52[_0x51a8('0x45')]=[{'all':!![]}];}_0x190d52=_[_0x51a8('0x41')]({},_0x190d52,_0x416988[_0x51a8('0x43')]);return db['Team']['find'](_0x190d52)['then'](handleEntityNotFound(_0x218ae0,null))[_0x51a8('0x26')](respondWithResult(_0x218ae0,null))[_0x51a8('0x48')](handleError(_0x218ae0,null));};exports[_0x51a8('0x4a')]=function(_0x5259f3,_0x3bd492){return db[_0x51a8('0x31')]['create'](_0x5259f3[_0x51a8('0x4b')],{})['then'](function(_0x50a2f8){var _0xbf828b=_0x5259f3[_0x51a8('0x4c')][_0x51a8('0x28')]({'plain':!![]});if(!_0xbf828b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbf828b['role']===_0x51a8('0x4c')){var _0x5b0398=_0x50a2f8[_0x51a8('0x28')]({'plain':!![]});var _0xc89617=_0x51a8('0x29');return db[_0x51a8('0x4d')][_0x51a8('0x4e')]({'where':{'name':_0xc89617,'userProfileId':_0xbf828b[_0x51a8('0x4f')]},'raw':!![]})[_0x51a8('0x26')](function(_0x406a87){if(_0x406a87&&_0x406a87[_0x51a8('0x50')]===0x0){return db['UserProfileResource'][_0x51a8('0x4a')]({'name':_0x5b0398[_0x51a8('0x2e')],'resourceId':_0x5b0398['id'],'type':_0x406a87[_0x51a8('0x2e')],'sectionId':_0x406a87['id']},{})[_0x51a8('0x26')](function(){return _0x50a2f8;});}else{return _0x50a2f8;}})['catch'](function(_0x13b7ba){logger['error'](_0x51a8('0x51'),_0x13b7ba);throw _0x13b7ba;});}return _0x50a2f8;})[_0x51a8('0x26')](respondWithResult(_0x3bd492,0xc9))['catch'](handleError(_0x3bd492,null));};exports['update']=function(_0x2628d4,_0x16f124){if(_0x2628d4[_0x51a8('0x4b')]['id']){delete _0x2628d4[_0x51a8('0x4b')]['id'];}return db[_0x51a8('0x31')]['find']({'where':{'id':_0x2628d4[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x16f124,null))[_0x51a8('0x26')](saveUpdates(_0x2628d4[_0x51a8('0x4b')],null))[_0x51a8('0x26')](respondWithResult(_0x16f124,null))['catch'](handleError(_0x16f124,null));};exports[_0x51a8('0x27')]=function(_0x3f37f9,_0x3656ac){return db[_0x51a8('0x31')][_0x51a8('0x4e')]({'where':{'id':_0x3f37f9[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x3656ac,null))['then'](removeEntity(_0x3656ac,null))['catch'](handleError(_0x3656ac,null));};exports['getQueues']=function(_0x2048c6,_0x1df9cc,_0x51f9f7){return db[_0x51a8('0x31')]['findOne']({'where':{'id':_0x2048c6[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x1df9cc,null))[_0x51a8('0x26')](function(_0x472fdb){if(!_0x2048c6['query']['channel']||!utils['isValidChannel'](_0x2048c6[_0x51a8('0x36')][_0x51a8('0x52')])){throw new db[(_0x51a8('0x53'))][(_0x51a8('0x54'))](_0x51a8('0x55'));}var _0x21c8e0={};var _0x3fd347={};_0x3fd347[_0x51a8('0x34')]=_['keys'](db[_[_0x51a8('0x56')](_0x2048c6[_0x51a8('0x36')]['channel'][_0x51a8('0x57')]())+_0x51a8('0x58')][_0x51a8('0x32')]);_0x3fd347[_0x51a8('0x36')]=_[_0x51a8('0x35')](_0x2048c6[_0x51a8('0x36')]);_0x3fd347['filters']=_['intersection'](_0x3fd347[_0x51a8('0x34')],_0x3fd347['query']);_0x21c8e0['attributes']=_['intersection'](_0x3fd347['model'],qs['fields'](_0x2048c6[_0x51a8('0x36')]['fields']));_0x21c8e0[_0x51a8('0x3a')]=_0x21c8e0[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x21c8e0[_0x51a8('0x3a')]:_0x3fd347[_0x51a8('0x34')];_0x21c8e0[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x2048c6[_0x51a8('0x36')][_0x51a8('0x22')]);_0x21c8e0[_0x51a8('0x20')]=qs['offset'](_0x2048c6[_0x51a8('0x36')][_0x51a8('0x20')]);_0x21c8e0[_0x51a8('0x59')]=qs['sort'](_0x2048c6['query']['sort']);_0x21c8e0[_0x51a8('0x3e')]=qs[_0x51a8('0x37')](_[_0x51a8('0x3f')](_0x2048c6[_0x51a8('0x36')],_0x3fd347[_0x51a8('0x37')]));_0x21c8e0=_[_0x51a8('0x41')]({},_0x21c8e0,_0x2048c6[_0x51a8('0x43')]);return _0x472fdb[_0x51a8('0x28')+_[_0x51a8('0x56')](_0x2048c6[_0x51a8('0x36')][_0x51a8('0x52')][_0x51a8('0x57')]())+_0x51a8('0x5a')](_0x21c8e0);})['then'](respondWithResult(_0x1df9cc,null))[_0x51a8('0x48')](handleError(_0x1df9cc,null));};exports[_0x51a8('0x5b')]=function(_0x52077e,_0x2dc9cb,_0x5140b8){return db['Team']['findOne']({'where':{'id':_0x52077e[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](function(_0xb480ec){if(_0xb480ec){if(!_0x52077e[_0x51a8('0x4b')][_0x51a8('0x52')]||!utils[_0x51a8('0x5c')](_0x52077e[_0x51a8('0x4b')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x51a8('0x55'));}return _0xb480ec[_0x51a8('0x5d')+_[_0x51a8('0x56')](_0x52077e[_0x51a8('0x4b')][_0x51a8('0x52')][_0x51a8('0x57')]())+'Queues'](_0x52077e[_0x51a8('0x4b')]['ids']);}return null;})[_0x51a8('0x26')](handleEntityNotFound(_0x2dc9cb,null))[_0x51a8('0x26')](respondWithStatusCode(_0x2dc9cb,null))[_0x51a8('0x48')](handleError(_0x2dc9cb,null));};exports[_0x51a8('0x5e')]=function(_0x149a40,_0x3aca4a,_0x895b42){return db[_0x51a8('0x31')][_0x51a8('0x5f')]({'where':{'id':_0x149a40[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](function(_0x55b9a0){if(_0x55b9a0){if(!_0x149a40['query'][_0x51a8('0x52')]||!utils[_0x51a8('0x5c')](_0x149a40[_0x51a8('0x36')][_0x51a8('0x52')])){throw new db['Sequelize'][(_0x51a8('0x54'))]('Unknown\x20channel');}return _0x55b9a0[_0x51a8('0x60')+_[_0x51a8('0x56')](_0x149a40[_0x51a8('0x36')][_0x51a8('0x52')][_0x51a8('0x57')]())+_0x51a8('0x5a')](_0x149a40[_0x51a8('0x36')][_0x51a8('0x61')]);}return null;})[_0x51a8('0x26')](handleEntityNotFound(_0x3aca4a,null))['then'](respondWithStatusCode(_0x3aca4a,null))[_0x51a8('0x48')](handleError(_0x3aca4a,null));};exports[_0x51a8('0x62')]=function(_0x3e80db,_0x353e90){return db['Team']['find']({'where':{'id':_0x3e80db[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x353e90,null))['then'](function(_0x58acce){if(_0x58acce){var _0xeb5d67=['Voice','Chat',_0x51a8('0x63'),_0x51a8('0x64'),_0x51a8('0x65'),'Openchannel',_0x51a8('0x66')];return db[_0x51a8('0x67')][_0x51a8('0x68')](function(_0x5f20f7){var _0x3ac9c8=_[_0x51a8('0x30')](_0xeb5d67,function(_0x24838b){var _0x16e90a={'attributes':['id',_0x51a8('0x2e')]};if(_0x24838b===_0x51a8('0x69')){_0x16e90a[_0x51a8('0x6a')]={'attributes':[_0x51a8('0x6b')]};}return _0x58acce[_0x51a8('0x28')+_0x24838b+'Queues'](_0x16e90a)[_0x51a8('0x26')](function(_0x3be132){var _0x4e2c5d=_[_0x51a8('0x30')](_0x3be132,function(_0x43112c){var _0x5d9e3b=_[_0x51a8('0x30')](_0x3e80db[_0x51a8('0x4b')][_0x51a8('0x61')],function(_0x17fd0a){var _0x398fb2={'where':{'UserId':_0x17fd0a,[_0x24838b+'QueueId']:_0x43112c['id']},'transaction':_0x5f20f7};if(_0x24838b===_0x51a8('0x69')){_0x398fb2[_0x51a8('0x18')]={'penalty':_0x43112c[_0x51a8('0x6c')][_0x51a8('0x6b')]};}return db['User'+_0x24838b+_0x51a8('0x58')][_0x51a8('0x6d')](_0x398fb2)[_0x51a8('0x26')](function(){socket[_0x51a8('0x6e')](_0x51a8('0x4c')+_0x24838b+_0x51a8('0x6f'),{'UserId':_0x17fd0a,[_0x24838b+_0x51a8('0x70')]:_0x43112c['id']});if(_0x24838b!==_0x51a8('0x69'))return;return db['User'][_0x51a8('0x46')]({'where':{'id':_0x3e80db[_0x51a8('0x4b')]['ids'],'online':0x1},'attributes':['id',_0x51a8('0x2e'),_0x51a8('0x71'),'voicePause',_0x51a8('0x72')],'raw':!![]})['then'](function(_0x48ad09){var _0x337ab2=_[_0x51a8('0x30')](_0x48ad09,function(_0x41e0b9){return db['UserVoiceQueueRt']['upsert']({'membername':_0x41e0b9[_0x51a8('0x2e')],'UserId':_0x41e0b9['id'],'queue_name':_0x43112c['name'],'VoiceQueueId':_0x43112c['id'],'interface':_[_0x51a8('0x73')](_0x41e0b9[_0x51a8('0x72')])?util[_0x51a8('0x74')](_0x51a8('0x75'),_0x41e0b9[_0x51a8('0x2e')]):_0x41e0b9[_0x51a8('0x72')],'paused':_0x41e0b9[_0x51a8('0x76')]||![],'penalty':_0x43112c[_0x51a8('0x6c')][_0x51a8('0x6b')]},{'transaction':_0x5f20f7});});return Promise[_0x51a8('0x77')](_0x337ab2);});});});return Promise[_0x51a8('0x77')](_0x5d9e3b);});return Promise[_0x51a8('0x77')](_0x4e2c5d);});});return Promise[_0x51a8('0x77')](_0x3ac9c8)[_0x51a8('0x26')](function(){return _0x58acce[_0x51a8('0x62')](_0x3e80db['body']['ids'],{'transaction':_0x5f20f7})[_0x51a8('0x78')](function(_0x4e25d7){return _0x4e25d7;});});});}})['then'](respondWithResult(_0x353e90,null))['catch'](handleError(_0x353e90,null));};exports[_0x51a8('0x79')]=function(_0x4cac59,_0xbc0075){return db[_0x51a8('0x31')]['find']({'where':{'id':_0x4cac59[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0xbc0075,null))['then'](function(_0x41819c){if(_0x41819c){var _0x37a542=['Voice','Chat',_0x51a8('0x63'),_0x51a8('0x64'),_0x51a8('0x65'),_0x51a8('0x7a'),_0x51a8('0x66')];return db[_0x51a8('0x67')]['transaction'](function(_0x13dab3){var _0x1c6e75=_[_0x51a8('0x30')](_0x37a542,function(_0x566d62){var _0x315802={'attributes':['id',_0x51a8('0x2e')]};return _0x41819c[_0x51a8('0x28')+_0x566d62+'Queues'](_0x315802)[_0x51a8('0x26')](function(_0x1821a8){var _0x5cf149=_[_0x51a8('0x30')](_0x1821a8,function(_0x529916){return _0x529916[_0x51a8('0x79')](_0x4cac59[_0x51a8('0x36')][_0x51a8('0x61')],{'transaction':_0x13dab3})[_0x51a8('0x26')](function(){var _0x41621c=JSON[_0x51a8('0x7b')]('['+_0x4cac59[_0x51a8('0x36')][_0x51a8('0x61')]+']');var _0x59561f=_[_0x51a8('0x30')](_0x41621c,function(_0x2c9723){socket[_0x51a8('0x6e')](_0x51a8('0x4c')+_0x566d62+_0x51a8('0x7c'),{'UserId':Number(_0x2c9723),[_0x566d62+'QueueId']:_0x529916['id']});if(_0x566d62!=='Voice')return;return db[_0x51a8('0x7d')][_0x51a8('0x27')]({'where':{'VoiceQueueId':_0x529916['id'],'UserId':_0x2c9723},'transaction':_0x13dab3});});return Promise[_0x51a8('0x77')](_0x59561f);});});return Promise[_0x51a8('0x77')](_0x5cf149);});});return Promise[_0x51a8('0x77')](_0x1c6e75)['then'](function(){return _0x41819c[_0x51a8('0x79')](_0x4cac59['query'][_0x51a8('0x61')],{'transaction':_0x13dab3});});});}})[_0x51a8('0x26')](respondWithStatusCode(_0xbc0075,null))['catch'](handleError(_0xbc0075,null));};exports[_0x51a8('0x7e')]=function(_0x5ca2b6,_0x3b7e30,_0x3cf33c){var _0x149091={};var _0x29563a={};var _0x35b703;var _0x5243fd;return db[_0x51a8('0x31')][_0x51a8('0x5f')]({'where':{'id':_0x5ca2b6['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x3b7e30,null))[_0x51a8('0x26')](function(_0x54e006){if(_0x54e006){_0x35b703=_0x54e006;_0x29563a['model']=_[_0x51a8('0x35')](db[_0x51a8('0x7f')][_0x51a8('0x32')]);_0x29563a['query']=_[_0x51a8('0x35')](_0x5ca2b6[_0x51a8('0x36')]);_0x29563a[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x29563a[_0x51a8('0x34')],_0x29563a[_0x51a8('0x36')]);_0x149091[_0x51a8('0x3a')]=_['intersection'](_0x29563a[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x5ca2b6[_0x51a8('0x36')][_0x51a8('0x39')]));_0x149091['attributes']=_0x149091['attributes'][_0x51a8('0x3b')]?_0x149091[_0x51a8('0x3a')]:_0x29563a['model'];_0x149091['order']=qs['sort'](_0x5ca2b6[_0x51a8('0x36')]['sort']);_0x149091['where']=qs['filters'](_[_0x51a8('0x3f')](_0x5ca2b6['query'],_0x29563a[_0x51a8('0x37')]));if(_0x5ca2b6[_0x51a8('0x36')]['filter']){_0x149091['where']=_[_0x51a8('0x41')](_0x149091['where'],{'$or':_[_0x51a8('0x30')](_0x149091[_0x51a8('0x3a')],function(_0x4bf480){var _0x39938f={};_0x39938f[_0x4bf480]={'$like':'%'+_0x5ca2b6[_0x51a8('0x36')]['filter']+'%'};return _0x39938f;})});}_0x149091=_[_0x51a8('0x41')]({},_0x149091,_0x5ca2b6[_0x51a8('0x43')]);return _0x35b703[_0x51a8('0x7e')](_0x149091);}})['then'](function(_0x2af315){if(_0x2af315){_0x5243fd=_0x2af315[_0x51a8('0x3b')];if(!_0x5ca2b6[_0x51a8('0x36')]['hasOwnProperty']('nolimit')){_0x149091[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x5ca2b6[_0x51a8('0x36')][_0x51a8('0x22')]);_0x149091[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x5ca2b6[_0x51a8('0x36')][_0x51a8('0x20')]);}return _0x35b703[_0x51a8('0x7e')](_0x149091);}})[_0x51a8('0x26')](function(_0x2a8aa1){if(_0x2a8aa1){return _0x2a8aa1?{'count':_0x5243fd,'rows':_0x2a8aa1}:null;}})[_0x51a8('0x26')](respondWithResult(_0x3b7e30,null))[_0x51a8('0x48')](handleError(_0x3b7e30,null));}; \ No newline at end of file +var _0x14a0=['penalty','QueueId','TeamVoiceQueue','User','emit','online','voicePause','interface','format','SIP/%s','all','Chat','removeAgents','Queue:remove','getAgents','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','Teams','UserProfileResource','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','ValidationError','add','ids','removeQueues','remove','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','through'];(function(_0xf0fa0a,_0x54e762){var _0x36c1ad=function(_0x53fa78){while(--_0x53fa78){_0xf0fa0a['push'](_0xf0fa0a['shift']());}};_0x36c1ad(++_0x54e762);}(_0x14a0,0x8e));var _0x014a=function(_0x5cf733,_0x1945f4){_0x5cf733=_0x5cf733-0x0;var _0x1a5242=_0x14a0[_0x5cf733];return _0x1a5242;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);function respondWithStatusCode(_0x3c54c8,_0x4fe87c){_0x4fe87c=_0x4fe87c||0xcc;return function(_0x130d13){if(_0x130d13){return _0x3c54c8[_0x014a('0x1a')](_0x4fe87c);}return _0x3c54c8['status'](_0x4fe87c)[_0x014a('0x1b')]();};}function respondWithResult(_0x128c46,_0x59a4ea){_0x59a4ea=_0x59a4ea||0xc8;return function(_0x16e6fc){if(_0x16e6fc){return _0x128c46[_0x014a('0x1c')](_0x59a4ea)[_0x014a('0x1d')](_0x16e6fc);}};}function respondWithFilteredResult(_0x12da95,_0x2c26ac){return function(_0x12d339){if(_0x12d339){var _0x61ec9f=typeof _0x2c26ac[_0x014a('0x1e')]===_0x014a('0x1f')&&typeof _0x2c26ac[_0x014a('0x20')]===_0x014a('0x1f');var _0x89e132=_0x12d339[_0x014a('0x21')];var _0x34e5c3=_0x61ec9f?0x0:_0x2c26ac['offset'];var _0x359903=_0x61ec9f?_0x12d339[_0x014a('0x21')]:_0x2c26ac[_0x014a('0x1e')]+_0x2c26ac[_0x014a('0x20')];var _0xc9a563;if(_0x359903>=_0x89e132){_0x359903=_0x89e132;_0xc9a563=0xc8;}else{_0xc9a563=0xce;}_0x12da95[_0x014a('0x1c')](_0xc9a563);return _0x12da95[_0x014a('0x22')](_0x014a('0x23'),_0x34e5c3+'-'+_0x359903+'/'+_0x89e132)[_0x014a('0x1d')](_0x12d339);}return null;};}function patchUpdates(_0x486e66){return function(_0x3679ed){try{jsonpatch['apply'](_0x3679ed,_0x486e66,!![]);}catch(_0x1a1318){return BPromise[_0x014a('0x24')](_0x1a1318);}return _0x3679ed[_0x014a('0x25')]();};}function saveUpdates(_0x36d52b,_0x2b3c10){return function(_0x113b12){if(_0x113b12){return _0x113b12[_0x014a('0x26')](_0x36d52b)[_0x014a('0x27')](function(_0x165a42){return _0x165a42;});}return null;};}function removeEntity(_0x4c2627,_0x3b4b92){return function(_0x5358e9){if(_0x5358e9){return _0x5358e9[_0x014a('0x28')]()[_0x014a('0x27')](function(){var _0x4f1c44=_0x5358e9['get']({'plain':!![]});var _0x9a901f=_0x014a('0x29');return db[_0x014a('0x2a')]['destroy']({'where':{'type':_0x9a901f,'resourceId':_0x4f1c44['id']}})[_0x014a('0x27')](function(){return _0x5358e9;});})[_0x014a('0x27')](function(){_0x4c2627['status'](0xcc)[_0x014a('0x1b')]();});}};}function handleEntityNotFound(_0x2560a6,_0x496040){return function(_0x4f9c1c){if(!_0x4f9c1c){_0x2560a6[_0x014a('0x1a')](0x194);}return _0x4f9c1c;};}function handleError(_0x3e5a0a,_0xe70dfa){_0xe70dfa=_0xe70dfa||0x1f4;return function(_0x29fce5){logger['error'](_0x29fce5[_0x014a('0x2b')]);if(_0x29fce5[_0x014a('0x2c')]){delete _0x29fce5[_0x014a('0x2c')];}_0x3e5a0a[_0x014a('0x1c')](_0xe70dfa)[_0x014a('0x2d')](_0x29fce5);};}exports[_0x014a('0x2e')]=function(_0x354f4c,_0x1dae8e){var _0xc802d5={},_0x3c8755={},_0x9dfb11={'count':0x0,'rows':[]};var _0x4ed54e=_[_0x014a('0x2f')](db[_0x014a('0x30')][_0x014a('0x31')],function(_0x457883){return{'name':_0x457883[_0x014a('0x32')],'type':_0x457883[_0x014a('0x33')][_0x014a('0x34')]};});_0x3c8755['model']=_[_0x014a('0x2f')](_0x4ed54e,_0x014a('0x2c'));_0x3c8755['query']=_[_0x014a('0x35')](_0x354f4c[_0x014a('0x36')]);_0x3c8755[_0x014a('0x37')]=_[_0x014a('0x38')](_0x3c8755[_0x014a('0x39')],_0x3c8755[_0x014a('0x36')]);_0xc802d5[_0x014a('0x3a')]=_[_0x014a('0x38')](_0x3c8755['model'],qs[_0x014a('0x3b')](_0x354f4c[_0x014a('0x36')][_0x014a('0x3b')]));_0xc802d5[_0x014a('0x3a')]=_0xc802d5['attributes'][_0x014a('0x3c')]?_0xc802d5[_0x014a('0x3a')]:_0x3c8755[_0x014a('0x39')];if(!_0x354f4c[_0x014a('0x36')][_0x014a('0x3d')](_0x014a('0x3e'))){_0xc802d5[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x354f4c[_0x014a('0x36')]['limit']);_0xc802d5[_0x014a('0x1e')]=qs['offset'](_0x354f4c[_0x014a('0x36')][_0x014a('0x1e')]);}_0xc802d5[_0x014a('0x3f')]=qs[_0x014a('0x40')](_0x354f4c[_0x014a('0x36')]['sort']);_0xc802d5[_0x014a('0x41')]=qs[_0x014a('0x37')](_['pick'](_0x354f4c[_0x014a('0x36')],_0x3c8755[_0x014a('0x37')]),_0x4ed54e);if(_0x354f4c[_0x014a('0x36')][_0x014a('0x42')]){_0xc802d5[_0x014a('0x41')]=_[_0x014a('0x43')](_0xc802d5[_0x014a('0x41')],{'$or':_[_0x014a('0x2f')](_0x4ed54e,function(_0x2beddc){if(_0x2beddc['type']!==_0x014a('0x44')){var _0x3baf40={};_0x3baf40[_0x2beddc[_0x014a('0x2c')]]={'$like':'%'+_0x354f4c[_0x014a('0x36')]['filter']+'%'};return _0x3baf40;}})});}_0xc802d5=_[_0x014a('0x43')]({},_0xc802d5,_0x354f4c[_0x014a('0x45')]);var _0x4cd132={'where':_0xc802d5[_0x014a('0x41')]};return db[_0x014a('0x30')][_0x014a('0x21')](_0x4cd132)['then'](function(_0x361866){_0x9dfb11[_0x014a('0x21')]=_0x361866;if(_0x354f4c['query'][_0x014a('0x46')]){_0xc802d5[_0x014a('0x47')]=[{'all':!![]}];}return db[_0x014a('0x30')]['findAll'](_0xc802d5);})[_0x014a('0x27')](function(_0x50a8f0){_0x9dfb11['rows']=_0x50a8f0;return _0x9dfb11;})[_0x014a('0x27')](respondWithFilteredResult(_0x1dae8e,_0xc802d5))[_0x014a('0x48')](handleError(_0x1dae8e,null));};exports['show']=function(_0x1557ad,_0x11c0d5){var _0xa4b68e={'raw':![],'where':{'id':_0x1557ad[_0x014a('0x49')]['id']}},_0x15c5dc={};_0x15c5dc[_0x014a('0x39')]=_['keys'](db[_0x014a('0x30')][_0x014a('0x31')]);_0x15c5dc[_0x014a('0x36')]=_['keys'](_0x1557ad['query']);_0x15c5dc[_0x014a('0x37')]=_['intersection'](_0x15c5dc['model'],_0x15c5dc[_0x014a('0x36')]);_0xa4b68e['attributes']=_[_0x014a('0x38')](_0x15c5dc[_0x014a('0x39')],qs[_0x014a('0x3b')](_0x1557ad['query'][_0x014a('0x3b')]));_0xa4b68e[_0x014a('0x3a')]=_0xa4b68e[_0x014a('0x3a')][_0x014a('0x3c')]?_0xa4b68e[_0x014a('0x3a')]:_0x15c5dc[_0x014a('0x39')];if(_0x1557ad['query'][_0x014a('0x46')]){_0xa4b68e[_0x014a('0x47')]=[{'all':!![]}];}_0xa4b68e=_['merge']({},_0xa4b68e,_0x1557ad[_0x014a('0x45')]);return db[_0x014a('0x30')][_0x014a('0x4a')](_0xa4b68e)[_0x014a('0x27')](handleEntityNotFound(_0x11c0d5,null))[_0x014a('0x27')](respondWithResult(_0x11c0d5,null))[_0x014a('0x48')](handleError(_0x11c0d5,null));};exports[_0x014a('0x4b')]=function(_0x21680f,_0x4aa72b){return db[_0x014a('0x30')][_0x014a('0x4b')](_0x21680f[_0x014a('0x4c')],{})[_0x014a('0x27')](function(_0x312c7a){var _0x4b2fdb=_0x21680f[_0x014a('0x4d')]['get']({'plain':!![]});if(!_0x4b2fdb)throw new Error(_0x014a('0x4e'));if(_0x4b2fdb[_0x014a('0x4f')]===_0x014a('0x4d')){var _0x479dc0=_0x312c7a[_0x014a('0x50')]({'plain':!![]});var _0x4f8547='Teams';return db['UserProfileSection']['find']({'where':{'name':_0x4f8547,'userProfileId':_0x4b2fdb[_0x014a('0x51')]},'raw':!![]})['then'](function(_0x1fe253){if(_0x1fe253&&_0x1fe253['autoAssociation']===0x0){return db['UserProfileResource'][_0x014a('0x4b')]({'name':_0x479dc0['name'],'resourceId':_0x479dc0['id'],'type':_0x1fe253[_0x014a('0x2c')],'sectionId':_0x1fe253['id']},{})[_0x014a('0x27')](function(){return _0x312c7a;});}else{return _0x312c7a;}})[_0x014a('0x48')](function(_0x3c7e06){logger[_0x014a('0x52')](_0x014a('0x53'),_0x3c7e06);throw _0x3c7e06;});}return _0x312c7a;})[_0x014a('0x27')](respondWithResult(_0x4aa72b,0xc9))[_0x014a('0x48')](handleError(_0x4aa72b,null));};exports[_0x014a('0x26')]=function(_0x3fc9ab,_0x4de0ec){if(_0x3fc9ab['body']['id']){delete _0x3fc9ab[_0x014a('0x4c')]['id'];}return db[_0x014a('0x30')][_0x014a('0x4a')]({'where':{'id':_0x3fc9ab['params']['id']}})['then'](handleEntityNotFound(_0x4de0ec,null))[_0x014a('0x27')](saveUpdates(_0x3fc9ab['body'],null))[_0x014a('0x27')](respondWithResult(_0x4de0ec,null))[_0x014a('0x48')](handleError(_0x4de0ec,null));};exports[_0x014a('0x28')]=function(_0x518c33,_0x53e631){return db[_0x014a('0x30')][_0x014a('0x4a')]({'where':{'id':_0x518c33[_0x014a('0x49')]['id']}})['then'](handleEntityNotFound(_0x53e631,null))[_0x014a('0x27')](removeEntity(_0x53e631,null))['catch'](handleError(_0x53e631,null));};exports[_0x014a('0x54')]=function(_0x47074f,_0x34736b,_0x24d433){return db[_0x014a('0x30')][_0x014a('0x55')]({'where':{'id':_0x47074f['params']['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x34736b,null))[_0x014a('0x27')](function(_0x29da9b){if(!_0x47074f['query'][_0x014a('0x56')]||!utils[_0x014a('0x57')](_0x47074f[_0x014a('0x36')][_0x014a('0x56')])){throw new db[(_0x014a('0x58'))]['ValidationError'](_0x014a('0x59'));}var _0x46168d={};var _0x63c341={};_0x63c341[_0x014a('0x39')]=_[_0x014a('0x35')](db[_[_0x014a('0x5a')](_0x47074f[_0x014a('0x36')][_0x014a('0x56')][_0x014a('0x5b')]())+_0x014a('0x5c')][_0x014a('0x31')]);_0x63c341[_0x014a('0x36')]=_['keys'](_0x47074f[_0x014a('0x36')]);_0x63c341['filters']=_['intersection'](_0x63c341['model'],_0x63c341['query']);_0x46168d['attributes']=_[_0x014a('0x38')](_0x63c341[_0x014a('0x39')],qs[_0x014a('0x3b')](_0x47074f['query'][_0x014a('0x3b')]));_0x46168d[_0x014a('0x3a')]=_0x46168d[_0x014a('0x3a')][_0x014a('0x3c')]?_0x46168d['attributes']:_0x63c341['model'];_0x46168d[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x47074f[_0x014a('0x36')][_0x014a('0x20')]);_0x46168d[_0x014a('0x1e')]=qs[_0x014a('0x1e')](_0x47074f[_0x014a('0x36')][_0x014a('0x1e')]);_0x46168d[_0x014a('0x3f')]=qs[_0x014a('0x40')](_0x47074f[_0x014a('0x36')]['sort']);_0x46168d[_0x014a('0x41')]=qs[_0x014a('0x37')](_['pick'](_0x47074f[_0x014a('0x36')],_0x63c341[_0x014a('0x37')]));_0x46168d=_['merge']({},_0x46168d,_0x47074f[_0x014a('0x45')]);return _0x29da9b['get'+_[_0x014a('0x5a')](_0x47074f[_0x014a('0x36')][_0x014a('0x56')][_0x014a('0x5b')]())+_0x014a('0x5d')](_0x46168d);})['then'](respondWithResult(_0x34736b,null))[_0x014a('0x48')](handleError(_0x34736b,null));};exports[_0x014a('0x5e')]=function(_0x107e1c,_0x36a756,_0xbad5ef){return db['Team'][_0x014a('0x55')]({'where':{'id':_0x107e1c[_0x014a('0x49')]['id']}})[_0x014a('0x27')](function(_0x5f3224){if(_0x5f3224){if(!_0x107e1c[_0x014a('0x4c')]['channel']||!utils[_0x014a('0x57')](_0x107e1c[_0x014a('0x4c')][_0x014a('0x56')])){throw new db[(_0x014a('0x58'))][(_0x014a('0x5f'))](_0x014a('0x59'));}return _0x5f3224[_0x014a('0x60')+_['capitalize'](_0x107e1c['body'][_0x014a('0x56')]['toLowerCase']())+_0x014a('0x5d')](_0x107e1c['body'][_0x014a('0x61')]);}return null;})[_0x014a('0x27')](handleEntityNotFound(_0x36a756,null))['then'](respondWithStatusCode(_0x36a756,null))['catch'](handleError(_0x36a756,null));};exports[_0x014a('0x62')]=function(_0x8234ee,_0x5f391d,_0x882fc9){return db[_0x014a('0x30')]['findOne']({'where':{'id':_0x8234ee['params']['id']}})[_0x014a('0x27')](function(_0xfd868){if(_0xfd868){if(!_0x8234ee[_0x014a('0x36')][_0x014a('0x56')]||!utils[_0x014a('0x57')](_0x8234ee[_0x014a('0x36')]['channel'])){throw new db[(_0x014a('0x58'))]['ValidationError']('Unknown\x20channel');}return _0xfd868[_0x014a('0x63')+_[_0x014a('0x5a')](_0x8234ee['query'][_0x014a('0x56')][_0x014a('0x5b')]())+_0x014a('0x5d')](_0x8234ee[_0x014a('0x36')][_0x014a('0x61')]);}return null;})['then'](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x27')](respondWithStatusCode(_0x5f391d,null))[_0x014a('0x48')](handleError(_0x5f391d,null));};exports[_0x014a('0x64')]=function(_0x163fa2,_0x4aefeb){return db[_0x014a('0x30')]['find']({'where':{'id':_0x163fa2[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x4aefeb,null))[_0x014a('0x27')](function(_0x1310b7){if(_0x1310b7){var _0xf7c997=[_0x014a('0x65'),'Chat',_0x014a('0x66'),_0x014a('0x67'),_0x014a('0x68'),_0x014a('0x69'),_0x014a('0x6a')];return db[_0x014a('0x6b')][_0x014a('0x6c')](function(_0x28a8a9){var _0x55cfe7=_[_0x014a('0x2f')](_0xf7c997,function(_0x37c69e){var _0x3c2a39={'attributes':['id','name']};if(_0x37c69e===_0x014a('0x65')){_0x3c2a39[_0x014a('0x6d')]={'attributes':[_0x014a('0x6e')]};}return _0x1310b7[_0x014a('0x50')+_0x37c69e+_0x014a('0x5d')](_0x3c2a39)[_0x014a('0x27')](function(_0x29b061){var _0x48cec1=_['map'](_0x29b061,function(_0x54767d){var _0x547710=_[_0x014a('0x2f')](_0x163fa2[_0x014a('0x4c')][_0x014a('0x61')],function(_0x3804e1){var _0xe1b5ed={'where':{'UserId':_0x3804e1,[_0x37c69e+_0x014a('0x6f')]:_0x54767d['id']},'transaction':_0x28a8a9};if(_0x37c69e===_0x014a('0x65')){_0xe1b5ed['defaults']={'penalty':_0x54767d[_0x014a('0x70')][_0x014a('0x6e')]};}return db[_0x014a('0x71')+_0x37c69e+_0x014a('0x5c')]['findOrCreate'](_0xe1b5ed)['then'](function(){socket[_0x014a('0x72')](_0x014a('0x4d')+_0x37c69e+'Queue:save',{'UserId':_0x3804e1,[_0x37c69e+'QueueId']:_0x54767d['id']});if(_0x37c69e!==_0x014a('0x65'))return;return db['User']['findAll']({'where':{'id':_0x163fa2[_0x014a('0x4c')][_0x014a('0x61')],'online':0x1},'attributes':['id','name',_0x014a('0x73'),_0x014a('0x74'),_0x014a('0x75')],'raw':!![]})[_0x014a('0x27')](function(_0x4009be){var _0x2b99d4=_[_0x014a('0x2f')](_0x4009be,function(_0xc86f44){return db['UserVoiceQueueRt']['upsert']({'membername':_0xc86f44[_0x014a('0x2c')],'UserId':_0xc86f44['id'],'queue_name':_0x54767d['name'],'VoiceQueueId':_0x54767d['id'],'interface':_['isNil'](_0xc86f44['interface'])?util[_0x014a('0x76')](_0x014a('0x77'),_0xc86f44[_0x014a('0x2c')]):_0xc86f44['interface'],'paused':_0xc86f44[_0x014a('0x74')]||![],'penalty':_0x54767d[_0x014a('0x70')][_0x014a('0x6e')]},{'transaction':_0x28a8a9});});return Promise[_0x014a('0x78')](_0x2b99d4);});});});return Promise['all'](_0x547710);});return Promise[_0x014a('0x78')](_0x48cec1);});});return Promise[_0x014a('0x78')](_0x55cfe7)[_0x014a('0x27')](function(){return _0x1310b7['addAgents'](_0x163fa2[_0x014a('0x4c')][_0x014a('0x61')],{'transaction':_0x28a8a9})['spread'](function(_0x3bdb8c){return _0x3bdb8c;});});});}})[_0x014a('0x27')](respondWithResult(_0x4aefeb,null))[_0x014a('0x48')](handleError(_0x4aefeb,null));};exports['removeAgents']=function(_0x1a6171,_0x3680ef){return db['Team'][_0x014a('0x4a')]({'where':{'id':_0x1a6171[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x3680ef,null))[_0x014a('0x27')](function(_0x3e6926){if(_0x3e6926){var _0x7662d3=[_0x014a('0x65'),_0x014a('0x79'),'Mail',_0x014a('0x67'),_0x014a('0x68'),'Openchannel','Whatsapp'];return db[_0x014a('0x6b')][_0x014a('0x6c')](function(_0x47f3c7){var _0x577ca4=_[_0x014a('0x2f')](_0x7662d3,function(_0x216b27){var _0x5ddb47={'attributes':['id',_0x014a('0x2c')]};return _0x3e6926[_0x014a('0x50')+_0x216b27+'Queues'](_0x5ddb47)['then'](function(_0x105786){var _0x5ca631=_[_0x014a('0x2f')](_0x105786,function(_0x4f0929){return _0x4f0929[_0x014a('0x7a')](_0x1a6171[_0x014a('0x36')][_0x014a('0x61')],{'transaction':_0x47f3c7})[_0x014a('0x27')](function(){var _0x20b182=JSON['parse']('['+_0x1a6171[_0x014a('0x36')][_0x014a('0x61')]+']');var _0x2eac9d=_[_0x014a('0x2f')](_0x20b182,function(_0x360a4a){socket[_0x014a('0x72')](_0x014a('0x4d')+_0x216b27+_0x014a('0x7b'),{'UserId':Number(_0x360a4a),[_0x216b27+'QueueId']:_0x4f0929['id']});if(_0x216b27!==_0x014a('0x65'))return;return db['UserVoiceQueueRt'][_0x014a('0x28')]({'where':{'VoiceQueueId':_0x4f0929['id'],'UserId':_0x360a4a},'transaction':_0x47f3c7});});return Promise['all'](_0x2eac9d);});});return Promise['all'](_0x5ca631);});});return Promise['all'](_0x577ca4)['then'](function(){return _0x3e6926[_0x014a('0x7a')](_0x1a6171[_0x014a('0x36')][_0x014a('0x61')],{'transaction':_0x47f3c7});});});}})[_0x014a('0x27')](respondWithStatusCode(_0x3680ef,null))[_0x014a('0x48')](handleError(_0x3680ef,null));};exports[_0x014a('0x7c')]=function(_0x11c940,_0x270208,_0x5327a6){var _0x499470={};var _0x2a66a2={};var _0x172cc5;var _0x15d686;return db[_0x014a('0x30')][_0x014a('0x55')]({'where':{'id':_0x11c940[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x270208,null))[_0x014a('0x27')](function(_0x5342cc){if(_0x5342cc){_0x172cc5=_0x5342cc;_0x2a66a2[_0x014a('0x39')]=_[_0x014a('0x35')](db[_0x014a('0x71')][_0x014a('0x31')]);_0x2a66a2[_0x014a('0x36')]=_['keys'](_0x11c940[_0x014a('0x36')]);_0x2a66a2[_0x014a('0x37')]=_[_0x014a('0x38')](_0x2a66a2[_0x014a('0x39')],_0x2a66a2[_0x014a('0x36')]);_0x499470[_0x014a('0x3a')]=_[_0x014a('0x38')](_0x2a66a2['model'],qs[_0x014a('0x3b')](_0x11c940['query']['fields']));_0x499470[_0x014a('0x3a')]=_0x499470[_0x014a('0x3a')]['length']?_0x499470[_0x014a('0x3a')]:_0x2a66a2[_0x014a('0x39')];_0x499470[_0x014a('0x3f')]=qs['sort'](_0x11c940[_0x014a('0x36')][_0x014a('0x40')]);_0x499470[_0x014a('0x41')]=qs[_0x014a('0x37')](_[_0x014a('0x7d')](_0x11c940[_0x014a('0x36')],_0x2a66a2[_0x014a('0x37')]));if(_0x11c940[_0x014a('0x36')][_0x014a('0x42')]){_0x499470['where']=_['merge'](_0x499470[_0x014a('0x41')],{'$or':_[_0x014a('0x2f')](_0x499470[_0x014a('0x3a')],function(_0x54de82){var _0x350a39={};_0x350a39[_0x54de82]={'$like':'%'+_0x11c940[_0x014a('0x36')][_0x014a('0x42')]+'%'};return _0x350a39;})});}_0x499470=_[_0x014a('0x43')]({},_0x499470,_0x11c940[_0x014a('0x45')]);return _0x172cc5[_0x014a('0x7c')](_0x499470);}})['then'](function(_0x1c8cba){if(_0x1c8cba){_0x15d686=_0x1c8cba[_0x014a('0x3c')];if(!_0x11c940[_0x014a('0x36')][_0x014a('0x3d')]('nolimit')){_0x499470[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x11c940[_0x014a('0x36')][_0x014a('0x20')]);_0x499470[_0x014a('0x1e')]=qs['offset'](_0x11c940[_0x014a('0x36')]['offset']);}return _0x172cc5['getAgents'](_0x499470);}})[_0x014a('0x27')](function(_0x369fbd){if(_0x369fbd){return _0x369fbd?{'count':_0x15d686,'rows':_0x369fbd}:null;}})[_0x014a('0x27')](respondWithResult(_0x270208,null))[_0x014a('0x48')](handleError(_0x270208,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 938f5e3..b373fad 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 _0x7e07=['hook','exports','../../mysqldb','Team','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x438c51,_0x184c33){var _0x27913e=function(_0x33362f){while(--_0x33362f){_0x438c51['push'](_0x438c51['shift']());}};_0x27913e(++_0x184c33);}(_0x7e07,0x162));var _0x77e0=function(_0x269407,_0x1b8f48){_0x269407=_0x269407-0x0;var _0x24aab2=_0x7e07[_0x269407];return _0x24aab2;};'use strict';var EventEmitter=require('events');var Team=require(_0x77e0('0x0'))['db'][_0x77e0('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x77e0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x77e0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1f2827){return function(_0x5b821b,_0x25a67a,_0x3ebdcb){TeamEvents[_0x77e0('0x4')](_0x1f2827+':'+_0x5b821b['id'],_0x5b821b);TeamEvents['emit'](_0x1f2827,_0x5b821b);_0x3ebdcb(null);};}for(var e in events){if(events[_0x77e0('0x5')](e)){var event=events[e];Team[_0x77e0('0x6')](e,emitEvent(event));}}module[_0x77e0('0x7')]=TeamEvents; \ No newline at end of file +var _0xacff=['hook','exports','events','Team','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1098e3,_0x2e6831){var _0x2a3161=function(_0x3425b3){while(--_0x3425b3){_0x1098e3['push'](_0x1098e3['shift']());}};_0x2a3161(++_0x2e6831);}(_0xacff,0x17c));var _0xfacf=function(_0x1493fb,_0x3e0020){_0x1493fb=_0x1493fb-0x0;var _0x36b5e7=_0xacff[_0x1493fb];return _0x36b5e7;};'use strict';var EventEmitter=require(_0xfacf('0x0'));var Team=require('../../mysqldb')['db'][_0xfacf('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xfacf('0x2')](0x0);var events={'afterCreate':_0xfacf('0x3'),'afterUpdate':_0xfacf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x331ef0){return function(_0xf0c0fe,_0x4871be,_0x419ff1){TeamEvents[_0xfacf('0x5')](_0x331ef0+':'+_0xf0c0fe['id'],_0xf0c0fe);TeamEvents['emit'](_0x331ef0,_0xf0c0fe);_0x419ff1(null);};}for(var e in events){if(events[_0xfacf('0x6')](e)){var event=events[e];Team[_0xfacf('0x7')](e,emitEvent(event));}}module[_0xfacf('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 96d06b7..18a73a4 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 _0xa1ff=['./team.attributes','Team','teams','lodash','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1ff,0x150));var _0xfa1f=function(_0x3c4847,_0x63a94e){_0x3c4847=_0x3c4847-0x0;var _0x4eede2=_0xa1ff[_0x3c4847];return _0x4eede2;};'use strict';var _=require(_0xfa1f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfa1f('0x1'));var moment=require('moment');var BPromise=require(_0xfa1f('0x2'));var rp=require(_0xfa1f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa1f('0x4'));var config=require(_0xfa1f('0x5'));var attributes=require(_0xfa1f('0x6'));module['exports']=function(_0x37486f,_0x7f3b64){return _0x37486f['define'](_0xfa1f('0x7'),attributes,{'tableName':_0xfa1f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea1=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Team','teams','lodash','util'];(function(_0xeeb202,_0x58198f){var _0x3260b6=function(_0x25427a){while(--_0x25427a){_0xeeb202['push'](_0xeeb202['shift']());}};_0x3260b6(++_0x58198f);}(_0xcea1,0x1de));var _0x1cea=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0xcea1[_0x218994];return _0x3f350b;};'use strict';var _=require(_0x1cea('0x0'));var util=require(_0x1cea('0x1'));var logger=require(_0x1cea('0x2'))(_0x1cea('0x3'));var moment=require('moment');var BPromise=require(_0x1cea('0x4'));var rp=require(_0x1cea('0x5'));var fs=require('fs');var path=require(_0x1cea('0x6'));var rimraf=require(_0x1cea('0x7'));var config=require(_0x1cea('0x8'));var attributes=require('./team.attributes');module[_0x1cea('0x9')]=function(_0x21946e,_0x3721c5){return _0x21946e['define'](_0x1cea('0xa'),attributes,{'tableName':_0x1cea('0xb'),'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 21f96f5..7ec09ca 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 _0x2485=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s'];(function(_0x2f548b,_0x56844a){var _0x2fac1a=function(_0x529aad){while(--_0x529aad){_0x2f548b['push'](_0x2f548b['shift']());}};_0x2fac1a(++_0x56844a);}(_0x2485,0x180));var _0x5248=function(_0xd25da3,_0x2a7b4f){_0xd25da3=_0xd25da3-0x0;var _0x531cab=_0x2485[_0xd25da3];return _0x531cab;};'use strict';var _=require(_0x5248('0x0'));var util=require(_0x5248('0x1'));var moment=require(_0x5248('0x2'));var BPromise=require(_0x5248('0x3'));var rs=require(_0x5248('0x4'));var fs=require('fs');var Redis=require(_0x5248('0x5'));var db=require(_0x5248('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5248('0x7'))(_0x5248('0x8'));var config=require(_0x5248('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5248('0xa')][_0x5248('0xb')]({'port':0x232a});config[_0x5248('0xc')]=_[_0x5248('0xd')](config[_0x5248('0xc')],{'host':_0x5248('0xe'),'port':0x18eb});var socket=require(_0x5248('0xf'))(new Redis(config[_0x5248('0xc')]));require(_0x5248('0x10'))[_0x5248('0x11')](socket);function respondWithRpcPromise(_0x59f01c,_0x232ad2,_0x10244e){return new BPromise(function(_0x1a2c3c,_0x1705cb){return client[_0x5248('0x12')](_0x59f01c,_0x10244e)[_0x5248('0x13')](function(_0x178a7c){logger[_0x5248('0x14')](_0x5248('0x15'),_0x232ad2,_0x5248('0x16'));logger[_0x5248('0x17')]('Team,\x20%s,\x20%s,\x20%s',_0x232ad2,'request\x20sent',JSON[_0x5248('0x18')](_0x178a7c));if(_0x178a7c['error']){if(_0x178a7c[_0x5248('0x19')]['code']===0x1f4){logger[_0x5248('0x19')](_0x5248('0x15'),_0x232ad2,_0x178a7c[_0x5248('0x19')]['message']);return _0x1705cb(_0x178a7c['error']['message']);}logger[_0x5248('0x19')]('Team,\x20%s,\x20%s',_0x232ad2,_0x178a7c[_0x5248('0x19')][_0x5248('0x1a')]);return _0x1a2c3c(_0x178a7c[_0x5248('0x19')][_0x5248('0x1a')]);}else{logger[_0x5248('0x14')](_0x5248('0x15'),_0x232ad2,'request\x20sent');_0x1a2c3c(_0x178a7c[_0x5248('0x1b')][_0x5248('0x1a')]);}})[_0x5248('0x1c')](function(_0x4b47fb){logger['error'](_0x5248('0x15'),_0x232ad2,_0x4b47fb);_0x1705cb(_0x4b47fb);});});} \ No newline at end of file +var _0xe634=['register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./team.socket'];(function(_0x3e0807,_0x21225c){var _0x4e64a2=function(_0x426882){while(--_0x426882){_0x3e0807['push'](_0x3e0807['shift']());}};_0x4e64a2(++_0x21225c);}(_0xe634,0xdd));var _0x4e63=function(_0x4df3da,_0x3db51a){_0x4df3da=_0x4df3da-0x0;var _0x2eb2cc=_0xe634[_0x4df3da];return _0x2eb2cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e63('0x0'));var BPromise=require(_0x4e63('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e63('0x2'));var db=require(_0x4e63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e63('0x4'))(_0x4e63('0x5'));var config=require(_0x4e63('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4e63('0x7')][_0x4e63('0x8')]({'port':0x232a});config[_0x4e63('0x9')]=_[_0x4e63('0xa')](config[_0x4e63('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e63('0xb'))(new Redis(config['redis']));require(_0x4e63('0xc'))[_0x4e63('0xd')](socket);function respondWithRpcPromise(_0x11b9bc,_0x548b66,_0x5a5b38){return new BPromise(function(_0x4a6f64,_0x5e0ac9){return client[_0x4e63('0xe')](_0x11b9bc,_0x5a5b38)[_0x4e63('0xf')](function(_0x847c0){logger[_0x4e63('0x10')](_0x4e63('0x11'),_0x548b66,_0x4e63('0x12'));logger[_0x4e63('0x13')](_0x4e63('0x14'),_0x548b66,_0x4e63('0x12'),JSON[_0x4e63('0x15')](_0x847c0));if(_0x847c0[_0x4e63('0x16')]){if(_0x847c0[_0x4e63('0x16')][_0x4e63('0x17')]===0x1f4){logger[_0x4e63('0x16')](_0x4e63('0x11'),_0x548b66,_0x847c0[_0x4e63('0x16')]['message']);return _0x5e0ac9(_0x847c0['error'][_0x4e63('0x18')]);}logger[_0x4e63('0x16')](_0x4e63('0x11'),_0x548b66,_0x847c0[_0x4e63('0x16')][_0x4e63('0x18')]);return _0x4a6f64(_0x847c0[_0x4e63('0x16')][_0x4e63('0x18')]);}else{logger['info'](_0x4e63('0x11'),_0x548b66,_0x4e63('0x12'));_0x4a6f64(_0x847c0[_0x4e63('0x19')][_0x4e63('0x18')]);}})['catch'](function(_0x1ee965){logger[_0x4e63('0x16')](_0x4e63('0x11'),_0x548b66,_0x1ee965);_0x5e0ac9(_0x1ee965);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ac1624b..51caaad 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 _0x1893=['remove','update','emit','removeListener','register','length'];(function(_0x47bb02,_0x4f230b){var _0x59ca95=function(_0x2d556b){while(--_0x2d556b){_0x47bb02['push'](_0x47bb02['shift']());}};_0x59ca95(++_0x4f230b);}(_0x1893,0xa2));var _0x3189=function(_0x128641,_0x1ec4c1){_0x128641=_0x128641-0x0;var _0x228d4c=_0x1893[_0x128641];return _0x228d4c;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x3189('0x0'),_0x3189('0x1')];function createListener(_0x1b12ad,_0x106df4){return function(_0x10c189){_0x106df4[_0x3189('0x2')](_0x1b12ad,_0x10c189);};}function removeListener(_0x3953a2,_0x5371db){return function(){TeamEvents[_0x3189('0x3')](_0x3953a2,_0x5371db);};}exports[_0x3189('0x4')]=function(_0x2333e6){for(var _0x4080a9=0x0,_0x77c566=events[_0x3189('0x5')];_0x4080a9<_0x77c566;_0x4080a9++){var _0x14d84b=events[_0x4080a9];var _0x1f6764=createListener('team:'+_0x14d84b,_0x2333e6);TeamEvents['on'](_0x14d84b,_0x1f6764);}}; \ No newline at end of file +var _0x8838=['./team.events','save','remove','update','emit','removeListener','register','team:'];(function(_0x5dfa5f,_0x4b5cff){var _0x17de5a=function(_0x2794c1){while(--_0x2794c1){_0x5dfa5f['push'](_0x5dfa5f['shift']());}};_0x17de5a(++_0x4b5cff);}(_0x8838,0x90));var _0x8883=function(_0x36d67e,_0x102d73){_0x36d67e=_0x36d67e-0x0;var _0x512765=_0x8838[_0x36d67e];return _0x512765;};'use strict';var TeamEvents=require(_0x8883('0x0'));var events=[_0x8883('0x1'),_0x8883('0x2'),_0x8883('0x3')];function createListener(_0x34c74f,_0x454b0b){return function(_0xddccbc){_0x454b0b[_0x8883('0x4')](_0x34c74f,_0xddccbc);};}function removeListener(_0x3df479,_0x2d7568){return function(){TeamEvents[_0x8883('0x5')](_0x3df479,_0x2d7568);};}exports[_0x8883('0x6')]=function(_0x5c894f){for(var _0x5061d6=0x0,_0x363519=events['length'];_0x5061d6<_0x363519;_0x5061d6++){var _0x458214=events[_0x5061d6];var _0x45a59c=createListener(_0x8883('0x7')+_0x458214,_0x5c894f);TeamEvents['on'](_0x458214,_0x45a59c);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index a08ae68..60ef7c7 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ebd=['Router','fs-extra','../../components/auth/service','exports','multer','util','path','express'];(function(_0x1e900d,_0x526f4a){var _0x155a82=function(_0x590a61){while(--_0x590a61){_0x1e900d['push'](_0x1e900d['shift']());}};_0x155a82(++_0x526f4a);}(_0x1ebd,0x64));var _0xd1eb=function(_0x3a7f1f,_0x18f8b6){_0x3a7f1f=_0x3a7f1f-0x0;var _0x581ba4=_0x1ebd[_0x3a7f1f];return _0x581ba4;};'use strict';var multer=require(_0xd1eb('0x0'));var util=require(_0xd1eb('0x1'));var path=require(_0xd1eb('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1eb('0x3'));var router=express[_0xd1eb('0x4')]();var fs_extra=require(_0xd1eb('0x5'));var auth=require(_0xd1eb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xd1eb('0x7')]=router; \ No newline at end of file +var _0xc3b7=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21c228,_0x1bd9fe){var _0x37761c=function(_0x24283c){while(--_0x24283c){_0x21c228['push'](_0x21c228['shift']());}};_0x37761c(++_0x1bd9fe);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x5222f9,_0x221d67){_0x5222f9=_0x5222f9-0x0;var _0x399a0f=_0xc3b7[_0x5222f9];return _0x399a0f;};'use strict';var multer=require('multer');var util=require(_0x7c3b('0x0'));var path=require(_0x7c3b('0x1'));var timeout=require(_0x7c3b('0x2'));var express=require(_0x7c3b('0x3'));var router=express[_0x7c3b('0x4')]();var fs_extra=require(_0x7c3b('0x5'));var auth=require(_0x7c3b('0x6'));var interaction=require(_0x7c3b('0x7'));var config=require(_0x7c3b('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1e4c899..439273f 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x1cf9b6,_0x209cc3){var _0x27ff1c=function(_0x9535f6){while(--_0x9535f6){_0x1cf9b6['push'](_0x1cf9b6['shift']());}};_0x27ff1c(++_0x209cc3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index af93c99..f8e8afd 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfec=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x1de030,_0x21aa36){var _0x2fd96e=function(_0x3480c5){while(--_0x3480c5){_0x1de030['push'](_0x1de030['shift']());}};_0x2fd96e(++_0x21aa36);}(_0xcfec,0x1a5));var _0xccfe=function(_0x1519ec,_0x26ab64){_0x1519ec=_0x1519ec-0x0;var _0x4ebabc=_0xcfec[_0x1519ec];return _0x4ebabc;};'use strict';var _=require(_0xccfe('0x0'));var util=require(_0xccfe('0x1'));var logger=require(_0xccfe('0x2'))(_0xccfe('0x3'));var moment=require(_0xccfe('0x4'));var BPromise=require(_0xccfe('0x5'));var rp=require(_0xccfe('0x6'));var fs=require('fs');var path=require(_0xccfe('0x7'));var rimraf=require(_0xccfe('0x8'));var config=require(_0xccfe('0x9'));var attributes=require(_0xccfe('0xa'));module[_0xccfe('0xb')]=function(_0x2c6027,_0x5ccce1){return _0x2c6027[_0xccfe('0xc')](_0xccfe('0xd'),attributes,{'tableName':_0xccfe('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8352=['api','moment','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','util','../../config/logger'];(function(_0x2afa71,_0x3de8cc){var _0x13b6c8=function(_0x121f0c){while(--_0x121f0c){_0x2afa71['push'](_0x2afa71['shift']());}};_0x13b6c8(++_0x3de8cc);}(_0x8352,0x1cb));var _0x2835=function(_0x2da487,_0x1cd5b5){_0x2da487=_0x2da487-0x0;var _0x41ff24=_0x8352[_0x2da487];return _0x41ff24;};'use strict';var _=require(_0x2835('0x0'));var util=require(_0x2835('0x1'));var logger=require(_0x2835('0x2'))(_0x2835('0x3'));var moment=require(_0x2835('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2835('0x5'));var rimraf=require(_0x2835('0x6'));var config=require('../../config/environment');var attributes=require(_0x2835('0x7'));module[_0x2835('0x8')]=function(_0x284429,_0x5b8ddc){return _0x284429[_0x2835('0x9')](_0x2835('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index a449f12..a5f5b72 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1ff=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3a627e,_0x597c2e){var _0xec24a7=function(_0x4d4393){while(--_0x4d4393){_0x3a627e['push'](_0x3a627e['shift']());}};_0xec24a7(++_0x597c2e);}(_0xf1ff,0xda));var _0xff1f=function(_0x57c4ec,_0xfb1ad0){_0x57c4ec=_0x57c4ec-0x0;var _0x157f3c=_0xf1ff[_0x57c4ec];return _0x157f3c;};'use strict';var _=require(_0xff1f('0x0'));var util=require(_0xff1f('0x1'));var moment=require(_0xff1f('0x2'));var BPromise=require(_0xff1f('0x3'));var rs=require(_0xff1f('0x4'));var fs=require('fs');var Redis=require(_0xff1f('0x5'));var db=require(_0xff1f('0x6'))['db'];var utils=require(_0xff1f('0x7'));var logger=require(_0xff1f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xff1f('0x9'));var client=jayson[_0xff1f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34b711,_0x3ac00c,_0x5d1ad7){return new BPromise(function(_0x1123a1,_0x588989){return client[_0xff1f('0xb')](_0x34b711,_0x5d1ad7)[_0xff1f('0xc')](function(_0x58bf26){logger[_0xff1f('0xd')](_0xff1f('0xe'),_0x3ac00c,_0xff1f('0xf'));logger[_0xff1f('0x10')](_0xff1f('0x11'),_0x3ac00c,_0xff1f('0xf'),JSON[_0xff1f('0x12')](_0x58bf26));if(_0x58bf26[_0xff1f('0x13')]){if(_0x58bf26['error'][_0xff1f('0x14')]===0x1f4){logger['error'](_0xff1f('0xe'),_0x3ac00c,_0x58bf26['error'][_0xff1f('0x15')]);return _0x588989(_0x58bf26[_0xff1f('0x13')][_0xff1f('0x15')]);}logger[_0xff1f('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3ac00c,_0x58bf26[_0xff1f('0x13')][_0xff1f('0x15')]);return _0x1123a1(_0x58bf26[_0xff1f('0x13')][_0xff1f('0x15')]);}else{logger[_0xff1f('0xd')](_0xff1f('0xe'),_0x3ac00c,_0xff1f('0xf'));_0x1123a1(_0x58bf26[_0xff1f('0x16')][_0xff1f('0x15')]);}})[_0xff1f('0x17')](function(_0xb67965){logger[_0xff1f('0x13')](_0xff1f('0xe'),_0x3ac00c,_0xb67965);_0x588989(_0xb67965);});});} \ No newline at end of file +var _0xcb65=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x288006,_0x2bf241){var _0x24c625=function(_0x4c79ed){while(--_0x4c79ed){_0x288006['push'](_0x288006['shift']());}};_0x24c625(++_0x2bf241);}(_0xcb65,0x143));var _0x5cb6=function(_0x50a3e1,_0x43d894){_0x50a3e1=_0x50a3e1-0x0;var _0x3f5a7f=_0xcb65[_0x50a3e1];return _0x3f5a7f;};'use strict';var _=require(_0x5cb6('0x0'));var util=require(_0x5cb6('0x1'));var moment=require(_0x5cb6('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cb6('0x3'));var fs=require('fs');var Redis=require(_0x5cb6('0x4'));var db=require(_0x5cb6('0x5'))['db'];var utils=require(_0x5cb6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5cb6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5cb6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24ade9,_0x903e3b,_0x46f462){return new BPromise(function(_0x1bdeac,_0x2cd19f){return client[_0x5cb6('0x9')](_0x24ade9,_0x46f462)[_0x5cb6('0xa')](function(_0x2b55e3){logger['info'](_0x5cb6('0xb'),_0x903e3b,_0x5cb6('0xc'));logger[_0x5cb6('0xd')](_0x5cb6('0xe'),_0x903e3b,_0x5cb6('0xc'),JSON['stringify'](_0x2b55e3));if(_0x2b55e3['error']){if(_0x2b55e3[_0x5cb6('0xf')][_0x5cb6('0x10')]===0x1f4){logger[_0x5cb6('0xf')](_0x5cb6('0xb'),_0x903e3b,_0x2b55e3[_0x5cb6('0xf')][_0x5cb6('0x11')]);return _0x2cd19f(_0x2b55e3[_0x5cb6('0xf')][_0x5cb6('0x11')]);}logger['error'](_0x5cb6('0xb'),_0x903e3b,_0x2b55e3[_0x5cb6('0xf')][_0x5cb6('0x11')]);return _0x1bdeac(_0x2b55e3[_0x5cb6('0xf')][_0x5cb6('0x11')]);}else{logger[_0x5cb6('0x12')](_0x5cb6('0xb'),_0x903e3b,_0x5cb6('0xc'));_0x1bdeac(_0x2b55e3[_0x5cb6('0x13')]['message']);}})[_0x5cb6('0x14')](function(_0x2388d2){logger['error'](_0x5cb6('0xb'),_0x903e3b,_0x2388d2);_0x2cd19f(_0x2388d2);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 9a62163..e578c37 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 _0xda19=['isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xda19,0xd5));var _0x9da1=function(_0x160918,_0x59a227){_0x160918=_0x160918-0x0;var _0x22d127=_0xda19[_0x160918];return _0x22d127;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0x7')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9da1('0xc')]('/:id',auth[_0x9da1('0x8')](),controller[_0x9da1('0xd')]);router[_0x9da1('0xe')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xf')]);module[_0x9da1('0x10')]=router; \ No newline at end of file +var _0x2eb2=['/:id','show','post','create','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x405c47,_0x1d2679){var _0x1a55a7=function(_0x3f42e4){while(--_0x3f42e4){_0x405c47['push'](_0x405c47['shift']());}};_0x1a55a7(++_0x1d2679);}(_0x2eb2,0x19f));var _0x22eb=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x2eb2[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x22eb('0x7')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0x9')]);router[_0x22eb('0x7')](_0x22eb('0xa'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['delete']('/:id',auth[_0x22eb('0x8')](),controller['destroy']);module[_0x22eb('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d2cac13..5d7d2e0 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 _0xe2a4=['exports','STRING','TEXT','sequelize'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xe2a4,0x193));var _0x4e2a=function(_0x2742db,_0x58e00c){_0x2742db=_0x2742db-0x0;var _0x18659e=_0xe2a4[_0x2742db];return _0x18659e;};'use strict';var Sequelize=require(_0x4e2a('0x0'));module[_0x4e2a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4e2a('0x2')]},'html':{'type':Sequelize[_0x4e2a('0x3')]}}; \ No newline at end of file +var _0x4784=['sequelize','STRING','TEXT'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x4784,0x9f));var _0x4478=function(_0x1e2ee4,_0x528218){_0x1e2ee4=_0x1e2ee4-0x0;var _0x210627=_0x4784[_0x1e2ee4];return _0x210627;};'use strict';var Sequelize=require(_0x4478('0x0'));module['exports']={'name':{'type':Sequelize[_0x4478('0x1')]},'description':{'type':Sequelize[_0x4478('0x1')]},'html':{'type':Sequelize[_0x4478('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1effa72..ee218f8 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 _0x794d=['moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','Template','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','fast-json-patch'];(function(_0x233277,_0x2568a0){var _0x5d215e=function(_0x419752){while(--_0x419752){_0x233277['push'](_0x233277['shift']());}};_0x5d215e(++_0x2568a0);}(_0x794d,0x143));var _0xd794=function(_0x26478e,_0xa4ba6c){_0x26478e=_0x26478e-0x0;var _0x342471=_0x794d[_0x26478e];return _0x342471;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd794('0x0'));var rp=require('request-promise');var moment=require(_0xd794('0x1'));var BPromise=require(_0xd794('0x2'));var Mustache=require(_0xd794('0x3'));var util=require(_0xd794('0x4'));var path=require('path');var sox=require(_0xd794('0x5'));var csv=require(_0xd794('0x6'));var ejs=require(_0xd794('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd794('0x8'));var squel=require(_0xd794('0x9'));var crypto=require(_0xd794('0xa'));var jsforce=require(_0xd794('0xb'));var deskjs=require(_0xd794('0xc'));var toCsv=require(_0xd794('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd794('0xd'));var authService=require(_0xd794('0xe'));var qs=require(_0xd794('0xf'));var as=require(_0xd794('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd794('0x11'));var utils=require(_0xd794('0x12'));var config=require(_0xd794('0x13'));var licenseUtil=require(_0xd794('0x14'));var db=require(_0xd794('0x15'))['db'];function respondWithStatusCode(_0x346c7a,_0x54204c){_0x54204c=_0x54204c||0xcc;return function(_0x5aa2f4){if(_0x5aa2f4){return _0x346c7a[_0xd794('0x16')](_0x54204c);}return _0x346c7a[_0xd794('0x17')](_0x54204c)[_0xd794('0x18')]();};}function respondWithResult(_0x6e086c,_0x1c4170){_0x1c4170=_0x1c4170||0xc8;return function(_0x1ecf9c){if(_0x1ecf9c){return _0x6e086c['status'](_0x1c4170)[_0xd794('0x19')](_0x1ecf9c);}};}function respondWithFilteredResult(_0x555a7c,_0xd41b9e){return function(_0x37dd08){if(_0x37dd08){var _0x551c3a=typeof _0xd41b9e[_0xd794('0x1a')]===_0xd794('0x1b')&&typeof _0xd41b9e[_0xd794('0x1c')]===_0xd794('0x1b');var _0x5f00a2=_0x37dd08[_0xd794('0x1d')];var _0x1b5d3c=_0x551c3a?0x0:_0xd41b9e[_0xd794('0x1a')];var _0x369758=_0x551c3a?_0x37dd08[_0xd794('0x1d')]:_0xd41b9e[_0xd794('0x1a')]+_0xd41b9e[_0xd794('0x1c')];var _0x315508;if(_0x369758>=_0x5f00a2){_0x369758=_0x5f00a2;_0x315508=0xc8;}else{_0x315508=0xce;}_0x555a7c[_0xd794('0x17')](_0x315508);return _0x555a7c[_0xd794('0x1e')]('Content-Range',_0x1b5d3c+'-'+_0x369758+'/'+_0x5f00a2)[_0xd794('0x19')](_0x37dd08);}return null;};}function patchUpdates(_0x3e3732){return function(_0x176320){try{jsonpatch[_0xd794('0x1f')](_0x176320,_0x3e3732,!![]);}catch(_0x4ae1fa){return BPromise['reject'](_0x4ae1fa);}return _0x176320[_0xd794('0x20')]();};}function saveUpdates(_0x4e7bd7,_0x15fa00){return function(_0x5285c0){if(_0x5285c0){return _0x5285c0[_0xd794('0x21')](_0x4e7bd7)[_0xd794('0x22')](function(_0x2ad3d7){return _0x2ad3d7;});}return null;};}function removeEntity(_0x541199,_0x1b2bfb){return function(_0x482f98){if(_0x482f98){return _0x482f98[_0xd794('0x23')]()[_0xd794('0x22')](function(){var _0x470e4a=_0x482f98[_0xd794('0x24')]({'plain':!![]});var _0x12345b=_0xd794('0x25');return db[_0xd794('0x26')][_0xd794('0x23')]({'where':{'type':_0x12345b,'resourceId':_0x470e4a['id']}})['then'](function(){return _0x482f98;});})[_0xd794('0x22')](function(){_0x541199[_0xd794('0x17')](0xcc)[_0xd794('0x18')]();});}};}function handleEntityNotFound(_0x343fe3,_0x573444){return function(_0x30bde1){if(!_0x30bde1){_0x343fe3[_0xd794('0x16')](0x194);}return _0x30bde1;};}function handleError(_0x2b3b7c,_0x173e7e){_0x173e7e=_0x173e7e||0x1f4;return function(_0x3f6d9b){logger[_0xd794('0x27')](_0x3f6d9b[_0xd794('0x28')]);if(_0x3f6d9b['name']){delete _0x3f6d9b[_0xd794('0x29')];}_0x2b3b7c[_0xd794('0x17')](_0x173e7e)[_0xd794('0x2a')](_0x3f6d9b);};}exports['index']=function(_0x18216c,_0x406ff1){var _0x24ca5d={},_0x2e3806={},_0x56d1f6={'count':0x0,'rows':[]};var _0x53b4f0=_['map'](db[_0xd794('0x2b')]['rawAttributes'],function(_0x20f2a3){return{'name':_0x20f2a3[_0xd794('0x2c')],'type':_0x20f2a3[_0xd794('0x2d')][_0xd794('0x2e')]};});_0x2e3806[_0xd794('0x2f')]=_[_0xd794('0x30')](_0x53b4f0,_0xd794('0x29'));_0x2e3806[_0xd794('0x31')]=_['keys'](_0x18216c[_0xd794('0x31')]);_0x2e3806[_0xd794('0x32')]=_['intersection'](_0x2e3806[_0xd794('0x2f')],_0x2e3806[_0xd794('0x31')]);_0x24ca5d[_0xd794('0x33')]=_['intersection'](_0x2e3806[_0xd794('0x2f')],qs[_0xd794('0x34')](_0x18216c[_0xd794('0x31')][_0xd794('0x34')]));_0x24ca5d[_0xd794('0x33')]=_0x24ca5d[_0xd794('0x33')][_0xd794('0x35')]?_0x24ca5d[_0xd794('0x33')]:_0x2e3806[_0xd794('0x2f')];if(!_0x18216c[_0xd794('0x31')][_0xd794('0x36')]('nolimit')){_0x24ca5d[_0xd794('0x1c')]=qs[_0xd794('0x1c')](_0x18216c[_0xd794('0x31')][_0xd794('0x1c')]);_0x24ca5d[_0xd794('0x1a')]=qs[_0xd794('0x1a')](_0x18216c[_0xd794('0x31')][_0xd794('0x1a')]);}_0x24ca5d[_0xd794('0x37')]=qs[_0xd794('0x38')](_0x18216c[_0xd794('0x31')]['sort']);_0x24ca5d['where']=qs['filters'](_['pick'](_0x18216c[_0xd794('0x31')],_0x2e3806[_0xd794('0x32')]),_0x53b4f0);if(_0x18216c[_0xd794('0x31')]['filter']){_0x24ca5d[_0xd794('0x39')]=_['merge'](_0x24ca5d[_0xd794('0x39')],{'$or':_[_0xd794('0x30')](_0x53b4f0,function(_0x13baff){if(_0x13baff['type']!==_0xd794('0x3a')){var _0x4741b7={};_0x4741b7[_0x13baff['name']]={'$like':'%'+_0x18216c[_0xd794('0x31')][_0xd794('0x3b')]+'%'};return _0x4741b7;}})});}_0x24ca5d=_[_0xd794('0x3c')]({},_0x24ca5d,_0x18216c['options']);var _0x42eaa0={'where':_0x24ca5d[_0xd794('0x39')]};return db['Template']['count'](_0x42eaa0)[_0xd794('0x22')](function(_0xa45b4a){_0x56d1f6['count']=_0xa45b4a;if(_0x18216c[_0xd794('0x31')][_0xd794('0x3d')]){_0x24ca5d[_0xd794('0x3e')]=[{'all':!![]}];}return db[_0xd794('0x2b')][_0xd794('0x3f')](_0x24ca5d);})[_0xd794('0x22')](function(_0x382d57){_0x56d1f6[_0xd794('0x40')]=_0x382d57;return _0x56d1f6;})[_0xd794('0x22')](respondWithFilteredResult(_0x406ff1,_0x24ca5d))[_0xd794('0x41')](handleError(_0x406ff1,null));};exports[_0xd794('0x42')]=function(_0x592b38,_0x503c87){var _0x4676e8={'raw':!![],'where':{'id':_0x592b38[_0xd794('0x43')]['id']}},_0xb7b538={};_0xb7b538[_0xd794('0x2f')]=_[_0xd794('0x44')](db[_0xd794('0x2b')][_0xd794('0x45')]);_0xb7b538[_0xd794('0x31')]=_[_0xd794('0x44')](_0x592b38[_0xd794('0x31')]);_0xb7b538[_0xd794('0x32')]=_[_0xd794('0x46')](_0xb7b538[_0xd794('0x2f')],_0xb7b538['query']);_0x4676e8['attributes']=_[_0xd794('0x46')](_0xb7b538[_0xd794('0x2f')],qs[_0xd794('0x34')](_0x592b38['query'][_0xd794('0x34')]));_0x4676e8[_0xd794('0x33')]=_0x4676e8[_0xd794('0x33')][_0xd794('0x35')]?_0x4676e8['attributes']:_0xb7b538[_0xd794('0x2f')];if(_0x592b38[_0xd794('0x31')]['includeAll']){_0x4676e8[_0xd794('0x3e')]=[{'all':!![]}];}_0x4676e8=_[_0xd794('0x3c')]({},_0x4676e8,_0x592b38[_0xd794('0x47')]);return db[_0xd794('0x2b')][_0xd794('0x48')](_0x4676e8)[_0xd794('0x22')](handleEntityNotFound(_0x503c87,null))[_0xd794('0x22')](respondWithResult(_0x503c87,null))[_0xd794('0x41')](handleError(_0x503c87,null));};exports['create']=function(_0x1cf514,_0x76a805){return db['Template'][_0xd794('0x49')](_0x1cf514['body'],{})[_0xd794('0x22')](function(_0x13df76){var _0x585249=_0x1cf514[_0xd794('0x4a')][_0xd794('0x24')]({'plain':!![]});if(!_0x585249)throw new Error(_0xd794('0x4b'));if(_0x585249[_0xd794('0x4c')]==='user'){var _0x59a0c5=_0x13df76[_0xd794('0x24')]({'plain':!![]});var _0x4115c6=_0xd794('0x25');return db[_0xd794('0x4d')]['find']({'where':{'name':_0x4115c6,'userProfileId':_0x585249[_0xd794('0x4e')]},'raw':!![]})['then'](function(_0x50dfbd){if(_0x50dfbd&&_0x50dfbd['autoAssociation']===0x0){return db[_0xd794('0x26')][_0xd794('0x49')]({'name':_0x59a0c5[_0xd794('0x29')],'resourceId':_0x59a0c5['id'],'type':_0x50dfbd[_0xd794('0x29')],'sectionId':_0x50dfbd['id']},{})[_0xd794('0x22')](function(){return _0x13df76;});}else{return _0x13df76;}})[_0xd794('0x41')](function(_0x532b20){logger[_0xd794('0x27')](_0xd794('0x4f'),_0x532b20);throw _0x532b20;});}return _0x13df76;})[_0xd794('0x22')](respondWithResult(_0x76a805,0xc9))['catch'](handleError(_0x76a805,null));};exports[_0xd794('0x21')]=function(_0x48150e,_0x49c0b1){if(_0x48150e[_0xd794('0x50')]['id']){delete _0x48150e[_0xd794('0x50')]['id'];}return db['Template'][_0xd794('0x48')]({'where':{'id':_0x48150e[_0xd794('0x43')]['id']}})[_0xd794('0x22')](handleEntityNotFound(_0x49c0b1,null))['then'](saveUpdates(_0x48150e[_0xd794('0x50')],null))[_0xd794('0x22')](respondWithResult(_0x49c0b1,null))['catch'](handleError(_0x49c0b1,null));};exports[_0xd794('0x23')]=function(_0x59bd91,_0x40d2e9){return db['Template'][_0xd794('0x48')]({'where':{'id':_0x59bd91[_0xd794('0x43')]['id']}})['then'](handleEntityNotFound(_0x40d2e9,null))['then'](removeEntity(_0x40d2e9,null))[_0xd794('0x41')](handleError(_0x40d2e9,null));}; \ No newline at end of file +var _0xfb56=['set','apply','save','update','then','get','Templates','UserProfileResource','error','name','send','index','map','Template','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x1ee938,_0x22267f){var _0x3ebf3b=function(_0x10611e){while(--_0x10611e){_0x1ee938['push'](_0x1ee938['shift']());}};_0x3ebf3b(++_0x22267f);}(_0xfb56,0x84));var _0x6fb5=function(_0x1777e4,_0x38b4f8){_0x1777e4=_0x1777e4-0x0;var _0x21ecac=_0xfb56[_0x1777e4];return _0x21ecac;};'use strict';var emlformat=require(_0x6fb5('0x0'));var rimraf=require(_0x6fb5('0x1'));var zipdir=require(_0x6fb5('0x2'));var jsonpatch=require(_0x6fb5('0x3'));var rp=require(_0x6fb5('0x4'));var moment=require(_0x6fb5('0x5'));var BPromise=require(_0x6fb5('0x6'));var Mustache=require('mustache');var util=require(_0x6fb5('0x7'));var path=require(_0x6fb5('0x8'));var sox=require('sox');var csv=require(_0x6fb5('0x9'));var ejs=require(_0x6fb5('0xa'));var fs=require('fs');var fs_extra=require(_0x6fb5('0xb'));var _=require(_0x6fb5('0xc'));var squel=require(_0x6fb5('0xd'));var crypto=require('crypto');var jsforce=require(_0x6fb5('0xe'));var deskjs=require(_0x6fb5('0xf'));var toCsv=require(_0x6fb5('0x9'));var querystring=require(_0x6fb5('0x10'));var Papa=require('papaparse');var Redis=require(_0x6fb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6fb5('0x12'));var as=require(_0x6fb5('0x13'));var hardwareService=require(_0x6fb5('0x14'));var logger=require('../../config/logger')(_0x6fb5('0x15'));var utils=require(_0x6fb5('0x16'));var config=require(_0x6fb5('0x17'));var licenseUtil=require(_0x6fb5('0x18'));var db=require(_0x6fb5('0x19'))['db'];function respondWithStatusCode(_0x4d84c5,_0x340424){_0x340424=_0x340424||0xcc;return function(_0x5e5209){if(_0x5e5209){return _0x4d84c5[_0x6fb5('0x1a')](_0x340424);}return _0x4d84c5[_0x6fb5('0x1b')](_0x340424)[_0x6fb5('0x1c')]();};}function respondWithResult(_0x39ca1c,_0x1bf6d5){_0x1bf6d5=_0x1bf6d5||0xc8;return function(_0x2a72c8){if(_0x2a72c8){return _0x39ca1c[_0x6fb5('0x1b')](_0x1bf6d5)[_0x6fb5('0x1d')](_0x2a72c8);}};}function respondWithFilteredResult(_0x2a0ad4,_0x370fc0){return function(_0x45899f){if(_0x45899f){var _0x433193=typeof _0x370fc0[_0x6fb5('0x1e')]===_0x6fb5('0x1f')&&typeof _0x370fc0[_0x6fb5('0x20')]==='undefined';var _0x21e46a=_0x45899f[_0x6fb5('0x21')];var _0x5f1b0e=_0x433193?0x0:_0x370fc0[_0x6fb5('0x1e')];var _0x42fc26=_0x433193?_0x45899f['count']:_0x370fc0[_0x6fb5('0x1e')]+_0x370fc0[_0x6fb5('0x20')];var _0x4b9815;if(_0x42fc26>=_0x21e46a){_0x42fc26=_0x21e46a;_0x4b9815=0xc8;}else{_0x4b9815=0xce;}_0x2a0ad4[_0x6fb5('0x1b')](_0x4b9815);return _0x2a0ad4[_0x6fb5('0x22')]('Content-Range',_0x5f1b0e+'-'+_0x42fc26+'/'+_0x21e46a)[_0x6fb5('0x1d')](_0x45899f);}return null;};}function patchUpdates(_0x264719){return function(_0x3e09bb){try{jsonpatch[_0x6fb5('0x23')](_0x3e09bb,_0x264719,!![]);}catch(_0x246837){return BPromise['reject'](_0x246837);}return _0x3e09bb[_0x6fb5('0x24')]();};}function saveUpdates(_0x5438ba,_0x33911c){return function(_0x34f204){if(_0x34f204){return _0x34f204[_0x6fb5('0x25')](_0x5438ba)[_0x6fb5('0x26')](function(_0xb4cbc9){return _0xb4cbc9;});}return null;};}function removeEntity(_0x411815,_0x3ba19b){return function(_0x3a5d3b){if(_0x3a5d3b){return _0x3a5d3b['destroy']()[_0x6fb5('0x26')](function(){var _0x145cdd=_0x3a5d3b[_0x6fb5('0x27')]({'plain':!![]});var _0x3dea76=_0x6fb5('0x28');return db[_0x6fb5('0x29')]['destroy']({'where':{'type':_0x3dea76,'resourceId':_0x145cdd['id']}})[_0x6fb5('0x26')](function(){return _0x3a5d3b;});})['then'](function(){_0x411815[_0x6fb5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e221,_0x4a04b8){return function(_0x3b1936){if(!_0x3b1936){_0x13e221[_0x6fb5('0x1a')](0x194);}return _0x3b1936;};}function handleError(_0x328b15,_0x3b7bb9){_0x3b7bb9=_0x3b7bb9||0x1f4;return function(_0x1cba41){logger[_0x6fb5('0x2a')](_0x1cba41['stack']);if(_0x1cba41['name']){delete _0x1cba41[_0x6fb5('0x2b')];}_0x328b15['status'](_0x3b7bb9)[_0x6fb5('0x2c')](_0x1cba41);};}exports[_0x6fb5('0x2d')]=function(_0x56532a,_0x1424e4){var _0x14e7db={},_0x4d24b7={},_0x1bb3d5={'count':0x0,'rows':[]};var _0x113a3a=_[_0x6fb5('0x2e')](db[_0x6fb5('0x2f')][_0x6fb5('0x30')],function(_0x387e3b){return{'name':_0x387e3b['fieldName'],'type':_0x387e3b[_0x6fb5('0x31')][_0x6fb5('0x32')]};});_0x4d24b7[_0x6fb5('0x33')]=_[_0x6fb5('0x2e')](_0x113a3a,'name');_0x4d24b7[_0x6fb5('0x34')]=_[_0x6fb5('0x35')](_0x56532a[_0x6fb5('0x34')]);_0x4d24b7[_0x6fb5('0x36')]=_[_0x6fb5('0x37')](_0x4d24b7[_0x6fb5('0x33')],_0x4d24b7[_0x6fb5('0x34')]);_0x14e7db['attributes']=_['intersection'](_0x4d24b7[_0x6fb5('0x33')],qs[_0x6fb5('0x38')](_0x56532a['query'][_0x6fb5('0x38')]));_0x14e7db[_0x6fb5('0x39')]=_0x14e7db[_0x6fb5('0x39')]['length']?_0x14e7db['attributes']:_0x4d24b7[_0x6fb5('0x33')];if(!_0x56532a[_0x6fb5('0x34')]['hasOwnProperty'](_0x6fb5('0x3a'))){_0x14e7db[_0x6fb5('0x20')]=qs[_0x6fb5('0x20')](_0x56532a['query'][_0x6fb5('0x20')]);_0x14e7db[_0x6fb5('0x1e')]=qs[_0x6fb5('0x1e')](_0x56532a[_0x6fb5('0x34')]['offset']);}_0x14e7db[_0x6fb5('0x3b')]=qs['sort'](_0x56532a[_0x6fb5('0x34')][_0x6fb5('0x3c')]);_0x14e7db['where']=qs['filters'](_[_0x6fb5('0x3d')](_0x56532a[_0x6fb5('0x34')],_0x4d24b7['filters']),_0x113a3a);if(_0x56532a[_0x6fb5('0x34')][_0x6fb5('0x3e')]){_0x14e7db[_0x6fb5('0x3f')]=_[_0x6fb5('0x40')](_0x14e7db[_0x6fb5('0x3f')],{'$or':_[_0x6fb5('0x2e')](_0x113a3a,function(_0x179dbe){if(_0x179dbe[_0x6fb5('0x31')]!==_0x6fb5('0x41')){var _0x459738={};_0x459738[_0x179dbe[_0x6fb5('0x2b')]]={'$like':'%'+_0x56532a[_0x6fb5('0x34')][_0x6fb5('0x3e')]+'%'};return _0x459738;}})});}_0x14e7db=_[_0x6fb5('0x40')]({},_0x14e7db,_0x56532a[_0x6fb5('0x42')]);var _0x3867dd={'where':_0x14e7db['where']};return db[_0x6fb5('0x2f')][_0x6fb5('0x21')](_0x3867dd)['then'](function(_0x291e27){_0x1bb3d5[_0x6fb5('0x21')]=_0x291e27;if(_0x56532a['query'][_0x6fb5('0x43')]){_0x14e7db[_0x6fb5('0x44')]=[{'all':!![]}];}return db[_0x6fb5('0x2f')][_0x6fb5('0x45')](_0x14e7db);})[_0x6fb5('0x26')](function(_0x249659){_0x1bb3d5['rows']=_0x249659;return _0x1bb3d5;})[_0x6fb5('0x26')](respondWithFilteredResult(_0x1424e4,_0x14e7db))[_0x6fb5('0x46')](handleError(_0x1424e4,null));};exports[_0x6fb5('0x47')]=function(_0x5253b9,_0x492e54){var _0x1761ab={'raw':!![],'where':{'id':_0x5253b9[_0x6fb5('0x48')]['id']}},_0x5bfc5a={};_0x5bfc5a[_0x6fb5('0x33')]=_[_0x6fb5('0x35')](db['Template'][_0x6fb5('0x30')]);_0x5bfc5a[_0x6fb5('0x34')]=_[_0x6fb5('0x35')](_0x5253b9[_0x6fb5('0x34')]);_0x5bfc5a['filters']=_[_0x6fb5('0x37')](_0x5bfc5a[_0x6fb5('0x33')],_0x5bfc5a[_0x6fb5('0x34')]);_0x1761ab['attributes']=_[_0x6fb5('0x37')](_0x5bfc5a[_0x6fb5('0x33')],qs[_0x6fb5('0x38')](_0x5253b9[_0x6fb5('0x34')][_0x6fb5('0x38')]));_0x1761ab['attributes']=_0x1761ab['attributes'][_0x6fb5('0x49')]?_0x1761ab[_0x6fb5('0x39')]:_0x5bfc5a[_0x6fb5('0x33')];if(_0x5253b9[_0x6fb5('0x34')]['includeAll']){_0x1761ab[_0x6fb5('0x44')]=[{'all':!![]}];}_0x1761ab=_[_0x6fb5('0x40')]({},_0x1761ab,_0x5253b9['options']);return db[_0x6fb5('0x2f')][_0x6fb5('0x4a')](_0x1761ab)[_0x6fb5('0x26')](handleEntityNotFound(_0x492e54,null))[_0x6fb5('0x26')](respondWithResult(_0x492e54,null))[_0x6fb5('0x46')](handleError(_0x492e54,null));};exports['create']=function(_0x30ddc3,_0x1ea5ba){return db[_0x6fb5('0x2f')][_0x6fb5('0x4b')](_0x30ddc3[_0x6fb5('0x4c')],{})[_0x6fb5('0x26')](function(_0x4d8ea9){var _0x239bbd=_0x30ddc3[_0x6fb5('0x4d')][_0x6fb5('0x27')]({'plain':!![]});if(!_0x239bbd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x239bbd[_0x6fb5('0x4e')]===_0x6fb5('0x4d')){var _0x44b308=_0x4d8ea9['get']({'plain':!![]});var _0x3a5126=_0x6fb5('0x28');return db[_0x6fb5('0x4f')]['find']({'where':{'name':_0x3a5126,'userProfileId':_0x239bbd['userProfileId']},'raw':!![]})['then'](function(_0x78a274){if(_0x78a274&&_0x78a274[_0x6fb5('0x50')]===0x0){return db[_0x6fb5('0x29')][_0x6fb5('0x4b')]({'name':_0x44b308[_0x6fb5('0x2b')],'resourceId':_0x44b308['id'],'type':_0x78a274[_0x6fb5('0x2b')],'sectionId':_0x78a274['id']},{})[_0x6fb5('0x26')](function(){return _0x4d8ea9;});}else{return _0x4d8ea9;}})[_0x6fb5('0x46')](function(_0x37171a){logger[_0x6fb5('0x2a')](_0x6fb5('0x51'),_0x37171a);throw _0x37171a;});}return _0x4d8ea9;})[_0x6fb5('0x26')](respondWithResult(_0x1ea5ba,0xc9))[_0x6fb5('0x46')](handleError(_0x1ea5ba,null));};exports[_0x6fb5('0x25')]=function(_0x2b062f,_0x3a8efc){if(_0x2b062f[_0x6fb5('0x4c')]['id']){delete _0x2b062f['body']['id'];}return db[_0x6fb5('0x2f')]['find']({'where':{'id':_0x2b062f[_0x6fb5('0x48')]['id']}})[_0x6fb5('0x26')](handleEntityNotFound(_0x3a8efc,null))[_0x6fb5('0x26')](saveUpdates(_0x2b062f[_0x6fb5('0x4c')],null))['then'](respondWithResult(_0x3a8efc,null))['catch'](handleError(_0x3a8efc,null));};exports[_0x6fb5('0x52')]=function(_0x47b6b6,_0xa3f7a3){return db[_0x6fb5('0x2f')]['find']({'where':{'id':_0x47b6b6['params']['id']}})['then'](handleEntityNotFound(_0xa3f7a3,null))[_0x6fb5('0x26')](removeEntity(_0xa3f7a3,null))[_0x6fb5('0x46')](handleError(_0xa3f7a3,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5231bb2..7429498 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 _0x2d26=['moment','path','rimraf','./template.attributes','Template','tools_templates','lodash','util','../../config/logger','api'];(function(_0x281fd1,_0x5da85d){var _0x568df1=function(_0x417862){while(--_0x417862){_0x281fd1['push'](_0x281fd1['shift']());}};_0x568df1(++_0x5da85d);}(_0x2d26,0x88));var _0x62d2=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x2d26[_0x521929];return _0x632436;};'use strict';var _=require(_0x62d2('0x0'));var util=require(_0x62d2('0x1'));var logger=require(_0x62d2('0x2'))(_0x62d2('0x3'));var moment=require(_0x62d2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x62d2('0x5'));var rimraf=require(_0x62d2('0x6'));var config=require('../../config/environment');var attributes=require(_0x62d2('0x7'));module['exports']=function(_0x5750b7,_0x1b9129){return _0x5750b7['define'](_0x62d2('0x8'),attributes,{'tableName':_0x62d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe24d=['../../config/logger','api','moment','request-promise','path','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0x382f44,_0x3a1b12){var _0x2fe454=function(_0x5a2e82){while(--_0x5a2e82){_0x382f44['push'](_0x382f44['shift']());}};_0x2fe454(++_0x3a1b12);}(_0xe24d,0x106));var _0xde24=function(_0x741232,_0x76da66){_0x741232=_0x741232-0x0;var _0x48196b=_0xe24d[_0x741232];return _0x48196b;};'use strict';var _=require(_0xde24('0x0'));var util=require(_0xde24('0x1'));var logger=require(_0xde24('0x2'))(_0xde24('0x3'));var moment=require(_0xde24('0x4'));var BPromise=require('bluebird');var rp=require(_0xde24('0x5'));var fs=require('fs');var path=require(_0xde24('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xde24('0x7'));module[_0xde24('0x8')]=function(_0xa447de,_0x79ece4){return _0xa447de[_0xde24('0x9')]('Template',attributes,{'tableName':_0xde24('0xa'),'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 f0cd5ef..48176ca 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 _0xa22a=['map','GetTemplate','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','options','raw','attributes','limit','include','model'];(function(_0x44427f,_0x4d5cff){var _0xd54970=function(_0x1286ea){while(--_0x1286ea){_0x44427f['push'](_0x44427f['shift']());}};_0xd54970(++_0x4d5cff);}(_0xa22a,0x1e3));var _0xaa22=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa22a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xaa22('0x0'));var moment=require(_0xaa22('0x1'));var BPromise=require(_0xaa22('0x2'));var rs=require(_0xaa22('0x3'));var fs=require('fs');var Redis=require(_0xaa22('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa22('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xaa22('0x6'));var jayson=require(_0xaa22('0x7'));var client=jayson[_0xaa22('0x8')][_0xaa22('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47b9c4,_0x1111db,_0x5f3421){return new BPromise(function(_0x163673,_0x4ca56e){return client[_0xaa22('0xa')](_0x47b9c4,_0x5f3421)[_0xaa22('0xb')](function(_0x467c59){logger['info'](_0xaa22('0xc'),_0x1111db,'request\x20sent');logger[_0xaa22('0xd')](_0xaa22('0xe'),_0x1111db,_0xaa22('0xf'),JSON['stringify'](_0x467c59));if(_0x467c59[_0xaa22('0x10')]){if(_0x467c59[_0xaa22('0x10')]['code']===0x1f4){logger[_0xaa22('0x10')]('Template,\x20%s,\x20%s',_0x1111db,_0x467c59['error'][_0xaa22('0x11')]);return _0x4ca56e(_0x467c59[_0xaa22('0x10')][_0xaa22('0x11')]);}logger[_0xaa22('0x10')]('Template,\x20%s,\x20%s',_0x1111db,_0x467c59[_0xaa22('0x10')][_0xaa22('0x11')]);return _0x163673(_0x467c59[_0xaa22('0x10')]['message']);}else{logger[_0xaa22('0x12')](_0xaa22('0xc'),_0x1111db,'request\x20sent');_0x163673(_0x467c59[_0xaa22('0x13')]['message']);}})[_0xaa22('0x14')](function(_0x547fd6){logger[_0xaa22('0x10')]('Template,\x20%s,\x20%s',_0x1111db,_0x547fd6);_0x4ca56e(_0x547fd6);});});}exports['GetTemplate']=function(_0x216fc4){var _0x47caad=this;return new Promise(function(_0x53742b,_0x5646fa){return db['Template']['findAll']({'raw':_0x216fc4['options']?_0x216fc4[_0xaa22('0x15')][_0xaa22('0x16')]===undefined?!![]:![]:!![],'where':_0x216fc4[_0xaa22('0x15')]?_0x216fc4[_0xaa22('0x15')]['where']||null:null,'attributes':_0x216fc4[_0xaa22('0x15')]?_0x216fc4[_0xaa22('0x15')][_0xaa22('0x17')]||null:null,'limit':_0x216fc4['options']?_0x216fc4['options'][_0xaa22('0x18')]||null:null,'include':_0x216fc4[_0xaa22('0x15')]?_0x216fc4[_0xaa22('0x15')][_0xaa22('0x19')]?_['map'](_0x216fc4[_0xaa22('0x15')]['include'],function(_0x30a02d){return{'model':db[_0x30a02d[_0xaa22('0x1a')]],'as':_0x30a02d['as'],'attributes':_0x30a02d[_0xaa22('0x17')],'include':_0x30a02d['include']?_[_0xaa22('0x1b')](_0x30a02d[_0xaa22('0x19')],function(_0x5179d3){return{'model':db[_0x5179d3[_0xaa22('0x1a')]],'as':_0x5179d3['as'],'attributes':_0x5179d3[_0xaa22('0x17')],'include':_0x5179d3[_0xaa22('0x19')]?_[_0xaa22('0x1b')](_0x5179d3[_0xaa22('0x19')],function(_0xd07c93){return{'model':db[_0xd07c93['model']],'as':_0xd07c93['as'],'attributes':_0xd07c93[_0xaa22('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b417a){logger[_0xaa22('0x12')](_0xaa22('0x1c'),_0x216fc4);logger[_0xaa22('0xd')](_0xaa22('0x1c'),_0x216fc4,JSON[_0xaa22('0x1d')](_0x1b417a));_0x53742b(_0x1b417a);})[_0xaa22('0x14')](function(_0x39d633){logger[_0xaa22('0x10')](_0xaa22('0x1c'),_0x39d633['message'],_0x216fc4);_0x5646fa(_0x47caad[_0xaa22('0x10')](0x1f4,_0x39d633[_0xaa22('0x11')]));});});}; \ No newline at end of file +var _0xdeae=['map','then','GetTemplate','debug','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Template,\x20%s,\x20%s','message','Template','options','attributes','limit','include','model'];(function(_0x514260,_0x1891e1){var _0x4ac81b=function(_0x53cab1){while(--_0x53cab1){_0x514260['push'](_0x514260['shift']());}};_0x4ac81b(++_0x1891e1);}(_0xdeae,0x18d));var _0xedea=function(_0x5ae8c0,_0x50ccd0){_0x5ae8c0=_0x5ae8c0-0x0;var _0x48716e=_0xdeae[_0x5ae8c0];return _0x48716e;};'use strict';var _=require('lodash');var util=require(_0xedea('0x0'));var moment=require(_0xedea('0x1'));var BPromise=require(_0xedea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedea('0x3'));var db=require(_0xedea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xedea('0x5'))('rpc');var config=require(_0xedea('0x6'));var jayson=require(_0xedea('0x7'));var client=jayson[_0xedea('0x8')][_0xedea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47fc19,_0x45f680,_0x342860){return new BPromise(function(_0x5b8e4d,_0x4c8f8d){return client['request'](_0x47fc19,_0x342860)['then'](function(_0x18a2cf){logger[_0xedea('0xa')]('Template,\x20%s,\x20%s',_0x45f680,'request\x20sent');logger['debug'](_0xedea('0xb'),_0x45f680,_0xedea('0xc'),JSON['stringify'](_0x18a2cf));if(_0x18a2cf[_0xedea('0xd')]){if(_0x18a2cf['error'][_0xedea('0xe')]===0x1f4){logger[_0xedea('0xd')](_0xedea('0xf'),_0x45f680,_0x18a2cf['error'][_0xedea('0x10')]);return _0x4c8f8d(_0x18a2cf[_0xedea('0xd')][_0xedea('0x10')]);}logger[_0xedea('0xd')](_0xedea('0xf'),_0x45f680,_0x18a2cf[_0xedea('0xd')][_0xedea('0x10')]);return _0x5b8e4d(_0x18a2cf[_0xedea('0xd')][_0xedea('0x10')]);}else{logger['info'](_0xedea('0xf'),_0x45f680,_0xedea('0xc'));_0x5b8e4d(_0x18a2cf['result']['message']);}})['catch'](function(_0x46dabd){logger[_0xedea('0xd')](_0xedea('0xf'),_0x45f680,_0x46dabd);_0x4c8f8d(_0x46dabd);});});}exports['GetTemplate']=function(_0x402893){var _0x38e4ab=this;return new Promise(function(_0x1b5eeb,_0x52b2cd){return db[_0xedea('0x11')]['findAll']({'raw':_0x402893['options']?_0x402893[_0xedea('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x402893[_0xedea('0x12')]?_0x402893[_0xedea('0x12')]['where']||null:null,'attributes':_0x402893[_0xedea('0x12')]?_0x402893[_0xedea('0x12')][_0xedea('0x13')]||null:null,'limit':_0x402893[_0xedea('0x12')]?_0x402893[_0xedea('0x12')][_0xedea('0x14')]||null:null,'include':_0x402893[_0xedea('0x12')]?_0x402893[_0xedea('0x12')][_0xedea('0x15')]?_['map'](_0x402893[_0xedea('0x12')]['include'],function(_0x51eb9c){return{'model':db[_0x51eb9c[_0xedea('0x16')]],'as':_0x51eb9c['as'],'attributes':_0x51eb9c[_0xedea('0x13')],'include':_0x51eb9c[_0xedea('0x15')]?_[_0xedea('0x17')](_0x51eb9c['include'],function(_0x5075d0){return{'model':db[_0x5075d0[_0xedea('0x16')]],'as':_0x5075d0['as'],'attributes':_0x5075d0[_0xedea('0x13')],'include':_0x5075d0[_0xedea('0x15')]?_['map'](_0x5075d0[_0xedea('0x15')],function(_0x520681){return{'model':db[_0x520681[_0xedea('0x16')]],'as':_0x520681['as'],'attributes':_0x520681[_0xedea('0x13')]};}):[]};}):[]};}):[]:[]})[_0xedea('0x18')](function(_0x121808){logger[_0xedea('0xa')](_0xedea('0x19'),_0x402893);logger[_0xedea('0x1a')](_0xedea('0x19'),_0x402893,JSON['stringify'](_0x121808));_0x1b5eeb(_0x121808);})[_0xedea('0x1b')](function(_0x25b7f9){logger[_0xedea('0xd')](_0xedea('0x19'),_0x25b7f9[_0xedea('0x10')],_0x402893);_0x52b2cd(_0x38e4ab[_0xedea('0xd')](0x1f4,_0x25b7f9[_0xedea('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 64e7c3e..d4f7453 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 _0xcb86=['isAuthenticated','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','show','/:id/all_conditions'];(function(_0x804d17,_0x32c4a7){var _0x24cc4b=function(_0x109402){while(--_0x109402){_0x804d17['push'](_0x804d17['shift']());}};_0x24cc4b(++_0x32c4a7);}(_0xcb86,0x1c3));var _0x6cb8=function(_0x3239fd,_0x30b89a){_0x3239fd=_0x3239fd-0x0;var _0x5b76d3=_0xcb86[_0x3239fd];return _0x5b76d3;};'use strict';var multer=require(_0x6cb8('0x0'));var util=require(_0x6cb8('0x1'));var path=require('path');var timeout=require(_0x6cb8('0x2'));var express=require('express');var router=express[_0x6cb8('0x3')]();var fs_extra=require(_0x6cb8('0x4'));var auth=require(_0x6cb8('0x5'));var interaction=require(_0x6cb8('0x6'));var config=require(_0x6cb8('0x7'));var controller=require(_0x6cb8('0x8'));router[_0x6cb8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6cb8('0x9')](_0x6cb8('0xa'),auth['isAuthenticated'](),controller[_0x6cb8('0xb')]);router[_0x6cb8('0x9')](_0x6cb8('0xc'),auth[_0x6cb8('0xd')](),controller[_0x6cb8('0xe')]);router[_0x6cb8('0x9')](_0x6cb8('0xf'),auth['isAuthenticated'](),controller[_0x6cb8('0x10')]);router[_0x6cb8('0x9')](_0x6cb8('0x11'),auth[_0x6cb8('0xd')](),controller[_0x6cb8('0x12')]);router[_0x6cb8('0x13')]('/',auth['isAuthenticated'](),controller[_0x6cb8('0x14')]);router['post'](_0x6cb8('0xc'),auth[_0x6cb8('0xd')](),controller[_0x6cb8('0x15')]);router['post'](_0x6cb8('0xf'),auth[_0x6cb8('0xd')](),controller[_0x6cb8('0x16')]);router[_0x6cb8('0x13')](_0x6cb8('0x11'),auth['isAuthenticated'](),controller[_0x6cb8('0x17')]);router[_0x6cb8('0x18')](_0x6cb8('0xa'),auth[_0x6cb8('0xd')](),controller[_0x6cb8('0x19')]);router[_0x6cb8('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x6cb8('0x1b')]);module[_0x6cb8('0x1c')]=router; \ No newline at end of file +var _0x9f89=['/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','addAllCondition','post','addAnyCondition','addAction','put','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','./trigger.controller','isAuthenticated','/:id','show','get'];(function(_0x43c6db,_0x4f9d68){var _0x43890d=function(_0x5ba5ff){while(--_0x5ba5ff){_0x43c6db['push'](_0x43c6db['shift']());}};_0x43890d(++_0x4f9d68);}(_0x9f89,0x9e));var _0x99f8=function(_0x471cc1,_0x3334d7){_0x471cc1=_0x471cc1-0x0;var _0x527d64=_0x9f89[_0x471cc1];return _0x527d64;};'use strict';var multer=require(_0x99f8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x99f8('0x1'));var express=require('express');var router=express[_0x99f8('0x2')]();var fs_extra=require(_0x99f8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x99f8('0x4'));var config=require('../../config/environment');var controller=require(_0x99f8('0x5'));router['get']('/',auth[_0x99f8('0x6')](),controller['index']);router['get'](_0x99f8('0x7'),auth[_0x99f8('0x6')](),controller[_0x99f8('0x8')]);router[_0x99f8('0x9')](_0x99f8('0xa'),auth[_0x99f8('0x6')](),controller[_0x99f8('0xb')]);router[_0x99f8('0x9')](_0x99f8('0xc'),auth['isAuthenticated'](),controller[_0x99f8('0xd')]);router[_0x99f8('0x9')](_0x99f8('0xe'),auth[_0x99f8('0x6')](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0x99f8('0xf')]);router['post']('/:id/all_conditions',auth[_0x99f8('0x6')](),controller[_0x99f8('0x10')]);router[_0x99f8('0x11')](_0x99f8('0xc'),auth[_0x99f8('0x6')](),controller[_0x99f8('0x12')]);router[_0x99f8('0x11')](_0x99f8('0xe'),auth[_0x99f8('0x6')](),controller[_0x99f8('0x13')]);router[_0x99f8('0x14')](_0x99f8('0x7'),auth[_0x99f8('0x6')](),controller[_0x99f8('0x15')]);router['delete'](_0x99f8('0x7'),auth[_0x99f8('0x6')](),controller[_0x99f8('0x16')]);module[_0x99f8('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a629c59..a7ae14c 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 _0x70a7=['STRING','sequelize','exports'];(function(_0x59f33b,_0x5efafd){var _0x4124cf=function(_0x5c1ce4){while(--_0x5c1ce4){_0x59f33b['push'](_0x59f33b['shift']());}};_0x4124cf(++_0x5efafd);}(_0x70a7,0x187));var _0x770a=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x70a7[_0x496738];return _0xee1381;};'use strict';var Sequelize=require(_0x770a('0x0'));module[_0x770a('0x1')]={'name':{'type':Sequelize[_0x770a('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4d3c=['BOOLEAN','exports'];(function(_0x3eb211,_0x4a2e7f){var _0xb32a15=function(_0xff52ec){while(--_0xff52ec){_0x3eb211['push'](_0x3eb211['shift']());}};_0xb32a15(++_0x4a2e7f);}(_0x4d3c,0x141));var _0xc4d3=function(_0x1df8a8,_0x4d6d95){_0x1df8a8=_0x1df8a8-0x0;var _0x3381c9=_0x4d3c[_0x1df8a8];return _0x3381c9;};'use strict';var Sequelize=require('sequelize');module[_0xc4d3('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xc4d3('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7f08416..c2ad552 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 _0x90b7=['then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','length','order','getAllConditions','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update'];(function(_0x560d5d,_0x4f9fc6){var _0x20a655=function(_0xdac46c){while(--_0xdac46c){_0x560d5d['push'](_0x560d5d['shift']());}};_0x20a655(++_0x4f9fc6);}(_0x90b7,0x95));var _0x790b=function(_0x3710b5,_0x3cdf91){_0x3710b5=_0x3710b5-0x0;var _0x20acb1=_0x90b7[_0x3710b5];return _0x20acb1;};'use strict';var emlformat=require(_0x790b('0x0'));var rimraf=require(_0x790b('0x1'));var zipdir=require(_0x790b('0x2'));var jsonpatch=require(_0x790b('0x3'));var rp=require(_0x790b('0x4'));var moment=require(_0x790b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x790b('0x6'));var util=require('util');var path=require(_0x790b('0x7'));var sox=require(_0x790b('0x8'));var csv=require(_0x790b('0x9'));var ejs=require(_0x790b('0xa'));var fs=require('fs');var fs_extra=require(_0x790b('0xb'));var _=require(_0x790b('0xc'));var squel=require(_0x790b('0xd'));var crypto=require(_0x790b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x790b('0xf'));var toCsv=require(_0x790b('0x9'));var querystring=require('querystring');var Papa=require(_0x790b('0x10'));var Redis=require(_0x790b('0x11'));var authService=require(_0x790b('0x12'));var qs=require(_0x790b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x790b('0x14'))(_0x790b('0x15'));var utils=require(_0x790b('0x16'));var config=require(_0x790b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d0251,_0x4acd50){_0x4acd50=_0x4acd50||0xcc;return function(_0x4aa1b9){if(_0x4aa1b9){return _0x4d0251[_0x790b('0x18')](_0x4acd50);}return _0x4d0251[_0x790b('0x19')](_0x4acd50)[_0x790b('0x1a')]();};}function respondWithResult(_0x14dd80,_0x3056fd){_0x3056fd=_0x3056fd||0xc8;return function(_0x391c5e){if(_0x391c5e){return _0x14dd80[_0x790b('0x19')](_0x3056fd)[_0x790b('0x1b')](_0x391c5e);}};}function respondWithFilteredResult(_0xae3434,_0x1bfcb1){return function(_0x427c37){if(_0x427c37){var _0x459f66=typeof _0x1bfcb1[_0x790b('0x1c')]===_0x790b('0x1d')&&typeof _0x1bfcb1[_0x790b('0x1e')]===_0x790b('0x1d');var _0x2b7ced=_0x427c37[_0x790b('0x1f')];var _0x2adf58=_0x459f66?0x0:_0x1bfcb1[_0x790b('0x1c')];var _0xc02f4c=_0x459f66?_0x427c37['count']:_0x1bfcb1[_0x790b('0x1c')]+_0x1bfcb1['limit'];var _0x5d87b5;if(_0xc02f4c>=_0x2b7ced){_0xc02f4c=_0x2b7ced;_0x5d87b5=0xc8;}else{_0x5d87b5=0xce;}_0xae3434[_0x790b('0x19')](_0x5d87b5);return _0xae3434[_0x790b('0x20')](_0x790b('0x21'),_0x2adf58+'-'+_0xc02f4c+'/'+_0x2b7ced)[_0x790b('0x1b')](_0x427c37);}return null;};}function patchUpdates(_0x411423){return function(_0x4bbb5e){try{jsonpatch[_0x790b('0x22')](_0x4bbb5e,_0x411423,!![]);}catch(_0x5f2824){return BPromise[_0x790b('0x23')](_0x5f2824);}return _0x4bbb5e['save']();};}function saveUpdates(_0x57ed07,_0x2b258f){return function(_0x1488f5){if(_0x1488f5){return _0x1488f5[_0x790b('0x24')](_0x57ed07)[_0x790b('0x25')](function(_0x34c3bc){return _0x34c3bc;});}return null;};}function removeEntity(_0x8ae900,_0x53a18f){return function(_0x4eb27a){if(_0x4eb27a){return _0x4eb27a[_0x790b('0x26')]()[_0x790b('0x25')](function(){var _0x2e1700=_0x4eb27a[_0x790b('0x27')]({'plain':!![]});var _0x88d710=_0x790b('0x28');return db[_0x790b('0x29')]['destroy']({'where':{'type':_0x88d710,'resourceId':_0x2e1700['id']}})[_0x790b('0x25')](function(){return _0x4eb27a;});})[_0x790b('0x25')](function(){_0x8ae900[_0x790b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7c24,_0x50ad59){return function(_0x383249){if(!_0x383249){_0x4a7c24[_0x790b('0x18')](0x194);}return _0x383249;};}function handleError(_0x1022c7,_0x34bf4f){_0x34bf4f=_0x34bf4f||0x1f4;return function(_0x2776ed){logger[_0x790b('0x2a')](_0x2776ed[_0x790b('0x2b')]);if(_0x2776ed['name']){delete _0x2776ed[_0x790b('0x2c')];}_0x1022c7['status'](_0x34bf4f)[_0x790b('0x2d')](_0x2776ed);};}exports[_0x790b('0x2e')]=function(_0x1af566,_0x2c8816){var _0x4c3b48={},_0x521423={},_0x7ee25c={'count':0x0,'rows':[]};var _0x5a4234=_[_0x790b('0x2f')](db[_0x790b('0x30')][_0x790b('0x31')],function(_0x5160f0){return{'name':_0x5160f0[_0x790b('0x32')],'type':_0x5160f0['type'][_0x790b('0x33')]};});_0x521423[_0x790b('0x34')]=_[_0x790b('0x2f')](_0x5a4234,_0x790b('0x2c'));_0x521423['query']=_['keys'](_0x1af566[_0x790b('0x35')]);_0x521423['filters']=_[_0x790b('0x36')](_0x521423['model'],_0x521423['query']);_0x4c3b48[_0x790b('0x37')]=_[_0x790b('0x36')](_0x521423[_0x790b('0x34')],qs[_0x790b('0x38')](_0x1af566[_0x790b('0x35')][_0x790b('0x38')]));_0x4c3b48['attributes']=_0x4c3b48[_0x790b('0x37')]['length']?_0x4c3b48['attributes']:_0x521423[_0x790b('0x34')];if(!_0x1af566[_0x790b('0x35')][_0x790b('0x39')](_0x790b('0x3a'))){_0x4c3b48['limit']=qs[_0x790b('0x1e')](_0x1af566[_0x790b('0x35')][_0x790b('0x1e')]);_0x4c3b48[_0x790b('0x1c')]=qs[_0x790b('0x1c')](_0x1af566[_0x790b('0x35')][_0x790b('0x1c')]);}_0x4c3b48['order']=qs['sort'](_0x1af566[_0x790b('0x35')][_0x790b('0x3b')]);_0x4c3b48[_0x790b('0x3c')]=qs[_0x790b('0x3d')](_[_0x790b('0x3e')](_0x1af566[_0x790b('0x35')],_0x521423['filters']),_0x5a4234);if(_0x1af566[_0x790b('0x35')][_0x790b('0x3f')]){_0x4c3b48[_0x790b('0x3c')]=_[_0x790b('0x40')](_0x4c3b48[_0x790b('0x3c')],{'$or':_[_0x790b('0x2f')](_0x5a4234,function(_0x4d60f9){if(_0x4d60f9[_0x790b('0x41')]!==_0x790b('0x42')){var _0x3f5dba={};_0x3f5dba[_0x4d60f9['name']]={'$like':'%'+_0x1af566[_0x790b('0x35')][_0x790b('0x3f')]+'%'};return _0x3f5dba;}})});}_0x4c3b48=_[_0x790b('0x40')]({},_0x4c3b48,_0x1af566[_0x790b('0x43')]);var _0x3fb8ca={'where':_0x4c3b48[_0x790b('0x3c')]};return db[_0x790b('0x30')][_0x790b('0x1f')](_0x3fb8ca)[_0x790b('0x25')](function(_0x433a70){_0x7ee25c['count']=_0x433a70;if(_0x1af566['query'][_0x790b('0x44')]){_0x4c3b48[_0x790b('0x45')]=[{'all':!![]}];}return db[_0x790b('0x30')]['findAll'](_0x4c3b48);})['then'](function(_0x283162){_0x7ee25c[_0x790b('0x46')]=_0x283162;return _0x7ee25c;})['then'](respondWithFilteredResult(_0x2c8816,_0x4c3b48))[_0x790b('0x47')](handleError(_0x2c8816,null));};exports['show']=function(_0x5522ed,_0x54ca6b){var _0x22b9a2={'raw':![],'where':{'id':_0x5522ed[_0x790b('0x48')]['id']}},_0x495244={};_0x495244[_0x790b('0x34')]=_[_0x790b('0x49')](db['Trigger'][_0x790b('0x31')]);_0x495244[_0x790b('0x35')]=_[_0x790b('0x49')](_0x5522ed[_0x790b('0x35')]);_0x495244[_0x790b('0x3d')]=_['intersection'](_0x495244[_0x790b('0x34')],_0x495244['query']);_0x22b9a2[_0x790b('0x37')]=_[_0x790b('0x36')](_0x495244['model'],qs['fields'](_0x5522ed[_0x790b('0x35')][_0x790b('0x38')]));_0x22b9a2[_0x790b('0x37')]=_0x22b9a2[_0x790b('0x37')]['length']?_0x22b9a2[_0x790b('0x37')]:_0x495244['model'];if(_0x5522ed[_0x790b('0x35')][_0x790b('0x44')]){_0x22b9a2[_0x790b('0x45')]=[{'all':!![]}];}_0x22b9a2=_[_0x790b('0x40')]({},_0x22b9a2,_0x5522ed['options']);return db[_0x790b('0x30')][_0x790b('0x4a')](_0x22b9a2)[_0x790b('0x25')](handleEntityNotFound(_0x54ca6b,null))['then'](respondWithResult(_0x54ca6b,null))[_0x790b('0x47')](handleError(_0x54ca6b,null));};exports[_0x790b('0x4b')]=function(_0x1c6d56,_0x566bee){return db[_0x790b('0x30')][_0x790b('0x4b')](_0x1c6d56[_0x790b('0x4c')],{})[_0x790b('0x25')](function(_0x545d32){var _0x3247e6=_0x1c6d56['user']['get']({'plain':!![]});if(!_0x3247e6)throw new Error(_0x790b('0x4d'));if(_0x3247e6['role']==='user'){var _0x2c8385=_0x545d32[_0x790b('0x27')]({'plain':!![]});var _0x359aa4=_0x790b('0x28');return db['UserProfileSection'][_0x790b('0x4a')]({'where':{'name':_0x359aa4,'userProfileId':_0x3247e6[_0x790b('0x4e')]},'raw':!![]})[_0x790b('0x25')](function(_0x3bee98){if(_0x3bee98&&_0x3bee98[_0x790b('0x4f')]===0x0){return db[_0x790b('0x29')][_0x790b('0x4b')]({'name':_0x2c8385[_0x790b('0x2c')],'resourceId':_0x2c8385['id'],'type':_0x3bee98['name'],'sectionId':_0x3bee98['id']},{})[_0x790b('0x25')](function(){return _0x545d32;});}else{return _0x545d32;}})[_0x790b('0x47')](function(_0xfe0433){logger[_0x790b('0x2a')](_0x790b('0x50'),_0xfe0433);throw _0xfe0433;});}return _0x545d32;})[_0x790b('0x25')](respondWithResult(_0x566bee,0xc9))[_0x790b('0x47')](handleError(_0x566bee,null));};exports[_0x790b('0x24')]=function(_0x4877c7,_0x52fad5){if(_0x4877c7['body']['id']){delete _0x4877c7[_0x790b('0x4c')]['id'];}return db[_0x790b('0x30')][_0x790b('0x4a')]({'where':{'id':_0x4877c7[_0x790b('0x48')]['id']}})[_0x790b('0x25')](handleEntityNotFound(_0x52fad5,null))[_0x790b('0x25')](saveUpdates(_0x4877c7['body'],null))['then'](respondWithResult(_0x52fad5,null))[_0x790b('0x47')](handleError(_0x52fad5,null));};exports[_0x790b('0x26')]=function(_0x19601d,_0x3fb911){return db[_0x790b('0x30')][_0x790b('0x4a')]({'where':{'id':_0x19601d[_0x790b('0x48')]['id']}})[_0x790b('0x25')](handleEntityNotFound(_0x3fb911,null))[_0x790b('0x25')](removeEntity(_0x3fb911,null))[_0x790b('0x47')](handleError(_0x3fb911,null));};exports[_0x790b('0x51')]=function(_0x153d1c,_0x564ce6,_0x31d2c7){if(_0x153d1c[_0x790b('0x4c')]['id']){delete _0x153d1c[_0x790b('0x4c')]['id'];}return db[_0x790b('0x30')][_0x790b('0x4a')]({'where':{'id':_0x153d1c[_0x790b('0x48')]['id']}})[_0x790b('0x25')](handleEntityNotFound(_0x564ce6,null))[_0x790b('0x25')](function(_0x9517b7){if(_0x9517b7){_0x153d1c[_0x790b('0x4c')][_0x790b('0x52')]=_0x9517b7['id'];return db[_0x790b('0x53')][_0x790b('0x4b')](_0x153d1c[_0x790b('0x4c')]);}})[_0x790b('0x25')](respondWithResult(_0x564ce6,null))['catch'](handleError(_0x564ce6,null));};exports['addAnyCondition']=function(_0x925517,_0x4b9ec1,_0x1bd17b){if(_0x925517[_0x790b('0x4c')]['id']){delete _0x925517[_0x790b('0x4c')]['id'];}return db['Trigger'][_0x790b('0x4a')]({'where':{'id':_0x925517[_0x790b('0x48')]['id']}})[_0x790b('0x25')](handleEntityNotFound(_0x4b9ec1,null))['then'](function(_0x3894e9){if(_0x3894e9){_0x925517[_0x790b('0x4c')][_0x790b('0x54')]=_0x3894e9['id'];return db[_0x790b('0x53')][_0x790b('0x4b')](_0x925517[_0x790b('0x4c')]);}})[_0x790b('0x25')](respondWithResult(_0x4b9ec1,null))['catch'](handleError(_0x4b9ec1,null));};exports['getAllConditions']=function(_0x414cae,_0x55ca95,_0x1acc91){var _0x426f2d={};var _0x4e20ab={};var _0x53777e;var _0x47fc0d;return db[_0x790b('0x30')][_0x790b('0x55')]({'where':{'id':_0x414cae['params']['id']}})['then'](handleEntityNotFound(_0x55ca95,null))[_0x790b('0x25')](function(_0x3c27b9){if(_0x3c27b9){_0x53777e=_0x3c27b9;_0x4e20ab[_0x790b('0x34')]=_[_0x790b('0x49')](db[_0x790b('0x53')][_0x790b('0x31')]);_0x4e20ab[_0x790b('0x35')]=_[_0x790b('0x49')](_0x414cae[_0x790b('0x35')]);_0x4e20ab[_0x790b('0x3d')]=_['intersection'](_0x4e20ab[_0x790b('0x34')],_0x4e20ab[_0x790b('0x35')]);_0x426f2d[_0x790b('0x37')]=_[_0x790b('0x36')](_0x4e20ab[_0x790b('0x34')],qs['fields'](_0x414cae[_0x790b('0x35')][_0x790b('0x38')]));_0x426f2d[_0x790b('0x37')]=_0x426f2d[_0x790b('0x37')][_0x790b('0x56')]?_0x426f2d[_0x790b('0x37')]:_0x4e20ab[_0x790b('0x34')];_0x426f2d[_0x790b('0x57')]=qs[_0x790b('0x3b')](_0x414cae[_0x790b('0x35')][_0x790b('0x3b')]);_0x426f2d['where']=qs['filters'](_[_0x790b('0x3e')](_0x414cae[_0x790b('0x35')],_0x4e20ab[_0x790b('0x3d')]));if(_0x414cae[_0x790b('0x35')][_0x790b('0x3f')]){_0x426f2d[_0x790b('0x3c')]=_['merge'](_0x426f2d[_0x790b('0x3c')],{'$or':_[_0x790b('0x2f')](_0x426f2d['attributes'],function(_0x312297){var _0x28878a={};_0x28878a[_0x312297]={'$like':'%'+_0x414cae[_0x790b('0x35')][_0x790b('0x3f')]+'%'};return _0x28878a;})});}_0x426f2d=_[_0x790b('0x40')]({},_0x426f2d,_0x414cae[_0x790b('0x43')]);return _0x53777e[_0x790b('0x58')](_0x426f2d);}})[_0x790b('0x25')](function(_0x4961ae){if(_0x4961ae){_0x47fc0d=_0x4961ae[_0x790b('0x56')];if(!_0x414cae[_0x790b('0x35')]['hasOwnProperty']('nolimit')){_0x426f2d[_0x790b('0x1e')]=qs[_0x790b('0x1e')](_0x414cae[_0x790b('0x35')][_0x790b('0x1e')]);_0x426f2d[_0x790b('0x1c')]=qs[_0x790b('0x1c')](_0x414cae[_0x790b('0x35')][_0x790b('0x1c')]);}return _0x53777e[_0x790b('0x58')](_0x426f2d);}})['then'](function(_0x154867){if(_0x154867){return _0x154867?{'count':_0x47fc0d,'rows':_0x154867}:null;}})[_0x790b('0x25')](respondWithResult(_0x55ca95,null))[_0x790b('0x47')](handleError(_0x55ca95,null));};exports[_0x790b('0x59')]=function(_0x166f71,_0x106396,_0x2acd97){var _0x565484={};var _0xe663e2={};var _0x467e3f;var _0x4982ab;return db[_0x790b('0x30')][_0x790b('0x55')]({'where':{'id':_0x166f71['params']['id']}})[_0x790b('0x25')](handleEntityNotFound(_0x106396,null))[_0x790b('0x25')](function(_0x124d1a){if(_0x124d1a){_0x467e3f=_0x124d1a;_0xe663e2[_0x790b('0x34')]=_['keys'](db[_0x790b('0x53')][_0x790b('0x31')]);_0xe663e2[_0x790b('0x35')]=_[_0x790b('0x49')](_0x166f71[_0x790b('0x35')]);_0xe663e2[_0x790b('0x3d')]=_['intersection'](_0xe663e2[_0x790b('0x34')],_0xe663e2[_0x790b('0x35')]);_0x565484['attributes']=_[_0x790b('0x36')](_0xe663e2[_0x790b('0x34')],qs['fields'](_0x166f71[_0x790b('0x35')]['fields']));_0x565484[_0x790b('0x37')]=_0x565484['attributes'][_0x790b('0x56')]?_0x565484[_0x790b('0x37')]:_0xe663e2[_0x790b('0x34')];_0x565484[_0x790b('0x57')]=qs[_0x790b('0x3b')](_0x166f71[_0x790b('0x35')][_0x790b('0x3b')]);_0x565484[_0x790b('0x3c')]=qs[_0x790b('0x3d')](_['pick'](_0x166f71['query'],_0xe663e2[_0x790b('0x3d')]));if(_0x166f71[_0x790b('0x35')]['filter']){_0x565484[_0x790b('0x3c')]=_[_0x790b('0x40')](_0x565484[_0x790b('0x3c')],{'$or':_[_0x790b('0x2f')](_0x565484['attributes'],function(_0x463167){var _0x2f11c5={};_0x2f11c5[_0x463167]={'$like':'%'+_0x166f71[_0x790b('0x35')][_0x790b('0x3f')]+'%'};return _0x2f11c5;})});}_0x565484=_[_0x790b('0x40')]({},_0x565484,_0x166f71[_0x790b('0x43')]);return _0x467e3f[_0x790b('0x59')](_0x565484);}})[_0x790b('0x25')](function(_0x3ebdd4){if(_0x3ebdd4){_0x4982ab=_0x3ebdd4[_0x790b('0x56')];if(!_0x166f71[_0x790b('0x35')][_0x790b('0x39')]('nolimit')){_0x565484[_0x790b('0x1e')]=qs[_0x790b('0x1e')](_0x166f71[_0x790b('0x35')][_0x790b('0x1e')]);_0x565484[_0x790b('0x1c')]=qs[_0x790b('0x1c')](_0x166f71['query'][_0x790b('0x1c')]);}return _0x467e3f[_0x790b('0x59')](_0x565484);}})[_0x790b('0x25')](function(_0x10ec6e){if(_0x10ec6e){return _0x10ec6e?{'count':_0x4982ab,'rows':_0x10ec6e}:null;}})['then'](respondWithResult(_0x106396,null))[_0x790b('0x47')](handleError(_0x106396,null));};exports[_0x790b('0x5a')]=function(_0x562147,_0x34ae15,_0x10a70b){if(_0x562147[_0x790b('0x4c')]['id']){delete _0x562147['body']['id'];}return db['Trigger'][_0x790b('0x4a')]({'where':{'id':_0x562147[_0x790b('0x48')]['id']}})['then'](handleEntityNotFound(_0x34ae15,null))[_0x790b('0x25')](function(_0x4a5a8f){if(_0x4a5a8f){_0x562147[_0x790b('0x4c')]['TriggerId']=_0x4a5a8f['id'];return db[_0x790b('0x5b')][_0x790b('0x4b')](_0x562147[_0x790b('0x4c')]);}})[_0x790b('0x25')](respondWithResult(_0x34ae15,null))[_0x790b('0x47')](handleError(_0x34ae15,null));};exports[_0x790b('0x5c')]=function(_0x15c262,_0x3f7bf5,_0x6dfe63){var _0x2e3479={};var _0x5f1113={};var _0x27b8a8;var _0xd7f3b0;return db['Trigger'][_0x790b('0x55')]({'where':{'id':_0x15c262[_0x790b('0x48')]['id']}})[_0x790b('0x25')](handleEntityNotFound(_0x3f7bf5,null))[_0x790b('0x25')](function(_0xe48867){if(_0xe48867){_0x27b8a8=_0xe48867;_0x5f1113[_0x790b('0x34')]=_[_0x790b('0x49')](db[_0x790b('0x5b')]['rawAttributes']);_0x5f1113[_0x790b('0x35')]=_[_0x790b('0x49')](_0x15c262[_0x790b('0x35')]);_0x5f1113[_0x790b('0x3d')]=_[_0x790b('0x36')](_0x5f1113['model'],_0x5f1113[_0x790b('0x35')]);_0x2e3479[_0x790b('0x37')]=_[_0x790b('0x36')](_0x5f1113[_0x790b('0x34')],qs['fields'](_0x15c262[_0x790b('0x35')][_0x790b('0x38')]));_0x2e3479[_0x790b('0x37')]=_0x2e3479['attributes']['length']?_0x2e3479[_0x790b('0x37')]:_0x5f1113[_0x790b('0x34')];_0x2e3479['order']=qs[_0x790b('0x3b')](_0x15c262[_0x790b('0x35')][_0x790b('0x3b')]);_0x2e3479['where']=qs[_0x790b('0x3d')](_[_0x790b('0x3e')](_0x15c262['query'],_0x5f1113['filters']));if(_0x15c262[_0x790b('0x35')]['filter']){_0x2e3479['where']=_[_0x790b('0x40')](_0x2e3479[_0x790b('0x3c')],{'$or':_['map'](_0x2e3479[_0x790b('0x37')],function(_0x39a81a){var _0x13db31={};_0x13db31[_0x39a81a]={'$like':'%'+_0x15c262[_0x790b('0x35')]['filter']+'%'};return _0x13db31;})});}_0x2e3479=_['merge']({},_0x2e3479,_0x15c262[_0x790b('0x43')]);return _0x27b8a8['getActions'](_0x2e3479);}})['then'](function(_0x4207e3){if(_0x4207e3){_0xd7f3b0=_0x4207e3[_0x790b('0x56')];if(!_0x15c262['query'][_0x790b('0x39')]('nolimit')){_0x2e3479[_0x790b('0x1e')]=qs[_0x790b('0x1e')](_0x15c262[_0x790b('0x35')][_0x790b('0x1e')]);_0x2e3479[_0x790b('0x1c')]=qs['offset'](_0x15c262[_0x790b('0x35')][_0x790b('0x1c')]);}return _0x27b8a8['getActions'](_0x2e3479);}})[_0x790b('0x25')](function(_0x508e2d){if(_0x508e2d){return _0x508e2d?{'count':_0xd7f3b0,'rows':_0x508e2d}:null;}})[_0x790b('0x25')](respondWithResult(_0x3f7bf5,null))[_0x790b('0x47')](handleError(_0x3f7bf5,null));}; \ No newline at end of file +var _0x4951=['error','name','send','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Trigger','findAll','show','params','includeAll','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','end'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x4951,0x1a2));var _0x1495=function(_0x136b00,_0x447130){_0x136b00=_0x136b00-0x0;var _0x3b81ca=_0x4951[_0x136b00];return _0x3b81ca;};'use strict';var emlformat=require(_0x1495('0x0'));var rimraf=require(_0x1495('0x1'));var zipdir=require(_0x1495('0x2'));var jsonpatch=require(_0x1495('0x3'));var rp=require('request-promise');var moment=require(_0x1495('0x4'));var BPromise=require(_0x1495('0x5'));var Mustache=require('mustache');var util=require(_0x1495('0x6'));var path=require(_0x1495('0x7'));var sox=require(_0x1495('0x8'));var csv=require('to-csv');var ejs=require(_0x1495('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1495('0xa'));var squel=require(_0x1495('0xb'));var crypto=require(_0x1495('0xc'));var jsforce=require(_0x1495('0xd'));var deskjs=require(_0x1495('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1495('0xf'));var Redis=require('ioredis');var authService=require(_0x1495('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1495('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1495('0x12'))(_0x1495('0x13'));var utils=require(_0x1495('0x14'));var config=require(_0x1495('0x15'));var licenseUtil=require(_0x1495('0x16'));var db=require(_0x1495('0x17'))['db'];function respondWithStatusCode(_0x3724c4,_0x126deb){_0x126deb=_0x126deb||0xcc;return function(_0x9f50e4){if(_0x9f50e4){return _0x3724c4[_0x1495('0x18')](_0x126deb);}return _0x3724c4['status'](_0x126deb)['end']();};}function respondWithResult(_0x5c4040,_0xea260f){_0xea260f=_0xea260f||0xc8;return function(_0x1c6756){if(_0x1c6756){return _0x5c4040[_0x1495('0x19')](_0xea260f)[_0x1495('0x1a')](_0x1c6756);}};}function respondWithFilteredResult(_0x33833d,_0x2e7344){return function(_0x48d24a){if(_0x48d24a){var _0x3dc8d8=typeof _0x2e7344['offset']===_0x1495('0x1b')&&typeof _0x2e7344[_0x1495('0x1c')]==='undefined';var _0x2df02a=_0x48d24a['count'];var _0x262a9c=_0x3dc8d8?0x0:_0x2e7344[_0x1495('0x1d')];var _0x277359=_0x3dc8d8?_0x48d24a['count']:_0x2e7344[_0x1495('0x1d')]+_0x2e7344[_0x1495('0x1c')];var _0x294143;if(_0x277359>=_0x2df02a){_0x277359=_0x2df02a;_0x294143=0xc8;}else{_0x294143=0xce;}_0x33833d[_0x1495('0x19')](_0x294143);return _0x33833d[_0x1495('0x1e')](_0x1495('0x1f'),_0x262a9c+'-'+_0x277359+'/'+_0x2df02a)[_0x1495('0x1a')](_0x48d24a);}return null;};}function patchUpdates(_0x325dd0){return function(_0x607788){try{jsonpatch[_0x1495('0x20')](_0x607788,_0x325dd0,!![]);}catch(_0x5d7302){return BPromise[_0x1495('0x21')](_0x5d7302);}return _0x607788[_0x1495('0x22')]();};}function saveUpdates(_0x50efce,_0x360ef7){return function(_0x5950f6){if(_0x5950f6){return _0x5950f6[_0x1495('0x23')](_0x50efce)[_0x1495('0x24')](function(_0x364ebe){return _0x364ebe;});}return null;};}function removeEntity(_0x1c7a5d,_0x1372fd){return function(_0x16e8d5){if(_0x16e8d5){return _0x16e8d5[_0x1495('0x25')]()[_0x1495('0x24')](function(){var _0x212959=_0x16e8d5[_0x1495('0x26')]({'plain':!![]});var _0x1e3f57=_0x1495('0x27');return db[_0x1495('0x28')][_0x1495('0x25')]({'where':{'type':_0x1e3f57,'resourceId':_0x212959['id']}})[_0x1495('0x24')](function(){return _0x16e8d5;});})['then'](function(){_0x1c7a5d[_0x1495('0x19')](0xcc)[_0x1495('0x29')]();});}};}function handleEntityNotFound(_0x369fb8,_0x3c5059){return function(_0x5a4193){if(!_0x5a4193){_0x369fb8['sendStatus'](0x194);}return _0x5a4193;};}function handleError(_0x2f7c7d,_0x51cc72){_0x51cc72=_0x51cc72||0x1f4;return function(_0x25e81d){logger[_0x1495('0x2a')](_0x25e81d['stack']);if(_0x25e81d[_0x1495('0x2b')]){delete _0x25e81d[_0x1495('0x2b')];}_0x2f7c7d[_0x1495('0x19')](_0x51cc72)[_0x1495('0x2c')](_0x25e81d);};}exports['index']=function(_0x123bf9,_0x1eab65){var _0x1a80dd={},_0x39fafe={},_0xa8061a={'count':0x0,'rows':[]};var _0xb9211f=_[_0x1495('0x2d')](db['Trigger'][_0x1495('0x2e')],function(_0x5ae4c4){return{'name':_0x5ae4c4[_0x1495('0x2f')],'type':_0x5ae4c4[_0x1495('0x30')]['key']};});_0x39fafe[_0x1495('0x31')]=_[_0x1495('0x2d')](_0xb9211f,'name');_0x39fafe['query']=_[_0x1495('0x32')](_0x123bf9['query']);_0x39fafe[_0x1495('0x33')]=_[_0x1495('0x34')](_0x39fafe[_0x1495('0x31')],_0x39fafe[_0x1495('0x35')]);_0x1a80dd[_0x1495('0x36')]=_['intersection'](_0x39fafe[_0x1495('0x31')],qs[_0x1495('0x37')](_0x123bf9['query']['fields']));_0x1a80dd[_0x1495('0x36')]=_0x1a80dd[_0x1495('0x36')][_0x1495('0x38')]?_0x1a80dd[_0x1495('0x36')]:_0x39fafe[_0x1495('0x31')];if(!_0x123bf9['query'][_0x1495('0x39')](_0x1495('0x3a'))){_0x1a80dd[_0x1495('0x1c')]=qs[_0x1495('0x1c')](_0x123bf9[_0x1495('0x35')]['limit']);_0x1a80dd[_0x1495('0x1d')]=qs[_0x1495('0x1d')](_0x123bf9[_0x1495('0x35')][_0x1495('0x1d')]);}_0x1a80dd[_0x1495('0x3b')]=qs[_0x1495('0x3c')](_0x123bf9[_0x1495('0x35')][_0x1495('0x3c')]);_0x1a80dd[_0x1495('0x3d')]=qs[_0x1495('0x33')](_[_0x1495('0x3e')](_0x123bf9[_0x1495('0x35')],_0x39fafe[_0x1495('0x33')]),_0xb9211f);if(_0x123bf9[_0x1495('0x35')][_0x1495('0x3f')]){_0x1a80dd['where']=_['merge'](_0x1a80dd['where'],{'$or':_[_0x1495('0x2d')](_0xb9211f,function(_0x2f8d71){if(_0x2f8d71[_0x1495('0x30')]!==_0x1495('0x40')){var _0x1b8269={};_0x1b8269[_0x2f8d71['name']]={'$like':'%'+_0x123bf9['query'][_0x1495('0x3f')]+'%'};return _0x1b8269;}})});}_0x1a80dd=_[_0x1495('0x41')]({},_0x1a80dd,_0x123bf9[_0x1495('0x42')]);var _0x56ff6d={'where':_0x1a80dd[_0x1495('0x3d')]};return db[_0x1495('0x43')]['count'](_0x56ff6d)['then'](function(_0x48e0c8){_0xa8061a['count']=_0x48e0c8;if(_0x123bf9['query']['includeAll']){_0x1a80dd['include']=[{'all':!![]}];}return db['Trigger'][_0x1495('0x44')](_0x1a80dd);})[_0x1495('0x24')](function(_0xb8c724){_0xa8061a['rows']=_0xb8c724;return _0xa8061a;})[_0x1495('0x24')](respondWithFilteredResult(_0x1eab65,_0x1a80dd))['catch'](handleError(_0x1eab65,null));};exports[_0x1495('0x45')]=function(_0x171ea3,_0x51f5d5){var _0x3cbf2d={'raw':![],'where':{'id':_0x171ea3[_0x1495('0x46')]['id']}},_0x32b647={};_0x32b647[_0x1495('0x31')]=_['keys'](db[_0x1495('0x43')][_0x1495('0x2e')]);_0x32b647[_0x1495('0x35')]=_['keys'](_0x171ea3[_0x1495('0x35')]);_0x32b647[_0x1495('0x33')]=_[_0x1495('0x34')](_0x32b647[_0x1495('0x31')],_0x32b647[_0x1495('0x35')]);_0x3cbf2d['attributes']=_[_0x1495('0x34')](_0x32b647[_0x1495('0x31')],qs[_0x1495('0x37')](_0x171ea3['query'][_0x1495('0x37')]));_0x3cbf2d[_0x1495('0x36')]=_0x3cbf2d[_0x1495('0x36')][_0x1495('0x38')]?_0x3cbf2d[_0x1495('0x36')]:_0x32b647[_0x1495('0x31')];if(_0x171ea3['query'][_0x1495('0x47')]){_0x3cbf2d[_0x1495('0x48')]=[{'all':!![]}];}_0x3cbf2d=_[_0x1495('0x41')]({},_0x3cbf2d,_0x171ea3['options']);return db[_0x1495('0x43')][_0x1495('0x49')](_0x3cbf2d)['then'](handleEntityNotFound(_0x51f5d5,null))['then'](respondWithResult(_0x51f5d5,null))[_0x1495('0x4a')](handleError(_0x51f5d5,null));};exports[_0x1495('0x4b')]=function(_0xbcff58,_0x592c89){return db[_0x1495('0x43')][_0x1495('0x4b')](_0xbcff58[_0x1495('0x4c')],{})[_0x1495('0x24')](function(_0x4f6a31){var _0x289f7f=_0xbcff58['user'][_0x1495('0x26')]({'plain':!![]});if(!_0x289f7f)throw new Error(_0x1495('0x4d'));if(_0x289f7f[_0x1495('0x4e')]===_0x1495('0x4f')){var _0x4489c9=_0x4f6a31['get']({'plain':!![]});var _0x460632=_0x1495('0x27');return db[_0x1495('0x50')][_0x1495('0x49')]({'where':{'name':_0x460632,'userProfileId':_0x289f7f[_0x1495('0x51')]},'raw':!![]})[_0x1495('0x24')](function(_0x3b3794){if(_0x3b3794&&_0x3b3794[_0x1495('0x52')]===0x0){return db[_0x1495('0x28')][_0x1495('0x4b')]({'name':_0x4489c9['name'],'resourceId':_0x4489c9['id'],'type':_0x3b3794[_0x1495('0x2b')],'sectionId':_0x3b3794['id']},{})[_0x1495('0x24')](function(){return _0x4f6a31;});}else{return _0x4f6a31;}})[_0x1495('0x4a')](function(_0x163967){logger[_0x1495('0x2a')](_0x1495('0x53'),_0x163967);throw _0x163967;});}return _0x4f6a31;})[_0x1495('0x24')](respondWithResult(_0x592c89,0xc9))['catch'](handleError(_0x592c89,null));};exports[_0x1495('0x23')]=function(_0x8e1306,_0x2ac21b){if(_0x8e1306[_0x1495('0x4c')]['id']){delete _0x8e1306[_0x1495('0x4c')]['id'];}return db['Trigger']['find']({'where':{'id':_0x8e1306[_0x1495('0x46')]['id']}})[_0x1495('0x24')](handleEntityNotFound(_0x2ac21b,null))['then'](saveUpdates(_0x8e1306[_0x1495('0x4c')],null))[_0x1495('0x24')](respondWithResult(_0x2ac21b,null))['catch'](handleError(_0x2ac21b,null));};exports['destroy']=function(_0x19aa82,_0x7ee5ac){return db[_0x1495('0x43')][_0x1495('0x49')]({'where':{'id':_0x19aa82[_0x1495('0x46')]['id']}})[_0x1495('0x24')](handleEntityNotFound(_0x7ee5ac,null))[_0x1495('0x24')](removeEntity(_0x7ee5ac,null))[_0x1495('0x4a')](handleError(_0x7ee5ac,null));};exports['addAllCondition']=function(_0x10a16d,_0x562d2c,_0x2f45c4){if(_0x10a16d[_0x1495('0x4c')]['id']){delete _0x10a16d[_0x1495('0x4c')]['id'];}return db[_0x1495('0x43')][_0x1495('0x49')]({'where':{'id':_0x10a16d[_0x1495('0x46')]['id']}})[_0x1495('0x24')](handleEntityNotFound(_0x562d2c,null))[_0x1495('0x24')](function(_0x3a4c5c){if(_0x3a4c5c){_0x10a16d[_0x1495('0x4c')][_0x1495('0x54')]=_0x3a4c5c['id'];return db[_0x1495('0x55')][_0x1495('0x4b')](_0x10a16d[_0x1495('0x4c')]);}})[_0x1495('0x24')](respondWithResult(_0x562d2c,null))['catch'](handleError(_0x562d2c,null));};exports['addAnyCondition']=function(_0x471066,_0x129403,_0x16a9fc){if(_0x471066['body']['id']){delete _0x471066[_0x1495('0x4c')]['id'];}return db[_0x1495('0x43')][_0x1495('0x49')]({'where':{'id':_0x471066['params']['id']}})[_0x1495('0x24')](handleEntityNotFound(_0x129403,null))['then'](function(_0x29fa7e){if(_0x29fa7e){_0x471066[_0x1495('0x4c')]['TriggerAnyId']=_0x29fa7e['id'];return db[_0x1495('0x55')]['create'](_0x471066[_0x1495('0x4c')]);}})[_0x1495('0x24')](respondWithResult(_0x129403,null))[_0x1495('0x4a')](handleError(_0x129403,null));};exports[_0x1495('0x56')]=function(_0x27a4af,_0x3c76ae,_0xfa782e){var _0x4a39cd={};var _0x15651e={};var _0x501f91;var _0x1ceb1b;return db[_0x1495('0x43')]['findOne']({'where':{'id':_0x27a4af[_0x1495('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c76ae,null))['then'](function(_0x5176b0){if(_0x5176b0){_0x501f91=_0x5176b0;_0x15651e['model']=_['keys'](db[_0x1495('0x55')]['rawAttributes']);_0x15651e['query']=_[_0x1495('0x32')](_0x27a4af[_0x1495('0x35')]);_0x15651e[_0x1495('0x33')]=_[_0x1495('0x34')](_0x15651e[_0x1495('0x31')],_0x15651e[_0x1495('0x35')]);_0x4a39cd['attributes']=_[_0x1495('0x34')](_0x15651e[_0x1495('0x31')],qs[_0x1495('0x37')](_0x27a4af[_0x1495('0x35')]['fields']));_0x4a39cd['attributes']=_0x4a39cd[_0x1495('0x36')]['length']?_0x4a39cd[_0x1495('0x36')]:_0x15651e['model'];_0x4a39cd[_0x1495('0x3b')]=qs['sort'](_0x27a4af[_0x1495('0x35')]['sort']);_0x4a39cd[_0x1495('0x3d')]=qs[_0x1495('0x33')](_[_0x1495('0x3e')](_0x27a4af[_0x1495('0x35')],_0x15651e[_0x1495('0x33')]));if(_0x27a4af['query'][_0x1495('0x3f')]){_0x4a39cd[_0x1495('0x3d')]=_[_0x1495('0x41')](_0x4a39cd['where'],{'$or':_['map'](_0x4a39cd[_0x1495('0x36')],function(_0x5a031b){var _0x3e6574={};_0x3e6574[_0x5a031b]={'$like':'%'+_0x27a4af[_0x1495('0x35')][_0x1495('0x3f')]+'%'};return _0x3e6574;})});}_0x4a39cd=_['merge']({},_0x4a39cd,_0x27a4af[_0x1495('0x42')]);return _0x501f91[_0x1495('0x56')](_0x4a39cd);}})['then'](function(_0x22e531){if(_0x22e531){_0x1ceb1b=_0x22e531[_0x1495('0x38')];if(!_0x27a4af[_0x1495('0x35')]['hasOwnProperty'](_0x1495('0x3a'))){_0x4a39cd[_0x1495('0x1c')]=qs[_0x1495('0x1c')](_0x27a4af[_0x1495('0x35')][_0x1495('0x1c')]);_0x4a39cd[_0x1495('0x1d')]=qs[_0x1495('0x1d')](_0x27a4af[_0x1495('0x35')][_0x1495('0x1d')]);}return _0x501f91[_0x1495('0x56')](_0x4a39cd);}})[_0x1495('0x24')](function(_0x1b291f){if(_0x1b291f){return _0x1b291f?{'count':_0x1ceb1b,'rows':_0x1b291f}:null;}})[_0x1495('0x24')](respondWithResult(_0x3c76ae,null))[_0x1495('0x4a')](handleError(_0x3c76ae,null));};exports['getAnyConditions']=function(_0x2c3a3a,_0x5cfe12,_0x1e8c94){var _0xd41067={};var _0x2accdf={};var _0x3b4801;var _0x1dd9a4;return db[_0x1495('0x43')][_0x1495('0x57')]({'where':{'id':_0x2c3a3a[_0x1495('0x46')]['id']}})['then'](handleEntityNotFound(_0x5cfe12,null))[_0x1495('0x24')](function(_0x43539b){if(_0x43539b){_0x3b4801=_0x43539b;_0x2accdf['model']=_['keys'](db[_0x1495('0x55')]['rawAttributes']);_0x2accdf[_0x1495('0x35')]=_[_0x1495('0x32')](_0x2c3a3a[_0x1495('0x35')]);_0x2accdf[_0x1495('0x33')]=_[_0x1495('0x34')](_0x2accdf[_0x1495('0x31')],_0x2accdf[_0x1495('0x35')]);_0xd41067[_0x1495('0x36')]=_[_0x1495('0x34')](_0x2accdf['model'],qs[_0x1495('0x37')](_0x2c3a3a['query'][_0x1495('0x37')]));_0xd41067[_0x1495('0x36')]=_0xd41067[_0x1495('0x36')]['length']?_0xd41067[_0x1495('0x36')]:_0x2accdf['model'];_0xd41067[_0x1495('0x3b')]=qs['sort'](_0x2c3a3a['query'][_0x1495('0x3c')]);_0xd41067['where']=qs[_0x1495('0x33')](_[_0x1495('0x3e')](_0x2c3a3a['query'],_0x2accdf[_0x1495('0x33')]));if(_0x2c3a3a[_0x1495('0x35')][_0x1495('0x3f')]){_0xd41067['where']=_[_0x1495('0x41')](_0xd41067['where'],{'$or':_[_0x1495('0x2d')](_0xd41067['attributes'],function(_0x44ba3c){var _0x2653d7={};_0x2653d7[_0x44ba3c]={'$like':'%'+_0x2c3a3a[_0x1495('0x35')]['filter']+'%'};return _0x2653d7;})});}_0xd41067=_[_0x1495('0x41')]({},_0xd41067,_0x2c3a3a[_0x1495('0x42')]);return _0x3b4801['getAnyConditions'](_0xd41067);}})[_0x1495('0x24')](function(_0x46354c){if(_0x46354c){_0x1dd9a4=_0x46354c['length'];if(!_0x2c3a3a['query']['hasOwnProperty'](_0x1495('0x3a'))){_0xd41067[_0x1495('0x1c')]=qs[_0x1495('0x1c')](_0x2c3a3a[_0x1495('0x35')][_0x1495('0x1c')]);_0xd41067[_0x1495('0x1d')]=qs[_0x1495('0x1d')](_0x2c3a3a[_0x1495('0x35')]['offset']);}return _0x3b4801[_0x1495('0x58')](_0xd41067);}})[_0x1495('0x24')](function(_0x10cc3d){if(_0x10cc3d){return _0x10cc3d?{'count':_0x1dd9a4,'rows':_0x10cc3d}:null;}})[_0x1495('0x24')](respondWithResult(_0x5cfe12,null))['catch'](handleError(_0x5cfe12,null));};exports['addAction']=function(_0x19fca0,_0x1f2ecd,_0x58b545){if(_0x19fca0[_0x1495('0x4c')]['id']){delete _0x19fca0[_0x1495('0x4c')]['id'];}return db[_0x1495('0x43')][_0x1495('0x49')]({'where':{'id':_0x19fca0['params']['id']}})[_0x1495('0x24')](handleEntityNotFound(_0x1f2ecd,null))[_0x1495('0x24')](function(_0x551349){if(_0x551349){_0x19fca0['body'][_0x1495('0x59')]=_0x551349['id'];return db[_0x1495('0x5a')][_0x1495('0x4b')](_0x19fca0[_0x1495('0x4c')]);}})[_0x1495('0x24')](respondWithResult(_0x1f2ecd,null))[_0x1495('0x4a')](handleError(_0x1f2ecd,null));};exports[_0x1495('0x5b')]=function(_0x1574af,_0x414e55,_0x26cd86){var _0x341305={};var _0x12eea6={};var _0x3e5d22;var _0x35f0fb;return db[_0x1495('0x43')][_0x1495('0x57')]({'where':{'id':_0x1574af[_0x1495('0x46')]['id']}})[_0x1495('0x24')](handleEntityNotFound(_0x414e55,null))[_0x1495('0x24')](function(_0x285222){if(_0x285222){_0x3e5d22=_0x285222;_0x12eea6[_0x1495('0x31')]=_['keys'](db['Action'][_0x1495('0x2e')]);_0x12eea6[_0x1495('0x35')]=_[_0x1495('0x32')](_0x1574af[_0x1495('0x35')]);_0x12eea6['filters']=_['intersection'](_0x12eea6[_0x1495('0x31')],_0x12eea6['query']);_0x341305[_0x1495('0x36')]=_['intersection'](_0x12eea6[_0x1495('0x31')],qs[_0x1495('0x37')](_0x1574af['query'][_0x1495('0x37')]));_0x341305[_0x1495('0x36')]=_0x341305[_0x1495('0x36')][_0x1495('0x38')]?_0x341305[_0x1495('0x36')]:_0x12eea6[_0x1495('0x31')];_0x341305[_0x1495('0x3b')]=qs['sort'](_0x1574af[_0x1495('0x35')][_0x1495('0x3c')]);_0x341305['where']=qs[_0x1495('0x33')](_[_0x1495('0x3e')](_0x1574af[_0x1495('0x35')],_0x12eea6['filters']));if(_0x1574af[_0x1495('0x35')]['filter']){_0x341305['where']=_[_0x1495('0x41')](_0x341305[_0x1495('0x3d')],{'$or':_[_0x1495('0x2d')](_0x341305['attributes'],function(_0x13a09e){var _0x33bf01={};_0x33bf01[_0x13a09e]={'$like':'%'+_0x1574af[_0x1495('0x35')]['filter']+'%'};return _0x33bf01;})});}_0x341305=_[_0x1495('0x41')]({},_0x341305,_0x1574af[_0x1495('0x42')]);return _0x3e5d22['getActions'](_0x341305);}})[_0x1495('0x24')](function(_0x2efcdd){if(_0x2efcdd){_0x35f0fb=_0x2efcdd['length'];if(!_0x1574af[_0x1495('0x35')][_0x1495('0x39')](_0x1495('0x3a'))){_0x341305['limit']=qs[_0x1495('0x1c')](_0x1574af[_0x1495('0x35')][_0x1495('0x1c')]);_0x341305[_0x1495('0x1d')]=qs[_0x1495('0x1d')](_0x1574af[_0x1495('0x35')][_0x1495('0x1d')]);}return _0x3e5d22[_0x1495('0x5b')](_0x341305);}})[_0x1495('0x24')](function(_0x50a2ad){if(_0x50a2ad){return _0x50a2ad?{'count':_0x35f0fb,'rows':_0x50a2ad}:null;}})['then'](respondWithResult(_0x414e55,null))[_0x1495('0x4a')](handleError(_0x414e55,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a3b2218..f230880 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 _0x8913=['exports','define','Trigger','tools_triggers','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5b1551,_0x4ad506){var _0x266298=function(_0x2b73c8){while(--_0x2b73c8){_0x5b1551['push'](_0x5b1551['shift']());}};_0x266298(++_0x4ad506);}(_0x8913,0x148));var _0x3891=function(_0x176e15,_0x33a5a8){_0x176e15=_0x176e15-0x0;var _0x4fca7f=_0x8913[_0x176e15];return _0x4fca7f;};'use strict';var _=require(_0x3891('0x0'));var util=require('util');var logger=require(_0x3891('0x1'))(_0x3891('0x2'));var moment=require('moment');var BPromise=require(_0x3891('0x3'));var rp=require(_0x3891('0x4'));var fs=require('fs');var path=require(_0x3891('0x5'));var rimraf=require(_0x3891('0x6'));var config=require(_0x3891('0x7'));var attributes=require('./trigger.attributes');module[_0x3891('0x8')]=function(_0x474bae,_0x15a223){return _0x474bae[_0x3891('0x9')](_0x3891('0xa'),attributes,{'tableName':_0x3891('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x838b=['tools_triggers','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x491468,_0x42f169){var _0x5b8c22=function(_0x407a9b){while(--_0x407a9b){_0x491468['push'](_0x491468['shift']());}};_0x5b8c22(++_0x42f169);}(_0x838b,0x1b9));var _0xb838=function(_0x46f99c,_0x49994d){_0x46f99c=_0x46f99c-0x0;var _0x5a8f06=_0x838b[_0x46f99c];return _0x5a8f06;};'use strict';var _=require('lodash');var util=require(_0xb838('0x0'));var logger=require(_0xb838('0x1'))('api');var moment=require(_0xb838('0x2'));var BPromise=require(_0xb838('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb838('0x4'));var rimraf=require(_0xb838('0x5'));var config=require(_0xb838('0x6'));var attributes=require('./trigger.attributes');module[_0xb838('0x7')]=function(_0x27be64,_0x5388de){return _0x27be64[_0xb838('0x8')]('Trigger',attributes,{'tableName':_0xb838('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 32f2760..ecd9505 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 _0x065e=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','attributes','limit','include','map','model','find','ShowTrigger','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x38f3c8,_0x166d00){var _0x24d35f=function(_0x2bca36){while(--_0x2bca36){_0x38f3c8['push'](_0x38f3c8['shift']());}};_0x24d35f(++_0x166d00);}(_0x065e,0x1a7));var _0xe065=function(_0x2f42d3,_0x362e7a){_0x2f42d3=_0x2f42d3-0x0;var _0x25a67e=_0x065e[_0x2f42d3];return _0x25a67e;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x189d72,_0x52403a,_0x267122){return new BPromise(function(_0x5afbd4,_0x273e22){return client[_0xe065('0x8')](_0x189d72,_0x267122)[_0xe065('0x9')](function(_0x114497){logger[_0xe065('0xa')]('Trigger,\x20%s,\x20%s',_0x52403a,_0xe065('0xb'));logger[_0xe065('0xc')](_0xe065('0xd'),_0x52403a,_0xe065('0xb'),JSON[_0xe065('0xe')](_0x114497));if(_0x114497[_0xe065('0xf')]){if(_0x114497['error']['code']===0x1f4){logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x273e22(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x5afbd4(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}else{logger[_0xe065('0xa')](_0xe065('0x10'),_0x52403a,_0xe065('0xb'));_0x5afbd4(_0x114497[_0xe065('0x12')][_0xe065('0x11')]);}})['catch'](function(_0x1ba88d){logger[_0xe065('0xf')]('Trigger,\x20%s,\x20%s',_0x52403a,_0x1ba88d);_0x273e22(_0x1ba88d);});});}exports[_0xe065('0x13')]=function(_0x1d2f7a){var _0x397f05=this;return new Promise(function(_0x14c97c,_0x1e7177){return db[_0xe065('0x14')][_0xe065('0x15')]({'raw':_0x1d2f7a['options']?_0x1d2f7a[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')]['where']||null:null,'attributes':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a['options'][_0xe065('0x17')]||null:null,'limit':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x18')]||null:null,'include':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1d2f7a[_0xe065('0x16')]['include'],function(_0x7208af){return{'model':db[_0x7208af[_0xe065('0x1b')]],'as':_0x7208af['as'],'attributes':_0x7208af[_0xe065('0x17')],'include':_0x7208af[_0xe065('0x19')]?_['map'](_0x7208af['include'],function(_0x164965){return{'model':db[_0x164965['model']],'as':_0x164965['as'],'attributes':_0x164965[_0xe065('0x17')],'include':_0x164965[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x164965[_0xe065('0x19')],function(_0x418731){return{'model':db[_0x418731[_0xe065('0x1b')]],'as':_0x418731['as'],'attributes':_0x418731[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x52cd9c){logger['info'](_0xe065('0x13'),_0x1d2f7a);logger[_0xe065('0xc')](_0xe065('0x13'),_0x1d2f7a,JSON[_0xe065('0xe')](_0x52cd9c));_0x14c97c(_0x52cd9c);})['catch'](function(_0x23f573){logger['error']('GetTrigger',_0x23f573[_0xe065('0x11')],_0x1d2f7a);_0x1e7177(_0x397f05[_0xe065('0xf')](0x1f4,_0x23f573[_0xe065('0x11')]));});});};exports['ShowTrigger']=function(_0x883747){var _0x59b915=this;return new Promise(function(_0x12679d,_0x46db7e){return db[_0xe065('0x14')][_0xe065('0x1c')]({'raw':_0x883747['options']?_0x883747[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x883747[_0xe065('0x16')]?_0x883747[_0xe065('0x16')]['where']||null:null,'attributes':_0x883747[_0xe065('0x16')]?_0x883747['options'][_0xe065('0x17')]||null:null,'include':_0x883747['options']?_0x883747[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x883747[_0xe065('0x16')]['include'],function(_0x1fe1dc){return{'model':db[_0x1fe1dc[_0xe065('0x1b')]],'as':_0x1fe1dc['as'],'attributes':_0x1fe1dc[_0xe065('0x17')],'include':_0x1fe1dc[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1fe1dc[_0xe065('0x19')],function(_0x4b822a){return{'model':db[_0x4b822a[_0xe065('0x1b')]],'as':_0x4b822a['as'],'attributes':_0x4b822a[_0xe065('0x17')],'include':_0x4b822a['include']?_[_0xe065('0x1a')](_0x4b822a[_0xe065('0x19')],function(_0x5afc23){return{'model':db[_0x5afc23[_0xe065('0x1b')]],'as':_0x5afc23['as'],'attributes':_0x5afc23[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x35135f){logger['info'](_0xe065('0x1d'),_0x883747);logger['debug'](_0xe065('0x1d'),_0x883747,JSON[_0xe065('0xe')](_0x35135f));_0x12679d(_0x35135f);})[_0xe065('0x1e')](function(_0xcceb12){logger[_0xe065('0xf')](_0xe065('0x1d'),_0xcceb12['message'],_0x883747);_0x46db7e(_0x59b915[_0xe065('0xf')](0x1f4,_0xcceb12[_0xe065('0x11')]));});});}; \ No newline at end of file +var _0xe5b5=['GetTrigger','Trigger','options','where','attributes','include','map','model','debug','ShowTrigger','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch'];(function(_0x2aa733,_0xcde568){var _0x2bcf85=function(_0x5d9358){while(--_0x5d9358){_0x2aa733['push'](_0x2aa733['shift']());}};_0x2bcf85(++_0xcde568);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xe5b5[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('Trigger,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('Trigger,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('Trigger,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});}exports[_0x5e5b('0x19')]=function(_0x45a091){var _0x4c5f9a=this;return new Promise(function(_0xe5aa6b,_0x1560e1){return db[_0x5e5b('0x1a')]['findAll']({'raw':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1c')]||null:null,'attributes':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1d')]||null:null,'limit':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['limit']||null:null,'include':_0x45a091['options']?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x28cd95){return{'model':db[_0x28cd95[_0x5e5b('0x20')]],'as':_0x28cd95['as'],'attributes':_0x28cd95[_0x5e5b('0x1d')],'include':_0x28cd95[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x28cd95[_0x5e5b('0x1e')],function(_0x4da321){return{'model':db[_0x4da321[_0x5e5b('0x20')]],'as':_0x4da321['as'],'attributes':_0x4da321[_0x5e5b('0x1d')],'include':_0x4da321[_0x5e5b('0x1e')]?_['map'](_0x4da321[_0x5e5b('0x1e')],function(_0xdb2863){return{'model':db[_0xdb2863['model']],'as':_0xdb2863['as'],'attributes':_0xdb2863[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x39ce16){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x21')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x39ce16));_0xe5aa6b(_0x39ce16);})[_0x5e5b('0x18')](function(_0x42da3b){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x42da3b['message'],_0x45a091);_0x1560e1(_0x4c5f9a['error'](0x1f4,_0x42da3b[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x22')]=function(_0xb68419){var _0x3dcdab=this;return new Promise(function(_0x12f1ee,_0x4b9be8){return db[_0x5e5b('0x1a')]['find']({'raw':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1c')]||null:null,'attributes':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1d')]||null:null,'include':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x317451){return{'model':db[_0x317451['model']],'as':_0x317451['as'],'attributes':_0x317451[_0x5e5b('0x1d')],'include':_0x317451[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x317451[_0x5e5b('0x1e')],function(_0x7da7a5){return{'model':db[_0x7da7a5[_0x5e5b('0x20')]],'as':_0x7da7a5['as'],'attributes':_0x7da7a5['attributes'],'include':_0x7da7a5['include']?_[_0x5e5b('0x1f')](_0x7da7a5[_0x5e5b('0x1e')],function(_0x8ec651){return{'model':db[_0x8ec651['model']],'as':_0x8ec651['as'],'attributes':_0x8ec651[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x18f5ba){logger[_0x5e5b('0x10')]('ShowTrigger',_0xb68419);logger[_0x5e5b('0x21')](_0x5e5b('0x22'),_0xb68419,JSON['stringify'](_0x18f5ba));_0x12f1ee(_0x18f5ba);})['catch'](function(_0xe9c586){logger[_0x5e5b('0x14')](_0x5e5b('0x22'),_0xe9c586['message'],_0xb68419);_0x4b9be8(_0x3dcdab[_0x5e5b('0x14')](0x1f4,_0xe9c586['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index f38d450..be953b0 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 _0xc878=['delete','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','clone','create','put','update'];(function(_0x223b03,_0x131346){var _0x4ae0b1=function(_0x140034){while(--_0x140034){_0x223b03['push'](_0x223b03['shift']());}};_0x4ae0b1(++_0x131346);}(_0xc878,0x10f));var _0x8c87=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0xc878[_0x57975f];return _0x4793b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8c87('0x0'));var timeout=require(_0x8c87('0x1'));var express=require(_0x8c87('0x2'));var router=express['Router']();var fs_extra=require(_0x8c87('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8c87('0x4'));var config=require(_0x8c87('0x5'));var controller=require(_0x8c87('0x6'));router[_0x8c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x8c87('0x8')]);router[_0x8c87('0x7')](_0x8c87('0x9'),auth[_0x8c87('0xa')](),controller[_0x8c87('0xb')]);router[_0x8c87('0xc')]('/:id/clone',auth[_0x8c87('0xa')](),controller[_0x8c87('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8c87('0xe')]);router[_0x8c87('0xf')]('/:id',auth[_0x8c87('0xa')](),controller[_0x8c87('0x10')]);router[_0x8c87('0x11')](_0x8c87('0x9'),auth[_0x8c87('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4dfa=['destroy','exports','multer','connect-timeout','Router','../../config/environment','./trunk.controller','index','get','/:id','isAuthenticated','clone','delete'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x4dfa,0xec));var _0xa4df=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4dfa[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xa4df('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa4df('0x1'));var express=require('express');var router=express[_0xa4df('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa4df('0x3'));var controller=require(_0xa4df('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xa4df('0x5')]);router[_0xa4df('0x6')](_0xa4df('0x7'),auth[_0xa4df('0x8')](),controller['show']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xa4df('0x9')]);router['post']('/',auth[_0xa4df('0x8')](),controller['create']);router['put'](_0xa4df('0x7'),auth[_0xa4df('0x8')](),controller['update']);router[_0xa4df('0xa')]('/:id',auth[_0xa4df('0x8')](),controller[_0xa4df('0xb')]);module[_0xa4df('0xc')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8c3a407..ec1251d 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 _0x7d15=['originate','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','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','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse'];(function(_0x3ed76b,_0x33f24b){var _0x1d501c=function(_0x30d36a){while(--_0x30d36a){_0x3ed76b['push'](_0x3ed76b['shift']());}};_0x1d501c(++_0x33f24b);}(_0x7d15,0x17f));var _0x57d1=function(_0x2c58b1,_0x37784a){_0x2c58b1=_0x2c58b1-0x0;var _0x1a64db=_0x7d15[_0x2c58b1];return _0x1a64db;};'use strict';var Sequelize=require(_0x57d1('0x0'));module['exports']={'name':{'type':Sequelize[_0x57d1('0x1')],'allowNull':![],'unique':_0x57d1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x57d1('0x3')]('friend',_0x57d1('0x4'),_0x57d1('0x5')),'allowNull':![],'defaultValue':_0x57d1('0x6')},'context':{'type':Sequelize[_0x57d1('0x1')],'allowNull':![],'defaultValue':_0x57d1('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x57d1('0x8'),_0x57d1('0x9'),'ALLOWED_FAILED_SCREEN',_0x57d1('0xa'),_0x57d1('0xb'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x57d1('0xc'))},'deny':{'type':Sequelize[_0x57d1('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x57d1('0x1')]},'remotesecret':{'type':Sequelize[_0x57d1('0x1')]},'transport':{'type':Sequelize[_0x57d1('0x1')],'defaultValue':'udp','set':function(_0x4b8571){this[_0x57d1('0xd')]('transport',_0x4b8571?_0x4b8571[_0x57d1('0xe')](','):null);},'get':function(){return this[_0x57d1('0xf')](_0x57d1('0x10'))?this[_0x57d1('0xf')](_0x57d1('0x10'))[_0x57d1('0x11')](','):null;},'comment':_0x57d1('0x12')},'dtmfmode':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x13'),_0x57d1('0x14'),_0x57d1('0x15'),_0x57d1('0x16'),'auto'),'defaultValue':_0x57d1('0x13')},'directmedia':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no','nonat',_0x57d1('0x18'),_0x57d1('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x57d1('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x57d1('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x57d1('0x1')],'defaultValue':_0x57d1('0x1a'),'set':function(_0x5c96c3){this[_0x57d1('0xd')](_0x57d1('0x1b'),_0x5c96c3?_0x5c96c3[_0x57d1('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x57d1('0x1b'))?this['getDataValue'](_0x57d1('0x1b'))['split'](','):null;},'comment':_0x57d1('0x1c')},'callgroup':{'type':Sequelize[_0x57d1('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x57d1('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x57d1('0x1')]},'language':{'type':Sequelize[_0x57d1('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x57d1('0x1')],'defaultValue':_0x57d1('0x1d')},'allow':{'type':Sequelize[_0x57d1('0x1')],'allowNull':![],'defaultValue':_0x57d1('0x1e'),'set':function(_0x232f88){this['setDataValue']('allow',_0x232f88?_0x232f88['join'](';'):_0x57d1('0x1e'));},'get':function(){return this['getDataValue']('allow')?this[_0x57d1('0xf')](_0x57d1('0x1f'))[_0x57d1('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'insecure':{'type':Sequelize[_0x57d1('0x1')],'defaultValue':_0x57d1('0x20'),'set':function(_0x2d67ff){this['setDataValue'](_0x57d1('0x21'),_0x2d67ff?_0x2d67ff[_0x57d1('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x57d1('0x21'))?this[_0x57d1('0xf')]('insecure')[_0x57d1('0x11')](','):null;},'comment':_0x57d1('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0x57d1('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no',_0x57d1('0x23'))},'promiscredir':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'accountcode':{'type':Sequelize[_0x57d1('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x57d1('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x57d1('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x57d1('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x57d1('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x57d1('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x57d1('0x1')]},'template':{'type':Sequelize[_0x57d1('0x1')]},'videosupport':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no',_0x57d1('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x27'),_0x57d1('0x28'),_0x57d1('0x29'))},'session_expires':{'type':Sequelize[_0x57d1('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x2a'),_0x57d1('0x2b')),'defaultValue':_0x57d1('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x57d1('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x57d1('0x1')]},'fromuser':{'type':Sequelize[_0x57d1('0x1')]},'port':{'type':Sequelize[_0x57d1('0x24')](0x5)},'qualify':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x57d1('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x57d1('0x1')]},'defaultuser':{'type':Sequelize[_0x57d1('0x1')]},'rtptimeout':{'type':Sequelize[_0x57d1('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x57d1('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x57d1('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no',_0x57d1('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x57d1('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x57d1('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x57d1('0x1')]},'contactdeny':{'type':Sequelize[_0x57d1('0x1')]},'contactacl':{'type':Sequelize[_0x57d1('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x57d1('0x1')]},'maxforwards':{'type':Sequelize[_0x57d1('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x57d1('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'force_avp':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'icesupport':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x57d1('0x3')]('yes','no',_0x57d1('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x57d1('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x57d1('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x57d1('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x57d1('0x2e'),_0x57d1('0x2f'),_0x57d1('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x57d1('0x1')]},'usereqphone':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x57d1('0x1')]},'call_limit':{'type':Sequelize[_0x57d1('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x57d1('0x1')]},'mohsuggest':{'type':Sequelize[_0x57d1('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x57d1('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x57d1('0x31')},'canreinvite':{'type':Sequelize[_0x57d1('0x3')](_0x57d1('0x17'),'no',_0x57d1('0x32'),_0x57d1('0x18'),_0x57d1('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x57d1('0x1')]},'otherFields':{'type':Sequelize[_0x57d1('0x1')]},'active':{'type':Sequelize[_0x57d1('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x57d1('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4f34=['PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x4f34,0x123));var _0x44f3=function(_0x442dcb,_0x179c35){_0x442dcb=_0x442dcb-0x0;var _0x593554=_0x4f34[_0x442dcb];return _0x593554;};'use strict';var Sequelize=require(_0x44f3('0x0'));module[_0x44f3('0x1')]={'name':{'type':Sequelize[_0x44f3('0x2')],'allowNull':![],'unique':_0x44f3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x5'),_0x44f3('0x6'),_0x44f3('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x44f3('0x2')],'allowNull':![],'defaultValue':_0x44f3('0x8')},'callingpres':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x9'),_0x44f3('0xa'),_0x44f3('0xb'),'ALLOWED',_0x44f3('0xc'),_0x44f3('0xd'),_0x44f3('0xe'),_0x44f3('0xf'))},'deny':{'type':Sequelize[_0x44f3('0x2')]},'permit':{'type':Sequelize[_0x44f3('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x44f3('0x2')]},'remotesecret':{'type':Sequelize[_0x44f3('0x2')]},'transport':{'type':Sequelize[_0x44f3('0x2')],'defaultValue':_0x44f3('0x10'),'set':function(_0x3c6544){this['setDataValue'](_0x44f3('0x11'),_0x3c6544?_0x3c6544[_0x44f3('0x12')](','):null);},'get':function(){return this[_0x44f3('0x13')](_0x44f3('0x11'))?this['getDataValue']('transport')[_0x44f3('0x14')](','):null;},'comment':_0x44f3('0x15')},'dtmfmode':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x16'),_0x44f3('0x17'),'shortinfo','inband','auto'),'defaultValue':_0x44f3('0x16')},'directmedia':{'type':Sequelize['ENUM'](_0x44f3('0x18'),'no',_0x44f3('0x19'),_0x44f3('0x1a'),_0x44f3('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x44f3('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x44f3('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x44f3('0x2')],'defaultValue':_0x44f3('0x1c'),'set':function(_0x2ad222){this[_0x44f3('0x1d')](_0x44f3('0x1e'),_0x2ad222?_0x2ad222[_0x44f3('0x12')](','):null);},'get':function(){return this[_0x44f3('0x13')](_0x44f3('0x1e'))?this[_0x44f3('0x13')]('nat')[_0x44f3('0x14')](','):null;},'comment':_0x44f3('0x1f')},'callgroup':{'type':Sequelize[_0x44f3('0x2')]},'namedcallgroup':{'type':Sequelize[_0x44f3('0x2')]},'pickupgroup':{'type':Sequelize[_0x44f3('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x44f3('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x44f3('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x44f3('0x20')},'allow':{'type':Sequelize[_0x44f3('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2ccaa5){this['setDataValue']('allow',_0x2ccaa5?_0x2ccaa5[_0x44f3('0x12')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x44f3('0x13')]('allow')?this[_0x44f3('0x13')](_0x44f3('0x21'))[_0x44f3('0x14')](';'):null;},'comment':_0x44f3('0x22')},'autoframing':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x1c0593){this[_0x44f3('0x1d')]('insecure',_0x1c0593?_0x1c0593[_0x44f3('0x12')](','):null);},'get':function(){return this[_0x44f3('0x13')](_0x44f3('0x23'))?this[_0x44f3('0x13')](_0x44f3('0x23'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x44f3('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x44f3('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x44f3('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x44f3('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'accountcode':{'type':Sequelize[_0x44f3('0x24')](0xb)},'setvar':{'type':Sequelize[_0x44f3('0x2')]},'callerid':{'type':Sequelize[_0x44f3('0x2')],'defaultValue':_0x44f3('0x25')},'amaflags':{'type':Sequelize[_0x44f3('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x44f3('0x18'),'no'),'defaultValue':_0x44f3('0x18')},'busylevel':{'type':Sequelize[_0x44f3('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x44f3('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x44f3('0x2')]},'template':{'type':Sequelize[_0x44f3('0x2')]},'videosupport':{'type':Sequelize[_0x44f3('0x4')]('yes','no',_0x44f3('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x44f3('0x18'),'no')},'mailbox':{'type':Sequelize[_0x44f3('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x44f3('0x27'),_0x44f3('0x28'),_0x44f3('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x44f3('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x2a'),'uas'),'defaultValue':_0x44f3('0x2b')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x44f3('0x2')]},'fromdomain':{'type':Sequelize[_0x44f3('0x2')]},'fromuser':{'type':Sequelize[_0x44f3('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x44f3('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x44f3('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x44f3('0x2')]},'defaultuser':{'type':Sequelize[_0x44f3('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x44f3('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x44f3('0x18'),'no',_0x44f3('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x44f3('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x44f3('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x44f3('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x44f3('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x44f3('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x44f3('0x2')]},'maxforwards':{'type':Sequelize[_0x44f3('0x24')](0xb)},'encryption':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'force_avp':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'icesupport':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x44f3('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x44f3('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x44f3('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x44f3('0x2')]},'dtlscapath':{'type':Sequelize[_0x44f3('0x2')]},'dtlssetup':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x2d'),_0x44f3('0x2e'),_0x44f3('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x44f3('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x44f3('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x44f3('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x44f3('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x44f3('0x2')],'defaultValue':_0x44f3('0x30')},'canreinvite':{'type':Sequelize[_0x44f3('0x4')](_0x44f3('0x18'),'no','nonat',_0x44f3('0x1a'),_0x44f3('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x44f3('0x2')]},'active':{'type':Sequelize[_0x44f3('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x44f3('0x2')],'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 2b20638..8280d97 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 _0x9b70=['createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_trunks.conf','eml-format','request-promise','moment','mustache','util','path','sox','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','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','Trunk','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','find','clone','keys','options','omit'];(function(_0x316c90,_0x4399f3){var _0x60428f=function(_0x38f3ba){while(--_0x38f3ba){_0x316c90['push'](_0x316c90['shift']());}};_0x60428f(++_0x4399f3);}(_0x9b70,0x8a));var _0x09b7=function(_0x2653ac,_0x338212){_0x2653ac=_0x2653ac-0x0;var _0x14a4ba=_0x9b70[_0x2653ac];return _0x14a4ba;};'use strict';var emlformat=require(_0x09b7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09b7('0x1'));var moment=require(_0x09b7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x09b7('0x3'));var util=require(_0x09b7('0x4'));var path=require(_0x09b7('0x5'));var sox=require(_0x09b7('0x6'));var csv=require('to-csv');var ejs=require(_0x09b7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09b7('0x8'));var squel=require(_0x09b7('0x9'));var crypto=require('crypto');var jsforce=require(_0x09b7('0xa'));var deskjs=require(_0x09b7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x09b7('0xc'));var Papa=require('papaparse');var Redis=require(_0x09b7('0xd'));var authService=require(_0x09b7('0xe'));var qs=require(_0x09b7('0xf'));var as=require(_0x09b7('0x10'));var hardwareService=require(_0x09b7('0x11'));var logger=require(_0x09b7('0x12'))(_0x09b7('0x13'));var utils=require(_0x09b7('0x14'));var config=require(_0x09b7('0x15'));var licenseUtil=require(_0x09b7('0x16'));var db=require(_0x09b7('0x17'))['db'];var jayson=require(_0x09b7('0x18'));var client=jayson[_0x09b7('0x19')][_0x09b7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2f66e0,_0x17f6fd,_0x37441b,_0x415254){return new BPromise(function(_0x1a6c41,_0x84dc79){var _0x1ee345=_0x415254||client;return _0x1ee345[_0x09b7('0x1b')](_0x2f66e0,_0x37441b)[_0x09b7('0x1c')](function(_0x40daa9){logger[_0x09b7('0x1d')](_0x09b7('0x1e'),_0x17f6fd,_0x09b7('0x1f'));logger[_0x09b7('0x20')](_0x09b7('0x21'),_0x17f6fd,_0x09b7('0x1f'),JSON['stringify'](_0x40daa9));if(_0x40daa9[_0x09b7('0x22')]){if(_0x40daa9[_0x09b7('0x22')]['code']===0x1f4){logger[_0x09b7('0x22')](_0x09b7('0x1e'),_0x17f6fd,_0x40daa9[_0x09b7('0x22')][_0x09b7('0x23')]);return _0x84dc79(_0x40daa9[_0x09b7('0x22')][_0x09b7('0x23')]);}logger[_0x09b7('0x22')]('Trunk,\x20%s,\x20%s',_0x17f6fd,_0x40daa9[_0x09b7('0x22')]['message']);return _0x1a6c41(_0x40daa9[_0x09b7('0x22')][_0x09b7('0x23')]);}else{logger[_0x09b7('0x1d')]('Trunk,\x20%s,\x20%s',_0x17f6fd,'request\x20sent');_0x1a6c41(_0x40daa9[_0x09b7('0x24')][_0x09b7('0x23')]);}})[_0x09b7('0x25')](function(_0x26145b){logger[_0x09b7('0x22')](_0x09b7('0x1e'),_0x17f6fd,_0x26145b);_0x84dc79(_0x26145b);});});}function respondWithStatusCode(_0x544350,_0x5f4aa5){_0x5f4aa5=_0x5f4aa5||0xcc;return function(_0xb49258){if(_0xb49258){return _0x544350[_0x09b7('0x26')](_0x5f4aa5);}return _0x544350[_0x09b7('0x27')](_0x5f4aa5)[_0x09b7('0x28')]();};}function respondWithResult(_0x16cdc4,_0xd34a2d){_0xd34a2d=_0xd34a2d||0xc8;return function(_0x3d16e4){if(_0x3d16e4){return _0x16cdc4[_0x09b7('0x27')](_0xd34a2d)[_0x09b7('0x29')](_0x3d16e4);}};}function respondWithFilteredResult(_0x1a4b7d,_0x528de9){return function(_0x2fb92b){if(_0x2fb92b){var _0x2eb906=typeof _0x528de9[_0x09b7('0x2a')]===_0x09b7('0x2b')&&typeof _0x528de9[_0x09b7('0x2c')]===_0x09b7('0x2b');var _0x2c6226=_0x2fb92b[_0x09b7('0x2d')];var _0x396780=_0x2eb906?0x0:_0x528de9['offset'];var _0x2c1ea4=_0x2eb906?_0x2fb92b[_0x09b7('0x2d')]:_0x528de9[_0x09b7('0x2a')]+_0x528de9[_0x09b7('0x2c')];var _0x19e30f;if(_0x2c1ea4>=_0x2c6226){_0x2c1ea4=_0x2c6226;_0x19e30f=0xc8;}else{_0x19e30f=0xce;}_0x1a4b7d['status'](_0x19e30f);return _0x1a4b7d[_0x09b7('0x2e')](_0x09b7('0x2f'),_0x396780+'-'+_0x2c1ea4+'/'+_0x2c6226)[_0x09b7('0x29')](_0x2fb92b);}return null;};}function patchUpdates(_0x4efee4){return function(_0x43eeab){try{jsonpatch[_0x09b7('0x30')](_0x43eeab,_0x4efee4,!![]);}catch(_0xded92){return BPromise[_0x09b7('0x31')](_0xded92);}return _0x43eeab['save']();};}function saveUpdates(_0x3c7174,_0x3122a4){return function(_0x4c53ec){if(_0x4c53ec){return _0x4c53ec[_0x09b7('0x32')](_0x3c7174)[_0x09b7('0x1c')](function(_0x3f3da9){return _0x3f3da9;});}return null;};}function removeEntity(_0x282672,_0x1899a6){return function(_0xed7bb5){if(_0xed7bb5){return _0xed7bb5[_0x09b7('0x33')]()[_0x09b7('0x1c')](function(){var _0x4001d1=_0xed7bb5[_0x09b7('0x34')]({'plain':!![]});var _0x617362=_0x09b7('0x35');return db[_0x09b7('0x36')][_0x09b7('0x33')]({'where':{'type':_0x617362,'resourceId':_0x4001d1['id']}})[_0x09b7('0x1c')](function(){return _0xed7bb5;});})[_0x09b7('0x1c')](function(){_0x282672[_0x09b7('0x27')](0xcc)[_0x09b7('0x28')]();});}};}function handleEntityNotFound(_0x5a3510,_0x1ddfb6){return function(_0x251cf8){if(!_0x251cf8){_0x5a3510[_0x09b7('0x26')](0x194);}return _0x251cf8;};}function handleError(_0x3f4480,_0x150608){_0x150608=_0x150608||0x1f4;return function(_0x1534ed){logger[_0x09b7('0x22')](_0x1534ed[_0x09b7('0x37')]);if(_0x1534ed[_0x09b7('0x38')]){delete _0x1534ed['name'];}_0x3f4480[_0x09b7('0x27')](_0x150608)[_0x09b7('0x39')](_0x1534ed);};}exports[_0x09b7('0x3a')]=function(_0x239b71,_0x4890c6){var _0x5ca970={},_0x41b9fc={},_0x4fb3d6={'count':0x0,'rows':[]};var _0x2b72d7=_['map'](db[_0x09b7('0x3b')]['rawAttributes'],function(_0x4a4e89){return{'name':_0x4a4e89[_0x09b7('0x3c')],'type':_0x4a4e89['type'][_0x09b7('0x3d')]};});_0x41b9fc[_0x09b7('0x3e')]=_['map'](_0x2b72d7,_0x09b7('0x38'));_0x41b9fc[_0x09b7('0x3f')]=_['keys'](_0x239b71[_0x09b7('0x3f')]);_0x41b9fc[_0x09b7('0x40')]=_[_0x09b7('0x41')](_0x41b9fc[_0x09b7('0x3e')],_0x41b9fc['query']);_0x5ca970[_0x09b7('0x42')]=_['intersection'](_0x41b9fc[_0x09b7('0x3e')],qs[_0x09b7('0x43')](_0x239b71['query'][_0x09b7('0x43')]));_0x5ca970[_0x09b7('0x42')]=_0x5ca970[_0x09b7('0x42')][_0x09b7('0x44')]?_0x5ca970['attributes']:_0x41b9fc['model'];if(!_0x239b71[_0x09b7('0x3f')]['hasOwnProperty'](_0x09b7('0x45'))){_0x5ca970[_0x09b7('0x2c')]=qs[_0x09b7('0x2c')](_0x239b71['query']['limit']);_0x5ca970[_0x09b7('0x2a')]=qs['offset'](_0x239b71[_0x09b7('0x3f')][_0x09b7('0x2a')]);}_0x5ca970[_0x09b7('0x46')]=qs[_0x09b7('0x47')](_0x239b71[_0x09b7('0x3f')][_0x09b7('0x47')]);_0x5ca970[_0x09b7('0x48')]=qs[_0x09b7('0x40')](_[_0x09b7('0x49')](_0x239b71[_0x09b7('0x3f')],_0x41b9fc['filters']),_0x2b72d7);if(_0x239b71[_0x09b7('0x3f')][_0x09b7('0x4a')]){_0x5ca970[_0x09b7('0x48')]=_[_0x09b7('0x4b')](_0x5ca970[_0x09b7('0x48')],{'$or':_[_0x09b7('0x4c')](_0x2b72d7,function(_0x375bc1){if(_0x375bc1[_0x09b7('0x4d')]!==_0x09b7('0x4e')){var _0x3eb722={};_0x3eb722[_0x375bc1[_0x09b7('0x38')]]={'$like':'%'+_0x239b71['query'][_0x09b7('0x4a')]+'%'};return _0x3eb722;}})});}_0x5ca970=_[_0x09b7('0x4b')]({},_0x5ca970,_0x239b71['options']);var _0x20455d={'where':_0x5ca970[_0x09b7('0x48')]};return db[_0x09b7('0x3b')][_0x09b7('0x2d')](_0x20455d)[_0x09b7('0x1c')](function(_0x21e89d){_0x4fb3d6[_0x09b7('0x2d')]=_0x21e89d;if(_0x239b71[_0x09b7('0x3f')][_0x09b7('0x4f')]){_0x5ca970[_0x09b7('0x50')]=[{'all':!![]}];}return db['Trunk'][_0x09b7('0x51')](_0x5ca970);})[_0x09b7('0x1c')](function(_0x1acb71){_0x4fb3d6[_0x09b7('0x52')]=_0x1acb71;return _0x4fb3d6;})['then'](respondWithFilteredResult(_0x4890c6,_0x5ca970))[_0x09b7('0x25')](handleError(_0x4890c6,null));};exports['show']=function(_0x10a5fa,_0x625b14){var _0x4ac6eb={'raw':![],'where':{'id':_0x10a5fa[_0x09b7('0x53')]['id']}},_0x5500d7={};_0x5500d7[_0x09b7('0x3e')]=_['keys'](db[_0x09b7('0x3b')][_0x09b7('0x54')]);_0x5500d7[_0x09b7('0x3f')]=_['keys'](_0x10a5fa[_0x09b7('0x3f')]);_0x5500d7['filters']=_[_0x09b7('0x41')](_0x5500d7[_0x09b7('0x3e')],_0x5500d7['query']);_0x4ac6eb[_0x09b7('0x42')]=_[_0x09b7('0x41')](_0x5500d7[_0x09b7('0x3e')],qs['fields'](_0x10a5fa[_0x09b7('0x3f')][_0x09b7('0x43')]));_0x4ac6eb['attributes']=_0x4ac6eb[_0x09b7('0x42')][_0x09b7('0x44')]?_0x4ac6eb[_0x09b7('0x42')]:_0x5500d7[_0x09b7('0x3e')];if(_0x10a5fa[_0x09b7('0x3f')][_0x09b7('0x4f')]){_0x4ac6eb[_0x09b7('0x50')]=[{'all':!![]}];}_0x4ac6eb=_['merge']({},_0x4ac6eb,_0x10a5fa['options']);return db['Trunk'][_0x09b7('0x55')](_0x4ac6eb)[_0x09b7('0x1c')](handleEntityNotFound(_0x625b14,null))[_0x09b7('0x1c')](respondWithResult(_0x625b14,null))[_0x09b7('0x25')](handleError(_0x625b14,null));};exports[_0x09b7('0x56')]=function(_0xca94f,_0x551fc3){var _0xaf9042={'where':{'id':_0xca94f[_0x09b7('0x53')]['id']}},_0x19d7b5={};_0x19d7b5[_0x09b7('0x3e')]=_[_0x09b7('0x57')](db['Trunk'][_0x09b7('0x54')]);_0xaf9042[_0x09b7('0x42')]=_['intersection'](_0x19d7b5[_0x09b7('0x3e')],qs['fields'](_0xca94f['query']['fields']));_0xaf9042[_0x09b7('0x42')]=_0xaf9042[_0x09b7('0x42')][_0x09b7('0x44')]?_0xaf9042[_0x09b7('0x42')]:_0x19d7b5[_0x09b7('0x3e')];if(_0xca94f[_0x09b7('0x3f')]['includeAll']){_0xaf9042[_0x09b7('0x50')]=[{'all':!![]}];}_0xaf9042=_['merge']({},_0xaf9042,_0xca94f[_0x09b7('0x58')]);return db[_0x09b7('0x3b')][_0x09b7('0x55')](_0xaf9042)[_0x09b7('0x1c')](handleEntityNotFound(_0x551fc3,null))[_0x09b7('0x1c')](function(_0x4fef5a){if(_0x4fef5a){var _0x2b8fbc=_0x4fef5a[_0x09b7('0x34')]({'plain':!![]});_0x2b8fbc=qs[_0x09b7('0x59')](_0x2b8fbc,['id',_0x09b7('0x5a'),_0x09b7('0x5b')]);_0xca94f[_0x09b7('0x5c')]=_[_0x09b7('0x59')](_0xca94f[_0x09b7('0x5c')],['id',_0x09b7('0x5a'),_0x09b7('0x5b')]);return db[_0x09b7('0x3b')]['create'](_[_0x09b7('0x4b')](_0x2b8fbc,_0xca94f[_0x09b7('0x5c')]),{'include':_0xca94f[_0x09b7('0x3f')][_0x09b7('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x37dbe4){var _0x3bc211=_0xca94f[_0x09b7('0x5d')][_0x09b7('0x34')]({'plain':!![]});if(!_0x3bc211)throw new Error(_0x09b7('0x5e'));if(_0x3bc211[_0x09b7('0x5f')]==='user'){var _0x500dc9=_0x37dbe4[_0x09b7('0x34')]({'plain':!![]});var _0x2ef3b8=_0x09b7('0x35');return db[_0x09b7('0x60')][_0x09b7('0x55')]({'where':{'name':_0x2ef3b8,'userProfileId':_0x3bc211[_0x09b7('0x61')]},'raw':!![]})[_0x09b7('0x1c')](function(_0x190d81){if(_0x190d81&&_0x190d81[_0x09b7('0x62')]===0x0){return db[_0x09b7('0x36')][_0x09b7('0x63')]({'name':_0x500dc9[_0x09b7('0x38')],'resourceId':_0x500dc9['id'],'type':_0x190d81[_0x09b7('0x38')],'sectionId':_0x190d81['id']},{})['then'](function(){return _0x37dbe4;});}else{return _0x37dbe4;}})['catch'](function(_0x56bcd7){logger['error'](_0x09b7('0x64'),_0x56bcd7);throw _0x56bcd7;});}return _0x37dbe4;});}})['then'](respondWithResult(_0x551fc3,0xc9))['catch'](handleError(_0x551fc3,null));};exports[_0x09b7('0x63')]=function(_0xd34ad0,_0x509d30,_0x399a99){var _0x4fae4c;return db['Trunk'][_0x09b7('0x63')](_0xd34ad0[_0x09b7('0x5c')],{'raw':!![]})[_0x09b7('0x1c')](function(_0x49fdc9){_0x4fae4c=_0x49fdc9;return db[_0x09b7('0x3b')]['findAll']({'raw':!![]});})[_0x09b7('0x1c')](function(_0x2ae058){var _0x207b7d=fs[_0x09b7('0x65')](path['join'](config[_0x09b7('0x66')],'server/files/templates/trunk.ejs'),'utf8');var _0x12e8f6=fs['readFileSync'](path[_0x09b7('0x67')](config[_0x09b7('0x66')],_0x09b7('0x68')),_0x09b7('0x69'));var _0x34d043=ejs[_0x09b7('0x6a')](_0x207b7d,{'trunks':_0x2ae058||[]});fs[_0x09b7('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x34d043);if(_0x4fae4c[_0x09b7('0x6c')]){var _0x281610=ejs[_0x09b7('0x6a')](_0x12e8f6,{'trunks':_0x2ae058||[]});fs[_0x09b7('0x6b')](_0x09b7('0x6d'),_0x281610);}})[_0x09b7('0x1c')](function(){return respondWithRpcPromise(_0x09b7('0x6e'),_0x09b7('0x63'),{'module':_0x09b7('0x6f')});})[_0x09b7('0x1c')](function(){var _0x1201ba=_0xd34ad0[_0x09b7('0x5d')][_0x09b7('0x34')]({'plain':!![]});if(!_0x1201ba)throw new Error(_0x09b7('0x5e'));if(_0x1201ba['role']==='user'){var _0x2bcdd0=_0x4fae4c[_0x09b7('0x34')]({'plain':!![]});return db[_0x09b7('0x60')]['find']({'where':{'name':_0x09b7('0x35'),'userProfileId':_0x1201ba[_0x09b7('0x61')]},'raw':!![]})[_0x09b7('0x1c')](function(_0x36f6e1){if(_0x36f6e1&&_0x36f6e1[_0x09b7('0x62')]===0x0){return db[_0x09b7('0x36')][_0x09b7('0x63')]({'name':_0x2bcdd0['name'],'resourceId':_0x2bcdd0['id'],'type':_0x36f6e1['name'],'sectionId':_0x36f6e1['id']},{})[_0x09b7('0x1c')](function(){return _0x4fae4c;});}else{return _0x4fae4c;}})[_0x09b7('0x25')](function(_0x2a5a62){logger[_0x09b7('0x22')](_0x09b7('0x64'),_0x2a5a62);throw _0x2a5a62;});}return _0x4fae4c;})[_0x09b7('0x1c')](respondWithResult(_0x509d30,0xc9))[_0x09b7('0x25')](handleError(_0x509d30,null));};exports[_0x09b7('0x32')]=function(_0x4bc346,_0x545b92,_0x2eb420){var _0x1e0870;return db[_0x09b7('0x3b')]['find']({'where':{'id':_0x4bc346[_0x09b7('0x53')]['id']}})[_0x09b7('0x1c')](handleEntityNotFound(_0x545b92,null))[_0x09b7('0x1c')](saveUpdates(_0x4bc346['body'],null))[_0x09b7('0x1c')](function(_0x8685fd){if(_0x8685fd){_0x1e0870=_0x8685fd;return db[_0x09b7('0x3b')][_0x09b7('0x51')]({'raw':!![]});}})['then'](function(_0x531605){if(_0x531605){var _0x4ef86a=fs[_0x09b7('0x65')](path['join'](config[_0x09b7('0x66')],_0x09b7('0x70')),_0x09b7('0x69'));var _0x540ca3=fs['readFileSync'](path[_0x09b7('0x67')](config[_0x09b7('0x66')],'server/files/templates/registry.ejs'),_0x09b7('0x69'));var _0x218795=ejs[_0x09b7('0x6a')](_0x4ef86a,{'trunks':_0x531605||[]});fs[_0x09b7('0x6b')](_0x09b7('0x71'),_0x218795);var _0x2680fc=ejs[_0x09b7('0x6a')](_0x540ca3,{'trunks':_0x531605||[]});fs['writeFileSync'](_0x09b7('0x6d'),_0x2680fc);return respondWithRpcPromise(_0x09b7('0x6e'),'update',{'module':_0x09b7('0x6f')});}return null;})[_0x09b7('0x1c')](function(_0x1d9d2d){if(_0x1d9d2d){return _0x1e0870;}})[_0x09b7('0x1c')](respondWithResult(_0x545b92,null))[_0x09b7('0x25')](handleError(_0x545b92,null));};exports['destroy']=function(_0x386aac,_0x260914,_0x317a9b){var _0xfce168;return db[_0x09b7('0x3b')][_0x09b7('0x55')]({'where':{'id':_0x386aac[_0x09b7('0x53')]['id']}})[_0x09b7('0x1c')](handleEntityNotFound(_0x260914,null))[_0x09b7('0x1c')](removeEntity(_0x260914,null))[_0x09b7('0x1c')](function(){return db[_0x09b7('0x3b')][_0x09b7('0x51')]({'raw':!![]});})[_0x09b7('0x1c')](function(_0x1b0627){var _0x13e2d2=fs[_0x09b7('0x65')](path[_0x09b7('0x67')](config[_0x09b7('0x66')],_0x09b7('0x70')),_0x09b7('0x69'));var _0x48a04d=fs[_0x09b7('0x65')](path['join'](config[_0x09b7('0x66')],_0x09b7('0x68')),_0x09b7('0x69'));var _0x264ea0=ejs[_0x09b7('0x6a')](_0x13e2d2,{'trunks':_0x1b0627});var _0x5e46ce=ejs[_0x09b7('0x6a')](_0x48a04d,{'trunks':_0x1b0627});fs[_0x09b7('0x6b')](_0x09b7('0x71'),_0x264ea0);fs['writeFileSync'](_0x09b7('0x6d'),_0x5e46ce);return respondWithRpcPromise(_0x09b7('0x6e'),_0x09b7('0x33'),{'module':_0x09b7('0x6f')});})[_0x09b7('0x25')](handleError(_0x260914,null));}; \ No newline at end of file +var _0xf887=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','destroy','get','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','length','includeAll','find','clone','params','omit','createdAt','updatedAt','body','create','user','Trunks','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','utf8','readFileSync','root','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','update','join','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x48622b,_0x5b8570){var _0x369a09=function(_0x21c786){while(--_0x21c786){_0x48622b['push'](_0x48622b['shift']());}};_0x369a09(++_0x5b8570);}(_0xf887,0x134));var _0x7f88=function(_0x524058,_0x31c163){_0x524058=_0x524058-0x0;var _0x1798ec=_0xf887[_0x524058];return _0x1798ec;};'use strict';var emlformat=require(_0x7f88('0x0'));var rimraf=require(_0x7f88('0x1'));var zipdir=require(_0x7f88('0x2'));var jsonpatch=require(_0x7f88('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f88('0x4'));var Mustache=require(_0x7f88('0x5'));var util=require(_0x7f88('0x6'));var path=require(_0x7f88('0x7'));var sox=require(_0x7f88('0x8'));var csv=require(_0x7f88('0x9'));var ejs=require(_0x7f88('0xa'));var fs=require('fs');var fs_extra=require(_0x7f88('0xb'));var _=require(_0x7f88('0xc'));var squel=require('squel');var crypto=require(_0x7f88('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7f88('0x9'));var querystring=require(_0x7f88('0xe'));var Papa=require(_0x7f88('0xf'));var Redis=require('ioredis');var authService=require(_0x7f88('0x10'));var qs=require(_0x7f88('0x11'));var as=require(_0x7f88('0x12'));var hardwareService=require(_0x7f88('0x13'));var logger=require(_0x7f88('0x14'))(_0x7f88('0x15'));var utils=require(_0x7f88('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7f88('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9edc,_0x38df82,_0x2f270e,_0x2128a0){return new BPromise(function(_0x10af94,_0x52fb03){var _0x242b7c=_0x2128a0||client;return _0x242b7c[_0x7f88('0x18')](_0x4e9edc,_0x2f270e)[_0x7f88('0x19')](function(_0x403712){logger[_0x7f88('0x1a')]('Trunk,\x20%s,\x20%s',_0x38df82,_0x7f88('0x1b'));logger[_0x7f88('0x1c')](_0x7f88('0x1d'),_0x38df82,'request\x20sent',JSON['stringify'](_0x403712));if(_0x403712[_0x7f88('0x1e')]){if(_0x403712[_0x7f88('0x1e')]['code']===0x1f4){logger['error'](_0x7f88('0x1f'),_0x38df82,_0x403712['error']['message']);return _0x52fb03(_0x403712[_0x7f88('0x1e')][_0x7f88('0x20')]);}logger[_0x7f88('0x1e')](_0x7f88('0x1f'),_0x38df82,_0x403712[_0x7f88('0x1e')][_0x7f88('0x20')]);return _0x10af94(_0x403712[_0x7f88('0x1e')][_0x7f88('0x20')]);}else{logger[_0x7f88('0x1a')]('Trunk,\x20%s,\x20%s',_0x38df82,_0x7f88('0x1b'));_0x10af94(_0x403712[_0x7f88('0x21')][_0x7f88('0x20')]);}})[_0x7f88('0x22')](function(_0x36d0f3){logger[_0x7f88('0x1e')]('Trunk,\x20%s,\x20%s',_0x38df82,_0x36d0f3);_0x52fb03(_0x36d0f3);});});}function respondWithStatusCode(_0x5a4195,_0x28bffc){_0x28bffc=_0x28bffc||0xcc;return function(_0x3abafc){if(_0x3abafc){return _0x5a4195[_0x7f88('0x23')](_0x28bffc);}return _0x5a4195[_0x7f88('0x24')](_0x28bffc)[_0x7f88('0x25')]();};}function respondWithResult(_0x28e098,_0x24af8f){_0x24af8f=_0x24af8f||0xc8;return function(_0x100173){if(_0x100173){return _0x28e098[_0x7f88('0x24')](_0x24af8f)[_0x7f88('0x26')](_0x100173);}};}function respondWithFilteredResult(_0x1912ee,_0x1e3552){return function(_0x19552e){if(_0x19552e){var _0x2d1a63=typeof _0x1e3552[_0x7f88('0x27')]==='undefined'&&typeof _0x1e3552[_0x7f88('0x28')]===_0x7f88('0x29');var _0x3e05ad=_0x19552e[_0x7f88('0x2a')];var _0x4a79e6=_0x2d1a63?0x0:_0x1e3552[_0x7f88('0x27')];var _0x2db125=_0x2d1a63?_0x19552e[_0x7f88('0x2a')]:_0x1e3552['offset']+_0x1e3552[_0x7f88('0x28')];var _0x596174;if(_0x2db125>=_0x3e05ad){_0x2db125=_0x3e05ad;_0x596174=0xc8;}else{_0x596174=0xce;}_0x1912ee[_0x7f88('0x24')](_0x596174);return _0x1912ee[_0x7f88('0x2b')]('Content-Range',_0x4a79e6+'-'+_0x2db125+'/'+_0x3e05ad)[_0x7f88('0x26')](_0x19552e);}return null;};}function patchUpdates(_0x29331f){return function(_0x494e00){try{jsonpatch['apply'](_0x494e00,_0x29331f,!![]);}catch(_0x13dd44){return BPromise['reject'](_0x13dd44);}return _0x494e00['save']();};}function saveUpdates(_0x3a871e,_0x4cc723){return function(_0x4caaeb){if(_0x4caaeb){return _0x4caaeb['update'](_0x3a871e)[_0x7f88('0x19')](function(_0x3fec8b){return _0x3fec8b;});}return null;};}function removeEntity(_0x3890c5,_0x12d259){return function(_0x9f8f13){if(_0x9f8f13){return _0x9f8f13[_0x7f88('0x2c')]()[_0x7f88('0x19')](function(){var _0x309ee0=_0x9f8f13[_0x7f88('0x2d')]({'plain':!![]});var _0x38c887='Trunks';return db['UserProfileResource'][_0x7f88('0x2c')]({'where':{'type':_0x38c887,'resourceId':_0x309ee0['id']}})[_0x7f88('0x19')](function(){return _0x9f8f13;});})[_0x7f88('0x19')](function(){_0x3890c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f1aa,_0x5e6ef0){return function(_0x27d575){if(!_0x27d575){_0x17f1aa[_0x7f88('0x23')](0x194);}return _0x27d575;};}function handleError(_0x3d4cbe,_0x174aee){_0x174aee=_0x174aee||0x1f4;return function(_0x10abad){logger[_0x7f88('0x1e')](_0x10abad[_0x7f88('0x2e')]);if(_0x10abad[_0x7f88('0x2f')]){delete _0x10abad[_0x7f88('0x2f')];}_0x3d4cbe[_0x7f88('0x24')](_0x174aee)[_0x7f88('0x30')](_0x10abad);};}exports[_0x7f88('0x31')]=function(_0x49d6ca,_0x5b64fb){var _0x13d9bb={},_0x8476b4={},_0x3f21ba={'count':0x0,'rows':[]};var _0x1d733e=_[_0x7f88('0x32')](db[_0x7f88('0x33')][_0x7f88('0x34')],function(_0x9d43d6){return{'name':_0x9d43d6[_0x7f88('0x35')],'type':_0x9d43d6[_0x7f88('0x36')][_0x7f88('0x37')]};});_0x8476b4[_0x7f88('0x38')]=_[_0x7f88('0x32')](_0x1d733e,_0x7f88('0x2f'));_0x8476b4[_0x7f88('0x39')]=_[_0x7f88('0x3a')](_0x49d6ca['query']);_0x8476b4[_0x7f88('0x3b')]=_[_0x7f88('0x3c')](_0x8476b4[_0x7f88('0x38')],_0x8476b4[_0x7f88('0x39')]);_0x13d9bb[_0x7f88('0x3d')]=_[_0x7f88('0x3c')](_0x8476b4[_0x7f88('0x38')],qs[_0x7f88('0x3e')](_0x49d6ca[_0x7f88('0x39')][_0x7f88('0x3e')]));_0x13d9bb[_0x7f88('0x3d')]=_0x13d9bb[_0x7f88('0x3d')]['length']?_0x13d9bb[_0x7f88('0x3d')]:_0x8476b4[_0x7f88('0x38')];if(!_0x49d6ca[_0x7f88('0x39')][_0x7f88('0x3f')](_0x7f88('0x40'))){_0x13d9bb[_0x7f88('0x28')]=qs[_0x7f88('0x28')](_0x49d6ca[_0x7f88('0x39')][_0x7f88('0x28')]);_0x13d9bb[_0x7f88('0x27')]=qs[_0x7f88('0x27')](_0x49d6ca['query'][_0x7f88('0x27')]);}_0x13d9bb[_0x7f88('0x41')]=qs[_0x7f88('0x42')](_0x49d6ca[_0x7f88('0x39')][_0x7f88('0x42')]);_0x13d9bb[_0x7f88('0x43')]=qs[_0x7f88('0x3b')](_[_0x7f88('0x44')](_0x49d6ca['query'],_0x8476b4[_0x7f88('0x3b')]),_0x1d733e);if(_0x49d6ca[_0x7f88('0x39')]['filter']){_0x13d9bb[_0x7f88('0x43')]=_[_0x7f88('0x45')](_0x13d9bb['where'],{'$or':_[_0x7f88('0x32')](_0x1d733e,function(_0x563df9){if(_0x563df9[_0x7f88('0x36')]!==_0x7f88('0x46')){var _0x513831={};_0x513831[_0x563df9[_0x7f88('0x2f')]]={'$like':'%'+_0x49d6ca['query'][_0x7f88('0x47')]+'%'};return _0x513831;}})});}_0x13d9bb=_[_0x7f88('0x45')]({},_0x13d9bb,_0x49d6ca[_0x7f88('0x48')]);var _0x391a63={'where':_0x13d9bb['where']};return db[_0x7f88('0x33')][_0x7f88('0x2a')](_0x391a63)['then'](function(_0x38c31){_0x3f21ba['count']=_0x38c31;if(_0x49d6ca['query']['includeAll']){_0x13d9bb[_0x7f88('0x49')]=[{'all':!![]}];}return db[_0x7f88('0x33')][_0x7f88('0x4a')](_0x13d9bb);})[_0x7f88('0x19')](function(_0x4a55e8){_0x3f21ba[_0x7f88('0x4b')]=_0x4a55e8;return _0x3f21ba;})[_0x7f88('0x19')](respondWithFilteredResult(_0x5b64fb,_0x13d9bb))[_0x7f88('0x22')](handleError(_0x5b64fb,null));};exports['show']=function(_0x459ed8,_0x3801b8){var _0x4f932d={'raw':![],'where':{'id':_0x459ed8['params']['id']}},_0x469f98={};_0x469f98[_0x7f88('0x38')]=_[_0x7f88('0x3a')](db[_0x7f88('0x33')][_0x7f88('0x34')]);_0x469f98[_0x7f88('0x39')]=_[_0x7f88('0x3a')](_0x459ed8[_0x7f88('0x39')]);_0x469f98[_0x7f88('0x3b')]=_[_0x7f88('0x3c')](_0x469f98[_0x7f88('0x38')],_0x469f98[_0x7f88('0x39')]);_0x4f932d[_0x7f88('0x3d')]=_[_0x7f88('0x3c')](_0x469f98[_0x7f88('0x38')],qs[_0x7f88('0x3e')](_0x459ed8[_0x7f88('0x39')]['fields']));_0x4f932d[_0x7f88('0x3d')]=_0x4f932d['attributes'][_0x7f88('0x4c')]?_0x4f932d[_0x7f88('0x3d')]:_0x469f98['model'];if(_0x459ed8[_0x7f88('0x39')][_0x7f88('0x4d')]){_0x4f932d[_0x7f88('0x49')]=[{'all':!![]}];}_0x4f932d=_[_0x7f88('0x45')]({},_0x4f932d,_0x459ed8['options']);return db['Trunk'][_0x7f88('0x4e')](_0x4f932d)[_0x7f88('0x19')](handleEntityNotFound(_0x3801b8,null))['then'](respondWithResult(_0x3801b8,null))['catch'](handleError(_0x3801b8,null));};exports[_0x7f88('0x4f')]=function(_0x3de26f,_0x1247fb){var _0x3bbeff={'where':{'id':_0x3de26f[_0x7f88('0x50')]['id']}},_0x57f8b5={};_0x57f8b5[_0x7f88('0x38')]=_[_0x7f88('0x3a')](db['Trunk'][_0x7f88('0x34')]);_0x3bbeff[_0x7f88('0x3d')]=_['intersection'](_0x57f8b5[_0x7f88('0x38')],qs[_0x7f88('0x3e')](_0x3de26f[_0x7f88('0x39')][_0x7f88('0x3e')]));_0x3bbeff[_0x7f88('0x3d')]=_0x3bbeff['attributes'][_0x7f88('0x4c')]?_0x3bbeff[_0x7f88('0x3d')]:_0x57f8b5[_0x7f88('0x38')];if(_0x3de26f[_0x7f88('0x39')]['includeAll']){_0x3bbeff[_0x7f88('0x49')]=[{'all':!![]}];}_0x3bbeff=_[_0x7f88('0x45')]({},_0x3bbeff,_0x3de26f['options']);return db[_0x7f88('0x33')]['find'](_0x3bbeff)[_0x7f88('0x19')](handleEntityNotFound(_0x1247fb,null))['then'](function(_0xf8f747){if(_0xf8f747){var _0x4c99b5=_0xf8f747['get']({'plain':!![]});_0x4c99b5=qs[_0x7f88('0x51')](_0x4c99b5,['id',_0x7f88('0x52'),_0x7f88('0x53')]);_0x3de26f[_0x7f88('0x54')]=_['omit'](_0x3de26f[_0x7f88('0x54')],['id',_0x7f88('0x52'),_0x7f88('0x53')]);return db[_0x7f88('0x33')][_0x7f88('0x55')](_[_0x7f88('0x45')](_0x4c99b5,_0x3de26f[_0x7f88('0x54')]),{'include':_0x3de26f[_0x7f88('0x39')][_0x7f88('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x28d14a){var _0x378244=_0x3de26f['user'][_0x7f88('0x2d')]({'plain':!![]});if(!_0x378244)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378244['role']===_0x7f88('0x56')){var _0x2e7d46=_0x28d14a['get']({'plain':!![]});var _0x2141e6=_0x7f88('0x57');return db['UserProfileSection'][_0x7f88('0x4e')]({'where':{'name':_0x2141e6,'userProfileId':_0x378244[_0x7f88('0x58')]},'raw':!![]})['then'](function(_0x563e66){if(_0x563e66&&_0x563e66['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2e7d46[_0x7f88('0x2f')],'resourceId':_0x2e7d46['id'],'type':_0x563e66[_0x7f88('0x2f')],'sectionId':_0x563e66['id']},{})[_0x7f88('0x19')](function(){return _0x28d14a;});}else{return _0x28d14a;}})[_0x7f88('0x22')](function(_0x1e20ce){logger[_0x7f88('0x1e')](_0x7f88('0x59'),_0x1e20ce);throw _0x1e20ce;});}return _0x28d14a;});}})[_0x7f88('0x19')](respondWithResult(_0x1247fb,0xc9))[_0x7f88('0x22')](handleError(_0x1247fb,null));};exports[_0x7f88('0x55')]=function(_0x2ef4b7,_0x35d037,_0x4591d0){var _0x45296b;return db[_0x7f88('0x33')][_0x7f88('0x55')](_0x2ef4b7['body'],{'raw':!![]})[_0x7f88('0x19')](function(_0x5a3897){_0x45296b=_0x5a3897;return db[_0x7f88('0x33')][_0x7f88('0x4a')]({'raw':!![]});})['then'](function(_0x144aad){var _0x8df368=fs['readFileSync'](path['join'](config['root'],_0x7f88('0x5a')),_0x7f88('0x5b'));var _0x5a0e28=fs[_0x7f88('0x5c')](path['join'](config[_0x7f88('0x5d')],'server/files/templates/registry.ejs'),_0x7f88('0x5b'));var _0x549df6=ejs['render'](_0x8df368,{'trunks':_0x144aad||[]});fs[_0x7f88('0x5e')](_0x7f88('0x5f'),_0x549df6);if(_0x45296b[_0x7f88('0x60')]){var _0x722abe=ejs['render'](_0x5a0e28,{'trunks':_0x144aad||[]});fs[_0x7f88('0x5e')]('/etc/asterisk/sip_xcally_registers.conf',_0x722abe);}})[_0x7f88('0x19')](function(){return respondWithRpcPromise(_0x7f88('0x61'),_0x7f88('0x55'),{'module':_0x7f88('0x62')});})[_0x7f88('0x19')](function(){var _0x3ab102=_0x2ef4b7['user'][_0x7f88('0x2d')]({'plain':!![]});if(!_0x3ab102)throw new Error(_0x7f88('0x63'));if(_0x3ab102[_0x7f88('0x64')]===_0x7f88('0x56')){var _0x4a8bdd=_0x45296b[_0x7f88('0x2d')]({'plain':!![]});return db[_0x7f88('0x65')][_0x7f88('0x4e')]({'where':{'name':_0x7f88('0x57'),'userProfileId':_0x3ab102['userProfileId']},'raw':!![]})[_0x7f88('0x19')](function(_0x40be89){if(_0x40be89&&_0x40be89[_0x7f88('0x66')]===0x0){return db[_0x7f88('0x67')][_0x7f88('0x55')]({'name':_0x4a8bdd[_0x7f88('0x2f')],'resourceId':_0x4a8bdd['id'],'type':_0x40be89[_0x7f88('0x2f')],'sectionId':_0x40be89['id']},{})[_0x7f88('0x19')](function(){return _0x45296b;});}else{return _0x45296b;}})['catch'](function(_0x438b78){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x438b78);throw _0x438b78;});}return _0x45296b;})['then'](respondWithResult(_0x35d037,0xc9))[_0x7f88('0x22')](handleError(_0x35d037,null));};exports[_0x7f88('0x68')]=function(_0x2913b9,_0x50ac3b,_0x49ca21){var _0x52977a;return db[_0x7f88('0x33')][_0x7f88('0x4e')]({'where':{'id':_0x2913b9[_0x7f88('0x50')]['id']}})[_0x7f88('0x19')](handleEntityNotFound(_0x50ac3b,null))[_0x7f88('0x19')](saveUpdates(_0x2913b9['body'],null))[_0x7f88('0x19')](function(_0x1bce2c){if(_0x1bce2c){_0x52977a=_0x1bce2c;return db[_0x7f88('0x33')][_0x7f88('0x4a')]({'raw':!![]});}})[_0x7f88('0x19')](function(_0x5d948f){if(_0x5d948f){var _0x1b799e=fs['readFileSync'](path['join'](config[_0x7f88('0x5d')],'server/files/templates/trunk.ejs'),_0x7f88('0x5b'));var _0x224387=fs[_0x7f88('0x5c')](path[_0x7f88('0x69')](config[_0x7f88('0x5d')],_0x7f88('0x6a')),'utf8');var _0x247e20=ejs[_0x7f88('0x6b')](_0x1b799e,{'trunks':_0x5d948f||[]});fs[_0x7f88('0x5e')](_0x7f88('0x5f'),_0x247e20);var _0x139cb1=ejs[_0x7f88('0x6b')](_0x224387,{'trunks':_0x5d948f||[]});fs[_0x7f88('0x5e')](_0x7f88('0x6c'),_0x139cb1);return respondWithRpcPromise(_0x7f88('0x61'),_0x7f88('0x68'),{'module':'chan_sip.so'});}return null;})[_0x7f88('0x19')](function(_0x558d5e){if(_0x558d5e){return _0x52977a;}})[_0x7f88('0x19')](respondWithResult(_0x50ac3b,null))[_0x7f88('0x22')](handleError(_0x50ac3b,null));};exports[_0x7f88('0x2c')]=function(_0x30acd2,_0x4f1336,_0xf4bb91){var _0x3cb102;return db['Trunk']['find']({'where':{'id':_0x30acd2[_0x7f88('0x50')]['id']}})[_0x7f88('0x19')](handleEntityNotFound(_0x4f1336,null))[_0x7f88('0x19')](removeEntity(_0x4f1336,null))[_0x7f88('0x19')](function(){return db[_0x7f88('0x33')][_0x7f88('0x4a')]({'raw':!![]});})['then'](function(_0x313080){var _0x5b89fa=fs[_0x7f88('0x5c')](path[_0x7f88('0x69')](config[_0x7f88('0x5d')],_0x7f88('0x5a')),'utf8');var _0x2d7c90=fs['readFileSync'](path[_0x7f88('0x69')](config[_0x7f88('0x5d')],'server/files/templates/registry.ejs'),_0x7f88('0x5b'));var _0x5c0c49=ejs[_0x7f88('0x6b')](_0x5b89fa,{'trunks':_0x313080});var _0x14cf0a=ejs['render'](_0x2d7c90,{'trunks':_0x313080});fs['writeFileSync'](_0x7f88('0x5f'),_0x5c0c49);fs[_0x7f88('0x5e')]('/etc/asterisk/sip_xcally_registers.conf',_0x14cf0a);return respondWithRpcPromise(_0x7f88('0x61'),_0x7f88('0x2c'),{'module':_0x7f88('0x62')});})[_0x7f88('0x22')](handleError(_0x4f1336,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index cbf700b..2a83b6c 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 _0x7c09=['exports','define','Trunk','tools_trunks','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trunk.attributes'];(function(_0x331054,_0x3bd4d1){var _0x422008=function(_0x393924){while(--_0x393924){_0x331054['push'](_0x331054['shift']());}};_0x422008(++_0x3bd4d1);}(_0x7c09,0x1cc));var _0x97c0=function(_0x45571a,_0x533f9e){_0x45571a=_0x45571a-0x0;var _0x179692=_0x7c09[_0x45571a];return _0x179692;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x97c0('0x0'))(_0x97c0('0x1'));var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require('../../config/environment');var attributes=require(_0x97c0('0x7'));module[_0x97c0('0x8')]=function(_0x2c1f51,_0x14d095){return _0x2c1f51[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d77=['path','rimraf','../../config/environment','exports','define','Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x6d77,0xb0));var _0x76d7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6d77[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x76d7('0x0'));var logger=require(_0x76d7('0x1'))(_0x76d7('0x2'));var moment=require(_0x76d7('0x3'));var BPromise=require(_0x76d7('0x4'));var rp=require(_0x76d7('0x5'));var fs=require('fs');var path=require(_0x76d7('0x6'));var rimraf=require(_0x76d7('0x7'));var config=require(_0x76d7('0x8'));var attributes=require('./trunk.attributes');module[_0x76d7('0x9')]=function(_0x184b12,_0x380889){return _0x184b12[_0x76d7('0xa')](_0x76d7('0xb'),attributes,{'tableName':_0x76d7('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 ba8dd91..334d002 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 _0x5f66=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetTrunk','findAll','options','attributes','limit','include','model','map','ShowTrunk','Trunk','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x2f41ba,_0x34789b){var _0x142b0a=function(_0x37951b){while(--_0x37951b){_0x2f41ba['push'](_0x2f41ba['shift']());}};_0x142b0a(++_0x34789b);}(_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 moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Trunk,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['Trunk'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowTrunk',_0x144e55);logger[_0x65f6('0xd')]('ShowTrunk',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowTrunk',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file +var _0x0b0e=['model','GetTrunk','Trunk','find','where','include','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','raw','options','attributes','map'];(function(_0x22dc42,_0x3db13b){var _0x38af02=function(_0x229547){while(--_0x229547){_0x22dc42['push'](_0x22dc42['shift']());}};_0x38af02(++_0x3db13b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4695e2,_0x3d5f15){_0x4695e2=_0x4695e2-0x0;var _0x160563=_0x0b0e[_0x4695e2];return _0x160563;};'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')]('Trunk,\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);});});}exports['GetTrunk']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['Trunk'][_0xe0b0('0x18')]({'raw':_0x54a3eb['options']?_0x54a3eb['options'][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['where']||null:null,'attributes':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')]['limit']||null:null,'include':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['include']?_[_0xe0b0('0x1c')](_0x54a3eb[_0xe0b0('0x1a')]['include'],function(_0x170ad8){return{'model':db[_0x170ad8['model']],'as':_0x170ad8['as'],'attributes':_0x170ad8[_0xe0b0('0x1b')],'include':_0x170ad8['include']?_[_0xe0b0('0x1c')](_0x170ad8['include'],function(_0x3e5c88){return{'model':db[_0x3e5c88['model']],'as':_0x3e5c88['as'],'attributes':_0x3e5c88[_0xe0b0('0x1b')],'include':_0x3e5c88['include']?_[_0xe0b0('0x1c')](_0x3e5c88['include'],function(_0x362aba){return{'model':db[_0x362aba[_0xe0b0('0x1d')]],'as':_0x362aba['as'],'attributes':_0x362aba[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x3ec2){logger[_0xe0b0('0xe')]('GetTrunk',_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1e'),_0x54a3eb,JSON['stringify'](_0x3ec2));_0x50a441(_0x3ec2);})[_0xe0b0('0x17')](function(_0x419b1f){logger[_0xe0b0('0x13')](_0xe0b0('0x1e'),_0x419b1f[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x419b1f[_0xe0b0('0x14')]));});});};exports['ShowTrunk']=function(_0x1854b8){var _0x3c0109=this;return new Promise(function(_0x48a9b5,_0x4fe400){return db[_0xe0b0('0x1f')][_0xe0b0('0x20')]({'raw':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x21')]||null:null,'attributes':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'include':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')],function(_0x12eeb8){return{'model':db[_0x12eeb8[_0xe0b0('0x1d')]],'as':_0x12eeb8['as'],'attributes':_0x12eeb8[_0xe0b0('0x1b')],'include':_0x12eeb8[_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x12eeb8[_0xe0b0('0x22')],function(_0x1a0c90){return{'model':db[_0x1a0c90[_0xe0b0('0x1d')]],'as':_0x1a0c90['as'],'attributes':_0x1a0c90[_0xe0b0('0x1b')],'include':_0x1a0c90[_0xe0b0('0x22')]?_['map'](_0x1a0c90[_0xe0b0('0x22')],function(_0x135be5){return{'model':db[_0x135be5[_0xe0b0('0x1d')]],'as':_0x135be5['as'],'attributes':_0x135be5[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x2c6e60){logger[_0xe0b0('0xe')]('ShowTrunk',_0x1854b8);logger['debug']('ShowTrunk',_0x1854b8,JSON['stringify'](_0x2c6e60));_0x48a9b5(_0x2c6e60);})[_0xe0b0('0x17')](function(_0xc3d967){logger[_0xe0b0('0x13')]('ShowTrunk',_0xc3d967[_0xe0b0('0x14')],_0x1854b8);_0x4fe400(_0x3c0109[_0xe0b0('0x13')](0x1f4,_0xc3d967[_0xe0b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 6118ada..fea8e80 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 _0x871e=['./user.controller','get','isAuthenticated','index','/describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','join','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','changePassword','delete','/:id/queues','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ee218,_0x172bb5){var _0x352554=function(_0xad54ce){while(--_0xad54ce){_0x2ee218['push'](_0x2ee218['shift']());}};_0x352554(++_0x172bb5);}(_0x871e,0x1b0));var _0xe871=function(_0xd3dc6f,_0x1473cf){_0xd3dc6f=_0xd3dc6f-0x0;var _0x5aa539=_0x871e[_0xd3dc6f];return _0x5aa539;};'use strict';var multer=require(_0xe871('0x0'));var util=require('util');var path=require(_0xe871('0x1'));var timeout=require(_0xe871('0x2'));var express=require(_0xe871('0x3'));var router=express[_0xe871('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe871('0x5'));var interaction=require(_0xe871('0x6'));var config=require(_0xe871('0x7'));var controller=require(_0xe871('0x8'));router[_0xe871('0x9')]('/',auth[_0xe871('0xa')](),controller[_0xe871('0xb')]);router[_0xe871('0x9')](_0xe871('0xc'),auth[_0xe871('0xa')](),controller['describe']);router[_0xe871('0x9')]('/whoami',auth['isAuthenticated'](),controller[_0xe871('0xd')]);router[_0xe871('0x9')](_0xe871('0xe'),auth['isAuthenticated'](),controller[_0xe871('0xf')]);router[_0xe871('0x9')](_0xe871('0x10'),auth[_0xe871('0xa')](),controller[_0xe871('0x11')]);router[_0xe871('0x9')](_0xe871('0x12'),controller['getAvatar']);router[_0xe871('0x9')](_0xe871('0x13'),auth[_0xe871('0xa')](),controller[_0xe871('0x14')]);router[_0xe871('0x9')](_0xe871('0x15'),auth[_0xe871('0xa')](),controller[_0xe871('0x16')]);router[_0xe871('0x9')]('/:id/queues',auth[_0xe871('0xa')](),controller['getQueues']);router['get'](_0xe871('0x17'),auth[_0xe871('0xa')](),controller[_0xe871('0x18')]);router[_0xe871('0x9')](_0xe871('0x19'),auth[_0xe871('0xa')](),controller[_0xe871('0x1a')]);router[_0xe871('0x9')](_0xe871('0x1b'),auth['isAuthenticated'](),controller[_0xe871('0x1c')]);router['get'](_0xe871('0x1d'),auth[_0xe871('0xa')](),controller['getScreenRecordings']);router[_0xe871('0x9')](_0xe871('0x1e'),auth[_0xe871('0xa')](),controller[_0xe871('0x1f')]);router[_0xe871('0x9')](_0xe871('0x20'),auth[_0xe871('0xa')](),controller[_0xe871('0x21')]);router[_0xe871('0x9')](_0xe871('0x22'),auth[_0xe871('0xa')](),controller[_0xe871('0x23')]);router[_0xe871('0x9')](_0xe871('0x24'),auth[_0xe871('0xa')](),controller[_0xe871('0x25')]);router[_0xe871('0x9')](_0xe871('0x26'),auth[_0xe871('0xa')](),controller[_0xe871('0x27')]);router[_0xe871('0x9')](_0xe871('0x28'),auth[_0xe871('0xa')](),controller[_0xe871('0x29')]);router[_0xe871('0x9')](_0xe871('0x2a'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xe871('0x2b'),auth[_0xe871('0xa')](),controller[_0xe871('0x2c')]);router[_0xe871('0x9')]('/:id/agents',auth[_0xe871('0xa')](),controller['getAgents']);router['get']('/:id/prefixes',auth[_0xe871('0xa')](),controller[_0xe871('0x2d')]);router[_0xe871('0x9')](_0xe871('0x2e'),auth[_0xe871('0xa')](),controller[_0xe871('0x2f')]);router[_0xe871('0x9')](_0xe871('0x30'),auth[_0xe871('0xa')](),controller[_0xe871('0x31')]);router[_0xe871('0x9')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xe871('0x9')]('/:id/sms_accounts',auth[_0xe871('0xa')](),controller['getSmsAccounts']);router['get'](_0xe871('0x32'),auth[_0xe871('0xa')](),controller[_0xe871('0x33')]);router[_0xe871('0x9')](_0xe871('0x34'),auth[_0xe871('0xa')](),controller[_0xe871('0x35')]);router[_0xe871('0x9')](_0xe871('0x36'),auth['isAuthenticated'](),controller[_0xe871('0x37')]);router[_0xe871('0x9')](_0xe871('0x38'),auth[_0xe871('0xa')](),controller[_0xe871('0x39')]);router[_0xe871('0x9')](_0xe871('0x3a'),auth['isAuthenticated'](),controller[_0xe871('0x3b')]);router[_0xe871('0x3c')](_0xe871('0x15'),auth[_0xe871('0xa')](),controller[_0xe871('0x3d')]);router[_0xe871('0x3c')]('/',auth[_0xe871('0xa')](),controller[_0xe871('0x3e')]);router[_0xe871('0x3c')]('/create_many',auth[_0xe871('0xa')](),controller['bulkCreate']);router['post']('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x304f18,_0x4dbcab,_0x2e4cbf){_0x2e4cbf(null,path[_0xe871('0x3f')](config['root'],'server/files/images/'));},'filename':function(_0x58ebe9,_0x2df7d0,_0x222397){_0x222397(null,util['format'](_0xe871('0x40'),Date[_0xe871('0x41')](),_0x2df7d0[_0xe871('0x42')]));}})});router['post'](_0xe871('0x12'),upload[_0xe871('0x43')](_0xe871('0x44')),controller[_0xe871('0x45')]);router[_0xe871('0x3c')](_0xe871('0x46'),auth['isAuthenticated'](),controller[_0xe871('0x47')]);router['post']('/:id/logout',auth[_0xe871('0xa')](),controller['logout']);router[_0xe871('0x3c')](_0xe871('0x48'),auth[_0xe871('0xa')](),controller[_0xe871('0x49')]);router[_0xe871('0x3c')]('/:id/unpause',auth[_0xe871('0xa')](),controller[_0xe871('0x4a')]);router[_0xe871('0x3c')](_0xe871('0x2a'),auth['isAuthenticated'](),controller[_0xe871('0x4b')]);router[_0xe871('0x3c')](_0xe871('0x4c'),auth[_0xe871('0xa')](),controller[_0xe871('0x4d')]);router['post'](_0xe871('0x4e'),auth[_0xe871('0xa')](),controller[_0xe871('0x4f')]);router[_0xe871('0x3c')](_0xe871('0x50'),auth[_0xe871('0xa')](),controller[_0xe871('0x51')]);router[_0xe871('0x3c')](_0xe871('0x52'),auth[_0xe871('0xa')](),controller['addSmsInteractions']);router[_0xe871('0x3c')](_0xe871('0x53'),auth[_0xe871('0xa')](),controller[_0xe871('0x54')]);router[_0xe871('0x3c')](_0xe871('0x55'),auth[_0xe871('0xa')](),controller['addWhatsappInteractions']);router['post'](_0xe871('0x2e'),auth['isAuthenticated'](),controller[_0xe871('0x56')]);router[_0xe871('0x3c')]('/:id/mail_accounts',auth[_0xe871('0xa')](),controller[_0xe871('0x57')]);router[_0xe871('0x3c')]('/:id/openchannel_accounts',auth[_0xe871('0xa')](),controller['addOpenchannelAccounts']);router[_0xe871('0x3c')](_0xe871('0x58'),auth[_0xe871('0xa')](),controller['addSmsAccounts']);router[_0xe871('0x3c')](_0xe871('0x32'),auth[_0xe871('0xa')](),controller['addChatWebsites']);router[_0xe871('0x3c')]('/:id/whatsapp_accounts',auth[_0xe871('0xa')](),controller[_0xe871('0x59')]);router[_0xe871('0x3c')](_0xe871('0x36'),auth[_0xe871('0xa')](),controller[_0xe871('0x5a')]);router[_0xe871('0x3c')](_0xe871('0x3a'),auth[_0xe871('0xa')](),controller[_0xe871('0x5b')]);router[_0xe871('0x5c')](_0xe871('0x10'),auth[_0xe871('0xa')](),controller['update']);router[_0xe871('0x5c')](_0xe871('0x5d'),auth[_0xe871('0xa')](),controller[_0xe871('0x5e')]);router[_0xe871('0x5f')](_0xe871('0x60'),auth[_0xe871('0xa')](),controller[_0xe871('0x61')]);router[_0xe871('0x5f')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe871('0x62')]);router[_0xe871('0x5f')]('/:id',auth[_0xe871('0xa')](),controller[_0xe871('0x63')]);router['delete']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xe871('0x64')]);router[_0xe871('0x5f')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xe871('0x65')]);router[_0xe871('0x5f')](_0xe871('0x52'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xe871('0x5f')](_0xe871('0x53'),auth[_0xe871('0xa')](),controller[_0xe871('0x66')]);router[_0xe871('0x5f')](_0xe871('0x55'),auth[_0xe871('0xa')](),controller[_0xe871('0x67')]);router[_0xe871('0x5f')](_0xe871('0x2e'),auth[_0xe871('0xa')](),controller['removeFaxAccounts']);router[_0xe871('0x5f')](_0xe871('0x30'),auth[_0xe871('0xa')](),controller['removeMailAccounts']);router[_0xe871('0x5f')](_0xe871('0x68'),auth[_0xe871('0xa')](),controller[_0xe871('0x69')]);router['delete'](_0xe871('0x58'),auth['isAuthenticated'](),controller[_0xe871('0x6a')]);router[_0xe871('0x5f')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe871('0x6b')]);router[_0xe871('0x5f')](_0xe871('0x34'),auth[_0xe871('0xa')](),controller[_0xe871('0x6c')]);router[_0xe871('0x5f')](_0xe871('0x36'),auth['isAuthenticated'](),controller['removeSquareProjects']);router['delete']('/:id/api_key',auth['isAuthenticated'](),controller['removeApiKey']);module[_0xe871('0x6d')]=router; \ No newline at end of file +var _0xb492=['destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','addContacts','post','/create_many','bulkCreate','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams'];(function(_0x553cf1,_0x1b083e){var _0x2dbbba=function(_0x315d96){while(--_0x315d96){_0x553cf1['push'](_0x553cf1['shift']());}};_0x2dbbba(++_0x1b083e);}(_0xb492,0x172));var _0x2b49=function(_0x353927,_0x82992a){_0x353927=_0x353927-0x0;var _0x222bb8=_0xb492[_0x353927];return _0x222bb8;};'use strict';var multer=require('multer');var util=require(_0x2b49('0x0'));var path=require(_0x2b49('0x1'));var timeout=require(_0x2b49('0x2'));var express=require(_0x2b49('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b49('0x4'));var interaction=require(_0x2b49('0x5'));var config=require(_0x2b49('0x6'));var controller=require(_0x2b49('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2b49('0x8')]);router[_0x2b49('0x9')](_0x2b49('0xa'),auth[_0x2b49('0xb')](),controller[_0x2b49('0xc')]);router[_0x2b49('0x9')](_0x2b49('0xd'),auth[_0x2b49('0xb')](),controller['whoami']);router[_0x2b49('0x9')](_0x2b49('0xe'),auth['isAuthenticated'](),controller[_0x2b49('0xf')]);router[_0x2b49('0x9')](_0x2b49('0x10'),auth['isAuthenticated'](),controller[_0x2b49('0x11')]);router[_0x2b49('0x9')](_0x2b49('0x12'),controller[_0x2b49('0x13')]);router[_0x2b49('0x9')](_0x2b49('0x14'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x2b49('0x9')](_0x2b49('0x15'),auth['isAuthenticated'](),controller['getContacts']);router[_0x2b49('0x9')](_0x2b49('0x16'),auth[_0x2b49('0xb')](),controller['getQueues']);router[_0x2b49('0x9')](_0x2b49('0x17'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x2b49('0x9')](_0x2b49('0x18'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x19')]);router[_0x2b49('0x9')](_0x2b49('0x1a'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x1b')]);router[_0x2b49('0x9')](_0x2b49('0x1c'),auth['isAuthenticated'](),controller[_0x2b49('0x1d')]);router['get'](_0x2b49('0x1e'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x1f')]);router[_0x2b49('0x9')](_0x2b49('0x20'),auth[_0x2b49('0xb')](),controller['getOpenchannelInteractions']);router[_0x2b49('0x9')](_0x2b49('0x21'),auth[_0x2b49('0xb')](),controller['getMailInteractions']);router[_0x2b49('0x9')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x2b49('0x22')]);router[_0x2b49('0x9')](_0x2b49('0x23'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x24')]);router['get'](_0x2b49('0x25'),auth['isAuthenticated'](),controller[_0x2b49('0x26')]);router[_0x2b49('0x9')](_0x2b49('0x27'),auth[_0x2b49('0xb')](),controller['getTeams']);router[_0x2b49('0x9')](_0x2b49('0x28'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x29')]);router[_0x2b49('0x9')](_0x2b49('0x2a'),auth['isAuthenticated'](),controller[_0x2b49('0x2b')]);router[_0x2b49('0x9')](_0x2b49('0x2c'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x2d')]);router[_0x2b49('0x9')](_0x2b49('0x2e'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x2f')]);router['get'](_0x2b49('0x30'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x31')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x2b49('0x32')]);router[_0x2b49('0x9')](_0x2b49('0x33'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x34')]);router[_0x2b49('0x9')](_0x2b49('0x35'),auth['isAuthenticated'](),controller[_0x2b49('0x36')]);router[_0x2b49('0x9')](_0x2b49('0x37'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x38')]);router[_0x2b49('0x9')](_0x2b49('0x39'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x3a')]);router[_0x2b49('0x9')](_0x2b49('0x3b'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x3c')]);router[_0x2b49('0x9')]('/:id/api_key',auth[_0x2b49('0xb')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0x2b49('0xb')](),controller[_0x2b49('0x3d')]);router[_0x2b49('0x3e')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2b49('0x3f'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x40')]);router['post'](_0x2b49('0x16'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18dad5,_0x2859fe,_0x5ccead){_0x5ccead(null,path['join'](config[_0x2b49('0x41')],_0x2b49('0x42')));},'filename':function(_0x340a45,_0x299ce2,_0x51d9f8){_0x51d9f8(null,util[_0x2b49('0x43')](_0x2b49('0x44'),Date[_0x2b49('0x45')](),_0x299ce2[_0x2b49('0x46')]));}})});router[_0x2b49('0x3e')]('/:id/avatar',upload[_0x2b49('0x47')](_0x2b49('0x48')),controller[_0x2b49('0x49')]);router[_0x2b49('0x3e')](_0x2b49('0x4a'),auth['isAuthenticated'](),controller['login']);router[_0x2b49('0x3e')](_0x2b49('0x4b'),auth['isAuthenticated'](),controller[_0x2b49('0x4c')]);router['post'](_0x2b49('0x4d'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x4e')]);router[_0x2b49('0x3e')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x2b49('0x4f')]);router[_0x2b49('0x3e')]('/:id/teams',auth[_0x2b49('0xb')](),controller[_0x2b49('0x50')]);router[_0x2b49('0x3e')](_0x2b49('0x51'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x52')]);router[_0x2b49('0x3e')](_0x2b49('0x53'),auth[_0x2b49('0xb')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x2b49('0xb')](),controller[_0x2b49('0x54')]);router[_0x2b49('0x3e')](_0x2b49('0x55'),auth['isAuthenticated'](),controller[_0x2b49('0x56')]);router[_0x2b49('0x3e')](_0x2b49('0x57'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x58')]);router[_0x2b49('0x3e')](_0x2b49('0x59'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x5a')]);router[_0x2b49('0x3e')]('/:id/fax_accounts',auth[_0x2b49('0xb')](),controller['addFaxAccounts']);router[_0x2b49('0x3e')](_0x2b49('0x30'),auth['isAuthenticated'](),controller[_0x2b49('0x5b')]);router[_0x2b49('0x3e')](_0x2b49('0x5c'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x5d')]);router['post'](_0x2b49('0x33'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x5e')]);router['post']('/:id/chat_websites',auth[_0x2b49('0xb')](),controller[_0x2b49('0x5f')]);router['post']('/:id/whatsapp_accounts',auth[_0x2b49('0xb')](),controller[_0x2b49('0x60')]);router[_0x2b49('0x3e')]('/:id/square_projects',auth[_0x2b49('0xb')](),controller[_0x2b49('0x61')]);router[_0x2b49('0x3e')](_0x2b49('0x62'),auth['isAuthenticated'](),controller[_0x2b49('0x63')]);router['put'](_0x2b49('0x10'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x64')]);router['put'](_0x2b49('0x65'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x66')]);router[_0x2b49('0x67')](_0x2b49('0x16'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x68')]);router[_0x2b49('0x67')](_0x2b49('0x27'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x69')]);router[_0x2b49('0x67')](_0x2b49('0x10'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x6a')]);router[_0x2b49('0x67')](_0x2b49('0x51'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x6b')]);router[_0x2b49('0x67')](_0x2b49('0x53'),auth['isAuthenticated'](),controller[_0x2b49('0x6c')]);router['delete']('/:id/fax_interactions',auth[_0x2b49('0xb')](),controller[_0x2b49('0x6d')]);router[_0x2b49('0x67')](_0x2b49('0x55'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x6e')]);router[_0x2b49('0x67')]('/:id/openchannel_interactions',auth[_0x2b49('0xb')](),controller[_0x2b49('0x6f')]);router['delete']('/:id/whatsapp_interactions',auth[_0x2b49('0xb')](),controller[_0x2b49('0x70')]);router[_0x2b49('0x67')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x2b49('0x71')]);router[_0x2b49('0x67')](_0x2b49('0x30'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x2b49('0x67')](_0x2b49('0x5c'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x72')]);router['delete'](_0x2b49('0x33'),auth['isAuthenticated'](),controller[_0x2b49('0x73')]);router[_0x2b49('0x67')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x2b49('0x74')]);router[_0x2b49('0x67')](_0x2b49('0x37'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x75')]);router[_0x2b49('0x67')](_0x2b49('0x39'),auth[_0x2b49('0xb')](),controller['removeSquareProjects']);router[_0x2b49('0x67')](_0x2b49('0x62'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x76')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1824855..8c3f212 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 _0x89d4=['dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','false','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','agent','telephone','INTEGER','internal','accountcode','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','info','inband','auto','yes','nonat','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','insecure','never','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','update,nonat','showWebBar','get','wss','encryption','force_avp','icesupport','dtlsenable'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0x89d4,0xc1));var _0x489d=function(_0x4320ce,_0x49f5f5){_0x4320ce=_0x4320ce-0x0;var _0x537dae=_0x89d4[_0x4320ce];return _0x537dae;};'use strict';var Sequelize=require(_0x489d('0x0'));var moment=require(_0x489d('0x1'));var util=require(_0x489d('0x2'));var _=require(_0x489d('0x3'));module[_0x489d('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x489d('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x579ad2){this[_0x489d('0x6')](_0x489d('0x5'),_0x579ad2);this['setDataValue']('defaultuser',_0x579ad2);},'comment':_0x489d('0x7')},'fullname':{'type':Sequelize[_0x489d('0x8')],'allowNull':![],'set':function(_0x3501a8){this[_0x489d('0x6')]('fullname',_0x3501a8);this[_0x489d('0x6')](_0x489d('0x9'),util[_0x489d('0xa')](_0x489d('0xb'),_0x3501a8,this[_0x489d('0xc')]('internal')));}},'alias':{'type':Sequelize[_0x489d('0x8')]},'email':{'type':Sequelize[_0x489d('0x8')],'allowNull':![],'unique':_0x489d('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1624ae){if(_0x1624ae){this[_0x489d('0x6')](_0x489d('0xd'),_0x1624ae['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x489d('0xe'),_0x489d('0xf'),_0x489d('0x10'),_0x489d('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x489d('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':![],'unique':_0x489d('0x13'),'set':function(_0x52526d){this['setDataValue'](_0x489d('0x13'),_0x52526d);this[_0x489d('0x6')](_0x489d('0x14'),_0x52526d);this[_0x489d('0x6')](_0x489d('0x9'),util[_0x489d('0xa')](_0x489d('0xb'),this[_0x489d('0xc')](_0x489d('0x15')),_0x52526d));}},'salt':{'type':Sequelize[_0x489d('0x8')]},'phone':{'type':Sequelize[_0x489d('0x8')]},'mobile':{'type':Sequelize[_0x489d('0x8')]},'address':{'type':Sequelize[_0x489d('0x8')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x489d('0x8')]},'city':{'type':Sequelize[_0x489d('0x8')]},'country':{'type':Sequelize[_0x489d('0x8')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x489d('0x8')],'defaultValue':_0x489d('0x17')},'lastPauseAt':{'type':Sequelize[_0x489d('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x489d('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x489d('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x489d('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x489d('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x489d('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x489d('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x489d('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x489d('0x19')},'ipaddr':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x1b'),_0x489d('0xf'),_0x489d('0x1c')),'allowNull':!![],'defaultValue':_0x489d('0x1b')},'context':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![],'defaultValue':_0x489d('0x1d')},'callingpres':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x1e'),_0x489d('0x1f'),_0x489d('0x20'),_0x489d('0x21'),'PROHIB_NOT_SCREENED',_0x489d('0x22'),_0x489d('0x23'),_0x489d('0x24')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x489d('0x25'),'set':function(_0x3f48f3){this[_0x489d('0x6')](_0x489d('0x26'),_0x3f48f3?_0x3f48f3[_0x489d('0x27')](','):null);},'get':function(){return this[_0x489d('0xc')](_0x489d('0x26'))?this[_0x489d('0xc')](_0x489d('0x26'))[_0x489d('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x29'),_0x489d('0x2a'),'shortinfo',_0x489d('0x2b'),_0x489d('0x2c')),'allowNull':!![],'defaultValue':_0x489d('0x29')},'directmedia':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no',_0x489d('0x2e'),_0x489d('0x2f'),_0x489d('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x489d('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![],'defaultValue':_0x489d('0x31'),'set':function(_0x1c7024){this[_0x489d('0x6')](_0x489d('0x32'),_0x1c7024?_0x1c7024[_0x489d('0x27')](','):null);},'get':function(){return this[_0x489d('0xc')](_0x489d('0x32'))?this[_0x489d('0xc')](_0x489d('0x32'))[_0x489d('0x28')](','):null;},'comment':_0x489d('0x33')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x489d('0x8')]},'pickupgroup':{'type':Sequelize[_0x489d('0x8')]},'namedpickupgroup':{'type':Sequelize[_0x489d('0x8')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x489d('0x8')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x489d('0x34')},'allow':{'type':Sequelize[_0x489d('0x8')],'allowNull':![],'defaultValue':_0x489d('0x35'),'set':function(_0x4c8257){this['setDataValue'](_0x489d('0x36'),_0x4c8257?_0x4c8257[_0x489d('0x27')](';'):_0x489d('0x35'));},'get':function(){return this['getDataValue'](_0x489d('0x36'))?this['getDataValue'](_0x489d('0x36'))[_0x489d('0x28')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![],'set':function(_0x565979){this[_0x489d('0x6')](_0x489d('0x37'),_0x565979?_0x565979['join'](','):null);},'get':function(){return this['getDataValue'](_0x489d('0x37'))?this[_0x489d('0xc')]('insecure')[_0x489d('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no',_0x489d('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x489d('0x1a')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x489d('0x2d')},'busylevel':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no',_0x489d('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x3a'),_0x489d('0x3b'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x3c'),_0x489d('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x489d('0x2d')},'keepalive':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x489d('0x1a')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no',_0x489d('0x3e'),_0x489d('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x40'),_0x489d('0x41'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x489d('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x489d('0x1a')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x489d('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no',_0x489d('0x2e'),_0x489d('0x2f'),_0x489d('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x489d('0x8')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x489d('0x12')],'defaultValue':0x0,'set':function(_0x5f73df){this[_0x489d('0x6')](_0x489d('0x43'),_0x5f73df);var _0x3cef55=this[_0x489d('0x44')]({'plain':!![]});switch(_0x5f73df){case 0x0:case 0x1:var _0x3389eb=_0x3cef55['transport']?_['isArray'](_0x3cef55['transport'])?_0x3cef55['transport']['join']():_0x3cef55[_0x489d('0x26')]:_0x489d('0x25');if(_0x3389eb===_0x489d('0x45')){_0x3389eb=_0x489d('0x25');}this[_0x489d('0x6')]('transport',_0x3389eb);this[_0x489d('0x6')](_0x489d('0x46'),'no');this[_0x489d('0x6')]('avpf',null);this[_0x489d('0x6')](_0x489d('0x47'),null);this['setDataValue'](_0x489d('0x48'),null);this['setDataValue'](_0x489d('0x49'),null);this[_0x489d('0x6')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this[_0x489d('0x6')](_0x489d('0x4a'),null);this[_0x489d('0x6')](_0x489d('0x4b'),null);this[_0x489d('0x6')](_0x489d('0x4c'),'no');break;case 0x2:this[_0x489d('0x6')](_0x489d('0x26'),_0x489d('0x45'));this['setDataValue'](_0x489d('0x46'),'yes');this['setDataValue'](_0x489d('0x4d'),_0x489d('0x2d'));this['setDataValue'](_0x489d('0x47'),_0x489d('0x2d'));this[_0x489d('0x6')]('icesupport',_0x489d('0x2d'));this['setDataValue']('dtlsenable',_0x489d('0x2d'));this[_0x489d('0x6')]('dtlsverify','no');this['setDataValue']('dtlssetup',_0x489d('0x4e'));this[_0x489d('0x6')](_0x489d('0x4a'),_0x3cef55[_0x489d('0x4a')]||_0x489d('0x4f'));this['setDataValue']('dtlsprivatekey',_0x3cef55[_0x489d('0x4b')]||_0x489d('0x50'));this[_0x489d('0x6')](_0x489d('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x489d('0x51')],'set':function(_0x5025e3){this[_0x489d('0x6')](_0x489d('0x52'),_0x5025e3?_0x5025e3['join'](','):[]);},'get':function(){return this[_0x489d('0xc')]('permissions')?_[_0x489d('0x53')](this[_0x489d('0xc')]('permissions')[_0x489d('0x28')](','),function(_0xeeddec){return parseInt(_0xeeddec,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x489d('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x489d('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0x489d('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x489d('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x489d('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x489d('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x489d('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x489d('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x489d('0x1a')](_0x489d('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x489d('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x489d('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x489d('0xc')](_0x489d('0x54'))?this[_0x489d('0xc')](_0x489d('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x489d('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x489d('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x489d('0x16')],'defaultValue':![],'set':function(_0x2065a8){if(typeof _0x2065a8==='string'){var _0x542ec5=_0x2065a8==='1'?!![]:_0x2065a8==='0'?![]:_0x2065a8==='true'?!![]:_0x2065a8===_0x489d('0x55')?![]:![];this['setDataValue']('screenrecording',_0x542ec5);}else{this['setDataValue']('screenrecording',_0x2065a8);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1dbbdc){this['setDataValue'](_0x489d('0x56'),_0x1dbbdc);if(_0x1dbbdc===!![]){this[_0x489d('0x6')](_0x489d('0x57'),moment());this[_0x489d('0x6')](_0x489d('0x58'),0x0);}else{this[_0x489d('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x489d('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x489d('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x489d('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x489d('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0x995a=['setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','split','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','accept','refuse','uas','fingerprint','certificate','update,nonat','TEXT','get','isArray','wss','avpf','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','icesupport','actpass','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x995a,0xa0));var _0xa995=function(_0x3d475b,_0xed9fa){_0x3d475b=_0x3d475b-0x0;var _0x60dc73=_0x995a[_0x3d475b];return _0x60dc73;};'use strict';var Sequelize=require(_0xa995('0x0'));var moment=require(_0xa995('0x1'));var util=require(_0xa995('0x2'));var _=require(_0xa995('0x3'));module[_0xa995('0x4')]={'name':{'type':Sequelize[_0xa995('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4c56e1){this[_0xa995('0x6')](_0xa995('0x7'),_0x4c56e1);this[_0xa995('0x6')](_0xa995('0x8'),_0x4c56e1);},'comment':_0xa995('0x9')},'fullname':{'type':Sequelize[_0xa995('0x5')],'allowNull':![],'set':function(_0x44c22d){this[_0xa995('0x6')](_0xa995('0xa'),_0x44c22d);this[_0xa995('0x6')](_0xa995('0xb'),util[_0xa995('0xc')](_0xa995('0xd'),_0x44c22d,this[_0xa995('0xe')](_0xa995('0xf'))));}},'alias':{'type':Sequelize[_0xa995('0x5')]},'email':{'type':Sequelize[_0xa995('0x5')],'allowNull':![],'unique':_0xa995('0x10'),'validate':{'isEmail':!![]},'set':function(_0x4335c2){if(_0x4335c2){this['setDataValue']('email',_0x4335c2['toLowerCase']());}}},'role':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x12'),_0xa995('0x13'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xa995('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa995('0x5')],'defaultValue':_0xa995('0x14')},'internal':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x211096){this[_0xa995('0x6')](_0xa995('0xf'),_0x211096);this[_0xa995('0x6')](_0xa995('0x16'),_0x211096);this[_0xa995('0x6')](_0xa995('0xb'),util[_0xa995('0xc')](_0xa995('0xd'),this[_0xa995('0xe')]('fullname'),_0x211096));}},'salt':{'type':Sequelize[_0xa995('0x5')]},'phone':{'type':Sequelize[_0xa995('0x5')]},'mobile':{'type':Sequelize[_0xa995('0x5')]},'address':{'type':Sequelize[_0xa995('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xa995('0x5')]},'city':{'type':Sequelize[_0xa995('0x5')]},'country':{'type':Sequelize[_0xa995('0x5')]},'online':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa995('0x5')],'defaultValue':_0xa995('0x18')},'lastPauseAt':{'type':Sequelize[_0xa995('0x19')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa995('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa995('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa995('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![],'defaultValue':_0xa995('0x1a')},'ipaddr':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x1b'),_0xa995('0x13'),_0xa995('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x1d'),'ALLOWED_PASSED_SCREEN',_0xa995('0x1e'),_0xa995('0x1f'),_0xa995('0x20'),'PROHIB_PASSED_SCREEN',_0xa995('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa995('0x22'),'set':function(_0x38dfe0){this[_0xa995('0x6')](_0xa995('0x23'),_0x38dfe0?_0x38dfe0[_0xa995('0x24')](','):null);},'get':function(){return this[_0xa995('0xe')](_0xa995('0x23'))?this[_0xa995('0xe')](_0xa995('0x23'))[_0xa995('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa995('0x11')]('rfc2833','info','shortinfo',_0xa995('0x26'),_0xa995('0x27')),'allowNull':!![],'defaultValue':_0xa995('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xa995('0x29'),'no',_0xa995('0x2a'),_0xa995('0x2b'),_0xa995('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![],'defaultValue':_0xa995('0x2d'),'set':function(_0x295302){this[_0xa995('0x6')](_0xa995('0x2e'),_0x295302?_0x295302[_0xa995('0x24')](','):null);},'get':function(){return this[_0xa995('0xe')]('nat')?this[_0xa995('0xe')](_0xa995('0x2e'))[_0xa995('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xa995('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xa995('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa995('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xa995('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa995('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x421865){this[_0xa995('0x6')]('allow',_0x421865?_0x421865[_0xa995('0x24')](';'):_0xa995('0x2f'));},'get':function(){return this[_0xa995('0xe')]('allow')?this[_0xa995('0xe')](_0xa995('0x30'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xa995('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x827cf5){this[_0xa995('0x6')](_0xa995('0x31'),_0x827cf5?_0x827cf5[_0xa995('0x24')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xa995('0xe')]('insecure')[_0xa995('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa995('0x29'),'no',_0xa995('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![],'defaultValue':_0xa995('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa995('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0xa995('0x29')},'busylevel':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa995('0x11')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x34'),_0xa995('0x35'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xa995('0x36')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![],'defaultValue':_0xa995('0x29')},'keepalive':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xa995('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa995('0x11')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xa995('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xa995('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa995('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa995('0x11')]('yes','no',_0xa995('0x37'),_0xa995('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa995('0x11')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xa995('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa995('0x11')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no',_0xa995('0x2a'),'update',_0xa995('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa995('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xa995('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa995('0x3a')]},'showWebBar':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x0,'set':function(_0x2f46cc){this['setDataValue']('showWebBar',_0x2f46cc);var _0x4f5d32=this[_0xa995('0x3b')]({'plain':!![]});switch(_0x2f46cc){case 0x0:case 0x1:var _0x21ec0b=_0x4f5d32[_0xa995('0x23')]?_[_0xa995('0x3c')](_0x4f5d32[_0xa995('0x23')])?_0x4f5d32[_0xa995('0x23')]['join']():_0x4f5d32[_0xa995('0x23')]:_0xa995('0x22');if(_0x21ec0b===_0xa995('0x3d')){_0x21ec0b=_0xa995('0x22');}this[_0xa995('0x6')](_0xa995('0x23'),_0x21ec0b);this[_0xa995('0x6')]('encryption','no');this[_0xa995('0x6')](_0xa995('0x3e'),null);this[_0xa995('0x6')]('force_avp',null);this[_0xa995('0x6')]('icesupport',null);this[_0xa995('0x6')](_0xa995('0x3f'),null);this[_0xa995('0x6')](_0xa995('0x40'),null);this[_0xa995('0x6')](_0xa995('0x41'),null);this[_0xa995('0x6')](_0xa995('0x42'),null);this['setDataValue'](_0xa995('0x43'),null);this[_0xa995('0x6')](_0xa995('0x44'),'no');break;case 0x2:this['setDataValue']('transport',_0xa995('0x3d'));this[_0xa995('0x6')]('encryption',_0xa995('0x29'));this[_0xa995('0x6')](_0xa995('0x3e'),_0xa995('0x29'));this[_0xa995('0x6')](_0xa995('0x45'),_0xa995('0x29'));this[_0xa995('0x6')](_0xa995('0x46'),_0xa995('0x29'));this[_0xa995('0x6')](_0xa995('0x3f'),_0xa995('0x29'));this[_0xa995('0x6')](_0xa995('0x40'),'no');this[_0xa995('0x6')](_0xa995('0x41'),_0xa995('0x47'));this['setDataValue']('dtlscertfile',_0x4f5d32[_0xa995('0x42')]||'/etc/pki/tls/certs/motion.crt');this[_0xa995('0x6')]('dtlsprivatekey',_0x4f5d32['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xa995('0x6')]('rtcp_mux',_0xa995('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0xa995('0x3a')],'set':function(_0x20ed9c){this[_0xa995('0x6')](_0xa995('0x48'),_0x20ed9c?_0x20ed9c[_0xa995('0x24')](','):[]);},'get':function(){return this[_0xa995('0xe')](_0xa995('0x48'))?_[_0xa995('0x49')](this[_0xa995('0xe')]('permissions')[_0xa995('0x25')](','),function(_0x449ced){return parseInt(_0x449ced,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa995('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xa995('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa995('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa995('0x11')](_0xa995('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa995('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa995('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa995('0x4a')],'get':function(){return this['getDataValue'](_0xa995('0x4b'))?this['getDataValue'](_0xa995('0x4b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa995('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa995('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![],'set':function(_0x1c7195){if(typeof _0x1c7195===_0xa995('0x4c')){var _0x5e6395=_0x1c7195==='1'?!![]:_0x1c7195==='0'?![]:_0x1c7195==='true'?!![]:_0x1c7195===_0xa995('0x4d')?![]:![];this['setDataValue'](_0xa995('0x4e'),_0x5e6395);}else{this[_0xa995('0x6')]('screenrecording',_0x1c7195);}}},'blocked':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![],'set':function(_0x16fc4b){this[_0xa995('0x6')](_0xa995('0x4f'),_0x16fc4b);if(_0x16fc4b===!![]){this[_0xa995('0x6')](_0xa995('0x50'),moment());this[_0xa995('0x6')](_0xa995('0x51'),0x0);}else{this[_0xa995('0x6')](_0xa995('0x50'),null);}}},'blockedAt':{'type':Sequelize[_0xa995('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa995('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa995('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa995('0x15')](0x5)[_0xa995('0x52')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa995('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa995('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 f2d44f3..dcc0c4d 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 _0x0b72=['105','106','107','108','109','100','114','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','create','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','each','telephone','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','Queue:save','VoiceQueue','voice','format','UserVoiceQueueRt','channel','remove','Queue:remove','addAvatar','file','filename','root','server/files/images/logos/default_profile.png','userpic','existsSync','join','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','includeAll','CmList','List','Tags','color','tag','nolimit','getQueues','Queue','order','pick','Unknown\x20role','Queues','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','include','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','UserId','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','phone','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','getVoiceQueues','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','LOGININPAUSE','MemberReport','concat','isMiddleware','logout','pause','QueuePause','updateAttributes','PAUSE','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','lastPauseAt','%s%s','Pause','manual','getTeams','Team','setDataValue','Voice','getChatQueues','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','getFaxQueues','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','upsert','removeTeams','Fax','Openchannel','removeAgent','getLists','send','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$lt','$lte','$ne','$between','$in','$notIn','$like','$notLike','$iLike','$contains','$contained','$any','firstName','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','token','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','resolve','queues','teams','inbound','getAgents','toString','desc','asc','substring','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','ui.','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','limit','undefined','offset','status','set','apply','reject','update','destroy','get','role','admin','Users','user','Agents','agent','Telephones','filter','ignore','map','value','includes','find','name','UserProfileResource','stack','User','fieldName','type','key','model','differenceBy','password','salt','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','merge','lower','sequelize','col','options','count','push','findAll','rows','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','all','show','params','rawAttributes','length','true','fax','body','addContacts','ids','omit','Setting','securePassword','validatePasswordPattern','max','internal','min_internal','isNil','SELECT','from','mailbox','VoiceMail','fullname','permissions','101','102','103','113','110','104'];(function(_0xc6b011,_0x5d1f19){var _0x420171=function(_0x433751){while(--_0x433751){_0xc6b011['push'](_0xc6b011['shift']());}};_0x420171(++_0x5d1f19);}(_0x0b72,0x119));var _0x20b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b72[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x20b7('0x0'));var rimraf=require(_0x20b7('0x1'));var zipdir=require(_0x20b7('0x2'));var jsonpatch=require(_0x20b7('0x3'));var rp=require(_0x20b7('0x4'));var moment=require('moment');var BPromise=require(_0x20b7('0x5'));var Mustache=require(_0x20b7('0x6'));var util=require('util');var path=require(_0x20b7('0x7'));var sox=require(_0x20b7('0x8'));var csv=require(_0x20b7('0x9'));var ejs=require(_0x20b7('0xa'));var fs=require('fs');var fs_extra=require(_0x20b7('0xb'));var _=require('lodash');var squel=require(_0x20b7('0xc'));var crypto=require('crypto');var jsforce=require(_0x20b7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x20b7('0x9'));var querystring=require(_0x20b7('0xe'));var Papa=require('papaparse');var Redis=require(_0x20b7('0xf'));var values;var authService=require('../../components/auth/service');var qs=require(_0x20b7('0x10'));var as=require(_0x20b7('0x11'));var hardwareService=require(_0x20b7('0x12'));var logger=require(_0x20b7('0x13'))(_0x20b7('0x14'));var utils=require('../../config/utils');var config=require(_0x20b7('0x15'));var licenseUtil=require(_0x20b7('0x16'));var db=require(_0x20b7('0x17'))['db'];config[_0x20b7('0x18')]=_[_0x20b7('0x19')](config[_0x20b7('0x18')],{'host':_0x20b7('0x1a'),'port':0x18eb});var socket=require(_0x20b7('0x1b'))(new Redis(config[_0x20b7('0x18')]));require(_0x20b7('0x1c'))[_0x20b7('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x20b7('0x1e')][_0x20b7('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x120867,_0x38136b,_0xac178c,_0x4fd5cb){return new BPromise(function(_0x253691,_0x35b761){var _0x38ae07=_0x4fd5cb||client;return _0x38ae07[_0x20b7('0x20')](_0x120867,_0xac178c)[_0x20b7('0x21')](function(_0x46c0af){logger[_0x20b7('0x22')](_0x20b7('0x23'),_0x38136b,_0x20b7('0x24'));logger[_0x20b7('0x25')](_0x20b7('0x26'),_0x38136b,_0x20b7('0x24'),JSON[_0x20b7('0x27')](_0x46c0af));if(_0x46c0af['error']){if(_0x46c0af[_0x20b7('0x28')][_0x20b7('0x29')]===0x1f4){logger[_0x20b7('0x28')](_0x20b7('0x23'),_0x38136b,_0x46c0af[_0x20b7('0x28')][_0x20b7('0x2a')]);return _0x35b761(_0x46c0af[_0x20b7('0x28')]['message']);}logger['error']('User,\x20%s,\x20%s',_0x38136b,_0x46c0af[_0x20b7('0x28')][_0x20b7('0x2a')]);return _0x253691(_0x46c0af['error']['message']);}else{logger[_0x20b7('0x22')](_0x20b7('0x23'),_0x38136b,'request\x20sent');_0x253691(_0x46c0af['result']['message']);}})[_0x20b7('0x2b')](function(_0x5a9eb7){logger[_0x20b7('0x28')](_0x20b7('0x23'),_0x38136b,_0x5a9eb7);_0x35b761(_0x5a9eb7);});});}function respondWithStatusCode(_0x21feb1,_0x4efbfa){_0x4efbfa=_0x4efbfa||0xcc;return function(_0x5bace5){if(_0x5bace5){return _0x21feb1[_0x20b7('0x2c')](_0x4efbfa);}return _0x21feb1['status'](_0x4efbfa)[_0x20b7('0x2d')]();};}function respondWithResult(_0x2ed2e8,_0x514150){_0x514150=_0x514150||0xc8;return function(_0x5ef6a0){if(_0x5ef6a0){return _0x2ed2e8['status'](_0x514150)[_0x20b7('0x2e')](_0x5ef6a0);}};}function respondWithFilteredResult(_0x483ee3,_0x3f06e2){return function(_0x5a4c85){if(_0x5a4c85){var _0x10a9bf=typeof _0x3f06e2['offset']==='undefined'&&typeof _0x3f06e2[_0x20b7('0x2f')]===_0x20b7('0x30');var _0x48873d=_0x5a4c85['count'];var _0x403375=_0x10a9bf?0x0:_0x3f06e2[_0x20b7('0x31')];var _0x3ab70b=_0x10a9bf?_0x5a4c85['count']:_0x3f06e2[_0x20b7('0x31')]+_0x3f06e2[_0x20b7('0x2f')];var _0x164231;if(_0x3ab70b>=_0x48873d){_0x3ab70b=_0x48873d;_0x164231=0xc8;}else{_0x164231=0xce;}_0x483ee3[_0x20b7('0x32')](_0x164231);return _0x483ee3[_0x20b7('0x33')]('Content-Range',_0x403375+'-'+_0x3ab70b+'/'+_0x48873d)[_0x20b7('0x2e')](_0x5a4c85);}return null;};}function patchUpdates(_0x3c1aa4){return function(_0x1806e3){try{jsonpatch[_0x20b7('0x34')](_0x1806e3,_0x3c1aa4,!![]);}catch(_0x312817){return BPromise[_0x20b7('0x35')](_0x312817);}return _0x1806e3['save']();};}function saveUpdates(_0x49ab41,_0x231feb){return function(_0x22c08e){if(_0x22c08e){return _0x22c08e[_0x20b7('0x36')](_0x49ab41)[_0x20b7('0x21')](function(_0x173ff7){return _0x173ff7;});}return null;};}function removeEntity(_0x208098,_0x1eb260){return function(_0x522a6c){if(_0x522a6c){return _0x522a6c[_0x20b7('0x37')]()[_0x20b7('0x21')](function(){var _0x36468c=_0x522a6c[_0x20b7('0x38')]({'plain':!![]});if(_0x36468c[_0x20b7('0x39')]===_0x20b7('0x3a'))return;var _0x55304b=[{'name':_0x20b7('0x3b'),'value':_0x20b7('0x3c'),'ignore':!![]},{'name':_0x20b7('0x3d'),'value':_0x20b7('0x3e'),'ignore':![]},{'name':_0x20b7('0x3f'),'value':'telephone','ignore':![]}];var _0x34a7b8=_(_0x55304b)[_0x20b7('0x40')](_0x20b7('0x41'))[_0x20b7('0x42')](_0x20b7('0x43'))[_0x20b7('0x43')]();if(_[_0x20b7('0x44')](_0x34a7b8,_0x36468c[_0x20b7('0x39')])){return;}var _0x1ab79a=_[_0x20b7('0x45')](_0x55304b,[_0x20b7('0x43'),_0x36468c['role']])[_0x20b7('0x46')];return db[_0x20b7('0x47')][_0x20b7('0x37')]({'where':{'type':_0x1ab79a,'resourceId':_0x36468c['id']}})[_0x20b7('0x21')](function(){return _0x522a6c;});})['then'](function(){_0x208098[_0x20b7('0x32')](0xcc)[_0x20b7('0x2d')]();});}};}function handleEntityNotFound(_0x17fde0,_0x168aea){return function(_0x3df70b){if(!_0x3df70b){_0x17fde0[_0x20b7('0x2c')](0x194);}return _0x3df70b;};}function handleError(_0x56a366,_0x4f0ce2){_0x4f0ce2=_0x4f0ce2||0x1f4;return function(_0x281b2){logger[_0x20b7('0x28')](_0x281b2[_0x20b7('0x48')]);if(_0x281b2[_0x20b7('0x46')]){delete _0x281b2['name'];}_0x56a366[_0x20b7('0x32')](_0x4f0ce2)['send'](_0x281b2);};}exports['index']=function(_0x45d700,_0x5ae127){var _0x1e8176={},_0x89ab60={},_0x5f899d={'count':0x0,'rows':[]};var _0x2a48b4=_['map'](db[_0x20b7('0x49')]['rawAttributes'],function(_0x10833e){return{'name':_0x10833e[_0x20b7('0x4a')],'type':_0x10833e[_0x20b7('0x4b')][_0x20b7('0x4c')]};});_0x89ab60[_0x20b7('0x4d')]=_[_0x20b7('0x4e')](_[_0x20b7('0x42')](_0x2a48b4,_0x20b7('0x46')),[_0x20b7('0x4f'),_0x20b7('0x50')]);_0x89ab60[_0x20b7('0x51')]=_[_0x20b7('0x52')](_0x45d700[_0x20b7('0x51')]);_0x89ab60[_0x20b7('0x53')]=_[_0x20b7('0x54')](_0x89ab60[_0x20b7('0x4d')],_0x89ab60['query']);_0x1e8176['attributes']=_[_0x20b7('0x54')](_0x89ab60['model'],qs[_0x20b7('0x55')](_0x45d700['query'][_0x20b7('0x55')]));_0x1e8176[_0x20b7('0x56')]=_0x1e8176[_0x20b7('0x56')]['length']?_0x1e8176[_0x20b7('0x56')]:_0x89ab60[_0x20b7('0x4d')];if(!_0x45d700[_0x20b7('0x51')][_0x20b7('0x57')]('nolimit')){_0x1e8176[_0x20b7('0x2f')]=qs[_0x20b7('0x2f')](_0x45d700[_0x20b7('0x51')][_0x20b7('0x2f')]);_0x1e8176[_0x20b7('0x31')]=qs['offset'](_0x45d700['query'][_0x20b7('0x31')]);}_0x1e8176['order']=qs['sort'](_0x45d700[_0x20b7('0x51')][_0x20b7('0x58')]);_0x1e8176['where']=qs[_0x20b7('0x53')](_['pick'](_0x45d700[_0x20b7('0x51')],_0x89ab60[_0x20b7('0x53')]),_0x2a48b4);if(_0x45d700[_0x20b7('0x51')][_0x20b7('0x40')]){_0x1e8176[_0x20b7('0x59')]=_[_0x20b7('0x5a')](_0x1e8176[_0x20b7('0x59')],{'$or':_[_0x20b7('0x42')](_0x2a48b4,function(_0x3c88e6){if(_0x3c88e6[_0x20b7('0x4b')]!=='VIRTUAL'){return db['sequelize'][_0x20b7('0x59')](db['sequelize']['fn'](_0x20b7('0x5b'),db[_0x20b7('0x5c')][_0x20b7('0x5d')](_0x3c88e6[_0x20b7('0x46')])),{'$like':db[_0x20b7('0x5c')]['fn']('lower','%'+_0x45d700[_0x20b7('0x51')][_0x20b7('0x40')]+'%')});}})});}_0x1e8176=_['merge']({},_0x1e8176,_0x45d700[_0x20b7('0x5e')]);var _0x49d1d5={'where':_0x1e8176[_0x20b7('0x59')]};return db[_0x20b7('0x49')][_0x20b7('0x5f')](_0x49d1d5)[_0x20b7('0x21')](function(_0xc20da){_0x5f899d[_0x20b7('0x5f')]=_0xc20da;if(_0x45d700['query']['includeAll']){_0x1e8176['include']=[{'all':!![]}];}if(!_[_0x20b7('0x44')](_0x1e8176['attributes'],'id')){_0x1e8176[_0x20b7('0x56')][_0x20b7('0x60')]('id');}return db[_0x20b7('0x49')][_0x20b7('0x61')](_0x1e8176);})[_0x20b7('0x21')](function(_0x409e93){_0x5f899d[_0x20b7('0x62')]=_0x409e93;if(_0x45d700[_0x20b7('0x51')][_0x20b7('0x63')]==='true'){var _0x5e84b1=[];for(var _0x29b998=0x0;_0x29b998<_0x5f899d[_0x20b7('0x62')]['length'];_0x29b998++){_0x5e84b1[_0x20b7('0x60')](get_open_tabs(_0x20b7('0x64'),_0x5f899d['rows'][_0x29b998][_0x20b7('0x65')]));_0x5e84b1[_0x20b7('0x60')](get_open_tabs(_0x20b7('0x66'),_0x5f899d[_0x20b7('0x62')][_0x29b998][_0x20b7('0x65')]));_0x5e84b1[_0x20b7('0x60')](get_open_tabs('fax',_0x5f899d[_0x20b7('0x62')][_0x29b998]['dataValues']));_0x5e84b1[_0x20b7('0x60')](get_open_tabs(_0x20b7('0x67'),_0x5f899d[_0x20b7('0x62')][_0x29b998][_0x20b7('0x65')]));_0x5e84b1['push'](get_open_tabs(_0x20b7('0x68'),_0x5f899d[_0x20b7('0x62')][_0x29b998][_0x20b7('0x65')]));_0x5e84b1['push'](get_open_tabs(_0x20b7('0x69'),_0x5f899d[_0x20b7('0x62')][_0x29b998]['dataValues']));}return BPromise[_0x20b7('0x6a')](_0x5e84b1)['then'](function(_0x42eb6f){return _0x5f899d;});}else{return _0x5f899d;}})[_0x20b7('0x21')](respondWithFilteredResult(_0x5ae127,_0x1e8176))['catch'](handleError(_0x5ae127,null));};exports[_0x20b7('0x6b')]=function(_0x566060,_0x212a66){var _0x30d2a7={'raw':![],'where':{'id':_0x566060[_0x20b7('0x6c')]['id']}},_0x4947a0={};_0x4947a0[_0x20b7('0x4d')]=_['differenceBy'](_[_0x20b7('0x52')](db[_0x20b7('0x49')][_0x20b7('0x6d')]),[_0x20b7('0x4f'),_0x20b7('0x50')]);_0x4947a0['query']=_[_0x20b7('0x52')](_0x566060['query']);_0x4947a0[_0x20b7('0x53')]=_[_0x20b7('0x54')](_0x4947a0[_0x20b7('0x4d')],_0x4947a0[_0x20b7('0x51')]);_0x30d2a7['attributes']=_[_0x20b7('0x54')](_0x4947a0['model'],qs['fields'](_0x566060[_0x20b7('0x51')]['fields']));_0x30d2a7[_0x20b7('0x56')]=_0x30d2a7[_0x20b7('0x56')][_0x20b7('0x6e')]?_0x30d2a7['attributes']:_0x4947a0[_0x20b7('0x4d')];if(_0x566060[_0x20b7('0x51')]['includeAll']){_0x30d2a7['include']=[{'all':!![]}];}_0x30d2a7=_[_0x20b7('0x5a')]({},_0x30d2a7,_0x566060[_0x20b7('0x5e')]);if(!_[_0x20b7('0x44')](_0x30d2a7[_0x20b7('0x56')],'id')){_0x30d2a7['attributes'][_0x20b7('0x60')]('id');}return db['User'][_0x20b7('0x45')](_0x30d2a7)['then'](handleEntityNotFound(_0x212a66,null))[_0x20b7('0x21')](function(_0x42c9d4){var _0x2c69d5=[];values=_0x42c9d4;if(_0x566060[_0x20b7('0x51')][_0x20b7('0x63')]===_0x20b7('0x6f')){_0x2c69d5['push'](get_open_tabs('chat',_0x42c9d4[_0x20b7('0x65')]));_0x2c69d5['push'](get_open_tabs(_0x20b7('0x66'),_0x42c9d4['dataValues']));_0x2c69d5[_0x20b7('0x60')](get_open_tabs(_0x20b7('0x68'),_0x42c9d4['dataValues']));_0x2c69d5[_0x20b7('0x60')](get_open_tabs(_0x20b7('0x69'),_0x42c9d4[_0x20b7('0x65')]));_0x2c69d5['push'](get_open_tabs(_0x20b7('0x70'),_0x42c9d4[_0x20b7('0x65')]));_0x2c69d5[_0x20b7('0x60')](get_open_tabs(_0x20b7('0x67'),_0x42c9d4[_0x20b7('0x65')]));return BPromise[_0x20b7('0x6a')](_0x2c69d5);}else{return values;}})[_0x20b7('0x21')](function(_0x2ef4e4){return values;})[_0x20b7('0x21')](respondWithResult(_0x212a66,null))[_0x20b7('0x2b')](handleError(_0x212a66,null));};exports[_0x20b7('0x36')]=function(_0x37c6ad,_0x513d52){if(_0x37c6ad[_0x20b7('0x71')]['id']){delete _0x37c6ad[_0x20b7('0x71')]['id'];}delete _0x37c6ad[_0x20b7('0x71')][_0x20b7('0x39')];return db[_0x20b7('0x49')][_0x20b7('0x45')]({'where':{'id':_0x37c6ad[_0x20b7('0x6c')]['id']}})[_0x20b7('0x21')](handleEntityNotFound(_0x513d52,null))[_0x20b7('0x21')](saveUpdates(_0x37c6ad[_0x20b7('0x71')],null))['then'](respondWithResult(_0x513d52,null))['catch'](handleError(_0x513d52,null));};exports['describe']=function(_0x4c13ff,_0x450d0e){return db[_0x20b7('0x49')]['describe']()[_0x20b7('0x21')](respondWithResult(_0x450d0e,null))[_0x20b7('0x2b')](handleError(_0x450d0e,null));};exports[_0x20b7('0x72')]=function(_0x1bedda,_0x2aff2d,_0x575b23){return db[_0x20b7('0x49')]['find']({'where':{'id':_0x1bedda[_0x20b7('0x6c')]['id']}})[_0x20b7('0x21')](handleEntityNotFound(_0x2aff2d,null))[_0x20b7('0x21')](function(_0x23bb6a){if(_0x23bb6a){return _0x23bb6a[_0x20b7('0x72')](_0x1bedda[_0x20b7('0x71')][_0x20b7('0x73')],_[_0x20b7('0x74')](_0x1bedda[_0x20b7('0x71')],['ids','id'])||{});}})[_0x20b7('0x21')](respondWithResult(_0x2aff2d,null))[_0x20b7('0x2b')](handleError(_0x2aff2d,null));};function validateUser(_0x3a24d3){return new BPromise(function(_0x26d5c6,_0x2d4554){if(_0x3a24d3['internal'])return _0x26d5c6(_0x3a24d3);return db[_0x20b7('0x75')]['findById'](0x1)[_0x20b7('0x21')](function(_0x1a61b9){if(_0x1a61b9[_0x20b7('0x76')])authService[_0x20b7('0x77')](_0x3a24d3[_0x20b7('0x4f')]);db[_0x20b7('0x49')][_0x20b7('0x78')](_0x20b7('0x79'))[_0x20b7('0x21')](function(_0x5ed089){if(_['isNil'](_0x5ed089)){_0x3a24d3[_0x20b7('0x79')]=_0x1a61b9[_0x20b7('0x7a')]||0x1;return;}if(_[_0x20b7('0x7b')](_0x1a61b9[_0x20b7('0x7a')])||_0x1a61b9['min_internal']===_0x5ed089){_0x3a24d3[_0x20b7('0x79')]=_0x5ed089+0x1;return;}if(_0x1a61b9[_0x20b7('0x7a')]>_0x5ed089){_0x3a24d3['internal']=_0x1a61b9[_0x20b7('0x7a')];return;}return db[_0x20b7('0x5c')][_0x20b7('0x51')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x20b7('0x5c')]['QueryTypes'][_0x20b7('0x7c')]})['then'](function(_0x134a6d){if(_0x134a6d&&_0x134a6d[_0x20b7('0x6e')]){for(var _0x17001c=0x0,_0x1d056b=_0x134a6d['length'];_0x17001c<_0x1d056b&&_['isNil'](_0x3a24d3['internal']);_0x17001c++){if(_0x1a61b9[_0x20b7('0x7a')]<=_0x134a6d[_0x17001c][_0x20b7('0x7d')]){_0x3a24d3[_0x20b7('0x79')]=_0x134a6d[_0x17001c][_0x20b7('0x7d')];}else if(_0x1a61b9[_0x20b7('0x7a')]>_0x134a6d[_0x17001c][_0x20b7('0x7d')]&&_0x1a61b9[_0x20b7('0x7a')]<=_0x134a6d[_0x17001c]['to']){_0x3a24d3[_0x20b7('0x79')]=_0x1a61b9[_0x20b7('0x7a')];}}}if(_[_0x20b7('0x7b')](_0x3a24d3['internal'])){_0x3a24d3[_0x20b7('0x79')]=_0x5ed089+0x1;}return _0x26d5c6(_0x3a24d3);});});})[_0x20b7('0x2b')](function(_0x42f7ed){_0x2d4554(_0x42f7ed);});});}function updateUser(_0x2da92a){return new BPromise(function(_0x541cc5,_0x5c5ea5){try{if(_0x2da92a['voicemail']){_0x2da92a[_0x20b7('0x7e')]=_0x2da92a[_0x20b7('0x79')];_0x2da92a[_0x20b7('0x7f')]={'mailbox':_0x2da92a[_0x20b7('0x79')],'password':_0x2da92a[_0x20b7('0x4f')],'fullname':_0x2da92a[_0x20b7('0x80')],'email':_0x2da92a['email']};}if(_0x2da92a['role']==='agent'){if(!_0x2da92a[_0x20b7('0x81')])_0x2da92a[_0x20b7('0x81')]=[_0x20b7('0x82'),_0x20b7('0x83'),_0x20b7('0x84'),_0x20b7('0x85'),_0x20b7('0x86'),_0x20b7('0x87'),_0x20b7('0x88'),_0x20b7('0x89'),_0x20b7('0x8a'),_0x20b7('0x8b'),_0x20b7('0x8c'),_0x20b7('0x8d'),'111',_0x20b7('0x8e'),'115'];}_0x541cc5(_0x2da92a);}catch(_0x100cf4){_0x5c5ea5(_0x100cf4);}});}exports['create']=function(_0x41153e,_0x177b44){if(_0x41153e[_0x20b7('0x3c')][_0x20b7('0x39')]==='agent')throw new Error(_0x20b7('0x8f'));if(_0x41153e[_0x20b7('0x71')][_0x20b7('0x39')]===_0x20b7('0x3c')&&_0x41153e['user'][_0x20b7('0x39')]!==_0x20b7('0x3a')){throw new Error(_0x20b7('0x90'));}if(_0x41153e['body'][_0x20b7('0x39')]===_0x20b7('0x3a')&&_0x41153e[_0x20b7('0x3c')]['role']!==_0x20b7('0x3a')){throw new Error(_0x20b7('0x91'));}return licenseUtil['checkUserLimits']([_0x41153e[_0x20b7('0x71')]])[_0x20b7('0x21')](function(){return validateUser(_0x41153e[_0x20b7('0x71')]);})[_0x20b7('0x21')](function(_0x31e6fa){return updateUser(_0x31e6fa)[_0x20b7('0x21')](function(_0x1454c2){if(_0x1454c2['role']===_0x20b7('0x3a')){_0x1454c2['settingsEnabled']=_0x41153e['user'][_0x20b7('0x92')];delete _0x1454c2[_0x20b7('0x93')];}return _0x1454c2;});})[_0x20b7('0x21')](function(_0x3bae35){return db['User'][_0x20b7('0x94')](_0x3bae35,{'include':[{'model':db[_0x20b7('0x7f')],'as':_0x20b7('0x7f')}]});})[_0x20b7('0x21')](function(_0xf8bc1b){if(_0x41153e['body'][_0x20b7('0x39')]==='user')return _0xf8bc1b;if(_0x41153e[_0x20b7('0x3c')][_0x20b7('0x39')]!=='user')return _0xf8bc1b;return db[_0x20b7('0x95')][_0x20b7('0x45')]({'where':{'name':_0xf8bc1b['role']===_0x20b7('0x3e')?_0x20b7('0x3d'):_0x20b7('0x3f'),'userProfileId':_0x41153e['user']['userProfileId']},'raw':!![]})['then'](function(_0x5660ca){if(!_0x5660ca||_0x5660ca[_0x20b7('0x96')]!=0x0)return _0xf8bc1b;return db['UserProfileResource']['create']({'name':_0xf8bc1b[_0x20b7('0x46')],'resourceId':_0xf8bc1b['id'],'type':_0x5660ca[_0x20b7('0x46')],'sectionId':_0x5660ca['id']},{})[_0x20b7('0x21')](function(){return _0xf8bc1b;});})['catch'](function(_0x39305b){logger[_0x20b7('0x28')](_0x20b7('0x97'),_0x39305b);throw _0x39305b;});})['then'](respondWithResult(_0x177b44,0xc9))[_0x20b7('0x2b')](handleError(_0x177b44,null));};exports[_0x20b7('0x98')]=function(_0x4db362,_0x4f819d){var _0xe3af7d=_0x4db362[_0x20b7('0x71')];var _0xd9fa8d=[];if(_0x4db362[_0x20b7('0x3c')][_0x20b7('0x39')]===_0x20b7('0x3e'))throw new Error(_0x20b7('0x8f'));if(_[_0x20b7('0x99')](_0xe3af7d,[_0x20b7('0x39'),_0x20b7('0x3c')])&&_0x4db362[_0x20b7('0x3c')][_0x20b7('0x39')]!==_0x20b7('0x3a')){throw new Error(_0x20b7('0x90'));}if(_[_0x20b7('0x99')](_0xe3af7d,[_0x20b7('0x39'),_0x20b7('0x3a')])&&_0x4db362[_0x20b7('0x3c')][_0x20b7('0x39')]!==_0x20b7('0x3a')){throw new Error(_0x20b7('0x9a'));}return licenseUtil[_0x20b7('0x9b')](_0xe3af7d)[_0x20b7('0x21')](function(){return validateUser(_0xe3af7d[0x0]);})[_0x20b7('0x21')](function(){for(var _0x33f86d=0x1;_0x33f86d<_0xe3af7d[_0x20b7('0x6e')];_0x33f86d++){var _0x37a2e0=_0xe3af7d[_0x33f86d-0x1][_0x20b7('0x79')];if(!_0xe3af7d[_0x33f86d][_0x20b7('0x79')])_0xe3af7d[_0x33f86d][_0x20b7('0x79')]=_0x37a2e0+0x1;_0xd9fa8d[_0x20b7('0x60')](validateUser(_0xe3af7d[_0x33f86d]));}return BPromise[_0x20b7('0x6a')](_0xd9fa8d);})[_0x20b7('0x21')](function(){_0xd9fa8d=[];for(var _0x340eb9=0x0;_0x340eb9<_0xe3af7d[_0x20b7('0x6e')];_0x340eb9++){_0xd9fa8d[_0x20b7('0x60')](updateUser(_0xe3af7d[_0x340eb9]));}return BPromise[_0x20b7('0x6a')](_0xd9fa8d);})[_0x20b7('0x21')](function(){return BPromise[_0x20b7('0x9c')](_0xe3af7d,function(_0x2748fd){return db['User']['create'](_0x2748fd,{'include':[{'model':db[_0x20b7('0x7f')],'as':_0x20b7('0x7f')}]})[_0x20b7('0x21')](function(_0x3f974e){_0x2748fd['id']=_0x3f974e['id'];return _0x2748fd;});});})['then'](function(_0x1521e6){if(_0x4db362[_0x20b7('0x71')]['role']===_0x20b7('0x3c'))return _0x1521e6;if(_0x4db362['user']['role']!==_0x20b7('0x3c'))return _0x1521e6;var _0x1c043c=_[_0x20b7('0x99')](_0x1521e6,function(_0x5d50a9){return _0x5d50a9[_0x20b7('0x39')]===_0x20b7('0x3e')||_0x5d50a9[_0x20b7('0x39')]===_0x20b7('0x9d');});if(!_0x1c043c)return _0x1521e6;return db[_0x20b7('0x95')]['findAll']({'where':{'name':{'$or':[_0x20b7('0x3d'),_0x20b7('0x3f')]},'userProfileId':_0x4db362[_0x20b7('0x3c')][_0x20b7('0x93')]},'raw':!![]})['then'](function(_0x5bf915){if(_[_0x20b7('0x9e')](_0x5bf915)||!_[_0x20b7('0x99')](_0x5bf915,[_0x20b7('0x96'),0x0]))return _0x1521e6;_0xd9fa8d=[];var _0x3fe7b4=_(_0x5bf915)[_0x20b7('0x42')](function(_0x78595b){if(_0x78595b['autoAssociation']===0x1)return;return _0x78595b[_0x20b7('0x46')]===_0x20b7('0x3d')?_0x20b7('0x3e'):_0x20b7('0x9d');})[_0x20b7('0x9f')]()[_0x20b7('0x43')]();for(var _0x233f53=0x0;_0x233f53<_0x1521e6[_0x20b7('0x6e')];_0x233f53++){if(!_[_0x20b7('0x44')](_0x3fe7b4,_0x1521e6[_0x233f53][_0x20b7('0x39')]))return;var _0x286f35=_0x1521e6[_0x233f53]['role']===_0x20b7('0x3e')?_0x20b7('0x3d'):_0x20b7('0x3f');_0xd9fa8d['push'](db['UserProfileResource'][_0x20b7('0x94')]({'name':_0x1521e6[_0x233f53][_0x20b7('0x46')],'resourceId':_0x1521e6[_0x233f53]['id'],'type':_0x286f35,'sectionId':_[_0x20b7('0x45')](_0x5bf915,['name',_0x286f35])['id']},{}));}return BPromise[_0x20b7('0x6a')](_0xd9fa8d);});})['then'](respondWithResult(_0x4f819d,0xc9))['catch'](handleError(_0x4f819d,null));};exports[_0x20b7('0xa0')]=function(_0x5f54c8,_0x4ae5c7,_0x48bc68){if(_0x5f54c8[_0x20b7('0x71')]['id']){delete _0x5f54c8[_0x20b7('0x71')]['id'];}return db[_0x20b7('0x49')][_0x20b7('0x45')]({'where':{'id':_0x5f54c8['params']['id']}})[_0x20b7('0x21')](function(_0x5cbd42){if(!_0x5cbd42)return null;if(_0x5cbd42['id']===_0x5f54c8['user']['id']){if(!_0x5f54c8[_0x20b7('0x71')][_0x20b7('0xa1')]||!_0x5f54c8[_0x20b7('0x71')][_0x20b7('0xa2')]){throw new db['Sequelize'][(_0x20b7('0xa3'))](_0x20b7('0xa4'));}if(!_0x5cbd42[_0x20b7('0xa5')](_0x5f54c8[_0x20b7('0x71')]['oldPassword'])){throw new db[(_0x20b7('0xa6'))][(_0x20b7('0xa3'))](_0x20b7('0xa7'));}if(_0x5f54c8[_0x20b7('0x71')][_0x20b7('0xa1')]===_0x5f54c8[_0x20b7('0x71')][_0x20b7('0xa2')]){throw new db['Sequelize'][(_0x20b7('0xa3'))](_0x20b7('0xa8'));}}else if(_0x5f54c8[_0x20b7('0x3c')]['role']===_0x20b7('0x3a')){if(!_0x5f54c8[_0x20b7('0x71')][_0x20b7('0xa2')]){throw new db[(_0x20b7('0xa6'))][(_0x20b7('0xa3'))](_0x20b7('0xa9'));}}else if(_0x5f54c8[_0x20b7('0x3c')][_0x20b7('0x39')]===_0x20b7('0x3c')){if(!_0x5f54c8[_0x20b7('0x71')][_0x20b7('0xa2')]){throw new db['Sequelize'][(_0x20b7('0xa3'))](_0x20b7('0xa9'));}if(_0x5cbd42[_0x20b7('0x39')]!==_0x20b7('0x3e')){throw new db['Sequelize'][(_0x20b7('0xa3'))](_0x20b7('0x8f'));}}else{throw new db[(_0x20b7('0xa6'))][(_0x20b7('0xa3'))](_0x20b7('0x8f'));}return _0x5cbd42;})[_0x20b7('0x21')](handleEntityNotFound(_0x4ae5c7,null))[_0x20b7('0x21')](function(_0x43225c){return db[_0x20b7('0x75')][_0x20b7('0xaa')]({'attributes':['id','securePassword',_0x20b7('0xab'),_0x20b7('0xac')]})[_0x20b7('0x21')](function(_0xb50ccc){if(_0xb50ccc[_0x20b7('0x76')])authService[_0x20b7('0x77')](_0x5f54c8[_0x20b7('0x71')]['newPassword']);if(!_0xb50ccc['enforcePasswordHistory']||!_0x43225c[_0x20b7('0xad')])return _0x43225c;authService[_0x20b7('0xae')](_0x5f54c8[_0x20b7('0x71')][_0x20b7('0xa2')],_0x43225c[_0x20b7('0xad')],_0xb50ccc['passwordHistoryLimit']);return _0x43225c;})[_0x20b7('0x21')](saveUpdates({'password':_0x5f54c8[_0x20b7('0x71')][_0x20b7('0xa2')],'passwordResetAt':_0x5f54c8['user']['id']==_0x5f54c8[_0x20b7('0x6c')]['id']?moment():null,'previousPasswords':authService[_0x20b7('0xaf')](_0x5f54c8['body']['newPassword'],_0x43225c[_0x20b7('0xad')])},null));})[_0x20b7('0x21')](respondWithResult(_0x4ae5c7,null))[_0x20b7('0x2b')](handleError(_0x4ae5c7,null));};exports[_0x20b7('0xb0')]=function(_0x4f5a71,_0x56af0c,_0x4d5763){var _0x3580d3=_0x4f5a71['body']['channel'];return db[_0x20b7('0x49')][_0x20b7('0x45')]({'where':{'id':_0x4f5a71['params']['id']},'attributes':['id',_0x20b7('0x46'),_0x20b7('0x39'),_0x20b7('0xb1'),_0x20b7('0xb2'),_0x20b7('0xb3'),_0x20b7('0xb4')]})[_0x20b7('0x21')](handleEntityNotFound(_0x56af0c,null))[_0x20b7('0x21')](function(_0x23ddb8){if(_0x23ddb8){if(!utils[_0x20b7('0xb5')](_0x3580d3)){throw new db[(_0x20b7('0xa6'))][(_0x20b7('0xa3'))](_0x20b7('0xb6'));}return _0x23ddb8[_0x20b7('0xb7')+_[_0x20b7('0xb8')](_0x3580d3[_0x20b7('0xb9')]())+'Queues'](_0x4f5a71[_0x20b7('0x71')][_0x20b7('0x73')],{'penalty':_0x4f5a71[_0x20b7('0x71')][_0x20b7('0xba')]||0x0})[_0x20b7('0xbb')](function(_0x2c9377){for(var _0x46ebc5=0x0;_0x46ebc5<_0x4f5a71['body'][_0x20b7('0x73')][_0x20b7('0x6e')];_0x46ebc5+=0x1){var _0x39d7b8={'UserId':_0x4f5a71['params']['id']};_0x39d7b8[_[_0x20b7('0xb8')](_0x3580d3[_0x20b7('0xb9')]())+_0x20b7('0xbc')]=_0x4f5a71[_0x20b7('0x71')]['ids'][_0x46ebc5];socket[_0x20b7('0xbd')]('user'+_[_0x20b7('0xb8')](_0x3580d3[_0x20b7('0xb9')]())+_0x20b7('0xbe'),_0x39d7b8);}return _0x2c9377;})[_0x20b7('0x21')](function(){if(_0x3580d3==='voice'){return db[_0x20b7('0xbf')][_0x20b7('0x61')]({'where':{'id':_0x4f5a71['body'][_0x20b7('0x73')]||[]},'raw':!![],'attributes':['id',_0x20b7('0x46')]});}})[_0x20b7('0x21')](function(_0x5398c9){var _0x2b1b3f=_0x23ddb8[_0x20b7('0x38')]({'plain':!![]});var _0x1c0893=[];if(_0x3580d3===_0x20b7('0xc0')&&_0x2b1b3f[_0x20b7('0x39')]==='agent'&&_0x2b1b3f['online']){for(var _0x69d556=0x0;_0x69d556<_0x5398c9[_0x20b7('0x6e')];_0x69d556+=0x1){_0x1c0893['push']({'membername':_0x2b1b3f[_0x20b7('0x46')],'UserId':_0x2b1b3f['id'],'queue_name':_0x5398c9[_0x69d556][_0x20b7('0x46')],'VoiceQueueId':_0x5398c9[_0x69d556]['id'],'interface':_['isNil'](_0x2b1b3f[_0x20b7('0xb4')])?util[_0x20b7('0xc1')]('SIP/%s',_0x2b1b3f[_0x20b7('0x46')]):_0x2b1b3f['interface'],'paused':_0x2b1b3f[_0x20b7('0xb3')]||![],'penalty':_0x4f5a71[_0x20b7('0x71')][_0x20b7('0xba')]||0x0});}return BPromise['each'](_0x1c0893,function(_0x57d1f4){return db[_0x20b7('0xc2')]['upsert'](_0x57d1f4);});}return _0x23ddb8;});}})['then'](respondWithStatusCode(_0x56af0c,null))['catch'](handleError(_0x56af0c,null));};exports['removeQueues']=function(_0xc4a88f,_0x1cfd5a,_0x37ae24){var _0x4d9062;return db[_0x20b7('0x49')][_0x20b7('0x45')]({'where':{'id':_0xc4a88f[_0x20b7('0x6c')]['id']},'attributes':['id','name',_0x20b7('0x39')]})[_0x20b7('0x21')](handleEntityNotFound(_0x1cfd5a,null))[_0x20b7('0x21')](function(_0x453469){if(_0x453469){_0x4d9062=_0x453469;if(!_0xc4a88f[_0x20b7('0x51')][_0x20b7('0xc3')]||!utils[_0x20b7('0xb5')](_0xc4a88f['query'][_0x20b7('0xc3')])){throw new db[(_0x20b7('0xa6'))]['ValidationError'](_0x20b7('0xb6'));}return _0x453469[_0x20b7('0xc4')+_['capitalize'](_0xc4a88f[_0x20b7('0x51')][_0x20b7('0xc3')][_0x20b7('0xb9')]())+'Queues'](_0xc4a88f[_0x20b7('0x51')][_0x20b7('0x73')]);}})[_0x20b7('0x21')](function(_0x61bb0f){for(var _0x14f07e=0x0;_0x14f07e<_0xc4a88f[_0x20b7('0x51')][_0x20b7('0x73')][_0x20b7('0x6e')];_0x14f07e+=0x1){var _0x7dd0f7={'UserId':_0xc4a88f[_0x20b7('0x6c')]['id']};_0x7dd0f7[_[_0x20b7('0xb8')](_0xc4a88f[_0x20b7('0x51')]['channel'][_0x20b7('0xb9')]())+_0x20b7('0xbc')]=_0xc4a88f['query'][_0x20b7('0x73')][_0x14f07e];socket[_0x20b7('0xbd')](_0x20b7('0x3c')+_[_0x20b7('0xb8')](_0xc4a88f[_0x20b7('0x51')]['channel'][_0x20b7('0xb9')]())+_0x20b7('0xc5'),_0x7dd0f7);}return _0x61bb0f;})[_0x20b7('0x21')](function(){if(_0xc4a88f['query'][_0x20b7('0xc3')]===_0x20b7('0xc0')){return db[_0x20b7('0xc2')]['destroy']({'where':{'UserId':_0xc4a88f[_0x20b7('0x6c')]['id'],'VoiceQueueId':_0xc4a88f[_0x20b7('0x51')][_0x20b7('0x73')]},'individualHooks':!![]})[_0x20b7('0x21')](function(){return _0x4d9062;});}return _0x4d9062;})[_0x20b7('0x21')](respondWithStatusCode(_0x1cfd5a,null))['catch'](handleError(_0x1cfd5a,null));};exports[_0x20b7('0xc6')]=function(_0x50ceac,_0x2ff747,_0x269c7f){_0x50ceac[_0x20b7('0x71')]['userpic']=_0x50ceac[_0x20b7('0xc7')][_0x20b7('0xc8')];return db['User'][_0x20b7('0x45')]({'where':{'id':_0x50ceac[_0x20b7('0x6c')]['id']}})[_0x20b7('0x21')](handleEntityNotFound(_0x2ff747,null))[_0x20b7('0x21')](saveUpdates(_0x50ceac['body'],null))['then'](respondWithResult(_0x2ff747,null))['catch'](handleError(_0x2ff747,null));};exports['getAvatar']=function(_0x940bd9,_0x35c228,_0x518635){var _0x15b565=path['join'](config[_0x20b7('0xc9')],_0x20b7('0xca'));return db['User']['find']({'where':{'id':_0x940bd9[_0x20b7('0x6c')]['id']},'attributes':['id',_0x20b7('0xcb')],'raw':!![]})[_0x20b7('0x21')](handleEntityNotFound(_0x35c228,null))[_0x20b7('0x21')](function(_0x3938e7){if(_0x3938e7){if(_[_0x20b7('0x7b')](_0x3938e7['userpic'])){return _0x35c228['download'](_0x15b565);}else{if(!fs[_0x20b7('0xcc')](path[_0x20b7('0xcd')](config['root'],_0x20b7('0xce'),_0x3938e7[_0x20b7('0xcb')]))){return _0x35c228[_0x20b7('0xcf')](_0x15b565);}return _0x35c228[_0x20b7('0xcf')](path['join'](config[_0x20b7('0xc9')],_0x20b7('0xce'),_0x3938e7[_0x20b7('0xcb')]));}}})['catch'](handleError(_0x35c228,null));};exports[_0x20b7('0xd0')]=function(_0x1c1ca4,_0x9924a7,_0x26929b){return db[_0x20b7('0x49')][_0x20b7('0x45')]({'where':{'id':_0x1c1ca4[_0x20b7('0x6c')]['id']},'attributes':['id']})[_0x20b7('0x21')](handleEntityNotFound(_0x9924a7,null))['then'](function(_0x50fd89){var _0x1a357f=[];values=_0x50fd89[_0x20b7('0x65')];_0x1a357f[_0x20b7('0x60')](get_open_tabs(_0x20b7('0x64'),_0x50fd89[_0x20b7('0x65')]));_0x1a357f['push'](get_open_tabs('sms',_0x50fd89[_0x20b7('0x65')]));_0x1a357f[_0x20b7('0x60')](get_open_tabs('openchannel',_0x50fd89[_0x20b7('0x65')]));_0x1a357f[_0x20b7('0x60')](get_open_tabs('whatsapp',_0x50fd89[_0x20b7('0x65')]));_0x1a357f['push'](get_open_tabs(_0x20b7('0x70'),_0x50fd89[_0x20b7('0x65')]));_0x1a357f[_0x20b7('0x60')](get_open_tabs(_0x20b7('0x67'),_0x50fd89[_0x20b7('0x65')]));return BPromise[_0x20b7('0x6a')](_0x1a357f);})[_0x20b7('0x21')](function(_0x3500e9){var _0x58e8d3=[];if(_0x3500e9){for(var _0x547b24=0x0;_0x547b24=_0x3c95a4){_0x2404bb=_0x3c95a4;_0x55af0a=0xc8;}else{_0x55af0a=0xce;}_0x95be14['status'](_0x55af0a);return _0x95be14[_0xf04a('0x32')](_0xf04a('0x33'),_0x42353a+'-'+_0x2404bb+'/'+_0x3c95a4)[_0xf04a('0x34')](_0x59cd3d);}return null;};}function patchUpdates(_0x4ef12c){return function(_0x22f635){try{jsonpatch[_0xf04a('0x35')](_0x22f635,_0x4ef12c,!![]);}catch(_0x12b5e4){return BPromise[_0xf04a('0x36')](_0x12b5e4);}return _0x22f635[_0xf04a('0x37')]();};}function saveUpdates(_0x15c830,_0x4f60e0){return function(_0x5f2c19){if(_0x5f2c19){return _0x5f2c19[_0xf04a('0x38')](_0x15c830)[_0xf04a('0x22')](function(_0x5647b5){return _0x5647b5;});}return null;};}function removeEntity(_0x2b6601,_0x6d6e65){return function(_0x3e2cf5){if(_0x3e2cf5){return _0x3e2cf5['destroy']()['then'](function(){var _0x2d267f=_0x3e2cf5['get']({'plain':!![]});if(_0x2d267f[_0xf04a('0x39')]==='admin')return;var _0x43b3f7=[{'name':'Users','value':'user','ignore':!![]},{'name':_0xf04a('0x3a'),'value':_0xf04a('0x3b'),'ignore':![]},{'name':'Telephones','value':_0xf04a('0x3c'),'ignore':![]}];var _0x56a749=_(_0x43b3f7)[_0xf04a('0x3d')](_0xf04a('0x3e'))[_0xf04a('0x3f')](_0xf04a('0x40'))[_0xf04a('0x40')]();if(_['includes'](_0x56a749,_0x2d267f[_0xf04a('0x39')])){return;}var _0x8bdbfa=_[_0xf04a('0x41')](_0x43b3f7,[_0xf04a('0x40'),_0x2d267f[_0xf04a('0x39')]])[_0xf04a('0x42')];return db['UserProfileResource'][_0xf04a('0x43')]({'where':{'type':_0x8bdbfa,'resourceId':_0x2d267f['id']}})[_0xf04a('0x22')](function(){return _0x3e2cf5;});})[_0xf04a('0x22')](function(){_0x2b6601[_0xf04a('0x2c')](0xcc)[_0xf04a('0x2d')]();});}};}function handleEntityNotFound(_0x5d4a69,_0x4c9291){return function(_0x17cd7f){if(!_0x17cd7f){_0x5d4a69[_0xf04a('0x44')](0x194);}return _0x17cd7f;};}function handleError(_0x3d0d4c,_0x4d2146){_0x4d2146=_0x4d2146||0x1f4;return function(_0x212fd1){logger[_0xf04a('0x26')](_0x212fd1[_0xf04a('0x45')]);if(_0x212fd1[_0xf04a('0x42')]){delete _0x212fd1[_0xf04a('0x42')];}_0x3d0d4c[_0xf04a('0x2c')](_0x4d2146)[_0xf04a('0x46')](_0x212fd1);};}exports[_0xf04a('0x47')]=function(_0x48f63b,_0x47468e){var _0x208d46={},_0x23b0cb={},_0x2209c5={'count':0x0,'rows':[]};var _0xe5f843=_[_0xf04a('0x3f')](db['User'][_0xf04a('0x48')],function(_0x59bd0e){return{'name':_0x59bd0e[_0xf04a('0x49')],'type':_0x59bd0e[_0xf04a('0x4a')][_0xf04a('0x4b')]};});_0x23b0cb[_0xf04a('0x4c')]=_['differenceBy'](_['map'](_0xe5f843,_0xf04a('0x42')),[_0xf04a('0x4d'),_0xf04a('0x4e')]);_0x23b0cb[_0xf04a('0x4f')]=_[_0xf04a('0x50')](_0x48f63b[_0xf04a('0x4f')]);_0x23b0cb[_0xf04a('0x51')]=_[_0xf04a('0x52')](_0x23b0cb[_0xf04a('0x4c')],_0x23b0cb[_0xf04a('0x4f')]);_0x208d46[_0xf04a('0x53')]=_[_0xf04a('0x52')](_0x23b0cb['model'],qs[_0xf04a('0x54')](_0x48f63b[_0xf04a('0x4f')][_0xf04a('0x54')]));_0x208d46[_0xf04a('0x53')]=_0x208d46[_0xf04a('0x53')]['length']?_0x208d46[_0xf04a('0x53')]:_0x23b0cb[_0xf04a('0x4c')];if(!_0x48f63b[_0xf04a('0x4f')][_0xf04a('0x55')]('nolimit')){_0x208d46[_0xf04a('0x31')]=qs[_0xf04a('0x31')](_0x48f63b[_0xf04a('0x4f')][_0xf04a('0x31')]);_0x208d46[_0xf04a('0x2e')]=qs[_0xf04a('0x2e')](_0x48f63b[_0xf04a('0x4f')]['offset']);}_0x208d46[_0xf04a('0x56')]=qs['sort'](_0x48f63b[_0xf04a('0x4f')][_0xf04a('0x57')]);_0x208d46[_0xf04a('0x58')]=qs[_0xf04a('0x51')](_['pick'](_0x48f63b[_0xf04a('0x4f')],_0x23b0cb['filters']),_0xe5f843);if(_0x48f63b[_0xf04a('0x4f')][_0xf04a('0x3d')]){_0x208d46[_0xf04a('0x58')]=_[_0xf04a('0x59')](_0x208d46['where'],{'$or':_[_0xf04a('0x3f')](_0xe5f843,function(_0x6067a8){if(_0x6067a8[_0xf04a('0x4a')]!==_0xf04a('0x5a')){return db['sequelize'][_0xf04a('0x58')](db['sequelize']['fn']('lower',db[_0xf04a('0x5b')][_0xf04a('0x5c')](_0x6067a8[_0xf04a('0x42')])),{'$like':db['sequelize']['fn'](_0xf04a('0x5d'),'%'+_0x48f63b[_0xf04a('0x4f')][_0xf04a('0x3d')]+'%')});}})});}_0x208d46=_[_0xf04a('0x59')]({},_0x208d46,_0x48f63b[_0xf04a('0x5e')]);var _0x1f6fac={'where':_0x208d46['where']};return db[_0xf04a('0x5f')][_0xf04a('0x30')](_0x1f6fac)['then'](function(_0x59a66c){_0x2209c5[_0xf04a('0x30')]=_0x59a66c;if(_0x48f63b[_0xf04a('0x4f')]['includeAll']){_0x208d46['include']=[{'all':!![]}];}if(!_['includes'](_0x208d46['attributes'],'id')){_0x208d46[_0xf04a('0x53')][_0xf04a('0x60')]('id');}return db[_0xf04a('0x5f')]['findAll'](_0x208d46);})[_0xf04a('0x22')](function(_0x4a3796){_0x2209c5[_0xf04a('0x61')]=_0x4a3796;if(_0x48f63b[_0xf04a('0x4f')][_0xf04a('0x62')]===_0xf04a('0x63')){var _0x519015=[];for(var _0x36968b=0x0;_0x36968b<_0x2209c5[_0xf04a('0x61')][_0xf04a('0x64')];_0x36968b++){_0x519015[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x65'),_0x2209c5[_0xf04a('0x61')][_0x36968b][_0xf04a('0x66')]));_0x519015[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x67'),_0x2209c5['rows'][_0x36968b]['dataValues']));_0x519015['push'](get_open_tabs(_0xf04a('0x68'),_0x2209c5[_0xf04a('0x61')][_0x36968b][_0xf04a('0x66')]));_0x519015[_0xf04a('0x60')](get_open_tabs('mail',_0x2209c5[_0xf04a('0x61')][_0x36968b][_0xf04a('0x66')]));_0x519015[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x69'),_0x2209c5['rows'][_0x36968b]['dataValues']));_0x519015[_0xf04a('0x60')](get_open_tabs('whatsapp',_0x2209c5[_0xf04a('0x61')][_0x36968b][_0xf04a('0x66')]));}return BPromise['all'](_0x519015)[_0xf04a('0x22')](function(_0x3b23f3){return _0x2209c5;});}else{return _0x2209c5;}})[_0xf04a('0x22')](respondWithFilteredResult(_0x47468e,_0x208d46))[_0xf04a('0x2b')](handleError(_0x47468e,null));};exports['show']=function(_0x44d517,_0x47816a){var _0x49df6b={'raw':![],'where':{'id':_0x44d517[_0xf04a('0x6a')]['id']}},_0x2f0dd8={};_0x2f0dd8[_0xf04a('0x4c')]=_[_0xf04a('0x6b')](_[_0xf04a('0x50')](db[_0xf04a('0x5f')]['rawAttributes']),['password','salt']);_0x2f0dd8[_0xf04a('0x4f')]=_[_0xf04a('0x50')](_0x44d517['query']);_0x2f0dd8['filters']=_[_0xf04a('0x52')](_0x2f0dd8[_0xf04a('0x4c')],_0x2f0dd8[_0xf04a('0x4f')]);_0x49df6b['attributes']=_[_0xf04a('0x52')](_0x2f0dd8[_0xf04a('0x4c')],qs['fields'](_0x44d517['query'][_0xf04a('0x54')]));_0x49df6b[_0xf04a('0x53')]=_0x49df6b[_0xf04a('0x53')][_0xf04a('0x64')]?_0x49df6b[_0xf04a('0x53')]:_0x2f0dd8[_0xf04a('0x4c')];if(_0x44d517[_0xf04a('0x4f')][_0xf04a('0x6c')]){_0x49df6b[_0xf04a('0x6d')]=[{'all':!![]}];}_0x49df6b=_['merge']({},_0x49df6b,_0x44d517[_0xf04a('0x5e')]);if(!_['includes'](_0x49df6b['attributes'],'id')){_0x49df6b['attributes'][_0xf04a('0x60')]('id');}return db[_0xf04a('0x5f')][_0xf04a('0x41')](_0x49df6b)[_0xf04a('0x22')](handleEntityNotFound(_0x47816a,null))['then'](function(_0x20c995){var _0x25dfeb=[];values=_0x20c995;if(_0x44d517[_0xf04a('0x4f')]['openTabs']==='true'){_0x25dfeb['push'](get_open_tabs(_0xf04a('0x65'),_0x20c995['dataValues']));_0x25dfeb[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x67'),_0x20c995['dataValues']));_0x25dfeb[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x69'),_0x20c995[_0xf04a('0x66')]));_0x25dfeb[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x6e'),_0x20c995[_0xf04a('0x66')]));_0x25dfeb[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x68'),_0x20c995[_0xf04a('0x66')]));_0x25dfeb[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x6f'),_0x20c995['dataValues']));return BPromise[_0xf04a('0x70')](_0x25dfeb);}else{return values;}})[_0xf04a('0x22')](function(_0x1550e3){return values;})['then'](respondWithResult(_0x47816a,null))['catch'](handleError(_0x47816a,null));};exports[_0xf04a('0x38')]=function(_0x344d87,_0xa01fdc){if(_0x344d87[_0xf04a('0x71')]['id']){delete _0x344d87['body']['id'];}delete _0x344d87[_0xf04a('0x71')][_0xf04a('0x39')];return db[_0xf04a('0x5f')][_0xf04a('0x41')]({'where':{'id':_0x344d87[_0xf04a('0x6a')]['id']}})[_0xf04a('0x22')](handleEntityNotFound(_0xa01fdc,null))[_0xf04a('0x22')](saveUpdates(_0x344d87[_0xf04a('0x71')],null))['then'](respondWithResult(_0xa01fdc,null))[_0xf04a('0x2b')](handleError(_0xa01fdc,null));};exports[_0xf04a('0x72')]=function(_0x2553d8,_0x41b9f7){return db[_0xf04a('0x5f')][_0xf04a('0x72')]()[_0xf04a('0x22')](respondWithResult(_0x41b9f7,null))[_0xf04a('0x2b')](handleError(_0x41b9f7,null));};exports[_0xf04a('0x73')]=function(_0x3da73a,_0x29fc01,_0x5b5026){return db['User'][_0xf04a('0x41')]({'where':{'id':_0x3da73a['params']['id']}})['then'](handleEntityNotFound(_0x29fc01,null))[_0xf04a('0x22')](function(_0x259362){if(_0x259362){return _0x259362[_0xf04a('0x73')](_0x3da73a['body'][_0xf04a('0x74')],_['omit'](_0x3da73a[_0xf04a('0x71')],[_0xf04a('0x74'),'id'])||{});}})[_0xf04a('0x22')](respondWithResult(_0x29fc01,null))[_0xf04a('0x2b')](handleError(_0x29fc01,null));};function validateUser(_0xd3c2b5){return new BPromise(function(_0x152717,_0x1bbdde){if(_0xd3c2b5[_0xf04a('0x75')])return _0x152717(_0xd3c2b5);return db[_0xf04a('0x76')][_0xf04a('0x77')](0x1)[_0xf04a('0x22')](function(_0x77ed02){if(_0x77ed02[_0xf04a('0x78')])authService['validatePasswordPattern'](_0xd3c2b5[_0xf04a('0x4d')]);db[_0xf04a('0x5f')][_0xf04a('0x79')]('internal')[_0xf04a('0x22')](function(_0x364bc3){if(_[_0xf04a('0x7a')](_0x364bc3)){_0xd3c2b5[_0xf04a('0x75')]=_0x77ed02[_0xf04a('0x7b')]||0x1;return;}if(_['isNil'](_0x77ed02[_0xf04a('0x7b')])||_0x77ed02['min_internal']===_0x364bc3){_0xd3c2b5[_0xf04a('0x75')]=_0x364bc3+0x1;return;}if(_0x77ed02['min_internal']>_0x364bc3){_0xd3c2b5[_0xf04a('0x75')]=_0x77ed02[_0xf04a('0x7b')];return;}return db[_0xf04a('0x5b')][_0xf04a('0x4f')](_0xf04a('0x7c'),{'type':db[_0xf04a('0x5b')][_0xf04a('0x7d')][_0xf04a('0x7e')]})['then'](function(_0x48a1a5){if(_0x48a1a5&&_0x48a1a5[_0xf04a('0x64')]){for(var _0x11c740=0x0,_0x485f7b=_0x48a1a5[_0xf04a('0x64')];_0x11c740<_0x485f7b&&_[_0xf04a('0x7a')](_0xd3c2b5[_0xf04a('0x75')]);_0x11c740++){if(_0x77ed02[_0xf04a('0x7b')]<=_0x48a1a5[_0x11c740]['from']){_0xd3c2b5[_0xf04a('0x75')]=_0x48a1a5[_0x11c740][_0xf04a('0x7f')];}else if(_0x77ed02[_0xf04a('0x7b')]>_0x48a1a5[_0x11c740][_0xf04a('0x7f')]&&_0x77ed02[_0xf04a('0x7b')]<=_0x48a1a5[_0x11c740]['to']){_0xd3c2b5['internal']=_0x77ed02[_0xf04a('0x7b')];}}}if(_[_0xf04a('0x7a')](_0xd3c2b5[_0xf04a('0x75')])){_0xd3c2b5[_0xf04a('0x75')]=_0x364bc3+0x1;}return _0x152717(_0xd3c2b5);});});})[_0xf04a('0x2b')](function(_0x1c2980){_0x1bbdde(_0x1c2980);});});}function updateUser(_0x47ebb6){return new BPromise(function(_0x1beed5,_0x3a30f9){try{if(_0x47ebb6[_0xf04a('0x80')]){_0x47ebb6[_0xf04a('0x81')]=_0x47ebb6[_0xf04a('0x75')];_0x47ebb6[_0xf04a('0x82')]={'mailbox':_0x47ebb6[_0xf04a('0x75')],'password':_0x47ebb6['password'],'fullname':_0x47ebb6[_0xf04a('0x83')],'email':_0x47ebb6[_0xf04a('0x84')]};}if(_0x47ebb6['role']===_0xf04a('0x3b')){if(!_0x47ebb6[_0xf04a('0x85')])_0x47ebb6[_0xf04a('0x85')]=[_0xf04a('0x86'),_0xf04a('0x87'),_0xf04a('0x88'),_0xf04a('0x89'),'110','104',_0xf04a('0x8a'),_0xf04a('0x8b'),'107',_0xf04a('0x8c'),_0xf04a('0x8d'),_0xf04a('0x8e'),_0xf04a('0x8f'),'114','115'];}_0x1beed5(_0x47ebb6);}catch(_0x3c47e6){_0x3a30f9(_0x3c47e6);}});}exports['create']=function(_0x502fa9,_0x404f69){if(_0x502fa9[_0xf04a('0x90')][_0xf04a('0x39')]===_0xf04a('0x3b'))throw new Error(_0xf04a('0x91'));if(_0x502fa9[_0xf04a('0x71')][_0xf04a('0x39')]===_0xf04a('0x90')&&_0x502fa9[_0xf04a('0x90')][_0xf04a('0x39')]!==_0xf04a('0x92')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x502fa9[_0xf04a('0x71')][_0xf04a('0x39')]===_0xf04a('0x92')&&_0x502fa9[_0xf04a('0x90')][_0xf04a('0x39')]!==_0xf04a('0x92')){throw new Error(_0xf04a('0x93'));}return licenseUtil[_0xf04a('0x94')]([_0x502fa9[_0xf04a('0x71')]])[_0xf04a('0x22')](function(){return validateUser(_0x502fa9[_0xf04a('0x71')]);})[_0xf04a('0x22')](function(_0x329ecb){return updateUser(_0x329ecb)['then'](function(_0x8bcae7){if(_0x8bcae7[_0xf04a('0x39')]==='admin'){_0x8bcae7[_0xf04a('0x95')]=_0x502fa9[_0xf04a('0x90')][_0xf04a('0x95')];delete _0x8bcae7[_0xf04a('0x96')];}return _0x8bcae7;});})[_0xf04a('0x22')](function(_0x4ba008){return db[_0xf04a('0x5f')][_0xf04a('0x97')](_0x4ba008,{'include':[{'model':db[_0xf04a('0x82')],'as':_0xf04a('0x82')}]});})['then'](function(_0xbabba9){if(_0x502fa9[_0xf04a('0x71')][_0xf04a('0x39')]===_0xf04a('0x90'))return _0xbabba9;if(_0x502fa9[_0xf04a('0x90')]['role']!=='user')return _0xbabba9;return db['UserProfileSection'][_0xf04a('0x41')]({'where':{'name':_0xbabba9['role']===_0xf04a('0x3b')?'Agents':_0xf04a('0x98'),'userProfileId':_0x502fa9[_0xf04a('0x90')][_0xf04a('0x96')]},'raw':!![]})[_0xf04a('0x22')](function(_0x4b30d1){if(!_0x4b30d1||_0x4b30d1['autoAssociation']!=0x0)return _0xbabba9;return db[_0xf04a('0x99')]['create']({'name':_0xbabba9[_0xf04a('0x42')],'resourceId':_0xbabba9['id'],'type':_0x4b30d1['name'],'sectionId':_0x4b30d1['id']},{})[_0xf04a('0x22')](function(){return _0xbabba9;});})[_0xf04a('0x2b')](function(_0x4a747c){logger[_0xf04a('0x26')](_0xf04a('0x9a'),_0x4a747c);throw _0x4a747c;});})[_0xf04a('0x22')](respondWithResult(_0x404f69,0xc9))['catch'](handleError(_0x404f69,null));};exports[_0xf04a('0x9b')]=function(_0x427f64,_0x46d050){var _0x4861cb=_0x427f64[_0xf04a('0x71')];var _0x582182=[];if(_0x427f64[_0xf04a('0x90')][_0xf04a('0x39')]===_0xf04a('0x3b'))throw new Error(_0xf04a('0x91'));if(_[_0xf04a('0x9c')](_0x4861cb,[_0xf04a('0x39'),_0xf04a('0x90')])&&_0x427f64[_0xf04a('0x90')]['role']!==_0xf04a('0x92')){throw new Error(_0xf04a('0x9d'));}if(_[_0xf04a('0x9c')](_0x4861cb,['role',_0xf04a('0x92')])&&_0x427f64['user'][_0xf04a('0x39')]!==_0xf04a('0x92')){throw new Error(_0xf04a('0x9e'));}return licenseUtil[_0xf04a('0x94')](_0x4861cb)[_0xf04a('0x22')](function(){return validateUser(_0x4861cb[0x0]);})[_0xf04a('0x22')](function(){for(var _0x44e3d6=0x1;_0x44e3d6<_0x4861cb[_0xf04a('0x64')];_0x44e3d6++){var _0x822b5f=_0x4861cb[_0x44e3d6-0x1][_0xf04a('0x75')];if(!_0x4861cb[_0x44e3d6][_0xf04a('0x75')])_0x4861cb[_0x44e3d6][_0xf04a('0x75')]=_0x822b5f+0x1;_0x582182[_0xf04a('0x60')](validateUser(_0x4861cb[_0x44e3d6]));}return BPromise[_0xf04a('0x70')](_0x582182);})[_0xf04a('0x22')](function(){_0x582182=[];for(var _0x5e5582=0x0;_0x5e5582<_0x4861cb[_0xf04a('0x64')];_0x5e5582++){_0x582182[_0xf04a('0x60')](updateUser(_0x4861cb[_0x5e5582]));}return BPromise[_0xf04a('0x70')](_0x582182);})[_0xf04a('0x22')](function(){return BPromise[_0xf04a('0x9f')](_0x4861cb,function(_0x52715e){return db['User'][_0xf04a('0x97')](_0x52715e,{'include':[{'model':db[_0xf04a('0x82')],'as':_0xf04a('0x82')}]})[_0xf04a('0x22')](function(_0x54c250){_0x52715e['id']=_0x54c250['id'];return _0x52715e;});});})[_0xf04a('0x22')](function(_0x5e5161){if(_0x427f64[_0xf04a('0x71')][_0xf04a('0x39')]===_0xf04a('0x90'))return _0x5e5161;if(_0x427f64[_0xf04a('0x90')][_0xf04a('0x39')]!==_0xf04a('0x90'))return _0x5e5161;var _0x324ae7=_[_0xf04a('0x9c')](_0x5e5161,function(_0x25981a){return _0x25981a[_0xf04a('0x39')]===_0xf04a('0x3b')||_0x25981a[_0xf04a('0x39')]===_0xf04a('0x3c');});if(!_0x324ae7)return _0x5e5161;return db[_0xf04a('0xa0')]['findAll']({'where':{'name':{'$or':[_0xf04a('0x3a'),'Telephones']},'userProfileId':_0x427f64[_0xf04a('0x90')]['userProfileId']},'raw':!![]})[_0xf04a('0x22')](function(_0x52f1f2){if(_[_0xf04a('0xa1')](_0x52f1f2)||!_[_0xf04a('0x9c')](_0x52f1f2,[_0xf04a('0xa2'),0x0]))return _0x5e5161;_0x582182=[];var _0x39ee84=_(_0x52f1f2)['map'](function(_0x26ba5a){if(_0x26ba5a[_0xf04a('0xa2')]===0x1)return;return _0x26ba5a['name']===_0xf04a('0x3a')?'agent':_0xf04a('0x3c');})[_0xf04a('0xa3')]()['value']();for(var _0xee814d=0x0;_0xee814d<_0x5e5161['length'];_0xee814d++){if(!_[_0xf04a('0xa4')](_0x39ee84,_0x5e5161[_0xee814d]['role']))return;var _0x4f4adf=_0x5e5161[_0xee814d][_0xf04a('0x39')]==='agent'?_0xf04a('0x3a'):'Telephones';_0x582182['push'](db[_0xf04a('0x99')][_0xf04a('0x97')]({'name':_0x5e5161[_0xee814d][_0xf04a('0x42')],'resourceId':_0x5e5161[_0xee814d]['id'],'type':_0x4f4adf,'sectionId':_[_0xf04a('0x41')](_0x52f1f2,[_0xf04a('0x42'),_0x4f4adf])['id']},{}));}return BPromise[_0xf04a('0x70')](_0x582182);});})[_0xf04a('0x22')](respondWithResult(_0x46d050,0xc9))[_0xf04a('0x2b')](handleError(_0x46d050,null));};exports[_0xf04a('0xa5')]=function(_0x122953,_0x1d1e20,_0x196728){if(_0x122953['body']['id']){delete _0x122953['body']['id'];}return db[_0xf04a('0x5f')][_0xf04a('0x41')]({'where':{'id':_0x122953[_0xf04a('0x6a')]['id']}})[_0xf04a('0x22')](function(_0x328243){if(!_0x328243)return null;if(_0x328243['id']===_0x122953[_0xf04a('0x90')]['id']){if(!_0x122953[_0xf04a('0x71')]['oldPassword']||!_0x122953[_0xf04a('0x71')][_0xf04a('0xa6')]){throw new db[(_0xf04a('0xa7'))][(_0xf04a('0xa8'))](_0xf04a('0xa9'));}if(!_0x328243['authenticate'](_0x122953[_0xf04a('0x71')]['oldPassword'])){throw new db[(_0xf04a('0xa7'))][(_0xf04a('0xa8'))](_0xf04a('0xaa'));}if(_0x122953[_0xf04a('0x71')]['oldPassword']===_0x122953[_0xf04a('0x71')][_0xf04a('0xa6')]){throw new db['Sequelize'][(_0xf04a('0xa8'))](_0xf04a('0xab'));}}else if(_0x122953['user']['role']===_0xf04a('0x92')){if(!_0x122953['body'][_0xf04a('0xa6')]){throw new db[(_0xf04a('0xa7'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x122953[_0xf04a('0x90')]['role']===_0xf04a('0x90')){if(!_0x122953['body']['newPassword']){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x328243[_0xf04a('0x39')]!==_0xf04a('0x3b')){throw new db[(_0xf04a('0xa7'))]['ValidationError'](_0xf04a('0x91'));}}else{throw new db[(_0xf04a('0xa7'))][(_0xf04a('0xa8'))](_0xf04a('0x91'));}return _0x328243;})[_0xf04a('0x22')](handleEntityNotFound(_0x1d1e20,null))[_0xf04a('0x22')](function(_0x20ee5c){return db['Setting'][_0xf04a('0xac')]({'attributes':['id',_0xf04a('0x78'),_0xf04a('0xad'),_0xf04a('0xae')]})[_0xf04a('0x22')](function(_0x252326){if(_0x252326[_0xf04a('0x78')])authService[_0xf04a('0xaf')](_0x122953[_0xf04a('0x71')]['newPassword']);if(!_0x252326[_0xf04a('0xad')]||!_0x20ee5c[_0xf04a('0xb0')])return _0x20ee5c;authService[_0xf04a('0xb1')](_0x122953[_0xf04a('0x71')][_0xf04a('0xa6')],_0x20ee5c['previousPasswords'],_0x252326[_0xf04a('0xae')]);return _0x20ee5c;})[_0xf04a('0x22')](saveUpdates({'password':_0x122953[_0xf04a('0x71')][_0xf04a('0xa6')],'passwordResetAt':_0x122953['user']['id']==_0x122953[_0xf04a('0x6a')]['id']?moment():null,'previousPasswords':authService[_0xf04a('0xb2')](_0x122953[_0xf04a('0x71')][_0xf04a('0xa6')],_0x20ee5c[_0xf04a('0xb0')])},null));})['then'](respondWithResult(_0x1d1e20,null))[_0xf04a('0x2b')](handleError(_0x1d1e20,null));};exports[_0xf04a('0xb3')]=function(_0x143475,_0x28f3a9,_0x1294d0){var _0x41da68=_0x143475[_0xf04a('0x71')]['channel'];return db[_0xf04a('0x5f')][_0xf04a('0x41')]({'where':{'id':_0x143475[_0xf04a('0x6a')]['id']},'attributes':['id',_0xf04a('0x42'),_0xf04a('0x39'),_0xf04a('0xb4'),_0xf04a('0xb5'),'voicePause',_0xf04a('0xb6')]})[_0xf04a('0x22')](handleEntityNotFound(_0x28f3a9,null))[_0xf04a('0x22')](function(_0x4c30fe){if(_0x4c30fe){if(!utils['isValidChannel'](_0x41da68)){throw new db[(_0xf04a('0xa7'))]['ValidationError'](_0xf04a('0xb7'));}return _0x4c30fe['add'+_[_0xf04a('0xb8')](_0x41da68[_0xf04a('0xb9')]())+_0xf04a('0xba')](_0x143475['body']['ids'],{'penalty':_0x143475[_0xf04a('0x71')]['penalty']||0x0})[_0xf04a('0xbb')](function(_0x281678){for(var _0x50e6e1=0x0;_0x50e6e1<_0x143475[_0xf04a('0x71')][_0xf04a('0x74')][_0xf04a('0x64')];_0x50e6e1+=0x1){var _0xb4db55={'UserId':_0x143475[_0xf04a('0x6a')]['id']};_0xb4db55[_['capitalize'](_0x41da68['toLowerCase']())+_0xf04a('0xbc')]=_0x143475[_0xf04a('0x71')]['ids'][_0x50e6e1];socket[_0xf04a('0xbd')](_0xf04a('0x90')+_['capitalize'](_0x41da68[_0xf04a('0xb9')]())+_0xf04a('0xbe'),_0xb4db55);}return _0x281678;})[_0xf04a('0x22')](function(){if(_0x41da68===_0xf04a('0xbf')){return db[_0xf04a('0xc0')][_0xf04a('0xc1')]({'where':{'id':_0x143475['body'][_0xf04a('0x74')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x3c4a6d){var _0x2efb85=_0x4c30fe['get']({'plain':!![]});var _0xba82f3=[];if(_0x41da68===_0xf04a('0xbf')&&_0x2efb85[_0xf04a('0x39')]===_0xf04a('0x3b')&&_0x2efb85[_0xf04a('0xb4')]){for(var _0x56b521=0x0;_0x56b521<_0x3c4a6d[_0xf04a('0x64')];_0x56b521+=0x1){_0xba82f3[_0xf04a('0x60')]({'membername':_0x2efb85['name'],'UserId':_0x2efb85['id'],'queue_name':_0x3c4a6d[_0x56b521]['name'],'VoiceQueueId':_0x3c4a6d[_0x56b521]['id'],'interface':_[_0xf04a('0x7a')](_0x2efb85['interface'])?util[_0xf04a('0xc2')](_0xf04a('0xc3'),_0x2efb85['name']):_0x2efb85['interface'],'paused':_0x2efb85[_0xf04a('0xc4')]||![],'penalty':_0x143475[_0xf04a('0x71')]['penalty']||0x0});}return BPromise[_0xf04a('0x9f')](_0xba82f3,function(_0x379acb){return db[_0xf04a('0xc5')][_0xf04a('0xc6')](_0x379acb);});}return _0x4c30fe;});}})[_0xf04a('0x22')](respondWithStatusCode(_0x28f3a9,null))['catch'](handleError(_0x28f3a9,null));};exports['removeQueues']=function(_0x2112bc,_0x5731f9,_0x484b3d){var _0x25e986;return db[_0xf04a('0x5f')][_0xf04a('0x41')]({'where':{'id':_0x2112bc[_0xf04a('0x6a')]['id']},'attributes':['id','name',_0xf04a('0x39')]})[_0xf04a('0x22')](handleEntityNotFound(_0x5731f9,null))[_0xf04a('0x22')](function(_0x253aef){if(_0x253aef){_0x25e986=_0x253aef;if(!_0x2112bc['query'][_0xf04a('0xc7')]||!utils[_0xf04a('0xc8')](_0x2112bc[_0xf04a('0x4f')]['channel'])){throw new db[(_0xf04a('0xa7'))]['ValidationError'](_0xf04a('0xb7'));}return _0x253aef['remove'+_['capitalize'](_0x2112bc[_0xf04a('0x4f')][_0xf04a('0xc7')][_0xf04a('0xb9')]())+_0xf04a('0xba')](_0x2112bc[_0xf04a('0x4f')][_0xf04a('0x74')]);}})[_0xf04a('0x22')](function(_0x1bf248){for(var _0x330b72=0x0;_0x330b72<_0x2112bc['query'][_0xf04a('0x74')][_0xf04a('0x64')];_0x330b72+=0x1){var _0x40119e={'UserId':_0x2112bc[_0xf04a('0x6a')]['id']};_0x40119e[_[_0xf04a('0xb8')](_0x2112bc[_0xf04a('0x4f')][_0xf04a('0xc7')][_0xf04a('0xb9')]())+_0xf04a('0xbc')]=_0x2112bc[_0xf04a('0x4f')][_0xf04a('0x74')][_0x330b72];socket['emit'](_0xf04a('0x90')+_[_0xf04a('0xb8')](_0x2112bc[_0xf04a('0x4f')][_0xf04a('0xc7')][_0xf04a('0xb9')]())+'Queue:remove',_0x40119e);}return _0x1bf248;})[_0xf04a('0x22')](function(){if(_0x2112bc[_0xf04a('0x4f')][_0xf04a('0xc7')]===_0xf04a('0xbf')){return db[_0xf04a('0xc5')][_0xf04a('0x43')]({'where':{'UserId':_0x2112bc[_0xf04a('0x6a')]['id'],'VoiceQueueId':_0x2112bc[_0xf04a('0x4f')][_0xf04a('0x74')]},'individualHooks':!![]})[_0xf04a('0x22')](function(){return _0x25e986;});}return _0x25e986;})[_0xf04a('0x22')](respondWithStatusCode(_0x5731f9,null))[_0xf04a('0x2b')](handleError(_0x5731f9,null));};exports[_0xf04a('0xc9')]=function(_0x556e62,_0x5d2ef9,_0x51f9b0){_0x556e62['body'][_0xf04a('0xca')]=_0x556e62[_0xf04a('0xcb')][_0xf04a('0xcc')];return db[_0xf04a('0x5f')][_0xf04a('0x41')]({'where':{'id':_0x556e62[_0xf04a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5d2ef9,null))[_0xf04a('0x22')](saveUpdates(_0x556e62[_0xf04a('0x71')],null))[_0xf04a('0x22')](respondWithResult(_0x5d2ef9,null))[_0xf04a('0x2b')](handleError(_0x5d2ef9,null));};exports[_0xf04a('0xcd')]=function(_0x200817,_0x170fb7,_0x5c44a1){var _0x19d3b3=path[_0xf04a('0xce')](config[_0xf04a('0xcf')],'server/files/images/logos/default_profile.png');return db[_0xf04a('0x5f')][_0xf04a('0x41')]({'where':{'id':_0x200817[_0xf04a('0x6a')]['id']},'attributes':['id',_0xf04a('0xca')],'raw':!![]})[_0xf04a('0x22')](handleEntityNotFound(_0x170fb7,null))[_0xf04a('0x22')](function(_0x36a917){if(_0x36a917){if(_[_0xf04a('0x7a')](_0x36a917[_0xf04a('0xca')])){return _0x170fb7['download'](_0x19d3b3);}else{if(!fs['existsSync'](path[_0xf04a('0xce')](config[_0xf04a('0xcf')],_0xf04a('0xd0'),_0x36a917[_0xf04a('0xca')]))){return _0x170fb7[_0xf04a('0xd1')](_0x19d3b3);}return _0x170fb7[_0xf04a('0xd1')](path[_0xf04a('0xce')](config[_0xf04a('0xcf')],_0xf04a('0xd0'),_0x36a917[_0xf04a('0xca')]));}}})[_0xf04a('0x2b')](handleError(_0x170fb7,null));};exports['getOpenTabs']=function(_0x54a06d,_0x3e59d3,_0x264a02){return db['User'][_0xf04a('0x41')]({'where':{'id':_0x54a06d['params']['id']},'attributes':['id']})[_0xf04a('0x22')](handleEntityNotFound(_0x3e59d3,null))[_0xf04a('0x22')](function(_0x14a2aa){var _0x53585c=[];values=_0x14a2aa[_0xf04a('0x66')];_0x53585c[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x65'),_0x14a2aa[_0xf04a('0x66')]));_0x53585c[_0xf04a('0x60')](get_open_tabs('sms',_0x14a2aa['dataValues']));_0x53585c[_0xf04a('0x60')](get_open_tabs('openchannel',_0x14a2aa[_0xf04a('0x66')]));_0x53585c['push'](get_open_tabs('whatsapp',_0x14a2aa[_0xf04a('0x66')]));_0x53585c[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x68'),_0x14a2aa['dataValues']));_0x53585c[_0xf04a('0x60')](get_open_tabs(_0xf04a('0x6f'),_0x14a2aa[_0xf04a('0x66')]));return BPromise[_0xf04a('0x70')](_0x53585c);})['then'](function(_0x5e2340){var _0x6ddadc=[];if(_0x5e2340){for(var _0xcdaddd=0x0;_0xcdaddd=_0x3f1c2a[_0xe11f('0x54')]){throw new Error(_0xe11f('0x55'));}})[_0xe11f('0x22')](function(){if(_0x3aa0e6){return db[_0xe11f('0x40')][_0xe11f('0x4b')]({'where':{'membername':_0x3aa0e6[_0xe11f('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x3aa0e6){return _0x3aa0e6[_0xe11f('0x56')]({'raw':!![]});}})[_0xe11f('0x22')](function(_0x37db51){if(_0x3aa0e6){if(_0x37db51){var _0x21c872=[];_0x13b6fc=_0x37db51;if(_0x13b6fc['length']){for(var _0x38cbc7=0x0;_0x38cbc7<_0x13b6fc[_0xe11f('0x2c')];_0x38cbc7++){_0x21c872[_0xe11f('0x32')](db[_0xe11f('0x40')][_0xe11f('0x57')]({'membername':_0x3aa0e6[_0xe11f('0x26')],'UserId':_0x3aa0e6['id'],'queue_name':_0x13b6fc[_0x38cbc7][_0xe11f('0x26')],'VoiceQueueId':_0x13b6fc[_0x38cbc7]['id'],'interface':_0x48c856,'paused':_0x3aa0e6['loginInPause']||![],'penalty':_0x13b6fc[_0x38cbc7][_0xe11f('0x58')]||0x0}));}return BPromise['all'](_0x21c872);}}}})['then'](function(){if(_0x3aa0e6){return db[_0xe11f('0x29')][_0xe11f('0x2a')]({'where':{'membername':_0x3aa0e6[_0xe11f('0x26')],'exitAt':null}});}})[_0xe11f('0x22')](function(_0x36b8a8){if(_0x3aa0e6){if(_0x36b8a8&&_0x36b8a8[_0xe11f('0x2c')]){var _0x5826bb=[];_0x36b8a8[_0xe11f('0x31')](function(_0x23bcce){_0x5826bb[_0xe11f('0x32')](_0x23bcce['update']({'exitAt':moment()[_0xe11f('0x2d')](_0xe11f('0x2e'))}));});return BPromise[_0xe11f('0x49')](_0x5826bb);}}})['then'](function(_0x2be7d6){if(_0x3aa0e6){var _0x3f6d53=[];var _0x1ab29f=[];var _0x24301e=utils['getChannels']();var _0x5b0421={'membername':_0x3aa0e6['name'],'interface':_0x48c856,'enterAt':moment()[_0xe11f('0x2d')](_0xe11f('0x2e')),'role':_0x3aa0e6[_0xe11f('0x27')],'internal':_0x3aa0e6[_0xe11f('0x28')]};_0x24301e[_0xe11f('0x31')](function(_0x32e388){_0x3f6d53[_0xe11f('0x32')](_['merge']({'channel':_0x32e388,'type':_0xe11f('0x59'),'data1':_0xe11f('0x5a'),'data2':_0x48c856},_0x5b0421));if(_0x3aa0e6[_0xe11f('0x4f')]){_0x1ab29f[_0xe11f('0x32')](_[_0xe11f('0x5b')]({'channel':_0x32e388,'type':_0xe11f('0x2b'),'data1':_0xe11f('0x5c')},_0x5b0421));}});return db[_0xe11f('0x29')][_0xe11f('0x3a')](_0x3f6d53[_0xe11f('0x5d')](_0x1ab29f),{'individualHooks':!![]});}})[_0xe11f('0x22')](function(){if(_0x3aa0e6){return _0x3aa0e6[_0xe11f('0x3b')]({'online':!![],'lastLoginAt':moment()[_0xe11f('0x2d')](_0xe11f('0x2e')),'voicePause':_0x3aa0e6['loginInPause']||![],'mailPause':_0x3aa0e6[_0xe11f('0x4f')]||![],'chatPause':_0x3aa0e6[_0xe11f('0x4f')]||![],'faxPause':_0x3aa0e6[_0xe11f('0x4f')]||![],'smsPause':_0x3aa0e6[_0xe11f('0x4f')]||![],'openchannelPause':_0x3aa0e6['loginInPause']||![],'pauseType':_0x3aa0e6[_0xe11f('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xe11f('0x2d')](_0xe11f('0x2e')),'interface':_0x48c856});}})[_0xe11f('0x22')](function(_0x242406){_0x2730d7(_0x242406);})[_0xe11f('0x17')](function(_0x3cca00){_0x24158f(_0x46a36a['error'](0x1f4,_0x3cca00['message']));});});}; \ No newline at end of file +var _0x59b7=['loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','./user.socket','register','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','message','error','catch','GetUser','options','raw','where','attributes','limit','include','map','model','debug','User','ShowUser','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','findAll','PAUSE','format','updateAttributes','forEach','push','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','uniqueid','MemberReport','bulkCreate','type','DEFAULT\x20PAUSE','UnpauseUser','findOne','isValidChannel','channel','Unknown\x20channel','find','system','mail','chat','fax','sms','openchannel','set','%s%s','Pause','all','LogoutUser','destroy','length','LoginUser','mobile','phone'];(function(_0x5c13f0,_0x3722cd){var _0x5e28a0=function(_0x1eac23){while(--_0x1eac23){_0x5c13f0['push'](_0x5c13f0['shift']());}};_0x5e28a0(++_0x3722cd);}(_0x59b7,0xc5));var _0x759b=function(_0x569564,_0x50dd26){_0x569564=_0x569564-0x0;var _0x20871f=_0x59b7[_0x569564];return _0x20871f;};'use strict';var _=require(_0x759b('0x0'));var util=require(_0x759b('0x1'));var moment=require(_0x759b('0x2'));var BPromise=require(_0x759b('0x3'));var rs=require(_0x759b('0x4'));var fs=require('fs');var Redis=require(_0x759b('0x5'));var db=require(_0x759b('0x6'))['db'];var utils=require(_0x759b('0x7'));var logger=require(_0x759b('0x8'))(_0x759b('0x9'));var config=require(_0x759b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x759b('0xb')]['http']({'port':0x232a});config['redis']=_[_0x759b('0xc')](config[_0x759b('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x759b('0xe'))[_0x759b('0xf')](socket);function respondWithRpcPromise(_0x2870e4,_0x48fb98,_0x15f330){return new BPromise(function(_0x5781d9,_0x9f8042){return client[_0x759b('0x10')](_0x2870e4,_0x15f330)[_0x759b('0x11')](function(_0x3950f0){logger[_0x759b('0x12')](_0x759b('0x13'),_0x48fb98,'request\x20sent');logger['debug'](_0x759b('0x14'),_0x48fb98,_0x759b('0x15'),JSON[_0x759b('0x16')](_0x3950f0));if(_0x3950f0['error']){if(_0x3950f0['error']['code']===0x1f4){logger['error'](_0x759b('0x13'),_0x48fb98,_0x3950f0['error'][_0x759b('0x17')]);return _0x9f8042(_0x3950f0['error'][_0x759b('0x17')]);}logger[_0x759b('0x18')]('User,\x20%s,\x20%s',_0x48fb98,_0x3950f0['error'][_0x759b('0x17')]);return _0x5781d9(_0x3950f0[_0x759b('0x18')]['message']);}else{logger['info'](_0x759b('0x13'),_0x48fb98,_0x759b('0x15'));_0x5781d9(_0x3950f0['result'][_0x759b('0x17')]);}})[_0x759b('0x19')](function(_0x183416){logger['error'](_0x759b('0x13'),_0x48fb98,_0x183416);_0x9f8042(_0x183416);});});}exports[_0x759b('0x1a')]=function(_0x9536ab){var _0x63634e=this;return new Promise(function(_0x1eb739,_0x53cd4e){return db['User']['findAll']({'raw':_0x9536ab['options']?_0x9536ab[_0x759b('0x1b')][_0x759b('0x1c')]===undefined?!![]:![]:!![],'where':_0x9536ab[_0x759b('0x1b')]?_0x9536ab['options'][_0x759b('0x1d')]||null:null,'attributes':_0x9536ab[_0x759b('0x1b')]?_0x9536ab[_0x759b('0x1b')][_0x759b('0x1e')]||null:null,'limit':_0x9536ab[_0x759b('0x1b')]?_0x9536ab[_0x759b('0x1b')][_0x759b('0x1f')]||null:null,'include':_0x9536ab['options']?_0x9536ab[_0x759b('0x1b')][_0x759b('0x20')]?_[_0x759b('0x21')](_0x9536ab['options'][_0x759b('0x20')],function(_0x50ad09){return{'model':db[_0x50ad09[_0x759b('0x22')]],'as':_0x50ad09['as'],'attributes':_0x50ad09[_0x759b('0x1e')],'include':_0x50ad09[_0x759b('0x20')]?_[_0x759b('0x21')](_0x50ad09['include'],function(_0x5ae91f){return{'model':db[_0x5ae91f['model']],'as':_0x5ae91f['as'],'attributes':_0x5ae91f[_0x759b('0x1e')],'include':_0x5ae91f[_0x759b('0x20')]?_[_0x759b('0x21')](_0x5ae91f['include'],function(_0x2b6747){return{'model':db[_0x2b6747[_0x759b('0x22')]],'as':_0x2b6747['as'],'attributes':_0x2b6747[_0x759b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ed0b0){logger['info']('GetUser',_0x9536ab);logger[_0x759b('0x23')]('GetUser',_0x9536ab,JSON[_0x759b('0x16')](_0x2ed0b0));_0x1eb739(_0x2ed0b0);})[_0x759b('0x19')](function(_0x1d649a){logger[_0x759b('0x18')](_0x759b('0x1a'),_0x1d649a[_0x759b('0x17')],_0x9536ab);_0x53cd4e(_0x63634e[_0x759b('0x18')](0x1f4,_0x1d649a[_0x759b('0x17')]));});});};exports['ShowUser']=function(_0x5a0c07){var _0x549a1e=this;return new Promise(function(_0x5c2867,_0x43a62b){return db[_0x759b('0x24')]['find']({'raw':_0x5a0c07[_0x759b('0x1b')]?_0x5a0c07[_0x759b('0x1b')][_0x759b('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a0c07['options']?_0x5a0c07[_0x759b('0x1b')][_0x759b('0x1d')]||null:null,'attributes':_0x5a0c07['options']?_0x5a0c07[_0x759b('0x1b')][_0x759b('0x1e')]||null:null,'include':_0x5a0c07[_0x759b('0x1b')]?_0x5a0c07['options'][_0x759b('0x20')]?_[_0x759b('0x21')](_0x5a0c07['options'][_0x759b('0x20')],function(_0x2a3be9){return{'model':db[_0x2a3be9['model']],'as':_0x2a3be9['as'],'attributes':_0x2a3be9[_0x759b('0x1e')],'include':_0x2a3be9['include']?_[_0x759b('0x21')](_0x2a3be9['include'],function(_0x479f84){return{'model':db[_0x479f84[_0x759b('0x22')]],'as':_0x479f84['as'],'attributes':_0x479f84[_0x759b('0x1e')],'include':_0x479f84[_0x759b('0x20')]?_['map'](_0x479f84[_0x759b('0x20')],function(_0x19ad87){return{'model':db[_0x19ad87[_0x759b('0x22')]],'as':_0x19ad87['as'],'attributes':_0x19ad87[_0x759b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b56a0){logger['info']('ShowUser',_0x5a0c07);logger['debug'](_0x759b('0x25'),_0x5a0c07,JSON[_0x759b('0x16')](_0x4b56a0));_0x5c2867(_0x4b56a0);})[_0x759b('0x19')](function(_0x21d18a){logger[_0x759b('0x18')](_0x759b('0x25'),_0x21d18a[_0x759b('0x17')],_0x5a0c07);_0x43a62b(_0x549a1e['error'](0x1f4,_0x21d18a[_0x759b('0x17')]));});});};exports[_0x759b('0x26')]=function(_0x4f5e6d){var _0x48ebaf=this;return new Promise(function(_0x2a072f,_0x5d3307){var _0xb5cea8;return db[_0x759b('0x24')]['find']({'where':_0x4f5e6d[_0x759b('0x1b')]['where']||{},'attributes':['id',_0x759b('0x27'),_0x759b('0x28'),_0x759b('0x29'),_0x759b('0x2a')]})[_0x759b('0x11')](function(_0x2cc3ea){if(_0x2cc3ea){_0xb5cea8=_0x2cc3ea;return db[_0x759b('0x2b')][_0x759b('0x2c')]({'paused':0x1},{'where':{'UserId':_0xb5cea8['id']},'individualHooks':!![]});}})[_0x759b('0x11')](function(){if(_0xb5cea8){return db['MemberReport'][_0x759b('0x2d')]({'where':{'membername':_0xb5cea8[_0x759b('0x27')],'type':_0x759b('0x2e'),'exitAt':null}});}})['then'](function(_0x15574b){if(_0xb5cea8){if(_0x15574b&&_0x15574b['length']){var _0x5bb71b=moment()[_0x759b('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1521f1=0x0,_0x1a20b0=_0x15574b['length'];_0x1521f1<_0x1a20b0;_0x1521f1++){_0x15574b[_0x1521f1][_0x759b('0x30')]({'exitAt':_0x5bb71b});}}}})[_0x759b('0x11')](function(){if(_0xb5cea8){var _0x264879=[];var _0x5e459d=utils['getChannels']();_0x5e459d[_0x759b('0x31')](function(_0x340985){_0x264879[_0x759b('0x32')]({'channel':_0x340985,'membername':_0xb5cea8[_0x759b('0x27')],'interface':_[_0x759b('0x33')](_0xb5cea8[_0x759b('0x2a')])?util[_0x759b('0x2f')](_0x759b('0x34'),_0xb5cea8[_0x759b('0x27')]):_0xb5cea8[_0x759b('0x2a')],'type':_0x759b('0x2e'),'enterAt':moment()[_0x759b('0x2f')](_0x759b('0x35')),'data1':_0x4f5e6d['body']['type']||'DEFAULT\x20PAUSE','role':_0xb5cea8[_0x759b('0x28')],'internal':_0xb5cea8[_0x759b('0x29')],'uniqueid':_0x4f5e6d[_0x759b('0x36')][_0x759b('0x37')]||null});});return db[_0x759b('0x38')][_0x759b('0x39')](_0x264879,{'individualHooks':!![]});}})[_0x759b('0x11')](function(){if(_0xb5cea8){return _0xb5cea8[_0x759b('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4f5e6d[_0x759b('0x36')][_0x759b('0x3a')]||_0x759b('0x3b'),'lastPauseAt':moment()[_0x759b('0x2f')](_0x759b('0x35'))});}})[_0x759b('0x11')](function(_0x5c1f67){_0x2a072f(_0x5c1f67);})[_0x759b('0x19')](function(_0x18aae3){_0x5d3307(_0x48ebaf[_0x759b('0x18')](0x1f4,_0x18aae3[_0x759b('0x17')]));});});};exports[_0x759b('0x3c')]=function(_0x829d91){var _0x10cd39=this;return new Promise(function(_0x51ca41,_0x10daa9){var _0x2986a7;return db[_0x759b('0x24')][_0x759b('0x3d')]({'where':_0x829d91[_0x759b('0x1b')][_0x759b('0x1d')]||{},'attributes':['id',_0x759b('0x27')]})[_0x759b('0x11')](function(_0xd6d028){if(_0xd6d028){_0x2986a7=_0xd6d028;if(_0x829d91[_0x759b('0x36')]['channel']&&!utils[_0x759b('0x3e')](_0x829d91[_0x759b('0x36')][_0x759b('0x3f')])){throw new Error(_0x759b('0x40'));}switch(_0x829d91[_0x759b('0x36')][_0x759b('0x3f')]){case'voice':return db[_0x759b('0x2b')][_0x759b('0x2c')]({'paused':0x0},{'where':{'UserId':_0x2986a7['id']}})[_0x759b('0x11')](function(){return db['MemberReport'][_0x759b('0x41')]({'where':{'channel':_0x829d91[_0x759b('0x36')][_0x759b('0x3f')],'membername':_0x2986a7[_0x759b('0x27')],'type':'PAUSE','exitAt':null}});})[_0x759b('0x11')](function(_0x2cb952){if(_0x2cb952){return _0x2cb952[_0x759b('0x2c')]({'exitAt':moment()[_0x759b('0x2f')](_0x759b('0x35')),'data2':_0x759b('0x42')},{'individualHooks':!![]});}return null;})[_0x759b('0x11')](function(){return _0x2986a7['update']({'voicePause':![]});});case _0x759b('0x43'):case _0x759b('0x44'):case _0x759b('0x45'):case _0x759b('0x46'):case _0x759b('0x47'):case'whatsapp':return db[_0x759b('0x38')][_0x759b('0x41')]({'where':{'channel':_0x829d91[_0x759b('0x36')]['channel'],'membername':_0x2986a7['name'],'type':_0x759b('0x2e'),'exitAt':null}})[_0x759b('0x11')](function(_0x12e000){return _0x12e000[_0x759b('0x2c')]({'exitAt':moment()[_0x759b('0x2f')](_0x759b('0x35')),'data2':_0x759b('0x42')},{'individualHooks':!![]});})[_0x759b('0x11')](function(){var _0x35f57d={};_[_0x759b('0x48')](_0x35f57d,util[_0x759b('0x2f')](_0x759b('0x49'),_0x829d91[_0x759b('0x36')]['channel'],_0x759b('0x4a')),![]);return _0x2986a7[_0x759b('0x2c')](_0x35f57d);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x2986a7['id']}})[_0x759b('0x11')](function(){return db[_0x759b('0x38')][_0x759b('0x2d')]({'where':{'membername':_0x2986a7[_0x759b('0x27')],'type':'PAUSE','exitAt':null}});})[_0x759b('0x11')](function(_0x5d6a61){var _0x282580=[];_0x5d6a61[_0x759b('0x31')](function(_0x51d009){_0x282580[_0x759b('0x32')](_0x51d009[_0x759b('0x2c')]({'exitAt':moment()[_0x759b('0x2f')](_0x759b('0x35')),'data2':_0x759b('0x42')}));});return BPromise[_0x759b('0x4b')](_0x282580);})['then'](function(){return _0x2986a7[_0x759b('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x2f89e5){_0x51ca41(_0x2f89e5);})['catch'](function(_0x230676){_0x10daa9(_0x10cd39[_0x759b('0x18')](0x1f4,_0x230676['message']));});});};exports[_0x759b('0x4c')]=function(_0x29eceb){var _0x43c7f0=this;return new Promise(function(_0x2b492d,_0x5e4951){var _0x4f3307;return db['User']['findOne']({'where':_0x29eceb[_0x759b('0x1b')]['where']||{},'attributes':['id',_0x759b('0x27')]})['then'](function(_0x2d9813){if(_0x2d9813){_0x4f3307=_0x2d9813;return db[_0x759b('0x2b')][_0x759b('0x4d')]({'where':{'membername':_0x4f3307[_0x759b('0x27')]},'individualHooks':!![]});}})[_0x759b('0x11')](function(){if(_0x4f3307){return db['MemberReport'][_0x759b('0x2d')]({'where':{'membername':_0x4f3307[_0x759b('0x27')],'exitAt':null}});}})[_0x759b('0x11')](function(_0x21ce72){if(_0x4f3307){if(_0x21ce72&&_0x21ce72[_0x759b('0x4e')]){var _0x1f6fa9=[];_0x21ce72['forEach'](function(_0x80a2c0){_0x1f6fa9[_0x759b('0x32')](_0x80a2c0[_0x759b('0x2c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x759b('0x4b')](_0x1f6fa9);}}})[_0x759b('0x11')](function(){if(_0x4f3307){return _0x4f3307[_0x759b('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x36a044){_0x2b492d(_0x36a044);})[_0x759b('0x19')](function(_0x47e137){_0x5e4951(_0x43c7f0[_0x759b('0x18')](0x1f4,_0x47e137[_0x759b('0x17')]));});});};exports[_0x759b('0x4f')]=function(_0x341054){var _0x4415cf=this;return new Promise(function(_0x153079,_0x1f3c1f){var _0x2818af;var _0x637414;var _0x26ca3e;var _0x2a6b02;return db[_0x759b('0x24')][_0x759b('0x3d')]({'where':_0x341054['options'][_0x759b('0x1d')]||{},'attributes':['id',_0x759b('0x27'),_0x759b('0x28'),_0x759b('0x50'),_0x759b('0x51'),_0x759b('0x29'),_0x759b('0x52'),_0x759b('0x2a')]})[_0x759b('0x11')](function(_0x47c520){if(_0x47c520){_0x2818af=_0x47c520;_0x2a6b02=_0x341054[_0x759b('0x36')][_0x759b('0x2a')]?_0x341054[_0x759b('0x36')][_0x759b('0x2a')]:util['format'](_0x759b('0x34'),_0x2818af[_0x759b('0x27')]);return db[_0x759b('0x24')][_0x759b('0x53')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2818af['id']}}});}})[_0x759b('0x11')](function(_0x14f1f0){if(_0x14f1f0){_0x26ca3e=_0x14f1f0;return require(_0x759b('0x54'))[_0x759b('0x55')]();}})[_0x759b('0x11')](function(_0xd6c511){if(_0xd6c511&&_0xd6c511[_0x759b('0x56')]&&_0x26ca3e>=_0xd6c511['agents']){throw new Error(_0x759b('0x57'));}})[_0x759b('0x11')](function(){if(_0x2818af){return db[_0x759b('0x2b')][_0x759b('0x4d')]({'where':{'membername':_0x2818af[_0x759b('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x2818af){return _0x2818af['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x437192){if(_0x2818af){if(_0x437192){var _0x3ae87a=[];_0x637414=_0x437192;if(_0x637414[_0x759b('0x4e')]){for(var _0x3a463a=0x0;_0x3a463a<_0x637414['length'];_0x3a463a++){_0x3ae87a[_0x759b('0x32')](db[_0x759b('0x2b')][_0x759b('0x58')]({'membername':_0x2818af['name'],'UserId':_0x2818af['id'],'queue_name':_0x637414[_0x3a463a][_0x759b('0x27')],'VoiceQueueId':_0x637414[_0x3a463a]['id'],'interface':_0x2a6b02,'paused':_0x2818af['loginInPause']||![],'penalty':_0x637414[_0x3a463a]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x759b('0x4b')](_0x3ae87a);}}}})[_0x759b('0x11')](function(){if(_0x2818af){return db[_0x759b('0x38')][_0x759b('0x2d')]({'where':{'membername':_0x2818af[_0x759b('0x27')],'exitAt':null}});}})[_0x759b('0x11')](function(_0x54a2d2){if(_0x2818af){if(_0x54a2d2&&_0x54a2d2[_0x759b('0x4e')]){var _0x1a1bb9=[];_0x54a2d2[_0x759b('0x31')](function(_0xa50413){_0x1a1bb9['push'](_0xa50413['update']({'exitAt':moment()['format'](_0x759b('0x35'))}));});return BPromise['all'](_0x1a1bb9);}}})[_0x759b('0x11')](function(_0x2a2dbb){if(_0x2818af){var _0x33779b=[];var _0x58b4f9=[];var _0x58948f=utils['getChannels']();var _0x96cc6f={'membername':_0x2818af[_0x759b('0x27')],'interface':_0x2a6b02,'enterAt':moment()['format'](_0x759b('0x35')),'role':_0x2818af[_0x759b('0x28')],'internal':_0x2818af[_0x759b('0x29')]};_0x58948f[_0x759b('0x31')](function(_0x2fe3d6){_0x33779b['push'](_[_0x759b('0x59')]({'channel':_0x2fe3d6,'type':_0x759b('0x5a'),'data1':_0x759b('0x5b'),'data2':_0x2a6b02},_0x96cc6f));if(_0x2818af[_0x759b('0x52')]){_0x58b4f9[_0x759b('0x32')](_[_0x759b('0x59')]({'channel':_0x2fe3d6,'type':_0x759b('0x2e'),'data1':_0x759b('0x5c')},_0x96cc6f));}});return db[_0x759b('0x38')][_0x759b('0x39')](_0x33779b['concat'](_0x58b4f9),{'individualHooks':!![]});}})[_0x759b('0x11')](function(){if(_0x2818af){return _0x2818af[_0x759b('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x759b('0x2f')](_0x759b('0x35')),'voicePause':_0x2818af['loginInPause']||![],'mailPause':_0x2818af['loginInPause']||![],'chatPause':_0x2818af[_0x759b('0x52')]||![],'faxPause':_0x2818af[_0x759b('0x52')]||![],'smsPause':_0x2818af[_0x759b('0x52')]||![],'openchannelPause':_0x2818af[_0x759b('0x52')]||![],'pauseType':_0x2818af[_0x759b('0x52')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x759b('0x2f')](_0x759b('0x35')),'interface':_0x2a6b02});}})[_0x759b('0x11')](function(_0x23d9c3){_0x153079(_0x23d9c3);})[_0x759b('0x19')](function(_0x31e034){_0x1f3c1f(_0x4415cf[_0x759b('0x18')](0x1f4,_0x31e034[_0x759b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 373e8ac..5029acd 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 _0x9dbf=['save','remove','emit','removeListener','register','length'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x9dbf,0x72));var _0xf9db=function(_0x40e437,_0x808574){_0x40e437=_0x40e437-0x0;var _0x1bb5d6=_0x9dbf[_0x40e437];return _0x1bb5d6;};'use strict';var UserEvents=require('./user.events');var events=[_0xf9db('0x0'),_0xf9db('0x1'),'update'];function createListener(_0x435caa,_0x1ed3b9){return function(_0x30f937){_0x1ed3b9[_0xf9db('0x2')](_0x435caa,_0x30f937);};}function removeListener(_0x31c1be,_0x4bcf24){return function(){UserEvents[_0xf9db('0x3')](_0x31c1be,_0x4bcf24);};}exports[_0xf9db('0x4')]=function(_0x5278c2){for(var _0x4c2783=0x0,_0x239a86=events[_0xf9db('0x5')];_0x4c2783<_0x239a86;_0x4c2783++){var _0x4c52d1=events[_0x4c2783];var _0x5e3c52=createListener('user:'+_0x4c52d1,_0x5278c2);UserEvents['on'](_0x4c52d1,_0x5e3c52);}}; \ No newline at end of file +var _0x21cd=['user:','./user.events','remove','update','emit','removeListener','register','length'];(function(_0x385ca6,_0x110710){var _0x47221c=function(_0x10fd01){while(--_0x10fd01){_0x385ca6['push'](_0x385ca6['shift']());}};_0x47221c(++_0x110710);}(_0x21cd,0x159));var _0xd21c=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x21cd[_0x1deb03];return _0x189fe7;};'use strict';var UserEvents=require(_0xd21c('0x0'));var events=['save',_0xd21c('0x1'),_0xd21c('0x2')];function createListener(_0x498e58,_0x4acfc7){return function(_0x3d93e1){_0x4acfc7[_0xd21c('0x3')](_0x498e58,_0x3d93e1);};}function removeListener(_0x1f7168,_0x3353b1){return function(){UserEvents[_0xd21c('0x4')](_0x1f7168,_0x3353b1);};}exports[_0xd21c('0x5')]=function(_0x453b6d){for(var _0x928f6d=0x0,_0x275b6c=events[_0xd21c('0x6')];_0x928f6d<_0x275b6c;_0x928f6d++){var _0x4b90eb=events[_0x928f6d];var _0x55ec40=createListener(_0xd21c('0x7')+_0x4b90eb,_0x453b6d);UserEvents['on'](_0x4b90eb,_0x55ec40);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d8560b7..c95b0c6 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 _0xcb10=['fs-extra','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x20f5ae,_0xb1470a){var _0x23750d=function(_0x430a64){while(--_0x430a64){_0x20f5ae['push'](_0x20f5ae['shift']());}};_0x23750d(++_0xb1470a);}(_0xcb10,0x104));var _0x0cb1=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xcb10[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var path=require('path');var timeout=require(_0x0cb1('0x2'));var express=require(_0x0cb1('0x3'));var router=express['Router']();var fs_extra=require(_0x0cb1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0cb1('0x5'));var config=require(_0x0cb1('0x6'));module[_0x0cb1('0x7')]=router; \ No newline at end of file +var _0x97c1=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x20edc9,_0x5b2a1f){var _0x5a5c3c=function(_0x53a413){while(--_0x53a413){_0x20edc9['push'](_0x20edc9['shift']());}};_0x5a5c3c(++_0x5b2a1f);}(_0x97c1,0xdf));var _0x197c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x97c1[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x197c('0x3'));var auth=require(_0x197c('0x4'));var interaction=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));module[_0x197c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 04c7494..9421871 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x21b47c,_0x1d45a7){var _0x1a6dd3=function(_0x182290){while(--_0x182290){_0x21b47c['push'](_0x21b47c['shift']());}};_0x1a6dd3(++_0x1d45a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x47d060,_0x4a2b1d){_0x47d060=_0x47d060-0x0;var _0xb2d051=_0xb10b[_0x47d060];return _0xb2d051;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 70f972b..6bde01f 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 _0xd90f=['define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','exports'];(function(_0xf0a713,_0x2a1926){var _0x126655=function(_0xafaa9f){while(--_0xafaa9f){_0xf0a713['push'](_0xf0a713['shift']());}};_0x126655(++_0x2a1926);}(_0xd90f,0xf5));var _0xfd90=function(_0xad314b,_0x214404){_0xad314b=_0xad314b-0x0;var _0x42971a=_0xd90f[_0xad314b];return _0x42971a;};'use strict';var _=require(_0xfd90('0x0'));var util=require('util');var logger=require(_0xfd90('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfd90('0x2'));var rp=require(_0xfd90('0x3'));var fs=require('fs');var path=require(_0xfd90('0x4'));var rimraf=require('rimraf');var config=require(_0xfd90('0x5'));var attributes=require(_0xfd90('0x6'));module[_0xfd90('0x7')]=function(_0x2ff796,_0x501d10){return _0x2ff796[_0xfd90('0x8')](_0xfd90('0x9'),attributes,{'tableName':_0xfd90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27f3=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','api','moment','request-promise','rimraf'];(function(_0xe3ea94,_0x59f614){var _0x5659fb=function(_0x23a469){while(--_0x23a469){_0xe3ea94['push'](_0xe3ea94['shift']());}};_0x5659fb(++_0x59f614);}(_0x27f3,0x1e9));var _0x327f=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x27f3[_0x58ae8a];return _0x2f0b6b;};'use strict';var _=require(_0x327f('0x0'));var util=require(_0x327f('0x1'));var logger=require('../../config/logger')(_0x327f('0x2'));var moment=require(_0x327f('0x3'));var BPromise=require('bluebird');var rp=require(_0x327f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x327f('0x5'));var config=require(_0x327f('0x6'));var attributes=require(_0x327f('0x7'));module[_0x327f('0x8')]=function(_0x1eada5,_0x358ab7){return _0x1eada5[_0x327f('0x9')](_0x327f('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index d20b5c8..4e8d8f6 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 _0x4305=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','UserChatQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird'];(function(_0x332232,_0x2d62ec){var _0xe2594d=function(_0x3d606d){while(--_0x3d606d){_0x332232['push'](_0x332232['shift']());}};_0xe2594d(++_0x2d62ec);}(_0x4305,0x6f));var _0x5430=function(_0x526786,_0x105cbf){_0x526786=_0x526786-0x0;var _0x3a512d=_0x4305[_0x526786];return _0x3a512d;};'use strict';var _=require(_0x5430('0x0'));var util=require('util');var moment=require(_0x5430('0x1'));var BPromise=require(_0x5430('0x2'));var rs=require(_0x5430('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5430('0x4'));var logger=require('../../config/logger')(_0x5430('0x5'));var config=require(_0x5430('0x6'));var jayson=require(_0x5430('0x7'));var client=jayson['client'][_0x5430('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5591f4,_0x4f27c1,_0x1ab4fc){return new BPromise(function(_0x181d8f,_0x22f8b8){return client[_0x5430('0x9')](_0x5591f4,_0x1ab4fc)[_0x5430('0xa')](function(_0x22a566){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x4f27c1,_0x5430('0xb'));logger[_0x5430('0xc')](_0x5430('0xd'),_0x4f27c1,'request\x20sent',JSON['stringify'](_0x22a566));if(_0x22a566[_0x5430('0xe')]){if(_0x22a566[_0x5430('0xe')][_0x5430('0xf')]===0x1f4){logger['error'](_0x5430('0x10'),_0x4f27c1,_0x22a566[_0x5430('0xe')][_0x5430('0x11')]);return _0x22f8b8(_0x22a566[_0x5430('0xe')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x4f27c1,_0x22a566[_0x5430('0xe')]['message']);return _0x181d8f(_0x22a566[_0x5430('0xe')][_0x5430('0x11')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x4f27c1,_0x5430('0xb'));_0x181d8f(_0x22a566[_0x5430('0x12')][_0x5430('0x11')]);}})['catch'](function(_0x171b77){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x4f27c1,_0x171b77);_0x22f8b8(_0x171b77);});});} \ No newline at end of file +var _0xcd93=['catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcd93,0x1e1));var _0x3cd9=function(_0x72ad64,_0x5ee8bc){_0x72ad64=_0x72ad64-0x0;var _0x4ff473=_0xcd93[_0x72ad64];return _0x4ff473;};'use strict';var _=require('lodash');var util=require(_0x3cd9('0x0'));var moment=require(_0x3cd9('0x1'));var BPromise=require('bluebird');var rs=require(_0x3cd9('0x2'));var fs=require('fs');var Redis=require(_0x3cd9('0x3'));var db=require(_0x3cd9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3cd9('0x5'));var config=require(_0x3cd9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3cd9('0x7')][_0x3cd9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fe355,_0x15a406,_0x2043c3){return new BPromise(function(_0x6b093b,_0x90b64b){return client[_0x3cd9('0x9')](_0x4fe355,_0x2043c3)[_0x3cd9('0xa')](function(_0x5372a4){logger['info'](_0x3cd9('0xb'),_0x15a406,_0x3cd9('0xc'));logger[_0x3cd9('0xd')](_0x3cd9('0xe'),_0x15a406,_0x3cd9('0xc'),JSON['stringify'](_0x5372a4));if(_0x5372a4[_0x3cd9('0xf')]){if(_0x5372a4['error'][_0x3cd9('0x10')]===0x1f4){logger[_0x3cd9('0xf')](_0x3cd9('0xb'),_0x15a406,_0x5372a4[_0x3cd9('0xf')][_0x3cd9('0x11')]);return _0x90b64b(_0x5372a4['error']['message']);}logger['error'](_0x3cd9('0xb'),_0x15a406,_0x5372a4[_0x3cd9('0xf')][_0x3cd9('0x11')]);return _0x6b093b(_0x5372a4[_0x3cd9('0xf')][_0x3cd9('0x11')]);}else{logger['info'](_0x3cd9('0xb'),_0x15a406,_0x3cd9('0xc'));_0x6b093b(_0x5372a4[_0x3cd9('0x12')][_0x3cd9('0x11')]);}})[_0x3cd9('0x13')](function(_0x313944){logger['error'](_0x3cd9('0xb'),_0x15a406,_0x313944);_0x90b64b(_0x313944);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d1fd6cd..4c60e8e 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 _0x75ea=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x1b8c71,_0x41d8ab){var _0x539905=function(_0x395edd){while(--_0x395edd){_0x1b8c71['push'](_0x1b8c71['shift']());}};_0x539905(++_0x41d8ab);}(_0x75ea,0x7d));var _0xa75e=function(_0x1521a8,_0x512e06){_0x1521a8=_0x1521a8-0x0;var _0x4b07ad=_0x75ea[_0x1521a8];return _0x4b07ad;};'use strict';var multer=require(_0xa75e('0x0'));var util=require(_0xa75e('0x1'));var path=require('path');var timeout=require(_0xa75e('0x2'));var express=require(_0xa75e('0x3'));var router=express['Router']();var fs_extra=require(_0xa75e('0x4'));var auth=require(_0xa75e('0x5'));var interaction=require(_0xa75e('0x6'));var config=require(_0xa75e('0x7'));module[_0xa75e('0x8')]=router; \ No newline at end of file +var _0x34bd=['../../components/interaction/service','../../config/environment','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x79ebbd,_0x2fde31){var _0x17e8a5=function(_0x948341){while(--_0x948341){_0x79ebbd['push'](_0x79ebbd['shift']());}};_0x17e8a5(++_0x2fde31);}(_0x34bd,0x1d2));var _0xd34b=function(_0x1a6970,_0xecaee2){_0x1a6970=_0x1a6970-0x0;var _0x21d9cd=_0x34bd[_0x1a6970];return _0x21d9cd;};'use strict';var multer=require(_0xd34b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd34b('0x1'));var express=require(_0xd34b('0x2'));var router=express[_0xd34b('0x3')]();var fs_extra=require(_0xd34b('0x4'));var auth=require(_0xd34b('0x5'));var interaction=require(_0xd34b('0x6'));var config=require(_0xd34b('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 8dbe466..762ead0 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 _0x0abf=['sequelize','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4a2=['INTEGER','sequelize'];(function(_0x1ac666,_0x40a6d0){var _0x4943a0=function(_0x5c9ca1){while(--_0x5c9ca1){_0x1ac666['push'](_0x1ac666['shift']());}};_0x4943a0(++_0x40a6d0);}(_0xd4a2,0x173));var _0x2d4a=function(_0x26101a,_0x565088){_0x26101a=_0x26101a-0x0;var _0xc9c017=_0xd4a2[_0x26101a];return _0xc9c017;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2d4a('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 50cd3f6..afb80d6 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 _0xff1e=['UserFaxQueue','user_has_fax_queues','util','api','bluebird','request-promise','./userFaxQueue.attributes','exports','define'];(function(_0x4dd7bb,_0x409176){var _0xbc91e8=function(_0x28690e){while(--_0x28690e){_0x4dd7bb['push'](_0x4dd7bb['shift']());}};_0xbc91e8(++_0x409176);}(_0xff1e,0x146));var _0xeff1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xff1e[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xeff1('0x0'));var logger=require('../../config/logger')(_0xeff1('0x1'));var moment=require('moment');var BPromise=require(_0xeff1('0x2'));var rp=require(_0xeff1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeff1('0x4'));module[_0xeff1('0x5')]=function(_0x1ed4cc,_0x7fa0fc){return _0x1ed4cc[_0xeff1('0x6')](_0xeff1('0x7'),attributes,{'tableName':_0xeff1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6ab=['bluebird','request-promise','path','exports','define','user_has_fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd6ab,0x124));var _0xbd6a=function(_0x2bf2ef,_0x3f3df2){_0x2bf2ef=_0x2bf2ef-0x0;var _0x157fdc=_0xd6ab[_0x2bf2ef];return _0x157fdc;};'use strict';var _=require(_0xbd6a('0x0'));var util=require(_0xbd6a('0x1'));var logger=require(_0xbd6a('0x2'))(_0xbd6a('0x3'));var moment=require(_0xbd6a('0x4'));var BPromise=require(_0xbd6a('0x5'));var rp=require(_0xbd6a('0x6'));var fs=require('fs');var path=require(_0xbd6a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xbd6a('0x8')]=function(_0x24a641,_0x5c5bfe){return _0x24a641[_0xbd6a('0x9')]('UserFaxQueue',attributes,{'tableName':_0xbd6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 1ee0792..a55441a 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 _0x9a8f=['ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a8f,0x1df));var _0xf9a8=function(_0x316b26,_0x2b1bc8){_0x316b26=_0x316b26-0x0;var _0xb88872=_0x9a8f[_0x316b26];return _0xb88872;};'use strict';var _=require('lodash');var util=require(_0xf9a8('0x0'));var moment=require(_0xf9a8('0x1'));var BPromise=require(_0xf9a8('0x2'));var rs=require(_0xf9a8('0x3'));var fs=require('fs');var Redis=require(_0xf9a8('0x4'));var db=require(_0xf9a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf9a8('0x6'));var jayson=require(_0xf9a8('0x7'));var client=jayson[_0xf9a8('0x8')][_0xf9a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48237d,_0x221b25,_0x39696c){return new BPromise(function(_0x48c2a5,_0x30ba3f){return client['request'](_0x48237d,_0x39696c)[_0xf9a8('0xa')](function(_0x5efb07){logger[_0xf9a8('0xb')](_0xf9a8('0xc'),_0x221b25,'request\x20sent');logger[_0xf9a8('0xd')](_0xf9a8('0xe'),_0x221b25,_0xf9a8('0xf'),JSON[_0xf9a8('0x10')](_0x5efb07));if(_0x5efb07['error']){if(_0x5efb07['error']['code']===0x1f4){logger[_0xf9a8('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x221b25,_0x5efb07['error'][_0xf9a8('0x12')]);return _0x30ba3f(_0x5efb07['error'][_0xf9a8('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x221b25,_0x5efb07[_0xf9a8('0x11')][_0xf9a8('0x12')]);return _0x48c2a5(_0x5efb07[_0xf9a8('0x11')]['message']);}else{logger[_0xf9a8('0xb')](_0xf9a8('0xc'),_0x221b25,_0xf9a8('0xf'));_0x48c2a5(_0x5efb07[_0xf9a8('0x13')][_0xf9a8('0x12')]);}})[_0xf9a8('0x14')](function(_0x27e1db){logger[_0xf9a8('0x11')](_0xf9a8('0xc'),_0x221b25,_0x27e1db);_0x30ba3f(_0x27e1db);});});} \ No newline at end of file +var _0xa5d1=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xa5d1,0xa1));var _0x1a5d=function(_0x3f1c86,_0x2494c0){_0x3f1c86=_0x3f1c86-0x0;var _0x14c74a=_0xa5d1[_0x3f1c86];return _0x14c74a;};'use strict';var _=require(_0x1a5d('0x0'));var util=require(_0x1a5d('0x1'));var moment=require('moment');var BPromise=require(_0x1a5d('0x2'));var rs=require(_0x1a5d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a5d('0x4'))['db'];var utils=require(_0x1a5d('0x5'));var logger=require(_0x1a5d('0x6'))(_0x1a5d('0x7'));var config=require(_0x1a5d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1a5d('0x9')][_0x1a5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2db94f,_0x215005,_0x4302e1){return new BPromise(function(_0x45f93d,_0x1380cd){return client[_0x1a5d('0xb')](_0x2db94f,_0x4302e1)[_0x1a5d('0xc')](function(_0x41f4cc){logger[_0x1a5d('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x215005,_0x1a5d('0xe'));logger['debug'](_0x1a5d('0xf'),_0x215005,'request\x20sent',JSON[_0x1a5d('0x10')](_0x41f4cc));if(_0x41f4cc['error']){if(_0x41f4cc[_0x1a5d('0x11')][_0x1a5d('0x12')]===0x1f4){logger['error'](_0x1a5d('0x13'),_0x215005,_0x41f4cc[_0x1a5d('0x11')][_0x1a5d('0x14')]);return _0x1380cd(_0x41f4cc[_0x1a5d('0x11')][_0x1a5d('0x14')]);}logger[_0x1a5d('0x11')](_0x1a5d('0x13'),_0x215005,_0x41f4cc[_0x1a5d('0x11')][_0x1a5d('0x14')]);return _0x45f93d(_0x41f4cc['error'][_0x1a5d('0x14')]);}else{logger[_0x1a5d('0xd')](_0x1a5d('0x13'),_0x215005,_0x1a5d('0xe'));_0x45f93d(_0x41f4cc[_0x1a5d('0x15')][_0x1a5d('0x14')]);}})[_0x1a5d('0x16')](function(_0x15b4c6){logger[_0x1a5d('0x11')](_0x1a5d('0x13'),_0x215005,_0x15b4c6);_0x1380cd(_0x15b4c6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index fc03dd3..caa8466 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 _0x49db=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x4e9e46,_0x4f49cf){var _0x5de19c=function(_0x414b1d){while(--_0x414b1d){_0x4e9e46['push'](_0x4e9e46['shift']());}};_0x5de19c(++_0x4f49cf);}(_0x49db,0xc5));var _0xb49d=function(_0x410d61,_0x12ea99){_0x410d61=_0x410d61-0x0;var _0x57e20f=_0x49db[_0x410d61];return _0x57e20f;};'use strict';var multer=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var path=require(_0xb49d('0x2'));var timeout=require(_0xb49d('0x3'));var express=require(_0xb49d('0x4'));var router=express['Router']();var fs_extra=require(_0xb49d('0x5'));var auth=require(_0xb49d('0x6'));var interaction=require(_0xb49d('0x7'));var config=require('../../config/environment');module[_0xb49d('0x8')]=router; \ No newline at end of file +var _0xb79a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x2c684d,_0x1d61b0){var _0x112863=function(_0xe64b45){while(--_0xe64b45){_0x2c684d['push'](_0x2c684d['shift']());}};_0x112863(++_0x1d61b0);}(_0xb79a,0x18e));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var path=require('path');var timeout=require(_0xab79('0x2'));var express=require(_0xab79('0x3'));var router=express[_0xab79('0x4')]();var fs_extra=require(_0xab79('0x5'));var auth=require(_0xab79('0x6'));var interaction=require(_0xab79('0x7'));var config=require(_0xab79('0x8'));module[_0xab79('0x9')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 132d645..dc6ff87 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x3accf9,_0x3e22b2){var _0x5ba536=function(_0x2a4cf4){while(--_0x2a4cf4){_0x3accf9['push'](_0x3accf9['shift']());}};_0x5ba536(++_0x3e22b2);}(_0xe706,0xa3));var _0x6e70=function(_0x2563e4,_0x456262){_0x2563e4=_0x2563e4-0x0;var _0x53e6d8=_0xe706[_0x2563e4];return _0x53e6d8;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 78eb54c..b476299 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5d5660,_0x55f04d){var _0x5348c8=function(_0x59b416){while(--_0x59b416){_0x5d5660['push'](_0x5d5660['shift']());}};_0x5348c8(++_0x55f04d);}(_0xe706,0xa3));var _0x6e70=function(_0x5991d7,_0x3ca7f8){_0x5991d7=_0x5991d7-0x0;var _0x5b299d=_0xe706[_0x5991d7];return _0x5b299d;};'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 +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x4d9efa,_0x2c75d3){var _0x4601ef=function(_0x429728){while(--_0x429728){_0x4d9efa['push'](_0x4d9efa['shift']());}};_0x4601ef(++_0x2c75d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 021f889..827070b 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 _0x3981=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x14afa3,_0xc86e65){var _0x5008ef=function(_0x4bfe25){while(--_0x4bfe25){_0x14afa3['push'](_0x14afa3['shift']());}};_0x5008ef(++_0xc86e65);}(_0x3981,0x144));var _0x1398=function(_0x39fba7,_0x11268c){_0x39fba7=_0x39fba7-0x0;var _0x488ed2=_0x3981[_0x39fba7];return _0x488ed2;};'use strict';var _=require(_0x1398('0x0'));var util=require('util');var moment=require(_0x1398('0x1'));var BPromise=require(_0x1398('0x2'));var rs=require(_0x1398('0x3'));var fs=require('fs');var Redis=require(_0x1398('0x4'));var db=require(_0x1398('0x5'))['db'];var utils=require(_0x1398('0x6'));var logger=require(_0x1398('0x7'))(_0x1398('0x8'));var config=require(_0x1398('0x9'));var jayson=require(_0x1398('0xa'));var client=jayson[_0x1398('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x216064,_0xdc7d88,_0x40e860){return new BPromise(function(_0x51dd7f,_0x3bb7c7){return client[_0x1398('0xc')](_0x216064,_0x40e860)[_0x1398('0xd')](function(_0x2c1da9){logger[_0x1398('0xe')](_0x1398('0xf'),_0xdc7d88,'request\x20sent');logger[_0x1398('0x10')](_0x1398('0x11'),_0xdc7d88,_0x1398('0x12'),JSON[_0x1398('0x13')](_0x2c1da9));if(_0x2c1da9[_0x1398('0x14')]){if(_0x2c1da9[_0x1398('0x14')][_0x1398('0x15')]===0x1f4){logger[_0x1398('0x14')](_0x1398('0xf'),_0xdc7d88,_0x2c1da9[_0x1398('0x14')]['message']);return _0x3bb7c7(_0x2c1da9[_0x1398('0x14')][_0x1398('0x16')]);}logger[_0x1398('0x14')](_0x1398('0xf'),_0xdc7d88,_0x2c1da9['error']['message']);return _0x51dd7f(_0x2c1da9['error'][_0x1398('0x16')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xdc7d88,'request\x20sent');_0x51dd7f(_0x2c1da9[_0x1398('0x17')]['message']);}})[_0x1398('0x18')](function(_0x255a40){logger[_0x1398('0x14')](_0x1398('0xf'),_0xdc7d88,_0x255a40);_0x3bb7c7(_0x255a40);});});} \ No newline at end of file +var _0xf3dc=['catch','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0xf3dc,0x1a5));var _0xcf3d=function(_0x48b819,_0x5159df){_0x48b819=_0x48b819-0x0;var _0x16b470=_0xf3dc[_0x48b819];return _0x16b470;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcf3d('0x0'));var BPromise=require(_0xcf3d('0x1'));var rs=require(_0xcf3d('0x2'));var fs=require('fs');var Redis=require(_0xcf3d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf3d('0x4'));var config=require(_0xcf3d('0x5'));var jayson=require(_0xcf3d('0x6'));var client=jayson['client'][_0xcf3d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c9177,_0x110a00,_0x1b846f){return new BPromise(function(_0x4a1e56,_0x5b5657){return client[_0xcf3d('0x8')](_0x3c9177,_0x1b846f)[_0xcf3d('0x9')](function(_0x50630f){logger['info'](_0xcf3d('0xa'),_0x110a00,_0xcf3d('0xb'));logger[_0xcf3d('0xc')](_0xcf3d('0xd'),_0x110a00,_0xcf3d('0xb'),JSON[_0xcf3d('0xe')](_0x50630f));if(_0x50630f[_0xcf3d('0xf')]){if(_0x50630f[_0xcf3d('0xf')][_0xcf3d('0x10')]===0x1f4){logger[_0xcf3d('0xf')](_0xcf3d('0xa'),_0x110a00,_0x50630f[_0xcf3d('0xf')][_0xcf3d('0x11')]);return _0x5b5657(_0x50630f[_0xcf3d('0xf')]['message']);}logger[_0xcf3d('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x110a00,_0x50630f['error'][_0xcf3d('0x11')]);return _0x4a1e56(_0x50630f[_0xcf3d('0xf')]['message']);}else{logger[_0xcf3d('0x12')](_0xcf3d('0xa'),_0x110a00,_0xcf3d('0xb'));_0x4a1e56(_0x50630f[_0xcf3d('0x13')][_0xcf3d('0x11')]);}})[_0xcf3d('0x14')](function(_0x4360a8){logger['error'](_0xcf3d('0xa'),_0x110a00,_0x4360a8);_0x5b5657(_0x4360a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 8c0aca7..ac5ea04 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x596b=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x1e5bc9,_0x38d171){var _0x20a1ad=function(_0x24a35c){while(--_0x24a35c){_0x1e5bc9['push'](_0x1e5bc9['shift']());}};_0x20a1ad(++_0x38d171);}(_0x596b,0x1b0));var _0xb596=function(_0x38cb06,_0x3e397c){_0x38cb06=_0x38cb06-0x0;var _0x23e537=_0x596b[_0x38cb06];return _0x23e537;};'use strict';var multer=require(_0xb596('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb596('0x1'));var express=require(_0xb596('0x2'));var router=express[_0xb596('0x3')]();var fs_extra=require(_0xb596('0x4'));var auth=require(_0xb596('0x5'));var interaction=require(_0xb596('0x6'));var config=require('../../config/environment');var controller=require(_0xb596('0x7'));router[_0xb596('0x8')]('/',auth[_0xb596('0x9')](),controller[_0xb596('0xa')]);module[_0xb596('0xb')]=router; \ No newline at end of file +var _0x2ce4=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb7d918,_0xe52c84){var _0x43d129=function(_0x4c39be){while(--_0x4c39be){_0xb7d918['push'](_0xb7d918['shift']());}};_0x43d129(++_0xe52c84);}(_0x2ce4,0x1e6));var _0x42ce=function(_0x5131c4,_0x512b72){_0x5131c4=_0x5131c4-0x0;var _0x255345=_0x2ce4[_0x5131c4];return _0x255345;};'use strict';var multer=require('multer');var util=require(_0x42ce('0x0'));var path=require(_0x42ce('0x1'));var timeout=require('connect-timeout');var express=require(_0x42ce('0x2'));var router=express[_0x42ce('0x3')]();var fs_extra=require(_0x42ce('0x4'));var auth=require(_0x42ce('0x5'));var interaction=require(_0x42ce('0x6'));var config=require(_0x42ce('0x7'));var controller=require(_0x42ce('0x8'));router[_0x42ce('0x9')]('/',auth[_0x42ce('0xa')](),controller['sendUserNotification']);module[_0x42ce('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index cbef6ff..946bfa8 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1aaf=['STRING','sequelize','exports','TEXT'];(function(_0x589017,_0x2274ac){var _0x3cc411=function(_0x2d75c4){while(--_0x2d75c4){_0x589017['push'](_0x589017['shift']());}};_0x3cc411(++_0x2274ac);}(_0x1aaf,0x1c1));var _0xf1aa=function(_0x4ee663,_0x228cb3){_0x4ee663=_0x4ee663-0x0;var _0x5bf953=_0x1aaf[_0x4ee663];return _0x5bf953;};'use strict';var Sequelize=require(_0xf1aa('0x0'));module[_0xf1aa('0x1')]={'body':{'type':Sequelize[_0xf1aa('0x2')]},'senderName':{'type':Sequelize[_0xf1aa('0x3')]},'recipientsId':{'type':Sequelize[_0xf1aa('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf1aa('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xf5a7=['STRING','TEXT','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5a7,0x6e));var _0x7f5a=function(_0x4001b5,_0x3225e0){_0x4001b5=_0x4001b5-0x0;var _0xb88ba8=_0xf5a7[_0x4001b5];return _0xb88ba8;};'use strict';var Sequelize=require('sequelize');module[_0x7f5a('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x7f5a('0x1')]},'recipientsId':{'type':Sequelize[_0x7f5a('0x2')]},'recipientsDescription':{'type':Sequelize[_0x7f5a('0x1')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 1490514..d1baac5 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x461c=['findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','toLowerCase','User','ids','queue','replace','Queue','push','all','union','flatten','eml-format','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','update','then','error','stack','name','send','sendUserNotification','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','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x461c,0x134));var _0xc461=function(_0x39881f,_0x1503fd){_0x39881f=_0x39881f-0x0;var _0x942a8b=_0x461c[_0x39881f];return _0x942a8b;};'use strict';var emlformat=require(_0xc461('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc461('0x1'));var rp=require(_0xc461('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc461('0x3'));var path=require(_0xc461('0x4'));var sox=require(_0xc461('0x5'));var csv=require(_0xc461('0x6'));var ejs=require(_0xc461('0x7'));var fs=require('fs');var fs_extra=require(_0xc461('0x8'));var _=require(_0xc461('0x9'));var squel=require(_0xc461('0xa'));var crypto=require('crypto');var jsforce=require(_0xc461('0xb'));var deskjs=require(_0xc461('0xc'));var toCsv=require(_0xc461('0x6'));var querystring=require(_0xc461('0xd'));var Papa=require(_0xc461('0xe'));var Redis=require(_0xc461('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc461('0x10'));var logger=require('../../config/logger')(_0xc461('0x11'));var utils=require('../../config/utils');var config=require(_0xc461('0x12'));var licenseUtil=require(_0xc461('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc461('0x14')](config['redis'],{'host':_0xc461('0x15'),'port':0x18eb});var socket=require(_0xc461('0x16'))(new Redis(config[_0xc461('0x17')]));require('./userNotification.socket')[_0xc461('0x18')](socket);function respondWithStatusCode(_0x25d67e,_0x2b8be4){_0x2b8be4=_0x2b8be4||0xcc;return function(_0x308bfa){if(_0x308bfa){return _0x25d67e[_0xc461('0x19')](_0x2b8be4);}return _0x25d67e[_0xc461('0x1a')](_0x2b8be4)[_0xc461('0x1b')]();};}function respondWithResult(_0x1ca478,_0x1ead16){_0x1ead16=_0x1ead16||0xc8;return function(_0x48e996){if(_0x48e996){return _0x1ca478['status'](_0x1ead16)[_0xc461('0x1c')](_0x48e996);}};}function respondWithFilteredResult(_0x3b853b,_0x5034d9){return function(_0xc34825){if(_0xc34825){var _0x1a0974=typeof _0x5034d9['offset']==='undefined'&&typeof _0x5034d9[_0xc461('0x1d')]==='undefined';var _0x5ab6d5=_0xc34825[_0xc461('0x1e')];var _0x12922f=_0x1a0974?0x0:_0x5034d9['offset'];var _0x33deff=_0x1a0974?_0xc34825['count']:_0x5034d9[_0xc461('0x1f')]+_0x5034d9[_0xc461('0x1d')];var _0x5d8859;if(_0x33deff>=_0x5ab6d5){_0x33deff=_0x5ab6d5;_0x5d8859=0xc8;}else{_0x5d8859=0xce;}_0x3b853b[_0xc461('0x1a')](_0x5d8859);return _0x3b853b[_0xc461('0x20')](_0xc461('0x21'),_0x12922f+'-'+_0x33deff+'/'+_0x5ab6d5)[_0xc461('0x1c')](_0xc34825);}return null;};}function patchUpdates(_0x542373){return function(_0x1dbfc2){try{jsonpatch['apply'](_0x1dbfc2,_0x542373,!![]);}catch(_0x55e6fc){return BPromise[_0xc461('0x22')](_0x55e6fc);}return _0x1dbfc2['save']();};}function saveUpdates(_0x2f81c7,_0x168b2a){return function(_0x3d8e51){if(_0x3d8e51){return _0x3d8e51[_0xc461('0x23')](_0x2f81c7)[_0xc461('0x24')](function(_0x162dd9){return _0x162dd9;});}return null;};}function removeEntity(_0x548bb4,_0xbb12c6){return function(_0x451aad){if(_0x451aad){return _0x451aad['destroy']()[_0xc461('0x24')](function(){_0x548bb4[_0xc461('0x1a')](0xcc)[_0xc461('0x1b')]();});}};}function handleEntityNotFound(_0x5b287b,_0x40f4f5){return function(_0x27932c){if(!_0x27932c){_0x5b287b[_0xc461('0x19')](0x194);}return _0x27932c;};}function handleError(_0x5ec8c7,_0x48d224){_0x48d224=_0x48d224||0x1f4;return function(_0x5ed808){logger[_0xc461('0x25')](_0x5ed808[_0xc461('0x26')]);if(_0x5ed808[_0xc461('0x27')]){delete _0x5ed808[_0xc461('0x27')];}_0x5ec8c7[_0xc461('0x1a')](_0x48d224)[_0xc461('0x28')](_0x5ed808);};}exports[_0xc461('0x29')]=function(_0x47bd63,_0x1ebf4f,_0x3aea3f){if(!_0x47bd63[_0xc461('0x2a')][_0xc461('0x2b')](_0xc461('0x2c'))&&!_0x47bd63[_0xc461('0x2a')]['hasOwnProperty'](_0xc461('0x2d'))){throw new db[(_0xc461('0x2e'))][(_0xc461('0x2f'))](_0xc461('0x30'));}else{if(_0x47bd63[_0xc461('0x2a')]['hasOwnProperty']('TemplateId')&&!_0x47bd63[_0xc461('0x2a')][_0xc461('0x2b')](_0xc461('0x31'))){throw new db[(_0xc461('0x2e'))]['ValidationError'](_0xc461('0x32'));}if(!_0x47bd63[_0xc461('0x2a')]['hasOwnProperty'](_0xc461('0x33'))){throw new db[(_0xc461('0x2e'))]['ValidationError'](_0xc461('0x34'));}else{try{var _0x23ae3d=JSON[_0xc461('0x35')](_0x47bd63['body']['recipients']);}catch(_0x44303f){logger[_0xc461('0x25')](_0x44303f);throw new db[(_0xc461('0x2e'))][(_0xc461('0x2f'))](_0xc461('0x36'));}var _0x565ae7=[_0xc461('0x37'),_0xc461('0x38'),_0xc461('0x39'),_0xc461('0x3a'),_0xc461('0x3b'),_0xc461('0x3c'),_0xc461('0x3d'),_0xc461('0x3e'),_0xc461('0x3f')];if(_[_0xc461('0x40')](_0x23ae3d,function(_0x2fb35e){return!_[_0xc461('0x41')](_0x565ae7,_0x2fb35e[_0xc461('0x42')]['toLowerCase']());})){throw new db[(_0xc461('0x2e'))][(_0xc461('0x2f'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x1c5a4f={};_0x1c5a4f[_0xc461('0x43')]=_0x47bd63[_0xc461('0x2a')]['hasOwnProperty'](_0xc461('0x43'))?_0x47bd63[_0xc461('0x2a')][_0xc461('0x43')]:_0x47bd63[_0xc461('0x3f')][_0xc461('0x44')];_0x1c5a4f[_0xc461('0x45')]=_[_0xc461('0x46')](_0x47bd63[_0xc461('0x2a')][_0xc461('0x45')])?null:_0x47bd63[_0xc461('0x2a')][_0xc461('0x45')];_0x1c5a4f[_0xc461('0x47')]=_0x47bd63[_0xc461('0x2a')][_0xc461('0x47')]||![];_0x1c5a4f[_0xc461('0x48')]=_0x47bd63['user']['id'];return getContent(_0x47bd63['body'])['then'](function(_0x1d295e){_0x1c5a4f[_0xc461('0x2a')]=_0x1d295e;return getRecipients(_0x23ae3d);})[_0xc461('0x24')](function(_0x1ba8ed){_0x1c5a4f[_0xc461('0x49')]=_[_0xc461('0x4a')](_0x1ba8ed)['join'](',');return db[_0xc461('0x4b')]['transaction'](function(_0x375537){return db[_0xc461('0x4c')][_0xc461('0x4d')](_0x1c5a4f,{'raw':!![],'transaction':_0x375537})[_0xc461('0x24')](function(_0x2b8b53){var _0x43856d={'sender':_0x1c5a4f[_0xc461('0x43')],'description':_0x1c5a4f[_0xc461('0x45')],'content':_0x1c5a4f[_0xc461('0x2a')],'beep':_0x1c5a4f[_0xc461('0x47')]};_0x1ba8ed[_0xc461('0x4e')](function(_0x349177){_0x43856d[_0xc461('0x4f')]=_0x349177;socket[_0xc461('0x50')](_0xc461('0x51'),_0x43856d);});return _0x2b8b53;});});})['then'](respondWithResult(_0x1ebf4f,0xc9))[_0xc461('0x52')](handleError(_0x1ebf4f,null));};function getContent(_0x5d6193){return new BPromise(function(_0x58f08b,_0x16da43){if(_0x5d6193[_0xc461('0x2c')]){_0x58f08b(_0x5d6193[_0xc461('0x2c')]);return;}return db[_0xc461('0x53')][_0xc461('0x54')]({'attributes':[_0xc461('0x55')],'where':{'id':_0x5d6193['TemplateId']},'raw':!![]})['then'](function(_0x51e058){if(!_0x51e058)throw new db['Sequelize'][(_0xc461('0x2f'))](_0xc461('0x56'));var _0x505abf=Mustache['render'](_0x51e058[_0xc461('0x55')],_0x5d6193[_0xc461('0x31')]);_0x58f08b(_0x505abf);})[_0xc461('0x52')](function(_0x138426){_0x16da43(_0x138426);});});}function getRecipients(_0x386954){return new BPromise(function(_0x307a12,_0x5b8c9f){var _0x3e3f8e=[];var _0xd4aadd=[];_0x386954[_0xc461('0x4e')](function(_0x258d1b){var _0x28cbff=_[_0xc461('0x57')](_0x258d1b[_0xc461('0x42')][_0xc461('0x58')]());if(_0x28cbff===_0xc461('0x59')){_0x3e3f8e=_['union'](_0x3e3f8e,_0x258d1b[_0xc461('0x5a')]);}else{if(_[_0xc461('0x41')](_0x28cbff,_0xc461('0x5b')))_0x28cbff=_0x28cbff[_0xc461('0x5c')](_0xc461('0x5b'),_0xc461('0x5d'));_0x258d1b[_0xc461('0x5a')][_0xc461('0x4e')](function(_0x29f36d){_0xd4aadd[_0xc461('0x5e')](getAgents(_0x28cbff,_0x29f36d));});}});return BPromise[_0xc461('0x5f')](_0xd4aadd)[_0xc461('0x24')](function(_0x1eefa4){_0x3e3f8e=_[_0xc461('0x60')](_0x3e3f8e,_[_0xc461('0x61')](_0x1eefa4));_0x307a12(_0x3e3f8e);})[_0xc461('0x52')](function(_0x55f880){_0x5b8c9f(_0x55f880);});});}function getAgents(_0x38093a,_0x44ab1c){return new BPromise(function(_0x5155b4,_0x2ee2a9){return db[_0x38093a][_0xc461('0x54')]({'where':{'id':_0x44ab1c}})[_0xc461('0x24')](function(_0x3ed982){return _0x3ed982['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x1f89b1){var _0x38f193=_['map'](_0x1f89b1,'id');_0x5155b4(_0x38f193);});})['catch'](function(_0x1b31a8){_0x2ee2a9(_0x1b31a8);});});} \ No newline at end of file +var _0xffaa=['./userNotification.socket','register','status','offset','limit','undefined','Content-Range','json','reject','save','update','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','toLowerCase','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter'];(function(_0x11d5d6,_0x33eef8){var _0x4af912=function(_0x4d2341){while(--_0x4d2341){_0x11d5d6['push'](_0x11d5d6['shift']());}};_0x4af912(++_0x33eef8);}(_0xffaa,0xb1));var _0xaffa=function(_0x2bb393,_0x327223){_0x2bb393=_0x2bb393-0x0;var _0x1c9205=_0xffaa[_0x2bb393];return _0x1c9205;};'use strict';var emlformat=require(_0xaffa('0x0'));var rimraf=require(_0xaffa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaffa('0x2'));var rp=require(_0xaffa('0x3'));var moment=require(_0xaffa('0x4'));var BPromise=require(_0xaffa('0x5'));var Mustache=require(_0xaffa('0x6'));var util=require(_0xaffa('0x7'));var path=require(_0xaffa('0x8'));var sox=require(_0xaffa('0x9'));var csv=require(_0xaffa('0xa'));var ejs=require(_0xaffa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaffa('0xc'));var squel=require(_0xaffa('0xd'));var crypto=require(_0xaffa('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaffa('0xf'));var Papa=require(_0xaffa('0x10'));var Redis=require(_0xaffa('0x11'));var authService=require(_0xaffa('0x12'));var qs=require(_0xaffa('0x13'));var as=require(_0xaffa('0x14'));var hardwareService=require(_0xaffa('0x15'));var logger=require('../../config/logger')(_0xaffa('0x16'));var utils=require('../../config/utils');var config=require(_0xaffa('0x17'));var licenseUtil=require(_0xaffa('0x18'));var db=require(_0xaffa('0x19'))['db'];config['redis']=_[_0xaffa('0x1a')](config[_0xaffa('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xaffa('0x1c'))(new Redis(config[_0xaffa('0x1b')]));require(_0xaffa('0x1d'))[_0xaffa('0x1e')](socket);function respondWithStatusCode(_0x4124cd,_0x26c77b){_0x26c77b=_0x26c77b||0xcc;return function(_0x15ad8d){if(_0x15ad8d){return _0x4124cd['sendStatus'](_0x26c77b);}return _0x4124cd[_0xaffa('0x1f')](_0x26c77b)['end']();};}function respondWithResult(_0xd2c9e7,_0x12cef4){_0x12cef4=_0x12cef4||0xc8;return function(_0x17dc62){if(_0x17dc62){return _0xd2c9e7[_0xaffa('0x1f')](_0x12cef4)['json'](_0x17dc62);}};}function respondWithFilteredResult(_0x4599e8,_0x15aca4){return function(_0x36fc9d){if(_0x36fc9d){var _0x1e836b=typeof _0x15aca4[_0xaffa('0x20')]==='undefined'&&typeof _0x15aca4[_0xaffa('0x21')]===_0xaffa('0x22');var _0x4550a7=_0x36fc9d['count'];var _0x2f5bb9=_0x1e836b?0x0:_0x15aca4['offset'];var _0x151da9=_0x1e836b?_0x36fc9d['count']:_0x15aca4[_0xaffa('0x20')]+_0x15aca4[_0xaffa('0x21')];var _0x7515cb;if(_0x151da9>=_0x4550a7){_0x151da9=_0x4550a7;_0x7515cb=0xc8;}else{_0x7515cb=0xce;}_0x4599e8[_0xaffa('0x1f')](_0x7515cb);return _0x4599e8['set'](_0xaffa('0x23'),_0x2f5bb9+'-'+_0x151da9+'/'+_0x4550a7)[_0xaffa('0x24')](_0x36fc9d);}return null;};}function patchUpdates(_0x572adb){return function(_0x14ea7d){try{jsonpatch['apply'](_0x14ea7d,_0x572adb,!![]);}catch(_0x43078a){return BPromise[_0xaffa('0x25')](_0x43078a);}return _0x14ea7d[_0xaffa('0x26')]();};}function saveUpdates(_0x4d4587,_0x40ac81){return function(_0x249eb0){if(_0x249eb0){return _0x249eb0[_0xaffa('0x27')](_0x4d4587)[_0xaffa('0x28')](function(_0x5c557d){return _0x5c557d;});}return null;};}function removeEntity(_0x1fae2b,_0x260fc6){return function(_0x5a8758){if(_0x5a8758){return _0x5a8758[_0xaffa('0x29')]()[_0xaffa('0x28')](function(){_0x1fae2b[_0xaffa('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bd564,_0x26e123){return function(_0x29a128){if(!_0x29a128){_0x4bd564['sendStatus'](0x194);}return _0x29a128;};}function handleError(_0x364997,_0x3d0903){_0x3d0903=_0x3d0903||0x1f4;return function(_0x1625e3){logger['error'](_0x1625e3[_0xaffa('0x2a')]);if(_0x1625e3[_0xaffa('0x2b')]){delete _0x1625e3['name'];}_0x364997[_0xaffa('0x1f')](_0x3d0903)[_0xaffa('0x2c')](_0x1625e3);};}exports[_0xaffa('0x2d')]=function(_0x5025d9,_0xedc720,_0x473999){if(!_0x5025d9[_0xaffa('0x2e')][_0xaffa('0x2f')](_0xaffa('0x30'))&&!_0x5025d9['body'][_0xaffa('0x2f')](_0xaffa('0x31'))){throw new db[(_0xaffa('0x32'))]['ValidationError'](_0xaffa('0x33'));}else{if(_0x5025d9[_0xaffa('0x2e')][_0xaffa('0x2f')](_0xaffa('0x31'))&&!_0x5025d9[_0xaffa('0x2e')][_0xaffa('0x2f')](_0xaffa('0x34'))){throw new db[(_0xaffa('0x32'))][(_0xaffa('0x35'))](_0xaffa('0x36'));}if(!_0x5025d9[_0xaffa('0x2e')]['hasOwnProperty'](_0xaffa('0x37'))){throw new db[(_0xaffa('0x32'))][(_0xaffa('0x35'))](_0xaffa('0x38'));}else{try{var _0x4bc9b2=JSON[_0xaffa('0x39')](_0x5025d9['body']['recipients']);}catch(_0x4ad51f){logger['error'](_0x4ad51f);throw new db[(_0xaffa('0x32'))][(_0xaffa('0x35'))](_0xaffa('0x3a'));}var _0x45b563=[_0xaffa('0x3b'),_0xaffa('0x3c'),_0xaffa('0x3d'),_0xaffa('0x3e'),_0xaffa('0x3f'),_0xaffa('0x40'),_0xaffa('0x41'),_0xaffa('0x42'),_0xaffa('0x43')];if(_['some'](_0x4bc9b2,function(_0x94a0e5){return!_[_0xaffa('0x44')](_0x45b563,_0x94a0e5[_0xaffa('0x45')]['toLowerCase']());})){throw new db[(_0xaffa('0x32'))][(_0xaffa('0x35'))](_0xaffa('0x46'));}}}var _0x222652={};_0x222652[_0xaffa('0x47')]=_0x5025d9[_0xaffa('0x2e')][_0xaffa('0x2f')](_0xaffa('0x47'))?_0x5025d9[_0xaffa('0x2e')][_0xaffa('0x47')]:_0x5025d9[_0xaffa('0x43')]['fullname'];_0x222652['recipientsDescription']=_[_0xaffa('0x48')](_0x5025d9[_0xaffa('0x2e')][_0xaffa('0x49')])?null:_0x5025d9[_0xaffa('0x2e')]['recipientsDescription'];_0x222652[_0xaffa('0x4a')]=_0x5025d9[_0xaffa('0x2e')][_0xaffa('0x4a')]||![];_0x222652[_0xaffa('0x4b')]=_0x5025d9[_0xaffa('0x43')]['id'];return getContent(_0x5025d9[_0xaffa('0x2e')])[_0xaffa('0x28')](function(_0x34e3de){_0x222652[_0xaffa('0x2e')]=_0x34e3de;return getRecipients(_0x4bc9b2);})['then'](function(_0xb6ef61){_0x222652[_0xaffa('0x4c')]=_[_0xaffa('0x4d')](_0xb6ef61)[_0xaffa('0x4e')](',');return db[_0xaffa('0x4f')][_0xaffa('0x50')](function(_0x121d74){return db[_0xaffa('0x51')]['create'](_0x222652,{'raw':!![],'transaction':_0x121d74})['then'](function(_0x57c093){var _0x11b55a={'sender':_0x222652[_0xaffa('0x47')],'description':_0x222652[_0xaffa('0x49')],'content':_0x222652[_0xaffa('0x2e')],'beep':_0x222652[_0xaffa('0x4a')]};_0xb6ef61[_0xaffa('0x52')](function(_0x12b7c1){_0x11b55a[_0xaffa('0x53')]=_0x12b7c1;socket[_0xaffa('0x54')]('userNotification:send',_0x11b55a);});return _0x57c093;});});})['then'](respondWithResult(_0xedc720,0xc9))[_0xaffa('0x55')](handleError(_0xedc720,null));};function getContent(_0x1fc65d){return new BPromise(function(_0x145a12,_0x540941){if(_0x1fc65d[_0xaffa('0x30')]){_0x145a12(_0x1fc65d[_0xaffa('0x30')]);return;}return db[_0xaffa('0x56')][_0xaffa('0x57')]({'attributes':['html'],'where':{'id':_0x1fc65d[_0xaffa('0x31')]},'raw':!![]})[_0xaffa('0x28')](function(_0x2efa81){if(!_0x2efa81)throw new db['Sequelize']['ValidationError'](_0xaffa('0x58'));var _0x432a19=Mustache[_0xaffa('0x59')](_0x2efa81[_0xaffa('0x5a')],_0x1fc65d['view']);_0x145a12(_0x432a19);})[_0xaffa('0x55')](function(_0x181c3f){_0x540941(_0x181c3f);});});}function getRecipients(_0x42d8db){return new BPromise(function(_0x3ffb5b,_0x1c3d41){var _0x1b6fc8=[];var _0x17a2c4=[];_0x42d8db[_0xaffa('0x52')](function(_0x20565c){var _0x30be18=_[_0xaffa('0x5b')](_0x20565c[_0xaffa('0x45')][_0xaffa('0x5c')]());if(_0x30be18==='User'){_0x1b6fc8=_[_0xaffa('0x5d')](_0x1b6fc8,_0x20565c[_0xaffa('0x5e')]);}else{if(_[_0xaffa('0x44')](_0x30be18,_0xaffa('0x5f')))_0x30be18=_0x30be18[_0xaffa('0x60')](_0xaffa('0x5f'),_0xaffa('0x61'));_0x20565c['ids']['forEach'](function(_0x2bf202){_0x17a2c4[_0xaffa('0x62')](getAgents(_0x30be18,_0x2bf202));});}});return BPromise[_0xaffa('0x63')](_0x17a2c4)[_0xaffa('0x28')](function(_0x1d38f0){_0x1b6fc8=_['union'](_0x1b6fc8,_[_0xaffa('0x64')](_0x1d38f0));_0x3ffb5b(_0x1b6fc8);})['catch'](function(_0x3ac56c){_0x1c3d41(_0x3ac56c);});});}function getAgents(_0x3ac728,_0x68da2b){return new BPromise(function(_0xdac797,_0x5c7ed6){return db[_0x3ac728][_0xaffa('0x57')]({'where':{'id':_0x68da2b}})['then'](function(_0x28e800){return _0x28e800[_0xaffa('0x65')]({'attributes':['id'],'raw':!![]})[_0xaffa('0x28')](function(_0x214848){var _0x3bcc4c=_[_0xaffa('0x66')](_0x214848,'id');_0xdac797(_0x3bcc4c);});})['catch'](function(_0x3983b0){_0x5c7ed6(_0x3983b0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index c47b509..4ae83b9 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x1d60af,_0x137d17){var _0x745a12=function(_0x54bac7){while(--_0x54bac7){_0x1d60af['push'](_0x1d60af['shift']());}};_0x745a12(++_0x137d17);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var UserNotification=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){UserNotificationEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);UserNotificationEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];UserNotification[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x68fc=['update','emit','hasOwnProperty','events','../../mysqldb','UserNotification'];(function(_0x4c68bc,_0xab812f){var _0x547c43=function(_0x3b7ac9){while(--_0x3b7ac9){_0x4c68bc['push'](_0x4c68bc['shift']());}};_0x547c43(++_0xab812f);}(_0x68fc,0xa5));var _0xc68f=function(_0x325298,_0x2d948a){_0x325298=_0x325298-0x0;var _0x23297e=_0x68fc[_0x325298];return _0x23297e;};'use strict';var EventEmitter=require(_0xc68f('0x0'));var UserNotification=require(_0xc68f('0x1'))['db'][_0xc68f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc68f('0x3'),'afterDestroy':'remove'};function emitEvent(_0xe70787){return function(_0x593648,_0x5899ea,_0x3b2744){UserNotificationEvents[_0xc68f('0x4')](_0xe70787+':'+_0x593648['id'],_0x593648);UserNotificationEvents[_0xc68f('0x4')](_0xe70787,_0x593648);_0x3b2744(null);};}for(var e in events){if(events[_0xc68f('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 1e8bd69..2211ef9 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4213=['rimraf','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4213,0x77));var _0x3421=function(_0x314ead,_0x13ec06){_0x314ead=_0x314ead-0x0;var _0x1e36a0=_0x4213[_0x314ead];return _0x1e36a0;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var logger=require(_0x3421('0x2'))(_0x3421('0x3'));var moment=require(_0x3421('0x4'));var BPromise=require(_0x3421('0x5'));var rp=require(_0x3421('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3421('0x7'));var config=require('../../config/environment');var attributes=require(_0x3421('0x8'));module[_0x3421('0x9')]=function(_0x2155f8,_0x2a04e0){return _0x2155f8['define'](_0x3421('0xa'),attributes,{'tableName':_0x3421('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3421('0xc'),'collate':_0x3421('0xd')});}; \ No newline at end of file +var _0x8ae9=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','./userNotification.attributes','exports','UserNotification'];(function(_0x240b55,_0x434680){var _0x3d0ebd=function(_0x3c206c){while(--_0x3c206c){_0x240b55['push'](_0x240b55['shift']());}};_0x3d0ebd(++_0x434680);}(_0x8ae9,0x179));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x98ae('0x0'));var util=require(_0x98ae('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x98ae('0x2'));var rp=require(_0x98ae('0x3'));var fs=require('fs');var path=require(_0x98ae('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x98ae('0x5'));module[_0x98ae('0x6')]=function(_0x237dd0,_0x3a6b37){return _0x237dd0['define'](_0x98ae('0x7'),attributes,{'tableName':_0x98ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x98ae('0x9'),'collate':_0x98ae('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9693b22..7b6e349 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00a6=['redis','localhost','socket.io-emitter','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x00a6,0x96));var _0x600a=function(_0x4394fb,_0x248f84){_0x4394fb=_0x4394fb-0x0;var _0x368e22=_0x00a6[_0x4394fb];return _0x368e22;};'use strict';var _=require('lodash');var util=require(_0x600a('0x0'));var moment=require(_0x600a('0x1'));var BPromise=require(_0x600a('0x2'));var rs=require(_0x600a('0x3'));var fs=require('fs');var Redis=require(_0x600a('0x4'));var db=require(_0x600a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x600a('0x6'))(_0x600a('0x7'));var config=require(_0x600a('0x8'));var jayson=require(_0x600a('0x9'));var client=jayson[_0x600a('0xa')]['http']({'port':0x232a});config[_0x600a('0xb')]=_['defaults'](config[_0x600a('0xb')],{'host':_0x600a('0xc'),'port':0x18eb});var socket=require(_0x600a('0xd'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x459032,_0x262c48,_0x46f352){return new BPromise(function(_0x195876,_0x87d62c){return client[_0x600a('0xe')](_0x459032,_0x46f352)['then'](function(_0x4900d2){logger[_0x600a('0xf')](_0x600a('0x10'),_0x262c48,_0x600a('0x11'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x262c48,_0x600a('0x11'),JSON[_0x600a('0x12')](_0x4900d2));if(_0x4900d2[_0x600a('0x13')]){if(_0x4900d2[_0x600a('0x13')]['code']===0x1f4){logger['error'](_0x600a('0x10'),_0x262c48,_0x4900d2[_0x600a('0x13')][_0x600a('0x14')]);return _0x87d62c(_0x4900d2[_0x600a('0x13')]['message']);}logger[_0x600a('0x13')](_0x600a('0x10'),_0x262c48,_0x4900d2[_0x600a('0x13')][_0x600a('0x14')]);return _0x195876(_0x4900d2[_0x600a('0x13')][_0x600a('0x14')]);}else{logger[_0x600a('0xf')](_0x600a('0x10'),_0x262c48,_0x600a('0x11'));_0x195876(_0x4900d2[_0x600a('0x15')][_0x600a('0x14')]);}})[_0x600a('0x16')](function(_0x51dcc5){logger[_0x600a('0x13')](_0x600a('0x10'),_0x262c48,_0x51dcc5);_0x87d62c(_0x51dcc5);});});} \ No newline at end of file +var _0x11d2=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11d2,0x86));var _0x211d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x11d2[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x211d('0x0'));var util=require(_0x211d('0x1'));var moment=require(_0x211d('0x2'));var BPromise=require('bluebird');var rs=require(_0x211d('0x3'));var fs=require('fs');var Redis=require(_0x211d('0x4'));var db=require(_0x211d('0x5'))['db'];var utils=require(_0x211d('0x6'));var logger=require(_0x211d('0x7'))(_0x211d('0x8'));var config=require('../../config/environment');var jayson=require(_0x211d('0x9'));var client=jayson[_0x211d('0xa')][_0x211d('0xb')]({'port':0x232a});config[_0x211d('0xc')]=_[_0x211d('0xd')](config[_0x211d('0xc')],{'host':_0x211d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x211d('0xf'))[_0x211d('0x10')](socket);function respondWithRpcPromise(_0xb4fb3d,_0x192927,_0x4c981c){return new BPromise(function(_0x36f045,_0x60d619){return client['request'](_0xb4fb3d,_0x4c981c)[_0x211d('0x11')](function(_0x39ffc4){logger['info'](_0x211d('0x12'),_0x192927,'request\x20sent');logger[_0x211d('0x13')](_0x211d('0x14'),_0x192927,_0x211d('0x15'),JSON[_0x211d('0x16')](_0x39ffc4));if(_0x39ffc4[_0x211d('0x17')]){if(_0x39ffc4[_0x211d('0x17')][_0x211d('0x18')]===0x1f4){logger[_0x211d('0x17')](_0x211d('0x12'),_0x192927,_0x39ffc4[_0x211d('0x17')]['message']);return _0x60d619(_0x39ffc4[_0x211d('0x17')][_0x211d('0x19')]);}logger[_0x211d('0x17')]('UserNotification,\x20%s,\x20%s',_0x192927,_0x39ffc4[_0x211d('0x17')][_0x211d('0x19')]);return _0x36f045(_0x39ffc4[_0x211d('0x17')][_0x211d('0x19')]);}else{logger['info'](_0x211d('0x12'),_0x192927,_0x211d('0x15'));_0x36f045(_0x39ffc4[_0x211d('0x1a')]['message']);}})[_0x211d('0x1b')](function(_0x16a4de){logger['error'](_0x211d('0x12'),_0x192927,_0x16a4de);_0x60d619(_0x16a4de);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 17234ce..3cde24d 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7676=['./userNotification.events','save','remove','emit','removeListener','register','length','userNotification:'];(function(_0x2bd3f7,_0xb9be42){var _0x74cfa7=function(_0x227dc0){while(--_0x227dc0){_0x2bd3f7['push'](_0x2bd3f7['shift']());}};_0x74cfa7(++_0xb9be42);}(_0x7676,0xb8));var _0x6767=function(_0x2efcd3,_0x216cc0){_0x2efcd3=_0x2efcd3-0x0;var _0x45e02e=_0x7676[_0x2efcd3];return _0x45e02e;};'use strict';var UserNotificationEvents=require(_0x6767('0x0'));var events=[_0x6767('0x1'),_0x6767('0x2'),'update'];function createListener(_0x38ffba,_0x478b23){return function(_0x51f099){_0x478b23[_0x6767('0x3')](_0x38ffba,_0x51f099);};}function removeListener(_0x4bd37b,_0x4005ff){return function(){UserNotificationEvents[_0x6767('0x4')](_0x4bd37b,_0x4005ff);};}exports[_0x6767('0x5')]=function(_0x4d0c08){for(var _0x24d747=0x0,_0x3f61f5=events[_0x6767('0x6')];_0x24d747<_0x3f61f5;_0x24d747++){var _0x54d2c7=events[_0x24d747];var _0xb81431=createListener(_0x6767('0x7')+_0x54d2c7,_0x4d0c08);UserNotificationEvents['on'](_0x54d2c7,_0xb81431);}}; \ No newline at end of file +var _0x2d17=['update','emit','register','userNotification:','./userNotification.events','save'];(function(_0x52671b,_0x1e32a1){var _0x4764a0=function(_0xb4779){while(--_0xb4779){_0x52671b['push'](_0x52671b['shift']());}};_0x4764a0(++_0x1e32a1);}(_0x2d17,0x17e));var _0x72d1=function(_0x5880e4,_0x4faec2){_0x5880e4=_0x5880e4-0x0;var _0x24c08c=_0x2d17[_0x5880e4];return _0x24c08c;};'use strict';var UserNotificationEvents=require(_0x72d1('0x0'));var events=[_0x72d1('0x1'),'remove',_0x72d1('0x2')];function createListener(_0x4727f9,_0x531f4e){return function(_0x3687bc){_0x531f4e[_0x72d1('0x3')](_0x4727f9,_0x3687bc);};}function removeListener(_0x55b722,_0x1dd6d8){return function(){UserNotificationEvents['removeListener'](_0x55b722,_0x1dd6d8);};}exports[_0x72d1('0x4')]=function(_0x50f551){for(var _0x139ba0=0x0,_0x239d1f=events['length'];_0x139ba0<_0x239d1f;_0x139ba0++){var _0x477264=events[_0x139ba0];var _0x422f5a=createListener(_0x72d1('0x5')+_0x477264,_0x50f551);UserNotificationEvents['on'](_0x477264,_0x422f5a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 49778a5..ca22df3 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 _0xc2af=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d1f09,_0x55e377){var _0x55a7c7=function(_0xfbc7de){while(--_0xfbc7de){_0x1d1f09['push'](_0x1d1f09['shift']());}};_0x55a7c7(++_0x55e377);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x463a14,_0x16a7c7){_0x463a14=_0x463a14-0x0;var _0x794caf=_0xc2af[_0x463a14];return _0x794caf;};'use strict';var multer=require(_0xfc2a('0x0'));var util=require('util');var path=require(_0xfc2a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc2a('0x2'));var router=express[_0xfc2a('0x3')]();var fs_extra=require(_0xfc2a('0x4'));var auth=require(_0xfc2a('0x5'));var interaction=require(_0xfc2a('0x6'));var config=require(_0xfc2a('0x7'));module[_0xfc2a('0x8')]=router; \ No newline at end of file +var _0x0cfa=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x495f6f,_0x20c392){var _0x39bbf3=function(_0x24b0e3){while(--_0x24b0e3){_0x495f6f['push'](_0x495f6f['shift']());}};_0x39bbf3(++_0x20c392);}(_0x0cfa,0x73));var _0xa0cf=function(_0x485301,_0x2a6e63){_0x485301=_0x485301-0x0;var _0x3175ae=_0x0cfa[_0x485301];return _0x3175ae;};'use strict';var multer=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var path=require(_0xa0cf('0x2'));var timeout=require(_0xa0cf('0x3'));var express=require(_0xa0cf('0x4'));var router=express[_0xa0cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa0cf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa0cf('0x7'));module[_0xa0cf('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 76caa36..02a7dde 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 _0xbaf0=['exports','INTEGER'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x452143,_0x330469){var _0x2e5203=function(_0x3d5cec){while(--_0x3d5cec){_0x452143['push'](_0x452143['shift']());}};_0x2e5203(++_0x330469);}(_0xe706,0xa3));var _0x6e70=function(_0x335ef5,_0x1a74a9){_0x335ef5=_0x335ef5-0x0;var _0xc51af9=_0xe706[_0x335ef5];return _0xc51af9;};'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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 0f98f8f..59aca2d 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 _0x705c=['request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','moment'];(function(_0x19c038,_0x175394){var _0x3e4fc9=function(_0x8887cb){while(--_0x8887cb){_0x19c038['push'](_0x19c038['shift']());}};_0x3e4fc9(++_0x175394);}(_0x705c,0x69));var _0xc705=function(_0x24fbf3,_0x55045a){_0x24fbf3=_0x24fbf3-0x0;var _0x778b60=_0x705c[_0x24fbf3];return _0x778b60;};'use strict';var _=require(_0xc705('0x0'));var util=require('util');var logger=require(_0xc705('0x1'))('api');var moment=require(_0xc705('0x2'));var BPromise=require('bluebird');var rp=require(_0xc705('0x3'));var fs=require('fs');var path=require(_0xc705('0x4'));var rimraf=require(_0xc705('0x5'));var config=require(_0xc705('0x6'));var attributes=require(_0xc705('0x7'));module[_0xc705('0x8')]=function(_0x3671fc,_0x40eb0b){return _0x3671fc[_0xc705('0x9')](_0xc705('0xa'),attributes,{'tableName':_0xc705('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb99b=['user_has_openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue'];(function(_0x4a0195,_0x2c55d1){var _0xfa5782=function(_0x10ce79){while(--_0x10ce79){_0x4a0195['push'](_0x4a0195['shift']());}};_0xfa5782(++_0x2c55d1);}(_0xb99b,0x85));var _0xbb99=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb99b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbb99('0x0'));var util=require(_0xbb99('0x1'));var logger=require('../../config/logger')(_0xbb99('0x2'));var moment=require(_0xbb99('0x3'));var BPromise=require(_0xbb99('0x4'));var rp=require(_0xbb99('0x5'));var fs=require('fs');var path=require(_0xbb99('0x6'));var rimraf=require('rimraf');var config=require(_0xbb99('0x7'));var attributes=require(_0xbb99('0x8'));module[_0xbb99('0x9')]=function(_0x519d71,_0x4fcfb1){return _0x519d71['define'](_0xbb99('0xa'),attributes,{'tableName':_0xbb99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index c31c030..32503e9 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 _0xabf7=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x2d9f45,_0x474eaa){var _0x433b84=function(_0x471ded){while(--_0x471ded){_0x2d9f45['push'](_0x2d9f45['shift']());}};_0x433b84(++_0x474eaa);}(_0xabf7,0x19e));var _0x7abf=function(_0x1c4951,_0x2038ee){_0x1c4951=_0x1c4951-0x0;var _0x345e1b=_0xabf7[_0x1c4951];return _0x345e1b;};'use strict';var _=require(_0x7abf('0x0'));var util=require(_0x7abf('0x1'));var moment=require(_0x7abf('0x2'));var BPromise=require(_0x7abf('0x3'));var rs=require(_0x7abf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7abf('0x5'))['db'];var utils=require(_0x7abf('0x6'));var logger=require(_0x7abf('0x7'))(_0x7abf('0x8'));var config=require('../../config/environment');var jayson=require(_0x7abf('0x9'));var client=jayson[_0x7abf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bd1c1,_0x41be78,_0x207a0c){return new BPromise(function(_0x3a045e,_0x4b1a1b){return client['request'](_0x2bd1c1,_0x207a0c)['then'](function(_0x5624a1){logger[_0x7abf('0xb')](_0x7abf('0xc'),_0x41be78,_0x7abf('0xd'));logger['debug'](_0x7abf('0xe'),_0x41be78,_0x7abf('0xd'),JSON[_0x7abf('0xf')](_0x5624a1));if(_0x5624a1['error']){if(_0x5624a1['error']['code']===0x1f4){logger[_0x7abf('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x41be78,_0x5624a1[_0x7abf('0x10')][_0x7abf('0x11')]);return _0x4b1a1b(_0x5624a1['error']['message']);}logger[_0x7abf('0x10')](_0x7abf('0xc'),_0x41be78,_0x5624a1[_0x7abf('0x10')][_0x7abf('0x11')]);return _0x3a045e(_0x5624a1[_0x7abf('0x10')][_0x7abf('0x11')]);}else{logger[_0x7abf('0xb')](_0x7abf('0xc'),_0x41be78,_0x7abf('0xd'));_0x3a045e(_0x5624a1[_0x7abf('0x12')][_0x7abf('0x11')]);}})['catch'](function(_0x1a8c57){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x41be78,_0x1a8c57);_0x4b1a1b(_0x1a8c57);});});} \ No newline at end of file +var _0xf988=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2d41dd,_0x12171f){var _0x1ca3c8=function(_0x4d0846){while(--_0x4d0846){_0x2d41dd['push'](_0x2d41dd['shift']());}};_0x1ca3c8(++_0x12171f);}(_0xf988,0xe0));var _0x8f98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf988[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x8f98('0x0'));var util=require(_0x8f98('0x1'));var moment=require(_0x8f98('0x2'));var BPromise=require(_0x8f98('0x3'));var rs=require(_0x8f98('0x4'));var fs=require('fs');var Redis=require(_0x8f98('0x5'));var db=require(_0x8f98('0x6'))['db'];var utils=require(_0x8f98('0x7'));var logger=require(_0x8f98('0x8'))(_0x8f98('0x9'));var config=require(_0x8f98('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8f98('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15c76d,_0x1f530a,_0x517b19){return new BPromise(function(_0x13bcfd,_0x5c3349){return client[_0x8f98('0xc')](_0x15c76d,_0x517b19)[_0x8f98('0xd')](function(_0x1fb42f){logger[_0x8f98('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f530a,_0x8f98('0xf'));logger[_0x8f98('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1f530a,_0x8f98('0xf'),JSON[_0x8f98('0x11')](_0x1fb42f));if(_0x1fb42f[_0x8f98('0x12')]){if(_0x1fb42f[_0x8f98('0x12')]['code']===0x1f4){logger[_0x8f98('0x12')](_0x8f98('0x13'),_0x1f530a,_0x1fb42f[_0x8f98('0x12')][_0x8f98('0x14')]);return _0x5c3349(_0x1fb42f['error']['message']);}logger[_0x8f98('0x12')](_0x8f98('0x13'),_0x1f530a,_0x1fb42f['error'][_0x8f98('0x14')]);return _0x13bcfd(_0x1fb42f[_0x8f98('0x12')][_0x8f98('0x14')]);}else{logger['info'](_0x8f98('0x13'),_0x1f530a,'request\x20sent');_0x13bcfd(_0x1fb42f[_0x8f98('0x15')]['message']);}})[_0x8f98('0x16')](function(_0x2d0795){logger[_0x8f98('0x12')](_0x8f98('0x13'),_0x1f530a,_0x2d0795);_0x5c3349(_0x2d0795);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 52c46cd..9a66aec 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 _0x5b20=['getResources','post','create','/:id/clone','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/sections','getSections','/:id/resources'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x5b20,0x86));var _0x05b2=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5b20[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var path=require(_0x05b2('0x2'));var timeout=require(_0x05b2('0x3'));var express=require(_0x05b2('0x4'));var router=express[_0x05b2('0x5')]();var fs_extra=require(_0x05b2('0x6'));var auth=require(_0x05b2('0x7'));var interaction=require(_0x05b2('0x8'));var config=require(_0x05b2('0x9'));var controller=require(_0x05b2('0xa'));router['get']('/',auth[_0x05b2('0xb')](),controller[_0x05b2('0xc')]);router['get'](_0x05b2('0xd'),auth[_0x05b2('0xb')](),controller[_0x05b2('0xe')]);router[_0x05b2('0xf')](_0x05b2('0x10'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x11')]);router[_0x05b2('0xf')](_0x05b2('0x12'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x13')]);router[_0x05b2('0xf')](_0x05b2('0x14'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x15')]);router[_0x05b2('0x16')]('/',auth['isAuthenticated'](),controller[_0x05b2('0x17')]);router[_0x05b2('0x16')](_0x05b2('0x18'),auth[_0x05b2('0xb')](),controller['clone']);router[_0x05b2('0x16')](_0x05b2('0x12'),auth[_0x05b2('0xb')](),controller['addSections']);router['post'](_0x05b2('0x14'),auth[_0x05b2('0xb')](),controller['addResources']);router['put'](_0x05b2('0x10'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x19')]);router[_0x05b2('0x1a')](_0x05b2('0x10'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x1b')]);router[_0x05b2('0x1a')](_0x05b2('0x12'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x1c')]);router[_0x05b2('0x1a')](_0x05b2('0x14'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x1d')]);module[_0x05b2('0x1e')]=router; \ No newline at end of file +var _0x746f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','update','destroy','delete','removeSections','removeResources','multer','util','path','connect-timeout'];(function(_0x1a2049,_0x28b774){var _0x5a2d07=function(_0x237c86){while(--_0x237c86){_0x1a2049['push'](_0x1a2049['shift']());}};_0x5a2d07(++_0x28b774);}(_0x746f,0x9c));var _0xf746=function(_0x49c207,_0x493e94){_0x49c207=_0x49c207-0x0;var _0x51f98a=_0x746f[_0x49c207];return _0x51f98a;};'use strict';var multer=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var path=require(_0xf746('0x2'));var timeout=require(_0xf746('0x3'));var express=require(_0xf746('0x4'));var router=express[_0xf746('0x5')]();var fs_extra=require(_0xf746('0x6'));var auth=require(_0xf746('0x7'));var interaction=require(_0xf746('0x8'));var config=require(_0xf746('0x9'));var controller=require(_0xf746('0xa'));router[_0xf746('0xb')]('/',auth[_0xf746('0xc')](),controller[_0xf746('0xd')]);router[_0xf746('0xb')](_0xf746('0xe'),auth[_0xf746('0xc')](),controller[_0xf746('0xf')]);router[_0xf746('0xb')](_0xf746('0x10'),auth[_0xf746('0xc')](),controller[_0xf746('0x11')]);router[_0xf746('0xb')](_0xf746('0x12'),auth[_0xf746('0xc')](),controller['getSections']);router[_0xf746('0xb')](_0xf746('0x13'),auth[_0xf746('0xc')](),controller['getResources']);router[_0xf746('0x14')]('/',auth['isAuthenticated'](),controller[_0xf746('0x15')]);router[_0xf746('0x14')](_0xf746('0x16'),auth[_0xf746('0xc')](),controller[_0xf746('0x17')]);router[_0xf746('0x14')]('/:id/sections',auth[_0xf746('0xc')](),controller[_0xf746('0x18')]);router[_0xf746('0x14')]('/:id/resources',auth[_0xf746('0xc')](),controller[_0xf746('0x19')]);router[_0xf746('0x1a')](_0xf746('0x10'),auth[_0xf746('0xc')](),controller[_0xf746('0x1b')]);router['delete'](_0xf746('0x10'),auth['isAuthenticated'](),controller[_0xf746('0x1c')]);router[_0xf746('0x1d')]('/:id/sections',auth[_0xf746('0xc')](),controller[_0xf746('0x1e')]);router[_0xf746('0x1d')](_0xf746('0x13'),auth[_0xf746('0xc')](),controller[_0xf746('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index fa0aaf8..a7cae46 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 _0x063c=['split','BOOLEAN','exports','STRING','name','setDataValue','join','crudPermissions'];(function(_0x3613a6,_0x15e8bd){var _0x113319=function(_0x37170e){while(--_0x37170e){_0x3613a6['push'](_0x3613a6['shift']());}};_0x113319(++_0x15e8bd);}(_0x063c,0xba));var _0xc063=function(_0x34148d,_0x21f607){_0x34148d=_0x34148d-0x0;var _0x195f8c=_0x063c[_0x34148d];return _0x195f8c;};'use strict';var Sequelize=require('sequelize');module[_0xc063('0x0')]={'name':{'type':Sequelize[_0xc063('0x1')],'allowNull':![],'unique':_0xc063('0x2')},'crudPermissions':{'type':Sequelize[_0xc063('0x1')],'set':function(_0x314f1b){this[_0xc063('0x3')]('crudPermissions',_0x314f1b?_0x314f1b[_0xc063('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0xc063('0x5'))[_0xc063('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc063('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc063('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc063('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xc063('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc063('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc063('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3070=['exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x21f3c3,_0x42e32c){var _0x15957=function(_0x271f01){while(--_0x271f01){_0x21f3c3['push'](_0x21f3c3['shift']());}};_0x15957(++_0x42e32c);}(_0x3070,0x75));var _0x0307=function(_0x16212d,_0x549576){_0x16212d=_0x16212d-0x0;var _0x16b6f8=_0x3070[_0x16212d];return _0x16b6f8;};'use strict';var Sequelize=require('sequelize');module[_0x0307('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0307('0x1')},'crudPermissions':{'type':Sequelize[_0x0307('0x2')],'set':function(_0x18cd2a){this[_0x0307('0x3')](_0x0307('0x4'),_0x18cd2a?_0x18cd2a[_0x0307('0x5')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x0307('0x6')](_0x0307('0x4'))[_0x0307('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0307('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0307('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0307('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x0307('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0307('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0307('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0307('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 6f96a44..29ad820 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 _0xfe9b=['Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','contexts','VoiceMail','voicerecordings','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','teams','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','scheduler','Schedule','Sound','templates','Template','triggers','Trunk','variables','Variable','plugins','Plugin','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','UserId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','rows','show','includeAll','options','catch','create','body','clone','params','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','findAll','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','transaction','each','removeSections','ids','getSections','enabled','isEmpty','sectionId','includes','subsections','findOne','forEach','push','resourceId','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','ignore','all','order','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','Agents','openTabs','chat','dataValues','fax','mail','openchannel','whatsapp','toUpperCase','slice','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','OpenTabs','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','JscriptyProject','contacts'];(function(_0x4f283a,_0x1495c1){var _0x2e81fa=function(_0x20efef){while(--_0x20efef){_0x4f283a['push'](_0x4f283a['shift']());}};_0x2e81fa(++_0x1495c1);}(_0xfe9b,0x159));var _0xbfe9=function(_0x25eb5e,_0x161649){_0x25eb5e=_0x25eb5e-0x0;var _0xa6b70e=_0xfe9b[_0x25eb5e];return _0xa6b70e;};'use strict';var emlformat=require(_0xbfe9('0x0'));var rimraf=require(_0xbfe9('0x1'));var zipdir=require(_0xbfe9('0x2'));var jsonpatch=require(_0xbfe9('0x3'));var rp=require(_0xbfe9('0x4'));var moment=require(_0xbfe9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfe9('0x6'));var util=require(_0xbfe9('0x7'));var path=require(_0xbfe9('0x8'));var sox=require(_0xbfe9('0x9'));var csv=require(_0xbfe9('0xa'));var ejs=require(_0xbfe9('0xb'));var fs=require('fs');var fs_extra=require(_0xbfe9('0xc'));var _=require(_0xbfe9('0xd'));var squel=require(_0xbfe9('0xe'));var crypto=require(_0xbfe9('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbfe9('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbfe9('0x11'));var Papa=require('papaparse');var Redis=require(_0xbfe9('0x12'));var authService=require(_0xbfe9('0x13'));var qs=require(_0xbfe9('0x14'));var as=require(_0xbfe9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfe9('0x16'))('api');var utils=require(_0xbfe9('0x17'));var config=require(_0xbfe9('0x18'));var licenseUtil=require(_0xbfe9('0x19'));var db=require(_0xbfe9('0x1a'))['db'];config[_0xbfe9('0x1b')]=_[_0xbfe9('0x1c')](config[_0xbfe9('0x1b')],{'host':_0xbfe9('0x1d'),'port':0x18eb});var socket=require(_0xbfe9('0x1e'))(new Redis(config[_0xbfe9('0x1b')]));require(_0xbfe9('0x1f'))[_0xbfe9('0x20')](socket);function respondWithStatusCode(_0x21fa85,_0x195958){_0x195958=_0x195958||0xcc;return function(_0x4faaa4){if(_0x4faaa4){return _0x21fa85[_0xbfe9('0x21')](_0x195958);}return _0x21fa85['status'](_0x195958)[_0xbfe9('0x22')]();};}function respondWithResult(_0x6de7f3,_0x5b398d){_0x5b398d=_0x5b398d||0xc8;return function(_0x3bd5fd){if(_0x3bd5fd){return _0x6de7f3[_0xbfe9('0x23')](_0x5b398d)[_0xbfe9('0x24')](_0x3bd5fd);}};}function respondWithFilteredResult(_0x279065,_0x349eee){return function(_0x1ab799){if(_0x1ab799){var _0x18c6f6=typeof _0x349eee[_0xbfe9('0x25')]===_0xbfe9('0x26')&&typeof _0x349eee['limit']===_0xbfe9('0x26');var _0x511859=_0x1ab799[_0xbfe9('0x27')];var _0xdcf55=_0x18c6f6?0x0:_0x349eee[_0xbfe9('0x25')];var _0x54e275=_0x18c6f6?_0x1ab799[_0xbfe9('0x27')]:_0x349eee[_0xbfe9('0x25')]+_0x349eee[_0xbfe9('0x28')];var _0x5791b9;if(_0x54e275>=_0x511859){_0x54e275=_0x511859;_0x5791b9=0xc8;}else{_0x5791b9=0xce;}_0x279065[_0xbfe9('0x23')](_0x5791b9);return _0x279065[_0xbfe9('0x29')](_0xbfe9('0x2a'),_0xdcf55+'-'+_0x54e275+'/'+_0x511859)[_0xbfe9('0x24')](_0x1ab799);}return null;};}function patchUpdates(_0x17a1af){return function(_0x16d49d){try{jsonpatch[_0xbfe9('0x2b')](_0x16d49d,_0x17a1af,!![]);}catch(_0x2b2a64){return BPromise[_0xbfe9('0x2c')](_0x2b2a64);}return _0x16d49d[_0xbfe9('0x2d')]();};}function saveUpdates(_0x2ded8c,_0x14d8a9){return function(_0x4d23a9){if(_0x4d23a9){return _0x4d23a9[_0xbfe9('0x2e')](_0x2ded8c)[_0xbfe9('0x2f')](function(_0x476ab7){return _0x476ab7;});}return null;};}function removeEntity(_0x16bd91,_0x199e60){return function(_0x4fa4f4){if(_0x4fa4f4){return _0x4fa4f4[_0xbfe9('0x30')]()['then'](function(){_0x16bd91['status'](0xcc)[_0xbfe9('0x22')]();});}};}function handleEntityNotFound(_0x393fee,_0x11f610){return function(_0xec5488){if(!_0xec5488){_0x393fee[_0xbfe9('0x21')](0x194);}return _0xec5488;};}function handleError(_0x19d6fa,_0x4345ac){_0x4345ac=_0x4345ac||0x1f4;return function(_0x1f0910){logger[_0xbfe9('0x31')](_0x1f0910[_0xbfe9('0x32')]);if(_0x1f0910[_0xbfe9('0x33')]){delete _0x1f0910['name'];}_0x19d6fa[_0xbfe9('0x23')](_0x4345ac)[_0xbfe9('0x34')](_0x1f0910);};}exports['index']=function(_0x5d011b,_0x4a7bd2){var _0x2538d0={},_0x4029c4={},_0x4ec70d={'count':0x0,'rows':[]};var _0x4967ed=_[_0xbfe9('0x35')](db[_0xbfe9('0x36')][_0xbfe9('0x37')],function(_0x1fff51){return{'name':_0x1fff51[_0xbfe9('0x38')],'type':_0x1fff51[_0xbfe9('0x39')][_0xbfe9('0x3a')]};});_0x4029c4['model']=_['map'](_0x4967ed,_0xbfe9('0x33'));_0x4029c4[_0xbfe9('0x3b')]=_[_0xbfe9('0x3c')](_0x5d011b[_0xbfe9('0x3b')]);_0x4029c4[_0xbfe9('0x3d')]=_[_0xbfe9('0x3e')](_0x4029c4[_0xbfe9('0x3f')],_0x4029c4[_0xbfe9('0x3b')]);_0x2538d0['attributes']=_['intersection'](_0x4029c4[_0xbfe9('0x3f')],qs[_0xbfe9('0x40')](_0x5d011b[_0xbfe9('0x3b')][_0xbfe9('0x40')]));_0x2538d0[_0xbfe9('0x41')]=_0x2538d0[_0xbfe9('0x41')][_0xbfe9('0x42')]?_0x2538d0[_0xbfe9('0x41')]:_0x4029c4[_0xbfe9('0x3f')];if(!_0x5d011b[_0xbfe9('0x3b')][_0xbfe9('0x43')](_0xbfe9('0x44'))){_0x2538d0[_0xbfe9('0x28')]=qs[_0xbfe9('0x28')](_0x5d011b[_0xbfe9('0x3b')][_0xbfe9('0x28')]);_0x2538d0['offset']=qs[_0xbfe9('0x25')](_0x5d011b[_0xbfe9('0x3b')][_0xbfe9('0x25')]);}_0x2538d0['order']=qs[_0xbfe9('0x45')](_0x5d011b[_0xbfe9('0x3b')][_0xbfe9('0x45')]);_0x2538d0[_0xbfe9('0x46')]=qs[_0xbfe9('0x3d')](_['pick'](_0x5d011b[_0xbfe9('0x3b')],_0x4029c4['filters']),_0x4967ed);if(_0x5d011b[_0xbfe9('0x3b')][_0xbfe9('0x47')]){_0x2538d0[_0xbfe9('0x46')]=_['merge'](_0x2538d0[_0xbfe9('0x46')],{'$or':_[_0xbfe9('0x35')](_0x4967ed,function(_0x5dcc54){if(_0x5dcc54[_0xbfe9('0x39')]!==_0xbfe9('0x48')){var _0x1dbcd8={};_0x1dbcd8[_0x5dcc54[_0xbfe9('0x33')]]={'$like':'%'+_0x5d011b[_0xbfe9('0x3b')]['filter']+'%'};return _0x1dbcd8;}})});}_0x2538d0=_[_0xbfe9('0x49')]({},_0x2538d0,_0x5d011b['options']);var _0x3735a7={'where':_0x2538d0[_0xbfe9('0x46')]};return db[_0xbfe9('0x36')][_0xbfe9('0x27')](_0x3735a7)[_0xbfe9('0x2f')](function(_0x297b09){_0x4ec70d['count']=_0x297b09;if(_0x5d011b[_0xbfe9('0x3b')]['includeAll']){_0x2538d0[_0xbfe9('0x4a')]=[{'all':!![]}];}return db[_0xbfe9('0x36')]['findAll'](_0x2538d0);})['then'](function(_0x4b478a){_0x4ec70d[_0xbfe9('0x4b')]=_0x4b478a;return _0x4ec70d;})[_0xbfe9('0x2f')](respondWithFilteredResult(_0x4a7bd2,_0x2538d0))['catch'](handleError(_0x4a7bd2,null));};exports[_0xbfe9('0x4c')]=function(_0x3912e4,_0x40971d){var _0x589bcd={'raw':![],'where':{'id':_0x3912e4['params']['id']}},_0x48724f={};_0x48724f['model']=_['keys'](db[_0xbfe9('0x36')][_0xbfe9('0x37')]);_0x48724f['query']=_[_0xbfe9('0x3c')](_0x3912e4[_0xbfe9('0x3b')]);_0x48724f[_0xbfe9('0x3d')]=_[_0xbfe9('0x3e')](_0x48724f[_0xbfe9('0x3f')],_0x48724f['query']);_0x589bcd['attributes']=_[_0xbfe9('0x3e')](_0x48724f[_0xbfe9('0x3f')],qs['fields'](_0x3912e4[_0xbfe9('0x3b')][_0xbfe9('0x40')]));_0x589bcd[_0xbfe9('0x41')]=_0x589bcd['attributes'][_0xbfe9('0x42')]?_0x589bcd['attributes']:_0x48724f[_0xbfe9('0x3f')];if(_0x3912e4[_0xbfe9('0x3b')][_0xbfe9('0x4d')]){_0x589bcd['include']=[{'all':!![]}];}_0x589bcd=_['merge']({},_0x589bcd,_0x3912e4[_0xbfe9('0x4e')]);return db[_0xbfe9('0x36')]['find'](_0x589bcd)[_0xbfe9('0x2f')](handleEntityNotFound(_0x40971d,null))[_0xbfe9('0x2f')](respondWithResult(_0x40971d,null))[_0xbfe9('0x4f')](handleError(_0x40971d,null));};exports['create']=function(_0x1e70c4,_0x185a90){return db[_0xbfe9('0x36')][_0xbfe9('0x50')](_0x1e70c4[_0xbfe9('0x51')],{})[_0xbfe9('0x2f')](respondWithResult(_0x185a90,0xc9))[_0xbfe9('0x4f')](handleError(_0x185a90,null));};exports[_0xbfe9('0x52')]=function(_0x2d6ea2,_0x4328e1){var _0x3fe868={'where':{'id':_0x2d6ea2[_0xbfe9('0x53')]['id']}},_0x29d149={};_0x29d149[_0xbfe9('0x3f')]=_[_0xbfe9('0x3c')](db[_0xbfe9('0x36')][_0xbfe9('0x37')]);_0x3fe868[_0xbfe9('0x41')]=_['intersection'](_0x29d149['model'],qs[_0xbfe9('0x40')](_0x2d6ea2['query']['fields']));_0x3fe868[_0xbfe9('0x41')]=_0x3fe868[_0xbfe9('0x41')][_0xbfe9('0x42')]?_0x3fe868[_0xbfe9('0x41')]:_0x29d149['model'];if(_0x2d6ea2[_0xbfe9('0x3b')][_0xbfe9('0x4d')]){_0x3fe868[_0xbfe9('0x4a')]=[{'all':!![]}];}_0x3fe868=_['merge']({},_0x3fe868,_0x2d6ea2[_0xbfe9('0x4e')]);return db[_0xbfe9('0x36')][_0xbfe9('0x54')](_0x3fe868)[_0xbfe9('0x2f')](handleEntityNotFound(_0x4328e1,null))[_0xbfe9('0x2f')](function(_0x31ea32){if(_0x31ea32){var _0x1bca86=_0x31ea32[_0xbfe9('0x55')]({'plain':!![]});_0x1bca86=qs[_0xbfe9('0x56')](_0x1bca86,['id',_0xbfe9('0x57'),_0xbfe9('0x58'),_0xbfe9('0x59')]);_0x2d6ea2[_0xbfe9('0x51')]=_[_0xbfe9('0x56')](_0x2d6ea2['body'],['id','createdAt',_0xbfe9('0x58')]);return db[_0xbfe9('0x5a')]['transaction'](function(_0x4bde37){return db[_0xbfe9('0x36')]['create'](_[_0xbfe9('0x49')](_0x1bca86,_0x2d6ea2[_0xbfe9('0x51')]),{'include':_0x2d6ea2['query'][_0xbfe9('0x4d')]?[{'all':!![]}]:undefined,'transaction':_0x4bde37})[_0xbfe9('0x2f')](function(_0x1332be){var _0x221ef2=_0x1332be[_0xbfe9('0x55')]({'plain':!![]});return db[_0xbfe9('0x5b')][_0xbfe9('0x5c')]({'where':{'userProfileId':_0x2d6ea2['params']['id']},'raw':!![]})[_0xbfe9('0x2f')](function(_0x354dc1){if(_0x354dc1){return BPromise['each'](_0x354dc1,function(_0x296f1e){return new BPromise(function(_0x22a0a7,_0x346461){if(_0x296f1e[_0xbfe9('0x5d')]===null||_0x296f1e[_0xbfe9('0x5d')]===0x1)_0x22a0a7(null);return db[_0xbfe9('0x5e')][_0xbfe9('0x5c')]({'where':{'sectionId':_0x296f1e['id']},'raw':!![]})[_0xbfe9('0x2f')](function(_0x38f7fe){var _0x27f6ca=_['map'](_0x38f7fe,function(_0x46533f){return qs[_0xbfe9('0x56')](_0x46533f,['id',_0xbfe9('0x57'),_0xbfe9('0x58'),'sectionId']);});_0x22a0a7(_0x27f6ca);})[_0xbfe9('0x4f')](function(_0x41a5e7){_0x346461(_0x41a5e7);});})[_0xbfe9('0x2f')](function(_0x44dc9f){var _0x3ecc2a=qs[_0xbfe9('0x56')](_0x296f1e,['id','createdAt',_0xbfe9('0x58')]);_0x3ecc2a[_0xbfe9('0x5f')]=_0x221ef2['id'];if(_0x44dc9f)_0x3ecc2a[_0xbfe9('0x60')]=_0x44dc9f;return _0x3ecc2a;})[_0xbfe9('0x2f')](function(_0x654418){return db['UserProfileSection'][_0xbfe9('0x50')](_0x654418,{'include':[{'model':db[_0xbfe9('0x5e')],'as':'Resources'}],'raw':!![],'transaction':_0x4bde37});});})[_0xbfe9('0x2f')](function(){return _0x221ef2;});}});});});}})['then'](respondWithResult(_0x4328e1,0xc9))[_0xbfe9('0x4f')](handleError(_0x4328e1,null));};exports['update']=function(_0x66d6a2,_0x5580f4){if(_0x66d6a2[_0xbfe9('0x51')]['id']){delete _0x66d6a2['body']['id'];}return db[_0xbfe9('0x36')][_0xbfe9('0x54')]({'where':{'id':_0x66d6a2[_0xbfe9('0x53')]['id']}})[_0xbfe9('0x2f')](handleEntityNotFound(_0x5580f4,null))[_0xbfe9('0x2f')](saveUpdates(_0x66d6a2[_0xbfe9('0x51')],null))[_0xbfe9('0x2f')](respondWithResult(_0x5580f4,null))[_0xbfe9('0x4f')](handleError(_0x5580f4,null));};exports['destroy']=function(_0x29d224,_0x3caba3){return db[_0xbfe9('0x36')]['find']({'where':{'id':_0x29d224['params']['id']}})[_0xbfe9('0x2f')](handleEntityNotFound(_0x3caba3,null))['then'](removeEntity(_0x3caba3,null))[_0xbfe9('0x4f')](handleError(_0x3caba3,null));};exports[_0xbfe9('0x61')]=function(_0x15ebc3,_0x38fd53){return db[_0xbfe9('0x36')]['describe']()[_0xbfe9('0x2f')](respondWithResult(_0x38fd53,null))['catch'](handleError(_0x38fd53,null));};exports[_0xbfe9('0x62')]=function(_0x4a7e18,_0x5ec9af){var _0x328410=_0x4a7e18['body'];return db[_0xbfe9('0x36')][_0xbfe9('0x54')]({'where':{'id':_0x4a7e18[_0xbfe9('0x53')]['id']}})[_0xbfe9('0x2f')](handleEntityNotFound(_0x5ec9af,null))[_0xbfe9('0x2f')](function(_0x23f56a){if(_0x23f56a){return db[_0xbfe9('0x5a')][_0xbfe9('0x63')](function(_0xb86ad6){return db[_0xbfe9('0x5b')]['destroy']({'where':{'userProfileId':_0x4a7e18[_0xbfe9('0x53')]['id'],'sectionId':_[_0xbfe9('0x35')](_0x328410,function(_0x2da18f){return _0x2da18f['sectionId'];})},'transaction':_0xb86ad6})[_0xbfe9('0x2f')](function(){var _0x55f4b4=_[_0xbfe9('0x35')](_0x328410,function(_0x48fef4){_0x48fef4[_0xbfe9('0x5f')]=_0x4a7e18[_0xbfe9('0x53')]['id'];return _0x48fef4;});var _0x485585=[];return BPromise[_0xbfe9('0x64')](_0x55f4b4,function(_0x4f90c0){return db['UserProfileSection'][_0xbfe9('0x50')](_0x4f90c0,{'include':[{'model':db[_0xbfe9('0x5e')],'as':'Resources'}],'raw':!![],'transaction':_0xb86ad6})[_0xbfe9('0x2f')](function(_0x3361db){_0x485585['push'](_0x3361db[_0xbfe9('0x55')]({'plain':!![]}));});})[_0xbfe9('0x2f')](function(){return _0x485585;});});});}})[_0xbfe9('0x2f')](function(_0x11a98a){return _0x11a98a;})[_0xbfe9('0x2f')](respondWithResult(_0x5ec9af,null))[_0xbfe9('0x4f')](handleError(_0x5ec9af,null));};exports[_0xbfe9('0x65')]=function(_0x1fa7eb,_0x22372f){var _0x31084f;return db[_0xbfe9('0x36')]['find']({'where':{'id':_0x1fa7eb[_0xbfe9('0x53')]['id']},'attributes':['id','name']})[_0xbfe9('0x2f')](handleEntityNotFound(_0x22372f,null))[_0xbfe9('0x2f')](function(_0x4d0aac){if(_0x4d0aac){_0x31084f=_0x4d0aac;return db[_0xbfe9('0x5b')][_0xbfe9('0x30')]({'where':{'userProfileId':_0x1fa7eb['params']['id'],'sectionId':_0x1fa7eb[_0xbfe9('0x3b')][_0xbfe9('0x66')]}});}})[_0xbfe9('0x2f')](function(){return _0x31084f;})[_0xbfe9('0x2f')](respondWithStatusCode(_0x22372f,null))[_0xbfe9('0x4f')](handleError(_0x22372f,null));};exports[_0xbfe9('0x67')]=function(_0x31a0b4,_0x6183e3){var _0x526616=[];var _0x1c7fd0=[];return db[_0xbfe9('0x5b')][_0xbfe9('0x5c')]({'where':{'userProfileId':_0x31a0b4[_0xbfe9('0x53')]['id']},'raw':!![]})[_0xbfe9('0x2f')](function(_0x13db4d){_0x526616=_[_0xbfe9('0x47')](_0x13db4d,function(_0x54da5d){return _0x54da5d[_0xbfe9('0x68')]===0x1||_['includes']([0x3eb,0x709],_0x54da5d['sectionId']);});if(!_[_0xbfe9('0x69')](_0x526616)){return _[_0xbfe9('0x35')](_0x526616,function(_0x4f0a18){return _0x4f0a18[_0xbfe9('0x6a')];});}else{return;}})[_0xbfe9('0x2f')](function(_0x4e6f85){if(_0x4e6f85)_0x1c7fd0=_0x4e6f85;if(_[_0xbfe9('0x6b')](_0x1c7fd0,0x64)){var _0x524532=_['find'](_0x526616,{'sectionId':0x64});return hasDefaultDashboard(_0x524532)[_0xbfe9('0x2f')](function(_0x24f30c){return _[_0xbfe9('0x35')](_0x526616,function(_0x4b7f97){if(_0x4b7f97[_0xbfe9('0x6a')]===0x64){_0x4b7f97[_0xbfe9('0x6c')]=_0x24f30c;}return _0x4b7f97;});});}else{return;}})[_0xbfe9('0x2f')](function(_0x4d5895){if(_0x4d5895)_0x526616=_0x4d5895;if(_[_0xbfe9('0x6b')](_0x1c7fd0,0x3eb)){var _0xb43a8c=_[_0xbfe9('0x54')](_0x526616,{'sectionId':0x3eb});return getCustomDashboards(_0xb43a8c)[_0xbfe9('0x2f')](function(_0x28df43){return _['map'](_0x526616,function(_0x34f163){if(_0xb43a8c[_0xbfe9('0x68')]){if(_0x34f163[_0xbfe9('0x6a')]===0x3eb){_0x34f163['subsections']=_0x28df43;}}else{if(_0x34f163[_0xbfe9('0x6a')]===0x64){_0x34f163['subsections']=_0x28df43;}}return _0x34f163;});});}else{return;}})[_0xbfe9('0x2f')](function(_0x50ca2){if(_0x50ca2)_0x526616=_0x50ca2;if(_[_0xbfe9('0x6b')](_0x1c7fd0,0x709)){var _0x559eec=_[_0xbfe9('0x54')](_0x526616,{'sectionId':0x709});return getPlugins(_0x559eec)[_0xbfe9('0x2f')](function(_0x27eb22){if(_0x559eec[_0xbfe9('0x68')]){return _[_0xbfe9('0x35')](_0x526616,function(_0x431825){if(_0x431825[_0xbfe9('0x6a')]===0x709){_0x431825[_0xbfe9('0x6c')]=_0x27eb22;}return _0x431825;});}else{var _0x532bb9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x27eb22};var _0x365218=_['map'](_0x526616);_0x365218['push'](_0x532bb9);return _0x365218;}});}else{return;}})[_0xbfe9('0x2f')](function(_0x2dce06){if(_0x2dce06)_0x526616=_0x2dce06;return _[_0xbfe9('0x47')](_0x526616,['enabled',0x1]);})['then'](respondWithResult(_0x6183e3,null))[_0xbfe9('0x4f')](handleError(_0x6183e3,null));};function hasDefaultDashboard(_0x2b17cf){var _0x1372a6=[0x65];return new BPromise(function(_0x2db760,_0x100168){try{if(_0x2b17cf[_0xbfe9('0x5d')]){_0x2db760(_0x1372a6);}else{return db[_0xbfe9('0x5e')][_0xbfe9('0x6d')]({'where':{'sectionId':_0x2b17cf['id']},'raw':!![]})['then'](function(_0x22fff5){_0x22fff5?_0x2db760(_0x1372a6):_0x2db760();});}}catch(_0x26e3af){_0x100168(_0x26e3af);}});}function getCustomDashboards(_0x432a90){var _0x328206=[];return new BPromise(function(_0x280cfb,_0x194136){try{if(_0x432a90[_0xbfe9('0x5d')]){return db['Dashboard'][_0xbfe9('0x5c')]({'raw':!![]})[_0xbfe9('0x2f')](function(_0x4fae54){_0x4fae54[_0xbfe9('0x6e')](function(_0x3b82a9){_0x328206[_0xbfe9('0x6f')](_0x3b82a9['id']+0x1869f);});_0x280cfb(_0x328206);});}else{return db[_0xbfe9('0x5e')][_0xbfe9('0x5c')]({'where':{'sectionId':_0x432a90['id']},'raw':!![]})[_0xbfe9('0x2f')](function(_0x23885f){_0x23885f[_0xbfe9('0x6e')](function(_0x3a40a3){_0x328206[_0xbfe9('0x6f')](_0x3a40a3['resourceId']+0x1869f);});_0x280cfb(_0x328206);});}}catch(_0x42fe3e){_0x194136(_0x42fe3e);}});}function getPlugins(_0x31f47e){var _0x202c17=[];return new BPromise(function(_0x48adb8,_0x2d0ddc){try{if(_0x31f47e['autoAssociation']){return db['Plugin'][_0xbfe9('0x5c')]({'raw':!![]})[_0xbfe9('0x2f')](function(_0x1ddb52){_0x1ddb52[_0xbfe9('0x6e')](function(_0x23c45e){_0x202c17[_0xbfe9('0x6f')](_0x23c45e['id']+0x15b38);});_0x48adb8(_0x202c17);});}else{return db[_0xbfe9('0x5e')][_0xbfe9('0x5c')]({'where':{'sectionId':_0x31f47e['id']},'raw':!![]})[_0xbfe9('0x2f')](function(_0x213c58){_0x213c58[_0xbfe9('0x6e')](function(_0x4c0e18){_0x202c17[_0xbfe9('0x6f')](_0x4c0e18[_0xbfe9('0x70')]+0x15b38);});_0x48adb8(_0x202c17);});}}catch(_0x25db3d){_0x2d0ddc(_0x25db3d);}});}exports[_0xbfe9('0x71')]=function(_0x244923,_0x4e6d2e){return db[_0xbfe9('0x36')]['find']({'where':{'id':_0x244923['params']['id']}})[_0xbfe9('0x2f')](handleEntityNotFound(_0x4e6d2e,null))[_0xbfe9('0x2f')](function(_0x25658b){if(_0x25658b){return db['sequelize']['transaction'](function(_0x1a7610){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x244923[_0xbfe9('0x53')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3a2016){if(_0x3a2016){return db[_0xbfe9('0x5b')][_0xbfe9('0x30')]({'where':{'userProfileId':_0x244923[_0xbfe9('0x53')]['id'],'id':_[_0xbfe9('0x35')](_0x3a2016,function(_0x54230e){return _0x54230e['id'];})},'transaction':_0x1a7610});}})['then'](function(_0x43d91f){var _0x57eb17=_[_0xbfe9('0x35')](_0x244923[_0xbfe9('0x51')],function(_0x177dea){_0x177dea[_0xbfe9('0x5f')]=_0x244923['params']['id'];return _0x177dea;});return db[_0xbfe9('0x5b')]['bulkCreate'](_0x57eb17,{'raw':!![],'transaction':_0x1a7610});})[_0xbfe9('0x2f')](function(_0x41def2){var _0xea30fb=_[_0xbfe9('0x47')](_['map'](_0x41def2,function(_0x10aa75){return _0x10aa75['get']({'plain':!![]});}),{'includeAll':![]});if(_0xea30fb){return db['UserProfileSection'][_0xbfe9('0x5c')]({'where':{'userProfileId':_0x244923['params']['id'],'sectionId':_['map'](_0xea30fb,function(_0x14b58f){return _0x14b58f[_0xbfe9('0x6a')];})},'attributes':['id',_0xbfe9('0x6a')],'raw':!![]})['then'](function(_0x1d9cc0){var _0x3a6f43=_[_0xbfe9('0x35')](_0x244923[_0xbfe9('0x51')],function(_0x32ae1e){_0x32ae1e[_0xbfe9('0x5f')]=_0x244923['params']['id'];return _0x32ae1e;});return db['UserProfileResource'][_0xbfe9('0x72')](_0x3a6f43,{'raw':!![],'transaction':_0x1a7610});});}})['catch'](handleError(_0x4e6d2e,null));});}})[_0xbfe9('0x2f')](function(_0x4a1485){var _0x2de861=_[_0xbfe9('0x35')](_0x4a1485,function(_0x1d225c){return _0x1d225c[_0xbfe9('0x55')]({'plain':!![]});});})['then'](respondWithResult(_0x4e6d2e,null))[_0xbfe9('0x4f')](handleError(_0x4e6d2e,null));};exports[_0xbfe9('0x73')]=function(_0x24641b,_0x4f544a,_0xe892fd){return db[_0xbfe9('0x36')]['find']({'where':{'id':_0x24641b[_0xbfe9('0x53')]['id']}})['then'](handleEntityNotFound(_0x4f544a,null))[_0xbfe9('0x2f')](function(_0x4502eb){if(_0x4502eb){return _0x4502eb[_0xbfe9('0x73')](_0x24641b[_0xbfe9('0x3b')][_0xbfe9('0x66')]);}})[_0xbfe9('0x2f')](respondWithStatusCode(_0x4f544a,null))['catch'](handleError(_0x4f544a,null));};exports[_0xbfe9('0x74')]=function(_0x3bd703,_0x308d12){var _0x4bada4={'raw':![],'where':{}};var _0x325a65={};var _0x4aa7d1={'count':0x0,'rows':[]};var _0x362caf=_0x3bd703['query'][_0xbfe9('0x75')];if(typeof _0x362caf===_0xbfe9('0x26')){throw new db[(_0xbfe9('0x76'))][(_0xbfe9('0x77'))](_0xbfe9('0x78'));}var _0x57b716=_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x79')]||![];var _0x4916f2=getQueryModels(_0x362caf,_0x57b716);if(typeof _0x4916f2[_0xbfe9('0x7a')]===_0xbfe9('0x26')){throw new db[(_0xbfe9('0x76'))][(_0xbfe9('0x77'))](_0xbfe9('0x7b')+_0x362caf+'\x27');}var _0x2ad5cc=[];if(!_[_0xbfe9('0x69')](_0x4916f2['parentSections'])){_0x2ad5cc=_0x4916f2[_0xbfe9('0x7c')];}else{_0x2ad5cc=[{'name':_0x362caf}];}return db[_0xbfe9('0x36')][_0xbfe9('0x6d')]({'where':{'id':_0x3bd703['params']['id']}})[_0xbfe9('0x2f')](handleEntityNotFound(_0x308d12,null))[_0xbfe9('0x2f')](function(_0x5eb1d8){if(_0x5eb1d8){var _0x2b9671=[];for(var _0x5d9cef=0x0;_0x5d9cef<_0x2ad5cc['length'];_0x5d9cef++){_0x2b9671[_0xbfe9('0x6f')](db[_0xbfe9('0x5b')]['findOne']({'where':{'userProfileId':_0x5eb1d8['id'],'name':_0x2ad5cc[_0x5d9cef][_0xbfe9('0x33')]},'raw':!![]}));}return BPromise['all'](_0x2b9671);}})['then'](function(_0x5bd038){var _0x13ccec=_[_0xbfe9('0x47')](_0x5bd038,function(_0x7557ed){return _0x7557ed?_0x7557ed:undefined;});var _0x3ff2a7=_[_0xbfe9('0x47')](_0x2ad5cc,[_0xbfe9('0x7d'),!![]]);var _0x50ba7f=_[_0xbfe9('0x69')](_0x13ccec)&&_[_0xbfe9('0x69')](_0x3ff2a7)?null:_['union'](_0x3ff2a7,_0x13ccec);if(_0x50ba7f){var _0x32d5b1=[];for(var _0x2c4dff=0x0;_0x2c4dff<_0x50ba7f[_0xbfe9('0x42')];_0x2c4dff++){var _0x532d8e=_['find'](_0x2ad5cc,function(_0x3c995a){return _0x50ba7f[_0x2c4dff]?_0x3c995a[_0xbfe9('0x33')]===_0x50ba7f[_0x2c4dff][_0xbfe9('0x33')]:null;});if(_0x532d8e){if(_0x50ba7f[_0x2c4dff][_0xbfe9('0x7d')]){_0x32d5b1[_0xbfe9('0x6f')](getAllResources(_0x4916f2['childModel'],_0x50ba7f[_0x2c4dff]));}else{if(!_0x50ba7f[_0x2c4dff][_0xbfe9('0x5d')]){_0x32d5b1['push'](getAllowedResources(_0x532d8e,_0x50ba7f[_0x2c4dff],_0x4916f2[_0xbfe9('0x7a')]));}else{if(_0x532d8e[_0xbfe9('0x3f')]){_0x32d5b1[_0xbfe9('0x6f')](getAllFilteredResources(_0x532d8e,_0x50ba7f[_0x2c4dff]));}}}}}return BPromise[_0xbfe9('0x7e')](_0x32d5b1);}else{return null;}})[_0xbfe9('0x2f')](function(_0x1ec76a){var _0x122905=_0x1ec76a;var _0xc36dd5=null;if(_0x122905){_0xc36dd5=_0x122905[_0xbfe9('0x42')]===0x1?_0x122905[0x0]:null;}if(_0xc36dd5||_0x122905){var _0x272c04=db[_0x4916f2[_0xbfe9('0x7a')]][_0xbfe9('0x37')];_0x325a65[_0xbfe9('0x3f')]=_[_0xbfe9('0x3c')](_0x272c04);_0x325a65[_0xbfe9('0x3b')]=_[_0xbfe9('0x3c')](_0x3bd703[_0xbfe9('0x3b')]);_0x325a65[_0xbfe9('0x3d')]=_[_0xbfe9('0x3e')](_0x325a65[_0xbfe9('0x3f')],_0x325a65[_0xbfe9('0x3b')]);_0x4bada4[_0xbfe9('0x41')]=_[_0xbfe9('0x3e')](_0x325a65['model'],qs[_0xbfe9('0x40')](_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x40')]));_0x4bada4[_0xbfe9('0x41')]=_0x4bada4['attributes'][_0xbfe9('0x42')]?_0x4bada4[_0xbfe9('0x41')]:_0x325a65[_0xbfe9('0x3f')];if(!_0x3bd703[_0xbfe9('0x3b')]['hasOwnProperty'](_0xbfe9('0x44'))){_0x4bada4[_0xbfe9('0x28')]=qs[_0xbfe9('0x28')](_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x28')]);_0x4bada4[_0xbfe9('0x25')]=qs[_0xbfe9('0x25')](_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x25')]);}_0x4bada4[_0xbfe9('0x7f')]=qs[_0xbfe9('0x45')](_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x45')]);_0x4bada4[_0xbfe9('0x46')]=qs[_0xbfe9('0x3d')](_[_0xbfe9('0x80')](_0x3bd703[_0xbfe9('0x3b')],_0x325a65['filters']));if(_0x3bd703['query'][_0xbfe9('0x47')]){_0x4bada4[_0xbfe9('0x46')]=_[_0xbfe9('0x49')](_0x4bada4['where'],{'$or':_[_0xbfe9('0x35')](_0x272c04,function(_0xea60ba){if(_0xea60ba[_0xbfe9('0x39')]['key']!==_0xbfe9('0x48')){var _0x1d2908={};_0x1d2908[_0xea60ba[_0xbfe9('0x81')]]={'$like':'%'+_0x3bd703[_0xbfe9('0x3b')]['filter']+'%'};return _0x1d2908;}})});}var _0xb9ad62=[];if(_0xc36dd5){var _0x41acd5=_[_0xbfe9('0x54')](_0x2ad5cc,['name',_0xc36dd5[_0xbfe9('0x33')]]);if(_0x41acd5[_0xbfe9('0x81')]){var _0xd6e42={};if(_0x4916f2[_0xbfe9('0x7a')]===_0xbfe9('0x82')){_0xd6e42[_0x41acd5[_0xbfe9('0x83')]]=_[_0xbfe9('0x35')](_0xc36dd5['associatedResources'],'id');}else{_0xd6e42[_0x41acd5[_0xbfe9('0x83')]]=_0xc36dd5['associatedResources'];}_0xb9ad62[_0xbfe9('0x6f')](_0xd6e42);}else{_0x4bada4['where']['id']=_0xc36dd5[_0xbfe9('0x84')];}}else{for(var _0x4b9673=0x0;_0x4b9673<_0x122905[_0xbfe9('0x42')];_0x4b9673++){var _0x41acd5=_['find'](_0x2ad5cc,[_0xbfe9('0x33'),_0x122905[_0x4b9673][_0xbfe9('0x33')]]);if(_0x41acd5['field']){var _0xd6e42={};_0xd6e42[_0x41acd5[_0xbfe9('0x83')]]=_0x122905[_0x4b9673][_0xbfe9('0x84')];_0xb9ad62[_0xbfe9('0x6f')](_0xd6e42);}else{if(!_0x4bada4['where']['id'])_0x4bada4['where']['id']=[];_0x122905[_0x4b9673][_0xbfe9('0x84')][_0xbfe9('0x6e')](function(_0x420eb1){_0x4bada4[_0xbfe9('0x46')]['id'][_0xbfe9('0x6f')](_0x420eb1);});}}}if(!_[_0xbfe9('0x69')](_0xb9ad62)){_0x4bada4[_0xbfe9('0x46')]=_['merge'](_0x4bada4[_0xbfe9('0x46')],{'$and':{'$or':_0xb9ad62}});}_0x4bada4=_[_0xbfe9('0x49')]({},_0x4bada4,_0x3bd703[_0xbfe9('0x4e')]);if(_0xc36dd5&&!_0xc36dd5[_0xbfe9('0x5d')]&&_0x4916f2[_0xbfe9('0x7a')]===_0xbfe9('0x82')){if(_0x3bd703[_0xbfe9('0x3b')]['includeAll']){_0x4bada4[_0xbfe9('0x4a')]=[{'all':!![]}];}return db[_0x4916f2[_0xbfe9('0x7a')]][_0xbfe9('0x5c')](_0x4bada4)[_0xbfe9('0x2f')](function(_0x2ba0a0){var _0x44d42d=[];_0x2ba0a0['forEach'](function(_0x40dfe3){var _0x1d6dea;switch(_0x40dfe3['reportType']){case'default':_0x1d6dea=_[_0xbfe9('0x54')](_0xc36dd5[_0xbfe9('0x84')],function(_0x2d56e2){return _0x2d56e2['id']===_0x40dfe3[_0xbfe9('0x85')]&&_0x2d56e2['type']===_0xbfe9('0x86');});break;case _0xbfe9('0x87'):_0x1d6dea=_['find'](_0xc36dd5['associatedResources'],function(_0x231623){return _0x231623['id']===_0x40dfe3[_0xbfe9('0x85')]&&_0x231623[_0xbfe9('0x39')]===_0xbfe9('0x88');});break;}if(_0x1d6dea)_0x44d42d[_0xbfe9('0x6f')](_0x40dfe3);});_0x4aa7d1[_0xbfe9('0x27')]=_0x44d42d['length'];_0x4aa7d1[_0xbfe9('0x4b')]=_0x44d42d;return _0x4aa7d1;});}else{return db[_0x4916f2[_0xbfe9('0x7a')]]['count']({'where':_0x4bada4[_0xbfe9('0x46')]})['then'](function(_0x1c6019){_0x4aa7d1[_0xbfe9('0x27')]=_0x1c6019;if(_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x4d')]){if(_0x4916f2[_0xbfe9('0x7a')]===_0xbfe9('0x89')){_0x4bada4['include']=[{'model':db[_0xbfe9('0x8a')],'as':_0xbfe9('0x8b'),'attributes':['id',_0xbfe9('0x33'),_0xbfe9('0x8c')],'required':_0x3bd703['query'][_0xbfe9('0x8d')]?!![]:![]},{'model':db[_0xbfe9('0x8a')],'as':_0xbfe9('0x8e'),'attributes':['id',_0xbfe9('0x33'),'color'],'through':_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x8d')]?{'attributes':[],'where':{'TagId':_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x8d')]||undefined}}:{},'required':_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x8d')]?!![]:![]}];}else{_0x4bada4[_0xbfe9('0x4a')]=[{'all':!![]}];}}return db[_0x4916f2[_0xbfe9('0x7a')]][_0xbfe9('0x5c')](_0x4bada4);})[_0xbfe9('0x2f')](function(_0x4af5b3){_0x4aa7d1[_0xbfe9('0x4b')]=_0x4af5b3;if(_0x362caf===_0xbfe9('0x8f')&&_0x3bd703[_0xbfe9('0x3b')][_0xbfe9('0x90')]==='true'){var _0x54cb8e=[];for(var _0x590032=0x0;_0x590032<_0x4aa7d1[_0xbfe9('0x4b')]['length'];_0x590032++){_0x54cb8e[_0xbfe9('0x6f')](getOpenTabs(_0xbfe9('0x91'),_0x4aa7d1[_0xbfe9('0x4b')][_0x590032]['dataValues']));_0x54cb8e[_0xbfe9('0x6f')](getOpenTabs('sms',_0x4aa7d1[_0xbfe9('0x4b')][_0x590032][_0xbfe9('0x92')]));_0x54cb8e[_0xbfe9('0x6f')](getOpenTabs(_0xbfe9('0x93'),_0x4aa7d1[_0xbfe9('0x4b')][_0x590032][_0xbfe9('0x92')]));_0x54cb8e[_0xbfe9('0x6f')](getOpenTabs(_0xbfe9('0x94'),_0x4aa7d1['rows'][_0x590032][_0xbfe9('0x92')]));_0x54cb8e[_0xbfe9('0x6f')](getOpenTabs(_0xbfe9('0x95'),_0x4aa7d1[_0xbfe9('0x4b')][_0x590032][_0xbfe9('0x92')]));_0x54cb8e['push'](getOpenTabs(_0xbfe9('0x96'),_0x4aa7d1[_0xbfe9('0x4b')][_0x590032]['dataValues']));}return Promise['all'](_0x54cb8e)['then'](function(){return _0x4aa7d1;});}return _0x4aa7d1;});}}else{return _0x4aa7d1;}})[_0xbfe9('0x2f')](respondWithFilteredResult(_0x308d12,_0x4bada4))[_0xbfe9('0x4f')](handleError(_0x308d12,null));};function getOpenTabs(_0x27713e,_0xdaf078){var _0x4dce90=_0x27713e['charAt'](0x0)[_0xbfe9('0x97')]()+_0x27713e[_0xbfe9('0x98')](0x1);var _0x37a22c={'type':db[_0xbfe9('0x76')][_0xbfe9('0x99')][_0xbfe9('0x9a')],'raw':!![]};return new BPromise(function(_0x1b3899,_0x19763c){var _0x4ec811=squel['select']()[_0xbfe9('0x81')](_0xbfe9('0x9b')+_0x4dce90+_0xbfe9('0x9c'),'id')[_0xbfe9('0x81')](_0xbfe9('0x9d'))[_0xbfe9('0x9e')](_0xbfe9('0x9f')+_0x27713e+_0xbfe9('0xa0'),'ui')[_0xbfe9('0x46')]('ui.UserId\x20=\x20?',_0xdaf078['id']);return db[_0xbfe9('0x5a')][_0xbfe9('0x3b')](_0x4ec811['toString'](),_0x37a22c)['then'](function(_0x814918){_0xdaf078[_0x4dce90+_0xbfe9('0xa1')]=_0x814918;_0x1b3899(_0x814918);})[_0xbfe9('0x4f')](function(_0x456243){_0x19763c(_0x456243);});});}function getAllResources(_0x5a1d3a,_0x45b4b4){return new BPromise(function(_0x222385,_0x3af5d4){if(_0x45b4b4){var _0x5bbb83=_0x45b4b4[_0xbfe9('0x47')]?{[_0x45b4b4[_0xbfe9('0x47')][_0xbfe9('0x81')]]:_0x45b4b4[_0xbfe9('0x47')][_0xbfe9('0xa2')]}:undefined;return db[_0x5a1d3a][_0xbfe9('0x5c')]({'where':_0x5bbb83,'raw':!![]})[_0xbfe9('0x2f')](function(_0x948c9b){_0x45b4b4[_0xbfe9('0x84')]=_[_0xbfe9('0x35')](_0x948c9b,'id');_0x222385(_0x45b4b4);})[_0xbfe9('0x4f')](function(_0x1f38dd){_0x3af5d4(_0x1f38dd);});}else{_0x222385(null);}});}function getAllFilteredResources(_0x3bb609,_0x71f113){return new BPromise(function(_0x1c622b,_0x2b726e){var _0x4d2f71=_0x3bb609[_0xbfe9('0x47')]?{[_0x3bb609[_0xbfe9('0x47')][_0xbfe9('0x81')]]:_0x3bb609[_0xbfe9('0x47')][_0xbfe9('0xa2')]}:undefined;return db[_0x3bb609[_0xbfe9('0x3f')]][_0xbfe9('0x5c')]({'where':_0x4d2f71,'raw':!![]})[_0xbfe9('0x2f')](function(_0x4a170f){_0x71f113[_0xbfe9('0x84')]=_[_0xbfe9('0x35')](_0x4a170f,function(_0x310f7c){return _0x3bb609['field']?_0x310f7c[_0x3bb609['field']]:_0x310f7c[_0xbfe9('0x33')];});_0x1c622b(_0x71f113);})[_0xbfe9('0x4f')](function(_0x3ba3b9){_0x2b726e(_0x3ba3b9);});});}function getAllowedResources(_0xf705ad,_0x39315e,_0x2cafa8){return new BPromise(function(_0xe8d691,_0x521915){if(_0x39315e){return db[_0xbfe9('0x5e')][_0xbfe9('0x5c')]({'where':{'sectionId':_0x39315e['id']},'raw':!![]})[_0xbfe9('0x2f')](function(_0x34bf72){if(_0xf705ad[_0xbfe9('0x81')]&&_0xf705ad[_0xbfe9('0x81')]!=='id'){_0x39315e['associatedResources']=_[_0xbfe9('0x35')](_0x34bf72,function(_0x4cd709){return _0x4cd709[_0xf705ad[_0xbfe9('0x81')]];});}else{if(_0x2cafa8===_0xbfe9('0x82')){_0x39315e[_0xbfe9('0x84')]=_[_0xbfe9('0x35')](_0x34bf72,function(_0x30a777){return{'id':_0x30a777[_0xbfe9('0x70')],'type':_0x30a777[_0xbfe9('0x39')]};});}else{_0x39315e[_0xbfe9('0x84')]=_[_0xbfe9('0x35')](_0x34bf72,function(_0x26582e){return _0x26582e['resourceId'];});}}_0xe8d691(_0x39315e);})['catch'](function(_0x3f0bde){_0x521915(_0x3f0bde);});}else{_0xe8d691(null);}});}function getQueryModels(_0x54ee1f,_0x4ce30e){var _0x3872e8=_0x54ee1f[_0xbfe9('0xa3')]();var _0x5ff606={'childModel':undefined,'parentSections':[]};switch(_0x3872e8){case _0xbfe9('0xa4'):_0x5ff606['childModel']=_0xbfe9('0xa5');break;case _0xbfe9('0xa6'):_0x5ff606['childModel']=_0xbfe9('0xa7');break;case _0xbfe9('0xa8'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xa9');_0x5ff606[_0xbfe9('0x7c')]=[{'name':'SquareProjects','field':_0xbfe9('0x33'),'foreignKey':_0xbfe9('0xaa')}];break;case'projects':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xab');break;case _0xbfe9('0xac'):_0x5ff606[_0xbfe9('0x7a')]='CmContact';_0x5ff606[_0xbfe9('0x7c')]=[{'name':_0xbfe9('0xad'),'field':'id','foreignKey':_0xbfe9('0xae')}];break;case _0xbfe9('0xaf'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xb0');break;case _0xbfe9('0xb1'):_0x5ff606['childModel']=_0xbfe9('0xb2');break;case _0xbfe9('0xb3'):_0x5ff606['childModel']=_0xbfe9('0xb4');break;case _0xbfe9('0xb5'):_0x5ff606[_0xbfe9('0x7a')]='ChatQueue';break;case'chatwebsites':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xb6');break;case _0xbfe9('0xb7'):_0x5ff606['childModel']=_0xbfe9('0xb8');break;case _0xbfe9('0xb9'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xba');break;case'inboundroutes':case _0xbfe9('0xbb'):case _0xbfe9('0xbc'):_0x5ff606[_0xbfe9('0x7a')]='VoiceExtension';break;case _0xbfe9('0xbd'):_0x5ff606[_0xbfe9('0x7a')]='VoiceContext';break;case'voicemails':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xbe');break;case _0xbfe9('0xbf'):_0x5ff606[_0xbfe9('0x7a')]='VoiceRecording';_0x5ff606[_0xbfe9('0x7c')]=[{'name':_0xbfe9('0x8f'),'field':_0xbfe9('0x33'),'foreignKey':_0xbfe9('0xc0'),'model':_0xbfe9('0xc1'),'filter':{'field':_0xbfe9('0xc2'),'value':[_0xbfe9('0xc3')]}},{'name':_0xbfe9('0xc4'),'field':_0xbfe9('0x33'),'foreignKey':_0xbfe9('0xc0'),'model':_0xbfe9('0xc1'),'filter':{'field':_0xbfe9('0xc2'),'value':[_0xbfe9('0xc5')]}},{'name':_0xbfe9('0xc6'),'field':'name','foreignKey':_0xbfe9('0xc7'),'model':_0xbfe9('0xc8'),'filter':{'field':_0xbfe9('0x39'),'value':[_0xbfe9('0xc9')]}},{'name':_0xbfe9('0xca'),'field':_0xbfe9('0x33'),'foreignKey':_0xbfe9('0xc7'),'model':_0xbfe9('0xc8'),'filter':{'field':_0xbfe9('0x39'),'value':['outbound']}}];break;case _0xbfe9('0xcb'):_0x5ff606[_0xbfe9('0x7a')]='VoiceMusicOnHold';break;case'chanspies':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xcc');break;case'voiceprefixes':_0x5ff606['childModel']=_0xbfe9('0xcd');break;case _0xbfe9('0xce'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xcf');break;case'mailqueues':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xd0');break;case _0xbfe9('0xd1'):_0x5ff606[_0xbfe9('0x7a')]='MailAccount';break;case _0xbfe9('0xd2'):_0x5ff606[_0xbfe9('0x7a')]='MailSubstatus';break;case _0xbfe9('0xd3'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xd4');break;case _0xbfe9('0xd5'):_0x5ff606[_0xbfe9('0x7a')]='OpenchannelAccount';break;case _0xbfe9('0xd6'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xd7');break;case _0xbfe9('0xd8'):_0x5ff606[_0xbfe9('0x7a')]='SmsAccount';break;case _0xbfe9('0xd9'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xda');break;case _0xbfe9('0xdb'):_0x5ff606['childModel']='Team';break;case _0xbfe9('0xdc'):case _0xbfe9('0xdd'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xc8');if(_0x4ce30e){_0x5ff606['parentSections']=[{'name':_0xbfe9('0xc6')},{'name':_0xbfe9('0xca')}];}break;case'users':case _0xbfe9('0xde'):case _0xbfe9('0xdf'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xc1');if(_0x4ce30e){_0x5ff606[_0xbfe9('0x7c')]=[{'name':_0xbfe9('0xe0'),'filter':{'field':_0xbfe9('0xc2'),'value':[_0xbfe9('0xe1'),_0xbfe9('0xe2')]},'ignore':!![]},{'name':'Agents'},{'name':_0xbfe9('0xc4')}];}break;case'zendeskaccounts':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xe3');break;case _0xbfe9('0xe4'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xe5');break;case _0xbfe9('0xe6'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xe7');break;case _0xbfe9('0xe8'):_0x5ff606[_0xbfe9('0x7a')]='SugarcrmAccount';break;case _0xbfe9('0xe9'):_0x5ff606['childModel']=_0xbfe9('0xea');break;case _0xbfe9('0xeb'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xec');break;case'vtigeraccounts':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xc1');break;case _0xbfe9('0xed'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xee');break;case _0xbfe9('0xef'):_0x5ff606['childModel']='Disposition';break;case _0xbfe9('0xf0'):_0x5ff606['childModel']=_0xbfe9('0xf1');break;case _0xbfe9('0xf2'):_0x5ff606['childModel']='Interval';break;case'pauses':_0x5ff606[_0xbfe9('0x7a')]='Pause';break;case _0xbfe9('0xf3'):_0x5ff606['childModel']=_0xbfe9('0xf4');break;case'sounds':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xf5');break;case'tags':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0x8a');break;case _0xbfe9('0xf6'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xf7');break;case _0xbfe9('0xf8'):_0x5ff606[_0xbfe9('0x7a')]='Trigger';break;case'trunks':_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xf9');break;case _0xbfe9('0xfa'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xfb');break;case _0xbfe9('0xfc'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xfd');break;case'extractedreports':_0x5ff606['childModel']=_0xbfe9('0x82');_0x5ff606['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xbfe9('0xfe'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0xff');break;case _0xbfe9('0x100'):_0x5ff606[_0xbfe9('0x7a')]=_0xbfe9('0x101');break;case'screenrecordings':_0x5ff606[_0xbfe9('0x7a')]='ScreenRecording';_0x5ff606[_0xbfe9('0x7c')]=[{'name':_0xbfe9('0x8f'),'field':'id','foreignKey':'UserId','model':_0xbfe9('0xc1'),'filter':{'field':_0xbfe9('0xc2'),'value':[_0xbfe9('0xc3')]}},{'name':'Telephones','field':'id','foreignKey':_0xbfe9('0x102'),'model':_0xbfe9('0xc1'),'filter':{'field':'role','value':[_0xbfe9('0xc5')]}}];break;default:return _0x5ff606;}return _0x5ff606;} \ No newline at end of file +var _0xe515=['telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','agents','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Interval','pauses','scheduler','sounds','tags','templates','Trunk','variables','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','screenrecordings','UserId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','map','UserProfile','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','rows','show','params','keys','include','find','create','body','clone','length','get','omit','createdAt','crudPermissions','updatedAt','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','catch','update','describe','addSections','sequelize','transaction','userProfileId','push','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','all','ignore','field','foreignKey','associatedResources','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','custom','CmContact','Tags','color','tag','Tag','ThroughTags','Agents','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','toUpperCase','slice','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','ui.UserId\x20=\x20?','toString','OpenTabs','value','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones'];(function(_0x8b2b82,_0x3519d9){var _0x32769d=function(_0xcf3e74){while(--_0xcf3e74){_0x8b2b82['push'](_0x8b2b82['shift']());}};_0x32769d(++_0x3519d9);}(_0xe515,0x146));var _0x5e51=function(_0x108057,_0x295083){_0x108057=_0x108057-0x0;var _0x37be45=_0xe515[_0x108057];return _0x37be45;};'use strict';var emlformat=require(_0x5e51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e51('0x1'));var jsonpatch=require(_0x5e51('0x2'));var rp=require(_0x5e51('0x3'));var moment=require(_0x5e51('0x4'));var BPromise=require(_0x5e51('0x5'));var Mustache=require(_0x5e51('0x6'));var util=require(_0x5e51('0x7'));var path=require(_0x5e51('0x8'));var sox=require(_0x5e51('0x9'));var csv=require('to-csv');var ejs=require(_0x5e51('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e51('0xb'));var squel=require(_0x5e51('0xc'));var crypto=require(_0x5e51('0xd'));var jsforce=require(_0x5e51('0xe'));var deskjs=require(_0x5e51('0xf'));var toCsv=require(_0x5e51('0x10'));var querystring=require('querystring');var Papa=require(_0x5e51('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5e51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e51('0x13'));var logger=require('../../config/logger')(_0x5e51('0x14'));var utils=require(_0x5e51('0x15'));var config=require(_0x5e51('0x16'));var licenseUtil=require(_0x5e51('0x17'));var db=require(_0x5e51('0x18'))['db'];config[_0x5e51('0x19')]=_[_0x5e51('0x1a')](config[_0x5e51('0x19')],{'host':_0x5e51('0x1b'),'port':0x18eb});var socket=require(_0x5e51('0x1c'))(new Redis(config[_0x5e51('0x19')]));require(_0x5e51('0x1d'))['register'](socket);function respondWithStatusCode(_0x19261b,_0x304653){_0x304653=_0x304653||0xcc;return function(_0x426711){if(_0x426711){return _0x19261b[_0x5e51('0x1e')](_0x304653);}return _0x19261b[_0x5e51('0x1f')](_0x304653)[_0x5e51('0x20')]();};}function respondWithResult(_0x2c8ebf,_0x5eea1d){_0x5eea1d=_0x5eea1d||0xc8;return function(_0x15249b){if(_0x15249b){return _0x2c8ebf[_0x5e51('0x1f')](_0x5eea1d)[_0x5e51('0x21')](_0x15249b);}};}function respondWithFilteredResult(_0x156864,_0x27e9fe){return function(_0x261634){if(_0x261634){var _0x286cbe=typeof _0x27e9fe[_0x5e51('0x22')]===_0x5e51('0x23')&&typeof _0x27e9fe[_0x5e51('0x24')]===_0x5e51('0x23');var _0x4d716f=_0x261634['count'];var _0x2ad36a=_0x286cbe?0x0:_0x27e9fe[_0x5e51('0x22')];var _0x158786=_0x286cbe?_0x261634[_0x5e51('0x25')]:_0x27e9fe[_0x5e51('0x22')]+_0x27e9fe[_0x5e51('0x24')];var _0x18952a;if(_0x158786>=_0x4d716f){_0x158786=_0x4d716f;_0x18952a=0xc8;}else{_0x18952a=0xce;}_0x156864['status'](_0x18952a);return _0x156864[_0x5e51('0x26')](_0x5e51('0x27'),_0x2ad36a+'-'+_0x158786+'/'+_0x4d716f)[_0x5e51('0x21')](_0x261634);}return null;};}function patchUpdates(_0xd5d6d0){return function(_0x4c104d){try{jsonpatch[_0x5e51('0x28')](_0x4c104d,_0xd5d6d0,!![]);}catch(_0x54a209){return BPromise[_0x5e51('0x29')](_0x54a209);}return _0x4c104d[_0x5e51('0x2a')]();};}function saveUpdates(_0x3a1cc2,_0x48807e){return function(_0x49891b){if(_0x49891b){return _0x49891b['update'](_0x3a1cc2)['then'](function(_0x423222){return _0x423222;});}return null;};}function removeEntity(_0x15f13c,_0x2f3b8f){return function(_0x42a411){if(_0x42a411){return _0x42a411[_0x5e51('0x2b')]()[_0x5e51('0x2c')](function(){_0x15f13c[_0x5e51('0x1f')](0xcc)[_0x5e51('0x20')]();});}};}function handleEntityNotFound(_0x3f5159,_0x2bda27){return function(_0x2d9cf3){if(!_0x2d9cf3){_0x3f5159[_0x5e51('0x1e')](0x194);}return _0x2d9cf3;};}function handleError(_0x5908d9,_0x1fa50a){_0x1fa50a=_0x1fa50a||0x1f4;return function(_0x167cef){logger[_0x5e51('0x2d')](_0x167cef[_0x5e51('0x2e')]);if(_0x167cef[_0x5e51('0x2f')]){delete _0x167cef['name'];}_0x5908d9[_0x5e51('0x1f')](_0x1fa50a)['send'](_0x167cef);};}exports['index']=function(_0x465645,_0x457882){var _0x3f2d8e={},_0x1a1f28={},_0x2d0033={'count':0x0,'rows':[]};var _0x3a8673=_[_0x5e51('0x30')](db[_0x5e51('0x31')][_0x5e51('0x32')],function(_0x26b381){return{'name':_0x26b381[_0x5e51('0x33')],'type':_0x26b381[_0x5e51('0x34')][_0x5e51('0x35')]};});_0x1a1f28[_0x5e51('0x36')]=_[_0x5e51('0x30')](_0x3a8673,'name');_0x1a1f28[_0x5e51('0x37')]=_['keys'](_0x465645[_0x5e51('0x37')]);_0x1a1f28['filters']=_[_0x5e51('0x38')](_0x1a1f28[_0x5e51('0x36')],_0x1a1f28[_0x5e51('0x37')]);_0x3f2d8e[_0x5e51('0x39')]=_[_0x5e51('0x38')](_0x1a1f28[_0x5e51('0x36')],qs[_0x5e51('0x3a')](_0x465645[_0x5e51('0x37')][_0x5e51('0x3a')]));_0x3f2d8e[_0x5e51('0x39')]=_0x3f2d8e[_0x5e51('0x39')]['length']?_0x3f2d8e[_0x5e51('0x39')]:_0x1a1f28[_0x5e51('0x36')];if(!_0x465645['query'][_0x5e51('0x3b')](_0x5e51('0x3c'))){_0x3f2d8e[_0x5e51('0x24')]=qs['limit'](_0x465645[_0x5e51('0x37')]['limit']);_0x3f2d8e[_0x5e51('0x22')]=qs[_0x5e51('0x22')](_0x465645[_0x5e51('0x37')]['offset']);}_0x3f2d8e[_0x5e51('0x3d')]=qs[_0x5e51('0x3e')](_0x465645[_0x5e51('0x37')][_0x5e51('0x3e')]);_0x3f2d8e['where']=qs[_0x5e51('0x3f')](_[_0x5e51('0x40')](_0x465645['query'],_0x1a1f28[_0x5e51('0x3f')]),_0x3a8673);if(_0x465645[_0x5e51('0x37')][_0x5e51('0x41')]){_0x3f2d8e['where']=_[_0x5e51('0x42')](_0x3f2d8e[_0x5e51('0x43')],{'$or':_[_0x5e51('0x30')](_0x3a8673,function(_0x1ae984){if(_0x1ae984['type']!==_0x5e51('0x44')){var _0x41caad={};_0x41caad[_0x1ae984[_0x5e51('0x2f')]]={'$like':'%'+_0x465645[_0x5e51('0x37')]['filter']+'%'};return _0x41caad;}})});}_0x3f2d8e=_['merge']({},_0x3f2d8e,_0x465645[_0x5e51('0x45')]);var _0x5d39ca={'where':_0x3f2d8e[_0x5e51('0x43')]};return db[_0x5e51('0x31')]['count'](_0x5d39ca)[_0x5e51('0x2c')](function(_0x275bbc){_0x2d0033[_0x5e51('0x25')]=_0x275bbc;if(_0x465645[_0x5e51('0x37')][_0x5e51('0x46')]){_0x3f2d8e['include']=[{'all':!![]}];}return db[_0x5e51('0x31')]['findAll'](_0x3f2d8e);})[_0x5e51('0x2c')](function(_0x3ca054){_0x2d0033[_0x5e51('0x47')]=_0x3ca054;return _0x2d0033;})[_0x5e51('0x2c')](respondWithFilteredResult(_0x457882,_0x3f2d8e))['catch'](handleError(_0x457882,null));};exports[_0x5e51('0x48')]=function(_0x3ba8a0,_0x4e7c7d){var _0x2bdbb2={'raw':![],'where':{'id':_0x3ba8a0[_0x5e51('0x49')]['id']}},_0x578609={};_0x578609[_0x5e51('0x36')]=_[_0x5e51('0x4a')](db['UserProfile']['rawAttributes']);_0x578609[_0x5e51('0x37')]=_[_0x5e51('0x4a')](_0x3ba8a0[_0x5e51('0x37')]);_0x578609['filters']=_[_0x5e51('0x38')](_0x578609[_0x5e51('0x36')],_0x578609[_0x5e51('0x37')]);_0x2bdbb2[_0x5e51('0x39')]=_['intersection'](_0x578609[_0x5e51('0x36')],qs[_0x5e51('0x3a')](_0x3ba8a0[_0x5e51('0x37')]['fields']));_0x2bdbb2[_0x5e51('0x39')]=_0x2bdbb2['attributes']['length']?_0x2bdbb2[_0x5e51('0x39')]:_0x578609['model'];if(_0x3ba8a0[_0x5e51('0x37')]['includeAll']){_0x2bdbb2[_0x5e51('0x4b')]=[{'all':!![]}];}_0x2bdbb2=_[_0x5e51('0x42')]({},_0x2bdbb2,_0x3ba8a0[_0x5e51('0x45')]);return db[_0x5e51('0x31')][_0x5e51('0x4c')](_0x2bdbb2)['then'](handleEntityNotFound(_0x4e7c7d,null))[_0x5e51('0x2c')](respondWithResult(_0x4e7c7d,null))['catch'](handleError(_0x4e7c7d,null));};exports[_0x5e51('0x4d')]=function(_0x56e47d,_0x582841){return db[_0x5e51('0x31')][_0x5e51('0x4d')](_0x56e47d[_0x5e51('0x4e')],{})[_0x5e51('0x2c')](respondWithResult(_0x582841,0xc9))['catch'](handleError(_0x582841,null));};exports[_0x5e51('0x4f')]=function(_0x502e91,_0x1b1c78){var _0x72a2b8={'where':{'id':_0x502e91[_0x5e51('0x49')]['id']}},_0x2a2bd5={};_0x2a2bd5[_0x5e51('0x36')]=_[_0x5e51('0x4a')](db[_0x5e51('0x31')][_0x5e51('0x32')]);_0x72a2b8[_0x5e51('0x39')]=_['intersection'](_0x2a2bd5['model'],qs[_0x5e51('0x3a')](_0x502e91[_0x5e51('0x37')][_0x5e51('0x3a')]));_0x72a2b8['attributes']=_0x72a2b8[_0x5e51('0x39')][_0x5e51('0x50')]?_0x72a2b8[_0x5e51('0x39')]:_0x2a2bd5[_0x5e51('0x36')];if(_0x502e91['query'][_0x5e51('0x46')]){_0x72a2b8[_0x5e51('0x4b')]=[{'all':!![]}];}_0x72a2b8=_['merge']({},_0x72a2b8,_0x502e91['options']);return db[_0x5e51('0x31')][_0x5e51('0x4c')](_0x72a2b8)[_0x5e51('0x2c')](handleEntityNotFound(_0x1b1c78,null))[_0x5e51('0x2c')](function(_0xfd7b2f){if(_0xfd7b2f){var _0x2cb0c4=_0xfd7b2f[_0x5e51('0x51')]({'plain':!![]});_0x2cb0c4=qs[_0x5e51('0x52')](_0x2cb0c4,['id',_0x5e51('0x53'),'updatedAt',_0x5e51('0x54')]);_0x502e91[_0x5e51('0x4e')]=_[_0x5e51('0x52')](_0x502e91['body'],['id',_0x5e51('0x53'),_0x5e51('0x55')]);return db['sequelize']['transaction'](function(_0x4f7c6c){return db[_0x5e51('0x31')][_0x5e51('0x4d')](_[_0x5e51('0x42')](_0x2cb0c4,_0x502e91[_0x5e51('0x4e')]),{'include':_0x502e91['query'][_0x5e51('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x4f7c6c})['then'](function(_0xa2c09){var _0x3e113f=_0xa2c09['get']({'plain':!![]});return db[_0x5e51('0x56')][_0x5e51('0x57')]({'where':{'userProfileId':_0x502e91['params']['id']},'raw':!![]})[_0x5e51('0x2c')](function(_0xdf4c26){if(_0xdf4c26){return BPromise[_0x5e51('0x58')](_0xdf4c26,function(_0x151008){return new BPromise(function(_0x259a59,_0x2dd8ff){if(_0x151008[_0x5e51('0x59')]===null||_0x151008[_0x5e51('0x59')]===0x1)_0x259a59(null);return db[_0x5e51('0x5a')][_0x5e51('0x57')]({'where':{'sectionId':_0x151008['id']},'raw':!![]})[_0x5e51('0x2c')](function(_0x11b688){var _0x52d020=_['map'](_0x11b688,function(_0x445a81){return qs[_0x5e51('0x52')](_0x445a81,['id',_0x5e51('0x53'),_0x5e51('0x55'),_0x5e51('0x5b')]);});_0x259a59(_0x52d020);})['catch'](function(_0x1f06c3){_0x2dd8ff(_0x1f06c3);});})['then'](function(_0x3a0ad4){var _0x323d81=qs[_0x5e51('0x52')](_0x151008,['id',_0x5e51('0x53'),_0x5e51('0x55')]);_0x323d81['userProfileId']=_0x3e113f['id'];if(_0x3a0ad4)_0x323d81[_0x5e51('0x5c')]=_0x3a0ad4;return _0x323d81;})['then'](function(_0x399280){return db[_0x5e51('0x56')][_0x5e51('0x4d')](_0x399280,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4f7c6c});});})[_0x5e51('0x2c')](function(){return _0x3e113f;});}});});});}})['then'](respondWithResult(_0x1b1c78,0xc9))[_0x5e51('0x5d')](handleError(_0x1b1c78,null));};exports[_0x5e51('0x5e')]=function(_0x12898c,_0x4cb2e5){if(_0x12898c[_0x5e51('0x4e')]['id']){delete _0x12898c[_0x5e51('0x4e')]['id'];}return db['UserProfile'][_0x5e51('0x4c')]({'where':{'id':_0x12898c[_0x5e51('0x49')]['id']}})[_0x5e51('0x2c')](handleEntityNotFound(_0x4cb2e5,null))[_0x5e51('0x2c')](saveUpdates(_0x12898c['body'],null))[_0x5e51('0x2c')](respondWithResult(_0x4cb2e5,null))[_0x5e51('0x5d')](handleError(_0x4cb2e5,null));};exports['destroy']=function(_0x55cdf8,_0x203dd2){return db['UserProfile'][_0x5e51('0x4c')]({'where':{'id':_0x55cdf8[_0x5e51('0x49')]['id']}})[_0x5e51('0x2c')](handleEntityNotFound(_0x203dd2,null))['then'](removeEntity(_0x203dd2,null))['catch'](handleError(_0x203dd2,null));};exports[_0x5e51('0x5f')]=function(_0x4b9863,_0x3fa210){return db['UserProfile']['describe']()[_0x5e51('0x2c')](respondWithResult(_0x3fa210,null))[_0x5e51('0x5d')](handleError(_0x3fa210,null));};exports[_0x5e51('0x60')]=function(_0x584b41,_0x1a7083){var _0x993349=_0x584b41[_0x5e51('0x4e')];return db[_0x5e51('0x31')]['find']({'where':{'id':_0x584b41[_0x5e51('0x49')]['id']}})[_0x5e51('0x2c')](handleEntityNotFound(_0x1a7083,null))[_0x5e51('0x2c')](function(_0x510b88){if(_0x510b88){return db[_0x5e51('0x61')][_0x5e51('0x62')](function(_0x2e6ba6){return db[_0x5e51('0x56')][_0x5e51('0x2b')]({'where':{'userProfileId':_0x584b41['params']['id'],'sectionId':_['map'](_0x993349,function(_0x6d3950){return _0x6d3950[_0x5e51('0x5b')];})},'transaction':_0x2e6ba6})[_0x5e51('0x2c')](function(){var _0x7ef925=_[_0x5e51('0x30')](_0x993349,function(_0x529f76){_0x529f76[_0x5e51('0x63')]=_0x584b41[_0x5e51('0x49')]['id'];return _0x529f76;});var _0x40b898=[];return BPromise['each'](_0x7ef925,function(_0x18c715){return db['UserProfileSection'][_0x5e51('0x4d')](_0x18c715,{'include':[{'model':db['UserProfileResource'],'as':_0x5e51('0x5c')}],'raw':!![],'transaction':_0x2e6ba6})[_0x5e51('0x2c')](function(_0xf9f3ed){_0x40b898[_0x5e51('0x64')](_0xf9f3ed[_0x5e51('0x51')]({'plain':!![]}));});})[_0x5e51('0x2c')](function(){return _0x40b898;});});});}})[_0x5e51('0x2c')](function(_0x3bc85b){return _0x3bc85b;})['then'](respondWithResult(_0x1a7083,null))[_0x5e51('0x5d')](handleError(_0x1a7083,null));};exports['removeSections']=function(_0x45a67f,_0x41f016){var _0x1883b0;return db[_0x5e51('0x31')][_0x5e51('0x4c')]({'where':{'id':_0x45a67f[_0x5e51('0x49')]['id']},'attributes':['id',_0x5e51('0x2f')]})['then'](handleEntityNotFound(_0x41f016,null))[_0x5e51('0x2c')](function(_0x3bf9ef){if(_0x3bf9ef){_0x1883b0=_0x3bf9ef;return db[_0x5e51('0x56')][_0x5e51('0x2b')]({'where':{'userProfileId':_0x45a67f[_0x5e51('0x49')]['id'],'sectionId':_0x45a67f[_0x5e51('0x37')][_0x5e51('0x65')]}});}})['then'](function(){return _0x1883b0;})[_0x5e51('0x2c')](respondWithStatusCode(_0x41f016,null))[_0x5e51('0x5d')](handleError(_0x41f016,null));};exports[_0x5e51('0x66')]=function(_0x2b3686,_0x222196){var _0x25fef5=[];var _0x5921d1=[];return db[_0x5e51('0x56')][_0x5e51('0x57')]({'where':{'userProfileId':_0x2b3686[_0x5e51('0x49')]['id']},'raw':!![]})[_0x5e51('0x2c')](function(_0x41bab0){_0x25fef5=_[_0x5e51('0x41')](_0x41bab0,function(_0x4a2668){return _0x4a2668[_0x5e51('0x67')]===0x1||_[_0x5e51('0x68')]([0x3eb,0x709],_0x4a2668[_0x5e51('0x5b')]);});if(!_[_0x5e51('0x69')](_0x25fef5)){return _[_0x5e51('0x30')](_0x25fef5,function(_0x337576){return _0x337576[_0x5e51('0x5b')];});}else{return;}})[_0x5e51('0x2c')](function(_0x38c8e3){if(_0x38c8e3)_0x5921d1=_0x38c8e3;if(_[_0x5e51('0x68')](_0x5921d1,0x64)){var _0x9f11c7=_[_0x5e51('0x4c')](_0x25fef5,{'sectionId':0x64});return hasDefaultDashboard(_0x9f11c7)[_0x5e51('0x2c')](function(_0x41fcbf){return _[_0x5e51('0x30')](_0x25fef5,function(_0x4c85dd){if(_0x4c85dd[_0x5e51('0x5b')]===0x64){_0x4c85dd[_0x5e51('0x6a')]=_0x41fcbf;}return _0x4c85dd;});});}else{return;}})[_0x5e51('0x2c')](function(_0x221aae){if(_0x221aae)_0x25fef5=_0x221aae;if(_['includes'](_0x5921d1,0x3eb)){var _0x6ef5f9=_[_0x5e51('0x4c')](_0x25fef5,{'sectionId':0x3eb});return getCustomDashboards(_0x6ef5f9)[_0x5e51('0x2c')](function(_0x584d8b){return _[_0x5e51('0x30')](_0x25fef5,function(_0x4c3fae){if(_0x6ef5f9[_0x5e51('0x67')]){if(_0x4c3fae['sectionId']===0x3eb){_0x4c3fae[_0x5e51('0x6a')]=_0x584d8b;}}else{if(_0x4c3fae['sectionId']===0x64){_0x4c3fae['subsections']=_0x584d8b;}}return _0x4c3fae;});});}else{return;}})[_0x5e51('0x2c')](function(_0x40070d){if(_0x40070d)_0x25fef5=_0x40070d;if(_[_0x5e51('0x68')](_0x5921d1,0x709)){var _0x5a58d0=_[_0x5e51('0x4c')](_0x25fef5,{'sectionId':0x709});return getPlugins(_0x5a58d0)['then'](function(_0x5cdf19){if(_0x5a58d0[_0x5e51('0x67')]){return _[_0x5e51('0x30')](_0x25fef5,function(_0x4ce373){if(_0x4ce373[_0x5e51('0x5b')]===0x709){_0x4ce373['subsections']=_0x5cdf19;}return _0x4ce373;});}else{var _0x56cafd={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5cdf19};var _0x59ea34=_[_0x5e51('0x30')](_0x25fef5);_0x59ea34['push'](_0x56cafd);return _0x59ea34;}});}else{return;}})[_0x5e51('0x2c')](function(_0x21f6f6){if(_0x21f6f6)_0x25fef5=_0x21f6f6;return _[_0x5e51('0x41')](_0x25fef5,[_0x5e51('0x67'),0x1]);})[_0x5e51('0x2c')](respondWithResult(_0x222196,null))[_0x5e51('0x5d')](handleError(_0x222196,null));};function hasDefaultDashboard(_0x3545e3){var _0x2db505=[0x65];return new BPromise(function(_0x475b66,_0x58e1bb){try{if(_0x3545e3[_0x5e51('0x59')]){_0x475b66(_0x2db505);}else{return db[_0x5e51('0x5a')][_0x5e51('0x6b')]({'where':{'sectionId':_0x3545e3['id']},'raw':!![]})[_0x5e51('0x2c')](function(_0x4cb766){_0x4cb766?_0x475b66(_0x2db505):_0x475b66();});}}catch(_0xaca830){_0x58e1bb(_0xaca830);}});}function getCustomDashboards(_0x370bf4){var _0x4094bf=[];return new BPromise(function(_0x4bb1ad,_0x2d61ab){try{if(_0x370bf4[_0x5e51('0x59')]){return db[_0x5e51('0x6c')][_0x5e51('0x57')]({'raw':!![]})[_0x5e51('0x2c')](function(_0x109821){_0x109821[_0x5e51('0x6d')](function(_0x40057e){_0x4094bf[_0x5e51('0x64')](_0x40057e['id']+0x1869f);});_0x4bb1ad(_0x4094bf);});}else{return db[_0x5e51('0x5a')]['findAll']({'where':{'sectionId':_0x370bf4['id']},'raw':!![]})['then'](function(_0x2747e6){_0x2747e6[_0x5e51('0x6d')](function(_0x53d3c6){_0x4094bf['push'](_0x53d3c6[_0x5e51('0x6e')]+0x1869f);});_0x4bb1ad(_0x4094bf);});}}catch(_0x1d7bfb){_0x2d61ab(_0x1d7bfb);}});}function getPlugins(_0x19e737){var _0x2746ba=[];return new BPromise(function(_0x47e543,_0x5679e5){try{if(_0x19e737[_0x5e51('0x59')]){return db['Plugin']['findAll']({'raw':!![]})[_0x5e51('0x2c')](function(_0xac58f4){_0xac58f4[_0x5e51('0x6d')](function(_0x1f5027){_0x2746ba[_0x5e51('0x64')](_0x1f5027['id']+0x15b38);});_0x47e543(_0x2746ba);});}else{return db[_0x5e51('0x5a')][_0x5e51('0x57')]({'where':{'sectionId':_0x19e737['id']},'raw':!![]})['then'](function(_0x9f580b){_0x9f580b[_0x5e51('0x6d')](function(_0x203528){_0x2746ba['push'](_0x203528['resourceId']+0x15b38);});_0x47e543(_0x2746ba);});}}catch(_0x237a0e){_0x5679e5(_0x237a0e);}});}exports[_0x5e51('0x6f')]=function(_0x5ee1e9,_0x38dc2a){return db[_0x5e51('0x31')]['find']({'where':{'id':_0x5ee1e9['params']['id']}})[_0x5e51('0x2c')](handleEntityNotFound(_0x38dc2a,null))[_0x5e51('0x2c')](function(_0x6a70cc){if(_0x6a70cc){return db[_0x5e51('0x61')][_0x5e51('0x62')](function(_0x53edda){return db['UserProfileSection'][_0x5e51('0x57')]({'where':{'userProfileId':_0x5ee1e9['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x56237e){if(_0x56237e){return db[_0x5e51('0x56')][_0x5e51('0x2b')]({'where':{'userProfileId':_0x5ee1e9[_0x5e51('0x49')]['id'],'id':_[_0x5e51('0x30')](_0x56237e,function(_0xf21116){return _0xf21116['id'];})},'transaction':_0x53edda});}})[_0x5e51('0x2c')](function(_0x3db624){var _0x5f4571=_[_0x5e51('0x30')](_0x5ee1e9['body'],function(_0x159a5a){_0x159a5a[_0x5e51('0x63')]=_0x5ee1e9[_0x5e51('0x49')]['id'];return _0x159a5a;});return db[_0x5e51('0x56')][_0x5e51('0x70')](_0x5f4571,{'raw':!![],'transaction':_0x53edda});})[_0x5e51('0x2c')](function(_0x1b78e9){var _0x1a89ba=_[_0x5e51('0x41')](_['map'](_0x1b78e9,function(_0x3464ab){return _0x3464ab['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1a89ba){return db[_0x5e51('0x56')][_0x5e51('0x57')]({'where':{'userProfileId':_0x5ee1e9['params']['id'],'sectionId':_[_0x5e51('0x30')](_0x1a89ba,function(_0x2cbb9c){return _0x2cbb9c[_0x5e51('0x5b')];})},'attributes':['id',_0x5e51('0x5b')],'raw':!![]})['then'](function(_0x1148e6){var _0x54c9e8=_['map'](_0x5ee1e9[_0x5e51('0x4e')],function(_0x4ce0ea){_0x4ce0ea[_0x5e51('0x63')]=_0x5ee1e9[_0x5e51('0x49')]['id'];return _0x4ce0ea;});return db['UserProfileResource'][_0x5e51('0x70')](_0x54c9e8,{'raw':!![],'transaction':_0x53edda});});}})[_0x5e51('0x5d')](handleError(_0x38dc2a,null));});}})[_0x5e51('0x2c')](function(_0x271880){var _0x560354=_['map'](_0x271880,function(_0x22804b){return _0x22804b[_0x5e51('0x51')]({'plain':!![]});});})[_0x5e51('0x2c')](respondWithResult(_0x38dc2a,null))[_0x5e51('0x5d')](handleError(_0x38dc2a,null));};exports[_0x5e51('0x71')]=function(_0x3d0fb6,_0x5d1fe2,_0x3e3a24){return db['UserProfile'][_0x5e51('0x4c')]({'where':{'id':_0x3d0fb6[_0x5e51('0x49')]['id']}})[_0x5e51('0x2c')](handleEntityNotFound(_0x5d1fe2,null))['then'](function(_0x850bae){if(_0x850bae){return _0x850bae[_0x5e51('0x71')](_0x3d0fb6['query']['ids']);}})[_0x5e51('0x2c')](respondWithStatusCode(_0x5d1fe2,null))[_0x5e51('0x5d')](handleError(_0x5d1fe2,null));};exports[_0x5e51('0x72')]=function(_0x384133,_0x13117e){var _0x2f019e={'raw':![],'where':{}};var _0xee4dd2={};var _0x4567a7={'count':0x0,'rows':[]};var _0x2fbf0c=_0x384133[_0x5e51('0x37')][_0x5e51('0x73')];if(typeof _0x2fbf0c==='undefined'){throw new db[(_0x5e51('0x74'))][(_0x5e51('0x75'))](_0x5e51('0x76'));}var _0x2d868e=_0x384133['query'][_0x5e51('0x77')]||![];var _0x2c1719=getQueryModels(_0x2fbf0c,_0x2d868e);if(typeof _0x2c1719[_0x5e51('0x78')]===_0x5e51('0x23')){throw new db[(_0x5e51('0x74'))][(_0x5e51('0x75'))]('Invalid\x20section\x20\x27'+_0x2fbf0c+'\x27');}var _0x2e4a61=[];if(!_[_0x5e51('0x69')](_0x2c1719[_0x5e51('0x79')])){_0x2e4a61=_0x2c1719[_0x5e51('0x79')];}else{_0x2e4a61=[{'name':_0x2fbf0c}];}return db[_0x5e51('0x31')][_0x5e51('0x6b')]({'where':{'id':_0x384133['params']['id']}})['then'](handleEntityNotFound(_0x13117e,null))[_0x5e51('0x2c')](function(_0x2dc5e1){if(_0x2dc5e1){var _0x5b4780=[];for(var _0x3a3a11=0x0;_0x3a3a11<_0x2e4a61[_0x5e51('0x50')];_0x3a3a11++){_0x5b4780[_0x5e51('0x64')](db[_0x5e51('0x56')][_0x5e51('0x6b')]({'where':{'userProfileId':_0x2dc5e1['id'],'name':_0x2e4a61[_0x3a3a11][_0x5e51('0x2f')]},'raw':!![]}));}return BPromise[_0x5e51('0x7a')](_0x5b4780);}})[_0x5e51('0x2c')](function(_0x5d58ea){var _0x4becc1=_[_0x5e51('0x41')](_0x5d58ea,function(_0x1db49f){return _0x1db49f?_0x1db49f:undefined;});var _0x10ab5e=_[_0x5e51('0x41')](_0x2e4a61,['ignore',!![]]);var _0x59d6f6=_[_0x5e51('0x69')](_0x4becc1)&&_[_0x5e51('0x69')](_0x10ab5e)?null:_['union'](_0x10ab5e,_0x4becc1);if(_0x59d6f6){var _0x45ffb9=[];for(var _0x5be98b=0x0;_0x5be98b<_0x59d6f6[_0x5e51('0x50')];_0x5be98b++){var _0x15a1f8=_[_0x5e51('0x4c')](_0x2e4a61,function(_0x33949a){return _0x59d6f6[_0x5be98b]?_0x33949a[_0x5e51('0x2f')]===_0x59d6f6[_0x5be98b]['name']:null;});if(_0x15a1f8){if(_0x59d6f6[_0x5be98b][_0x5e51('0x7b')]){_0x45ffb9[_0x5e51('0x64')](getAllResources(_0x2c1719[_0x5e51('0x78')],_0x59d6f6[_0x5be98b]));}else{if(!_0x59d6f6[_0x5be98b]['autoAssociation']){_0x45ffb9[_0x5e51('0x64')](getAllowedResources(_0x15a1f8,_0x59d6f6[_0x5be98b],_0x2c1719[_0x5e51('0x78')]));}else{if(_0x15a1f8[_0x5e51('0x36')]){_0x45ffb9[_0x5e51('0x64')](getAllFilteredResources(_0x15a1f8,_0x59d6f6[_0x5be98b]));}}}}}return BPromise['all'](_0x45ffb9);}else{return null;}})[_0x5e51('0x2c')](function(_0x3464bd){var _0x10bc5d=_0x3464bd;var _0x2ad234=null;if(_0x10bc5d){_0x2ad234=_0x10bc5d[_0x5e51('0x50')]===0x1?_0x10bc5d[0x0]:null;}if(_0x2ad234||_0x10bc5d){var _0x4e8f72=db[_0x2c1719[_0x5e51('0x78')]]['rawAttributes'];_0xee4dd2['model']=_[_0x5e51('0x4a')](_0x4e8f72);_0xee4dd2['query']=_[_0x5e51('0x4a')](_0x384133[_0x5e51('0x37')]);_0xee4dd2[_0x5e51('0x3f')]=_[_0x5e51('0x38')](_0xee4dd2[_0x5e51('0x36')],_0xee4dd2[_0x5e51('0x37')]);_0x2f019e[_0x5e51('0x39')]=_[_0x5e51('0x38')](_0xee4dd2['model'],qs['fields'](_0x384133['query']['fields']));_0x2f019e[_0x5e51('0x39')]=_0x2f019e['attributes']['length']?_0x2f019e['attributes']:_0xee4dd2['model'];if(!_0x384133['query'][_0x5e51('0x3b')]('nolimit')){_0x2f019e[_0x5e51('0x24')]=qs['limit'](_0x384133['query'][_0x5e51('0x24')]);_0x2f019e[_0x5e51('0x22')]=qs[_0x5e51('0x22')](_0x384133[_0x5e51('0x37')][_0x5e51('0x22')]);}_0x2f019e[_0x5e51('0x3d')]=qs[_0x5e51('0x3e')](_0x384133[_0x5e51('0x37')]['sort']);_0x2f019e[_0x5e51('0x43')]=qs[_0x5e51('0x3f')](_[_0x5e51('0x40')](_0x384133['query'],_0xee4dd2[_0x5e51('0x3f')]));if(_0x384133[_0x5e51('0x37')][_0x5e51('0x41')]){_0x2f019e[_0x5e51('0x43')]=_['merge'](_0x2f019e[_0x5e51('0x43')],{'$or':_[_0x5e51('0x30')](_0x4e8f72,function(_0x1e6eb1){if(_0x1e6eb1['type'][_0x5e51('0x35')]!==_0x5e51('0x44')){var _0x52b95c={};_0x52b95c[_0x1e6eb1['field']]={'$like':'%'+_0x384133[_0x5e51('0x37')][_0x5e51('0x41')]+'%'};return _0x52b95c;}})});}var _0x2521a2=[];if(_0x2ad234){var _0x19473e=_['find'](_0x2e4a61,['name',_0x2ad234[_0x5e51('0x2f')]]);if(_0x19473e[_0x5e51('0x7c')]){var _0x4fa3aa={};if(_0x2c1719[_0x5e51('0x78')]==='AnalyticExtractedReport'){_0x4fa3aa[_0x19473e[_0x5e51('0x7d')]]=_['map'](_0x2ad234[_0x5e51('0x7e')],'id');}else{_0x4fa3aa[_0x19473e[_0x5e51('0x7d')]]=_0x2ad234[_0x5e51('0x7e')];}_0x2521a2[_0x5e51('0x64')](_0x4fa3aa);}else{_0x2f019e['where']['id']=_0x2ad234['associatedResources'];}}else{for(var _0x402523=0x0;_0x402523<_0x10bc5d[_0x5e51('0x50')];_0x402523++){var _0x19473e=_[_0x5e51('0x4c')](_0x2e4a61,[_0x5e51('0x2f'),_0x10bc5d[_0x402523][_0x5e51('0x2f')]]);if(_0x19473e[_0x5e51('0x7c')]){var _0x4fa3aa={};_0x4fa3aa[_0x19473e[_0x5e51('0x7d')]]=_0x10bc5d[_0x402523][_0x5e51('0x7e')];_0x2521a2[_0x5e51('0x64')](_0x4fa3aa);}else{if(!_0x2f019e['where']['id'])_0x2f019e[_0x5e51('0x43')]['id']=[];_0x10bc5d[_0x402523]['associatedResources']['forEach'](function(_0x52e583){_0x2f019e[_0x5e51('0x43')]['id'][_0x5e51('0x64')](_0x52e583);});}}}if(!_[_0x5e51('0x69')](_0x2521a2)){_0x2f019e['where']=_[_0x5e51('0x42')](_0x2f019e[_0x5e51('0x43')],{'$and':{'$or':_0x2521a2}});}_0x2f019e=_[_0x5e51('0x42')]({},_0x2f019e,_0x384133[_0x5e51('0x45')]);if(_0x2ad234&&!_0x2ad234[_0x5e51('0x59')]&&_0x2c1719[_0x5e51('0x78')]===_0x5e51('0x7f')){if(_0x384133['query']['includeAll']){_0x2f019e[_0x5e51('0x4b')]=[{'all':!![]}];}return db[_0x2c1719[_0x5e51('0x78')]][_0x5e51('0x57')](_0x2f019e)[_0x5e51('0x2c')](function(_0x4cba3e){var _0x5e0eae=[];_0x4cba3e[_0x5e51('0x6d')](function(_0x3b0f44){var _0x52eda7;switch(_0x3b0f44[_0x5e51('0x80')]){case _0x5e51('0x81'):_0x52eda7=_[_0x5e51('0x4c')](_0x2ad234[_0x5e51('0x7e')],function(_0x3df908){return _0x3df908['id']===_0x3b0f44[_0x5e51('0x82')]&&_0x3df908[_0x5e51('0x34')]===_0x5e51('0x83');});break;case _0x5e51('0x84'):_0x52eda7=_[_0x5e51('0x4c')](_0x2ad234['associatedResources'],function(_0x400055){return _0x400055['id']===_0x3b0f44['reportId']&&_0x400055['type']==='CustomReports';});break;}if(_0x52eda7)_0x5e0eae['push'](_0x3b0f44);});_0x4567a7[_0x5e51('0x25')]=_0x5e0eae[_0x5e51('0x50')];_0x4567a7[_0x5e51('0x47')]=_0x5e0eae;return _0x4567a7;});}else{return db[_0x2c1719[_0x5e51('0x78')]][_0x5e51('0x25')]({'where':_0x2f019e[_0x5e51('0x43')]})[_0x5e51('0x2c')](function(_0x30395c){_0x4567a7[_0x5e51('0x25')]=_0x30395c;if(_0x384133['query'][_0x5e51('0x46')]){if(_0x2c1719[_0x5e51('0x78')]===_0x5e51('0x85')){_0x2f019e[_0x5e51('0x4b')]=[{'model':db['Tag'],'as':_0x5e51('0x86'),'attributes':['id',_0x5e51('0x2f'),_0x5e51('0x87')],'required':_0x384133[_0x5e51('0x37')][_0x5e51('0x88')]?!![]:![]},{'model':db[_0x5e51('0x89')],'as':_0x5e51('0x8a'),'attributes':['id',_0x5e51('0x2f'),'color'],'through':_0x384133['query']['tag']?{'attributes':[],'where':{'TagId':_0x384133[_0x5e51('0x37')][_0x5e51('0x88')]||undefined}}:{},'required':_0x384133[_0x5e51('0x37')][_0x5e51('0x88')]?!![]:![]}];}else{_0x2f019e[_0x5e51('0x4b')]=[{'all':!![]}];}}return db[_0x2c1719[_0x5e51('0x78')]]['findAll'](_0x2f019e);})['then'](function(_0x38fd43){_0x4567a7[_0x5e51('0x47')]=_0x38fd43;if(_0x2fbf0c===_0x5e51('0x8b')&&_0x384133['query'][_0x5e51('0x8c')]==='true'){var _0x41120e=[];for(var _0x832e34=0x0;_0x832e34<_0x4567a7[_0x5e51('0x47')][_0x5e51('0x50')];_0x832e34++){_0x41120e[_0x5e51('0x64')](getOpenTabs(_0x5e51('0x8d'),_0x4567a7['rows'][_0x832e34][_0x5e51('0x8e')]));_0x41120e[_0x5e51('0x64')](getOpenTabs(_0x5e51('0x8f'),_0x4567a7['rows'][_0x832e34][_0x5e51('0x8e')]));_0x41120e[_0x5e51('0x64')](getOpenTabs(_0x5e51('0x90'),_0x4567a7[_0x5e51('0x47')][_0x832e34]['dataValues']));_0x41120e[_0x5e51('0x64')](getOpenTabs(_0x5e51('0x91'),_0x4567a7[_0x5e51('0x47')][_0x832e34][_0x5e51('0x8e')]));_0x41120e['push'](getOpenTabs(_0x5e51('0x92'),_0x4567a7['rows'][_0x832e34][_0x5e51('0x8e')]));_0x41120e[_0x5e51('0x64')](getOpenTabs(_0x5e51('0x93'),_0x4567a7[_0x5e51('0x47')][_0x832e34][_0x5e51('0x8e')]));}return Promise[_0x5e51('0x7a')](_0x41120e)[_0x5e51('0x2c')](function(){return _0x4567a7;});}return _0x4567a7;});}}else{return _0x4567a7;}})['then'](respondWithFilteredResult(_0x13117e,_0x2f019e))['catch'](handleError(_0x13117e,null));};function getOpenTabs(_0x2d1811,_0x227361){var _0x55b645=_0x2d1811['charAt'](0x0)[_0x5e51('0x94')]()+_0x2d1811[_0x5e51('0x95')](0x1);var _0xcf3de7={'type':db[_0x5e51('0x74')][_0x5e51('0x96')][_0x5e51('0x97')],'raw':!![]};return new BPromise(function(_0x887066,_0x485f69){var _0x23aa62=squel['select']()['field'](_0x5e51('0x98')+_0x55b645+_0x5e51('0x99'),'id')['field'](_0x5e51('0x9a'))[_0x5e51('0x9b')](_0x5e51('0x9c')+_0x2d1811+'_interactions','ui')['where'](_0x5e51('0x9d'),_0x227361['id']);return db[_0x5e51('0x61')][_0x5e51('0x37')](_0x23aa62[_0x5e51('0x9e')](),_0xcf3de7)['then'](function(_0x184b76){_0x227361[_0x55b645+_0x5e51('0x9f')]=_0x184b76;_0x887066(_0x184b76);})['catch'](function(_0x7b52d9){_0x485f69(_0x7b52d9);});});}function getAllResources(_0x20cf2b,_0xbd4eb3){return new BPromise(function(_0xdf1c7,_0x858183){if(_0xbd4eb3){var _0x550659=_0xbd4eb3[_0x5e51('0x41')]?{[_0xbd4eb3[_0x5e51('0x41')][_0x5e51('0x7c')]]:_0xbd4eb3[_0x5e51('0x41')][_0x5e51('0xa0')]}:undefined;return db[_0x20cf2b][_0x5e51('0x57')]({'where':_0x550659,'raw':!![]})[_0x5e51('0x2c')](function(_0x20c2ff){_0xbd4eb3[_0x5e51('0x7e')]=_[_0x5e51('0x30')](_0x20c2ff,'id');_0xdf1c7(_0xbd4eb3);})[_0x5e51('0x5d')](function(_0x3f2f98){_0x858183(_0x3f2f98);});}else{_0xdf1c7(null);}});}function getAllFilteredResources(_0x4072b1,_0x4ae97e){return new BPromise(function(_0x452fc0,_0x93637a){var _0x58aae9=_0x4072b1[_0x5e51('0x41')]?{[_0x4072b1[_0x5e51('0x41')][_0x5e51('0x7c')]]:_0x4072b1[_0x5e51('0x41')][_0x5e51('0xa0')]}:undefined;return db[_0x4072b1[_0x5e51('0x36')]][_0x5e51('0x57')]({'where':_0x58aae9,'raw':!![]})[_0x5e51('0x2c')](function(_0xe16565){_0x4ae97e[_0x5e51('0x7e')]=_['map'](_0xe16565,function(_0x224c2e){return _0x4072b1[_0x5e51('0x7c')]?_0x224c2e[_0x4072b1[_0x5e51('0x7c')]]:_0x224c2e['name'];});_0x452fc0(_0x4ae97e);})[_0x5e51('0x5d')](function(_0x19710b){_0x93637a(_0x19710b);});});}function getAllowedResources(_0x231b99,_0xdf8936,_0x293600){return new BPromise(function(_0x19d054,_0xdcb3fb){if(_0xdf8936){return db[_0x5e51('0x5a')]['findAll']({'where':{'sectionId':_0xdf8936['id']},'raw':!![]})[_0x5e51('0x2c')](function(_0x33adde){if(_0x231b99[_0x5e51('0x7c')]&&_0x231b99[_0x5e51('0x7c')]!=='id'){_0xdf8936[_0x5e51('0x7e')]=_[_0x5e51('0x30')](_0x33adde,function(_0x31bd6e){return _0x31bd6e[_0x231b99['field']];});}else{if(_0x293600===_0x5e51('0x7f')){_0xdf8936[_0x5e51('0x7e')]=_[_0x5e51('0x30')](_0x33adde,function(_0x3c16b3){return{'id':_0x3c16b3[_0x5e51('0x6e')],'type':_0x3c16b3['type']};});}else{_0xdf8936[_0x5e51('0x7e')]=_['map'](_0x33adde,function(_0x24e623){return _0x24e623[_0x5e51('0x6e')];});}}_0x19d054(_0xdf8936);})['catch'](function(_0x2d3063){_0xdcb3fb(_0x2d3063);});}else{_0x19d054(null);}});}function getQueryModels(_0x3e1930,_0x4090fc){var _0x41291c=_0x3e1930['toLowerCase']();var _0x448485={'childModel':undefined,'parentSections':[]};switch(_0x41291c){case'squareprojects':_0x448485[_0x5e51('0x78')]='SquareProject';break;case _0x5e51('0xa1'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xa2');break;case'squarerecordings':_0x448485[_0x5e51('0x78')]=_0x5e51('0xa3');_0x448485[_0x5e51('0x79')]=[{'name':_0x5e51('0xa4'),'field':_0x5e51('0x2f'),'foreignKey':_0x5e51('0xa5')}];break;case _0x5e51('0xa6'):_0x448485['childModel']=_0x5e51('0xa7');break;case _0x5e51('0xa8'):_0x448485[_0x5e51('0x78')]=_0x5e51('0x85');_0x448485[_0x5e51('0x79')]=[{'name':_0x5e51('0xa9'),'field':'id','foreignKey':_0x5e51('0xaa')}];break;case _0x5e51('0xab'):_0x448485['childModel']='CmList';break;case _0x5e51('0xac'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xad');break;case _0x5e51('0xae'):_0x448485[_0x5e51('0x78')]='CmCustomField';break;case _0x5e51('0xaf'):_0x448485['childModel']='ChatQueue';break;case _0x5e51('0xb0'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xb1');break;case _0x5e51('0xb2'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xb3');break;case _0x5e51('0xb4'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xb5');break;case _0x5e51('0xb6'):case _0x5e51('0xb7'):case _0x5e51('0xb8'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xb9');break;case'contexts':_0x448485[_0x5e51('0x78')]=_0x5e51('0xba');break;case _0x5e51('0xbb'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xbc');break;case _0x5e51('0xbd'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xbe');_0x448485['parentSections']=[{'name':_0x5e51('0x8b'),'field':_0x5e51('0x2f'),'foreignKey':_0x5e51('0xbf'),'model':_0x5e51('0xc0'),'filter':{'field':_0x5e51('0xc1'),'value':[_0x5e51('0xc2')]}},{'name':_0x5e51('0xc3'),'field':_0x5e51('0x2f'),'foreignKey':'membername','model':_0x5e51('0xc0'),'filter':{'field':'role','value':[_0x5e51('0xc4')]}},{'name':_0x5e51('0xc5'),'field':_0x5e51('0x2f'),'foreignKey':_0x5e51('0xc6'),'model':_0x5e51('0xc7'),'filter':{'field':_0x5e51('0x34'),'value':[_0x5e51('0xc8')]}},{'name':_0x5e51('0xc9'),'field':_0x5e51('0x2f'),'foreignKey':_0x5e51('0xc6'),'model':'VoiceQueue','filter':{'field':_0x5e51('0x34'),'value':[_0x5e51('0xca')]}}];break;case _0x5e51('0xcb'):_0x448485['childModel']='VoiceMusicOnHold';break;case'chanspies':_0x448485[_0x5e51('0x78')]=_0x5e51('0xcc');break;case _0x5e51('0xcd'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xce');break;case _0x5e51('0xcf'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xd0');break;case _0x5e51('0xd1'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xd2');break;case _0x5e51('0xd3'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xd4');break;case _0x5e51('0xd5'):_0x448485['childModel']='MailSubstatus';break;case _0x5e51('0xd6'):_0x448485[_0x5e51('0x78')]='OpenchannelQueue';break;case _0x5e51('0xd7'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xd8');break;case _0x5e51('0xd9'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xda');break;case _0x5e51('0xdb'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xdc');break;case _0x5e51('0xdd'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xde');break;case _0x5e51('0xdf'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xe0');break;case _0x5e51('0xe1'):case _0x5e51('0xe2'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xc7');if(_0x4090fc){_0x448485['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0x5e51('0xe3'):case'telephones':_0x448485[_0x5e51('0x78')]=_0x5e51('0xc0');if(_0x4090fc){_0x448485['parentSections']=[{'name':'Users','filter':{'field':_0x5e51('0xc1'),'value':[_0x5e51('0xe4'),_0x5e51('0xe5')]},'ignore':!![]},{'name':_0x5e51('0x8b')},{'name':'Telephones'}];}break;case _0x5e51('0xe6'):_0x448485[_0x5e51('0x78')]='ZendeskAccount';break;case _0x5e51('0xe7'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xe8');break;case _0x5e51('0xe9'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xea');break;case _0x5e51('0xeb'):_0x448485[_0x5e51('0x78')]='SugarcrmAccount';break;case _0x5e51('0xec'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xed');break;case _0x5e51('0xee'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xef');break;case _0x5e51('0xf0'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xc0');break;case _0x5e51('0xf1'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xf2');break;case'dispositions':_0x448485['childModel']=_0x5e51('0xf3');break;case'customdashboards':_0x448485[_0x5e51('0x78')]=_0x5e51('0x6c');break;case'intervals':_0x448485[_0x5e51('0x78')]=_0x5e51('0xf4');break;case _0x5e51('0xf5'):_0x448485[_0x5e51('0x78')]='Pause';break;case _0x5e51('0xf6'):_0x448485[_0x5e51('0x78')]='Schedule';break;case _0x5e51('0xf7'):_0x448485[_0x5e51('0x78')]='Sound';break;case _0x5e51('0xf8'):_0x448485[_0x5e51('0x78')]=_0x5e51('0x89');break;case _0x5e51('0xf9'):_0x448485['childModel']='Template';break;case'triggers':_0x448485[_0x5e51('0x78')]='Trigger';break;case'trunks':_0x448485[_0x5e51('0x78')]=_0x5e51('0xfa');break;case _0x5e51('0xfb'):_0x448485[_0x5e51('0x78')]='Variable';break;case _0x5e51('0xfc'):_0x448485[_0x5e51('0x78')]=_0x5e51('0xfd');break;case _0x5e51('0xfe'):_0x448485[_0x5e51('0x78')]=_0x5e51('0x7f');_0x448485['parentSections']=[{'name':_0x5e51('0xff'),'field':'id','foreignKey':_0x5e51('0x82')}];break;case _0x5e51('0x100'):_0x448485['childModel']=_0x5e51('0x101');break;case'whatsappaccounts':_0x448485[_0x5e51('0x78')]=_0x5e51('0x102');break;case _0x5e51('0x103'):_0x448485[_0x5e51('0x78')]='ScreenRecording';_0x448485[_0x5e51('0x79')]=[{'name':_0x5e51('0x8b'),'field':'id','foreignKey':_0x5e51('0x104'),'model':_0x5e51('0xc0'),'filter':{'field':_0x5e51('0xc1'),'value':[_0x5e51('0xc2')]}},{'name':_0x5e51('0xc3'),'field':'id','foreignKey':'UserId','model':_0x5e51('0xc0'),'filter':{'field':_0x5e51('0xc1'),'value':[_0x5e51('0xc4')]}}];break;default:return _0x448485;}return _0x448485;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9bc7cd2..014701f 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 _0x9689=['emit','hasOwnProperty','exports','events','../../mysqldb','update','remove'];(function(_0x4114dd,_0x2ad862){var _0x26f44c=function(_0xad2246){while(--_0xad2246){_0x4114dd['push'](_0x4114dd['shift']());}};_0x26f44c(++_0x2ad862);}(_0x9689,0x1d8));var _0x9968=function(_0xc9f7b8,_0x2a9a32){_0xc9f7b8=_0xc9f7b8-0x0;var _0x4b0270=_0x9689[_0xc9f7b8];return _0x4b0270;};'use strict';var EventEmitter=require(_0x9968('0x0'));var UserProfile=require(_0x9968('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9968('0x2'),'afterDestroy':_0x9968('0x3')};function emitEvent(_0x2f90a3){return function(_0x193a76,_0x8d4340,_0x13d238){UserProfileEvents[_0x9968('0x4')](_0x2f90a3+':'+_0x193a76['id'],_0x193a76);UserProfileEvents[_0x9968('0x4')](_0x2f90a3,_0x193a76);_0x13d238(null);};}for(var e in events){if(events[_0x9968('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x9968('0x6')]=UserProfileEvents; \ No newline at end of file +var _0xa0d3=['setMaxListeners','save','update','remove','emit','hook','exports','events','UserProfile'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xa0d3,0x1a5));var _0x3a0d=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xa0d3[_0x5d7227];return _0x15ac55;};'use strict';var EventEmitter=require(_0x3a0d('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x3a0d('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3a0d('0x2')](0x0);var events={'afterCreate':_0x3a0d('0x3'),'afterUpdate':_0x3a0d('0x4'),'afterDestroy':_0x3a0d('0x5')};function emitEvent(_0x4fc60b){return function(_0x31b15e,_0x323b10,_0xea92d3){UserProfileEvents['emit'](_0x4fc60b+':'+_0x31b15e['id'],_0x31b15e);UserProfileEvents[_0x3a0d('0x6')](_0x4fc60b,_0x31b15e);_0xea92d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x3a0d('0x7')](e,emitEvent(event));}}module[_0x3a0d('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index ae2ce6b..431df04 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 _0x087b=['./userProfile.attributes','exports','define','UserProfile','user_profiles','models','User','privacyEnabled','then','catch','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x331117,_0x396493){var _0x3a1498=function(_0x3cedc5){while(--_0x3cedc5){_0x331117['push'](_0x331117['shift']());}};_0x3a1498(++_0x396493);}(_0x087b,0x11a));var _0xb087=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x087b[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb087('0x2'));var BPromise=require('bluebird');var rp=require(_0xb087('0x3'));var fs=require('fs');var path=require(_0xb087('0x4'));var rimraf=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var attributes=require(_0xb087('0x7'));module[_0xb087('0x8')]=function(_0x40156d,_0x17d6e8){return _0x40156d[_0xb087('0x9')](_0xb087('0xa'),attributes,{'tableName':_0xb087('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x6d83fb,_0x1dbe9f,_0x80e4da){var _0x2f14bc=_0x40156d[_0xb087('0xc')];_0x2f14bc[_0xb087('0xd')]['update']({'privacyEnabled':_0x6d83fb[_0xb087('0xe')]},{'where':{'UserProfileId':_0x6d83fb['id']}})[_0xb087('0xf')](function(){_0x80e4da();})[_0xb087('0x10')](function(_0x3bce7a){_0x80e4da(_0x3bce7a);});}}});}; \ No newline at end of file +var _0x0901=['../../config/environment','./userProfile.attributes','exports','UserProfile','user_profiles','privacyEnabled','then','catch','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x52b824,_0x41db22){var _0x420ad6=function(_0x58f082){while(--_0x58f082){_0x52b824['push'](_0x52b824['shift']());}};_0x420ad6(++_0x41db22);}(_0x0901,0x134));var _0x1090=function(_0x1cb90c,_0x144050){_0x1cb90c=_0x1cb90c-0x0;var _0x2cd1dc=_0x0901[_0x1cb90c];return _0x2cd1dc;};'use strict';var _=require(_0x1090('0x0'));var util=require(_0x1090('0x1'));var logger=require(_0x1090('0x2'))(_0x1090('0x3'));var moment=require(_0x1090('0x4'));var BPromise=require(_0x1090('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1090('0x6'));var config=require(_0x1090('0x7'));var attributes=require(_0x1090('0x8'));module[_0x1090('0x9')]=function(_0x9a1121,_0x395921){return _0x9a1121['define'](_0x1090('0xa'),attributes,{'tableName':_0x1090('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5cd3f0,_0x3d2f8a,_0x160356){var _0x2c42b1=_0x9a1121['models'];_0x2c42b1['User']['update']({'privacyEnabled':_0x5cd3f0[_0x1090('0xc')]},{'where':{'UserProfileId':_0x5cd3f0['id']}})[_0x1090('0xd')](function(){_0x160356();})[_0x1090('0xe')](function(_0x4fbcfc){_0x160356(_0x4fbcfc);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 21088d3..14695d7 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 _0x2eb2=['../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1424e1,_0x2e6315){var _0x1866e8=function(_0x5d6440){while(--_0x5d6440){_0x1424e1['push'](_0x1424e1['shift']());}};_0x1866e8(++_0x2e6315);}(_0x2eb2,0x19f));var _0x22eb=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2eb2[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});config[_0x22eb('0xa')]=_[_0x22eb('0xb')](config[_0x22eb('0xa')],{'host':_0x22eb('0xc'),'port':0x18eb});var socket=require(_0x22eb('0xd'))(new Redis(config[_0x22eb('0xa')]));require(_0x22eb('0xe'))[_0x22eb('0xf')](socket);function respondWithRpcPromise(_0x3008e0,_0x489260,_0x46c197){return new BPromise(function(_0x54342e,_0x4ce9fb){return client[_0x22eb('0x10')](_0x3008e0,_0x46c197)['then'](function(_0x17b668){logger[_0x22eb('0x11')]('UserProfile,\x20%s,\x20%s',_0x489260,'request\x20sent');logger[_0x22eb('0x12')](_0x22eb('0x13'),_0x489260,_0x22eb('0x14'),JSON[_0x22eb('0x15')](_0x17b668));if(_0x17b668[_0x22eb('0x16')]){if(_0x17b668['error'][_0x22eb('0x17')]===0x1f4){logger['error'](_0x22eb('0x18'),_0x489260,_0x17b668['error'][_0x22eb('0x19')]);return _0x4ce9fb(_0x17b668[_0x22eb('0x16')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x489260,_0x17b668[_0x22eb('0x16')]['message']);return _0x54342e(_0x17b668['error'][_0x22eb('0x19')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x489260,_0x22eb('0x14'));_0x54342e(_0x17b668[_0x22eb('0x1a')][_0x22eb('0x19')]);}})[_0x22eb('0x1b')](function(_0x3b0940){logger['error'](_0x22eb('0x18'),_0x489260,_0x3b0940);_0x4ce9fb(_0x3b0940);});});} \ No newline at end of file +var _0x3eea=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','redis','register','request','then'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x43a9fa,_0x4c4642){_0x43a9fa=_0x43a9fa-0x0;var _0x4e3e15=_0x3eea[_0x43a9fa];return _0x4e3e15;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))(_0xa3ee('0x8'));var config=require(_0xa3ee('0x9'));var jayson=require(_0xa3ee('0xa'));var client=jayson[_0xa3ee('0xb')]['http']({'port':0x232a});config['redis']=_[_0xa3ee('0xc')](config['redis'],{'host':_0xa3ee('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3ee('0xe')]));require('./userProfile.socket')[_0xa3ee('0xf')](socket);function respondWithRpcPromise(_0x5ef236,_0x28aeb1,_0x1a3ab0){return new BPromise(function(_0x188966,_0x50f5e6){return client[_0xa3ee('0x10')](_0x5ef236,_0x1a3ab0)[_0xa3ee('0x11')](function(_0x4dc361){logger['info'](_0xa3ee('0x12'),_0x28aeb1,_0xa3ee('0x13'));logger[_0xa3ee('0x14')](_0xa3ee('0x15'),_0x28aeb1,'request\x20sent',JSON[_0xa3ee('0x16')](_0x4dc361));if(_0x4dc361['error']){if(_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x18')]===0x1f4){logger[_0xa3ee('0x17')](_0xa3ee('0x12'),_0x28aeb1,_0x4dc361['error'][_0xa3ee('0x19')]);return _0x50f5e6(_0x4dc361[_0xa3ee('0x17')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x28aeb1,_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x19')]);return _0x188966(_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x19')]);}else{logger['info'](_0xa3ee('0x12'),_0x28aeb1,_0xa3ee('0x13'));_0x188966(_0x4dc361[_0xa3ee('0x1a')][_0xa3ee('0x19')]);}})[_0xa3ee('0x1b')](function(_0x4aac0e){logger[_0xa3ee('0x17')](_0xa3ee('0x12'),_0x28aeb1,_0x4aac0e);_0x50f5e6(_0x4aac0e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 68efeb0..97a2fdb 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 _0x63ec=['length','userProfile:','save','emit','removeListener','register'];(function(_0x3841cc,_0x34c50d){var _0x4bd9f3=function(_0x5c6de8){while(--_0x5c6de8){_0x3841cc['push'](_0x3841cc['shift']());}};_0x4bd9f3(++_0x34c50d);}(_0x63ec,0xaa));var _0xc63e=function(_0x598029,_0x157845){_0x598029=_0x598029-0x0;var _0x13a226=_0x63ec[_0x598029];return _0x13a226;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xc63e('0x0'),'remove','update'];function createListener(_0x3f06d6,_0x4b8f09){return function(_0x32bcfc){_0x4b8f09[_0xc63e('0x1')](_0x3f06d6,_0x32bcfc);};}function removeListener(_0x1e53a0,_0x3d7316){return function(){UserProfileEvents[_0xc63e('0x2')](_0x1e53a0,_0x3d7316);};}exports[_0xc63e('0x3')]=function(_0x5e3d14){for(var _0x5b32d6=0x0,_0x17a7c6=events[_0xc63e('0x4')];_0x5b32d6<_0x17a7c6;_0x5b32d6++){var _0x5520ed=events[_0x5b32d6];var _0x51f5e8=createListener(_0xc63e('0x5')+_0x5520ed,_0x5e3d14);UserProfileEvents['on'](_0x5520ed,_0x51f5e8);}}; \ No newline at end of file +var _0x0546=['register','length','userProfile:','save','remove','update','removeListener'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x0546,0x176));var _0x6054=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x0546[_0x47623f];return _0x282ce8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x6054('0x0'),_0x6054('0x1'),_0x6054('0x2')];function createListener(_0xf6b4a6,_0x1a204f){return function(_0x54110a){_0x1a204f['emit'](_0xf6b4a6,_0x54110a);};}function removeListener(_0x3d2f0b,_0x22fa62){return function(){UserProfileEvents[_0x6054('0x3')](_0x3d2f0b,_0x22fa62);};}exports[_0x6054('0x4')]=function(_0x3f634d){for(var _0x1e2859=0x0,_0x483597=events[_0x6054('0x5')];_0x1e2859<_0x483597;_0x1e2859++){var _0xc6dca5=events[_0x1e2859];var _0x280caa=createListener(_0x6054('0x6')+_0xc6dca5,_0x3f634d);UserProfileEvents['on'](_0xc6dca5,_0x280caa);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c04c674..af3e4ea 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 _0xfad5=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3ed0ec,_0x44ece7){var _0x4b32f4=function(_0x3bf38e){while(--_0x3bf38e){_0x3ed0ec['push'](_0x3ed0ec['shift']());}};_0x4b32f4(++_0x44ece7);}(_0xfad5,0xd8));var _0x5fad=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xfad5[_0x58965a];return _0x254efc;};'use strict';var multer=require(_0x5fad('0x0'));var util=require(_0x5fad('0x1'));var path=require(_0x5fad('0x2'));var timeout=require(_0x5fad('0x3'));var express=require(_0x5fad('0x4'));var router=express[_0x5fad('0x5')]();var fs_extra=require(_0x5fad('0x6'));var auth=require(_0x5fad('0x7'));var interaction=require(_0x5fad('0x8'));var config=require(_0x5fad('0x9'));var controller=require(_0x5fad('0xa'));router['get']('/',auth[_0x5fad('0xb')](),controller[_0x5fad('0xc')]);router[_0x5fad('0xd')]('/describe',auth[_0x5fad('0xb')](),controller['describe']);router['get'](_0x5fad('0xe'),auth[_0x5fad('0xb')](),controller['show']);router[_0x5fad('0xf')]('/',auth[_0x5fad('0xb')](),controller[_0x5fad('0x10')]);router[_0x5fad('0x11')]('/:id',auth[_0x5fad('0xb')](),controller[_0x5fad('0x12')]);router[_0x5fad('0x13')](_0x5fad('0xe'),auth[_0x5fad('0xb')](),controller[_0x5fad('0x14')]);module[_0x5fad('0x15')]=router; \ No newline at end of file +var _0x45bd=['Router','../../components/auth/service','./userProfileResource.controller','isAuthenticated','/describe','describe','get','show','create','/:id','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xf5e385,_0xc2bb05){var _0x1b2871=function(_0x1ef108){while(--_0x1ef108){_0xf5e385['push'](_0xf5e385['shift']());}};_0x1b2871(++_0xc2bb05);}(_0x45bd,0x1b5));var _0xd45b=function(_0x417887,_0x1ada63){_0x417887=_0x417887-0x0;var _0x32e235=_0x45bd[_0x417887];return _0x32e235;};'use strict';var multer=require(_0xd45b('0x0'));var util=require(_0xd45b('0x1'));var path=require(_0xd45b('0x2'));var timeout=require(_0xd45b('0x3'));var express=require(_0xd45b('0x4'));var router=express[_0xd45b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd45b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd45b('0x7'));router['get']('/',auth[_0xd45b('0x8')](),controller['index']);router['get'](_0xd45b('0x9'),auth[_0xd45b('0x8')](),controller[_0xd45b('0xa')]);router[_0xd45b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xd45b('0xc')]);router['post']('/',auth[_0xd45b('0x8')](),controller[_0xd45b('0xd')]);router['put'](_0xd45b('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xd45b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd45b('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 0be648c..687753f 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 _0xca49=['STRING','sequelize','exports'];(function(_0x2bf089,_0x51b8df){var _0x2808ab=function(_0x48bee0){while(--_0x48bee0){_0x2bf089['push'](_0x2bf089['shift']());}};_0x2808ab(++_0x51b8df);}(_0xca49,0xbb));var _0x9ca4=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xca49[_0x415603];return _0x131e72;};'use strict';var Sequelize=require(_0x9ca4('0x0'));module[_0x9ca4('0x1')]={'name':{'type':Sequelize[_0x9ca4('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x9ca4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd361=['INTEGER','sequelize','STRING'];(function(_0x63ce9f,_0x431e5c){var _0x1b644a=function(_0x2e0a8b){while(--_0x2e0a8b){_0x63ce9f['push'](_0x63ce9f['shift']());}};_0x1b644a(++_0x431e5c);}(_0xd361,0x9a));var _0x1d36=function(_0x4f4612,_0x36ea9e){_0x4f4612=_0x4f4612-0x0;var _0x403d37=_0xd361[_0x4f4612];return _0x403d37;};'use strict';var Sequelize=require(_0x1d36('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d36('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1d36('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1d36('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0e634d6..0493058 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 _0xc4e1=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','UserProfileResource','include','findAll','catch','show','keys','includeAll','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','query','filters','model'];(function(_0x394481,_0x5c5321){var _0x28355c=function(_0x50bbe2){while(--_0x50bbe2){_0x394481['push'](_0x394481['shift']());}};_0x28355c(++_0x5c5321);}(_0xc4e1,0x172));var _0x1c4e=function(_0x124a1d,_0x3424ba){_0x124a1d=_0x124a1d-0x0;var _0x374640=_0xc4e1[_0x124a1d];return _0x374640;};'use strict';var emlformat=require(_0x1c4e('0x0'));var rimraf=require(_0x1c4e('0x1'));var zipdir=require(_0x1c4e('0x2'));var jsonpatch=require(_0x1c4e('0x3'));var rp=require('request-promise');var moment=require(_0x1c4e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1c4e('0x5'));var util=require('util');var path=require(_0x1c4e('0x6'));var sox=require('sox');var csv=require(_0x1c4e('0x7'));var ejs=require(_0x1c4e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c4e('0x9'));var squel=require(_0x1c4e('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c4e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c4e('0xc'));var Papa=require('papaparse');var Redis=require(_0x1c4e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1c4e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c4e('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1c4e('0x10'));var licenseUtil=require(_0x1c4e('0x11'));var db=require(_0x1c4e('0x12'))['db'];function respondWithStatusCode(_0x4f4eec,_0x275b90){_0x275b90=_0x275b90||0xcc;return function(_0x2eb80a){if(_0x2eb80a){return _0x4f4eec['sendStatus'](_0x275b90);}return _0x4f4eec['status'](_0x275b90)['end']();};}function respondWithResult(_0x119d51,_0x2b6459){_0x2b6459=_0x2b6459||0xc8;return function(_0x5889db){if(_0x5889db){return _0x119d51[_0x1c4e('0x13')](_0x2b6459)[_0x1c4e('0x14')](_0x5889db);}};}function respondWithFilteredResult(_0x10555f,_0x31708b){return function(_0x2d55bb){if(_0x2d55bb){var _0x4b12b3=typeof _0x31708b[_0x1c4e('0x15')]===_0x1c4e('0x16')&&typeof _0x31708b['limit']==='undefined';var _0x572737=_0x2d55bb['count'];var _0x285d65=_0x4b12b3?0x0:_0x31708b[_0x1c4e('0x15')];var _0x4faa6a=_0x4b12b3?_0x2d55bb[_0x1c4e('0x17')]:_0x31708b[_0x1c4e('0x15')]+_0x31708b[_0x1c4e('0x18')];var _0x3ae385;if(_0x4faa6a>=_0x572737){_0x4faa6a=_0x572737;_0x3ae385=0xc8;}else{_0x3ae385=0xce;}_0x10555f[_0x1c4e('0x13')](_0x3ae385);return _0x10555f[_0x1c4e('0x19')](_0x1c4e('0x1a'),_0x285d65+'-'+_0x4faa6a+'/'+_0x572737)[_0x1c4e('0x14')](_0x2d55bb);}return null;};}function patchUpdates(_0x24a1c7){return function(_0x491fdb){try{jsonpatch[_0x1c4e('0x1b')](_0x491fdb,_0x24a1c7,!![]);}catch(_0x4bfc35){return BPromise[_0x1c4e('0x1c')](_0x4bfc35);}return _0x491fdb[_0x1c4e('0x1d')]();};}function saveUpdates(_0x300b16,_0x1353e4){return function(_0xb79c5){if(_0xb79c5){return _0xb79c5['update'](_0x300b16)[_0x1c4e('0x1e')](function(_0xa9714b){return _0xa9714b;});}return null;};}function removeEntity(_0x20f93d,_0x41bbe6){return function(_0x18ee91){if(_0x18ee91){return _0x18ee91[_0x1c4e('0x1f')]()['then'](function(){_0x20f93d[_0x1c4e('0x13')](0xcc)[_0x1c4e('0x20')]();});}};}function handleEntityNotFound(_0x1b235d,_0x1ec251){return function(_0x2bf026){if(!_0x2bf026){_0x1b235d[_0x1c4e('0x21')](0x194);}return _0x2bf026;};}function handleError(_0x57364b,_0x133b6a){_0x133b6a=_0x133b6a||0x1f4;return function(_0x2e2d32){logger['error'](_0x2e2d32[_0x1c4e('0x22')]);if(_0x2e2d32[_0x1c4e('0x23')]){delete _0x2e2d32[_0x1c4e('0x23')];}_0x57364b[_0x1c4e('0x13')](_0x133b6a)['send'](_0x2e2d32);};}exports[_0x1c4e('0x24')]=function(_0xd843da,_0x2ae1d1){var _0x536e52={},_0x111bec={},_0x2c48c2={'count':0x0,'rows':[]};var _0x160afa=_[_0x1c4e('0x25')](db['UserProfileResource'][_0x1c4e('0x26')],function(_0x37f50b){return{'name':_0x37f50b[_0x1c4e('0x27')],'type':_0x37f50b[_0x1c4e('0x28')]['key']};});_0x111bec['model']=_[_0x1c4e('0x25')](_0x160afa,_0x1c4e('0x23'));_0x111bec[_0x1c4e('0x29')]=_['keys'](_0xd843da[_0x1c4e('0x29')]);_0x111bec[_0x1c4e('0x2a')]=_['intersection'](_0x111bec[_0x1c4e('0x2b')],_0x111bec[_0x1c4e('0x29')]);_0x536e52[_0x1c4e('0x2c')]=_[_0x1c4e('0x2d')](_0x111bec[_0x1c4e('0x2b')],qs['fields'](_0xd843da[_0x1c4e('0x29')][_0x1c4e('0x2e')]));_0x536e52[_0x1c4e('0x2c')]=_0x536e52[_0x1c4e('0x2c')][_0x1c4e('0x2f')]?_0x536e52['attributes']:_0x111bec[_0x1c4e('0x2b')];if(!_0xd843da['query'][_0x1c4e('0x30')](_0x1c4e('0x31'))){_0x536e52[_0x1c4e('0x18')]=qs[_0x1c4e('0x18')](_0xd843da[_0x1c4e('0x29')]['limit']);_0x536e52[_0x1c4e('0x15')]=qs[_0x1c4e('0x15')](_0xd843da[_0x1c4e('0x29')][_0x1c4e('0x15')]);}_0x536e52[_0x1c4e('0x32')]=qs[_0x1c4e('0x33')](_0xd843da[_0x1c4e('0x29')][_0x1c4e('0x33')]);_0x536e52[_0x1c4e('0x34')]=qs[_0x1c4e('0x2a')](_[_0x1c4e('0x35')](_0xd843da[_0x1c4e('0x29')],_0x111bec[_0x1c4e('0x2a')]),_0x160afa);if(_0xd843da['query'][_0x1c4e('0x36')]){_0x536e52[_0x1c4e('0x34')]=_[_0x1c4e('0x37')](_0x536e52[_0x1c4e('0x34')],{'$or':_[_0x1c4e('0x25')](_0x160afa,function(_0x597a22){if(_0x597a22[_0x1c4e('0x28')]!=='VIRTUAL'){var _0x5edd4c={};_0x5edd4c[_0x597a22[_0x1c4e('0x23')]]={'$like':'%'+_0xd843da['query'][_0x1c4e('0x36')]+'%'};return _0x5edd4c;}})});}_0x536e52=_[_0x1c4e('0x37')]({},_0x536e52,_0xd843da['options']);var _0x4aff8b={'where':_0x536e52[_0x1c4e('0x34')]};return db[_0x1c4e('0x38')][_0x1c4e('0x17')](_0x4aff8b)[_0x1c4e('0x1e')](function(_0x536836){_0x2c48c2['count']=_0x536836;if(_0xd843da['query']['includeAll']){_0x536e52[_0x1c4e('0x39')]=[{'all':!![]}];}return db[_0x1c4e('0x38')][_0x1c4e('0x3a')](_0x536e52);})[_0x1c4e('0x1e')](function(_0x3c19af){_0x2c48c2['rows']=_0x3c19af;return _0x2c48c2;})['then'](respondWithFilteredResult(_0x2ae1d1,_0x536e52))[_0x1c4e('0x3b')](handleError(_0x2ae1d1,null));};exports[_0x1c4e('0x3c')]=function(_0x1b5314,_0x1036e0){var _0x5179d9={'raw':![],'where':{'id':_0x1b5314['params']['id']}},_0xb1102d={};_0xb1102d['model']=_[_0x1c4e('0x3d')](db[_0x1c4e('0x38')]['rawAttributes']);_0xb1102d[_0x1c4e('0x29')]=_[_0x1c4e('0x3d')](_0x1b5314[_0x1c4e('0x29')]);_0xb1102d[_0x1c4e('0x2a')]=_[_0x1c4e('0x2d')](_0xb1102d['model'],_0xb1102d[_0x1c4e('0x29')]);_0x5179d9['attributes']=_[_0x1c4e('0x2d')](_0xb1102d['model'],qs[_0x1c4e('0x2e')](_0x1b5314[_0x1c4e('0x29')][_0x1c4e('0x2e')]));_0x5179d9[_0x1c4e('0x2c')]=_0x5179d9[_0x1c4e('0x2c')][_0x1c4e('0x2f')]?_0x5179d9[_0x1c4e('0x2c')]:_0xb1102d[_0x1c4e('0x2b')];if(_0x1b5314[_0x1c4e('0x29')][_0x1c4e('0x3e')]){_0x5179d9[_0x1c4e('0x39')]=[{'all':!![]}];}_0x5179d9=_['merge']({},_0x5179d9,_0x1b5314['options']);return db[_0x1c4e('0x38')]['find'](_0x5179d9)['then'](handleEntityNotFound(_0x1036e0,null))[_0x1c4e('0x1e')](respondWithResult(_0x1036e0,null))[_0x1c4e('0x3b')](handleError(_0x1036e0,null));};exports[_0x1c4e('0x3f')]=function(_0xfd9b0e,_0x1cceb9){return db[_0x1c4e('0x38')][_0x1c4e('0x3f')](_0xfd9b0e[_0x1c4e('0x40')],{})[_0x1c4e('0x1e')](respondWithResult(_0x1cceb9,0xc9))[_0x1c4e('0x3b')](handleError(_0x1cceb9,null));};exports[_0x1c4e('0x41')]=function(_0x54ac0f,_0x219b6b){if(_0x54ac0f[_0x1c4e('0x40')]['id']){delete _0x54ac0f[_0x1c4e('0x40')]['id'];}return db[_0x1c4e('0x38')][_0x1c4e('0x42')]({'where':{'id':_0x54ac0f[_0x1c4e('0x43')]['id']}})[_0x1c4e('0x1e')](handleEntityNotFound(_0x219b6b,null))[_0x1c4e('0x1e')](saveUpdates(_0x54ac0f['body'],null))[_0x1c4e('0x1e')](respondWithResult(_0x219b6b,null))[_0x1c4e('0x3b')](handleError(_0x219b6b,null));};exports['destroy']=function(_0x65c265,_0x36ad9d){return db[_0x1c4e('0x38')]['find']({'where':{'id':_0x65c265['params']['id']}})['then'](handleEntityNotFound(_0x36ad9d,null))[_0x1c4e('0x1e')](removeEntity(_0x36ad9d,null))[_0x1c4e('0x3b')](handleError(_0x36ad9d,null));};exports[_0x1c4e('0x44')]=function(_0x353f90,_0x5349f3){return db['UserProfileResource'][_0x1c4e('0x44')]()[_0x1c4e('0x1e')](respondWithResult(_0x5349f3,null))[_0x1c4e('0x3b')](handleError(_0x5349f3,null));}; \ No newline at end of file +var _0xcf3d=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','reject','update','destroy','then','end','stack','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','catch','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x35b378,_0x35674d){var _0x592edd=function(_0x342b42){while(--_0x342b42){_0x35b378['push'](_0x35b378['shift']());}};_0x592edd(++_0x35674d);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x3c6402,_0x25a5e8){_0x3c6402=_0x3c6402-0x0;var _0x566b5a=_0xcf3d[_0x3c6402];return _0x566b5a;};'use strict';var emlformat=require(_0xdcf3('0x0'));var rimraf=require(_0xdcf3('0x1'));var zipdir=require(_0xdcf3('0x2'));var jsonpatch=require(_0xdcf3('0x3'));var rp=require('request-promise');var moment=require(_0xdcf3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcf3('0x5'));var util=require(_0xdcf3('0x6'));var path=require(_0xdcf3('0x7'));var sox=require(_0xdcf3('0x8'));var csv=require(_0xdcf3('0x9'));var ejs=require(_0xdcf3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcf3('0xb'));var squel=require('squel');var crypto=require(_0xdcf3('0xc'));var jsforce=require(_0xdcf3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdcf3('0xe'));var Redis=require(_0xdcf3('0xf'));var authService=require(_0xdcf3('0x10'));var qs=require(_0xdcf3('0x11'));var as=require(_0xdcf3('0x12'));var hardwareService=require(_0xdcf3('0x13'));var logger=require(_0xdcf3('0x14'))(_0xdcf3('0x15'));var utils=require(_0xdcf3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdcf3('0x17'));var db=require(_0xdcf3('0x18'))['db'];function respondWithStatusCode(_0x4b1623,_0x40ddf7){_0x40ddf7=_0x40ddf7||0xcc;return function(_0x2e1fff){if(_0x2e1fff){return _0x4b1623[_0xdcf3('0x19')](_0x40ddf7);}return _0x4b1623[_0xdcf3('0x1a')](_0x40ddf7)['end']();};}function respondWithResult(_0x2d0bc2,_0x4b003f){_0x4b003f=_0x4b003f||0xc8;return function(_0x4d5417){if(_0x4d5417){return _0x2d0bc2[_0xdcf3('0x1a')](_0x4b003f)['json'](_0x4d5417);}};}function respondWithFilteredResult(_0x1b34b4,_0x2ebc69){return function(_0x1af727){if(_0x1af727){var _0x2c5436=typeof _0x2ebc69['offset']===_0xdcf3('0x1b')&&typeof _0x2ebc69[_0xdcf3('0x1c')]==='undefined';var _0xc64c2a=_0x1af727[_0xdcf3('0x1d')];var _0x441142=_0x2c5436?0x0:_0x2ebc69[_0xdcf3('0x1e')];var _0x1c1df7=_0x2c5436?_0x1af727[_0xdcf3('0x1d')]:_0x2ebc69[_0xdcf3('0x1e')]+_0x2ebc69[_0xdcf3('0x1c')];var _0x27a958;if(_0x1c1df7>=_0xc64c2a){_0x1c1df7=_0xc64c2a;_0x27a958=0xc8;}else{_0x27a958=0xce;}_0x1b34b4[_0xdcf3('0x1a')](_0x27a958);return _0x1b34b4[_0xdcf3('0x1f')]('Content-Range',_0x441142+'-'+_0x1c1df7+'/'+_0xc64c2a)['json'](_0x1af727);}return null;};}function patchUpdates(_0x3a4512){return function(_0x427890){try{jsonpatch['apply'](_0x427890,_0x3a4512,!![]);}catch(_0x4e3e41){return BPromise[_0xdcf3('0x20')](_0x4e3e41);}return _0x427890['save']();};}function saveUpdates(_0x5622de,_0x71009c){return function(_0x273591){if(_0x273591){return _0x273591[_0xdcf3('0x21')](_0x5622de)['then'](function(_0x40b9f1){return _0x40b9f1;});}return null;};}function removeEntity(_0x4d340a,_0x2cc3ce){return function(_0x524ab0){if(_0x524ab0){return _0x524ab0[_0xdcf3('0x22')]()[_0xdcf3('0x23')](function(){_0x4d340a[_0xdcf3('0x1a')](0xcc)[_0xdcf3('0x24')]();});}};}function handleEntityNotFound(_0x5b6fc3,_0x16ea83){return function(_0x5c8557){if(!_0x5c8557){_0x5b6fc3[_0xdcf3('0x19')](0x194);}return _0x5c8557;};}function handleError(_0x3fbd96,_0x7df45){_0x7df45=_0x7df45||0x1f4;return function(_0x4c7412){logger['error'](_0x4c7412[_0xdcf3('0x25')]);if(_0x4c7412['name']){delete _0x4c7412['name'];}_0x3fbd96['status'](_0x7df45)['send'](_0x4c7412);};}exports[_0xdcf3('0x26')]=function(_0x4cd417,_0x3165a5){var _0x56964c={},_0x3b34a5={},_0x4cc17a={'count':0x0,'rows':[]};var _0x23a893=_[_0xdcf3('0x27')](db[_0xdcf3('0x28')][_0xdcf3('0x29')],function(_0x18a560){return{'name':_0x18a560[_0xdcf3('0x2a')],'type':_0x18a560[_0xdcf3('0x2b')][_0xdcf3('0x2c')]};});_0x3b34a5[_0xdcf3('0x2d')]=_[_0xdcf3('0x27')](_0x23a893,_0xdcf3('0x2e'));_0x3b34a5[_0xdcf3('0x2f')]=_['keys'](_0x4cd417[_0xdcf3('0x2f')]);_0x3b34a5[_0xdcf3('0x30')]=_[_0xdcf3('0x31')](_0x3b34a5[_0xdcf3('0x2d')],_0x3b34a5[_0xdcf3('0x2f')]);_0x56964c[_0xdcf3('0x32')]=_[_0xdcf3('0x31')](_0x3b34a5[_0xdcf3('0x2d')],qs[_0xdcf3('0x33')](_0x4cd417['query'][_0xdcf3('0x33')]));_0x56964c['attributes']=_0x56964c[_0xdcf3('0x32')][_0xdcf3('0x34')]?_0x56964c[_0xdcf3('0x32')]:_0x3b34a5[_0xdcf3('0x2d')];if(!_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x35')]('nolimit')){_0x56964c[_0xdcf3('0x1c')]=qs[_0xdcf3('0x1c')](_0x4cd417['query'][_0xdcf3('0x1c')]);_0x56964c[_0xdcf3('0x1e')]=qs['offset'](_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x1e')]);}_0x56964c[_0xdcf3('0x36')]=qs[_0xdcf3('0x37')](_0x4cd417['query'][_0xdcf3('0x37')]);_0x56964c[_0xdcf3('0x38')]=qs['filters'](_['pick'](_0x4cd417['query'],_0x3b34a5[_0xdcf3('0x30')]),_0x23a893);if(_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x39')]){_0x56964c[_0xdcf3('0x38')]=_[_0xdcf3('0x3a')](_0x56964c[_0xdcf3('0x38')],{'$or':_[_0xdcf3('0x27')](_0x23a893,function(_0x321978){if(_0x321978[_0xdcf3('0x2b')]!=='VIRTUAL'){var _0x48d9bb={};_0x48d9bb[_0x321978[_0xdcf3('0x2e')]]={'$like':'%'+_0x4cd417['query'][_0xdcf3('0x39')]+'%'};return _0x48d9bb;}})});}_0x56964c=_[_0xdcf3('0x3a')]({},_0x56964c,_0x4cd417['options']);var _0x5ba362={'where':_0x56964c[_0xdcf3('0x38')]};return db['UserProfileResource']['count'](_0x5ba362)[_0xdcf3('0x23')](function(_0x5b472c){_0x4cc17a[_0xdcf3('0x1d')]=_0x5b472c;if(_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x3b')]){_0x56964c['include']=[{'all':!![]}];}return db[_0xdcf3('0x28')][_0xdcf3('0x3c')](_0x56964c);})[_0xdcf3('0x23')](function(_0x169848){_0x4cc17a[_0xdcf3('0x3d')]=_0x169848;return _0x4cc17a;})[_0xdcf3('0x23')](respondWithFilteredResult(_0x3165a5,_0x56964c))[_0xdcf3('0x3e')](handleError(_0x3165a5,null));};exports['show']=function(_0x3a32c6,_0x2e2ba0){var _0x649485={'raw':![],'where':{'id':_0x3a32c6[_0xdcf3('0x3f')]['id']}},_0x499c8e={};_0x499c8e[_0xdcf3('0x2d')]=_['keys'](db[_0xdcf3('0x28')][_0xdcf3('0x29')]);_0x499c8e['query']=_[_0xdcf3('0x40')](_0x3a32c6[_0xdcf3('0x2f')]);_0x499c8e[_0xdcf3('0x30')]=_[_0xdcf3('0x31')](_0x499c8e['model'],_0x499c8e[_0xdcf3('0x2f')]);_0x649485['attributes']=_[_0xdcf3('0x31')](_0x499c8e[_0xdcf3('0x2d')],qs[_0xdcf3('0x33')](_0x3a32c6[_0xdcf3('0x2f')][_0xdcf3('0x33')]));_0x649485[_0xdcf3('0x32')]=_0x649485[_0xdcf3('0x32')][_0xdcf3('0x34')]?_0x649485['attributes']:_0x499c8e[_0xdcf3('0x2d')];if(_0x3a32c6[_0xdcf3('0x2f')][_0xdcf3('0x3b')]){_0x649485['include']=[{'all':!![]}];}_0x649485=_['merge']({},_0x649485,_0x3a32c6[_0xdcf3('0x41')]);return db[_0xdcf3('0x28')][_0xdcf3('0x42')](_0x649485)[_0xdcf3('0x23')](handleEntityNotFound(_0x2e2ba0,null))[_0xdcf3('0x23')](respondWithResult(_0x2e2ba0,null))['catch'](handleError(_0x2e2ba0,null));};exports[_0xdcf3('0x43')]=function(_0x51f4d4,_0x4ded3f){return db[_0xdcf3('0x28')][_0xdcf3('0x43')](_0x51f4d4[_0xdcf3('0x44')],{})[_0xdcf3('0x23')](respondWithResult(_0x4ded3f,0xc9))[_0xdcf3('0x3e')](handleError(_0x4ded3f,null));};exports[_0xdcf3('0x21')]=function(_0x48abd5,_0x1ebf31){if(_0x48abd5[_0xdcf3('0x44')]['id']){delete _0x48abd5[_0xdcf3('0x44')]['id'];}return db[_0xdcf3('0x28')]['find']({'where':{'id':_0x48abd5[_0xdcf3('0x3f')]['id']}})[_0xdcf3('0x23')](handleEntityNotFound(_0x1ebf31,null))[_0xdcf3('0x23')](saveUpdates(_0x48abd5[_0xdcf3('0x44')],null))[_0xdcf3('0x23')](respondWithResult(_0x1ebf31,null))[_0xdcf3('0x3e')](handleError(_0x1ebf31,null));};exports[_0xdcf3('0x22')]=function(_0x20cdbc,_0x7dded8){return db['UserProfileResource']['find']({'where':{'id':_0x20cdbc[_0xdcf3('0x3f')]['id']}})[_0xdcf3('0x23')](handleEntityNotFound(_0x7dded8,null))[_0xdcf3('0x23')](removeEntity(_0x7dded8,null))['catch'](handleError(_0x7dded8,null));};exports[_0xdcf3('0x45')]=function(_0x5a604b,_0x8dc91a){return db['UserProfileResource'][_0xdcf3('0x45')]()[_0xdcf3('0x23')](respondWithResult(_0x8dc91a,null))[_0xdcf3('0x3e')](handleError(_0x8dc91a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 59564b5..8da97e9 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 _0x46e1=['compositeIndex','resourceId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0x44d3d3,_0x30dbe6){var _0x5c828e=function(_0x3b4cf1){while(--_0x3b4cf1){_0x44d3d3['push'](_0x44d3d3['shift']());}};_0x5c828e(++_0x30dbe6);}(_0x46e1,0x144));var _0x146e=function(_0x35a188,_0x5d97ad){_0x35a188=_0x35a188-0x0;var _0x3c0014=_0x46e1[_0x35a188];return _0x3c0014;};'use strict';var _=require(_0x146e('0x0'));var util=require(_0x146e('0x1'));var logger=require(_0x146e('0x2'))('api');var moment=require(_0x146e('0x3'));var BPromise=require(_0x146e('0x4'));var rp=require(_0x146e('0x5'));var fs=require('fs');var path=require(_0x146e('0x6'));var rimraf=require(_0x146e('0x7'));var config=require(_0x146e('0x8'));var attributes=require(_0x146e('0x9'));module[_0x146e('0xa')]=function(_0x5b0487,_0x5a0fb7){return _0x5b0487[_0x146e('0xb')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x146e('0xc'),'fields':[_0x146e('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1bc=['define','UserProfileResource','compositeIndex','resourceId','sectionId','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x27f9e2,_0x3a410c){var _0xef376d=function(_0x566bec){while(--_0x566bec){_0x27f9e2['push'](_0x27f9e2['shift']());}};_0xef376d(++_0x3a410c);}(_0xa1bc,0x1b5));var _0xca1b=function(_0x5a8538,_0x370845){_0x5a8538=_0x5a8538-0x0;var _0x2409db=_0xa1bc[_0x5a8538];return _0x2409db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xca1b('0x0'))(_0xca1b('0x1'));var moment=require('moment');var BPromise=require(_0xca1b('0x2'));var rp=require(_0xca1b('0x3'));var fs=require('fs');var path=require(_0xca1b('0x4'));var rimraf=require(_0xca1b('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xca1b('0x6')]=function(_0x4fa49a,_0x330fd3){return _0x4fa49a[_0xca1b('0x7')](_0xca1b('0x8'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xca1b('0x9'),'fields':[_0xca1b('0xa'),_0xca1b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e6d1383..e132b6c 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 _0x426b=['then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0x426b,0x1d8));var _0xb426=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x426b[_0x2ddfd9];return _0x2668f0;};'use strict';var _=require(_0xb426('0x0'));var util=require(_0xb426('0x1'));var moment=require('moment');var BPromise=require(_0xb426('0x2'));var rs=require(_0xb426('0x3'));var fs=require('fs');var Redis=require(_0xb426('0x4'));var db=require(_0xb426('0x5'))['db'];var utils=require(_0xb426('0x6'));var logger=require('../../config/logger')(_0xb426('0x7'));var config=require(_0xb426('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb426('0x9')][_0xb426('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45565d,_0x3628dd,_0x27c2a0){return new BPromise(function(_0x3ec6b7,_0x34633b){return client['request'](_0x45565d,_0x27c2a0)[_0xb426('0xb')](function(_0xa6e69b){logger[_0xb426('0xc')](_0xb426('0xd'),_0x3628dd,_0xb426('0xe'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3628dd,_0xb426('0xe'),JSON[_0xb426('0xf')](_0xa6e69b));if(_0xa6e69b['error']){if(_0xa6e69b[_0xb426('0x10')][_0xb426('0x11')]===0x1f4){logger[_0xb426('0x10')](_0xb426('0xd'),_0x3628dd,_0xa6e69b[_0xb426('0x10')][_0xb426('0x12')]);return _0x34633b(_0xa6e69b['error'][_0xb426('0x12')]);}logger['error'](_0xb426('0xd'),_0x3628dd,_0xa6e69b[_0xb426('0x10')][_0xb426('0x12')]);return _0x3ec6b7(_0xa6e69b[_0xb426('0x10')]['message']);}else{logger[_0xb426('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x3628dd,'request\x20sent');_0x3ec6b7(_0xa6e69b[_0xb426('0x13')][_0xb426('0x12')]);}})[_0xb426('0x14')](function(_0x197408){logger[_0xb426('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x3628dd,_0x197408);_0x34633b(_0x197408);});});} \ No newline at end of file +var _0x5216=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2a55f6,_0x34c429){var _0x5786c7=function(_0x197f9b){while(--_0x197f9b){_0x2a55f6['push'](_0x2a55f6['shift']());}};_0x5786c7(++_0x34c429);}(_0x5216,0x165));var _0x6521=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5216[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x6521('0x0'));var moment=require(_0x6521('0x1'));var BPromise=require(_0x6521('0x2'));var rs=require(_0x6521('0x3'));var fs=require('fs');var Redis=require(_0x6521('0x4'));var db=require(_0x6521('0x5'))['db'];var utils=require(_0x6521('0x6'));var logger=require('../../config/logger')(_0x6521('0x7'));var config=require('../../config/environment');var jayson=require(_0x6521('0x8'));var client=jayson[_0x6521('0x9')][_0x6521('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42f4a8,_0x1e9433,_0x429985){return new BPromise(function(_0x403cf6,_0x45177a){return client[_0x6521('0xb')](_0x42f4a8,_0x429985)[_0x6521('0xc')](function(_0x5b60d1){logger[_0x6521('0xd')](_0x6521('0xe'),_0x1e9433,_0x6521('0xf'));logger[_0x6521('0x10')](_0x6521('0x11'),_0x1e9433,_0x6521('0xf'),JSON[_0x6521('0x12')](_0x5b60d1));if(_0x5b60d1[_0x6521('0x13')]){if(_0x5b60d1[_0x6521('0x13')]['code']===0x1f4){logger[_0x6521('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1e9433,_0x5b60d1[_0x6521('0x13')][_0x6521('0x14')]);return _0x45177a(_0x5b60d1[_0x6521('0x13')][_0x6521('0x14')]);}logger[_0x6521('0x13')](_0x6521('0xe'),_0x1e9433,_0x5b60d1[_0x6521('0x13')][_0x6521('0x14')]);return _0x403cf6(_0x5b60d1[_0x6521('0x13')]['message']);}else{logger['info'](_0x6521('0xe'),_0x1e9433,_0x6521('0xf'));_0x403cf6(_0x5b60d1[_0x6521('0x15')][_0x6521('0x14')]);}})['catch'](function(_0x129bc5){logger['error'](_0x6521('0xe'),_0x1e9433,_0x129bc5);_0x45177a(_0x129bc5);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e950cbd..5a84718 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 _0x0949=['exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','/:id','show','put','delete','destroy'];(function(_0x1adb1d,_0x799f9b){var _0x23d39c=function(_0xbd8f16){while(--_0xbd8f16){_0x1adb1d['push'](_0x1adb1d['shift']());}};_0x23d39c(++_0x799f9b);}(_0x0949,0x157));var _0x9094=function(_0x56968c,_0x1e4877){_0x56968c=_0x56968c-0x0;var _0x3e3524=_0x0949[_0x56968c];return _0x3e3524;};'use strict';var multer=require('multer');var util=require(_0x9094('0x0'));var path=require(_0x9094('0x1'));var timeout=require('connect-timeout');var express=require(_0x9094('0x2'));var router=express[_0x9094('0x3')]();var fs_extra=require(_0x9094('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9094('0x5'));var config=require(_0x9094('0x6'));var controller=require(_0x9094('0x7'));router[_0x9094('0x8')]('/',auth['isAuthenticated'](),controller[_0x9094('0x9')]);router[_0x9094('0x8')](_0x9094('0xa'),auth[_0x9094('0xb')](),controller['describe']);router[_0x9094('0x8')](_0x9094('0xc'),auth['isAuthenticated'](),controller[_0x9094('0xd')]);router['post']('/',auth[_0x9094('0xb')](),controller['create']);router[_0x9094('0xe')](_0x9094('0xc'),auth[_0x9094('0xb')](),controller['update']);router[_0x9094('0xf')](_0x9094('0xc'),auth['isAuthenticated'](),controller[_0x9094('0x10')]);module[_0x9094('0x11')]=router; \ No newline at end of file +var _0xe469=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','isAuthenticated','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0xf92eab,_0x1c1256){var _0x5394a7=function(_0xfd7ece){while(--_0xfd7ece){_0xf92eab['push'](_0xf92eab['shift']());}};_0x5394a7(++_0x1c1256);}(_0xe469,0xd0));var _0x9e46=function(_0x506380,_0x4cc05e){_0x506380=_0x506380-0x0;var _0x2d7d52=_0xe469[_0x506380];return _0x2d7d52;};'use strict';var multer=require(_0x9e46('0x0'));var util=require(_0x9e46('0x1'));var path=require(_0x9e46('0x2'));var timeout=require(_0x9e46('0x3'));var express=require(_0x9e46('0x4'));var router=express['Router']();var fs_extra=require(_0x9e46('0x5'));var auth=require(_0x9e46('0x6'));var interaction=require(_0x9e46('0x7'));var config=require(_0x9e46('0x8'));var controller=require('./userProfileSection.controller');router[_0x9e46('0x9')]('/',auth['isAuthenticated'](),controller[_0x9e46('0xa')]);router[_0x9e46('0x9')](_0x9e46('0xb'),auth['isAuthenticated'](),controller[_0x9e46('0xc')]);router[_0x9e46('0x9')]('/:id',auth[_0x9e46('0xd')](),controller['show']);router[_0x9e46('0xe')]('/',auth[_0x9e46('0xd')](),controller[_0x9e46('0xf')]);router[_0x9e46('0x10')](_0x9e46('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x9e46('0x12')](_0x9e46('0x11'),auth['isAuthenticated'](),controller[_0x9e46('0x13')]);module[_0x9e46('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 68665d9..90f218f 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 _0xb7fc=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x29caf2,_0x21e2fb){_0x29caf2=_0x29caf2-0x0;var _0x31d5f4=_0xb7fc[_0x29caf2];return _0x31d5f4;};'use strict';var Sequelize=require(_0xcb7f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xcb7f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xcb7f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xcb7f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x23c877){this[_0xcb7f('0x4')](_0xcb7f('0x5'),_0x23c877?_0x23c877[_0xcb7f('0x6')](''):[]);},'get':function(){return this[_0xcb7f('0x7')](_0xcb7f('0x5'))?this['getDataValue'](_0xcb7f('0x5'))[_0xcb7f('0x8')](''):[];}}}; \ No newline at end of file +var _0x37a4=['crudPermissions','join','getDataValue','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x591bdc,_0xa46d7c){var _0x3059db=function(_0x4f022d){while(--_0x4f022d){_0x591bdc['push'](_0x591bdc['shift']());}};_0x3059db(++_0xa46d7c);}(_0x37a4,0xcb));var _0x437a=function(_0x300a43,_0x565f64){_0x300a43=_0x300a43-0x0;var _0x20aa3f=_0x37a4[_0x300a43];return _0x20aa3f;};'use strict';var Sequelize=require(_0x437a('0x0'));module['exports']={'name':{'type':Sequelize[_0x437a('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x437a('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x437a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x437a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5f2883){this[_0x437a('0x4')](_0x437a('0x5'),_0x5f2883?_0x5f2883[_0x437a('0x6')](''):[]);},'get':function(){return this[_0x437a('0x7')]('crudPermissions')?this[_0x437a('0x7')](_0x437a('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 2a9f122..0aa10e6 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 _0x6f82=['filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','include','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6f82,0x13b));var _0x26f8=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0x6f82[_0x3f8a03];return _0x147fb2;};'use strict';var emlformat=require(_0x26f8('0x0'));var rimraf=require(_0x26f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26f8('0x2'));var rp=require(_0x26f8('0x3'));var moment=require(_0x26f8('0x4'));var BPromise=require(_0x26f8('0x5'));var Mustache=require(_0x26f8('0x6'));var util=require(_0x26f8('0x7'));var path=require(_0x26f8('0x8'));var sox=require(_0x26f8('0x9'));var csv=require(_0x26f8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26f8('0xb'));var _=require(_0x26f8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x26f8('0xd'));var toCsv=require(_0x26f8('0xa'));var querystring=require(_0x26f8('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x26f8('0xf'));var as=require(_0x26f8('0x10'));var hardwareService=require(_0x26f8('0x11'));var logger=require(_0x26f8('0x12'))(_0x26f8('0x13'));var utils=require(_0x26f8('0x14'));var config=require(_0x26f8('0x15'));var licenseUtil=require(_0x26f8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x534a65,_0x31a78a){_0x31a78a=_0x31a78a||0xcc;return function(_0x4dfba4){if(_0x4dfba4){return _0x534a65[_0x26f8('0x17')](_0x31a78a);}return _0x534a65[_0x26f8('0x18')](_0x31a78a)[_0x26f8('0x19')]();};}function respondWithResult(_0x12a06b,_0x1d0c2d){_0x1d0c2d=_0x1d0c2d||0xc8;return function(_0x21b72b){if(_0x21b72b){return _0x12a06b[_0x26f8('0x18')](_0x1d0c2d)[_0x26f8('0x1a')](_0x21b72b);}};}function respondWithFilteredResult(_0x404f88,_0x11c402){return function(_0x5ba71e){if(_0x5ba71e){var _0x5afa4c=typeof _0x11c402[_0x26f8('0x1b')]===_0x26f8('0x1c')&&typeof _0x11c402[_0x26f8('0x1d')]===_0x26f8('0x1c');var _0x3b510e=_0x5ba71e[_0x26f8('0x1e')];var _0xce9b87=_0x5afa4c?0x0:_0x11c402['offset'];var _0x445c5b=_0x5afa4c?_0x5ba71e['count']:_0x11c402[_0x26f8('0x1b')]+_0x11c402[_0x26f8('0x1d')];var _0x2cc58a;if(_0x445c5b>=_0x3b510e){_0x445c5b=_0x3b510e;_0x2cc58a=0xc8;}else{_0x2cc58a=0xce;}_0x404f88[_0x26f8('0x18')](_0x2cc58a);return _0x404f88[_0x26f8('0x1f')](_0x26f8('0x20'),_0xce9b87+'-'+_0x445c5b+'/'+_0x3b510e)[_0x26f8('0x1a')](_0x5ba71e);}return null;};}function patchUpdates(_0x339d5c){return function(_0x307bfe){try{jsonpatch[_0x26f8('0x21')](_0x307bfe,_0x339d5c,!![]);}catch(_0x299762){return BPromise[_0x26f8('0x22')](_0x299762);}return _0x307bfe['save']();};}function saveUpdates(_0x32a63e,_0x455cc5){return function(_0x266b4a){if(_0x266b4a){return _0x266b4a[_0x26f8('0x23')](_0x32a63e)[_0x26f8('0x24')](function(_0x32eb5e){return _0x32eb5e;});}return null;};}function removeEntity(_0x521140,_0x470b60){return function(_0x172d82){if(_0x172d82){return _0x172d82[_0x26f8('0x25')]()[_0x26f8('0x24')](function(){_0x521140['status'](0xcc)[_0x26f8('0x19')]();});}};}function handleEntityNotFound(_0x29cf0d,_0x912ad6){return function(_0x58337e){if(!_0x58337e){_0x29cf0d['sendStatus'](0x194);}return _0x58337e;};}function handleError(_0x504b9f,_0x186855){_0x186855=_0x186855||0x1f4;return function(_0x237f10){logger[_0x26f8('0x26')](_0x237f10[_0x26f8('0x27')]);if(_0x237f10[_0x26f8('0x28')]){delete _0x237f10[_0x26f8('0x28')];}_0x504b9f['status'](_0x186855)['send'](_0x237f10);};}exports[_0x26f8('0x29')]=function(_0x415382,_0x5baa49){var _0x4436b5={},_0x7fd66a={},_0x3a5ff4={'count':0x0,'rows':[]};var _0x432103=_[_0x26f8('0x2a')](db[_0x26f8('0x2b')][_0x26f8('0x2c')],function(_0x5ba92d){return{'name':_0x5ba92d[_0x26f8('0x2d')],'type':_0x5ba92d[_0x26f8('0x2e')][_0x26f8('0x2f')]};});_0x7fd66a[_0x26f8('0x30')]=_[_0x26f8('0x2a')](_0x432103,_0x26f8('0x28'));_0x7fd66a[_0x26f8('0x31')]=_[_0x26f8('0x32')](_0x415382[_0x26f8('0x31')]);_0x7fd66a[_0x26f8('0x33')]=_[_0x26f8('0x34')](_0x7fd66a[_0x26f8('0x30')],_0x7fd66a['query']);_0x4436b5[_0x26f8('0x35')]=_[_0x26f8('0x34')](_0x7fd66a[_0x26f8('0x30')],qs[_0x26f8('0x36')](_0x415382['query'][_0x26f8('0x36')]));_0x4436b5[_0x26f8('0x35')]=_0x4436b5[_0x26f8('0x35')][_0x26f8('0x37')]?_0x4436b5['attributes']:_0x7fd66a[_0x26f8('0x30')];if(!_0x415382[_0x26f8('0x31')]['hasOwnProperty'](_0x26f8('0x38'))){_0x4436b5['limit']=qs['limit'](_0x415382[_0x26f8('0x31')][_0x26f8('0x1d')]);_0x4436b5[_0x26f8('0x1b')]=qs['offset'](_0x415382[_0x26f8('0x31')][_0x26f8('0x1b')]);}_0x4436b5[_0x26f8('0x39')]=qs[_0x26f8('0x3a')](_0x415382['query'][_0x26f8('0x3a')]);_0x4436b5['where']=qs['filters'](_[_0x26f8('0x3b')](_0x415382['query'],_0x7fd66a[_0x26f8('0x33')]),_0x432103);if(_0x415382[_0x26f8('0x31')][_0x26f8('0x3c')]){_0x4436b5[_0x26f8('0x3d')]=_[_0x26f8('0x3e')](_0x4436b5[_0x26f8('0x3d')],{'$or':_[_0x26f8('0x2a')](_0x432103,function(_0x7a2b09){if(_0x7a2b09['type']!==_0x26f8('0x3f')){var _0x3472f5={};_0x3472f5[_0x7a2b09[_0x26f8('0x28')]]={'$like':'%'+_0x415382['query'][_0x26f8('0x3c')]+'%'};return _0x3472f5;}})});}_0x4436b5=_[_0x26f8('0x3e')]({},_0x4436b5,_0x415382['options']);var _0x22ea28={'where':_0x4436b5[_0x26f8('0x3d')]};return db[_0x26f8('0x2b')][_0x26f8('0x1e')](_0x22ea28)[_0x26f8('0x24')](function(_0x2da41d){_0x3a5ff4[_0x26f8('0x1e')]=_0x2da41d;if(_0x415382[_0x26f8('0x31')][_0x26f8('0x40')]){_0x4436b5['include']=[{'all':!![]}];}return db[_0x26f8('0x2b')][_0x26f8('0x41')](_0x4436b5);})[_0x26f8('0x24')](function(_0x10598b){_0x3a5ff4[_0x26f8('0x42')]=_0x10598b;return _0x3a5ff4;})[_0x26f8('0x24')](respondWithFilteredResult(_0x5baa49,_0x4436b5))[_0x26f8('0x43')](handleError(_0x5baa49,null));};exports['show']=function(_0x53c4c7,_0x41702c){var _0x3f581d={'raw':![],'where':{'id':_0x53c4c7['params']['id']}},_0x130d92={};_0x130d92[_0x26f8('0x30')]=_[_0x26f8('0x32')](db['UserProfileSection'][_0x26f8('0x2c')]);_0x130d92[_0x26f8('0x31')]=_[_0x26f8('0x32')](_0x53c4c7[_0x26f8('0x31')]);_0x130d92[_0x26f8('0x33')]=_[_0x26f8('0x34')](_0x130d92[_0x26f8('0x30')],_0x130d92[_0x26f8('0x31')]);_0x3f581d['attributes']=_['intersection'](_0x130d92[_0x26f8('0x30')],qs[_0x26f8('0x36')](_0x53c4c7[_0x26f8('0x31')][_0x26f8('0x36')]));_0x3f581d[_0x26f8('0x35')]=_0x3f581d[_0x26f8('0x35')][_0x26f8('0x37')]?_0x3f581d[_0x26f8('0x35')]:_0x130d92[_0x26f8('0x30')];if(_0x53c4c7[_0x26f8('0x31')][_0x26f8('0x40')]){_0x3f581d[_0x26f8('0x44')]=[{'all':!![]}];}_0x3f581d=_['merge']({},_0x3f581d,_0x53c4c7[_0x26f8('0x45')]);return db[_0x26f8('0x2b')][_0x26f8('0x46')](_0x3f581d)[_0x26f8('0x24')](handleEntityNotFound(_0x41702c,null))['then'](respondWithResult(_0x41702c,null))[_0x26f8('0x43')](handleError(_0x41702c,null));};exports[_0x26f8('0x47')]=function(_0x336c3a,_0x213209){return db[_0x26f8('0x2b')][_0x26f8('0x47')](_0x336c3a[_0x26f8('0x48')],{})[_0x26f8('0x24')](respondWithResult(_0x213209,0xc9))[_0x26f8('0x43')](handleError(_0x213209,null));};exports['update']=function(_0x4e894d,_0x56d1a2){if(_0x4e894d[_0x26f8('0x48')]['id']){delete _0x4e894d[_0x26f8('0x48')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x4e894d['params']['id']}})[_0x26f8('0x24')](handleEntityNotFound(_0x56d1a2,null))[_0x26f8('0x24')](saveUpdates(_0x4e894d[_0x26f8('0x48')],null))[_0x26f8('0x24')](respondWithResult(_0x56d1a2,null))[_0x26f8('0x43')](handleError(_0x56d1a2,null));};exports[_0x26f8('0x25')]=function(_0x354791,_0x37d22d){return db['UserProfileSection'][_0x26f8('0x46')]({'where':{'id':_0x354791[_0x26f8('0x49')]['id']}})[_0x26f8('0x24')](handleEntityNotFound(_0x37d22d,null))[_0x26f8('0x24')](removeEntity(_0x37d22d,null))['catch'](handleError(_0x37d22d,null));};exports['describe']=function(_0x47e3ea,_0x4e6900){return db['UserProfileSection'][_0x26f8('0x4a')]()[_0x26f8('0x24')](respondWithResult(_0x4e6900,null))[_0x26f8('0x43')](handleError(_0x4e6900,null));}; \ No newline at end of file +var _0x32ff=['papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileSection','include','rows','catch','show','includeAll','find','create','params','describe','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x292d7a,_0xba34c8){var _0x409e7b=function(_0x5c9e29){while(--_0x5c9e29){_0x292d7a['push'](_0x292d7a['shift']());}};_0x409e7b(++_0xba34c8);}(_0x32ff,0xcc));var _0xf32f=function(_0x426d33,_0x2cfb45){_0x426d33=_0x426d33-0x0;var _0x279c96=_0x32ff[_0x426d33];return _0x279c96;};'use strict';var emlformat=require(_0xf32f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf32f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf32f('0x2'));var moment=require('moment');var BPromise=require(_0xf32f('0x3'));var Mustache=require(_0xf32f('0x4'));var util=require('util');var path=require(_0xf32f('0x5'));var sox=require(_0xf32f('0x6'));var csv=require(_0xf32f('0x7'));var ejs=require(_0xf32f('0x8'));var fs=require('fs');var fs_extra=require(_0xf32f('0x9'));var _=require(_0xf32f('0xa'));var squel=require(_0xf32f('0xb'));var crypto=require(_0xf32f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf32f('0xd'));var toCsv=require(_0xf32f('0x7'));var querystring=require(_0xf32f('0xe'));var Papa=require(_0xf32f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf32f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf32f('0x11'));var logger=require(_0xf32f('0x12'))(_0xf32f('0x13'));var utils=require(_0xf32f('0x14'));var config=require(_0xf32f('0x15'));var licenseUtil=require(_0xf32f('0x16'));var db=require(_0xf32f('0x17'))['db'];function respondWithStatusCode(_0x4c6d5d,_0x31a401){_0x31a401=_0x31a401||0xcc;return function(_0x19d018){if(_0x19d018){return _0x4c6d5d['sendStatus'](_0x31a401);}return _0x4c6d5d[_0xf32f('0x18')](_0x31a401)[_0xf32f('0x19')]();};}function respondWithResult(_0x50bfbf,_0x72f445){_0x72f445=_0x72f445||0xc8;return function(_0x267566){if(_0x267566){return _0x50bfbf['status'](_0x72f445)[_0xf32f('0x1a')](_0x267566);}};}function respondWithFilteredResult(_0x54dd5d,_0x5010d9){return function(_0xc8b01e){if(_0xc8b01e){var _0x5b5f9d=typeof _0x5010d9[_0xf32f('0x1b')]===_0xf32f('0x1c')&&typeof _0x5010d9[_0xf32f('0x1d')]===_0xf32f('0x1c');var _0x40f2b8=_0xc8b01e[_0xf32f('0x1e')];var _0x3d3895=_0x5b5f9d?0x0:_0x5010d9['offset'];var _0xe8bfc5=_0x5b5f9d?_0xc8b01e[_0xf32f('0x1e')]:_0x5010d9[_0xf32f('0x1b')]+_0x5010d9['limit'];var _0x2d3252;if(_0xe8bfc5>=_0x40f2b8){_0xe8bfc5=_0x40f2b8;_0x2d3252=0xc8;}else{_0x2d3252=0xce;}_0x54dd5d[_0xf32f('0x18')](_0x2d3252);return _0x54dd5d[_0xf32f('0x1f')](_0xf32f('0x20'),_0x3d3895+'-'+_0xe8bfc5+'/'+_0x40f2b8)[_0xf32f('0x1a')](_0xc8b01e);}return null;};}function patchUpdates(_0x13b558){return function(_0x428da6){try{jsonpatch[_0xf32f('0x21')](_0x428da6,_0x13b558,!![]);}catch(_0x30945a){return BPromise[_0xf32f('0x22')](_0x30945a);}return _0x428da6['save']();};}function saveUpdates(_0x3957f8,_0xc054a7){return function(_0x831694){if(_0x831694){return _0x831694[_0xf32f('0x23')](_0x3957f8)[_0xf32f('0x24')](function(_0x2d7662){return _0x2d7662;});}return null;};}function removeEntity(_0x179881,_0x42ca45){return function(_0x56594c){if(_0x56594c){return _0x56594c[_0xf32f('0x25')]()['then'](function(){_0x179881[_0xf32f('0x18')](0xcc)[_0xf32f('0x19')]();});}};}function handleEntityNotFound(_0x267537,_0x3f559f){return function(_0x22003d){if(!_0x22003d){_0x267537[_0xf32f('0x26')](0x194);}return _0x22003d;};}function handleError(_0x512d0b,_0x20ccb7){_0x20ccb7=_0x20ccb7||0x1f4;return function(_0x2b1d3c){logger['error'](_0x2b1d3c['stack']);if(_0x2b1d3c[_0xf32f('0x27')]){delete _0x2b1d3c[_0xf32f('0x27')];}_0x512d0b[_0xf32f('0x18')](_0x20ccb7)[_0xf32f('0x28')](_0x2b1d3c);};}exports[_0xf32f('0x29')]=function(_0x24e8e2,_0x1915cd){var _0x4b99ab={},_0x52da3c={},_0x1693de={'count':0x0,'rows':[]};var _0x46b5d3=_['map'](db['UserProfileSection']['rawAttributes'],function(_0x9ae5ef){return{'name':_0x9ae5ef[_0xf32f('0x2a')],'type':_0x9ae5ef[_0xf32f('0x2b')][_0xf32f('0x2c')]};});_0x52da3c[_0xf32f('0x2d')]=_[_0xf32f('0x2e')](_0x46b5d3,_0xf32f('0x27'));_0x52da3c[_0xf32f('0x2f')]=_[_0xf32f('0x30')](_0x24e8e2[_0xf32f('0x2f')]);_0x52da3c[_0xf32f('0x31')]=_[_0xf32f('0x32')](_0x52da3c[_0xf32f('0x2d')],_0x52da3c['query']);_0x4b99ab[_0xf32f('0x33')]=_[_0xf32f('0x32')](_0x52da3c[_0xf32f('0x2d')],qs[_0xf32f('0x34')](_0x24e8e2['query'][_0xf32f('0x34')]));_0x4b99ab[_0xf32f('0x33')]=_0x4b99ab[_0xf32f('0x33')][_0xf32f('0x35')]?_0x4b99ab[_0xf32f('0x33')]:_0x52da3c['model'];if(!_0x24e8e2[_0xf32f('0x2f')]['hasOwnProperty'](_0xf32f('0x36'))){_0x4b99ab[_0xf32f('0x1d')]=qs[_0xf32f('0x1d')](_0x24e8e2[_0xf32f('0x2f')][_0xf32f('0x1d')]);_0x4b99ab[_0xf32f('0x1b')]=qs[_0xf32f('0x1b')](_0x24e8e2[_0xf32f('0x2f')][_0xf32f('0x1b')]);}_0x4b99ab[_0xf32f('0x37')]=qs[_0xf32f('0x38')](_0x24e8e2[_0xf32f('0x2f')][_0xf32f('0x38')]);_0x4b99ab[_0xf32f('0x39')]=qs[_0xf32f('0x31')](_[_0xf32f('0x3a')](_0x24e8e2[_0xf32f('0x2f')],_0x52da3c[_0xf32f('0x31')]),_0x46b5d3);if(_0x24e8e2[_0xf32f('0x2f')][_0xf32f('0x3b')]){_0x4b99ab[_0xf32f('0x39')]=_[_0xf32f('0x3c')](_0x4b99ab[_0xf32f('0x39')],{'$or':_[_0xf32f('0x2e')](_0x46b5d3,function(_0x41ae41){if(_0x41ae41[_0xf32f('0x2b')]!==_0xf32f('0x3d')){var _0x19fba6={};_0x19fba6[_0x41ae41[_0xf32f('0x27')]]={'$like':'%'+_0x24e8e2[_0xf32f('0x2f')][_0xf32f('0x3b')]+'%'};return _0x19fba6;}})});}_0x4b99ab=_[_0xf32f('0x3c')]({},_0x4b99ab,_0x24e8e2[_0xf32f('0x3e')]);var _0xb9a421={'where':_0x4b99ab[_0xf32f('0x39')]};return db[_0xf32f('0x3f')][_0xf32f('0x1e')](_0xb9a421)[_0xf32f('0x24')](function(_0x8d5ce5){_0x1693de[_0xf32f('0x1e')]=_0x8d5ce5;if(_0x24e8e2[_0xf32f('0x2f')]['includeAll']){_0x4b99ab[_0xf32f('0x40')]=[{'all':!![]}];}return db[_0xf32f('0x3f')]['findAll'](_0x4b99ab);})[_0xf32f('0x24')](function(_0x2d1938){_0x1693de[_0xf32f('0x41')]=_0x2d1938;return _0x1693de;})[_0xf32f('0x24')](respondWithFilteredResult(_0x1915cd,_0x4b99ab))[_0xf32f('0x42')](handleError(_0x1915cd,null));};exports[_0xf32f('0x43')]=function(_0x5434d3,_0x5cf9f0){var _0x1f780d={'raw':![],'where':{'id':_0x5434d3['params']['id']}},_0x3ba926={};_0x3ba926['model']=_[_0xf32f('0x30')](db[_0xf32f('0x3f')]['rawAttributes']);_0x3ba926['query']=_[_0xf32f('0x30')](_0x5434d3[_0xf32f('0x2f')]);_0x3ba926[_0xf32f('0x31')]=_['intersection'](_0x3ba926[_0xf32f('0x2d')],_0x3ba926['query']);_0x1f780d[_0xf32f('0x33')]=_[_0xf32f('0x32')](_0x3ba926[_0xf32f('0x2d')],qs[_0xf32f('0x34')](_0x5434d3[_0xf32f('0x2f')][_0xf32f('0x34')]));_0x1f780d[_0xf32f('0x33')]=_0x1f780d[_0xf32f('0x33')]['length']?_0x1f780d[_0xf32f('0x33')]:_0x3ba926[_0xf32f('0x2d')];if(_0x5434d3['query'][_0xf32f('0x44')]){_0x1f780d[_0xf32f('0x40')]=[{'all':!![]}];}_0x1f780d=_[_0xf32f('0x3c')]({},_0x1f780d,_0x5434d3[_0xf32f('0x3e')]);return db['UserProfileSection'][_0xf32f('0x45')](_0x1f780d)[_0xf32f('0x24')](handleEntityNotFound(_0x5cf9f0,null))[_0xf32f('0x24')](respondWithResult(_0x5cf9f0,null))[_0xf32f('0x42')](handleError(_0x5cf9f0,null));};exports[_0xf32f('0x46')]=function(_0x39cb06,_0x438237){return db[_0xf32f('0x3f')][_0xf32f('0x46')](_0x39cb06['body'],{})['then'](respondWithResult(_0x438237,0xc9))[_0xf32f('0x42')](handleError(_0x438237,null));};exports[_0xf32f('0x23')]=function(_0x227e4b,_0x370f8e){if(_0x227e4b['body']['id']){delete _0x227e4b['body']['id'];}return db['UserProfileSection'][_0xf32f('0x45')]({'where':{'id':_0x227e4b[_0xf32f('0x47')]['id']}})[_0xf32f('0x24')](handleEntityNotFound(_0x370f8e,null))[_0xf32f('0x24')](saveUpdates(_0x227e4b['body'],null))[_0xf32f('0x24')](respondWithResult(_0x370f8e,null))[_0xf32f('0x42')](handleError(_0x370f8e,null));};exports[_0xf32f('0x25')]=function(_0x4a381f,_0x441d92){return db[_0xf32f('0x3f')][_0xf32f('0x45')]({'where':{'id':_0x4a381f[_0xf32f('0x47')]['id']}})[_0xf32f('0x24')](handleEntityNotFound(_0x441d92,null))[_0xf32f('0x24')](removeEntity(_0x441d92,null))[_0xf32f('0x42')](handleError(_0x441d92,null));};exports['describe']=function(_0x30685e,_0x4895a2){return db[_0xf32f('0x3f')][_0xf32f('0x48')]()['then'](respondWithResult(_0x4895a2,null))[_0xf32f('0x42')](handleError(_0x4895a2,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 4618c12..db9e64b 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 _0xf4ae=['userProfileId','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','sectionId'];(function(_0x269def,_0xb166d9){var _0x4a5882=function(_0x2d1016){while(--_0x2d1016){_0x269def['push'](_0x269def['shift']());}};_0x4a5882(++_0xb166d9);}(_0xf4ae,0x69));var _0xef4a=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0xf4ae[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0xef4a('0x0'));var util=require('util');var logger=require(_0xef4a('0x1'))(_0xef4a('0x2'));var moment=require(_0xef4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xef4a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef4a('0x5'));var config=require(_0xef4a('0x6'));var attributes=require(_0xef4a('0x7'));module['exports']=function(_0x50e532,_0x5cb368){return _0x50e532[_0xef4a('0x8')](_0xef4a('0x9'),attributes,{'tableName':_0xef4a('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xef4a('0xb'),_0xef4a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e76=['api','bluebird','request-promise','path','rimraf','../../config/environment','UserProfileSection','user_profile_has_sections','userProfileId','lodash'];(function(_0x45e3c0,_0x279504){var _0x28005e=function(_0xceb03e){while(--_0xceb03e){_0x45e3c0['push'](_0x45e3c0['shift']());}};_0x28005e(++_0x279504);}(_0x2e76,0x199));var _0x62e7=function(_0x3caeb6,_0x36c150){_0x3caeb6=_0x3caeb6-0x0;var _0x459595=_0x2e76[_0x3caeb6];return _0x459595;};'use strict';var _=require(_0x62e7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x62e7('0x1'));var moment=require('moment');var BPromise=require(_0x62e7('0x2'));var rp=require(_0x62e7('0x3'));var fs=require('fs');var path=require(_0x62e7('0x4'));var rimraf=require(_0x62e7('0x5'));var config=require(_0x62e7('0x6'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x462d8c,_0x4f83f3){return _0x462d8c['define'](_0x62e7('0x7'),attributes,{'tableName':_0x62e7('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x62e7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 01f61e4..d2af9b0 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 _0x5150=['message','UserProfileSection,\x20%s,\x20%s','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x48051b,_0x339115){var _0x2a4f6e=function(_0x5b7756){while(--_0x5b7756){_0x48051b['push'](_0x48051b['shift']());}};_0x2a4f6e(++_0x339115);}(_0x5150,0xff));var _0x0515=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x5150[_0x3f2d02];return _0x54092b;};'use strict';var _=require(_0x0515('0x0'));var util=require('util');var moment=require(_0x0515('0x1'));var BPromise=require(_0x0515('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0515('0x3'));var db=require(_0x0515('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0515('0x5'))(_0x0515('0x6'));var config=require(_0x0515('0x7'));var jayson=require(_0x0515('0x8'));var client=jayson[_0x0515('0x9')][_0x0515('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e454c,_0x1c6208,_0x37c0b4){return new BPromise(function(_0x3aa9e8,_0x5c697a){return client[_0x0515('0xb')](_0x3e454c,_0x37c0b4)['then'](function(_0x1578ec){logger[_0x0515('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x1c6208,_0x0515('0xd'));logger[_0x0515('0xe')](_0x0515('0xf'),_0x1c6208,'request\x20sent',JSON['stringify'](_0x1578ec));if(_0x1578ec[_0x0515('0x10')]){if(_0x1578ec[_0x0515('0x10')][_0x0515('0x11')]===0x1f4){logger[_0x0515('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x1c6208,_0x1578ec[_0x0515('0x10')][_0x0515('0x12')]);return _0x5c697a(_0x1578ec['error'][_0x0515('0x12')]);}logger[_0x0515('0x10')](_0x0515('0x13'),_0x1c6208,_0x1578ec[_0x0515('0x10')]['message']);return _0x3aa9e8(_0x1578ec[_0x0515('0x10')][_0x0515('0x12')]);}else{logger['info'](_0x0515('0x13'),_0x1c6208,'request\x20sent');_0x3aa9e8(_0x1578ec['result'][_0x0515('0x12')]);}})[_0x0515('0x14')](function(_0x2d7311){logger[_0x0515('0x10')](_0x0515('0x13'),_0x1c6208,_0x2d7311);_0x5c697a(_0x2d7311);});});} \ No newline at end of file +var _0xed2e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xed2e,0xf0));var _0xeed2=function(_0x498d2e,_0x450d08){_0x498d2e=_0x498d2e-0x0;var _0x3019c1=_0xed2e[_0x498d2e];return _0x3019c1;};'use strict';var _=require(_0xeed2('0x0'));var util=require(_0xeed2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeed2('0x2'));var fs=require('fs');var Redis=require(_0xeed2('0x3'));var db=require(_0xeed2('0x4'))['db'];var utils=require(_0xeed2('0x5'));var logger=require(_0xeed2('0x6'))(_0xeed2('0x7'));var config=require('../../config/environment');var jayson=require(_0xeed2('0x8'));var client=jayson[_0xeed2('0x9')][_0xeed2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31bbcb,_0x130282,_0x21050d){return new BPromise(function(_0x263c14,_0x164740){return client[_0xeed2('0xb')](_0x31bbcb,_0x21050d)[_0xeed2('0xc')](function(_0x10dc38){logger['info'](_0xeed2('0xd'),_0x130282,_0xeed2('0xe'));logger[_0xeed2('0xf')](_0xeed2('0x10'),_0x130282,_0xeed2('0xe'),JSON[_0xeed2('0x11')](_0x10dc38));if(_0x10dc38[_0xeed2('0x12')]){if(_0x10dc38[_0xeed2('0x12')]['code']===0x1f4){logger[_0xeed2('0x12')](_0xeed2('0xd'),_0x130282,_0x10dc38[_0xeed2('0x12')][_0xeed2('0x13')]);return _0x164740(_0x10dc38[_0xeed2('0x12')]['message']);}logger[_0xeed2('0x12')](_0xeed2('0xd'),_0x130282,_0x10dc38['error'][_0xeed2('0x13')]);return _0x263c14(_0x10dc38['error']['message']);}else{logger[_0xeed2('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x130282,_0xeed2('0xe'));_0x263c14(_0x10dc38['result'][_0xeed2('0x13')]);}})[_0xeed2('0x15')](function(_0x4edc67){logger['error'](_0xeed2('0xd'),_0x130282,_0x4edc67);_0x164740(_0x4edc67);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index cd570e7..c8d9897 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 _0xcaa3=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x214377,_0x5d8d2a){var _0x275dbd=function(_0x15aac3){while(--_0x15aac3){_0x214377['push'](_0x214377['shift']());}};_0x275dbd(++_0x5d8d2a);}(_0xcaa3,0xcb));var _0x3caa=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xcaa3[_0x55821d];return _0x58ea8a;};'use strict';var multer=require(_0x3caa('0x0'));var util=require(_0x3caa('0x1'));var path=require(_0x3caa('0x2'));var timeout=require(_0x3caa('0x3'));var express=require(_0x3caa('0x4'));var router=express[_0x3caa('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3caa('0x6'));var config=require(_0x3caa('0x7'));module[_0x3caa('0x8')]=router; \ No newline at end of file +var _0xf1f9=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x51191f,_0x9a0ab8){var _0x4278c0=function(_0x2b9766){while(--_0x2b9766){_0x51191f['push'](_0x51191f['shift']());}};_0x4278c0(++_0x9a0ab8);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x424747,_0x30f215){_0x424747=_0x424747-0x0;var _0xae36b5=_0xf1f9[_0x424747];return _0xae36b5;};'use strict';var multer=require(_0x9f1f('0x0'));var util=require(_0x9f1f('0x1'));var path=require(_0x9f1f('0x2'));var timeout=require(_0x9f1f('0x3'));var express=require(_0x9f1f('0x4'));var router=express['Router']();var fs_extra=require(_0x9f1f('0x5'));var auth=require(_0x9f1f('0x6'));var interaction=require(_0x9f1f('0x7'));var config=require(_0x9f1f('0x8'));module[_0x9f1f('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 89c9ff1..fc01961 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x28473b,_0x499a7a){var _0x40b410=function(_0x5c5947){while(--_0x5c5947){_0x28473b['push'](_0x28473b['shift']());}};_0x40b410(++_0x499a7a);}(_0xe706,0xa3));var _0x6e70=function(_0xf25c17,_0x288f2c){_0xf25c17=_0xf25c17-0x0;var _0x429736=_0xe706[_0xf25c17];return _0x429736;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x490cb4,_0x16c206){var _0x1271e5=function(_0x182f2b){while(--_0x182f2b){_0x490cb4['push'](_0x490cb4['shift']());}};_0x1271e5(++_0x16c206);}(_0xe706,0xa3));var _0x6e70=function(_0x5ecaab,_0x2f3053){_0x5ecaab=_0x5ecaab-0x0;var _0x3db1a8=_0xe706[_0x5ecaab];return _0x3db1a8;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index f354e90..1bef1eb 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 _0xd159=['moment','bluebird','request-promise','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x1a10c1,_0x462974){var _0x26022a=function(_0x150789){while(--_0x150789){_0x1a10c1['push'](_0x1a10c1['shift']());}};_0x26022a(++_0x462974);}(_0xd159,0x140));var _0x9d15=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd159[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x9d15('0x0'));var util=require(_0x9d15('0x1'));var logger=require(_0x9d15('0x2'))(_0x9d15('0x3'));var moment=require(_0x9d15('0x4'));var BPromise=require(_0x9d15('0x5'));var rp=require(_0x9d15('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d15('0x7'));var config=require('../../config/environment');var attributes=require(_0x9d15('0x8'));module[_0x9d15('0x9')]=function(_0x657e06,_0x17256b){return _0x657e06['define'](_0x9d15('0xa'),attributes,{'tableName':_0x9d15('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04d4=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x5e2586,_0x139364){var _0x2f4966=function(_0x5d3a6b){while(--_0x5d3a6b){_0x5e2586['push'](_0x5e2586['shift']());}};_0x2f4966(++_0x139364);}(_0x04d4,0x136));var _0x404d=function(_0x1fe84e,_0x46d8c6){_0x1fe84e=_0x1fe84e-0x0;var _0x5ea810=_0x04d4[_0x1fe84e];return _0x5ea810;};'use strict';var _=require(_0x404d('0x0'));var util=require(_0x404d('0x1'));var logger=require(_0x404d('0x2'))(_0x404d('0x3'));var moment=require(_0x404d('0x4'));var BPromise=require(_0x404d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x404d('0x6'));var config=require(_0x404d('0x7'));var attributes=require(_0x404d('0x8'));module[_0x404d('0x9')]=function(_0x1bda09,_0x410c25){return _0x1bda09['define']('UserSmsQueue',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 6b85498..2ba5ae6 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 _0x7353=['then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserSmsQueue,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14339e,_0x1c8fb3){var _0x1d7568=function(_0x54f443){while(--_0x54f443){_0x14339e['push'](_0x14339e['shift']());}};_0x1d7568(++_0x1c8fb3);}(_0x7353,0x12b));var _0x3735=function(_0x5e5ceb,_0x32b8d7){_0x5e5ceb=_0x5e5ceb-0x0;var _0xd9d5bd=_0x7353[_0x5e5ceb];return _0xd9d5bd;};'use strict';var _=require(_0x3735('0x0'));var util=require(_0x3735('0x1'));var moment=require(_0x3735('0x2'));var BPromise=require(_0x3735('0x3'));var rs=require(_0x3735('0x4'));var fs=require('fs');var Redis=require(_0x3735('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3735('0x6'));var logger=require(_0x3735('0x7'))(_0x3735('0x8'));var config=require(_0x3735('0x9'));var jayson=require(_0x3735('0xa'));var client=jayson[_0x3735('0xb')][_0x3735('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b844d,_0x2b7c3b,_0x1405b0){return new BPromise(function(_0x54a9c1,_0x9e1275){return client['request'](_0x5b844d,_0x1405b0)[_0x3735('0xd')](function(_0x1a6e88){logger[_0x3735('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x2b7c3b,_0x3735('0xf'));logger[_0x3735('0x10')](_0x3735('0x11'),_0x2b7c3b,'request\x20sent',JSON[_0x3735('0x12')](_0x1a6e88));if(_0x1a6e88['error']){if(_0x1a6e88['error'][_0x3735('0x13')]===0x1f4){logger[_0x3735('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x2b7c3b,_0x1a6e88[_0x3735('0x14')][_0x3735('0x15')]);return _0x9e1275(_0x1a6e88['error'][_0x3735('0x15')]);}logger[_0x3735('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x2b7c3b,_0x1a6e88['error'][_0x3735('0x15')]);return _0x54a9c1(_0x1a6e88[_0x3735('0x14')][_0x3735('0x15')]);}else{logger[_0x3735('0xe')](_0x3735('0x16'),_0x2b7c3b,_0x3735('0xf'));_0x54a9c1(_0x1a6e88[_0x3735('0x17')][_0x3735('0x15')]);}})['catch'](function(_0xaeb541){logger[_0x3735('0x14')](_0x3735('0x16'),_0x2b7c3b,_0xaeb541);_0x9e1275(_0xaeb541);});});} \ No newline at end of file +var _0x5357=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5357,0x1af));var _0x7535=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x5357[_0x92c450];return _0x2a9599;};'use strict';var _=require('lodash');var util=require(_0x7535('0x0'));var moment=require('moment');var BPromise=require(_0x7535('0x1'));var rs=require(_0x7535('0x2'));var fs=require('fs');var Redis=require(_0x7535('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7535('0x4'))('rpc');var config=require(_0x7535('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7535('0x6')][_0x7535('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51316d,_0x24cc0c,_0x2a8358){return new BPromise(function(_0x4d856d,_0x4b1f7d){return client[_0x7535('0x8')](_0x51316d,_0x2a8358)[_0x7535('0x9')](function(_0x12fb6d){logger[_0x7535('0xa')](_0x7535('0xb'),_0x24cc0c,_0x7535('0xc'));logger[_0x7535('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x24cc0c,'request\x20sent',JSON['stringify'](_0x12fb6d));if(_0x12fb6d['error']){if(_0x12fb6d['error'][_0x7535('0xe')]===0x1f4){logger[_0x7535('0xf')](_0x7535('0xb'),_0x24cc0c,_0x12fb6d[_0x7535('0xf')][_0x7535('0x10')]);return _0x4b1f7d(_0x12fb6d[_0x7535('0xf')][_0x7535('0x10')]);}logger[_0x7535('0xf')](_0x7535('0xb'),_0x24cc0c,_0x12fb6d[_0x7535('0xf')][_0x7535('0x10')]);return _0x4d856d(_0x12fb6d[_0x7535('0xf')][_0x7535('0x10')]);}else{logger[_0x7535('0xa')](_0x7535('0xb'),_0x24cc0c,_0x7535('0xc'));_0x4d856d(_0x12fb6d[_0x7535('0x11')][_0x7535('0x10')]);}})[_0x7535('0x12')](function(_0x3edefb){logger[_0x7535('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x24cc0c,_0x3edefb);_0x4b1f7d(_0x3edefb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index ce9f8b0..a7a8165 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 _0x851a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','path','connect-timeout'];(function(_0x3bdd25,_0x47234c){var _0x3b74bd=function(_0x5b5283){while(--_0x5b5283){_0x3bdd25['push'](_0x3bdd25['shift']());}};_0x3b74bd(++_0x47234c);}(_0x851a,0x19b));var _0xa851=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x851a[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xa851('0x0'));var util=require('util');var path=require(_0xa851('0x1'));var timeout=require(_0xa851('0x2'));var express=require(_0xa851('0x3'));var router=express[_0xa851('0x4')]();var fs_extra=require(_0xa851('0x5'));var auth=require(_0xa851('0x6'));var interaction=require(_0xa851('0x7'));var config=require(_0xa851('0x8'));module['exports']=router; \ No newline at end of file +var _0x6836=['multer','util','path','express','fs-extra','../../components/interaction/service','exports'];(function(_0x19e52d,_0x3491f4){var _0x208fc7=function(_0x3cf0f2){while(--_0x3cf0f2){_0x19e52d['push'](_0x19e52d['shift']());}};_0x208fc7(++_0x3491f4);}(_0x6836,0x1c0));var _0x6683=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x6836[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var path=require(_0x6683('0x2'));var timeout=require('connect-timeout');var express=require(_0x6683('0x3'));var router=express['Router']();var fs_extra=require(_0x6683('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6683('0x5'));var config=require('../../config/environment');module[_0x6683('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index d789c7d..a0ddee5 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x5b405c,_0x379166){var _0x2d0b28=function(_0x2b569a){while(--_0x2b569a){_0x5b405c['push'](_0x5b405c['shift']());}};_0x2d0b28(++_0x379166);}(_0xe706,0xa3));var _0x6e70=function(_0x26b308,_0x397dfc){_0x26b308=_0x26b308-0x0;var _0x59478d=_0xe706[_0x26b308];return _0x59478d;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2c027a,_0x341527){var _0x40b97c=function(_0x342651){while(--_0x342651){_0x2c027a['push'](_0x2c027a['shift']());}};_0x40b97c(++_0x341527);}(_0xe706,0xa3));var _0x6e70=function(_0x58a364,_0x3439f6){_0x58a364=_0x58a364-0x0;var _0x409b74=_0xe706[_0x58a364];return _0x409b74;};'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 ee8d3d8..0a034db 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 _0x81bd=['../../config/environment','./userVoiceQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xcd2c9a,_0x3c1626){var _0xd032b6=function(_0x495116){while(--_0x495116){_0xcd2c9a['push'](_0xcd2c9a['shift']());}};_0xd032b6(++_0x3c1626);}(_0x81bd,0x7c));var _0xd81b=function(_0x32e7d6,_0x682bc5){_0x32e7d6=_0x32e7d6-0x0;var _0x5427cf=_0x81bd[_0x32e7d6];return _0x5427cf;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3435=['api','moment','bluebird','path','rimraf','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x3435,0xfa));var _0x5343=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x3435[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var logger=require(_0x5343('0x2'))(_0x5343('0x3'));var moment=require(_0x5343('0x4'));var BPromise=require(_0x5343('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5343('0x6'));var rimraf=require(_0x5343('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x5343('0x8')]=function(_0x28f0f3,_0x4d26b5){return _0x28f0f3['define'](_0x5343('0x9'),attributes,{'tableName':_0x5343('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 e425c83..1274b30 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 _0xde75=['../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1576fa,_0x5ba64e){var _0x1304ca=function(_0x1912ef){while(--_0x1912ef){_0x1576fa['push'](_0x1576fa['shift']());}};_0x1304ca(++_0x5ba64e);}(_0xde75,0x123));var _0x5de7=function(_0x274c58,_0x2f79eb){_0x274c58=_0x274c58-0x0;var _0x2fe236=_0xde75[_0x274c58];return _0x2fe236;};'use strict';var _=require(_0x5de7('0x0'));var util=require(_0x5de7('0x1'));var moment=require(_0x5de7('0x2'));var BPromise=require(_0x5de7('0x3'));var rs=require(_0x5de7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5de7('0x5'))['db'];var utils=require(_0x5de7('0x6'));var logger=require(_0x5de7('0x7'))(_0x5de7('0x8'));var config=require(_0x5de7('0x9'));var jayson=require(_0x5de7('0xa'));var client=jayson[_0x5de7('0xb')][_0x5de7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49eeb3,_0x1e22b1,_0x3f978f){return new BPromise(function(_0x1bb3e3,_0x13e80c){return client[_0x5de7('0xd')](_0x49eeb3,_0x3f978f)[_0x5de7('0xe')](function(_0x346901){logger[_0x5de7('0xf')](_0x5de7('0x10'),_0x1e22b1,'request\x20sent');logger[_0x5de7('0x11')](_0x5de7('0x12'),_0x1e22b1,_0x5de7('0x13'),JSON[_0x5de7('0x14')](_0x346901));if(_0x346901[_0x5de7('0x15')]){if(_0x346901[_0x5de7('0x15')]['code']===0x1f4){logger['error'](_0x5de7('0x10'),_0x1e22b1,_0x346901[_0x5de7('0x15')][_0x5de7('0x16')]);return _0x13e80c(_0x346901[_0x5de7('0x15')][_0x5de7('0x16')]);}logger[_0x5de7('0x15')](_0x5de7('0x10'),_0x1e22b1,_0x346901['error']['message']);return _0x1bb3e3(_0x346901['error']['message']);}else{logger[_0x5de7('0xf')](_0x5de7('0x10'),_0x1e22b1,_0x5de7('0x13'));_0x1bb3e3(_0x346901[_0x5de7('0x17')]['message']);}})[_0x5de7('0x18')](function(_0x57d96d){logger[_0x5de7('0x15')](_0x5de7('0x10'),_0x1e22b1,_0x57d96d);_0x13e80c(_0x57d96d);});});} \ No newline at end of file +var _0x0fbe=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x3bd27f,_0x33586a){var _0x1963ac=function(_0x31f786){while(--_0x31f786){_0x3bd27f['push'](_0x3bd27f['shift']());}};_0x1963ac(++_0x33586a);}(_0x0fbe,0x8a));var _0xe0fb=function(_0x15cd46,_0x163193){_0x15cd46=_0x15cd46-0x0;var _0x49ae24=_0x0fbe[_0x15cd46];return _0x49ae24;};'use strict';var _=require(_0xe0fb('0x0'));var util=require(_0xe0fb('0x1'));var moment=require(_0xe0fb('0x2'));var BPromise=require(_0xe0fb('0x3'));var rs=require(_0xe0fb('0x4'));var fs=require('fs');var Redis=require(_0xe0fb('0x5'));var db=require(_0xe0fb('0x6'))['db'];var utils=require(_0xe0fb('0x7'));var logger=require(_0xe0fb('0x8'))('rpc');var config=require(_0xe0fb('0x9'));var jayson=require(_0xe0fb('0xa'));var client=jayson[_0xe0fb('0xb')][_0xe0fb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d1003,_0x4464a9,_0x3ba348){return new BPromise(function(_0x41c903,_0x4876d5){return client[_0xe0fb('0xd')](_0x3d1003,_0x3ba348)[_0xe0fb('0xe')](function(_0x3dc1d0){logger[_0xe0fb('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x4464a9,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4464a9,_0xe0fb('0x10'),JSON['stringify'](_0x3dc1d0));if(_0x3dc1d0[_0xe0fb('0x11')]){if(_0x3dc1d0[_0xe0fb('0x11')][_0xe0fb('0x12')]===0x1f4){logger[_0xe0fb('0x11')](_0xe0fb('0x13'),_0x4464a9,_0x3dc1d0['error'][_0xe0fb('0x14')]);return _0x4876d5(_0x3dc1d0[_0xe0fb('0x11')][_0xe0fb('0x14')]);}logger[_0xe0fb('0x11')](_0xe0fb('0x13'),_0x4464a9,_0x3dc1d0[_0xe0fb('0x11')]['message']);return _0x41c903(_0x3dc1d0[_0xe0fb('0x11')][_0xe0fb('0x14')]);}else{logger[_0xe0fb('0xf')](_0xe0fb('0x13'),_0x4464a9,_0xe0fb('0x10'));_0x41c903(_0x3dc1d0[_0xe0fb('0x15')][_0xe0fb('0x14')]);}})[_0xe0fb('0x16')](function(_0x3b33b7){logger[_0xe0fb('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x4464a9,_0x3b33b7);_0x4876d5(_0x3b33b7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 396205a..6e687f9 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 _0x02f7=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x4cfd4d,_0x135ab4){var _0x5c7a28=function(_0x562665){while(--_0x562665){_0x4cfd4d['push'](_0x4cfd4d['shift']());}};_0x5c7a28(++_0x135ab4);}(_0x02f7,0x1d3));var _0x702f=function(_0x4b40a2,_0x4a8b83){_0x4b40a2=_0x4b40a2-0x0;var _0x5d2478=_0x02f7[_0x4b40a2];return _0x5d2478;};'use strict';var multer=require(_0x702f('0x0'));var util=require(_0x702f('0x1'));var path=require(_0x702f('0x2'));var timeout=require('connect-timeout');var express=require(_0x702f('0x3'));var router=express[_0x702f('0x4')]();var fs_extra=require(_0x702f('0x5'));var auth=require(_0x702f('0x6'));var interaction=require(_0x702f('0x7'));var config=require(_0x702f('0x8'));module['exports']=router; \ No newline at end of file +var _0x7be1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','multer','util','path'];(function(_0xcd7ff7,_0x58b332){var _0xe8099f=function(_0x9386b5){while(--_0x9386b5){_0xcd7ff7['push'](_0xcd7ff7['shift']());}};_0xe8099f(++_0x58b332);}(_0x7be1,0x165));var _0x17be=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x7be1[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var path=require(_0x17be('0x2'));var timeout=require('connect-timeout');var express=require(_0x17be('0x3'));var router=express[_0x17be('0x4')]();var fs_extra=require(_0x17be('0x5'));var auth=require(_0x17be('0x6'));var interaction=require(_0x17be('0x7'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6685a56..6d340d2 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 _0xe0d6=['STRING','queue_interface','INTEGER','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0xe0d6,0x1a7));var _0x6e0d=function(_0x563764,_0x5673c7){_0x563764=_0x563764-0x0;var _0x13b7b3=_0xe0d6[_0x563764];return _0x13b7b3;};'use strict';var Sequelize=require(_0x6e0d('0x0'));module[_0x6e0d('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6e0d('0x2')},'membername':{'type':Sequelize[_0x6e0d('0x3')],'allowNull':![],'comment':_0x6e0d('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6e0d('0x3')],'allowNull':![],'unique':_0x6e0d('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x6e0d('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x6e0d('0x2')},'penalty':{'type':Sequelize[_0x6e0d('0x5')](0xb),'defaultValue':0x0,'comment':_0x6e0d('0x2')},'paused':{'type':Sequelize[_0x6e0d('0x5')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xb989=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x4e04a8,_0x2f2d6a){var _0x6c3e6f=function(_0x806cf7){while(--_0x806cf7){_0x4e04a8['push'](_0x4e04a8['shift']());}};_0x6c3e6f(++_0x2f2d6a);}(_0xb989,0xea));var _0x9b98=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0xb989[_0x2a453b];return _0x132f79;};'use strict';var Sequelize=require('sequelize');module[_0x9b98('0x0')]={'uniqueid':{'type':Sequelize[_0x9b98('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9b98('0x2')},'membername':{'type':Sequelize[_0x9b98('0x3')],'allowNull':![],'comment':_0x9b98('0x2')},'UserId':{'type':Sequelize[_0x9b98('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9b98('0x3')],'allowNull':![],'unique':_0x9b98('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9b98('0x4'),'comment':_0x9b98('0x2')},'penalty':{'type':Sequelize[_0x9b98('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x9b98('0x1')](0xb),'defaultValue':0x0,'comment':_0x9b98('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0b0a2dd..723188c 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 _0xbc25=['update','emit','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x5231e5,_0x36e009){var _0x274de0=function(_0x351f2f){while(--_0x351f2f){_0x5231e5['push'](_0x5231e5['shift']());}};_0x274de0(++_0x36e009);}(_0xbc25,0x88));var _0x5bc2=function(_0x36d7a6,_0x242da1){_0x36d7a6=_0x36d7a6-0x0;var _0x5a5c41=_0xbc25[_0x36d7a6];return _0x5a5c41;};'use strict';var EventEmitter=require(_0x5bc2('0x0'));var UserVoiceQueueRt=require(_0x5bc2('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5bc2('0x2')](0x0);var events={'afterCreate':_0x5bc2('0x3'),'afterUpdate':_0x5bc2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x305085){return function(_0x37a2ef,_0xfaa9f6,_0x35a254){UserVoiceQueueRtEvents[_0x5bc2('0x5')](_0x305085+':'+_0x37a2ef['id'],_0x37a2ef);UserVoiceQueueRtEvents[_0x5bc2('0x5')](_0x305085,_0x37a2ef);_0x35a254(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5bc2('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xcccb=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','save','update','emit'];(function(_0x453c0e,_0x266500){var _0x3af4cc=function(_0x282fe4){while(--_0x282fe4){_0x453c0e['push'](_0x453c0e['shift']());}};_0x3af4cc(++_0x266500);}(_0xcccb,0x1c2));var _0xbccc=function(_0xde80e5,_0x51f243){_0xde80e5=_0xde80e5-0x0;var _0x3f00f4=_0xcccb[_0xde80e5];return _0x3f00f4;};'use strict';var EventEmitter=require(_0xbccc('0x0'));var UserVoiceQueueRt=require(_0xbccc('0x1'))['db'][_0xbccc('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbccc('0x3'),'afterUpdate':_0xbccc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b08e6){return function(_0x35deb6,_0x3729ff,_0x12ffaa){UserVoiceQueueRtEvents[_0xbccc('0x5')](_0x1b08e6+':'+_0x35deb6['id'],_0x35deb6);UserVoiceQueueRtEvents['emit'](_0x1b08e6,_0x35deb6);_0x12ffaa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xbccc('0x6')](e,emitEvent(event));}}module[_0xbccc('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index c475a6a..35fffaa 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 _0xf90d=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1f8f32,_0x353852){var _0x5c35fd=function(_0x3437db){while(--_0x3437db){_0x1f8f32['push'](_0x1f8f32['shift']());}};_0x5c35fd(++_0x353852);}(_0xf90d,0xbe));var _0xdf90=function(_0x2a19b5,_0x450ffc){_0x2a19b5=_0x2a19b5-0x0;var _0x255489=_0xf90d[_0x2a19b5];return _0x255489;};'use strict';var _=require(_0xdf90('0x0'));var util=require(_0xdf90('0x1'));var logger=require(_0xdf90('0x2'))(_0xdf90('0x3'));var moment=require(_0xdf90('0x4'));var BPromise=require(_0xdf90('0x5'));var rp=require(_0xdf90('0x6'));var fs=require('fs');var path=require(_0xdf90('0x7'));var rimraf=require(_0xdf90('0x8'));var config=require(_0xdf90('0x9'));var attributes=require(_0xdf90('0xa'));module['exports']=function(_0xaaa57b,_0x182d34){return _0xaaa57b[_0xdf90('0xb')](_0xdf90('0xc'),attributes,{'tableName':_0xdf90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6518=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x6518,0x180));var _0x8651=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x6518[_0x3da832];return _0xe602f2;};'use strict';var _=require(_0x8651('0x0'));var util=require(_0x8651('0x1'));var logger=require(_0x8651('0x2'))(_0x8651('0x3'));var moment=require(_0x8651('0x4'));var BPromise=require(_0x8651('0x5'));var rp=require(_0x8651('0x6'));var fs=require('fs');var path=require(_0x8651('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x8651('0x8')]=function(_0x403d28,_0x2d11ce){return _0x403d28[_0x8651('0x9')](_0x8651('0xa'),attributes,{'tableName':_0x8651('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 6d42a48..ae49c34 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 _0xaa78=['./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x51bfcf,_0x415320){var _0x3abe14=function(_0x21af13){while(--_0x21af13){_0x51bfcf['push'](_0x51bfcf['shift']());}};_0x3abe14(++_0x415320);}(_0xaa78,0x13f));var _0x8aa7=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0xaa78[_0x134192];return _0x3cd080;};'use strict';var _=require(_0x8aa7('0x0'));var util=require(_0x8aa7('0x1'));var moment=require(_0x8aa7('0x2'));var BPromise=require(_0x8aa7('0x3'));var rs=require(_0x8aa7('0x4'));var fs=require('fs');var Redis=require(_0x8aa7('0x5'));var db=require(_0x8aa7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8aa7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8aa7('0x8')][_0x8aa7('0x9')]({'port':0x232a});config[_0x8aa7('0xa')]=_[_0x8aa7('0xb')](config[_0x8aa7('0xa')],{'host':_0x8aa7('0xc'),'port':0x18eb});var socket=require(_0x8aa7('0xd'))(new Redis(config['redis']));require(_0x8aa7('0xe'))[_0x8aa7('0xf')](socket);function respondWithRpcPromise(_0x371655,_0x394a60,_0x57d8e1){return new BPromise(function(_0x381102,_0x117281){return client['request'](_0x371655,_0x57d8e1)[_0x8aa7('0x10')](function(_0x4af0b2){logger[_0x8aa7('0x11')](_0x8aa7('0x12'),_0x394a60,_0x8aa7('0x13'));logger[_0x8aa7('0x14')](_0x8aa7('0x15'),_0x394a60,_0x8aa7('0x13'),JSON[_0x8aa7('0x16')](_0x4af0b2));if(_0x4af0b2['error']){if(_0x4af0b2[_0x8aa7('0x17')][_0x8aa7('0x18')]===0x1f4){logger[_0x8aa7('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x394a60,_0x4af0b2[_0x8aa7('0x17')][_0x8aa7('0x19')]);return _0x117281(_0x4af0b2[_0x8aa7('0x17')][_0x8aa7('0x19')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x394a60,_0x4af0b2[_0x8aa7('0x17')][_0x8aa7('0x19')]);return _0x381102(_0x4af0b2['error'][_0x8aa7('0x19')]);}else{logger[_0x8aa7('0x11')](_0x8aa7('0x12'),_0x394a60,'request\x20sent');_0x381102(_0x4af0b2[_0x8aa7('0x1a')][_0x8aa7('0x19')]);}})[_0x8aa7('0x1b')](function(_0x1c0e7f){logger[_0x8aa7('0x17')](_0x8aa7('0x12'),_0x394a60,_0x1c0e7f);_0x117281(_0x1c0e7f);});});}exports[_0x8aa7('0x1c')]=function(_0x33ee54){var _0xf1a3de=this;return new Promise(function(_0x5a9da0,_0x782ffa){return db[_0x8aa7('0x1d')][_0x8aa7('0x1e')]({'raw':_0x33ee54[_0x8aa7('0x1f')]?_0x33ee54[_0x8aa7('0x1f')][_0x8aa7('0x20')]===undefined?!![]:![]:!![],'where':_0x33ee54['options']?_0x33ee54[_0x8aa7('0x1f')][_0x8aa7('0x21')]||null:null,'attributes':[[db[_0x8aa7('0x22')]['fn']('COUNT',db[_0x8aa7('0x22')]['fn']('IF',db[_0x8aa7('0x22')][_0x8aa7('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0x8aa7('0x24')]]})[_0x8aa7('0x10')](function(_0x5720ae){logger[_0x8aa7('0x11')](_0x8aa7('0x1c'),_0x33ee54);logger[_0x8aa7('0x14')](_0x8aa7('0x1c'),_0x33ee54,JSON[_0x8aa7('0x16')](_0x5720ae));_0x5a9da0(_0x5720ae);})['catch'](function(_0x1fbcfd){logger['error']('GetVoiceQueueRtPauses',_0x1fbcfd[_0x8aa7('0x19')],_0x33ee54);_0x782ffa(_0xf1a3de[_0x8aa7('0x17')](0x1f4,_0x1fbcfd[_0x8aa7('0x19')]));});});}; \ No newline at end of file +var _0xc5ea=['redis','defaults','localhost','./userVoiceQueueRt.socket','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x4569d7,_0x3a5b0d){var _0x471894=function(_0x23d7fe){while(--_0x23d7fe){_0x4569d7['push'](_0x4569d7['shift']());}};_0x471894(++_0x3a5b0d);}(_0xc5ea,0x1d0));var _0xac5e=function(_0x335c97,_0x485355){_0x335c97=_0x335c97-0x0;var _0x36ac8e=_0xc5ea[_0x335c97];return _0x36ac8e;};'use strict';var _=require(_0xac5e('0x0'));var util=require(_0xac5e('0x1'));var moment=require(_0xac5e('0x2'));var BPromise=require(_0xac5e('0x3'));var rs=require(_0xac5e('0x4'));var fs=require('fs');var Redis=require(_0xac5e('0x5'));var db=require(_0xac5e('0x6'))['db'];var utils=require(_0xac5e('0x7'));var logger=require('../../config/logger')(_0xac5e('0x8'));var config=require('../../config/environment');var jayson=require(_0xac5e('0x9'));var client=jayson[_0xac5e('0xa')][_0xac5e('0xb')]({'port':0x232a});config[_0xac5e('0xc')]=_[_0xac5e('0xd')](config[_0xac5e('0xc')],{'host':_0xac5e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac5e('0xc')]));require(_0xac5e('0xf'))['register'](socket);function respondWithRpcPromise(_0x25f53b,_0x2c2113,_0xa63c26){return new BPromise(function(_0x130114,_0x44e889){return client['request'](_0x25f53b,_0xa63c26)[_0xac5e('0x10')](function(_0x414904){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c2113,_0xac5e('0x11'));logger[_0xac5e('0x12')](_0xac5e('0x13'),_0x2c2113,_0xac5e('0x11'),JSON[_0xac5e('0x14')](_0x414904));if(_0x414904[_0xac5e('0x15')]){if(_0x414904[_0xac5e('0x15')][_0xac5e('0x16')]===0x1f4){logger[_0xac5e('0x15')](_0xac5e('0x17'),_0x2c2113,_0x414904[_0xac5e('0x15')][_0xac5e('0x18')]);return _0x44e889(_0x414904[_0xac5e('0x15')]['message']);}logger[_0xac5e('0x15')](_0xac5e('0x17'),_0x2c2113,_0x414904[_0xac5e('0x15')][_0xac5e('0x18')]);return _0x130114(_0x414904[_0xac5e('0x15')]['message']);}else{logger[_0xac5e('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c2113,'request\x20sent');_0x130114(_0x414904['result'][_0xac5e('0x18')]);}})[_0xac5e('0x1a')](function(_0x1e0eb){logger[_0xac5e('0x15')](_0xac5e('0x17'),_0x2c2113,_0x1e0eb);_0x44e889(_0x1e0eb);});});}exports[_0xac5e('0x1b')]=function(_0x4ddad2){var _0x414ebd=this;return new Promise(function(_0x3c517f,_0x21ce5e){return db['UserVoiceQueueRt'][_0xac5e('0x1c')]({'raw':_0x4ddad2['options']?_0x4ddad2[_0xac5e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4ddad2['options']?_0x4ddad2['options'][_0xac5e('0x1e')]||null:null,'attributes':[[db[_0xac5e('0x1f')]['fn']('COUNT',db[_0xac5e('0x1f')]['fn']('IF',db[_0xac5e('0x1f')]['literal'](_0xac5e('0x20')))),_0xac5e('0x21')]]})[_0xac5e('0x10')](function(_0x5a067b){logger[_0xac5e('0x19')](_0xac5e('0x1b'),_0x4ddad2);logger[_0xac5e('0x12')](_0xac5e('0x1b'),_0x4ddad2,JSON[_0xac5e('0x14')](_0x5a067b));_0x3c517f(_0x5a067b);})[_0xac5e('0x1a')](function(_0x5a7510){logger['error'](_0xac5e('0x1b'),_0x5a7510[_0xac5e('0x18')],_0x4ddad2);_0x21ce5e(_0x414ebd[_0xac5e('0x15')](0x1f4,_0x5a7510['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 368413e..c160bbd 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 _0xf321=['update','emit','removeListener','register','length','userVoiceQueueRt:','save','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf321,0x136));var _0x1f32=function(_0x58023c,_0x5db893){_0x58023c=_0x58023c-0x0;var _0x415ed9=_0xf321[_0x58023c];return _0x415ed9;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x1f32('0x0'),_0x1f32('0x1'),_0x1f32('0x2')];function createListener(_0x5a0cb4,_0x18a266){return function(_0x27ac10){_0x18a266[_0x1f32('0x3')](_0x5a0cb4,_0x27ac10);};}function removeListener(_0x2e5bd8,_0x3f2e58){return function(){UserVoiceQueueRtEvents[_0x1f32('0x4')](_0x2e5bd8,_0x3f2e58);};}exports[_0x1f32('0x5')]=function(_0x3bf810){for(var _0x1df230=0x0,_0x4307f8=events[_0x1f32('0x6')];_0x1df230<_0x4307f8;_0x1df230++){var _0x9acf12=events[_0x1df230];var _0x159a0d=createListener(_0x1f32('0x7')+_0x9acf12,_0x3bf810);UserVoiceQueueRtEvents['on'](_0x9acf12,_0x159a0d);}}; \ No newline at end of file +var _0x977f=['length','userVoiceQueueRt:','save','remove','emit','removeListener','register'];(function(_0x4c31b6,_0x29ddb1){var _0x295ab9=function(_0x1684ac){while(--_0x1684ac){_0x4c31b6['push'](_0x4c31b6['shift']());}};_0x295ab9(++_0x29ddb1);}(_0x977f,0x1ad));var _0xf977=function(_0x773eda,_0x2450d8){_0x773eda=_0x773eda-0x0;var _0x4a6b5a=_0x977f[_0x773eda];return _0x4a6b5a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xf977('0x0'),_0xf977('0x1'),'update'];function createListener(_0x5ddfc4,_0x4d0cec){return function(_0x3ffe71){_0x4d0cec[_0xf977('0x2')](_0x5ddfc4,_0x3ffe71);};}function removeListener(_0x23bf8b,_0x3b9e0c){return function(){UserVoiceQueueRtEvents[_0xf977('0x3')](_0x23bf8b,_0x3b9e0c);};}exports[_0xf977('0x4')]=function(_0x14a644){for(var _0x8782d4=0x0,_0x17f1fd=events[_0xf977('0x5')];_0x8782d4<_0x17f1fd;_0x8782d4++){var _0x393256=events[_0x8782d4];var _0x618684=createListener(_0xf977('0x6')+_0x393256,_0x14a644);UserVoiceQueueRtEvents['on'](_0x393256,_0x618684);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1331835..430f9bc 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 _0x5423=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','connect-timeout','express','fs-extra'];(function(_0x385900,_0x40f4fa){var _0x48dace=function(_0x26bddf){while(--_0x26bddf){_0x385900['push'](_0x385900['shift']());}};_0x48dace(++_0x40f4fa);}(_0x5423,0xe3));var _0x3542=function(_0xdded02,_0x385f97){_0xdded02=_0xdded02-0x0;var _0x132d3f=_0x5423[_0xdded02];return _0x132d3f;};'use strict';var multer=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var path=require('path');var timeout=require(_0x3542('0x2'));var express=require(_0x3542('0x3'));var router=express['Router']();var fs_extra=require(_0x3542('0x4'));var auth=require(_0x3542('0x5'));var interaction=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));module['exports']=router; \ No newline at end of file +var _0x40ac=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2da39c,_0x511ec6){var _0x44f789=function(_0x4a0c64){while(--_0x4a0c64){_0x2da39c['push'](_0x2da39c['shift']());}};_0x44f789(++_0x511ec6);}(_0x40ac,0x1de));var _0xc40a=function(_0x3bf148,_0x1683ef){_0x3bf148=_0x3bf148-0x0;var _0x511781=_0x40ac[_0x3bf148];return _0x511781;};'use strict';var multer=require(_0xc40a('0x0'));var util=require('util');var path=require(_0xc40a('0x1'));var timeout=require(_0xc40a('0x2'));var express=require(_0xc40a('0x3'));var router=express[_0xc40a('0x4')]();var fs_extra=require(_0xc40a('0x5'));var auth=require(_0xc40a('0x6'));var interaction=require(_0xc40a('0x7'));var config=require('../../config/environment');module[_0xc40a('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 71999cd..e90e782 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(_0x295c8a,_0x768dbe){var _0x50ccc0=function(_0x341add){while(--_0x341add){_0x295c8a['push'](_0x295c8a['shift']());}};_0x50ccc0(++_0x768dbe);}(_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(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 2b7bef6..91898d1 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 _0x4e81=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x4e81,0x1bc));var _0x14e8=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x4e81[_0x1b745b];return _0x120a9d;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14e8('0x3'));var fs=require('fs');var path=require(_0x14e8('0x4'));var rimraf=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var attributes=require(_0x14e8('0x7'));module[_0x14e8('0x8')]=function(_0x56a266,_0x57c79b){return _0x56a266[_0x14e8('0x9')](_0x14e8('0xa'),attributes,{'tableName':_0x14e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','lodash','util','api','moment'];(function(_0x117170,_0x35023d){var _0x10f9a1=function(_0x4624d7){while(--_0x4624d7){_0x117170['push'](_0x117170['shift']());}};_0x10f9a1(++_0x35023d);}(_0x5423,0xe3));var _0x3542=function(_0x44dc67,_0x4500e4){_0x44dc67=_0x44dc67-0x0;var _0x425965=_0x5423[_0x44dc67];return _0x425965;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index dd35ce5..145e2d8 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(_0x145ac9,_0x332cae){var _0x3e56c0=function(_0x58ff43){while(--_0x58ff43){_0x145ac9['push'](_0x145ac9['shift']());}};_0x3e56c0(++_0x332cae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x585bef,_0xcff5e6){var _0x2fadd9=function(_0x556f31){while(--_0x556f31){_0x585bef['push'](_0x585bef['shift']());}};_0x2fadd9(++_0xcff5e6);}(_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);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c6095ed..d772267 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 _0xdae5=['put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x47078c,_0x2dd424){var _0x2a7dd2=function(_0x188b34){while(--_0x188b34){_0x47078c['push'](_0x47078c['shift']());}};_0x2a7dd2(++_0x2dd424);}(_0xdae5,0x180));var _0x5dae=function(_0x8d3d4f,_0x57d4f6){_0x8d3d4f=_0x8d3d4f-0x0;var _0x328a35=_0xdae5[_0x8d3d4f];return _0x328a35;};'use strict';var multer=require('multer');var util=require(_0x5dae('0x0'));var path=require(_0x5dae('0x1'));var timeout=require(_0x5dae('0x2'));var express=require('express');var router=express[_0x5dae('0x3')]();var fs_extra=require(_0x5dae('0x4'));var auth=require(_0x5dae('0x5'));var interaction=require(_0x5dae('0x6'));var config=require('../../config/environment');var controller=require(_0x5dae('0x7'));router[_0x5dae('0x8')]('/',auth[_0x5dae('0x9')](),controller[_0x5dae('0xa')]);router['get'](_0x5dae('0xb'),auth[_0x5dae('0x9')](),controller[_0x5dae('0xc')]);router[_0x5dae('0xd')]('/',auth[_0x5dae('0x9')](),controller[_0x5dae('0xe')]);router[_0x5dae('0xf')](_0x5dae('0xb'),auth[_0x5dae('0x9')](),controller[_0x5dae('0x10')]);router[_0x5dae('0x11')]('/:id',auth[_0x5dae('0x9')](),controller['destroy']);module[_0x5dae('0x12')]=router; \ No newline at end of file +var _0x29c6=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29c6,0x89));var _0x629c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x29c6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x629c('0x0'));var util=require('util');var path=require(_0x629c('0x1'));var timeout=require(_0x629c('0x2'));var express=require('express');var router=express[_0x629c('0x3')]();var fs_extra=require(_0x629c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x629c('0x5'));var config=require(_0x629c('0x6'));var controller=require(_0x629c('0x7'));router[_0x629c('0x8')]('/',auth['isAuthenticated'](),controller[_0x629c('0x9')]);router[_0x629c('0x8')](_0x629c('0xa'),auth[_0x629c('0xb')](),controller[_0x629c('0xc')]);router[_0x629c('0xd')]('/',auth[_0x629c('0xb')](),controller['create']);router[_0x629c('0xe')](_0x629c('0xa'),auth[_0x629c('0xb')](),controller[_0x629c('0xf')]);router[_0x629c('0x10')](_0x629c('0xa'),auth['isAuthenticated'](),controller[_0x629c('0x11')]);module[_0x629c('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 6e0a993..7bc82a4 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 _0xb6de=['sequelize','STRING','name'];(function(_0x490100,_0x4c4ae6){var _0x26d3e5=function(_0x54412a){while(--_0x54412a){_0x490100['push'](_0x490100['shift']());}};_0x26d3e5(++_0x4c4ae6);}(_0xb6de,0x195));var _0xeb6d=function(_0x458020,_0x5073bf){_0x458020=_0x458020-0x0;var _0x3bc2ac=_0xb6de[_0x458020];return _0x3bc2ac;};'use strict';var Sequelize=require(_0xeb6d('0x0'));module['exports']={'name':{'type':Sequelize[_0xeb6d('0x1')],'unique':_0xeb6d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeb6d('0x1')]}}; \ No newline at end of file +var _0x463d=['STRING','name','sequelize','exports'];(function(_0x27712a,_0x465bfb){var _0x32eb04=function(_0x3699bd){while(--_0x3699bd){_0x27712a['push'](_0x27712a['shift']());}};_0x32eb04(++_0x465bfb);}(_0x463d,0xa2));var _0xd463=function(_0x3346ce,_0x25b2a9){_0x3346ce=_0x3346ce-0x0;var _0x570c16=_0x463d[_0x3346ce];return _0x570c16;};'use strict';var Sequelize=require(_0xd463('0x0'));module[_0xd463('0x1')]={'name':{'type':Sequelize[_0xd463('0x2')],'unique':_0xd463('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd463('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 95b930d..03d0585 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 _0x1fa9=['../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','Variables','UserProfileResource','end','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','map','VIRTUAL','filter','options','Variable','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2dba68,_0xb7d48){var _0x3a12a7=function(_0x14cef4){while(--_0x14cef4){_0x2dba68['push'](_0x2dba68['shift']());}};_0x3a12a7(++_0xb7d48);}(_0x1fa9,0x136));var _0x91fa=function(_0x56a497,_0x3c3b9f){_0x56a497=_0x56a497-0x0;var _0x2d134b=_0x1fa9[_0x56a497];return _0x2d134b;};'use strict';var emlformat=require(_0x91fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91fa('0x2'));var moment=require(_0x91fa('0x3'));var BPromise=require(_0x91fa('0x4'));var Mustache=require('mustache');var util=require(_0x91fa('0x5'));var path=require(_0x91fa('0x6'));var sox=require(_0x91fa('0x7'));var csv=require(_0x91fa('0x8'));var ejs=require(_0x91fa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91fa('0xa'));var squel=require(_0x91fa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x91fa('0xc'));var toCsv=require(_0x91fa('0x8'));var querystring=require(_0x91fa('0xd'));var Papa=require(_0x91fa('0xe'));var Redis=require(_0x91fa('0xf'));var authService=require(_0x91fa('0x10'));var qs=require(_0x91fa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x91fa('0x12'))(_0x91fa('0x13'));var utils=require(_0x91fa('0x14'));var config=require(_0x91fa('0x15'));var licenseUtil=require(_0x91fa('0x16'));var db=require(_0x91fa('0x17'))['db'];function respondWithStatusCode(_0x1bdb51,_0x578035){_0x578035=_0x578035||0xcc;return function(_0x5a904d){if(_0x5a904d){return _0x1bdb51['sendStatus'](_0x578035);}return _0x1bdb51[_0x91fa('0x18')](_0x578035)['end']();};}function respondWithResult(_0x5f215d,_0x4d95f5){_0x4d95f5=_0x4d95f5||0xc8;return function(_0x4650bf){if(_0x4650bf){return _0x5f215d[_0x91fa('0x18')](_0x4d95f5)['json'](_0x4650bf);}};}function respondWithFilteredResult(_0x308812,_0x252ec7){return function(_0x74c75d){if(_0x74c75d){var _0x2667da=typeof _0x252ec7[_0x91fa('0x19')]===_0x91fa('0x1a')&&typeof _0x252ec7['limit']===_0x91fa('0x1a');var _0x17c4d4=_0x74c75d[_0x91fa('0x1b')];var _0x3916cc=_0x2667da?0x0:_0x252ec7[_0x91fa('0x19')];var _0x4dcbcf=_0x2667da?_0x74c75d[_0x91fa('0x1b')]:_0x252ec7[_0x91fa('0x19')]+_0x252ec7[_0x91fa('0x1c')];var _0x1e3d6f;if(_0x4dcbcf>=_0x17c4d4){_0x4dcbcf=_0x17c4d4;_0x1e3d6f=0xc8;}else{_0x1e3d6f=0xce;}_0x308812[_0x91fa('0x18')](_0x1e3d6f);return _0x308812[_0x91fa('0x1d')](_0x91fa('0x1e'),_0x3916cc+'-'+_0x4dcbcf+'/'+_0x17c4d4)[_0x91fa('0x1f')](_0x74c75d);}return null;};}function patchUpdates(_0xba1e97){return function(_0x274d6f){try{jsonpatch[_0x91fa('0x20')](_0x274d6f,_0xba1e97,!![]);}catch(_0x4a8f08){return BPromise[_0x91fa('0x21')](_0x4a8f08);}return _0x274d6f[_0x91fa('0x22')]();};}function saveUpdates(_0x4ac68d,_0x1a6480){return function(_0x50596c){if(_0x50596c){return _0x50596c[_0x91fa('0x23')](_0x4ac68d)['then'](function(_0x4e619c){return _0x4e619c;});}return null;};}function removeEntity(_0x5d89f9,_0x2ed86d){return function(_0x6d4e53){if(_0x6d4e53){return _0x6d4e53[_0x91fa('0x24')]()[_0x91fa('0x25')](function(){var _0x1fd482=_0x6d4e53['get']({'plain':!![]});var _0x3048c4=_0x91fa('0x26');return db[_0x91fa('0x27')][_0x91fa('0x24')]({'where':{'type':_0x3048c4,'resourceId':_0x1fd482['id']}})['then'](function(){return _0x6d4e53;});})['then'](function(){_0x5d89f9[_0x91fa('0x18')](0xcc)[_0x91fa('0x28')]();});}};}function handleEntityNotFound(_0x26a9b3,_0x44af0b){return function(_0x1224ef){if(!_0x1224ef){_0x26a9b3['sendStatus'](0x194);}return _0x1224ef;};}function handleError(_0x1c2a60,_0x404bbc){_0x404bbc=_0x404bbc||0x1f4;return function(_0x402884){logger['error'](_0x402884['stack']);if(_0x402884[_0x91fa('0x29')]){delete _0x402884[_0x91fa('0x29')];}_0x1c2a60[_0x91fa('0x18')](_0x404bbc)[_0x91fa('0x2a')](_0x402884);};}exports[_0x91fa('0x2b')]=function(_0x17bba2,_0x27ed0e){var _0x33198a={},_0x455e8c={},_0x1ebc7c={'count':0x0,'rows':[]};var _0x115b09=_['map'](db['Variable'][_0x91fa('0x2c')],function(_0x242640){return{'name':_0x242640[_0x91fa('0x2d')],'type':_0x242640[_0x91fa('0x2e')][_0x91fa('0x2f')]};});_0x455e8c[_0x91fa('0x30')]=_['map'](_0x115b09,_0x91fa('0x29'));_0x455e8c[_0x91fa('0x31')]=_[_0x91fa('0x32')](_0x17bba2[_0x91fa('0x31')]);_0x455e8c[_0x91fa('0x33')]=_[_0x91fa('0x34')](_0x455e8c[_0x91fa('0x30')],_0x455e8c[_0x91fa('0x31')]);_0x33198a['attributes']=_['intersection'](_0x455e8c[_0x91fa('0x30')],qs[_0x91fa('0x35')](_0x17bba2['query'][_0x91fa('0x35')]));_0x33198a['attributes']=_0x33198a['attributes'][_0x91fa('0x36')]?_0x33198a[_0x91fa('0x37')]:_0x455e8c[_0x91fa('0x30')];if(!_0x17bba2['query'][_0x91fa('0x38')](_0x91fa('0x39'))){_0x33198a[_0x91fa('0x1c')]=qs[_0x91fa('0x1c')](_0x17bba2[_0x91fa('0x31')][_0x91fa('0x1c')]);_0x33198a[_0x91fa('0x19')]=qs['offset'](_0x17bba2[_0x91fa('0x31')][_0x91fa('0x19')]);}_0x33198a['order']=qs['sort'](_0x17bba2[_0x91fa('0x31')][_0x91fa('0x3a')]);_0x33198a['where']=qs[_0x91fa('0x33')](_[_0x91fa('0x3b')](_0x17bba2['query'],_0x455e8c[_0x91fa('0x33')]),_0x115b09);if(_0x17bba2['query']['filter']){_0x33198a[_0x91fa('0x3c')]=_[_0x91fa('0x3d')](_0x33198a['where'],{'$or':_[_0x91fa('0x3e')](_0x115b09,function(_0x60465f){if(_0x60465f['type']!==_0x91fa('0x3f')){var _0x501e3c={};_0x501e3c[_0x60465f[_0x91fa('0x29')]]={'$like':'%'+_0x17bba2['query'][_0x91fa('0x40')]+'%'};return _0x501e3c;}})});}_0x33198a=_['merge']({},_0x33198a,_0x17bba2[_0x91fa('0x41')]);var _0x988e5={'where':_0x33198a[_0x91fa('0x3c')]};return db[_0x91fa('0x42')]['count'](_0x988e5)[_0x91fa('0x25')](function(_0x337c8b){_0x1ebc7c[_0x91fa('0x1b')]=_0x337c8b;if(_0x17bba2[_0x91fa('0x31')][_0x91fa('0x43')]){_0x33198a[_0x91fa('0x44')]=[{'all':!![]}];}return db['Variable'][_0x91fa('0x45')](_0x33198a);})['then'](function(_0x4cdd67){_0x1ebc7c[_0x91fa('0x46')]=_0x4cdd67;return _0x1ebc7c;})[_0x91fa('0x25')](respondWithFilteredResult(_0x27ed0e,_0x33198a))[_0x91fa('0x47')](handleError(_0x27ed0e,null));};exports[_0x91fa('0x48')]=function(_0x3ec29e,_0x897db7){var _0x414259={'raw':!![],'where':{'id':_0x3ec29e[_0x91fa('0x49')]['id']}},_0x5d01d2={};_0x5d01d2['model']=_[_0x91fa('0x32')](db[_0x91fa('0x42')][_0x91fa('0x2c')]);_0x5d01d2[_0x91fa('0x31')]=_[_0x91fa('0x32')](_0x3ec29e[_0x91fa('0x31')]);_0x5d01d2[_0x91fa('0x33')]=_[_0x91fa('0x34')](_0x5d01d2[_0x91fa('0x30')],_0x5d01d2[_0x91fa('0x31')]);_0x414259[_0x91fa('0x37')]=_[_0x91fa('0x34')](_0x5d01d2[_0x91fa('0x30')],qs[_0x91fa('0x35')](_0x3ec29e[_0x91fa('0x31')]['fields']));_0x414259[_0x91fa('0x37')]=_0x414259[_0x91fa('0x37')][_0x91fa('0x36')]?_0x414259[_0x91fa('0x37')]:_0x5d01d2[_0x91fa('0x30')];if(_0x3ec29e[_0x91fa('0x31')][_0x91fa('0x43')]){_0x414259[_0x91fa('0x44')]=[{'all':!![]}];}_0x414259=_[_0x91fa('0x3d')]({},_0x414259,_0x3ec29e[_0x91fa('0x41')]);return db[_0x91fa('0x42')][_0x91fa('0x4a')](_0x414259)[_0x91fa('0x25')](handleEntityNotFound(_0x897db7,null))['then'](respondWithResult(_0x897db7,null))[_0x91fa('0x47')](handleError(_0x897db7,null));};exports[_0x91fa('0x4b')]=function(_0x27645d,_0x3f8ad7){return db[_0x91fa('0x42')]['create'](_0x27645d[_0x91fa('0x4c')],{})['then'](function(_0x3aac77){var _0x389ea9=_0x27645d[_0x91fa('0x4d')][_0x91fa('0x4e')]({'plain':!![]});if(!_0x389ea9)throw new Error(_0x91fa('0x4f'));if(_0x389ea9[_0x91fa('0x50')]===_0x91fa('0x4d')){var _0x6c02b9=_0x3aac77[_0x91fa('0x4e')]({'plain':!![]});var _0xed80bb=_0x91fa('0x26');return db['UserProfileSection'][_0x91fa('0x4a')]({'where':{'name':_0xed80bb,'userProfileId':_0x389ea9['userProfileId']},'raw':!![]})['then'](function(_0x5c9949){if(_0x5c9949&&_0x5c9949['autoAssociation']===0x0){return db['UserProfileResource'][_0x91fa('0x4b')]({'name':_0x6c02b9[_0x91fa('0x29')],'resourceId':_0x6c02b9['id'],'type':_0x5c9949[_0x91fa('0x29')],'sectionId':_0x5c9949['id']},{})[_0x91fa('0x25')](function(){return _0x3aac77;});}else{return _0x3aac77;}})[_0x91fa('0x47')](function(_0x6c76db){logger[_0x91fa('0x51')](_0x91fa('0x52'),_0x6c76db);throw _0x6c76db;});}return _0x3aac77;})['then'](respondWithResult(_0x3f8ad7,0xc9))['catch'](handleError(_0x3f8ad7,null));};exports['update']=function(_0x1ad7f9,_0x3797e4){if(_0x1ad7f9['body']['id']){delete _0x1ad7f9[_0x91fa('0x4c')]['id'];}return db[_0x91fa('0x42')][_0x91fa('0x4a')]({'where':{'id':_0x1ad7f9['params']['id']}})[_0x91fa('0x25')](handleEntityNotFound(_0x3797e4,null))['then'](saveUpdates(_0x1ad7f9[_0x91fa('0x4c')],null))[_0x91fa('0x25')](respondWithResult(_0x3797e4,null))[_0x91fa('0x47')](handleError(_0x3797e4,null));};exports[_0x91fa('0x24')]=function(_0x439b4b,_0x38121e){return db['Variable']['find']({'where':{'id':_0x439b4b[_0x91fa('0x49')]['id']}})[_0x91fa('0x25')](handleEntityNotFound(_0x38121e,null))[_0x91fa('0x25')](removeEntity(_0x38121e,null))[_0x91fa('0x47')](handleError(_0x38121e,null));}; \ No newline at end of file +var _0xab54=['update','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','map','Variable','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','save'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ab5('0x0'));var zipdir=require(_0x4ab5('0x1'));var jsonpatch=require(_0x4ab5('0x2'));var rp=require(_0x4ab5('0x3'));var moment=require(_0x4ab5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ab5('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4ab5('0x6'));var ejs=require(_0x4ab5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ab5('0x8'));var squel=require('squel');var crypto=require(_0x4ab5('0x9'));var jsforce=require(_0x4ab5('0xa'));var deskjs=require(_0x4ab5('0xb'));var toCsv=require(_0x4ab5('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ab5('0xc'));var qs=require(_0x4ab5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ab5('0xe'));var logger=require(_0x4ab5('0xf'))('api');var utils=require(_0x4ab5('0x10'));var config=require(_0x4ab5('0x11'));var licenseUtil=require(_0x4ab5('0x12'));var db=require(_0x4ab5('0x13'))['db'];function respondWithStatusCode(_0x34d4e5,_0xfb4366){_0xfb4366=_0xfb4366||0xcc;return function(_0x3bb255){if(_0x3bb255){return _0x34d4e5[_0x4ab5('0x14')](_0xfb4366);}return _0x34d4e5[_0x4ab5('0x15')](_0xfb4366)[_0x4ab5('0x16')]();};}function respondWithResult(_0x4486bb,_0x35abf2){_0x35abf2=_0x35abf2||0xc8;return function(_0x4fe2dd){if(_0x4fe2dd){return _0x4486bb[_0x4ab5('0x15')](_0x35abf2)['json'](_0x4fe2dd);}};}function respondWithFilteredResult(_0x3b9e16,_0x4b48bf){return function(_0x1c19f7){if(_0x1c19f7){var _0x5d0cbf=typeof _0x4b48bf['offset']===_0x4ab5('0x17')&&typeof _0x4b48bf[_0x4ab5('0x18')]===_0x4ab5('0x17');var _0x2f319d=_0x1c19f7['count'];var _0x151ec6=_0x5d0cbf?0x0:_0x4b48bf[_0x4ab5('0x19')];var _0x4b60c1=_0x5d0cbf?_0x1c19f7['count']:_0x4b48bf['offset']+_0x4b48bf[_0x4ab5('0x18')];var _0x5b0c3e;if(_0x4b60c1>=_0x2f319d){_0x4b60c1=_0x2f319d;_0x5b0c3e=0xc8;}else{_0x5b0c3e=0xce;}_0x3b9e16['status'](_0x5b0c3e);return _0x3b9e16[_0x4ab5('0x1a')](_0x4ab5('0x1b'),_0x151ec6+'-'+_0x4b60c1+'/'+_0x2f319d)[_0x4ab5('0x1c')](_0x1c19f7);}return null;};}function patchUpdates(_0x267466){return function(_0x1fa0e7){try{jsonpatch[_0x4ab5('0x1d')](_0x1fa0e7,_0x267466,!![]);}catch(_0x45514d){return BPromise['reject'](_0x45514d);}return _0x1fa0e7[_0x4ab5('0x1e')]();};}function saveUpdates(_0x918d1a,_0x334304){return function(_0x356127){if(_0x356127){return _0x356127[_0x4ab5('0x1f')](_0x918d1a)[_0x4ab5('0x20')](function(_0x4d59b0){return _0x4d59b0;});}return null;};}function removeEntity(_0xe5e093,_0x5af3df){return function(_0x100f38){if(_0x100f38){return _0x100f38[_0x4ab5('0x21')]()[_0x4ab5('0x20')](function(){var _0x24a585=_0x100f38[_0x4ab5('0x22')]({'plain':!![]});var _0x231945=_0x4ab5('0x23');return db[_0x4ab5('0x24')][_0x4ab5('0x21')]({'where':{'type':_0x231945,'resourceId':_0x24a585['id']}})[_0x4ab5('0x20')](function(){return _0x100f38;});})['then'](function(){_0xe5e093[_0x4ab5('0x15')](0xcc)[_0x4ab5('0x16')]();});}};}function handleEntityNotFound(_0x251564,_0x278938){return function(_0x1c3a2e){if(!_0x1c3a2e){_0x251564[_0x4ab5('0x14')](0x194);}return _0x1c3a2e;};}function handleError(_0x2d5bf2,_0xa4b01f){_0xa4b01f=_0xa4b01f||0x1f4;return function(_0x201aa5){logger[_0x4ab5('0x25')](_0x201aa5[_0x4ab5('0x26')]);if(_0x201aa5[_0x4ab5('0x27')]){delete _0x201aa5[_0x4ab5('0x27')];}_0x2d5bf2[_0x4ab5('0x15')](_0xa4b01f)['send'](_0x201aa5);};}exports[_0x4ab5('0x28')]=function(_0xc73eda,_0x3e5b88){var _0x513a4f={},_0x5568e9={},_0x3c0b72={'count':0x0,'rows':[]};var _0xb507a7=_[_0x4ab5('0x29')](db[_0x4ab5('0x2a')]['rawAttributes'],function(_0x18f3f0){return{'name':_0x18f3f0[_0x4ab5('0x2b')],'type':_0x18f3f0['type'][_0x4ab5('0x2c')]};});_0x5568e9[_0x4ab5('0x2d')]=_[_0x4ab5('0x29')](_0xb507a7,'name');_0x5568e9[_0x4ab5('0x2e')]=_[_0x4ab5('0x2f')](_0xc73eda[_0x4ab5('0x2e')]);_0x5568e9['filters']=_[_0x4ab5('0x30')](_0x5568e9['model'],_0x5568e9[_0x4ab5('0x2e')]);_0x513a4f['attributes']=_[_0x4ab5('0x30')](_0x5568e9[_0x4ab5('0x2d')],qs[_0x4ab5('0x31')](_0xc73eda[_0x4ab5('0x2e')]['fields']));_0x513a4f[_0x4ab5('0x32')]=_0x513a4f[_0x4ab5('0x32')]['length']?_0x513a4f[_0x4ab5('0x32')]:_0x5568e9[_0x4ab5('0x2d')];if(!_0xc73eda[_0x4ab5('0x2e')][_0x4ab5('0x33')](_0x4ab5('0x34'))){_0x513a4f[_0x4ab5('0x18')]=qs['limit'](_0xc73eda[_0x4ab5('0x2e')][_0x4ab5('0x18')]);_0x513a4f[_0x4ab5('0x19')]=qs['offset'](_0xc73eda[_0x4ab5('0x2e')][_0x4ab5('0x19')]);}_0x513a4f[_0x4ab5('0x35')]=qs[_0x4ab5('0x36')](_0xc73eda[_0x4ab5('0x2e')][_0x4ab5('0x36')]);_0x513a4f[_0x4ab5('0x37')]=qs[_0x4ab5('0x38')](_['pick'](_0xc73eda[_0x4ab5('0x2e')],_0x5568e9['filters']),_0xb507a7);if(_0xc73eda[_0x4ab5('0x2e')][_0x4ab5('0x39')]){_0x513a4f[_0x4ab5('0x37')]=_[_0x4ab5('0x3a')](_0x513a4f[_0x4ab5('0x37')],{'$or':_[_0x4ab5('0x29')](_0xb507a7,function(_0x465bde){if(_0x465bde[_0x4ab5('0x3b')]!==_0x4ab5('0x3c')){var _0x4aa2bf={};_0x4aa2bf[_0x465bde[_0x4ab5('0x27')]]={'$like':'%'+_0xc73eda[_0x4ab5('0x2e')]['filter']+'%'};return _0x4aa2bf;}})});}_0x513a4f=_[_0x4ab5('0x3a')]({},_0x513a4f,_0xc73eda[_0x4ab5('0x3d')]);var _0x1c7c42={'where':_0x513a4f[_0x4ab5('0x37')]};return db[_0x4ab5('0x2a')][_0x4ab5('0x3e')](_0x1c7c42)[_0x4ab5('0x20')](function(_0x4f7d44){_0x3c0b72[_0x4ab5('0x3e')]=_0x4f7d44;if(_0xc73eda[_0x4ab5('0x2e')][_0x4ab5('0x3f')]){_0x513a4f[_0x4ab5('0x40')]=[{'all':!![]}];}return db[_0x4ab5('0x2a')][_0x4ab5('0x41')](_0x513a4f);})[_0x4ab5('0x20')](function(_0x35928d){_0x3c0b72['rows']=_0x35928d;return _0x3c0b72;})[_0x4ab5('0x20')](respondWithFilteredResult(_0x3e5b88,_0x513a4f))[_0x4ab5('0x42')](handleError(_0x3e5b88,null));};exports[_0x4ab5('0x43')]=function(_0x7cf795,_0xba1c7d){var _0x29618b={'raw':!![],'where':{'id':_0x7cf795[_0x4ab5('0x44')]['id']}},_0x28bd7b={};_0x28bd7b['model']=_[_0x4ab5('0x2f')](db['Variable'][_0x4ab5('0x45')]);_0x28bd7b[_0x4ab5('0x2e')]=_[_0x4ab5('0x2f')](_0x7cf795['query']);_0x28bd7b[_0x4ab5('0x38')]=_[_0x4ab5('0x30')](_0x28bd7b[_0x4ab5('0x2d')],_0x28bd7b['query']);_0x29618b['attributes']=_[_0x4ab5('0x30')](_0x28bd7b[_0x4ab5('0x2d')],qs['fields'](_0x7cf795['query'][_0x4ab5('0x31')]));_0x29618b[_0x4ab5('0x32')]=_0x29618b['attributes']['length']?_0x29618b['attributes']:_0x28bd7b[_0x4ab5('0x2d')];if(_0x7cf795[_0x4ab5('0x2e')]['includeAll']){_0x29618b[_0x4ab5('0x40')]=[{'all':!![]}];}_0x29618b=_['merge']({},_0x29618b,_0x7cf795[_0x4ab5('0x3d')]);return db[_0x4ab5('0x2a')][_0x4ab5('0x46')](_0x29618b)[_0x4ab5('0x20')](handleEntityNotFound(_0xba1c7d,null))[_0x4ab5('0x20')](respondWithResult(_0xba1c7d,null))[_0x4ab5('0x42')](handleError(_0xba1c7d,null));};exports[_0x4ab5('0x47')]=function(_0x35abc7,_0x5891a2){return db[_0x4ab5('0x2a')][_0x4ab5('0x47')](_0x35abc7['body'],{})['then'](function(_0xd46416){var _0x7d4126=_0x35abc7['user'][_0x4ab5('0x22')]({'plain':!![]});if(!_0x7d4126)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7d4126[_0x4ab5('0x48')]==='user'){var _0x40309f=_0xd46416['get']({'plain':!![]});var _0x57a0a5=_0x4ab5('0x23');return db['UserProfileSection'][_0x4ab5('0x46')]({'where':{'name':_0x57a0a5,'userProfileId':_0x7d4126[_0x4ab5('0x49')]},'raw':!![]})['then'](function(_0x2c46c2){if(_0x2c46c2&&_0x2c46c2[_0x4ab5('0x4a')]===0x0){return db[_0x4ab5('0x24')][_0x4ab5('0x47')]({'name':_0x40309f[_0x4ab5('0x27')],'resourceId':_0x40309f['id'],'type':_0x2c46c2[_0x4ab5('0x27')],'sectionId':_0x2c46c2['id']},{})[_0x4ab5('0x20')](function(){return _0xd46416;});}else{return _0xd46416;}})[_0x4ab5('0x42')](function(_0x3305dd){logger['error'](_0x4ab5('0x4b'),_0x3305dd);throw _0x3305dd;});}return _0xd46416;})[_0x4ab5('0x20')](respondWithResult(_0x5891a2,0xc9))['catch'](handleError(_0x5891a2,null));};exports['update']=function(_0x3f5ae,_0x195aed){if(_0x3f5ae[_0x4ab5('0x4c')]['id']){delete _0x3f5ae[_0x4ab5('0x4c')]['id'];}return db[_0x4ab5('0x2a')][_0x4ab5('0x46')]({'where':{'id':_0x3f5ae[_0x4ab5('0x44')]['id']}})[_0x4ab5('0x20')](handleEntityNotFound(_0x195aed,null))['then'](saveUpdates(_0x3f5ae[_0x4ab5('0x4c')],null))[_0x4ab5('0x20')](respondWithResult(_0x195aed,null))[_0x4ab5('0x42')](handleError(_0x195aed,null));};exports['destroy']=function(_0xbe20fb,_0x1a2c7d){return db['Variable'][_0x4ab5('0x46')]({'where':{'id':_0xbe20fb[_0x4ab5('0x44')]['id']}})[_0x4ab5('0x20')](handleEntityNotFound(_0x1a2c7d,null))[_0x4ab5('0x20')](removeEntity(_0x1a2c7d,null))[_0x4ab5('0x42')](handleError(_0x1a2c7d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5d889ee..a5a7911 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 _0xe205=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','tools_variables','lodash'];(function(_0x34421e,_0xf309a2){var _0x5725d7=function(_0x367fbf){while(--_0x367fbf){_0x34421e['push'](_0x34421e['shift']());}};_0x5725d7(++_0xf309a2);}(_0xe205,0xa7));var _0x5e20=function(_0x193d09,_0x129093){_0x193d09=_0x193d09-0x0;var _0x39c4ec=_0xe205[_0x193d09];return _0x39c4ec;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var logger=require(_0x5e20('0x2'))(_0x5e20('0x3'));var moment=require(_0x5e20('0x4'));var BPromise=require(_0x5e20('0x5'));var rp=require(_0x5e20('0x6'));var fs=require('fs');var path=require(_0x5e20('0x7'));var rimraf=require(_0x5e20('0x8'));var config=require('../../config/environment');var attributes=require(_0x5e20('0x9'));module[_0x5e20('0xa')]=function(_0x44dbb3,_0x3c4203){return _0x44dbb3['define']('Variable',attributes,{'tableName':_0x5e20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcef6=['Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./variable.attributes','exports','define'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0xcef6,0x16e));var _0x6cef=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xcef6[_0x26a906];return _0x495575;};'use strict';var _=require(_0x6cef('0x0'));var util=require(_0x6cef('0x1'));var logger=require(_0x6cef('0x2'))(_0x6cef('0x3'));var moment=require(_0x6cef('0x4'));var BPromise=require(_0x6cef('0x5'));var rp=require(_0x6cef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6cef('0x7'));var attributes=require(_0x6cef('0x8'));module[_0x6cef('0x9')]=function(_0x22227e,_0x26c08b){return _0x22227e[_0x6cef('0xa')](_0x6cef('0xb'),attributes,{'tableName':_0x6cef('0xc'),'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 135fb0c..d1dde3b 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 _0xd913=['then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','code','error','message','ShowVariable','Variable','options','where','attributes','include','model','map','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xd7e544,_0x4811bf){var _0x3dbcf7=function(_0x1641e0){while(--_0x1641e0){_0xd7e544['push'](_0xd7e544['shift']());}};_0x3dbcf7(++_0x4811bf);}(_0xd913,0x6c));var _0x3d91=function(_0x4566db,_0x5da9a1){_0x4566db=_0x4566db-0x0;var _0x3167e6=_0xd913[_0x4566db];return _0x3167e6;};'use strict';var _=require('lodash');var util=require(_0x3d91('0x0'));var moment=require(_0x3d91('0x1'));var BPromise=require(_0x3d91('0x2'));var rs=require(_0x3d91('0x3'));var fs=require('fs');var Redis=require(_0x3d91('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d91('0x5'));var logger=require(_0x3d91('0x6'))('rpc');var config=require(_0x3d91('0x7'));var jayson=require(_0x3d91('0x8'));var client=jayson[_0x3d91('0x9')][_0x3d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ae971,_0x40ef0d,_0x31b89c){return new BPromise(function(_0x2cda66,_0x4d06dc){return client[_0x3d91('0xb')](_0x3ae971,_0x31b89c)[_0x3d91('0xc')](function(_0x58137b){logger[_0x3d91('0xd')](_0x3d91('0xe'),_0x40ef0d,_0x3d91('0xf'));logger[_0x3d91('0x10')](_0x3d91('0x11'),_0x40ef0d,'request\x20sent',JSON['stringify'](_0x58137b));if(_0x58137b['error']){if(_0x58137b['error'][_0x3d91('0x12')]===0x1f4){logger[_0x3d91('0x13')](_0x3d91('0xe'),_0x40ef0d,_0x58137b[_0x3d91('0x13')][_0x3d91('0x14')]);return _0x4d06dc(_0x58137b['error']['message']);}logger['error']('Variable,\x20%s,\x20%s',_0x40ef0d,_0x58137b[_0x3d91('0x13')][_0x3d91('0x14')]);return _0x2cda66(_0x58137b[_0x3d91('0x13')][_0x3d91('0x14')]);}else{logger[_0x3d91('0xd')](_0x3d91('0xe'),_0x40ef0d,'request\x20sent');_0x2cda66(_0x58137b['result'][_0x3d91('0x14')]);}})['catch'](function(_0x510c4c){logger[_0x3d91('0x13')](_0x3d91('0xe'),_0x40ef0d,_0x510c4c);_0x4d06dc(_0x510c4c);});});}exports[_0x3d91('0x15')]=function(_0x4aca66){var _0x53e9c0=this;return new Promise(function(_0x36fbd0,_0xa1c13e){return db[_0x3d91('0x16')]['find']({'raw':_0x4aca66[_0x3d91('0x17')]?_0x4aca66[_0x3d91('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4aca66[_0x3d91('0x17')]?_0x4aca66[_0x3d91('0x17')][_0x3d91('0x18')]||null:null,'attributes':_0x4aca66[_0x3d91('0x17')]?_0x4aca66[_0x3d91('0x17')][_0x3d91('0x19')]||null:null,'include':_0x4aca66[_0x3d91('0x17')]?_0x4aca66[_0x3d91('0x17')][_0x3d91('0x1a')]?_['map'](_0x4aca66[_0x3d91('0x17')][_0x3d91('0x1a')],function(_0x5f56de){return{'model':db[_0x5f56de[_0x3d91('0x1b')]],'as':_0x5f56de['as'],'attributes':_0x5f56de[_0x3d91('0x19')],'include':_0x5f56de['include']?_[_0x3d91('0x1c')](_0x5f56de[_0x3d91('0x1a')],function(_0xfed527){return{'model':db[_0xfed527[_0x3d91('0x1b')]],'as':_0xfed527['as'],'attributes':_0xfed527[_0x3d91('0x19')],'include':_0xfed527[_0x3d91('0x1a')]?_[_0x3d91('0x1c')](_0xfed527[_0x3d91('0x1a')],function(_0x22e8c9){return{'model':db[_0x22e8c9[_0x3d91('0x1b')]],'as':_0x22e8c9['as'],'attributes':_0x22e8c9[_0x3d91('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3d91('0xc')](function(_0x35effc){logger['info'](_0x3d91('0x15'),_0x4aca66);logger[_0x3d91('0x10')](_0x3d91('0x15'),_0x4aca66,JSON['stringify'](_0x35effc));_0x36fbd0(_0x35effc);})[_0x3d91('0x1d')](function(_0x6d8299){logger[_0x3d91('0x13')]('ShowVariable',_0x6d8299['message'],_0x4aca66);_0xa1c13e(_0x53e9c0['error'](0x1f4,_0x6d8299[_0x3d91('0x14')]));});});}; \ No newline at end of file +var _0x4b04=['rpc','../../config/environment','jayson/promise','client','http','request','then','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Variable,\x20%s,\x20%s','message','info','result','catch','ShowVariable','Variable','find','options','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x38b954,_0x1e88e6){var _0x578ce=function(_0x512d5e){while(--_0x512d5e){_0x38b954['push'](_0x38b954['shift']());}};_0x578ce(++_0x1e88e6);}(_0x4b04,0xe1));var _0x44b0=function(_0x29b435,_0x32e245){_0x29b435=_0x29b435-0x0;var _0x58b9c9=_0x4b04[_0x29b435];return _0x58b9c9;};'use strict';var _=require('lodash');var util=require(_0x44b0('0x0'));var moment=require(_0x44b0('0x1'));var BPromise=require(_0x44b0('0x2'));var rs=require(_0x44b0('0x3'));var fs=require('fs');var Redis=require(_0x44b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x44b0('0x5'));var logger=require('../../config/logger')(_0x44b0('0x6'));var config=require(_0x44b0('0x7'));var jayson=require(_0x44b0('0x8'));var client=jayson[_0x44b0('0x9')][_0x44b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7a9250,_0x126af4,_0x9d0580){return new BPromise(function(_0x1d74ba,_0x25b016){return client[_0x44b0('0xb')](_0x7a9250,_0x9d0580)[_0x44b0('0xc')](function(_0x3080d1){logger['info']('Variable,\x20%s,\x20%s',_0x126af4,'request\x20sent');logger[_0x44b0('0xd')](_0x44b0('0xe'),_0x126af4,_0x44b0('0xf'),JSON[_0x44b0('0x10')](_0x3080d1));if(_0x3080d1[_0x44b0('0x11')]){if(_0x3080d1[_0x44b0('0x11')][_0x44b0('0x12')]===0x1f4){logger[_0x44b0('0x11')](_0x44b0('0x13'),_0x126af4,_0x3080d1[_0x44b0('0x11')][_0x44b0('0x14')]);return _0x25b016(_0x3080d1[_0x44b0('0x11')][_0x44b0('0x14')]);}logger['error'](_0x44b0('0x13'),_0x126af4,_0x3080d1[_0x44b0('0x11')][_0x44b0('0x14')]);return _0x1d74ba(_0x3080d1[_0x44b0('0x11')][_0x44b0('0x14')]);}else{logger[_0x44b0('0x15')]('Variable,\x20%s,\x20%s',_0x126af4,_0x44b0('0xf'));_0x1d74ba(_0x3080d1[_0x44b0('0x16')][_0x44b0('0x14')]);}})[_0x44b0('0x17')](function(_0x2946ba){logger['error'](_0x44b0('0x13'),_0x126af4,_0x2946ba);_0x25b016(_0x2946ba);});});}exports[_0x44b0('0x18')]=function(_0x3bd41f){var _0x5dc73c=this;return new Promise(function(_0x448474,_0x20b4da){return db[_0x44b0('0x19')][_0x44b0('0x1a')]({'raw':_0x3bd41f[_0x44b0('0x1b')]?_0x3bd41f[_0x44b0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3bd41f['options']?_0x3bd41f[_0x44b0('0x1b')][_0x44b0('0x1c')]||null:null,'attributes':_0x3bd41f[_0x44b0('0x1b')]?_0x3bd41f['options'][_0x44b0('0x1d')]||null:null,'include':_0x3bd41f['options']?_0x3bd41f[_0x44b0('0x1b')][_0x44b0('0x1e')]?_[_0x44b0('0x1f')](_0x3bd41f[_0x44b0('0x1b')]['include'],function(_0x489fd7){return{'model':db[_0x489fd7[_0x44b0('0x20')]],'as':_0x489fd7['as'],'attributes':_0x489fd7[_0x44b0('0x1d')],'include':_0x489fd7[_0x44b0('0x1e')]?_[_0x44b0('0x1f')](_0x489fd7[_0x44b0('0x1e')],function(_0x47fa5b){return{'model':db[_0x47fa5b[_0x44b0('0x20')]],'as':_0x47fa5b['as'],'attributes':_0x47fa5b[_0x44b0('0x1d')],'include':_0x47fa5b[_0x44b0('0x1e')]?_['map'](_0x47fa5b[_0x44b0('0x1e')],function(_0x52243d){return{'model':db[_0x52243d[_0x44b0('0x20')]],'as':_0x52243d['as'],'attributes':_0x52243d['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b0('0xc')](function(_0x9ed769){logger[_0x44b0('0x15')](_0x44b0('0x18'),_0x3bd41f);logger['debug']('ShowVariable',_0x3bd41f,JSON[_0x44b0('0x10')](_0x9ed769));_0x448474(_0x9ed769);})[_0x44b0('0x17')](function(_0x8f9b1e){logger[_0x44b0('0x11')](_0x44b0('0x18'),_0x8f9b1e[_0x44b0('0x14')],_0x3bd41f);_0x20b4da(_0x5dc73c[_0x44b0('0x11')](0x1f4,_0x8f9b1e[_0x44b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 666f10c..2b287a0 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 _0x455f=['canUpdate','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch','/reset'];(function(_0x1ae04a,_0x18ee45){var _0x126c5e=function(_0x47e070){while(--_0x47e070){_0x1ae04a['push'](_0x1ae04a['shift']());}};_0x126c5e(++_0x18ee45);}(_0x455f,0x118));var _0xf455=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x455f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xf455('0x0'));var router=express[_0xf455('0x1')]();var auth=require(_0xf455('0x2'));var controller=require(_0xf455('0x3'));router['get']('/',controller['index']);router[_0xf455('0x4')](_0xf455('0x5'),auth[_0xf455('0x6')](),auth['canUpdate'](),controller[_0xf455('0x7')]);router[_0xf455('0x4')](_0xf455('0x8'),auth[_0xf455('0x6')](),auth[_0xf455('0x9')](),controller['reset']);router[_0xf455('0x4')](_0xf455('0xa'),auth[_0xf455('0x6')](),auth[_0xf455('0x9')](),controller[_0xf455('0xb')]);router['get'](_0xf455('0xc'),auth['isAuthenticated'](),controller[_0xf455('0xd')]);router[_0xf455('0x4')](_0xf455('0xe'),controller[_0xf455('0xf')]);module[_0xf455('0x10')]=router; \ No newline at end of file +var _0xf33f=['/restart','/migrations','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xf33f,0x13d));var _0xff33=function(_0x427fe7,_0x79331a){_0x427fe7=_0x427fe7-0x0;var _0x5ee4ab=_0xf33f[_0x427fe7];return _0x5ee4ab;};'use strict';var express=require(_0xff33('0x0'));var router=express[_0xff33('0x1')]();var auth=require(_0xff33('0x2'));var controller=require(_0xff33('0x3'));router['get']('/',controller[_0xff33('0x4')]);router[_0xff33('0x5')](_0xff33('0x6'),auth[_0xff33('0x7')](),auth[_0xff33('0x8')](),controller[_0xff33('0x9')]);router[_0xff33('0x5')](_0xff33('0xa'),auth[_0xff33('0x7')](),auth['canUpdate'](),controller[_0xff33('0xb')]);router[_0xff33('0x5')](_0xff33('0xc'),auth[_0xff33('0x7')](),auth[_0xff33('0x8')](),controller['pull']);router['get'](_0xff33('0xd'),auth[_0xff33('0x7')](),controller['restart']);router[_0xff33('0x5')](_0xff33('0xe'),controller['migrations']);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 7e54bf2..43585ce 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 _0x6a55=['restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','length','replace','.js','exports','push','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','version','exec','../../config/environment','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6a55,0xdb));var _0x56a5=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x6a55[_0x1663ae];return _0x30ffb8;};'use strict';var Umzug=require(_0x56a5('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x56a5('0x1'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0x56a5('0x2')];var db=require('../../mysqldb')['db'];var config=require(_0x56a5('0x3'));var pm2=require('../../config/pm2');var logger=require(_0x56a5('0x4'))(_0x56a5('0x5'));var git=require(_0x56a5('0x6'))(config[_0x56a5('0x7')]);exports[_0x56a5('0x8')]=function(_0x2272d9,_0x2b8f57){var _0x387dcb={'current':module['exports'][_0x56a5('0x1')],'phonebar':0x2};if(_0x2272d9[_0x56a5('0x9')]&&_0x2272d9[_0x56a5('0x9')][_0x56a5('0xa')]){return git[_0x56a5('0xb')]()[_0x56a5('0xc')](function(_0x2ad997,_0x258c20){_0x387dcb[_0x56a5('0xa')]=(_0x2ad997?module['exports']['version']:_0x258c20[_0x56a5('0xa')])||_0x56a5('0xd');return _0x2b8f57[_0x56a5('0xe')](0xc8)[_0x56a5('0xf')](_0x387dcb);});}else{return _0x2b8f57[_0x56a5('0xe')](0xc8)[_0x56a5('0xf')](_0x387dcb);}};exports['fetch']=function(_0x4a6dc5,_0x3e3ff6){return git[_0x56a5('0xb')]([_0x56a5('0x10'),_0x56a5('0x11')],function(_0x310c32){if(_0x310c32){logger[_0x56a5('0x12')](_0x310c32);return _0x3e3ff6[_0x56a5('0xe')](0x1f4)['json'](_0x310c32);}logger[_0x56a5('0x13')]('git\x20fetch');return _0x3e3ff6[_0x56a5('0xe')](0xc8)['json']({'output':_0x56a5('0x14')});});};exports[_0x56a5('0x15')]=function(_0x173c65,_0x28fe74){return git[_0x56a5('0x15')]([_0x56a5('0x16'),_0x56a5('0x17')],function(_0x5d6c25){if(_0x5d6c25){logger[_0x56a5('0x12')](_0x5d6c25);return _0x28fe74[_0x56a5('0xe')](0x1f4)[_0x56a5('0xf')](_0x5d6c25);}logger[_0x56a5('0x13')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x28fe74[_0x56a5('0xe')](0xc8)[_0x56a5('0xf')]({'output':_0x56a5('0x18')});});};exports[_0x56a5('0x19')]=function(_0x155d3b,_0x529711){exec('npm\x20install\x20--production',function(_0x29f181,_0x1c4ab8,_0x487505){logger[_0x56a5('0x13')](_0x1c4ab8);logger[_0x56a5('0x13')](_0x487505);if(_0x29f181){logger[_0x56a5('0x12')](_0x29f181);return _0x529711[_0x56a5('0xe')](0x1f4)[_0x56a5('0xf')](_0x29f181);}return _0x529711[_0x56a5('0xe')](0xc8)[_0x56a5('0xf')]({'output':_0x1c4ab8});});};exports[_0x56a5('0x1a')]=function(_0x2f4514,_0x2035c7){return pm2[_0x56a5('0x1a')](_0x56a5('0x1b'))[_0x56a5('0x1c')](function(_0x4f68b9){logger[_0x56a5('0x13')](_0x56a5('0x1d'),_0x4f68b9);return _0x2035c7[_0x56a5('0xe')](0xc8)[_0x56a5('0xf')]({'output':_0x56a5('0x1e')});})['catch'](function(_0x18e863){logger['error'](_0x18e863);return _0x2035c7[_0x56a5('0xe')](0x1f4)[_0x56a5('0xf')](_0x18e863);});};exports[_0x56a5('0x1f')]=function(_0x284ee5,_0x4e7afd){var _0x3b55e6=fs[_0x56a5('0x20')](path[_0x56a5('0x21')](config['root'],_0x56a5('0x22'),_0x56a5('0x1f')));var _0xeb4378=[];for(var _0x214649=0x0;_0x214649<_0x3b55e6[_0x56a5('0x23')];_0x214649++){var _0x4e1a6b=_0x3b55e6[_0x214649][_0x56a5('0x24')](_0x56a5('0x25'),'');if(compareVersions(module[_0x56a5('0x26')][_0x56a5('0x1')],_0x4e1a6b)===-0x1){_0xeb4378[_0x56a5('0x27')](_0x4e1a6b);}}if(_0xeb4378['length']){var _0x516b38=_0xeb4378[_0x56a5('0x28')](compareVersions);var _0xe17c5e=new Umzug({'storage':_0x56a5('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0x56a5('0x2a'),'columnName':_0x56a5('0x1')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error(_0x56a5('0x2b'));}],'path':path[_0x56a5('0x21')](config[_0x56a5('0x7')],'server',_0x56a5('0x1f')),'pattern':/\.js$/}});_0xe17c5e['up']({'migrations':_['map'](_0x516b38,function(_0x1f46b9){return _0x1f46b9+_0x56a5('0x25');})})['then'](function(){return _0x4e7afd[_0x56a5('0xe')](0xc8)['json']({'output':_0x56a5('0x2c')+module[_0x56a5('0x26')][_0x56a5('0x1')]+'\x20to\x20'+_[_0x56a5('0x2d')](_0x516b38),'migrations':_[_0x56a5('0x21')](_0x516b38)});})[_0x56a5('0x2e')](function(_0x5de387){if(_0x5de387 instanceof db[_0x56a5('0x29')][_0x56a5('0x2f')]){return _0x4e7afd[_0x56a5('0xe')](0xc8)[_0x56a5('0xf')]({'output':_0x56a5('0x30')});}else{return _0x4e7afd['status'](0x1f4)['json'](_0x5de387);}});}else{return _0x4e7afd[_0x56a5('0xe')](0xc8)[_0x56a5('0xf')]({'output':_0x56a5('0x30')});}}; \ No newline at end of file +var _0xbd0a=['migrations','readdirSync','join','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','version','query','latest','fetch','tags','exports','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch'];(function(_0x4f616b,_0x4cb423){var _0x1ef1c0=function(_0x5c59f8){while(--_0x5c59f8){_0x4f616b['push'](_0x4f616b['shift']());}};_0x1ef1c0(++_0x4cb423);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x29ec60,_0x362cc1){_0x29ec60=_0x29ec60-0x0;var _0x5f19bc=_0xbd0a[_0x29ec60];return _0x5f19bc;};'use strict';var Umzug=require(_0xabd0('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xabd0('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0xabd0('0x2'))[_0xabd0('0x3')];var db=require(_0xabd0('0x4'))['db'];var config=require(_0xabd0('0x5'));var pm2=require(_0xabd0('0x6'));var logger=require(_0xabd0('0x7'))(_0xabd0('0x8'));var git=require(_0xabd0('0x9'))(config[_0xabd0('0xa')]);exports['index']=function(_0xf44097,_0xb60e77){var _0x2b50c1={'current':module['exports'][_0xabd0('0xb')],'phonebar':0x2};if(_0xf44097['query']&&_0xf44097[_0xabd0('0xc')][_0xabd0('0xd')]){return git[_0xabd0('0xe')]()[_0xabd0('0xf')](function(_0x50fc2d,_0x40fb72){_0x2b50c1['latest']=(_0x50fc2d?module[_0xabd0('0x10')][_0xabd0('0xb')]:_0x40fb72[_0xabd0('0xd')])||_0xabd0('0x11');return _0xb60e77[_0xabd0('0x12')](0xc8)[_0xabd0('0x13')](_0x2b50c1);});}else{return _0xb60e77['status'](0xc8)[_0xabd0('0x13')](_0x2b50c1);}};exports['fetch']=function(_0x3586cf,_0x145f76){return git['fetch'](['origin','master'],function(_0x53acfc){if(_0x53acfc){logger[_0xabd0('0x14')](_0x53acfc);return _0x145f76[_0xabd0('0x12')](0x1f4)[_0xabd0('0x13')](_0x53acfc);}logger[_0xabd0('0x15')](_0xabd0('0x16'));return _0x145f76[_0xabd0('0x12')](0xc8)[_0xabd0('0x13')]({'output':_0xabd0('0x17')});});};exports[_0xabd0('0x18')]=function(_0x543461,_0x3a0ace){return git['reset'](['--hard',_0xabd0('0x19')],function(_0x391988){if(_0x391988){logger[_0xabd0('0x14')](_0x391988);return _0x3a0ace[_0xabd0('0x12')](0x1f4)['json'](_0x391988);}logger[_0xabd0('0x15')](_0xabd0('0x1a'));return _0x3a0ace['status'](0xc8)['json']({'output':_0xabd0('0x1b')});});};exports[_0xabd0('0x1c')]=function(_0x4d9416,_0x345b45){exec(_0xabd0('0x1d'),function(_0xa1ebf,_0x1e077e,_0x4c9f3a){logger[_0xabd0('0x15')](_0x1e077e);logger[_0xabd0('0x15')](_0x4c9f3a);if(_0xa1ebf){logger[_0xabd0('0x14')](_0xa1ebf);return _0x345b45[_0xabd0('0x12')](0x1f4)[_0xabd0('0x13')](_0xa1ebf);}return _0x345b45[_0xabd0('0x12')](0xc8)[_0xabd0('0x13')]({'output':_0x1e077e});});};exports[_0xabd0('0x1e')]=function(_0x187fc5,_0x20b73d){return pm2['restart'](_0xabd0('0x1f'))[_0xabd0('0x20')](function(_0x30739e){logger[_0xabd0('0x15')](_0xabd0('0x21'),_0x30739e);return _0x20b73d[_0xabd0('0x12')](0xc8)[_0xabd0('0x13')]({'output':_0xabd0('0x22')});})[_0xabd0('0x23')](function(_0x38c553){logger[_0xabd0('0x14')](_0x38c553);return _0x20b73d[_0xabd0('0x12')](0x1f4)[_0xabd0('0x13')](_0x38c553);});};exports[_0xabd0('0x24')]=function(_0x1fe955,_0x15096f){var _0x5427a0=fs[_0xabd0('0x25')](path[_0xabd0('0x26')](config[_0xabd0('0xa')],_0xabd0('0x27'),'migrations'));var _0x1ef94b=[];for(var _0x30c608=0x0;_0x30c608<_0x5427a0[_0xabd0('0x28')];_0x30c608++){var _0x47bc41=_0x5427a0[_0x30c608][_0xabd0('0x29')](_0xabd0('0x2a'),'');if(compareVersions(module['exports'][_0xabd0('0xb')],_0x47bc41)===-0x1){_0x1ef94b['push'](_0x47bc41);}}if(_0x1ef94b[_0xabd0('0x28')]){var _0xf481d8=_0x1ef94b[_0xabd0('0x2b')](compareVersions);var _0x313e38=new Umzug({'storage':_0xabd0('0x2c'),'storageOptions':{'model':db[_0xabd0('0x2d')],'modelName':'Migration','columnName':_0xabd0('0xb')},'migrations':{'params':[db[_0xabd0('0x2c')][_0xabd0('0x2e')](),db[_0xabd0('0x2c')][_0xabd0('0x2f')],function(){throw new Error(_0xabd0('0x30'));}],'path':path[_0xabd0('0x26')](config[_0xabd0('0xa')],_0xabd0('0x27'),_0xabd0('0x24')),'pattern':/\.js$/}});_0x313e38['up']({'migrations':_[_0xabd0('0x31')](_0xf481d8,function(_0x211267){return _0x211267+_0xabd0('0x2a');})})[_0xabd0('0x20')](function(){return _0x15096f[_0xabd0('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xabd0('0xb')]+_0xabd0('0x32')+_[_0xabd0('0x33')](_0xf481d8),'migrations':_[_0xabd0('0x26')](_0xf481d8)});})[_0xabd0('0x23')](function(_0x4aabf4){if(_0x4aabf4 instanceof db['sequelize']['UniqueConstraintError']){return _0x15096f[_0xabd0('0x12')](0xc8)['json']({'output':_0xabd0('0x34')});}else{return _0x15096f[_0xabd0('0x12')](0x1f4)[_0xabd0('0x13')](_0x4aabf4);}});}else{return _0x15096f[_0xabd0('0x12')](0xc8)[_0xabd0('0x13')]({'output':_0xabd0('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a4b47ea..752a7d3 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 _0x0b0e=['get','isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x4aab6f,_0x2894a9){var _0x1b8106=function(_0xefd254){while(--_0xefd254){_0x4aab6f['push'](_0x4aab6f['shift']());}};_0x1b8106(++_0x2894a9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x548503,_0x1aa00c){_0x548503=_0x548503-0x0;var _0xf8f05f=_0x0b0e[_0x548503];return _0xf8f05f;};'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 fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0xe')]('/',auth[_0xe0b0('0xa')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);module[_0xe0b0('0x13')]=router; \ No newline at end of file +var _0x757a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','util','path'];(function(_0xd995cc,_0x488c5f){var _0x49af67=function(_0x1343b0){while(--_0x1343b0){_0xd995cc['push'](_0xd995cc['shift']());}};_0x49af67(++_0x488c5f);}(_0x757a,0xde));var _0xa757=function(_0x45a952,_0x2991b2){_0x45a952=_0x45a952-0x0;var _0x580293=_0x757a[_0x45a952];return _0x580293;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0xc')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller[_0xa757('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);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 5f428f3..b59b1d7 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 _0x4819=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4819,0xcd));var _0x9481=function(_0x5df780,_0x3460c8){_0x5df780=_0x5df780-0x0;var _0x535f5b=_0x4819[_0x5df780];return _0x535f5b;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'type':{'type':Sequelize[_0x9481('0x1')]},'uniqueid':{'type':Sequelize[_0x9481('0x1')]},'calleridnum':{'type':Sequelize[_0x9481('0x1')]},'calleridname':{'type':Sequelize[_0x9481('0x1')]},'queue':{'type':Sequelize[_0x9481('0x1')]},'interface':{'type':Sequelize[_0x9481('0x1')]},'membername':{'type':Sequelize[_0x9481('0x1')]},'agentcalledAt':{'type':Sequelize[_0x9481('0x2')]},'agentconnectAt':{'type':Sequelize[_0x9481('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x9481('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9481('0x4')]},'agentacw':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9481('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9481('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9481('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9481('0x1')]},'connectedlinename':{'type':Sequelize[_0x9481('0x1')]},'language':{'type':Sequelize[_0x9481('0x1')]},'accountcode':{'type':Sequelize[_0x9481('0x1')]},'context':{'type':Sequelize[_0x9481('0x1')]},'exten':{'type':Sequelize[_0x9481('0x1')]},'priority':{'type':Sequelize[_0x9481('0x1')]},'destchannel':{'type':Sequelize[_0x9481('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9481('0x1')]},'destcalleridname':{'type':Sequelize[_0x9481('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9481('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x9481('0x1')]},'destlanguage':{'type':Sequelize[_0x9481('0x1')]},'destaccountcode':{'type':Sequelize[_0x9481('0x1')]},'destcontext':{'type':Sequelize[_0x9481('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9481('0x1')]},'destuniqueid':{'type':Sequelize[_0x9481('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x9481('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9481('0x1')],'comment':_0x9481('0x5')},'transferexten':{'type':Sequelize[_0x9481('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9481('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8fb=['DATE','BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x487f51,_0x268f8f){var _0xaf1452=function(_0x228ab7){while(--_0x228ab7){_0x487f51['push'](_0x487f51['shift']());}};_0xaf1452(++_0x268f8f);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1fabc6,_0x55c35d){_0x1fabc6=_0x1fabc6-0x0;var _0x3debc2=_0xd8fb[_0x1fabc6];return _0x3debc2;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'type':{'type':Sequelize[_0xbd8f('0x2')]},'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbd8f('0x2')]},'membername':{'type':Sequelize[_0xbd8f('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbd8f('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbd8f('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xbd8f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbd8f('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xbd8f('0x2')]},'lastevent':{'type':Sequelize[_0xbd8f('0x2')]},'channel':{'type':Sequelize[_0xbd8f('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'context':{'type':Sequelize[_0xbd8f('0x2')]},'exten':{'type':Sequelize[_0xbd8f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbd8f('0x2')]},'destchannelstate':{'type':Sequelize[_0xbd8f('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridname':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbd8f('0x2')]},'destlanguage':{'type':Sequelize[_0xbd8f('0x2')]},'destaccountcode':{'type':Sequelize[_0xbd8f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbd8f('0x2')]},'destpriority':{'type':Sequelize[_0xbd8f('0x2')]},'destuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbd8f('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xbd8f('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 35da764..b58a919 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 _0x0e12=['describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','sendStatus','error','name','index','map','type','model','query','filters','intersection','attributes','fields','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','destroy'];(function(_0xe8c687,_0x33f35a){var _0x343c0e=function(_0x4a5637){while(--_0x4a5637){_0xe8c687['push'](_0xe8c687['shift']());}};_0x343c0e(++_0x33f35a);}(_0x0e12,0x169));var _0x20e1=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x0e12[_0x30cc1a];return _0xb3f18f;};'use strict';var emlformat=require(_0x20e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20e1('0x1'));var jsonpatch=require(_0x20e1('0x2'));var rp=require(_0x20e1('0x3'));var moment=require(_0x20e1('0x4'));var BPromise=require(_0x20e1('0x5'));var Mustache=require(_0x20e1('0x6'));var util=require(_0x20e1('0x7'));var path=require('path');var sox=require(_0x20e1('0x8'));var csv=require(_0x20e1('0x9'));var ejs=require(_0x20e1('0xa'));var fs=require('fs');var fs_extra=require(_0x20e1('0xb'));var _=require(_0x20e1('0xc'));var squel=require(_0x20e1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x20e1('0x9'));var querystring=require('querystring');var Papa=require(_0x20e1('0xe'));var Redis=require(_0x20e1('0xf'));var authService=require(_0x20e1('0x10'));var qs=require(_0x20e1('0x11'));var as=require(_0x20e1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20e1('0x13'))(_0x20e1('0x14'));var utils=require(_0x20e1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x20e1('0x16'));var db=require(_0x20e1('0x17'))['db'];function respondWithStatusCode(_0x4607da,_0x2e1609){_0x2e1609=_0x2e1609||0xcc;return function(_0xae91f4){if(_0xae91f4){return _0x4607da['sendStatus'](_0x2e1609);}return _0x4607da['status'](_0x2e1609)[_0x20e1('0x18')]();};}function respondWithResult(_0x466967,_0x2c7f4f){_0x2c7f4f=_0x2c7f4f||0xc8;return function(_0x52afc4){if(_0x52afc4){return _0x466967['status'](_0x2c7f4f)[_0x20e1('0x19')](_0x52afc4);}};}function respondWithFilteredResult(_0x15f41c,_0x4f6275){return function(_0x520b78){if(_0x520b78){var _0x7a8eeb=typeof _0x4f6275[_0x20e1('0x1a')]===_0x20e1('0x1b')&&typeof _0x4f6275[_0x20e1('0x1c')]===_0x20e1('0x1b');var _0x4aa9b1=_0x520b78[_0x20e1('0x1d')];var _0x5cafd4=_0x7a8eeb?0x0:_0x4f6275[_0x20e1('0x1a')];var _0x5d979e=_0x7a8eeb?_0x520b78[_0x20e1('0x1d')]:_0x4f6275[_0x20e1('0x1a')]+_0x4f6275['limit'];var _0x4fe818;if(_0x5d979e>=_0x4aa9b1){_0x5d979e=_0x4aa9b1;_0x4fe818=0xc8;}else{_0x4fe818=0xce;}_0x15f41c[_0x20e1('0x1e')](_0x4fe818);return _0x15f41c['set'](_0x20e1('0x1f'),_0x5cafd4+'-'+_0x5d979e+'/'+_0x4aa9b1)[_0x20e1('0x19')](_0x520b78);}return null;};}function patchUpdates(_0x52e73f){return function(_0x59b753){try{jsonpatch['apply'](_0x59b753,_0x52e73f,!![]);}catch(_0x21e033){return BPromise[_0x20e1('0x20')](_0x21e033);}return _0x59b753[_0x20e1('0x21')]();};}function saveUpdates(_0x172695,_0x3aeca0){return function(_0x1107bf){if(_0x1107bf){return _0x1107bf[_0x20e1('0x22')](_0x172695)[_0x20e1('0x23')](function(_0x1d6088){return _0x1d6088;});}return null;};}function removeEntity(_0x3ecabc,_0x4aaf8e){return function(_0x51ddcc){if(_0x51ddcc){return _0x51ddcc['destroy']()[_0x20e1('0x23')](function(){_0x3ecabc[_0x20e1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11afcf,_0x36df5c){return function(_0x589488){if(!_0x589488){_0x11afcf[_0x20e1('0x24')](0x194);}return _0x589488;};}function handleError(_0x32fbb8,_0x267c21){_0x267c21=_0x267c21||0x1f4;return function(_0x560385){logger[_0x20e1('0x25')](_0x560385['stack']);if(_0x560385[_0x20e1('0x26')]){delete _0x560385[_0x20e1('0x26')];}_0x32fbb8[_0x20e1('0x1e')](_0x267c21)['send'](_0x560385);};}exports[_0x20e1('0x27')]=function(_0x13ae61,_0x34c3f3){var _0x2448d4={},_0xe9289e={},_0x58ef50={'count':0x0,'rows':[]};var _0x290522=_[_0x20e1('0x28')](db['VoiceAgentReport']['rawAttributes'],function(_0x35f842){return{'name':_0x35f842['fieldName'],'type':_0x35f842[_0x20e1('0x29')]['key']};});_0xe9289e[_0x20e1('0x2a')]=_[_0x20e1('0x28')](_0x290522,_0x20e1('0x26'));_0xe9289e['query']=_['keys'](_0x13ae61[_0x20e1('0x2b')]);_0xe9289e[_0x20e1('0x2c')]=_[_0x20e1('0x2d')](_0xe9289e['model'],_0xe9289e[_0x20e1('0x2b')]);_0x2448d4[_0x20e1('0x2e')]=_['intersection'](_0xe9289e[_0x20e1('0x2a')],qs[_0x20e1('0x2f')](_0x13ae61[_0x20e1('0x2b')]['fields']));_0x2448d4['attributes']=_0x2448d4[_0x20e1('0x2e')]['length']?_0x2448d4[_0x20e1('0x2e')]:_0xe9289e[_0x20e1('0x2a')];if(!_0x13ae61['query']['hasOwnProperty']('nolimit')){_0x2448d4[_0x20e1('0x1c')]=qs[_0x20e1('0x1c')](_0x13ae61['query'][_0x20e1('0x1c')]);_0x2448d4[_0x20e1('0x1a')]=qs[_0x20e1('0x1a')](_0x13ae61[_0x20e1('0x2b')]['offset']);}_0x2448d4[_0x20e1('0x30')]=qs['sort'](_0x13ae61['query'][_0x20e1('0x31')]);_0x2448d4['where']=qs['filters'](_[_0x20e1('0x32')](_0x13ae61[_0x20e1('0x2b')],_0xe9289e[_0x20e1('0x2c')]),_0x290522);if(_0x13ae61[_0x20e1('0x2b')][_0x20e1('0x33')]){_0x2448d4['where']=_[_0x20e1('0x34')](_0x2448d4[_0x20e1('0x35')],{'$or':_[_0x20e1('0x28')](_0x290522,function(_0x840915){if(_0x840915[_0x20e1('0x29')]!==_0x20e1('0x36')){var _0x273c9c={};_0x273c9c[_0x840915['name']]={'$like':'%'+_0x13ae61[_0x20e1('0x2b')][_0x20e1('0x33')]+'%'};return _0x273c9c;}})});}_0x2448d4=_[_0x20e1('0x34')]({},_0x2448d4,_0x13ae61[_0x20e1('0x37')]);var _0xb5dcdc={'where':_0x2448d4[_0x20e1('0x35')]};return db[_0x20e1('0x38')][_0x20e1('0x1d')](_0xb5dcdc)[_0x20e1('0x23')](function(_0x57bfc6){_0x58ef50[_0x20e1('0x1d')]=_0x57bfc6;if(_0x13ae61['query'][_0x20e1('0x39')]){_0x2448d4[_0x20e1('0x3a')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x20e1('0x3b')](_0x2448d4);})[_0x20e1('0x23')](function(_0xb138fe){_0x58ef50[_0x20e1('0x3c')]=_0xb138fe;return _0x58ef50;})['then'](respondWithFilteredResult(_0x34c3f3,_0x2448d4))[_0x20e1('0x3d')](handleError(_0x34c3f3,null));};exports[_0x20e1('0x3e')]=function(_0x23113c,_0x2a825d){var _0x37a845={'raw':![],'where':{'id':_0x23113c[_0x20e1('0x3f')]['id']}},_0x7fa3c={};_0x7fa3c[_0x20e1('0x2a')]=_[_0x20e1('0x40')](db['VoiceAgentReport'][_0x20e1('0x41')]);_0x7fa3c[_0x20e1('0x2b')]=_[_0x20e1('0x40')](_0x23113c[_0x20e1('0x2b')]);_0x7fa3c[_0x20e1('0x2c')]=_[_0x20e1('0x2d')](_0x7fa3c[_0x20e1('0x2a')],_0x7fa3c[_0x20e1('0x2b')]);_0x37a845[_0x20e1('0x2e')]=_[_0x20e1('0x2d')](_0x7fa3c[_0x20e1('0x2a')],qs[_0x20e1('0x2f')](_0x23113c[_0x20e1('0x2b')][_0x20e1('0x2f')]));_0x37a845['attributes']=_0x37a845['attributes'][_0x20e1('0x42')]?_0x37a845[_0x20e1('0x2e')]:_0x7fa3c['model'];if(_0x23113c['query'][_0x20e1('0x39')]){_0x37a845[_0x20e1('0x3a')]=[{'all':!![]}];}_0x37a845=_['merge']({},_0x37a845,_0x23113c[_0x20e1('0x37')]);return db['VoiceAgentReport'][_0x20e1('0x43')](_0x37a845)[_0x20e1('0x23')](handleEntityNotFound(_0x2a825d,null))[_0x20e1('0x23')](respondWithResult(_0x2a825d,null))[_0x20e1('0x3d')](handleError(_0x2a825d,null));};exports[_0x20e1('0x44')]=function(_0x47bacf,_0x31d920){return db[_0x20e1('0x38')][_0x20e1('0x44')](_0x47bacf[_0x20e1('0x45')],{})['then'](respondWithResult(_0x31d920,0xc9))[_0x20e1('0x3d')](handleError(_0x31d920,null));};exports[_0x20e1('0x22')]=function(_0x44e9e4,_0x433739){if(_0x44e9e4[_0x20e1('0x45')]['id']){delete _0x44e9e4['body']['id'];}return db[_0x20e1('0x38')]['find']({'where':{'id':_0x44e9e4[_0x20e1('0x3f')]['id']}})[_0x20e1('0x23')](handleEntityNotFound(_0x433739,null))[_0x20e1('0x23')](saveUpdates(_0x44e9e4[_0x20e1('0x45')],null))[_0x20e1('0x23')](respondWithResult(_0x433739,null))[_0x20e1('0x3d')](handleError(_0x433739,null));};exports[_0x20e1('0x46')]=function(_0x1f8229,_0x48184){return db[_0x20e1('0x38')]['find']({'where':{'id':_0x1f8229[_0x20e1('0x3f')]['id']}})[_0x20e1('0x23')](handleEntityNotFound(_0x48184,null))['then'](removeEntity(_0x48184,null))[_0x20e1('0x3d')](handleError(_0x48184,null));};exports['describe']=function(_0x493717,_0x51098b){return db[_0x20e1('0x38')][_0x20e1('0x47')]()['then'](respondWithResult(_0x51098b,null))['catch'](handleError(_0x51098b,null));}; \ No newline at end of file +var _0x2929=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','save','update','then','destroy','error','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x1a20b4,_0xfdd568){var _0x24815d=function(_0x346be0){while(--_0x346be0){_0x1a20b4['push'](_0x1a20b4['shift']());}};_0x24815d(++_0xfdd568);}(_0x2929,0x1ab));var _0x9292=function(_0x2ac3ae,_0x2ebcd8){_0x2ac3ae=_0x2ac3ae-0x0;var _0x5509ff=_0x2929[_0x2ac3ae];return _0x5509ff;};'use strict';var emlformat=require(_0x9292('0x0'));var rimraf=require(_0x9292('0x1'));var zipdir=require(_0x9292('0x2'));var jsonpatch=require(_0x9292('0x3'));var rp=require(_0x9292('0x4'));var moment=require(_0x9292('0x5'));var BPromise=require(_0x9292('0x6'));var Mustache=require(_0x9292('0x7'));var util=require(_0x9292('0x8'));var path=require(_0x9292('0x9'));var sox=require(_0x9292('0xa'));var csv=require(_0x9292('0xb'));var ejs=require(_0x9292('0xc'));var fs=require('fs');var fs_extra=require(_0x9292('0xd'));var _=require(_0x9292('0xe'));var squel=require(_0x9292('0xf'));var crypto=require('crypto');var jsforce=require(_0x9292('0x10'));var deskjs=require(_0x9292('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9292('0x12'));var Redis=require('ioredis');var authService=require(_0x9292('0x13'));var qs=require(_0x9292('0x14'));var as=require(_0x9292('0x15'));var hardwareService=require(_0x9292('0x16'));var logger=require(_0x9292('0x17'))(_0x9292('0x18'));var utils=require('../../config/utils');var config=require(_0x9292('0x19'));var licenseUtil=require(_0x9292('0x1a'));var db=require(_0x9292('0x1b'))['db'];function respondWithStatusCode(_0x574382,_0x313e87){_0x313e87=_0x313e87||0xcc;return function(_0x2303f3){if(_0x2303f3){return _0x574382[_0x9292('0x1c')](_0x313e87);}return _0x574382[_0x9292('0x1d')](_0x313e87)[_0x9292('0x1e')]();};}function respondWithResult(_0x4bba49,_0x213551){_0x213551=_0x213551||0xc8;return function(_0x12ac58){if(_0x12ac58){return _0x4bba49[_0x9292('0x1d')](_0x213551)[_0x9292('0x1f')](_0x12ac58);}};}function respondWithFilteredResult(_0x3bde03,_0x101e3f){return function(_0x33ffb4){if(_0x33ffb4){var _0xdb601b=typeof _0x101e3f[_0x9292('0x20')]==='undefined'&&typeof _0x101e3f['limit']===_0x9292('0x21');var _0x109469=_0x33ffb4['count'];var _0x31b616=_0xdb601b?0x0:_0x101e3f[_0x9292('0x20')];var _0x7bca02=_0xdb601b?_0x33ffb4['count']:_0x101e3f['offset']+_0x101e3f[_0x9292('0x22')];var _0x376362;if(_0x7bca02>=_0x109469){_0x7bca02=_0x109469;_0x376362=0xc8;}else{_0x376362=0xce;}_0x3bde03[_0x9292('0x1d')](_0x376362);return _0x3bde03['set']('Content-Range',_0x31b616+'-'+_0x7bca02+'/'+_0x109469)[_0x9292('0x1f')](_0x33ffb4);}return null;};}function patchUpdates(_0x44fc01){return function(_0x11c3f9){try{jsonpatch['apply'](_0x11c3f9,_0x44fc01,!![]);}catch(_0x2ac55e){return BPromise['reject'](_0x2ac55e);}return _0x11c3f9[_0x9292('0x23')]();};}function saveUpdates(_0x31facd,_0x49b34d){return function(_0x3b6bd4){if(_0x3b6bd4){return _0x3b6bd4[_0x9292('0x24')](_0x31facd)[_0x9292('0x25')](function(_0x52298e){return _0x52298e;});}return null;};}function removeEntity(_0x38c218,_0x289db8){return function(_0x7d417a){if(_0x7d417a){return _0x7d417a[_0x9292('0x26')]()['then'](function(){_0x38c218[_0x9292('0x1d')](0xcc)[_0x9292('0x1e')]();});}};}function handleEntityNotFound(_0x5a8c1e,_0x524295){return function(_0x36c17a){if(!_0x36c17a){_0x5a8c1e[_0x9292('0x1c')](0x194);}return _0x36c17a;};}function handleError(_0x2da832,_0x45f6cb){_0x45f6cb=_0x45f6cb||0x1f4;return function(_0x246b42){logger[_0x9292('0x27')](_0x246b42['stack']);if(_0x246b42['name']){delete _0x246b42[_0x9292('0x28')];}_0x2da832[_0x9292('0x1d')](_0x45f6cb)[_0x9292('0x29')](_0x246b42);};}exports[_0x9292('0x2a')]=function(_0x140ea2,_0xbda5d4){var _0x8eba44={},_0x4e25db={},_0x411dbf={'count':0x0,'rows':[]};var _0x28bb72=_[_0x9292('0x2b')](db[_0x9292('0x2c')][_0x9292('0x2d')],function(_0x3a59b6){return{'name':_0x3a59b6[_0x9292('0x2e')],'type':_0x3a59b6[_0x9292('0x2f')][_0x9292('0x30')]};});_0x4e25db[_0x9292('0x31')]=_[_0x9292('0x2b')](_0x28bb72,_0x9292('0x28'));_0x4e25db[_0x9292('0x32')]=_[_0x9292('0x33')](_0x140ea2['query']);_0x4e25db[_0x9292('0x34')]=_[_0x9292('0x35')](_0x4e25db[_0x9292('0x31')],_0x4e25db['query']);_0x8eba44[_0x9292('0x36')]=_[_0x9292('0x35')](_0x4e25db[_0x9292('0x31')],qs['fields'](_0x140ea2[_0x9292('0x32')][_0x9292('0x37')]));_0x8eba44[_0x9292('0x36')]=_0x8eba44[_0x9292('0x36')][_0x9292('0x38')]?_0x8eba44[_0x9292('0x36')]:_0x4e25db[_0x9292('0x31')];if(!_0x140ea2['query'][_0x9292('0x39')](_0x9292('0x3a'))){_0x8eba44[_0x9292('0x22')]=qs[_0x9292('0x22')](_0x140ea2[_0x9292('0x32')][_0x9292('0x22')]);_0x8eba44[_0x9292('0x20')]=qs[_0x9292('0x20')](_0x140ea2[_0x9292('0x32')][_0x9292('0x20')]);}_0x8eba44['order']=qs[_0x9292('0x3b')](_0x140ea2['query']['sort']);_0x8eba44[_0x9292('0x3c')]=qs[_0x9292('0x34')](_['pick'](_0x140ea2['query'],_0x4e25db[_0x9292('0x34')]),_0x28bb72);if(_0x140ea2[_0x9292('0x32')][_0x9292('0x3d')]){_0x8eba44['where']=_[_0x9292('0x3e')](_0x8eba44[_0x9292('0x3c')],{'$or':_[_0x9292('0x2b')](_0x28bb72,function(_0x3a050f){if(_0x3a050f[_0x9292('0x2f')]!==_0x9292('0x3f')){var _0x2590b8={};_0x2590b8[_0x3a050f[_0x9292('0x28')]]={'$like':'%'+_0x140ea2[_0x9292('0x32')]['filter']+'%'};return _0x2590b8;}})});}_0x8eba44=_[_0x9292('0x3e')]({},_0x8eba44,_0x140ea2['options']);var _0xa1b606={'where':_0x8eba44[_0x9292('0x3c')]};return db[_0x9292('0x2c')][_0x9292('0x40')](_0xa1b606)[_0x9292('0x25')](function(_0x1c718a){_0x411dbf['count']=_0x1c718a;if(_0x140ea2[_0x9292('0x32')]['includeAll']){_0x8eba44[_0x9292('0x41')]=[{'all':!![]}];}return db[_0x9292('0x2c')][_0x9292('0x42')](_0x8eba44);})[_0x9292('0x25')](function(_0xf94877){_0x411dbf[_0x9292('0x43')]=_0xf94877;return _0x411dbf;})[_0x9292('0x25')](respondWithFilteredResult(_0xbda5d4,_0x8eba44))['catch'](handleError(_0xbda5d4,null));};exports['show']=function(_0x25c836,_0x194e6b){var _0x1765fd={'raw':![],'where':{'id':_0x25c836[_0x9292('0x44')]['id']}},_0x13fdd9={};_0x13fdd9[_0x9292('0x31')]=_[_0x9292('0x33')](db[_0x9292('0x2c')]['rawAttributes']);_0x13fdd9[_0x9292('0x32')]=_['keys'](_0x25c836[_0x9292('0x32')]);_0x13fdd9['filters']=_['intersection'](_0x13fdd9[_0x9292('0x31')],_0x13fdd9[_0x9292('0x32')]);_0x1765fd[_0x9292('0x36')]=_[_0x9292('0x35')](_0x13fdd9[_0x9292('0x31')],qs[_0x9292('0x37')](_0x25c836['query'][_0x9292('0x37')]));_0x1765fd[_0x9292('0x36')]=_0x1765fd[_0x9292('0x36')][_0x9292('0x38')]?_0x1765fd[_0x9292('0x36')]:_0x13fdd9[_0x9292('0x31')];if(_0x25c836[_0x9292('0x32')]['includeAll']){_0x1765fd[_0x9292('0x41')]=[{'all':!![]}];}_0x1765fd=_[_0x9292('0x3e')]({},_0x1765fd,_0x25c836['options']);return db[_0x9292('0x2c')][_0x9292('0x45')](_0x1765fd)[_0x9292('0x25')](handleEntityNotFound(_0x194e6b,null))['then'](respondWithResult(_0x194e6b,null))[_0x9292('0x46')](handleError(_0x194e6b,null));};exports[_0x9292('0x47')]=function(_0x382745,_0x2351c4){return db['VoiceAgentReport'][_0x9292('0x47')](_0x382745[_0x9292('0x48')],{})[_0x9292('0x25')](respondWithResult(_0x2351c4,0xc9))['catch'](handleError(_0x2351c4,null));};exports[_0x9292('0x24')]=function(_0x108f83,_0x255bcd){if(_0x108f83['body']['id']){delete _0x108f83[_0x9292('0x48')]['id'];}return db[_0x9292('0x2c')][_0x9292('0x45')]({'where':{'id':_0x108f83['params']['id']}})['then'](handleEntityNotFound(_0x255bcd,null))['then'](saveUpdates(_0x108f83[_0x9292('0x48')],null))[_0x9292('0x25')](respondWithResult(_0x255bcd,null))[_0x9292('0x46')](handleError(_0x255bcd,null));};exports[_0x9292('0x26')]=function(_0x16117e,_0x353dc1){return db[_0x9292('0x2c')][_0x9292('0x45')]({'where':{'id':_0x16117e['params']['id']}})['then'](handleEntityNotFound(_0x353dc1,null))['then'](removeEntity(_0x353dc1,null))[_0x9292('0x46')](handleError(_0x353dc1,null));};exports[_0x9292('0x49')]=function(_0x25b40c,_0x5ddf2c){return db[_0x9292('0x2c')][_0x9292('0x49')]()[_0x9292('0x25')](respondWithResult(_0x5ddf2c,null))['catch'](handleError(_0x5ddf2c,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index c8ae66d..73bb11e 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 _0x20ef=['uniqueid','destuniqueid','util','../../config/logger','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','exports','define','report_agent'];(function(_0x13a9cf,_0x3e6c7b){var _0x4d92bd=function(_0x3fc0de){while(--_0x3fc0de){_0x13a9cf['push'](_0x13a9cf['shift']());}};_0x4d92bd(++_0x3e6c7b);}(_0x20ef,0x9e));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf20e('0x0'));var logger=require(_0xf20e('0x1'))('api');var moment=require(_0xf20e('0x2'));var BPromise=require(_0xf20e('0x3'));var rp=require(_0xf20e('0x4'));var fs=require('fs');var path=require(_0xf20e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf20e('0x6'));module[_0xf20e('0x7')]=function(_0x141d2b,_0x26b003){return _0x141d2b[_0xf20e('0x8')]('VoiceAgentReport',attributes,{'tableName':_0xf20e('0x9'),'paranoid':![],'indexes':[{'fields':[_0xf20e('0xa'),_0xf20e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33f1=['../../config/environment','./voiceAgentReport.attributes','exports','define','destuniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x26d9e0,_0x305956){var _0x2915fe=function(_0x18f448){while(--_0x18f448){_0x26d9e0['push'](_0x26d9e0['shift']());}};_0x2915fe(++_0x305956);}(_0x33f1,0x16d));var _0x133f=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0x33f1[_0x8bb4c1];return _0x67a6e1;};'use strict';var _=require(_0x133f('0x0'));var util=require(_0x133f('0x1'));var logger=require('../../config/logger')(_0x133f('0x2'));var moment=require(_0x133f('0x3'));var BPromise=require(_0x133f('0x4'));var rp=require(_0x133f('0x5'));var fs=require('fs');var path=require(_0x133f('0x6'));var rimraf=require('rimraf');var config=require(_0x133f('0x7'));var attributes=require(_0x133f('0x8'));module[_0x133f('0x9')]=function(_0x5176f7,_0x266939){return _0x5176f7[_0x133f('0xa')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x133f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1825b89..7f9fce6 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 _0xae7c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','CreateVoiceAgentReport','create','body','raw','update','options','where','UpdateVoiceAgentReport','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1d6505,_0x2f62f7){var _0x45e9a4=function(_0x3cda3f){while(--_0x3cda3f){_0x1d6505['push'](_0x1d6505['shift']());}};_0x45e9a4(++_0x2f62f7);}(_0xae7c,0x10a));var _0xcae7=function(_0x1f4d1a,_0x2af6c4){_0x1f4d1a=_0x1f4d1a-0x0;var _0x2efebd=_0xae7c[_0x1f4d1a];return _0x2efebd;};'use strict';var _=require(_0xcae7('0x0'));var util=require(_0xcae7('0x1'));var moment=require(_0xcae7('0x2'));var BPromise=require(_0xcae7('0x3'));var rs=require(_0xcae7('0x4'));var fs=require('fs');var Redis=require(_0xcae7('0x5'));var db=require(_0xcae7('0x6'))['db'];var utils=require(_0xcae7('0x7'));var logger=require(_0xcae7('0x8'))(_0xcae7('0x9'));var config=require(_0xcae7('0xa'));var jayson=require(_0xcae7('0xb'));var client=jayson[_0xcae7('0xc')][_0xcae7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xa7c1c,_0x1df7d3,_0x1a7717){return new BPromise(function(_0x14e6b9,_0xc6b853){return client[_0xcae7('0xe')](_0xa7c1c,_0x1a7717)[_0xcae7('0xf')](function(_0x13745c){logger['info'](_0xcae7('0x10'),_0x1df7d3,_0xcae7('0x11'));logger['debug'](_0xcae7('0x12'),_0x1df7d3,_0xcae7('0x11'),JSON[_0xcae7('0x13')](_0x13745c));if(_0x13745c['error']){if(_0x13745c['error'][_0xcae7('0x14')]===0x1f4){logger['error'](_0xcae7('0x10'),_0x1df7d3,_0x13745c[_0xcae7('0x15')]['message']);return _0xc6b853(_0x13745c[_0xcae7('0x15')][_0xcae7('0x16')]);}logger[_0xcae7('0x15')](_0xcae7('0x10'),_0x1df7d3,_0x13745c[_0xcae7('0x15')]['message']);return _0x14e6b9(_0x13745c[_0xcae7('0x15')]['message']);}else{logger[_0xcae7('0x17')](_0xcae7('0x10'),_0x1df7d3,'request\x20sent');_0x14e6b9(_0x13745c['result'][_0xcae7('0x16')]);}})[_0xcae7('0x18')](function(_0x246478){logger[_0xcae7('0x15')](_0xcae7('0x10'),_0x1df7d3,_0x246478);_0xc6b853(_0x246478);});});}exports[_0xcae7('0x19')]=function(_0x189441){var _0x54763f=this;return new Promise(function(_0x1e9a57,_0x359b4b){return db['VoiceAgentReport'][_0xcae7('0x1a')](_0x189441[_0xcae7('0x1b')],{'raw':_0x189441['options']?_0x189441['options'][_0xcae7('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5ca79b){logger[_0xcae7('0x17')](_0xcae7('0x19'),_0x189441);logger['debug'](_0xcae7('0x19'),_0x189441,JSON[_0xcae7('0x13')](_0x5ca79b));_0x1e9a57(_0x5ca79b);})[_0xcae7('0x18')](function(_0x5d6d5b){logger[_0xcae7('0x15')](_0xcae7('0x19'),_0x5d6d5b[_0xcae7('0x16')],_0x189441);_0x359b4b(_0x54763f[_0xcae7('0x15')](0x1f4,_0x5d6d5b['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x1e01c5){var _0x13d325=this;return new Promise(function(_0x443154,_0x1af50b){return db['VoiceAgentReport'][_0xcae7('0x1d')](_0x1e01c5[_0xcae7('0x1b')],{'raw':_0x1e01c5[_0xcae7('0x1e')]?_0x1e01c5[_0xcae7('0x1e')][_0xcae7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e01c5['options']?_0x1e01c5[_0xcae7('0x1e')][_0xcae7('0x1f')]||null:null,'attributes':_0x1e01c5[_0xcae7('0x1e')]?_0x1e01c5[_0xcae7('0x1e')]['attributes']||null:null,'limit':_0x1e01c5[_0xcae7('0x1e')]?_0x1e01c5[_0xcae7('0x1e')]['limit']||null:null})[_0xcae7('0xf')](function(_0xe97c2b){logger[_0xcae7('0x17')](_0xcae7('0x20'),_0x1e01c5);logger[_0xcae7('0x21')](_0xcae7('0x20'),_0x1e01c5,JSON['stringify'](_0xe97c2b));_0x443154(_0xe97c2b);})['catch'](function(_0x54c9ee){logger[_0xcae7('0x15')](_0xcae7('0x20'),_0x54c9ee['message'],_0x1e01c5);_0x1af50b(_0x13d325[_0xcae7('0x15')](0x1f4,_0x54c9ee[_0xcae7('0x16')]));});});}; \ No newline at end of file +var _0x6162=['create','body','options','raw','UpdateVoiceAgentReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x37b4cc,_0x187be2){var _0x1e5791=function(_0x291f6d){while(--_0x291f6d){_0x37b4cc['push'](_0x37b4cc['shift']());}};_0x1e5791(++_0x187be2);}(_0x6162,0xa2));var _0x2616=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6162[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2616('0x0'));var util=require(_0x2616('0x1'));var moment=require(_0x2616('0x2'));var BPromise=require(_0x2616('0x3'));var rs=require(_0x2616('0x4'));var fs=require('fs');var Redis=require(_0x2616('0x5'));var db=require(_0x2616('0x6'))['db'];var utils=require(_0x2616('0x7'));var logger=require(_0x2616('0x8'))('rpc');var config=require(_0x2616('0x9'));var jayson=require(_0x2616('0xa'));var client=jayson[_0x2616('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb5f136,_0x4b973a,_0x3cda94){return new BPromise(function(_0x44e708,_0x1eb3dd){return client[_0x2616('0xc')](_0xb5f136,_0x3cda94)[_0x2616('0xd')](function(_0x296dd2){logger[_0x2616('0xe')](_0x2616('0xf'),_0x4b973a,_0x2616('0x10'));logger[_0x2616('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4b973a,_0x2616('0x10'),JSON[_0x2616('0x12')](_0x296dd2));if(_0x296dd2[_0x2616('0x13')]){if(_0x296dd2['error']['code']===0x1f4){logger['error'](_0x2616('0xf'),_0x4b973a,_0x296dd2[_0x2616('0x13')][_0x2616('0x14')]);return _0x1eb3dd(_0x296dd2[_0x2616('0x13')]['message']);}logger['error'](_0x2616('0xf'),_0x4b973a,_0x296dd2['error'][_0x2616('0x14')]);return _0x44e708(_0x296dd2[_0x2616('0x13')][_0x2616('0x14')]);}else{logger[_0x2616('0xe')](_0x2616('0xf'),_0x4b973a,_0x2616('0x10'));_0x44e708(_0x296dd2['result']['message']);}})[_0x2616('0x15')](function(_0x35a4e9){logger[_0x2616('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4b973a,_0x35a4e9);_0x1eb3dd(_0x35a4e9);});});}exports[_0x2616('0x16')]=function(_0x1b43c5){var _0x33eb61=this;return new Promise(function(_0x1a18b3,_0x1e6af9){return db[_0x2616('0x17')][_0x2616('0x18')](_0x1b43c5[_0x2616('0x19')],{'raw':_0x1b43c5[_0x2616('0x1a')]?_0x1b43c5[_0x2616('0x1a')][_0x2616('0x1b')]===undefined?!![]:![]:!![]})[_0x2616('0xd')](function(_0x463e80){logger[_0x2616('0xe')](_0x2616('0x16'),_0x1b43c5);logger[_0x2616('0x11')](_0x2616('0x16'),_0x1b43c5,JSON[_0x2616('0x12')](_0x463e80));_0x1a18b3(_0x463e80);})['catch'](function(_0x50a44c){logger[_0x2616('0x13')]('CreateVoiceAgentReport',_0x50a44c[_0x2616('0x14')],_0x1b43c5);_0x1e6af9(_0x33eb61[_0x2616('0x13')](0x1f4,_0x50a44c[_0x2616('0x14')]));});});};exports[_0x2616('0x1c')]=function(_0x1135b4){var _0x423892=this;return new Promise(function(_0x20b522,_0x9c5cb){return db[_0x2616('0x17')]['update'](_0x1135b4[_0x2616('0x19')],{'raw':_0x1135b4[_0x2616('0x1a')]?_0x1135b4[_0x2616('0x1a')][_0x2616('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1135b4['options']?_0x1135b4[_0x2616('0x1a')][_0x2616('0x1d')]||null:null,'attributes':_0x1135b4['options']?_0x1135b4[_0x2616('0x1a')][_0x2616('0x1e')]||null:null,'limit':_0x1135b4[_0x2616('0x1a')]?_0x1135b4[_0x2616('0x1a')]['limit']||null:null})[_0x2616('0xd')](function(_0x36bacd){logger[_0x2616('0xe')]('UpdateVoiceAgentReport',_0x1135b4);logger['debug']('UpdateVoiceAgentReport',_0x1135b4,JSON[_0x2616('0x12')](_0x36bacd));_0x20b522(_0x36bacd);})[_0x2616('0x15')](function(_0xb160de){logger['error'](_0x2616('0x1c'),_0xb160de[_0x2616('0x14')],_0x1135b4);_0x9c5cb(_0x423892['error'](0x1f4,_0xb160de[_0x2616('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8d3b4ba..c926a4a 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d9950e7..666b01d 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 _0x6c7b=['inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','inbound','outbound'];(function(_0x836672,_0x1b61bf){var _0x283627=function(_0x338483){while(--_0x338483){_0x836672['push'](_0x836672['shift']());}};_0x283627(++_0x1b61bf);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x524bf9,_0x47462b){_0x524bf9=_0x524bf9-0x0;var _0x550148=_0x6c7b[_0x524bf9];return _0x550148;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xb6c7('0x1'),'internal',_0xb6c7('0x2'),_0xb6c7('0x3'),_0xb6c7('0x4'),'dialer')},'tag':{'type':Sequelize[_0xb6c7('0x5')]},'accountcode':{'type':Sequelize[_0xb6c7('0x5')]},'source':{'type':Sequelize[_0xb6c7('0x5')]},'destination':{'type':Sequelize[_0xb6c7('0x5')]},'destinationcontext':{'type':Sequelize[_0xb6c7('0x5')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb6c7('0x5')]},'destinationchannel':{'type':Sequelize[_0xb6c7('0x5')]},'lastapplication':{'type':Sequelize[_0xb6c7('0x5')]},'lastdata':{'type':Sequelize[_0xb6c7('0x6')]},'starttime':{'type':Sequelize[_0xb6c7('0x7')]},'systemanswertime':{'type':Sequelize[_0xb6c7('0x7')]},'answertime':{'type':Sequelize[_0xb6c7('0x7')]},'endtime':{'type':Sequelize[_0xb6c7('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xb6c7('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb6c7('0x5')]},'amaflags':{'type':Sequelize[_0xb6c7('0x5')]},'userfield':{'type':Sequelize[_0xb6c7('0x5')]},'userDisposition':{'type':Sequelize[_0xb6c7('0x5')]},'userSecondDisposition':{'type':Sequelize[_0xb6c7('0x5')]},'userThirdDisposition':{'type':Sequelize[_0xb6c7('0x5')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb6c7('0x5')]},'routeid':{'type':Sequelize[_0xb6c7('0x8')]},'sipcallid':{'type':Sequelize[_0xb6c7('0x5')]}}; \ No newline at end of file +var _0xed1f=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x464184,_0x1ab0a7){var _0x3728ca=function(_0x3dd915){while(--_0x3dd915){_0x464184['push'](_0x464184['shift']());}};_0x3728ca(++_0x1ab0a7);}(_0xed1f,0x6a));var _0xfed1=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xed1f[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'type':{'type':Sequelize[_0xfed1('0x3')](_0xfed1('0x4'),_0xfed1('0x5'),_0xfed1('0x6'),_0xfed1('0x7'),_0xfed1('0x8'),_0xfed1('0x9'))},'tag':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize[_0xfed1('0x2')]},'source':{'type':Sequelize[_0xfed1('0x2')]},'destination':{'type':Sequelize[_0xfed1('0x2')]},'destinationcontext':{'type':Sequelize[_0xfed1('0x2')]},'callerid':{'type':Sequelize[_0xfed1('0x2')]},'channel':{'type':Sequelize[_0xfed1('0x2')]},'destinationchannel':{'type':Sequelize[_0xfed1('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xfed1('0xa')]},'starttime':{'type':Sequelize[_0xfed1('0xb')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfed1('0xb')]},'endtime':{'type':Sequelize[_0xfed1('0xb')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xfed1('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfed1('0x2')]},'amaflags':{'type':Sequelize[_0xfed1('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xfed1('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xfed1('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xfed1('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6a350fb..753372b 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 _0x9c44=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','create','body','find','describe','uniqueid','user','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'attributes':['id',_0x49c4('0x26'),_0x49c4('0x42'),_0x49c4('0x43')],'model':db[_0x49c4('0x44')],'as':_0x49c4('0x44')}];}return db['VoiceCallReport'][_0x49c4('0x45')](_0x2b2793);})['then'](function(_0x104efb){_0x4f28a2[_0x49c4('0x46')]=_0x104efb;return _0x4f28a2;})[_0x49c4('0x3f')](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x47')](handleError(_0x889909,null));};exports[_0x49c4('0x48')]=function(_0x281b83,_0x4cbd0d){var _0x4d628a={'raw':!![],'where':{'id':_0x281b83[_0x49c4('0x49')]['id']}},_0x20490b={};_0x20490b[_0x49c4('0x31')]=_[_0x49c4('0x2f')](db['VoiceCallReport'][_0x49c4('0x2b')]);_0x20490b[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x281b83[_0x49c4('0x2e')]);_0x20490b[_0x49c4('0x30')]=_[_0x49c4('0x33')](_0x20490b[_0x49c4('0x31')],_0x20490b[_0x49c4('0x2e')]);_0x4d628a[_0x49c4('0x32')]=_['intersection'](_0x20490b[_0x49c4('0x31')],qs['fields'](_0x281b83[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x4d628a[_0x49c4('0x32')]=_0x4d628a[_0x49c4('0x32')][_0x49c4('0x35')]?_0x4d628a['attributes']:_0x20490b[_0x49c4('0x31')];if(_0x281b83[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x4d628a[_0x49c4('0x41')]=[{'all':!![]}];}_0x4d628a=_[_0x49c4('0x3c')]({},_0x4d628a,_0x281b83[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')]['find'](_0x4d628a)[_0x49c4('0x3f')](handleEntityNotFound(_0x4cbd0d,null))['then'](respondWithResult(_0x4cbd0d,null))[_0x49c4('0x47')](handleError(_0x4cbd0d,null));};exports[_0x49c4('0x4a')]=function(_0x29fe65,_0x27adfe){return db[_0x49c4('0x2a')][_0x49c4('0x4a')](_0x29fe65[_0x49c4('0x4b')],{})['then'](respondWithResult(_0x27adfe,0xc9))[_0x49c4('0x47')](handleError(_0x27adfe,null));};exports[_0x49c4('0x23')]=function(_0x4a5c34,_0x1e1ac4){return db[_0x49c4('0x2a')][_0x49c4('0x4c')]({'where':{'id':_0x4a5c34[_0x49c4('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e1ac4,null))['then'](removeEntity(_0x1e1ac4,null))[_0x49c4('0x47')](handleError(_0x1e1ac4,null));};exports['describe']=function(_0x4597c3,_0x1f941f){return db[_0x49c4('0x2a')][_0x49c4('0x4d')]()[_0x49c4('0x3f')](respondWithResult(_0x1f941f,null))[_0x49c4('0x47')](handleError(_0x1f941f,null));};exports[_0x49c4('0x22')]=function(_0x563f0b,_0x1f26c2){if(_0x563f0b[_0x49c4('0x4b')][_0x49c4('0x4e')]){delete _0x563f0b[_0x49c4('0x4b')][_0x49c4('0x4e')];}return db[_0x49c4('0x2a')][_0x49c4('0x4c')]({'where':{'uniqueid':_0x563f0b[_0x49c4('0x49')]['id'],'UserId':{'$or':[null,_0x563f0b[_0x49c4('0x4f')]['id']]}}})[_0x49c4('0x3f')](handleEntityNotFound(_0x1f26c2,null))['then'](saveUpdates(_0x563f0b['body'],null))[_0x49c4('0x3f')](respondWithResult(_0x1f26c2,null))[_0x49c4('0x47')](handleError(_0x1f26c2,null));}; \ No newline at end of file +var _0x9bde=['describe','uniqueid','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','VoiceCallReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','alias','User','findAll','catch','show','params','include','find','create'];(function(_0x8fee5a,_0x28c4aa){var _0x4bfc4f=function(_0x3c1151){while(--_0x3c1151){_0x8fee5a['push'](_0x8fee5a['shift']());}};_0x4bfc4f(++_0x28c4aa);}(_0x9bde,0xe1));var _0xe9bd=function(_0x14b17e,_0x25e333){_0x14b17e=_0x14b17e-0x0;var _0x585a10=_0x9bde[_0x14b17e];return _0x585a10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={},_0x1de54c={},_0x56e409={'count':0x0,'rows':[]};var _0xa45eb0=_[_0xe9bd('0x2b')](db[_0xe9bd('0x2c')][_0xe9bd('0x2d')],function(_0x4057df){return{'name':_0x4057df['fieldName'],'type':_0x4057df['type'][_0xe9bd('0x2e')]};});_0x1de54c[_0xe9bd('0x2f')]=_[_0xe9bd('0x2b')](_0xa45eb0,_0xe9bd('0x28'));_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x183601[_0xe9bd('0x30')]);_0x1de54c[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0x1de54c['model'],_0x1de54c[_0xe9bd('0x30')]);_0x5b7f1d[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0x1de54c['model'],qs['fields'](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x35')]));_0x5b7f1d[_0xe9bd('0x34')]=_0x5b7f1d[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x5b7f1d[_0xe9bd('0x34')]:_0x1de54c[_0xe9bd('0x2f')];if(!_0x183601[_0xe9bd('0x30')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x5b7f1d[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x1e')]);_0x5b7f1d[_0xe9bd('0x20')]=qs[_0xe9bd('0x20')](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x20')]);}_0x5b7f1d['order']=qs[_0xe9bd('0x39')](_0x183601[_0xe9bd('0x30')]['sort']);_0x5b7f1d[_0xe9bd('0x3a')]=qs[_0xe9bd('0x32')](_['pick'](_0x183601['query'],_0x1de54c[_0xe9bd('0x32')]),_0xa45eb0);if(_0x183601[_0xe9bd('0x30')]['filter']){_0x5b7f1d[_0xe9bd('0x3a')]=_[_0xe9bd('0x3b')](_0x5b7f1d[_0xe9bd('0x3a')],{'$or':_['map'](_0xa45eb0,function(_0x19740b){if(_0x19740b['type']!==_0xe9bd('0x3c')){var _0x42238a={};_0x42238a[_0x19740b[_0xe9bd('0x28')]]={'$like':'%'+_0x183601[_0xe9bd('0x30')]['filter']+'%'};return _0x42238a;}})});}_0x5b7f1d=_[_0xe9bd('0x3b')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x3d')]);var _0x327e1a={'where':_0x5b7f1d[_0xe9bd('0x3a')]};return db[_0xe9bd('0x2c')][_0xe9bd('0x1f')](_0x327e1a)[_0xe9bd('0x25')](function(_0xacfd19){_0x56e409[_0xe9bd('0x1f')]=_0xacfd19;if(_0x183601[_0xe9bd('0x30')]['includeAll']){_0x5b7f1d['include']=[{'attributes':['id',_0xe9bd('0x28'),'fullname',_0xe9bd('0x3e')],'model':db[_0xe9bd('0x3f')],'as':_0xe9bd('0x3f')}];}return db['VoiceCallReport'][_0xe9bd('0x40')](_0x5b7f1d);})[_0xe9bd('0x25')](function(_0x1a2d94){_0x56e409['rows']=_0x1a2d94;return _0x56e409;})[_0xe9bd('0x25')](respondWithFilteredResult(_0x519f48,_0x5b7f1d))[_0xe9bd('0x41')](handleError(_0x519f48,null));};exports[_0xe9bd('0x42')]=function(_0x388132,_0x1e1b87){var _0x40f87c={'raw':!![],'where':{'id':_0x388132[_0xe9bd('0x43')]['id']}},_0x221be7={};_0x221be7[_0xe9bd('0x2f')]=_[_0xe9bd('0x31')](db[_0xe9bd('0x2c')][_0xe9bd('0x2d')]);_0x221be7[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x388132[_0xe9bd('0x30')]);_0x221be7['filters']=_['intersection'](_0x221be7[_0xe9bd('0x2f')],_0x221be7[_0xe9bd('0x30')]);_0x40f87c[_0xe9bd('0x34')]=_['intersection'](_0x221be7['model'],qs[_0xe9bd('0x35')](_0x388132[_0xe9bd('0x30')][_0xe9bd('0x35')]));_0x40f87c[_0xe9bd('0x34')]=_0x40f87c[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x40f87c[_0xe9bd('0x34')]:_0x221be7['model'];if(_0x388132[_0xe9bd('0x30')]['includeAll']){_0x40f87c[_0xe9bd('0x44')]=[{'all':!![]}];}_0x40f87c=_[_0xe9bd('0x3b')]({},_0x40f87c,_0x388132[_0xe9bd('0x3d')]);return db[_0xe9bd('0x2c')][_0xe9bd('0x45')](_0x40f87c)['then'](handleEntityNotFound(_0x1e1b87,null))[_0xe9bd('0x25')](respondWithResult(_0x1e1b87,null))[_0xe9bd('0x41')](handleError(_0x1e1b87,null));};exports[_0xe9bd('0x46')]=function(_0x58dc3b,_0xff4e14){return db[_0xe9bd('0x2c')][_0xe9bd('0x46')](_0x58dc3b['body'],{})[_0xe9bd('0x25')](respondWithResult(_0xff4e14,0xc9))[_0xe9bd('0x41')](handleError(_0xff4e14,null));};exports[_0xe9bd('0x26')]=function(_0x10ec29,_0x1ee09c){return db['VoiceCallReport'][_0xe9bd('0x45')]({'where':{'id':_0x10ec29['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x1ee09c,null))[_0xe9bd('0x25')](removeEntity(_0x1ee09c,null))[_0xe9bd('0x41')](handleError(_0x1ee09c,null));};exports[_0xe9bd('0x47')]=function(_0x194b7d,_0x4944e3){return db[_0xe9bd('0x2c')]['describe']()[_0xe9bd('0x25')](respondWithResult(_0x4944e3,null))[_0xe9bd('0x41')](handleError(_0x4944e3,null));};exports['update']=function(_0x59d5cb,_0x1ce539){if(_0x59d5cb['body'][_0xe9bd('0x48')]){delete _0x59d5cb['body'][_0xe9bd('0x48')];}return db[_0xe9bd('0x2c')]['find']({'where':{'uniqueid':_0x59d5cb[_0xe9bd('0x43')]['id'],'UserId':{'$or':[null,_0x59d5cb['user']['id']]}}})[_0xe9bd('0x25')](handleEntityNotFound(_0x1ce539,null))[_0xe9bd('0x25')](saveUpdates(_0x59d5cb[_0xe9bd('0x49')],null))['then'](respondWithResult(_0x1ce539,null))[_0xe9bd('0x41')](handleError(_0x1ce539,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4ec6d60..efa87fb 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 _0x71e5=['path','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x5ccb78,_0x5ddd51){var _0x4fe34c=function(_0x1c608e){while(--_0x1c608e){_0x5ccb78['push'](_0x5ccb78['shift']());}};_0x4fe34c(++_0x5ddd51);}(_0x71e5,0x194));var _0x571e=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x71e5[_0x25fa5c];return _0x1bade2;};'use strict';var _=require(_0x571e('0x0'));var util=require('util');var logger=require(_0x571e('0x1'))(_0x571e('0x2'));var moment=require(_0x571e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x571e('0x4'));var rimraf=require(_0x571e('0x5'));var config=require(_0x571e('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x571e('0x7')]=function(_0x9564cc,_0x4907a9){return _0x9564cc[_0x571e('0x8')](_0x571e('0x9'),attributes,{'tableName':_0x571e('0xa'),'paranoid':![],'indexes':[{'fields':[_0x571e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a3d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util','../../config/logger'];(function(_0x3dd077,_0x1eda30){var _0x1d481e=function(_0xa2aa5a){while(--_0xa2aa5a){_0x3dd077['push'](_0x3dd077['shift']());}};_0x1d481e(++_0x1eda30);}(_0x9a3d,0x14e));var _0xd9a3=function(_0x3fc625,_0x35c089){_0x3fc625=_0x3fc625-0x0;var _0x4b52ea=_0x9a3d[_0x3fc625];return _0x4b52ea;};'use strict';var _=require('lodash');var util=require(_0xd9a3('0x0'));var logger=require(_0xd9a3('0x1'))(_0xd9a3('0x2'));var moment=require(_0xd9a3('0x3'));var BPromise=require(_0xd9a3('0x4'));var rp=require(_0xd9a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9a3('0x6'));var config=require(_0xd9a3('0x7'));var attributes=require(_0xd9a3('0x8'));module[_0xd9a3('0x9')]=function(_0x5355b8,_0x1ff64f){return _0x5355b8[_0xd9a3('0xa')](_0xd9a3('0xb'),attributes,{'tableName':_0xd9a3('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd9a3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 16815bb..f54ea99 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 _0x977e=['GetVoiceCallReport','VoiceCallReport','options','where','limit','include','attributes','map','model','CreateVoiceCallReport','create','raw','update','UpdateVoiceCallReport','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch'];(function(_0x330aea,_0x2890bf){var _0x2fc360=function(_0x330701){while(--_0x330701){_0x330aea['push'](_0x330aea['shift']());}};_0x2fc360(++_0x2890bf);}(_0x977e,0x1c8));var _0xe977=function(_0x8c4b53,_0x52cace){_0x8c4b53=_0x8c4b53-0x0;var _0x164404=_0x977e[_0x8c4b53];return _0x164404;};'use strict';var _=require(_0xe977('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe977('0x1'));var rs=require(_0xe977('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe977('0x3'))['db'];var utils=require(_0xe977('0x4'));var logger=require(_0xe977('0x5'))(_0xe977('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe977('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x919d31,_0x1b816c,_0x572470){return new BPromise(function(_0x262d33,_0x5d30a8){return client[_0xe977('0x8')](_0x919d31,_0x572470)[_0xe977('0x9')](function(_0xafa46e){logger[_0xe977('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x1b816c,_0xe977('0xb'));logger[_0xe977('0xc')](_0xe977('0xd'),_0x1b816c,_0xe977('0xb'),JSON[_0xe977('0xe')](_0xafa46e));if(_0xafa46e[_0xe977('0xf')]){if(_0xafa46e[_0xe977('0xf')]['code']===0x1f4){logger[_0xe977('0xf')](_0xe977('0x10'),_0x1b816c,_0xafa46e['error']['message']);return _0x5d30a8(_0xafa46e[_0xe977('0xf')]['message']);}logger[_0xe977('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x1b816c,_0xafa46e['error'][_0xe977('0x11')]);return _0x262d33(_0xafa46e[_0xe977('0xf')][_0xe977('0x11')]);}else{logger['info'](_0xe977('0x10'),_0x1b816c,_0xe977('0xb'));_0x262d33(_0xafa46e[_0xe977('0x12')][_0xe977('0x11')]);}})[_0xe977('0x13')](function(_0x18152c){logger[_0xe977('0xf')](_0xe977('0x10'),_0x1b816c,_0x18152c);_0x5d30a8(_0x18152c);});});}exports[_0xe977('0x14')]=function(_0xccf31){var _0x1bb7c7=this;return new Promise(function(_0xa365e4,_0x1a8c02){return db[_0xe977('0x15')]['findAll']({'raw':_0xccf31[_0xe977('0x16')]?_0xccf31[_0xe977('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xccf31[_0xe977('0x16')]?_0xccf31[_0xe977('0x16')][_0xe977('0x17')]||null:null,'attributes':_0xccf31[_0xe977('0x16')]?_0xccf31[_0xe977('0x16')]['attributes']||null:null,'limit':_0xccf31[_0xe977('0x16')]?_0xccf31[_0xe977('0x16')][_0xe977('0x18')]||null:null,'include':_0xccf31[_0xe977('0x16')]?_0xccf31[_0xe977('0x16')][_0xe977('0x19')]?_['map'](_0xccf31[_0xe977('0x16')][_0xe977('0x19')],function(_0x255b90){return{'model':db[_0x255b90['model']],'as':_0x255b90['as'],'attributes':_0x255b90[_0xe977('0x1a')],'include':_0x255b90[_0xe977('0x19')]?_[_0xe977('0x1b')](_0x255b90[_0xe977('0x19')],function(_0x32ad99){return{'model':db[_0x32ad99[_0xe977('0x1c')]],'as':_0x32ad99['as'],'attributes':_0x32ad99[_0xe977('0x1a')],'include':_0x32ad99[_0xe977('0x19')]?_['map'](_0x32ad99[_0xe977('0x19')],function(_0x18bdf3){return{'model':db[_0x18bdf3[_0xe977('0x1c')]],'as':_0x18bdf3['as'],'attributes':_0x18bdf3[_0xe977('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe977('0x9')](function(_0x4d7b18){logger[_0xe977('0xa')]('GetVoiceCallReport',_0xccf31);logger[_0xe977('0xc')](_0xe977('0x14'),_0xccf31,JSON['stringify'](_0x4d7b18));_0xa365e4(_0x4d7b18);})[_0xe977('0x13')](function(_0x275e7e){logger[_0xe977('0xf')](_0xe977('0x14'),_0x275e7e['message'],_0xccf31);_0x1a8c02(_0x1bb7c7[_0xe977('0xf')](0x1f4,_0x275e7e[_0xe977('0x11')]));});});};exports[_0xe977('0x1d')]=function(_0x193ff7){var _0x3c0ec9=this;return new Promise(function(_0x417c37,_0x38deec){return db['VoiceCallReport'][_0xe977('0x1e')](_0x193ff7['body'],{'raw':_0x193ff7[_0xe977('0x16')]?_0x193ff7[_0xe977('0x16')][_0xe977('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3a5c69){logger[_0xe977('0xa')](_0xe977('0x1d'),_0x193ff7);logger[_0xe977('0xc')](_0xe977('0x1d'),_0x193ff7,JSON['stringify'](_0x3a5c69));_0x417c37(_0x3a5c69);})[_0xe977('0x13')](function(_0x23cfb5){logger[_0xe977('0xf')](_0xe977('0x1d'),_0x23cfb5[_0xe977('0x11')],_0x193ff7);_0x38deec(_0x3c0ec9['error'](0x1f4,_0x23cfb5[_0xe977('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x15577e){var _0x4e8255=this;return new Promise(function(_0x19b915,_0x41c581){return db['VoiceCallReport'][_0xe977('0x20')](_0x15577e['body'],{'raw':_0x15577e[_0xe977('0x16')]?_0x15577e[_0xe977('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15577e['options']?_0x15577e[_0xe977('0x16')]['where']||null:null,'attributes':_0x15577e[_0xe977('0x16')]?_0x15577e[_0xe977('0x16')][_0xe977('0x1a')]||null:null,'limit':_0x15577e[_0xe977('0x16')]?_0x15577e[_0xe977('0x16')][_0xe977('0x18')]||null:null})[_0xe977('0x9')](function(_0x3f0e00){logger[_0xe977('0xa')]('UpdateVoiceCallReport',_0x15577e);logger[_0xe977('0xc')](_0xe977('0x21'),_0x15577e,JSON['stringify'](_0x3f0e00));_0x19b915(_0x3f0e00);})[_0xe977('0x13')](function(_0x229692){logger[_0xe977('0xf')](_0xe977('0x21'),_0x229692[_0xe977('0x11')],_0x15577e);_0x41c581(_0x4e8255[_0xe977('0xf')](0x1f4,_0x229692['message']));});});}; \ No newline at end of file +var _0xce38=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','then','catch','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','util','moment'];(function(_0x4fce24,_0xa929c1){var _0x55a990=function(_0xde190c){while(--_0xde190c){_0x4fce24['push'](_0x4fce24['shift']());}};_0x55a990(++_0xa929c1);}(_0xce38,0x10f));var _0x8ce3=function(_0x14bd60,_0x73b2f9){_0x14bd60=_0x14bd60-0x0;var _0x4b0a31=_0xce38[_0x14bd60];return _0x4b0a31;};'use strict';var _=require('lodash');var util=require(_0x8ce3('0x0'));var moment=require(_0x8ce3('0x1'));var BPromise=require(_0x8ce3('0x2'));var rs=require(_0x8ce3('0x3'));var fs=require('fs');var Redis=require(_0x8ce3('0x4'));var db=require(_0x8ce3('0x5'))['db'];var utils=require(_0x8ce3('0x6'));var logger=require(_0x8ce3('0x7'))(_0x8ce3('0x8'));var config=require('../../config/environment');var jayson=require(_0x8ce3('0x9'));var client=jayson[_0x8ce3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b781,_0xe55871,_0x502a92){return new BPromise(function(_0xd4487,_0x590b8b){return client[_0x8ce3('0xb')](_0x27b781,_0x502a92)['then'](function(_0x3f0bcd){logger[_0x8ce3('0xc')](_0x8ce3('0xd'),_0xe55871,'request\x20sent');logger[_0x8ce3('0xe')](_0x8ce3('0xf'),_0xe55871,'request\x20sent',JSON[_0x8ce3('0x10')](_0x3f0bcd));if(_0x3f0bcd[_0x8ce3('0x11')]){if(_0x3f0bcd[_0x8ce3('0x11')]['code']===0x1f4){logger[_0x8ce3('0x11')](_0x8ce3('0xd'),_0xe55871,_0x3f0bcd[_0x8ce3('0x11')][_0x8ce3('0x12')]);return _0x590b8b(_0x3f0bcd[_0x8ce3('0x11')][_0x8ce3('0x12')]);}logger[_0x8ce3('0x11')](_0x8ce3('0xd'),_0xe55871,_0x3f0bcd[_0x8ce3('0x11')][_0x8ce3('0x12')]);return _0xd4487(_0x3f0bcd[_0x8ce3('0x11')]['message']);}else{logger[_0x8ce3('0xc')](_0x8ce3('0xd'),_0xe55871,_0x8ce3('0x13'));_0xd4487(_0x3f0bcd[_0x8ce3('0x14')][_0x8ce3('0x12')]);}})['catch'](function(_0x5a2f8b){logger[_0x8ce3('0x11')](_0x8ce3('0xd'),_0xe55871,_0x5a2f8b);_0x590b8b(_0x5a2f8b);});});}exports[_0x8ce3('0x15')]=function(_0x361559){var _0x13a528=this;return new Promise(function(_0x4db5d1,_0x457c78){return db[_0x8ce3('0x16')][_0x8ce3('0x17')]({'raw':_0x361559['options']?_0x361559[_0x8ce3('0x18')][_0x8ce3('0x19')]===undefined?!![]:![]:!![],'where':_0x361559[_0x8ce3('0x18')]?_0x361559['options'][_0x8ce3('0x1a')]||null:null,'attributes':_0x361559[_0x8ce3('0x18')]?_0x361559[_0x8ce3('0x18')][_0x8ce3('0x1b')]||null:null,'limit':_0x361559[_0x8ce3('0x18')]?_0x361559[_0x8ce3('0x18')][_0x8ce3('0x1c')]||null:null,'include':_0x361559[_0x8ce3('0x18')]?_0x361559[_0x8ce3('0x18')]['include']?_[_0x8ce3('0x1d')](_0x361559[_0x8ce3('0x18')]['include'],function(_0x1a9caf){return{'model':db[_0x1a9caf['model']],'as':_0x1a9caf['as'],'attributes':_0x1a9caf[_0x8ce3('0x1b')],'include':_0x1a9caf[_0x8ce3('0x1e')]?_[_0x8ce3('0x1d')](_0x1a9caf[_0x8ce3('0x1e')],function(_0xda9cb2){return{'model':db[_0xda9cb2[_0x8ce3('0x1f')]],'as':_0xda9cb2['as'],'attributes':_0xda9cb2[_0x8ce3('0x1b')],'include':_0xda9cb2[_0x8ce3('0x1e')]?_[_0x8ce3('0x1d')](_0xda9cb2['include'],function(_0x16f366){return{'model':db[_0x16f366['model']],'as':_0x16f366['as'],'attributes':_0x16f366[_0x8ce3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8ce3('0x20')](function(_0x583e47){logger[_0x8ce3('0xc')](_0x8ce3('0x15'),_0x361559);logger[_0x8ce3('0xe')]('GetVoiceCallReport',_0x361559,JSON[_0x8ce3('0x10')](_0x583e47));_0x4db5d1(_0x583e47);})[_0x8ce3('0x21')](function(_0x55f554){logger[_0x8ce3('0x11')](_0x8ce3('0x15'),_0x55f554[_0x8ce3('0x12')],_0x361559);_0x457c78(_0x13a528[_0x8ce3('0x11')](0x1f4,_0x55f554['message']));});});};exports[_0x8ce3('0x22')]=function(_0x2598fd){var _0xeb99ea=this;return new Promise(function(_0x544cbb,_0x5f74ef){return db[_0x8ce3('0x16')][_0x8ce3('0x23')](_0x2598fd[_0x8ce3('0x24')],{'raw':_0x2598fd[_0x8ce3('0x18')]?_0x2598fd[_0x8ce3('0x18')][_0x8ce3('0x19')]===undefined?!![]:![]:!![]})[_0x8ce3('0x20')](function(_0x2d9894){logger[_0x8ce3('0xc')](_0x8ce3('0x22'),_0x2598fd);logger['debug'](_0x8ce3('0x22'),_0x2598fd,JSON['stringify'](_0x2d9894));_0x544cbb(_0x2d9894);})[_0x8ce3('0x21')](function(_0x45c22d){logger['error'](_0x8ce3('0x22'),_0x45c22d[_0x8ce3('0x12')],_0x2598fd);_0x5f74ef(_0xeb99ea[_0x8ce3('0x11')](0x1f4,_0x45c22d[_0x8ce3('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x4bbcd3){var _0xcc81ac=this;return new Promise(function(_0x5109e1,_0x1077dc){return db[_0x8ce3('0x16')][_0x8ce3('0x25')](_0x4bbcd3['body'],{'raw':_0x4bbcd3['options']?_0x4bbcd3[_0x8ce3('0x18')][_0x8ce3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbcd3[_0x8ce3('0x18')]?_0x4bbcd3[_0x8ce3('0x18')][_0x8ce3('0x1a')]||null:null,'attributes':_0x4bbcd3[_0x8ce3('0x18')]?_0x4bbcd3[_0x8ce3('0x18')]['attributes']||null:null,'limit':_0x4bbcd3['options']?_0x4bbcd3[_0x8ce3('0x18')][_0x8ce3('0x1c')]||null:null})['then'](function(_0x5218f0){logger['info'](_0x8ce3('0x26'),_0x4bbcd3);logger[_0x8ce3('0xe')](_0x8ce3('0x26'),_0x4bbcd3,JSON[_0x8ce3('0x10')](_0x5218f0));_0x5109e1(_0x5218f0);})[_0x8ce3('0x21')](function(_0x127712){logger[_0x8ce3('0x11')]('UpdateVoiceCallReport',_0x127712[_0x8ce3('0x12')],_0x4bbcd3);_0x1077dc(_0xcc81ac['error'](0x1f4,_0x127712[_0x8ce3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index efcef4d..c8d7b55 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 _0x441f=['update','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','create'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x441f,0x16a));var _0xf441=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0x441f[_0x2fa457];return _0x4f250a;};'use strict';var multer=require(_0xf441('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf441('0x1'));var router=express[_0xf441('0x2')]();var fs_extra=require(_0xf441('0x3'));var auth=require(_0xf441('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf441('0x5'));var controller=require(_0xf441('0x6'));router[_0xf441('0x7')]('/',auth['isAuthenticated'](),controller[_0xf441('0x8')]);router['get'](_0xf441('0x9'),auth[_0xf441('0xa')](),controller[_0xf441('0xb')]);router['post']('/',auth[_0xf441('0xa')](),controller[_0xf441('0xc')]);router['put'](_0xf441('0x9'),auth['isAuthenticated'](),controller[_0xf441('0xd')]);router['delete'](_0xf441('0x9'),auth[_0xf441('0xa')](),controller[_0xf441('0xe')]);module['exports']=router; \ No newline at end of file +var _0x2c47=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x348985,_0x165339){var _0x4a1e13=function(_0x1db209){while(--_0x1db209){_0x348985['push'](_0x348985['shift']());}};_0x4a1e13(++_0x165339);}(_0x2c47,0x18e));var _0x72c4=function(_0x388754,_0x221dc9){_0x388754=_0x388754-0x0;var _0x536091=_0x2c47[_0x388754];return _0x536091;};'use strict';var multer=require(_0x72c4('0x0'));var util=require(_0x72c4('0x1'));var path=require(_0x72c4('0x2'));var timeout=require(_0x72c4('0x3'));var express=require(_0x72c4('0x4'));var router=express[_0x72c4('0x5')]();var fs_extra=require(_0x72c4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x72c4('0x7'));router[_0x72c4('0x8')]('/',auth[_0x72c4('0x9')](),controller[_0x72c4('0xa')]);router['get'](_0x72c4('0xb'),auth[_0x72c4('0x9')](),controller[_0x72c4('0xc')]);router[_0x72c4('0xd')]('/',auth[_0x72c4('0x9')](),controller[_0x72c4('0xe')]);router['put'](_0x72c4('0xb'),auth[_0x72c4('0x9')](),controller[_0x72c4('0xf')]);router[_0x72c4('0x10')](_0x72c4('0xb'),auth[_0x72c4('0x9')](),controller['destroy']);module[_0x72c4('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6e2133f..033a909 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 _0x218e=['options','join','getDataValue','BOOLEAN','exports','STRING','setDataValue'];(function(_0x1a4091,_0x4c0128){var _0x44af29=function(_0xddaa44){while(--_0xddaa44){_0x1a4091['push'](_0x1a4091['shift']());}};_0x44af29(++_0x4c0128);}(_0x218e,0xd6));var _0xe218=function(_0x66e968,_0x2dcbbd){_0x66e968=_0x66e968-0x0;var _0x35fb35=_0x218e[_0x66e968];return _0x35fb35;};'use strict';var Sequelize=require('sequelize');module[_0xe218('0x0')]={'name':{'type':Sequelize[_0xe218('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x4eabb7){this[_0xe218('0x2')](_0xe218('0x3'),_0x4eabb7?_0x4eabb7[_0xe218('0x4')](''):[]);},'get':function(){return this[_0xe218('0x5')](_0xe218('0x3'))?this[_0xe218('0x5')](_0xe218('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0xe218('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xe218('0x1')]},'record':{'type':Sequelize[_0xe218('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe218('0x1')]},'description':{'type':Sequelize[_0xe218('0x1')]}}; \ No newline at end of file +var _0x2d7f=['options','BOOLEAN','exports','STRING','name','join','getDataValue'];(function(_0x718f5e,_0x27455d){var _0x2b4efe=function(_0x3abdd9){while(--_0x3abdd9){_0x718f5e['push'](_0x718f5e['shift']());}};_0x2b4efe(++_0x27455d);}(_0x2d7f,0x95));var _0xf2d7=function(_0x287ed0,_0x1bc2f5){_0x287ed0=_0x287ed0-0x0;var _0x58061a=_0x2d7f[_0x287ed0];return _0x58061a;};'use strict';var Sequelize=require('sequelize');module[_0xf2d7('0x0')]={'name':{'type':Sequelize[_0xf2d7('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xf2d7('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xf2d7('0x1')],'set':function(_0x1e4d89){this['setDataValue']('options',_0x1e4d89?_0x1e4d89[_0xf2d7('0x3')](''):[]);},'get':function(){return this[_0xf2d7('0x4')](_0xf2d7('0x5'))?this['getDataValue'](_0xf2d7('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0xf2d7('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xf2d7('0x1')]},'record':{'type':Sequelize[_0xf2d7('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf2d7('0x1')]},'description':{'type':Sequelize[_0xf2d7('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 09697df..1979a26 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 _0xd7fd=['query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','rawAttributes','length','catch','create','body','user','role','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','apply','reject','save','then','UserProfileResource','end','error','name','index','VoiceChanSpy','fieldName','type','key','model','map'];(function(_0x48f485,_0x4c5aea){var _0x46cb65=function(_0x12bb60){while(--_0x12bb60){_0x48f485['push'](_0x48f485['shift']());}};_0x46cb65(++_0x4c5aea);}(_0xd7fd,0x161));var _0xdd7f=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0xd7fd[_0x1ebb10];return _0x20d709;};'use strict';var emlformat=require(_0xdd7f('0x0'));var rimraf=require(_0xdd7f('0x1'));var zipdir=require(_0xdd7f('0x2'));var jsonpatch=require(_0xdd7f('0x3'));var rp=require(_0xdd7f('0x4'));var moment=require(_0xdd7f('0x5'));var BPromise=require(_0xdd7f('0x6'));var Mustache=require(_0xdd7f('0x7'));var util=require(_0xdd7f('0x8'));var path=require(_0xdd7f('0x9'));var sox=require('sox');var csv=require(_0xdd7f('0xa'));var ejs=require(_0xdd7f('0xb'));var fs=require('fs');var fs_extra=require(_0xdd7f('0xc'));var _=require(_0xdd7f('0xd'));var squel=require(_0xdd7f('0xe'));var crypto=require(_0xdd7f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdd7f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdd7f('0x11'));var Papa=require(_0xdd7f('0x12'));var Redis=require(_0xdd7f('0x13'));var authService=require(_0xdd7f('0x14'));var qs=require(_0xdd7f('0x15'));var as=require(_0xdd7f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdd7f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdd7f('0x18'));var db=require(_0xdd7f('0x19'))['db'];function respondWithStatusCode(_0x39d441,_0xe06002){_0xe06002=_0xe06002||0xcc;return function(_0x35ca4c){if(_0x35ca4c){return _0x39d441[_0xdd7f('0x1a')](_0xe06002);}return _0x39d441['status'](_0xe06002)['end']();};}function respondWithResult(_0x5bf7bd,_0x209482){_0x209482=_0x209482||0xc8;return function(_0x1a4253){if(_0x1a4253){return _0x5bf7bd[_0xdd7f('0x1b')](_0x209482)['json'](_0x1a4253);}};}function respondWithFilteredResult(_0x162e39,_0x389d0c){return function(_0x28ad76){if(_0x28ad76){var _0x42b5d7=typeof _0x389d0c[_0xdd7f('0x1c')]==='undefined'&&typeof _0x389d0c[_0xdd7f('0x1d')]==='undefined';var _0x332e3e=_0x28ad76[_0xdd7f('0x1e')];var _0xc0b934=_0x42b5d7?0x0:_0x389d0c[_0xdd7f('0x1c')];var _0x4268de=_0x42b5d7?_0x28ad76[_0xdd7f('0x1e')]:_0x389d0c[_0xdd7f('0x1c')]+_0x389d0c[_0xdd7f('0x1d')];var _0x2cd644;if(_0x4268de>=_0x332e3e){_0x4268de=_0x332e3e;_0x2cd644=0xc8;}else{_0x2cd644=0xce;}_0x162e39['status'](_0x2cd644);return _0x162e39[_0xdd7f('0x1f')]('Content-Range',_0xc0b934+'-'+_0x4268de+'/'+_0x332e3e)['json'](_0x28ad76);}return null;};}function patchUpdates(_0x4746b2){return function(_0x5dc600){try{jsonpatch[_0xdd7f('0x20')](_0x5dc600,_0x4746b2,!![]);}catch(_0x25f34c){return BPromise[_0xdd7f('0x21')](_0x25f34c);}return _0x5dc600[_0xdd7f('0x22')]();};}function saveUpdates(_0x1062a2,_0xf787f4){return function(_0x4326a1){if(_0x4326a1){return _0x4326a1['update'](_0x1062a2)[_0xdd7f('0x23')](function(_0x6d9b0b){return _0x6d9b0b;});}return null;};}function removeEntity(_0x156684,_0x249a92){return function(_0x299864){if(_0x299864){return _0x299864['destroy']()[_0xdd7f('0x23')](function(){var _0xe55936=_0x299864['get']({'plain':!![]});var _0x13082e='ChanSpies';return db[_0xdd7f('0x24')]['destroy']({'where':{'type':_0x13082e,'resourceId':_0xe55936['id']}})['then'](function(){return _0x299864;});})['then'](function(){_0x156684[_0xdd7f('0x1b')](0xcc)[_0xdd7f('0x25')]();});}};}function handleEntityNotFound(_0x211857,_0xd4a41b){return function(_0x25a560){if(!_0x25a560){_0x211857['sendStatus'](0x194);}return _0x25a560;};}function handleError(_0x74b20,_0x31a835){_0x31a835=_0x31a835||0x1f4;return function(_0x259cf2){logger[_0xdd7f('0x26')](_0x259cf2['stack']);if(_0x259cf2[_0xdd7f('0x27')]){delete _0x259cf2['name'];}_0x74b20[_0xdd7f('0x1b')](_0x31a835)['send'](_0x259cf2);};}exports[_0xdd7f('0x28')]=function(_0x32dae8,_0x1373a7){var _0x5e6d6c={},_0x1003c5={},_0x1c58fe={'count':0x0,'rows':[]};var _0x361845=_['map'](db[_0xdd7f('0x29')]['rawAttributes'],function(_0x1b7db5){return{'name':_0x1b7db5[_0xdd7f('0x2a')],'type':_0x1b7db5[_0xdd7f('0x2b')][_0xdd7f('0x2c')]};});_0x1003c5[_0xdd7f('0x2d')]=_[_0xdd7f('0x2e')](_0x361845,_0xdd7f('0x27'));_0x1003c5[_0xdd7f('0x2f')]=_[_0xdd7f('0x30')](_0x32dae8[_0xdd7f('0x2f')]);_0x1003c5['filters']=_[_0xdd7f('0x31')](_0x1003c5['model'],_0x1003c5[_0xdd7f('0x2f')]);_0x5e6d6c[_0xdd7f('0x32')]=_[_0xdd7f('0x31')](_0x1003c5[_0xdd7f('0x2d')],qs[_0xdd7f('0x33')](_0x32dae8[_0xdd7f('0x2f')][_0xdd7f('0x33')]));_0x5e6d6c[_0xdd7f('0x32')]=_0x5e6d6c[_0xdd7f('0x32')]['length']?_0x5e6d6c[_0xdd7f('0x32')]:_0x1003c5[_0xdd7f('0x2d')];if(!_0x32dae8[_0xdd7f('0x2f')][_0xdd7f('0x34')]('nolimit')){_0x5e6d6c[_0xdd7f('0x1d')]=qs[_0xdd7f('0x1d')](_0x32dae8[_0xdd7f('0x2f')]['limit']);_0x5e6d6c[_0xdd7f('0x1c')]=qs['offset'](_0x32dae8[_0xdd7f('0x2f')]['offset']);}_0x5e6d6c[_0xdd7f('0x35')]=qs[_0xdd7f('0x36')](_0x32dae8['query'][_0xdd7f('0x36')]);_0x5e6d6c[_0xdd7f('0x37')]=qs['filters'](_[_0xdd7f('0x38')](_0x32dae8[_0xdd7f('0x2f')],_0x1003c5[_0xdd7f('0x39')]),_0x361845);if(_0x32dae8[_0xdd7f('0x2f')]['filter']){_0x5e6d6c[_0xdd7f('0x37')]=_[_0xdd7f('0x3a')](_0x5e6d6c[_0xdd7f('0x37')],{'$or':_[_0xdd7f('0x2e')](_0x361845,function(_0x2e0b49){if(_0x2e0b49['type']!==_0xdd7f('0x3b')){var _0x46de54={};_0x46de54[_0x2e0b49['name']]={'$like':'%'+_0x32dae8['query'][_0xdd7f('0x3c')]+'%'};return _0x46de54;}})});}_0x5e6d6c=_['merge']({},_0x5e6d6c,_0x32dae8[_0xdd7f('0x3d')]);var _0x13c3b5={'where':_0x5e6d6c[_0xdd7f('0x37')]};return db[_0xdd7f('0x29')][_0xdd7f('0x1e')](_0x13c3b5)[_0xdd7f('0x23')](function(_0x245459){_0x1c58fe[_0xdd7f('0x1e')]=_0x245459;if(_0x32dae8[_0xdd7f('0x2f')][_0xdd7f('0x3e')]){_0x5e6d6c[_0xdd7f('0x3f')]=[{'all':!![]}];}return db[_0xdd7f('0x29')][_0xdd7f('0x40')](_0x5e6d6c);})['then'](function(_0x57f2a6){_0x1c58fe[_0xdd7f('0x41')]=_0x57f2a6;return _0x1c58fe;})[_0xdd7f('0x23')](respondWithFilteredResult(_0x1373a7,_0x5e6d6c))['catch'](handleError(_0x1373a7,null));};exports['show']=function(_0x3c54b5,_0x1c528b){var _0x10f739={'raw':![],'where':{'id':_0x3c54b5[_0xdd7f('0x42')]['id']}},_0x384ced={};_0x384ced[_0xdd7f('0x2d')]=_[_0xdd7f('0x30')](db[_0xdd7f('0x29')][_0xdd7f('0x43')]);_0x384ced[_0xdd7f('0x2f')]=_[_0xdd7f('0x30')](_0x3c54b5[_0xdd7f('0x2f')]);_0x384ced[_0xdd7f('0x39')]=_[_0xdd7f('0x31')](_0x384ced[_0xdd7f('0x2d')],_0x384ced['query']);_0x10f739[_0xdd7f('0x32')]=_['intersection'](_0x384ced[_0xdd7f('0x2d')],qs[_0xdd7f('0x33')](_0x3c54b5['query'][_0xdd7f('0x33')]));_0x10f739[_0xdd7f('0x32')]=_0x10f739[_0xdd7f('0x32')][_0xdd7f('0x44')]?_0x10f739[_0xdd7f('0x32')]:_0x384ced[_0xdd7f('0x2d')];if(_0x3c54b5[_0xdd7f('0x2f')][_0xdd7f('0x3e')]){_0x10f739['include']=[{'all':!![]}];}_0x10f739=_['merge']({},_0x10f739,_0x3c54b5['options']);return db[_0xdd7f('0x29')]['find'](_0x10f739)[_0xdd7f('0x23')](handleEntityNotFound(_0x1c528b,null))[_0xdd7f('0x23')](respondWithResult(_0x1c528b,null))[_0xdd7f('0x45')](handleError(_0x1c528b,null));};exports[_0xdd7f('0x46')]=function(_0x31db93,_0x1502c7){return db[_0xdd7f('0x29')][_0xdd7f('0x46')](_0x31db93[_0xdd7f('0x47')],{})[_0xdd7f('0x23')](function(_0x3278eb){var _0x4a053b=_0x31db93[_0xdd7f('0x48')]['get']({'plain':!![]});if(!_0x4a053b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a053b[_0xdd7f('0x49')]===_0xdd7f('0x48')){var _0x3ed433=_0x3278eb[_0xdd7f('0x4a')]({'plain':!![]});var _0x39fe51='ChanSpies';return db[_0xdd7f('0x4b')][_0xdd7f('0x4c')]({'where':{'name':_0x39fe51,'userProfileId':_0x4a053b['userProfileId']},'raw':!![]})[_0xdd7f('0x23')](function(_0x4ecfcf){if(_0x4ecfcf&&_0x4ecfcf['autoAssociation']===0x0){return db[_0xdd7f('0x24')][_0xdd7f('0x46')]({'name':_0x3ed433['name'],'resourceId':_0x3ed433['id'],'type':_0x4ecfcf[_0xdd7f('0x27')],'sectionId':_0x4ecfcf['id']},{})[_0xdd7f('0x23')](function(){return _0x3278eb;});}else{return _0x3278eb;}})[_0xdd7f('0x45')](function(_0x1561db){logger[_0xdd7f('0x26')](_0xdd7f('0x4d'),_0x1561db);throw _0x1561db;});}return _0x3278eb;})[_0xdd7f('0x23')](respondWithResult(_0x1502c7,0xc9))[_0xdd7f('0x45')](handleError(_0x1502c7,null));};exports[_0xdd7f('0x4e')]=function(_0x55ee87,_0x1ed176){if(_0x55ee87[_0xdd7f('0x47')]['id']){delete _0x55ee87[_0xdd7f('0x47')]['id'];}return db[_0xdd7f('0x29')]['find']({'where':{'id':_0x55ee87[_0xdd7f('0x42')]['id']}})[_0xdd7f('0x23')](handleEntityNotFound(_0x1ed176,null))[_0xdd7f('0x23')](saveUpdates(_0x55ee87[_0xdd7f('0x47')],null))['then'](respondWithResult(_0x1ed176,null))['catch'](handleError(_0x1ed176,null));};exports[_0xdd7f('0x4f')]=function(_0x2b2fac,_0x18dc4c){return db[_0xdd7f('0x29')]['find']({'where':{'id':_0x2b2fac[_0xdd7f('0x42')]['id']}})['then'](handleEntityNotFound(_0x18dc4c,null))[_0xdd7f('0x23')](removeEntity(_0x18dc4c,null))['catch'](handleError(_0x18dc4c,null));}; \ No newline at end of file +var _0xd74a=['bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','error','name','send','map','VoiceChanSpy','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','merge','options','find','create','body','get','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xd74a,0xa4));var _0xad74=function(_0x3c876e,_0x4a5295){_0x3c876e=_0x3c876e-0x0;var _0x46f90e=_0xd74a[_0x3c876e];return _0x46f90e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad74('0x0'));var zipdir=require(_0xad74('0x1'));var jsonpatch=require(_0xad74('0x2'));var rp=require(_0xad74('0x3'));var moment=require('moment');var BPromise=require(_0xad74('0x4'));var Mustache=require(_0xad74('0x5'));var util=require(_0xad74('0x6'));var path=require(_0xad74('0x7'));var sox=require(_0xad74('0x8'));var csv=require(_0xad74('0x9'));var ejs=require(_0xad74('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xad74('0xb'));var crypto=require(_0xad74('0xc'));var jsforce=require(_0xad74('0xd'));var deskjs=require(_0xad74('0xe'));var toCsv=require(_0xad74('0x9'));var querystring=require(_0xad74('0xf'));var Papa=require(_0xad74('0x10'));var Redis=require(_0xad74('0x11'));var authService=require(_0xad74('0x12'));var qs=require(_0xad74('0x13'));var as=require(_0xad74('0x14'));var hardwareService=require(_0xad74('0x15'));var logger=require('../../config/logger')(_0xad74('0x16'));var utils=require(_0xad74('0x17'));var config=require(_0xad74('0x18'));var licenseUtil=require(_0xad74('0x19'));var db=require(_0xad74('0x1a'))['db'];function respondWithStatusCode(_0x4cb329,_0x287f6f){_0x287f6f=_0x287f6f||0xcc;return function(_0x1c1bcb){if(_0x1c1bcb){return _0x4cb329[_0xad74('0x1b')](_0x287f6f);}return _0x4cb329['status'](_0x287f6f)[_0xad74('0x1c')]();};}function respondWithResult(_0x366c99,_0x5dc914){_0x5dc914=_0x5dc914||0xc8;return function(_0x5b99be){if(_0x5b99be){return _0x366c99[_0xad74('0x1d')](_0x5dc914)[_0xad74('0x1e')](_0x5b99be);}};}function respondWithFilteredResult(_0x18e96c,_0x57ef66){return function(_0x35a25b){if(_0x35a25b){var _0x4babc5=typeof _0x57ef66['offset']===_0xad74('0x1f')&&typeof _0x57ef66[_0xad74('0x20')]===_0xad74('0x1f');var _0x271454=_0x35a25b[_0xad74('0x21')];var _0x4ced3f=_0x4babc5?0x0:_0x57ef66[_0xad74('0x22')];var _0x16832c=_0x4babc5?_0x35a25b[_0xad74('0x21')]:_0x57ef66[_0xad74('0x22')]+_0x57ef66[_0xad74('0x20')];var _0x103bd2;if(_0x16832c>=_0x271454){_0x16832c=_0x271454;_0x103bd2=0xc8;}else{_0x103bd2=0xce;}_0x18e96c[_0xad74('0x1d')](_0x103bd2);return _0x18e96c['set'](_0xad74('0x23'),_0x4ced3f+'-'+_0x16832c+'/'+_0x271454)[_0xad74('0x1e')](_0x35a25b);}return null;};}function patchUpdates(_0x4ba05a){return function(_0x589c00){try{jsonpatch[_0xad74('0x24')](_0x589c00,_0x4ba05a,!![]);}catch(_0x4c8923){return BPromise[_0xad74('0x25')](_0x4c8923);}return _0x589c00[_0xad74('0x26')]();};}function saveUpdates(_0x5e055f,_0x1dd7f6){return function(_0x12a580){if(_0x12a580){return _0x12a580[_0xad74('0x27')](_0x5e055f)[_0xad74('0x28')](function(_0x25a6e4){return _0x25a6e4;});}return null;};}function removeEntity(_0x39b929,_0x2acfe){return function(_0x1c2a7d){if(_0x1c2a7d){return _0x1c2a7d[_0xad74('0x29')]()[_0xad74('0x28')](function(){var _0x344ec1=_0x1c2a7d['get']({'plain':!![]});var _0x4ded5a=_0xad74('0x2a');return db[_0xad74('0x2b')][_0xad74('0x29')]({'where':{'type':_0x4ded5a,'resourceId':_0x344ec1['id']}})['then'](function(){return _0x1c2a7d;});})[_0xad74('0x28')](function(){_0x39b929['status'](0xcc)[_0xad74('0x1c')]();});}};}function handleEntityNotFound(_0x466cbe,_0x491991){return function(_0x5e55bb){if(!_0x5e55bb){_0x466cbe[_0xad74('0x1b')](0x194);}return _0x5e55bb;};}function handleError(_0x37e1bb,_0x486613){_0x486613=_0x486613||0x1f4;return function(_0xb0ea1){logger[_0xad74('0x2c')](_0xb0ea1['stack']);if(_0xb0ea1[_0xad74('0x2d')]){delete _0xb0ea1[_0xad74('0x2d')];}_0x37e1bb[_0xad74('0x1d')](_0x486613)[_0xad74('0x2e')](_0xb0ea1);};}exports['index']=function(_0x40a13c,_0x9f9390){var _0x281ced={},_0xb6ce0={},_0x3277b8={'count':0x0,'rows':[]};var _0x4ffd18=_[_0xad74('0x2f')](db[_0xad74('0x30')]['rawAttributes'],function(_0x83e6c8){return{'name':_0x83e6c8[_0xad74('0x31')],'type':_0x83e6c8[_0xad74('0x32')][_0xad74('0x33')]};});_0xb6ce0['model']=_[_0xad74('0x2f')](_0x4ffd18,_0xad74('0x2d'));_0xb6ce0[_0xad74('0x34')]=_[_0xad74('0x35')](_0x40a13c[_0xad74('0x34')]);_0xb6ce0[_0xad74('0x36')]=_[_0xad74('0x37')](_0xb6ce0[_0xad74('0x38')],_0xb6ce0[_0xad74('0x34')]);_0x281ced[_0xad74('0x39')]=_[_0xad74('0x37')](_0xb6ce0[_0xad74('0x38')],qs[_0xad74('0x3a')](_0x40a13c[_0xad74('0x34')][_0xad74('0x3a')]));_0x281ced[_0xad74('0x39')]=_0x281ced[_0xad74('0x39')][_0xad74('0x3b')]?_0x281ced['attributes']:_0xb6ce0['model'];if(!_0x40a13c[_0xad74('0x34')][_0xad74('0x3c')]('nolimit')){_0x281ced[_0xad74('0x20')]=qs[_0xad74('0x20')](_0x40a13c[_0xad74('0x34')][_0xad74('0x20')]);_0x281ced[_0xad74('0x22')]=qs[_0xad74('0x22')](_0x40a13c['query'][_0xad74('0x22')]);}_0x281ced[_0xad74('0x3d')]=qs[_0xad74('0x3e')](_0x40a13c[_0xad74('0x34')][_0xad74('0x3e')]);_0x281ced[_0xad74('0x3f')]=qs[_0xad74('0x36')](_[_0xad74('0x40')](_0x40a13c[_0xad74('0x34')],_0xb6ce0[_0xad74('0x36')]),_0x4ffd18);if(_0x40a13c[_0xad74('0x34')][_0xad74('0x41')]){_0x281ced['where']=_['merge'](_0x281ced[_0xad74('0x3f')],{'$or':_[_0xad74('0x2f')](_0x4ffd18,function(_0x191b87){if(_0x191b87['type']!==_0xad74('0x42')){var _0x8a4584={};_0x8a4584[_0x191b87[_0xad74('0x2d')]]={'$like':'%'+_0x40a13c[_0xad74('0x34')][_0xad74('0x41')]+'%'};return _0x8a4584;}})});}_0x281ced=_['merge']({},_0x281ced,_0x40a13c['options']);var _0xdca954={'where':_0x281ced['where']};return db['VoiceChanSpy'][_0xad74('0x21')](_0xdca954)[_0xad74('0x28')](function(_0x65c4a5){_0x3277b8[_0xad74('0x21')]=_0x65c4a5;if(_0x40a13c[_0xad74('0x34')][_0xad74('0x43')]){_0x281ced[_0xad74('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x281ced);})[_0xad74('0x28')](function(_0x310941){_0x3277b8['rows']=_0x310941;return _0x3277b8;})[_0xad74('0x28')](respondWithFilteredResult(_0x9f9390,_0x281ced))[_0xad74('0x45')](handleError(_0x9f9390,null));};exports[_0xad74('0x46')]=function(_0x2d13de,_0x4f475f){var _0x10315b={'raw':![],'where':{'id':_0x2d13de[_0xad74('0x47')]['id']}},_0x5d3600={};_0x5d3600[_0xad74('0x38')]=_[_0xad74('0x35')](db[_0xad74('0x30')][_0xad74('0x48')]);_0x5d3600[_0xad74('0x34')]=_[_0xad74('0x35')](_0x2d13de[_0xad74('0x34')]);_0x5d3600[_0xad74('0x36')]=_[_0xad74('0x37')](_0x5d3600[_0xad74('0x38')],_0x5d3600[_0xad74('0x34')]);_0x10315b['attributes']=_[_0xad74('0x37')](_0x5d3600['model'],qs[_0xad74('0x3a')](_0x2d13de[_0xad74('0x34')][_0xad74('0x3a')]));_0x10315b[_0xad74('0x39')]=_0x10315b['attributes'][_0xad74('0x3b')]?_0x10315b['attributes']:_0x5d3600[_0xad74('0x38')];if(_0x2d13de[_0xad74('0x34')][_0xad74('0x43')]){_0x10315b[_0xad74('0x44')]=[{'all':!![]}];}_0x10315b=_[_0xad74('0x49')]({},_0x10315b,_0x2d13de[_0xad74('0x4a')]);return db[_0xad74('0x30')][_0xad74('0x4b')](_0x10315b)['then'](handleEntityNotFound(_0x4f475f,null))[_0xad74('0x28')](respondWithResult(_0x4f475f,null))[_0xad74('0x45')](handleError(_0x4f475f,null));};exports[_0xad74('0x4c')]=function(_0x4d4d3b,_0x569eb8){return db['VoiceChanSpy']['create'](_0x4d4d3b[_0xad74('0x4d')],{})[_0xad74('0x28')](function(_0x29fd0d){var _0x56899f=_0x4d4d3b['user'][_0xad74('0x4e')]({'plain':!![]});if(!_0x56899f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56899f[_0xad74('0x4f')]===_0xad74('0x50')){var _0x3b20ca=_0x29fd0d[_0xad74('0x4e')]({'plain':!![]});var _0xd7a2b='ChanSpies';return db[_0xad74('0x51')][_0xad74('0x4b')]({'where':{'name':_0xd7a2b,'userProfileId':_0x56899f[_0xad74('0x52')]},'raw':!![]})[_0xad74('0x28')](function(_0x1fa7fb){if(_0x1fa7fb&&_0x1fa7fb['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3b20ca['name'],'resourceId':_0x3b20ca['id'],'type':_0x1fa7fb[_0xad74('0x2d')],'sectionId':_0x1fa7fb['id']},{})['then'](function(){return _0x29fd0d;});}else{return _0x29fd0d;}})[_0xad74('0x45')](function(_0x1c975a){logger[_0xad74('0x2c')](_0xad74('0x53'),_0x1c975a);throw _0x1c975a;});}return _0x29fd0d;})[_0xad74('0x28')](respondWithResult(_0x569eb8,0xc9))[_0xad74('0x45')](handleError(_0x569eb8,null));};exports['update']=function(_0x1a9088,_0x2dfbee){if(_0x1a9088[_0xad74('0x4d')]['id']){delete _0x1a9088[_0xad74('0x4d')]['id'];}return db[_0xad74('0x30')]['find']({'where':{'id':_0x1a9088[_0xad74('0x47')]['id']}})[_0xad74('0x28')](handleEntityNotFound(_0x2dfbee,null))['then'](saveUpdates(_0x1a9088[_0xad74('0x4d')],null))[_0xad74('0x28')](respondWithResult(_0x2dfbee,null))[_0xad74('0x45')](handleError(_0x2dfbee,null));};exports[_0xad74('0x29')]=function(_0x1cbb80,_0x3e2164){return db['VoiceChanSpy'][_0xad74('0x4b')]({'where':{'id':_0x1cbb80[_0xad74('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e2164,null))[_0xad74('0x28')](removeEntity(_0x3e2164,null))['catch'](handleError(_0x3e2164,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index afcc64d..54e8e2a 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 _0xf6fb=['Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','bulkCreate','VoiceExtension','destroy','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xf6fb,0x111));var _0xbf6f=function(_0x1423b2,_0x37c23a){_0x1423b2=_0x1423b2-0x0;var _0x3641e5=_0xf6fb[_0x1423b2];return _0x3641e5;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xbf6f('0x0'));var attributes=require(_0xbf6f('0x1'));var getUserApplications=function(_0x48adc3,_0x270dda,_0x7191f2){var _0x5709b7=0x1;var _0xa3eb6=[];var _0x4f7bc9={'context':_0x270dda[_0xbf6f('0x2')]||_0xbf6f('0x3'),'exten':util[_0xbf6f('0x4')](_0xbf6f('0x5'),_0x48adc3[_0xbf6f('0x6')],_0x7191f2),'type':_0xbf6f('0x7'),'isApp':![],'ChanSpyId':_0x48adc3['id'],'UserId':_0x270dda['id']};_0xa3eb6[_0xbf6f('0x8')](_[_0xbf6f('0x9')]({'app':'Set','appdata':util[_0xbf6f('0x4')](_0xbf6f('0xa'),_0xbf6f('0xb')),'priority':_0x5709b7++},_0x4f7bc9));if(_0x48adc3[_0xbf6f('0xc')]){_0xa3eb6[_0xbf6f('0x8')](_['merge']({'app':'MixMonitor','appdata':util[_0xbf6f('0x4')](_0xbf6f('0xd'),_0x48adc3[_0xbf6f('0xe')]),'priority':_0x5709b7++},_0x4f7bc9));}if(_0x48adc3['auth']){_0xa3eb6[_0xbf6f('0x8')](_['merge']({'app':_0xbf6f('0xf'),'appdata':_0x48adc3[_0xbf6f('0x10')],'priority':_0x5709b7++},_0x4f7bc9));}_0xa3eb6[_0xbf6f('0x8')](_['merge']({'app':_0xbf6f('0x11'),'appdata':util[_0xbf6f('0x4')](_0xbf6f('0x12'),_0x270dda[_0xbf6f('0x13')],_0x48adc3[_0xbf6f('0x14')]?_0x48adc3[_0xbf6f('0x14')]['join'](''):''),'priority':_0x5709b7++},_0x4f7bc9));if(_0x48adc3[_0xbf6f('0xc')]){_0xa3eb6[_0xbf6f('0x8')](_[_0xbf6f('0x9')]({'app':_0xbf6f('0x15'),'priority':_0x5709b7++},_0x4f7bc9));}return _0xa3eb6;};var getChanSpyApplications=function(_0x270ec6,_0x2abe87){var _0x27f90f=[];for(var _0x586f33=0x0,_0x4b2006=0x1;_0x586f33<_0x2abe87[_0xbf6f('0x16')];_0x586f33++,_0x4b2006=0x1){_0x27f90f=_0x27f90f[_0xbf6f('0x17')](getUserApplications(_0x270ec6,_0x2abe87[_0x586f33],_0x2abe87[_0x586f33][_0xbf6f('0x18')]));if(_0x2abe87[_0x586f33]['internal']!=_0x2abe87[_0x586f33]['name']){_0x27f90f=_0x27f90f[_0xbf6f('0x17')](getUserApplications(_0x270ec6,_0x2abe87[_0x586f33],_0x2abe87[_0x586f33][_0xbf6f('0x13')]));}}return _0x27f90f;};var getChanSpyPromise=function(_0x1056f7,_0x22e1e9){return new BPromise(function(_0x18fc9d,_0x527407){return _0x1056f7['User'][_0xbf6f('0x19')]({'attributes':['id','name',_0xbf6f('0x18')],'where':{'role':_0xbf6f('0x1a'),'chanspy':!![]},'raw':!![]})[_0xbf6f('0x1b')](function(_0x4e71e9){if(_0x4e71e9){return _0x18fc9d(getChanSpyApplications(_0x22e1e9,_0x4e71e9));}return _0x18fc9d([]);})[_0xbf6f('0x1c')](function(_0x21b547){_0x527407(_0x21b547);});});};module[_0xbf6f('0x1d')]=function(_0x528bf0,_0x446857){var _0x4a370f=_0x528bf0[_0xbf6f('0x1e')];return _0x528bf0[_0xbf6f('0x1f')](_0xbf6f('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28d8f6,_0x406320,_0x29415d){return getChanSpyPromise(_0x4a370f,_0x28d8f6)[_0xbf6f('0x1b')](function(_0x44d47f){if(_0x44d47f&&_0x44d47f[_0xbf6f('0x16')]){return _0x4a370f['VoiceExtension'][_0xbf6f('0x21')](_0x44d47f);}})[_0xbf6f('0x1b')](function(){_0x29415d();})['catch'](function(_0x506302){_0x29415d(_0x506302);});},'afterUpdate':function(_0x527284,_0x246473,_0x588fbe){return _0x4a370f[_0xbf6f('0x22')][_0xbf6f('0x23')]({'where':{'ChanSpyId':_0x527284['id']}})[_0xbf6f('0x1b')](function(){return getChanSpyPromise(_0x4a370f,_0x527284);})[_0xbf6f('0x1b')](function(_0xb440e8){if(_0xb440e8&&_0xb440e8[_0xbf6f('0x16')]){return _0x4a370f[_0xbf6f('0x22')]['bulkCreate'](_0xb440e8);}})['then'](function(){_0x588fbe();})[_0xbf6f('0x1c')](function(_0x12897f){_0x588fbe(_0x12897f);});},'afterDestroy':function(_0x5db6ba,_0x1fa67c,_0x4f2430){return _0x4a370f[_0xbf6f('0x22')][_0xbf6f('0x23')]({'where':{'ChanSpyId':_0x5db6ba['id']}})[_0xbf6f('0x1b')](function(){_0x4f2430();})[_0xbf6f('0x1c')](function(_0x37bf96){_0x4f2430(_0x37bf96);});}}});}; \ No newline at end of file +var _0x65b3=['internal','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','system','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','name','options','join','StopMixMonitor','length','concat'];(function(_0x4c53c1,_0x493f72){var _0x3fce3f=function(_0x405f1d){while(--_0x405f1d){_0x4c53c1['push'](_0x4c53c1['shift']());}};_0x3fce3f(++_0x493f72);}(_0x65b3,0xc6));var _0x365b=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x65b3[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x365b('0x0'));var util=require(_0x365b('0x1'));var BPromise=require(_0x365b('0x2'));var attributes=require(_0x365b('0x3'));var getUserApplications=function(_0x2ea7a9,_0x86c875,_0x4b0b05){var _0x46fcf2=0x1;var _0x386c02=[];var _0x44ced6={'context':_0x86c875['context']||_0x365b('0x4'),'exten':util[_0x365b('0x5')](_0x365b('0x6'),_0x2ea7a9['prefix'],_0x4b0b05),'type':_0x365b('0x7'),'isApp':![],'ChanSpyId':_0x2ea7a9['id'],'UserId':_0x86c875['id']};_0x386c02[_0x365b('0x8')](_[_0x365b('0x9')]({'app':_0x365b('0xa'),'appdata':util[_0x365b('0x5')]('CDR(type)=%s',_0x365b('0xb')),'priority':_0x46fcf2++},_0x44ced6));if(_0x2ea7a9[_0x365b('0xc')]){_0x386c02[_0x365b('0x8')](_[_0x365b('0x9')]({'app':_0x365b('0xd'),'appdata':util['format'](_0x365b('0xe'),_0x2ea7a9[_0x365b('0xf')]),'priority':_0x46fcf2++},_0x44ced6));}if(_0x2ea7a9[_0x365b('0x10')]){_0x386c02[_0x365b('0x8')](_['merge']({'app':'Authenticate','appdata':_0x2ea7a9[_0x365b('0x11')],'priority':_0x46fcf2++},_0x44ced6));}_0x386c02[_0x365b('0x8')](_[_0x365b('0x9')]({'app':'ChanSpy','appdata':util[_0x365b('0x5')]('SIP/%s,%s',_0x86c875[_0x365b('0x12')],_0x2ea7a9[_0x365b('0x13')]?_0x2ea7a9[_0x365b('0x13')][_0x365b('0x14')](''):''),'priority':_0x46fcf2++},_0x44ced6));if(_0x2ea7a9[_0x365b('0xc')]){_0x386c02[_0x365b('0x8')](_[_0x365b('0x9')]({'app':_0x365b('0x15'),'priority':_0x46fcf2++},_0x44ced6));}return _0x386c02;};var getChanSpyApplications=function(_0x1e93d9,_0x24745c){var _0xcc6110=[];for(var _0x13403b=0x0,_0x185867=0x1;_0x13403b<_0x24745c[_0x365b('0x16')];_0x13403b++,_0x185867=0x1){_0xcc6110=_0xcc6110[_0x365b('0x17')](getUserApplications(_0x1e93d9,_0x24745c[_0x13403b],_0x24745c[_0x13403b][_0x365b('0x18')]));if(_0x24745c[_0x13403b][_0x365b('0x18')]!=_0x24745c[_0x13403b][_0x365b('0x12')]){_0xcc6110=_0xcc6110[_0x365b('0x17')](getUserApplications(_0x1e93d9,_0x24745c[_0x13403b],_0x24745c[_0x13403b]['name']));}}return _0xcc6110;};var getChanSpyPromise=function(_0x1d0108,_0x5b9eea){return new BPromise(function(_0x417e8f,_0x26719a){return _0x1d0108[_0x365b('0x19')][_0x365b('0x1a')]({'attributes':['id',_0x365b('0x12'),_0x365b('0x18')],'where':{'role':_0x365b('0x1b'),'chanspy':!![]},'raw':!![]})[_0x365b('0x1c')](function(_0x33bb80){if(_0x33bb80){return _0x417e8f(getChanSpyApplications(_0x5b9eea,_0x33bb80));}return _0x417e8f([]);})[_0x365b('0x1d')](function(_0x252ff0){_0x26719a(_0x252ff0);});});};module[_0x365b('0x1e')]=function(_0x2b8122,_0x47578e){var _0xe27afd=_0x2b8122[_0x365b('0x1f')];return _0x2b8122['define'](_0x365b('0x20'),attributes,{'tableName':_0x365b('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xdf632f,_0x39ad9f,_0x265e83){return getChanSpyPromise(_0xe27afd,_0xdf632f)['then'](function(_0x31cea5){if(_0x31cea5&&_0x31cea5[_0x365b('0x16')]){return _0xe27afd[_0x365b('0x22')]['bulkCreate'](_0x31cea5);}})[_0x365b('0x1c')](function(){_0x265e83();})[_0x365b('0x1d')](function(_0x24e599){_0x265e83(_0x24e599);});},'afterUpdate':function(_0xa259b9,_0x446e55,_0x8b9b5c){return _0xe27afd[_0x365b('0x22')][_0x365b('0x23')]({'where':{'ChanSpyId':_0xa259b9['id']}})[_0x365b('0x1c')](function(){return getChanSpyPromise(_0xe27afd,_0xa259b9);})['then'](function(_0x2f79bc){if(_0x2f79bc&&_0x2f79bc['length']){return _0xe27afd[_0x365b('0x22')][_0x365b('0x24')](_0x2f79bc);}})['then'](function(){_0x8b9b5c();})[_0x365b('0x1d')](function(_0x19f06b){_0x8b9b5c(_0x19f06b);});},'afterDestroy':function(_0x32a537,_0x5a3b25,_0x5db320){return _0xe27afd[_0x365b('0x22')][_0x365b('0x23')]({'where':{'ChanSpyId':_0x32a537['id']}})[_0x365b('0x1c')](function(){_0x5db320();})[_0x365b('0x1d')](function(_0x574fd4){_0x5db320(_0x574fd4);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 597c676..bccc1c3 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 _0x96b7=['request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x684928,_0x4aa42b){var _0xfd7f5d=function(_0x19d3f7){while(--_0x19d3f7){_0x684928['push'](_0x684928['shift']());}};_0xfd7f5d(++_0x4aa42b);}(_0x96b7,0x103));var _0x796b=function(_0x4eb662,_0x540e40){_0x4eb662=_0x4eb662-0x0;var _0x2d7889=_0x96b7[_0x4eb662];return _0x2d7889;};'use strict';var _=require(_0x796b('0x0'));var util=require(_0x796b('0x1'));var moment=require(_0x796b('0x2'));var BPromise=require(_0x796b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x796b('0x4'));var db=require(_0x796b('0x5'))['db'];var utils=require(_0x796b('0x6'));var logger=require(_0x796b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x796b('0x8'));var client=jayson[_0x796b('0x9')][_0x796b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4af00f,_0x503da1,_0x50f4dd){return new BPromise(function(_0x5cb44b,_0x3db398){return client[_0x796b('0xb')](_0x4af00f,_0x50f4dd)['then'](function(_0x258b48){logger[_0x796b('0xc')](_0x796b('0xd'),_0x503da1,_0x796b('0xe'));logger[_0x796b('0xf')](_0x796b('0x10'),_0x503da1,_0x796b('0xe'),JSON[_0x796b('0x11')](_0x258b48));if(_0x258b48[_0x796b('0x12')]){if(_0x258b48[_0x796b('0x12')]['code']===0x1f4){logger[_0x796b('0x12')](_0x796b('0xd'),_0x503da1,_0x258b48[_0x796b('0x12')][_0x796b('0x13')]);return _0x3db398(_0x258b48[_0x796b('0x12')][_0x796b('0x13')]);}logger[_0x796b('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x503da1,_0x258b48[_0x796b('0x12')][_0x796b('0x13')]);return _0x5cb44b(_0x258b48['error'][_0x796b('0x13')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x503da1,_0x796b('0xe'));_0x5cb44b(_0x258b48[_0x796b('0x14')][_0x796b('0x13')]);}})['catch'](function(_0x555cdb){logger[_0x796b('0x12')](_0x796b('0xd'),_0x503da1,_0x555cdb);_0x3db398(_0x555cdb);});});} \ No newline at end of file +var _0x9008=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x182aee,_0x5a0712){var _0x18dfe3=function(_0x439244){while(--_0x439244){_0x182aee['push'](_0x182aee['shift']());}};_0x18dfe3(++_0x5a0712);}(_0x9008,0xcc));var _0x8900=function(_0x4444e4,_0x5f1462){_0x4444e4=_0x4444e4-0x0;var _0x43a887=_0x9008[_0x4444e4];return _0x43a887;};'use strict';var _=require(_0x8900('0x0'));var util=require(_0x8900('0x1'));var moment=require(_0x8900('0x2'));var BPromise=require(_0x8900('0x3'));var rs=require(_0x8900('0x4'));var fs=require('fs');var Redis=require(_0x8900('0x5'));var db=require(_0x8900('0x6'))['db'];var utils=require(_0x8900('0x7'));var logger=require('../../config/logger')(_0x8900('0x8'));var config=require(_0x8900('0x9'));var jayson=require(_0x8900('0xa'));var client=jayson[_0x8900('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40c1e7,_0x4725cc,_0x2825d0){return new BPromise(function(_0x493cf8,_0x271b96){return client[_0x8900('0xc')](_0x40c1e7,_0x2825d0)[_0x8900('0xd')](function(_0x554cc){logger[_0x8900('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x4725cc,_0x8900('0xf'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4725cc,'request\x20sent',JSON[_0x8900('0x10')](_0x554cc));if(_0x554cc['error']){if(_0x554cc[_0x8900('0x11')][_0x8900('0x12')]===0x1f4){logger[_0x8900('0x11')](_0x8900('0x13'),_0x4725cc,_0x554cc['error'][_0x8900('0x14')]);return _0x271b96(_0x554cc[_0x8900('0x11')][_0x8900('0x14')]);}logger['error'](_0x8900('0x13'),_0x4725cc,_0x554cc['error']['message']);return _0x493cf8(_0x554cc[_0x8900('0x11')][_0x8900('0x14')]);}else{logger[_0x8900('0xe')](_0x8900('0x13'),_0x4725cc,'request\x20sent');_0x493cf8(_0x554cc[_0x8900('0x15')][_0x8900('0x14')]);}})[_0x8900('0x16')](function(_0x359cee){logger[_0x8900('0x11')](_0x8900('0x13'),_0x4725cc,_0x359cee);_0x271b96(_0x359cee);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6a30ab8..5737ee1 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 _0x85b5=['show','post','put','/:id','update','delete','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85b5,0x7f));var _0x585b=function(_0x355082,_0xcc6bdc){_0x355082=_0x355082-0x0;var _0x4b9246=_0x85b5[_0x355082];return _0x4b9246;};'use strict';var multer=require(_0x585b('0x0'));var util=require(_0x585b('0x1'));var path=require('path');var timeout=require(_0x585b('0x2'));var express=require('express');var router=express[_0x585b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x585b('0x4'));var config=require('../../config/environment');var controller=require(_0x585b('0x5'));router[_0x585b('0x6')]('/',auth[_0x585b('0x7')](),controller['index']);router[_0x585b('0x6')]('/:id',auth[_0x585b('0x7')](),controller[_0x585b('0x8')]);router[_0x585b('0x9')]('/',auth[_0x585b('0x7')](),controller['create']);router[_0x585b('0xa')](_0x585b('0xb'),auth[_0x585b('0x7')](),controller[_0x585b('0xc')]);router[_0x585b('0xd')](_0x585b('0xb'),auth[_0x585b('0x7')](),controller['destroy']);module[_0x585b('0xe')]=router; \ No newline at end of file +var _0xb91a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x485bd8,_0x30530d){var _0x9540=function(_0x3e071e){while(--_0x3e071e){_0x485bd8['push'](_0x485bd8['shift']());}};_0x9540(++_0x30530d);}(_0xb91a,0xf4));var _0xab91=function(_0x3ba343,_0x4480c3){_0x3ba343=_0x3ba343-0x0;var _0x4bfa17=_0xb91a[_0x3ba343];return _0x4bfa17;};'use strict';var multer=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var path=require(_0xab91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab91('0x3')]();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0xb')]);router[_0xab91('0x9')]('/:id',auth[_0xab91('0xa')](),controller[_0xab91('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xab91('0xd')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0xf')]);router[_0xab91('0x10')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0x11')]);module[_0xab91('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 91891a4..e3fbfb7 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 _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x25ad49,_0x2a6ef7){var _0x4fea17=function(_0x5dcb01){while(--_0x5dcb01){_0x25ad49['push'](_0x25ad49['shift']());}};_0x4fea17(++_0x2a6ef7);}(_0xe14b,0x93));var _0xbe14=function(_0x591d70,_0xe828c2){_0x591d70=_0x591d70-0x0;var _0x217d3f=_0xe14b[_0x591d70];return _0x217d3f;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x13826c,_0x369668){var _0x263275=function(_0x51b04e){while(--_0x51b04e){_0x13826c['push'](_0x13826c['shift']());}};_0x263275(++_0x369668);}(_0x34e8,0x12c));var _0x834e=function(_0x320df3,_0x2222b4){_0x320df3=_0x320df3-0x0;var _0x417237=_0x34e8[_0x320df3];return _0x417237;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index f49c2e2..aec30c9 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 _0xcba2=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','update','destroy','Contexts','UserProfileResource','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','writeFileSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcba2,0xab));var _0x2cba=function(_0x1e8478,_0x1f93fb){_0x1e8478=_0x1e8478-0x0;var _0xdd6e84=_0xcba2[_0x1e8478];return _0xdd6e84;};'use strict';var emlformat=require(_0x2cba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cba('0x2'));var moment=require(_0x2cba('0x3'));var BPromise=require(_0x2cba('0x4'));var Mustache=require(_0x2cba('0x5'));var util=require('util');var path=require(_0x2cba('0x6'));var sox=require('sox');var csv=require(_0x2cba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2cba('0x8'));var _=require(_0x2cba('0x9'));var squel=require(_0x2cba('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2cba('0xb'));var toCsv=require(_0x2cba('0x7'));var querystring=require('querystring');var Papa=require(_0x2cba('0xc'));var Redis=require(_0x2cba('0xd'));var authService=require(_0x2cba('0xe'));var qs=require(_0x2cba('0xf'));var as=require(_0x2cba('0x10'));var hardwareService=require(_0x2cba('0x11'));var logger=require(_0x2cba('0x12'))(_0x2cba('0x13'));var utils=require(_0x2cba('0x14'));var config=require(_0x2cba('0x15'));var licenseUtil=require(_0x2cba('0x16'));var db=require(_0x2cba('0x17'))['db'];var jayson=require(_0x2cba('0x18'));var client=jayson[_0x2cba('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f886,_0x4681e3,_0x1bd2e7,_0x391ed4){return new BPromise(function(_0x38e4af,_0x22fe2c){var _0x17b7ac=_0x391ed4||client;return _0x17b7ac[_0x2cba('0x1a')](_0x20f886,_0x1bd2e7)[_0x2cba('0x1b')](function(_0x42a07d){logger[_0x2cba('0x1c')](_0x2cba('0x1d'),_0x4681e3,_0x2cba('0x1e'));logger[_0x2cba('0x1f')](_0x2cba('0x20'),_0x4681e3,_0x2cba('0x1e'),JSON['stringify'](_0x42a07d));if(_0x42a07d[_0x2cba('0x21')]){if(_0x42a07d[_0x2cba('0x21')]['code']===0x1f4){logger[_0x2cba('0x21')]('VoiceContext,\x20%s,\x20%s',_0x4681e3,_0x42a07d[_0x2cba('0x21')][_0x2cba('0x22')]);return _0x22fe2c(_0x42a07d[_0x2cba('0x21')][_0x2cba('0x22')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x4681e3,_0x42a07d[_0x2cba('0x21')]['message']);return _0x38e4af(_0x42a07d[_0x2cba('0x21')][_0x2cba('0x22')]);}else{logger[_0x2cba('0x1c')](_0x2cba('0x1d'),_0x4681e3,_0x2cba('0x1e'));_0x38e4af(_0x42a07d[_0x2cba('0x23')][_0x2cba('0x22')]);}})['catch'](function(_0x55ad0a){logger[_0x2cba('0x21')]('VoiceContext,\x20%s,\x20%s',_0x4681e3,_0x55ad0a);_0x22fe2c(_0x55ad0a);});});}function respondWithStatusCode(_0x3d9353,_0x540a24){_0x540a24=_0x540a24||0xcc;return function(_0x443657){if(_0x443657){return _0x3d9353[_0x2cba('0x24')](_0x540a24);}return _0x3d9353[_0x2cba('0x25')](_0x540a24)[_0x2cba('0x26')]();};}function respondWithResult(_0x28c4b4,_0x2cd0b4){_0x2cd0b4=_0x2cd0b4||0xc8;return function(_0xebfd4b){if(_0xebfd4b){return _0x28c4b4['status'](_0x2cd0b4)[_0x2cba('0x27')](_0xebfd4b);}};}function respondWithFilteredResult(_0x2f7080,_0xda25fe){return function(_0x33d50f){if(_0x33d50f){var _0x5bdd1a=typeof _0xda25fe['offset']===_0x2cba('0x28')&&typeof _0xda25fe[_0x2cba('0x29')]===_0x2cba('0x28');var _0x17620b=_0x33d50f['count'];var _0x735d36=_0x5bdd1a?0x0:_0xda25fe[_0x2cba('0x2a')];var _0x3c74bc=_0x5bdd1a?_0x33d50f[_0x2cba('0x2b')]:_0xda25fe[_0x2cba('0x2a')]+_0xda25fe[_0x2cba('0x29')];var _0x255772;if(_0x3c74bc>=_0x17620b){_0x3c74bc=_0x17620b;_0x255772=0xc8;}else{_0x255772=0xce;}_0x2f7080[_0x2cba('0x25')](_0x255772);return _0x2f7080[_0x2cba('0x2c')]('Content-Range',_0x735d36+'-'+_0x3c74bc+'/'+_0x17620b)['json'](_0x33d50f);}return null;};}function patchUpdates(_0x2abe64){return function(_0x5370c2){try{jsonpatch['apply'](_0x5370c2,_0x2abe64,!![]);}catch(_0x226324){return BPromise[_0x2cba('0x2d')](_0x226324);}return _0x5370c2['save']();};}function saveUpdates(_0x5eea4f,_0x558f46){return function(_0x23f13f){if(_0x23f13f){return _0x23f13f[_0x2cba('0x2e')](_0x5eea4f)['then'](function(_0x1c3f8f){return _0x1c3f8f;});}return null;};}function removeEntity(_0x1a5340,_0x25bea7){return function(_0x4a9782){if(_0x4a9782){return _0x4a9782[_0x2cba('0x2f')]()[_0x2cba('0x1b')](function(){var _0x30867f=_0x4a9782['get']({'plain':!![]});var _0x2eb86b=_0x2cba('0x30');return db[_0x2cba('0x31')][_0x2cba('0x2f')]({'where':{'type':_0x2eb86b,'resourceId':_0x30867f['id']}})['then'](function(){return _0x4a9782;});})[_0x2cba('0x1b')](function(){_0x1a5340['status'](0xcc)[_0x2cba('0x26')]();});}};}function handleEntityNotFound(_0x2a6979,_0x464d5d){return function(_0x93886d){if(!_0x93886d){_0x2a6979[_0x2cba('0x24')](0x194);}return _0x93886d;};}function handleError(_0x312e4a,_0x2ae982){_0x2ae982=_0x2ae982||0x1f4;return function(_0x304abd){logger['error'](_0x304abd['stack']);if(_0x304abd[_0x2cba('0x32')]){delete _0x304abd[_0x2cba('0x32')];}_0x312e4a[_0x2cba('0x25')](_0x2ae982)[_0x2cba('0x33')](_0x304abd);};}exports[_0x2cba('0x34')]=function(_0x27efbf,_0x4f4da5){var _0xc49d53={},_0x33c675={},_0x2cd2e0={'count':0x0,'rows':[]};var _0x4857e7=_['map'](db[_0x2cba('0x35')][_0x2cba('0x36')],function(_0x54a02f){return{'name':_0x54a02f[_0x2cba('0x37')],'type':_0x54a02f[_0x2cba('0x38')][_0x2cba('0x39')]};});_0x33c675[_0x2cba('0x3a')]=_[_0x2cba('0x3b')](_0x4857e7,'name');_0x33c675[_0x2cba('0x3c')]=_[_0x2cba('0x3d')](_0x27efbf[_0x2cba('0x3c')]);_0x33c675[_0x2cba('0x3e')]=_[_0x2cba('0x3f')](_0x33c675[_0x2cba('0x3a')],_0x33c675[_0x2cba('0x3c')]);_0xc49d53[_0x2cba('0x40')]=_['intersection'](_0x33c675[_0x2cba('0x3a')],qs[_0x2cba('0x41')](_0x27efbf[_0x2cba('0x3c')][_0x2cba('0x41')]));_0xc49d53[_0x2cba('0x40')]=_0xc49d53[_0x2cba('0x40')][_0x2cba('0x42')]?_0xc49d53[_0x2cba('0x40')]:_0x33c675['model'];if(!_0x27efbf[_0x2cba('0x3c')]['hasOwnProperty'](_0x2cba('0x43'))){_0xc49d53['limit']=qs[_0x2cba('0x29')](_0x27efbf['query'][_0x2cba('0x29')]);_0xc49d53[_0x2cba('0x2a')]=qs[_0x2cba('0x2a')](_0x27efbf['query'][_0x2cba('0x2a')]);}_0xc49d53[_0x2cba('0x44')]=qs[_0x2cba('0x45')](_0x27efbf[_0x2cba('0x3c')][_0x2cba('0x45')]);_0xc49d53[_0x2cba('0x46')]=qs['filters'](_[_0x2cba('0x47')](_0x27efbf[_0x2cba('0x3c')],_0x33c675[_0x2cba('0x3e')]),_0x4857e7);if(_0x27efbf[_0x2cba('0x3c')][_0x2cba('0x48')]){_0xc49d53[_0x2cba('0x46')]=_[_0x2cba('0x49')](_0xc49d53['where'],{'$or':_['map'](_0x4857e7,function(_0x45cfa4){if(_0x45cfa4[_0x2cba('0x38')]!=='VIRTUAL'){var _0x3c89aa={};_0x3c89aa[_0x45cfa4['name']]={'$like':'%'+_0x27efbf[_0x2cba('0x3c')]['filter']+'%'};return _0x3c89aa;}})});}_0xc49d53=_['merge']({},_0xc49d53,_0x27efbf[_0x2cba('0x4a')]);var _0x5e9fb2={'where':_0xc49d53[_0x2cba('0x46')]};return db[_0x2cba('0x35')][_0x2cba('0x2b')](_0x5e9fb2)['then'](function(_0x5cc036){_0x2cd2e0[_0x2cba('0x2b')]=_0x5cc036;if(_0x27efbf['query'][_0x2cba('0x4b')]){_0xc49d53['include']=[{'all':!![]}];}return db['VoiceContext'][_0x2cba('0x4c')](_0xc49d53);})[_0x2cba('0x1b')](function(_0x13f9c8){_0x2cd2e0[_0x2cba('0x4d')]=_0x13f9c8;return _0x2cd2e0;})[_0x2cba('0x1b')](respondWithFilteredResult(_0x4f4da5,_0xc49d53))[_0x2cba('0x4e')](handleError(_0x4f4da5,null));};exports[_0x2cba('0x4f')]=function(_0xe01a95,_0x182805){var _0x4fd060={'raw':![],'where':{'id':_0xe01a95[_0x2cba('0x50')]['id']}},_0x390e34={};_0x390e34[_0x2cba('0x3a')]=_[_0x2cba('0x3d')](db[_0x2cba('0x35')]['rawAttributes']);_0x390e34['query']=_[_0x2cba('0x3d')](_0xe01a95['query']);_0x390e34[_0x2cba('0x3e')]=_['intersection'](_0x390e34[_0x2cba('0x3a')],_0x390e34['query']);_0x4fd060[_0x2cba('0x40')]=_[_0x2cba('0x3f')](_0x390e34[_0x2cba('0x3a')],qs[_0x2cba('0x41')](_0xe01a95[_0x2cba('0x3c')][_0x2cba('0x41')]));_0x4fd060[_0x2cba('0x40')]=_0x4fd060[_0x2cba('0x40')][_0x2cba('0x42')]?_0x4fd060[_0x2cba('0x40')]:_0x390e34[_0x2cba('0x3a')];if(_0xe01a95[_0x2cba('0x3c')][_0x2cba('0x4b')]){_0x4fd060[_0x2cba('0x51')]=[{'all':!![]}];}_0x4fd060=_['merge']({},_0x4fd060,_0xe01a95[_0x2cba('0x4a')]);return db[_0x2cba('0x35')][_0x2cba('0x52')](_0x4fd060)[_0x2cba('0x1b')](handleEntityNotFound(_0x182805,null))[_0x2cba('0x1b')](respondWithResult(_0x182805,null))[_0x2cba('0x4e')](handleError(_0x182805,null));};exports[_0x2cba('0x53')]=function(_0x13ac00,_0x3ec405,_0x33030a){var _0x306ac0;return db[_0x2cba('0x35')][_0x2cba('0x53')](_0x13ac00[_0x2cba('0x54')],{'raw':!![]})[_0x2cba('0x1b')](function(_0x5db609){_0x306ac0=_0x5db609;return db[_0x2cba('0x35')][_0x2cba('0x4c')]({'raw':!![]});})[_0x2cba('0x1b')](function(_0x57266d){var _0x5c49a2=fs[_0x2cba('0x55')](path[_0x2cba('0x56')](config[_0x2cba('0x57')],_0x2cba('0x58')),_0x2cba('0x59'));var _0x4537ea=ejs['render'](_0x5c49a2,{'contexts':_0x57266d||[]});fs['writeFileSync'](_0x2cba('0x5a'),_0x4537ea);})['then'](function(){return respondWithRpcPromise(_0x2cba('0x5b'),_0x2cba('0x53'),{'module':_0x2cba('0x5c')});})['then'](function(){var _0x49dfaf=_0x13ac00['user'][_0x2cba('0x5d')]({'plain':!![]});if(!_0x49dfaf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49dfaf[_0x2cba('0x5e')]==='user'){var _0x3bb625=_0x306ac0['get']({'plain':!![]});return db[_0x2cba('0x5f')][_0x2cba('0x52')]({'where':{'name':_0x2cba('0x30'),'userProfileId':_0x49dfaf[_0x2cba('0x60')]},'raw':!![]})[_0x2cba('0x1b')](function(_0x491afe){if(_0x491afe&&_0x491afe[_0x2cba('0x61')]===0x0){return db[_0x2cba('0x31')]['create']({'name':_0x3bb625[_0x2cba('0x32')],'resourceId':_0x3bb625['id'],'type':_0x491afe[_0x2cba('0x32')],'sectionId':_0x491afe['id']},{})[_0x2cba('0x1b')](function(){return _0x306ac0;});}else{return _0x306ac0;}})['catch'](function(_0x896e62){logger[_0x2cba('0x21')](_0x2cba('0x62'),_0x896e62);throw _0x896e62;});}return _0x306ac0;})[_0x2cba('0x1b')](respondWithResult(_0x3ec405,0xc9))[_0x2cba('0x4e')](handleError(_0x3ec405,null));};exports[_0x2cba('0x2e')]=function(_0x221f08,_0x3282f9,_0x83309a){var _0x4f141d;return db[_0x2cba('0x35')][_0x2cba('0x52')]({'where':{'id':_0x221f08['params']['id']}})['then'](handleEntityNotFound(_0x3282f9,null))[_0x2cba('0x1b')](saveUpdates(_0x221f08[_0x2cba('0x54')],null))[_0x2cba('0x1b')](function(_0x5f562c){if(_0x5f562c){_0x4f141d=_0x5f562c;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x3069c9){var _0x2bb303=fs[_0x2cba('0x55')](path[_0x2cba('0x56')](config[_0x2cba('0x57')],_0x2cba('0x58')),_0x2cba('0x59'));var _0x30de1c=ejs['render'](_0x2bb303,{'contexts':_0x3069c9||[]});fs[_0x2cba('0x63')](_0x2cba('0x5a'),_0x30de1c);})[_0x2cba('0x1b')](function(){return respondWithRpcPromise('Reload',_0x2cba('0x2e'),{'module':_0x2cba('0x5c')});})['then'](function(){return _0x4f141d;})[_0x2cba('0x1b')](respondWithResult(_0x3282f9,null))[_0x2cba('0x4e')](handleError(_0x3282f9,null));};exports['destroy']=function(_0x4375d6,_0x127bcd,_0x444f2a){var _0x1567b0;return db['VoiceContext'][_0x2cba('0x52')]({'where':{'id':_0x4375d6[_0x2cba('0x50')]['id']}})[_0x2cba('0x1b')](handleEntityNotFound(_0x127bcd,null))[_0x2cba('0x1b')](removeEntity(_0x127bcd,null))[_0x2cba('0x1b')](function(){return db[_0x2cba('0x35')][_0x2cba('0x4c')]({'raw':!![]});})[_0x2cba('0x1b')](function(_0x2a5f1a){var _0x6c698a=fs['readFileSync'](path[_0x2cba('0x56')](config[_0x2cba('0x57')],_0x2cba('0x58')),_0x2cba('0x59'));var _0x4a6d5a=ejs['render'](_0x6c698a,{'contexts':_0x2a5f1a});fs[_0x2cba('0x63')](_0x2cba('0x5a'),_0x4a6d5a);return respondWithRpcPromise(_0x2cba('0x5b'),_0x2cba('0x2f'),{'module':_0x2cba('0x5c')});})[_0x2cba('0x4e')](handleError(_0x127bcd,null));}; \ No newline at end of file +var _0x9894=['count','limit','status','set','Content-Range','save','update','then','destroy','get','stack','name','send','index','VoiceContext','rawAttributes','fieldName','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','rows','catch','includeAll','include','options','create','findAll','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','utf8','writeFileSync','Reload','readFileSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','end','json','offset','undefined'];(function(_0x1e7554,_0xfc8613){var _0xf029c3=function(_0x3c7a50){while(--_0x3c7a50){_0x1e7554['push'](_0x1e7554['shift']());}};_0xf029c3(++_0xfc8613);}(_0x9894,0xa2));var _0x4989=function(_0xecd2fe,_0x44544e){_0xecd2fe=_0xecd2fe-0x0;var _0x86a786=_0x9894[_0xecd2fe];return _0x86a786;};'use strict';var emlformat=require(_0x4989('0x0'));var rimraf=require(_0x4989('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4989('0x2'));var rp=require('request-promise');var moment=require(_0x4989('0x3'));var BPromise=require(_0x4989('0x4'));var Mustache=require(_0x4989('0x5'));var util=require('util');var path=require(_0x4989('0x6'));var sox=require('sox');var csv=require(_0x4989('0x7'));var ejs=require(_0x4989('0x8'));var fs=require('fs');var fs_extra=require(_0x4989('0x9'));var _=require(_0x4989('0xa'));var squel=require('squel');var crypto=require(_0x4989('0xb'));var jsforce=require(_0x4989('0xc'));var deskjs=require(_0x4989('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4989('0xe'));var qs=require(_0x4989('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4989('0x10'));var logger=require('../../config/logger')(_0x4989('0x11'));var utils=require(_0x4989('0x12'));var config=require(_0x4989('0x13'));var licenseUtil=require(_0x4989('0x14'));var db=require(_0x4989('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4989('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1349f8,_0x55b8fc,_0xc0bc9c,_0x38864f){return new BPromise(function(_0x3a2298,_0x4260b0){var _0x28bfb0=_0x38864f||client;return _0x28bfb0[_0x4989('0x17')](_0x1349f8,_0xc0bc9c)['then'](function(_0xcf31db){logger[_0x4989('0x18')](_0x4989('0x19'),_0x55b8fc,'request\x20sent');logger[_0x4989('0x1a')](_0x4989('0x1b'),_0x55b8fc,_0x4989('0x1c'),JSON[_0x4989('0x1d')](_0xcf31db));if(_0xcf31db[_0x4989('0x1e')]){if(_0xcf31db[_0x4989('0x1e')][_0x4989('0x1f')]===0x1f4){logger[_0x4989('0x1e')](_0x4989('0x19'),_0x55b8fc,_0xcf31db[_0x4989('0x1e')][_0x4989('0x20')]);return _0x4260b0(_0xcf31db['error'][_0x4989('0x20')]);}logger[_0x4989('0x1e')](_0x4989('0x19'),_0x55b8fc,_0xcf31db['error'][_0x4989('0x20')]);return _0x3a2298(_0xcf31db[_0x4989('0x1e')][_0x4989('0x20')]);}else{logger['info'](_0x4989('0x19'),_0x55b8fc,_0x4989('0x1c'));_0x3a2298(_0xcf31db['result']['message']);}})['catch'](function(_0x38e25d){logger[_0x4989('0x1e')](_0x4989('0x19'),_0x55b8fc,_0x38e25d);_0x4260b0(_0x38e25d);});});}function respondWithStatusCode(_0x383693,_0x449c62){_0x449c62=_0x449c62||0xcc;return function(_0x118dba){if(_0x118dba){return _0x383693[_0x4989('0x21')](_0x449c62);}return _0x383693['status'](_0x449c62)[_0x4989('0x22')]();};}function respondWithResult(_0x377617,_0x495876){_0x495876=_0x495876||0xc8;return function(_0x4492aa){if(_0x4492aa){return _0x377617['status'](_0x495876)[_0x4989('0x23')](_0x4492aa);}};}function respondWithFilteredResult(_0x4d349e,_0x34f86d){return function(_0x59d338){if(_0x59d338){var _0x45b80e=typeof _0x34f86d[_0x4989('0x24')]===_0x4989('0x25')&&typeof _0x34f86d['limit']===_0x4989('0x25');var _0x480f9f=_0x59d338['count'];var _0x370a3e=_0x45b80e?0x0:_0x34f86d[_0x4989('0x24')];var _0x885958=_0x45b80e?_0x59d338[_0x4989('0x26')]:_0x34f86d[_0x4989('0x24')]+_0x34f86d[_0x4989('0x27')];var _0x384344;if(_0x885958>=_0x480f9f){_0x885958=_0x480f9f;_0x384344=0xc8;}else{_0x384344=0xce;}_0x4d349e[_0x4989('0x28')](_0x384344);return _0x4d349e[_0x4989('0x29')](_0x4989('0x2a'),_0x370a3e+'-'+_0x885958+'/'+_0x480f9f)[_0x4989('0x23')](_0x59d338);}return null;};}function patchUpdates(_0x42970d){return function(_0x5a1057){try{jsonpatch['apply'](_0x5a1057,_0x42970d,!![]);}catch(_0x48ecf6){return BPromise['reject'](_0x48ecf6);}return _0x5a1057[_0x4989('0x2b')]();};}function saveUpdates(_0x4fa5f3,_0x17a629){return function(_0xd59039){if(_0xd59039){return _0xd59039[_0x4989('0x2c')](_0x4fa5f3)[_0x4989('0x2d')](function(_0x514b05){return _0x514b05;});}return null;};}function removeEntity(_0x1c2576,_0x733275){return function(_0x416103){if(_0x416103){return _0x416103[_0x4989('0x2e')]()[_0x4989('0x2d')](function(){var _0x371a56=_0x416103[_0x4989('0x2f')]({'plain':!![]});var _0xbf18ff='Contexts';return db['UserProfileResource'][_0x4989('0x2e')]({'where':{'type':_0xbf18ff,'resourceId':_0x371a56['id']}})[_0x4989('0x2d')](function(){return _0x416103;});})[_0x4989('0x2d')](function(){_0x1c2576[_0x4989('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2112bf,_0x1471d0){return function(_0x443929){if(!_0x443929){_0x2112bf['sendStatus'](0x194);}return _0x443929;};}function handleError(_0x51dd73,_0x228066){_0x228066=_0x228066||0x1f4;return function(_0x2e3ed7){logger[_0x4989('0x1e')](_0x2e3ed7[_0x4989('0x30')]);if(_0x2e3ed7[_0x4989('0x31')]){delete _0x2e3ed7[_0x4989('0x31')];}_0x51dd73[_0x4989('0x28')](_0x228066)[_0x4989('0x32')](_0x2e3ed7);};}exports[_0x4989('0x33')]=function(_0x313c41,_0x28319c){var _0x54a0b9={},_0x4ccb0f={},_0x910e6={'count':0x0,'rows':[]};var _0x5a2bea=_['map'](db[_0x4989('0x34')][_0x4989('0x35')],function(_0x562021){return{'name':_0x562021[_0x4989('0x36')],'type':_0x562021['type']['key']};});_0x4ccb0f['model']=_[_0x4989('0x37')](_0x5a2bea,_0x4989('0x31'));_0x4ccb0f[_0x4989('0x38')]=_[_0x4989('0x39')](_0x313c41['query']);_0x4ccb0f[_0x4989('0x3a')]=_[_0x4989('0x3b')](_0x4ccb0f[_0x4989('0x3c')],_0x4ccb0f[_0x4989('0x38')]);_0x54a0b9['attributes']=_[_0x4989('0x3b')](_0x4ccb0f['model'],qs[_0x4989('0x3d')](_0x313c41[_0x4989('0x38')][_0x4989('0x3d')]));_0x54a0b9['attributes']=_0x54a0b9[_0x4989('0x3e')]['length']?_0x54a0b9[_0x4989('0x3e')]:_0x4ccb0f[_0x4989('0x3c')];if(!_0x313c41[_0x4989('0x38')][_0x4989('0x3f')](_0x4989('0x40'))){_0x54a0b9[_0x4989('0x27')]=qs[_0x4989('0x27')](_0x313c41[_0x4989('0x38')][_0x4989('0x27')]);_0x54a0b9[_0x4989('0x24')]=qs[_0x4989('0x24')](_0x313c41[_0x4989('0x38')][_0x4989('0x24')]);}_0x54a0b9[_0x4989('0x41')]=qs[_0x4989('0x42')](_0x313c41[_0x4989('0x38')]['sort']);_0x54a0b9[_0x4989('0x43')]=qs[_0x4989('0x3a')](_['pick'](_0x313c41['query'],_0x4ccb0f[_0x4989('0x3a')]),_0x5a2bea);if(_0x313c41[_0x4989('0x38')][_0x4989('0x44')]){_0x54a0b9[_0x4989('0x43')]=_['merge'](_0x54a0b9[_0x4989('0x43')],{'$or':_[_0x4989('0x37')](_0x5a2bea,function(_0x5ec22c){if(_0x5ec22c[_0x4989('0x45')]!==_0x4989('0x46')){var _0x32a5a3={};_0x32a5a3[_0x5ec22c[_0x4989('0x31')]]={'$like':'%'+_0x313c41[_0x4989('0x38')][_0x4989('0x44')]+'%'};return _0x32a5a3;}})});}_0x54a0b9=_[_0x4989('0x47')]({},_0x54a0b9,_0x313c41['options']);var _0x5bdbfa={'where':_0x54a0b9[_0x4989('0x43')]};return db[_0x4989('0x34')]['count'](_0x5bdbfa)['then'](function(_0x2acf4b){_0x910e6[_0x4989('0x26')]=_0x2acf4b;if(_0x313c41[_0x4989('0x38')]['includeAll']){_0x54a0b9['include']=[{'all':!![]}];}return db[_0x4989('0x34')]['findAll'](_0x54a0b9);})['then'](function(_0x3e04e4){_0x910e6[_0x4989('0x48')]=_0x3e04e4;return _0x910e6;})[_0x4989('0x2d')](respondWithFilteredResult(_0x28319c,_0x54a0b9))[_0x4989('0x49')](handleError(_0x28319c,null));};exports['show']=function(_0x572b1f,_0x566ad5){var _0x44cc41={'raw':![],'where':{'id':_0x572b1f['params']['id']}},_0x9259d0={};_0x9259d0['model']=_[_0x4989('0x39')](db[_0x4989('0x34')][_0x4989('0x35')]);_0x9259d0[_0x4989('0x38')]=_[_0x4989('0x39')](_0x572b1f['query']);_0x9259d0[_0x4989('0x3a')]=_['intersection'](_0x9259d0['model'],_0x9259d0[_0x4989('0x38')]);_0x44cc41[_0x4989('0x3e')]=_[_0x4989('0x3b')](_0x9259d0[_0x4989('0x3c')],qs[_0x4989('0x3d')](_0x572b1f['query'][_0x4989('0x3d')]));_0x44cc41['attributes']=_0x44cc41[_0x4989('0x3e')]['length']?_0x44cc41[_0x4989('0x3e')]:_0x9259d0[_0x4989('0x3c')];if(_0x572b1f[_0x4989('0x38')][_0x4989('0x4a')]){_0x44cc41[_0x4989('0x4b')]=[{'all':!![]}];}_0x44cc41=_[_0x4989('0x47')]({},_0x44cc41,_0x572b1f[_0x4989('0x4c')]);return db[_0x4989('0x34')]['find'](_0x44cc41)['then'](handleEntityNotFound(_0x566ad5,null))[_0x4989('0x2d')](respondWithResult(_0x566ad5,null))['catch'](handleError(_0x566ad5,null));};exports['create']=function(_0x2d18ab,_0x5db000,_0x3a47ab){var _0x94f8a8;return db['VoiceContext'][_0x4989('0x4d')](_0x2d18ab['body'],{'raw':!![]})[_0x4989('0x2d')](function(_0x1168ac){_0x94f8a8=_0x1168ac;return db[_0x4989('0x34')][_0x4989('0x4e')]({'raw':!![]});})[_0x4989('0x2d')](function(_0xfe901d){var _0x399643=fs['readFileSync'](path[_0x4989('0x4f')](config[_0x4989('0x50')],_0x4989('0x51')),'utf8');var _0x115246=ejs[_0x4989('0x52')](_0x399643,{'contexts':_0xfe901d||[]});fs['writeFileSync'](_0x4989('0x53'),_0x115246);})[_0x4989('0x2d')](function(){return respondWithRpcPromise('Reload',_0x4989('0x4d'),{'module':_0x4989('0x54')});})[_0x4989('0x2d')](function(){var _0xacd267=_0x2d18ab[_0x4989('0x55')][_0x4989('0x2f')]({'plain':!![]});if(!_0xacd267)throw new Error(_0x4989('0x56'));if(_0xacd267[_0x4989('0x57')]===_0x4989('0x55')){var _0x46eb17=_0x94f8a8[_0x4989('0x2f')]({'plain':!![]});return db['UserProfileSection'][_0x4989('0x58')]({'where':{'name':_0x4989('0x59'),'userProfileId':_0xacd267[_0x4989('0x5a')]},'raw':!![]})['then'](function(_0x3ec490){if(_0x3ec490&&_0x3ec490[_0x4989('0x5b')]===0x0){return db[_0x4989('0x5c')][_0x4989('0x4d')]({'name':_0x46eb17[_0x4989('0x31')],'resourceId':_0x46eb17['id'],'type':_0x3ec490['name'],'sectionId':_0x3ec490['id']},{})[_0x4989('0x2d')](function(){return _0x94f8a8;});}else{return _0x94f8a8;}})[_0x4989('0x49')](function(_0x3e3817){logger[_0x4989('0x1e')](_0x4989('0x5d'),_0x3e3817);throw _0x3e3817;});}return _0x94f8a8;})[_0x4989('0x2d')](respondWithResult(_0x5db000,0xc9))[_0x4989('0x49')](handleError(_0x5db000,null));};exports[_0x4989('0x2c')]=function(_0x33951b,_0x13732a,_0x1076d3){var _0x5ccded;return db[_0x4989('0x34')][_0x4989('0x58')]({'where':{'id':_0x33951b[_0x4989('0x5e')]['id']}})[_0x4989('0x2d')](handleEntityNotFound(_0x13732a,null))[_0x4989('0x2d')](saveUpdates(_0x33951b[_0x4989('0x5f')],null))[_0x4989('0x2d')](function(_0x3f69c2){if(_0x3f69c2){_0x5ccded=_0x3f69c2;return db['VoiceContext'][_0x4989('0x4e')]({'raw':!![]});}})['then'](function(_0x3a7ce6){var _0x3b40c8=fs['readFileSync'](path[_0x4989('0x4f')](config[_0x4989('0x50')],'server/files/templates/context.ejs'),_0x4989('0x60'));var _0x3b961b=ejs[_0x4989('0x52')](_0x3b40c8,{'contexts':_0x3a7ce6||[]});fs[_0x4989('0x61')](_0x4989('0x53'),_0x3b961b);})[_0x4989('0x2d')](function(){return respondWithRpcPromise(_0x4989('0x62'),_0x4989('0x2c'),{'module':'chan_sip.so'});})['then'](function(){return _0x5ccded;})[_0x4989('0x2d')](respondWithResult(_0x13732a,null))[_0x4989('0x49')](handleError(_0x13732a,null));};exports['destroy']=function(_0x4779a0,_0x4faa72,_0x2e3db7){var _0x18ecc5;return db['VoiceContext'][_0x4989('0x58')]({'where':{'id':_0x4779a0[_0x4989('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4faa72,null))[_0x4989('0x2d')](removeEntity(_0x4faa72,null))[_0x4989('0x2d')](function(){return db['VoiceContext'][_0x4989('0x4e')]({'raw':!![]});})[_0x4989('0x2d')](function(_0x4c1913){var _0x13785e=fs[_0x4989('0x63')](path[_0x4989('0x4f')](config[_0x4989('0x50')],_0x4989('0x51')),_0x4989('0x60'));var _0x2f13b0=ejs['render'](_0x13785e,{'contexts':_0x4c1913});fs['writeFileSync'](_0x4989('0x53'),_0x2f13b0);return respondWithRpcPromise(_0x4989('0x62'),'destroy',{'module':_0x4989('0x54')});})[_0x4989('0x49')](handleError(_0x4faa72,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 519132d..276788c 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 _0x1370=['path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1370,0x7f));var _0x0137=function(_0x48e921,_0x20cf98){_0x48e921=_0x48e921-0x0;var _0x4986fe=_0x1370[_0x48e921];return _0x4986fe;};'use strict';var _=require(_0x0137('0x0'));var util=require(_0x0137('0x1'));var logger=require('../../config/logger')(_0x0137('0x2'));var moment=require(_0x0137('0x3'));var BPromise=require(_0x0137('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0137('0x5'));var rimraf=require(_0x0137('0x6'));var config=require(_0x0137('0x7'));var attributes=require('./voiceContext.attributes');module[_0x0137('0x8')]=function(_0x33afbf,_0x1c9d9d){return _0x33afbf[_0x0137('0x9')](_0x0137('0xa'),attributes,{'tableName':_0x0137('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3088=['api','moment','rimraf','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x1f5b15,_0x1b25e6){var _0x248b56=function(_0x4f013b){while(--_0x4f013b){_0x1f5b15['push'](_0x1f5b15['shift']());}};_0x248b56(++_0x1b25e6);}(_0x3088,0x96));var _0x8308=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x3088[_0x95942];return _0x6d7f81;};'use strict';var _=require(_0x8308('0x0'));var util=require(_0x8308('0x1'));var logger=require(_0x8308('0x2'))(_0x8308('0x3'));var moment=require(_0x8308('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8308('0x5'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x8308('0x6')]=function(_0x201b51,_0x55944c){return _0x201b51['define'](_0x8308('0x7'),attributes,{'tableName':_0x8308('0x8'),'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 88e9546..b5870b2 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 _0xcf92=['debug','stringify','code','error','message','request\x20sent','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x2e8439,_0x495d09){var _0x59aa31=function(_0x2e4b73){while(--_0x2e4b73){_0x2e8439['push'](_0x2e8439['shift']());}};_0x59aa31(++_0x495d09);}(_0xcf92,0x182));var _0x2cf9=function(_0x3111fe,_0xf74d28){_0x3111fe=_0x3111fe-0x0;var _0x93887c=_0xcf92[_0x3111fe];return _0x93887c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2cf9('0x0'));var BPromise=require('bluebird');var rs=require(_0x2cf9('0x1'));var fs=require('fs');var Redis=require(_0x2cf9('0x2'));var db=require(_0x2cf9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cf9('0x4'))('rpc');var config=require(_0x2cf9('0x5'));var jayson=require(_0x2cf9('0x6'));var client=jayson[_0x2cf9('0x7')][_0x2cf9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a1d51,_0x3dc6c2,_0x4cf34c){return new BPromise(function(_0x271834,_0x422411){return client[_0x2cf9('0x9')](_0x5a1d51,_0x4cf34c)[_0x2cf9('0xa')](function(_0x322f7a){logger[_0x2cf9('0xb')](_0x2cf9('0xc'),_0x3dc6c2,'request\x20sent');logger[_0x2cf9('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3dc6c2,'request\x20sent',JSON[_0x2cf9('0xe')](_0x322f7a));if(_0x322f7a['error']){if(_0x322f7a['error'][_0x2cf9('0xf')]===0x1f4){logger['error'](_0x2cf9('0xc'),_0x3dc6c2,_0x322f7a[_0x2cf9('0x10')][_0x2cf9('0x11')]);return _0x422411(_0x322f7a[_0x2cf9('0x10')][_0x2cf9('0x11')]);}logger[_0x2cf9('0x10')](_0x2cf9('0xc'),_0x3dc6c2,_0x322f7a[_0x2cf9('0x10')][_0x2cf9('0x11')]);return _0x271834(_0x322f7a[_0x2cf9('0x10')][_0x2cf9('0x11')]);}else{logger[_0x2cf9('0xb')](_0x2cf9('0xc'),_0x3dc6c2,_0x2cf9('0x12'));_0x271834(_0x322f7a['result'][_0x2cf9('0x11')]);}})['catch'](function(_0x5e9713){logger[_0x2cf9('0x10')](_0x2cf9('0xc'),_0x3dc6c2,_0x5e9713);_0x422411(_0x5e9713);});});} \ No newline at end of file +var _0xa941=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','info','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xa941,0x15e));var _0x1a94=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa941[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x1a94('0x0'));var moment=require(_0x1a94('0x1'));var BPromise=require(_0x1a94('0x2'));var rs=require(_0x1a94('0x3'));var fs=require('fs');var Redis=require(_0x1a94('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a94('0x5'));var config=require(_0x1a94('0x6'));var jayson=require(_0x1a94('0x7'));var client=jayson[_0x1a94('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144396,_0x46c7cb,_0x571c96){return new BPromise(function(_0xf221fc,_0x3b2f50){return client[_0x1a94('0x9')](_0x144396,_0x571c96)['then'](function(_0xa6e7c8){logger['info'](_0x1a94('0xa'),_0x46c7cb,_0x1a94('0xb'));logger[_0x1a94('0xc')](_0x1a94('0xd'),_0x46c7cb,'request\x20sent',JSON[_0x1a94('0xe')](_0xa6e7c8));if(_0xa6e7c8[_0x1a94('0xf')]){if(_0xa6e7c8[_0x1a94('0xf')]['code']===0x1f4){logger['error'](_0x1a94('0xa'),_0x46c7cb,_0xa6e7c8[_0x1a94('0xf')][_0x1a94('0x10')]);return _0x3b2f50(_0xa6e7c8['error'][_0x1a94('0x10')]);}logger[_0x1a94('0xf')](_0x1a94('0xa'),_0x46c7cb,_0xa6e7c8[_0x1a94('0xf')]['message']);return _0xf221fc(_0xa6e7c8[_0x1a94('0xf')][_0x1a94('0x10')]);}else{logger[_0x1a94('0x11')](_0x1a94('0xa'),_0x46c7cb,'request\x20sent');_0xf221fc(_0xa6e7c8['result']['message']);}})['catch'](function(_0x41a314){logger['error'](_0x1a94('0xa'),_0x46c7cb,_0x41a314);_0x3b2f50(_0x41a314);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 27dd4cd..44278e1 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 _0xcb99=['create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x295c11,_0x54b9e0){var _0xe56efc=function(_0x56d07d){while(--_0x56d07d){_0x295c11['push'](_0x295c11['shift']());}};_0xe56efc(++_0x54b9e0);}(_0xcb99,0x8b));var _0x9cb9=function(_0x3a23c1,_0x495d49){_0x3a23c1=_0x3a23c1-0x0;var _0x286863=_0xcb99[_0x3a23c1];return _0x286863;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);router[_0x9cb9('0xe')](_0x9cb9('0xb'),auth['isAuthenticated'](),controller[_0x9cb9('0xf')]);router[_0x9cb9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x11')]);module[_0x9cb9('0x12')]=router; \ No newline at end of file +var _0xb903=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','describe','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1acc2e,_0x42f2a2){var _0x23976d=function(_0x4204b1){while(--_0x4204b1){_0x1acc2e['push'](_0x1acc2e['shift']());}};_0x23976d(++_0x42f2a2);}(_0xb903,0x185));var _0x3b90=function(_0x10b051,_0x301d48){_0x10b051=_0x10b051-0x0;var _0x4d21cc=_0xb903[_0x10b051];return _0x4d21cc;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/describe',auth[_0x3b90('0xc')](),controller[_0x3b90('0xd')]);router[_0x3b90('0xa')](_0x3b90('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3b90('0xe'),auth[_0x3b90('0xc')](),controller['update']);router[_0x3b90('0xf')](_0x3b90('0xe'),auth['isAuthenticated'](),controller[_0x3b90('0x10')]);module[_0x3b90('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8c115b4..38636e4 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 _0x0397=['DATE','sequelize','exports','STRING','INTEGER'];(function(_0x2a9a95,_0x27b730){var _0x12e03b=function(_0x194548){while(--_0x194548){_0x2a9a95['push'](_0x2a9a95['shift']());}};_0x12e03b(++_0x27b730);}(_0x0397,0x169));var _0x7039=function(_0x28d231,_0x55888a){_0x28d231=_0x28d231-0x0;var _0x3814c5=_0x0397[_0x28d231];return _0x3814c5;};'use strict';var Sequelize=require(_0x7039('0x0'));module[_0x7039('0x1')]={'privilege':{'type':Sequelize[_0x7039('0x2')]},'channel':{'type':Sequelize[_0x7039('0x2')]},'channelstate':{'type':Sequelize[_0x7039('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7039('0x2')]},'calleridname':{'type':Sequelize[_0x7039('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7039('0x2')]},'connectedlinename':{'type':Sequelize[_0x7039('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7039('0x2')]},'context':{'type':Sequelize[_0x7039('0x2')]},'exten':{'type':Sequelize[_0x7039('0x2')]},'priority':{'type':Sequelize[_0x7039('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x7039('0x2')]},'destchannel':{'type':Sequelize[_0x7039('0x2')]},'destchannelstate':{'type':Sequelize[_0x7039('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7039('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7039('0x2')]},'destcalleridname':{'type':Sequelize[_0x7039('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7039('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7039('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7039('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7039('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7039('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7039('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x7039('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x7039('0x3')]},'duration':{'type':Sequelize[_0x7039('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7039('0x3')]}}; \ No newline at end of file +var _0x06f2=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x7721a1,_0x3d8300){var _0x4668ed=function(_0x176f86){while(--_0x176f86){_0x7721a1['push'](_0x7721a1['shift']());}};_0x4668ed(++_0x3d8300);}(_0x06f2,0x118));var _0x206f=function(_0x714486,_0x10a55d){_0x714486=_0x714486-0x0;var _0x589bac=_0x06f2[_0x714486];return _0x589bac;};'use strict';var Sequelize=require('sequelize');module[_0x206f('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x206f('0x1')]},'channelstate':{'type':Sequelize[_0x206f('0x2')]},'channelstatedesc':{'type':Sequelize[_0x206f('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x206f('0x1')]},'connectedlinename':{'type':Sequelize[_0x206f('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x206f('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x206f('0x1')]},'priority':{'type':Sequelize[_0x206f('0x2')]},'uniqueid':{'type':Sequelize[_0x206f('0x1')]},'linkedid':{'type':Sequelize[_0x206f('0x1')]},'destchannel':{'type':Sequelize[_0x206f('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x206f('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x206f('0x1')]},'destlanguage':{'type':Sequelize[_0x206f('0x1')]},'destaccountcode':{'type':Sequelize[_0x206f('0x1')]},'destcontext':{'type':Sequelize[_0x206f('0x1')]},'destexten':{'type':Sequelize[_0x206f('0x1')]},'destpriority':{'type':Sequelize[_0x206f('0x2')]},'destuniqueid':{'type':Sequelize[_0x206f('0x1')]},'destlinkedid':{'type':Sequelize[_0x206f('0x1')]},'dialstring':{'type':Sequelize[_0x206f('0x1')]},'dialstatus':{'type':Sequelize[_0x206f('0x1')]},'starttime':{'type':Sequelize[_0x206f('0x3')]},'answertime':{'type':Sequelize[_0x206f('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0x206f('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x206f('0x2')]},'holdtime':{'type':Sequelize[_0x206f('0x2')]},'billableseconds':{'type':Sequelize[_0x206f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 90b30f2..a7eed18 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 _0x9393=['find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll'];(function(_0x2207ef,_0x15d0b8){var _0x55a34c=function(_0x1fc912){while(--_0x1fc912){_0x2207ef['push'](_0x2207ef['shift']());}};_0x55a34c(++_0x15d0b8);}(_0x9393,0x9c));var _0x3939=function(_0x466388,_0x4a43c4){_0x466388=_0x466388-0x0;var _0x27da38=_0x9393[_0x466388];return _0x27da38;};'use strict';var emlformat=require(_0x3939('0x0'));var rimraf=require(_0x3939('0x1'));var zipdir=require(_0x3939('0x2'));var jsonpatch=require(_0x3939('0x3'));var rp=require(_0x3939('0x4'));var moment=require(_0x3939('0x5'));var BPromise=require(_0x3939('0x6'));var Mustache=require(_0x3939('0x7'));var util=require('util');var path=require(_0x3939('0x8'));var sox=require(_0x3939('0x9'));var csv=require(_0x3939('0xa'));var ejs=require(_0x3939('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3939('0xc'));var squel=require(_0x3939('0xd'));var crypto=require(_0x3939('0xe'));var jsforce=require(_0x3939('0xf'));var deskjs=require(_0x3939('0x10'));var toCsv=require(_0x3939('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3939('0x11'));var authService=require(_0x3939('0x12'));var qs=require(_0x3939('0x13'));var as=require(_0x3939('0x14'));var hardwareService=require(_0x3939('0x15'));var logger=require('../../config/logger')(_0x3939('0x16'));var utils=require(_0x3939('0x17'));var config=require(_0x3939('0x18'));var licenseUtil=require(_0x3939('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d2507,_0x326bf1){_0x326bf1=_0x326bf1||0xcc;return function(_0x4f9330){if(_0x4f9330){return _0x2d2507[_0x3939('0x1a')](_0x326bf1);}return _0x2d2507[_0x3939('0x1b')](_0x326bf1)['end']();};}function respondWithResult(_0x3c2ec3,_0x18a3f0){_0x18a3f0=_0x18a3f0||0xc8;return function(_0x150928){if(_0x150928){return _0x3c2ec3[_0x3939('0x1b')](_0x18a3f0)[_0x3939('0x1c')](_0x150928);}};}function respondWithFilteredResult(_0x27cb21,_0x560c09){return function(_0x27da2c){if(_0x27da2c){var _0x313486=typeof _0x560c09[_0x3939('0x1d')]===_0x3939('0x1e')&&typeof _0x560c09[_0x3939('0x1f')]==='undefined';var _0x1d5722=_0x27da2c[_0x3939('0x20')];var _0x1560e2=_0x313486?0x0:_0x560c09['offset'];var _0x5e57eb=_0x313486?_0x27da2c[_0x3939('0x20')]:_0x560c09[_0x3939('0x1d')]+_0x560c09[_0x3939('0x1f')];var _0x871123;if(_0x5e57eb>=_0x1d5722){_0x5e57eb=_0x1d5722;_0x871123=0xc8;}else{_0x871123=0xce;}_0x27cb21[_0x3939('0x1b')](_0x871123);return _0x27cb21[_0x3939('0x21')]('Content-Range',_0x1560e2+'-'+_0x5e57eb+'/'+_0x1d5722)['json'](_0x27da2c);}return null;};}function patchUpdates(_0x175aee){return function(_0x58b71e){try{jsonpatch[_0x3939('0x22')](_0x58b71e,_0x175aee,!![]);}catch(_0x37b628){return BPromise[_0x3939('0x23')](_0x37b628);}return _0x58b71e[_0x3939('0x24')]();};}function saveUpdates(_0x577c56,_0xdcb916){return function(_0x1f0af6){if(_0x1f0af6){return _0x1f0af6['update'](_0x577c56)[_0x3939('0x25')](function(_0x37992d){return _0x37992d;});}return null;};}function removeEntity(_0x3a9d08,_0x3f0ecd){return function(_0x1a1cab){if(_0x1a1cab){return _0x1a1cab[_0x3939('0x26')]()['then'](function(){_0x3a9d08[_0x3939('0x1b')](0xcc)[_0x3939('0x27')]();});}};}function handleEntityNotFound(_0x14f668,_0x58c53a){return function(_0x124dae){if(!_0x124dae){_0x14f668['sendStatus'](0x194);}return _0x124dae;};}function handleError(_0x357e7a,_0x252687){_0x252687=_0x252687||0x1f4;return function(_0x380cda){logger[_0x3939('0x28')](_0x380cda['stack']);if(_0x380cda[_0x3939('0x29')]){delete _0x380cda[_0x3939('0x29')];}_0x357e7a['status'](_0x252687)[_0x3939('0x2a')](_0x380cda);};}exports[_0x3939('0x2b')]=function(_0x45b95c,_0x9e943a){var _0x48d548={},_0x56177b={},_0x421ef5={'count':0x0,'rows':[]};var _0x32b77e=_[_0x3939('0x2c')](db[_0x3939('0x2d')][_0x3939('0x2e')],function(_0x44df0d){return{'name':_0x44df0d[_0x3939('0x2f')],'type':_0x44df0d[_0x3939('0x30')]['key']};});_0x56177b[_0x3939('0x31')]=_['map'](_0x32b77e,_0x3939('0x29'));_0x56177b[_0x3939('0x32')]=_['keys'](_0x45b95c[_0x3939('0x32')]);_0x56177b[_0x3939('0x33')]=_[_0x3939('0x34')](_0x56177b[_0x3939('0x31')],_0x56177b[_0x3939('0x32')]);_0x48d548[_0x3939('0x35')]=_[_0x3939('0x34')](_0x56177b[_0x3939('0x31')],qs[_0x3939('0x36')](_0x45b95c[_0x3939('0x32')][_0x3939('0x36')]));_0x48d548[_0x3939('0x35')]=_0x48d548[_0x3939('0x35')]['length']?_0x48d548[_0x3939('0x35')]:_0x56177b[_0x3939('0x31')];if(!_0x45b95c[_0x3939('0x32')][_0x3939('0x37')](_0x3939('0x38'))){_0x48d548['limit']=qs[_0x3939('0x1f')](_0x45b95c['query'][_0x3939('0x1f')]);_0x48d548[_0x3939('0x1d')]=qs[_0x3939('0x1d')](_0x45b95c[_0x3939('0x32')][_0x3939('0x1d')]);}_0x48d548[_0x3939('0x39')]=qs[_0x3939('0x3a')](_0x45b95c[_0x3939('0x32')][_0x3939('0x3a')]);_0x48d548[_0x3939('0x3b')]=qs['filters'](_[_0x3939('0x3c')](_0x45b95c[_0x3939('0x32')],_0x56177b['filters']),_0x32b77e);if(_0x45b95c[_0x3939('0x32')][_0x3939('0x3d')]){_0x48d548[_0x3939('0x3b')]=_[_0x3939('0x3e')](_0x48d548[_0x3939('0x3b')],{'$or':_['map'](_0x32b77e,function(_0x1c28bc){if(_0x1c28bc[_0x3939('0x30')]!==_0x3939('0x3f')){var _0x10ff45={};_0x10ff45[_0x1c28bc[_0x3939('0x29')]]={'$like':'%'+_0x45b95c[_0x3939('0x32')][_0x3939('0x3d')]+'%'};return _0x10ff45;}})});}_0x48d548=_[_0x3939('0x3e')]({},_0x48d548,_0x45b95c[_0x3939('0x40')]);var _0x2ef80d={'where':_0x48d548[_0x3939('0x3b')]};return db[_0x3939('0x2d')][_0x3939('0x20')](_0x2ef80d)[_0x3939('0x25')](function(_0x45cc33){_0x421ef5[_0x3939('0x20')]=_0x45cc33;if(_0x45b95c[_0x3939('0x32')]['includeAll']){_0x48d548[_0x3939('0x41')]=[{'all':!![]}];}return db[_0x3939('0x2d')]['findAll'](_0x48d548);})['then'](function(_0x52c4c3){_0x421ef5[_0x3939('0x42')]=_0x52c4c3;return _0x421ef5;})['then'](respondWithFilteredResult(_0x9e943a,_0x48d548))[_0x3939('0x43')](handleError(_0x9e943a,null));};exports[_0x3939('0x44')]=function(_0x1404d2,_0x1721dc){var _0xc79158={'raw':!![],'where':{'id':_0x1404d2[_0x3939('0x45')]['id']}},_0x3996fd={};_0x3996fd[_0x3939('0x31')]=_[_0x3939('0x46')](db[_0x3939('0x2d')][_0x3939('0x2e')]);_0x3996fd['query']=_[_0x3939('0x46')](_0x1404d2[_0x3939('0x32')]);_0x3996fd[_0x3939('0x33')]=_['intersection'](_0x3996fd[_0x3939('0x31')],_0x3996fd[_0x3939('0x32')]);_0xc79158[_0x3939('0x35')]=_[_0x3939('0x34')](_0x3996fd['model'],qs[_0x3939('0x36')](_0x1404d2['query'][_0x3939('0x36')]));_0xc79158[_0x3939('0x35')]=_0xc79158[_0x3939('0x35')]['length']?_0xc79158[_0x3939('0x35')]:_0x3996fd[_0x3939('0x31')];if(_0x1404d2['query'][_0x3939('0x47')]){_0xc79158['include']=[{'all':!![]}];}_0xc79158=_[_0x3939('0x3e')]({},_0xc79158,_0x1404d2['options']);return db[_0x3939('0x2d')][_0x3939('0x48')](_0xc79158)[_0x3939('0x25')](handleEntityNotFound(_0x1721dc,null))[_0x3939('0x25')](respondWithResult(_0x1721dc,null))[_0x3939('0x43')](handleError(_0x1721dc,null));};exports['create']=function(_0xaadac2,_0x353929){return db[_0x3939('0x2d')]['create'](_0xaadac2[_0x3939('0x49')],{})[_0x3939('0x25')](respondWithResult(_0x353929,0xc9))[_0x3939('0x43')](handleError(_0x353929,null));};exports[_0x3939('0x4a')]=function(_0x28b8bd,_0x4dd46a){if(_0x28b8bd[_0x3939('0x49')]['id']){delete _0x28b8bd[_0x3939('0x49')]['id'];}return db[_0x3939('0x2d')][_0x3939('0x48')]({'where':{'id':_0x28b8bd['params']['id']}})[_0x3939('0x25')](handleEntityNotFound(_0x4dd46a,null))[_0x3939('0x25')](saveUpdates(_0x28b8bd[_0x3939('0x49')],null))[_0x3939('0x25')](respondWithResult(_0x4dd46a,null))[_0x3939('0x43')](handleError(_0x4dd46a,null));};exports[_0x3939('0x26')]=function(_0x283c26,_0x3d4b86){return db[_0x3939('0x2d')][_0x3939('0x48')]({'where':{'id':_0x283c26[_0x3939('0x45')]['id']}})[_0x3939('0x25')](handleEntityNotFound(_0x3d4b86,null))['then'](removeEntity(_0x3d4b86,null))[_0x3939('0x43')](handleError(_0x3d4b86,null));};exports[_0x3939('0x4b')]=function(_0x18659e,_0x1d941d){return db[_0x3939('0x2d')][_0x3939('0x4b')]()[_0x3939('0x25')](respondWithResult(_0x1d941d,null))[_0x3939('0x43')](handleError(_0x1d941d,null));}; \ No newline at end of file +var _0x3c58=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','VoiceDialReport','includeAll','include','findAll','rows','show','length','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3c58,0x119));var _0x83c5=function(_0x4e9ebd,_0x5ccaac){_0x4e9ebd=_0x4e9ebd-0x0;var _0x4d5df8=_0x3c58[_0x4e9ebd];return _0x4d5df8;};'use strict';var emlformat=require(_0x83c5('0x0'));var rimraf=require(_0x83c5('0x1'));var zipdir=require(_0x83c5('0x2'));var jsonpatch=require(_0x83c5('0x3'));var rp=require(_0x83c5('0x4'));var moment=require(_0x83c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x83c5('0x6'));var util=require('util');var path=require(_0x83c5('0x7'));var sox=require(_0x83c5('0x8'));var csv=require('to-csv');var ejs=require(_0x83c5('0x9'));var fs=require('fs');var fs_extra=require(_0x83c5('0xa'));var _=require(_0x83c5('0xb'));var squel=require(_0x83c5('0xc'));var crypto=require(_0x83c5('0xd'));var jsforce=require(_0x83c5('0xe'));var deskjs=require(_0x83c5('0xf'));var toCsv=require(_0x83c5('0x10'));var querystring=require(_0x83c5('0x11'));var Papa=require('papaparse');var Redis=require(_0x83c5('0x12'));var authService=require(_0x83c5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x83c5('0x14'));var hardwareService=require(_0x83c5('0x15'));var logger=require(_0x83c5('0x16'))('api');var utils=require(_0x83c5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x83c5('0x18'))['db'];function respondWithStatusCode(_0x4208f1,_0x1b58c9){_0x1b58c9=_0x1b58c9||0xcc;return function(_0x12480e){if(_0x12480e){return _0x4208f1[_0x83c5('0x19')](_0x1b58c9);}return _0x4208f1[_0x83c5('0x1a')](_0x1b58c9)[_0x83c5('0x1b')]();};}function respondWithResult(_0x15f06e,_0x4869b3){_0x4869b3=_0x4869b3||0xc8;return function(_0x5d2bfe){if(_0x5d2bfe){return _0x15f06e['status'](_0x4869b3)[_0x83c5('0x1c')](_0x5d2bfe);}};}function respondWithFilteredResult(_0x476172,_0xbbaa43){return function(_0x1a07f5){if(_0x1a07f5){var _0x3e4052=typeof _0xbbaa43[_0x83c5('0x1d')]===_0x83c5('0x1e')&&typeof _0xbbaa43[_0x83c5('0x1f')]===_0x83c5('0x1e');var _0x49c93c=_0x1a07f5[_0x83c5('0x20')];var _0x4483e5=_0x3e4052?0x0:_0xbbaa43[_0x83c5('0x1d')];var _0x576905=_0x3e4052?_0x1a07f5[_0x83c5('0x20')]:_0xbbaa43[_0x83c5('0x1d')]+_0xbbaa43['limit'];var _0x120171;if(_0x576905>=_0x49c93c){_0x576905=_0x49c93c;_0x120171=0xc8;}else{_0x120171=0xce;}_0x476172[_0x83c5('0x1a')](_0x120171);return _0x476172[_0x83c5('0x21')](_0x83c5('0x22'),_0x4483e5+'-'+_0x576905+'/'+_0x49c93c)[_0x83c5('0x1c')](_0x1a07f5);}return null;};}function patchUpdates(_0x443bf9){return function(_0x438529){try{jsonpatch[_0x83c5('0x23')](_0x438529,_0x443bf9,!![]);}catch(_0x5799cb){return BPromise[_0x83c5('0x24')](_0x5799cb);}return _0x438529['save']();};}function saveUpdates(_0x27cddd,_0x5ef4c3){return function(_0x1ef8f4){if(_0x1ef8f4){return _0x1ef8f4[_0x83c5('0x25')](_0x27cddd)[_0x83c5('0x26')](function(_0x2ef86f){return _0x2ef86f;});}return null;};}function removeEntity(_0x557d6a,_0x15efe8){return function(_0x2455b3){if(_0x2455b3){return _0x2455b3[_0x83c5('0x27')]()[_0x83c5('0x26')](function(){_0x557d6a['status'](0xcc)[_0x83c5('0x1b')]();});}};}function handleEntityNotFound(_0x5f2ccc,_0x574689){return function(_0x31467c){if(!_0x31467c){_0x5f2ccc['sendStatus'](0x194);}return _0x31467c;};}function handleError(_0x117f99,_0x2b25d2){_0x2b25d2=_0x2b25d2||0x1f4;return function(_0x4be91e){logger[_0x83c5('0x28')](_0x4be91e['stack']);if(_0x4be91e[_0x83c5('0x29')]){delete _0x4be91e[_0x83c5('0x29')];}_0x117f99[_0x83c5('0x1a')](_0x2b25d2)['send'](_0x4be91e);};}exports[_0x83c5('0x2a')]=function(_0x36fa68,_0x2bd9ad){var _0x4f2264={},_0x3759a6={},_0x4a7c57={'count':0x0,'rows':[]};var _0x2f37d7=_[_0x83c5('0x2b')](db['VoiceDialReport'][_0x83c5('0x2c')],function(_0x12e1b8){return{'name':_0x12e1b8['fieldName'],'type':_0x12e1b8[_0x83c5('0x2d')][_0x83c5('0x2e')]};});_0x3759a6[_0x83c5('0x2f')]=_[_0x83c5('0x2b')](_0x2f37d7,'name');_0x3759a6[_0x83c5('0x30')]=_[_0x83c5('0x31')](_0x36fa68[_0x83c5('0x30')]);_0x3759a6['filters']=_[_0x83c5('0x32')](_0x3759a6[_0x83c5('0x2f')],_0x3759a6['query']);_0x4f2264['attributes']=_[_0x83c5('0x32')](_0x3759a6['model'],qs[_0x83c5('0x33')](_0x36fa68[_0x83c5('0x30')][_0x83c5('0x33')]));_0x4f2264['attributes']=_0x4f2264[_0x83c5('0x34')]['length']?_0x4f2264[_0x83c5('0x34')]:_0x3759a6[_0x83c5('0x2f')];if(!_0x36fa68[_0x83c5('0x30')][_0x83c5('0x35')](_0x83c5('0x36'))){_0x4f2264[_0x83c5('0x1f')]=qs[_0x83c5('0x1f')](_0x36fa68[_0x83c5('0x30')][_0x83c5('0x1f')]);_0x4f2264[_0x83c5('0x1d')]=qs[_0x83c5('0x1d')](_0x36fa68[_0x83c5('0x30')]['offset']);}_0x4f2264[_0x83c5('0x37')]=qs[_0x83c5('0x38')](_0x36fa68[_0x83c5('0x30')][_0x83c5('0x38')]);_0x4f2264[_0x83c5('0x39')]=qs[_0x83c5('0x3a')](_['pick'](_0x36fa68['query'],_0x3759a6[_0x83c5('0x3a')]),_0x2f37d7);if(_0x36fa68['query']['filter']){_0x4f2264[_0x83c5('0x39')]=_[_0x83c5('0x3b')](_0x4f2264['where'],{'$or':_[_0x83c5('0x2b')](_0x2f37d7,function(_0x2a0f51){if(_0x2a0f51[_0x83c5('0x2d')]!=='VIRTUAL'){var _0x554cb6={};_0x554cb6[_0x2a0f51[_0x83c5('0x29')]]={'$like':'%'+_0x36fa68[_0x83c5('0x30')][_0x83c5('0x3c')]+'%'};return _0x554cb6;}})});}_0x4f2264=_['merge']({},_0x4f2264,_0x36fa68[_0x83c5('0x3d')]);var _0x3edd9c={'where':_0x4f2264[_0x83c5('0x39')]};return db[_0x83c5('0x3e')][_0x83c5('0x20')](_0x3edd9c)[_0x83c5('0x26')](function(_0x571038){_0x4a7c57['count']=_0x571038;if(_0x36fa68['query'][_0x83c5('0x3f')]){_0x4f2264[_0x83c5('0x40')]=[{'all':!![]}];}return db[_0x83c5('0x3e')][_0x83c5('0x41')](_0x4f2264);})['then'](function(_0x5adc32){_0x4a7c57[_0x83c5('0x42')]=_0x5adc32;return _0x4a7c57;})['then'](respondWithFilteredResult(_0x2bd9ad,_0x4f2264))['catch'](handleError(_0x2bd9ad,null));};exports[_0x83c5('0x43')]=function(_0xda654a,_0x2898fd){var _0x2a0a75={'raw':!![],'where':{'id':_0xda654a['params']['id']}},_0x17b80f={};_0x17b80f['model']=_['keys'](db[_0x83c5('0x3e')][_0x83c5('0x2c')]);_0x17b80f[_0x83c5('0x30')]=_[_0x83c5('0x31')](_0xda654a[_0x83c5('0x30')]);_0x17b80f[_0x83c5('0x3a')]=_['intersection'](_0x17b80f[_0x83c5('0x2f')],_0x17b80f['query']);_0x2a0a75[_0x83c5('0x34')]=_[_0x83c5('0x32')](_0x17b80f[_0x83c5('0x2f')],qs[_0x83c5('0x33')](_0xda654a['query'][_0x83c5('0x33')]));_0x2a0a75[_0x83c5('0x34')]=_0x2a0a75['attributes'][_0x83c5('0x44')]?_0x2a0a75[_0x83c5('0x34')]:_0x17b80f[_0x83c5('0x2f')];if(_0xda654a['query']['includeAll']){_0x2a0a75[_0x83c5('0x40')]=[{'all':!![]}];}_0x2a0a75=_[_0x83c5('0x3b')]({},_0x2a0a75,_0xda654a[_0x83c5('0x3d')]);return db['VoiceDialReport']['find'](_0x2a0a75)[_0x83c5('0x26')](handleEntityNotFound(_0x2898fd,null))[_0x83c5('0x26')](respondWithResult(_0x2898fd,null))[_0x83c5('0x45')](handleError(_0x2898fd,null));};exports['create']=function(_0x2d3744,_0x364120){return db[_0x83c5('0x3e')][_0x83c5('0x46')](_0x2d3744['body'],{})[_0x83c5('0x26')](respondWithResult(_0x364120,0xc9))[_0x83c5('0x45')](handleError(_0x364120,null));};exports[_0x83c5('0x25')]=function(_0x1f7a7f,_0xa3b3fe){if(_0x1f7a7f[_0x83c5('0x47')]['id']){delete _0x1f7a7f[_0x83c5('0x47')]['id'];}return db[_0x83c5('0x3e')][_0x83c5('0x48')]({'where':{'id':_0x1f7a7f[_0x83c5('0x49')]['id']}})[_0x83c5('0x26')](handleEntityNotFound(_0xa3b3fe,null))[_0x83c5('0x26')](saveUpdates(_0x1f7a7f[_0x83c5('0x47')],null))[_0x83c5('0x26')](respondWithResult(_0xa3b3fe,null))[_0x83c5('0x45')](handleError(_0xa3b3fe,null));};exports[_0x83c5('0x27')]=function(_0x51c48f,_0x17dd9e){return db[_0x83c5('0x3e')][_0x83c5('0x48')]({'where':{'id':_0x51c48f[_0x83c5('0x49')]['id']}})[_0x83c5('0x26')](handleEntityNotFound(_0x17dd9e,null))[_0x83c5('0x26')](removeEntity(_0x17dd9e,null))['catch'](handleError(_0x17dd9e,null));};exports[_0x83c5('0x4a')]=function(_0x35ee05,_0x427f99){return db[_0x83c5('0x3e')]['describe']()[_0x83c5('0x26')](respondWithResult(_0x427f99,null))[_0x83c5('0x45')](handleError(_0x427f99,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 94adb1e..1c11317 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 _0x12c9=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x12c9,0x131));var _0x912c=function(_0x26e098,_0x4515aa){_0x26e098=_0x26e098-0x0;var _0x53f6a6=_0x12c9[_0x26e098];return _0x53f6a6;};'use strict';var _=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x912c('0x2'));var BPromise=require(_0x912c('0x3'));var rp=require(_0x912c('0x4'));var fs=require('fs');var path=require(_0x912c('0x5'));var rimraf=require(_0x912c('0x6'));var config=require('../../config/environment');var attributes=require(_0x912c('0x7'));module[_0x912c('0x8')]=function(_0x4d843,_0xe764d1){return _0x4d843[_0x912c('0x9')](_0x912c('0xa'),attributes,{'tableName':_0x912c('0xb'),'paranoid':![],'indexes':[{'fields':[_0x912c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b71=['uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x1162b1,_0x35b69f){var _0x2165b0=function(_0x1125f9){while(--_0x1125f9){_0x1162b1['push'](_0x1162b1['shift']());}};_0x2165b0(++_0x35b69f);}(_0x5b71,0x143));var _0x15b7=function(_0x436e22,_0x4dae1f){_0x436e22=_0x436e22-0x0;var _0x284cc1=_0x5b71[_0x436e22];return _0x284cc1;};'use strict';var _=require('lodash');var util=require(_0x15b7('0x0'));var logger=require(_0x15b7('0x1'))('api');var moment=require(_0x15b7('0x2'));var BPromise=require(_0x15b7('0x3'));var rp=require(_0x15b7('0x4'));var fs=require('fs');var path=require(_0x15b7('0x5'));var rimraf=require(_0x15b7('0x6'));var config=require(_0x15b7('0x7'));var attributes=require(_0x15b7('0x8'));module[_0x15b7('0x9')]=function(_0x533ba8,_0x2b21c6){return _0x533ba8[_0x15b7('0xa')](_0x15b7('0xb'),attributes,{'tableName':_0x15b7('0xc'),'paranoid':![],'indexes':[{'fields':[_0x15b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 365bf6f..a0802f9 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 _0x696b=['update','body','where','then','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceDialReport','create','options','CreateVoiceDialReport','UpdateVoiceDialReport'];(function(_0x58c010,_0x413a4a){var _0x344f41=function(_0x809bd8){while(--_0x809bd8){_0x58c010['push'](_0x58c010['shift']());}};_0x344f41(++_0x413a4a);}(_0x696b,0xc8));var _0xb696=function(_0xf39cab,_0x6e0d72){_0xf39cab=_0xf39cab-0x0;var _0x55a588=_0x696b[_0xf39cab];return _0x55a588;};'use strict';var _=require(_0xb696('0x0'));var util=require(_0xb696('0x1'));var moment=require(_0xb696('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb696('0x3'));var db=require(_0xb696('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb696('0x5'));var config=require(_0xb696('0x6'));var jayson=require(_0xb696('0x7'));var client=jayson['client'][_0xb696('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa4081d,_0x5eff93,_0x2dd391){return new BPromise(function(_0x5e3fa9,_0x379edf){return client['request'](_0xa4081d,_0x2dd391)['then'](function(_0x50f1c7){logger[_0xb696('0x9')](_0xb696('0xa'),_0x5eff93,_0xb696('0xb'));logger[_0xb696('0xc')](_0xb696('0xd'),_0x5eff93,_0xb696('0xb'),JSON[_0xb696('0xe')](_0x50f1c7));if(_0x50f1c7[_0xb696('0xf')]){if(_0x50f1c7['error'][_0xb696('0x10')]===0x1f4){logger[_0xb696('0xf')](_0xb696('0xa'),_0x5eff93,_0x50f1c7['error'][_0xb696('0x11')]);return _0x379edf(_0x50f1c7[_0xb696('0xf')][_0xb696('0x11')]);}logger[_0xb696('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x5eff93,_0x50f1c7[_0xb696('0xf')][_0xb696('0x11')]);return _0x5e3fa9(_0x50f1c7['error'][_0xb696('0x11')]);}else{logger['info'](_0xb696('0xa'),_0x5eff93,_0xb696('0xb'));_0x5e3fa9(_0x50f1c7['result'][_0xb696('0x11')]);}})[_0xb696('0x12')](function(_0x4e994c){logger[_0xb696('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x5eff93,_0x4e994c);_0x379edf(_0x4e994c);});});}exports['CreateVoiceDialReport']=function(_0x399dda){var _0x49d5ca=this;return new Promise(function(_0x14af44,_0x11859e){return db[_0xb696('0x13')][_0xb696('0x14')](_0x399dda['body'],{'raw':_0x399dda[_0xb696('0x15')]?_0x399dda[_0xb696('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c7f88){logger[_0xb696('0x9')](_0xb696('0x16'),_0x399dda);logger[_0xb696('0xc')](_0xb696('0x16'),_0x399dda,JSON[_0xb696('0xe')](_0x4c7f88));_0x14af44(_0x4c7f88);})[_0xb696('0x12')](function(_0x2c42d5){logger[_0xb696('0xf')]('CreateVoiceDialReport',_0x2c42d5[_0xb696('0x11')],_0x399dda);_0x11859e(_0x49d5ca[_0xb696('0xf')](0x1f4,_0x2c42d5[_0xb696('0x11')]));});});};exports[_0xb696('0x17')]=function(_0x5b065f){var _0x86d64f=this;return new Promise(function(_0x197e14,_0x1a7dcd){return db[_0xb696('0x13')][_0xb696('0x18')](_0x5b065f[_0xb696('0x19')],{'raw':_0x5b065f[_0xb696('0x15')]?_0x5b065f[_0xb696('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b065f['options']?_0x5b065f[_0xb696('0x15')][_0xb696('0x1a')]||null:null,'attributes':_0x5b065f[_0xb696('0x15')]?_0x5b065f[_0xb696('0x15')]['attributes']||null:null,'limit':_0x5b065f['options']?_0x5b065f[_0xb696('0x15')]['limit']||null:null})[_0xb696('0x1b')](function(_0x50fc61){logger[_0xb696('0x9')](_0xb696('0x17'),_0x5b065f);logger[_0xb696('0xc')](_0xb696('0x17'),_0x5b065f,JSON[_0xb696('0xe')](_0x50fc61));_0x197e14(_0x50fc61);})[_0xb696('0x12')](function(_0x2eeb6f){logger['error']('UpdateVoiceDialReport',_0x2eeb6f[_0xb696('0x11')],_0x5b065f);_0x1a7dcd(_0x86d64f[_0xb696('0xf')](0x1f4,_0x2eeb6f['message']));});});}; \ No newline at end of file +var _0x6871=['../../config/utils','../../config/logger','rpc','jayson/promise','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x2e01ca,_0x12da6f){var _0x51bb4d=function(_0x25323d){while(--_0x25323d){_0x2e01ca['push'](_0x2e01ca['shift']());}};_0x51bb4d(++_0x12da6f);}(_0x6871,0x1db));var _0x1687=function(_0x45783f,_0x1fc3bd){_0x45783f=_0x45783f-0x0;var _0x3a7afe=_0x6871[_0x45783f];return _0x3a7afe;};'use strict';var _=require(_0x1687('0x0'));var util=require(_0x1687('0x1'));var moment=require('moment');var BPromise=require(_0x1687('0x2'));var rs=require(_0x1687('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1687('0x4'))['db'];var utils=require(_0x1687('0x5'));var logger=require(_0x1687('0x6'))(_0x1687('0x7'));var config=require('../../config/environment');var jayson=require(_0x1687('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4742aa,_0x5a5faa,_0x692086){return new BPromise(function(_0x1f0fd8,_0x32a922){return client[_0x1687('0x9')](_0x4742aa,_0x692086)['then'](function(_0x3e55f1){logger[_0x1687('0xa')](_0x1687('0xb'),_0x5a5faa,'request\x20sent');logger[_0x1687('0xc')](_0x1687('0xd'),_0x5a5faa,_0x1687('0xe'),JSON[_0x1687('0xf')](_0x3e55f1));if(_0x3e55f1['error']){if(_0x3e55f1[_0x1687('0x10')]['code']===0x1f4){logger[_0x1687('0x10')](_0x1687('0xb'),_0x5a5faa,_0x3e55f1[_0x1687('0x10')][_0x1687('0x11')]);return _0x32a922(_0x3e55f1[_0x1687('0x10')][_0x1687('0x11')]);}logger[_0x1687('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x5a5faa,_0x3e55f1[_0x1687('0x10')][_0x1687('0x11')]);return _0x1f0fd8(_0x3e55f1[_0x1687('0x10')][_0x1687('0x11')]);}else{logger[_0x1687('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x5a5faa,'request\x20sent');_0x1f0fd8(_0x3e55f1[_0x1687('0x12')][_0x1687('0x11')]);}})[_0x1687('0x13')](function(_0x1dc502){logger[_0x1687('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x5a5faa,_0x1dc502);_0x32a922(_0x1dc502);});});}exports[_0x1687('0x14')]=function(_0x1dffaf){var _0x17bf30=this;return new Promise(function(_0x171499,_0x312acd){return db[_0x1687('0x15')][_0x1687('0x16')](_0x1dffaf[_0x1687('0x17')],{'raw':_0x1dffaf['options']?_0x1dffaf[_0x1687('0x18')][_0x1687('0x19')]===undefined?!![]:![]:!![]})[_0x1687('0x1a')](function(_0x8685a7){logger[_0x1687('0xa')](_0x1687('0x14'),_0x1dffaf);logger[_0x1687('0xc')](_0x1687('0x14'),_0x1dffaf,JSON[_0x1687('0xf')](_0x8685a7));_0x171499(_0x8685a7);})['catch'](function(_0x471197){logger['error'](_0x1687('0x14'),_0x471197[_0x1687('0x11')],_0x1dffaf);_0x312acd(_0x17bf30['error'](0x1f4,_0x471197['message']));});});};exports[_0x1687('0x1b')]=function(_0x3ff374){var _0x482668=this;return new Promise(function(_0x53e228,_0xf63cb3){return db[_0x1687('0x15')][_0x1687('0x1c')](_0x3ff374[_0x1687('0x17')],{'raw':_0x3ff374[_0x1687('0x18')]?_0x3ff374[_0x1687('0x18')][_0x1687('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff374[_0x1687('0x18')]?_0x3ff374[_0x1687('0x18')][_0x1687('0x1d')]||null:null,'attributes':_0x3ff374[_0x1687('0x18')]?_0x3ff374[_0x1687('0x18')][_0x1687('0x1e')]||null:null,'limit':_0x3ff374[_0x1687('0x18')]?_0x3ff374[_0x1687('0x18')][_0x1687('0x1f')]||null:null})[_0x1687('0x1a')](function(_0x343951){logger[_0x1687('0xa')](_0x1687('0x1b'),_0x3ff374);logger[_0x1687('0xc')]('UpdateVoiceDialReport',_0x3ff374,JSON[_0x1687('0xf')](_0x343951));_0x53e228(_0x343951);})[_0x1687('0x13')](function(_0x288d14){logger[_0x1687('0x10')](_0x1687('0x1b'),_0x288d14[_0x1687('0x11')],_0x3ff374);_0xf63cb3(_0x482668[_0x1687('0x10')](0x1f4,_0x288d14[_0x1687('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7806524..4fc0c20 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 _0x07c3=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x07c3,0x1a8));var _0x307c=function(_0x2c69a1,_0x201903){_0x2c69a1=_0x2c69a1-0x0;var _0x24bb91=_0x07c3[_0x2c69a1];return _0x24bb91;};'use strict';var multer=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var path=require(_0x307c('0x2'));var timeout=require(_0x307c('0x3'));var express=require('express');var router=express[_0x307c('0x4')]();var fs_extra=require(_0x307c('0x5'));var auth=require(_0x307c('0x6'));var interaction=require(_0x307c('0x7'));var config=require(_0x307c('0x8'));var controller=require(_0x307c('0x9'));router[_0x307c('0xa')]('/',auth[_0x307c('0xb')](),controller[_0x307c('0xc')]);router['get'](_0x307c('0xd'),auth[_0x307c('0xb')](),controller[_0x307c('0xe')]);router[_0x307c('0xf')]('/',auth[_0x307c('0xb')](),controller[_0x307c('0x10')]);router[_0x307c('0xf')](_0x307c('0x11'),auth[_0x307c('0xb')](),controller[_0x307c('0x12')]);router[_0x307c('0x13')](_0x307c('0xd'),auth['isAuthenticated'](),controller[_0x307c('0x14')]);router[_0x307c('0x15')](_0x307c('0xd'),auth['isAuthenticated'](),controller[_0x307c('0x16')]);module[_0x307c('0x17')]=router; \ No newline at end of file +var _0x9157=['../../config/environment','./voiceExtension.controller','isAuthenticated','index','post','/:id/applications','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x575783,_0x4f66f6){var _0x1aeae0=function(_0x3e05cb){while(--_0x3e05cb){_0x575783['push'](_0x575783['shift']());}};_0x1aeae0(++_0x4f66f6);}(_0x9157,0xc5));var _0x7915=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x9157[_0x4715d2];return _0x141811;};'use strict';var multer=require(_0x7915('0x0'));var util=require(_0x7915('0x1'));var path=require(_0x7915('0x2'));var timeout=require(_0x7915('0x3'));var express=require(_0x7915('0x4'));var router=express['Router']();var fs_extra=require(_0x7915('0x5'));var auth=require(_0x7915('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7915('0x7'));var controller=require(_0x7915('0x8'));router['get']('/',auth[_0x7915('0x9')](),controller[_0x7915('0xa')]);router['get']('/:id',auth[_0x7915('0x9')](),controller['show']);router[_0x7915('0xb')]('/',auth[_0x7915('0x9')](),controller['create']);router[_0x7915('0xb')](_0x7915('0xc'),auth[_0x7915('0x9')](),controller['addApplications']);router[_0x7915('0xd')](_0x7915('0xe'),auth[_0x7915('0x9')](),controller['update']);router[_0x7915('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7915('0x10')]);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 240f91a..9b2d573 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(_0x2f8249,_0xb849cc){var _0x874c3d=function(_0x51b803){while(--_0x51b803){_0x2f8249['push'](_0x2f8249['shift']());}};_0x874c3d(++_0xb849cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0xcfaafe,_0x1c2685){var _0x3b2f30=function(_0x4c06ef){while(--_0x4c06ef){_0xcfaafe['push'](_0xcfaafe['shift']());}};_0x3b2f30(++_0x1c2685);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 beaf823..622a4ac 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 _0xd663=['update','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','value','includes','type','find','UserProfileResource','error','stack','name','send','index','map','VoiceExtension','rawAttributes','fieldName','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','startsWith','exten','concat','role','user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x51995b,_0x3f5a93){var _0x4ddcd4=function(_0x7ba3b2){while(--_0x7ba3b2){_0x51995b['push'](_0x51995b['shift']());}};_0x4ddcd4(++_0x3f5a93);}(_0xd663,0xf0));var _0x3d66=function(_0x5968cf,_0x55a45f){_0x5968cf=_0x5968cf-0x0;var _0x115f7a=_0xd663[_0x5968cf];return _0x115f7a;};'use strict';var emlformat=require(_0x3d66('0x0'));var rimraf=require(_0x3d66('0x1'));var zipdir=require(_0x3d66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d66('0x3'));var moment=require(_0x3d66('0x4'));var BPromise=require(_0x3d66('0x5'));var Mustache=require('mustache');var util=require(_0x3d66('0x6'));var path=require(_0x3d66('0x7'));var sox=require(_0x3d66('0x8'));var csv=require('to-csv');var ejs=require(_0x3d66('0x9'));var fs=require('fs');var fs_extra=require(_0x3d66('0xa'));var _=require(_0x3d66('0xb'));var squel=require(_0x3d66('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d66('0xd'));var deskjs=require(_0x3d66('0xe'));var toCsv=require(_0x3d66('0xf'));var querystring=require(_0x3d66('0x10'));var Papa=require('papaparse');var Redis=require(_0x3d66('0x11'));var authService=require(_0x3d66('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x13'));var hardwareService=require(_0x3d66('0x14'));var logger=require(_0x3d66('0x15'))(_0x3d66('0x16'));var utils=require(_0x3d66('0x17'));var config=require(_0x3d66('0x18'));var licenseUtil=require(_0x3d66('0x19'));var db=require(_0x3d66('0x1a'))['db'];config['redis']=_[_0x3d66('0x1b')](config[_0x3d66('0x1c')],{'host':_0x3d66('0x1d'),'port':0x18eb});var socket=require(_0x3d66('0x1e'))(new Redis(config[_0x3d66('0x1c')]));require(_0x3d66('0x1f'))[_0x3d66('0x20')](socket);function respondWithStatusCode(_0x1c0d13,_0x139835){_0x139835=_0x139835||0xcc;return function(_0xa089ea){if(_0xa089ea){return _0x1c0d13[_0x3d66('0x21')](_0x139835);}return _0x1c0d13[_0x3d66('0x22')](_0x139835)[_0x3d66('0x23')]();};}function respondWithResult(_0x5b2396,_0x2a16b8){_0x2a16b8=_0x2a16b8||0xc8;return function(_0x272ca5){if(_0x272ca5){return _0x5b2396[_0x3d66('0x22')](_0x2a16b8)[_0x3d66('0x24')](_0x272ca5);}};}function respondWithFilteredResult(_0x47d8eb,_0x5e992b){return function(_0x26fd8e){if(_0x26fd8e){var _0x350528=typeof _0x5e992b[_0x3d66('0x25')]==='undefined'&&typeof _0x5e992b['limit']==='undefined';var _0x2095af=_0x26fd8e[_0x3d66('0x26')];var _0x5e7d24=_0x350528?0x0:_0x5e992b[_0x3d66('0x25')];var _0x295063=_0x350528?_0x26fd8e[_0x3d66('0x26')]:_0x5e992b[_0x3d66('0x25')]+_0x5e992b[_0x3d66('0x27')];var _0x2fe665;if(_0x295063>=_0x2095af){_0x295063=_0x2095af;_0x2fe665=0xc8;}else{_0x2fe665=0xce;}_0x47d8eb[_0x3d66('0x22')](_0x2fe665);return _0x47d8eb[_0x3d66('0x28')](_0x3d66('0x29'),_0x5e7d24+'-'+_0x295063+'/'+_0x2095af)[_0x3d66('0x24')](_0x26fd8e);}return null;};}function patchUpdates(_0x5b2466){return function(_0x3ef125){try{jsonpatch[_0x3d66('0x2a')](_0x3ef125,_0x5b2466,!![]);}catch(_0x17d223){return BPromise[_0x3d66('0x2b')](_0x17d223);}return _0x3ef125[_0x3d66('0x2c')]();};}function saveUpdates(_0x271d52,_0x305ecd){return function(_0x5aacaf){if(_0x5aacaf){return _0x5aacaf['update'](_0x271d52)[_0x3d66('0x2d')](function(_0x4ad0cd){return _0x4ad0cd;});}return null;};}function removeEntity(_0x44b455,_0x3e9e23){return function(_0x480b3f){if(_0x480b3f){return _0x480b3f[_0x3d66('0x2e')]()[_0x3d66('0x2d')](function(){var _0x207b8d=_0x480b3f[_0x3d66('0x2f')]({'plain':!![]});var _0x54e9d4=[{'name':_0x3d66('0x30'),'value':_0x3d66('0x31'),'ignore':![]},{'name':_0x3d66('0x32'),'value':_0x3d66('0x33'),'ignore':![]},{'name':_0x3d66('0x34'),'value':_0x3d66('0x35'),'ignore':![]}];var _0x3d350a=_(_0x54e9d4)['filter'](_0x3d66('0x36'))['map'](_0x3d66('0x37'))[_0x3d66('0x37')]();if(_[_0x3d66('0x38')](_0x3d350a,_0x207b8d[_0x3d66('0x39')])){return;}var _0x53fe6f=_[_0x3d66('0x3a')](_0x54e9d4,['value',_0x207b8d[_0x3d66('0x39')]])['name'];return db[_0x3d66('0x3b')]['destroy']({'where':{'type':_0x53fe6f,'resourceId':_0x207b8d['id']}})[_0x3d66('0x2d')](function(){return _0x480b3f;});})[_0x3d66('0x2d')](function(){_0x44b455[_0x3d66('0x22')](0xcc)[_0x3d66('0x23')]();});}};}function handleEntityNotFound(_0x53770c,_0xe394bb){return function(_0x462942){if(!_0x462942){_0x53770c[_0x3d66('0x21')](0x194);}return _0x462942;};}function handleError(_0x1a6f31,_0x40d8ea){_0x40d8ea=_0x40d8ea||0x1f4;return function(_0x14fca3){logger[_0x3d66('0x3c')](_0x14fca3[_0x3d66('0x3d')]);if(_0x14fca3[_0x3d66('0x3e')]){delete _0x14fca3['name'];}_0x1a6f31['status'](_0x40d8ea)[_0x3d66('0x3f')](_0x14fca3);};}exports[_0x3d66('0x40')]=function(_0x338374,_0x5b700b){var _0x4c7ef5={},_0x22f699={},_0x4ec440={'count':0x0,'rows':[]};var _0x1753ae=_[_0x3d66('0x41')](db[_0x3d66('0x42')][_0x3d66('0x43')],function(_0x436f99){return{'name':_0x436f99[_0x3d66('0x44')],'type':_0x436f99[_0x3d66('0x39')]['key']};});_0x22f699['model']=_[_0x3d66('0x41')](_0x1753ae,_0x3d66('0x3e'));_0x22f699[_0x3d66('0x45')]=_['keys'](_0x338374[_0x3d66('0x45')]);_0x22f699[_0x3d66('0x46')]=_[_0x3d66('0x47')](_0x22f699[_0x3d66('0x48')],_0x22f699[_0x3d66('0x45')]);_0x4c7ef5['attributes']=_['intersection'](_0x22f699[_0x3d66('0x48')],qs['fields'](_0x338374[_0x3d66('0x45')][_0x3d66('0x49')]));_0x4c7ef5[_0x3d66('0x4a')]=_0x4c7ef5['attributes'][_0x3d66('0x4b')]?_0x4c7ef5[_0x3d66('0x4a')]:_0x22f699[_0x3d66('0x48')];if(!_0x338374[_0x3d66('0x45')]['hasOwnProperty'](_0x3d66('0x4c'))){_0x4c7ef5[_0x3d66('0x27')]=qs['limit'](_0x338374[_0x3d66('0x45')][_0x3d66('0x27')]);_0x4c7ef5[_0x3d66('0x25')]=qs[_0x3d66('0x25')](_0x338374[_0x3d66('0x45')][_0x3d66('0x25')]);}_0x4c7ef5[_0x3d66('0x4d')]=qs[_0x3d66('0x4e')](_0x338374[_0x3d66('0x45')][_0x3d66('0x4e')]);_0x4c7ef5[_0x3d66('0x4f')]=qs[_0x3d66('0x46')](_[_0x3d66('0x50')](_0x338374[_0x3d66('0x45')],_0x22f699[_0x3d66('0x46')]),_0x1753ae);if(_0x338374[_0x3d66('0x45')][_0x3d66('0x51')]){_0x4c7ef5[_0x3d66('0x4f')]=_[_0x3d66('0x52')](_0x4c7ef5[_0x3d66('0x4f')],{'$or':_['map'](_0x1753ae,function(_0x2ec9dd){if(_0x2ec9dd['type']!==_0x3d66('0x53')){var _0x54a6ce={};_0x54a6ce[_0x2ec9dd[_0x3d66('0x3e')]]={'$like':'%'+_0x338374['query'][_0x3d66('0x51')]+'%'};return _0x54a6ce;}})});}_0x4c7ef5=_[_0x3d66('0x52')]({},_0x4c7ef5,_0x338374[_0x3d66('0x54')]);var _0x501f39={'where':_0x4c7ef5['where']};return db[_0x3d66('0x42')][_0x3d66('0x26')](_0x501f39)[_0x3d66('0x2d')](function(_0x2010f7){_0x4ec440[_0x3d66('0x26')]=_0x2010f7;if(_0x338374['query'][_0x3d66('0x55')]){_0x4c7ef5[_0x3d66('0x56')]=[{'all':!![]}];}return db[_0x3d66('0x42')][_0x3d66('0x57')](_0x4c7ef5);})['then'](function(_0x378373){_0x4ec440[_0x3d66('0x58')]=_0x378373;return _0x4ec440;})[_0x3d66('0x2d')](respondWithFilteredResult(_0x5b700b,_0x4c7ef5))[_0x3d66('0x59')](handleError(_0x5b700b,null));};exports['show']=function(_0x5b520f,_0x3179a4){var _0x3aa3a1={'raw':![],'where':{'id':_0x5b520f[_0x3d66('0x5a')]['id']}},_0x3aa439={};_0x3aa439['model']=_[_0x3d66('0x5b')](db[_0x3d66('0x42')][_0x3d66('0x43')]);_0x3aa439[_0x3d66('0x45')]=_[_0x3d66('0x5b')](_0x5b520f['query']);_0x3aa439[_0x3d66('0x46')]=_[_0x3d66('0x47')](_0x3aa439[_0x3d66('0x48')],_0x3aa439[_0x3d66('0x45')]);_0x3aa3a1[_0x3d66('0x4a')]=_[_0x3d66('0x47')](_0x3aa439[_0x3d66('0x48')],qs[_0x3d66('0x49')](_0x5b520f[_0x3d66('0x45')][_0x3d66('0x49')]));_0x3aa3a1['attributes']=_0x3aa3a1['attributes'][_0x3d66('0x4b')]?_0x3aa3a1[_0x3d66('0x4a')]:_0x3aa439[_0x3d66('0x48')];if(_0x5b520f['query'][_0x3d66('0x55')]){_0x3aa3a1['include']=[{'all':!![]}];}_0x3aa3a1=_[_0x3d66('0x52')]({},_0x3aa3a1,_0x5b520f[_0x3d66('0x54')]);return db[_0x3d66('0x42')][_0x3d66('0x3a')](_0x3aa3a1)[_0x3d66('0x2d')](handleEntityNotFound(_0x3179a4,null))[_0x3d66('0x2d')](respondWithResult(_0x3179a4,null))['catch'](handleError(_0x3179a4,null));};exports['destroy']=function(_0x475d2b,_0x32c015){return db[_0x3d66('0x42')][_0x3d66('0x3a')]({'where':{'id':_0x475d2b[_0x3d66('0x5a')]['id']}})[_0x3d66('0x2d')](handleEntityNotFound(_0x32c015,null))[_0x3d66('0x2d')](removeEntity(_0x32c015,null))[_0x3d66('0x59')](handleError(_0x32c015,null));};exports[_0x3d66('0x5c')]=function(_0x450136,_0x66ecd){if(_0x450136[_0x3d66('0x5d')][_0x3d66('0x39')]===_0x3d66('0x33')&&!_[_0x3d66('0x5e')](_0x450136[_0x3d66('0x5d')][_0x3d66('0x5f')],'_')){_0x450136[_0x3d66('0x5d')]['exten']='_'[_0x3d66('0x60')](_0x450136[_0x3d66('0x5d')][_0x3d66('0x5f')]);}return db[_0x3d66('0x42')]['create'](_0x450136['body'],{'raw':![]})[_0x3d66('0x2d')](function(_0x5cb252){var _0x501af6=_0x450136['user'][_0x3d66('0x2f')]({'plain':!![]});if(!_0x501af6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x501af6[_0x3d66('0x61')]===_0x3d66('0x62')){var _0x3da33c=_0x5cb252[_0x3d66('0x2f')]({'plain':!![]});var _0x2231d4=[{'name':_0x3d66('0x30'),'value':'inbound'},{'name':_0x3d66('0x32'),'value':_0x3d66('0x33')},{'name':_0x3d66('0x34'),'value':'internal'}];var _0x5e685c=_[_0x3d66('0x3a')](_0x2231d4,[_0x3d66('0x37'),_0x3da33c[_0x3d66('0x39')]])[_0x3d66('0x3e')];return db[_0x3d66('0x63')][_0x3d66('0x3a')]({'where':{'name':_0x5e685c,'userProfileId':_0x501af6[_0x3d66('0x64')]},'raw':!![]})[_0x3d66('0x2d')](function(_0x1aa55c){if(_0x1aa55c&&_0x1aa55c[_0x3d66('0x65')]===0x0){return db[_0x3d66('0x3b')][_0x3d66('0x5c')]({'name':_0x3da33c[_0x3d66('0x3e')],'resourceId':_0x3da33c['id'],'type':_0x1aa55c[_0x3d66('0x3e')],'sectionId':_0x1aa55c['id']},{})['then'](function(){return _0x5cb252;});}else{return _0x5cb252;}})[_0x3d66('0x59')](function(_0x2835a6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2835a6);throw _0x2835a6;});}return _0x5cb252;})[_0x3d66('0x2d')](respondWithResult(_0x66ecd,0xc9))[_0x3d66('0x59')](handleError(_0x66ecd,null));};exports['update']=function(_0x17dc6d,_0x35e8c7){if(_0x17dc6d[_0x3d66('0x5d')]['id']){delete _0x17dc6d[_0x3d66('0x5d')]['id'];}return db[_0x3d66('0x42')][_0x3d66('0x3a')]({'where':{'id':_0x17dc6d[_0x3d66('0x5a')]['id']}})[_0x3d66('0x2d')](handleEntityNotFound(_0x35e8c7,null))[_0x3d66('0x2d')](function(_0x1b57c8){if(_0x1b57c8){return db[_0x3d66('0x42')][_0x3d66('0x66')](_[_0x3d66('0x50')](_0x17dc6d[_0x3d66('0x5d')],[_0x3d66('0x5f'),_0x3d66('0x67'),_0x3d66('0x68'),'recordingFormat',_0x3d66('0x69'),_0x3d66('0x6a')]),{'where':{'context':_0x1b57c8[_0x3d66('0x67')],'exten':_0x1b57c8[_0x3d66('0x5f')]},'individualHooks':!![]})[_0x3d66('0x2d')](function(_0x53622a){return _0x53622a;});}return null;})[_0x3d66('0x2d')](respondWithStatusCode(_0x35e8c7,null))[_0x3d66('0x59')](handleError(_0x35e8c7,null));};exports[_0x3d66('0x6b')]=function(_0xa9bda7,_0x5c4a76,_0x2c48b3){return db[_0x3d66('0x42')][_0x3d66('0x6c')]({'where':{'id':_0xa9bda7[_0x3d66('0x5a')]['id']}})[_0x3d66('0x2d')](handleEntityNotFound(_0x5c4a76,null))[_0x3d66('0x2d')](function(_0x23de89){if(_0x23de89){return db[_0x3d66('0x6d')][_0x3d66('0x6e')](function(_0x1e91fe){return db[_0x3d66('0x42')][_0x3d66('0x2e')]({'where':{'VoiceExtensionId':_0xa9bda7[_0x3d66('0x5a')]['id']},'transaction':_0x1e91fe})[_0x3d66('0x2d')](function(_0x3929d1){var _0x1477b5=_[_0x3d66('0x41')](_0xa9bda7['body'],function(_0x50e742){_0x50e742[_0x3d66('0x6f')]=_0xa9bda7[_0x3d66('0x5a')]['id'];return _0x50e742;});return db[_0x3d66('0x42')][_0x3d66('0x70')](_0x1477b5,{'transaction':_0x1e91fe});});})[_0x3d66('0x2d')](function(){return db[_0x3d66('0x42')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0xa9bda7[_0x3d66('0x5a')]['id']},'order':_0x3d66('0x71')});});}})['then'](respondWithResult(_0x5c4a76,null))['catch'](handleError(_0x5c4a76,null));}; \ No newline at end of file +var _0x9c03=['UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','VoiceExtension','findAll','rows','catch','show','params','keys','fields','merge','find','body','startsWith','exten','concat','create','user','role','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','map','value','includes'];(function(_0x350ab0,_0x577dcf){var _0x2f8878=function(_0x53ed41){while(--_0x53ed41){_0x350ab0['push'](_0x350ab0['shift']());}};_0x2f8878(++_0x577dcf);}(_0x9c03,0x18a));var _0x39c0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9c03[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39c0('0x0'));var zipdir=require(_0x39c0('0x1'));var jsonpatch=require(_0x39c0('0x2'));var rp=require(_0x39c0('0x3'));var moment=require(_0x39c0('0x4'));var BPromise=require(_0x39c0('0x5'));var Mustache=require(_0x39c0('0x6'));var util=require(_0x39c0('0x7'));var path=require('path');var sox=require(_0x39c0('0x8'));var csv=require(_0x39c0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39c0('0xa'));var _=require(_0x39c0('0xb'));var squel=require(_0x39c0('0xc'));var crypto=require(_0x39c0('0xd'));var jsforce=require(_0x39c0('0xe'));var deskjs=require(_0x39c0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x39c0('0x10'));var Papa=require('papaparse');var Redis=require(_0x39c0('0x11'));var authService=require(_0x39c0('0x12'));var qs=require(_0x39c0('0x13'));var as=require(_0x39c0('0x14'));var hardwareService=require(_0x39c0('0x15'));var logger=require(_0x39c0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x39c0('0x17'));var licenseUtil=require(_0x39c0('0x18'));var db=require(_0x39c0('0x19'))['db'];config[_0x39c0('0x1a')]=_[_0x39c0('0x1b')](config['redis'],{'host':_0x39c0('0x1c'),'port':0x18eb});var socket=require(_0x39c0('0x1d'))(new Redis(config['redis']));require(_0x39c0('0x1e'))['register'](socket);function respondWithStatusCode(_0x1294d7,_0x2190dd){_0x2190dd=_0x2190dd||0xcc;return function(_0x15d4d9){if(_0x15d4d9){return _0x1294d7[_0x39c0('0x1f')](_0x2190dd);}return _0x1294d7[_0x39c0('0x20')](_0x2190dd)['end']();};}function respondWithResult(_0xc05aae,_0x1d7125){_0x1d7125=_0x1d7125||0xc8;return function(_0xdf895c){if(_0xdf895c){return _0xc05aae[_0x39c0('0x20')](_0x1d7125)[_0x39c0('0x21')](_0xdf895c);}};}function respondWithFilteredResult(_0x3ee784,_0x27f453){return function(_0x1be3ab){if(_0x1be3ab){var _0x512c61=typeof _0x27f453[_0x39c0('0x22')]===_0x39c0('0x23')&&typeof _0x27f453['limit']===_0x39c0('0x23');var _0x282b1f=_0x1be3ab[_0x39c0('0x24')];var _0x346e06=_0x512c61?0x0:_0x27f453[_0x39c0('0x22')];var _0x2222bd=_0x512c61?_0x1be3ab[_0x39c0('0x24')]:_0x27f453[_0x39c0('0x22')]+_0x27f453[_0x39c0('0x25')];var _0x13e7ba;if(_0x2222bd>=_0x282b1f){_0x2222bd=_0x282b1f;_0x13e7ba=0xc8;}else{_0x13e7ba=0xce;}_0x3ee784[_0x39c0('0x20')](_0x13e7ba);return _0x3ee784[_0x39c0('0x26')](_0x39c0('0x27'),_0x346e06+'-'+_0x2222bd+'/'+_0x282b1f)[_0x39c0('0x21')](_0x1be3ab);}return null;};}function patchUpdates(_0x47fbb8){return function(_0x55fdd8){try{jsonpatch[_0x39c0('0x28')](_0x55fdd8,_0x47fbb8,!![]);}catch(_0x3526cf){return BPromise[_0x39c0('0x29')](_0x3526cf);}return _0x55fdd8[_0x39c0('0x2a')]();};}function saveUpdates(_0x2bbd50,_0x43d300){return function(_0x48f11f){if(_0x48f11f){return _0x48f11f['update'](_0x2bbd50)[_0x39c0('0x2b')](function(_0x4609b3){return _0x4609b3;});}return null;};}function removeEntity(_0xf1e3c,_0x10e3ac){return function(_0x4e7eb1){if(_0x4e7eb1){return _0x4e7eb1[_0x39c0('0x2c')]()[_0x39c0('0x2b')](function(){var _0x382621=_0x4e7eb1[_0x39c0('0x2d')]({'plain':!![]});var _0x254acd=[{'name':_0x39c0('0x2e'),'value':_0x39c0('0x2f'),'ignore':![]},{'name':_0x39c0('0x30'),'value':_0x39c0('0x31'),'ignore':![]},{'name':_0x39c0('0x32'),'value':'internal','ignore':![]}];var _0xeb716f=_(_0x254acd)['filter']('ignore')[_0x39c0('0x33')](_0x39c0('0x34'))[_0x39c0('0x34')]();if(_[_0x39c0('0x35')](_0xeb716f,_0x382621['type'])){return;}var _0x2b9b43=_['find'](_0x254acd,['value',_0x382621['type']])['name'];return db[_0x39c0('0x36')]['destroy']({'where':{'type':_0x2b9b43,'resourceId':_0x382621['id']}})[_0x39c0('0x2b')](function(){return _0x4e7eb1;});})[_0x39c0('0x2b')](function(){_0xf1e3c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23311b,_0x50042d){return function(_0x347c52){if(!_0x347c52){_0x23311b[_0x39c0('0x1f')](0x194);}return _0x347c52;};}function handleError(_0x4a1eae,_0x3baa8f){_0x3baa8f=_0x3baa8f||0x1f4;return function(_0x534daa){logger[_0x39c0('0x37')](_0x534daa[_0x39c0('0x38')]);if(_0x534daa['name']){delete _0x534daa[_0x39c0('0x39')];}_0x4a1eae[_0x39c0('0x20')](_0x3baa8f)[_0x39c0('0x3a')](_0x534daa);};}exports['index']=function(_0x262d63,_0x1880a3){var _0x1eaef6={},_0x207431={},_0x2ff8c0={'count':0x0,'rows':[]};var _0x33d63f=_[_0x39c0('0x33')](db['VoiceExtension'][_0x39c0('0x3b')],function(_0x1ab6cb){return{'name':_0x1ab6cb[_0x39c0('0x3c')],'type':_0x1ab6cb[_0x39c0('0x3d')][_0x39c0('0x3e')]};});_0x207431[_0x39c0('0x3f')]=_['map'](_0x33d63f,_0x39c0('0x39'));_0x207431['query']=_['keys'](_0x262d63[_0x39c0('0x40')]);_0x207431[_0x39c0('0x41')]=_[_0x39c0('0x42')](_0x207431['model'],_0x207431[_0x39c0('0x40')]);_0x1eaef6['attributes']=_[_0x39c0('0x42')](_0x207431[_0x39c0('0x3f')],qs['fields'](_0x262d63[_0x39c0('0x40')]['fields']));_0x1eaef6['attributes']=_0x1eaef6[_0x39c0('0x43')]['length']?_0x1eaef6[_0x39c0('0x43')]:_0x207431['model'];if(!_0x262d63[_0x39c0('0x40')][_0x39c0('0x44')](_0x39c0('0x45'))){_0x1eaef6[_0x39c0('0x25')]=qs['limit'](_0x262d63[_0x39c0('0x40')]['limit']);_0x1eaef6[_0x39c0('0x22')]=qs['offset'](_0x262d63[_0x39c0('0x40')]['offset']);}_0x1eaef6[_0x39c0('0x46')]=qs['sort'](_0x262d63[_0x39c0('0x40')][_0x39c0('0x47')]);_0x1eaef6['where']=qs['filters'](_[_0x39c0('0x48')](_0x262d63['query'],_0x207431[_0x39c0('0x41')]),_0x33d63f);if(_0x262d63['query']['filter']){_0x1eaef6['where']=_['merge'](_0x1eaef6[_0x39c0('0x49')],{'$or':_['map'](_0x33d63f,function(_0x4ed16e){if(_0x4ed16e['type']!==_0x39c0('0x4a')){var _0x581230={};_0x581230[_0x4ed16e[_0x39c0('0x39')]]={'$like':'%'+_0x262d63['query'][_0x39c0('0x4b')]+'%'};return _0x581230;}})});}_0x1eaef6=_['merge']({},_0x1eaef6,_0x262d63[_0x39c0('0x4c')]);var _0x42f2d4={'where':_0x1eaef6[_0x39c0('0x49')]};return db['VoiceExtension'][_0x39c0('0x24')](_0x42f2d4)['then'](function(_0x15eab9){_0x2ff8c0[_0x39c0('0x24')]=_0x15eab9;if(_0x262d63[_0x39c0('0x40')][_0x39c0('0x4d')]){_0x1eaef6[_0x39c0('0x4e')]=[{'all':!![]}];}return db[_0x39c0('0x4f')][_0x39c0('0x50')](_0x1eaef6);})[_0x39c0('0x2b')](function(_0x4b4085){_0x2ff8c0[_0x39c0('0x51')]=_0x4b4085;return _0x2ff8c0;})['then'](respondWithFilteredResult(_0x1880a3,_0x1eaef6))[_0x39c0('0x52')](handleError(_0x1880a3,null));};exports[_0x39c0('0x53')]=function(_0x2d3358,_0x20fc73){var _0x4992ba={'raw':![],'where':{'id':_0x2d3358[_0x39c0('0x54')]['id']}},_0x367353={};_0x367353[_0x39c0('0x3f')]=_['keys'](db[_0x39c0('0x4f')][_0x39c0('0x3b')]);_0x367353[_0x39c0('0x40')]=_[_0x39c0('0x55')](_0x2d3358[_0x39c0('0x40')]);_0x367353[_0x39c0('0x41')]=_[_0x39c0('0x42')](_0x367353[_0x39c0('0x3f')],_0x367353[_0x39c0('0x40')]);_0x4992ba['attributes']=_[_0x39c0('0x42')](_0x367353[_0x39c0('0x3f')],qs[_0x39c0('0x56')](_0x2d3358[_0x39c0('0x40')][_0x39c0('0x56')]));_0x4992ba[_0x39c0('0x43')]=_0x4992ba[_0x39c0('0x43')]['length']?_0x4992ba[_0x39c0('0x43')]:_0x367353[_0x39c0('0x3f')];if(_0x2d3358[_0x39c0('0x40')][_0x39c0('0x4d')]){_0x4992ba[_0x39c0('0x4e')]=[{'all':!![]}];}_0x4992ba=_[_0x39c0('0x57')]({},_0x4992ba,_0x2d3358[_0x39c0('0x4c')]);return db['VoiceExtension'][_0x39c0('0x58')](_0x4992ba)[_0x39c0('0x2b')](handleEntityNotFound(_0x20fc73,null))['then'](respondWithResult(_0x20fc73,null))[_0x39c0('0x52')](handleError(_0x20fc73,null));};exports[_0x39c0('0x2c')]=function(_0x343d38,_0x7b799c){return db['VoiceExtension'][_0x39c0('0x58')]({'where':{'id':_0x343d38['params']['id']}})[_0x39c0('0x2b')](handleEntityNotFound(_0x7b799c,null))['then'](removeEntity(_0x7b799c,null))[_0x39c0('0x52')](handleError(_0x7b799c,null));};exports['create']=function(_0x2c6da7,_0x274535){if(_0x2c6da7[_0x39c0('0x59')][_0x39c0('0x3d')]==='outbound'&&!_[_0x39c0('0x5a')](_0x2c6da7[_0x39c0('0x59')][_0x39c0('0x5b')],'_')){_0x2c6da7['body'][_0x39c0('0x5b')]='_'[_0x39c0('0x5c')](_0x2c6da7[_0x39c0('0x59')][_0x39c0('0x5b')]);}return db[_0x39c0('0x4f')][_0x39c0('0x5d')](_0x2c6da7[_0x39c0('0x59')],{'raw':![]})[_0x39c0('0x2b')](function(_0x18a35c){var _0x45aa23=_0x2c6da7[_0x39c0('0x5e')][_0x39c0('0x2d')]({'plain':!![]});if(!_0x45aa23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45aa23[_0x39c0('0x5f')]===_0x39c0('0x5e')){var _0x4395ac=_0x18a35c['get']({'plain':!![]});var _0x5bc99c=[{'name':_0x39c0('0x2e'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x39c0('0x31')},{'name':_0x39c0('0x32'),'value':_0x39c0('0x60')}];var _0x5c8c0c=_[_0x39c0('0x58')](_0x5bc99c,[_0x39c0('0x34'),_0x4395ac['type']])[_0x39c0('0x39')];return db[_0x39c0('0x61')]['find']({'where':{'name':_0x5c8c0c,'userProfileId':_0x45aa23[_0x39c0('0x62')]},'raw':!![]})[_0x39c0('0x2b')](function(_0x438790){if(_0x438790&&_0x438790[_0x39c0('0x63')]===0x0){return db[_0x39c0('0x36')][_0x39c0('0x5d')]({'name':_0x4395ac['name'],'resourceId':_0x4395ac['id'],'type':_0x438790[_0x39c0('0x39')],'sectionId':_0x438790['id']},{})[_0x39c0('0x2b')](function(){return _0x18a35c;});}else{return _0x18a35c;}})[_0x39c0('0x52')](function(_0x4f0282){logger[_0x39c0('0x37')](_0x39c0('0x64'),_0x4f0282);throw _0x4f0282;});}return _0x18a35c;})['then'](respondWithResult(_0x274535,0xc9))[_0x39c0('0x52')](handleError(_0x274535,null));};exports[_0x39c0('0x65')]=function(_0x5630c0,_0x42aa72){if(_0x5630c0['body']['id']){delete _0x5630c0['body']['id'];}return db[_0x39c0('0x4f')][_0x39c0('0x58')]({'where':{'id':_0x5630c0[_0x39c0('0x54')]['id']}})[_0x39c0('0x2b')](handleEntityNotFound(_0x42aa72,null))[_0x39c0('0x2b')](function(_0x5b2286){if(_0x5b2286){return db[_0x39c0('0x4f')][_0x39c0('0x65')](_['pick'](_0x5630c0[_0x39c0('0x59')],['exten',_0x39c0('0x66'),_0x39c0('0x67'),'recordingFormat',_0x39c0('0x68'),'mandatoryDisposition']),{'where':{'context':_0x5b2286['context'],'exten':_0x5b2286[_0x39c0('0x5b')]},'individualHooks':!![]})[_0x39c0('0x2b')](function(_0x19af25){return _0x19af25;});}return null;})[_0x39c0('0x2b')](respondWithStatusCode(_0x42aa72,null))[_0x39c0('0x52')](handleError(_0x42aa72,null));};exports['addApplications']=function(_0x4db4ba,_0x32a372,_0x3be88b){return db[_0x39c0('0x4f')][_0x39c0('0x69')]({'where':{'id':_0x4db4ba[_0x39c0('0x54')]['id']}})[_0x39c0('0x2b')](handleEntityNotFound(_0x32a372,null))[_0x39c0('0x2b')](function(_0x39b402){if(_0x39b402){return db[_0x39c0('0x6a')][_0x39c0('0x6b')](function(_0x42144d){return db[_0x39c0('0x4f')][_0x39c0('0x2c')]({'where':{'VoiceExtensionId':_0x4db4ba[_0x39c0('0x54')]['id']},'transaction':_0x42144d})[_0x39c0('0x2b')](function(_0x14056c){var _0x27b584=_['map'](_0x4db4ba[_0x39c0('0x59')],function(_0x7768e1){_0x7768e1[_0x39c0('0x6c')]=_0x4db4ba['params']['id'];return _0x7768e1;});return db['VoiceExtension'][_0x39c0('0x6d')](_0x27b584,{'transaction':_0x42144d});});})[_0x39c0('0x2b')](function(){return db[_0x39c0('0x4f')][_0x39c0('0x6e')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4db4ba['params']['id']},'order':_0x39c0('0x6f')});});}})[_0x39c0('0x2b')](respondWithResult(_0x32a372,null))[_0x39c0('0x52')](handleError(_0x32a372,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 0d1d860..66ea2ed 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 _0xd6a2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1c579b,_0x2fc27e){var _0x1e5999=function(_0x288dc2){while(--_0x288dc2){_0x1c579b['push'](_0x1c579b['shift']());}};_0x1e5999(++_0x2fc27e);}(_0xd6a2,0x115));var _0x2d6a=function(_0x53be6f,_0x294424){_0x53be6f=_0x53be6f-0x0;var _0x63abd5=_0xd6a2[_0x53be6f];return _0x63abd5;};'use strict';var EventEmitter=require(_0x2d6a('0x0'));var VoiceExtension=require(_0x2d6a('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2d6a('0x2')](0x0);var events={'afterCreate':_0x2d6a('0x3'),'afterUpdate':_0x2d6a('0x4'),'afterDestroy':_0x2d6a('0x5')};function emitEvent(_0x58b1ca){return function(_0x1913dc,_0x27376f,_0x1fc087){VoiceExtensionEvents[_0x2d6a('0x6')](_0x58b1ca+':'+_0x1913dc['id'],_0x1913dc);VoiceExtensionEvents[_0x2d6a('0x6')](_0x58b1ca,_0x1913dc);_0x1fc087(null);};}for(var e in events){if(events[_0x2d6a('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x2d6a('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6aa1=['remove','emit','hasOwnProperty','hook','exports','VoiceExtension','setMaxListeners','save','update'];(function(_0x47344b,_0x41ee27){var _0x357300=function(_0x55579f){while(--_0x55579f){_0x47344b['push'](_0x47344b['shift']());}};_0x357300(++_0x41ee27);}(_0x6aa1,0x1b5));var _0x16aa=function(_0x5c53b4,_0x20bbfc){_0x5c53b4=_0x5c53b4-0x0;var _0x1ec658=_0x6aa1[_0x5c53b4];return _0x1ec658;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x16aa('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x16aa('0x1')](0x0);var events={'afterCreate':_0x16aa('0x2'),'afterUpdate':_0x16aa('0x3'),'afterDestroy':_0x16aa('0x4')};function emitEvent(_0x4aaa8f){return function(_0x33806f,_0x3c93c4,_0xd4e210){VoiceExtensionEvents[_0x16aa('0x5')](_0x4aaa8f+':'+_0x33806f['id'],_0x33806f);VoiceExtensionEvents[_0x16aa('0x5')](_0x4aaa8f,_0x33806f);_0xd4e210(null);};}for(var e in events){if(events[_0x16aa('0x6')](e)){var event=events[e];VoiceExtension[_0x16aa('0x7')](e,emitEvent(event));}}module[_0x16aa('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 928f668..698c7f5 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 _0x4b48=['request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb12c0a,_0x42b9f1){var _0x4a05b3=function(_0x342bc8){while(--_0x342bc8){_0xb12c0a['push'](_0xb12c0a['shift']());}};_0x4a05b3(++_0x42b9f1);}(_0x4b48,0x171));var _0x84b4=function(_0x2705af,_0x10a7b5){_0x2705af=_0x2705af-0x0;var _0x1a4ac8=_0x4b48[_0x2705af];return _0x1a4ac8;};'use strict';var _=require(_0x84b4('0x0'));var util=require(_0x84b4('0x1'));var logger=require(_0x84b4('0x2'))(_0x84b4('0x3'));var moment=require(_0x84b4('0x4'));var BPromise=require(_0x84b4('0x5'));var rp=require(_0x84b4('0x6'));var fs=require('fs');var path=require(_0x84b4('0x7'));var rimraf=require(_0x84b4('0x8'));var config=require(_0x84b4('0x9'));var attributes=require(_0x84b4('0xa'));module[_0x84b4('0xb')]=function(_0x375e9f,_0x3cdaf0){return _0x375e9f[_0x84b4('0xc')](_0x84b4('0xd'),attributes,{'tableName':_0x84b4('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa85c=['rimraf','../../config/environment','./voiceExtension.attributes','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x27d402,_0x26a705){var _0x383012=function(_0x3b406f){while(--_0x3b406f){_0x27d402['push'](_0x27d402['shift']());}};_0x383012(++_0x26a705);}(_0xa85c,0x14b));var _0xca85=function(_0x353c53,_0x2102c0){_0x353c53=_0x353c53-0x0;var _0x2c55da=_0xa85c[_0x353c53];return _0x2c55da;};'use strict';var _=require(_0xca85('0x0'));var util=require(_0xca85('0x1'));var logger=require(_0xca85('0x2'))(_0xca85('0x3'));var moment=require(_0xca85('0x4'));var BPromise=require('bluebird');var rp=require(_0xca85('0x5'));var fs=require('fs');var path=require(_0xca85('0x6'));var rimraf=require(_0xca85('0x7'));var config=require(_0xca85('0x8'));var attributes=require(_0xca85('0x9'));module['exports']=function(_0x11449f,_0x288cfb){return _0x11449f[_0xca85('0xa')](_0xca85('0xb'),attributes,{'tableName':_0xca85('0xc'),'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 8c9a9b3..a7f3da4 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 _0xbc14=['../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','result','catch','VoiceExtension','findAll','options','raw','where','attributes','map','include','model','GetVoiceExtension','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2a73c4,_0x1ec1be){var _0x1f5583=function(_0x2b14d6){while(--_0x2b14d6){_0x2a73c4['push'](_0x2a73c4['shift']());}};_0x1f5583(++_0x1ec1be);}(_0xbc14,0x1e6));var _0x4bc1=function(_0x3a980f,_0x49e4d6){_0x3a980f=_0x3a980f-0x0;var _0x36010f=_0xbc14[_0x3a980f];return _0x36010f;};'use strict';var _=require(_0x4bc1('0x0'));var util=require(_0x4bc1('0x1'));var moment=require('moment');var BPromise=require(_0x4bc1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bc1('0x3'));var db=require(_0x4bc1('0x4'))['db'];var utils=require(_0x4bc1('0x5'));var logger=require(_0x4bc1('0x6'))(_0x4bc1('0x7'));var config=require(_0x4bc1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4bc1('0x9')][_0x4bc1('0xa')]({'port':0x232a});config[_0x4bc1('0xb')]=_['defaults'](config[_0x4bc1('0xb')],{'host':_0x4bc1('0xc'),'port':0x18eb});var socket=require(_0x4bc1('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x4bc1('0xe')](socket);function respondWithRpcPromise(_0xcb03fe,_0x263546,_0x5ad962){return new BPromise(function(_0x5dc771,_0x2ef1ca){return client[_0x4bc1('0xf')](_0xcb03fe,_0x5ad962)[_0x4bc1('0x10')](function(_0x4f2e3f){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x263546,_0x4bc1('0x11'));logger[_0x4bc1('0x12')](_0x4bc1('0x13'),_0x263546,_0x4bc1('0x11'),JSON[_0x4bc1('0x14')](_0x4f2e3f));if(_0x4f2e3f['error']){if(_0x4f2e3f[_0x4bc1('0x15')][_0x4bc1('0x16')]===0x1f4){logger[_0x4bc1('0x15')](_0x4bc1('0x17'),_0x263546,_0x4f2e3f[_0x4bc1('0x15')][_0x4bc1('0x18')]);return _0x2ef1ca(_0x4f2e3f[_0x4bc1('0x15')]['message']);}logger[_0x4bc1('0x15')](_0x4bc1('0x17'),_0x263546,_0x4f2e3f['error'][_0x4bc1('0x18')]);return _0x5dc771(_0x4f2e3f[_0x4bc1('0x15')][_0x4bc1('0x18')]);}else{logger[_0x4bc1('0x19')](_0x4bc1('0x17'),_0x263546,'request\x20sent');_0x5dc771(_0x4f2e3f[_0x4bc1('0x1a')][_0x4bc1('0x18')]);}})[_0x4bc1('0x1b')](function(_0x34f3de){logger[_0x4bc1('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x263546,_0x34f3de);_0x2ef1ca(_0x34f3de);});});}exports['GetVoiceExtension']=function(_0x18e2ab){var _0x12f624=this;return new Promise(function(_0x1e1cf3,_0x5b73e1){return db[_0x4bc1('0x1c')][_0x4bc1('0x1d')]({'raw':_0x18e2ab['options']?_0x18e2ab[_0x4bc1('0x1e')][_0x4bc1('0x1f')]===undefined?!![]:![]:!![],'where':_0x18e2ab[_0x4bc1('0x1e')]?_0x18e2ab[_0x4bc1('0x1e')][_0x4bc1('0x20')]||null:null,'attributes':_0x18e2ab[_0x4bc1('0x1e')]?_0x18e2ab[_0x4bc1('0x1e')][_0x4bc1('0x21')]||null:null,'limit':_0x18e2ab[_0x4bc1('0x1e')]?_0x18e2ab['options']['limit']||null:null,'include':_0x18e2ab[_0x4bc1('0x1e')]?_0x18e2ab['options']['include']?_[_0x4bc1('0x22')](_0x18e2ab[_0x4bc1('0x1e')][_0x4bc1('0x23')],function(_0xd97418){return{'model':db[_0xd97418[_0x4bc1('0x24')]],'as':_0xd97418['as'],'attributes':_0xd97418[_0x4bc1('0x21')],'include':_0xd97418[_0x4bc1('0x23')]?_[_0x4bc1('0x22')](_0xd97418[_0x4bc1('0x23')],function(_0x262f9f){return{'model':db[_0x262f9f['model']],'as':_0x262f9f['as'],'attributes':_0x262f9f[_0x4bc1('0x21')],'include':_0x262f9f['include']?_[_0x4bc1('0x22')](_0x262f9f[_0x4bc1('0x23')],function(_0x5bcf78){return{'model':db[_0x5bcf78[_0x4bc1('0x24')]],'as':_0x5bcf78['as'],'attributes':_0x5bcf78[_0x4bc1('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f8a6d){logger[_0x4bc1('0x19')](_0x4bc1('0x25'),_0x18e2ab);logger['debug'](_0x4bc1('0x25'),_0x18e2ab,JSON[_0x4bc1('0x14')](_0x3f8a6d));_0x1e1cf3(_0x3f8a6d);})['catch'](function(_0x4bb292){logger['error'](_0x4bc1('0x25'),_0x4bb292[_0x4bc1('0x18')],_0x18e2ab);_0x5b73e1(_0x12f624[_0x4bc1('0x15')](0x1f4,_0x4bb292[_0x4bc1('0x18')]));});});}; \ No newline at end of file +var _0x2ffb=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','result','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceExtension','stringify','util','moment'];(function(_0x116ff3,_0x28e6d3){var _0x898bfb=function(_0x58efdb){while(--_0x58efdb){_0x116ff3['push'](_0x116ff3['shift']());}};_0x898bfb(++_0x28e6d3);}(_0x2ffb,0x11e));var _0xb2ff=function(_0x349077,_0x2eafb1){_0x349077=_0x349077-0x0;var _0x277000=_0x2ffb[_0x349077];return _0x277000;};'use strict';var _=require('lodash');var util=require(_0xb2ff('0x0'));var moment=require(_0xb2ff('0x1'));var BPromise=require(_0xb2ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2ff('0x3'));var db=require(_0xb2ff('0x4'))['db'];var utils=require(_0xb2ff('0x5'));var logger=require(_0xb2ff('0x6'))(_0xb2ff('0x7'));var config=require(_0xb2ff('0x8'));var jayson=require(_0xb2ff('0x9'));var client=jayson['client'][_0xb2ff('0xa')]({'port':0x232a});config['redis']=_[_0xb2ff('0xb')](config[_0xb2ff('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2ff('0xc')]));require(_0xb2ff('0xd'))[_0xb2ff('0xe')](socket);function respondWithRpcPromise(_0x4e8253,_0xbac5b2,_0x5e4530){return new BPromise(function(_0xa8c837,_0x4c3992){return client[_0xb2ff('0xf')](_0x4e8253,_0x5e4530)[_0xb2ff('0x10')](function(_0x23a7d1){logger[_0xb2ff('0x11')](_0xb2ff('0x12'),_0xbac5b2,_0xb2ff('0x13'));logger['debug'](_0xb2ff('0x14'),_0xbac5b2,_0xb2ff('0x13'),JSON['stringify'](_0x23a7d1));if(_0x23a7d1[_0xb2ff('0x15')]){if(_0x23a7d1[_0xb2ff('0x15')]['code']===0x1f4){logger[_0xb2ff('0x15')](_0xb2ff('0x12'),_0xbac5b2,_0x23a7d1[_0xb2ff('0x15')][_0xb2ff('0x16')]);return _0x4c3992(_0x23a7d1[_0xb2ff('0x15')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0xbac5b2,_0x23a7d1[_0xb2ff('0x15')][_0xb2ff('0x16')]);return _0xa8c837(_0x23a7d1[_0xb2ff('0x15')][_0xb2ff('0x16')]);}else{logger[_0xb2ff('0x11')](_0xb2ff('0x12'),_0xbac5b2,'request\x20sent');_0xa8c837(_0x23a7d1[_0xb2ff('0x17')][_0xb2ff('0x16')]);}})['catch'](function(_0x2e51f6){logger[_0xb2ff('0x15')](_0xb2ff('0x12'),_0xbac5b2,_0x2e51f6);_0x4c3992(_0x2e51f6);});});}exports['GetVoiceExtension']=function(_0x25466a){var _0x1b44c2=this;return new Promise(function(_0x175ecb,_0x284bd1){return db[_0xb2ff('0x18')][_0xb2ff('0x19')]({'raw':_0x25466a['options']?_0x25466a[_0xb2ff('0x1a')][_0xb2ff('0x1b')]===undefined?!![]:![]:!![],'where':_0x25466a[_0xb2ff('0x1a')]?_0x25466a[_0xb2ff('0x1a')][_0xb2ff('0x1c')]||null:null,'attributes':_0x25466a[_0xb2ff('0x1a')]?_0x25466a[_0xb2ff('0x1a')][_0xb2ff('0x1d')]||null:null,'limit':_0x25466a[_0xb2ff('0x1a')]?_0x25466a[_0xb2ff('0x1a')][_0xb2ff('0x1e')]||null:null,'include':_0x25466a[_0xb2ff('0x1a')]?_0x25466a[_0xb2ff('0x1a')]['include']?_['map'](_0x25466a['options'][_0xb2ff('0x1f')],function(_0xe318f2){return{'model':db[_0xe318f2[_0xb2ff('0x20')]],'as':_0xe318f2['as'],'attributes':_0xe318f2[_0xb2ff('0x1d')],'include':_0xe318f2['include']?_[_0xb2ff('0x21')](_0xe318f2[_0xb2ff('0x1f')],function(_0xd8de5){return{'model':db[_0xd8de5[_0xb2ff('0x20')]],'as':_0xd8de5['as'],'attributes':_0xd8de5[_0xb2ff('0x1d')],'include':_0xd8de5['include']?_[_0xb2ff('0x21')](_0xd8de5[_0xb2ff('0x1f')],function(_0x86bb3b){return{'model':db[_0x86bb3b[_0xb2ff('0x20')]],'as':_0x86bb3b['as'],'attributes':_0x86bb3b[_0xb2ff('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb2ff('0x10')](function(_0x34e2b0){logger[_0xb2ff('0x11')](_0xb2ff('0x22'),_0x25466a);logger['debug'](_0xb2ff('0x22'),_0x25466a,JSON[_0xb2ff('0x23')](_0x34e2b0));_0x175ecb(_0x34e2b0);})['catch'](function(_0x25ed84){logger[_0xb2ff('0x15')]('GetVoiceExtension',_0x25ed84[_0xb2ff('0x16')],_0x25466a);_0x284bd1(_0x1b44c2[_0xb2ff('0x15')](0x1f4,_0x25ed84[_0xb2ff('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8b4affb..daccb67 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 _0xf8c7=['length','voiceExtension:','save','update','emit','removeListener','register'];(function(_0x5a75f7,_0x1bdb5b){var _0x3619da=function(_0x55402a){while(--_0x55402a){_0x5a75f7['push'](_0x5a75f7['shift']());}};_0x3619da(++_0x1bdb5b);}(_0xf8c7,0x1d7));var _0x7f8c=function(_0x198666,_0x472745){_0x198666=_0x198666-0x0;var _0x502ce5=_0xf8c7[_0x198666];return _0x502ce5;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x7f8c('0x0'),'remove',_0x7f8c('0x1')];function createListener(_0x15109f,_0xf2b17d){return function(_0x17fc5b){_0xf2b17d[_0x7f8c('0x2')](_0x15109f,_0x17fc5b);};}function removeListener(_0x348b87,_0x3d64e2){return function(){VoiceExtensionEvents[_0x7f8c('0x3')](_0x348b87,_0x3d64e2);};}exports[_0x7f8c('0x4')]=function(_0x5b030a){for(var _0x462ca9=0x0,_0x1ad27b=events[_0x7f8c('0x5')];_0x462ca9<_0x1ad27b;_0x462ca9++){var _0x4e2d34=events[_0x462ca9];var _0x2f3755=createListener(_0x7f8c('0x6')+_0x4e2d34,_0x5b030a);VoiceExtensionEvents['on'](_0x4e2d34,_0x2f3755);}}; \ No newline at end of file +var _0xa07d=['update','./voiceExtension.events','save'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0xa07d,0xbe));var _0xda07=function(_0x408457,_0x1e0b2e){_0x408457=_0x408457-0x0;var _0x194afd=_0xa07d[_0x408457];return _0x194afd;};'use strict';var VoiceExtensionEvents=require(_0xda07('0x0'));var events=[_0xda07('0x1'),'remove',_0xda07('0x2')];function createListener(_0x39f349,_0x318bef){return function(_0x2cc40c){_0x318bef['emit'](_0x39f349,_0x2cc40c);};}function removeListener(_0x12fff8,_0x15752d){return function(){VoiceExtensionEvents['removeListener'](_0x12fff8,_0x15752d);};}exports['register']=function(_0x544fec){for(var _0x3f7f87=0x0,_0x5b00ed=events['length'];_0x3f7f87<_0x5b00ed;_0x3f7f87++){var _0x39ba30=events[_0x3f7f87];var _0x3e6743=createListener('voiceExtension:'+_0x39ba30,_0x544fec);VoiceExtensionEvents['on'](_0x39ba30,_0x3e6743);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index bf2e017..499cae0 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 _0xa149=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4aa174,_0x4270f3){var _0x376f7e=function(_0x2d42d5){while(--_0x2d42d5){_0x4aa174['push'](_0x4aa174['shift']());}};_0x376f7e(++_0x4270f3);}(_0xa149,0x18c));var _0x9a14=function(_0x3ea2f4,_0x58f806){_0x3ea2f4=_0x3ea2f4-0x0;var _0x384245=_0xa149[_0x3ea2f4];return _0x384245;};'use strict';var multer=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var path=require(_0x9a14('0x2'));var timeout=require(_0x9a14('0x3'));var express=require(_0x9a14('0x4'));var router=express[_0x9a14('0x5')]();var fs_extra=require(_0x9a14('0x6'));var auth=require(_0x9a14('0x7'));var interaction=require(_0x9a14('0x8'));var config=require('../../config/environment');var controller=require(_0x9a14('0x9'));router[_0x9a14('0xa')]('/',auth['isAuthenticated'](),controller[_0x9a14('0xb')]);router[_0x9a14('0xa')](_0x9a14('0xc'),auth[_0x9a14('0xd')](),controller[_0x9a14('0xe')]);router[_0x9a14('0xa')]('/:id/messages',auth[_0x9a14('0xd')](),controller['getMessages']);router[_0x9a14('0xf')]('/',auth[_0x9a14('0xd')](),controller[_0x9a14('0x10')]);router[_0x9a14('0x11')](_0x9a14('0xc'),auth[_0x9a14('0xd')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9a14('0x12')]);module[_0x9a14('0x13')]=router; \ No newline at end of file +var _0x422f=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages','post','put','/:id','update','delete','destroy','util'];(function(_0x42a433,_0x4a3052){var _0x4b1bd4=function(_0xae45d1){while(--_0xae45d1){_0x42a433['push'](_0x42a433['shift']());}};_0x4b1bd4(++_0x4a3052);}(_0x422f,0x1c7));var _0xf422=function(_0x1b0a2e,_0x87952c){_0x1b0a2e=_0x1b0a2e-0x0;var _0x13ebd7=_0x422f[_0x1b0a2e];return _0x13ebd7;};'use strict';var multer=require('multer');var util=require(_0xf422('0x0'));var path=require('path');var timeout=require(_0xf422('0x1'));var express=require(_0xf422('0x2'));var router=express['Router']();var fs_extra=require(_0xf422('0x3'));var auth=require(_0xf422('0x4'));var interaction=require(_0xf422('0x5'));var config=require(_0xf422('0x6'));var controller=require(_0xf422('0x7'));router[_0xf422('0x8')]('/',auth[_0xf422('0x9')](),controller[_0xf422('0xa')]);router[_0xf422('0x8')]('/:id',auth[_0xf422('0x9')](),controller[_0xf422('0xb')]);router[_0xf422('0x8')](_0xf422('0xc'),auth[_0xf422('0x9')](),controller['getMessages']);router[_0xf422('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf422('0xe')](_0xf422('0xf'),auth[_0xf422('0x9')](),controller[_0xf422('0x10')]);router[_0xf422('0x11')]('/:id',auth[_0xf422('0x9')](),controller[_0xf422('0x12')]);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 9d661d3..909b5a3 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 _0xac4a=['contest_mailbox','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x188a0a,_0x4ad3bb){var _0x3cc66d=function(_0x5eba09){while(--_0x5eba09){_0x188a0a['push'](_0x188a0a['shift']());}};_0x3cc66d(++_0x4ad3bb);}(_0xac4a,0x13f));var _0xaac4=function(_0x2a3f19,_0xa4969c){_0x2a3f19=_0x2a3f19-0x0;var _0x51f9db=_0xac4a[_0x2a3f19];return _0x51f9db;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'customer_id':{'type':Sequelize[_0xaac4('0x2')]},'context':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x3'),'unique':_0xaac4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xaac4('0x2')]},'fullname':{'type':Sequelize[_0xaac4('0x2')]},'email':{'type':Sequelize[_0xaac4('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58ae95){this[_0xaac4('0x5')]('email',typeof _0x58ae95===_0xaac4('0x6')&&_0x58ae95['trim']()?_0x58ae95[_0xaac4('0x7')]():null);}},'pager':{'type':Sequelize[_0xaac4('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xaac4('0x2')]},'callback':{'type':Sequelize[_0xaac4('0x2')]},'review':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xaac4('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'stamp':{'type':_0xaac4('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xaac4('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xaac4('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xaac4('0xd')](_0xaac4('0xe'))+_0xaac4('0xf')+this[_0xaac4('0xd')](_0xaac4('0x10'));}}}; \ No newline at end of file +var _0x6cb4=['fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0x30b31d,_0x294a84){var _0x3e8edd=function(_0x22e645){while(--_0x22e645){_0x30b31d['push'](_0x30b31d['shift']());}};_0x3e8edd(++_0x294a84);}(_0x6cb4,0xff));var _0x46cb=function(_0x4f7daf,_0x27c135){_0x4f7daf=_0x4f7daf-0x0;var _0x5a2d86=_0x6cb4[_0x4f7daf];return _0x5a2d86;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'customer_id':{'type':Sequelize[_0x46cb('0x2')]},'context':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':_0x46cb('0x3'),'unique':_0x46cb('0x4')},'mailbox':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':'','allowNull':![],'unique':_0x46cb('0x4')},'password':{'type':Sequelize[_0x46cb('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x46cb('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5cb9a4){this[_0x46cb('0x5')]('email',typeof _0x5cb9a4===_0x46cb('0x6')&&_0x5cb9a4[_0x46cb('0x7')]()?_0x5cb9a4[_0x46cb('0x7')]():null);}},'pager':{'type':Sequelize[_0x46cb('0x2')]},'tz':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':_0x46cb('0x8')},'attach':{'type':Sequelize['ENUM'](_0x46cb('0x9'),'no'),'defaultValue':_0x46cb('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x46cb('0x9'),'no'),'defaultValue':_0x46cb('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x46cb('0x2')]},'review':{'type':Sequelize[_0x46cb('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':_0x46cb('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x46cb('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x46cb('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x46cb('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x46cb('0xd')],'get':function(){return this[_0x46cb('0xe')](_0x46cb('0xf'))+_0x46cb('0x10')+this[_0x46cb('0xe')](_0x46cb('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 14d415c..d594171 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 _0xae2a=['rows','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','hasOwnProperty','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xae2a,0xc8));var _0xaae2=function(_0xd8bae9,_0x50c977){_0xd8bae9=_0xd8bae9-0x0;var _0x115306=_0xae2a[_0xd8bae9];return _0x115306;};'use strict';var emlformat=require(_0xaae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaae2('0x2'));var moment=require(_0xaae2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaae2('0x4'));var util=require(_0xaae2('0x5'));var path=require(_0xaae2('0x6'));var sox=require('sox');var csv=require(_0xaae2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaae2('0x8'));var _=require(_0xaae2('0x9'));var squel=require('squel');var crypto=require(_0xaae2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaae2('0xb'));var toCsv=require(_0xaae2('0x7'));var querystring=require('querystring');var Papa=require(_0xaae2('0xc'));var Redis=require(_0xaae2('0xd'));var authService=require(_0xaae2('0xe'));var qs=require(_0xaae2('0xf'));var as=require(_0xaae2('0x10'));var hardwareService=require(_0xaae2('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xaae2('0x12'));var config=require(_0xaae2('0x13'));var licenseUtil=require(_0xaae2('0x14'));var db=require(_0xaae2('0x15'))['db'];function respondWithStatusCode(_0x30b34b,_0x246f01){_0x246f01=_0x246f01||0xcc;return function(_0x452805){if(_0x452805){return _0x30b34b['sendStatus'](_0x246f01);}return _0x30b34b[_0xaae2('0x16')](_0x246f01)[_0xaae2('0x17')]();};}function respondWithResult(_0x5bb199,_0x4d90cc){_0x4d90cc=_0x4d90cc||0xc8;return function(_0x769283){if(_0x769283){return _0x5bb199[_0xaae2('0x16')](_0x4d90cc)[_0xaae2('0x18')](_0x769283);}};}function respondWithFilteredResult(_0x2b2f09,_0x184112){return function(_0x2d671e){if(_0x2d671e){var _0x350dee=typeof _0x184112[_0xaae2('0x19')]===_0xaae2('0x1a')&&typeof _0x184112['limit']===_0xaae2('0x1a');var _0x27c6d3=_0x2d671e[_0xaae2('0x1b')];var _0x495567=_0x350dee?0x0:_0x184112[_0xaae2('0x19')];var _0x48c279=_0x350dee?_0x2d671e[_0xaae2('0x1b')]:_0x184112[_0xaae2('0x19')]+_0x184112[_0xaae2('0x1c')];var _0x467428;if(_0x48c279>=_0x27c6d3){_0x48c279=_0x27c6d3;_0x467428=0xc8;}else{_0x467428=0xce;}_0x2b2f09[_0xaae2('0x16')](_0x467428);return _0x2b2f09['set']('Content-Range',_0x495567+'-'+_0x48c279+'/'+_0x27c6d3)[_0xaae2('0x18')](_0x2d671e);}return null;};}function patchUpdates(_0x24e978){return function(_0x4a0f1d){try{jsonpatch[_0xaae2('0x1d')](_0x4a0f1d,_0x24e978,!![]);}catch(_0x48d28f){return BPromise[_0xaae2('0x1e')](_0x48d28f);}return _0x4a0f1d[_0xaae2('0x1f')]();};}function saveUpdates(_0x198ced,_0x473a3f){return function(_0x2e7493){if(_0x2e7493){return _0x2e7493['update'](_0x198ced)[_0xaae2('0x20')](function(_0x19dd13){return _0x19dd13;});}return null;};}function removeEntity(_0x3fa80f,_0x1761b6){return function(_0x37dc20){if(_0x37dc20){return _0x37dc20[_0xaae2('0x21')]()[_0xaae2('0x20')](function(){var _0x5c3513=_0x37dc20[_0xaae2('0x22')]({'plain':!![]});var _0x16b5ad=_0xaae2('0x23');return db[_0xaae2('0x24')]['destroy']({'where':{'type':_0x16b5ad,'resourceId':_0x5c3513['id']}})['then'](function(){return _0x37dc20;});})[_0xaae2('0x20')](function(){_0x3fa80f[_0xaae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420c00,_0x5b9c08){return function(_0x28a42c){if(!_0x28a42c){_0x420c00[_0xaae2('0x25')](0x194);}return _0x28a42c;};}function handleError(_0x2cba10,_0x56fa36){_0x56fa36=_0x56fa36||0x1f4;return function(_0x16da81){logger['error'](_0x16da81[_0xaae2('0x26')]);if(_0x16da81[_0xaae2('0x27')]){delete _0x16da81[_0xaae2('0x27')];}_0x2cba10[_0xaae2('0x16')](_0x56fa36)[_0xaae2('0x28')](_0x16da81);};}exports[_0xaae2('0x29')]=function(_0x32d13d,_0x18c3cf){var _0x1c032f={},_0x471628={},_0xfbadb5={'count':0x0,'rows':[]};var _0x24c00d=_[_0xaae2('0x2a')](db[_0xaae2('0x2b')][_0xaae2('0x2c')],function(_0x3ed41f){return{'name':_0x3ed41f[_0xaae2('0x2d')],'type':_0x3ed41f[_0xaae2('0x2e')][_0xaae2('0x2f')]};});_0x471628[_0xaae2('0x30')]=_[_0xaae2('0x2a')](_0x24c00d,_0xaae2('0x27'));_0x471628[_0xaae2('0x31')]=_[_0xaae2('0x32')](_0x32d13d[_0xaae2('0x31')]);_0x471628['filters']=_['intersection'](_0x471628[_0xaae2('0x30')],_0x471628[_0xaae2('0x31')]);_0x1c032f[_0xaae2('0x33')]=_[_0xaae2('0x34')](_0x471628[_0xaae2('0x30')],qs[_0xaae2('0x35')](_0x32d13d['query']['fields']));_0x1c032f[_0xaae2('0x33')]=_0x1c032f['attributes']['length']?_0x1c032f[_0xaae2('0x33')]:_0x471628[_0xaae2('0x30')];if(!_0x32d13d['query']['hasOwnProperty'](_0xaae2('0x36'))){_0x1c032f[_0xaae2('0x1c')]=qs['limit'](_0x32d13d['query'][_0xaae2('0x1c')]);_0x1c032f['offset']=qs['offset'](_0x32d13d[_0xaae2('0x31')][_0xaae2('0x19')]);}_0x1c032f[_0xaae2('0x37')]=qs[_0xaae2('0x38')](_0x32d13d[_0xaae2('0x31')][_0xaae2('0x38')]);_0x1c032f[_0xaae2('0x39')]=qs[_0xaae2('0x3a')](_['pick'](_0x32d13d[_0xaae2('0x31')],_0x471628['filters']),_0x24c00d);if(_0x32d13d[_0xaae2('0x31')][_0xaae2('0x3b')]){_0x1c032f['where']=_[_0xaae2('0x3c')](_0x1c032f[_0xaae2('0x39')],{'$or':_[_0xaae2('0x2a')](_0x24c00d,function(_0xf869be){if(_0xf869be[_0xaae2('0x2e')]!==_0xaae2('0x3d')){var _0x517374={};_0x517374[_0xf869be[_0xaae2('0x27')]]={'$like':'%'+_0x32d13d[_0xaae2('0x31')][_0xaae2('0x3b')]+'%'};return _0x517374;}})});}_0x1c032f=_[_0xaae2('0x3c')]({},_0x1c032f,_0x32d13d[_0xaae2('0x3e')]);var _0x43579a={'where':_0x1c032f[_0xaae2('0x39')]};return db[_0xaae2('0x2b')][_0xaae2('0x1b')](_0x43579a)[_0xaae2('0x20')](function(_0x38d634){_0xfbadb5[_0xaae2('0x1b')]=_0x38d634;if(_0x32d13d[_0xaae2('0x31')]['includeAll']){_0x1c032f[_0xaae2('0x3f')]=[{'all':!![]}];}return db[_0xaae2('0x2b')]['findAll'](_0x1c032f);})[_0xaae2('0x20')](function(_0x37277d){_0xfbadb5[_0xaae2('0x40')]=_0x37277d;return _0xfbadb5;})[_0xaae2('0x20')](respondWithFilteredResult(_0x18c3cf,_0x1c032f))[_0xaae2('0x41')](handleError(_0x18c3cf,null));};exports[_0xaae2('0x42')]=function(_0x2aa0c9,_0xbee0c0){var _0x426954={'raw':!![],'where':{'id':_0x2aa0c9[_0xaae2('0x43')]['id']}},_0x1f74ff={};_0x1f74ff[_0xaae2('0x30')]=_[_0xaae2('0x32')](db[_0xaae2('0x2b')][_0xaae2('0x2c')]);_0x1f74ff[_0xaae2('0x31')]=_[_0xaae2('0x32')](_0x2aa0c9[_0xaae2('0x31')]);_0x1f74ff['filters']=_[_0xaae2('0x34')](_0x1f74ff['model'],_0x1f74ff[_0xaae2('0x31')]);_0x426954[_0xaae2('0x33')]=_['intersection'](_0x1f74ff[_0xaae2('0x30')],qs[_0xaae2('0x35')](_0x2aa0c9['query'][_0xaae2('0x35')]));_0x426954[_0xaae2('0x33')]=_0x426954[_0xaae2('0x33')][_0xaae2('0x44')]?_0x426954[_0xaae2('0x33')]:_0x1f74ff[_0xaae2('0x30')];if(_0x2aa0c9['query'][_0xaae2('0x45')]){_0x426954['include']=[{'all':!![]}];}_0x426954=_[_0xaae2('0x3c')]({},_0x426954,_0x2aa0c9[_0xaae2('0x3e')]);return db[_0xaae2('0x2b')][_0xaae2('0x46')](_0x426954)[_0xaae2('0x20')](handleEntityNotFound(_0xbee0c0,null))[_0xaae2('0x20')](respondWithResult(_0xbee0c0,null))[_0xaae2('0x41')](handleError(_0xbee0c0,null));};exports[_0xaae2('0x47')]=function(_0x50d31b,_0x4b85a6){return db[_0xaae2('0x2b')][_0xaae2('0x47')](_0x50d31b[_0xaae2('0x48')],{})[_0xaae2('0x20')](function(_0x238da6){var _0x13fb86=_0x50d31b['user'][_0xaae2('0x22')]({'plain':!![]});if(!_0x13fb86)throw new Error(_0xaae2('0x49'));if(_0x13fb86[_0xaae2('0x4a')]===_0xaae2('0x4b')){var _0xf914a0=_0x238da6['get']({'plain':!![]});var _0x2e1e6b=_0xaae2('0x23');return db[_0xaae2('0x4c')][_0xaae2('0x46')]({'where':{'name':_0x2e1e6b,'userProfileId':_0x13fb86[_0xaae2('0x4d')]},'raw':!![]})[_0xaae2('0x20')](function(_0x32a58e){if(_0x32a58e&&_0x32a58e[_0xaae2('0x4e')]===0x0){return db[_0xaae2('0x24')][_0xaae2('0x47')]({'name':_0xf914a0[_0xaae2('0x27')],'resourceId':_0xf914a0['id'],'type':_0x32a58e['name'],'sectionId':_0x32a58e['id']},{})[_0xaae2('0x20')](function(){return _0x238da6;});}else{return _0x238da6;}})['catch'](function(_0x197acd){logger[_0xaae2('0x4f')](_0xaae2('0x50'),_0x197acd);throw _0x197acd;});}return _0x238da6;})['then'](respondWithResult(_0x4b85a6,0xc9))[_0xaae2('0x41')](handleError(_0x4b85a6,null));};exports[_0xaae2('0x51')]=function(_0x52a95f,_0x45346b){if(_0x52a95f[_0xaae2('0x48')]['id']){delete _0x52a95f[_0xaae2('0x48')]['id'];}return db[_0xaae2('0x2b')][_0xaae2('0x46')]({'where':{'id':_0x52a95f[_0xaae2('0x43')]['id']}})['then'](handleEntityNotFound(_0x45346b,null))['then'](saveUpdates(_0x52a95f['body'],null))[_0xaae2('0x20')](respondWithResult(_0x45346b,null))[_0xaae2('0x41')](handleError(_0x45346b,null));};exports[_0xaae2('0x21')]=function(_0x5c6d70,_0x367273){return db[_0xaae2('0x2b')][_0xaae2('0x46')]({'where':{'id':_0x5c6d70['params']['id']}})[_0xaae2('0x20')](handleEntityNotFound(_0x367273,null))['then'](removeEntity(_0x367273,null))[_0xaae2('0x41')](handleError(_0x367273,null));};exports[_0xaae2('0x52')]=function(_0x32ec57,_0xe38780,_0x32b5d1){return db[_0xaae2('0x2b')]['findOne']({'where':{'id':_0x32ec57['params']['id']}})[_0xaae2('0x20')](handleEntityNotFound(_0xe38780,null))['then'](function(_0x1e7c6c){var _0x46ec83;var _0x4903b5={},_0x9eef0a={};_0x9eef0a[_0xaae2('0x30')]=_[_0xaae2('0x32')](db['VoiceMailMessage'][_0xaae2('0x2c')]);_0x9eef0a[_0xaae2('0x31')]=_[_0xaae2('0x32')](_0x32ec57[_0xaae2('0x31')]);_0x9eef0a[_0xaae2('0x3a')]=_[_0xaae2('0x34')](_0x9eef0a[_0xaae2('0x30')],_0x9eef0a[_0xaae2('0x31')]);_0x4903b5[_0xaae2('0x33')]=_[_0xaae2('0x34')](_0x9eef0a[_0xaae2('0x30')],qs['fields'](_0x32ec57[_0xaae2('0x31')][_0xaae2('0x35')]));_0x4903b5[_0xaae2('0x33')]=_0x4903b5[_0xaae2('0x33')]['length']?_0x4903b5['attributes']:_0x9eef0a[_0xaae2('0x30')];if(!_0x32ec57[_0xaae2('0x31')][_0xaae2('0x53')]('nolimit')){_0x4903b5[_0xaae2('0x1c')]=qs[_0xaae2('0x1c')](_0x32ec57['query'][_0xaae2('0x1c')]);_0x4903b5[_0xaae2('0x19')]=qs['offset'](_0x32ec57['query']['offset']);}_0x4903b5['order']=qs[_0xaae2('0x38')](_0x32ec57[_0xaae2('0x31')][_0xaae2('0x38')]);_0x4903b5['where']=qs['filters'](_[_0xaae2('0x54')](_0x32ec57['query'],_0x9eef0a[_0xaae2('0x3a')]));if(_0x32ec57[_0xaae2('0x31')][_0xaae2('0x3b')]){_0x4903b5[_0xaae2('0x39')]=_[_0xaae2('0x3c')](_0x4903b5[_0xaae2('0x39')],{'$or':_[_0xaae2('0x2a')](_0x4903b5[_0xaae2('0x33')],function(_0x4382ee){var _0x419930={};_0x419930[_0x4382ee]={'$like':'%'+_0x32ec57[_0xaae2('0x31')][_0xaae2('0x3b')]+'%'};return _0x419930;})});}_0x4903b5['where']=_[_0xaae2('0x3c')](_0x4903b5[_0xaae2('0x39')],{'mailboxuser':_0x1e7c6c[_0xaae2('0x55')]});_0x4903b5=_['merge']({},_0x4903b5,_0x32ec57[_0xaae2('0x3e')]);return db[_0xaae2('0x56')][_0xaae2('0x57')](_0x4903b5)['then'](respondWithFilteredResult(_0xe38780,_0x4903b5));})[_0xaae2('0x41')](handleError(_0xe38780,null));}; \ No newline at end of file +var _0x8e61=['key','map','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','show','keys','rawAttributes','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','update','params','findOne','VoiceMailMessage','hasOwnProperty','order','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','error','stack','name','send','VoiceMail','fieldName','type'];(function(_0x6f9a50,_0x2f8b59){var _0x54d159=function(_0x3d6942){while(--_0x3d6942){_0x6f9a50['push'](_0x6f9a50['shift']());}};_0x54d159(++_0x2f8b59);}(_0x8e61,0x191));var _0x18e6=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8e61[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x18e6('0x0'));var zipdir=require(_0x18e6('0x1'));var jsonpatch=require(_0x18e6('0x2'));var rp=require(_0x18e6('0x3'));var moment=require(_0x18e6('0x4'));var BPromise=require(_0x18e6('0x5'));var Mustache=require(_0x18e6('0x6'));var util=require('util');var path=require(_0x18e6('0x7'));var sox=require('sox');var csv=require(_0x18e6('0x8'));var ejs=require(_0x18e6('0x9'));var fs=require('fs');var fs_extra=require(_0x18e6('0xa'));var _=require(_0x18e6('0xb'));var squel=require(_0x18e6('0xc'));var crypto=require(_0x18e6('0xd'));var jsforce=require(_0x18e6('0xe'));var deskjs=require(_0x18e6('0xf'));var toCsv=require(_0x18e6('0x8'));var querystring=require(_0x18e6('0x10'));var Papa=require('papaparse');var Redis=require(_0x18e6('0x11'));var authService=require(_0x18e6('0x12'));var qs=require(_0x18e6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18e6('0x14'));var logger=require(_0x18e6('0x15'))(_0x18e6('0x16'));var utils=require(_0x18e6('0x17'));var config=require(_0x18e6('0x18'));var licenseUtil=require(_0x18e6('0x19'));var db=require(_0x18e6('0x1a'))['db'];function respondWithStatusCode(_0x4c494e,_0x350bcc){_0x350bcc=_0x350bcc||0xcc;return function(_0x17a103){if(_0x17a103){return _0x4c494e[_0x18e6('0x1b')](_0x350bcc);}return _0x4c494e['status'](_0x350bcc)[_0x18e6('0x1c')]();};}function respondWithResult(_0x4f5720,_0xd2abd2){_0xd2abd2=_0xd2abd2||0xc8;return function(_0x1ac2aa){if(_0x1ac2aa){return _0x4f5720[_0x18e6('0x1d')](_0xd2abd2)['json'](_0x1ac2aa);}};}function respondWithFilteredResult(_0x429e72,_0x3b6871){return function(_0x5c844a){if(_0x5c844a){var _0x6a6cf0=typeof _0x3b6871[_0x18e6('0x1e')]===_0x18e6('0x1f')&&typeof _0x3b6871[_0x18e6('0x20')]==='undefined';var _0x3e8bc3=_0x5c844a[_0x18e6('0x21')];var _0x3f0cc0=_0x6a6cf0?0x0:_0x3b6871[_0x18e6('0x1e')];var _0xe8684f=_0x6a6cf0?_0x5c844a[_0x18e6('0x21')]:_0x3b6871[_0x18e6('0x1e')]+_0x3b6871[_0x18e6('0x20')];var _0x2b61b9;if(_0xe8684f>=_0x3e8bc3){_0xe8684f=_0x3e8bc3;_0x2b61b9=0xc8;}else{_0x2b61b9=0xce;}_0x429e72[_0x18e6('0x1d')](_0x2b61b9);return _0x429e72['set'](_0x18e6('0x22'),_0x3f0cc0+'-'+_0xe8684f+'/'+_0x3e8bc3)[_0x18e6('0x23')](_0x5c844a);}return null;};}function patchUpdates(_0x1ae662){return function(_0x175c33){try{jsonpatch[_0x18e6('0x24')](_0x175c33,_0x1ae662,!![]);}catch(_0x3abfc5){return BPromise[_0x18e6('0x25')](_0x3abfc5);}return _0x175c33[_0x18e6('0x26')]();};}function saveUpdates(_0x2ab546,_0x2c890c){return function(_0xd6a88f){if(_0xd6a88f){return _0xd6a88f['update'](_0x2ab546)[_0x18e6('0x27')](function(_0x141364){return _0x141364;});}return null;};}function removeEntity(_0x5f0db6,_0xa77bdd){return function(_0x297edc){if(_0x297edc){return _0x297edc[_0x18e6('0x28')]()[_0x18e6('0x27')](function(){var _0x38bd5f=_0x297edc['get']({'plain':!![]});var _0x33839e=_0x18e6('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x33839e,'resourceId':_0x38bd5f['id']}})['then'](function(){return _0x297edc;});})['then'](function(){_0x5f0db6[_0x18e6('0x1d')](0xcc)[_0x18e6('0x1c')]();});}};}function handleEntityNotFound(_0x50348e,_0x2f5b53){return function(_0x419523){if(!_0x419523){_0x50348e['sendStatus'](0x194);}return _0x419523;};}function handleError(_0x54351c,_0x57bdda){_0x57bdda=_0x57bdda||0x1f4;return function(_0x447b06){logger[_0x18e6('0x2a')](_0x447b06[_0x18e6('0x2b')]);if(_0x447b06[_0x18e6('0x2c')]){delete _0x447b06[_0x18e6('0x2c')];}_0x54351c[_0x18e6('0x1d')](_0x57bdda)[_0x18e6('0x2d')](_0x447b06);};}exports['index']=function(_0x57dea1,_0x964e2a){var _0x193f04={},_0x2aa601={},_0x31de5c={'count':0x0,'rows':[]};var _0x4b29a1=_['map'](db[_0x18e6('0x2e')]['rawAttributes'],function(_0xd1fca1){return{'name':_0xd1fca1[_0x18e6('0x2f')],'type':_0xd1fca1[_0x18e6('0x30')][_0x18e6('0x31')]};});_0x2aa601['model']=_[_0x18e6('0x32')](_0x4b29a1,_0x18e6('0x2c'));_0x2aa601[_0x18e6('0x33')]=_['keys'](_0x57dea1[_0x18e6('0x33')]);_0x2aa601[_0x18e6('0x34')]=_[_0x18e6('0x35')](_0x2aa601[_0x18e6('0x36')],_0x2aa601['query']);_0x193f04[_0x18e6('0x37')]=_[_0x18e6('0x35')](_0x2aa601[_0x18e6('0x36')],qs['fields'](_0x57dea1['query'][_0x18e6('0x38')]));_0x193f04[_0x18e6('0x37')]=_0x193f04['attributes'][_0x18e6('0x39')]?_0x193f04[_0x18e6('0x37')]:_0x2aa601[_0x18e6('0x36')];if(!_0x57dea1[_0x18e6('0x33')]['hasOwnProperty'](_0x18e6('0x3a'))){_0x193f04['limit']=qs['limit'](_0x57dea1['query'][_0x18e6('0x20')]);_0x193f04[_0x18e6('0x1e')]=qs['offset'](_0x57dea1[_0x18e6('0x33')][_0x18e6('0x1e')]);}_0x193f04['order']=qs['sort'](_0x57dea1[_0x18e6('0x33')][_0x18e6('0x3b')]);_0x193f04[_0x18e6('0x3c')]=qs[_0x18e6('0x34')](_[_0x18e6('0x3d')](_0x57dea1[_0x18e6('0x33')],_0x2aa601[_0x18e6('0x34')]),_0x4b29a1);if(_0x57dea1[_0x18e6('0x33')]['filter']){_0x193f04[_0x18e6('0x3c')]=_[_0x18e6('0x3e')](_0x193f04[_0x18e6('0x3c')],{'$or':_[_0x18e6('0x32')](_0x4b29a1,function(_0x4b6368){if(_0x4b6368[_0x18e6('0x30')]!==_0x18e6('0x3f')){var _0x413a9b={};_0x413a9b[_0x4b6368[_0x18e6('0x2c')]]={'$like':'%'+_0x57dea1[_0x18e6('0x33')][_0x18e6('0x40')]+'%'};return _0x413a9b;}})});}_0x193f04=_['merge']({},_0x193f04,_0x57dea1[_0x18e6('0x41')]);var _0x1cef44={'where':_0x193f04[_0x18e6('0x3c')]};return db[_0x18e6('0x2e')][_0x18e6('0x21')](_0x1cef44)['then'](function(_0x3ebeb5){_0x31de5c['count']=_0x3ebeb5;if(_0x57dea1[_0x18e6('0x33')]['includeAll']){_0x193f04['include']=[{'all':!![]}];}return db[_0x18e6('0x2e')][_0x18e6('0x42')](_0x193f04);})[_0x18e6('0x27')](function(_0x3d736f){_0x31de5c['rows']=_0x3d736f;return _0x31de5c;})[_0x18e6('0x27')](respondWithFilteredResult(_0x964e2a,_0x193f04))['catch'](handleError(_0x964e2a,null));};exports[_0x18e6('0x43')]=function(_0x2613eb,_0x2455ed){var _0x21a026={'raw':!![],'where':{'id':_0x2613eb['params']['id']}},_0x20fbb6={};_0x20fbb6[_0x18e6('0x36')]=_[_0x18e6('0x44')](db[_0x18e6('0x2e')][_0x18e6('0x45')]);_0x20fbb6['query']=_[_0x18e6('0x44')](_0x2613eb[_0x18e6('0x33')]);_0x20fbb6['filters']=_[_0x18e6('0x35')](_0x20fbb6[_0x18e6('0x36')],_0x20fbb6[_0x18e6('0x33')]);_0x21a026[_0x18e6('0x37')]=_[_0x18e6('0x35')](_0x20fbb6[_0x18e6('0x36')],qs[_0x18e6('0x38')](_0x2613eb['query'][_0x18e6('0x38')]));_0x21a026[_0x18e6('0x37')]=_0x21a026[_0x18e6('0x37')]['length']?_0x21a026['attributes']:_0x20fbb6['model'];if(_0x2613eb[_0x18e6('0x33')][_0x18e6('0x46')]){_0x21a026[_0x18e6('0x47')]=[{'all':!![]}];}_0x21a026=_[_0x18e6('0x3e')]({},_0x21a026,_0x2613eb[_0x18e6('0x41')]);return db[_0x18e6('0x2e')][_0x18e6('0x48')](_0x21a026)[_0x18e6('0x27')](handleEntityNotFound(_0x2455ed,null))['then'](respondWithResult(_0x2455ed,null))['catch'](handleError(_0x2455ed,null));};exports['create']=function(_0x87488f,_0x8edddb){return db['VoiceMail'][_0x18e6('0x49')](_0x87488f[_0x18e6('0x4a')],{})[_0x18e6('0x27')](function(_0x4dc86a){var _0x301d2c=_0x87488f[_0x18e6('0x4b')][_0x18e6('0x4c')]({'plain':!![]});if(!_0x301d2c)throw new Error(_0x18e6('0x4d'));if(_0x301d2c[_0x18e6('0x4e')]===_0x18e6('0x4b')){var _0x483448=_0x4dc86a[_0x18e6('0x4c')]({'plain':!![]});var _0x4a6cea=_0x18e6('0x29');return db['UserProfileSection'][_0x18e6('0x48')]({'where':{'name':_0x4a6cea,'userProfileId':_0x301d2c[_0x18e6('0x4f')]},'raw':!![]})['then'](function(_0xb6f8a0){if(_0xb6f8a0&&_0xb6f8a0[_0x18e6('0x50')]===0x0){return db['UserProfileResource'][_0x18e6('0x49')]({'name':_0x483448[_0x18e6('0x2c')],'resourceId':_0x483448['id'],'type':_0xb6f8a0[_0x18e6('0x2c')],'sectionId':_0xb6f8a0['id']},{})[_0x18e6('0x27')](function(){return _0x4dc86a;});}else{return _0x4dc86a;}})[_0x18e6('0x51')](function(_0x110ae7){logger[_0x18e6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x110ae7);throw _0x110ae7;});}return _0x4dc86a;})[_0x18e6('0x27')](respondWithResult(_0x8edddb,0xc9))[_0x18e6('0x51')](handleError(_0x8edddb,null));};exports[_0x18e6('0x52')]=function(_0x401011,_0x12cea1){if(_0x401011[_0x18e6('0x4a')]['id']){delete _0x401011['body']['id'];}return db[_0x18e6('0x2e')][_0x18e6('0x48')]({'where':{'id':_0x401011[_0x18e6('0x53')]['id']}})[_0x18e6('0x27')](handleEntityNotFound(_0x12cea1,null))[_0x18e6('0x27')](saveUpdates(_0x401011['body'],null))['then'](respondWithResult(_0x12cea1,null))['catch'](handleError(_0x12cea1,null));};exports[_0x18e6('0x28')]=function(_0x589b27,_0x1e77a9){return db[_0x18e6('0x2e')]['find']({'where':{'id':_0x589b27[_0x18e6('0x53')]['id']}})[_0x18e6('0x27')](handleEntityNotFound(_0x1e77a9,null))['then'](removeEntity(_0x1e77a9,null))[_0x18e6('0x51')](handleError(_0x1e77a9,null));};exports['getMessages']=function(_0xc9c2ae,_0x11043f,_0x5baa0f){return db['VoiceMail'][_0x18e6('0x54')]({'where':{'id':_0xc9c2ae['params']['id']}})[_0x18e6('0x27')](handleEntityNotFound(_0x11043f,null))[_0x18e6('0x27')](function(_0x4eff72){var _0x15c80b;var _0x1b191a={},_0x5e63ad={};_0x5e63ad[_0x18e6('0x36')]=_['keys'](db[_0x18e6('0x55')][_0x18e6('0x45')]);_0x5e63ad[_0x18e6('0x33')]=_['keys'](_0xc9c2ae['query']);_0x5e63ad['filters']=_[_0x18e6('0x35')](_0x5e63ad[_0x18e6('0x36')],_0x5e63ad['query']);_0x1b191a[_0x18e6('0x37')]=_[_0x18e6('0x35')](_0x5e63ad[_0x18e6('0x36')],qs[_0x18e6('0x38')](_0xc9c2ae[_0x18e6('0x33')]['fields']));_0x1b191a[_0x18e6('0x37')]=_0x1b191a['attributes']['length']?_0x1b191a[_0x18e6('0x37')]:_0x5e63ad[_0x18e6('0x36')];if(!_0xc9c2ae[_0x18e6('0x33')][_0x18e6('0x56')](_0x18e6('0x3a'))){_0x1b191a[_0x18e6('0x20')]=qs[_0x18e6('0x20')](_0xc9c2ae[_0x18e6('0x33')][_0x18e6('0x20')]);_0x1b191a[_0x18e6('0x1e')]=qs[_0x18e6('0x1e')](_0xc9c2ae['query'][_0x18e6('0x1e')]);}_0x1b191a[_0x18e6('0x57')]=qs['sort'](_0xc9c2ae[_0x18e6('0x33')]['sort']);_0x1b191a['where']=qs[_0x18e6('0x34')](_[_0x18e6('0x3d')](_0xc9c2ae[_0x18e6('0x33')],_0x5e63ad[_0x18e6('0x34')]));if(_0xc9c2ae[_0x18e6('0x33')]['filter']){_0x1b191a[_0x18e6('0x3c')]=_[_0x18e6('0x3e')](_0x1b191a[_0x18e6('0x3c')],{'$or':_['map'](_0x1b191a['attributes'],function(_0x2c8c58){var _0x1a2ccd={};_0x1a2ccd[_0x2c8c58]={'$like':'%'+_0xc9c2ae['query']['filter']+'%'};return _0x1a2ccd;})});}_0x1b191a[_0x18e6('0x3c')]=_[_0x18e6('0x3e')](_0x1b191a[_0x18e6('0x3c')],{'mailboxuser':_0x4eff72[_0x18e6('0x58')]});_0x1b191a=_['merge']({},_0x1b191a,_0xc9c2ae[_0x18e6('0x41')]);return db[_0x18e6('0x55')][_0x18e6('0x59')](_0x1b191a)['then'](respondWithFilteredResult(_0x11043f,_0x1b191a));})[_0x18e6('0x51')](handleError(_0x11043f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a472e61..8f01405 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 _0x133d=['moment','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','api'];(function(_0x2a0c52,_0x58cc82){var _0x18fba7=function(_0xe83949){while(--_0xe83949){_0x2a0c52['push'](_0x2a0c52['shift']());}};_0x18fba7(++_0x58cc82);}(_0x133d,0x193));var _0xd133=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x133d[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xd133('0x0'));var util=require(_0xd133('0x1'));var logger=require('../../config/logger')(_0xd133('0x2'));var moment=require(_0xd133('0x3'));var BPromise=require('bluebird');var rp=require(_0xd133('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd133('0x5'));var config=require(_0xd133('0x6'));var attributes=require(_0xd133('0x7'));module[_0xd133('0x8')]=function(_0x7865f0,_0x3e7f6b){return _0x7865f0[_0xd133('0x9')](_0xd133('0xa'),attributes,{'tableName':_0xd133('0xb'),'paranoid':![],'indexes':[{'name':_0xd133('0xc'),'fields':['mailbox',_0xd133('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a17=['exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./voiceMail.attributes'];(function(_0x48affa,_0x52ed60){var _0x4ee41d=function(_0x5d4b26){while(--_0x5d4b26){_0x48affa['push'](_0x48affa['shift']());}};_0x4ee41d(++_0x52ed60);}(_0x0a17,0x1a6));var _0x70a1=function(_0x490f0f,_0x303bf4){_0x490f0f=_0x490f0f-0x0;var _0x400888=_0x0a17[_0x490f0f];return _0x400888;};'use strict';var _=require(_0x70a1('0x0'));var util=require('util');var logger=require(_0x70a1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x70a1('0x2'));var rp=require(_0x70a1('0x3'));var fs=require('fs');var path=require(_0x70a1('0x4'));var rimraf=require(_0x70a1('0x5'));var config=require('../../config/environment');var attributes=require(_0x70a1('0x6'));module[_0x70a1('0x7')]=function(_0x100797,_0x30c87b){return _0x100797[_0x70a1('0x8')](_0x70a1('0x9'),attributes,{'tableName':_0x70a1('0xa'),'paranoid':![],'indexes':[{'name':_0x70a1('0xb'),'fields':['mailbox',_0x70a1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 4e54e82..5a2abf6 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 _0x65f8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0x1bd2eb,_0x46267a){var _0x1b1768=function(_0x2a49b0){while(--_0x2a49b0){_0x1bd2eb['push'](_0x1bd2eb['shift']());}};_0x1b1768(++_0x46267a);}(_0x65f8,0x194));var _0x865f=function(_0x398fbb,_0x43220d){_0x398fbb=_0x398fbb-0x0;var _0x132e5c=_0x65f8[_0x398fbb];return _0x132e5c;};'use strict';var _=require(_0x865f('0x0'));var util=require(_0x865f('0x1'));var moment=require('moment');var BPromise=require(_0x865f('0x2'));var rs=require(_0x865f('0x3'));var fs=require('fs');var Redis=require(_0x865f('0x4'));var db=require(_0x865f('0x5'))['db'];var utils=require(_0x865f('0x6'));var logger=require(_0x865f('0x7'))('rpc');var config=require(_0x865f('0x8'));var jayson=require(_0x865f('0x9'));var client=jayson[_0x865f('0xa')][_0x865f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb751,_0x38ec88,_0x2aa96b){return new BPromise(function(_0x169229,_0x17445f){return client['request'](_0x3bb751,_0x2aa96b)[_0x865f('0xc')](function(_0x1f6635){logger['info'](_0x865f('0xd'),_0x38ec88,'request\x20sent');logger[_0x865f('0xe')](_0x865f('0xf'),_0x38ec88,_0x865f('0x10'),JSON[_0x865f('0x11')](_0x1f6635));if(_0x1f6635[_0x865f('0x12')]){if(_0x1f6635[_0x865f('0x12')][_0x865f('0x13')]===0x1f4){logger[_0x865f('0x12')](_0x865f('0xd'),_0x38ec88,_0x1f6635[_0x865f('0x12')][_0x865f('0x14')]);return _0x17445f(_0x1f6635[_0x865f('0x12')][_0x865f('0x14')]);}logger[_0x865f('0x12')]('VoiceMail,\x20%s,\x20%s',_0x38ec88,_0x1f6635['error'][_0x865f('0x14')]);return _0x169229(_0x1f6635[_0x865f('0x12')][_0x865f('0x14')]);}else{logger[_0x865f('0x15')](_0x865f('0xd'),_0x38ec88,_0x865f('0x10'));_0x169229(_0x1f6635[_0x865f('0x16')][_0x865f('0x14')]);}})[_0x865f('0x17')](function(_0x2f8451){logger['error']('VoiceMail,\x20%s,\x20%s',_0x38ec88,_0x2f8451);_0x17445f(_0x2f8451);});});} \ No newline at end of file +var _0x0234=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0234,0x14a));var _0x4023=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x0234[_0x151721];return _0x2deaa7;};'use strict';var _=require(_0x4023('0x0'));var util=require(_0x4023('0x1'));var moment=require(_0x4023('0x2'));var BPromise=require(_0x4023('0x3'));var rs=require(_0x4023('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4023('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4023('0x6'))(_0x4023('0x7'));var config=require('../../config/environment');var jayson=require(_0x4023('0x8'));var client=jayson[_0x4023('0x9')][_0x4023('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x552e93,_0x558a68,_0x4162ab){return new BPromise(function(_0x342298,_0x2e3b00){return client['request'](_0x552e93,_0x4162ab)[_0x4023('0xb')](function(_0x2a1989){logger['info'](_0x4023('0xc'),_0x558a68,_0x4023('0xd'));logger[_0x4023('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x558a68,_0x4023('0xd'),JSON[_0x4023('0xf')](_0x2a1989));if(_0x2a1989[_0x4023('0x10')]){if(_0x2a1989[_0x4023('0x10')][_0x4023('0x11')]===0x1f4){logger[_0x4023('0x10')]('VoiceMail,\x20%s,\x20%s',_0x558a68,_0x2a1989[_0x4023('0x10')]['message']);return _0x2e3b00(_0x2a1989[_0x4023('0x10')][_0x4023('0x12')]);}logger[_0x4023('0x10')](_0x4023('0xc'),_0x558a68,_0x2a1989[_0x4023('0x10')][_0x4023('0x12')]);return _0x342298(_0x2a1989[_0x4023('0x10')][_0x4023('0x12')]);}else{logger[_0x4023('0x13')](_0x4023('0xc'),_0x558a68,_0x4023('0xd'));_0x342298(_0x2a1989[_0x4023('0x14')][_0x4023('0x12')]);}})[_0x4023('0x15')](function(_0xf051a7){logger['error'](_0x4023('0xc'),_0x558a68,_0xf051a7);_0x2e3b00(_0xf051a7);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2d4eecd..4c46d9a 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 _0xbfa7=['index','show','/:id/download','isAuthenticated','post','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xbfa7,0x1b0));var _0x7bfa=function(_0x24f1d0,_0x51e9a6){_0x24f1d0=_0x24f1d0-0x0;var _0x427dd4=_0xbfa7[_0x24f1d0];return _0x427dd4;};'use strict';var multer=require(_0x7bfa('0x0'));var util=require(_0x7bfa('0x1'));var path=require(_0x7bfa('0x2'));var timeout=require(_0x7bfa('0x3'));var express=require(_0x7bfa('0x4'));var router=express[_0x7bfa('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7bfa('0x6'));var config=require(_0x7bfa('0x7'));var controller=require(_0x7bfa('0x8'));router[_0x7bfa('0x9')]('/',auth['isAuthenticated'](),controller[_0x7bfa('0xa')]);router[_0x7bfa('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7bfa('0xb')]);router[_0x7bfa('0x9')](_0x7bfa('0xc'),auth[_0x7bfa('0xd')](),controller['download']);router[_0x7bfa('0xe')]('/',auth[_0x7bfa('0xd')](),controller['create']);router['put'](_0x7bfa('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7bfa('0xf'),auth[_0x7bfa('0xd')](),controller['destroy']);module[_0x7bfa('0x10')]=router; \ No newline at end of file +var _0x9044=['/:id','isAuthenticated','show','download','post','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x5509a8,_0x1a8b93){var _0x5383b1=function(_0x14cde3){while(--_0x14cde3){_0x5509a8['push'](_0x5509a8['shift']());}};_0x5383b1(++_0x1a8b93);}(_0x9044,0x87));var _0x4904=function(_0x5b0960,_0x205c7d){_0x5b0960=_0x5b0960-0x0;var _0x1a83fc=_0x9044[_0x5b0960];return _0x1a83fc;};'use strict';var multer=require(_0x4904('0x0'));var util=require(_0x4904('0x1'));var path=require(_0x4904('0x2'));var timeout=require(_0x4904('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4904('0x4'));var auth=require(_0x4904('0x5'));var interaction=require(_0x4904('0x6'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x4904('0x7')]('/',auth['isAuthenticated'](),controller[_0x4904('0x8')]);router[_0x4904('0x7')](_0x4904('0x9'),auth[_0x4904('0xa')](),controller[_0x4904('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x4904('0xc')]);router[_0x4904('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4904('0xe')]('/:id',auth[_0x4904('0xa')](),controller[_0x4904('0xf')]);router[_0x4904('0x10')](_0x4904('0x9'),auth[_0x4904('0xa')](),controller[_0x4904('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index dadc3ab..c3ec802 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 _0x10e7=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','long'];(function(_0x3d887,_0x405d7d){var _0x423d5b=function(_0x178bf7){while(--_0x178bf7){_0x3d887['push'](_0x3d887['shift']());}};_0x423d5b(++_0x405d7d);}(_0x10e7,0x1ba));var _0x710e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x10e7[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x710e('0x0'));module['exports']={'name':{'type':Sequelize[_0x710e('0x1')],'get':function(_0x124e2d){return this[_0x710e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x710e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x710e('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x710e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x710e('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x710e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x710e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x710e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x710e('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x710e('0x6')](_0x710e('0x7'))}}; \ No newline at end of file +var _0x112d=['VIRTUAL','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x3d4e64,_0x3d636d){var _0x316e92=function(_0x41f2e2){while(--_0x41f2e2){_0x3d4e64['push'](_0x3d4e64['shift']());}};_0x316e92(++_0x3d636d);}(_0x112d,0x176));var _0xd112=function(_0x317ecb,_0x25389d){_0x317ecb=_0x317ecb-0x0;var _0x1bcf28=_0x112d[_0x317ecb];return _0x1bcf28;};'use strict';var Sequelize=require(_0xd112('0x0'));module[_0xd112('0x1')]={'name':{'type':Sequelize[_0xd112('0x2')],'get':function(_0x50c7e1){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd112('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xd112('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd112('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd112('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd112('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xd112('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xd112('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xd112('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd112('0x5'),'defaultValue':Sequelize[_0xd112('0x6')](_0xd112('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 7e78632..c1b5d01 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 _0x5e79=['sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','model','differenceBy','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','download','recording','Sequelize','ValidationError','attachment','msg_id','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x5e79,0x1f2));var _0x95e7=function(_0x1543a2,_0x5970a0){_0x1543a2=_0x1543a2-0x0;var _0x4d6cda=_0x5e79[_0x1543a2];return _0x4d6cda;};'use strict';var emlformat=require(_0x95e7('0x0'));var rimraf=require(_0x95e7('0x1'));var zipdir=require(_0x95e7('0x2'));var jsonpatch=require(_0x95e7('0x3'));var rp=require(_0x95e7('0x4'));var moment=require(_0x95e7('0x5'));var BPromise=require(_0x95e7('0x6'));var Mustache=require(_0x95e7('0x7'));var util=require(_0x95e7('0x8'));var path=require(_0x95e7('0x9'));var sox=require(_0x95e7('0xa'));var csv=require(_0x95e7('0xb'));var ejs=require(_0x95e7('0xc'));var fs=require('fs');var fs_extra=require(_0x95e7('0xd'));var _=require('lodash');var squel=require(_0x95e7('0xe'));var crypto=require('crypto');var jsforce=require(_0x95e7('0xf'));var deskjs=require(_0x95e7('0x10'));var toCsv=require(_0x95e7('0xb'));var querystring=require(_0x95e7('0x11'));var Papa=require(_0x95e7('0x12'));var Redis=require(_0x95e7('0x13'));var authService=require(_0x95e7('0x14'));var qs=require(_0x95e7('0x15'));var as=require(_0x95e7('0x16'));var hardwareService=require(_0x95e7('0x17'));var logger=require(_0x95e7('0x18'))(_0x95e7('0x19'));var utils=require(_0x95e7('0x1a'));var config=require(_0x95e7('0x1b'));var licenseUtil=require(_0x95e7('0x1c'));var db=require(_0x95e7('0x1d'))['db'];function respondWithStatusCode(_0x544512,_0x515b95){_0x515b95=_0x515b95||0xcc;return function(_0x109da2){if(_0x109da2){return _0x544512[_0x95e7('0x1e')](_0x515b95);}return _0x544512[_0x95e7('0x1f')](_0x515b95)[_0x95e7('0x20')]();};}function respondWithResult(_0x9535b,_0x5a8d84){_0x5a8d84=_0x5a8d84||0xc8;return function(_0x35dc92){if(_0x35dc92){return _0x9535b[_0x95e7('0x1f')](_0x5a8d84)[_0x95e7('0x21')](_0x35dc92);}};}function respondWithFilteredResult(_0x22b53a,_0x2373b1){return function(_0x5080bc){if(_0x5080bc){var _0x13d60a=typeof _0x2373b1[_0x95e7('0x22')]==='undefined'&&typeof _0x2373b1[_0x95e7('0x23')]==='undefined';var _0x590616=_0x5080bc['count'];var _0x48d7d5=_0x13d60a?0x0:_0x2373b1['offset'];var _0x2bcc89=_0x13d60a?_0x5080bc[_0x95e7('0x24')]:_0x2373b1[_0x95e7('0x22')]+_0x2373b1[_0x95e7('0x23')];var _0x5d40bc;if(_0x2bcc89>=_0x590616){_0x2bcc89=_0x590616;_0x5d40bc=0xc8;}else{_0x5d40bc=0xce;}_0x22b53a['status'](_0x5d40bc);return _0x22b53a[_0x95e7('0x25')](_0x95e7('0x26'),_0x48d7d5+'-'+_0x2bcc89+'/'+_0x590616)[_0x95e7('0x21')](_0x5080bc);}return null;};}function patchUpdates(_0x8c6639){return function(_0x19c76f){try{jsonpatch[_0x95e7('0x27')](_0x19c76f,_0x8c6639,!![]);}catch(_0x2c683f){return BPromise[_0x95e7('0x28')](_0x2c683f);}return _0x19c76f[_0x95e7('0x29')]();};}function saveUpdates(_0x58788a,_0xc6a2cc){return function(_0x190105){if(_0x190105){return _0x190105['update'](_0x58788a)[_0x95e7('0x2a')](function(_0x157e9c){return _0x157e9c;});}return null;};}function removeEntity(_0x127d0a,_0x4fbd74){return function(_0x4bc955){if(_0x4bc955){return _0x4bc955[_0x95e7('0x2b')]()[_0x95e7('0x2a')](function(){_0x127d0a[_0x95e7('0x1f')](0xcc)[_0x95e7('0x20')]();});}};}function handleEntityNotFound(_0x5a128f,_0x3be619){return function(_0x4dcea0){if(!_0x4dcea0){_0x5a128f['sendStatus'](0x194);}return _0x4dcea0;};}function handleError(_0x3c96ae,_0x54b61d){_0x54b61d=_0x54b61d||0x1f4;return function(_0x30da89){logger[_0x95e7('0x2c')](_0x30da89[_0x95e7('0x2d')]);if(_0x30da89[_0x95e7('0x2e')]){delete _0x30da89[_0x95e7('0x2e')];}_0x3c96ae[_0x95e7('0x1f')](_0x54b61d)[_0x95e7('0x2f')](_0x30da89);};}exports['index']=function(_0x2fa8bf,_0x20ada3){var _0x58f6a3={},_0x34b414={},_0x31579b={'count':0x0,'rows':[]};var _0x32275f=_[_0x95e7('0x30')](db[_0x95e7('0x31')][_0x95e7('0x32')],function(_0x362d07){return{'name':_0x362d07['fieldName'],'type':_0x362d07['type']['key']};});_0x34b414[_0x95e7('0x33')]=_[_0x95e7('0x34')](_[_0x95e7('0x30')](_0x32275f,'name'),[_0x95e7('0x2e')]);_0x34b414[_0x95e7('0x35')]=_[_0x95e7('0x36')](_0x2fa8bf[_0x95e7('0x35')]);_0x34b414[_0x95e7('0x37')]=_['intersection'](_0x34b414['model'],_0x34b414['query']);_0x58f6a3[_0x95e7('0x38')]=_[_0x95e7('0x39')](_0x34b414[_0x95e7('0x33')],qs[_0x95e7('0x3a')](_0x2fa8bf[_0x95e7('0x35')][_0x95e7('0x3a')]));_0x58f6a3['attributes']=_0x58f6a3['attributes']['length']?_0x58f6a3[_0x95e7('0x38')]:_0x34b414[_0x95e7('0x33')];if(!_0x2fa8bf[_0x95e7('0x35')][_0x95e7('0x3b')](_0x95e7('0x3c'))){_0x58f6a3[_0x95e7('0x23')]=qs[_0x95e7('0x23')](_0x2fa8bf[_0x95e7('0x35')][_0x95e7('0x23')]);_0x58f6a3['offset']=qs[_0x95e7('0x22')](_0x2fa8bf[_0x95e7('0x35')][_0x95e7('0x22')]);}_0x58f6a3[_0x95e7('0x3d')]=qs[_0x95e7('0x3e')](_0x2fa8bf[_0x95e7('0x35')][_0x95e7('0x3e')]);_0x58f6a3[_0x95e7('0x3f')]=qs['filters'](_[_0x95e7('0x40')](_0x2fa8bf[_0x95e7('0x35')],_0x34b414[_0x95e7('0x37')]),_0x32275f);if(_0x2fa8bf['query'][_0x95e7('0x41')]){_0x58f6a3[_0x95e7('0x3f')]=_[_0x95e7('0x42')](_0x58f6a3[_0x95e7('0x3f')],{'$or':_['map'](_0x32275f,function(_0x14d2d0){if(_0x14d2d0[_0x95e7('0x43')]!=='VIRTUAL'){var _0x370217={};_0x370217[_0x14d2d0[_0x95e7('0x2e')]]={'$like':'%'+_0x2fa8bf[_0x95e7('0x35')][_0x95e7('0x41')]+'%'};return _0x370217;}})});}_0x58f6a3=_['merge']({},_0x58f6a3,_0x2fa8bf[_0x95e7('0x44')]);var _0xd7f91c={'where':_0x58f6a3[_0x95e7('0x3f')]};return db[_0x95e7('0x31')][_0x95e7('0x24')](_0xd7f91c)[_0x95e7('0x2a')](function(_0x2aeccc){_0x31579b['count']=_0x2aeccc;if(_0x2fa8bf[_0x95e7('0x35')][_0x95e7('0x45')]){_0x58f6a3[_0x95e7('0x46')]=[{'all':!![]}];}return db[_0x95e7('0x31')][_0x95e7('0x47')](_0x58f6a3);})[_0x95e7('0x2a')](function(_0x2bca77){_0x31579b[_0x95e7('0x48')]=_0x2bca77;return _0x31579b;})[_0x95e7('0x2a')](respondWithFilteredResult(_0x20ada3,_0x58f6a3))[_0x95e7('0x49')](handleError(_0x20ada3,null));};exports[_0x95e7('0x4a')]=function(_0x4a6508,_0x7c15f4){var _0x3b871f={'raw':!![],'where':{'id':_0x4a6508[_0x95e7('0x4b')]['id']}},_0x5f4e28={};_0x5f4e28[_0x95e7('0x33')]=_['keys'](db['VoiceMailMessage'][_0x95e7('0x32')]);_0x5f4e28[_0x95e7('0x35')]=_[_0x95e7('0x36')](_0x4a6508['query']);_0x5f4e28[_0x95e7('0x37')]=_[_0x95e7('0x39')](_0x5f4e28[_0x95e7('0x33')],_0x5f4e28[_0x95e7('0x35')]);_0x3b871f[_0x95e7('0x38')]=_['intersection'](_0x5f4e28[_0x95e7('0x33')],qs['fields'](_0x4a6508[_0x95e7('0x35')][_0x95e7('0x3a')]));_0x3b871f[_0x95e7('0x38')]=_0x3b871f['attributes'][_0x95e7('0x4c')]?_0x3b871f[_0x95e7('0x38')]:_0x5f4e28['model'];if(_0x4a6508[_0x95e7('0x35')][_0x95e7('0x45')]){_0x3b871f['include']=[{'all':!![]}];}_0x3b871f=_[_0x95e7('0x42')]({},_0x3b871f,_0x4a6508[_0x95e7('0x44')]);return db[_0x95e7('0x31')][_0x95e7('0x4d')](_0x3b871f)[_0x95e7('0x2a')](handleEntityNotFound(_0x7c15f4,null))[_0x95e7('0x2a')](respondWithResult(_0x7c15f4,null))[_0x95e7('0x49')](handleError(_0x7c15f4,null));};exports[_0x95e7('0x4e')]=function(_0x104364,_0xc2b93f){return db[_0x95e7('0x31')]['create'](_0x104364[_0x95e7('0x4f')],{})[_0x95e7('0x2a')](respondWithResult(_0xc2b93f,0xc9))[_0x95e7('0x49')](handleError(_0xc2b93f,null));};exports['update']=function(_0x3d6790,_0x2ccba4){if(_0x3d6790[_0x95e7('0x4f')]['id']){delete _0x3d6790[_0x95e7('0x4f')]['id'];}return db[_0x95e7('0x31')][_0x95e7('0x4d')]({'where':{'id':_0x3d6790['params']['id']}})[_0x95e7('0x2a')](handleEntityNotFound(_0x2ccba4,null))[_0x95e7('0x2a')](saveUpdates(_0x3d6790[_0x95e7('0x4f')],null))[_0x95e7('0x2a')](respondWithResult(_0x2ccba4,null))[_0x95e7('0x49')](handleError(_0x2ccba4,null));};exports[_0x95e7('0x2b')]=function(_0x48db4e,_0x21a275){return db['VoiceMailMessage'][_0x95e7('0x4d')]({'where':{'id':_0x48db4e[_0x95e7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21a275,null))[_0x95e7('0x2a')](removeEntity(_0x21a275,null))['catch'](handleError(_0x21a275,null));};exports[_0x95e7('0x50')]=function(_0x748d3a,_0x20b7a8,_0x3c3540){return db['VoiceMailMessage'][_0x95e7('0x4d')]({'where':{'id':_0x748d3a['params']['id']},'attributes':['id',_0x95e7('0x51'),'msg_id']})[_0x95e7('0x2a')](handleEntityNotFound(_0x20b7a8,null))['then'](function(_0x2f0583){if(_0x2f0583){if(!_0x2f0583[_0x95e7('0x51')]){throw new db[(_0x95e7('0x52'))][(_0x95e7('0x53'))]('VoiceMailMessage\x20not\x20found');}var _0x3dee89={'Content-Type':'audio/wav','Content-Disposition':_0x95e7('0x54')};if(_0x2f0583[_0x95e7('0x55')]){_0x3dee89[_0x95e7('0x56')]='attachment;\x20filename=\x22'+_0x2f0583[_0x95e7('0x55')]+_0x95e7('0x57');}_0x20b7a8['set'](_0x3dee89);return _0x20b7a8[_0x95e7('0x2f')](new Buffer(_0x2f0583['recording']));}})[_0x95e7('0x49')](handleError(_0x20b7a8,null));}; \ No newline at end of file +var _0x67a0=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','params','find','catch','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','type','key','keys','filters','model','query','attributes','intersection','fields','length'];(function(_0x4fb8f5,_0x156954){var _0x2ec829=function(_0xe78f96){while(--_0xe78f96){_0x4fb8f5['push'](_0x4fb8f5['shift']());}};_0x2ec829(++_0x156954);}(_0x67a0,0x178));var _0x067a=function(_0x3019d3,_0x29e9e0){_0x3019d3=_0x3019d3-0x0;var _0x38f833=_0x67a0[_0x3019d3];return _0x38f833;};'use strict';var emlformat=require(_0x067a('0x0'));var rimraf=require(_0x067a('0x1'));var zipdir=require(_0x067a('0x2'));var jsonpatch=require(_0x067a('0x3'));var rp=require(_0x067a('0x4'));var moment=require(_0x067a('0x5'));var BPromise=require(_0x067a('0x6'));var Mustache=require(_0x067a('0x7'));var util=require(_0x067a('0x8'));var path=require(_0x067a('0x9'));var sox=require('sox');var csv=require(_0x067a('0xa'));var ejs=require(_0x067a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x067a('0xc'));var squel=require(_0x067a('0xd'));var crypto=require(_0x067a('0xe'));var jsforce=require(_0x067a('0xf'));var deskjs=require(_0x067a('0x10'));var toCsv=require(_0x067a('0xa'));var querystring=require(_0x067a('0x11'));var Papa=require(_0x067a('0x12'));var Redis=require(_0x067a('0x13'));var authService=require(_0x067a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x067a('0x15'));var hardwareService=require(_0x067a('0x16'));var logger=require('../../config/logger')(_0x067a('0x17'));var utils=require(_0x067a('0x18'));var config=require(_0x067a('0x19'));var licenseUtil=require(_0x067a('0x1a'));var db=require(_0x067a('0x1b'))['db'];function respondWithStatusCode(_0x4851bc,_0x5928b4){_0x5928b4=_0x5928b4||0xcc;return function(_0x3afa3f){if(_0x3afa3f){return _0x4851bc['sendStatus'](_0x5928b4);}return _0x4851bc[_0x067a('0x1c')](_0x5928b4)['end']();};}function respondWithResult(_0x900fe4,_0x3d876a){_0x3d876a=_0x3d876a||0xc8;return function(_0x127370){if(_0x127370){return _0x900fe4[_0x067a('0x1c')](_0x3d876a)[_0x067a('0x1d')](_0x127370);}};}function respondWithFilteredResult(_0x54f3da,_0x437e55){return function(_0x4e6524){if(_0x4e6524){var _0x545435=typeof _0x437e55[_0x067a('0x1e')]===_0x067a('0x1f')&&typeof _0x437e55['limit']===_0x067a('0x1f');var _0x14ac78=_0x4e6524[_0x067a('0x20')];var _0x45f823=_0x545435?0x0:_0x437e55[_0x067a('0x1e')];var _0x54d07a=_0x545435?_0x4e6524['count']:_0x437e55[_0x067a('0x1e')]+_0x437e55[_0x067a('0x21')];var _0x1d8d72;if(_0x54d07a>=_0x14ac78){_0x54d07a=_0x14ac78;_0x1d8d72=0xc8;}else{_0x1d8d72=0xce;}_0x54f3da[_0x067a('0x1c')](_0x1d8d72);return _0x54f3da[_0x067a('0x22')](_0x067a('0x23'),_0x45f823+'-'+_0x54d07a+'/'+_0x14ac78)[_0x067a('0x1d')](_0x4e6524);}return null;};}function patchUpdates(_0x12f7cb){return function(_0x5bfb3a){try{jsonpatch[_0x067a('0x24')](_0x5bfb3a,_0x12f7cb,!![]);}catch(_0x323dee){return BPromise[_0x067a('0x25')](_0x323dee);}return _0x5bfb3a['save']();};}function saveUpdates(_0x23a387,_0x25527b){return function(_0x262702){if(_0x262702){return _0x262702[_0x067a('0x26')](_0x23a387)[_0x067a('0x27')](function(_0x2652cc){return _0x2652cc;});}return null;};}function removeEntity(_0x488649,_0x463d83){return function(_0x50a2ac){if(_0x50a2ac){return _0x50a2ac[_0x067a('0x28')]()['then'](function(){_0x488649[_0x067a('0x1c')](0xcc)[_0x067a('0x29')]();});}};}function handleEntityNotFound(_0x33fea6,_0x3ce84b){return function(_0x892f0c){if(!_0x892f0c){_0x33fea6[_0x067a('0x2a')](0x194);}return _0x892f0c;};}function handleError(_0x497e76,_0x45f4ca){_0x45f4ca=_0x45f4ca||0x1f4;return function(_0xc972fa){logger[_0x067a('0x2b')](_0xc972fa[_0x067a('0x2c')]);if(_0xc972fa[_0x067a('0x2d')]){delete _0xc972fa[_0x067a('0x2d')];}_0x497e76['status'](_0x45f4ca)[_0x067a('0x2e')](_0xc972fa);};}exports['index']=function(_0x3cbb62,_0x351dc2){var _0x2a984c={},_0x52eda8={},_0x22fce2={'count':0x0,'rows':[]};var _0xf01c13=_[_0x067a('0x2f')](db['VoiceMailMessage'][_0x067a('0x30')],function(_0x417d71){return{'name':_0x417d71['fieldName'],'type':_0x417d71[_0x067a('0x31')][_0x067a('0x32')]};});_0x52eda8['model']=_['differenceBy'](_[_0x067a('0x2f')](_0xf01c13,'name'),[_0x067a('0x2d')]);_0x52eda8['query']=_[_0x067a('0x33')](_0x3cbb62['query']);_0x52eda8[_0x067a('0x34')]=_['intersection'](_0x52eda8[_0x067a('0x35')],_0x52eda8[_0x067a('0x36')]);_0x2a984c[_0x067a('0x37')]=_[_0x067a('0x38')](_0x52eda8[_0x067a('0x35')],qs[_0x067a('0x39')](_0x3cbb62[_0x067a('0x36')][_0x067a('0x39')]));_0x2a984c[_0x067a('0x37')]=_0x2a984c[_0x067a('0x37')][_0x067a('0x3a')]?_0x2a984c[_0x067a('0x37')]:_0x52eda8[_0x067a('0x35')];if(!_0x3cbb62[_0x067a('0x36')][_0x067a('0x3b')](_0x067a('0x3c'))){_0x2a984c[_0x067a('0x21')]=qs[_0x067a('0x21')](_0x3cbb62[_0x067a('0x36')][_0x067a('0x21')]);_0x2a984c[_0x067a('0x1e')]=qs[_0x067a('0x1e')](_0x3cbb62[_0x067a('0x36')]['offset']);}_0x2a984c[_0x067a('0x3d')]=qs[_0x067a('0x3e')](_0x3cbb62[_0x067a('0x36')][_0x067a('0x3e')]);_0x2a984c[_0x067a('0x3f')]=qs[_0x067a('0x34')](_[_0x067a('0x40')](_0x3cbb62[_0x067a('0x36')],_0x52eda8[_0x067a('0x34')]),_0xf01c13);if(_0x3cbb62['query'][_0x067a('0x41')]){_0x2a984c['where']=_[_0x067a('0x42')](_0x2a984c[_0x067a('0x3f')],{'$or':_[_0x067a('0x2f')](_0xf01c13,function(_0x81aa51){if(_0x81aa51[_0x067a('0x31')]!==_0x067a('0x43')){var _0x4bcd69={};_0x4bcd69[_0x81aa51['name']]={'$like':'%'+_0x3cbb62['query']['filter']+'%'};return _0x4bcd69;}})});}_0x2a984c=_[_0x067a('0x42')]({},_0x2a984c,_0x3cbb62[_0x067a('0x44')]);var _0x5adec8={'where':_0x2a984c[_0x067a('0x3f')]};return db[_0x067a('0x45')]['count'](_0x5adec8)['then'](function(_0xc4de43){_0x22fce2[_0x067a('0x20')]=_0xc4de43;if(_0x3cbb62['query'][_0x067a('0x46')]){_0x2a984c[_0x067a('0x47')]=[{'all':!![]}];}return db[_0x067a('0x45')]['findAll'](_0x2a984c);})[_0x067a('0x27')](function(_0x1701c8){_0x22fce2['rows']=_0x1701c8;return _0x22fce2;})['then'](respondWithFilteredResult(_0x351dc2,_0x2a984c))['catch'](handleError(_0x351dc2,null));};exports['show']=function(_0x13a4d9,_0x5d3be3){var _0x3f63e5={'raw':!![],'where':{'id':_0x13a4d9[_0x067a('0x48')]['id']}},_0x5cbded={};_0x5cbded[_0x067a('0x35')]=_[_0x067a('0x33')](db[_0x067a('0x45')]['rawAttributes']);_0x5cbded[_0x067a('0x36')]=_['keys'](_0x13a4d9[_0x067a('0x36')]);_0x5cbded[_0x067a('0x34')]=_['intersection'](_0x5cbded[_0x067a('0x35')],_0x5cbded[_0x067a('0x36')]);_0x3f63e5[_0x067a('0x37')]=_[_0x067a('0x38')](_0x5cbded[_0x067a('0x35')],qs['fields'](_0x13a4d9[_0x067a('0x36')][_0x067a('0x39')]));_0x3f63e5[_0x067a('0x37')]=_0x3f63e5[_0x067a('0x37')][_0x067a('0x3a')]?_0x3f63e5[_0x067a('0x37')]:_0x5cbded[_0x067a('0x35')];if(_0x13a4d9[_0x067a('0x36')][_0x067a('0x46')]){_0x3f63e5['include']=[{'all':!![]}];}_0x3f63e5=_[_0x067a('0x42')]({},_0x3f63e5,_0x13a4d9[_0x067a('0x44')]);return db[_0x067a('0x45')][_0x067a('0x49')](_0x3f63e5)['then'](handleEntityNotFound(_0x5d3be3,null))['then'](respondWithResult(_0x5d3be3,null))[_0x067a('0x4a')](handleError(_0x5d3be3,null));};exports[_0x067a('0x4b')]=function(_0x32f0d6,_0x47c375){return db[_0x067a('0x45')][_0x067a('0x4b')](_0x32f0d6[_0x067a('0x4c')],{})[_0x067a('0x27')](respondWithResult(_0x47c375,0xc9))[_0x067a('0x4a')](handleError(_0x47c375,null));};exports[_0x067a('0x26')]=function(_0x3d6313,_0x320e5f){if(_0x3d6313[_0x067a('0x4c')]['id']){delete _0x3d6313[_0x067a('0x4c')]['id'];}return db[_0x067a('0x45')][_0x067a('0x49')]({'where':{'id':_0x3d6313[_0x067a('0x48')]['id']}})[_0x067a('0x27')](handleEntityNotFound(_0x320e5f,null))['then'](saveUpdates(_0x3d6313['body'],null))['then'](respondWithResult(_0x320e5f,null))[_0x067a('0x4a')](handleError(_0x320e5f,null));};exports[_0x067a('0x28')]=function(_0x3e4890,_0xce80a2){return db[_0x067a('0x45')][_0x067a('0x49')]({'where':{'id':_0x3e4890[_0x067a('0x48')]['id']}})[_0x067a('0x27')](handleEntityNotFound(_0xce80a2,null))[_0x067a('0x27')](removeEntity(_0xce80a2,null))[_0x067a('0x4a')](handleError(_0xce80a2,null));};exports[_0x067a('0x4d')]=function(_0xb76c74,_0x28e3c6,_0x1c40a1){return db[_0x067a('0x45')][_0x067a('0x49')]({'where':{'id':_0xb76c74[_0x067a('0x48')]['id']},'attributes':['id',_0x067a('0x4e'),_0x067a('0x4f')]})['then'](handleEntityNotFound(_0x28e3c6,null))[_0x067a('0x27')](function(_0x314c09){if(_0x314c09){if(!_0x314c09[_0x067a('0x4e')]){throw new db[(_0x067a('0x50'))]['ValidationError'](_0x067a('0x51'));}var _0x900c52={'Content-Type':_0x067a('0x52'),'Content-Disposition':_0x067a('0x53')};if(_0x314c09[_0x067a('0x4f')]){_0x900c52[_0x067a('0x54')]=_0x067a('0x55')+_0x314c09[_0x067a('0x4f')]+_0x067a('0x56');}_0x28e3c6[_0x067a('0x22')](_0x900c52);return _0x28e3c6[_0x067a('0x2e')](new Buffer(_0x314c09['recording']));}})[_0x067a('0x4a')](handleError(_0x28e3c6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1a9a8cb..a7fdfa2 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 _0xe4ec=['VoiceMailMessage','voice_voicemail_messages','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x27194b,_0x28acaf){var _0x5eb373=function(_0xdea401){while(--_0xdea401){_0x27194b['push'](_0x27194b['shift']());}};_0x5eb373(++_0x28acaf);}(_0xe4ec,0x7b));var _0xce4e=function(_0x1f98a2,_0x21cb4a){_0x1f98a2=_0x1f98a2-0x0;var _0x47706a=_0xe4ec[_0x1f98a2];return _0x47706a;};'use strict';var _=require(_0xce4e('0x0'));var util=require(_0xce4e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xce4e('0x2'));var BPromise=require(_0xce4e('0x3'));var rp=require(_0xce4e('0x4'));var fs=require('fs');var path=require(_0xce4e('0x5'));var rimraf=require(_0xce4e('0x6'));var config=require(_0xce4e('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xce4e('0x8')]=function(_0x31d0d2,_0xef38a0){return _0x31d0d2['define'](_0xce4e('0x9'),attributes,{'tableName':_0xce4e('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x634d=['../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x364cf8,_0x146b9b){var _0x6a59ee=function(_0x3d81eb){while(--_0x3d81eb){_0x364cf8['push'](_0x364cf8['shift']());}};_0x6a59ee(++_0x146b9b);}(_0x634d,0xdd));var _0xd634=function(_0x5b8db8,_0x692fe9){_0x5b8db8=_0x5b8db8-0x0;var _0x2078bf=_0x634d[_0x5b8db8];return _0x2078bf;};'use strict';var _=require(_0xd634('0x0'));var util=require(_0xd634('0x1'));var logger=require(_0xd634('0x2'))('api');var moment=require(_0xd634('0x3'));var BPromise=require('bluebird');var rp=require(_0xd634('0x4'));var fs=require('fs');var path=require(_0xd634('0x5'));var rimraf=require(_0xd634('0x6'));var config=require(_0xd634('0x7'));var attributes=require(_0xd634('0x8'));module['exports']=function(_0x39ea70,_0x4cfa3d){return _0x39ea70[_0xd634('0x9')](_0xd634('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xd634('0xb'),'fields':[_0xd634('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 477d323..1a8a7ba 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 _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x1967,0x173));var _0x7196=function(_0x15f03e,_0x1c87a8){_0x15f03e=_0x15f03e-0x0;var _0x8dcd63=_0x1967[_0x15f03e];return _0x8dcd63;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1967,0x173));var _0x7196=function(_0xcda3d,_0x4f45d1){_0xcda3d=_0xcda3d-0x0;var _0xe24b9a=_0x1967[_0xcda3d];return _0xe24b9a;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4f0b88e..faf3e47 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 _0xd5a0=['create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','getSounds'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0xd5a0,0x1c1));var _0x0d5a=function(_0x1548a0,_0x4bd793){_0x1548a0=_0x1548a0-0x0;var _0x27d824=_0xd5a0[_0x1548a0];return _0x27d824;};'use strict';var multer=require(_0x0d5a('0x0'));var util=require(_0x0d5a('0x1'));var path=require('path');var timeout=require(_0x0d5a('0x2'));var express=require(_0x0d5a('0x3'));var router=express[_0x0d5a('0x4')]();var fs_extra=require(_0x0d5a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0d5a('0x6'));var controller=require(_0x0d5a('0x7'));router[_0x0d5a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0d5a('0x8')](_0x0d5a('0x9'),auth[_0x0d5a('0xa')](),controller[_0x0d5a('0xb')]);router[_0x0d5a('0x8')]('/:id/sounds',auth[_0x0d5a('0xa')](),controller[_0x0d5a('0xc')]);router['post']('/',auth[_0x0d5a('0xa')](),controller[_0x0d5a('0xd')]);router['post']('/:id/sounds',auth['isAuthenticated'](),controller[_0x0d5a('0xe')]);router[_0x0d5a('0xf')](_0x0d5a('0x9'),auth[_0x0d5a('0xa')](),controller[_0x0d5a('0x10')]);router[_0x0d5a('0x11')](_0x0d5a('0x9'),auth['isAuthenticated'](),controller[_0x0d5a('0x12')]);router['delete'](_0x0d5a('0x13'),auth[_0x0d5a('0xa')](),controller[_0x0d5a('0x14')]);module[_0x0d5a('0x15')]=router; \ No newline at end of file +var _0x757d=['index','get','/:id','/:id/sounds','getSounds','post','create','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated'];(function(_0x16753e,_0xbbffef){var _0x31ad26=function(_0x48849c){while(--_0x48849c){_0x16753e['push'](_0x16753e['shift']());}};_0x31ad26(++_0xbbffef);}(_0x757d,0xef));var _0xd757=function(_0x1aed01,_0x3b59f3){_0x1aed01=_0x1aed01-0x0;var _0x34ccb8=_0x757d[_0x1aed01];return _0x34ccb8;};'use strict';var multer=require(_0xd757('0x0'));var util=require('util');var path=require(_0xd757('0x1'));var timeout=require(_0xd757('0x2'));var express=require(_0xd757('0x3'));var router=express[_0xd757('0x4')]();var fs_extra=require(_0xd757('0x5'));var auth=require(_0xd757('0x6'));var interaction=require(_0xd757('0x7'));var config=require(_0xd757('0x8'));var controller=require(_0xd757('0x9'));router['get']('/',auth[_0xd757('0xa')](),controller[_0xd757('0xb')]);router[_0xd757('0xc')](_0xd757('0xd'),auth[_0xd757('0xa')](),controller['show']);router[_0xd757('0xc')](_0xd757('0xe'),auth['isAuthenticated'](),controller[_0xd757('0xf')]);router[_0xd757('0x10')]('/',auth[_0xd757('0xa')](),controller[_0xd757('0x11')]);router[_0xd757('0x10')]('/:id/sounds',auth[_0xd757('0xa')](),controller['addSound']);router[_0xd757('0x12')](_0xd757('0xd'),auth['isAuthenticated'](),controller[_0xd757('0x13')]);router[_0xd757('0x14')](_0xd757('0xd'),auth[_0xd757('0xa')](),controller[_0xd757('0x15')]);router[_0xd757('0x14')](_0xd757('0x16'),auth['isAuthenticated'](),controller[_0xd757('0x17')]);module[_0xd757('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index b6d73c5..9cdd02a 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 _0x7ad6=['quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','mp3nb'];(function(_0x39be62,_0xe8fbd9){var _0x57f227=function(_0xf244e6){while(--_0xf244e6){_0x39be62['push'](_0x39be62['shift']());}};_0x57f227(++_0xe8fbd9);}(_0x7ad6,0x1a7));var _0x67ad=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7ad6[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x67ad('0x0'));module[_0x67ad('0x1')]={'name':{'type':Sequelize[_0x67ad('0x2')],'allowNull':![],'unique':_0x67ad('0x3')},'mode':{'type':Sequelize[_0x67ad('0x4')]('custom','files',_0x67ad('0x5'),_0x67ad('0x6'),'quietmp3',_0x67ad('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x67ad('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x67ad('0x2')],'allowNull':!![],'defaultValue':_0x67ad('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x67ad('0x9')},'defaultEntry':{'type':Sequelize[_0x67ad('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaf74=['custom','files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','name','ENUM'];(function(_0x4173f3,_0x41904c){var _0x2431a0=function(_0x4aab70){while(--_0x4aab70){_0x4173f3['push'](_0x4173f3['shift']());}};_0x2431a0(++_0x41904c);}(_0xaf74,0x13d));var _0x4af7=function(_0x13a41d,_0x10ef21){_0x13a41d=_0x13a41d-0x0;var _0x462d22=_0xaf74[_0x13a41d];return _0x462d22;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4af7('0x0')},'mode':{'type':Sequelize[_0x4af7('0x1')](_0x4af7('0x2'),_0x4af7('0x3'),'mp3nb',_0x4af7('0x4'),_0x4af7('0x5'),_0x4af7('0x6')),'allowNull':!![],'defaultValue':_0x4af7('0x3')},'directory':{'type':Sequelize[_0x4af7('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x4af7('0x7')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x4af7('0x7')],'allowNull':!![],'defaultValue':_0x4af7('0x8')},'format':{'type':Sequelize[_0x4af7('0x7')],'allowNull':!![]},'stamp':{'type':_0x4af7('0x9')},'defaultEntry':{'type':Sequelize[_0x4af7('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 43dc4ec..07bd1ce 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 _0x0b52=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','update','body','create','transaction','mode','directory','join','root','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','format','%s.%s','basename','extname','server/files/moh','symlinkSync','removeSound','id2','save_name','ValidationError','getSounds','eml-format','rimraf'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x0b52,0xe8));var _0x20b5=function(_0x199d40,_0x1be032){_0x199d40=_0x199d40-0x0;var _0x428fbb=_0x0b52[_0x199d40];return _0x428fbb;};'use strict';var emlformat=require(_0x20b5('0x0'));var rimraf=require(_0x20b5('0x1'));var zipdir=require(_0x20b5('0x2'));var jsonpatch=require(_0x20b5('0x3'));var rp=require(_0x20b5('0x4'));var moment=require(_0x20b5('0x5'));var BPromise=require(_0x20b5('0x6'));var Mustache=require(_0x20b5('0x7'));var util=require('util');var path=require('path');var sox=require(_0x20b5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20b5('0x9'));var _=require(_0x20b5('0xa'));var squel=require(_0x20b5('0xb'));var crypto=require(_0x20b5('0xc'));var jsforce=require(_0x20b5('0xd'));var deskjs=require(_0x20b5('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x20b5('0xf'));var authService=require(_0x20b5('0x10'));var qs=require(_0x20b5('0x11'));var as=require(_0x20b5('0x12'));var hardwareService=require(_0x20b5('0x13'));var logger=require('../../config/logger')(_0x20b5('0x14'));var utils=require(_0x20b5('0x15'));var config=require(_0x20b5('0x16'));var licenseUtil=require(_0x20b5('0x17'));var db=require(_0x20b5('0x18'))['db'];function respondWithStatusCode(_0x1d3fac,_0x239b35){_0x239b35=_0x239b35||0xcc;return function(_0x1aa9dd){if(_0x1aa9dd){return _0x1d3fac[_0x20b5('0x19')](_0x239b35);}return _0x1d3fac['status'](_0x239b35)[_0x20b5('0x1a')]();};}function respondWithResult(_0x2a5936,_0x33e1b5){_0x33e1b5=_0x33e1b5||0xc8;return function(_0x4701dc){if(_0x4701dc){return _0x2a5936[_0x20b5('0x1b')](_0x33e1b5)['json'](_0x4701dc);}};}function respondWithFilteredResult(_0x4edca1,_0x4e1f30){return function(_0xb5b0d3){if(_0xb5b0d3){var _0x1dc2f5=typeof _0x4e1f30[_0x20b5('0x1c')]===_0x20b5('0x1d')&&typeof _0x4e1f30[_0x20b5('0x1e')]==='undefined';var _0x22a523=_0xb5b0d3['count'];var _0x45da28=_0x1dc2f5?0x0:_0x4e1f30['offset'];var _0x3dfd1d=_0x1dc2f5?_0xb5b0d3[_0x20b5('0x1f')]:_0x4e1f30[_0x20b5('0x1c')]+_0x4e1f30['limit'];var _0x2ef2f1;if(_0x3dfd1d>=_0x22a523){_0x3dfd1d=_0x22a523;_0x2ef2f1=0xc8;}else{_0x2ef2f1=0xce;}_0x4edca1[_0x20b5('0x1b')](_0x2ef2f1);return _0x4edca1[_0x20b5('0x20')](_0x20b5('0x21'),_0x45da28+'-'+_0x3dfd1d+'/'+_0x22a523)[_0x20b5('0x22')](_0xb5b0d3);}return null;};}function patchUpdates(_0x4aab18){return function(_0x1bdb34){try{jsonpatch[_0x20b5('0x23')](_0x1bdb34,_0x4aab18,!![]);}catch(_0xc8a64a){return BPromise[_0x20b5('0x24')](_0xc8a64a);}return _0x1bdb34[_0x20b5('0x25')]();};}function saveUpdates(_0x1d72f3,_0x1091aa){return function(_0x614566){if(_0x614566){return _0x614566['update'](_0x1d72f3)[_0x20b5('0x26')](function(_0x11e2d0){return _0x11e2d0;});}return null;};}function removeEntity(_0x335e93,_0x28914b){return function(_0x3d42bb){if(_0x3d42bb){return _0x3d42bb[_0x20b5('0x27')]()[_0x20b5('0x26')](function(){var _0x1c0f94=_0x3d42bb[_0x20b5('0x28')]({'plain':!![]});var _0x5a84f8=_0x20b5('0x29');return db[_0x20b5('0x2a')]['destroy']({'where':{'type':_0x5a84f8,'resourceId':_0x1c0f94['id']}})[_0x20b5('0x26')](function(){return _0x3d42bb;});})[_0x20b5('0x26')](function(){_0x335e93[_0x20b5('0x1b')](0xcc)[_0x20b5('0x1a')]();});}};}function handleEntityNotFound(_0x23e92e,_0x56ec5b){return function(_0x216974){if(!_0x216974){_0x23e92e[_0x20b5('0x19')](0x194);}return _0x216974;};}function handleError(_0x20ff66,_0x4fdc6e){_0x4fdc6e=_0x4fdc6e||0x1f4;return function(_0x597159){logger[_0x20b5('0x2b')](_0x597159[_0x20b5('0x2c')]);if(_0x597159[_0x20b5('0x2d')]){delete _0x597159[_0x20b5('0x2d')];}_0x20ff66['status'](_0x4fdc6e)[_0x20b5('0x2e')](_0x597159);};}exports[_0x20b5('0x2f')]=function(_0x35835a,_0x2c9fc0){var _0x1e0766={},_0x150014={},_0x363f98={'count':0x0,'rows':[]};var _0x39ed24=_[_0x20b5('0x30')](db[_0x20b5('0x31')][_0x20b5('0x32')],function(_0x5ae7d7){return{'name':_0x5ae7d7[_0x20b5('0x33')],'type':_0x5ae7d7[_0x20b5('0x34')][_0x20b5('0x35')]};});_0x150014[_0x20b5('0x36')]=_['map'](_0x39ed24,_0x20b5('0x2d'));_0x150014['query']=_['keys'](_0x35835a[_0x20b5('0x37')]);_0x150014['filters']=_[_0x20b5('0x38')](_0x150014[_0x20b5('0x36')],_0x150014['query']);_0x1e0766['attributes']=_[_0x20b5('0x38')](_0x150014['model'],qs[_0x20b5('0x39')](_0x35835a[_0x20b5('0x37')][_0x20b5('0x39')]));_0x1e0766[_0x20b5('0x3a')]=_0x1e0766[_0x20b5('0x3a')][_0x20b5('0x3b')]?_0x1e0766['attributes']:_0x150014['model'];if(!_0x35835a['query'][_0x20b5('0x3c')](_0x20b5('0x3d'))){_0x1e0766['limit']=qs[_0x20b5('0x1e')](_0x35835a['query'][_0x20b5('0x1e')]);_0x1e0766[_0x20b5('0x1c')]=qs[_0x20b5('0x1c')](_0x35835a[_0x20b5('0x37')][_0x20b5('0x1c')]);}_0x1e0766[_0x20b5('0x3e')]=qs[_0x20b5('0x3f')](_0x35835a[_0x20b5('0x37')]['sort']);delete _0x35835a[_0x20b5('0x37')][_0x20b5('0x3f')];_0x1e0766[_0x20b5('0x40')]=qs[_0x20b5('0x41')](_[_0x20b5('0x42')](_0x35835a[_0x20b5('0x37')],_0x150014[_0x20b5('0x41')]),_0x39ed24);if(_0x35835a['query'][_0x20b5('0x43')]){_0x1e0766[_0x20b5('0x40')]=_[_0x20b5('0x44')](_0x1e0766[_0x20b5('0x40')],{'$or':_['map'](_0x39ed24,function(_0x490dcb){if(_0x490dcb[_0x20b5('0x34')]!==_0x20b5('0x45')){var _0x9ff453={};_0x9ff453[_0x490dcb[_0x20b5('0x2d')]]={'$like':'%'+_0x35835a[_0x20b5('0x37')][_0x20b5('0x43')]+'%'};return _0x9ff453;}})});}_0x1e0766=_[_0x20b5('0x44')]({},_0x1e0766,_0x35835a[_0x20b5('0x46')]);var _0x2c5bf1={'where':_0x1e0766[_0x20b5('0x40')]};return db[_0x20b5('0x31')][_0x20b5('0x1f')](_0x2c5bf1)[_0x20b5('0x26')](function(_0x3e3cfa){_0x363f98[_0x20b5('0x1f')]=_0x3e3cfa;if(_0x35835a[_0x20b5('0x37')][_0x20b5('0x47')]){_0x1e0766[_0x20b5('0x48')]=[{'all':!![]}];}return db[_0x20b5('0x31')][_0x20b5('0x49')](_0x1e0766);})['then'](function(_0x2f3602){_0x363f98['rows']=_0x2f3602;return _0x363f98;})[_0x20b5('0x26')](respondWithFilteredResult(_0x2c9fc0,_0x1e0766))[_0x20b5('0x4a')](handleError(_0x2c9fc0,null));};exports[_0x20b5('0x4b')]=function(_0x15db1c,_0x1cb79e){var _0x556fa6={'raw':![],'where':{'id':_0x15db1c[_0x20b5('0x4c')]['id']}},_0x2f2f69={};_0x2f2f69[_0x20b5('0x36')]=_[_0x20b5('0x4d')](db[_0x20b5('0x31')]['rawAttributes']);_0x2f2f69[_0x20b5('0x37')]=_['keys'](_0x15db1c[_0x20b5('0x37')]);_0x2f2f69[_0x20b5('0x41')]=_[_0x20b5('0x38')](_0x2f2f69[_0x20b5('0x36')],_0x2f2f69[_0x20b5('0x37')]);_0x556fa6[_0x20b5('0x3a')]=_[_0x20b5('0x38')](_0x2f2f69[_0x20b5('0x36')],qs[_0x20b5('0x39')](_0x15db1c[_0x20b5('0x37')][_0x20b5('0x39')]));_0x556fa6[_0x20b5('0x3a')]=_0x556fa6[_0x20b5('0x3a')]['length']?_0x556fa6[_0x20b5('0x3a')]:_0x2f2f69[_0x20b5('0x36')];if(_0x15db1c[_0x20b5('0x37')][_0x20b5('0x47')]){_0x556fa6[_0x20b5('0x48')]=[{'all':!![]}];}_0x556fa6=_[_0x20b5('0x44')]({},_0x556fa6,_0x15db1c['options']);return db[_0x20b5('0x31')][_0x20b5('0x4e')](_0x556fa6)[_0x20b5('0x26')](handleEntityNotFound(_0x1cb79e,null))[_0x20b5('0x26')](respondWithResult(_0x1cb79e,null))['catch'](handleError(_0x1cb79e,null));};exports[_0x20b5('0x4f')]=function(_0x3b923b,_0x9134df){if(_0x3b923b[_0x20b5('0x50')]['id']){delete _0x3b923b[_0x20b5('0x50')]['id'];}return db[_0x20b5('0x31')]['find']({'where':{'id':_0x3b923b[_0x20b5('0x4c')]['id']}})[_0x20b5('0x26')](handleEntityNotFound(_0x9134df,null))[_0x20b5('0x26')](saveUpdates(_0x3b923b[_0x20b5('0x50')],null))[_0x20b5('0x26')](respondWithResult(_0x9134df,null))[_0x20b5('0x4a')](handleError(_0x9134df,null));};exports[_0x20b5('0x51')]=function(_0x2007df,_0x84bc62,_0x11666c){return db['sequelize'][_0x20b5('0x52')](function(_0x5e0bf1){if(_0x2007df['body'][_0x20b5('0x53')]==='files'){_0x2007df[_0x20b5('0x50')][_0x20b5('0x54')]=path[_0x20b5('0x55')](config[_0x20b5('0x56')],'server/files/moh',_0x2007df[_0x20b5('0x50')][_0x20b5('0x2d')]);}return db[_0x20b5('0x31')]['create'](_0x2007df[_0x20b5('0x50')],{'transaction':_0x5e0bf1})[_0x20b5('0x26')](function(_0x3ab412){if(_0x2007df[_0x20b5('0x50')][_0x20b5('0x53')]==='files'){fs[_0x20b5('0x57')](_0x3ab412['directory'],parseInt('0777',0x8));}var _0x566c72=_0x2007df[_0x20b5('0x58')][_0x20b5('0x28')]({'plain':!![]});if(!_0x566c72)throw new Error(_0x20b5('0x59'));if(_0x566c72[_0x20b5('0x5a')]===_0x20b5('0x58')){var _0x103e25=_0x3ab412[_0x20b5('0x28')]({'plain':!![]});return db[_0x20b5('0x5b')][_0x20b5('0x4e')]({'where':{'name':_0x20b5('0x29'),'userProfileId':_0x566c72[_0x20b5('0x5c')]},'raw':!![]})[_0x20b5('0x26')](function(_0x509385){if(_0x509385&&_0x509385[_0x20b5('0x5d')]===0x0){return db[_0x20b5('0x2a')]['create']({'name':_0x103e25[_0x20b5('0x2d')],'resourceId':_0x103e25['id'],'type':_0x509385[_0x20b5('0x2d')],'sectionId':_0x509385['id']},{})['then'](function(){return _0x3ab412;});}else{return _0x3ab412;}})[_0x20b5('0x4a')](function(_0x36b7b2){logger['error'](_0x20b5('0x5e'),_0x36b7b2);});}return _0x3ab412;});})['then'](respondWithResult(_0x84bc62,0xc9))[_0x20b5('0x4a')](handleError(_0x84bc62,null));};exports[_0x20b5('0x27')]=function(_0x486468,_0x488edd,_0xd2d388){var _0xde56a2;return db[_0x20b5('0x31')][_0x20b5('0x4e')]({'where':{'id':_0x486468[_0x20b5('0x4c')]['id']}})['then'](function(_0x3cb31d){if(_0x3cb31d){return db[_0x20b5('0x5f')][_0x20b5('0x52')](function(_0x5e3a72){return _0x3cb31d[_0x20b5('0x27')]({'transaction':_0x5e3a72,'raw':!![]})['then'](function(_0x1db5a4){if(_0x1db5a4[_0x20b5('0x54')]){fs[_0x20b5('0x60')](_0x1db5a4[_0x20b5('0x54')])[_0x20b5('0x61')](function(_0x295668){fs[_0x20b5('0x62')](path[_0x20b5('0x55')](_0x1db5a4['directory'],_0x295668));});fs[_0x20b5('0x63')](_0x1db5a4[_0x20b5('0x54')]);}return _0x1db5a4;});})[_0x20b5('0x4a')](function(_0x3900bc){throw new db[(_0x20b5('0x64'))]['ValidationError'](_0x3900bc['message']);});}})[_0x20b5('0x26')](handleEntityNotFound(_0x488edd,null))['then'](removeEntity(_0x488edd,null))['catch'](handleError(_0x488edd,null));};exports[_0x20b5('0x65')]=function(_0xca92d1,_0xfff366,_0x2bacd9){return db['sequelize'][_0x20b5('0x52')](function(_0x459276){var _0xcd6e85;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xca92d1[_0x20b5('0x4c')]['id']}})[_0x20b5('0x26')](function(_0x3e8540){if(_0x3e8540){_0xcd6e85=_0x3e8540;return _0x3e8540[_0x20b5('0x65')](_0xca92d1[_0x20b5('0x50')]['id'],{'transaction':_0x459276});}})[_0x20b5('0x26')](function(_0x355a01){if(_0x355a01){return db[_0x20b5('0x66')][_0x20b5('0x67')]({'where':{'id':_0xca92d1['body']['id']},'attributes':['id',_0x20b5('0x2d'),'save_name',_0x20b5('0x68'),_0x20b5('0x69')],'raw':!![]});}})[_0x20b5('0x26')](function(_0x4c8d51){if(_0x4c8d51){var _0x2fc50a=path[_0x20b5('0x55')](config['root'],'server/files/sounds/converted',util[_0x20b5('0x6a')](_0x20b5('0x6b'),path[_0x20b5('0x6c')](_0x4c8d51['save_name'],path[_0x20b5('0x6d')](_0x4c8d51['save_name'])),_0x4c8d51[_0x20b5('0x68')]));var _0x42e7ff=path[_0x20b5('0x55')](config[_0x20b5('0x56')],_0x20b5('0x6e'),_0xcd6e85[_0x20b5('0x2d')],util[_0x20b5('0x6a')]('%s.%s',_0x4c8d51[_0x20b5('0x2d')],_0x4c8d51[_0x20b5('0x68')]));fs[_0x20b5('0x6f')](_0x2fc50a,_0x42e7ff);return _0x4c8d51;}})['catch'](function(_0x49e813){throw new db[(_0x20b5('0x64'))]['ValidationError'](_0x49e813['message']);});})[_0x20b5('0x26')](handleEntityNotFound(_0xfff366,null))[_0x20b5('0x26')](respondWithResult(_0xfff366,0xc9))[_0x20b5('0x4a')](handleError(_0xfff366,null));};exports[_0x20b5('0x70')]=function(_0x4c4781,_0x4605a4,_0x35a576){return db[_0x20b5('0x5f')]['transaction'](function(_0x9176){var _0x48d220;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x4c4781[_0x20b5('0x4c')]['id']}})[_0x20b5('0x26')](handleEntityNotFound(_0x4605a4,null))['then'](function(_0x304c95){if(_0x304c95){_0x48d220=_0x304c95;return _0x304c95[_0x20b5('0x70')](_0x4c4781[_0x20b5('0x4c')]['id2']);}})[_0x20b5('0x26')](function(_0x519462){if(_0x519462){return db[_0x20b5('0x66')][_0x20b5('0x67')]({'where':{'id':_0x4c4781[_0x20b5('0x4c')][_0x20b5('0x71')]},'attributes':['id',_0x20b5('0x2d'),_0x20b5('0x72'),_0x20b5('0x68'),_0x20b5('0x69')],'raw':!![]});}})[_0x20b5('0x26')](function(_0x5f5408){if(_0x5f5408){fs[_0x20b5('0x62')](path[_0x20b5('0x55')](_0x48d220['directory'],util[_0x20b5('0x6a')](_0x20b5('0x6b'),_0x5f5408[_0x20b5('0x2d')],_0x5f5408[_0x20b5('0x68')])));return _0x5f5408;}})[_0x20b5('0x4a')](function(_0x217003){throw new db['Sequelize'][(_0x20b5('0x73'))](_0x217003['message']);});})['then'](handleEntityNotFound(_0x4605a4,null))[_0x20b5('0x26')](respondWithStatusCode(_0x4605a4,0xcc))[_0x20b5('0x4a')](handleError(_0x4605a4,null));};exports[_0x20b5('0x74')]=function(_0x465aa4,_0x35060b,_0x5afee7){var _0x4ca82f={};var _0x526be2={};var _0x51d164;var _0x91245b;return db[_0x20b5('0x31')][_0x20b5('0x67')]({'where':{'id':_0x465aa4['params']['id']}})[_0x20b5('0x26')](handleEntityNotFound(_0x35060b,null))[_0x20b5('0x26')](function(_0x2b9f95){if(_0x2b9f95){_0x51d164=_0x2b9f95;_0x526be2[_0x20b5('0x36')]=_[_0x20b5('0x4d')](db['Sound'][_0x20b5('0x32')]);_0x526be2['query']=_[_0x20b5('0x4d')](_0x465aa4[_0x20b5('0x37')]);_0x526be2[_0x20b5('0x41')]=_[_0x20b5('0x38')](_0x526be2['model'],_0x526be2[_0x20b5('0x37')]);_0x4ca82f['attributes']=_[_0x20b5('0x38')](_0x526be2[_0x20b5('0x36')],qs[_0x20b5('0x39')](_0x465aa4['query'][_0x20b5('0x39')]));_0x4ca82f[_0x20b5('0x3a')]=_0x4ca82f[_0x20b5('0x3a')][_0x20b5('0x3b')]?_0x4ca82f[_0x20b5('0x3a')]:_0x526be2[_0x20b5('0x36')];_0x4ca82f[_0x20b5('0x3e')]=qs[_0x20b5('0x3f')](_0x465aa4['query'][_0x20b5('0x3f')]);_0x4ca82f[_0x20b5('0x40')]=qs[_0x20b5('0x41')](_[_0x20b5('0x42')](_0x465aa4[_0x20b5('0x37')],_0x526be2[_0x20b5('0x41')]));if(_0x465aa4[_0x20b5('0x37')]['filter']){_0x4ca82f[_0x20b5('0x40')]=_['merge'](_0x4ca82f[_0x20b5('0x40')],{'$or':_['map'](_0x4ca82f['attributes'],function(_0x410ebb){var _0x1743da={};_0x1743da[_0x410ebb]={'$like':'%'+_0x465aa4[_0x20b5('0x37')][_0x20b5('0x43')]+'%'};return _0x1743da;})});}_0x4ca82f=_[_0x20b5('0x44')]({},_0x4ca82f,_0x465aa4[_0x20b5('0x46')]);return _0x51d164[_0x20b5('0x74')](_0x4ca82f);}})['then'](function(_0x5b4308){if(_0x5b4308){_0x91245b=_0x5b4308['length'];if(!_0x465aa4['query'][_0x20b5('0x3c')](_0x20b5('0x3d'))){_0x4ca82f[_0x20b5('0x1e')]=qs['limit'](_0x465aa4[_0x20b5('0x37')][_0x20b5('0x1e')]);_0x4ca82f['offset']=qs[_0x20b5('0x1c')](_0x465aa4[_0x20b5('0x37')][_0x20b5('0x1c')]);}return _0x51d164[_0x20b5('0x74')](_0x4ca82f);}})[_0x20b5('0x26')](function(_0x57c408){if(_0x57c408){return _0x57c408?{'count':_0x91245b,'rows':_0x57c408}:null;}})[_0x20b5('0x26')](respondWithResult(_0x35060b,null))['catch'](handleError(_0x35060b,null));}; \ No newline at end of file +var _0x23e1=['sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','UserProfileResource','end','error','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','update','body','find','create','sequelize','transaction','mode','directory','join','mkdirSync','0777','user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','basename','server/files/moh','%s.%s','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound','getSounds','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3f4ba6,_0x133cd6){var _0x4fa5a3=function(_0x136d8b){while(--_0x136d8b){_0x3f4ba6['push'](_0x3f4ba6['shift']());}};_0x4fa5a3(++_0x133cd6);}(_0x23e1,0xcc));var _0x123e=function(_0x3c3d85,_0x1f0d39){_0x3c3d85=_0x3c3d85-0x0;var _0x1a8b6e=_0x23e1[_0x3c3d85];return _0x1a8b6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x123e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x123e('0x1'));var rp=require(_0x123e('0x2'));var moment=require('moment');var BPromise=require(_0x123e('0x3'));var Mustache=require(_0x123e('0x4'));var util=require(_0x123e('0x5'));var path=require(_0x123e('0x6'));var sox=require(_0x123e('0x7'));var csv=require(_0x123e('0x8'));var ejs=require(_0x123e('0x9'));var fs=require('fs');var fs_extra=require(_0x123e('0xa'));var _=require(_0x123e('0xb'));var squel=require(_0x123e('0xc'));var crypto=require(_0x123e('0xd'));var jsforce=require(_0x123e('0xe'));var deskjs=require(_0x123e('0xf'));var toCsv=require(_0x123e('0x8'));var querystring=require(_0x123e('0x10'));var Papa=require(_0x123e('0x11'));var Redis=require('ioredis');var authService=require(_0x123e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x123e('0x13'));var logger=require(_0x123e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x123e('0x15'));var licenseUtil=require(_0x123e('0x16'));var db=require(_0x123e('0x17'))['db'];function respondWithStatusCode(_0x4b24f5,_0x12b479){_0x12b479=_0x12b479||0xcc;return function(_0x450749){if(_0x450749){return _0x4b24f5[_0x123e('0x18')](_0x12b479);}return _0x4b24f5['status'](_0x12b479)['end']();};}function respondWithResult(_0x1f86fd,_0x48101b){_0x48101b=_0x48101b||0xc8;return function(_0x4ccb21){if(_0x4ccb21){return _0x1f86fd[_0x123e('0x19')](_0x48101b)[_0x123e('0x1a')](_0x4ccb21);}};}function respondWithFilteredResult(_0x612b5a,_0x670a4d){return function(_0x552e6d){if(_0x552e6d){var _0xed0e7f=typeof _0x670a4d[_0x123e('0x1b')]===_0x123e('0x1c')&&typeof _0x670a4d['limit']===_0x123e('0x1c');var _0x38cd00=_0x552e6d[_0x123e('0x1d')];var _0x49cc9a=_0xed0e7f?0x0:_0x670a4d['offset'];var _0x587484=_0xed0e7f?_0x552e6d[_0x123e('0x1d')]:_0x670a4d[_0x123e('0x1b')]+_0x670a4d[_0x123e('0x1e')];var _0x16b81a;if(_0x587484>=_0x38cd00){_0x587484=_0x38cd00;_0x16b81a=0xc8;}else{_0x16b81a=0xce;}_0x612b5a[_0x123e('0x19')](_0x16b81a);return _0x612b5a[_0x123e('0x1f')]('Content-Range',_0x49cc9a+'-'+_0x587484+'/'+_0x38cd00)['json'](_0x552e6d);}return null;};}function patchUpdates(_0x58f0ea){return function(_0xe92296){try{jsonpatch[_0x123e('0x20')](_0xe92296,_0x58f0ea,!![]);}catch(_0x25f330){return BPromise[_0x123e('0x21')](_0x25f330);}return _0xe92296[_0x123e('0x22')]();};}function saveUpdates(_0x262265,_0xbe280){return function(_0x142bdd){if(_0x142bdd){return _0x142bdd['update'](_0x262265)[_0x123e('0x23')](function(_0x574e92){return _0x574e92;});}return null;};}function removeEntity(_0x437538,_0x37afa6){return function(_0x38dee5){if(_0x38dee5){return _0x38dee5[_0x123e('0x24')]()[_0x123e('0x23')](function(){var _0x3c1a47=_0x38dee5['get']({'plain':!![]});var _0x392452='MusicOnHolds';return db[_0x123e('0x25')]['destroy']({'where':{'type':_0x392452,'resourceId':_0x3c1a47['id']}})['then'](function(){return _0x38dee5;});})[_0x123e('0x23')](function(){_0x437538[_0x123e('0x19')](0xcc)[_0x123e('0x26')]();});}};}function handleEntityNotFound(_0x345365,_0x142783){return function(_0x157ca4){if(!_0x157ca4){_0x345365[_0x123e('0x18')](0x194);}return _0x157ca4;};}function handleError(_0x80b4aa,_0x367029){_0x367029=_0x367029||0x1f4;return function(_0x13ff10){logger[_0x123e('0x27')](_0x13ff10['stack']);if(_0x13ff10['name']){delete _0x13ff10['name'];}_0x80b4aa['status'](_0x367029)[_0x123e('0x28')](_0x13ff10);};}exports['index']=function(_0x53f9ef,_0x3c0ee5){var _0x3eb3ca={},_0x1e256d={},_0x18ffef={'count':0x0,'rows':[]};var _0xe93271=_[_0x123e('0x29')](db[_0x123e('0x2a')][_0x123e('0x2b')],function(_0x24aedd){return{'name':_0x24aedd[_0x123e('0x2c')],'type':_0x24aedd[_0x123e('0x2d')][_0x123e('0x2e')]};});_0x1e256d['model']=_[_0x123e('0x29')](_0xe93271,_0x123e('0x2f'));_0x1e256d[_0x123e('0x30')]=_[_0x123e('0x31')](_0x53f9ef[_0x123e('0x30')]);_0x1e256d[_0x123e('0x32')]=_[_0x123e('0x33')](_0x1e256d[_0x123e('0x34')],_0x1e256d[_0x123e('0x30')]);_0x3eb3ca[_0x123e('0x35')]=_['intersection'](_0x1e256d[_0x123e('0x34')],qs[_0x123e('0x36')](_0x53f9ef[_0x123e('0x30')]['fields']));_0x3eb3ca[_0x123e('0x35')]=_0x3eb3ca['attributes'][_0x123e('0x37')]?_0x3eb3ca[_0x123e('0x35')]:_0x1e256d[_0x123e('0x34')];if(!_0x53f9ef[_0x123e('0x30')][_0x123e('0x38')](_0x123e('0x39'))){_0x3eb3ca[_0x123e('0x1e')]=qs['limit'](_0x53f9ef['query'][_0x123e('0x1e')]);_0x3eb3ca[_0x123e('0x1b')]=qs[_0x123e('0x1b')](_0x53f9ef[_0x123e('0x30')]['offset']);}_0x3eb3ca[_0x123e('0x3a')]=qs['sort'](_0x53f9ef[_0x123e('0x30')][_0x123e('0x3b')]);delete _0x53f9ef[_0x123e('0x30')][_0x123e('0x3b')];_0x3eb3ca[_0x123e('0x3c')]=qs[_0x123e('0x32')](_[_0x123e('0x3d')](_0x53f9ef['query'],_0x1e256d[_0x123e('0x32')]),_0xe93271);if(_0x53f9ef[_0x123e('0x30')]['filter']){_0x3eb3ca[_0x123e('0x3c')]=_['merge'](_0x3eb3ca[_0x123e('0x3c')],{'$or':_[_0x123e('0x29')](_0xe93271,function(_0x18f974){if(_0x18f974[_0x123e('0x2d')]!==_0x123e('0x3e')){var _0x3b07ea={};_0x3b07ea[_0x18f974[_0x123e('0x2f')]]={'$like':'%'+_0x53f9ef[_0x123e('0x30')][_0x123e('0x3f')]+'%'};return _0x3b07ea;}})});}_0x3eb3ca=_[_0x123e('0x40')]({},_0x3eb3ca,_0x53f9ef[_0x123e('0x41')]);var _0x44e8ab={'where':_0x3eb3ca[_0x123e('0x3c')]};return db[_0x123e('0x2a')][_0x123e('0x1d')](_0x44e8ab)['then'](function(_0x43a781){_0x18ffef[_0x123e('0x1d')]=_0x43a781;if(_0x53f9ef[_0x123e('0x30')][_0x123e('0x42')]){_0x3eb3ca[_0x123e('0x43')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x123e('0x44')](_0x3eb3ca);})[_0x123e('0x23')](function(_0x2eb5ad){_0x18ffef[_0x123e('0x45')]=_0x2eb5ad;return _0x18ffef;})[_0x123e('0x23')](respondWithFilteredResult(_0x3c0ee5,_0x3eb3ca))[_0x123e('0x46')](handleError(_0x3c0ee5,null));};exports[_0x123e('0x47')]=function(_0x5a73be,_0x292e81){var _0x2b08b5={'raw':![],'where':{'id':_0x5a73be[_0x123e('0x48')]['id']}},_0xba23a7={};_0xba23a7['model']=_[_0x123e('0x31')](db['VoiceMusicOnHold']['rawAttributes']);_0xba23a7['query']=_[_0x123e('0x31')](_0x5a73be[_0x123e('0x30')]);_0xba23a7[_0x123e('0x32')]=_[_0x123e('0x33')](_0xba23a7[_0x123e('0x34')],_0xba23a7['query']);_0x2b08b5[_0x123e('0x35')]=_[_0x123e('0x33')](_0xba23a7[_0x123e('0x34')],qs['fields'](_0x5a73be[_0x123e('0x30')][_0x123e('0x36')]));_0x2b08b5[_0x123e('0x35')]=_0x2b08b5['attributes']['length']?_0x2b08b5[_0x123e('0x35')]:_0xba23a7['model'];if(_0x5a73be['query']['includeAll']){_0x2b08b5[_0x123e('0x43')]=[{'all':!![]}];}_0x2b08b5=_[_0x123e('0x40')]({},_0x2b08b5,_0x5a73be['options']);return db[_0x123e('0x2a')]['find'](_0x2b08b5)[_0x123e('0x23')](handleEntityNotFound(_0x292e81,null))[_0x123e('0x23')](respondWithResult(_0x292e81,null))[_0x123e('0x46')](handleError(_0x292e81,null));};exports[_0x123e('0x49')]=function(_0x59e6c9,_0x7f2a65){if(_0x59e6c9[_0x123e('0x4a')]['id']){delete _0x59e6c9[_0x123e('0x4a')]['id'];}return db[_0x123e('0x2a')][_0x123e('0x4b')]({'where':{'id':_0x59e6c9['params']['id']}})[_0x123e('0x23')](handleEntityNotFound(_0x7f2a65,null))[_0x123e('0x23')](saveUpdates(_0x59e6c9[_0x123e('0x4a')],null))[_0x123e('0x23')](respondWithResult(_0x7f2a65,null))[_0x123e('0x46')](handleError(_0x7f2a65,null));};exports[_0x123e('0x4c')]=function(_0x27beb3,_0x3e4d20,_0x5b796e){return db[_0x123e('0x4d')][_0x123e('0x4e')](function(_0x3c2f92){if(_0x27beb3[_0x123e('0x4a')][_0x123e('0x4f')]==='files'){_0x27beb3[_0x123e('0x4a')][_0x123e('0x50')]=path[_0x123e('0x51')](config['root'],'server/files/moh',_0x27beb3[_0x123e('0x4a')][_0x123e('0x2f')]);}return db[_0x123e('0x2a')][_0x123e('0x4c')](_0x27beb3['body'],{'transaction':_0x3c2f92})['then'](function(_0x4ef831){if(_0x27beb3['body'][_0x123e('0x4f')]==='files'){fs[_0x123e('0x52')](_0x4ef831[_0x123e('0x50')],parseInt(_0x123e('0x53'),0x8));}var _0x50ef6b=_0x27beb3[_0x123e('0x54')]['get']({'plain':!![]});if(!_0x50ef6b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50ef6b[_0x123e('0x55')]==='user'){var _0x38f65c=_0x4ef831['get']({'plain':!![]});return db[_0x123e('0x56')][_0x123e('0x4b')]({'where':{'name':_0x123e('0x57'),'userProfileId':_0x50ef6b[_0x123e('0x58')]},'raw':!![]})[_0x123e('0x23')](function(_0x5e9c61){if(_0x5e9c61&&_0x5e9c61[_0x123e('0x59')]===0x0){return db[_0x123e('0x25')][_0x123e('0x4c')]({'name':_0x38f65c[_0x123e('0x2f')],'resourceId':_0x38f65c['id'],'type':_0x5e9c61['name'],'sectionId':_0x5e9c61['id']},{})['then'](function(){return _0x4ef831;});}else{return _0x4ef831;}})[_0x123e('0x46')](function(_0x20a486){logger['error'](_0x123e('0x5a'),_0x20a486);});}return _0x4ef831;});})[_0x123e('0x23')](respondWithResult(_0x3e4d20,0xc9))['catch'](handleError(_0x3e4d20,null));};exports[_0x123e('0x24')]=function(_0x1d6c0e,_0x1baea1,_0x33df57){var _0x5ab35c;return db['VoiceMusicOnHold'][_0x123e('0x4b')]({'where':{'id':_0x1d6c0e[_0x123e('0x48')]['id']}})[_0x123e('0x23')](function(_0x1bb2f6){if(_0x1bb2f6){return db[_0x123e('0x4d')][_0x123e('0x4e')](function(_0x9ec91b){return _0x1bb2f6[_0x123e('0x24')]({'transaction':_0x9ec91b,'raw':!![]})[_0x123e('0x23')](function(_0x426cc3){if(_0x426cc3[_0x123e('0x50')]){fs[_0x123e('0x5b')](_0x426cc3['directory'])[_0x123e('0x5c')](function(_0x456e03){fs[_0x123e('0x5d')](path['join'](_0x426cc3['directory'],_0x456e03));});fs[_0x123e('0x5e')](_0x426cc3['directory']);}return _0x426cc3;});})[_0x123e('0x46')](function(_0x3104f5){throw new db['Sequelize']['ValidationError'](_0x3104f5[_0x123e('0x5f')]);});}})[_0x123e('0x23')](handleEntityNotFound(_0x1baea1,null))[_0x123e('0x23')](removeEntity(_0x1baea1,null))[_0x123e('0x46')](handleError(_0x1baea1,null));};exports[_0x123e('0x60')]=function(_0x36f6a2,_0x36fdc1,_0x3792af){return db[_0x123e('0x4d')][_0x123e('0x4e')](function(_0x2a3596){var _0x1357d0;return db[_0x123e('0x2a')][_0x123e('0x4b')]({'where':{'id':_0x36f6a2[_0x123e('0x48')]['id']}})[_0x123e('0x23')](function(_0x186e4d){if(_0x186e4d){_0x1357d0=_0x186e4d;return _0x186e4d['addSound'](_0x36f6a2[_0x123e('0x4a')]['id'],{'transaction':_0x2a3596});}})[_0x123e('0x23')](function(_0x195e10){if(_0x195e10){return db['Sound'][_0x123e('0x61')]({'where':{'id':_0x36f6a2[_0x123e('0x4a')]['id']},'attributes':['id',_0x123e('0x2f'),_0x123e('0x62'),_0x123e('0x63'),_0x123e('0x64')],'raw':!![]});}})[_0x123e('0x23')](function(_0x335387){if(_0x335387){var _0x45ec26=path[_0x123e('0x51')](config[_0x123e('0x65')],_0x123e('0x66'),util[_0x123e('0x67')]('%s.%s',path[_0x123e('0x68')](_0x335387[_0x123e('0x62')],path['extname'](_0x335387[_0x123e('0x62')])),_0x335387[_0x123e('0x63')]));var _0xe71478=path[_0x123e('0x51')](config[_0x123e('0x65')],_0x123e('0x69'),_0x1357d0[_0x123e('0x2f')],util[_0x123e('0x67')](_0x123e('0x6a'),_0x335387[_0x123e('0x2f')],_0x335387[_0x123e('0x63')]));fs[_0x123e('0x6b')](_0x45ec26,_0xe71478);return _0x335387;}})['catch'](function(_0x2f6fe9){throw new db[(_0x123e('0x6c'))][(_0x123e('0x6d'))](_0x2f6fe9['message']);});})['then'](handleEntityNotFound(_0x36fdc1,null))['then'](respondWithResult(_0x36fdc1,0xc9))[_0x123e('0x46')](handleError(_0x36fdc1,null));};exports[_0x123e('0x6e')]=function(_0x3e948e,_0x28c587,_0x3fb481){return db['sequelize'][_0x123e('0x4e')](function(_0x4291c0){var _0xd5fbc;return db[_0x123e('0x2a')][_0x123e('0x61')]({'where':{'id':_0x3e948e[_0x123e('0x48')]['id']}})[_0x123e('0x23')](handleEntityNotFound(_0x28c587,null))[_0x123e('0x23')](function(_0x1725bd){if(_0x1725bd){_0xd5fbc=_0x1725bd;return _0x1725bd[_0x123e('0x6e')](_0x3e948e[_0x123e('0x48')][_0x123e('0x6f')]);}})[_0x123e('0x23')](function(_0x480d0f){if(_0x480d0f){return db[_0x123e('0x70')]['findOne']({'where':{'id':_0x3e948e['params'][_0x123e('0x6f')]},'attributes':['id',_0x123e('0x2f'),'save_name',_0x123e('0x63'),'createdAt'],'raw':!![]});}})[_0x123e('0x23')](function(_0x128136){if(_0x128136){fs[_0x123e('0x5d')](path[_0x123e('0x51')](_0xd5fbc['directory'],util['format'](_0x123e('0x6a'),_0x128136[_0x123e('0x2f')],_0x128136[_0x123e('0x63')])));return _0x128136;}})[_0x123e('0x46')](function(_0x18e6e4){throw new db[(_0x123e('0x6c'))][(_0x123e('0x6d'))](_0x18e6e4['message']);});})[_0x123e('0x23')](handleEntityNotFound(_0x28c587,null))[_0x123e('0x23')](respondWithStatusCode(_0x28c587,0xcc))[_0x123e('0x46')](handleError(_0x28c587,null));};exports[_0x123e('0x71')]=function(_0x230063,_0x50b6d7,_0x257318){var _0x30e20d={};var _0x252c99={};var _0x183c2a;var _0x5b2e0c;return db[_0x123e('0x2a')][_0x123e('0x61')]({'where':{'id':_0x230063['params']['id']}})[_0x123e('0x23')](handleEntityNotFound(_0x50b6d7,null))[_0x123e('0x23')](function(_0x5d9073){if(_0x5d9073){_0x183c2a=_0x5d9073;_0x252c99[_0x123e('0x34')]=_[_0x123e('0x31')](db[_0x123e('0x70')][_0x123e('0x2b')]);_0x252c99[_0x123e('0x30')]=_[_0x123e('0x31')](_0x230063[_0x123e('0x30')]);_0x252c99[_0x123e('0x32')]=_[_0x123e('0x33')](_0x252c99['model'],_0x252c99[_0x123e('0x30')]);_0x30e20d[_0x123e('0x35')]=_['intersection'](_0x252c99[_0x123e('0x34')],qs[_0x123e('0x36')](_0x230063[_0x123e('0x30')][_0x123e('0x36')]));_0x30e20d['attributes']=_0x30e20d['attributes'][_0x123e('0x37')]?_0x30e20d[_0x123e('0x35')]:_0x252c99[_0x123e('0x34')];_0x30e20d[_0x123e('0x3a')]=qs[_0x123e('0x3b')](_0x230063[_0x123e('0x30')][_0x123e('0x3b')]);_0x30e20d['where']=qs[_0x123e('0x32')](_[_0x123e('0x3d')](_0x230063['query'],_0x252c99[_0x123e('0x32')]));if(_0x230063['query'][_0x123e('0x3f')]){_0x30e20d['where']=_[_0x123e('0x40')](_0x30e20d['where'],{'$or':_[_0x123e('0x29')](_0x30e20d[_0x123e('0x35')],function(_0x3d32c4){var _0x2cf3c6={};_0x2cf3c6[_0x3d32c4]={'$like':'%'+_0x230063[_0x123e('0x30')][_0x123e('0x3f')]+'%'};return _0x2cf3c6;})});}_0x30e20d=_['merge']({},_0x30e20d,_0x230063['options']);return _0x183c2a[_0x123e('0x71')](_0x30e20d);}})[_0x123e('0x23')](function(_0x23c54c){if(_0x23c54c){_0x5b2e0c=_0x23c54c[_0x123e('0x37')];if(!_0x230063[_0x123e('0x30')][_0x123e('0x38')]('nolimit')){_0x30e20d[_0x123e('0x1e')]=qs[_0x123e('0x1e')](_0x230063[_0x123e('0x30')][_0x123e('0x1e')]);_0x30e20d[_0x123e('0x1b')]=qs[_0x123e('0x1b')](_0x230063['query'][_0x123e('0x1b')]);}return _0x183c2a[_0x123e('0x71')](_0x30e20d);}})['then'](function(_0x3b5770){if(_0x3b5770){return _0x3b5770?{'count':_0x5b2e0c,'rows':_0x3b5770}:null;}})[_0x123e('0x23')](respondWithResult(_0x50b6d7,null))[_0x123e('0x46')](handleError(_0x50b6d7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2b79433..9473308 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 _0x5e57=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger'];(function(_0x50450d,_0x314c15){var _0x1c391b=function(_0x3d5c86){while(--_0x3d5c86){_0x50450d['push'](_0x50450d['shift']());}};_0x1c391b(++_0x314c15);}(_0x5e57,0x19e));var _0x75e5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5e57[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x75e5('0x0'));var logger=require(_0x75e5('0x1'))('api');var moment=require(_0x75e5('0x2'));var BPromise=require(_0x75e5('0x3'));var rp=require(_0x75e5('0x4'));var fs=require('fs');var path=require(_0x75e5('0x5'));var rimraf=require(_0x75e5('0x6'));var config=require(_0x75e5('0x7'));var attributes=require(_0x75e5('0x8'));module[_0x75e5('0x9')]=function(_0x57d33d,_0x4e5ab3){return _0x57d33d[_0x75e5('0xa')](_0x75e5('0xb'),attributes,{'tableName':_0x75e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d09=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold'];(function(_0xcba4b6,_0x1ecf6a){var _0x2bd8bf=function(_0x46812a){while(--_0x46812a){_0xcba4b6['push'](_0xcba4b6['shift']());}};_0x2bd8bf(++_0x1ecf6a);}(_0x7d09,0x1ba));var _0x97d0=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x7d09[_0x4bb145];return _0x4db596;};'use strict';var _=require(_0x97d0('0x0'));var util=require(_0x97d0('0x1'));var logger=require(_0x97d0('0x2'))('api');var moment=require(_0x97d0('0x3'));var BPromise=require(_0x97d0('0x4'));var rp=require(_0x97d0('0x5'));var fs=require('fs');var path=require(_0x97d0('0x6'));var rimraf=require(_0x97d0('0x7'));var config=require(_0x97d0('0x8'));var attributes=require(_0x97d0('0x9'));module[_0x97d0('0xa')]=function(_0x390a6b,_0x5af36b){return _0x390a6b['define'](_0x97d0('0xb'),attributes,{'tableName':_0x97d0('0xc'),'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 5b33d60..82e3ebf 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 _0xe18c=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xe18c,0x1a4));var _0xce18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce18('0x0'));var util=require(_0xce18('0x1'));var moment=require(_0xce18('0x2'));var BPromise=require('bluebird');var rs=require(_0xce18('0x3'));var fs=require('fs');var Redis=require(_0xce18('0x4'));var db=require(_0xce18('0x5'))['db'];var utils=require(_0xce18('0x6'));var logger=require(_0xce18('0x7'))(_0xce18('0x8'));var config=require('../../config/environment');var jayson=require(_0xce18('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x185a42,_0x23600f,_0x5df735){return new BPromise(function(_0x42cb53,_0x57be88){return client[_0xce18('0xa')](_0x185a42,_0x5df735)[_0xce18('0xb')](function(_0x29cb5b){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x23600f,'request\x20sent');logger[_0xce18('0xc')](_0xce18('0xd'),_0x23600f,_0xce18('0xe'),JSON['stringify'](_0x29cb5b));if(_0x29cb5b[_0xce18('0xf')]){if(_0x29cb5b[_0xce18('0xf')][_0xce18('0x10')]===0x1f4){logger[_0xce18('0xf')](_0xce18('0x11'),_0x23600f,_0x29cb5b[_0xce18('0xf')][_0xce18('0x12')]);return _0x57be88(_0x29cb5b['error'][_0xce18('0x12')]);}logger[_0xce18('0xf')](_0xce18('0x11'),_0x23600f,_0x29cb5b[_0xce18('0xf')]['message']);return _0x42cb53(_0x29cb5b[_0xce18('0xf')][_0xce18('0x12')]);}else{logger['info'](_0xce18('0x11'),_0x23600f,_0xce18('0xe'));_0x42cb53(_0x29cb5b[_0xce18('0x13')][_0xce18('0x12')]);}})['catch'](function(_0x576cb3){logger[_0xce18('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x23600f,_0x576cb3);_0x57be88(_0x576cb3);});});} \ No newline at end of file +var _0xe868=['debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent'];(function(_0x3c6ff0,_0x343418){var _0x35ce54=function(_0xa0670d){while(--_0xa0670d){_0x3c6ff0['push'](_0x3c6ff0['shift']());}};_0x35ce54(++_0x343418);}(_0xe868,0x80));var _0x8e86=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe868[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x8e86('0x0'));var moment=require(_0x8e86('0x1'));var BPromise=require('bluebird');var rs=require(_0x8e86('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e86('0x3'))['db'];var utils=require(_0x8e86('0x4'));var logger=require(_0x8e86('0x5'))(_0x8e86('0x6'));var config=require('../../config/environment');var jayson=require(_0x8e86('0x7'));var client=jayson['client'][_0x8e86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x489838,_0x450cdc,_0x382c89){return new BPromise(function(_0x4d7876,_0x2548ec){return client['request'](_0x489838,_0x382c89)['then'](function(_0x55bafd){logger[_0x8e86('0x9')](_0x8e86('0xa'),_0x450cdc,_0x8e86('0xb'));logger[_0x8e86('0xc')](_0x8e86('0xd'),_0x450cdc,_0x8e86('0xb'),JSON[_0x8e86('0xe')](_0x55bafd));if(_0x55bafd[_0x8e86('0xf')]){if(_0x55bafd['error'][_0x8e86('0x10')]===0x1f4){logger[_0x8e86('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x450cdc,_0x55bafd[_0x8e86('0xf')][_0x8e86('0x11')]);return _0x2548ec(_0x55bafd[_0x8e86('0xf')][_0x8e86('0x11')]);}logger[_0x8e86('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x450cdc,_0x55bafd[_0x8e86('0xf')][_0x8e86('0x11')]);return _0x4d7876(_0x55bafd[_0x8e86('0xf')]['message']);}else{logger[_0x8e86('0x9')](_0x8e86('0xa'),_0x450cdc,'request\x20sent');_0x4d7876(_0x55bafd[_0x8e86('0x12')][_0x8e86('0x11')]);}})[_0x8e86('0x13')](function(_0x5bec29){logger['error'](_0x8e86('0xa'),_0x450cdc,_0x5bec29);_0x2548ec(_0x5bec29);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 78508bc..f3b0b47 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 _0xabce=['post','create','addAgents','put','/:id','delete','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/users','getAgents'];(function(_0x81e1b6,_0x350b6a){var _0x48d1ca=function(_0x26b6d5){while(--_0x26b6d5){_0x81e1b6['push'](_0x81e1b6['shift']());}};_0x48d1ca(++_0x350b6a);}(_0xabce,0x103));var _0xeabc=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xabce[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0xe')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0x12'),auth[_0xeabc('0x8')](),controller['update']);router[_0xeabc('0x13')](_0xeabc('0x12'),auth[_0xeabc('0x8')](),controller['destroy']);router['delete'](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9a5a=['/describe','isAuthenticated','describe','show','/:id/users','getAgents','post','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index'];(function(_0x1df227,_0x24aa24){var _0x560cbe=function(_0x16ec15){while(--_0x16ec15){_0x1df227['push'](_0x1df227['shift']());}};_0x560cbe(++_0x24aa24);}(_0x9a5a,0x194));var _0xa9a5=function(_0x575c01,_0xd1bef5){_0x575c01=_0x575c01-0x0;var _0x327287=_0x9a5a[_0x575c01];return _0x327287;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xa9a5('0x5'));var auth=require(_0xa9a5('0x6'));var interaction=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xa')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0xa')](_0xa9a5('0x10'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x11')]);router[_0xa9a5('0x12')]('/',auth[_0xa9a5('0xd')](),controller['create']);router['post']('/:id/users',auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x13')]);router[_0xa9a5('0x14')](_0xa9a5('0x15'),auth[_0xa9a5('0xd')](),controller['update']);router[_0xa9a5('0x16')](_0xa9a5('0x15'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x17')]);router[_0xa9a5('0x16')](_0xa9a5('0x10'),auth['isAuthenticated'](),controller[_0xa9a5('0x18')]);module[_0xa9a5('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ad79ec5..cac0c8e 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 _0x835a=['INTEGER','STRING','name','VIRTUAL','system-'];(function(_0x3ffd27,_0x24a889){var _0x376083=function(_0xad4ae0){while(--_0xad4ae0){_0x3ffd27['push'](_0x3ffd27['shift']());}};_0x376083(++_0x24a889);}(_0x835a,0x8d));var _0xa835=function(_0x37abeb,_0x5e19b5){_0x37abeb=_0x37abeb-0x0;var _0x2008d2=_0x835a[_0x37abeb];return _0x2008d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa835('0x0')],'allowNull':![],'unique':_0xa835('0x1')},'prefix':{'type':Sequelize[_0xa835('0x2')],'get':function(_0x50eedc){return _0xa835('0x3')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xa835('0x0')]},'callerIdAll':{'type':Sequelize[_0xa835('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0xa835('0x4')]}}; \ No newline at end of file +var _0x8856=['VIRTUAL','system-','STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8856,0xe2));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6885('0x0'));module[_0x6885('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x6885('0x2')],'get':function(_0x1b6d04){return _0x6885('0x3')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x6885('0x4')]},'callerIdAll':{'type':Sequelize[_0x6885('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x6885('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5470f9f..cfca666 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 _0x497f=['create','sequelize','transaction','body','VoiceExtensionId','get','role','user','autoAssociation','error','context','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','params','ids','emit','removeAgents','userVoicePrefix:remove','findOne','User','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','undefined','limit','offset','Content-Range','save','update','then','destroy','VoicePrefixes','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VoicePrefix','count','includeAll','rows','show','include','options','find','catch','describe'];(function(_0x3b4c88,_0x51ab49){var _0x47cce1=function(_0x121b4c){while(--_0x121b4c){_0x3b4c88['push'](_0x3b4c88['shift']());}};_0x47cce1(++_0x51ab49);}(_0x497f,0x118));var _0xf497=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0x497f[_0x119629];return _0x49a771;};'use strict';var emlformat=require(_0xf497('0x0'));var rimraf=require(_0xf497('0x1'));var zipdir=require(_0xf497('0x2'));var jsonpatch=require(_0xf497('0x3'));var rp=require(_0xf497('0x4'));var moment=require(_0xf497('0x5'));var BPromise=require(_0xf497('0x6'));var Mustache=require(_0xf497('0x7'));var util=require('util');var path=require(_0xf497('0x8'));var sox=require('sox');var csv=require(_0xf497('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf497('0xa'));var _=require(_0xf497('0xb'));var squel=require(_0xf497('0xc'));var crypto=require(_0xf497('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf497('0xe'));var toCsv=require(_0xf497('0x9'));var querystring=require(_0xf497('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf497('0x10'));var qs=require(_0xf497('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf497('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf497('0x13'));var db=require('../../mysqldb')['db'];config[_0xf497('0x14')]=_[_0xf497('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf497('0x16'))(new Redis(config['redis']));require(_0xf497('0x17'))[_0xf497('0x18')](socket);function respondWithStatusCode(_0x3f2496,_0x5da6f5){_0x5da6f5=_0x5da6f5||0xcc;return function(_0x2c7c1a){if(_0x2c7c1a){return _0x3f2496[_0xf497('0x19')](_0x5da6f5);}return _0x3f2496['status'](_0x5da6f5)[_0xf497('0x1a')]();};}function respondWithResult(_0x561611,_0x2ab4ba){_0x2ab4ba=_0x2ab4ba||0xc8;return function(_0x5206aa){if(_0x5206aa){return _0x561611[_0xf497('0x1b')](_0x2ab4ba)[_0xf497('0x1c')](_0x5206aa);}};}function respondWithFilteredResult(_0x372616,_0x610cc){return function(_0x1d216d){if(_0x1d216d){var _0x595ca7=typeof _0x610cc['offset']===_0xf497('0x1d')&&typeof _0x610cc[_0xf497('0x1e')]===_0xf497('0x1d');var _0x1d505b=_0x1d216d['count'];var _0x3fc74b=_0x595ca7?0x0:_0x610cc[_0xf497('0x1f')];var _0x50a42e=_0x595ca7?_0x1d216d['count']:_0x610cc['offset']+_0x610cc[_0xf497('0x1e')];var _0x290342;if(_0x50a42e>=_0x1d505b){_0x50a42e=_0x1d505b;_0x290342=0xc8;}else{_0x290342=0xce;}_0x372616['status'](_0x290342);return _0x372616['set'](_0xf497('0x20'),_0x3fc74b+'-'+_0x50a42e+'/'+_0x1d505b)['json'](_0x1d216d);}return null;};}function patchUpdates(_0x343e13){return function(_0x240968){try{jsonpatch['apply'](_0x240968,_0x343e13,!![]);}catch(_0x294dc5){return BPromise['reject'](_0x294dc5);}return _0x240968[_0xf497('0x21')]();};}function saveUpdates(_0xd2f9d2,_0xa9f992){return function(_0x44081f){if(_0x44081f){return _0x44081f[_0xf497('0x22')](_0xd2f9d2)[_0xf497('0x23')](function(_0x4445f7){return _0x4445f7;});}return null;};}function removeEntity(_0x19f76f,_0x1c79d2){return function(_0xc3cda7){if(_0xc3cda7){return _0xc3cda7[_0xf497('0x24')]()[_0xf497('0x23')](function(){var _0x1e9087=_0xc3cda7['get']({'plain':!![]});var _0x7750e5=_0xf497('0x25');return db[_0xf497('0x26')][_0xf497('0x24')]({'where':{'type':_0x7750e5,'resourceId':_0x1e9087['id']}})[_0xf497('0x23')](function(){return _0xc3cda7;});})[_0xf497('0x23')](function(){_0x19f76f[_0xf497('0x1b')](0xcc)[_0xf497('0x1a')]();});}};}function handleEntityNotFound(_0x407d1f,_0x24b450){return function(_0x17f291){if(!_0x17f291){_0x407d1f[_0xf497('0x19')](0x194);}return _0x17f291;};}function handleError(_0x1b97f2,_0x54b5fa){_0x54b5fa=_0x54b5fa||0x1f4;return function(_0x268692){logger['error'](_0x268692[_0xf497('0x27')]);if(_0x268692[_0xf497('0x28')]){delete _0x268692[_0xf497('0x28')];}_0x1b97f2[_0xf497('0x1b')](_0x54b5fa)[_0xf497('0x29')](_0x268692);};}exports[_0xf497('0x2a')]=function(_0x1a1136,_0xb96efb){var _0x32dfc0={},_0x3160f2={},_0x5998fb={'count':0x0,'rows':[]};var _0x388dc4=_['map'](db['VoicePrefix'][_0xf497('0x2b')],function(_0x493663){return{'name':_0x493663[_0xf497('0x2c')],'type':_0x493663[_0xf497('0x2d')][_0xf497('0x2e')]};});_0x3160f2['model']=_[_0xf497('0x2f')](_0x388dc4,_0xf497('0x28'));_0x3160f2[_0xf497('0x30')]=_[_0xf497('0x31')](_0x1a1136[_0xf497('0x30')]);_0x3160f2[_0xf497('0x32')]=_[_0xf497('0x33')](_0x3160f2[_0xf497('0x34')],_0x3160f2['query']);_0x32dfc0[_0xf497('0x35')]=_[_0xf497('0x33')](_0x3160f2[_0xf497('0x34')],qs[_0xf497('0x36')](_0x1a1136[_0xf497('0x30')][_0xf497('0x36')]));_0x32dfc0[_0xf497('0x35')]=_0x32dfc0[_0xf497('0x35')][_0xf497('0x37')]?_0x32dfc0['attributes']:_0x3160f2[_0xf497('0x34')];if(!_0x1a1136[_0xf497('0x30')][_0xf497('0x38')](_0xf497('0x39'))){_0x32dfc0[_0xf497('0x1e')]=qs[_0xf497('0x1e')](_0x1a1136['query'][_0xf497('0x1e')]);_0x32dfc0['offset']=qs['offset'](_0x1a1136[_0xf497('0x30')][_0xf497('0x1f')]);}_0x32dfc0[_0xf497('0x3a')]=qs[_0xf497('0x3b')](_0x1a1136[_0xf497('0x30')][_0xf497('0x3b')]);_0x32dfc0[_0xf497('0x3c')]=qs[_0xf497('0x32')](_['pick'](_0x1a1136[_0xf497('0x30')],_0x3160f2[_0xf497('0x32')]),_0x388dc4);if(_0x1a1136[_0xf497('0x30')][_0xf497('0x3d')]){_0x32dfc0[_0xf497('0x3c')]=_[_0xf497('0x3e')](_0x32dfc0[_0xf497('0x3c')],{'$or':_['map'](_0x388dc4,function(_0x112357){if(_0x112357['type']!==_0xf497('0x3f')){var _0x156ebe={};_0x156ebe[_0x112357['name']]={'$like':'%'+_0x1a1136[_0xf497('0x30')]['filter']+'%'};return _0x156ebe;}})});}_0x32dfc0=_[_0xf497('0x3e')]({},_0x32dfc0,_0x1a1136['options']);var _0x3d0085={'where':_0x32dfc0['where']};return db[_0xf497('0x40')][_0xf497('0x41')](_0x3d0085)['then'](function(_0x32190b){_0x5998fb[_0xf497('0x41')]=_0x32190b;if(_0x1a1136[_0xf497('0x30')][_0xf497('0x42')]){_0x32dfc0['include']=[{'all':!![]}];}return db[_0xf497('0x40')]['findAll'](_0x32dfc0);})['then'](function(_0x4ca38d){_0x5998fb[_0xf497('0x43')]=_0x4ca38d;return _0x5998fb;})[_0xf497('0x23')](respondWithFilteredResult(_0xb96efb,_0x32dfc0))['catch'](handleError(_0xb96efb,null));};exports[_0xf497('0x44')]=function(_0x14175e,_0x31f6a1){var _0xd7cc90={'raw':![],'where':{'id':_0x14175e['params']['id']}},_0x5bb8d5={};_0x5bb8d5[_0xf497('0x34')]=_[_0xf497('0x31')](db[_0xf497('0x40')][_0xf497('0x2b')]);_0x5bb8d5['query']=_[_0xf497('0x31')](_0x14175e['query']);_0x5bb8d5['filters']=_[_0xf497('0x33')](_0x5bb8d5[_0xf497('0x34')],_0x5bb8d5[_0xf497('0x30')]);_0xd7cc90[_0xf497('0x35')]=_[_0xf497('0x33')](_0x5bb8d5[_0xf497('0x34')],qs[_0xf497('0x36')](_0x14175e['query'][_0xf497('0x36')]));_0xd7cc90['attributes']=_0xd7cc90[_0xf497('0x35')]['length']?_0xd7cc90[_0xf497('0x35')]:_0x5bb8d5[_0xf497('0x34')];if(_0x14175e[_0xf497('0x30')][_0xf497('0x42')]){_0xd7cc90[_0xf497('0x45')]=[{'all':!![]}];}_0xd7cc90=_[_0xf497('0x3e')]({},_0xd7cc90,_0x14175e[_0xf497('0x46')]);return db[_0xf497('0x40')][_0xf497('0x47')](_0xd7cc90)[_0xf497('0x23')](handleEntityNotFound(_0x31f6a1,null))[_0xf497('0x23')](respondWithResult(_0x31f6a1,null))[_0xf497('0x48')](handleError(_0x31f6a1,null));};exports[_0xf497('0x24')]=function(_0x220169,_0xf0618f){return db[_0xf497('0x40')][_0xf497('0x47')]({'where':{'id':_0x220169['params']['id']}})[_0xf497('0x23')](handleEntityNotFound(_0xf0618f,null))['then'](removeEntity(_0xf0618f,null))[_0xf497('0x48')](handleError(_0xf0618f,null));};exports[_0xf497('0x49')]=function(_0x54d724,_0x43f6a6){return db['VoicePrefix'][_0xf497('0x49')]()[_0xf497('0x23')](respondWithResult(_0x43f6a6,null))['catch'](handleError(_0x43f6a6,null));};exports[_0xf497('0x4a')]=function(_0x18a4f9,_0x94f749){var _0x30ea07;return db[_0xf497('0x4b')][_0xf497('0x4c')](function(_0x45aece){return db[_0xf497('0x40')]['create'](_0x18a4f9[_0xf497('0x4d')],{'transaction':_0x45aece})[_0xf497('0x23')](function(_0x583b49){_0x30ea07=_0x583b49['get']({'plain':!![]});return db['VoiceExtension'][_0xf497('0x47')]({'where':{'id':_0x30ea07[_0xf497('0x4e')]},'raw':!![]})[_0xf497('0x23')](function(_0x5028bc){return createVoicePrefixExtensions(_0x30ea07,_0x5028bc,_0x45aece);});});})[_0xf497('0x23')](function(){var _0xbfb5af=_0x18a4f9['user'][_0xf497('0x4f')]({'plain':!![]});if(!_0xbfb5af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbfb5af[_0xf497('0x50')]===_0xf497('0x51')){var _0x341539=_0x30ea07;return db['UserProfileSection']['find']({'where':{'name':_0xf497('0x25'),'userProfileId':_0xbfb5af['userProfileId']},'raw':!![]})[_0xf497('0x23')](function(_0x298b76){if(_0x298b76&&_0x298b76[_0xf497('0x52')]===0x0){return db['UserProfileResource'][_0xf497('0x4a')]({'name':_0x341539[_0xf497('0x28')],'resourceId':_0x341539['id'],'type':_0x298b76[_0xf497('0x28')],'sectionId':_0x298b76['id']},{})[_0xf497('0x23')](function(){return _0x30ea07;});}else{return _0x30ea07;}})[_0xf497('0x48')](function(_0x34a232){logger[_0xf497('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34a232);throw _0x34a232;});}return _0x30ea07;})[_0xf497('0x23')](respondWithResult(_0x94f749,null))['catch'](handleError(_0x94f749,null));};function Extension(_0x4a7ead,_0x154e58,_0x4593d8,_0x30d95c){this[_0xf497('0x54')]='from-sip';this[_0xf497('0x55')]=_0x4a7ead;this[_0xf497('0x56')]=_0x4593d8;this[_0xf497('0x2d')]=_0xf497('0x57');this[_0xf497('0x58')]=_0xf497('0x59');this['priority']=_0x154e58;this[_0xf497('0x5a')]=_0x30d95c;}function createVoicePrefixExtensions(_0x4a6348,_0x16abaa,_0x5df3eb){return new BPromise(function(_0x36a5db,_0x23f0a0){var _0x4dd4b6=new Extension(formatPrefixName(_0x4a6348[_0xf497('0x5b')]),0x1,_0xf497('0x5c'),_0xf497('0x5d'));_0x4dd4b6[_0xf497('0x5e')]=_0x4a6348['id'];return db[_0xf497('0x5f')]['create'](_0x4dd4b6,{'transaction':_0x5df3eb})[_0xf497('0x23')](function(_0x507d1e){var _0x10100b=_0x507d1e['get']({'plain':!![]});var _0x13720c=_[_0xf497('0x2f')](addVoicePrefixExtensions(_0x4a6348,_0x16abaa),function(_0x375f7){_0x375f7[_0xf497('0x4e')]=_0x10100b['id'];_0x375f7[_0xf497('0x5e')]=_0x4a6348['id'];return _0x375f7;});return db[_0xf497('0x5f')][_0xf497('0x60')](_0x13720c,{'transaction':_0x5df3eb})['then'](function(_0x4f9e7b){if(!_0x4f9e7b){return _0x23f0a0(_0xf497('0x61'));}else{return _0x36a5db(_0x4f9e7b);}})[_0xf497('0x48')](function(_0x42a84e){return _0x23f0a0(_0x42a84e);});});;});};function addVoicePrefixExtensions(_0x4023f5,_0x2ddd72){var _0x38aa8b=[];var _0x410593=formatPrefixName(_0x4023f5[_0xf497('0x5b')]);_0x38aa8b[_0xf497('0x62')](new Extension(_0x410593,0x2,'Set',_0xf497('0x63')+_0x4023f5[_0xf497('0x28')]));if(_0x4023f5[_0xf497('0x64')]){_0x38aa8b[_0xf497('0x62')](new Extension(_0x410593,0x3,_0xf497('0x65'),'PREFIX-CALLERIDALL='+_0x4023f5[_0xf497('0x64')]));}else{_0x38aa8b['push'](new Extension(_0x410593,0x3,_0xf497('0x5c'),_0xf497('0x66')));}_0x38aa8b[_0xf497('0x62')](new Extension(_0x410593,0x4,_0xf497('0x67'),_0x2ddd72['context']+','+_0xf497('0x68')+(0x8+_0x4023f5[_0xf497('0x28')]['length'])+'}'+','+0x1));return _0x38aa8b;}function formatPrefixName(_0x194348){var _0x5baea6='_';for(var _0x2ec424=0x0;_0x2ec424<_0x194348[_0xf497('0x37')];_0x2ec424++){if(_0x194348[_0xf497('0x69')](_0x2ec424)=='-'){_0x5baea6+=_0x194348[_0xf497('0x69')](_0x2ec424);}else{_0x5baea6+='['+_0x194348[_0xf497('0x69')](_0x2ec424)+']';}}_0x5baea6+='.';return _0x5baea6;}exports['update']=function(_0x10ab9e,_0x2aba80,_0x2fcd03){var _0x2673a3=_0x10ab9e[_0xf497('0x4d')];_0x2673a3[_0xf497('0x5b')]=_0xf497('0x6a')+_0x2673a3[_0xf497('0x28')]+'-';return db[_0xf497('0x4b')][_0xf497('0x4c')](function(_0x98dfee){return db['VoicePrefix'][_0xf497('0x22')](_0x2673a3,{'where':{'id':_0x2673a3['id']},'transaction':_0x98dfee})['then'](function(){return db['VoiceExtension'][_0xf497('0x24')]({'where':{'VoicePrefixId':_0x2673a3['id']},'transaction':_0x98dfee})[_0xf497('0x23')](function(){return db['VoiceExtension'][_0xf497('0x47')]({'where':{'id':_0x2673a3['VoiceExtensionId']},'raw':!![]})[_0xf497('0x23')](function(_0x38deaa){return createVoicePrefixExtensions(_0x2673a3,_0x38deaa,_0x98dfee);});});});})['then'](function(){return db[_0xf497('0x40')][_0xf497('0x6b')](_0x2673a3['id']);})['then'](respondWithResult(_0x2aba80,null))['catch'](handleError(_0x2aba80,null));};exports[_0xf497('0x6c')]=function(_0x205bff,_0x5c1f97,_0x37dca2){return db[_0xf497('0x40')]['find']({'where':{'id':_0x205bff[_0xf497('0x6d')]['id']}})[_0xf497('0x23')](handleEntityNotFound(_0x5c1f97,null))[_0xf497('0x23')](function(_0x376930){if(_0x376930){return _0x376930[_0xf497('0x6c')](_0x205bff['body'][_0xf497('0x6e')],_['omit'](_0x205bff['body'],[_0xf497('0x6e'),'id'])||{})['spread'](function(_0x1cf4b0){for(var _0x47be48=0x0;_0x47be48<_0x205bff[_0xf497('0x4d')][_0xf497('0x6e')][_0xf497('0x37')];_0x47be48+=0x1){socket[_0xf497('0x6f')]('userVoicePrefix:save',{'UserId':_0x205bff[_0xf497('0x4d')]['ids'][_0x47be48],'VoicePrefixId':_0x205bff[_0xf497('0x6d')]['id']});}return _0x1cf4b0;});}})[_0xf497('0x23')](respondWithResult(_0x5c1f97,null))['catch'](handleError(_0x5c1f97,null));};exports['removeAgents']=function(_0x5f50ab,_0x373e2f,_0xb99d2b){return db[_0xf497('0x40')][_0xf497('0x47')]({'where':{'id':_0x5f50ab[_0xf497('0x6d')]['id']}})['then'](handleEntityNotFound(_0x373e2f,null))[_0xf497('0x23')](function(_0x22681a){if(_0x22681a){return _0x22681a[_0xf497('0x70')](_0x5f50ab[_0xf497('0x30')][_0xf497('0x6e')])[_0xf497('0x23')](function(){if(_['isArray'](_0x5f50ab[_0xf497('0x30')]['ids'])){for(var _0x2eddd1=0x0;_0x2eddd1<_0x5f50ab[_0xf497('0x30')][_0xf497('0x6e')][_0xf497('0x37')];_0x2eddd1+=0x1){socket[_0xf497('0x6f')](_0xf497('0x71'),{'UserId':Number(_0x5f50ab['query'][_0xf497('0x6e')][_0x2eddd1]),'VoicePrefixId':Number(_0x5f50ab[_0xf497('0x6d')]['id'])});}}else{socket[_0xf497('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x5f50ab[_0xf497('0x30')][_0xf497('0x6e')]),'VoicePrefixId':Number(_0x5f50ab[_0xf497('0x6d')]['id'])});}});}})[_0xf497('0x23')](respondWithStatusCode(_0x373e2f,null))['catch'](handleError(_0x373e2f,null));};exports['getAgents']=function(_0x4bc81d,_0x48bf26,_0x2f178b){var _0x1d4394={};var _0x19513c={};var _0x4a7db2;var _0x180212;return db[_0xf497('0x40')][_0xf497('0x72')]({'where':{'id':_0x4bc81d['params']['id']}})['then'](handleEntityNotFound(_0x48bf26,null))[_0xf497('0x23')](function(_0x590eb3){if(_0x590eb3){_0x4a7db2=_0x590eb3;_0x19513c['model']=_[_0xf497('0x31')](db[_0xf497('0x73')][_0xf497('0x2b')]);_0x19513c[_0xf497('0x30')]=_[_0xf497('0x31')](_0x4bc81d['query']);_0x19513c[_0xf497('0x32')]=_['intersection'](_0x19513c['model'],_0x19513c[_0xf497('0x30')]);_0x1d4394['attributes']=_['intersection'](_0x19513c['model'],qs[_0xf497('0x36')](_0x4bc81d[_0xf497('0x30')][_0xf497('0x36')]));_0x1d4394['attributes']=_0x1d4394[_0xf497('0x35')][_0xf497('0x37')]?_0x1d4394['attributes']:_0x19513c[_0xf497('0x34')];_0x1d4394[_0xf497('0x3a')]=qs[_0xf497('0x3b')](_0x4bc81d[_0xf497('0x30')][_0xf497('0x3b')]);_0x1d4394[_0xf497('0x3c')]=qs[_0xf497('0x32')](_[_0xf497('0x74')](_0x4bc81d[_0xf497('0x30')],_0x19513c[_0xf497('0x32')]));if(_0x4bc81d[_0xf497('0x30')][_0xf497('0x3d')]){_0x1d4394['where']=_[_0xf497('0x3e')](_0x1d4394[_0xf497('0x3c')],{'$or':_['map'](_0x1d4394[_0xf497('0x35')],function(_0x2c8030){var _0x4b88a5={};_0x4b88a5[_0x2c8030]={'$like':'%'+_0x4bc81d[_0xf497('0x30')][_0xf497('0x3d')]+'%'};return _0x4b88a5;})});}_0x1d4394=_['merge']({},_0x1d4394,_0x4bc81d['options']);return _0x4a7db2[_0xf497('0x75')](_0x1d4394);}})[_0xf497('0x23')](function(_0x3f193d){if(_0x3f193d){_0x180212=_0x3f193d[_0xf497('0x37')];if(!_0x4bc81d[_0xf497('0x30')]['hasOwnProperty'](_0xf497('0x39'))){_0x1d4394[_0xf497('0x1e')]=qs[_0xf497('0x1e')](_0x4bc81d[_0xf497('0x30')]['limit']);_0x1d4394[_0xf497('0x1f')]=qs[_0xf497('0x1f')](_0x4bc81d[_0xf497('0x30')][_0xf497('0x1f')]);}return _0x4a7db2[_0xf497('0x75')](_0x1d4394);}})[_0xf497('0x23')](function(_0x5a8b28){if(_0x5a8b28){return _0x5a8b28?{'count':_0x180212,'rows':_0x5a8b28}:null;}})[_0xf497('0x23')](respondWithResult(_0x48bf26,null))[_0xf497('0x48')](handleError(_0x48bf26,null));}; \ No newline at end of file +var _0xd183=['bulkCreate','Extensions\x20creation\x20failed','Set','callerIdAll','push','goto','charAt','update','body','findById','addAgents','params','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','offset','undefined','limit','count','status','Content-Range','json','reject','then','get','VoicePrefixes','UserProfileResource','destroy','end','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','intersection','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId'];(function(_0x2920dd,_0x19d049){var _0x5d4e52=function(_0x46c751){while(--_0x46c751){_0x2920dd['push'](_0x2920dd['shift']());}};_0x5d4e52(++_0x19d049);}(_0xd183,0x9a));var _0x3d18=function(_0xe74e3c,_0x5d25e5){_0xe74e3c=_0xe74e3c-0x0;var _0x318eec=_0xd183[_0xe74e3c];return _0x318eec;};'use strict';var emlformat=require(_0x3d18('0x0'));var rimraf=require(_0x3d18('0x1'));var zipdir=require(_0x3d18('0x2'));var jsonpatch=require(_0x3d18('0x3'));var rp=require(_0x3d18('0x4'));var moment=require(_0x3d18('0x5'));var BPromise=require(_0x3d18('0x6'));var Mustache=require(_0x3d18('0x7'));var util=require(_0x3d18('0x8'));var path=require('path');var sox=require(_0x3d18('0x9'));var csv=require(_0x3d18('0xa'));var ejs=require(_0x3d18('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3d18('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d18('0xd'));var deskjs=require(_0x3d18('0xe'));var toCsv=require(_0x3d18('0xa'));var querystring=require(_0x3d18('0xf'));var Papa=require(_0x3d18('0x10'));var Redis=require(_0x3d18('0x11'));var authService=require(_0x3d18('0x12'));var qs=require(_0x3d18('0x13'));var as=require(_0x3d18('0x14'));var hardwareService=require(_0x3d18('0x15'));var logger=require(_0x3d18('0x16'))(_0x3d18('0x17'));var utils=require(_0x3d18('0x18'));var config=require(_0x3d18('0x19'));var licenseUtil=require(_0x3d18('0x1a'));var db=require(_0x3d18('0x1b'))['db'];config['redis']=_[_0x3d18('0x1c')](config[_0x3d18('0x1d')],{'host':_0x3d18('0x1e'),'port':0x18eb});var socket=require(_0x3d18('0x1f'))(new Redis(config[_0x3d18('0x1d')]));require(_0x3d18('0x20'))[_0x3d18('0x21')](socket);function respondWithStatusCode(_0x2c7a31,_0x48109d){_0x48109d=_0x48109d||0xcc;return function(_0x11d039){if(_0x11d039){return _0x2c7a31[_0x3d18('0x22')](_0x48109d);}return _0x2c7a31['status'](_0x48109d)['end']();};}function respondWithResult(_0x1fb89f,_0x5696c1){_0x5696c1=_0x5696c1||0xc8;return function(_0x584c55){if(_0x584c55){return _0x1fb89f['status'](_0x5696c1)['json'](_0x584c55);}};}function respondWithFilteredResult(_0xac8012,_0x2468b9){return function(_0x37062f){if(_0x37062f){var _0xd3768=typeof _0x2468b9[_0x3d18('0x23')]===_0x3d18('0x24')&&typeof _0x2468b9[_0x3d18('0x25')]===_0x3d18('0x24');var _0x3c9a2f=_0x37062f[_0x3d18('0x26')];var _0x19aec3=_0xd3768?0x0:_0x2468b9[_0x3d18('0x23')];var _0x3bd3aa=_0xd3768?_0x37062f[_0x3d18('0x26')]:_0x2468b9[_0x3d18('0x23')]+_0x2468b9[_0x3d18('0x25')];var _0x42e0d6;if(_0x3bd3aa>=_0x3c9a2f){_0x3bd3aa=_0x3c9a2f;_0x42e0d6=0xc8;}else{_0x42e0d6=0xce;}_0xac8012[_0x3d18('0x27')](_0x42e0d6);return _0xac8012['set'](_0x3d18('0x28'),_0x19aec3+'-'+_0x3bd3aa+'/'+_0x3c9a2f)[_0x3d18('0x29')](_0x37062f);}return null;};}function patchUpdates(_0x48e20d){return function(_0x320eba){try{jsonpatch['apply'](_0x320eba,_0x48e20d,!![]);}catch(_0x4d0084){return BPromise[_0x3d18('0x2a')](_0x4d0084);}return _0x320eba['save']();};}function saveUpdates(_0x4f4333,_0x5794ac){return function(_0x50f439){if(_0x50f439){return _0x50f439['update'](_0x4f4333)[_0x3d18('0x2b')](function(_0x4773e7){return _0x4773e7;});}return null;};}function removeEntity(_0x5d6c17,_0x444c41){return function(_0x186f01){if(_0x186f01){return _0x186f01['destroy']()[_0x3d18('0x2b')](function(){var _0x3ee604=_0x186f01[_0x3d18('0x2c')]({'plain':!![]});var _0x2d5fd4=_0x3d18('0x2d');return db[_0x3d18('0x2e')][_0x3d18('0x2f')]({'where':{'type':_0x2d5fd4,'resourceId':_0x3ee604['id']}})[_0x3d18('0x2b')](function(){return _0x186f01;});})[_0x3d18('0x2b')](function(){_0x5d6c17[_0x3d18('0x27')](0xcc)[_0x3d18('0x30')]();});}};}function handleEntityNotFound(_0x3b43f5,_0x537a81){return function(_0x4aed9c){if(!_0x4aed9c){_0x3b43f5[_0x3d18('0x22')](0x194);}return _0x4aed9c;};}function handleError(_0x22d208,_0x433390){_0x433390=_0x433390||0x1f4;return function(_0x57657c){logger['error'](_0x57657c[_0x3d18('0x31')]);if(_0x57657c[_0x3d18('0x32')]){delete _0x57657c[_0x3d18('0x32')];}_0x22d208[_0x3d18('0x27')](_0x433390)[_0x3d18('0x33')](_0x57657c);};}exports[_0x3d18('0x34')]=function(_0x2c03ac,_0x116d13){var _0x5da226={},_0x5165c0={},_0x3ff6dc={'count':0x0,'rows':[]};var _0x366b12=_[_0x3d18('0x35')](db[_0x3d18('0x36')][_0x3d18('0x37')],function(_0x277650){return{'name':_0x277650[_0x3d18('0x38')],'type':_0x277650[_0x3d18('0x39')][_0x3d18('0x3a')]};});_0x5165c0[_0x3d18('0x3b')]=_[_0x3d18('0x35')](_0x366b12,_0x3d18('0x32'));_0x5165c0['query']=_[_0x3d18('0x3c')](_0x2c03ac['query']);_0x5165c0[_0x3d18('0x3d')]=_['intersection'](_0x5165c0[_0x3d18('0x3b')],_0x5165c0[_0x3d18('0x3e')]);_0x5da226['attributes']=_['intersection'](_0x5165c0[_0x3d18('0x3b')],qs[_0x3d18('0x3f')](_0x2c03ac[_0x3d18('0x3e')]['fields']));_0x5da226[_0x3d18('0x40')]=_0x5da226[_0x3d18('0x40')][_0x3d18('0x41')]?_0x5da226['attributes']:_0x5165c0['model'];if(!_0x2c03ac[_0x3d18('0x3e')][_0x3d18('0x42')](_0x3d18('0x43'))){_0x5da226['limit']=qs[_0x3d18('0x25')](_0x2c03ac[_0x3d18('0x3e')][_0x3d18('0x25')]);_0x5da226[_0x3d18('0x23')]=qs[_0x3d18('0x23')](_0x2c03ac[_0x3d18('0x3e')][_0x3d18('0x23')]);}_0x5da226['order']=qs['sort'](_0x2c03ac[_0x3d18('0x3e')][_0x3d18('0x44')]);_0x5da226['where']=qs[_0x3d18('0x3d')](_['pick'](_0x2c03ac[_0x3d18('0x3e')],_0x5165c0[_0x3d18('0x3d')]),_0x366b12);if(_0x2c03ac[_0x3d18('0x3e')][_0x3d18('0x45')]){_0x5da226[_0x3d18('0x46')]=_[_0x3d18('0x47')](_0x5da226[_0x3d18('0x46')],{'$or':_[_0x3d18('0x35')](_0x366b12,function(_0x565ecc){if(_0x565ecc[_0x3d18('0x39')]!==_0x3d18('0x48')){var _0x2909fc={};_0x2909fc[_0x565ecc[_0x3d18('0x32')]]={'$like':'%'+_0x2c03ac[_0x3d18('0x3e')][_0x3d18('0x45')]+'%'};return _0x2909fc;}})});}_0x5da226=_[_0x3d18('0x47')]({},_0x5da226,_0x2c03ac[_0x3d18('0x49')]);var _0x23a73b={'where':_0x5da226[_0x3d18('0x46')]};return db['VoicePrefix']['count'](_0x23a73b)[_0x3d18('0x2b')](function(_0x2d2520){_0x3ff6dc[_0x3d18('0x26')]=_0x2d2520;if(_0x2c03ac[_0x3d18('0x3e')]['includeAll']){_0x5da226[_0x3d18('0x4a')]=[{'all':!![]}];}return db['VoicePrefix'][_0x3d18('0x4b')](_0x5da226);})[_0x3d18('0x2b')](function(_0x5e190f){_0x3ff6dc['rows']=_0x5e190f;return _0x3ff6dc;})[_0x3d18('0x2b')](respondWithFilteredResult(_0x116d13,_0x5da226))[_0x3d18('0x4c')](handleError(_0x116d13,null));};exports[_0x3d18('0x4d')]=function(_0x2ab93e,_0x522f25){var _0x52067b={'raw':![],'where':{'id':_0x2ab93e['params']['id']}},_0x2eab2e={};_0x2eab2e[_0x3d18('0x3b')]=_[_0x3d18('0x3c')](db['VoicePrefix'][_0x3d18('0x37')]);_0x2eab2e[_0x3d18('0x3e')]=_[_0x3d18('0x3c')](_0x2ab93e[_0x3d18('0x3e')]);_0x2eab2e[_0x3d18('0x3d')]=_[_0x3d18('0x4e')](_0x2eab2e[_0x3d18('0x3b')],_0x2eab2e[_0x3d18('0x3e')]);_0x52067b[_0x3d18('0x40')]=_['intersection'](_0x2eab2e[_0x3d18('0x3b')],qs[_0x3d18('0x3f')](_0x2ab93e[_0x3d18('0x3e')][_0x3d18('0x3f')]));_0x52067b[_0x3d18('0x40')]=_0x52067b['attributes'][_0x3d18('0x41')]?_0x52067b['attributes']:_0x2eab2e['model'];if(_0x2ab93e['query']['includeAll']){_0x52067b['include']=[{'all':!![]}];}_0x52067b=_[_0x3d18('0x47')]({},_0x52067b,_0x2ab93e['options']);return db[_0x3d18('0x36')]['find'](_0x52067b)[_0x3d18('0x2b')](handleEntityNotFound(_0x522f25,null))[_0x3d18('0x2b')](respondWithResult(_0x522f25,null))[_0x3d18('0x4c')](handleError(_0x522f25,null));};exports['destroy']=function(_0x4a9f5a,_0x2ff65f){return db[_0x3d18('0x36')][_0x3d18('0x4f')]({'where':{'id':_0x4a9f5a['params']['id']}})['then'](handleEntityNotFound(_0x2ff65f,null))['then'](removeEntity(_0x2ff65f,null))[_0x3d18('0x4c')](handleError(_0x2ff65f,null));};exports[_0x3d18('0x50')]=function(_0x2e21f7,_0x89ea41){return db['VoicePrefix'][_0x3d18('0x50')]()[_0x3d18('0x2b')](respondWithResult(_0x89ea41,null))['catch'](handleError(_0x89ea41,null));};exports[_0x3d18('0x51')]=function(_0xb287ea,_0x1dcc4c){var _0x4b1c29;return db[_0x3d18('0x52')][_0x3d18('0x53')](function(_0x5cba3a){return db[_0x3d18('0x36')][_0x3d18('0x51')](_0xb287ea['body'],{'transaction':_0x5cba3a})['then'](function(_0xe76891){_0x4b1c29=_0xe76891[_0x3d18('0x2c')]({'plain':!![]});return db[_0x3d18('0x54')][_0x3d18('0x4f')]({'where':{'id':_0x4b1c29[_0x3d18('0x55')]},'raw':!![]})[_0x3d18('0x2b')](function(_0x1f32b7){return createVoicePrefixExtensions(_0x4b1c29,_0x1f32b7,_0x5cba3a);});});})['then'](function(){var _0x3f5fe2=_0xb287ea[_0x3d18('0x56')]['get']({'plain':!![]});if(!_0x3f5fe2)throw new Error(_0x3d18('0x57'));if(_0x3f5fe2[_0x3d18('0x58')]===_0x3d18('0x56')){var _0x6c39b7=_0x4b1c29;return db[_0x3d18('0x59')][_0x3d18('0x4f')]({'where':{'name':_0x3d18('0x2d'),'userProfileId':_0x3f5fe2[_0x3d18('0x5a')]},'raw':!![]})[_0x3d18('0x2b')](function(_0x32dfba){if(_0x32dfba&&_0x32dfba[_0x3d18('0x5b')]===0x0){return db[_0x3d18('0x2e')]['create']({'name':_0x6c39b7['name'],'resourceId':_0x6c39b7['id'],'type':_0x32dfba[_0x3d18('0x32')],'sectionId':_0x32dfba['id']},{})[_0x3d18('0x2b')](function(){return _0x4b1c29;});}else{return _0x4b1c29;}})[_0x3d18('0x4c')](function(_0x10dadc){logger[_0x3d18('0x5c')](_0x3d18('0x5d'),_0x10dadc);throw _0x10dadc;});}return _0x4b1c29;})['then'](respondWithResult(_0x1dcc4c,null))[_0x3d18('0x4c')](handleError(_0x1dcc4c,null));};function Extension(_0xe455cf,_0x1e55aa,_0x49b623,_0x192eb4){this[_0x3d18('0x5e')]=_0x3d18('0x5f');this[_0x3d18('0x60')]=_0xe455cf;this[_0x3d18('0x61')]=_0x49b623;this[_0x3d18('0x39')]=_0x3d18('0x62');this[_0x3d18('0x63')]='Voice\x20Prefix\x20Extension';this[_0x3d18('0x64')]=_0x1e55aa;this[_0x3d18('0x65')]=_0x192eb4;}function createVoicePrefixExtensions(_0x147808,_0x2d01bc,_0x2fbc11){return new BPromise(function(_0x185b73,_0x416f68){var _0x4ef340=new Extension(formatPrefixName(_0x147808[_0x3d18('0x66')]),0x1,_0x3d18('0x67'),_0x3d18('0x68'));_0x4ef340[_0x3d18('0x69')]=_0x147808['id'];return db[_0x3d18('0x54')][_0x3d18('0x51')](_0x4ef340,{'transaction':_0x2fbc11})[_0x3d18('0x2b')](function(_0x584da0){var _0xf3a594=_0x584da0[_0x3d18('0x2c')]({'plain':!![]});var _0x16a028=_[_0x3d18('0x35')](addVoicePrefixExtensions(_0x147808,_0x2d01bc),function(_0x3ead6b){_0x3ead6b[_0x3d18('0x55')]=_0xf3a594['id'];_0x3ead6b[_0x3d18('0x69')]=_0x147808['id'];return _0x3ead6b;});return db[_0x3d18('0x54')][_0x3d18('0x6a')](_0x16a028,{'transaction':_0x2fbc11})[_0x3d18('0x2b')](function(_0x121934){if(!_0x121934){return _0x416f68(_0x3d18('0x6b'));}else{return _0x185b73(_0x121934);}})[_0x3d18('0x4c')](function(_0x204b61){return _0x416f68(_0x204b61);});});;});};function addVoicePrefixExtensions(_0x56dfb0,_0x545305){var _0x9524b7=[];var _0x29f2d9=formatPrefixName(_0x56dfb0[_0x3d18('0x66')]);_0x9524b7['push'](new Extension(_0x29f2d9,0x2,_0x3d18('0x6c'),'CDR(prefix)='+_0x56dfb0[_0x3d18('0x32')]));if(_0x56dfb0[_0x3d18('0x6d')]){_0x9524b7[_0x3d18('0x6e')](new Extension(_0x29f2d9,0x3,'Set','PREFIX-CALLERIDALL='+_0x56dfb0[_0x3d18('0x6d')]));}else{_0x9524b7[_0x3d18('0x6e')](new Extension(_0x29f2d9,0x3,_0x3d18('0x67'),'No\x20callerid\x20available'));}_0x9524b7[_0x3d18('0x6e')](new Extension(_0x29f2d9,0x4,_0x3d18('0x6f'),_0x545305[_0x3d18('0x5e')]+','+'${EXTEN:'+(0x8+_0x56dfb0['name']['length'])+'}'+','+0x1));return _0x9524b7;}function formatPrefixName(_0x3419cd){var _0x3a674b='_';for(var _0x73cb=0x0;_0x73cb<_0x3419cd['length'];_0x73cb++){if(_0x3419cd[_0x3d18('0x70')](_0x73cb)=='-'){_0x3a674b+=_0x3419cd[_0x3d18('0x70')](_0x73cb);}else{_0x3a674b+='['+_0x3419cd['charAt'](_0x73cb)+']';}}_0x3a674b+='.';return _0x3a674b;}exports[_0x3d18('0x71')]=function(_0x5bbfd9,_0x6a7995,_0x244c11){var _0x7283f5=_0x5bbfd9[_0x3d18('0x72')];_0x7283f5['prefix']='system-'+_0x7283f5[_0x3d18('0x32')]+'-';return db[_0x3d18('0x52')][_0x3d18('0x53')](function(_0xffa95){return db[_0x3d18('0x36')][_0x3d18('0x71')](_0x7283f5,{'where':{'id':_0x7283f5['id']},'transaction':_0xffa95})['then'](function(){return db[_0x3d18('0x54')]['destroy']({'where':{'VoicePrefixId':_0x7283f5['id']},'transaction':_0xffa95})[_0x3d18('0x2b')](function(){return db[_0x3d18('0x54')]['find']({'where':{'id':_0x7283f5['VoiceExtensionId']},'raw':!![]})[_0x3d18('0x2b')](function(_0x47d47a){return createVoicePrefixExtensions(_0x7283f5,_0x47d47a,_0xffa95);});});});})[_0x3d18('0x2b')](function(){return db[_0x3d18('0x36')][_0x3d18('0x73')](_0x7283f5['id']);})[_0x3d18('0x2b')](respondWithResult(_0x6a7995,null))['catch'](handleError(_0x6a7995,null));};exports[_0x3d18('0x74')]=function(_0x2fab0f,_0x1073c2,_0x3557e0){return db['VoicePrefix'][_0x3d18('0x4f')]({'where':{'id':_0x2fab0f[_0x3d18('0x75')]['id']}})[_0x3d18('0x2b')](handleEntityNotFound(_0x1073c2,null))[_0x3d18('0x2b')](function(_0x2cc135){if(_0x2cc135){return _0x2cc135[_0x3d18('0x74')](_0x2fab0f[_0x3d18('0x72')][_0x3d18('0x76')],_[_0x3d18('0x77')](_0x2fab0f[_0x3d18('0x72')],[_0x3d18('0x76'),'id'])||{})[_0x3d18('0x78')](function(_0x2a35b8){for(var _0x4ac405=0x0;_0x4ac405<_0x2fab0f[_0x3d18('0x72')]['ids'][_0x3d18('0x41')];_0x4ac405+=0x1){socket[_0x3d18('0x79')](_0x3d18('0x7a'),{'UserId':_0x2fab0f[_0x3d18('0x72')]['ids'][_0x4ac405],'VoicePrefixId':_0x2fab0f[_0x3d18('0x75')]['id']});}return _0x2a35b8;});}})[_0x3d18('0x2b')](respondWithResult(_0x1073c2,null))[_0x3d18('0x4c')](handleError(_0x1073c2,null));};exports[_0x3d18('0x7b')]=function(_0x1db220,_0x1055e1,_0x624a9b){return db['VoicePrefix'][_0x3d18('0x4f')]({'where':{'id':_0x1db220[_0x3d18('0x75')]['id']}})[_0x3d18('0x2b')](handleEntityNotFound(_0x1055e1,null))[_0x3d18('0x2b')](function(_0x2df5e5){if(_0x2df5e5){return _0x2df5e5[_0x3d18('0x7b')](_0x1db220['query'][_0x3d18('0x76')])[_0x3d18('0x2b')](function(){if(_[_0x3d18('0x7c')](_0x1db220[_0x3d18('0x3e')][_0x3d18('0x76')])){for(var _0x5ab7b7=0x0;_0x5ab7b7<_0x1db220[_0x3d18('0x3e')][_0x3d18('0x76')]['length'];_0x5ab7b7+=0x1){socket[_0x3d18('0x79')](_0x3d18('0x7d'),{'UserId':Number(_0x1db220[_0x3d18('0x3e')][_0x3d18('0x76')][_0x5ab7b7]),'VoicePrefixId':Number(_0x1db220[_0x3d18('0x75')]['id'])});}}else{socket[_0x3d18('0x79')](_0x3d18('0x7d'),{'UserId':Number(_0x1db220[_0x3d18('0x3e')][_0x3d18('0x76')]),'VoicePrefixId':Number(_0x1db220['params']['id'])});}});}})[_0x3d18('0x2b')](respondWithStatusCode(_0x1055e1,null))['catch'](handleError(_0x1055e1,null));};exports['getAgents']=function(_0x3a90c3,_0x599bb9,_0x351474){var _0x4513a5={};var _0x4a1f77={};var _0x3d04ad;var _0x5efbb8;return db[_0x3d18('0x36')][_0x3d18('0x7e')]({'where':{'id':_0x3a90c3[_0x3d18('0x75')]['id']}})[_0x3d18('0x2b')](handleEntityNotFound(_0x599bb9,null))[_0x3d18('0x2b')](function(_0x340196){if(_0x340196){_0x3d04ad=_0x340196;_0x4a1f77[_0x3d18('0x3b')]=_[_0x3d18('0x3c')](db[_0x3d18('0x7f')][_0x3d18('0x37')]);_0x4a1f77[_0x3d18('0x3e')]=_[_0x3d18('0x3c')](_0x3a90c3[_0x3d18('0x3e')]);_0x4a1f77['filters']=_[_0x3d18('0x4e')](_0x4a1f77[_0x3d18('0x3b')],_0x4a1f77[_0x3d18('0x3e')]);_0x4513a5[_0x3d18('0x40')]=_[_0x3d18('0x4e')](_0x4a1f77[_0x3d18('0x3b')],qs[_0x3d18('0x3f')](_0x3a90c3[_0x3d18('0x3e')][_0x3d18('0x3f')]));_0x4513a5[_0x3d18('0x40')]=_0x4513a5[_0x3d18('0x40')][_0x3d18('0x41')]?_0x4513a5[_0x3d18('0x40')]:_0x4a1f77[_0x3d18('0x3b')];_0x4513a5['order']=qs[_0x3d18('0x44')](_0x3a90c3[_0x3d18('0x3e')][_0x3d18('0x44')]);_0x4513a5[_0x3d18('0x46')]=qs['filters'](_[_0x3d18('0x80')](_0x3a90c3[_0x3d18('0x3e')],_0x4a1f77[_0x3d18('0x3d')]));if(_0x3a90c3['query']['filter']){_0x4513a5[_0x3d18('0x46')]=_[_0x3d18('0x47')](_0x4513a5[_0x3d18('0x46')],{'$or':_[_0x3d18('0x35')](_0x4513a5[_0x3d18('0x40')],function(_0x9f5141){var _0x485bf2={};_0x485bf2[_0x9f5141]={'$like':'%'+_0x3a90c3['query']['filter']+'%'};return _0x485bf2;})});}_0x4513a5=_['merge']({},_0x4513a5,_0x3a90c3[_0x3d18('0x49')]);return _0x3d04ad[_0x3d18('0x81')](_0x4513a5);}})[_0x3d18('0x2b')](function(_0x52ca21){if(_0x52ca21){_0x5efbb8=_0x52ca21['length'];if(!_0x3a90c3[_0x3d18('0x3e')][_0x3d18('0x42')]('nolimit')){_0x4513a5[_0x3d18('0x25')]=qs[_0x3d18('0x25')](_0x3a90c3[_0x3d18('0x3e')][_0x3d18('0x25')]);_0x4513a5[_0x3d18('0x23')]=qs[_0x3d18('0x23')](_0x3a90c3[_0x3d18('0x3e')][_0x3d18('0x23')]);}return _0x3d04ad['getAgents'](_0x4513a5);}})['then'](function(_0x160aba){if(_0x160aba){return _0x160aba?{'count':_0x5efbb8,'rows':_0x160aba}:null;}})[_0x3d18('0x2b')](respondWithResult(_0x599bb9,null))[_0x3d18('0x4c')](handleError(_0x599bb9,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f34b0d5..cd8df09 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 _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x1d33eb,_0x29751c){_0x1d33eb=_0x1d33eb-0x0;var _0x106b4a=_0x3e74[_0x1d33eb];return _0x106b4a;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x5788d3,_0x4d3f7d){var _0x314003=function(_0x1c496c){while(--_0x1c496c){_0x5788d3['push'](_0x5788d3['shift']());}};_0x314003(++_0x4d3f7d);}(_0x70e0,0x17b));var _0x070e=function(_0x1ed195,_0x2b8356){_0x1ed195=_0x1ed195-0x0;var _0x2b8d92=_0x70e0[_0x1ed195];return _0x2b8d92;};'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 94a1111..7458178 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 _0x620f=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voicePrefix.attributes','exports'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0x620f,0x114));var _0xf620=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x620f[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xf620('0x0'));var util=require(_0xf620('0x1'));var logger=require(_0xf620('0x2'))(_0xf620('0x3'));var moment=require(_0xf620('0x4'));var BPromise=require(_0xf620('0x5'));var rp=require(_0xf620('0x6'));var fs=require('fs');var path=require(_0xf620('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf620('0x8'));module[_0xf620('0x9')]=function(_0x1f9025,_0x2fad4b){return _0x1f9025[_0xf620('0xa')](_0xf620('0xb'),attributes,{'tableName':_0xf620('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd583=['bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes','util','../../config/logger','api','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd583,0xb0));var _0x3d58=function(_0x1d6121,_0x557ec9){_0x1d6121=_0x1d6121-0x0;var _0x23f10e=_0xd583[_0x1d6121];return _0x23f10e;};'use strict';var _=require('lodash');var util=require(_0x3d58('0x0'));var logger=require(_0x3d58('0x1'))(_0x3d58('0x2'));var moment=require(_0x3d58('0x3'));var BPromise=require(_0x3d58('0x4'));var rp=require(_0x3d58('0x5'));var fs=require('fs');var path=require(_0x3d58('0x6'));var rimraf=require(_0x3d58('0x7'));var config=require(_0x3d58('0x8'));var attributes=require(_0x3d58('0x9'));module['exports']=function(_0x2935d8,_0x5c034e){return _0x2935d8[_0x3d58('0xa')]('VoicePrefix',attributes,{'tableName':_0x3d58('0xb'),'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 837314a..3ee5c65 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 _0x94cc=['redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x255984,_0x46e231){var _0x3b8658=function(_0x18ca57){while(--_0x18ca57){_0x255984['push'](_0x255984['shift']());}};_0x3b8658(++_0x46e231);}(_0x94cc,0xf0));var _0xc94c=function(_0x2596f3,_0x3b4daf){_0x2596f3=_0x2596f3-0x0;var _0x563da6=_0x94cc[_0x2596f3];return _0x563da6;};'use strict';var _=require(_0xc94c('0x0'));var util=require(_0xc94c('0x1'));var moment=require(_0xc94c('0x2'));var BPromise=require(_0xc94c('0x3'));var rs=require(_0xc94c('0x4'));var fs=require('fs');var Redis=require(_0xc94c('0x5'));var db=require(_0xc94c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc94c('0x7'))(_0xc94c('0x8'));var config=require(_0xc94c('0x9'));var jayson=require(_0xc94c('0xa'));var client=jayson['client'][_0xc94c('0xb')]({'port':0x232a});config[_0xc94c('0xc')]=_['defaults'](config[_0xc94c('0xc')],{'host':_0xc94c('0xd'),'port':0x18eb});var socket=require(_0xc94c('0xe'))(new Redis(config[_0xc94c('0xc')]));require(_0xc94c('0xf'))[_0xc94c('0x10')](socket);function respondWithRpcPromise(_0x5d82d7,_0x10491d,_0x48f968){return new BPromise(function(_0x2c33f0,_0x5a0e56){return client[_0xc94c('0x11')](_0x5d82d7,_0x48f968)['then'](function(_0x535078){logger[_0xc94c('0x12')](_0xc94c('0x13'),_0x10491d,_0xc94c('0x14'));logger[_0xc94c('0x15')](_0xc94c('0x16'),_0x10491d,_0xc94c('0x14'),JSON['stringify'](_0x535078));if(_0x535078['error']){if(_0x535078['error'][_0xc94c('0x17')]===0x1f4){logger[_0xc94c('0x18')](_0xc94c('0x13'),_0x10491d,_0x535078['error'][_0xc94c('0x19')]);return _0x5a0e56(_0x535078['error'][_0xc94c('0x19')]);}logger[_0xc94c('0x18')](_0xc94c('0x13'),_0x10491d,_0x535078[_0xc94c('0x18')]['message']);return _0x2c33f0(_0x535078[_0xc94c('0x18')]['message']);}else{logger[_0xc94c('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x10491d,_0xc94c('0x14'));_0x2c33f0(_0x535078[_0xc94c('0x1a')]['message']);}})[_0xc94c('0x1b')](function(_0x72beaf){logger[_0xc94c('0x18')](_0xc94c('0x13'),_0x10491d,_0x72beaf);_0x5a0e56(_0x72beaf);});});} \ No newline at end of file +var _0x14f1=['code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x522551,_0x16dd6e){var _0x110c42=function(_0x15b116){while(--_0x15b116){_0x522551['push'](_0x522551['shift']());}};_0x110c42(++_0x16dd6e);}(_0x14f1,0x90));var _0x114f=function(_0x4d4fb5,_0x342977){_0x4d4fb5=_0x4d4fb5-0x0;var _0x745c52=_0x14f1[_0x4d4fb5];return _0x745c52;};'use strict';var _=require(_0x114f('0x0'));var util=require('util');var moment=require(_0x114f('0x1'));var BPromise=require(_0x114f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x114f('0x3'));var db=require(_0x114f('0x4'))['db'];var utils=require(_0x114f('0x5'));var logger=require(_0x114f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x114f('0x7'));var client=jayson[_0x114f('0x8')][_0x114f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x114f('0xa')],{'host':_0x114f('0xb'),'port':0x18eb});var socket=require(_0x114f('0xc'))(new Redis(config[_0x114f('0xa')]));require(_0x114f('0xd'))[_0x114f('0xe')](socket);function respondWithRpcPromise(_0x2da5ab,_0x15ed92,_0x1180aa){return new BPromise(function(_0x2acdb9,_0x4f6346){return client[_0x114f('0xf')](_0x2da5ab,_0x1180aa)[_0x114f('0x10')](function(_0x1bd874){logger[_0x114f('0x11')](_0x114f('0x12'),_0x15ed92,_0x114f('0x13'));logger[_0x114f('0x14')](_0x114f('0x15'),_0x15ed92,_0x114f('0x13'),JSON[_0x114f('0x16')](_0x1bd874));if(_0x1bd874['error']){if(_0x1bd874[_0x114f('0x17')][_0x114f('0x18')]===0x1f4){logger[_0x114f('0x17')](_0x114f('0x12'),_0x15ed92,_0x1bd874[_0x114f('0x17')]['message']);return _0x4f6346(_0x1bd874[_0x114f('0x17')][_0x114f('0x19')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x15ed92,_0x1bd874[_0x114f('0x17')][_0x114f('0x19')]);return _0x2acdb9(_0x1bd874['error'][_0x114f('0x19')]);}else{logger[_0x114f('0x11')](_0x114f('0x12'),_0x15ed92,_0x114f('0x13'));_0x2acdb9(_0x1bd874[_0x114f('0x1a')][_0x114f('0x19')]);}})[_0x114f('0x1b')](function(_0xe93177){logger[_0x114f('0x17')](_0x114f('0x12'),_0x15ed92,_0xe93177);_0x4f6346(_0xe93177);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index bfa0a43..8f0293d 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 _0x7f5d=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x4a3b2e,_0x4e94a1){var _0x519301=function(_0x130c5f){while(--_0x130c5f){_0x4a3b2e['push'](_0x4a3b2e['shift']());}};_0x519301(++_0x4e94a1);}(_0x7f5d,0xb2));var _0xd7f5=function(_0x39734b,_0x56a475){_0x39734b=_0x39734b-0x0;var _0x504aec=_0x7f5d[_0x39734b];return _0x504aec;};'use strict';var VoicePrefixEvents=require(_0xd7f5('0x0'));var events=[_0xd7f5('0x1'),_0xd7f5('0x2'),_0xd7f5('0x3')];function createListener(_0x1354ff,_0x2cd92e){return function(_0x6a00d2){_0x2cd92e[_0xd7f5('0x4')](_0x1354ff,_0x6a00d2);};}function removeListener(_0x359efa,_0x4daae9){return function(){VoicePrefixEvents['removeListener'](_0x359efa,_0x4daae9);};}exports[_0xd7f5('0x5')]=function(_0x95fe7c){for(var _0x648a65=0x0,_0x162ab8=events[_0xd7f5('0x6')];_0x648a65<_0x162ab8;_0x648a65++){var _0x2f44a0=events[_0x648a65];var _0x531653=createListener(_0xd7f5('0x7')+_0x2f44a0,_0x95fe7c);VoicePrefixEvents['on'](_0x2f44a0,_0x531653);}}; \ No newline at end of file +var _0x2df4=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2df4,0x81));var _0x42df=function(_0x47ee23,_0x58aad2){_0x47ee23=_0x47ee23-0x0;var _0x5b4718=_0x2df4[_0x47ee23];return _0x5b4718;};'use strict';var VoicePrefixEvents=require(_0x42df('0x0'));var events=[_0x42df('0x1'),_0x42df('0x2'),_0x42df('0x3')];function createListener(_0x1c7407,_0x44342e){return function(_0x2bfe39){_0x44342e[_0x42df('0x4')](_0x1c7407,_0x2bfe39);};}function removeListener(_0x39d8be,_0x597afb){return function(){VoicePrefixEvents[_0x42df('0x5')](_0x39d8be,_0x597afb);};}exports[_0x42df('0x6')]=function(_0x137f4f){for(var _0x3eb512=0x0,_0x428db3=events['length'];_0x3eb512<_0x428db3;_0x3eb512++){var _0x32a338=events[_0x3eb512];var _0x3c25b1=createListener(_0x42df('0x7')+_0x32a338,_0x137f4f);VoicePrefixEvents['on'](_0x32a338,_0x3c25b1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b921b3e..0c431a7 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 _0x2032=['getLists','getBlackLists','create','/:id/clone','clone','post','/:id/teams','addTeams','addLists','update','delete','destroy','removeTeams','removeAgents','removeLists','/:id/blacklists','removeBlackLists','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getAgents','/:id/members','getMembers','/:id/lists'];(function(_0x157cca,_0x41a01c){var _0x3a3fe8=function(_0x35ff85){while(--_0x35ff85){_0x157cca['push'](_0x157cca['shift']());}};_0x3a3fe8(++_0x41a01c);}(_0x2032,0xd9));var _0x2203=function(_0xb18133,_0x4fb499){_0xb18133=_0xb18133-0x0;var _0x148558=_0x2032[_0xb18133];return _0x148558;};'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 fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['get'](_0x2203('0x12'),auth[_0x2203('0x9')](),controller['getHopperBlacks']);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x2203('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x2203('0x13')]);router[_0x2203('0x8')](_0x2203('0x14'),auth[_0x2203('0x9')](),controller[_0x2203('0x15')]);router[_0x2203('0x8')](_0x2203('0x16'),auth[_0x2203('0x9')](),controller[_0x2203('0x17')]);router[_0x2203('0x8')]('/:id/blacklists',auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x19')]);router['post'](_0x2203('0x1a'),auth['isAuthenticated'](),controller[_0x2203('0x1b')]);router[_0x2203('0x1c')](_0x2203('0x1d'),auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);router[_0x2203('0x1c')]('/:id/users',auth[_0x2203('0x9')](),controller['addAgents']);router['post'](_0x2203('0x16'),auth['isAuthenticated'](),controller[_0x2203('0x1f')]);router[_0x2203('0x1c')]('/:id/blacklists',auth[_0x2203('0x9')](),controller['addBlackLists']);router['put'](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x20')]);router[_0x2203('0x21')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x22')]);router[_0x2203('0x21')]('/:id/teams',auth[_0x2203('0x9')](),controller[_0x2203('0x23')]);router[_0x2203('0x21')]('/:id/users',auth[_0x2203('0x9')](),controller[_0x2203('0x24')]);router['delete'](_0x2203('0x16'),auth[_0x2203('0x9')](),controller[_0x2203('0x25')]);router[_0x2203('0x21')](_0x2203('0x26'),auth[_0x2203('0x9')](),controller[_0x2203('0x27')]);module['exports']=router; \ No newline at end of file +var _0x896e=['update','delete','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','/:id/lists','addLists','put'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x896e,0x1e9));var _0xe896=function(_0x2ff26e,_0x454a47){_0x2ff26e=_0x2ff26e-0x0;var _0x2080da=_0x896e[_0x2ff26e];return _0x2080da;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['get'](_0xe896('0x12'),auth['isAuthenticated'](),controller[_0xe896('0x13')]);router['get'](_0xe896('0x14'),auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);router['get'](_0xe896('0x16'),auth[_0xe896('0xe')](),controller[_0xe896('0x17')]);router['get'](_0xe896('0x18'),auth[_0xe896('0xe')](),controller[_0xe896('0x19')]);router['get'](_0xe896('0x1a'),auth[_0xe896('0xe')](),controller[_0xe896('0x1b')]);router['get']('/:id/members',auth[_0xe896('0xe')](),controller[_0xe896('0x1c')]);router['get']('/:id/lists',auth[_0xe896('0xe')](),controller[_0xe896('0x1d')]);router['get'](_0xe896('0x1e'),auth['isAuthenticated'](),controller[_0xe896('0x1f')]);router[_0xe896('0x20')]('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x20')](_0xe896('0x21'),auth[_0xe896('0xe')](),controller[_0xe896('0x22')]);router[_0xe896('0x20')](_0xe896('0x18'),auth[_0xe896('0xe')](),controller[_0xe896('0x23')]);router['post'](_0xe896('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0xe896('0x20')](_0xe896('0x24'),auth[_0xe896('0xe')](),controller[_0xe896('0x25')]);router['post'](_0xe896('0x1e'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xe896('0x26')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0x27')]);router[_0xe896('0x28')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller['destroy']);router[_0xe896('0x28')](_0xe896('0x18'),auth[_0xe896('0xe')](),controller['removeTeams']);router[_0xe896('0x28')](_0xe896('0x1a'),auth[_0xe896('0xe')](),controller[_0xe896('0x29')]);router[_0xe896('0x28')](_0xe896('0x24'),auth['isAuthenticated'](),controller[_0xe896('0x2a')]);router[_0xe896('0x28')](_0xe896('0x1e'),auth[_0xe896('0xe')](),controller[_0xe896('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d144ed9..ca63578 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 _0xb00d=['#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Minutes\x20to\x20wait\x20to\x20call\x20next\x20additional\x20phone\x20number\x20','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','linear','wrandom','rrordered','strategy','rrmemory','getDataValue','booked','roundrobin','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xb00d,0x19e));var _0xdb00=function(_0x4e7abc,_0x2aeca1){_0x4e7abc=_0x4e7abc-0x0;var _0x428796=_0xb00d[_0x4e7abc];return _0x428796;};'use strict';var Sequelize=require(_0xdb00('0x0'));module[_0xdb00('0x1')]={'name':{'type':Sequelize[_0xdb00('0x2')],'allowNull':![],'unique':_0xdb00('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdb00('0x4')](_0xdb00('0x5'),'outbound'),'allowNull':![],'defaultValue':_0xdb00('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xdb00('0x6')},'announce':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xdb00('0x7'),_0xdb00('0x8'),_0xdb00('0x9'),'random','rrmemory',_0xdb00('0xa'),_0xdb00('0xb'),_0xdb00('0xc')),'allowNull':![],'defaultValue':_0xdb00('0x7'),'set':function(_0x21e0e4){this['setDataValue'](_0xdb00('0xd'),_0x21e0e4?_0x21e0e4:_0xdb00('0xe'));},'get':function(){var _0x33c2fb=this[_0xdb00('0xf')]('type');var _0x1fe565=this[_0xdb00('0xf')]('dialMethod');var _0x2669fa=this['getDataValue'](_0xdb00('0xd'));if(_0x33c2fb===_0xdb00('0x5')){return _0x2669fa;}if(_0x1fe565===_0xdb00('0x10')&&_0x2669fa==='rrmemory'||_0x1fe565===_0xdb00('0x10')&&_0x2669fa===_0xdb00('0x11')){return _0x2669fa;}if(_0x1fe565==='progressive'||_0x1fe565===_0xdb00('0x12')||_0x1fe565===_0xdb00('0x13')){return _0x2669fa;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xdb00('0x14')](0xb)},'timeout':{'type':Sequelize[_0xdb00('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xdb00('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xdb00('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xdb00('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xdb00('0x4')](_0xdb00('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xdb00('0x4')]('yes','no',_0xdb00('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xdb00('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xdb00('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xdb00('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdb00('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdb00('0x4')](_0xdb00('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xdb00('0x4')](_0xdb00('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdb00('0x4')](_0xdb00('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdb00('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xdb00('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xdb00('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdb00('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xdb00('0x15'),'no'),'defaultValue':_0xdb00('0x15')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xdb00('0x15'),'no',_0xdb00('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xdb00('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xdb00('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdb00('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xdb00('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdb00('0x2')]},'queue_quantity1':{'type':Sequelize[_0xdb00('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xdb00('0x2')]},'queue_less_than':{'type':Sequelize[_0xdb00('0x2')]},'periodic_announce':{'type':Sequelize[_0xdb00('0x18')],'set':function(_0x3d7dde){this[_0xdb00('0x19')](_0xdb00('0x1a'),_0x3d7dde?_0x3d7dde[_0xdb00('0x1b')](','):[]);},'get':function(){return this[_0xdb00('0xf')](_0xdb00('0x1a'))?this[_0xdb00('0xf')](_0xdb00('0x1a'))[_0xdb00('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':_0xdb00('0x15'),'set':function(_0x43aedc){this['setDataValue'](_0xdb00('0x1d'),_0x43aedc?_0x43aedc[_0xdb00('0x1b')](','):undefined);},'get':function(){return this[_0xdb00('0xf')]('joinempty')?this[_0xdb00('0xf')]('joinempty')[_0xdb00('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1cfafb){this[_0xdb00('0x19')](_0xdb00('0x1e'),_0x1cfafb?_0x1cfafb[_0xdb00('0x1b')](','):undefined);},'get':function(){return this[_0xdb00('0xf')]('leavewhenempty')?this[_0xdb00('0xf')](_0xdb00('0x1e'))[_0xdb00('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xdb00('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xdb00('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xdb00('0x4')](_0xdb00('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xdb00('0x2')]},'description':{'type':Sequelize[_0xdb00('0x2')]},'acw':{'type':Sequelize[_0xdb00('0x1f')],'defaultValue':0x0,'set':function(_0x5e78e4){this['setDataValue'](_0xdb00('0x20'),_0x5e78e4);if(_0x5e78e4){if(this['getDataValue']('wrapuptime')<0x2){this['setDataValue'](_0xdb00('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdb00('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xdb00('0x4')](_0xdb00('0x22'),'progressive',_0xdb00('0x13'),_0xdb00('0x12'),'booked'),'defaultValue':_0xdb00('0x23'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xdb00('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdb00('0x25')},'dialPowerLevel':{'type':Sequelize[_0xdb00('0x26')](0x2)[_0xdb00('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xdb00('0x27'),'dropRate'),'defaultValue':_0xdb00('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdb00('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xdb00('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xdb00('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdb00('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdb00('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb00('0x2b')},'dialQueueOptions':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':_0xdb00('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xdb00('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb00('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdb00('0x14')](0x5)[_0xdb00('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb00('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdb00('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdb00('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xdb00('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdb00('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xdb00('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xdb00('0x30')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xdb00('0x4')](_0xdb00('0x31'),_0xdb00('0x32'),_0xdb00('0x33')),'defaultValue':_0xdb00('0x31')},'dialAMDActive':{'type':Sequelize[_0xdb00('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xdb00('0x14')](0x9)[_0xdb00('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdb00('0x34')},'dialAMDGreeting':{'type':Sequelize[_0xdb00('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdb00('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdb00('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdb00('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdb00('0x14')](0x9)[_0xdb00('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdb00('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0xdb00('0x14')](0x9)[_0xdb00('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdb00('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdb00('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdb00('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdb00('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdb00('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdb00('0x14')](0x5)[_0xdb00('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdb00('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdb00('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdb00('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0xdb00('0x14')](0x5)[_0xdb00('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xdb00('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xdb00('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xdb00('0x3e'),_0xdb00('0x3f')),'defaultValue':_0xdb00('0x3e')},'dialQueueProject2':{'type':Sequelize[_0xdb00('0x2')],'comment':_0xdb00('0x40')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdb00('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdb00('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdb00('0x41')},'dialCutDigit':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb00('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdb00('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb00('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb00('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0xdb00('0x14')](0x5)[_0xdb00('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb00('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdb00('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdb00('0x14')](0x5)[_0xdb00('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb00('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb00('0x47')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdb00('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb00('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb00('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdb00('0x14')](0x5)[_0xdb00('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb00('0x4a')},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xdb00('0x14')](0x5)[_0xdb00('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x3,'comment':_0xdb00('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdb00('0x14')],'allowNull':!![],'comment':_0xdb00('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xdb00('0x1f')],'defaultValue':![],'comment':_0xdb00('0x4d'),'set':function(_0x345060){if(!_0x345060)this[_0xdb00('0x19')](_0xdb00('0x4e'),null);this['setDataValue'](_0xdb00('0x4f'),_0x345060);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xdb00('0x14')](0x3)[_0xdb00('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x3173=['rrmemory','linear','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Minutes\x20to\x20wait\x20to\x20call\x20next\x20additional\x20phone\x20number\x20','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','ENUM','outbound','inbound','STRING','default','ringall','leastrecent','fewestcalls','random'];(function(_0x5ca62a,_0x3dffb9){var _0xcabff4=function(_0x48766a){while(--_0x48766a){_0x5ca62a['push'](_0x5ca62a['shift']());}};_0xcabff4(++_0x3dffb9);}(_0x3173,0x13a));var _0x3317=function(_0x531535,_0x39872c){_0x531535=_0x531535-0x0;var _0x3f1563=_0x3173[_0x531535];return _0x3f1563;};'use strict';var Sequelize=require(_0x3317('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3317('0x1')]('inbound',_0x3317('0x2')),'allowNull':![],'defaultValue':_0x3317('0x3')},'musiconhold':{'type':Sequelize[_0x3317('0x4')],'defaultValue':_0x3317('0x5')},'announce':{'type':Sequelize[_0x3317('0x4')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x3317('0x6'),_0x3317('0x7'),_0x3317('0x8'),_0x3317('0x9'),_0x3317('0xa'),_0x3317('0xb'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x3317('0x6'),'set':function(_0x3cc424){this[_0x3317('0xc')](_0x3317('0xd'),_0x3cc424?_0x3cc424:_0x3317('0xa'));},'get':function(){var _0x4b2468=this[_0x3317('0xe')](_0x3317('0xf'));var _0x5e98b7=this[_0x3317('0xe')](_0x3317('0x10'));var _0x3cf5f5=this[_0x3317('0xe')](_0x3317('0xd'));if(_0x4b2468===_0x3317('0x3')){return _0x3cf5f5;}if(_0x5e98b7===_0x3317('0x11')&&_0x3cf5f5===_0x3317('0xa')||_0x5e98b7===_0x3317('0x11')&&_0x3cf5f5===_0x3317('0x12')){return _0x3cf5f5;}if(_0x5e98b7===_0x3317('0x13')||_0x5e98b7===_0x3317('0x14')||_0x5e98b7===_0x3317('0x15')){return _0x3cf5f5;}return null;}},'servicelevel':{'type':Sequelize[_0x3317('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x3317('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3317('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x3317('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x3317('0x17')},'autopause':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x17'),'no',_0x3317('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3317('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x3317('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3317('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3317('0x1')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3317('0x1')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3317('0x1')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3317('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3317('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3317('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x17'),'no'),'defaultValue':_0x3317('0x17')},'announce_holdtime':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x17'),'no',_0x3317('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3317('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x3317('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x3317('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3317('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3317('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3317('0x4')]},'queue_youarenext':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3317('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3317('0x4')]},'queue_quantity1':{'type':Sequelize[_0x3317('0x4')]},'queue_quantity2':{'type':Sequelize[_0x3317('0x4')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x3317('0x4')]},'periodic_announce':{'type':Sequelize[_0x3317('0x1a')],'set':function(_0x2f1716){this[_0x3317('0xc')](_0x3317('0x1b'),_0x2f1716?_0x2f1716['join'](','):[]);},'get':function(){return this['getDataValue'](_0x3317('0x1b'))?this[_0x3317('0xe')](_0x3317('0x1b'))[_0x3317('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x3317('0x4')],'defaultValue':_0x3317('0x17'),'set':function(_0x338a5e){this[_0x3317('0xc')](_0x3317('0x1d'),_0x338a5e?_0x338a5e[_0x3317('0x1e')](','):undefined);},'get':function(){return this[_0x3317('0xe')](_0x3317('0x1d'))?this[_0x3317('0xe')]('joinempty')[_0x3317('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3317('0x4')],'defaultValue':'no','set':function(_0x5b779b){this[_0x3317('0xc')](_0x3317('0x1f'),_0x5b779b?_0x5b779b[_0x3317('0x1e')](','):undefined);},'get':function(){return this['getDataValue'](_0x3317('0x1f'))?this['getDataValue']('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x3317('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3317('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x3317('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3317('0x4')]},'acw':{'type':Sequelize[_0x3317('0x20')],'defaultValue':0x0,'set':function(_0x2e2cdd){this[_0x3317('0xc')](_0x3317('0x21'),_0x2e2cdd);if(_0x2e2cdd){if(this['getDataValue'](_0x3317('0x22'))<0x2){this[_0x3317('0xc')](_0x3317('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3317('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x23'),_0x3317('0x13'),_0x3317('0x15'),_0x3317('0x14'),_0x3317('0x11')),'defaultValue':_0x3317('0x13'),'comment':_0x3317('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x3317('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3317('0x26')},'dialLimitQueue':{'type':Sequelize[_0x3317('0x16')](0x4)[_0x3317('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3317('0x27')},'dialPowerLevel':{'type':Sequelize[_0x3317('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x29'),_0x3317('0x2a')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3317('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x3317('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3317('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3317('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3317('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x3317('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x3317('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3317('0x2e')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x3317('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3317('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3317('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3317('0x16')](0x5)[_0x3317('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3317('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3317('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3317('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3317('0x16')](0x5)[_0x3317('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3317('0x16')](0x3)[_0x3317('0x25')],'defaultValue':0x3,'comment':_0x3317('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3317('0x16')](0x5)[_0x3317('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3317('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3317('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3317('0x4')],'defaultValue':_0x3317('0x35')},'dialPrefix':{'type':Sequelize[_0x3317('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3317('0x36'),_0x3317('0x37'),_0x3317('0x38')),'defaultValue':_0x3317('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3317('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x3317('0x16')](0x9)[_0x3317('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3317('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x3317('0x16')](0x9)[_0x3317('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3317('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3317('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3317('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3317('0x16')](0x9)[_0x3317('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3317('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3317('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3317('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3317('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3317('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3317('0x16')](0x5)[_0x3317('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3317('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3317('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3317('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3317('0x1')](_0x3317('0x41'),_0x3317('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x3317('0x4')],'comment':_0x3317('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3317('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3317('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3317('0x16')](0x3)[_0x3317('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3317('0x43')},'dialCutDigit':{'type':Sequelize[_0x3317('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3317('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3317('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3317('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3317('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x3317('0x16')](0x3)[_0x3317('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3317('0x46')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3317('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3317('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3317('0x16')](0x3)[_0x3317('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3317('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3317('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x3317('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3317('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3317('0x16')](0x5)[_0x3317('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3317('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3317('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3317('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3317('0x16')](0x5)[_0x3317('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x3,'comment':_0x3317('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3317('0x16')],'allowNull':!![],'comment':_0x3317('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x3317('0x20')],'defaultValue':![],'comment':_0x3317('0x4f'),'set':function(_0x4df3d4){if(!_0x4df3d4)this[_0x3317('0xc')](_0x3317('0x50'),null);this['setDataValue']('mandatoryDisposition',_0x4df3d4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x3317('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'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 696a66d..eb72531 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 _0x31bd=['YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','scheduledAt','ContactId','ListId','phone','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','fromQuery','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.VoiceQueueId=?','h.createdAt\x20=\x20?','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','VoiceQueues','outbound','map','value','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','inbound','findOne','CmHopper','order','VoiceQueueId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','SELECT','every','includes','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','SIP/%s','isArray','getAgents','getMembers','getLists','format'];(function(_0x2ac618,_0x797d00){var _0x27c4aa=function(_0x46424a){while(--_0x46424a){_0x2ac618['push'](_0x2ac618['shift']());}};_0x27c4aa(++_0x797d00);}(_0x31bd,0x1b4));var _0xd31b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x31bd[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xd31b('0x0'));var rimraf=require(_0xd31b('0x1'));var zipdir=require(_0xd31b('0x2'));var jsonpatch=require(_0xd31b('0x3'));var rp=require('request-promise');var moment=require(_0xd31b('0x4'));var BPromise=require(_0xd31b('0x5'));var Mustache=require(_0xd31b('0x6'));var util=require('util');var path=require(_0xd31b('0x7'));var sox=require(_0xd31b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd31b('0x9'));var _=require(_0xd31b('0xa'));var squel=require(_0xd31b('0xb'));var crypto=require(_0xd31b('0xc'));var jsforce=require(_0xd31b('0xd'));var deskjs=require(_0xd31b('0xe'));var toCsv=require(_0xd31b('0xf'));var querystring=require(_0xd31b('0x10'));var Papa=require('papaparse');var Redis=require(_0xd31b('0x11'));var authService=require(_0xd31b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd31b('0x13'));var logger=require(_0xd31b('0x14'))('api');var utils=require(_0xd31b('0x15'));var config=require(_0xd31b('0x16'));var licenseUtil=require(_0xd31b('0x17'));var db=require(_0xd31b('0x18'))['db'];config[_0xd31b('0x19')]=_[_0xd31b('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd31b('0x19')]));require('./voiceQueue.socket')[_0xd31b('0x1b')](socket);function respondWithStatusCode(_0x5515b6,_0x6d218b){_0x6d218b=_0x6d218b||0xcc;return function(_0xa5d7b8){if(_0xa5d7b8){return _0x5515b6[_0xd31b('0x1c')](_0x6d218b);}return _0x5515b6[_0xd31b('0x1d')](_0x6d218b)['end']();};}function respondWithResult(_0x250240,_0xbeb818){_0xbeb818=_0xbeb818||0xc8;return function(_0x581073){if(_0x581073){return _0x250240[_0xd31b('0x1d')](_0xbeb818)[_0xd31b('0x1e')](_0x581073);}};}function respondWithFilteredResult(_0x1e0e61,_0x4e8295){return function(_0x3a8b12){if(_0x3a8b12){var _0x379a5e=typeof _0x4e8295[_0xd31b('0x1f')]===_0xd31b('0x20')&&typeof _0x4e8295['limit']===_0xd31b('0x20');var _0x25a287=_0x3a8b12[_0xd31b('0x21')];var _0x451026=_0x379a5e?0x0:_0x4e8295[_0xd31b('0x1f')];var _0x41db03=_0x379a5e?_0x3a8b12[_0xd31b('0x21')]:_0x4e8295[_0xd31b('0x1f')]+_0x4e8295[_0xd31b('0x22')];var _0x43dbf4;if(_0x41db03>=_0x25a287){_0x41db03=_0x25a287;_0x43dbf4=0xc8;}else{_0x43dbf4=0xce;}_0x1e0e61[_0xd31b('0x1d')](_0x43dbf4);return _0x1e0e61['set'](_0xd31b('0x23'),_0x451026+'-'+_0x41db03+'/'+_0x25a287)[_0xd31b('0x1e')](_0x3a8b12);}return null;};}function patchUpdates(_0x402872){return function(_0x4bd4d1){try{jsonpatch[_0xd31b('0x24')](_0x4bd4d1,_0x402872,!![]);}catch(_0x124d5d){return BPromise['reject'](_0x124d5d);}return _0x4bd4d1[_0xd31b('0x25')]();};}function saveUpdates(_0x3dd3c5,_0x577e82){return function(_0x3cc4f1){if(_0x3cc4f1){return _0x3cc4f1[_0xd31b('0x26')](_0x3dd3c5)[_0xd31b('0x27')](function(_0x95486){return _0x95486;});}return null;};}function removeEntity(_0xa2813a,_0x17b9ca){return function(_0x51e912){if(_0x51e912){return _0x51e912[_0xd31b('0x28')]()[_0xd31b('0x27')](function(){var _0x43e61c=_0x51e912['get']({'plain':!![]});var _0x4032f9=[{'name':_0xd31b('0x29'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xd31b('0x2a'),'ignore':![]}];var _0x387862=_(_0x4032f9)['filter']('ignore')[_0xd31b('0x2b')](_0xd31b('0x2c'))[_0xd31b('0x2c')]();if(_['includes'](_0x387862,_0x43e61c[_0xd31b('0x2d')])){return;}var _0x36204c=_[_0xd31b('0x2e')](_0x4032f9,[_0xd31b('0x2c'),_0x43e61c[_0xd31b('0x2d')]])[_0xd31b('0x2f')];return db[_0xd31b('0x30')][_0xd31b('0x28')]({'where':{'type':_0x36204c,'resourceId':_0x43e61c['id']}})[_0xd31b('0x27')](function(){return _0x51e912;});})[_0xd31b('0x27')](function(){_0xa2813a[_0xd31b('0x1d')](0xcc)[_0xd31b('0x31')]();});}};}function handleEntityNotFound(_0x2d533f,_0x3a3ad1){return function(_0x24f19f){if(!_0x24f19f){_0x2d533f[_0xd31b('0x1c')](0x194);}return _0x24f19f;};}function handleError(_0x1ee307,_0x11d436){_0x11d436=_0x11d436||0x1f4;return function(_0x506417){logger[_0xd31b('0x32')](_0x506417[_0xd31b('0x33')]);if(_0x506417[_0xd31b('0x2f')]){delete _0x506417[_0xd31b('0x2f')];}_0x1ee307[_0xd31b('0x1d')](_0x11d436)[_0xd31b('0x34')](_0x506417);};}exports[_0xd31b('0x35')]=function(_0x3975ba,_0x1e4479){var _0x48fa17={},_0x46869c={},_0x5b5565={'count':0x0,'rows':[]};var _0x1fe6c7=_[_0xd31b('0x2b')](db[_0xd31b('0x36')][_0xd31b('0x37')],function(_0x51b64f){return{'name':_0x51b64f[_0xd31b('0x38')],'type':_0x51b64f[_0xd31b('0x2d')][_0xd31b('0x39')]};});_0x46869c['model']=_[_0xd31b('0x2b')](_0x1fe6c7,_0xd31b('0x2f'));_0x46869c['query']=_[_0xd31b('0x3a')](_0x3975ba[_0xd31b('0x3b')]);_0x46869c[_0xd31b('0x3c')]=_[_0xd31b('0x3d')](_0x46869c['model'],_0x46869c[_0xd31b('0x3b')]);_0x48fa17['attributes']=_[_0xd31b('0x3d')](_0x46869c[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x3975ba[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x48fa17[_0xd31b('0x40')]=_0x48fa17[_0xd31b('0x40')][_0xd31b('0x41')]?_0x48fa17[_0xd31b('0x40')]:_0x46869c[_0xd31b('0x3e')];if(!_0x3975ba[_0xd31b('0x3b')][_0xd31b('0x42')](_0xd31b('0x43'))){_0x48fa17[_0xd31b('0x22')]=qs[_0xd31b('0x22')](_0x3975ba['query'][_0xd31b('0x22')]);_0x48fa17['offset']=qs[_0xd31b('0x1f')](_0x3975ba[_0xd31b('0x3b')]['offset']);}_0x48fa17['order']=qs['sort'](_0x3975ba[_0xd31b('0x3b')][_0xd31b('0x44')]);_0x48fa17[_0xd31b('0x45')]=qs['filters'](_[_0xd31b('0x46')](_0x3975ba[_0xd31b('0x3b')],_0x46869c[_0xd31b('0x3c')]),_0x1fe6c7);if(_0x3975ba[_0xd31b('0x3b')][_0xd31b('0x47')]){_0x48fa17[_0xd31b('0x45')]=_[_0xd31b('0x48')](_0x48fa17['where'],{'$or':_[_0xd31b('0x2b')](_0x1fe6c7,function(_0x25e702){if(_0x25e702['type']!==_0xd31b('0x49')){var _0x257224={};_0x257224[_0x25e702[_0xd31b('0x2f')]]={'$like':'%'+_0x3975ba[_0xd31b('0x3b')][_0xd31b('0x47')]+'%'};return _0x257224;}})});}_0x48fa17=_[_0xd31b('0x48')]({},_0x48fa17,_0x3975ba[_0xd31b('0x4a')]);var _0xcad311={'where':_0x48fa17[_0xd31b('0x45')]};return db[_0xd31b('0x36')][_0xd31b('0x21')](_0xcad311)[_0xd31b('0x27')](function(_0xd4f18){_0x5b5565[_0xd31b('0x21')]=_0xd4f18;if(_0x3975ba[_0xd31b('0x3b')][_0xd31b('0x4b')]){_0x48fa17['include']=[{'all':!![]}];}return db[_0xd31b('0x36')][_0xd31b('0x4c')](_0x48fa17);})[_0xd31b('0x27')](function(_0x2e148a){_0x5b5565['rows']=_0x2e148a;return _0x5b5565;})[_0xd31b('0x27')](respondWithFilteredResult(_0x1e4479,_0x48fa17))[_0xd31b('0x4d')](handleError(_0x1e4479,null));};exports['show']=function(_0x2aa4c8,_0x4760bf){var _0x4b82e6={'raw':![],'where':{'id':_0x2aa4c8[_0xd31b('0x4e')]['id']}},_0x294651={};_0x294651[_0xd31b('0x3e')]=_[_0xd31b('0x3a')](db[_0xd31b('0x36')][_0xd31b('0x37')]);_0x294651[_0xd31b('0x3b')]=_[_0xd31b('0x3a')](_0x2aa4c8[_0xd31b('0x3b')]);_0x294651['filters']=_[_0xd31b('0x3d')](_0x294651[_0xd31b('0x3e')],_0x294651[_0xd31b('0x3b')]);_0x4b82e6[_0xd31b('0x40')]=_['intersection'](_0x294651[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x2aa4c8[_0xd31b('0x3b')]['fields']));_0x4b82e6[_0xd31b('0x40')]=_0x4b82e6[_0xd31b('0x40')][_0xd31b('0x41')]?_0x4b82e6[_0xd31b('0x40')]:_0x294651['model'];if(_0x2aa4c8['query'][_0xd31b('0x4b')]){_0x4b82e6['include']=[{'all':!![]}];}_0x4b82e6=_[_0xd31b('0x48')]({},_0x4b82e6,_0x2aa4c8[_0xd31b('0x4a')]);return db['VoiceQueue'][_0xd31b('0x2e')](_0x4b82e6)[_0xd31b('0x27')](handleEntityNotFound(_0x4760bf,null))['then'](respondWithResult(_0x4760bf,null))['catch'](handleError(_0x4760bf,null));};exports[_0xd31b('0x4f')]=function(_0x44d9b1,_0x3d2368){return db['VoiceQueue']['create'](_0x44d9b1[_0xd31b('0x50')],{})[_0xd31b('0x27')](function(_0x55f262){var _0x289c31=_0x44d9b1[_0xd31b('0x51')][_0xd31b('0x52')]({'plain':!![]});if(!_0x289c31)throw new Error(_0xd31b('0x53'));if(_0x289c31[_0xd31b('0x54')]===_0xd31b('0x51')){var _0x55061d=_0x55f262[_0xd31b('0x52')]({'plain':!![]});var _0x133b96=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xd31b('0x55'),'value':'outbound'}];var _0x18db8b=_[_0xd31b('0x2e')](_0x133b96,[_0xd31b('0x2c'),_0x55061d['type']])[_0xd31b('0x2f')];return db[_0xd31b('0x56')][_0xd31b('0x2e')]({'where':{'name':_0x18db8b,'userProfileId':_0x289c31[_0xd31b('0x57')]},'raw':!![]})['then'](function(_0x449359){if(_0x449359&&_0x449359[_0xd31b('0x58')]===0x0){return db[_0xd31b('0x30')][_0xd31b('0x4f')]({'name':_0x55061d[_0xd31b('0x2f')],'resourceId':_0x55061d['id'],'type':_0x449359['name'],'sectionId':_0x449359['id']},{})['then'](function(){return _0x55f262;});}else{return _0x55f262;}})[_0xd31b('0x4d')](function(_0x3a0eaf){logger[_0xd31b('0x32')](_0xd31b('0x59'),_0x3a0eaf);throw _0x3a0eaf;});}return _0x55f262;})[_0xd31b('0x27')](respondWithResult(_0x3d2368,0xc9))[_0xd31b('0x4d')](handleError(_0x3d2368,null));};exports[_0xd31b('0x5a')]=function(_0x2780a6,_0x5a4b38){var _0x1b0783={'where':{'id':_0x2780a6['params']['id']}},_0xd27335={};_0xd27335[_0xd31b('0x3e')]=_['keys'](db['VoiceQueue'][_0xd31b('0x37')]);_0x1b0783[_0xd31b('0x40')]=_['intersection'](_0xd27335[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x2780a6[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x1b0783[_0xd31b('0x40')]=_0x1b0783[_0xd31b('0x40')][_0xd31b('0x41')]?_0x1b0783['attributes']:_0xd27335['model'];if(_0x2780a6[_0xd31b('0x3b')][_0xd31b('0x4b')]){_0x1b0783[_0xd31b('0x5b')]=[{'all':!![]}];}_0x1b0783=_['merge']({},_0x1b0783,_0x2780a6[_0xd31b('0x4a')]);return db[_0xd31b('0x36')][_0xd31b('0x2e')](_0x1b0783)[_0xd31b('0x27')](handleEntityNotFound(_0x5a4b38,null))[_0xd31b('0x27')](function(_0x4ea48a){if(_0x4ea48a){var _0x16f445=_0x4ea48a['get']({'plain':!![]});_0x16f445=qs[_0xd31b('0x5c')](_0x16f445,['id',_0xd31b('0x5d'),_0xd31b('0x5e')]);_0x2780a6[_0xd31b('0x50')]=_['omit'](_0x2780a6['body'],['id','createdAt',_0xd31b('0x5e')]);return db[_0xd31b('0x36')]['create'](_['merge'](_0x16f445,_0x2780a6[_0xd31b('0x50')]),{'include':_0x2780a6[_0xd31b('0x3b')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x54f612){var _0x2c7fac=_0x2780a6['user'][_0xd31b('0x52')]({'plain':!![]});if(!_0x2c7fac)throw new Error(_0xd31b('0x53'));if(_0x2c7fac['role']===_0xd31b('0x51')){var _0x993dd8=_0x54f612[_0xd31b('0x52')]({'plain':!![]});var _0x387b01=[{'name':'VoiceQueues','value':_0xd31b('0x5f')},{'name':_0xd31b('0x55'),'value':_0xd31b('0x2a')}];var _0x16e0c3=_[_0xd31b('0x2e')](_0x387b01,[_0xd31b('0x2c'),_0x993dd8[_0xd31b('0x2d')]])[_0xd31b('0x2f')];return db[_0xd31b('0x56')][_0xd31b('0x2e')]({'where':{'name':_0x16e0c3,'userProfileId':_0x2c7fac[_0xd31b('0x57')]},'raw':!![]})[_0xd31b('0x27')](function(_0x3acef9){if(_0x3acef9&&_0x3acef9['autoAssociation']===0x0){return db[_0xd31b('0x30')]['create']({'name':_0x993dd8[_0xd31b('0x2f')],'resourceId':_0x993dd8['id'],'type':_0x3acef9['name'],'sectionId':_0x3acef9['id']},{})['then'](function(){return _0x54f612;});}else{return _0x54f612;}})[_0xd31b('0x4d')](function(_0x20df73){logger[_0xd31b('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20df73);throw _0x20df73;});}return _0x54f612;});}})[_0xd31b('0x27')](respondWithResult(_0x5a4b38,0xc9))[_0xd31b('0x4d')](handleError(_0x5a4b38,null));};exports[_0xd31b('0x26')]=function(_0x4c7faa,_0x418914){if(_0x4c7faa[_0xd31b('0x50')]['id']){delete _0x4c7faa[_0xd31b('0x50')]['id'];}return db[_0xd31b('0x36')][_0xd31b('0x2e')]({'where':{'id':_0x4c7faa['params']['id']}})['then'](handleEntityNotFound(_0x418914,null))[_0xd31b('0x27')](saveUpdates(_0x4c7faa[_0xd31b('0x50')],null))['then'](respondWithResult(_0x418914,null))[_0xd31b('0x4d')](handleError(_0x418914,null));};exports['destroy']=function(_0x3e9f87,_0x50af26){return db['VoiceQueue'][_0xd31b('0x2e')]({'where':{'id':_0x3e9f87[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x50af26,null))[_0xd31b('0x27')](removeEntity(_0x50af26,null))[_0xd31b('0x4d')](handleError(_0x50af26,null));};exports['getHoppers']=function(_0x104fc8,_0x39d1f1,_0x270792){var _0x1b4685={'raw':![],'where':{}};var _0x2be559={};var _0xfa7d01={'count':0x0,'rows':[]};return db[_0xd31b('0x36')][_0xd31b('0x60')]({'where':{'id':_0x104fc8[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x39d1f1,null))[_0xd31b('0x27')](function(_0x123a57){if(_0x123a57){_0x2be559[_0xd31b('0x3e')]=_[_0xd31b('0x3a')](db[_0xd31b('0x61')][_0xd31b('0x37')]);_0x2be559[_0xd31b('0x3b')]=_['keys'](_0x104fc8[_0xd31b('0x3b')]);_0x2be559[_0xd31b('0x3c')]=_[_0xd31b('0x3d')](_0x2be559[_0xd31b('0x3e')],_0x2be559[_0xd31b('0x3b')]);_0x1b4685[_0xd31b('0x40')]=_['intersection'](_0x2be559[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x104fc8[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x1b4685['attributes']=_0x1b4685[_0xd31b('0x40')][_0xd31b('0x41')]?_0x1b4685[_0xd31b('0x40')]:_0x2be559['model'];if(!_0x104fc8['query']['hasOwnProperty']('nolimit')){_0x1b4685['limit']=qs[_0xd31b('0x22')](_0x104fc8[_0xd31b('0x3b')]['limit']);_0x1b4685[_0xd31b('0x1f')]=qs[_0xd31b('0x1f')](_0x104fc8[_0xd31b('0x3b')][_0xd31b('0x1f')]);}_0x1b4685[_0xd31b('0x62')]=qs[_0xd31b('0x44')](_0x104fc8['query'][_0xd31b('0x44')]);_0x1b4685[_0xd31b('0x45')]=qs[_0xd31b('0x3c')](_[_0xd31b('0x46')](_0x104fc8[_0xd31b('0x3b')],_0x2be559['filters']));_0x1b4685[_0xd31b('0x45')][_0xd31b('0x63')]=_0x123a57['id'];if(_0x104fc8[_0xd31b('0x3b')][_0xd31b('0x47')]){_0x1b4685[_0xd31b('0x45')]=_[_0xd31b('0x48')](_0x1b4685[_0xd31b('0x45')],{'$or':_[_0xd31b('0x2b')](_0x1b4685['attributes'],function(_0x203a14){var _0x43a3b3={};_0x43a3b3[_0x203a14]={'$like':'%'+_0x104fc8[_0xd31b('0x3b')][_0xd31b('0x47')]+'%'};return _0x43a3b3;})});}_0x1b4685=_[_0xd31b('0x48')]({},_0x1b4685,_0x104fc8[_0xd31b('0x4a')]);return db[_0xd31b('0x61')][_0xd31b('0x21')]({'where':_0x1b4685[_0xd31b('0x45')]})['then'](function(_0x28ca2b){_0xfa7d01[_0xd31b('0x21')]=_0x28ca2b;if(_0x104fc8[_0xd31b('0x3b')]['includeAll']){_0x1b4685[_0xd31b('0x5b')]=[{'all':!![]}];}return db[_0xd31b('0x61')][_0xd31b('0x4c')](_0x1b4685);})[_0xd31b('0x27')](function(_0x557e4d){_0xfa7d01[_0xd31b('0x64')]=_0x557e4d;return _0xfa7d01;});}})['then'](respondWithFilteredResult(_0x39d1f1,_0x1b4685))[_0xd31b('0x4d')](handleError(_0x39d1f1,null));};exports['getHopperHistories']=function(_0x5d3f04,_0x111e04,_0x4e14c0){var _0x6ee80b={'raw':!![],'where':{}};var _0x5dd375={};var _0x55a446={'count':0x0,'rows':[]};return db[_0xd31b('0x36')][_0xd31b('0x60')]({'where':{'id':_0x5d3f04[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x111e04,null))[_0xd31b('0x27')](function(_0x19971a){if(_0x19971a){_0x5dd375[_0xd31b('0x3e')]=_[_0xd31b('0x3a')](db[_0xd31b('0x65')][_0xd31b('0x37')]);_0x5dd375[_0xd31b('0x3b')]=_[_0xd31b('0x3a')](_0x5d3f04[_0xd31b('0x3b')]);_0x5dd375[_0xd31b('0x3c')]=_[_0xd31b('0x3d')](_0x5dd375[_0xd31b('0x3e')],_0x5dd375[_0xd31b('0x3b')]);_0x6ee80b[_0xd31b('0x40')]=_[_0xd31b('0x3d')](_0x5dd375[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x5d3f04[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x6ee80b[_0xd31b('0x40')]=_0x6ee80b[_0xd31b('0x40')][_0xd31b('0x41')]?_0x6ee80b[_0xd31b('0x40')]:_0x5dd375['model'];if(!_0x5d3f04['query']['hasOwnProperty']('nolimit')){_0x6ee80b['limit']=qs['limit'](_0x5d3f04['query']['limit']);_0x6ee80b[_0xd31b('0x1f')]=qs[_0xd31b('0x1f')](_0x5d3f04[_0xd31b('0x3b')][_0xd31b('0x1f')]);}_0x6ee80b[_0xd31b('0x62')]=qs['sort'](_0x5d3f04['query']['sort']);_0x6ee80b['where']=qs[_0xd31b('0x3c')](_[_0xd31b('0x46')](_0x5d3f04[_0xd31b('0x3b')],_0x5dd375[_0xd31b('0x3c')]));_0x6ee80b[_0xd31b('0x45')][_0xd31b('0x63')]=_0x19971a['id'];if(_0x5d3f04['query']['filter']){_0x6ee80b[_0xd31b('0x45')]=_['merge'](_0x6ee80b[_0xd31b('0x45')],{'$or':_[_0xd31b('0x2b')](_0x6ee80b[_0xd31b('0x40')],function(_0x178f78){var _0x19f88d={};_0x19f88d[_0x178f78]={'$like':'%'+_0x5d3f04[_0xd31b('0x3b')][_0xd31b('0x47')]+'%'};return _0x19f88d;})});}_0x6ee80b=_['merge']({},_0x6ee80b,_0x5d3f04[_0xd31b('0x4a')]);return db[_0xd31b('0x65')][_0xd31b('0x21')]({'where':_0x6ee80b[_0xd31b('0x45')]})[_0xd31b('0x27')](function(_0x3ddfa6){_0x55a446['count']=_0x3ddfa6;if(_0x5d3f04['query'][_0xd31b('0x4b')]){_0x6ee80b[_0xd31b('0x5b')]=[{'all':!![]}];}return db[_0xd31b('0x65')][_0xd31b('0x4c')](_0x6ee80b);})[_0xd31b('0x27')](function(_0x15323c){_0x55a446['rows']=_0x15323c;return _0x55a446;});}})[_0xd31b('0x27')](respondWithFilteredResult(_0x111e04,_0x6ee80b))[_0xd31b('0x4d')](handleError(_0x111e04,null));};exports[_0xd31b('0x66')]=function(_0x1c9ff6,_0x413149,_0x57513f){var _0x254087={'raw':!![],'where':{}};var _0x104094={};var _0xdfcd04={'count':0x0,'rows':[]};return db[_0xd31b('0x36')]['findOne']({'where':{'id':_0x1c9ff6[_0xd31b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x413149,null))[_0xd31b('0x27')](function(_0x55a212){if(_0x55a212){_0x104094[_0xd31b('0x3e')]=_[_0xd31b('0x3a')](db['CmHopperFinal'][_0xd31b('0x37')]);_0x104094[_0xd31b('0x3b')]=_[_0xd31b('0x3a')](_0x1c9ff6[_0xd31b('0x3b')]);_0x104094[_0xd31b('0x3c')]=_[_0xd31b('0x3d')](_0x104094[_0xd31b('0x3e')],_0x104094[_0xd31b('0x3b')]);_0x254087[_0xd31b('0x40')]=_['intersection'](_0x104094[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x1c9ff6[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x254087[_0xd31b('0x40')]=_0x254087[_0xd31b('0x40')][_0xd31b('0x41')]?_0x254087[_0xd31b('0x40')]:_0x104094[_0xd31b('0x3e')];if(!_0x1c9ff6[_0xd31b('0x3b')]['hasOwnProperty'](_0xd31b('0x43'))){_0x254087['limit']=qs[_0xd31b('0x22')](_0x1c9ff6[_0xd31b('0x3b')]['limit']);_0x254087[_0xd31b('0x1f')]=qs['offset'](_0x1c9ff6['query'][_0xd31b('0x1f')]);}_0x254087['order']=qs[_0xd31b('0x44')](_0x1c9ff6[_0xd31b('0x3b')][_0xd31b('0x44')]);_0x254087[_0xd31b('0x45')]=qs[_0xd31b('0x3c')](_[_0xd31b('0x46')](_0x1c9ff6[_0xd31b('0x3b')],_0x104094[_0xd31b('0x3c')]));_0x254087['where']['VoiceQueueId']=_0x55a212['id'];if(_0x1c9ff6[_0xd31b('0x3b')]['filter']){_0x254087[_0xd31b('0x45')]=_[_0xd31b('0x48')](_0x254087[_0xd31b('0x45')],{'$or':_['map'](_0x254087[_0xd31b('0x40')],function(_0x2f9158){var _0x1f0941={};_0x1f0941[_0x2f9158]={'$like':'%'+_0x1c9ff6[_0xd31b('0x3b')][_0xd31b('0x47')]+'%'};return _0x1f0941;})});}_0x254087=_[_0xd31b('0x48')]({},_0x254087,_0x1c9ff6[_0xd31b('0x4a')]);return db[_0xd31b('0x67')][_0xd31b('0x21')]({'where':_0x254087[_0xd31b('0x45')]})[_0xd31b('0x27')](function(_0x4b5ec2){_0xdfcd04[_0xd31b('0x21')]=_0x4b5ec2;if(_0x1c9ff6[_0xd31b('0x3b')][_0xd31b('0x4b')]){_0x254087[_0xd31b('0x5b')]=[{'all':!![]}];}return db[_0xd31b('0x67')][_0xd31b('0x4c')](_0x254087);})['then'](function(_0x24a71d){_0xdfcd04[_0xd31b('0x64')]=_0x24a71d;return _0xdfcd04;});}})['then'](respondWithFilteredResult(_0x413149,_0x254087))['catch'](handleError(_0x413149,null));};exports[_0xd31b('0x68')]=function(_0x20ad66,_0x2879a4,_0xec1851){var _0x1faa9d={'raw':!![],'where':{}};var _0x294175={};var _0x1ef23f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x20ad66[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x2879a4,null))[_0xd31b('0x27')](function(_0x55546f){if(_0x55546f){_0x294175['model']=_[_0xd31b('0x3a')](db['CmHopperBlack']['rawAttributes']);_0x294175['query']=_[_0xd31b('0x3a')](_0x20ad66[_0xd31b('0x3b')]);_0x294175[_0xd31b('0x3c')]=_['intersection'](_0x294175[_0xd31b('0x3e')],_0x294175[_0xd31b('0x3b')]);_0x1faa9d['attributes']=_[_0xd31b('0x3d')](_0x294175[_0xd31b('0x3e')],qs['fields'](_0x20ad66[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x1faa9d[_0xd31b('0x40')]=_0x1faa9d[_0xd31b('0x40')][_0xd31b('0x41')]?_0x1faa9d[_0xd31b('0x40')]:_0x294175[_0xd31b('0x3e')];if(!_0x20ad66[_0xd31b('0x3b')][_0xd31b('0x42')](_0xd31b('0x43'))){_0x1faa9d[_0xd31b('0x22')]=qs[_0xd31b('0x22')](_0x20ad66[_0xd31b('0x3b')][_0xd31b('0x22')]);_0x1faa9d['offset']=qs[_0xd31b('0x1f')](_0x20ad66[_0xd31b('0x3b')][_0xd31b('0x1f')]);}_0x1faa9d[_0xd31b('0x62')]=qs[_0xd31b('0x44')](_0x20ad66[_0xd31b('0x3b')][_0xd31b('0x44')]);_0x1faa9d[_0xd31b('0x45')]=qs[_0xd31b('0x3c')](_['pick'](_0x20ad66[_0xd31b('0x3b')],_0x294175[_0xd31b('0x3c')]));_0x1faa9d[_0xd31b('0x45')][_0xd31b('0x63')]=_0x55546f['id'];if(_0x20ad66[_0xd31b('0x3b')][_0xd31b('0x47')]){_0x1faa9d['where']=_[_0xd31b('0x48')](_0x1faa9d[_0xd31b('0x45')],{'$or':_[_0xd31b('0x2b')](_0x1faa9d[_0xd31b('0x40')],function(_0xd73c14){var _0x908358={};_0x908358[_0xd73c14]={'$like':'%'+_0x20ad66[_0xd31b('0x3b')][_0xd31b('0x47')]+'%'};return _0x908358;})});}_0x1faa9d=_['merge']({},_0x1faa9d,_0x20ad66['options']);return db[_0xd31b('0x69')][_0xd31b('0x21')]({'where':_0x1faa9d[_0xd31b('0x45')]})['then'](function(_0x4d8b2d){_0x1ef23f[_0xd31b('0x21')]=_0x4d8b2d;if(_0x20ad66[_0xd31b('0x3b')][_0xd31b('0x4b')]){_0x1faa9d[_0xd31b('0x5b')]=[{'all':!![]}];}return db[_0xd31b('0x69')][_0xd31b('0x4c')](_0x1faa9d);})[_0xd31b('0x27')](function(_0x1fd154){_0x1ef23f[_0xd31b('0x64')]=_0x1fd154;return _0x1ef23f;});}})[_0xd31b('0x27')](respondWithFilteredResult(_0x2879a4,_0x1faa9d))[_0xd31b('0x4d')](handleError(_0x2879a4,null));};exports[_0xd31b('0x6a')]=function(_0x46a990,_0x2f743a,_0x1e65bc){var _0x268acf={};var _0x53322c={};var _0xd30eda;var _0x256225;return db[_0xd31b('0x36')][_0xd31b('0x60')]({'where':{'id':_0x46a990['params']['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x2f743a,null))[_0xd31b('0x27')](function(_0x5a8fca){if(_0x5a8fca){_0xd30eda=_0x5a8fca;_0x53322c[_0xd31b('0x3e')]=_[_0xd31b('0x3a')](db[_0xd31b('0x6b')]['rawAttributes']);_0x53322c[_0xd31b('0x3b')]=_[_0xd31b('0x3a')](_0x46a990['query']);_0x53322c[_0xd31b('0x3c')]=_[_0xd31b('0x3d')](_0x53322c[_0xd31b('0x3e')],_0x53322c[_0xd31b('0x3b')]);_0x268acf[_0xd31b('0x40')]=_[_0xd31b('0x3d')](_0x53322c[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x46a990[_0xd31b('0x3b')]['fields']));_0x268acf[_0xd31b('0x40')]=_0x268acf[_0xd31b('0x40')][_0xd31b('0x41')]?_0x268acf[_0xd31b('0x40')]:_0x53322c[_0xd31b('0x3e')];_0x268acf[_0xd31b('0x62')]=qs[_0xd31b('0x44')](_0x46a990[_0xd31b('0x3b')][_0xd31b('0x44')]);_0x268acf[_0xd31b('0x45')]=qs[_0xd31b('0x3c')](_[_0xd31b('0x46')](_0x46a990[_0xd31b('0x3b')],_0x53322c[_0xd31b('0x3c')]));if(_0x46a990[_0xd31b('0x3b')][_0xd31b('0x47')]){_0x268acf[_0xd31b('0x45')]=_[_0xd31b('0x48')](_0x268acf[_0xd31b('0x45')],{'$or':_[_0xd31b('0x2b')](_0x268acf['attributes'],function(_0x1ffbaa){var _0x1e8742={};_0x1e8742[_0x1ffbaa]={'$like':'%'+_0x46a990['query']['filter']+'%'};return _0x1e8742;})});}_0x268acf=_[_0xd31b('0x48')]({},_0x268acf,_0x46a990[_0xd31b('0x4a')]);return _0xd30eda[_0xd31b('0x6a')](_0x268acf);}})[_0xd31b('0x27')](function(_0x2a4e8b){if(_0x2a4e8b){_0x256225=_0x2a4e8b[_0xd31b('0x41')];if(!_0x46a990['query'][_0xd31b('0x42')](_0xd31b('0x43'))){_0x268acf['limit']=qs[_0xd31b('0x22')](_0x46a990[_0xd31b('0x3b')][_0xd31b('0x22')]);_0x268acf[_0xd31b('0x1f')]=qs[_0xd31b('0x1f')](_0x46a990[_0xd31b('0x3b')][_0xd31b('0x1f')]);}return _0xd30eda[_0xd31b('0x6a')](_0x268acf);}})['then'](function(_0x466915){if(_0x466915){return _0x466915?{'count':_0x256225,'rows':_0x466915}:null;}})[_0xd31b('0x27')](respondWithResult(_0x2f743a,null))[_0xd31b('0x4d')](handleError(_0x2f743a,null));};exports[_0xd31b('0x6c')]=function(_0x50004d,_0x49c0cd,_0x1d15d7){var _0x24e297=_0x50004d[_0xd31b('0x50')][_0xd31b('0x6d')];var _0x4b8cd3=_['map'](_0x24e297,'id');return db[_0xd31b('0x6b')]['findAll']({'where':{'id':_0x4b8cd3},'attributes':['id'],'include':[{'model':db[_0xd31b('0x6e')],'as':'Agents','attributes':['id',_0xd31b('0x2f'),_0xd31b('0x6f'),'voicePause',_0xd31b('0x70')],'raw':!![]}]})[_0xd31b('0x27')](function(_0x8c2ee9){if(_0x8c2ee9){var _0x46f40c=_[_0xd31b('0x71')](_0x8c2ee9,function(_0x55f75c){var _0x46f6be=_0x55f75c['get']({'plain':!![]});_0x46f6be['Agents'][_0xd31b('0x72')](function(_0x2e6b20){_0x2e6b20[_0xd31b('0x73')]=_[_0xd31b('0x2e')](_0x24e297,{'id':_0x46f6be['id']})['penalty'];});return _0x46f6be[_0xd31b('0x74')];});return db['VoiceQueue'][_0xd31b('0x2e')]({'where':{'id':_0x50004d[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](function(_0x2d013e){return db[_0xd31b('0x75')][_0xd31b('0x76')](function(_0x1fe556){return _0x2d013e['addTeams'](_0x4b8cd3,{'transaction':_0x1fe556})['then'](function(){return BPromise[_0xd31b('0x77')](_0x24e297,function(_0x154ef2){return db[_0xd31b('0x78')][_0xd31b('0x79')]({'TeamId':_0x154ef2['id'],'VoiceQueueId':_0x50004d[_0xd31b('0x4e')]['id'],'penalty':_0x154ef2[_0xd31b('0x73')]},{'transaction':_0x1fe556});});})['then'](function(){return BPromise[_0xd31b('0x77')](_0x46f40c,function(_0x4d7896){return db[_0xd31b('0x7a')][_0xd31b('0x7b')]({'where':{'UserId':_0x4d7896['id'],'VoiceQueueId':_0x50004d[_0xd31b('0x4e')]['id']},'defaults':{'penalty':_0x4d7896[_0xd31b('0x73')]},'transaction':_0x1fe556});});})[_0xd31b('0x27')](function(){return BPromise['each'](_[_0xd31b('0x47')](_0x46f40c,{'online':!![]}),function(_0x396dc8){return db[_0xd31b('0x7c')][_0xd31b('0x79')]({'membername':_0x396dc8['name'],'UserId':_0x396dc8['id'],'queue_name':_0x2d013e[_0xd31b('0x2f')],'VoiceQueueId':_0x2d013e['id'],'interface':_[_0xd31b('0x7d')](_0x396dc8[_0xd31b('0x70')])?util['format']('SIP/%s',_0x396dc8['name']):_0x396dc8['interface'],'paused':_0x396dc8[_0xd31b('0x7e')]||![],'penalty':_0x396dc8[_0xd31b('0x73')]},{'transaction':_0x1fe556});});})[_0xd31b('0x27')](function(){_0x46f40c[_0xd31b('0x72')](function(_0x542e74){socket[_0xd31b('0x7f')](_0xd31b('0x80'),{'UserId':_0x542e74['id'],'VoiceQueueId':_0x2d013e['id']});});});});});}})[_0xd31b('0x27')](respondWithStatusCode(_0x49c0cd,null))[_0xd31b('0x4d')](handleError(_0x49c0cd,null));};exports[_0xd31b('0x81')]=function(_0x434d1c,_0x366700,_0x2b8d95){return db[_0xd31b('0x6b')][_0xd31b('0x4c')]({'where':{'id':_0x434d1c[_0xd31b('0x3b')][_0xd31b('0x82')]},'attributes':['id'],'include':[{'model':db[_0xd31b('0x6e')],'as':_0xd31b('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x366700,null))['then'](function(_0x10ff73){var _0x3aac14=_[_0xd31b('0x2b')](_0x10ff73,'id');var _0x431c5c=[];var _0x237f11=[];var _0x328745=squel[_0xd31b('0x83')]();_0x328745[_0xd31b('0x84')]('tq.TeamId')[_0xd31b('0x85')]('team_has_voice_queues','tq')[_0xd31b('0x86')](_0xd31b('0x87'),'ut',_0xd31b('0x88'))[_0xd31b('0x45')]('VoiceQueueId\x20=\x20?',_0x434d1c['params']['id']);for(var _0x114b16=0x0;_0x114b16<_0x10ff73[_0xd31b('0x41')];_0x114b16+=0x1){let _0x256238=_0x10ff73[_0x114b16];for(var _0x2e6a4b=0x0;_0x2e6a4b<_0x256238['Agents'][_0xd31b('0x41')];_0x2e6a4b+=0x1){let _0x4f18b3=_0x256238['Agents'][_0x2e6a4b];var _0x982073=_0x328745[_0xd31b('0x5a')]();_0x982073[_0xd31b('0x45')](_0xd31b('0x89'),_0x4f18b3['id']);_0x237f11[_0xd31b('0x8a')](db[_0xd31b('0x75')]['query'](_0x982073['toString'](),{'type':db[_0xd31b('0x75')]['QueryTypes'][_0xd31b('0x8b')]})[_0xd31b('0x27')](function(_0x5e3172){if(_0x5e3172['length']===0x1){return _0x4f18b3['id'];}else{var _0x38ff04=_[_0xd31b('0x8c')](_['map'](_0x5e3172,'TeamId'),function(_0x2c1429){return _[_0xd31b('0x8d')](_0x3aac14,_0x2c1429);});if(_0x38ff04){return _0x4f18b3['id'];}}}));}}return BPromise['all'](_0x237f11)['then'](function(_0x1037d0){_0x431c5c=_(_0x431c5c)[_0xd31b('0x8e')](_0x1037d0)[_0xd31b('0x8f')]()[_0xd31b('0x2c')]();return db[_0xd31b('0x36')]['find']({'where':{'id':_0x434d1c[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](function(_0x3f753d){return db[_0xd31b('0x75')][_0xd31b('0x76')](function(_0x59040a){return _0x3f753d[_0xd31b('0x81')](_0x434d1c[_0xd31b('0x3b')][_0xd31b('0x82')],{'transaction':_0x59040a})[_0xd31b('0x27')](function(){if(!_[_0xd31b('0x90')](_0x431c5c)){return _0x3f753d[_0xd31b('0x91')](_0x431c5c,{'transaction':_0x59040a})[_0xd31b('0x27')](function(){return db[_0xd31b('0x7c')][_0xd31b('0x28')]({'where':{'VoiceQueueId':_0x434d1c[_0xd31b('0x4e')]['id'],'UserId':_0x431c5c},'transaction':_0x59040a});});}})[_0xd31b('0x27')](function(){_0x431c5c['forEach'](function(_0x4078c6){socket['emit'](_0xd31b('0x92'),{'UserId':_0x4078c6,'VoiceQueueId':_0x3f753d['id']});});});});});});})[_0xd31b('0x27')](respondWithStatusCode(_0x366700,null))[_0xd31b('0x4d')](handleError(_0x366700,null));};exports[_0xd31b('0x93')]=function(_0x26159f,_0x11a16a,_0x2ca536){var _0xdf89f4,_0x15c5fa;return db['VoiceQueue'][_0xd31b('0x2e')]({'where':{'id':_0x26159f[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x11a16a,null))[_0xd31b('0x27')](function(_0x565b13){if(_0x565b13){_0x15c5fa=_0x565b13;return _0x565b13['addAgents'](_0x26159f[_0xd31b('0x50')]['ids'],_[_0xd31b('0x5c')](_0x26159f[_0xd31b('0x50')],[_0xd31b('0x82'),'id'])||{})[_0xd31b('0x94')](function(_0x13f59b){for(var _0x54545c=0x0;_0x54545c<_0x26159f[_0xd31b('0x50')][_0xd31b('0x82')]['length'];_0x54545c+=0x1){socket['emit'](_0xd31b('0x80'),{'UserId':_0x26159f[_0xd31b('0x50')]['ids'][_0x54545c],'VoiceQueueId':_0x26159f[_0xd31b('0x4e')]['id']});}return _0x13f59b;});}})[_0xd31b('0x27')](function(_0x47dc78){_0xdf89f4=_0x47dc78||[];if(_0x15c5fa){return db[_0xd31b('0x6e')][_0xd31b('0x4c')]({'where':{'id':_0x26159f[_0xd31b('0x50')][_0xd31b('0x82')]},'attributes':['id',_0xd31b('0x2f'),_0xd31b('0x6f'),_0xd31b('0x7e'),_0xd31b('0x70')],'raw':!![]});}})[_0xd31b('0x27')](function(_0x45248d){if(!_[_0xd31b('0x90')](_0x45248d)){var _0x210100=[];for(var _0x5c1a76=0x0;_0x5c1a76<_0x45248d['length'];_0x5c1a76++){if(_0x45248d[_0x5c1a76][_0xd31b('0x6f')]){_0x210100[_0xd31b('0x8a')](db['UserVoiceQueueRt'][_0xd31b('0x79')]({'membername':_0x45248d[_0x5c1a76][_0xd31b('0x2f')],'UserId':_0x45248d[_0x5c1a76]['id'],'queue_name':_0x15c5fa['name'],'VoiceQueueId':_0x15c5fa['id'],'interface':_['isNil'](_0x45248d[_0x5c1a76][_0xd31b('0x70')])?util['format'](_0xd31b('0x95'),_0x45248d[_0x5c1a76]['name']):_0x45248d[_0x5c1a76][_0xd31b('0x70')],'paused':_0x45248d[_0x5c1a76][_0xd31b('0x7e')]||![],'penalty':_0x26159f[_0xd31b('0x50')]['penalty']||0x0}));}}return BPromise['all'](_0x210100);}})['then'](function(){return _0xdf89f4;})['then'](respondWithResult(_0x11a16a,null))['catch'](handleError(_0x11a16a,null));};exports[_0xd31b('0x91')]=function(_0x21c064,_0x3599eb,_0x2bde73){return db[_0xd31b('0x36')][_0xd31b('0x2e')]({'where':{'id':_0x21c064[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x3599eb,null))['then'](function(_0x2b8a6b){if(_0x2b8a6b){return _0x2b8a6b[_0xd31b('0x91')](_0x21c064['query'][_0xd31b('0x82')])[_0xd31b('0x27')](function(){if(_[_0xd31b('0x96')](_0x21c064[_0xd31b('0x3b')][_0xd31b('0x82')])){for(var _0x52c0ed=0x0;_0x52c0ed<_0x21c064[_0xd31b('0x3b')]['ids'][_0xd31b('0x41')];_0x52c0ed+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x21c064[_0xd31b('0x3b')][_0xd31b('0x82')][_0x52c0ed]),'VoiceQueueId':Number(_0x21c064['params']['id'])});}}else{socket[_0xd31b('0x7f')](_0xd31b('0x92'),{'UserId':Number(_0x21c064['query'][_0xd31b('0x82')]),'VoiceQueueId':Number(_0x21c064['params']['id'])});}});}})[_0xd31b('0x27')](function(_0x3f5b20){return db[_0xd31b('0x7c')][_0xd31b('0x28')]({'where':{'VoiceQueueId':_0x21c064['params']['id'],'UserId':_0x21c064['query'][_0xd31b('0x82')]}})['then'](function(){return _0x3f5b20;});})[_0xd31b('0x27')](respondWithStatusCode(_0x3599eb,null))[_0xd31b('0x4d')](handleError(_0x3599eb,null));};exports[_0xd31b('0x97')]=function(_0x445057,_0x7dbce5,_0xa16aa9){var _0x22ed73={};var _0x3a4ab6={};var _0x4ceedc;var _0xe07bd7;return db[_0xd31b('0x36')]['findOne']({'where':{'id':_0x445057[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x7dbce5,null))['then'](function(_0x1b7338){if(_0x1b7338){_0x4ceedc=_0x1b7338;_0x3a4ab6['model']=_[_0xd31b('0x3a')](db['User'][_0xd31b('0x37')]);_0x3a4ab6[_0xd31b('0x3b')]=_[_0xd31b('0x3a')](_0x445057[_0xd31b('0x3b')]);_0x3a4ab6[_0xd31b('0x3c')]=_[_0xd31b('0x3d')](_0x3a4ab6[_0xd31b('0x3e')],_0x3a4ab6[_0xd31b('0x3b')]);_0x22ed73[_0xd31b('0x40')]=_['intersection'](_0x3a4ab6[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x445057[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x22ed73['attributes']=_0x22ed73[_0xd31b('0x40')]['length']?_0x22ed73[_0xd31b('0x40')]:_0x3a4ab6[_0xd31b('0x3e')];_0x22ed73[_0xd31b('0x62')]=qs[_0xd31b('0x44')](_0x445057[_0xd31b('0x3b')][_0xd31b('0x44')]);_0x22ed73[_0xd31b('0x45')]=qs[_0xd31b('0x3c')](_['pick'](_0x445057[_0xd31b('0x3b')],_0x3a4ab6[_0xd31b('0x3c')]));if(_0x445057[_0xd31b('0x3b')]['filter']){_0x22ed73['where']=_[_0xd31b('0x48')](_0x22ed73[_0xd31b('0x45')],{'$or':_[_0xd31b('0x2b')](_0x22ed73[_0xd31b('0x40')],function(_0x291870){var _0x3d48a7={};_0x3d48a7[_0x291870]={'$like':'%'+_0x445057['query'][_0xd31b('0x47')]+'%'};return _0x3d48a7;})});}_0x22ed73=_[_0xd31b('0x48')]({},_0x22ed73,_0x445057[_0xd31b('0x4a')]);return _0x4ceedc[_0xd31b('0x97')](_0x22ed73);}})[_0xd31b('0x27')](function(_0x2bb120){if(_0x2bb120){_0xe07bd7=_0x2bb120[_0xd31b('0x41')];if(!_0x445057[_0xd31b('0x3b')][_0xd31b('0x42')](_0xd31b('0x43'))){_0x22ed73['limit']=qs[_0xd31b('0x22')](_0x445057['query'][_0xd31b('0x22')]);_0x22ed73[_0xd31b('0x1f')]=qs['offset'](_0x445057[_0xd31b('0x3b')][_0xd31b('0x1f')]);}return _0x4ceedc[_0xd31b('0x97')](_0x22ed73);}})[_0xd31b('0x27')](function(_0x183d2c){if(_0x183d2c){return _0x183d2c?{'count':_0xe07bd7,'rows':_0x183d2c}:null;}})[_0xd31b('0x27')](respondWithResult(_0x7dbce5,null))[_0xd31b('0x4d')](handleError(_0x7dbce5,null));};exports[_0xd31b('0x98')]=function(_0x349124,_0x1a50b0,_0xc57e25){var _0x9308c9={};var _0x337bf9={};var _0x5ac9f5;var _0x43c6d9;return db[_0xd31b('0x36')][_0xd31b('0x60')]({'where':{'id':_0x349124[_0xd31b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1a50b0,null))[_0xd31b('0x27')](function(_0x13ceb7){if(_0x13ceb7){_0x5ac9f5=_0x13ceb7;_0x337bf9[_0xd31b('0x3e')]=_[_0xd31b('0x3a')](db[_0xd31b('0x7c')][_0xd31b('0x37')]);_0x337bf9[_0xd31b('0x3b')]=_[_0xd31b('0x3a')](_0x349124[_0xd31b('0x3b')]);_0x337bf9[_0xd31b('0x3c')]=_['intersection'](_0x337bf9[_0xd31b('0x3e')],_0x337bf9[_0xd31b('0x3b')]);_0x9308c9[_0xd31b('0x40')]=_[_0xd31b('0x3d')](_0x337bf9[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x349124[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x9308c9[_0xd31b('0x40')]=_0x9308c9[_0xd31b('0x40')][_0xd31b('0x41')]?_0x9308c9[_0xd31b('0x40')]:_0x337bf9['model'];_0x9308c9[_0xd31b('0x62')]=qs[_0xd31b('0x44')](_0x349124[_0xd31b('0x3b')][_0xd31b('0x44')]);_0x9308c9['where']=qs[_0xd31b('0x3c')](_['pick'](_0x349124[_0xd31b('0x3b')],_0x337bf9[_0xd31b('0x3c')]));if(_0x349124[_0xd31b('0x3b')]['filter']){_0x9308c9['where']=_[_0xd31b('0x48')](_0x9308c9[_0xd31b('0x45')],{'$or':_['map'](_0x9308c9[_0xd31b('0x40')],function(_0xfa8f78){var _0x48907d={};_0x48907d[_0xfa8f78]={'$like':'%'+_0x349124[_0xd31b('0x3b')]['filter']+'%'};return _0x48907d;})});}_0x9308c9=_[_0xd31b('0x48')]({},_0x9308c9,_0x349124[_0xd31b('0x4a')]);return _0x5ac9f5['getMembers'](_0x9308c9);}})[_0xd31b('0x27')](function(_0x2571a7){if(_0x2571a7){_0x43c6d9=_0x2571a7[_0xd31b('0x41')];if(!_0x349124[_0xd31b('0x3b')][_0xd31b('0x42')](_0xd31b('0x43'))){_0x9308c9[_0xd31b('0x22')]=qs['limit'](_0x349124['query'][_0xd31b('0x22')]);_0x9308c9[_0xd31b('0x1f')]=qs[_0xd31b('0x1f')](_0x349124['query'][_0xd31b('0x1f')]);}return _0x5ac9f5[_0xd31b('0x98')](_0x9308c9);}})[_0xd31b('0x27')](function(_0x47f3c0){return _0x47f3c0?{'count':_0x43c6d9,'rows':_0x47f3c0}:null;})[_0xd31b('0x27')](respondWithResult(_0x1a50b0,null))[_0xd31b('0x4d')](handleError(_0x1a50b0,null));};exports[_0xd31b('0x99')]=function(_0x517b1c,_0x5a8bef,_0x175ad0){var _0x329e08={};var _0x4ef351={};var _0x471288;var _0x410b2e;return db[_0xd31b('0x36')][_0xd31b('0x60')]({'where':{'id':_0x517b1c[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x5a8bef,null))['then'](function(_0x145970){if(_0x145970){_0x471288=_0x145970;_0x4ef351[_0xd31b('0x3e')]=_[_0xd31b('0x3a')](db['CmList'][_0xd31b('0x37')]);_0x4ef351['query']=_[_0xd31b('0x3a')](_0x517b1c[_0xd31b('0x3b')]);_0x4ef351[_0xd31b('0x3c')]=_[_0xd31b('0x3d')](_0x4ef351[_0xd31b('0x3e')],_0x4ef351['query']);_0x329e08[_0xd31b('0x40')]=_[_0xd31b('0x3d')](_0x4ef351['model'],qs[_0xd31b('0x3f')](_0x517b1c[_0xd31b('0x3b')][_0xd31b('0x3f')]));_0x329e08[_0xd31b('0x40')]=_0x329e08[_0xd31b('0x40')][_0xd31b('0x41')]?_0x329e08[_0xd31b('0x40')]:_0x4ef351[_0xd31b('0x3e')];_0x329e08[_0xd31b('0x62')]=qs['sort'](_0x517b1c[_0xd31b('0x3b')]['sort']);_0x329e08['where']=qs[_0xd31b('0x3c')](_['pick'](_0x517b1c[_0xd31b('0x3b')],_0x4ef351[_0xd31b('0x3c')]));if(_0x517b1c['query'][_0xd31b('0x47')]){_0x329e08[_0xd31b('0x45')]=_[_0xd31b('0x48')](_0x329e08['where'],{'$or':_['map'](_0x329e08[_0xd31b('0x40')],function(_0x4dcec6){var _0x4ffb78={};_0x4ffb78[_0x4dcec6]={'$like':'%'+_0x517b1c[_0xd31b('0x3b')][_0xd31b('0x47')]+'%'};return _0x4ffb78;})});}_0x329e08=_['merge']({},_0x329e08,_0x517b1c[_0xd31b('0x4a')]);return _0x471288['getLists'](_0x329e08);}})[_0xd31b('0x27')](function(_0x1e2c0e){if(_0x1e2c0e){_0x410b2e=_0x1e2c0e[_0xd31b('0x41')];if(!_0x517b1c[_0xd31b('0x3b')][_0xd31b('0x42')](_0xd31b('0x43'))){_0x329e08['limit']=qs[_0xd31b('0x22')](_0x517b1c['query'][_0xd31b('0x22')]);_0x329e08[_0xd31b('0x1f')]=qs[_0xd31b('0x1f')](_0x517b1c[_0xd31b('0x3b')][_0xd31b('0x1f')]);}return _0x471288[_0xd31b('0x99')](_0x329e08);}})['then'](function(_0x5e61df){if(_0x5e61df){return _0x5e61df?{'count':_0x410b2e,'rows':_0x5e61df}:null;}})[_0xd31b('0x27')](respondWithResult(_0x5a8bef,null))[_0xd31b('0x4d')](handleError(_0x5a8bef,null));};exports['addLists']=function(_0x1682c7,_0x3aed2f,_0x42b05e){var _0x51ea62,_0x1ea673;var _0x28670f=[];var _0x4b3431=moment()[_0xd31b('0x9a')](_0xd31b('0x9b'));return db[_0xd31b('0x36')][_0xd31b('0x2e')]({'where':{'id':_0x1682c7[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x3aed2f,null))['then'](function(_0x310c8b){if(_0x310c8b){_0x1ea673=_0x310c8b;return _0x310c8b[_0xd31b('0x9c')](_0x1682c7['body'][_0xd31b('0x82')],_['omit'](_0x1682c7[_0xd31b('0x50')],[_0xd31b('0x82'),'id'])||{});}return null;})['spread'](function(_0x345f59){var _0x27c9c2;var _0x4e9835;_0x51ea62=_0x345f59||[];var _0x24ee2e=[];if(_0x345f59){for(var _0x5165c0=0x0;_0x5165c0<_0x345f59['length'];_0x5165c0+=0x1){var _0x2cb3fc=_0x345f59[_0x5165c0][_0xd31b('0x52')]({'plain':!![]});_0x1ea673[_0xd31b('0x9d')]=_0x1682c7[_0xd31b('0x50')][_0xd31b('0x9d')]?_0x1682c7[_0xd31b('0x50')]['dialCheckDuplicateType']:_0x1ea673[_0xd31b('0x9d')];switch(_0x1ea673[_0xd31b('0x9d')]){case _0xd31b('0x9e'):_0x27c9c2=squel[_0xd31b('0x9f')]()[_0xd31b('0xa0')](_0xd31b('0xa1'))['fromQuery'](['phone',_0xd31b('0xa2'),_0xd31b('0xa3'),_0xd31b('0xa4'),'VoiceQueueId',_0xd31b('0x5d'),'updatedAt'],squel['select']()[_0xd31b('0x84')](_0xd31b('0xa5'),_0xd31b('0xa5'))['field'](_0xd31b('0xa6'),_0xd31b('0xa2'))[_0xd31b('0x84')]('id','ContactId')[_0xd31b('0x84')](_0x2cb3fc[_0xd31b('0xa7')]['toString'](),'ListId')[_0xd31b('0x84')](_0x1682c7['params']['id'][_0xd31b('0xa8')](),_0xd31b('0x63'))['field']('\x27'+_0x4b3431+'\x27',_0xd31b('0x5d'))['field']('\x27'+_0x4b3431+'\x27',_0xd31b('0x5e'))[_0xd31b('0x85')](_0xd31b('0xa9'))[_0xd31b('0x45')](_0xd31b('0xaa'))[_0xd31b('0x45')](_0xd31b('0xab'),_0x2cb3fc[_0xd31b('0xa7')][_0xd31b('0xa8')]())[_0xd31b('0x45')](_0xd31b('0xac'))['where'](_0xd31b('0xad'),squel[_0xd31b('0x83')]()[_0xd31b('0x84')](_0xd31b('0xae'))[_0xd31b('0x85')](_0xd31b('0xaf'))[_0xd31b('0x45')](_0xd31b('0xb0'),_0x1682c7['params']['id'][_0xd31b('0xa8')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd31b('0x83')]()[_0xd31b('0x84')]('COALESCE(phone,\x27\x27)')[_0xd31b('0x85')](_0xd31b('0xa1'))[_0xd31b('0x45')](_0xd31b('0xb0'),_0x1682c7[_0xd31b('0x4e')]['id'][_0xd31b('0xa8')]())))[_0xd31b('0xa8')]();break;case'onlyIfOpen':_0x27c9c2=squel['insert']()[_0xd31b('0xa0')](_0xd31b('0xa1'))[_0xd31b('0xb1')]([_0xd31b('0xa5'),'scheduledAt',_0xd31b('0xa3'),_0xd31b('0xa4'),'VoiceQueueId','createdAt',_0xd31b('0x5e')],squel[_0xd31b('0x83')]()[_0xd31b('0x84')](_0xd31b('0xa5'),_0xd31b('0xa5'))[_0xd31b('0x84')](_0xd31b('0xa6'),_0xd31b('0xa2'))[_0xd31b('0x84')]('id',_0xd31b('0xa3'))[_0xd31b('0x84')](_0x2cb3fc[_0xd31b('0xa7')]['toString'](),_0xd31b('0xa4'))[_0xd31b('0x84')](_0x1682c7[_0xd31b('0x4e')]['id']['toString'](),_0xd31b('0x63'))[_0xd31b('0x84')]('\x27'+_0x4b3431+'\x27',_0xd31b('0x5d'))[_0xd31b('0x84')]('\x27'+_0x4b3431+'\x27',_0xd31b('0x5e'))['from'](_0xd31b('0xa9'))[_0xd31b('0x45')](_0xd31b('0xaa'))[_0xd31b('0x45')](_0xd31b('0xab'),_0x2cb3fc[_0xd31b('0xa7')][_0xd31b('0xa8')]())[_0xd31b('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xd31b('0x45')](_0xd31b('0xad'),squel['select']()[_0xd31b('0x84')](_0xd31b('0xb2'))['from'](_0xd31b('0xa1'))[_0xd31b('0x45')](_0xd31b('0xb0'),_0x1682c7[_0xd31b('0x4e')]['id'][_0xd31b('0xa8')]())))['toString']();break;default:_0x27c9c2=squel[_0xd31b('0x9f')]()[_0xd31b('0xa0')]('cm_hopper')[_0xd31b('0xb1')]([_0xd31b('0xa5'),_0xd31b('0xa2'),_0xd31b('0xa3'),_0xd31b('0xa4'),_0xd31b('0x63'),_0xd31b('0x5d'),_0xd31b('0x5e')],squel[_0xd31b('0x83')]()[_0xd31b('0x84')](_0xd31b('0xa5'),'phone')[_0xd31b('0x84')]('NOW()','scheduledAt')['field']('id',_0xd31b('0xa3'))[_0xd31b('0x84')](_0x2cb3fc['CmListId'][_0xd31b('0xa8')](),'ListId')[_0xd31b('0x84')](_0x1682c7['params']['id']['toString'](),_0xd31b('0x63'))[_0xd31b('0x84')]('\x27'+_0x4b3431+'\x27',_0xd31b('0x5d'))[_0xd31b('0x84')]('\x27'+_0x4b3431+'\x27','updatedAt')[_0xd31b('0x85')]('cm_contacts')[_0xd31b('0x45')](_0xd31b('0xaa'))[_0xd31b('0x45')](_0xd31b('0xab'),_0x2cb3fc[_0xd31b('0xa7')][_0xd31b('0xa8')]())[_0xd31b('0x45')](_0xd31b('0xac')))['toString']();}_0x4e9835=squel[_0xd31b('0x9f')]()[_0xd31b('0xa0')](_0xd31b('0xb3'))[_0xd31b('0xb1')]([_0xd31b('0xb4'),_0xd31b('0xa2'),_0xd31b('0xa5'),_0xd31b('0xb5'),_0xd31b('0x5d'),'updatedAt'],squel['select']()['field'](_0xd31b('0xb6'),'id')[_0xd31b('0x84')](_0xd31b('0xa6'),'scheduledAt')[_0xd31b('0x84')](_0xd31b('0xb7'),_0xd31b('0xa5'))['field'](_0xd31b('0xb8'),'OrderBy')[_0xd31b('0x84')]('\x27'+_0x4b3431+'\x27',_0xd31b('0x5d'))[_0xd31b('0x84')]('\x27'+_0x4b3431+'\x27','updatedAt')[_0xd31b('0x85')](_0xd31b('0xb9'),'ci')['join']('cm_hopper','h',_0xd31b('0xba'))['where'](_0xd31b('0xbb'),_0x2cb3fc[_0xd31b('0xa7')]['toString']())[_0xd31b('0x45')](_0xd31b('0xbc'),_0x1682c7[_0xd31b('0x4e')]['id'][_0xd31b('0xa8')]())[_0xd31b('0x45')](_0xd31b('0xbd'),_0x4b3431))[_0xd31b('0xa8')]();_0x24ee2e[_0xd31b('0x8a')](db['sequelize']['query'](_0x27c9c2));_0x28670f[_0xd31b('0x8a')](db[_0xd31b('0x75')][_0xd31b('0x3b')](_0x4e9835));}return BPromise[_0xd31b('0xbe')](_0x24ee2e);}})['then'](function(){return BPromise[_0xd31b('0xbe')](_0x28670f);})[_0xd31b('0x27')](function(){return _0x51ea62;})['then'](respondWithResult(_0x3aed2f,null))['catch'](handleError(_0x3aed2f,null));};exports[_0xd31b('0xbf')]=function(_0x4f1c78,_0x3687f6,_0x1d710d){return db[_0xd31b('0x36')][_0xd31b('0x2e')]({'where':{'id':_0x4f1c78[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x3687f6,null))[_0xd31b('0x27')](function(_0x326130){if(_0x326130){return _0x326130[_0xd31b('0xbf')](_0x4f1c78[_0xd31b('0x3b')][_0xd31b('0x82')]);}})[_0xd31b('0x27')](function(_0x5db037){if(_0x5db037){return db['CmHopper'][_0xd31b('0x28')]({'where':{'ListId':_0x4f1c78[_0xd31b('0x3b')][_0xd31b('0x82')],'VoiceQueueId':_0x4f1c78[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](function(){return _0x5db037;});}})[_0xd31b('0x27')](respondWithStatusCode(_0x3687f6,null))[_0xd31b('0x4d')](handleError(_0x3687f6,null));};exports[_0xd31b('0xc0')]=function(_0x32dd9c,_0x4be9ad,_0x5f399f){var _0x315e60={};var _0x14d067={};var _0x3ca176;var _0x1ab7fc;return db[_0xd31b('0x36')]['findOne']({'where':{'id':_0x32dd9c[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](handleEntityNotFound(_0x4be9ad,null))[_0xd31b('0x27')](function(_0x5f34ea){if(_0x5f34ea){_0x3ca176=_0x5f34ea;_0x14d067[_0xd31b('0x3e')]=_[_0xd31b('0x3a')](db[_0xd31b('0xc1')]['rawAttributes']);_0x14d067[_0xd31b('0x3b')]=_[_0xd31b('0x3a')](_0x32dd9c[_0xd31b('0x3b')]);_0x14d067[_0xd31b('0x3c')]=_[_0xd31b('0x3d')](_0x14d067[_0xd31b('0x3e')],_0x14d067[_0xd31b('0x3b')]);_0x315e60[_0xd31b('0x40')]=_['intersection'](_0x14d067[_0xd31b('0x3e')],qs[_0xd31b('0x3f')](_0x32dd9c['query'][_0xd31b('0x3f')]));_0x315e60['attributes']=_0x315e60['attributes']['length']?_0x315e60[_0xd31b('0x40')]:_0x14d067[_0xd31b('0x3e')];_0x315e60[_0xd31b('0x62')]=qs[_0xd31b('0x44')](_0x32dd9c['query']['sort']);_0x315e60[_0xd31b('0x45')]=qs[_0xd31b('0x3c')](_[_0xd31b('0x46')](_0x32dd9c[_0xd31b('0x3b')],_0x14d067['filters']));if(_0x32dd9c['query'][_0xd31b('0x47')]){_0x315e60[_0xd31b('0x45')]=_[_0xd31b('0x48')](_0x315e60['where'],{'$or':_['map'](_0x315e60[_0xd31b('0x40')],function(_0x20203e){var _0x4c6619={};_0x4c6619[_0x20203e]={'$like':'%'+_0x32dd9c[_0xd31b('0x3b')][_0xd31b('0x47')]+'%'};return _0x4c6619;})});}_0x315e60=_[_0xd31b('0x48')]({},_0x315e60,_0x32dd9c[_0xd31b('0x4a')]);return _0x3ca176['getBlackLists'](_0x315e60);}})['then'](function(_0x9aefe1){if(_0x9aefe1){_0x1ab7fc=_0x9aefe1[_0xd31b('0x41')];if(!_0x32dd9c['query'][_0xd31b('0x42')](_0xd31b('0x43'))){_0x315e60['limit']=qs[_0xd31b('0x22')](_0x32dd9c[_0xd31b('0x3b')]['limit']);_0x315e60['offset']=qs[_0xd31b('0x1f')](_0x32dd9c[_0xd31b('0x3b')]['offset']);}return _0x3ca176['getBlackLists'](_0x315e60);}})['then'](function(_0x2915e9){if(_0x2915e9){return _0x2915e9?{'count':_0x1ab7fc,'rows':_0x2915e9}:null;}})[_0xd31b('0x27')](respondWithResult(_0x4be9ad,null))['catch'](handleError(_0x4be9ad,null));};exports[_0xd31b('0xc2')]=function(_0x3e68b4,_0x3a85e2,_0x363869){var _0x39189e,_0xe2d44b;var _0x54981e=[];var _0x16128e=moment()[_0xd31b('0x9a')](_0xd31b('0x9b'));return db[_0xd31b('0x36')][_0xd31b('0x2e')]({'where':{'id':_0x3e68b4[_0xd31b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a85e2,null))[_0xd31b('0x27')](function(_0x14bb30){if(_0x14bb30){_0xe2d44b=_0x14bb30;return _0x14bb30[_0xd31b('0xc2')](_0x3e68b4[_0xd31b('0x50')][_0xd31b('0x82')],_[_0xd31b('0x5c')](_0x3e68b4[_0xd31b('0x50')],[_0xd31b('0x82'),'id'])||{});}return null;})[_0xd31b('0x94')](function(_0xfcb890){var _0x33a069;var _0x335d75;_0x39189e=_0xfcb890||[];var _0x2cfcd6=[];if(_0xfcb890){for(var _0x139b2d=0x0;_0x139b2d<_0xfcb890[_0xd31b('0x41')];_0x139b2d+=0x1){var _0x5ba0de=_0xfcb890[_0x139b2d][_0xd31b('0x52')]({'plain':!![]});_0x33a069=squel[_0xd31b('0x9f')]()[_0xd31b('0xa0')](_0xd31b('0xc3'))[_0xd31b('0xb1')]([_0xd31b('0xa5'),_0xd31b('0xa3'),'ListId','VoiceQueueId','createdAt',_0xd31b('0x5e')],squel['select']()[_0xd31b('0x84')](_0xd31b('0xa5'),_0xd31b('0xa5'))[_0xd31b('0x84')]('id','ContactId')[_0xd31b('0x84')](_0x5ba0de[_0xd31b('0xa7')][_0xd31b('0xa8')](),_0xd31b('0xa4'))[_0xd31b('0x84')](_0x3e68b4['params']['id']['toString'](),_0xd31b('0x63'))['field']('NOW()',_0xd31b('0x5d'))[_0xd31b('0x84')](_0xd31b('0xa6'),_0xd31b('0x5e'))[_0xd31b('0x85')](_0xd31b('0xa9'))[_0xd31b('0x45')](_0xd31b('0xaa'))[_0xd31b('0x45')]('ListId\x20=\x20?',_0x5ba0de[_0xd31b('0xa7')]['toString']())[_0xd31b('0x45')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x2cfcd6['push'](db[_0xd31b('0x75')]['query'](_0x33a069));}return BPromise[_0xd31b('0xbe')](_0x2cfcd6);}})[_0xd31b('0x27')](function(){return _0x39189e;})[_0xd31b('0x27')](respondWithResult(_0x3a85e2,null))[_0xd31b('0x4d')](handleError(_0x3a85e2,null));};exports[_0xd31b('0xc4')]=function(_0x33a4c1,_0x2c0d89,_0x23959e){return db[_0xd31b('0x36')][_0xd31b('0x2e')]({'where':{'id':_0x33a4c1[_0xd31b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c0d89,null))[_0xd31b('0x27')](function(_0x1525a3){if(_0x1525a3){return _0x1525a3[_0xd31b('0xc4')](_0x33a4c1[_0xd31b('0x3b')][_0xd31b('0x82')]);}})[_0xd31b('0x27')](function(_0x374b84){if(_0x374b84){return db[_0xd31b('0x69')][_0xd31b('0x28')]({'where':{'ListId':_0x33a4c1['query'][_0xd31b('0x82')],'VoiceQueueId':_0x33a4c1[_0xd31b('0x4e')]['id']}})[_0xd31b('0x27')](function(){return _0x374b84;});}})[_0xd31b('0x27')](respondWithStatusCode(_0x2c0d89,null))['catch'](handleError(_0x2c0d89,null));}; \ No newline at end of file +var _0x7f4f=['always','insert','into','fromQuery','phone','scheduledAt','ContactId','field','CmListId','toString','ListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','NOW()','ListId\x20=\x20?','cmHopperId','OrderBy','ci.item','cm_contact_has_items','join','h.ListId\x20=\x20?','h.VoiceQueueId=?','h.createdAt\x20=\x20?','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','include','findAll','catch','show','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','body','includeAll','role','findOne','CmHopper','nolimit','getHopperHistories','CmHopperHistory','VoiceQueueId','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','union','compact','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','User','voicePause','isEmpty','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0x7f4f,0x1a4));var _0xf7f4=function(_0x5ae0cf,_0x501c34){_0x5ae0cf=_0x5ae0cf-0x0;var _0x43f562=_0x7f4f[_0x5ae0cf];return _0x43f562;};'use strict';var emlformat=require(_0xf7f4('0x0'));var rimraf=require(_0xf7f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf7f4('0x2'));var Mustache=require(_0xf7f4('0x3'));var util=require(_0xf7f4('0x4'));var path=require(_0xf7f4('0x5'));var sox=require(_0xf7f4('0x6'));var csv=require(_0xf7f4('0x7'));var ejs=require(_0xf7f4('0x8'));var fs=require('fs');var fs_extra=require(_0xf7f4('0x9'));var _=require(_0xf7f4('0xa'));var squel=require('squel');var crypto=require(_0xf7f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf7f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf7f4('0xd'));var Papa=require(_0xf7f4('0xe'));var Redis=require(_0xf7f4('0xf'));var authService=require(_0xf7f4('0x10'));var qs=require(_0xf7f4('0x11'));var as=require(_0xf7f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7f4('0x13'))(_0xf7f4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf7f4('0x15'));var db=require('../../mysqldb')['db'];config[_0xf7f4('0x16')]=_[_0xf7f4('0x17')](config[_0xf7f4('0x16')],{'host':_0xf7f4('0x18'),'port':0x18eb});var socket=require(_0xf7f4('0x19'))(new Redis(config['redis']));require(_0xf7f4('0x1a'))['register'](socket);function respondWithStatusCode(_0x19fc36,_0x556e43){_0x556e43=_0x556e43||0xcc;return function(_0x4d4af0){if(_0x4d4af0){return _0x19fc36[_0xf7f4('0x1b')](_0x556e43);}return _0x19fc36[_0xf7f4('0x1c')](_0x556e43)[_0xf7f4('0x1d')]();};}function respondWithResult(_0x459365,_0x5d725b){_0x5d725b=_0x5d725b||0xc8;return function(_0x1ee34e){if(_0x1ee34e){return _0x459365[_0xf7f4('0x1c')](_0x5d725b)[_0xf7f4('0x1e')](_0x1ee34e);}};}function respondWithFilteredResult(_0x5f1ba0,_0x2e2365){return function(_0xd2f914){if(_0xd2f914){var _0x327b89=typeof _0x2e2365[_0xf7f4('0x1f')]==='undefined'&&typeof _0x2e2365[_0xf7f4('0x20')]==='undefined';var _0x1f73c0=_0xd2f914[_0xf7f4('0x21')];var _0x338800=_0x327b89?0x0:_0x2e2365[_0xf7f4('0x1f')];var _0x1b30c2=_0x327b89?_0xd2f914[_0xf7f4('0x21')]:_0x2e2365[_0xf7f4('0x1f')]+_0x2e2365[_0xf7f4('0x20')];var _0x2c0634;if(_0x1b30c2>=_0x1f73c0){_0x1b30c2=_0x1f73c0;_0x2c0634=0xc8;}else{_0x2c0634=0xce;}_0x5f1ba0['status'](_0x2c0634);return _0x5f1ba0[_0xf7f4('0x22')](_0xf7f4('0x23'),_0x338800+'-'+_0x1b30c2+'/'+_0x1f73c0)[_0xf7f4('0x1e')](_0xd2f914);}return null;};}function patchUpdates(_0x49d5ac){return function(_0x3c6e13){try{jsonpatch['apply'](_0x3c6e13,_0x49d5ac,!![]);}catch(_0x3d9080){return BPromise[_0xf7f4('0x24')](_0x3d9080);}return _0x3c6e13[_0xf7f4('0x25')]();};}function saveUpdates(_0x28636e,_0xe66b8a){return function(_0xb23f9b){if(_0xb23f9b){return _0xb23f9b[_0xf7f4('0x26')](_0x28636e)[_0xf7f4('0x27')](function(_0x4f52aa){return _0x4f52aa;});}return null;};}function removeEntity(_0x52f6ff,_0x599e6d){return function(_0x588522){if(_0x588522){return _0x588522[_0xf7f4('0x28')]()[_0xf7f4('0x27')](function(){var _0x3a4767=_0x588522[_0xf7f4('0x29')]({'plain':!![]});var _0x21bf38=[{'name':_0xf7f4('0x2a'),'value':_0xf7f4('0x2b'),'ignore':![]},{'name':_0xf7f4('0x2c'),'value':_0xf7f4('0x2d'),'ignore':![]}];var _0x752cbf=_(_0x21bf38)[_0xf7f4('0x2e')](_0xf7f4('0x2f'))[_0xf7f4('0x30')]('value')[_0xf7f4('0x31')]();if(_[_0xf7f4('0x32')](_0x752cbf,_0x3a4767[_0xf7f4('0x33')])){return;}var _0x12bde1=_[_0xf7f4('0x34')](_0x21bf38,[_0xf7f4('0x31'),_0x3a4767[_0xf7f4('0x33')]])[_0xf7f4('0x35')];return db[_0xf7f4('0x36')]['destroy']({'where':{'type':_0x12bde1,'resourceId':_0x3a4767['id']}})['then'](function(){return _0x588522;});})['then'](function(){_0x52f6ff['status'](0xcc)[_0xf7f4('0x1d')]();});}};}function handleEntityNotFound(_0x414fc,_0x180a34){return function(_0xda2bcc){if(!_0xda2bcc){_0x414fc[_0xf7f4('0x1b')](0x194);}return _0xda2bcc;};}function handleError(_0x190f07,_0x418597){_0x418597=_0x418597||0x1f4;return function(_0x2421aa){logger[_0xf7f4('0x37')](_0x2421aa[_0xf7f4('0x38')]);if(_0x2421aa[_0xf7f4('0x35')]){delete _0x2421aa[_0xf7f4('0x35')];}_0x190f07['status'](_0x418597)[_0xf7f4('0x39')](_0x2421aa);};}exports[_0xf7f4('0x3a')]=function(_0x4d1eba,_0x533d93){var _0x4e2c13={},_0x5849e3={},_0x447311={'count':0x0,'rows':[]};var _0x484f59=_[_0xf7f4('0x30')](db['VoiceQueue'][_0xf7f4('0x3b')],function(_0x136c72){return{'name':_0x136c72[_0xf7f4('0x3c')],'type':_0x136c72[_0xf7f4('0x33')][_0xf7f4('0x3d')]};});_0x5849e3[_0xf7f4('0x3e')]=_[_0xf7f4('0x30')](_0x484f59,_0xf7f4('0x35'));_0x5849e3[_0xf7f4('0x3f')]=_[_0xf7f4('0x40')](_0x4d1eba[_0xf7f4('0x3f')]);_0x5849e3[_0xf7f4('0x41')]=_[_0xf7f4('0x42')](_0x5849e3[_0xf7f4('0x3e')],_0x5849e3[_0xf7f4('0x3f')]);_0x4e2c13[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x5849e3[_0xf7f4('0x3e')],qs[_0xf7f4('0x44')](_0x4d1eba[_0xf7f4('0x3f')][_0xf7f4('0x44')]));_0x4e2c13[_0xf7f4('0x43')]=_0x4e2c13['attributes'][_0xf7f4('0x45')]?_0x4e2c13[_0xf7f4('0x43')]:_0x5849e3['model'];if(!_0x4d1eba['query'][_0xf7f4('0x46')]('nolimit')){_0x4e2c13[_0xf7f4('0x20')]=qs[_0xf7f4('0x20')](_0x4d1eba['query'][_0xf7f4('0x20')]);_0x4e2c13['offset']=qs[_0xf7f4('0x1f')](_0x4d1eba[_0xf7f4('0x3f')][_0xf7f4('0x1f')]);}_0x4e2c13[_0xf7f4('0x47')]=qs[_0xf7f4('0x48')](_0x4d1eba['query'][_0xf7f4('0x48')]);_0x4e2c13[_0xf7f4('0x49')]=qs[_0xf7f4('0x41')](_[_0xf7f4('0x4a')](_0x4d1eba['query'],_0x5849e3[_0xf7f4('0x41')]),_0x484f59);if(_0x4d1eba['query'][_0xf7f4('0x2e')]){_0x4e2c13[_0xf7f4('0x49')]=_[_0xf7f4('0x4b')](_0x4e2c13[_0xf7f4('0x49')],{'$or':_[_0xf7f4('0x30')](_0x484f59,function(_0x1309af){if(_0x1309af['type']!==_0xf7f4('0x4c')){var _0x1f3439={};_0x1f3439[_0x1309af[_0xf7f4('0x35')]]={'$like':'%'+_0x4d1eba['query'][_0xf7f4('0x2e')]+'%'};return _0x1f3439;}})});}_0x4e2c13=_[_0xf7f4('0x4b')]({},_0x4e2c13,_0x4d1eba[_0xf7f4('0x4d')]);var _0x4b0d0f={'where':_0x4e2c13['where']};return db[_0xf7f4('0x4e')][_0xf7f4('0x21')](_0x4b0d0f)[_0xf7f4('0x27')](function(_0x4381d6){_0x447311[_0xf7f4('0x21')]=_0x4381d6;if(_0x4d1eba['query']['includeAll']){_0x4e2c13[_0xf7f4('0x4f')]=[{'all':!![]}];}return db[_0xf7f4('0x4e')][_0xf7f4('0x50')](_0x4e2c13);})['then'](function(_0x27c389){_0x447311['rows']=_0x27c389;return _0x447311;})['then'](respondWithFilteredResult(_0x533d93,_0x4e2c13))[_0xf7f4('0x51')](handleError(_0x533d93,null));};exports[_0xf7f4('0x52')]=function(_0xc55eb6,_0x4f8331){var _0x28f196={'raw':![],'where':{'id':_0xc55eb6[_0xf7f4('0x53')]['id']}},_0x4897c8={};_0x4897c8[_0xf7f4('0x3e')]=_[_0xf7f4('0x40')](db[_0xf7f4('0x4e')]['rawAttributes']);_0x4897c8[_0xf7f4('0x3f')]=_[_0xf7f4('0x40')](_0xc55eb6['query']);_0x4897c8[_0xf7f4('0x41')]=_[_0xf7f4('0x42')](_0x4897c8[_0xf7f4('0x3e')],_0x4897c8[_0xf7f4('0x3f')]);_0x28f196[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x4897c8[_0xf7f4('0x3e')],qs[_0xf7f4('0x44')](_0xc55eb6['query'][_0xf7f4('0x44')]));_0x28f196[_0xf7f4('0x43')]=_0x28f196[_0xf7f4('0x43')][_0xf7f4('0x45')]?_0x28f196[_0xf7f4('0x43')]:_0x4897c8[_0xf7f4('0x3e')];if(_0xc55eb6[_0xf7f4('0x3f')]['includeAll']){_0x28f196['include']=[{'all':!![]}];}_0x28f196=_[_0xf7f4('0x4b')]({},_0x28f196,_0xc55eb6['options']);return db[_0xf7f4('0x4e')][_0xf7f4('0x34')](_0x28f196)[_0xf7f4('0x27')](handleEntityNotFound(_0x4f8331,null))[_0xf7f4('0x27')](respondWithResult(_0x4f8331,null))['catch'](handleError(_0x4f8331,null));};exports['create']=function(_0x28f237,_0x462ba4){return db[_0xf7f4('0x4e')][_0xf7f4('0x54')](_0x28f237['body'],{})[_0xf7f4('0x27')](function(_0x32cc2e){var _0x4f3a1e=_0x28f237['user']['get']({'plain':!![]});if(!_0x4f3a1e)throw new Error(_0xf7f4('0x55'));if(_0x4f3a1e['role']===_0xf7f4('0x56')){var _0x4b7b98=_0x32cc2e[_0xf7f4('0x29')]({'plain':!![]});var _0x1a8163=[{'name':_0xf7f4('0x2a'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xf7f4('0x2d')}];var _0x15d88e=_[_0xf7f4('0x34')](_0x1a8163,['value',_0x4b7b98[_0xf7f4('0x33')]])[_0xf7f4('0x35')];return db[_0xf7f4('0x57')][_0xf7f4('0x34')]({'where':{'name':_0x15d88e,'userProfileId':_0x4f3a1e[_0xf7f4('0x58')]},'raw':!![]})['then'](function(_0x406719){if(_0x406719&&_0x406719[_0xf7f4('0x59')]===0x0){return db['UserProfileResource'][_0xf7f4('0x54')]({'name':_0x4b7b98[_0xf7f4('0x35')],'resourceId':_0x4b7b98['id'],'type':_0x406719['name'],'sectionId':_0x406719['id']},{})[_0xf7f4('0x27')](function(){return _0x32cc2e;});}else{return _0x32cc2e;}})[_0xf7f4('0x51')](function(_0x5b7733){logger[_0xf7f4('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7733);throw _0x5b7733;});}return _0x32cc2e;})[_0xf7f4('0x27')](respondWithResult(_0x462ba4,0xc9))['catch'](handleError(_0x462ba4,null));};exports[_0xf7f4('0x5a')]=function(_0x3a7c91,_0x3e9fd1){var _0x292723={'where':{'id':_0x3a7c91[_0xf7f4('0x53')]['id']}},_0x5cf62c={};_0x5cf62c['model']=_[_0xf7f4('0x40')](db[_0xf7f4('0x4e')]['rawAttributes']);_0x292723['attributes']=_[_0xf7f4('0x42')](_0x5cf62c[_0xf7f4('0x3e')],qs[_0xf7f4('0x44')](_0x3a7c91[_0xf7f4('0x3f')]['fields']));_0x292723['attributes']=_0x292723[_0xf7f4('0x43')][_0xf7f4('0x45')]?_0x292723['attributes']:_0x5cf62c['model'];if(_0x3a7c91[_0xf7f4('0x3f')]['includeAll']){_0x292723['include']=[{'all':!![]}];}_0x292723=_['merge']({},_0x292723,_0x3a7c91[_0xf7f4('0x4d')]);return db['VoiceQueue']['find'](_0x292723)['then'](handleEntityNotFound(_0x3e9fd1,null))[_0xf7f4('0x27')](function(_0x589212){if(_0x589212){var _0x1914e9=_0x589212[_0xf7f4('0x29')]({'plain':!![]});_0x1914e9=qs[_0xf7f4('0x5b')](_0x1914e9,['id',_0xf7f4('0x5c'),_0xf7f4('0x5d')]);_0x3a7c91['body']=_['omit'](_0x3a7c91['body'],['id',_0xf7f4('0x5c'),_0xf7f4('0x5d')]);return db[_0xf7f4('0x4e')]['create'](_[_0xf7f4('0x4b')](_0x1914e9,_0x3a7c91[_0xf7f4('0x5e')]),{'include':_0x3a7c91[_0xf7f4('0x3f')][_0xf7f4('0x5f')]?[{'all':!![]}]:undefined})[_0xf7f4('0x27')](function(_0x1f714e){var _0x484d45=_0x3a7c91[_0xf7f4('0x56')][_0xf7f4('0x29')]({'plain':!![]});if(!_0x484d45)throw new Error(_0xf7f4('0x55'));if(_0x484d45[_0xf7f4('0x60')]===_0xf7f4('0x56')){var _0x2c1a4c=_0x1f714e[_0xf7f4('0x29')]({'plain':!![]});var _0x209955=[{'name':_0xf7f4('0x2a'),'value':_0xf7f4('0x2b')},{'name':_0xf7f4('0x2c'),'value':_0xf7f4('0x2d')}];var _0xeefaaa=_[_0xf7f4('0x34')](_0x209955,[_0xf7f4('0x31'),_0x2c1a4c[_0xf7f4('0x33')]])[_0xf7f4('0x35')];return db['UserProfileSection'][_0xf7f4('0x34')]({'where':{'name':_0xeefaaa,'userProfileId':_0x484d45[_0xf7f4('0x58')]},'raw':!![]})[_0xf7f4('0x27')](function(_0x42c14d){if(_0x42c14d&&_0x42c14d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2c1a4c[_0xf7f4('0x35')],'resourceId':_0x2c1a4c['id'],'type':_0x42c14d[_0xf7f4('0x35')],'sectionId':_0x42c14d['id']},{})[_0xf7f4('0x27')](function(){return _0x1f714e;});}else{return _0x1f714e;}})[_0xf7f4('0x51')](function(_0x2a57c4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a57c4);throw _0x2a57c4;});}return _0x1f714e;});}})['then'](respondWithResult(_0x3e9fd1,0xc9))[_0xf7f4('0x51')](handleError(_0x3e9fd1,null));};exports[_0xf7f4('0x26')]=function(_0x1bdb1b,_0x1ee360){if(_0x1bdb1b[_0xf7f4('0x5e')]['id']){delete _0x1bdb1b[_0xf7f4('0x5e')]['id'];}return db[_0xf7f4('0x4e')][_0xf7f4('0x34')]({'where':{'id':_0x1bdb1b[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x1ee360,null))[_0xf7f4('0x27')](saveUpdates(_0x1bdb1b[_0xf7f4('0x5e')],null))[_0xf7f4('0x27')](respondWithResult(_0x1ee360,null))[_0xf7f4('0x51')](handleError(_0x1ee360,null));};exports[_0xf7f4('0x28')]=function(_0x5486a5,_0x1f9d31){return db[_0xf7f4('0x4e')]['find']({'where':{'id':_0x5486a5[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x1f9d31,null))[_0xf7f4('0x27')](removeEntity(_0x1f9d31,null))[_0xf7f4('0x51')](handleError(_0x1f9d31,null));};exports['getHoppers']=function(_0x2843cd,_0x4d3277,_0x39704a){var _0x2e550e={'raw':![],'where':{}};var _0x557baf={};var _0x1a5a81={'count':0x0,'rows':[]};return db[_0xf7f4('0x4e')][_0xf7f4('0x61')]({'where':{'id':_0x2843cd[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x4d3277,null))[_0xf7f4('0x27')](function(_0x1e2566){if(_0x1e2566){_0x557baf[_0xf7f4('0x3e')]=_[_0xf7f4('0x40')](db[_0xf7f4('0x62')][_0xf7f4('0x3b')]);_0x557baf[_0xf7f4('0x3f')]=_[_0xf7f4('0x40')](_0x2843cd[_0xf7f4('0x3f')]);_0x557baf[_0xf7f4('0x41')]=_['intersection'](_0x557baf[_0xf7f4('0x3e')],_0x557baf[_0xf7f4('0x3f')]);_0x2e550e[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x557baf[_0xf7f4('0x3e')],qs['fields'](_0x2843cd[_0xf7f4('0x3f')][_0xf7f4('0x44')]));_0x2e550e[_0xf7f4('0x43')]=_0x2e550e[_0xf7f4('0x43')][_0xf7f4('0x45')]?_0x2e550e[_0xf7f4('0x43')]:_0x557baf[_0xf7f4('0x3e')];if(!_0x2843cd[_0xf7f4('0x3f')][_0xf7f4('0x46')](_0xf7f4('0x63'))){_0x2e550e['limit']=qs['limit'](_0x2843cd[_0xf7f4('0x3f')][_0xf7f4('0x20')]);_0x2e550e['offset']=qs[_0xf7f4('0x1f')](_0x2843cd['query']['offset']);}_0x2e550e['order']=qs['sort'](_0x2843cd[_0xf7f4('0x3f')]['sort']);_0x2e550e[_0xf7f4('0x49')]=qs[_0xf7f4('0x41')](_[_0xf7f4('0x4a')](_0x2843cd[_0xf7f4('0x3f')],_0x557baf[_0xf7f4('0x41')]));_0x2e550e['where']['VoiceQueueId']=_0x1e2566['id'];if(_0x2843cd['query']['filter']){_0x2e550e[_0xf7f4('0x49')]=_['merge'](_0x2e550e[_0xf7f4('0x49')],{'$or':_[_0xf7f4('0x30')](_0x2e550e[_0xf7f4('0x43')],function(_0x27f677){var _0x51c457={};_0x51c457[_0x27f677]={'$like':'%'+_0x2843cd['query']['filter']+'%'};return _0x51c457;})});}_0x2e550e=_[_0xf7f4('0x4b')]({},_0x2e550e,_0x2843cd['options']);return db[_0xf7f4('0x62')][_0xf7f4('0x21')]({'where':_0x2e550e['where']})[_0xf7f4('0x27')](function(_0x4a4e56){_0x1a5a81[_0xf7f4('0x21')]=_0x4a4e56;if(_0x2843cd[_0xf7f4('0x3f')]['includeAll']){_0x2e550e[_0xf7f4('0x4f')]=[{'all':!![]}];}return db[_0xf7f4('0x62')][_0xf7f4('0x50')](_0x2e550e);})['then'](function(_0x55bbcf){_0x1a5a81['rows']=_0x55bbcf;return _0x1a5a81;});}})['then'](respondWithFilteredResult(_0x4d3277,_0x2e550e))['catch'](handleError(_0x4d3277,null));};exports[_0xf7f4('0x64')]=function(_0x1f8ba8,_0x29a22e,_0x1a6331){var _0x2662e6={'raw':!![],'where':{}};var _0x38df4f={};var _0x49b8f6={'count':0x0,'rows':[]};return db[_0xf7f4('0x4e')][_0xf7f4('0x61')]({'where':{'id':_0x1f8ba8[_0xf7f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x29a22e,null))[_0xf7f4('0x27')](function(_0x5514d2){if(_0x5514d2){_0x38df4f['model']=_[_0xf7f4('0x40')](db[_0xf7f4('0x65')][_0xf7f4('0x3b')]);_0x38df4f['query']=_['keys'](_0x1f8ba8[_0xf7f4('0x3f')]);_0x38df4f['filters']=_[_0xf7f4('0x42')](_0x38df4f['model'],_0x38df4f[_0xf7f4('0x3f')]);_0x2662e6[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x38df4f['model'],qs[_0xf7f4('0x44')](_0x1f8ba8['query'][_0xf7f4('0x44')]));_0x2662e6[_0xf7f4('0x43')]=_0x2662e6['attributes'][_0xf7f4('0x45')]?_0x2662e6[_0xf7f4('0x43')]:_0x38df4f['model'];if(!_0x1f8ba8['query'][_0xf7f4('0x46')]('nolimit')){_0x2662e6['limit']=qs['limit'](_0x1f8ba8[_0xf7f4('0x3f')][_0xf7f4('0x20')]);_0x2662e6[_0xf7f4('0x1f')]=qs[_0xf7f4('0x1f')](_0x1f8ba8['query'][_0xf7f4('0x1f')]);}_0x2662e6[_0xf7f4('0x47')]=qs[_0xf7f4('0x48')](_0x1f8ba8[_0xf7f4('0x3f')]['sort']);_0x2662e6['where']=qs['filters'](_[_0xf7f4('0x4a')](_0x1f8ba8['query'],_0x38df4f[_0xf7f4('0x41')]));_0x2662e6[_0xf7f4('0x49')][_0xf7f4('0x66')]=_0x5514d2['id'];if(_0x1f8ba8[_0xf7f4('0x3f')][_0xf7f4('0x2e')]){_0x2662e6[_0xf7f4('0x49')]=_[_0xf7f4('0x4b')](_0x2662e6['where'],{'$or':_[_0xf7f4('0x30')](_0x2662e6[_0xf7f4('0x43')],function(_0x372124){var _0x5014f1={};_0x5014f1[_0x372124]={'$like':'%'+_0x1f8ba8[_0xf7f4('0x3f')]['filter']+'%'};return _0x5014f1;})});}_0x2662e6=_[_0xf7f4('0x4b')]({},_0x2662e6,_0x1f8ba8['options']);return db['CmHopperHistory'][_0xf7f4('0x21')]({'where':_0x2662e6[_0xf7f4('0x49')]})[_0xf7f4('0x27')](function(_0x2de358){_0x49b8f6[_0xf7f4('0x21')]=_0x2de358;if(_0x1f8ba8['query']['includeAll']){_0x2662e6[_0xf7f4('0x4f')]=[{'all':!![]}];}return db[_0xf7f4('0x65')][_0xf7f4('0x50')](_0x2662e6);})['then'](function(_0x21a0d2){_0x49b8f6[_0xf7f4('0x67')]=_0x21a0d2;return _0x49b8f6;});}})[_0xf7f4('0x27')](respondWithFilteredResult(_0x29a22e,_0x2662e6))['catch'](handleError(_0x29a22e,null));};exports[_0xf7f4('0x68')]=function(_0x5b0369,_0x3fd60f,_0x3846ca){var _0x2f23b3={'raw':!![],'where':{}};var _0x4d9fb4={};var _0x3d1bd9={'count':0x0,'rows':[]};return db[_0xf7f4('0x4e')][_0xf7f4('0x61')]({'where':{'id':_0x5b0369[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x3fd60f,null))[_0xf7f4('0x27')](function(_0x346235){if(_0x346235){_0x4d9fb4[_0xf7f4('0x3e')]=_['keys'](db[_0xf7f4('0x69')]['rawAttributes']);_0x4d9fb4[_0xf7f4('0x3f')]=_[_0xf7f4('0x40')](_0x5b0369[_0xf7f4('0x3f')]);_0x4d9fb4[_0xf7f4('0x41')]=_[_0xf7f4('0x42')](_0x4d9fb4['model'],_0x4d9fb4[_0xf7f4('0x3f')]);_0x2f23b3[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x4d9fb4[_0xf7f4('0x3e')],qs['fields'](_0x5b0369[_0xf7f4('0x3f')][_0xf7f4('0x44')]));_0x2f23b3['attributes']=_0x2f23b3[_0xf7f4('0x43')][_0xf7f4('0x45')]?_0x2f23b3[_0xf7f4('0x43')]:_0x4d9fb4['model'];if(!_0x5b0369[_0xf7f4('0x3f')][_0xf7f4('0x46')]('nolimit')){_0x2f23b3[_0xf7f4('0x20')]=qs[_0xf7f4('0x20')](_0x5b0369[_0xf7f4('0x3f')]['limit']);_0x2f23b3[_0xf7f4('0x1f')]=qs['offset'](_0x5b0369[_0xf7f4('0x3f')][_0xf7f4('0x1f')]);}_0x2f23b3[_0xf7f4('0x47')]=qs[_0xf7f4('0x48')](_0x5b0369['query'][_0xf7f4('0x48')]);_0x2f23b3['where']=qs[_0xf7f4('0x41')](_[_0xf7f4('0x4a')](_0x5b0369[_0xf7f4('0x3f')],_0x4d9fb4['filters']));_0x2f23b3[_0xf7f4('0x49')][_0xf7f4('0x66')]=_0x346235['id'];if(_0x5b0369[_0xf7f4('0x3f')][_0xf7f4('0x2e')]){_0x2f23b3[_0xf7f4('0x49')]=_[_0xf7f4('0x4b')](_0x2f23b3[_0xf7f4('0x49')],{'$or':_['map'](_0x2f23b3['attributes'],function(_0x5ce07a){var _0x1c404e={};_0x1c404e[_0x5ce07a]={'$like':'%'+_0x5b0369[_0xf7f4('0x3f')][_0xf7f4('0x2e')]+'%'};return _0x1c404e;})});}_0x2f23b3=_[_0xf7f4('0x4b')]({},_0x2f23b3,_0x5b0369[_0xf7f4('0x4d')]);return db[_0xf7f4('0x69')][_0xf7f4('0x21')]({'where':_0x2f23b3[_0xf7f4('0x49')]})['then'](function(_0x2ec30a){_0x3d1bd9[_0xf7f4('0x21')]=_0x2ec30a;if(_0x5b0369[_0xf7f4('0x3f')][_0xf7f4('0x5f')]){_0x2f23b3[_0xf7f4('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xf7f4('0x50')](_0x2f23b3);})[_0xf7f4('0x27')](function(_0x1e9a85){_0x3d1bd9[_0xf7f4('0x67')]=_0x1e9a85;return _0x3d1bd9;});}})['then'](respondWithFilteredResult(_0x3fd60f,_0x2f23b3))['catch'](handleError(_0x3fd60f,null));};exports[_0xf7f4('0x6a')]=function(_0xcf77e9,_0x7c5459,_0x5dde17){var _0x416d66={'raw':!![],'where':{}};var _0x8d40f4={};var _0x57a6a7={'count':0x0,'rows':[]};return db[_0xf7f4('0x4e')][_0xf7f4('0x61')]({'where':{'id':_0xcf77e9[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x7c5459,null))[_0xf7f4('0x27')](function(_0x3589a6){if(_0x3589a6){_0x8d40f4[_0xf7f4('0x3e')]=_[_0xf7f4('0x40')](db[_0xf7f4('0x6b')][_0xf7f4('0x3b')]);_0x8d40f4[_0xf7f4('0x3f')]=_['keys'](_0xcf77e9[_0xf7f4('0x3f')]);_0x8d40f4[_0xf7f4('0x41')]=_[_0xf7f4('0x42')](_0x8d40f4[_0xf7f4('0x3e')],_0x8d40f4['query']);_0x416d66[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x8d40f4[_0xf7f4('0x3e')],qs[_0xf7f4('0x44')](_0xcf77e9[_0xf7f4('0x3f')][_0xf7f4('0x44')]));_0x416d66['attributes']=_0x416d66[_0xf7f4('0x43')][_0xf7f4('0x45')]?_0x416d66[_0xf7f4('0x43')]:_0x8d40f4[_0xf7f4('0x3e')];if(!_0xcf77e9[_0xf7f4('0x3f')]['hasOwnProperty'](_0xf7f4('0x63'))){_0x416d66[_0xf7f4('0x20')]=qs['limit'](_0xcf77e9[_0xf7f4('0x3f')][_0xf7f4('0x20')]);_0x416d66[_0xf7f4('0x1f')]=qs[_0xf7f4('0x1f')](_0xcf77e9['query'][_0xf7f4('0x1f')]);}_0x416d66[_0xf7f4('0x47')]=qs[_0xf7f4('0x48')](_0xcf77e9[_0xf7f4('0x3f')][_0xf7f4('0x48')]);_0x416d66[_0xf7f4('0x49')]=qs[_0xf7f4('0x41')](_[_0xf7f4('0x4a')](_0xcf77e9['query'],_0x8d40f4[_0xf7f4('0x41')]));_0x416d66[_0xf7f4('0x49')][_0xf7f4('0x66')]=_0x3589a6['id'];if(_0xcf77e9[_0xf7f4('0x3f')]['filter']){_0x416d66[_0xf7f4('0x49')]=_['merge'](_0x416d66[_0xf7f4('0x49')],{'$or':_['map'](_0x416d66['attributes'],function(_0x23978b){var _0x36966e={};_0x36966e[_0x23978b]={'$like':'%'+_0xcf77e9[_0xf7f4('0x3f')]['filter']+'%'};return _0x36966e;})});}_0x416d66=_['merge']({},_0x416d66,_0xcf77e9[_0xf7f4('0x4d')]);return db[_0xf7f4('0x6b')][_0xf7f4('0x21')]({'where':_0x416d66['where']})['then'](function(_0xf121){_0x57a6a7['count']=_0xf121;if(_0xcf77e9[_0xf7f4('0x3f')][_0xf7f4('0x5f')]){_0x416d66[_0xf7f4('0x4f')]=[{'all':!![]}];}return db[_0xf7f4('0x6b')][_0xf7f4('0x50')](_0x416d66);})['then'](function(_0x721715){_0x57a6a7[_0xf7f4('0x67')]=_0x721715;return _0x57a6a7;});}})['then'](respondWithFilteredResult(_0x7c5459,_0x416d66))['catch'](handleError(_0x7c5459,null));};exports[_0xf7f4('0x6c')]=function(_0x347e37,_0x492b13,_0x5ee43f){var _0x38f1d9={};var _0x41d02e={};var _0x5cc65b;var _0x15fa4f;return db['VoiceQueue'][_0xf7f4('0x61')]({'where':{'id':_0x347e37[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x492b13,null))[_0xf7f4('0x27')](function(_0x4a21da){if(_0x4a21da){_0x5cc65b=_0x4a21da;_0x41d02e['model']=_[_0xf7f4('0x40')](db[_0xf7f4('0x6d')][_0xf7f4('0x3b')]);_0x41d02e[_0xf7f4('0x3f')]=_[_0xf7f4('0x40')](_0x347e37[_0xf7f4('0x3f')]);_0x41d02e['filters']=_['intersection'](_0x41d02e[_0xf7f4('0x3e')],_0x41d02e['query']);_0x38f1d9[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x41d02e[_0xf7f4('0x3e')],qs['fields'](_0x347e37[_0xf7f4('0x3f')]['fields']));_0x38f1d9[_0xf7f4('0x43')]=_0x38f1d9['attributes'][_0xf7f4('0x45')]?_0x38f1d9[_0xf7f4('0x43')]:_0x41d02e['model'];_0x38f1d9[_0xf7f4('0x47')]=qs[_0xf7f4('0x48')](_0x347e37[_0xf7f4('0x3f')][_0xf7f4('0x48')]);_0x38f1d9['where']=qs[_0xf7f4('0x41')](_['pick'](_0x347e37[_0xf7f4('0x3f')],_0x41d02e[_0xf7f4('0x41')]));if(_0x347e37['query'][_0xf7f4('0x2e')]){_0x38f1d9['where']=_[_0xf7f4('0x4b')](_0x38f1d9[_0xf7f4('0x49')],{'$or':_[_0xf7f4('0x30')](_0x38f1d9[_0xf7f4('0x43')],function(_0x51fecb){var _0x4b918b={};_0x4b918b[_0x51fecb]={'$like':'%'+_0x347e37[_0xf7f4('0x3f')][_0xf7f4('0x2e')]+'%'};return _0x4b918b;})});}_0x38f1d9=_[_0xf7f4('0x4b')]({},_0x38f1d9,_0x347e37[_0xf7f4('0x4d')]);return _0x5cc65b[_0xf7f4('0x6c')](_0x38f1d9);}})[_0xf7f4('0x27')](function(_0x4408e8){if(_0x4408e8){_0x15fa4f=_0x4408e8[_0xf7f4('0x45')];if(!_0x347e37[_0xf7f4('0x3f')]['hasOwnProperty'](_0xf7f4('0x63'))){_0x38f1d9[_0xf7f4('0x20')]=qs['limit'](_0x347e37[_0xf7f4('0x3f')]['limit']);_0x38f1d9['offset']=qs['offset'](_0x347e37[_0xf7f4('0x3f')][_0xf7f4('0x1f')]);}return _0x5cc65b[_0xf7f4('0x6c')](_0x38f1d9);}})[_0xf7f4('0x27')](function(_0x128e80){if(_0x128e80){return _0x128e80?{'count':_0x15fa4f,'rows':_0x128e80}:null;}})[_0xf7f4('0x27')](respondWithResult(_0x492b13,null))[_0xf7f4('0x51')](handleError(_0x492b13,null));};exports[_0xf7f4('0x6e')]=function(_0x244fe6,_0x1d140e,_0x286128){var _0x43ff2d=_0x244fe6[_0xf7f4('0x5e')][_0xf7f4('0x6f')];var _0x508a92=_[_0xf7f4('0x30')](_0x43ff2d,'id');return db[_0xf7f4('0x6d')][_0xf7f4('0x50')]({'where':{'id':_0x508a92},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf7f4('0x70'),'attributes':['id',_0xf7f4('0x35'),_0xf7f4('0x71'),'voicePause',_0xf7f4('0x72')],'raw':!![]}]})[_0xf7f4('0x27')](function(_0x6cf6a8){if(_0x6cf6a8){var _0x5d349b=_[_0xf7f4('0x73')](_0x6cf6a8,function(_0x2c6a1e){var _0x143ec0=_0x2c6a1e[_0xf7f4('0x29')]({'plain':!![]});_0x143ec0['Agents'][_0xf7f4('0x74')](function(_0x229300){_0x229300[_0xf7f4('0x75')]=_[_0xf7f4('0x34')](_0x43ff2d,{'id':_0x143ec0['id']})[_0xf7f4('0x75')];});return _0x143ec0[_0xf7f4('0x70')];});return db['VoiceQueue'][_0xf7f4('0x34')]({'where':{'id':_0x244fe6[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](function(_0x2e6a27){return db[_0xf7f4('0x76')][_0xf7f4('0x77')](function(_0x29f058){return _0x2e6a27[_0xf7f4('0x6e')](_0x508a92,{'transaction':_0x29f058})['then'](function(){return BPromise[_0xf7f4('0x78')](_0x43ff2d,function(_0x3765f8){return db['TeamVoiceQueue'][_0xf7f4('0x79')]({'TeamId':_0x3765f8['id'],'VoiceQueueId':_0x244fe6[_0xf7f4('0x53')]['id'],'penalty':_0x3765f8[_0xf7f4('0x75')]},{'transaction':_0x29f058});});})[_0xf7f4('0x27')](function(){return BPromise[_0xf7f4('0x78')](_0x5d349b,function(_0x43d968){return db[_0xf7f4('0x7a')][_0xf7f4('0x7b')]({'where':{'UserId':_0x43d968['id'],'VoiceQueueId':_0x244fe6[_0xf7f4('0x53')]['id']},'defaults':{'penalty':_0x43d968['penalty']},'transaction':_0x29f058});});})['then'](function(){return BPromise[_0xf7f4('0x78')](_[_0xf7f4('0x2e')](_0x5d349b,{'online':!![]}),function(_0x33695b){return db['UserVoiceQueueRt'][_0xf7f4('0x79')]({'membername':_0x33695b['name'],'UserId':_0x33695b['id'],'queue_name':_0x2e6a27['name'],'VoiceQueueId':_0x2e6a27['id'],'interface':_[_0xf7f4('0x7c')](_0x33695b[_0xf7f4('0x72')])?util[_0xf7f4('0x7d')](_0xf7f4('0x7e'),_0x33695b[_0xf7f4('0x35')]):_0x33695b[_0xf7f4('0x72')],'paused':_0x33695b['voicePause']||![],'penalty':_0x33695b['penalty']},{'transaction':_0x29f058});});})['then'](function(){_0x5d349b['forEach'](function(_0x45a074){socket[_0xf7f4('0x7f')](_0xf7f4('0x80'),{'UserId':_0x45a074['id'],'VoiceQueueId':_0x2e6a27['id']});});});});});}})[_0xf7f4('0x27')](respondWithStatusCode(_0x1d140e,null))[_0xf7f4('0x51')](handleError(_0x1d140e,null));};exports[_0xf7f4('0x81')]=function(_0x2932f0,_0x24d022,_0x32f472){return db['Team'][_0xf7f4('0x50')]({'where':{'id':_0x2932f0[_0xf7f4('0x3f')][_0xf7f4('0x82')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf7f4('0x70'),'attributes':['id'],'raw':!![]}]})[_0xf7f4('0x27')](handleEntityNotFound(_0x24d022,null))[_0xf7f4('0x27')](function(_0x5715f1){var _0x1c3fc6=_[_0xf7f4('0x30')](_0x5715f1,'id');var _0x38cb75=[];var _0x164588=[];var _0x3ea116=squel['select']();_0x3ea116['field'](_0xf7f4('0x83'))[_0xf7f4('0x84')](_0xf7f4('0x85'),'tq')['join'](_0xf7f4('0x86'),'ut',_0xf7f4('0x87'))['where'](_0xf7f4('0x88'),_0x2932f0[_0xf7f4('0x53')]['id']);for(var _0x198993=0x0;_0x198993<_0x5715f1[_0xf7f4('0x45')];_0x198993+=0x1){let _0x2ace49=_0x5715f1[_0x198993];for(var _0x4abc74=0x0;_0x4abc74<_0x2ace49[_0xf7f4('0x70')][_0xf7f4('0x45')];_0x4abc74+=0x1){let _0x23b770=_0x2ace49[_0xf7f4('0x70')][_0x4abc74];var _0x2398aa=_0x3ea116[_0xf7f4('0x5a')]();_0x2398aa[_0xf7f4('0x49')]('ut.UserId\x20=\x20?',_0x23b770['id']);_0x164588[_0xf7f4('0x89')](db[_0xf7f4('0x76')][_0xf7f4('0x3f')](_0x2398aa['toString'](),{'type':db[_0xf7f4('0x76')][_0xf7f4('0x8a')][_0xf7f4('0x8b')]})[_0xf7f4('0x27')](function(_0xc21036){if(_0xc21036[_0xf7f4('0x45')]===0x1){return _0x23b770['id'];}else{var _0x5c9ac8=_['every'](_[_0xf7f4('0x30')](_0xc21036,_0xf7f4('0x8c')),function(_0x4dbb20){return _['includes'](_0x1c3fc6,_0x4dbb20);});if(_0x5c9ac8){return _0x23b770['id'];}}}));}}return BPromise[_0xf7f4('0x8d')](_0x164588)[_0xf7f4('0x27')](function(_0x53cb4d){_0x38cb75=_(_0x38cb75)[_0xf7f4('0x8e')](_0x53cb4d)[_0xf7f4('0x8f')]()[_0xf7f4('0x31')]();return db['VoiceQueue']['find']({'where':{'id':_0x2932f0[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](function(_0x217659){return db['sequelize'][_0xf7f4('0x77')](function(_0x363bc1){return _0x217659[_0xf7f4('0x81')](_0x2932f0[_0xf7f4('0x3f')]['ids'],{'transaction':_0x363bc1})[_0xf7f4('0x27')](function(){if(!_['isEmpty'](_0x38cb75)){return _0x217659['removeAgents'](_0x38cb75,{'transaction':_0x363bc1})[_0xf7f4('0x27')](function(){return db[_0xf7f4('0x90')][_0xf7f4('0x28')]({'where':{'VoiceQueueId':_0x2932f0[_0xf7f4('0x53')]['id'],'UserId':_0x38cb75},'transaction':_0x363bc1});});}})['then'](function(){_0x38cb75[_0xf7f4('0x74')](function(_0x15d0e5){socket[_0xf7f4('0x7f')](_0xf7f4('0x91'),{'UserId':_0x15d0e5,'VoiceQueueId':_0x217659['id']});});});});});});})['then'](respondWithStatusCode(_0x24d022,null))[_0xf7f4('0x51')](handleError(_0x24d022,null));};exports[_0xf7f4('0x92')]=function(_0x111e82,_0x40d518,_0x4fc7ce){var _0xae52c3,_0x2951f8;return db[_0xf7f4('0x4e')][_0xf7f4('0x34')]({'where':{'id':_0x111e82[_0xf7f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x40d518,null))['then'](function(_0x11927f){if(_0x11927f){_0x2951f8=_0x11927f;return _0x11927f[_0xf7f4('0x92')](_0x111e82['body'][_0xf7f4('0x82')],_[_0xf7f4('0x5b')](_0x111e82['body'],['ids','id'])||{})[_0xf7f4('0x93')](function(_0x3e7381){for(var _0x40656a=0x0;_0x40656a<_0x111e82[_0xf7f4('0x5e')]['ids'][_0xf7f4('0x45')];_0x40656a+=0x1){socket[_0xf7f4('0x7f')](_0xf7f4('0x80'),{'UserId':_0x111e82[_0xf7f4('0x5e')][_0xf7f4('0x82')][_0x40656a],'VoiceQueueId':_0x111e82[_0xf7f4('0x53')]['id']});}return _0x3e7381;});}})['then'](function(_0x1c867a){_0xae52c3=_0x1c867a||[];if(_0x2951f8){return db[_0xf7f4('0x94')][_0xf7f4('0x50')]({'where':{'id':_0x111e82[_0xf7f4('0x5e')][_0xf7f4('0x82')]},'attributes':['id','name',_0xf7f4('0x71'),_0xf7f4('0x95'),_0xf7f4('0x72')],'raw':!![]});}})[_0xf7f4('0x27')](function(_0x4c3e3d){if(!_[_0xf7f4('0x96')](_0x4c3e3d)){var _0x49190b=[];for(var _0x2e1a6e=0x0;_0x2e1a6e<_0x4c3e3d[_0xf7f4('0x45')];_0x2e1a6e++){if(_0x4c3e3d[_0x2e1a6e]['online']){_0x49190b[_0xf7f4('0x89')](db[_0xf7f4('0x90')][_0xf7f4('0x79')]({'membername':_0x4c3e3d[_0x2e1a6e]['name'],'UserId':_0x4c3e3d[_0x2e1a6e]['id'],'queue_name':_0x2951f8['name'],'VoiceQueueId':_0x2951f8['id'],'interface':_['isNil'](_0x4c3e3d[_0x2e1a6e][_0xf7f4('0x72')])?util[_0xf7f4('0x7d')]('SIP/%s',_0x4c3e3d[_0x2e1a6e][_0xf7f4('0x35')]):_0x4c3e3d[_0x2e1a6e][_0xf7f4('0x72')],'paused':_0x4c3e3d[_0x2e1a6e][_0xf7f4('0x95')]||![],'penalty':_0x111e82[_0xf7f4('0x5e')][_0xf7f4('0x75')]||0x0}));}}return BPromise[_0xf7f4('0x8d')](_0x49190b);}})['then'](function(){return _0xae52c3;})['then'](respondWithResult(_0x40d518,null))[_0xf7f4('0x51')](handleError(_0x40d518,null));};exports[_0xf7f4('0x97')]=function(_0x3c7a75,_0xf0cf62,_0x27859b){return db[_0xf7f4('0x4e')]['find']({'where':{'id':_0x3c7a75[_0xf7f4('0x53')]['id']}})['then'](handleEntityNotFound(_0xf0cf62,null))[_0xf7f4('0x27')](function(_0x2fee0d){if(_0x2fee0d){return _0x2fee0d[_0xf7f4('0x97')](_0x3c7a75[_0xf7f4('0x3f')][_0xf7f4('0x82')])[_0xf7f4('0x27')](function(){if(_[_0xf7f4('0x98')](_0x3c7a75[_0xf7f4('0x3f')][_0xf7f4('0x82')])){for(var _0x1f86ad=0x0;_0x1f86ad<_0x3c7a75[_0xf7f4('0x3f')]['ids']['length'];_0x1f86ad+=0x1){socket[_0xf7f4('0x7f')](_0xf7f4('0x91'),{'UserId':Number(_0x3c7a75[_0xf7f4('0x3f')][_0xf7f4('0x82')][_0x1f86ad]),'VoiceQueueId':Number(_0x3c7a75[_0xf7f4('0x53')]['id'])});}}else{socket['emit'](_0xf7f4('0x91'),{'UserId':Number(_0x3c7a75[_0xf7f4('0x3f')][_0xf7f4('0x82')]),'VoiceQueueId':Number(_0x3c7a75[_0xf7f4('0x53')]['id'])});}});}})[_0xf7f4('0x27')](function(_0x513c52){return db[_0xf7f4('0x90')][_0xf7f4('0x28')]({'where':{'VoiceQueueId':_0x3c7a75[_0xf7f4('0x53')]['id'],'UserId':_0x3c7a75['query'][_0xf7f4('0x82')]}})[_0xf7f4('0x27')](function(){return _0x513c52;});})[_0xf7f4('0x27')](respondWithStatusCode(_0xf0cf62,null))['catch'](handleError(_0xf0cf62,null));};exports[_0xf7f4('0x99')]=function(_0x5d428c,_0x40bdfd,_0x133d0b){var _0x3d53c2={};var _0x1cb0dd={};var _0x36a381;var _0x491cb4;return db[_0xf7f4('0x4e')][_0xf7f4('0x61')]({'where':{'id':_0x5d428c[_0xf7f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x40bdfd,null))[_0xf7f4('0x27')](function(_0x3a0d19){if(_0x3a0d19){_0x36a381=_0x3a0d19;_0x1cb0dd['model']=_['keys'](db[_0xf7f4('0x94')][_0xf7f4('0x3b')]);_0x1cb0dd[_0xf7f4('0x3f')]=_[_0xf7f4('0x40')](_0x5d428c['query']);_0x1cb0dd[_0xf7f4('0x41')]=_['intersection'](_0x1cb0dd['model'],_0x1cb0dd['query']);_0x3d53c2['attributes']=_[_0xf7f4('0x42')](_0x1cb0dd[_0xf7f4('0x3e')],qs[_0xf7f4('0x44')](_0x5d428c[_0xf7f4('0x3f')][_0xf7f4('0x44')]));_0x3d53c2[_0xf7f4('0x43')]=_0x3d53c2['attributes'][_0xf7f4('0x45')]?_0x3d53c2[_0xf7f4('0x43')]:_0x1cb0dd['model'];_0x3d53c2[_0xf7f4('0x47')]=qs[_0xf7f4('0x48')](_0x5d428c[_0xf7f4('0x3f')][_0xf7f4('0x48')]);_0x3d53c2['where']=qs[_0xf7f4('0x41')](_['pick'](_0x5d428c[_0xf7f4('0x3f')],_0x1cb0dd[_0xf7f4('0x41')]));if(_0x5d428c['query'][_0xf7f4('0x2e')]){_0x3d53c2[_0xf7f4('0x49')]=_[_0xf7f4('0x4b')](_0x3d53c2[_0xf7f4('0x49')],{'$or':_['map'](_0x3d53c2[_0xf7f4('0x43')],function(_0x108795){var _0x481aa1={};_0x481aa1[_0x108795]={'$like':'%'+_0x5d428c[_0xf7f4('0x3f')][_0xf7f4('0x2e')]+'%'};return _0x481aa1;})});}_0x3d53c2=_[_0xf7f4('0x4b')]({},_0x3d53c2,_0x5d428c['options']);return _0x36a381[_0xf7f4('0x99')](_0x3d53c2);}})[_0xf7f4('0x27')](function(_0x123c76){if(_0x123c76){_0x491cb4=_0x123c76[_0xf7f4('0x45')];if(!_0x5d428c[_0xf7f4('0x3f')]['hasOwnProperty'](_0xf7f4('0x63'))){_0x3d53c2[_0xf7f4('0x20')]=qs[_0xf7f4('0x20')](_0x5d428c[_0xf7f4('0x3f')][_0xf7f4('0x20')]);_0x3d53c2[_0xf7f4('0x1f')]=qs['offset'](_0x5d428c[_0xf7f4('0x3f')][_0xf7f4('0x1f')]);}return _0x36a381[_0xf7f4('0x99')](_0x3d53c2);}})['then'](function(_0x1dad09){if(_0x1dad09){return _0x1dad09?{'count':_0x491cb4,'rows':_0x1dad09}:null;}})[_0xf7f4('0x27')](respondWithResult(_0x40bdfd,null))['catch'](handleError(_0x40bdfd,null));};exports['getMembers']=function(_0x34f495,_0x471e77,_0x4ac581){var _0x10cb4a={};var _0x35ee7e={};var _0x412d7e;var _0x3a125d;return db[_0xf7f4('0x4e')][_0xf7f4('0x61')]({'where':{'id':_0x34f495[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x471e77,null))[_0xf7f4('0x27')](function(_0x29355d){if(_0x29355d){_0x412d7e=_0x29355d;_0x35ee7e[_0xf7f4('0x3e')]=_[_0xf7f4('0x40')](db['UserVoiceQueueRt'][_0xf7f4('0x3b')]);_0x35ee7e[_0xf7f4('0x3f')]=_[_0xf7f4('0x40')](_0x34f495[_0xf7f4('0x3f')]);_0x35ee7e[_0xf7f4('0x41')]=_[_0xf7f4('0x42')](_0x35ee7e['model'],_0x35ee7e[_0xf7f4('0x3f')]);_0x10cb4a[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x35ee7e[_0xf7f4('0x3e')],qs[_0xf7f4('0x44')](_0x34f495[_0xf7f4('0x3f')][_0xf7f4('0x44')]));_0x10cb4a[_0xf7f4('0x43')]=_0x10cb4a[_0xf7f4('0x43')][_0xf7f4('0x45')]?_0x10cb4a[_0xf7f4('0x43')]:_0x35ee7e[_0xf7f4('0x3e')];_0x10cb4a[_0xf7f4('0x47')]=qs[_0xf7f4('0x48')](_0x34f495[_0xf7f4('0x3f')][_0xf7f4('0x48')]);_0x10cb4a[_0xf7f4('0x49')]=qs[_0xf7f4('0x41')](_['pick'](_0x34f495[_0xf7f4('0x3f')],_0x35ee7e[_0xf7f4('0x41')]));if(_0x34f495[_0xf7f4('0x3f')][_0xf7f4('0x2e')]){_0x10cb4a[_0xf7f4('0x49')]=_['merge'](_0x10cb4a[_0xf7f4('0x49')],{'$or':_[_0xf7f4('0x30')](_0x10cb4a['attributes'],function(_0x486013){var _0x5a4a69={};_0x5a4a69[_0x486013]={'$like':'%'+_0x34f495['query'][_0xf7f4('0x2e')]+'%'};return _0x5a4a69;})});}_0x10cb4a=_['merge']({},_0x10cb4a,_0x34f495['options']);return _0x412d7e[_0xf7f4('0x9a')](_0x10cb4a);}})['then'](function(_0x27a3ab){if(_0x27a3ab){_0x3a125d=_0x27a3ab[_0xf7f4('0x45')];if(!_0x34f495['query'][_0xf7f4('0x46')](_0xf7f4('0x63'))){_0x10cb4a[_0xf7f4('0x20')]=qs[_0xf7f4('0x20')](_0x34f495[_0xf7f4('0x3f')][_0xf7f4('0x20')]);_0x10cb4a[_0xf7f4('0x1f')]=qs[_0xf7f4('0x1f')](_0x34f495[_0xf7f4('0x3f')]['offset']);}return _0x412d7e[_0xf7f4('0x9a')](_0x10cb4a);}})[_0xf7f4('0x27')](function(_0x49b2e6){return _0x49b2e6?{'count':_0x3a125d,'rows':_0x49b2e6}:null;})[_0xf7f4('0x27')](respondWithResult(_0x471e77,null))[_0xf7f4('0x51')](handleError(_0x471e77,null));};exports[_0xf7f4('0x9b')]=function(_0x42fe88,_0x5455ec,_0x2c431b){var _0x598798={};var _0x392c0a={};var _0x39ab91;var _0x3d3f59;return db['VoiceQueue'][_0xf7f4('0x61')]({'where':{'id':_0x42fe88['params']['id']}})['then'](handleEntityNotFound(_0x5455ec,null))['then'](function(_0x44467){if(_0x44467){_0x39ab91=_0x44467;_0x392c0a['model']=_[_0xf7f4('0x40')](db[_0xf7f4('0x9c')]['rawAttributes']);_0x392c0a['query']=_[_0xf7f4('0x40')](_0x42fe88[_0xf7f4('0x3f')]);_0x392c0a[_0xf7f4('0x41')]=_[_0xf7f4('0x42')](_0x392c0a[_0xf7f4('0x3e')],_0x392c0a['query']);_0x598798[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x392c0a[_0xf7f4('0x3e')],qs[_0xf7f4('0x44')](_0x42fe88[_0xf7f4('0x3f')][_0xf7f4('0x44')]));_0x598798[_0xf7f4('0x43')]=_0x598798['attributes'][_0xf7f4('0x45')]?_0x598798['attributes']:_0x392c0a[_0xf7f4('0x3e')];_0x598798[_0xf7f4('0x47')]=qs['sort'](_0x42fe88[_0xf7f4('0x3f')][_0xf7f4('0x48')]);_0x598798[_0xf7f4('0x49')]=qs[_0xf7f4('0x41')](_[_0xf7f4('0x4a')](_0x42fe88[_0xf7f4('0x3f')],_0x392c0a[_0xf7f4('0x41')]));if(_0x42fe88['query']['filter']){_0x598798['where']=_['merge'](_0x598798['where'],{'$or':_[_0xf7f4('0x30')](_0x598798[_0xf7f4('0x43')],function(_0x2b7bfb){var _0x2584e9={};_0x2584e9[_0x2b7bfb]={'$like':'%'+_0x42fe88[_0xf7f4('0x3f')][_0xf7f4('0x2e')]+'%'};return _0x2584e9;})});}_0x598798=_[_0xf7f4('0x4b')]({},_0x598798,_0x42fe88[_0xf7f4('0x4d')]);return _0x39ab91[_0xf7f4('0x9b')](_0x598798);}})[_0xf7f4('0x27')](function(_0x5267e2){if(_0x5267e2){_0x3d3f59=_0x5267e2[_0xf7f4('0x45')];if(!_0x42fe88['query'][_0xf7f4('0x46')]('nolimit')){_0x598798[_0xf7f4('0x20')]=qs[_0xf7f4('0x20')](_0x42fe88[_0xf7f4('0x3f')][_0xf7f4('0x20')]);_0x598798[_0xf7f4('0x1f')]=qs['offset'](_0x42fe88['query'][_0xf7f4('0x1f')]);}return _0x39ab91[_0xf7f4('0x9b')](_0x598798);}})['then'](function(_0x1bfb2e){if(_0x1bfb2e){return _0x1bfb2e?{'count':_0x3d3f59,'rows':_0x1bfb2e}:null;}})[_0xf7f4('0x27')](respondWithResult(_0x5455ec,null))['catch'](handleError(_0x5455ec,null));};exports['addLists']=function(_0x5b6c1f,_0x5e9a46,_0x19635e){var _0x3e52d7,_0x5dbbde;var _0x5edbcc=[];var _0x254800=moment()[_0xf7f4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xf7f4('0x4e')][_0xf7f4('0x34')]({'where':{'id':_0x5b6c1f['params']['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x5e9a46,null))[_0xf7f4('0x27')](function(_0x335e77){if(_0x335e77){_0x5dbbde=_0x335e77;return _0x335e77[_0xf7f4('0x9d')](_0x5b6c1f[_0xf7f4('0x5e')]['ids'],_['omit'](_0x5b6c1f[_0xf7f4('0x5e')],[_0xf7f4('0x82'),'id'])||{});}return null;})[_0xf7f4('0x93')](function(_0x42e33e){var _0x11be77;var _0x11b937;_0x3e52d7=_0x42e33e||[];var _0x56e907=[];if(_0x42e33e){for(var _0x106e80=0x0;_0x106e80<_0x42e33e[_0xf7f4('0x45')];_0x106e80+=0x1){var _0x36c04a=_0x42e33e[_0x106e80][_0xf7f4('0x29')]({'plain':!![]});_0x5dbbde[_0xf7f4('0x9e')]=_0x5b6c1f[_0xf7f4('0x5e')][_0xf7f4('0x9e')]?_0x5b6c1f[_0xf7f4('0x5e')][_0xf7f4('0x9e')]:_0x5dbbde['dialCheckDuplicateType'];switch(_0x5dbbde[_0xf7f4('0x9e')]){case _0xf7f4('0x9f'):_0x11be77=squel[_0xf7f4('0xa0')]()[_0xf7f4('0xa1')]('cm_hopper')[_0xf7f4('0xa2')]([_0xf7f4('0xa3'),_0xf7f4('0xa4'),_0xf7f4('0xa5'),'ListId',_0xf7f4('0x66'),_0xf7f4('0x5c'),_0xf7f4('0x5d')],squel['select']()['field'](_0xf7f4('0xa3'),_0xf7f4('0xa3'))[_0xf7f4('0xa6')]('NOW()',_0xf7f4('0xa4'))[_0xf7f4('0xa6')]('id','ContactId')['field'](_0x36c04a[_0xf7f4('0xa7')][_0xf7f4('0xa8')](),_0xf7f4('0xa9'))[_0xf7f4('0xa6')](_0x5b6c1f['params']['id'][_0xf7f4('0xa8')](),_0xf7f4('0x66'))[_0xf7f4('0xa6')]('\x27'+_0x254800+'\x27',_0xf7f4('0x5c'))['field']('\x27'+_0x254800+'\x27',_0xf7f4('0x5d'))[_0xf7f4('0x84')](_0xf7f4('0xaa'))[_0xf7f4('0x49')]('deletedAt\x20IS\x20NULL')[_0xf7f4('0x49')]('ListId\x20=\x20?',_0x36c04a[_0xf7f4('0xa7')]['toString']())['where'](_0xf7f4('0xab'))[_0xf7f4('0x49')](_0xf7f4('0xac'),squel[_0xf7f4('0xad')]()[_0xf7f4('0xa6')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0xf7f4('0x49')](_0xf7f4('0x88'),_0x5b6c1f[_0xf7f4('0x53')]['id'][_0xf7f4('0xa8')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xf7f4('0xad')]()[_0xf7f4('0xa6')](_0xf7f4('0xae'))[_0xf7f4('0x84')](_0xf7f4('0xaf'))[_0xf7f4('0x49')](_0xf7f4('0x88'),_0x5b6c1f[_0xf7f4('0x53')]['id']['toString']())))['toString']();break;case _0xf7f4('0xb0'):_0x11be77=squel[_0xf7f4('0xa0')]()[_0xf7f4('0xa1')](_0xf7f4('0xaf'))[_0xf7f4('0xa2')]([_0xf7f4('0xa3'),_0xf7f4('0xa4'),'ContactId',_0xf7f4('0xa9'),'VoiceQueueId',_0xf7f4('0x5c'),_0xf7f4('0x5d')],squel[_0xf7f4('0xad')]()[_0xf7f4('0xa6')]('phone',_0xf7f4('0xa3'))[_0xf7f4('0xa6')](_0xf7f4('0xb1'),_0xf7f4('0xa4'))[_0xf7f4('0xa6')]('id','ContactId')[_0xf7f4('0xa6')](_0x36c04a[_0xf7f4('0xa7')][_0xf7f4('0xa8')](),_0xf7f4('0xa9'))[_0xf7f4('0xa6')](_0x5b6c1f['params']['id'][_0xf7f4('0xa8')](),'VoiceQueueId')[_0xf7f4('0xa6')]('\x27'+_0x254800+'\x27',_0xf7f4('0x5c'))[_0xf7f4('0xa6')]('\x27'+_0x254800+'\x27',_0xf7f4('0x5d'))[_0xf7f4('0x84')]('cm_contacts')[_0xf7f4('0x49')]('deletedAt\x20IS\x20NULL')[_0xf7f4('0x49')](_0xf7f4('0xb2'),_0x36c04a[_0xf7f4('0xa7')][_0xf7f4('0xa8')]())['where'](_0xf7f4('0xab'))['where'](_0xf7f4('0xac'),squel[_0xf7f4('0xad')]()['field']('COALESCE(phone,\x27\x27)')[_0xf7f4('0x84')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x5b6c1f[_0xf7f4('0x53')]['id'][_0xf7f4('0xa8')]())))[_0xf7f4('0xa8')]();break;default:_0x11be77=squel[_0xf7f4('0xa0')]()['into'](_0xf7f4('0xaf'))['fromQuery'](['phone','scheduledAt',_0xf7f4('0xa5'),_0xf7f4('0xa9'),'VoiceQueueId',_0xf7f4('0x5c'),_0xf7f4('0x5d')],squel[_0xf7f4('0xad')]()['field'](_0xf7f4('0xa3'),'phone')[_0xf7f4('0xa6')](_0xf7f4('0xb1'),_0xf7f4('0xa4'))['field']('id',_0xf7f4('0xa5'))['field'](_0x36c04a[_0xf7f4('0xa7')][_0xf7f4('0xa8')](),_0xf7f4('0xa9'))[_0xf7f4('0xa6')](_0x5b6c1f[_0xf7f4('0x53')]['id'][_0xf7f4('0xa8')](),_0xf7f4('0x66'))[_0xf7f4('0xa6')]('\x27'+_0x254800+'\x27',_0xf7f4('0x5c'))[_0xf7f4('0xa6')]('\x27'+_0x254800+'\x27',_0xf7f4('0x5d'))['from'](_0xf7f4('0xaa'))[_0xf7f4('0x49')]('deletedAt\x20IS\x20NULL')[_0xf7f4('0x49')](_0xf7f4('0xb2'),_0x36c04a['CmListId'][_0xf7f4('0xa8')]())[_0xf7f4('0x49')](_0xf7f4('0xab')))[_0xf7f4('0xa8')]();}_0x11b937=squel['insert']()[_0xf7f4('0xa1')]('cm_hopper_additional_phones')[_0xf7f4('0xa2')]([_0xf7f4('0xb3'),_0xf7f4('0xa4'),_0xf7f4('0xa3'),_0xf7f4('0xb4'),_0xf7f4('0x5c'),_0xf7f4('0x5d')],squel[_0xf7f4('0xad')]()[_0xf7f4('0xa6')]('h.id','id')['field'](_0xf7f4('0xb1'),_0xf7f4('0xa4'))[_0xf7f4('0xa6')](_0xf7f4('0xb5'),'phone')[_0xf7f4('0xa6')]('ci.OrderBY',_0xf7f4('0xb4'))[_0xf7f4('0xa6')]('\x27'+_0x254800+'\x27',_0xf7f4('0x5c'))[_0xf7f4('0xa6')]('\x27'+_0x254800+'\x27',_0xf7f4('0x5d'))[_0xf7f4('0x84')](_0xf7f4('0xb6'),'ci')[_0xf7f4('0xb7')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0xf7f4('0xb8'),_0x36c04a[_0xf7f4('0xa7')]['toString']())[_0xf7f4('0x49')](_0xf7f4('0xb9'),_0x5b6c1f[_0xf7f4('0x53')]['id'][_0xf7f4('0xa8')]())[_0xf7f4('0x49')](_0xf7f4('0xba'),_0x254800))['toString']();_0x56e907[_0xf7f4('0x89')](db[_0xf7f4('0x76')]['query'](_0x11be77));_0x5edbcc[_0xf7f4('0x89')](db[_0xf7f4('0x76')][_0xf7f4('0x3f')](_0x11b937));}return BPromise[_0xf7f4('0x8d')](_0x56e907);}})[_0xf7f4('0x27')](function(){return BPromise['all'](_0x5edbcc);})[_0xf7f4('0x27')](function(){return _0x3e52d7;})[_0xf7f4('0x27')](respondWithResult(_0x5e9a46,null))[_0xf7f4('0x51')](handleError(_0x5e9a46,null));};exports['removeLists']=function(_0x495791,_0x126b8c,_0x516903){return db[_0xf7f4('0x4e')][_0xf7f4('0x34')]({'where':{'id':_0x495791[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x126b8c,null))[_0xf7f4('0x27')](function(_0x392066){if(_0x392066){return _0x392066[_0xf7f4('0xbb')](_0x495791[_0xf7f4('0x3f')][_0xf7f4('0x82')]);}})[_0xf7f4('0x27')](function(_0x5d7992){if(_0x5d7992){return db[_0xf7f4('0x62')][_0xf7f4('0x28')]({'where':{'ListId':_0x495791['query']['ids'],'VoiceQueueId':_0x495791[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](function(){return _0x5d7992;});}})[_0xf7f4('0x27')](respondWithStatusCode(_0x126b8c,null))[_0xf7f4('0x51')](handleError(_0x126b8c,null));};exports[_0xf7f4('0xbc')]=function(_0x3a7ef1,_0x24a9f9,_0x5ac819){var _0x43ed45={};var _0x56e799={};var _0x42bbee;var _0x2069d1;return db['VoiceQueue'][_0xf7f4('0x61')]({'where':{'id':_0x3a7ef1[_0xf7f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x24a9f9,null))[_0xf7f4('0x27')](function(_0x1460e1){if(_0x1460e1){_0x42bbee=_0x1460e1;_0x56e799['model']=_['keys'](db[_0xf7f4('0x9c')]['rawAttributes']);_0x56e799[_0xf7f4('0x3f')]=_[_0xf7f4('0x40')](_0x3a7ef1[_0xf7f4('0x3f')]);_0x56e799['filters']=_[_0xf7f4('0x42')](_0x56e799[_0xf7f4('0x3e')],_0x56e799[_0xf7f4('0x3f')]);_0x43ed45[_0xf7f4('0x43')]=_[_0xf7f4('0x42')](_0x56e799[_0xf7f4('0x3e')],qs[_0xf7f4('0x44')](_0x3a7ef1[_0xf7f4('0x3f')][_0xf7f4('0x44')]));_0x43ed45[_0xf7f4('0x43')]=_0x43ed45[_0xf7f4('0x43')][_0xf7f4('0x45')]?_0x43ed45[_0xf7f4('0x43')]:_0x56e799[_0xf7f4('0x3e')];_0x43ed45['order']=qs['sort'](_0x3a7ef1[_0xf7f4('0x3f')][_0xf7f4('0x48')]);_0x43ed45[_0xf7f4('0x49')]=qs[_0xf7f4('0x41')](_[_0xf7f4('0x4a')](_0x3a7ef1[_0xf7f4('0x3f')],_0x56e799[_0xf7f4('0x41')]));if(_0x3a7ef1['query'][_0xf7f4('0x2e')]){_0x43ed45['where']=_[_0xf7f4('0x4b')](_0x43ed45[_0xf7f4('0x49')],{'$or':_[_0xf7f4('0x30')](_0x43ed45['attributes'],function(_0x2a2cb9){var _0x3a5443={};_0x3a5443[_0x2a2cb9]={'$like':'%'+_0x3a7ef1[_0xf7f4('0x3f')]['filter']+'%'};return _0x3a5443;})});}_0x43ed45=_[_0xf7f4('0x4b')]({},_0x43ed45,_0x3a7ef1[_0xf7f4('0x4d')]);return _0x42bbee[_0xf7f4('0xbc')](_0x43ed45);}})['then'](function(_0x1016aa){if(_0x1016aa){_0x2069d1=_0x1016aa['length'];if(!_0x3a7ef1[_0xf7f4('0x3f')]['hasOwnProperty'](_0xf7f4('0x63'))){_0x43ed45[_0xf7f4('0x20')]=qs[_0xf7f4('0x20')](_0x3a7ef1[_0xf7f4('0x3f')][_0xf7f4('0x20')]);_0x43ed45['offset']=qs[_0xf7f4('0x1f')](_0x3a7ef1[_0xf7f4('0x3f')][_0xf7f4('0x1f')]);}return _0x42bbee['getBlackLists'](_0x43ed45);}})[_0xf7f4('0x27')](function(_0x1baeea){if(_0x1baeea){return _0x1baeea?{'count':_0x2069d1,'rows':_0x1baeea}:null;}})[_0xf7f4('0x27')](respondWithResult(_0x24a9f9,null))[_0xf7f4('0x51')](handleError(_0x24a9f9,null));};exports[_0xf7f4('0xbd')]=function(_0x336526,_0x56ddb5,_0x351e8c){var _0x26c185,_0x159ac8;var _0x4ae46e=[];var _0x3e111d=moment()[_0xf7f4('0x7d')](_0xf7f4('0xbe'));return db[_0xf7f4('0x4e')][_0xf7f4('0x34')]({'where':{'id':_0x336526[_0xf7f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x56ddb5,null))[_0xf7f4('0x27')](function(_0x264578){if(_0x264578){_0x159ac8=_0x264578;return _0x264578[_0xf7f4('0xbd')](_0x336526[_0xf7f4('0x5e')][_0xf7f4('0x82')],_[_0xf7f4('0x5b')](_0x336526[_0xf7f4('0x5e')],[_0xf7f4('0x82'),'id'])||{});}return null;})['spread'](function(_0x368e0c){var _0x310b35;var _0x506ad9;_0x26c185=_0x368e0c||[];var _0x3a7ef3=[];if(_0x368e0c){for(var _0x2e2a88=0x0;_0x2e2a88<_0x368e0c[_0xf7f4('0x45')];_0x2e2a88+=0x1){var _0x17043c=_0x368e0c[_0x2e2a88]['get']({'plain':!![]});_0x310b35=squel['insert']()[_0xf7f4('0xa1')](_0xf7f4('0xbf'))[_0xf7f4('0xa2')](['phone','ContactId',_0xf7f4('0xa9'),_0xf7f4('0x66'),_0xf7f4('0x5c'),_0xf7f4('0x5d')],squel[_0xf7f4('0xad')]()[_0xf7f4('0xa6')](_0xf7f4('0xa3'),_0xf7f4('0xa3'))[_0xf7f4('0xa6')]('id',_0xf7f4('0xa5'))['field'](_0x17043c[_0xf7f4('0xa7')][_0xf7f4('0xa8')](),'ListId')['field'](_0x336526[_0xf7f4('0x53')]['id'][_0xf7f4('0xa8')](),_0xf7f4('0x66'))[_0xf7f4('0xa6')](_0xf7f4('0xb1'),_0xf7f4('0x5c'))['field'](_0xf7f4('0xb1'),_0xf7f4('0x5d'))[_0xf7f4('0x84')](_0xf7f4('0xaa'))[_0xf7f4('0x49')]('deletedAt\x20IS\x20NULL')['where'](_0xf7f4('0xb2'),_0x17043c[_0xf7f4('0xa7')][_0xf7f4('0xa8')]())[_0xf7f4('0x49')](_0xf7f4('0xab')))[_0xf7f4('0xa8')]();_0x3a7ef3[_0xf7f4('0x89')](db[_0xf7f4('0x76')]['query'](_0x310b35));}return BPromise['all'](_0x3a7ef3);}})[_0xf7f4('0x27')](function(){return _0x26c185;})['then'](respondWithResult(_0x56ddb5,null))[_0xf7f4('0x51')](handleError(_0x56ddb5,null));};exports[_0xf7f4('0xc0')]=function(_0x1fa725,_0x1b76a9,_0x3ef42d){return db['VoiceQueue'][_0xf7f4('0x34')]({'where':{'id':_0x1fa725[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](handleEntityNotFound(_0x1b76a9,null))[_0xf7f4('0x27')](function(_0x1f38ab){if(_0x1f38ab){return _0x1f38ab['removeBlackLists'](_0x1fa725[_0xf7f4('0x3f')][_0xf7f4('0x82')]);}})['then'](function(_0xa0eae1){if(_0xa0eae1){return db[_0xf7f4('0x6b')][_0xf7f4('0x28')]({'where':{'ListId':_0x1fa725[_0xf7f4('0x3f')][_0xf7f4('0x82')],'VoiceQueueId':_0x1fa725[_0xf7f4('0x53')]['id']}})[_0xf7f4('0x27')](function(){return _0xa0eae1;});}})[_0xf7f4('0x27')](respondWithStatusCode(_0x1b76a9,null))[_0xf7f4('0x51')](handleError(_0x1b76a9,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index fb28767..7786536 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 _0xa20e=['update','remove','hook','events','VoiceQueue','save'];(function(_0x2ab36d,_0x354b92){var _0x1300d4=function(_0x43e7bb){while(--_0x43e7bb){_0x2ab36d['push'](_0x2ab36d['shift']());}};_0x1300d4(++_0x354b92);}(_0xa20e,0xab));var _0xea20=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xa20e[_0x2a67fe];return _0x57e726;};'use strict';var EventEmitter=require(_0xea20('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xea20('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea20('0x2'),'afterUpdate':_0xea20('0x3'),'afterDestroy':_0xea20('0x4')};function emitEvent(_0x5aba3c){return function(_0x304c2a,_0x5d4d03,_0x25ffd5){VoiceQueueEvents['emit'](_0x5aba3c+':'+_0x304c2a['id'],_0x304c2a);VoiceQueueEvents['emit'](_0x5aba3c,_0x304c2a);_0x25ffd5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xea20('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x903d=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5c4fa5,_0x3b79cc){var _0x828bd7=function(_0x2cf92a){while(--_0x2cf92a){_0x5c4fa5['push'](_0x5c4fa5['shift']());}};_0x828bd7(++_0x3b79cc);}(_0x903d,0x19b));var _0xd903=function(_0x2f06c8,_0x192576){_0x2f06c8=_0x2f06c8-0x0;var _0x188fe4=_0x903d[_0x2f06c8];return _0x188fe4;};'use strict';var EventEmitter=require(_0xd903('0x0'));var VoiceQueue=require(_0xd903('0x1'))['db'][_0xd903('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd903('0x3')](0x0);var events={'afterCreate':_0xd903('0x4'),'afterUpdate':_0xd903('0x5'),'afterDestroy':_0xd903('0x6')};function emitEvent(_0x257c93){return function(_0x4b5b6d,_0x107f89,_0x1cc6c7){VoiceQueueEvents[_0xd903('0x7')](_0x257c93+':'+_0x4b5b6d['id'],_0x4b5b6d);VoiceQueueEvents[_0xd903('0x7')](_0x257c93,_0x4b5b6d);_0x1cc6c7(null);};}for(var e in events){if(events[_0xd903('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xd903('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8a39b20..ddeed1b 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 _0xada4=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceQueue'];(function(_0x444edc,_0x5022b4){var _0x1d91e5=function(_0x4c4342){while(--_0x4c4342){_0x444edc['push'](_0x444edc['shift']());}};_0x1d91e5(++_0x5022b4);}(_0xada4,0x19a));var _0x4ada=function(_0x20a379,_0x3e11fb){_0x20a379=_0x20a379-0x0;var _0x4f3b39=_0xada4[_0x20a379];return _0x4f3b39;};'use strict';var _=require('lodash');var util=require(_0x4ada('0x0'));var logger=require('../../config/logger')(_0x4ada('0x1'));var moment=require(_0x4ada('0x2'));var BPromise=require(_0x4ada('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ada('0x4'));var rimraf=require(_0x4ada('0x5'));var config=require(_0x4ada('0x6'));var attributes=require('./voiceQueue.attributes');module[_0x4ada('0x7')]=function(_0x1c07f6,_0x3a8542){return _0x1c07f6[_0x4ada('0x8')](_0x4ada('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0417=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','../../config/logger','moment','path','rimraf'];(function(_0x470f94,_0x42d3f6){var _0x790912=function(_0x500a10){while(--_0x500a10){_0x470f94['push'](_0x470f94['shift']());}};_0x790912(++_0x42d3f6);}(_0x0417,0x171));var _0x7041=function(_0x4a0a2e,_0x3897b1){_0x4a0a2e=_0x4a0a2e-0x0;var _0x20d54c=_0x0417[_0x4a0a2e];return _0x20d54c;};'use strict';var _=require(_0x7041('0x0'));var util=require('util');var logger=require(_0x7041('0x1'))('api');var moment=require(_0x7041('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7041('0x3'));var rimraf=require(_0x7041('0x4'));var config=require(_0x7041('0x5'));var attributes=require(_0x7041('0x6'));module[_0x7041('0x7')]=function(_0x425d4c,_0x54eab8){return _0x425d4c[_0x7041('0x8')](_0x7041('0x9'),attributes,{'tableName':_0x7041('0xa'),'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 c634008..5684e37 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 _0x4f06=['options','raw','limit','map','include','model','attributes','ShowVoiceQueue','where','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll'];(function(_0x52b893,_0x16c3cb){var _0x380f91=function(_0x573ad7){while(--_0x573ad7){_0x52b893['push'](_0x52b893['shift']());}};_0x380f91(++_0x16c3cb);}(_0x4f06,0x1ac));var _0x64f0=function(_0x507742,_0x4877a4){_0x507742=_0x507742-0x0;var _0x541827=_0x4f06[_0x507742];return _0x541827;};'use strict';var _=require('lodash');var util=require(_0x64f0('0x0'));var moment=require(_0x64f0('0x1'));var BPromise=require(_0x64f0('0x2'));var rs=require(_0x64f0('0x3'));var fs=require('fs');var Redis=require(_0x64f0('0x4'));var db=require(_0x64f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x64f0('0x6'))(_0x64f0('0x7'));var config=require('../../config/environment');var jayson=require(_0x64f0('0x8'));var client=jayson[_0x64f0('0x9')][_0x64f0('0xa')]({'port':0x232a});config[_0x64f0('0xb')]=_['defaults'](config[_0x64f0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x64f0('0xc'))(new Redis(config[_0x64f0('0xb')]));require(_0x64f0('0xd'))[_0x64f0('0xe')](socket);function respondWithRpcPromise(_0x343e38,_0x344c37,_0x201f31){return new BPromise(function(_0x357f03,_0x9209df){return client['request'](_0x343e38,_0x201f31)[_0x64f0('0xf')](function(_0x840b0b){logger['info'](_0x64f0('0x10'),_0x344c37,'request\x20sent');logger[_0x64f0('0x11')](_0x64f0('0x12'),_0x344c37,'request\x20sent',JSON['stringify'](_0x840b0b));if(_0x840b0b['error']){if(_0x840b0b[_0x64f0('0x13')][_0x64f0('0x14')]===0x1f4){logger[_0x64f0('0x13')](_0x64f0('0x10'),_0x344c37,_0x840b0b['error'][_0x64f0('0x15')]);return _0x9209df(_0x840b0b['error']['message']);}logger[_0x64f0('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x344c37,_0x840b0b[_0x64f0('0x13')][_0x64f0('0x15')]);return _0x357f03(_0x840b0b[_0x64f0('0x13')][_0x64f0('0x15')]);}else{logger[_0x64f0('0x16')](_0x64f0('0x10'),_0x344c37,'request\x20sent');_0x357f03(_0x840b0b[_0x64f0('0x17')][_0x64f0('0x15')]);}})[_0x64f0('0x18')](function(_0xdbe8fe){logger[_0x64f0('0x13')](_0x64f0('0x10'),_0x344c37,_0xdbe8fe);_0x9209df(_0xdbe8fe);});});}exports[_0x64f0('0x19')]=function(_0x257255){var _0x1e47be=this;return new Promise(function(_0x10c8cf,_0x1d783b){return db[_0x64f0('0x1a')][_0x64f0('0x1b')]({'raw':_0x257255['options']?_0x257255[_0x64f0('0x1c')][_0x64f0('0x1d')]===undefined?!![]:![]:!![],'where':_0x257255['options']?_0x257255['options']['where']||null:null,'attributes':_0x257255[_0x64f0('0x1c')]?_0x257255[_0x64f0('0x1c')]['attributes']||null:null,'limit':_0x257255[_0x64f0('0x1c')]?_0x257255[_0x64f0('0x1c')][_0x64f0('0x1e')]||null:null,'include':_0x257255[_0x64f0('0x1c')]?_0x257255[_0x64f0('0x1c')]['include']?_[_0x64f0('0x1f')](_0x257255['options'][_0x64f0('0x20')],function(_0x4fe341){return{'model':db[_0x4fe341[_0x64f0('0x21')]],'as':_0x4fe341['as'],'attributes':_0x4fe341[_0x64f0('0x22')],'include':_0x4fe341['include']?_[_0x64f0('0x1f')](_0x4fe341[_0x64f0('0x20')],function(_0x26c4ba){return{'model':db[_0x26c4ba['model']],'as':_0x26c4ba['as'],'attributes':_0x26c4ba['attributes'],'include':_0x26c4ba['include']?_[_0x64f0('0x1f')](_0x26c4ba[_0x64f0('0x20')],function(_0x291601){return{'model':db[_0x291601['model']],'as':_0x291601['as'],'attributes':_0x291601['attributes']};}):[]};}):[]};}):[]:[]})[_0x64f0('0xf')](function(_0x394426){logger[_0x64f0('0x16')]('GetVoiceQueue',_0x257255);logger['debug'](_0x64f0('0x19'),_0x257255,JSON['stringify'](_0x394426));_0x10c8cf(_0x394426);})['catch'](function(_0x432e10){logger['error'](_0x64f0('0x19'),_0x432e10[_0x64f0('0x15')],_0x257255);_0x1d783b(_0x1e47be[_0x64f0('0x13')](0x1f4,_0x432e10[_0x64f0('0x15')]));});});};exports[_0x64f0('0x23')]=function(_0x374713){var _0x2c4e08=this;return new Promise(function(_0x22535e,_0x17b53a){return db[_0x64f0('0x1a')]['find']({'raw':_0x374713[_0x64f0('0x1c')]?_0x374713[_0x64f0('0x1c')][_0x64f0('0x1d')]===undefined?!![]:![]:!![],'where':_0x374713[_0x64f0('0x1c')]?_0x374713[_0x64f0('0x1c')][_0x64f0('0x24')]||null:null,'attributes':_0x374713[_0x64f0('0x1c')]?_0x374713['options'][_0x64f0('0x22')]||null:null,'include':_0x374713[_0x64f0('0x1c')]?_0x374713[_0x64f0('0x1c')][_0x64f0('0x20')]?_[_0x64f0('0x1f')](_0x374713['options'][_0x64f0('0x20')],function(_0x1f7887){return{'model':db[_0x1f7887[_0x64f0('0x21')]],'as':_0x1f7887['as'],'attributes':_0x1f7887[_0x64f0('0x22')],'include':_0x1f7887[_0x64f0('0x20')]?_[_0x64f0('0x1f')](_0x1f7887[_0x64f0('0x20')],function(_0x169643){return{'model':db[_0x169643[_0x64f0('0x21')]],'as':_0x169643['as'],'attributes':_0x169643['attributes'],'include':_0x169643[_0x64f0('0x20')]?_[_0x64f0('0x1f')](_0x169643[_0x64f0('0x20')],function(_0x179cbc){return{'model':db[_0x179cbc[_0x64f0('0x21')]],'as':_0x179cbc['as'],'attributes':_0x179cbc[_0x64f0('0x22')]};}):[]};}):[]};}):[]:[]})[_0x64f0('0xf')](function(_0x5f484e){logger['info']('ShowVoiceQueue',_0x374713);logger[_0x64f0('0x11')](_0x64f0('0x23'),_0x374713,JSON[_0x64f0('0x25')](_0x5f484e));_0x22535e(_0x5f484e);})[_0x64f0('0x18')](function(_0x2f5b74){logger[_0x64f0('0x13')](_0x64f0('0x23'),_0x2f5b74[_0x64f0('0x15')],_0x374713);_0x17b53a(_0x2c4e08[_0x64f0('0x13')](0x1f4,_0x2f5b74['message']));});});}; \ No newline at end of file +var _0xfdea=['stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','options','raw','attributes','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1aed04,_0x129e58){var _0x169bd7=function(_0x20ee2b){while(--_0x20ee2b){_0x1aed04['push'](_0x1aed04['shift']());}};_0x169bd7(++_0x129e58);}(_0xfdea,0x114));var _0xafde=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xfdea[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xafde('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xafde('0x1'));var rs=require(_0xafde('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafde('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xafde('0x4'))(_0xafde('0x5'));var config=require('../../config/environment');var jayson=require(_0xafde('0x6'));var client=jayson[_0xafde('0x7')][_0xafde('0x8')]({'port':0x232a});config[_0xafde('0x9')]=_[_0xafde('0xa')](config[_0xafde('0x9')],{'host':_0xafde('0xb'),'port':0x18eb});var socket=require(_0xafde('0xc'))(new Redis(config[_0xafde('0x9')]));require(_0xafde('0xd'))[_0xafde('0xe')](socket);function respondWithRpcPromise(_0x579e3e,_0x7e9fbc,_0x7a086c){return new BPromise(function(_0x11ccf1,_0x27e640){return client[_0xafde('0xf')](_0x579e3e,_0x7a086c)[_0xafde('0x10')](function(_0x225cbf){logger[_0xafde('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x7e9fbc,_0xafde('0x12'));logger['debug'](_0xafde('0x13'),_0x7e9fbc,_0xafde('0x12'),JSON[_0xafde('0x14')](_0x225cbf));if(_0x225cbf[_0xafde('0x15')]){if(_0x225cbf[_0xafde('0x15')][_0xafde('0x16')]===0x1f4){logger[_0xafde('0x15')](_0xafde('0x17'),_0x7e9fbc,_0x225cbf[_0xafde('0x15')][_0xafde('0x18')]);return _0x27e640(_0x225cbf[_0xafde('0x15')][_0xafde('0x18')]);}logger[_0xafde('0x15')](_0xafde('0x17'),_0x7e9fbc,_0x225cbf['error']['message']);return _0x11ccf1(_0x225cbf[_0xafde('0x15')]['message']);}else{logger[_0xafde('0x11')](_0xafde('0x17'),_0x7e9fbc,_0xafde('0x12'));_0x11ccf1(_0x225cbf[_0xafde('0x19')][_0xafde('0x18')]);}})[_0xafde('0x1a')](function(_0x568b23){logger[_0xafde('0x15')](_0xafde('0x17'),_0x7e9fbc,_0x568b23);_0x27e640(_0x568b23);});});}exports['GetVoiceQueue']=function(_0x3fa723){var _0x1497c7=this;return new Promise(function(_0x19a05d,_0x242ebe){return db['VoiceQueue']['findAll']({'raw':_0x3fa723['options']?_0x3fa723[_0xafde('0x1b')][_0xafde('0x1c')]===undefined?!![]:![]:!![],'where':_0x3fa723[_0xafde('0x1b')]?_0x3fa723['options']['where']||null:null,'attributes':_0x3fa723['options']?_0x3fa723[_0xafde('0x1b')][_0xafde('0x1d')]||null:null,'limit':_0x3fa723['options']?_0x3fa723[_0xafde('0x1b')]['limit']||null:null,'include':_0x3fa723[_0xafde('0x1b')]?_0x3fa723[_0xafde('0x1b')][_0xafde('0x1e')]?_[_0xafde('0x1f')](_0x3fa723[_0xafde('0x1b')]['include'],function(_0x123932){return{'model':db[_0x123932[_0xafde('0x20')]],'as':_0x123932['as'],'attributes':_0x123932['attributes'],'include':_0x123932[_0xafde('0x1e')]?_[_0xafde('0x1f')](_0x123932[_0xafde('0x1e')],function(_0x453695){return{'model':db[_0x453695[_0xafde('0x20')]],'as':_0x453695['as'],'attributes':_0x453695[_0xafde('0x1d')],'include':_0x453695['include']?_[_0xafde('0x1f')](_0x453695[_0xafde('0x1e')],function(_0x40ada2){return{'model':db[_0x40ada2['model']],'as':_0x40ada2['as'],'attributes':_0x40ada2[_0xafde('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xafde('0x10')](function(_0x3a3fda){logger[_0xafde('0x11')]('GetVoiceQueue',_0x3fa723);logger['debug'](_0xafde('0x21'),_0x3fa723,JSON[_0xafde('0x14')](_0x3a3fda));_0x19a05d(_0x3a3fda);})[_0xafde('0x1a')](function(_0x18b59c){logger[_0xafde('0x15')](_0xafde('0x21'),_0x18b59c['message'],_0x3fa723);_0x242ebe(_0x1497c7['error'](0x1f4,_0x18b59c[_0xafde('0x18')]));});});};exports[_0xafde('0x22')]=function(_0x1a2447){var _0x118499=this;return new Promise(function(_0x56e242,_0x3c476c){return db['VoiceQueue'][_0xafde('0x23')]({'raw':_0x1a2447['options']?_0x1a2447[_0xafde('0x1b')][_0xafde('0x1c')]===undefined?!![]:![]:!![],'where':_0x1a2447['options']?_0x1a2447[_0xafde('0x1b')]['where']||null:null,'attributes':_0x1a2447[_0xafde('0x1b')]?_0x1a2447[_0xafde('0x1b')][_0xafde('0x1d')]||null:null,'include':_0x1a2447[_0xafde('0x1b')]?_0x1a2447[_0xafde('0x1b')][_0xafde('0x1e')]?_[_0xafde('0x1f')](_0x1a2447['options']['include'],function(_0xba9eef){return{'model':db[_0xba9eef[_0xafde('0x20')]],'as':_0xba9eef['as'],'attributes':_0xba9eef[_0xafde('0x1d')],'include':_0xba9eef[_0xafde('0x1e')]?_[_0xafde('0x1f')](_0xba9eef[_0xafde('0x1e')],function(_0x452586){return{'model':db[_0x452586['model']],'as':_0x452586['as'],'attributes':_0x452586['attributes'],'include':_0x452586['include']?_[_0xafde('0x1f')](_0x452586[_0xafde('0x1e')],function(_0x4beed6){return{'model':db[_0x4beed6[_0xafde('0x20')]],'as':_0x4beed6['as'],'attributes':_0x4beed6[_0xafde('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xafde('0x10')](function(_0x28f7c7){logger['info'](_0xafde('0x22'),_0x1a2447);logger[_0xafde('0x24')](_0xafde('0x22'),_0x1a2447,JSON['stringify'](_0x28f7c7));_0x56e242(_0x28f7c7);})[_0xafde('0x1a')](function(_0xa2202e){logger[_0xafde('0x15')]('ShowVoiceQueue',_0xa2202e[_0xafde('0x18')],_0x1a2447);_0x3c476c(_0x118499[_0xafde('0x15')](0x1f4,_0xa2202e[_0xafde('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index bb0e9c9..84a873c 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 _0xe99f=['save','remove','update','removeListener','length'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0xe99f,0x136));var _0xfe99=function(_0x27a5e8,_0x569265){_0x27a5e8=_0x27a5e8-0x0;var _0x3d139c=_0xe99f[_0x27a5e8];return _0x3d139c;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xfe99('0x0'),_0xfe99('0x1'),_0xfe99('0x2')];function createListener(_0x382543,_0x1d3178){return function(_0x595232){_0x1d3178['emit'](_0x382543,_0x595232);};}function removeListener(_0x1dfc34,_0x52d3cf){return function(){VoiceQueueEvents[_0xfe99('0x3')](_0x1dfc34,_0x52d3cf);};}exports['register']=function(_0x52133c){for(var _0x1eb8c9=0x0,_0x383f30=events[_0xfe99('0x4')];_0x1eb8c9<_0x383f30;_0x1eb8c9++){var _0x262d83=events[_0x1eb8c9];var _0x379723=createListener('voiceQueue:'+_0x262d83,_0x52133c);VoiceQueueEvents['on'](_0x262d83,_0x379723);}}; \ No newline at end of file +var _0x0d98=['save','remove','emit','register','length','./voiceQueue.events'];(function(_0x4536f1,_0x5dc4b0){var _0x595a32=function(_0x3ede79){while(--_0x3ede79){_0x4536f1['push'](_0x4536f1['shift']());}};_0x595a32(++_0x5dc4b0);}(_0x0d98,0x149));var _0x80d9=function(_0x498f33,_0x3bbd0c){_0x498f33=_0x498f33-0x0;var _0x512f96=_0x0d98[_0x498f33];return _0x512f96;};'use strict';var VoiceQueueEvents=require(_0x80d9('0x0'));var events=[_0x80d9('0x1'),_0x80d9('0x2'),'update'];function createListener(_0x4dffe3,_0x57240c){return function(_0x344efb){_0x57240c[_0x80d9('0x3')](_0x4dffe3,_0x344efb);};}function removeListener(_0xb3be1c,_0x459acd){return function(){VoiceQueueEvents['removeListener'](_0xb3be1c,_0x459acd);};}exports[_0x80d9('0x4')]=function(_0x4c6e77){for(var _0x4a7aad=0x0,_0x5e5f6b=events[_0x80d9('0x5')];_0x4a7aad<_0x5e5f6b;_0x4a7aad++){var _0xb8d05=events[_0x4a7aad];var _0x5cc7b7=createListener('voiceQueue:'+_0xb8d05,_0x4c6e77);VoiceQueueEvents['on'](_0xb8d05,_0x5cc7b7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f542493..09272a9 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 _0x157f=['../../config/environment','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b2443,_0x3e283c){var _0x95988d=function(_0x2f6eff){while(--_0x2f6eff){_0x2b2443['push'](_0x2b2443['shift']());}};_0x95988d(++_0x3e283c);}(_0x157f,0x179));var _0xf157=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x157f[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xf157('0x0'));var util=require(_0xf157('0x1'));var path=require('path');var timeout=require(_0xf157('0x2'));var express=require('express');var router=express[_0xf157('0x3')]();var fs_extra=require(_0xf157('0x4'));var auth=require(_0xf157('0x5'));var interaction=require(_0xf157('0x6'));var config=require(_0xf157('0x7'));var controller=require('./voiceQueueReport.controller');router[_0xf157('0x8')]('/',auth['isAuthenticated'](),controller[_0xf157('0x9')]);router[_0xf157('0x8')](_0xf157('0xa'),auth[_0xf157('0xb')](),controller[_0xf157('0xc')]);router[_0xf157('0x8')](_0xf157('0xd'),auth['isAuthenticated'](),controller[_0xf157('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf157('0xf')]);router[_0xf157('0x10')]('/',auth[_0xf157('0xb')](),controller[_0xf157('0x11')]);router[_0xf157('0x12')](_0xf157('0x13'),auth[_0xf157('0xb')](),controller[_0xf157('0x14')]);router[_0xf157('0x15')](_0xf157('0x13'),auth[_0xf157('0xb')](),controller[_0xf157('0x16')]);module[_0xf157('0x17')]=router; \ No newline at end of file +var _0xa2da=['../../config/environment','get','/describe','isAuthenticated','describe','getVoiceQueuesReport','post','create','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x9ddf37,_0x293505){var _0x29f5df=function(_0x15693c){while(--_0x15693c){_0x9ddf37['push'](_0x9ddf37['shift']());}};_0x29f5df(++_0x293505);}(_0xa2da,0x18a));var _0xaa2d=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0xa2da[_0x1ac77b];return _0x161584;};'use strict';var multer=require(_0xaa2d('0x0'));var util=require('util');var path=require(_0xaa2d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa2d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xaa2d('0x3'));var interaction=require(_0xaa2d('0x4'));var config=require(_0xaa2d('0x5'));var controller=require('./voiceQueueReport.controller');router[_0xaa2d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaa2d('0x6')](_0xaa2d('0x7'),auth[_0xaa2d('0x8')](),controller[_0xaa2d('0x9')]);router['get']('/index',auth[_0xaa2d('0x8')](),controller[_0xaa2d('0xa')]);router['get']('/:id',auth[_0xaa2d('0x8')](),controller['show']);router[_0xaa2d('0xb')]('/',auth[_0xaa2d('0x8')](),controller[_0xaa2d('0xc')]);router[_0xaa2d('0xd')](_0xaa2d('0xe'),auth[_0xaa2d('0x8')](),controller[_0xaa2d('0xf')]);router[_0xaa2d('0x10')](_0xaa2d('0xe'),auth['isAuthenticated'](),controller[_0xaa2d('0x11')]);module[_0xaa2d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index f26973f..10705d7 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 _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x3138d3,_0x48c0ae){var _0x54945b=function(_0x25cbdb){while(--_0x25cbdb){_0x3138d3['push'](_0x3138d3['shift']());}};_0x54945b(++_0x48c0ae);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x16954c,_0x2f3051){var _0x93e220=function(_0x539dd1){while(--_0x539dd1){_0x16954c['push'](_0x16954c['shift']());}};_0x93e220(++_0x2f3051);}(_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')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'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 2c7ed8d..2841438 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 _0x25c9=['nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','fields','model','options','find','create','body','describe','getVoiceQueuesReport','rawAttributes','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','VoiceQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x25c9,0x6c));var _0x925c=function(_0x3ad5ff,_0x4d8e3b){_0x3ad5ff=_0x3ad5ff-0x0;var _0x637cc2=_0x25c9[_0x3ad5ff];return _0x637cc2;};'use strict';var emlformat=require(_0x925c('0x0'));var rimraf=require(_0x925c('0x1'));var zipdir=require(_0x925c('0x2'));var jsonpatch=require(_0x925c('0x3'));var rp=require('request-promise');var moment=require(_0x925c('0x4'));var BPromise=require(_0x925c('0x5'));var Mustache=require('mustache');var util=require(_0x925c('0x6'));var path=require(_0x925c('0x7'));var sox=require(_0x925c('0x8'));var csv=require('to-csv');var ejs=require(_0x925c('0x9'));var fs=require('fs');var fs_extra=require(_0x925c('0xa'));var _=require(_0x925c('0xb'));var squel=require(_0x925c('0xc'));var crypto=require(_0x925c('0xd'));var jsforce=require(_0x925c('0xe'));var deskjs=require(_0x925c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x925c('0x10'));var Papa=require(_0x925c('0x11'));var Redis=require(_0x925c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x925c('0x13'));var as=require(_0x925c('0x14'));var hardwareService=require(_0x925c('0x15'));var logger=require(_0x925c('0x16'))(_0x925c('0x17'));var utils=require(_0x925c('0x18'));var config=require(_0x925c('0x19'));var licenseUtil=require(_0x925c('0x1a'));var db=require('../../mysqldb')['db'];config[_0x925c('0x1b')]=_['defaults'](config[_0x925c('0x1b')],{'host':_0x925c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x925c('0x1b')]));require(_0x925c('0x1d'))[_0x925c('0x1e')](socket);function respondWithStatusCode(_0x4a68d8,_0x349b10){_0x349b10=_0x349b10||0xcc;return function(_0x18f857){if(_0x18f857){return _0x4a68d8[_0x925c('0x1f')](_0x349b10);}return _0x4a68d8[_0x925c('0x20')](_0x349b10)['end']();};}function respondWithResult(_0x10d667,_0x80ed05){_0x80ed05=_0x80ed05||0xc8;return function(_0x1b5fc3){if(_0x1b5fc3){return _0x10d667[_0x925c('0x20')](_0x80ed05)[_0x925c('0x21')](_0x1b5fc3);}};}function respondWithFilteredResult(_0x4f59af,_0x1b4d20){return function(_0x390430){if(_0x390430){var _0x2e9810=typeof _0x1b4d20[_0x925c('0x22')]===_0x925c('0x23')&&typeof _0x1b4d20['limit']==='undefined';var _0x4e0a75=_0x390430[_0x925c('0x24')];var _0x2c1a9f=_0x2e9810?0x0:_0x1b4d20['offset'];var _0x5395c6=_0x2e9810?_0x390430[_0x925c('0x24')]:_0x1b4d20[_0x925c('0x22')]+_0x1b4d20['limit'];var _0xbee326;if(_0x5395c6>=_0x4e0a75){_0x5395c6=_0x4e0a75;_0xbee326=0xc8;}else{_0xbee326=0xce;}_0x4f59af[_0x925c('0x20')](_0xbee326);return _0x4f59af[_0x925c('0x25')](_0x925c('0x26'),_0x2c1a9f+'-'+_0x5395c6+'/'+_0x4e0a75)['json'](_0x390430);}return null;};}function patchUpdates(_0x2e8c58){return function(_0x4c46a0){try{jsonpatch['apply'](_0x4c46a0,_0x2e8c58,!![]);}catch(_0x35e60c){return BPromise[_0x925c('0x27')](_0x35e60c);}return _0x4c46a0[_0x925c('0x28')]();};}function saveUpdates(_0x32e7bb,_0x5a0a9f){return function(_0x533000){if(_0x533000){return _0x533000[_0x925c('0x29')](_0x32e7bb)[_0x925c('0x2a')](function(_0x416580){return _0x416580;});}return null;};}function removeEntity(_0x33f000,_0x559cfb){return function(_0x470907){if(_0x470907){return _0x470907[_0x925c('0x2b')]()[_0x925c('0x2a')](function(){_0x33f000['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x94747f,_0x48645b){return function(_0x50c87a){if(!_0x50c87a){_0x94747f[_0x925c('0x1f')](0x194);}return _0x50c87a;};}function handleError(_0x15076e,_0x5cd245){_0x5cd245=_0x5cd245||0x1f4;return function(_0x276f19){logger['error'](_0x276f19[_0x925c('0x2c')]);if(_0x276f19[_0x925c('0x2d')]){delete _0x276f19[_0x925c('0x2d')];}_0x15076e[_0x925c('0x20')](_0x5cd245)[_0x925c('0x2e')](_0x276f19);};}exports['index']=function(_0x332949,_0x586955){var _0x5b1d24={},_0x54b696={},_0x38dd92={'count':0x0,'rows':[]};var _0x379962=_['map'](db[_0x925c('0x2f')]['rawAttributes'],function(_0x198d8c){return{'name':_0x198d8c[_0x925c('0x30')],'type':_0x198d8c[_0x925c('0x31')][_0x925c('0x32')]};});_0x54b696['model']=_['map'](_0x379962,_0x925c('0x2d'));_0x54b696[_0x925c('0x33')]=_[_0x925c('0x34')](_0x332949[_0x925c('0x33')]);_0x54b696[_0x925c('0x35')]=_[_0x925c('0x36')](_0x54b696['model'],_0x54b696['query']);_0x5b1d24[_0x925c('0x37')]=_[_0x925c('0x36')](_0x54b696['model'],qs['fields'](_0x332949[_0x925c('0x33')]['fields']));_0x5b1d24['attributes']=_0x5b1d24[_0x925c('0x37')][_0x925c('0x38')]?_0x5b1d24[_0x925c('0x37')]:_0x54b696['model'];if(!_0x332949['query'][_0x925c('0x39')](_0x925c('0x3a'))){_0x5b1d24[_0x925c('0x3b')]=qs[_0x925c('0x3b')](_0x332949[_0x925c('0x33')][_0x925c('0x3b')]);_0x5b1d24[_0x925c('0x22')]=qs['offset'](_0x332949[_0x925c('0x33')][_0x925c('0x22')]);}_0x5b1d24['order']=qs[_0x925c('0x3c')](_0x332949['query']['sort']);_0x5b1d24[_0x925c('0x3d')]=qs[_0x925c('0x35')](_[_0x925c('0x3e')](_0x332949[_0x925c('0x33')],_0x54b696[_0x925c('0x35')]),_0x379962);if(_0x332949['query']['filter']){_0x5b1d24[_0x925c('0x3d')]=_[_0x925c('0x3f')](_0x5b1d24[_0x925c('0x3d')],{'$or':_['map'](_0x379962,function(_0x30327c){if(_0x30327c[_0x925c('0x31')]!==_0x925c('0x40')){var _0x349ed7={};_0x349ed7[_0x30327c[_0x925c('0x2d')]]={'$like':'%'+_0x332949['query'][_0x925c('0x41')]+'%'};return _0x349ed7;}})});}_0x5b1d24=_[_0x925c('0x3f')]({},_0x5b1d24,_0x332949['options']);var _0x3582eb={'where':_0x5b1d24['where']};return db[_0x925c('0x2f')][_0x925c('0x24')](_0x3582eb)[_0x925c('0x2a')](function(_0x60c93){_0x38dd92[_0x925c('0x24')]=_0x60c93;if(_0x332949[_0x925c('0x33')][_0x925c('0x42')]){_0x5b1d24[_0x925c('0x43')]=[{'all':!![]}];}return db[_0x925c('0x2f')][_0x925c('0x44')](_0x5b1d24);})['then'](function(_0x5361c5){_0x38dd92[_0x925c('0x45')]=_0x5361c5;return _0x38dd92;})[_0x925c('0x2a')](respondWithFilteredResult(_0x586955,_0x5b1d24))[_0x925c('0x46')](handleError(_0x586955,null));};exports[_0x925c('0x47')]=function(_0x2c9adf,_0x487f67){var _0x36c4a7={'raw':![],'where':{'id':_0x2c9adf[_0x925c('0x48')]['id']}},_0x5d238d={};_0x5d238d['model']=_['keys'](db[_0x925c('0x2f')]['rawAttributes']);_0x5d238d[_0x925c('0x33')]=_[_0x925c('0x34')](_0x2c9adf['query']);_0x5d238d[_0x925c('0x35')]=_['intersection'](_0x5d238d['model'],_0x5d238d[_0x925c('0x33')]);_0x36c4a7[_0x925c('0x37')]=_['intersection'](_0x5d238d['model'],qs[_0x925c('0x49')](_0x2c9adf[_0x925c('0x33')]['fields']));_0x36c4a7[_0x925c('0x37')]=_0x36c4a7['attributes']['length']?_0x36c4a7[_0x925c('0x37')]:_0x5d238d[_0x925c('0x4a')];if(_0x2c9adf[_0x925c('0x33')]['includeAll']){_0x36c4a7[_0x925c('0x43')]=[{'all':!![]}];}_0x36c4a7=_['merge']({},_0x36c4a7,_0x2c9adf[_0x925c('0x4b')]);return db[_0x925c('0x2f')][_0x925c('0x4c')](_0x36c4a7)['then'](handleEntityNotFound(_0x487f67,null))[_0x925c('0x2a')](respondWithResult(_0x487f67,null))[_0x925c('0x46')](handleError(_0x487f67,null));};exports[_0x925c('0x4d')]=function(_0x29e4f7,_0x5052f1){return db['VoiceQueueReport'][_0x925c('0x4d')](_0x29e4f7[_0x925c('0x4e')],{})[_0x925c('0x2a')](respondWithResult(_0x5052f1,0xc9))[_0x925c('0x46')](handleError(_0x5052f1,null));};exports['update']=function(_0x31e990,_0x1b7cc3){if(_0x31e990[_0x925c('0x4e')]['id']){delete _0x31e990[_0x925c('0x4e')]['id'];}return db[_0x925c('0x2f')][_0x925c('0x4c')]({'where':{'id':_0x31e990[_0x925c('0x48')]['id']}})[_0x925c('0x2a')](handleEntityNotFound(_0x1b7cc3,null))['then'](saveUpdates(_0x31e990[_0x925c('0x4e')],null))['then'](respondWithResult(_0x1b7cc3,null))[_0x925c('0x46')](handleError(_0x1b7cc3,null));};exports[_0x925c('0x2b')]=function(_0x2feaff,_0x1fde90){return db[_0x925c('0x2f')][_0x925c('0x4c')]({'where':{'id':_0x2feaff['params']['id']}})[_0x925c('0x2a')](handleEntityNotFound(_0x1fde90,null))[_0x925c('0x2a')](removeEntity(_0x1fde90,null))[_0x925c('0x46')](handleError(_0x1fde90,null));};exports[_0x925c('0x4f')]=function(_0x364ee5,_0x210b40){return db[_0x925c('0x2f')][_0x925c('0x4f')]()[_0x925c('0x2a')](respondWithResult(_0x210b40,null))[_0x925c('0x46')](handleError(_0x210b40,null));};exports[_0x925c('0x50')]=function(_0x268940,_0x2ec58a){var _0xe06986={},_0x336f2f={},_0x44ceb0={'count':0x0,'rows':[]};_0x336f2f[_0x925c('0x4a')]=_[_0x925c('0x34')](db[_0x925c('0x2f')][_0x925c('0x51')]);_0x336f2f[_0x925c('0x33')]=_['keys'](_0x268940[_0x925c('0x33')]);_0x336f2f['filters']=_[_0x925c('0x36')](_0x336f2f[_0x925c('0x4a')],_0x336f2f['query']);_0xe06986[_0x925c('0x37')]=_['intersection'](_0x336f2f[_0x925c('0x4a')],qs[_0x925c('0x49')](_0x268940['query'][_0x925c('0x49')]));_0xe06986['attributes']=_0xe06986[_0x925c('0x37')][_0x925c('0x38')]?_0xe06986['attributes']:_0x336f2f[_0x925c('0x4a')];if(!_0x268940['query'][_0x925c('0x39')](_0x925c('0x3a'))){_0xe06986[_0x925c('0x3b')]=qs['limit'](_0x268940[_0x925c('0x33')][_0x925c('0x3b')]);_0xe06986[_0x925c('0x22')]=qs[_0x925c('0x22')](_0x268940[_0x925c('0x33')][_0x925c('0x22')]);}_0xe06986[_0x925c('0x52')]=qs[_0x925c('0x3c')](_0x268940[_0x925c('0x33')]['sort']);_0xe06986[_0x925c('0x3d')]=qs[_0x925c('0x35')](_[_0x925c('0x3e')](_0x268940['query'],_0x336f2f[_0x925c('0x35')]));if(_0x268940[_0x925c('0x33')][_0x925c('0x41')]){_0xe06986[_0x925c('0x3d')]=_[_0x925c('0x3f')](_0xe06986['where'],{'$or':_['map'](_0xe06986[_0x925c('0x37')],function(_0x865923){var _0x12d53c={};_0x12d53c[_0x865923]={'$like':'%'+_0x268940[_0x925c('0x33')]['filter']+'%'};return _0x12d53c;})});}_0xe06986=_['merge']({},_0xe06986,_0x268940[_0x925c('0x4b')]);var _0x55cf44={'where':_0xe06986[_0x925c('0x3d')]};return db[_0x925c('0x2f')][_0x925c('0x24')](_0x55cf44)[_0x925c('0x2a')](function(_0x6f71b5){_0x44ceb0[_0x925c('0x24')]=_0x6f71b5;if(_0x268940[_0x925c('0x33')][_0x925c('0x42')]){_0xe06986['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0xe06986);})[_0x925c('0x2a')](function(_0x2551ac){_0x44ceb0[_0x925c('0x45')]=_0x2551ac;return _0x44ceb0;})['then'](respondWithFilteredResult(_0x2ec58a,_0xe06986,_0x925c('0x50')))['catch'](handleError(_0x2ec58a,null,_0x925c('0x50')));}; \ No newline at end of file +var _0xdbe2=['crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','stack','name','map','VoiceQueueReport','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','catch','create','body','update','destroy','describe','getVoiceQueuesReport','hasOwnProperty','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x304bec,_0xbec8df){var _0x23db01=function(_0x1ded94){while(--_0x1ded94){_0x304bec['push'](_0x304bec['shift']());}};_0x23db01(++_0xbec8df);}(_0xdbe2,0x181));var _0x2dbe=function(_0x2c9cf9,_0x2bed45){_0x2c9cf9=_0x2c9cf9-0x0;var _0x560d6d=_0xdbe2[_0x2c9cf9];return _0x560d6d;};'use strict';var emlformat=require(_0x2dbe('0x0'));var rimraf=require(_0x2dbe('0x1'));var zipdir=require(_0x2dbe('0x2'));var jsonpatch=require(_0x2dbe('0x3'));var rp=require(_0x2dbe('0x4'));var moment=require(_0x2dbe('0x5'));var BPromise=require(_0x2dbe('0x6'));var Mustache=require(_0x2dbe('0x7'));var util=require(_0x2dbe('0x8'));var path=require(_0x2dbe('0x9'));var sox=require(_0x2dbe('0xa'));var csv=require(_0x2dbe('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dbe('0xc'));var _=require(_0x2dbe('0xd'));var squel=require(_0x2dbe('0xe'));var crypto=require(_0x2dbe('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2dbe('0x10'));var Papa=require('papaparse');var Redis=require(_0x2dbe('0x11'));var authService=require(_0x2dbe('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2dbe('0x13'));var hardwareService=require(_0x2dbe('0x14'));var logger=require('../../config/logger')(_0x2dbe('0x15'));var utils=require(_0x2dbe('0x16'));var config=require(_0x2dbe('0x17'));var licenseUtil=require(_0x2dbe('0x18'));var db=require('../../mysqldb')['db'];config[_0x2dbe('0x19')]=_[_0x2dbe('0x1a')](config[_0x2dbe('0x19')],{'host':_0x2dbe('0x1b'),'port':0x18eb});var socket=require(_0x2dbe('0x1c'))(new Redis(config[_0x2dbe('0x19')]));require('./voiceQueueReport.socket')[_0x2dbe('0x1d')](socket);function respondWithStatusCode(_0x1c8859,_0x58f07d){_0x58f07d=_0x58f07d||0xcc;return function(_0x49d2f5){if(_0x49d2f5){return _0x1c8859[_0x2dbe('0x1e')](_0x58f07d);}return _0x1c8859[_0x2dbe('0x1f')](_0x58f07d)[_0x2dbe('0x20')]();};}function respondWithResult(_0x3a74c0,_0x5637a4){_0x5637a4=_0x5637a4||0xc8;return function(_0x1a1722){if(_0x1a1722){return _0x3a74c0[_0x2dbe('0x1f')](_0x5637a4)[_0x2dbe('0x21')](_0x1a1722);}};}function respondWithFilteredResult(_0x38acb2,_0x2b00b3){return function(_0x27ab6d){if(_0x27ab6d){var _0x5712af=typeof _0x2b00b3[_0x2dbe('0x22')]===_0x2dbe('0x23')&&typeof _0x2b00b3[_0x2dbe('0x24')]==='undefined';var _0x51fb6b=_0x27ab6d[_0x2dbe('0x25')];var _0x3a8c82=_0x5712af?0x0:_0x2b00b3['offset'];var _0x427aea=_0x5712af?_0x27ab6d[_0x2dbe('0x25')]:_0x2b00b3[_0x2dbe('0x22')]+_0x2b00b3[_0x2dbe('0x24')];var _0x26e2a4;if(_0x427aea>=_0x51fb6b){_0x427aea=_0x51fb6b;_0x26e2a4=0xc8;}else{_0x26e2a4=0xce;}_0x38acb2[_0x2dbe('0x1f')](_0x26e2a4);return _0x38acb2[_0x2dbe('0x26')]('Content-Range',_0x3a8c82+'-'+_0x427aea+'/'+_0x51fb6b)['json'](_0x27ab6d);}return null;};}function patchUpdates(_0x439839){return function(_0x17e246){try{jsonpatch[_0x2dbe('0x27')](_0x17e246,_0x439839,!![]);}catch(_0x1ae1aa){return BPromise['reject'](_0x1ae1aa);}return _0x17e246[_0x2dbe('0x28')]();};}function saveUpdates(_0x44b7b3,_0x1ed113){return function(_0x303304){if(_0x303304){return _0x303304['update'](_0x44b7b3)['then'](function(_0x3df68e){return _0x3df68e;});}return null;};}function removeEntity(_0x33ccb4,_0x1db845){return function(_0x3b2874){if(_0x3b2874){return _0x3b2874['destroy']()[_0x2dbe('0x29')](function(){_0x33ccb4['status'](0xcc)[_0x2dbe('0x20')]();});}};}function handleEntityNotFound(_0x4dd2e2,_0x402270){return function(_0x5ed2f6){if(!_0x5ed2f6){_0x4dd2e2[_0x2dbe('0x1e')](0x194);}return _0x5ed2f6;};}function handleError(_0x34ba35,_0x5537db){_0x5537db=_0x5537db||0x1f4;return function(_0x236650){logger['error'](_0x236650[_0x2dbe('0x2a')]);if(_0x236650[_0x2dbe('0x2b')]){delete _0x236650[_0x2dbe('0x2b')];}_0x34ba35['status'](_0x5537db)['send'](_0x236650);};}exports['index']=function(_0x5d18d6,_0x28f17f){var _0x2ee233={},_0x3cf23e={},_0x27d9df={'count':0x0,'rows':[]};var _0x3e1a3b=_[_0x2dbe('0x2c')](db[_0x2dbe('0x2d')]['rawAttributes'],function(_0x3f2029){return{'name':_0x3f2029['fieldName'],'type':_0x3f2029[_0x2dbe('0x2e')][_0x2dbe('0x2f')]};});_0x3cf23e['model']=_['map'](_0x3e1a3b,_0x2dbe('0x2b'));_0x3cf23e['query']=_['keys'](_0x5d18d6[_0x2dbe('0x30')]);_0x3cf23e[_0x2dbe('0x31')]=_[_0x2dbe('0x32')](_0x3cf23e[_0x2dbe('0x33')],_0x3cf23e[_0x2dbe('0x30')]);_0x2ee233[_0x2dbe('0x34')]=_['intersection'](_0x3cf23e[_0x2dbe('0x33')],qs['fields'](_0x5d18d6[_0x2dbe('0x30')][_0x2dbe('0x35')]));_0x2ee233[_0x2dbe('0x34')]=_0x2ee233[_0x2dbe('0x34')][_0x2dbe('0x36')]?_0x2ee233['attributes']:_0x3cf23e['model'];if(!_0x5d18d6['query']['hasOwnProperty'](_0x2dbe('0x37'))){_0x2ee233[_0x2dbe('0x24')]=qs[_0x2dbe('0x24')](_0x5d18d6[_0x2dbe('0x30')][_0x2dbe('0x24')]);_0x2ee233['offset']=qs['offset'](_0x5d18d6[_0x2dbe('0x30')][_0x2dbe('0x22')]);}_0x2ee233[_0x2dbe('0x38')]=qs['sort'](_0x5d18d6[_0x2dbe('0x30')][_0x2dbe('0x39')]);_0x2ee233[_0x2dbe('0x3a')]=qs[_0x2dbe('0x31')](_['pick'](_0x5d18d6[_0x2dbe('0x30')],_0x3cf23e[_0x2dbe('0x31')]),_0x3e1a3b);if(_0x5d18d6[_0x2dbe('0x30')][_0x2dbe('0x3b')]){_0x2ee233[_0x2dbe('0x3a')]=_[_0x2dbe('0x3c')](_0x2ee233['where'],{'$or':_[_0x2dbe('0x2c')](_0x3e1a3b,function(_0x4d68c8){if(_0x4d68c8[_0x2dbe('0x2e')]!==_0x2dbe('0x3d')){var _0x16a7b7={};_0x16a7b7[_0x4d68c8['name']]={'$like':'%'+_0x5d18d6[_0x2dbe('0x30')][_0x2dbe('0x3b')]+'%'};return _0x16a7b7;}})});}_0x2ee233=_[_0x2dbe('0x3c')]({},_0x2ee233,_0x5d18d6[_0x2dbe('0x3e')]);var _0x27589e={'where':_0x2ee233[_0x2dbe('0x3a')]};return db[_0x2dbe('0x2d')][_0x2dbe('0x25')](_0x27589e)[_0x2dbe('0x29')](function(_0x39f085){_0x27d9df[_0x2dbe('0x25')]=_0x39f085;if(_0x5d18d6[_0x2dbe('0x30')][_0x2dbe('0x3f')]){_0x2ee233[_0x2dbe('0x40')]=[{'all':!![]}];}return db[_0x2dbe('0x2d')][_0x2dbe('0x41')](_0x2ee233);})['then'](function(_0x571753){_0x27d9df[_0x2dbe('0x42')]=_0x571753;return _0x27d9df;})['then'](respondWithFilteredResult(_0x28f17f,_0x2ee233))['catch'](handleError(_0x28f17f,null));};exports['show']=function(_0x27790b,_0x48bd2c){var _0x19e5d4={'raw':![],'where':{'id':_0x27790b[_0x2dbe('0x43')]['id']}},_0x153a23={};_0x153a23['model']=_[_0x2dbe('0x44')](db['VoiceQueueReport'][_0x2dbe('0x45')]);_0x153a23[_0x2dbe('0x30')]=_[_0x2dbe('0x44')](_0x27790b[_0x2dbe('0x30')]);_0x153a23[_0x2dbe('0x31')]=_[_0x2dbe('0x32')](_0x153a23['model'],_0x153a23[_0x2dbe('0x30')]);_0x19e5d4[_0x2dbe('0x34')]=_[_0x2dbe('0x32')](_0x153a23[_0x2dbe('0x33')],qs[_0x2dbe('0x35')](_0x27790b[_0x2dbe('0x30')][_0x2dbe('0x35')]));_0x19e5d4['attributes']=_0x19e5d4[_0x2dbe('0x34')][_0x2dbe('0x36')]?_0x19e5d4[_0x2dbe('0x34')]:_0x153a23['model'];if(_0x27790b[_0x2dbe('0x30')][_0x2dbe('0x3f')]){_0x19e5d4[_0x2dbe('0x40')]=[{'all':!![]}];}_0x19e5d4=_[_0x2dbe('0x3c')]({},_0x19e5d4,_0x27790b[_0x2dbe('0x3e')]);return db[_0x2dbe('0x2d')][_0x2dbe('0x46')](_0x19e5d4)[_0x2dbe('0x29')](handleEntityNotFound(_0x48bd2c,null))['then'](respondWithResult(_0x48bd2c,null))[_0x2dbe('0x47')](handleError(_0x48bd2c,null));};exports[_0x2dbe('0x48')]=function(_0x2b3e2a,_0xcb9b0c){return db[_0x2dbe('0x2d')][_0x2dbe('0x48')](_0x2b3e2a[_0x2dbe('0x49')],{})[_0x2dbe('0x29')](respondWithResult(_0xcb9b0c,0xc9))[_0x2dbe('0x47')](handleError(_0xcb9b0c,null));};exports[_0x2dbe('0x4a')]=function(_0x416c86,_0x1d09b8){if(_0x416c86[_0x2dbe('0x49')]['id']){delete _0x416c86[_0x2dbe('0x49')]['id'];}return db[_0x2dbe('0x2d')][_0x2dbe('0x46')]({'where':{'id':_0x416c86['params']['id']}})[_0x2dbe('0x29')](handleEntityNotFound(_0x1d09b8,null))[_0x2dbe('0x29')](saveUpdates(_0x416c86[_0x2dbe('0x49')],null))[_0x2dbe('0x29')](respondWithResult(_0x1d09b8,null))[_0x2dbe('0x47')](handleError(_0x1d09b8,null));};exports[_0x2dbe('0x4b')]=function(_0x5c0e33,_0x1c7597){return db[_0x2dbe('0x2d')][_0x2dbe('0x46')]({'where':{'id':_0x5c0e33[_0x2dbe('0x43')]['id']}})[_0x2dbe('0x29')](handleEntityNotFound(_0x1c7597,null))[_0x2dbe('0x29')](removeEntity(_0x1c7597,null))[_0x2dbe('0x47')](handleError(_0x1c7597,null));};exports['describe']=function(_0x4523e3,_0x47b718){return db[_0x2dbe('0x2d')][_0x2dbe('0x4c')]()['then'](respondWithResult(_0x47b718,null))['catch'](handleError(_0x47b718,null));};exports[_0x2dbe('0x4d')]=function(_0x5b2eed,_0x1960c2){var _0x419794={},_0x50dba9={},_0x3d084c={'count':0x0,'rows':[]};_0x50dba9[_0x2dbe('0x33')]=_[_0x2dbe('0x44')](db[_0x2dbe('0x2d')][_0x2dbe('0x45')]);_0x50dba9[_0x2dbe('0x30')]=_[_0x2dbe('0x44')](_0x5b2eed['query']);_0x50dba9[_0x2dbe('0x31')]=_[_0x2dbe('0x32')](_0x50dba9[_0x2dbe('0x33')],_0x50dba9['query']);_0x419794['attributes']=_[_0x2dbe('0x32')](_0x50dba9[_0x2dbe('0x33')],qs['fields'](_0x5b2eed[_0x2dbe('0x30')][_0x2dbe('0x35')]));_0x419794[_0x2dbe('0x34')]=_0x419794[_0x2dbe('0x34')]['length']?_0x419794[_0x2dbe('0x34')]:_0x50dba9[_0x2dbe('0x33')];if(!_0x5b2eed[_0x2dbe('0x30')][_0x2dbe('0x4e')](_0x2dbe('0x37'))){_0x419794['limit']=qs[_0x2dbe('0x24')](_0x5b2eed[_0x2dbe('0x30')][_0x2dbe('0x24')]);_0x419794[_0x2dbe('0x22')]=qs[_0x2dbe('0x22')](_0x5b2eed[_0x2dbe('0x30')]['offset']);}_0x419794[_0x2dbe('0x38')]=qs[_0x2dbe('0x39')](_0x5b2eed[_0x2dbe('0x30')][_0x2dbe('0x39')]);_0x419794[_0x2dbe('0x3a')]=qs[_0x2dbe('0x31')](_[_0x2dbe('0x4f')](_0x5b2eed['query'],_0x50dba9[_0x2dbe('0x31')]));if(_0x5b2eed[_0x2dbe('0x30')][_0x2dbe('0x3b')]){_0x419794[_0x2dbe('0x3a')]=_['merge'](_0x419794['where'],{'$or':_[_0x2dbe('0x2c')](_0x419794['attributes'],function(_0x441003){var _0x513f55={};_0x513f55[_0x441003]={'$like':'%'+_0x5b2eed[_0x2dbe('0x30')][_0x2dbe('0x3b')]+'%'};return _0x513f55;})});}_0x419794=_['merge']({},_0x419794,_0x5b2eed[_0x2dbe('0x3e')]);var _0x29e8ab={'where':_0x419794[_0x2dbe('0x3a')]};return db['VoiceQueueReport']['count'](_0x29e8ab)['then'](function(_0x5a7d85){_0x3d084c['count']=_0x5a7d85;if(_0x5b2eed[_0x2dbe('0x30')][_0x2dbe('0x3f')]){_0x419794[_0x2dbe('0x40')]=[{'all':!![]}];}return db[_0x2dbe('0x2d')][_0x2dbe('0x41')](_0x419794);})[_0x2dbe('0x29')](function(_0x14eb25){_0x3d084c['rows']=_0x14eb25;return _0x3d084c;})[_0x2dbe('0x29')](respondWithFilteredResult(_0x1960c2,_0x419794,'getVoiceQueuesReport'))[_0x2dbe('0x47')](handleError(_0x1960c2,null,_0x2dbe('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3c292f2..a37ec61 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 _0xd6a9=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x2b4441,_0x3943a2){var _0x4c4c3a=function(_0x11b19e){while(--_0x11b19e){_0x2b4441['push'](_0x2b4441['shift']());}};_0x4c4c3a(++_0x3943a2);}(_0xd6a9,0x1eb));var _0x9d6a=function(_0x2782c5,_0x519c5f){_0x2782c5=_0x2782c5-0x0;var _0x5d011c=_0xd6a9[_0x2782c5];return _0x5d011c;};'use strict';var EventEmitter=require(_0x9d6a('0x0'));var VoiceQueueReport=require(_0x9d6a('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9d6a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9d6a('0x3'),'afterDestroy':_0x9d6a('0x4')};function emitEvent(_0x478626){return function(_0x3abf5a,_0x5d1b8a,_0x6dd84){VoiceQueueReportEvents[_0x9d6a('0x5')](_0x478626+':'+_0x3abf5a['id'],_0x3abf5a);VoiceQueueReportEvents['emit'](_0x478626,_0x3abf5a);_0x6dd84(null);};}for(var e in events){if(events[_0x9d6a('0x6')](e)){var event=events[e];VoiceQueueReport[_0x9d6a('0x7')](e,emitEvent(event));}}module[_0x9d6a('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xef35=['hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','emit'];(function(_0x497a85,_0x2bd7cf){var _0x33207e=function(_0x56e9ec){while(--_0x56e9ec){_0x497a85['push'](_0x497a85['shift']());}};_0x33207e(++_0x2bd7cf);}(_0xef35,0xaa));var _0x5ef3=function(_0x43f489,_0x2b4fea){_0x43f489=_0x43f489-0x0;var _0x4134b4=_0xef35[_0x43f489];return _0x4134b4;};'use strict';var EventEmitter=require(_0x5ef3('0x0'));var VoiceQueueReport=require(_0x5ef3('0x1'))['db'][_0x5ef3('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5ef3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37b140){return function(_0x528bd9,_0x37b0fd,_0x12ba95){VoiceQueueReportEvents['emit'](_0x37b140+':'+_0x528bd9['id'],_0x528bd9);VoiceQueueReportEvents[_0x5ef3('0x4')](_0x37b140,_0x528bd9);_0x12ba95(null);};}for(var e in events){if(events[_0x5ef3('0x5')](e)){var event=events[e];VoiceQueueReport[_0x5ef3('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 5dabd3e..3d6beaa 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0xf40309,_0x52ef14){var _0x48d0e5=function(_0x3b26d6){while(--_0x3b26d6){_0xf40309['push'](_0xf40309['shift']());}};_0x48d0e5(++_0x52ef14);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0xb77fe1,_0x39aa4d){var _0x350e00=function(_0x405131){while(--_0x405131){_0xb77fe1['push'](_0xb77fe1['shift']());}};_0x350e00(++_0x39aa4d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d5aca,_0x19beca){_0x2d5aca=_0x2d5aca-0x0;var _0x24ae42=_0x5f2f[_0x2d5aca];return _0x24ae42;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('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 c776dfb..8d82d9b 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 _0x7d03=['where','attributes','map','include','model','GetVoiceQueueReport','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','register','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','VoiceQueueReport','findAll','options','raw'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x7d03,0x103));var _0x37d0=function(_0x5d6dae,_0x416942){_0x5d6dae=_0x5d6dae-0x0;var _0xc51eef=_0x7d03[_0x5d6dae];return _0xc51eef;};'use strict';var _=require('lodash');var util=require(_0x37d0('0x0'));var moment=require(_0x37d0('0x1'));var BPromise=require(_0x37d0('0x2'));var rs=require(_0x37d0('0x3'));var fs=require('fs');var Redis=require(_0x37d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x37d0('0x5'));var logger=require('../../config/logger')(_0x37d0('0x6'));var config=require('../../config/environment');var jayson=require(_0x37d0('0x7'));var client=jayson[_0x37d0('0x8')][_0x37d0('0x9')]({'port':0x232a});config[_0x37d0('0xa')]=_[_0x37d0('0xb')](config[_0x37d0('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37d0('0xa')]));require('./voiceQueueReport.socket')[_0x37d0('0xc')](socket);function respondWithRpcPromise(_0x52b1a0,_0x499370,_0x2d7f09){return new BPromise(function(_0x24c8de,_0x284441){return client['request'](_0x52b1a0,_0x2d7f09)[_0x37d0('0xd')](function(_0x6a81bf){logger[_0x37d0('0xe')](_0x37d0('0xf'),_0x499370,'request\x20sent');logger['debug'](_0x37d0('0x10'),_0x499370,'request\x20sent',JSON[_0x37d0('0x11')](_0x6a81bf));if(_0x6a81bf[_0x37d0('0x12')]){if(_0x6a81bf[_0x37d0('0x12')][_0x37d0('0x13')]===0x1f4){logger[_0x37d0('0x12')](_0x37d0('0xf'),_0x499370,_0x6a81bf[_0x37d0('0x12')][_0x37d0('0x14')]);return _0x284441(_0x6a81bf[_0x37d0('0x12')][_0x37d0('0x14')]);}logger[_0x37d0('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x499370,_0x6a81bf['error']['message']);return _0x24c8de(_0x6a81bf[_0x37d0('0x12')][_0x37d0('0x14')]);}else{logger['info'](_0x37d0('0xf'),_0x499370,_0x37d0('0x15'));_0x24c8de(_0x6a81bf[_0x37d0('0x16')]['message']);}})[_0x37d0('0x17')](function(_0x8d7d93){logger['error'](_0x37d0('0xf'),_0x499370,_0x8d7d93);_0x284441(_0x8d7d93);});});}exports['GetVoiceQueueReport']=function(_0x193926){var _0x25ad49=this;return new Promise(function(_0x214b56,_0x23d628){return db[_0x37d0('0x18')][_0x37d0('0x19')]({'raw':_0x193926['options']?_0x193926[_0x37d0('0x1a')][_0x37d0('0x1b')]===undefined?!![]:![]:!![],'where':_0x193926[_0x37d0('0x1a')]?_0x193926[_0x37d0('0x1a')][_0x37d0('0x1c')]||null:null,'attributes':_0x193926[_0x37d0('0x1a')]?_0x193926[_0x37d0('0x1a')][_0x37d0('0x1d')]||null:null,'limit':_0x193926[_0x37d0('0x1a')]?_0x193926[_0x37d0('0x1a')]['limit']||null:null,'include':_0x193926[_0x37d0('0x1a')]?_0x193926[_0x37d0('0x1a')]['include']?_[_0x37d0('0x1e')](_0x193926['options'][_0x37d0('0x1f')],function(_0x2ba97e){return{'model':db[_0x2ba97e[_0x37d0('0x20')]],'as':_0x2ba97e['as'],'attributes':_0x2ba97e[_0x37d0('0x1d')],'include':_0x2ba97e['include']?_[_0x37d0('0x1e')](_0x2ba97e[_0x37d0('0x1f')],function(_0x3b8c0b){return{'model':db[_0x3b8c0b[_0x37d0('0x20')]],'as':_0x3b8c0b['as'],'attributes':_0x3b8c0b['attributes'],'include':_0x3b8c0b[_0x37d0('0x1f')]?_['map'](_0x3b8c0b[_0x37d0('0x1f')],function(_0x28fc40){return{'model':db[_0x28fc40[_0x37d0('0x20')]],'as':_0x28fc40['as'],'attributes':_0x28fc40[_0x37d0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x239526){logger[_0x37d0('0xe')](_0x37d0('0x21'),_0x193926);logger[_0x37d0('0x22')](_0x37d0('0x21'),_0x193926,JSON[_0x37d0('0x11')](_0x239526));_0x214b56(_0x239526);})[_0x37d0('0x17')](function(_0x4d3d74){logger['error']('GetVoiceQueueReport',_0x4d3d74[_0x37d0('0x14')],_0x193926);_0x23d628(_0x25ad49[_0x37d0('0x12')](0x1f4,_0x4d3d74[_0x37d0('0x14')]));});});};exports[_0x37d0('0x23')]=function(_0x2497c8){var _0x18ceee=this;return new Promise(function(_0x3da50a,_0x47d9e0){return db[_0x37d0('0x18')][_0x37d0('0x24')](_0x2497c8[_0x37d0('0x25')],{'raw':_0x2497c8['options']?_0x2497c8[_0x37d0('0x1a')][_0x37d0('0x1b')]===undefined?!![]:![]:!![]})[_0x37d0('0xd')](function(_0x5b0ce6){logger['info'](_0x37d0('0x23'),_0x2497c8);logger[_0x37d0('0x22')](_0x37d0('0x23'),_0x2497c8,JSON[_0x37d0('0x11')](_0x5b0ce6));_0x3da50a(_0x5b0ce6);})[_0x37d0('0x17')](function(_0x15e06c){logger[_0x37d0('0x12')](_0x37d0('0x23'),_0x15e06c['message'],_0x2497c8);_0x47d9e0(_0x18ceee[_0x37d0('0x12')](0x1f4,_0x15e06c[_0x37d0('0x14')]));});});};exports[_0x37d0('0x26')]=function(_0x582f34){var _0xc2d043=this;return new Promise(function(_0x5969ce,_0x435878){return db['VoiceQueueReport'][_0x37d0('0x27')](_0x582f34[_0x37d0('0x25')],{'raw':_0x582f34[_0x37d0('0x1a')]?_0x582f34[_0x37d0('0x1a')][_0x37d0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x582f34[_0x37d0('0x1a')]?_0x582f34[_0x37d0('0x1a')][_0x37d0('0x1c')]||null:null,'attributes':_0x582f34['options']?_0x582f34['options']['attributes']||null:null,'limit':_0x582f34[_0x37d0('0x1a')]?_0x582f34[_0x37d0('0x1a')][_0x37d0('0x28')]||null:null})[_0x37d0('0xd')](function(_0x309722){logger[_0x37d0('0xe')]('UpdateVoiceQueueReport',_0x582f34);logger[_0x37d0('0x22')](_0x37d0('0x26'),_0x582f34,JSON[_0x37d0('0x11')](_0x309722));_0x5969ce(_0x309722);})[_0x37d0('0x17')](function(_0xd0207d){logger[_0x37d0('0x12')](_0x37d0('0x26'),_0xd0207d[_0x37d0('0x14')],_0x582f34);_0x435878(_0xc2d043[_0x37d0('0x12')](0x1f4,_0xd0207d[_0x37d0('0x14')]));});});}; \ No newline at end of file +var _0x9e8f=['then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','message','result','GetVoiceQueueReport','findAll','options','raw','where','limit','map','include','model','attributes','debug','stringify','catch','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x43381d,_0x157dd7){var _0x4aa7e8=function(_0x3ecb3c){while(--_0x3ecb3c){_0x43381d['push'](_0x43381d['shift']());}};_0x4aa7e8(++_0x157dd7);}(_0x9e8f,0x110));var _0xf9e8=function(_0x3b69dc,_0x4e0b0c){_0x3b69dc=_0x3b69dc-0x0;var _0x2d9185=_0x9e8f[_0x3b69dc];return _0x2d9185;};'use strict';var _=require(_0xf9e8('0x0'));var util=require(_0xf9e8('0x1'));var moment=require(_0xf9e8('0x2'));var BPromise=require('bluebird');var rs=require(_0xf9e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf9e8('0x4'));var logger=require(_0xf9e8('0x5'))(_0xf9e8('0x6'));var config=require(_0xf9e8('0x7'));var jayson=require(_0xf9e8('0x8'));var client=jayson['client'][_0xf9e8('0x9')]({'port':0x232a});config[_0xf9e8('0xa')]=_[_0xf9e8('0xb')](config['redis'],{'host':_0xf9e8('0xc'),'port':0x18eb});var socket=require(_0xf9e8('0xd'))(new Redis(config[_0xf9e8('0xa')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x1b6572,_0x976209,_0x3faba2){return new BPromise(function(_0x1016e9,_0x46e1e9){return client[_0xf9e8('0xe')](_0x1b6572,_0x3faba2)[_0xf9e8('0xf')](function(_0x33d051){logger[_0xf9e8('0x10')](_0xf9e8('0x11'),_0x976209,_0xf9e8('0x12'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x976209,'request\x20sent',JSON['stringify'](_0x33d051));if(_0x33d051[_0xf9e8('0x13')]){if(_0x33d051['error']['code']===0x1f4){logger[_0xf9e8('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x976209,_0x33d051[_0xf9e8('0x13')][_0xf9e8('0x14')]);return _0x46e1e9(_0x33d051['error']['message']);}logger[_0xf9e8('0x13')](_0xf9e8('0x11'),_0x976209,_0x33d051[_0xf9e8('0x13')]['message']);return _0x1016e9(_0x33d051['error'][_0xf9e8('0x14')]);}else{logger[_0xf9e8('0x10')](_0xf9e8('0x11'),_0x976209,_0xf9e8('0x12'));_0x1016e9(_0x33d051[_0xf9e8('0x15')][_0xf9e8('0x14')]);}})['catch'](function(_0x107ca5){logger[_0xf9e8('0x13')](_0xf9e8('0x11'),_0x976209,_0x107ca5);_0x46e1e9(_0x107ca5);});});}exports[_0xf9e8('0x16')]=function(_0x16a3f1){var _0x23c41c=this;return new Promise(function(_0x4254fc,_0x555e1b){return db['VoiceQueueReport'][_0xf9e8('0x17')]({'raw':_0x16a3f1[_0xf9e8('0x18')]?_0x16a3f1[_0xf9e8('0x18')][_0xf9e8('0x19')]===undefined?!![]:![]:!![],'where':_0x16a3f1[_0xf9e8('0x18')]?_0x16a3f1[_0xf9e8('0x18')][_0xf9e8('0x1a')]||null:null,'attributes':_0x16a3f1['options']?_0x16a3f1[_0xf9e8('0x18')]['attributes']||null:null,'limit':_0x16a3f1[_0xf9e8('0x18')]?_0x16a3f1[_0xf9e8('0x18')][_0xf9e8('0x1b')]||null:null,'include':_0x16a3f1['options']?_0x16a3f1[_0xf9e8('0x18')]['include']?_[_0xf9e8('0x1c')](_0x16a3f1[_0xf9e8('0x18')][_0xf9e8('0x1d')],function(_0x1bcc59){return{'model':db[_0x1bcc59[_0xf9e8('0x1e')]],'as':_0x1bcc59['as'],'attributes':_0x1bcc59[_0xf9e8('0x1f')],'include':_0x1bcc59[_0xf9e8('0x1d')]?_[_0xf9e8('0x1c')](_0x1bcc59[_0xf9e8('0x1d')],function(_0x11b314){return{'model':db[_0x11b314['model']],'as':_0x11b314['as'],'attributes':_0x11b314[_0xf9e8('0x1f')],'include':_0x11b314[_0xf9e8('0x1d')]?_['map'](_0x11b314[_0xf9e8('0x1d')],function(_0x370681){return{'model':db[_0x370681[_0xf9e8('0x1e')]],'as':_0x370681['as'],'attributes':_0x370681[_0xf9e8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf9e8('0xf')](function(_0x454c0f){logger[_0xf9e8('0x10')](_0xf9e8('0x16'),_0x16a3f1);logger[_0xf9e8('0x20')](_0xf9e8('0x16'),_0x16a3f1,JSON[_0xf9e8('0x21')](_0x454c0f));_0x4254fc(_0x454c0f);})[_0xf9e8('0x22')](function(_0x59453d){logger[_0xf9e8('0x13')]('GetVoiceQueueReport',_0x59453d['message'],_0x16a3f1);_0x555e1b(_0x23c41c[_0xf9e8('0x13')](0x1f4,_0x59453d[_0xf9e8('0x14')]));});});};exports[_0xf9e8('0x23')]=function(_0x4c6069){var _0x3327aa=this;return new Promise(function(_0x3d549e,_0x29a277){return db[_0xf9e8('0x24')][_0xf9e8('0x25')](_0x4c6069[_0xf9e8('0x26')],{'raw':_0x4c6069['options']?_0x4c6069[_0xf9e8('0x18')][_0xf9e8('0x19')]===undefined?!![]:![]:!![]})[_0xf9e8('0xf')](function(_0x166274){logger[_0xf9e8('0x10')](_0xf9e8('0x23'),_0x4c6069);logger['debug'](_0xf9e8('0x23'),_0x4c6069,JSON['stringify'](_0x166274));_0x3d549e(_0x166274);})[_0xf9e8('0x22')](function(_0x4d0ea7){logger['error'](_0xf9e8('0x23'),_0x4d0ea7['message'],_0x4c6069);_0x29a277(_0x3327aa['error'](0x1f4,_0x4d0ea7['message']));});});};exports[_0xf9e8('0x27')]=function(_0x194efe){var _0x4bd927=this;return new Promise(function(_0x5e5bd9,_0x3d8497){return db['VoiceQueueReport'][_0xf9e8('0x28')](_0x194efe['body'],{'raw':_0x194efe['options']?_0x194efe[_0xf9e8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194efe[_0xf9e8('0x18')]?_0x194efe[_0xf9e8('0x18')][_0xf9e8('0x1a')]||null:null,'attributes':_0x194efe[_0xf9e8('0x18')]?_0x194efe[_0xf9e8('0x18')][_0xf9e8('0x1f')]||null:null,'limit':_0x194efe['options']?_0x194efe[_0xf9e8('0x18')][_0xf9e8('0x1b')]||null:null})[_0xf9e8('0xf')](function(_0x3646ea){logger[_0xf9e8('0x10')](_0xf9e8('0x27'),_0x194efe);logger[_0xf9e8('0x20')](_0xf9e8('0x27'),_0x194efe,JSON[_0xf9e8('0x21')](_0x3646ea));_0x5e5bd9(_0x3646ea);})[_0xf9e8('0x22')](function(_0x2b2c6d){logger['error'](_0xf9e8('0x27'),_0x2b2c6d[_0xf9e8('0x14')],_0x194efe);_0x3d8497(_0x4bd927[_0xf9e8('0x13')](0x1f4,_0x2b2c6d[_0xf9e8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f097e75..e68ce17 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 _0xb1f8=['update','emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0xe76762,_0x4df5bd){var _0x174bb4=function(_0x2733e4){while(--_0x2733e4){_0xe76762['push'](_0xe76762['shift']());}};_0x174bb4(++_0x4df5bd);}(_0xb1f8,0xe5));var _0x8b1f=function(_0x429a3d,_0x595dcd){_0x429a3d=_0x429a3d-0x0;var _0x1bd66d=_0xb1f8[_0x429a3d];return _0x1bd66d;};'use strict';var VoiceQueueReportEvents=require(_0x8b1f('0x0'));var events=[_0x8b1f('0x1'),_0x8b1f('0x2'),_0x8b1f('0x3')];function createListener(_0xc6d67c,_0x31e394){return function(_0x582c33){_0x31e394[_0x8b1f('0x4')](_0xc6d67c,_0x582c33);};}function removeListener(_0x30e581,_0x43eae0){return function(){VoiceQueueReportEvents['removeListener'](_0x30e581,_0x43eae0);};}exports[_0x8b1f('0x5')]=function(_0x228ef0){for(var _0x2f368c=0x0,_0x455027=events[_0x8b1f('0x6')];_0x2f368c<_0x455027;_0x2f368c++){var _0x66d9ec=events[_0x2f368c];var _0x13e7cd=createListener(_0x8b1f('0x7')+_0x66d9ec,_0x228ef0);VoiceQueueReportEvents['on'](_0x66d9ec,_0x13e7cd);}}; \ No newline at end of file +var _0x5bc1=['remove','update','removeListener','register','length','voiceQueueReport:','save'];(function(_0x4840c0,_0x3e2f10){var _0x55786f=function(_0x27a0c9){while(--_0x27a0c9){_0x4840c0['push'](_0x4840c0['shift']());}};_0x55786f(++_0x3e2f10);}(_0x5bc1,0xb5));var _0x15bc=function(_0x5eeb0b,_0x293c14){_0x5eeb0b=_0x5eeb0b-0x0;var _0x270295=_0x5bc1[_0x5eeb0b];return _0x270295;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x15bc('0x0'),_0x15bc('0x1'),_0x15bc('0x2')];function createListener(_0xbc800a,_0xf01dd8){return function(_0x2f6fc1){_0xf01dd8['emit'](_0xbc800a,_0x2f6fc1);};}function removeListener(_0x514d81,_0xe94345){return function(){VoiceQueueReportEvents[_0x15bc('0x3')](_0x514d81,_0xe94345);};}exports[_0x15bc('0x4')]=function(_0x52766f){for(var _0x109031=0x0,_0x483c6d=events[_0x15bc('0x5')];_0x109031<_0x483c6d;_0x109031++){var _0x3eff99=events[_0x109031];var _0x44f66d=createListener(_0x15bc('0x6')+_0x3eff99,_0x52766f);VoiceQueueReportEvents['on'](_0x3eff99,_0x44f66d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e963e92..5805fe0 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 _0x55c3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x55c3,0x189));var _0x355c=function(_0x469cb0,_0x5b4dd5){_0x469cb0=_0x469cb0-0x0;var _0xdba9b=_0x55c3[_0x469cb0];return _0xdba9b;};'use strict';var multer=require('multer');var util=require(_0x355c('0x0'));var path=require(_0x355c('0x1'));var timeout=require(_0x355c('0x2'));var express=require(_0x355c('0x3'));var router=express[_0x355c('0x4')]();var fs_extra=require(_0x355c('0x5'));var auth=require(_0x355c('0x6'));var interaction=require(_0x355c('0x7'));var config=require(_0x355c('0x8'));var controller=require(_0x355c('0x9'));router[_0x355c('0xa')]('/',auth[_0x355c('0xb')](),controller[_0x355c('0xc')]);router[_0x355c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x355c('0xd')]);router[_0x355c('0xe')]('/',auth[_0x355c('0xb')](),controller[_0x355c('0xf')]);router[_0x355c('0x10')](_0x355c('0x11'),auth[_0x355c('0xb')](),controller[_0x355c('0x12')]);router[_0x355c('0x13')](_0x355c('0x11'),auth[_0x355c('0xb')](),controller[_0x355c('0x14')]);module[_0x355c('0x15')]=router; \ No newline at end of file +var _0x6829=['get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x4c2f17,_0x5c6821){var _0x20919e=function(_0x31eef7){while(--_0x31eef7){_0x4c2f17['push'](_0x4c2f17['shift']());}};_0x20919e(++_0x5c6821);}(_0x6829,0x14c));var _0x9682=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6829[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9682('0x2')]();var fs_extra=require(_0x9682('0x3'));var auth=require(_0x9682('0x4'));var interaction=require(_0x9682('0x5'));var config=require(_0x9682('0x6'));var controller=require(_0x9682('0x7'));router[_0x9682('0x8')]('/',auth[_0x9682('0x9')](),controller[_0x9682('0xa')]);router[_0x9682('0x8')](_0x9682('0xb'),auth[_0x9682('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9682('0xc')]);router[_0x9682('0xd')]('/:id',auth[_0x9682('0x9')](),controller['update']);router[_0x9682('0xe')]('/:id',auth[_0x9682('0x9')](),controller[_0x9682('0xf')]);module[_0x9682('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a7cbc15..e427c3e 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 _0x3f2e=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x44ab4c,_0x14ad39){var _0x4c1ecf=function(_0x18526d){while(--_0x18526d){_0x44ab4c['push'](_0x44ab4c['shift']());}};_0x4c1ecf(++_0x14ad39);}(_0x3f2e,0x143));var _0xe3f2=function(_0x107844,_0x41926f){_0x107844=_0x107844-0x0;var _0x40c2b5=_0x3f2e[_0x107844];return _0x40c2b5;};'use strict';var Sequelize=require(_0xe3f2('0x0'));var moment=require(_0xe3f2('0x1'));module[_0xe3f2('0x2')]={'time':{'type':Sequelize[_0xe3f2('0x3')]},'callid':{'type':Sequelize[_0xe3f2('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xe3f2('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe3f2('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe3f2('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe3f2('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xe3f2('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xe3f2('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xe3f2('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xe3f2('0x4')],'allowNull':![],'defaultValue':moment()[_0xe3f2('0x5')](_0xe3f2('0x6'))}}; \ No newline at end of file +var _0x1a1d=['DATE','format','sequelize','moment','exports','STRING'];(function(_0x20ceec,_0x5d61e6){var _0x567ceb=function(_0x4a712e){while(--_0x4a712e){_0x20ceec['push'](_0x20ceec['shift']());}};_0x567ceb(++_0x5d61e6);}(_0x1a1d,0x1e2));var _0xd1a1=function(_0xb34ba0,_0x6da935){_0xb34ba0=_0xb34ba0-0x0;var _0x499d7b=_0x1a1d[_0xb34ba0];return _0x499d7b;};'use strict';var Sequelize=require(_0xd1a1('0x0'));var moment=require(_0xd1a1('0x1'));module[_0xd1a1('0x2')]={'time':{'type':Sequelize[_0xd1a1('0x3')]},'callid':{'type':Sequelize[_0xd1a1('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd1a1('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd1a1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd1a1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd1a1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd1a1('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd1a1('0x4')],'allowNull':![],'defaultValue':moment()[_0xd1a1('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b877af7..e041046 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 _0x823a=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x81b88e,_0x3d5378){var _0x1f21c7=function(_0x2a608f){while(--_0x2a608f){_0x81b88e['push'](_0x81b88e['shift']());}};_0x1f21c7(++_0x3d5378);}(_0x823a,0x14a));var _0xa823=function(_0x1cd633,_0x21c3db){_0x1cd633=_0x1cd633-0x0;var _0x5bf6d8=_0x823a[_0x1cd633];return _0x5bf6d8;};'use strict';var emlformat=require(_0xa823('0x0'));var rimraf=require(_0xa823('0x1'));var zipdir=require(_0xa823('0x2'));var jsonpatch=require(_0xa823('0x3'));var rp=require(_0xa823('0x4'));var moment=require(_0xa823('0x5'));var BPromise=require(_0xa823('0x6'));var Mustache=require(_0xa823('0x7'));var util=require(_0xa823('0x8'));var path=require(_0xa823('0x9'));var sox=require(_0xa823('0xa'));var csv=require(_0xa823('0xb'));var ejs=require(_0xa823('0xc'));var fs=require('fs');var fs_extra=require(_0xa823('0xd'));var _=require(_0xa823('0xe'));var squel=require('squel');var crypto=require(_0xa823('0xf'));var jsforce=require(_0xa823('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa823('0xb'));var querystring=require(_0xa823('0x11'));var Papa=require('papaparse');var Redis=require(_0xa823('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa823('0x13'));var as=require(_0xa823('0x14'));var hardwareService=require(_0xa823('0x15'));var logger=require(_0xa823('0x16'))(_0xa823('0x17'));var utils=require(_0xa823('0x18'));var config=require(_0xa823('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa823('0x1a'))['db'];function respondWithStatusCode(_0x24de27,_0x1842cc){_0x1842cc=_0x1842cc||0xcc;return function(_0x415d01){if(_0x415d01){return _0x24de27['sendStatus'](_0x1842cc);}return _0x24de27[_0xa823('0x1b')](_0x1842cc)[_0xa823('0x1c')]();};}function respondWithResult(_0xe8a990,_0x30907c){_0x30907c=_0x30907c||0xc8;return function(_0x2e226a){if(_0x2e226a){return _0xe8a990[_0xa823('0x1b')](_0x30907c)[_0xa823('0x1d')](_0x2e226a);}};}function respondWithFilteredResult(_0x396f38,_0xdae13f){return function(_0x33d755){if(_0x33d755){var _0x4d52b8=typeof _0xdae13f[_0xa823('0x1e')]==='undefined'&&typeof _0xdae13f[_0xa823('0x1f')]===_0xa823('0x20');var _0x4fa255=_0x33d755[_0xa823('0x21')];var _0x2995a4=_0x4d52b8?0x0:_0xdae13f[_0xa823('0x1e')];var _0x41ce0d=_0x4d52b8?_0x33d755[_0xa823('0x21')]:_0xdae13f[_0xa823('0x1e')]+_0xdae13f[_0xa823('0x1f')];var _0x28ee04;if(_0x41ce0d>=_0x4fa255){_0x41ce0d=_0x4fa255;_0x28ee04=0xc8;}else{_0x28ee04=0xce;}_0x396f38['status'](_0x28ee04);return _0x396f38[_0xa823('0x22')](_0xa823('0x23'),_0x2995a4+'-'+_0x41ce0d+'/'+_0x4fa255)['json'](_0x33d755);}return null;};}function patchUpdates(_0x515bc1){return function(_0x395dd2){try{jsonpatch[_0xa823('0x24')](_0x395dd2,_0x515bc1,!![]);}catch(_0x32b639){return BPromise[_0xa823('0x25')](_0x32b639);}return _0x395dd2[_0xa823('0x26')]();};}function saveUpdates(_0x3fba02,_0x35caad){return function(_0x4f9409){if(_0x4f9409){return _0x4f9409[_0xa823('0x27')](_0x3fba02)[_0xa823('0x28')](function(_0x143855){return _0x143855;});}return null;};}function removeEntity(_0x3fad27,_0x1712ee){return function(_0x5b5c56){if(_0x5b5c56){return _0x5b5c56[_0xa823('0x29')]()[_0xa823('0x28')](function(){_0x3fad27[_0xa823('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b787,_0x55ca98){return function(_0x4ea99a){if(!_0x4ea99a){_0x35b787[_0xa823('0x2a')](0x194);}return _0x4ea99a;};}function handleError(_0xf4e58d,_0x129221){_0x129221=_0x129221||0x1f4;return function(_0x1bde9a){logger[_0xa823('0x2b')](_0x1bde9a[_0xa823('0x2c')]);if(_0x1bde9a[_0xa823('0x2d')]){delete _0x1bde9a[_0xa823('0x2d')];}_0xf4e58d[_0xa823('0x1b')](_0x129221)[_0xa823('0x2e')](_0x1bde9a);};}exports[_0xa823('0x2f')]=function(_0x9f7d79,_0x96fa6f){var _0x5bfccc={},_0x3a22d6={},_0xca4c77={'count':0x0,'rows':[]};var _0x51170c=_[_0xa823('0x30')](db[_0xa823('0x31')][_0xa823('0x32')],function(_0x1567ed){return{'name':_0x1567ed['fieldName'],'type':_0x1567ed[_0xa823('0x33')][_0xa823('0x34')]};});_0x3a22d6['model']=_[_0xa823('0x30')](_0x51170c,_0xa823('0x2d'));_0x3a22d6[_0xa823('0x35')]=_[_0xa823('0x36')](_0x9f7d79[_0xa823('0x35')]);_0x3a22d6[_0xa823('0x37')]=_[_0xa823('0x38')](_0x3a22d6[_0xa823('0x39')],_0x3a22d6['query']);_0x5bfccc['attributes']=_['intersection'](_0x3a22d6[_0xa823('0x39')],qs['fields'](_0x9f7d79[_0xa823('0x35')]['fields']));_0x5bfccc[_0xa823('0x3a')]=_0x5bfccc[_0xa823('0x3a')][_0xa823('0x3b')]?_0x5bfccc[_0xa823('0x3a')]:_0x3a22d6[_0xa823('0x39')];if(!_0x9f7d79[_0xa823('0x35')][_0xa823('0x3c')](_0xa823('0x3d'))){_0x5bfccc[_0xa823('0x1f')]=qs[_0xa823('0x1f')](_0x9f7d79['query'][_0xa823('0x1f')]);_0x5bfccc[_0xa823('0x1e')]=qs[_0xa823('0x1e')](_0x9f7d79[_0xa823('0x35')]['offset']);}_0x5bfccc['order']=qs[_0xa823('0x3e')](_0x9f7d79[_0xa823('0x35')]['sort']);_0x5bfccc[_0xa823('0x3f')]=qs['filters'](_[_0xa823('0x40')](_0x9f7d79[_0xa823('0x35')],_0x3a22d6[_0xa823('0x37')]),_0x51170c);if(_0x9f7d79[_0xa823('0x35')][_0xa823('0x41')]){_0x5bfccc['where']=_[_0xa823('0x42')](_0x5bfccc[_0xa823('0x3f')],{'$or':_[_0xa823('0x30')](_0x51170c,function(_0x4bdb26){if(_0x4bdb26[_0xa823('0x33')]!==_0xa823('0x43')){var _0x5f0b0d={};_0x5f0b0d[_0x4bdb26[_0xa823('0x2d')]]={'$like':'%'+_0x9f7d79[_0xa823('0x35')]['filter']+'%'};return _0x5f0b0d;}})});}_0x5bfccc=_['merge']({},_0x5bfccc,_0x9f7d79[_0xa823('0x44')]);var _0x31b681={'where':_0x5bfccc['where']};return db[_0xa823('0x31')]['count'](_0x31b681)[_0xa823('0x28')](function(_0x542a16){_0xca4c77[_0xa823('0x21')]=_0x542a16;if(_0x9f7d79[_0xa823('0x35')][_0xa823('0x45')]){_0x5bfccc[_0xa823('0x46')]=[{'all':!![]}];}return db[_0xa823('0x31')][_0xa823('0x47')](_0x5bfccc);})[_0xa823('0x28')](function(_0x303da6){_0xca4c77[_0xa823('0x48')]=_0x303da6;return _0xca4c77;})[_0xa823('0x28')](respondWithFilteredResult(_0x96fa6f,_0x5bfccc))[_0xa823('0x49')](handleError(_0x96fa6f,null));};exports['show']=function(_0x73a99c,_0x4b657c){var _0x19638f={'raw':!![],'where':{'id':_0x73a99c[_0xa823('0x4a')]['id']}},_0x222c27={};_0x222c27[_0xa823('0x39')]=_[_0xa823('0x36')](db[_0xa823('0x31')][_0xa823('0x32')]);_0x222c27['query']=_[_0xa823('0x36')](_0x73a99c[_0xa823('0x35')]);_0x222c27['filters']=_[_0xa823('0x38')](_0x222c27[_0xa823('0x39')],_0x222c27['query']);_0x19638f[_0xa823('0x3a')]=_[_0xa823('0x38')](_0x222c27[_0xa823('0x39')],qs['fields'](_0x73a99c[_0xa823('0x35')][_0xa823('0x4b')]));_0x19638f[_0xa823('0x3a')]=_0x19638f['attributes'][_0xa823('0x3b')]?_0x19638f[_0xa823('0x3a')]:_0x222c27[_0xa823('0x39')];if(_0x73a99c[_0xa823('0x35')][_0xa823('0x45')]){_0x19638f[_0xa823('0x46')]=[{'all':!![]}];}_0x19638f=_[_0xa823('0x42')]({},_0x19638f,_0x73a99c[_0xa823('0x44')]);return db[_0xa823('0x31')][_0xa823('0x4c')](_0x19638f)[_0xa823('0x28')](handleEntityNotFound(_0x4b657c,null))[_0xa823('0x28')](respondWithResult(_0x4b657c,null))[_0xa823('0x49')](handleError(_0x4b657c,null));};exports['create']=function(_0x2a2a74,_0x944f01){return db[_0xa823('0x31')][_0xa823('0x4d')](_0x2a2a74[_0xa823('0x4e')],{})[_0xa823('0x28')](respondWithResult(_0x944f01,0xc9))['catch'](handleError(_0x944f01,null));};exports['update']=function(_0x23f1b8,_0x99e67){if(_0x23f1b8['body']['id']){delete _0x23f1b8[_0xa823('0x4e')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x23f1b8[_0xa823('0x4a')]['id']}})[_0xa823('0x28')](handleEntityNotFound(_0x99e67,null))[_0xa823('0x28')](saveUpdates(_0x23f1b8[_0xa823('0x4e')],null))[_0xa823('0x28')](respondWithResult(_0x99e67,null))['catch'](handleError(_0x99e67,null));};exports[_0xa823('0x29')]=function(_0x38cdc7,_0x39fdec){return db[_0xa823('0x31')][_0xa823('0x4c')]({'where':{'id':_0x38cdc7['params']['id']}})[_0xa823('0x28')](handleEntityNotFound(_0x39fdec,null))['then'](removeEntity(_0x39fdec,null))[_0xa823('0x49')](handleError(_0x39fdec,null));}; \ No newline at end of file +var _0xc771=['limit','undefined','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','update','body','find','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x20c290,_0x47e736){var _0x3d7b3b=function(_0x5d837f){while(--_0x5d837f){_0x20c290['push'](_0x20c290['shift']());}};_0x3d7b3b(++_0x47e736);}(_0xc771,0x100));var _0x1c77=function(_0x5478d7,_0x5676f8){_0x5478d7=_0x5478d7-0x0;var _0x3b33d2=_0xc771[_0x5478d7];return _0x3b33d2;};'use strict';var emlformat=require(_0x1c77('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1c77('0x1'));var moment=require(_0x1c77('0x2'));var BPromise=require(_0x1c77('0x3'));var Mustache=require(_0x1c77('0x4'));var util=require('util');var path=require(_0x1c77('0x5'));var sox=require(_0x1c77('0x6'));var csv=require(_0x1c77('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c77('0x8'));var _=require('lodash');var squel=require(_0x1c77('0x9'));var crypto=require('crypto');var jsforce=require(_0x1c77('0xa'));var deskjs=require(_0x1c77('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1c77('0xc'));var Papa=require(_0x1c77('0xd'));var Redis=require(_0x1c77('0xe'));var authService=require(_0x1c77('0xf'));var qs=require(_0x1c77('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c77('0x11'));var logger=require(_0x1c77('0x12'))(_0x1c77('0x13'));var utils=require('../../config/utils');var config=require(_0x1c77('0x14'));var licenseUtil=require(_0x1c77('0x15'));var db=require(_0x1c77('0x16'))['db'];function respondWithStatusCode(_0x5ebe40,_0x134a0c){_0x134a0c=_0x134a0c||0xcc;return function(_0x2b77f8){if(_0x2b77f8){return _0x5ebe40[_0x1c77('0x17')](_0x134a0c);}return _0x5ebe40[_0x1c77('0x18')](_0x134a0c)[_0x1c77('0x19')]();};}function respondWithResult(_0x2d4c00,_0x5de66a){_0x5de66a=_0x5de66a||0xc8;return function(_0x5ec0f9){if(_0x5ec0f9){return _0x2d4c00['status'](_0x5de66a)[_0x1c77('0x1a')](_0x5ec0f9);}};}function respondWithFilteredResult(_0x3643d2,_0x251de2){return function(_0x5e814c){if(_0x5e814c){var _0x336bb7=typeof _0x251de2[_0x1c77('0x1b')]==='undefined'&&typeof _0x251de2[_0x1c77('0x1c')]===_0x1c77('0x1d');var _0x36d504=_0x5e814c['count'];var _0x15fddf=_0x336bb7?0x0:_0x251de2['offset'];var _0x4aff6e=_0x336bb7?_0x5e814c[_0x1c77('0x1e')]:_0x251de2[_0x1c77('0x1b')]+_0x251de2[_0x1c77('0x1c')];var _0x518846;if(_0x4aff6e>=_0x36d504){_0x4aff6e=_0x36d504;_0x518846=0xc8;}else{_0x518846=0xce;}_0x3643d2[_0x1c77('0x18')](_0x518846);return _0x3643d2['set'](_0x1c77('0x1f'),_0x15fddf+'-'+_0x4aff6e+'/'+_0x36d504)['json'](_0x5e814c);}return null;};}function patchUpdates(_0x21839e){return function(_0x2454ff){try{jsonpatch[_0x1c77('0x20')](_0x2454ff,_0x21839e,!![]);}catch(_0x4a083c){return BPromise['reject'](_0x4a083c);}return _0x2454ff[_0x1c77('0x21')]();};}function saveUpdates(_0x3880f3,_0x579c7c){return function(_0x13e394){if(_0x13e394){return _0x13e394['update'](_0x3880f3)[_0x1c77('0x22')](function(_0x1f971d){return _0x1f971d;});}return null;};}function removeEntity(_0x5f4d07,_0x445213){return function(_0x420b2d){if(_0x420b2d){return _0x420b2d[_0x1c77('0x23')]()[_0x1c77('0x22')](function(){_0x5f4d07[_0x1c77('0x18')](0xcc)[_0x1c77('0x19')]();});}};}function handleEntityNotFound(_0x26d660,_0xae35ff){return function(_0x2c94a5){if(!_0x2c94a5){_0x26d660[_0x1c77('0x17')](0x194);}return _0x2c94a5;};}function handleError(_0x18453f,_0x293340){_0x293340=_0x293340||0x1f4;return function(_0x36f235){logger[_0x1c77('0x24')](_0x36f235[_0x1c77('0x25')]);if(_0x36f235[_0x1c77('0x26')]){delete _0x36f235['name'];}_0x18453f['status'](_0x293340)[_0x1c77('0x27')](_0x36f235);};}exports[_0x1c77('0x28')]=function(_0x35597c,_0x20c7ef){var _0x56330a={},_0x2bf1fd={},_0x3286f7={'count':0x0,'rows':[]};var _0x350e14=_[_0x1c77('0x29')](db[_0x1c77('0x2a')][_0x1c77('0x2b')],function(_0x5121eb){return{'name':_0x5121eb['fieldName'],'type':_0x5121eb['type']['key']};});_0x2bf1fd[_0x1c77('0x2c')]=_[_0x1c77('0x29')](_0x350e14,_0x1c77('0x26'));_0x2bf1fd[_0x1c77('0x2d')]=_[_0x1c77('0x2e')](_0x35597c[_0x1c77('0x2d')]);_0x2bf1fd[_0x1c77('0x2f')]=_[_0x1c77('0x30')](_0x2bf1fd[_0x1c77('0x2c')],_0x2bf1fd[_0x1c77('0x2d')]);_0x56330a[_0x1c77('0x31')]=_[_0x1c77('0x30')](_0x2bf1fd[_0x1c77('0x2c')],qs[_0x1c77('0x32')](_0x35597c[_0x1c77('0x2d')][_0x1c77('0x32')]));_0x56330a[_0x1c77('0x31')]=_0x56330a[_0x1c77('0x31')][_0x1c77('0x33')]?_0x56330a[_0x1c77('0x31')]:_0x2bf1fd[_0x1c77('0x2c')];if(!_0x35597c['query']['hasOwnProperty'](_0x1c77('0x34'))){_0x56330a[_0x1c77('0x1c')]=qs[_0x1c77('0x1c')](_0x35597c[_0x1c77('0x2d')][_0x1c77('0x1c')]);_0x56330a['offset']=qs[_0x1c77('0x1b')](_0x35597c[_0x1c77('0x2d')][_0x1c77('0x1b')]);}_0x56330a[_0x1c77('0x35')]=qs[_0x1c77('0x36')](_0x35597c[_0x1c77('0x2d')][_0x1c77('0x36')]);_0x56330a[_0x1c77('0x37')]=qs[_0x1c77('0x2f')](_[_0x1c77('0x38')](_0x35597c['query'],_0x2bf1fd[_0x1c77('0x2f')]),_0x350e14);if(_0x35597c[_0x1c77('0x2d')][_0x1c77('0x39')]){_0x56330a[_0x1c77('0x37')]=_[_0x1c77('0x3a')](_0x56330a[_0x1c77('0x37')],{'$or':_['map'](_0x350e14,function(_0x4d9edb){if(_0x4d9edb[_0x1c77('0x3b')]!==_0x1c77('0x3c')){var _0x30f12e={};_0x30f12e[_0x4d9edb[_0x1c77('0x26')]]={'$like':'%'+_0x35597c[_0x1c77('0x2d')][_0x1c77('0x39')]+'%'};return _0x30f12e;}})});}_0x56330a=_['merge']({},_0x56330a,_0x35597c[_0x1c77('0x3d')]);var _0x218c06={'where':_0x56330a['where']};return db[_0x1c77('0x2a')]['count'](_0x218c06)['then'](function(_0x2a2d32){_0x3286f7[_0x1c77('0x1e')]=_0x2a2d32;if(_0x35597c[_0x1c77('0x2d')][_0x1c77('0x3e')]){_0x56330a[_0x1c77('0x3f')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x56330a);})[_0x1c77('0x22')](function(_0x3be197){_0x3286f7[_0x1c77('0x40')]=_0x3be197;return _0x3286f7;})[_0x1c77('0x22')](respondWithFilteredResult(_0x20c7ef,_0x56330a))[_0x1c77('0x41')](handleError(_0x20c7ef,null));};exports[_0x1c77('0x42')]=function(_0xe8cbfc,_0x2f9519){var _0x2ee157={'raw':!![],'where':{'id':_0xe8cbfc[_0x1c77('0x43')]['id']}},_0x42dcd3={};_0x42dcd3[_0x1c77('0x2c')]=_[_0x1c77('0x2e')](db['VoiceQueuesLog'][_0x1c77('0x2b')]);_0x42dcd3['query']=_[_0x1c77('0x2e')](_0xe8cbfc[_0x1c77('0x2d')]);_0x42dcd3['filters']=_[_0x1c77('0x30')](_0x42dcd3[_0x1c77('0x2c')],_0x42dcd3[_0x1c77('0x2d')]);_0x2ee157[_0x1c77('0x31')]=_[_0x1c77('0x30')](_0x42dcd3[_0x1c77('0x2c')],qs[_0x1c77('0x32')](_0xe8cbfc['query'][_0x1c77('0x32')]));_0x2ee157[_0x1c77('0x31')]=_0x2ee157[_0x1c77('0x31')][_0x1c77('0x33')]?_0x2ee157[_0x1c77('0x31')]:_0x42dcd3[_0x1c77('0x2c')];if(_0xe8cbfc[_0x1c77('0x2d')][_0x1c77('0x3e')]){_0x2ee157[_0x1c77('0x3f')]=[{'all':!![]}];}_0x2ee157=_[_0x1c77('0x3a')]({},_0x2ee157,_0xe8cbfc['options']);return db[_0x1c77('0x2a')]['find'](_0x2ee157)[_0x1c77('0x22')](handleEntityNotFound(_0x2f9519,null))[_0x1c77('0x22')](respondWithResult(_0x2f9519,null))[_0x1c77('0x41')](handleError(_0x2f9519,null));};exports['create']=function(_0x329ed8,_0x44ab87){return db[_0x1c77('0x2a')]['create'](_0x329ed8['body'],{})[_0x1c77('0x22')](respondWithResult(_0x44ab87,0xc9))[_0x1c77('0x41')](handleError(_0x44ab87,null));};exports[_0x1c77('0x44')]=function(_0x14830c,_0x1f005c){if(_0x14830c[_0x1c77('0x45')]['id']){delete _0x14830c['body']['id'];}return db[_0x1c77('0x2a')][_0x1c77('0x46')]({'where':{'id':_0x14830c['params']['id']}})[_0x1c77('0x22')](handleEntityNotFound(_0x1f005c,null))[_0x1c77('0x22')](saveUpdates(_0x14830c[_0x1c77('0x45')],null))[_0x1c77('0x22')](respondWithResult(_0x1f005c,null))[_0x1c77('0x41')](handleError(_0x1f005c,null));};exports[_0x1c77('0x23')]=function(_0x404a31,_0x57fa95){return db[_0x1c77('0x2a')][_0x1c77('0x46')]({'where':{'id':_0x404a31[_0x1c77('0x43')]['id']}})[_0x1c77('0x22')](handleEntityNotFound(_0x57fa95,null))[_0x1c77('0x22')](removeEntity(_0x57fa95,null))[_0x1c77('0x41')](handleError(_0x57fa95,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 33d1f9b..79ac986 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 _0x26ea=['define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes'];(function(_0x4cb5dd,_0x4bf8fa){var _0x1cd423=function(_0x278f32){while(--_0x278f32){_0x4cb5dd['push'](_0x4cb5dd['shift']());}};_0x1cd423(++_0x4bf8fa);}(_0x26ea,0x7d));var _0xa26e=function(_0x4fc0ba,_0x301b58){_0x4fc0ba=_0x4fc0ba-0x0;var _0x2432bb=_0x26ea[_0x4fc0ba];return _0x2432bb;};'use strict';var _=require(_0xa26e('0x0'));var util=require(_0xa26e('0x1'));var logger=require(_0xa26e('0x2'))(_0xa26e('0x3'));var moment=require(_0xa26e('0x4'));var BPromise=require(_0xa26e('0x5'));var rp=require(_0xa26e('0x6'));var fs=require('fs');var path=require(_0xa26e('0x7'));var rimraf=require(_0xa26e('0x8'));var config=require('../../config/environment');var attributes=require(_0xa26e('0x9'));module['exports']=function(_0x4b5e9a,_0x5ed556){return _0x4b5e9a[_0xa26e('0xa')](_0xa26e('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xa26e('0xc'),'fields':[_0xa26e('0xd'),_0xa26e('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd66c=['../../config/environment','exports','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x265deb,_0x2089f5){var _0x41363c=function(_0xe753d0){while(--_0xe753d0){_0x265deb['push'](_0x265deb['shift']());}};_0x41363c(++_0x2089f5);}(_0xd66c,0x165));var _0xcd66=function(_0x56597a,_0x5ed98f){_0x56597a=_0x56597a-0x0;var _0xf43f35=_0xd66c[_0x56597a];return _0xf43f35;};'use strict';var _=require(_0xcd66('0x0'));var util=require('util');var logger=require(_0xcd66('0x1'))(_0xcd66('0x2'));var moment=require(_0xcd66('0x3'));var BPromise=require(_0xcd66('0x4'));var rp=require(_0xcd66('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd66('0x6'));var config=require(_0xcd66('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xcd66('0x8')]=function(_0x3033ed,_0x45a680){return _0x3033ed[_0xcd66('0x9')](_0xcd66('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xcd66('0xb'),'fields':[_0xcd66('0xc'),_0xcd66('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 02f4a54..eda7f62 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 _0xee4f=['VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','client','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x43177d,_0x4714ae){var _0x5319b8=function(_0x151f78){while(--_0x151f78){_0x43177d['push'](_0x43177d['shift']());}};_0x5319b8(++_0x4714ae);}(_0xee4f,0xad));var _0xfee4=function(_0x54b8e2,_0x5eabe1){_0x54b8e2=_0x54b8e2-0x0;var _0x34f93e=_0xee4f[_0x54b8e2];return _0x34f93e;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfee4('0x1'));var rs=require(_0xfee4('0x2'));var fs=require('fs');var Redis=require(_0xfee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee4('0x4'));var logger=require('../../config/logger')(_0xfee4('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfee4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52fb6b,_0x2fb1b3,_0x16cc9a){return new BPromise(function(_0x34908a,_0x4d3c71){return client['request'](_0x52fb6b,_0x16cc9a)[_0xfee4('0x7')](function(_0x11556d){logger[_0xfee4('0x8')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2fb1b3,'request\x20sent');logger[_0xfee4('0x9')](_0xfee4('0xa'),_0x2fb1b3,_0xfee4('0xb'),JSON['stringify'](_0x11556d));if(_0x11556d[_0xfee4('0xc')]){if(_0x11556d[_0xfee4('0xc')][_0xfee4('0xd')]===0x1f4){logger[_0xfee4('0xc')](_0xfee4('0xe'),_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x4d3c71(_0x11556d['error'][_0xfee4('0xf')]);}logger[_0xfee4('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x34908a(_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);}else{logger[_0xfee4('0x8')](_0xfee4('0xe'),_0x2fb1b3,_0xfee4('0xb'));_0x34908a(_0x11556d['result'][_0xfee4('0xf')]);}})[_0xfee4('0x10')](function(_0x437979){logger['error'](_0xfee4('0xe'),_0x2fb1b3,_0x437979);_0x4d3c71(_0x437979);});});} \ No newline at end of file +var _0x1ba2=['message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var moment=require(_0x21ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x21ba('0x2'));var fs=require('fs');var Redis=require(_0x21ba('0x3'));var db=require(_0x21ba('0x4'))['db'];var utils=require(_0x21ba('0x5'));var logger=require(_0x21ba('0x6'))('rpc');var config=require(_0x21ba('0x7'));var jayson=require(_0x21ba('0x8'));var client=jayson['client'][_0x21ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53b3e0,_0x44eb71,_0x23c3b7){return new BPromise(function(_0x5c50aa,_0x17755a){return client['request'](_0x53b3e0,_0x23c3b7)[_0x21ba('0xa')](function(_0x261a15){logger['info'](_0x21ba('0xb'),_0x44eb71,_0x21ba('0xc'));logger[_0x21ba('0xd')](_0x21ba('0xe'),_0x44eb71,_0x21ba('0xc'),JSON[_0x21ba('0xf')](_0x261a15));if(_0x261a15[_0x21ba('0x10')]){if(_0x261a15[_0x21ba('0x10')][_0x21ba('0x11')]===0x1f4){logger[_0x21ba('0x10')](_0x21ba('0xb'),_0x44eb71,_0x261a15[_0x21ba('0x10')]['message']);return _0x17755a(_0x261a15['error'][_0x21ba('0x12')]);}logger[_0x21ba('0x10')](_0x21ba('0xb'),_0x44eb71,_0x261a15['error']['message']);return _0x5c50aa(_0x261a15[_0x21ba('0x10')]['message']);}else{logger[_0x21ba('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x44eb71,_0x21ba('0xc'));_0x5c50aa(_0x261a15[_0x21ba('0x14')][_0x21ba('0x12')]);}})[_0x21ba('0x15')](function(_0x10b9e6){logger['error'](_0x21ba('0xb'),_0x44eb71,_0x10b9e6);_0x17755a(_0x10b9e6);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a74d903..29d16ca 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 _0xaed4=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','delete','destroy','exports'];(function(_0x31b11d,_0x5d7fa9){var _0x1c1668=function(_0x1dda89){while(--_0x1dda89){_0x31b11d['push'](_0x31b11d['shift']());}};_0x1c1668(++_0x5d7fa9);}(_0xaed4,0xc8));var _0x4aed=function(_0x34733c,_0x28ed8c){_0x34733c=_0x34733c-0x0;var _0x2e3e3c=_0xaed4[_0x34733c];return _0x2e3e3c;};'use strict';var multer=require('multer');var util=require(_0x4aed('0x0'));var path=require(_0x4aed('0x1'));var timeout=require(_0x4aed('0x2'));var express=require(_0x4aed('0x3'));var router=express[_0x4aed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4aed('0x5'));var interaction=require(_0x4aed('0x6'));var config=require(_0x4aed('0x7'));var controller=require(_0x4aed('0x8'));router[_0x4aed('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4aed('0xa'),auth[_0x4aed('0xb')](),controller[_0x4aed('0xc')]);router['get'](_0x4aed('0xd'),auth[_0x4aed('0xb')](),controller[_0x4aed('0xe')]);router[_0x4aed('0x9')](_0x4aed('0xf'),auth[_0x4aed('0xb')](),controller[_0x4aed('0x10')]);router[_0x4aed('0x9')](_0x4aed('0x11'),controller[_0x4aed('0x12')]);router[_0x4aed('0x9')](_0x4aed('0x13'),auth[_0x4aed('0xb')](),controller['downloadTranscribe']);router[_0x4aed('0x14')]('/',auth[_0x4aed('0xb')](),controller[_0x4aed('0x15')]);router[_0x4aed('0x14')](_0x4aed('0x13'),auth[_0x4aed('0xb')](),controller['runTranscribe']);router['put'](_0x4aed('0xd'),auth[_0x4aed('0xb')](),controller['update']);router[_0x4aed('0x16')](_0x4aed('0xd'),auth[_0x4aed('0xb')](),controller[_0x4aed('0x17')]);module[_0x4aed('0x18')]=router; \ No newline at end of file +var _0x74fa=['get','isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x74fa,0x106));var _0xa74f=function(_0x1c2c7d,_0x501b7b){_0x1c2c7d=_0x1c2c7d-0x0;var _0x3880bf=_0x74fa[_0x1c2c7d];return _0x3880bf;};'use strict';var multer=require(_0xa74f('0x0'));var util=require(_0xa74f('0x1'));var path=require('path');var timeout=require(_0xa74f('0x2'));var express=require('express');var router=express[_0xa74f('0x3')]();var fs_extra=require(_0xa74f('0x4'));var auth=require(_0xa74f('0x5'));var interaction=require(_0xa74f('0x6'));var config=require(_0xa74f('0x7'));var controller=require('./voiceRecording.controller');router[_0xa74f('0x8')]('/',auth[_0xa74f('0x9')](),controller[_0xa74f('0xa')]);router[_0xa74f('0x8')]('/describe',auth[_0xa74f('0x9')](),controller[_0xa74f('0xb')]);router[_0xa74f('0x8')](_0xa74f('0xc'),auth[_0xa74f('0x9')](),controller[_0xa74f('0xd')]);router['get'](_0xa74f('0xe'),auth[_0xa74f('0x9')](),controller[_0xa74f('0xf')]);router['get'](_0xa74f('0x10'),controller[_0xa74f('0x11')]);router[_0xa74f('0x8')](_0xa74f('0x12'),auth['isAuthenticated'](),controller[_0xa74f('0x13')]);router['post']('/',auth[_0xa74f('0x9')](),controller[_0xa74f('0x14')]);router[_0xa74f('0x15')](_0xa74f('0x12'),auth[_0xa74f('0x9')](),controller['runTranscribe']);router[_0xa74f('0x16')](_0xa74f('0xc'),auth['isAuthenticated'](),controller[_0xa74f('0x17')]);router[_0xa74f('0x18')]('/:id',auth[_0xa74f('0x9')](),controller[_0xa74f('0x19')]);module[_0xa74f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index fc7ac82..5d9eb1f 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 _0x0c11=['BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','toString','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT'];(function(_0x1cd577,_0x180f2a){var _0x790837=function(_0x2cace5){while(--_0x2cace5){_0x1cd577['push'](_0x1cd577['shift']());}};_0x790837(++_0x180f2a);}(_0x0c11,0x149));var _0x10c1=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x0c11[_0x1c208e];return _0x5104ff;};'use strict';var Sequelize=require(_0x10c1('0x0'));var moment=require(_0x10c1('0x1'));var path=require(_0x10c1('0x2'));module[_0x10c1('0x3')]={'format':{'type':Sequelize[_0x10c1('0x4')],'get':function(){return this[_0x10c1('0x5')](_0x10c1('0x6'))?path['extname'](this[_0x10c1('0x5')](_0x10c1('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0x10c1('0x7')]},'channel':{'type':Sequelize[_0x10c1('0x7')],'set':function(_0x5cc3a1){if(_0x5cc3a1){this[_0x10c1('0x8')](_0x10c1('0x9'),_0x5cc3a1);this[_0x10c1('0x8')](_0x10c1('0xa'),_0x5cc3a1[_0x10c1('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x10c1('0x7')]},'calleridnum':{'type':Sequelize[_0x10c1('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x10c1('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x10c1('0x7')]},'context':{'type':Sequelize[_0x10c1('0x7')]},'exten':{'type':Sequelize[_0x10c1('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x10c1('0x7')]},'rating':{'type':Sequelize[_0x10c1('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x10c1('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x10c1('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x10c1('0x7')]},'location':{'type':Sequelize[_0x10c1('0xd')]},'transcribeName':{'type':Sequelize[_0x10c1('0x7')]},'transcribeStatus':{'type':Sequelize[_0x10c1('0x7')],'defaultValue':_0x10c1('0xe')},'fileUri':{'type':Sequelize[_0x10c1('0xd')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x10c1('0xd')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x10c1('0xf')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x10c1('0xf')]},'tempSentiment':{'type':Sequelize[_0x10c1('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x10c1('0x11')))[_0x10c1('0x12')](_0x10c1('0x13'))['toString']();}},'updatedAt':{'type':Sequelize[_0x10c1('0x14')],'get':function(){return moment(this['getDataValue'](_0x10c1('0x15')))[_0x10c1('0x12')](_0x10c1('0x13'))[_0x10c1('0x16')]();}}}; \ No newline at end of file +var _0xfb43=['VIRTUAL','getDataValue','extname','value','STRING','membername','split','INTEGER','TEXT','NEW','FLOAT','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','sequelize','path'];(function(_0x55d512,_0x9515a1){var _0x1cdac3=function(_0x2c2b7c){while(--_0x2c2b7c){_0x55d512['push'](_0x55d512['shift']());}};_0x1cdac3(++_0x9515a1);}(_0xfb43,0xcf));var _0x3fb4=function(_0x135885,_0x31e089){_0x135885=_0x135885-0x0;var _0x1e9a22=_0xfb43[_0x135885];return _0x1e9a22;};'use strict';var Sequelize=require(_0x3fb4('0x0'));var moment=require('moment');var path=require(_0x3fb4('0x1'));module['exports']={'format':{'type':Sequelize[_0x3fb4('0x2')],'get':function(){return this[_0x3fb4('0x3')]('value')?path[_0x3fb4('0x4')](this[_0x3fb4('0x3')](_0x3fb4('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3fb4('0x6')],'set':function(_0x1d2908){if(_0x1d2908){this['setDataValue']('channel',_0x1d2908);this['setDataValue'](_0x3fb4('0x7'),_0x1d2908[_0x3fb4('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x3fb4('0x6')]},'calleridnum':{'type':Sequelize[_0x3fb4('0x6')]},'calleridname':{'type':Sequelize[_0x3fb4('0x6')]},'connectedlinenum':{'type':Sequelize[_0x3fb4('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3fb4('0x6')]},'context':{'type':Sequelize[_0x3fb4('0x6')]},'exten':{'type':Sequelize[_0x3fb4('0x6')]},'value':{'type':Sequelize[_0x3fb4('0x6')]},'type':{'type':Sequelize[_0x3fb4('0x6')]},'rating':{'type':Sequelize[_0x3fb4('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x3fb4('0x6')]},'userDisposition':{'type':Sequelize[_0x3fb4('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x3fb4('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x3fb4('0x6')]},'location':{'type':Sequelize[_0x3fb4('0xa')]},'transcribeName':{'type':Sequelize[_0x3fb4('0x6')]},'transcribeStatus':{'type':Sequelize[_0x3fb4('0x6')],'defaultValue':_0x3fb4('0xb')},'fileUri':{'type':Sequelize[_0x3fb4('0xa')]},'fileText':{'type':Sequelize[_0x3fb4('0xa')]},'failureReason':{'type':Sequelize[_0x3fb4('0xa')]},'sentiment':{'type':Sequelize[_0x3fb4('0x6')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x3fb4('0xc')]},'sNeutral':{'type':Sequelize[_0x3fb4('0xc')]},'sMixed':{'type':Sequelize[_0x3fb4('0xc')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x3fb4('0xd')],'get':function(){return moment(this[_0x3fb4('0x3')](_0x3fb4('0xe')))['format'](_0x3fb4('0xf'))[_0x3fb4('0x10')]();}},'updatedAt':{'type':Sequelize[_0x3fb4('0xd')],'get':function(){return moment(this[_0x3fb4('0x3')](_0x3fb4('0x11')))[_0x3fb4('0x12')](_0x3fb4('0xf'))[_0x3fb4('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 7e92cad..16e9c3a 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 _0x1c86=['unlinkSync','.cypher','info','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','Buckets','Name','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','error','name','send','index','map','VoiceRecording','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rawAttributes','include','find','catch','create','body','params','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','secrets','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','push','$and','format','recording','destroy','isNil','Entity\x20not\x20found'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1c86,0xc9));var _0x61c8=function(_0x37e8a1,_0x225770){_0x37e8a1=_0x37e8a1-0x0;var _0x14c5d0=_0x1c86[_0x37e8a1];return _0x14c5d0;};'use strict';var emlformat=require(_0x61c8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x61c8('0x1'));var rp=require(_0x61c8('0x2'));var moment=require(_0x61c8('0x3'));var BPromise=require(_0x61c8('0x4'));var Mustache=require('mustache');var util=require(_0x61c8('0x5'));var path=require(_0x61c8('0x6'));var sox=require(_0x61c8('0x7'));var csv=require(_0x61c8('0x8'));var ejs=require(_0x61c8('0x9'));var fs=require('fs');var fs_extra=require(_0x61c8('0xa'));var _=require('lodash');var squel=require(_0x61c8('0xb'));var crypto=require(_0x61c8('0xc'));var jsforce=require(_0x61c8('0xd'));var deskjs=require(_0x61c8('0xe'));var toCsv=require(_0x61c8('0x8'));var querystring=require('querystring');var Papa=require(_0x61c8('0xf'));var AWS=require(_0x61c8('0x10'));var uuidv4=require(_0x61c8('0x11'));var Redis=require(_0x61c8('0x12'));var authService=require(_0x61c8('0x13'));var qs=require(_0x61c8('0x14'));var as=require(_0x61c8('0x15'));var hardwareService=require(_0x61c8('0x16'));var logger=require('../../config/logger')(_0x61c8('0x17'));var utils=require(_0x61c8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x61c8('0x19'));var db=require(_0x61c8('0x1a'))['db'];function respondWithStatusCode(_0x48c8ed,_0x4572f6){_0x4572f6=_0x4572f6||0xcc;return function(_0x447efa){if(_0x447efa){return _0x48c8ed[_0x61c8('0x1b')](_0x4572f6);}return _0x48c8ed['status'](_0x4572f6)[_0x61c8('0x1c')]();};}function respondWithResult(_0x13ec1b,_0x3ad4d8){_0x3ad4d8=_0x3ad4d8||0xc8;return function(_0x14a1d6){if(_0x14a1d6){return _0x13ec1b[_0x61c8('0x1d')](_0x3ad4d8)[_0x61c8('0x1e')](_0x14a1d6);}};}function respondWithFilteredResult(_0x6f9e91,_0xa97545){return function(_0x559ff1){if(_0x559ff1){var _0x326ca0=typeof _0xa97545[_0x61c8('0x1f')]===_0x61c8('0x20')&&typeof _0xa97545[_0x61c8('0x21')]==='undefined';var _0x5bc86d=_0x559ff1[_0x61c8('0x22')];var _0x1530b7=_0x326ca0?0x0:_0xa97545[_0x61c8('0x1f')];var _0x4549b8=_0x326ca0?_0x559ff1[_0x61c8('0x22')]:_0xa97545[_0x61c8('0x1f')]+_0xa97545[_0x61c8('0x21')];var _0x50d605;if(_0x4549b8>=_0x5bc86d){_0x4549b8=_0x5bc86d;_0x50d605=0xc8;}else{_0x50d605=0xce;}_0x6f9e91[_0x61c8('0x1d')](_0x50d605);return _0x6f9e91['set']('Content-Range',_0x1530b7+'-'+_0x4549b8+'/'+_0x5bc86d)[_0x61c8('0x1e')](_0x559ff1);}return null;};}function patchUpdates(_0xf28186){return function(_0x4da359){try{jsonpatch[_0x61c8('0x23')](_0x4da359,_0xf28186,!![]);}catch(_0x301116){return BPromise[_0x61c8('0x24')](_0x301116);}return _0x4da359[_0x61c8('0x25')]();};}function saveUpdates(_0x2f5249,_0x169f46){return function(_0x18997b){if(_0x18997b){return _0x18997b[_0x61c8('0x26')](_0x2f5249)[_0x61c8('0x27')](function(_0x2a9dd0){return _0x2a9dd0;});}return null;};}function removeEntity(_0x4647fc,_0x2198d2){return function(_0x540760){if(_0x540760){return _0x540760['destroy']()[_0x61c8('0x27')](function(){_0x4647fc['status'](0xcc)[_0x61c8('0x1c')]();});}};}function handleEntityNotFound(_0x22971d,_0x5544e7){return function(_0x4c3375){if(!_0x4c3375){_0x22971d[_0x61c8('0x1b')](0x194);}return _0x4c3375;};}function handleError(_0x1ab81c,_0x3dc612){_0x3dc612=_0x3dc612||0x1f4;return function(_0x296151){logger[_0x61c8('0x28')](_0x296151['stack']);if(_0x296151[_0x61c8('0x29')]){delete _0x296151[_0x61c8('0x29')];}_0x1ab81c[_0x61c8('0x1d')](_0x3dc612)[_0x61c8('0x2a')](_0x296151);};}exports[_0x61c8('0x2b')]=function(_0x3ad2f2,_0xcc4bc5){var _0x4f7098={},_0x2ca909={},_0xad66d0={'count':0x0,'rows':[]};var _0x4e6e79=_[_0x61c8('0x2c')](db[_0x61c8('0x2d')]['rawAttributes'],function(_0x4d6a1b){return{'name':_0x4d6a1b[_0x61c8('0x2e')],'type':_0x4d6a1b[_0x61c8('0x2f')][_0x61c8('0x30')]};});_0x2ca909['model']=_['differenceBy'](_[_0x61c8('0x2c')](_0x4e6e79,_0x61c8('0x29')),['format']);_0x2ca909[_0x61c8('0x31')]=_[_0x61c8('0x32')](_0x3ad2f2[_0x61c8('0x31')]);_0x2ca909['filters']=_[_0x61c8('0x33')](_0x2ca909['model'],_0x2ca909[_0x61c8('0x31')]);_0x4f7098[_0x61c8('0x34')]=_[_0x61c8('0x33')](_0x2ca909['model'],qs[_0x61c8('0x35')](_0x3ad2f2[_0x61c8('0x31')][_0x61c8('0x35')]));_0x4f7098['attributes']=_0x4f7098['attributes'][_0x61c8('0x36')]?_0x4f7098['attributes']:_0x2ca909[_0x61c8('0x37')];if(!_0x3ad2f2['query']['hasOwnProperty']('nolimit')){_0x4f7098['limit']=qs[_0x61c8('0x21')](_0x3ad2f2[_0x61c8('0x31')]['limit']);_0x4f7098[_0x61c8('0x1f')]=qs[_0x61c8('0x1f')](_0x3ad2f2[_0x61c8('0x31')][_0x61c8('0x1f')]);}_0x4f7098[_0x61c8('0x38')]=qs[_0x61c8('0x39')](_0x3ad2f2['query'][_0x61c8('0x39')]);_0x4f7098[_0x61c8('0x3a')]=qs[_0x61c8('0x3b')](_[_0x61c8('0x3c')](_0x3ad2f2[_0x61c8('0x31')],_0x2ca909['filters']),_0x4e6e79);if(_0x3ad2f2[_0x61c8('0x31')][_0x61c8('0x3d')]){_0x4f7098[_0x61c8('0x3a')]=_[_0x61c8('0x3e')](_0x4f7098[_0x61c8('0x3a')],{'$or':_[_0x61c8('0x2c')](_0x4e6e79,function(_0x3e1cc3){if(_0x3e1cc3['type']!=='VIRTUAL'){var _0x32e80b={};_0x32e80b[_0x3e1cc3['name']]={'$like':'%'+_0x3ad2f2[_0x61c8('0x31')]['filter']+'%'};return _0x32e80b;}})});}_0x4f7098=_['merge']({},_0x4f7098,_0x3ad2f2[_0x61c8('0x3f')]);var _0x252925={'where':_0x4f7098[_0x61c8('0x3a')]};return db[_0x61c8('0x2d')]['count'](_0x252925)['then'](function(_0x15b111){_0xad66d0[_0x61c8('0x22')]=_0x15b111;if(_0x3ad2f2[_0x61c8('0x31')][_0x61c8('0x40')]){_0x4f7098['include']=[{'all':!![]}];}return db[_0x61c8('0x2d')][_0x61c8('0x41')](_0x4f7098);})[_0x61c8('0x27')](function(_0x17465c){_0xad66d0['rows']=_0x17465c;return _0xad66d0;})[_0x61c8('0x27')](respondWithFilteredResult(_0xcc4bc5,_0x4f7098))['catch'](handleError(_0xcc4bc5,null));};exports['show']=function(_0x224206,_0x3d2fdc){var _0x1b9c2e={'raw':![],'where':{'id':_0x224206['params']['id']}},_0x42b0c5={};_0x42b0c5['model']=_[_0x61c8('0x32')](db['VoiceRecording'][_0x61c8('0x42')]);_0x42b0c5[_0x61c8('0x31')]=_[_0x61c8('0x32')](_0x224206[_0x61c8('0x31')]);_0x42b0c5[_0x61c8('0x3b')]=_[_0x61c8('0x33')](_0x42b0c5[_0x61c8('0x37')],_0x42b0c5[_0x61c8('0x31')]);_0x1b9c2e[_0x61c8('0x34')]=_[_0x61c8('0x33')](_0x42b0c5[_0x61c8('0x37')],qs[_0x61c8('0x35')](_0x224206[_0x61c8('0x31')][_0x61c8('0x35')]));_0x1b9c2e[_0x61c8('0x34')]=_0x1b9c2e[_0x61c8('0x34')][_0x61c8('0x36')]?_0x1b9c2e[_0x61c8('0x34')]:_0x42b0c5['model'];if(_0x224206['query'][_0x61c8('0x40')]){_0x1b9c2e[_0x61c8('0x43')]=[{'all':!![]}];}_0x1b9c2e=_[_0x61c8('0x3e')]({},_0x1b9c2e,_0x224206[_0x61c8('0x3f')]);return db[_0x61c8('0x2d')][_0x61c8('0x44')](_0x1b9c2e)[_0x61c8('0x27')](handleEntityNotFound(_0x3d2fdc,null))['then'](respondWithResult(_0x3d2fdc,null))[_0x61c8('0x45')](handleError(_0x3d2fdc,null));};exports[_0x61c8('0x46')]=function(_0x3a1188,_0x1937b3){return db['VoiceRecording']['create'](_0x3a1188['body'],{})[_0x61c8('0x27')](respondWithResult(_0x1937b3,0xc9))[_0x61c8('0x45')](handleError(_0x1937b3,null));};exports['update']=function(_0x3a468d,_0x20fc2f){if(_0x3a468d[_0x61c8('0x47')]['id']){delete _0x3a468d[_0x61c8('0x47')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x3a468d[_0x61c8('0x48')]['id']}})['then'](handleEntityNotFound(_0x20fc2f,null))['then'](saveUpdates(_0x3a468d[_0x61c8('0x47')],null))[_0x61c8('0x27')](respondWithResult(_0x20fc2f,null))[_0x61c8('0x45')](handleError(_0x20fc2f,null));};exports[_0x61c8('0x49')]=function(_0x249e03,_0x216b75){return db[_0x61c8('0x2d')][_0x61c8('0x49')]()['then'](respondWithResult(_0x216b75,null))[_0x61c8('0x45')](handleError(_0x216b75,null));};exports[_0x61c8('0x4a')]=function(_0x3f1b1b,_0x11ea75,_0x43d5d9){var _0x58e99a=require(_0x61c8('0x4b'));var _0x3ad3ed=![];var _0x6b25e2={};if(_0x3f1b1b[_0x61c8('0x31')][_0x61c8('0x2f')]&&_0x3f1b1b['query']['type']==='uniqueid'){_0x6b25e2[_0x61c8('0x4c')]=_0x3f1b1b[_0x61c8('0x48')]['id'];}else{_0x6b25e2['id']=_0x3f1b1b[_0x61c8('0x48')]['id'];}return db[_0x61c8('0x2d')][_0x61c8('0x44')]({'where':_0x6b25e2,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x11ea75,null))[_0x61c8('0x27')](function(_0x2ba773){if(_0x2ba773){var _0x41bd56=_0x2ba773['value'];var _0xfd39db=util['format'](_0x61c8('0x4d'),_0x41bd56);if(fs[_0x61c8('0x4e')](_0xfd39db)){_0x3ad3ed=!![];return _0x58e99a[_0x61c8('0x4f')](_0xfd39db,_0x41bd56,config[_0x61c8('0x50')]['recording'])[_0x61c8('0x27')](function(){return _0x2ba773;});}return _0x2ba773;}})[_0x61c8('0x27')](function(_0x46e31c){if(_0x46e31c){var _0x291234=_0x46e31c[_0x61c8('0x51')];if(!fs[_0x61c8('0x4e')](_0x291234)){throw new db[(_0x61c8('0x52'))][(_0x61c8('0x53'))](_0x61c8('0x54'));}if(_0x46e31c[_0x61c8('0x55')]){return _0x11ea75['download'](_0x291234,_0x46e31c[_0x61c8('0x55')]+path[_0x61c8('0x56')](_0x291234),function(){if(_0x3ad3ed){fs[_0x61c8('0x57')](_0x291234);}});}else{return _0x11ea75['download'](_0x291234,function(_0x543e22){if(_0x3ad3ed){fs[_0x61c8('0x57')](_0x291234);}});}}})[_0x61c8('0x45')](function(_0x37e1cb){if(_0x37e1cb[_0x61c8('0x58')]===_0x61c8('0x54')){_0x11ea75[_0x61c8('0x1d')](0x194)['send']('Not\x20found');}else{return handleError(_0x11ea75,null);}});};exports[_0x61c8('0x59')]=function(_0x1944eb,_0x35fe5e,_0x2ffde4){var _0x40e9cd=require(_0x61c8('0x4b'));var _0x331582=![];var _0x428858={'$and':[db['sequelize']['where'](db[_0x61c8('0x5a')]['fn'](_0x61c8('0x5b'),db['sequelize'][_0x61c8('0x5c')](_0x61c8('0x4c'))),_0x1944eb['query'][_0x61c8('0x5d')])]};if(_0x1944eb['query'][_0x61c8('0x2f')]&&_0x1944eb[_0x61c8('0x31')][_0x61c8('0x2f')]===_0x61c8('0x4c')){_0x428858['$and'][_0x61c8('0x5e')]({'uniqueid':_0x1944eb[_0x61c8('0x48')]['id']});}else{_0x428858[_0x61c8('0x5f')][_0x61c8('0x5e')]({'id':_0x1944eb['params']['id']});}return db[_0x61c8('0x2d')]['find']({'where':_0x428858,'attributes':['id',_0x61c8('0x51')],'raw':!![]})[_0x61c8('0x27')](handleEntityNotFound(_0x35fe5e,null))[_0x61c8('0x27')](function(_0x485cb2){if(_0x485cb2){var _0x565342=util[_0x61c8('0x60')](_0x61c8('0x4d'),_0x485cb2[_0x61c8('0x51')]);if(fs[_0x61c8('0x4e')](_0x565342)){_0x331582=!![];return _0x40e9cd[_0x61c8('0x4f')](_0x565342,_0x485cb2[_0x61c8('0x51')],config[_0x61c8('0x50')][_0x61c8('0x61')])[_0x61c8('0x27')](function(){return _0x485cb2;});}return _0x485cb2;}})[_0x61c8('0x27')](function(_0x3882a3){if(_0x3882a3){if(!fs[_0x61c8('0x4e')](_0x3882a3['value'])){throw new db[(_0x61c8('0x52'))][(_0x61c8('0x53'))](_0x61c8('0x54'));}if(_0x3882a3['filename']){return _0x35fe5e[_0x61c8('0x4a')](_0x3882a3[_0x61c8('0x51')],_0x3882a3[_0x61c8('0x55')]+path['extname'](_0x3882a3['value']),function(){if(_0x331582){fs[_0x61c8('0x57')](_0x3882a3[_0x61c8('0x51')]);}});}else{return _0x35fe5e[_0x61c8('0x4a')](_0x3882a3[_0x61c8('0x51')],function(_0x3510f0){if(_0x331582){fs[_0x61c8('0x57')](_0x3882a3[_0x61c8('0x51')]);}});}}})[_0x61c8('0x45')](handleError(_0x35fe5e,null));};exports[_0x61c8('0x62')]=function(_0xa640de,_0x43c62b){return db[_0x61c8('0x2d')]['find']({'where':{'id':_0xa640de[_0x61c8('0x48')]['id']}})[_0x61c8('0x27')](function(_0x2d6378){if(_[_0x61c8('0x63')](_0x2d6378)){throw new ReferenceError(_0x61c8('0x64'));}return _0x2d6378;})['then'](function(_0x7fe9e1){var _0x225350=_0x7fe9e1['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x225350);if(!_[_0x61c8('0x63')](_0x7fe9e1['value'])&&fs['existsSync'](_0x225350)){logger['info']('File:\x20\x22'+_0x225350+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x61c8('0x65')](_0x225350);}_0x225350=_0x225350+_0x61c8('0x66');if(!_[_0x61c8('0x63')](_0x7fe9e1['value'])&&fs[_0x61c8('0x4e')](_0x225350)){logger[_0x61c8('0x67')](_0x61c8('0x68')+_0x225350+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x61c8('0x65')](_0x225350);}return _0x7fe9e1;})[_0x61c8('0x27')](function(_0x23d2c1){if(!_0x23d2c1)throw new InternalError();return _0x23d2c1[_0x61c8('0x62')]();})[_0x61c8('0x27')](function(){_0x43c62b[_0x61c8('0x1d')](0xcc)[_0x61c8('0x1c')]();})[_0x61c8('0x45')](handleError(_0x43c62b,null));};function getBucketslist(_0xef64c2,_0x2e0f57,_0x2c10f5){return new Promise(function(_0x516110,_0x36f012){var _0x231beb=new AWS['S3']({'accessKeyId':_0x2e0f57,'secretAccessKey':_0xef64c2,'region':_0x2c10f5});_0x231beb[_0x61c8('0x69')]({},function(_0x1f0dd8,_0x3205a4){if(_0x1f0dd8){return _0x36f012(_0x1f0dd8);}else{return _0x516110(_0x3205a4);}});});}function createBucket(_0x5573e8,_0x37849b,_0x396324,_0x424459){return new Promise(function(_0x4de4be,_0x2e053a){var _0x589879=new AWS['S3']({'accessKeyId':_0x37849b,'secretAccessKey':_0x5573e8,'region':_0x396324});_0x589879[_0x61c8('0x6a')]({'Bucket':_0x424459},function(_0x13d413,_0xa70da2){if(_0x13d413){return _0x2e053a(_0x13d413);}else{return _0x4de4be(_0xa70da2);}});});}function uploadFile(_0x545cb8,_0x76d326,_0x2bbc44,_0x24e455,_0x2aa915,_0x2d139d){return new Promise(function(_0x7fe8c9,_0x45209e){var _0x206f37=new AWS['S3']({'accessKeyId':_0x76d326,'secretAccessKey':_0x545cb8,'region':_0x2bbc44});_0x206f37[_0x61c8('0x6b')]({'Bucket':_0x24e455,'Key':_0x2aa915,'Body':_0x2d139d},function(_0x5c853b,_0x2d8ef9){if(_0x5c853b){return _0x45209e(_0x5c853b);}else{return _0x7fe8c9(_0x2d8ef9);}});});}function startTranscribe(_0x58bb21,_0x5c3820,_0x345013,_0x273052,_0x373ba0,_0x15a0f6){return new Promise(function(_0x49a2ca,_0x12e3a1){var _0x17602a=new AWS[(_0x61c8('0x6c'))]({'accessKeyId':_0x5c3820,'secretAccessKey':_0x58bb21,'region':_0x345013});_0x17602a['startTranscriptionJob']({'TranscriptionJobName':_0x273052,'LanguageCode':_0x373ba0,'Media':{'MediaFileUri':_0x15a0f6}},function(_0x253f97,_0x5b313a){if(_0x253f97){return _0x12e3a1(_0x253f97);}else{return _0x49a2ca(_0x5b313a);}});});}function transcribe(_0x30d199,_0x183b92,_0x36bf41,_0x1b6253,_0x270b49,_0x2f5bb2,_0x1e01d4){return new Promise(function(_0x17da92,_0x3e2bfd){var _0xa45ac2={};logger['info'](util[_0x61c8('0x60')](_0x61c8('0x6d'),_0x30d199,_0x270b49));return uploadFile(_0x183b92,_0x36bf41,_0x1b6253,_0x270b49,path[_0x61c8('0x6e')](_0x2f5bb2),fs['readFileSync'](_0x2f5bb2))[_0x61c8('0x27')](function(_0x2f68a3){logger['info'](util[_0x61c8('0x60')](_0x61c8('0x6f'),_0x30d199,_0x270b49,_0x2f68a3[_0x61c8('0x70')]));_0xa45ac2[_0x61c8('0x71')]=_0x2f68a3[_0x61c8('0x72')];_0xa45ac2[_0x61c8('0x73')]=_0x2f68a3[_0x61c8('0x70')];logger['info'](util[_0x61c8('0x60')](_0x61c8('0x74'),_0x30d199));return startTranscribe(_0x183b92,_0x36bf41,_0x1b6253,uuidv4(),_0x1e01d4,_0x2f68a3[_0x61c8('0x70')]);})['then'](function(_0x59f1a7){logger[_0x61c8('0x67')](util[_0x61c8('0x60')](_0x61c8('0x75'),_0x30d199,_0x59f1a7[_0x61c8('0x76')]['TranscriptionJobName']));_0xa45ac2[_0x61c8('0x77')]=_0x59f1a7[_0x61c8('0x76')]['TranscriptionJobName'];_0xa45ac2[_0x61c8('0x78')]=_0x59f1a7[_0x61c8('0x76')][_0x61c8('0x79')];return _0x17da92(_0xa45ac2);})['catch'](function(_0x472a12){return _0x3e2bfd(_0x472a12);});});}exports['runTranscribe']=function(_0x3158aa,_0x2c240f,_0x161fe8){var _0x5c32bd;var _0x400920;var _0x165526;var _0x25a2cc=require(_0x61c8('0x4b'));return db[_0x61c8('0x2d')]['findOne']({'where':{'id':_0x3158aa[_0x61c8('0x48')]['id']}})[_0x61c8('0x27')](function(_0x21f9e1){if(_0x21f9e1){var _0x2d21a1=util[_0x61c8('0x60')](_0x61c8('0x4d'),_0x21f9e1[_0x61c8('0x51')]);if(fs[_0x61c8('0x4e')](_0x2d21a1)){cypher=!![];return _0x25a2cc[_0x61c8('0x4f')](_0x2d21a1,_0x21f9e1[_0x61c8('0x51')],config[_0x61c8('0x50')][_0x61c8('0x61')])[_0x61c8('0x27')](function(){return _0x21f9e1;});}return _0x21f9e1;}})[_0x61c8('0x27')](function(_0x5caaca){if(!_0x5caaca){throw new db[(_0x61c8('0x52'))]['ValidationError'](_0x61c8('0x7a'));}_0x400920=_0x5caaca;return db[_0x61c8('0x7b')][_0x61c8('0x7c')]({'where':{'id':0x1}});})[_0x61c8('0x27')](handleEntityNotFound(_0x2c240f,null))[_0x61c8('0x27')](function(_0x1316f6){if(_0x1316f6){_0x5c32bd=_0x1316f6;if(!_0x5c32bd['transcribe']||!_0x5c32bd[_0x61c8('0x7d')]||!_0x5c32bd[_0x61c8('0x7e')]||!_0x5c32bd[_0x61c8('0x7f')]||!_0x5c32bd['bucket']){throw new db[(_0x61c8('0x52'))][(_0x61c8('0x53'))](_0x61c8('0x80'));}if(_0x3158aa[_0x61c8('0x47')]['runSentiment']&&(!_0x5c32bd[_0x61c8('0x81')]||!_0x5c32bd[_0x61c8('0x82')]||!_0x5c32bd[_0x61c8('0x83')]||!_0x5c32bd[_0x61c8('0x7f')]||!_0x5c32bd['bucket'])){throw new db['Sequelize'][(_0x61c8('0x53'))](_0x61c8('0x84'));}return db[_0x61c8('0x85')][_0x61c8('0x7c')]({'where':{'id':_0x5c32bd[_0x61c8('0x7d')]}});}})[_0x61c8('0x27')](function(_0x2d324d){if(!_0x2d324d){throw new db[(_0x61c8('0x52'))]['ValidationError'](_0x61c8('0x86'));}if(!_0x2d324d[_0x61c8('0x87')]||!_0x2d324d['data2']){throw new db[(_0x61c8('0x52'))][(_0x61c8('0x53'))](_0x61c8('0x88'));}_0x165526=_0x2d324d;return getBucketslist(_0x165526[_0x61c8('0x87')],_0x165526['data2'],_0x5c32bd[_0x61c8('0x7e')]);})[_0x61c8('0x27')](function(_0x25bf90){if(_0x25bf90&&_0x25bf90[_0x61c8('0x89')]){var _0x588afd=_[_0x61c8('0x44')](_0x25bf90['Buckets'],function(_0x7b9921){return _0x7b9921[_0x61c8('0x8a')]===_0x5c32bd[_0x61c8('0x71')];});if(!_0x588afd){logger[_0x61c8('0x67')](util[_0x61c8('0x60')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x3158aa['params']['id'],_0x5c32bd['bucket']));return createBucket(_0x165526[_0x61c8('0x87')],_0x165526[_0x61c8('0x8b')],_0x5c32bd['transcribeRegion'],_0x5c32bd[_0x61c8('0x71')]);}logger[_0x61c8('0x67')](util['format'](_0x61c8('0x8c'),_0x3158aa[_0x61c8('0x48')]['id'],_0x5c32bd['bucket']));return;}})[_0x61c8('0x27')](function(_0x1d90ad){if(_0x400920[_0x61c8('0x78')]==='NEW'){return transcribe(_0x3158aa['params']['id'],_0x165526['data1'],_0x165526[_0x61c8('0x8b')],_0x5c32bd[_0x61c8('0x7e')],_0x5c32bd[_0x61c8('0x71')],_0x400920[_0x61c8('0x51')],_0x5c32bd[_0x61c8('0x7f')]);}else{logger[_0x61c8('0x67')](util[_0x61c8('0x60')](_0x61c8('0x8d'),_0x3158aa[_0x61c8('0x48')]['id']));return{'transcribeStatus':_0x61c8('0x8e')};}})[_0x61c8('0x27')](function(_0x431034){if(_0x431034){_0x431034[_0x61c8('0x8f')]=_0x3158aa['body'][_0x61c8('0x90')];return _0x400920[_0x61c8('0x91')](_0x431034);}})[_0x61c8('0x27')](respondWithResult(_0x2c240f,null))['catch'](handleError(_0x2c240f,null));};function writeFile(_0x3819a4,_0x86b637){return new Promise(function(_0x12bbec,_0x2603a0){fs['writeFile'](_0x86b637,_0x3819a4,function(_0x56643c,_0xae6eed){if(_0x56643c){return _0x2603a0(_0x56643c);}else{return _0x12bbec(_0xae6eed);}});});}exports[_0x61c8('0x92')]=function(_0x41f347,_0x146930,_0x2dcc28){return db[_0x61c8('0x2d')][_0x61c8('0x7c')]({'where':{'id':_0x41f347[_0x61c8('0x48')]['id']}})[_0x61c8('0x27')](handleEntityNotFound(_0x146930))[_0x61c8('0x27')](function(_0x4abfe1){if(_0x4abfe1&&_0x4abfe1[_0x61c8('0x93')]){var _0x51422f=_0x4abfe1[_0x61c8('0x93')];var _0x471c78=config['root']+_0x61c8('0x94')+_0x4abfe1['id']+_0x61c8('0x95');if(fs[_0x61c8('0x4e')](_0x471c78)){return _0x471c78;}return writeFile(_0x51422f,_0x471c78)[_0x61c8('0x27')](function(){return _0x471c78;});}else{throw new db[(_0x61c8('0x52'))]['ValidationError'](_0x61c8('0x96'));}})[_0x61c8('0x27')](function(_0x4d16ed){return _0x146930[_0x61c8('0x4a')](_0x4d16ed);})['catch'](handleError(_0x146930));}; \ No newline at end of file +var _0x4932=['Setting','transcribe','transcribeRegion','bucket','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','language','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','format','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','download','../../components/encryptor','type','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','uniqueid','$and','push','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne'];(function(_0x5ee9d5,_0x4a6cd1){var _0x4d0c99=function(_0x381c43){while(--_0x381c43){_0x5ee9d5['push'](_0x5ee9d5['shift']());}};_0x4d0c99(++_0x4a6cd1);}(_0x4932,0xb1));var _0x2493=function(_0x465cb1,_0x5c229b){_0x465cb1=_0x465cb1-0x0;var _0x1ecb30=_0x4932[_0x465cb1];return _0x1ecb30;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2493('0x0'));var jsonpatch=require(_0x2493('0x1'));var rp=require('request-promise');var moment=require(_0x2493('0x2'));var BPromise=require(_0x2493('0x3'));var Mustache=require(_0x2493('0x4'));var util=require(_0x2493('0x5'));var path=require('path');var sox=require(_0x2493('0x6'));var csv=require('to-csv');var ejs=require(_0x2493('0x7'));var fs=require('fs');var fs_extra=require(_0x2493('0x8'));var _=require(_0x2493('0x9'));var squel=require('squel');var crypto=require(_0x2493('0xa'));var jsforce=require(_0x2493('0xb'));var deskjs=require(_0x2493('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2493('0xd'));var Papa=require(_0x2493('0xe'));var AWS=require(_0x2493('0xf'));var uuidv4=require(_0x2493('0x10'));var Redis=require(_0x2493('0x11'));var authService=require(_0x2493('0x12'));var qs=require(_0x2493('0x13'));var as=require(_0x2493('0x14'));var hardwareService=require(_0x2493('0x15'));var logger=require(_0x2493('0x16'))(_0x2493('0x17'));var utils=require(_0x2493('0x18'));var config=require(_0x2493('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2493('0x1a'))['db'];function respondWithStatusCode(_0x4e8531,_0x402458){_0x402458=_0x402458||0xcc;return function(_0x25248f){if(_0x25248f){return _0x4e8531['sendStatus'](_0x402458);}return _0x4e8531['status'](_0x402458)[_0x2493('0x1b')]();};}function respondWithResult(_0x41467d,_0x2d71f6){_0x2d71f6=_0x2d71f6||0xc8;return function(_0x4d84f4){if(_0x4d84f4){return _0x41467d[_0x2493('0x1c')](_0x2d71f6)[_0x2493('0x1d')](_0x4d84f4);}};}function respondWithFilteredResult(_0x18d932,_0x15ec8a){return function(_0x4070ca){if(_0x4070ca){var _0x1d0cc5=typeof _0x15ec8a['offset']==='undefined'&&typeof _0x15ec8a[_0x2493('0x1e')]===_0x2493('0x1f');var _0x4981d7=_0x4070ca[_0x2493('0x20')];var _0x2d3aef=_0x1d0cc5?0x0:_0x15ec8a['offset'];var _0x5ac80f=_0x1d0cc5?_0x4070ca['count']:_0x15ec8a[_0x2493('0x21')]+_0x15ec8a[_0x2493('0x1e')];var _0x258bf1;if(_0x5ac80f>=_0x4981d7){_0x5ac80f=_0x4981d7;_0x258bf1=0xc8;}else{_0x258bf1=0xce;}_0x18d932[_0x2493('0x1c')](_0x258bf1);return _0x18d932[_0x2493('0x22')](_0x2493('0x23'),_0x2d3aef+'-'+_0x5ac80f+'/'+_0x4981d7)[_0x2493('0x1d')](_0x4070ca);}return null;};}function patchUpdates(_0xdf8634){return function(_0x4fd45c){try{jsonpatch['apply'](_0x4fd45c,_0xdf8634,!![]);}catch(_0x1dcaab){return BPromise[_0x2493('0x24')](_0x1dcaab);}return _0x4fd45c[_0x2493('0x25')]();};}function saveUpdates(_0x5bf5b2,_0x5d339d){return function(_0x53582a){if(_0x53582a){return _0x53582a[_0x2493('0x26')](_0x5bf5b2)['then'](function(_0x57597b){return _0x57597b;});}return null;};}function removeEntity(_0x362dec,_0x17193e){return function(_0x1d26ae){if(_0x1d26ae){return _0x1d26ae['destroy']()[_0x2493('0x27')](function(){_0x362dec[_0x2493('0x1c')](0xcc)[_0x2493('0x1b')]();});}};}function handleEntityNotFound(_0x432409,_0x28eaad){return function(_0x4844a4){if(!_0x4844a4){_0x432409[_0x2493('0x28')](0x194);}return _0x4844a4;};}function handleError(_0x179435,_0x125581){_0x125581=_0x125581||0x1f4;return function(_0x682cb3){logger[_0x2493('0x29')](_0x682cb3['stack']);if(_0x682cb3[_0x2493('0x2a')]){delete _0x682cb3[_0x2493('0x2a')];}_0x179435[_0x2493('0x1c')](_0x125581)[_0x2493('0x2b')](_0x682cb3);};}exports[_0x2493('0x2c')]=function(_0x32ac7d,_0x3b28d6){var _0x41c003={},_0x3d3cce={},_0x31323a={'count':0x0,'rows':[]};var _0x1e5d0a=_[_0x2493('0x2d')](db[_0x2493('0x2e')][_0x2493('0x2f')],function(_0x51180b){return{'name':_0x51180b[_0x2493('0x30')],'type':_0x51180b['type'][_0x2493('0x31')]};});_0x3d3cce[_0x2493('0x32')]=_['differenceBy'](_[_0x2493('0x2d')](_0x1e5d0a,'name'),[_0x2493('0x33')]);_0x3d3cce['query']=_[_0x2493('0x34')](_0x32ac7d['query']);_0x3d3cce[_0x2493('0x35')]=_[_0x2493('0x36')](_0x3d3cce['model'],_0x3d3cce[_0x2493('0x37')]);_0x41c003['attributes']=_[_0x2493('0x36')](_0x3d3cce[_0x2493('0x32')],qs[_0x2493('0x38')](_0x32ac7d[_0x2493('0x37')][_0x2493('0x38')]));_0x41c003[_0x2493('0x39')]=_0x41c003['attributes'][_0x2493('0x3a')]?_0x41c003[_0x2493('0x39')]:_0x3d3cce[_0x2493('0x32')];if(!_0x32ac7d[_0x2493('0x37')][_0x2493('0x3b')](_0x2493('0x3c'))){_0x41c003['limit']=qs['limit'](_0x32ac7d[_0x2493('0x37')]['limit']);_0x41c003[_0x2493('0x21')]=qs[_0x2493('0x21')](_0x32ac7d[_0x2493('0x37')]['offset']);}_0x41c003[_0x2493('0x3d')]=qs[_0x2493('0x3e')](_0x32ac7d['query'][_0x2493('0x3e')]);_0x41c003[_0x2493('0x3f')]=qs[_0x2493('0x35')](_[_0x2493('0x40')](_0x32ac7d[_0x2493('0x37')],_0x3d3cce[_0x2493('0x35')]),_0x1e5d0a);if(_0x32ac7d['query'][_0x2493('0x41')]){_0x41c003[_0x2493('0x3f')]=_[_0x2493('0x42')](_0x41c003[_0x2493('0x3f')],{'$or':_[_0x2493('0x2d')](_0x1e5d0a,function(_0x5e2645){if(_0x5e2645['type']!==_0x2493('0x43')){var _0x18ccc5={};_0x18ccc5[_0x5e2645[_0x2493('0x2a')]]={'$like':'%'+_0x32ac7d[_0x2493('0x37')][_0x2493('0x41')]+'%'};return _0x18ccc5;}})});}_0x41c003=_[_0x2493('0x42')]({},_0x41c003,_0x32ac7d[_0x2493('0x44')]);var _0x50a68b={'where':_0x41c003['where']};return db[_0x2493('0x2e')][_0x2493('0x20')](_0x50a68b)[_0x2493('0x27')](function(_0x5262ab){_0x31323a[_0x2493('0x20')]=_0x5262ab;if(_0x32ac7d['query'][_0x2493('0x45')]){_0x41c003[_0x2493('0x46')]=[{'all':!![]}];}return db[_0x2493('0x2e')][_0x2493('0x47')](_0x41c003);})[_0x2493('0x27')](function(_0x236b83){_0x31323a[_0x2493('0x48')]=_0x236b83;return _0x31323a;})['then'](respondWithFilteredResult(_0x3b28d6,_0x41c003))[_0x2493('0x49')](handleError(_0x3b28d6,null));};exports[_0x2493('0x4a')]=function(_0x74af3c,_0x4348ff){var _0x508fe2={'raw':![],'where':{'id':_0x74af3c['params']['id']}},_0x3ea7e5={};_0x3ea7e5[_0x2493('0x32')]=_[_0x2493('0x34')](db[_0x2493('0x2e')]['rawAttributes']);_0x3ea7e5[_0x2493('0x37')]=_[_0x2493('0x34')](_0x74af3c[_0x2493('0x37')]);_0x3ea7e5[_0x2493('0x35')]=_['intersection'](_0x3ea7e5[_0x2493('0x32')],_0x3ea7e5[_0x2493('0x37')]);_0x508fe2[_0x2493('0x39')]=_[_0x2493('0x36')](_0x3ea7e5[_0x2493('0x32')],qs['fields'](_0x74af3c['query']['fields']));_0x508fe2[_0x2493('0x39')]=_0x508fe2[_0x2493('0x39')]['length']?_0x508fe2[_0x2493('0x39')]:_0x3ea7e5[_0x2493('0x32')];if(_0x74af3c[_0x2493('0x37')][_0x2493('0x45')]){_0x508fe2[_0x2493('0x46')]=[{'all':!![]}];}_0x508fe2=_[_0x2493('0x42')]({},_0x508fe2,_0x74af3c[_0x2493('0x44')]);return db[_0x2493('0x2e')][_0x2493('0x4b')](_0x508fe2)['then'](handleEntityNotFound(_0x4348ff,null))['then'](respondWithResult(_0x4348ff,null))['catch'](handleError(_0x4348ff,null));};exports['create']=function(_0x544432,_0x4cf25a){return db[_0x2493('0x2e')][_0x2493('0x4c')](_0x544432[_0x2493('0x4d')],{})[_0x2493('0x27')](respondWithResult(_0x4cf25a,0xc9))['catch'](handleError(_0x4cf25a,null));};exports[_0x2493('0x26')]=function(_0x173e25,_0x2f47be){if(_0x173e25['body']['id']){delete _0x173e25[_0x2493('0x4d')]['id'];}return db[_0x2493('0x2e')][_0x2493('0x4b')]({'where':{'id':_0x173e25[_0x2493('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2f47be,null))['then'](saveUpdates(_0x173e25[_0x2493('0x4d')],null))[_0x2493('0x27')](respondWithResult(_0x2f47be,null))[_0x2493('0x49')](handleError(_0x2f47be,null));};exports[_0x2493('0x4f')]=function(_0x4c8086,_0xde07f8){return db[_0x2493('0x2e')]['describe']()['then'](respondWithResult(_0xde07f8,null))['catch'](handleError(_0xde07f8,null));};exports[_0x2493('0x50')]=function(_0x32ac30,_0x57aabb,_0x51cab4){var _0x318ea2=require(_0x2493('0x51'));var _0x31fa94=![];var _0x4a7781={};if(_0x32ac30[_0x2493('0x37')][_0x2493('0x52')]&&_0x32ac30[_0x2493('0x37')][_0x2493('0x52')]==='uniqueid'){_0x4a7781['uniqueid']=_0x32ac30[_0x2493('0x4e')]['id'];}else{_0x4a7781['id']=_0x32ac30[_0x2493('0x4e')]['id'];}return db['VoiceRecording'][_0x2493('0x4b')]({'where':_0x4a7781,'attributes':['id',_0x2493('0x53')],'raw':!![]})[_0x2493('0x27')](handleEntityNotFound(_0x57aabb,null))['then'](function(_0x4667f2){if(_0x4667f2){var _0x5cb82a=_0x4667f2['value'];var _0x549b71=util[_0x2493('0x33')](_0x2493('0x54'),_0x5cb82a);if(fs[_0x2493('0x55')](_0x549b71)){_0x31fa94=!![];return _0x318ea2[_0x2493('0x56')](_0x549b71,_0x5cb82a,config[_0x2493('0x57')][_0x2493('0x58')])['then'](function(){return _0x4667f2;});}return _0x4667f2;}})['then'](function(_0x158ca3){if(_0x158ca3){var _0x4becf8=_0x158ca3[_0x2493('0x53')];if(!fs[_0x2493('0x55')](_0x4becf8)){throw new db[(_0x2493('0x59'))][(_0x2493('0x5a'))](_0x2493('0x5b'));}if(_0x158ca3[_0x2493('0x5c')]){return _0x57aabb[_0x2493('0x50')](_0x4becf8,_0x158ca3['filename']+path[_0x2493('0x5d')](_0x4becf8),function(){if(_0x31fa94){fs[_0x2493('0x5e')](_0x4becf8);}});}else{return _0x57aabb[_0x2493('0x50')](_0x4becf8,function(_0x4a2584){if(_0x31fa94){fs[_0x2493('0x5e')](_0x4becf8);}});}}})[_0x2493('0x49')](function(_0x3606da){if(_0x3606da[_0x2493('0x5f')]===_0x2493('0x5b')){_0x57aabb['status'](0x194)[_0x2493('0x2b')](_0x2493('0x60'));}else{return handleError(_0x57aabb,null);}});};exports[_0x2493('0x61')]=function(_0x510b8d,_0x244e9d,_0x1e9eb4){var _0x5c6ca9=require(_0x2493('0x51'));var _0x16d757=![];var _0xe32bea={'$and':[db[_0x2493('0x62')][_0x2493('0x3f')](db[_0x2493('0x62')]['fn'](_0x2493('0x63'),db[_0x2493('0x62')][_0x2493('0x64')]('uniqueid')),_0x510b8d[_0x2493('0x37')][_0x2493('0x65')])]};if(_0x510b8d['query'][_0x2493('0x52')]&&_0x510b8d[_0x2493('0x37')][_0x2493('0x52')]===_0x2493('0x66')){_0xe32bea[_0x2493('0x67')]['push']({'uniqueid':_0x510b8d[_0x2493('0x4e')]['id']});}else{_0xe32bea[_0x2493('0x67')][_0x2493('0x68')]({'id':_0x510b8d[_0x2493('0x4e')]['id']});}return db['VoiceRecording'][_0x2493('0x4b')]({'where':_0xe32bea,'attributes':['id',_0x2493('0x53')],'raw':!![]})[_0x2493('0x27')](handleEntityNotFound(_0x244e9d,null))[_0x2493('0x27')](function(_0x3004e2){if(_0x3004e2){var _0x44f0eb=util[_0x2493('0x33')](_0x2493('0x54'),_0x3004e2[_0x2493('0x53')]);if(fs[_0x2493('0x55')](_0x44f0eb)){_0x16d757=!![];return _0x5c6ca9[_0x2493('0x56')](_0x44f0eb,_0x3004e2['value'],config[_0x2493('0x57')][_0x2493('0x58')])[_0x2493('0x27')](function(){return _0x3004e2;});}return _0x3004e2;}})[_0x2493('0x27')](function(_0x3845be){if(_0x3845be){if(!fs['existsSync'](_0x3845be[_0x2493('0x53')])){throw new db[(_0x2493('0x59'))][(_0x2493('0x5a'))](_0x2493('0x5b'));}if(_0x3845be[_0x2493('0x5c')]){return _0x244e9d[_0x2493('0x50')](_0x3845be[_0x2493('0x53')],_0x3845be['filename']+path[_0x2493('0x5d')](_0x3845be[_0x2493('0x53')]),function(){if(_0x16d757){fs[_0x2493('0x5e')](_0x3845be[_0x2493('0x53')]);}});}else{return _0x244e9d[_0x2493('0x50')](_0x3845be['value'],function(_0x31edb7){if(_0x16d757){fs[_0x2493('0x5e')](_0x3845be[_0x2493('0x53')]);}});}}})['catch'](handleError(_0x244e9d,null));};exports[_0x2493('0x69')]=function(_0x5b81d3,_0x1cc5d2){return db['VoiceRecording']['find']({'where':{'id':_0x5b81d3[_0x2493('0x4e')]['id']}})[_0x2493('0x27')](function(_0x40a1a2){if(_[_0x2493('0x6a')](_0x40a1a2)){throw new ReferenceError(_0x2493('0x6b'));}return _0x40a1a2;})['then'](function(_0x275200){var _0x2ab0ad=_0x275200['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2ab0ad);if(!_['isNil'](_0x275200[_0x2493('0x53')])&&fs[_0x2493('0x55')](_0x2ab0ad)){logger[_0x2493('0x6c')](_0x2493('0x6d')+_0x2ab0ad+_0x2493('0x6e'));fs['unlinkSync'](_0x2ab0ad);}_0x2ab0ad=_0x2ab0ad+'.cypher';if(!_['isNil'](_0x275200[_0x2493('0x53')])&&fs[_0x2493('0x55')](_0x2ab0ad)){logger[_0x2493('0x6c')](_0x2493('0x6d')+_0x2ab0ad+_0x2493('0x6e'));fs[_0x2493('0x6f')](_0x2ab0ad);}return _0x275200;})[_0x2493('0x27')](function(_0x3b177b){if(!_0x3b177b)throw new InternalError();return _0x3b177b[_0x2493('0x69')]();})[_0x2493('0x27')](function(){_0x1cc5d2['status'](0xcc)['end']();})[_0x2493('0x49')](handleError(_0x1cc5d2,null));};function getBucketslist(_0x4af353,_0x45c9a1,_0x19d4cd){return new Promise(function(_0x5265ba,_0x20af5b){var _0x4d2da2=new AWS['S3']({'accessKeyId':_0x45c9a1,'secretAccessKey':_0x4af353,'region':_0x19d4cd});_0x4d2da2['listBuckets']({},function(_0x533ae4,_0xc6f420){if(_0x533ae4){return _0x20af5b(_0x533ae4);}else{return _0x5265ba(_0xc6f420);}});});}function createBucket(_0x5e790a,_0xaef1c6,_0x1bffc1,_0x5d2fc8){return new Promise(function(_0x2d6954,_0x48fef1){var _0x5f09b4=new AWS['S3']({'accessKeyId':_0xaef1c6,'secretAccessKey':_0x5e790a,'region':_0x1bffc1});_0x5f09b4[_0x2493('0x70')]({'Bucket':_0x5d2fc8},function(_0x127cb1,_0x2daaec){if(_0x127cb1){return _0x48fef1(_0x127cb1);}else{return _0x2d6954(_0x2daaec);}});});}function uploadFile(_0x4f96d6,_0xc663fc,_0x252b6f,_0xb53f67,_0x546e38,_0x532053){return new Promise(function(_0x586489,_0x5d51c6){var _0x5bb37c=new AWS['S3']({'accessKeyId':_0xc663fc,'secretAccessKey':_0x4f96d6,'region':_0x252b6f});_0x5bb37c[_0x2493('0x71')]({'Bucket':_0xb53f67,'Key':_0x546e38,'Body':_0x532053},function(_0xd74753,_0x5ba69d){if(_0xd74753){return _0x5d51c6(_0xd74753);}else{return _0x586489(_0x5ba69d);}});});}function startTranscribe(_0x43d7fe,_0x4a4898,_0xabdf6d,_0x28a6e4,_0x37795c,_0x309c8b){return new Promise(function(_0x4ba850,_0x25d93f){var _0x9912ae=new AWS[(_0x2493('0x72'))]({'accessKeyId':_0x4a4898,'secretAccessKey':_0x43d7fe,'region':_0xabdf6d});_0x9912ae[_0x2493('0x73')]({'TranscriptionJobName':_0x28a6e4,'LanguageCode':_0x37795c,'Media':{'MediaFileUri':_0x309c8b}},function(_0x30cf8f,_0x5a5706){if(_0x30cf8f){return _0x25d93f(_0x30cf8f);}else{return _0x4ba850(_0x5a5706);}});});}function transcribe(_0x35ac6b,_0xbc7a97,_0x2f75,_0x289970,_0x120e9a,_0x30352e,_0x1890ff){return new Promise(function(_0x5613d0,_0x7232c1){var _0x1d14de={};logger[_0x2493('0x6c')](util[_0x2493('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x35ac6b,_0x120e9a));return uploadFile(_0xbc7a97,_0x2f75,_0x289970,_0x120e9a,path['basename'](_0x30352e),fs[_0x2493('0x74')](_0x30352e))[_0x2493('0x27')](function(_0x33548f){logger[_0x2493('0x6c')](util['format'](_0x2493('0x75'),_0x35ac6b,_0x120e9a,_0x33548f[_0x2493('0x76')]));_0x1d14de['bucket']=_0x33548f['Bucket'];_0x1d14de['location']=_0x33548f[_0x2493('0x76')];logger[_0x2493('0x6c')](util[_0x2493('0x33')](_0x2493('0x77'),_0x35ac6b));return startTranscribe(_0xbc7a97,_0x2f75,_0x289970,uuidv4(),_0x1890ff,_0x33548f[_0x2493('0x76')]);})[_0x2493('0x27')](function(_0x1e1500){logger['info'](util[_0x2493('0x33')](_0x2493('0x78'),_0x35ac6b,_0x1e1500['TranscriptionJob'][_0x2493('0x79')]));_0x1d14de['transcribeName']=_0x1e1500[_0x2493('0x7a')][_0x2493('0x79')];_0x1d14de[_0x2493('0x7b')]=_0x1e1500[_0x2493('0x7a')][_0x2493('0x7c')];return _0x5613d0(_0x1d14de);})['catch'](function(_0x51f2f5){return _0x7232c1(_0x51f2f5);});});}exports[_0x2493('0x7d')]=function(_0x267300,_0x16e8ff,_0x1aadec){var _0x50cb91;var _0x15e4b7;var _0x4fe24b;var _0x4aae98=require(_0x2493('0x51'));return db['VoiceRecording'][_0x2493('0x7e')]({'where':{'id':_0x267300[_0x2493('0x4e')]['id']}})[_0x2493('0x27')](function(_0x2a5a94){if(_0x2a5a94){var _0x3e59a3=util[_0x2493('0x33')]('%s.cypher',_0x2a5a94[_0x2493('0x53')]);if(fs[_0x2493('0x55')](_0x3e59a3)){cypher=!![];return _0x4aae98[_0x2493('0x56')](_0x3e59a3,_0x2a5a94['value'],config[_0x2493('0x57')][_0x2493('0x58')])[_0x2493('0x27')](function(){return _0x2a5a94;});}return _0x2a5a94;}})['then'](function(_0x40bc43){if(!_0x40bc43){throw new db[(_0x2493('0x59'))][(_0x2493('0x5a'))]('Voice\x20Recording\x20not\x20found');}_0x15e4b7=_0x40bc43;return db[_0x2493('0x7f')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x16e8ff,null))[_0x2493('0x27')](function(_0x216289){if(_0x216289){_0x50cb91=_0x216289;if(!_0x50cb91[_0x2493('0x80')]||!_0x50cb91['transcribeAccountId']||!_0x50cb91[_0x2493('0x81')]||!_0x50cb91['language']||!_0x50cb91[_0x2493('0x82')]){throw new db['Sequelize'][(_0x2493('0x5a'))](_0x2493('0x83'));}if(_0x267300[_0x2493('0x4d')]['runSentiment']&&(!_0x50cb91[_0x2493('0x84')]||!_0x50cb91[_0x2493('0x85')]||!_0x50cb91[_0x2493('0x86')]||!_0x50cb91[_0x2493('0x87')]||!_0x50cb91['bucket'])){throw new db[(_0x2493('0x59'))][(_0x2493('0x5a'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x2493('0x7e')]({'where':{'id':_0x50cb91[_0x2493('0x88')]}});}})[_0x2493('0x27')](function(_0x517d51){if(!_0x517d51){throw new db[(_0x2493('0x59'))][(_0x2493('0x5a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x517d51[_0x2493('0x89')]||!_0x517d51[_0x2493('0x8a')]){throw new db[(_0x2493('0x59'))][(_0x2493('0x5a'))](_0x2493('0x8b'));}_0x4fe24b=_0x517d51;return getBucketslist(_0x4fe24b[_0x2493('0x89')],_0x4fe24b[_0x2493('0x8a')],_0x50cb91[_0x2493('0x81')]);})['then'](function(_0x4f69d5){if(_0x4f69d5&&_0x4f69d5[_0x2493('0x8c')]){var _0x22cd34=_['find'](_0x4f69d5[_0x2493('0x8c')],function(_0x37864a){return _0x37864a[_0x2493('0x8d')]===_0x50cb91['bucket'];});if(!_0x22cd34){logger[_0x2493('0x6c')](util[_0x2493('0x33')](_0x2493('0x8e'),_0x267300['params']['id'],_0x50cb91[_0x2493('0x82')]));return createBucket(_0x4fe24b[_0x2493('0x89')],_0x4fe24b[_0x2493('0x8a')],_0x50cb91[_0x2493('0x81')],_0x50cb91[_0x2493('0x82')]);}logger['info'](util[_0x2493('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x267300[_0x2493('0x4e')]['id'],_0x50cb91['bucket']));return;}})[_0x2493('0x27')](function(_0x5e62e0){if(_0x15e4b7[_0x2493('0x7b')]==='NEW'){return transcribe(_0x267300['params']['id'],_0x4fe24b[_0x2493('0x89')],_0x4fe24b[_0x2493('0x8a')],_0x50cb91['transcribeRegion'],_0x50cb91['bucket'],_0x15e4b7[_0x2493('0x53')],_0x50cb91[_0x2493('0x87')]);}else{logger[_0x2493('0x6c')](util[_0x2493('0x33')](_0x2493('0x8f'),_0x267300[_0x2493('0x4e')]['id']));return{'transcribeStatus':_0x2493('0x90')};}})['then'](function(_0x41a19d){if(_0x41a19d){_0x41a19d['tempSentiment']=_0x267300[_0x2493('0x4d')][_0x2493('0x91')];return _0x15e4b7[_0x2493('0x92')](_0x41a19d);}})['then'](respondWithResult(_0x16e8ff,null))[_0x2493('0x49')](handleError(_0x16e8ff,null));};function writeFile(_0x1eda22,_0x15b422){return new Promise(function(_0x48f2e4,_0x49d6dc){fs[_0x2493('0x93')](_0x15b422,_0x1eda22,function(_0x1c224a,_0x23f7fa){if(_0x1c224a){return _0x49d6dc(_0x1c224a);}else{return _0x48f2e4(_0x23f7fa);}});});}exports['downloadTranscribe']=function(_0x5a6dca,_0x5e7392,_0x45ff0d){return db['VoiceRecording']['findOne']({'where':{'id':_0x5a6dca['params']['id']}})[_0x2493('0x27')](handleEntityNotFound(_0x5e7392))[_0x2493('0x27')](function(_0x26f6bc){if(_0x26f6bc&&_0x26f6bc[_0x2493('0x94')]){var _0x5d22b0=_0x26f6bc[_0x2493('0x94')];var _0x30ed9c=config['root']+_0x2493('0x95')+_0x26f6bc['id']+_0x2493('0x96');if(fs[_0x2493('0x55')](_0x30ed9c)){return _0x30ed9c;}return writeFile(_0x5d22b0,_0x30ed9c)[_0x2493('0x27')](function(){return _0x30ed9c;});}else{throw new db[(_0x2493('0x59'))][(_0x2493('0x5a'))](_0x2493('0x97'));}})['then'](function(_0x5c64b7){return _0x5e7392[_0x2493('0x50')](_0x5c64b7);})['catch'](handleError(_0x5e7392));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index dfebb82..ec60bde 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 _0x1ca4=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./voiceRecording.attributes','exports','define'];(function(_0x2e1fc8,_0x106d21){var _0x34689c=function(_0x1ac4fe){while(--_0x1ac4fe){_0x2e1fc8['push'](_0x2e1fc8['shift']());}};_0x34689c(++_0x106d21);}(_0x1ca4,0x183));var _0x41ca=function(_0x479a60,_0x51e99a){_0x479a60=_0x479a60-0x0;var _0x462ea0=_0x1ca4[_0x479a60];return _0x462ea0;};'use strict';var _=require(_0x41ca('0x0'));var util=require(_0x41ca('0x1'));var logger=require(_0x41ca('0x2'))('api');var moment=require('moment');var BPromise=require(_0x41ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x41ca('0x4'));var config=require(_0x41ca('0x5'));var attributes=require(_0x41ca('0x6'));module[_0x41ca('0x7')]=function(_0x13bb52,_0x49ec6f){return _0x13bb52[_0x41ca('0x8')](_0x41ca('0x9'),attributes,{'tableName':_0x41ca('0xa'),'paranoid':![],'indexes':[{'name':_0x41ca('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x236b=['lodash','util','../../config/logger','api','bluebird','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x152de0,_0x59d6b9){var _0x45d5f3=function(_0x4be376){while(--_0x4be376){_0x152de0['push'](_0x152de0['shift']());}};_0x45d5f3(++_0x59d6b9);}(_0x236b,0x16c));var _0xb236=function(_0x302448,_0x1fb306){_0x302448=_0x302448-0x0;var _0x3567ab=_0x236b[_0x302448];return _0x3567ab;};'use strict';var _=require(_0xb236('0x0'));var util=require(_0xb236('0x1'));var logger=require(_0xb236('0x2'))(_0xb236('0x3'));var moment=require('moment');var BPromise=require(_0xb236('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb236('0x5'));var rimraf=require(_0xb236('0x6'));var config=require('../../config/environment');var attributes=require(_0xb236('0x7'));module[_0xb236('0x8')]=function(_0x16b45e,_0x3a40c4){return _0x16b45e[_0xb236('0x9')](_0xb236('0xa'),attributes,{'tableName':_0xb236('0xb'),'paranoid':![],'indexes':[{'name':_0xb236('0xc'),'fields':[_0xb236('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 1624039..6c3143a 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(_0x21d1eb,_0x56f664){var _0x4cb8cd=function(_0x450a48){while(--_0x450a48){_0x21d1eb['push'](_0x21d1eb['shift']());}};_0x4cb8cd(++_0x56f664);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0xf7ff4,_0x543a19){var _0x554e6a=function(_0x4b8192){while(--_0x4b8192){_0xf7ff4['push'](_0xf7ff4['shift']());}};_0x554e6a(++_0x543a19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 5740221..d0f81aa 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 _0x2c28=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2b7922,_0x5a317d){var _0x44d0e4=function(_0x37f895){while(--_0x37f895){_0x2b7922['push'](_0x2b7922['shift']());}};_0x44d0e4(++_0x5a317d);}(_0x2c28,0xed));var _0x82c2=function(_0xa55947,_0x28ccd8){_0xa55947=_0xa55947-0x0;var _0x2b26c0=_0x2c28[_0xa55947];return _0x2b26c0;};'use strict';var multer=require(_0x82c2('0x0'));var util=require(_0x82c2('0x1'));var path=require(_0x82c2('0x2'));var timeout=require(_0x82c2('0x3'));var express=require(_0x82c2('0x4'));var router=express[_0x82c2('0x5')]();var fs_extra=require(_0x82c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x82c2('0x7'));var config=require(_0x82c2('0x8'));var controller=require('./voiceTransferReport.controller');router[_0x82c2('0x9')]('/',auth[_0x82c2('0xa')](),controller[_0x82c2('0xb')]);router[_0x82c2('0x9')](_0x82c2('0xc'),auth[_0x82c2('0xa')](),controller[_0x82c2('0xd')]);router[_0x82c2('0x9')](_0x82c2('0xe'),auth[_0x82c2('0xa')](),controller[_0x82c2('0xf')]);router['post']('/',auth[_0x82c2('0xa')](),controller[_0x82c2('0x10')]);router[_0x82c2('0x11')](_0x82c2('0xe'),auth[_0x82c2('0xa')](),controller[_0x82c2('0x12')]);router[_0x82c2('0x13')](_0x82c2('0xe'),auth[_0x82c2('0xa')](),controller[_0x82c2('0x14')]);module[_0x82c2('0x15')]=router; \ No newline at end of file +var _0x5f3f=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','index','get','isAuthenticated','describe','/:id','post','create','put','delete'];(function(_0x36f762,_0x3d7a2c){var _0x58fa85=function(_0x5bed67){while(--_0x5bed67){_0x36f762['push'](_0x36f762['shift']());}};_0x58fa85(++_0x3d7a2c);}(_0x5f3f,0xde));var _0xf5f3=function(_0x19c274,_0x3cbbbf){_0x19c274=_0x19c274-0x0;var _0x410aa3=_0x5f3f[_0x19c274];return _0x410aa3;};'use strict';var multer=require(_0xf5f3('0x0'));var util=require(_0xf5f3('0x1'));var path=require(_0xf5f3('0x2'));var timeout=require(_0xf5f3('0x3'));var express=require(_0xf5f3('0x4'));var router=express[_0xf5f3('0x5')]();var fs_extra=require(_0xf5f3('0x6'));var auth=require(_0xf5f3('0x7'));var interaction=require(_0xf5f3('0x8'));var config=require(_0xf5f3('0x9'));var controller=require(_0xf5f3('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xf5f3('0xb')]);router[_0xf5f3('0xc')]('/describe',auth[_0xf5f3('0xd')](),controller[_0xf5f3('0xe')]);router['get'](_0xf5f3('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xf5f3('0x10')]('/',auth['isAuthenticated'](),controller[_0xf5f3('0x11')]);router[_0xf5f3('0x12')](_0xf5f3('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf5f3('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf5f3('0x14')]);module[_0xf5f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index bde34b2..ad3b3b5 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 _0x01c3=['attended','STRING','sequelize','exports','ENUM','blind'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x01c3,0x7a));var _0x301c=function(_0x518b91,_0x4b8390){_0x518b91=_0x518b91-0x0;var _0x3e867e=_0x01c3[_0x518b91];return _0x3e867e;};'use strict';var Sequelize=require(_0x301c('0x0'));var moment=require('moment');module[_0x301c('0x1')]={'type':{'type':Sequelize[_0x301c('0x2')](_0x301c('0x3'),_0x301c('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x301c('0x5')]},'transferercalleridname':{'type':Sequelize[_0x301c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x301c('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x301c('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x301c('0x5')]},'transferercontext':{'type':Sequelize[_0x301c('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x301c('0x5')]},'transfereechannel':{'type':Sequelize[_0x301c('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x301c('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x301c('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x301c('0x5')]},'transfereecontext':{'type':Sequelize[_0x301c('0x5')]},'transfereeexten':{'type':Sequelize[_0x301c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x301c('0x5')]},'isexternal':{'type':Sequelize[_0x301c('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x301c('0x5')]},'extension':{'type':Sequelize[_0x301c('0x5')]}}; \ No newline at end of file +var _0xc658=['sequelize','moment','exports','ENUM','attended','STRING','Yes'];(function(_0x21c81e,_0x5de28f){var _0x16a6d7=function(_0x91beeb){while(--_0x91beeb){_0x21c81e['push'](_0x21c81e['shift']());}};_0x16a6d7(++_0x5de28f);}(_0xc658,0x173));var _0x8c65=function(_0x19cd29,_0x1ac3e7){_0x19cd29=_0x19cd29-0x0;var _0x27c96d=_0xc658[_0x19cd29];return _0x27c96d;};'use strict';var Sequelize=require(_0x8c65('0x0'));var moment=require(_0x8c65('0x1'));module[_0x8c65('0x2')]={'type':{'type':Sequelize[_0x8c65('0x3')]('blind',_0x8c65('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x8c65('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8c65('0x5')]},'transferercalleridname':{'type':Sequelize[_0x8c65('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8c65('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x8c65('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x8c65('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8c65('0x5')]},'transfereechannel':{'type':Sequelize[_0x8c65('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8c65('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x8c65('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8c65('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x8c65('0x5')]},'transfereecontext':{'type':Sequelize[_0x8c65('0x5')]},'transfereeexten':{'type':Sequelize[_0x8c65('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8c65('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x8c65('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8c65('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f3c9827..d27406d 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 _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x10b986,_0x284bba){var _0x1c3e54=function(_0x3fa0f3){while(--_0x3fa0f3){_0x10b986['push'](_0x10b986['shift']());}};_0x1c3e54(++_0x284bba);}(_0x7a54,0x106));var _0x47a5=function(_0x4b4221,_0x34bfb9){_0x4b4221=_0x4b4221-0x0;var _0x10dc30=_0x7a54[_0x4b4221];return _0x10dc30;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['VoiceTransferReport'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['VoiceTransferReport']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['VoiceTransferReport'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file +var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0xe47817,_0xc0c4b2){var _0x5df0eb=function(_0x3f1a70){while(--_0x3f1a70){_0xe47817['push'](_0xe47817['shift']());}};_0x5df0eb(++_0xc0c4b2);}(_0x7a54,0x106));var _0x47a5=function(_0x55e124,_0x17dcec){_0x55e124=_0x55e124-0x0;var _0x153454=_0x7a54[_0x55e124];return _0x153454;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['VoiceTransferReport'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['VoiceTransferReport']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['VoiceTransferReport'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ff675d8..b2b1c80 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 _0x8ed5=['util','../../config/logger','bluebird','path','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x48fe9e,_0x29720a){var _0x4dac6c=function(_0x2774ea){while(--_0x2774ea){_0x48fe9e['push'](_0x48fe9e['shift']());}};_0x4dac6c(++_0x29720a);}(_0x8ed5,0x15f));var _0x58ed=function(_0x502e7e,_0x4e2e2e){_0x502e7e=_0x502e7e-0x0;var _0x1954e7=_0x8ed5[_0x502e7e];return _0x1954e7;};'use strict';var _=require('lodash');var util=require(_0x58ed('0x0'));var logger=require(_0x58ed('0x1'))('api');var moment=require('moment');var BPromise=require(_0x58ed('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58ed('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x58ed('0x4'));module[_0x58ed('0x5')]=function(_0x523033,_0xeb3a80){return _0x523033[_0x58ed('0x6')](_0x58ed('0x7'),attributes,{'tableName':_0x58ed('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcae=['api','moment','request-promise','path','rimraf','../../config/environment','exports','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x1cb39f,_0x38d17e){var _0x58babd=function(_0x1e4ab2){while(--_0x1e4ab2){_0x1cb39f['push'](_0x1cb39f['shift']());}};_0x58babd(++_0x38d17e);}(_0xfcae,0x141));var _0xefca=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xfcae[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xefca('0x0'));var util=require(_0xefca('0x1'));var logger=require(_0xefca('0x2'))(_0xefca('0x3'));var moment=require(_0xefca('0x4'));var BPromise=require('bluebird');var rp=require(_0xefca('0x5'));var fs=require('fs');var path=require(_0xefca('0x6'));var rimraf=require(_0xefca('0x7'));var config=require(_0xefca('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0xefca('0x9')]=function(_0x40136d,_0x181acf){return _0x40136d['define'](_0xefca('0xa'),attributes,{'tableName':_0xefca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index ab7bf74..c28e2ea 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 _0x9205=['stringify','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4a9f7c,_0x344d95){var _0x52f052=function(_0x126392){while(--_0x126392){_0x4a9f7c['push'](_0x4a9f7c['shift']());}};_0x52f052(++_0x344d95);}(_0x9205,0x14d));var _0x5920=function(_0x47c1b2,_0x5daa14){_0x47c1b2=_0x47c1b2-0x0;var _0x2ed8c0=_0x9205[_0x47c1b2];return _0x2ed8c0;};'use strict';var _=require(_0x5920('0x0'));var util=require(_0x5920('0x1'));var moment=require(_0x5920('0x2'));var BPromise=require(_0x5920('0x3'));var rs=require(_0x5920('0x4'));var fs=require('fs');var Redis=require(_0x5920('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5920('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54425e,_0xdc66ec,_0x24b8ab){return new BPromise(function(_0x13dacb,_0x661e9){return client[_0x5920('0x7')](_0x54425e,_0x24b8ab)[_0x5920('0x8')](function(_0xd61c79){logger['info'](_0x5920('0x9'),_0xdc66ec,_0x5920('0xa'));logger['debug'](_0x5920('0xb'),_0xdc66ec,_0x5920('0xa'),JSON[_0x5920('0xc')](_0xd61c79));if(_0xd61c79['error']){if(_0xd61c79[_0x5920('0xd')][_0x5920('0xe')]===0x1f4){logger['error'](_0x5920('0x9'),_0xdc66ec,_0xd61c79[_0x5920('0xd')][_0x5920('0xf')]);return _0x661e9(_0xd61c79[_0x5920('0xd')][_0x5920('0xf')]);}logger[_0x5920('0xd')](_0x5920('0x9'),_0xdc66ec,_0xd61c79['error'][_0x5920('0xf')]);return _0x13dacb(_0xd61c79[_0x5920('0xd')][_0x5920('0xf')]);}else{logger[_0x5920('0x10')](_0x5920('0x9'),_0xdc66ec,_0x5920('0xa'));_0x13dacb(_0xd61c79['result']['message']);}})[_0x5920('0x11')](function(_0x3edf67){logger['error'](_0x5920('0x9'),_0xdc66ec,_0x3edf67);_0x661e9(_0x3edf67);});});}exports[_0x5920('0x12')]=function(_0x1801c1){var _0x2e8218=this;return new Promise(function(_0x34d93a,_0x39634c){return db[_0x5920('0x13')][_0x5920('0x14')](_0x1801c1['body'],{'raw':_0x1801c1[_0x5920('0x15')]?_0x1801c1[_0x5920('0x15')][_0x5920('0x16')]===undefined?!![]:![]:!![]})[_0x5920('0x8')](function(_0x55776d){logger[_0x5920('0x10')](_0x5920('0x12'),_0x1801c1);logger['debug'](_0x5920('0x12'),_0x1801c1,JSON['stringify'](_0x55776d));_0x34d93a(_0x55776d);})['catch'](function(_0x2a676f){logger[_0x5920('0xd')]('CreateVoiceTransferReport',_0x2a676f[_0x5920('0xf')],_0x1801c1);_0x39634c(_0x2e8218[_0x5920('0xd')](0x1f4,_0x2a676f[_0x5920('0xf')]));});});}; \ No newline at end of file +var _0x1c4d=['catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result'];(function(_0x33e9fd,_0x5c94c0){var _0x464e2e=function(_0x5113ef){while(--_0x5113ef){_0x33e9fd['push'](_0x33e9fd['shift']());}};_0x464e2e(++_0x5c94c0);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0x4faab9,_0x1b4c88){_0x4faab9=_0x4faab9-0x0;var _0x4e69b0=_0x1c4d[_0x4faab9];return _0x4e69b0;};'use strict';var _=require('lodash');var util=require(_0xd1c4('0x0'));var moment=require(_0xd1c4('0x1'));var BPromise=require(_0xd1c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1c4('0x3'));var db=require(_0xd1c4('0x4'))['db'];var utils=require(_0xd1c4('0x5'));var logger=require(_0xd1c4('0x6'))('rpc');var config=require(_0xd1c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd1c4('0x8')][_0xd1c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41cc76,_0x35cbf5,_0x429dc6){return new BPromise(function(_0xc9284c,_0x49c2dc){return client[_0xd1c4('0xa')](_0x41cc76,_0x429dc6)[_0xd1c4('0xb')](function(_0x5443f3){logger[_0xd1c4('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x35cbf5,_0xd1c4('0xd'));logger[_0xd1c4('0xe')](_0xd1c4('0xf'),_0x35cbf5,_0xd1c4('0xd'),JSON[_0xd1c4('0x10')](_0x5443f3));if(_0x5443f3[_0xd1c4('0x11')]){if(_0x5443f3[_0xd1c4('0x11')][_0xd1c4('0x12')]===0x1f4){logger[_0xd1c4('0x11')](_0xd1c4('0x13'),_0x35cbf5,_0x5443f3[_0xd1c4('0x11')]['message']);return _0x49c2dc(_0x5443f3[_0xd1c4('0x11')][_0xd1c4('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x35cbf5,_0x5443f3[_0xd1c4('0x11')]['message']);return _0xc9284c(_0x5443f3[_0xd1c4('0x11')]['message']);}else{logger['info'](_0xd1c4('0x13'),_0x35cbf5,'request\x20sent');_0xc9284c(_0x5443f3[_0xd1c4('0x15')][_0xd1c4('0x14')]);}})[_0xd1c4('0x16')](function(_0x4af352){logger[_0xd1c4('0x11')](_0xd1c4('0x13'),_0x35cbf5,_0x4af352);_0x49c2dc(_0x4af352);});});}exports[_0xd1c4('0x17')]=function(_0x41c496){var _0xe25f12=this;return new Promise(function(_0x39e0bb,_0x51a465){return db[_0xd1c4('0x18')][_0xd1c4('0x19')](_0x41c496[_0xd1c4('0x1a')],{'raw':_0x41c496[_0xd1c4('0x1b')]?_0x41c496['options'][_0xd1c4('0x1c')]===undefined?!![]:![]:!![]})[_0xd1c4('0xb')](function(_0x2dbdbb){logger[_0xd1c4('0xc')](_0xd1c4('0x17'),_0x41c496);logger[_0xd1c4('0xe')]('CreateVoiceTransferReport',_0x41c496,JSON[_0xd1c4('0x10')](_0x2dbdbb));_0x39e0bb(_0x2dbdbb);})[_0xd1c4('0x16')](function(_0x49f1db){logger[_0xd1c4('0x11')]('CreateVoiceTransferReport',_0x49f1db[_0xd1c4('0x14')],_0x41c496);_0x51a465(_0xe25f12[_0xd1c4('0x11')](0x1f4,_0x49f1db[_0xd1c4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 771bcea..e982473 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 _0x279d=['hangup','/answer','answer','/hold','hold','/unhold','exports','express','Router','../../components/auth/service','./webbar.controller','isAuthenticated','canUpdate','post','/hangup'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x279d,0x1d8));var _0xd279=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x279d[_0x9dfc10];return _0x4f938a;};'use strict';var express=require(_0xd279('0x0'));var router=express[_0xd279('0x1')]();var auth=require(_0xd279('0x2'));var controller=require(_0xd279('0x3'));router['post']('/originate',auth[_0xd279('0x4')](),auth[_0xd279('0x5')](),controller['originate']);router[_0xd279('0x6')](_0xd279('0x7'),auth[_0xd279('0x4')](),auth[_0xd279('0x5')](),controller[_0xd279('0x8')]);router[_0xd279('0x6')](_0xd279('0x9'),auth['isAuthenticated'](),auth[_0xd279('0x5')](),controller[_0xd279('0xa')]);router[_0xd279('0x6')](_0xd279('0xb'),auth[_0xd279('0x4')](),auth[_0xd279('0x5')](),controller[_0xd279('0xc')]);router[_0xd279('0x6')](_0xd279('0xd'),auth[_0xd279('0x4')](),auth[_0xd279('0x5')](),controller['unhold']);router[_0xd279('0x6')]('/calls',auth[_0xd279('0x4')](),auth[_0xd279('0x5')](),controller['calls']);router[_0xd279('0x6')]('/transfer',auth['isAuthenticated'](),auth[_0xd279('0x5')](),controller['transfer']);module[_0xd279('0xe')]=router; \ No newline at end of file +var _0x639a=['/originate','isAuthenticated','originate','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x639a,0xec));var _0xa639=function(_0x104196,_0x4132dd){_0x104196=_0x104196-0x0;var _0x4c2af4=_0x639a[_0x104196];return _0x4c2af4;};'use strict';var express=require('express');var router=express[_0xa639('0x0')]();var auth=require(_0xa639('0x1'));var controller=require(_0xa639('0x2'));router[_0xa639('0x3')](_0xa639('0x4'),auth[_0xa639('0x5')](),auth['canUpdate'](),controller[_0xa639('0x6')]);router[_0xa639('0x3')](_0xa639('0x7'),auth['isAuthenticated'](),auth[_0xa639('0x8')](),controller[_0xa639('0x9')]);router[_0xa639('0x3')](_0xa639('0xa'),auth['isAuthenticated'](),auth[_0xa639('0x8')](),controller[_0xa639('0xb')]);router[_0xa639('0x3')](_0xa639('0xc'),auth[_0xa639('0x5')](),auth[_0xa639('0x8')](),controller[_0xa639('0xd')]);router[_0xa639('0x3')](_0xa639('0xe'),auth[_0xa639('0x5')](),auth[_0xa639('0x8')](),controller[_0xa639('0xf')]);router[_0xa639('0x3')](_0xa639('0x10'),auth['isAuthenticated'](),auth['canUpdate'](),controller['calls']);router[_0xa639('0x3')](_0xa639('0x11'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xa639('0x12')]);module[_0xa639('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 68e746b..036adc3 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 _0x8c25=['then','error','code','message','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup','userId','webbar:hangup','answer','validate','webbar:answer','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','ioredis','defaults','socket.io-emitter','redis','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','name','status','send','NotFound','request'];(function(_0x5c38a2,_0x40e4e4){var _0x22869c=function(_0x4601ce){while(--_0x4601ce){_0x5c38a2['push'](_0x5c38a2['shift']());}};_0x22869c(++_0x40e4e4);}(_0x8c25,0x15e));var _0x58c2=function(_0x54a49c,_0x2640f3){_0x54a49c=_0x54a49c-0x0;var _0x4e7690=_0x8c25[_0x54a49c];return _0x4e7690;};'use strict';var path=require(_0x58c2('0x0'));var fs=require('fs');var _=require(_0x58c2('0x1'));var db=require(_0x58c2('0x2'))['db'];var config=require(_0x58c2('0x3'));var util=require(_0x58c2('0x4'));var BPromise=require(_0x58c2('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x58c2('0x6')]['http']({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x58c2('0x7'));config['redis']=_[_0x58c2('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x58c2('0x9'))(new Redis(config[_0x58c2('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x58c2('0xb'),'required':[!![],_0x58c2('0xc')]},'callNumber':{'type':_0x58c2('0xd'),'required':[!![],_0x58c2('0xe')]},'callerId':{'type':_0x58c2('0xd')},'callbackUrl':{'type':_0x58c2('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x58c2('0xb'),'required':[!![],_0x58c2('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x58c2('0xb'),'required':[!![],_0x58c2('0xc')]},'sessionId':{'type':_0x58c2('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x58c2('0xc')]},'sessionId':{'type':_0x58c2('0xd'),'required':[!![],_0x58c2('0xf')]},'transferNumber':{'type':_0x58c2('0xd'),'required':[!![],_0x58c2('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x58c2('0xb'),'required':[!![],_0x58c2('0xc')]},'sessionId':{'type':_0x58c2('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x58c2('0xb'),'required':[!![],_0x58c2('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x58c2('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x58c2('0xb'),'required':[!![],_0x58c2('0xc')]}});function emit(_0x20d6d6,_0x3e6589,_0x4ec80c){logger[_0x58c2('0x11')](_0x20d6d6,_0x3e6589,JSON[_0x58c2('0x12')](_0x4ec80c));io['to'](_0x20d6d6)['emit'](_0x3e6589,_0x4ec80c);}function handleError(_0x50e4fa){return function(_0x55d76b){console[_0x58c2('0x13')]('handleError:',_0x55d76b,_0x55d76b instanceof RangeError);logger['error'](_0x55d76b['stack']);if(_0x55d76b instanceof RangeError){if(_0x55d76b['name']){delete _0x55d76b[_0x58c2('0x14')];}_0x50e4fa[_0x58c2('0x15')](0x194)[_0x58c2('0x16')](_0x55d76b);}else{if(_0x55d76b[_0x58c2('0x14')]){delete _0x55d76b[_0x58c2('0x14')];}_0x50e4fa[_0x58c2('0x15')](0x1f4)['send'](_0x55d76b);}};}function checkError(){return function(_0x4094a3){if(!_0x4094a3){throw new RangeError(_0x58c2('0x17'));}return _0x4094a3;};}function respondWithRpcPromise(_0x1f7adc,_0x21618c){return new BPromise(function(_0x59f55c,_0x34c54b){var _0x148d67=amiClient;return _0x148d67[_0x58c2('0x18')](_0x1f7adc,_0x21618c)[_0x58c2('0x19')](function(_0x21f3de){if(_0x21f3de[_0x58c2('0x1a')]){if(_0x21f3de[_0x58c2('0x1a')][_0x58c2('0x1b')]===0x1f4){return _0x34c54b(_0x21f3de[_0x58c2('0x1a')][_0x58c2('0x1c')]);}return _0x59f55c(_0x21f3de[_0x58c2('0x1a')]['message']);}else{_0x59f55c(_0x21f3de['result']);}})[_0x58c2('0x1d')](function(_0x2481fa){_0x34c54b(_0x2481fa);});});}function getAgent(_0x371fe2){return db[_0x58c2('0x1e')][_0x58c2('0x1f')]({'where':{'id':_0x371fe2,'role':_0x58c2('0x20')}})[_0x58c2('0x19')](checkError());}function getAgentCheckSession(_0x9eeb35,_0x4198c3){return new BPromise(function(_0x367d44,_0x1b3a7f){var _0x2344a5=respondWithRpcPromise(_0x58c2('0x21'));var _0xda8f66=getAgent(_0x9eeb35);Promise[_0x58c2('0x22')]([_0x2344a5,_0xda8f66])[_0x58c2('0x19')](function(_0x543745){var _0x2ce592=_0x543745[0x0];var _0x40d5aa=_0x543745[0x1];var _0x1bd3a5=_[_0x58c2('0x23')](_0x2ce592[_0x58c2('0x24')],function(_0x2544fa){return _0x2544fa[_0x58c2('0x25')]==_0x40d5aa['id']&&_0x2544fa[_0x58c2('0x26')]==_0x4198c3;});if(_0x1bd3a5[_0x58c2('0x27')]==0x1){_0x367d44(_0x40d5aa);}else{_0x1b3a7f(new RangeError(_0x58c2('0x28')+_0x4198c3+_0x58c2('0x29')));}});});}exports[_0x58c2('0x2a')]=function(_0x175e34,_0x179502){logger[_0x58c2('0x11')](_0x58c2('0x2b'),_0x175e34[_0x58c2('0x2c')]);var _0x55a460=originateValidation['validate'](_0x175e34[_0x58c2('0x2c')]);if(_0x55a460[_0x58c2('0x27')]>0x0){return _0x179502['status'](0x190)[_0x58c2('0x2d')](_0x55a460);}var _0x5d33d1=_0x175e34['body']['userId'];var _0x2d12b1=_0x175e34[_0x58c2('0x2c')]['callNumber'];var _0x2e1970=_0x175e34[_0x58c2('0x2c')][_0x58c2('0x2e')];var _0x1f4f13=_0x175e34['body'][_0x58c2('0x2f')];return getAgent(_0x5d33d1)[_0x58c2('0x19')](function(_0x5b3f29){logger[_0x58c2('0x11')](_0x58c2('0x30'),_0x5b3f29[_0x58c2('0x14')]);emit(util[_0x58c2('0x31')](_0x58c2('0x32'),_0x5b3f29[_0x58c2('0x14')]),_0x58c2('0x33'),{'callNumber':_0x2d12b1,'callerId':_0x2e1970,'callbackUrl':_0x1f4f13});return _0x179502[_0x58c2('0x15')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x179502));};exports[_0x58c2('0x34')]=function(_0x2f93a7,_0x8fb783){logger['info']('hangup\x20fired:',_0x2f93a7[_0x58c2('0x2c')]);var _0x177eda=hangupValidation['validate'](_0x2f93a7[_0x58c2('0x2c')]);if(_0x177eda['length']>0x0){return _0x8fb783[_0x58c2('0x15')](0x190)[_0x58c2('0x2d')](_0x177eda);}var _0x3e4e5c=_0x2f93a7[_0x58c2('0x2c')][_0x58c2('0x35')];var _0x117459=_0x2f93a7[_0x58c2('0x2c')]['sessionId'];return getAgent(_0x3e4e5c)[_0x58c2('0x19')](function(_0x24f451){logger[_0x58c2('0x11')](_0x58c2('0x30'),_0x24f451[_0x58c2('0x14')]);emit(util['format'](_0x58c2('0x32'),_0x24f451[_0x58c2('0x14')]),_0x58c2('0x36'),{'sessionId':_0x117459});return _0x8fb783[_0x58c2('0x15')](0xc8)[_0x58c2('0x2d')]({'error':![],'message':'hangup\x20executed!'});})[_0x58c2('0x1d')](handleError(_0x8fb783));};exports[_0x58c2('0x37')]=function(_0x23687b,_0x7a9fb7){logger['info']('answer\x20fired:',_0x23687b[_0x58c2('0x2c')]);var _0x5bd179=answerValidation[_0x58c2('0x38')](_0x23687b[_0x58c2('0x2c')]);if(_0x5bd179['length']>0x0){return _0x7a9fb7[_0x58c2('0x15')](0x190)[_0x58c2('0x2d')](_0x5bd179);}var _0xc2487d=_0x23687b[_0x58c2('0x2c')][_0x58c2('0x35')];var _0x4933b6=_0x23687b[_0x58c2('0x2c')][_0x58c2('0x26')];return getAgent(_0xc2487d)[_0x58c2('0x19')](function(_0x4da893){logger['info'](_0x58c2('0x30'),_0x4da893['name']);emit(util[_0x58c2('0x31')](_0x58c2('0x32'),_0x4da893['name']),_0x58c2('0x39'),{'sessionId':_0x4933b6});return _0x7a9fb7['status'](0xc8)[_0x58c2('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0x58c2('0x1d')](handleError(_0x7a9fb7));};exports[_0x58c2('0x3a')]=function(_0x24c3c9,_0x25db32){logger[_0x58c2('0x11')](_0x58c2('0x3b'),_0x24c3c9[_0x58c2('0x2c')]);var _0x4af7e6=holdValidation['validate'](_0x24c3c9[_0x58c2('0x2c')]);if(_0x4af7e6[_0x58c2('0x27')]>0x0){return _0x25db32[_0x58c2('0x15')](0x190)[_0x58c2('0x2d')](_0x4af7e6);}var _0x693625=_0x24c3c9['body'][_0x58c2('0x35')];var _0x471b5f=_0x24c3c9[_0x58c2('0x2c')][_0x58c2('0x26')];return getAgent(_0x693625)[_0x58c2('0x19')](function(_0xfc6a7e){logger['info']('entityFound:',_0xfc6a7e['name']);emit(util['format'](_0x58c2('0x32'),_0xfc6a7e[_0x58c2('0x14')]),_0x58c2('0x3c'),{'sessionId':_0x471b5f});return _0x25db32[_0x58c2('0x15')](0xc8)[_0x58c2('0x2d')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x25db32));};exports[_0x58c2('0x3d')]=function(_0x2edceb,_0x221a0f){logger[_0x58c2('0x11')](_0x58c2('0x3e'),_0x2edceb['body']);var _0x1302f0=unholdValidation['validate'](_0x2edceb[_0x58c2('0x2c')]);if(_0x1302f0[_0x58c2('0x27')]>0x0){return _0x221a0f[_0x58c2('0x15')](0x190)[_0x58c2('0x2d')](_0x1302f0);}var _0x280cf1=_0x2edceb['body'][_0x58c2('0x35')];var _0x35faa8=_0x2edceb[_0x58c2('0x2c')][_0x58c2('0x26')];return getAgent(_0x280cf1)[_0x58c2('0x19')](function(_0x37d59a){logger[_0x58c2('0x11')](_0x58c2('0x30'),_0x37d59a[_0x58c2('0x14')]);emit(util[_0x58c2('0x31')](_0x58c2('0x32'),_0x37d59a['name']),_0x58c2('0x3f'),{'sessionId':_0x35faa8});return _0x221a0f[_0x58c2('0x15')](0xc8)[_0x58c2('0x2d')]({'error':![],'message':_0x58c2('0x40')});})[_0x58c2('0x1d')](handleError(_0x221a0f));};exports[_0x58c2('0x41')]=function(_0x43b6ef,_0x3a169a){logger[_0x58c2('0x11')](_0x58c2('0x42'),_0x3a169a[_0x58c2('0x2c')]);var _0x4e1ba6=callsValidation[_0x58c2('0x38')](_0x43b6ef[_0x58c2('0x2c')]);if(_0x4e1ba6[_0x58c2('0x27')]>0x0){return _0x3a169a[_0x58c2('0x15')](0x190)['json'](_0x4e1ba6);}var _0x10f587=_0x43b6ef['body'][_0x58c2('0x35')];var _0x2cb1c5=respondWithRpcPromise('VoiceChannels');var _0x4b251e=getAgent(_0x10f587);return Promise[_0x58c2('0x22')]([_0x2cb1c5,_0x4b251e])['then'](function(_0x59a3ef){var _0x24bca8=_0x59a3ef[0x0];var _0x3f8e7c=_0x59a3ef[0x1];var _0x1a39bb=_[_0x58c2('0x23')](_0x24bca8[_0x58c2('0x24')],function(_0x421f7d){return _0x421f7d[_0x58c2('0x25')]==_0x3f8e7c['id'];});return _0x3a169a['status'](0xc8)[_0x58c2('0x2d')]({'count':_0x1a39bb['length'],'rows':_0x1a39bb});})['catch'](handleError(_0x3a169a));};exports['conference']=function(_0x21ad0f,_0x1f66da){logger[_0x58c2('0x11')](_0x58c2('0x43'),_0x21ad0f[_0x58c2('0x2c')]);var _0x238e6e=conferenceValidation['validate'](_0x21ad0f[_0x58c2('0x2c')]);if(_0x238e6e[_0x58c2('0x27')]>0x0){return _0x1f66da[_0x58c2('0x15')](0x190)[_0x58c2('0x2d')](_0x238e6e);}var _0x394bc0=_0x21ad0f['body'][_0x58c2('0x35')];return getAgent(_0x394bc0)[_0x58c2('0x19')](function(_0x4e68e2){logger[_0x58c2('0x11')](_0x58c2('0x30'),_0x4e68e2['name']);emit(util[_0x58c2('0x31')](_0x58c2('0x32'),_0x4e68e2[_0x58c2('0x14')]),_0x58c2('0x44'));return _0x1f66da[_0x58c2('0x15')](0xc8)[_0x58c2('0x2d')]({'error':![],'message':_0x58c2('0x45')});})[_0x58c2('0x1d')](handleError(_0x1f66da));};exports[_0x58c2('0x46')]=function(_0x3ce842,_0x116e28){logger[_0x58c2('0x11')](_0x58c2('0x47'),_0x3ce842[_0x58c2('0x2c')]);var _0x653ec4=transferValidation[_0x58c2('0x38')](_0x3ce842[_0x58c2('0x2c')]);if(_0x653ec4[_0x58c2('0x27')]>0x0){return _0x116e28['status'](0x190)[_0x58c2('0x2d')](_0x653ec4);}var _0x445ec3=_0x3ce842[_0x58c2('0x2c')][_0x58c2('0x35')];var _0x50e780=_0x3ce842['body'][_0x58c2('0x26')];var _0x521089=_0x3ce842[_0x58c2('0x2c')][_0x58c2('0x48')];return getAgent(_0x445ec3)[_0x58c2('0x19')](function(_0x5d13b5){logger[_0x58c2('0x11')](_0x58c2('0x30'),_0x5d13b5[_0x58c2('0x14')]);emit(util[_0x58c2('0x31')](_0x58c2('0x32'),_0x5d13b5[_0x58c2('0x14')]),_0x58c2('0x49'),{'sessionId':_0x50e780,'transferNumber':_0x521089});return _0x116e28['status'](0xc8)['json']({'error':![],'message':_0x58c2('0x4a')});})[_0x58c2('0x1d')](handleError(_0x116e28));}; \ No newline at end of file +var _0x12f1=['agent','all','rows','UserId','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','webbar:hangup','hangup\x20executed!','sessionId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','then','code','message','result','catch'];(function(_0x2b89ff,_0x1a6f76){var _0x1d56b0=function(_0xbc750d){while(--_0xbc750d){_0x2b89ff['push'](_0x2b89ff['shift']());}};_0x1d56b0(++_0x1a6f76);}(_0x12f1,0xf4));var _0x112f=function(_0x58ef77,_0x52605d){_0x58ef77=_0x58ef77-0x0;var _0x2c7fa4=_0x12f1[_0x58ef77];return _0x2c7fa4;};'use strict';var path=require(_0x112f('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x112f('0x1'))['db'];var config=require(_0x112f('0x2'));var util=require(_0x112f('0x3'));var BPromise=require(_0x112f('0x4'));var jayson=require(_0x112f('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require('../../config/logger')(_0x112f('0x6'));var Redis=require('ioredis');config[_0x112f('0x7')]=_[_0x112f('0x8')](config[_0x112f('0x7')],{'host':_0x112f('0x9'),'port':0x18eb});var io=require(_0x112f('0xa'))(new Redis(config[_0x112f('0x7')]));var Schema=require(_0x112f('0xb'));var originateValidation=new Schema({'userId':{'type':_0x112f('0xc'),'required':[!![],_0x112f('0xd')]},'callNumber':{'type':'string','required':[!![],_0x112f('0xe')]},'callerId':{'type':_0x112f('0xf')},'callbackUrl':{'type':_0x112f('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x112f('0xc'),'required':[!![],_0x112f('0xd')]},'sessionId':{'type':_0x112f('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x112f('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x112f('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x112f('0xc'),'required':[!![],_0x112f('0xd')]},'sessionId':{'type':_0x112f('0xf'),'required':[!![],_0x112f('0x10')]},'transferNumber':{'type':_0x112f('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x112f('0xc'),'required':[!![],_0x112f('0xd')]},'sessionId':{'type':_0x112f('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x112f('0xc'),'required':[!![],_0x112f('0xd')]},'sessionId':{'type':_0x112f('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x112f('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x28e5ff,_0x1d704a,_0x3b2817){logger[_0x112f('0x11')](_0x28e5ff,_0x1d704a,JSON[_0x112f('0x12')](_0x3b2817));io['to'](_0x28e5ff)[_0x112f('0x13')](_0x1d704a,_0x3b2817);}function handleError(_0x5129be){return function(_0xc8a6c5){console[_0x112f('0x14')](_0x112f('0x15'),_0xc8a6c5,_0xc8a6c5 instanceof RangeError);logger[_0x112f('0x16')](_0xc8a6c5[_0x112f('0x17')]);if(_0xc8a6c5 instanceof RangeError){if(_0xc8a6c5['name']){delete _0xc8a6c5[_0x112f('0x18')];}_0x5129be[_0x112f('0x19')](0x194)[_0x112f('0x1a')](_0xc8a6c5);}else{if(_0xc8a6c5[_0x112f('0x18')]){delete _0xc8a6c5[_0x112f('0x18')];}_0x5129be[_0x112f('0x19')](0x1f4)[_0x112f('0x1a')](_0xc8a6c5);}};}function checkError(){return function(_0x3b5dd5){if(!_0x3b5dd5){throw new RangeError('NotFound');}return _0x3b5dd5;};}function respondWithRpcPromise(_0x12eede,_0x4d6a5b){return new BPromise(function(_0x435ea3,_0x2deba0){var _0x116b51=amiClient;return _0x116b51['request'](_0x12eede,_0x4d6a5b)[_0x112f('0x1b')](function(_0x5e4473){if(_0x5e4473[_0x112f('0x16')]){if(_0x5e4473['error'][_0x112f('0x1c')]===0x1f4){return _0x2deba0(_0x5e4473[_0x112f('0x16')]['message']);}return _0x435ea3(_0x5e4473[_0x112f('0x16')][_0x112f('0x1d')]);}else{_0x435ea3(_0x5e4473[_0x112f('0x1e')]);}})[_0x112f('0x1f')](function(_0x2b4204){_0x2deba0(_0x2b4204);});});}function getAgent(_0x2de0e2){return db['User']['findOne']({'where':{'id':_0x2de0e2,'role':_0x112f('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x424431,_0x2f2000){return new BPromise(function(_0x42989a,_0x14bb05){var _0x11b5d4=respondWithRpcPromise('VoiceChannels');var _0x587dc0=getAgent(_0x424431);Promise[_0x112f('0x21')]([_0x11b5d4,_0x587dc0])[_0x112f('0x1b')](function(_0x5df6f2){var _0x5a8e47=_0x5df6f2[0x0];var _0x23a33c=_0x5df6f2[0x1];var _0x4b9a63=_['filter'](_0x5a8e47[_0x112f('0x22')],function(_0x13f20c){return _0x13f20c[_0x112f('0x23')]==_0x23a33c['id']&&_0x13f20c['sessionId']==_0x2f2000;});if(_0x4b9a63['length']==0x1){_0x42989a(_0x23a33c);}else{_0x14bb05(new RangeError('sessionId\x20'+_0x2f2000+_0x112f('0x24')));}});});}exports[_0x112f('0x25')]=function(_0x1806a9,_0x224ee2){logger[_0x112f('0x11')](_0x112f('0x26'),_0x1806a9[_0x112f('0x27')]);var _0x37264f=originateValidation[_0x112f('0xb')](_0x1806a9[_0x112f('0x27')]);if(_0x37264f[_0x112f('0x28')]>0x0){return _0x224ee2[_0x112f('0x19')](0x190)[_0x112f('0x29')](_0x37264f);}var _0x2fb315=_0x1806a9[_0x112f('0x27')][_0x112f('0x2a')];var _0x2fdc1b=_0x1806a9[_0x112f('0x27')][_0x112f('0x2b')];var _0x1eeefb=_0x1806a9[_0x112f('0x27')][_0x112f('0x2c')];var _0x45443c=_0x1806a9[_0x112f('0x27')][_0x112f('0x2d')];return getAgent(_0x2fb315)[_0x112f('0x1b')](function(_0x4b54e7){logger[_0x112f('0x11')](_0x112f('0x2e'),_0x4b54e7[_0x112f('0x18')]);emit(util[_0x112f('0x2f')](_0x112f('0x30'),_0x4b54e7[_0x112f('0x18')]),'webbar:originate',{'callNumber':_0x2fdc1b,'callerId':_0x1eeefb,'callbackUrl':_0x45443c});return _0x224ee2[_0x112f('0x19')](0xc8)[_0x112f('0x29')]({'error':![],'message':_0x112f('0x31')});})['catch'](handleError(_0x224ee2));};exports['hangup']=function(_0x1df5ea,_0x51070e){logger[_0x112f('0x11')]('hangup\x20fired:',_0x1df5ea[_0x112f('0x27')]);var _0x51f1f7=hangupValidation[_0x112f('0xb')](_0x1df5ea[_0x112f('0x27')]);if(_0x51f1f7[_0x112f('0x28')]>0x0){return _0x51070e[_0x112f('0x19')](0x190)[_0x112f('0x29')](_0x51f1f7);}var _0x3e95ff=_0x1df5ea[_0x112f('0x27')][_0x112f('0x2a')];var _0x548421=_0x1df5ea['body']['sessionId'];return getAgent(_0x3e95ff)[_0x112f('0x1b')](function(_0x4d2ae7){logger[_0x112f('0x11')](_0x112f('0x2e'),_0x4d2ae7[_0x112f('0x18')]);emit(util[_0x112f('0x2f')](_0x112f('0x30'),_0x4d2ae7[_0x112f('0x18')]),_0x112f('0x32'),{'sessionId':_0x548421});return _0x51070e['status'](0xc8)[_0x112f('0x29')]({'error':![],'message':_0x112f('0x33')});})[_0x112f('0x1f')](handleError(_0x51070e));};exports['answer']=function(_0x4175a8,_0x5b5e3c){logger[_0x112f('0x11')]('answer\x20fired:',_0x4175a8['body']);var _0x3e7456=answerValidation['validate'](_0x4175a8[_0x112f('0x27')]);if(_0x3e7456[_0x112f('0x28')]>0x0){return _0x5b5e3c[_0x112f('0x19')](0x190)['json'](_0x3e7456);}var _0x25ee21=_0x4175a8['body'][_0x112f('0x2a')];var _0x313bba=_0x4175a8[_0x112f('0x27')][_0x112f('0x34')];return getAgent(_0x25ee21)[_0x112f('0x1b')](function(_0xf4b550){logger[_0x112f('0x11')](_0x112f('0x2e'),_0xf4b550['name']);emit(util[_0x112f('0x2f')]('user:%s',_0xf4b550[_0x112f('0x18')]),_0x112f('0x35'),{'sessionId':_0x313bba});return _0x5b5e3c[_0x112f('0x19')](0xc8)[_0x112f('0x29')]({'error':![],'message':_0x112f('0x36')});})[_0x112f('0x1f')](handleError(_0x5b5e3c));};exports[_0x112f('0x37')]=function(_0x219f1c,_0xa5fc19){logger['info'](_0x112f('0x38'),_0x219f1c['body']);var _0x2750f7=holdValidation['validate'](_0x219f1c[_0x112f('0x27')]);if(_0x2750f7[_0x112f('0x28')]>0x0){return _0xa5fc19[_0x112f('0x19')](0x190)['json'](_0x2750f7);}var _0x39aa8f=_0x219f1c[_0x112f('0x27')][_0x112f('0x2a')];var _0x4baab1=_0x219f1c[_0x112f('0x27')][_0x112f('0x34')];return getAgent(_0x39aa8f)['then'](function(_0xf89842){logger[_0x112f('0x11')](_0x112f('0x2e'),_0xf89842['name']);emit(util['format'](_0x112f('0x30'),_0xf89842[_0x112f('0x18')]),_0x112f('0x39'),{'sessionId':_0x4baab1});return _0xa5fc19[_0x112f('0x19')](0xc8)[_0x112f('0x29')]({'error':![],'message':_0x112f('0x3a')});})[_0x112f('0x1f')](handleError(_0xa5fc19));};exports['unhold']=function(_0x22638b,_0xf8ed04){logger[_0x112f('0x11')]('unhold\x20fired:',_0x22638b['body']);var _0x162908=unholdValidation[_0x112f('0xb')](_0x22638b[_0x112f('0x27')]);if(_0x162908[_0x112f('0x28')]>0x0){return _0xf8ed04['status'](0x190)[_0x112f('0x29')](_0x162908);}var _0x27b2b7=_0x22638b['body']['userId'];var _0x192995=_0x22638b[_0x112f('0x27')][_0x112f('0x34')];return getAgent(_0x27b2b7)[_0x112f('0x1b')](function(_0x21d803){logger['info']('entityFound:',_0x21d803[_0x112f('0x18')]);emit(util[_0x112f('0x2f')]('user:%s',_0x21d803[_0x112f('0x18')]),'webbar:unhold',{'sessionId':_0x192995});return _0xf8ed04[_0x112f('0x19')](0xc8)[_0x112f('0x29')]({'error':![],'message':_0x112f('0x3b')});})['catch'](handleError(_0xf8ed04));};exports[_0x112f('0x3c')]=function(_0x14c791,_0x252fc8){logger[_0x112f('0x11')](_0x112f('0x3d'),_0x252fc8[_0x112f('0x27')]);var _0x11cc95=callsValidation[_0x112f('0xb')](_0x14c791['body']);if(_0x11cc95[_0x112f('0x28')]>0x0){return _0x252fc8[_0x112f('0x19')](0x190)[_0x112f('0x29')](_0x11cc95);}var _0x167a64=_0x14c791[_0x112f('0x27')][_0x112f('0x2a')];var _0x4d5ed6=respondWithRpcPromise(_0x112f('0x3e'));var _0x1993c3=getAgent(_0x167a64);return Promise['all']([_0x4d5ed6,_0x1993c3])[_0x112f('0x1b')](function(_0x4e3387){var _0x362897=_0x4e3387[0x0];var _0x314b8f=_0x4e3387[0x1];var _0x24ff4b=_['filter'](_0x362897[_0x112f('0x22')],function(_0x5c98f5){return _0x5c98f5[_0x112f('0x23')]==_0x314b8f['id'];});return _0x252fc8[_0x112f('0x19')](0xc8)[_0x112f('0x29')]({'count':_0x24ff4b[_0x112f('0x28')],'rows':_0x24ff4b});})[_0x112f('0x1f')](handleError(_0x252fc8));};exports[_0x112f('0x3f')]=function(_0x1e0a9f,_0x7ea45c){logger[_0x112f('0x11')](_0x112f('0x40'),_0x1e0a9f[_0x112f('0x27')]);var _0x2d3d18=conferenceValidation[_0x112f('0xb')](_0x1e0a9f[_0x112f('0x27')]);if(_0x2d3d18[_0x112f('0x28')]>0x0){return _0x7ea45c[_0x112f('0x19')](0x190)[_0x112f('0x29')](_0x2d3d18);}var _0x36a91f=_0x1e0a9f[_0x112f('0x27')]['userId'];return getAgent(_0x36a91f)[_0x112f('0x1b')](function(_0x138e72){logger[_0x112f('0x11')](_0x112f('0x2e'),_0x138e72[_0x112f('0x18')]);emit(util[_0x112f('0x2f')]('user:%s',_0x138e72[_0x112f('0x18')]),_0x112f('0x41'));return _0x7ea45c['status'](0xc8)[_0x112f('0x29')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x7ea45c));};exports['transfer']=function(_0x303768,_0x4e6f67){logger[_0x112f('0x11')](_0x112f('0x42'),_0x303768[_0x112f('0x27')]);var _0x1ceb9b=transferValidation[_0x112f('0xb')](_0x303768['body']);if(_0x1ceb9b[_0x112f('0x28')]>0x0){return _0x4e6f67['status'](0x190)[_0x112f('0x29')](_0x1ceb9b);}var _0x2664b8=_0x303768[_0x112f('0x27')]['userId'];var _0x48ba7f=_0x303768[_0x112f('0x27')][_0x112f('0x34')];var _0xe786cc=_0x303768[_0x112f('0x27')][_0x112f('0x43')];return getAgent(_0x2664b8)[_0x112f('0x1b')](function(_0x539e6a){logger['info'](_0x112f('0x2e'),_0x539e6a[_0x112f('0x18')]);emit(util[_0x112f('0x2f')](_0x112f('0x30'),_0x539e6a[_0x112f('0x18')]),_0x112f('0x44'),{'sessionId':_0x48ba7f,'transferNumber':_0xe786cc});return _0x4e6f67[_0x112f('0x19')](0xc8)[_0x112f('0x29')]({'error':![],'message':'transfer\x20executed!'});})[_0x112f('0x1f')](handleError(_0x4e6f67));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 9de9262..d2d6dc7 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 _0xcf35=['../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/users','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','fs-extra'];(function(_0x46530d,_0x121f73){var _0x4774c3=function(_0x2f5c02){while(--_0x2f5c02){_0x46530d['push'](_0x46530d['shift']());}};_0x4774c3(++_0x121f73);}(_0xcf35,0x83));var _0x5cf3=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0xcf35[_0x3c414c];return _0x4f3062;};'use strict';var multer=require(_0x5cf3('0x0'));var util=require('util');var path=require(_0x5cf3('0x1'));var timeout=require('connect-timeout');var express=require(_0x5cf3('0x2'));var router=express[_0x5cf3('0x3')]();var fs_extra=require(_0x5cf3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5cf3('0x5'));var controller=require(_0x5cf3('0x6'));router[_0x5cf3('0x7')]('/',auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x9')]);router[_0x5cf3('0x7')]('/describe',auth[_0x5cf3('0x8')](),controller[_0x5cf3('0xa')]);router[_0x5cf3('0x7')](_0x5cf3('0xb'),auth[_0x5cf3('0x8')](),controller[_0x5cf3('0xc')]);router[_0x5cf3('0x7')](_0x5cf3('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x5cf3('0x7')]('/:id/canned_answers',auth[_0x5cf3('0x8')](),controller['getAnswers']);router[_0x5cf3('0x7')](_0x5cf3('0xe'),auth[_0x5cf3('0x8')](),controller[_0x5cf3('0xf')]);router[_0x5cf3('0x7')](_0x5cf3('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x5cf3('0x11')]('/',auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x12')]);router[_0x5cf3('0x11')](_0x5cf3('0xd'),auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x13')]);router['post'](_0x5cf3('0x14'),auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x15')]);router[_0x5cf3('0x11')]('/:id/users',auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x16')]);router[_0x5cf3('0x11')](_0x5cf3('0x10'),auth['isAuthenticated'](),controller[_0x5cf3('0x17')]);router[_0x5cf3('0x11')](_0x5cf3('0x18'),controller[_0x5cf3('0x19')]);router[_0x5cf3('0x11')]('/:id/send',auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x1a')]);router[_0x5cf3('0x1b')](_0x5cf3('0xb'),auth['isAuthenticated'](),controller[_0x5cf3('0x1c')]);router[_0x5cf3('0x1d')](_0x5cf3('0xb'),auth[_0x5cf3('0x8')](),controller['destroy']);router[_0x5cf3('0x1d')]('/:id/dispositions',auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x1e')]);router[_0x5cf3('0x1d')](_0x5cf3('0x14'),auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x1f')]);router[_0x5cf3('0x1d')](_0x5cf3('0xe'),auth[_0x5cf3('0x8')](),controller[_0x5cf3('0x20')]);module[_0x5cf3('0x21')]=router; \ No newline at end of file +var _0x4b4d=['describe','/:id','/:id/dispositions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAgents','/:id/applications','/:id/notify','/:id/send','put','update','delete','destroy','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x1c8408,_0x31828c){var _0x34d134=function(_0xc18d96){while(--_0xc18d96){_0x1c8408['push'](_0x1c8408['shift']());}};_0x34d134(++_0x31828c);}(_0x4b4d,0xd8));var _0xd4b4=function(_0x2938b8,_0x2c9c72){_0x2938b8=_0x2938b8-0x0;var _0x3ece20=_0x4b4d[_0x2938b8];return _0x3ece20;};'use strict';var multer=require(_0xd4b4('0x0'));var util=require(_0xd4b4('0x1'));var path=require(_0xd4b4('0x2'));var timeout=require(_0xd4b4('0x3'));var express=require(_0xd4b4('0x4'));var router=express[_0xd4b4('0x5')]();var fs_extra=require(_0xd4b4('0x6'));var auth=require(_0xd4b4('0x7'));var interaction=require(_0xd4b4('0x8'));var config=require(_0xd4b4('0x9'));var controller=require(_0xd4b4('0xa'));router[_0xd4b4('0xb')]('/',auth['isAuthenticated'](),controller[_0xd4b4('0xc')]);router['get'](_0xd4b4('0xd'),auth[_0xd4b4('0xe')](),controller[_0xd4b4('0xf')]);router[_0xd4b4('0xb')](_0xd4b4('0x10'),auth[_0xd4b4('0xe')](),controller['show']);router[_0xd4b4('0xb')](_0xd4b4('0x11'),auth[_0xd4b4('0xe')](),controller['getDispositions']);router[_0xd4b4('0xb')]('/:id/canned_answers',auth[_0xd4b4('0xe')](),controller['getAnswers']);router[_0xd4b4('0xb')](_0xd4b4('0x12'),auth['isAuthenticated'](),controller[_0xd4b4('0x13')]);router[_0xd4b4('0xb')]('/:id/applications',auth[_0xd4b4('0xe')](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller[_0xd4b4('0x14')]);router[_0xd4b4('0x15')](_0xd4b4('0x11'),auth['isAuthenticated'](),controller[_0xd4b4('0x16')]);router[_0xd4b4('0x15')](_0xd4b4('0x17'),auth[_0xd4b4('0xe')](),controller['addAnswer']);router[_0xd4b4('0x15')]('/:id/users',auth[_0xd4b4('0xe')](),controller[_0xd4b4('0x18')]);router['post'](_0xd4b4('0x19'),auth['isAuthenticated'](),controller['addApplications']);router[_0xd4b4('0x15')](_0xd4b4('0x1a'),controller['notify']);router[_0xd4b4('0x15')](_0xd4b4('0x1b'),auth['isAuthenticated'](),controller['send']);router[_0xd4b4('0x1c')](_0xd4b4('0x10'),auth[_0xd4b4('0xe')](),controller[_0xd4b4('0x1d')]);router[_0xd4b4('0x1e')](_0xd4b4('0x10'),auth[_0xd4b4('0xe')](),controller[_0xd4b4('0x1f')]);router[_0xd4b4('0x1e')](_0xd4b4('0x11'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xd4b4('0x1e')]('/:id/canned_answers',auth[_0xd4b4('0xe')](),controller[_0xd4b4('0x20')]);router[_0xd4b4('0x1e')](_0xd4b4('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b161a02..5ec6681 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 _0x0f3c=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x8f8e58,_0x2fa3cc){var _0x24ce7a=function(_0x41bcca){while(--_0x41bcca){_0x8f8e58['push'](_0x8f8e58['shift']());}};_0x24ce7a(++_0x2fa3cc);}(_0x0f3c,0x185));var _0xc0f3=function(_0x478527,_0x2a3b0f){_0x478527=_0x478527-0x0;var _0x28c5fc=_0x0f3c[_0x478527];return _0x28c5fc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc0f3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc0f3('0x1')],'defaultValue':function(){return rs[_0xc0f3('0x2')]();}},'phone':{'type':Sequelize[_0xc0f3('0x1')]},'type':{'type':Sequelize[_0xc0f3('0x3')](_0xc0f3('0x4'))},'accountSid':{'type':Sequelize[_0xc0f3('0x1')]},'authToken':{'type':Sequelize[_0xc0f3('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc0f3('0x5');}},'notificationSound':{'type':Sequelize[_0xc0f3('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc0f3('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc0f3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc0f3('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc0f3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc0f3('0x7')],'comment':_0xc0f3('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xc0f3('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x400004){if(!_0x400004){this[_0xc0f3('0x9')](_0xc0f3('0xa'),null);}this[_0xc0f3('0x9')](_0xc0f3('0xb'),_0x400004);}},'description':{'type':Sequelize[_0xc0f3('0x1')]}}; \ No newline at end of file +var _0x462f=['randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize'];(function(_0x34b36e,_0x5753a8){var _0x5e8a5a=function(_0x409fb6){while(--_0x409fb6){_0x34b36e['push'](_0x34b36e['shift']());}};_0x5e8a5a(++_0x5753a8);}(_0x462f,0x68));var _0xf462=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x462f[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require(_0xf462('0x0'));var rs=require(_0xf462('0x1'));module[_0xf462('0x2')]={'name':{'type':Sequelize[_0xf462('0x3')],'unique':_0xf462('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xf462('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf462('0x5')]();}},'phone':{'type':Sequelize[_0xf462('0x3')]},'type':{'type':Sequelize[_0xf462('0x6')](_0xf462('0x7'))},'accountSid':{'type':Sequelize[_0xf462('0x3')]},'authToken':{'type':Sequelize[_0xf462('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf462('0x8')],'defaultValue':function(){return _0xf462('0x9');}},'notificationSound':{'type':Sequelize[_0xf462('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf462('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf462('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf462('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf462('0xb')],'comment':_0xf462('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xf462('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1098e9){if(!_0x1098e9){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xf462('0xd')](_0xf462('0xe'),_0x1098e9);}},'description':{'type':Sequelize[_0xf462('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 0333b1d..09fb409 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 _0xc1ea=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','WhatsappAccount','findAll','rows','params','Pause','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','describe','WhatsappAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addAgents','omit','spread','removeAgents','isArray','emit','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','push','unmanaged','*,*,*,*','WhatsappMessage','UserId','User','unshift','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','dataValues','Messages','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x546005,_0x354855){var _0x516d1e=function(_0x5afc06){while(--_0x5afc06){_0x546005['push'](_0x546005['shift']());}};_0x516d1e(++_0x354855);}(_0xc1ea,0xa2));var _0xac1e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc1ea[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xac1e('0x0'));var jsonpatch=require(_0xac1e('0x1'));var rp=require(_0xac1e('0x2'));var moment=require(_0xac1e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac1e('0x4'));var util=require(_0xac1e('0x5'));var path=require(_0xac1e('0x6'));var sox=require(_0xac1e('0x7'));var csv=require('to-csv');var ejs=require(_0xac1e('0x8'));var fs=require('fs');var fs_extra=require(_0xac1e('0x9'));var _=require(_0xac1e('0xa'));var squel=require(_0xac1e('0xb'));var crypto=require('crypto');var jsforce=require(_0xac1e('0xc'));var deskjs=require(_0xac1e('0xd'));var toCsv=require(_0xac1e('0xe'));var querystring=require('querystring');var Papa=require(_0xac1e('0xf'));var Redis=require(_0xac1e('0x10'));var authService=require(_0xac1e('0x11'));var qs=require(_0xac1e('0x12'));var as=require(_0xac1e('0x13'));var hardwareService=require(_0xac1e('0x14'));var logger=require(_0xac1e('0x15'))(_0xac1e('0x16'));var utils=require('../../config/utils');var config=require(_0xac1e('0x17'));var licenseUtil=require(_0xac1e('0x18'));var db=require(_0xac1e('0x19'))['db'];config[_0xac1e('0x1a')]=_[_0xac1e('0x1b')](config[_0xac1e('0x1a')],{'host':_0xac1e('0x1c'),'port':0x18eb});var socket=require(_0xac1e('0x1d'))(new Redis(config['redis']));require(_0xac1e('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xac1e('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1133d1,_0x539a15,_0x51a0f6,_0x3a3566){return new BPromise(function(_0xe8e407,_0x3a3f51){var _0x508c1c=_0x3a3566||client;return _0x508c1c[_0xac1e('0x20')](_0x1133d1,_0x51a0f6)[_0xac1e('0x21')](function(_0x594c95){logger[_0xac1e('0x22')](_0xac1e('0x23'),_0x539a15,'request\x20sent');logger[_0xac1e('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x539a15,_0xac1e('0x25'),JSON[_0xac1e('0x26')](_0x594c95));if(_0x594c95['error']){if(_0x594c95[_0xac1e('0x27')][_0xac1e('0x28')]===0x1f4){logger[_0xac1e('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x539a15,_0x594c95[_0xac1e('0x27')][_0xac1e('0x29')]);return _0x3a3f51(_0x594c95[_0xac1e('0x27')]['message']);}logger[_0xac1e('0x27')](_0xac1e('0x23'),_0x539a15,_0x594c95[_0xac1e('0x27')]['message']);return _0xe8e407(_0x594c95[_0xac1e('0x27')][_0xac1e('0x29')]);}else{logger[_0xac1e('0x22')](_0xac1e('0x23'),_0x539a15,'request\x20sent');_0xe8e407(_0x594c95[_0xac1e('0x2a')]['message']);}})['catch'](function(_0x291dd6){logger[_0xac1e('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x539a15,_0x291dd6);_0x3a3f51(_0x291dd6);});});}function respondWithStatusCode(_0x1c881d,_0x21b18e){_0x21b18e=_0x21b18e||0xcc;return function(_0x468bfe){if(_0x468bfe){return _0x1c881d['sendStatus'](_0x21b18e);}return _0x1c881d[_0xac1e('0x2b')](_0x21b18e)[_0xac1e('0x2c')]();};}function respondWithResult(_0x2d96c5,_0x5314a2){_0x5314a2=_0x5314a2||0xc8;return function(_0x312e44){if(_0x312e44){return _0x2d96c5[_0xac1e('0x2b')](_0x5314a2)[_0xac1e('0x2d')](_0x312e44);}};}function respondWithFilteredResult(_0x4f5f81,_0x2077a2){return function(_0x3a000a){if(_0x3a000a){var _0x147236=typeof _0x2077a2[_0xac1e('0x2e')]===_0xac1e('0x2f')&&typeof _0x2077a2[_0xac1e('0x30')]===_0xac1e('0x2f');var _0x1a354a=_0x3a000a[_0xac1e('0x31')];var _0x29cf08=_0x147236?0x0:_0x2077a2[_0xac1e('0x2e')];var _0x2cdc1c=_0x147236?_0x3a000a['count']:_0x2077a2['offset']+_0x2077a2[_0xac1e('0x30')];var _0x39e55a;if(_0x2cdc1c>=_0x1a354a){_0x2cdc1c=_0x1a354a;_0x39e55a=0xc8;}else{_0x39e55a=0xce;}_0x4f5f81[_0xac1e('0x2b')](_0x39e55a);return _0x4f5f81[_0xac1e('0x32')]('Content-Range',_0x29cf08+'-'+_0x2cdc1c+'/'+_0x1a354a)[_0xac1e('0x2d')](_0x3a000a);}return null;};}function patchUpdates(_0x18f19a){return function(_0x21bda9){try{jsonpatch[_0xac1e('0x33')](_0x21bda9,_0x18f19a,!![]);}catch(_0xa908ee){return BPromise['reject'](_0xa908ee);}return _0x21bda9[_0xac1e('0x34')]();};}function saveUpdates(_0x5104f0,_0x2a6475){return function(_0x414eb2){if(_0x414eb2){return _0x414eb2[_0xac1e('0x35')](_0x5104f0)['then'](function(_0x5b1a51){return _0x5b1a51;});}return null;};}function removeEntity(_0xb83a,_0x5bbc1a){return function(_0x227c95){if(_0x227c95){return _0x227c95[_0xac1e('0x36')]()['then'](function(){var _0x294abf=_0x227c95[_0xac1e('0x37')]({'plain':!![]});var _0x19e2c1=_0xac1e('0x38');return db[_0xac1e('0x39')][_0xac1e('0x36')]({'where':{'type':_0x19e2c1,'resourceId':_0x294abf['id']}})['then'](function(){return _0x227c95;});})[_0xac1e('0x21')](function(){_0xb83a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3f11,_0x5ed849){return function(_0xe2add9){if(!_0xe2add9){_0x3c3f11[_0xac1e('0x3a')](0x194);}return _0xe2add9;};}function handleError(_0x1fd5a1,_0xe1e16b){_0xe1e16b=_0xe1e16b||0x1f4;return function(_0x1b689d){logger['error'](_0x1b689d[_0xac1e('0x3b')]);if(_0x1b689d[_0xac1e('0x3c')]){delete _0x1b689d[_0xac1e('0x3c')];}_0x1fd5a1[_0xac1e('0x2b')](_0xe1e16b)[_0xac1e('0x3d')](_0x1b689d);};}exports[_0xac1e('0x3e')]=function(_0x43473a,_0x1c3f3c){var _0x4737e1={'include':[{'model':db['Pause'],'as':_0xac1e('0x3f')}]},_0x5d2200={},_0x557e7e={'count':0x0,'rows':[]};var _0x10c3c6=_[_0xac1e('0x40')](db['WhatsappAccount'][_0xac1e('0x41')],function(_0x21a2b0){return{'name':_0x21a2b0[_0xac1e('0x42')],'type':_0x21a2b0[_0xac1e('0x43')][_0xac1e('0x44')]};});_0x5d2200[_0xac1e('0x45')]=_['map'](_0x10c3c6,'name');_0x5d2200['query']=_[_0xac1e('0x46')](_0x43473a['query']);_0x5d2200[_0xac1e('0x47')]=_[_0xac1e('0x48')](_0x5d2200[_0xac1e('0x45')],_0x5d2200['query']);_0x4737e1['attributes']=_['intersection'](_0x5d2200[_0xac1e('0x45')],qs[_0xac1e('0x49')](_0x43473a['query'][_0xac1e('0x49')]));_0x4737e1[_0xac1e('0x4a')]=_0x4737e1[_0xac1e('0x4a')][_0xac1e('0x4b')]?_0x4737e1[_0xac1e('0x4a')]:_0x5d2200['model'];if(!_0x43473a[_0xac1e('0x4c')][_0xac1e('0x4d')](_0xac1e('0x4e'))){_0x4737e1[_0xac1e('0x30')]=qs[_0xac1e('0x30')](_0x43473a['query'][_0xac1e('0x30')]);_0x4737e1[_0xac1e('0x2e')]=qs['offset'](_0x43473a[_0xac1e('0x4c')][_0xac1e('0x2e')]);}_0x4737e1['order']=qs[_0xac1e('0x4f')](_0x43473a['query'][_0xac1e('0x4f')]);_0x4737e1[_0xac1e('0x50')]=qs[_0xac1e('0x47')](_[_0xac1e('0x51')](_0x43473a[_0xac1e('0x4c')],_0x5d2200[_0xac1e('0x47')]),_0x10c3c6);if(_0x43473a[_0xac1e('0x4c')][_0xac1e('0x52')]){_0x4737e1[_0xac1e('0x50')]=_[_0xac1e('0x53')](_0x4737e1['where'],{'$or':_[_0xac1e('0x40')](_0x10c3c6,function(_0x2fde94){if(_0x2fde94['type']!==_0xac1e('0x54')){var _0x4f6e39={};_0x4f6e39[_0x2fde94[_0xac1e('0x3c')]]={'$like':'%'+_0x43473a[_0xac1e('0x4c')][_0xac1e('0x52')]+'%'};return _0x4f6e39;}})});}_0x4737e1=_['merge']({},_0x4737e1,_0x43473a[_0xac1e('0x55')]);var _0x40f1b1={'where':_0x4737e1[_0xac1e('0x50')]};return db['WhatsappAccount']['count'](_0x40f1b1)[_0xac1e('0x21')](function(_0x52406a){_0x557e7e[_0xac1e('0x31')]=_0x52406a;if(_0x43473a[_0xac1e('0x4c')][_0xac1e('0x56')]){_0x4737e1['include']=[{'all':!![]}];}return db[_0xac1e('0x57')][_0xac1e('0x58')](_0x4737e1);})[_0xac1e('0x21')](function(_0x29c73d){_0x557e7e[_0xac1e('0x59')]=_0x29c73d;return _0x557e7e;})['then'](respondWithFilteredResult(_0x1c3f3c,_0x4737e1))['catch'](handleError(_0x1c3f3c,null));};exports['show']=function(_0x58a316,_0x4b39ae){var _0x539b94={'raw':![],'where':{'id':_0x58a316[_0xac1e('0x5a')]['id']},'include':[{'model':db[_0xac1e('0x5b')],'as':_0xac1e('0x3f')}]},_0x46159b={};_0x46159b[_0xac1e('0x45')]=_[_0xac1e('0x46')](db[_0xac1e('0x57')][_0xac1e('0x41')]);_0x46159b[_0xac1e('0x4c')]=_['keys'](_0x58a316[_0xac1e('0x4c')]);_0x46159b['filters']=_['intersection'](_0x46159b[_0xac1e('0x45')],_0x46159b[_0xac1e('0x4c')]);_0x539b94[_0xac1e('0x4a')]=_['intersection'](_0x46159b['model'],qs['fields'](_0x58a316[_0xac1e('0x4c')][_0xac1e('0x49')]));_0x539b94[_0xac1e('0x4a')]=_0x539b94[_0xac1e('0x4a')]['length']?_0x539b94[_0xac1e('0x4a')]:_0x46159b[_0xac1e('0x45')];if(_0x58a316['query'][_0xac1e('0x56')]){_0x539b94[_0xac1e('0x5c')]=[{'all':!![]}];}_0x539b94=_[_0xac1e('0x53')]({},_0x539b94,_0x58a316['options']);return db['WhatsappAccount'][_0xac1e('0x5d')](_0x539b94)[_0xac1e('0x21')](handleEntityNotFound(_0x4b39ae,null))[_0xac1e('0x21')](respondWithResult(_0x4b39ae,null))['catch'](handleError(_0x4b39ae,null));};exports[_0xac1e('0x5e')]=function(_0x43ee4f,_0xb26b8d){return db[_0xac1e('0x57')]['create'](_0x43ee4f[_0xac1e('0x5f')],{})['then'](function(_0x4c5a30){var _0x38087c=_0x43ee4f[_0xac1e('0x60')][_0xac1e('0x37')]({'plain':!![]});if(!_0x38087c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38087c[_0xac1e('0x61')]===_0xac1e('0x60')){var _0x317ad9=_0x4c5a30['get']({'plain':!![]});var _0x33311a=_0xac1e('0x38');return db[_0xac1e('0x62')][_0xac1e('0x5d')]({'where':{'name':_0x33311a,'userProfileId':_0x38087c[_0xac1e('0x63')]},'raw':!![]})[_0xac1e('0x21')](function(_0xb12773){if(_0xb12773&&_0xb12773[_0xac1e('0x64')]===0x0){return db[_0xac1e('0x39')]['create']({'name':_0x317ad9[_0xac1e('0x3c')],'resourceId':_0x317ad9['id'],'type':_0xb12773[_0xac1e('0x3c')],'sectionId':_0xb12773['id']},{})[_0xac1e('0x21')](function(){return _0x4c5a30;});}else{return _0x4c5a30;}})[_0xac1e('0x65')](function(_0x4fa498){logger[_0xac1e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fa498);throw _0x4fa498;});}return _0x4c5a30;})[_0xac1e('0x21')](respondWithResult(_0xb26b8d,0xc9))[_0xac1e('0x65')](handleError(_0xb26b8d,null));};exports[_0xac1e('0x35')]=function(_0x4f6cb4,_0x21a920){if(_0x4f6cb4[_0xac1e('0x5f')]['id']){delete _0x4f6cb4[_0xac1e('0x5f')]['id'];}return db[_0xac1e('0x57')][_0xac1e('0x5d')]({'where':{'id':_0x4f6cb4[_0xac1e('0x5a')]['id']},'include':[{'model':db[_0xac1e('0x5b')],'as':_0xac1e('0x3f')}]})[_0xac1e('0x21')](handleEntityNotFound(_0x21a920,null))[_0xac1e('0x21')](saveUpdates(_0x4f6cb4[_0xac1e('0x5f')],null))[_0xac1e('0x21')](respondWithResult(_0x21a920,null))[_0xac1e('0x65')](handleError(_0x21a920,null));};exports[_0xac1e('0x36')]=function(_0x52468f,_0x1476e9){return db[_0xac1e('0x57')][_0xac1e('0x5d')]({'where':{'id':_0x52468f['params']['id']}})[_0xac1e('0x21')](handleEntityNotFound(_0x1476e9,null))[_0xac1e('0x21')](removeEntity(_0x1476e9,null))[_0xac1e('0x65')](handleError(_0x1476e9,null));};exports[_0xac1e('0x66')]=function(_0x4f042f,_0xb8d325){return db[_0xac1e('0x57')][_0xac1e('0x66')]()[_0xac1e('0x21')](respondWithResult(_0xb8d325,null))[_0xac1e('0x65')](handleError(_0xb8d325,null));};exports['addDisposition']=function(_0x52bba8,_0x5e0a43,_0xaa2dd5){if(_0x52bba8[_0xac1e('0x5f')]['id']){delete _0x52bba8[_0xac1e('0x5f')]['id'];}return db['WhatsappAccount'][_0xac1e('0x5d')]({'where':{'id':_0x52bba8['params']['id']}})[_0xac1e('0x21')](handleEntityNotFound(_0x5e0a43,null))['then'](function(_0x55e9e6){if(_0x55e9e6){_0x52bba8['body'][_0xac1e('0x67')]=_0x55e9e6['id'];return db[_0xac1e('0x68')][_0xac1e('0x5e')](_0x52bba8['body']);}})[_0xac1e('0x21')](respondWithResult(_0x5e0a43,null))[_0xac1e('0x65')](handleError(_0x5e0a43,null));};exports['getDispositions']=function(_0x33012f,_0x46063a,_0x1c97ec){var _0x52f4cb={'raw':![],'where':{}};var _0x2a60e2={};var _0x5778e8={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xac1e('0x69')]({'where':{'id':_0x33012f[_0xac1e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x46063a,null))[_0xac1e('0x21')](function(_0x3dc353){if(_0x3dc353){_0x2a60e2[_0xac1e('0x45')]=_['keys'](db[_0xac1e('0x68')]['rawAttributes']);_0x2a60e2[_0xac1e('0x4c')]=_[_0xac1e('0x46')](_0x33012f['query']);_0x2a60e2[_0xac1e('0x47')]=_[_0xac1e('0x48')](_0x2a60e2['model'],_0x2a60e2['query']);_0x52f4cb[_0xac1e('0x4a')]=_[_0xac1e('0x48')](_0x2a60e2[_0xac1e('0x45')],qs[_0xac1e('0x49')](_0x33012f[_0xac1e('0x4c')][_0xac1e('0x49')]));_0x52f4cb[_0xac1e('0x4a')]=_0x52f4cb[_0xac1e('0x4a')][_0xac1e('0x4b')]?_0x52f4cb[_0xac1e('0x4a')]:_0x2a60e2['model'];if(!_0x33012f['query']['hasOwnProperty'](_0xac1e('0x4e'))){_0x52f4cb[_0xac1e('0x30')]=qs['limit'](_0x33012f[_0xac1e('0x4c')][_0xac1e('0x30')]);_0x52f4cb[_0xac1e('0x2e')]=qs[_0xac1e('0x2e')](_0x33012f[_0xac1e('0x4c')][_0xac1e('0x2e')]);}_0x52f4cb['order']=qs['sort'](_0x33012f['query'][_0xac1e('0x4f')]);_0x52f4cb[_0xac1e('0x50')]=qs[_0xac1e('0x47')](_[_0xac1e('0x51')](_0x33012f['query'],_0x2a60e2[_0xac1e('0x47')]));_0x52f4cb[_0xac1e('0x50')][_0xac1e('0x67')]=_0x3dc353['id'];if(_0x33012f[_0xac1e('0x4c')][_0xac1e('0x52')]){_0x52f4cb['where']=_[_0xac1e('0x53')](_0x52f4cb[_0xac1e('0x50')],{'$or':_[_0xac1e('0x40')](_0x52f4cb[_0xac1e('0x4a')],function(_0x3b94f4){var _0x21cd2d={};_0x21cd2d[_0x3b94f4]={'$like':'%'+_0x33012f[_0xac1e('0x4c')][_0xac1e('0x52')]+'%'};return _0x21cd2d;})});}_0x52f4cb=_[_0xac1e('0x53')]({},_0x52f4cb,_0x33012f[_0xac1e('0x55')]);return db['Disposition'][_0xac1e('0x31')]({'where':_0x52f4cb[_0xac1e('0x50')]})['then'](function(_0x3f5e31){_0x5778e8['count']=_0x3f5e31;if(_0x33012f[_0xac1e('0x4c')]['includeAll']){_0x52f4cb[_0xac1e('0x5c')]=[{'all':!![]}];}return db[_0xac1e('0x68')][_0xac1e('0x58')](_0x52f4cb);})[_0xac1e('0x21')](function(_0x4130c7){_0x5778e8[_0xac1e('0x59')]=_0x4130c7;return _0x5778e8;});}})['then'](respondWithFilteredResult(_0x46063a,_0x52f4cb))['catch'](handleError(_0x46063a,null));};exports[_0xac1e('0x6a')]=function(_0x742078,_0x1a2f81,_0x4d65c6){return db[_0xac1e('0x57')][_0xac1e('0x5d')]({'where':{'id':_0x742078['params']['id']}})['then'](handleEntityNotFound(_0x1a2f81,null))[_0xac1e('0x21')](function(_0x3b697a){if(_0x3b697a){return _0x3b697a['removeDispositions'](_0x742078['query'][_0xac1e('0x6b')]);}})['then'](respondWithStatusCode(_0x1a2f81,null))[_0xac1e('0x65')](handleError(_0x1a2f81,null));};exports[_0xac1e('0x6c')]=function(_0x59027d,_0x2517b9,_0x12f56c){if(_0x59027d[_0xac1e('0x5f')]['id']){delete _0x59027d[_0xac1e('0x5f')]['id'];}return db[_0xac1e('0x57')]['find']({'where':{'id':_0x59027d['params']['id']}})[_0xac1e('0x21')](handleEntityNotFound(_0x2517b9,null))[_0xac1e('0x21')](function(_0x25da81){if(_0x25da81){_0x59027d[_0xac1e('0x5f')]['WhatsappAccountId']=_0x25da81['id'];return db[_0xac1e('0x6d')][_0xac1e('0x5e')](_0x59027d[_0xac1e('0x5f')]);}})[_0xac1e('0x21')](respondWithResult(_0x2517b9,null))[_0xac1e('0x65')](handleError(_0x2517b9,null));};exports[_0xac1e('0x6e')]=function(_0x45dcf0,_0x52164d,_0x53e503){var _0x48b787={'raw':![],'where':{}};var _0x3cac69={};var _0x4943e9={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xac1e('0x69')]({'where':{'id':_0x45dcf0[_0xac1e('0x5a')]['id']}})[_0xac1e('0x21')](handleEntityNotFound(_0x52164d,null))[_0xac1e('0x21')](function(_0x3492e1){if(_0x3492e1){_0x3cac69['model']=_['keys'](db[_0xac1e('0x6d')]['rawAttributes']);_0x3cac69['query']=_[_0xac1e('0x46')](_0x45dcf0['query']);_0x3cac69['filters']=_[_0xac1e('0x48')](_0x3cac69[_0xac1e('0x45')],_0x3cac69['query']);_0x48b787[_0xac1e('0x4a')]=_[_0xac1e('0x48')](_0x3cac69[_0xac1e('0x45')],qs[_0xac1e('0x49')](_0x45dcf0[_0xac1e('0x4c')][_0xac1e('0x49')]));_0x48b787[_0xac1e('0x4a')]=_0x48b787[_0xac1e('0x4a')][_0xac1e('0x4b')]?_0x48b787[_0xac1e('0x4a')]:_0x3cac69['model'];if(!_0x45dcf0['query']['hasOwnProperty'](_0xac1e('0x4e'))){_0x48b787[_0xac1e('0x30')]=qs[_0xac1e('0x30')](_0x45dcf0[_0xac1e('0x4c')][_0xac1e('0x30')]);_0x48b787[_0xac1e('0x2e')]=qs[_0xac1e('0x2e')](_0x45dcf0[_0xac1e('0x4c')][_0xac1e('0x2e')]);}_0x48b787[_0xac1e('0x6f')]=qs['sort'](_0x45dcf0[_0xac1e('0x4c')][_0xac1e('0x4f')]);_0x48b787[_0xac1e('0x50')]=qs['filters'](_[_0xac1e('0x51')](_0x45dcf0[_0xac1e('0x4c')],_0x3cac69[_0xac1e('0x47')]));_0x48b787[_0xac1e('0x50')][_0xac1e('0x67')]=_0x3492e1['id'];if(_0x45dcf0['query'][_0xac1e('0x52')]){_0x48b787[_0xac1e('0x50')]=_[_0xac1e('0x53')](_0x48b787['where'],{'$or':_[_0xac1e('0x40')](_0x48b787[_0xac1e('0x4a')],function(_0x482643){var _0x336229={};_0x336229[_0x482643]={'$like':'%'+_0x45dcf0[_0xac1e('0x4c')]['filter']+'%'};return _0x336229;})});}_0x48b787=_[_0xac1e('0x53')]({},_0x48b787,_0x45dcf0[_0xac1e('0x55')]);return db[_0xac1e('0x6d')][_0xac1e('0x31')]({'where':_0x48b787['where']})[_0xac1e('0x21')](function(_0x1d689f){_0x4943e9['count']=_0x1d689f;if(_0x45dcf0[_0xac1e('0x4c')][_0xac1e('0x56')]){_0x48b787[_0xac1e('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xac1e('0x58')](_0x48b787);})['then'](function(_0x43165b){_0x4943e9[_0xac1e('0x59')]=_0x43165b;return _0x4943e9;});}})[_0xac1e('0x21')](respondWithFilteredResult(_0x52164d,_0x48b787))[_0xac1e('0x65')](handleError(_0x52164d,null));};exports['removeAnswers']=function(_0x31e82f,_0xecf46e,_0x12a656){return db['WhatsappAccount'][_0xac1e('0x5d')]({'where':{'id':_0x31e82f[_0xac1e('0x5a')]['id']}})[_0xac1e('0x21')](handleEntityNotFound(_0xecf46e,null))[_0xac1e('0x21')](function(_0x3a35d6){if(_0x3a35d6){return _0x3a35d6[_0xac1e('0x70')](_0x31e82f['query'][_0xac1e('0x6b')]);}})[_0xac1e('0x21')](respondWithStatusCode(_0xecf46e,null))['catch'](handleError(_0xecf46e,null));};exports[_0xac1e('0x71')]=function(_0x32f273,_0x5d1601,_0x1561a0){return db[_0xac1e('0x57')][_0xac1e('0x5d')]({'where':{'id':_0x32f273[_0xac1e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5d1601,null))[_0xac1e('0x21')](function(_0x113771){if(_0x113771){return _0x113771[_0xac1e('0x71')](_0x32f273['body'][_0xac1e('0x6b')],_[_0xac1e('0x72')](_0x32f273['body'],[_0xac1e('0x6b'),'id'])||{})[_0xac1e('0x73')](function(_0x5e647a){for(var _0x258f63=0x0;_0x258f63<_0x32f273[_0xac1e('0x5f')][_0xac1e('0x6b')][_0xac1e('0x4b')];_0x258f63+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x32f273[_0xac1e('0x5f')][_0xac1e('0x6b')][_0x258f63],'WhatsappAccountId':_0x32f273[_0xac1e('0x5a')]['id']});}return _0x5e647a;});}})[_0xac1e('0x21')](respondWithResult(_0x5d1601,null))[_0xac1e('0x65')](handleError(_0x5d1601,null));};exports[_0xac1e('0x74')]=function(_0x405a8,_0x3ea6ba,_0x252bbe){return db['WhatsappAccount'][_0xac1e('0x5d')]({'where':{'id':_0x405a8[_0xac1e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3ea6ba,null))[_0xac1e('0x21')](function(_0x561fb1){if(_0x561fb1){return _0x561fb1[_0xac1e('0x74')](_0x405a8[_0xac1e('0x4c')]['ids'])[_0xac1e('0x21')](function(){if(_[_0xac1e('0x75')](_0x405a8[_0xac1e('0x4c')][_0xac1e('0x6b')])){for(var _0x4f4a84=0x0;_0x4f4a84<_0x405a8['query']['ids'][_0xac1e('0x4b')];_0x4f4a84+=0x1){socket[_0xac1e('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x405a8[_0xac1e('0x4c')]['ids'][_0x4f4a84]),'WhatsappAccountId':Number(_0x405a8[_0xac1e('0x5a')]['id'])});}}else{socket[_0xac1e('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x405a8[_0xac1e('0x4c')][_0xac1e('0x6b')]),'WhatsappAccountId':Number(_0x405a8[_0xac1e('0x5a')]['id'])});}});}})[_0xac1e('0x21')](respondWithStatusCode(_0x3ea6ba,null))[_0xac1e('0x65')](handleError(_0x3ea6ba,null));};exports[_0xac1e('0x77')]=function(_0x2bdac3,_0x3715bc,_0x36912f){var _0x41a23b={};var _0x17697d={};var _0x3703d3;var _0x1c4def;return db[_0xac1e('0x57')][_0xac1e('0x69')]({'where':{'id':_0x2bdac3[_0xac1e('0x5a')]['id']}})[_0xac1e('0x21')](handleEntityNotFound(_0x3715bc,null))[_0xac1e('0x21')](function(_0x9369fb){if(_0x9369fb){_0x3703d3=_0x9369fb;_0x17697d[_0xac1e('0x45')]=_[_0xac1e('0x46')](db['User'][_0xac1e('0x41')]);_0x17697d[_0xac1e('0x4c')]=_['keys'](_0x2bdac3[_0xac1e('0x4c')]);_0x17697d['filters']=_[_0xac1e('0x48')](_0x17697d['model'],_0x17697d['query']);_0x41a23b[_0xac1e('0x4a')]=_[_0xac1e('0x48')](_0x17697d[_0xac1e('0x45')],qs[_0xac1e('0x49')](_0x2bdac3[_0xac1e('0x4c')][_0xac1e('0x49')]));_0x41a23b[_0xac1e('0x4a')]=_0x41a23b[_0xac1e('0x4a')][_0xac1e('0x4b')]?_0x41a23b[_0xac1e('0x4a')]:_0x17697d[_0xac1e('0x45')];_0x41a23b[_0xac1e('0x6f')]=qs['sort'](_0x2bdac3[_0xac1e('0x4c')][_0xac1e('0x4f')]);_0x41a23b[_0xac1e('0x50')]=qs[_0xac1e('0x47')](_[_0xac1e('0x51')](_0x2bdac3['query'],_0x17697d[_0xac1e('0x47')]));if(_0x2bdac3['query']['filter']){_0x41a23b[_0xac1e('0x50')]=_['merge'](_0x41a23b['where'],{'$or':_[_0xac1e('0x40')](_0x41a23b[_0xac1e('0x4a')],function(_0x12b52e){var _0x13e448={};_0x13e448[_0x12b52e]={'$like':'%'+_0x2bdac3['query']['filter']+'%'};return _0x13e448;})});}_0x41a23b=_[_0xac1e('0x53')]({},_0x41a23b,_0x2bdac3['options']);return _0x3703d3[_0xac1e('0x77')](_0x41a23b);}})[_0xac1e('0x21')](function(_0x10f7c7){if(_0x10f7c7){_0x1c4def=_0x10f7c7['length'];if(!_0x2bdac3[_0xac1e('0x4c')]['hasOwnProperty'](_0xac1e('0x4e'))){_0x41a23b[_0xac1e('0x30')]=qs[_0xac1e('0x30')](_0x2bdac3[_0xac1e('0x4c')][_0xac1e('0x30')]);_0x41a23b[_0xac1e('0x2e')]=qs[_0xac1e('0x2e')](_0x2bdac3[_0xac1e('0x4c')][_0xac1e('0x2e')]);}return _0x3703d3[_0xac1e('0x77')](_0x41a23b);}})[_0xac1e('0x21')](function(_0x45f696){if(_0x45f696){return _0x45f696?{'count':_0x1c4def,'rows':_0x45f696}:null;}})[_0xac1e('0x21')](respondWithResult(_0x3715bc,null))[_0xac1e('0x65')](handleError(_0x3715bc,null));};exports[_0xac1e('0x78')]=function(_0x139e3b,_0x3562af,_0x555b17){return db[_0xac1e('0x57')][_0xac1e('0x69')]({'where':{'id':_0x139e3b[_0xac1e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3562af,null))[_0xac1e('0x21')](function(_0x5736d8){if(_0x5736d8){return db[_0xac1e('0x79')][_0xac1e('0x7a')](function(_0x10cefa){return db[_0xac1e('0x7b')][_0xac1e('0x36')]({'where':{'WhatsappAccountId':_0x139e3b['params']['id']},'transaction':_0x10cefa})[_0xac1e('0x21')](function(_0x3ff6b1){var _0x2eb369=_['map'](_0x139e3b[_0xac1e('0x5f')],function(_0x14adde){_0x14adde['WhatsappAccountId']=_0x139e3b[_0xac1e('0x5a')]['id'];return _0x14adde;});return db[_0xac1e('0x7b')][_0xac1e('0x7c')](_0x2eb369,{'transaction':_0x10cefa});});})['then'](function(){return db['WhatsappApplication'][_0xac1e('0x7d')]({'where':{'WhatsappAccountId':_0x139e3b[_0xac1e('0x5a')]['id']},'order':_0xac1e('0x7e')});});}})[_0xac1e('0x21')](respondWithResult(_0x3562af,null))[_0xac1e('0x65')](handleError(_0x3562af,null));};exports['getApplications']=function(_0x258dd7,_0x1afef3,_0x300dd7){var _0x359f2b={};var _0x3fc511={};var _0x5d725b;var _0x5868cb;return db[_0xac1e('0x57')][_0xac1e('0x69')]({'where':{'id':_0x258dd7[_0xac1e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1afef3,null))['then'](function(_0x3d2b90){if(_0x3d2b90){_0x5d725b=_0x3d2b90;_0x3fc511[_0xac1e('0x45')]=_[_0xac1e('0x46')](db[_0xac1e('0x7b')][_0xac1e('0x41')]);_0x3fc511['query']=_[_0xac1e('0x46')](_0x258dd7[_0xac1e('0x4c')]);_0x3fc511['filters']=_['intersection'](_0x3fc511[_0xac1e('0x45')],_0x3fc511[_0xac1e('0x4c')]);_0x359f2b[_0xac1e('0x4a')]=_[_0xac1e('0x48')](_0x3fc511[_0xac1e('0x45')],qs[_0xac1e('0x49')](_0x258dd7[_0xac1e('0x4c')][_0xac1e('0x49')]));_0x359f2b['attributes']=_0x359f2b[_0xac1e('0x4a')][_0xac1e('0x4b')]?_0x359f2b[_0xac1e('0x4a')]:_0x3fc511[_0xac1e('0x45')];_0x359f2b[_0xac1e('0x6f')]=qs[_0xac1e('0x4f')](_0x258dd7[_0xac1e('0x4c')][_0xac1e('0x4f')]);_0x359f2b[_0xac1e('0x50')]=qs[_0xac1e('0x47')](_['pick'](_0x258dd7[_0xac1e('0x4c')],_0x3fc511['filters']));if(_0x258dd7['query'][_0xac1e('0x52')]){_0x359f2b[_0xac1e('0x50')]=_['merge'](_0x359f2b[_0xac1e('0x50')],{'$or':_[_0xac1e('0x40')](_0x359f2b['attributes'],function(_0x22b21c){var _0x2be3cf={};_0x2be3cf[_0x22b21c]={'$like':'%'+_0x258dd7[_0xac1e('0x4c')]['filter']+'%'};return _0x2be3cf;})});}_0x359f2b=_[_0xac1e('0x53')]({},_0x359f2b,_0x258dd7[_0xac1e('0x55')]);return _0x5d725b[_0xac1e('0x7f')](_0x359f2b);}})['then'](function(_0x1e5837){if(_0x1e5837){_0x5868cb=_0x1e5837[_0xac1e('0x4b')];if(!_0x258dd7[_0xac1e('0x4c')][_0xac1e('0x4d')](_0xac1e('0x4e'))){_0x359f2b[_0xac1e('0x30')]=qs[_0xac1e('0x30')](_0x258dd7[_0xac1e('0x4c')][_0xac1e('0x30')]);_0x359f2b[_0xac1e('0x2e')]=qs[_0xac1e('0x2e')](_0x258dd7[_0xac1e('0x4c')][_0xac1e('0x2e')]);}return _0x5d725b[_0xac1e('0x7f')](_0x359f2b);}})[_0xac1e('0x21')](function(_0x2a8978){if(_0x2a8978){return _0x2a8978?{'count':_0x5868cb,'rows':_0x2a8978}:null;}})['then'](respondWithResult(_0x1afef3,null))[_0xac1e('0x65')](handleError(_0x1afef3,null));};exports[_0xac1e('0x80')]=function(_0x33236d,_0x3a4198,_0x198c50){var _0x487cae={'channel':_0xac1e('0x81')};var _0x4a1204=[];var _0x4ce4e6=[];var _0x42acd5={};return db[_0xac1e('0x57')]['find']({'where':{'id':_0x33236d[_0xac1e('0x5a')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xac1e('0x82')}]})[_0xac1e('0x21')](handleEntityNotFound(_0x3a4198,null))[_0xac1e('0x21')](function(_0x28f3dc){_0x487cae[_0xac1e('0x83')]=_0x28f3dc;_0x487cae[_0xac1e('0x84')]=_[_0xac1e('0x85')](_0x28f3dc[_0xac1e('0x82')],[_0xac1e('0x7e')],[_0xac1e('0x86')]);if(_0x487cae[_0xac1e('0x83')]['Applications']){delete _0x487cae[_0xac1e('0x83')][_0xac1e('0x82')];}return db[_0xac1e('0x87')][_0xac1e('0x66')]();})[_0xac1e('0x21')](function(_0x101a08){if(!_0x101a08){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4a1204=_['difference'](_['keys'](_0x101a08),[_0xac1e('0x88'),_0xac1e('0x89')]);_0x4ce4e6=_[_0xac1e('0x8a')](_[_0xac1e('0x46')](_0x101a08),[_0xac1e('0x88'),_0xac1e('0x89'),'CompanyId',_0xac1e('0x8b')]);_0x487cae[_0xac1e('0x5f')]={'mapKey':_0xac1e('0x8c')};if(_0x487cae[_0xac1e('0x83')][_0xac1e('0x43')]&&_0x487cae['account'][_0xac1e('0x43')]===_0xac1e('0x8d')){_0x487cae[_0xac1e('0x5f')][_0xac1e('0x8e')]=_0x33236d['body'][_0xac1e('0x8f')][_0xac1e('0x90')](_0xac1e('0x91'),'');_0x487cae[_0xac1e('0x5f')][_0xac1e('0x5f')]=_0x33236d[_0xac1e('0x5f')][_0xac1e('0x92')];_0x487cae[_0xac1e('0x5f')][_0xac1e('0x93')]=_0x33236d[_0xac1e('0x5f')][_0xac1e('0x94')];}if(_0x487cae[_0xac1e('0x5f')]['id']){delete _0x487cae[_0xac1e('0x5f')]['id'];}if(_[_0xac1e('0x95')](_0x487cae[_0xac1e('0x5f')]['from'])){throw new db[(_0xac1e('0x96'))][(_0xac1e('0x97'))](_0xac1e('0x98'));}if(_[_0xac1e('0x95')](_0x487cae['body']['body'])||_0x487cae['body'][_0xac1e('0x5f')]===''){throw new db[(_0xac1e('0x96'))][(_0xac1e('0x97'))](_0xac1e('0x99'));}if(_['isNil'](_0x487cae[_0xac1e('0x5f')][_0xac1e('0x9a')])){throw new db[(_0xac1e('0x96'))][(_0xac1e('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ce4e6);}if(!_[_0xac1e('0x9b')](_0x4ce4e6,_0x487cae[_0xac1e('0x5f')][_0xac1e('0x9a')])){throw new db[(_0xac1e('0x96'))][(_0xac1e('0x97'))](_0xac1e('0x9c')+_0x4ce4e6);}_0x42acd5[_0x487cae[_0xac1e('0x5f')][_0xac1e('0x9a')]]=_0x487cae[_0xac1e('0x5f')][_0xac1e('0x8e')];return db[_0xac1e('0x9d')][_0xac1e('0x5d')]({'where':{'id':_0x487cae[_0xac1e('0x83')][_0xac1e('0x8b')]},'include':[{'model':db['CmContact'],'as':_0xac1e('0x9e'),'where':_0x42acd5,'limit':0x1,'order':[[_0xac1e('0x89'),_0xac1e('0x9f')]]}]});})[_0xac1e('0x21')](handleEntityNotFound(_0x3a4198,null))[_0xac1e('0x21')](function(_0x37e554){if(_0x37e554){_0x487cae[_0xac1e('0xa0')]=_[_0xac1e('0x72')](_0x37e554,['Contacts']);if(_0x37e554[_0xac1e('0x9e')][_0xac1e('0x4b')]){return _0x37e554[_0xac1e('0x9e')][0x0];}var _0x53a7f6=_[_0xac1e('0x1b')](_0x487cae[_0xac1e('0x5f')],{'firstName':_0x487cae[_0xac1e('0x5f')]['from'],'ListId':_0x37e554['id']});_0x53a7f6[_0x487cae[_0xac1e('0x5f')][_0xac1e('0x9a')]]=_0x487cae[_0xac1e('0x5f')][_0xac1e('0x8e')];return db[_0xac1e('0x87')][_0xac1e('0x5e')](_0x53a7f6,{'fields':_0x4a1204,'raw':!![]});}})[_0xac1e('0x21')](handleEntityNotFound(_0x3a4198,null))[_0xac1e('0x21')](function(_0x4fef14){if(_0x4fef14){_0x487cae[_0xac1e('0xa1')]=_0x4fef14;var _0x36ee6e={'ContactId':_0x4fef14['id'],'phone':_0x487cae[_0xac1e('0x5f')][_0xac1e('0x8e')],'WhatsappAccountId':_0x33236d['params']['id']};var _0x2e58ce={'ContactId':_0x4fef14['id'],'WhatsappAccountId':_0x33236d[_0xac1e('0x5a')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xac1e('0x5d')]({'where':_0x2e58ce})[_0xac1e('0x21')](function(_0x74e9fc){if(_0x74e9fc){return[_0x74e9fc,![]];}return db[_0xac1e('0xa2')]['create'](_0x36ee6e)[_0xac1e('0x21')](function(_0x40433b){return[_0x40433b,!![]];});});}})['spread'](function(_0x38a946,_0x313fdf){_0x487cae[_0xac1e('0xa3')]=_0x38a946[_0xac1e('0x37')]({'plain':!![]});_0x487cae[_0xac1e('0xa3')][_0xac1e('0xa4')]=![];if(_0x313fdf){if(_0x487cae[_0xac1e('0x83')]['autoclose']){_0x487cae[_0xac1e('0x84')][_0xac1e('0xa5')]({'id':0x0,'priority':_0x487cae[_0xac1e('0x84')][_0xac1e('0x4b')]+0x1,'app':'close','appdata':_0xac1e('0xa6'),'interval':_0xac1e('0xa7')});}_0x487cae[_0xac1e('0xa3')]['created']=!![];}return db[_0xac1e('0xa8')][_0xac1e('0x5e')]({'phone':_0x487cae[_0xac1e('0x5f')][_0xac1e('0x8e')],'messageId':_0x487cae[_0xac1e('0x5f')]['messageId'],'body':_0x487cae[_0xac1e('0x5f')][_0xac1e('0x5f')],'WhatsappAccountId':_0x33236d[_0xac1e('0x5a')]['id'],'WhatsappInteractionId':_0x38a946['id'],'direction':'in','ContactId':_0x38a946['ContactId'],'AttachmentId':_0x487cae[_0xac1e('0x5f')]['AttachmentId']});})[_0xac1e('0x21')](function(_0xdda483){_0x487cae[_0xac1e('0x29')]=_0xdda483;if(_0x487cae['interaction'][_0xac1e('0xa9')]){return db[_0xac1e('0xaa')][_0xac1e('0x5d')]({'attributes':['id',_0xac1e('0x3c')],'where':{'id':_0x487cae[_0xac1e('0xa3')][_0xac1e('0xa9')]}})[_0xac1e('0x21')](function(_0x4e2de2){if(_0x4e2de2){_0x487cae[_0xac1e('0x84')][_0xac1e('0xab')]({'id':0x0,'priority':0x0,'app':_0xac1e('0xac'),'appdata':_0x4e2de2['name']+','+(_0x487cae['account']['waitForTheAssignedAgent']||0xa),'interval':_0xac1e('0xa7')});}return respondWithRpcPromise(_0xac1e('0xad'),_0xac1e('0xae'),_0x487cae);});}return respondWithRpcPromise(_0xac1e('0xad'),'startRouting',_0x487cae);})[_0xac1e('0x21')](function(_0x349ec2){if(_0x349ec2){var _0x3da383=0xc8;var _0x5715f0=_0xac1e('0xaf');logger[_0xac1e('0x22')](_0xac1e('0xb0'),_0x5715f0,_0x3da383,_0xac1e('0xb1'));logger['debug'](_0xac1e('0xb2'),_0x5715f0,_0x3da383,_0xac1e('0xb1'),JSON[_0xac1e('0x26')](_0x349ec2));if(_0x487cae['account'][_0xac1e('0x43')]==='twilio'){return _0x3a4198[_0xac1e('0x2b')](_0x3da383)[_0xac1e('0x32')](_0xac1e('0xb3'),_0xac1e('0xb4'))['send']('\x0a');}else{return _0x3a4198[_0xac1e('0x2b')](_0x3da383)[_0xac1e('0x2d')](_0x349ec2);}}})['catch'](handleError(_0x3a4198,null));};exports[_0xac1e('0x3d')]=function(_0x179ba4,_0xa70886,_0x6eddb7){var _0x4073c2,_0x3f71c8,_0x156be4;if(_[_0xac1e('0x95')](_0x179ba4[_0xac1e('0x5f')][_0xac1e('0x5f')])||_0x179ba4[_0xac1e('0x5f')]['body']===''){throw new db['Sequelize']['ValidationError'](_0xac1e('0x99'));}if(_[_0xac1e('0x95')](_0x179ba4[_0xac1e('0x5f')]['to'])){throw new db[(_0xac1e('0x96'))]['ValidationError'](_0xac1e('0xb5'));}_0x4073c2=_0x179ba4[_0xac1e('0x5f')]['to'];return db[_0xac1e('0x57')][_0xac1e('0x5d')]({'where':{'id':_0x179ba4[_0xac1e('0x5a')]['id']},'include':[{'model':db[_0xac1e('0x9d')],'as':'List','include':[{'model':db[_0xac1e('0x87')],'as':'Contacts','where':{'mobile':_0x4073c2},'limit':0x1,'order':[['updatedAt',_0xac1e('0x9f')]]}]}]})[_0xac1e('0x21')](handleEntityNotFound(_0xa70886,null))[_0xac1e('0x21')](function(_0x5d7dc8){if(_0x5d7dc8&&_0x5d7dc8['List']){_0x3f71c8=_0x5d7dc8[_0xac1e('0x37')]({'plain':!![]});if(_0x3f71c8['List']&&_0x3f71c8[_0xac1e('0xb6')][_0xac1e('0x9e')]['length']){return _0x3f71c8['List'][_0xac1e('0x9e')][0x0];}return db[_0xac1e('0x87')]['create'](_['defaults'](_0x179ba4[_0xac1e('0x5f')],{'firstName':_0x4073c2,'mobile':_0x4073c2,'phone':_0x4073c2,'ListId':_0x3f71c8['ListId']}));}})[_0xac1e('0x21')](handleEntityNotFound(_0xa70886,null))['then'](function(_0x10e64f){if(_0x10e64f){_0x156be4=_0x10e64f;return db['WhatsappInteraction'][_0xac1e('0x5d')]({'where':{'ContactId':_0x156be4['id'],'closed':![],'WhatsappAccountId':_0x3f71c8['id']}})['then'](function(_0x57605c){if(_0x57605c){return[_0x57605c,![]];}return db[_0xac1e('0xa2')]['create']({'UserId':_0x179ba4[_0xac1e('0x60')]['id'],'ContactId':_0x156be4['id'],'WhatsappAccountId':_0x3f71c8['id'],'phone':_0x4073c2,'firstMsgDirection':'out','Messages':[_['merge'](_0x179ba4['body'],{'read':![],'body':_0x179ba4[_0xac1e('0x5f')][_0xac1e('0x5f')],'phone':_0x4073c2,'WhatsappAccountId':_0x3f71c8['id'],'UserId':_0x179ba4[_0xac1e('0x60')]['id'],'ContactId':_0x156be4['id']})]},{'include':[{'model':db[_0xac1e('0xa8')],'as':'Messages'}]})[_0xac1e('0x21')](function(_0x47208e){return[_0x47208e,!![]];});});}})[_0xac1e('0x73')](function(_0xc9817b,_0x1ad1ac){if(_0x1ad1ac){return _0xc9817b;}return db[_0xac1e('0xa8')][_0xac1e('0x5e')](_[_0xac1e('0x53')](_0x179ba4[_0xac1e('0x5f')],{'read':![],'body':_0x179ba4[_0xac1e('0x5f')]['body'],'phone':_0x4073c2,'WhatsappAccountId':_0x3f71c8['id'],'WhatsappInteractionId':_0xc9817b['id'],'UserId':_0x179ba4[_0xac1e('0x60')]['id'],'ContactId':_0x156be4['id']}))['then'](function(_0x30bc23){_0xc9817b[_0xac1e('0xb7')][_0xac1e('0xb8')]=[];_0xc9817b[_0xac1e('0xb7')]['Messages']['push'](_0x30bc23['dataValues']);return _0xc9817b;});})[_0xac1e('0x21')](respondWithResult(_0xa70886,null))['catch'](handleError(_0xa70886,null));}; \ No newline at end of file +var _0x967b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','pick','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','findOne','findAll','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','getApplications','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','WhatsappAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x967b,0x10b));var _0xb967=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x967b[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0xb967('0x0'));var rimraf=require(_0xb967('0x1'));var zipdir=require(_0xb967('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb967('0x3'));var moment=require(_0xb967('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb967('0x5'));var path=require(_0xb967('0x6'));var sox=require(_0xb967('0x7'));var csv=require(_0xb967('0x8'));var ejs=require(_0xb967('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb967('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb967('0x8'));var querystring=require(_0xb967('0xb'));var Papa=require(_0xb967('0xc'));var Redis=require(_0xb967('0xd'));var authService=require(_0xb967('0xe'));var qs=require(_0xb967('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb967('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xb967('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xb967('0x12'))['db'];config[_0xb967('0x13')]=_[_0xb967('0x14')](config[_0xb967('0x13')],{'host':_0xb967('0x15'),'port':0x18eb});var socket=require(_0xb967('0x16'))(new Redis(config[_0xb967('0x13')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xb967('0x17'));var client=jayson['client'][_0xb967('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x229af2,_0x2fb19e,_0x157e98,_0x44bf5b){return new BPromise(function(_0x255a43,_0x57d9fc){var _0x185f61=_0x44bf5b||client;return _0x185f61[_0xb967('0x19')](_0x229af2,_0x157e98)['then'](function(_0x53ee25){logger[_0xb967('0x1a')](_0xb967('0x1b'),_0x2fb19e,_0xb967('0x1c'));logger[_0xb967('0x1d')](_0xb967('0x1e'),_0x2fb19e,_0xb967('0x1c'),JSON[_0xb967('0x1f')](_0x53ee25));if(_0x53ee25[_0xb967('0x20')]){if(_0x53ee25[_0xb967('0x20')]['code']===0x1f4){logger[_0xb967('0x20')](_0xb967('0x1b'),_0x2fb19e,_0x53ee25['error'][_0xb967('0x21')]);return _0x57d9fc(_0x53ee25[_0xb967('0x20')][_0xb967('0x21')]);}logger[_0xb967('0x20')](_0xb967('0x1b'),_0x2fb19e,_0x53ee25[_0xb967('0x20')]['message']);return _0x255a43(_0x53ee25[_0xb967('0x20')][_0xb967('0x21')]);}else{logger[_0xb967('0x1a')](_0xb967('0x1b'),_0x2fb19e,_0xb967('0x1c'));_0x255a43(_0x53ee25[_0xb967('0x22')][_0xb967('0x21')]);}})[_0xb967('0x23')](function(_0x4b6520){logger[_0xb967('0x20')](_0xb967('0x1b'),_0x2fb19e,_0x4b6520);_0x57d9fc(_0x4b6520);});});}function respondWithStatusCode(_0x2e90c5,_0x218131){_0x218131=_0x218131||0xcc;return function(_0x297028){if(_0x297028){return _0x2e90c5['sendStatus'](_0x218131);}return _0x2e90c5[_0xb967('0x24')](_0x218131)[_0xb967('0x25')]();};}function respondWithResult(_0x124120,_0x17ee49){_0x17ee49=_0x17ee49||0xc8;return function(_0xfbd8fe){if(_0xfbd8fe){return _0x124120[_0xb967('0x24')](_0x17ee49)[_0xb967('0x26')](_0xfbd8fe);}};}function respondWithFilteredResult(_0x1654b3,_0x6de718){return function(_0x211c42){if(_0x211c42){var _0x42c26a=typeof _0x6de718[_0xb967('0x27')]===_0xb967('0x28')&&typeof _0x6de718[_0xb967('0x29')]===_0xb967('0x28');var _0x173518=_0x211c42[_0xb967('0x2a')];var _0x4c4f55=_0x42c26a?0x0:_0x6de718[_0xb967('0x27')];var _0x17e805=_0x42c26a?_0x211c42[_0xb967('0x2a')]:_0x6de718[_0xb967('0x27')]+_0x6de718['limit'];var _0x2a672c;if(_0x17e805>=_0x173518){_0x17e805=_0x173518;_0x2a672c=0xc8;}else{_0x2a672c=0xce;}_0x1654b3[_0xb967('0x24')](_0x2a672c);return _0x1654b3[_0xb967('0x2b')](_0xb967('0x2c'),_0x4c4f55+'-'+_0x17e805+'/'+_0x173518)[_0xb967('0x26')](_0x211c42);}return null;};}function patchUpdates(_0x2d5897){return function(_0x28c5ed){try{jsonpatch['apply'](_0x28c5ed,_0x2d5897,!![]);}catch(_0x5d0f4f){return BPromise[_0xb967('0x2d')](_0x5d0f4f);}return _0x28c5ed['save']();};}function saveUpdates(_0x3ae1fa,_0x4f3f7c){return function(_0x2a44e4){if(_0x2a44e4){return _0x2a44e4[_0xb967('0x2e')](_0x3ae1fa)[_0xb967('0x2f')](function(_0x3fe483){return _0x3fe483;});}return null;};}function removeEntity(_0x42c069,_0x23d83b){return function(_0xee97a8){if(_0xee97a8){return _0xee97a8[_0xb967('0x30')]()['then'](function(){var _0x5e0ad0=_0xee97a8[_0xb967('0x31')]({'plain':!![]});var _0xc94bcb=_0xb967('0x32');return db['UserProfileResource']['destroy']({'where':{'type':_0xc94bcb,'resourceId':_0x5e0ad0['id']}})[_0xb967('0x2f')](function(){return _0xee97a8;});})[_0xb967('0x2f')](function(){_0x42c069[_0xb967('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2769,_0x9e76c6){return function(_0x47b5ff){if(!_0x47b5ff){_0x5c2769[_0xb967('0x33')](0x194);}return _0x47b5ff;};}function handleError(_0x16db0b,_0x2b3317){_0x2b3317=_0x2b3317||0x1f4;return function(_0x30eaa9){logger[_0xb967('0x20')](_0x30eaa9[_0xb967('0x34')]);if(_0x30eaa9[_0xb967('0x35')]){delete _0x30eaa9[_0xb967('0x35')];}_0x16db0b[_0xb967('0x24')](_0x2b3317)[_0xb967('0x36')](_0x30eaa9);};}exports[_0xb967('0x37')]=function(_0x4ab4ee,_0x51c4c0){var _0x217f79={'include':[{'model':db[_0xb967('0x38')],'as':_0xb967('0x39')}]},_0x96493f={},_0x470cee={'count':0x0,'rows':[]};var _0x2c2647=_[_0xb967('0x3a')](db[_0xb967('0x3b')][_0xb967('0x3c')],function(_0x5724aa){return{'name':_0x5724aa[_0xb967('0x3d')],'type':_0x5724aa[_0xb967('0x3e')][_0xb967('0x3f')]};});_0x96493f[_0xb967('0x40')]=_['map'](_0x2c2647,_0xb967('0x35'));_0x96493f[_0xb967('0x41')]=_[_0xb967('0x42')](_0x4ab4ee[_0xb967('0x41')]);_0x96493f[_0xb967('0x43')]=_[_0xb967('0x44')](_0x96493f['model'],_0x96493f['query']);_0x217f79[_0xb967('0x45')]=_[_0xb967('0x44')](_0x96493f['model'],qs[_0xb967('0x46')](_0x4ab4ee[_0xb967('0x41')]['fields']));_0x217f79[_0xb967('0x45')]=_0x217f79[_0xb967('0x45')][_0xb967('0x47')]?_0x217f79[_0xb967('0x45')]:_0x96493f['model'];if(!_0x4ab4ee[_0xb967('0x41')][_0xb967('0x48')](_0xb967('0x49'))){_0x217f79['limit']=qs[_0xb967('0x29')](_0x4ab4ee[_0xb967('0x41')][_0xb967('0x29')]);_0x217f79['offset']=qs[_0xb967('0x27')](_0x4ab4ee[_0xb967('0x41')][_0xb967('0x27')]);}_0x217f79[_0xb967('0x4a')]=qs['sort'](_0x4ab4ee['query'][_0xb967('0x4b')]);_0x217f79[_0xb967('0x4c')]=qs[_0xb967('0x43')](_['pick'](_0x4ab4ee[_0xb967('0x41')],_0x96493f[_0xb967('0x43')]),_0x2c2647);if(_0x4ab4ee[_0xb967('0x41')][_0xb967('0x4d')]){_0x217f79[_0xb967('0x4c')]=_['merge'](_0x217f79[_0xb967('0x4c')],{'$or':_[_0xb967('0x3a')](_0x2c2647,function(_0x1f1efc){if(_0x1f1efc[_0xb967('0x3e')]!==_0xb967('0x4e')){var _0x13c992={};_0x13c992[_0x1f1efc['name']]={'$like':'%'+_0x4ab4ee['query'][_0xb967('0x4d')]+'%'};return _0x13c992;}})});}_0x217f79=_[_0xb967('0x4f')]({},_0x217f79,_0x4ab4ee[_0xb967('0x50')]);var _0x1a98f8={'where':_0x217f79['where']};return db[_0xb967('0x3b')][_0xb967('0x2a')](_0x1a98f8)[_0xb967('0x2f')](function(_0x59ded7){_0x470cee[_0xb967('0x2a')]=_0x59ded7;if(_0x4ab4ee['query'][_0xb967('0x51')]){_0x217f79[_0xb967('0x52')]=[{'all':!![]}];}return db[_0xb967('0x3b')]['findAll'](_0x217f79);})[_0xb967('0x2f')](function(_0x4f3af7){_0x470cee[_0xb967('0x53')]=_0x4f3af7;return _0x470cee;})[_0xb967('0x2f')](respondWithFilteredResult(_0x51c4c0,_0x217f79))[_0xb967('0x23')](handleError(_0x51c4c0,null));};exports[_0xb967('0x54')]=function(_0x13f807,_0x1cb059){var _0x3645cb={'raw':![],'where':{'id':_0x13f807[_0xb967('0x55')]['id']},'include':[{'model':db[_0xb967('0x38')],'as':_0xb967('0x39')}]},_0x548cfe={};_0x548cfe[_0xb967('0x40')]=_[_0xb967('0x42')](db[_0xb967('0x3b')][_0xb967('0x3c')]);_0x548cfe[_0xb967('0x41')]=_[_0xb967('0x42')](_0x13f807['query']);_0x548cfe[_0xb967('0x43')]=_[_0xb967('0x44')](_0x548cfe[_0xb967('0x40')],_0x548cfe[_0xb967('0x41')]);_0x3645cb['attributes']=_[_0xb967('0x44')](_0x548cfe[_0xb967('0x40')],qs[_0xb967('0x46')](_0x13f807[_0xb967('0x41')][_0xb967('0x46')]));_0x3645cb[_0xb967('0x45')]=_0x3645cb[_0xb967('0x45')][_0xb967('0x47')]?_0x3645cb[_0xb967('0x45')]:_0x548cfe['model'];if(_0x13f807[_0xb967('0x41')][_0xb967('0x51')]){_0x3645cb[_0xb967('0x52')]=[{'all':!![]}];}_0x3645cb=_[_0xb967('0x4f')]({},_0x3645cb,_0x13f807[_0xb967('0x50')]);return db['WhatsappAccount'][_0xb967('0x56')](_0x3645cb)[_0xb967('0x2f')](handleEntityNotFound(_0x1cb059,null))[_0xb967('0x2f')](respondWithResult(_0x1cb059,null))[_0xb967('0x23')](handleError(_0x1cb059,null));};exports['create']=function(_0x5c94fd,_0x24b1d0){return db[_0xb967('0x3b')][_0xb967('0x57')](_0x5c94fd[_0xb967('0x58')],{})[_0xb967('0x2f')](function(_0x56169f){var _0x1cc334=_0x5c94fd[_0xb967('0x59')][_0xb967('0x31')]({'plain':!![]});if(!_0x1cc334)throw new Error(_0xb967('0x5a'));if(_0x1cc334[_0xb967('0x5b')]===_0xb967('0x59')){var _0x54474d=_0x56169f[_0xb967('0x31')]({'plain':!![]});var _0x4d0117=_0xb967('0x32');return db['UserProfileSection']['find']({'where':{'name':_0x4d0117,'userProfileId':_0x1cc334[_0xb967('0x5c')]},'raw':!![]})[_0xb967('0x2f')](function(_0x55f39b){if(_0x55f39b&&_0x55f39b[_0xb967('0x5d')]===0x0){return db[_0xb967('0x5e')][_0xb967('0x57')]({'name':_0x54474d[_0xb967('0x35')],'resourceId':_0x54474d['id'],'type':_0x55f39b[_0xb967('0x35')],'sectionId':_0x55f39b['id']},{})[_0xb967('0x2f')](function(){return _0x56169f;});}else{return _0x56169f;}})[_0xb967('0x23')](function(_0x5d332b){logger[_0xb967('0x20')](_0xb967('0x5f'),_0x5d332b);throw _0x5d332b;});}return _0x56169f;})[_0xb967('0x2f')](respondWithResult(_0x24b1d0,0xc9))['catch'](handleError(_0x24b1d0,null));};exports[_0xb967('0x2e')]=function(_0x575219,_0x1b4dc6){if(_0x575219[_0xb967('0x58')]['id']){delete _0x575219[_0xb967('0x58')]['id'];}return db[_0xb967('0x3b')][_0xb967('0x56')]({'where':{'id':_0x575219[_0xb967('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xb967('0x39')}]})[_0xb967('0x2f')](handleEntityNotFound(_0x1b4dc6,null))[_0xb967('0x2f')](saveUpdates(_0x575219[_0xb967('0x58')],null))[_0xb967('0x2f')](respondWithResult(_0x1b4dc6,null))[_0xb967('0x23')](handleError(_0x1b4dc6,null));};exports[_0xb967('0x30')]=function(_0x454eb6,_0x2eea68){return db[_0xb967('0x3b')]['find']({'where':{'id':_0x454eb6['params']['id']}})['then'](handleEntityNotFound(_0x2eea68,null))[_0xb967('0x2f')](removeEntity(_0x2eea68,null))[_0xb967('0x23')](handleError(_0x2eea68,null));};exports['describe']=function(_0x58eb3b,_0x1a7035){return db[_0xb967('0x3b')][_0xb967('0x60')]()[_0xb967('0x2f')](respondWithResult(_0x1a7035,null))[_0xb967('0x23')](handleError(_0x1a7035,null));};exports[_0xb967('0x61')]=function(_0x3cb708,_0x12ec69,_0x262128){if(_0x3cb708[_0xb967('0x58')]['id']){delete _0x3cb708[_0xb967('0x58')]['id'];}return db[_0xb967('0x3b')]['find']({'where':{'id':_0x3cb708[_0xb967('0x55')]['id']}})['then'](handleEntityNotFound(_0x12ec69,null))['then'](function(_0x10fb8c){if(_0x10fb8c){_0x3cb708[_0xb967('0x58')]['WhatsappAccountId']=_0x10fb8c['id'];return db['Disposition'][_0xb967('0x57')](_0x3cb708[_0xb967('0x58')]);}})[_0xb967('0x2f')](respondWithResult(_0x12ec69,null))[_0xb967('0x23')](handleError(_0x12ec69,null));};exports[_0xb967('0x62')]=function(_0x37a3b4,_0x37dcc4,_0x1367be){var _0x2a4d1e={'raw':![],'where':{}};var _0x38c477={};var _0x47188f={'count':0x0,'rows':[]};return db[_0xb967('0x3b')]['findOne']({'where':{'id':_0x37a3b4[_0xb967('0x55')]['id']}})['then'](handleEntityNotFound(_0x37dcc4,null))[_0xb967('0x2f')](function(_0x49a058){if(_0x49a058){_0x38c477['model']=_[_0xb967('0x42')](db['Disposition'][_0xb967('0x3c')]);_0x38c477[_0xb967('0x41')]=_['keys'](_0x37a3b4[_0xb967('0x41')]);_0x38c477[_0xb967('0x43')]=_[_0xb967('0x44')](_0x38c477[_0xb967('0x40')],_0x38c477[_0xb967('0x41')]);_0x2a4d1e[_0xb967('0x45')]=_['intersection'](_0x38c477[_0xb967('0x40')],qs[_0xb967('0x46')](_0x37a3b4['query'][_0xb967('0x46')]));_0x2a4d1e[_0xb967('0x45')]=_0x2a4d1e[_0xb967('0x45')][_0xb967('0x47')]?_0x2a4d1e[_0xb967('0x45')]:_0x38c477[_0xb967('0x40')];if(!_0x37a3b4['query'][_0xb967('0x48')]('nolimit')){_0x2a4d1e[_0xb967('0x29')]=qs['limit'](_0x37a3b4['query'][_0xb967('0x29')]);_0x2a4d1e['offset']=qs[_0xb967('0x27')](_0x37a3b4[_0xb967('0x41')][_0xb967('0x27')]);}_0x2a4d1e[_0xb967('0x4a')]=qs['sort'](_0x37a3b4['query'][_0xb967('0x4b')]);_0x2a4d1e[_0xb967('0x4c')]=qs['filters'](_[_0xb967('0x63')](_0x37a3b4[_0xb967('0x41')],_0x38c477[_0xb967('0x43')]));_0x2a4d1e[_0xb967('0x4c')][_0xb967('0x64')]=_0x49a058['id'];if(_0x37a3b4['query']['filter']){_0x2a4d1e[_0xb967('0x4c')]=_[_0xb967('0x4f')](_0x2a4d1e[_0xb967('0x4c')],{'$or':_['map'](_0x2a4d1e[_0xb967('0x45')],function(_0x42d404){var _0x277358={};_0x277358[_0x42d404]={'$like':'%'+_0x37a3b4[_0xb967('0x41')][_0xb967('0x4d')]+'%'};return _0x277358;})});}_0x2a4d1e=_[_0xb967('0x4f')]({},_0x2a4d1e,_0x37a3b4[_0xb967('0x50')]);return db[_0xb967('0x65')][_0xb967('0x2a')]({'where':_0x2a4d1e[_0xb967('0x4c')]})[_0xb967('0x2f')](function(_0x36109e){_0x47188f['count']=_0x36109e;if(_0x37a3b4[_0xb967('0x41')]['includeAll']){_0x2a4d1e[_0xb967('0x52')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2a4d1e);})[_0xb967('0x2f')](function(_0x556f05){_0x47188f[_0xb967('0x53')]=_0x556f05;return _0x47188f;});}})[_0xb967('0x2f')](respondWithFilteredResult(_0x37dcc4,_0x2a4d1e))['catch'](handleError(_0x37dcc4,null));};exports['removeDispositions']=function(_0x384b14,_0x4e46ac,_0x44037b){return db['WhatsappAccount'][_0xb967('0x56')]({'where':{'id':_0x384b14[_0xb967('0x55')]['id']}})[_0xb967('0x2f')](handleEntityNotFound(_0x4e46ac,null))[_0xb967('0x2f')](function(_0xd065ae){if(_0xd065ae){return _0xd065ae[_0xb967('0x66')](_0x384b14[_0xb967('0x41')][_0xb967('0x67')]);}})['then'](respondWithStatusCode(_0x4e46ac,null))[_0xb967('0x23')](handleError(_0x4e46ac,null));};exports[_0xb967('0x68')]=function(_0x310319,_0x378245,_0x2ba38f){if(_0x310319[_0xb967('0x58')]['id']){delete _0x310319[_0xb967('0x58')]['id'];}return db['WhatsappAccount'][_0xb967('0x56')]({'where':{'id':_0x310319[_0xb967('0x55')]['id']}})['then'](handleEntityNotFound(_0x378245,null))[_0xb967('0x2f')](function(_0x399bcb){if(_0x399bcb){_0x310319[_0xb967('0x58')][_0xb967('0x64')]=_0x399bcb['id'];return db[_0xb967('0x69')][_0xb967('0x57')](_0x310319[_0xb967('0x58')]);}})[_0xb967('0x2f')](respondWithResult(_0x378245,null))[_0xb967('0x23')](handleError(_0x378245,null));};exports['getAnswers']=function(_0x316dfc,_0x3e1bb1,_0x149167){var _0x1f497b={'raw':![],'where':{}};var _0x3f3282={};var _0x294c90={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xb967('0x6a')]({'where':{'id':_0x316dfc['params']['id']}})[_0xb967('0x2f')](handleEntityNotFound(_0x3e1bb1,null))[_0xb967('0x2f')](function(_0x29d634){if(_0x29d634){_0x3f3282[_0xb967('0x40')]=_[_0xb967('0x42')](db['CannedAnswer'][_0xb967('0x3c')]);_0x3f3282['query']=_[_0xb967('0x42')](_0x316dfc[_0xb967('0x41')]);_0x3f3282[_0xb967('0x43')]=_[_0xb967('0x44')](_0x3f3282[_0xb967('0x40')],_0x3f3282[_0xb967('0x41')]);_0x1f497b[_0xb967('0x45')]=_['intersection'](_0x3f3282[_0xb967('0x40')],qs['fields'](_0x316dfc[_0xb967('0x41')][_0xb967('0x46')]));_0x1f497b[_0xb967('0x45')]=_0x1f497b[_0xb967('0x45')][_0xb967('0x47')]?_0x1f497b[_0xb967('0x45')]:_0x3f3282[_0xb967('0x40')];if(!_0x316dfc[_0xb967('0x41')]['hasOwnProperty'](_0xb967('0x49'))){_0x1f497b[_0xb967('0x29')]=qs['limit'](_0x316dfc['query'][_0xb967('0x29')]);_0x1f497b[_0xb967('0x27')]=qs[_0xb967('0x27')](_0x316dfc['query'][_0xb967('0x27')]);}_0x1f497b[_0xb967('0x4a')]=qs[_0xb967('0x4b')](_0x316dfc[_0xb967('0x41')][_0xb967('0x4b')]);_0x1f497b[_0xb967('0x4c')]=qs[_0xb967('0x43')](_[_0xb967('0x63')](_0x316dfc[_0xb967('0x41')],_0x3f3282[_0xb967('0x43')]));_0x1f497b[_0xb967('0x4c')]['WhatsappAccountId']=_0x29d634['id'];if(_0x316dfc[_0xb967('0x41')]['filter']){_0x1f497b['where']=_[_0xb967('0x4f')](_0x1f497b[_0xb967('0x4c')],{'$or':_[_0xb967('0x3a')](_0x1f497b[_0xb967('0x45')],function(_0x4b136f){var _0x76815f={};_0x76815f[_0x4b136f]={'$like':'%'+_0x316dfc[_0xb967('0x41')]['filter']+'%'};return _0x76815f;})});}_0x1f497b=_[_0xb967('0x4f')]({},_0x1f497b,_0x316dfc[_0xb967('0x50')]);return db[_0xb967('0x69')]['count']({'where':_0x1f497b[_0xb967('0x4c')]})[_0xb967('0x2f')](function(_0x29301a){_0x294c90['count']=_0x29301a;if(_0x316dfc[_0xb967('0x41')][_0xb967('0x51')]){_0x1f497b[_0xb967('0x52')]=[{'all':!![]}];}return db[_0xb967('0x69')][_0xb967('0x6b')](_0x1f497b);})[_0xb967('0x2f')](function(_0x33d6fe){_0x294c90['rows']=_0x33d6fe;return _0x294c90;});}})[_0xb967('0x2f')](respondWithFilteredResult(_0x3e1bb1,_0x1f497b))[_0xb967('0x23')](handleError(_0x3e1bb1,null));};exports[_0xb967('0x6c')]=function(_0x2a2adf,_0x4a5813,_0x3181b2){return db['WhatsappAccount'][_0xb967('0x56')]({'where':{'id':_0x2a2adf[_0xb967('0x55')]['id']}})[_0xb967('0x2f')](handleEntityNotFound(_0x4a5813,null))['then'](function(_0xc84cb4){if(_0xc84cb4){return _0xc84cb4['removeAnswers'](_0x2a2adf[_0xb967('0x41')][_0xb967('0x67')]);}})['then'](respondWithStatusCode(_0x4a5813,null))['catch'](handleError(_0x4a5813,null));};exports['addAgents']=function(_0x5e3ad9,_0x84d9a6,_0x17eb41){return db['WhatsappAccount']['find']({'where':{'id':_0x5e3ad9[_0xb967('0x55')]['id']}})['then'](handleEntityNotFound(_0x84d9a6,null))[_0xb967('0x2f')](function(_0x1524e1){if(_0x1524e1){return _0x1524e1[_0xb967('0x6d')](_0x5e3ad9['body'][_0xb967('0x67')],_[_0xb967('0x6e')](_0x5e3ad9[_0xb967('0x58')],['ids','id'])||{})[_0xb967('0x6f')](function(_0x423a9b){for(var _0x426302=0x0;_0x426302<_0x5e3ad9[_0xb967('0x58')][_0xb967('0x67')][_0xb967('0x47')];_0x426302+=0x1){socket[_0xb967('0x70')]('userWhatsappAccount:save',{'UserId':_0x5e3ad9[_0xb967('0x58')][_0xb967('0x67')][_0x426302],'WhatsappAccountId':_0x5e3ad9[_0xb967('0x55')]['id']});}return _0x423a9b;});}})[_0xb967('0x2f')](respondWithResult(_0x84d9a6,null))[_0xb967('0x23')](handleError(_0x84d9a6,null));};exports[_0xb967('0x71')]=function(_0x29ea63,_0x7654a5,_0x4d84d8){return db[_0xb967('0x3b')][_0xb967('0x56')]({'where':{'id':_0x29ea63['params']['id']}})[_0xb967('0x2f')](handleEntityNotFound(_0x7654a5,null))[_0xb967('0x2f')](function(_0x2e8077){if(_0x2e8077){return _0x2e8077['removeAgents'](_0x29ea63['query'][_0xb967('0x67')])[_0xb967('0x2f')](function(){if(_[_0xb967('0x72')](_0x29ea63['query']['ids'])){for(var _0x2e5b0c=0x0;_0x2e5b0c<_0x29ea63[_0xb967('0x41')][_0xb967('0x67')][_0xb967('0x47')];_0x2e5b0c+=0x1){socket['emit'](_0xb967('0x73'),{'UserId':Number(_0x29ea63['query'][_0xb967('0x67')][_0x2e5b0c]),'WhatsappAccountId':Number(_0x29ea63[_0xb967('0x55')]['id'])});}}else{socket[_0xb967('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x29ea63['query'][_0xb967('0x67')]),'WhatsappAccountId':Number(_0x29ea63['params']['id'])});}});}})[_0xb967('0x2f')](respondWithStatusCode(_0x7654a5,null))[_0xb967('0x23')](handleError(_0x7654a5,null));};exports['getAgents']=function(_0x1a85ad,_0x2e352,_0x2a0f5d){var _0x44f945={};var _0x1e56f9={};var _0x46ac51;var _0x5cd22e;return db[_0xb967('0x3b')][_0xb967('0x6a')]({'where':{'id':_0x1a85ad[_0xb967('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e352,null))[_0xb967('0x2f')](function(_0x2956f0){if(_0x2956f0){_0x46ac51=_0x2956f0;_0x1e56f9[_0xb967('0x40')]=_[_0xb967('0x42')](db['User']['rawAttributes']);_0x1e56f9[_0xb967('0x41')]=_[_0xb967('0x42')](_0x1a85ad['query']);_0x1e56f9[_0xb967('0x43')]=_['intersection'](_0x1e56f9['model'],_0x1e56f9['query']);_0x44f945[_0xb967('0x45')]=_['intersection'](_0x1e56f9[_0xb967('0x40')],qs[_0xb967('0x46')](_0x1a85ad['query'][_0xb967('0x46')]));_0x44f945[_0xb967('0x45')]=_0x44f945[_0xb967('0x45')][_0xb967('0x47')]?_0x44f945['attributes']:_0x1e56f9[_0xb967('0x40')];_0x44f945['order']=qs[_0xb967('0x4b')](_0x1a85ad[_0xb967('0x41')][_0xb967('0x4b')]);_0x44f945[_0xb967('0x4c')]=qs[_0xb967('0x43')](_[_0xb967('0x63')](_0x1a85ad[_0xb967('0x41')],_0x1e56f9['filters']));if(_0x1a85ad['query'][_0xb967('0x4d')]){_0x44f945[_0xb967('0x4c')]=_[_0xb967('0x4f')](_0x44f945['where'],{'$or':_[_0xb967('0x3a')](_0x44f945[_0xb967('0x45')],function(_0x2f4290){var _0xb668b9={};_0xb668b9[_0x2f4290]={'$like':'%'+_0x1a85ad[_0xb967('0x41')][_0xb967('0x4d')]+'%'};return _0xb668b9;})});}_0x44f945=_['merge']({},_0x44f945,_0x1a85ad[_0xb967('0x50')]);return _0x46ac51[_0xb967('0x74')](_0x44f945);}})[_0xb967('0x2f')](function(_0x5f08ce){if(_0x5f08ce){_0x5cd22e=_0x5f08ce[_0xb967('0x47')];if(!_0x1a85ad[_0xb967('0x41')]['hasOwnProperty'](_0xb967('0x49'))){_0x44f945[_0xb967('0x29')]=qs[_0xb967('0x29')](_0x1a85ad[_0xb967('0x41')][_0xb967('0x29')]);_0x44f945['offset']=qs[_0xb967('0x27')](_0x1a85ad[_0xb967('0x41')][_0xb967('0x27')]);}return _0x46ac51[_0xb967('0x74')](_0x44f945);}})['then'](function(_0x48bc4a){if(_0x48bc4a){return _0x48bc4a?{'count':_0x5cd22e,'rows':_0x48bc4a}:null;}})[_0xb967('0x2f')](respondWithResult(_0x2e352,null))['catch'](handleError(_0x2e352,null));};exports[_0xb967('0x75')]=function(_0x252cce,_0x2a3da0,_0x1769cd){return db[_0xb967('0x3b')][_0xb967('0x6a')]({'where':{'id':_0x252cce[_0xb967('0x55')]['id']}})[_0xb967('0x2f')](handleEntityNotFound(_0x2a3da0,null))[_0xb967('0x2f')](function(_0x170cd8){if(_0x170cd8){return db[_0xb967('0x76')][_0xb967('0x77')](function(_0x3cd094){return db[_0xb967('0x78')][_0xb967('0x30')]({'where':{'WhatsappAccountId':_0x252cce[_0xb967('0x55')]['id']},'transaction':_0x3cd094})[_0xb967('0x2f')](function(_0x2fd7b4){var _0x4cea5e=_[_0xb967('0x3a')](_0x252cce['body'],function(_0x483a7a){_0x483a7a['WhatsappAccountId']=_0x252cce[_0xb967('0x55')]['id'];return _0x483a7a;});return db[_0xb967('0x78')]['bulkCreate'](_0x4cea5e,{'transaction':_0x3cd094});});})[_0xb967('0x2f')](function(){return db[_0xb967('0x78')][_0xb967('0x79')]({'where':{'WhatsappAccountId':_0x252cce['params']['id']},'order':'priority'});});}})[_0xb967('0x2f')](respondWithResult(_0x2a3da0,null))[_0xb967('0x23')](handleError(_0x2a3da0,null));};exports['getApplications']=function(_0x4b5933,_0x5a91d5,_0x4a18d7){var _0x5bd215={};var _0xf2213={};var _0xffe9df;var _0x1906ce;return db[_0xb967('0x3b')]['findOne']({'where':{'id':_0x4b5933['params']['id']}})['then'](handleEntityNotFound(_0x5a91d5,null))['then'](function(_0x274c4d){if(_0x274c4d){_0xffe9df=_0x274c4d;_0xf2213[_0xb967('0x40')]=_['keys'](db[_0xb967('0x78')][_0xb967('0x3c')]);_0xf2213[_0xb967('0x41')]=_[_0xb967('0x42')](_0x4b5933[_0xb967('0x41')]);_0xf2213[_0xb967('0x43')]=_[_0xb967('0x44')](_0xf2213[_0xb967('0x40')],_0xf2213[_0xb967('0x41')]);_0x5bd215[_0xb967('0x45')]=_[_0xb967('0x44')](_0xf2213[_0xb967('0x40')],qs[_0xb967('0x46')](_0x4b5933[_0xb967('0x41')][_0xb967('0x46')]));_0x5bd215['attributes']=_0x5bd215['attributes'][_0xb967('0x47')]?_0x5bd215[_0xb967('0x45')]:_0xf2213['model'];_0x5bd215[_0xb967('0x4a')]=qs['sort'](_0x4b5933[_0xb967('0x41')][_0xb967('0x4b')]);_0x5bd215[_0xb967('0x4c')]=qs[_0xb967('0x43')](_[_0xb967('0x63')](_0x4b5933[_0xb967('0x41')],_0xf2213['filters']));if(_0x4b5933[_0xb967('0x41')][_0xb967('0x4d')]){_0x5bd215[_0xb967('0x4c')]=_[_0xb967('0x4f')](_0x5bd215[_0xb967('0x4c')],{'$or':_[_0xb967('0x3a')](_0x5bd215['attributes'],function(_0x5828cb){var _0x587064={};_0x587064[_0x5828cb]={'$like':'%'+_0x4b5933[_0xb967('0x41')]['filter']+'%'};return _0x587064;})});}_0x5bd215=_[_0xb967('0x4f')]({},_0x5bd215,_0x4b5933[_0xb967('0x50')]);return _0xffe9df[_0xb967('0x7a')](_0x5bd215);}})['then'](function(_0x11f2f){if(_0x11f2f){_0x1906ce=_0x11f2f[_0xb967('0x47')];if(!_0x4b5933[_0xb967('0x41')][_0xb967('0x48')](_0xb967('0x49'))){_0x5bd215[_0xb967('0x29')]=qs[_0xb967('0x29')](_0x4b5933[_0xb967('0x41')][_0xb967('0x29')]);_0x5bd215[_0xb967('0x27')]=qs[_0xb967('0x27')](_0x4b5933[_0xb967('0x41')][_0xb967('0x27')]);}return _0xffe9df[_0xb967('0x7a')](_0x5bd215);}})[_0xb967('0x2f')](function(_0x277d2d){if(_0x277d2d){return _0x277d2d?{'count':_0x1906ce,'rows':_0x277d2d}:null;}})[_0xb967('0x2f')](respondWithResult(_0x5a91d5,null))[_0xb967('0x23')](handleError(_0x5a91d5,null));};exports['notify']=function(_0x1fdb4e,_0x25179b,_0x20056c){var _0x3d550a={'channel':'whatsapp'};var _0x1c9bdc=[];var _0x37ce42=[];var _0x3a8f36={};return db[_0xb967('0x3b')][_0xb967('0x56')]({'where':{'id':_0x1fdb4e['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xb967('0x7b')}]})[_0xb967('0x2f')](handleEntityNotFound(_0x25179b,null))['then'](function(_0x1ed0ae){_0x3d550a[_0xb967('0x7c')]=_0x1ed0ae;_0x3d550a[_0xb967('0x7d')]=_[_0xb967('0x7e')](_0x1ed0ae[_0xb967('0x7b')],[_0xb967('0x7f')],['asc']);if(_0x3d550a['account'][_0xb967('0x7b')]){delete _0x3d550a[_0xb967('0x7c')][_0xb967('0x7b')];}return db[_0xb967('0x80')][_0xb967('0x60')]();})['then'](function(_0xccac95){if(!_0xccac95){throw new db[(_0xb967('0x81'))][(_0xb967('0x82'))](_0xb967('0x83'));}_0x1c9bdc=_['difference'](_[_0xb967('0x42')](_0xccac95),['createdAt',_0xb967('0x84')]);_0x37ce42=_['difference'](_[_0xb967('0x42')](_0xccac95),[_0xb967('0x85'),'updatedAt',_0xb967('0x86'),_0xb967('0x87')]);_0x3d550a[_0xb967('0x58')]={'mapKey':_0xb967('0x88')};if(_0x3d550a[_0xb967('0x7c')]['type']&&_0x3d550a[_0xb967('0x7c')]['type']===_0xb967('0x89')){_0x3d550a[_0xb967('0x58')]['from']=_0x1fdb4e[_0xb967('0x58')][_0xb967('0x8a')][_0xb967('0x8b')](_0xb967('0x8c'),'');_0x3d550a[_0xb967('0x58')][_0xb967('0x58')]=_0x1fdb4e[_0xb967('0x58')][_0xb967('0x8d')];_0x3d550a['body']['messageId']=_0x1fdb4e['body']['MessageSid'];}if(_0x3d550a[_0xb967('0x58')]['id']){delete _0x3d550a[_0xb967('0x58')]['id'];}if(_[_0xb967('0x8e')](_0x3d550a[_0xb967('0x58')][_0xb967('0x8f')])){throw new db['Sequelize'][(_0xb967('0x82'))]('from\x20is\x20mandatory');}if(_[_0xb967('0x8e')](_0x3d550a[_0xb967('0x58')]['body'])||_0x3d550a[_0xb967('0x58')][_0xb967('0x58')]===''){throw new db[(_0xb967('0x81'))]['ValidationError'](_0xb967('0x90'));}if(_['isNil'](_0x3d550a['body'][_0xb967('0x91')])){throw new db[(_0xb967('0x81'))][(_0xb967('0x82'))](_0xb967('0x92')+_0x37ce42);}if(!_[_0xb967('0x93')](_0x37ce42,_0x3d550a[_0xb967('0x58')][_0xb967('0x91')])){throw new db[(_0xb967('0x81'))][(_0xb967('0x82'))](_0xb967('0x94')+_0x37ce42);}_0x3a8f36[_0x3d550a[_0xb967('0x58')]['mapKey']]=_0x3d550a[_0xb967('0x58')][_0xb967('0x8f')];return db['CmList'][_0xb967('0x56')]({'where':{'id':_0x3d550a[_0xb967('0x7c')]['ListId']},'include':[{'model':db[_0xb967('0x80')],'as':'Contacts','where':_0x3a8f36,'limit':0x1,'order':[[_0xb967('0x84'),_0xb967('0x95')]]}]});})[_0xb967('0x2f')](handleEntityNotFound(_0x25179b,null))['then'](function(_0x10c17c){if(_0x10c17c){_0x3d550a[_0xb967('0x96')]=_[_0xb967('0x6e')](_0x10c17c,[_0xb967('0x97')]);if(_0x10c17c[_0xb967('0x97')][_0xb967('0x47')]){return _0x10c17c[_0xb967('0x97')][0x0];}var _0x204b60=_[_0xb967('0x14')](_0x3d550a[_0xb967('0x58')],{'firstName':_0x3d550a['body'][_0xb967('0x8f')],'ListId':_0x10c17c['id']});_0x204b60[_0x3d550a[_0xb967('0x58')]['mapKey']]=_0x3d550a['body'][_0xb967('0x8f')];return db['CmContact'][_0xb967('0x57')](_0x204b60,{'fields':_0x1c9bdc,'raw':!![]});}})[_0xb967('0x2f')](handleEntityNotFound(_0x25179b,null))['then'](function(_0x39f745){if(_0x39f745){_0x3d550a[_0xb967('0x98')]=_0x39f745;var _0x2842c3={'ContactId':_0x39f745['id'],'phone':_0x3d550a[_0xb967('0x58')][_0xb967('0x8f')],'WhatsappAccountId':_0x1fdb4e[_0xb967('0x55')]['id']};var _0x3764fd={'ContactId':_0x39f745['id'],'WhatsappAccountId':_0x1fdb4e[_0xb967('0x55')]['id'],'closed':![]};return db[_0xb967('0x99')][_0xb967('0x56')]({'where':_0x3764fd})[_0xb967('0x2f')](function(_0x2956af){if(_0x2956af){return[_0x2956af,![]];}return db[_0xb967('0x99')][_0xb967('0x57')](_0x2842c3)[_0xb967('0x2f')](function(_0x38e79b){return[_0x38e79b,!![]];});});}})[_0xb967('0x6f')](function(_0xd5661c,_0x506f9f){_0x3d550a['interaction']=_0xd5661c[_0xb967('0x31')]({'plain':!![]});_0x3d550a[_0xb967('0x9a')][_0xb967('0x9b')]=![];if(_0x506f9f){if(_0x3d550a[_0xb967('0x7c')]['autoclose']){_0x3d550a[_0xb967('0x7d')][_0xb967('0x9c')]({'id':0x0,'priority':_0x3d550a[_0xb967('0x7d')][_0xb967('0x47')]+0x1,'app':_0xb967('0x9d'),'appdata':_0xb967('0x9e'),'interval':_0xb967('0x9f')});}_0x3d550a['interaction'][_0xb967('0x9b')]=!![];}return db[_0xb967('0xa0')][_0xb967('0x57')]({'phone':_0x3d550a[_0xb967('0x58')]['from'],'messageId':_0x3d550a[_0xb967('0x58')][_0xb967('0xa1')],'body':_0x3d550a[_0xb967('0x58')][_0xb967('0x58')],'WhatsappAccountId':_0x1fdb4e['params']['id'],'WhatsappInteractionId':_0xd5661c['id'],'direction':'in','ContactId':_0xd5661c[_0xb967('0xa2')],'AttachmentId':_0x3d550a[_0xb967('0x58')][_0xb967('0xa3')]});})['then'](function(_0x38da4e){_0x3d550a[_0xb967('0x21')]=_0x38da4e;if(_0x3d550a['interaction'][_0xb967('0xa4')]){return db[_0xb967('0xa5')][_0xb967('0x56')]({'attributes':['id',_0xb967('0x35')],'where':{'id':_0x3d550a['interaction'][_0xb967('0xa4')]}})['then'](function(_0x348e38){if(_0x348e38){_0x3d550a['applications'][_0xb967('0xa6')]({'id':0x0,'priority':0x0,'app':_0xb967('0xa7'),'appdata':_0x348e38[_0xb967('0x35')]+','+(_0x3d550a[_0xb967('0x7c')][_0xb967('0xa8')]||0xa),'interval':_0xb967('0x9f')});}return respondWithRpcPromise(_0xb967('0xa9'),_0xb967('0xaa'),_0x3d550a);});}return respondWithRpcPromise('Start',_0xb967('0xaa'),_0x3d550a);})[_0xb967('0x2f')](function(_0x5c0e62){if(_0x5c0e62){var _0xf3dc01=0xc8;var _0xb8e587='receiveMessage';logger[_0xb967('0x1a')](_0xb967('0x1e'),_0xb8e587,_0xf3dc01,_0xb967('0xab'));logger[_0xb967('0x1d')](_0xb967('0xac'),_0xb8e587,_0xf3dc01,_0xb967('0xab'),JSON[_0xb967('0x1f')](_0x5c0e62));if(_0x3d550a[_0xb967('0x7c')]['type']==='twilio'){return _0x25179b[_0xb967('0x24')](_0xf3dc01)[_0xb967('0x2b')]('Content-Type',_0xb967('0xad'))[_0xb967('0x36')](_0xb967('0xae'));}else{return _0x25179b['status'](_0xf3dc01)['json'](_0x5c0e62);}}})[_0xb967('0x23')](handleError(_0x25179b,null));};exports[_0xb967('0x36')]=function(_0x3d3f36,_0x285540,_0x3b3668){var _0x102c4e,_0x372ef6,_0x3e73da;if(_['isNil'](_0x3d3f36[_0xb967('0x58')][_0xb967('0x58')])||_0x3d3f36[_0xb967('0x58')][_0xb967('0x58')]===''){throw new db[(_0xb967('0x81'))][(_0xb967('0x82'))](_0xb967('0x90'));}if(_[_0xb967('0x8e')](_0x3d3f36[_0xb967('0x58')]['to'])){throw new db['Sequelize']['ValidationError'](_0xb967('0xaf'));}_0x102c4e=_0x3d3f36[_0xb967('0x58')]['to'];return db[_0xb967('0x3b')][_0xb967('0x56')]({'where':{'id':_0x3d3f36[_0xb967('0x55')]['id']},'include':[{'model':db[_0xb967('0xb0')],'as':'List','include':[{'model':db[_0xb967('0x80')],'as':_0xb967('0x97'),'where':{'mobile':_0x102c4e},'limit':0x1,'order':[['updatedAt',_0xb967('0x95')]]}]}]})[_0xb967('0x2f')](handleEntityNotFound(_0x285540,null))[_0xb967('0x2f')](function(_0xe0e2da){if(_0xe0e2da&&_0xe0e2da[_0xb967('0xb1')]){_0x372ef6=_0xe0e2da[_0xb967('0x31')]({'plain':!![]});if(_0x372ef6[_0xb967('0xb1')]&&_0x372ef6[_0xb967('0xb1')][_0xb967('0x97')][_0xb967('0x47')]){return _0x372ef6[_0xb967('0xb1')]['Contacts'][0x0];}return db['CmContact'][_0xb967('0x57')](_['defaults'](_0x3d3f36[_0xb967('0x58')],{'firstName':_0x102c4e,'mobile':_0x102c4e,'phone':_0x102c4e,'ListId':_0x372ef6[_0xb967('0x87')]}));}})['then'](handleEntityNotFound(_0x285540,null))[_0xb967('0x2f')](function(_0x57791a){if(_0x57791a){_0x3e73da=_0x57791a;return db[_0xb967('0x99')][_0xb967('0x56')]({'where':{'ContactId':_0x3e73da['id'],'closed':![],'WhatsappAccountId':_0x372ef6['id']}})[_0xb967('0x2f')](function(_0x544084){if(_0x544084){return[_0x544084,![]];}return db[_0xb967('0x99')][_0xb967('0x57')]({'UserId':_0x3d3f36[_0xb967('0x59')]['id'],'ContactId':_0x3e73da['id'],'WhatsappAccountId':_0x372ef6['id'],'phone':_0x102c4e,'firstMsgDirection':_0xb967('0xb2'),'Messages':[_[_0xb967('0x4f')](_0x3d3f36[_0xb967('0x58')],{'read':![],'body':_0x3d3f36[_0xb967('0x58')][_0xb967('0x58')],'phone':_0x102c4e,'WhatsappAccountId':_0x372ef6['id'],'UserId':_0x3d3f36['user']['id'],'ContactId':_0x3e73da['id']})]},{'include':[{'model':db[_0xb967('0xa0')],'as':_0xb967('0xb3')}]})['then'](function(_0xe6ce5){return[_0xe6ce5,!![]];});});}})[_0xb967('0x6f')](function(_0x2cc28e,_0x502b32){if(_0x502b32){return _0x2cc28e;}return db[_0xb967('0xa0')]['create'](_[_0xb967('0x4f')](_0x3d3f36[_0xb967('0x58')],{'read':![],'body':_0x3d3f36[_0xb967('0x58')][_0xb967('0x58')],'phone':_0x102c4e,'WhatsappAccountId':_0x372ef6['id'],'WhatsappInteractionId':_0x2cc28e['id'],'UserId':_0x3d3f36[_0xb967('0x59')]['id'],'ContactId':_0x3e73da['id']}))['then'](function(_0x4378a4){_0x2cc28e[_0xb967('0xb4')]['Messages']=[];_0x2cc28e[_0xb967('0xb4')]['Messages'][_0xb967('0x9c')](_0x4378a4[_0xb967('0xb4')]);return _0x2cc28e;});})['then'](respondWithResult(_0x285540,null))[_0xb967('0x23')](handleError(_0x285540,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5dde0bd..8d7a71f 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 _0x01d9=['WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x901d('0x0'));var WhatsappAccount=require(_0x901d('0x1'))['db'][_0x901d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x901d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x901d('0x4'),'afterDestroy':_0x901d('0x5')};function emitEvent(_0x247cfc){return function(_0x8f7b4,_0x214f38,_0x456f31){WhatsappAccountEvents[_0x901d('0x6')](_0x247cfc+':'+_0x8f7b4['id'],_0x8f7b4);WhatsappAccountEvents['emit'](_0x247cfc,_0x8f7b4);_0x456f31(null);};}for(var e in events){if(events[_0x901d('0x7')](e)){var event=events[e];WhatsappAccount[_0x901d('0x8')](e,emitEvent(event));}}module[_0x901d('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x3a6d=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0x143));var _0xd3a6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3a6d[_0x199572];return _0x13cfa3;};'use strict';var EventEmitter=require(_0xd3a6('0x0'));var WhatsappAccount=require(_0xd3a6('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd3a6('0x2')](0x0);var events={'afterCreate':_0xd3a6('0x3'),'afterUpdate':_0xd3a6('0x4'),'afterDestroy':_0xd3a6('0x5')};function emitEvent(_0x3d37ff){return function(_0x585473,_0x1cb966,_0x27d641){WhatsappAccountEvents[_0xd3a6('0x6')](_0x3d37ff+':'+_0x585473['id'],_0x585473);WhatsappAccountEvents[_0xd3a6('0x6')](_0x3d37ff,_0x585473);_0x27d641(null);};}for(var e in events){if(events[_0xd3a6('0x7')](e)){var event=events[e];WhatsappAccount[_0xd3a6('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b003a6d..c9f510b 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 _0xab5a=['exports','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x5680b4,_0x21ae4e){var _0x43dd45=function(_0x13f956){while(--_0x13f956){_0x5680b4['push'](_0x5680b4['shift']());}};_0x43dd45(++_0x21ae4e);}(_0xab5a,0x122));var _0xaab5=function(_0x54169a,_0x1ea0d1){_0x54169a=_0x54169a-0x0;var _0x14e2fc=_0xab5a[_0x54169a];return _0x14e2fc;};'use strict';var _=require(_0xaab5('0x0'));var util=require('util');var logger=require(_0xaab5('0x1'))(_0xaab5('0x2'));var moment=require(_0xaab5('0x3'));var BPromise=require(_0xaab5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaab5('0x5'));var rimraf=require('rimraf');var config=require(_0xaab5('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xaab5('0x7')]=function(_0x516b75,_0x549d2b){return _0x516b75['define']('WhatsappAccount',attributes,{'tableName':_0xaab5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64a3=['bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1ec7b0,_0x2eb52a){var _0x5aff54=function(_0x1af5e6){while(--_0x1af5e6){_0x1ec7b0['push'](_0x1ec7b0['shift']());}};_0x5aff54(++_0x2eb52a);}(_0x64a3,0xb1));var _0x364a=function(_0x5227c6,_0x497640){_0x5227c6=_0x5227c6-0x0;var _0x586e6a=_0x64a3[_0x5227c6];return _0x586e6a;};'use strict';var _=require(_0x364a('0x0'));var util=require(_0x364a('0x1'));var logger=require(_0x364a('0x2'))(_0x364a('0x3'));var moment=require(_0x364a('0x4'));var BPromise=require(_0x364a('0x5'));var rp=require(_0x364a('0x6'));var fs=require('fs');var path=require(_0x364a('0x7'));var rimraf=require('rimraf');var config=require(_0x364a('0x8'));var attributes=require(_0x364a('0x9'));module[_0x364a('0xa')]=function(_0x3497d0,_0x363779){return _0x3497d0['define'](_0x364a('0xb'),attributes,{'tableName':_0x364a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index a864abb..09829f0 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 _0x95aa=['rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5228da,_0x4d44ac){var _0x1723f4=function(_0x4b169d){while(--_0x4b169d){_0x5228da['push'](_0x5228da['shift']());}};_0x1723f4(++_0x4d44ac);}(_0x95aa,0x91));var _0xa95a=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x95aa[_0x1e4f2f];return _0xccea89;};'use strict';var _=require(_0xa95a('0x0'));var util=require('util');var moment=require(_0xa95a('0x1'));var BPromise=require(_0xa95a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa95a('0x3'));var db=require(_0xa95a('0x4'))['db'];var utils=require(_0xa95a('0x5'));var logger=require(_0xa95a('0x6'))(_0xa95a('0x7'));var config=require(_0xa95a('0x8'));var jayson=require(_0xa95a('0x9'));var client=jayson[_0xa95a('0xa')][_0xa95a('0xb')]({'port':0x232a});config['redis']=_[_0xa95a('0xc')](config['redis'],{'host':_0xa95a('0xd'),'port':0x18eb});var socket=require(_0xa95a('0xe'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xa95a('0xf')](socket);function respondWithRpcPromise(_0x1a4056,_0x29a091,_0x2ec118){return new BPromise(function(_0x15ce6d,_0x29e4f0){return client[_0xa95a('0x10')](_0x1a4056,_0x2ec118)[_0xa95a('0x11')](function(_0xb951fb){logger[_0xa95a('0x12')](_0xa95a('0x13'),_0x29a091,'request\x20sent');logger['debug'](_0xa95a('0x14'),_0x29a091,'request\x20sent',JSON[_0xa95a('0x15')](_0xb951fb));if(_0xb951fb[_0xa95a('0x16')]){if(_0xb951fb[_0xa95a('0x16')][_0xa95a('0x17')]===0x1f4){logger[_0xa95a('0x16')](_0xa95a('0x13'),_0x29a091,_0xb951fb[_0xa95a('0x16')][_0xa95a('0x18')]);return _0x29e4f0(_0xb951fb[_0xa95a('0x16')][_0xa95a('0x18')]);}logger['error'](_0xa95a('0x13'),_0x29a091,_0xb951fb[_0xa95a('0x16')]['message']);return _0x15ce6d(_0xb951fb[_0xa95a('0x16')][_0xa95a('0x18')]);}else{logger[_0xa95a('0x12')](_0xa95a('0x13'),_0x29a091,'request\x20sent');_0x15ce6d(_0xb951fb[_0xa95a('0x19')]['message']);}})[_0xa95a('0x1a')](function(_0x334c65){logger[_0xa95a('0x16')](_0xa95a('0x13'),_0x29a091,_0x334c65);_0x29e4f0(_0x334c65);});});}exports[_0xa95a('0x1b')]=function(_0x28791e){var _0x4584c4=this;return new Promise(function(_0x27c464,_0x26a3be){return db[_0xa95a('0x1c')][_0xa95a('0x1d')]({'raw':_0x28791e['options']?_0x28791e[_0xa95a('0x1e')][_0xa95a('0x1f')]===undefined?!![]:![]:!![],'where':_0x28791e[_0xa95a('0x1e')]?_0x28791e[_0xa95a('0x1e')][_0xa95a('0x20')]||null:null,'attributes':_0x28791e['options']?_0x28791e['options'][_0xa95a('0x21')]||null:null,'include':_0x28791e[_0xa95a('0x1e')]?_0x28791e[_0xa95a('0x1e')][_0xa95a('0x22')]?_[_0xa95a('0x23')](_0x28791e[_0xa95a('0x1e')][_0xa95a('0x22')],function(_0xd66aea){return{'model':db[_0xd66aea[_0xa95a('0x24')]],'as':_0xd66aea['as'],'attributes':_0xd66aea[_0xa95a('0x21')],'include':_0xd66aea[_0xa95a('0x22')]?_[_0xa95a('0x23')](_0xd66aea[_0xa95a('0x22')],function(_0x3aa452){return{'model':db[_0x3aa452['model']],'as':_0x3aa452['as'],'attributes':_0x3aa452[_0xa95a('0x21')],'include':_0x3aa452[_0xa95a('0x22')]?_[_0xa95a('0x23')](_0x3aa452[_0xa95a('0x22')],function(_0x389f87){return{'model':db[_0x389f87[_0xa95a('0x24')]],'as':_0x389f87['as'],'attributes':_0x389f87[_0xa95a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa95a('0x11')](function(_0x1a795f){logger[_0xa95a('0x12')]('ShowWhatsappAccount',_0x28791e);logger[_0xa95a('0x25')]('ShowWhatsappAccount',_0x28791e,JSON['stringify'](_0x1a795f));_0x27c464(_0x1a795f);})[_0xa95a('0x1a')](function(_0x11f114){logger['error']('ShowWhatsappAccount',_0x11f114[_0xa95a('0x18')],_0x28791e);_0x26a3be(_0x4584c4[_0xa95a('0x16')](0x1f4,_0x11f114[_0xa95a('0x18')]));});});}; \ No newline at end of file +var _0x3d4e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','find','options','raw','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird'];(function(_0x3bf079,_0x36582e){var _0x21223e=function(_0x8633f0){while(--_0x8633f0){_0x3bf079['push'](_0x3bf079['shift']());}};_0x21223e(++_0x36582e);}(_0x3d4e,0x1dd));var _0xe3d4=function(_0x18afcc,_0x3eb4cd){_0x18afcc=_0x18afcc-0x0;var _0x290a6d=_0x3d4e[_0x18afcc];return _0x290a6d;};'use strict';var _=require(_0xe3d4('0x0'));var util=require(_0xe3d4('0x1'));var moment=require(_0xe3d4('0x2'));var BPromise=require(_0xe3d4('0x3'));var rs=require(_0xe3d4('0x4'));var fs=require('fs');var Redis=require(_0xe3d4('0x5'));var db=require(_0xe3d4('0x6'))['db'];var utils=require(_0xe3d4('0x7'));var logger=require(_0xe3d4('0x8'))(_0xe3d4('0x9'));var config=require(_0xe3d4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe3d4('0xb')][_0xe3d4('0xc')]({'port':0x232a});config['redis']=_[_0xe3d4('0xd')](config[_0xe3d4('0xe')],{'host':_0xe3d4('0xf'),'port':0x18eb});var socket=require(_0xe3d4('0x10'))(new Redis(config[_0xe3d4('0xe')]));require('./whatsappAccount.socket')[_0xe3d4('0x11')](socket);function respondWithRpcPromise(_0x3f550d,_0xe08be,_0x5c9223){return new BPromise(function(_0x461367,_0x356511){return client['request'](_0x3f550d,_0x5c9223)[_0xe3d4('0x12')](function(_0x5acdb6){logger[_0xe3d4('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xe08be,_0xe3d4('0x14'));logger[_0xe3d4('0x15')](_0xe3d4('0x16'),_0xe08be,_0xe3d4('0x14'),JSON['stringify'](_0x5acdb6));if(_0x5acdb6[_0xe3d4('0x17')]){if(_0x5acdb6['error'][_0xe3d4('0x18')]===0x1f4){logger['error'](_0xe3d4('0x19'),_0xe08be,_0x5acdb6['error'][_0xe3d4('0x1a')]);return _0x356511(_0x5acdb6[_0xe3d4('0x17')][_0xe3d4('0x1a')]);}logger['error'](_0xe3d4('0x19'),_0xe08be,_0x5acdb6[_0xe3d4('0x17')][_0xe3d4('0x1a')]);return _0x461367(_0x5acdb6[_0xe3d4('0x17')][_0xe3d4('0x1a')]);}else{logger[_0xe3d4('0x13')](_0xe3d4('0x19'),_0xe08be,_0xe3d4('0x14'));_0x461367(_0x5acdb6[_0xe3d4('0x1b')][_0xe3d4('0x1a')]);}})[_0xe3d4('0x1c')](function(_0x106482){logger[_0xe3d4('0x17')](_0xe3d4('0x19'),_0xe08be,_0x106482);_0x356511(_0x106482);});});}exports['ShowWhatsappAccount']=function(_0x55ba99){var _0x127139=this;return new Promise(function(_0x4c2617,_0x504c7f){return db['WhatsappAccount'][_0xe3d4('0x1d')]({'raw':_0x55ba99[_0xe3d4('0x1e')]?_0x55ba99['options'][_0xe3d4('0x1f')]===undefined?!![]:![]:!![],'where':_0x55ba99[_0xe3d4('0x1e')]?_0x55ba99[_0xe3d4('0x1e')]['where']||null:null,'attributes':_0x55ba99[_0xe3d4('0x1e')]?_0x55ba99[_0xe3d4('0x1e')][_0xe3d4('0x20')]||null:null,'include':_0x55ba99[_0xe3d4('0x1e')]?_0x55ba99[_0xe3d4('0x1e')][_0xe3d4('0x21')]?_[_0xe3d4('0x22')](_0x55ba99['options'][_0xe3d4('0x21')],function(_0x584a1f){return{'model':db[_0x584a1f[_0xe3d4('0x23')]],'as':_0x584a1f['as'],'attributes':_0x584a1f[_0xe3d4('0x20')],'include':_0x584a1f[_0xe3d4('0x21')]?_[_0xe3d4('0x22')](_0x584a1f[_0xe3d4('0x21')],function(_0x2453d3){return{'model':db[_0x2453d3[_0xe3d4('0x23')]],'as':_0x2453d3['as'],'attributes':_0x2453d3['attributes'],'include':_0x2453d3['include']?_[_0xe3d4('0x22')](_0x2453d3['include'],function(_0x1baafc){return{'model':db[_0x1baafc[_0xe3d4('0x23')]],'as':_0x1baafc['as'],'attributes':_0x1baafc['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3d4('0x12')](function(_0x51e2b0){logger[_0xe3d4('0x13')](_0xe3d4('0x24'),_0x55ba99);logger[_0xe3d4('0x15')]('ShowWhatsappAccount',_0x55ba99,JSON['stringify'](_0x51e2b0));_0x4c2617(_0x51e2b0);})['catch'](function(_0x37da49){logger[_0xe3d4('0x17')](_0xe3d4('0x24'),_0x37da49['message'],_0x55ba99);_0x504c7f(_0x127139[_0xe3d4('0x17')](0x1f4,_0x37da49[_0xe3d4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 74a5e2f..53da5e1 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 _0x7996=['remove','emit','removeListener','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x3770c8,_0x4c3e51){var _0x33d6ff=function(_0x5e1f08){while(--_0x5e1f08){_0x3770c8['push'](_0x3770c8['shift']());}};_0x33d6ff(++_0x4c3e51);}(_0x7996,0x1c0));var _0x6799=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x7996[_0x1b02bb];return _0x131245;};'use strict';var WhatsappAccountEvents=require(_0x6799('0x0'));var events=[_0x6799('0x1'),_0x6799('0x2'),'update'];function createListener(_0x2ba0e7,_0x5c5e32){return function(_0x3af4bf){_0x5c5e32[_0x6799('0x3')](_0x2ba0e7,_0x3af4bf);};}function removeListener(_0x14c1a6,_0x41dffa){return function(){WhatsappAccountEvents[_0x6799('0x4')](_0x14c1a6,_0x41dffa);};}exports['register']=function(_0x1bc661){for(var _0xcc84d=0x0,_0x28a300=events['length'];_0xcc84d<_0x28a300;_0xcc84d++){var _0x26682a=events[_0xcc84d];var _0x32961f=createListener(_0x6799('0x5')+_0x26682a,_0x1bc661);WhatsappAccountEvents['on'](_0x26682a,_0x32961f);}}; \ No newline at end of file +var _0xfc28=['./whatsappAccount.events','save','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x326f9b,_0x45af04){var _0x4e04c1=function(_0x4bcbee){while(--_0x4bcbee){_0x326f9b['push'](_0x326f9b['shift']());}};_0x4e04c1(++_0x45af04);}(_0xfc28,0x17a));var _0x8fc2=function(_0x16569c,_0x50a923){_0x16569c=_0x16569c-0x0;var _0x12b387=_0xfc28[_0x16569c];return _0x12b387;};'use strict';var WhatsappAccountEvents=require(_0x8fc2('0x0'));var events=[_0x8fc2('0x1'),_0x8fc2('0x2'),_0x8fc2('0x3')];function createListener(_0x536056,_0xcacacc){return function(_0x3d2a67){_0xcacacc[_0x8fc2('0x4')](_0x536056,_0x3d2a67);};}function removeListener(_0x4bac88,_0x2cdc37){return function(){WhatsappAccountEvents[_0x8fc2('0x5')](_0x4bac88,_0x2cdc37);};}exports[_0x8fc2('0x6')]=function(_0x123845){for(var _0x5ab722=0x0,_0x1f0bc9=events[_0x8fc2('0x7')];_0x5ab722<_0x1f0bc9;_0x5ab722++){var _0x3f53d2=events[_0x5ab722];var _0x2e6b32=createListener(_0x8fc2('0x8')+_0x3f53d2,_0x123845);WhatsappAccountEvents['on'](_0x3f53d2,_0x2e6b32);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e17377e..28d828c 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 _0x5574=['isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0xd580e2,_0x109182){var _0x4d955f=function(_0x568fff){while(--_0x568fff){_0xd580e2['push'](_0xd580e2['shift']());}};_0x4d955f(++_0x109182);}(_0x5574,0x81));var _0x4557=function(_0x2ff72c,_0x2ea6c8){_0x2ff72c=_0x2ff72c-0x0;var _0x41020a=_0x5574[_0x2ff72c];return _0x41020a;};'use strict';var multer=require(_0x4557('0x0'));var util=require('util');var path=require(_0x4557('0x1'));var timeout=require(_0x4557('0x2'));var express=require(_0x4557('0x3'));var router=express[_0x4557('0x4')]();var fs_extra=require(_0x4557('0x5'));var auth=require(_0x4557('0x6'));var interaction=require(_0x4557('0x7'));var config=require(_0x4557('0x8'));var controller=require(_0x4557('0x9'));router[_0x4557('0xa')]('/',auth[_0x4557('0xb')](),controller[_0x4557('0xc')]);router['get'](_0x4557('0xd'),auth[_0x4557('0xb')](),controller[_0x4557('0xe')]);router[_0x4557('0xf')]('/',auth[_0x4557('0xb')](),controller[_0x4557('0x10')]);router[_0x4557('0x11')](_0x4557('0xd'),auth[_0x4557('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4557('0x12')]);module[_0x4557('0x13')]=router; \ No newline at end of file +var _0xc107=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','post','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0xc107,0xc2));var _0x7c10=function(_0x5654b6,_0x52d20c){_0x5654b6=_0x5654b6-0x0;var _0x450267=_0xc107[_0x5654b6];return _0x450267;};'use strict';var multer=require(_0x7c10('0x0'));var util=require(_0x7c10('0x1'));var path=require(_0x7c10('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c10('0x3'));var router=express[_0x7c10('0x4')]();var fs_extra=require(_0x7c10('0x5'));var auth=require(_0x7c10('0x6'));var interaction=require(_0x7c10('0x7'));var config=require(_0x7c10('0x8'));var controller=require(_0x7c10('0x9'));router[_0x7c10('0xa')]('/',auth['isAuthenticated'](),controller[_0x7c10('0xb')]);router['get']('/:id',auth[_0x7c10('0xc')](),controller['show']);router[_0x7c10('0xd')]('/',auth[_0x7c10('0xc')](),controller[_0x7c10('0xe')]);router[_0x7c10('0xf')](_0x7c10('0x10'),auth[_0x7c10('0xc')](),controller[_0x7c10('0x11')]);router['delete'](_0x7c10('0x10'),auth[_0x7c10('0xc')](),controller[_0x7c10('0x12')]);module[_0x7c10('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index bf8a501..5233804 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 _0x64e5=['INTEGER','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64e5,0x146));var _0x564e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x64e5[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x564e('0x0'));module[_0x564e('0x1')]={'priority':{'type':Sequelize[_0x564e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x564e('0x3')]},'interval':{'type':Sequelize[_0x564e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6018=['exports','TEXT','STRING','sequelize'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x6018,0x1df));var _0x8601=function(_0x3359a5,_0x3eefb6){_0x3359a5=_0x3359a5-0x0;var _0x425847=_0x6018[_0x3359a5];return _0x425847;};'use strict';var Sequelize=require(_0x8601('0x0'));module[_0x8601('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8601('0x2')]()},'description':{'type':Sequelize[_0x8601('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a10bc59..5440d90 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 _0x53aa=['destroy','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','WhatsappApplication','findAll','catch','show','includeAll','include','create','body','find','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then'];(function(_0x594857,_0x32bdc5){var _0x2894f3=function(_0x80cf2d){while(--_0x80cf2d){_0x594857['push'](_0x594857['shift']());}};_0x2894f3(++_0x32bdc5);}(_0x53aa,0x6d));var _0xa53a=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x53aa[_0x486f4a];return _0x135d99;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa53a('0x0'));var jsonpatch=require(_0xa53a('0x1'));var rp=require('request-promise');var moment=require(_0xa53a('0x2'));var BPromise=require(_0xa53a('0x3'));var Mustache=require(_0xa53a('0x4'));var util=require(_0xa53a('0x5'));var path=require(_0xa53a('0x6'));var sox=require(_0xa53a('0x7'));var csv=require(_0xa53a('0x8'));var ejs=require(_0xa53a('0x9'));var fs=require('fs');var fs_extra=require(_0xa53a('0xa'));var _=require(_0xa53a('0xb'));var squel=require('squel');var crypto=require(_0xa53a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa53a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa53a('0xe'));var Papa=require('papaparse');var Redis=require(_0xa53a('0xf'));var authService=require(_0xa53a('0x10'));var qs=require(_0xa53a('0x11'));var as=require(_0xa53a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa53a('0x13'));var utils=require(_0xa53a('0x14'));var config=require(_0xa53a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa53a('0x16'))['db'];function respondWithStatusCode(_0x419494,_0x18e658){_0x18e658=_0x18e658||0xcc;return function(_0x20de47){if(_0x20de47){return _0x419494[_0xa53a('0x17')](_0x18e658);}return _0x419494['status'](_0x18e658)[_0xa53a('0x18')]();};}function respondWithResult(_0x39e5ab,_0x5bb756){_0x5bb756=_0x5bb756||0xc8;return function(_0x49f8f1){if(_0x49f8f1){return _0x39e5ab[_0xa53a('0x19')](_0x5bb756)[_0xa53a('0x1a')](_0x49f8f1);}};}function respondWithFilteredResult(_0x3aded6,_0x2ba1cc){return function(_0x23c420){if(_0x23c420){var _0x49ffe7=typeof _0x2ba1cc[_0xa53a('0x1b')]===_0xa53a('0x1c')&&typeof _0x2ba1cc[_0xa53a('0x1d')]===_0xa53a('0x1c');var _0x3e729b=_0x23c420[_0xa53a('0x1e')];var _0x595d3c=_0x49ffe7?0x0:_0x2ba1cc[_0xa53a('0x1b')];var _0x2beec4=_0x49ffe7?_0x23c420[_0xa53a('0x1e')]:_0x2ba1cc[_0xa53a('0x1b')]+_0x2ba1cc[_0xa53a('0x1d')];var _0x145586;if(_0x2beec4>=_0x3e729b){_0x2beec4=_0x3e729b;_0x145586=0xc8;}else{_0x145586=0xce;}_0x3aded6[_0xa53a('0x19')](_0x145586);return _0x3aded6['set']('Content-Range',_0x595d3c+'-'+_0x2beec4+'/'+_0x3e729b)[_0xa53a('0x1a')](_0x23c420);}return null;};}function patchUpdates(_0x5a4281){return function(_0x2121c8){try{jsonpatch[_0xa53a('0x1f')](_0x2121c8,_0x5a4281,!![]);}catch(_0x27071c){return BPromise['reject'](_0x27071c);}return _0x2121c8[_0xa53a('0x20')]();};}function saveUpdates(_0x42d44a,_0x2a344d){return function(_0x4fd7b8){if(_0x4fd7b8){return _0x4fd7b8[_0xa53a('0x21')](_0x42d44a)[_0xa53a('0x22')](function(_0x3c457f){return _0x3c457f;});}return null;};}function removeEntity(_0x33a698,_0x2b56b7){return function(_0x458d03){if(_0x458d03){return _0x458d03[_0xa53a('0x23')]()['then'](function(){_0x33a698[_0xa53a('0x19')](0xcc)[_0xa53a('0x18')]();});}};}function handleEntityNotFound(_0x58df30,_0xd1cfed){return function(_0x71de90){if(!_0x71de90){_0x58df30[_0xa53a('0x17')](0x194);}return _0x71de90;};}function handleError(_0x383503,_0x18fa52){_0x18fa52=_0x18fa52||0x1f4;return function(_0x43589f){logger[_0xa53a('0x24')](_0x43589f[_0xa53a('0x25')]);if(_0x43589f[_0xa53a('0x26')]){delete _0x43589f[_0xa53a('0x26')];}_0x383503[_0xa53a('0x19')](_0x18fa52)[_0xa53a('0x27')](_0x43589f);};}exports['index']=function(_0x2b3180,_0x3d0c0d){var _0x1f1957={},_0x36b686={},_0x134f5e={'count':0x0,'rows':[]};var _0x2cb10f=_[_0xa53a('0x28')](db['WhatsappApplication']['rawAttributes'],function(_0x2c6d93){return{'name':_0x2c6d93[_0xa53a('0x29')],'type':_0x2c6d93['type'][_0xa53a('0x2a')]};});_0x36b686[_0xa53a('0x2b')]=_['map'](_0x2cb10f,_0xa53a('0x26'));_0x36b686[_0xa53a('0x2c')]=_[_0xa53a('0x2d')](_0x2b3180[_0xa53a('0x2c')]);_0x36b686[_0xa53a('0x2e')]=_[_0xa53a('0x2f')](_0x36b686[_0xa53a('0x2b')],_0x36b686[_0xa53a('0x2c')]);_0x1f1957[_0xa53a('0x30')]=_['intersection'](_0x36b686[_0xa53a('0x2b')],qs[_0xa53a('0x31')](_0x2b3180[_0xa53a('0x2c')][_0xa53a('0x31')]));_0x1f1957['attributes']=_0x1f1957[_0xa53a('0x30')][_0xa53a('0x32')]?_0x1f1957['attributes']:_0x36b686[_0xa53a('0x2b')];if(!_0x2b3180[_0xa53a('0x2c')][_0xa53a('0x33')](_0xa53a('0x34'))){_0x1f1957[_0xa53a('0x1d')]=qs['limit'](_0x2b3180['query'][_0xa53a('0x1d')]);_0x1f1957['offset']=qs[_0xa53a('0x1b')](_0x2b3180[_0xa53a('0x2c')]['offset']);}_0x1f1957[_0xa53a('0x35')]=qs[_0xa53a('0x36')](_0x2b3180[_0xa53a('0x2c')]['sort']);_0x1f1957[_0xa53a('0x37')]=qs[_0xa53a('0x2e')](_[_0xa53a('0x38')](_0x2b3180[_0xa53a('0x2c')],_0x36b686[_0xa53a('0x2e')]),_0x2cb10f);if(_0x2b3180[_0xa53a('0x2c')]['filter']){_0x1f1957['where']=_[_0xa53a('0x39')](_0x1f1957[_0xa53a('0x37')],{'$or':_[_0xa53a('0x28')](_0x2cb10f,function(_0x1cab87){if(_0x1cab87[_0xa53a('0x3a')]!==_0xa53a('0x3b')){var _0x5c85a6={};_0x5c85a6[_0x1cab87['name']]={'$like':'%'+_0x2b3180[_0xa53a('0x2c')][_0xa53a('0x3c')]+'%'};return _0x5c85a6;}})});}_0x1f1957=_['merge']({},_0x1f1957,_0x2b3180[_0xa53a('0x3d')]);var _0x72d879={'where':_0x1f1957[_0xa53a('0x37')]};return db[_0xa53a('0x3e')][_0xa53a('0x1e')](_0x72d879)[_0xa53a('0x22')](function(_0x32d45f){_0x134f5e[_0xa53a('0x1e')]=_0x32d45f;if(_0x2b3180[_0xa53a('0x2c')]['includeAll']){_0x1f1957['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0xa53a('0x3f')](_0x1f1957);})[_0xa53a('0x22')](function(_0x2e0a4e){_0x134f5e['rows']=_0x2e0a4e;return _0x134f5e;})[_0xa53a('0x22')](respondWithFilteredResult(_0x3d0c0d,_0x1f1957))[_0xa53a('0x40')](handleError(_0x3d0c0d,null));};exports[_0xa53a('0x41')]=function(_0xfc7e4a,_0x46a1aa){var _0x49b2fb={'raw':!![],'where':{'id':_0xfc7e4a['params']['id']}},_0x3d784a={};_0x3d784a[_0xa53a('0x2b')]=_[_0xa53a('0x2d')](db[_0xa53a('0x3e')]['rawAttributes']);_0x3d784a['query']=_[_0xa53a('0x2d')](_0xfc7e4a['query']);_0x3d784a[_0xa53a('0x2e')]=_[_0xa53a('0x2f')](_0x3d784a[_0xa53a('0x2b')],_0x3d784a['query']);_0x49b2fb[_0xa53a('0x30')]=_['intersection'](_0x3d784a[_0xa53a('0x2b')],qs['fields'](_0xfc7e4a[_0xa53a('0x2c')][_0xa53a('0x31')]));_0x49b2fb[_0xa53a('0x30')]=_0x49b2fb['attributes'][_0xa53a('0x32')]?_0x49b2fb['attributes']:_0x3d784a['model'];if(_0xfc7e4a['query'][_0xa53a('0x42')]){_0x49b2fb[_0xa53a('0x43')]=[{'all':!![]}];}_0x49b2fb=_[_0xa53a('0x39')]({},_0x49b2fb,_0xfc7e4a[_0xa53a('0x3d')]);return db[_0xa53a('0x3e')]['find'](_0x49b2fb)[_0xa53a('0x22')](handleEntityNotFound(_0x46a1aa,null))[_0xa53a('0x22')](respondWithResult(_0x46a1aa,null))[_0xa53a('0x40')](handleError(_0x46a1aa,null));};exports['create']=function(_0x5eeca8,_0x511326){return db[_0xa53a('0x3e')][_0xa53a('0x44')](_0x5eeca8['body'],{})[_0xa53a('0x22')](respondWithResult(_0x511326,0xc9))[_0xa53a('0x40')](handleError(_0x511326,null));};exports[_0xa53a('0x21')]=function(_0x139cf4,_0xce75b0){if(_0x139cf4[_0xa53a('0x45')]['id']){delete _0x139cf4[_0xa53a('0x45')]['id'];}return db[_0xa53a('0x3e')][_0xa53a('0x46')]({'where':{'id':_0x139cf4[_0xa53a('0x47')]['id']}})[_0xa53a('0x22')](handleEntityNotFound(_0xce75b0,null))[_0xa53a('0x22')](saveUpdates(_0x139cf4['body'],null))[_0xa53a('0x22')](respondWithResult(_0xce75b0,null))[_0xa53a('0x40')](handleError(_0xce75b0,null));};exports[_0xa53a('0x23')]=function(_0x5e7b2f,_0x3e3f26){return db['WhatsappApplication'][_0xa53a('0x46')]({'where':{'id':_0x5e7b2f[_0xa53a('0x47')]['id']}})[_0xa53a('0x22')](handleEntityNotFound(_0x3e3f26,null))[_0xa53a('0x22')](removeEntity(_0x3e3f26,null))[_0xa53a('0x40')](handleError(_0x3e3f26,null));}; \ No newline at end of file +var _0x05bf=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','update','params','eml-format','rimraf'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x05bf,0xe5));var _0xf05b=function(_0x4c8672,_0x42e61b){_0x4c8672=_0x4c8672-0x0;var _0x540dea=_0x05bf[_0x4c8672];return _0x540dea;};'use strict';var emlformat=require(_0xf05b('0x0'));var rimraf=require(_0xf05b('0x1'));var zipdir=require(_0xf05b('0x2'));var jsonpatch=require(_0xf05b('0x3'));var rp=require(_0xf05b('0x4'));var moment=require(_0xf05b('0x5'));var BPromise=require(_0xf05b('0x6'));var Mustache=require(_0xf05b('0x7'));var util=require(_0xf05b('0x8'));var path=require(_0xf05b('0x9'));var sox=require('sox');var csv=require(_0xf05b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf05b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf05b('0xc'));var deskjs=require(_0xf05b('0xd'));var toCsv=require(_0xf05b('0xa'));var querystring=require(_0xf05b('0xe'));var Papa=require('papaparse');var Redis=require(_0xf05b('0xf'));var authService=require(_0xf05b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf05b('0x11'));var hardwareService=require(_0xf05b('0x12'));var logger=require(_0xf05b('0x13'))(_0xf05b('0x14'));var utils=require(_0xf05b('0x15'));var config=require(_0xf05b('0x16'));var licenseUtil=require(_0xf05b('0x17'));var db=require(_0xf05b('0x18'))['db'];function respondWithStatusCode(_0x121276,_0x2ce192){_0x2ce192=_0x2ce192||0xcc;return function(_0x2914ed){if(_0x2914ed){return _0x121276[_0xf05b('0x19')](_0x2ce192);}return _0x121276[_0xf05b('0x1a')](_0x2ce192)[_0xf05b('0x1b')]();};}function respondWithResult(_0x218114,_0x5f4e2a){_0x5f4e2a=_0x5f4e2a||0xc8;return function(_0x233974){if(_0x233974){return _0x218114['status'](_0x5f4e2a)[_0xf05b('0x1c')](_0x233974);}};}function respondWithFilteredResult(_0x53ac4f,_0x4fd28){return function(_0x10dfc7){if(_0x10dfc7){var _0x408419=typeof _0x4fd28[_0xf05b('0x1d')]==='undefined'&&typeof _0x4fd28[_0xf05b('0x1e')]===_0xf05b('0x1f');var _0x8ed741=_0x10dfc7['count'];var _0x4b9cc2=_0x408419?0x0:_0x4fd28[_0xf05b('0x1d')];var _0x22756b=_0x408419?_0x10dfc7['count']:_0x4fd28['offset']+_0x4fd28[_0xf05b('0x1e')];var _0x22468b;if(_0x22756b>=_0x8ed741){_0x22756b=_0x8ed741;_0x22468b=0xc8;}else{_0x22468b=0xce;}_0x53ac4f[_0xf05b('0x1a')](_0x22468b);return _0x53ac4f[_0xf05b('0x20')](_0xf05b('0x21'),_0x4b9cc2+'-'+_0x22756b+'/'+_0x8ed741)['json'](_0x10dfc7);}return null;};}function patchUpdates(_0x158da7){return function(_0x58f27e){try{jsonpatch[_0xf05b('0x22')](_0x58f27e,_0x158da7,!![]);}catch(_0x41fc69){return BPromise['reject'](_0x41fc69);}return _0x58f27e[_0xf05b('0x23')]();};}function saveUpdates(_0xfa8d,_0x1a2a1e){return function(_0x46783b){if(_0x46783b){return _0x46783b['update'](_0xfa8d)[_0xf05b('0x24')](function(_0xdae7fc){return _0xdae7fc;});}return null;};}function removeEntity(_0x527576,_0xb49343){return function(_0x1d22a7){if(_0x1d22a7){return _0x1d22a7[_0xf05b('0x25')]()[_0xf05b('0x24')](function(){_0x527576['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x543570,_0x398242){return function(_0x37fe98){if(!_0x37fe98){_0x543570[_0xf05b('0x19')](0x194);}return _0x37fe98;};}function handleError(_0x26c153,_0x1aa155){_0x1aa155=_0x1aa155||0x1f4;return function(_0x358087){logger[_0xf05b('0x26')](_0x358087[_0xf05b('0x27')]);if(_0x358087['name']){delete _0x358087[_0xf05b('0x28')];}_0x26c153[_0xf05b('0x1a')](_0x1aa155)[_0xf05b('0x29')](_0x358087);};}exports[_0xf05b('0x2a')]=function(_0x413aa3,_0x1d907d){var _0x88f241={},_0x3d167c={},_0x7989c3={'count':0x0,'rows':[]};var _0x107845=_['map'](db[_0xf05b('0x2b')][_0xf05b('0x2c')],function(_0x1334f3){return{'name':_0x1334f3[_0xf05b('0x2d')],'type':_0x1334f3[_0xf05b('0x2e')][_0xf05b('0x2f')]};});_0x3d167c[_0xf05b('0x30')]=_[_0xf05b('0x31')](_0x107845,_0xf05b('0x28'));_0x3d167c['query']=_[_0xf05b('0x32')](_0x413aa3[_0xf05b('0x33')]);_0x3d167c[_0xf05b('0x34')]=_[_0xf05b('0x35')](_0x3d167c[_0xf05b('0x30')],_0x3d167c[_0xf05b('0x33')]);_0x88f241['attributes']=_[_0xf05b('0x35')](_0x3d167c['model'],qs[_0xf05b('0x36')](_0x413aa3[_0xf05b('0x33')][_0xf05b('0x36')]));_0x88f241[_0xf05b('0x37')]=_0x88f241['attributes'][_0xf05b('0x38')]?_0x88f241[_0xf05b('0x37')]:_0x3d167c[_0xf05b('0x30')];if(!_0x413aa3[_0xf05b('0x33')][_0xf05b('0x39')]('nolimit')){_0x88f241[_0xf05b('0x1e')]=qs['limit'](_0x413aa3['query'][_0xf05b('0x1e')]);_0x88f241[_0xf05b('0x1d')]=qs[_0xf05b('0x1d')](_0x413aa3[_0xf05b('0x33')]['offset']);}_0x88f241['order']=qs[_0xf05b('0x3a')](_0x413aa3['query'][_0xf05b('0x3a')]);_0x88f241[_0xf05b('0x3b')]=qs[_0xf05b('0x34')](_[_0xf05b('0x3c')](_0x413aa3['query'],_0x3d167c[_0xf05b('0x34')]),_0x107845);if(_0x413aa3[_0xf05b('0x33')][_0xf05b('0x3d')]){_0x88f241['where']=_[_0xf05b('0x3e')](_0x88f241[_0xf05b('0x3b')],{'$or':_[_0xf05b('0x31')](_0x107845,function(_0x44dd57){if(_0x44dd57[_0xf05b('0x2e')]!==_0xf05b('0x3f')){var _0x44b1ca={};_0x44b1ca[_0x44dd57[_0xf05b('0x28')]]={'$like':'%'+_0x413aa3['query'][_0xf05b('0x3d')]+'%'};return _0x44b1ca;}})});}_0x88f241=_[_0xf05b('0x3e')]({},_0x88f241,_0x413aa3[_0xf05b('0x40')]);var _0x32384c={'where':_0x88f241['where']};return db[_0xf05b('0x2b')][_0xf05b('0x41')](_0x32384c)[_0xf05b('0x24')](function(_0x5bde58){_0x7989c3[_0xf05b('0x41')]=_0x5bde58;if(_0x413aa3['query'][_0xf05b('0x42')]){_0x88f241['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0xf05b('0x43')](_0x88f241);})[_0xf05b('0x24')](function(_0x5e3ae4){_0x7989c3[_0xf05b('0x44')]=_0x5e3ae4;return _0x7989c3;})[_0xf05b('0x24')](respondWithFilteredResult(_0x1d907d,_0x88f241))[_0xf05b('0x45')](handleError(_0x1d907d,null));};exports[_0xf05b('0x46')]=function(_0x44a357,_0x6d73e){var _0x44dbee={'raw':!![],'where':{'id':_0x44a357['params']['id']}},_0xec81a8={};_0xec81a8[_0xf05b('0x30')]=_[_0xf05b('0x32')](db[_0xf05b('0x2b')][_0xf05b('0x2c')]);_0xec81a8['query']=_[_0xf05b('0x32')](_0x44a357[_0xf05b('0x33')]);_0xec81a8[_0xf05b('0x34')]=_[_0xf05b('0x35')](_0xec81a8[_0xf05b('0x30')],_0xec81a8['query']);_0x44dbee[_0xf05b('0x37')]=_[_0xf05b('0x35')](_0xec81a8[_0xf05b('0x30')],qs[_0xf05b('0x36')](_0x44a357[_0xf05b('0x33')][_0xf05b('0x36')]));_0x44dbee[_0xf05b('0x37')]=_0x44dbee[_0xf05b('0x37')][_0xf05b('0x38')]?_0x44dbee[_0xf05b('0x37')]:_0xec81a8[_0xf05b('0x30')];if(_0x44a357[_0xf05b('0x33')]['includeAll']){_0x44dbee[_0xf05b('0x47')]=[{'all':!![]}];}_0x44dbee=_[_0xf05b('0x3e')]({},_0x44dbee,_0x44a357[_0xf05b('0x40')]);return db['WhatsappApplication'][_0xf05b('0x48')](_0x44dbee)['then'](handleEntityNotFound(_0x6d73e,null))['then'](respondWithResult(_0x6d73e,null))['catch'](handleError(_0x6d73e,null));};exports['create']=function(_0xc52f84,_0x2c6d46){return db[_0xf05b('0x2b')][_0xf05b('0x49')](_0xc52f84[_0xf05b('0x4a')],{})['then'](respondWithResult(_0x2c6d46,0xc9))['catch'](handleError(_0x2c6d46,null));};exports[_0xf05b('0x4b')]=function(_0x14bc89,_0x3b95f1){if(_0x14bc89['body']['id']){delete _0x14bc89[_0xf05b('0x4a')]['id'];}return db[_0xf05b('0x2b')][_0xf05b('0x48')]({'where':{'id':_0x14bc89[_0xf05b('0x4c')]['id']}})[_0xf05b('0x24')](handleEntityNotFound(_0x3b95f1,null))[_0xf05b('0x24')](saveUpdates(_0x14bc89[_0xf05b('0x4a')],null))[_0xf05b('0x24')](respondWithResult(_0x3b95f1,null))[_0xf05b('0x45')](handleError(_0x3b95f1,null));};exports[_0xf05b('0x25')]=function(_0xb16e98,_0xf4ad89){return db[_0xf05b('0x2b')][_0xf05b('0x48')]({'where':{'id':_0xb16e98['params']['id']}})[_0xf05b('0x24')](handleEntityNotFound(_0xf4ad89,null))[_0xf05b('0x24')](removeEntity(_0xf4ad89,null))[_0xf05b('0x45')](handleError(_0xf4ad89,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index a7216e0..5cd55fc 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 _0xa6c0=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x3df25f,_0x2ed46e){var _0x386acd=function(_0x27edb0){while(--_0x27edb0){_0x3df25f['push'](_0x3df25f['shift']());}};_0x386acd(++_0x2ed46e);}(_0xa6c0,0x184));var _0x0a6c=function(_0x322c68,_0x2fe626){_0x322c68=_0x322c68-0x0;var _0x38cf31=_0xa6c0[_0x322c68];return _0x38cf31;};'use strict';var _=require(_0x0a6c('0x0'));var util=require(_0x0a6c('0x1'));var logger=require(_0x0a6c('0x2'))('api');var moment=require(_0x0a6c('0x3'));var BPromise=require('bluebird');var rp=require(_0x0a6c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6c('0x5'));var config=require(_0x0a6c('0x6'));var attributes=require(_0x0a6c('0x7'));module[_0x0a6c('0x8')]=function(_0xc2325f,_0x505f0d){return _0xc2325f[_0x0a6c('0x9')](_0x0a6c('0xa'),attributes,{'tableName':_0x0a6c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a6c('0xc')});}; \ No newline at end of file +var _0xbf21=['exports','WhatsappApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes'];(function(_0x375961,_0x211a76){var _0x50f35a=function(_0x30b592){while(--_0x30b592){_0x375961['push'](_0x375961['shift']());}};_0x50f35a(++_0x211a76);}(_0xbf21,0xab));var _0x1bf2=function(_0xd70761,_0x2c5111){_0xd70761=_0xd70761-0x0;var _0x5420dd=_0xbf21[_0xd70761];return _0x5420dd;};'use strict';var _=require(_0x1bf2('0x0'));var util=require(_0x1bf2('0x1'));var logger=require(_0x1bf2('0x2'))(_0x1bf2('0x3'));var moment=require(_0x1bf2('0x4'));var BPromise=require('bluebird');var rp=require(_0x1bf2('0x5'));var fs=require('fs');var path=require(_0x1bf2('0x6'));var rimraf=require('rimraf');var config=require(_0x1bf2('0x7'));var attributes=require(_0x1bf2('0x8'));module[_0x1bf2('0x9')]=function(_0x4e638b,_0x2dd61f){return _0x4e638b['define'](_0x1bf2('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1bf2('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9d175cd..dc5e9f5 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 _0x39d9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x53d99f,_0x112f2c){var _0x3555a8=function(_0x290c5b){while(--_0x290c5b){_0x53d99f['push'](_0x53d99f['shift']());}};_0x3555a8(++_0x112f2c);}(_0x39d9,0x17f));var _0x939d=function(_0x40c98f,_0x538320){_0x40c98f=_0x40c98f-0x0;var _0x2380b5=_0x39d9[_0x40c98f];return _0x2380b5;};'use strict';var _=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var moment=require(_0x939d('0x2'));var BPromise=require(_0x939d('0x3'));var rs=require(_0x939d('0x4'));var fs=require('fs');var Redis=require(_0x939d('0x5'));var db=require(_0x939d('0x6'))['db'];var utils=require(_0x939d('0x7'));var logger=require('../../config/logger')(_0x939d('0x8'));var config=require(_0x939d('0x9'));var jayson=require(_0x939d('0xa'));var client=jayson['client'][_0x939d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x537fd2,_0x2ba30f,_0x1bac28){return new BPromise(function(_0x20546a,_0xd65604){return client[_0x939d('0xc')](_0x537fd2,_0x1bac28)[_0x939d('0xd')](function(_0x39e0b5){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x2ba30f,_0x939d('0xe'));logger[_0x939d('0xf')](_0x939d('0x10'),_0x2ba30f,_0x939d('0xe'),JSON[_0x939d('0x11')](_0x39e0b5));if(_0x39e0b5['error']){if(_0x39e0b5['error']['code']===0x1f4){logger[_0x939d('0x12')](_0x939d('0x13'),_0x2ba30f,_0x39e0b5[_0x939d('0x12')]['message']);return _0xd65604(_0x39e0b5[_0x939d('0x12')][_0x939d('0x14')]);}logger[_0x939d('0x12')](_0x939d('0x13'),_0x2ba30f,_0x39e0b5[_0x939d('0x12')][_0x939d('0x14')]);return _0x20546a(_0x39e0b5[_0x939d('0x12')][_0x939d('0x14')]);}else{logger[_0x939d('0x15')]('WhatsappApplication,\x20%s,\x20%s',_0x2ba30f,'request\x20sent');_0x20546a(_0x39e0b5[_0x939d('0x16')]['message']);}})[_0x939d('0x17')](function(_0x1b1a4f){logger['error'](_0x939d('0x13'),_0x2ba30f,_0x1b1a4f);_0xd65604(_0x1b1a4f);});});} \ No newline at end of file +var _0x9c63=['message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x56fcfb,_0x1e3df7){var _0x3b868c=function(_0x456b15){while(--_0x456b15){_0x56fcfb['push'](_0x56fcfb['shift']());}};_0x3b868c(++_0x1e3df7);}(_0x9c63,0x1a7));var _0x39c6=function(_0x46c242,_0x2ae607){_0x46c242=_0x46c242-0x0;var _0x1d6cc6=_0x9c63[_0x46c242];return _0x1d6cc6;};'use strict';var _=require(_0x39c6('0x0'));var util=require(_0x39c6('0x1'));var moment=require(_0x39c6('0x2'));var BPromise=require(_0x39c6('0x3'));var rs=require(_0x39c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39c6('0x5'))['db'];var utils=require(_0x39c6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x39c6('0x7'));var jayson=require(_0x39c6('0x8'));var client=jayson[_0x39c6('0x9')][_0x39c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x435078,_0x27d474,_0x48e68f){return new BPromise(function(_0x364ad5,_0x1c8bdd){return client[_0x39c6('0xb')](_0x435078,_0x48e68f)[_0x39c6('0xc')](function(_0x165817){logger['info'](_0x39c6('0xd'),_0x27d474,'request\x20sent');logger[_0x39c6('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x27d474,_0x39c6('0xf'),JSON[_0x39c6('0x10')](_0x165817));if(_0x165817[_0x39c6('0x11')]){if(_0x165817[_0x39c6('0x11')]['code']===0x1f4){logger[_0x39c6('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x27d474,_0x165817['error'][_0x39c6('0x12')]);return _0x1c8bdd(_0x165817[_0x39c6('0x11')][_0x39c6('0x12')]);}logger[_0x39c6('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x27d474,_0x165817[_0x39c6('0x11')]['message']);return _0x364ad5(_0x165817[_0x39c6('0x11')][_0x39c6('0x12')]);}else{logger[_0x39c6('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x27d474,'request\x20sent');_0x364ad5(_0x165817[_0x39c6('0x14')][_0x39c6('0x12')]);}})['catch'](function(_0x3556c0){logger[_0x39c6('0x11')](_0x39c6('0xd'),_0x27d474,_0x3556c0);_0x1c8bdd(_0x3556c0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 0a0b187..8fa57e5 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 _0x72b1=['delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','put','tracked','whatsapp'];(function(_0x5b67f1,_0x1b73b9){var _0x4a3dff=function(_0x57fc2a){while(--_0x57fc2a){_0x5b67f1['push'](_0x5b67f1['shift']());}};_0x4a3dff(++_0x1b73b9);}(_0x72b1,0x1c6));var _0x172b=function(_0x5c16d7,_0x13a968){_0x5c16d7=_0x5c16d7-0x0;var _0x2d33a2=_0x72b1[_0x5c16d7];return _0x2d33a2;};'use strict';var multer=require(_0x172b('0x0'));var util=require(_0x172b('0x1'));var path=require(_0x172b('0x2'));var timeout=require(_0x172b('0x3'));var express=require(_0x172b('0x4'));var router=express['Router']();var fs_extra=require(_0x172b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x172b('0x6'));var config=require(_0x172b('0x7'));var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x172b('0x9')](_0x172b('0xa'),auth[_0x172b('0xb')](),controller[_0x172b('0xc')]);router[_0x172b('0x9')](_0x172b('0xd'),auth[_0x172b('0xb')](),controller[_0x172b('0xe')]);router[_0x172b('0x9')](_0x172b('0xf'),auth[_0x172b('0xb')](),controller[_0x172b('0x10')]);router[_0x172b('0x9')](_0x172b('0x11'),auth[_0x172b('0xb')](),controller['download']);router[_0x172b('0x12')]('/',auth['isAuthenticated'](),controller[_0x172b('0x13')]);router[_0x172b('0x12')]('/:id/messages',auth[_0x172b('0xb')](),controller[_0x172b('0x14')]);router['post'](_0x172b('0x15'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x172b('0x16')),controller['addTags']);router[_0x172b('0x17')](_0x172b('0xd'),auth[_0x172b('0xb')](),interaction[_0x172b('0x18')](_0x172b('0x19'),'whatsappinteraction:update'),controller['update']);router[_0x172b('0x1a')](_0x172b('0xd'),auth[_0x172b('0xb')](),interaction[_0x172b('0x18')](_0x172b('0x19'),_0x172b('0x1b')),controller[_0x172b('0x1c')]);router['delete'](_0x172b('0x15'),auth[_0x172b('0xb')](),controller[_0x172b('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xe166=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','/:id','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer'];(function(_0x3a7c38,_0x3e30cb){var _0x31b925=function(_0x104ba3){while(--_0x104ba3){_0x3a7c38['push'](_0x3a7c38['shift']());}};_0x31b925(++_0x3e30cb);}(_0xe166,0x83));var _0x6e16=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xe166[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x6e16('0x0'));var util=require(_0x6e16('0x1'));var path=require('path');var timeout=require(_0x6e16('0x2'));var express=require(_0x6e16('0x3'));var router=express['Router']();var fs_extra=require(_0x6e16('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6e16('0x5'));var config=require(_0x6e16('0x6'));var controller=require(_0x6e16('0x7'));router[_0x6e16('0x8')]('/',auth[_0x6e16('0x9')](),controller[_0x6e16('0xa')]);router['get'](_0x6e16('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6e16('0x8')]('/:id',auth[_0x6e16('0x9')](),controller[_0x6e16('0xc')]);router[_0x6e16('0x8')](_0x6e16('0xd'),auth[_0x6e16('0x9')](),controller[_0x6e16('0xe')]);router[_0x6e16('0x8')](_0x6e16('0xf'),auth[_0x6e16('0x9')](),controller[_0x6e16('0x10')]);router[_0x6e16('0x11')]('/',auth[_0x6e16('0x9')](),controller[_0x6e16('0x12')]);router[_0x6e16('0x11')](_0x6e16('0xd'),auth['isAuthenticated'](),controller[_0x6e16('0x13')]);router[_0x6e16('0x11')](_0x6e16('0x14'),auth[_0x6e16('0x9')](),interaction[_0x6e16('0x15')](_0x6e16('0x16'),_0x6e16('0x17')),controller['addTags']);router[_0x6e16('0x18')]('/:id',auth[_0x6e16('0x9')](),interaction[_0x6e16('0x15')]('whatsapp',_0x6e16('0x19')),controller[_0x6e16('0x1a')]);router['delete'](_0x6e16('0x1b'),auth[_0x6e16('0x9')](),interaction[_0x6e16('0x15')](_0x6e16('0x16'),_0x6e16('0x1c')),controller[_0x6e16('0x1d')]);router[_0x6e16('0x1e')](_0x6e16('0x14'),auth[_0x6e16('0x9')](),controller[_0x6e16('0x1f')]);module[_0x6e16('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index a386671..774e6ea 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 _0x8747=['STRING','out','ENUM','sequelize','exports','DATE'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x8747,0xab));var _0x7874=function(_0x3c2d87,_0x623ad){_0x3c2d87=_0x3c2d87-0x0;var _0x142d3c=_0x8747[_0x3c2d87];return _0x142d3c;};'use strict';var Sequelize=require(_0x7874('0x0'));var moment=require('moment');module[_0x7874('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7874('0x2')]},'disposition':{'type':Sequelize[_0x7874('0x3')]},'secondDisposition':{'type':Sequelize[_0x7874('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7874('0x3')]},'note':{'type':Sequelize[_0x7874('0x3')]},'phone':{'type':Sequelize[_0x7874('0x3')]},'read1stAt':{'type':Sequelize[_0x7874('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7874('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7874('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x7874('0x5')]('in',_0x7874('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x689b=['BOOLEAN','DATE','STRING','out','sequelize','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x689b,0xeb));var _0xb689=function(_0x3f51cf,_0xb64b7b){_0x3f51cf=_0x3f51cf-0x0;var _0x4564a2=_0x689b[_0x3f51cf];return _0x4564a2;};'use strict';var Sequelize=require(_0xb689('0x0'));var moment=require(_0xb689('0x1'));module[_0xb689('0x2')]={'closed':{'type':Sequelize[_0xb689('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb689('0x4')]},'disposition':{'type':Sequelize[_0xb689('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb689('0x5')]},'phone':{'type':Sequelize[_0xb689('0x5')]},'read1stAt':{'type':Sequelize[_0xb689('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb689('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb689('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('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 a112fae..b151607 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 _0x0746=['save','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','WhatsappInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','then','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','catch','show','includeAll','include','options','create','update','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','whatsappInteractionTags:save','removeTags','unix','join','root','files','attachments','transcript-%d-%s.zip','User','CmContact','Attachment','Messages','secret','Account','get','mkdirSync','Owner','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','direction','renderFile','views','downloadInteraction.html','transcript-','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject'];(function(_0x4f6044,_0x9c627b){var _0x12211d=function(_0x1fe5df){while(--_0x1fe5df){_0x4f6044['push'](_0x4f6044['shift']());}};_0x12211d(++_0x9c627b);}(_0x0746,0x1c2));var _0x6074=function(_0x1a0d75,_0xc3143a){_0x1a0d75=_0x1a0d75-0x0;var _0x4efa9e=_0x0746[_0x1a0d75];return _0x4efa9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6074('0x0'));var zipdir=require(_0x6074('0x1'));var jsonpatch=require(_0x6074('0x2'));var rp=require('request-promise');var moment=require(_0x6074('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6074('0x4'));var util=require(_0x6074('0x5'));var path=require('path');var sox=require(_0x6074('0x6'));var csv=require(_0x6074('0x7'));var ejs=require(_0x6074('0x8'));var fs=require('fs');var fs_extra=require(_0x6074('0x9'));var _=require(_0x6074('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6074('0xb'));var deskjs=require(_0x6074('0xc'));var toCsv=require(_0x6074('0x7'));var querystring=require(_0x6074('0xd'));var Papa=require(_0x6074('0xe'));var Redis=require(_0x6074('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6074('0x10'));var pdf=require(_0x6074('0x11'));var hardwareService=require(_0x6074('0x12'));var logger=require('../../config/logger')(_0x6074('0x13'));var utils=require(_0x6074('0x14'));var config=require(_0x6074('0x15'));var licenseUtil=require(_0x6074('0x16'));var db=require('../../mysqldb')['db'];config[_0x6074('0x17')]=_[_0x6074('0x18')](config['redis'],{'host':_0x6074('0x19'),'port':0x18eb});var socket=require(_0x6074('0x1a'))(new Redis(config[_0x6074('0x17')]));require(_0x6074('0x1b'))[_0x6074('0x1c')](socket);function respondWithStatusCode(_0x196bdb,_0x3aa4fe){_0x3aa4fe=_0x3aa4fe||0xcc;return function(_0x4d9513){if(_0x4d9513){return _0x196bdb[_0x6074('0x1d')](_0x3aa4fe);}return _0x196bdb[_0x6074('0x1e')](_0x3aa4fe)[_0x6074('0x1f')]();};}function respondWithResult(_0xbbb59c,_0x14862a){_0x14862a=_0x14862a||0xc8;return function(_0x4f2b16){if(_0x4f2b16){return _0xbbb59c[_0x6074('0x1e')](_0x14862a)[_0x6074('0x20')](_0x4f2b16);}};}function respondWithFilteredResult(_0x12e6e3,_0x10d7d8){return function(_0x5bed43){if(_0x5bed43){var _0x26852f=typeof _0x10d7d8['offset']===_0x6074('0x21')&&typeof _0x10d7d8['limit']===_0x6074('0x21');var _0x493c54=_0x5bed43[_0x6074('0x22')];var _0x210011=_0x26852f?0x0:_0x10d7d8[_0x6074('0x23')];var _0x5e40e2=_0x26852f?_0x5bed43[_0x6074('0x22')]:_0x10d7d8[_0x6074('0x23')]+_0x10d7d8[_0x6074('0x24')];var _0x132ef0;if(_0x5e40e2>=_0x493c54){_0x5e40e2=_0x493c54;_0x132ef0=0xc8;}else{_0x132ef0=0xce;}_0x12e6e3['status'](_0x132ef0);return _0x12e6e3['set'](_0x6074('0x25'),_0x210011+'-'+_0x5e40e2+'/'+_0x493c54)[_0x6074('0x20')](_0x5bed43);}return null;};}function patchUpdates(_0x1ef22a){return function(_0xb34184){try{jsonpatch[_0x6074('0x26')](_0xb34184,_0x1ef22a,!![]);}catch(_0x3f0828){return BPromise[_0x6074('0x27')](_0x3f0828);}return _0xb34184[_0x6074('0x28')]();};}function saveUpdates(_0x3ba3c8,_0x479852){return function(_0x1280c2){if(_0x1280c2){return _0x1280c2['update'](_0x3ba3c8)['then'](function(_0x339087){return _0x339087;});}return null;};}function removeEntity(_0x2e06aa,_0x1ad167){return function(_0xa9218d){if(_0xa9218d){return _0xa9218d[_0x6074('0x29')]()['then'](function(){_0x2e06aa[_0x6074('0x1e')](0xcc)[_0x6074('0x1f')]();});}};}function handleEntityNotFound(_0x1cdff5,_0xdce56e){return function(_0x25cdfe){if(!_0x25cdfe){_0x1cdff5[_0x6074('0x1d')](0x194);}return _0x25cdfe;};}function handleError(_0x17c1f6,_0x3f4919){_0x3f4919=_0x3f4919||0x1f4;return function(_0x152fdd){logger[_0x6074('0x2a')](_0x152fdd[_0x6074('0x2b')]);if(_0x152fdd[_0x6074('0x2c')]){delete _0x152fdd[_0x6074('0x2c')];}_0x17c1f6['status'](_0x3f4919)[_0x6074('0x2d')](_0x152fdd);};}function getInteractionUsers(_0x108de1,_0x37388b){return new BPromise(function(_0x26d3cd,_0x331e8a){try{if(_0x37388b[_0x108de1['id']]){_0x108de1[_0x6074('0x2e')]=_[_0x6074('0x2f')](_0x37388b[_0x108de1['id']],function(_0x399671){return{'id':_0x399671['id'],'fullname':_0x399671[_0x6074('0x30')]};});}}catch(_0x410bd5){_0x331e8a(_0x410bd5);}_0x26d3cd(_0x108de1);});}function getInteractionTags(_0x3242b0,_0x46fa27){return new BPromise(function(_0x2c21db,_0x600d64){try{if(_0x3242b0[_0x6074('0x31')]){_0x3242b0['Tags']=[];_0x3242b0[_0x6074('0x31')][_0x6074('0x32')](',')[_0x6074('0x33')](function(_0x45c2e0){_0x3242b0[_0x6074('0x34')][_0x6074('0x35')](_0x46fa27[_0x45c2e0]);});}delete _0x3242b0['TagIds'];}catch(_0x3a882d){_0x600d64(_0x3a882d);}_0x2c21db(_0x3242b0);});}function updateWhatsappInteraction(_0x127a42,_0x2374d5,_0x4dc92e){return new BPromise(function(_0x36d562,_0x4d3040){return getInteractionUsers(_0x127a42,_0x4dc92e)['then'](function(_0x29eb57){return getInteractionTags(_0x29eb57,_0x2374d5);})['then'](function(_0x3298fe){_0x36d562(_0x3298fe);})['catch'](function(_0x1a8b94){_0x4d3040(_0x1a8b94);});});}exports['index']=function(_0x35463a,_0x5268ed){var _0x3f2135={},_0x3ac812={},_0x4b8757={'count':0x0,'rows':[]};var _0x3745dc=_['map'](db[_0x6074('0x36')][_0x6074('0x37')],function(_0x509c00){return{'name':_0x509c00['fieldName'],'type':_0x509c00[_0x6074('0x38')][_0x6074('0x39')]};});_0x3ac812[_0x6074('0x3a')]=_[_0x6074('0x2f')](_0x3745dc,'name');_0x3ac812['query']=_[_0x6074('0x3b')](_0x35463a[_0x6074('0x3c')]);_0x3ac812[_0x6074('0x3d')]=_[_0x6074('0x3e')](_0x3ac812['model'],_0x3ac812[_0x6074('0x3c')]);_0x3f2135['attributes']=_[_0x6074('0x3e')](_0x3ac812[_0x6074('0x3a')],qs['fields'](_0x35463a['query'][_0x6074('0x3f')]));_0x3f2135[_0x6074('0x40')]=_0x3f2135[_0x6074('0x40')][_0x6074('0x41')]?_0x3f2135['attributes']:_0x3ac812['model'];if(!_0x35463a[_0x6074('0x3c')][_0x6074('0x42')](_0x6074('0x43'))){_0x3f2135[_0x6074('0x24')]=qs[_0x6074('0x24')](_0x35463a[_0x6074('0x3c')][_0x6074('0x24')]);_0x3f2135[_0x6074('0x23')]=qs[_0x6074('0x23')](_0x35463a[_0x6074('0x3c')]['offset']);}_0x3f2135[_0x6074('0x44')]=qs[_0x6074('0x45')](_0x35463a['query']['sort']);_0x3f2135[_0x6074('0x46')]=qs[_0x6074('0x3d')](_[_0x6074('0x47')](_0x35463a[_0x6074('0x3c')],_0x3ac812[_0x6074('0x3d')]),_0x3745dc);var _0x29c93f=[];var _0x34d72f=squel[_0x6074('0x48')]()[_0x6074('0x49')]('id')[_0x6074('0x49')](_0x6074('0x2c'))['field'](_0x6074('0x4a'))[_0x6074('0x4b')](_0x6074('0x4c'));var _0x58c6a0=squel[_0x6074('0x48')]()['field'](_0x6074('0x4d'))[_0x6074('0x49')](_0x6074('0x4e'))[_0x6074('0x49')](_0x6074('0x4f'))[_0x6074('0x4b')](_0x6074('0x50'),'ui')[_0x6074('0x51')](_0x6074('0x52'),'u',_0x6074('0x53'));var _0x31ba04=squel['select']()[_0x6074('0x4b')](_0x6074('0x54'),'i')[_0x6074('0x51')](_0x6074('0x55'),'c',_0x6074('0x56'))[_0x6074('0x51')]('users','o',_0x6074('0x57'))[_0x6074('0x51')]('whatsapp_accounts','a',_0x6074('0x58'))[_0x6074('0x51')]('whatsapp_messages','me',_0x6074('0x59'))['left_join']('whatsapp_interaction_has_tags','it',_0x6074('0x5a'))['left_join']('tools_tags','t',_0x6074('0x5b'));var _0x338972=squel['expr']();var _0x47e8e5=[];var _0x4b4359=squel[_0x6074('0x5c')]();var _0x2fbdae;if(_0x35463a[_0x6074('0x3c')][_0x6074('0x5d')]){_0x2fbdae=as[_0x6074('0x5e')](_0x35463a[_0x6074('0x3c')][_0x6074('0x5d')]);var _0x572356=_0x2fbdae[_0x6074('0x5f')];for(var _0x2e42c4=0x0;_0x2e42c4<_0x2fbdae[_0x6074('0x60')][_0x6074('0x41')];_0x2e42c4++){var _0x1e4a7d=_0x2fbdae['conditions'][_0x2e42c4];var _0x183c46='i';var _0x33243c=_['find'](_0x3745dc,[_0x6074('0x2c'),_0x1e4a7d[_0x6074('0x49')]]);if(!_0x33243c){switch(_0x1e4a7d[_0x6074('0x49')]){case _0x6074('0x61'):if(_0x1e4a7d[_0x6074('0x62')]==0x1){_0x31ba04[_0x6074('0x63')]('`'+_0x1e4a7d['field']+'`\x20=\x200');}else{_0x31ba04[_0x6074('0x63')]('`'+_0x1e4a7d['field']+_0x6074('0x64'));}break;case _0x6074('0x65'):if(_0x1e4a7d[_0x6074('0x66')]===_0x6074('0x67')){if(_0x1e4a7d[_0x6074('0x62')][_0x6074('0x32')]('\x20')[_0x6074('0x41')]>0x1){_0x338972[_0x572356](_0x6074('0x68'),qs[_0x6074('0x69')](_0x1e4a7d[_0x6074('0x62')]),null);}else{var _0x3cc9af='%'+_0x1e4a7d[_0x6074('0x62')]+'%';_0x338972[_0x572356]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3cc9af,_0x3cc9af,_0x3cc9af);}}else{_0x33243c=_[_0x6074('0x6a')](_0x3745dc,[_0x6074('0x2c'),_0x6074('0x6b')]);_0x1e4a7d['field']=_0x6074('0x6b');_0x47889a=as['buildExpression'](_0x183c46,_0x33243c[_0x6074('0x38')],_0x1e4a7d);_0x338972[_0x572356](_0x47889a[_0x6074('0x6c')],_0x47889a[_0x6074('0x62')]['start'],_0x47889a[_0x6074('0x62')]['end']);}break;case _0x6074('0x6d'):var _0x4446eb=_0x1e4a7d[_0x6074('0x62')]['split'](',')['map'](function(_0x19d7cd){return Number(_0x19d7cd);});_0x4446eb[_0x6074('0x33')](function(_0x440add){_0x4b4359['or'](_0x6074('0x6e'),'%,'+_0x440add+',%');});_0x47e8e5=_[_0x6074('0x6f')](_0x47e8e5,_0x4446eb);break;case'User':if(_0x1e4a7d[_0x6074('0x66')]===_0x6074('0x67')){_0x338972[_0x572356](_0x6074('0x70'),'%'+_0x1e4a7d[_0x6074('0x62')]+'%',null);}else{_0x33243c=_[_0x6074('0x6a')](_0x3745dc,[_0x6074('0x2c'),'UserId']);_0x1e4a7d[_0x6074('0x49')]=_0x6074('0x71');_0x47889a=as[_0x6074('0x72')](_0x183c46,_0x33243c[_0x6074('0x38')],_0x1e4a7d);_0x338972[_0x572356](_0x47889a['text'],_0x47889a[_0x6074('0x62')][_0x6074('0x73')],_0x47889a[_0x6074('0x62')][_0x6074('0x1f')]);}break;case _0x6074('0x74'):_0x47889a=as['buildExpression']('me',null,_0x1e4a7d);_0x338972[_0x572356](_0x47889a[_0x6074('0x6c')],_0x47889a[_0x6074('0x62')]['start'],_0x47889a[_0x6074('0x62')]['end']);break;}}else{var _0x47889a=as['buildExpression'](_0x183c46,_0x33243c[_0x6074('0x38')],_0x1e4a7d);_0x338972[_0x572356](_0x47889a[_0x6074('0x6c')],_0x47889a[_0x6074('0x62')][_0x6074('0x73')],_0x47889a[_0x6074('0x62')]['end']);}}}else{var _0xdf1a6f=_(_0x35463a[_0x6074('0x3c')])[_0x6074('0x3b')]()[_0x6074('0x2f')](function(_0x1f0175){return _[_0x6074('0x75')](_0x3745dc,[_0x6074('0x2c'),_0x1f0175])?_0x1f0175:undefined;})[_0x6074('0x76')]()[_0x6074('0x62')]();if(!_['isEmpty'](_0xdf1a6f)){_0xdf1a6f[_0x6074('0x33')](function(_0x31e42d){if(_0x31e42d===_0x6074('0x77')){_0x31ba04['where'](_0x6074('0x78'),[][_0x6074('0x79')](_0x35463a['query'][_0x31e42d]));}else if(_0x31e42d===_0x6074('0x7a')){var _0x54acc2=JSON['parse'](_0x35463a[_0x6074('0x3c')][_0x31e42d])['$gte'];var _0x2a38b8=JSON[_0x6074('0x7b')](_0x35463a[_0x6074('0x3c')][_0x31e42d])['$lte'];_0x31ba04[_0x6074('0x46')](_0x6074('0x7c'),_0x54acc2,_0x2a38b8);}else{if(_0x35463a[_0x6074('0x3c')][_0x31e42d]===_0x6074('0x7d')){_0x31ba04[_0x6074('0x46')]('i.'+_0x31e42d+_0x6074('0x7e'));}else{_0x31ba04['where']('i.'+_0x31e42d+_0x6074('0x7f'),_0x35463a['query'][_0x31e42d]);}}});}if(_0x35463a[_0x6074('0x3c')]['read']){if(_0x35463a[_0x6074('0x3c')][_0x6074('0x80')]==0x1){_0x31ba04[_0x6074('0x63')](_0x6074('0x81'));}else{_0x31ba04[_0x6074('0x63')](_0x6074('0x82'));}}if(_0x35463a[_0x6074('0x3c')][_0x6074('0x83')]){_0x47e8e5=_[_0x6074('0x84')](_0x35463a[_0x6074('0x3c')][_0x6074('0x83')])?_0x35463a['query'][_0x6074('0x83')]:new Array(_0x35463a[_0x6074('0x3c')][_0x6074('0x83')]);_0x47e8e5[_0x6074('0x33')](function(_0x387989){_0x4b4359['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x387989+',%');});}if(_0x35463a[_0x6074('0x3c')]['filter']){var _0x2c74e9=_0x35463a[_0x6074('0x3c')][_0x6074('0x85')]['replace']('\x5c','\x5c\x5c')[_0x6074('0x86')](/'/g,'\x27\x27');if(qs[_0x6074('0x87')](_0x2c74e9)){_0x338972['or'](_0x6074('0x88'),_0x2c74e9+'%')['or'](_0x6074('0x89'),_0x2c74e9+'%');}else{_0x338972['or'](_0x6074('0x8a'),qs[_0x6074('0x69')](_0x2c74e9))['or'](_0x6074('0x8b'),_0x2c74e9+'%');}}}_0x31ba04[_0x6074('0x46')](_0x338972);_0x31ba04[_0x6074('0x8c')]('i.id');var _0x1ac6df={'type':db[_0x6074('0x8d')][_0x6074('0x8e')][_0x6074('0x8f')],'raw':!![]};var _0x5a095c=_0x31ba04[_0x6074('0x90')]();_0x5a095c[_0x6074('0x49')]('i.id');_0x5a095c[_0x6074('0x49')](_0x6074('0x91'),_0x6074('0x61'));if(_0x3f2135[_0x6074('0x44')]){_0x3f2135[_0x6074('0x44')][_0x6074('0x33')](function(_0x40ad47){var _0x4a42bc=_0x40ad47[0x0]===_0x6074('0x92')?_0x40ad47[0x0]:'i.'+_0x40ad47[0x0];_0x31ba04[_0x6074('0x44')](_0x4a42bc,_0x40ad47[0x1]===_0x6074('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x47e8e5)){_0x31ba04[_0x6074('0x63')](_0x4b4359);_0x5a095c[_0x6074('0x46')](_0x6074('0x94'),_0x47e8e5);}BPromise[_0x6074('0x95')]()[_0x6074('0x96')](function(){if(!_0x2fbdae){if(_0x35463a[_0x6074('0x3c')][_0x6074('0x77')])return;_0x5a095c[_0x6074('0x46')](_0x6074('0x97'));_0x31ba04[_0x6074('0x46')](_0x6074('0x97'));return;}if(_0x35463a[_0x6074('0x98')][_0x6074('0x99')]!==_0x6074('0x9a'))return;return _0x35463a['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x6074('0x96')](function(_0x3b67be){if(_[_0x6074('0x9b')](_0x3b67be)){_0x5a095c['where'](_0x6074('0x9c'));_0x31ba04['where'](_0x6074('0x9c'));}else{_0x5a095c['where'](_0x6074('0x78'),_[_0x6074('0x2f')](_0x3b67be,'id'));_0x31ba04[_0x6074('0x46')](_0x6074('0x78'),_['map'](_0x3b67be,'id'));}});})[_0x6074('0x96')](function(){if(_0x35463a[_0x6074('0x98')][_0x6074('0x99')]===_0x6074('0x9a')&&!_0x2fbdae&&!_0x35463a[_0x6074('0x3c')][_0x6074('0x77')])return[];return db['sequelize'][_0x6074('0x3c')](_0x5a095c[_0x6074('0x9d')](),_0x1ac6df);})[_0x6074('0x96')](function(_0x1c384f){_0x4b8757[_0x6074('0x22')]=_0x1c384f['length'];if(_0x4b8757[_0x6074('0x22')]===0x0)return[];return db[_0x6074('0x9e')][_0x6074('0x3c')](_0x34d72f[_0x6074('0x9d')](),_0x1ac6df)[_0x6074('0x96')](function(_0x5b1bbd){_0x29c93f=_[_0x6074('0x9f')](_0x5b1bbd,'id');_0x1ac6df=_[_0x6074('0xa0')](_0x1ac6df,{'model':db[_0x6074('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35463a[_0x6074('0x3c')]['fields']){_0x3f2135[_0x6074('0x40')]['forEach'](function(_0x571e0b){_0x31ba04['field']('i.'+_0x571e0b);});}else{_0x31ba04[_0x6074('0x49')](_0x6074('0x91'),_0x6074('0x61'));_0x31ba04[_0x6074('0x49')]('a.key',_0x6074('0xa1'));_0x31ba04[_0x6074('0x49')](_0x6074('0xa2'),_0x6074('0xa3'));_0x31ba04['field'](_0x6074('0xa4'),_0x6074('0x92'));_0x31ba04[_0x6074('0x49')]('i.*');_0x31ba04[_0x6074('0x49')](_0x6074('0xa5'),_0x6074('0xa6'));_0x31ba04[_0x6074('0x49')](_0x6074('0xa7'),_0x6074('0xa8'));_0x31ba04[_0x6074('0x49')](_0x6074('0xa9'),_0x6074('0xaa'));_0x31ba04[_0x6074('0x49')](_0x6074('0xab'),_0x6074('0xac'));_0x31ba04[_0x6074('0x49')](_0x6074('0xad'),_0x6074('0xae'));_0x31ba04['field'](_0x6074('0xaf'),_0x6074('0xb0'));_0x31ba04[_0x6074('0x49')](_0x6074('0xb1'),_0x6074('0xb2'));_0x31ba04['field'](_0x6074('0xb3'),'Owner.internal');_0x31ba04[_0x6074('0x49')](_0x6074('0xb4'),_0x6074('0x31'));}if(_0x3f2135[_0x6074('0x24')])_0x31ba04[_0x6074('0x24')](_0x3f2135[_0x6074('0x24')]);if(_0x3f2135['offset'])_0x31ba04[_0x6074('0x23')](_0x3f2135[_0x6074('0x23')]);return db[_0x6074('0x9e')][_0x6074('0x3c')](_0x31ba04[_0x6074('0x9d')](),_0x1ac6df);})[_0x6074('0x96')](function(_0x224654){if(_0x224654[_0x6074('0x41')]>0x0)_0x58c6a0['where'](_0x6074('0xb5'),_[_0x6074('0x2f')](_0x224654,'id'));return db[_0x6074('0x9e')][_0x6074('0x3c')](_0x58c6a0['toString'](),_0x1ac6df)[_0x6074('0x96')](function(_0x3206a2){var _0x125118=_['groupBy'](_0x3206a2,'WhatsappInteractionId');var _0xb2138c=[];_0x224654[_0x6074('0x33')](function(_0x2ff83e){_0xb2138c['push'](updateWhatsappInteraction(_0x2ff83e,_0x29c93f,_0x125118));});return BPromise['all'](_0xb2138c);});});})[_0x6074('0x96')](function(_0x2f3e58){_0x4b8757['rows']=_0x2f3e58;return _0x4b8757;})[_0x6074('0x96')](respondWithFilteredResult(_0x5268ed,_0x3f2135))[_0x6074('0xb6')](handleError(_0x5268ed,null));};exports[_0x6074('0xb7')]=function(_0x23bb8c,_0x466252){var _0x170124={'raw':![],'where':{'id':_0x23bb8c['params']['id']}},_0xd66fdc={};_0xd66fdc[_0x6074('0x3a')]=_[_0x6074('0x3b')](db[_0x6074('0x36')][_0x6074('0x37')]);_0xd66fdc['query']=_['keys'](_0x23bb8c['query']);_0xd66fdc['filters']=_['intersection'](_0xd66fdc[_0x6074('0x3a')],_0xd66fdc[_0x6074('0x3c')]);_0x170124[_0x6074('0x40')]=_[_0x6074('0x3e')](_0xd66fdc[_0x6074('0x3a')],qs['fields'](_0x23bb8c[_0x6074('0x3c')][_0x6074('0x3f')]));_0x170124['attributes']=_0x170124[_0x6074('0x40')][_0x6074('0x41')]?_0x170124[_0x6074('0x40')]:_0xd66fdc[_0x6074('0x3a')];if(_0x23bb8c[_0x6074('0x3c')][_0x6074('0xb8')]){_0x170124[_0x6074('0xb9')]=[{'all':!![]}];}_0x170124=_['merge']({},_0x170124,_0x23bb8c[_0x6074('0xba')]);return db[_0x6074('0x36')][_0x6074('0x6a')](_0x170124)['then'](handleEntityNotFound(_0x466252,null))[_0x6074('0x96')](respondWithResult(_0x466252,null))[_0x6074('0xb6')](handleError(_0x466252,null));};exports[_0x6074('0xbb')]=function(_0x7a77fd,_0x3937a6){return db[_0x6074('0x36')][_0x6074('0xbb')](_0x7a77fd[_0x6074('0x74')],{})[_0x6074('0x96')](respondWithResult(_0x3937a6,0xc9))[_0x6074('0xb6')](handleError(_0x3937a6,null));};exports[_0x6074('0xbc')]=function(_0x1c1225,_0x2e5503){if(_0x1c1225[_0x6074('0x74')]['id']){delete _0x1c1225[_0x6074('0x74')]['id'];}return db[_0x6074('0x36')][_0x6074('0x6a')]({'where':{'id':_0x1c1225[_0x6074('0xbd')]['id']}})[_0x6074('0x96')](handleEntityNotFound(_0x2e5503,null))[_0x6074('0x96')](saveUpdates(_0x1c1225[_0x6074('0x74')],null))['then'](respondWithResult(_0x2e5503,null))[_0x6074('0xb6')](handleError(_0x2e5503,null));};exports[_0x6074('0x29')]=function(_0x3c0e68,_0x4833bd){return db[_0x6074('0x36')][_0x6074('0x6a')]({'where':{'id':_0x3c0e68[_0x6074('0xbd')]['id']}})[_0x6074('0x96')](handleEntityNotFound(_0x4833bd,null))[_0x6074('0x96')](removeEntity(_0x4833bd,null))[_0x6074('0xb6')](handleError(_0x4833bd,null));};exports[_0x6074('0xbe')]=function(_0x313197,_0x22ec4b){return db[_0x6074('0x36')][_0x6074('0xbe')]()[_0x6074('0x96')](respondWithResult(_0x22ec4b,null))[_0x6074('0xb6')](handleError(_0x22ec4b,null));};exports[_0x6074('0xbf')]=function(_0x5db381,_0x4d3b9a,_0x19699b){return db[_0x6074('0xc0')][_0x6074('0x6a')]({'where':{'id':_0x5db381[_0x6074('0xbd')]['id']}})['then'](handleEntityNotFound(_0x4d3b9a,null))[_0x6074('0x96')](function(_0x401fe1){if(_0x401fe1){return _0x401fe1['addMessage'](_0x5db381[_0x6074('0x74')][_0x6074('0xc1')],_[_0x6074('0xc2')](_0x5db381[_0x6074('0x74')],[_0x6074('0xc1'),'id'])||{});}})[_0x6074('0x96')](respondWithResult(_0x4d3b9a,null))[_0x6074('0xb6')](handleError(_0x4d3b9a,null));};exports[_0x6074('0xc3')]=function(_0x5874f2,_0xf90278,_0x1319f4){var _0x71dbd0={'raw':![],'where':{}};var _0xf5fa57={};var _0x51bc8d={'count':0x0,'rows':[]};return db[_0x6074('0x36')][_0x6074('0xc4')]({'where':{'id':_0x5874f2['params']['id']}})[_0x6074('0x96')](handleEntityNotFound(_0xf90278,null))[_0x6074('0x96')](function(_0x49ddae){if(_0x49ddae){_0xf5fa57['model']=_[_0x6074('0x3b')](db[_0x6074('0xc0')][_0x6074('0x37')]);_0xf5fa57[_0x6074('0x3c')]=_[_0x6074('0x3b')](_0x5874f2[_0x6074('0x3c')]);_0xf5fa57[_0x6074('0x3d')]=_['intersection'](_0xf5fa57['model'],_0xf5fa57['query']);_0x71dbd0['attributes']=_['intersection'](_0xf5fa57[_0x6074('0x3a')],qs['fields'](_0x5874f2[_0x6074('0x3c')][_0x6074('0x3f')]));_0x71dbd0['attributes']=_0x71dbd0[_0x6074('0x40')]['length']?_0x71dbd0['attributes']:_0xf5fa57[_0x6074('0x3a')];if(!_0x5874f2[_0x6074('0x3c')]['hasOwnProperty'](_0x6074('0x43'))){_0x71dbd0['limit']=qs[_0x6074('0x24')](_0x5874f2[_0x6074('0x3c')][_0x6074('0x24')]);_0x71dbd0['offset']=qs[_0x6074('0x23')](_0x5874f2[_0x6074('0x3c')][_0x6074('0x23')]);}_0x71dbd0[_0x6074('0x44')]=qs[_0x6074('0x45')](_0x5874f2['query'][_0x6074('0x45')]);_0x71dbd0['where']=qs[_0x6074('0x3d')](_[_0x6074('0x47')](_0x5874f2[_0x6074('0x3c')],_0xf5fa57[_0x6074('0x3d')]));_0x71dbd0[_0x6074('0x46')][_0x6074('0xc5')]=_0x49ddae['id'];if(_0x5874f2[_0x6074('0x3c')][_0x6074('0x85')]){_0x71dbd0[_0x6074('0x46')]=_[_0x6074('0xa0')](_0x71dbd0[_0x6074('0x46')],{'$or':_[_0x6074('0x2f')](_0x71dbd0[_0x6074('0x40')],function(_0x4fbbeb){var _0x4fd724={};_0x4fd724[_0x4fbbeb]={'$like':'%'+_0x5874f2[_0x6074('0x3c')]['filter']+'%'};return _0x4fd724;})});}if(_0x5874f2[_0x6074('0x3c')][_0x6074('0xc6')]){var _0x43072e=_0x5874f2[_0x6074('0x3c')][_0x6074('0xc6')]['split'](',');var _0x4b0e5e={};_0x4b0e5e[_0x43072e[0x0]]={'$gte':moment(_0x43072e[0x1])[_0x6074('0xc7')](_0x6074('0xc8'))};_0x71dbd0[_0x6074('0x46')]=_[_0x6074('0xa0')](_0x71dbd0[_0x6074('0x46')],_0x4b0e5e);}_0x71dbd0=_['merge']({},_0x71dbd0,_0x5874f2[_0x6074('0xba')]);return db[_0x6074('0xc0')]['count']({'where':_0x71dbd0[_0x6074('0x46')]})['then'](function(_0x1962e5){_0x51bc8d[_0x6074('0x22')]=_0x1962e5;if(_0x5874f2[_0x6074('0x3c')][_0x6074('0xb8')]){_0x71dbd0[_0x6074('0xb9')]=[{'all':!![]}];}return db[_0x6074('0xc0')][_0x6074('0xc9')](_0x71dbd0);})[_0x6074('0x96')](function(_0xba2e2f){_0x51bc8d[_0x6074('0xca')]=_0xba2e2f;return _0x51bc8d;});}})[_0x6074('0x96')](respondWithFilteredResult(_0xf90278,_0x71dbd0))[_0x6074('0xb6')](handleError(_0xf90278,null));};exports[_0x6074('0xcb')]=function(_0x34ea78,_0x12151d,_0x804824){return db['WhatsappInteraction'][_0x6074('0x6a')]({'where':{'id':_0x34ea78[_0x6074('0xbd')]['id']}})[_0x6074('0x96')](handleEntityNotFound(_0x12151d,null))[_0x6074('0x96')](function(_0x221621){if(_0x221621){return _0x221621[_0x6074('0xcc')](_0x34ea78[_0x6074('0x74')][_0x6074('0xc1')],_[_0x6074('0xc2')](_0x34ea78[_0x6074('0x74')],[_0x6074('0xc1'),'id'])||{})[_0x6074('0xcd')](function(){return db[_0x6074('0x6d')][_0x6074('0xc9')]({'attributes':['id',_0x6074('0x2c'),_0x6074('0x4a')],'where':{'id':_0x34ea78['body'][_0x6074('0xc1')]}});})[_0x6074('0x96')](function(_0x33241c){socket['emit'](_0x6074('0xce'),{'id':Number(_0x34ea78[_0x6074('0xbd')]['id']),'tags':_0x33241c||[]});return{'id':Number(_0x34ea78['params']['id']),'tags':_0x33241c||[]};});}})[_0x6074('0x96')](respondWithResult(_0x12151d,null))[_0x6074('0xb6')](handleError(_0x12151d,null));};exports[_0x6074('0xcf')]=function(_0x43983d,_0x4fa8fc,_0x5d2fc5){return db[_0x6074('0x36')]['find']({'where':{'id':_0x43983d['params']['id']}})[_0x6074('0x96')](handleEntityNotFound(_0x4fa8fc,null))[_0x6074('0x96')](function(_0x2af051){if(_0x2af051){return _0x2af051[_0x6074('0xcf')](_0x43983d[_0x6074('0x3c')][_0x6074('0xc1')]);}})[_0x6074('0x96')](respondWithStatusCode(_0x4fa8fc,null))[_0x6074('0xb6')](handleError(_0x4fa8fc,null));};exports['download']=function(_0x41dbbf,_0xea53af){var _0x1e5714=moment()[_0x6074('0xd0')]()[_0x6074('0x9d')]();var _0x13f8d5=path[_0x6074('0xd1')](config[_0x6074('0xd2')],'server',_0x6074('0xd3'),'tmp');var _0x16a01a=path['join'](config['root'],'server',_0x6074('0xd3'),_0x6074('0xd4'));var _0x224d49=path[_0x6074('0xd1')](_0x13f8d5,_0x1e5714);var _0x53b9b8=util['format'](_0x6074('0xd5'),_0x41dbbf['params']['id'],_0x1e5714);var _0x5966cc=path[_0x6074('0xd1')](_0x13f8d5,_0x53b9b8);var _0x5dec1c=[];_0x5dec1c['push']({'model':db[_0x6074('0xd6')],'as':_0x6074('0xd6'),'attributes':['id',_0x6074('0x30')],'raw':!![]});_0x5dec1c[_0x6074('0x35')]({'model':db[_0x6074('0xd7')],'as':_0x6074('0x65'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x41dbbf[_0x6074('0x3c')][_0x6074('0xd4')]){_0x5dec1c['push']({'model':db[_0x6074('0xd8')],'as':'Attachment','raw':!![]});}var _0x426460=[{'model':db[_0x6074('0xc0')],'as':_0x6074('0xd9'),'attributes':['id',_0x6074('0x74'),_0x6074('0x7a'),'direction',_0x6074('0xda'),_0x6074('0x80')],'include':_0x5dec1c}];_0x426460[_0x6074('0x35')]({'model':db['WhatsappAccount'],'as':_0x6074('0xdb'),'attributes':['id',_0x6074('0x2c')]});_0x426460[_0x6074('0x35')]({'model':db[_0x6074('0xd6')],'as':'Owner','attributes':['id',_0x6074('0x30')]});return db[_0x6074('0x36')][_0x6074('0x6a')]({'where':{'id':_0x41dbbf[_0x6074('0xbd')]['id']},'include':_0x426460})[_0x6074('0x96')](handleEntityNotFound(_0xea53af,null))[_0x6074('0x96')](function(_0x2be6d4){if(_0x2be6d4){var _0x27a6ae=_0x2be6d4[_0x6074('0xdc')]({'plain':!![]});fs[_0x6074('0xdd')](_0x224d49);var _0x537b92={'channel':'Whatsapp','account':_0x27a6ae['Account'][_0x6074('0x2c')],'agent':_0x27a6ae[_0x6074('0xde')]?_0x27a6ae[_0x6074('0xde')]['fullname']:'N.A.','createdAt':moment(_0x27a6ae[_0x6074('0x7a')])[_0x6074('0xc7')](_0x6074('0xc8'))[_0x6074('0x9d')](),'closedAt':_0x27a6ae[_0x6074('0xdf')]?moment(_0x27a6ae[_0x6074('0xe0')])['format'](_0x6074('0xc8'))[_0x6074('0x9d')]():'','disposition':_0x27a6ae[_0x6074('0xe1')],'messages':_(_0x27a6ae['Messages'])[_0x6074('0x85')]({'secret':![]})['map'](function(_0x103e20){if(_0x103e20[_0x6074('0xd8')]){var _0x355828=path[_0x6074('0xd1')](_0x16a01a,_0x103e20[_0x6074('0xd8')][_0x6074('0xe2')]);if(fs[_0x6074('0xe3')](_0x355828)){fs[_0x6074('0xe4')](_0x355828)[_0x6074('0xe5')](fs[_0x6074('0xe6')](path[_0x6074('0xd1')](_0x224d49,_0x103e20[_0x6074('0xd8')][_0x6074('0xe2')])));}}return{'date':moment(_0x103e20[_0x6074('0x7a')])[_0x6074('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6074('0x9d')](),'sender':_0x103e20['direction']===_0x6074('0xe7')?_0x103e20[_0x6074('0xd6')]?_0x103e20[_0x6074('0xd6')][_0x6074('0x30')]:_0x6074('0xe8'):_0x103e20['Contact'][_0x6074('0xe9')]+(_0x103e20[_0x6074('0x65')][_0x6074('0xea')]?'\x20'+_0x103e20['Contact']['lastName']:''),'body':_0x103e20[_0x6074('0xd8')]?_0x103e20[_0x6074('0xd8')][_0x6074('0xe2')]:_0x103e20[_0x6074('0x74')],'direction':_0x103e20[_0x6074('0xeb')]===_0x6074('0xe7')?'A':'C','secret':_0x103e20[_0x6074('0xda')],'read':_0x103e20[_0x6074('0x80')],'attachment':_0x103e20[_0x6074('0xd8')]};})[_0x6074('0x62')]()};return ejs[_0x6074('0xec')](path[_0x6074('0xd1')](config['root'],'server',_0x6074('0xed'),_0x6074('0xee')),{'interaction':_0x537b92})[_0x6074('0x96')](function(_0x1ad996){var _0x307364=path[_0x6074('0xd1')](_0x224d49,_0x6074('0xef')+_0x27a6ae['id']+'-'+_0x1e5714+_0x6074('0xf0'));var _0x234e03={'path':_0x307364,'channel':'Whatsapp','interactionId':_0x27a6ae['id']};return pdf['createPdfFromHTML'](_0x1ad996,_0x234e03);})[_0x6074('0x96')](function(){return new BPromise(function(_0x53f20a,_0x4f5a5b){zipdir(_0x224d49,{'saveTo':_0x5966cc},function(_0x80d712,_0x47101b){if(_0x80d712)return _0x4f5a5b(_0x80d712);return _0x53f20a(_0x47101b);});})[_0x6074('0x96')](function(){return new BPromise(function(_0x467994,_0x18922d){rimraf(_0x224d49,function(_0x294fdc){if(_0x294fdc)_0x18922d(_0x294fdc);return _0x467994();});});})[_0x6074('0x96')](function(){return _0xea53af[_0x6074('0xf1')](_0x5966cc,_0x53b9b8,function(_0x3e08e0){if(_0x3e08e0){console[_0x6074('0xf2')](_0x6074('0xf3'),_0x3e08e0);}else{fs[_0x6074('0xf4')](_0x5966cc);}});});});}else{return _0xea53af[_0x6074('0x1d')](0xc8);}})[_0x6074('0xb6')](handleError(_0xea53af,null));}; \ No newline at end of file +var _0x5f32=['model','query','keys','filters','intersection','attributes','length','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type','start','body','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','WhatsappInteraction','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','catch','show','includeAll','include','options','create','describe','addMessage','WhatsappMessage','params','getMessages','findOne','hasOwnProperty','pick','filter','format','YYYY-MM-DD\x20HH:mm:ss','setTags','ids','omit','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','closed','closedAt','disposition','basename','createReadStream','pipe','out','System','renderFile','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','then','destroy','stack','name','send','Users','TagIds','Tags','split','push','index','map','rawAttributes','fieldName','key'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f32,0x1ad));var _0x25f3=function(_0x6d0a22,_0x55d6c4){_0x6d0a22=_0x6d0a22-0x0;var _0x4c1e70=_0x5f32[_0x6d0a22];return _0x4c1e70;};'use strict';var emlformat=require(_0x25f3('0x0'));var rimraf=require(_0x25f3('0x1'));var zipdir=require(_0x25f3('0x2'));var jsonpatch=require(_0x25f3('0x3'));var rp=require(_0x25f3('0x4'));var moment=require(_0x25f3('0x5'));var BPromise=require(_0x25f3('0x6'));var Mustache=require(_0x25f3('0x7'));var util=require(_0x25f3('0x8'));var path=require('path');var sox=require(_0x25f3('0x9'));var csv=require(_0x25f3('0xa'));var ejs=require(_0x25f3('0xb'));var fs=require('fs');var fs_extra=require(_0x25f3('0xc'));var _=require(_0x25f3('0xd'));var squel=require(_0x25f3('0xe'));var crypto=require(_0x25f3('0xf'));var jsforce=require(_0x25f3('0x10'));var deskjs=require(_0x25f3('0x11'));var toCsv=require(_0x25f3('0xa'));var querystring=require(_0x25f3('0x12'));var Papa=require(_0x25f3('0x13'));var Redis=require(_0x25f3('0x14'));var authService=require(_0x25f3('0x15'));var qs=require(_0x25f3('0x16'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x25f3('0x17'))('api');var utils=require(_0x25f3('0x18'));var config=require(_0x25f3('0x19'));var licenseUtil=require(_0x25f3('0x1a'));var db=require(_0x25f3('0x1b'))['db'];config[_0x25f3('0x1c')]=_[_0x25f3('0x1d')](config[_0x25f3('0x1c')],{'host':_0x25f3('0x1e'),'port':0x18eb});var socket=require(_0x25f3('0x1f'))(new Redis(config['redis']));require(_0x25f3('0x20'))[_0x25f3('0x21')](socket);function respondWithStatusCode(_0x27e6c6,_0x45d41f){_0x45d41f=_0x45d41f||0xcc;return function(_0x4ae693){if(_0x4ae693){return _0x27e6c6[_0x25f3('0x22')](_0x45d41f);}return _0x27e6c6['status'](_0x45d41f)[_0x25f3('0x23')]();};}function respondWithResult(_0x14f7ee,_0x3e8ae0){_0x3e8ae0=_0x3e8ae0||0xc8;return function(_0x2ea157){if(_0x2ea157){return _0x14f7ee[_0x25f3('0x24')](_0x3e8ae0)['json'](_0x2ea157);}};}function respondWithFilteredResult(_0x74c02,_0x24529b){return function(_0x4ef2bc){if(_0x4ef2bc){var _0x5b1711=typeof _0x24529b[_0x25f3('0x25')]===_0x25f3('0x26')&&typeof _0x24529b[_0x25f3('0x27')]===_0x25f3('0x26');var _0x1ddc59=_0x4ef2bc[_0x25f3('0x28')];var _0x5e80df=_0x5b1711?0x0:_0x24529b[_0x25f3('0x25')];var _0x3725c0=_0x5b1711?_0x4ef2bc[_0x25f3('0x28')]:_0x24529b['offset']+_0x24529b[_0x25f3('0x27')];var _0x36d5cf;if(_0x3725c0>=_0x1ddc59){_0x3725c0=_0x1ddc59;_0x36d5cf=0xc8;}else{_0x36d5cf=0xce;}_0x74c02[_0x25f3('0x24')](_0x36d5cf);return _0x74c02[_0x25f3('0x29')]('Content-Range',_0x5e80df+'-'+_0x3725c0+'/'+_0x1ddc59)[_0x25f3('0x2a')](_0x4ef2bc);}return null;};}function patchUpdates(_0x288e4d){return function(_0x460fb5){try{jsonpatch[_0x25f3('0x2b')](_0x460fb5,_0x288e4d,!![]);}catch(_0x3ea448){return BPromise['reject'](_0x3ea448);}return _0x460fb5['save']();};}function saveUpdates(_0x3cacb1,_0x567dd0){return function(_0x50e936){if(_0x50e936){return _0x50e936['update'](_0x3cacb1)[_0x25f3('0x2c')](function(_0x4a9b5c){return _0x4a9b5c;});}return null;};}function removeEntity(_0x4b63e6,_0x2e58b1){return function(_0x3be301){if(_0x3be301){return _0x3be301[_0x25f3('0x2d')]()[_0x25f3('0x2c')](function(){_0x4b63e6[_0x25f3('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2118da,_0x2e434b){return function(_0x3009b7){if(!_0x3009b7){_0x2118da['sendStatus'](0x194);}return _0x3009b7;};}function handleError(_0x527eaf,_0x57c8da){_0x57c8da=_0x57c8da||0x1f4;return function(_0x1372b3){logger['error'](_0x1372b3[_0x25f3('0x2e')]);if(_0x1372b3[_0x25f3('0x2f')]){delete _0x1372b3[_0x25f3('0x2f')];}_0x527eaf[_0x25f3('0x24')](_0x57c8da)[_0x25f3('0x30')](_0x1372b3);};}function getInteractionUsers(_0x158298,_0x6497bd){return new BPromise(function(_0x3b8492,_0x3e421d){try{if(_0x6497bd[_0x158298['id']]){_0x158298[_0x25f3('0x31')]=_['map'](_0x6497bd[_0x158298['id']],function(_0x480753){return{'id':_0x480753['id'],'fullname':_0x480753['fullname']};});}}catch(_0x141fc5){_0x3e421d(_0x141fc5);}_0x3b8492(_0x158298);});}function getInteractionTags(_0x19bf9d,_0x198cdf){return new BPromise(function(_0x2e9aac,_0x13d746){try{if(_0x19bf9d[_0x25f3('0x32')]){_0x19bf9d[_0x25f3('0x33')]=[];_0x19bf9d[_0x25f3('0x32')][_0x25f3('0x34')](',')['forEach'](function(_0x3f85f5){_0x19bf9d[_0x25f3('0x33')][_0x25f3('0x35')](_0x198cdf[_0x3f85f5]);});}delete _0x19bf9d[_0x25f3('0x32')];}catch(_0x4923d4){_0x13d746(_0x4923d4);}_0x2e9aac(_0x19bf9d);});}function updateWhatsappInteraction(_0x3a6260,_0x33fd66,_0x48b436){return new BPromise(function(_0x3779ac,_0x2afb86){return getInteractionUsers(_0x3a6260,_0x48b436)[_0x25f3('0x2c')](function(_0x3c011c){return getInteractionTags(_0x3c011c,_0x33fd66);})['then'](function(_0x29d7fd){_0x3779ac(_0x29d7fd);})['catch'](function(_0x4ded8d){_0x2afb86(_0x4ded8d);});});}exports[_0x25f3('0x36')]=function(_0x128855,_0x22b2dc){var _0x40c217={},_0x1993ac={},_0x403f0e={'count':0x0,'rows':[]};var _0x1a5dcc=_[_0x25f3('0x37')](db['WhatsappInteraction'][_0x25f3('0x38')],function(_0x37fbd8){return{'name':_0x37fbd8[_0x25f3('0x39')],'type':_0x37fbd8['type'][_0x25f3('0x3a')]};});_0x1993ac[_0x25f3('0x3b')]=_['map'](_0x1a5dcc,'name');_0x1993ac[_0x25f3('0x3c')]=_[_0x25f3('0x3d')](_0x128855[_0x25f3('0x3c')]);_0x1993ac[_0x25f3('0x3e')]=_[_0x25f3('0x3f')](_0x1993ac[_0x25f3('0x3b')],_0x1993ac[_0x25f3('0x3c')]);_0x40c217[_0x25f3('0x40')]=_[_0x25f3('0x3f')](_0x1993ac[_0x25f3('0x3b')],qs['fields'](_0x128855[_0x25f3('0x3c')]['fields']));_0x40c217[_0x25f3('0x40')]=_0x40c217[_0x25f3('0x40')][_0x25f3('0x41')]?_0x40c217[_0x25f3('0x40')]:_0x1993ac[_0x25f3('0x3b')];if(!_0x128855[_0x25f3('0x3c')]['hasOwnProperty']('nolimit')){_0x40c217[_0x25f3('0x27')]=qs[_0x25f3('0x27')](_0x128855[_0x25f3('0x3c')][_0x25f3('0x27')]);_0x40c217[_0x25f3('0x25')]=qs[_0x25f3('0x25')](_0x128855[_0x25f3('0x3c')][_0x25f3('0x25')]);}_0x40c217[_0x25f3('0x42')]=qs[_0x25f3('0x43')](_0x128855[_0x25f3('0x3c')]['sort']);_0x40c217[_0x25f3('0x44')]=qs['filters'](_['pick'](_0x128855[_0x25f3('0x3c')],_0x1993ac[_0x25f3('0x3e')]),_0x1a5dcc);var _0x101e05=[];var _0x3ae134=squel[_0x25f3('0x45')]()['field']('id')['field'](_0x25f3('0x2f'))[_0x25f3('0x46')]('color')[_0x25f3('0x47')](_0x25f3('0x48'));var _0x4f738d=squel[_0x25f3('0x45')]()[_0x25f3('0x46')](_0x25f3('0x49'))['field'](_0x25f3('0x4a'))[_0x25f3('0x46')](_0x25f3('0x4b'))[_0x25f3('0x47')](_0x25f3('0x4c'),'ui')[_0x25f3('0x4d')](_0x25f3('0x4e'),'u',_0x25f3('0x4f'));var _0x55e69e=squel[_0x25f3('0x45')]()[_0x25f3('0x47')]('whatsapp_interactions','i')[_0x25f3('0x4d')](_0x25f3('0x50'),'c',_0x25f3('0x51'))[_0x25f3('0x4d')](_0x25f3('0x4e'),'o',_0x25f3('0x52'))[_0x25f3('0x4d')](_0x25f3('0x53'),'a',_0x25f3('0x54'))[_0x25f3('0x4d')]('whatsapp_messages','me',_0x25f3('0x55'))[_0x25f3('0x4d')](_0x25f3('0x56'),'it',_0x25f3('0x57'))[_0x25f3('0x4d')](_0x25f3('0x48'),'t',_0x25f3('0x58'));var _0x1a854e=squel['expr']();var _0x2b826b=[];var _0x1da426=squel[_0x25f3('0x59')]();var _0x3a112b;if(_0x128855[_0x25f3('0x3c')]['search']){_0x3a112b=as[_0x25f3('0x5a')](_0x128855[_0x25f3('0x3c')][_0x25f3('0x5b')]);var _0x51cf8b=_0x3a112b[_0x25f3('0x5c')];for(var _0x4aea48=0x0;_0x4aea48<_0x3a112b[_0x25f3('0x5d')][_0x25f3('0x41')];_0x4aea48++){var _0x2e2884=_0x3a112b[_0x25f3('0x5d')][_0x4aea48];var _0x16bb2e='i';var _0x326c57=_[_0x25f3('0x5e')](_0x1a5dcc,[_0x25f3('0x2f'),_0x2e2884['field']]);if(!_0x326c57){switch(_0x2e2884[_0x25f3('0x46')]){case _0x25f3('0x5f'):if(_0x2e2884['value']==0x1){_0x55e69e[_0x25f3('0x60')]('`'+_0x2e2884[_0x25f3('0x46')]+_0x25f3('0x61'));}else{_0x55e69e[_0x25f3('0x60')]('`'+_0x2e2884[_0x25f3('0x46')]+'`\x20>\x200');}break;case'Contact':if(_0x2e2884[_0x25f3('0x62')]===_0x25f3('0x63')){if(_0x2e2884['value'][_0x25f3('0x34')]('\x20')[_0x25f3('0x41')]>0x1){_0x1a854e[_0x51cf8b](_0x25f3('0x64'),qs['getFullTextValue'](_0x2e2884[_0x25f3('0x65')]),null);}else{var _0x229dfa='%'+_0x2e2884[_0x25f3('0x65')]+'%';_0x1a854e[_0x51cf8b](_0x25f3('0x66'),_0x229dfa,_0x229dfa,_0x229dfa);}}else{_0x326c57=_[_0x25f3('0x5e')](_0x1a5dcc,[_0x25f3('0x2f'),_0x25f3('0x67')]);_0x2e2884[_0x25f3('0x46')]=_0x25f3('0x67');_0x477702=as['buildExpression'](_0x16bb2e,_0x326c57['type'],_0x2e2884);_0x1a854e[_0x51cf8b](_0x477702[_0x25f3('0x68')],_0x477702[_0x25f3('0x65')]['start'],_0x477702['value'][_0x25f3('0x23')]);}break;case _0x25f3('0x69'):var _0x3d2e12=_0x2e2884[_0x25f3('0x65')][_0x25f3('0x34')](',')[_0x25f3('0x37')](function(_0x21ee41){return Number(_0x21ee41);});_0x3d2e12[_0x25f3('0x6a')](function(_0x184ec0){_0x1da426['or'](_0x25f3('0x6b'),'%,'+_0x184ec0+',%');});_0x2b826b=_['union'](_0x2b826b,_0x3d2e12);break;case _0x25f3('0x6c'):if(_0x2e2884[_0x25f3('0x62')]==='$substring'){_0x1a854e[_0x51cf8b](_0x25f3('0x6d'),'%'+_0x2e2884[_0x25f3('0x65')]+'%',null);}else{_0x326c57=_[_0x25f3('0x5e')](_0x1a5dcc,['name',_0x25f3('0x6e')]);_0x2e2884[_0x25f3('0x46')]=_0x25f3('0x6e');_0x477702=as[_0x25f3('0x6f')](_0x16bb2e,_0x326c57[_0x25f3('0x70')],_0x2e2884);_0x1a854e[_0x51cf8b](_0x477702[_0x25f3('0x68')],_0x477702['value'][_0x25f3('0x71')],_0x477702['value']['end']);}break;case _0x25f3('0x72'):_0x477702=as['buildExpression']('me',null,_0x2e2884);_0x1a854e[_0x51cf8b](_0x477702['text'],_0x477702[_0x25f3('0x65')][_0x25f3('0x71')],_0x477702[_0x25f3('0x65')][_0x25f3('0x23')]);break;}}else{var _0x477702=as[_0x25f3('0x6f')](_0x16bb2e,_0x326c57[_0x25f3('0x70')],_0x2e2884);_0x1a854e[_0x51cf8b](_0x477702[_0x25f3('0x68')],_0x477702['value'][_0x25f3('0x71')],_0x477702[_0x25f3('0x65')][_0x25f3('0x23')]);}}}else{var _0x4c5f76=_(_0x128855[_0x25f3('0x3c')])[_0x25f3('0x3d')]()['map'](function(_0xe62c19){return _[_0x25f3('0x73')](_0x1a5dcc,['name',_0xe62c19])?_0xe62c19:undefined;})['compact']()[_0x25f3('0x65')]();if(!_[_0x25f3('0x74')](_0x4c5f76)){_0x4c5f76[_0x25f3('0x6a')](function(_0x598175){if(_0x598175===_0x25f3('0x75')){_0x55e69e[_0x25f3('0x44')](_0x25f3('0x76'),[]['concat'](_0x128855[_0x25f3('0x3c')][_0x598175]));}else if(_0x598175==='createdAt'){var _0x28e9d0=JSON[_0x25f3('0x77')](_0x128855['query'][_0x598175])[_0x25f3('0x78')];var _0x4f7adc=JSON[_0x25f3('0x77')](_0x128855['query'][_0x598175])[_0x25f3('0x79')];_0x55e69e[_0x25f3('0x44')](_0x25f3('0x7a'),_0x28e9d0,_0x4f7adc);}else{if(_0x128855[_0x25f3('0x3c')][_0x598175]==='null'){_0x55e69e[_0x25f3('0x44')]('i.'+_0x598175+_0x25f3('0x7b'));}else{_0x55e69e[_0x25f3('0x44')]('i.'+_0x598175+_0x25f3('0x7c'),_0x128855[_0x25f3('0x3c')][_0x598175]);}}});}if(_0x128855[_0x25f3('0x3c')][_0x25f3('0x7d')]){if(_0x128855[_0x25f3('0x3c')][_0x25f3('0x7d')]==0x1){_0x55e69e[_0x25f3('0x60')]('`unreadMessages`\x20=\x200');}else{_0x55e69e[_0x25f3('0x60')](_0x25f3('0x7e'));}}if(_0x128855[_0x25f3('0x3c')][_0x25f3('0x7f')]){_0x2b826b=_[_0x25f3('0x80')](_0x128855[_0x25f3('0x3c')][_0x25f3('0x7f')])?_0x128855[_0x25f3('0x3c')][_0x25f3('0x7f')]:new Array(_0x128855[_0x25f3('0x3c')]['tag']);_0x2b826b[_0x25f3('0x6a')](function(_0x39c714){_0x1da426['or'](_0x25f3('0x6b'),'%,'+_0x39c714+',%');});}if(_0x128855['query']['filter']){var _0x1f4dd3=_0x128855['query']['filter'][_0x25f3('0x81')]('\x5c','\x5c\x5c')[_0x25f3('0x81')](/'/g,'\x27\x27');if(qs[_0x25f3('0x82')](_0x1f4dd3)){_0x1a854e['or'](_0x25f3('0x83'),_0x1f4dd3+'%')['or'](_0x25f3('0x84'),_0x1f4dd3+'%');}else{_0x1a854e['or'](_0x25f3('0x85'),qs[_0x25f3('0x86')](_0x1f4dd3))['or'](_0x25f3('0x87'),_0x1f4dd3+'%');}}}_0x55e69e[_0x25f3('0x44')](_0x1a854e);_0x55e69e['group'](_0x25f3('0x88'));var _0x3cb91f={'type':db['Sequelize'][_0x25f3('0x89')][_0x25f3('0x8a')],'raw':!![]};var _0x516565=_0x55e69e[_0x25f3('0x8b')]();_0x516565[_0x25f3('0x46')](_0x25f3('0x88'));_0x516565['field'](_0x25f3('0x8c'),_0x25f3('0x5f'));if(_0x40c217[_0x25f3('0x42')]){_0x40c217[_0x25f3('0x42')][_0x25f3('0x6a')](function(_0x14971c){var _0x25c0cc=_0x14971c[0x0]===_0x25f3('0x8d')?_0x14971c[0x0]:'i.'+_0x14971c[0x0];_0x55e69e[_0x25f3('0x42')](_0x25c0cc,_0x14971c[0x1]===_0x25f3('0x8e')?![]:!![]);});}if(!_[_0x25f3('0x74')](_0x2b826b)){_0x55e69e[_0x25f3('0x60')](_0x1da426);_0x516565['where']('t.id\x20IN\x20?',_0x2b826b);}BPromise[_0x25f3('0x8f')]()[_0x25f3('0x2c')](function(){if(!_0x3a112b){if(_0x128855[_0x25f3('0x3c')][_0x25f3('0x75')])return;_0x516565[_0x25f3('0x44')](_0x25f3('0x90'));_0x55e69e[_0x25f3('0x44')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x128855[_0x25f3('0x91')][_0x25f3('0x92')]!==_0x25f3('0x93'))return;return _0x128855[_0x25f3('0x91')][_0x25f3('0x94')]({'attributes':['id'],'raw':!![]})[_0x25f3('0x2c')](function(_0x443f23){if(_[_0x25f3('0x74')](_0x443f23)){_0x516565[_0x25f3('0x44')](_0x25f3('0x95'));_0x55e69e[_0x25f3('0x44')](_0x25f3('0x95'));}else{_0x516565[_0x25f3('0x44')](_0x25f3('0x76'),_[_0x25f3('0x37')](_0x443f23,'id'));_0x55e69e[_0x25f3('0x44')](_0x25f3('0x76'),_[_0x25f3('0x37')](_0x443f23,'id'));}});})[_0x25f3('0x2c')](function(){if(_0x128855[_0x25f3('0x91')]['role']===_0x25f3('0x93')&&!_0x3a112b&&!_0x128855[_0x25f3('0x3c')]['WhatsappAccountId'])return[];return db['sequelize'][_0x25f3('0x3c')](_0x516565[_0x25f3('0x96')](),_0x3cb91f);})[_0x25f3('0x2c')](function(_0x487ce9){_0x403f0e[_0x25f3('0x28')]=_0x487ce9[_0x25f3('0x41')];if(_0x403f0e['count']===0x0)return[];return db[_0x25f3('0x97')][_0x25f3('0x3c')](_0x3ae134[_0x25f3('0x96')](),_0x3cb91f)[_0x25f3('0x2c')](function(_0x3d281a){_0x101e05=_[_0x25f3('0x98')](_0x3d281a,'id');_0x3cb91f=_[_0x25f3('0x99')](_0x3cb91f,{'model':db[_0x25f3('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x128855['query'][_0x25f3('0x9b')]){_0x40c217[_0x25f3('0x40')][_0x25f3('0x6a')](function(_0x213954){_0x55e69e[_0x25f3('0x46')]('i.'+_0x213954);});}else{_0x55e69e['field'](_0x25f3('0x8c'),_0x25f3('0x5f'));_0x55e69e['field'](_0x25f3('0x9c'),_0x25f3('0x9d'));_0x55e69e[_0x25f3('0x46')](_0x25f3('0x9e'),_0x25f3('0x9f'));_0x55e69e['field'](_0x25f3('0xa0'),_0x25f3('0x8d'));_0x55e69e[_0x25f3('0x46')]('i.*');_0x55e69e[_0x25f3('0x46')](_0x25f3('0xa1'),_0x25f3('0xa2'));_0x55e69e[_0x25f3('0x46')](_0x25f3('0xa3'),_0x25f3('0xa4'));_0x55e69e[_0x25f3('0x46')](_0x25f3('0xa5'),_0x25f3('0xa6'));_0x55e69e[_0x25f3('0x46')]('c.phone',_0x25f3('0xa7'));_0x55e69e[_0x25f3('0x46')]('c.mobile',_0x25f3('0xa8'));_0x55e69e[_0x25f3('0x46')](_0x25f3('0xa9'),_0x25f3('0xaa'));_0x55e69e[_0x25f3('0x46')](_0x25f3('0xab'),_0x25f3('0xac'));_0x55e69e[_0x25f3('0x46')](_0x25f3('0xad'),'Owner.internal');_0x55e69e[_0x25f3('0x46')](_0x25f3('0xae'),_0x25f3('0x32'));}if(_0x40c217[_0x25f3('0x27')])_0x55e69e['limit'](_0x40c217['limit']);if(_0x40c217[_0x25f3('0x25')])_0x55e69e[_0x25f3('0x25')](_0x40c217['offset']);return db[_0x25f3('0x97')][_0x25f3('0x3c')](_0x55e69e['toString'](),_0x3cb91f);})[_0x25f3('0x2c')](function(_0x1aa723){if(_0x1aa723[_0x25f3('0x41')]>0x0)_0x4f738d['where'](_0x25f3('0xaf'),_[_0x25f3('0x37')](_0x1aa723,'id'));return db['sequelize'][_0x25f3('0x3c')](_0x4f738d[_0x25f3('0x96')](),_0x3cb91f)['then'](function(_0x32cbd5){var _0x325c60=_[_0x25f3('0xb0')](_0x32cbd5,'WhatsappInteractionId');var _0x2ae99d=[];_0x1aa723[_0x25f3('0x6a')](function(_0x38fee7){_0x2ae99d[_0x25f3('0x35')](updateWhatsappInteraction(_0x38fee7,_0x101e05,_0x325c60));});return BPromise[_0x25f3('0xb1')](_0x2ae99d);});});})[_0x25f3('0x2c')](function(_0x3d5785){_0x403f0e[_0x25f3('0xb2')]=_0x3d5785;return _0x403f0e;})[_0x25f3('0x2c')](respondWithFilteredResult(_0x22b2dc,_0x40c217))[_0x25f3('0xb3')](handleError(_0x22b2dc,null));};exports[_0x25f3('0xb4')]=function(_0x104558,_0x441ed7){var _0x2a2294={'raw':![],'where':{'id':_0x104558['params']['id']}},_0x25e57a={};_0x25e57a[_0x25f3('0x3b')]=_['keys'](db[_0x25f3('0x9a')]['rawAttributes']);_0x25e57a['query']=_[_0x25f3('0x3d')](_0x104558[_0x25f3('0x3c')]);_0x25e57a[_0x25f3('0x3e')]=_[_0x25f3('0x3f')](_0x25e57a[_0x25f3('0x3b')],_0x25e57a[_0x25f3('0x3c')]);_0x2a2294[_0x25f3('0x40')]=_[_0x25f3('0x3f')](_0x25e57a['model'],qs[_0x25f3('0x9b')](_0x104558[_0x25f3('0x3c')][_0x25f3('0x9b')]));_0x2a2294[_0x25f3('0x40')]=_0x2a2294['attributes']['length']?_0x2a2294[_0x25f3('0x40')]:_0x25e57a[_0x25f3('0x3b')];if(_0x104558[_0x25f3('0x3c')][_0x25f3('0xb5')]){_0x2a2294[_0x25f3('0xb6')]=[{'all':!![]}];}_0x2a2294=_['merge']({},_0x2a2294,_0x104558[_0x25f3('0xb7')]);return db[_0x25f3('0x9a')]['find'](_0x2a2294)[_0x25f3('0x2c')](handleEntityNotFound(_0x441ed7,null))[_0x25f3('0x2c')](respondWithResult(_0x441ed7,null))[_0x25f3('0xb3')](handleError(_0x441ed7,null));};exports[_0x25f3('0xb8')]=function(_0x567bf9,_0x379e6a){return db[_0x25f3('0x9a')]['create'](_0x567bf9['body'],{})[_0x25f3('0x2c')](respondWithResult(_0x379e6a,0xc9))[_0x25f3('0xb3')](handleError(_0x379e6a,null));};exports['update']=function(_0x575443,_0xa3074b){if(_0x575443[_0x25f3('0x72')]['id']){delete _0x575443[_0x25f3('0x72')]['id'];}return db[_0x25f3('0x9a')][_0x25f3('0x5e')]({'where':{'id':_0x575443['params']['id']}})[_0x25f3('0x2c')](handleEntityNotFound(_0xa3074b,null))[_0x25f3('0x2c')](saveUpdates(_0x575443[_0x25f3('0x72')],null))[_0x25f3('0x2c')](respondWithResult(_0xa3074b,null))[_0x25f3('0xb3')](handleError(_0xa3074b,null));};exports[_0x25f3('0x2d')]=function(_0x491f1f,_0x5c13a5){return db[_0x25f3('0x9a')][_0x25f3('0x5e')]({'where':{'id':_0x491f1f['params']['id']}})[_0x25f3('0x2c')](handleEntityNotFound(_0x5c13a5,null))[_0x25f3('0x2c')](removeEntity(_0x5c13a5,null))[_0x25f3('0xb3')](handleError(_0x5c13a5,null));};exports[_0x25f3('0xb9')]=function(_0x36bb43,_0x4b74ff){return db[_0x25f3('0x9a')][_0x25f3('0xb9')]()['then'](respondWithResult(_0x4b74ff,null))[_0x25f3('0xb3')](handleError(_0x4b74ff,null));};exports[_0x25f3('0xba')]=function(_0x38ea5d,_0x2d2d31,_0x572889){return db[_0x25f3('0xbb')][_0x25f3('0x5e')]({'where':{'id':_0x38ea5d[_0x25f3('0xbc')]['id']}})[_0x25f3('0x2c')](handleEntityNotFound(_0x2d2d31,null))['then'](function(_0x51426){if(_0x51426){return _0x51426['addMessage'](_0x38ea5d[_0x25f3('0x72')]['ids'],_['omit'](_0x38ea5d[_0x25f3('0x72')],['ids','id'])||{});}})[_0x25f3('0x2c')](respondWithResult(_0x2d2d31,null))[_0x25f3('0xb3')](handleError(_0x2d2d31,null));};exports[_0x25f3('0xbd')]=function(_0x337fca,_0x5b1c7a,_0x1c605c){var _0xf8cfa7={'raw':![],'where':{}};var _0x2b973a={};var _0x4af69f={'count':0x0,'rows':[]};return db[_0x25f3('0x9a')][_0x25f3('0xbe')]({'where':{'id':_0x337fca[_0x25f3('0xbc')]['id']}})[_0x25f3('0x2c')](handleEntityNotFound(_0x5b1c7a,null))[_0x25f3('0x2c')](function(_0x36047a){if(_0x36047a){_0x2b973a[_0x25f3('0x3b')]=_[_0x25f3('0x3d')](db['WhatsappMessage'][_0x25f3('0x38')]);_0x2b973a['query']=_[_0x25f3('0x3d')](_0x337fca[_0x25f3('0x3c')]);_0x2b973a[_0x25f3('0x3e')]=_[_0x25f3('0x3f')](_0x2b973a[_0x25f3('0x3b')],_0x2b973a[_0x25f3('0x3c')]);_0xf8cfa7['attributes']=_['intersection'](_0x2b973a[_0x25f3('0x3b')],qs['fields'](_0x337fca[_0x25f3('0x3c')][_0x25f3('0x9b')]));_0xf8cfa7[_0x25f3('0x40')]=_0xf8cfa7[_0x25f3('0x40')][_0x25f3('0x41')]?_0xf8cfa7[_0x25f3('0x40')]:_0x2b973a[_0x25f3('0x3b')];if(!_0x337fca[_0x25f3('0x3c')][_0x25f3('0xbf')]('nolimit')){_0xf8cfa7[_0x25f3('0x27')]=qs[_0x25f3('0x27')](_0x337fca[_0x25f3('0x3c')][_0x25f3('0x27')]);_0xf8cfa7['offset']=qs[_0x25f3('0x25')](_0x337fca[_0x25f3('0x3c')]['offset']);}_0xf8cfa7['order']=qs[_0x25f3('0x43')](_0x337fca[_0x25f3('0x3c')][_0x25f3('0x43')]);_0xf8cfa7[_0x25f3('0x44')]=qs['filters'](_[_0x25f3('0xc0')](_0x337fca[_0x25f3('0x3c')],_0x2b973a[_0x25f3('0x3e')]));_0xf8cfa7[_0x25f3('0x44')]['WhatsappInteractionId']=_0x36047a['id'];if(_0x337fca[_0x25f3('0x3c')][_0x25f3('0xc1')]){_0xf8cfa7[_0x25f3('0x44')]=_[_0x25f3('0x99')](_0xf8cfa7[_0x25f3('0x44')],{'$or':_[_0x25f3('0x37')](_0xf8cfa7[_0x25f3('0x40')],function(_0x59e7fb){var _0x234cf1={};_0x234cf1[_0x59e7fb]={'$like':'%'+_0x337fca[_0x25f3('0x3c')][_0x25f3('0xc1')]+'%'};return _0x234cf1;})});}if(_0x337fca[_0x25f3('0x3c')][_0x25f3('0x78')]){var _0x1d9137=_0x337fca[_0x25f3('0x3c')][_0x25f3('0x78')][_0x25f3('0x34')](',');var _0x33536a={};_0x33536a[_0x1d9137[0x0]]={'$gte':moment(_0x1d9137[0x1])[_0x25f3('0xc2')](_0x25f3('0xc3'))};_0xf8cfa7[_0x25f3('0x44')]=_[_0x25f3('0x99')](_0xf8cfa7[_0x25f3('0x44')],_0x33536a);}_0xf8cfa7=_['merge']({},_0xf8cfa7,_0x337fca[_0x25f3('0xb7')]);return db['WhatsappMessage'][_0x25f3('0x28')]({'where':_0xf8cfa7[_0x25f3('0x44')]})[_0x25f3('0x2c')](function(_0x4b4427){_0x4af69f['count']=_0x4b4427;if(_0x337fca[_0x25f3('0x3c')][_0x25f3('0xb5')]){_0xf8cfa7[_0x25f3('0xb6')]=[{'all':!![]}];}return db[_0x25f3('0xbb')]['findAll'](_0xf8cfa7);})[_0x25f3('0x2c')](function(_0x501b7a){_0x4af69f['rows']=_0x501b7a;return _0x4af69f;});}})[_0x25f3('0x2c')](respondWithFilteredResult(_0x5b1c7a,_0xf8cfa7))['catch'](handleError(_0x5b1c7a,null));};exports['addTags']=function(_0x24ecfe,_0x338bc3,_0x1fc231){return db[_0x25f3('0x9a')][_0x25f3('0x5e')]({'where':{'id':_0x24ecfe[_0x25f3('0xbc')]['id']}})['then'](handleEntityNotFound(_0x338bc3,null))[_0x25f3('0x2c')](function(_0x53d9b1){if(_0x53d9b1){return _0x53d9b1[_0x25f3('0xc4')](_0x24ecfe[_0x25f3('0x72')][_0x25f3('0xc5')],_[_0x25f3('0xc6')](_0x24ecfe[_0x25f3('0x72')],['ids','id'])||{})['spread'](function(){return db[_0x25f3('0x69')][_0x25f3('0xc7')]({'attributes':['id',_0x25f3('0x2f'),_0x25f3('0xc8')],'where':{'id':_0x24ecfe[_0x25f3('0x72')][_0x25f3('0xc5')]}});})[_0x25f3('0x2c')](function(_0x590ca3){socket[_0x25f3('0xc9')](_0x25f3('0xca'),{'id':Number(_0x24ecfe[_0x25f3('0xbc')]['id']),'tags':_0x590ca3||[]});return{'id':Number(_0x24ecfe[_0x25f3('0xbc')]['id']),'tags':_0x590ca3||[]};});}})['then'](respondWithResult(_0x338bc3,null))[_0x25f3('0xb3')](handleError(_0x338bc3,null));};exports['removeTags']=function(_0x3d8cab,_0xb01750,_0x4d293b){return db[_0x25f3('0x9a')][_0x25f3('0x5e')]({'where':{'id':_0x3d8cab['params']['id']}})[_0x25f3('0x2c')](handleEntityNotFound(_0xb01750,null))[_0x25f3('0x2c')](function(_0x5e1cd2){if(_0x5e1cd2){return _0x5e1cd2[_0x25f3('0xcb')](_0x3d8cab['query']['ids']);}})['then'](respondWithStatusCode(_0xb01750,null))[_0x25f3('0xb3')](handleError(_0xb01750,null));};exports[_0x25f3('0xcc')]=function(_0x4ed809,_0x4f61a8){var _0x172695=moment()[_0x25f3('0xcd')]()[_0x25f3('0x96')]();var _0x306b37=path[_0x25f3('0xce')](config[_0x25f3('0xcf')],_0x25f3('0xd0'),_0x25f3('0xd1'),_0x25f3('0xd2'));var _0x3cf1de=path[_0x25f3('0xce')](config['root'],_0x25f3('0xd0'),_0x25f3('0xd1'),_0x25f3('0xd3'));var _0x52b12a=path[_0x25f3('0xce')](_0x306b37,_0x172695);var _0x18f162=util['format'](_0x25f3('0xd4'),_0x4ed809['params']['id'],_0x172695);var _0x347c3b=path[_0x25f3('0xce')](_0x306b37,_0x18f162);var _0x314725=[];_0x314725[_0x25f3('0x35')]({'model':db['User'],'as':_0x25f3('0x6c'),'attributes':['id',_0x25f3('0xd5')],'raw':!![]});_0x314725[_0x25f3('0x35')]({'model':db[_0x25f3('0xd6')],'as':_0x25f3('0xd7'),'attributes':['id',_0x25f3('0xd8'),_0x25f3('0xd9')],'raw':!![]});if(_0x4ed809[_0x25f3('0x3c')][_0x25f3('0xd3')]){_0x314725['push']({'model':db['Attachment'],'as':_0x25f3('0xda'),'raw':!![]});}var _0x4e5ebb=[{'model':db[_0x25f3('0xbb')],'as':_0x25f3('0xdb'),'attributes':['id',_0x25f3('0x72'),_0x25f3('0xdc'),_0x25f3('0xdd'),_0x25f3('0xde'),_0x25f3('0x7d')],'include':_0x314725}];_0x4e5ebb[_0x25f3('0x35')]({'model':db[_0x25f3('0xdf')],'as':_0x25f3('0xe0'),'attributes':['id','name']});_0x4e5ebb[_0x25f3('0x35')]({'model':db[_0x25f3('0x6c')],'as':_0x25f3('0xe1'),'attributes':['id',_0x25f3('0xd5')]});return db['WhatsappInteraction'][_0x25f3('0x5e')]({'where':{'id':_0x4ed809[_0x25f3('0xbc')]['id']},'include':_0x4e5ebb})[_0x25f3('0x2c')](handleEntityNotFound(_0x4f61a8,null))[_0x25f3('0x2c')](function(_0x59be6f){if(_0x59be6f){var _0x186567=_0x59be6f[_0x25f3('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x52b12a);var _0x3f11bf={'channel':_0x25f3('0xe3'),'account':_0x186567[_0x25f3('0xe0')]['name'],'agent':_0x186567[_0x25f3('0xe1')]?_0x186567[_0x25f3('0xe1')][_0x25f3('0xd5')]:_0x25f3('0xe4'),'createdAt':moment(_0x186567[_0x25f3('0xdc')])[_0x25f3('0xc2')](_0x25f3('0xc3'))[_0x25f3('0x96')](),'closedAt':_0x186567[_0x25f3('0xe5')]?moment(_0x186567[_0x25f3('0xe6')])[_0x25f3('0xc2')](_0x25f3('0xc3'))[_0x25f3('0x96')]():'','disposition':_0x186567[_0x25f3('0xe7')],'messages':_(_0x186567['Messages'])['filter']({'secret':![]})['map'](function(_0xe8f51){if(_0xe8f51[_0x25f3('0xda')]){var _0xd41f22=path[_0x25f3('0xce')](_0x3cf1de,_0xe8f51['Attachment'][_0x25f3('0xe8')]);if(fs['existsSync'](_0xd41f22)){fs[_0x25f3('0xe9')](_0xd41f22)[_0x25f3('0xea')](fs['createWriteStream'](path[_0x25f3('0xce')](_0x52b12a,_0xe8f51[_0x25f3('0xda')][_0x25f3('0xe8')])));}}return{'date':moment(_0xe8f51['createdAt'])[_0x25f3('0xc2')](_0x25f3('0xc3'))['toString'](),'sender':_0xe8f51[_0x25f3('0xdd')]===_0x25f3('0xeb')?_0xe8f51[_0x25f3('0x6c')]?_0xe8f51[_0x25f3('0x6c')][_0x25f3('0xd5')]:_0x25f3('0xec'):_0xe8f51[_0x25f3('0xd7')][_0x25f3('0xd8')]+(_0xe8f51['Contact'][_0x25f3('0xd9')]?'\x20'+_0xe8f51[_0x25f3('0xd7')]['lastName']:''),'body':_0xe8f51['Attachment']?_0xe8f51[_0x25f3('0xda')][_0x25f3('0xe8')]:_0xe8f51[_0x25f3('0x72')],'direction':_0xe8f51['direction']===_0x25f3('0xeb')?'A':'C','secret':_0xe8f51[_0x25f3('0xde')],'read':_0xe8f51[_0x25f3('0x7d')],'attachment':_0xe8f51['Attachment']};})[_0x25f3('0x65')]()};return ejs[_0x25f3('0xed')](path[_0x25f3('0xce')](config[_0x25f3('0xcf')],_0x25f3('0xd0'),'views',_0x25f3('0xee')),{'interaction':_0x3f11bf})['then'](function(_0x4eded1){var _0x20a171=path[_0x25f3('0xce')](_0x52b12a,_0x25f3('0xef')+_0x186567['id']+'-'+_0x172695+_0x25f3('0xf0'));var _0x995d65={'path':_0x20a171,'channel':_0x25f3('0xe3'),'interactionId':_0x186567['id']};return pdf[_0x25f3('0xf1')](_0x4eded1,_0x995d65);})[_0x25f3('0x2c')](function(){return new BPromise(function(_0x5e5aec,_0x5b6dbe){zipdir(_0x52b12a,{'saveTo':_0x347c3b},function(_0x2e6f55,_0x1de55c){if(_0x2e6f55)return _0x5b6dbe(_0x2e6f55);return _0x5e5aec(_0x1de55c);});})['then'](function(){return new BPromise(function(_0x20f8e2,_0x503e10){rimraf(_0x52b12a,function(_0x3f6620){if(_0x3f6620)_0x503e10(_0x3f6620);return _0x20f8e2();});});})[_0x25f3('0x2c')](function(){return _0x4f61a8[_0x25f3('0xcc')](_0x347c3b,_0x18f162,function(_0x489913){if(_0x489913){console[_0x25f3('0xf2')]('err',_0x489913);}else{fs[_0x25f3('0xf3')](_0x347c3b);}});});});}else{return _0x4f61a8[_0x25f3('0x22')](0xc8);}})[_0x25f3('0xb3')](handleError(_0x4f61a8,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c1e67bd..e1b14a6 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 _0x3b58=['map','findAll','unreadMessages','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','setDataValue','Users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b58,0xbc));var _0x83b5=function(_0x2057d3,_0x3b00e2){_0x2057d3=_0x2057d3-0x0;var _0x2723d0=_0x3b58[_0x2057d3];return _0x2723d0;};'use strict';var EventEmitter=require(_0x83b5('0x0'));var WhatsappInteraction=require(_0x83b5('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x83b5('0x1'))['db'][_0x83b5('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x83b5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x83b5('0x4'),'afterDestroy':_0x83b5('0x5')};function emitEvent(_0x1de446){return function(_0x533bf9,_0x1da8de,_0x2607b9){_0x533bf9['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x184cff){_0x533bf9[_0x83b5('0x6')](_0x83b5('0x7'),_0x184cff[_0x83b5('0x8')](function(_0x3bba01){return{'id':_0x3bba01['id']};}));return WhatsappMessage[_0x83b5('0x9')]({'where':{'WhatsappInteractionId':_0x533bf9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x227d8f){_0x533bf9[_0x83b5('0x6')](_0x83b5('0xa'),_0x227d8f['length']);WhatsappInteractionEvents[_0x83b5('0xb')](_0x1de446+':'+_0x533bf9['id'],_0x533bf9);WhatsappInteractionEvents[_0x83b5('0xb')](_0x1de446,_0x533bf9);_0x2607b9(null);})['catch'](_0x2607b9(null));};}for(var e in events){if(events[_0x83b5('0xc')](e)){var event=events[e];WhatsappInteraction[_0x83b5('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x820a=['emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','then','Users','findAll','setDataValue','length'];(function(_0xd42ae9,_0x562ea2){var _0x581cff=function(_0x54ec26){while(--_0x54ec26){_0xd42ae9['push'](_0xd42ae9['shift']());}};_0x581cff(++_0x562ea2);}(_0x820a,0x114));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa820('0x0'));var WhatsappInteraction=require(_0xa820('0x1'))['db'][_0xa820('0x2')];var WhatsappMessage=require(_0xa820('0x1'))['db'][_0xa820('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa820('0x4'),'afterUpdate':_0xa820('0x5'),'afterDestroy':_0xa820('0x6')};function emitEvent(_0x4395fb){return function(_0x1e48cc,_0x335e2c,_0x51567d){_0x1e48cc['getUsers']({'attributes':['id'],'raw':!![]})[_0xa820('0x7')](function(_0x3adfa3){_0x1e48cc['setDataValue'](_0xa820('0x8'),_0x3adfa3['map'](function(_0x47398a){return{'id':_0x47398a['id']};}));return WhatsappMessage[_0xa820('0x9')]({'where':{'WhatsappInteractionId':_0x1e48cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa820('0x7')](function(_0x572522){_0x1e48cc[_0xa820('0xa')]('unreadMessages',_0x572522[_0xa820('0xb')]);WhatsappInteractionEvents['emit'](_0x4395fb+':'+_0x1e48cc['id'],_0x1e48cc);WhatsappInteractionEvents[_0xa820('0xc')](_0x4395fb,_0x1e48cc);_0x51567d(null);})[_0xa820('0xd')](_0x51567d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xa820('0xe')](e,emitEvent(event));}}module[_0xa820('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b0e3979..b3ba211 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 _0x8308=['rimraf','../../config/environment','define','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8308,0x1cb));var _0x8830=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0x8308[_0xe30e17];return _0x2342c9;};'use strict';var _=require(_0x8830('0x0'));var util=require('util');var logger=require(_0x8830('0x1'))('api');var moment=require(_0x8830('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8830('0x3'));var config=require(_0x8830('0x4'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x5780ac,_0x411404){return _0x5780ac[_0x8830('0x5')](_0x8830('0x6'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x361b3a,_0x51723e,_0x49029d){if(_0x361b3a[_0x8830('0x7')]('closed')){_0x361b3a[_0x8830('0x8')]=moment()[_0x8830('0x9')](_0x8830('0xa'));}_0x49029d(null,_0x361b3a);}}});}; \ No newline at end of file +var _0x1b74=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x1abc3e,_0x10af1a){var _0x443c6d=function(_0x396d07){while(--_0x396d07){_0x1abc3e['push'](_0x1abc3e['shift']());}};_0x443c6d(++_0x10af1a);}(_0x1b74,0x169));var _0x41b7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b74[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x41b7('0x0'));var util=require(_0x41b7('0x1'));var logger=require(_0x41b7('0x2'))('api');var moment=require(_0x41b7('0x3'));var BPromise=require(_0x41b7('0x4'));var rp=require(_0x41b7('0x5'));var fs=require('fs');var path=require(_0x41b7('0x6'));var rimraf=require('rimraf');var config=require(_0x41b7('0x7'));var attributes=require(_0x41b7('0x8'));module['exports']=function(_0x2ee2ab,_0x54f2d3){return _0x2ee2ab[_0x41b7('0x9')](_0x41b7('0xa'),attributes,{'tableName':_0x41b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd56c26,_0x5494c7,_0x14e5dd){if(_0xd56c26[_0x41b7('0xc')](_0x41b7('0xd'))){_0xd56c26[_0x41b7('0xe')]=moment()[_0x41b7('0xf')](_0x41b7('0x10'));}_0x14e5dd(null,_0xd56c26);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 9589e98..c7de1bb 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 _0xd84f=['limit','UpdateWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw','where','attributes'];(function(_0x3dad04,_0x5bd65a){var _0x31dc42=function(_0x5744f2){while(--_0x5744f2){_0x3dad04['push'](_0x3dad04['shift']());}};_0x31dc42(++_0x5bd65a);}(_0xd84f,0x134));var _0xfd84=function(_0x43e5f8,_0x334949){_0x43e5f8=_0x43e5f8-0x0;var _0xcb023e=_0xd84f[_0x43e5f8];return _0xcb023e;};'use strict';var _=require(_0xfd84('0x0'));var util=require(_0xfd84('0x1'));var moment=require('moment');var BPromise=require(_0xfd84('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd84('0x3'));var db=require(_0xfd84('0x4'))['db'];var utils=require(_0xfd84('0x5'));var logger=require(_0xfd84('0x6'))(_0xfd84('0x7'));var config=require(_0xfd84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfd84('0x9')][_0xfd84('0xa')]({'port':0x232a});config[_0xfd84('0xb')]=_['defaults'](config['redis'],{'host':_0xfd84('0xc'),'port':0x18eb});var socket=require(_0xfd84('0xd'))(new Redis(config[_0xfd84('0xb')]));require(_0xfd84('0xe'))[_0xfd84('0xf')](socket);function respondWithRpcPromise(_0x5bf078,_0x4ee488,_0x4afbac){return new BPromise(function(_0x4cce52,_0x20bb23){return client[_0xfd84('0x10')](_0x5bf078,_0x4afbac)[_0xfd84('0x11')](function(_0x4eaf19){logger[_0xfd84('0x12')](_0xfd84('0x13'),_0x4ee488,_0xfd84('0x14'));logger[_0xfd84('0x15')](_0xfd84('0x16'),_0x4ee488,_0xfd84('0x14'),JSON[_0xfd84('0x17')](_0x4eaf19));if(_0x4eaf19['error']){if(_0x4eaf19[_0xfd84('0x18')][_0xfd84('0x19')]===0x1f4){logger[_0xfd84('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x4ee488,_0x4eaf19[_0xfd84('0x18')][_0xfd84('0x1a')]);return _0x20bb23(_0x4eaf19[_0xfd84('0x18')][_0xfd84('0x1a')]);}logger[_0xfd84('0x18')](_0xfd84('0x13'),_0x4ee488,_0x4eaf19[_0xfd84('0x18')][_0xfd84('0x1a')]);return _0x4cce52(_0x4eaf19[_0xfd84('0x18')][_0xfd84('0x1a')]);}else{logger[_0xfd84('0x12')](_0xfd84('0x13'),_0x4ee488,_0xfd84('0x14'));_0x4cce52(_0x4eaf19[_0xfd84('0x1b')][_0xfd84('0x1a')]);}})[_0xfd84('0x1c')](function(_0x59969a){logger['error'](_0xfd84('0x13'),_0x4ee488,_0x59969a);_0x20bb23(_0x59969a);});});}exports['UpdateWhatsappInteraction']=function(_0x26e52b){var _0x394730=this;return new Promise(function(_0x142317,_0x4f8ac3){return db[_0xfd84('0x1d')][_0xfd84('0x1e')](_0x26e52b[_0xfd84('0x1f')],{'raw':_0x26e52b[_0xfd84('0x20')]?_0x26e52b[_0xfd84('0x20')][_0xfd84('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26e52b[_0xfd84('0x20')]?_0x26e52b[_0xfd84('0x20')][_0xfd84('0x22')]||null:null,'attributes':_0x26e52b['options']?_0x26e52b[_0xfd84('0x20')][_0xfd84('0x23')]||null:null,'limit':_0x26e52b[_0xfd84('0x20')]?_0x26e52b[_0xfd84('0x20')][_0xfd84('0x24')]||null:null})[_0xfd84('0x11')](function(_0xed577e){logger[_0xfd84('0x12')](_0xfd84('0x25'),_0x26e52b);logger[_0xfd84('0x15')](_0xfd84('0x25'),_0x26e52b,JSON[_0xfd84('0x17')](_0xed577e));_0x142317(_0xed577e);})[_0xfd84('0x1c')](function(_0xf5d8b0){logger[_0xfd84('0x18')](_0xfd84('0x25'),_0xf5d8b0['message'],_0x26e52b);_0x4f8ac3(_0x394730[_0xfd84('0x18')](0x1f4,_0xf5d8b0[_0xfd84('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x18982d){return new Promise(function(_0x39fda2,_0x556907){return db[_0xfd84('0x1d')][_0xfd84('0x26')]({'where':_0x18982d['options']?_0x18982d[_0xfd84('0x20')][_0xfd84('0x22')]||null:null})[_0xfd84('0x11')](function(_0x19ce69){if(_0x19ce69){return _0x19ce69[_0xfd84('0x27')](_0x18982d['body'][_0xfd84('0x28')],_['omit'](_0x18982d[_0xfd84('0x1f')],[_0xfd84('0x28'),'id'])||{});}})[_0xfd84('0x29')](function(_0x146c11){logger[_0xfd84('0x12')](_0xfd84('0x2a'),_0x18982d);logger['debug'](_0xfd84('0x2a'),_0x18982d,JSON['stringify'](_0x146c11));_0x39fda2(_0x146c11);})[_0xfd84('0x1c')](function(_0x18ce9c){logger[_0xfd84('0x18')](_0xfd84('0x2a'),_0x18ce9c[_0xfd84('0x1a')],_0x18982d);_0x556907(_this[_0xfd84('0x18')](0x1f4,_0x18ce9c[_0xfd84('0x1a')]));});});}; \ No newline at end of file +var _0x9d63=['options','raw','where','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body'];(function(_0x5a655f,_0x126e4f){var _0x477cfb=function(_0x46d408){while(--_0x46d408){_0x5a655f['push'](_0x5a655f['shift']());}};_0x477cfb(++_0x126e4f);}(_0x9d63,0x1c3));var _0x39d6=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x9d63[_0x2cfb58];return _0xd99951;};'use strict';var _=require('lodash');var util=require(_0x39d6('0x0'));var moment=require(_0x39d6('0x1'));var BPromise=require(_0x39d6('0x2'));var rs=require(_0x39d6('0x3'));var fs=require('fs');var Redis=require(_0x39d6('0x4'));var db=require(_0x39d6('0x5'))['db'];var utils=require(_0x39d6('0x6'));var logger=require(_0x39d6('0x7'))(_0x39d6('0x8'));var config=require(_0x39d6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x39d6('0xa')][_0x39d6('0xb')]({'port':0x232a});config[_0x39d6('0xc')]=_[_0x39d6('0xd')](config[_0x39d6('0xc')],{'host':_0x39d6('0xe'),'port':0x18eb});var socket=require(_0x39d6('0xf'))(new Redis(config['redis']));require(_0x39d6('0x10'))['register'](socket);function respondWithRpcPromise(_0x2f77bc,_0x49c54b,_0x5c6b7d){return new BPromise(function(_0x19ceda,_0x41340b){return client[_0x39d6('0x11')](_0x2f77bc,_0x5c6b7d)[_0x39d6('0x12')](function(_0x15fa66){logger[_0x39d6('0x13')](_0x39d6('0x14'),_0x49c54b,_0x39d6('0x15'));logger[_0x39d6('0x16')](_0x39d6('0x17'),_0x49c54b,_0x39d6('0x15'),JSON[_0x39d6('0x18')](_0x15fa66));if(_0x15fa66[_0x39d6('0x19')]){if(_0x15fa66[_0x39d6('0x19')][_0x39d6('0x1a')]===0x1f4){logger[_0x39d6('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x49c54b,_0x15fa66[_0x39d6('0x19')]['message']);return _0x41340b(_0x15fa66[_0x39d6('0x19')]['message']);}logger['error'](_0x39d6('0x14'),_0x49c54b,_0x15fa66[_0x39d6('0x19')][_0x39d6('0x1b')]);return _0x19ceda(_0x15fa66[_0x39d6('0x19')]['message']);}else{logger[_0x39d6('0x13')](_0x39d6('0x14'),_0x49c54b,_0x39d6('0x15'));_0x19ceda(_0x15fa66['result'][_0x39d6('0x1b')]);}})[_0x39d6('0x1c')](function(_0x4868b8){logger[_0x39d6('0x19')](_0x39d6('0x14'),_0x49c54b,_0x4868b8);_0x41340b(_0x4868b8);});});}exports[_0x39d6('0x1d')]=function(_0x47f54a){var _0x1fcb61=this;return new Promise(function(_0x43ace8,_0x234ee6){return db[_0x39d6('0x1e')][_0x39d6('0x1f')](_0x47f54a[_0x39d6('0x20')],{'raw':_0x47f54a[_0x39d6('0x21')]?_0x47f54a['options'][_0x39d6('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47f54a[_0x39d6('0x21')]?_0x47f54a[_0x39d6('0x21')][_0x39d6('0x23')]||null:null,'attributes':_0x47f54a[_0x39d6('0x21')]?_0x47f54a[_0x39d6('0x21')]['attributes']||null:null,'limit':_0x47f54a[_0x39d6('0x21')]?_0x47f54a[_0x39d6('0x21')][_0x39d6('0x24')]||null:null})[_0x39d6('0x12')](function(_0xc8203b){logger[_0x39d6('0x13')](_0x39d6('0x1d'),_0x47f54a);logger[_0x39d6('0x16')](_0x39d6('0x1d'),_0x47f54a,JSON[_0x39d6('0x18')](_0xc8203b));_0x43ace8(_0xc8203b);})['catch'](function(_0x22bfb5){logger['error'](_0x39d6('0x1d'),_0x22bfb5[_0x39d6('0x1b')],_0x47f54a);_0x234ee6(_0x1fcb61['error'](0x1f4,_0x22bfb5[_0x39d6('0x1b')]));});});};exports[_0x39d6('0x25')]=function(_0x481884){return new Promise(function(_0x21043c,_0x1ac084){return db['WhatsappInteraction'][_0x39d6('0x26')]({'where':_0x481884[_0x39d6('0x21')]?_0x481884['options']['where']||null:null})[_0x39d6('0x12')](function(_0x4cfac7){if(_0x4cfac7){return _0x4cfac7[_0x39d6('0x27')](_0x481884['body'][_0x39d6('0x28')],_[_0x39d6('0x29')](_0x481884[_0x39d6('0x20')],[_0x39d6('0x28'),'id'])||{});}})[_0x39d6('0x2a')](function(_0x154b7e){logger[_0x39d6('0x13')](_0x39d6('0x2b'),_0x481884);logger[_0x39d6('0x16')](_0x39d6('0x2b'),_0x481884,JSON[_0x39d6('0x18')](_0x154b7e));_0x21043c(_0x154b7e);})[_0x39d6('0x1c')](function(_0x5db782){logger[_0x39d6('0x19')]('AddTags',_0x5db782['message'],_0x481884);_0x1ac084(_this[_0x39d6('0x19')](0x1f4,_0x5db782[_0x39d6('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index e1a188e..b49245e 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 _0xde34=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x2c24df,_0x2ca187){var _0x198bb2=function(_0x5bb76f){while(--_0x5bb76f){_0x2c24df['push'](_0x2c24df['shift']());}};_0x198bb2(++_0x2ca187);}(_0xde34,0x133));var _0x4de3=function(_0x267730,_0x1dcfb4){_0x267730=_0x267730-0x0;var _0x772034=_0xde34[_0x267730];return _0x772034;};'use strict';var WhatsappInteractionEvents=require(_0x4de3('0x0'));var events=['save','remove',_0x4de3('0x1')];function createListener(_0x536219,_0x2257a9){return function(_0x53fe8f){_0x2257a9[_0x4de3('0x2')](_0x536219,_0x53fe8f);};}function removeListener(_0x1c1f68,_0x452a25){return function(){WhatsappInteractionEvents[_0x4de3('0x3')](_0x1c1f68,_0x452a25);};}exports[_0x4de3('0x4')]=function(_0x37728b){for(var _0x59d8f3=0x0,_0x4c3b4e=events[_0x4de3('0x5')];_0x59d8f3<_0x4c3b4e;_0x59d8f3++){var _0x4be01f=events[_0x59d8f3];var _0xdecdf6=createListener(_0x4de3('0x6')+_0x4be01f,_0x37728b);WhatsappInteractionEvents['on'](_0x4be01f,_0xdecdf6);}}; \ No newline at end of file +var _0xbf43=['update','emit','removeListener','register','length','./whatsappInteraction.events','save'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xbf43,0x1d3));var _0x3bf4=function(_0x164ae5,_0x5ac1c8){_0x164ae5=_0x164ae5-0x0;var _0x19e445=_0xbf43[_0x164ae5];return _0x19e445;};'use strict';var WhatsappInteractionEvents=require(_0x3bf4('0x0'));var events=[_0x3bf4('0x1'),'remove',_0x3bf4('0x2')];function createListener(_0x1d9861,_0x1d85e3){return function(_0x2cf297){_0x1d85e3[_0x3bf4('0x3')](_0x1d9861,_0x2cf297);};}function removeListener(_0x4d5ba0,_0x70cd53){return function(){WhatsappInteractionEvents[_0x3bf4('0x4')](_0x4d5ba0,_0x70cd53);};}exports[_0x3bf4('0x5')]=function(_0x2e5778){for(var _0x283887=0x0,_0x366925=events[_0x3bf4('0x6')];_0x283887<_0x366925;_0x283887++){var _0x371db3=events[_0x283887];var _0x958c44=createListener('whatsappInteraction:'+_0x371db3,_0x2e5778);WhatsappInteractionEvents['on'](_0x371db3,_0x958c44);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 746ca6f..e0175e4 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 _0xeec6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','/describe','describe','get','show','post','whatsappmessage:create','create','status','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x88000f,_0x443a85){var _0x3187a7=function(_0x551de5){while(--_0x551de5){_0x88000f['push'](_0x88000f['shift']());}};_0x3187a7(++_0x443a85);}(_0xeec6,0x1c2));var _0x6eec=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0xeec6[_0x2a390b];return _0x5df10a;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get']('/',auth[_0x6eec('0xa')](),controller[_0x6eec('0xb')]);router['get'](_0x6eec('0xc'),auth[_0x6eec('0xa')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xa')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x6eec('0x11')),controller[_0x6eec('0x12')]);router['post']('/:id/status',controller[_0x6eec('0x13')]);router['put'](_0x6eec('0x14'),auth[_0x6eec('0xa')](),controller[_0x6eec('0x15')]);router[_0x6eec('0x16')](_0x6eec('0x17'),auth['isAuthenticated'](),controller[_0x6eec('0x18')]);router[_0x6eec('0x16')](_0x6eec('0x19'),auth[_0x6eec('0xa')](),controller[_0x6eec('0x1a')]);router[_0x6eec('0x1b')](_0x6eec('0x14'),auth[_0x6eec('0xa')](),controller[_0x6eec('0x1c')]);module[_0x6eec('0x1d')]=router; \ No newline at end of file +var _0xed1f=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','whatsapp','create','put','update','accept','/:id/reject'];(function(_0x5da20d,_0x46cc8a){var _0x4bef3b=function(_0x6d4905){while(--_0x6d4905){_0x5da20d['push'](_0x5da20d['shift']());}};_0x4bef3b(++_0x46cc8a);}(_0xed1f,0x6a));var _0xfed1=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xed1f[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',auth[_0xfed1('0xc')](),controller[_0xfed1('0xd')]);router[_0xfed1('0xb')](_0xfed1('0xe'),auth[_0xfed1('0xc')](),controller[_0xfed1('0xf')]);router['get'](_0xfed1('0x10'),auth[_0xfed1('0xc')](),controller['show']);router[_0xfed1('0x11')]('/',auth[_0xfed1('0xc')](),interaction['tracked'](_0xfed1('0x12'),'whatsappmessage:create'),controller[_0xfed1('0x13')]);router[_0xfed1('0x11')]('/:id/status',controller['status']);router[_0xfed1('0x14')](_0xfed1('0x10'),auth['isAuthenticated'](),controller[_0xfed1('0x15')]);router['put']('/:id/accept',auth[_0xfed1('0xc')](),controller[_0xfed1('0x16')]);router['put'](_0xfed1('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0xfed1('0x18')](_0xfed1('0x10'),auth[_0xfed1('0xc')](),controller[_0xfed1('0x19')]);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 8da6be8..2e96473 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 _0xc8ed=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x9381e1,_0xa19020){var _0x1a4f47=function(_0x5155b7){while(--_0x5155b7){_0x9381e1['push'](_0x9381e1['shift']());}};_0x1a4f47(++_0xa19020);}(_0xc8ed,0x137));var _0xdc8e=function(_0x4ac1cc,_0x586beb){_0x4ac1cc=_0x4ac1cc-0x0;var _0x300e78=_0xc8ed[_0x4ac1cc];return _0x300e78;};'use strict';var Sequelize=require(_0xdc8e('0x0'));module[_0xdc8e('0x1')]={'body':{'type':Sequelize[_0xdc8e('0x2')](_0xdc8e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc8e('0x4')]('in',_0xdc8e('0x5')),'defaultValue':_0xdc8e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdc8e('0x6')](0xbe)},'phone':{'type':Sequelize[_0xdc8e('0x6')]},'readAt':{'type':Sequelize[_0xdc8e('0x7')]},'secret':{'type':Sequelize[_0xdc8e('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdc8e('0x6')]},'providerResponse':{'type':Sequelize[_0xdc8e('0x2')]}}; \ No newline at end of file +var _0x022a=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x022a,0x178));var _0xa022=function(_0x5bdf15,_0x39f070){_0x5bdf15=_0x5bdf15-0x0;var _0x1c7939=_0x022a[_0x5bdf15];return _0x1c7939;};'use strict';var Sequelize=require(_0xa022('0x0'));module[_0xa022('0x1')]={'body':{'type':Sequelize[_0xa022('0x2')](_0xa022('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa022('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa022('0x5')]('in',_0xa022('0x6')),'defaultValue':_0xa022('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa022('0x7')](0xbe)},'phone':{'type':Sequelize[_0xa022('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa022('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 427ff85..c778f75 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 _0xa9e0=['event','EventManager','acceptmessage','whatsapp-interactions','whatsapp','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','Sequelize','SELECT','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','WhatsappMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','get','WhatsappInteraction','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','startsWith','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','interface','SIP/%s','channel'];(function(_0x5d345a,_0x1dc114){var _0x3feaf0=function(_0x1b76cb){while(--_0x1b76cb){_0x5d345a['push'](_0x5d345a['shift']());}};_0x3feaf0(++_0x1dc114);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['WhatsappMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['WhatsappMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('whatsapp-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'whatsapp'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5e')],'as':'Contact'}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x1d')](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x401837){if(_0x401837){_0x273cb5['message']=_0x401837[_0x0a9e('0x5f')]({'plain':!![]});return db[_0x0a9e('0x60')][_0x0a9e('0x55')]({'where':{'id':_0x401837['WhatsappInteractionId']}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x5211e3){if(_0x5211e3){return _0x5211e3[_0x0a9e('0x35')]({'UserId':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x61')](_0x5211e3[_0x0a9e('0x62')])?moment()[_0x0a9e('0x63')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x2d7205){if(_0x2d7205){_0x273cb5[_0x0a9e('0x64')]=_0x2d7205[_0x0a9e('0x5f')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x65'),_0x5ba1f9[_0x0a9e('0x66')]['id'],_0x5ba1f9[_0x0a9e('0x66')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x66')][_0x0a9e('0x67')],_0x273cb5['interaction']['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x5ba1f9[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x68'),_0x0a9e('0x69'),_0x273cb5);}return null;})['then'](function(_0x83f0b2){return db[_0x0a9e('0x5e')][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](function(_0x13b5c0){var _0x4a43a8=[];for(var _0x50cdce=0x0;_0x50cdce=_0xbe87e1){_0x209aba=_0xbe87e1;_0x4fd03f=0xc8;}else{_0x4fd03f=0xce;}_0x52746a[_0x9edd('0x2d')](_0x4fd03f);return _0x52746a[_0x9edd('0x34')](_0x9edd('0x35'),_0xbbf08f+'-'+_0x209aba+'/'+_0xbe87e1)[_0x9edd('0x2f')](_0x28cfae);}return null;};}function patchUpdates(_0x5af178){return function(_0x1453d2){try{jsonpatch[_0x9edd('0x36')](_0x1453d2,_0x5af178,!![]);}catch(_0x267c74){return BPromise['reject'](_0x267c74);}return _0x1453d2[_0x9edd('0x37')]();};}function saveUpdates(_0x3990fb,_0xde9b13){return function(_0x38a7be){if(_0x38a7be){return _0x38a7be[_0x9edd('0x38')](_0x3990fb)[_0x9edd('0x22')](function(_0x473068){return _0x473068;});}return null;};}function removeEntity(_0x438a5d,_0xd0fd74){return function(_0x2539c6){if(_0x2539c6){return _0x2539c6[_0x9edd('0x39')]()[_0x9edd('0x22')](function(){_0x438a5d[_0x9edd('0x2d')](0xcc)[_0x9edd('0x2e')]();});}};}function handleEntityNotFound(_0x5757fc,_0x37fcb2){return function(_0x5ed62d){if(!_0x5ed62d){_0x5757fc[_0x9edd('0x2c')](0x194);}return _0x5ed62d;};}function handleError(_0x148630,_0x10d6fd){_0x10d6fd=_0x10d6fd||0x1f4;return function(_0x434d26){logger[_0x9edd('0x27')](_0x434d26['stack']);if(_0x434d26[_0x9edd('0x3a')]){delete _0x434d26[_0x9edd('0x3a')];}_0x148630[_0x9edd('0x2d')](_0x10d6fd)[_0x9edd('0x3b')](_0x434d26);};}exports[_0x9edd('0x3c')]=function(_0x337e6c,_0x5c0627){var _0x1cbbac={},_0x1ccee8={},_0x35c16f={'count':0x0,'rows':[]};var _0x51a54a=_[_0x9edd('0x3d')](db['WhatsappMessage'][_0x9edd('0x3e')],function(_0x5658d6){return{'name':_0x5658d6[_0x9edd('0x3f')],'type':_0x5658d6[_0x9edd('0x40')][_0x9edd('0x41')]};});_0x1ccee8['model']=_[_0x9edd('0x3d')](_0x51a54a,_0x9edd('0x3a'));_0x1ccee8[_0x9edd('0x42')]=_['keys'](_0x337e6c[_0x9edd('0x42')]);_0x1ccee8['filters']=_[_0x9edd('0x43')](_0x1ccee8[_0x9edd('0x44')],_0x1ccee8['query']);_0x1cbbac[_0x9edd('0x45')]=_[_0x9edd('0x43')](_0x1ccee8[_0x9edd('0x44')],qs[_0x9edd('0x46')](_0x337e6c['query'][_0x9edd('0x46')]));_0x1cbbac['attributes']=_0x1cbbac[_0x9edd('0x45')][_0x9edd('0x47')]?_0x1cbbac['attributes']:_0x1ccee8[_0x9edd('0x44')];if(!_0x337e6c['query']['hasOwnProperty'](_0x9edd('0x48'))){_0x1cbbac[_0x9edd('0x31')]=qs[_0x9edd('0x31')](_0x337e6c[_0x9edd('0x42')][_0x9edd('0x31')]);_0x1cbbac[_0x9edd('0x30')]=qs[_0x9edd('0x30')](_0x337e6c[_0x9edd('0x42')][_0x9edd('0x30')]);}_0x1cbbac[_0x9edd('0x49')]=qs[_0x9edd('0x4a')](_0x337e6c[_0x9edd('0x42')][_0x9edd('0x4a')]);_0x1cbbac[_0x9edd('0x4b')]=qs[_0x9edd('0x4c')](_['pick'](_0x337e6c[_0x9edd('0x42')],_0x1ccee8[_0x9edd('0x4c')]),_0x51a54a);if(_0x337e6c[_0x9edd('0x42')][_0x9edd('0x4d')]){_0x1cbbac[_0x9edd('0x4b')]=_[_0x9edd('0x4e')](_0x1cbbac[_0x9edd('0x4b')],{'$or':_['map'](_0x51a54a,function(_0x4a4656){if(_0x4a4656['type']!==_0x9edd('0x4f')){var _0x58a1dd={};_0x58a1dd[_0x4a4656[_0x9edd('0x3a')]]={'$like':'%'+_0x337e6c[_0x9edd('0x42')][_0x9edd('0x4d')]+'%'};return _0x58a1dd;}})});}_0x1cbbac=_[_0x9edd('0x4e')]({},_0x1cbbac,_0x337e6c[_0x9edd('0x50')]);var _0x53005b={'where':_0x1cbbac[_0x9edd('0x4b')]};return db[_0x9edd('0x51')][_0x9edd('0x33')](_0x53005b)['then'](function(_0x3626bc){_0x35c16f[_0x9edd('0x33')]=_0x3626bc;if(_0x337e6c[_0x9edd('0x42')][_0x9edd('0x52')]){_0x1cbbac[_0x9edd('0x53')]=[{'all':!![]}];}return db[_0x9edd('0x51')]['findAll'](_0x1cbbac);})[_0x9edd('0x22')](function(_0x237e91){_0x35c16f['rows']=_0x237e91;return _0x35c16f;})[_0x9edd('0x22')](respondWithFilteredResult(_0x5c0627,_0x1cbbac))[_0x9edd('0x2b')](handleError(_0x5c0627,null));};exports['show']=function(_0x2bd089,_0x8134cd){var _0x468239={'raw':!![],'where':{'id':_0x2bd089[_0x9edd('0x54')]['id']}},_0x5215b0={};_0x5215b0[_0x9edd('0x44')]=_[_0x9edd('0x55')](db[_0x9edd('0x51')]['rawAttributes']);_0x5215b0[_0x9edd('0x42')]=_[_0x9edd('0x55')](_0x2bd089[_0x9edd('0x42')]);_0x5215b0['filters']=_[_0x9edd('0x43')](_0x5215b0[_0x9edd('0x44')],_0x5215b0['query']);_0x468239[_0x9edd('0x45')]=_['intersection'](_0x5215b0[_0x9edd('0x44')],qs[_0x9edd('0x46')](_0x2bd089[_0x9edd('0x42')][_0x9edd('0x46')]));_0x468239[_0x9edd('0x45')]=_0x468239[_0x9edd('0x45')][_0x9edd('0x47')]?_0x468239[_0x9edd('0x45')]:_0x5215b0[_0x9edd('0x44')];if(_0x2bd089[_0x9edd('0x42')][_0x9edd('0x52')]){_0x468239['include']=[{'all':!![]}];}_0x468239=_[_0x9edd('0x4e')]({},_0x468239,_0x2bd089[_0x9edd('0x50')]);return db[_0x9edd('0x51')]['find'](_0x468239)[_0x9edd('0x22')](handleEntityNotFound(_0x8134cd,null))['then'](respondWithResult(_0x8134cd,null))['catch'](handleError(_0x8134cd,null));};exports['create']=function(_0x1348a7,_0x45f47c){return db[_0x9edd('0x51')][_0x9edd('0x56')](_0x1348a7['body'],{})['then'](respondWithResult(_0x45f47c,0xc9))['catch'](handleError(_0x45f47c,null));};exports[_0x9edd('0x38')]=function(_0x5f666b,_0xd5090a){if(_0x5f666b[_0x9edd('0x57')]['id']){delete _0x5f666b[_0x9edd('0x57')]['id'];}return db[_0x9edd('0x51')][_0x9edd('0x58')]({'where':{'id':_0x5f666b[_0x9edd('0x54')]['id']}})['then'](handleEntityNotFound(_0xd5090a,null))[_0x9edd('0x22')](saveUpdates(_0x5f666b['body'],null))[_0x9edd('0x22')](respondWithResult(_0xd5090a,null))[_0x9edd('0x2b')](handleError(_0xd5090a,null));};exports['destroy']=function(_0x22b91a,_0x322359){return db[_0x9edd('0x51')]['find']({'where':{'id':_0x22b91a[_0x9edd('0x54')]['id']}})[_0x9edd('0x22')](handleEntityNotFound(_0x322359,null))[_0x9edd('0x22')](removeEntity(_0x322359,null))[_0x9edd('0x2b')](handleError(_0x322359,null));};exports[_0x9edd('0x59')]=function(_0x2c3173,_0x53f55b){return db['WhatsappMessage'][_0x9edd('0x59')]()['then'](respondWithResult(_0x53f55b,null))[_0x9edd('0x2b')](handleError(_0x53f55b,null));};var interaction_log=require(_0x9edd('0x13'))(_0x9edd('0x5a'));exports[_0x9edd('0x5b')]=function(_0x5df1d7,_0x21ead2,_0x507cce){var _0x3e5dca={'agent':{},'channel':_0x9edd('0x5c')};if(_0x5df1d7[_0x9edd('0x57')]['id']){delete _0x5df1d7['body']['id'];}_0x5df1d7[_0x9edd('0x57')]['read']=!![];_0x5df1d7[_0x9edd('0x57')][_0x9edd('0x5d')]=moment()['format'](_0x9edd('0x5e'));_0x5df1d7['body'][_0x9edd('0x5f')]=_0x5df1d7[_0x9edd('0x57')][_0x9edd('0x5f')]||_0x5df1d7['user']['id'];_0x3e5dca[_0x9edd('0x60')]['id']=_0x5df1d7[_0x9edd('0x57')][_0x9edd('0x5f')];return db[_0x9edd('0x51')][_0x9edd('0x58')]({'where':{'id':_0x5df1d7['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9edd('0x61')}]})[_0x9edd('0x22')](handleEntityNotFound(_0x21ead2,null))['then'](saveUpdates(_0x5df1d7['body'],null))['then'](function(_0x1bc89b){if(_0x1bc89b){_0x3e5dca['message']=_0x1bc89b['get']({'plain':!![]});return db[_0x9edd('0x62')][_0x9edd('0x58')]({'where':{'id':_0x1bc89b['WhatsappInteractionId']}});}return null;})[_0x9edd('0x22')](handleEntityNotFound(_0x21ead2,null))[_0x9edd('0x22')](function(_0x34dff5){if(_0x34dff5){return _0x34dff5['update']({'UserId':_0x5df1d7[_0x9edd('0x57')]['UserId'],'read1stAt':_[_0x9edd('0x63')](_0x34dff5[_0x9edd('0x64')])?moment()['format'](_0x9edd('0x5e')):undefined});}return null;})[_0x9edd('0x22')](function(_0x5c1746){if(_0x5c1746){_0x3e5dca[_0x9edd('0x65')]=_0x5c1746[_0x9edd('0x66')]({'plain':!![]});interaction_log[_0x9edd('0x23')](_0x9edd('0x67'),_0x5df1d7['user']['id'],_0x5df1d7[_0x9edd('0x68')]['name'],_0x5df1d7[_0x9edd('0x68')][_0x9edd('0x69')],_0x3e5dca[_0x9edd('0x65')]['id'],_0x5df1d7['body']?JSON[_0x9edd('0x26')](_0x5df1d7[_0x9edd('0x57')]):_0x9edd('0x6a'));return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x6c'),_0x3e5dca);}return null;})[_0x9edd('0x22')](function(_0x3fa4a9){return db['CmContact']['describe']()[_0x9edd('0x22')](function(_0x3c7874){var _0x13254e=[];for(var _0x171403=0x0;_0x171403=_0x17d583){_0x35093a=_0x17d583;_0x590cea=0xc8;}else{_0x590cea=0xce;}_0x487751[_0x73cb('0x1f')](_0x590cea);return _0x487751[_0x73cb('0x25')]('Content-Range',_0x8eef2d+'-'+_0x35093a+'/'+_0x17d583)['json'](_0x1b2a83);}return null;};}function patchUpdates(_0x5a030e){return function(_0x5550b0){try{jsonpatch['apply'](_0x5550b0,_0x5a030e,!![]);}catch(_0x310013){return BPromise[_0x73cb('0x26')](_0x310013);}return _0x5550b0[_0x73cb('0x27')]();};}function saveUpdates(_0x489db3,_0x2574e1){return function(_0x757511){if(_0x757511){return _0x757511[_0x73cb('0x28')](_0x489db3)[_0x73cb('0x29')](function(_0x263dd6){return _0x263dd6;});}return null;};}function removeEntity(_0x28cac5,_0x58eb8a){return function(_0x1afa3e){if(_0x1afa3e){return _0x1afa3e[_0x73cb('0x2a')]()['then'](function(){var _0x1981ae=_0x1afa3e[_0x73cb('0x2b')]({'plain':!![]});var _0x543553='WhatsappQueues';return db['UserProfileResource'][_0x73cb('0x2a')]({'where':{'type':_0x543553,'resourceId':_0x1981ae['id']}})[_0x73cb('0x29')](function(){return _0x1afa3e;});})['then'](function(){_0x28cac5[_0x73cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x350820,_0x2cd5a2){return function(_0x175be6){if(!_0x175be6){_0x350820[_0x73cb('0x2c')](0x194);}return _0x175be6;};}function handleError(_0x9a2833,_0xc0f5f7){_0xc0f5f7=_0xc0f5f7||0x1f4;return function(_0x4552e1){logger[_0x73cb('0x2d')](_0x4552e1[_0x73cb('0x2e')]);if(_0x4552e1[_0x73cb('0x2f')]){delete _0x4552e1[_0x73cb('0x2f')];}_0x9a2833[_0x73cb('0x1f')](_0xc0f5f7)[_0x73cb('0x30')](_0x4552e1);};}exports[_0x73cb('0x31')]=function(_0x5be308,_0x5f0f19){var _0x27e019={},_0x1e3a46={},_0x411839={'count':0x0,'rows':[]};var _0x543e70=_['map'](db['WhatsappQueue'][_0x73cb('0x32')],function(_0x1e700f){return{'name':_0x1e700f[_0x73cb('0x33')],'type':_0x1e700f['type'][_0x73cb('0x34')]};});_0x1e3a46[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x543e70,'name');_0x1e3a46[_0x73cb('0x37')]=_['keys'](_0x5be308[_0x73cb('0x37')]);_0x1e3a46['filters']=_['intersection'](_0x1e3a46[_0x73cb('0x35')],_0x1e3a46['query']);_0x27e019[_0x73cb('0x38')]=_[_0x73cb('0x39')](_0x1e3a46[_0x73cb('0x35')],qs[_0x73cb('0x3a')](_0x5be308['query']['fields']));_0x27e019[_0x73cb('0x38')]=_0x27e019[_0x73cb('0x38')][_0x73cb('0x3b')]?_0x27e019[_0x73cb('0x38')]:_0x1e3a46[_0x73cb('0x35')];if(!_0x5be308[_0x73cb('0x37')][_0x73cb('0x3c')](_0x73cb('0x3d'))){_0x27e019['limit']=qs[_0x73cb('0x22')](_0x5be308[_0x73cb('0x37')][_0x73cb('0x22')]);_0x27e019[_0x73cb('0x23')]=qs[_0x73cb('0x23')](_0x5be308[_0x73cb('0x37')][_0x73cb('0x23')]);}_0x27e019['order']=qs[_0x73cb('0x3e')](_0x5be308[_0x73cb('0x37')][_0x73cb('0x3e')]);_0x27e019['where']=qs['filters'](_[_0x73cb('0x3f')](_0x5be308['query'],_0x1e3a46[_0x73cb('0x40')]),_0x543e70);if(_0x5be308[_0x73cb('0x37')][_0x73cb('0x41')]){_0x27e019['where']=_[_0x73cb('0x42')](_0x27e019['where'],{'$or':_[_0x73cb('0x36')](_0x543e70,function(_0xee3e25){if(_0xee3e25[_0x73cb('0x43')]!==_0x73cb('0x44')){var _0x29336e={};_0x29336e[_0xee3e25[_0x73cb('0x2f')]]={'$like':'%'+_0x5be308[_0x73cb('0x37')][_0x73cb('0x41')]+'%'};return _0x29336e;}})});}_0x27e019=_[_0x73cb('0x42')]({},_0x27e019,_0x5be308[_0x73cb('0x45')]);var _0x2a95a7={'where':_0x27e019[_0x73cb('0x46')]};return db[_0x73cb('0x47')][_0x73cb('0x24')](_0x2a95a7)[_0x73cb('0x29')](function(_0x3c7e57){_0x411839[_0x73cb('0x24')]=_0x3c7e57;if(_0x5be308[_0x73cb('0x37')]['includeAll']){_0x27e019['include']=[{'all':!![]}];}return db[_0x73cb('0x47')][_0x73cb('0x48')](_0x27e019);})[_0x73cb('0x29')](function(_0x159519){_0x411839[_0x73cb('0x49')]=_0x159519;return _0x411839;})[_0x73cb('0x29')](respondWithFilteredResult(_0x5f0f19,_0x27e019))[_0x73cb('0x4a')](handleError(_0x5f0f19,null));};exports[_0x73cb('0x4b')]=function(_0x374913,_0xf844cd){var _0x4402e7={'raw':!![],'where':{'id':_0x374913[_0x73cb('0x4c')]['id']}},_0x4cf24f={};_0x4cf24f[_0x73cb('0x35')]=_[_0x73cb('0x4d')](db[_0x73cb('0x47')][_0x73cb('0x32')]);_0x4cf24f[_0x73cb('0x37')]=_[_0x73cb('0x4d')](_0x374913[_0x73cb('0x37')]);_0x4cf24f[_0x73cb('0x40')]=_[_0x73cb('0x39')](_0x4cf24f[_0x73cb('0x35')],_0x4cf24f[_0x73cb('0x37')]);_0x4402e7[_0x73cb('0x38')]=_[_0x73cb('0x39')](_0x4cf24f[_0x73cb('0x35')],qs[_0x73cb('0x3a')](_0x374913[_0x73cb('0x37')][_0x73cb('0x3a')]));_0x4402e7[_0x73cb('0x38')]=_0x4402e7['attributes'][_0x73cb('0x3b')]?_0x4402e7[_0x73cb('0x38')]:_0x4cf24f[_0x73cb('0x35')];if(_0x374913['query'][_0x73cb('0x4e')]){_0x4402e7['include']=[{'all':!![]}];}_0x4402e7=_['merge']({},_0x4402e7,_0x374913[_0x73cb('0x45')]);return db[_0x73cb('0x47')][_0x73cb('0x4f')](_0x4402e7)['then'](handleEntityNotFound(_0xf844cd,null))[_0x73cb('0x29')](respondWithResult(_0xf844cd,null))['catch'](handleError(_0xf844cd,null));};exports[_0x73cb('0x50')]=function(_0x1284f6,_0x4c47b1){return db[_0x73cb('0x47')][_0x73cb('0x50')](_0x1284f6[_0x73cb('0x51')],{})[_0x73cb('0x29')](function(_0x33d847){var _0x6e3c2e=_0x1284f6[_0x73cb('0x52')]['get']({'plain':!![]});if(!_0x6e3c2e)throw new Error(_0x73cb('0x53'));if(_0x6e3c2e[_0x73cb('0x54')]===_0x73cb('0x52')){var _0x408324=_0x33d847['get']({'plain':!![]});var _0xa909fe='WhatsappQueues';return db[_0x73cb('0x55')]['find']({'where':{'name':_0xa909fe,'userProfileId':_0x6e3c2e[_0x73cb('0x56')]},'raw':!![]})[_0x73cb('0x29')](function(_0x5c9731){if(_0x5c9731&&_0x5c9731['autoAssociation']===0x0){return db[_0x73cb('0x57')]['create']({'name':_0x408324['name'],'resourceId':_0x408324['id'],'type':_0x5c9731[_0x73cb('0x2f')],'sectionId':_0x5c9731['id']},{})['then'](function(){return _0x33d847;});}else{return _0x33d847;}})[_0x73cb('0x4a')](function(_0x19af7a){logger[_0x73cb('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19af7a);throw _0x19af7a;});}return _0x33d847;})[_0x73cb('0x29')](respondWithResult(_0x4c47b1,0xc9))[_0x73cb('0x4a')](handleError(_0x4c47b1,null));};exports[_0x73cb('0x28')]=function(_0x345712,_0x15ee0f){if(_0x345712['body']['id']){delete _0x345712[_0x73cb('0x51')]['id'];}return db[_0x73cb('0x47')][_0x73cb('0x4f')]({'where':{'id':_0x345712[_0x73cb('0x4c')]['id']}})[_0x73cb('0x29')](handleEntityNotFound(_0x15ee0f,null))['then'](saveUpdates(_0x345712['body'],null))[_0x73cb('0x29')](respondWithResult(_0x15ee0f,null))[_0x73cb('0x4a')](handleError(_0x15ee0f,null));};exports['destroy']=function(_0xbfae01,_0x102d3b){return db[_0x73cb('0x47')][_0x73cb('0x4f')]({'where':{'id':_0xbfae01[_0x73cb('0x4c')]['id']}})[_0x73cb('0x29')](handleEntityNotFound(_0x102d3b,null))[_0x73cb('0x29')](removeEntity(_0x102d3b,null))['catch'](handleError(_0x102d3b,null));};exports['describe']=function(_0x19fc2d,_0x5a0b0b){return db[_0x73cb('0x47')][_0x73cb('0x58')]()[_0x73cb('0x29')](respondWithResult(_0x5a0b0b,null))[_0x73cb('0x4a')](handleError(_0x5a0b0b,null));};exports[_0x73cb('0x59')]=function(_0x530880,_0x186703,_0x4e091f){var _0x5aa4a0={'raw':!![],'where':{}},_0xd384c9={},_0x32e772;return db['WhatsappQueue']['findOne']({'where':{'id':_0x530880[_0x73cb('0x4c')]['id']}})[_0x73cb('0x29')](handleEntityNotFound(_0x186703,null))['then'](function(_0x78de2e){if(_0x78de2e){_0x32e772=_0x78de2e['get']({'plain':!![]});_0xd384c9['model']=_[_0x73cb('0x4d')](db[_0x73cb('0x5a')][_0x73cb('0x32')]);_0xd384c9['query']=_['keys'](_0x530880[_0x73cb('0x37')]);_0xd384c9[_0x73cb('0x40')]=_[_0x73cb('0x39')](_0xd384c9[_0x73cb('0x35')],_0xd384c9[_0x73cb('0x37')]);_0x5aa4a0[_0x73cb('0x38')]=_[_0x73cb('0x39')](_0xd384c9[_0x73cb('0x35')],qs['fields'](_0x530880[_0x73cb('0x37')][_0x73cb('0x3a')]));_0x5aa4a0['attributes']=_0x5aa4a0[_0x73cb('0x38')][_0x73cb('0x3b')]?_0x5aa4a0[_0x73cb('0x38')]:_0xd384c9[_0x73cb('0x35')];if(!_0x530880[_0x73cb('0x37')]['hasOwnProperty'](_0x73cb('0x3d'))){_0x5aa4a0[_0x73cb('0x22')]=qs[_0x73cb('0x22')](_0x530880[_0x73cb('0x37')][_0x73cb('0x22')]);_0x5aa4a0[_0x73cb('0x23')]=qs[_0x73cb('0x23')](_0x530880[_0x73cb('0x37')][_0x73cb('0x23')]);}_0x5aa4a0[_0x73cb('0x5b')]=qs['sort'](_0x530880[_0x73cb('0x37')][_0x73cb('0x3e')]);_0x5aa4a0[_0x73cb('0x46')]=qs[_0x73cb('0x40')](_[_0x73cb('0x3f')](_0x530880[_0x73cb('0x37')],_0xd384c9['filters']));_0x5aa4a0[_0x73cb('0x46')][_0x73cb('0x5c')]=_0x78de2e['id'];if(_0x530880['query'][_0x73cb('0x41')]){_0x5aa4a0[_0x73cb('0x46')]=_[_0x73cb('0x42')](_0x5aa4a0[_0x73cb('0x46')],{'$or':_['map'](_0x5aa4a0[_0x73cb('0x38')],function(_0x34e1bf){var _0x218365={};_0x218365[_0x34e1bf]={'$like':'%'+_0x530880[_0x73cb('0x37')][_0x73cb('0x41')]+'%'};return _0x218365;})});}_0x5aa4a0=_['merge']({},_0x5aa4a0,_0x530880[_0x73cb('0x45')]);return db['UserWhatsappQueue'][_0x73cb('0x48')](_0x5aa4a0);}})[_0x73cb('0x29')](function(_0x4629d5){if(_0x4629d5){return db[_0x73cb('0x5d')][_0x73cb('0x5e')]({'where':{'id':_[_0x73cb('0x36')](_0x4629d5,_0x73cb('0x5f')),'role':_0x73cb('0x60')},'attributes':['id',_0x73cb('0x2f'),_0x73cb('0x61'),'updatedAt',_0x73cb('0x62')]});}})[_0x73cb('0x29')](function(_0x4b0087){if(_0x4b0087){return{'count':_0x4b0087[_0x73cb('0x24')],'rows':_['map'](_0x4b0087[_0x73cb('0x49')],function(_0x41a1dc){return{'membername':_0x41a1dc[_0x73cb('0x2f')],'UserId':_0x41a1dc['id'],'queue_name':_0x32e772[_0x73cb('0x2f')],'WhatsappQueueId':_0x32e772['id'],'interface':util[_0x73cb('0x63')](_0x73cb('0x64'),_0x73cb('0x65'),_0x41a1dc[_0x73cb('0x2f')]),'penalty':0x0,'paused':_0x41a1dc[_0x73cb('0x61')],'createdAt':_0x41a1dc[_0x73cb('0x62')],'updatedAt':_0x41a1dc[_0x73cb('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x186703,_0x5aa4a0))[_0x73cb('0x4a')](handleError(_0x186703,null));};exports[_0x73cb('0x67')]=function(_0x745352,_0x457fad,_0x4e512f){var _0x2f3e52={};var _0x3409c6={};var _0x4897c5;var _0x1057ec;return db[_0x73cb('0x47')]['findOne']({'where':{'id':_0x745352[_0x73cb('0x4c')]['id']}})[_0x73cb('0x29')](handleEntityNotFound(_0x457fad,null))[_0x73cb('0x29')](function(_0x32eb51){if(_0x32eb51){_0x4897c5=_0x32eb51;_0x3409c6[_0x73cb('0x35')]=_[_0x73cb('0x4d')](db[_0x73cb('0x68')][_0x73cb('0x32')]);_0x3409c6[_0x73cb('0x37')]=_['keys'](_0x745352[_0x73cb('0x37')]);_0x3409c6[_0x73cb('0x40')]=_[_0x73cb('0x39')](_0x3409c6[_0x73cb('0x35')],_0x3409c6[_0x73cb('0x37')]);_0x2f3e52[_0x73cb('0x38')]=_[_0x73cb('0x39')](_0x3409c6[_0x73cb('0x35')],qs['fields'](_0x745352['query'][_0x73cb('0x3a')]));_0x2f3e52['attributes']=_0x2f3e52[_0x73cb('0x38')][_0x73cb('0x3b')]?_0x2f3e52[_0x73cb('0x38')]:_0x3409c6[_0x73cb('0x35')];_0x2f3e52[_0x73cb('0x5b')]=qs[_0x73cb('0x3e')](_0x745352['query'][_0x73cb('0x3e')]);_0x2f3e52[_0x73cb('0x46')]=qs['filters'](_[_0x73cb('0x3f')](_0x745352[_0x73cb('0x37')],_0x3409c6[_0x73cb('0x40')]));if(_0x745352[_0x73cb('0x37')][_0x73cb('0x41')]){_0x2f3e52[_0x73cb('0x46')]=_[_0x73cb('0x42')](_0x2f3e52[_0x73cb('0x46')],{'$or':_['map'](_0x2f3e52[_0x73cb('0x38')],function(_0x4fab5c){var _0x4449d1={};_0x4449d1[_0x4fab5c]={'$like':'%'+_0x745352[_0x73cb('0x37')][_0x73cb('0x41')]+'%'};return _0x4449d1;})});}_0x2f3e52=_[_0x73cb('0x42')]({},_0x2f3e52,_0x745352['options']);return _0x4897c5[_0x73cb('0x67')](_0x2f3e52);}})[_0x73cb('0x29')](function(_0xd2e02d){if(_0xd2e02d){_0x1057ec=_0xd2e02d[_0x73cb('0x3b')];if(!_0x745352[_0x73cb('0x37')][_0x73cb('0x3c')](_0x73cb('0x3d'))){_0x2f3e52[_0x73cb('0x22')]=qs[_0x73cb('0x22')](_0x745352[_0x73cb('0x37')][_0x73cb('0x22')]);_0x2f3e52['offset']=qs[_0x73cb('0x23')](_0x745352[_0x73cb('0x37')]['offset']);}return _0x4897c5[_0x73cb('0x67')](_0x2f3e52);}})[_0x73cb('0x29')](function(_0x268f55){if(_0x268f55){return _0x268f55?{'count':_0x1057ec,'rows':_0x268f55}:null;}})[_0x73cb('0x29')](respondWithResult(_0x457fad,null))[_0x73cb('0x4a')](handleError(_0x457fad,null));};exports['addTeams']=function(_0x3f4b81,_0x45e3c5,_0x5b07ec){var _0x5a9f4c=_0x3f4b81[_0x73cb('0x51')][_0x73cb('0x69')];return db[_0x73cb('0x68')][_0x73cb('0x48')]({'where':{'id':_0x5a9f4c},'attributes':['id'],'include':[{'model':db[_0x73cb('0x5d')],'as':_0x73cb('0x6a'),'attributes':['id',_0x73cb('0x2f'),_0x73cb('0x6b'),_0x73cb('0x6c'),_0x73cb('0x6d')],'raw':!![]}]})[_0x73cb('0x29')](function(_0x19b676){if(_0x19b676){var _0x5880ec=_['flatMap'](_0x19b676,function(_0xfce5fb){var _0x511b93=_0xfce5fb['get']({'plain':!![]});return _0x511b93['Agents'];});return db[_0x73cb('0x47')][_0x73cb('0x4f')]({'where':{'id':_0x3f4b81[_0x73cb('0x4c')]['id']}})[_0x73cb('0x29')](function(_0x3358d0){return db[_0x73cb('0x6e')][_0x73cb('0x6f')](function(_0x41022a){return _0x3358d0[_0x73cb('0x70')](_0x5a9f4c,{'transaction':_0x41022a})[_0x73cb('0x29')](function(){return BPromise[_0x73cb('0x71')](_0x5880ec,function(_0x165932){return db['UserWhatsappQueue'][_0x73cb('0x72')]({'where':{'UserId':_0x165932['id'],'WhatsappQueueId':_0x3f4b81[_0x73cb('0x4c')]['id']},'transaction':_0x41022a});});})[_0x73cb('0x29')](function(){_0x5880ec['forEach'](function(_0x511030){socket[_0x73cb('0x73')](_0x73cb('0x74'),{'UserId':_0x511030['id'],'WhatsappQueueId':_0x3358d0['id']});});});});});}})[_0x73cb('0x29')](respondWithStatusCode(_0x45e3c5,null))[_0x73cb('0x4a')](handleError(_0x45e3c5,null));};exports[_0x73cb('0x75')]=function(_0x5129b5,_0x164108,_0x486f21){return db[_0x73cb('0x68')][_0x73cb('0x48')]({'where':{'id':_0x5129b5[_0x73cb('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x73cb('0x5d')],'as':_0x73cb('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x164108,null))['then'](function(_0x13c0e3){var _0x384485=_[_0x73cb('0x36')](_0x13c0e3,'id');var _0x42227a=[];var _0x3b0493=[];var _0x1a09fc=squel[_0x73cb('0x76')]();_0x1a09fc[_0x73cb('0x77')](_0x73cb('0x78'))[_0x73cb('0x79')](_0x73cb('0x7a'),'tq')[_0x73cb('0x7b')](_0x73cb('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x73cb('0x7d'),_0x5129b5[_0x73cb('0x4c')]['id']);for(var _0x5da54b=0x0;_0x5da54b<_0x13c0e3[_0x73cb('0x3b')];_0x5da54b+=0x1){let _0x3d2733=_0x13c0e3[_0x5da54b];for(var _0x5c6085=0x0;_0x5c6085<_0x3d2733[_0x73cb('0x6a')][_0x73cb('0x3b')];_0x5c6085+=0x1){let _0x3446a0=_0x3d2733['Agents'][_0x5c6085];var _0x247405=_0x1a09fc['clone']();_0x247405[_0x73cb('0x46')]('ut.UserId\x20=\x20?',_0x3446a0['id']);_0x3b0493[_0x73cb('0x7e')](db[_0x73cb('0x6e')]['query'](_0x247405[_0x73cb('0x7f')](),{'type':db[_0x73cb('0x6e')][_0x73cb('0x80')][_0x73cb('0x81')]})[_0x73cb('0x29')](function(_0x3f4421){if(_0x3f4421[_0x73cb('0x3b')]===0x1){return _0x3446a0['id'];}else{var _0x11bd0b=_[_0x73cb('0x82')](_[_0x73cb('0x36')](_0x3f4421,'TeamId'),function(_0xd55505){return _['includes'](_0x384485,_0xd55505);});if(_0x11bd0b){return _0x3446a0['id'];}}}));}}return BPromise[_0x73cb('0x83')](_0x3b0493)['then'](function(_0x537367){_0x42227a=_(_0x42227a)[_0x73cb('0x84')](_0x537367)[_0x73cb('0x85')]()[_0x73cb('0x86')]();return db[_0x73cb('0x47')][_0x73cb('0x4f')]({'where':{'id':_0x5129b5[_0x73cb('0x4c')]['id']}})[_0x73cb('0x29')](function(_0x25011c){return db[_0x73cb('0x6e')][_0x73cb('0x6f')](function(_0x480dc8){return _0x25011c[_0x73cb('0x75')](_0x5129b5['query'][_0x73cb('0x69')],{'transaction':_0x480dc8})[_0x73cb('0x29')](function(){if(!_['isEmpty'](_0x42227a)){return _0x25011c['removeAgents'](_0x42227a,{'transaction':_0x480dc8});}})['then'](function(){_0x42227a['forEach'](function(_0xf40fca){socket[_0x73cb('0x73')](_0x73cb('0x87'),{'UserId':_0xf40fca,'WhatsappQueueId':_0x25011c['id']});});});});});});})[_0x73cb('0x29')](respondWithStatusCode(_0x164108,null))[_0x73cb('0x4a')](handleError(_0x164108,null));};exports[_0x73cb('0x88')]=function(_0x563eab,_0x1fa773,_0x1ea69d){return db[_0x73cb('0x47')]['find']({'where':{'id':_0x563eab[_0x73cb('0x4c')]['id']}})[_0x73cb('0x29')](handleEntityNotFound(_0x1fa773,null))[_0x73cb('0x29')](function(_0xe9209b){if(_0xe9209b){return _0xe9209b[_0x73cb('0x88')](_0x563eab[_0x73cb('0x51')]['ids'],_[_0x73cb('0x89')](_0x563eab[_0x73cb('0x51')],[_0x73cb('0x69'),'id'])||{})[_0x73cb('0x8a')](function(_0x10d487){for(var _0x2e2fc9=0x0;_0x2e2fc9<_0x563eab[_0x73cb('0x51')][_0x73cb('0x69')][_0x73cb('0x3b')];_0x2e2fc9+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x563eab[_0x73cb('0x51')][_0x73cb('0x69')][_0x2e2fc9],'WhatsappQueueId':_0x563eab['params']['id']});}return _0x10d487;});}})[_0x73cb('0x29')](respondWithResult(_0x1fa773,null))[_0x73cb('0x4a')](handleError(_0x1fa773,null));};exports[_0x73cb('0x8b')]=function(_0x10dc6c,_0x3b56f8,_0xb7f230){return db[_0x73cb('0x47')][_0x73cb('0x4f')]({'where':{'id':_0x10dc6c[_0x73cb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b56f8,null))[_0x73cb('0x29')](function(_0xbd72da){if(_0xbd72da){return _0xbd72da[_0x73cb('0x8b')](_0x10dc6c[_0x73cb('0x37')][_0x73cb('0x69')])[_0x73cb('0x29')](function(){if(_[_0x73cb('0x8c')](_0x10dc6c[_0x73cb('0x37')][_0x73cb('0x69')])){for(var _0x4e1d4c=0x0;_0x4e1d4c<_0x10dc6c['query'][_0x73cb('0x69')][_0x73cb('0x3b')];_0x4e1d4c+=0x1){socket[_0x73cb('0x73')](_0x73cb('0x87'),{'UserId':Number(_0x10dc6c[_0x73cb('0x37')][_0x73cb('0x69')][_0x4e1d4c]),'WhatsappQueueId':Number(_0x10dc6c[_0x73cb('0x4c')]['id'])});}}else{socket['emit'](_0x73cb('0x87'),{'UserId':Number(_0x10dc6c['query'][_0x73cb('0x69')]),'WhatsappQueueId':Number(_0x10dc6c[_0x73cb('0x4c')]['id'])});}});}})[_0x73cb('0x29')](respondWithStatusCode(_0x3b56f8,null))[_0x73cb('0x4a')](handleError(_0x3b56f8,null));};exports[_0x73cb('0x8d')]=function(_0x193d66,_0x563cac,_0x5bf54c){var _0x15a38e={};var _0x3a0452={};var _0x3b2dac;var _0x1f7da6;return db[_0x73cb('0x47')][_0x73cb('0x8e')]({'where':{'id':_0x193d66[_0x73cb('0x4c')]['id']}})[_0x73cb('0x29')](handleEntityNotFound(_0x563cac,null))[_0x73cb('0x29')](function(_0x3efb3b){if(_0x3efb3b){_0x3b2dac=_0x3efb3b;_0x3a0452['model']=_[_0x73cb('0x4d')](db[_0x73cb('0x5d')]['rawAttributes']);_0x3a0452[_0x73cb('0x37')]=_[_0x73cb('0x4d')](_0x193d66[_0x73cb('0x37')]);_0x3a0452[_0x73cb('0x40')]=_[_0x73cb('0x39')](_0x3a0452[_0x73cb('0x35')],_0x3a0452[_0x73cb('0x37')]);_0x15a38e[_0x73cb('0x38')]=_[_0x73cb('0x39')](_0x3a0452[_0x73cb('0x35')],qs[_0x73cb('0x3a')](_0x193d66['query'][_0x73cb('0x3a')]));_0x15a38e[_0x73cb('0x38')]=_0x15a38e['attributes'][_0x73cb('0x3b')]?_0x15a38e[_0x73cb('0x38')]:_0x3a0452[_0x73cb('0x35')];_0x15a38e[_0x73cb('0x5b')]=qs[_0x73cb('0x3e')](_0x193d66[_0x73cb('0x37')]['sort']);_0x15a38e['where']=qs[_0x73cb('0x40')](_['pick'](_0x193d66['query'],_0x3a0452[_0x73cb('0x40')]));if(_0x193d66[_0x73cb('0x37')][_0x73cb('0x41')]){_0x15a38e[_0x73cb('0x46')]=_[_0x73cb('0x42')](_0x15a38e['where'],{'$or':_[_0x73cb('0x36')](_0x15a38e[_0x73cb('0x38')],function(_0x139d45){var _0x78decf={};_0x78decf[_0x139d45]={'$like':'%'+_0x193d66['query']['filter']+'%'};return _0x78decf;})});}_0x15a38e=_[_0x73cb('0x42')]({},_0x15a38e,_0x193d66[_0x73cb('0x45')]);return _0x3b2dac['getAgents'](_0x15a38e);}})['then'](function(_0x380e32){if(_0x380e32){_0x1f7da6=_0x380e32[_0x73cb('0x3b')];if(!_0x193d66[_0x73cb('0x37')]['hasOwnProperty'](_0x73cb('0x3d'))){_0x15a38e['limit']=qs[_0x73cb('0x22')](_0x193d66['query'][_0x73cb('0x22')]);_0x15a38e[_0x73cb('0x23')]=qs[_0x73cb('0x23')](_0x193d66[_0x73cb('0x37')][_0x73cb('0x23')]);}return _0x3b2dac[_0x73cb('0x8d')](_0x15a38e);}})[_0x73cb('0x29')](function(_0xeb1aba){if(_0xeb1aba){return _0xeb1aba?{'count':_0x1f7da6,'rows':_0xeb1aba}:null;}})[_0x73cb('0x29')](respondWithResult(_0x563cac,null))[_0x73cb('0x4a')](handleError(_0x563cac,null));}; \ No newline at end of file +var _0xa2ab=['tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','WhatsappQueues','UserProfileResource','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','params','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','keys','UserWhatsappQueue','sort','WhatsappQueueId','options','User','findAndCountAll','agent','createdAt','SIP','whatsappPause','updatedAt','getTeams','findOne','order','addTeams','ids','Team','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','Agents','select','field'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa2ab,0xa7));var _0xba2a=function(_0x3a00f6,_0x1bf634){_0x3a00f6=_0x3a00f6-0x0;var _0x151ff5=_0xa2ab[_0x3a00f6];return _0x151ff5;};'use strict';var emlformat=require(_0xba2a('0x0'));var rimraf=require(_0xba2a('0x1'));var zipdir=require(_0xba2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba2a('0x3'));var moment=require(_0xba2a('0x4'));var BPromise=require(_0xba2a('0x5'));var Mustache=require(_0xba2a('0x6'));var util=require(_0xba2a('0x7'));var path=require(_0xba2a('0x8'));var sox=require(_0xba2a('0x9'));var csv=require('to-csv');var ejs=require(_0xba2a('0xa'));var fs=require('fs');var fs_extra=require(_0xba2a('0xb'));var _=require(_0xba2a('0xc'));var squel=require('squel');var crypto=require(_0xba2a('0xd'));var jsforce=require(_0xba2a('0xe'));var deskjs=require(_0xba2a('0xf'));var toCsv=require(_0xba2a('0x10'));var querystring=require('querystring');var Papa=require(_0xba2a('0x11'));var Redis=require(_0xba2a('0x12'));var authService=require(_0xba2a('0x13'));var qs=require(_0xba2a('0x14'));var as=require(_0xba2a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba2a('0x16'))(_0xba2a('0x17'));var utils=require(_0xba2a('0x18'));var config=require(_0xba2a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xba2a('0x1a'))['db'];config[_0xba2a('0x1b')]=_[_0xba2a('0x1c')](config[_0xba2a('0x1b')],{'host':_0xba2a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba2a('0x1b')]));require(_0xba2a('0x1e'))[_0xba2a('0x1f')](socket);function respondWithStatusCode(_0x127c42,_0x5352fa){_0x5352fa=_0x5352fa||0xcc;return function(_0x26ea93){if(_0x26ea93){return _0x127c42[_0xba2a('0x20')](_0x5352fa);}return _0x127c42[_0xba2a('0x21')](_0x5352fa)[_0xba2a('0x22')]();};}function respondWithResult(_0x4b9f63,_0x404885){_0x404885=_0x404885||0xc8;return function(_0x25f517){if(_0x25f517){return _0x4b9f63['status'](_0x404885)[_0xba2a('0x23')](_0x25f517);}};}function respondWithFilteredResult(_0x49c57e,_0x5d40f6){return function(_0x559c6e){if(_0x559c6e){var _0x283846=typeof _0x5d40f6[_0xba2a('0x24')]===_0xba2a('0x25')&&typeof _0x5d40f6[_0xba2a('0x26')]==='undefined';var _0x437e4c=_0x559c6e[_0xba2a('0x27')];var _0x4d572d=_0x283846?0x0:_0x5d40f6[_0xba2a('0x24')];var _0x5c9fb4=_0x283846?_0x559c6e[_0xba2a('0x27')]:_0x5d40f6[_0xba2a('0x24')]+_0x5d40f6[_0xba2a('0x26')];var _0x1d4ba9;if(_0x5c9fb4>=_0x437e4c){_0x5c9fb4=_0x437e4c;_0x1d4ba9=0xc8;}else{_0x1d4ba9=0xce;}_0x49c57e[_0xba2a('0x21')](_0x1d4ba9);return _0x49c57e[_0xba2a('0x28')]('Content-Range',_0x4d572d+'-'+_0x5c9fb4+'/'+_0x437e4c)[_0xba2a('0x23')](_0x559c6e);}return null;};}function patchUpdates(_0x2cc3db){return function(_0x295f02){try{jsonpatch[_0xba2a('0x29')](_0x295f02,_0x2cc3db,!![]);}catch(_0x3bc8e1){return BPromise['reject'](_0x3bc8e1);}return _0x295f02[_0xba2a('0x2a')]();};}function saveUpdates(_0x4458cb,_0x3da13c){return function(_0x3475e3){if(_0x3475e3){return _0x3475e3[_0xba2a('0x2b')](_0x4458cb)[_0xba2a('0x2c')](function(_0x24ee7d){return _0x24ee7d;});}return null;};}function removeEntity(_0x415dd7,_0x4bba7a){return function(_0x1c990d){if(_0x1c990d){return _0x1c990d[_0xba2a('0x2d')]()[_0xba2a('0x2c')](function(){var _0x2a001c=_0x1c990d['get']({'plain':!![]});var _0x2e627b=_0xba2a('0x2e');return db[_0xba2a('0x2f')]['destroy']({'where':{'type':_0x2e627b,'resourceId':_0x2a001c['id']}})['then'](function(){return _0x1c990d;});})[_0xba2a('0x2c')](function(){_0x415dd7[_0xba2a('0x21')](0xcc)[_0xba2a('0x22')]();});}};}function handleEntityNotFound(_0x3bb5c3,_0x3aa95a){return function(_0x403372){if(!_0x403372){_0x3bb5c3[_0xba2a('0x20')](0x194);}return _0x403372;};}function handleError(_0x46e861,_0x3e03e2){_0x3e03e2=_0x3e03e2||0x1f4;return function(_0x7ab93c){logger['error'](_0x7ab93c[_0xba2a('0x30')]);if(_0x7ab93c[_0xba2a('0x31')]){delete _0x7ab93c[_0xba2a('0x31')];}_0x46e861[_0xba2a('0x21')](_0x3e03e2)['send'](_0x7ab93c);};}exports[_0xba2a('0x32')]=function(_0xf75143,_0x3ec14f){var _0x49597b={},_0x30d3b5={},_0x274174={'count':0x0,'rows':[]};var _0x12979d=_[_0xba2a('0x33')](db[_0xba2a('0x34')][_0xba2a('0x35')],function(_0x1f4cb3){return{'name':_0x1f4cb3[_0xba2a('0x36')],'type':_0x1f4cb3['type'][_0xba2a('0x37')]};});_0x30d3b5[_0xba2a('0x38')]=_[_0xba2a('0x33')](_0x12979d,_0xba2a('0x31'));_0x30d3b5[_0xba2a('0x39')]=_['keys'](_0xf75143[_0xba2a('0x39')]);_0x30d3b5[_0xba2a('0x3a')]=_[_0xba2a('0x3b')](_0x30d3b5[_0xba2a('0x38')],_0x30d3b5['query']);_0x49597b[_0xba2a('0x3c')]=_[_0xba2a('0x3b')](_0x30d3b5[_0xba2a('0x38')],qs['fields'](_0xf75143[_0xba2a('0x39')][_0xba2a('0x3d')]));_0x49597b[_0xba2a('0x3c')]=_0x49597b['attributes'][_0xba2a('0x3e')]?_0x49597b[_0xba2a('0x3c')]:_0x30d3b5[_0xba2a('0x38')];if(!_0xf75143[_0xba2a('0x39')][_0xba2a('0x3f')](_0xba2a('0x40'))){_0x49597b[_0xba2a('0x26')]=qs['limit'](_0xf75143[_0xba2a('0x39')]['limit']);_0x49597b[_0xba2a('0x24')]=qs[_0xba2a('0x24')](_0xf75143['query']['offset']);}_0x49597b['order']=qs['sort'](_0xf75143[_0xba2a('0x39')]['sort']);_0x49597b[_0xba2a('0x41')]=qs[_0xba2a('0x3a')](_['pick'](_0xf75143[_0xba2a('0x39')],_0x30d3b5[_0xba2a('0x3a')]),_0x12979d);if(_0xf75143[_0xba2a('0x39')]['filter']){_0x49597b[_0xba2a('0x41')]=_['merge'](_0x49597b[_0xba2a('0x41')],{'$or':_[_0xba2a('0x33')](_0x12979d,function(_0x111fd5){if(_0x111fd5['type']!==_0xba2a('0x42')){var _0x25584d={};_0x25584d[_0x111fd5[_0xba2a('0x31')]]={'$like':'%'+_0xf75143['query'][_0xba2a('0x43')]+'%'};return _0x25584d;}})});}_0x49597b=_[_0xba2a('0x44')]({},_0x49597b,_0xf75143['options']);var _0x23b3e7={'where':_0x49597b[_0xba2a('0x41')]};return db[_0xba2a('0x34')][_0xba2a('0x27')](_0x23b3e7)[_0xba2a('0x2c')](function(_0x3905d7){_0x274174[_0xba2a('0x27')]=_0x3905d7;if(_0xf75143[_0xba2a('0x39')][_0xba2a('0x45')]){_0x49597b['include']=[{'all':!![]}];}return db[_0xba2a('0x34')][_0xba2a('0x46')](_0x49597b);})['then'](function(_0x23b790){_0x274174[_0xba2a('0x47')]=_0x23b790;return _0x274174;})[_0xba2a('0x2c')](respondWithFilteredResult(_0x3ec14f,_0x49597b))[_0xba2a('0x48')](handleError(_0x3ec14f,null));};exports['show']=function(_0x5339f6,_0x569ba6){var _0x5af185={'raw':!![],'where':{'id':_0x5339f6[_0xba2a('0x49')]['id']}},_0x362e80={};_0x362e80['model']=_['keys'](db['WhatsappQueue'][_0xba2a('0x35')]);_0x362e80[_0xba2a('0x39')]=_['keys'](_0x5339f6['query']);_0x362e80[_0xba2a('0x3a')]=_[_0xba2a('0x3b')](_0x362e80['model'],_0x362e80[_0xba2a('0x39')]);_0x5af185[_0xba2a('0x3c')]=_[_0xba2a('0x3b')](_0x362e80['model'],qs[_0xba2a('0x3d')](_0x5339f6['query'][_0xba2a('0x3d')]));_0x5af185['attributes']=_0x5af185[_0xba2a('0x3c')][_0xba2a('0x3e')]?_0x5af185[_0xba2a('0x3c')]:_0x362e80[_0xba2a('0x38')];if(_0x5339f6[_0xba2a('0x39')][_0xba2a('0x45')]){_0x5af185['include']=[{'all':!![]}];}_0x5af185=_[_0xba2a('0x44')]({},_0x5af185,_0x5339f6['options']);return db[_0xba2a('0x34')]['find'](_0x5af185)[_0xba2a('0x2c')](handleEntityNotFound(_0x569ba6,null))[_0xba2a('0x2c')](respondWithResult(_0x569ba6,null))[_0xba2a('0x48')](handleError(_0x569ba6,null));};exports['create']=function(_0x46d142,_0x513bbb){return db['WhatsappQueue'][_0xba2a('0x4a')](_0x46d142['body'],{})['then'](function(_0x236a31){var _0x4260a3=_0x46d142['user'][_0xba2a('0x4b')]({'plain':!![]});if(!_0x4260a3)throw new Error(_0xba2a('0x4c'));if(_0x4260a3[_0xba2a('0x4d')]==='user'){var _0x54ce2f=_0x236a31[_0xba2a('0x4b')]({'plain':!![]});var _0x3c1926=_0xba2a('0x2e');return db[_0xba2a('0x4e')][_0xba2a('0x4f')]({'where':{'name':_0x3c1926,'userProfileId':_0x4260a3[_0xba2a('0x50')]},'raw':!![]})[_0xba2a('0x2c')](function(_0x8c9dca){if(_0x8c9dca&&_0x8c9dca[_0xba2a('0x51')]===0x0){return db[_0xba2a('0x2f')]['create']({'name':_0x54ce2f[_0xba2a('0x31')],'resourceId':_0x54ce2f['id'],'type':_0x8c9dca['name'],'sectionId':_0x8c9dca['id']},{})[_0xba2a('0x2c')](function(){return _0x236a31;});}else{return _0x236a31;}})[_0xba2a('0x48')](function(_0x539f44){logger[_0xba2a('0x52')](_0xba2a('0x53'),_0x539f44);throw _0x539f44;});}return _0x236a31;})[_0xba2a('0x2c')](respondWithResult(_0x513bbb,0xc9))[_0xba2a('0x48')](handleError(_0x513bbb,null));};exports[_0xba2a('0x2b')]=function(_0x1ac2fa,_0x58a823){if(_0x1ac2fa[_0xba2a('0x54')]['id']){delete _0x1ac2fa['body']['id'];}return db[_0xba2a('0x34')][_0xba2a('0x4f')]({'where':{'id':_0x1ac2fa[_0xba2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x58a823,null))[_0xba2a('0x2c')](saveUpdates(_0x1ac2fa[_0xba2a('0x54')],null))[_0xba2a('0x2c')](respondWithResult(_0x58a823,null))['catch'](handleError(_0x58a823,null));};exports['destroy']=function(_0x347d81,_0x122766){return db[_0xba2a('0x34')][_0xba2a('0x4f')]({'where':{'id':_0x347d81[_0xba2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x122766,null))[_0xba2a('0x2c')](removeEntity(_0x122766,null))[_0xba2a('0x48')](handleError(_0x122766,null));};exports[_0xba2a('0x55')]=function(_0x2a54f7,_0x52292b){return db[_0xba2a('0x34')][_0xba2a('0x55')]()[_0xba2a('0x2c')](respondWithResult(_0x52292b,null))[_0xba2a('0x48')](handleError(_0x52292b,null));};exports['getMembers']=function(_0x394e36,_0x121e17,_0x44ef91){var _0x529335={'raw':!![],'where':{}},_0x433e6f={},_0x30afa4;return db[_0xba2a('0x34')]['findOne']({'where':{'id':_0x394e36['params']['id']}})[_0xba2a('0x2c')](handleEntityNotFound(_0x121e17,null))[_0xba2a('0x2c')](function(_0x4b41a6){if(_0x4b41a6){_0x30afa4=_0x4b41a6['get']({'plain':!![]});_0x433e6f[_0xba2a('0x38')]=_[_0xba2a('0x56')](db[_0xba2a('0x57')]['rawAttributes']);_0x433e6f[_0xba2a('0x39')]=_[_0xba2a('0x56')](_0x394e36['query']);_0x433e6f[_0xba2a('0x3a')]=_['intersection'](_0x433e6f[_0xba2a('0x38')],_0x433e6f[_0xba2a('0x39')]);_0x529335['attributes']=_[_0xba2a('0x3b')](_0x433e6f[_0xba2a('0x38')],qs[_0xba2a('0x3d')](_0x394e36[_0xba2a('0x39')][_0xba2a('0x3d')]));_0x529335[_0xba2a('0x3c')]=_0x529335['attributes'][_0xba2a('0x3e')]?_0x529335[_0xba2a('0x3c')]:_0x433e6f[_0xba2a('0x38')];if(!_0x394e36[_0xba2a('0x39')][_0xba2a('0x3f')](_0xba2a('0x40'))){_0x529335['limit']=qs[_0xba2a('0x26')](_0x394e36[_0xba2a('0x39')][_0xba2a('0x26')]);_0x529335['offset']=qs['offset'](_0x394e36[_0xba2a('0x39')][_0xba2a('0x24')]);}_0x529335['order']=qs[_0xba2a('0x58')](_0x394e36[_0xba2a('0x39')]['sort']);_0x529335[_0xba2a('0x41')]=qs['filters'](_['pick'](_0x394e36[_0xba2a('0x39')],_0x433e6f[_0xba2a('0x3a')]));_0x529335[_0xba2a('0x41')][_0xba2a('0x59')]=_0x4b41a6['id'];if(_0x394e36[_0xba2a('0x39')][_0xba2a('0x43')]){_0x529335[_0xba2a('0x41')]=_['merge'](_0x529335['where'],{'$or':_[_0xba2a('0x33')](_0x529335[_0xba2a('0x3c')],function(_0x5795c8){var _0x49642a={};_0x49642a[_0x5795c8]={'$like':'%'+_0x394e36['query'][_0xba2a('0x43')]+'%'};return _0x49642a;})});}_0x529335=_['merge']({},_0x529335,_0x394e36[_0xba2a('0x5a')]);return db[_0xba2a('0x57')][_0xba2a('0x46')](_0x529335);}})[_0xba2a('0x2c')](function(_0x38eebf){if(_0x38eebf){return db[_0xba2a('0x5b')][_0xba2a('0x5c')]({'where':{'id':_['map'](_0x38eebf,'UserId'),'role':_0xba2a('0x5d')},'attributes':['id',_0xba2a('0x31'),'whatsappPause','updatedAt',_0xba2a('0x5e')]});}})[_0xba2a('0x2c')](function(_0x1ec731){if(_0x1ec731){return{'count':_0x1ec731[_0xba2a('0x27')],'rows':_['map'](_0x1ec731[_0xba2a('0x47')],function(_0x12f4e4){return{'membername':_0x12f4e4[_0xba2a('0x31')],'UserId':_0x12f4e4['id'],'queue_name':_0x30afa4[_0xba2a('0x31')],'WhatsappQueueId':_0x30afa4['id'],'interface':util['format']('%s/%s',_0xba2a('0x5f'),_0x12f4e4[_0xba2a('0x31')]),'penalty':0x0,'paused':_0x12f4e4[_0xba2a('0x60')],'createdAt':_0x12f4e4[_0xba2a('0x5e')],'updatedAt':_0x12f4e4[_0xba2a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xba2a('0x2c')](respondWithFilteredResult(_0x121e17,_0x529335))['catch'](handleError(_0x121e17,null));};exports[_0xba2a('0x62')]=function(_0x2e0810,_0x51b7e3,_0x10b674){var _0x27c831={};var _0x493227={};var _0x2d6446;var _0x4ec9ea;return db[_0xba2a('0x34')][_0xba2a('0x63')]({'where':{'id':_0x2e0810[_0xba2a('0x49')]['id']}})[_0xba2a('0x2c')](handleEntityNotFound(_0x51b7e3,null))[_0xba2a('0x2c')](function(_0x44759e){if(_0x44759e){_0x2d6446=_0x44759e;_0x493227['model']=_[_0xba2a('0x56')](db['Team'][_0xba2a('0x35')]);_0x493227['query']=_[_0xba2a('0x56')](_0x2e0810[_0xba2a('0x39')]);_0x493227[_0xba2a('0x3a')]=_[_0xba2a('0x3b')](_0x493227[_0xba2a('0x38')],_0x493227[_0xba2a('0x39')]);_0x27c831[_0xba2a('0x3c')]=_[_0xba2a('0x3b')](_0x493227[_0xba2a('0x38')],qs[_0xba2a('0x3d')](_0x2e0810[_0xba2a('0x39')][_0xba2a('0x3d')]));_0x27c831[_0xba2a('0x3c')]=_0x27c831[_0xba2a('0x3c')]['length']?_0x27c831[_0xba2a('0x3c')]:_0x493227[_0xba2a('0x38')];_0x27c831[_0xba2a('0x64')]=qs['sort'](_0x2e0810[_0xba2a('0x39')][_0xba2a('0x58')]);_0x27c831['where']=qs['filters'](_['pick'](_0x2e0810[_0xba2a('0x39')],_0x493227[_0xba2a('0x3a')]));if(_0x2e0810[_0xba2a('0x39')][_0xba2a('0x43')]){_0x27c831[_0xba2a('0x41')]=_['merge'](_0x27c831[_0xba2a('0x41')],{'$or':_[_0xba2a('0x33')](_0x27c831[_0xba2a('0x3c')],function(_0x17c986){var _0x1904d3={};_0x1904d3[_0x17c986]={'$like':'%'+_0x2e0810['query'][_0xba2a('0x43')]+'%'};return _0x1904d3;})});}_0x27c831=_[_0xba2a('0x44')]({},_0x27c831,_0x2e0810[_0xba2a('0x5a')]);return _0x2d6446[_0xba2a('0x62')](_0x27c831);}})['then'](function(_0x56a1a9){if(_0x56a1a9){_0x4ec9ea=_0x56a1a9[_0xba2a('0x3e')];if(!_0x2e0810[_0xba2a('0x39')][_0xba2a('0x3f')]('nolimit')){_0x27c831[_0xba2a('0x26')]=qs[_0xba2a('0x26')](_0x2e0810[_0xba2a('0x39')][_0xba2a('0x26')]);_0x27c831[_0xba2a('0x24')]=qs['offset'](_0x2e0810[_0xba2a('0x39')][_0xba2a('0x24')]);}return _0x2d6446[_0xba2a('0x62')](_0x27c831);}})['then'](function(_0x397ceb){if(_0x397ceb){return _0x397ceb?{'count':_0x4ec9ea,'rows':_0x397ceb}:null;}})['then'](respondWithResult(_0x51b7e3,null))['catch'](handleError(_0x51b7e3,null));};exports[_0xba2a('0x65')]=function(_0x5760a0,_0x836cc2,_0x15153d){var _0x2409b3=_0x5760a0[_0xba2a('0x54')][_0xba2a('0x66')];return db[_0xba2a('0x67')][_0xba2a('0x46')]({'where':{'id':_0x2409b3},'attributes':['id'],'include':[{'model':db[_0xba2a('0x5b')],'as':'Agents','attributes':['id',_0xba2a('0x31'),_0xba2a('0x68'),'voicePause',_0xba2a('0x69')],'raw':!![]}]})[_0xba2a('0x2c')](function(_0x32c41b){if(_0x32c41b){var _0x2cb150=_[_0xba2a('0x6a')](_0x32c41b,function(_0x4168d5){var _0x122b78=_0x4168d5[_0xba2a('0x4b')]({'plain':!![]});return _0x122b78['Agents'];});return db[_0xba2a('0x34')]['find']({'where':{'id':_0x5760a0[_0xba2a('0x49')]['id']}})[_0xba2a('0x2c')](function(_0x5c3ae4){return db[_0xba2a('0x6b')][_0xba2a('0x6c')](function(_0x14c3b3){return _0x5c3ae4[_0xba2a('0x65')](_0x2409b3,{'transaction':_0x14c3b3})[_0xba2a('0x2c')](function(){return BPromise[_0xba2a('0x6d')](_0x2cb150,function(_0x314fe5){return db[_0xba2a('0x57')][_0xba2a('0x6e')]({'where':{'UserId':_0x314fe5['id'],'WhatsappQueueId':_0x5760a0[_0xba2a('0x49')]['id']},'transaction':_0x14c3b3});});})['then'](function(){_0x2cb150[_0xba2a('0x6f')](function(_0x5501ca){socket['emit'](_0xba2a('0x70'),{'UserId':_0x5501ca['id'],'WhatsappQueueId':_0x5c3ae4['id']});});});});});}})[_0xba2a('0x2c')](respondWithStatusCode(_0x836cc2,null))['catch'](handleError(_0x836cc2,null));};exports[_0xba2a('0x71')]=function(_0x22b431,_0x42f182,_0xf511fd){return db[_0xba2a('0x67')][_0xba2a('0x46')]({'where':{'id':_0x22b431[_0xba2a('0x39')][_0xba2a('0x66')]},'attributes':['id'],'include':[{'model':db[_0xba2a('0x5b')],'as':_0xba2a('0x72'),'attributes':['id'],'raw':!![]}]})[_0xba2a('0x2c')](handleEntityNotFound(_0x42f182,null))[_0xba2a('0x2c')](function(_0x29ed91){var _0x2a228b=_[_0xba2a('0x33')](_0x29ed91,'id');var _0x13a132=[];var _0x3aaab9=[];var _0x234f20=squel[_0xba2a('0x73')]();_0x234f20[_0xba2a('0x74')](_0xba2a('0x75'))[_0xba2a('0x76')](_0xba2a('0x77'),'tq')[_0xba2a('0x78')](_0xba2a('0x79'),'ut',_0xba2a('0x7a'))[_0xba2a('0x41')](_0xba2a('0x7b'),_0x22b431[_0xba2a('0x49')]['id']);for(var _0x5799f0=0x0;_0x5799f0<_0x29ed91[_0xba2a('0x3e')];_0x5799f0+=0x1){let _0x1036ff=_0x29ed91[_0x5799f0];for(var _0x3941a7=0x0;_0x3941a7<_0x1036ff[_0xba2a('0x72')]['length'];_0x3941a7+=0x1){let _0x514a53=_0x1036ff[_0xba2a('0x72')][_0x3941a7];var _0x2cccd2=_0x234f20['clone']();_0x2cccd2[_0xba2a('0x41')]('ut.UserId\x20=\x20?',_0x514a53['id']);_0x3aaab9[_0xba2a('0x7c')](db['sequelize']['query'](_0x2cccd2[_0xba2a('0x7d')](),{'type':db[_0xba2a('0x6b')][_0xba2a('0x7e')][_0xba2a('0x7f')]})[_0xba2a('0x2c')](function(_0xc4409b){if(_0xc4409b[_0xba2a('0x3e')]===0x1){return _0x514a53['id'];}else{var _0x109e82=_['every'](_['map'](_0xc4409b,_0xba2a('0x80')),function(_0x5e5ad3){return _[_0xba2a('0x81')](_0x2a228b,_0x5e5ad3);});if(_0x109e82){return _0x514a53['id'];}}}));}}return BPromise[_0xba2a('0x82')](_0x3aaab9)[_0xba2a('0x2c')](function(_0x1718aa){_0x13a132=_(_0x13a132)[_0xba2a('0x83')](_0x1718aa)['compact']()['value']();return db[_0xba2a('0x34')]['find']({'where':{'id':_0x22b431['params']['id']}})[_0xba2a('0x2c')](function(_0x1c2c2a){return db[_0xba2a('0x6b')][_0xba2a('0x6c')](function(_0x274520){return _0x1c2c2a[_0xba2a('0x71')](_0x22b431[_0xba2a('0x39')][_0xba2a('0x66')],{'transaction':_0x274520})[_0xba2a('0x2c')](function(){if(!_[_0xba2a('0x84')](_0x13a132)){return _0x1c2c2a[_0xba2a('0x85')](_0x13a132,{'transaction':_0x274520});}})[_0xba2a('0x2c')](function(){_0x13a132[_0xba2a('0x6f')](function(_0x94d82f){socket['emit'](_0xba2a('0x86'),{'UserId':_0x94d82f,'WhatsappQueueId':_0x1c2c2a['id']});});});});});});})[_0xba2a('0x2c')](respondWithStatusCode(_0x42f182,null))[_0xba2a('0x48')](handleError(_0x42f182,null));};exports[_0xba2a('0x87')]=function(_0x489d93,_0x1f7dd9,_0x1fb2b3){return db['WhatsappQueue'][_0xba2a('0x4f')]({'where':{'id':_0x489d93[_0xba2a('0x49')]['id']}})[_0xba2a('0x2c')](handleEntityNotFound(_0x1f7dd9,null))[_0xba2a('0x2c')](function(_0x32cd12){if(_0x32cd12){return _0x32cd12['addAgents'](_0x489d93[_0xba2a('0x54')][_0xba2a('0x66')],_[_0xba2a('0x88')](_0x489d93[_0xba2a('0x54')],['ids','id'])||{})[_0xba2a('0x89')](function(_0x4919f6){for(var _0x36fc19=0x0;_0x36fc19<_0x489d93['body'][_0xba2a('0x66')][_0xba2a('0x3e')];_0x36fc19+=0x1){socket[_0xba2a('0x8a')](_0xba2a('0x70'),{'UserId':_0x489d93[_0xba2a('0x54')][_0xba2a('0x66')][_0x36fc19],'WhatsappQueueId':_0x489d93[_0xba2a('0x49')]['id']});}return _0x4919f6;});}})[_0xba2a('0x2c')](respondWithResult(_0x1f7dd9,null))[_0xba2a('0x48')](handleError(_0x1f7dd9,null));};exports['removeAgents']=function(_0x19fd45,_0x559db6,_0x2f6524){return db[_0xba2a('0x34')][_0xba2a('0x4f')]({'where':{'id':_0x19fd45[_0xba2a('0x49')]['id']}})[_0xba2a('0x2c')](handleEntityNotFound(_0x559db6,null))[_0xba2a('0x2c')](function(_0x15cf18){if(_0x15cf18){return _0x15cf18['removeAgents'](_0x19fd45[_0xba2a('0x39')][_0xba2a('0x66')])[_0xba2a('0x2c')](function(){if(_[_0xba2a('0x8b')](_0x19fd45[_0xba2a('0x39')]['ids'])){for(var _0x41d944=0x0;_0x41d944<_0x19fd45['query'][_0xba2a('0x66')]['length'];_0x41d944+=0x1){socket['emit'](_0xba2a('0x86'),{'UserId':Number(_0x19fd45[_0xba2a('0x39')][_0xba2a('0x66')][_0x41d944]),'WhatsappQueueId':Number(_0x19fd45[_0xba2a('0x49')]['id'])});}}else{socket[_0xba2a('0x8a')]('userWhatsappQueue:remove',{'UserId':Number(_0x19fd45['query'][_0xba2a('0x66')]),'WhatsappQueueId':Number(_0x19fd45[_0xba2a('0x49')]['id'])});}});}})[_0xba2a('0x2c')](respondWithStatusCode(_0x559db6,null))[_0xba2a('0x48')](handleError(_0x559db6,null));};exports[_0xba2a('0x8c')]=function(_0x3f3615,_0x5be48e,_0x385033){var _0x739ecb={};var _0xea9e92={};var _0x3da3cf;var _0x12b106;return db['WhatsappQueue'][_0xba2a('0x63')]({'where':{'id':_0x3f3615[_0xba2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x5be48e,null))[_0xba2a('0x2c')](function(_0x4c69e5){if(_0x4c69e5){_0x3da3cf=_0x4c69e5;_0xea9e92[_0xba2a('0x38')]=_['keys'](db[_0xba2a('0x5b')][_0xba2a('0x35')]);_0xea9e92[_0xba2a('0x39')]=_[_0xba2a('0x56')](_0x3f3615[_0xba2a('0x39')]);_0xea9e92[_0xba2a('0x3a')]=_[_0xba2a('0x3b')](_0xea9e92['model'],_0xea9e92[_0xba2a('0x39')]);_0x739ecb['attributes']=_[_0xba2a('0x3b')](_0xea9e92[_0xba2a('0x38')],qs[_0xba2a('0x3d')](_0x3f3615[_0xba2a('0x39')][_0xba2a('0x3d')]));_0x739ecb[_0xba2a('0x3c')]=_0x739ecb['attributes'][_0xba2a('0x3e')]?_0x739ecb[_0xba2a('0x3c')]:_0xea9e92[_0xba2a('0x38')];_0x739ecb['order']=qs[_0xba2a('0x58')](_0x3f3615[_0xba2a('0x39')][_0xba2a('0x58')]);_0x739ecb[_0xba2a('0x41')]=qs[_0xba2a('0x3a')](_[_0xba2a('0x8d')](_0x3f3615['query'],_0xea9e92[_0xba2a('0x3a')]));if(_0x3f3615[_0xba2a('0x39')][_0xba2a('0x43')]){_0x739ecb[_0xba2a('0x41')]=_[_0xba2a('0x44')](_0x739ecb['where'],{'$or':_[_0xba2a('0x33')](_0x739ecb[_0xba2a('0x3c')],function(_0x2acbe6){var _0xb97ce1={};_0xb97ce1[_0x2acbe6]={'$like':'%'+_0x3f3615['query'][_0xba2a('0x43')]+'%'};return _0xb97ce1;})});}_0x739ecb=_[_0xba2a('0x44')]({},_0x739ecb,_0x3f3615[_0xba2a('0x5a')]);return _0x3da3cf[_0xba2a('0x8c')](_0x739ecb);}})[_0xba2a('0x2c')](function(_0x4b7cd5){if(_0x4b7cd5){_0x12b106=_0x4b7cd5['length'];if(!_0x3f3615['query'][_0xba2a('0x3f')](_0xba2a('0x40'))){_0x739ecb[_0xba2a('0x26')]=qs[_0xba2a('0x26')](_0x3f3615[_0xba2a('0x39')][_0xba2a('0x26')]);_0x739ecb[_0xba2a('0x24')]=qs[_0xba2a('0x24')](_0x3f3615[_0xba2a('0x39')][_0xba2a('0x24')]);}return _0x3da3cf[_0xba2a('0x8c')](_0x739ecb);}})[_0xba2a('0x2c')](function(_0x29329c){if(_0x29329c){return _0x29329c?{'count':_0x12b106,'rows':_0x29329c}:null;}})[_0xba2a('0x2c')](respondWithResult(_0x5be48e,null))[_0xba2a('0x48')](handleError(_0x5be48e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 95a30cf..7ed7f7f 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 _0xe849=['WhatsappQueue','setMaxListeners','save','update','remove','emit','events'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xe849,0x8b));var _0x9e84=function(_0x50812d,_0x49c2e9){_0x50812d=_0x50812d-0x0;var _0x1c0781=_0xe849[_0x50812d];return _0x1c0781;};'use strict';var EventEmitter=require(_0x9e84('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x9e84('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9e84('0x2')](0x0);var events={'afterCreate':_0x9e84('0x3'),'afterUpdate':_0x9e84('0x4'),'afterDestroy':_0x9e84('0x5')};function emitEvent(_0x37cb63){return function(_0x13d130,_0x435d12,_0x2c2af6){WhatsappQueueEvents['emit'](_0x37cb63+':'+_0x13d130['id'],_0x13d130);WhatsappQueueEvents[_0x9e84('0x6')](_0x37cb63,_0x13d130);_0x2c2af6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x828d=['hasOwnProperty','hook','exports','events','../../mysqldb','update','emit'];(function(_0x43b8be,_0x227ea3){var _0x1580f4=function(_0x4f62c0){while(--_0x4f62c0){_0x43b8be['push'](_0x43b8be['shift']());}};_0x1580f4(++_0x227ea3);}(_0x828d,0x96));var _0xd828=function(_0x29638f,_0x5dfb8a){_0x29638f=_0x29638f-0x0;var _0x4c2121=_0x828d[_0x29638f];return _0x4c2121;};'use strict';var EventEmitter=require(_0xd828('0x0'));var WhatsappQueue=require(_0xd828('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd828('0x2'),'afterDestroy':'remove'};function emitEvent(_0x19f60c){return function(_0x9fa1c8,_0x258215,_0x5aa0dd){WhatsappQueueEvents[_0xd828('0x3')](_0x19f60c+':'+_0x9fa1c8['id'],_0x9fa1c8);WhatsappQueueEvents[_0xd828('0x3')](_0x19f60c,_0x9fa1c8);_0x5aa0dd(null);};}for(var e in events){if(events[_0xd828('0x4')](e)){var event=events[e];WhatsappQueue[_0xd828('0x5')](e,emitEvent(event));}}module[_0xd828('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a376d48..fc37207 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 _0x1a6a=['define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x56cba1,_0x2b23c1){var _0x3ddfdf=function(_0x1f8771){while(--_0x1f8771){_0x56cba1['push'](_0x56cba1['shift']());}};_0x3ddfdf(++_0x2b23c1);}(_0x1a6a,0xab));var _0xa1a6=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x1a6a[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0xa1a6('0x0'));var util=require(_0xa1a6('0x1'));var logger=require(_0xa1a6('0x2'))('api');var moment=require(_0xa1a6('0x3'));var BPromise=require(_0xa1a6('0x4'));var rp=require(_0xa1a6('0x5'));var fs=require('fs');var path=require(_0xa1a6('0x6'));var rimraf=require(_0xa1a6('0x7'));var config=require(_0xa1a6('0x8'));var attributes=require(_0xa1a6('0x9'));module[_0xa1a6('0xa')]=function(_0x56753d,_0x586ec4){return _0x56753d[_0xa1a6('0xb')](_0xa1a6('0xc'),attributes,{'tableName':_0xa1a6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8fa=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x177d3b,_0x334409){var _0x50ac2e=function(_0x551b1e){while(--_0x551b1e){_0x177d3b['push'](_0x177d3b['shift']());}};_0x50ac2e(++_0x334409);}(_0xe8fa,0x13a));var _0xae8f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe8fa[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xae8f('0x0'));var util=require(_0xae8f('0x1'));var logger=require(_0xae8f('0x2'))(_0xae8f('0x3'));var moment=require(_0xae8f('0x4'));var BPromise=require(_0xae8f('0x5'));var rp=require(_0xae8f('0x6'));var fs=require('fs');var path=require(_0xae8f('0x7'));var rimraf=require('rimraf');var config=require(_0xae8f('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xae8f('0x9')]=function(_0x338882,_0x1adbb5){return _0x338882[_0xae8f('0xa')](_0xae8f('0xb'),attributes,{'tableName':_0xae8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 9e96747..0b68720 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 _0xafea=['where','attributes','include','map','model','GetWhatsappQueue','stringify','catch','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','WhatsappQueue','findAll','options'];(function(_0x4a3ebd,_0x3e9fd1){var _0x4dca85=function(_0x417506){while(--_0x417506){_0x4a3ebd['push'](_0x4a3ebd['shift']());}};_0x4dca85(++_0x3e9fd1);}(_0xafea,0x172));var _0xaafe=function(_0x4123eb,_0x418858){_0x4123eb=_0x4123eb-0x0;var _0x32562a=_0xafea[_0x4123eb];return _0x32562a;};'use strict';var _=require(_0xaafe('0x0'));var util=require(_0xaafe('0x1'));var moment=require(_0xaafe('0x2'));var BPromise=require(_0xaafe('0x3'));var rs=require(_0xaafe('0x4'));var fs=require('fs');var Redis=require(_0xaafe('0x5'));var db=require(_0xaafe('0x6'))['db'];var utils=require(_0xaafe('0x7'));var logger=require(_0xaafe('0x8'))(_0xaafe('0x9'));var config=require('../../config/environment');var jayson=require(_0xaafe('0xa'));var client=jayson[_0xaafe('0xb')][_0xaafe('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xaafe('0xd')],{'host':_0xaafe('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaafe('0xd')]));require(_0xaafe('0xf'))[_0xaafe('0x10')](socket);function respondWithRpcPromise(_0x257f7c,_0x3a6ebd,_0xf64fe1){return new BPromise(function(_0x4ff7ef,_0x12f822){return client['request'](_0x257f7c,_0xf64fe1)[_0xaafe('0x11')](function(_0x46e8b7){logger['info'](_0xaafe('0x12'),_0x3a6ebd,_0xaafe('0x13'));logger[_0xaafe('0x14')](_0xaafe('0x15'),_0x3a6ebd,_0xaafe('0x13'),JSON['stringify'](_0x46e8b7));if(_0x46e8b7[_0xaafe('0x16')]){if(_0x46e8b7[_0xaafe('0x16')][_0xaafe('0x17')]===0x1f4){logger[_0xaafe('0x16')](_0xaafe('0x12'),_0x3a6ebd,_0x46e8b7[_0xaafe('0x16')][_0xaafe('0x18')]);return _0x12f822(_0x46e8b7[_0xaafe('0x16')][_0xaafe('0x18')]);}logger[_0xaafe('0x16')](_0xaafe('0x12'),_0x3a6ebd,_0x46e8b7[_0xaafe('0x16')][_0xaafe('0x18')]);return _0x4ff7ef(_0x46e8b7[_0xaafe('0x16')][_0xaafe('0x18')]);}else{logger[_0xaafe('0x19')](_0xaafe('0x12'),_0x3a6ebd,'request\x20sent');_0x4ff7ef(_0x46e8b7[_0xaafe('0x1a')][_0xaafe('0x18')]);}})['catch'](function(_0x1e6b54){logger[_0xaafe('0x16')](_0xaafe('0x12'),_0x3a6ebd,_0x1e6b54);_0x12f822(_0x1e6b54);});});}exports['GetWhatsappQueue']=function(_0x4d0178){var _0x3c0d09=this;return new Promise(function(_0x62423c,_0x12c5f6){return db[_0xaafe('0x1b')][_0xaafe('0x1c')]({'raw':_0x4d0178[_0xaafe('0x1d')]?_0x4d0178['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d0178[_0xaafe('0x1d')]?_0x4d0178[_0xaafe('0x1d')][_0xaafe('0x1e')]||null:null,'attributes':_0x4d0178[_0xaafe('0x1d')]?_0x4d0178[_0xaafe('0x1d')][_0xaafe('0x1f')]||null:null,'limit':_0x4d0178[_0xaafe('0x1d')]?_0x4d0178[_0xaafe('0x1d')]['limit']||null:null,'include':_0x4d0178[_0xaafe('0x1d')]?_0x4d0178[_0xaafe('0x1d')][_0xaafe('0x20')]?_[_0xaafe('0x21')](_0x4d0178['options']['include'],function(_0x1bf862){return{'model':db[_0x1bf862[_0xaafe('0x22')]],'as':_0x1bf862['as'],'attributes':_0x1bf862['attributes'],'include':_0x1bf862[_0xaafe('0x20')]?_[_0xaafe('0x21')](_0x1bf862['include'],function(_0x5d7693){return{'model':db[_0x5d7693['model']],'as':_0x5d7693['as'],'attributes':_0x5d7693['attributes'],'include':_0x5d7693['include']?_[_0xaafe('0x21')](_0x5d7693[_0xaafe('0x20')],function(_0x32f46f){return{'model':db[_0x32f46f['model']],'as':_0x32f46f['as'],'attributes':_0x32f46f[_0xaafe('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b2af9){logger[_0xaafe('0x19')](_0xaafe('0x23'),_0x4d0178);logger[_0xaafe('0x14')](_0xaafe('0x23'),_0x4d0178,JSON[_0xaafe('0x24')](_0x3b2af9));_0x62423c(_0x3b2af9);})[_0xaafe('0x25')](function(_0x175741){logger['error'](_0xaafe('0x23'),_0x175741[_0xaafe('0x18')],_0x4d0178);_0x12c5f6(_0x3c0d09[_0xaafe('0x16')](0x1f4,_0x175741[_0xaafe('0x18')]));});});};exports[_0xaafe('0x26')]=function(_0x23fea7){var _0x3d6885=this;return new Promise(function(_0x497d4c,_0x1e4cf5){return db[_0xaafe('0x1b')][_0xaafe('0x27')]({'raw':_0x23fea7[_0xaafe('0x1d')]?_0x23fea7[_0xaafe('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x23fea7['options']?_0x23fea7[_0xaafe('0x1d')][_0xaafe('0x1e')]||null:null,'attributes':_0x23fea7[_0xaafe('0x1d')]?_0x23fea7[_0xaafe('0x1d')]['attributes']||null:null,'include':_0x23fea7[_0xaafe('0x1d')]?_0x23fea7[_0xaafe('0x1d')][_0xaafe('0x20')]?_[_0xaafe('0x21')](_0x23fea7[_0xaafe('0x1d')]['include'],function(_0x237264){return{'model':db[_0x237264[_0xaafe('0x22')]],'as':_0x237264['as'],'attributes':_0x237264[_0xaafe('0x1f')],'include':_0x237264[_0xaafe('0x20')]?_[_0xaafe('0x21')](_0x237264[_0xaafe('0x20')],function(_0x3de24f){return{'model':db[_0x3de24f[_0xaafe('0x22')]],'as':_0x3de24f['as'],'attributes':_0x3de24f[_0xaafe('0x1f')],'include':_0x3de24f[_0xaafe('0x20')]?_['map'](_0x3de24f[_0xaafe('0x20')],function(_0x4a40f1){return{'model':db[_0x4a40f1[_0xaafe('0x22')]],'as':_0x4a40f1['as'],'attributes':_0x4a40f1[_0xaafe('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41b2e9){logger[_0xaafe('0x19')](_0xaafe('0x26'),_0x23fea7);logger[_0xaafe('0x14')](_0xaafe('0x26'),_0x23fea7,JSON[_0xaafe('0x24')](_0x41b2e9));_0x497d4c(_0x41b2e9);})[_0xaafe('0x25')](function(_0x92b2e7){logger[_0xaafe('0x16')](_0xaafe('0x26'),_0x92b2e7['message'],_0x23fea7);_0x1e4cf5(_0x3d6885[_0xaafe('0x16')](0x1f4,_0x92b2e7['message']));});});}; \ No newline at end of file +var _0x8b6c=['options','raw','where','attributes','include','map','stringify','catch','model','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll'];(function(_0x28749c,_0x578a74){var _0x3c6ee1=function(_0x437251){while(--_0x437251){_0x28749c['push'](_0x28749c['shift']());}};_0x3c6ee1(++_0x578a74);}(_0x8b6c,0x1ea));var _0xc8b6=function(_0x5641e5,_0x41f6b7){_0x5641e5=_0x5641e5-0x0;var _0x533eff=_0x8b6c[_0x5641e5];return _0x533eff;};'use strict';var _=require(_0xc8b6('0x0'));var util=require(_0xc8b6('0x1'));var moment=require(_0xc8b6('0x2'));var BPromise=require(_0xc8b6('0x3'));var rs=require(_0xc8b6('0x4'));var fs=require('fs');var Redis=require(_0xc8b6('0x5'));var db=require(_0xc8b6('0x6'))['db'];var utils=require(_0xc8b6('0x7'));var logger=require(_0xc8b6('0x8'))(_0xc8b6('0x9'));var config=require(_0xc8b6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc8b6('0xb')][_0xc8b6('0xc')]({'port':0x232a});config[_0xc8b6('0xd')]=_['defaults'](config['redis'],{'host':_0xc8b6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc8b6('0xd')]));require(_0xc8b6('0xf'))['register'](socket);function respondWithRpcPromise(_0x24aa21,_0x500d89,_0x361874){return new BPromise(function(_0x305eac,_0xe27170){return client[_0xc8b6('0x10')](_0x24aa21,_0x361874)[_0xc8b6('0x11')](function(_0x4daab3){logger[_0xc8b6('0x12')](_0xc8b6('0x13'),_0x500d89,_0xc8b6('0x14'));logger[_0xc8b6('0x15')](_0xc8b6('0x16'),_0x500d89,'request\x20sent',JSON['stringify'](_0x4daab3));if(_0x4daab3[_0xc8b6('0x17')]){if(_0x4daab3['error'][_0xc8b6('0x18')]===0x1f4){logger[_0xc8b6('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x500d89,_0x4daab3[_0xc8b6('0x17')][_0xc8b6('0x19')]);return _0xe27170(_0x4daab3[_0xc8b6('0x17')][_0xc8b6('0x19')]);}logger[_0xc8b6('0x17')](_0xc8b6('0x13'),_0x500d89,_0x4daab3[_0xc8b6('0x17')]['message']);return _0x305eac(_0x4daab3[_0xc8b6('0x17')]['message']);}else{logger[_0xc8b6('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x500d89,_0xc8b6('0x14'));_0x305eac(_0x4daab3[_0xc8b6('0x1a')][_0xc8b6('0x19')]);}})['catch'](function(_0x349392){logger[_0xc8b6('0x17')](_0xc8b6('0x13'),_0x500d89,_0x349392);_0xe27170(_0x349392);});});}exports[_0xc8b6('0x1b')]=function(_0x352554){var _0x50ac1b=this;return new Promise(function(_0x50a017,_0x3cf575){return db[_0xc8b6('0x1c')][_0xc8b6('0x1d')]({'raw':_0x352554[_0xc8b6('0x1e')]?_0x352554[_0xc8b6('0x1e')][_0xc8b6('0x1f')]===undefined?!![]:![]:!![],'where':_0x352554[_0xc8b6('0x1e')]?_0x352554['options'][_0xc8b6('0x20')]||null:null,'attributes':_0x352554[_0xc8b6('0x1e')]?_0x352554['options'][_0xc8b6('0x21')]||null:null,'limit':_0x352554[_0xc8b6('0x1e')]?_0x352554[_0xc8b6('0x1e')]['limit']||null:null,'include':_0x352554['options']?_0x352554[_0xc8b6('0x1e')][_0xc8b6('0x22')]?_['map'](_0x352554[_0xc8b6('0x1e')][_0xc8b6('0x22')],function(_0xfd5bc7){return{'model':db[_0xfd5bc7['model']],'as':_0xfd5bc7['as'],'attributes':_0xfd5bc7[_0xc8b6('0x21')],'include':_0xfd5bc7['include']?_['map'](_0xfd5bc7[_0xc8b6('0x22')],function(_0x39a9e6){return{'model':db[_0x39a9e6['model']],'as':_0x39a9e6['as'],'attributes':_0x39a9e6[_0xc8b6('0x21')],'include':_0x39a9e6[_0xc8b6('0x22')]?_[_0xc8b6('0x23')](_0x39a9e6[_0xc8b6('0x22')],function(_0x51ddf8){return{'model':db[_0x51ddf8['model']],'as':_0x51ddf8['as'],'attributes':_0x51ddf8[_0xc8b6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc8b6('0x11')](function(_0x8bfd4f){logger[_0xc8b6('0x12')](_0xc8b6('0x1b'),_0x352554);logger['debug'](_0xc8b6('0x1b'),_0x352554,JSON[_0xc8b6('0x24')](_0x8bfd4f));_0x50a017(_0x8bfd4f);})[_0xc8b6('0x25')](function(_0x15404e){logger[_0xc8b6('0x17')]('GetWhatsappQueue',_0x15404e[_0xc8b6('0x19')],_0x352554);_0x3cf575(_0x50ac1b[_0xc8b6('0x17')](0x1f4,_0x15404e[_0xc8b6('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x121400){var _0x288156=this;return new Promise(function(_0x4b0af3,_0x362735){return db['WhatsappQueue']['find']({'raw':_0x121400['options']?_0x121400[_0xc8b6('0x1e')][_0xc8b6('0x1f')]===undefined?!![]:![]:!![],'where':_0x121400['options']?_0x121400[_0xc8b6('0x1e')][_0xc8b6('0x20')]||null:null,'attributes':_0x121400['options']?_0x121400[_0xc8b6('0x1e')][_0xc8b6('0x21')]||null:null,'include':_0x121400[_0xc8b6('0x1e')]?_0x121400[_0xc8b6('0x1e')][_0xc8b6('0x22')]?_[_0xc8b6('0x23')](_0x121400[_0xc8b6('0x1e')][_0xc8b6('0x22')],function(_0x2a903a){return{'model':db[_0x2a903a[_0xc8b6('0x26')]],'as':_0x2a903a['as'],'attributes':_0x2a903a[_0xc8b6('0x21')],'include':_0x2a903a['include']?_['map'](_0x2a903a[_0xc8b6('0x22')],function(_0x2a0169){return{'model':db[_0x2a0169[_0xc8b6('0x26')]],'as':_0x2a0169['as'],'attributes':_0x2a0169[_0xc8b6('0x21')],'include':_0x2a0169[_0xc8b6('0x22')]?_[_0xc8b6('0x23')](_0x2a0169[_0xc8b6('0x22')],function(_0x1a56a0){return{'model':db[_0x1a56a0[_0xc8b6('0x26')]],'as':_0x1a56a0['as'],'attributes':_0x1a56a0[_0xc8b6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc8b6('0x11')](function(_0x36b291){logger['info'](_0xc8b6('0x27'),_0x121400);logger[_0xc8b6('0x15')](_0xc8b6('0x27'),_0x121400,JSON[_0xc8b6('0x24')](_0x36b291));_0x4b0af3(_0x36b291);})[_0xc8b6('0x25')](function(_0x5a049d){logger['error'](_0xc8b6('0x27'),_0x5a049d['message'],_0x121400);_0x362735(_0x288156[_0xc8b6('0x17')](0x1f4,_0x5a049d[_0xc8b6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 44c3ab9..ab564aa 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 _0xbf13=['removeListener','register','length','./whatsappQueue.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf13,0x173));var _0x3bf1=function(_0xdba375,_0x2a01d0){_0xdba375=_0xdba375-0x0;var _0x591a41=_0xbf13[_0xdba375];return _0x591a41;};'use strict';var WhatsappQueueEvents=require(_0x3bf1('0x0'));var events=[_0x3bf1('0x1'),_0x3bf1('0x2'),_0x3bf1('0x3')];function createListener(_0x20b9e3,_0x2ab602){return function(_0x200e96){_0x2ab602[_0x3bf1('0x4')](_0x20b9e3,_0x200e96);};}function removeListener(_0x159413,_0x4529be){return function(){WhatsappQueueEvents[_0x3bf1('0x5')](_0x159413,_0x4529be);};}exports[_0x3bf1('0x6')]=function(_0x3dbd2a){for(var _0x1189cb=0x0,_0x522c73=events[_0x3bf1('0x7')];_0x1189cb<_0x522c73;_0x1189cb++){var _0x350905=events[_0x1189cb];var _0x48d6f3=createListener('whatsappQueue:'+_0x350905,_0x3dbd2a);WhatsappQueueEvents['on'](_0x350905,_0x48d6f3);}}; \ No newline at end of file +var _0xab26=['emit','register','length','whatsappQueue:','save','remove','update'];(function(_0x41249e,_0x275d84){var _0x2bff48=function(_0x33a84d){while(--_0x33a84d){_0x41249e['push'](_0x41249e['shift']());}};_0x2bff48(++_0x275d84);}(_0xab26,0x1e7));var _0x6ab2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xab26[_0x122ef9];return _0x42fba0;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6ab2('0x0'),_0x6ab2('0x1'),_0x6ab2('0x2')];function createListener(_0x3d24fa,_0x299061){return function(_0xe41a7f){_0x299061[_0x6ab2('0x3')](_0x3d24fa,_0xe41a7f);};}function removeListener(_0x2b856f,_0x1f9df0){return function(){WhatsappQueueEvents['removeListener'](_0x2b856f,_0x1f9df0);};}exports[_0x6ab2('0x4')]=function(_0x33aa9c){for(var _0x39b825=0x0,_0x254ff4=events[_0x6ab2('0x5')];_0x39b825<_0x254ff4;_0x39b825++){var _0x1bcccd=events[_0x39b825];var _0x3b9adb=createListener(_0x6ab2('0x6')+_0x1bcccd,_0x33aa9c);WhatsappQueueEvents['on'](_0x1bcccd,_0x3b9adb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 22289c5..a901c61 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 _0xe600=['describe','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x0e60('0x0'));var path=require('path');var timeout=require(_0x0e60('0x1'));var express=require(_0x0e60('0x2'));var router=express[_0x0e60('0x3')]();var fs_extra=require(_0x0e60('0x4'));var auth=require(_0x0e60('0x5'));var interaction=require(_0x0e60('0x6'));var config=require(_0x0e60('0x7'));var controller=require(_0x0e60('0x8'));router[_0x0e60('0x9')]('/',auth[_0x0e60('0xa')](),controller['index']);router[_0x0e60('0x9')](_0x0e60('0xb'),auth[_0x0e60('0xa')](),controller[_0x0e60('0xc')]);router['get'](_0x0e60('0xd'),auth[_0x0e60('0xa')](),controller[_0x0e60('0xe')]);router[_0x0e60('0xf')]('/',auth[_0x0e60('0xa')](),controller[_0x0e60('0x10')]);router['put'](_0x0e60('0xd'),auth[_0x0e60('0xa')](),controller[_0x0e60('0x11')]);router[_0x0e60('0x12')](_0x0e60('0xd'),auth[_0x0e60('0xa')](),controller[_0x0e60('0x13')]);module[_0x0e60('0x14')]=router; \ No newline at end of file +var _0x04b8=['update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','describe','isAuthenticated','show','post','create','/:id'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x04b8,0x159));var _0x804b=function(_0x13d849,_0x1c97ac){_0x13d849=_0x13d849-0x0;var _0xaae2fd=_0x04b8[_0x13d849];return _0xaae2fd;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var fs_extra=require(_0x804b('0x3'));var auth=require(_0x804b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x804b('0x5'));var controller=require(_0x804b('0x6'));router[_0x804b('0x7')]('/',auth['isAuthenticated'](),controller[_0x804b('0x8')]);router[_0x804b('0x7')](_0x804b('0x9'),auth['isAuthenticated'](),controller[_0x804b('0xa')]);router[_0x804b('0x7')]('/:id',auth[_0x804b('0xb')](),controller[_0x804b('0xc')]);router[_0x804b('0xd')]('/',auth[_0x804b('0xb')](),controller[_0x804b('0xe')]);router['put'](_0x804b('0xf'),auth[_0x804b('0xb')](),controller[_0x804b('0x10')]);router[_0x804b('0x11')](_0x804b('0xf'),auth[_0x804b('0xb')](),controller['destroy']);module[_0x804b('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 735e45d..c16b1e0 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 _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x1ab616,_0x2a359){var _0x20425d=function(_0x53277f){while(--_0x53277f){_0x1ab616['push'](_0x1ab616['shift']());}};_0x20425d(++_0x2a359);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'uniqueid':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb00b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb00b('0x3')]},'exitAt':{'type':Sequelize[_0xb00b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','DATE'];(function(_0x4b23ea,_0x3c2b92){var _0x42a3db=function(_0x3d0e76){while(--_0x3d0e76){_0x4b23ea['push'](_0x4b23ea['shift']());}};_0x42a3db(++_0x3c2b92);}(_0xe14b,0x93));var _0xbe14=function(_0x6ffaa9,_0x528e58){_0x6ffaa9=_0x6ffaa9-0x0;var _0x24438b=_0xe14b[_0x6ffaa9];return _0x24438b;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbe14('0x2')]},'leaveAt':{'type':Sequelize[_0xbe14('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbe14('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 5989df1..53118e7 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 _0xc67e=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','apply','reject','update','destroy','then','end','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x5e4b35,_0x4d0efd){var _0x220bde=function(_0xa4f167){while(--_0xa4f167){_0x5e4b35['push'](_0x5e4b35['shift']());}};_0x220bde(++_0x4d0efd);}(_0xc67e,0x110));var _0xec67=function(_0x6c31a8,_0x417cb7){_0x6c31a8=_0x6c31a8-0x0;var _0x138b37=_0xc67e[_0x6c31a8];return _0x138b37;};'use strict';var emlformat=require(_0xec67('0x0'));var rimraf=require(_0xec67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xec67('0x2'));var moment=require(_0xec67('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xec67('0x4'));var path=require(_0xec67('0x5'));var sox=require('sox');var csv=require(_0xec67('0x6'));var ejs=require(_0xec67('0x7'));var fs=require('fs');var fs_extra=require(_0xec67('0x8'));var _=require(_0xec67('0x9'));var squel=require(_0xec67('0xa'));var crypto=require(_0xec67('0xb'));var jsforce=require(_0xec67('0xc'));var deskjs=require(_0xec67('0xd'));var toCsv=require(_0xec67('0x6'));var querystring=require(_0xec67('0xe'));var Papa=require('papaparse');var Redis=require(_0xec67('0xf'));var authService=require(_0xec67('0x10'));var qs=require(_0xec67('0x11'));var as=require(_0xec67('0x12'));var hardwareService=require(_0xec67('0x13'));var logger=require(_0xec67('0x14'))('api');var utils=require(_0xec67('0x15'));var config=require(_0xec67('0x16'));var licenseUtil=require(_0xec67('0x17'));var db=require(_0xec67('0x18'))['db'];function respondWithStatusCode(_0x884631,_0x5eca12){_0x5eca12=_0x5eca12||0xcc;return function(_0x98c145){if(_0x98c145){return _0x884631[_0xec67('0x19')](_0x5eca12);}return _0x884631[_0xec67('0x1a')](_0x5eca12)['end']();};}function respondWithResult(_0x54daae,_0x2342c4){_0x2342c4=_0x2342c4||0xc8;return function(_0x1bfb5e){if(_0x1bfb5e){return _0x54daae[_0xec67('0x1a')](_0x2342c4)[_0xec67('0x1b')](_0x1bfb5e);}};}function respondWithFilteredResult(_0x533fb,_0x1a531e){return function(_0x308363){if(_0x308363){var _0x3e4ec8=typeof _0x1a531e['offset']===_0xec67('0x1c')&&typeof _0x1a531e[_0xec67('0x1d')]==='undefined';var _0x5d94f3=_0x308363['count'];var _0x414390=_0x3e4ec8?0x0:_0x1a531e[_0xec67('0x1e')];var _0x58a489=_0x3e4ec8?_0x308363[_0xec67('0x1f')]:_0x1a531e[_0xec67('0x1e')]+_0x1a531e[_0xec67('0x1d')];var _0x3df053;if(_0x58a489>=_0x5d94f3){_0x58a489=_0x5d94f3;_0x3df053=0xc8;}else{_0x3df053=0xce;}_0x533fb[_0xec67('0x1a')](_0x3df053);return _0x533fb['set']('Content-Range',_0x414390+'-'+_0x58a489+'/'+_0x5d94f3)[_0xec67('0x1b')](_0x308363);}return null;};}function patchUpdates(_0x27b2d2){return function(_0x16b6a6){try{jsonpatch[_0xec67('0x20')](_0x16b6a6,_0x27b2d2,!![]);}catch(_0x567997){return BPromise[_0xec67('0x21')](_0x567997);}return _0x16b6a6['save']();};}function saveUpdates(_0x1dc03b,_0x1d49c4){return function(_0x3f1061){if(_0x3f1061){return _0x3f1061[_0xec67('0x22')](_0x1dc03b)['then'](function(_0x395ad8){return _0x395ad8;});}return null;};}function removeEntity(_0x3cd3c2,_0x12506a){return function(_0x1c9684){if(_0x1c9684){return _0x1c9684[_0xec67('0x23')]()[_0xec67('0x24')](function(){_0x3cd3c2[_0xec67('0x1a')](0xcc)[_0xec67('0x25')]();});}};}function handleEntityNotFound(_0x3e8ba6,_0x174906){return function(_0x1bab1b){if(!_0x1bab1b){_0x3e8ba6[_0xec67('0x19')](0x194);}return _0x1bab1b;};}function handleError(_0x4fc9c6,_0x3d6bcf){_0x3d6bcf=_0x3d6bcf||0x1f4;return function(_0x4e6adb){logger['error'](_0x4e6adb[_0xec67('0x26')]);if(_0x4e6adb[_0xec67('0x27')]){delete _0x4e6adb[_0xec67('0x27')];}_0x4fc9c6[_0xec67('0x1a')](_0x3d6bcf)[_0xec67('0x28')](_0x4e6adb);};}exports[_0xec67('0x29')]=function(_0x297129,_0x558d6a){var _0x239204={},_0x2b53ff={},_0x1e4b66={'count':0x0,'rows':[]};var _0xf6970a=_[_0xec67('0x2a')](db[_0xec67('0x2b')]['rawAttributes'],function(_0x26c600){return{'name':_0x26c600[_0xec67('0x2c')],'type':_0x26c600[_0xec67('0x2d')]['key']};});_0x2b53ff[_0xec67('0x2e')]=_[_0xec67('0x2a')](_0xf6970a,_0xec67('0x27'));_0x2b53ff[_0xec67('0x2f')]=_[_0xec67('0x30')](_0x297129[_0xec67('0x2f')]);_0x2b53ff['filters']=_['intersection'](_0x2b53ff[_0xec67('0x2e')],_0x2b53ff[_0xec67('0x2f')]);_0x239204[_0xec67('0x31')]=_[_0xec67('0x32')](_0x2b53ff[_0xec67('0x2e')],qs['fields'](_0x297129['query'][_0xec67('0x33')]));_0x239204[_0xec67('0x31')]=_0x239204[_0xec67('0x31')][_0xec67('0x34')]?_0x239204[_0xec67('0x31')]:_0x2b53ff[_0xec67('0x2e')];if(!_0x297129[_0xec67('0x2f')][_0xec67('0x35')]('nolimit')){_0x239204[_0xec67('0x1d')]=qs[_0xec67('0x1d')](_0x297129['query'][_0xec67('0x1d')]);_0x239204['offset']=qs[_0xec67('0x1e')](_0x297129[_0xec67('0x2f')]['offset']);}_0x239204['order']=qs[_0xec67('0x36')](_0x297129[_0xec67('0x2f')][_0xec67('0x36')]);_0x239204[_0xec67('0x37')]=qs['filters'](_[_0xec67('0x38')](_0x297129[_0xec67('0x2f')],_0x2b53ff['filters']),_0xf6970a);if(_0x297129[_0xec67('0x2f')][_0xec67('0x39')]){_0x239204[_0xec67('0x37')]=_[_0xec67('0x3a')](_0x239204[_0xec67('0x37')],{'$or':_[_0xec67('0x2a')](_0xf6970a,function(_0x2439b2){if(_0x2439b2[_0xec67('0x2d')]!==_0xec67('0x3b')){var _0x57f43d={};_0x57f43d[_0x2439b2['name']]={'$like':'%'+_0x297129[_0xec67('0x2f')][_0xec67('0x39')]+'%'};return _0x57f43d;}})});}_0x239204=_['merge']({},_0x239204,_0x297129[_0xec67('0x3c')]);var _0x3c2327={'where':_0x239204[_0xec67('0x37')]};return db[_0xec67('0x2b')][_0xec67('0x1f')](_0x3c2327)[_0xec67('0x24')](function(_0x220f16){_0x1e4b66['count']=_0x220f16;if(_0x297129[_0xec67('0x2f')][_0xec67('0x3d')]){_0x239204[_0xec67('0x3e')]=[{'all':!![]}];}return db[_0xec67('0x2b')][_0xec67('0x3f')](_0x239204);})[_0xec67('0x24')](function(_0x54c818){_0x1e4b66[_0xec67('0x40')]=_0x54c818;return _0x1e4b66;})[_0xec67('0x24')](respondWithFilteredResult(_0x558d6a,_0x239204))[_0xec67('0x41')](handleError(_0x558d6a,null));};exports['show']=function(_0x24df6e,_0x5980d0){var _0x1fdcf0={'raw':!![],'where':{'id':_0x24df6e[_0xec67('0x42')]['id']}},_0x2ef53c={};_0x2ef53c[_0xec67('0x2e')]=_['keys'](db['WhatsappQueueReport']['rawAttributes']);_0x2ef53c['query']=_[_0xec67('0x30')](_0x24df6e[_0xec67('0x2f')]);_0x2ef53c['filters']=_[_0xec67('0x32')](_0x2ef53c[_0xec67('0x2e')],_0x2ef53c[_0xec67('0x2f')]);_0x1fdcf0[_0xec67('0x31')]=_[_0xec67('0x32')](_0x2ef53c['model'],qs[_0xec67('0x33')](_0x24df6e[_0xec67('0x2f')]['fields']));_0x1fdcf0['attributes']=_0x1fdcf0[_0xec67('0x31')]['length']?_0x1fdcf0[_0xec67('0x31')]:_0x2ef53c['model'];if(_0x24df6e[_0xec67('0x2f')][_0xec67('0x3d')]){_0x1fdcf0['include']=[{'all':!![]}];}_0x1fdcf0=_['merge']({},_0x1fdcf0,_0x24df6e[_0xec67('0x3c')]);return db['WhatsappQueueReport'][_0xec67('0x43')](_0x1fdcf0)['then'](handleEntityNotFound(_0x5980d0,null))[_0xec67('0x24')](respondWithResult(_0x5980d0,null))[_0xec67('0x41')](handleError(_0x5980d0,null));};exports[_0xec67('0x44')]=function(_0x333622,_0x5020c0){return db[_0xec67('0x2b')]['create'](_0x333622[_0xec67('0x45')],{})[_0xec67('0x24')](respondWithResult(_0x5020c0,0xc9))[_0xec67('0x41')](handleError(_0x5020c0,null));};exports[_0xec67('0x22')]=function(_0x331b70,_0x85d686){if(_0x331b70['body']['id']){delete _0x331b70['body']['id'];}return db['WhatsappQueueReport'][_0xec67('0x43')]({'where':{'id':_0x331b70[_0xec67('0x42')]['id']}})[_0xec67('0x24')](handleEntityNotFound(_0x85d686,null))['then'](saveUpdates(_0x331b70['body'],null))['then'](respondWithResult(_0x85d686,null))['catch'](handleError(_0x85d686,null));};exports[_0xec67('0x23')]=function(_0x23749a,_0x22eb66){return db[_0xec67('0x2b')][_0xec67('0x43')]({'where':{'id':_0x23749a['params']['id']}})[_0xec67('0x24')](handleEntityNotFound(_0x22eb66,null))[_0xec67('0x24')](removeEntity(_0x22eb66,null))['catch'](handleError(_0x22eb66,null));};exports[_0xec67('0x46')]=function(_0x42b918,_0x222a6e){return db[_0xec67('0x2b')][_0xec67('0x46')]()['then'](respondWithResult(_0x222a6e,null))[_0xec67('0x41')](handleError(_0x222a6e,null));}; \ No newline at end of file +var _0x03f6=['../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','WhatsappQueueReport','includeAll','show','include','options','find','catch','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xe0553,_0x392e55){var _0x5ae578=function(_0x285d7a){while(--_0x285d7a){_0xe0553['push'](_0xe0553['shift']());}};_0x5ae578(++_0x392e55);}(_0x03f6,0x199));var _0x603f=function(_0x20fc1f,_0x37debc){_0x20fc1f=_0x20fc1f-0x0;var _0xa8d9ee=_0x03f6[_0x20fc1f];return _0xa8d9ee;};'use strict';var emlformat=require(_0x603f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x603f('0x1'));var rp=require(_0x603f('0x2'));var moment=require(_0x603f('0x3'));var BPromise=require(_0x603f('0x4'));var Mustache=require(_0x603f('0x5'));var util=require(_0x603f('0x6'));var path=require(_0x603f('0x7'));var sox=require(_0x603f('0x8'));var csv=require(_0x603f('0x9'));var ejs=require(_0x603f('0xa'));var fs=require('fs');var fs_extra=require(_0x603f('0xb'));var _=require('lodash');var squel=require(_0x603f('0xc'));var crypto=require('crypto');var jsforce=require(_0x603f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x603f('0x9'));var querystring=require(_0x603f('0xe'));var Papa=require('papaparse');var Redis=require(_0x603f('0xf'));var authService=require(_0x603f('0x10'));var qs=require(_0x603f('0x11'));var as=require(_0x603f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x603f('0x13'))(_0x603f('0x14'));var utils=require(_0x603f('0x15'));var config=require(_0x603f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x603f('0x17'))['db'];function respondWithStatusCode(_0x2c18cc,_0x1b7565){_0x1b7565=_0x1b7565||0xcc;return function(_0x22c3dc){if(_0x22c3dc){return _0x2c18cc[_0x603f('0x18')](_0x1b7565);}return _0x2c18cc[_0x603f('0x19')](_0x1b7565)[_0x603f('0x1a')]();};}function respondWithResult(_0x4253de,_0x47e40f){_0x47e40f=_0x47e40f||0xc8;return function(_0x37479a){if(_0x37479a){return _0x4253de[_0x603f('0x19')](_0x47e40f)['json'](_0x37479a);}};}function respondWithFilteredResult(_0x283350,_0x358a73){return function(_0x4750b3){if(_0x4750b3){var _0x40d1b7=typeof _0x358a73['offset']===_0x603f('0x1b')&&typeof _0x358a73[_0x603f('0x1c')]===_0x603f('0x1b');var _0x44a0a0=_0x4750b3[_0x603f('0x1d')];var _0x2ea8f5=_0x40d1b7?0x0:_0x358a73[_0x603f('0x1e')];var _0x8cc4ca=_0x40d1b7?_0x4750b3[_0x603f('0x1d')]:_0x358a73['offset']+_0x358a73[_0x603f('0x1c')];var _0x383c91;if(_0x8cc4ca>=_0x44a0a0){_0x8cc4ca=_0x44a0a0;_0x383c91=0xc8;}else{_0x383c91=0xce;}_0x283350[_0x603f('0x19')](_0x383c91);return _0x283350[_0x603f('0x1f')](_0x603f('0x20'),_0x2ea8f5+'-'+_0x8cc4ca+'/'+_0x44a0a0)['json'](_0x4750b3);}return null;};}function patchUpdates(_0x14aee9){return function(_0x4ef16d){try{jsonpatch[_0x603f('0x21')](_0x4ef16d,_0x14aee9,!![]);}catch(_0x5b96c9){return BPromise[_0x603f('0x22')](_0x5b96c9);}return _0x4ef16d[_0x603f('0x23')]();};}function saveUpdates(_0x2e9179,_0xd36e90){return function(_0x272dc1){if(_0x272dc1){return _0x272dc1[_0x603f('0x24')](_0x2e9179)[_0x603f('0x25')](function(_0x3c3022){return _0x3c3022;});}return null;};}function removeEntity(_0x5e4a,_0x2fb2d9){return function(_0x57eb03){if(_0x57eb03){return _0x57eb03[_0x603f('0x26')]()[_0x603f('0x25')](function(){_0x5e4a[_0x603f('0x19')](0xcc)[_0x603f('0x1a')]();});}};}function handleEntityNotFound(_0x5b0692,_0x40648d){return function(_0x47a074){if(!_0x47a074){_0x5b0692[_0x603f('0x18')](0x194);}return _0x47a074;};}function handleError(_0x5411ae,_0x38dfef){_0x38dfef=_0x38dfef||0x1f4;return function(_0x46c0ac){logger['error'](_0x46c0ac[_0x603f('0x27')]);if(_0x46c0ac[_0x603f('0x28')]){delete _0x46c0ac['name'];}_0x5411ae[_0x603f('0x19')](_0x38dfef)[_0x603f('0x29')](_0x46c0ac);};}exports[_0x603f('0x2a')]=function(_0x4d324c,_0x1b3b9b){var _0x42a259={},_0x155050={},_0x3a7282={'count':0x0,'rows':[]};var _0x333f07=_['map'](db['WhatsappQueueReport'][_0x603f('0x2b')],function(_0x53c688){return{'name':_0x53c688[_0x603f('0x2c')],'type':_0x53c688[_0x603f('0x2d')][_0x603f('0x2e')]};});_0x155050['model']=_['map'](_0x333f07,_0x603f('0x28'));_0x155050[_0x603f('0x2f')]=_['keys'](_0x4d324c[_0x603f('0x2f')]);_0x155050[_0x603f('0x30')]=_[_0x603f('0x31')](_0x155050['model'],_0x155050[_0x603f('0x2f')]);_0x42a259['attributes']=_[_0x603f('0x31')](_0x155050[_0x603f('0x32')],qs[_0x603f('0x33')](_0x4d324c[_0x603f('0x2f')][_0x603f('0x33')]));_0x42a259[_0x603f('0x34')]=_0x42a259[_0x603f('0x34')][_0x603f('0x35')]?_0x42a259[_0x603f('0x34')]:_0x155050[_0x603f('0x32')];if(!_0x4d324c[_0x603f('0x2f')][_0x603f('0x36')](_0x603f('0x37'))){_0x42a259[_0x603f('0x1c')]=qs[_0x603f('0x1c')](_0x4d324c[_0x603f('0x2f')]['limit']);_0x42a259[_0x603f('0x1e')]=qs[_0x603f('0x1e')](_0x4d324c[_0x603f('0x2f')][_0x603f('0x1e')]);}_0x42a259[_0x603f('0x38')]=qs['sort'](_0x4d324c[_0x603f('0x2f')]['sort']);_0x42a259[_0x603f('0x39')]=qs[_0x603f('0x30')](_[_0x603f('0x3a')](_0x4d324c[_0x603f('0x2f')],_0x155050[_0x603f('0x30')]),_0x333f07);if(_0x4d324c[_0x603f('0x2f')]['filter']){_0x42a259['where']=_['merge'](_0x42a259['where'],{'$or':_['map'](_0x333f07,function(_0x52123b){if(_0x52123b[_0x603f('0x2d')]!=='VIRTUAL'){var _0x397abf={};_0x397abf[_0x52123b['name']]={'$like':'%'+_0x4d324c[_0x603f('0x2f')][_0x603f('0x3b')]+'%'};return _0x397abf;}})});}_0x42a259=_[_0x603f('0x3c')]({},_0x42a259,_0x4d324c['options']);var _0x4b009d={'where':_0x42a259[_0x603f('0x39')]};return db[_0x603f('0x3d')][_0x603f('0x1d')](_0x4b009d)[_0x603f('0x25')](function(_0x52f286){_0x3a7282[_0x603f('0x1d')]=_0x52f286;if(_0x4d324c[_0x603f('0x2f')][_0x603f('0x3e')]){_0x42a259['include']=[{'all':!![]}];}return db[_0x603f('0x3d')]['findAll'](_0x42a259);})['then'](function(_0x4fda46){_0x3a7282['rows']=_0x4fda46;return _0x3a7282;})[_0x603f('0x25')](respondWithFilteredResult(_0x1b3b9b,_0x42a259))['catch'](handleError(_0x1b3b9b,null));};exports[_0x603f('0x3f')]=function(_0x529880,_0xab5d31){var _0x6e4047={'raw':!![],'where':{'id':_0x529880['params']['id']}},_0x380df0={};_0x380df0[_0x603f('0x32')]=_['keys'](db[_0x603f('0x3d')]['rawAttributes']);_0x380df0[_0x603f('0x2f')]=_['keys'](_0x529880[_0x603f('0x2f')]);_0x380df0[_0x603f('0x30')]=_[_0x603f('0x31')](_0x380df0[_0x603f('0x32')],_0x380df0['query']);_0x6e4047[_0x603f('0x34')]=_[_0x603f('0x31')](_0x380df0['model'],qs[_0x603f('0x33')](_0x529880['query'][_0x603f('0x33')]));_0x6e4047[_0x603f('0x34')]=_0x6e4047[_0x603f('0x34')][_0x603f('0x35')]?_0x6e4047['attributes']:_0x380df0[_0x603f('0x32')];if(_0x529880[_0x603f('0x2f')]['includeAll']){_0x6e4047[_0x603f('0x40')]=[{'all':!![]}];}_0x6e4047=_[_0x603f('0x3c')]({},_0x6e4047,_0x529880[_0x603f('0x41')]);return db[_0x603f('0x3d')][_0x603f('0x42')](_0x6e4047)[_0x603f('0x25')](handleEntityNotFound(_0xab5d31,null))[_0x603f('0x25')](respondWithResult(_0xab5d31,null))[_0x603f('0x43')](handleError(_0xab5d31,null));};exports[_0x603f('0x44')]=function(_0x337b04,_0x7780c8){return db[_0x603f('0x3d')]['create'](_0x337b04[_0x603f('0x45')],{})[_0x603f('0x25')](respondWithResult(_0x7780c8,0xc9))[_0x603f('0x43')](handleError(_0x7780c8,null));};exports[_0x603f('0x24')]=function(_0x1314b0,_0x2e946b){if(_0x1314b0['body']['id']){delete _0x1314b0[_0x603f('0x45')]['id'];}return db[_0x603f('0x3d')][_0x603f('0x42')]({'where':{'id':_0x1314b0[_0x603f('0x46')]['id']}})[_0x603f('0x25')](handleEntityNotFound(_0x2e946b,null))['then'](saveUpdates(_0x1314b0['body'],null))[_0x603f('0x25')](respondWithResult(_0x2e946b,null))['catch'](handleError(_0x2e946b,null));};exports[_0x603f('0x26')]=function(_0x57d09d,_0x3ca20c){return db[_0x603f('0x3d')][_0x603f('0x42')]({'where':{'id':_0x57d09d[_0x603f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ca20c,null))[_0x603f('0x25')](removeEntity(_0x3ca20c,null))[_0x603f('0x43')](handleError(_0x3ca20c,null));};exports['describe']=function(_0x134aef,_0x29c1d1){return db['WhatsappQueueReport'][_0x603f('0x47')]()['then'](respondWithResult(_0x29c1d1,null))[_0x603f('0x43')](handleError(_0x29c1d1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 94eb53b..0622905 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 _0x94cb=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappQueueReport.attributes','define','WhatsappQueueReport'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x94cb,0x16e));var _0xb94c=function(_0x286d0f,_0x597012){_0x286d0f=_0x286d0f-0x0;var _0x6c91d4=_0x94cb[_0x286d0f];return _0x6c91d4;};'use strict';var _=require(_0xb94c('0x0'));var util=require(_0xb94c('0x1'));var logger=require(_0xb94c('0x2'))(_0xb94c('0x3'));var moment=require(_0xb94c('0x4'));var BPromise=require('bluebird');var rp=require(_0xb94c('0x5'));var fs=require('fs');var path=require(_0xb94c('0x6'));var rimraf=require(_0xb94c('0x7'));var config=require('../../config/environment');var attributes=require(_0xb94c('0x8'));module['exports']=function(_0x51fb5e,_0x42382c){return _0x51fb5e[_0xb94c('0x9')](_0xb94c('0xa'),attributes,{'tableName':_0xb94c('0xb'),'paranoid':![],'indexes':[{'name':_0xb94c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d56=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','uniqueid'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x9d56,0x64));var _0x69d5=function(_0x2c8044,_0x2ba090){_0x2c8044=_0x2c8044-0x0;var _0x4c8c9d=_0x9d56[_0x2c8044];return _0x4c8c9d;};'use strict';var _=require(_0x69d5('0x0'));var util=require(_0x69d5('0x1'));var logger=require(_0x69d5('0x2'))(_0x69d5('0x3'));var moment=require(_0x69d5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x69d5('0x5'));var rimraf=require(_0x69d5('0x6'));var config=require(_0x69d5('0x7'));var attributes=require(_0x69d5('0x8'));module['exports']=function(_0x5922df,_0x3473a7){return _0x5922df['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x69d5('0x9'),'fields':[_0x69d5('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 d34573a..f241538 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 _0x7986=['stringify','UpdateWhatsappQueueReport','update','raw','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','body','options','then','CreateWhatsappQueueReport'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x7986,0x14f));var _0x6798=function(_0x28be52,_0x46c500){_0x28be52=_0x28be52-0x0;var _0x8f9def=_0x7986[_0x28be52];return _0x8f9def;};'use strict';var _=require(_0x6798('0x0'));var util=require(_0x6798('0x1'));var moment=require(_0x6798('0x2'));var BPromise=require(_0x6798('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6798('0x4'));var db=require(_0x6798('0x5'))['db'];var utils=require(_0x6798('0x6'));var logger=require(_0x6798('0x7'))(_0x6798('0x8'));var config=require(_0x6798('0x9'));var jayson=require(_0x6798('0xa'));var client=jayson['client'][_0x6798('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x222d4b,_0x1458ca,_0x2900f7){return new BPromise(function(_0x46372f,_0x16bd77){return client[_0x6798('0xc')](_0x222d4b,_0x2900f7)['then'](function(_0x5bfc18){logger[_0x6798('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1458ca,_0x6798('0xe'));logger[_0x6798('0xf')](_0x6798('0x10'),_0x1458ca,'request\x20sent',JSON['stringify'](_0x5bfc18));if(_0x5bfc18[_0x6798('0x11')]){if(_0x5bfc18['error'][_0x6798('0x12')]===0x1f4){logger[_0x6798('0x11')](_0x6798('0x13'),_0x1458ca,_0x5bfc18[_0x6798('0x11')][_0x6798('0x14')]);return _0x16bd77(_0x5bfc18[_0x6798('0x11')]['message']);}logger[_0x6798('0x11')](_0x6798('0x13'),_0x1458ca,_0x5bfc18[_0x6798('0x11')]['message']);return _0x46372f(_0x5bfc18[_0x6798('0x11')]['message']);}else{logger[_0x6798('0xd')](_0x6798('0x13'),_0x1458ca,_0x6798('0xe'));_0x46372f(_0x5bfc18[_0x6798('0x15')][_0x6798('0x14')]);}})[_0x6798('0x16')](function(_0x183349){logger[_0x6798('0x11')](_0x6798('0x13'),_0x1458ca,_0x183349);_0x16bd77(_0x183349);});});}exports['CreateWhatsappQueueReport']=function(_0x3e9b03){var _0x89e06a=this;return new Promise(function(_0x145004,_0x324f20){return db[_0x6798('0x17')]['create'](_0x3e9b03[_0x6798('0x18')],{'raw':_0x3e9b03[_0x6798('0x19')]?_0x3e9b03['options']['raw']===undefined?!![]:![]:!![]})[_0x6798('0x1a')](function(_0x2a4cec){logger[_0x6798('0xd')](_0x6798('0x1b'),_0x3e9b03);logger['debug']('CreateWhatsappQueueReport',_0x3e9b03,JSON[_0x6798('0x1c')](_0x2a4cec));_0x145004(_0x2a4cec);})['catch'](function(_0x4ea1c3){logger[_0x6798('0x11')](_0x6798('0x1b'),_0x4ea1c3[_0x6798('0x14')],_0x3e9b03);_0x324f20(_0x89e06a[_0x6798('0x11')](0x1f4,_0x4ea1c3[_0x6798('0x14')]));});});};exports[_0x6798('0x1d')]=function(_0x8fbfbe){var _0x1f0817=this;return new Promise(function(_0x3ef95c,_0x177f41){return db[_0x6798('0x17')][_0x6798('0x1e')](_0x8fbfbe[_0x6798('0x18')],{'raw':_0x8fbfbe['options']?_0x8fbfbe[_0x6798('0x19')][_0x6798('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8fbfbe['options']?_0x8fbfbe[_0x6798('0x19')]['where']||null:null,'attributes':_0x8fbfbe[_0x6798('0x19')]?_0x8fbfbe[_0x6798('0x19')]['attributes']||null:null,'limit':_0x8fbfbe[_0x6798('0x19')]?_0x8fbfbe[_0x6798('0x19')][_0x6798('0x20')]||null:null})['then'](function(_0x4b3c9f){logger[_0x6798('0xd')](_0x6798('0x1d'),_0x8fbfbe);logger[_0x6798('0xf')](_0x6798('0x1d'),_0x8fbfbe,JSON[_0x6798('0x1c')](_0x4b3c9f));_0x3ef95c(_0x4b3c9f);})[_0x6798('0x16')](function(_0x1a626e){logger[_0x6798('0x11')]('UpdateWhatsappQueueReport',_0x1a626e[_0x6798('0x14')],_0x8fbfbe);_0x177f41(_0x1f0817[_0x6798('0x11')](0x1f4,_0x1a626e[_0x6798('0x14')]));});});}; \ No newline at end of file +var _0xba5c=['then','info','WhatsappQueueReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x1fee0,_0xb4f666){var _0x512d83=function(_0x59d3ad){while(--_0x59d3ad){_0x1fee0['push'](_0x1fee0['shift']());}};_0x512d83(++_0xb4f666);}(_0xba5c,0xdb));var _0xcba5=function(_0x41ae0f,_0x130120){_0x41ae0f=_0x41ae0f-0x0;var _0x2817d9=_0xba5c[_0x41ae0f];return _0x2817d9;};'use strict';var _=require(_0xcba5('0x0'));var util=require(_0xcba5('0x1'));var moment=require(_0xcba5('0x2'));var BPromise=require(_0xcba5('0x3'));var rs=require(_0xcba5('0x4'));var fs=require('fs');var Redis=require(_0xcba5('0x5'));var db=require(_0xcba5('0x6'))['db'];var utils=require(_0xcba5('0x7'));var logger=require(_0xcba5('0x8'))('rpc');var config=require(_0xcba5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcba5('0xa')][_0xcba5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x224d40,_0x3d0de9,_0x11bf16){return new BPromise(function(_0x2e8299,_0x2a23eb){return client['request'](_0x224d40,_0x11bf16)[_0xcba5('0xc')](function(_0x5bb235){logger[_0xcba5('0xd')](_0xcba5('0xe'),_0x3d0de9,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3d0de9,'request\x20sent',JSON[_0xcba5('0xf')](_0x5bb235));if(_0x5bb235[_0xcba5('0x10')]){if(_0x5bb235[_0xcba5('0x10')][_0xcba5('0x11')]===0x1f4){logger[_0xcba5('0x10')](_0xcba5('0xe'),_0x3d0de9,_0x5bb235[_0xcba5('0x10')]['message']);return _0x2a23eb(_0x5bb235[_0xcba5('0x10')]['message']);}logger['error'](_0xcba5('0xe'),_0x3d0de9,_0x5bb235[_0xcba5('0x10')][_0xcba5('0x12')]);return _0x2e8299(_0x5bb235[_0xcba5('0x10')][_0xcba5('0x12')]);}else{logger[_0xcba5('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3d0de9,_0xcba5('0x13'));_0x2e8299(_0x5bb235[_0xcba5('0x14')][_0xcba5('0x12')]);}})[_0xcba5('0x15')](function(_0x534414){logger[_0xcba5('0x10')](_0xcba5('0xe'),_0x3d0de9,_0x534414);_0x2a23eb(_0x534414);});});}exports['CreateWhatsappQueueReport']=function(_0x1190b8){var _0x3e31cc=this;return new Promise(function(_0x232d63,_0xcac5c8){return db[_0xcba5('0x16')][_0xcba5('0x17')](_0x1190b8[_0xcba5('0x18')],{'raw':_0x1190b8[_0xcba5('0x19')]?_0x1190b8[_0xcba5('0x19')][_0xcba5('0x1a')]===undefined?!![]:![]:!![]})[_0xcba5('0xc')](function(_0x3cf6d5){logger[_0xcba5('0xd')]('CreateWhatsappQueueReport',_0x1190b8);logger['debug']('CreateWhatsappQueueReport',_0x1190b8,JSON[_0xcba5('0xf')](_0x3cf6d5));_0x232d63(_0x3cf6d5);})[_0xcba5('0x15')](function(_0x34d32a){logger['error'](_0xcba5('0x1b'),_0x34d32a[_0xcba5('0x12')],_0x1190b8);_0xcac5c8(_0x3e31cc['error'](0x1f4,_0x34d32a['message']));});});};exports[_0xcba5('0x1c')]=function(_0x344a4f){var _0x4b6ea4=this;return new Promise(function(_0x70c75e,_0x40be87){return db[_0xcba5('0x16')][_0xcba5('0x1d')](_0x344a4f['body'],{'raw':_0x344a4f[_0xcba5('0x19')]?_0x344a4f[_0xcba5('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x344a4f[_0xcba5('0x19')]?_0x344a4f[_0xcba5('0x19')][_0xcba5('0x1e')]||null:null,'attributes':_0x344a4f[_0xcba5('0x19')]?_0x344a4f['options']['attributes']||null:null,'limit':_0x344a4f['options']?_0x344a4f[_0xcba5('0x19')][_0xcba5('0x1f')]||null:null})[_0xcba5('0xc')](function(_0x1bca64){logger[_0xcba5('0xd')](_0xcba5('0x1c'),_0x344a4f);logger[_0xcba5('0x20')](_0xcba5('0x1c'),_0x344a4f,JSON[_0xcba5('0xf')](_0x1bca64));_0x70c75e(_0x1bca64);})['catch'](function(_0x406fc6){logger['error'](_0xcba5('0x1c'),_0x406fc6[_0xcba5('0x12')],_0x344a4f);_0x40be87(_0x4b6ea4['error'](0x1f4,_0x406fc6[_0xcba5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index abca78b..36711d0 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 _0xe235=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x102d5c,_0x4d89dd){var _0xe06cc2=function(_0x5b593f){while(--_0x5b593f){_0x102d5c['push'](_0x102d5c['shift']());}};_0xe06cc2(++_0x4d89dd);}(_0xe235,0x12b));var _0x5e23=function(_0x1d6f1e,_0x22a3f2){_0x1d6f1e=_0x1d6f1e-0x0;var _0xc74a85=_0xe235[_0x1d6f1e];return _0xc74a85;};'use strict';var multer=require(_0x5e23('0x0'));var util=require(_0x5e23('0x1'));var path=require('path');var timeout=require(_0x5e23('0x2'));var express=require(_0x5e23('0x3'));var router=express[_0x5e23('0x4')]();var fs_extra=require(_0x5e23('0x5'));var auth=require(_0x5e23('0x6'));var interaction=require(_0x5e23('0x7'));var config=require(_0x5e23('0x8'));var controller=require(_0x5e23('0x9'));router[_0x5e23('0xa')]('/',auth[_0x5e23('0xb')](),controller[_0x5e23('0xc')]);router[_0x5e23('0xa')](_0x5e23('0xd'),auth[_0x5e23('0xb')](),controller[_0x5e23('0xe')]);router[_0x5e23('0xa')](_0x5e23('0xf'),auth['isAuthenticated'](),controller[_0x5e23('0x10')]);router[_0x5e23('0x11')]('/',auth[_0x5e23('0xb')](),controller[_0x5e23('0x12')]);router[_0x5e23('0x13')](_0x5e23('0xf'),auth[_0x5e23('0xb')](),controller[_0x5e23('0x14')]);router[_0x5e23('0x15')]('/:id',auth[_0x5e23('0xb')](),controller['destroy']);module[_0x5e23('0x16')]=router; \ No newline at end of file +var _0x8da4=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','index','get','/describe','isAuthenticated','describe','show','create','put','/:id'];(function(_0x45b63f,_0x57d15c){var _0x2ad950=function(_0x254ca0){while(--_0x254ca0){_0x45b63f['push'](_0x45b63f['shift']());}};_0x2ad950(++_0x57d15c);}(_0x8da4,0x1a8));var _0x48da=function(_0x37a5b0,_0xccebf5){_0x37a5b0=_0x37a5b0-0x0;var _0x321dbf=_0x8da4[_0x37a5b0];return _0x321dbf;};'use strict';var multer=require(_0x48da('0x0'));var util=require('util');var path=require(_0x48da('0x1'));var timeout=require(_0x48da('0x2'));var express=require(_0x48da('0x3'));var router=express[_0x48da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x48da('0x5'));var interaction=require(_0x48da('0x6'));var config=require('../../config/environment');var controller=require(_0x48da('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x48da('0x8')]);router[_0x48da('0x9')](_0x48da('0xa'),auth[_0x48da('0xb')](),controller[_0x48da('0xc')]);router[_0x48da('0x9')]('/:id',auth[_0x48da('0xb')](),controller[_0x48da('0xd')]);router['post']('/',auth[_0x48da('0xb')](),controller[_0x48da('0xe')]);router[_0x48da('0xf')](_0x48da('0x10'),auth['isAuthenticated'](),controller[_0x48da('0x11')]);router[_0x48da('0x12')]('/:id',auth[_0x48da('0xb')](),controller[_0x48da('0x13')]);module[_0x48da('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index f260526..b310a1a 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 _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x334c6c,_0x3978fb){var _0x2e3ba1=function(_0x46ab97){while(--_0x46ab97){_0x334c6c['push'](_0x334c6c['shift']());}};_0x2e3ba1(++_0x3978fb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a174e,_0x48d236){_0x4a174e=_0x4a174e-0x0;var _0x4ff7cd=_0x5f2f[_0x4a174e];return _0x4ff7cd;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x46add2,_0x4346d4){_0x46add2=_0x46add2-0x0;var _0x226d64=_0xb10b[_0x46add2];return _0x226d64;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c4c54e2..8d18a81 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 _0x81ae=['path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','send','WhatsappTransferReport','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x3063f9,_0x385fc7){var _0x100015=function(_0x35a166){while(--_0x35a166){_0x3063f9['push'](_0x3063f9['shift']());}};_0x100015(++_0x385fc7);}(_0x81ae,0xdf));var _0xe81a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x81ae[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xe81a('0x0'));var rimraf=require(_0xe81a('0x1'));var zipdir=require(_0xe81a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe81a('0x3'));var moment=require(_0xe81a('0x4'));var BPromise=require(_0xe81a('0x5'));var Mustache=require(_0xe81a('0x6'));var util=require(_0xe81a('0x7'));var path=require(_0xe81a('0x8'));var sox=require(_0xe81a('0x9'));var csv=require('to-csv');var ejs=require(_0xe81a('0xa'));var fs=require('fs');var fs_extra=require(_0xe81a('0xb'));var _=require(_0xe81a('0xc'));var squel=require('squel');var crypto=require(_0xe81a('0xd'));var jsforce=require(_0xe81a('0xe'));var deskjs=require(_0xe81a('0xf'));var toCsv=require(_0xe81a('0x10'));var querystring=require(_0xe81a('0x11'));var Papa=require('papaparse');var Redis=require(_0xe81a('0x12'));var authService=require(_0xe81a('0x13'));var qs=require(_0xe81a('0x14'));var as=require(_0xe81a('0x15'));var hardwareService=require(_0xe81a('0x16'));var logger=require('../../config/logger')(_0xe81a('0x17'));var utils=require(_0xe81a('0x18'));var config=require(_0xe81a('0x19'));var licenseUtil=require(_0xe81a('0x1a'));var db=require(_0xe81a('0x1b'))['db'];function respondWithStatusCode(_0xf4382e,_0x4fd6e6){_0x4fd6e6=_0x4fd6e6||0xcc;return function(_0x1a77d5){if(_0x1a77d5){return _0xf4382e['sendStatus'](_0x4fd6e6);}return _0xf4382e['status'](_0x4fd6e6)[_0xe81a('0x1c')]();};}function respondWithResult(_0x3eea75,_0x2eebe8){_0x2eebe8=_0x2eebe8||0xc8;return function(_0x32a204){if(_0x32a204){return _0x3eea75[_0xe81a('0x1d')](_0x2eebe8)[_0xe81a('0x1e')](_0x32a204);}};}function respondWithFilteredResult(_0x2795bc,_0x26b191){return function(_0x63760c){if(_0x63760c){var _0x3e46b0=typeof _0x26b191[_0xe81a('0x1f')]===_0xe81a('0x20')&&typeof _0x26b191['limit']===_0xe81a('0x20');var _0x2935d0=_0x63760c[_0xe81a('0x21')];var _0x3f4058=_0x3e46b0?0x0:_0x26b191[_0xe81a('0x1f')];var _0x16013e=_0x3e46b0?_0x63760c['count']:_0x26b191['offset']+_0x26b191[_0xe81a('0x22')];var _0xc70792;if(_0x16013e>=_0x2935d0){_0x16013e=_0x2935d0;_0xc70792=0xc8;}else{_0xc70792=0xce;}_0x2795bc[_0xe81a('0x1d')](_0xc70792);return _0x2795bc['set'](_0xe81a('0x23'),_0x3f4058+'-'+_0x16013e+'/'+_0x2935d0)[_0xe81a('0x1e')](_0x63760c);}return null;};}function patchUpdates(_0x5af24e){return function(_0x195661){try{jsonpatch['apply'](_0x195661,_0x5af24e,!![]);}catch(_0x3b207c){return BPromise[_0xe81a('0x24')](_0x3b207c);}return _0x195661[_0xe81a('0x25')]();};}function saveUpdates(_0x2db2f5,_0x5bd307){return function(_0x18759b){if(_0x18759b){return _0x18759b['update'](_0x2db2f5)['then'](function(_0x2281dd){return _0x2281dd;});}return null;};}function removeEntity(_0x29e72c,_0x53445f){return function(_0x52b059){if(_0x52b059){return _0x52b059[_0xe81a('0x26')]()[_0xe81a('0x27')](function(){_0x29e72c['status'](0xcc)[_0xe81a('0x1c')]();});}};}function handleEntityNotFound(_0x3b8622,_0x2ea72a){return function(_0x2d072d){if(!_0x2d072d){_0x3b8622[_0xe81a('0x28')](0x194);}return _0x2d072d;};}function handleError(_0x88cd3a,_0x164572){_0x164572=_0x164572||0x1f4;return function(_0x42ebd9){logger[_0xe81a('0x29')](_0x42ebd9[_0xe81a('0x2a')]);if(_0x42ebd9['name']){delete _0x42ebd9[_0xe81a('0x2b')];}_0x88cd3a[_0xe81a('0x1d')](_0x164572)[_0xe81a('0x2c')](_0x42ebd9);};}exports['index']=function(_0x1de8b4,_0xce76a4){var _0x2252a1={},_0x3bf8e3={},_0x5da7dd={'count':0x0,'rows':[]};var _0x4d4a0a=_['map'](db[_0xe81a('0x2d')][_0xe81a('0x2e')],function(_0x2d24d6){return{'name':_0x2d24d6[_0xe81a('0x2f')],'type':_0x2d24d6[_0xe81a('0x30')]['key']};});_0x3bf8e3['model']=_['map'](_0x4d4a0a,_0xe81a('0x2b'));_0x3bf8e3[_0xe81a('0x31')]=_[_0xe81a('0x32')](_0x1de8b4[_0xe81a('0x31')]);_0x3bf8e3[_0xe81a('0x33')]=_['intersection'](_0x3bf8e3[_0xe81a('0x34')],_0x3bf8e3[_0xe81a('0x31')]);_0x2252a1['attributes']=_['intersection'](_0x3bf8e3[_0xe81a('0x34')],qs[_0xe81a('0x35')](_0x1de8b4[_0xe81a('0x31')][_0xe81a('0x35')]));_0x2252a1[_0xe81a('0x36')]=_0x2252a1[_0xe81a('0x36')][_0xe81a('0x37')]?_0x2252a1[_0xe81a('0x36')]:_0x3bf8e3[_0xe81a('0x34')];if(!_0x1de8b4[_0xe81a('0x31')][_0xe81a('0x38')]('nolimit')){_0x2252a1['limit']=qs[_0xe81a('0x22')](_0x1de8b4[_0xe81a('0x31')][_0xe81a('0x22')]);_0x2252a1[_0xe81a('0x1f')]=qs[_0xe81a('0x1f')](_0x1de8b4['query'][_0xe81a('0x1f')]);}_0x2252a1['order']=qs['sort'](_0x1de8b4[_0xe81a('0x31')][_0xe81a('0x39')]);_0x2252a1[_0xe81a('0x3a')]=qs[_0xe81a('0x33')](_[_0xe81a('0x3b')](_0x1de8b4[_0xe81a('0x31')],_0x3bf8e3['filters']),_0x4d4a0a);if(_0x1de8b4[_0xe81a('0x31')][_0xe81a('0x3c')]){_0x2252a1['where']=_[_0xe81a('0x3d')](_0x2252a1[_0xe81a('0x3a')],{'$or':_[_0xe81a('0x3e')](_0x4d4a0a,function(_0x48d85a){if(_0x48d85a['type']!=='VIRTUAL'){var _0x554810={};_0x554810[_0x48d85a['name']]={'$like':'%'+_0x1de8b4[_0xe81a('0x31')][_0xe81a('0x3c')]+'%'};return _0x554810;}})});}_0x2252a1=_[_0xe81a('0x3d')]({},_0x2252a1,_0x1de8b4[_0xe81a('0x3f')]);var _0x519a55={'where':_0x2252a1[_0xe81a('0x3a')]};return db[_0xe81a('0x2d')][_0xe81a('0x21')](_0x519a55)['then'](function(_0x16211c){_0x5da7dd['count']=_0x16211c;if(_0x1de8b4['query'][_0xe81a('0x40')]){_0x2252a1[_0xe81a('0x41')]=[{'all':!![]}];}return db[_0xe81a('0x2d')][_0xe81a('0x42')](_0x2252a1);})[_0xe81a('0x27')](function(_0x1b2d46){_0x5da7dd[_0xe81a('0x43')]=_0x1b2d46;return _0x5da7dd;})[_0xe81a('0x27')](respondWithFilteredResult(_0xce76a4,_0x2252a1))['catch'](handleError(_0xce76a4,null));};exports[_0xe81a('0x44')]=function(_0x8bceb1,_0x37701b){var _0x4de521={'raw':!![],'where':{'id':_0x8bceb1['params']['id']}},_0x22b89a={};_0x22b89a[_0xe81a('0x34')]=_[_0xe81a('0x32')](db[_0xe81a('0x2d')][_0xe81a('0x2e')]);_0x22b89a[_0xe81a('0x31')]=_[_0xe81a('0x32')](_0x8bceb1[_0xe81a('0x31')]);_0x22b89a[_0xe81a('0x33')]=_['intersection'](_0x22b89a[_0xe81a('0x34')],_0x22b89a['query']);_0x4de521[_0xe81a('0x36')]=_[_0xe81a('0x45')](_0x22b89a[_0xe81a('0x34')],qs['fields'](_0x8bceb1[_0xe81a('0x31')][_0xe81a('0x35')]));_0x4de521[_0xe81a('0x36')]=_0x4de521[_0xe81a('0x36')][_0xe81a('0x37')]?_0x4de521[_0xe81a('0x36')]:_0x22b89a['model'];if(_0x8bceb1[_0xe81a('0x31')]['includeAll']){_0x4de521[_0xe81a('0x41')]=[{'all':!![]}];}_0x4de521=_[_0xe81a('0x3d')]({},_0x4de521,_0x8bceb1[_0xe81a('0x3f')]);return db[_0xe81a('0x2d')][_0xe81a('0x46')](_0x4de521)[_0xe81a('0x27')](handleEntityNotFound(_0x37701b,null))[_0xe81a('0x27')](respondWithResult(_0x37701b,null))[_0xe81a('0x47')](handleError(_0x37701b,null));};exports[_0xe81a('0x48')]=function(_0x41b322,_0x3b9b4a){return db[_0xe81a('0x2d')][_0xe81a('0x48')](_0x41b322[_0xe81a('0x49')],{})[_0xe81a('0x27')](respondWithResult(_0x3b9b4a,0xc9))[_0xe81a('0x47')](handleError(_0x3b9b4a,null));};exports[_0xe81a('0x4a')]=function(_0x4b699e,_0xef1d81){if(_0x4b699e[_0xe81a('0x49')]['id']){delete _0x4b699e[_0xe81a('0x49')]['id'];}return db['WhatsappTransferReport'][_0xe81a('0x46')]({'where':{'id':_0x4b699e[_0xe81a('0x4b')]['id']}})[_0xe81a('0x27')](handleEntityNotFound(_0xef1d81,null))['then'](saveUpdates(_0x4b699e[_0xe81a('0x49')],null))['then'](respondWithResult(_0xef1d81,null))[_0xe81a('0x47')](handleError(_0xef1d81,null));};exports[_0xe81a('0x26')]=function(_0x5b89de,_0x3192f5){return db['WhatsappTransferReport'][_0xe81a('0x46')]({'where':{'id':_0x5b89de['params']['id']}})[_0xe81a('0x27')](handleEntityNotFound(_0x3192f5,null))['then'](removeEntity(_0x3192f5,null))['catch'](handleError(_0x3192f5,null));};exports['describe']=function(_0x4544c3,_0x226289){return db[_0xe81a('0x2d')][_0xe81a('0x4c')]()['then'](respondWithResult(_0x226289,null))[_0xe81a('0x47')](handleError(_0x226289,null));}; \ No newline at end of file +var _0x3400=['undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','name','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0xb2a26,_0x11decc){var _0x31c695=function(_0x4d3ece){while(--_0x4d3ece){_0xb2a26['push'](_0xb2a26['shift']());}};_0x31c695(++_0x11decc);}(_0x3400,0x76));var _0x0340=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x3400[_0x562f3b];return _0x1edd55;};'use strict';var emlformat=require(_0x0340('0x0'));var rimraf=require(_0x0340('0x1'));var zipdir=require(_0x0340('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0340('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0340('0x4'));var util=require('util');var path=require(_0x0340('0x5'));var sox=require(_0x0340('0x6'));var csv=require(_0x0340('0x7'));var ejs=require(_0x0340('0x8'));var fs=require('fs');var fs_extra=require(_0x0340('0x9'));var _=require('lodash');var squel=require(_0x0340('0xa'));var crypto=require('crypto');var jsforce=require(_0x0340('0xb'));var deskjs=require(_0x0340('0xc'));var toCsv=require(_0x0340('0x7'));var querystring=require(_0x0340('0xd'));var Papa=require(_0x0340('0xe'));var Redis=require('ioredis');var authService=require(_0x0340('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0340('0x10'));var logger=require(_0x0340('0x11'))(_0x0340('0x12'));var utils=require(_0x0340('0x13'));var config=require(_0x0340('0x14'));var licenseUtil=require(_0x0340('0x15'));var db=require(_0x0340('0x16'))['db'];function respondWithStatusCode(_0x19a2ad,_0x592b39){_0x592b39=_0x592b39||0xcc;return function(_0x12d32d){if(_0x12d32d){return _0x19a2ad[_0x0340('0x17')](_0x592b39);}return _0x19a2ad[_0x0340('0x18')](_0x592b39)['end']();};}function respondWithResult(_0x48e7df,_0xd57df2){_0xd57df2=_0xd57df2||0xc8;return function(_0x298b2b){if(_0x298b2b){return _0x48e7df[_0x0340('0x18')](_0xd57df2)[_0x0340('0x19')](_0x298b2b);}};}function respondWithFilteredResult(_0x51f1f8,_0x51fbed){return function(_0x1f8d7d){if(_0x1f8d7d){var _0x42e315=typeof _0x51fbed['offset']===_0x0340('0x1a')&&typeof _0x51fbed[_0x0340('0x1b')]===_0x0340('0x1a');var _0x5e979b=_0x1f8d7d[_0x0340('0x1c')];var _0x1f0b35=_0x42e315?0x0:_0x51fbed[_0x0340('0x1d')];var _0x30a99b=_0x42e315?_0x1f8d7d[_0x0340('0x1c')]:_0x51fbed[_0x0340('0x1d')]+_0x51fbed[_0x0340('0x1b')];var _0x16aa7a;if(_0x30a99b>=_0x5e979b){_0x30a99b=_0x5e979b;_0x16aa7a=0xc8;}else{_0x16aa7a=0xce;}_0x51f1f8['status'](_0x16aa7a);return _0x51f1f8[_0x0340('0x1e')](_0x0340('0x1f'),_0x1f0b35+'-'+_0x30a99b+'/'+_0x5e979b)['json'](_0x1f8d7d);}return null;};}function patchUpdates(_0x33fc95){return function(_0x462925){try{jsonpatch[_0x0340('0x20')](_0x462925,_0x33fc95,!![]);}catch(_0x1f9a16){return BPromise['reject'](_0x1f9a16);}return _0x462925[_0x0340('0x21')]();};}function saveUpdates(_0x46f4f2,_0x2aa818){return function(_0x5ecbd0){if(_0x5ecbd0){return _0x5ecbd0[_0x0340('0x22')](_0x46f4f2)[_0x0340('0x23')](function(_0x459413){return _0x459413;});}return null;};}function removeEntity(_0x47e2aa,_0x50a0c1){return function(_0x2279d5){if(_0x2279d5){return _0x2279d5[_0x0340('0x24')]()['then'](function(){_0x47e2aa['status'](0xcc)[_0x0340('0x25')]();});}};}function handleEntityNotFound(_0x464c44,_0x21e132){return function(_0x25ee3d){if(!_0x25ee3d){_0x464c44['sendStatus'](0x194);}return _0x25ee3d;};}function handleError(_0x41a152,_0x24355c){_0x24355c=_0x24355c||0x1f4;return function(_0x40ac9f){logger[_0x0340('0x26')](_0x40ac9f['stack']);if(_0x40ac9f['name']){delete _0x40ac9f[_0x0340('0x27')];}_0x41a152[_0x0340('0x18')](_0x24355c)['send'](_0x40ac9f);};}exports['index']=function(_0x74026d,_0x3e6828){var _0x1d9dac={},_0x33a535={},_0x5e960f={'count':0x0,'rows':[]};var _0x58f203=_[_0x0340('0x28')](db[_0x0340('0x29')][_0x0340('0x2a')],function(_0x15a2ff){return{'name':_0x15a2ff[_0x0340('0x2b')],'type':_0x15a2ff[_0x0340('0x2c')][_0x0340('0x2d')]};});_0x33a535[_0x0340('0x2e')]=_[_0x0340('0x28')](_0x58f203,'name');_0x33a535[_0x0340('0x2f')]=_['keys'](_0x74026d[_0x0340('0x2f')]);_0x33a535[_0x0340('0x30')]=_['intersection'](_0x33a535[_0x0340('0x2e')],_0x33a535[_0x0340('0x2f')]);_0x1d9dac[_0x0340('0x31')]=_[_0x0340('0x32')](_0x33a535['model'],qs[_0x0340('0x33')](_0x74026d[_0x0340('0x2f')]['fields']));_0x1d9dac[_0x0340('0x31')]=_0x1d9dac['attributes'][_0x0340('0x34')]?_0x1d9dac[_0x0340('0x31')]:_0x33a535['model'];if(!_0x74026d[_0x0340('0x2f')]['hasOwnProperty'](_0x0340('0x35'))){_0x1d9dac['limit']=qs[_0x0340('0x1b')](_0x74026d[_0x0340('0x2f')][_0x0340('0x1b')]);_0x1d9dac[_0x0340('0x1d')]=qs[_0x0340('0x1d')](_0x74026d[_0x0340('0x2f')]['offset']);}_0x1d9dac['order']=qs['sort'](_0x74026d[_0x0340('0x2f')][_0x0340('0x36')]);_0x1d9dac[_0x0340('0x37')]=qs[_0x0340('0x30')](_[_0x0340('0x38')](_0x74026d[_0x0340('0x2f')],_0x33a535['filters']),_0x58f203);if(_0x74026d[_0x0340('0x2f')]['filter']){_0x1d9dac[_0x0340('0x37')]=_[_0x0340('0x39')](_0x1d9dac['where'],{'$or':_[_0x0340('0x28')](_0x58f203,function(_0x4027ca){if(_0x4027ca['type']!==_0x0340('0x3a')){var _0x1c91c6={};_0x1c91c6[_0x4027ca[_0x0340('0x27')]]={'$like':'%'+_0x74026d[_0x0340('0x2f')][_0x0340('0x3b')]+'%'};return _0x1c91c6;}})});}_0x1d9dac=_[_0x0340('0x39')]({},_0x1d9dac,_0x74026d[_0x0340('0x3c')]);var _0x16c034={'where':_0x1d9dac['where']};return db[_0x0340('0x29')][_0x0340('0x1c')](_0x16c034)[_0x0340('0x23')](function(_0xf69a30){_0x5e960f[_0x0340('0x1c')]=_0xf69a30;if(_0x74026d['query'][_0x0340('0x3d')]){_0x1d9dac[_0x0340('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x1d9dac);})[_0x0340('0x23')](function(_0x4e5d23){_0x5e960f[_0x0340('0x3f')]=_0x4e5d23;return _0x5e960f;})[_0x0340('0x23')](respondWithFilteredResult(_0x3e6828,_0x1d9dac))[_0x0340('0x40')](handleError(_0x3e6828,null));};exports[_0x0340('0x41')]=function(_0x4a3341,_0x561af8){var _0x3c49dc={'raw':!![],'where':{'id':_0x4a3341[_0x0340('0x42')]['id']}},_0x2f5180={};_0x2f5180[_0x0340('0x2e')]=_[_0x0340('0x43')](db[_0x0340('0x29')][_0x0340('0x2a')]);_0x2f5180[_0x0340('0x2f')]=_[_0x0340('0x43')](_0x4a3341[_0x0340('0x2f')]);_0x2f5180['filters']=_['intersection'](_0x2f5180[_0x0340('0x2e')],_0x2f5180[_0x0340('0x2f')]);_0x3c49dc['attributes']=_[_0x0340('0x32')](_0x2f5180[_0x0340('0x2e')],qs[_0x0340('0x33')](_0x4a3341[_0x0340('0x2f')][_0x0340('0x33')]));_0x3c49dc[_0x0340('0x31')]=_0x3c49dc[_0x0340('0x31')][_0x0340('0x34')]?_0x3c49dc['attributes']:_0x2f5180[_0x0340('0x2e')];if(_0x4a3341['query']['includeAll']){_0x3c49dc[_0x0340('0x3e')]=[{'all':!![]}];}_0x3c49dc=_[_0x0340('0x39')]({},_0x3c49dc,_0x4a3341[_0x0340('0x3c')]);return db['WhatsappTransferReport'][_0x0340('0x44')](_0x3c49dc)[_0x0340('0x23')](handleEntityNotFound(_0x561af8,null))[_0x0340('0x23')](respondWithResult(_0x561af8,null))[_0x0340('0x40')](handleError(_0x561af8,null));};exports[_0x0340('0x45')]=function(_0x2a310e,_0x5f5ca1){return db[_0x0340('0x29')]['create'](_0x2a310e[_0x0340('0x46')],{})[_0x0340('0x23')](respondWithResult(_0x5f5ca1,0xc9))['catch'](handleError(_0x5f5ca1,null));};exports[_0x0340('0x22')]=function(_0x18625e,_0x4ca1e9){if(_0x18625e[_0x0340('0x46')]['id']){delete _0x18625e['body']['id'];}return db[_0x0340('0x29')][_0x0340('0x44')]({'where':{'id':_0x18625e[_0x0340('0x42')]['id']}})[_0x0340('0x23')](handleEntityNotFound(_0x4ca1e9,null))[_0x0340('0x23')](saveUpdates(_0x18625e[_0x0340('0x46')],null))[_0x0340('0x23')](respondWithResult(_0x4ca1e9,null))[_0x0340('0x40')](handleError(_0x4ca1e9,null));};exports[_0x0340('0x24')]=function(_0x1811e7,_0x3ea9d9){return db[_0x0340('0x29')][_0x0340('0x44')]({'where':{'id':_0x1811e7[_0x0340('0x42')]['id']}})[_0x0340('0x23')](handleEntityNotFound(_0x3ea9d9,null))[_0x0340('0x23')](removeEntity(_0x3ea9d9,null))[_0x0340('0x40')](handleError(_0x3ea9d9,null));};exports[_0x0340('0x47')]=function(_0x1527e2,_0x538438){return db[_0x0340('0x29')][_0x0340('0x47')]()[_0x0340('0x23')](respondWithResult(_0x538438,null))[_0x0340('0x40')](handleError(_0x538438,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 31eb6d5..01d5092 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 _0x216d=['uniqueid','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x306b08,_0x4f84a9){var _0x254c71=function(_0x380392){while(--_0x380392){_0x306b08['push'](_0x306b08['shift']());}};_0x254c71(++_0x4f84a9);}(_0x216d,0x181));var _0xd216=function(_0x38644f,_0x4d4b16){_0x38644f=_0x38644f-0x0;var _0x5cf843=_0x216d[_0x38644f];return _0x5cf843;};'use strict';var _=require('lodash');var util=require(_0xd216('0x0'));var logger=require(_0xd216('0x1'))(_0xd216('0x2'));var moment=require(_0xd216('0x3'));var BPromise=require(_0xd216('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd216('0x5'));var config=require(_0xd216('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0xd216('0x7')]=function(_0x2ea548,_0xb5e09){return _0x2ea548[_0xd216('0x8')](_0xd216('0x9'),attributes,{'tableName':_0xd216('0xa'),'paranoid':![],'indexes':[{'name':_0xd216('0xb'),'fields':[_0xd216('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42c9=['path','../../config/environment','exports','WhatsappTransferReport','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x54ef36,_0x1c649b){var _0x4a23c2=function(_0x34cac9){while(--_0x34cac9){_0x54ef36['push'](_0x54ef36['shift']());}};_0x4a23c2(++_0x1c649b);}(_0x42c9,0x1c6));var _0x942c=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0x42c9[_0x47e93d];return _0xe86c46;};'use strict';var _=require(_0x942c('0x0'));var util=require('util');var logger=require(_0x942c('0x1'))(_0x942c('0x2'));var moment=require('moment');var BPromise=require(_0x942c('0x3'));var rp=require(_0x942c('0x4'));var fs=require('fs');var path=require(_0x942c('0x5'));var rimraf=require('rimraf');var config=require(_0x942c('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0x942c('0x7')]=function(_0x4e1ca9,_0x15d016){return _0x4e1ca9['define'](_0x942c('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 690966d..36349b6 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(_0x1b49ea,_0x4cbd3c){var _0xcb861=function(_0x737573){while(--_0x737573){_0x1b49ea['push'](_0x1b49ea['shift']());}};_0xcb861(++_0x4cbd3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0xdc7836,_0x2f878b){var _0x565a2d=function(_0x25c2cf){while(--_0x25c2cf){_0xdc7836['push'](_0xdc7836['shift']());}};_0x565a2d(++_0x2f878b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 3485a6c..2b898f4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf03a=['join','Offline\x20apps:','status','online','name','None','./config/seedDB','default','./config/license','catch','exit','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','info','start','Online\x20apps:','map','filter'];(function(_0x20ea8,_0x15f89f){var _0x44366e=function(_0x147c96){while(--_0x147c96){_0x20ea8['push'](_0x20ea8['shift']());}};_0x44366e(++_0x15f89f);}(_0xf03a,0x1a0));var _0xaf03=function(_0x39b8a5,_0xc78910){_0x39b8a5=_0x39b8a5-0x0;var _0x3f17e7=_0xf03a[_0x39b8a5];return _0x3f17e7;};'use strict';var _=require('lodash');var mysqldb=require(_0xaf03('0x0'));var rpc=require(_0xaf03('0x1'));var config=require(_0xaf03('0x2'));var logger=require(_0xaf03('0x3'))('app');var pm2=require(_0xaf03('0x4'));var pm2Config=require(_0xaf03('0x5'));var schedule=require('./config/schedule');var chat=require(_0xaf03('0x6'));var whatsapp=require(_0xaf03('0x7'));var transcribe=require(_0xaf03('0x8'));function main(){return mysqldb['db'][_0xaf03('0x9')]['sync']()[_0xaf03('0xa')](function(){return rpc['listen']();})[_0xaf03('0xa')](function(_0x467e7c){logger[_0xaf03('0xb')](_0x467e7c);return chat[_0xaf03('0xc')]();})[_0xaf03('0xa')](function(){return whatsapp[_0xaf03('0xc')]();})['then'](function(){return schedule[_0xaf03('0xc')]();})[_0xaf03('0xa')](function(){return transcribe[_0xaf03('0xc')]();})[_0xaf03('0xa')](function(_0x417c6a){logger['info'](_0x417c6a);return pm2[_0xaf03('0xc')](pm2Config);})[_0xaf03('0xa')](function(_0x2254d4){logger[_0xaf03('0xb')](_0xaf03('0xd'),_[_0xaf03('0xe')](_[_0xaf03('0xf')](_0x2254d4,{'status':'online'}),'name')[_0xaf03('0x10')]());logger[_0xaf03('0xb')](_0xaf03('0x11'),_['map'](_['filter'](_0x2254d4,function(_0x38ae35){return _0x38ae35[_0xaf03('0x12')]!==_0xaf03('0x13');}),_0xaf03('0x14'))[_0xaf03('0x10')]()||_0xaf03('0x15'));config['seedDB']&&require(_0xaf03('0x16'))[_0xaf03('0x17')]();require(_0xaf03('0x18'))[_0xaf03('0x17')]();})[_0xaf03('0x19')](function(_0x27e625){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x27e625);process[_0xaf03('0x1a')](0x1);});}main(); \ No newline at end of file +var _0x01d9=['join','Offline\x20apps:','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','filter','online','name'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var mysqldb=require(_0x901d('0x1'));var rpc=require(_0x901d('0x2'));var config=require(_0x901d('0x3'));var logger=require('./config/logger')(_0x901d('0x4'));var pm2=require(_0x901d('0x5'));var pm2Config=require(_0x901d('0x6'));var schedule=require(_0x901d('0x7'));var chat=require(_0x901d('0x8'));var whatsapp=require(_0x901d('0x9'));var transcribe=require(_0x901d('0xa'));function main(){return mysqldb['db']['sequelize'][_0x901d('0xb')]()[_0x901d('0xc')](function(){return rpc[_0x901d('0xd')]();})[_0x901d('0xc')](function(_0x313f85){logger[_0x901d('0xe')](_0x313f85);return chat[_0x901d('0xf')]();})[_0x901d('0xc')](function(){return whatsapp[_0x901d('0xf')]();})[_0x901d('0xc')](function(){return schedule[_0x901d('0xf')]();})[_0x901d('0xc')](function(){return transcribe[_0x901d('0xf')]();})['then'](function(_0x439f17){logger['info'](_0x439f17);return pm2[_0x901d('0xf')](pm2Config);})[_0x901d('0xc')](function(_0x3f2a0a){logger[_0x901d('0xe')](_0x901d('0x10'),_['map'](_[_0x901d('0x11')](_0x3f2a0a,{'status':_0x901d('0x12')}),_0x901d('0x13'))[_0x901d('0x14')]());logger[_0x901d('0xe')](_0x901d('0x15'),_['map'](_[_0x901d('0x11')](_0x3f2a0a,function(_0x13903c){return _0x13903c[_0x901d('0x16')]!==_0x901d('0x12');}),_0x901d('0x13'))[_0x901d('0x14')]()||_0x901d('0x17'));config[_0x901d('0x18')]&&require(_0x901d('0x19'))[_0x901d('0x1a')]();require(_0x901d('0x1b'))[_0x901d('0x1a')]();})[_0x901d('0x1c')](function(_0x403db9){logger[_0x901d('0x1d')](_0x901d('0x1e'),_0x403db9);process[_0x901d('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index f0dc61d..11693d0 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 _0x976c=['express-jwt','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','email','userpic','permissions','voicePause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','status','unmanaged','Forbidden.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','json','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','updatePasswordsHistory','unshift','join','sign','payload','options','verify','session','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','lodash'];(function(_0x55059d,_0x4e7936){var _0x131cd9=function(_0x149ee5){while(--_0x149ee5){_0x55059d['push'](_0x55059d['shift']());}};_0x131cd9(++_0x4e7936);}(_0x976c,0x72));var _0xc976=function(_0x3d8fe6,_0x174155){_0x3d8fe6=_0x3d8fe6-0x0;var _0x3864e2=_0x976c[_0x3d8fe6];return _0x3864e2;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xc976('0x0'));var hardwareConf=require(_0xc976('0x1'));var licenseUtil=require(_0xc976('0x2'));var encryptor=require('../encryptor');var _=require(_0xc976('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xc976('0x4'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0xc976('0x5'));var BPromise=require(_0xc976('0x6'));var util=require(_0xc976('0x7'));var moment=require(_0xc976('0x8'));var validateJwt=expressJwt({'secret':config[_0xc976('0x9')]['session']});var userAttributes=['id',_0xc976('0xa'),_0xc976('0xb'),_0xc976('0xc'),_0xc976('0xd'),_0xc976('0xe'),_0xc976('0xf'),_0xc976('0x10'),'md5secret',_0xc976('0x11'),'chatPause',_0xc976('0x12'),_0xc976('0x13'),_0xc976('0x14'),_0xc976('0x15'),'pauseType',_0xc976('0x16'),_0xc976('0x17'),_0xc976('0x18'),_0xc976('0x19'),'allowmessenger','passwordResetAt',_0xc976('0x1a'),_0xc976('0x1b'),_0xc976('0x1c'),_0xc976('0x1d'),_0xc976('0x1e'),_0xc976('0x1f'),_0xc976('0x20'),_0xc976('0x21'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0xc976('0x22'),'hotdesk',_0xc976('0x23'),_0xc976('0x24'),_0xc976('0x25'),_0xc976('0x26'),_0xc976('0x27'),'downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments'];exports[_0xc976('0x28')]=function(){return this[_0xc976('0x29')](!![])[_0xc976('0x2a')](function(_0x19a20b,_0x95866d,_0x1e0f1a){if(_0x19a20b[_0xc976('0x2b')]){_0x1e0f1a();}else{return db[_0xc976('0x2c')][_0xc976('0x2d')]({'where':{'id':_0x19a20b['params']['id']},'attributes':['id',_0xc976('0x2e'),_0xc976('0x2f')],'raw':!![]})[_0xc976('0x30')](function(_0x28478d){if(_0x28478d&&_0x28478d['closed']){return _0x95866d[_0xc976('0x31')](_0x28478d[_0xc976('0x2f')]===_0xc976('0x32')?0x195:0x193)['json']({'message':_0x28478d[_0xc976('0x2f')]==='unmanaged'?'Unmanaged.':_0xc976('0x33')});}else{_0x1e0f1a();}})['catch'](function(_0x504268){_0x1e0f1a(_0x504268);});}});};exports['isAuthenticated']=function isAuthenticated(_0x2c6fc1){return compose()[_0xc976('0x2a')](function(_0x274e47,_0x4f47e3,_0x2c8cc6){var _0x558761;if(_0x274e47['headers'][_0xc976('0x34')]){if(_[_0xc976('0x35')](_0x274e47[_0xc976('0x36')][_0xc976('0x34')],_0xc976('0x37'))){var _0x178c12=basicAuth(_0x274e47);db[_0xc976('0x38')][_0xc976('0x39')]({'where':{'name':_0x178c12['name']}})[_0xc976('0x30')](function(_0x1916b8){if(!_0x1916b8||!_0x1916b8[_0xc976('0x3a')](_0x178c12[_0xc976('0x3b')])){return _0x4f47e3[_0xc976('0x31')](0x191)[_0xc976('0x3c')]({'message':_0xc976('0x3d')});}_0x274e47['user']={'id':_0x1916b8['id']};_0x2c8cc6();})[_0xc976('0x3e')](function(_0x3e6eeb){_0x2c8cc6(_0x3e6eeb);});}else if(_['startsWith'](_0x274e47[_0xc976('0x36')][_0xc976('0x34')],'Bearer')){validateJwt(_0x274e47,_0x4f47e3,_0x2c8cc6);}else{if(_0x2c6fc1){_0x2c8cc6();}else{return _0x4f47e3[_0xc976('0x31')](0x193)[_0xc976('0x3c')]({'message':_0xc976('0x3f')});}}}else if(_0x274e47[_0xc976('0x40')][_0xc976('0x41')]){try{var _0x45118e={'audience':hardwareConf[_0xc976('0x42')](),'issuer':hardwareConf[_0xc976('0x42')]()};verifyJwt(_0x274e47[_0xc976('0x40')][_0xc976('0x41')],_0x45118e)[_0xc976('0x30')](function(_0x1cd778){return db[_0xc976('0x38')][_0xc976('0x39')]({'where':{'id':_0x1cd778['sub']}})['then'](function(_0x596184){_0x558761=_0x596184;return db[_0xc976('0x43')]['findOne']({'where':{'id':0x1},'attributes':[_0xc976('0x44'),_0xc976('0x45')],'raw':!![]});})['then'](function(_0x477b40){if(!_0x558761||!_['isEqual'](_0x558761[_0xc976('0x46')],_0x1cd778['nonce'])){return _0x4f47e3['status'](0x191)[_0xc976('0x3c')]({'message':_0xc976('0x47')});}if(_0x558761[_0xc976('0x48')]){return _0x4f47e3['status'](0x191)[_0xc976('0x3c')]({'message':_0xc976('0x49')});}if(_0x558761[_0xc976('0x4a')]){if(_0x477b40[_0xc976('0x45')]>0x0){if(moment(_0x558761['blockedAt'])[_0xc976('0x4b')](_0x477b40[_0xc976('0x45')],_0xc976('0x4c'))>moment()){return _0x4f47e3[_0xc976('0x31')](0x191)[_0xc976('0x3c')]({'message':_0xc976('0x49')});}}else{return _0x4f47e3[_0xc976('0x31')](0x191)['json']({'message':_0xc976('0x49')});}}_0x274e47[_0xc976('0x2b')]={'id':_0x558761['id']};_0x2c8cc6();});})[_0xc976('0x3e')](function(){return _0x4f47e3[_0xc976('0x31')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x492c83){_0x2c8cc6(_0x492c83);}}else if(_0x2c6fc1){_0x2c8cc6();}else{return _0x4f47e3[_0xc976('0x31')](0x193)[_0xc976('0x3c')]({'message':_0xc976('0x3f')});}})[_0xc976('0x2a')](function(_0x4a63a0,_0x4862f9,_0x2df8a4){if(_0x4a63a0[_0xc976('0x2b')]){db['User']['find']({'where':{'id':_0x4a63a0[_0xc976('0x2b')]['id']},'attributes':userAttributes})[_0xc976('0x30')](function(_0x307011){if(!_0x307011){return _0x4862f9[_0xc976('0x31')](0x194)['json']({'message':_0xc976('0x4d')});}_0x4a63a0[_0xc976('0x2b')]=_0x307011;_0x2df8a4();})['catch'](function(_0x20975f){_0x2df8a4(_0x20975f);});}else if(_0x2c6fc1){_0x2df8a4();}else{return _0x4862f9[_0xc976('0x31')](0x194)[_0xc976('0x3c')]({'message':_0xc976('0x4e')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc976('0x2a')](function(_0x51d644,_0xa425,_0x305126){return licenseUtil[_0xc976('0x4f')]()[_0xc976('0x30')](function(_0xdfd8e4){if(_0xdfd8e4[_0xc976('0x50')]){_0x305126();}else{return _0xa425[_0xc976('0x31')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x43e291){_0x305126(_0x43e291);});});};exports['isMiddleware']=function(_0xd4f78f,_0x5d8f30,_0x46db63){_0xd4f78f[_0xc976('0x51')]=!![];return _0x46db63();};exports[_0xc976('0x52')]=function signToken(_0x423159){return signJwt(_0x423159);};exports[_0xc976('0x53')]=function(_0x2af904,_0x1afbef){if(!_0x2af904[_0xc976('0x2b')]){return _0x1afbef[_0xc976('0x31')](0x194)['json']({'message':_0xc976('0x54')});}var _0xa20174={'payload':{'id':_0x2af904[_0xc976('0x2b')]['id'],'role':_0x2af904['user'][_0xc976('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0xa20174)[_0xc976('0x30')](function(_0x43cc8c){_0x1afbef['cookie'](_0xc976('0x55'),_0x43cc8c);_0x1afbef[_0xc976('0x56')](_0xc976('0x57'));})[_0xc976('0x3e')](function(_0x17b70f){return _0x1afbef[_0xc976('0x31')](0x1f4)[_0xc976('0x58')](_0x17b70f);});};exports[_0xc976('0x59')]=function(_0x74615f){if(_[_0xc976('0x5a')](_0x74615f[_0xc976('0x46')])||_[_0xc976('0x5a')](_0x74615f[_0xc976('0x5b')])){return null;}else{return createJwt(_0x74615f);}};exports[_0xc976('0x5c')]=function(_0x3a14cd){_0x3a14cd[_0xc976('0x46')]=generateNonce();_0x3a14cd['apiKeyIat']=generateIssuedAt();return createJwt(_0x3a14cd);};exports['regenerateApiKey']=function(_0x2e6b33,_0x3def20){var _0x370abc=_0x2e6b33['query'][_0xc976('0x41')];if(_0x370abc){var _0x54b3ff={'nonce':_0x3def20['apiKeyNonce'],'iat':_0x3def20[_0xc976('0x5b')],'audience':hardwareConf[_0xc976('0x42')](),'issuer':hardwareConf[_0xc976('0x42')]()};return verifyJwt(_0x370abc,_0x54b3ff)[_0xc976('0x30')](function(){return generateApiKey(_0x3def20);});}else{throw{'message':_0xc976('0x5d')};}};exports[_0xc976('0x5e')]=function(_0x12f2f9){var _0x44d077=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x44d077[_0xc976('0x5f')](_0x12f2f9))throw new db[(_0xc976('0x60'))][(_0xc976('0x61'))](_0xc976('0x62'));return;};exports[_0xc976('0x63')]=function(_0x29ce0d,_0x3f14d3,_0x3e645f){var _0xdb8399=encryptor[_0xc976('0x64')](_0x3f14d3)[_0xc976('0x65')](',');for(var _0x4fac00=0x0;_0x4fac00<_0x3e645f;_0x4fac00++){if(!_0xdb8399[_0x4fac00])break;if(_0x29ce0d[_0xc976('0x66')]()===_0xdb8399[_0x4fac00][_0xc976('0x66')]()){var _0x434a20=util[_0xc976('0x67')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x3e645f);if(_0x3e645f===0x1){_0x434a20='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xc976('0x60'))][(_0xc976('0x61'))](_0x434a20);}}return;};exports[_0xc976('0x68')]=function(_0x3e33a6,_0x39c417){var _0x85a4c8=_0x39c417?encryptor['decryptString'](_0x39c417)[_0xc976('0x65')](','):[];if(_0x85a4c8['length']===0x5){_0x85a4c8['splice'](-0x1,0x1);}_0x85a4c8[_0xc976('0x69')](_0x3e33a6);return encryptor['encryptString'](_0x85a4c8[_0xc976('0x6a')](','));};function signJwt(_0x4e8ed9){var _0x39549b=BPromise['promisify'](jwt[_0xc976('0x6b')],{'context':jwt});var _0x21c44b=_0x4e8ed9['secret']||config[_0xc976('0x9')]['session'];return new BPromise(function(_0x4dcdce,_0x52156f){_0x39549b(_0x4e8ed9[_0xc976('0x6c')],_0x21c44b,_0x4e8ed9[_0xc976('0x6d')])[_0xc976('0x30')](function(_0x499f2a){_0x4dcdce(_0x499f2a);})[_0xc976('0x3e')](function(_0x19505b){_0x52156f(_0x19505b);});});}function verifyJwt(_0x31a6e0,_0x554ae2,_0x2c5dc4){var _0x4a25ce=BPromise['promisify'](jwt[_0xc976('0x6e')],{'context':jwt});var _0x565078=_0x2c5dc4||config['secrets'][_0xc976('0x6f')];return new BPromise(function(_0x50c885,_0x31ce4c){_0x4a25ce(_0x31a6e0,_0x565078,_0x554ae2)[_0xc976('0x30')](function(_0x1629d8){_0x50c885(_0x1629d8);})[_0xc976('0x3e')](function(_0x47cb5e){_0x31ce4c(_0x47cb5e);});});}function generateNonce(){return crypto[_0xc976('0x70')](0x10)[_0xc976('0x71')](_0xc976('0x72'));}function generateIssuedAt(){return Math[_0xc976('0x73')](Date[_0xc976('0x74')]()/0x3e8)['toString']();}function createJwt(_0x5eb901){var _0x124edf={'payload':{'iat':_0x5eb901['apiKeyIat'],'nonce':_0x5eb901['apiKeyNonce']},'options':{'algorithm':_0xc976('0x75'),'subject':_0x5eb901['id'][_0xc976('0x71')](),'issuer':hardwareConf[_0xc976('0x42')](),'audience':hardwareConf[_0xc976('0x42')]()}};return signJwt(_0x124edf)['then'](function(_0x3ee563){return{'iat':_0x5eb901['apiKeyIat'],'nonce':_0x5eb901[_0xc976('0x46')],'token':_0x3ee563};});} \ No newline at end of file +var _0x4fe9=['isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','join','sign','secrets','session','payload','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','util','moment','fullname','name','email','userpic','permissions','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','userProfileId','settingsEnabled','wssPort','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','status','unmanaged','Unmanaged.','catch','authorization','startsWith','headers','Basic','find','then','authenticate','Wrong\x20credentials.','json','Unknown\x20authorization\x20format','query','apikey','getUuid','User','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey'];(function(_0x3bf4ce,_0x1f4534){var _0x158959=function(_0x3ec9b7){while(--_0x3ec9b7){_0x3bf4ce['push'](_0x3bf4ce['shift']());}};_0x158959(++_0x1f4534);}(_0x4fe9,0x90));var _0x94fe=function(_0x3229b5,_0x4d0670){_0x3229b5=_0x3229b5-0x0;var _0x1e6b22=_0x4fe9[_0x3229b5];return _0x1e6b22;};'use strict';var db=require(_0x94fe('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x94fe('0x1'));var licenseUtil=require(_0x94fe('0x2'));var encryptor=require(_0x94fe('0x3'));var _=require(_0x94fe('0x4'));var jwt=require(_0x94fe('0x5'));var expressJwt=require(_0x94fe('0x6'));var compose=require(_0x94fe('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x94fe('0x8'));var util=require(_0x94fe('0x9'));var moment=require(_0x94fe('0xa'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id','role',_0x94fe('0xb'),_0x94fe('0xc'),'internal',_0x94fe('0xd'),_0x94fe('0xe'),_0x94fe('0xf'),'md5secret',_0x94fe('0x10'),_0x94fe('0x11'),'mailPause',_0x94fe('0x12'),'smsPause',_0x94fe('0x13'),_0x94fe('0x14'),_0x94fe('0x15'),_0x94fe('0x16'),_0x94fe('0x17'),'crudPermissions',_0x94fe('0x18'),_0x94fe('0x19'),'alias','phoneBarAutoAnswer',_0x94fe('0x1a'),_0x94fe('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x94fe('0x1c'),_0x94fe('0x1d'),_0x94fe('0x1e'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x94fe('0x1f'),'interface',_0x94fe('0x20'),'privacyEnabled',_0x94fe('0x21'),_0x94fe('0x22'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x94fe('0x23')];exports[_0x94fe('0x24')]=function(){return this[_0x94fe('0x25')](!![])[_0x94fe('0x26')](function(_0xeeb656,_0xee23fe,_0x49d80b){if(_0xeeb656[_0x94fe('0x27')]){_0x49d80b();}else{return db[_0x94fe('0x28')]['findOne']({'where':{'id':_0xeeb656[_0x94fe('0x29')]['id']},'attributes':['id',_0x94fe('0x2a'),_0x94fe('0x2b')],'raw':!![]})['then'](function(_0x158f71){if(_0x158f71&&_0x158f71[_0x94fe('0x2a')]){return _0xee23fe[_0x94fe('0x2c')](_0x158f71[_0x94fe('0x2b')]===_0x94fe('0x2d')?0x195:0x193)['json']({'message':_0x158f71[_0x94fe('0x2b')]===_0x94fe('0x2d')?_0x94fe('0x2e'):'Forbidden.'});}else{_0x49d80b();}})[_0x94fe('0x2f')](function(_0x39f349){_0x49d80b(_0x39f349);});}});};exports[_0x94fe('0x25')]=function isAuthenticated(_0x4d902f){return compose()[_0x94fe('0x26')](function(_0xaf39d5,_0x2aa051,_0x26425e){var _0x488d9e;if(_0xaf39d5['headers'][_0x94fe('0x30')]){if(_[_0x94fe('0x31')](_0xaf39d5[_0x94fe('0x32')]['authorization'],_0x94fe('0x33'))){var _0x1f31e4=basicAuth(_0xaf39d5);db['User'][_0x94fe('0x34')]({'where':{'name':_0x1f31e4[_0x94fe('0xc')]}})[_0x94fe('0x35')](function(_0x57f89f){if(!_0x57f89f||!_0x57f89f[_0x94fe('0x36')](_0x1f31e4['pass'])){return _0x2aa051[_0x94fe('0x2c')](0x191)['json']({'message':_0x94fe('0x37')});}_0xaf39d5['user']={'id':_0x57f89f['id']};_0x26425e();})[_0x94fe('0x2f')](function(_0x4a9d5a){_0x26425e(_0x4a9d5a);});}else if(_[_0x94fe('0x31')](_0xaf39d5['headers'][_0x94fe('0x30')],'Bearer')){validateJwt(_0xaf39d5,_0x2aa051,_0x26425e);}else{if(_0x4d902f){_0x26425e();}else{return _0x2aa051['status'](0x193)[_0x94fe('0x38')]({'message':_0x94fe('0x39')});}}}else if(_0xaf39d5[_0x94fe('0x3a')][_0x94fe('0x3b')]){try{var _0x55a4d3={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x94fe('0x3c')]()};verifyJwt(_0xaf39d5[_0x94fe('0x3a')][_0x94fe('0x3b')],_0x55a4d3)[_0x94fe('0x35')](function(_0x2ca19f){return db[_0x94fe('0x3d')]['find']({'where':{'id':_0x2ca19f['sub']}})[_0x94fe('0x35')](function(_0x3d7756){_0x488d9e=_0x3d7756;return db[_0x94fe('0x3e')]['findOne']({'where':{'id':0x1},'attributes':[_0x94fe('0x3f'),'blockDuration'],'raw':!![]});})[_0x94fe('0x35')](function(_0x37f707){if(!_0x488d9e||!_[_0x94fe('0x40')](_0x488d9e[_0x94fe('0x41')],_0x2ca19f[_0x94fe('0x42')])){return _0x2aa051[_0x94fe('0x2c')](0x191)[_0x94fe('0x38')]({'message':_0x94fe('0x43')});}if(_0x488d9e['disabled']){return _0x2aa051[_0x94fe('0x2c')](0x191)['json']({'message':_0x94fe('0x44')});}if(_0x488d9e['blocked']){if(_0x37f707[_0x94fe('0x45')]>0x0){if(moment(_0x488d9e['blockedAt'])['add'](_0x37f707[_0x94fe('0x45')],'minutes')>moment()){return _0x2aa051[_0x94fe('0x2c')](0x191)[_0x94fe('0x38')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2aa051[_0x94fe('0x2c')](0x191)['json']({'message':_0x94fe('0x44')});}}_0xaf39d5[_0x94fe('0x27')]={'id':_0x488d9e['id']};_0x26425e();});})['catch'](function(){return _0x2aa051[_0x94fe('0x2c')](0x191)[_0x94fe('0x38')]({'message':_0x94fe('0x44')});});}catch(_0x53f70f){_0x26425e(_0x53f70f);}}else if(_0x4d902f){_0x26425e();}else{return _0x2aa051[_0x94fe('0x2c')](0x193)['json']({'message':_0x94fe('0x39')});}})['use'](function(_0x54ad3b,_0xe8cb99,_0x3a4e3f){if(_0x54ad3b[_0x94fe('0x27')]){db[_0x94fe('0x3d')]['find']({'where':{'id':_0x54ad3b[_0x94fe('0x27')]['id']},'attributes':userAttributes})['then'](function(_0x5d06a1){if(!_0x5d06a1){return _0xe8cb99[_0x94fe('0x2c')](0x194)[_0x94fe('0x38')]({'message':_0x94fe('0x46')});}_0x54ad3b[_0x94fe('0x27')]=_0x5d06a1;_0x3a4e3f();})['catch'](function(_0x130138){_0x3a4e3f(_0x130138);});}else if(_0x4d902f){_0x3a4e3f();}else{return _0xe8cb99['status'](0x194)[_0x94fe('0x38')]({'message':_0x94fe('0x47')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x94fe('0x26')](function(_0x3f2885,_0x7f79ba,_0x19ed88){return licenseUtil[_0x94fe('0x48')]()[_0x94fe('0x35')](function(_0x3891d0){if(_0x3891d0[_0x94fe('0x49')]){_0x19ed88();}else{return _0x7f79ba[_0x94fe('0x2c')](0x193)[_0x94fe('0x38')]({'message':_0x94fe('0x4a')});}})[_0x94fe('0x2f')](function(_0x59ce73){_0x19ed88(_0x59ce73);});});};exports['isMiddleware']=function(_0x2226f8,_0x4d54f1,_0x8d0792){_0x2226f8[_0x94fe('0x4b')]=!![];return _0x8d0792();};exports[_0x94fe('0x4c')]=function signToken(_0x3af71d){return signJwt(_0x3af71d);};exports[_0x94fe('0x4d')]=function(_0x139706,_0x1e20bc){if(!_0x139706[_0x94fe('0x27')]){return _0x1e20bc[_0x94fe('0x2c')](0x194)['json']({'message':_0x94fe('0x4e')});}var _0x28a826={'payload':{'id':_0x139706[_0x94fe('0x27')]['id'],'role':_0x139706[_0x94fe('0x27')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x28a826)[_0x94fe('0x35')](function(_0x298a8b){_0x1e20bc[_0x94fe('0x4f')](_0x94fe('0x50'),_0x298a8b);_0x1e20bc[_0x94fe('0x51')]('/dashboards/general');})[_0x94fe('0x2f')](function(_0x3dda2c){return _0x1e20bc[_0x94fe('0x2c')](0x1f4)[_0x94fe('0x52')](_0x3dda2c);});};exports[_0x94fe('0x53')]=function(_0x340b00){if(_[_0x94fe('0x54')](_0x340b00[_0x94fe('0x41')])||_[_0x94fe('0x54')](_0x340b00[_0x94fe('0x55')])){return null;}else{return createJwt(_0x340b00);}};exports['generateApiKey']=function(_0x174fa8){_0x174fa8[_0x94fe('0x41')]=generateNonce();_0x174fa8[_0x94fe('0x55')]=generateIssuedAt();return createJwt(_0x174fa8);};exports[_0x94fe('0x56')]=function(_0x3cebc2,_0x1a6da5){var _0x37cb2b=_0x3cebc2[_0x94fe('0x3a')]['apikey'];if(_0x37cb2b){var _0xfec763={'nonce':_0x1a6da5[_0x94fe('0x41')],'iat':_0x1a6da5[_0x94fe('0x55')],'audience':hardwareConf[_0x94fe('0x3c')](),'issuer':hardwareConf[_0x94fe('0x3c')]()};return verifyJwt(_0x37cb2b,_0xfec763)['then'](function(){return generateApiKey(_0x1a6da5);});}else{throw{'message':_0x94fe('0x57')};}};exports[_0x94fe('0x58')]=function(_0x570e75){var _0x426a0f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x426a0f[_0x94fe('0x59')](_0x570e75))throw new db['Sequelize'][(_0x94fe('0x5a'))](_0x94fe('0x5b'));return;};exports['validatePasswordHistory']=function(_0x159b25,_0x672af0,_0x5698e9){var _0x2d882f=encryptor[_0x94fe('0x5c')](_0x672af0)[_0x94fe('0x5d')](',');for(var _0x523700=0x0;_0x523700<_0x5698e9;_0x523700++){if(!_0x2d882f[_0x523700])break;if(_0x159b25[_0x94fe('0x5e')]()===_0x2d882f[_0x523700]['toLowerCase']()){var _0x957124=util[_0x94fe('0x5f')](_0x94fe('0x60'),_0x5698e9);if(_0x5698e9===0x1){_0x957124=_0x94fe('0x61');}throw new db[(_0x94fe('0x62'))][(_0x94fe('0x5a'))](_0x957124);}}return;};exports[_0x94fe('0x63')]=function(_0x347214,_0x4ddaf2){var _0x3d7908=_0x4ddaf2?encryptor[_0x94fe('0x5c')](_0x4ddaf2)['split'](','):[];if(_0x3d7908[_0x94fe('0x64')]===0x5){_0x3d7908[_0x94fe('0x65')](-0x1,0x1);}_0x3d7908[_0x94fe('0x66')](_0x347214);return encryptor['encryptString'](_0x3d7908[_0x94fe('0x67')](','));};function signJwt(_0x1453df){var _0x3dada7=BPromise['promisify'](jwt[_0x94fe('0x68')],{'context':jwt});var _0x12fce9=_0x1453df['secret']||config[_0x94fe('0x69')][_0x94fe('0x6a')];return new BPromise(function(_0x4b7555,_0x572466){_0x3dada7(_0x1453df[_0x94fe('0x6b')],_0x12fce9,_0x1453df['options'])[_0x94fe('0x35')](function(_0x11c2ad){_0x4b7555(_0x11c2ad);})[_0x94fe('0x2f')](function(_0x5160f5){_0x572466(_0x5160f5);});});}function verifyJwt(_0x451660,_0xa21dfd,_0x56c602){var _0x9fc7ad=BPromise['promisify'](jwt[_0x94fe('0x6c')],{'context':jwt});var _0x852c3=_0x56c602||config['secrets'][_0x94fe('0x6a')];return new BPromise(function(_0x5e8ce0,_0x5bd506){_0x9fc7ad(_0x451660,_0x852c3,_0xa21dfd)[_0x94fe('0x35')](function(_0x5018de){_0x5e8ce0(_0x5018de);})[_0x94fe('0x2f')](function(_0x4e975e){_0x5bd506(_0x4e975e);});});}function generateNonce(){return crypto[_0x94fe('0x6d')](0x10)[_0x94fe('0x6e')](_0x94fe('0x6f'));}function generateIssuedAt(){return Math['floor'](Date[_0x94fe('0x70')]()/0x3e8)[_0x94fe('0x6e')]();}function createJwt(_0x51c025){var _0x44719e={'payload':{'iat':_0x51c025[_0x94fe('0x55')],'nonce':_0x51c025['apiKeyNonce']},'options':{'algorithm':_0x94fe('0x71'),'subject':_0x51c025['id'][_0x94fe('0x6e')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x94fe('0x3c')]()}};return signJwt(_0x44719e)[_0x94fe('0x35')](function(_0xf6a3ea){return{'iat':_0x51c025['apiKeyIat'],'nonce':_0x51c025[_0x94fe('0x41')],'token':_0xf6a3ea};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9eadd55..4892d05 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 _0x6b00=['app','secrets','session','aes-256-ctr','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','final','write','close','unlink','decryptFile','encryptString','secret','utf8','base64','decryptString','createDecipher','bluebird'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x6b00,0xb9));var _0x06b0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6b00[_0x432682];return _0x463d05;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x06b0('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x06b0('0x1'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x06b0('0x2')][_0x06b0('0x3')],'algorithm':_0x06b0('0x4')};const fileOptions={'algorithm':'aes192'};if(config[_0x06b0('0x5')]&&config['encrypt'][_0x06b0('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x06b0('0x6')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x06b0('0x5')]['algorithm'],_0x06b0('0x7'),supportedAlgorithms);}}function isASupportedCipher(_0x38096a){return AES_SUPPORTED_RX[_0x06b0('0x8')](_0x38096a);}function getSupportedCiphers(){return crypto[_0x06b0('0x9')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x403b85){return getSupportedCiphers()[_0x06b0('0xa')](_0x403b85)>-0x1;}function combineOptions(_0x102055){var _0x15c5d1={};for(var _0x15243d in fileOptions){if(fileOptions[_0x06b0('0xb')](_0x15243d)){_0x15c5d1[_0x15243d]=fileOptions[_0x15243d];}}if(_0x102055){for(var _0x34499e in _0x102055){if(_0x102055['hasOwnProperty'](_0x34499e)){_0x15c5d1[_0x34499e]=_0x102055[_0x34499e];}}}return _0x15c5d1;}exports[_0x06b0('0xc')]=function(_0xe634f2,_0x1b35d4,_0x32f377,_0x2c5aa7){return new BPromise(function(_0x311138,_0x34d34f){_0x2c5aa7=combineOptions(_0x2c5aa7);var _0x2f4b36=new Buffer(_0x32f377);var _0x3f5c91=fs[_0x06b0('0xd')](_0xe634f2);var _0x2e7b8a=fs[_0x06b0('0xe')](_0x1b35d4);var _0x43d170=crypto[_0x06b0('0xf')](_0x2c5aa7[_0x06b0('0x6')],_0x2f4b36);_0x3f5c91['on'](_0x06b0('0x10'),function(_0x4fb17d){var _0x12a86e=new Buffer(_0x43d170[_0x06b0('0x11')](_0x4fb17d),_0x06b0('0x12'));_0x2e7b8a['write'](_0x12a86e);});_0x3f5c91['on'](_0x06b0('0x13'),function(){try{var _0x131a9c=new Buffer(_0x43d170[_0x06b0('0x14')](_0x06b0('0x12')),_0x06b0('0x12'));_0x2e7b8a[_0x06b0('0x15')](_0x131a9c);_0x2e7b8a[_0x06b0('0x13')]();_0x2e7b8a['on'](_0x06b0('0x16'),function(){return _0x311138(_0x1b35d4);});}catch(_0x5ee164){fs[_0x06b0('0x17')](_0x1b35d4);return _0x34d34f(_0x5ee164);}});});};exports[_0x06b0('0x18')]=function(_0x4697a2,_0x1a0db8,_0x42d201,_0xd47eb0){return new BPromise(function(_0x3bd796,_0x592271){_0xd47eb0=combineOptions(_0xd47eb0);var _0x29606e=new Buffer(_0x42d201);var _0x18547d=fs['createReadStream'](_0x4697a2);var _0x39ca5f=fs[_0x06b0('0xe')](_0x1a0db8);var _0x2004ff=crypto['createDecipher'](_0xd47eb0[_0x06b0('0x6')],_0x29606e);_0x18547d['on'](_0x06b0('0x10'),function(_0xa8559e){var _0x565a4c=new Buffer(_0x2004ff['update'](_0xa8559e),_0x06b0('0x12'));_0x39ca5f[_0x06b0('0x15')](_0x565a4c);});_0x18547d['on'](_0x06b0('0x13'),function(){try{var _0x48f6e1=new Buffer(_0x2004ff[_0x06b0('0x14')](_0x06b0('0x12')),_0x06b0('0x12'));_0x39ca5f[_0x06b0('0x15')](_0x48f6e1);_0x39ca5f[_0x06b0('0x13')]();_0x39ca5f['on'](_0x06b0('0x16'),function(){return _0x3bd796(_0x1a0db8);});}catch(_0x2b93a4){fs[_0x06b0('0x17')](_0x1a0db8);return _0x592271(_0x2b93a4);}});});};exports[_0x06b0('0x19')]=function(_0x511d90,_0x100f2,_0x45b317){var _0x2f2f20=_0x45b317||stringOptions[_0x06b0('0x6')];var _0x23c186=_0x100f2||stringOptions[_0x06b0('0x1a')];var _0x2de03a=crypto['createCipher'](_0x2f2f20,_0x23c186);var _0x396c7c=_0x2de03a[_0x06b0('0x11')](_0x511d90,_0x06b0('0x1b'),_0x06b0('0x1c'));_0x396c7c+=_0x2de03a[_0x06b0('0x14')](_0x06b0('0x1c'));return _0x396c7c;};exports[_0x06b0('0x1d')]=function(_0x507560,_0x48b1dd,_0x437d22){var _0x84b418=_0x437d22||stringOptions[_0x06b0('0x6')];var _0x11f30b=_0x48b1dd||stringOptions[_0x06b0('0x1a')];var _0x1630fb=crypto[_0x06b0('0x1e')](_0x84b418,_0x11f30b);var _0x2a683d=_0x1630fb['update'](_0x507560,'base64',_0x06b0('0x1b'));_0x2a683d+=_0x1630fb['final'](_0x06b0('0x1b'));return _0x2a683d;}; \ No newline at end of file +var _0xa32b=['write','end','binary','close','decryptFile','createDecipher','final','unlink','encryptString','secret','createCipher','update','utf8','base64','crypto','bluebird','../../config/environment','../../config/logger','secrets','session','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','createWriteStream','data'];(function(_0x9dca4c,_0xc09e49){var _0x4c8506=function(_0x8305bf){while(--_0x8305bf){_0x9dca4c['push'](_0x9dca4c['shift']());}};_0x4c8506(++_0xc09e49);}(_0xa32b,0x144));var _0xba32=function(_0x21a0cb,_0x5a4cc5){_0x21a0cb=_0x21a0cb-0x0;var _0x2e9bb4=_0xa32b[_0x21a0cb];return _0x2e9bb4;};'use strict';var crypto=require(_0xba32('0x0'));var fs=require('fs');var BPromise=require(_0xba32('0x1'));var _=require('lodash');var config=require(_0xba32('0x2'));var logger=require(_0xba32('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xba32('0x4')][_0xba32('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0xba32('0x6')]&&config[_0xba32('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xba32('0x6')][_0xba32('0x7')]);if(isSupported){fileOptions[_0xba32('0x7')]=config['encrypt'][_0xba32('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xba32('0x8')](',\x20');logger[_0xba32('0x9')](config[_0xba32('0x6')][_0xba32('0x7')],_0xba32('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x1669ba){return AES_SUPPORTED_RX[_0xba32('0xb')](_0x1669ba);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xba32('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x5711cf){return getSupportedCiphers()[_0xba32('0xd')](_0x5711cf)>-0x1;}function combineOptions(_0x4af18e){var _0x138563={};for(var _0x2bbc58 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2bbc58)){_0x138563[_0x2bbc58]=fileOptions[_0x2bbc58];}}if(_0x4af18e){for(var _0x53f471 in _0x4af18e){if(_0x4af18e[_0xba32('0xe')](_0x53f471)){_0x138563[_0x53f471]=_0x4af18e[_0x53f471];}}}return _0x138563;}exports['encryptFile']=function(_0x1eb69c,_0x1e3435,_0x36f656,_0x37e832){return new BPromise(function(_0x587813,_0x4c65d7){_0x37e832=combineOptions(_0x37e832);var _0x8f72ca=new Buffer(_0x36f656);var _0x242051=fs['createReadStream'](_0x1eb69c);var _0x1d57a8=fs[_0xba32('0xf')](_0x1e3435);var _0x2da4ea=crypto['createCipher'](_0x37e832[_0xba32('0x7')],_0x8f72ca);_0x242051['on'](_0xba32('0x10'),function(_0x16839f){var _0x4d95e3=new Buffer(_0x2da4ea['update'](_0x16839f),'binary');_0x1d57a8[_0xba32('0x11')](_0x4d95e3);});_0x242051['on'](_0xba32('0x12'),function(){try{var _0x3d361f=new Buffer(_0x2da4ea['final'](_0xba32('0x13')),_0xba32('0x13'));_0x1d57a8[_0xba32('0x11')](_0x3d361f);_0x1d57a8['end']();_0x1d57a8['on'](_0xba32('0x14'),function(){return _0x587813(_0x1e3435);});}catch(_0x326fb3){fs['unlink'](_0x1e3435);return _0x4c65d7(_0x326fb3);}});});};exports[_0xba32('0x15')]=function(_0x2057da,_0x4157be,_0x584320,_0xe6308f){return new BPromise(function(_0x32e2a1,_0x577b11){_0xe6308f=combineOptions(_0xe6308f);var _0x3acc21=new Buffer(_0x584320);var _0x2526fd=fs['createReadStream'](_0x2057da);var _0x3a9c35=fs[_0xba32('0xf')](_0x4157be);var _0x1935f3=crypto[_0xba32('0x16')](_0xe6308f[_0xba32('0x7')],_0x3acc21);_0x2526fd['on'](_0xba32('0x10'),function(_0x2b51be){var _0x5f5d7a=new Buffer(_0x1935f3['update'](_0x2b51be),'binary');_0x3a9c35[_0xba32('0x11')](_0x5f5d7a);});_0x2526fd['on'](_0xba32('0x12'),function(){try{var _0x16dfdb=new Buffer(_0x1935f3[_0xba32('0x17')](_0xba32('0x13')),_0xba32('0x13'));_0x3a9c35[_0xba32('0x11')](_0x16dfdb);_0x3a9c35[_0xba32('0x12')]();_0x3a9c35['on'](_0xba32('0x14'),function(){return _0x32e2a1(_0x4157be);});}catch(_0x152683){fs[_0xba32('0x18')](_0x4157be);return _0x577b11(_0x152683);}});});};exports[_0xba32('0x19')]=function(_0x339fc5,_0x224370,_0x43386a){var _0x338ba1=_0x43386a||stringOptions[_0xba32('0x7')];var _0x790ed8=_0x224370||stringOptions[_0xba32('0x1a')];var _0x5bb049=crypto[_0xba32('0x1b')](_0x338ba1,_0x790ed8);var _0x32f98b=_0x5bb049[_0xba32('0x1c')](_0x339fc5,_0xba32('0x1d'),_0xba32('0x1e'));_0x32f98b+=_0x5bb049[_0xba32('0x17')](_0xba32('0x1e'));return _0x32f98b;};exports['decryptString']=function(_0x344c10,_0x31e6ca,_0x5cc47f){var _0x5f183b=_0x5cc47f||stringOptions[_0xba32('0x7')];var _0x2bf82d=_0x31e6ca||stringOptions[_0xba32('0x1a')];var _0x2a6795=crypto[_0xba32('0x16')](_0x5f183b,_0x2bf82d);var _0x4d7bcb=_0x2a6795['update'](_0x344c10,_0xba32('0x1e'),_0xba32('0x1d'));_0x4d7bcb+=_0x2a6795[_0xba32('0x17')]('utf8');return _0x4d7bcb;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1afb2dd..064e247 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 _0x29b8=['push','dirname','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','to-csv','bluebird','zip-dir','../../mysqldb','argv','update','info','CSV','find','then','splitSizeCsv','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','split','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x543950,_0x5c0344){var _0x220740=function(_0x51a41d){while(--_0x51a41d){_0x543950['push'](_0x543950['shift']());}};_0x220740(++_0x5c0344);}(_0x29b8,0x18e));var _0x829b=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0x29b8[_0x754ab4];return _0x34079a;};'use strict';var util=require('util');var path=require('path');var _=require(_0x829b('0x0'));var csv=require(_0x829b('0x1'));var fs=require('fs');var BPromise=require(_0x829b('0x2'));var zipdir=require(_0x829b('0x3'));var rimraf=require('rimraf');var db=require(_0x829b('0x4'))['db'];var dbH=require(_0x829b('0x4'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x829b('0x5')][0x2]);var QUERY=process[_0x829b('0x5')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x31e283,_0x30ad04){var _0x3bc613={'status':_0x31e283};var _0x1cb4b1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x30ad04){_0x3bc613['savename']=_0x30ad04;}return db['AnalyticExtractedReport'][_0x829b('0x6')](_0x3bc613,_0x1cb4b1);}function main(){var _0x4bc76d=0x1388;var _0x5512de;logger[_0x829b('0x7')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x829b('0x8')));return db['Setting'][_0x829b('0x9')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x829b('0xa')](function(_0x378b45){if(_0x378b45){_0x5512de=_0x378b45;_0x4bc76d=_0x5512de[_0x829b('0xb')]||0x1388;}})[_0x829b('0xa')](function(){return dbH[_0x829b('0xc')][_0x829b('0xd')](util[_0x829b('0xe')](_0x829b('0xf'),QUERY),{'type':dbH['sequelize'][_0x829b('0x10')][_0x829b('0x11')]});})[_0x829b('0xa')](function(_0x92ab5a){if(!_0x92ab5a[0x0][_0x829b('0x12')]){return analyticExtractedReport('Empty');}var _0x1c70d8=[];var _0x460d0c=0x0;var _0x57717c=!![];if(_0x92ab5a&&_0x92ab5a[_0x829b('0x13')]){var _0x59f06f=_0x92ab5a[0x0][_0x829b('0x12')]%(_0x460d0c+_0x4bc76d);if(_0x5512de[_0x829b('0x14')]){for(;_0x57717c;_0x460d0c+=_0x4bc76d,_0x59f06f=_0x92ab5a[0x0][_0x829b('0x12')]%(_0x460d0c+_0x4bc76d)){if(_0x59f06f==0x0||_0x59f06f==_0x92ab5a[0x0]['num']){_0x57717c=![];}_0x1c70d8['push'](dbH[_0x829b('0xc')][_0x829b('0xd')](util['format'](_0x829b('0x15'),QUERY,_0x4bc76d,_0x460d0c),{'type':dbH['sequelize'][_0x829b('0x10')][_0x829b('0x11')]}));}}else{_0x1c70d8[_0x829b('0x16')](dbH[_0x829b('0xc')]['query'](QUERY,{'type':dbH[_0x829b('0xc')][_0x829b('0x10')]['SELECT']}));}}var _0x5dcb44=path[_0x829b('0x17')](PATH);var _0xf23135=path['basename'](PATH,'.csv');var _0x5d885b=_0x5512de[_0x829b('0x14')]&&_0x1c70d8[_0x829b('0x13')]>0x1;var _0x334ca1=[];if(!fs[_0x829b('0x18')](path[_0x829b('0x19')](_0x5dcb44,_0xf23135))&&_0x5d885b){fs['mkdirSync'](path[_0x829b('0x19')](_0x5dcb44,_0xf23135));}return BPromise[_0x829b('0x1a')](_0x1c70d8,function(_0x480955){_0x334ca1[_0x829b('0x16')](_0x480955);})[_0x829b('0xa')](function(){for(var _0x3b16c8=0x0;_0x3b16c8<_0x334ca1[_0x829b('0x13')];_0x3b16c8+=0x1){var _0x41f25d;var _0x1650d1=_0x334ca1[_0x3b16c8];if(_0x5d885b){_0x41f25d=path[_0x829b('0x19')](_0x5dcb44,_0xf23135,util[_0x829b('0xe')](_0x829b('0x1b'),_0xf23135,_0x3b16c8,_0x829b('0x1c')));}else{_0x41f25d=path['join'](_0x5dcb44,util[_0x829b('0xe')](_0x829b('0x1d'),_0xf23135,'csv'));}fs[_0x829b('0x1e')](_0x41f25d,csv(_0x1650d1));}})[_0x829b('0xa')](function(){if(_0x5d885b){zipdir(path[_0x829b('0x19')](_0x5dcb44,_0xf23135),{'saveTo':path[_0x829b('0x19')](_0x5dcb44,util['format'](_0x829b('0x1d'),_0xf23135,_0x829b('0x1f')))},function(_0xb50b62,_0x3756fb){});rimraf(path[_0x829b('0x19')](_0x5dcb44,_0xf23135),function(){});}})[_0x829b('0xa')](function(){logger[_0x829b('0x7')](util[_0x829b('0xe')](_0x829b('0x20'),EXTRACTED_REPORT_ID,_0x829b('0x8')));return analyticExtractedReport('Completed',_0x5d885b?util[_0x829b('0xe')](_0x829b('0x1d'),_0xf23135,_0x5d885b?_0x829b('0x1f'):'csv'):null);});})['catch'](function(_0x2756eb){logger[_0x829b('0x7')](util['format'](_0x829b('0x21'),EXTRACTED_REPORT_ID,_0x829b('0x8')),util['inspect'](_0x2756eb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x829b('0x22'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xcb55=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','split','push','dirname','basename','.csv','join','each','csv','%s.%s','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update'];(function(_0x3e2ed6,_0x30815d){var _0x377ce7=function(_0x435949){while(--_0x435949){_0x3e2ed6['push'](_0x3e2ed6['shift']());}};_0x377ce7(++_0x30815d);}(_0xcb55,0x79));var _0x5cb5=function(_0x34352b,_0x459635){_0x34352b=_0x34352b-0x0;var _0x500239=_0xcb55[_0x34352b];return _0x500239;};'use strict';var util=require(_0x5cb5('0x0'));var path=require(_0x5cb5('0x1'));var _=require(_0x5cb5('0x2'));var csv=require(_0x5cb5('0x3'));var fs=require('fs');var BPromise=require(_0x5cb5('0x4'));var zipdir=require(_0x5cb5('0x5'));var rimraf=require(_0x5cb5('0x6'));var db=require(_0x5cb5('0x7'))['db'];var dbH=require(_0x5cb5('0x7'))['dbH'];var logger=require(_0x5cb5('0x8'))(_0x5cb5('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x5cb5('0xa')][0x2]);var QUERY=process[_0x5cb5('0xa')][0x3];var PATH=process[_0x5cb5('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x216d03,_0x3db26b){var _0x4c6765={'status':_0x216d03};var _0xea5285={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3db26b){_0x4c6765[_0x5cb5('0xb')]=_0x3db26b;}return db[_0x5cb5('0xc')][_0x5cb5('0xd')](_0x4c6765,_0xea5285);}function main(){var _0x2e07a4=0x1388;var _0x3c553d;logger['info'](util[_0x5cb5('0xe')](_0x5cb5('0xf'),EXTRACTED_REPORT_ID,_0x5cb5('0x10')));return db['Setting'][_0x5cb5('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5cb5('0x12')]})['then'](function(_0x18638b){if(_0x18638b){_0x3c553d=_0x18638b;_0x2e07a4=_0x3c553d[_0x5cb5('0x12')]||0x1388;}})[_0x5cb5('0x13')](function(){return dbH[_0x5cb5('0x14')][_0x5cb5('0x15')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x5cb5('0x14')][_0x5cb5('0x16')][_0x5cb5('0x17')]});})[_0x5cb5('0x13')](function(_0x29c76a){if(!_0x29c76a[0x0][_0x5cb5('0x18')]){return analyticExtractedReport(_0x5cb5('0x19'));}var _0x225ce2=[];var _0x25eb14=0x0;var _0x5631e1=!![];if(_0x29c76a&&_0x29c76a[_0x5cb5('0x1a')]){var _0x9bbd5c=_0x29c76a[0x0][_0x5cb5('0x18')]%(_0x25eb14+_0x2e07a4);if(_0x3c553d[_0x5cb5('0x1b')]){for(;_0x5631e1;_0x25eb14+=_0x2e07a4,_0x9bbd5c=_0x29c76a[0x0][_0x5cb5('0x18')]%(_0x25eb14+_0x2e07a4)){if(_0x9bbd5c==0x0||_0x9bbd5c==_0x29c76a[0x0][_0x5cb5('0x18')]){_0x5631e1=![];}_0x225ce2['push'](dbH['sequelize'][_0x5cb5('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2e07a4,_0x25eb14),{'type':dbH[_0x5cb5('0x14')][_0x5cb5('0x16')][_0x5cb5('0x17')]}));}}else{_0x225ce2[_0x5cb5('0x1c')](dbH['sequelize'][_0x5cb5('0x15')](QUERY,{'type':dbH[_0x5cb5('0x14')][_0x5cb5('0x16')]['SELECT']}));}}var _0x32eb10=path[_0x5cb5('0x1d')](PATH);var _0x1d9654=path[_0x5cb5('0x1e')](PATH,_0x5cb5('0x1f'));var _0xf44ed5=_0x3c553d[_0x5cb5('0x1b')]&&_0x225ce2[_0x5cb5('0x1a')]>0x1;var _0x4b6c98=[];if(!fs['existsSync'](path[_0x5cb5('0x20')](_0x32eb10,_0x1d9654))&&_0xf44ed5){fs['mkdirSync'](path[_0x5cb5('0x20')](_0x32eb10,_0x1d9654));}return BPromise[_0x5cb5('0x21')](_0x225ce2,function(_0x4e8817){_0x4b6c98[_0x5cb5('0x1c')](_0x4e8817);})['then'](function(){for(var _0x415322=0x0;_0x415322<_0x4b6c98[_0x5cb5('0x1a')];_0x415322+=0x1){var _0x25a897;var _0x134fd8=_0x4b6c98[_0x415322];if(_0xf44ed5){_0x25a897=path[_0x5cb5('0x20')](_0x32eb10,_0x1d9654,util[_0x5cb5('0xe')]('%s%d.%s',_0x1d9654,_0x415322,_0x5cb5('0x22')));}else{_0x25a897=path[_0x5cb5('0x20')](_0x32eb10,util[_0x5cb5('0xe')](_0x5cb5('0x23'),_0x1d9654,'csv'));}fs[_0x5cb5('0x24')](_0x25a897,csv(_0x134fd8));}})[_0x5cb5('0x13')](function(){if(_0xf44ed5){zipdir(path['join'](_0x32eb10,_0x1d9654),{'saveTo':path['join'](_0x32eb10,util['format']('%s.%s',_0x1d9654,_0x5cb5('0x25')))},function(_0x577165,_0x24f4aa){});rimraf(path[_0x5cb5('0x20')](_0x32eb10,_0x1d9654),function(){});}})[_0x5cb5('0x13')](function(){logger[_0x5cb5('0x26')](util['format'](_0x5cb5('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x5cb5('0x28'),_0xf44ed5?util[_0x5cb5('0xe')](_0x5cb5('0x23'),_0x1d9654,_0xf44ed5?'zip':'csv'):null);});})['catch'](function(_0x536eea){logger[_0x5cb5('0x26')](util[_0x5cb5('0xe')](_0x5cb5('0x29'),EXTRACTED_REPORT_ID,'CSV'),util[_0x5cb5('0x2a')](_0x536eea,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5cb5('0x2b')](function(){process[_0x5cb5('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d7b7f7c..e157cf8 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 _0xa877=['sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','existsSync','mkdirSync','flatten','createPdfKitDocument','pdf','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','catch','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','before','margin','landscape','\x20/\x20','footer','num','Empty','.pdf','join','Setting','find','then','splitSizePdf','split'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa877,0x12d));var _0x7a87=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa877[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7a87('0x0'));var fs=require('fs');var util=require(_0x7a87('0x1'));var path=require(_0x7a87('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x7a87('0x3'));var PdfPrinter=require(_0x7a87('0x4'));var zipdir=require(_0x7a87('0x5'));var rimraf=require(_0x7a87('0x6'));var JSDOM=require('jsdom')[_0x7a87('0x7')];var window=new JSDOM('')[_0x7a87('0x8')];var db=require('../../mysqldb')['db'];var dbH=require(_0x7a87('0x9'))['dbH'];var logger=require(_0x7a87('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7a87('0xb')][0x2]);var QUERY=process[_0x7a87('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x7a87('0xb')][0x5];var FORMAT=_0x7a87('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x16affa,_0x1219c8){var _0x5e48e0={'status':_0x16affa};var _0x56db0d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1219c8){_0x5e48e0['savename']=_0x1219c8;}return db[_0x7a87('0xd')]['update'](_0x5e48e0,_0x56db0d);}function getHeaders(_0x269477){return _[_0x7a87('0xe')](_0x269477,function(_0x935b0f){return{'text':_0x935b0f,'style':_0x7a87('0xf')};});}function getRows(_0x29501d,_0x345fae){return _[_0x7a87('0xe')](_0x345fae,function(_0x354d01){return _(_0x354d01)[_0x7a87('0x10')](_0x29501d)['map'](function(_0x188884){return _0x188884?_[_0x7a87('0x11')](_0x188884):'';})[_0x7a87('0x12')]();});}function createTable(_0x17c793,_0x4b6a0b){var _0x357bc0={'widths':_[_0x7a87('0x13')](Array(_0x17c793[_0x7a87('0x14')]),0x91),'heights':function(_0xd2d472){return _0xd2d472===0x0?_0x7a87('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1e38f4=getHeaders(_0x17c793);_0x357bc0[_0x7a87('0x16')][_0x7a87('0x17')](_0x1e38f4);var _0x21135c=getRows(_0x17c793,_0x4b6a0b);_0x357bc0[_0x7a87('0x16')]=_0x357bc0[_0x7a87('0x16')][_0x7a87('0x18')](_0x21135c);return _0x357bc0;}function createTables(_0x4cf6e7){var _0x5ab049=[];var _0x2571b1=_[_0x7a87('0x19')](Object[_0x7a87('0x1a')](_0x4cf6e7[0x0]),0x5);_0x2571b1[_0x7a87('0x1b')](function(_0x32d696){_0x5ab049['push'](createTable(_0x32d696,_0x4cf6e7));});return _0x5ab049;}function getPDFDocDefinition(_0x4bb9d0){var _0x5a3565=util['format'](_0x7a87('0x1c'),NAME,EXTRACTED_REPORT[_0x7a87('0x1d')],moment(EXTRACTED_REPORT[_0x7a87('0x1e')])[_0x7a87('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x7a87('0x20')])[_0x7a87('0x1f')](FORMAT));var _0x49a7b9=[];for(var _0x5d1431=0x0;_0x5d1431<_0x4bb9d0[_0x7a87('0x14')];_0x5d1431++){var _0x33dc31=[];if(_0x5d1431===0x0){_0x33dc31['push']({'text':_0x5a3565,'style':'header'});}var _0x258646={'table':_0x4bb9d0[_0x5d1431]};if(_0x5d1431>0x0){_0x258646['pageBreak']=_0x7a87('0x21');_0x258646[_0x7a87('0x22')]=[0x0,0x46,0x0,0x0];}_0x33dc31[_0x7a87('0x17')](_0x258646);_0x49a7b9[_0x7a87('0x17')](_0x33dc31);}return{'pageSize':'A4','pageOrientation':_0x7a87('0x23'),'content':_0x49a7b9,'footer':function(_0xf470d1,_0x1ec1ca){return{'text':_0xf470d1[_0x7a87('0x11')]()+_0x7a87('0x24')+_0x1ec1ca,'style':_0x7a87('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x167400){var _0x1ec593=0x1388;var _0x42e932;if(!_0x167400[0x0][_0x7a87('0x26')]){return analyticExtractedReport(_0x7a87('0x27'));}var _0x264b10=[];var _0x343581=0x0;var _0x286479=!![];var _0x4a53d5=path['dirname'](PATH);var _0x43ecaf=path['basename'](PATH,_0x7a87('0x28'));var _0xac8e88=path[_0x7a87('0x29')](_0x4a53d5,util[_0x7a87('0x1f')]('%s.%s',_0x43ecaf,'pdf'));var _0x2637ff=![];return db[_0x7a87('0x2a')][_0x7a87('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x7a87('0x2c')](function(_0x3395ac){if(_0x3395ac){_0x42e932=_0x3395ac;_0x1ec593=_0x42e932[_0x7a87('0x2d')]||0x3e8;}})[_0x7a87('0x2c')](function(){if(_0x167400&&_0x167400[_0x7a87('0x14')]){var _0x1b6d2c=_0x167400[0x0][_0x7a87('0x26')]%(_0x343581+_0x1ec593);if(_0x42e932[_0x7a87('0x2e')]){for(;_0x286479;_0x343581+=_0x1ec593,_0x1b6d2c=_0x167400[0x0][_0x7a87('0x26')]%(_0x343581+_0x1ec593)){if(_0x1b6d2c==0x0||_0x1b6d2c==_0x167400[0x0][_0x7a87('0x26')]){_0x286479=![];}_0x264b10[_0x7a87('0x17')](dbH[_0x7a87('0x2f')][_0x7a87('0x30')](util[_0x7a87('0x1f')](_0x7a87('0x31'),QUERY,_0x1ec593,_0x343581),{'type':dbH[_0x7a87('0x2f')]['QueryTypes'][_0x7a87('0x32')]}));}}else{_0x264b10[_0x7a87('0x17')](dbH[_0x7a87('0x2f')][_0x7a87('0x30')](QUERY,{'type':dbH['sequelize'][_0x7a87('0x33')][_0x7a87('0x32')]}));}}_0x2637ff=_0x42e932[_0x7a87('0x2e')]&&_0x264b10[_0x7a87('0x14')]>0x1;if(!fs[_0x7a87('0x34')](path[_0x7a87('0x29')](_0x4a53d5,_0x43ecaf))&&_0x2637ff){fs[_0x7a87('0x35')](path[_0x7a87('0x29')](_0x4a53d5,_0x43ecaf));}return Promise['all'](_0x264b10);})[_0x7a87('0x2c')](function(_0x2db6d5){return createTables(_[_0x7a87('0x36')](_0x2db6d5));})['then'](function(_0x5f4386){var _0x7835a6=getPDFDocDefinition(_0x5f4386);var _0x2232c3=getPDFPrinter();var _0x2209c0=_0x2232c3[_0x7a87('0x37')](_0x7835a6);if(_0x2637ff)_0xac8e88=path['join'](_0x4a53d5,_0x43ecaf,util[_0x7a87('0x1f')]('%s%d.%s',_0x43ecaf,index,_0x7a87('0x38')));return writePDFDocument(_0x2209c0,_0xac8e88);})['then'](function(){if(!_0x2637ff)return;zipdir(path[_0x7a87('0x29')](_0x4a53d5,_0x43ecaf),{'saveTo':path[_0x7a87('0x29')](_0x4a53d5,util[_0x7a87('0x1f')](_0x7a87('0x39'),_0x43ecaf,_0x7a87('0x3a')))},function(_0xcfbc7e){if(_0xcfbc7e)throw _0xcfbc7e;return;});})[_0x7a87('0x2c')](function(){if(!_0x2637ff)return;rimraf(path['join'](_0x4a53d5,_0x43ecaf),function(){});})[_0x7a87('0x2c')](function(){logger[_0x7a87('0x3b')](util[_0x7a87('0x1f')](_0x7a87('0x3c'),EXTRACTED_REPORT_ID,_0x7a87('0x3d')));return analyticExtractedReport('Completed',_0x2637ff?util[_0x7a87('0x1f')]('%s.%s',_0x43ecaf,_0x2637ff?_0x7a87('0x3a'):_0x7a87('0x38')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7a87('0x3b')](util[_0x7a87('0x1f')](_0x7a87('0x3e'),EXTRACTED_REPORT_ID,_0x7a87('0x3f')));return db[_0x7a87('0xd')][_0x7a87('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x11eaae){EXTRACTED_REPORT=_0x11eaae;return dbH['sequelize'][_0x7a87('0x30')](util[_0x7a87('0x1f')](_0x7a87('0x41'),QUERY),{'type':dbH['sequelize'][_0x7a87('0x33')]['SELECT']});})[_0x7a87('0x2c')](extractReport)['catch'](function(_0x370592){logger[_0x7a87('0x3b')](util[_0x7a87('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7a87('0x3f')),util[_0x7a87('0x42')](_0x370592,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7a87('0x43'));})['finally'](function(){process[_0x7a87('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3bdafc=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x7a87('0x45'),'italics':__dirname+_0x7a87('0x46'),'bolditalics':__dirname+_0x7a87('0x47')}});return _0x3bdafc;}function getPDFDocDefinitionFromHTML(_0x58cb9b,_0x31cd3a){var _0x5e80fd=util[_0x7a87('0x1f')](_0x7a87('0x48'),_0x31cd3a[_0x7a87('0x49')],_0x31cd3a[_0x7a87('0x4a')]);var _0x412349=moment()[_0x7a87('0x1f')](_0x7a87('0x4b'))[_0x7a87('0x11')]();var _0x2b58d7=htmlToPdfmake(_0x58cb9b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2b58d7],'defaultStyle':{'font':_0x7a87('0x4c')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7a87('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7a87('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7a87('0x4d')}},'header':function(){return[{'text':_0x7a87('0x4e'),'style':_0x7a87('0x4f')}];},'footer':function(_0x17467b,_0x9ba84b){return[{'text':util[_0x7a87('0x1f')](_0x7a87('0x50'),_0x5e80fd,_0x17467b,_0x9ba84b,_0x412349),'style':_0x7a87('0x25')}];}};}function writePDFDocument(_0x20d9fe,_0x51837b){return new Promise(function(_0x4df964,_0xe64b2f){var _0x282cd5=_0x20d9fe[_0x7a87('0x51')](fs[_0x7a87('0x52')](_0x51837b));_0x282cd5['on'](_0x7a87('0x53'),function(){_0x4df964('finish');});_0x282cd5['on'](_0x7a87('0x54'),function(_0x2b55f2){_0xe64b2f(_0x2b55f2);});_0x20d9fe[_0x7a87('0x55')]();});}exports['createPdfFromHTML']=function(_0x5968d4,_0x2dba8e){var _0x5c7d66=getPDFPrinter();var _0xb22774=getPDFDocDefinitionFromHTML(_0x5968d4,_0x2dba8e);var _0x26929e=_0x5c7d66[_0x7a87('0x37')](_0xb22774);return writePDFDocument(_0x26929e,_0x2dba8e[_0x7a87('0x2')])[_0x7a87('0x56')](function(_0x61691e){throw _0x61691e;});}; \ No newline at end of file +var _0x15de=['error','end','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','window','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','map','tableHeader','pick','value','fill','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','before','landscape','\x20/\x20','Arial','right','num','Empty','dirname','basename','.pdf','pdf','Setting','find','split','splitSizePdf','then','sequelize','query','SELECT','join','all','%s%d.%s','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','info','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','Interaction\x20Transcript','footer','createWriteStream','finish'];(function(_0x2966d3,_0x353a1e){var _0x5e2c8c=function(_0x27f155){while(--_0x27f155){_0x2966d3['push'](_0x2966d3['shift']());}};_0x5e2c8c(++_0x353a1e);}(_0x15de,0x18d));var _0xe15d=function(_0x70504d,_0x34e810){_0x70504d=_0x70504d-0x0;var _0x47e29b=_0x15de[_0x70504d];return _0x47e29b;};'use strict';var _=require(_0xe15d('0x0'));var fs=require('fs');var util=require(_0xe15d('0x1'));var path=require(_0xe15d('0x2'));var moment=require(_0xe15d('0x3'));var htmlToPdfmake=require(_0xe15d('0x4'));var PdfPrinter=require(_0xe15d('0x5'));var zipdir=require(_0xe15d('0x6'));var rimraf=require('rimraf');var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xe15d('0x7')];var db=require(_0xe15d('0x8'))['db'];var dbH=require(_0xe15d('0x8'))[_0xe15d('0x9')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe15d('0xa')][0x2]);var QUERY=process[_0xe15d('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xe15d('0xa')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x291234,_0x5a69f1){var _0x21a32f={'status':_0x291234};var _0x5a12e6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5a69f1){_0x21a32f[_0xe15d('0xb')]=_0x5a69f1;}return db[_0xe15d('0xc')]['update'](_0x21a32f,_0x5a12e6);}function getHeaders(_0xb131a6){return _[_0xe15d('0xd')](_0xb131a6,function(_0x17f1b8){return{'text':_0x17f1b8,'style':_0xe15d('0xe')};});}function getRows(_0x8d7753,_0x38379a){return _[_0xe15d('0xd')](_0x38379a,function(_0x301fc7){return _(_0x301fc7)[_0xe15d('0xf')](_0x8d7753)[_0xe15d('0xd')](function(_0x5e174a){return _0x5e174a?_['toString'](_0x5e174a):'';})[_0xe15d('0x10')]();});}function createTable(_0x2e8c7d,_0x2c66e2){var _0x29dfac={'widths':_[_0xe15d('0x11')](Array(_0x2e8c7d[_0xe15d('0x12')]),0x91),'heights':function(_0x8a2c69){return _0x8a2c69===0x0?_0xe15d('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x40cd79=getHeaders(_0x2e8c7d);_0x29dfac[_0xe15d('0x14')]['push'](_0x40cd79);var _0x45c5e2=getRows(_0x2e8c7d,_0x2c66e2);_0x29dfac['body']=_0x29dfac[_0xe15d('0x14')][_0xe15d('0x15')](_0x45c5e2);return _0x29dfac;}function createTables(_0x13cbc6){var _0x34f081=[];var _0x1b9d2f=_[_0xe15d('0x16')](Object[_0xe15d('0x17')](_0x13cbc6[0x0]),0x5);_0x1b9d2f[_0xe15d('0x18')](function(_0x13170d){_0x34f081[_0xe15d('0x19')](createTable(_0x13170d,_0x13cbc6));});return _0x34f081;}function getPDFDocDefinition(_0x589a34){var _0x52008f=util[_0xe15d('0x1a')](_0xe15d('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xe15d('0x1c')])[_0xe15d('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0xe15d('0x1d')])['format'](FORMAT));var _0x11d8f5=[];for(var _0x351b12=0x0;_0x351b12<_0x589a34[_0xe15d('0x12')];_0x351b12++){var _0x2151f1=[];if(_0x351b12===0x0){_0x2151f1[_0xe15d('0x19')]({'text':_0x52008f,'style':_0xe15d('0x1e')});}var _0x1d04d9={'table':_0x589a34[_0x351b12]};if(_0x351b12>0x0){_0x1d04d9['pageBreak']=_0xe15d('0x1f');_0x1d04d9['margin']=[0x0,0x46,0x0,0x0];}_0x2151f1['push'](_0x1d04d9);_0x11d8f5[_0xe15d('0x19')](_0x2151f1);}return{'pageSize':'A4','pageOrientation':_0xe15d('0x20'),'content':_0x11d8f5,'footer':function(_0x4c4daf,_0x25a56f){return{'text':_0x4c4daf['toString']()+_0xe15d('0x21')+_0x25a56f,'style':'footer'};},'defaultStyle':{'font':_0xe15d('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xe15d('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1fa4c0){var _0x43898d=0x1388;var _0x4b4bc3;if(!_0x1fa4c0[0x0][_0xe15d('0x24')]){return analyticExtractedReport(_0xe15d('0x25'));}var _0x1bc817=[];var _0xc027bd=0x0;var _0xc29a45=!![];var _0x72b9d3=path[_0xe15d('0x26')](PATH);var _0x1d8794=path[_0xe15d('0x27')](PATH,_0xe15d('0x28'));var _0x5b94cc=path['join'](_0x72b9d3,util[_0xe15d('0x1a')]('%s.%s',_0x1d8794,_0xe15d('0x29')));var _0x4db57c=![];return db[_0xe15d('0x2a')][_0xe15d('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe15d('0x2c'),_0xe15d('0x2d')]})[_0xe15d('0x2e')](function(_0x3e5da9){if(_0x3e5da9){_0x4b4bc3=_0x3e5da9;_0x43898d=_0x4b4bc3['splitSizePdf']||0x3e8;}})[_0xe15d('0x2e')](function(){if(_0x1fa4c0&&_0x1fa4c0[_0xe15d('0x12')]){var _0x5e308b=_0x1fa4c0[0x0][_0xe15d('0x24')]%(_0xc027bd+_0x43898d);if(_0x4b4bc3[_0xe15d('0x2c')]){for(;_0xc29a45;_0xc027bd+=_0x43898d,_0x5e308b=_0x1fa4c0[0x0][_0xe15d('0x24')]%(_0xc027bd+_0x43898d)){if(_0x5e308b==0x0||_0x5e308b==_0x1fa4c0[0x0][_0xe15d('0x24')]){_0xc29a45=![];}_0x1bc817[_0xe15d('0x19')](dbH[_0xe15d('0x2f')][_0xe15d('0x30')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x43898d,_0xc027bd),{'type':dbH[_0xe15d('0x2f')]['QueryTypes']['SELECT']}));}}else{_0x1bc817[_0xe15d('0x19')](dbH[_0xe15d('0x2f')][_0xe15d('0x30')](QUERY,{'type':dbH[_0xe15d('0x2f')]['QueryTypes'][_0xe15d('0x31')]}));}}_0x4db57c=_0x4b4bc3['split']&&_0x1bc817[_0xe15d('0x12')]>0x1;if(!fs['existsSync'](path[_0xe15d('0x32')](_0x72b9d3,_0x1d8794))&&_0x4db57c){fs['mkdirSync'](path[_0xe15d('0x32')](_0x72b9d3,_0x1d8794));}return Promise[_0xe15d('0x33')](_0x1bc817);})[_0xe15d('0x2e')](function(_0x5e7c83){return createTables(_['flatten'](_0x5e7c83));})[_0xe15d('0x2e')](function(_0x50bee8){var _0x25fe7f=getPDFDocDefinition(_0x50bee8);var _0x3f58b0=getPDFPrinter();var _0x1c4afc=_0x3f58b0['createPdfKitDocument'](_0x25fe7f);if(_0x4db57c)_0x5b94cc=path[_0xe15d('0x32')](_0x72b9d3,_0x1d8794,util[_0xe15d('0x1a')](_0xe15d('0x34'),_0x1d8794,index,'pdf'));return writePDFDocument(_0x1c4afc,_0x5b94cc);})[_0xe15d('0x2e')](function(){if(!_0x4db57c)return;zipdir(path[_0xe15d('0x32')](_0x72b9d3,_0x1d8794),{'saveTo':path['join'](_0x72b9d3,util[_0xe15d('0x1a')](_0xe15d('0x35'),_0x1d8794,'zip'))},function(_0x439c33){if(_0x439c33)throw _0x439c33;return;});})[_0xe15d('0x2e')](function(){if(!_0x4db57c)return;rimraf(path['join'](_0x72b9d3,_0x1d8794),function(){});})['then'](function(){logger['info'](util['format'](_0xe15d('0x36'),EXTRACTED_REPORT_ID,_0xe15d('0x37')));return analyticExtractedReport(_0xe15d('0x38'),_0x4db57c?util[_0xe15d('0x1a')](_0xe15d('0x35'),_0x1d8794,_0x4db57c?_0xe15d('0x39'):_0xe15d('0x29')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe15d('0x3a')](util[_0xe15d('0x1a')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe15d('0x3b')));return db[_0xe15d('0xc')][_0xe15d('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe15d('0x2e')](function(_0x28e957){EXTRACTED_REPORT=_0x28e957;return dbH[_0xe15d('0x2f')]['query'](util[_0xe15d('0x1a')](_0xe15d('0x3d'),QUERY),{'type':dbH[_0xe15d('0x2f')]['QueryTypes']['SELECT']});})[_0xe15d('0x2e')](extractReport)[_0xe15d('0x3e')](function(_0x1ed211){logger['info'](util[_0xe15d('0x1a')](_0xe15d('0x3f'),EXTRACTED_REPORT_ID,_0xe15d('0x3b')),util[_0xe15d('0x40')](_0x1ed211,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe15d('0x41'));})[_0xe15d('0x42')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9f9bbc=new PdfPrinter({'Arial':{'normal':__dirname+_0xe15d('0x43'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xe15d('0x44'),'bolditalics':__dirname+_0xe15d('0x45')}});return _0x9f9bbc;}function getPDFDocDefinitionFromHTML(_0x3a7539,_0x3cfbc9){var _0x9c3af9=util[_0xe15d('0x1a')](_0xe15d('0x46'),_0x3cfbc9['channel'],_0x3cfbc9['interactionId']);var _0x16d7a5=moment()['format'](_0xe15d('0x47'))['toString']();var _0x370bdd=htmlToPdfmake(_0x3a7539,{'window':window,'tableAutoSize':!![]});return{'content':[_0x370bdd],'defaultStyle':{'font':_0xe15d('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe15d('0x48'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe15d('0x48'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xe15d('0x48')}},'header':function(){return[{'text':_0xe15d('0x49'),'style':'header'}];},'footer':function(_0x947f32,_0x3072d7){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x9c3af9,_0x947f32,_0x3072d7,_0x16d7a5),'style':_0xe15d('0x4a')}];}};}function writePDFDocument(_0x11e960,_0x5100a5){return new Promise(function(_0x291a47,_0x1e15c7){var _0x5bb68d=_0x11e960['pipe'](fs[_0xe15d('0x4b')](_0x5100a5));_0x5bb68d['on'](_0xe15d('0x4c'),function(){_0x291a47('finish');});_0x5bb68d['on'](_0xe15d('0x4d'),function(_0x4b2188){_0x1e15c7(_0x4b2188);});_0x11e960[_0xe15d('0x4e')]();});}exports['createPdfFromHTML']=function(_0xf8ccf1,_0x42ce36){var _0x533206=getPDFPrinter();var _0x613388=getPDFDocDefinitionFromHTML(_0xf8ccf1,_0x42ce36);var _0xaacc4b=_0x533206['createPdfKitDocument'](_0x613388);return writePDFDocument(_0xaacc4b,_0x42ce36['path'])[_0xe15d('0x3e')](function(_0x20dbac){throw _0x20dbac;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 23fd9e8..b70d4a9 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 _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 22fbe8e..c8aa2f1 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 _0xe8f2=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='];(function(_0x6ebf74,_0x422052){var _0x32d24d=function(_0x237fcf){while(--_0x237fcf){_0x6ebf74['push'](_0x6ebf74['shift']());}};_0x32d24d(++_0x422052);}(_0xe8f2,0x133));var _0x2e8f=function(_0x4bc9b3,_0x298862){_0x4bc9b3=_0x4bc9b3-0x0;var _0x19da83=_0xe8f2[_0x4bc9b3];return _0x19da83;};'use strict';var _=require(_0x2e8f('0x0'));var util=require(_0x2e8f('0x1'));function rewrite(_0x6adba0,_0x1ea1d5){var _0x5c07ab=this;return _0x6adba0[_0x2e8f('0x2')][_0x2e8f('0x3')][_0x2e8f('0x4')]({'raw':!![]})['then'](function(_0x5806d1){_0x5c07ab[_0x2e8f('0x5')]=_0x5806d1;return _0x6adba0[_0x2e8f('0x2')][_0x2e8f('0x6')][_0x2e8f('0x4')]({'where':{'IntervalId':_0x1ea1d5[_0x2e8f('0x7')]},'raw':!![]});})[_0x2e8f('0x8')](function(_0x284c13){return _0x6adba0[_0x2e8f('0x2')][_0x2e8f('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x2e8f('0x9')](_[_0x2e8f('0xa')](_0x284c13,_0x2e8f('0xb')))}},'order':[{'raw':_0x2e8f('0xc')}],'raw':!![]});})['then'](function(_0x4fb298){var _0x4e9d2c=_['filter'](_0x4fb298,{'priority':'1'});var _0x335c80=_[_0x2e8f('0xd')](_0x4fb298,{'isApp':0x1});var _0xdf163f=_[_0x2e8f('0xe')](_0x335c80,_0x2e8f('0xb'));var _0x192653=[_0x2e8f('0xf'),_0x2e8f('0x10')];var _0x4999ce=[];var _0x37b3d3=[];for(var _0x4a231b in _0xdf163f){if(_0xdf163f['hasOwnProperty'](_0x4a231b)){_0x5c07ab[_0x2e8f('0x11')]=0x2;_0x5c07ab[_0x2e8f('0x12')]=[];_0x5c07ab[_0x2e8f('0x13')]=_[_0x2e8f('0x14')](_0x4e9d2c,{'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')]});_0x5c07ab[_0x2e8f('0x12')][_0x2e8f('0x15')]({'type':_0xdf163f[_0x4a231b][0x0]['type'],'app':_0x2e8f('0x16'),'appdata':util[_0x2e8f('0x17')](_0x2e8f('0x18'),_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')]),'context':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1a')],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x5c07ab[_0x2e8f('0x11')]++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});if(_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')]===_0x2e8f('0x1c')){if(_0x5c07ab[_0x2e8f('0x13')]){_0x5c07ab['extensions']['push']({'type':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')],'app':'Set','appdata':_0x2e8f('0x1d')+(_0x5c07ab[_0x2e8f('0x13')]['cutdigits']?'${EXTEN:'+_0x5c07ab[_0x2e8f('0x13')][_0x2e8f('0x1e')]+'}':'${EXTEN}'),'context':_0xdf163f[_0x4a231b][0x0]['context'],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x5c07ab['priority']++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});}_0x5c07ab[_0x2e8f('0x12')]['push']({'type':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')],'app':_0x2e8f('0x16'),'appdata':_0x2e8f('0x1f')+_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')],'context':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1a')],'exten':_0xdf163f[_0x4a231b][0x0]['exten'],'priority':_0x5c07ab[_0x2e8f('0x11')]++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});var _0x2db35b=_0x5c07ab[_0x2e8f('0x11')]++;_0x5c07ab[_0x2e8f('0x12')][_0x2e8f('0x15')]({'type':_0xdf163f[_0x4a231b][0x0]['type'],'app':_0x2e8f('0x20'),'appdata':_0x2e8f('0x21')+(_0x2db35b+0x2)+'):Goto('+(_0x2db35b+0x1)+')','context':_0xdf163f[_0x4a231b][0x0]['context'],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x2db35b,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});if(_0x5c07ab[_0x2e8f('0x13')]){_0x5c07ab[_0x2e8f('0x12')][_0x2e8f('0x15')]({'type':_0xdf163f[_0x4a231b][0x0]['type'],'app':'Set','appdata':_0x5c07ab[_0x2e8f('0x13')][_0x2e8f('0x1e')]?_0x2e8f('0x22')+_0x5c07ab[_0x2e8f('0x13')][_0x2e8f('0x1e')]+'}':_0x2e8f('0x23'),'context':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1a')],'exten':_0xdf163f[_0x4a231b][0x0]['exten'],'priority':_0x5c07ab[_0x2e8f('0x11')]++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0]['VoiceExtensionId']});}_0x5c07ab[_0x2e8f('0x12')]['push']({'type':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')],'app':_0x2e8f('0x16'),'appdata':_0x2e8f('0x24')+_0xdf163f[_0x4a231b][0x0]['VoiceExtensionId'],'context':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1a')],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x5c07ab['priority']++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0]['VoiceExtensionId']});if(_0x5c07ab[_0x2e8f('0x13')]&&_0x5c07ab[_0x2e8f('0x13')][_0x2e8f('0x25')](_0x2e8f('0x26'))&&_0x5c07ab[_0x2e8f('0x13')][_0x2e8f('0x26')]!=='none'){_0x5c07ab[_0x2e8f('0x12')][_0x2e8f('0x15')]({'type':_0xdf163f[_0x4a231b][0x0]['type'],'app':_0x2e8f('0x16'),'appdata':_0x2e8f('0x27'),'context':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1a')],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x5c07ab['priority']++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});_0x5c07ab[_0x2e8f('0x12')][_0x2e8f('0x15')]({'type':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')],'app':_0x2e8f('0x16'),'appdata':_0x2e8f('0x28')+_0x5c07ab[_0x2e8f('0x13')][_0x2e8f('0x26')]||_0x2e8f('0x29'),'context':_0xdf163f[_0x4a231b][0x0]['context'],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x5c07ab['priority']++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});}}_0x5c07ab[_0x2e8f('0x12')][_0x2e8f('0x15')]({'type':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')],'app':_0x2e8f('0x16'),'appdata':_0x2e8f('0x2a'),'context':_0xdf163f[_0x4a231b][0x0]['context'],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x5c07ab['priority']++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});_0x5c07ab[_0x2e8f('0x12')][_0x2e8f('0x15')]({'type':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1a')],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x5c07ab['priority']++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});_0x5c07ab[_0x2e8f('0x12')]['push']({'type':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x19')],'app':'Set','appdata':_0x2e8f('0x2b'),'context':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1a')],'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'priority':_0x5c07ab[_0x2e8f('0x11')]++,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]});for(var _0x677c1=0x0,_0x45cc44=0x0;_0x677c1<_0xdf163f[_0x4a231b][_0x2e8f('0x2c')];_0x677c1+=0x1,_0x45cc44=0x0){var _0xc69b64=_0xdf163f[_0x4a231b][_0x677c1];if(_0xc69b64['type']){_0xc69b64[_0x2e8f('0x19')]=_0xc69b64[_0x2e8f('0x19')]['toLowerCase']();}var _0xacf657=[];var _0x258480=[];delete _0xc69b64['id'];delete _0xc69b64[_0x2e8f('0x2d')];delete _0xc69b64[_0x2e8f('0x2e')];var _0x4c790b=_0xc69b64[_0x2e8f('0x2f')]!==_0x2e8f('0x30')?[_0xc69b64[_0x2e8f('0x2f')]]:_0xc69b64[_0x2e8f('0x7')]?_['map'](_[_0x2e8f('0xd')](_0x5c07ab[_0x2e8f('0x5')],{'IntervalId':_0xc69b64[_0x2e8f('0x7')]}),_0x2e8f('0x2f')):[];if(_0xc69b64[_0x2e8f('0x25')](_0x2e8f('0x31'))){if(_0xc69b64['tag']&&_0xc69b64[_0x2e8f('0x31')]!=='--'){_0xacf657[_0x2e8f('0x15')]({'type':_0xc69b64[_0x2e8f('0x19')],'app':_0x2e8f('0x16'),'appdata':_0x2e8f('0x32')+_0xc69b64[_0x2e8f('0x31')],'context':_0xc69b64[_0x2e8f('0x1a')],'exten':_0xc69b64[_0x2e8f('0xb')],'priority':_0x4c790b['length']+_0x5c07ab['priority']+_0x45cc44++,'VoiceExtensionId':_0xc69b64[_0x2e8f('0x1b')]});}}if(_0xc69b64[_0x2e8f('0x19')]==='outbound'&&_0xc69b64[_0x2e8f('0x25')](_0x2e8f('0x33'))){if(_0xc69b64[_0x2e8f('0x33')]){_0xacf657[_0x2e8f('0x15')]({'type':_0xc69b64[_0x2e8f('0x19')],'app':_0x2e8f('0x20'),'appdata':_0x2e8f('0x34')+_0xc69b64[_0x2e8f('0x33')]+')','context':_0xc69b64['context'],'exten':_0xc69b64[_0x2e8f('0xb')],'priority':_0x4c790b[_0x2e8f('0x2c')]+_0x5c07ab[_0x2e8f('0x11')]+_0x45cc44++,'VoiceExtensionId':_0xc69b64[_0x2e8f('0x1b')]});}else{_0xacf657['push']({'type':_0xc69b64[_0x2e8f('0x19')],'app':_0x2e8f('0x20'),'appdata':_0x2e8f('0x35'),'context':_0xc69b64[_0x2e8f('0x1a')],'exten':_0xc69b64[_0x2e8f('0xb')],'priority':_0x4c790b['length']+_0x5c07ab[_0x2e8f('0x11')]+_0x45cc44++,'VoiceExtensionId':_0xc69b64[_0x2e8f('0x1b')]});}}if(_0xc69b64[_0x2e8f('0x25')](_0x2e8f('0x36'))){if(_0x192653[_0x2e8f('0x37')](_0xc69b64['app'][_0x2e8f('0x38')]())>=0x0&&_0xc69b64[_0x2e8f('0x39')]!==_0x2e8f('0x3a')){if(_0xc69b64['answer']){_0xacf657['push']({'type':_0xc69b64[_0x2e8f('0x19')],'app':'ExecIf','appdata':_0x2e8f('0x3b'),'context':_0xc69b64['context'],'exten':_0xc69b64[_0x2e8f('0xb')],'priority':_0x4c790b[_0x2e8f('0x2c')]+_0x5c07ab[_0x2e8f('0x11')]+_0x45cc44++,'VoiceExtensionId':_0xc69b64['VoiceExtensionId']});_0xacf657[_0x2e8f('0x15')]({'type':_0xc69b64['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0xc69b64[_0x2e8f('0x1a')],'exten':_0xc69b64['exten'],'priority':_0x4c790b[_0x2e8f('0x2c')]+_0x5c07ab[_0x2e8f('0x11')]+_0x45cc44++,'VoiceExtensionId':_0xc69b64[_0x2e8f('0x1b')]});}else{_0xacf657[_0x2e8f('0x15')]({'type':_0xc69b64[_0x2e8f('0x19')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xc69b64[_0x2e8f('0x1a')],'exten':_0xc69b64[_0x2e8f('0xb')],'priority':_0x4c790b[_0x2e8f('0x2c')]+_0x5c07ab[_0x2e8f('0x11')]+_0x45cc44++,'VoiceExtensionId':_0xc69b64[_0x2e8f('0x1b')]});_0xacf657[_0x2e8f('0x15')]({'type':_0xc69b64['type'],'app':_0x2e8f('0x16'),'appdata':_0x2e8f('0x3c'),'context':_0xc69b64[_0x2e8f('0x1a')],'exten':_0xc69b64[_0x2e8f('0xb')],'priority':_0x4c790b[_0x2e8f('0x2c')]+_0x5c07ab[_0x2e8f('0x11')]+_0x45cc44++,'VoiceExtensionId':_0xc69b64['VoiceExtensionId']});}}}for(var _0x164345=0x0;_0x164345<_0x4c790b[_0x2e8f('0x2c')];_0x164345+=0x1){var _0x5f4ced=_0x5c07ab[_0x2e8f('0x11')]+_0x4c790b['length'];var _0x35c8f7=_0x164345===_0x4c790b['length']-0x1?_0x5c07ab[_0x2e8f('0x11')]+_0xacf657[_0x2e8f('0x2c')]+_0x258480['length']+0x2:_0x5c07ab['priority']+_0x164345+0x1;_0xacf657[_0x2e8f('0x3d')](_0x164345,0x0,{'type':_0xc69b64['type'],'app':_0x2e8f('0x3e'),'appdata':_0x4c790b[_0x164345]+'?'+_0xc69b64[_0x2e8f('0x1a')]+_0x2e8f('0x3f')+_0x5f4ced+':'+_0xc69b64[_0x2e8f('0x1a')]+',${EXTEN},'+_0x35c8f7,'exten':_0xc69b64[_0x2e8f('0xb')],'context':_0xc69b64[_0x2e8f('0x1a')],'priority':_0x5c07ab['priority']+_0x164345,'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0]['VoiceExtensionId']});}_0xc69b64[_0x2e8f('0x11')]=_0xacf657[_0x2e8f('0x2c')]?_[_0x2e8f('0x40')](_0xacf657)[_0x2e8f('0x11')]+0x1:_0x5c07ab[_0x2e8f('0x11')];_0x5c07ab[_0x2e8f('0x11')]=(_0x258480[_0x2e8f('0x2c')]?_['last'](_0x258480)[_0x2e8f('0x11')]:_0xc69b64[_0x2e8f('0x11')])+0x1;_0x5c07ab[_0x2e8f('0x12')]=_[_0x2e8f('0x41')](_0x5c07ab[_0x2e8f('0x12')],_0xacf657,[_0xc69b64],_0x258480);}_0x5c07ab[_0x2e8f('0x12')][_0x2e8f('0x15')]({'type':_0xdf163f[_0x4a231b][0x0]['type'],'app':_0x2e8f('0x42'),'exten':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0xb')],'context':_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1a')],'priority':_0x5c07ab['priority'],'VoiceExtensionId':_0xdf163f[_0x4a231b][0x0]['VoiceExtensionId']});_0x4999ce[_0x2e8f('0x15')](_0xdf163f[_0x4a231b][0x0][_0x2e8f('0x1b')]);_0x37b3d3=_[_0x2e8f('0x41')](_0x37b3d3,_0x5c07ab['extensions']);}}return _0x6adba0[_0x2e8f('0x43')](function(_0x1f5598){return _0x6adba0['models'][_0x2e8f('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x4999ce}},'transaction':_0x1f5598})[_0x2e8f('0x8')](function(_0x231f8b){return _0x6adba0[_0x2e8f('0x2')]['VoiceExtension']['bulkCreate'](_[_0x2e8f('0x44')](_0x37b3d3,_0x2e8f('0x11')),{'transaction':_0x1f5598});});});})[_0x2e8f('0x45')](function(_0x7c9ae1){console[_0x2e8f('0x46')](_0x7c9ae1);});}exports[_0x2e8f('0x47')]=rewrite; \ No newline at end of file +var _0xd8b0=['VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','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','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context'];(function(_0x420f22,_0x16b6ea){var _0x573bc9=function(_0x2cfcba){while(--_0x2cfcba){_0x420f22['push'](_0x420f22['shift']());}};_0x573bc9(++_0x16b6ea);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));function rewrite(_0x5a55a3,_0x585166){var _0x4b72b0=this;return _0x5a55a3[_0x0d8b('0x2')][_0x0d8b('0x3')][_0x0d8b('0x4')]({'raw':!![]})[_0x0d8b('0x5')](function(_0x8196ed){_0x4b72b0['intervals']=_0x8196ed;return _0x5a55a3['models'][_0x0d8b('0x6')][_0x0d8b('0x4')]({'where':{'IntervalId':_0x585166[_0x0d8b('0x7')]},'raw':!![]});})['then'](function(_0x413284){return _0x5a55a3[_0x0d8b('0x2')]['VoiceExtension'][_0x0d8b('0x4')]({'where':{'exten':{'$in':_[_0x0d8b('0x8')](_[_0x0d8b('0x9')](_0x413284,_0x0d8b('0xa')))}},'order':[{'raw':_0x0d8b('0xb')}],'raw':!![]});})[_0x0d8b('0x5')](function(_0x2c5e9e){var _0x28f87c=_['filter'](_0x2c5e9e,{'priority':'1'});var _0x3c4bfa=_['filter'](_0x2c5e9e,{'isApp':0x1});var _0x4225c4=_[_0x0d8b('0xc')](_0x3c4bfa,_0x0d8b('0xa'));var _0x92cdd8=[_0x0d8b('0xd'),_0x0d8b('0xe')];var _0x15dd0f=[];var _0x31a8cc=[];for(var _0x1d4bbc in _0x4225c4){if(_0x4225c4[_0x0d8b('0xf')](_0x1d4bbc)){_0x4b72b0[_0x0d8b('0x10')]=0x2;_0x4b72b0[_0x0d8b('0x11')]=[];_0x4b72b0[_0x0d8b('0x12')]=_[_0x0d8b('0x13')](_0x28f87c,{'exten':_0x4225c4[_0x1d4bbc][0x0]['exten']});_0x4b72b0[_0x0d8b('0x11')][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')],'app':_0x0d8b('0x16'),'appdata':util[_0x0d8b('0x17')]('CDR(type)=%s',_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')]),'context':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x18')],'exten':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0xa')],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});if(_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')]===_0x0d8b('0x1a')){if(_0x4b72b0[_0x0d8b('0x12')]){_0x4b72b0['extensions'][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')],'app':_0x0d8b('0x16'),'appdata':_0x0d8b('0x1b')+(_0x4b72b0[_0x0d8b('0x12')][_0x0d8b('0x1c')]?_0x0d8b('0x1d')+_0x4b72b0[_0x0d8b('0x12')]['cutdigits']+'}':'${EXTEN}'),'context':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x18')],'exten':_0x4225c4[_0x1d4bbc][0x0]['exten'],'priority':_0x4b72b0['priority']++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0]['VoiceExtensionId']});}_0x4b72b0[_0x0d8b('0x11')][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')],'app':_0x0d8b('0x16'),'appdata':_0x0d8b('0x1e')+_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')],'context':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x18')],'exten':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0xa')],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0]['VoiceExtensionId']});var _0xe8bbee=_0x4b72b0[_0x0d8b('0x10')]++;_0x4b72b0['extensions'][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0]['type'],'app':_0x0d8b('0x1f'),'appdata':_0x0d8b('0x20')+(_0xe8bbee+0x2)+_0x0d8b('0x21')+(_0xe8bbee+0x1)+')','context':_0x4225c4[_0x1d4bbc][0x0]['context'],'exten':_0x4225c4[_0x1d4bbc][0x0]['exten'],'priority':_0xe8bbee,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});if(_0x4b72b0[_0x0d8b('0x12')]){_0x4b72b0['extensions'][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0]['type'],'app':_0x0d8b('0x16'),'appdata':_0x4b72b0['extension'][_0x0d8b('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x4b72b0[_0x0d8b('0x12')]['cutdigits']+'}':_0x0d8b('0x22'),'context':_0x4225c4[_0x1d4bbc][0x0]['context'],'exten':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0xa')],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});}_0x4b72b0['extensions']['push']({'type':_0x4225c4[_0x1d4bbc][0x0]['type'],'app':_0x0d8b('0x16'),'appdata':'outboundrouteid='+_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')],'context':_0x4225c4[_0x1d4bbc][0x0]['context'],'exten':_0x4225c4[_0x1d4bbc][0x0]['exten'],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});if(_0x4b72b0[_0x0d8b('0x12')]&&_0x4b72b0[_0x0d8b('0x12')][_0x0d8b('0xf')](_0x0d8b('0x23'))&&_0x4b72b0[_0x0d8b('0x12')][_0x0d8b('0x23')]!=='none'){_0x4b72b0[_0x0d8b('0x11')][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0]['type'],'app':_0x0d8b('0x16'),'appdata':_0x0d8b('0x24'),'context':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x18')],'exten':_0x4225c4[_0x1d4bbc][0x0]['exten'],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});_0x4b72b0[_0x0d8b('0x11')][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')],'app':'Set','appdata':_0x0d8b('0x25')+_0x4b72b0[_0x0d8b('0x12')]['recordingFormat']||_0x0d8b('0x26'),'context':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x18')],'exten':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0xa')],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});}}_0x4b72b0['extensions']['push']({'type':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x18')],'exten':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0xa')],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});_0x4b72b0[_0x0d8b('0x11')][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0]['type'],'app':_0x0d8b('0x16'),'appdata':_0x0d8b('0x27'),'context':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x18')],'exten':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0xa')],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});_0x4b72b0[_0x0d8b('0x11')]['push']({'type':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')],'app':_0x0d8b('0x16'),'appdata':_0x0d8b('0x28'),'context':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x18')],'exten':_0x4225c4[_0x1d4bbc][0x0]['exten'],'priority':_0x4b72b0[_0x0d8b('0x10')]++,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0]['VoiceExtensionId']});for(var _0x37b26c=0x0,_0x10b2e7=0x0;_0x37b26c<_0x4225c4[_0x1d4bbc][_0x0d8b('0x29')];_0x37b26c+=0x1,_0x10b2e7=0x0){var _0x26ac10=_0x4225c4[_0x1d4bbc][_0x37b26c];if(_0x26ac10[_0x0d8b('0x15')]){_0x26ac10[_0x0d8b('0x15')]=_0x26ac10[_0x0d8b('0x15')][_0x0d8b('0x2a')]();}var _0x89ab0d=[];var _0x2c3c84=[];delete _0x26ac10['id'];delete _0x26ac10['createdAt'];delete _0x26ac10['updatedAt'];var _0x576050=_0x26ac10['interval']!=='*,*,*,*'?[_0x26ac10[_0x0d8b('0x2b')]]:_0x26ac10[_0x0d8b('0x7')]?_[_0x0d8b('0x9')](_['filter'](_0x4b72b0['intervals'],{'IntervalId':_0x26ac10[_0x0d8b('0x7')]}),_0x0d8b('0x2b')):[];if(_0x26ac10[_0x0d8b('0xf')]('tag')){if(_0x26ac10[_0x0d8b('0x2c')]&&_0x26ac10[_0x0d8b('0x2c')]!=='--'){_0x89ab0d['push']({'type':_0x26ac10['type'],'app':_0x0d8b('0x16'),'appdata':'CDR(tag)='+_0x26ac10[_0x0d8b('0x2c')],'context':_0x26ac10['context'],'exten':_0x26ac10['exten'],'priority':_0x576050[_0x0d8b('0x29')]+_0x4b72b0[_0x0d8b('0x10')]+_0x10b2e7++,'VoiceExtensionId':_0x26ac10['VoiceExtensionId']});}}if(_0x26ac10['type']==='outbound'&&_0x26ac10['hasOwnProperty'](_0x0d8b('0x2d'))){if(_0x26ac10[_0x0d8b('0x2d')]){_0x89ab0d[_0x0d8b('0x14')]({'type':_0x26ac10['type'],'app':_0x0d8b('0x1f'),'appdata':_0x0d8b('0x2e')+_0x26ac10[_0x0d8b('0x2d')]+')','context':_0x26ac10[_0x0d8b('0x18')],'exten':_0x26ac10[_0x0d8b('0xa')],'priority':_0x576050[_0x0d8b('0x29')]+_0x4b72b0[_0x0d8b('0x10')]+_0x10b2e7++,'VoiceExtensionId':_0x26ac10[_0x0d8b('0x19')]});}else{_0x89ab0d[_0x0d8b('0x14')]({'type':_0x26ac10[_0x0d8b('0x15')],'app':_0x0d8b('0x1f'),'appdata':_0x0d8b('0x2f'),'context':_0x26ac10[_0x0d8b('0x18')],'exten':_0x26ac10[_0x0d8b('0xa')],'priority':_0x576050[_0x0d8b('0x29')]+_0x4b72b0[_0x0d8b('0x10')]+_0x10b2e7++,'VoiceExtensionId':_0x26ac10[_0x0d8b('0x19')]});}}if(_0x26ac10[_0x0d8b('0xf')](_0x0d8b('0x30'))){if(_0x92cdd8['indexOf'](_0x26ac10[_0x0d8b('0x31')]['toLowerCase']())>=0x0&&_0x26ac10['appType']!==_0x0d8b('0x32')){if(_0x26ac10[_0x0d8b('0x30')]){_0x89ab0d[_0x0d8b('0x14')]({'type':_0x26ac10[_0x0d8b('0x15')],'app':'ExecIf','appdata':_0x0d8b('0x33'),'context':_0x26ac10[_0x0d8b('0x18')],'exten':_0x26ac10[_0x0d8b('0xa')],'priority':_0x576050[_0x0d8b('0x29')]+_0x4b72b0[_0x0d8b('0x10')]+_0x10b2e7++,'VoiceExtensionId':_0x26ac10['VoiceExtensionId']});_0x89ab0d['push']({'type':_0x26ac10['type'],'app':'Set','appdata':_0x0d8b('0x34'),'context':_0x26ac10[_0x0d8b('0x18')],'exten':_0x26ac10['exten'],'priority':_0x576050['length']+_0x4b72b0[_0x0d8b('0x10')]+_0x10b2e7++,'VoiceExtensionId':_0x26ac10[_0x0d8b('0x19')]});}else{_0x89ab0d['push']({'type':_0x26ac10['type'],'app':_0x0d8b('0x1f'),'appdata':_0x0d8b('0x35'),'context':_0x26ac10[_0x0d8b('0x18')],'exten':_0x26ac10[_0x0d8b('0xa')],'priority':_0x576050[_0x0d8b('0x29')]+_0x4b72b0['priority']+_0x10b2e7++,'VoiceExtensionId':_0x26ac10[_0x0d8b('0x19')]});_0x89ab0d[_0x0d8b('0x14')]({'type':_0x26ac10['type'],'app':'Set','appdata':_0x0d8b('0x36'),'context':_0x26ac10[_0x0d8b('0x18')],'exten':_0x26ac10['exten'],'priority':_0x576050['length']+_0x4b72b0[_0x0d8b('0x10')]+_0x10b2e7++,'VoiceExtensionId':_0x26ac10[_0x0d8b('0x19')]});}}}for(var _0x377027=0x0;_0x377027<_0x576050[_0x0d8b('0x29')];_0x377027+=0x1){var _0x4a2989=_0x4b72b0[_0x0d8b('0x10')]+_0x576050['length'];var _0x5c271c=_0x377027===_0x576050[_0x0d8b('0x29')]-0x1?_0x4b72b0[_0x0d8b('0x10')]+_0x89ab0d['length']+_0x2c3c84['length']+0x2:_0x4b72b0[_0x0d8b('0x10')]+_0x377027+0x1;_0x89ab0d[_0x0d8b('0x37')](_0x377027,0x0,{'type':_0x26ac10[_0x0d8b('0x15')],'app':_0x0d8b('0x38'),'appdata':_0x576050[_0x377027]+'?'+_0x26ac10[_0x0d8b('0x18')]+_0x0d8b('0x39')+_0x4a2989+':'+_0x26ac10[_0x0d8b('0x18')]+_0x0d8b('0x39')+_0x5c271c,'exten':_0x26ac10['exten'],'context':_0x26ac10[_0x0d8b('0x18')],'priority':_0x4b72b0[_0x0d8b('0x10')]+_0x377027,'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});}_0x26ac10[_0x0d8b('0x10')]=_0x89ab0d[_0x0d8b('0x29')]?_[_0x0d8b('0x3a')](_0x89ab0d)[_0x0d8b('0x10')]+0x1:_0x4b72b0[_0x0d8b('0x10')];_0x4b72b0[_0x0d8b('0x10')]=(_0x2c3c84['length']?_[_0x0d8b('0x3a')](_0x2c3c84)[_0x0d8b('0x10')]:_0x26ac10[_0x0d8b('0x10')])+0x1;_0x4b72b0[_0x0d8b('0x11')]=_[_0x0d8b('0x3b')](_0x4b72b0['extensions'],_0x89ab0d,[_0x26ac10],_0x2c3c84);}_0x4b72b0[_0x0d8b('0x11')][_0x0d8b('0x14')]({'type':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x15')],'app':_0x0d8b('0x3c'),'exten':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0xa')],'context':_0x4225c4[_0x1d4bbc][0x0]['context'],'priority':_0x4b72b0['priority'],'VoiceExtensionId':_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]});_0x15dd0f[_0x0d8b('0x14')](_0x4225c4[_0x1d4bbc][0x0][_0x0d8b('0x19')]);_0x31a8cc=_[_0x0d8b('0x3b')](_0x31a8cc,_0x4b72b0['extensions']);}}return _0x5a55a3[_0x0d8b('0x3d')](function(_0x12aef7){return _0x5a55a3[_0x0d8b('0x2')]['VoiceExtension'][_0x0d8b('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x15dd0f}},'transaction':_0x12aef7})['then'](function(_0x2fce07){return _0x5a55a3[_0x0d8b('0x2')][_0x0d8b('0x6')][_0x0d8b('0x3f')](_[_0x0d8b('0x40')](_0x31a8cc,_0x0d8b('0x10')),{'transaction':_0x12aef7});});});})['catch'](function(_0x382d2e){console['error'](_0x382d2e);});}exports[_0x0d8b('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6434891..faa12b3 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 _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){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'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x2c11a6,_0xd16854){var _0x3900df=function(_0x58ca9c){while(--_0x58ca9c){_0x2c11a6['push'](_0x2c11a6['shift']());}};_0x3900df(++_0xd16854);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 376d333..2f3f761 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 _0x0f9f=['split','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','select','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','catch','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','findAll','name','_description','writeFileSync','parse','data','rows','find','isNil','trim','isValid','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','hasOwnProperty','replace','itemTypeId','description','SystemRow','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','finish','affectedRows','emit','unlink','complete','argv','existsSync','binding','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','length','push','all'];(function(_0x2c66c7,_0x10087e){var _0x20f0c6=function(_0x2ddfe4){while(--_0x2ddfe4){_0x2c66c7['push'](_0x2c66c7['shift']());}};_0x20f0c6(++_0x10087e);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x282f9a,_0x63dff){_0x282f9a=_0x282f9a-0x0;var _0x52528c=_0x0f9f[_0x282f9a];return _0x52528c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf0f9('0x0'));var Papa=require(_0xf0f9('0x1'));var util=require(_0xf0f9('0x2'));var BPromise=require('bluebird');var moment=require(_0xf0f9('0x3'));var squel=require(_0xf0f9('0x4'));var Redis=require(_0xf0f9('0x5'));var db=require(_0xf0f9('0x6'))['db'];var config=require(_0xf0f9('0x7'));var logger=require(_0xf0f9('0x8'))(_0xf0f9('0x9'));config[_0xf0f9('0xa')]=_[_0xf0f9('0xb')](config[_0xf0f9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0f9('0xc'))(new Redis(config[_0xf0f9('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xf0f9('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xd0620f){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))*$/[_0xf0f9('0xe')](_0xd0620f);}function selectNotIn(_0x5ab12e,_0x196f21,_0xb9d09e,_0x44e75c,_0x5157d5){return squel['select']()[_0xf0f9('0xf')](_0xf0f9('0x10'))[_0xf0f9('0x11')](_0x44e75c)[_0xf0f9('0x12')](_0x196f21,null,_0x196f21+_0xf0f9('0x13')+_0x44e75c+'.'+_0xb9d09e)[_0xf0f9('0x14')](_0x44e75c+'.'+_0xb9d09e+_0xf0f9('0x15')+_0x5ab12e+'.'+_0xb9d09e)['where'](_0x196f21+_0xf0f9('0x16')+_0x5157d5[_0xf0f9('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x30bdaa,_0x200514){promisesAdditionalPhones=[];return db[_0xf0f9('0x17')]['findAll']({'raw':!![],'attributes':['id',_0xf0f9('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xf0f9('0x19')](function(_0xa7d48c){if(_0xa7d48c!==null){var _0x2e2955=[];for(var _0x2b05e3=0x0;_0x2b05e3<_0xa7d48c[_0xf0f9('0x1a')];_0x2b05e3++){var _0x2f75da=_0xa7d48c[_0x2b05e3];_0x2e2955[_0xf0f9('0x1b')](insertAdditionalPhones(_0x2f75da));}}Promise[_0xf0f9('0x1c')](_0x2e2955)[_0xf0f9('0x19')](function(){_0x30bdaa({'val':0x1});});});});}function insertAdditionalPhones(_0x4d3534){return new Promise(function(_0x526fff,_0x350a48){var _0x3227cf=_0x4d3534['AdditionalPhones'];var _0x178e16=_0x3227cf['split'](';');var _0x5d7582=[];orderBy=0x0;for(var _0x42c157=0x0;_0x42c157<_0x178e16[_0xf0f9('0x1a')];_0x42c157++){_0x5d7582[_0xf0f9('0x1b')](splitAdditionalPhone(_0x4d3534['id'],_0x178e16[_0x42c157]));}Promise[_0xf0f9('0x1c')](_0x5d7582)[_0xf0f9('0x19')](function(){_0x526fff({'val':_0x178e16['length']});});});}function splitAdditionalPhone(_0x5ccbc9,_0x5294ac){return new Promise(function(_0x102336,_0x1c8c39){var _0x126ba7=_0x5294ac['split'](':');var _0x4a8726=_0x126ba7[0x0];var _0x209cd4=_0x126ba7[0x1];if(_0x209cd4!==''){var _0x550728=_0x209cd4[_0xf0f9('0x1d')]('|');var _0x414f87=[];for(var _0x173c79=0x0;_0x173c79<_0x550728['length'];_0x173c79++){if(_0x550728[_0x173c79]!==''){var _0x33dfca=_[_0xf0f9('0x1e')](promisesAdditionalPhones,{'contactId':_0x5ccbc9,'phone':_0x550728[_0x173c79]});if(_0x33dfca[_0xf0f9('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5ccbc9,'contactTypeId':_0x4a8726,'phone':_0x550728[_0x173c79],'orderBy':orderBy});}}}_0x102336({'ok':0x1});}else _0x102336({'res':0x0});});}function createAdditionalPhone(_0x384594,_0x33f070,_0x2879a2,_0x185e1e){var _0x16f639='';var _0x19d750='';var _0x5df7f5=_0x2879a2[_0xf0f9('0x1d')]('§');_0x16f639=_0x5df7f5[0x0];if(_0x5df7f5['length']==0x2)_0x19d750=_0x5df7f5[0x1];return new Promise(function(_0x1288e0,_0x30e85c){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x384594,'item':_0x16f639}})[_0xf0f9('0x19')](function(_0x50e7f6){if(_0x50e7f6){return db[_0xf0f9('0x1f')][_0xf0f9('0x20')]({'ItemTypeId':_0x33f070,'description':_0x19d750,'OrderBy':_0x185e1e},{'where':{'CmContactId':_0x384594,'item':_0x16f639}})[_0xf0f9('0x19')](function(_0x353502){_0x1288e0({'res':_0xf0f9('0x21')});});}else{return db[_0xf0f9('0x1f')][_0xf0f9('0x22')]({'CmContactId':_0x384594,'item':_0x16f639,'description':_0x19d750,'ItemTypeId':_0x33f070,'OrderBy':_0x185e1e,'ItemClass':_0xf0f9('0x23')})[_0xf0f9('0x19')](function(_0x4e4e08){_0x1288e0({'res':_0xf0f9('0x24')});});}});});}function insertCmHopper(_0x28da31,_0x534083,_0x48ef2a,_0x49ce78,_0x49d3bc){var _0x483a8c=[_0xf0f9('0x25'),'cm_contacts.scheduledat',_0xf0f9('0x26'),_0xf0f9('0x27'),_0x534083+'.'+_0x49ce78,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xf0f9('0x28'),_0xf0f9('0x29'),'\x22'+_0x49d3bc+'\x22'];return squel[_0xf0f9('0x2a')]()[_0xf0f9('0x2b')](_0xf0f9('0x2c'))[_0xf0f9('0x2d')]([_0xf0f9('0x10'),_0xf0f9('0x2e'),_0xf0f9('0x2f'),_0xf0f9('0x30'),_0x49ce78,_0xf0f9('0x31'),_0xf0f9('0x32'),_0xf0f9('0x33'),'UserId',_0xf0f9('0x34')],squel['select']()[_0xf0f9('0x35')](_0x483a8c)[_0xf0f9('0x11')](_0x534083)[_0xf0f9('0x12')](_0xf0f9('0x36'),null,_0xf0f9('0x37')+_0x534083+_0xf0f9('0x38'))[_0xf0f9('0x12')](_0x48ef2a,null,_0x48ef2a+'.id\x20=\x20'+_0x534083+'.'+_0x49ce78)['where'](_0x534083+_0xf0f9('0x39'),_0x28da31)[_0xf0f9('0x14')](_0xf0f9('0x3a'),NOW)[_0xf0f9('0x14')](_0xf0f9('0x3b'),selectNotIn(_0x534083,_0x48ef2a,_0x49ce78,'cm_hopper',[_0xf0f9('0x3c'),_0xf0f9('0x3d')]))[_0xf0f9('0x14')](_0xf0f9('0x3b'),selectNotIn(_0x534083,_0x48ef2a,_0x49ce78,_0xf0f9('0x2c'),['\x22always\x22'])))[_0xf0f9('0x3e')]();}function insertCmHopperBlack(_0x1fd579,_0x165b1b,_0x208aa9,_0x7cf75a){var _0x3054d6=['cm_contacts.phone',_0xf0f9('0x26'),_0xf0f9('0x27'),_0x165b1b+'.'+_0x7cf75a,_0xf0f9('0x3f'),'cm_contacts.updatedAt'];return squel[_0xf0f9('0x2a')]()[_0xf0f9('0x2b')](_0xf0f9('0x40'))[_0xf0f9('0x2d')]([_0xf0f9('0x10'),_0xf0f9('0x2f'),_0xf0f9('0x30'),_0x7cf75a,_0xf0f9('0x31'),_0xf0f9('0x32')],squel[_0xf0f9('0x41')]()[_0xf0f9('0x35')](_0x3054d6)[_0xf0f9('0x11')](_0x165b1b)[_0xf0f9('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x165b1b+_0xf0f9('0x38'))['join'](_0x208aa9,null,_0x208aa9+'.id\x20=\x20'+_0x165b1b+'.'+_0x7cf75a)['where'](_0x165b1b+_0xf0f9('0x39'),_0x1fd579)[_0xf0f9('0x14')](_0xf0f9('0x3a'),NOW)[_0xf0f9('0x14')](_0xf0f9('0x3b'),squel[_0xf0f9('0x41')]()[_0xf0f9('0xf')](_0xf0f9('0x10'))[_0xf0f9('0x11')]('cm_hopper_black')[_0xf0f9('0x14')](_0xf0f9('0x42'),_0x1fd579)[_0xf0f9('0x14')](_0x7cf75a+'\x20=\x20?',_0x165b1b+'.'+_0x7cf75a)))[_0xf0f9('0x3e')]();}function insertCmHopperAdditionalPhones(_0x36d15a){var _0x114e65=['cm_hopper.id',_0xf0f9('0x43'),_0xf0f9('0x44'),'cm_contact_has_items.createdAt',_0xf0f9('0x45')];return squel[_0xf0f9('0x2a')]()[_0xf0f9('0x2b')](_0xf0f9('0x46'))['fromQuery']([_0xf0f9('0x47'),_0xf0f9('0x10'),_0xf0f9('0x48'),_0xf0f9('0x31'),_0xf0f9('0x32')],squel[_0xf0f9('0x41')]()['fields'](_0x114e65)[_0xf0f9('0x11')]('cm_hopper')[_0xf0f9('0x12')](_0xf0f9('0x36'),null,_0xf0f9('0x49'))[_0xf0f9('0x12')](_0xf0f9('0x4a'),null,_0xf0f9('0x4b'))[_0xf0f9('0x14')](_0xf0f9('0x4c'),_0x36d15a)[_0xf0f9('0x14')](_0xf0f9('0x3a'),NOW))[_0xf0f9('0x3e')]();}function insertCmContact(_0x40aef9,_0x43d0fe,_0x17cb09,_0x45a165){var _0x3cb91a=_[_0xf0f9('0x4d')](_[_0xf0f9('0x4e')](_0x45a165),[_0xf0f9('0x30'),_0xf0f9('0x4f'),_0xf0f9('0x31'),_0xf0f9('0x32')]);return squel[_0xf0f9('0x2a')]()[_0xf0f9('0x2b')]('cm_contacts')['fromQuery'](_0x3cb91a,squel[_0xf0f9('0x41')]()['fields'](_0x3cb91a)[_0xf0f9('0x11')](_0x43d0fe)[_0xf0f9('0x14')]('('+_0x17cb09[_0xf0f9('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0xf0f9('0x41')]()['fields'](_0x17cb09)[_0xf0f9('0x11')](_0xf0f9('0x36'))[_0xf0f9('0x14')](_0xf0f9('0x42'),_0x40aef9)[_0xf0f9('0x14')]('deletedAt\x20IS\x20NULL'))[_0xf0f9('0x14')]('id\x20IN\x20?',squel[_0xf0f9('0x41')]()[_0xf0f9('0xf')](_0xf0f9('0x50'),_0xf0f9('0x51'))[_0xf0f9('0x11')](_0x43d0fe)['group'](_0x17cb09[_0xf0f9('0x12')](','))))[_0xf0f9('0x3e')]();}function handleStop(){logger[_0xf0f9('0x52')](_0xf0f9('0x53'));stopped=!![];}function handleUncaughtException(_0x1dbc9d){logger[_0xf0f9('0x54')](_0x1dbc9d[_0xf0f9('0x55')]);process[_0xf0f9('0x56')](0x1);}function handleError(_0x15f3b3,_0x406b45){stats[_0xf0f9('0x57')][_0xf0f9('0x1b')]({'name':_0x406b45[_0xf0f9('0x58')],'message':_0x406b45[_0xf0f9('0x55')],'row':_0x15f3b3});}function handleQuery(_0x5791a4){logger[_0xf0f9('0x52')](_0x5791a4);return db[_0xf0f9('0x59')][_0xf0f9('0x5a')](_0x5791a4)['spread'](function(_0x102cfd){results[_0xf0f9('0x1b')](_0x102cfd);})[_0xf0f9('0x5b')](function(_0x115d02){logger[_0xf0f9('0x54')](_0x115d02['message']);});}function main(_0x3b1d45,_0x838550,_0x3dbb9c,_0x2f3cfb){logger[_0xf0f9('0x52')](_0xf0f9('0x5c'),_0x3b1d45,JSON[_0xf0f9('0x5d')](_0x838550));process[_0xf0f9('0x5e')](_0xf0f9('0x5f'));var _0x10e1c7=_0x838550['binding'];var _0x3777ae=_[_0xf0f9('0x60')](_0x10e1c7);var _0x51f80a=_0x838550[_0xf0f9('0x61')];var _0x5bcef6=path[_0xf0f9('0x12')](config[_0xf0f9('0x62')],_0xf0f9('0x63'),_0x51f80a+'.csv');logger[_0xf0f9('0x52')](_0xf0f9('0x64'),_0x838550);db[_0xf0f9('0x65')][_0xf0f9('0x66')]({'raw':!![],'attributes':['id',_0xf0f9('0x67')]})[_0xf0f9('0x19')](function(_0xdb0e6c){for(var _0x39bd8f=0x0;_0x39bd8f<_0xdb0e6c[_0xf0f9('0x1a')];_0x39bd8f++){if(_0xdb0e6c[_0x39bd8f][_0xf0f9('0x67')]in _0x10e1c7){contactItemTypes[_0xf0f9('0x1b')](_0xdb0e6c[_0x39bd8f]);delete _0x3777ae[_0xdb0e6c[_0x39bd8f][_0xf0f9('0x67')]];hasAdditionalPhones=!![];}for(var _0x4a758c in _0x10e1c7){if(_0xdb0e6c[_0x39bd8f][_0xf0f9('0x67')]+_0xf0f9('0x68')===_0x4a758c){phoneDescriptions[_0xf0f9('0x1b')]({'itemTypeId':_0xdb0e6c[_0x39bd8f]['id'],'description':_0x4a758c});delete _0x3777ae[_0x4a758c];}}}if(hasAdditionalPhones)_0x3777ae[_0xf0f9('0x18')]='';var _0x4e43e3=_[_0xf0f9('0x4e')](_0x3777ae)[_0xf0f9('0x12')]();logger[_0xf0f9('0x52')]('header',_0x4e43e3);fs[_0xf0f9('0x69')](_0x5bcef6,_0x4e43e3+'\x0a');Papa[_0xf0f9('0x6a')](fs['createReadStream'](_0x3b1d45),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1a23f2,_0x405c38){try{for(var _0x5b3b40=0x0,_0x110bb7=[];_0x5b3b40<_0x1a23f2[_0xf0f9('0x6b')][_0xf0f9('0x1a')];_0x5b3b40++){stats[_0xf0f9('0x6c')]+=0x1;if(_0x1a23f2[_0xf0f9('0x57')][_0x5b3b40]){handleError(_0x1a23f2[_0xf0f9('0x6b')][_0x5b3b40],_0x1a23f2[_0xf0f9('0x57')][_0x5b3b40]);}else{var _0x504cb5=[];var _0x392ffa=[];var _0x33f71c={};for(var _0x5cd450 in _0x10e1c7){let _0x1ac791=contactItemTypes[_0xf0f9('0x6d')](_0x5bb76b=>_0x5bb76b[_0xf0f9('0x67')]===_0x5cd450);let _0x24396e=contactItemTypes['find'](_0x180c37=>_0x180c37['name']+_0xf0f9('0x68')===_0x5cd450);if(_[_0xf0f9('0x6e')](_0x1ac791)&&_[_0xf0f9('0x6e')](_0x24396e)){if(_0x10e1c7['hasOwnProperty'](_0x5cd450)){if(_0x1a23f2[_0xf0f9('0x6b')][_0x5b3b40][_0x10e1c7[_0x5cd450]]){var _0x4b042b=_[_0xf0f9('0x6f')](_0x1a23f2[_0xf0f9('0x6b')][_0x5b3b40][_0x10e1c7[_0x5cd450]]['replace'](/"/g,'\x27'));switch(_0x5cd450){case _0xf0f9('0x2e'):var _0x1e5018=moment(_0x4b042b,_0xf0f9('0xd'),!![]);if(_0x1e5018[_0xf0f9('0x70')]()){_0x110bb7[_0xf0f9('0x1b')]('\x22'+_0x4b042b+'\x22');}else{_0x504cb5[_0xf0f9('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xf0f9('0x33'):var _0x1eb8d2=parseInt(_0x4b042b);_0x4b042b=_[_0xf0f9('0x71')](_0x1eb8d2)||_0x1eb8d2<0x0||_0x1eb8d2>0x4?_0x2f3cfb?0x3:0x2:_0x1eb8d2;_0x110bb7[_0xf0f9('0x1b')]('\x22'+_0x4b042b+'\x22');break;case'UserId':var _0x28c540=parseInt(_0x4b042b);if(_['isNumber'](_0x28c540)&&_[_0xf0f9('0x72')](_0x3dbb9c,_0x28c540)){_0x110bb7[_0xf0f9('0x1b')]('\x22'+_0x28c540+'\x22');}else{_0x504cb5[_0xf0f9('0x1b')](_0xf0f9('0x73'));}break;case _0xf0f9('0x74'):if(isEmail(_0x4b042b)){_0x110bb7[_0xf0f9('0x1b')]('\x22'+_0x4b042b+'\x22');}else{_0x504cb5[_0xf0f9('0x1b')](_0xf0f9('0x75'));}break;case _0xf0f9('0x76'):var _0x46a345=moment(_0x4b042b,_0xf0f9('0x77'),!![]);if(_0x46a345[_0xf0f9('0x70')]()){_0x110bb7['push']('\x22'+_0x4b042b+'\x22');}else{_0x504cb5[_0xf0f9('0x1b')](_0xf0f9('0x78'));}break;default:_0x110bb7['push']('\x22'+_0x4b042b+'\x22');}}else{switch(_0x5cd450){case _0xf0f9('0x79'):case _0xf0f9('0x10'):_0x504cb5['push'](_0x5cd450+'\x20not\x20specified');break;default:_0x110bb7[_0xf0f9('0x1b')]('\x22\x22');}}}}else{var _0xb1f145='';if(!_[_0xf0f9('0x6e')](_0x1ac791)){if(!_0x33f71c[_0xf0f9('0x7a')](_0x1ac791['id'])){for(var _0x287b01=0x0;_0x287b01<_0x10e1c7[_0x5cd450][_0xf0f9('0x1a')];_0x287b01++){var _0x4b042b=_[_0xf0f9('0x6f')](_0x1a23f2[_0xf0f9('0x6b')][_0x5b3b40][_0x10e1c7[_0x5cd450][_0x287b01]][_0xf0f9('0x7b')](/"/g,'\x27'));var _0x3862a2=phoneDescriptions[_0xf0f9('0x6d')](_0x46fe0a=>_0x46fe0a[_0xf0f9('0x7c')]===_0x1ac791['id']);if(!_[_0xf0f9('0x6e')](_0x3862a2)){var _0x5cee0d=_[_0xf0f9('0x6f')](_0x1a23f2[_0xf0f9('0x6b')][_0x5b3b40][_0x10e1c7[_0x3862a2[_0xf0f9('0x7d')]][0x0]][_0xf0f9('0x7b')](/"/g,'\x27'));if(!_['isNil'](_0x5cee0d))_0x4b042b=_0x4b042b+'§'+_0x5cee0d;}if(_0xb1f145=='')_0xb1f145=_0x4b042b;else _0xb1f145+='|'+_0x4b042b;}_0x392ffa['push'](_0x1ac791['id']+':'+_0xb1f145);_0x33f71c[_0x1ac791['id']]=0x1;}}}}if(hasAdditionalPhones){_0x110bb7[_0xf0f9('0x1b')]('\x22'+_0x392ffa[_0xf0f9('0x12')](';')+'\x22');}if(_0x504cb5['length']){handleError(_0x1a23f2[_0xf0f9('0x6b')][_0x5b3b40],{'code':_0xf0f9('0x7e'),'message':_0x504cb5[_0xf0f9('0x12')]()});}else{fs['appendFileSync'](_0x5bcef6,_0x110bb7[_0xf0f9('0x12')]()+'\x0a');}_0x110bb7=[];}if(!(stats[_0xf0f9('0x6c')]%0xc8)){socket['emit'](_0xf0f9('0x7f')+_0x51f80a,stats);stats[_0xf0f9('0x57')]=[];}}if(stopped){logger['info'](_0xf0f9('0x80'));_0x405c38[_0xf0f9('0x81')]();}}catch(_0x338e66){handleError(_0x1a23f2[_0xf0f9('0x6b')][_0x5b3b40],{'code':'SystemError','message':_0x338e66[_0xf0f9('0x55')]});logger[_0xf0f9('0x54')](_0xf0f9('0x82'),_0x338e66['message']);}},'complete':function(){try{var _0x4f3ff7=[];var _0x404809='cm_contacts';if(_0x838550[_0xf0f9('0x83')]&&_0x838550[_0xf0f9('0x83')][_0xf0f9('0x1a')]){_0x404809=_0xf0f9('0x84')+_0x51f80a;_0x4f3ff7[_0xf0f9('0x1b')](_0xf0f9('0x85')+_0x404809+_0xf0f9('0x86'));}logger[_0xf0f9('0x52')](_0xf0f9('0x87'),contactItemTypes['length']);var _0x2f91d8=util[_0xf0f9('0x88')](_0xf0f9('0x89'),_0x5bcef6,_0x404809,_0x4e43e3,_0x838550[_0xf0f9('0x30')],_0x838550[_0xf0f9('0x4f')]||null,NOW,NOW);if(_[_0xf0f9('0x6e')](_0x10e1c7['scheduledat'])){_0x2f91d8+=_0xf0f9('0x8a');}_0x4f3ff7['push'](_0x2f91d8);if(_0x838550[_0xf0f9('0x83')]&&_0x838550[_0xf0f9('0x83')][_0xf0f9('0x1a')]){_0x4f3ff7[_0xf0f9('0x1b')](insertCmContact(_0x838550[_0xf0f9('0x30')],_0x404809,_0x838550[_0xf0f9('0x83')],_0x10e1c7));_0x4f3ff7[_0xf0f9('0x1b')]('DROP\x20TABLE\x20'+_0x404809+';');}BPromise[_0xf0f9('0x8b')](_0x4f3ff7,handleQuery)['then'](function(_0x5de55d){BPromise[_0xf0f9('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x4f3ff7=[];for(var _0xeb5dd8=0x0;_0xeb5dd8\x20\x20');}var _0xce45e3=path[_0xf0f9('0x12')](config[_0xf0f9('0x62')],_0xf0f9('0x63'),process[_0xf0f9('0x9a')][0x2]);if(!fs[_0xf0f9('0x9b')](_0xce45e3)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2c24e7={};try{_0x2c24e7=JSON[_0xf0f9('0x6a')](process['argv'][0x3]);if(!_0x2c24e7[_0xf0f9('0x9c')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2c24e7[_0xf0f9('0x9c')][_0xf0f9('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x2c24e7[_0xf0f9('0x9c')][_0xf0f9('0x79')]){throw new Error(_0xf0f9('0x9d'));}var _0x100d38=0x0;if(_0x2c24e7[_0xf0f9('0x9c')][_0xf0f9('0x9e')]){_0x100d38=0x1;}if(!_0x2c24e7[_0xf0f9('0x30')]){throw new Error(_0xf0f9('0x9f'));}}catch(_0x4ceaab){throw new Error(_0xf0f9('0xa0'));}var _0x40d42d=[];try{_0x40d42d=_['map'](JSON[_0xf0f9('0x6a')](process[_0xf0f9('0x9a')][0x4]),'id');}catch(_0x3c70fa){logger[_0xf0f9('0x52')](_0xf0f9('0xa1'));}main(_0xce45e3,_0x2c24e7,_0x40d42d,_0x100d38);}validate();process['on']('SIGINT',handleStop);process['on'](_0xf0f9('0xa2'),handleUncaughtException); \ No newline at end of file +var _0xd8ee=['../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','.id\x20=\x20','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','Received\x20SIGINT','errors','code','message','info','sequelize','catch','error','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','body','ContactItemType','name','keys','header','parse','createReadStream','data','find','_description','isNil','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','replace','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','squel','ioredis'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x330fe3,_0x4d9362){_0x330fe3=_0x330fe3-0x0;var _0x36ce81=_0xd8ee[_0x330fe3];return _0x36ce81;};'use strict';var fs=require('fs');var path=require(_0xed8e('0x0'));var _=require('lodash');var Papa=require(_0xed8e('0x1'));var util=require(_0xed8e('0x2'));var BPromise=require(_0xed8e('0x3'));var moment=require('moment');var squel=require(_0xed8e('0x4'));var Redis=require(_0xed8e('0x5'));var db=require(_0xed8e('0x6'))['db'];var config=require(_0xed8e('0x7'));var logger=require(_0xed8e('0x8'))(_0xed8e('0x9'));config['redis']=_[_0xed8e('0xa')](config[_0xed8e('0xb')],{'host':_0xed8e('0xc'),'port':0x18eb});var socket=require(_0xed8e('0xd'))(new Redis(config[_0xed8e('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xed8e('0xe')](_0xed8e('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x57efee){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'](_0x57efee);}function selectNotIn(_0x361f70,_0x4c3458,_0x552ecf,_0x3edaee,_0x5b9066){return squel[_0xed8e('0x10')]()[_0xed8e('0x11')]('phone')[_0xed8e('0x12')](_0x3edaee)[_0xed8e('0x13')](_0x4c3458,null,_0x4c3458+'.id\x20=\x20'+_0x3edaee+'.'+_0x552ecf)[_0xed8e('0x14')](_0x3edaee+'.'+_0x552ecf+'\x20=\x20'+_0x361f70+'.'+_0x552ecf)[_0xed8e('0x14')](_0x4c3458+_0xed8e('0x15')+_0x5b9066[_0xed8e('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xd4559b,_0x35a6db){promisesAdditionalPhones=[];return db[_0xed8e('0x16')][_0xed8e('0x17')]({'raw':!![],'attributes':['id',_0xed8e('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xed8e('0x19')](function(_0x17b3c7){if(_0x17b3c7!==null){var _0x1bf120=[];for(var _0x28dd7b=0x0;_0x28dd7b<_0x17b3c7[_0xed8e('0x1a')];_0x28dd7b++){var _0x4cefe4=_0x17b3c7[_0x28dd7b];_0x1bf120[_0xed8e('0x1b')](insertAdditionalPhones(_0x4cefe4));}}Promise['all'](_0x1bf120)[_0xed8e('0x19')](function(){_0xd4559b({'val':0x1});});});});}function insertAdditionalPhones(_0xec2257){return new Promise(function(_0x5866df,_0x715374){var _0x167924=_0xec2257[_0xed8e('0x18')];var _0x51d6a2=_0x167924['split'](';');var _0x4df327=[];orderBy=0x0;for(var _0x269324=0x0;_0x269324<_0x51d6a2[_0xed8e('0x1a')];_0x269324++){_0x4df327[_0xed8e('0x1b')](splitAdditionalPhone(_0xec2257['id'],_0x51d6a2[_0x269324]));}Promise[_0xed8e('0x1c')](_0x4df327)['then'](function(){_0x5866df({'val':_0x51d6a2['length']});});});}function splitAdditionalPhone(_0xf53680,_0x2d2c19){return new Promise(function(_0x29e6ca,_0x2a4c3f){var _0x2ba0ce=_0x2d2c19['split'](':');var _0x5619b2=_0x2ba0ce[0x0];var _0xe2f3da=_0x2ba0ce[0x1];if(_0xe2f3da!==''){var _0x589317=_0xe2f3da[_0xed8e('0x1d')]('|');var _0x90106e=[];for(var _0x4bebfc=0x0;_0x4bebfc<_0x589317[_0xed8e('0x1a')];_0x4bebfc++){if(_0x589317[_0x4bebfc]!==''){var _0x13828a=_['filter'](promisesAdditionalPhones,{'contactId':_0xf53680,'phone':_0x589317[_0x4bebfc]});if(_0x13828a[_0xed8e('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xf53680,'contactTypeId':_0x5619b2,'phone':_0x589317[_0x4bebfc],'orderBy':orderBy});}}}_0x29e6ca({'ok':0x1});}else _0x29e6ca({'res':0x0});});}function createAdditionalPhone(_0x53f9d0,_0x26c644,_0x37c350,_0x428295){var _0x91cfdc='';var _0x177e05='';var _0xbbecf4=_0x37c350[_0xed8e('0x1d')]('§');_0x91cfdc=_0xbbecf4[0x0];if(_0xbbecf4[_0xed8e('0x1a')]==0x2)_0x177e05=_0xbbecf4[0x1];return new Promise(function(_0xbbed86,_0x2be2be){return db[_0xed8e('0x1e')]['findOne']({'where':{'CmContactId':_0x53f9d0,'item':_0x91cfdc}})['then'](function(_0x5063fd){if(_0x5063fd){return db[_0xed8e('0x1e')][_0xed8e('0x1f')]({'ItemTypeId':_0x26c644,'description':_0x177e05,'OrderBy':_0x428295},{'where':{'CmContactId':_0x53f9d0,'item':_0x91cfdc}})['then'](function(_0x112f4b){_0xbbed86({'res':'updated'});});}else{return db[_0xed8e('0x1e')][_0xed8e('0x20')]({'CmContactId':_0x53f9d0,'item':_0x91cfdc,'description':_0x177e05,'ItemTypeId':_0x26c644,'OrderBy':_0x428295,'ItemClass':_0xed8e('0x21')})[_0xed8e('0x19')](function(_0x2666b5){_0xbbed86({'res':_0xed8e('0x22')});});}});});}function insertCmHopper(_0x39f94a,_0x8970df,_0x65c098,_0x4ea85c,_0x403ddb){var _0x120eab=[_0xed8e('0x23'),_0xed8e('0x24'),_0xed8e('0x25'),_0xed8e('0x26'),_0x8970df+'.'+_0x4ea85c,_0xed8e('0x27'),_0xed8e('0x28'),_0xed8e('0x29'),_0xed8e('0x2a'),'\x22'+_0x403ddb+'\x22'];return squel[_0xed8e('0x2b')]()[_0xed8e('0x2c')](_0xed8e('0x2d'))[_0xed8e('0x2e')]([_0xed8e('0x2f'),_0xed8e('0x30'),_0xed8e('0x31'),_0xed8e('0x32'),_0x4ea85c,_0xed8e('0x33'),_0xed8e('0x34'),_0xed8e('0x35'),_0xed8e('0x36'),_0xed8e('0x37')],squel[_0xed8e('0x10')]()[_0xed8e('0x38')](_0x120eab)['from'](_0x8970df)[_0xed8e('0x13')](_0xed8e('0x39'),null,_0xed8e('0x3a')+_0x8970df+_0xed8e('0x3b'))[_0xed8e('0x13')](_0x65c098,null,_0x65c098+'.id\x20=\x20'+_0x8970df+'.'+_0x4ea85c)['where'](_0x8970df+_0xed8e('0x3c'),_0x39f94a)['where'](_0xed8e('0x3d'),NOW)[_0xed8e('0x14')](_0xed8e('0x3e'),selectNotIn(_0x8970df,_0x65c098,_0x4ea85c,_0xed8e('0x2d'),[_0xed8e('0x3f'),_0xed8e('0x40')]))[_0xed8e('0x14')](_0xed8e('0x3e'),selectNotIn(_0x8970df,_0x65c098,_0x4ea85c,_0xed8e('0x2d'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x2f80cd,_0x2760ca,_0x2874ac,_0x1bac81){var _0x116423=['cm_contacts.phone','cm_contacts.id',_0xed8e('0x26'),_0x2760ca+'.'+_0x1bac81,_0xed8e('0x27'),_0xed8e('0x28')];return squel[_0xed8e('0x2b')]()[_0xed8e('0x2c')](_0xed8e('0x41'))[_0xed8e('0x2e')]([_0xed8e('0x2f'),_0xed8e('0x31'),_0xed8e('0x32'),_0x1bac81,'createdAt',_0xed8e('0x34')],squel['select']()[_0xed8e('0x38')](_0x116423)[_0xed8e('0x12')](_0x2760ca)[_0xed8e('0x13')](_0xed8e('0x39'),null,_0xed8e('0x3a')+_0x2760ca+'.CmListId')['join'](_0x2874ac,null,_0x2874ac+_0xed8e('0x42')+_0x2760ca+'.'+_0x1bac81)['where'](_0x2760ca+_0xed8e('0x3c'),_0x2f80cd)['where'](_0xed8e('0x3d'),NOW)[_0xed8e('0x14')](_0xed8e('0x3e'),squel[_0xed8e('0x10')]()[_0xed8e('0x11')](_0xed8e('0x2f'))['from']('cm_hopper_black')[_0xed8e('0x14')](_0xed8e('0x43'),_0x2f80cd)['where'](_0x1bac81+_0xed8e('0x44'),_0x2760ca+'.'+_0x1bac81)))[_0xed8e('0x45')]();}function insertCmHopperAdditionalPhones(_0x275af9){var _0x555a68=['cm_hopper.id',_0xed8e('0x46'),_0xed8e('0x47'),'cm_contact_has_items.createdAt',_0xed8e('0x48')];return squel[_0xed8e('0x2b')]()[_0xed8e('0x2c')](_0xed8e('0x49'))[_0xed8e('0x2e')]([_0xed8e('0x4a'),_0xed8e('0x2f'),_0xed8e('0x4b'),_0xed8e('0x33'),_0xed8e('0x34')],squel[_0xed8e('0x10')]()['fields'](_0x555a68)[_0xed8e('0x12')](_0xed8e('0x2d'))[_0xed8e('0x13')](_0xed8e('0x39'),null,_0xed8e('0x4c'))['join'](_0xed8e('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xed8e('0x14')]('cm_hopper.ListId\x20=\x20?',_0x275af9)[_0xed8e('0x14')](_0xed8e('0x3d'),NOW))[_0xed8e('0x45')]();}function insertCmContact(_0x5c5916,_0x1f36d4,_0x9bdfff,_0x13fca6){var _0x5145c5=_['concat'](_['keys'](_0x13fca6),[_0xed8e('0x32'),_0xed8e('0x4e'),'createdAt',_0xed8e('0x34')]);return squel[_0xed8e('0x2b')]()[_0xed8e('0x2c')](_0xed8e('0x39'))[_0xed8e('0x2e')](_0x5145c5,squel['select']()[_0xed8e('0x38')](_0x5145c5)[_0xed8e('0x12')](_0x1f36d4)[_0xed8e('0x14')]('('+_0x9bdfff['join'](',')+_0xed8e('0x4f'),squel[_0xed8e('0x10')]()[_0xed8e('0x38')](_0x9bdfff)[_0xed8e('0x12')]('cm_contacts')[_0xed8e('0x14')](_0xed8e('0x43'),_0x5c5916)[_0xed8e('0x14')]('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0xed8e('0x10')]()[_0xed8e('0x11')](_0xed8e('0x50'),_0xed8e('0x51'))[_0xed8e('0x12')](_0x1f36d4)['group'](_0x9bdfff[_0xed8e('0x13')](','))))[_0xed8e('0x45')]();}function handleStop(){logger['info'](_0xed8e('0x52'));stopped=!![];}function handleUncaughtException(_0x1ec4d4){logger['error'](_0x1ec4d4['message']);process['exit'](0x1);}function handleError(_0x5cdc07,_0x209316){stats[_0xed8e('0x53')][_0xed8e('0x1b')]({'name':_0x209316[_0xed8e('0x54')],'message':_0x209316[_0xed8e('0x55')],'row':_0x5cdc07});}function handleQuery(_0x3b7cd7){logger[_0xed8e('0x56')](_0x3b7cd7);return db[_0xed8e('0x57')]['query'](_0x3b7cd7)['spread'](function(_0x5b1b9f){results['push'](_0x5b1b9f);})[_0xed8e('0x58')](function(_0xcae562){logger[_0xed8e('0x59')](_0xcae562[_0xed8e('0x55')]);});}function main(_0x3da66b,_0x40e7b0,_0x2e1d1e,_0x48f65a){logger[_0xed8e('0x56')](_0xed8e('0x5a'),_0x3da66b,JSON[_0xed8e('0x5b')](_0x40e7b0));process[_0xed8e('0x5c')](_0xed8e('0x5d'));var _0xd838b4=_0x40e7b0[_0xed8e('0x5e')];var _0x4695f6=_[_0xed8e('0x5f')](_0xd838b4);var _0x26b037=_0x40e7b0['socket_timestamp'];var _0x3cd625=path['join'](config[_0xed8e('0x60')],_0xed8e('0x61'),_0x26b037+_0xed8e('0x62'));logger[_0xed8e('0x56')](_0xed8e('0x63'),_0x40e7b0);db[_0xed8e('0x64')]['findAll']({'raw':!![],'attributes':['id','name']})[_0xed8e('0x19')](function(_0x494c85){for(var _0x5628c3=0x0;_0x5628c3<_0x494c85[_0xed8e('0x1a')];_0x5628c3++){if(_0x494c85[_0x5628c3][_0xed8e('0x65')]in _0xd838b4){contactItemTypes['push'](_0x494c85[_0x5628c3]);delete _0x4695f6[_0x494c85[_0x5628c3][_0xed8e('0x65')]];hasAdditionalPhones=!![];}for(var _0x597d36 in _0xd838b4){if(_0x494c85[_0x5628c3]['name']+'_description'===_0x597d36){phoneDescriptions[_0xed8e('0x1b')]({'itemTypeId':_0x494c85[_0x5628c3]['id'],'description':_0x597d36});delete _0x4695f6[_0x597d36];}}}if(hasAdditionalPhones)_0x4695f6[_0xed8e('0x18')]='';var _0x3c7f77=_[_0xed8e('0x66')](_0x4695f6)[_0xed8e('0x13')]();logger[_0xed8e('0x56')](_0xed8e('0x67'),_0x3c7f77);fs['writeFileSync'](_0x3cd625,_0x3c7f77+'\x0a');Papa[_0xed8e('0x68')](fs[_0xed8e('0x69')](_0x3da66b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4bf2e2,_0x3252cf){try{for(var _0x789a5f=0x0,_0x1be183=[];_0x789a5f<_0x4bf2e2['data'][_0xed8e('0x1a')];_0x789a5f++){stats['rows']+=0x1;if(_0x4bf2e2['errors'][_0x789a5f]){handleError(_0x4bf2e2[_0xed8e('0x6a')][_0x789a5f],_0x4bf2e2[_0xed8e('0x53')][_0x789a5f]);}else{var _0x276cc0=[];var _0x21dab3=[];var _0xfe09a2={};for(var _0x593b50 in _0xd838b4){let _0x34ac5b=contactItemTypes[_0xed8e('0x6b')](_0x51eb53=>_0x51eb53[_0xed8e('0x65')]===_0x593b50);let _0x2e00e4=contactItemTypes[_0xed8e('0x6b')](_0x472189=>_0x472189[_0xed8e('0x65')]+_0xed8e('0x6c')===_0x593b50);if(_[_0xed8e('0x6d')](_0x34ac5b)&&_[_0xed8e('0x6d')](_0x2e00e4)){if(_0xd838b4[_0xed8e('0x6e')](_0x593b50)){if(_0x4bf2e2['data'][_0x789a5f][_0xd838b4[_0x593b50]]){var _0x5ba4be=_[_0xed8e('0x6f')](_0x4bf2e2[_0xed8e('0x6a')][_0x789a5f][_0xd838b4[_0x593b50]]['replace'](/"/g,'\x27'));switch(_0x593b50){case _0xed8e('0x30'):var _0x42063a=moment(_0x5ba4be,_0xed8e('0xf'),!![]);if(_0x42063a[_0xed8e('0x70')]()){_0x1be183[_0xed8e('0x1b')]('\x22'+_0x5ba4be+'\x22');}else{_0x276cc0[_0xed8e('0x1b')](_0xed8e('0x71'));}break;case _0xed8e('0x35'):var _0xa5987b=parseInt(_0x5ba4be);_0x5ba4be=_[_0xed8e('0x72')](_0xa5987b)||_0xa5987b<0x0||_0xa5987b>0x4?_0x48f65a?0x3:0x2:_0xa5987b;_0x1be183[_0xed8e('0x1b')]('\x22'+_0x5ba4be+'\x22');break;case'UserId':var _0x4c18c1=parseInt(_0x5ba4be);if(_[_0xed8e('0x73')](_0x4c18c1)&&_[_0xed8e('0x74')](_0x2e1d1e,_0x4c18c1)){_0x1be183['push']('\x22'+_0x4c18c1+'\x22');}else{_0x276cc0['push'](_0xed8e('0x75'));}break;case'email':if(isEmail(_0x5ba4be)){_0x1be183[_0xed8e('0x1b')]('\x22'+_0x5ba4be+'\x22');}else{_0x276cc0['push'](_0xed8e('0x76'));}break;case _0xed8e('0x77'):var _0x4f805e=moment(_0x5ba4be,_0xed8e('0x78'),!![]);if(_0x4f805e[_0xed8e('0x70')]()){_0x1be183[_0xed8e('0x1b')]('\x22'+_0x5ba4be+'\x22');}else{_0x276cc0[_0xed8e('0x1b')](_0xed8e('0x79'));}break;default:_0x1be183[_0xed8e('0x1b')]('\x22'+_0x5ba4be+'\x22');}}else{switch(_0x593b50){case _0xed8e('0x7a'):case _0xed8e('0x2f'):_0x276cc0[_0xed8e('0x1b')](_0x593b50+'\x20not\x20specified');break;default:_0x1be183['push']('\x22\x22');}}}}else{var _0x41cba5='';if(!_[_0xed8e('0x6d')](_0x34ac5b)){if(!_0xfe09a2[_0xed8e('0x6e')](_0x34ac5b['id'])){for(var _0x2b0b9a=0x0;_0x2b0b9a<_0xd838b4[_0x593b50]['length'];_0x2b0b9a++){var _0x5ba4be=_[_0xed8e('0x6f')](_0x4bf2e2['data'][_0x789a5f][_0xd838b4[_0x593b50][_0x2b0b9a]][_0xed8e('0x7b')](/"/g,'\x27'));var _0x5ee448=phoneDescriptions[_0xed8e('0x6b')](_0x1c313d=>_0x1c313d[_0xed8e('0x7c')]===_0x34ac5b['id']);if(!_[_0xed8e('0x6d')](_0x5ee448)){var _0x2f7403=_['trim'](_0x4bf2e2[_0xed8e('0x6a')][_0x789a5f][_0xd838b4[_0x5ee448[_0xed8e('0x7d')]][0x0]][_0xed8e('0x7b')](/"/g,'\x27'));if(!_[_0xed8e('0x6d')](_0x2f7403))_0x5ba4be=_0x5ba4be+'§'+_0x2f7403;}if(_0x41cba5=='')_0x41cba5=_0x5ba4be;else _0x41cba5+='|'+_0x5ba4be;}_0x21dab3[_0xed8e('0x1b')](_0x34ac5b['id']+':'+_0x41cba5);_0xfe09a2[_0x34ac5b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1be183[_0xed8e('0x1b')]('\x22'+_0x21dab3['join'](';')+'\x22');}if(_0x276cc0[_0xed8e('0x1a')]){handleError(_0x4bf2e2[_0xed8e('0x6a')][_0x789a5f],{'code':_0xed8e('0x7e'),'message':_0x276cc0['join']()});}else{fs[_0xed8e('0x7f')](_0x3cd625,_0x1be183[_0xed8e('0x13')]()+'\x0a');}_0x1be183=[];}if(!(stats[_0xed8e('0x80')]%0xc8)){socket[_0xed8e('0x81')](_0xed8e('0x82')+_0x26b037,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xed8e('0x83'));_0x3252cf[_0xed8e('0x84')]();}}catch(_0x234275){handleError(_0x4bf2e2[_0xed8e('0x6a')][_0x789a5f],{'code':_0xed8e('0x85'),'message':_0x234275[_0xed8e('0x55')]});logger['error']('step',_0x234275[_0xed8e('0x55')]);}},'complete':function(){try{var _0x268c83=[];var _0x13187b='cm_contacts';if(_0x40e7b0[_0xed8e('0x86')]&&_0x40e7b0[_0xed8e('0x86')][_0xed8e('0x1a')]){_0x13187b=_0xed8e('0x87')+_0x26b037;_0x268c83[_0xed8e('0x1b')]('CREATE\x20TABLE\x20'+_0x13187b+_0xed8e('0x88'));}logger[_0xed8e('0x56')](_0xed8e('0x89'),contactItemTypes[_0xed8e('0x1a')]);var _0x3b9f7b=util[_0xed8e('0xe')](_0xed8e('0x8a'),_0x3cd625,_0x13187b,_0x3c7f77,_0x40e7b0[_0xed8e('0x32')],_0x40e7b0[_0xed8e('0x4e')]||null,NOW,NOW);if(_[_0xed8e('0x6d')](_0xd838b4[_0xed8e('0x30')])){_0x3b9f7b+=_0xed8e('0x8b');}_0x268c83['push'](_0x3b9f7b);if(_0x40e7b0[_0xed8e('0x86')]&&_0x40e7b0[_0xed8e('0x86')][_0xed8e('0x1a')]){_0x268c83[_0xed8e('0x1b')](insertCmContact(_0x40e7b0['ListId'],_0x13187b,_0x40e7b0['duplicates'],_0xd838b4));_0x268c83[_0xed8e('0x1b')](_0xed8e('0x8c')+_0x13187b+';');}BPromise[_0xed8e('0x8d')](_0x268c83,handleQuery)[_0xed8e('0x19')](function(_0x5470b2){BPromise[_0xed8e('0x1c')]([handleAdditionalPhones()])[_0xed8e('0x19')](function(){_0x268c83=[];for(var _0x3ed53d=0x0;_0x3ed53d\x20\x20','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','SIGINT','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','.id\x20=\x20','\x20=\x20','where','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','findOne','update','create','inserted','CmContact','CmHopper'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var BPromise=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var squel=require(_0x3071('0x4'));var Redis=require('ioredis');var db=require(_0x3071('0x5'))['db'];var config=require(_0x3071('0x6'));var logger=require(_0x3071('0x7'))(_0x3071('0x8'));config[_0x3071('0x9')]=_[_0x3071('0xa')](config[_0x3071('0x9')],{'host':_0x3071('0xb'),'port':0x18eb});var socket=require(_0x3071('0xc'))(new Redis(config[_0x3071('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x3071('0xd')](_0x3071('0xe'));var tempTableName=_0x3071('0xf')+moment()['format'](_0x3071('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2610b4){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))*$/[_0x3071('0x11')](_0x2610b4);}function selectNotIn(_0xff9a29,_0x1ce844,_0x4a470a,_0x2ace21,_0x11a7ee){return squel[_0x3071('0x12')]()[_0x3071('0x13')](_0x3071('0x14'))['from'](_0x2ace21)['join'](_0x1ce844,null,_0x1ce844+_0x3071('0x15')+_0x2ace21+'.'+_0x4a470a)['where'](_0x2ace21+'.'+_0x4a470a+_0x3071('0x16')+_0xff9a29+'.'+_0x4a470a)[_0x3071('0x17')](_0x1ce844+'.dialCheckDuplicateType\x20IN\x20('+_0x11a7ee[_0x3071('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e1219,_0x2fc15d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x3071('0x19')][_0x3071('0x1a')](_0x3071('0x1b')+tempTableName)[_0x3071('0x1c')](function(_0x2a6a4b){if(_0x2a6a4b!==null){var _0x157a47=[];for(var _0x11bdc9=0x0;_0x11bdc9<_0x2a6a4b[_0x3071('0x1d')];_0x11bdc9++){var _0x344ea6=_0x2a6a4b[_0x11bdc9];if(!_['isNil'](_0x344ea6[_0x3071('0x14')])){if(!_[_0x3071('0x1e')](_0x344ea6[_0x3071('0x1f')]))_0x157a47[_0x3071('0x20')](insertAdditionalPhones(_0x344ea6));promisesContact[_0x3071('0x20')]({'contact':_0x344ea6});}}}Promise[_0x3071('0x21')](_0x157a47)[_0x3071('0x22')](function(){_0x4e1219({'val':0x1});});})[_0x3071('0x23')](function(_0x502a16){logger[_0x3071('0x24')](_0x502a16[_0x3071('0x25')]);});});}function insertAdditionalPhones(_0xd3e23d){return new Promise(function(_0x56c267,_0xb8f4e3){var _0x5cd80d=_0xd3e23d[_0x3071('0x1f')];if(_[_0x3071('0x1e')](_0x5cd80d))_0xb8f4e3({'val':0x0});else{var _0x3762d8=_0x5cd80d[_0x3071('0x26')](';');var _0x33090c=[];orderBy=0x0;for(var _0x34c50e=0x0;_0x34c50e<_0x3762d8[_0x3071('0x1d')];_0x34c50e++){_0x33090c[_0x3071('0x20')](splitAdditionalPhone(_0xd3e23d['id'],_0x3762d8[_0x34c50e]));}Promise['all'](_0x33090c)['then'](function(){_0x56c267({'val':_0x3762d8[_0x3071('0x1d')]});});}});}function splitAdditionalPhone(_0xb05b1d,_0x412652){return new Promise(function(_0x13df9f,_0x2793ef){var _0x44b45f=_0x412652[_0x3071('0x26')](':');var _0x1fe727=_0x44b45f[0x0];var _0x1de5fb=_0x44b45f[0x1];if(_0x1de5fb!==''){var _0x4c7130=_0x1de5fb[_0x3071('0x26')]('|');var _0x3f1e6e=[];for(var _0x177138=0x0;_0x177138<_0x4c7130['length'];_0x177138++){if(_0x4c7130[_0x177138]!==''){var _0x4fb1ca=_[_0x3071('0x27')](promisesAdditionalPhones,{'contactId':_0xb05b1d,'phone':_0x4c7130[_0x177138]});if(_0x4fb1ca[_0x3071('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x3071('0x20')]({'contactId':_0xb05b1d,'contactTypeId':_0x1fe727,'phone':_0x4c7130[_0x177138],'orderBy':orderBy});}}}_0x13df9f({'ok':0x1});}else _0x13df9f({'res':0x0});});}function createAdditionalPhone(_0x3fa3b8,_0x25b96b,_0x177b5f,_0x3921a1){var _0x32f1b4='';var _0x292205='';var _0x254fc8=_0x177b5f['split']('§');_0x32f1b4=_0x254fc8[0x0];if(_0x254fc8['length']==0x2)_0x292205=_0x254fc8[0x1];return new Promise(function(_0x9e26d1,_0x149e0d){return db[_0x3071('0x28')][_0x3071('0x29')]({'where':{'CmContactId':_0x3fa3b8,'item':_0x32f1b4}})[_0x3071('0x22')](function(_0x29538c){if(_0x29538c){return db[_0x3071('0x28')][_0x3071('0x2a')]({'ItemTypeId':_0x25b96b,'description':_0x292205,'OrderBy':_0x3921a1},{'where':{'CmContactId':_0x3fa3b8,'item':_0x32f1b4}})['then'](function(_0x55d230){_0x9e26d1({'res':'updated'});});}else{return db[_0x3071('0x28')][_0x3071('0x2b')]({'CmContactId':_0x3fa3b8,'item':_0x32f1b4,'ItemTypeId':_0x25b96b,'description':_0x292205,'OrderBy':_0x3921a1,'ItemClass':'PHONE'})[_0x3071('0x22')](function(_0x28747d){_0x9e26d1({'res':_0x3071('0x2c')});});}});});}function updateContact(_0x13ae2c){return new Promise(function(_0x5e1d2b,_0x218a82){var _0x1525df=_0x13ae2c['id'];delete _0x13ae2c['id'];return db[_0x3071('0x2d')][_0x3071('0x2a')](_0x13ae2c,{'where':{'id':_0x1525df}})[_0x3071('0x22')](function(_0x2068ce){updatedRows+=0x1;return db[_0x3071('0x2e')][_0x3071('0x2a')]({'phone':_0x13ae2c['phone']},{'where':{'ContactId':_0x1525df}})[_0x3071('0x22')](function(_0x54e52f){_0x5e1d2b({'ret':'OK'});});});});}function insertCmHopper(_0x4fb1ec,_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x2e85c8){var _0x46e94e=[_0x3071('0x2f'),_0x3071('0x30'),_0x3071('0x31'),_0x3071('0x32'),_0x1a1a64+'.'+_0x54d9c3,'cm_contacts.createdAt',_0x3071('0x33'),_0x3071('0x34'),'cm_contacts.UserId','\x22'+_0x2e85c8+'\x22'];return squel[_0x3071('0x35')]()['into'](_0x3071('0x36'))[_0x3071('0x37')](['phone','scheduledat',_0x3071('0x38'),_0x3071('0x39'),_0x54d9c3,_0x3071('0x3a'),'updatedAt',_0x3071('0x3b'),'UserId',_0x3071('0x3c')],squel['select']()[_0x3071('0x3d')](_0x46e94e)[_0x3071('0x3e')](_0x1a1a64)[_0x3071('0x18')](_0x3071('0x3f'),null,_0x3071('0x40')+_0x1a1a64+'.CmListId')['join'](_0xa3a7ae,null,_0xa3a7ae+_0x3071('0x15')+_0x1a1a64+'.'+_0x54d9c3)[_0x3071('0x17')](_0x1a1a64+_0x3071('0x41'),_0x4fb1ec)[_0x3071('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x3071('0x17')](_0x3071('0x42'),selectNotIn(_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x3071('0x36'),[_0x3071('0x43'),_0x3071('0x44')]))[_0x3071('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x3071('0x36'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x4dc9d1,_0x47ceaf,_0x2992e6,_0x1be8b6){var _0x67b2fb=[_0x3071('0x2f'),_0x3071('0x31'),_0x3071('0x32'),_0x47ceaf+'.'+_0x1be8b6,_0x3071('0x45'),_0x3071('0x33')];return squel['insert']()[_0x3071('0x46')](_0x3071('0x47'))[_0x3071('0x37')]([_0x3071('0x14'),_0x3071('0x38'),'ListId',_0x1be8b6,'createdAt',_0x3071('0x48')],squel[_0x3071('0x12')]()[_0x3071('0x3d')](_0x67b2fb)[_0x3071('0x3e')](_0x47ceaf)[_0x3071('0x18')]('cm_contacts',null,_0x3071('0x40')+_0x47ceaf+'.CmListId')[_0x3071('0x18')](_0x2992e6,null,_0x2992e6+'.id\x20=\x20'+_0x47ceaf+'.'+_0x1be8b6)['where'](_0x47ceaf+_0x3071('0x41'),_0x4dc9d1)['where'](_0x3071('0x49'),NOW)['where'](_0x3071('0x42'),squel[_0x3071('0x12')]()[_0x3071('0x13')](_0x3071('0x14'))['from'](_0x3071('0x47'))['where'](_0x3071('0x4a'),_0x4dc9d1)['where'](_0x1be8b6+_0x3071('0x4b'),_0x47ceaf+'.'+_0x1be8b6)))[_0x3071('0x4c')]();}function insertCmHopperAdditionalPhones(_0x4d395a){var _0x131ae6=[_0x3071('0x4d'),_0x3071('0x4e'),_0x3071('0x4f'),_0x3071('0x50'),_0x3071('0x51')];return squel[_0x3071('0x35')]()['into'](_0x3071('0x52'))[_0x3071('0x37')]([_0x3071('0x53'),_0x3071('0x14'),'OrderBy',_0x3071('0x3a'),_0x3071('0x48')],squel[_0x3071('0x12')]()[_0x3071('0x3d')](_0x131ae6)[_0x3071('0x3e')](_0x3071('0x36'))[_0x3071('0x18')](_0x3071('0x3f'),null,_0x3071('0x54'))[_0x3071('0x18')](_0x3071('0x55'),null,_0x3071('0x56'))[_0x3071('0x17')](_0x3071('0x57'),_0x4d395a)[_0x3071('0x17')](_0x3071('0x49'),NOW))['toString']();}function insertCmContact(_0x47a438,_0x12536d,_0x580c04,_0x403761){var _0x198168=_[_0x3071('0x58')](_['keys'](_0x403761),[_0x3071('0x39'),_0x3071('0x59'),'createdAt','updatedAt']);return squel[_0x3071('0x35')]()[_0x3071('0x46')](_0x3071('0x3f'))[_0x3071('0x37')](_0x198168,squel['select']()[_0x3071('0x3d')](_0x198168)[_0x3071('0x3e')](_0x12536d)[_0x3071('0x17')]('('+_0x580c04[_0x3071('0x18')](',')+_0x3071('0x5a'),squel['select']()[_0x3071('0x3d')](_0x580c04)[_0x3071('0x3e')](_0x3071('0x3f'))[_0x3071('0x17')](_0x3071('0x4a'),_0x47a438))[_0x3071('0x17')](_0x3071('0x5b'),squel['select']()['field'](_0x3071('0x5c'),'min_id')[_0x3071('0x3e')](_0x12536d)[_0x3071('0x5d')](_0x580c04['join'](','))))[_0x3071('0x4c')]();}function handleStop(){logger[_0x3071('0x5e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x108b14){logger[_0x3071('0x24')](_0x108b14[_0x3071('0x25')]);process[_0x3071('0x5f')](0x1);}function handleError(_0x2aaccb,_0x53a399){stats[_0x3071('0x60')][_0x3071('0x20')]({'name':_0x53a399[_0x3071('0x61')],'message':_0x53a399['message'],'row':_0x2aaccb});}function handleQuery(_0x1b0f81){logger[_0x3071('0x5e')](_0x1b0f81);return db[_0x3071('0x19')][_0x3071('0x1a')](_0x1b0f81)[_0x3071('0x1c')](function(_0x210123){results[_0x3071('0x20')](_0x210123);})[_0x3071('0x23')](function(_0x3b47e8){logger['error'](_0x3b47e8[_0x3071('0x25')]);});}function main(_0x29a58e,_0x3bcf28,_0x26ecb2,_0x466835){logger[_0x3071('0x5e')](_0x3071('0x62'),_0x29a58e,JSON[_0x3071('0x63')](_0x3bcf28));process[_0x3071('0x64')](_0x3071('0x65'));var _0x195d03=_0x3bcf28['binding'];var _0x320fe6=_[_0x3071('0x66')](_0x195d03);var _0x279594=_0x3bcf28[_0x3071('0x67')];var _0x429a03=path[_0x3071('0x18')](config[_0x3071('0x68')],_0x3071('0x69'),_0x279594+'.csv');logger[_0x3071('0x5e')](_0x3071('0x6a'),_0x3bcf28);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x3071('0x6b')]})[_0x3071('0x22')](function(_0x3469c1){for(var _0x38bc1f=0x0;_0x38bc1f<_0x3469c1['length'];_0x38bc1f++){if(_0x3469c1[_0x38bc1f]['name']in _0x195d03){contactItemTypes[_0x3071('0x20')](_0x3469c1[_0x38bc1f]);delete _0x320fe6[_0x3469c1[_0x38bc1f]['name']];hasAdditionalPhones=!![];}for(var _0x518bb5 in _0x195d03){if(_0x3469c1[_0x38bc1f]['name']+'_description'===_0x518bb5){phoneDescriptions[_0x3071('0x20')]({'itemTypeId':_0x3469c1[_0x38bc1f]['id'],'description':_0x518bb5});delete _0x320fe6[_0x518bb5];}}}if(hasAdditionalPhones)_0x320fe6[_0x3071('0x1f')]='';var _0xd928e8=_['keys'](_0x320fe6)[_0x3071('0x18')]();logger[_0x3071('0x5e')](_0x3071('0x6c'),_0xd928e8);fs[_0x3071('0x6d')](_0x429a03,_0xd928e8+'\x0a');Papa['parse'](fs[_0x3071('0x6e')](_0x29a58e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29841a,_0x588406){try{for(var _0x1b35d3=0x0,_0x29ee70=[];_0x1b35d3<_0x29841a[_0x3071('0x6f')][_0x3071('0x1d')];_0x1b35d3++){stats[_0x3071('0x70')]+=0x1;if(_0x29841a[_0x3071('0x60')][_0x1b35d3]){handleError(_0x29841a[_0x3071('0x6f')][_0x1b35d3],_0x29841a['errors'][_0x1b35d3]);}else{var _0x5dde93=[];var _0x21c1e3=[];var _0x168025={};for(var _0x1456ce in _0x195d03){let _0x4bf839=contactItemTypes['find'](_0x9f49f0=>_0x9f49f0[_0x3071('0x6b')]===_0x1456ce);let _0x3bad84=contactItemTypes[_0x3071('0x71')](_0x2f1935=>_0x2f1935[_0x3071('0x6b')]+_0x3071('0x72')===_0x1456ce);if(_[_0x3071('0x1e')](_0x4bf839)&&_['isNil'](_0x3bad84)){if(_0x195d03[_0x3071('0x73')](_0x1456ce)){if(_0x29841a['data'][_0x1b35d3][_0x195d03[_0x1456ce]]){var _0xa8e233=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x1456ce]][_0x3071('0x75')](/"/g,'\x27'));switch(_0x1456ce){case _0x3071('0x76'):var _0x44b5dc=moment(_0xa8e233,_0x3071('0xe'),!![]);if(_0x44b5dc[_0x3071('0x77')]()){_0x29ee70['push']('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x78'));}break;case _0x3071('0x3b'):var _0x4f06c0=parseInt(_0xa8e233);_0xa8e233=_[_0x3071('0x79')](_0x4f06c0)||_0x4f06c0<0x0||_0x4f06c0>0x4?_0x466835?0x3:0x2:_0x4f06c0;_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');break;case _0x3071('0x7a'):var _0x567e33=parseInt(_0xa8e233);if(_['isNumber'](_0x567e33)&&_[_0x3071('0x7b')](_0x26ecb2,_0x567e33)){_0x29ee70['push']('\x22'+_0x567e33+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x7c'));}break;case _0x3071('0x7d'):if(isEmail(_0xa8e233)){_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x7e'));}break;case _0x3071('0x7f'):var _0x4c67ec=moment(_0xa8e233,_0x3071('0x80'),!![]);if(_0x4c67ec[_0x3071('0x77')]()){_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x81'));}break;default:_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}}else{switch(_0x1456ce){case _0x3071('0x82'):case _0x3071('0x14'):_0x5dde93['push'](_0x1456ce+_0x3071('0x83'));break;default:_0x29ee70['push']('\x22\x22');}}}}else{var _0x2aef6e='';if(!_[_0x3071('0x1e')](_0x4bf839)){if(!_0x168025[_0x3071('0x73')](_0x4bf839['id'])){for(var _0x45879b=0x0;_0x45879b<_0x195d03[_0x1456ce][_0x3071('0x1d')];_0x45879b++){var _0xa8e233=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x1456ce][_0x45879b]][_0x3071('0x75')](/"/g,'\x27'));var _0x3a3cf3=phoneDescriptions['find'](_0x456921=>_0x456921[_0x3071('0x84')]===_0x4bf839['id']);if(!_['isNil'](_0x3a3cf3)){var _0x156826=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x3a3cf3[_0x3071('0x85')]][0x0]][_0x3071('0x75')](/"/g,'\x27'));if(!_['isNil'](_0x156826))_0xa8e233=_0xa8e233+'§'+_0x156826;}if(_0x2aef6e=='')_0x2aef6e=_0xa8e233;else _0x2aef6e+='|'+_0xa8e233;}_0x21c1e3['push'](_0x4bf839['id']+':'+_0x2aef6e);_0x168025[_0x4bf839['id']]=0x1;}}}}if(hasAdditionalPhones){_0x29ee70[_0x3071('0x20')]('\x22'+_0x21c1e3['join'](';')+'\x22');}if(_0x5dde93[_0x3071('0x1d')]){handleError(_0x29841a[_0x3071('0x6f')][_0x1b35d3],{'code':_0x3071('0x86'),'message':_0x5dde93[_0x3071('0x18')]()});}else{fs[_0x3071('0x87')](_0x429a03,_0x29ee70[_0x3071('0x18')]()+'\x0a');}_0x29ee70=[];}if(!(stats['rows']%0xc8)){socket[_0x3071('0x88')](_0x3071('0x89')+_0x279594,stats);stats[_0x3071('0x60')]=[];}}if(stopped){logger[_0x3071('0x5e')]('Abort\x20parser');_0x588406[_0x3071('0x8a')]();}}catch(_0x446546){handleError(_0x29841a['data'][_0x1b35d3],{'code':_0x3071('0x8b'),'message':_0x446546[_0x3071('0x25')]});logger[_0x3071('0x24')](_0x3071('0x8c'),_0x446546[_0x3071('0x25')]);}},'complete':function(){try{var _0x547ba8=[];var _0x44cecd=tempTableName;_0x547ba8['push'](_0x3071('0x8d')+_0x44cecd+_0x3071('0x8e'));logger[_0x3071('0x5e')](_0x3071('0x8f'),contactItemTypes[_0x3071('0x1d')]);var _0x247cda=util[_0x3071('0xd')](_0x3071('0x90'),_0x429a03,_0x44cecd,_0xd928e8,_0x3bcf28['ListId'],_0x3bcf28[_0x3071('0x59')]||null,NOW,NOW);if(_[_0x3071('0x1e')](_0x195d03[_0x3071('0x76')])){_0x247cda+=',\x20scheduledAt\x20=\x20NOW()';}_0x547ba8[_0x3071('0x20')](_0x247cda);BPromise['each'](_0x547ba8,handleQuery)[_0x3071('0x22')](function(_0x5a5861){BPromise[_0x3071('0x21')]([handleAdditionalPhones()])['then'](function(){_0x547ba8=[];for(var _0x163b29=0x0;_0x163b29\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/logger','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','where','sequelize','spread','isNil','AdditionalPhones','push','all','then','catch','error','length','split','findOne','update','updated','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.createdAt','insert','into','ListId','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys'];(function(_0x242bb9,_0x5575b7){var _0x2a2760=function(_0x54703e){while(--_0x54703e){_0x242bb9['push'](_0x242bb9['shift']());}};_0x2a2760(++_0x5575b7);}(_0x70e0,0x17b));var _0x070e=function(_0x381ae8,_0x4168be){_0x381ae8=_0x381ae8-0x0;var _0x119beb=_0x70e0[_0x381ae8];return _0x119beb;};'use strict';var fs=require('fs');var path=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var Papa=require(_0x070e('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x070e('0x3'));var squel=require(_0x070e('0x4'));var Redis=require(_0x070e('0x5'));var db=require(_0x070e('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x070e('0x7'))('import');config[_0x070e('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x070e('0x9'))(new Redis(config[_0x070e('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x070e('0xa')](_0x070e('0xb'));var tempTableName=_0x070e('0xc')+moment()[_0x070e('0xa')](_0x070e('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4e99e6){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'](_0x4e99e6);}function selectNotIn(_0x50f4eb,_0x2e3e5e,_0x12bb37,_0xb8d819,_0xa927a2){return squel[_0x070e('0xe')]()[_0x070e('0xf')](_0x070e('0x10'))[_0x070e('0x11')](_0xb8d819)[_0x070e('0x12')](_0x2e3e5e,null,_0x2e3e5e+_0x070e('0x13')+_0xb8d819+'.'+_0x12bb37)['where'](_0xb8d819+'.'+_0x12bb37+'\x20=\x20'+_0x50f4eb+'.'+_0x12bb37)[_0x070e('0x14')](_0x2e3e5e+'.dialCheckDuplicateType\x20IN\x20('+_0xa927a2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5bae0f,_0x11d2ce){promisesAdditionalPhones=[];promisesContact=[];return db[_0x070e('0x15')]['query']('select\x20*\x20from\x20'+tempTableName)[_0x070e('0x16')](function(_0xeae1a5){if(_0xeae1a5!==null){var _0x180897=[];for(var _0x19d9da=0x0;_0x19d9da<_0xeae1a5['length'];_0x19d9da++){var _0x49861b=_0xeae1a5[_0x19d9da];if(!_[_0x070e('0x17')](_0x49861b[_0x070e('0x10')])){if(!_[_0x070e('0x17')](_0x49861b[_0x070e('0x18')]))_0x180897[_0x070e('0x19')](insertAdditionalPhones(_0x49861b));promisesContact['push']({'contact':_0x49861b});}}}Promise[_0x070e('0x1a')](_0x180897)[_0x070e('0x1b')](function(){_0x5bae0f({'val':0x1});});})[_0x070e('0x1c')](function(_0x3ea105){logger[_0x070e('0x1d')](_0x3ea105['message']);});});}function insertAdditionalPhones(_0x5b2f48){return new Promise(function(_0x4e958f,_0x9907cf){var _0x3004f0=_0x5b2f48[_0x070e('0x18')];if(_['isNil'](_0x3004f0))_0x9907cf({'val':0x0});else{var _0x5b184=_0x3004f0['split'](';');var _0xf8dd5d=[];orderBy=0x0;for(var _0x3f6985=0x0;_0x3f6985<_0x5b184[_0x070e('0x1e')];_0x3f6985++){_0xf8dd5d[_0x070e('0x19')](splitAdditionalPhone(_0x5b2f48['id'],_0x5b184[_0x3f6985]));}Promise[_0x070e('0x1a')](_0xf8dd5d)[_0x070e('0x1b')](function(){_0x4e958f({'val':_0x5b184[_0x070e('0x1e')]});});}});}function splitAdditionalPhone(_0x164cdf,_0x595c7e){return new Promise(function(_0x2f8055,_0x270061){var _0x4790eb=_0x595c7e['split'](':');var _0xf17c56=_0x4790eb[0x0];var _0x5f3e9d=_0x4790eb[0x1];if(_0x5f3e9d!==''){var _0x4a2dbd=_0x5f3e9d[_0x070e('0x1f')]('|');var _0x25f6e=[];for(var _0x41deb1=0x0;_0x41deb1<_0x4a2dbd[_0x070e('0x1e')];_0x41deb1++){if(_0x4a2dbd[_0x41deb1]!==''){var _0x4763c6=_['filter'](promisesAdditionalPhones,{'contactId':_0x164cdf,'phone':_0x4a2dbd[_0x41deb1]});if(_0x4763c6[_0x070e('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x070e('0x19')]({'contactId':_0x164cdf,'contactTypeId':_0xf17c56,'phone':_0x4a2dbd[_0x41deb1],'orderBy':orderBy});}}}_0x2f8055({'ok':0x1});}else _0x2f8055({'res':0x0});});}function createAdditionalPhone(_0x1d72d6,_0x1d2a34,_0x43dd96,_0x28d7f2){var _0x1a1892='';var _0x26373b='';var _0x5e8326=_0x43dd96[_0x070e('0x1f')]('§');_0x1a1892=_0x5e8326[0x0];if(_0x5e8326[_0x070e('0x1e')]==0x2)_0x26373b=_0x5e8326[0x1];return new Promise(function(_0x3a16d0,_0x56fc12){return db['CmContactHasItem'][_0x070e('0x20')]({'where':{'CmContactId':_0x1d72d6,'item':_0x1a1892}})[_0x070e('0x1b')](function(_0xa6c0ab){if(_0xa6c0ab){return db['CmContactHasItem'][_0x070e('0x21')]({'ItemTypeId':_0x1d2a34,'description':_0x26373b,'OrderBy':_0x28d7f2},{'where':{'CmContactId':_0x1d72d6,'item':_0x1a1892}})[_0x070e('0x1b')](function(_0x3a9425){_0x3a16d0({'res':_0x070e('0x22')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x1d72d6,'item':_0x1a1892,'ItemTypeId':_0x1d2a34,'description':_0x26373b,'OrderBy':_0x28d7f2,'ItemClass':'PHONE'})['then'](function(_0xdf8945){_0x3a16d0({'res':'inserted'});});}});});}function updateContact(_0x1dff97){return new Promise(function(_0x323cf1,_0x4f8130){var _0x47a739=_0x1dff97['id'];delete _0x1dff97['id'];return db[_0x070e('0x23')][_0x070e('0x21')](_0x1dff97,{'where':{'id':_0x47a739}})['then'](function(_0x546a16){updatedRows+=0x1;return db[_0x070e('0x24')][_0x070e('0x21')]({'phone':_0x1dff97[_0x070e('0x10')]},{'where':{'ContactId':_0x47a739}})[_0x070e('0x1b')](function(_0x18f0ad){_0x323cf1({'ret':'OK'});});});});}function insertCmHopper(_0x5f530d,_0x482cc2,_0x24d17d,_0x3011c4,_0x4bb439){var _0xf57ed=[_0x070e('0x25'),'cm_contacts.scheduledat',_0x070e('0x26'),_0x070e('0x27'),_0x482cc2+'.'+_0x3011c4,'cm_contacts.createdAt',_0x070e('0x28'),_0x070e('0x29'),'cm_contacts.UserId','\x22'+_0x4bb439+'\x22'];return squel['insert']()['into'](_0x070e('0x2a'))[_0x070e('0x2b')]([_0x070e('0x10'),_0x070e('0x2c'),_0x070e('0x2d'),'ListId',_0x3011c4,_0x070e('0x2e'),_0x070e('0x2f'),_0x070e('0x30'),'UserId',_0x070e('0x31')],squel[_0x070e('0xe')]()[_0x070e('0x32')](_0xf57ed)['from'](_0x482cc2)[_0x070e('0x12')](_0x070e('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x482cc2+_0x070e('0x34'))['join'](_0x24d17d,null,_0x24d17d+_0x070e('0x13')+_0x482cc2+'.'+_0x3011c4)[_0x070e('0x14')](_0x482cc2+_0x070e('0x35'),_0x5f530d)[_0x070e('0x14')](_0x070e('0x36'),NOW)['where'](_0x070e('0x37'),selectNotIn(_0x482cc2,_0x24d17d,_0x3011c4,'cm_hopper',['\x22always\x22',_0x070e('0x38')]))[_0x070e('0x14')](_0x070e('0x37'),selectNotIn(_0x482cc2,_0x24d17d,_0x3011c4,'cm_hopper',[_0x070e('0x39')])))[_0x070e('0x3a')]();}function insertCmHopperBlack(_0x556bf3,_0x7dc240,_0x4a4ee3,_0x13e4e0){var _0x5851ab=['cm_contacts.phone','cm_contacts.id',_0x070e('0x27'),_0x7dc240+'.'+_0x13e4e0,_0x070e('0x3b'),_0x070e('0x28')];return squel[_0x070e('0x3c')]()[_0x070e('0x3d')]('cm_hopper_black')[_0x070e('0x2b')](['phone',_0x070e('0x2d'),_0x070e('0x3e'),_0x13e4e0,_0x070e('0x2e'),'updatedAt'],squel['select']()[_0x070e('0x32')](_0x5851ab)['from'](_0x7dc240)[_0x070e('0x12')](_0x070e('0x33'),null,_0x070e('0x3f')+_0x7dc240+'.CmListId')[_0x070e('0x12')](_0x4a4ee3,null,_0x4a4ee3+_0x070e('0x13')+_0x7dc240+'.'+_0x13e4e0)['where'](_0x7dc240+'.CmListId\x20=\x20?',_0x556bf3)[_0x070e('0x14')](_0x070e('0x36'),NOW)[_0x070e('0x14')](_0x070e('0x37'),squel[_0x070e('0xe')]()['field'](_0x070e('0x10'))[_0x070e('0x11')](_0x070e('0x40'))[_0x070e('0x14')](_0x070e('0x41'),_0x556bf3)[_0x070e('0x14')](_0x13e4e0+_0x070e('0x42'),_0x7dc240+'.'+_0x13e4e0)))[_0x070e('0x3a')]();}function insertCmHopperAdditionalPhones(_0xd67987){var _0x66a3f3=[_0x070e('0x43'),_0x070e('0x44'),_0x070e('0x45'),_0x070e('0x46'),_0x070e('0x47')];return squel['insert']()[_0x070e('0x3d')](_0x070e('0x48'))[_0x070e('0x2b')]([_0x070e('0x49'),_0x070e('0x10'),_0x070e('0x4a'),_0x070e('0x2e'),_0x070e('0x2f')],squel[_0x070e('0xe')]()['fields'](_0x66a3f3)[_0x070e('0x11')]('cm_hopper')[_0x070e('0x12')](_0x070e('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x070e('0x12')](_0x070e('0x4b'),null,_0x070e('0x4c'))[_0x070e('0x14')](_0x070e('0x4d'),_0xd67987)[_0x070e('0x14')](_0x070e('0x36'),NOW))['toString']();}function insertCmContact(_0x296978,_0x5bacbd,_0x516161,_0x3a06c6){var _0x3d1b5e=_[_0x070e('0x4e')](_[_0x070e('0x4f')](_0x3a06c6),[_0x070e('0x3e'),_0x070e('0x50'),_0x070e('0x2e'),_0x070e('0x2f')]);return squel['insert']()[_0x070e('0x3d')]('cm_contacts')['fromQuery'](_0x3d1b5e,squel[_0x070e('0xe')]()[_0x070e('0x32')](_0x3d1b5e)['from'](_0x5bacbd)[_0x070e('0x14')]('('+_0x516161[_0x070e('0x12')](',')+_0x070e('0x51'),squel[_0x070e('0xe')]()[_0x070e('0x32')](_0x516161)[_0x070e('0x11')](_0x070e('0x33'))['where']('ListId\x20=\x20?',_0x296978))['where'](_0x070e('0x52'),squel[_0x070e('0xe')]()[_0x070e('0xf')](_0x070e('0x53'),'min_id')[_0x070e('0x11')](_0x5bacbd)['group'](_0x516161[_0x070e('0x12')](','))))[_0x070e('0x3a')]();}function handleStop(){logger[_0x070e('0x54')](_0x070e('0x55'));stopped=!![];}function handleUncaughtException(_0x3ab11c){logger[_0x070e('0x1d')](_0x3ab11c['message']);process[_0x070e('0x56')](0x1);}function handleError(_0x18e8d0,_0x8aaf00){stats['errors'][_0x070e('0x19')]({'name':_0x8aaf00[_0x070e('0x57')],'message':_0x8aaf00['message'],'row':_0x18e8d0});}function handleQuery(_0x1f1df5){logger['info'](_0x1f1df5);return db[_0x070e('0x15')]['query'](_0x1f1df5)['spread'](function(_0x4b354d){results[_0x070e('0x19')](_0x4b354d);})[_0x070e('0x1c')](function(_0x1100d8){logger[_0x070e('0x1d')](_0x1100d8[_0x070e('0x58')]);});}function main(_0x3a00bb,_0x498bc6,_0x841c89,_0x54d4f9){logger[_0x070e('0x54')]('main',_0x3a00bb,JSON[_0x070e('0x59')](_0x498bc6));process[_0x070e('0x5a')]('start');var _0x1bcdc3=_0x498bc6['binding'];var _0x1a9e25=_[_0x070e('0x5b')](_0x1bcdc3);var _0x2f1604=_0x498bc6[_0x070e('0x5c')];var _0x764b06=path[_0x070e('0x12')](config[_0x070e('0x5d')],_0x070e('0x5e'),_0x2f1604+_0x070e('0x5f'));logger[_0x070e('0x54')](_0x070e('0x60'),_0x498bc6);db[_0x070e('0x61')][_0x070e('0x62')]({'raw':!![],'attributes':['id',_0x070e('0x63')]})['then'](function(_0x45bf20){for(var _0x19d78c=0x0;_0x19d78c<_0x45bf20[_0x070e('0x1e')];_0x19d78c++){if(_0x45bf20[_0x19d78c][_0x070e('0x63')]in _0x1bcdc3){contactItemTypes['push'](_0x45bf20[_0x19d78c]);delete _0x1a9e25[_0x45bf20[_0x19d78c][_0x070e('0x63')]];hasAdditionalPhones=!![];}for(var _0x4e8e58 in _0x1bcdc3){if(_0x45bf20[_0x19d78c][_0x070e('0x63')]+_0x070e('0x64')===_0x4e8e58){phoneDescriptions[_0x070e('0x19')]({'itemTypeId':_0x45bf20[_0x19d78c]['id'],'description':_0x4e8e58});delete _0x1a9e25[_0x4e8e58];}}}if(hasAdditionalPhones)_0x1a9e25[_0x070e('0x18')]='';var _0x55524b=_[_0x070e('0x4f')](_0x1a9e25)[_0x070e('0x12')]();logger[_0x070e('0x54')](_0x070e('0x65'),_0x55524b);fs['writeFileSync'](_0x764b06,_0x55524b+'\x0a');Papa[_0x070e('0x66')](fs['createReadStream'](_0x3a00bb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x10d95d,_0x36373d){try{for(var _0x3a1ad2=0x0,_0x150bf6=[];_0x3a1ad2<_0x10d95d[_0x070e('0x67')]['length'];_0x3a1ad2++){stats[_0x070e('0x68')]+=0x1;if(_0x10d95d[_0x070e('0x69')][_0x3a1ad2]){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],_0x10d95d[_0x070e('0x69')][_0x3a1ad2]);}else{var _0x5591dd=[];var _0x26b2c0=[];var _0x5cadcf={};for(var _0x399055 in _0x1bcdc3){let _0x44e465=contactItemTypes[_0x070e('0x6a')](_0x57585e=>_0x57585e[_0x070e('0x63')]===_0x399055);let _0x4d344c=contactItemTypes[_0x070e('0x6a')](_0x5ce157=>_0x5ce157[_0x070e('0x63')]+_0x070e('0x64')===_0x399055);if(_['isNil'](_0x44e465)&&_[_0x070e('0x17')](_0x4d344c)){if(_0x1bcdc3['hasOwnProperty'](_0x399055)){if(_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x399055]]){var _0x416dde=_['trim'](_0x10d95d['data'][_0x3a1ad2][_0x1bcdc3[_0x399055]][_0x070e('0x6b')](/"/g,'\x27'));switch(_0x399055){case _0x070e('0x2c'):var _0xf67cfd=moment(_0x416dde,_0x070e('0xb'),!![]);if(_0xf67cfd[_0x070e('0x6c')]()){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x6d'));}break;case _0x070e('0x30'):var _0x1d1f44=parseInt(_0x416dde);_0x416dde=_[_0x070e('0x6e')](_0x1d1f44)||_0x1d1f44<0x0||_0x1d1f44>0x4?_0x54d4f9?0x3:0x2:_0x1d1f44;_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');break;case _0x070e('0x6f'):var _0x5c88fe=parseInt(_0x416dde);if(_[_0x070e('0x70')](_0x5c88fe)&&_[_0x070e('0x71')](_0x841c89,_0x5c88fe)){_0x150bf6['push']('\x22'+_0x5c88fe+'\x22');}else{_0x5591dd['push'](_0x070e('0x72'));}break;case _0x070e('0x73'):if(isEmail(_0x416dde)){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x74'));}break;case _0x070e('0x75'):var _0x3223a4=moment(_0x416dde,_0x070e('0x76'),!![]);if(_0x3223a4[_0x070e('0x6c')]()){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x77'));}break;default:_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}}else{switch(_0x399055){case'firstName':case'phone':_0x5591dd['push'](_0x399055+_0x070e('0x78'));break;default:_0x150bf6[_0x070e('0x19')]('\x22\x22');}}}}else{var _0x2c4e67='';if(!_[_0x070e('0x17')](_0x44e465)){if(!_0x5cadcf['hasOwnProperty'](_0x44e465['id'])){for(var _0x33bfed=0x0;_0x33bfed<_0x1bcdc3[_0x399055][_0x070e('0x1e')];_0x33bfed++){var _0x416dde=_[_0x070e('0x79')](_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x399055][_0x33bfed]][_0x070e('0x6b')](/"/g,'\x27'));var _0x4a7129=phoneDescriptions[_0x070e('0x6a')](_0x5c56bd=>_0x5c56bd[_0x070e('0x7a')]===_0x44e465['id']);if(!_[_0x070e('0x17')](_0x4a7129)){var _0x2f704b=_[_0x070e('0x79')](_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x4a7129['description']][0x0]][_0x070e('0x6b')](/"/g,'\x27'));if(!_[_0x070e('0x17')](_0x2f704b))_0x416dde=_0x416dde+'§'+_0x2f704b;}if(_0x2c4e67=='')_0x2c4e67=_0x416dde;else _0x2c4e67+='|'+_0x416dde;}_0x26b2c0['push'](_0x44e465['id']+':'+_0x2c4e67);_0x5cadcf[_0x44e465['id']]=0x1;}}}}if(hasAdditionalPhones){_0x150bf6[_0x070e('0x19')]('\x22'+_0x26b2c0[_0x070e('0x12')](';')+'\x22');}if(_0x5591dd['length']){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],{'code':_0x070e('0x7b'),'message':_0x5591dd[_0x070e('0x12')]()});}else{fs['appendFileSync'](_0x764b06,_0x150bf6[_0x070e('0x12')]()+'\x0a');}_0x150bf6=[];}if(!(stats[_0x070e('0x68')]%0xc8)){socket[_0x070e('0x7c')](_0x070e('0x7d')+_0x2f1604,stats);stats[_0x070e('0x69')]=[];}}if(stopped){logger[_0x070e('0x54')](_0x070e('0x7e'));_0x36373d[_0x070e('0x7f')]();}}catch(_0x206b97){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],{'code':_0x070e('0x80'),'message':_0x206b97[_0x070e('0x58')]});logger[_0x070e('0x1d')]('step',_0x206b97[_0x070e('0x58')]);}},'complete':function(){try{var _0x2df184=[];var _0x392c45=tempTableName;_0x2df184[_0x070e('0x19')](_0x070e('0x81')+_0x392c45+_0x070e('0x82'));logger['info']('CIS\x20len',contactItemTypes['length']);var _0x3c9abf=util[_0x070e('0xa')](_0x070e('0x83'),_0x764b06,_0x392c45,_0x55524b,_0x498bc6[_0x070e('0x3e')],_0x498bc6['CompanyId']||null,NOW,NOW);if(_[_0x070e('0x17')](_0x1bcdc3[_0x070e('0x2c')])){_0x3c9abf+=_0x070e('0x84');}_0x2df184['push'](_0x3c9abf);BPromise[_0x070e('0x85')](_0x2df184,handleQuery)['then'](function(_0x237e3b){BPromise[_0x070e('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x2df184=[];for(var _0x59fe3e=0x0;_0x59fe3e=_0x41fccb){return _0x21a582[_0x3098('0x12')](0x193)['json']({'message':util[_0x3098('0x7')](_0x3098('0x13'),_0x58058c)});}_0x3cac7e();})['catch'](function(_0x38cca4){_0x3cac7e(_0x38cca4);});});}function isUserLimit(){return isLimit(_0x3098('0x14'),0x1,db[_0x3098('0x15')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xb5f9=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','parse','hasOwnProperty','use','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb5f9,0x162));var _0x9b5f=function(_0x1bbfa9,_0x2ef79a){_0x1bbfa9=_0x1bbfa9-0x0;var _0x3ddf12=_0xb5f9[_0x1bbfa9];return _0x3ddf12;};'use strict';var crypto=require(_0x9b5f('0x0'));var util=require('util');var compose=require(_0x9b5f('0x1'));var db=require(_0x9b5f('0x2'))['db'];var config=require(_0x9b5f('0x3'));function getValueFromLicense(_0x1b7bca,_0x53a843){if(_0x1b7bca&&_0x53a843){if(_0x53a843[_0x9b5f('0x4')]&&_0x53a843[_0x9b5f('0x5')]){var _0x495522=_0x53a843[_0x9b5f('0x4')];var _0x50f69a=_0x53a843[_0x9b5f('0x5')];var _0x3a7a9e=_0x495522[_0x9b5f('0x6')]('-')[0x4];var _0x307f67=_0x495522['split']('-')[0x0];var _0x164556=crypto[_0x9b5f('0x7')](_0x9b5f('0x8'),util[_0x9b5f('0x9')](_0x9b5f('0xa'),_0x3a7a9e,_0x495522,_0x307f67));var _0x593843=_0x164556[_0x9b5f('0xb')](_0x50f69a,'base64','utf8');_0x593843+=_0x164556['final']('utf8');var _0x3161b2=JSON[_0x9b5f('0xc')](_0x593843);return _0x3161b2[_0x9b5f('0xd')](_0x1b7bca)?_0x3161b2[_0x1b7bca]:null;}}return null;}function isLimit(_0x33ab9c,_0x1f9023,_0x3bd992,_0x41766b){var _0x41237a=_0x1f9023;return compose()[_0x9b5f('0xe')](function(_0x32b62f,_0x21eae4,_0x4d66c5){return db['License'][_0x9b5f('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x9b5f('0x10')](function(_0x1b8ca1){var _0x2246fd=getValueFromLicense(_0x33ab9c,_0x1b8ca1);return _0x2246fd?_0x2246fd:_0x41237a;})[_0x9b5f('0x10')](function(_0x2d880c){_0x41237a=_0x2d880c;return _0x3bd992[_0x9b5f('0x11')](_0x41766b);})[_0x9b5f('0x10')](function(_0x67de41){if(_0x67de41>=_0x41237a){return _0x21eae4[_0x9b5f('0x12')](0x193)['json']({'message':util[_0x9b5f('0x9')](_0x9b5f('0x13'),_0x33ab9c)});}_0x4d66c5();})[_0x9b5f('0x14')](function(_0x3d0f17){_0x4d66c5(_0x3d0f17);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x9b5f('0x15')},{'role':_0x9b5f('0x16')}]}});}exports[_0x9b5f('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9f80c74..0b6fd0c 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 _0x9e2b=['parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','filter','indexOf','push','buildExpression','DATE','operator','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','$between','start','pop','utcOffset','hours','minutes','seconds','lodash','moment'];(function(_0x48be2d,_0x53c7a2){var _0x427905=function(_0x5d32cc){while(--_0x5d32cc){_0x48be2d['push'](_0x48be2d['shift']());}};_0x427905(++_0x53c7a2);}(_0x9e2b,0xa6));var _0xb9e2=function(_0x482f2d,_0x56f3fc){_0x482f2d=_0x482f2d-0x0;var _0x4f929a=_0x9e2b[_0x482f2d];return _0x4f929a;};'use strict';var _=require(_0xb9e2('0x0'));var moment=require(_0xb9e2('0x1'));exports[_0xb9e2('0x2')]=function(_0x5d17be){var _0x6c4f7d={'conditions':[]};_0x6c4f7d[_0xb9e2('0x3')]=_['startsWith'](_0x5d17be,_0xb9e2('0x4'))?'or':_0xb9e2('0x5');var _0x41b001=_0x5d17be[_0xb9e2('0x6')](_0xb9e2('0x7'),'')[_0xb9e2('0x6')]('[$or]','')[_0xb9e2('0x8')]('||');for(var _0x4cc691=0x0;_0x4cc691<_0x41b001['length'];_0x4cc691++){var _0x2cae6e=_0x41b001[_0x4cc691][_0xb9e2('0x8')](':=');var _0x34bc68=_0x2cae6e[0x0];var _0x1ed9e8=_0x2cae6e[_0xb9e2('0x9')](0x1);_0x1ed9e8[_0xb9e2('0xa')](function(_0x2d0e51){var _0x2cc63a=_0x2d0e51[_0xb9e2('0x8')]('[')[_0xb9e2('0xb')]();var _0x3aadb0=_0x2d0e51[_0xb9e2('0xc')](/\[(.*?)\]/g);_0x3aadb0[_0xb9e2('0xa')](function(_0x4549dd){var _0x49527b=_0x4549dd[_0xb9e2('0x8')]('[')[_0xb9e2('0xd')](function(_0x48f33f){return _0x48f33f[_0xb9e2('0xe')](']')>-0x1;})['map'](function(_0x56540b){return _0x56540b[_0xb9e2('0x8')](']')[0x0];})[0x0];_0x6c4f7d['conditions'][_0xb9e2('0xf')]({'field':_0x34bc68,'operator':_0x2cc63a,'value':_0x49527b});});});}return _0x6c4f7d;};exports[_0xb9e2('0x10')]=function(_0xbff517,_0x3849cf,_0x51b253){var _0x514636={};if(_0x3849cf===_0xb9e2('0x11')){if(_0x51b253[_0xb9e2('0x12')]==='$eq'){_0x51b253[_0xb9e2('0x12')]='$between';_0x51b253[_0xb9e2('0x13')]+=','+_0x51b253[_0xb9e2('0x13')];}else if(_[_0xb9e2('0x14')]([_0xb9e2('0x15'),_0xb9e2('0x16')],_0x51b253[_0xb9e2('0x12')])){_0x51b253[_0xb9e2('0x13')]=moment(_0x51b253['value'])[_0xb9e2('0x17')](0x1,_0xb9e2('0x18'))[_0xb9e2('0x19')](_0xb9e2('0x1a'));}}if(_0x51b253[_0xb9e2('0x1b')]){_0x3849cf=_0x51b253[_0xb9e2('0x1b')];_0x514636[_0xb9e2('0x1c')]=_0xb9e2('0x1d')+_0xbff517+'.'+_0x51b253[_0xb9e2('0x1e')]+_0xb9e2('0x1f')+_0x51b253[_0xb9e2('0x1b')]+')\x20'+parseOperator(_0x51b253['operator']);}else{_0x514636[_0xb9e2('0x1c')]=_0xbff517+'.'+_0x51b253[_0xb9e2('0x1e')]+'\x20'+parseOperator(_0x51b253[_0xb9e2('0x12')]);}if(_['includes']([_0xb9e2('0x20'),_0xb9e2('0x21')],_0x51b253[_0xb9e2('0x12')]))_0x514636[_0xb9e2('0x1c')]='('+_0x514636[_0xb9e2('0x1c')]+_0xb9e2('0x22')+_0xbff517+'.'+_0x51b253[_0xb9e2('0x1e')]+_0xb9e2('0x23');_0x514636['value']=parseValue(_0x3849cf,_0x51b253[_0xb9e2('0x12')],_0x51b253[_0xb9e2('0x13')]);return _0x514636;};function parseOperator(_0x413a40){var _0x3aac2f;switch(_0x413a40){case _0xb9e2('0x24'):_0x3aac2f=_0xb9e2('0x25');break;case'$notIn':_0x3aac2f=_0xb9e2('0x26');break;case _0xb9e2('0x27'):_0x3aac2f='=\x20?';break;case _0xb9e2('0x20'):_0x3aac2f='<>\x20?';break;case _0xb9e2('0x28'):case _0xb9e2('0x29'):case _0xb9e2('0x2a'):_0x3aac2f=_0xb9e2('0x2b');break;case _0xb9e2('0x2c'):_0x3aac2f=_0xb9e2('0x2d');break;case'$gt':_0x3aac2f=_0xb9e2('0x2e');break;case _0xb9e2('0x16'):_0x3aac2f='<=\x20?';break;case _0xb9e2('0x2f'):_0x3aac2f=_0xb9e2('0x30');break;case _0xb9e2('0x31'):_0x3aac2f='BETWEEN\x20?\x20AND\x20?';break;}return _0x3aac2f;}function parseValue(_0x1d7494,_0x5d402e,_0x4d0f45){var _0xa6e598={'start':undefined,'end':undefined};switch(_0x5d402e){case _0xb9e2('0x24'):case'$notIn':_0xa6e598[_0xb9e2('0x32')]=_0x4d0f45[_0xb9e2('0x8')](',');break;case'$substring':_0xa6e598[_0xb9e2('0x32')]='%'+_0x4d0f45+'%';break;case _0xb9e2('0x29'):_0xa6e598[_0xb9e2('0x32')]=_0x4d0f45+'%';break;case'$endsWith':_0xa6e598[_0xb9e2('0x32')]='%'+_0x4d0f45;break;case'$between':var _0x16fdec=_0x4d0f45[_0xb9e2('0x8')](',');var _0x4d0f45=_0x16fdec['shift']();var _0x45573e=_0x16fdec[_0xb9e2('0x33')]();if(_0x1d7494===_0xb9e2('0x11')){_0x4d0f45=moment(_0x4d0f45)[_0xb9e2('0x34')](0x0,!![])[_0xb9e2('0x19')]();_0x45573e=moment(_0x45573e)[_0xb9e2('0x34')](0x0,!![])['add'](0x17,_0xb9e2('0x35'))['add'](0x3b,_0xb9e2('0x36'))[_0xb9e2('0x17')](0x3b,_0xb9e2('0x37'))['format']();}_0xa6e598={'start':_0x4d0f45,'end':_0x45573e};break;default:_0xa6e598[_0xb9e2('0x32')]=_0x4d0f45;break;}return _0xa6e598;} \ No newline at end of file +var _0x1785=['replace','[$and]','split','length','forEach','shift','filter','map','conditions','push','buildExpression','DATE','$eq','operator','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20IS\x20NULL)','$in','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$startsWith','start','utcOffset','format','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','and'];(function(_0x242f03,_0x422341){var _0x345203=function(_0x2eaa3c){while(--_0x2eaa3c){_0x242f03['push'](_0x242f03['shift']());}};_0x345203(++_0x422341);}(_0x1785,0x1c6));var _0x5178=function(_0x17a754,_0x5f1052){_0x17a754=_0x17a754-0x0;var _0x545d3e=_0x1785[_0x17a754];return _0x545d3e;};'use strict';var _=require('lodash');var moment=require(_0x5178('0x0'));exports[_0x5178('0x1')]=function(_0x5b350c){var _0x1e344e={'conditions':[]};_0x1e344e[_0x5178('0x2')]=_[_0x5178('0x3')](_0x5b350c,'[$or]')?'or':_0x5178('0x4');var _0x44f313=_0x5b350c[_0x5178('0x5')](_0x5178('0x6'),'')[_0x5178('0x5')]('[$or]','')[_0x5178('0x7')]('||');for(var _0x1baf7d=0x0;_0x1baf7d<_0x44f313[_0x5178('0x8')];_0x1baf7d++){var _0x3d71e1=_0x44f313[_0x1baf7d][_0x5178('0x7')](':=');var _0x42f842=_0x3d71e1[0x0];var _0x531c92=_0x3d71e1['slice'](0x1);_0x531c92[_0x5178('0x9')](function(_0x35d286){var _0xd1c182=_0x35d286[_0x5178('0x7')]('[')[_0x5178('0xa')]();var _0x1fab14=_0x35d286['match'](/\[(.*?)\]/g);_0x1fab14[_0x5178('0x9')](function(_0x482a16){var _0x531ed7=_0x482a16[_0x5178('0x7')]('[')[_0x5178('0xb')](function(_0x14b1c3){return _0x14b1c3['indexOf'](']')>-0x1;})[_0x5178('0xc')](function(_0x7afa41){return _0x7afa41['split'](']')[0x0];})[0x0];_0x1e344e[_0x5178('0xd')][_0x5178('0xe')]({'field':_0x42f842,'operator':_0xd1c182,'value':_0x531ed7});});});}return _0x1e344e;};exports[_0x5178('0xf')]=function(_0x5d41c2,_0x1f43bc,_0x392118){var _0xad2588={};if(_0x1f43bc===_0x5178('0x10')){if(_0x392118['operator']===_0x5178('0x11')){_0x392118[_0x5178('0x12')]='$between';_0x392118[_0x5178('0x13')]+=','+_0x392118[_0x5178('0x13')];}else if(_[_0x5178('0x14')]([_0x5178('0x15'),_0x5178('0x16')],_0x392118[_0x5178('0x12')])){_0x392118[_0x5178('0x13')]=moment(_0x392118[_0x5178('0x13')])[_0x5178('0x17')](0x1,_0x5178('0x18'))['format'](_0x5178('0x19'));}}if(_0x392118[_0x5178('0x1a')]){_0x1f43bc=_0x392118[_0x5178('0x1a')];_0xad2588[_0x5178('0x1b')]=_0x5178('0x1c')+_0x5d41c2+'.'+_0x392118[_0x5178('0x1d')]+'\x20AS\x20'+_0x392118[_0x5178('0x1a')]+')\x20'+parseOperator(_0x392118[_0x5178('0x12')]);}else{_0xad2588['text']=_0x5d41c2+'.'+_0x392118[_0x5178('0x1d')]+'\x20'+parseOperator(_0x392118[_0x5178('0x12')]);}if(_['includes'](['$ne','$notIn'],_0x392118[_0x5178('0x12')]))_0xad2588[_0x5178('0x1b')]='('+_0xad2588[_0x5178('0x1b')]+'\x20OR\x20'+_0x5d41c2+'.'+_0x392118[_0x5178('0x1d')]+_0x5178('0x1e');_0xad2588['value']=parseValue(_0x1f43bc,_0x392118[_0x5178('0x12')],_0x392118[_0x5178('0x13')]);return _0xad2588;};function parseOperator(_0x1947b1){var _0x16b393;switch(_0x1947b1){case _0x5178('0x1f'):_0x16b393='IN\x20?';break;case _0x5178('0x20'):_0x16b393=_0x5178('0x21');break;case _0x5178('0x11'):_0x16b393=_0x5178('0x22');break;case'$ne':_0x16b393=_0x5178('0x23');break;case _0x5178('0x24'):case'$startsWith':case _0x5178('0x25'):_0x16b393='LIKE\x20?';break;case _0x5178('0x26'):_0x16b393=_0x5178('0x27');break;case _0x5178('0x15'):_0x16b393=_0x5178('0x28');break;case'$lte':_0x16b393=_0x5178('0x29');break;case'$gte':_0x16b393=_0x5178('0x2a');break;case _0x5178('0x2b'):_0x16b393=_0x5178('0x2c');break;}return _0x16b393;}function parseValue(_0x39f789,_0x28c03d,_0xca2c46){var _0x239a85={'start':undefined,'end':undefined};switch(_0x28c03d){case _0x5178('0x1f'):case _0x5178('0x20'):_0x239a85['start']=_0xca2c46[_0x5178('0x7')](',');break;case _0x5178('0x24'):_0x239a85['start']='%'+_0xca2c46+'%';break;case _0x5178('0x2d'):_0x239a85['start']=_0xca2c46+'%';break;case'$endsWith':_0x239a85[_0x5178('0x2e')]='%'+_0xca2c46;break;case _0x5178('0x2b'):var _0x348472=_0xca2c46['split'](',');var _0xca2c46=_0x348472[_0x5178('0xa')]();var _0x1f97ce=_0x348472['pop']();if(_0x39f789===_0x5178('0x10')){_0xca2c46=moment(_0xca2c46)[_0x5178('0x2f')](0x0,!![])[_0x5178('0x30')]();_0x1f97ce=moment(_0x1f97ce)[_0x5178('0x2f')](0x0,!![])[_0x5178('0x17')](0x17,'hours')['add'](0x3b,_0x5178('0x31'))[_0x5178('0x17')](0x3b,_0x5178('0x32'))['format']();}_0x239a85={'start':_0xca2c46,'end':_0x1f97ce};break;default:_0x239a85[_0x5178('0x2e')]=_0xca2c46;break;}return _0x239a85;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6f620e8..f390879 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 _0x5b15=['format','name','uniqueid','isArray','map','priority','cast','unsigned','substr','DESC','col','ASC','isEmpty','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','lodash','moment','fields','split','filters','find','type','DATE','isPlainObject','parse','YYYY-MM-DD','utc'];(function(_0x214624,_0x4dcf4a){var _0x4b52ff=function(_0x11a688){while(--_0x11a688){_0x214624['push'](_0x214624['shift']());}};_0x4b52ff(++_0x4dcf4a);}(_0x5b15,0x1e2));var _0x55b1=function(_0x380ca8,_0x4f3b17){_0x380ca8=_0x380ca8-0x0;var _0x456f29=_0x5b15[_0x380ca8];return _0x456f29;};'use strict';var _=require(_0x55b1('0x0'));var sequelize=require('sequelize');var moment=require(_0x55b1('0x1'));var LIMIT_VALUE=0xfa;exports[_0x55b1('0x2')]=function(_0x34302f){var _0x388eef=null;if(_0x34302f){_0x388eef=_0x34302f[_0x55b1('0x3')](',');}return _0x388eef;};exports[_0x55b1('0x4')]=function(_0x59c277,_0x2993ca){var _0x4c35d4={};if(!_['isEmpty'](_0x59c277)){_['forOwn'](_0x59c277,function(_0x493889,_0x3c7ed2){try{if(_0x2993ca){var _0x4030a6=_[_0x55b1('0x5')](_0x2993ca,{'name':_0x3c7ed2})||{};if(_0x4030a6[_0x55b1('0x6')]===_0x55b1('0x7')&&_[_0x55b1('0x8')](_0x493889)){var _0x117622=JSON[_0x55b1('0x9')](_0x493889);var _0x5de89f={'$gte':moment(moment(_0x117622['$gte'])['format'](_0x55b1('0xa')))[_0x55b1('0xb')]()[_0x55b1('0xc')](),'$lte':moment(moment(_0x117622['$lte'])[_0x55b1('0xc')](_0x55b1('0xa')))[_0x55b1('0xb')]()['subtract'](0x1,'s')[_0x55b1('0xc')]()};_0x4c35d4[_0x3c7ed2]=_0x5de89f;}else if(_0x4030a6[_0x55b1('0xd')]===_0x55b1('0xe')){_0x4c35d4[_0x3c7ed2]=_0x493889;}else{_0x4c35d4[_0x3c7ed2]=_[_0x55b1('0xf')](_0x493889)?_0x493889:JSON['parse'](_0x493889);}}else{_0x4c35d4[_0x3c7ed2]=_[_0x55b1('0xf')](_0x493889)?_0x493889:JSON[_0x55b1('0x9')](_0x493889);}}catch(_0x5c13e7){_0x4c35d4[_0x3c7ed2]=_0x493889[_0x55b1('0x3')](',');}});}return _0x4c35d4;};exports['limit']=function(_0x4cef29){_0x4cef29=parseInt(_0x4cef29,0xa);if(!_0x4cef29||_0x4cef29<0x0){_0x4cef29=LIMIT_VALUE;}return _0x4cef29;};exports['offset']=function(_0x213633){_0x213633=parseInt(_0x213633,0xa);if(!_0x213633||_0x213633<0x0){_0x213633=0x0;}return _0x213633;};exports['sort']=function(_0x31d4d8){var _0x247687,_0x127293=null;if(_0x31d4d8){_0x247687=_0x31d4d8['split'](',');_0x127293=_[_0x55b1('0x10')](_0x247687,function(_0x5800ad){if(_0x5800ad['indexOf']('-')===0x0){return[_0x5800ad===_0x55b1('0x11')?sequelize[_0x55b1('0x12')](sequelize['col'](_0x55b1('0x11')),_0x55b1('0x13')):_0x5800ad[_0x55b1('0x14')](0x1),_0x55b1('0x15')];}else{return[_0x5800ad==='priority'?sequelize[_0x55b1('0x12')](sequelize[_0x55b1('0x16')](_0x55b1('0x11')),_0x55b1('0x13')):_0x5800ad,_0x55b1('0x17')];}});}return _0x127293;};exports['omit']=function(_0x18be13,_0x2717a7){if(_[_0x55b1('0x18')](_0x18be13)){return _0x18be13;}if(_[_0x55b1('0xf')](_0x18be13)){for(var _0x22b3fb=0x0;_0x22b3fb<_0x18be13['length'];_0x22b3fb+=0x1){_0x18be13[_0x22b3fb]=this[_0x55b1('0x19')](_0x18be13[_0x22b3fb],_0x2717a7);}return _0x18be13;}if(!_[_0x55b1('0x1a')](_0x18be13)){return _0x18be13;}if(_[_0x55b1('0x1b')](_0x2717a7)){_0x2717a7=[_0x2717a7];}if(!_[_0x55b1('0xf')](_0x2717a7)){return _0x18be13;}for(var _0x25430b=0x0;_0x25430b<_0x2717a7['length'];_0x25430b+=0x1){_[_0x55b1('0x1c')](_0x18be13,_0x2717a7[_0x25430b]);}for(var _0x29aa83 in _0x18be13){if(_0x18be13[_0x55b1('0x1d')](_0x29aa83)){_0x18be13[_0x29aa83]=this['omit'](_0x18be13[_0x29aa83],_0x2717a7);}}return _0x18be13;};exports[_0x55b1('0x1e')]=function(_0x520ed2){return _0x520ed2[_0x55b1('0x1f')](RegExp(_0x55b1('0x20')))?!![]:![];};exports[_0x55b1('0x21')]=function(_0x5a9be5){return _0x5a9be5['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x55b1('0x22')]=function(_0x53be28){var _0x40473e=[];_0x53be28['split'](/[ ,]+/)[_0x55b1('0x23')](function(_0x3a6221){_0x3a6221=_0x3a6221['replace'](/([^:]")"+/g,'$1');_0x3a6221='+'+_0x3a6221+'*';if(_0x3a6221['includes']('@'))_0x3a6221='\x22'+_0x3a6221+'\x22';_0x40473e[_0x55b1('0x24')](_0x3a6221);});return _0x40473e[_0x55b1('0x25')]('\x20');}; \ No newline at end of file +var _0x991f=['lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','DATE','parse','$gte','format','YYYY-MM-DD','utc','subtract','name','indexOf','cast','col','unsigned','substr','priority','omit','isArray','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','push','join'];(function(_0x56dd9d,_0x3b4f4e){var _0x1c8649=function(_0x37368d){while(--_0x37368d){_0x56dd9d['push'](_0x56dd9d['shift']());}};_0x1c8649(++_0x3b4f4e);}(_0x991f,0x168));var _0xf991=function(_0x24d0de,_0x3d94eb){_0x24d0de=_0x24d0de-0x0;var _0x27cc50=_0x991f[_0x24d0de];return _0x27cc50;};'use strict';var _=require(_0xf991('0x0'));var sequelize=require(_0xf991('0x1'));var moment=require(_0xf991('0x2'));var LIMIT_VALUE=0xfa;exports[_0xf991('0x3')]=function(_0x54b769){var _0x3cfe63=null;if(_0x54b769){_0x3cfe63=_0x54b769[_0xf991('0x4')](',');}return _0x3cfe63;};exports[_0xf991('0x5')]=function(_0xe81250,_0x248394){var _0x4817c1={};if(!_[_0xf991('0x6')](_0xe81250)){_[_0xf991('0x7')](_0xe81250,function(_0x575986,_0x2ccafb){try{if(_0x248394){var _0x3b07a=_[_0xf991('0x8')](_0x248394,{'name':_0x2ccafb})||{};if(_0x3b07a['type']===_0xf991('0x9')&&_['isPlainObject'](_0x575986)){var _0x1d12ab=JSON[_0xf991('0xa')](_0x575986);var _0x119dc0={'$gte':moment(moment(_0x1d12ab[_0xf991('0xb')])[_0xf991('0xc')](_0xf991('0xd')))[_0xf991('0xe')]()[_0xf991('0xc')](),'$lte':moment(moment(_0x1d12ab['$lte'])[_0xf991('0xc')](_0xf991('0xd')))['utc']()[_0xf991('0xf')](0x1,'s')[_0xf991('0xc')]()};_0x4817c1[_0x2ccafb]=_0x119dc0;}else if(_0x3b07a[_0xf991('0x10')]==='uniqueid'){_0x4817c1[_0x2ccafb]=_0x575986;}else{_0x4817c1[_0x2ccafb]=_['isArray'](_0x575986)?_0x575986:JSON[_0xf991('0xa')](_0x575986);}}else{_0x4817c1[_0x2ccafb]=_['isArray'](_0x575986)?_0x575986:JSON[_0xf991('0xa')](_0x575986);}}catch(_0xaecd64){_0x4817c1[_0x2ccafb]=_0x575986[_0xf991('0x4')](',');}});}return _0x4817c1;};exports['limit']=function(_0xe807b2){_0xe807b2=parseInt(_0xe807b2,0xa);if(!_0xe807b2||_0xe807b2<0x0){_0xe807b2=LIMIT_VALUE;}return _0xe807b2;};exports['offset']=function(_0x10b222){_0x10b222=parseInt(_0x10b222,0xa);if(!_0x10b222||_0x10b222<0x0){_0x10b222=0x0;}return _0x10b222;};exports['sort']=function(_0x45a973){var _0x14147f,_0x5db9c5=null;if(_0x45a973){_0x14147f=_0x45a973[_0xf991('0x4')](',');_0x5db9c5=_['map'](_0x14147f,function(_0x5b52c1){if(_0x5b52c1[_0xf991('0x11')]('-')===0x0){return[_0x5b52c1==='priority'?sequelize[_0xf991('0x12')](sequelize[_0xf991('0x13')]('priority'),_0xf991('0x14')):_0x5b52c1[_0xf991('0x15')](0x1),'DESC'];}else{return[_0x5b52c1===_0xf991('0x16')?sequelize[_0xf991('0x12')](sequelize[_0xf991('0x13')](_0xf991('0x16')),_0xf991('0x14')):_0x5b52c1,'ASC'];}});}return _0x5db9c5;};exports[_0xf991('0x17')]=function(_0x392a8f,_0x4b0b05){if(_[_0xf991('0x6')](_0x392a8f)){return _0x392a8f;}if(_[_0xf991('0x18')](_0x392a8f)){for(var _0x445d7e=0x0;_0x445d7e<_0x392a8f[_0xf991('0x19')];_0x445d7e+=0x1){_0x392a8f[_0x445d7e]=this['omit'](_0x392a8f[_0x445d7e],_0x4b0b05);}return _0x392a8f;}if(!_[_0xf991('0x1a')](_0x392a8f)){return _0x392a8f;}if(_[_0xf991('0x1b')](_0x4b0b05)){_0x4b0b05=[_0x4b0b05];}if(!_[_0xf991('0x18')](_0x4b0b05)){return _0x392a8f;}for(var _0x22008b=0x0;_0x22008b<_0x4b0b05[_0xf991('0x19')];_0x22008b+=0x1){_[_0xf991('0x1c')](_0x392a8f,_0x4b0b05[_0x22008b]);}for(var _0x5ab748 in _0x392a8f){if(_0x392a8f[_0xf991('0x1d')](_0x5ab748)){_0x392a8f[_0x5ab748]=this[_0xf991('0x17')](_0x392a8f[_0x5ab748],_0x4b0b05);}}return _0x392a8f;};exports[_0xf991('0x1e')]=function(_0x26c868){return _0x26c868[_0xf991('0x1f')](RegExp(_0xf991('0x20')))?!![]:![];};exports[_0xf991('0x21')]=function(_0x31a86f){return _0x31a86f['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xf991('0x22')]=function(_0x4fbb07){var _0x5dd68d=[];_0x4fbb07[_0xf991('0x4')](/[ ,]+/)[_0xf991('0x23')](function(_0x570c42){_0x570c42=_0x570c42[_0xf991('0x24')](/([^:]")"+/g,'$1');_0x570c42='+'+_0x570c42+'*';if(_0x570c42[_0xf991('0x25')]('@'))_0x570c42='\x22'+_0x570c42+'\x22';_0x5dd68d[_0xf991('0x26')](_0x570c42);});return _0x5dd68d[_0xf991('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 3a2a351..61a2a65 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe42a=['set','appPath','join','development','test','root','use','static','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','path','moment','../mysqldb','get','env','production'];(function(_0x340423,_0xc67494){var _0x12a33f=function(_0x263599){while(--_0x263599){_0x340423['push'](_0x340423['shift']());}};_0x12a33f(++_0xc67494);}(_0xe42a,0x15d));var _0xae42=function(_0x79e8a8,_0xbcbcf5){_0x79e8a8=_0x79e8a8-0x0;var _0x405b73=_0xe42a[_0x79e8a8];return _0x405b73;};'use strict';var express=require(_0xae42('0x0'));var favicon=require(_0xae42('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0xae42('0x2'));var cookieParser=require(_0xae42('0x3'));var errorHandler=require(_0xae42('0x4'));var path=require(_0xae42('0x5'));var passport=require('passport');var cors=require('cors');var moment=require(_0xae42('0x6'));var config=require('./environment');var db=require(_0xae42('0x7'))['db'];exports['default']=function(_0x407727){var _0x434ccc=_0x407727[_0xae42('0x8')](_0xae42('0x9'));if(_0x434ccc===_0xae42('0xa')){_0x407727[_0xae42('0xb')](_0xae42('0xc'),path[_0xae42('0xd')](config['root'],'public'));}if(_0x434ccc===_0xae42('0xe')||_0x434ccc===_0xae42('0xf')){_0x407727['set']('appPath',path['join'](config[_0xae42('0x10')],'client'));_0x407727[_0xae42('0x11')](errorHandler());}_0x407727[_0xae42('0xb')]('json\x20replacer',function(_0x3042be,_0x4db9b3){if(this[_0x3042be]instanceof Date){_0x4db9b3=this[_0x3042be]['toISOString']()['split']('.')[0x0]+'Z';}return _0x4db9b3;});_0x407727['use'](express[_0xae42('0x12')](_0x407727[_0xae42('0x8')]('appPath')));_0x407727[_0xae42('0xb')](_0xae42('0x13'),config[_0xae42('0x10')]+_0xae42('0x14'));_0x407727[_0xae42('0x15')](_0xae42('0x16'),require(_0xae42('0x17'))[_0xae42('0x18')]);_0x407727[_0xae42('0xb')](_0xae42('0x19'),'html');_0x407727[_0xae42('0x11')](bodyParser[_0xae42('0x1a')]({'limit':_0xae42('0x1b'),'extended':!![]}));_0x407727[_0xae42('0x11')](bodyParser[_0xae42('0x1c')]({'limit':_0xae42('0x1b')}));_0x407727[_0xae42('0x11')](cors());_0x407727[_0xae42('0x11')](methodOverride());_0x407727[_0xae42('0x11')](cookieParser());_0x407727[_0xae42('0x11')](passport[_0xae42('0x1d')]());}; \ No newline at end of file +var _0x3e32=['root','public','development','set','client','json\x20replacer','toISOString','split','use','get','views','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','env','production','appPath','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e32,0xe5));var _0x23e3=function(_0x344b69,_0x32d129){_0x344b69=_0x344b69-0x0;var _0x38cfed=_0x3e32[_0x344b69];return _0x38cfed;};'use strict';var express=require(_0x23e3('0x0'));var favicon=require(_0x23e3('0x1'));var bodyParser=require(_0x23e3('0x2'));var methodOverride=require(_0x23e3('0x3'));var cookieParser=require(_0x23e3('0x4'));var errorHandler=require(_0x23e3('0x5'));var path=require(_0x23e3('0x6'));var passport=require(_0x23e3('0x7'));var cors=require(_0x23e3('0x8'));var moment=require(_0x23e3('0x9'));var config=require('./environment');var db=require(_0x23e3('0xa'))['db'];exports[_0x23e3('0xb')]=function(_0x3d78f3){var _0x24e527=_0x3d78f3['get'](_0x23e3('0xc'));if(_0x24e527===_0x23e3('0xd')){_0x3d78f3['set'](_0x23e3('0xe'),path[_0x23e3('0xf')](config[_0x23e3('0x10')],_0x23e3('0x11')));}if(_0x24e527===_0x23e3('0x12')||_0x24e527==='test'){_0x3d78f3[_0x23e3('0x13')](_0x23e3('0xe'),path[_0x23e3('0xf')](config[_0x23e3('0x10')],_0x23e3('0x14')));_0x3d78f3['use'](errorHandler());}_0x3d78f3['set'](_0x23e3('0x15'),function(_0x2c3ad2,_0x3d796a){if(this[_0x2c3ad2]instanceof Date){_0x3d796a=this[_0x2c3ad2][_0x23e3('0x16')]()[_0x23e3('0x17')]('.')[0x0]+'Z';}return _0x3d796a;});_0x3d78f3[_0x23e3('0x18')](express['static'](_0x3d78f3[_0x23e3('0x19')](_0x23e3('0xe'))));_0x3d78f3[_0x23e3('0x13')](_0x23e3('0x1a'),config['root']+_0x23e3('0x1b'));_0x3d78f3[_0x23e3('0x1c')](_0x23e3('0x1d'),require(_0x23e3('0x1e'))[_0x23e3('0x1f')]);_0x3d78f3[_0x23e3('0x13')]('view\x20engine',_0x23e3('0x1d'));_0x3d78f3[_0x23e3('0x18')](bodyParser[_0x23e3('0x20')]({'limit':_0x23e3('0x21'),'extended':!![]}));_0x3d78f3['use'](bodyParser[_0x23e3('0x22')]({'limit':'50mb'}));_0x3d78f3[_0x23e3('0x18')](cors());_0x3d78f3[_0x23e3('0x18')](methodOverride());_0x3d78f3[_0x23e3('0x18')](cookieParser());_0x3d78f3[_0x23e3('0x18')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 1a64b16..25b158c 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 _0xf9fd=['join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','orderBy','length','filter','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus'];(function(_0x8bb633,_0x49a383){var _0x536bfb=function(_0x520db4){while(--_0x520db4){_0x8bb633['push'](_0x8bb633['shift']());}};_0x536bfb(++_0x49a383);}(_0xf9fd,0x118));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdf9f('0x0'));var os=require('os');var crypto=require(_0xdf9f('0x1'));var machine=require(_0xdf9f('0x2'));var exec=require('child_process')[_0xdf9f('0x3')];var config=require(_0xdf9f('0x4'));function getInterfaces(){var _0x54c2db=[];var _0x42a5ea=os['networkInterfaces']();var _0x544f5a=_[_0xdf9f('0x5')](_['keys'](_0x42a5ea));for(var _0x2de026=0x0;_0x2de026<_0x544f5a[_0xdf9f('0x6')];_0x2de026++){var _0x482a4c=_0x42a5ea[_0x544f5a[_0x2de026]][_0xdf9f('0x7')](function(_0x2a0de2){return _0x2a0de2['family']===_0xdf9f('0x8')&&_0x2a0de2[_0xdf9f('0x9')]===![];});_0x54c2db=_0x54c2db['concat'](_0x482a4c);}return _0x54c2db;}function getFirstInterface(){var _0x135ad5=_[_0xdf9f('0xa')](getInterfaces());return{'macAddress':_0x135ad5&&_0x135ad5[_0xdf9f('0xb')]?_0x135ad5['mac']:_0xdf9f('0xc'),'ipAddress':_0x135ad5&&_0x135ad5[_0xdf9f('0xd')]?_0x135ad5[_0xdf9f('0xd')]:_0xdf9f('0xe')};}exports[_0xdf9f('0xf')]=getFirstInterface;function getCPUhash(){var _0x869706=_[_0xdf9f('0x5')](os[_0xdf9f('0x10')]()['map'](function(_0x1bc5ef){return _0x1bc5ef['model'];}))[_0xdf9f('0x11')](':');return crypto[_0xdf9f('0x12')](_0xdf9f('0x13'))[_0xdf9f('0x14')](_0x869706)[_0xdf9f('0x15')](_0xdf9f('0x16'));}exports[_0xdf9f('0x17')]=function(){var _0x5834cb=os[_0xdf9f('0x18')]();var _0x757c0b=/[0-9a-f-]{36}/;if(config[_0xdf9f('0x19')]&&_0x757c0b[_0xdf9f('0x1a')](config['licenseToken'])){return config[_0xdf9f('0x19')];}else if(_0x5834cb==='win32'){return exec(_0xdf9f('0x1b'),{'encoding':_0xdf9f('0x1c')})[_0xdf9f('0x1d')]('\x0d\x0a','');}else{var _0x2dd244=getFirstInterface();var _0x552b3b=getCPUhash();var _0x1a7f4c=_0x552b3b+'|'+os['hostname']()+'|'+_0x2dd244[_0xdf9f('0x1e')]+'|'+_0x2dd244[_0xdf9f('0x1f')];var _0x2bdf0c=crypto[_0xdf9f('0x12')](_0xdf9f('0x13'))[_0xdf9f('0x14')](_0x1a7f4c)[_0xdf9f('0x15')]('hex');return _0x2bdf0c[_0xdf9f('0x20')](0x0,0x8)+'-'+_0x2bdf0c[_0xdf9f('0x20')](0x8,0xc)+'-'+_0x2bdf0c['substring'](0xc,0x10)+'-'+_0x2bdf0c[_0xdf9f('0x20')](0x10,0x14)+'-'+_0x2bdf0c['substring'](0x14);}}; \ No newline at end of file +var _0xedef=['bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','IPv4','internal','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','join','createHash','md5','digest','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','update','hex','substring','lodash','crypto'];(function(_0x3cfeb7,_0x145e06){var _0x205de7=function(_0x2c5c4e){while(--_0x2c5c4e){_0x3cfeb7['push'](_0x3cfeb7['shift']());}};_0x205de7(++_0x145e06);}(_0xedef,0xd6));var _0xfede=function(_0x43d175,_0x2bb5f8){_0x43d175=_0x43d175-0x0;var _0xf558ed=_0xedef[_0x43d175];return _0xf558ed;};'use strict';var _=require(_0xfede('0x0'));var os=require('os');var crypto=require(_0xfede('0x1'));var machine=require(_0xfede('0x2'));var exec=require(_0xfede('0x3'))[_0xfede('0x4')];var config=require(_0xfede('0x5'));function getInterfaces(){var _0x421dd2=[];var _0xf2f33e=os[_0xfede('0x6')]();var _0x41cdde=_[_0xfede('0x7')](_['keys'](_0xf2f33e));for(var _0x9f50b0=0x0;_0x9f50b0<_0x41cdde[_0xfede('0x8')];_0x9f50b0++){var _0x4efed9=_0xf2f33e[_0x41cdde[_0x9f50b0]][_0xfede('0x9')](function(_0x28bad1){return _0x28bad1['family']===_0xfede('0xa')&&_0x28bad1[_0xfede('0xb')]===![];});_0x421dd2=_0x421dd2['concat'](_0x4efed9);}return _0x421dd2;}function getFirstInterface(){var _0x4f1e5e=_[_0xfede('0xc')](getInterfaces());return{'macAddress':_0x4f1e5e&&_0x4f1e5e['mac']?_0x4f1e5e[_0xfede('0xd')]:_0xfede('0xe'),'ipAddress':_0x4f1e5e&&_0x4f1e5e[_0xfede('0xf')]?_0x4f1e5e[_0xfede('0xf')]:'127.0.0.1'};}exports[_0xfede('0x10')]=getFirstInterface;function getCPUhash(){var _0x36a2d3=_[_0xfede('0x7')](os[_0xfede('0x11')]()[_0xfede('0x12')](function(_0x3cf269){return _0x3cf269['model'];}))[_0xfede('0x13')](':');return crypto[_0xfede('0x14')](_0xfede('0x15'))['update'](_0x36a2d3)[_0xfede('0x16')]('hex');}exports[_0xfede('0x17')]=function(){var _0xe3b756=os[_0xfede('0x18')]();var _0x53206b=/[0-9a-f-]{36}/;if(config[_0xfede('0x19')]&&_0x53206b[_0xfede('0x1a')](config['licenseToken'])){return config[_0xfede('0x19')];}else if(_0xe3b756===_0xfede('0x1b')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xfede('0x1c')})[_0xfede('0x1d')]('\x0d\x0a','');}else{var _0x378dc8=getFirstInterface();var _0x584948=getCPUhash();var _0x2542c8=_0x584948+'|'+os[_0xfede('0x1e')]()+'|'+_0x378dc8[_0xfede('0x1f')]+'|'+_0x378dc8[_0xfede('0x20')];var _0xb12ef4=crypto[_0xfede('0x14')](_0xfede('0x15'))[_0xfede('0x21')](_0x2542c8)[_0xfede('0x16')](_0xfede('0x22'));return _0xb12ef4[_0xfede('0x23')](0x0,0x8)+'-'+_0xb12ef4['substring'](0x8,0xc)+'-'+_0xb12ef4['substring'](0xc,0x10)+'-'+_0xb12ef4[_0xfede('0x23')](0x10,0x14)+'-'+_0xb12ef4[_0xfede('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e4fecdf..0a2d324 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 _0x0cd4=['finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','get','data1','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','message'];(function(_0x7d093e,_0xf569ea){var _0x34432d=function(_0x3996f9){while(--_0x3996f9){_0x7d093e['push'](_0x7d093e['shift']());}};_0x34432d(++_0xf569ea);}(_0x0cd4,0xd4));var _0x40cd=function(_0x81d907,_0x44941d){_0x81d907=_0x81d907-0x0;var _0x359b3f=_0x0cd4[_0x81d907];return _0x359b3f;};'use strict';var util=require(_0x40cd('0x0'));var moment=require(_0x40cd('0x1'));var rp=require(_0x40cd('0x2'));var BPromise=require(_0x40cd('0x3'));var pkginfo=require(_0x40cd('0x4'))(module,_0x40cd('0x5'));var db=require(_0x40cd('0x6'))['db'];var encryptor=require(_0x40cd('0x7'));var hardware=require(_0x40cd('0x8'));var logger=require(_0x40cd('0x9'))(_0x40cd('0xa'));var HOST=_0x40cd('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x40c1b5){return new BPromise(function(_0x37d55f,_0x5cdbcc){var _0x24e897=util[_0x40cd('0xc')](_0x40cd('0xd'),HOST,_0x40c1b5,module[_0x40cd('0xe')][_0x40cd('0x5')]);if(oldToken){_0x24e897=util[_0x40cd('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x40c1b5,module['exports'][_0x40cd('0x5')],oldToken);}var _0x20df92={'uri':_0x24e897,'method':_0x40cd('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x20df92)[_0x40cd('0x10')](function(_0xf8eed2){_0x37d55f(_0xf8eed2);})['catch'](function(_0x40f0d9){_0x5cdbcc(_0x40f0d9);});});}function manageLicense(_0x3d21ea,_0x44474e){var _0x2a01e6=_0x44474e[_0x40cd('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x2a01e6[_0x40cd('0x12')]!==_0x3d21ea&&!_0x2a01e6[_0x40cd('0x13')]){oldToken=_0x2a01e6[_0x40cd('0x12')];}httpRequest(_0x3d21ea)[_0x40cd('0x10')](function(_0x702251){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x702251['active']){isOldTokenSent=![];if(!_0x2a01e6['license']&&_0x2a01e6[_0x40cd('0xa')]!=_0x702251['license']||_0x2a01e6[_0x40cd('0xa')]&&_0x2a01e6[_0x40cd('0x13')]){logger['info'](_0x40cd('0x14'));}if(_0x2a01e6['license']&&!_0x2a01e6[_0x40cd('0x13')]&&_0x2a01e6[_0x40cd('0xa')]!=_0x702251[_0x40cd('0xa')]){logger['info'](_0x40cd('0x15'));}if(_0x2a01e6[_0x40cd('0xa')]&&!_0x2a01e6[_0x40cd('0x13')]&&_0x2a01e6[_0x40cd('0xa')]==_0x702251[_0x40cd('0xa')]){return _0x44474e;}return _0x44474e[_0x40cd('0x16')]({'data1':_0x3d21ea,'data2':null,'license':_0x702251[_0x40cd('0xa')]});}else{if(_0x702251['license']||_0x2a01e6[_0x40cd('0xa')]){if(!_0x2a01e6[_0x40cd('0x13')]){if(_0x2a01e6[_0x40cd('0x12')]==_0x3d21ea){GRAY_PERIOD_REASON=_0x40cd('0x17');logger[_0x40cd('0x18')](_0x40cd('0x19'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x40cd('0x18')](_0x40cd('0x1a'),_0x2a01e6[_0x40cd('0x12')],_0x3d21ea);}logger[_0x40cd('0x18')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x40cd('0x1b')](),moment()[_0x40cd('0xc')](_0x40cd('0x1c')));return _0x44474e[_0x40cd('0x16')]({'data2':encryptor['encryptString'](moment()[_0x40cd('0xc')](_0x40cd('0x1c')))});}else{if(moment()[_0x40cd('0x1d')](encryptor[_0x40cd('0x1e')](_0x2a01e6['data2']),'days')>DAYS){logger[_0x40cd('0x18')](_0x40cd('0x1f'),moment()[_0x40cd('0xc')](_0x40cd('0x1c')));isOldTokenSent=![];return _0x44474e[_0x40cd('0x16')]({'data1':_0x3d21ea,'data2':null,'license':null});}}}else{if(_0x2a01e6[_0x40cd('0x12')]!=_0x3d21ea){logger[_0x40cd('0x18')](_0x40cd('0x1a'),_0x2a01e6[_0x40cd('0x12')],_0x3d21ea);return _0x44474e['update']({'data1':_0x3d21ea,'data2':null,'license':null});}}}return _0x44474e;})[_0x40cd('0x10')](function(_0x2eb564){_0x44474e=_0x2eb564;})[_0x40cd('0x20')](function(_0x1d0254){logger['error'](_0x1d0254[_0x40cd('0x21')]);})[_0x40cd('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x40cd('0x23')](),_0x44474e);},TIME);});}function defaultLicense(){var _0x43c43d=hardware['getUuid']();if(_0x43c43d){return db[_0x40cd('0x24')][_0x40cd('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x43c43d}})[_0x40cd('0x26')](function(_0x12549e,_0x1a24fa){logger[_0x40cd('0x18')](_0x40cd('0x27'),_0x43c43d);manageLicense(_0x43c43d,_0x12549e);})[_0x40cd('0x20')](function(_0x484faa){logger[_0x40cd('0x28')](_0x484faa['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xb21f=['DEMO\x20START\x20AT\x20%s','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','GET','then','catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','encryptString','decryptString','days'];(function(_0x4fee28,_0x18a041){var _0x37e10b=function(_0x36bc2e){while(--_0x36bc2e){_0x4fee28['push'](_0x4fee28['shift']());}};_0x37e10b(++_0x18a041);}(_0xb21f,0x7d));var _0xfb21=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0xb21f[_0x40ebff];return _0x40122a;};'use strict';var util=require(_0xfb21('0x0'));var moment=require(_0xfb21('0x1'));var rp=require(_0xfb21('0x2'));var BPromise=require(_0xfb21('0x3'));var pkginfo=require(_0xfb21('0x4'))(module,_0xfb21('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xfb21('0x6'));var hardware=require(_0xfb21('0x7'));var logger=require(_0xfb21('0x8'))(_0xfb21('0x9'));var HOST=_0xfb21('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5b94f1){return new BPromise(function(_0x411f4f,_0x199ef7){var _0x5684bc=util[_0xfb21('0xb')](_0xfb21('0xc'),HOST,_0x5b94f1,module['exports'][_0xfb21('0x5')]);if(oldToken){_0x5684bc=util[_0xfb21('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x5b94f1,module['exports'][_0xfb21('0x5')],oldToken);}var _0x247b68={'uri':_0x5684bc,'method':_0xfb21('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x247b68)[_0xfb21('0xe')](function(_0x23ba58){_0x411f4f(_0x23ba58);})[_0xfb21('0xf')](function(_0x43511a){_0x199ef7(_0x43511a);});});}function manageLicense(_0x4e7be8,_0x1f5831){var _0xcddec0=_0x1f5831[_0xfb21('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0xcddec0['data1']!==_0x4e7be8&&!_0xcddec0['data2']){oldToken=_0xcddec0[_0xfb21('0x11')];}httpRequest(_0x4e7be8)[_0xfb21('0xe')](function(_0x75dcc){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x75dcc['active']){isOldTokenSent=![];if(!_0xcddec0[_0xfb21('0x9')]&&_0xcddec0['license']!=_0x75dcc[_0xfb21('0x9')]||_0xcddec0[_0xfb21('0x9')]&&_0xcddec0[_0xfb21('0x12')]){logger[_0xfb21('0x13')](_0xfb21('0x14'));}if(_0xcddec0[_0xfb21('0x9')]&&!_0xcddec0['data2']&&_0xcddec0['license']!=_0x75dcc[_0xfb21('0x9')]){logger['info'](_0xfb21('0x15'));}if(_0xcddec0[_0xfb21('0x9')]&&!_0xcddec0[_0xfb21('0x12')]&&_0xcddec0['license']==_0x75dcc[_0xfb21('0x9')]){return _0x1f5831;}return _0x1f5831['update']({'data1':_0x4e7be8,'data2':null,'license':_0x75dcc[_0xfb21('0x9')]});}else{if(_0x75dcc[_0xfb21('0x9')]||_0xcddec0[_0xfb21('0x9')]){if(!_0xcddec0['data2']){if(_0xcddec0[_0xfb21('0x11')]==_0x4e7be8){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xfb21('0x16'));}else{GRAY_PERIOD_REASON=_0xfb21('0x17');logger['info'](_0xfb21('0x18'),_0xcddec0[_0xfb21('0x11')],_0x4e7be8);}logger[_0xfb21('0x13')](_0xfb21('0x19'),GRAY_PERIOD_REASON[_0xfb21('0x1a')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x1f5831[_0xfb21('0x1b')]({'data2':encryptor[_0xfb21('0x1c')](moment()[_0xfb21('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xfb21('0x1d')](_0xcddec0[_0xfb21('0x12')]),_0xfb21('0x1e'))>DAYS){logger['info'](_0xfb21('0x1f'),moment()[_0xfb21('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x1f5831[_0xfb21('0x1b')]({'data1':_0x4e7be8,'data2':null,'license':null});}}}else{if(_0xcddec0[_0xfb21('0x11')]!=_0x4e7be8){logger['info'](_0xfb21('0x18'),_0xcddec0['data1'],_0x4e7be8);return _0x1f5831[_0xfb21('0x1b')]({'data1':_0x4e7be8,'data2':null,'license':null});}}}return _0x1f5831;})[_0xfb21('0xe')](function(_0x265843){_0x1f5831=_0x265843;})[_0xfb21('0xf')](function(_0x5b37cb){logger['error'](_0x5b37cb[_0xfb21('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xfb21('0x21')](),_0x1f5831);},TIME);});}function defaultLicense(){var _0x300e5d=hardware[_0xfb21('0x21')]();if(_0x300e5d){return db['License'][_0xfb21('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x300e5d}})[_0xfb21('0x23')](function(_0x95688d,_0x43067e){logger['info'](_0xfb21('0x24'),_0x300e5d);manageLicense(_0x300e5d,_0x95688d);})['catch'](function(_0x10a555){logger[_0xfb21('0x25')](_0x10a555[_0xfb21('0x20')]);});}}exports[_0xfb21('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 808eaf8..cb9237f 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 _0x4b24=['defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','machineUuid','getUuid','gray','deadline','add','days','grayReason','changed','message','findAll','sequelize','col','role','count','admin','telephone','users','telephones','forEach','user','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','Breaking\x20license','License'];(function(_0xe4c712,_0x1e26d5){var _0x101962=function(_0x1bfc5a){while(--_0x1bfc5a){_0xe4c712['push'](_0xe4c712['shift']());}};_0x101962(++_0x1e26d5);}(_0x4b24,0x7d));var _0x44b2=function(_0x3f5bf8,_0x5514d2){_0x3f5bf8=_0x3f5bf8-0x0;var _0x2a912f=_0x4b24[_0x3f5bf8];return _0x2a912f;};'use strict';var util=require(_0x44b2('0x0'));var _=require(_0x44b2('0x1'));var moment=require(_0x44b2('0x2'));var BPromise=require(_0x44b2('0x3'));var hardware=require('./hardware');var encryptor=require(_0x44b2('0x4'));var db=require(_0x44b2('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x44b2('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x44b2('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x44b2('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x17695e){return new BPromise(function(_0x30f770,_0x1efcf5){return db[_0x44b2('0x9')]['find'](_[_0x44b2('0xa')](_0x17695e,{'raw':!![],'where':{'id':0x1}}))[_0x44b2('0xb')](function(_0x4ece5b){return checkLicense(_0x4ece5b,null);})['then'](function(_0x94b5a7){_0x30f770(_0x94b5a7);return;})[_0x44b2('0xc')](function(_0x551e0c){_0x1efcf5(_0x551e0c);});});}function checkLicense(_0x1a1fd7,_0x2c292e){if(!_0x1a1fd7){demoLicense[_0x44b2('0xd')]=_0x1a1fd7[_0x44b2('0xe')];return demoLicense;}try{var _0x3c1b5e=_0x2c292e||_0x1a1fd7['license'];if(_[_0x44b2('0xf')](_0x3c1b5e)){throw new Error(_0x44b2('0x10'));}var _0x9090d7=_0x1a1fd7[_0x44b2('0xe')];var _0x45e74c=_0x1a1fd7[_0x44b2('0x11')];var _0x2d698a=_0x9090d7[_0x44b2('0x12')]('-')[0x4];var _0x50a610=_0x9090d7['split']('-')[0x0];var _0x763f10=encryptor[_0x44b2('0x13')](_0x3c1b5e,util[_0x44b2('0x14')]('%s:%s:%s',_0x2d698a,_0x9090d7,_0x50a610));var _0x3120ec=JSON[_0x44b2('0x15')](_0x763f10);_0x3120ec[_0x44b2('0x16')]=![];_0x3120ec[_0x44b2('0xd')]=_0x9090d7;_0x3120ec[_0x44b2('0x17')]=hardware[_0x44b2('0x18')]();if(_0x45e74c){var _0x4c095d=encryptor[_0x44b2('0x13')](_0x45e74c);_0x3120ec[_0x44b2('0x19')]=_0x4c095d;_0x3120ec[_0x44b2('0x1a')]=moment(_0x4c095d)[_0x44b2('0x1b')](0x7,_0x44b2('0x1c'))[_0x44b2('0x14')]();_0x3120ec[_0x44b2('0x1d')]=_0x3120ec['uuid']!=_0x3120ec['machineUuid']?_0x44b2('0x1e'):'disabled';}return _0x3120ec;}catch(_0x53fd86){breakingLicense[_0x44b2('0xd')]=_0x1a1fd7[_0x44b2('0xe')];breakingLicense['message']=_0x53fd86[_0x44b2('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x218a38,_0x319f04){getLicense()[_0x44b2('0xb')](function(_0x1935a8){return db['User'][_0x44b2('0x20')]({'attributes':['role',[db[_0x44b2('0x21')]['fn']('COUNT',db[_0x44b2('0x21')][_0x44b2('0x22')](_0x44b2('0x23'))),_0x44b2('0x24')]],'group':_0x44b2('0x23'),'where':{'role':{'$or':[_0x44b2('0x25'),'user',_0x44b2('0x26')]}},'raw':!![]})[_0x44b2('0xb')](function(_0x18a302){var _0x4d32dc={'user':_0x1935a8[_0x44b2('0x27')]||0x0,'telephone':_0x1935a8[_0x44b2('0x28')]||0x0};_0x18a302[_0x44b2('0x29')](function(_0x412364){var _0x314a07=_0x412364[_0x44b2('0x23')]===_0x44b2('0x25')?_0x44b2('0x2a'):_0x412364[_0x44b2('0x23')];_0x4d32dc[_0x314a07]-=_0x412364[_0x44b2('0x24')];if(_0x4d32dc[_0x314a07]<0x0)_0x4d32dc[_0x314a07]=0x0;});_0x218a38(_0x4d32dc);return;});})['catch'](function(_0x581f02){_0x319f04(_0x581f02);});});}function checkUserLimits(_0x12660a){return new BPromise(function(_0x103f72,_0x4a0b41){getLimits()[_0x44b2('0xb')](function(_0x3c2f7e){var _0x2f405e=_['pick'](_['countBy'](_0x12660a,_0x44b2('0x23')),['admin',_0x44b2('0x2a'),'telephone']);var _0x734b51=(_0x2f405e[_0x44b2('0x25')]||0x0)+(_0x2f405e[_0x44b2('0x2a')]||0x0);var _0x15f528=_0x2f405e[_0x44b2('0x26')]||0x0;if(_0x734b51>_0x3c2f7e[_0x44b2('0x2a')])return _0x4a0b41('License\x20limit\x20reached\x20for\x20users');if(_0x15f528>_0x3c2f7e['telephone'])return _0x4a0b41(_0x44b2('0x2b'));return _0x103f72();})[_0x44b2('0xc')](function(_0x2141db){_0x4a0b41(_0x2141db);});});}module[_0x44b2('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x89c9=['forEach','pick','countBy','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','decryptString','format','%s:%s:%s','parse','demo','uuid','add','days','grayReason','machineUuid','changed','disabled','User','findAll','role','COUNT','col','count','admin','user','telephone','users','telephones'];(function(_0x204a8a,_0x1f9294){var _0x4d6c52=function(_0x414ed0){while(--_0x414ed0){_0x204a8a['push'](_0x204a8a['shift']());}};_0x4d6c52(++_0x1f9294);}(_0x89c9,0xc0));var _0x989c=function(_0xcd4d8e,_0x1fc2fd){_0xcd4d8e=_0xcd4d8e-0x0;var _0x1c3c61=_0x89c9[_0xcd4d8e];return _0x1c3c61;};'use strict';var util=require(_0x989c('0x0'));var _=require(_0x989c('0x1'));var moment=require(_0x989c('0x2'));var BPromise=require(_0x989c('0x3'));var hardware=require(_0x989c('0x4'));var encryptor=require(_0x989c('0x5'));var db=require(_0x989c('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x989c('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x989c('0x8'),'machineUuid':hardware[_0x989c('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x989c('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x989c('0xa'),'machineUuid':hardware[_0x989c('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x30c973){return new BPromise(function(_0x28f42d,_0x34b89e){return db[_0x989c('0xb')]['find'](_[_0x989c('0xc')](_0x30c973,{'raw':!![],'where':{'id':0x1}}))[_0x989c('0xd')](function(_0xf8c1b0){return checkLicense(_0xf8c1b0,null);})['then'](function(_0x1922ae){_0x28f42d(_0x1922ae);return;})[_0x989c('0xe')](function(_0x209545){_0x34b89e(_0x209545);});});}function checkLicense(_0x3791f1,_0x46363c){if(!_0x3791f1){demoLicense['uuid']=_0x3791f1['data1'];return demoLicense;}try{var _0x24ccff=_0x46363c||_0x3791f1[_0x989c('0xf')];if(_[_0x989c('0x10')](_0x24ccff)){throw new Error(_0x989c('0x11'));}var _0x398fb7=_0x3791f1[_0x989c('0x12')];var _0x3ef099=_0x3791f1['data2'];var _0x31e58b=_0x398fb7[_0x989c('0x13')]('-')[0x4];var _0x55f657=_0x398fb7[_0x989c('0x13')]('-')[0x0];var _0x295db7=encryptor[_0x989c('0x14')](_0x24ccff,util[_0x989c('0x15')](_0x989c('0x16'),_0x31e58b,_0x398fb7,_0x55f657));var _0x462f03=JSON[_0x989c('0x17')](_0x295db7);_0x462f03[_0x989c('0x18')]=![];_0x462f03[_0x989c('0x19')]=_0x398fb7;_0x462f03['machineUuid']=hardware[_0x989c('0x9')]();if(_0x3ef099){var _0x9e4a19=encryptor[_0x989c('0x14')](_0x3ef099);_0x462f03['gray']=_0x9e4a19;_0x462f03['deadline']=moment(_0x9e4a19)[_0x989c('0x1a')](0x7,_0x989c('0x1b'))['format']();_0x462f03[_0x989c('0x1c')]=_0x462f03[_0x989c('0x19')]!=_0x462f03[_0x989c('0x1d')]?_0x989c('0x1e'):_0x989c('0x1f');}return _0x462f03;}catch(_0x3a40d5){breakingLicense['uuid']=_0x3791f1[_0x989c('0x12')];breakingLicense['message']=_0x3a40d5['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xa4088d,_0x34b20e){getLicense()[_0x989c('0xd')](function(_0x18f8f6){return db[_0x989c('0x20')][_0x989c('0x21')]({'attributes':[_0x989c('0x22'),[db['sequelize']['fn'](_0x989c('0x23'),db['sequelize'][_0x989c('0x24')](_0x989c('0x22'))),_0x989c('0x25')]],'group':_0x989c('0x22'),'where':{'role':{'$or':[_0x989c('0x26'),_0x989c('0x27'),_0x989c('0x28')]}},'raw':!![]})[_0x989c('0xd')](function(_0x530218){var _0x118a3b={'user':_0x18f8f6[_0x989c('0x29')]||0x0,'telephone':_0x18f8f6[_0x989c('0x2a')]||0x0};_0x530218[_0x989c('0x2b')](function(_0x28d1f1){var _0x5b2732=_0x28d1f1[_0x989c('0x22')]===_0x989c('0x26')?_0x989c('0x27'):_0x28d1f1[_0x989c('0x22')];_0x118a3b[_0x5b2732]-=_0x28d1f1[_0x989c('0x25')];if(_0x118a3b[_0x5b2732]<0x0)_0x118a3b[_0x5b2732]=0x0;});_0xa4088d(_0x118a3b);return;});})[_0x989c('0xe')](function(_0x561c2e){_0x34b20e(_0x561c2e);});});}function checkUserLimits(_0x3a7e5a){return new BPromise(function(_0xd32e4a,_0x414289){getLimits()[_0x989c('0xd')](function(_0x4e0ba9){var _0x466268=_[_0x989c('0x2c')](_[_0x989c('0x2d')](_0x3a7e5a,_0x989c('0x22')),[_0x989c('0x26'),_0x989c('0x27'),_0x989c('0x28')]);var _0x5be74d=(_0x466268[_0x989c('0x26')]||0x0)+(_0x466268[_0x989c('0x27')]||0x0);var _0x4feb9c=_0x466268['telephone']||0x0;if(_0x5be74d>_0x4e0ba9[_0x989c('0x27')])return _0x414289('License\x20limit\x20reached\x20for\x20users');if(_0x4feb9c>_0x4e0ba9[_0x989c('0x28')])return _0x414289('License\x20limit\x20reached\x20for\x20telephones');return _0xd32e4a();})[_0x989c('0xe')](function(_0x45edd4){_0x414289(_0x45edd4);});});}module[_0x989c('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index e454a50..7b3754f 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 _0x7269=['myappanuglar-secret','exports','http://localhost:9000'];(function(_0xd9fc62,_0x338164){var _0x5cb280=function(_0x1a2b28){while(--_0x1a2b28){_0xd9fc62['push'](_0xd9fc62['shift']());}};_0x5cb280(++_0x338164);}(_0x7269,0x76));var _0x9726=function(_0xe150c,_0x3d0e26){_0xe150c=_0xe150c-0x0;var _0x403e98=_0x7269[_0xe150c];return _0x403e98;};'use strict';module[_0x9726('0x0')]={'DOMAIN':_0x9726('0x1'),'SESSION_SECRET':_0x9726('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x6146=['app-id','secret','exports','myappanuglar-secret'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x6146,0xba));var _0x6614=function(_0x265dd7,_0x1ff594){_0x265dd7=_0x265dd7-0x0;var _0x51a70a=_0x6146[_0x265dd7];return _0x51a70a;};'use strict';module[_0x6614('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x6614('0x1'),'GOOGLE_ID':_0x6614('0x2'),'GOOGLE_SECRET':_0x6614('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e12ec63..14b65f4 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x334d=['moment','winston','util','path','INFO','join','log','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console'];(function(_0x2f559a,_0x2ac955){var _0x228437=function(_0x22a5a2){while(--_0x22a5a2){_0x2f559a['push'](_0x2f559a['shift']());}};_0x228437(++_0x2ac955);}(_0x334d,0x1a9));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xd334('0x0'));var winston=require(_0xd334('0x1'));var util=require(_0xd334('0x2'));var path=require(_0xd334('0x3'));var debugLevel=_0xd334('0x4');function filename(_0x5673ee,_0xcb81f9){return path[_0xd334('0x5')]('/var',_0xd334('0x6'),_0xd334('0x7'),util[_0xd334('0x8')](_0xd334('0x9'),_0x5673ee,_0xcb81f9));}function formatter(_0x1c7b46,_0x3a35b5){_0x3a35b5[_0xd334('0xa')]=_0x3a35b5['message'][_0xd334('0xb')](/@@{/g,'{{{')[_0xd334('0xb')](/}@@/g,_0xd334('0xc'))['replace'](/@{/g,'{{')[_0xd334('0xb')](/}@/g,'}}');return util['format'](_0xd334('0xd'),moment()[_0xd334('0x8')](_0xd334('0xe')),_0x3a35b5[_0xd334('0xf')][_0xd334('0x10')](),_0x1c7b46,_0x3a35b5['message']);}module[_0xd334('0x11')]=function(_0x2d24e7){return new winston[(_0xd334('0x12'))]({'transports':[new winston[(_0xd334('0x13'))][(_0xd334('0x14'))]({'name':util[_0xd334('0x8')](_0xd334('0x15'),_0x2d24e7,_0xd334('0x16')),'filename':filename(_0x2d24e7,'error'),'level':_0xd334('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x388a4c){return formatter(_0x2d24e7,_0x388a4c);}}),new winston[(_0xd334('0x13'))]['File']({'name':util['format'](_0xd334('0x15'),_0x2d24e7,'info'),'filename':filename(_0x2d24e7,_0xd334('0x17')),'level':_0xd334('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x56525d){return formatter(_0x2d24e7,_0x56525d);}}),new winston[(_0xd334('0x13'))][(_0xd334('0x18'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x45eb51){return formatter(_0x2d24e7,_0x45eb51);}})]});}; \ No newline at end of file +var _0x054e=['level','toUpperCase','Logger','transports','File','%s-%s','error','info','debugLevel','util','path','log','xcally','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x17c27c,_0x1072e3){var _0x583236=function(_0x304c16){while(--_0x304c16){_0x17c27c['push'](_0x17c27c['shift']());}};_0x583236(++_0x1072e3);}(_0x054e,0x139));var _0xe054=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x054e[_0x187ee1];return _0x388160;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0xe054('0x0'));var path=require(_0xe054('0x1'));var debugLevel='INFO';function filename(_0x275ae7,_0x63f5cd){return path['join']('/var',_0xe054('0x2'),_0xe054('0x3'),util['format']('%s-%s.log',_0x275ae7,_0x63f5cd));}function formatter(_0x3946d9,_0x149e1b){_0x149e1b[_0xe054('0x4')]=_0x149e1b[_0xe054('0x4')][_0xe054('0x5')](/@@{/g,_0xe054('0x6'))['replace'](/}@@/g,_0xe054('0x7'))['replace'](/@{/g,'{{')[_0xe054('0x5')](/}@/g,'}}');return util[_0xe054('0x8')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xe054('0x8')](_0xe054('0x9')),_0x149e1b[_0xe054('0xa')][_0xe054('0xb')](),_0x3946d9,_0x149e1b[_0xe054('0x4')]);}module['exports']=function(_0x1d5a11){return new winston[(_0xe054('0xc'))]({'transports':[new winston[(_0xe054('0xd'))][(_0xe054('0xe'))]({'name':util[_0xe054('0x8')](_0xe054('0xf'),_0x1d5a11,'error'),'filename':filename(_0x1d5a11,'error'),'level':_0xe054('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf0d9af){return formatter(_0x1d5a11,_0xf0d9af);}}),new winston[(_0xe054('0xd'))][(_0xe054('0xe'))]({'name':util[_0xe054('0x8')]('%s-%s',_0x1d5a11,_0xe054('0x11')),'filename':filename(_0x1d5a11,_0xe054('0x11')),'level':_0xe054('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b65f1){return formatter(_0x1d5a11,_0x5b65f1);}}),new winston[(_0xe054('0xd'))]['Console']({'level':process['env'][_0xe054('0x12')]||debugLevel,'json':![],'formatter':function(_0x531696){return formatter(_0x1d5a11,_0x531696);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f0eed0d..ba47bb5 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 _0x3dcd=['../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x38d428,_0x58a778){var _0xf5dcd5=function(_0x579daf){while(--_0x579daf){_0x38d428['push'](_0x38d428['shift']());}};_0xf5dcd5(++_0x58a778);}(_0x3dcd,0xc5));var _0xd3dc=function(_0x23129b,_0x2d13ae){_0x23129b=_0x23129b-0x0;var _0x3b2fe9=_0x3dcd[_0x23129b];return _0x3b2fe9;};'use strict';var path=require(_0xd3dc('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xd3dc('0x1')](__dirname,_0xd3dc('0x2'))},{'name':_0xd3dc('0x3'),'script':path[_0xd3dc('0x1')](__dirname,_0xd3dc('0x4'))},{'name':_0xd3dc('0x5'),'script':path['join'](__dirname,_0xd3dc('0x6'))},{'name':'email','script':path[_0xd3dc('0x1')](__dirname,_0xd3dc('0x7'))},{'name':_0xd3dc('0x8'),'script':path[_0xd3dc('0x1')](__dirname,_0xd3dc('0x9'))},{'name':_0xd3dc('0xa'),'script':path[_0xd3dc('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0xd3dc('0xb')]=config; \ No newline at end of file +var _0xcd72=['routing','../../services/routing/index.js','path','express','ami','join','agi','email'];(function(_0x3a59b1,_0x5800e3){var _0x3e6f1f=function(_0x4ad1d7){while(--_0x4ad1d7){_0x3a59b1['push'](_0x3a59b1['shift']());}};_0x3e6f1f(++_0x5800e3);}(_0xcd72,0x192));var _0x2cd7=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0xcd72[_0x378891];return _0xfbfda2;};'use strict';var path=require(_0x2cd7('0x0'));var os=require('os');var config={'apps':[{'name':_0x2cd7('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x2cd7('0x2'),'script':path[_0x2cd7('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x2cd7('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x2cd7('0x5'),'script':path[_0x2cd7('0x3')](__dirname,'../../services/email/index.js')},{'name':_0x2cd7('0x6'),'script':path[_0x2cd7('0x3')](__dirname,_0x2cd7('0x7'))},{'name':'xdr','script':path[_0x2cd7('0x3')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 0131e4f..552bc68 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 _0x76ed=['start','disconnect','stop','restart','then','list','describe','dump','saved','pm2','bluebird','connect','connected'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x76ed,0x1d0));var _0xd76e=function(_0x4aba66,_0x1d803d){_0x4aba66=_0x4aba66-0x0;var _0x3d7ebe=_0x76ed[_0x4aba66];return _0x3d7ebe;};'use strict';var pm2=require(_0xd76e('0x0'));var BPromise=require(_0xd76e('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x467bd5,_0x351dfa){return pm2[_0xd76e('0x2')](function(_0x355fc0){if(_0x355fc0){return _0x351dfa(_0x355fc0);}return _0x467bd5(_0xd76e('0x3'));});});};exports[_0xd76e('0x4')]=function(_0x485b78){return connect()['then'](function(){return new BPromise(function(_0x2e2320,_0x13c9cc){return pm2[_0xd76e('0x4')](_0x485b78,function(_0xb3682c,_0x3e4c93){if(_0xb3682c){return _0x13c9cc(_0xb3682c);}pm2[_0xd76e('0x5')]();return _0x2e2320(_0x3e4c93);});});});};exports[_0xd76e('0x6')]=function(_0x249dff){return connect()['then'](function(){return new BPromise(function(_0xe7de14,_0x35f986){return pm2[_0xd76e('0x6')](_0x249dff,function(_0x2037d7,_0x5df681){if(_0x2037d7){return _0x35f986(_0x2037d7);}pm2[_0xd76e('0x5')]();return _0xe7de14(_0x5df681);});});});};exports[_0xd76e('0x7')]=function(_0x4e0193){return connect()[_0xd76e('0x8')](function(){return new BPromise(function(_0x807b29,_0x7aba9a){return pm2['restart'](_0x4e0193,function(_0x5a173f,_0x2fc119){if(_0x5a173f){return _0x7aba9a(_0x5a173f);}pm2['disconnect']();return _0x807b29(_0x2fc119);});});});};exports['list']=function(){return connect()[_0xd76e('0x8')](function(){return new BPromise(function(_0x2ea3a1,_0x843bff){return pm2[_0xd76e('0x9')](function(_0x36013f,_0x1dbfe0){if(_0x36013f){return _0x843bff(_0x36013f);}pm2['disconnect']();return _0x2ea3a1(_0x1dbfe0);});});});};exports[_0xd76e('0xa')]=function(_0x74ad97){return connect()[_0xd76e('0x8')](function(){return new BPromise(function(_0x516292,_0xca992){return pm2['describe'](_0x74ad97,function(_0x263475,_0x54cede){if(_0x263475){return _0xca992(_0x263475);}pm2[_0xd76e('0x5')]();return _0x516292(_0x54cede);});});});};exports['delete']=function(_0x59dade){return connect()['then'](function(){return new BPromise(function(_0x210e4b,_0xcaa115){return pm2['delete'](_0x59dade,function(_0x13a9f9,_0x3a48eb){if(_0x13a9f9){return _0xcaa115(_0x13a9f9);}pm2[_0xd76e('0x5')]();return _0x210e4b(_0x3a48eb);});});});};exports['dump']=function(){return connect()[_0xd76e('0x8')](function(){return new BPromise(function(_0x355edc,_0x191c4d){return pm2[_0xd76e('0xb')](function(_0x215618){if(_0x215618){return _0x191c4d(_0x215618);}return _0x355edc(_0xd76e('0xc'));});});});}; \ No newline at end of file +var _0xe599=['list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop'];(function(_0x30efa9,_0xbda22c){var _0x1800f8=function(_0x3ba37e){while(--_0x3ba37e){_0x30efa9['push'](_0x30efa9['shift']());}};_0x1800f8(++_0xbda22c);}(_0xe599,0x1e5));var _0x9e59=function(_0x3d53c9,_0x58b560){_0x3d53c9=_0x3d53c9-0x0;var _0x220d08=_0xe599[_0x3d53c9];return _0x220d08;};'use strict';var pm2=require(_0x9e59('0x0'));var BPromise=require(_0x9e59('0x1'));var config=require(_0x9e59('0x2'));function connect(){return new BPromise(function(_0xfe3ea3,_0x250181){return pm2[_0x9e59('0x3')](function(_0x3fdc53){if(_0x3fdc53){return _0x250181(_0x3fdc53);}return _0xfe3ea3(_0x9e59('0x4'));});});};exports[_0x9e59('0x5')]=function(_0x568c08){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x36f378,_0x523089){return pm2[_0x9e59('0x5')](_0x568c08,function(_0x599400,_0x290f63){if(_0x599400){return _0x523089(_0x599400);}pm2[_0x9e59('0x7')]();return _0x36f378(_0x290f63);});});});};exports['stop']=function(_0x1c975c){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x2556e2,_0x1a6a13){return pm2[_0x9e59('0x8')](_0x1c975c,function(_0x14a5d7,_0x578fdc){if(_0x14a5d7){return _0x1a6a13(_0x14a5d7);}pm2[_0x9e59('0x7')]();return _0x2556e2(_0x578fdc);});});});};exports['restart']=function(_0x366941){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x21c404,_0x77f87e){return pm2['restart'](_0x366941,function(_0x9a4bb6,_0x126e57){if(_0x9a4bb6){return _0x77f87e(_0x9a4bb6);}pm2['disconnect']();return _0x21c404(_0x126e57);});});});};exports[_0x9e59('0x9')]=function(){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x27bf9b,_0x257a39){return pm2['list'](function(_0x3c9cba,_0xcd37b5){if(_0x3c9cba){return _0x257a39(_0x3c9cba);}pm2[_0x9e59('0x7')]();return _0x27bf9b(_0xcd37b5);});});});};exports[_0x9e59('0xa')]=function(_0x1ec55a){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x1e0f80,_0x82dffd){return pm2['describe'](_0x1ec55a,function(_0x78b8e2,_0x4bfd39){if(_0x78b8e2){return _0x82dffd(_0x78b8e2);}pm2['disconnect']();return _0x1e0f80(_0x4bfd39);});});});};exports['delete']=function(_0x29dc13){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x51e05b,_0x224bc7){return pm2[_0x9e59('0xb')](_0x29dc13,function(_0x40f315,_0xd789aa){if(_0x40f315){return _0x224bc7(_0x40f315);}pm2[_0x9e59('0x7')]();return _0x51e05b(_0xd789aa);});});});};exports[_0x9e59('0xc')]=function(){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x48fa20,_0x1ba8f9){return pm2[_0x9e59('0xc')](function(_0x52bf05){if(_0x52bf05){return _0x1ba8f9(_0x52bf05);}return _0x48fa20('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8054bba..a416c80 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 _0xa66f=['findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa66f,0x1e1));var _0xfa66=function(_0x175cbb,_0x25a77c){_0x175cbb=_0x175cbb-0x0;var _0x84fd88=_0xa66f[_0x175cbb];return _0x84fd88;};'use strict';var _=require(_0xfa66('0x0'));var moment=require(_0xfa66('0x1'));var Redis=require(_0xfa66('0x2'));var util=require(_0xfa66('0x3'));var config=require(_0xfa66('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xfa66('0x5'))(_0xfa66('0x6'));config[_0xfa66('0x7')]=_[_0xfa66('0x8')](config[_0xfa66('0x7')],{'host':_0xfa66('0x9'),'port':0x18eb});var io=require(_0xfa66('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x3dcd4c=0x0;var _0x37956b=[];return db[_0xfa66('0xb')]['find']({'raw':!![],'attributes':['id',_0xfa66('0xc')],'where':{'id':0x1}})[_0xfa66('0xd')](function(_0x8db50a){_0x3dcd4c=_0x8db50a[_0xfa66('0xc')];if(_0x3dcd4c){return db[_0xfa66('0xe')][_0xfa66('0xf')]({'raw':!![],'attributes':['id',_0xfa66('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xfa66('0x11')](_0x8db50a['chatTimeout'],_0xfa66('0x12'))}}});}else{return[];}})[_0xfa66('0xd')](function(_0x42dedd){if(_0x42dedd&&_0x42dedd[_0xfa66('0x13')]){_0x37956b=_[_0xfa66('0x14')](_0x42dedd||[],'id');logger['info'](_0xfa66('0x15'),_0x37956b[_0xfa66('0x16')]());return db[_0xfa66('0xe')][_0xfa66('0x17')]({'closeReason':_0xfa66('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x37956b}});}})['then'](function(){if(_0x37956b&&_0x37956b[_0xfa66('0x13')]){logger[_0xfa66('0x19')](_0xfa66('0x1a'),_0x37956b['join']());for(var _0x1840a5=0x0;_0x1840a5<_0x37956b[_0xfa66('0x13')];_0x1840a5++){io[_0xfa66('0x1b')](_0xfa66('0x1c'),{'id':_0x37956b[_0x1840a5],'closed':!![]});}}})[_0xfa66('0x1d')](function(_0x225dda){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x225dda?util['inspect'](_0x225dda,{'showHidden':![],'depth':null}):'');});}exports[_0xfa66('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbda4=['lastMsgAt','subtract','minutes','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','find','then','chatTimeout','ChatInteraction','findAll'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xbda4,0x69));var _0x4bda=function(_0x11aee7,_0x182443){_0x11aee7=_0x11aee7-0x0;var _0x4a9985=_0xbda4[_0x11aee7];return _0x4a9985;};'use strict';var _=require(_0x4bda('0x0'));var moment=require(_0x4bda('0x1'));var Redis=require(_0x4bda('0x2'));var util=require('util');var config=require(_0x4bda('0x3'));var db=require(_0x4bda('0x4'))['db'];var logger=require(_0x4bda('0x5'))(_0x4bda('0x6'));config[_0x4bda('0x7')]=_[_0x4bda('0x8')](config[_0x4bda('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x4bda('0x9'))(new Redis(config[_0x4bda('0x7')]));function closeInteractions(){var _0x5b530e=0x0;var _0x164370=[];return db['Setting'][_0x4bda('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x4bda('0xb')](function(_0x5a3be2){_0x5b530e=_0x5a3be2[_0x4bda('0xc')];if(_0x5b530e){return db[_0x4bda('0xd')][_0x4bda('0xe')]({'raw':!![],'attributes':['id',_0x4bda('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4bda('0x10')](_0x5a3be2[_0x4bda('0xc')],_0x4bda('0x11'))}}});}else{return[];}})[_0x4bda('0xb')](function(_0x13f4ee){if(_0x13f4ee&&_0x13f4ee['length']){_0x164370=_['map'](_0x13f4ee||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x164370[_0x4bda('0x12')]());return db[_0x4bda('0xd')][_0x4bda('0x13')]({'closeReason':_0x4bda('0x14'),'disposition':_0x4bda('0x15'),'closed':!![],'closedAt':moment()[_0x4bda('0x16')](_0x4bda('0x17'))},{'where':{'id':_0x164370}});}})[_0x4bda('0xb')](function(){if(_0x164370&&_0x164370[_0x4bda('0x18')]){logger[_0x4bda('0x19')](_0x4bda('0x1a'),_0x164370[_0x4bda('0x12')]());for(var _0x5769d0=0x0;_0x5769d0<_0x164370[_0x4bda('0x18')];_0x5769d0++){io['emit']('chatInteraction:update',{'id':_0x164370[_0x5769d0],'closed':!![]});}}})['catch'](function(_0x51116){logger['error'](_0x4bda('0x1b'),_0x51116?util[_0x4bda('0x1c')](_0x51116,{'showHidden':![],'depth':null}):'');});}exports[_0x4bda('0x1d')]=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 b40dac5..1320d03 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 _0xa716=['bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','empty\x20file,\x20email\x20not\x20sent','SendMail','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','then','jobs','map','toString','difference','intersection','length','exists','delete\x20cron','toRun','index','resolve','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','active','endAt','update','update\x20cron','stop','stop\x20cron','util','path','lodash'];(function(_0x946156,_0x4902e0){var _0x5a7488=function(_0x4ad37b){while(--_0x4ad37b){_0x946156['push'](_0x946156['shift']());}};_0x5a7488(++_0x4902e0);}(_0xa716,0x10b));var _0x6a71=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa716[_0x19950b];return _0x3c6b41;};'use strict';var fs=require('fs');var util=require(_0x6a71('0x0'));var path=require(_0x6a71('0x1'));var _=require(_0x6a71('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x6a71('0x3'));var logger=require(_0x6a71('0x4'))(_0x6a71('0x5'));var db=require(_0x6a71('0x6'))['db'];var analyticCustomReportController=require(_0x6a71('0x7'));var analyticDefaultReportController=require(_0x6a71('0x8'));var client=jayson[_0x6a71('0x9')][_0x6a71('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x57d180,_0x1b39e5){return function(){logger[_0x6a71('0xb')](_0x6a71('0xc'),_0x57d180[_0x6a71('0xd')]);var _0x2d2c68=!![];var _0x3074ea={'tls':{'rejectUnauthorized':![]}};if(_0x57d180[_0x6a71('0xe')][_0x6a71('0xf')][_0x6a71('0x10')]){_0x3074ea[_0x6a71('0x10')]=_0x57d180[_0x6a71('0xe')][_0x6a71('0xf')][_0x6a71('0x10')];}else{_0x3074ea[_0x6a71('0x11')]=_0x57d180[_0x6a71('0xe')]['Smtp'][_0x6a71('0x11')];_0x3074ea[_0x6a71('0x12')]=_0x57d180['MailAccount'][_0x6a71('0xf')][_0x6a71('0x12')];_0x3074ea['secure']=_0x57d180[_0x6a71('0xe')]['Smtp'][_0x6a71('0x13')];}if(_0x57d180[_0x6a71('0xe')][_0x6a71('0xf')][_0x6a71('0x14')]){_0x3074ea[_0x6a71('0x15')]={'user':_0x57d180[_0x6a71('0xe')][_0x6a71('0xf')][_0x6a71('0x16')],'pass':_0x57d180['MailAccount'][_0x6a71('0xf')][_0x6a71('0x17')]};}var _0x599aba={'account':_0x3074ea,'message':{'from':util[_0x6a71('0x18')]('\x22%s\x22\x20<%s>',_0x57d180[_0x6a71('0xe')][_0x6a71('0x19')],_0x57d180[_0x6a71('0xe')][_0x6a71('0xd')]||_0x57d180['MailAccount'][_0x6a71('0xf')][_0x6a71('0x16')]),'to':_0x57d180[_0x6a71('0xd')],'cc':_0x57d180['cc'],'bcc':_0x57d180[_0x6a71('0x1a')],'subject':util['format'](_0x6a71('0x1b'),_0x1b39e5['name'],_0x57d180[_0x6a71('0x1c')],_0x57d180[_0x6a71('0x1d')])}};var _0x587b09=path['join'](__dirname,_0x6a71('0x1e'));var _0x5f58b3=_0x1b39e5[_0x6a71('0x1f')];var _0x330ed2=util[_0x6a71('0x18')](_0x6a71('0x20'),path[_0x6a71('0x21')](_0x1b39e5['savename'],path[_0x6a71('0x22')](_0x1b39e5[_0x6a71('0x1f')])),_0x6a71('0x23'));var _0x455f45=path[_0x6a71('0x24')](_0x587b09,_0x5f58b3);var _0x424ce4=path[_0x6a71('0x24')](_0x587b09,_0x330ed2);if(fs[_0x6a71('0x25')](_0x455f45)){_0x1b39e5['status']=_0x6a71('0x26');_0x599aba[_0x6a71('0x27')][_0x6a71('0x28')]=[{'filename':_0x5f58b3,'path':_0x455f45}];_0x599aba['message'][_0x6a71('0x29')]=util['format'](_0x6a71('0x2a'),JSON[_0x6a71('0x2b')](_0x1b39e5,null,0x2));}else if(fs[_0x6a71('0x25')](_0x424ce4)){_0x1b39e5['status']='Sent';_0x599aba[_0x6a71('0x27')][_0x6a71('0x28')]=[{'filename':_0x330ed2,'path':_0x424ce4}];}else{_0x599aba[_0x6a71('0x27')][_0x6a71('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x57d180['sendIfEmpty']){_0x2d2c68=![];logger[_0x6a71('0xb')](_0x6a71('0x2c'));}}if(_0x2d2c68){return client['request'](_0x6a71('0x2d'),_0x599aba)['then'](function(_0x4881a5){if(_0x4881a5[_0x6a71('0x2e')]){return logger['error']('error\x20mail',JSON[_0x6a71('0x2b')](_0x4881a5));}return logger[_0x6a71('0xb')](_0x6a71('0x2f'));})[_0x6a71('0x30')](function(_0x21ab55){return logger[_0x6a71('0x2e')](_0x6a71('0x31'),JSON[_0x6a71('0x2b')](_0x21ab55));});}};}function handleError(){return function(_0x3a3896){return logger['error'](JSON['stringify'](_0x3a3896));};}function handleResult(_0x285d95){return function(_0x26c436){logger['info'](_0x6a71('0x32'),JSON['stringify'](_0x26c436));if(_0x285d95[_0x6a71('0xe')]&&_0x285d95[_0x6a71('0xe')]['Smtp']&&!_[_0x6a71('0x33')](_0x285d95[_0x6a71('0xd')])){setTimeout(handleSendEmail(_0x285d95,_0x26c436),0x3c*0x3e8);}};}function handleJob(_0x15e244){return function(){try{if(_[_0x6a71('0x33')](_0x15e244[_0x6a71('0x1c')])){return logger['info'](_0x6a71('0x34'));}if(_[_0x6a71('0x33')](_0x15e244[_0x6a71('0x1d')])){return logger[_0x6a71('0xb')](_0x6a71('0x35'));}var _0x583bee={'startDate':moment()[_0x6a71('0x36')](_0x15e244[_0x6a71('0x1c')],_0x15e244['subtractUnit'])[_0x6a71('0x18')](_0x6a71('0x37')),'endDate':moment()[_0x6a71('0x18')](_0x6a71('0x37')),'type':_0x6a71('0x38'),'output':_0x15e244[_0x6a71('0x39')],'name':_0x15e244[_0x6a71('0x19')]};if(!_['isNil'](_0x15e244[_0x6a71('0x3a')])){logger['info'](_0x6a71('0x3b'),_0x15e244[_0x6a71('0x3a')]);return analyticDefaultReportController['runReport']({'id':_0x15e244[_0x6a71('0x3a')]},_0x583bee)['then'](handleResult(_0x15e244))['catch'](handleError());}if(!_[_0x6a71('0x33')](_0x15e244[_0x6a71('0x3c')])){logger[_0x6a71('0xb')](_0x6a71('0x3d'),_0x15e244[_0x6a71('0x3c')]);return analyticCustomReportController['runReport']({'id':_0x15e244[_0x6a71('0x3c')]},_0x583bee)['then'](handleResult(_0x15e244))[_0x6a71('0x30')](handleError());}}catch(_0x4b7c55){logger[_0x6a71('0x2e')](JSON[_0x6a71('0x2b')](_0x4b7c55));}return logger[_0x6a71('0xb')](_0x6a71('0x3e'));};}function getJobs(_0x42f445){var _0x31a9={};if(_0x42f445){_0x31a9['id']=_0x42f445;}return db[_0x6a71('0x3f')]['findAll']({'where':_0x31a9,'include':[{'model':db[_0x6a71('0xe')],'attributes':['id','name',_0x6a71('0xd')],'include':[{'model':db[_0x6a71('0x40')],'as':_0x6a71('0xf')}]}]})[_0x6a71('0x41')](function(_0x462c66){var _0x30dab5=_['keys'](manager[_0x6a71('0x42')]);var _0x402ce2=_[_0x6a71('0x43')](_0x462c66,function(_0x5c60cc){return _0x5c60cc['id'][_0x6a71('0x44')]();});var _0x490046=_['keyBy'](_0x462c66,function(_0x3e5a09){return _0x3e5a09['id']['toString']();});var _0x2828e9=_0x42f445?_0x402ce2:_[_0x6a71('0x45')](_0x402ce2,_0x30dab5);var _0x4ca9c9=_[_0x6a71('0x46')](_0x402ce2,_0x30dab5);var _0x3679e9=_[_0x6a71('0x45')](_0x30dab5,_0x402ce2);var _0x2dcf24;var _0xe5ac92;for(_0x2dcf24=0x0;_0x2dcf24<_0x3679e9[_0x6a71('0x47')]&&!_0x42f445;_0x2dcf24+=0x1){_0xe5ac92=_0x3679e9[_0x2dcf24][_0x6a71('0x44')]();if(manager[_0x6a71('0x48')](_0xe5ac92)){manager['stop'](_0xe5ac92);manager['deleteJob'](_0xe5ac92);logger[_0x6a71('0xb')](_0x6a71('0x49'),_0xe5ac92);}}logger['info'](_0x6a71('0x4a'),JSON['stringify'](_0x2828e9));for(_0x2dcf24=0x0;_0x2dcf24<_0x2828e9['length'];_0x2dcf24+=0x1){_0xe5ac92=_0x2828e9[_0x2dcf24]['toString']();logger[_0x6a71('0xb')](_0x6a71('0x4b'),_0xe5ac92);if(_0x42f445){logger['info']('my\x20id',_0x42f445);logger[_0x6a71('0xb')](JSON[_0x6a71('0x2b')](_0x490046[_0xe5ac92]));BPromise[_0x6a71('0x4c')]()['then'](handleJob(_0x490046[_0xe5ac92]));logger[_0x6a71('0xb')](_0x6a71('0x4d'),_0x490046[_0xe5ac92][_0x6a71('0x19')],_0x490046[_0xe5ac92][_0x6a71('0x4e')]);}else if(_0x490046[_0xe5ac92][_0x6a71('0x4e')]&&_0x490046[_0xe5ac92]['active']&&moment()[_0x6a71('0x4f')](_0x490046[_0xe5ac92][_0x6a71('0x50')],_0x490046[_0xe5ac92]['endAt'])){manager[_0x6a71('0x51')](_0xe5ac92,_0x490046[_0xe5ac92]['cron'],handleJob(_0x490046[_0xe5ac92]));manager[_0x6a71('0x52')](_0xe5ac92);logger[_0x6a71('0xb')](_0x6a71('0x53'),_0x490046[_0xe5ac92][_0x6a71('0x19')],_0x490046[_0xe5ac92][_0x6a71('0x4e')]);}else if(manager['exists'](_0xe5ac92)){manager['stop'](_0xe5ac92);manager['deleteJob'](_0xe5ac92);logger[_0x6a71('0xb')]('stop\x20cron',_0x490046[_0xe5ac92]['name'],_0x490046[_0xe5ac92][_0x6a71('0x4e')]);}}for(_0x2dcf24=0x0,_0xe5ac92;_0x2dcf24<_0x4ca9c9['length']&&!_0x42f445;_0x2dcf24+=0x1){_0xe5ac92=_0x4ca9c9[_0x2dcf24]['toString']();if(manager[_0x6a71('0x48')](_0xe5ac92)){if(_0x490046[_0xe5ac92][_0x6a71('0x4e')]&&_0x490046[_0xe5ac92][_0x6a71('0x54')]&&moment()[_0x6a71('0x4f')](_0x490046[_0xe5ac92][_0x6a71('0x50')],_0x490046[_0xe5ac92][_0x6a71('0x55')])){manager[_0x6a71('0x56')](_0xe5ac92,_0x490046[_0xe5ac92][_0x6a71('0x4e')],handleJob(_0x490046[_0xe5ac92]));logger[_0x6a71('0xb')](_0x6a71('0x57'),_0x490046[_0xe5ac92][_0x6a71('0x19')],_0x490046[_0xe5ac92][_0x6a71('0x4e')]);}else{manager[_0x6a71('0x58')](_0xe5ac92);manager['deleteJob'](_0xe5ac92);logger['info'](_0x6a71('0x59'),_0x490046[_0xe5ac92][_0x6a71('0x19')],_0x490046[_0xe5ac92][_0x6a71('0x4e')]);}}}})[_0x6a71('0x30')](function(_0x40d6aa){logger[_0x6a71('0x2e')](JSON[_0x6a71('0x2b')](_0x40d6aa));});}exports['run']=function(_0xa1501a){return getJobs(_0xa1501a);};exports[_0x6a71('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf666=['startAt','add','start','endAt','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','Smtp','service','host','port','auth','user','pass','format','\x22%s\x22\x20<%s>','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','Schedule','findAll','MailServerOut','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','run\x20job','cron','active','isBetween'];(function(_0x2a1274,_0x44cdbb){var _0x80212f=function(_0x5c11c3){while(--_0x5c11c3){_0x2a1274['push'](_0x2a1274['shift']());}};_0x80212f(++_0x44cdbb);}(_0xf666,0xb0));var _0x6f66=function(_0x2fc1ce,_0x250865){_0x2fc1ce=_0x2fc1ce-0x0;var _0x2cf1ab=_0xf666[_0x2fc1ce];return _0x2cf1ab;};'use strict';var fs=require('fs');var util=require(_0x6f66('0x0'));var path=require(_0x6f66('0x1'));var _=require(_0x6f66('0x2'));var moment=require(_0x6f66('0x3'));var CronJobManager=require(_0x6f66('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x6f66('0x5'));var logger=require(_0x6f66('0x6'))(_0x6f66('0x7'));var db=require(_0x6f66('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x6f66('0x9'));var client=jayson['client'][_0x6f66('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x555987,_0x1ef984){return function(){logger[_0x6f66('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x555987[_0x6f66('0xc')]);var _0x342d2a=!![];var _0x58031f={'tls':{'rejectUnauthorized':![]}};if(_0x555987[_0x6f66('0xd')][_0x6f66('0xe')][_0x6f66('0xf')]){_0x58031f[_0x6f66('0xf')]=_0x555987[_0x6f66('0xd')][_0x6f66('0xe')]['service'];}else{_0x58031f[_0x6f66('0x10')]=_0x555987[_0x6f66('0xd')][_0x6f66('0xe')][_0x6f66('0x10')];_0x58031f[_0x6f66('0x11')]=_0x555987[_0x6f66('0xd')][_0x6f66('0xe')][_0x6f66('0x11')];_0x58031f['secure']=_0x555987['MailAccount'][_0x6f66('0xe')]['secure'];}if(_0x555987[_0x6f66('0xd')][_0x6f66('0xe')]['authentication']){_0x58031f[_0x6f66('0x12')]={'user':_0x555987[_0x6f66('0xd')][_0x6f66('0xe')][_0x6f66('0x13')],'pass':_0x555987[_0x6f66('0xd')][_0x6f66('0xe')][_0x6f66('0x14')]};}var _0x583139={'account':_0x58031f,'message':{'from':util[_0x6f66('0x15')](_0x6f66('0x16'),_0x555987[_0x6f66('0xd')]['name'],_0x555987['MailAccount'][_0x6f66('0xc')]||_0x555987[_0x6f66('0xd')][_0x6f66('0xe')]['user']),'to':_0x555987[_0x6f66('0xc')],'cc':_0x555987['cc'],'bcc':_0x555987['bcc'],'subject':util[_0x6f66('0x15')](_0x6f66('0x17'),_0x1ef984[_0x6f66('0x18')],_0x555987[_0x6f66('0x19')],_0x555987['subtractUnit'])}};var _0x1773f2=path[_0x6f66('0x1a')](__dirname,'../../files/reports');var _0x46b2f1=_0x1ef984[_0x6f66('0x1b')];var _0x47a81f=util['format'](_0x6f66('0x1c'),path[_0x6f66('0x1d')](_0x1ef984[_0x6f66('0x1b')],path[_0x6f66('0x1e')](_0x1ef984['savename'])),_0x6f66('0x1f'));var _0x34df6f=path[_0x6f66('0x1a')](_0x1773f2,_0x46b2f1);var _0x305ad9=path[_0x6f66('0x1a')](_0x1773f2,_0x47a81f);if(fs[_0x6f66('0x20')](_0x34df6f)){_0x1ef984[_0x6f66('0x21')]=_0x6f66('0x22');_0x583139[_0x6f66('0x23')][_0x6f66('0x24')]=[{'filename':_0x46b2f1,'path':_0x34df6f}];_0x583139[_0x6f66('0x23')][_0x6f66('0x25')]=util[_0x6f66('0x15')](_0x6f66('0x26'),JSON[_0x6f66('0x27')](_0x1ef984,null,0x2));}else if(fs[_0x6f66('0x20')](_0x305ad9)){_0x1ef984[_0x6f66('0x21')]='Sent';_0x583139[_0x6f66('0x23')][_0x6f66('0x24')]=[{'filename':_0x47a81f,'path':_0x305ad9}];}else{_0x583139['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x555987[_0x6f66('0x28')]){_0x342d2a=![];logger[_0x6f66('0xb')](_0x6f66('0x29'));}}if(_0x342d2a){return client[_0x6f66('0x2a')]('SendMail',_0x583139)[_0x6f66('0x2b')](function(_0xebdace){if(_0xebdace[_0x6f66('0x2c')]){return logger['error']('error\x20mail',JSON[_0x6f66('0x27')](_0xebdace));}return logger[_0x6f66('0xb')]('email\x20sent');})['catch'](function(_0x3943f2){return logger[_0x6f66('0x2c')](_0x6f66('0x2d'),JSON[_0x6f66('0x27')](_0x3943f2));});}};}function handleError(){return function(_0x823ca1){return logger[_0x6f66('0x2c')](JSON['stringify'](_0x823ca1));};}function handleResult(_0x5e33f2){return function(_0x1f66fb){logger[_0x6f66('0xb')](_0x6f66('0x2e'),JSON['stringify'](_0x1f66fb));if(_0x5e33f2['MailAccount']&&_0x5e33f2[_0x6f66('0xd')][_0x6f66('0xe')]&&!_[_0x6f66('0x2f')](_0x5e33f2[_0x6f66('0xc')])){setTimeout(handleSendEmail(_0x5e33f2,_0x1f66fb),0x3c*0x3e8);}};}function handleJob(_0x52c274){return function(){try{if(_[_0x6f66('0x2f')](_0x52c274['subtractNumber'])){return logger['info'](_0x6f66('0x30'));}if(_[_0x6f66('0x2f')](_0x52c274['subtractUnit'])){return logger[_0x6f66('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5c5341={'startDate':moment()[_0x6f66('0x31')](_0x52c274[_0x6f66('0x19')],_0x52c274[_0x6f66('0x32')])['format'](_0x6f66('0x33')),'endDate':moment()[_0x6f66('0x15')](_0x6f66('0x33')),'type':_0x6f66('0x34'),'output':_0x52c274[_0x6f66('0x35')],'name':_0x52c274[_0x6f66('0x18')]};if(!_[_0x6f66('0x2f')](_0x52c274[_0x6f66('0x36')])){logger[_0x6f66('0xb')](_0x6f66('0x37'),_0x52c274[_0x6f66('0x36')]);return analyticDefaultReportController[_0x6f66('0x38')]({'id':_0x52c274[_0x6f66('0x36')]},_0x5c5341)[_0x6f66('0x2b')](handleResult(_0x52c274))['catch'](handleError());}if(!_['isNil'](_0x52c274['CustomReportId'])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x52c274['CustomReportId']);return analyticCustomReportController[_0x6f66('0x38')]({'id':_0x52c274['CustomReportId']},_0x5c5341)['then'](handleResult(_0x52c274))[_0x6f66('0x39')](handleError());}}catch(_0x11ffd0){logger[_0x6f66('0x2c')](JSON[_0x6f66('0x27')](_0x11ffd0));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x35cfad){var _0x29a52e={};if(_0x35cfad){_0x29a52e['id']=_0x35cfad;}return db[_0x6f66('0x3a')][_0x6f66('0x3b')]({'where':_0x29a52e,'include':[{'model':db[_0x6f66('0xd')],'attributes':['id',_0x6f66('0x18'),_0x6f66('0xc')],'include':[{'model':db[_0x6f66('0x3c')],'as':_0x6f66('0xe')}]}]})['then'](function(_0x5c9130){var _0x7f3b96=_['keys'](manager['jobs']);var _0x3af0e9=_[_0x6f66('0x3d')](_0x5c9130,function(_0x3a6c99){return _0x3a6c99['id'][_0x6f66('0x3e')]();});var _0x59f36b=_[_0x6f66('0x3f')](_0x5c9130,function(_0x674c1e){return _0x674c1e['id'][_0x6f66('0x3e')]();});var _0xf87e74=_0x35cfad?_0x3af0e9:_['difference'](_0x3af0e9,_0x7f3b96);var _0x295c13=_['intersection'](_0x3af0e9,_0x7f3b96);var _0x4eb363=_[_0x6f66('0x40')](_0x7f3b96,_0x3af0e9);var _0x361a41;var _0x3d846b;for(_0x361a41=0x0;_0x361a41<_0x4eb363[_0x6f66('0x41')]&&!_0x35cfad;_0x361a41+=0x1){_0x3d846b=_0x4eb363[_0x361a41]['toString']();if(manager[_0x6f66('0x42')](_0x3d846b)){manager[_0x6f66('0x43')](_0x3d846b);manager[_0x6f66('0x44')](_0x3d846b);logger[_0x6f66('0xb')](_0x6f66('0x45'),_0x3d846b);}}logger[_0x6f66('0xb')](_0x6f66('0x46'),JSON['stringify'](_0xf87e74));for(_0x361a41=0x0;_0x361a41<_0xf87e74[_0x6f66('0x41')];_0x361a41+=0x1){_0x3d846b=_0xf87e74[_0x361a41]['toString']();logger[_0x6f66('0xb')](_0x6f66('0x47'),_0x3d846b);if(_0x35cfad){logger['info']('my\x20id',_0x35cfad);logger['info'](JSON['stringify'](_0x59f36b[_0x3d846b]));BPromise['resolve']()['then'](handleJob(_0x59f36b[_0x3d846b]));logger[_0x6f66('0xb')](_0x6f66('0x48'),_0x59f36b[_0x3d846b][_0x6f66('0x18')],_0x59f36b[_0x3d846b][_0x6f66('0x49')]);}else if(_0x59f36b[_0x3d846b][_0x6f66('0x49')]&&_0x59f36b[_0x3d846b][_0x6f66('0x4a')]&&moment()[_0x6f66('0x4b')](_0x59f36b[_0x3d846b][_0x6f66('0x4c')],_0x59f36b[_0x3d846b]['endAt'])){manager[_0x6f66('0x4d')](_0x3d846b,_0x59f36b[_0x3d846b][_0x6f66('0x49')],handleJob(_0x59f36b[_0x3d846b]));manager[_0x6f66('0x4e')](_0x3d846b);logger['info']('add\x20cron',_0x59f36b[_0x3d846b][_0x6f66('0x18')],_0x59f36b[_0x3d846b]['cron']);}else if(manager['exists'](_0x3d846b)){manager[_0x6f66('0x43')](_0x3d846b);manager[_0x6f66('0x44')](_0x3d846b);logger[_0x6f66('0xb')]('stop\x20cron',_0x59f36b[_0x3d846b][_0x6f66('0x18')],_0x59f36b[_0x3d846b][_0x6f66('0x49')]);}}for(_0x361a41=0x0,_0x3d846b;_0x361a41<_0x295c13[_0x6f66('0x41')]&&!_0x35cfad;_0x361a41+=0x1){_0x3d846b=_0x295c13[_0x361a41][_0x6f66('0x3e')]();if(manager[_0x6f66('0x42')](_0x3d846b)){if(_0x59f36b[_0x3d846b]['cron']&&_0x59f36b[_0x3d846b][_0x6f66('0x4a')]&&moment()['isBetween'](_0x59f36b[_0x3d846b][_0x6f66('0x4c')],_0x59f36b[_0x3d846b][_0x6f66('0x4f')])){manager[_0x6f66('0x50')](_0x3d846b,_0x59f36b[_0x3d846b][_0x6f66('0x49')],handleJob(_0x59f36b[_0x3d846b]));logger['info'](_0x6f66('0x51'),_0x59f36b[_0x3d846b][_0x6f66('0x18')],_0x59f36b[_0x3d846b]['cron']);}else{manager['stop'](_0x3d846b);manager[_0x6f66('0x44')](_0x3d846b);logger[_0x6f66('0xb')](_0x6f66('0x52'),_0x59f36b[_0x3d846b][_0x6f66('0x18')],_0x59f36b[_0x3d846b]['cron']);}}}})[_0x6f66('0x39')](function(_0x4bfc9c){logger['error'](JSON[_0x6f66('0x27')](_0x4bfc9c));});}exports[_0x6f66('0x53')]=function(_0x1a56c5){return getJobs(_0x1a56c5);};exports[_0x6f66('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 1a1db39..6248f65 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 _0xc3e3=['COMPLETED','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','FAILED','update','resolve','tempSentiment','bucket','CloudProvider','Positive'];(function(_0x332b14,_0xef9261){var _0x17e5b8=function(_0x1d6819){while(--_0x1d6819){_0x332b14['push'](_0x332b14['shift']());}};_0x17e5b8(++_0xef9261);}(_0xc3e3,0x1ba));var _0x3c3e=function(_0x3527eb,_0x2a1ddc){_0x3527eb=_0x3527eb-0x0;var _0x449056=_0xc3e3[_0x3527eb];return _0x449056;};var _=require(_0x3c3e('0x0'));var AWS=require(_0x3c3e('0x1'));var rp=require(_0x3c3e('0x2'));var util=require(_0x3c3e('0x3'));var BPromise=require(_0x3c3e('0x4'));var db=require(_0x3c3e('0x5'))['db'];var logger=require(_0x3c3e('0x6'))(_0x3c3e('0x7'));function getTranscriptionJob(_0x259ac6,_0x337927,_0x2516cf,_0x23ce25){return new Promise(function(_0x3ebf54,_0x794bc3){var _0x3f8b7a=new AWS['TranscribeService']({'accessKeyId':_0x337927,'secretAccessKey':_0x259ac6,'region':_0x2516cf});_0x3f8b7a[_0x3c3e('0x8')]({'TranscriptionJobName':_0x23ce25},function(_0x28816d,_0x50c853){if(_0x28816d){return _0x794bc3(_0x28816d);}else{return _0x3ebf54(_0x50c853);}});});}function sentiment(_0x2d51f7,_0x5dfa3d,_0x5ae488,_0x12214e,_0x49bab3){return new Promise(function(_0x3f3fbb,_0x52b5f9){var _0x3ef330=new AWS[(_0x3c3e('0x9'))]({'accessKeyId':_0x5dfa3d,'secretAccessKey':_0x2d51f7,'region':_0x5ae488});_0x3ef330['detectSentiment']({'Text':_0x12214e,'LanguageCode':_0x49bab3[_0x3c3e('0xa')](0x0,0x2)},function(_0x1edb7f,_0x45320f){if(_0x1edb7f){return _0x52b5f9(_0x1edb7f);}else{return _0x3f3fbb(_0x45320f);}});});}function checkTranscribeJob(_0x24161a,_0x47204f,_0x862c39){var _0x40ed51;return new BPromise(function(_0x75fdb2,_0x573f43){logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0xd'),_0x24161a['id'],_0x24161a[_0x3c3e('0xe')]));return getTranscriptionJob(_0x862c39[_0x3c3e('0xf')],_0x862c39['data2'],_0x47204f[_0x3c3e('0x10')],_0x24161a['transcribeName'])['then'](function(_0x1251b6){logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x11'),_0x24161a['id'],_0x24161a[_0x3c3e('0xe')],_0x1251b6[_0x3c3e('0x12')][_0x3c3e('0x13')]));if(!_0x24161a[_0x3c3e('0x14')]){switch(_0x1251b6['TranscriptionJob'][_0x3c3e('0x13')]){case'COMPLETED':var _0x162caa={'transcribeStatus':_0x1251b6[_0x3c3e('0x12')]['TranscriptionJobStatus'],'fileUri':_0x1251b6[_0x3c3e('0x12')][_0x3c3e('0x15')][_0x3c3e('0x16')]};logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x17'),_0x24161a['id']));return rp({'uri':_0x1251b6[_0x3c3e('0x12')][_0x3c3e('0x15')][_0x3c3e('0x16')],'json':!![]})[_0x3c3e('0x18')](function(_0x5c1699){logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x19'),_0x24161a['id']));if(_0x5c1699&&_0x5c1699[_0x3c3e('0x1a')]&&_0x5c1699[_0x3c3e('0x1a')][_0x3c3e('0x1b')]&&_0x5c1699[_0x3c3e('0x1a')][_0x3c3e('0x1b')][_0x3c3e('0x1c')]){_0x162caa['fileText']='';for(var _0x1bcb4c=0x0;_0x1bcb4c<_0x5c1699['results'][_0x3c3e('0x1b')][_0x3c3e('0x1c')];_0x1bcb4c++){_0x162caa[_0x3c3e('0x14')]+=_0x5c1699[_0x3c3e('0x1a')][_0x3c3e('0x1b')][_0x1bcb4c][_0x3c3e('0x1d')]+'';}}return _0x24161a['update'](_0x162caa);})[_0x3c3e('0x18')](function(){logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x1e'),_0x24161a['id']));if(!_0x24161a['tempSentiment']){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x47204f[_0x3c3e('0x21')]||!_0x47204f['sentimentAccountId']||!_0x47204f[_0x3c3e('0x22')]||!_0x47204f['language']||!_0x47204f['bucket']){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))](_0x3c3e('0x23'));}if(!_0x162caa['fileText']){throw new Error(_0x3c3e('0x24'));}if(_0x47204f[_0x3c3e('0x25')]===_0x862c39['id']){return _0x862c39;}else{return db['CloudProvider'][_0x3c3e('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3c3e('0x18')](function(_0x5dc339){if(!_0x5dc339){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))](_0x3c3e('0x27'));}if(!_0x5dc339[_0x3c3e('0xf')]||!_0x5dc339['data2']){throw new db[(_0x3c3e('0x1f'))]['ValidationError'](_0x3c3e('0x28'));}_0x40ed51=_0x5dc339;logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x29'),_0x24161a['id']));return sentiment(_0x40ed51['data1'],_0x40ed51[_0x3c3e('0x2a')],_0x47204f[_0x3c3e('0x22')],_0x162caa[_0x3c3e('0x14')],_0x47204f[_0x3c3e('0x2b')]);})[_0x3c3e('0x18')](function(_0x2cd63e){logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x2c'),_0x24161a['id']));return _0x24161a['update']({'sentiment':_0x2cd63e[_0x3c3e('0x2d')],'sPositive':_0x2cd63e[_0x3c3e('0x2e')]['Positive'],'sNegative':_0x2cd63e[_0x3c3e('0x2e')]['Negative'],'sMixed':_0x2cd63e[_0x3c3e('0x2e')][_0x3c3e('0x2f')],'sNeutral':_0x2cd63e['SentimentScore']['Neutral']});})[_0x3c3e('0x18')](function(){logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x1e'),_0x24161a['id']));_0x75fdb2();});case _0x3c3e('0x30'):return _0x24161a[_0x3c3e('0x31')]({'transcribeStatus':_0x3c3e('0x30'),'failureReason':_0x1251b6[_0x3c3e('0x12')]['FailureReason']})['then'](function(){logger[_0x3c3e('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x24161a['id']));_0x75fdb2();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x24161a['id']));break;}}else{return BPromise[_0x3c3e('0x32')]()[_0x3c3e('0x18')](function(){if(!_0x24161a[_0x3c3e('0x33')]){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x47204f[_0x3c3e('0x21')]||!_0x47204f[_0x3c3e('0x25')]||!_0x47204f[_0x3c3e('0x22')]||!_0x47204f['language']||!_0x47204f[_0x3c3e('0x34')]){throw new db['Sequelize']['ValidationError'](_0x3c3e('0x23'));}if(!_0x24161a[_0x3c3e('0x14')]){throw new Error(_0x3c3e('0x24'));}if(_0x47204f['sentimentAccountId']===_0x862c39['id']){return _0x862c39;}else{return db[_0x3c3e('0x35')][_0x3c3e('0x26')]({'where':{'id':_settings[_0x3c3e('0x25')]}});}})[_0x3c3e('0x18')](function(_0x219cc0){if(!_0x219cc0){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))](_0x3c3e('0x27'));}if(!_0x219cc0[_0x3c3e('0xf')]||!_0x219cc0[_0x3c3e('0x2a')]){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))](_0x3c3e('0x28'));}_0x40ed51=_0x219cc0;logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x29'),_0x24161a['id']));return sentiment(_0x40ed51[_0x3c3e('0xf')],_0x40ed51[_0x3c3e('0x2a')],_0x47204f[_0x3c3e('0x22')],_0x24161a[_0x3c3e('0x14')],_0x47204f[_0x3c3e('0x2b')]);})['then'](function(_0x484f6f){logger[_0x3c3e('0xb')](util[_0x3c3e('0xc')](_0x3c3e('0x2c'),_0x24161a['id']));return _0x24161a[_0x3c3e('0x31')]({'sentiment':_0x484f6f['Sentiment'],'sPositive':_0x484f6f['SentimentScore'][_0x3c3e('0x36')],'sNegative':_0x484f6f[_0x3c3e('0x2e')]['Negative'],'sMixed':_0x484f6f[_0x3c3e('0x2e')][_0x3c3e('0x2f')],'sNeutral':_0x484f6f[_0x3c3e('0x2e')]['Neutral'],'transcribeStatus':_0x3c3e('0x37')});})[_0x3c3e('0x18')](function(){logger['info'](util[_0x3c3e('0xc')](_0x3c3e('0x1e'),_0x24161a['id']));_0x75fdb2();});}})[_0x3c3e('0x38')](function(_0x5b1bcb){if(_0x5b1bcb){if(!_0x5b1bcb[_0x3c3e('0x39')]||_0x5b1bcb[_0x3c3e('0x39')]!==_0x3c3e('0x3a')){logger[_0x3c3e('0x3b')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x24161a['id']),util[_0x3c3e('0x3c')](_0x5b1bcb,{'showHidden':![],'depth':null}));}}_0x75fdb2();});});}function checkTranscribe(){var _0x3b6800;var _0xfa658f;var _0x651cf4;return db[_0x3c3e('0x3d')][_0x3c3e('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x3c3e('0x18')](function(_0xf51d6b){if(!_0xf51d6b||!_0xf51d6b[_0x3c3e('0x1c')]){throw new db[(_0x3c3e('0x1f'))]['ValidationError'](_0x3c3e('0x3f'));}_0x3b6800=_0xf51d6b;return db[_0x3c3e('0x40')][_0x3c3e('0x26')]({'where':{'id':0x1}});})[_0x3c3e('0x18')](function(_0x3af2d4){if(!_0x3af2d4){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))](_0x3c3e('0x41'));}_0xfa658f=_0x3af2d4;if(!_0xfa658f[_0x3c3e('0x7')]||!_0xfa658f[_0x3c3e('0x42')]||!_0xfa658f[_0x3c3e('0x10')]||!_0xfa658f[_0x3c3e('0x2b')]||!_0xfa658f[_0x3c3e('0x34')]){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))](_0x3c3e('0x43'));}return db[_0x3c3e('0x35')][_0x3c3e('0x26')]({'where':{'id':_0xfa658f[_0x3c3e('0x42')]}});})[_0x3c3e('0x18')](function(_0x241967){if(!_0x241967){throw new db[(_0x3c3e('0x1f'))][(_0x3c3e('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x241967[_0x3c3e('0xf')]||!_0x241967[_0x3c3e('0x2a')]){throw new db['Sequelize'][(_0x3c3e('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x651cf4=_0x241967;var _0x55a000=[];_0x3b6800[_0x3c3e('0x44')](function(_0x2949b7){_0x55a000[_0x3c3e('0x45')](checkTranscribeJob(_0x2949b7,_0xfa658f,_0x651cf4));});return BPromise[_0x3c3e('0x46')](_0x55a000);})[_0x3c3e('0x38')](function(_0x66ec9e){if(_0x66ec9e){if(!_0x66ec9e['name']||_0x66ec9e[_0x3c3e('0x39')]!==_0x3c3e('0x3a')){logger[_0x3c3e('0x3b')](util['inspect'](_0x66ec9e,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0cee=['then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','sentiment','sentimentAccountId','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','CloudProvider','Sentiment','Positive','Neutral','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','forEach','push','all','name','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','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','TranscriptionJobStatus','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x10aebb,_0x2fd10a){var _0x1b1b8f=function(_0x1161be){while(--_0x1161be){_0x10aebb['push'](_0x10aebb['shift']());}};_0x1b1b8f(++_0x2fd10a);}(_0x0cee,0x1ed));var _0xe0ce=function(_0x3c3630,_0x197214){_0x3c3630=_0x3c3630-0x0;var _0xadb471=_0x0cee[_0x3c3630];return _0xadb471;};var _=require(_0xe0ce('0x0'));var AWS=require(_0xe0ce('0x1'));var rp=require('request-promise');var util=require(_0xe0ce('0x2'));var BPromise=require(_0xe0ce('0x3'));var db=require(_0xe0ce('0x4'))['db'];var logger=require(_0xe0ce('0x5'))(_0xe0ce('0x6'));function getTranscriptionJob(_0x4645de,_0x5611e2,_0x159e4,_0xc9b7cd){return new Promise(function(_0x1fdef8,_0x39da59){var _0x475e25=new AWS[(_0xe0ce('0x7'))]({'accessKeyId':_0x5611e2,'secretAccessKey':_0x4645de,'region':_0x159e4});_0x475e25['getTranscriptionJob']({'TranscriptionJobName':_0xc9b7cd},function(_0x5dbdf6,_0x3f6548){if(_0x5dbdf6){return _0x39da59(_0x5dbdf6);}else{return _0x1fdef8(_0x3f6548);}});});}function sentiment(_0x399a59,_0x335bd7,_0x5adbd1,_0x30e329,_0x2b7ea4){return new Promise(function(_0x4bc1f1,_0x215e1d){var _0x4718fb=new AWS[(_0xe0ce('0x8'))]({'accessKeyId':_0x335bd7,'secretAccessKey':_0x399a59,'region':_0x5adbd1});_0x4718fb[_0xe0ce('0x9')]({'Text':_0x30e329,'LanguageCode':_0x2b7ea4[_0xe0ce('0xa')](0x0,0x2)},function(_0x4ed828,_0x38033c){if(_0x4ed828){return _0x215e1d(_0x4ed828);}else{return _0x4bc1f1(_0x38033c);}});});}function checkTranscribeJob(_0x5a69b,_0x2382c1,_0xd8d3c2){var _0x1a3ae0;return new BPromise(function(_0x1f811a,_0x96026c){logger[_0xe0ce('0xb')](util['format'](_0xe0ce('0xc'),_0x5a69b['id'],_0x5a69b[_0xe0ce('0xd')]));return getTranscriptionJob(_0xd8d3c2[_0xe0ce('0xe')],_0xd8d3c2[_0xe0ce('0xf')],_0x2382c1[_0xe0ce('0x10')],_0x5a69b[_0xe0ce('0xd')])['then'](function(_0x1a5a49){logger[_0xe0ce('0xb')](util[_0xe0ce('0x11')](_0xe0ce('0x12'),_0x5a69b['id'],_0x5a69b[_0xe0ce('0xd')],_0x1a5a49['TranscriptionJob'][_0xe0ce('0x13')]));if(!_0x5a69b['fileText']){switch(_0x1a5a49['TranscriptionJob'][_0xe0ce('0x13')]){case _0xe0ce('0x14'):var _0xd2fdd={'transcribeStatus':_0x1a5a49[_0xe0ce('0x15')][_0xe0ce('0x13')],'fileUri':_0x1a5a49[_0xe0ce('0x15')][_0xe0ce('0x16')][_0xe0ce('0x17')]};logger['info'](util['format'](_0xe0ce('0x18'),_0x5a69b['id']));return rp({'uri':_0x1a5a49[_0xe0ce('0x15')][_0xe0ce('0x16')][_0xe0ce('0x17')],'json':!![]})[_0xe0ce('0x19')](function(_0x171b20){logger[_0xe0ce('0xb')](util[_0xe0ce('0x11')](_0xe0ce('0x1a'),_0x5a69b['id']));if(_0x171b20&&_0x171b20[_0xe0ce('0x1b')]&&_0x171b20[_0xe0ce('0x1b')][_0xe0ce('0x1c')]&&_0x171b20[_0xe0ce('0x1b')]['transcripts'][_0xe0ce('0x1d')]){_0xd2fdd['fileText']='';for(var _0x2acbbe=0x0;_0x2acbbe<_0x171b20[_0xe0ce('0x1b')][_0xe0ce('0x1c')][_0xe0ce('0x1d')];_0x2acbbe++){_0xd2fdd[_0xe0ce('0x1e')]+=_0x171b20['results']['transcripts'][_0x2acbbe][_0xe0ce('0x1f')]+'';}}return _0x5a69b[_0xe0ce('0x20')](_0xd2fdd);})[_0xe0ce('0x19')](function(){logger['info'](util[_0xe0ce('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5a69b['id']));if(!_0x5a69b[_0xe0ce('0x21')]){throw new db[(_0xe0ce('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2382c1[_0xe0ce('0x23')]||!_0x2382c1[_0xe0ce('0x24')]||!_0x2382c1['sentimentRegion']||!_0x2382c1[_0xe0ce('0x25')]||!_0x2382c1[_0xe0ce('0x26')]){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))](_0xe0ce('0x28'));}if(!_0xd2fdd['fileText']){throw new Error(_0xe0ce('0x29'));}if(_0x2382c1['sentimentAccountId']===_0xd8d3c2['id']){return _0xd8d3c2;}else{return db['CloudProvider'][_0xe0ce('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xe0ce('0x19')](function(_0x872313){if(!_0x872313){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))](_0xe0ce('0x2b'));}if(!_0x872313[_0xe0ce('0xe')]||!_0x872313['data2']){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))](_0xe0ce('0x2c'));}_0x1a3ae0=_0x872313;logger[_0xe0ce('0xb')](util[_0xe0ce('0x11')](_0xe0ce('0x2d'),_0x5a69b['id']));return sentiment(_0x1a3ae0[_0xe0ce('0xe')],_0x1a3ae0[_0xe0ce('0xf')],_0x2382c1[_0xe0ce('0x2e')],_0xd2fdd[_0xe0ce('0x1e')],_0x2382c1[_0xe0ce('0x25')]);})['then'](function(_0xa576ab){logger[_0xe0ce('0xb')](util['format'](_0xe0ce('0x2f'),_0x5a69b['id']));return _0x5a69b[_0xe0ce('0x20')]({'sentiment':_0xa576ab['Sentiment'],'sPositive':_0xa576ab[_0xe0ce('0x30')]['Positive'],'sNegative':_0xa576ab[_0xe0ce('0x30')][_0xe0ce('0x31')],'sMixed':_0xa576ab[_0xe0ce('0x30')][_0xe0ce('0x32')],'sNeutral':_0xa576ab['SentimentScore']['Neutral']});})[_0xe0ce('0x19')](function(){logger[_0xe0ce('0xb')](util[_0xe0ce('0x11')](_0xe0ce('0x33'),_0x5a69b['id']));_0x1f811a();});case _0xe0ce('0x34'):return _0x5a69b[_0xe0ce('0x20')]({'transcribeStatus':'FAILED','failureReason':_0x1a5a49[_0xe0ce('0x15')][_0xe0ce('0x35')]})[_0xe0ce('0x19')](function(){logger['info'](util[_0xe0ce('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5a69b['id']));_0x1f811a();});default:logger[_0xe0ce('0xb')](util['format'](_0xe0ce('0x36'),_0x5a69b['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x5a69b[_0xe0ce('0x21')]){throw new db['Sequelize'][(_0xe0ce('0x27'))](_0xe0ce('0x37'));}if(!_0x2382c1[_0xe0ce('0x23')]||!_0x2382c1[_0xe0ce('0x24')]||!_0x2382c1[_0xe0ce('0x2e')]||!_0x2382c1['language']||!_0x2382c1[_0xe0ce('0x26')]){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))](_0xe0ce('0x28'));}if(!_0x5a69b[_0xe0ce('0x1e')]){throw new Error(_0xe0ce('0x29'));}if(_0x2382c1[_0xe0ce('0x24')]===_0xd8d3c2['id']){return _0xd8d3c2;}else{return db[_0xe0ce('0x38')][_0xe0ce('0x2a')]({'where':{'id':_settings[_0xe0ce('0x24')]}});}})[_0xe0ce('0x19')](function(_0x39f1c3){if(!_0x39f1c3){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x39f1c3[_0xe0ce('0xe')]||!_0x39f1c3[_0xe0ce('0xf')]){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x1a3ae0=_0x39f1c3;logger['info'](util[_0xe0ce('0x11')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5a69b['id']));return sentiment(_0x1a3ae0['data1'],_0x1a3ae0[_0xe0ce('0xf')],_0x2382c1[_0xe0ce('0x2e')],_0x5a69b['fileText'],_0x2382c1[_0xe0ce('0x25')]);})[_0xe0ce('0x19')](function(_0x5daf88){logger[_0xe0ce('0xb')](util[_0xe0ce('0x11')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5a69b['id']));return _0x5a69b[_0xe0ce('0x20')]({'sentiment':_0x5daf88[_0xe0ce('0x39')],'sPositive':_0x5daf88[_0xe0ce('0x30')][_0xe0ce('0x3a')],'sNegative':_0x5daf88[_0xe0ce('0x30')][_0xe0ce('0x31')],'sMixed':_0x5daf88['SentimentScore'][_0xe0ce('0x32')],'sNeutral':_0x5daf88['SentimentScore'][_0xe0ce('0x3b')],'transcribeStatus':'COMPLETED'});})[_0xe0ce('0x19')](function(){logger[_0xe0ce('0xb')](util[_0xe0ce('0x11')](_0xe0ce('0x33'),_0x5a69b['id']));_0x1f811a();});}})[_0xe0ce('0x3c')](function(_0x2cb39f){if(_0x2cb39f){if(!_0x2cb39f['name']||_0x2cb39f['name']!==_0xe0ce('0x3d')){logger[_0xe0ce('0x3e')](util[_0xe0ce('0x11')](_0xe0ce('0x3f'),_0x5a69b['id']),util[_0xe0ce('0x40')](_0x2cb39f,{'showHidden':![],'depth':null}));}}_0x1f811a();});});}function checkTranscribe(){var _0x76911e;var _0x54c884;var _0x3e5f53;return db[_0xe0ce('0x41')]['findAll']({'where':{'transcribeStatus':_0xe0ce('0x42')}})[_0xe0ce('0x19')](function(_0x30c0c4){if(!_0x30c0c4||!_0x30c0c4['length']){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))]('No\x20transcribe\x20job\x20to\x20check');}_0x76911e=_0x30c0c4;return db[_0xe0ce('0x43')][_0xe0ce('0x2a')]({'where':{'id':0x1}});})['then'](function(_0x2bd261){if(!_0x2bd261){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))](_0xe0ce('0x44'));}_0x54c884=_0x2bd261;if(!_0x54c884[_0xe0ce('0x6')]||!_0x54c884['transcribeAccountId']||!_0x54c884[_0xe0ce('0x10')]||!_0x54c884[_0xe0ce('0x25')]||!_0x54c884['bucket']){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))](_0xe0ce('0x45'));}return db[_0xe0ce('0x38')]['findOne']({'where':{'id':_0x54c884['transcribeAccountId']}});})['then'](function(_0x16575f){if(!_0x16575f){throw new db[(_0xe0ce('0x22'))]['ValidationError'](_0xe0ce('0x2b'));}if(!_0x16575f[_0xe0ce('0xe')]||!_0x16575f[_0xe0ce('0xf')]){throw new db[(_0xe0ce('0x22'))][(_0xe0ce('0x27'))](_0xe0ce('0x2c'));}_0x3e5f53=_0x16575f;var _0x2339de=[];_0x76911e[_0xe0ce('0x46')](function(_0x56165c){_0x2339de[_0xe0ce('0x47')](checkTranscribeJob(_0x56165c,_0x54c884,_0x3e5f53));});return BPromise[_0xe0ce('0x48')](_0x2339de);})[_0xe0ce('0x3c')](function(_0x3cf507){if(_0x3cf507){if(!_0x3cf507[_0xe0ce('0x49')]||_0x3cf507[_0xe0ce('0x49')]!==_0xe0ce('0x3d')){logger[_0xe0ce('0x3e')](util[_0xe0ce('0x40')](_0x3cf507,{'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/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index dc1c17e..c5449d4 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fcf=['hours','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','subtract'];(function(_0x21ecf3,_0x3b4b99){var _0x3cf63a=function(_0x536c67){while(--_0x536c67){_0x21ecf3['push'](_0x21ecf3['shift']());}};_0x3cf63a(++_0x3b4b99);}(_0x7fcf,0xe0));var _0xf7fc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7fcf[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0xf7fc('0x0'));var config=require(_0xf7fc('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xf7fc('0x2'))(_0xf7fc('0x3'));config[_0xf7fc('0x4')]=_[_0xf7fc('0x5')](config[_0xf7fc('0x4')],{'host':_0xf7fc('0x6'),'port':0x18eb});var io=require(_0xf7fc('0x7'))(new Redis(config[_0xf7fc('0x4')]));function closeInteractions(){var _0x14f10f=[];return db[_0xf7fc('0x8')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf7fc('0x9')](0x18,_0xf7fc('0xa'))}}})['then'](function(_0x1053f4){if(_0x1053f4&&_0x1053f4['length']){_0x14f10f=_['map'](_0x1053f4||[],'id');logger[_0xf7fc('0xb')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x14f10f[_0xf7fc('0xc')]());return db[_0xf7fc('0x8')][_0xf7fc('0xd')]({'closeReason':_0xf7fc('0xe'),'disposition':_0xf7fc('0xf'),'closed':!![],'closedAt':moment()[_0xf7fc('0x10')](_0xf7fc('0x11'))},{'where':{'id':_0x14f10f}});}})[_0xf7fc('0x12')](function(){if(_0x14f10f&&_0x14f10f[_0xf7fc('0x13')]){logger[_0xf7fc('0xb')](_0xf7fc('0x14'),_0x14f10f['join']());for(var _0x21e054=0x0;_0x21e054<_0x14f10f['length'];_0x21e054++){io[_0xf7fc('0x15')](_0xf7fc('0x16'),{'id':_0x14f10f[_0x21e054],'closed':!![]});}}})[_0xf7fc('0x17')](function(_0x5a5639){logger['error'](_0xf7fc('0x18'),_0x5a5639?util['inspect'](_0x5a5639,{'showHidden':![],'depth':null}):'');});}exports[_0xf7fc('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbd67=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbd67,0x10f));var _0x7bd6=function(_0x19046c,_0x2494b5){_0x19046c=_0x19046c-0x0;var _0x469c79=_0xbd67[_0x19046c];return _0x469c79;};'use strict';var _=require('lodash');var moment=require(_0x7bd6('0x0'));var Redis=require('ioredis');var util=require(_0x7bd6('0x1'));var config=require('../../config/environment');var db=require(_0x7bd6('0x2'))['db'];var logger=require(_0x7bd6('0x3'))(_0x7bd6('0x4'));config['redis']=_[_0x7bd6('0x5')](config[_0x7bd6('0x6')],{'host':_0x7bd6('0x7'),'port':0x18eb});var io=require(_0x7bd6('0x8'))(new Redis(config[_0x7bd6('0x6')]));function closeInteractions(){var _0x331411=[];return db[_0x7bd6('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x7bd6('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7bd6('0xb')](0x18,_0x7bd6('0xc'))}}})[_0x7bd6('0xd')](function(_0x3004a0){if(_0x3004a0&&_0x3004a0[_0x7bd6('0xe')]){_0x331411=_['map'](_0x3004a0||[],'id');logger[_0x7bd6('0xf')](_0x7bd6('0x10'),_0x331411[_0x7bd6('0x11')]());return db['WhatsappInteraction'][_0x7bd6('0x12')]({'closeReason':'system','disposition':_0x7bd6('0x13'),'closed':!![],'closedAt':moment()[_0x7bd6('0x14')](_0x7bd6('0x15'))},{'where':{'id':_0x331411}});}})[_0x7bd6('0xd')](function(){if(_0x331411&&_0x331411['length']){logger['info'](_0x7bd6('0x16'),_0x331411[_0x7bd6('0x11')]());for(var _0x3717ab=0x0;_0x3717ab<_0x331411[_0x7bd6('0xe')];_0x3717ab++){io[_0x7bd6('0x17')](_0x7bd6('0x18'),{'id':_0x331411[_0x3717ab],'closed':!![]});}}})[_0x7bd6('0x19')](function(_0x557a53){logger[_0x7bd6('0x1a')](_0x7bd6('0x1b'),_0x557a53?util['inspect'](_0x557a53,{'showHidden':![],'depth':null}):'');});}exports[_0x7bd6('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6cd4a13..60831dd 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a26=['util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','catch'];(function(_0x568449,_0x1ea607){var _0x5d53af=function(_0x41ad20){while(--_0x41ad20){_0x568449['push'](_0x568449['shift']());}};_0x5d53af(++_0x1ea607);}(_0x9a26,0x169));var _0x69a2=function(_0x33396b,_0x38e90c){_0x33396b=_0x33396b-0x0;var _0x24ca65=_0x9a26[_0x33396b];return _0x24ca65;};'use strict';var util=require(_0x69a2('0x0'));var db=require(_0x69a2('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x69a2('0x2')]({'id':i,'firstName':_0x69a2('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x69a2('0x4')+i+_0x69a2('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x69a2('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x69a2('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x69a2('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x69a2('0x2')]({'id':i,'firstName':_0x69a2('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x69a2('0x4')+i+_0x69a2('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x69a2('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x69a2('0x6')]()});}db['CmContact']['destroy']({'where':{}})[_0x69a2('0x7')](function(){return db[_0x69a2('0x8')][_0x69a2('0x9')](contacts);})['then'](function(){console[_0x69a2('0xa')](_0x69a2('0xb'),_0x69a2('0xc'));return db[_0x69a2('0xd')][_0x69a2('0xe')]({'where':{}});})[_0x69a2('0x7')](function(){return db['CmHopper'][_0x69a2('0x9')](hopper);})['then'](function(){console[_0x69a2('0xa')](_0x69a2('0xb'),_0x69a2('0xf'));return db[_0x69a2('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0x69a2('0xa')](_0x69a2('0xb'),_0x69a2('0x10'));return db[_0x69a2('0xd')][_0x69a2('0x9')](hopper2);})[_0x69a2('0x7')](function(){console[_0x69a2('0xa')](_0x69a2('0xb'),_0x69a2('0x11'));})[_0x69a2('0x12')](function(_0x521b06){console[_0x69a2('0xa')](_0x521b06);}); \ No newline at end of file +var _0xd7d2=['destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact'];(function(_0x18a772,_0x1a4d3f){var _0xbaac04=function(_0x467aa6){while(--_0x467aa6){_0x18a772['push'](_0x18a772['shift']());}};_0xbaac04(++_0x1a4d3f);}(_0xd7d2,0x76));var _0x2d7d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd7d2[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var db=require(_0x2d7d('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2d7d('0x1')+i,'phone':0xf879fb460+i,'email':_0x2d7d('0x2')+i+_0x2d7d('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2d7d('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2d7d('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2d7d('0x4')]({'id':i,'firstName':_0x2d7d('0x6')+i,'lastName':_0x2d7d('0x1')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2d7d('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2d7d('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2d7d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2d7d('0x5')](),'updatedAt':Date[_0x2d7d('0x5')]()});}db[_0x2d7d('0x7')][_0x2d7d('0x8')]({'where':{}})['then'](function(){return db[_0x2d7d('0x7')][_0x2d7d('0x9')](contacts);})[_0x2d7d('0xa')](function(){console[_0x2d7d('0xb')](_0x2d7d('0xc'),_0x2d7d('0xd'));return db[_0x2d7d('0xe')][_0x2d7d('0x8')]({'where':{}});})[_0x2d7d('0xa')](function(){return db['CmHopper'][_0x2d7d('0x9')](hopper);})[_0x2d7d('0xa')](function(){console[_0x2d7d('0xb')](_0x2d7d('0xc'),_0x2d7d('0xf'));return db['CmContact'][_0x2d7d('0x9')](contacts2);})[_0x2d7d('0xa')](function(){console[_0x2d7d('0xb')](_0x2d7d('0xc'),'contacts2');return db[_0x2d7d('0xe')][_0x2d7d('0x9')](hopper2);})[_0x2d7d('0xa')](function(){console[_0x2d7d('0xb')](_0x2d7d('0xc'),_0x2d7d('0x10'));})[_0x2d7d('0x11')](function(_0x20d5b9){console[_0x2d7d('0xb')](_0x20d5b9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d595cb6..dfa4a7b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x600d=['actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','push','format','agent','%s%s','%s%s@xcally.com','password','udp','wss','all','ulaw','yes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x600d,0x196));var _0xd600=function(_0x199185,_0x28b3bd){_0x199185=_0x199185-0x0;var _0x5c0c4f=_0x600d[_0x199185];return _0x5c0c4f;};'use strict';var util=require(_0xd600('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd600('0x1')]({'name':util[_0xd600('0x2')]('%s%s',_0xd600('0x3'),i),'fullname':util['format'](_0xd600('0x4'),_0xd600('0x3'),i),'email':util[_0xd600('0x2')](_0xd600('0x5'),'agent',i),'role':'agent','password':_0xd600('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xd600('0x7'),'ws',_0xd600('0x8')],'disallow':[_0xd600('0x9')],'allow':[_0xd600('0xa')],'defaultuser':util['format'](_0xd600('0x4'),'agent',i),'encryption':_0xd600('0xb'),'avpf':_0xd600('0xb'),'force_avp':_0xd600('0xb'),'icesupport':'yes','dtlsenable':_0xd600('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xd600('0xc'),'callerid':util['format'](_0xd600('0xd'),util['format'](_0xd600('0x4'),'agent',i),0xfa0+i)});}db['User'][_0xd600('0xe')](users)[_0xd600('0xf')](function(){console[_0xd600('0x10')](_0xd600('0x11'));})[_0xd600('0x12')](function(_0x184551){console[_0xd600('0x10')](_0x184551);}); \ No newline at end of file +var _0x6e0b=['agent','%s%s','%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','../mysqldb','format'];(function(_0x481780,_0x3db65d){var _0x2d2b2b=function(_0x320199){while(--_0x320199){_0x481780['push'](_0x481780['shift']());}};_0x2d2b2b(++_0x3db65d);}(_0x6e0b,0x1b5));var _0xb6e0=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6e0b[_0x1035c1];return _0x308d67;};'use strict';var util=require(_0xb6e0('0x0'));var db=require(_0xb6e0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xb6e0('0x2')]('%s%s',_0xb6e0('0x3'),i),'fullname':util[_0xb6e0('0x2')](_0xb6e0('0x4'),_0xb6e0('0x3'),i),'email':util['format'](_0xb6e0('0x5'),'agent',i),'role':_0xb6e0('0x3'),'password':'password','internal':0xfa0+i,'type':_0xb6e0('0x6'),'transport':[_0xb6e0('0x7'),'ws',_0xb6e0('0x8')],'disallow':['all'],'allow':[_0xb6e0('0x9')],'defaultuser':util[_0xb6e0('0x2')](_0xb6e0('0x4'),_0xb6e0('0x3'),i),'encryption':_0xb6e0('0xa'),'avpf':_0xb6e0('0xa'),'force_avp':'yes','icesupport':_0xb6e0('0xa'),'dtlsenable':_0xb6e0('0xa'),'dtlsverify':'no','dtlscertfile':_0xb6e0('0xb'),'dtlsprivatekey':_0xb6e0('0xc'),'dtlssetup':_0xb6e0('0xd'),'callerid':util[_0xb6e0('0x2')](_0xb6e0('0xe'),util[_0xb6e0('0x2')](_0xb6e0('0x4'),_0xb6e0('0x3'),i),0xfa0+i)});}db[_0xb6e0('0xf')][_0xb6e0('0x10')](users)[_0xb6e0('0x11')](function(){console[_0xb6e0('0x12')]('add\x20user');})[_0xb6e0('0x13')](function(_0x491315){console[_0xb6e0('0x12')](_0x491315);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8ce0e9b..2c820e2 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19fc=['FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','push','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:inbound','VoiceQueue','SmsQueues','SmsQueue','OpenchannelQueues','getVoiceQueues','getSmsQueues','getWhatsappQueues','all','chat','fax','sms','mail','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','join','default','setMaxListeners','request','remoteAddress','connection','remotePort','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0x19fc,0x150));var _0xc19f=function(_0x2d6d0f,_0x3cf2a5){_0x2d6d0f=_0x2d6d0f-0x0;var _0xd2bee6=_0x19fc[_0x2d6d0f];return _0xd2bee6;};'use strict';var _=require(_0xc19f('0x0'));var util=require('util');var BPromise=require(_0xc19f('0x1'));var db=require(_0xc19f('0x2'))['db'];var config=require(_0xc19f('0x3'));var queryQueues={'attributes':['id',_0xc19f('0x4')],'include':[{'as':_0xc19f('0x5'),'model':db[_0xc19f('0x6')],'attributes':['id',_0xc19f('0x4'),_0xc19f('0x7')],'raw':!![],'where':{'role':_0xc19f('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc19f('0x4')],'where':{'role':_0xc19f('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc19f('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc19f('0x4')],'where':{'role':_0xc19f('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc19f('0x4'),_0xc19f('0xa')],'where':{'type':_0xc19f('0xb')}};function getAssociatedResources(_0x2fe58b,_0x5ce1ad,_0x2da042){return db[_0xc19f('0xc')]['findOne']({'where':{'name':_0x2fe58b,'userProfileId':_0x5ce1ad},'raw':!![]})['then'](function(_0x2a958a){if(_0x2a958a){if(_0x2a958a[_0xc19f('0xd')]){switch(_0x2fe58b){case _0xc19f('0xe'):case _0xc19f('0xf'):case _0xc19f('0x10'):case'SmsQueues':case _0xc19f('0x11'):case'OpenchannelQueues':case _0xc19f('0x12'):return db[_0x2da042]['findAll'](queryQueues);case'Telephones':return db[_0x2da042][_0xc19f('0x13')](queryTelephones);case _0xc19f('0x14'):return db[_0x2da042][_0xc19f('0x13')](queryTrunks);case _0xc19f('0x15'):return db[_0x2da042][_0xc19f('0x13')](queryCampaigns);}}else{return db[_0xc19f('0x16')][_0xc19f('0x13')]({'attributes':[_0xc19f('0x17')],'where':{'sectionId':_0x2a958a['id']},'raw':!![]})[_0xc19f('0x18')](function(_0x1fc69d){if(_0x1fc69d){var _0x38a3c3={'where':{'id':_[_0xc19f('0x19')](_0x1fc69d,_0xc19f('0x17'))},'raw':!![]};switch(_0x2da042){case _0xc19f('0x6'):_0x38a3c3[_0xc19f('0x1a')][_0xc19f('0x7')]=_0xc19f('0x9');break;case _0xc19f('0x1b'):_0x38a3c3[_0xc19f('0x1a')][_0xc19f('0xa')]=_0xc19f('0xb');break;}return db[_0x2da042][_0xc19f('0x13')](_0x38a3c3);}else{return[];}});}}else{return[];}})[_0xc19f('0x18')](function(_0x4ba5d8){return _0x4ba5d8;});}function joinOrLeaveQueues(_0x346aa8,_0x39210a,_0x7307d5,_0x74a1b6){_0x346aa8[_0x39210a](util[_0xc19f('0x1c')](_0xc19f('0x1d'),_0x7307d5,_0x74a1b6[_0xc19f('0x4')]));if(_0x74a1b6[_0xc19f('0x5')]){for(var _0x53be70=0x0;_0x53be70<_0x74a1b6['Agents'][_0xc19f('0x1e')];_0x53be70+=0x1){_0x346aa8[_0x39210a](util[_0xc19f('0x1c')](_0xc19f('0x1f'),_0x74a1b6[_0xc19f('0x5')][_0x53be70]['name']));}}}function joinOrLeave(_0x5b79b2,_0x2a7f6a,_0x2af360){var _0x4c8d63;if(_0x5b79b2[_0xc19f('0x20')]['query']['id']){db[_0xc19f('0x6')][_0xc19f('0x21')]({'attributes':['id',_0xc19f('0x4'),_0xc19f('0x7'),_0xc19f('0x22')],'where':{'id':_0x5b79b2[_0xc19f('0x20')][_0xc19f('0x23')]['id']},'include':[{'model':db[_0xc19f('0x24')],'as':_0xc19f('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xc19f('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc19f('0x27')],'as':_0xc19f('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xc19f('0x29')],'as':_0xc19f('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc19f('0x2b')],'as':_0xc19f('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xc19f('0x18')](function(_0x32699c){if(_0x32699c){_0x4c8d63=_0x32699c;_0x5b79b2[_0x2a7f6a](util['format'](_0xc19f('0x1f'),_0x32699c[_0xc19f('0x4')]));var _0x494252=[];switch(_0x32699c[_0xc19f('0x7')]){case _0xc19f('0x2d'):_0x5b79b2[_0x2a7f6a]('voice:inbound');_0x5b79b2[_0x2a7f6a](_0xc19f('0x2e'));if(queryQueues[_0xc19f('0x2f')]('include')){delete queryQueues['include'];}_0x494252[_0xc19f('0x30')](db['VoiceQueue'][_0xc19f('0x13')](queryQueues));_0x494252[_0xc19f('0x30')](db['ChatQueue'][_0xc19f('0x13')](queryQueues));_0x494252[_0xc19f('0x30')](db['FaxQueue'][_0xc19f('0x13')](queryQueues));_0x494252[_0xc19f('0x30')](db['SmsQueue'][_0xc19f('0x13')](queryQueues));_0x494252[_0xc19f('0x30')](db[_0xc19f('0x31')][_0xc19f('0x13')](queryQueues));_0x494252['push'](db[_0xc19f('0x32')]['findAll'](queryQueues));_0x494252[_0xc19f('0x30')](db[_0xc19f('0x33')][_0xc19f('0x13')](queryQueues));_0x494252[_0xc19f('0x30')](db[_0xc19f('0x6')][_0xc19f('0x13')](queryTelephones));_0x494252[_0xc19f('0x30')](db['Trunk']['findAll'](queryTrunks));_0x494252[_0xc19f('0x30')](db[_0xc19f('0x1b')][_0xc19f('0x13')](queryCampaigns));_0x494252['push'](db['User'][_0xc19f('0x13')](queryAgents));break;case _0xc19f('0x34'):_0x5b79b2[_0x2a7f6a](_0xc19f('0x35'));_0x5b79b2[_0x2a7f6a](_0xc19f('0x2e'));_0x494252['push'](getAssociatedResources(_0xc19f('0xe'),_0x32699c[_0xc19f('0x22')],_0xc19f('0x36')));_0x494252[_0xc19f('0x30')](getAssociatedResources(_0xc19f('0xf'),_0x32699c[_0xc19f('0x22')],'ChatQueue'));_0x494252[_0xc19f('0x30')](getAssociatedResources(_0xc19f('0x10'),_0x32699c[_0xc19f('0x22')],'FaxQueue'));_0x494252[_0xc19f('0x30')](getAssociatedResources(_0xc19f('0x37'),_0x32699c[_0xc19f('0x22')],_0xc19f('0x38')));_0x494252['push'](getAssociatedResources(_0xc19f('0x11'),_0x32699c['userProfileId'],_0xc19f('0x31')));_0x494252[_0xc19f('0x30')](getAssociatedResources(_0xc19f('0x39'),_0x32699c[_0xc19f('0x22')],_0xc19f('0x32')));_0x494252['push'](getAssociatedResources(_0xc19f('0x12'),_0x32699c['userProfileId'],_0xc19f('0x33')));_0x494252['push'](getAssociatedResources('Telephones',_0x32699c[_0xc19f('0x22')],_0xc19f('0x6')));_0x494252['push'](getAssociatedResources(_0xc19f('0x14'),_0x32699c['userProfileId'],'Trunk'));_0x494252[_0xc19f('0x30')](getAssociatedResources('IvrCampaigns',_0x32699c[_0xc19f('0x22')],_0xc19f('0x1b')));_0x494252[_0xc19f('0x30')](db[_0xc19f('0x6')][_0xc19f('0x13')](queryAgents));break;case _0xc19f('0x8'):_0x5b79b2[_0x2a7f6a](_0xc19f('0x35'));_0x5b79b2[_0x2a7f6a](_0xc19f('0x2e'));_0x494252[_0xc19f('0x30')](_0x32699c[_0xc19f('0x3a')]({'attributes':['id',_0xc19f('0x4')]}));_0x494252['push'](_0x32699c['getChatQueues']({'attributes':['id',_0xc19f('0x4')]}));_0x494252['push'](_0x32699c['getFaxQueues']({'attributes':['id',_0xc19f('0x4')]}));_0x494252[_0xc19f('0x30')](_0x32699c[_0xc19f('0x3b')]({'attributes':['id','name']}));_0x494252['push'](_0x32699c['getMailQueues']({'attributes':['id',_0xc19f('0x4')]}));_0x494252['push'](_0x32699c['getOpenchannelQueues']({'attributes':['id',_0xc19f('0x4')]}));_0x494252[_0xc19f('0x30')](_0x32699c[_0xc19f('0x3c')]({'attributes':['id',_0xc19f('0x4')]}));break;}return BPromise[_0xc19f('0x3d')](_0x494252);}})['then'](function(_0x383cd8){if(_0x383cd8&&_0x383cd8['length']){for(var _0x39da63=0x0;_0x39da63<_0x383cd8[_0xc19f('0x1e')];_0x39da63+=0x1){for(var _0x4a8547=0x0;_0x4a8547<_0x383cd8[_0x39da63]['length'];_0x4a8547+=0x1){switch(_0x39da63){case 0x0:joinOrLeaveQueues(_0x5b79b2,_0x2a7f6a,'voice',_0x383cd8[_0x39da63][_0x4a8547]);break;case 0x1:joinOrLeaveQueues(_0x5b79b2,_0x2a7f6a,_0xc19f('0x3e'),_0x383cd8[_0x39da63][_0x4a8547]);break;case 0x2:joinOrLeaveQueues(_0x5b79b2,_0x2a7f6a,_0xc19f('0x3f'),_0x383cd8[_0x39da63][_0x4a8547]);break;case 0x3:joinOrLeaveQueues(_0x5b79b2,_0x2a7f6a,_0xc19f('0x40'),_0x383cd8[_0x39da63][_0x4a8547]);break;case 0x4:joinOrLeaveQueues(_0x5b79b2,_0x2a7f6a,_0xc19f('0x41'),_0x383cd8[_0x39da63][_0x4a8547]);break;case 0x5:joinOrLeaveQueues(_0x5b79b2,_0x2a7f6a,'openchannel',_0x383cd8[_0x39da63][_0x4a8547]);break;case 0x6:joinOrLeaveQueues(_0x5b79b2,_0x2a7f6a,_0xc19f('0x42'),_0x383cd8[_0x39da63][_0x4a8547]);break;case 0x7:if(_0x4c8d63['role']!==_0xc19f('0x8'))_0x5b79b2[_0x2a7f6a](util['format'](_0xc19f('0x43'),_0x383cd8[_0x39da63][_0x4a8547]['name']));break;case 0x8:if(_0x4c8d63[_0xc19f('0x7')]!==_0xc19f('0x8'))_0x5b79b2[_0x2a7f6a](util[_0xc19f('0x1c')]('trunk:%s',_0x383cd8[_0x39da63][_0x4a8547]['name']));break;case 0x9:if(_0x4c8d63[_0xc19f('0x7')]!==_0xc19f('0x8'))_0x5b79b2[_0x2a7f6a](util[_0xc19f('0x1c')](_0xc19f('0x44'),_0x383cd8[_0x39da63][_0x4a8547][_0xc19f('0xa')],_0x383cd8[_0x39da63][_0x4a8547][_0xc19f('0x4')]));break;case 0xa:_0x5b79b2[_0x2a7f6a](util['format']('user:%s',_0x383cd8[_0x39da63][_0x4a8547][_0xc19f('0x4')]));break;}}}}})[_0xc19f('0x18')](function(){if(_0x2a7f6a===_0xc19f('0x45')){var _0x34c836=_[_0xc19f('0x19')](_0x4c8d63[_0xc19f('0x25')],'id');return _0x4c8d63[_0xc19f('0x46')](_0x34c836)[_0xc19f('0x18')](function(){for(var _0xb1157d=0x0;_0xb1157d<_0x34c836[_0xc19f('0x1e')];_0xb1157d+=0x1){_0x2af360[_0xc19f('0x47')](_0xc19f('0x48'),{'ChatInteractionId':Number(_0x34c836[_0xb1157d]),'UserId':Number(_0x4c8d63['id'])});}});}})[_0xc19f('0x18')](function(){if(_0x2a7f6a===_0xc19f('0x45')){var _0x311ab2=_[_0xc19f('0x19')](_0x4c8d63[_0xc19f('0x49')],'id');return _0x4c8d63[_0xc19f('0x4a')](_0x311ab2)[_0xc19f('0x18')](function(){for(var _0x116d57=0x0;_0x116d57<_0x311ab2[_0xc19f('0x1e')];_0x116d57+=0x1){_0x2af360[_0xc19f('0x47')](_0xc19f('0x4b'),{'MailInteractionId':Number(_0x311ab2[_0x116d57]),'UserId':Number(_0x4c8d63['id'])});}});}})[_0xc19f('0x18')](function(){if(_0x2a7f6a==='leave'){var _0x5c157b=_[_0xc19f('0x19')](_0x4c8d63[_0xc19f('0x28')],'id');return _0x4c8d63['removeFaxInteractions'](_0x5c157b)[_0xc19f('0x18')](function(){for(var _0x3cabdb=0x0;_0x3cabdb<_0x5c157b[_0xc19f('0x1e')];_0x3cabdb+=0x1){_0x2af360['emit'](_0xc19f('0x4c'),{'FaxInteractionId':Number(_0x5c157b[_0x3cabdb]),'UserId':Number(_0x4c8d63['id'])});}});}})[_0xc19f('0x18')](function(){if(_0x2a7f6a===_0xc19f('0x45')){var _0x31afe5=_[_0xc19f('0x19')](_0x4c8d63[_0xc19f('0x2a')],'id');return _0x4c8d63[_0xc19f('0x4d')](_0x31afe5)[_0xc19f('0x18')](function(){for(var _0x23442e=0x0;_0x23442e<_0x31afe5['length'];_0x23442e+=0x1){_0x2af360[_0xc19f('0x47')](_0xc19f('0x4e'),{'SmsInteractionId':Number(_0x31afe5[_0x23442e]),'UserId':Number(_0x4c8d63['id'])});}});}})['then'](function(){if(_0x2a7f6a===_0xc19f('0x45')){var _0x58484d=_[_0xc19f('0x19')](_0x4c8d63[_0xc19f('0x4f')],'id');return _0x4c8d63[_0xc19f('0x50')](_0x58484d)['then'](function(){for(var _0x4bb91e=0x0;_0x4bb91e<_0x58484d[_0xc19f('0x1e')];_0x4bb91e+=0x1){_0x2af360[_0xc19f('0x47')](_0xc19f('0x51'),{'OpenchannelInteractionId':Number(_0x58484d[_0x4bb91e]),'UserId':Number(_0x4c8d63['id'])});}});}})['then'](function(){if(_0x2a7f6a===_0xc19f('0x45')){var _0x595193=_[_0xc19f('0x19')](_0x4c8d63[_0xc19f('0x2c')],'id');return _0x4c8d63['removeWhatsappInteractions'](_0x595193)[_0xc19f('0x18')](function(){for(var _0x43f338=0x0;_0x43f338<_0x595193[_0xc19f('0x1e')];_0x43f338+=0x1){_0x2af360[_0xc19f('0x47')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x595193[_0x43f338]),'UserId':Number(_0x4c8d63['id'])});}});}})['catch'](function(_0xbd3b96){_0x5b79b2['log'](_0xbd3b96);});}}function onDisconnect(_0xcc27bf,_0x29a2cc){joinOrLeave(_0xcc27bf,'leave',_0x29a2cc);}function onConnect(_0x1c68b7){joinOrLeave(_0x1c68b7,_0xc19f('0x52'));}exports[_0xc19f('0x53')]=function(_0xff5be2){_0xff5be2['on']('connection',function(_0x28bb77){_0x28bb77[_0xc19f('0x54')](0x0);_0x28bb77['address']=_0x28bb77[_0xc19f('0x55')]['connection'][_0xc19f('0x56')]+':'+_0x28bb77[_0xc19f('0x55')][_0xc19f('0x57')][_0xc19f('0x58')];_0x28bb77['connectedAt']=new Date();_0x28bb77[_0xc19f('0x59')]=function(_0x4f5ca7){console[_0xc19f('0x59')](_0xc19f('0x5a')+_0x28bb77[_0xc19f('0x5b')]['name']+'['+_0x28bb77['address']+']',_0x4f5ca7);};_0x28bb77['on'](_0xc19f('0x5c'),function(){onDisconnect(_0x28bb77,_0xff5be2);_0x28bb77[_0xc19f('0x59')](_0xc19f('0x5d'));});onConnect(_0x28bb77);_0x28bb77[_0xc19f('0x59')]('CONNECTED');});}; \ No newline at end of file +var _0x0c3a=['findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','then','format','%s:queue:%s','length','user:%s','find','userProfileId','handshake','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','ChatQueues','ChatQueue','Telephones','Trunk','agent','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','trunk:%s','campaign:%s:%s','map','ChatInteractions','emit','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','setMaxListeners','address','request','remoteAddress','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues'];(function(_0x202b05,_0x5a246c){var _0x22a0a7=function(_0x5157f2){while(--_0x5157f2){_0x202b05['push'](_0x202b05['shift']());}};_0x22a0a7(++_0x5a246c);}(_0x0c3a,0x171));var _0xa0c3=function(_0x498c6f,_0x4d1892){_0x498c6f=_0x498c6f-0x0;var _0x33f3b4=_0x0c3a[_0x498c6f];return _0x33f3b4;};'use strict';var _=require(_0xa0c3('0x0'));var util=require(_0xa0c3('0x1'));var BPromise=require(_0xa0c3('0x2'));var db=require(_0xa0c3('0x3'))['db'];var config=require(_0xa0c3('0x4'));var queryQueues={'attributes':['id',_0xa0c3('0x5')],'include':[{'as':_0xa0c3('0x6'),'model':db['User'],'attributes':['id',_0xa0c3('0x5'),_0xa0c3('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa0c3('0x5')],'where':{'role':_0xa0c3('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xa0c3('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xa0c3('0x9')],'where':{'type':_0xa0c3('0xa')}};function getAssociatedResources(_0x3b524a,_0x263a66,_0x5d7c35){return db[_0xa0c3('0xb')][_0xa0c3('0xc')]({'where':{'name':_0x3b524a,'userProfileId':_0x263a66},'raw':!![]})['then'](function(_0x47fa6f){if(_0x47fa6f){if(_0x47fa6f[_0xa0c3('0xd')]){switch(_0x3b524a){case _0xa0c3('0xe'):case'ChatQueues':case _0xa0c3('0xf'):case _0xa0c3('0x10'):case _0xa0c3('0x11'):case'OpenchannelQueues':case _0xa0c3('0x12'):return db[_0x5d7c35][_0xa0c3('0x13')](queryQueues);case'Telephones':return db[_0x5d7c35]['findAll'](queryTelephones);case _0xa0c3('0x14'):return db[_0x5d7c35][_0xa0c3('0x13')](queryTrunks);case _0xa0c3('0x15'):return db[_0x5d7c35][_0xa0c3('0x13')](queryCampaigns);}}else{return db[_0xa0c3('0x16')]['findAll']({'attributes':[_0xa0c3('0x17')],'where':{'sectionId':_0x47fa6f['id']},'raw':!![]})['then'](function(_0x2f0ec4){if(_0x2f0ec4){var _0x5195c3={'where':{'id':_['map'](_0x2f0ec4,'resourceId')},'raw':!![]};switch(_0x5d7c35){case _0xa0c3('0x18'):_0x5195c3[_0xa0c3('0x19')][_0xa0c3('0x7')]='telephone';break;case _0xa0c3('0x1a'):_0x5195c3[_0xa0c3('0x19')][_0xa0c3('0x9')]=_0xa0c3('0xa');break;}return db[_0x5d7c35][_0xa0c3('0x13')](_0x5195c3);}else{return[];}});}}else{return[];}})[_0xa0c3('0x1b')](function(_0x3e6851){return _0x3e6851;});}function joinOrLeaveQueues(_0x50c239,_0x18a312,_0x4c310d,_0x112c23){_0x50c239[_0x18a312](util[_0xa0c3('0x1c')](_0xa0c3('0x1d'),_0x4c310d,_0x112c23[_0xa0c3('0x5')]));if(_0x112c23['Agents']){for(var _0x91fd9f=0x0;_0x91fd9f<_0x112c23[_0xa0c3('0x6')][_0xa0c3('0x1e')];_0x91fd9f+=0x1){_0x50c239[_0x18a312](util[_0xa0c3('0x1c')](_0xa0c3('0x1f'),_0x112c23[_0xa0c3('0x6')][_0x91fd9f][_0xa0c3('0x5')]));}}}function joinOrLeave(_0x5e31da,_0x406356,_0xbc0388){var _0x216dc7;if(_0x5e31da['handshake']['query']['id']){db[_0xa0c3('0x18')][_0xa0c3('0x20')]({'attributes':['id',_0xa0c3('0x5'),_0xa0c3('0x7'),_0xa0c3('0x21')],'where':{'id':_0x5e31da[_0xa0c3('0x22')][_0xa0c3('0x23')]['id']},'include':[{'model':db[_0xa0c3('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa0c3('0x25')],'as':_0xa0c3('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xa0c3('0x27')],'as':_0xa0c3('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xa0c3('0x29')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa0c3('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa0c3('0x2b')],'as':_0xa0c3('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xa0c3('0x1b')](function(_0x20d3c4){if(_0x20d3c4){_0x216dc7=_0x20d3c4;_0x5e31da[_0x406356](util[_0xa0c3('0x1c')](_0xa0c3('0x1f'),_0x20d3c4['name']));var _0x21fb72=[];switch(_0x20d3c4[_0xa0c3('0x7')]){case _0xa0c3('0x2d'):_0x5e31da[_0x406356](_0xa0c3('0x2e'));_0x5e31da[_0x406356](_0xa0c3('0x2f'));if(queryQueues['hasOwnProperty'](_0xa0c3('0x30'))){delete queryQueues[_0xa0c3('0x30')];}_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x32')]['findAll'](queryQueues));_0x21fb72[_0xa0c3('0x31')](db['ChatQueue'][_0xa0c3('0x13')](queryQueues));_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x33')]['findAll'](queryQueues));_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x34')][_0xa0c3('0x13')](queryQueues));_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x35')][_0xa0c3('0x13')](queryQueues));_0x21fb72['push'](db[_0xa0c3('0x36')][_0xa0c3('0x13')](queryQueues));_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x37')][_0xa0c3('0x13')](queryQueues));_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x18')]['findAll'](queryTelephones));_0x21fb72['push'](db['Trunk'][_0xa0c3('0x13')](queryTrunks));_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x1a')][_0xa0c3('0x13')](queryCampaigns));_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x18')][_0xa0c3('0x13')](queryAgents));break;case _0xa0c3('0x38'):_0x5e31da[_0x406356](_0xa0c3('0x2e'));_0x5e31da[_0x406356](_0xa0c3('0x2f'));_0x21fb72[_0xa0c3('0x31')](getAssociatedResources(_0xa0c3('0xe'),_0x20d3c4['userProfileId'],_0xa0c3('0x32')));_0x21fb72['push'](getAssociatedResources(_0xa0c3('0x39'),_0x20d3c4['userProfileId'],_0xa0c3('0x3a')));_0x21fb72[_0xa0c3('0x31')](getAssociatedResources(_0xa0c3('0xf'),_0x20d3c4[_0xa0c3('0x21')],_0xa0c3('0x33')));_0x21fb72[_0xa0c3('0x31')](getAssociatedResources(_0xa0c3('0x10'),_0x20d3c4[_0xa0c3('0x21')],_0xa0c3('0x34')));_0x21fb72['push'](getAssociatedResources('MailQueues',_0x20d3c4['userProfileId'],'MailQueue'));_0x21fb72[_0xa0c3('0x31')](getAssociatedResources('OpenchannelQueues',_0x20d3c4[_0xa0c3('0x21')],_0xa0c3('0x36')));_0x21fb72[_0xa0c3('0x31')](getAssociatedResources(_0xa0c3('0x12'),_0x20d3c4[_0xa0c3('0x21')],_0xa0c3('0x37')));_0x21fb72[_0xa0c3('0x31')](getAssociatedResources(_0xa0c3('0x3b'),_0x20d3c4[_0xa0c3('0x21')],_0xa0c3('0x18')));_0x21fb72[_0xa0c3('0x31')](getAssociatedResources(_0xa0c3('0x14'),_0x20d3c4[_0xa0c3('0x21')],_0xa0c3('0x3c')));_0x21fb72['push'](getAssociatedResources(_0xa0c3('0x15'),_0x20d3c4[_0xa0c3('0x21')],_0xa0c3('0x1a')));_0x21fb72[_0xa0c3('0x31')](db[_0xa0c3('0x18')][_0xa0c3('0x13')](queryAgents));break;case _0xa0c3('0x3d'):_0x5e31da[_0x406356](_0xa0c3('0x2e'));_0x5e31da[_0x406356](_0xa0c3('0x2f'));_0x21fb72[_0xa0c3('0x31')](_0x20d3c4['getVoiceQueues']({'attributes':['id',_0xa0c3('0x5')]}));_0x21fb72[_0xa0c3('0x31')](_0x20d3c4[_0xa0c3('0x3e')]({'attributes':['id',_0xa0c3('0x5')]}));_0x21fb72['push'](_0x20d3c4[_0xa0c3('0x3f')]({'attributes':['id',_0xa0c3('0x5')]}));_0x21fb72[_0xa0c3('0x31')](_0x20d3c4[_0xa0c3('0x40')]({'attributes':['id',_0xa0c3('0x5')]}));_0x21fb72['push'](_0x20d3c4['getMailQueues']({'attributes':['id','name']}));_0x21fb72[_0xa0c3('0x31')](_0x20d3c4['getOpenchannelQueues']({'attributes':['id',_0xa0c3('0x5')]}));_0x21fb72[_0xa0c3('0x31')](_0x20d3c4[_0xa0c3('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0xa0c3('0x42')](_0x21fb72);}})['then'](function(_0x51f22f){if(_0x51f22f&&_0x51f22f[_0xa0c3('0x1e')]){for(var _0x3f5ece=0x0;_0x3f5ece<_0x51f22f[_0xa0c3('0x1e')];_0x3f5ece+=0x1){for(var _0x378647=0x0;_0x378647<_0x51f22f[_0x3f5ece][_0xa0c3('0x1e')];_0x378647+=0x1){switch(_0x3f5ece){case 0x0:joinOrLeaveQueues(_0x5e31da,_0x406356,_0xa0c3('0x43'),_0x51f22f[_0x3f5ece][_0x378647]);break;case 0x1:joinOrLeaveQueues(_0x5e31da,_0x406356,_0xa0c3('0x44'),_0x51f22f[_0x3f5ece][_0x378647]);break;case 0x2:joinOrLeaveQueues(_0x5e31da,_0x406356,_0xa0c3('0x45'),_0x51f22f[_0x3f5ece][_0x378647]);break;case 0x3:joinOrLeaveQueues(_0x5e31da,_0x406356,_0xa0c3('0x46'),_0x51f22f[_0x3f5ece][_0x378647]);break;case 0x4:joinOrLeaveQueues(_0x5e31da,_0x406356,_0xa0c3('0x47'),_0x51f22f[_0x3f5ece][_0x378647]);break;case 0x5:joinOrLeaveQueues(_0x5e31da,_0x406356,'openchannel',_0x51f22f[_0x3f5ece][_0x378647]);break;case 0x6:joinOrLeaveQueues(_0x5e31da,_0x406356,'whatsapp',_0x51f22f[_0x3f5ece][_0x378647]);break;case 0x7:if(_0x216dc7[_0xa0c3('0x7')]!=='agent')_0x5e31da[_0x406356](util['format']('telephone:%s',_0x51f22f[_0x3f5ece][_0x378647][_0xa0c3('0x5')]));break;case 0x8:if(_0x216dc7['role']!=='agent')_0x5e31da[_0x406356](util[_0xa0c3('0x1c')](_0xa0c3('0x48'),_0x51f22f[_0x3f5ece][_0x378647][_0xa0c3('0x5')]));break;case 0x9:if(_0x216dc7[_0xa0c3('0x7')]!=='agent')_0x5e31da[_0x406356](util['format'](_0xa0c3('0x49'),_0x51f22f[_0x3f5ece][_0x378647][_0xa0c3('0x9')],_0x51f22f[_0x3f5ece][_0x378647][_0xa0c3('0x5')]));break;case 0xa:_0x5e31da[_0x406356](util[_0xa0c3('0x1c')](_0xa0c3('0x1f'),_0x51f22f[_0x3f5ece][_0x378647][_0xa0c3('0x5')]));break;}}}}})[_0xa0c3('0x1b')](function(){if(_0x406356==='leave'){var _0x1ebcc0=_[_0xa0c3('0x4a')](_0x216dc7[_0xa0c3('0x4b')],'id');return _0x216dc7['removeChatInteractions'](_0x1ebcc0)['then'](function(){for(var _0x4fdd42=0x0;_0x4fdd42<_0x1ebcc0[_0xa0c3('0x1e')];_0x4fdd42+=0x1){_0xbc0388[_0xa0c3('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1ebcc0[_0x4fdd42]),'UserId':Number(_0x216dc7['id'])});}});}})[_0xa0c3('0x1b')](function(){if(_0x406356==='leave'){var _0x22787e=_[_0xa0c3('0x4a')](_0x216dc7[_0xa0c3('0x26')],'id');return _0x216dc7['removeMailInteractions'](_0x22787e)[_0xa0c3('0x1b')](function(){for(var _0x728afc=0x0;_0x728afc<_0x22787e[_0xa0c3('0x1e')];_0x728afc+=0x1){_0xbc0388['emit'](_0xa0c3('0x4d'),{'MailInteractionId':Number(_0x22787e[_0x728afc]),'UserId':Number(_0x216dc7['id'])});}});}})['then'](function(){if(_0x406356===_0xa0c3('0x4e')){var _0xe937c2=_['map'](_0x216dc7['FaxInteractions'],'id');return _0x216dc7[_0xa0c3('0x4f')](_0xe937c2)['then'](function(){for(var _0x3627cb=0x0;_0x3627cb<_0xe937c2['length'];_0x3627cb+=0x1){_0xbc0388[_0xa0c3('0x4c')](_0xa0c3('0x50'),{'FaxInteractionId':Number(_0xe937c2[_0x3627cb]),'UserId':Number(_0x216dc7['id'])});}});}})['then'](function(){if(_0x406356==='leave'){var _0x435de8=_['map'](_0x216dc7['SmsInteractions'],'id');return _0x216dc7[_0xa0c3('0x51')](_0x435de8)[_0xa0c3('0x1b')](function(){for(var _0x24a0f9=0x0;_0x24a0f9<_0x435de8[_0xa0c3('0x1e')];_0x24a0f9+=0x1){_0xbc0388[_0xa0c3('0x4c')](_0xa0c3('0x52'),{'SmsInteractionId':Number(_0x435de8[_0x24a0f9]),'UserId':Number(_0x216dc7['id'])});}});}})[_0xa0c3('0x1b')](function(){if(_0x406356===_0xa0c3('0x4e')){var _0x10d66d=_['map'](_0x216dc7['OpenchannelInteractions'],'id');return _0x216dc7[_0xa0c3('0x53')](_0x10d66d)[_0xa0c3('0x1b')](function(){for(var _0x927de7=0x0;_0x927de7<_0x10d66d[_0xa0c3('0x1e')];_0x927de7+=0x1){_0xbc0388[_0xa0c3('0x4c')](_0xa0c3('0x54'),{'OpenchannelInteractionId':Number(_0x10d66d[_0x927de7]),'UserId':Number(_0x216dc7['id'])});}});}})['then'](function(){if(_0x406356===_0xa0c3('0x4e')){var _0x2d75ac=_['map'](_0x216dc7['WhatsappInteractions'],'id');return _0x216dc7['removeWhatsappInteractions'](_0x2d75ac)[_0xa0c3('0x1b')](function(){for(var _0x24a6c4=0x0;_0x24a6c4<_0x2d75ac[_0xa0c3('0x1e')];_0x24a6c4+=0x1){_0xbc0388['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2d75ac[_0x24a6c4]),'UserId':Number(_0x216dc7['id'])});}});}})[_0xa0c3('0x55')](function(_0x3ade73){_0x5e31da[_0xa0c3('0x56')](_0x3ade73);});}}function onDisconnect(_0x404e77,_0x355feb){joinOrLeave(_0x404e77,_0xa0c3('0x4e'),_0x355feb);}function onConnect(_0x32c103){joinOrLeave(_0x32c103,_0xa0c3('0x57'));}exports['default']=function(_0x1c8bb0){_0x1c8bb0['on']('connection',function(_0x2e7715){_0x2e7715[_0xa0c3('0x58')](0x0);_0x2e7715[_0xa0c3('0x59')]=_0x2e7715[_0xa0c3('0x5a')]['connection'][_0xa0c3('0x5b')]+':'+_0x2e7715['request']['connection']['remotePort'];_0x2e7715[_0xa0c3('0x5c')]=new Date();_0x2e7715[_0xa0c3('0x56')]=function(_0x81c639){console['log']('SocketIO\x20'+_0x2e7715[_0xa0c3('0x5d')][_0xa0c3('0x5')]+'['+_0x2e7715[_0xa0c3('0x59')]+']',_0x81c639);};_0x2e7715['on'](_0xa0c3('0x5e'),function(){onDisconnect(_0x2e7715,_0x1c8bb0);_0x2e7715[_0xa0c3('0x56')](_0xa0c3('0x5f'));});onConnect(_0x2e7715);_0x2e7715[_0xa0c3('0x56')](_0xa0c3('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3edabd1..c108885 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 _0x995b=['newinteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','closedinteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','event','direction','CmContact','describe','keys','startsWith','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','SELECT','contact','UserId','find','format','SIP/%s','name','channel','incomingmessage','outgoingmessage','opened','length','ContactId','sequelize','QueryTypes','changed','closed','get','User','default','hasOwnProperty','model','hook','callback','condition','util','../../mysqldb','jayson/promise','triggers','lodash','client','http','Chat','ChatInteraction','afterCreate','afterUpdate','newmessage','SmsInteraction'];(function(_0x56737c,_0x1a7eda){var _0x400640=function(_0x5438bb){while(--_0x5438bb){_0x56737c['push'](_0x56737c['shift']());}};_0x400640(++_0x1a7eda);}(_0x995b,0x1e4));var _0xb995=function(_0xaa4f0e,_0x3e76ea){_0xaa4f0e=_0xaa4f0e-0x0;var _0x326bc8=_0x995b[_0xaa4f0e];return _0x326bc8;};'use strict';var util=require(_0xb995('0x0'));var db=require(_0xb995('0x1'))['db'];var jayson=require(_0xb995('0x2'));var logger=require('../logger')(_0xb995('0x3'));var _=require(_0xb995('0x4'));var client=jayson[_0xb995('0x5')][_0xb995('0x6')]({'port':0x232a});var triggers=[{'channel':_0xb995('0x7'),'model':_0xb995('0x8'),'event':_0xb995('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xb995('0x7'),'model':_0xb995('0x8'),'event':_0xb995('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb995('0x7'),'model':'ChatMessage','event':_0xb995('0x9'),'condition':_0xb995('0xb'),'callback':afterCreateMessage},{'channel':'Sms','model':_0xb995('0xc'),'event':'afterCreate','condition':_0xb995('0xd'),'callback':afterCreate},{'channel':'Sms','model':_0xb995('0xc'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb995('0xe'),'model':_0xb995('0xf'),'event':'afterCreate','condition':_0xb995('0xb'),'callback':afterCreateMessage},{'channel':_0xb995('0x10'),'model':_0xb995('0x11'),'event':'afterCreate','condition':_0xb995('0xd'),'callback':afterCreate},{'channel':_0xb995('0x10'),'model':_0xb995('0x11'),'event':_0xb995('0xa'),'condition':_0xb995('0x12'),'callback':afterUpdate},{'channel':_0xb995('0x10'),'model':_0xb995('0x13'),'event':_0xb995('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb995('0x14'),'model':_0xb995('0x15'),'event':'afterCreate','condition':_0xb995('0xd'),'callback':afterCreate},{'channel':_0xb995('0x14'),'model':_0xb995('0x15'),'event':_0xb995('0xa'),'condition':_0xb995('0x12'),'callback':afterUpdate},{'channel':'Fax','model':_0xb995('0x16'),'event':'afterCreate','condition':_0xb995('0xb'),'callback':afterCreateMessage},{'channel':_0xb995('0x17'),'model':_0xb995('0x18'),'event':_0xb995('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0xb995('0x18'),'event':_0xb995('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb995('0x17'),'model':'MailMessage','event':_0xb995('0x9'),'condition':_0xb995('0xb'),'callback':afterCreateMessage},{'channel':_0xb995('0x19'),'model':_0xb995('0x1a'),'event':'afterCreate','condition':_0xb995('0xd'),'callback':afterCreate},{'channel':_0xb995('0x19'),'model':_0xb995('0x1a'),'event':_0xb995('0xa'),'condition':_0xb995('0x12'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0xb995('0x9'),'condition':_0xb995('0xb'),'callback':afterCreateMessage}];function request(_0xba95dd){return client[_0xb995('0x1b')](_0xb995('0x1c'),_0xba95dd)[_0xb995('0x1d')](function(_0x4ebeaf){logger[_0xb995('0x1e')](_0xb995('0x1f'),_0xb995('0x1c'),_0x4ebeaf);if(_0x4ebeaf[_0xb995('0x20')]){if(_0x4ebeaf[_0xb995('0x20')][_0xb995('0x21')]===0x1f4){logger[_0xb995('0x20')](_0xb995('0x1f'),_0xb995('0x1c'),_0x4ebeaf[_0xb995('0x20')]);}}})[_0xb995('0x22')](function(_0x46331c){logger[_0xb995('0x20')](_0xb995('0x1f'),_0xb995('0x1c'),_0x46331c);});}function afterCreateMessage(_0x21c1e1,_0x328e5a){return function(_0x4cdab1,_0x43e9ff){_0x4cdab1=_0x4cdab1['get']({'plain':!![]});_0x4cdab1['channel']=_0x21c1e1;_0x4cdab1[_0xb995('0x23')]=_0x4cdab1[_0xb995('0x24')];return db[_0xb995('0x25')][_0xb995('0x26')]()[_0xb995('0x1d')](function(_0x445f45){var _0x49b815=[];for(var _0x118448=0x0;_0x118448=_0x27afb5['agents']){throw Error(_0x7696('0x13'));}_0x3c262e(_0x194c5a);})[_0x7696('0x14')](function(_0x33965a){_0x5f0ea6(_0x33965a);});});}; \ No newline at end of file +var _0x0da8=['role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','updateAttributes','getLicense'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0da8,0x187));var _0x80da=function(_0xd4e6b4,_0x14394e){_0xd4e6b4=_0xd4e6b4-0x0;var _0x63f282=_0x0da8[_0xd4e6b4];return _0x63f282;};'use strict';var _=require(_0x80da('0x0'));var BPromise=require(_0x80da('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x80da('0x2'));var channels=[_0x80da('0x3'),_0x80da('0x4'),_0x80da('0x5'),_0x80da('0x6'),_0x80da('0x7'),_0x80da('0x8'),_0x80da('0x9')];exports[_0x80da('0xa')]=function(){return channels;};exports[_0x80da('0xb')]=function(_0x217122){_0x217122=_0x217122[_0x80da('0xc')]();return _[_0x80da('0xd')](channels,_0x217122);};exports[_0x80da('0xe')]=function(_0xc8e2a8,_0x687bf7,_0x33d447,_0x3bffee){var _0x29eefa={'loginAttempts':_0x687bf7,'blocked':_0x33d447};if(!_['isUndefined'](_0x3bffee)){_0x29eefa['blockedAt']=_0x3bffee;}return _0xc8e2a8[_0x80da('0xf')](_0x29eefa);};exports[_0x80da('0x10')]=function(_0x558a86){return new BPromise(function(_0x5f417f,_0x4c53dc){var _0x2717de=0x0;if(_0x558a86[_0x80da('0x11')]!=='agent'){_0x5f417f(_0x558a86);}db[_0x80da('0x12')][_0x80da('0x13')]({'where':{'role':_0x80da('0x14'),'online':!![],'id':{'$ne':_0x558a86['id']}}})[_0x80da('0x15')](function(_0x217f56){_0x2717de=_0x217f56;return util[_0x80da('0x10')]();})[_0x80da('0x15')](function(_0x44a980){if(_0x44a980&&_0x44a980[_0x80da('0x16')]&&_0x2717de>=_0x44a980['agents']){throw Error(_0x80da('0x17'));}_0x5f417f(_0x558a86);})['catch'](function(_0x431104){_0x4c53dc(_0x431104);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index daa6f96..be4ed80 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8120=['status','json','send','exports'];(function(_0x57f1bc,_0x103651){var _0x57649d=function(_0x251c28){while(--_0x251c28){_0x57f1bc['push'](_0x57f1bc['shift']());}};_0x57649d(++_0x103651);}(_0x8120,0x8b));var _0x0812=function(_0x46516f,_0x3ce26e){_0x46516f=_0x46516f-0x0;var _0x5df1e0=_0x8120[_0x46516f];return _0x5df1e0;};'use strict';module[_0x0812('0x0')][0x194]=function pageNotFound(_0x3d978f,_0x5d1394){var _0x4e2c3f='404';var _0x3e6ff3=0x194;var _0x2ca881={'status':_0x3e6ff3};_0x5d1394[_0x0812('0x1')](_0x2ca881['status']);_0x5d1394['render'](_0x4e2c3f,{},function(_0x39257e,_0x5befe1){if(_0x39257e){return _0x5d1394[_0x0812('0x1')](_0x2ca881[_0x0812('0x1')])[_0x0812('0x2')](_0x2ca881);}_0x5d1394[_0x0812('0x3')](_0x5befe1);});}; \ No newline at end of file +var _0x061e=['exports','404','status','render','json','send'];(function(_0x31688a,_0x588c7d){var _0xc7b088=function(_0x3ed4c8){while(--_0x3ed4c8){_0x31688a['push'](_0x31688a['shift']());}};_0xc7b088(++_0x588c7d);}(_0x061e,0xd8));var _0xe061=function(_0x91222a,_0x3caf9c){_0x91222a=_0x91222a-0x0;var _0x2a6796=_0x061e[_0x91222a];return _0x2a6796;};'use strict';module[_0xe061('0x0')][0x194]=function pageNotFound(_0x42eb04,_0x597a8c){var _0x1767f0=_0xe061('0x1');var _0x401b5b=0x194;var _0x45c554={'status':_0x401b5b};_0x597a8c[_0xe061('0x2')](_0x45c554['status']);_0x597a8c[_0xe061('0x3')](_0x1767f0,{},function(_0x22fe07,_0x402cd0){if(_0x22fe07){return _0x597a8c['status'](_0x45c554[_0xe061('0x2')])[_0xe061('0x4')](_0x45c554);}_0x597a8c[_0xe061('0x5')](_0x402cd0);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 330fdbe..0678d6f 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80b1=['MailQueue','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Sound','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperFinals','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','Agents','BlackLists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','Imap','Disposition','Dispositions','CannedAnswer','Interactions','MailApplication','Applications','ListId','mandatoryDispositionPauseId','Teams','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Account','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','DashboardItem','FaxAccountId','Answers','Exntensions','Tag','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','OpenchannelQueueReport','Agent','ChatQueue','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','team_has_chat_queues','chat_group_has_users','CompanyId','Phones','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','Subject','Description','FieldId','SugarcrmAccount','Configurations','SugarcrmField','DescriptionId','Field','VariableId','DeskAccount','DeskField','int_desk_configuration_has_tags','ZohoField','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','Dynamics365Configuration','ChatInternalMessage','ToId','SessionId','SmsQueueReport','ProjectId','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromAgent','ToChatQueueId','ToFaxAccountId','ToUserId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','userProfileId','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','jstz','determine','defaultsDeep','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','database','username','options','password','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/campaign/campaign.model','Migration','Attachment','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','hasMany','VoiceRecording','UserId','UserVoiceQueueRt','Extensions','ReportAgentPreview','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','ChatGroup','cm_user_has_contacts','Lists','cm_user_has_lists','Team','ChatInteractions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x80b1,0xd6));var _0x180b=function(_0x5eec91,_0x2c1d91){_0x5eec91=_0x5eec91-0x0;var _0x41cacf=_0x80b1[_0x5eec91];return _0x41cacf;};'use strict';var path=require(_0x180b('0x0'));var config=require(_0x180b('0x1'));var Sequelize=require(_0x180b('0x2'));var _=require('lodash');var jstz=require(_0x180b('0x3'));var timezone=jstz[_0x180b('0x4')]();config['sequelize']=_[_0x180b('0x5')](config[_0x180b('0x2')],{'database':'motion2','username':'xcall','password':_0x180b('0x6'),'options':{'host':_0x180b('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x180b('0x8')},'logging':![],'timezone':timezone[_0x180b('0x9')](),'define':{'charset':_0x180b('0xa'),'collate':_0x180b('0xb')}}});config[_0x180b('0xc')]=_['defaultsDeep'](config[_0x180b('0xc')],{'database':'motion2','username':_0x180b('0xd'),'password':_0x180b('0x6'),'options':{'host':_0x180b('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x180b('0x8')},'logging':![],'timezone':timezone[_0x180b('0x9')](),'define':{'charset':_0x180b('0xa'),'collate':_0x180b('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x180b('0x2')][_0x180b('0xe')],config['sequelize'][_0x180b('0xf')],config[_0x180b('0x2')]['password'],config[_0x180b('0x2')][_0x180b('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x180b('0xc')][_0x180b('0xe')],config[_0x180b('0xc')][_0x180b('0xf')],config[_0x180b('0xc')][_0x180b('0x11')],config[_0x180b('0xc')][_0x180b('0x10')])};db[_0x180b('0x12')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x14'));db['VoiceChanSpy']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x15'));db[_0x180b('0x16')]=db[_0x180b('0x2')]['import'](_0x180b('0x17'));db[_0x180b('0x18')]=db[_0x180b('0x2')]['import']('../api/voiceExtension/voiceExtension.model');db[_0x180b('0x19')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x1a'));db[_0x180b('0x1b')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x1c'));db['VoiceRecording']=db[_0x180b('0x2')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x180b('0x1d')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/screenRecording/screenRecording.model');db[_0x180b('0x1e')]=db[_0x180b('0x2')]['import']('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x180b('0x2')]['import'](_0x180b('0x1f'));db[_0x180b('0x20')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x21'));db[_0x180b('0x22')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x23'));db[_0x180b('0x24')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x25'));db[_0x180b('0x26')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x27'));db[_0x180b('0x28')]=db['sequelize']['import'](_0x180b('0x29'));db[_0x180b('0x2a')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x2b'));db[_0x180b('0x2c')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x2d'));db['UserVoiceQueueRt']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x2e'));db[_0x180b('0x2f')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x30'));db[_0x180b('0x31')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x180b('0x2')]['import'](_0x180b('0x32'));db[_0x180b('0x33')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x34'));db[_0x180b('0x35')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x36'));db[_0x180b('0x37')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x180b('0x38')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x39'));db[_0x180b('0x3a')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x180b('0x3b')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x3c'));db[_0x180b('0x3d')]=db[_0x180b('0x2')]['import'](_0x180b('0x3e'));db['MailQueue']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x180b('0x3f')]=db['sequelize']['import'](_0x180b('0x40'));db[_0x180b('0x41')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x42'));db['MailApplication']=db['sequelize']['import'](_0x180b('0x43'));db[_0x180b('0x44')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x45'));db[_0x180b('0x46')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x180b('0x47')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x48'));db[_0x180b('0x49')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/faxApplication/faxApplication.model');db[_0x180b('0x4a')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x4b'));db[_0x180b('0x4c')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x4d'));db[_0x180b('0x4e')]=db[_0x180b('0x2')]['import'](_0x180b('0x4f'));db['FaxQueueReport']=db[_0x180b('0x2')]['import'](_0x180b('0x50'));db[_0x180b('0x51')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/smsAccount/smsAccount.model');db[_0x180b('0x52')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x53'));db[_0x180b('0x54')]=db['sequelize'][_0x180b('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0x180b('0x55')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x56'));db[_0x180b('0x57')]=db[_0x180b('0x2')]['import'](_0x180b('0x58'));db[_0x180b('0x59')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x5a'));db['OpenchannelApplication']=db['sequelize'][_0x180b('0x13')](_0x180b('0x5b'));db[_0x180b('0x5c')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x180b('0x5d')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x5e'));db[_0x180b('0x5f')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x60'));db['OpenchannelQueueReport']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x180b('0x61')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x62'));db[_0x180b('0x63')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x64'));db[_0x180b('0x65')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x66'));db[_0x180b('0x67')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0x180b('0x13')](_0x180b('0x68'));db['ChatGroup']=db['sequelize'][_0x180b('0x13')](_0x180b('0x69'));db[_0x180b('0x6a')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x6b'));db[_0x180b('0x6c')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x6d'));db['CmContact']=db['sequelize']['import'](_0x180b('0x6e'));db[_0x180b('0x6f')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x70'));db[_0x180b('0x71')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x72'));db[_0x180b('0x73')]=db[_0x180b('0x2')]['import'](_0x180b('0x74'));db[_0x180b('0x75')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x180b('0x76')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x77'));db[_0x180b('0x78')]=db['sequelize']['import']('../api/action/action.model');db[_0x180b('0x79')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/automation/automation.model');db['CannedAnswer']=db['sequelize'][_0x180b('0x13')](_0x180b('0x7a'));db['Disposition']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x7b'));db['Condition']=db[_0x180b('0x2')]['import']('../api/condition/condition.model');db[_0x180b('0x7c')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x7d'));db[_0x180b('0x7e')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/pause/pause.model');db[_0x180b('0x7f')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x80'));db[_0x180b('0x81')]=db[_0x180b('0x2')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x180b('0x82')]=db['sequelize']['import'](_0x180b('0x83'));db['Sound']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x84'));db['Tag']=db['sequelize'][_0x180b('0x13')](_0x180b('0x85'));db[_0x180b('0x86')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x87'));db[_0x180b('0x88')]=db['sequelize']['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0x180b('0x89')]=db[_0x180b('0x2')]['import'](_0x180b('0x8a'));db[_0x180b('0x8b')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x8c'));db[_0x180b('0x8d')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/trigger/trigger.model');db[_0x180b('0x8e')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x8f'));db[_0x180b('0x90')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x91'));db['IntegrationReport']=db['sequelize'][_0x180b('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x180b('0x2')]['import'](_0x180b('0x92'));db[_0x180b('0x93')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x94'));db['AnalyticExtractedReport']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x95'));db['AnalyticMetric']=db[_0x180b('0x2')]['import'](_0x180b('0x96'));db[_0x180b('0x97')]=db['sequelize'][_0x180b('0x13')](_0x180b('0x98'));db['AnalyticTreeReport']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x99'));db[_0x180b('0x9a')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x9b'));db[_0x180b('0x9c')]=db[_0x180b('0x2')]['import'](_0x180b('0x9d'));db[_0x180b('0x9e')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x9f'));db[_0x180b('0xa0')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xa1'));db['SugarcrmField']=db[_0x180b('0x2')]['import'](_0x180b('0xa2'));db['DeskAccount']=db[_0x180b('0x2')]['import'](_0x180b('0xa3'));db[_0x180b('0xa4')]=db[_0x180b('0x2')]['import'](_0x180b('0xa5'));db['DeskField']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xa6'));db[_0x180b('0xa7')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xa8'));db[_0x180b('0xa9')]=db[_0x180b('0x2')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/intZohoField/intZohoField.model');db[_0x180b('0xaa')]=db[_0x180b('0x2')]['import'](_0x180b('0xab'));db['ZendeskConfiguration']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xac'));db[_0x180b('0xad')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x180b('0xae')]=db['sequelize'][_0x180b('0x13')](_0x180b('0xaf'));db[_0x180b('0xb0')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xb1'));db[_0x180b('0xb2')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xb3'));db['VtigerAccount']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x180b('0xb4')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xb5'));db['VtigerField']=db[_0x180b('0x2')]['import'](_0x180b('0xb6'));db[_0x180b('0xb7')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xb8'));db[_0x180b('0xb9')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x180b('0xba')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xbb'));db[_0x180b('0xbc')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xbd'));db['Dynamics365Configuration']=db['sequelize'][_0x180b('0x13')](_0x180b('0xbe'));db[_0x180b('0xbf')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x180b('0xc0')]=db['sequelize'][_0x180b('0x13')](_0x180b('0xc1'));db[_0x180b('0xc2')]=db[_0x180b('0x2')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x180b('0xc3')]=db['sequelize'][_0x180b('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x180b('0x90')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0x91'));db['Network']=db['sequelize']['import'](_0x180b('0xc4'));db[_0x180b('0xc5')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xc6'));db['ChatInternalMessage']=db['sequelize'][_0x180b('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x180b('0xc7')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xc8'));db[_0x180b('0xc9')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xca'));db[_0x180b('0xcb')]=db['sequelize'][_0x180b('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xcc'));db[_0x180b('0xcd')]=db[_0x180b('0x2')]['import'](_0x180b('0xce'));db[_0x180b('0xcf')]=db[_0x180b('0x2')]['import'](_0x180b('0xd0'));db[_0x180b('0xd1')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xd2'));db[_0x180b('0xd3')]=db['sequelize'][_0x180b('0x13')](_0x180b('0xd4'));db['SquareOdbc']=db[_0x180b('0x2')]['import'](_0x180b('0xd5'));db['SquareProject']=db[_0x180b('0x2')]['import'](_0x180b('0xd6'));db['SquareRecording']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/squareRecording/squareRecording.model');db[_0x180b('0xd7')]=db['sequelize']['import'](_0x180b('0xd8'));db['Team']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xd9'));db[_0x180b('0xda')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/license/license.model');db['Campaign']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xdb'));db[_0x180b('0xdc')]=db[_0x180b('0x2')]['import']('../api/migration/migration.model');db[_0x180b('0xdd')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/attachment/attachment.model');db['Plugin']=db[_0x180b('0x2')]['import'](_0x180b('0xde'));db['MailTransferReport']=db['sequelize'][_0x180b('0x13')](_0x180b('0xdf'));db[_0x180b('0xe0')]=db[_0x180b('0x2')]['import'](_0x180b('0xe1'));db[_0x180b('0xe2')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xe3'));db[_0x180b('0xe4')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xe5'));db[_0x180b('0xe6')]=db[_0x180b('0x2')]['import'](_0x180b('0xe7'));db[_0x180b('0xe8')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xe9'));db[_0x180b('0xea')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xeb'));db[_0x180b('0xec')]=db[_0x180b('0x2')]['import']('../api/userProfile/userProfile.model');db[_0x180b('0xed')]=db[_0x180b('0x2')]['import']('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xee'));db[_0x180b('0xef')]=db[_0x180b('0x2')][_0x180b('0x13')]('../api/userNotification/userNotification.model');db[_0x180b('0xf0')]=db[_0x180b('0x2')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x180b('0xf1')]=db[_0x180b('0x2')]['import'](_0x180b('0xf2'));db[_0x180b('0xf3')]=db[_0x180b('0x2')]['import'](_0x180b('0xf4'));db[_0x180b('0xf5')]=db[_0x180b('0x2')]['import'](_0x180b('0xf6'));db['WhatsappQueueReport']=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xf7'));db['WhatsappTransferReport']=db[_0x180b('0x2')]['import'](_0x180b('0xf8'));db[_0x180b('0xf9')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xfa'));db['CloudProvider']=db[_0x180b('0x2')][_0x180b('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0x180b('0xfb')]=db[_0x180b('0x2')][_0x180b('0x13')](_0x180b('0xfc'));db[_0x180b('0x12')][_0x180b('0xfd')](db[_0x180b('0x1e')],{'as':_0x180b('0x1e'),'onDelete':_0x180b('0xfe'),'foreignKey':'UserId'});db['User'][_0x180b('0xff')](db[_0x180b('0x100')],{'as':'Recordings','foreignKey':_0x180b('0x101')});db[_0x180b('0x12')]['hasMany'](db[_0x180b('0x102')],{'as':'VoiceQueuesRt','foreignKey':_0x180b('0x101')});db[_0x180b('0x12')]['hasMany'](db['VoiceExtension'],{'as':_0x180b('0x103'),'onDelete':_0x180b('0xfe'),'hooks':!![]});db[_0x180b('0x12')][_0x180b('0xff')](db[_0x180b('0x73')],{'as':'HopperFinals','foreignKey':_0x180b('0x101')});db[_0x180b('0x12')][_0x180b('0xff')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x180b('0x101')});db[_0x180b('0x12')][_0x180b('0xff')](db['ReportAgentPreview'],{'as':_0x180b('0x104'),'foreignKey':'UserId'});db[_0x180b('0x12')][_0x180b('0xff')](db[_0x180b('0x5c')],{'as':'OpenchannelInteractions','foreignKey':_0x180b('0x101')});db['User']['hasMany'](db[_0x180b('0x63')],{'as':'ChatInteractions','foreignKey':_0x180b('0x101')});db[_0x180b('0x12')]['hasMany'](db[_0x180b('0x54')],{'as':'SmsInteractions','foreignKey':_0x180b('0x101')});db[_0x180b('0x12')][_0x180b('0xff')](db[_0x180b('0x4a')],{'as':_0x180b('0x105'),'foreignKey':_0x180b('0x101')});db[_0x180b('0x12')]['hasMany'](db[_0x180b('0x3f')],{'as':_0x180b('0x106'),'foreignKey':'UserId'});db[_0x180b('0x12')][_0x180b('0xff')](db[_0x180b('0xf3')],{'as':_0x180b('0x107'),'foreignKey':_0x180b('0x101')});db[_0x180b('0x12')][_0x180b('0xff')](db[_0x180b('0xef')],{'as':_0x180b('0x108'),'foreignKey':_0x180b('0x109')});db[_0x180b('0x12')][_0x180b('0x10a')](db['UserProfile'],{'as':_0x180b('0xec'),'foreignKey':'userProfileId'});db['User'][_0x180b('0x10b')](db[_0x180b('0x10c')],{'as':'Groups','through':'chat_group_has_users'});db[_0x180b('0x12')][_0x180b('0x10b')](db['CmContact'],{'as':'Contacts','through':_0x180b('0x10d')});db['User'][_0x180b('0x10b')](db[_0x180b('0xe8')],{'as':_0x180b('0x10e'),'through':_0x180b('0x10f')});db[_0x180b('0x12')][_0x180b('0x10b')](db[_0x180b('0x110')],{'through':'user_has_teams'});db[_0x180b('0x12')]['belongsToMany'](db['MailInteraction'],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x180b('0x12')]['belongsToMany'](db[_0x180b('0x63')],{'as':_0x180b('0x111'),'through':'user_has_chat_interactions'});db[_0x180b('0x12')]['belongsToMany'](db[_0x180b('0x4a')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User']['belongsToMany'](db['SmsInteraction'],{'as':_0x180b('0x112'),'through':_0x180b('0x113')});db[_0x180b('0x12')][_0x180b('0x10b')](db[_0x180b('0x5c')],{'as':'OpenchannelInteractions','through':_0x180b('0x114')});db['User'][_0x180b('0x10b')](db[_0x180b('0xf3')],{'as':_0x180b('0x107'),'through':_0x180b('0x115')});db[_0x180b('0x12')][_0x180b('0x10b')](db['VoiceQueue'],{'as':_0x180b('0x116'),'through':_0x180b('0x2f'),'required':![]});db[_0x180b('0x12')][_0x180b('0x10b')](db[_0x180b('0x117')],{'as':_0x180b('0x118'),'through':_0x180b('0x119'),'required':![]});db[_0x180b('0x12')][_0x180b('0x10b')](db['ChatQueue'],{'as':_0x180b('0x11a'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x180b('0x12')][_0x180b('0x10b')](db['FaxQueue'],{'as':_0x180b('0x11b'),'through':_0x180b('0x33'),'required':![]});db[_0x180b('0x12')][_0x180b('0x10b')](db[_0x180b('0x57')],{'as':_0x180b('0x11c'),'through':_0x180b('0x35'),'required':![]});db[_0x180b('0x12')][_0x180b('0x10b')](db['OpenchannelQueue'],{'as':_0x180b('0x11d'),'through':_0x180b('0x37'),'required':![]});db[_0x180b('0x12')][_0x180b('0x10b')](db[_0x180b('0xf9')],{'as':_0x180b('0x11e'),'through':_0x180b('0x38'),'required':![]});db[_0x180b('0x12')][_0x180b('0x10b')](db[_0x180b('0xe8')],{'through':'cm_user_has_lists'});db['User'][_0x180b('0x10b')](db['VoicePrefix'],{'as':_0x180b('0x11f'),'through':_0x180b('0x120'),'required':![]});db[_0x180b('0x12')]['belongsToMany'](db[_0x180b('0x121')],{'as':_0x180b('0x122'),'through':'user_has_chat_websites'});db[_0x180b('0x12')][_0x180b('0x10b')](db[_0x180b('0x47')],{'as':_0x180b('0x123'),'through':'user_has_fax_accounts'});db[_0x180b('0x12')][_0x180b('0x10b')](db[_0x180b('0x3d')],{'as':_0x180b('0x124'),'through':_0x180b('0x125')});db[_0x180b('0x12')]['belongsToMany'](db[_0x180b('0x59')],{'as':_0x180b('0x126'),'through':_0x180b('0x127')});db[_0x180b('0x12')]['belongsToMany'](db[_0x180b('0x51')],{'as':_0x180b('0x128'),'through':_0x180b('0x129')});db['User'][_0x180b('0x10b')](db[_0x180b('0xf0')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x180b('0x12')][_0x180b('0x10b')](db['SquareProject'],{'as':_0x180b('0x12a'),'through':_0x180b('0x12b')});db[_0x180b('0x12c')]['hasMany'](db[_0x180b('0x18')],{'as':_0x180b('0x12d'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x12e')});db[_0x180b('0x16')][_0x180b('0xff')](db[_0x180b('0x18')],{'onDelete':_0x180b('0xfe')});db[_0x180b('0x18')]['hasMany'](db[_0x180b('0x18')],{'as':'Applications','onDelete':'cascade'});db['VoiceMusicOnHold'][_0x180b('0x10b')](db[_0x180b('0x12f')],{'as':_0x180b('0x130'),'through':_0x180b('0x131')});db[_0x180b('0x1b')]['hasMany'](db[_0x180b('0x102')],{'as':_0x180b('0x132'),'foreignKey':'VoiceQueueId'});db[_0x180b('0x1b')]['hasMany'](db[_0x180b('0x6f')],{'as':_0x180b('0x133'),'foreignKey':_0x180b('0x134')});db['VoiceQueue'][_0x180b('0xff')](db[_0x180b('0x73')],{'as':_0x180b('0x135'),'foreignKey':'VoiceQueueId'});db[_0x180b('0x1b')][_0x180b('0xff')](db[_0x180b('0x75')],{'as':_0x180b('0x136'),'foreignKey':_0x180b('0x134')});db[_0x180b('0x1b')][_0x180b('0xff')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x180b('0x134')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x180b('0x1b')][_0x180b('0xff')](db['JscriptySessionReport'],{'as':_0x180b('0x137'),'foreignKey':_0x180b('0x134')});db[_0x180b('0x1b')][_0x180b('0x10a')](db['Trunk'],{'as':'Trunk','foreignKey':_0x180b('0x138')});db[_0x180b('0x1b')][_0x180b('0x10a')](db[_0x180b('0x2a')],{'as':_0x180b('0x139'),'foreignKey':'TrunkBackupId'});db[_0x180b('0x1b')][_0x180b('0x10a')](db[_0x180b('0x7c')],{'as':_0x180b('0x7c'),'foreignKey':_0x180b('0x13a')});db['VoiceQueue'][_0x180b('0x10a')](db[_0x180b('0x7e')],{'as':_0x180b('0x13b'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db[_0x180b('0xe8')],{'as':_0x180b('0x10e'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':'UserVoiceQueue'});db[_0x180b('0x1b')][_0x180b('0x10b')](db[_0x180b('0x110')],{'as':'Teams','through':_0x180b('0xfb')});db['VoiceQueue'][_0x180b('0x10b')](db[_0x180b('0xe8')],{'as':_0x180b('0x13d'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x180b('0x10a')](db['User'],{'as':'User','foreignKey':_0x180b('0x101')});db['ScreenRecording'][_0x180b('0x10a')](db['User'],{'as':_0x180b('0x12'),'foreignKey':_0x180b('0x101')});db[_0x180b('0x1e')][_0x180b('0xff')](db[_0x180b('0x13e')],{'as':_0x180b('0x13f'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x140'),'sourceKey':_0x180b('0x141')});db[_0x180b('0x13e')][_0x180b('0x10a')](db['VoiceMail'],{'foreignKey':_0x180b('0x140'),'targetKey':_0x180b('0x141')});db[_0x180b('0x20')][_0x180b('0xff')](db[_0x180b('0x26')],{'as':_0x180b('0x142'),'foreignKey':_0x180b('0x143'),'constraints':![]});db[_0x180b('0x20')][_0x180b('0xff')](db[_0x180b('0x24')],{'as':_0x180b('0x144'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':'User','foreignKey':_0x180b('0x101')});db['VoiceCallReport'][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x3a')][_0x180b('0x10a')](db[_0x180b('0x3d')],{'as':_0x180b('0x3d'),'foreignKey':_0x180b('0x148')});db[_0x180b('0x3b')][_0x180b('0x10a')](db[_0x180b('0x3d')],{'as':_0x180b('0x3d'),'foreignKey':_0x180b('0x148')});db[_0x180b('0x3d')]['hasOne'](db[_0x180b('0x3a')],{'as':_0x180b('0x149'),'onDelete':_0x180b('0xfe')});db['MailAccount']['hasOne'](db[_0x180b('0x3b')],{'as':'Smtp','onDelete':_0x180b('0xfe')});db['MailAccount']['hasMany'](db[_0x180b('0x14a')],{'as':_0x180b('0x14b'),'foreignKey':'MailAccountId'});db[_0x180b('0x3d')]['hasMany'](db[_0x180b('0x14c')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x180b('0x3d')]['hasMany'](db[_0x180b('0x41')],{'as':_0x180b('0x13f'),'foreignKey':_0x180b('0x148')});db[_0x180b('0x3d')][_0x180b('0xff')](db[_0x180b('0x3f')],{'as':_0x180b('0x14d')});db['MailAccount']['hasMany'](db[_0x180b('0x14e')],{'as':_0x180b('0x14f')});db[_0x180b('0x3d')]['belongsTo'](db[_0x180b('0xe8')],{'as':'List','foreignKey':_0x180b('0x150')});db[_0x180b('0x3d')][_0x180b('0x10a')](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db[_0x180b('0x3d')][_0x180b('0x10a')](db[_0x180b('0x7e')],{'as':_0x180b('0x13b'),'foreignKey':_0x180b('0x151')});db[_0x180b('0x3d')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':_0x180b('0x125')});db[_0x180b('0x117')]['belongsToMany'](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':_0x180b('0x119')});db['MailQueue'][_0x180b('0x10b')](db[_0x180b('0x110')],{'through':'team_has_mail_queues','as':_0x180b('0x152')});db['MailInteraction']['hasMany'](db[_0x180b('0x41')],{'as':'Messages','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x153')});db[_0x180b('0x3f')]['belongsTo'](db[_0x180b('0x3d')],{'as':'Account','foreignKey':_0x180b('0x148')});db['MailInteraction'][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':'Contact','foreignKey':_0x180b('0x147')});db[_0x180b('0x3f')][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':_0x180b('0x154'),'foreignKey':_0x180b('0x101')});db[_0x180b('0x3f')]['belongsToMany'](db['Tag'],{'through':_0x180b('0x155'),'as':_0x180b('0x156')});db['MailInteraction'][_0x180b('0x10b')](db['Tag'],{'through':_0x180b('0x155'),'as':_0x180b('0x157')});db['MailInteraction'][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x158'),'through':_0x180b('0x159'),'foreignKey':'MailInteractionId'});db[_0x180b('0x41')][_0x180b('0xff')](db[_0x180b('0xdd')],{'as':'Attachments','onDelete':_0x180b('0xfe')});db['MailMessage'][_0x180b('0x10a')](db['User'],{'as':_0x180b('0x12')});db[_0x180b('0x41')][_0x180b('0x10a')](db[_0x180b('0x145')],{'onDelete':_0x180b('0xfe'),'as':'Contact'});db[_0x180b('0x41')][_0x180b('0x10a')](db[_0x180b('0x3f')],{'as':'Interaction','foreignKey':_0x180b('0x153')});db[_0x180b('0x41')][_0x180b('0x10a')](db[_0x180b('0x3d')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x148')});db['MailMessage'][_0x180b('0x10a')](db[_0x180b('0x121')],{'as':_0x180b('0x121'),'foreignKey':_0x180b('0x15b')});db['MailMessage'][_0x180b('0x10a')](db[_0x180b('0x67')],{'as':'ChatOfflineMessage','foreignKey':_0x180b('0x15c')});db[_0x180b('0x14e')][_0x180b('0x10a')](db[_0x180b('0x12')],{'onDelete':_0x180b('0x15d')});db[_0x180b('0x14e')]['belongsTo'](db['MailQueue'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db['MailAccount'],{'onDelete':'restrict'});db[_0x180b('0x14e')][_0x180b('0x10a')](db[_0x180b('0x7c')],{'onDelete':_0x180b('0x15d'),'foreignKey':'IntervalId'});db[_0x180b('0x14e')]['belongsTo'](db['Tag'],{'onDelete':_0x180b('0x15d'),'foreignKey':_0x180b('0x15e')});db[_0x180b('0x44')][_0x180b('0x10a')](db[_0x180b('0x3d')],{});db[_0x180b('0x44')][_0x180b('0x10a')](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':'ListId'});db[_0x180b('0x44')][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x44')][_0x180b('0x10a')](db[_0x180b('0x3f')],{});db[_0x180b('0x44')][_0x180b('0x10a')](db['MailMessage'],{});db[_0x180b('0x44')][_0x180b('0x10a')](db[_0x180b('0x12')],{});db[_0x180b('0x44')][_0x180b('0x10a')](db[_0x180b('0x117')],{});db[_0x180b('0x46')]['hasMany'](db[_0x180b('0x160')],{'as':'Items','onDelete':_0x180b('0xfe')});db[_0x180b('0x47')][_0x180b('0xff')](db[_0x180b('0x14a')],{'as':_0x180b('0x14b'),'foreignKey':_0x180b('0x161')});db[_0x180b('0x47')]['hasMany'](db[_0x180b('0x14c')],{'as':_0x180b('0x162'),'foreignKey':'FaxAccountId'});db[_0x180b('0x47')][_0x180b('0xff')](db[_0x180b('0x4a')],{'as':'Interactions'});db[_0x180b('0x47')][_0x180b('0xff')](db[_0x180b('0x49')],{'as':_0x180b('0x14f')});db['FaxAccount'][_0x180b('0xff')](db[_0x180b('0x18')],{'as':_0x180b('0x163'),'onDelete':_0x180b('0xfe')});db['FaxAccount'][_0x180b('0xff')](db['FaxMessage'],{'as':_0x180b('0x13f')});db[_0x180b('0x47')][_0x180b('0x10a')](db[_0x180b('0x2a')],{'as':_0x180b('0x2a')});db['FaxAccount'][_0x180b('0x10a')](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':_0x180b('0x150')});db[_0x180b('0x47')]['belongsTo'](db[_0x180b('0x7e')],{'as':_0x180b('0x13b'),'foreignKey':_0x180b('0x151')});db[_0x180b('0x47')][_0x180b('0x10b')](db['User'],{'as':_0x180b('0x13c'),'through':'user_has_fax_accounts'});db[_0x180b('0x49')]['belongsTo'](db[_0x180b('0x12')],{'onDelete':_0x180b('0x15d')});db[_0x180b('0x49')][_0x180b('0x10a')](db['FaxQueue'],{'onDelete':_0x180b('0x15d')});db[_0x180b('0x49')][_0x180b('0x10a')](db[_0x180b('0x47')],{'onDelete':_0x180b('0x15d')});db[_0x180b('0x49')]['belongsTo'](db[_0x180b('0x164')],{'onDelete':_0x180b('0x15d'),'foreignKey':_0x180b('0x15e')});db[_0x180b('0x4a')][_0x180b('0xff')](db['FaxMessage'],{'as':_0x180b('0x13f'),'onDelete':'cascade','foreignKey':_0x180b('0x165')});db[_0x180b('0x4a')][_0x180b('0x10a')](db['FaxAccount'],{'as':_0x180b('0x15a'),'foreignKey':'FaxAccountId'});db[_0x180b('0x4a')][_0x180b('0x10a')](db['CmContact'],{'as':'Contact','foreignKey':_0x180b('0x147')});db[_0x180b('0x4a')][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':_0x180b('0x154'),'foreignKey':_0x180b('0x101')});db[_0x180b('0x4a')][_0x180b('0x10b')](db['Tag'],{'through':_0x180b('0x166'),'as':_0x180b('0x156')});db[_0x180b('0x4a')][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':'fax_interaction_has_tags','as':_0x180b('0x157')});db['FaxInteraction'][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':'Users','through':_0x180b('0x167'),'foreignKey':'FaxInteractionId'});db[_0x180b('0x4c')][_0x180b('0x10a')](db[_0x180b('0x12')],{'onDelete':_0x180b('0xfe'),'as':_0x180b('0x12')});db[_0x180b('0x4c')]['belongsTo'](db[_0x180b('0x4a')],{'as':'Interaction','foreignKey':_0x180b('0x165')});db[_0x180b('0x4c')][_0x180b('0x10a')](db[_0x180b('0x145')],{'onDelete':'cascade','as':'Contact'});db[_0x180b('0x4c')]['belongsTo'](db[_0x180b('0xdd')],{'as':_0x180b('0xdd'),'foreignKey':_0x180b('0x168')});db[_0x180b('0x4c')]['belongsTo'](db[_0x180b('0x47')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x161')});db[_0x180b('0x4e')]['belongsToMany'](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':'UserFaxQueue'});db['FaxQueue'][_0x180b('0x10b')](db[_0x180b('0x110')],{'through':_0x180b('0x169'),'as':_0x180b('0x152')});db[_0x180b('0x16a')][_0x180b('0x10a')](db[_0x180b('0x47')],{});db[_0x180b('0x16a')][_0x180b('0x10a')](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':'ListId'});db[_0x180b('0x16a')]['belongsTo'](db[_0x180b('0x145')],{'as':'Contact','foreignKey':_0x180b('0x147')});db[_0x180b('0x16a')]['belongsTo'](db[_0x180b('0x4a')],{});db[_0x180b('0x16a')]['belongsTo'](db['FaxMessage'],{});db[_0x180b('0x16a')][_0x180b('0x10a')](db['User'],{});db['FaxQueueReport'][_0x180b('0x10a')](db[_0x180b('0x4e')],{});db[_0x180b('0x51')][_0x180b('0xff')](db[_0x180b('0x14a')],{'as':_0x180b('0x14b'),'foreignKey':_0x180b('0x16b')});db['SmsAccount'][_0x180b('0xff')](db[_0x180b('0x14c')],{'as':_0x180b('0x162'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x180b('0xff')](db[_0x180b('0x55')],{'as':_0x180b('0x13f'),'foreignKey':_0x180b('0x16b')});db[_0x180b('0x51')][_0x180b('0xff')](db[_0x180b('0x54')],{'as':_0x180b('0x14d')});db[_0x180b('0x51')][_0x180b('0xff')](db[_0x180b('0x52')],{'as':_0x180b('0x14f')});db[_0x180b('0x51')][_0x180b('0x10a')](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':_0x180b('0x150')});db['SmsAccount'][_0x180b('0x10a')](db[_0x180b('0x7e')],{'as':_0x180b('0x13b'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':_0x180b('0x129')});db[_0x180b('0x52')][_0x180b('0x10a')](db[_0x180b('0x12')],{'onDelete':_0x180b('0x15d')});db[_0x180b('0x52')][_0x180b('0x10a')](db[_0x180b('0x57')],{'onDelete':_0x180b('0x15d')});db[_0x180b('0x52')][_0x180b('0x10a')](db[_0x180b('0x51')],{'onDelete':_0x180b('0x15d')});db['SmsApplication'][_0x180b('0x10a')](db['Interval'],{'onDelete':_0x180b('0x15d'),'foreignKey':_0x180b('0x13a')});db[_0x180b('0x52')][_0x180b('0x10a')](db[_0x180b('0x164')],{'onDelete':_0x180b('0x15d'),'foreignKey':_0x180b('0x15e')});db[_0x180b('0x54')][_0x180b('0xff')](db[_0x180b('0x55')],{'as':'Messages','onDelete':_0x180b('0xfe'),'foreignKey':'SmsInteractionId'});db[_0x180b('0x54')][_0x180b('0x10a')](db['SmsAccount'],{'as':'Account','foreignKey':_0x180b('0x16b')});db['SmsInteraction'][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x54')]['belongsTo'](db[_0x180b('0x12')],{'as':_0x180b('0x154'),'foreignKey':'UserId'});db[_0x180b('0x54')]['belongsToMany'](db[_0x180b('0x164')],{'through':_0x180b('0x16c'),'as':_0x180b('0x156')});db['SmsInteraction'][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':'sms_interaction_has_tags','as':_0x180b('0x157')});db['SmsInteraction'][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x158'),'through':_0x180b('0x113'),'foreignKey':_0x180b('0x16d')});db[_0x180b('0x55')][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':'User'});db[_0x180b('0x55')]['belongsTo'](db[_0x180b('0x145')],{'onDelete':_0x180b('0xfe'),'as':_0x180b('0x146')});db['SmsMessage'][_0x180b('0x10a')](db[_0x180b('0x54')],{'onDelete':_0x180b('0xfe'),'as':_0x180b('0x16e'),'foreignKey':_0x180b('0x16d')});db[_0x180b('0x55')][_0x180b('0x10a')](db[_0x180b('0x51')],{'as':_0x180b('0x15a'),'foreignKey':'SmsAccountId'});db[_0x180b('0x57')]['belongsToMany'](db[_0x180b('0x12')],{'as':'Agents','through':_0x180b('0x35'),'foreignKey':_0x180b('0x16f')});db[_0x180b('0x57')][_0x180b('0x10b')](db['Team'],{'through':_0x180b('0x170'),'as':_0x180b('0x152')});db[_0x180b('0x59')][_0x180b('0xff')](db[_0x180b('0x14a')],{'as':_0x180b('0x14b'),'foreignKey':_0x180b('0x171')});db[_0x180b('0x59')][_0x180b('0xff')](db[_0x180b('0x14c')],{'as':_0x180b('0x162'),'foreignKey':_0x180b('0x171')});db[_0x180b('0x59')]['hasMany'](db[_0x180b('0x5c')],{'as':_0x180b('0x14d'),'foreignKey':_0x180b('0x171')});db['OpenchannelAccount'][_0x180b('0xff')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x180b('0x59')][_0x180b('0xff')](db['OpenchannelApplication'],{'as':_0x180b('0x14f'),'foreignKey':'OpenchannelAccountId'});db[_0x180b('0x59')][_0x180b('0x10a')](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':_0x180b('0x150')});db[_0x180b('0x59')][_0x180b('0x10a')](db[_0x180b('0x7e')],{'as':_0x180b('0x13b'),'foreignKey':_0x180b('0x151')});db[_0x180b('0x59')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':'Agents','through':_0x180b('0x127')});db[_0x180b('0x172')][_0x180b('0x10a')](db[_0x180b('0x12')],{'onDelete':_0x180b('0x15d')});db['OpenchannelApplication'][_0x180b('0x10a')](db[_0x180b('0x5f')],{'onDelete':_0x180b('0x15d'),'foreignKey':_0x180b('0x173')});db[_0x180b('0x172')]['belongsTo'](db[_0x180b('0x59')],{'onDelete':_0x180b('0x15d'),'foreignKey':_0x180b('0x171')});db[_0x180b('0x172')][_0x180b('0x10a')](db[_0x180b('0x7c')],{'onDelete':'restrict','foreignKey':_0x180b('0x13a')});db['OpenchannelApplication']['belongsTo'](db[_0x180b('0x164')],{'onDelete':'restrict','foreignKey':_0x180b('0x15e')});db[_0x180b('0x5c')][_0x180b('0xff')](db[_0x180b('0x5d')],{'as':_0x180b('0x13f'),'onDelete':'cascade','foreignKey':_0x180b('0x174')});db[_0x180b('0x5c')][_0x180b('0x10a')](db['OpenchannelAccount'],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x171')});db[_0x180b('0x5c')][_0x180b('0x10a')](db['CmContact'],{'as':'Contact','foreignKey':_0x180b('0x147')});db[_0x180b('0x5c')][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':'Owner','foreignKey':'UserId'});db['OpenchannelInteraction'][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':'openchannel_interaction_has_tags','as':_0x180b('0x156')});db['OpenchannelInteraction'][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':_0x180b('0x175'),'as':_0x180b('0x157')});db['OpenchannelInteraction'][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x158'),'through':_0x180b('0x114'),'foreignKey':'OpenchannelInteractionId'});db[_0x180b('0x5d')][_0x180b('0x10a')](db['User'],{'onDelete':'cascade','as':_0x180b('0x12')});db[_0x180b('0x5d')]['belongsTo'](db['CmContact'],{'onDelete':_0x180b('0xfe'),'as':_0x180b('0x146')});db[_0x180b('0x5d')][_0x180b('0x10a')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x180b('0x16e'),'foreignKey':_0x180b('0x174')});db['OpenchannelMessage'][_0x180b('0x10a')](db[_0x180b('0xdd')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x180b('0x5d')]['belongsTo'](db[_0x180b('0x59')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x171')});db[_0x180b('0x5f')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':_0x180b('0x37'),'foreignKey':_0x180b('0x173')});db['OpenchannelQueue']['belongsToMany'](db[_0x180b('0x110')],{'through':_0x180b('0x176'),'as':_0x180b('0x152')});db[_0x180b('0x121')][_0x180b('0xff')](db[_0x180b('0x14a')],{'as':_0x180b('0x14b'),'foreignKey':_0x180b('0x15b')});db[_0x180b('0x121')][_0x180b('0xff')](db[_0x180b('0x14c')],{'as':_0x180b('0x162'),'foreignKey':'ChatWebsiteId'});db[_0x180b('0x121')]['hasMany'](db[_0x180b('0x6a')],{'as':_0x180b('0x177')});db['ChatWebsite']['hasMany'](db[_0x180b('0x63')],{'as':'Interactions'});db['ChatWebsite'][_0x180b('0xff')](db[_0x180b('0x61')],{'as':_0x180b('0x14f')});db[_0x180b('0x121')][_0x180b('0xff')](db[_0x180b('0x65')],{'as':_0x180b('0x13f')});db['ChatWebsite']['belongsTo'](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':'ListId'});db[_0x180b('0x121')][_0x180b('0x10a')](db[_0x180b('0x7c')],{'as':_0x180b('0x7c'),'foreignKey':'IntervalId'});db[_0x180b('0x121')][_0x180b('0x10a')](db[_0x180b('0x3d')],{'as':_0x180b('0x3d'),'foreignKey':_0x180b('0x148')});db['ChatWebsite'][_0x180b('0x10a')](db['Pause'],{'as':_0x180b('0x13b'),'foreignKey':_0x180b('0x151')});db[_0x180b('0x121')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':_0x180b('0x178')});db['OpenchannelQueueReport'][_0x180b('0x10a')](db[_0x180b('0x59')],{});db['OpenchannelQueueReport'][_0x180b('0x10a')](db['CmList'],{'as':_0x180b('0x15f'),'foreignKey':_0x180b('0x150')});db[_0x180b('0x179')][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x179')]['belongsTo'](db[_0x180b('0x5c')],{});db[_0x180b('0x179')]['belongsTo'](db[_0x180b('0x5d')],{});db[_0x180b('0x179')][_0x180b('0x10a')](db[_0x180b('0x12')],{});db[_0x180b('0x179')][_0x180b('0x10a')](db[_0x180b('0x5f')],{});db[_0x180b('0x61')][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':_0x180b('0x17a'),'foreignKey':_0x180b('0x101'),'onDelete':_0x180b('0x15d')});db['ChatApplication'][_0x180b('0x10a')](db[_0x180b('0x17b')],{'as':_0x180b('0x17c'),'foreignKey':_0x180b('0x17d'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x180b('0x121')],{'as':_0x180b('0x17e'),'foreignKey':_0x180b('0x15b'),'onDelete':_0x180b('0x15d')});db[_0x180b('0x61')][_0x180b('0x10a')](db[_0x180b('0x164')],{'onDelete':_0x180b('0x15d'),'foreignKey':_0x180b('0x15e')});db[_0x180b('0x63')]['hasMany'](db[_0x180b('0x65')],{'as':_0x180b('0x13f'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x17f')});db[_0x180b('0x63')][_0x180b('0x10a')](db['ChatWebsite'],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x15b')});db[_0x180b('0x63')]['belongsTo'](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x63')]['belongsTo'](db[_0x180b('0x12')],{'as':_0x180b('0x154'),'foreignKey':'UserId'});db[_0x180b('0x63')][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':_0x180b('0x180'),'as':'Tags'});db[_0x180b('0x63')][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':_0x180b('0x180'),'as':_0x180b('0x157')});db['ChatInteraction'][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x158'),'through':_0x180b('0x181'),'foreignKey':'ChatInteractionId'});db[_0x180b('0x65')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x180b('0x12')});db['ChatMessage'][_0x180b('0x10a')](db['CmContact'],{'onDelete':_0x180b('0xfe'),'as':'Contact','foreignKey':'ContactId'});db[_0x180b('0x65')]['belongsTo'](db[_0x180b('0x63')],{'onDelete':_0x180b('0xfe'),'as':_0x180b('0x16e'),'foreignKey':_0x180b('0x17f')});db[_0x180b('0x65')]['belongsTo'](db[_0x180b('0xdd')],{'as':_0x180b('0xdd'),'foreignKey':_0x180b('0x168')});db[_0x180b('0x65')]['belongsTo'](db[_0x180b('0x121')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x15b')});db['ChatOfflineMessage'][_0x180b('0xff')](db[_0x180b('0xdd')],{'as':_0x180b('0x182'),'foreignKey':_0x180b('0x15c'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0x180b('0x10a')](db['CmContact'],{'onDelete':_0x180b('0xfe'),'as':_0x180b('0x146'),'foreignKey':'ContactId'});db[_0x180b('0x67')]['belongsTo'](db['ChatWebsite'],{'as':_0x180b('0x15a'),'foreignKey':'ChatWebsiteId'});db[_0x180b('0x17b')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':_0x180b('0x31'),'hooks':!![]});db[_0x180b('0x17b')][_0x180b('0x10b')](db[_0x180b('0x110')],{'through':_0x180b('0x183'),'as':_0x180b('0x152')});db['ChatGroup'][_0x180b('0xff')](db['ChatInternalMessage'],{'as':_0x180b('0x13f'),'foreignKey':'ChatGroupId','onDelete':_0x180b('0xfe')});db['ChatGroup'][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x132'),'through':_0x180b('0x184')});db[_0x180b('0x6a')][_0x180b('0x10a')](db[_0x180b('0x121')],{'as':_0x180b('0x17e'),'foreignKey':_0x180b('0x15b')});db[_0x180b('0x6c')][_0x180b('0xff')](db['CmContact'],{'as':'Contacts','foreignKey':_0x180b('0x185')});db[_0x180b('0x145')][_0x180b('0xff')](db[_0x180b('0x88')],{'as':_0x180b('0x186'),'foreignKey':'CmContactId'});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0x180b('0x133'),'foreignKey':_0x180b('0x147')});db['CmContact']['hasMany'](db[_0x180b('0x73')],{'as':_0x180b('0x135'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x145')]['hasMany'](db['CmHopperHistory'],{'as':_0x180b('0x136'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x145')][_0x180b('0xff')](db[_0x180b('0x104')],{'as':_0x180b('0x104'),'foreignKey':_0x180b('0x147')});db['CmContact']['hasMany'](db[_0x180b('0xcb')],{'as':'JscriptySessions','foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x180b('0x5c')],{'as':'OpenchannelInteractions','foreignKey':_0x180b('0x147'),'onDelete':'restrict'});db[_0x180b('0x145')][_0x180b('0xff')](db[_0x180b('0x63')],{'as':_0x180b('0x111'),'foreignKey':'ContactId','onDelete':_0x180b('0x15d')});db[_0x180b('0x145')][_0x180b('0xff')](db['SmsInteraction'],{'as':_0x180b('0x112'),'foreignKey':_0x180b('0x147'),'onDelete':'restrict'});db[_0x180b('0x145')][_0x180b('0xff')](db[_0x180b('0x4a')],{'as':'FaxInteractions','foreignKey':_0x180b('0x147'),'onDelete':'restrict'});db[_0x180b('0x145')][_0x180b('0xff')](db[_0x180b('0x3f')],{'as':'MailInteractions','foreignKey':_0x180b('0x147'),'onDelete':_0x180b('0x15d')});db['CmContact'][_0x180b('0x10a')](db[_0x180b('0x6c')],{'as':'Company','foreignKey':_0x180b('0x185')});db[_0x180b('0x145')]['belongsTo'](db[_0x180b('0xe8')],{'as':'List','foreignKey':_0x180b('0x150'),'onDelete':'cascade'});db[_0x180b('0x145')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':'Users','through':_0x180b('0x10d')});db[_0x180b('0x145')][_0x180b('0x10b')](db[_0x180b('0x164')],{'as':'Tags','through':_0x180b('0x187')});db[_0x180b('0x145')][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':_0x180b('0x187'),'as':_0x180b('0x157')});db['CmHopper']['hasMany'](db[_0x180b('0x89')],{'as':_0x180b('0x188'),'foreignKey':_0x180b('0x189')});db['CmHopper']['belongsTo'](db[_0x180b('0x145')],{'as':'Contact','foreignKey':_0x180b('0x147'),'onDelete':_0x180b('0xfe')});db[_0x180b('0x6f')][_0x180b('0x10a')](db['CmList'],{'as':_0x180b('0x15f'),'foreignKey':_0x180b('0x150'),'onDelete':_0x180b('0xfe')});db[_0x180b('0x6f')][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':_0x180b('0x17a'),'foreignKey':_0x180b('0x101')});db[_0x180b('0x6f')][_0x180b('0x10a')](db[_0x180b('0x1b')],{'as':_0x180b('0x17c'),'foreignKey':_0x180b('0x134'),'onDelete':_0x180b('0xfe')});db[_0x180b('0x6f')][_0x180b('0x10a')](db[_0x180b('0x18a')],{'as':_0x180b('0x18a'),'foreignKey':_0x180b('0x18b'),'onDelete':_0x180b('0xfe')});db[_0x180b('0x6f')][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':_0x180b('0x154'),'foreignKey':_0x180b('0x18c')});db[_0x180b('0x71')][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':'ContactId','onDelete':_0x180b('0xfe')});db[_0x180b('0x71')][_0x180b('0x10a')](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':_0x180b('0x150'),'onDelete':_0x180b('0xfe')});db['CmHopperBlack'][_0x180b('0x10a')](db[_0x180b('0x1b')],{'as':_0x180b('0x17c'),'foreignKey':_0x180b('0x134'),'onDelete':_0x180b('0xfe')});db['CmHopperBlack']['belongsTo'](db[_0x180b('0x18a')],{'as':_0x180b('0x18a'),'foreignKey':_0x180b('0x18b'),'onDelete':_0x180b('0xfe')});db[_0x180b('0x79')][_0x180b('0xff')](db[_0x180b('0x18d')],{'as':{'plural':_0x180b('0x18e'),'singular':_0x180b('0x18f')},'foreignKey':_0x180b('0x190'),'onDelete':_0x180b('0xfe'),'hooks':!![]});db[_0x180b('0x79')]['hasMany'](db[_0x180b('0x18d')],{'as':{'plural':_0x180b('0x191'),'singular':_0x180b('0x192')},'foreignKey':_0x180b('0x193'),'onDelete':_0x180b('0xfe'),'hooks':!![]});db[_0x180b('0x79')][_0x180b('0xff')](db[_0x180b('0x78')],{'as':'Actions','foreignKey':_0x180b('0x194'),'onDelete':'cascade','hooks':!![]});db['Disposition']['hasMany'](db[_0x180b('0x14a')],{'as':_0x180b('0x14b'),'foreignKey':'ParentId','onDelete':_0x180b('0xfe')});db[_0x180b('0x7c')][_0x180b('0xff')](db[_0x180b('0x7c')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x180b('0xfe'),'hooks':!![],'required':![]});db['Interval'][_0x180b('0xff')](db[_0x180b('0x18')],{'as':_0x180b('0x103'),'foreignKey':_0x180b('0x13a'),'onDelete':_0x180b('0x15d')});db[_0x180b('0x7c')][_0x180b('0xff')](db[_0x180b('0x14e')],{'as':_0x180b('0x195'),'foreignKey':_0x180b('0x13a')});db[_0x180b('0x7c')][_0x180b('0xff')](db[_0x180b('0x61')],{'as':_0x180b('0x196'),'foreignKey':_0x180b('0x13a')});db[_0x180b('0x7c')][_0x180b('0xff')](db['FaxApplication'],{'as':_0x180b('0x197'),'foreignKey':_0x180b('0x13a')});db[_0x180b('0x7c')]['hasMany'](db[_0x180b('0x52')],{'as':_0x180b('0x198'),'foreignKey':'IntervalId'});db[_0x180b('0x82')][_0x180b('0x10a')](db[_0x180b('0x3d')],{});db[_0x180b('0x82')]['belongsTo'](db[_0x180b('0x93')],{'foreignKey':_0x180b('0x199')});db[_0x180b('0x82')][_0x180b('0x10a')](db[_0x180b('0x19a')],{'foreignKey':_0x180b('0x19b')});db['Sound'][_0x180b('0x10b')](db['VoiceMusicOnHold'],{'as':_0x180b('0x19c'),'through':_0x180b('0x131'),'onDelete':_0x180b('0x15d')});db[_0x180b('0x164')]['belongsToMany'](db[_0x180b('0x145')],{'through':'cm_contact_has_tags'});db['Tag'][_0x180b('0x10b')](db[_0x180b('0x63')],{'through':_0x180b('0x180')});db[_0x180b('0x164')][_0x180b('0x10b')](db[_0x180b('0x3f')],{'through':'mail_interaction_has_tags'});db[_0x180b('0x164')]['belongsToMany'](db['SmsInteraction'],{'through':_0x180b('0x16c')});db[_0x180b('0x164')][_0x180b('0x10b')](db[_0x180b('0x4a')],{'through':_0x180b('0x166')});db[_0x180b('0x164')][_0x180b('0x10b')](db[_0x180b('0x5c')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x180b('0x10b')](db[_0x180b('0xf3')],{'through':_0x180b('0x19d')});db[_0x180b('0x88')][_0x180b('0x10a')](db[_0x180b('0x86')],{'as':'ItemType','foreignKey':_0x180b('0x19e')});db[_0x180b('0x89')][_0x180b('0x10a')](db[_0x180b('0x6f')],{'as':_0x180b('0x19f'),'foreignKey':_0x180b('0x189')});db[_0x180b('0x8d')][_0x180b('0xff')](db['Condition'],{'as':{'plural':_0x180b('0x1a0'),'singular':_0x180b('0x1a1')},'foreignKey':_0x180b('0x1a2'),'onDelete':_0x180b('0xfe'),'hooks':!![]});db[_0x180b('0x8d')][_0x180b('0xff')](db[_0x180b('0x18d')],{'as':{'plural':_0x180b('0x1a3'),'singular':_0x180b('0x1a4')},'foreignKey':_0x180b('0x1a5'),'onDelete':_0x180b('0xfe'),'hooks':!![]});db[_0x180b('0x8d')][_0x180b('0xff')](db['Action'],{'as':'Actions','foreignKey':_0x180b('0x1a6'),'onDelete':_0x180b('0xfe'),'hooks':!![]});db[_0x180b('0x19a')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x180b('0x1a7'),'onDelete':'cascade','foreignKey':_0x180b('0x19b'),'hooks':!![]});db[_0x180b('0x93')][_0x180b('0xff')](db[_0x180b('0x97')],{'as':_0x180b('0x1a7'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x180b('0x1a8')][_0x180b('0xff')](db[_0x180b('0x97')],{'as':_0x180b('0x1a7'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1a9')});db['AnalyticFieldReport']['belongsTo'](db[_0x180b('0x1a8')],{'foreignKey':_0x180b('0x1a9')});db[_0x180b('0x9a')][_0x180b('0xff')](db[_0x180b('0x9c')],{'as':'Configurations','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0x9c')][_0x180b('0xff')](db[_0x180b('0x9e')],{'as':_0x180b('0x1ab'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1ac')});db[_0x180b('0x9c')][_0x180b('0xff')](db[_0x180b('0x9e')],{'as':_0x180b('0x1ad'),'onDelete':_0x180b('0xfe'),'foreignKey':'DescriptionId'});db[_0x180b('0x9c')]['hasMany'](db['SalesforceField'],{'as':_0x180b('0x1a7'),'onDelete':_0x180b('0xfe'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0x180b('0x10a')](db[_0x180b('0x9a')],{'as':'Account','foreignKey':_0x180b('0x1aa')});db[_0x180b('0x9e')][_0x180b('0xff')](db[_0x180b('0x9e')],{'as':_0x180b('0x1ae'),'foreignKey':_0x180b('0x1ac')});db['SalesforceField'][_0x180b('0xff')](db[_0x180b('0x9e')],{'as':_0x180b('0x1af'),'foreignKey':'DescriptionId'});db[_0x180b('0x9e')][_0x180b('0xff')](db[_0x180b('0x9e')],{'as':'Field','foreignKey':_0x180b('0x1b0')});db[_0x180b('0x9e')]['belongsTo'](db[_0x180b('0x8e')],{'as':_0x180b('0x8e'),'foreignKey':'VariableId'});db[_0x180b('0x1b1')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0x180b('0x1b2'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0xa0')]['hasMany'](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1ac')});db[_0x180b('0xa0')][_0x180b('0xff')](db[_0x180b('0x1b3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x180b('0x1b4')});db[_0x180b('0xa0')]['hasMany'](db[_0x180b('0x1b3')],{'as':_0x180b('0x1a7'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x180b('0xa0')][_0x180b('0x10a')](db[_0x180b('0x1b1')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x1aa')});db['SugarcrmField']['hasMany'](db[_0x180b('0x1b3')],{'as':'Subject','foreignKey':'SubjectId'});db['SugarcrmField'][_0x180b('0xff')](db[_0x180b('0x1b3')],{'as':'Description','foreignKey':_0x180b('0x1b4')});db['SugarcrmField'][_0x180b('0xff')](db[_0x180b('0x1b3')],{'as':_0x180b('0x1b5'),'foreignKey':_0x180b('0x1b0')});db[_0x180b('0x1b3')][_0x180b('0x10a')](db[_0x180b('0x8e')],{'as':_0x180b('0x8e'),'foreignKey':_0x180b('0x1b6')});db[_0x180b('0x1b7')][_0x180b('0xff')](db[_0x180b('0xa4')],{'as':_0x180b('0x1b2'),'onDelete':_0x180b('0xfe'),'foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0x180b('0x1b8')],{'as':_0x180b('0x1ab'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1ac')});db[_0x180b('0xa4')][_0x180b('0xff')](db[_0x180b('0x1b8')],{'as':'Descriptions','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1b4')});db['DeskConfiguration'][_0x180b('0xff')](db[_0x180b('0x1b8')],{'as':_0x180b('0x1a7'),'onDelete':_0x180b('0xfe'),'foreignKey':'FieldId'});db[_0x180b('0xa4')]['belongsTo'](db[_0x180b('0x1b7')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0xa4')][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':_0x180b('0x1b9')});db['DeskField'][_0x180b('0xff')](db[_0x180b('0x1b8')],{'as':_0x180b('0x1ae'),'foreignKey':'SubjectId'});db['DeskField']['hasMany'](db[_0x180b('0x1b8')],{'as':'Description','foreignKey':_0x180b('0x1b4')});db[_0x180b('0x1b8')][_0x180b('0xff')](db[_0x180b('0x1b8')],{'as':_0x180b('0x1b5'),'foreignKey':_0x180b('0x1b0')});db['DeskField'][_0x180b('0x10a')](db[_0x180b('0x8e')],{'as':_0x180b('0x8e'),'foreignKey':_0x180b('0x1b6')});db[_0x180b('0xa7')]['hasMany'](db[_0x180b('0xa9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x180b('0x1aa')});db['ZohoConfiguration'][_0x180b('0xff')](db['ZohoField'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x180b('0xa9')][_0x180b('0xff')](db[_0x180b('0x1ba')],{'as':'Descriptions','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1b4')});db[_0x180b('0xa9')]['hasMany'](db[_0x180b('0x1ba')],{'as':'Fields','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1b0')});db[_0x180b('0xa9')][_0x180b('0x10a')](db[_0x180b('0xa7')],{'as':'Account','foreignKey':_0x180b('0x1aa')});db[_0x180b('0x1ba')][_0x180b('0xff')](db[_0x180b('0x1ba')],{'as':_0x180b('0x1ae'),'foreignKey':'SubjectId'});db[_0x180b('0x1ba')][_0x180b('0xff')](db[_0x180b('0x1ba')],{'as':_0x180b('0x1af'),'foreignKey':_0x180b('0x1b4')});db[_0x180b('0x1ba')]['hasMany'](db['ZohoField'],{'as':_0x180b('0x1b5'),'foreignKey':_0x180b('0x1b0')});db[_0x180b('0x1ba')][_0x180b('0x10a')](db[_0x180b('0x8e')],{'as':_0x180b('0x8e'),'foreignKey':_0x180b('0x1b6')});db['ZendeskAccount'][_0x180b('0xff')](db[_0x180b('0x1bb')],{'as':_0x180b('0x1b2'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0x1bb')][_0x180b('0xff')](db[_0x180b('0xad')],{'as':_0x180b('0x1ab'),'foreignKey':_0x180b('0x1ac')});db[_0x180b('0x1bb')][_0x180b('0xff')](db[_0x180b('0xad')],{'as':_0x180b('0x1ad'),'foreignKey':_0x180b('0x1b4')});db[_0x180b('0x1bb')][_0x180b('0xff')](db[_0x180b('0xad')],{'as':_0x180b('0x1a7'),'foreignKey':_0x180b('0x1b0')});db['ZendeskConfiguration'][_0x180b('0x10a')](db['ZendeskAccount'],{'as':_0x180b('0x15a'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x180b('0x10b')](db['Tag'],{'through':_0x180b('0x1bc')});db[_0x180b('0xad')][_0x180b('0xff')](db[_0x180b('0xad')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x180b('0xad')][_0x180b('0xff')](db['ZendeskField'],{'as':_0x180b('0x1af'),'foreignKey':'DescriptionId'});db[_0x180b('0xad')][_0x180b('0xff')](db[_0x180b('0xad')],{'as':_0x180b('0x1b5'),'foreignKey':'FieldId'});db[_0x180b('0xad')][_0x180b('0x10a')](db[_0x180b('0x8e')],{'as':_0x180b('0x8e'),'foreignKey':_0x180b('0x1b6')});db[_0x180b('0xae')][_0x180b('0xff')](db[_0x180b('0xb0')],{'as':'Configurations','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1aa')});db['FreshdeskConfiguration'][_0x180b('0xff')](db[_0x180b('0xb2')],{'as':'Subjects','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1ac')});db['FreshdeskConfiguration']['hasMany'](db[_0x180b('0xb2')],{'as':_0x180b('0x1ad'),'onDelete':'cascade','foreignKey':_0x180b('0x1b4')});db['FreshdeskConfiguration'][_0x180b('0xff')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1b0')});db[_0x180b('0xb0')][_0x180b('0x10a')](db[_0x180b('0xae')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0xb0')][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':_0x180b('0x1bd')});db[_0x180b('0xb2')][_0x180b('0xff')](db['FreshdeskField'],{'as':_0x180b('0x1ae'),'foreignKey':_0x180b('0x1ac')});db[_0x180b('0xb2')][_0x180b('0xff')](db[_0x180b('0xb2')],{'as':_0x180b('0x1af'),'foreignKey':_0x180b('0x1b4')});db[_0x180b('0xb2')][_0x180b('0xff')](db['FreshdeskField'],{'as':_0x180b('0x1b5'),'foreignKey':_0x180b('0x1b0')});db['FreshdeskField'][_0x180b('0x10a')](db['Variable'],{'as':'Variable','foreignKey':_0x180b('0x1b6')});db[_0x180b('0x1be')]['hasMany'](db[_0x180b('0xb4')],{'as':'Configurations','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0xb4')][_0x180b('0xff')](db[_0x180b('0x1bf')],{'as':'Subjects','foreignKey':_0x180b('0x1ac')});db[_0x180b('0xb4')][_0x180b('0xff')](db['VtigerField'],{'as':_0x180b('0x1ad'),'foreignKey':'DescriptionId'});db[_0x180b('0xb4')]['hasMany'](db[_0x180b('0x1bf')],{'as':'Fields','foreignKey':'FieldId'});db[_0x180b('0xb4')][_0x180b('0x10a')](db[_0x180b('0x1be')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x1aa')});db['VtigerField']['hasMany'](db[_0x180b('0x1bf')],{'as':_0x180b('0x1ae'),'foreignKey':_0x180b('0x1ac')});db[_0x180b('0x1bf')][_0x180b('0xff')](db['VtigerField'],{'as':_0x180b('0x1af'),'foreignKey':_0x180b('0x1b4')});db[_0x180b('0x1bf')][_0x180b('0xff')](db['VtigerField'],{'as':_0x180b('0x1b5'),'foreignKey':_0x180b('0x1b0')});db['VtigerField'][_0x180b('0x10a')](db['Variable'],{'as':'Variable','foreignKey':_0x180b('0x1b6')});db[_0x180b('0xb7')][_0x180b('0xff')](db[_0x180b('0xb9')],{'as':_0x180b('0x1b2'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1aa')});db['ServicenowConfiguration']['hasMany'](db[_0x180b('0xba')],{'as':_0x180b('0x1ab'),'foreignKey':_0x180b('0x1ac')});db['ServicenowConfiguration'][_0x180b('0xff')](db[_0x180b('0xba')],{'as':_0x180b('0x1ad'),'foreignKey':_0x180b('0x1b4')});db['ServicenowConfiguration'][_0x180b('0xff')](db[_0x180b('0xba')],{'as':_0x180b('0x1a7'),'foreignKey':_0x180b('0x1b0')});db['ServicenowConfiguration'][_0x180b('0x10a')](db[_0x180b('0xb7')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0xba')][_0x180b('0xff')](db['ServicenowField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x180b('0xba')][_0x180b('0xff')](db[_0x180b('0xba')],{'as':_0x180b('0x1af'),'foreignKey':_0x180b('0x1b4')});db[_0x180b('0xba')]['hasMany'](db['ServicenowField'],{'as':_0x180b('0x1b5'),'foreignKey':_0x180b('0x1b0')});db['ServicenowField'][_0x180b('0x10a')](db[_0x180b('0x8e')],{'as':'Variable','foreignKey':_0x180b('0x1b6')});db[_0x180b('0xbc')][_0x180b('0xff')](db['Dynamics365Configuration'],{'as':_0x180b('0x1b2'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0x1c0')][_0x180b('0xff')](db['Dynamics365Field'],{'as':_0x180b('0x1ab'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1ac')});db[_0x180b('0x1c0')][_0x180b('0xff')](db[_0x180b('0xbf')],{'as':_0x180b('0x1ad'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1b4')});db[_0x180b('0x1c0')][_0x180b('0xff')](db['Dynamics365Field'],{'as':_0x180b('0x1a7'),'onDelete':_0x180b('0xfe'),'foreignKey':'FieldId'});db[_0x180b('0x1c0')][_0x180b('0x10a')](db['Dynamics365Account'],{'as':_0x180b('0x15a'),'foreignKey':'AccountId'});db[_0x180b('0xbf')][_0x180b('0xff')](db[_0x180b('0xbf')],{'as':_0x180b('0x1ae'),'foreignKey':'SubjectId'});db[_0x180b('0xbf')][_0x180b('0xff')](db[_0x180b('0xbf')],{'as':_0x180b('0x1af'),'foreignKey':_0x180b('0x1b4')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x180b('0x1b5'),'foreignKey':_0x180b('0x1b0')});db[_0x180b('0xbf')][_0x180b('0x10a')](db['Variable'],{'as':'Variable','foreignKey':_0x180b('0x1b6')});db['FreshsalesAccount'][_0x180b('0xff')](db[_0x180b('0xc2')],{'as':_0x180b('0x1b2'),'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0xc2')][_0x180b('0xff')](db[_0x180b('0xc3')],{'as':_0x180b('0x1ab'),'foreignKey':_0x180b('0x1ac')});db[_0x180b('0xc2')][_0x180b('0xff')](db['FreshsalesField'],{'as':_0x180b('0x1ad'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x180b('0xff')](db['FreshsalesField'],{'as':_0x180b('0x1a7'),'foreignKey':_0x180b('0x1b0')});db[_0x180b('0xc2')][_0x180b('0x10a')](db[_0x180b('0xc0')],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x1aa')});db[_0x180b('0xc3')]['hasMany'](db[_0x180b('0xc3')],{'as':_0x180b('0x1ae'),'foreignKey':'SubjectId'});db[_0x180b('0xc3')][_0x180b('0xff')](db[_0x180b('0xc3')],{'as':'Description','foreignKey':_0x180b('0x1b4')});db[_0x180b('0xc3')][_0x180b('0xff')](db[_0x180b('0xc3')],{'as':_0x180b('0x1b5'),'foreignKey':'FieldId'});db[_0x180b('0xc3')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x180b('0xc5')][_0x180b('0x10a')](db[_0x180b('0x121')],{});db[_0x180b('0xc5')][_0x180b('0x10a')](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':_0x180b('0x150')});db[_0x180b('0xc5')]['belongsTo'](db[_0x180b('0x145')],{'as':'Contact','foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0x180b('0x63')],{});db[_0x180b('0xc5')]['belongsTo'](db[_0x180b('0x65')],{});db[_0x180b('0xc5')]['belongsTo'](db['User'],{});db[_0x180b('0xc5')][_0x180b('0x10a')](db['ChatQueue'],{});db[_0x180b('0x1c1')][_0x180b('0x10a')](db[_0x180b('0x12')],{'onDelete':_0x180b('0xfe'),'foreignKey':'FromId'});db[_0x180b('0x1c1')][_0x180b('0x10a')](db['User'],{'onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1c2')});db[_0x180b('0xcb')][_0x180b('0xff')](db[_0x180b('0xc9')],{'foreignKey':'SessionId','onDelete':_0x180b('0xfe')});db[_0x180b('0xcb')]['hasMany'](db[_0x180b('0xc7')],{'foreignKey':_0x180b('0x1c3'),'onDelete':_0x180b('0xfe')});db[_0x180b('0x1c4')][_0x180b('0x10a')](db['SmsAccount'],{});db['SmsQueueReport'][_0x180b('0x10a')](db['CmList'],{'as':_0x180b('0x15f'),'foreignKey':_0x180b('0x150')});db[_0x180b('0x1c4')][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x1c4')]['belongsTo'](db[_0x180b('0x54')],{});db[_0x180b('0x1c4')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x180b('0x10a')](db[_0x180b('0x12')],{});db[_0x180b('0x1c4')][_0x180b('0x10a')](db[_0x180b('0x57')],{});db[_0x180b('0xd1')]['hasMany'](db[_0x180b('0xcb')],{'foreignKey':'ProjectId'});db[_0x180b('0xd1')]['hasMany'](db[_0x180b('0xc9')],{'foreignKey':_0x180b('0x1c5')});db[_0x180b('0xd1')][_0x180b('0xff')](db[_0x180b('0xc7')],{'foreignKey':_0x180b('0x1c5')});db[_0x180b('0x1c6')][_0x180b('0x10b')](db['User'],{'as':_0x180b('0x158'),'through':_0x180b('0x12b')});db['Team']['belongsToMany'](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':'user_has_teams'});db[_0x180b('0x110')][_0x180b('0x10b')](db['VoiceQueue'],{'through':_0x180b('0xfb'),'as':'VoiceQueues'});db[_0x180b('0x110')][_0x180b('0x10b')](db[_0x180b('0x117')],{'through':'team_has_mail_queues','as':_0x180b('0x118')});db[_0x180b('0x110')][_0x180b('0x10b')](db['ChatQueue'],{'through':_0x180b('0x183'),'as':_0x180b('0x11a')});db[_0x180b('0x110')][_0x180b('0x10b')](db[_0x180b('0x4e')],{'through':'team_has_fax_queues','as':_0x180b('0x11b')});db[_0x180b('0x110')][_0x180b('0x10b')](db[_0x180b('0x57')],{'through':_0x180b('0x170'),'as':_0x180b('0x11c')});db[_0x180b('0x110')]['belongsToMany'](db[_0x180b('0x5f')],{'through':_0x180b('0x176'),'as':_0x180b('0x11d')});db[_0x180b('0x110')]['belongsToMany'](db[_0x180b('0xf9')],{'through':'team_has_whatsapp_queues','as':_0x180b('0x11e')});db['Campaign'][_0x180b('0xff')](db[_0x180b('0x6f')],{'as':'Hoppers','foreignKey':_0x180b('0x18b')});db[_0x180b('0x18a')][_0x180b('0xff')](db[_0x180b('0x73')],{'as':_0x180b('0x135'),'foreignKey':'CampaignId'});db[_0x180b('0x18a')][_0x180b('0xff')](db[_0x180b('0x75')],{'as':_0x180b('0x136'),'foreignKey':_0x180b('0x18b')});db[_0x180b('0x18a')][_0x180b('0xff')](db[_0x180b('0x71')],{'as':'HopperBlacks','foreignKey':_0x180b('0x18b')});db['Campaign'][_0x180b('0x10a')](db[_0x180b('0x2a')],{'as':_0x180b('0x2a'),'foreignKey':_0x180b('0x138')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x180b('0x139'),'foreignKey':'TrunkBackupId'});db[_0x180b('0x18a')][_0x180b('0x10a')](db[_0x180b('0x7c')],{'as':_0x180b('0x7c'),'foreignKey':_0x180b('0x13a')});db['Campaign'][_0x180b('0x10a')](db[_0x180b('0x1c6')],{'as':_0x180b('0x1c6'),'foreignKey':_0x180b('0x1c7')});db['Campaign'][_0x180b('0x10b')](db[_0x180b('0xe8')],{'as':'Lists','through':_0x180b('0x1c8')});db[_0x180b('0x18a')][_0x180b('0x10b')](db[_0x180b('0xe8')],{'as':'BlackLists','through':_0x180b('0x1c9')});db[_0x180b('0xdd')][_0x180b('0x10a')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x180b('0x15c')});db[_0x180b('0x1ca')][_0x180b('0x10a')](db['MailMessage'],{});db[_0x180b('0x1ca')][_0x180b('0x10a')](db[_0x180b('0x3f')],{});db[_0x180b('0x1ca')][_0x180b('0x10a')](db[_0x180b('0x3d')],{'foreignKey':_0x180b('0x1cb'),'as':'FromAccount'});db[_0x180b('0x1ca')][_0x180b('0x10a')](db['User'],{'foreignKey':_0x180b('0x1cc'),'as':'FromAgent'});db['MailTransferReport'][_0x180b('0x10a')](db[_0x180b('0x12')],{'foreignKey':'ToUserId','as':_0x180b('0x1cd')});db[_0x180b('0x1ca')][_0x180b('0x10a')](db[_0x180b('0x117')],{'foreignKey':_0x180b('0x1ce'),'as':_0x180b('0x1cf')});db['MailTransferReport'][_0x180b('0x10a')](db[_0x180b('0x3d')],{'foreignKey':_0x180b('0x1d0'),'as':_0x180b('0x1d1')});db[_0x180b('0xe0')][_0x180b('0x10a')](db['ChatMessage'],{});db[_0x180b('0xe0')]['belongsTo'](db[_0x180b('0x63')],{});db[_0x180b('0xe0')][_0x180b('0x10a')](db[_0x180b('0x121')],{'foreignKey':_0x180b('0x1d2'),'as':_0x180b('0x1d3')});db[_0x180b('0xe0')][_0x180b('0x10a')](db[_0x180b('0x12')],{'foreignKey':_0x180b('0x1cc'),'as':_0x180b('0x1d4')});db[_0x180b('0xe0')][_0x180b('0x10a')](db['User'],{'foreignKey':'ToUserId','as':_0x180b('0x1cd')});db[_0x180b('0xe0')]['belongsTo'](db[_0x180b('0x17b')],{'foreignKey':_0x180b('0x1d5'),'as':_0x180b('0x1cf')});db['ChatTransferReport']['belongsTo'](db[_0x180b('0x121')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x180b('0xe2')][_0x180b('0x10a')](db[_0x180b('0x4c')],{});db['FaxTransferReport'][_0x180b('0x10a')](db[_0x180b('0x4a')],{});db[_0x180b('0xe2')]['belongsTo'](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x180b('0x1d3')});db[_0x180b('0xe2')]['belongsTo'](db[_0x180b('0x12')],{'foreignKey':'FromUserId','as':_0x180b('0x1d4')});db[_0x180b('0xe2')][_0x180b('0x10a')](db[_0x180b('0x12')],{'foreignKey':'ToUserId','as':_0x180b('0x1cd')});db[_0x180b('0xe2')][_0x180b('0x10a')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x180b('0x1cf')});db[_0x180b('0xe2')][_0x180b('0x10a')](db[_0x180b('0x47')],{'foreignKey':_0x180b('0x1d6'),'as':'ToAccount'});db[_0x180b('0xe4')][_0x180b('0x10a')](db[_0x180b('0x5d')],{});db[_0x180b('0xe4')][_0x180b('0x10a')](db[_0x180b('0x5c')],{});db[_0x180b('0xe4')][_0x180b('0x10a')](db[_0x180b('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x180b('0xe4')][_0x180b('0x10a')](db[_0x180b('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x180b('0xe4')]['belongsTo'](db[_0x180b('0x12')],{'foreignKey':_0x180b('0x1d7'),'as':_0x180b('0x1cd')});db[_0x180b('0xe4')][_0x180b('0x10a')](db[_0x180b('0x5f')],{'foreignKey':_0x180b('0x1d8'),'as':_0x180b('0x1cf')});db[_0x180b('0xe4')][_0x180b('0x10a')](db[_0x180b('0x59')],{'foreignKey':_0x180b('0x1d9'),'as':_0x180b('0x1d1')});db[_0x180b('0xe6')][_0x180b('0x10a')](db[_0x180b('0x55')],{});db[_0x180b('0xe6')][_0x180b('0x10a')](db['SmsInteraction'],{});db[_0x180b('0xe6')]['belongsTo'](db[_0x180b('0x51')],{'foreignKey':_0x180b('0x1da'),'as':_0x180b('0x1d3')});db[_0x180b('0xe6')][_0x180b('0x10a')](db[_0x180b('0x12')],{'foreignKey':'FromUserId','as':_0x180b('0x1d4')});db['SmsTransferReport'][_0x180b('0x10a')](db[_0x180b('0x12')],{'foreignKey':_0x180b('0x1d7'),'as':_0x180b('0x1cd')});db['SmsTransferReport'][_0x180b('0x10a')](db[_0x180b('0x57')],{'foreignKey':_0x180b('0x1db'),'as':_0x180b('0x1cf')});db[_0x180b('0xe6')][_0x180b('0x10a')](db['SmsAccount'],{'foreignKey':_0x180b('0x1dc'),'as':_0x180b('0x1d1')});db[_0x180b('0xe8')]['hasMany'](db[_0x180b('0x14a')],{'as':_0x180b('0x14b'),'foreignKey':_0x180b('0x150')});db['CmList'][_0x180b('0xff')](db[_0x180b('0x76')],{'as':_0x180b('0x1dd'),'foreignKey':_0x180b('0x150')});db[_0x180b('0xe8')][_0x180b('0xff')](db[_0x180b('0x145')],{'as':'Contacts','onDelete':_0x180b('0xfe'),'foreignKey':'ListId'});db[_0x180b('0xe8')][_0x180b('0xff')](db[_0x180b('0x73')],{'as':'HopperFinals','foreignKey':_0x180b('0x150')});db[_0x180b('0xe8')]['hasMany'](db[_0x180b('0x75')],{'as':_0x180b('0x1de'),'foreignKey':_0x180b('0x150')});db[_0x180b('0xe8')][_0x180b('0xff')](db[_0x180b('0x104')],{'as':_0x180b('0x104'),'foreignKey':_0x180b('0x150')});db['CmList']['belongsToMany'](db['VoiceQueue'],{'as':_0x180b('0x1df'),'through':_0x180b('0x1e0')});db[_0x180b('0xe8')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':_0x180b('0x10f')});db[_0x180b('0xea')][_0x180b('0xff')](db[_0x180b('0x18')],{'as':_0x180b('0x103'),'onDelete':'cascade'});db['VoicePrefix'][_0x180b('0x10b')](db['User'],{'as':'Agents','through':_0x180b('0x120')});db[_0x180b('0xec')][_0x180b('0xff')](db[_0x180b('0x12')],{'as':_0x180b('0x158'),'foreignKey':_0x180b('0x1e1')});db[_0x180b('0xec')][_0x180b('0xff')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x180b('0x1e1'),'onDelete':_0x180b('0xfe')});db[_0x180b('0xed')]['hasMany'](db['UserProfileResource'],{'as':_0x180b('0x1e2'),'foreignKey':_0x180b('0x1e3'),'onDelete':_0x180b('0xfe')});db[_0x180b('0xf0')][_0x180b('0xff')](db['Disposition'],{'as':_0x180b('0x14b'),'foreignKey':_0x180b('0x1e4')});db[_0x180b('0xf0')][_0x180b('0xff')](db[_0x180b('0x14c')],{'as':_0x180b('0x162'),'foreignKey':_0x180b('0x1e4')});db[_0x180b('0xf0')]['hasMany'](db[_0x180b('0xf5')],{'as':_0x180b('0x13f'),'foreignKey':'WhatsappAccountId'});db[_0x180b('0xf0')][_0x180b('0xff')](db['WhatsappInteraction'],{'as':_0x180b('0x14d')});db[_0x180b('0xf0')]['hasMany'](db[_0x180b('0xf1')],{'as':_0x180b('0x14f')});db[_0x180b('0xf0')][_0x180b('0x10a')](db[_0x180b('0xe8')],{'as':_0x180b('0x15f'),'foreignKey':'ListId'});db[_0x180b('0xf0')][_0x180b('0x10a')](db[_0x180b('0x7e')],{'as':_0x180b('0x13b'),'foreignKey':_0x180b('0x151')});db[_0x180b('0xf0')]['belongsToMany'](db['User'],{'as':_0x180b('0x13c'),'through':_0x180b('0x1e5')});db[_0x180b('0xf1')][_0x180b('0x10a')](db[_0x180b('0x12')],{'onDelete':_0x180b('0x15d')});db['WhatsappApplication'][_0x180b('0x10a')](db[_0x180b('0xf9')],{'onDelete':_0x180b('0x15d')});db[_0x180b('0xf1')][_0x180b('0x10a')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x180b('0xf1')][_0x180b('0x10a')](db[_0x180b('0x7c')],{'onDelete':_0x180b('0x15d'),'foreignKey':_0x180b('0x13a')});db['WhatsappApplication']['belongsTo'](db['Tag'],{'onDelete':_0x180b('0x15d'),'foreignKey':'TagId'});db[_0x180b('0xf3')][_0x180b('0xff')](db[_0x180b('0xf5')],{'as':'Messages','onDelete':_0x180b('0xfe'),'foreignKey':_0x180b('0x1e6')});db[_0x180b('0xf3')][_0x180b('0x10a')](db['WhatsappAccount'],{'as':_0x180b('0x15a'),'foreignKey':_0x180b('0x1e4')});db[_0x180b('0xf3')][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':_0x180b('0x147')});db[_0x180b('0xf3')][_0x180b('0x10a')](db['User'],{'as':'Owner','foreignKey':_0x180b('0x101')});db[_0x180b('0xf3')][_0x180b('0x10b')](db[_0x180b('0x164')],{'through':_0x180b('0x19d'),'as':'Tags'});db[_0x180b('0xf3')]['belongsToMany'](db[_0x180b('0x164')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x180b('0xf3')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x158'),'through':'user_has_whatsapp_interactions','foreignKey':_0x180b('0x1e6')});db[_0x180b('0xf5')][_0x180b('0x10a')](db[_0x180b('0x12')],{'as':'User'});db[_0x180b('0xf5')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x180b('0x146')});db[_0x180b('0xf5')][_0x180b('0x10a')](db['WhatsappInteraction'],{'onDelete':_0x180b('0xfe'),'as':'Interaction','foreignKey':_0x180b('0x1e6')});db[_0x180b('0xf5')][_0x180b('0x10a')](db[_0x180b('0xf0')],{'as':_0x180b('0x15a'),'foreignKey':'WhatsappAccountId'});db[_0x180b('0x1e7')][_0x180b('0x10a')](db[_0x180b('0xf0')],{});db[_0x180b('0x1e7')][_0x180b('0x10a')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x180b('0x1e7')][_0x180b('0x10a')](db[_0x180b('0x145')],{'as':_0x180b('0x146'),'foreignKey':_0x180b('0x147')});db[_0x180b('0x1e7')]['belongsTo'](db[_0x180b('0xf3')],{});db[_0x180b('0x1e7')][_0x180b('0x10a')](db[_0x180b('0xf9')],{});db[_0x180b('0x1e7')][_0x180b('0x10a')](db[_0x180b('0xf5')],{});db['WhatsappQueueReport'][_0x180b('0x10a')](db[_0x180b('0x12')],{});db[_0x180b('0x1e8')][_0x180b('0x10a')](db[_0x180b('0xf5')],{});db[_0x180b('0x1e8')][_0x180b('0x10a')](db[_0x180b('0xf3')],{});db[_0x180b('0x1e8')][_0x180b('0x10a')](db[_0x180b('0xf0')],{'foreignKey':'FromWhatsappAccountId','as':_0x180b('0x1d3')});db[_0x180b('0x1e8')]['belongsTo'](db[_0x180b('0xf0')],{'foreignKey':_0x180b('0x1e9'),'as':'ToAccount'});db[_0x180b('0x1e8')][_0x180b('0x10a')](db[_0x180b('0xf9')],{'foreignKey':_0x180b('0x1ea'),'as':'ToQueue'});db[_0x180b('0x1e8')][_0x180b('0x10a')](db[_0x180b('0x12')],{'foreignKey':_0x180b('0x1cc'),'as':_0x180b('0x1d4')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x180b('0x1d7'),'as':_0x180b('0x1cd')});db[_0x180b('0xf9')][_0x180b('0x10b')](db[_0x180b('0x12')],{'as':_0x180b('0x13c'),'through':_0x180b('0x38'),'foreignKey':_0x180b('0x1eb')});db[_0x180b('0xf9')][_0x180b('0x10b')](db[_0x180b('0x110')],{'through':'team_has_whatsapp_queues','as':_0x180b('0x152')});module[_0x180b('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbf57=['CmCompany','CompanyId','Phones','CmContactId','Hoppers','SmsInteractions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllCondition','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','SubjectId','DescriptionId','FieldId','AccountId','Subject','Subjects','Descriptions','Field','VariableId','DeskField','int_desk_configuration_has_tags','Description','ZohoConfiguration','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerField','VtigerAccount','ServicenowAccount','ServicenowConfiguration','ServicenowField','Dynamics365Configuration','FreshsalesAccount','ToId','SessionId','ProjectId','MailQueues','team_has_whatsapp_queues','TrunkBackupId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','voice_queues_has_cm_lists','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','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','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','VoiceMail','cascade','UserId','hasMany','User','VoiceQueuesRt','Extensions','CmHopperFinal','HopperHistory','OpenchannelInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','ChatGroup','Groups','chat_group_has_users','belongsToMany','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','UserMailQueue','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Members','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccount','MailAccountId','hasOne','Imap','Smtp','Answers','Interactions','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Interaction','MailInteractionId','ChatWebsiteId','restrict','TagId','List','Dashboard','Items','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','Account','fax_interaction_has_tags','Users','AttachmentId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','UserOpenchannelQueue','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xbf57,0x69));var _0x7bf5=function(_0x4cbdc4,_0x8be7a8){_0x4cbdc4=_0x4cbdc4-0x0;var _0x413c70=_0xbf57[_0x4cbdc4];return _0x413c70;};'use strict';var path=require('path');var config=require(_0x7bf5('0x0'));var Sequelize=require(_0x7bf5('0x1'));var _=require(_0x7bf5('0x2'));var jstz=require(_0x7bf5('0x3'));var timezone=jstz['determine']();config[_0x7bf5('0x1')]=_['defaultsDeep'](config[_0x7bf5('0x1')],{'database':_0x7bf5('0x4'),'username':_0x7bf5('0x5'),'password':_0x7bf5('0x6'),'options':{'host':_0x7bf5('0x7'),'port':0xcea,'dialect':_0x7bf5('0x8'),'dialectOptions':{'charset':_0x7bf5('0x9')},'logging':![],'timezone':timezone[_0x7bf5('0xa')](),'define':{'charset':_0x7bf5('0xb'),'collate':_0x7bf5('0xc')}}});config[_0x7bf5('0xd')]=_[_0x7bf5('0xe')](config[_0x7bf5('0xd')],{'database':_0x7bf5('0x4'),'username':_0x7bf5('0x5'),'password':_0x7bf5('0x6'),'options':{'host':_0x7bf5('0x7'),'port':0xcea,'dialect':_0x7bf5('0x8'),'dialectOptions':{'charset':_0x7bf5('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x7bf5('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x7bf5('0x1')][_0x7bf5('0xf')],config[_0x7bf5('0x1')][_0x7bf5('0x10')],config[_0x7bf5('0x1')][_0x7bf5('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7bf5('0xd')]['database'],config[_0x7bf5('0xd')][_0x7bf5('0xf')],config[_0x7bf5('0xd')][_0x7bf5('0x10')],config['sequelizeHistory']['options'])};db['User']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x13'));db[_0x7bf5('0x14')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x15'));db['VoiceContext']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x16'));db[_0x7bf5('0x17')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x18'));db[_0x7bf5('0x19')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x1a'));db[_0x7bf5('0x1b')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x1c'));db[_0x7bf5('0x1d')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x1e'));db[_0x7bf5('0x1f')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x20'));db['VoiceMail']=db['sequelize']['import'](_0x7bf5('0x21'));db[_0x7bf5('0x22')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x23'));db['VoiceCallReport']=db['sequelize'][_0x7bf5('0x12')]('../api/voiceCallReport/voiceCallReport.model');db[_0x7bf5('0x24')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x25'));db[_0x7bf5('0x26')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x27'));db[_0x7bf5('0x28')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x29'));db[_0x7bf5('0x2a')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/memberReport/memberReport.model');db[_0x7bf5('0x2b')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x2c'));db[_0x7bf5('0x2d')]=db[_0x7bf5('0x1')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x7bf5('0x2e')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x2f'));db['UserChatQueue']=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x30'));db['UserMailQueue']=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x31'));db['UserFaxQueue']=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x32'));db[_0x7bf5('0x33')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x34'));db['UserOpenchannelQueue']=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db['sequelize']['import'](_0x7bf5('0x35'));db[_0x7bf5('0x36')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x37'));db[_0x7bf5('0x38')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x39'));db['MailAccount']=db[_0x7bf5('0x1')]['import']('../api/mailAccount/mailAccount.model');db[_0x7bf5('0x3a')]=db[_0x7bf5('0x1')]['import']('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x3b'));db[_0x7bf5('0x3c')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x3d'));db[_0x7bf5('0x3e')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x3f'));db[_0x7bf5('0x40')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x41'));db[_0x7bf5('0x42')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x43'));db['Dashboard']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x44'));db[_0x7bf5('0x45')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x46'));db[_0x7bf5('0x47')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x48'));db[_0x7bf5('0x49')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x4a'));db[_0x7bf5('0x4b')]=db['sequelize'][_0x7bf5('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0x7bf5('0x4c')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x4d'));db['FaxQueue']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x4e'));db[_0x7bf5('0x4f')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x50'));db[_0x7bf5('0x51')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x52'));db[_0x7bf5('0x53')]=db['sequelize']['import'](_0x7bf5('0x54'));db[_0x7bf5('0x55')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/smsInteraction/smsInteraction.model');db[_0x7bf5('0x56')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x57'));db[_0x7bf5('0x58')]=db['sequelize'][_0x7bf5('0x12')]('../api/smsQueue/smsQueue.model');db[_0x7bf5('0x59')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x5a'));db[_0x7bf5('0x5b')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x5c'));db[_0x7bf5('0x5d')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x5e'));db[_0x7bf5('0x5f')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x60'));db[_0x7bf5('0x61')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x62'));db['ChatWebsite']=db[_0x7bf5('0x1')]['import']('../api/chatWebsite/chatWebsite.model');db[_0x7bf5('0x63')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x64'));db[_0x7bf5('0x65')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x66'));db[_0x7bf5('0x67')]=db['sequelize']['import'](_0x7bf5('0x68'));db[_0x7bf5('0x69')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x6a'));db[_0x7bf5('0x6b')]=db['sequelize']['import'](_0x7bf5('0x6c'));db[_0x7bf5('0x6d')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x6e'));db['ChatGroup']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x6f'));db[_0x7bf5('0x70')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x71'));db['CmContact']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x72'));db[_0x7bf5('0x73')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x74'));db[_0x7bf5('0x75')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x76'));db['CmHopperFinal']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x77'));db[_0x7bf5('0x78')]=db['sequelize']['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x7bf5('0x79')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x7a'));db[_0x7bf5('0x7b')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x7c'));db[_0x7bf5('0x7d')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x7e'));db[_0x7bf5('0x7f')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x80'));db[_0x7bf5('0x81')]=db['sequelize'][_0x7bf5('0x12')]('../api/cannedAnswer/cannedAnswer.model');db[_0x7bf5('0x82')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x83'));db[_0x7bf5('0x84')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x85'));db[_0x7bf5('0x86')]=db[_0x7bf5('0x1')]['import']('../api/interval/interval.model');db[_0x7bf5('0x87')]=db['sequelize'][_0x7bf5('0x12')]('../api/pause/pause.model');db[_0x7bf5('0x88')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x89'));db['VoiceQueuesLog']=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x8a'));db[_0x7bf5('0x8b')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/schedule/schedule.model');db[_0x7bf5('0x8c')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x8d'));db[_0x7bf5('0x8e')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0x8f'));db[_0x7bf5('0x90')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x91'));db[_0x7bf5('0x92')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x93'));db[_0x7bf5('0x94')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x95'));db[_0x7bf5('0x96')]=db[_0x7bf5('0x1')]['import']('../api/template/template.model');db[_0x7bf5('0x97')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x98'));db[_0x7bf5('0x99')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/variable/variable.model');db[_0x7bf5('0x9a')]=db['sequelize'][_0x7bf5('0x12')]('../api/integration/integration.model');db[_0x7bf5('0x9b')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x9c'));db[_0x7bf5('0x9d')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x9e'));db['AnalyticDefaultReport']=db[_0x7bf5('0x1')]['import'](_0x7bf5('0x9f'));db[_0x7bf5('0xa0')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0xa1'));db[_0x7bf5('0xa2')]=db['sequelize'][_0x7bf5('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x7bf5('0xa3')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x7bf5('0xa4')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x7bf5('0xa5')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xa6'));db['SalesforceConfiguration']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xa7'));db[_0x7bf5('0xa8')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x7bf5('0xa9')]=db['sequelize'][_0x7bf5('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x7bf5('0xaa')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0xab'));db[_0x7bf5('0xac')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0xad'));db[_0x7bf5('0xae')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xaf'));db[_0x7bf5('0xb0')]=db['sequelize']['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xb1'));db[_0x7bf5('0xb2')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xb3'));db['ZohoConfiguration']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xb4'));db['ZohoField']=db['sequelize'][_0x7bf5('0x12')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize'][_0x7bf5('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x7bf5('0xb5')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xb6'));db[_0x7bf5('0xb7')]=db['sequelize']['import'](_0x7bf5('0xb8'));db[_0x7bf5('0xb9')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xba'));db['FreshdeskConfiguration']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xbb'));db[_0x7bf5('0xbc')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xbd'));db[_0x7bf5('0xbe')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x7bf5('0x1')]['import'](_0x7bf5('0xbf'));db['ServicenowAccount']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xc0'));db['ServicenowConfiguration']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xc1'));db['ServicenowField']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xc2'));db[_0x7bf5('0xc3')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xc4'));db['Dynamics365Configuration']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xc5'));db[_0x7bf5('0xc6')]=db[_0x7bf5('0x1')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db['sequelize'][_0x7bf5('0x12')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x7bf5('0xc7')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xc8'));db[_0x7bf5('0xc9')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0xca'));db['Integration']=db[_0x7bf5('0x1')]['import']('../api/integration/integration.model');db[_0x7bf5('0xcb')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xcc'));db[_0x7bf5('0xcd')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xce'));db['ChatInternalMessage']=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x7bf5('0xcf')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xd0'));db[_0x7bf5('0xd1')]=db[_0x7bf5('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0xd2'));db[_0x7bf5('0xd3')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0xd4'));db['SquareReport']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xd5'));db[_0x7bf5('0xd6')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xd7'));db[_0x7bf5('0xd8')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0xd9'));db[_0x7bf5('0xda')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/setting/setting.model');db[_0x7bf5('0xdb')]=db['sequelize']['import']('../api/squareOdbc/squareOdbc.model');db[_0x7bf5('0xdc')]=db[_0x7bf5('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x7bf5('0xdd')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xde'));db[_0x7bf5('0xdf')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xe0'));db[_0x7bf5('0xe1')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/team/team.model');db[_0x7bf5('0xe2')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xe3'));db[_0x7bf5('0xe4')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0xe5'));db['Migration']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xe6'));db[_0x7bf5('0xe7')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xe8'));db['Plugin']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xe9'));db[_0x7bf5('0xea')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xeb'));db[_0x7bf5('0xec')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x7bf5('0xed')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0xee'));db['OpenchannelTransferReport']=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x7bf5('0xef')]=db['sequelize'][_0x7bf5('0x12')](_0x7bf5('0xf0'));db[_0x7bf5('0xf1')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xf2'));db[_0x7bf5('0xf3')]=db['sequelize'][_0x7bf5('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x7bf5('0xf4')]=db['sequelize']['import'](_0x7bf5('0xf5'));db[_0x7bf5('0xf6')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x7bf5('0xf7')]=db['sequelize'][_0x7bf5('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x7bf5('0xf8')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xf9'));db[_0x7bf5('0xfa')]=db[_0x7bf5('0x1')]['import'](_0x7bf5('0xfb'));db[_0x7bf5('0xfc')]=db['sequelize']['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x7bf5('0xfd')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0xfe'));db[_0x7bf5('0xff')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')]('../api/whatsappMessage/whatsappMessage.model');db[_0x7bf5('0x100')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x101'));db[_0x7bf5('0x102')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x103'));db[_0x7bf5('0x104')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x105'));db['CloudProvider']=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x106'));db[_0x7bf5('0x107')]=db[_0x7bf5('0x1')][_0x7bf5('0x12')](_0x7bf5('0x108'));db['User']['hasOne'](db[_0x7bf5('0x109')],{'as':'VoiceMail','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x10b')});db['User'][_0x7bf5('0x10c')](db[_0x7bf5('0x1d')],{'as':'Recordings','foreignKey':'UserId'});db[_0x7bf5('0x10d')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x7bf5('0x10e'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x10d')]['hasMany'](db[_0x7bf5('0x17')],{'as':_0x7bf5('0x10f'),'onDelete':_0x7bf5('0x10a'),'hooks':!![]});db[_0x7bf5('0x10d')][_0x7bf5('0x10c')](db[_0x7bf5('0x110')],{'as':'HopperFinals','foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x10d')][_0x7bf5('0x10c')](db['CmHopperHistory'],{'as':_0x7bf5('0x111'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x10d')][_0x7bf5('0x10c')](db['ReportAgentPreview'],{'as':_0x7bf5('0x79'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x10d')][_0x7bf5('0x10c')](db[_0x7bf5('0x5d')],{'as':_0x7bf5('0x112'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x10d')][_0x7bf5('0x10c')](db[_0x7bf5('0x67')],{'as':'ChatInteractions','foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x10d')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x7bf5('0x10d')][_0x7bf5('0x10c')](db[_0x7bf5('0x4b')],{'as':_0x7bf5('0x113'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x10d')]['hasMany'](db[_0x7bf5('0x3c')],{'as':_0x7bf5('0x114'),'foreignKey':'UserId'});db['User'][_0x7bf5('0x10c')](db[_0x7bf5('0xfd')],{'as':_0x7bf5('0x115'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x10d')]['hasMany'](db[_0x7bf5('0xf8')],{'as':_0x7bf5('0x116'),'foreignKey':'SenderId'});db[_0x7bf5('0x10d')][_0x7bf5('0x117')](db[_0x7bf5('0xf4')],{'as':_0x7bf5('0xf4'),'foreignKey':_0x7bf5('0x118')});db[_0x7bf5('0x10d')]['belongsToMany'](db[_0x7bf5('0x119')],{'as':_0x7bf5('0x11a'),'through':_0x7bf5('0x11b')});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x11e'),'through':_0x7bf5('0x11f')});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db['CmList'],{'as':_0x7bf5('0x120'),'through':_0x7bf5('0x121')});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db['Team'],{'through':_0x7bf5('0x122')});db['User'][_0x7bf5('0x11c')](db[_0x7bf5('0x3c')],{'as':_0x7bf5('0x114'),'through':'user_has_mail_interactions'});db['User'][_0x7bf5('0x11c')](db[_0x7bf5('0x67')],{'as':_0x7bf5('0x123'),'through':_0x7bf5('0x124')});db[_0x7bf5('0x10d')]['belongsToMany'](db[_0x7bf5('0x4b')],{'as':_0x7bf5('0x113'),'through':_0x7bf5('0x125')});db[_0x7bf5('0x10d')]['belongsToMany'](db[_0x7bf5('0x55')],{'as':'SmsInteractions','through':_0x7bf5('0x126')});db[_0x7bf5('0x10d')]['belongsToMany'](db[_0x7bf5('0x5d')],{'as':_0x7bf5('0x112'),'through':'user_has_openchannel_interactions'});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db[_0x7bf5('0xfd')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db[_0x7bf5('0x1b')],{'as':_0x7bf5('0x127'),'through':'UserVoiceQueue','required':![]});db['User'][_0x7bf5('0x11c')](db[_0x7bf5('0x3a')],{'as':'MailQueues','through':_0x7bf5('0x128'),'required':![]});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db['ChatQueue'],{'as':_0x7bf5('0x129'),'through':_0x7bf5('0x12a'),'required':![],'hooks':!![]});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db[_0x7bf5('0x12b')],{'as':_0x7bf5('0x12c'),'through':_0x7bf5('0x12d'),'required':![]});db['User']['belongsToMany'](db[_0x7bf5('0x58')],{'as':_0x7bf5('0x12e'),'through':_0x7bf5('0x33'),'required':![]});db['User'][_0x7bf5('0x11c')](db[_0x7bf5('0x61')],{'as':_0x7bf5('0x12f'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x7bf5('0x11c')](db[_0x7bf5('0x104')],{'as':_0x7bf5('0x130'),'through':_0x7bf5('0x131'),'required':![]});db['User'][_0x7bf5('0x11c')](db[_0x7bf5('0xf1')],{'through':_0x7bf5('0x121')});db['User'][_0x7bf5('0x11c')](db['VoicePrefix'],{'as':_0x7bf5('0x132'),'through':_0x7bf5('0x133'),'required':![]});db[_0x7bf5('0x10d')]['belongsToMany'](db[_0x7bf5('0x134')],{'as':_0x7bf5('0x135'),'through':'user_has_chat_websites'});db[_0x7bf5('0x10d')]['belongsToMany'](db[_0x7bf5('0x47')],{'as':'FaxAccounts','through':_0x7bf5('0x136')});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db['MailAccount'],{'as':_0x7bf5('0x137'),'through':_0x7bf5('0x138')});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db[_0x7bf5('0x59')],{'as':'OpenchannelAccounts','through':_0x7bf5('0x139')});db['User'][_0x7bf5('0x11c')](db[_0x7bf5('0x51')],{'as':_0x7bf5('0x13a'),'through':_0x7bf5('0x13b')});db[_0x7bf5('0x10d')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x7bf5('0x13c'),'through':'user_has_whatsapp_accounts'});db[_0x7bf5('0x10d')][_0x7bf5('0x11c')](db[_0x7bf5('0xdc')],{'as':_0x7bf5('0x13d'),'through':_0x7bf5('0x13e')});db[_0x7bf5('0x14')][_0x7bf5('0x10c')](db[_0x7bf5('0x17')],{'as':_0x7bf5('0x13f'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x140')});db[_0x7bf5('0x141')][_0x7bf5('0x10c')](db[_0x7bf5('0x17')],{'onDelete':_0x7bf5('0x10a')});db['VoiceExtension']['hasMany'](db['VoiceExtension'],{'as':_0x7bf5('0x142'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x19')][_0x7bf5('0x11c')](db[_0x7bf5('0x8c')],{'as':'Sounds','through':'moh_has_sounds'});db[_0x7bf5('0x1b')][_0x7bf5('0x10c')](db[_0x7bf5('0x2d')],{'as':_0x7bf5('0x143'),'foreignKey':_0x7bf5('0x144')});db[_0x7bf5('0x1b')]['hasMany'](db[_0x7bf5('0x73')],{'as':'Hoppers','foreignKey':_0x7bf5('0x144')});db[_0x7bf5('0x1b')][_0x7bf5('0x10c')](db['CmHopperFinal'],{'as':_0x7bf5('0x145'),'foreignKey':'VoiceQueueId'});db[_0x7bf5('0x1b')][_0x7bf5('0x10c')](db[_0x7bf5('0x78')],{'as':_0x7bf5('0x146'),'foreignKey':_0x7bf5('0x144')});db[_0x7bf5('0x1b')][_0x7bf5('0x10c')](db['ReportAgentPreview'],{'as':_0x7bf5('0x79'),'foreignKey':'VoiceQueueId'});db[_0x7bf5('0x1b')][_0x7bf5('0x10c')](db[_0x7bf5('0x75')],{'as':_0x7bf5('0x147'),'foreignKey':_0x7bf5('0x144')});db[_0x7bf5('0x1b')][_0x7bf5('0x10c')](db[_0x7bf5('0x148')],{'as':_0x7bf5('0x149'),'foreignKey':_0x7bf5('0x144')});db[_0x7bf5('0x1b')][_0x7bf5('0x117')](db['Trunk'],{'as':_0x7bf5('0x2b'),'foreignKey':_0x7bf5('0x14a')});db[_0x7bf5('0x1b')][_0x7bf5('0x117')](db[_0x7bf5('0x2b')],{'as':_0x7bf5('0x14b'),'foreignKey':'TrunkBackupId'});db[_0x7bf5('0x1b')]['belongsTo'](db[_0x7bf5('0x86')],{'as':_0x7bf5('0x86'),'foreignKey':_0x7bf5('0x14c')});db[_0x7bf5('0x1b')][_0x7bf5('0x117')](db[_0x7bf5('0x87')],{'as':_0x7bf5('0x14d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7bf5('0x1b')][_0x7bf5('0x11c')](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x120'),'through':'voice_queues_has_cm_lists'});db[_0x7bf5('0x1b')][_0x7bf5('0x11c')](db['User'],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x2e')});db[_0x7bf5('0x1b')][_0x7bf5('0x11c')](db[_0x7bf5('0xe1')],{'as':_0x7bf5('0x14f'),'through':_0x7bf5('0x107')});db[_0x7bf5('0x1b')][_0x7bf5('0x11c')](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x150'),'through':_0x7bf5('0x151')});db[_0x7bf5('0x1d')]['belongsTo'](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x10d'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x1f')][_0x7bf5('0x117')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x7bf5('0x109')]['hasMany'](db[_0x7bf5('0x22')],{'as':_0x7bf5('0x152'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x153'),'sourceKey':_0x7bf5('0x154')});db[_0x7bf5('0x22')][_0x7bf5('0x117')](db[_0x7bf5('0x109')],{'foreignKey':_0x7bf5('0x153'),'targetKey':'mailbox'});db[_0x7bf5('0x155')][_0x7bf5('0x10c')](db[_0x7bf5('0x28')],{'as':_0x7bf5('0x156'),'foreignKey':_0x7bf5('0x157'),'constraints':![]});db['VoiceCallReport'][_0x7bf5('0x10c')](db['VoiceAgentReport'],{'as':_0x7bf5('0x158'),'foreignKey':_0x7bf5('0x157'),'constraints':![]});db[_0x7bf5('0x155')]['belongsTo'](db['User'],{'as':_0x7bf5('0x10d'),'foreignKey':_0x7bf5('0x10b')});db['VoiceCallReport']['belongsTo'](db[_0x7bf5('0x11d')],{'as':'Contact','foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0x36')][_0x7bf5('0x117')](db[_0x7bf5('0x15a')],{'as':'MailAccount','foreignKey':_0x7bf5('0x15b')});db[_0x7bf5('0x38')]['belongsTo'](db[_0x7bf5('0x15a')],{'as':_0x7bf5('0x15a'),'foreignKey':_0x7bf5('0x15b')});db[_0x7bf5('0x15a')][_0x7bf5('0x15c')](db[_0x7bf5('0x36')],{'as':_0x7bf5('0x15d'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x15a')]['hasOne'](db[_0x7bf5('0x38')],{'as':_0x7bf5('0x15e'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x15a')]['hasMany'](db[_0x7bf5('0x82')],{'as':'Dispositions','foreignKey':_0x7bf5('0x15b')});db[_0x7bf5('0x15a')][_0x7bf5('0x10c')](db[_0x7bf5('0x81')],{'as':_0x7bf5('0x15f'),'foreignKey':_0x7bf5('0x15b')});db[_0x7bf5('0x15a')][_0x7bf5('0x10c')](db['MailMessage'],{'as':'Messages','foreignKey':_0x7bf5('0x15b')});db[_0x7bf5('0x15a')]['hasMany'](db[_0x7bf5('0x3c')],{'as':_0x7bf5('0x160')});db[_0x7bf5('0x15a')][_0x7bf5('0x10c')](db[_0x7bf5('0x40')],{'as':_0x7bf5('0x142')});db['MailAccount']['belongsTo'](db[_0x7bf5('0xf1')],{'as':'List','foreignKey':_0x7bf5('0x161')});db[_0x7bf5('0x15a')][_0x7bf5('0x117')](db[_0x7bf5('0x96')],{'as':_0x7bf5('0x96'),'foreignKey':_0x7bf5('0x162')});db['MailAccount'][_0x7bf5('0x117')](db[_0x7bf5('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x7bf5('0x163')});db[_0x7bf5('0x15a')][_0x7bf5('0x11c')](db['User'],{'as':_0x7bf5('0x14e'),'through':'user_has_mail_accounts'});db['MailQueue'][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':'Agents','through':_0x7bf5('0x128')});db[_0x7bf5('0x3a')][_0x7bf5('0x11c')](db[_0x7bf5('0xe1')],{'through':_0x7bf5('0x164'),'as':_0x7bf5('0x14f')});db['MailInteraction'][_0x7bf5('0x10c')](db['MailMessage'],{'as':_0x7bf5('0x152'),'onDelete':_0x7bf5('0x10a'),'foreignKey':'MailInteractionId'});db[_0x7bf5('0x3c')][_0x7bf5('0x117')](db['MailAccount'],{'as':'Account','foreignKey':_0x7bf5('0x15b')});db[_0x7bf5('0x3c')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db['MailInteraction'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x166'),'foreignKey':'UserId'});db['MailInteraction'][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x167'),'as':_0x7bf5('0x168')});db[_0x7bf5('0x3c')][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x167'),'as':_0x7bf5('0x169')});db[_0x7bf5('0x3c')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':'Users','through':_0x7bf5('0x16a'),'foreignKey':'MailInteractionId'});db[_0x7bf5('0x3e')][_0x7bf5('0x10c')](db[_0x7bf5('0xe7')],{'as':'Attachments','onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x3e')]['belongsTo'](db['User'],{'as':'User'});db['MailMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x7bf5('0x10a'),'as':_0x7bf5('0x165')});db['MailMessage'][_0x7bf5('0x117')](db['MailInteraction'],{'as':_0x7bf5('0x16b'),'foreignKey':_0x7bf5('0x16c')});db[_0x7bf5('0x3e')]['belongsTo'](db[_0x7bf5('0x15a')],{'as':'Account','foreignKey':_0x7bf5('0x15b')});db[_0x7bf5('0x3e')][_0x7bf5('0x117')](db[_0x7bf5('0x134')],{'as':_0x7bf5('0x134'),'foreignKey':_0x7bf5('0x16d')});db[_0x7bf5('0x3e')][_0x7bf5('0x117')](db[_0x7bf5('0x6b')],{'as':_0x7bf5('0x6b'),'foreignKey':'ChatOfflineMessageId'});db[_0x7bf5('0x40')]['belongsTo'](db[_0x7bf5('0x10d')],{'onDelete':'restrict'});db[_0x7bf5('0x40')]['belongsTo'](db[_0x7bf5('0x3a')],{'onDelete':_0x7bf5('0x16e')});db['MailApplication'][_0x7bf5('0x117')](db[_0x7bf5('0x15a')],{'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x40')][_0x7bf5('0x117')](db['Interval'],{'onDelete':_0x7bf5('0x16e'),'foreignKey':'IntervalId'});db[_0x7bf5('0x40')][_0x7bf5('0x117')](db['Tag'],{'onDelete':_0x7bf5('0x16e'),'foreignKey':_0x7bf5('0x16f')});db[_0x7bf5('0x42')]['belongsTo'](db[_0x7bf5('0x15a')],{});db[_0x7bf5('0x42')][_0x7bf5('0x117')](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x170'),'foreignKey':'ListId'});db[_0x7bf5('0x42')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0x42')]['belongsTo'](db['MailInteraction'],{});db[_0x7bf5('0x42')][_0x7bf5('0x117')](db['MailMessage'],{});db[_0x7bf5('0x42')]['belongsTo'](db['User'],{});db[_0x7bf5('0x42')][_0x7bf5('0x117')](db[_0x7bf5('0x3a')],{});db[_0x7bf5('0x171')][_0x7bf5('0x10c')](db[_0x7bf5('0x45')],{'as':_0x7bf5('0x172'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x47')][_0x7bf5('0x10c')](db[_0x7bf5('0x82')],{'as':_0x7bf5('0x173'),'foreignKey':_0x7bf5('0x174')});db['FaxAccount']['hasMany'](db['CannedAnswer'],{'as':_0x7bf5('0x15f'),'foreignKey':_0x7bf5('0x174')});db[_0x7bf5('0x47')][_0x7bf5('0x10c')](db[_0x7bf5('0x4b')],{'as':'Interactions'});db['FaxAccount'][_0x7bf5('0x10c')](db['FaxApplication'],{'as':_0x7bf5('0x142')});db['FaxAccount']['hasMany'](db[_0x7bf5('0x17')],{'as':_0x7bf5('0x175'),'onDelete':'cascade'});db[_0x7bf5('0x47')][_0x7bf5('0x10c')](db['FaxMessage'],{'as':_0x7bf5('0x152')});db[_0x7bf5('0x47')]['belongsTo'](db['Trunk'],{'as':_0x7bf5('0x2b')});db[_0x7bf5('0x47')][_0x7bf5('0x117')](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x170'),'foreignKey':'ListId'});db[_0x7bf5('0x47')]['belongsTo'](db[_0x7bf5('0x87')],{'as':_0x7bf5('0x14d'),'foreignKey':_0x7bf5('0x163')});db[_0x7bf5('0x47')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x136')});db[_0x7bf5('0x49')]['belongsTo'](db[_0x7bf5('0x10d')],{'onDelete':'restrict'});db[_0x7bf5('0x49')][_0x7bf5('0x117')](db[_0x7bf5('0x12b')],{'onDelete':'restrict'});db[_0x7bf5('0x49')][_0x7bf5('0x117')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x7bf5('0x49')][_0x7bf5('0x117')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x7bf5('0x16f')});db[_0x7bf5('0x4b')]['hasMany'](db[_0x7bf5('0x4c')],{'as':_0x7bf5('0x152'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x176')});db['FaxInteraction'][_0x7bf5('0x117')](db['FaxAccount'],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x174')});db['FaxInteraction'][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db['FaxInteraction'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x166'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x4b')][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x178'),'as':'Tags'});db['FaxInteraction'][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':'fax_interaction_has_tags','as':_0x7bf5('0x169')});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0x7bf5('0x179'),'through':_0x7bf5('0x125'),'foreignKey':_0x7bf5('0x176')});db['FaxMessage'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'onDelete':_0x7bf5('0x10a'),'as':_0x7bf5('0x10d')});db[_0x7bf5('0x4c')][_0x7bf5('0x117')](db[_0x7bf5('0x4b')],{'as':_0x7bf5('0x16b'),'foreignKey':_0x7bf5('0x176')});db[_0x7bf5('0x4c')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'onDelete':'cascade','as':_0x7bf5('0x165')});db[_0x7bf5('0x4c')][_0x7bf5('0x117')](db['Attachment'],{'as':_0x7bf5('0xe7'),'foreignKey':_0x7bf5('0x17a')});db[_0x7bf5('0x4c')][_0x7bf5('0x117')](db[_0x7bf5('0x47')],{'as':'Account','foreignKey':_0x7bf5('0x174')});db['FaxQueue']['belongsToMany'](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x12d')});db[_0x7bf5('0x12b')][_0x7bf5('0x11c')](db['Team'],{'through':'team_has_fax_queues','as':_0x7bf5('0x14f')});db[_0x7bf5('0x4f')][_0x7bf5('0x117')](db[_0x7bf5('0x47')],{});db[_0x7bf5('0x4f')][_0x7bf5('0x117')](db[_0x7bf5('0xf1')],{'as':'List','foreignKey':_0x7bf5('0x161')});db['FaxQueueReport'][_0x7bf5('0x117')](db['CmContact'],{'as':_0x7bf5('0x165'),'foreignKey':'ContactId'});db[_0x7bf5('0x4f')][_0x7bf5('0x117')](db[_0x7bf5('0x4b')],{});db[_0x7bf5('0x4f')][_0x7bf5('0x117')](db[_0x7bf5('0x4c')],{});db[_0x7bf5('0x4f')][_0x7bf5('0x117')](db['User'],{});db[_0x7bf5('0x4f')][_0x7bf5('0x117')](db[_0x7bf5('0x12b')],{});db[_0x7bf5('0x51')]['hasMany'](db[_0x7bf5('0x82')],{'as':_0x7bf5('0x173'),'foreignKey':'SmsAccountId'});db[_0x7bf5('0x51')][_0x7bf5('0x10c')](db['CannedAnswer'],{'as':_0x7bf5('0x15f'),'foreignKey':_0x7bf5('0x17b')});db[_0x7bf5('0x51')][_0x7bf5('0x10c')](db[_0x7bf5('0x56')],{'as':_0x7bf5('0x152'),'foreignKey':_0x7bf5('0x17b')});db[_0x7bf5('0x51')][_0x7bf5('0x10c')](db[_0x7bf5('0x55')],{'as':_0x7bf5('0x160')});db[_0x7bf5('0x51')][_0x7bf5('0x10c')](db[_0x7bf5('0x53')],{'as':'Applications'});db[_0x7bf5('0x51')][_0x7bf5('0x117')](db['CmList'],{'as':'List','foreignKey':_0x7bf5('0x161')});db[_0x7bf5('0x51')]['belongsTo'](db['Pause'],{'as':_0x7bf5('0x14d'),'foreignKey':_0x7bf5('0x163')});db['SmsAccount'][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':'Agents','through':_0x7bf5('0x13b')});db[_0x7bf5('0x53')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x53')][_0x7bf5('0x117')](db[_0x7bf5('0x58')],{'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x53')][_0x7bf5('0x117')](db[_0x7bf5('0x51')],{'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x53')][_0x7bf5('0x117')](db['Interval'],{'onDelete':_0x7bf5('0x16e'),'foreignKey':_0x7bf5('0x14c')});db[_0x7bf5('0x53')][_0x7bf5('0x117')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x7bf5('0x55')][_0x7bf5('0x10c')](db[_0x7bf5('0x56')],{'as':_0x7bf5('0x152'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x17c')});db['SmsInteraction'][_0x7bf5('0x117')](db[_0x7bf5('0x51')],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x17b')});db[_0x7bf5('0x55')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':'ContactId'});db['SmsInteraction'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x166'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x55')][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':'sms_interaction_has_tags','as':_0x7bf5('0x168')});db[_0x7bf5('0x55')][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x17d'),'as':_0x7bf5('0x169')});db['SmsInteraction'][_0x7bf5('0x11c')](db['User'],{'as':_0x7bf5('0x179'),'through':_0x7bf5('0x126'),'foreignKey':'SmsInteractionId'});db[_0x7bf5('0x56')][_0x7bf5('0x117')](db['User'],{'as':_0x7bf5('0x10d')});db[_0x7bf5('0x56')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'onDelete':_0x7bf5('0x10a'),'as':_0x7bf5('0x165')});db[_0x7bf5('0x56')][_0x7bf5('0x117')](db[_0x7bf5('0x55')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x7bf5('0x17c')});db[_0x7bf5('0x56')][_0x7bf5('0x117')](db['SmsAccount'],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x17b')});db[_0x7bf5('0x58')][_0x7bf5('0x11c')](db['User'],{'as':'Agents','through':_0x7bf5('0x33'),'foreignKey':_0x7bf5('0x17e')});db[_0x7bf5('0x58')][_0x7bf5('0x11c')](db[_0x7bf5('0xe1')],{'through':_0x7bf5('0x17f'),'as':_0x7bf5('0x14f')});db[_0x7bf5('0x59')]['hasMany'](db[_0x7bf5('0x82')],{'as':_0x7bf5('0x173'),'foreignKey':_0x7bf5('0x180')});db[_0x7bf5('0x59')]['hasMany'](db['CannedAnswer'],{'as':_0x7bf5('0x15f'),'foreignKey':_0x7bf5('0x180')});db['OpenchannelAccount'][_0x7bf5('0x10c')](db[_0x7bf5('0x5d')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x7bf5('0x59')][_0x7bf5('0x10c')](db['OpenchannelMessage'],{'as':_0x7bf5('0x152'),'foreignKey':_0x7bf5('0x180')});db[_0x7bf5('0x59')][_0x7bf5('0x10c')](db[_0x7bf5('0x5b')],{'as':_0x7bf5('0x142'),'foreignKey':_0x7bf5('0x180')});db[_0x7bf5('0x59')][_0x7bf5('0x117')](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x170'),'foreignKey':'ListId'});db[_0x7bf5('0x59')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x7bf5('0x163')});db[_0x7bf5('0x59')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x139')});db['OpenchannelApplication'][_0x7bf5('0x117')](db['User'],{'onDelete':'restrict'});db[_0x7bf5('0x5b')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x7bf5('0x181')});db[_0x7bf5('0x5b')][_0x7bf5('0x117')](db[_0x7bf5('0x59')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x7bf5('0x5b')]['belongsTo'](db[_0x7bf5('0x86')],{'onDelete':_0x7bf5('0x16e'),'foreignKey':_0x7bf5('0x14c')});db['OpenchannelApplication'][_0x7bf5('0x117')](db[_0x7bf5('0x8e')],{'onDelete':_0x7bf5('0x16e'),'foreignKey':_0x7bf5('0x16f')});db[_0x7bf5('0x5d')][_0x7bf5('0x10c')](db[_0x7bf5('0x5f')],{'as':_0x7bf5('0x152'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x182')});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x7bf5('0x180')});db[_0x7bf5('0x5d')]['belongsTo'](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db['OpenchannelInteraction'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':'Owner','foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x5d')][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x183'),'as':_0x7bf5('0x168')});db[_0x7bf5('0x5d')]['belongsToMany'](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x183'),'as':_0x7bf5('0x169')});db[_0x7bf5('0x5d')][_0x7bf5('0x11c')](db['User'],{'as':_0x7bf5('0x179'),'through':_0x7bf5('0x184'),'foreignKey':_0x7bf5('0x182')});db[_0x7bf5('0x5f')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'onDelete':_0x7bf5('0x10a'),'as':_0x7bf5('0x10d')});db[_0x7bf5('0x5f')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'onDelete':_0x7bf5('0x10a'),'as':'Contact'});db[_0x7bf5('0x5f')]['belongsTo'](db[_0x7bf5('0x5d')],{'onDelete':'cascade','as':_0x7bf5('0x16b'),'foreignKey':_0x7bf5('0x182')});db[_0x7bf5('0x5f')][_0x7bf5('0x117')](db[_0x7bf5('0xe7')],{'as':_0x7bf5('0xe7'),'foreignKey':'AttachmentId'});db[_0x7bf5('0x5f')][_0x7bf5('0x117')](db[_0x7bf5('0x59')],{'as':'Account','foreignKey':_0x7bf5('0x180')});db[_0x7bf5('0x61')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x185'),'foreignKey':_0x7bf5('0x181')});db[_0x7bf5('0x61')][_0x7bf5('0x11c')](db['Team'],{'through':_0x7bf5('0x186'),'as':_0x7bf5('0x14f')});db[_0x7bf5('0x134')][_0x7bf5('0x10c')](db[_0x7bf5('0x82')],{'as':_0x7bf5('0x173'),'foreignKey':_0x7bf5('0x16d')});db['ChatWebsite'][_0x7bf5('0x10c')](db[_0x7bf5('0x81')],{'as':_0x7bf5('0x15f'),'foreignKey':_0x7bf5('0x16d')});db[_0x7bf5('0x134')][_0x7bf5('0x10c')](db['ChatProactiveAction'],{'as':_0x7bf5('0x187')});db[_0x7bf5('0x134')][_0x7bf5('0x10c')](db[_0x7bf5('0x67')],{'as':'Interactions'});db[_0x7bf5('0x134')]['hasMany'](db[_0x7bf5('0x65')],{'as':_0x7bf5('0x142')});db[_0x7bf5('0x134')]['hasMany'](db[_0x7bf5('0x69')],{'as':'Messages'});db[_0x7bf5('0x134')][_0x7bf5('0x117')](db['CmList'],{'as':_0x7bf5('0x170'),'foreignKey':_0x7bf5('0x161')});db[_0x7bf5('0x134')][_0x7bf5('0x117')](db[_0x7bf5('0x86')],{'as':_0x7bf5('0x86'),'foreignKey':'IntervalId'});db[_0x7bf5('0x134')]['belongsTo'](db[_0x7bf5('0x15a')],{'as':_0x7bf5('0x15a'),'foreignKey':'MailAccountId'});db[_0x7bf5('0x134')][_0x7bf5('0x117')](db[_0x7bf5('0x87')],{'as':_0x7bf5('0x14d'),'foreignKey':_0x7bf5('0x163')});db['ChatWebsite'][_0x7bf5('0x11c')](db['User'],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x188')});db[_0x7bf5('0x63')]['belongsTo'](db['OpenchannelAccount'],{});db[_0x7bf5('0x63')][_0x7bf5('0x117')](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x170'),'foreignKey':_0x7bf5('0x161')});db[_0x7bf5('0x63')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0x63')][_0x7bf5('0x117')](db[_0x7bf5('0x5d')],{});db['OpenchannelQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0x5f')],{});db[_0x7bf5('0x63')]['belongsTo'](db['User'],{});db[_0x7bf5('0x63')][_0x7bf5('0x117')](db[_0x7bf5('0x61')],{});db[_0x7bf5('0x65')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x189'),'foreignKey':_0x7bf5('0x10b'),'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x65')][_0x7bf5('0x117')](db[_0x7bf5('0x6d')],{'as':_0x7bf5('0x18a'),'foreignKey':_0x7bf5('0x18b'),'onDelete':_0x7bf5('0x16e')});db['ChatApplication'][_0x7bf5('0x117')](db[_0x7bf5('0x134')],{'as':_0x7bf5('0x18c'),'foreignKey':_0x7bf5('0x16d'),'onDelete':'restrict'});db[_0x7bf5('0x65')]['belongsTo'](db[_0x7bf5('0x8e')],{'onDelete':_0x7bf5('0x16e'),'foreignKey':_0x7bf5('0x16f')});db[_0x7bf5('0x67')][_0x7bf5('0x10c')](db['ChatMessage'],{'as':_0x7bf5('0x152'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x18d')});db[_0x7bf5('0x67')][_0x7bf5('0x117')](db[_0x7bf5('0x134')],{'as':'Account','foreignKey':_0x7bf5('0x16d')});db[_0x7bf5('0x67')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':'Contact','foreignKey':'ContactId'});db[_0x7bf5('0x67')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x166'),'foreignKey':_0x7bf5('0x10b')});db['ChatInteraction'][_0x7bf5('0x11c')](db['Tag'],{'through':_0x7bf5('0x18e'),'as':_0x7bf5('0x168')});db['ChatInteraction'][_0x7bf5('0x11c')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x7bf5('0x169')});db[_0x7bf5('0x67')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x179'),'through':_0x7bf5('0x124'),'foreignKey':_0x7bf5('0x18d')});db[_0x7bf5('0x69')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'onDelete':_0x7bf5('0x10a'),'as':'User'});db['ChatMessage'][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'onDelete':'cascade','as':_0x7bf5('0x165'),'foreignKey':'ContactId'});db[_0x7bf5('0x69')][_0x7bf5('0x117')](db[_0x7bf5('0x67')],{'onDelete':_0x7bf5('0x10a'),'as':_0x7bf5('0x16b'),'foreignKey':_0x7bf5('0x18d')});db[_0x7bf5('0x69')][_0x7bf5('0x117')](db[_0x7bf5('0xe7')],{'as':_0x7bf5('0xe7'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x7bf5('0x117')](db['ChatWebsite'],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x16d')});db['ChatOfflineMessage']['hasMany'](db[_0x7bf5('0xe7')],{'as':_0x7bf5('0x18f'),'foreignKey':_0x7bf5('0x190'),'onDelete':'cascade','hooks':!![]});db[_0x7bf5('0x6b')]['belongsTo'](db[_0x7bf5('0x11d')],{'onDelete':'cascade','as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0x6b')][_0x7bf5('0x117')](db[_0x7bf5('0x134')],{'as':_0x7bf5('0x177'),'foreignKey':'ChatWebsiteId'});db[_0x7bf5('0x6d')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x12a'),'hooks':!![]});db[_0x7bf5('0x6d')][_0x7bf5('0x11c')](db[_0x7bf5('0xe1')],{'through':_0x7bf5('0x191'),'as':_0x7bf5('0x14f')});db[_0x7bf5('0x119')][_0x7bf5('0x10c')](db[_0x7bf5('0x192')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x119')][_0x7bf5('0x11c')](db['User'],{'as':_0x7bf5('0x143'),'through':_0x7bf5('0x11b')});db['ChatProactiveAction'][_0x7bf5('0x117')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x7bf5('0x16d')});db[_0x7bf5('0x193')][_0x7bf5('0x10c')](db[_0x7bf5('0x11d')],{'as':'Contacts','foreignKey':_0x7bf5('0x194')});db[_0x7bf5('0x11d')][_0x7bf5('0x10c')](db[_0x7bf5('0x92')],{'as':_0x7bf5('0x195'),'foreignKey':_0x7bf5('0x196')});db['CmContact']['hasMany'](db[_0x7bf5('0x73')],{'as':_0x7bf5('0x197'),'foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0x11d')]['hasMany'](db[_0x7bf5('0x110')],{'as':_0x7bf5('0x145'),'foreignKey':_0x7bf5('0x159')});db['CmContact'][_0x7bf5('0x10c')](db[_0x7bf5('0x78')],{'as':_0x7bf5('0x146'),'foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0x11d')][_0x7bf5('0x10c')](db[_0x7bf5('0x79')],{'as':_0x7bf5('0x79'),'foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0x11d')][_0x7bf5('0x10c')](db[_0x7bf5('0x148')],{'as':_0x7bf5('0x149'),'foreignKey':'ContactId'});db[_0x7bf5('0x11d')]['hasMany'](db[_0x7bf5('0x5d')],{'as':_0x7bf5('0x112'),'foreignKey':_0x7bf5('0x159'),'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x11d')][_0x7bf5('0x10c')](db[_0x7bf5('0x67')],{'as':_0x7bf5('0x123'),'foreignKey':'ContactId','onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x11d')]['hasMany'](db[_0x7bf5('0x55')],{'as':_0x7bf5('0x198'),'foreignKey':'ContactId','onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x11d')][_0x7bf5('0x10c')](db[_0x7bf5('0x4b')],{'as':'FaxInteractions','foreignKey':_0x7bf5('0x159'),'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x11d')][_0x7bf5('0x10c')](db[_0x7bf5('0x3c')],{'as':_0x7bf5('0x114'),'foreignKey':_0x7bf5('0x159'),'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0x11d')]['belongsTo'](db[_0x7bf5('0x193')],{'as':_0x7bf5('0x199'),'foreignKey':'CompanyId'});db[_0x7bf5('0x11d')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x7bf5('0x11d')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x179'),'through':'cm_user_has_contacts'});db[_0x7bf5('0x11d')][_0x7bf5('0x11c')](db['Tag'],{'as':'Tags','through':_0x7bf5('0x19a')});db[_0x7bf5('0x11d')][_0x7bf5('0x11c')](db['Tag'],{'through':_0x7bf5('0x19a'),'as':_0x7bf5('0x169')});db['CmHopper']['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x7bf5('0x19b'),'foreignKey':_0x7bf5('0x19c')});db[_0x7bf5('0x73')]['belongsTo'](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x73')][_0x7bf5('0x117')](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x170'),'foreignKey':_0x7bf5('0x161'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x73')][_0x7bf5('0x117')](db['User'],{'as':_0x7bf5('0x189'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0x73')]['belongsTo'](db[_0x7bf5('0x1b')],{'as':'Queue','foreignKey':_0x7bf5('0x144'),'onDelete':_0x7bf5('0x10a')});db['CmHopper']['belongsTo'](db[_0x7bf5('0xe4')],{'as':_0x7bf5('0xe4'),'foreignKey':_0x7bf5('0x19d'),'onDelete':'cascade'});db[_0x7bf5('0x73')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x166'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x7bf5('0x117')](db['CmContact'],{'as':'Contact','foreignKey':_0x7bf5('0x159'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x75')]['belongsTo'](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x170'),'foreignKey':_0x7bf5('0x161'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x7bf5('0x1b')],{'as':'Queue','foreignKey':_0x7bf5('0x144'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x75')]['belongsTo'](db[_0x7bf5('0xe4')],{'as':_0x7bf5('0xe4'),'foreignKey':_0x7bf5('0x19d'),'onDelete':'cascade'});db[_0x7bf5('0x7f')]['hasMany'](db['Condition'],{'as':{'plural':_0x7bf5('0x19e'),'singular':_0x7bf5('0x19f')},'foreignKey':_0x7bf5('0x1a0'),'onDelete':_0x7bf5('0x10a'),'hooks':!![]});db[_0x7bf5('0x7f')][_0x7bf5('0x10c')](db[_0x7bf5('0x84')],{'as':{'plural':_0x7bf5('0x1a1'),'singular':_0x7bf5('0x1a2')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x7bf5('0x7f')]['hasMany'](db[_0x7bf5('0x7d')],{'as':'Actions','foreignKey':_0x7bf5('0x1a3'),'onDelete':_0x7bf5('0x10a'),'hooks':!![]});db[_0x7bf5('0x82')][_0x7bf5('0x10c')](db[_0x7bf5('0x82')],{'as':_0x7bf5('0x173'),'foreignKey':_0x7bf5('0x1a4'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0x86')][_0x7bf5('0x10c')](db[_0x7bf5('0x86')],{'as':_0x7bf5('0x1a5'),'foreignKey':_0x7bf5('0x14c'),'onDelete':_0x7bf5('0x10a'),'hooks':!![],'required':![]});db[_0x7bf5('0x86')][_0x7bf5('0x10c')](db[_0x7bf5('0x17')],{'as':'Extensions','foreignKey':_0x7bf5('0x14c'),'onDelete':_0x7bf5('0x16e')});db['Interval'][_0x7bf5('0x10c')](db[_0x7bf5('0x40')],{'as':_0x7bf5('0x1a6'),'foreignKey':_0x7bf5('0x14c')});db[_0x7bf5('0x86')][_0x7bf5('0x10c')](db[_0x7bf5('0x65')],{'as':_0x7bf5('0x1a7'),'foreignKey':_0x7bf5('0x14c')});db['Interval'][_0x7bf5('0x10c')](db['FaxApplication'],{'as':_0x7bf5('0x1a8'),'foreignKey':_0x7bf5('0x14c')});db[_0x7bf5('0x86')][_0x7bf5('0x10c')](db['SmsApplication'],{'as':_0x7bf5('0x1a9'),'foreignKey':_0x7bf5('0x14c')});db[_0x7bf5('0x8b')][_0x7bf5('0x117')](db[_0x7bf5('0x15a')],{});db[_0x7bf5('0x8b')]['belongsTo'](db[_0x7bf5('0x1aa')],{'foreignKey':_0x7bf5('0x1ab')});db[_0x7bf5('0x8b')][_0x7bf5('0x117')](db[_0x7bf5('0x9d')],{'foreignKey':_0x7bf5('0x1ac')});db[_0x7bf5('0x8c')]['belongsToMany'](db[_0x7bf5('0x19')],{'as':_0x7bf5('0x1ad'),'through':'moh_has_sounds','onDelete':'restrict'});db['Tag']['belongsToMany'](db[_0x7bf5('0x11d')],{'through':_0x7bf5('0x19a')});db[_0x7bf5('0x8e')][_0x7bf5('0x11c')](db[_0x7bf5('0x67')],{'through':_0x7bf5('0x18e')});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x7bf5('0x8e')][_0x7bf5('0x11c')](db[_0x7bf5('0x55')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x7bf5('0x11c')](db[_0x7bf5('0x4b')],{'through':'fax_interaction_has_tags'});db[_0x7bf5('0x8e')]['belongsToMany'](db[_0x7bf5('0x5d')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x7bf5('0x11c')](db[_0x7bf5('0xfd')],{'through':_0x7bf5('0x1ae')});db[_0x7bf5('0x92')][_0x7bf5('0x117')](db[_0x7bf5('0x90')],{'as':_0x7bf5('0x1af'),'foreignKey':_0x7bf5('0x1b0')});db['CmHopperAdditionalPhone'][_0x7bf5('0x117')](db[_0x7bf5('0x73')],{'as':_0x7bf5('0x1b1'),'foreignKey':'CmHopperId'});db['Trigger'][_0x7bf5('0x10c')](db[_0x7bf5('0x84')],{'as':{'plural':'AllConditions','singular':_0x7bf5('0x1b2')},'foreignKey':'TriggerAllId','onDelete':_0x7bf5('0x10a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x7bf5('0x84')],{'as':{'plural':_0x7bf5('0x1b3'),'singular':'AnyCondition'},'foreignKey':_0x7bf5('0x1b4'),'onDelete':_0x7bf5('0x10a'),'hooks':!![]});db['Trigger'][_0x7bf5('0x10c')](db[_0x7bf5('0x7d')],{'as':'Actions','foreignKey':_0x7bf5('0x1b5'),'onDelete':_0x7bf5('0x10a'),'hooks':!![]});db[_0x7bf5('0x9d')][_0x7bf5('0x10c')](db['AnalyticFieldReport'],{'as':_0x7bf5('0x1b6'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1ac'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x7bf5('0xa3')],{'as':_0x7bf5('0x1b6'),'onDelete':'cascade','foreignKey':_0x7bf5('0x1ab')});db['AnalyticMetric']['hasMany'](db[_0x7bf5('0xa3')],{'as':_0x7bf5('0x1b6'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1b7')});db[_0x7bf5('0xa3')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x7bf5('0xa5')]['hasMany'](db[_0x7bf5('0x1b8')],{'as':_0x7bf5('0x1b9'),'onDelete':_0x7bf5('0x10a'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x7bf5('0x10c')](db[_0x7bf5('0xa8')],{'as':'Subjects','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1ba')});db['SalesforceConfiguration']['hasMany'](db[_0x7bf5('0xa8')],{'as':'Descriptions','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0x1b8')][_0x7bf5('0x10c')](db[_0x7bf5('0xa8')],{'as':'Fields','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0x1b8')][_0x7bf5('0x117')](db[_0x7bf5('0xa5')],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xa8')][_0x7bf5('0x10c')](db[_0x7bf5('0xa8')],{'as':_0x7bf5('0x1be'),'foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0xa8')][_0x7bf5('0x10c')](db[_0x7bf5('0xa8')],{'as':'Description','foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0xa8')][_0x7bf5('0x10c')](db[_0x7bf5('0xa8')],{'as':'Field','foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0xa8')]['belongsTo'](db['Variable'],{'as':_0x7bf5('0x99'),'foreignKey':'VariableId'});db[_0x7bf5('0xa9')]['hasMany'](db[_0x7bf5('0xaa')],{'as':'Configurations','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xaa')][_0x7bf5('0x10c')](db[_0x7bf5('0xac')],{'as':_0x7bf5('0x1bf'),'onDelete':_0x7bf5('0x10a'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0x7bf5('0x1c0'),'onDelete':'cascade','foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0xaa')][_0x7bf5('0x10c')](db['SugarcrmField'],{'as':_0x7bf5('0x1b6'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x7bf5('0xaa')][_0x7bf5('0x117')](db['SugarcrmAccount'],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xac')][_0x7bf5('0x10c')](db[_0x7bf5('0xac')],{'as':_0x7bf5('0x1be'),'foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0xac')][_0x7bf5('0x10c')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0xac')][_0x7bf5('0x10c')](db[_0x7bf5('0xac')],{'as':_0x7bf5('0x1c1'),'foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0xac')][_0x7bf5('0x117')](db[_0x7bf5('0x99')],{'as':_0x7bf5('0x99'),'foreignKey':_0x7bf5('0x1c2')});db[_0x7bf5('0xae')][_0x7bf5('0x10c')](db[_0x7bf5('0xb0')],{'as':'Configurations','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xb0')]['hasMany'](db[_0x7bf5('0x1c3')],{'as':_0x7bf5('0x1bf'),'onDelete':'cascade','foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0xb0')][_0x7bf5('0x10c')](db['DeskField'],{'as':_0x7bf5('0x1c0'),'onDelete':_0x7bf5('0x10a'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db[_0x7bf5('0x1c3')],{'as':_0x7bf5('0x1b6'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0xb0')][_0x7bf5('0x117')](db['DeskAccount'],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xb0')]['belongsToMany'](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x1c4')});db['DeskField'][_0x7bf5('0x10c')](db[_0x7bf5('0x1c3')],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField'][_0x7bf5('0x10c')](db['DeskField'],{'as':_0x7bf5('0x1c5'),'foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0x1c3')][_0x7bf5('0x10c')](db[_0x7bf5('0x1c3')],{'as':_0x7bf5('0x1c1'),'foreignKey':'FieldId'});db[_0x7bf5('0x1c3')][_0x7bf5('0x117')](db[_0x7bf5('0x99')],{'as':_0x7bf5('0x99'),'foreignKey':'VariableId'});db[_0x7bf5('0xb2')][_0x7bf5('0x10c')](db[_0x7bf5('0x1c6')],{'as':_0x7bf5('0x1b9'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0x1c6')]['hasMany'](db['ZohoField'],{'as':_0x7bf5('0x1bf'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x7bf5('0x1c6')][_0x7bf5('0x10c')](db[_0x7bf5('0x1c7')],{'as':_0x7bf5('0x1c0'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0x1c6')][_0x7bf5('0x10c')](db[_0x7bf5('0x1c7')],{'as':_0x7bf5('0x1b6'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x7bf5('0x1c6')]['belongsTo'](db[_0x7bf5('0xb2')],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0x1c7')][_0x7bf5('0x10c')](db[_0x7bf5('0x1c7')],{'as':_0x7bf5('0x1be'),'foreignKey':'SubjectId'});db[_0x7bf5('0x1c7')][_0x7bf5('0x10c')](db[_0x7bf5('0x1c7')],{'as':_0x7bf5('0x1c5'),'foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0x1c7')][_0x7bf5('0x10c')](db['ZohoField'],{'as':_0x7bf5('0x1c1'),'foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0x1c7')]['belongsTo'](db[_0x7bf5('0x99')],{'as':_0x7bf5('0x99'),'foreignKey':_0x7bf5('0x1c2')});db[_0x7bf5('0x1c8')][_0x7bf5('0x10c')](db[_0x7bf5('0xb5')],{'as':_0x7bf5('0x1b9'),'onDelete':_0x7bf5('0x10a'),'foreignKey':'AccountId'});db[_0x7bf5('0xb5')][_0x7bf5('0x10c')](db[_0x7bf5('0xb7')],{'as':_0x7bf5('0x1bf'),'foreignKey':_0x7bf5('0x1ba')});db['ZendeskConfiguration'][_0x7bf5('0x10c')](db[_0x7bf5('0xb7')],{'as':_0x7bf5('0x1c0'),'foreignKey':'DescriptionId'});db[_0x7bf5('0xb5')][_0x7bf5('0x10c')](db[_0x7bf5('0xb7')],{'as':'Fields','foreignKey':_0x7bf5('0x1bc')});db['ZendeskConfiguration'][_0x7bf5('0x117')](db[_0x7bf5('0x1c8')],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xb5')]['belongsToMany'](db['Tag'],{'through':_0x7bf5('0x1c9')});db[_0x7bf5('0xb7')][_0x7bf5('0x10c')](db[_0x7bf5('0xb7')],{'as':'Subject','foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0xb7')]['hasMany'](db[_0x7bf5('0xb7')],{'as':'Description','foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0xb7')]['hasMany'](db[_0x7bf5('0xb7')],{'as':_0x7bf5('0x1c1'),'foreignKey':'FieldId'});db['ZendeskField'][_0x7bf5('0x117')](db[_0x7bf5('0x99')],{'as':_0x7bf5('0x99'),'foreignKey':_0x7bf5('0x1c2')});db[_0x7bf5('0xb9')][_0x7bf5('0x10c')](db[_0x7bf5('0x1ca')],{'as':_0x7bf5('0x1b9'),'onDelete':_0x7bf5('0x10a'),'foreignKey':'AccountId'});db[_0x7bf5('0x1ca')][_0x7bf5('0x10c')](db[_0x7bf5('0xbc')],{'as':_0x7bf5('0x1bf'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0x1ca')][_0x7bf5('0x10c')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bb')});db['FreshdeskConfiguration'][_0x7bf5('0x10c')](db['FreshdeskField'],{'as':_0x7bf5('0x1b6'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0x1ca')][_0x7bf5('0x117')](db[_0x7bf5('0xb9')],{'as':'Account','foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0x1ca')][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x1cb')});db[_0x7bf5('0xbc')][_0x7bf5('0x10c')](db[_0x7bf5('0xbc')],{'as':'Subject','foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0xbc')][_0x7bf5('0x10c')](db[_0x7bf5('0xbc')],{'as':_0x7bf5('0x1c5'),'foreignKey':_0x7bf5('0x1bb')});db['FreshdeskField'][_0x7bf5('0x10c')](db[_0x7bf5('0xbc')],{'as':_0x7bf5('0x1c1'),'foreignKey':'FieldId'});db[_0x7bf5('0xbc')]['belongsTo'](db[_0x7bf5('0x99')],{'as':_0x7bf5('0x99'),'foreignKey':_0x7bf5('0x1c2')});db['VtigerAccount']['hasMany'](db[_0x7bf5('0xbe')],{'as':_0x7bf5('0x1b9'),'onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xbe')][_0x7bf5('0x10c')](db[_0x7bf5('0x1cc')],{'as':_0x7bf5('0x1bf'),'foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0xbe')][_0x7bf5('0x10c')](db[_0x7bf5('0x1cc')],{'as':_0x7bf5('0x1c0'),'foreignKey':_0x7bf5('0x1bb')});db['VtigerConfiguration'][_0x7bf5('0x10c')](db['VtigerField'],{'as':_0x7bf5('0x1b6'),'foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0xbe')][_0x7bf5('0x117')](db[_0x7bf5('0x1cd')],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1bd')});db['VtigerField']['hasMany'](db[_0x7bf5('0x1cc')],{'as':_0x7bf5('0x1be'),'foreignKey':'SubjectId'});db[_0x7bf5('0x1cc')]['hasMany'](db[_0x7bf5('0x1cc')],{'as':_0x7bf5('0x1c5'),'foreignKey':'DescriptionId'});db['VtigerField']['hasMany'](db[_0x7bf5('0x1cc')],{'as':'Field','foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0x1cc')][_0x7bf5('0x117')](db[_0x7bf5('0x99')],{'as':_0x7bf5('0x99'),'foreignKey':_0x7bf5('0x1c2')});db[_0x7bf5('0x1ce')][_0x7bf5('0x10c')](db[_0x7bf5('0x1cf')],{'as':'Configurations','onDelete':_0x7bf5('0x10a'),'foreignKey':'AccountId'});db[_0x7bf5('0x1cf')]['hasMany'](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0x1cf')]['hasMany'](db[_0x7bf5('0x1d0')],{'as':_0x7bf5('0x1c0'),'foreignKey':_0x7bf5('0x1bb')});db['ServicenowConfiguration'][_0x7bf5('0x10c')](db[_0x7bf5('0x1d0')],{'as':_0x7bf5('0x1b6'),'foreignKey':_0x7bf5('0x1bc')});db['ServicenowConfiguration'][_0x7bf5('0x117')](db[_0x7bf5('0x1ce')],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1bd')});db['ServicenowField'][_0x7bf5('0x10c')](db[_0x7bf5('0x1d0')],{'as':_0x7bf5('0x1be'),'foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0x1d0')][_0x7bf5('0x10c')](db[_0x7bf5('0x1d0')],{'as':_0x7bf5('0x1c5'),'foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0x1d0')]['hasMany'](db['ServicenowField'],{'as':_0x7bf5('0x1c1'),'foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0x1d0')][_0x7bf5('0x117')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x7bf5('0xc3')][_0x7bf5('0x10c')](db[_0x7bf5('0x1d1')],{'as':_0x7bf5('0x1b9'),'onDelete':'cascade','foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0x1d1')][_0x7bf5('0x10c')](db[_0x7bf5('0xc6')],{'as':'Subjects','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1ba')});db['Dynamics365Configuration'][_0x7bf5('0x10c')](db[_0x7bf5('0xc6')],{'as':'Descriptions','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0x1d1')][_0x7bf5('0x10c')](db[_0x7bf5('0xc6')],{'as':_0x7bf5('0x1b6'),'onDelete':_0x7bf5('0x10a'),'foreignKey':'FieldId'});db[_0x7bf5('0x1d1')][_0x7bf5('0x117')](db[_0x7bf5('0xc3')],{'as':_0x7bf5('0x177'),'foreignKey':'AccountId'});db[_0x7bf5('0xc6')][_0x7bf5('0x10c')](db[_0x7bf5('0xc6')],{'as':'Subject','foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0xc6')][_0x7bf5('0x10c')](db[_0x7bf5('0xc6')],{'as':_0x7bf5('0x1c5'),'foreignKey':_0x7bf5('0x1bb')});db[_0x7bf5('0xc6')][_0x7bf5('0x10c')](db[_0x7bf5('0xc6')],{'as':_0x7bf5('0x1c1'),'foreignKey':_0x7bf5('0x1bc')});db[_0x7bf5('0xc6')]['belongsTo'](db['Variable'],{'as':_0x7bf5('0x99'),'foreignKey':_0x7bf5('0x1c2')});db[_0x7bf5('0x1d2')][_0x7bf5('0x10c')](db[_0x7bf5('0xc7')],{'as':'Configurations','onDelete':_0x7bf5('0x10a'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xc7')][_0x7bf5('0x10c')](db[_0x7bf5('0xc9')],{'as':_0x7bf5('0x1bf'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x7bf5('0x10c')](db['FreshsalesField'],{'as':_0x7bf5('0x1c0'),'foreignKey':_0x7bf5('0x1bb')});db['FreshsalesConfiguration'][_0x7bf5('0x10c')](db[_0x7bf5('0xc9')],{'as':_0x7bf5('0x1b6'),'foreignKey':_0x7bf5('0x1bc')});db['FreshsalesConfiguration'][_0x7bf5('0x117')](db['FreshsalesAccount'],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1bd')});db[_0x7bf5('0xc9')]['hasMany'](db['FreshsalesField'],{'as':_0x7bf5('0x1be'),'foreignKey':_0x7bf5('0x1ba')});db[_0x7bf5('0xc9')]['hasMany'](db[_0x7bf5('0xc9')],{'as':'Description','foreignKey':_0x7bf5('0x1bb')});db['FreshsalesField'][_0x7bf5('0x10c')](db[_0x7bf5('0xc9')],{'as':_0x7bf5('0x1c1'),'foreignKey':_0x7bf5('0x1bc')});db['FreshsalesField'][_0x7bf5('0x117')](db[_0x7bf5('0x99')],{'as':'Variable','foreignKey':_0x7bf5('0x1c2')});db['ChatQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0x134')],{});db[_0x7bf5('0xcd')][_0x7bf5('0x117')](db[_0x7bf5('0xf1')],{'as':_0x7bf5('0x170'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0xcd')][_0x7bf5('0x117')](db[_0x7bf5('0x67')],{});db['ChatQueueReport']['belongsTo'](db[_0x7bf5('0x69')],{});db['ChatQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{});db[_0x7bf5('0xcd')]['belongsTo'](db[_0x7bf5('0x6d')],{});db[_0x7bf5('0x192')]['belongsTo'](db['User'],{'onDelete':_0x7bf5('0x10a'),'foreignKey':'FromId'});db[_0x7bf5('0x192')][_0x7bf5('0x117')](db['User'],{'onDelete':'cascade','foreignKey':_0x7bf5('0x1d3')});db['JscriptySessionReport'][_0x7bf5('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':_0x7bf5('0x1d4'),'onDelete':_0x7bf5('0x10a')});db['JscriptySessionReport'][_0x7bf5('0x10c')](db[_0x7bf5('0xcf')],{'foreignKey':_0x7bf5('0x1d4'),'onDelete':_0x7bf5('0x10a')});db['SmsQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0x51')],{});db[_0x7bf5('0xd3')][_0x7bf5('0x117')](db[_0x7bf5('0xf1')],{'as':'List','foreignKey':_0x7bf5('0x161')});db[_0x7bf5('0xd3')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':'Contact','foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0xd3')][_0x7bf5('0x117')](db[_0x7bf5('0x55')],{});db['SmsQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0x56')],{});db[_0x7bf5('0xd3')][_0x7bf5('0x117')](db['User'],{});db['SmsQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0x58')],{});db[_0x7bf5('0xd8')][_0x7bf5('0x10c')](db[_0x7bf5('0x148')],{'foreignKey':_0x7bf5('0x1d5')});db[_0x7bf5('0xd8')][_0x7bf5('0x10c')](db[_0x7bf5('0xd1')],{'foreignKey':'ProjectId'});db[_0x7bf5('0xd8')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x7bf5('0x1d5')});db['SquareProject'][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x179'),'through':'user_has_square_projects'});db['Team'][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':'Agents','through':_0x7bf5('0x122')});db['Team'][_0x7bf5('0x11c')](db[_0x7bf5('0x1b')],{'through':_0x7bf5('0x107'),'as':_0x7bf5('0x127')});db[_0x7bf5('0xe1')]['belongsToMany'](db[_0x7bf5('0x3a')],{'through':_0x7bf5('0x164'),'as':_0x7bf5('0x1d6')});db['Team']['belongsToMany'](db[_0x7bf5('0x6d')],{'through':_0x7bf5('0x191'),'as':_0x7bf5('0x129')});db['Team']['belongsToMany'](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x7bf5('0x12c')});db['Team'][_0x7bf5('0x11c')](db[_0x7bf5('0x58')],{'through':_0x7bf5('0x17f'),'as':_0x7bf5('0x12e')});db[_0x7bf5('0xe1')]['belongsToMany'](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x7bf5('0x12f')});db[_0x7bf5('0xe1')][_0x7bf5('0x11c')](db[_0x7bf5('0x104')],{'through':_0x7bf5('0x1d7'),'as':_0x7bf5('0x130')});db[_0x7bf5('0xe4')][_0x7bf5('0x10c')](db[_0x7bf5('0x73')],{'as':_0x7bf5('0x197'),'foreignKey':_0x7bf5('0x19d')});db['Campaign'][_0x7bf5('0x10c')](db[_0x7bf5('0x110')],{'as':_0x7bf5('0x145'),'foreignKey':_0x7bf5('0x19d')});db['Campaign'][_0x7bf5('0x10c')](db[_0x7bf5('0x78')],{'as':_0x7bf5('0x146'),'foreignKey':_0x7bf5('0x19d')});db[_0x7bf5('0xe4')][_0x7bf5('0x10c')](db['CmHopperBlack'],{'as':_0x7bf5('0x147'),'foreignKey':_0x7bf5('0x19d')});db[_0x7bf5('0xe4')][_0x7bf5('0x117')](db['Trunk'],{'as':_0x7bf5('0x2b'),'foreignKey':_0x7bf5('0x14a')});db[_0x7bf5('0xe4')][_0x7bf5('0x117')](db[_0x7bf5('0x2b')],{'as':_0x7bf5('0x14b'),'foreignKey':_0x7bf5('0x1d8')});db[_0x7bf5('0xe4')][_0x7bf5('0x117')](db[_0x7bf5('0x86')],{'as':_0x7bf5('0x86'),'foreignKey':'IntervalId'});db[_0x7bf5('0xe4')][_0x7bf5('0x117')](db[_0x7bf5('0xdc')],{'as':_0x7bf5('0xdc'),'foreignKey':'SquareProjectId'});db[_0x7bf5('0xe4')]['belongsToMany'](db['CmList'],{'as':_0x7bf5('0x120'),'through':_0x7bf5('0x1d9')});db['Campaign'][_0x7bf5('0x11c')](db[_0x7bf5('0xf1')],{'as':'BlackLists','through':_0x7bf5('0x1da')});db['Attachment'][_0x7bf5('0x117')](db[_0x7bf5('0x6b')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x7bf5('0xea')][_0x7bf5('0x117')](db[_0x7bf5('0x3e')],{});db[_0x7bf5('0xea')][_0x7bf5('0x117')](db[_0x7bf5('0x3c')],{});db[_0x7bf5('0xea')][_0x7bf5('0x117')](db[_0x7bf5('0x15a')],{'foreignKey':_0x7bf5('0x1db'),'as':_0x7bf5('0x1dc')});db[_0x7bf5('0xea')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x7bf5('0xea')]['belongsTo'](db[_0x7bf5('0x10d')],{'foreignKey':_0x7bf5('0x1dd'),'as':_0x7bf5('0x1de')});db['MailTransferReport']['belongsTo'](db['MailQueue'],{'foreignKey':_0x7bf5('0x1df'),'as':'ToQueue'});db[_0x7bf5('0xea')][_0x7bf5('0x117')](db[_0x7bf5('0x15a')],{'foreignKey':_0x7bf5('0x1e0'),'as':_0x7bf5('0x1e1')});db[_0x7bf5('0xec')][_0x7bf5('0x117')](db['ChatMessage'],{});db[_0x7bf5('0xec')]['belongsTo'](db[_0x7bf5('0x67')],{});db[_0x7bf5('0xec')][_0x7bf5('0x117')](db[_0x7bf5('0x134')],{'foreignKey':_0x7bf5('0x1e2'),'as':_0x7bf5('0x1dc')});db[_0x7bf5('0xec')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'foreignKey':_0x7bf5('0x1e3'),'as':'FromAgent'});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x7bf5('0x1dd'),'as':_0x7bf5('0x1de')});db[_0x7bf5('0xec')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x7bf5('0x1e4'),'as':_0x7bf5('0x1e5')});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x7bf5('0x1e6'),'as':_0x7bf5('0x1e1')});db['FaxTransferReport'][_0x7bf5('0x117')](db[_0x7bf5('0x4c')],{});db['FaxTransferReport']['belongsTo'](db[_0x7bf5('0x4b')],{});db[_0x7bf5('0xed')]['belongsTo'](db[_0x7bf5('0x47')],{'foreignKey':_0x7bf5('0x1e7'),'as':_0x7bf5('0x1dc')});db[_0x7bf5('0xed')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'foreignKey':_0x7bf5('0x1e3'),'as':_0x7bf5('0x1e8')});db['FaxTransferReport'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'foreignKey':_0x7bf5('0x1dd'),'as':'ToAgent'});db[_0x7bf5('0xed')][_0x7bf5('0x117')](db[_0x7bf5('0x12b')],{'foreignKey':_0x7bf5('0x1e9'),'as':_0x7bf5('0x1e5')});db[_0x7bf5('0xed')][_0x7bf5('0x117')](db[_0x7bf5('0x47')],{'foreignKey':_0x7bf5('0x1ea'),'as':_0x7bf5('0x1e1')});db[_0x7bf5('0x1eb')][_0x7bf5('0x117')](db[_0x7bf5('0x5f')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x7bf5('0x5d')],{});db['OpenchannelTransferReport'][_0x7bf5('0x117')](db[_0x7bf5('0x59')],{'foreignKey':_0x7bf5('0x1ec'),'as':'FromAccount'});db[_0x7bf5('0x1eb')][_0x7bf5('0x117')](db['User'],{'foreignKey':'FromUserId','as':_0x7bf5('0x1e8')});db['OpenchannelTransferReport'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'foreignKey':_0x7bf5('0x1dd'),'as':_0x7bf5('0x1de')});db[_0x7bf5('0x1eb')][_0x7bf5('0x117')](db[_0x7bf5('0x61')],{'foreignKey':_0x7bf5('0x1ed'),'as':_0x7bf5('0x1e5')});db['OpenchannelTransferReport'][_0x7bf5('0x117')](db[_0x7bf5('0x59')],{'foreignKey':_0x7bf5('0x1ee'),'as':_0x7bf5('0x1e1')});db[_0x7bf5('0xef')][_0x7bf5('0x117')](db[_0x7bf5('0x56')],{});db[_0x7bf5('0xef')][_0x7bf5('0x117')](db[_0x7bf5('0x55')],{});db[_0x7bf5('0xef')]['belongsTo'](db[_0x7bf5('0x51')],{'foreignKey':_0x7bf5('0x1ef'),'as':'FromAccount'});db[_0x7bf5('0xef')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'foreignKey':_0x7bf5('0x1e3'),'as':'FromAgent'});db[_0x7bf5('0xef')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'foreignKey':_0x7bf5('0x1dd'),'as':_0x7bf5('0x1de')});db[_0x7bf5('0xef')][_0x7bf5('0x117')](db[_0x7bf5('0x58')],{'foreignKey':_0x7bf5('0x1f0'),'as':_0x7bf5('0x1e5')});db[_0x7bf5('0xef')][_0x7bf5('0x117')](db[_0x7bf5('0x51')],{'foreignKey':_0x7bf5('0x1f1'),'as':'ToAccount'});db['CmList'][_0x7bf5('0x10c')](db[_0x7bf5('0x82')],{'as':_0x7bf5('0x173'),'foreignKey':_0x7bf5('0x161')});db[_0x7bf5('0xf1')][_0x7bf5('0x10c')](db['CmCustomField'],{'as':_0x7bf5('0x1f2'),'foreignKey':'ListId'});db[_0x7bf5('0xf1')][_0x7bf5('0x10c')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x11e'),'onDelete':_0x7bf5('0x10a'),'foreignKey':'ListId'});db['CmList'][_0x7bf5('0x10c')](db[_0x7bf5('0x110')],{'as':_0x7bf5('0x145'),'foreignKey':_0x7bf5('0x161')});db['CmList']['hasMany'](db[_0x7bf5('0x78')],{'as':_0x7bf5('0x111'),'foreignKey':_0x7bf5('0x161')});db[_0x7bf5('0xf1')]['hasMany'](db['ReportAgentPreview'],{'as':_0x7bf5('0x79'),'foreignKey':'ListId'});db['CmList']['belongsToMany'](db[_0x7bf5('0x1b')],{'as':'Queues','through':_0x7bf5('0x1f3')});db['CmList'][_0x7bf5('0x11c')](db['User'],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x121')});db[_0x7bf5('0xf3')]['hasMany'](db[_0x7bf5('0x17')],{'as':_0x7bf5('0x10f'),'onDelete':_0x7bf5('0x10a')});db['VoicePrefix'][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x133')});db[_0x7bf5('0xf4')]['hasMany'](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x179'),'foreignKey':_0x7bf5('0x118')});db['UserProfile']['hasMany'](db[_0x7bf5('0xf6')],{'as':_0x7bf5('0x1f4'),'foreignKey':_0x7bf5('0x118'),'onDelete':_0x7bf5('0x10a')});db[_0x7bf5('0xf6')][_0x7bf5('0x10c')](db[_0x7bf5('0xf7')],{'as':_0x7bf5('0x1f5'),'foreignKey':'sectionId','onDelete':_0x7bf5('0x10a')});db['WhatsappAccount'][_0x7bf5('0x10c')](db[_0x7bf5('0x82')],{'as':_0x7bf5('0x173'),'foreignKey':_0x7bf5('0x1f6')});db['WhatsappAccount'][_0x7bf5('0x10c')](db[_0x7bf5('0x81')],{'as':_0x7bf5('0x15f'),'foreignKey':'WhatsappAccountId'});db[_0x7bf5('0xfa')][_0x7bf5('0x10c')](db['WhatsappMessage'],{'as':_0x7bf5('0x152'),'foreignKey':_0x7bf5('0x1f6')});db[_0x7bf5('0xfa')][_0x7bf5('0x10c')](db[_0x7bf5('0xfd')],{'as':'Interactions'});db[_0x7bf5('0xfa')][_0x7bf5('0x10c')](db['WhatsappApplication'],{'as':_0x7bf5('0x142')});db[_0x7bf5('0xfa')][_0x7bf5('0x117')](db['CmList'],{'as':_0x7bf5('0x170'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x7bf5('0x117')](db[_0x7bf5('0x87')],{'as':_0x7bf5('0x14d'),'foreignKey':_0x7bf5('0x163')});db[_0x7bf5('0xfa')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x1f7')});db[_0x7bf5('0xfc')]['belongsTo'](db[_0x7bf5('0x10d')],{'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0xfc')][_0x7bf5('0x117')](db[_0x7bf5('0x104')],{'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0xfc')][_0x7bf5('0x117')](db['WhatsappAccount'],{'onDelete':_0x7bf5('0x16e')});db[_0x7bf5('0xfc')]['belongsTo'](db[_0x7bf5('0x86')],{'onDelete':_0x7bf5('0x16e'),'foreignKey':_0x7bf5('0x14c')});db['WhatsappApplication'][_0x7bf5('0x117')](db['Tag'],{'onDelete':_0x7bf5('0x16e'),'foreignKey':_0x7bf5('0x16f')});db[_0x7bf5('0xfd')]['hasMany'](db[_0x7bf5('0xff')],{'as':_0x7bf5('0x152'),'onDelete':'cascade','foreignKey':_0x7bf5('0x1f8')});db[_0x7bf5('0xfd')]['belongsTo'](db[_0x7bf5('0xfa')],{'as':_0x7bf5('0x177'),'foreignKey':'WhatsappAccountId'});db[_0x7bf5('0xfd')]['belongsTo'](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db[_0x7bf5('0xfd')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x166'),'foreignKey':_0x7bf5('0x10b')});db[_0x7bf5('0xfd')][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':_0x7bf5('0x1ae'),'as':_0x7bf5('0x168')});db[_0x7bf5('0xfd')][_0x7bf5('0x11c')](db[_0x7bf5('0x8e')],{'through':'whatsapp_interaction_has_tags','as':_0x7bf5('0x169')});db[_0x7bf5('0xfd')][_0x7bf5('0x11c')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x179'),'through':'user_has_whatsapp_interactions','foreignKey':_0x7bf5('0x1f8')});db[_0x7bf5('0xff')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'as':_0x7bf5('0x10d')});db[_0x7bf5('0xff')][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'onDelete':_0x7bf5('0x10a'),'as':_0x7bf5('0x165')});db[_0x7bf5('0xff')][_0x7bf5('0x117')](db['WhatsappInteraction'],{'onDelete':_0x7bf5('0x10a'),'as':_0x7bf5('0x16b'),'foreignKey':_0x7bf5('0x1f8')});db['WhatsappMessage'][_0x7bf5('0x117')](db['WhatsappAccount'],{'as':_0x7bf5('0x177'),'foreignKey':_0x7bf5('0x1f6')});db[_0x7bf5('0x100')]['belongsTo'](db[_0x7bf5('0xfa')],{});db['WhatsappQueueReport'][_0x7bf5('0x117')](db['CmList'],{'as':'List','foreignKey':_0x7bf5('0x161')});db['WhatsappQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0x11d')],{'as':_0x7bf5('0x165'),'foreignKey':_0x7bf5('0x159')});db['WhatsappQueueReport'][_0x7bf5('0x117')](db[_0x7bf5('0xfd')],{});db[_0x7bf5('0x100')][_0x7bf5('0x117')](db[_0x7bf5('0x104')],{});db[_0x7bf5('0x100')]['belongsTo'](db[_0x7bf5('0xff')],{});db[_0x7bf5('0x100')][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{});db[_0x7bf5('0x102')]['belongsTo'](db[_0x7bf5('0xff')],{});db[_0x7bf5('0x102')][_0x7bf5('0x117')](db[_0x7bf5('0xfd')],{});db[_0x7bf5('0x102')][_0x7bf5('0x117')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x7bf5('0x102')][_0x7bf5('0x117')](db[_0x7bf5('0xfa')],{'foreignKey':'ToWhatsappAccountId','as':_0x7bf5('0x1e1')});db['WhatsappTransferReport'][_0x7bf5('0x117')](db[_0x7bf5('0x104')],{'foreignKey':_0x7bf5('0x1f9'),'as':_0x7bf5('0x1e5')});db['WhatsappTransferReport'][_0x7bf5('0x117')](db[_0x7bf5('0x10d')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x7bf5('0x102')]['belongsTo'](db['User'],{'foreignKey':_0x7bf5('0x1dd'),'as':'ToAgent'});db[_0x7bf5('0x104')][_0x7bf5('0x11c')](db['User'],{'as':_0x7bf5('0x14e'),'through':_0x7bf5('0x131'),'foreignKey':_0x7bf5('0x1fa')});db[_0x7bf5('0x104')][_0x7bf5('0x11c')](db[_0x7bf5('0xe1')],{'through':_0x7bf5('0x1d7'),'as':_0x7bf5('0x14f')});module[_0x7bf5('0x1fb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 259c3bf..28cabf4 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c2c=['registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','includes','path','express','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','agent_id','agent_name','test','url','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./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/analytics/field_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','key','pass','accountSid','localstationid','dsn'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x6c2c,0x158));var _0xc6c2=function(_0x99f10b,_0x32b68e){_0x99f10b=_0x99f10b-0x0;var _0x4e440c=_0x6c2c[_0x99f10b];return _0x4e440c;};'use strict';var _=require('lodash');var path=require(_0xc6c2('0x0'));var express=require(_0xc6c2('0x1'));var ewinston=require(_0xc6c2('0x2'));var util=require(_0xc6c2('0x3'));var errors=require(_0xc6c2('0x4'));var config=require('./config/environment');var logger=require(_0xc6c2('0x5'))(_0xc6c2('0x6'));var authLogger=require(_0xc6c2('0x5'))(_0xc6c2('0x7'));exports[_0xc6c2('0x8')]=function(_0x30ad0b){_0x30ad0b[_0xc6c2('0x9')](ewinston[_0xc6c2('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2d63d5,_0x27eaa4){var _0x490e12=_0xc6c2('0xb');if(!_[_0xc6c2('0xc')](_0x2d63d5[_0xc6c2('0xd')])){_0x490e12+=_0xc6c2('0xe');var _0x13ed3a=_0x2d63d5[_0xc6c2('0xd')];maskSensitiveData(_0x13ed3a);}return util[_0xc6c2('0xf')](_0x490e12,_0x2d63d5[_0xc6c2('0x10')],_0x2d63d5[_0xc6c2('0x11')][_0xc6c2('0x12')]?_0x2d63d5[_0xc6c2('0x11')]['x-forwarded-for']:_0x2d63d5[_0xc6c2('0x13')][_0xc6c2('0x14')]||_0x2d63d5['ip'],_0x2d63d5['url'],_0x27eaa4[_0xc6c2('0x15')],_0x27eaa4['responseTime'],_0x2d63d5['user']?_0x2d63d5[_0xc6c2('0x16')]['id']:null,_0x2d63d5['user']?_0x2d63d5[_0xc6c2('0x16')][_0xc6c2('0x17')]:null,_0x2d63d5[_0xc6c2('0x16')]?_0x2d63d5['user'][_0xc6c2('0x18')]:null,_0x13ed3a?util[_0xc6c2('0x19')](_0x13ed3a,![],null):'');}}));_0x30ad0b[_0xc6c2('0x9')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4a3a2d,_0x2290b7){var _0x1af0e4=_0xc6c2('0x1a');if(_0x4a3a2d[_0xc6c2('0xd')]&&_0x4a3a2d['body'][_0xc6c2('0x1b')]&&_0x4a3a2d['body']['agent_id']){_0x1af0e4=_0xc6c2('0x1c');}return util[_0xc6c2('0xf')](_0x1af0e4,_0x4a3a2d[_0xc6c2('0x10')],_0x4a3a2d[_0xc6c2('0x11')][_0xc6c2('0x12')]?_0x4a3a2d[_0xc6c2('0x11')][_0xc6c2('0x12')]:_0x4a3a2d[_0xc6c2('0x13')]['remoteAddress']||_0x4a3a2d['ip'],_0x4a3a2d['url'],_0x2290b7['statusCode'],_0x2290b7[_0xc6c2('0x1d')],_0x4a3a2d[_0xc6c2('0x16')]?_0x4a3a2d[_0xc6c2('0x16')]['id']:null,_0x4a3a2d[_0xc6c2('0x16')]?_0x4a3a2d['user'][_0xc6c2('0x17')]:null,_0x4a3a2d[_0xc6c2('0x16')]?_0x4a3a2d[_0xc6c2('0x16')][_0xc6c2('0x18')]:null,_0x4a3a2d[_0xc6c2('0xd')]&&_0x4a3a2d[_0xc6c2('0xd')][_0xc6c2('0x1b')]?_0x4a3a2d[_0xc6c2('0xd')][_0xc6c2('0x1b')]:_0xc6c2('0x1e'),_0x4a3a2d['body']&&_0x4a3a2d[_0xc6c2('0xd')]['agent_id']?_0x4a3a2d[_0xc6c2('0xd')][_0xc6c2('0x1f')]:'',_0x4a3a2d[_0xc6c2('0xd')]&&_0x4a3a2d[_0xc6c2('0xd')][_0xc6c2('0x20')]?_0x4a3a2d[_0xc6c2('0xd')][_0xc6c2('0x20')]:'');},'ignoreRoute':function(_0x484e33){var _0xbe1010=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xbe1010[_0xc6c2('0x21')](_0x484e33[_0xc6c2('0x22')]);}}));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x23'),require(_0xc6c2('0x24')));_0x30ad0b[_0xc6c2('0x9')]('/api/voice/chanspy',require(_0xc6c2('0x25')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x26'),require(_0xc6c2('0x27')));_0x30ad0b['use'](_0xc6c2('0x28'),require(_0xc6c2('0x29')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x2a'),require(_0xc6c2('0x2b')));_0x30ad0b[_0xc6c2('0x9')]('/api/voice/queues',require(_0xc6c2('0x2c')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x2d'),require(_0xc6c2('0x2e')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x2f'),require('./api/screenRecording'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x30'),require(_0xc6c2('0x31')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x32'),require(_0xc6c2('0x33')));_0x30ad0b['use'](_0xc6c2('0x34'),require('./api/voiceCallReport'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x35'),require(_0xc6c2('0x36')));_0x30ad0b['use'](_0xc6c2('0x37'),require('./api/voiceAgentReport'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x38'),require(_0xc6c2('0x39')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x3a'),require('./api/memberReport'));_0x30ad0b['use'](_0xc6c2('0x3b'),require(_0xc6c2('0x3c')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x3d'),require('./api/voiceTransferReport'));_0x30ad0b['use']('/api/mail/out_servers',require('./api/mailServerOut'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x3e'),require(_0xc6c2('0x3f')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x40'),require(_0xc6c2('0x41')));_0x30ad0b[_0xc6c2('0x9')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x42'),require(_0xc6c2('0x43')));_0x30ad0b['use'](_0xc6c2('0x44'),require(_0xc6c2('0x45')));_0x30ad0b[_0xc6c2('0x9')]('/api/mail/applications',require(_0xc6c2('0x46')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x47'),require('./api/mailQueueReport'));_0x30ad0b[_0xc6c2('0x9')]('/api/dashboards',require(_0xc6c2('0x48')));_0x30ad0b['use'](_0xc6c2('0x49'),require(_0xc6c2('0x4a')));_0x30ad0b['use'](_0xc6c2('0x4b'),require('./api/faxAccount'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x4c'),require(_0xc6c2('0x4d')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x4e'),require('./api/faxInteraction'));_0x30ad0b['use'](_0xc6c2('0x4f'),require(_0xc6c2('0x50')));_0x30ad0b['use']('/api/fax/queues',require(_0xc6c2('0x51')));_0x30ad0b[_0xc6c2('0x9')]('/api/fax/reports/queue',require(_0xc6c2('0x52')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x53'),require(_0xc6c2('0x54')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x55'),require(_0xc6c2('0x56')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x57'),require('./api/smsInteraction'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x58'),require('./api/smsMessage'));_0x30ad0b['use']('/api/sms/queues',require(_0xc6c2('0x59')));_0x30ad0b[_0xc6c2('0x9')]('/api/openchannel/accounts',require(_0xc6c2('0x5a')));_0x30ad0b[_0xc6c2('0x9')]('/api/openchannel/applications',require(_0xc6c2('0x5b')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x5c'),require('./api/openchannelInteraction'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x5d'),require(_0xc6c2('0x5e')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x5f'),require('./api/openchannelQueue'));_0x30ad0b['use']('/api/chat/websites',require(_0xc6c2('0x60')));_0x30ad0b['use']('/api/openchannel/reports/queue',require(_0xc6c2('0x61')));_0x30ad0b['use'](_0xc6c2('0x62'),require(_0xc6c2('0x63')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x64'),require('./api/chatInteraction'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x65'),require('./api/chatMessage'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x66'),require(_0xc6c2('0x67')));_0x30ad0b['use'](_0xc6c2('0x68'),require(_0xc6c2('0x69')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x6a'),require('./api/chatGroup'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x6b'),require(_0xc6c2('0x6c')));_0x30ad0b['use'](_0xc6c2('0x6d'),require(_0xc6c2('0x6e')));_0x30ad0b['use'](_0xc6c2('0x6f'),require(_0xc6c2('0x70')));_0x30ad0b['use'](_0xc6c2('0x71'),require('./api/cmHopper'));_0x30ad0b[_0xc6c2('0x9')]('/api/cm/hopper_black',require(_0xc6c2('0x72')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x73'),require(_0xc6c2('0x74')));_0x30ad0b['use']('/api/cm/hopper_history',require(_0xc6c2('0x75')));_0x30ad0b['use'](_0xc6c2('0x76'),require(_0xc6c2('0x77')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x78'),require('./api/action'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x79'),require(_0xc6c2('0x7a')));_0x30ad0b['use'](_0xc6c2('0x7b'),require(_0xc6c2('0x7c')));_0x30ad0b['use'](_0xc6c2('0x7d'),require(_0xc6c2('0x7e')));_0x30ad0b[_0xc6c2('0x9')]('/api/conditions',require(_0xc6c2('0x7f')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x80'),require(_0xc6c2('0x81')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x82'),require(_0xc6c2('0x83')));_0x30ad0b[_0xc6c2('0x9')]('/api/cdr',require(_0xc6c2('0x84')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x85'),require(_0xc6c2('0x86')));_0x30ad0b['use'](_0xc6c2('0x87'),require(_0xc6c2('0x88')));_0x30ad0b[_0xc6c2('0x9')]('/api/sounds',require('./api/sound'));_0x30ad0b['use'](_0xc6c2('0x89'),require('./api/tag'));_0x30ad0b['use'](_0xc6c2('0x8a'),require(_0xc6c2('0x8b')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x8c'),require('./api/cmContactHasItem'));_0x30ad0b[_0xc6c2('0x9')]('/api/cm_hopper_additional_phones',require(_0xc6c2('0x8d')));_0x30ad0b['use'](_0xc6c2('0x8e'),require(_0xc6c2('0x8f')));_0x30ad0b['use'](_0xc6c2('0x90'),require(_0xc6c2('0x91')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x92'),require(_0xc6c2('0x93')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x94'),require(_0xc6c2('0x95')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/reports',require(_0xc6c2('0x96')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x97'),require(_0xc6c2('0x98')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x99'),require(_0xc6c2('0x9a')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x9b'),require(_0xc6c2('0x9c')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x9d'),require(_0xc6c2('0x9e')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x9f'),require('./api/analyticFieldReport'));_0x30ad0b[_0xc6c2('0x9')]('/api/analytics/tree_reports',require(_0xc6c2('0xa0')));_0x30ad0b['use']('/api/integrations/salesforce/accounts',require(_0xc6c2('0xa1')));_0x30ad0b['use'](_0xc6c2('0xa2'),require(_0xc6c2('0xa3')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xa4'),require(_0xc6c2('0xa5')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xa6'),require(_0xc6c2('0xa7')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xa8'),require(_0xc6c2('0xa9')));_0x30ad0b['use'](_0xc6c2('0xaa'),require(_0xc6c2('0xab')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xac'),require('./api/intDeskAccount'));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/desk/configurations',require(_0xc6c2('0xad')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/desk/fields',require(_0xc6c2('0xae')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xaf'),require(_0xc6c2('0xb0')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xb1'),require(_0xc6c2('0xb2')));_0x30ad0b['use'](_0xc6c2('0xb3'),require(_0xc6c2('0xb4')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xb5'),require('./api/intZendeskAccount'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xb6'),require(_0xc6c2('0xb7')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/zendesk/fields',require(_0xc6c2('0xb8')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xb9'),require(_0xc6c2('0xba')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xbb'),require(_0xc6c2('0xbc')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xbd'),require(_0xc6c2('0xbe')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xbf'),require('./api/intVtigerAccount'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xc0'),require(_0xc6c2('0xc1')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/vtiger/fields',require(_0xc6c2('0xc2')));_0x30ad0b['use']('/api/integrations/servicenow/accounts',require(_0xc6c2('0xc3')));_0x30ad0b['use'](_0xc6c2('0xc4'),require(_0xc6c2('0xc5')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/servicenow/fields',require(_0xc6c2('0xc6')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xc7'),require('./api/intDynamics365Configuration'));_0x30ad0b['use'](_0xc6c2('0xc8'),require(_0xc6c2('0xc9')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/freshsales/accounts',require(_0xc6c2('0xca')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/freshsales/configurations',require(_0xc6c2('0xcb')));_0x30ad0b[_0xc6c2('0x9')]('/api/integrations/freshsales/fields',require(_0xc6c2('0xcc')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xcd'),require(_0xc6c2('0xce')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xcf'),require(_0xc6c2('0xd0')));_0x30ad0b['use'](_0xc6c2('0xd1'),require('./api/chatInternalMessage'));_0x30ad0b['use'](_0xc6c2('0xd2'),require(_0xc6c2('0xd3')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xd4'),require(_0xc6c2('0xd5')));_0x30ad0b['use'](_0xc6c2('0xd6'),require('./api/jscriptySessionReport'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xd7'),require(_0xc6c2('0xd8')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xd9'),require(_0xc6c2('0xda')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xdb'),require('./api/squareReportDetail'));_0x30ad0b['use']('/api/jscripty/projects',require(_0xc6c2('0xdc')));_0x30ad0b[_0xc6c2('0x9')]('/api/settings',require(_0xc6c2('0xdd')));_0x30ad0b[_0xc6c2('0x9')]('/api/square/odbc',require('./api/squareOdbc'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xde'),require(_0xc6c2('0xdf')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xe0'),require(_0xc6c2('0xe1')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xe2'),require(_0xc6c2('0xe3')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xe4'),require(_0xc6c2('0xe5')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xe6'),require(_0xc6c2('0xe7')));_0x30ad0b[_0xc6c2('0x9')]('/api/campaigns',require(_0xc6c2('0xe8')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xe9'),require(_0xc6c2('0xea')));_0x30ad0b[_0xc6c2('0x9')]('/api/attachments',require('./api/attachment'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xeb'),require(_0xc6c2('0xec')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xed'),require(_0xc6c2('0xee')));_0x30ad0b[_0xc6c2('0x9')]('/api/chat/reports/transfer',require(_0xc6c2('0xef')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xf0'),require(_0xc6c2('0xf1')));_0x30ad0b[_0xc6c2('0x9')]('/api/openchannel/reports/transfer',require(_0xc6c2('0xf2')));_0x30ad0b[_0xc6c2('0x9')]('/api/sms/reports/transfer',require(_0xc6c2('0xf3')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xf4'),require(_0xc6c2('0xf5')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xf6'),require(_0xc6c2('0xf7')));_0x30ad0b[_0xc6c2('0x9')]('/api/userProfiles',require(_0xc6c2('0xf8')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xf9'),require('./api/userProfileSection'));_0x30ad0b['use'](_0xc6c2('0xfa'),require('./api/userProfileResource'));_0x30ad0b[_0xc6c2('0x9')]('/api/userNotifications',require(_0xc6c2('0xfb')));_0x30ad0b['use'](_0xc6c2('0xfc'),require(_0xc6c2('0xfd')));_0x30ad0b[_0xc6c2('0x9')]('/api/whatsapp/applications',require(_0xc6c2('0xfe')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0xff'),require(_0xc6c2('0x100')));_0x30ad0b[_0xc6c2('0x9')]('/api/whatsapp/messages',require(_0xc6c2('0x101')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x102'),require('./api/whatsappQueueReport'));_0x30ad0b['use'](_0xc6c2('0x103'),require(_0xc6c2('0x104')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x105'),require(_0xc6c2('0x106')));_0x30ad0b['use'](_0xc6c2('0x107'),require(_0xc6c2('0x108')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x109'),require('./api/authLocal'));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x10a'),require('./api/authGoogle'));_0x30ad0b[_0xc6c2('0x9')]('/api/jira',require(_0xc6c2('0x10b')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x10c'),require(_0xc6c2('0x10d')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x10e'),require(_0xc6c2('0x10f')));_0x30ad0b['use']('/api/system',require(_0xc6c2('0x110')));_0x30ad0b['use'](_0xc6c2('0x111'),require(_0xc6c2('0x112')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x113'),require(_0xc6c2('0x114')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x115'),express[_0xc6c2('0x116')](path[_0xc6c2('0x117')](config[_0xc6c2('0x118')],_0xc6c2('0x115'))));_0x30ad0b[_0xc6c2('0x9')]('/www',express[_0xc6c2('0x116')](path[_0xc6c2('0x117')](config[_0xc6c2('0x118')],_0xc6c2('0x119'))));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x11a'),express[_0xc6c2('0x116')](path['join'](config[_0xc6c2('0x118')],'/demo')));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x11b'),express[_0xc6c2('0x116')](path[_0xc6c2('0x117')](config['root'],_0xc6c2('0x11c'),_0xc6c2('0x11d'))));_0x30ad0b[_0xc6c2('0x9')](_0xc6c2('0x11e'),express[_0xc6c2('0x116')](path[_0xc6c2('0x117')](config[_0xc6c2('0x118')],_0xc6c2('0x11f'))));_0x30ad0b[_0xc6c2('0x120')](_0xc6c2('0x121'))[_0xc6c2('0x122')](errors[0x194]);_0x30ad0b['route']('/*')['get'](function(_0x4c2950,_0x3457ae){_0x3457ae[_0xc6c2('0x123')](path[_0xc6c2('0x124')](_0x30ad0b[_0xc6c2('0x122')](_0xc6c2('0x125'))+_0xc6c2('0x126')));});};var sensitiveFields=[_0xc6c2('0x127'),_0xc6c2('0x128'),_0xc6c2('0x129'),_0xc6c2('0x12a'),_0xc6c2('0x12b'),_0xc6c2('0x12c'),'street',_0xc6c2('0x12d'),_0xc6c2('0x12e'),_0xc6c2('0x12f'),_0xc6c2('0x130'),_0xc6c2('0x131'),_0xc6c2('0x132'),_0xc6c2('0x133'),_0xc6c2('0x134'),_0xc6c2('0x135'),_0xc6c2('0x136'),'token',_0xc6c2('0x137'),_0xc6c2('0x138'),'accessTokenSecret','authToken',_0xc6c2('0x139'),_0xc6c2('0x13a'),_0xc6c2('0x13b'),_0xc6c2('0x13c'),_0xc6c2('0x13d'),_0xc6c2('0x13e'),_0xc6c2('0x13f'),'clientEmail',_0xc6c2('0x140'),'accesskeyid','secretaccesskey',_0xc6c2('0x141'),'user',_0xc6c2('0x142'),_0xc6c2('0x143'),_0xc6c2('0x144'),_0xc6c2('0x145'),'secret',_0xc6c2('0x146'),_0xc6c2('0x147')];function maskSensitiveData(_0x90b7b0){var _0x299f1e=/(?!^)[\s\S](?!$)/g;if(!_[_0xc6c2('0x148')](_0x90b7b0))return;for(var _0x144f47 in _0x90b7b0){if(_[_0xc6c2('0x149')](_0x90b7b0[_0x144f47])){for(var _0x34003f=0x0;_0x34003f<_0x90b7b0[_0x144f47][_0xc6c2('0x14a')];_0x34003f++){maskSensitiveData(_0x90b7b0[_0x144f47][_0x34003f]);}}else if(_[_0xc6c2('0x148')](_0x90b7b0[_0x144f47])){maskSensitiveData(_0x90b7b0[_0x144f47]);}else if(_[_0xc6c2('0x14b')](_0x90b7b0[_0x144f47])){_0x90b7b0[_0x144f47]=_0x90b7b0[_0x144f47][_0xc6c2('0x14c')](/{{{/g,_0xc6c2('0x14d'))[_0xc6c2('0x14c')](/}}}/g,'}@@')[_0xc6c2('0x14c')](/{{/g,'@{')[_0xc6c2('0x14c')](/}}/g,'}@');if(_[_0xc6c2('0x14e')](sensitiveFields,_0x144f47)){_0x90b7b0[_0x144f47]=_0x90b7b0[_0x144f47][_0xc6c2('0x14c')](_0x299f1e,'*');}}}} \ No newline at end of file +var _0x9aa8=['./config/logger','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','role','device','other','agent_id','agent_name','/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/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./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/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/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/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','phone','fax','email','clientId','clientSecret','securityToken','code','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','oldPassword','isPlainObject','isArray','replace','@@{','}@@','includes','lodash','path','express','util','api'];(function(_0x56a8e9,_0xd04e8c){var _0x4018a5=function(_0x2645be){while(--_0x2645be){_0x56a8e9['push'](_0x56a8e9['shift']());}};_0x4018a5(++_0xd04e8c);}(_0x9aa8,0x155));var _0x89aa=function(_0x40b4de,_0x6099bd){_0x40b4de=_0x40b4de-0x0;var _0x1e69d2=_0x9aa8[_0x40b4de];return _0x1e69d2;};'use strict';var _=require(_0x89aa('0x0'));var path=require(_0x89aa('0x1'));var express=require(_0x89aa('0x2'));var ewinston=require('express-winston');var util=require(_0x89aa('0x3'));var errors=require('./errors');var config=require('./config/environment');var logger=require('./config/logger')(_0x89aa('0x4'));var authLogger=require(_0x89aa('0x5'))('auth');exports[_0x89aa('0x6')]=function(_0x59b4fd){_0x59b4fd['use'](ewinston[_0x89aa('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x10fd60,_0x3e07b4){var _0x303194=_0x89aa('0x8');if(!_[_0x89aa('0x9')](_0x10fd60[_0x89aa('0xa')])){_0x303194+=_0x89aa('0xb');var _0x28f4ad=_0x10fd60[_0x89aa('0xa')];maskSensitiveData(_0x28f4ad);}return util[_0x89aa('0xc')](_0x303194,_0x10fd60[_0x89aa('0xd')],_0x10fd60[_0x89aa('0xe')][_0x89aa('0xf')]?_0x10fd60['headers']['x-forwarded-for']:_0x10fd60[_0x89aa('0x10')][_0x89aa('0x11')]||_0x10fd60['ip'],_0x10fd60[_0x89aa('0x12')],_0x3e07b4[_0x89aa('0x13')],_0x3e07b4[_0x89aa('0x14')],_0x10fd60[_0x89aa('0x15')]?_0x10fd60[_0x89aa('0x15')]['id']:null,_0x10fd60[_0x89aa('0x15')]?_0x10fd60[_0x89aa('0x15')][_0x89aa('0x16')]:null,_0x10fd60[_0x89aa('0x15')]?_0x10fd60[_0x89aa('0x15')]['role']:null,_0x28f4ad?util[_0x89aa('0x17')](_0x28f4ad,![],null):'');}}));_0x59b4fd[_0x89aa('0x18')](ewinston[_0x89aa('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x281a5f,_0x36e5df){var _0xbe5bc7=_0x89aa('0x19');if(_0x281a5f[_0x89aa('0xa')]&&_0x281a5f['body']['device']&&_0x281a5f[_0x89aa('0xa')]['agent_id']){_0xbe5bc7=_0x89aa('0x1a');}return util[_0x89aa('0xc')](_0xbe5bc7,_0x281a5f[_0x89aa('0xd')],_0x281a5f[_0x89aa('0xe')][_0x89aa('0xf')]?_0x281a5f[_0x89aa('0xe')][_0x89aa('0xf')]:_0x281a5f['connection'][_0x89aa('0x11')]||_0x281a5f['ip'],_0x281a5f[_0x89aa('0x12')],_0x36e5df[_0x89aa('0x13')],_0x36e5df[_0x89aa('0x14')],_0x281a5f['user']?_0x281a5f[_0x89aa('0x15')]['id']:null,_0x281a5f[_0x89aa('0x15')]?_0x281a5f['user'][_0x89aa('0x16')]:null,_0x281a5f[_0x89aa('0x15')]?_0x281a5f[_0x89aa('0x15')][_0x89aa('0x1b')]:null,_0x281a5f[_0x89aa('0xa')]&&_0x281a5f[_0x89aa('0xa')][_0x89aa('0x1c')]?_0x281a5f[_0x89aa('0xa')][_0x89aa('0x1c')]:_0x89aa('0x1d'),_0x281a5f[_0x89aa('0xa')]&&_0x281a5f[_0x89aa('0xa')][_0x89aa('0x1e')]?_0x281a5f[_0x89aa('0xa')][_0x89aa('0x1e')]:'',_0x281a5f[_0x89aa('0xa')]&&_0x281a5f['body']['agent_name']?_0x281a5f[_0x89aa('0xa')][_0x89aa('0x1f')]:'');},'ignoreRoute':function(_0x36c950){var _0x42e90b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x42e90b['test'](_0x36c950['url']);}}));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x20'),require(_0x89aa('0x21')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x22'),require(_0x89aa('0x23')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x24'),require(_0x89aa('0x25')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x26'),require(_0x89aa('0x27')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x28'),require(_0x89aa('0x29')));_0x59b4fd['use']('/api/voice/queues',require(_0x89aa('0x2a')));_0x59b4fd['use'](_0x89aa('0x2b'),require(_0x89aa('0x2c')));_0x59b4fd['use'](_0x89aa('0x2d'),require(_0x89aa('0x2e')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x2f'),require(_0x89aa('0x30')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x31'),require(_0x89aa('0x32')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x33'),require(_0x89aa('0x34')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x35'),require(_0x89aa('0x36')));_0x59b4fd['use'](_0x89aa('0x37'),require('./api/voiceAgentReport'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x38'),require('./api/voiceQueueReport'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x39'),require(_0x89aa('0x3a')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x3b'),require(_0x89aa('0x3c')));_0x59b4fd['use'](_0x89aa('0x3d'),require(_0x89aa('0x3e')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x3f'),require(_0x89aa('0x40')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x41'),require(_0x89aa('0x42')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x43'),require(_0x89aa('0x44')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x45'),require(_0x89aa('0x46')));_0x59b4fd['use'](_0x89aa('0x47'),require(_0x89aa('0x48')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x49'),require('./api/mailMessage'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x4a'),require('./api/mailApplication'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x4b'),require(_0x89aa('0x4c')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x4d'),require('./api/dashboard'));_0x59b4fd['use'](_0x89aa('0x4e'),require('./api/dashboardItem'));_0x59b4fd['use'](_0x89aa('0x4f'),require(_0x89aa('0x50')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x51'),require('./api/faxApplication'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x52'),require('./api/faxInteraction'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x53'),require(_0x89aa('0x54')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x55'),require(_0x89aa('0x56')));_0x59b4fd[_0x89aa('0x18')]('/api/fax/reports/queue',require(_0x89aa('0x57')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x58'),require(_0x89aa('0x59')));_0x59b4fd['use'](_0x89aa('0x5a'),require('./api/smsApplication'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x5b'),require('./api/smsInteraction'));_0x59b4fd['use'](_0x89aa('0x5c'),require(_0x89aa('0x5d')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x5e'),require('./api/smsQueue'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x5f'),require(_0x89aa('0x60')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x61'),require(_0x89aa('0x62')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x63'),require('./api/openchannelInteraction'));_0x59b4fd['use'](_0x89aa('0x64'),require(_0x89aa('0x65')));_0x59b4fd[_0x89aa('0x18')]('/api/openchannel/queues',require(_0x89aa('0x66')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x67'),require(_0x89aa('0x68')));_0x59b4fd['use'](_0x89aa('0x69'),require(_0x89aa('0x6a')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x6b'),require(_0x89aa('0x6c')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x6d'),require('./api/chatInteraction'));_0x59b4fd[_0x89aa('0x18')]('/api/chat/messages',require(_0x89aa('0x6e')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x6f'),require(_0x89aa('0x70')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x71'),require('./api/chatQueue'));_0x59b4fd['use'](_0x89aa('0x72'),require(_0x89aa('0x73')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x74'),require(_0x89aa('0x75')));_0x59b4fd['use'](_0x89aa('0x76'),require(_0x89aa('0x77')));_0x59b4fd[_0x89aa('0x18')]('/api/cm/contacts',require(_0x89aa('0x78')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x79'),require(_0x89aa('0x7a')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x7b'),require(_0x89aa('0x7c')));_0x59b4fd['use']('/api/cm/hopper_final',require(_0x89aa('0x7d')));_0x59b4fd['use'](_0x89aa('0x7e'),require(_0x89aa('0x7f')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x80'),require(_0x89aa('0x81')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x82'),require('./api/action'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x83'),require('./api/automation'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x84'),require('./api/cannedAnswer'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x85'),require(_0x89aa('0x86')));_0x59b4fd[_0x89aa('0x18')]('/api/conditions',require(_0x89aa('0x87')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x88'),require(_0x89aa('0x89')));_0x59b4fd['use'](_0x89aa('0x8a'),require('./api/pause'));_0x59b4fd['use'](_0x89aa('0x8b'),require(_0x89aa('0x8c')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x8d'),require('./api/voiceQueuesLog'));_0x59b4fd['use'](_0x89aa('0x8e'),require(_0x89aa('0x8f')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x90'),require(_0x89aa('0x91')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x92'),require(_0x89aa('0x93')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x94'),require('./api/contactItemType'));_0x59b4fd['use'](_0x89aa('0x95'),require(_0x89aa('0x96')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x97'),require('./api/cmHopperAdditionalPhone'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x98'),require(_0x89aa('0x99')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x9a'),require(_0x89aa('0x9b')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x9c'),require('./api/variable'));_0x59b4fd[_0x89aa('0x18')]('/api/integrations',require(_0x89aa('0x9d')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x9e'),require(_0x89aa('0x9f')));_0x59b4fd['use'](_0x89aa('0xa0'),require('./api/analyticCustomReport'));_0x59b4fd['use']('/api/analytics/default_reports',require(_0x89aa('0xa1')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xa2'),require(_0x89aa('0xa3')));_0x59b4fd['use']('/api/analytics/metrics',require(_0x89aa('0xa4')));_0x59b4fd['use'](_0x89aa('0xa5'),require(_0x89aa('0xa6')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xa7'),require('./api/analyticTreeReport'));_0x59b4fd['use'](_0x89aa('0xa8'),require(_0x89aa('0xa9')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xaa'),require(_0x89aa('0xab')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xac'),require(_0x89aa('0xad')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xae'),require(_0x89aa('0xaf')));_0x59b4fd['use'](_0x89aa('0xb0'),require(_0x89aa('0xb1')));_0x59b4fd['use']('/api/integrations/sugarcrm/fields',require(_0x89aa('0xb2')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xb3'),require('./api/intDeskAccount'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xb4'),require('./api/intDeskConfiguration'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xb5'),require('./api/intDeskField'));_0x59b4fd['use'](_0x89aa('0xb6'),require(_0x89aa('0xb7')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xb8'),require(_0x89aa('0xb9')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xba'),require(_0x89aa('0xbb')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xbc'),require('./api/intZendeskAccount'));_0x59b4fd[_0x89aa('0x18')]('/api/integrations/zendesk/configurations',require(_0x89aa('0xbd')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xbe'),require(_0x89aa('0xbf')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xc0'),require('./api/intFreshdeskAccount'));_0x59b4fd[_0x89aa('0x18')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xc1'),require(_0x89aa('0xc2')));_0x59b4fd['use'](_0x89aa('0xc3'),require(_0x89aa('0xc4')));_0x59b4fd['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x59b4fd[_0x89aa('0x18')]('/api/integrations/vtiger/fields',require(_0x89aa('0xc5')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xc6'),require('./api/intServicenowAccount'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xc7'),require(_0x89aa('0xc8')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xc9'),require('./api/intServicenowField'));_0x59b4fd['use']('/api/integrations/dynamics365/accounts',require(_0x89aa('0xca')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xcb'),require(_0x89aa('0xcc')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xcd'),require('./api/intDynamics365Field'));_0x59b4fd['use'](_0x89aa('0xce'),require(_0x89aa('0xcf')));_0x59b4fd['use'](_0x89aa('0xd0'),require(_0x89aa('0xd1')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xd2'),require(_0x89aa('0xd3')));_0x59b4fd[_0x89aa('0x18')]('/api/networks',require(_0x89aa('0xd4')));_0x59b4fd['use'](_0x89aa('0xd5'),require('./api/chatQueueReport'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xd6'),require('./api/chatInternalMessage'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xd7'),require(_0x89aa('0xd8')));_0x59b4fd['use'](_0x89aa('0xd9'),require(_0x89aa('0xda')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xdb'),require(_0x89aa('0xdc')));_0x59b4fd[_0x89aa('0x18')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x59b4fd[_0x89aa('0x18')]('/api/square/reports',require(_0x89aa('0xdd')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xde'),require(_0x89aa('0xdf')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xe0'),require(_0x89aa('0xe1')));_0x59b4fd[_0x89aa('0x18')]('/api/settings',require(_0x89aa('0xe2')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xe3'),require(_0x89aa('0xe4')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xe5'),require('./api/squareProject'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xe6'),require('./api/squareRecording'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xe7'),require(_0x89aa('0xe8')));_0x59b4fd[_0x89aa('0x18')]('/api/teams',require('./api/team'));_0x59b4fd['use'](_0x89aa('0xe9'),require(_0x89aa('0xea')));_0x59b4fd['use'](_0x89aa('0xeb'),require(_0x89aa('0xec')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xed'),require(_0x89aa('0xee')));_0x59b4fd['use'](_0x89aa('0xef'),require(_0x89aa('0xf0')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xf1'),require(_0x89aa('0xf2')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xf3'),require(_0x89aa('0xf4')));_0x59b4fd['use'](_0x89aa('0xf5'),require(_0x89aa('0xf6')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xf7'),require(_0x89aa('0xf8')));_0x59b4fd['use'](_0x89aa('0xf9'),require(_0x89aa('0xfa')));_0x59b4fd[_0x89aa('0x18')]('/api/sms/reports/transfer',require(_0x89aa('0xfb')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xfc'),require('./api/cmList'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xfd'),require(_0x89aa('0xfe')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0xff'),require(_0x89aa('0x100')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x101'),require('./api/userProfileSection'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x102'),require(_0x89aa('0x103')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x104'),require(_0x89aa('0x105')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x106'),require(_0x89aa('0x107')));_0x59b4fd['use'](_0x89aa('0x108'),require('./api/whatsappApplication'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x109'),require(_0x89aa('0x10a')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x10b'),require(_0x89aa('0x10c')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x10d'),require(_0x89aa('0x10e')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x10f'),require(_0x89aa('0x110')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x111'),require(_0x89aa('0x112')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x113'),require(_0x89aa('0x114')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x115'),require(_0x89aa('0x116')));_0x59b4fd['use'](_0x89aa('0x117'),require(_0x89aa('0x118')));_0x59b4fd['use'](_0x89aa('0x119'),require('./api/jira'));_0x59b4fd['use']('/api/rpc',require(_0x89aa('0x11a')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x11b'),require('./api/version'));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x11c'),require(_0x89aa('0x11d')));_0x59b4fd['use']('/api/pm2',require(_0x89aa('0x11e')));_0x59b4fd['use'](_0x89aa('0x11f'),require(_0x89aa('0x120')));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x121'),express[_0x89aa('0x122')](path[_0x89aa('0x123')](config[_0x89aa('0x124')],'/apidoc')));_0x59b4fd['use'](_0x89aa('0x125'),express['static'](path[_0x89aa('0x123')](config[_0x89aa('0x124')],_0x89aa('0x125'))));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x126'),express[_0x89aa('0x122')](path['join'](config['root'],_0x89aa('0x126'))));_0x59b4fd[_0x89aa('0x18')]('/snippet',express['static'](path['join'](config[_0x89aa('0x124')],_0x89aa('0x127'),_0x89aa('0x128'))));_0x59b4fd[_0x89aa('0x18')](_0x89aa('0x129'),express['static'](path[_0x89aa('0x123')](config[_0x89aa('0x124')],_0x89aa('0x12a'))));_0x59b4fd['route'](_0x89aa('0x12b'))[_0x89aa('0x12c')](errors[0x194]);_0x59b4fd[_0x89aa('0x12d')]('/*')['get'](function(_0x1bd5ff,_0x4930ae){_0x4930ae[_0x89aa('0x12e')](path[_0x89aa('0x12f')](_0x59b4fd[_0x89aa('0x12c')](_0x89aa('0x130'))+_0x89aa('0x131')));});};var sensitiveFields=[_0x89aa('0x132'),_0x89aa('0x133'),_0x89aa('0x134'),'apiKey',_0x89aa('0x135'),_0x89aa('0x136'),'street',_0x89aa('0x137'),'mobile',_0x89aa('0x138'),_0x89aa('0x139'),_0x89aa('0x13a'),_0x89aa('0x13b'),_0x89aa('0x13c'),_0x89aa('0x13d'),'accessKey',_0x89aa('0x13e'),'token',_0x89aa('0x13f'),_0x89aa('0x140'),_0x89aa('0x141'),_0x89aa('0x142'),_0x89aa('0x143'),_0x89aa('0x144'),_0x89aa('0x145'),_0x89aa('0x146'),_0x89aa('0x147'),_0x89aa('0x148'),'vidaooApiKey',_0x89aa('0x149'),_0x89aa('0x14a'),_0x89aa('0x14b'),_0x89aa('0x14c'),_0x89aa('0x14d'),_0x89aa('0x15'),_0x89aa('0x14e'),_0x89aa('0x14f'),_0x89aa('0x150'),_0x89aa('0x151'),'secret',_0x89aa('0x152'),_0x89aa('0x153')];function maskSensitiveData(_0x37ab7f){var _0x573509=/(?!^)[\s\S](?!$)/g;if(!_[_0x89aa('0x154')](_0x37ab7f))return;for(var _0x47811a in _0x37ab7f){if(_[_0x89aa('0x155')](_0x37ab7f[_0x47811a])){for(var _0x4d7660=0x0;_0x4d7660<_0x37ab7f[_0x47811a]['length'];_0x4d7660++){maskSensitiveData(_0x37ab7f[_0x47811a][_0x4d7660]);}}else if(_['isPlainObject'](_0x37ab7f[_0x47811a])){maskSensitiveData(_0x37ab7f[_0x47811a]);}else if(_['isString'](_0x37ab7f[_0x47811a])){_0x37ab7f[_0x47811a]=_0x37ab7f[_0x47811a][_0x89aa('0x156')](/{{{/g,_0x89aa('0x157'))['replace'](/}}}/g,_0x89aa('0x158'))[_0x89aa('0x156')](/{{/g,'@{')[_0x89aa('0x156')](/}}/g,'}@');if(_[_0x89aa('0x159')](sensitiveFields,_0x47811a)){_0x37ab7f[_0x47811a]=_0x37ab7f[_0x47811a][_0x89aa('0x156')](_0x573509,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 18503f5..2b2e5ea 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2931=['../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/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc'];(function(_0x138c93,_0x16c108){var _0x3d56d0=function(_0x4233ce){while(--_0x4233ce){_0x138c93['push'](_0x138c93['shift']());}};_0x3d56d0(++_0x16c108);}(_0x2931,0x101));var _0x1293=function(_0x3054ae,_0x5cb0bb){_0x3054ae=_0x3054ae-0x0;var _0xa72ff0=_0x2931[_0x3054ae];return _0xa72ff0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x1293('0x0'));var _=require(_0x1293('0x1'));var config=require(_0x1293('0x2'));exports[_0x1293('0x3')]=function(){return new BPromise(function(_0x1a34ee,_0xaad30a){var _0x321a0e={};_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x5')));_0x321a0e=_['merge'](_0x321a0e,require('../api/voiceExtension/voiceExtension.rpc'));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x6')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x7')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x8')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x9')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0xa')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0xb')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0xc')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0xd')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0xe')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0xf')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x10')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x11')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x12')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x13')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x14')));_0x321a0e=_['merge'](_0x321a0e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x15')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x16')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x17')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/faxMessage/faxMessage.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/faxQueue/faxQueue.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x18')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x19')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x1a')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/smsMessage/smsMessage.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x1b')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x1c')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x1d')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x1e')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x1f')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x20')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x21')));_0x321a0e=_['merge'](_0x321a0e,require('../api/chatQueue/chatQueue.rpc'));_0x321a0e=_['merge'](_0x321a0e,require('../api/cmContact/cmContact.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x22')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x23')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x24')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x25')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x26')));_0x321a0e=_['merge'](_0x321a0e,require('../api/interval/interval.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x27')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/sound/sound.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x28')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x29')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x2a')));_0x321a0e=_['merge'](_0x321a0e,require('../api/variable/variable.rpc'));_0x321a0e=_['merge'](_0x321a0e,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x2b')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x2c')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x2d')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x2e')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x2f')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x30')));_0x321a0e=_['merge'](_0x321a0e,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x321a0e=_['merge'](_0x321a0e,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x31')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x32')));_0x321a0e=_['merge'](_0x321a0e,require(_0x1293('0x33')));_0x321a0e=_['merge'](_0x321a0e,require('../api/squareOdbc/squareOdbc.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x34')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x35')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x36')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x37')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x38')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require('../api/plugin/plugin.rpc'));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x39')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x3a')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x3b')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x3c')));_0x321a0e=_[_0x1293('0x4')](_0x321a0e,require(_0x1293('0x3d')));var _0x568770=jayson[_0x1293('0x3e')](_0x321a0e)[_0x1293('0x3f')]();var _0x2086f8=config['rpc'][_0x1293('0x40')]||config[_0x1293('0x40')]+0x1;var _0xa258e1=config['rpc']['ip']||_0x1293('0x41');_0x568770['on'](_0x1293('0x42'),function(_0x51f64d){return _0xaad30a(_0x51f64d);});_0x568770[_0x1293('0x3')](_0x2086f8,_0xa258e1,function(){console[_0x1293('0x43')](_0x1293('0x44'),_0xa258e1,_0x2086f8);require(_0x1293('0x45'))['default']();return _0x1a34ee(_0x1293('0x46')+_0xa258e1+':'+_0x2086f8);});});}; \ No newline at end of file +var _0x3e6d=['../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/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.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/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.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','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc'];(function(_0x335eca,_0x23bee1){var _0x4a9e78=function(_0x5ef1ec){while(--_0x5ef1ec){_0x335eca['push'](_0x335eca['shift']());}};_0x4a9e78(++_0x23bee1);}(_0x3e6d,0x15b));var _0xd3e6=function(_0x35c81d,_0x170808){_0x35c81d=_0x35c81d-0x0;var _0x164e2f=_0x3e6d[_0x35c81d];return _0x164e2f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd3e6('0x0'));var _=require(_0xd3e6('0x1'));var config=require(_0xd3e6('0x2'));exports[_0xd3e6('0x3')]=function(){return new BPromise(function(_0x4f0c6e,_0x1441c7){var _0x21d633={};_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x5')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x6')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x7')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x8')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x9')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0xa')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0xb')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0xc')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0xd')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0xe')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0xf')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x10')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x11')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x12')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x13')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x14')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x15')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x16')));_0x21d633=_['merge'](_0x21d633,require('../api/faxAccount/faxAccount.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x17')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/faxInteraction/faxInteraction.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x18')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x19')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x1a')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x1b')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x1c')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x1d')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x1e')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x1f')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x20')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x21')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x22')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/chatInteraction/chatInteraction.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x23')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x24')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x25')));_0x21d633=_['merge'](_0x21d633,require('../api/cmHopper/cmHopper.rpc'));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x26')));_0x21d633=_['merge'](_0x21d633,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x27')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x28')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/pause/pause.rpc'));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x29')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x2a')));_0x21d633=_['merge'](_0x21d633,require('../api/template/template.rpc'));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x2b')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x2c')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x2d')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x2e')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x2f')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x30')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x31')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x32')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x33')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x34')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x35')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x36')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x37')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x38')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x39')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x3a')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x3b')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x3c')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x3d')));_0x21d633=_['merge'](_0x21d633,require(_0xd3e6('0x3e')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x3f')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x40')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x41')));_0x21d633=_[_0xd3e6('0x4')](_0x21d633,require(_0xd3e6('0x42')));var _0x1e7ca9=jayson['server'](_0x21d633)[_0xd3e6('0x43')]();var _0x5f2c25=config[_0xd3e6('0x44')][_0xd3e6('0x45')]||config[_0xd3e6('0x45')]+0x1;var _0x243552=config[_0xd3e6('0x44')]['ip']||_0xd3e6('0x46');_0x1e7ca9['on'](_0xd3e6('0x47'),function(_0x17b036){return _0x1441c7(_0x17b036);});_0x1e7ca9[_0xd3e6('0x3')](_0x5f2c25,_0x243552,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x243552,_0x5f2c25);require(_0xd3e6('0x48'))[_0xd3e6('0x49')]();return _0x4f0c6e(_0xd3e6('0x4a')+_0x243552+':'+_0x5f2c25);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 17007d9..3bbf519 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 _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(_0x32f7ef,_0x2a139e){var _0x4d1051=function(_0x174216){while(--_0x174216){_0x32f7ef['push'](_0x32f7ef['shift']());}};_0x4d1051(++_0x2a139e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 +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(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 516f71a..15c052a 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 _0xb28a=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x4d82b2,_0x4a1269){var _0x45b964=function(_0x584e40){while(--_0x584e40){_0x4d82b2['push'](_0x4d82b2['shift']());}};_0x45b964(++_0x4a1269);}(_0xb28a,0x166));var _0xab28=function(_0x22b099,_0x2f69ba){_0x22b099=_0x22b099-0x0;var _0x5652c7=_0xb28a[_0x22b099];return _0x5652c7;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xab28('0x0'),'E_AGI_ARGUMENT_PORT':_0xab28('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xab28('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xab28('0x3'),'E_AGI_SOCKET_TIMEOUT':_0xab28('0x4'),'E_AGI_COMMAND_EMPTY':_0xab28('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xab28('0x6'),'E_AGI_IVR_ENTRY':_0xab28('0x7')};function AGIError(_0x128a13){var _0x128a13=_0x128a13||null,_0x3b2507=_0x3b2507||[],_0x48949b=0x1,_0x479267='';if(!error[_0x128a13]){_0x128a13=_0xab28('0x8');}_0x3b2507[_0xab28('0x9')](error[_0x128a13]);while(arguments[_0x48949b]){_0x3b2507[_0xab28('0x9')](arguments[_0x48949b]);_0x48949b++;}_0x479267=util[_0xab28('0xa')][_0xab28('0xb')](util,_0x3b2507);this[_0xab28('0xc')]=_0x479267;this['name']=_0x128a13;}module[_0xab28('0xd')]=AGIError; \ No newline at end of file +var _0x3edb=['format','message','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3edb,0x1c9));var _0xb3ed=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3edb[_0x24237f];return _0x48298e;};'use strict';var util=require(_0xb3ed('0x0'));var error={'E_AGI_UNDEFINED':_0xb3ed('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xb3ed('0x2'),'E_AGI_SERVER_CLOSE':_0xb3ed('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xb3ed('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xb3ed('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xb3ed('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xb3ed('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xb3ed('0x8')};function AGIError(_0x28a1c6){var _0x28a1c6=_0x28a1c6||null,_0x50fd32=_0x50fd32||[],_0xcd6a84=0x1,_0x3c968c='';if(!error[_0x28a1c6]){_0x28a1c6=_0xb3ed('0x9');}_0x50fd32[_0xb3ed('0xa')](error[_0x28a1c6]);while(arguments[_0xcd6a84]){_0x50fd32[_0xb3ed('0xa')](arguments[_0xcd6a84]);_0xcd6a84++;}_0x3c968c=util[_0xb3ed('0xb')]['apply'](util,_0x50fd32);this[_0xb3ed('0xc')]=_0x3c968c;this['name']=_0x28a1c6;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5628a4b..31b211d 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 _0x235a=['condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','getVertex','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','condition','length','agicommand','vswitch','target','menu','invalid','traverseBFS','includes','max\x20retry\x20reach'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x235a,0x1ef));var _0xa235=function(_0x345767,_0x18c543){_0x345767=_0x345767-0x0;var _0x1aa43c=_0x235a[_0x345767];return _0x1aa43c;};'use strict';var _=require(_0xa235('0x0'));var logger=require(_0xa235('0x1'))(_0xa235('0x2'));var verticesWithRetry=['menu',_0xa235('0x3'),'getsecretdigits'];var Graph=function(){this[_0xa235('0x4')]={};this[_0xa235('0x5')]={};this[_0xa235('0x6')]=0x0;};Graph[_0xa235('0x7')][_0xa235('0x8')]=function(_0x5e94b0){this[_0xa235('0x4')][_0x5e94b0['id']]=_0x5e94b0;this[_0xa235('0x5')][_0x5e94b0['id']]=[];};Graph['prototype'][_0xa235('0x9')]=function(_0x2dc1ba,_0x450e27,_0x2f3403){this['edges'][_0x2dc1ba][_0xa235('0xa')]({'target':_0x450e27,'condition':_0x2f3403});this['numberOfEdges']+=0x1;};Graph['prototype'][_0xa235('0xb')]=function(){return _['size'](this[_0xa235('0x4')]);};Graph['prototype']['relations']=function(){return this['numberOfEdges'];};Graph[_0xa235('0x7')][_0xa235('0xc')]=function(_0x3e620c){return this[_0xa235('0x4')][_0x3e620c];};Graph['prototype']['traverseBFS']=function(_0x47aad7,_0x3187e4){if(!this[_0xa235('0x4')][_0x47aad7]){return logger[_0xa235('0xd')](_0xa235('0xe'));}var _0x36b4b1=_0x3187e4(this[_0xa235('0x4')][_0x47aad7]);if(!_0x36b4b1){return logger[_0xa235('0xd')](_0xa235('0xf'));}if(this[_0xa235('0x5')][_0x47aad7]['length']===0x0){return logger[_0xa235('0xd')](_0xa235('0x10'));}for(var _0x26fd63=0x0,_0x128244=[],_0x16dbe9=![];_0x26fd63\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','sync','production','start','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','isUndefined','toString','response','agicommand\x20not\x20found','finally','[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','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','xml2json','syncho','util','moment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','port','name','[%s]\x20%s','message','[ERROR]\x20%s','stack','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','inspect','debug','variables'];(function(_0x2cd368,_0x4a8c24){var _0x363036=function(_0x41f907){while(--_0x41f907){_0x2cd368['push'](_0x2cd368['shift']());}};_0x363036(++_0x4a8c24);}(_0x79a8,0x1d0));var _0x879a=function(_0x3cb09b,_0x31c2a5){_0x3cb09b=_0x3cb09b-0x0;var _0x242048=_0x79a8[_0x3cb09b];return _0x242048;};'use strict';var parser=require(_0x879a('0x0'));var _=require('lodash');var syncho=require(_0x879a('0x1'));var util=require(_0x879a('0x2'));var moment=require(_0x879a('0x3'));var config=require('../../config/environment');var logger=require(_0x879a('0x4'))('agi');var utilLicense=require(_0x879a('0x5'));var rpc=require(_0x879a('0x6'));var mailRpc=require(_0x879a('0x7'));var Graph=require(_0x879a('0x8'));var Vertices=require(_0x879a('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x879a('0xa')]=_[_0x879a('0xb')](config[_0x879a('0xa')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0xe27fe6){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xe27fe6);agiHandler(_0xe27fe6);}catch(_0x445079){logger[_0x879a('0xc')](_0x445079['stack']);}});});}function listeningHandler(){console[_0x879a('0xd')](_0x879a('0xe'),config[_0x879a('0xa')]['port']);logger[_0x879a('0xf')](util[_0x879a('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x879a('0xa')][_0x879a('0x11')]));}function errorHandler(_0x3391c8){if(_0x3391c8&&_0x3391c8[_0x879a('0x12')]&&_0x3391c8['message']){logger[_0x879a('0xc')](util[_0x879a('0x10')](_0x879a('0x13'),_0x3391c8[_0x879a('0x12')],_0x3391c8[_0x879a('0x14')]));}else{logger[_0x879a('0xc')](util[_0x879a('0x10')](_0x879a('0x15'),_0x3391c8[_0x879a('0x16')]));}}function closeHandler(){logger[_0x879a('0xf')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x879a('0x17')],this[_0x879a('0x18')],this['callerid'],this[_0x879a('0x19')],this[_0x879a('0x1a')]));try{createSquareReport(this);}catch(_0x149105){logger[_0x879a('0xc')](_0x149105[_0x879a('0x16')]);}}function timeoutHandler(){logger[_0x879a('0xf')](util[_0x879a('0x10')](_0x879a('0x1b'),this[_0x879a('0x17')],this[_0x879a('0x18')],this[_0x879a('0x1c')],this[_0x879a('0x19')],this[_0x879a('0x1a')]));}function hangupHandler(){logger[_0x879a('0xf')](util['format'](_0x879a('0x1d'),this[_0x879a('0x17')],this['calleridname'],this[_0x879a('0x1c')],this[_0x879a('0x19')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x4ed0d6){return parser[_0x879a('0x1e')](_0x4ed0d6,{'object':!![]})[_0x879a('0x1f')][_0x879a('0x20')];}function addVertex(_0x38d42c,_0x4c3808,_0x5c21e2){_0x4c3808[_0x879a('0x21')]=_0x5c21e2;if(_0x4c3808[_0x879a('0x22')](_0x879a('0x23'))){_0x4c3808[_0x879a('0x24')]=parseInt(_0x4c3808[_0x879a('0x23')],0xa);}_0x38d42c[_0x879a('0x25')](_[_0x879a('0x26')](_0x4c3808,_0x879a('0x27')));}function initGraph(_0x358f0e,_0x2ee375){var _0x272bf9=new Graph();for(var _0x3510cc in _0x358f0e){if(_0x358f0e[_0x879a('0x22')](_0x3510cc)){if(_['isArray'](_0x358f0e[_0x3510cc])){for(var _0x51a665=0x0;_0x51a665<_0x358f0e[_0x3510cc][_0x879a('0x28')];_0x51a665+=0x1){addVertex(_0x272bf9,_0x358f0e[_0x3510cc][_0x51a665],_0x3510cc);}}else{addVertex(_0x272bf9,_0x358f0e[_0x3510cc],_0x3510cc);}}}for(var _0x92c805=0x0;_0x92c805<_0x2ee375[_0x879a('0x28')];_0x92c805+=0x1){if(_0x2ee375[_0x92c805][_0x879a('0x29')]&&_0x2ee375[_0x92c805][_0x879a('0x2a')]){_0x272bf9[_0x879a('0x2b')](_0x2ee375[_0x92c805][_0x879a('0x29')],_0x2ee375[_0x92c805][_0x879a('0x2a')],_0x2ee375[_0x92c805][_0x879a('0x2c')]);}}return _0x272bf9;}function getSquareProject(_0x2605e9,_0x1c06f8){rpc[_0x879a('0x2d')](_0x2605e9)[_0x879a('0x2e')](function(_0x99559){_0x1c06f8(null,_0x99559);})[_0x879a('0x2f')](function(_0x14c6c9){_0x1c06f8(null,_0x14c6c9);});}function createSquareReport(_0x93790b,_0x4db7dd){rpc[_0x879a('0x30')](_0x93790b)['then'](function(_0x3ac306){if(_0x4db7dd){_0x4db7dd(null,_0x3ac306);}})[_0x879a('0x2f')](function(_0x1a0358){if(_0x4db7dd){_0x4db7dd(null,_0x1a0358);}});}function setChannelVariables(_0x4d001a){for(var _0x24adad in _0x4d001a){if(_0x4d001a['hasOwnProperty'](_0x24adad)){if(_0x24adad['indexOf']('agi_')===0x0){_0x4d001a[_0x24adad['substring'](0x4)]=_0x4d001a[_0x24adad];delete _0x4d001a[_0x24adad];}}}}function getLogFromObject(_0x334361){return util[_0x879a('0x31')](_0x334361,{'showHidden':![],'depth':null});}function agiHandler(_0x4dcf18){var _0xfff69f,_0x192363,_0x146fbc,_0x4d3e7d,_0x2fd7e7;logger[_0x879a('0x32')](_0x879a('0x33'),JSON[_0x879a('0x34')](_0x4dcf18,null,0x2));logger['info'](util[_0x879a('0x10')](_0x879a('0x35'),_0x4dcf18[_0x879a('0x17')],_0x4dcf18[_0x879a('0x18')],_0x4dcf18['callerid'],_0x4dcf18[_0x879a('0x19')],_0x4dcf18['uniqueid']));_0x4dcf18['on'](_0x879a('0xc'),errorHandler);_0x4dcf18['on']('close',closeHandler);_0x4dcf18['on'](_0x879a('0x36'),timeoutHandler);_0x4dcf18[_0x879a('0x37')]=![];_0x4dcf18['on']('hangup',hangupHandler);var _0x2b80ee=getSquareProject[_0x879a('0x38')](null,_0x4dcf18[_0x879a('0x17')]);if(_0x2b80ee){if(_0x2b80ee[_0x879a('0x39')]){_0xfff69f=getRoot(_0x2b80ee['production']);if(_0xfff69f&&_0xfff69f[_0x879a('0x3a')]){logger[_0x879a('0x32')](_0x879a('0x20'),JSON['stringify'](_0xfff69f,null,0x2));_0x4dcf18['joinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x192363=initGraph(_['omit'](_0xfff69f,_0x879a('0x27')),_0xfff69f[_0x879a('0x27')]);_0x146fbc=new Vertices(_0x4dcf18,rpc,mailRpc);logger[_0x879a('0xf')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4dcf18['arg_1'],_0x4dcf18[_0x879a('0x18')],_0x4dcf18['callerid'],_0x4dcf18[_0x879a('0x19')],_0x4dcf18[_0x879a('0x1a')]));_0x192363[_0x879a('0x3b')](_0xfff69f['start']['id'],function(_0x4f9681){try{_0x4f9681=_0x146fbc[_0x879a('0x3c')](_0x4f9681);logger['debug'](_0x879a('0x3d'),JSON[_0x879a('0x34')](_0x4f9681,null,0x2));if(_0x4f9681['agicommand']===_0x879a('0x3e')){logger[_0x879a('0xf')](_0x879a('0x3f'));_0x4dcf18['context']=_0x4f9681[_0x879a('0x40')]||_0x4dcf18[_0x879a('0x40')];_0x4dcf18['extension']=_0x4f9681[_0x879a('0x41')];_0x4dcf18[_0x879a('0x42')]=_0x4f9681['priority']?_0x4f9681[_0x879a('0x42')]-0x1:0x1;return null;}else if(_0x4f9681&&_0x146fbc[_0x4f9681[_0x879a('0x21')]]){_0x2fd7e7=_0x146fbc[_0x4f9681[_0x879a('0x21')]](_0x4f9681);logger[_0x879a('0xf')]('response',JSON[_0x879a('0x34')](_0x2fd7e7,null,0x2));if(_0x2fd7e7&&_0x2fd7e7['code']===AGI_CODE_SUCCESS&&_0x2fd7e7[_0x879a('0x43')]!==AGI_RESULT_ERROR&&!_0x4dcf18['evtHangup']){logger[_0x879a('0x32')]('response',getLogFromObject(_0x2fd7e7));return _[_0x879a('0x44')](_0x2fd7e7[_0x879a('0x43')])?null:_0x2fd7e7[_0x879a('0x43')][_0x879a('0x45')]();}else{logger[_0x879a('0xc')](_0x879a('0x46'),getLogFromObject(_0x2fd7e7));return null;}}else{logger['error'](_0x879a('0x47'));return null;}}catch(_0x26c474){logger[_0x879a('0xc')](_0x26c474['stack']);return null;}});if(_0xfff69f[_0x879a('0x48')]){logger[_0x879a('0xf')](util[_0x879a('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4dcf18[_0x879a('0x17')],_0x4dcf18[_0x879a('0x18')],_0x4dcf18[_0x879a('0x1c')],_0x4dcf18[_0x879a('0x19')],_0x4dcf18['uniqueid']));_0x192363['traverseBFS'](_0xfff69f[_0x879a('0x48')]['id'],function(_0x4159a3){try{_0x4159a3=_0x146fbc['clear'](_0x4159a3);logger[_0x879a('0x32')](_0x879a('0x3d'),JSON['stringify'](_0x4159a3,null,0x2));if(_0x4159a3&&_0x146fbc[_0x4159a3[_0x879a('0x21')]]){_0x2fd7e7=_0x146fbc[_0x4159a3[_0x879a('0x21')]](_0x4159a3);if(_0x2fd7e7){logger[_0x879a('0x32')](_0x879a('0x46'),getLogFromObject(_0x2fd7e7));return _['isUndefined'](_0x2fd7e7[_0x879a('0x43')])?null:_0x2fd7e7[_0x879a('0x43')][_0x879a('0x45')]();}else{logger['error']('response',getLogFromObject(_0x2fd7e7));return null;}}else{logger[_0x879a('0xc')](_0x879a('0x47'));return null;}}catch(_0x524f1c){logger[_0x879a('0xc')](_0x524f1c[_0x879a('0x16')]);return null;}});}logger[_0x879a('0xf')](util['format'](_0x879a('0x49'),_0x4dcf18[_0x879a('0x17')],_0x4dcf18[_0x879a('0x18')],_0x4dcf18[_0x879a('0x1c')],_0x4dcf18['dnid'],_0x4dcf18[_0x879a('0x1a')]));logger[_0x879a('0xf')](util['format'](_0x879a('0x4a'),_0x4dcf18[_0x879a('0x40')],_0x4dcf18['extension'],parseInt(_0x4dcf18['priority'],0xa)+0x1));_0x4dcf18[_0x879a('0x4b')](_0x4dcf18['context'],_0x4dcf18['extension'],parseInt(_0x4dcf18[_0x879a('0x42')],0xa)+0x1);_0x4dcf18[_0x879a('0x4c')]();}}else{logger['error'](util[_0x879a('0x10')](_0x879a('0x4d'),_0x4dcf18[_0x879a('0x17')]));_0x4dcf18['continueAt'](_0x4dcf18[_0x879a('0x40')],_0x4dcf18[_0x879a('0x41')],parseInt(_0x4dcf18[_0x879a('0x42')],0xa)+0x1);_0x4dcf18[_0x879a('0x4c')]();}}else{logger[_0x879a('0xc')](util[_0x879a('0x10')](_0x879a('0x4e'),_0x4dcf18[_0x879a('0x17')]));_0x4dcf18['continueAt'](_0x4dcf18[_0x879a('0x40')],_0x4dcf18[_0x879a('0x41')],parseInt(_0x4dcf18['priority'],0xa)+0x1);_0x4dcf18['close']();}}function main(){var _0x1d3e3c;return utilLicense['getLicense']()[_0x879a('0x2e')](function(_0x457e4e){if(_0x457e4e){if(_0x457e4e[_0x879a('0x4f')]){if(_0x457e4e[_0x879a('0x50')]&&_0x457e4e['callysquare']>0x0){logger['info'](util[_0x879a('0x10')](_0x879a('0x51'),_0x457e4e['callysquare']));_0x1d3e3c=_0x457e4e[_0x879a('0x50')];}else{logger[_0x879a('0xf')](_0x879a('0x52'));}}else{logger[_0x879a('0xf')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1d3e3c=-0x1;}}})['catch'](function(_0x527e37){logger[_0x879a('0xc')](_0x879a('0x53'),_0x527e37['stack']);})['finally'](function(){var _0x11338c=require(_0x879a('0x54'))(config[_0x879a('0xa')][_0x879a('0x11')],config['agi']['ip'],_0x1d3e3c);_0x11338c['on'](_0x879a('0xc'),errorHandler);_0x11338c['on'](_0x879a('0x55'),listeningHandler);_0x11338c['on']('connection',connectionHandler);_0x11338c['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xf9d5=['production','start','debug','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','nextTick','error','stack','log','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','format','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','retry','maxRetry','addVertex','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','hangup'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf9d5,0x122));var _0x5f9d=function(_0x1e3d48,_0x4f4593){_0x1e3d48=_0x1e3d48-0x0;var _0x19b49d=_0xf9d5[_0x1e3d48];return _0x19b49d;};'use strict';var parser=require('xml2json');var _=require(_0x5f9d('0x0'));var syncho=require(_0x5f9d('0x1'));var util=require('util');var moment=require(_0x5f9d('0x2'));var config=require(_0x5f9d('0x3'));var logger=require(_0x5f9d('0x4'))(_0x5f9d('0x5'));var utilLicense=require(_0x5f9d('0x6'));var rpc=require(_0x5f9d('0x7'));var mailRpc=require(_0x5f9d('0x8'));var Graph=require('./graph');var Vertices=require(_0x5f9d('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x5f9d('0xa')](config[_0x5f9d('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x3420b2){process[_0x5f9d('0xb')](function(){syncho(function(){try{setChannelVariables(_0x3420b2);agiHandler(_0x3420b2);}catch(_0x46e265){logger[_0x5f9d('0xc')](_0x46e265[_0x5f9d('0xd')]);}});});}function listeningHandler(){console[_0x5f9d('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x5f9d('0x5')][_0x5f9d('0xf')]);logger['info'](util['format'](_0x5f9d('0x10'),config[_0x5f9d('0x5')]['ip'],config[_0x5f9d('0x5')]['port']));}function errorHandler(_0x235de2){if(_0x235de2&&_0x235de2[_0x5f9d('0x11')]&&_0x235de2[_0x5f9d('0x12')]){logger[_0x5f9d('0xc')](util['format'](_0x5f9d('0x13'),_0x235de2[_0x5f9d('0x11')],_0x235de2[_0x5f9d('0x12')]));}else{logger['error'](util[_0x5f9d('0x14')](_0x5f9d('0x15'),_0x235de2['stack']));}}function closeHandler(){logger['info'](util[_0x5f9d('0x14')](_0x5f9d('0x16'),this[_0x5f9d('0x17')],this[_0x5f9d('0x18')],this[_0x5f9d('0x19')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x54bd00){logger[_0x5f9d('0xc')](_0x54bd00['stack']);}}function timeoutHandler(){logger[_0x5f9d('0x1a')](util['format'](_0x5f9d('0x1b'),this[_0x5f9d('0x17')],this[_0x5f9d('0x18')],this['callerid'],this[_0x5f9d('0x1c')],this[_0x5f9d('0x1d')]));}function hangupHandler(){logger[_0x5f9d('0x1a')](util[_0x5f9d('0x14')](_0x5f9d('0x1e'),this[_0x5f9d('0x17')],this[_0x5f9d('0x18')],this[_0x5f9d('0x19')],this[_0x5f9d('0x1c')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x5465b1){return parser[_0x5f9d('0x1f')](_0x5465b1,{'object':!![]})['mxGraphModel'][_0x5f9d('0x20')];}function addVertex(_0x5a3472,_0x9d86ce,_0x564886){_0x9d86ce['agicommand']=_0x564886;if(_0x9d86ce['hasOwnProperty'](_0x5f9d('0x21'))){_0x9d86ce[_0x5f9d('0x22')]=parseInt(_0x9d86ce[_0x5f9d('0x21')],0xa);}_0x5a3472[_0x5f9d('0x23')](_['omit'](_0x9d86ce,_0x5f9d('0x24')));}function initGraph(_0x272b93,_0x190402){var _0x74f212=new Graph();for(var _0x2d097f in _0x272b93){if(_0x272b93[_0x5f9d('0x25')](_0x2d097f)){if(_[_0x5f9d('0x26')](_0x272b93[_0x2d097f])){for(var _0x21cc63=0x0;_0x21cc63<_0x272b93[_0x2d097f][_0x5f9d('0x27')];_0x21cc63+=0x1){addVertex(_0x74f212,_0x272b93[_0x2d097f][_0x21cc63],_0x2d097f);}}else{addVertex(_0x74f212,_0x272b93[_0x2d097f],_0x2d097f);}}}for(var _0x1ec773=0x0;_0x1ec773<_0x190402['length'];_0x1ec773+=0x1){if(_0x190402[_0x1ec773][_0x5f9d('0x28')]&&_0x190402[_0x1ec773][_0x5f9d('0x29')]){_0x74f212[_0x5f9d('0x2a')](_0x190402[_0x1ec773][_0x5f9d('0x28')],_0x190402[_0x1ec773][_0x5f9d('0x29')],_0x190402[_0x1ec773][_0x5f9d('0x2b')]);}}return _0x74f212;}function getSquareProject(_0x38b10d,_0x101a80){rpc[_0x5f9d('0x2c')](_0x38b10d)['then'](function(_0x4ed27d){_0x101a80(null,_0x4ed27d);})['catch'](function(_0x118f77){_0x101a80(null,_0x118f77);});}function createSquareReport(_0x5b7bd4,_0x461a2a){rpc['createSquareReport'](_0x5b7bd4)[_0x5f9d('0x2d')](function(_0x5388a3){if(_0x461a2a){_0x461a2a(null,_0x5388a3);}})[_0x5f9d('0x2e')](function(_0xa0ab8c){if(_0x461a2a){_0x461a2a(null,_0xa0ab8c);}});}function setChannelVariables(_0x1f99a6){for(var _0x3b4933 in _0x1f99a6){if(_0x1f99a6[_0x5f9d('0x25')](_0x3b4933)){if(_0x3b4933['indexOf'](_0x5f9d('0x2f'))===0x0){_0x1f99a6[_0x3b4933['substring'](0x4)]=_0x1f99a6[_0x3b4933];delete _0x1f99a6[_0x3b4933];}}}}function getLogFromObject(_0xf30420){return util['inspect'](_0xf30420,{'showHidden':![],'depth':null});}function agiHandler(_0x299736){var _0x20f1ba,_0x5d3fe6,_0x526cce,_0x97826c,_0x36a6bc;logger['debug'](_0x5f9d('0x30'),JSON[_0x5f9d('0x31')](_0x299736,null,0x2));logger[_0x5f9d('0x1a')](util[_0x5f9d('0x14')](_0x5f9d('0x32'),_0x299736['arg_1'],_0x299736[_0x5f9d('0x18')],_0x299736[_0x5f9d('0x19')],_0x299736[_0x5f9d('0x1c')],_0x299736[_0x5f9d('0x1d')]));_0x299736['on'](_0x5f9d('0xc'),errorHandler);_0x299736['on'](_0x5f9d('0x33'),closeHandler);_0x299736['on']('timeout',timeoutHandler);_0x299736[_0x5f9d('0x34')]=![];_0x299736['on'](_0x5f9d('0x35'),hangupHandler);var _0x32ecc1=getSquareProject['sync'](null,_0x299736['arg_1']);if(_0x32ecc1){if(_0x32ecc1[_0x5f9d('0x36')]){_0x20f1ba=getRoot(_0x32ecc1[_0x5f9d('0x36')]);if(_0x20f1ba&&_0x20f1ba[_0x5f9d('0x37')]){logger[_0x5f9d('0x38')](_0x5f9d('0x20'),JSON['stringify'](_0x20f1ba,null,0x2));_0x299736['joinAt']=moment()[_0x5f9d('0x14')](_0x5f9d('0x39'));_0x5d3fe6=initGraph(_['omit'](_0x20f1ba,_0x5f9d('0x24')),_0x20f1ba['mxCell']);_0x526cce=new Vertices(_0x299736,rpc,mailRpc);logger[_0x5f9d('0x1a')](util[_0x5f9d('0x14')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x299736[_0x5f9d('0x17')],_0x299736[_0x5f9d('0x18')],_0x299736[_0x5f9d('0x19')],_0x299736['dnid'],_0x299736[_0x5f9d('0x1d')]));_0x5d3fe6[_0x5f9d('0x3a')](_0x20f1ba[_0x5f9d('0x37')]['id'],function(_0x3c43f6){try{_0x3c43f6=_0x526cce[_0x5f9d('0x3b')](_0x3c43f6);logger[_0x5f9d('0x38')](_0x5f9d('0x3c'),JSON[_0x5f9d('0x31')](_0x3c43f6,null,0x2));if(_0x3c43f6[_0x5f9d('0x3d')]===_0x5f9d('0x3e')){logger[_0x5f9d('0x1a')](_0x5f9d('0x3f'));_0x299736[_0x5f9d('0x40')]=_0x3c43f6[_0x5f9d('0x40')]||_0x299736[_0x5f9d('0x40')];_0x299736[_0x5f9d('0x41')]=_0x3c43f6[_0x5f9d('0x41')];_0x299736[_0x5f9d('0x42')]=_0x3c43f6[_0x5f9d('0x42')]?_0x3c43f6[_0x5f9d('0x42')]-0x1:0x1;return null;}else if(_0x3c43f6&&_0x526cce[_0x3c43f6[_0x5f9d('0x3d')]]){_0x36a6bc=_0x526cce[_0x3c43f6[_0x5f9d('0x3d')]](_0x3c43f6);logger[_0x5f9d('0x1a')](_0x5f9d('0x43'),JSON[_0x5f9d('0x31')](_0x36a6bc,null,0x2));if(_0x36a6bc&&_0x36a6bc[_0x5f9d('0x44')]===AGI_CODE_SUCCESS&&_0x36a6bc[_0x5f9d('0x45')]!==AGI_RESULT_ERROR&&!_0x299736[_0x5f9d('0x34')]){logger[_0x5f9d('0x38')](_0x5f9d('0x43'),getLogFromObject(_0x36a6bc));return _['isUndefined'](_0x36a6bc[_0x5f9d('0x45')])?null:_0x36a6bc['result'][_0x5f9d('0x46')]();}else{logger[_0x5f9d('0xc')](_0x5f9d('0x43'),getLogFromObject(_0x36a6bc));return null;}}else{logger[_0x5f9d('0xc')](_0x5f9d('0x47'));return null;}}catch(_0x476abf){logger[_0x5f9d('0xc')](_0x476abf['stack']);return null;}});if(_0x20f1ba[_0x5f9d('0x48')]){logger[_0x5f9d('0x1a')](util[_0x5f9d('0x14')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x299736[_0x5f9d('0x17')],_0x299736['calleridname'],_0x299736[_0x5f9d('0x19')],_0x299736[_0x5f9d('0x1c')],_0x299736[_0x5f9d('0x1d')]));_0x5d3fe6['traverseBFS'](_0x20f1ba['finally']['id'],function(_0x17cd97){try{_0x17cd97=_0x526cce[_0x5f9d('0x3b')](_0x17cd97);logger['debug'](_0x5f9d('0x3c'),JSON['stringify'](_0x17cd97,null,0x2));if(_0x17cd97&&_0x526cce[_0x17cd97[_0x5f9d('0x3d')]]){_0x36a6bc=_0x526cce[_0x17cd97[_0x5f9d('0x3d')]](_0x17cd97);if(_0x36a6bc){logger[_0x5f9d('0x38')](_0x5f9d('0x43'),getLogFromObject(_0x36a6bc));return _[_0x5f9d('0x49')](_0x36a6bc[_0x5f9d('0x45')])?null:_0x36a6bc[_0x5f9d('0x45')][_0x5f9d('0x46')]();}else{logger[_0x5f9d('0xc')](_0x5f9d('0x43'),getLogFromObject(_0x36a6bc));return null;}}else{logger['error'](_0x5f9d('0x47'));return null;}}catch(_0x2a5ebc){logger['error'](_0x2a5ebc[_0x5f9d('0xd')]);return null;}});}logger[_0x5f9d('0x1a')](util[_0x5f9d('0x14')](_0x5f9d('0x4a'),_0x299736[_0x5f9d('0x17')],_0x299736[_0x5f9d('0x18')],_0x299736[_0x5f9d('0x19')],_0x299736[_0x5f9d('0x1c')],_0x299736['uniqueid']));logger['info'](util[_0x5f9d('0x14')](_0x5f9d('0x4b'),_0x299736[_0x5f9d('0x40')],_0x299736[_0x5f9d('0x41')],parseInt(_0x299736[_0x5f9d('0x42')],0xa)+0x1));_0x299736[_0x5f9d('0x4c')](_0x299736[_0x5f9d('0x40')],_0x299736[_0x5f9d('0x41')],parseInt(_0x299736[_0x5f9d('0x42')],0xa)+0x1);_0x299736['close']();}}else{logger['error'](util[_0x5f9d('0x14')](_0x5f9d('0x4d'),_0x299736[_0x5f9d('0x17')]));_0x299736[_0x5f9d('0x4c')](_0x299736[_0x5f9d('0x40')],_0x299736[_0x5f9d('0x41')],parseInt(_0x299736[_0x5f9d('0x42')],0xa)+0x1);_0x299736[_0x5f9d('0x33')]();}}else{logger[_0x5f9d('0xc')](util[_0x5f9d('0x14')]('Project\x20%s\x20not\x20found',_0x299736['arg_1']));_0x299736[_0x5f9d('0x4c')](_0x299736[_0x5f9d('0x40')],_0x299736[_0x5f9d('0x41')],parseInt(_0x299736['priority'],0xa)+0x1);_0x299736[_0x5f9d('0x33')]();}}function main(){var _0x560290;return utilLicense[_0x5f9d('0x4e')]()['then'](function(_0x59022d){if(_0x59022d){if(_0x59022d[_0x5f9d('0x4f')]){if(_0x59022d['callysquare']&&_0x59022d[_0x5f9d('0x50')]>0x0){logger[_0x5f9d('0x1a')](util[_0x5f9d('0x14')](_0x5f9d('0x51'),_0x59022d[_0x5f9d('0x50')]));_0x560290=_0x59022d[_0x5f9d('0x50')];}else{logger['info'](_0x5f9d('0x52'));}}else{logger['info'](_0x5f9d('0x53'));_0x560290=-0x1;}}})['catch'](function(_0x557e65){logger[_0x5f9d('0xc')](_0x5f9d('0x54'),_0x557e65[_0x5f9d('0xd')]);})[_0x5f9d('0x48')](function(){var _0x5e8d28=require('./server')(config[_0x5f9d('0x5')][_0x5f9d('0xf')],config[_0x5f9d('0x5')]['ip'],_0x560290);_0x5e8d28['on'](_0x5f9d('0xc'),errorHandler);_0x5e8d28['on'](_0x5f9d('0x55'),listeningHandler);_0x5e8d28['on']('connection',connectionHandler);_0x5e8d28['on'](_0x5f9d('0x33'),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 d2c3699..8bf0133 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(_0x5120a9,_0x43a68a){var _0x2903fa=function(_0x36ed87){while(--_0x36ed87){_0x5120a9['push'](_0x5120a9['shift']());}};_0x2903fa(++_0x43a68a);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x65c0a4,_0x600ae3){var _0x5e1365=function(_0x35dbdf){while(--_0x35dbdf){_0x65c0a4['push'](_0x65c0a4['shift']());}};_0x5e1365(++_0x600ae3);}(_0x34e8,0x12c));var _0x834e=function(_0x308d30,_0xf4ff17){_0x308d30=_0x308d30-0x0;var _0x7ec63d=_0x34e8[_0x308d30];return _0x7ec63d;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6415da1..a1ca4ed 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(_0x4b6339,_0x49c545){var _0x353978=function(_0x4ad096){while(--_0x4ad096){_0x4b6339['push'](_0x4b6339['shift']());}};_0x353978(++_0x49c545);}(_0x5f2f,0x73));var _0xf5f2=function(_0x137e96,_0x301502){_0x137e96=_0x137e96-0x0;var _0x47d8f2=_0x5f2f[_0x137e96];return _0x47d8f2;};'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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x1b343a,_0x171e4a){var _0x55a4f8=function(_0x51ca21){while(--_0x51ca21){_0x1b343a['push'](_0x1b343a['shift']());}};_0x55a4f8(++_0x171e4a);}(_0x7a54,0x106));var _0x47a5=function(_0x28d18b,_0x531e05){_0x28d18b=_0x28d18b-0x0;var _0x168e47=_0x7a54[_0x28d18b];return _0x168e47;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index eb96787..5600b2e 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 _0x1c52=['getTrunkById','getSoundById','save_name','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','client','http','request','then','error','result','catch','ShowSquareProject','getMailAccountById','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1c52,0xa9));var _0x21c5=function(_0x3f3940,_0x158134){_0x3f3940=_0x3f3940-0x0;var _0xdd1ff6=_0x1c52[_0x3f3940];return _0xdd1ff6;};'use strict';var BPromise=require(_0x21c5('0x0'));var moment=require(_0x21c5('0x1'));var _=require('lodash');var util=require(_0x21c5('0x2'));var jayson=require('jayson/promise');var client=jayson[_0x21c5('0x3')][_0x21c5('0x4')]({'port':0x2329});function request(_0x3ebf6e,_0x3a639b){return new BPromise(function(_0x994c52,_0x59bc56){return client[_0x21c5('0x5')](_0x3ebf6e,_0x3a639b)[_0x21c5('0x6')](function(_0xc7e95b){if(_0xc7e95b[_0x21c5('0x7')]){return _0x59bc56(_0xc7e95b['error']['message']);}else{return _0x994c52(_0xc7e95b[_0x21c5('0x8')]);}})[_0x21c5('0x9')](function(_0x2d926d){return _0x59bc56(_0x2d926d);});});}exports['getSquareProject']=function(_0x141a50){return request(_0x21c5('0xa'),{'options':{'raw':![],'where':{'name':_0x141a50},'attributes':['production']}});};exports[_0x21c5('0xb')]=function(_0x59f706){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x59f706},'include':[{'model':'MailServerOut','as':_0x21c5('0xc')}],'attributes':['id',_0x21c5('0xd'),_0x21c5('0xe')]}});};exports[_0x21c5('0xf')]=function(_0x3ea3a0){return request('ShowSquareProject',{'options':{'where':{'id':_0x3ea3a0},'attributes':[_0x21c5('0xd')]}});};exports[_0x21c5('0x10')]=function(_0x410b6b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x410b6b},'attributes':[_0x21c5('0xd')]}});};exports[_0x21c5('0x11')]=function(_0xdb3e0b){return request(_0x21c5('0x12'),{'options':{'where':{'id':_0xdb3e0b},'attributes':['name']}});};exports[_0x21c5('0x13')]=function(_0xc2d464){return request(_0x21c5('0x14'),{'options':{'where':{'id':_0xc2d464},'attributes':[_0x21c5('0x15')]}});};exports['getUserById']=function(_0x3ce3d6){return request(_0x21c5('0x16'),{'options':{'where':{'id':_0x3ce3d6},'attributes':[_0x21c5('0xd')]}});};exports[_0x21c5('0x17')]=function(_0x124ca3){return request('ShowTrunk',{'options':{'where':{'id':_0x124ca3},'attributes':[_0x21c5('0xd')]}});};exports[_0x21c5('0x18')]=function(_0x283fd7){return request('ShowSound',{'options':{'where':{'id':_0x283fd7},'attributes':[_0x21c5('0x19')]}});};exports['getIntervalById']=function(_0x432ca7){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x432ca7},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x21c5('0x1a')]=function(_0x57f203){return request(_0x21c5('0x1b'),{'options':{'where':{'id':_0x57f203},'attributes':['id','name']}});};exports[_0x21c5('0x1c')]=function(_0x2b07f2){return request('CreateSmsMessage',{'body':_0x2b07f2});};exports['createSquareDetailsReport']=function(_0x5d8853){return request('CreateSquareDetailsReport',{'body':_0x5d8853});};exports[_0x21c5('0x1d')]=function(_0x729260){return request('CreateSquareReport',{'body':_[_0x21c5('0x1e')](_0x729260,{'project_name':_0x729260[_0x21c5('0x1f')],'prev_project_name':_0x729260[_0x21c5('0x20')]||'','is_subproject':_0x729260['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x21c5('0x21'))})});};exports[_0x21c5('0x22')]=function(_0x2fad52){return request('CreateSquareRecording',{'body':_0x2fad52});};exports[_0x21c5('0x23')]=function(_0x5533dc){return request(_0x21c5('0x24'),{'body':_0x5533dc});};exports['createCmContact']=function(_0x125ee0){return request(_0x21c5('0x25'),{'options':{'raw':![],'where':{'phone':_0x125ee0['phone'],'ListId':_0x125ee0[_0x21c5('0x26')]}}})[_0x21c5('0x6')](function(_0x300a6d){if(_0x300a6d){return _0x300a6d;}return request(_0x21c5('0x27'),{'body':_0x125ee0});});};exports[_0x21c5('0x28')]=function(_0x12bbbe){return request('ShowPause',{'options':{'where':{'id':_0x12bbbe},'attributes':[_0x21c5('0xd')]}});};exports[_0x21c5('0x29')]=function(_0x6d3cee,_0x20955f){return request(_0x21c5('0x2a'),{'body':{'interface':_0x20955f},'options':{'where':_0x6d3cee}});};exports[_0x21c5('0x2b')]=function(_0x8b704a,_0xd77a1b,_0x127b91){return request('PauseUser',{'body':{'type':_0xd77a1b,'uniqueid':_0x127b91},'options':{'where':_0x8b704a}});};exports[_0x21c5('0x2c')]=function(_0x31f802){return request(_0x21c5('0x2d'),{'body':{},'options':{'where':_0x31f802}});};exports[_0x21c5('0x2e')]=function(_0x42722e){return request(_0x21c5('0x2f'),{'body':{},'options':{'where':_0x42722e}});}; \ No newline at end of file +var _0x7b37=['LogoutUser','bluebird','moment','util','jayson/promise','http','then','message','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause'];(function(_0x1c29fe,_0x1d37c1){var _0x283709=function(_0x8457c0){while(--_0x8457c0){_0x1c29fe['push'](_0x1c29fe['shift']());}};_0x283709(++_0x1d37c1);}(_0x7b37,0xd9));var _0x77b3=function(_0x25cfcd,_0x5a294d){_0x25cfcd=_0x25cfcd-0x0;var _0x421a40=_0x7b37[_0x25cfcd];return _0x421a40;};'use strict';var BPromise=require(_0x77b3('0x0'));var moment=require(_0x77b3('0x1'));var _=require('lodash');var util=require(_0x77b3('0x2'));var jayson=require(_0x77b3('0x3'));var client=jayson['client'][_0x77b3('0x4')]({'port':0x2329});function request(_0x522d20,_0x2719f2){return new BPromise(function(_0x2c94ea,_0x2d64f7){return client['request'](_0x522d20,_0x2719f2)[_0x77b3('0x5')](function(_0x32345c){if(_0x32345c['error']){return _0x2d64f7(_0x32345c['error'][_0x77b3('0x6')]);}else{return _0x2c94ea(_0x32345c['result']);}})[_0x77b3('0x7')](function(_0x37fafb){return _0x2d64f7(_0x37fafb);});});}exports['getSquareProject']=function(_0x46dc45){return request(_0x77b3('0x8'),{'options':{'raw':![],'where':{'name':_0x46dc45},'attributes':[_0x77b3('0x9')]}});};exports[_0x77b3('0xa')]=function(_0x203a71){return request(_0x77b3('0xb'),{'options':{'raw':![],'where':{'id':_0x203a71},'include':[{'model':_0x77b3('0xc'),'as':_0x77b3('0xd')}],'attributes':['id',_0x77b3('0xe'),_0x77b3('0xf')]}});};exports['getSquareProjectById']=function(_0x13bc8e){return request(_0x77b3('0x8'),{'options':{'where':{'id':_0x13bc8e},'attributes':[_0x77b3('0xe')]}});};exports[_0x77b3('0x10')]=function(_0x3ee308){return request(_0x77b3('0x11'),{'options':{'where':{'id':_0x3ee308},'attributes':[_0x77b3('0xe')]}});};exports[_0x77b3('0x12')]=function(_0x9bdb6d){return request(_0x77b3('0x13'),{'options':{'where':{'id':_0x9bdb6d},'attributes':[_0x77b3('0xe')]}});};exports[_0x77b3('0x14')]=function(_0x504c5b){return request(_0x77b3('0x15'),{'options':{'where':{'id':_0x504c5b},'attributes':[_0x77b3('0x16')]}});};exports[_0x77b3('0x17')]=function(_0x442bb8){return request('ShowUser',{'options':{'where':{'id':_0x442bb8},'attributes':[_0x77b3('0xe')]}});};exports['getTrunkById']=function(_0x4e44ec){return request(_0x77b3('0x18'),{'options':{'where':{'id':_0x4e44ec},'attributes':[_0x77b3('0xe')]}});};exports[_0x77b3('0x19')]=function(_0x4499e8){return request('ShowSound',{'options':{'where':{'id':_0x4499e8},'attributes':[_0x77b3('0x1a')]}});};exports['getIntervalById']=function(_0x5453ba){return request(_0x77b3('0x1b'),{'options':{'raw':![],'where':{'id':_0x5453ba},'include':[{'model':_0x77b3('0x1c'),'as':_0x77b3('0x1d')}]}});};exports['getSmsAccountById']=function(_0x95b5fc){return request(_0x77b3('0x1e'),{'options':{'where':{'id':_0x95b5fc},'attributes':['id',_0x77b3('0xe')]}});};exports[_0x77b3('0x1f')]=function(_0x34366c){return request(_0x77b3('0x20'),{'body':_0x34366c});};exports[_0x77b3('0x21')]=function(_0x17d739){return request(_0x77b3('0x22'),{'body':_0x17d739});};exports[_0x77b3('0x23')]=function(_0x586e87){return request(_0x77b3('0x24'),{'body':_['merge'](_0x586e87,{'project_name':_0x586e87[_0x77b3('0x25')],'prev_project_name':_0x586e87['arg_2']||'','is_subproject':_0x586e87[_0x77b3('0x26')]?!![]:![],'leaveAt':moment()[_0x77b3('0x27')](_0x77b3('0x28'))})});};exports[_0x77b3('0x29')]=function(_0x38be5e){return request('CreateSquareRecording',{'body':_0x38be5e});};exports['createSquareMessage']=function(_0x390b56){return request(_0x77b3('0x2a'),{'body':_0x390b56});};exports[_0x77b3('0x2b')]=function(_0x49155b){return request(_0x77b3('0x2c'),{'options':{'raw':![],'where':{'phone':_0x49155b[_0x77b3('0x2d')],'ListId':_0x49155b[_0x77b3('0x2e')]}}})[_0x77b3('0x5')](function(_0x232bb7){if(_0x232bb7){return _0x232bb7;}return request(_0x77b3('0x2f'),{'body':_0x49155b});});};exports['getPauseById']=function(_0x289383){return request(_0x77b3('0x30'),{'options':{'where':{'id':_0x289383},'attributes':['name']}});};exports['agentLogin']=function(_0x376bcf,_0x460813){return request(_0x77b3('0x31'),{'body':{'interface':_0x460813},'options':{'where':_0x376bcf}});};exports[_0x77b3('0x32')]=function(_0x14a7f8,_0x240c1b,_0x3ff4ea){return request(_0x77b3('0x33'),{'body':{'type':_0x240c1b,'uniqueid':_0x3ff4ea},'options':{'where':_0x14a7f8}});};exports[_0x77b3('0x34')]=function(_0x104747){return request('UnpauseUser',{'body':{},'options':{'where':_0x104747}});};exports['agentLogout']=function(_0x17b4ec){return request(_0x77b3('0x35'),{'body':{},'options':{'where':_0x17b4ec}});}; \ 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 8abd5f2..a632912 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 _0xca66=['./polly'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xca66,0x8b));var _0x6ca6=function(_0x2688d3,_0x58b123){_0x2688d3=_0x2688d3-0x0;var _0x42f823=_0xca66[_0x2688d3];return _0x42f823;};var polly=require(_0x6ca6('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7bae=['exports'];(function(_0x41c44d,_0x31d1eb){var _0x5e00f5=function(_0x235c98){while(--_0x235c98){_0x41c44d['push'](_0x41c44d['shift']());}};_0x5e00f5(++_0x31d1eb);}(_0x7bae,0x13b));var _0xe7ba=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7bae[_0x397e5f];return _0x5302b8;};var polly=require('./polly');var lex=require('./lex');module[_0xe7ba('0x0')]={'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 3f20a28..844fd47 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 _0x89e8=['./lib/api','exports'];(function(_0x31eb97,_0x35db07){var _0x36c853=function(_0x44df57){while(--_0x44df57){_0x31eb97['push'](_0x31eb97['shift']());}};_0x36c853(++_0x35db07);}(_0x89e8,0x74));var _0x889e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x89e8[_0x397e5f];return _0x5302b8;};'use strict';var lex=require(_0x889e('0x0'));module[_0x889e('0x1')]=function(_0xfc1dd0,_0x319ddb,_0x35d770,_0x2a8b6d,_0xfe71bf,_0x935fd){return lex(_0xfc1dd0,_0x319ddb,_0x35d770,_0x2a8b6d,_0xfe71bf,_0x935fd);}; \ No newline at end of file +var _0xe13a=['exports'];(function(_0x48302d,_0x3c1e8f){var _0x26832a=function(_0x432588){while(--_0x432588){_0x48302d['push'](_0x48302d['shift']());}};_0x26832a(++_0x3c1e8f);}(_0xe13a,0x178));var _0xae13=function(_0x563122,_0x4b5d60){_0x563122=_0x563122-0x0;var _0x1f5d68=_0xe13a[_0x563122];return _0x1f5d68;};'use strict';var lex=require('./lib/api');module[_0xae13('0x0')]=function(_0x2da5ca,_0x3dd3e8,_0x6066c0,_0x4cf961,_0x3aaf90,_0x6840ca){return lex(_0x2da5ca,_0x3dd3e8,_0x6066c0,_0x4cf961,_0x3aaf90,_0x6840ca);}; \ 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 f2abe9e..59086ab 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 _0xa32f=['bluebird','aws-sdk','postText','slots','hasOwnProperty','exports','LexRuntime'];(function(_0x53765c,_0x37d8a5){var _0x170107=function(_0x263606){while(--_0x263606){_0x53765c['push'](_0x53765c['shift']());}};_0x170107(++_0x37d8a5);}(_0xa32f,0x1b9));var _0xfa32=function(_0x4e464e,_0x5529e4){_0x4e464e=_0x4e464e-0x0;var _0x46d8fc=_0xa32f[_0x4e464e];return _0x46d8fc;};'use strict';var BPromise=require(_0xfa32('0x0'));var AWS=require(_0xfa32('0x1'));function lexResult(_0x47be39,_0x350162){return new BPromise(function(_0x51a84d,_0x573659){_0x47be39[_0xfa32('0x2')](_0x350162,function(_0x41d4a1,_0x235d7e){if(_0x41d4a1){_0x573659(_0x41d4a1);}if(_0x235d7e['slots']){for(const _0x2ae8ee in _0x235d7e['slots']){if(_0x235d7e[_0xfa32('0x3')][_0xfa32('0x4')](_0x2ae8ee)){var _0x470f24=_0x235d7e[_0xfa32('0x3')][_0x2ae8ee];_0x235d7e['slot_'+_0x2ae8ee]=_0x470f24;}}}_0x51a84d(_0x235d7e);});});}module[_0xfa32('0x5')]=function(_0x2bfe7e,_0x40010f,_0x2ab28b,_0x5be8b9,_0x2fb718,_0x6b3af7){var _0x2c7aa6=new AWS[(_0xfa32('0x6'))]({'accessKeyId':_0x40010f,'secretAccessKey':_0x2ab28b,'region':_0x5be8b9});var _0x340e66={'botAlias':'$LATEST','botName':_0x6b3af7,'inputText':_0x2fb718,'userId':_0x2bfe7e};return lexResult(_0x2c7aa6,_0x340e66);}; \ No newline at end of file +var _0x4f59=['bluebird','aws-sdk','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST'];(function(_0x2e6cd4,_0x1a0a07){var _0x56531a=function(_0x135344){while(--_0x135344){_0x2e6cd4['push'](_0x2e6cd4['shift']());}};_0x56531a(++_0x1a0a07);}(_0x4f59,0x88));var _0x94f5=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x4f59[_0x45fc6a];return _0x14bcfd;};'use strict';var BPromise=require(_0x94f5('0x0'));var AWS=require(_0x94f5('0x1'));function lexResult(_0x1f294e,_0x3eb947){return new BPromise(function(_0x245b5d,_0x28698b){_0x1f294e['postText'](_0x3eb947,function(_0x4f2c20,_0x3b572c){if(_0x4f2c20){_0x28698b(_0x4f2c20);}if(_0x3b572c[_0x94f5('0x2')]){for(const _0x303d91 in _0x3b572c[_0x94f5('0x2')]){if(_0x3b572c[_0x94f5('0x2')][_0x94f5('0x3')](_0x303d91)){var _0x1a8fb3=_0x3b572c[_0x94f5('0x2')][_0x303d91];_0x3b572c[_0x94f5('0x4')+_0x303d91]=_0x1a8fb3;}}}_0x245b5d(_0x3b572c);});});}module[_0x94f5('0x5')]=function(_0x21fe6a,_0x50124e,_0x123096,_0x4ebc1b,_0x5a309e,_0x1566fb){var _0x13567b=new AWS[(_0x94f5('0x6'))]({'accessKeyId':_0x50124e,'secretAccessKey':_0x123096,'region':_0x4ebc1b});var _0x5c9ed3={'botAlias':_0x94f5('0x7'),'botName':_0x1566fb,'inputText':_0x5a309e,'userId':_0x21fe6a};return lexResult(_0x13567b,_0x5c9ed3);}; \ 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 829f896..69362a8 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 _0xd4ea=['./lib/api','exports'];(function(_0x4981ed,_0x5ee4af){var _0x4134fa=function(_0x510ed9){while(--_0x510ed9){_0x4981ed['push'](_0x4981ed['shift']());}};_0x4134fa(++_0x5ee4af);}(_0xd4ea,0x12e));var _0xad4e=function(_0x7cd2cc,_0x49fc1a){_0x7cd2cc=_0x7cd2cc-0x0;var _0x3c6d19=_0xd4ea[_0x7cd2cc];return _0x3c6d19;};'use strict';var polly=require(_0xad4e('0x0'));module[_0xad4e('0x1')]=function(_0x48771e,_0x29033d,_0x1f4453,_0x510c77,_0x18f16e,_0x3821ec,_0x598f10){return polly(_0x48771e,_0x29033d,_0x1f4453,_0x510c77,_0x18f16e,_0x3821ec,_0x598f10);}; \ No newline at end of file +var _0xe605=['./lib/api'];(function(_0x40f7f0,_0x3901d1){var _0x374a1d=function(_0x2fc42b){while(--_0x2fc42b){_0x40f7f0['push'](_0x40f7f0['shift']());}};_0x374a1d(++_0x3901d1);}(_0xe605,0xae));var _0x5e60=function(_0xf62886,_0x1e7b9a){_0xf62886=_0xf62886-0x0;var _0x317c1e=_0xe605[_0xf62886];return _0x317c1e;};'use strict';var polly=require(_0x5e60('0x0'));module['exports']=function(_0x5f593b,_0x539898,_0x51e097,_0x872803,_0x29513d,_0x41d947,_0x1a820e){return polly(_0x5f593b,_0x539898,_0x51e097,_0x872803,_0x29513d,_0x41d947,_0x1a820e);}; \ 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 ed80d7d..ef4ea07 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 _0xef6b=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path'];(function(_0x45cfc8,_0x25c9ed){var _0x5e3c59=function(_0x34d410){while(--_0x34d410){_0x45cfc8['push'](_0x45cfc8['shift']());}};_0x5e3c59(++_0x25c9ed);}(_0xef6b,0xaf));var _0xbef6=function(_0x3d37cc,_0x52a9eb){_0x3d37cc=_0x3d37cc-0x0;var _0x5e74be=_0xef6b[_0x3d37cc];return _0x5e74be;};'use strict';var fs=require('fs');var path=require(_0xbef6('0x0'));var BPromise=require(_0xbef6('0x1'));var rs=require(_0xbef6('0x2'));var AWS=require(_0xbef6('0x3'));function pollyResult(_0x4ee6bf,_0x3dd747,_0x1faebe){return new BPromise(function(_0x48cd16,_0x226c86){_0x4ee6bf[_0xbef6('0x4')](_0x3dd747,function(_0x5593d0,_0x1ee0ee){if(_0x5593d0){_0x226c86(_0x5593d0);}else if(_0x1ee0ee){if(_0x1ee0ee[_0xbef6('0x5')]instanceof Buffer){fs[_0xbef6('0x6')](_0x1faebe,_0x1ee0ee['AudioStream'],function(_0xee84b){if(_0xee84b){_0x226c86(_0xee84b);}else{_0x48cd16();}});}else{_0x226c86(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x226c86(new Error(_0xbef6('0x7')));}});});}module[_0xbef6('0x8')]=function(_0x180182,_0x356c82,_0x4fff66,_0x34220a,_0x18aeaa,_0x361af0,_0x44b345){var _0x541c13=new AWS[(_0xbef6('0x9'))]({'accessKeyId':_0x180182,'secretAccessKey':_0x356c82,'region':_0x4fff66});var _0x167c19={'Text':_0x18aeaa,'TextType':_0x361af0||_0xbef6('0xa'),'OutputFormat':'mp3','VoiceId':_0x34220a};return pollyResult(_0x541c13,_0x167c19,_0x44b345);}; \ No newline at end of file +var _0xea09=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','bluebird','randomstring','aws-sdk'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xea09,0x168));var _0x9ea0=function(_0x486591,_0x5e8791){_0x486591=_0x486591-0x0;var _0x1e7d6e=_0xea09[_0x486591];return _0x1e7d6e;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9ea0('0x0'));var rs=require(_0x9ea0('0x1'));var AWS=require(_0x9ea0('0x2'));function pollyResult(_0x3d1041,_0x670309,_0xb95dc){return new BPromise(function(_0x3ad000,_0x1e4138){_0x3d1041[_0x9ea0('0x3')](_0x670309,function(_0x2f5150,_0x1f7770){if(_0x2f5150){_0x1e4138(_0x2f5150);}else if(_0x1f7770){if(_0x1f7770[_0x9ea0('0x4')]instanceof Buffer){fs[_0x9ea0('0x5')](_0xb95dc,_0x1f7770[_0x9ea0('0x4')],function(_0x3ca9d9){if(_0x3ca9d9){_0x1e4138(_0x3ca9d9);}else{_0x3ad000();}});}else{_0x1e4138(new Error(_0x9ea0('0x6')));}}else{_0x1e4138(new Error(_0x9ea0('0x7')));}});});}module[_0x9ea0('0x8')]=function(_0x1d294d,_0x3504dc,_0x11ae16,_0x598f79,_0x133ae7,_0x35d560,_0xbb2cc1){var _0x4108df=new AWS[(_0x9ea0('0x9'))]({'accessKeyId':_0x1d294d,'secretAccessKey':_0x3504dc,'region':_0x11ae16});var _0x9302a3={'Text':_0x133ae7,'TextType':_0x35d560||_0x9ea0('0xa'),'OutputFormat':'mp3','VoiceId':_0x598f79};return pollyResult(_0x4108df,_0x9302a3,_0xbb2cc1);}; \ 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 582d446..1c09b0d 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 _0x855f=['./lib/api'];(function(_0x2f7f9b,_0x1ad489){var _0x2de4d7=function(_0x31d5fc){while(--_0x31d5fc){_0x2f7f9b['push'](_0x2f7f9b['shift']());}};_0x2de4d7(++_0x1ad489);}(_0x855f,0x17b));var _0xf855=function(_0x4dbaba,_0x4d96fa){_0x4dbaba=_0x4dbaba-0x0;var _0x4a7836=_0x855f[_0x4dbaba];return _0x4a7836;};'use strict';var asr=require(_0xf855('0x0'));module['exports']=function(_0x318883,_0xb0346e,_0xa99450,_0x3450ed){return asr(_0x318883,_0xb0346e,_0xa99450);}; \ No newline at end of file +var _0x196e=['exports','./lib/api'];(function(_0x530e0e,_0x54d536){var _0x2742fb=function(_0x248145){while(--_0x248145){_0x530e0e['push'](_0x530e0e['shift']());}};_0x2742fb(++_0x54d536);}(_0x196e,0x1d7));var _0xe196=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0x196e[_0x211bc3];return _0x34c9a2;};'use strict';var asr=require(_0xe196('0x0'));module[_0xe196('0x1')]=function(_0x29f12c,_0x1f9613,_0x17f6ec,_0x32d4b5){return asr(_0x29f12c,_0x1f9613,_0x17f6ec);}; \ 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 168560c..533dc6b 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 _0x7a4d=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x530c55,_0x457b25){var _0x27c858=function(_0x2c69b5){while(--_0x2c69b5){_0x530c55['push'](_0x530c55['shift']());}};_0x27c858(++_0x457b25);}(_0x7a4d,0x183));var _0xd7a4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7a4d[_0x465a0c];return _0x1e202e;};'use strict';var url=require('url');var BPromise=require(_0xd7a4('0x0'));var fs=require('fs');var host=_0xd7a4('0x1');module[_0xd7a4('0x2')]=function(_0x4c325d,_0x2c596a,_0x3ec3ba){return new BPromise(function(_0x2fad7e,_0x268399){var _0x3dbe80;if(typeof _0x4c325d!==_0xd7a4('0x3')||_0x4c325d[_0xd7a4('0x4')]===0x0){return _0x268399(_0xd7a4('0x5'));}if(typeof _0x2c596a!==_0xd7a4('0x3')||_0x2c596a[_0xd7a4('0x4')]===0x0){return _0x268399(_0xd7a4('0x6'));}if(typeof _0x3ec3ba!=='undefined'&&(typeof _0x3ec3ba!==_0xd7a4('0x3')||_0x3ec3ba['length']===0x0)){return _0x268399(_0xd7a4('0x7'));}try{_0x3dbe80=fs['readFileSync'](_0x4c325d)[_0xd7a4('0x8')](_0xd7a4('0x9'));}catch(_0x3eaaa9){return _0x268399(_0x3eaaa9);}return _0x2fad7e({'method':_0xd7a4('0xa'),'uri':host+_0xd7a4('0xb')+_0x2c596a,'body':{'config':{'encoding':_0xd7a4('0xc'),'sampleRateHertz':_0xd7a4('0xd'),'languageCode':_0x3ec3ba},'audio':{'content':_0x3dbe80}},'json':!![]});});}; \ No newline at end of file +var _0xd340=['bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','url'];(function(_0x11438b,_0x42f8fd){var _0x5576a2=function(_0x1f1e00){while(--_0x1f1e00){_0x11438b['push'](_0x11438b['shift']());}};_0x5576a2(++_0x42f8fd);}(_0xd340,0x16b));var _0x0d34=function(_0x25235b,_0x4124a8){_0x25235b=_0x25235b-0x0;var _0x1d7c7e=_0xd340[_0x25235b];return _0x1d7c7e;};'use strict';var url=require(_0x0d34('0x0'));var BPromise=require(_0x0d34('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x0d34('0x2')]=function(_0x4aabbc,_0x290394,_0x385105){return new BPromise(function(_0x1224ef,_0x27b361){var _0xb361dc;if(typeof _0x4aabbc!==_0x0d34('0x3')||_0x4aabbc[_0x0d34('0x4')]===0x0){return _0x27b361(_0x0d34('0x5'));}if(typeof _0x290394!=='string'||_0x290394['length']===0x0){return _0x27b361(_0x0d34('0x6'));}if(typeof _0x385105!==_0x0d34('0x7')&&(typeof _0x385105!==_0x0d34('0x3')||_0x385105[_0x0d34('0x4')]===0x0)){return _0x27b361(_0x0d34('0x8'));}try{_0xb361dc=fs[_0x0d34('0x9')](_0x4aabbc)[_0x0d34('0xa')](_0x0d34('0xb'));}catch(_0x532132){return _0x27b361(_0x532132);}return _0x1224ef({'method':_0x0d34('0xc'),'uri':host+_0x0d34('0xd')+_0x290394,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x385105},'audio':{'content':_0xb361dc}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 9e27ad7..d94288e 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 _0x1d7a=['./google','./sestek','../../../config/logger','agi','protocol','https:','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','close','unlink','download\x20error','pipe','host','path','data','end','transcode','wav','error\x20convert','start','resolve','writeFileSync','chmodSync','777','readFileSync','base64','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','POST','then','tmp','generate','from','writeFile','.wav','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','source','result','action','actionIncomplete','fulfillment','speech','status','code','endConversation','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','util'];(function(_0xaabea0,_0x5f4ac7){var _0x4f366d=function(_0x47a9fc){while(--_0x47a9fc){_0xaabea0['push'](_0xaabea0['shift']());}};_0x4f366d(++_0x5f4ac7);}(_0x1d7a,0x187));var _0xa1d7=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x1d7a[_0x1ebeea];return _0x576465;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xa1d7('0x0'));var dialogflow=require(_0xa1d7('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xa1d7('0x2'));var md5=require(_0xa1d7('0x3'));var path=require('path');var querystring=require(_0xa1d7('0x4'));var rp=require(_0xa1d7('0x5'));var rs=require(_0xa1d7('0x6'));var sox=require(_0xa1d7('0x7'));var tts=require(_0xa1d7('0x8'));var urlParse=require(_0xa1d7('0x9'))['parse'];var util=require(_0xa1d7('0xa'));var aws=require('./aws');var google=require(_0xa1d7('0xb'));var sestek=require(_0xa1d7('0xc'));var tilde=require('./tilde');var logger=require(_0xa1d7('0xd'))(_0xa1d7('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x2c65ce,_0x117d32){return new BPromise(function(_0x264ec2,_0x130e6a){var _0x432212=urlParse(_0x2c65ce);var _0xee9add=_0x432212[_0xa1d7('0xf')]===_0xa1d7('0x10')?https:http;var _0x159161={'host':_0x432212['host'],'path':_0x432212['path'],'headers':{'user-agent':_0xa1d7('0x11')}};_0xee9add[_0xa1d7('0x12')](_0x159161,function(_0xecefbc){if(_0xecefbc['statusCode']!==0xc8){logger[_0xa1d7('0x13')](_0xa1d7('0x14')+_0x2c65ce+_0xa1d7('0x15')+_0xecefbc[_0xa1d7('0x16')]+'\x20('+_0xecefbc[_0xa1d7('0x17')]+')');_0x130e6a(new Error(_0xa1d7('0x14')+_0x2c65ce+'\x20failed,\x20status\x20code\x20=\x20'+_0xecefbc[_0xa1d7('0x16')]+'\x20('+_0xecefbc['statusMessage']+')'));return;}var _0x2a38f1=fs[_0xa1d7('0x18')](_0x117d32);_0x2a38f1['on']('finish',function(){logger[_0xa1d7('0x19')]('finish\x20download\x20file');_0x2a38f1[_0xa1d7('0x1a')](_0x264ec2);});_0x2a38f1['on'](_0xa1d7('0x13'),function(_0x77bdd2){fs[_0xa1d7('0x1b')](_0x117d32);logger[_0xa1d7('0x13')](_0xa1d7('0x1c'),_0x77bdd2);_0x130e6a(_0x77bdd2);});_0xecefbc[_0xa1d7('0x1d')](_0x2a38f1);})['on']('error',function(_0x580945){logger[_0xa1d7('0x13')](_0x580945);_0x130e6a(_0x580945);})['end']();});}function uploadFile(_0x47fc0c){return new BPromise(function(_0x5d9a75,_0x4eceff){var _0x233b3a=urlParse(_0x47fc0c);var _0x35ff90=_0x233b3a['protocol']===_0xa1d7('0x10')?https:http;var _0x8f7c7c={'host':_0x233b3a[_0xa1d7('0x1e')],'path':_0x233b3a[_0xa1d7('0x1f')],'headers':{'user-agent':'WHAT_EVER'}};_0x35ff90[_0xa1d7('0x12')](_0x8f7c7c,function(_0x20d794){if(_0x20d794[_0xa1d7('0x16')]!==0xc8){_0x4eceff(new Error(_0xa1d7('0x14')+_0x47fc0c+_0xa1d7('0x15')+_0x20d794[_0xa1d7('0x16')]+'\x20('+_0x20d794[_0xa1d7('0x17')]+')'));return;}var _0x31a48d='';_0x20d794['on'](_0xa1d7('0x20'),function(_0x221a5f){_0x31a48d+=_0x221a5f;});_0x20d794['on'](_0xa1d7('0x21'),function(){_0x5d9a75(_0x31a48d);});})['on'](_0xa1d7('0x13'),function(_0xfda49){_0x4eceff(_0xfda49);})[_0xa1d7('0x21')]();});}function convertFile(_0x265b70,_0x362b4d){return new BPromise(function(_0x3d1084,_0x8e47a5){var _0x2b90c4=sox[_0xa1d7('0x22')](_0x265b70,_0x362b4d,{'sampleRate':0x1f40,'format':_0xa1d7('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2b90c4['on'](_0xa1d7('0x13'),function(_0x10857e){logger[_0xa1d7('0x13')](_0xa1d7('0x24'),_0x10857e);_0x8e47a5(_0x10857e);});_0x2b90c4['on'](_0xa1d7('0x21'),function(){logger[_0xa1d7('0x19')]('finish\x20to\x20convert');_0x3d1084();});_0x2b90c4[_0xa1d7('0x25')]();});}function base64Decode(_0x107db4,_0x3ed6fb){var _0x275946=path[_0xa1d7('0x26')](__dirname,'tmp',rs['generate'](0x4)+'.wav');fs[_0xa1d7('0x27')](_0x275946,_0x107db4,'base64');return convertFile(_0x275946,_0x3ed6fb)['then'](function(){try{fs['unlink'](_0x275946);fs[_0xa1d7('0x28')](_0x3ed6fb,_0xa1d7('0x29'));}catch(_0x518405){logger[_0xa1d7('0x13')](_0x518405);}return _0x3ed6fb['split']('.')[0x0];});}function base64Encode(_0xda49e){var _0x44c15e=fs[_0xa1d7('0x2a')](_0xda49e);return new Buffer(_0x44c15e)['toString'](_0xa1d7('0x2b'));}exports['googleCloudTTS']=function(_0x5ccc61,_0x5e2df8,_0x251309,_0x62f06e,_0x53185a,_0x1b7235){var _0x589b91,_0xaa649f;var _0x95da4d=_0xa1d7('0x2c');var _0x5acb3c='?key='+_0x5ccc61;var _0x447858={};if(_0x5e2df8===_0xa1d7('0x2d')){_0x447858[_0xa1d7('0x2e')]={'ssml':_0x251309};}else{_0x447858[_0xa1d7('0x2e')]={'text':_0x251309};};_0x447858['voice']={'languageCode':_0x62f06e,'ssmlGender':_0x53185a};_0x447858[_0xa1d7('0x2f')]={'audioEncoding':_0xa1d7('0x30'),'sampleRateHertz':0x1f40};var _0x2c6121={'url':_0x95da4d+_0xa1d7('0x31')+_0x5acb3c,'method':_0xa1d7('0x32'),'json':!![],'body':_0x447858};return rp(_0x2c6121)[_0xa1d7('0x33')](function(_0x3f90bd){return new BPromise(function(_0x328438,_0x31decd){_0x589b91=path[_0xa1d7('0x26')](__dirname,_0xa1d7('0x34'),rs[_0xa1d7('0x35')](0x4)+'.mp3');var _0x181f4b=Buffer[_0xa1d7('0x36')](_0x3f90bd['audioContent'],_0xa1d7('0x2b'));return fs[_0xa1d7('0x37')](_0x589b91,_0x181f4b,function(_0x155b62){_0x31decd(_0x155b62);},function(_0x304a66){fs[_0xa1d7('0x28')](_0x589b91,_0xa1d7('0x29'));_0x328438(_0x304a66);});});})[_0xa1d7('0x33')](function(_0x567860){_0xaa649f=path['resolve'](__dirname,_0xa1d7('0x34'),rs[_0xa1d7('0x35')](0x4)+_0xa1d7('0x38'));return convertFile(_0x589b91,_0xaa649f);})['then'](function(){try{fs[_0xa1d7('0x1b')](_0x589b91);fs[_0xa1d7('0x28')](_0xaa649f,_0xa1d7('0x29'));}catch(_0x2025a5){logger[_0xa1d7('0x13')](_0x2025a5);}logger['info']('googleCloudTTS\x20path',_0xaa649f[_0xa1d7('0x39')]('.')[0x0]);return _0xaa649f[_0xa1d7('0x39')]('.')[0x0];});};exports['googleTTS']=function(_0x3555be,_0x4e1a72){var _0x50d62a=_0xa1d7('0x3a');var _0x57eddf,_0x19af9b;var _0x3bde36;var _0x4f2266={'encoding':'utf8','method':_0xa1d7('0x32'),'timeout':0x2710,'url':_0x50d62a,'headers':{'Content-Type':_0xa1d7('0x3b')},'body':_0xa1d7('0x3c')+encodeURIComponent(JSON[_0xa1d7('0x3d')]([[['jQ1olc',JSON[_0xa1d7('0x3d')]([_0x3555be,_0x4e1a72||'en',![],'null']),null,_0xa1d7('0x3e')]]]))};return rp(_0x4f2266)[_0xa1d7('0x33')](function(_0x5c7088){try{_0x3bde36=eval(_0x5c7088[_0xa1d7('0x3f')](0x5))[0x0][0x2];}catch(_0x32688f){throw new Error(_0xa1d7('0x40')+_0x5c7088[_0xa1d7('0x20')]);}if(!_0x3bde36){if(_0x3555be[_0xa1d7('0x41')]>0xc8){throw new Error(_0xa1d7('0x42'));}else{throw new Error(_0xa1d7('0x43')+_0x4e1a72+_0xa1d7('0x44'));}}try{_0x3bde36=eval(_0x3bde36)[0x0];}catch(_0x1a5cb8){throw new Error(_0xa1d7('0x40')+res[_0xa1d7('0x20')]);}const _0x470a61=_0x3bde36;_0x57eddf=path[_0xa1d7('0x26')](__dirname,_0xa1d7('0x34'),rs[_0xa1d7('0x35')](0x4)+_0xa1d7('0x45'));fs[_0xa1d7('0x27')](_0x57eddf,_0x3bde36,{'encoding':_0xa1d7('0x2b')});_0x19af9b=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x57eddf,_0x19af9b);})[_0xa1d7('0x33')](function(){try{fs[_0xa1d7('0x1b')](_0x57eddf);fs[_0xa1d7('0x28')](_0x19af9b,_0xa1d7('0x29'));}catch(_0x3f807f){logger[_0xa1d7('0x13')](_0x3f807f);}logger[_0xa1d7('0x19')](_0xa1d7('0x46'),_0x19af9b[_0xa1d7('0x39')]('.')[0x0]);return _0x19af9b['split']('.')[0x0];});};exports[_0xa1d7('0x47')]=function(_0x42ba79,_0x44ab3f,_0x167bea){return google[_0xa1d7('0x48')](_0x42ba79,_0x44ab3f,_0x167bea)[_0xa1d7('0x33')](function(_0x4649b6){logger['info'](_0x4649b6[_0xa1d7('0x49')]);return rp(_0x4649b6);})[_0xa1d7('0x33')](function(_0x234b98){var _0x56be20='';var _0x832123=0x0;try{fs[_0xa1d7('0x1b')](_0x42ba79);}catch(_0x3da67a){logger[_0xa1d7('0x13')](_0x3da67a);}if(_0x234b98&&_0x234b98[_0xa1d7('0x4a')]){_0x56be20=_0x234b98[_0xa1d7('0x4a')]['map'](function(_0x2006b9){return _0x2006b9&&_0x2006b9[_0xa1d7('0x4b')][0x0]&&_0x2006b9['alternatives'][0x0][_0xa1d7('0x4c')]?_0x2006b9[_0xa1d7('0x4b')][0x0][_0xa1d7('0x4c')]:'';})['join']('\x0a');_0x832123=_0x234b98[_0xa1d7('0x4a')][_0xa1d7('0x4d')](function(_0x2fb603){return _0x2fb603&&_0x2fb603[_0xa1d7('0x4b')][0x0]&&_0x2fb603[_0xa1d7('0x4b')][0x0][_0xa1d7('0x4e')]?_0x2fb603[_0xa1d7('0x4b')][0x0][_0xa1d7('0x4e')]:0x0;})['join']('\x0a');}logger['info'](_0xa1d7('0x4f'),_0x56be20);logger[_0xa1d7('0x19')](_0xa1d7('0x50'),_0x832123);return{'transcript':_0x56be20,'confidence':_0x832123};})[_0xa1d7('0x51')](function(_0x1f03bd){logger[_0xa1d7('0x13')](_0xa1d7('0x52'),_0x1f03bd[_0xa1d7('0x16')],_0x1f03bd[_0xa1d7('0x53')],_0x1f03bd[_0xa1d7('0x54')]);});};exports['googleDialogflow']=function(_0xe4ca45,_0x349ad9,_0x43d1e3,_0x54d68e){var _0x4ddcc1=apiai(_0x349ad9,{'language':_0x54d68e||'en'});return _0x4ddcc1[_0xa1d7('0x55')](_0x43d1e3,{'sessionId':md5(_0xe4ca45)})[_0xa1d7('0x33')](function(_0x2edfac){logger[_0xa1d7('0x19')](JSON[_0xa1d7('0x3d')](_0x2edfac));return{'source':_0x2edfac['result'][_0xa1d7('0x56')],'resolvedQuery':_0x2edfac['result']['resolvedQuery'],'action':_0x2edfac[_0xa1d7('0x57')][_0xa1d7('0x58')],'actionIncomplete':_0x2edfac[_0xa1d7('0x57')][_0xa1d7('0x59')],'speech':_0x2edfac[_0xa1d7('0x57')][_0xa1d7('0x5a')][_0xa1d7('0x5b')],'score':_0x2edfac[_0xa1d7('0x57')]['score'],'statusCode':_0x2edfac[_0xa1d7('0x5c')][_0xa1d7('0x5d')],'endConversation':_0x2edfac[_0xa1d7('0x57')]['metadata'][_0xa1d7('0x5e')]||![],'isFallbackIntent':_0x2edfac[_0xa1d7('0x57')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x497240,_0xf85135,_0x5aa977,_0x1a9c4a,_0x4863a1,_0x9c9e51){var _0x2261ff=_0x1a9c4a[_0xa1d7('0x5f')](/\\n/g,'\x0a');var _0x5d7f40={'credentials':{'private_key':_0x2261ff,'client_email':_0x5aa977}};var _0x30b51f=new dialogflow[(_0xa1d7('0x60'))](_0x5d7f40);var _0x3d69d9=_0x30b51f['sessionPath'](_0xf85135,md5(_0x497240));var _0x49954f={'session':_0x3d69d9,'queryInput':{'text':{'text':_0x4863a1,'languageCode':_0x9c9e51}}};return _0x30b51f[_0xa1d7('0x61')](_0x49954f)[_0xa1d7('0x33')](function(_0x2d1fac){if(_0x2d1fac&&_0x2d1fac[_0xa1d7('0x41')]){logger[_0xa1d7('0x19')](_0xa1d7('0x62'),JSON[_0xa1d7('0x3d')](_0x2d1fac));var _0x4934a5=_0x2d1fac[0x0];if(_0x4934a5){var _0xbf72c0={'action':_0x4934a5['queryResult']['action'],'allRequiredParamsPresent':_0x4934a5['queryResult'][_0xa1d7('0x63')],'endConversation':_0x4934a5['queryResult']['diagnosticInfo']&&_0x4934a5['queryResult'][_0xa1d7('0x64')]['fields']?_0x4934a5[_0xa1d7('0x65')][_0xa1d7('0x64')][_0xa1d7('0x66')][_0xa1d7('0x67')][_0xa1d7('0x68')]:![],'fulfillmentText':_0x4934a5[_0xa1d7('0x65')][_0xa1d7('0x69')],'intentName':_0x4934a5[_0xa1d7('0x65')][_0xa1d7('0x6a')]['name'],'intentDisplayName':_0x4934a5['queryResult'][_0xa1d7('0x6a')][_0xa1d7('0x6b')],'isFallbackIntent':_0x4934a5[_0xa1d7('0x65')][_0xa1d7('0x6a')][_0xa1d7('0x6c')],'languageCode':_0x4934a5[_0xa1d7('0x65')][_0xa1d7('0x6d')],'queryText':_0x4934a5['queryResult'][_0xa1d7('0x6e')],'responseId':_0x4934a5['responseId'],'score':_0x4934a5[_0xa1d7('0x65')][_0xa1d7('0x6f')],'speech':_0x4934a5[_0xa1d7('0x65')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x2d1fac)};return _0xbf72c0;}}});};exports[_0xa1d7('0x70')]=function(_0xde622a,_0x50fcf2,_0x37826e,_0x9e9e19){return tilde[_0xa1d7('0x48')](_0xde622a,_0x50fcf2,_0x37826e,_0x9e9e19)[_0xa1d7('0x33')](function(_0x27595b){try{fs[_0xa1d7('0x1b')](_0xde622a);}catch(_0x57338f){logger[_0xa1d7('0x13')](_0x57338f);}logger[_0xa1d7('0x19')](_0xa1d7('0x71'),_0x27595b['transcript']);logger[_0xa1d7('0x19')](_0xa1d7('0x72'),_0x27595b[_0xa1d7('0x4e')]);return _0x27595b;});};exports[_0xa1d7('0x73')]=function(_0x17f785,_0x291c61,_0x221144,_0x58099f,_0x41695d,_0x597a5f){var _0x29f51b=path[_0xa1d7('0x26')](__dirname,_0xa1d7('0x34'),rs['generate'](0x4)+_0xa1d7('0x45'));var _0x435f75;return aws[_0xa1d7('0x74')](_0x17f785,_0x291c61,_0x221144,_0x58099f,_0x41695d,_0x597a5f,_0x29f51b)[_0xa1d7('0x33')](function(){_0x435f75=path[_0xa1d7('0x26')](__dirname,_0xa1d7('0x34'),rs[_0xa1d7('0x35')](0x4)+'.wav');return convertFile(_0x29f51b,_0x435f75);})['then'](function(){try{fs[_0xa1d7('0x1b')](_0x29f51b);fs[_0xa1d7('0x28')](_0x435f75,_0xa1d7('0x29'));}catch(_0x1799bb){logger['error'](_0x1799bb);}return _0x435f75[_0xa1d7('0x39')]('.')[0x0];});};exports[_0xa1d7('0x75')]=function(_0x12d2d0,_0x14b5a9,_0x4534b7,_0x41b492,_0x584baa,_0x4a2163){return aws['lex'](_0x12d2d0,_0x14b5a9,_0x4534b7,_0x41b492,_0x584baa,_0x4a2163)[_0xa1d7('0x33')](function(_0x34034e){logger[_0xa1d7('0x19')](JSON[_0xa1d7('0x3d')](_0x34034e));return _0x34034e;});};exports[_0xa1d7('0x76')]=function(_0x47c12a,_0x26236d,_0x157d60,_0x24d0dd){var _0x546ed9=util[_0xa1d7('0x77')](_0xa1d7('0x78'),ISPEECH_API,_0x47c12a,encodeURIComponent(_0x26236d),_0x157d60,_0x24d0dd);var _0x3fece9=path['resolve'](__dirname,_0xa1d7('0x34'),rs[_0xa1d7('0x35')](0x4)+_0xa1d7('0x45'));var _0x279ecf;return downloadFile(_0x546ed9,_0x3fece9)['then'](function(){_0x279ecf=path[_0xa1d7('0x26')](__dirname,_0xa1d7('0x34'),rs[_0xa1d7('0x35')](0x4)+_0xa1d7('0x38'));return convertFile(_0x3fece9,_0x279ecf);})[_0xa1d7('0x33')](function(){try{fs[_0xa1d7('0x1b')](_0x3fece9);fs[_0xa1d7('0x28')](_0x279ecf,_0xa1d7('0x29'));}catch(_0x5dedaf){logger[_0xa1d7('0x13')](_0x5dedaf);}return _0x279ecf[_0xa1d7('0x39')]('.')[0x0];});};exports[_0xa1d7('0x79')]=function(_0x51d682,_0x1d8b32,_0x13df23,_0x33c793){var _0x51911d=util[_0xa1d7('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1d8b32,_0x13df23,base64Encode(_0x51d682),_0x33c793?util[_0xa1d7('0x77')](_0xa1d7('0x7a'),encodeURIComponent(_0x33c793)):_0xa1d7('0x7b'));return uploadFile(_0x51911d)[_0xa1d7('0x33')](function(_0x58b427){return querystring[_0xa1d7('0x7c')](_0x58b427);});};exports[_0xa1d7('0x7d')]=function(_0x3be21f,_0x16cb68){return sestek[_0xa1d7('0x7e')](_0x3be21f,_0x16cb68)[_0xa1d7('0x33')](function(_0xe2f185){logger[_0xa1d7('0x19')](JSON['stringify'](_0xe2f185));var _0x3edc42={'speech':_0xe2f185[_0xa1d7('0x7f')],'action':_0xe2f185[_0xa1d7('0x80')]?_0xe2f185[_0xa1d7('0x80')]['CustomAction']:undefined,'actiondata':_0xe2f185[_0xa1d7('0x80')]?_0xe2f185[_0xa1d7('0x80')][_0xa1d7('0x81')]:undefined};if(_0xe2f185[_0xa1d7('0x80')]&&_0xe2f185[_0xa1d7('0x80')][_0xa1d7('0x82')]){return base64Decode(_0xe2f185['channelData'][_0xa1d7('0x82')][_0xa1d7('0x83')],path[_0xa1d7('0x26')](__dirname,'tmp',rs[_0xa1d7('0x35')](0x4)+_0xa1d7('0x38')))[_0xa1d7('0x33')](function(_0x45fb6e){_0x3edc42[_0xa1d7('0x84')]=_0x45fb6e;return _0x3edc42;});}return _0x3edc42;});};exports[_0xa1d7('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0xa596=['https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','POST','resolve','tmp','.mp3','audioContent','writeFile','chmodSync','generate','googleTTS','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','replace','detectIntent','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','http','md5','path','querystring','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','protocol','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS'];(function(_0x55fe62,_0x53aa2f){var _0x4c74da=function(_0x177196){while(--_0x177196){_0x55fe62['push'](_0x55fe62['shift']());}};_0x4c74da(++_0x53aa2f);}(_0xa596,0x1e0));var _0x6a59=function(_0x5aadb0,_0x4331ec){_0x5aadb0=_0x5aadb0-0x0;var _0x21859b=_0xa596[_0x5aadb0];return _0x21859b;};'use strict';var apiai=require(_0x6a59('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x6a59('0x1'));var https=require('https');var md5=require(_0x6a59('0x2'));var path=require(_0x6a59('0x3'));var querystring=require(_0x6a59('0x4'));var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require(_0x6a59('0x5'));var urlParse=require(_0x6a59('0x6'))[_0x6a59('0x7')];var util=require(_0x6a59('0x8'));var aws=require(_0x6a59('0x9'));var google=require(_0x6a59('0xa'));var sestek=require(_0x6a59('0xb'));var tilde=require('./tilde');var logger=require(_0x6a59('0xc'))(_0x6a59('0xd'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x32392b,_0x12295d){return new BPromise(function(_0x6cce65,_0x48bcf1){var _0x42f061=urlParse(_0x32392b);var _0x2073d2=_0x42f061[_0x6a59('0xe')]==='https:'?https:http;var _0x4018a3={'host':_0x42f061['host'],'path':_0x42f061[_0x6a59('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x2073d2[_0x6a59('0xf')](_0x4018a3,function(_0xb0ee81){if(_0xb0ee81['statusCode']!==0xc8){logger[_0x6a59('0x10')](_0x6a59('0x11')+_0x32392b+'\x20failed,\x20status\x20code\x20=\x20'+_0xb0ee81[_0x6a59('0x12')]+'\x20('+_0xb0ee81[_0x6a59('0x13')]+')');_0x48bcf1(new Error(_0x6a59('0x11')+_0x32392b+_0x6a59('0x14')+_0xb0ee81[_0x6a59('0x12')]+'\x20('+_0xb0ee81[_0x6a59('0x13')]+')'));return;}var _0x1d343a=fs[_0x6a59('0x15')](_0x12295d);_0x1d343a['on'](_0x6a59('0x16'),function(){logger[_0x6a59('0x17')](_0x6a59('0x18'));_0x1d343a[_0x6a59('0x19')](_0x6cce65);});_0x1d343a['on'](_0x6a59('0x10'),function(_0x38f766){fs[_0x6a59('0x1a')](_0x12295d);logger[_0x6a59('0x10')]('download\x20error',_0x38f766);_0x48bcf1(_0x38f766);});_0xb0ee81[_0x6a59('0x1b')](_0x1d343a);})['on'](_0x6a59('0x10'),function(_0x194c61){logger['error'](_0x194c61);_0x48bcf1(_0x194c61);})[_0x6a59('0x1c')]();});}function uploadFile(_0x4a91ac){return new BPromise(function(_0xa245ed,_0x315956){var _0x41b45f=urlParse(_0x4a91ac);var _0x5cf7a4=_0x41b45f[_0x6a59('0xe')]===_0x6a59('0x1d')?https:http;var _0x3c1438={'host':_0x41b45f['host'],'path':_0x41b45f[_0x6a59('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x5cf7a4[_0x6a59('0xf')](_0x3c1438,function(_0x5e153c){if(_0x5e153c[_0x6a59('0x12')]!==0xc8){_0x315956(new Error('request\x20to\x20'+_0x4a91ac+'\x20failed,\x20status\x20code\x20=\x20'+_0x5e153c[_0x6a59('0x12')]+'\x20('+_0x5e153c[_0x6a59('0x13')]+')'));return;}var _0x2261ca='';_0x5e153c['on'](_0x6a59('0x1e'),function(_0x37af13){_0x2261ca+=_0x37af13;});_0x5e153c['on'](_0x6a59('0x1c'),function(){_0xa245ed(_0x2261ca);});})['on'](_0x6a59('0x10'),function(_0x39b586){_0x315956(_0x39b586);})[_0x6a59('0x1c')]();});}function convertFile(_0x159d30,_0x449c58){return new BPromise(function(_0x3eb63e,_0xab4ddd){var _0x4327d3=sox[_0x6a59('0x1f')](_0x159d30,_0x449c58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4327d3['on']('error',function(_0x21f443){logger[_0x6a59('0x10')](_0x6a59('0x20'),_0x21f443);_0xab4ddd(_0x21f443);});_0x4327d3['on'](_0x6a59('0x1c'),function(){logger[_0x6a59('0x17')](_0x6a59('0x21'));_0x3eb63e();});_0x4327d3[_0x6a59('0x22')]();});}function base64Decode(_0x264b94,_0x50d47e){var _0x447b20=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x6a59('0x23'));fs[_0x6a59('0x24')](_0x447b20,_0x264b94,_0x6a59('0x25'));return convertFile(_0x447b20,_0x50d47e)[_0x6a59('0x26')](function(){try{fs['unlink'](_0x447b20);fs['chmodSync'](_0x50d47e,_0x6a59('0x27'));}catch(_0x4e1320){logger[_0x6a59('0x10')](_0x4e1320);}return _0x50d47e[_0x6a59('0x28')]('.')[0x0];});}function base64Encode(_0x5f4aac){var _0x113838=fs[_0x6a59('0x29')](_0x5f4aac);return new Buffer(_0x113838)[_0x6a59('0x2a')](_0x6a59('0x25'));}exports[_0x6a59('0x2b')]=function(_0x46dd50,_0x3effca,_0xea5e9c,_0x4c1313,_0x4dc780,_0x13c94a){var _0x3dd604,_0x25669e;var _0x206952=_0x6a59('0x2c');var _0x4c5285=_0x6a59('0x2d')+_0x46dd50;var _0x4b3680={};if(_0x3effca==='ssml'){_0x4b3680[_0x6a59('0x2e')]={'ssml':_0xea5e9c};}else{_0x4b3680[_0x6a59('0x2e')]={'text':_0xea5e9c};};_0x4b3680[_0x6a59('0x2f')]={'languageCode':_0x4c1313,'ssmlGender':_0x4dc780};_0x4b3680[_0x6a59('0x30')]={'audioEncoding':_0x6a59('0x31'),'sampleRateHertz':0x1f40};var _0x34bc4f={'url':_0x206952+'text:synthesize'+_0x4c5285,'method':_0x6a59('0x32'),'json':!![],'body':_0x4b3680};return rp(_0x34bc4f)['then'](function(_0x9c2d6f){return new BPromise(function(_0xdb4696,_0x4bd5af){_0x3dd604=path[_0x6a59('0x33')](__dirname,_0x6a59('0x34'),rs['generate'](0x4)+_0x6a59('0x35'));var _0x36f93d=Buffer['from'](_0x9c2d6f[_0x6a59('0x36')],'base64');return fs[_0x6a59('0x37')](_0x3dd604,_0x36f93d,function(_0x172152){_0x4bd5af(_0x172152);},function(_0x3d8589){fs[_0x6a59('0x38')](_0x3dd604,'777');_0xdb4696(_0x3d8589);});});})[_0x6a59('0x26')](function(_0x124c4d){_0x25669e=path[_0x6a59('0x33')](__dirname,_0x6a59('0x34'),rs[_0x6a59('0x39')](0x4)+'.wav');return convertFile(_0x3dd604,_0x25669e);})['then'](function(){try{fs[_0x6a59('0x1a')](_0x3dd604);fs[_0x6a59('0x38')](_0x25669e,_0x6a59('0x27'));}catch(_0x49b85e){logger[_0x6a59('0x10')](_0x49b85e);}logger['info']('googleCloudTTS\x20path',_0x25669e[_0x6a59('0x28')]('.')[0x0]);return _0x25669e[_0x6a59('0x28')]('.')[0x0];});};exports[_0x6a59('0x3a')]=function(_0x19e39f,_0x135a17){var _0x80d546='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x531f09,_0x4ee9b7;var _0x16533f;var _0x1485be={'encoding':'utf8','method':_0x6a59('0x32'),'timeout':0x2710,'url':_0x80d546,'headers':{'Content-Type':_0x6a59('0x3b')},'body':'f.req='+encodeURIComponent(JSON[_0x6a59('0x3c')]([[[_0x6a59('0x3d'),JSON[_0x6a59('0x3c')]([_0x19e39f,_0x135a17||'en',![],_0x6a59('0x3e')]),null,_0x6a59('0x3f')]]]))};return rp(_0x1485be)['then'](function(_0x189126){try{_0x16533f=eval(_0x189126['slice'](0x5))[0x0][0x2];}catch(_0x3c67da){throw new Error(_0x6a59('0x40')+_0x189126[_0x6a59('0x1e')]);}if(!_0x16533f){if(_0x19e39f[_0x6a59('0x41')]>0xc8){throw new Error(_0x6a59('0x42'));}else{throw new Error('lang\x20\x22'+_0x135a17+_0x6a59('0x43'));}}try{_0x16533f=eval(_0x16533f)[0x0];}catch(_0x3f9059){throw new Error(_0x6a59('0x40')+res[_0x6a59('0x1e')]);}const _0x4d71e9=_0x16533f;_0x531f09=path[_0x6a59('0x33')](__dirname,'tmp',rs[_0x6a59('0x39')](0x4)+_0x6a59('0x35'));fs[_0x6a59('0x24')](_0x531f09,_0x16533f,{'encoding':_0x6a59('0x25')});_0x4ee9b7=path[_0x6a59('0x33')](__dirname,_0x6a59('0x34'),rs[_0x6a59('0x39')](0x4)+_0x6a59('0x23'));return convertFile(_0x531f09,_0x4ee9b7);})['then'](function(){try{fs[_0x6a59('0x1a')](_0x531f09);fs[_0x6a59('0x38')](_0x4ee9b7,'777');}catch(_0x1150b0){logger[_0x6a59('0x10')](_0x1150b0);}logger[_0x6a59('0x17')](_0x6a59('0x44'),_0x4ee9b7['split']('.')[0x0]);return _0x4ee9b7[_0x6a59('0x28')]('.')[0x0];});};exports[_0x6a59('0x45')]=function(_0xb397b2,_0x2ef5e2,_0x9ec12d){return google[_0x6a59('0x46')](_0xb397b2,_0x2ef5e2,_0x9ec12d)[_0x6a59('0x26')](function(_0x24ea0b){logger[_0x6a59('0x17')](_0x24ea0b[_0x6a59('0x47')]);return rp(_0x24ea0b);})['then'](function(_0x5ee62f){var _0x3760c5='';var _0x4a9fa3=0x0;try{fs[_0x6a59('0x1a')](_0xb397b2);}catch(_0x18326f){logger['error'](_0x18326f);}if(_0x5ee62f&&_0x5ee62f[_0x6a59('0x48')]){_0x3760c5=_0x5ee62f[_0x6a59('0x48')]['map'](function(_0x3a0742){return _0x3a0742&&_0x3a0742[_0x6a59('0x49')][0x0]&&_0x3a0742[_0x6a59('0x49')][0x0]['transcript']?_0x3a0742[_0x6a59('0x49')][0x0][_0x6a59('0x4a')]:'';})['join']('\x0a');_0x4a9fa3=_0x5ee62f['results'][_0x6a59('0x4b')](function(_0x4d2c2b){return _0x4d2c2b&&_0x4d2c2b[_0x6a59('0x49')][0x0]&&_0x4d2c2b[_0x6a59('0x49')][0x0]['confidence']?_0x4d2c2b[_0x6a59('0x49')][0x0][_0x6a59('0x4c')]:0x0;})[_0x6a59('0x4d')]('\x0a');}logger[_0x6a59('0x17')](_0x6a59('0x4e'),_0x3760c5);logger[_0x6a59('0x17')](_0x6a59('0x4f'),_0x4a9fa3);return{'transcript':_0x3760c5,'confidence':_0x4a9fa3};})[_0x6a59('0x50')](function(_0x3b906f){logger[_0x6a59('0x10')](_0x6a59('0x51'),_0x3b906f['statusCode'],_0x3b906f['name'],_0x3b906f['message']);});};exports[_0x6a59('0x52')]=function(_0x70dc1d,_0x148619,_0x20467c,_0x4620cf){var _0x1aa6df=apiai(_0x148619,{'language':_0x4620cf||'en'});return _0x1aa6df['textRequest'](_0x20467c,{'sessionId':md5(_0x70dc1d)})[_0x6a59('0x26')](function(_0x1ad03d){logger[_0x6a59('0x17')](JSON[_0x6a59('0x3c')](_0x1ad03d));return{'source':_0x1ad03d[_0x6a59('0x53')][_0x6a59('0x54')],'resolvedQuery':_0x1ad03d[_0x6a59('0x53')][_0x6a59('0x55')],'action':_0x1ad03d[_0x6a59('0x53')]['action'],'actionIncomplete':_0x1ad03d[_0x6a59('0x53')][_0x6a59('0x56')],'speech':_0x1ad03d[_0x6a59('0x53')][_0x6a59('0x57')][_0x6a59('0x58')],'score':_0x1ad03d['result']['score'],'statusCode':_0x1ad03d[_0x6a59('0x59')][_0x6a59('0x5a')],'endConversation':_0x1ad03d['result'][_0x6a59('0x5b')][_0x6a59('0x5c')]||![],'isFallbackIntent':_0x1ad03d[_0x6a59('0x53')]['metadata'][_0x6a59('0x5d')]};});};exports['googleDialogflowV2']=function(_0x16201a,_0x3c3a49,_0xfc3435,_0x5c4f51,_0x13f35f,_0x4dc64d){var _0x546453=_0x5c4f51[_0x6a59('0x5e')](/\\n/g,'\x0a');var _0x275913={'credentials':{'private_key':_0x546453,'client_email':_0xfc3435}};var _0x272d83=new dialogflow['SessionsClient'](_0x275913);var _0x4a5836=_0x272d83['sessionPath'](_0x3c3a49,md5(_0x16201a));var _0x53e483={'session':_0x4a5836,'queryInput':{'text':{'text':_0x13f35f,'languageCode':_0x4dc64d}}};return _0x272d83[_0x6a59('0x5f')](_0x53e483)[_0x6a59('0x26')](function(_0x57d94a){if(_0x57d94a&&_0x57d94a['length']){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x6a59('0x3c')](_0x57d94a));var _0x396432=_0x57d94a[0x0];if(_0x396432){var _0x5db123={'action':_0x396432[_0x6a59('0x60')][_0x6a59('0x61')],'allRequiredParamsPresent':_0x396432['queryResult'][_0x6a59('0x62')],'endConversation':_0x396432[_0x6a59('0x60')][_0x6a59('0x63')]&&_0x396432['queryResult'][_0x6a59('0x63')][_0x6a59('0x64')]?_0x396432[_0x6a59('0x60')]['diagnosticInfo'][_0x6a59('0x64')][_0x6a59('0x65')][_0x6a59('0x66')]:![],'fulfillmentText':_0x396432[_0x6a59('0x60')][_0x6a59('0x67')],'intentName':_0x396432['queryResult'][_0x6a59('0x68')][_0x6a59('0x69')],'intentDisplayName':_0x396432[_0x6a59('0x60')]['intent'][_0x6a59('0x6a')],'isFallbackIntent':_0x396432['queryResult'][_0x6a59('0x68')]['isFallback'],'languageCode':_0x396432[_0x6a59('0x60')]['languageCode'],'queryText':_0x396432[_0x6a59('0x60')][_0x6a59('0x6b')],'responseId':_0x396432[_0x6a59('0x6c')],'score':_0x396432[_0x6a59('0x60')][_0x6a59('0x6d')],'speech':_0x396432[_0x6a59('0x60')][_0x6a59('0x67')],'providerResponse':JSON['stringify'](_0x57d94a)};return _0x5db123;}}});};exports[_0x6a59('0x6e')]=function(_0x3d81b2,_0xd9b07d,_0xf69fab,_0x28264f){return tilde[_0x6a59('0x46')](_0x3d81b2,_0xd9b07d,_0xf69fab,_0x28264f)[_0x6a59('0x26')](function(_0x164c83){try{fs[_0x6a59('0x1a')](_0x3d81b2);}catch(_0x478087){logger[_0x6a59('0x10')](_0x478087);}logger[_0x6a59('0x17')]('Tilde\x20ASR\x20transcription',_0x164c83['transcript']);logger[_0x6a59('0x17')](_0x6a59('0x6f'),_0x164c83[_0x6a59('0x4c')]);return _0x164c83;});};exports[_0x6a59('0x70')]=function(_0x539638,_0x4ad974,_0x8111f9,_0x5aa796,_0x56f523,_0x2437ff){var _0x4ce4e8=path[_0x6a59('0x33')](__dirname,_0x6a59('0x34'),rs[_0x6a59('0x39')](0x4)+_0x6a59('0x35'));var _0x371471;return aws[_0x6a59('0x71')](_0x539638,_0x4ad974,_0x8111f9,_0x5aa796,_0x56f523,_0x2437ff,_0x4ce4e8)[_0x6a59('0x26')](function(){_0x371471=path[_0x6a59('0x33')](__dirname,_0x6a59('0x34'),rs[_0x6a59('0x39')](0x4)+_0x6a59('0x23'));return convertFile(_0x4ce4e8,_0x371471);})[_0x6a59('0x26')](function(){try{fs[_0x6a59('0x1a')](_0x4ce4e8);fs[_0x6a59('0x38')](_0x371471,_0x6a59('0x27'));}catch(_0x4319c2){logger['error'](_0x4319c2);}return _0x371471[_0x6a59('0x28')]('.')[0x0];});};exports[_0x6a59('0x72')]=function(_0x1187bb,_0x231f80,_0x4e3294,_0x5e95d9,_0x300a83,_0x2120d0){return aws[_0x6a59('0x73')](_0x1187bb,_0x231f80,_0x4e3294,_0x5e95d9,_0x300a83,_0x2120d0)[_0x6a59('0x26')](function(_0x44a5bb){logger[_0x6a59('0x17')](JSON[_0x6a59('0x3c')](_0x44a5bb));return _0x44a5bb;});};exports['ispeechTTS']=function(_0x5bb9d2,_0x2b5641,_0x8e8233,_0x3638d3){var _0x166cdc=util[_0x6a59('0x74')](_0x6a59('0x75'),ISPEECH_API,_0x5bb9d2,encodeURIComponent(_0x2b5641),_0x8e8233,_0x3638d3);var _0x569715=path[_0x6a59('0x33')](__dirname,_0x6a59('0x34'),rs['generate'](0x4)+_0x6a59('0x35'));var _0x287160;return downloadFile(_0x166cdc,_0x569715)['then'](function(){_0x287160=path['resolve'](__dirname,_0x6a59('0x34'),rs[_0x6a59('0x39')](0x4)+_0x6a59('0x23'));return convertFile(_0x569715,_0x287160);})[_0x6a59('0x26')](function(){try{fs['unlink'](_0x569715);fs[_0x6a59('0x38')](_0x287160,_0x6a59('0x27'));}catch(_0x2add21){logger[_0x6a59('0x10')](_0x2add21);}return _0x287160[_0x6a59('0x28')]('.')[0x0];});};exports[_0x6a59('0x76')]=function(_0x3c7adc,_0x178353,_0x33f466,_0x2dd3f2){var _0x46c888=util[_0x6a59('0x74')](_0x6a59('0x77'),ISPEECH_API,_0x178353,_0x33f466,base64Encode(_0x3c7adc),_0x2dd3f2?util['format'](_0x6a59('0x78'),encodeURIComponent(_0x2dd3f2)):'freeform=3');return uploadFile(_0x46c888)[_0x6a59('0x26')](function(_0x2cc2b7){return querystring[_0x6a59('0x7')](_0x2cc2b7);});};exports[_0x6a59('0x79')]=function(_0x560fff,_0x4174b7){return sestek[_0x6a59('0x7a')](_0x560fff,_0x4174b7)[_0x6a59('0x26')](function(_0x5c3420){logger[_0x6a59('0x17')](JSON['stringify'](_0x5c3420));var _0x54b61e={'speech':_0x5c3420[_0x6a59('0x7b')],'action':_0x5c3420[_0x6a59('0x7c')]?_0x5c3420[_0x6a59('0x7c')][_0x6a59('0x7d')]:undefined,'actiondata':_0x5c3420[_0x6a59('0x7c')]?_0x5c3420['channelData'][_0x6a59('0x7e')]:undefined};if(_0x5c3420['channelData']&&_0x5c3420['channelData'][_0x6a59('0x7f')]){return base64Decode(_0x5c3420['channelData'][_0x6a59('0x7f')][_0x6a59('0x80')],path[_0x6a59('0x33')](__dirname,_0x6a59('0x34'),rs[_0x6a59('0x39')](0x4)+'.wav'))[_0x6a59('0x26')](function(_0x262c65){_0x54b61e[_0x6a59('0x81')]=_0x262c65;return _0x54b61e;});}return _0x54b61e;});};exports[_0x6a59('0x82')]=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 5831553..3d94c7a 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 _0x80ad=['exports'];(function(_0x5721c4,_0x2ffbd4){var _0x597a5f=function(_0x2387a5){while(--_0x2387a5){_0x5721c4['push'](_0x5721c4['shift']());}};_0x597a5f(++_0x2ffbd4);}(_0x80ad,0x1ba));var _0xd80a=function(_0x5a69b5,_0x167340){_0x5a69b5=_0x5a69b5-0x0;var _0x33a7fe=_0x80ad[_0x5a69b5];return _0x33a7fe;};var nda=require('./nda');module[_0xd80a('0x0')]={'nda':nda}; \ No newline at end of file +var _0xf178=['./nda','exports'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xf178,0xa6));var _0x8f17=function(_0x1d774d,_0x28a381){_0x1d774d=_0x1d774d-0x0;var _0x41314f=_0xf178[_0x1d774d];return _0x41314f;};var nda=require(_0x8f17('0x0'));module[_0x8f17('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 63b66c2..3d8a516 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 _0xe8cc=['ndagenerate_audio','AudioOutputSettings','CustomAction','custom_action','custom_action_data','body','info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','channelData','ProjectName'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xe8cc,0x127));var _0xce8c=function(_0x1f8b88,_0x3a2e67){_0x1f8b88=_0x1f8b88-0x0;var _0x12416c=_0xe8cc[_0x1f8b88];return _0x12416c;};'use strict';var rp=require(_0xce8c('0x0'));var url=require(_0xce8c('0x1'));var logger=require(_0xce8c('0x2'))(_0xce8c('0x3'));module[_0xce8c('0x4')]=function(_0x1e616d,_0xb3038f){var _0x4e52ff={'method':_0xce8c('0x5'),'uri':url[_0xce8c('0x6')](_0xb3038f[_0xce8c('0x7')],_0xce8c('0x8')),'form':{'grant_type':_0xce8c('0x9'),'username':_0xb3038f[_0xce8c('0xa')],'password':_0xb3038f[_0xce8c('0x9')]},'json':!![]};return rp(_0x4e52ff)[_0xce8c('0xb')](function(_0x5cd157){var _0x469855={'method':_0xce8c('0x5'),'uri':url[_0xce8c('0x6')](_0xb3038f['ndassistant_url'],_0xce8c('0xc')),'body':{'type':_0xb3038f[_0xce8c('0xd')]||_0xce8c('0xe'),'channelId':'Nda','conversation':{'id':_0x1e616d[_0xce8c('0xf')]},'from':{'id':_0x1e616d['callerid'],'name':_0x1e616d[_0xce8c('0x10')]},'recipient':{'id':_0x1e616d[_0xce8c('0x11')],'name':_0x1e616d[_0xce8c('0x12')]},'text':_0xb3038f[_0xce8c('0x13')],'channelData':{}},'headers':{'Authorization':_0xce8c('0x14')+_0x5cd157[_0xce8c('0x15')]},'json':!![]};if(_0xb3038f[_0xce8c('0x16')]){_0x469855['body'][_0xce8c('0x17')][_0xce8c('0x18')]=_0xb3038f[_0xce8c('0x16')];}if(_0xb3038f[_0xce8c('0x19')]=='1'){_0x469855['body']['channelData'][_0xce8c('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0xb3038f['custom_action']){_0x469855['body'][_0xce8c('0x17')][_0xce8c('0x1b')]=_0xb3038f[_0xce8c('0x1c')];if(_0xb3038f[_0xce8c('0x1d')]){_0x469855[_0xce8c('0x1e')][_0xce8c('0x17')]['CustomActionData']=_0xb3038f[_0xce8c('0x1d')];}}logger[_0xce8c('0x1f')](JSON['stringify'](_0x469855));return rp(_0x469855);});}; \ No newline at end of file +var _0xb1ab=['Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','body','CustomAction','info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x58a1d2,_0x4bdb53){var _0x29a345=function(_0x4b9e99){while(--_0x4b9e99){_0x58a1d2['push'](_0x58a1d2['shift']());}};_0x29a345(++_0x4bdb53);}(_0xb1ab,0x1bf));var _0xbb1a=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xb1ab[_0x344a3f];return _0x264712;};'use strict';var rp=require(_0xbb1a('0x0'));var url=require(_0xbb1a('0x1'));var logger=require(_0xbb1a('0x2'))(_0xbb1a('0x3'));module[_0xbb1a('0x4')]=function(_0x24d7ea,_0x3c6f47){var _0x1c95e3={'method':_0xbb1a('0x5'),'uri':url[_0xbb1a('0x6')](_0x3c6f47[_0xbb1a('0x7')],_0xbb1a('0x8')),'form':{'grant_type':_0xbb1a('0x9'),'username':_0x3c6f47[_0xbb1a('0xa')],'password':_0x3c6f47[_0xbb1a('0x9')]},'json':!![]};return rp(_0x1c95e3)['then'](function(_0x57cbcb){var _0x2be4c2={'method':_0xbb1a('0x5'),'uri':url[_0xbb1a('0x6')](_0x3c6f47[_0xbb1a('0xb')],_0xbb1a('0xc')),'body':{'type':_0x3c6f47[_0xbb1a('0xd')]||_0xbb1a('0xe'),'channelId':_0xbb1a('0xf'),'conversation':{'id':_0x24d7ea[_0xbb1a('0x10')]},'from':{'id':_0x24d7ea[_0xbb1a('0x11')],'name':_0x24d7ea[_0xbb1a('0x12')]},'recipient':{'id':_0x24d7ea[_0xbb1a('0x13')],'name':_0x24d7ea[_0xbb1a('0x14')]},'text':_0x3c6f47[_0xbb1a('0x15')],'channelData':{}},'headers':{'Authorization':_0xbb1a('0x16')+_0x57cbcb[_0xbb1a('0x17')]},'json':!![]};if(_0x3c6f47[_0xbb1a('0x18')]){_0x2be4c2['body']['channelData'][_0xbb1a('0x19')]=_0x3c6f47[_0xbb1a('0x18')];}if(_0x3c6f47[_0xbb1a('0x1a')]=='1'){_0x2be4c2['body'][_0xbb1a('0x1b')][_0xbb1a('0x1c')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3c6f47[_0xbb1a('0x1d')]){_0x2be4c2[_0xbb1a('0x1e')][_0xbb1a('0x1b')][_0xbb1a('0x1f')]=_0x3c6f47['custom_action'];if(_0x3c6f47['custom_action_data']){_0x2be4c2['body'][_0xbb1a('0x1b')]['CustomActionData']=_0x3c6f47['custom_action_data'];}}logger[_0xbb1a('0x20')](JSON['stringify'](_0x2be4c2));return rp(_0x2be4c2);});}; \ 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 3121932..0066603 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 _0x568d=['exports','./lib/api'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x568d,0x191));var _0xd568=function(_0x212dad,_0xb862ef){_0x212dad=_0x212dad-0x0;var _0x4fea3f=_0x568d[_0x212dad];return _0x4fea3f;};'use strict';var asr=require(_0xd568('0x0'));module[_0xd568('0x1')]=function(_0x5baa39,_0x4eb7d6,_0x481179,_0x1c0b69){return asr(_0x5baa39,_0x4eb7d6,_0x481179,_0x1c0b69);}; \ No newline at end of file +var _0xd7d9=['./lib/api'];(function(_0x191745,_0x3e8db8){var _0x2aa568=function(_0x180aed){while(--_0x180aed){_0x191745['push'](_0x191745['shift']());}};_0x2aa568(++_0x3e8db8);}(_0xd7d9,0x137));var _0x9d7d=function(_0x3c8c38,_0x277bc6){_0x3c8c38=_0x3c8c38-0x0;var _0x1edcab=_0xd7d9[_0x3c8c38];return _0x1edcab;};'use strict';var asr=require(_0x9d7d('0x0'));module['exports']=function(_0x5e4b32,_0x1bfbc9,_0x2938d9,_0x4aa2af){return asr(_0x5e4b32,_0x1bfbc9,_0x2938d9,_0x4aa2af);}; \ 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 5abd507..efee770 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 _0xfa23=['message','bluebird','moment','crypto','../../../../../../config/logger','agi','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','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','EOS','Tilde\x20ASR\x20send\x20error','stringify','status','result','final','Tilde\x20ASR\x20hypoteses','likelihood','terminate','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.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open'];(function(_0x168698,_0x39e9ca){var _0x20ca66=function(_0x10c3a2){while(--_0x10c3a2){_0x168698['push'](_0x168698['shift']());}};_0x20ca66(++_0x39e9ca);}(_0xfa23,0x1d5));var _0x3fa2=function(_0x34c403,_0x341b70){_0x34c403=_0x34c403-0x0;var _0x5bf2b9=_0xfa23[_0x34c403];return _0x5bf2b9;};'use strict';var BPromise=require(_0x3fa2('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3fa2('0x1'));var crypto=require(_0x3fa2('0x2'));var logger=require(_0x3fa2('0x3'))(_0x3fa2('0x4'));module[_0x3fa2('0x5')]=function(_0xcdeadd,_0x2457b6,_0x586e64,_0xdba7bc){return new BPromise(function(_0x3c636b,_0x745841){logger[_0x3fa2('0x6')](_0x3fa2('0x7'),_0xdba7bc||_0x3fa2('0x8'));var _0x598a81=new WebSocket(_0xdba7bc||_0x3fa2('0x8'),{'perMessageDeflate':![]});var _0x273474='';var _0x5d648c='0';var _0x2f6591='1';var _0x5a2d6a=_0x3fa2('0x9');function _0x578519(_0x34cbf0){var _0x5ae21e=crypto[_0x3fa2('0xa')](_0x3fa2('0xb'));_0x5ae21e[_0x3fa2('0xc')](_0x34cbf0);return _0x5ae21e[_0x3fa2('0xd')](_0x3fa2('0xe'));}function _0x13b465(){try{logger[_0x3fa2('0x6')](_0x3fa2('0xf'));var _0x53b96d=moment()[_0x3fa2('0x10')]();var _0x4df352=_0x578519(_0x53b96d+_0x2457b6+_0x586e64);_0x598a81[_0x3fa2('0x11')](JSON['stringify']({'appID':_0x2457b6,'timestamp':_0x53b96d,'appKey':_0x4df352}));var _0x4ec33b=fs['createReadStream'](_0xcdeadd);_0x4ec33b['on']('data',function(_0x380651){_0x598a81[_0x3fa2('0x11')](_0x380651);});_0x4ec33b['on']('close',function(){_0x598a81[_0x3fa2('0x11')](_0x3fa2('0x12'));});}catch(_0x179abc){logger['error'](_0x3fa2('0x13'),JSON[_0x3fa2('0x14')](_0x179abc));_0x598a81['terminate']();}}function _0x19fc1d(_0x40f673){try{if(_0x40f673){var _0x2ccf76=JSON['parse'](_0x40f673);switch(_0x2ccf76[_0x3fa2('0x15')]){case 0x0:if(_0x2ccf76['result']){if(_0x2ccf76[_0x3fa2('0x16')][_0x3fa2('0x17')]){logger[_0x3fa2('0x6')](_0x3fa2('0x18'),JSON[_0x3fa2('0x14')](_0x2ccf76['result']['hypotheses']));_0x273474=_0x2ccf76[_0x3fa2('0x16')]['hypotheses'][0x0]['transcript'];_0x5d648c=_0x2ccf76[_0x3fa2('0x16')]['hypotheses'][0x0][_0x3fa2('0x19')];_0x2f6591='0';_0x5a2d6a='Success.';_0x598a81[_0x3fa2('0x1a')]();}}break;case 0x1:logger['info'](_0x3fa2('0x9'));_0x2f6591='1';_0x5a2d6a=_0x3fa2('0x9');break;case 0x2:logger[_0x3fa2('0x6')](_0x3fa2('0x1b'));_0x2f6591='2';_0x5a2d6a=_0x3fa2('0x1b');break;case 0x9:logger[_0x3fa2('0x6')](_0x3fa2('0x1c'));_0x2f6591='9';_0x5a2d6a='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x2f6591='10';_0x5a2d6a='Authentication\x20failed.';break;case 0xb:logger[_0x3fa2('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2f6591='11';_0x5a2d6a=_0x3fa2('0x1d');}}}catch(_0x3bbce0){logger[_0x3fa2('0x1e')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x3fa2('0x14')](_0x3bbce0));_0x598a81['terminate']();}}function _0x202b47(){logger['info'](_0x3fa2('0x1f'));_0x3c636b({'transcript':_0x273474,'confidence':_0x5d648c,'status':_0x2f6591,'status_message':_0x5a2d6a});}function _0x2f0bab(_0x4a3551){logger[_0x3fa2('0x1e')](_0x3fa2('0x20'));if(!_['isNil'](_0x4a3551)){logger[_0x3fa2('0x1e')](_[_0x3fa2('0x21')](_0x4a3551)?JSON[_0x3fa2('0x14')](_0x4a3551):_0x4a3551);}}_0x598a81['on'](_0x3fa2('0x22'),_0x13b465);_0x598a81['on'](_0x3fa2('0x23'),_0x19fc1d);_0x598a81['on']('close',_0x202b47);_0x598a81['on'](_0x3fa2('0x1e'),_0x2f0bab);});}; \ No newline at end of file +var _0x5aef=['data','close','Tilde\x20ASR\x20send\x20error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','agi','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','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream'];(function(_0x3f0ce9,_0x19b1ec){var _0x1ae5d9=function(_0x55b974){while(--_0x55b974){_0x3f0ce9['push'](_0x3f0ce9['shift']());}};_0x1ae5d9(++_0x19b1ec);}(_0x5aef,0xa9));var _0xf5ae=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0x5aef[_0x4232d8];return _0x324de2;};'use strict';var BPromise=require(_0xf5ae('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf5ae('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xf5ae('0x2'));module[_0xf5ae('0x3')]=function(_0x4f5ffd,_0xc9a2e2,_0x19d89c,_0x392bde){return new BPromise(function(_0x52759f,_0x1a8555){logger[_0xf5ae('0x4')](_0xf5ae('0x5'),_0x392bde||_0xf5ae('0x6'));var _0x440470=new WebSocket(_0x392bde||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1c0df1='';var _0x4e6e46='0';var _0x1f92d3='1';var _0x14b676=_0xf5ae('0x7');function _0x23bcb7(_0x2b3b23){var _0x3f2344=crypto['createHash'](_0xf5ae('0x8'));_0x3f2344[_0xf5ae('0x9')](_0x2b3b23);return _0x3f2344['digest'](_0xf5ae('0xa'));}function _0x43706e(){try{logger[_0xf5ae('0x4')](_0xf5ae('0xb'));var _0x1f8169=moment()[_0xf5ae('0xc')]();var _0x5d2b86=_0x23bcb7(_0x1f8169+_0xc9a2e2+_0x19d89c);_0x440470[_0xf5ae('0xd')](JSON[_0xf5ae('0xe')]({'appID':_0xc9a2e2,'timestamp':_0x1f8169,'appKey':_0x5d2b86}));var _0x1a8e87=fs[_0xf5ae('0xf')](_0x4f5ffd);_0x1a8e87['on'](_0xf5ae('0x10'),function(_0x453278){_0x440470[_0xf5ae('0xd')](_0x453278);});_0x1a8e87['on'](_0xf5ae('0x11'),function(){_0x440470[_0xf5ae('0xd')]('EOS');});}catch(_0x265e3c){logger['error'](_0xf5ae('0x12'),JSON[_0xf5ae('0xe')](_0x265e3c));_0x440470['terminate']();}}function _0x32ced0(_0x2b5423){try{if(_0x2b5423){var _0xfffae=JSON['parse'](_0x2b5423);switch(_0xfffae[_0xf5ae('0x13')]){case 0x0:if(_0xfffae[_0xf5ae('0x14')]){if(_0xfffae[_0xf5ae('0x14')][_0xf5ae('0x15')]){logger[_0xf5ae('0x4')](_0xf5ae('0x16'),JSON[_0xf5ae('0xe')](_0xfffae[_0xf5ae('0x14')][_0xf5ae('0x17')]));_0x1c0df1=_0xfffae['result'][_0xf5ae('0x17')][0x0]['transcript'];_0x4e6e46=_0xfffae[_0xf5ae('0x14')]['hypotheses'][0x0]['likelihood'];_0x1f92d3='0';_0x14b676=_0xf5ae('0x18');_0x440470[_0xf5ae('0x19')]();}}break;case 0x1:logger[_0xf5ae('0x4')](_0xf5ae('0x7'));_0x1f92d3='1';_0x14b676='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xf5ae('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1f92d3='2';_0x14b676=_0xf5ae('0x1a');break;case 0x9:logger['info'](_0xf5ae('0x1b'));_0x1f92d3='9';_0x14b676=_0xf5ae('0x1b');break;case 0xa:logger[_0xf5ae('0x4')](_0xf5ae('0x1c'));_0x1f92d3='10';_0x14b676=_0xf5ae('0x1c');break;case 0xb:logger[_0xf5ae('0x4')](_0xf5ae('0x1d'));_0x1f92d3='11';_0x14b676=_0xf5ae('0x1d');}}}catch(_0x2b78a0){logger[_0xf5ae('0x1e')](_0xf5ae('0x1f'),JSON[_0xf5ae('0xe')](_0x2b78a0));_0x440470[_0xf5ae('0x19')]();}}function _0x27c5cd(){logger[_0xf5ae('0x4')](_0xf5ae('0x20'));_0x52759f({'transcript':_0x1c0df1,'confidence':_0x4e6e46,'status':_0x1f92d3,'status_message':_0x14b676});}function _0x44f329(_0x6cb410){logger[_0xf5ae('0x1e')](_0xf5ae('0x21'));if(!_[_0xf5ae('0x22')](_0x6cb410)){logger[_0xf5ae('0x1e')](_['isObject'](_0x6cb410)?JSON['stringify'](_0x6cb410):_0x6cb410);}}_0x440470['on'](_0xf5ae('0x23'),_0x43706e);_0x440470['on'](_0xf5ae('0x24'),_0x32ced0);_0x440470['on']('close',_0x27c5cd);_0x440470['on'](_0xf5ae('0x1e'),_0x44f329);});}; \ 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 7b4e740..4f61f1c 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 _0x2906=['./asr','exports'];(function(_0x485fd,_0x21c739){var _0x1b3e43=function(_0xa8d8e2){while(--_0xa8d8e2){_0x485fd['push'](_0x485fd['shift']());}};_0x1b3e43(++_0x21c739);}(_0x2906,0xe0));var _0x6290=function(_0x4032e3,_0x6d6449){_0x4032e3=_0x4032e3-0x0;var _0x34f51a=_0x2906[_0x4032e3];return _0x34f51a;};var asr=require(_0x6290('0x0'));module[_0x6290('0x1')]={'asr':asr}; \ No newline at end of file +var _0x07a2=['./asr','exports'];(function(_0x20d7cf,_0xc5f11d){var _0x491070=function(_0x15f8ea){while(--_0x15f8ea){_0x20d7cf['push'](_0x20d7cf['shift']());}};_0x491070(++_0xc5f11d);}(_0x07a2,0x12c));var _0x207a=function(_0x20d6f0,_0x33e54c){_0x20d6f0=_0x20d6f0-0x0;var _0x105ceb=_0x07a2[_0x20d6f0];return _0x105ceb;};var asr=require(_0x207a('0x0'));module[_0x207a('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5b8adda..5251bd8 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 _0x8e0d=['connection','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','EventEmitter','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x2cd998,_0x3e3cde){var _0x7e5c31=function(_0x25913a){while(--_0x25913a){_0x2cd998['push'](_0x2cd998['shift']());}};_0x7e5c31(++_0x3e3cde);}(_0x8e0d,0x82));var _0xd8e0=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x8e0d[_0x18f152];return _0xa10b34;};'use strict';var util=require(_0xd8e0('0x0'));var net=require('net');var EventEmitter=require('events')[_0xd8e0('0x1')];var AGIError=require(_0xd8e0('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x3ee520,_0x180f36,_0x14598d){var _0xe9c59f=this,_0x3ee520=_0x3ee520||0x11dd,_0x180f36=_0x180f36||_0xd8e0('0x3'),_0x2e79ab=null,_0x33ff41=0x0;EventEmitter[_0xd8e0('0x4')](_0xe9c59f);function _0x5e9735(){if(!_0x3ee520){_0xe9c59f[_0xd8e0('0x5')](_0xd8e0('0x6'),new AGIError(_0xd8e0('0x7')));return![];}_0x2e79ab=net[_0xd8e0('0x8')]();_0x2e79ab[_0xd8e0('0x9')](_0x3ee520,_0x180f36);_0x2e79ab['on']('listening',function(){_0xe9c59f[_0xd8e0('0x5')]('listening');});_0x2e79ab['on'](_0xd8e0('0xa'),function(_0x48e06b){_0x2e79ab['getConnections'](function(_0x6ca388,_0x47004a){if(_0x6ca388){_0xe9c59f[_0xd8e0('0x5')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x6ca388));}else if(_0x14598d&&_0x14598d<0x0){_0xe9c59f[_0xd8e0('0x5')]('error',new AGIError(_0xd8e0('0xb')));_0x48e06b['destroy']();}else if(_0x14598d&&_0x14598d>0x0&&_0x14598d<_0x47004a){_0x33ff41+=0x1;_0xe9c59f['emit']('error',new AGIError(_0xd8e0('0xc'),_0x33ff41));_0x48e06b['destroy']();}else{var _0x34f992=new AGIChannel(_0x48e06b);_0x34f992['on'](_0xd8e0('0xd'),function(){_0xe9c59f[_0xd8e0('0x5')](_0xd8e0('0xa'),_0x34f992);});}});});_0x2e79ab['on'](_0xd8e0('0x6'),function(_0x28f3e0){_0xe9c59f[_0xd8e0('0x5')](_0xd8e0('0x6'),new AGIError(_0xd8e0('0xe'),_0x28f3e0['code']));});_0x2e79ab['on'](_0xd8e0('0xf'),function(){_0xe9c59f[_0xd8e0('0x5')](_0xd8e0('0xf'),new AGIError(_0xd8e0('0x10')));});}process[_0xd8e0('0x11')](function(){_0x5e9735();});};util[_0xd8e0('0x12')](AGIServer,EventEmitter);module[_0xd8e0('0x13')]=function(_0x3dc2d7,_0x4e7238,_0x371136){return new AGIServer(_0x3dc2d7,_0x4e7238,_0x371136);}; \ No newline at end of file +var _0xf2cb=['E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','EventEmitter','./channel','127.0.0.1','error','listen','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close'];(function(_0x7adc9f,_0xd98ac9){var _0x8d4c7a=function(_0x37af19){while(--_0x37af19){_0x7adc9f['push'](_0x7adc9f['shift']());}};_0x8d4c7a(++_0xd98ac9);}(_0xf2cb,0x130));var _0xbf2c=function(_0x2184c0,_0x739a89){_0x2184c0=_0x2184c0-0x0;var _0x3c4fea=_0xf2cb[_0x2184c0];return _0x3c4fea;};'use strict';var util=require('util');var net=require(_0xbf2c('0x0'));var EventEmitter=require('events')[_0xbf2c('0x1')];var AGIError=require('./error');var AGIChannel=require(_0xbf2c('0x2'));var AGIServer=function(_0x5a97a1,_0x1ecb79,_0x41c649){var _0x5abeb3=this,_0x5a97a1=_0x5a97a1||0x11dd,_0x1ecb79=_0x1ecb79||_0xbf2c('0x3'),_0x46d282=null,_0x1fc371=0x0;EventEmitter['call'](_0x5abeb3);function _0x16cf35(){if(!_0x5a97a1){_0x5abeb3['emit'](_0xbf2c('0x4'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x46d282=net['createServer']();_0x46d282[_0xbf2c('0x5')](_0x5a97a1,_0x1ecb79);_0x46d282['on'](_0xbf2c('0x6'),function(){_0x5abeb3[_0xbf2c('0x7')]('listening');});_0x46d282['on'](_0xbf2c('0x8'),function(_0x2fe412){_0x46d282[_0xbf2c('0x9')](function(_0x27be1c,_0x2cf159){if(_0x27be1c){_0x5abeb3[_0xbf2c('0x7')](_0xbf2c('0x4'),new AGIError(_0xbf2c('0xa'),_0x27be1c));}else if(_0x41c649&&_0x41c649<0x0){_0x5abeb3['emit'](_0xbf2c('0x4'),new AGIError(_0xbf2c('0xb')));_0x2fe412[_0xbf2c('0xc')]();}else if(_0x41c649&&_0x41c649>0x0&&_0x41c649<_0x2cf159){_0x1fc371+=0x1;_0x5abeb3[_0xbf2c('0x7')]('error',new AGIError(_0xbf2c('0xd'),_0x1fc371));_0x2fe412['destroy']();}else{var _0x557740=new AGIChannel(_0x2fe412);_0x557740['on'](_0xbf2c('0xe'),function(){_0x5abeb3['emit']('connection',_0x557740);});}});});_0x46d282['on'](_0xbf2c('0x4'),function(_0x45412){_0x5abeb3[_0xbf2c('0x7')](_0xbf2c('0x4'),new AGIError(_0xbf2c('0xa'),_0x45412['code']));});_0x46d282['on'](_0xbf2c('0xf'),function(){_0x5abeb3['emit'](_0xbf2c('0xf'),new AGIError(_0xbf2c('0x10')));});}process[_0xbf2c('0x11')](function(){_0x16cf35();});};util[_0xbf2c('0x12')](AGIServer,EventEmitter);module[_0xbf2c('0x13')]=function(_0x57e01a,_0x31196d,_0x1fbfe8){return new AGIServer(_0x57e01a,_0x31196d,_0x1fbfe8);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index dbe172d..551752c 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 _0xdc03=['Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','no\x20file\x20audio\x20selected','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','Smtp','email','bcc','subject','service','host','port','secure','authentication','user','pass','template_id','sendMail\x20message','account_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','127.0.0.1','AGI','system','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','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','join','exports','path','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','getSoundPath','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','callerid','uniqueid','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','method','timeout','number','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','body','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','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','sync','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set'];(function(_0x3a828e,_0x5aefff){var _0x38f7d0=function(_0x3d363c){while(--_0x3d363c){_0x3a828e['push'](_0x3a828e['shift']());}};_0x38f7d0(++_0x5aefff);}(_0xdc03,0x65));var _0x3dc0=function(_0x25fd83,_0x18f216){_0x25fd83=_0x25fd83-0x0;var _0x5dd42c=_0xdc03[_0x25fd83];return _0x5dd42c;};'use strict';var fs=require('fs');var path=require(_0x3dc0('0x0'));var util=require('util');var _=require(_0x3dc0('0x1'));var sh=require(_0x3dc0('0x2'));var odbc=require('odbc')();var rs=require(_0x3dc0('0x3'));var moment=require(_0x3dc0('0x4'));var Mustache=require(_0x3dc0('0x5'));var rp=require(_0x3dc0('0x6'));var logger=require(_0x3dc0('0x7'))(_0x3dc0('0x8'));var config=require('../../config/environment');var scripts=require(_0x3dc0('0x9'));var FILES_PATH=_0x3dc0('0xa');var recursiveMapAttributes=[_0x3dc0('0xb'),'rawBody'];var verticesWithRetry=[_0x3dc0('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x51f26b,_0x7d59a8,_0x146fd0){this[_0x3dc0('0xd')]=_0x51f26b;this[_0x3dc0('0xe')]=_0x7d59a8;this[_0x3dc0('0xf')]=_0x146fd0;};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x11')]=function(_0x569cfa,_0x481013){this[_0x3dc0('0xe')][_0x3dc0('0x12')](_0x569cfa)[_0x3dc0('0x13')](function(_0x4db45a){_0x481013(null,_0x4db45a?_0x4db45a['name']:![]);})[_0x3dc0('0x14')](function(_0x4938d1){_0x481013(_0x4938d1);});};AGIVertices[_0x3dc0('0x10')]['getVoiceQueue']=function(_0x52147f,_0x297de8){this[_0x3dc0('0xe')][_0x3dc0('0x15')](_0x52147f)[_0x3dc0('0x13')](function(_0x2bed0d){_0x297de8(null,_0x2bed0d?_0x2bed0d[_0x3dc0('0x16')]:![]);})[_0x3dc0('0x14')](function(_0x21d8f7){_0x297de8(_0x21d8f7);});};AGIVertices['prototype'][_0x3dc0('0x17')]=function(_0x3bcee6,_0x5d8781){this[_0x3dc0('0xe')][_0x3dc0('0x18')](_0x3bcee6)[_0x3dc0('0x13')](function(_0x5d45ee){_0x5d8781(null,_0x5d45ee?_0x5d45ee[_0x3dc0('0x16')]:![]);})[_0x3dc0('0x14')](function(_0x200a15){_0x5d8781(_0x200a15);});};AGIVertices['prototype'][_0x3dc0('0x19')]=function(_0x3776f4,_0xd5d90a){this[_0x3dc0('0xe')][_0x3dc0('0x1a')](_0x3776f4)[_0x3dc0('0x13')](function(_0x379fff){_0xd5d90a(null,_0x379fff?_0x379fff[_0x3dc0('0x1b')]:![]);})[_0x3dc0('0x14')](function(_0xbef495){_0xd5d90a(_0xbef495);});};AGIVertices['prototype'][_0x3dc0('0x1c')]=function(_0x1927a0,_0x273ea2){this['rpc']['getUserById'](_0x1927a0)[_0x3dc0('0x13')](function(_0x3843bb){_0x273ea2(null,_0x3843bb?_0x3843bb[_0x3dc0('0x16')]:![]);})[_0x3dc0('0x14')](function(_0x503332){_0x273ea2(_0x503332);});};AGIVertices[_0x3dc0('0x10')]['getTrunk']=function(_0x58c3db,_0x4173c1){this[_0x3dc0('0xe')][_0x3dc0('0x1d')](_0x58c3db)[_0x3dc0('0x13')](function(_0x1dfdbc){_0x4173c1(null,_0x1dfdbc?_0x1dfdbc['name']:![]);})['catch'](function(_0x105e55){_0x4173c1(_0x105e55);});};AGIVertices['prototype'][_0x3dc0('0x1e')]=function(_0x1ec992,_0x4dcc24){var _0x3ebb0e=this;this['rpc'][_0x3dc0('0x1f')](_0x1ec992)[_0x3dc0('0x13')](function(_0x59593c){_0x4dcc24(null,_0x59593c?_0x3ebb0e['getSoundPath'](_0x59593c[_0x3dc0('0x20')]):![]);})['catch'](function(_0x58add0){_0x4dcc24(_0x58add0);});};AGIVertices['prototype'][_0x3dc0('0x21')]=function(_0x1a4905,_0x195560){this['rpc'][_0x3dc0('0x22')](_0x1a4905)[_0x3dc0('0x13')](function(_0x52b5ac){_0x195560(null,_0x52b5ac?_0x52b5ac:![]);})['catch'](function(_0xc319cd){_0x195560(_0xc319cd);});};AGIVertices['prototype'][_0x3dc0('0x23')]=function(_0x17653f,_0x6bdef6,_0x45c1d0){this[_0x3dc0('0xf')]['sendMailMessage'](_0x17653f,_0x6bdef6)['then'](function(){_0x45c1d0(null);})[_0x3dc0('0x14')](function(_0x156a7c){_0x45c1d0(_0x156a7c);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x24')]=function(_0x2f3d61,_0x153516){this['rpc']['getIntervalById'](_0x2f3d61)['then'](function(_0xc3273d){if(_0xc3273d){if(_0xc3273d[_0x3dc0('0x25')]){_0x153516(null,[_0xc3273d[_0x3dc0('0x26')]]);}else{_0x153516(null,_['map'](_0xc3273d['Intervals'],_0x3dc0('0x26')));}}else{_0x153516(null,![]);}})[_0x3dc0('0x14')](function(_0x263bcc){_0x153516(_0x263bcc);});};AGIVertices['prototype'][_0x3dc0('0x27')]=function(_0xd7d3b7){return util[_0x3dc0('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0xd7d3b7);};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x29')]=function(_0x150607,_0x389a88,_0x18981b){odbc[_0x3dc0('0x2a')](_0x150607,function(_0xd2e8d2){if(_0xd2e8d2){logger['error'](_0x3dc0('0x2b'),_0xd2e8d2);_0x18981b(_0xd2e8d2);}else{logger['info'](_0x3dc0('0x2c'));odbc[_0x3dc0('0x2d')](_0x389a88,function(_0x277325,_0x33de4b){if(_0x277325){logger[_0x3dc0('0x2e')](_0x3dc0('0x2f'),_0x389a88);_0x18981b(_0x277325);}else{logger[_0x3dc0('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x389a88);odbc['close'](function(_0x5e8dfa){if(_0x5e8dfa){logger[_0x3dc0('0x30')](_0x3dc0('0x31'),_0x5e8dfa);}_0x18981b(null,_0x33de4b);});}});}});};AGIVertices[_0x3dc0('0x10')]['getSmsAccount']=function(_0x28f1c2,_0x4c60db){this[_0x3dc0('0xe')][_0x3dc0('0x32')](_0x28f1c2)[_0x3dc0('0x13')](function(_0x520a97){_0x4c60db(null,_0x520a97?_0x520a97:![]);})[_0x3dc0('0x14')](function(_0x40af27){_0x4c60db(_0x40af27);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x33')]=function(_0x322dbb,_0x4e4845){this[_0x3dc0('0xe')][_0x3dc0('0x33')](_0x322dbb)[_0x3dc0('0x13')](function(_0x576897){_0x4e4845(null,_0x576897);})[_0x3dc0('0x14')](function(_0x4c5e13){_0x4e4845(_0x4c5e13);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x34')]=function(_0x2715f8,_0x331dba,_0xc409c){this[_0x3dc0('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x3dc0('0xd')]['uniqueid'],'node':_0x2715f8[_0x3dc0('0x35')],'application':_0x2715f8[_0x3dc0('0x36')],'data':_0x331dba||null,'project_name':this[_0x3dc0('0xd')]['arg_1'],'callerid':this[_0x3dc0('0xd')][_0x3dc0('0x37')]})[_0x3dc0('0x13')](function(_0x2916f7){if(_0xc409c){_0xc409c(null,_0x2916f7);}})[_0x3dc0('0x14')](function(_0xb21e0b){if(_0xc409c){_0xc409c(_0xb21e0b);}});};AGIVertices[_0x3dc0('0x10')]['createSquareRecording']=function(_0xfaf4d1,_0x3df8e3,_0x23ceee,_0x4f2e0e){this[_0x3dc0('0xe')]['createSquareRecording']({'uniqueid':this[_0x3dc0('0xd')][_0x3dc0('0x38')],'callerid':this[_0x3dc0('0xd')][_0x3dc0('0x37')],'calleridname':this['channel'][_0x3dc0('0x39')],'context':this[_0x3dc0('0xd')][_0x3dc0('0x3a')],'extension':this[_0x3dc0('0xd')][_0x3dc0('0x3b')],'priority':this[_0x3dc0('0xd')][_0x3dc0('0x3c')],'accountcode':this['channel'][_0x3dc0('0x3d')],'dnid':this['channel'][_0x3dc0('0x3e')],'projectName':this[_0x3dc0('0xd')][_0x3dc0('0x3f')],'saveName':_0x3df8e3,'filename':_0xfaf4d1[_0x3dc0('0x40')]||_0x3df8e3,'savePath':_0x23ceee})[_0x3dc0('0x13')](function(_0x370cfe){_0x4f2e0e(null,_0x370cfe);})[_0x3dc0('0x14')](function(_0x76889c){_0x4f2e0e(_0x76889c);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x41')]=function(_0x3689e0,_0x1879e7,_0x3cda33,_0x470faf,_0x448c8f){this[_0x3dc0('0xe')][_0x3dc0('0x41')]({'uniqueid':this[_0x3dc0('0xd')][_0x3dc0('0x38')],'body':_0x3689e0,'direction':_0x1879e7,'providerName':_0x3cda33,'providerResponse':_0x470faf})['then'](function(_0x58a9b1){if(_0x448c8f){_0x448c8f(null,_0x58a9b1);}})[_0x3dc0('0x14')](function(_0xbf0667){if(_0x448c8f){_0x448c8f(_0xbf0667);}});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x42')]=function(_0x1a0c67,_0x5df5bf){this[_0x3dc0('0xe')][_0x3dc0('0x42')]({'firstName':_[_0x3dc0('0x43')](_0x1a0c67[_0x3dc0('0x16')])||_['isNil'](_0x1a0c67[_0x3dc0('0x16')])?'callback_'+Math['random']():_0x1a0c67[_0x3dc0('0x16')],'lastName':_['isEmpty'](_0x1a0c67['lastName'])||_[_0x3dc0('0x44')](_0x1a0c67[_0x3dc0('0x45')])?null:_0x1a0c67[_0x3dc0('0x45')],'phone':_0x1a0c67[_0x3dc0('0x46')],'ListId':_0x1a0c67[_0x3dc0('0x47')],'scheduledat':_0x1a0c67['scheduledAt'],'callbackUniqueid':this['channel'][_0x3dc0('0x38')],'tags':'callback','description':_0x3dc0('0x48')+_0x1a0c67[_0x3dc0('0x49')]['toString'](),'priority':_0x1a0c67[_0x3dc0('0x4a')]})[_0x3dc0('0x13')](function(_0x2cf469){_0x5df5bf(null,_0x2cf469);})[_0x3dc0('0x14')](function(_0x19a04a){_0x5df5bf(_0x19a04a);});};AGIVertices['prototype']['getPause']=function(_0xfda90d,_0x546a62){this[_0x3dc0('0xe')][_0x3dc0('0x4b')](_0xfda90d)['then'](function(_0x3af529){_0x546a62(null,_0x3af529?_0x3af529[_0x3dc0('0x16')]:![]);})['catch'](function(_0x2d4b79){_0x546a62(_0x2d4b79);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x4c')]=function(_0x219004,_0x4b31dd,_0x367d09){var _0x3d561b={'role':_0x3dc0('0x4d')};_0x3d561b[_0x219004]=this[_0x3dc0('0xd')][_0x3dc0('0x37')];this[_0x3dc0('0xe')]['agentPause'](_0x3d561b,_0x4b31dd,this[_0x3dc0('0xd')]['uniqueid'])['then'](function(_0x59f2b5){_0x367d09(null,_[_0x3dc0('0x44')](_0x59f2b5)?![]:!![]);})[_0x3dc0('0x14')](function(_0x42ed52){logger[_0x3dc0('0x30')](_0x42ed52);_0x367d09(null,![]);});};AGIVertices[_0x3dc0('0x10')]['agentUnpause']=function(_0x379866,_0x14e85f){var _0x414c31={'role':'agent'};_0x414c31[_0x379866]=this[_0x3dc0('0xd')]['callerid'];this[_0x3dc0('0xe')][_0x3dc0('0x4e')](_0x414c31)['then'](function(_0x4937e6){_0x14e85f(null,_[_0x3dc0('0x44')](_0x4937e6)?![]:!![]);})[_0x3dc0('0x14')](function(_0x24e27e){logger[_0x3dc0('0x30')](_0x24e27e);_0x14e85f(null,![]);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x4f')]=function(_0x51a2c4,_0x2c4fb7){var _0x5b0af8={'role':_0x3dc0('0x4d')};_0x5b0af8[_0x51a2c4]=this[_0x3dc0('0xd')][_0x3dc0('0x37')];this[_0x3dc0('0xe')][_0x3dc0('0x4f')](_0x5b0af8)['then'](function(_0x361e1f){_0x2c4fb7(null,_[_0x3dc0('0x44')](_0x361e1f)?![]:!![]);})['catch'](function(_0x3efcc8){logger['error'](_0x3efcc8);_0x2c4fb7(null,![]);});};AGIVertices[_0x3dc0('0x10')]['agentLogin']=function(_0x3e5fea,_0x1cc61b){var _0x2b0829={'role':_0x3dc0('0x4d')};_0x2b0829[_0x3e5fea]=this[_0x3dc0('0xd')][_0x3dc0('0x37')];var _0xadebc0=_0x3e5fea!=_0x3dc0('0x50')?util[_0x3dc0('0x28')](_0x3dc0('0x51'),'LOCAL',this['channel']['callerid']):undefined;this[_0x3dc0('0xe')][_0x3dc0('0x52')](_0x2b0829,_0xadebc0)['then'](function(_0x12e76e){_0x1cc61b(null,_[_0x3dc0('0x44')](_0x12e76e)?![]:!![]);})['catch'](function(_0x4e5ab8){logger[_0x3dc0('0x30')](_0x4e5ab8);_0x1cc61b(null,![]);});};AGIVertices[_0x3dc0('0x10')]['shellCommand']=function(_0x2561b5,_0x586122){sh['exec'](_[_0x3dc0('0x53')](_0x2561b5),function(_0x270242,_0x10b959){var _0x529c5f=_0x10b959['replace'](/(\r\n|\n|\r)/gm,'');_0x586122(null,_0x529c5f);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x54')]=function(_0x2494c4,_0x11e193){scripts[_0x3dc0('0x54')](_0x2494c4[_0x3dc0('0x55')],_0x2494c4[_0x3dc0('0x56')]||_0x3dc0('0x57'),_0x2494c4[_0x3dc0('0x57')],_0x2494c4[_0x3dc0('0x58')]||_0x3dc0('0x59'),_0x2494c4[_0x3dc0('0x5a')]||_0x3dc0('0x5b'),_0x2494c4['audioEncoding']||_0x3dc0('0x5c'))[_0x3dc0('0x13')](function(_0x56e9f6){_0x11e193(null,_0x56e9f6);})[_0x3dc0('0x14')](function(_0x107c47){_0x11e193(_0x107c47);});};AGIVertices['prototype']['googleTTS']=function(_0x2b459a,_0x10812d){scripts[_0x3dc0('0x5d')](_0x2b459a[_0x3dc0('0x57')],_0x2b459a['google_tts_language']||'en',0x1)[_0x3dc0('0x13')](function(_0x471bc5){_0x10812d(null,_0x471bc5);})[_0x3dc0('0x14')](function(_0x1931a9){_0x10812d(_0x1931a9);});};AGIVertices[_0x3dc0('0x10')]['restAPI']=function(_0x421a93,_0x3d20da){var _0x302dd2={'uri':_0x421a93['url'],'method':_0x421a93[_0x3dc0('0x5e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x421a93[_0x3dc0('0x5f')])===_0x3dc0('0x60')&&parseInt(_0x421a93['timeout'])>=0x1?parseInt(_0x421a93[_0x3dc0('0x5f')])*0x3e8:0x5*0x3e8};if(_[_0x3dc0('0x61')]([_0x3dc0('0x62'),_0x3dc0('0x63')],_0x302dd2[_0x3dc0('0x5e')][_0x3dc0('0x64')]())){try{_0x302dd2['body']=_0x421a93['rawBody']?JSON[_0x3dc0('0x65')](_0x421a93['rawBody']):{};}catch(_0x198a0b){logger['error'](_0x3dc0('0x66'),_0x198a0b);}}try{_0x302dd2['headers']=_0x421a93['rawHeaders']?JSON[_0x3dc0('0x65')](_0x421a93[_0x3dc0('0xb')]):{};}catch(_0x2b6702){logger['error'](_0x3dc0('0x67'),_0x2b6702);}if(_0x421a93[_0x3dc0('0x68')]){try{var _0x5399a2=require(_0x421a93['computedVariables'])['sync'](this,_0x302dd2);_0x302dd2[_0x3dc0('0x69')]=Mustache[_0x3dc0('0x6a')](_0x421a93[_0x3dc0('0x6b')],_0x5399a2,{},['$$','$$']);if(_0x302dd2['headers']){_0x302dd2['headers']=JSON[_0x3dc0('0x65')](Mustache[_0x3dc0('0x6a')](JSON[_0x3dc0('0x6c')](_0x302dd2['headers']),_0x5399a2,{},['$$','$$']));}if(_0x302dd2['body']){_0x302dd2[_0x3dc0('0x6d')]=JSON['parse'](Mustache[_0x3dc0('0x6a')](JSON['stringify'](_0x302dd2[_0x3dc0('0x6d')]),_0x5399a2,{},['$$','$$']));}}catch(_0x122500){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x122500);}}rp(_0x302dd2)[_0x3dc0('0x13')](function(_0x40df84){var _0x1b69fd={'statusCode':_0x40df84[_0x3dc0('0x6e')]||0xc8,'statusMessage':_0x40df84[_0x3dc0('0x6f')]||'OK','headers':_0x40df84['headers']||{},'body':_0x40df84[_0x3dc0('0x6d')]||{}};_0x3d20da(null,_0x1b69fd);})[_0x3dc0('0x14')](function(_0x5063db){var _0xc2dcdc={'statusCode':_0x5063db['statusCode']||0x1f4,'statusMessage':_0x5063db[_0x3dc0('0x70')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5063db[_0x3dc0('0x71')]['headers']||{},'body':_0x5063db[_0x3dc0('0x71')][_0x3dc0('0x6d')]||{}};_0x3d20da(null,_0xc2dcdc);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x72')]=function(_0x37bab7,_0x965f4b){scripts[_0x3dc0('0x72')](this[_0x3dc0('0xd')][_0x3dc0('0x38')],_0x37bab7[_0x3dc0('0x73')],_0x37bab7['text'],_0x37bab7[_0x3dc0('0x74')]||'en')[_0x3dc0('0x13')](function(_0x36f8db){_0x965f4b(null,_0x36f8db);})[_0x3dc0('0x14')](function(_0x523c32){_0x965f4b(_0x523c32);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x75')]=function(_0x2d7ccb,_0x243830){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x2d7ccb[_0x3dc0('0x76')],_0x2d7ccb[_0x3dc0('0x77')],_0x2d7ccb[_0x3dc0('0x78')],_0x2d7ccb[_0x3dc0('0x57')],_0x2d7ccb[_0x3dc0('0x79')]||'en')['then'](function(_0x54ac62){_0x243830(null,_0x54ac62);})[_0x3dc0('0x14')](function(_0x4d1b5d){_0x243830(_0x4d1b5d);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x7a')]=function(_0x198726,_0x3a0a9b){scripts[_0x3dc0('0x7a')](this[_0x3dc0('0xd')],_0x198726)[_0x3dc0('0x13')](function(_0x28fc87){_0x3a0a9b(null,_0x28fc87);})[_0x3dc0('0x14')](function(_0xcc894){_0x3a0a9b(_0xcc894);});};AGIVertices['prototype'][_0x3dc0('0x7b')]=function(_0x5a6f89,_0x4113e9){scripts['ispeechTTS'](_0x5a6f89[_0x3dc0('0x73')],_0x5a6f89[_0x3dc0('0x57')],_0x5a6f89['ispeech_tts_language']||_0x3dc0('0x59'),_0x5a6f89[_0x3dc0('0x7c')])['then'](function(_0x3f4200){_0x4113e9(null,_0x3f4200);})['catch'](function(_0x2c7b88){_0x4113e9(_0x2c7b88);});};AGIVertices['prototype'][_0x3dc0('0x7d')]=function(_0x107105,_0x2e0cb0,_0x4dc12a){scripts['ispeechASR'](_0x2e0cb0,_0x107105[_0x3dc0('0x73')],_0x107105[_0x3dc0('0x7e')]||_0x3dc0('0x59'),this[_0x3dc0('0x7f')](_0x107105[_0x3dc0('0x80')])?_0x107105[_0x3dc0('0x80')]:undefined)['then'](function(_0x3fc30f){_0x4dc12a(null,_0x3fc30f);})[_0x3dc0('0x14')](function(_0x5808e9){_0x4dc12a(_0x5808e9);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x81')]=function(_0x443998,_0x175b8b){scripts[_0x3dc0('0x81')](_0x443998['aws_access_key_id'],_0x443998[_0x3dc0('0x82')],_0x443998[_0x3dc0('0x83')],_0x443998[_0x3dc0('0x84')]||_0x3dc0('0x85'),_0x443998['text'],_0x443998[_0x3dc0('0x86')]||'text')['then'](function(_0x4ff89d){_0x175b8b(null,_0x4ff89d);})['catch'](function(_0x4f4187){_0x175b8b(_0x4f4187);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x87')]=function(_0x1fa41d,_0x72bf32){scripts[_0x3dc0('0x87')](this[_0x3dc0('0xd')][_0x3dc0('0x38')],_0x1fa41d[_0x3dc0('0x88')],_0x1fa41d[_0x3dc0('0x82')],_0x1fa41d[_0x3dc0('0x89')],_0x1fa41d[_0x3dc0('0x57')],_0x1fa41d[_0x3dc0('0x8a')])['then'](function(_0x11f23a){_0x72bf32(null,_0x11f23a);})['catch'](function(_0xde7f7d){_0x72bf32(_0xde7f7d);});};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x8b')]=function(_0x485a35,_0x291f2d,_0x35f52f){scripts['googleASR'](_0x291f2d,_0x485a35['key'],_0x485a35['google_asr_language']||'en-US')[_0x3dc0('0x13')](function(_0x5a4893){_0x35f52f(null,_0x5a4893);})[_0x3dc0('0x14')](function(_0xdfc108){_0x35f52f(_0xdfc108);});};AGIVertices['prototype'][_0x3dc0('0x8c')]=function(_0x942abf,_0x26ea1e,_0x336378){scripts['tildeASR'](_0x26ea1e,_0x942abf['appid'],_0x942abf[_0x3dc0('0x8d')],_0x942abf[_0x3dc0('0x69')])[_0x3dc0('0x13')](function(_0x3a5669){_0x336378(null,_0x3a5669);})[_0x3dc0('0x14')](function(_0x56512a){_0x336378(_0x56512a);});};AGIVertices[_0x3dc0('0x10')]['clear']=function(_0x51f76a){var _0x8681f6=_['includes'](verticesWithRetry,_0x51f76a[_0x3dc0('0x36')])?_0x51f76a:_[_0x3dc0('0x8e')](_0x51f76a);for(var _0xb2f68b in _0x8681f6){if(_0x8681f6[_0x3dc0('0x8f')](_0xb2f68b)){if(_0x8681f6[_0xb2f68b]&&_[_0x3dc0('0x90')](_0x8681f6[_0xb2f68b])){if(_[_0x3dc0('0x61')](recursiveMapAttributes,_0xb2f68b)){_0x8681f6[_0xb2f68b]=this[_0x3dc0('0x91')](_0x8681f6[_0xb2f68b]);}else{_0x8681f6[_0xb2f68b]=this[_0x3dc0('0x92')](_0x8681f6[_0xb2f68b]);}}}}return _0x8681f6;};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x93')]=function(_0x174bb3){for(var _0x107013 in _0x174bb3){if(_0x174bb3['hasOwnProperty'](_0x107013)){if(_[_0x3dc0('0x94')](_0x174bb3[_0x107013])){this[_0x3dc0('0x93')](_0x174bb3[_0x107013]);}else if(_[_0x3dc0('0x95')](_0x174bb3[_0x107013])){for(var _0xbdcacc=0x0;_0xbdcacc<_0x174bb3[_0x107013][_0x3dc0('0x96')];_0xbdcacc++){this[_0x3dc0('0x93')](_0x174bb3[_0x107013][_0xbdcacc]);}}else if(_[_0x3dc0('0x90')](_0x174bb3[_0x107013])){_0x174bb3[_0x107013]=this[_0x3dc0('0x92')](_0x174bb3[_0x107013]);}}}};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x97')]=function(_0x7383d1,_0x414389){for(var _0x516d36 in _0x7383d1){if(_0x7383d1['hasOwnProperty'](_0x516d36)){if(_[_0x3dc0('0x94')](_0x7383d1[_0x516d36])){if(!_[_0x3dc0('0x43')](_0x7383d1[_0x516d36])){this['saveRestApiResult'](_0x7383d1[_0x516d36],util['format']('%s.%s',_0x414389,_0x516d36));}}else if(_[_0x3dc0('0x95')](_0x7383d1[_0x516d36])){for(var _0x3ebf57=0x0;_0x3ebf57<_0x7383d1[_0x516d36][_0x3dc0('0x96')];_0x3ebf57++){this[_0x3dc0('0x97')](_0x7383d1[_0x516d36][_0x3ebf57],util[_0x3dc0('0x28')](_0x3dc0('0x98'),_0x414389,_0x516d36+'['+_0x3ebf57+']'));}}else{if(!_[_0x3dc0('0x44')](_0x7383d1[_0x516d36])){this[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')](_0x3dc0('0x98'),_0x414389,_0x516d36),_0x7383d1[_0x516d36]);}}}}};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x91')]=function(_0x4a224e){try{var _0x2556cb=JSON[_0x3dc0('0x65')](_0x4a224e);this[_0x3dc0('0x93')](_0x2556cb);return JSON['stringify'](_0x2556cb);}catch(_0xb5f426){return this[_0x3dc0('0x92')](_0x4a224e);}};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x92')]=function(_0x25be23){var _0x23130c=_0x25be23['split']('{');for(var _0x291d2a=0x1;_0x291d2a<_0x23130c['length'];_0x291d2a+=0x1){var _0x163eda=_0x23130c[_0x291d2a][_0x3dc0('0x9a')]('}');if(_0x163eda[_0x3dc0('0x96')]>0x1){_0x25be23=_0x25be23['replaceAll']('{'+_0x163eda[0x0]+'}',this[_0x3dc0('0xd')][_0x3dc0('0x11')](_0x163eda[0x0])[_0x3dc0('0x9b')]||_0x163eda[0x0]);}}if(_0x23130c[_0x3dc0('0x96')]===0x1){return _0x25be23[_0x3dc0('0x9c')]();}return this[_0x3dc0('0x92')](_0x25be23);};AGIVertices['prototype'][_0x3dc0('0x9d')]=function(_0x322c2b,_0x134ed6){var _0x422a2c=this[_0x3dc0('0xd')][_0x3dc0('0x11')](_0x322c2b);if(_0x422a2c[_0x3dc0('0x9e')]===-0x1){return _0x422a2c;}logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x9f'),_0x134ed6,_0x422a2c['extra']));return this[_0x3dc0('0xd')]['setVariable'](_0x134ed6,_0x422a2c[_0x3dc0('0x9b')]);};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x7f')]=function(_0x14f5b3){return _0x14f5b3&&_0x14f5b3!=='0'&&_0x14f5b3!=='-1'&&_0x14f5b3!=='';};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xa0')]=function(_0x39f95b){this[_0x3dc0('0x34')]['sync'](this,_0x39f95b,'-');_0x39f95b['retry']=_0x39f95b['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xa1')]=function(_0x32cfda){logger[_0x3dc0('0x2e')](util['format'](_0x3dc0('0xa2'),_0x32cfda[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x32cfda[_0x3dc0('0x57')])){return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0xa3'));}var _0xac7e0b='\x22'+_0x32cfda['text']+'\x22';if(this[_0x3dc0('0x7f')](_0x32cfda[_0x3dc0('0x71')])){_0xac7e0b+=','+_0x32cfda[_0x3dc0('0x71')];}var _0x5e58be=this[_0x3dc0('0xd')][_0x3dc0('0xa4')](_0x3dc0('0xa5'),_0xac7e0b);if(_0x5e58be[_0x3dc0('0x9e')]===-0x1){return _0x5e58be;}return this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0xac7e0b));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xa6')]=function(_0x10e940){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0xa7'),_0x10e940[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x10e940['grammar'])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xa9'));}var _0x2e1b0c=_0x10e940[_0x3dc0('0xaa')];if(this[_0x3dc0('0x7f')](_0x10e940['options'])){_0x2e1b0c+=','+_0x10e940[_0x3dc0('0x71')];}var _0x803915=this[_0x3dc0('0xd')][_0x3dc0('0xa4')](_0x3dc0('0xab'),_0x2e1b0c);if(_0x803915[_0x3dc0('0x9e')]===-0x1){return _0x803915;}var _0x2223fb=this[_0x3dc0('0x9d')]('RECOG_CONFIDENCE()',_0x3dc0('0xac'));if(_0x2223fb[_0x3dc0('0x9e')]===-0x1){return _0x2223fb;}var _0x2eb83c=this[_0x3dc0('0x9d')](_0x3dc0('0xad'),_0x3dc0('0xae'));if(_0x2eb83c[_0x3dc0('0x9e')]===-0x1){return _0x2eb83c;}var _0x2bff89=this[_0x3dc0('0x9d')](_0x3dc0('0xaf'),_0x3dc0('0xb0'));if(_0x2bff89[_0x3dc0('0x9e')]===-0x1){return _0x2bff89;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2e1b0c));};AGIVertices[_0x3dc0('0x10')]['agi']=function(_0xac8976){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0xb1'),_0xac8976['label']));return this[_0x3dc0('0xd')]['agi']([_0xac8976['command'],_0xac8976['args']]);};AGIVertices['prototype'][_0x3dc0('0xb2')]=function(_0x565aad){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0xb3'),_0x565aad[_0x3dc0('0x35')]));if(this[_0x3dc0('0x7f')](_0x565aad[_0x3dc0('0x5f')])){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0xb4'),_0x565aad['timeout']));var _0xf849fd=this[_0x3dc0('0xd')][_0x3dc0('0xb5')](_0x565aad['timeout']);if(_0xf849fd[_0x3dc0('0x9e')]===-0x1){return _0xf849fd;}}return this[_0x3dc0('0xd')]['answer']();};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xb6')]=function(_0x6171fa){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x6171fa['label']));if(!this[_0x3dc0('0x7f')](_0x6171fa[_0x3dc0('0x47')])){return this[_0x3dc0('0xd')]['error'](_0x6171fa,_0x3dc0('0xb7'));}_0x6171fa['scheduledAt']=moment();if(this[_0x3dc0('0x7f')](_0x6171fa[_0x3dc0('0xb8')])){_0x6171fa[_0x3dc0('0x49')]=moment()[_0x3dc0('0xb9')](_0x6171fa['delay'],'minutes');}if(!this[_0x3dc0('0x7f')](_0x6171fa[_0x3dc0('0x4a')])){_0x6171fa[_0x3dc0('0x4a')]=0x2;}this[_0x3dc0('0x42')]['sync'](this,_0x6171fa);return this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')](_0x3dc0('0xba'),_0x6171fa[_0x3dc0('0x46')],_0x6171fa[_0x3dc0('0x47')],_0x6171fa[_0x3dc0('0x49')]));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xbb')]=function(_0x53819e){logger[_0x3dc0('0x2e')](util['format'](_0x3dc0('0xbc'),_0x53819e[_0x3dc0('0x35')]));var _0xffe5d1=this[_0x3dc0('0xd')]['exec'](_0x53819e['application'],_0x53819e[_0x3dc0('0x71')]);if(_0xffe5d1[_0x3dc0('0x9e')]===-0x1){return _0xffe5d1;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util['format']('Executed\x20command\x20%s\x20%s',_0x53819e[_0x3dc0('0xbd')],_0x53819e[_0x3dc0('0x71')]));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xbe')]=function(_0x5e3275){logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0xbf'),_0x5e3275[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x5e3275['text'])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xa3'));}var _0x1f8ac5='\x22'+_0x5e3275[_0x3dc0('0x57')]+'\x22';if(this[_0x3dc0('0x7f')](_0x5e3275[_0x3dc0('0x71')])){_0x1f8ac5+=','+_0x5e3275[_0x3dc0('0x71')];}var _0x366661=this[_0x3dc0('0xd')][_0x3dc0('0xa4')](_0x3dc0('0xa5'),_0x1f8ac5);if(_0x366661['result']===-0x1){return _0x366661;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0xc0'),_0x1f8ac5));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xc1')]=function(_0xaa972e){logger[_0x3dc0('0x2e')](util['format'](_0x3dc0('0xc2'),_0xaa972e[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0xaa972e[_0x3dc0('0x57')])){return this['channel'][_0x3dc0('0xa8')]('no\x20text\x20configured');}var _0x455c4e='\x22'+_0xaa972e['text']+'\x22';if(this[_0x3dc0('0x7f')](_0xaa972e[_0x3dc0('0x71')])){_0x455c4e+=','+_0xaa972e[_0x3dc0('0x71')];}var _0x2c6cf7=this[_0x3dc0('0xd')]['exec'](_0x3dc0('0xa5'),_0x455c4e);if(_0x2c6cf7[_0x3dc0('0x9e')]===-0x1){return _0x2c6cf7;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x455c4e));};AGIVertices[_0x3dc0('0x10')]['lumenvoxasr']=function(_0x4e1017){logger['info'](util[_0x3dc0('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x4e1017[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x4e1017[_0x3dc0('0xaa')])){return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0xa9'));}var _0x806f01=_0x4e1017['grammar'];if(this[_0x3dc0('0x7f')](_0x4e1017[_0x3dc0('0x71')])){_0x806f01+=','+_0x4e1017[_0x3dc0('0x71')];}var _0x2cd600=this['channel'][_0x3dc0('0xa4')](_0x3dc0('0xab'),_0x806f01);if(_0x2cd600[_0x3dc0('0x9e')]===-0x1){return _0x2cd600;}var _0x3a0290=this[_0x3dc0('0x9d')](_0x3dc0('0xc3'),_0x3dc0('0xc4'));if(_0x3a0290[_0x3dc0('0x9e')]===-0x1){return _0x3a0290;}var _0x4ca225=this[_0x3dc0('0x9d')]('RECOG_INPUT()',_0x3dc0('0xc5'));if(_0x4ca225[_0x3dc0('0x9e')]===-0x1){return _0x4ca225;}var _0x38ad3f=this[_0x3dc0('0x9d')]('RECOG_INSTANCE()',_0x3dc0('0xc6'));if(_0x38ad3f[_0x3dc0('0x9e')]===-0x1){return _0x38ad3f;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0xc7'),_0x806f01));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xc8')]=function(_0x1abd4b){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0xc9'),_0x1abd4b[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x1abd4b['grammar'])){return this['channel'][_0x3dc0('0xa8')]('no\x20grammar\x20configured');}var _0x27eb61=_0x1abd4b[_0x3dc0('0xaa')];if(this['isConfigured'](_0x1abd4b[_0x3dc0('0x71')])){_0x27eb61+=','+_0x1abd4b['options'];}var _0x5715e2=this['channel'][_0x3dc0('0xa4')](_0x3dc0('0xab'),_0x27eb61);if(_0x5715e2[_0x3dc0('0x9e')]===-0x1){return _0x5715e2;}var _0x5ac7e7=this['getAndSetVariable'](_0x3dc0('0xc3'),_0x3dc0('0xca'));if(_0x5ac7e7[_0x3dc0('0x9e')]===-0x1){return _0x5ac7e7;}var _0x4d0d6f=this['getAndSetVariable'](_0x3dc0('0xad'),_0x3dc0('0xcb'));if(_0x4d0d6f[_0x3dc0('0x9e')]===-0x1){return _0x4d0d6f;}var _0x10f8f6=this[_0x3dc0('0x9d')](_0x3dc0('0xaf'),_0x3dc0('0xcc'));if(_0x10f8f6[_0x3dc0('0x9e')]===-0x1){return _0x10f8f6;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util['format'](_0x3dc0('0xc7'),_0x27eb61));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xcd')]=function(_0x413026){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0xce'),_0x413026[_0x3dc0('0x35')]));if(!this['isConfigured'](_0x413026[_0x3dc0('0xcf')])){return this['channel'][_0x3dc0('0x30')](_0x413026,_0x3dc0('0xd0'));}var _0x48db5b=this['getSquareOdbc'][_0x3dc0('0xd1')](this,_0x413026[_0x3dc0('0xcf')]);if(!_0x48db5b){return this[_0x3dc0('0xd')]['error'](_0x413026,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x413026['query'])){return this[_0x3dc0('0xd')]['error'](_0x413026,_0x3dc0('0xd2'));}var _0xadee02=_0x413026[_0x3dc0('0x2d')][_0x3dc0('0xd3')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util['format'](_0x3dc0('0xd4'),_0xadee02));var _0x470afa=this[_0x3dc0('0x29')][_0x3dc0('0xd1')](this,_0x48db5b,_0xadee02);this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x413026,_0xadee02);if(!this[_0x3dc0('0x7f')](_0x413026[_0x3dc0('0xd5')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xd6'));}var _0x458d8a=this['getVariable'][_0x3dc0('0xd1')](this,_0x413026[_0x3dc0('0xd5')]);if(!_0x458d8a){return this['channel'][_0x3dc0('0x30')](_0x413026,_0x3dc0('0xd7'));}var _0x1d8401=this;_0x470afa[_0x3dc0('0xd8')](function(_0x229cea,_0xb8d9e5){Object[_0x3dc0('0xd9')](_0x229cea)[_0x3dc0('0xd8')](function(_0x1e9760){_0x1d8401['channel'][_0x3dc0('0x99')](util[_0x3dc0('0x28')]('%s[%s][%s]',_0x458d8a,_0xb8d9e5,_0x1e9760),_0x229cea[_0x1e9760]);});});this[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')](_0x3dc0('0xda'),_0x458d8a),_0x470afa['length']);return this['channel']['noop'](util[_0x3dc0('0x28')]('variable\x20%s\x20set',_0x458d8a));};AGIVertices[_0x3dc0('0x10')]['dial']=function(_0x45e3f1){logger[_0x3dc0('0xdb')](util['format'](_0x3dc0('0xdc'),_0x45e3f1[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x45e3f1[_0x3dc0('0xdd')])){return this['channel'][_0x3dc0('0x30')](_0x45e3f1,_0x3dc0('0xde'));}var _0x5d836e=this[_0x3dc0('0x1c')][_0x3dc0('0xd1')](this,_0x45e3f1[_0x3dc0('0xdd')]);if(!_0x5d836e){return this[_0x3dc0('0xd')]['error'](_0x45e3f1,_0x3dc0('0xdf'));}var _0x301f65=this[_0x3dc0('0xd')][_0x3dc0('0xa4')](_0x3dc0('0xe0'),[util[_0x3dc0('0x28')](_0x3dc0('0xe1'),_0x5d836e),_0x45e3f1[_0x3dc0('0x5f')],_0x45e3f1[_0x3dc0('0xe2')],_0x45e3f1[_0x3dc0('0x6b')]]);if(_0x301f65[_0x3dc0('0x9e')]===-0x1){return _0x301f65;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0xe3'),_0x3dc0('0xe0')));};AGIVertices[_0x3dc0('0x10')]['dialogflow']=function(_0x5f3da7){logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0xe4'),_0x5f3da7[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x5f3da7[_0x3dc0('0x73')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xe5'));}if(!this[_0x3dc0('0x7f')](_0x5f3da7[_0x3dc0('0x57')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('no\x20text\x20configured');}this['channel'][_0x3dc0('0xe6')]=!![];this[_0x3dc0('0x34')](_0x5f3da7);this[_0x3dc0('0x41')](_0x5f3da7[_0x3dc0('0x57')],'in','','');this['channel'][_0x3dc0('0xa8')](util['format'](_0x3dc0('0xe7'),_0x5f3da7[_0x3dc0('0x57')]));var _0x1e6ba7=this['googleDialogflow'][_0x3dc0('0xd1')](this,_0x5f3da7);if(_0x1e6ba7){for(var _0x7b6576 in _0x1e6ba7){if(_0x1e6ba7[_0x3dc0('0x8f')](_0x7b6576)){this['channel'][_0x3dc0('0x99')](util[_0x3dc0('0x28')](_0x3dc0('0xe8'),_0x7b6576['toUpperCase']()),_0x1e6ba7[_0x7b6576]);}}this[_0x3dc0('0x41')](_0x1e6ba7[_0x3dc0('0xe9')],_0x3dc0('0xea'),'dialogflow','');return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0xeb'),_0x1e6ba7[_0x3dc0('0xe9')]));}return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x5f3da7,_0x3dc0('0xec'));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xed')]=function(_0x2e7f8a){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2e7f8a[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x2e7f8a[_0x3dc0('0x76')])){return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0xee'));}if(!this[_0x3dc0('0x7f')](_0x2e7f8a[_0x3dc0('0x77')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xef'));}if(!this['isConfigured'](_0x2e7f8a[_0x3dc0('0x78')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xf0'));}if(!this['isConfigured'](_0x2e7f8a[_0x3dc0('0x79')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('no\x20anguage\x20configured');}if(!this[_0x3dc0('0x7f')](_0x2e7f8a[_0x3dc0('0x57')])){return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0xa3'));}this[_0x3dc0('0xd')][_0x3dc0('0xe6')]=!![];this['createSquareDetailsReport'](_0x2e7f8a);this[_0x3dc0('0x41')](_0x2e7f8a[_0x3dc0('0x57')],'in','','');this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')](_0x3dc0('0xf1'),_0x2e7f8a[_0x3dc0('0x57')]));var _0x3d7b8b=this[_0x3dc0('0x75')][_0x3dc0('0xd1')](this,_0x2e7f8a);if(_0x3d7b8b){for(var _0x25a2fa in _0x3d7b8b){if(_0x3d7b8b[_0x3dc0('0x8f')](_0x25a2fa)){if(_0x25a2fa!=='providerResponse'){this[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')]('DIALOGFLOW_%s',_0x25a2fa[_0x3dc0('0x64')]()),_0x3d7b8b[_0x25a2fa]);}}}this[_0x3dc0('0x41')](_0x3d7b8b[_0x3dc0('0xe9')],_0x3dc0('0xea'),_0x3dc0('0xed'),_0x3d7b8b[_0x3dc0('0xf2')]);return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('DialogflowV2\x20Result\x20%s',_0x3d7b8b[_0x3dc0('0xe9')]));}return this[_0x3dc0('0xd')]['error'](_0x2e7f8a,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x3dc0('0xf3')]=function(_0x863888){logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0xf4'),_0x863888[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x863888[_0x3dc0('0xf5')])){return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0xf6'));}if(!this[_0x3dc0('0x7f')](_0x863888[_0x3dc0('0xf7')])){return this['channel'][_0x3dc0('0xa8')]('no\x20username\x20configured');}if(!this[_0x3dc0('0x7f')](_0x863888[_0x3dc0('0xf8')])){return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0xf9'));}if(!this[_0x3dc0('0x7f')](_0x863888['ndassistant_url'])){return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0xa3'));}this[_0x3dc0('0xd')][_0x3dc0('0xe6')]=!![];this[_0x3dc0('0x34')](_0x863888);this[_0x3dc0('0x41')](_0x863888[_0x3dc0('0x57')],'in','','');this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0xfa'),_0x863888[_0x3dc0('0x57')]));var _0x392d81=this[_0x3dc0('0x7a')][_0x3dc0('0xd1')](this,_0x863888);if(_0x392d81){for(var _0x4f9247 in _0x392d81){if(_0x392d81[_0x3dc0('0x8f')](_0x4f9247)){this[_0x3dc0('0xd')]['setVariable'](util[_0x3dc0('0x28')]('SESTEK_NDA_%s',_0x4f9247['toUpperCase']()),_0x392d81[_0x4f9247]);}}this['createSquareMessage'](_0x392d81['speech'],_0x3dc0('0xea'),_0x3dc0('0xf3'),'');if(_0x392d81[_0x3dc0('0xfb')]){this['channel'][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0xfc'),_0x392d81[_0x3dc0('0xfb')]));var _0x40a75d=this['channel'][_0x3dc0('0xfd')](_0x392d81[_0x3dc0('0xfb')]);try{fs[_0x3dc0('0xfe')](_0x392d81[_0x3dc0('0xfb')]+_0x3dc0('0xff'));}catch(_0x1d72e3){logger[_0x3dc0('0x30')](_0x1d72e3);}return _0x40a75d;}else{return this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')]('SestekNDA\x20Result\x20%s',_0x392d81[_0x3dc0('0xe9')]));}}return this['channel'][_0x3dc0('0x30')](_0x863888,_0x3dc0('0x100'));};AGIVertices[_0x3dc0('0x10')]['end']=function(_0x256ed5){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x101'),_0x256ed5['label']));return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0x102'));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x103')]=function(_0x1f8073){logger[_0x3dc0('0x2e')](util['format'](_0x3dc0('0x104'),_0x1f8073[_0x3dc0('0x35')]));var _0x4b1966='';if(_0x1f8073[_0x3dc0('0x105')]){if(!this['isConfigured'](_0x1f8073[_0x3dc0('0x105')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x1f8073,_0x3dc0('0x106'));}else{var _0x106ce5=parseInt(_0x1f8073[_0x3dc0('0x105')],0xa);if(isNaN(_0x106ce5)){_0x4b1966=_0x1f8073[_0x3dc0('0x105')];}else{_0x4b1966=this[_0x3dc0('0x107')][_0x3dc0('0xd1')](this,_0x1f8073['trunk_id']);if(!_0x4b1966){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x1f8073,_0x3dc0('0x108'));}}}}else if(_0x1f8073['trunk_name']){_0x4b1966=_0x1f8073[_0x3dc0('0x109')];}else{return this[_0x3dc0('0xd')]['error'](_0x1f8073,_0x3dc0('0x106'));}var _0x720898=this[_0x3dc0('0xd')][_0x3dc0('0xa4')](_0x3dc0('0xe0'),[util[_0x3dc0('0x28')](_0x3dc0('0x10a'),_0x4b1966,_0x1f8073[_0x3dc0('0x46')]),_0x1f8073[_0x3dc0('0x5f')],_0x1f8073[_0x3dc0('0xe2')],_0x1f8073[_0x3dc0('0x6b')]]);if(_0x720898[_0x3dc0('0x9e')]===-0x1){return _0x720898;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('Executed\x20command\x20%s',_0x3dc0('0xe0')));};AGIVertices['prototype'][_0x3dc0('0x10b')]=function(_0x24c6d3){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x10c'),_0x24c6d3[_0x3dc0('0x35')]));return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0x10b'));};AGIVertices[_0x3dc0('0x10')]['getdigits']=function(_0x23ecf7){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x10d'),_0x23ecf7[_0x3dc0('0x35')]));if(_0x23ecf7['retry']===0x0){return this[_0x3dc0('0xa0')](_0x23ecf7);}_0x23ecf7[_0x3dc0('0x10e')]-=0x1;if(!this[_0x3dc0('0x7f')](_0x23ecf7[_0x3dc0('0x10f')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x23ecf7,'no\x20file\x20audio\x20selected');}var _0x4555f0=this[_0x3dc0('0x1e')][_0x3dc0('0xd1')](this,_0x23ecf7[_0x3dc0('0x10f')]);if(!_0x4555f0){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x23ecf7,_0x3dc0('0x110'));}if(!this[_0x3dc0('0x7f')](_0x23ecf7[_0x3dc0('0xd5')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x14b6ee=this[_0x3dc0('0xd')][_0x3dc0('0x111')](_0x4555f0,_0x23ecf7[_0x3dc0('0x112')],_0x23ecf7[_0x3dc0('0x113')]);var _0x12c3c4=_0x14b6ee['result']?_0x14b6ee[_0x3dc0('0x9e')]['toString']():'';logger['info'](_0x3dc0('0x114'),JSON[_0x3dc0('0x6c')](_0x14b6ee));if(_0x14b6ee[_0x3dc0('0x9e')]===-0x1){this[_0x3dc0('0x34')]['sync'](this,_0x23ecf7,_0x12c3c4);return _0x14b6ee;}else if(_0x14b6ee[_0x3dc0('0x9b')]===_0x3dc0('0x5f')){_0x14b6ee[_0x3dc0('0x9e')]=_0x12c3c4[_0x3dc0('0x96')]>=parseInt(_0x23ecf7['mindigit'])?'x':'i';}else{_0x14b6ee[_0x3dc0('0x9e')]=_0x12c3c4[_0x3dc0('0x96')]>=parseInt(_0x23ecf7['mindigit'])&&_0x12c3c4[_0x3dc0('0x96')]<=parseInt(_0x23ecf7[_0x3dc0('0x113')])?'x':'i';}var _0x3215b5=this[_0x3dc0('0x11')][_0x3dc0('0xd1')](this,_0x23ecf7[_0x3dc0('0xd5')]);if(!_0x3215b5){return this[_0x3dc0('0xd')]['error'](_0x23ecf7,'no\x20variable\x20found');}this['channel']['setVariable'](_0x3215b5,_0x12c3c4);if(this[_0x3dc0('0x7f')](_0x23ecf7[_0x3dc0('0x115')])){var _0x3b92db=parseInt(_0x23ecf7[_0x3dc0('0x115')],0xa);var _0x2ae535=rs[_0x3dc0('0x116')]({'charset':'*','length':_0x3b92db});var _0x552768=_0x12c3c4[_0x3dc0('0x96')];if(_0x552768>0x0){if(_0x552768>_0x3b92db){this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x23ecf7,_0x23ecf7[_0x3dc0('0x117')]==='first'?_0x2ae535+_0x12c3c4[_0x3dc0('0x118')](_0x3b92db):_0x12c3c4[_0x3dc0('0x118')](0x0,_0x552768-_0x3b92db)+_0x2ae535);}else{this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x23ecf7,rs[_0x3dc0('0x116')]({'charset':'*','length':_0x552768}));}}else{this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x23ecf7,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x23ecf7,_0x12c3c4);}return _0x14b6ee;};AGIVertices[_0x3dc0('0x10')]['getsecretdigits']=function(_0x53b122){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x119'),_0x53b122['label']));return this[_0x3dc0('0x11a')](_0x53b122);};AGIVertices[_0x3dc0('0x10')]['goal']=function(_0x2e2344){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x11b'),_0x2e2344[_0x3dc0('0x35')]));this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x2e2344,_0x2e2344[_0x3dc0('0x11c')]);return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x11d'),_0x2e2344[_0x3dc0('0x11c')]));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x11e')]=function(_0x583803){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x583803['label']));if(!this['isConfigured'](_0x583803[_0x3dc0('0x88')])||!this['isConfigured'](_0x583803[_0x3dc0('0x82')])){return this['channel']['noop'](_0x3dc0('0x11f'));}if(!this[_0x3dc0('0x7f')](_0x583803[_0x3dc0('0x57')])){return this['channel'][_0x3dc0('0xa8')](_0x3dc0('0xa3'));}this[_0x3dc0('0xd')]['noop'](util['format'](_0x3dc0('0x120'),_0x583803[_0x3dc0('0x57')]));var _0x3178a2=this[_0x3dc0('0x81')][_0x3dc0('0xd1')](this,_0x583803);if(_0x3178a2){this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')](_0x3dc0('0x121'),_0x3178a2));var _0xbf5e26=this[_0x3dc0('0xd')][_0x3dc0('0xfd')](_0x3178a2);try{fs['unlink'](_0x3178a2+_0x3dc0('0xff'));}catch(_0x38c7b3){logger[_0x3dc0('0x30')](_0x38c7b3);}return _0xbf5e26;}return this[_0x3dc0('0xd')]['error'](_0x583803,_0x3dc0('0x122'));};AGIVertices[_0x3dc0('0x10')]['awslex']=function(_0x5542c3){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5542c3[_0x3dc0('0x35')]));if(!this['isConfigured'](_0x5542c3[_0x3dc0('0x88')])||!this[_0x3dc0('0x7f')](_0x5542c3[_0x3dc0('0x82')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x3dc0('0x7f')](_0x5542c3[_0x3dc0('0x8a')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0x123'));}if(!this[_0x3dc0('0x7f')](_0x5542c3[_0x3dc0('0x57')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xa3'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x5542c3);this[_0x3dc0('0x41')](_0x5542c3[_0x3dc0('0x57')],'in','','');this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util['format'](_0x3dc0('0x124'),_0x5542c3[_0x3dc0('0x57')]));var _0x3c9169=this[_0x3dc0('0x87')][_0x3dc0('0xd1')](this,_0x5542c3);if(_0x3c9169){for(var _0x45d36b in _0x3c9169){if(_0x3c9169[_0x3dc0('0x8f')](_0x45d36b)&&_[_0x3dc0('0x90')](_0x3c9169[_0x45d36b])){this[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')]('AWS_LEX_%s',_0x45d36b[_0x3dc0('0x64')]()),_0x3c9169[_0x45d36b]);}}if(_[_0x3dc0('0x44')](_0x3c9169[_0x3dc0('0x70')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0x125'));}else{this[_0x3dc0('0x41')](_0x3c9169['message'],_0x3dc0('0xea'),_0x3dc0('0x126'),'');return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x3c9169['message']));}}return this[_0x3dc0('0xd')]['error'](_0x5542c3,_0x3dc0('0x127'));};AGIVertices['prototype'][_0x3dc0('0x128')]=function(_0x2a0401){logger['info'](util['format'](_0x3dc0('0x129'),_0x2a0401['label'],_0x2a0401['timeout']));if(!this['isConfigured'](_0x2a0401[_0x3dc0('0x73')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xe5'));}var _0xd22e5c=_0x3dc0('0x12a');var _0x4143f6=util['format'](_0x3dc0('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x25b97d=util[_0x3dc0('0x28')]('%s.%s',_0x4143f6,_0xd22e5c);var _0x2361ed=!![];if(_0x2a0401[_0x3dc0('0x12c')]===_0x3dc0('0x12d')){_0x2361ed=![];}var _0x38bbf8=this[_0x3dc0('0xd')][_0x3dc0('0x12e')](_0x4143f6,_0xd22e5c,_0x2a0401[_0x3dc0('0x12f')],_0x2a0401[_0x3dc0('0x5f')],undefined,_0x2361ed);if(_0x38bbf8[_0x3dc0('0x9e')]!==-0x1){this['channel'][_0x3dc0('0xa8')](util['format']('google\x20%s\x20file\x20created',_0x25b97d));var _0x5cf278=this[_0x3dc0('0x8b')]['sync'](this,_0x2a0401,_0x25b97d);if(_0x5cf278){for(var _0x5c28e8 in _0x5cf278){if(_0x5cf278[_0x3dc0('0x8f')](_0x5c28e8)){this[_0x3dc0('0xd')]['setVariable'](util[_0x3dc0('0x28')](_0x3dc0('0x130'),_0x5c28e8[_0x3dc0('0x64')]()),_0x5cf278[_0x5c28e8]);}}return this['channel'][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0x3dc0('0x6c')](_0x5cf278)));}}return _0x38bbf8;};AGIVertices['prototype'][_0x3dc0('0x131')]=function(_0x4f3188){logger[_0x3dc0('0x2e')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4f3188[_0x3dc0('0x35')]));if(!this['isConfigured'](_0x4f3188[_0x3dc0('0x132')])){return this['channel'][_0x3dc0('0xa8')](_0x3dc0('0x133'));}if(!this[_0x3dc0('0x7f')](_0x4f3188[_0x3dc0('0x8d')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0x134'));}var _0x11d3cb=_0x3dc0('0x12a');var _0x47ff8f=util[_0x3dc0('0x28')](_0x3dc0('0x12b'),FILES_PATH,rs[_0x3dc0('0x116')](0x4));var _0x20b015=util['format'](_0x3dc0('0x98'),_0x47ff8f,_0x11d3cb);var _0x5c5659=!![];if(_0x4f3188[_0x3dc0('0x12c')]===_0x3dc0('0x12d')){_0x5c5659=![];}var _0x14d3cb=this['channel']['recordFile'](_0x47ff8f,_0x11d3cb,_0x4f3188[_0x3dc0('0x12f')],_0x4f3188[_0x3dc0('0x5f')],undefined,_0x5c5659);if(_0x14d3cb['result']!==-0x1){this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')](_0x3dc0('0x135'),_0x20b015));var _0x1985ae=this[_0x3dc0('0x8c')][_0x3dc0('0xd1')](this,_0x4f3188,_0x20b015);if(_0x1985ae){for(var _0x566308 in _0x1985ae){if(_0x1985ae[_0x3dc0('0x8f')](_0x566308)){this[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')]('TILDE_ASR_%s',_0x566308[_0x3dc0('0x64')]()),_0x1985ae[_0x566308]);}}return this[_0x3dc0('0xd')]['noop'](util['format']('TildeASR\x20Result\x20%s',JSON[_0x3dc0('0x6c')](_0x1985ae)));}}return _0x14d3cb;};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x136')]=function(_0x24b4cf){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x137'),_0x24b4cf[_0x3dc0('0x35')]));return this[_0x3dc0('0xd')][_0x3dc0('0x138')](_0x24b4cf[_0x3dc0('0x3a')],_0x24b4cf[_0x3dc0('0x3b')],_0x24b4cf[_0x3dc0('0x3c')]);};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x139')]=function(_0x34e4ad){logger['info'](util['format'](_0x3dc0('0x13a'),_0x34e4ad[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x34e4ad[_0x3dc0('0x13b')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x34e4ad,_0x3dc0('0x13c'));}try{var _0x589189=eval(_0x34e4ad[_0x3dc0('0x13b')])?'true':_0x3dc0('0x13d');this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x34e4ad['condition'],_0x589189));return{'code':0xc8,'result':_0x589189};}catch(_0x3a5dd8){return{'code':0xc8,'result':_0x3dc0('0x13d')};}};AGIVertices[_0x3dc0('0x10')]['gotoiftime']=function(_0x43de98){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x13e'),_0x43de98['label']));if(!this[_0x3dc0('0x7f')](_0x43de98[_0x3dc0('0x13f')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x43de98,_0x3dc0('0x140'));}var _0x15478d=this[_0x3dc0('0x24')][_0x3dc0('0xd1')](this,_0x43de98['interval_id']);if(!_0x15478d){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x43de98,_0x3dc0('0x141'));}for(var _0x52c182=0x0;_0x52c182<_0x15478d[_0x3dc0('0x96')];_0x52c182+=0x1){var _0x297288=this[_0x3dc0('0xd')]['getVariable'](util[_0x3dc0('0x28')](_0x3dc0('0x142'),_0x15478d[_0x52c182]));if(_0x297288[_0x3dc0('0x9e')]===-0x1){return _0x297288;}logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x143'),_0x15478d[_0x52c182],_0x297288[_0x3dc0('0x9b')]));if(_0x297288[_0x3dc0('0x9b')]===_0x3dc0('0x144')){logger[_0x3dc0('0x2e')](util['format'](_0x3dc0('0x143'),_0x15478d[_0x52c182],_0x3dc0('0x144')));this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util['format'](_0x3dc0('0x143'),_0x15478d[_0x52c182],_0x3dc0('0x144')));return{'code':0xc8,'result':_0x3dc0('0x144')};}else{logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x15478d[_0x52c182],_0x3dc0('0x13d')));this['channel'][_0x3dc0('0xa8')](util['format'](_0x3dc0('0x143'),_0x15478d[_0x52c182],_0x3dc0('0x13d')));}}return{'code':0xc8,'result':_0x3dc0('0x13d')};};AGIVertices[_0x3dc0('0x10')]['hangup']=function(_0x4d4e9a){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x145'),_0x4d4e9a[_0x3dc0('0x35')]));return this[_0x3dc0('0xd')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x46ab63){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x146'),_0x46ab63['label']));if(!this[_0x3dc0('0x7f')](_0x46ab63[_0x3dc0('0x73')])){return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0xe5'));}var _0x4767b1='wav';var _0x4d316d=util[_0x3dc0('0x28')](_0x3dc0('0x12b'),FILES_PATH,rs[_0x3dc0('0x116')](0x4));var _0x1e006a=util[_0x3dc0('0x28')](_0x3dc0('0x98'),_0x4d316d,_0x4767b1);var _0x222d28=!![];if(_0x46ab63[_0x3dc0('0x12c')]===_0x3dc0('0x12d')){_0x222d28=![];}var _0x3e1cd6=this['channel'][_0x3dc0('0x12e')](_0x4d316d,_0x4767b1,_0x46ab63[_0x3dc0('0x12f')],_0x46ab63[_0x3dc0('0x5f')],undefined,_0x222d28);if(_0x3e1cd6[_0x3dc0('0x9e')]!==-0x1){this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x147'),_0x1e006a));var _0x43024c=this[_0x3dc0('0x7d')][_0x3dc0('0xd1')](this,_0x46ab63,_0x1e006a);if(_0x43024c){for(var _0x533a35 in _0x43024c){if(_0x43024c['hasOwnProperty'](_0x533a35)){this[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')](_0x3dc0('0x148'),_0x533a35[_0x3dc0('0x64')]()),_0x43024c[_0x533a35]);}}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x149'),JSON['stringify'](_0x43024c)));}}return _0x3e1cd6;};AGIVertices['prototype']['ispeechtts']=function(_0x38b8b6){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x14a'),_0x38b8b6[_0x3dc0('0x35')]));if(!this['isConfigured'](_0x38b8b6['key'])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xe5'));}if(!this[_0x3dc0('0x7f')](_0x38b8b6['text'])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('no\x20text\x20configured');}this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x14b'),_0x38b8b6[_0x3dc0('0x57')]));var _0x426faa=this[_0x3dc0('0x7b')][_0x3dc0('0xd1')](this,_0x38b8b6);if(_0x426faa){this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')](_0x3dc0('0x147'),_0x426faa));var _0x45eaa0=this['channel'][_0x3dc0('0xfd')](_0x426faa,_0x38b8b6['intKey']);try{fs[_0x3dc0('0xfe')](_0x426faa+'.wav');}catch(_0x49c838){logger[_0x3dc0('0x30')](_0x49c838);}return _0x45eaa0;}return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x38b8b6,_0x3dc0('0x14c'));};AGIVertices['prototype']['login']=function(_0x1f9434){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x14d'),_0x1f9434['label']));if(!this['isConfigured'](_0x1f9434[_0x3dc0('0x14e')])){return this['channel'][_0x3dc0('0x30')](_0x1f9434,_0x3dc0('0x14f'));}logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x1f9434[_0x3dc0('0x14e')]));var _0x5e2b47=this['agentLogin'][_0x3dc0('0xd1')](this,_0x1f9434[_0x3dc0('0x14e')]);if(_0x5e2b47){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x1f9434[_0x3dc0('0x14e')]));this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util['format'](_0x3dc0('0x150'),this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x1f9434[_0x3dc0('0x14e')]));return{'code':0xc8,'result':_0x3dc0('0x151')};}else{logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3dc0('0xd')]['callerid'],_0x1f9434[_0x3dc0('0x14e')]));this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x152'),this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x1f9434['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['logout']=function(_0x4c37bf){logger[_0x3dc0('0x2e')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x4c37bf[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x4c37bf[_0x3dc0('0x14e')])){return this[_0x3dc0('0xd')]['error'](_0x4c37bf,_0x3dc0('0x14f'));}logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0x153'),this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x4c37bf[_0x3dc0('0x14e')]));var _0x382a68=this[_0x3dc0('0x4f')][_0x3dc0('0xd1')](this,_0x4c37bf[_0x3dc0('0x14e')]);if(_0x382a68){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x150'),this['channel'][_0x3dc0('0x37')],_0x4c37bf[_0x3dc0('0x14e')]));this[_0x3dc0('0xd')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3dc0('0x37')],_0x4c37bf[_0x3dc0('0x14e')]));return{'code':0xc8,'result':_0x3dc0('0x151')};}else{logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x152'),this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x4c37bf[_0x3dc0('0x14e')]));this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x152'),this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x4c37bf[_0x3dc0('0x14e')]));return{'code':0xc8,'result':_0x3dc0('0x154')};}};AGIVertices[_0x3dc0('0x10')]['math']=function(_0x7bef56){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x155'),_0x7bef56[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x7bef56[_0x3dc0('0x156')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x7bef56,'no\x20operation\x20configured');}this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')](_0x3dc0('0x157'),_0x7bef56[_0x3dc0('0x156')]));var _0x24a1ed=eval(_0x7bef56['operation']);if(!this[_0x3dc0('0x7f')](_0x7bef56[_0x3dc0('0xd5')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xd6'));}var _0xa53149=this[_0x3dc0('0x11')][_0x3dc0('0xd1')](this,_0x7bef56[_0x3dc0('0xd5')]);if(!_0xa53149){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x7bef56,'no\x20variable\x20found');}if(_['isArray'](_0x24a1ed)){var _0x32fec1=this;_0x24a1ed[_0x3dc0('0xd8')](function(_0x53a9c0,_0x6d793e){_0x32fec1[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')](_0x3dc0('0x158'),_0xa53149,_0x6d793e),_0x53a9c0);});return this['channel'][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x159'),_0xa53149));}else{return this[_0x3dc0('0xd')][_0x3dc0('0x99')](_0xa53149,_0x24a1ed);}};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0xc')]=function(_0x4fe3c3){logger['info'](util['format'](_0x3dc0('0x15a'),_0x4fe3c3[_0x3dc0('0x35')]));if(_0x4fe3c3['retry']===0x0){return this[_0x3dc0('0xa0')](_0x4fe3c3);}_0x4fe3c3[_0x3dc0('0x10e')]-=0x1;if(!this[_0x3dc0('0x7f')](_0x4fe3c3['file_id'])){return this[_0x3dc0('0xd')]['error'](_0x4fe3c3,'no\x20file\x20audio\x20selected');}var _0x2d4a47=this[_0x3dc0('0x1e')][_0x3dc0('0xd1')](this,_0x4fe3c3[_0x3dc0('0x10f')]);if(!_0x2d4a47){return this[_0x3dc0('0xd')]['error'](_0x4fe3c3,_0x3dc0('0x110'));}var _0x13b144=this[_0x3dc0('0xd')]['getData'](_0x2d4a47,_0x4fe3c3[_0x3dc0('0x112')],_0x4fe3c3['digit']);var _0x3cafce=_0x13b144[_0x3dc0('0x9e')];if(_0x13b144[_0x3dc0('0x9e')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4fe3c3,'-1');return _0x13b144;}else if(_0x13b144['extra']===_0x3dc0('0x5f')){_0x13b144['result']=_0x13b144[_0x3dc0('0x9e')]['length']>0x0?_0x13b144['result']:'t';}else if(_[_0x3dc0('0x43')](_0x13b144['result'])){_0x13b144[_0x3dc0('0x9e')]='#';_0x3cafce='#';}if(!this[_0x3dc0('0x7f')](_0x4fe3c3['variable_id'])){this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x40ec4=this[_0x3dc0('0x11')]['sync'](this,_0x4fe3c3[_0x3dc0('0xd5')]);if(!_0x40ec4){return this[_0x3dc0('0xd')]['error'](_0x4fe3c3,_0x3dc0('0xd7'));}this[_0x3dc0('0xd')][_0x3dc0('0x99')](_0x40ec4,_0x3cafce);}this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x4fe3c3,_0x3cafce);return _0x13b144;};AGIVertices[_0x3dc0('0x10')]['noop']=function(_0x2687a7){logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0x15b'),_0x2687a7[_0x3dc0('0x35')]));return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x2687a7['output']||_0x2687a7[_0x3dc0('0x35')]);};AGIVertices['prototype']['pause']=function(_0x15fb8c){logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0x15c'),_0x15fb8c[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x15fb8c['findBy'])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x15fb8c,_0x3dc0('0x14f'));}logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x153'),this[_0x3dc0('0xd')]['callerid'],_0x15fb8c['findBy']));var _0x301493=this[_0x3dc0('0x15d')][_0x3dc0('0xd1')](this,_0x15fb8c[_0x3dc0('0x15e')]);var _0x5797f8=this[_0x3dc0('0x4c')][_0x3dc0('0xd1')](this,_0x15fb8c[_0x3dc0('0x14e')],_0x301493);if(_0x5797f8){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x15fb8c['findBy']));this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x150'),this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x15fb8c[_0x3dc0('0x14e')]));return{'code':0xc8,'result':_0x3dc0('0x151')};}else{logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x152'),this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x15fb8c[_0x3dc0('0x14e')]));this['channel'][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x15fb8c[_0x3dc0('0x14e')]));return{'code':0xc8,'result':_0x3dc0('0x154')};}};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x15f')]=function(_0x2b481f){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2b481f['label']));if(!this['isConfigured'](_0x2b481f[_0x3dc0('0x10f')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x2b481f,_0x3dc0('0x160'));}var _0x305f90=this[_0x3dc0('0x1e')]['sync'](this,_0x2b481f[_0x3dc0('0x10f')]);if(!_0x305f90){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x2b481f,'no\x20file\x20audio\x20found');}var _0x1701aa=this['channel'][_0x3dc0('0xa4')](_0x3dc0('0x161'),[_0x305f90,_0x2b481f[_0x3dc0('0xe2')]]);if(_0x1701aa[_0x3dc0('0x9e')]===-0x1){return _0x1701aa;}return this['channel']['noop'](util[_0x3dc0('0x28')](_0x3dc0('0x162'),_0x3dc0('0x161'),_0x305f90));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x163')]=function(_0x5e4a59){logger[_0x3dc0('0x2e')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5e4a59[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x5e4a59[_0x3dc0('0x164')])){return this[_0x3dc0('0xd')]['error'](_0x5e4a59,'no\x20queue\x20selected');}var _0x90753e='';var _0x59ae79=parseInt(_0x5e4a59['queue_id'],0xa);if(isNaN(_0x59ae79)){_0x90753e=_0x5e4a59['queue_id'];}else{_0x90753e=this['getVoiceQueue']['sync'](this,_0x5e4a59['queue_id']);if(!_0x90753e){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x5e4a59,_0x3dc0('0x165'));}}var _0x42670a='';if(this['isConfigured'](_0x5e4a59[_0x3dc0('0x10f')])){var _0x1e9844=this['getSound']['sync'](this,_0x5e4a59[_0x3dc0('0x10f')]);if(_0x1e9844){_0x42670a=_0x1e9844;}}this['createSquareDetailsReport'][_0x3dc0('0xd1')](this,_0x5e4a59,_0x90753e);if(_0x5e4a59[_0x3dc0('0xe2')][_0x3dc0('0x166')]('x')<0x0){_0x5e4a59[_0x3dc0('0xe2')]+='x';}if(_0x5e4a59[_0x3dc0('0xe2')][_0x3dc0('0x166')]('X')<0x0){_0x5e4a59['opts']+='X';}this['channel'][_0x3dc0('0x99')](_0x3dc0('0x167'),_0x90753e?_0x90753e[_0x3dc0('0x168')]():'');var _0x509462=this[_0x3dc0('0xd')][_0x3dc0('0xa4')](_0x3dc0('0x169'),[_0x90753e,_0x5e4a59[_0x3dc0('0xe2')],_0x5e4a59[_0x3dc0('0x6b')],_0x42670a,_0x5e4a59[_0x3dc0('0x5f')],_0x5e4a59['agi'],_0x5e4a59['macro'],_0x5e4a59[_0x3dc0('0x16a')],'',_0x5e4a59[_0x3dc0('0x16b')]]);if(_0x509462[_0x3dc0('0x9e')]===-0x1){return _0x509462;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x162'),_0x3dc0('0x169'),_0x90753e));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x16c')]=function(_0x3b3540){logger['info'](util[_0x3dc0('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3b3540['label']));var _0x4bdb6c=_0x3b3540['recordingFormat']||_0x3dc0('0x12a');var _0x369065=util['format']('%s_%s',this[_0x3dc0('0xd')][_0x3dc0('0x38')],rs[_0x3dc0('0x116')](0x5));var _0x294678=util[_0x3dc0('0x28')](_0x3dc0('0x16d'),FILES_PATH,_0x369065,_0x4bdb6c);var _0x3cd11e=util[_0x3dc0('0x28')](_0x3dc0('0x12b'),FILES_PATH,_0x369065);this[_0x3dc0('0x16e')]['sync'](this,_0x3b3540,_0x369065,_0x294678);this[_0x3dc0('0xd')][_0x3dc0('0x99')](_0x3dc0('0x16f'),_0x369065);logger['info'](_0x3dc0('0x170'),_0x3cd11e,_0x4bdb6c,_0x3b3540[_0x3dc0('0x171')],_0x3b3540[_0x3dc0('0x5f')]);return this['channel'][_0x3dc0('0x12e')](_0x3cd11e,_0x4bdb6c,_0x3b3540[_0x3dc0('0x171')],_0x3b3540[_0x3dc0('0x5f')],undefined,!![]);};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x172')]=function(_0x1d84c5){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x173'),_0x1d84c5[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x1d84c5[_0x3dc0('0x6b')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('no\x20url\x20configured');}var _0x4670ac=this['restAPI'][_0x3dc0('0xd1')](this,_0x1d84c5);logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('Response:',util[_0x3dc0('0x174')](_0x4670ac,{'showHidden':![],'depth':null})));if(!this[_0x3dc0('0x7f')](_0x1d84c5[_0x3dc0('0xd5')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0x175'));}var _0x287f11=this[_0x3dc0('0x11')][_0x3dc0('0xd1')](this,_0x1d84c5[_0x3dc0('0xd5')]);if(!_0x287f11){return this[_0x3dc0('0xd')]['error'](_0x1d84c5,_0x3dc0('0xd7'));}this[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')]('%s_STATUS_CODE',_0x287f11),_0x4670ac[_0x3dc0('0x6e')]?_0x4670ac[_0x3dc0('0x6e')]:_0x3dc0('0x176'));this[_0x3dc0('0xd')][_0x3dc0('0x99')](util[_0x3dc0('0x28')](_0x3dc0('0x177'),_0x287f11),_0x4670ac[_0x3dc0('0x6f')]?_0x4670ac['statusMessage']:'OK');if(_0x4670ac[_0x3dc0('0x6d')]){try{this[_0x3dc0('0x97')](_0x4670ac[_0x3dc0('0x6d')],_0x287f11);}catch(_0x5c273b){logger['error'](util['format'](_0x3dc0('0x178'),_0x287f11));}}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x179'),_0x287f11));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x17a')]=function(_0x4c117c){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x17b'),_0x4c117c[_0x3dc0('0x35')]));return this['channel'][_0x3dc0('0x17c')](_0x4c117c[_0x3dc0('0x17d')][_0x3dc0('0xd3')](/\s+/g,''),_0x4c117c[_0x3dc0('0x171')]);};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x17e')]=function(_0x581f98){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x17f'),_0x581f98[_0x3dc0('0x35')]));return this['channel'][_0x3dc0('0x180')](_0x581f98[_0x3dc0('0x60')]['replace'](/\s+/g,''),_0x581f98[_0x3dc0('0x171')]);};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x181')]=function(_0xc93a66){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0xc93a66[_0x3dc0('0x35')]));return this[_0x3dc0('0xd')][_0x3dc0('0x182')](_0xc93a66['text'],_0xc93a66[_0x3dc0('0x171')]);};AGIVertices['prototype'][_0x3dc0('0x183')]=function(_0x26ab97){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x184'),_0x26ab97['label']));if(!this[_0x3dc0('0x7f')](_0x26ab97['account_id'])){return this[_0x3dc0('0xd')]['noop']('no\x20mail\x20account\x20configured');}var _0x30e955=this[_0x3dc0('0x21')]['sync'](this,_0x26ab97['account_id']);if(!_0x30e955||!_0x30e955[_0x3dc0('0x185')]){return this['channel'][_0x3dc0('0x30')](_0x26ab97,'no\x20mail\x20account\x20found');}var _0x25f7d0={'from':util[_0x3dc0('0x28')]('\x22%s\x22\x20<%s>',_0x30e955[_0x3dc0('0x16')],_0x30e955[_0x3dc0('0x186')]||_0x30e955[_0x3dc0('0x185')]['user']),'to':_0x26ab97['to']||'','cc':_0x26ab97['cc']||'','bcc':_0x26ab97[_0x3dc0('0x187')]||'','subject':_0x26ab97[_0x3dc0('0x188')],'html':_0x26ab97['text'],'text':_0x26ab97[_0x3dc0('0x57')]};var _0x2cbcbf={'tls':{'rejectUnauthorized':![]}};if(_0x30e955['Smtp'][_0x3dc0('0x189')]){_0x2cbcbf['service']=_0x30e955[_0x3dc0('0x185')][_0x3dc0('0x189')];}else{_0x2cbcbf[_0x3dc0('0x18a')]=_0x30e955['Smtp'][_0x3dc0('0x18a')];_0x2cbcbf[_0x3dc0('0x18b')]=_0x30e955[_0x3dc0('0x185')][_0x3dc0('0x18b')];_0x2cbcbf['secure']=_0x30e955[_0x3dc0('0x185')][_0x3dc0('0x18c')];}if(_0x30e955[_0x3dc0('0x185')][_0x3dc0('0x18d')]){_0x2cbcbf['auth']={'user':_0x30e955[_0x3dc0('0x185')][_0x3dc0('0x18e')],'pass':_0x30e955[_0x3dc0('0x185')][_0x3dc0('0x18f')]};}if(this[_0x3dc0('0x7f')](_0x26ab97[_0x3dc0('0x190')])){}logger[_0x3dc0('0xdb')](_0x3dc0('0x191'),JSON['stringify'](_0x25f7d0));this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x26ab97,_0x26ab97[_0x3dc0('0x192')]);this['channel'][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x30e955[_0x3dc0('0x16')]));this['sendMailMessage'][_0x3dc0('0xd1')](this,_0x2cbcbf,_0x25f7d0);return this[_0x3dc0('0xd')]['noop'](_0x3dc0('0x193'));};AGIVertices[_0x3dc0('0x10')]['sendFax']=function(_0xe51dc4){logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0x194'),_0xe51dc4['label']));return this['channel'][_0x3dc0('0xa8')](_0x3dc0('0x195'));};AGIVertices['prototype'][_0x3dc0('0x196')]=function(_0x5f058a){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x197'),_0x5f058a[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x5f058a[_0x3dc0('0x198')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0x199'));}var _0x1074f7=this[_0x3dc0('0x19a')][_0x3dc0('0xd1')](this,_0x5f058a[_0x3dc0('0x198')]);if(!_0x1074f7){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x5f058a,_0x3dc0('0x19b'));}var _0x373818={'body':_0x5f058a[_0x3dc0('0x19c')],'phone':_0x5f058a['to']||'','SmsAccountId':_0x1074f7['id']};logger[_0x3dc0('0xdb')](_0x3dc0('0x19d'),JSON[_0x3dc0('0x6c')](_0x373818));this['createSquareDetailsReport'][_0x3dc0('0xd1')](this,_0x5f058a,_0x5f058a[_0x3dc0('0x198')]);this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x1074f7[_0x3dc0('0x16')]));this[_0x3dc0('0x33')][_0x3dc0('0xd1')](this,_0x373818);return this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x3dc0('0x10')]['set']=function(_0x31a36b){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x31a36b['label']));if(!this[_0x3dc0('0x7f')](_0x31a36b[_0x3dc0('0xd5')])){return this[_0x3dc0('0xd')]['error'](_0x31a36b,_0x3dc0('0x19e'));}var _0x2a9f7d=this[_0x3dc0('0x11')][_0x3dc0('0xd1')](this,_0x31a36b[_0x3dc0('0xd5')]);if(!_0x2a9f7d){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x31a36b,_0x3dc0('0xd7'));}return this[_0x3dc0('0xd')][_0x3dc0('0x99')](_0x2a9f7d,_0x31a36b[_0x3dc0('0x19f')]);};AGIVertices['prototype'][_0x3dc0('0x1a0')]=function(_0x537625){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x1a1'),_0x537625[_0x3dc0('0x35')]));this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('START\x20CALLY\x20SQUARE');if(_0x537625[_0x3dc0('0xb2')]==='yes'){this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('Answer');return this[_0x3dc0('0xd')][_0x3dc0('0xb2')]();}return this['channel'][_0x3dc0('0xa8')](_0x3dc0('0x1a2'));};AGIVertices[_0x3dc0('0x10')]['subproject']=function(_0x560990){logger[_0x3dc0('0x2e')](util['format'](_0x3dc0('0x1a3'),_0x560990[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x560990[_0x3dc0('0x1a4')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x560990,_0x3dc0('0x1a5'));}var _0x1bae9f=this[_0x3dc0('0x17')]['sync'](this,_0x560990[_0x3dc0('0x1a4')]);if(!this['isConfigured'](_0x1bae9f)){return this[_0x3dc0('0xd')]['error'](_0x560990,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x560990[_0x3dc0('0x1a4')]));}if(_0x1bae9f===this['channel'][_0x3dc0('0x3f')]){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x560990,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x560990,_0x1bae9f);var _0xd8b8b=this['channel'][_0x3dc0('0xa4')]('AGI',util[_0x3dc0('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x3dc0('0x8')]['host']||_0x3dc0('0x1a6'),_0x1bae9f,this[_0x3dc0('0xd')][_0x3dc0('0x3f')]));if(_0xd8b8b['result']===-0x1){return _0xd8b8b;}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x162'),_0x3dc0('0x1a7'),_0x1bae9f));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x1a8')]=function(_0x496a73){logger[_0x3dc0('0x2e')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x496a73['label']));var _0x176040=this[_0x3dc0('0x1a9')]['sync'](this,_0x496a73[_0x3dc0('0x1aa')]);this[_0x3dc0('0x34')][_0x3dc0('0xd1')](this,_0x496a73,_0x496a73['command']);if(this['isConfigured'](_0x496a73[_0x3dc0('0xd5')])){var _0x5e33b1=this[_0x3dc0('0x11')][_0x3dc0('0xd1')](this,_0x496a73[_0x3dc0('0xd5')]);if(_0x5e33b1){this['channel']['setVariable'](_0x5e33b1,_0x176040);return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x1ab'),_0x496a73['command'],_0x5e33b1));}}return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util['format'](_0x3dc0('0x1ac'),_0x496a73['command']));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x1ad')]=function(_0x16855f){logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0x1ae'),_0x16855f['label']));_0x16855f['text']=_0x16855f[_0x3dc0('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3dc0('0x7f')](_0x16855f[_0x3dc0('0x55')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('no\x20apiKey\x20configured');}if(!this[_0x3dc0('0x7f')](_0x16855f[_0x3dc0('0x57')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')](_0x3dc0('0xa3'));}this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')](_0x3dc0('0x1af'),_0x16855f[_0x3dc0('0x57')]));var _0x30db64=this['googleCloudTTS']['sync'](this,_0x16855f);if(_0x30db64){this[_0x3dc0('0xd')]['noop'](util['format'](_0x3dc0('0x1b0'),_0x30db64));var _0x56e896=this[_0x3dc0('0xd')]['streamFile'](_0x30db64);try{fs[_0x3dc0('0xfe')](_0x30db64+_0x3dc0('0xff'));}catch(_0x3a32dc){logger[_0x3dc0('0x30')](_0x3a32dc);}return _0x56e896;}return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x16855f,_0x3dc0('0x1b1'));};AGIVertices['prototype']['tts']=function(_0x11aad9){logger['info'](util['format'](_0x3dc0('0x1b2'),_0x11aad9['label']));_0x11aad9[_0x3dc0('0x57')]=_0x11aad9[_0x3dc0('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3dc0('0x7f')](_0x11aad9[_0x3dc0('0x57')])){return this[_0x3dc0('0xd')][_0x3dc0('0xa8')]('no\x20text\x20configured');}this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util[_0x3dc0('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x11aad9[_0x3dc0('0x57')]));var _0x2c789a=this[_0x3dc0('0x5d')][_0x3dc0('0xd1')](this,_0x11aad9);if(_0x2c789a){this[_0x3dc0('0xd')]['noop'](util['format'](_0x3dc0('0x1b3'),_0x2c789a));var _0x161c5c=this[_0x3dc0('0xd')][_0x3dc0('0xfd')](_0x2c789a);try{fs['unlink'](_0x2c789a+_0x3dc0('0xff'));}catch(_0x378b96){logger[_0x3dc0('0x30')](_0x378b96);}return _0x161c5c;}return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x11aad9,_0x3dc0('0x1b4'));};AGIVertices['prototype'][_0x3dc0('0x1b5')]=function(_0x217cfc){logger[_0x3dc0('0x2e')](util['format'](_0x3dc0('0x1b6'),_0x217cfc[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x217cfc[_0x3dc0('0x14e')])){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x217cfc,'no\x20find\x20by\x20configured');}logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x153'),this['channel'][_0x3dc0('0x37')],_0x217cfc[_0x3dc0('0x14e')]));var _0x56c992=this[_0x3dc0('0x4e')]['sync'](this,_0x217cfc[_0x3dc0('0x14e')]);if(_0x56c992){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x150'),this['channel'][_0x3dc0('0x37')],_0x217cfc[_0x3dc0('0x14e')]));this[_0x3dc0('0xd')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3dc0('0xd')][_0x3dc0('0x37')],_0x217cfc['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x3dc0('0x28')](_0x3dc0('0x152'),this['channel'][_0x3dc0('0x37')],_0x217cfc['findBy']));this[_0x3dc0('0xd')][_0x3dc0('0xa8')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x3dc0('0x37')],_0x217cfc['findBy']));return{'code':0xc8,'result':_0x3dc0('0x154')};}};AGIVertices['prototype'][_0x3dc0('0x1b7')]=function(_0xb4429a){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x1b8'),_0xb4429a[_0x3dc0('0x35')]));var _0x450b15=this[_0x3dc0('0xd')][_0x3dc0('0xa4')](_0x3dc0('0x1b9'),[_0xb4429a['mailbox'],_0xb4429a[_0x3dc0('0x71')]]);if(_0x450b15[_0x3dc0('0x9e')]===-0x1){return _0x450b15;}return this[_0x3dc0('0xd')]['noop'](util[_0x3dc0('0x28')]('Executed\x20command\x20%s\x20%s',_0x3dc0('0x1b9'),_0xb4429a[_0x3dc0('0x1ba')]));};AGIVertices[_0x3dc0('0x10')][_0x3dc0('0x1bb')]=function(_0x8fdfec){logger[_0x3dc0('0x2e')](util[_0x3dc0('0x28')](_0x3dc0('0x1bc'),_0x8fdfec[_0x3dc0('0x35')]));if(!this[_0x3dc0('0x7f')](_0x8fdfec[_0x3dc0('0xd5')])){return this[_0x3dc0('0xd')]['error'](_0x8fdfec,_0x3dc0('0x19e'));}var _0x55cea4=this['getVariable']['sync'](this,_0x8fdfec[_0x3dc0('0xd5')]);if(!_0x55cea4){return this[_0x3dc0('0xd')][_0x3dc0('0x30')](_0x8fdfec,_0x3dc0('0xd7'));}var _0x32e8e9=this[_0x3dc0('0xd')][_0x3dc0('0x11')](_0x55cea4);return{'code':0xc8,'result':_0x32e8e9['extra']?_0x32e8e9[_0x3dc0('0x9b')]:'-'};};String[_0x3dc0('0x10')]['replaceAll']=function(_0xcceaa7,_0x20d167){return this[_0x3dc0('0x9a')](_0xcceaa7)[_0x3dc0('0x1bd')](_0x20d167);};module[_0x3dc0('0x1be')]=AGIVertices; \ No newline at end of file +var _0xfb8f=['channel','callerid','createSquareRecording','calleridname','context','extension','priority','arg_1','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','timeout','number','POST','method','toUpperCase','body','rawBody','rawHeaders','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','uri','headers','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','includes','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','add','delay','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','url','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','speech','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','bot','isString','AWS_LEX_%s','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','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','200','%s_STATUS_MESSAGE','statusMessage','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','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','service','host','port','secure','auth','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','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','util','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand'];(function(_0x3e8bab,_0x3a4979){var _0x2726ed=function(_0x3e7abc){while(--_0x3e7abc){_0x3e8bab['push'](_0x3e8bab['shift']());}};_0x2726ed(++_0x3a4979);}(_0xfb8f,0x18c));var _0xffb8=function(_0xec778e,_0x354656){_0xec778e=_0xec778e-0x0;var _0x1b1e1d=_0xfb8f[_0xec778e];return _0x1b1e1d;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xffb8('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xffb8('0x1'))();var rs=require(_0xffb8('0x2'));var moment=require(_0xffb8('0x3'));var Mustache=require(_0xffb8('0x4'));var rp=require(_0xffb8('0x5'));var logger=require('../../config/logger')(_0xffb8('0x6'));var config=require(_0xffb8('0x7'));var scripts=require(_0xffb8('0x8'));var FILES_PATH=_0xffb8('0x9');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xffb8('0xa'),_0xffb8('0xb'),_0xffb8('0xc')];var AGIVertices=function(_0x449f21,_0x4561e7,_0x487759){this['channel']=_0x449f21;this[_0xffb8('0xd')]=_0x4561e7;this[_0xffb8('0xe')]=_0x487759;};AGIVertices[_0xffb8('0xf')][_0xffb8('0x10')]=function(_0x42dcca,_0x507f8a){this[_0xffb8('0xd')][_0xffb8('0x11')](_0x42dcca)[_0xffb8('0x12')](function(_0x1a06b4){_0x507f8a(null,_0x1a06b4?_0x1a06b4[_0xffb8('0x13')]:![]);})['catch'](function(_0x3b4516){_0x507f8a(_0x3b4516);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x14')]=function(_0x4a38c4,_0x79b08b){this['rpc']['getVoiceQueueById'](_0x4a38c4)[_0xffb8('0x12')](function(_0x290253){_0x79b08b(null,_0x290253?_0x290253[_0xffb8('0x13')]:![]);})[_0xffb8('0x15')](function(_0x261c48){_0x79b08b(_0x261c48);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x16')]=function(_0x37b219,_0x1a310e){this['rpc']['getSquareProjectById'](_0x37b219)[_0xffb8('0x12')](function(_0x514cba){_0x1a310e(null,_0x514cba?_0x514cba['name']:![]);})['catch'](function(_0x50754f){_0x1a310e(_0x50754f);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x17')]=function(_0x31f5c8,_0x6fe61a){this['rpc'][_0xffb8('0x18')](_0x31f5c8)[_0xffb8('0x12')](function(_0x2c9e1c){_0x6fe61a(null,_0x2c9e1c?_0x2c9e1c['dsn']:![]);})[_0xffb8('0x15')](function(_0x51d7fe){_0x6fe61a(_0x51d7fe);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x19')]=function(_0x5216f0,_0x14be86){this[_0xffb8('0xd')][_0xffb8('0x1a')](_0x5216f0)[_0xffb8('0x12')](function(_0x2e83a2){_0x14be86(null,_0x2e83a2?_0x2e83a2[_0xffb8('0x13')]:![]);})[_0xffb8('0x15')](function(_0x570582){_0x14be86(_0x570582);});};AGIVertices[_0xffb8('0xf')]['getTrunk']=function(_0x3994c5,_0x383a66){this['rpc']['getTrunkById'](_0x3994c5)[_0xffb8('0x12')](function(_0x4537e3){_0x383a66(null,_0x4537e3?_0x4537e3['name']:![]);})[_0xffb8('0x15')](function(_0x457bfa){_0x383a66(_0x457bfa);});};AGIVertices['prototype'][_0xffb8('0x1b')]=function(_0x54996e,_0x5eeba5){var _0x37be0a=this;this[_0xffb8('0xd')][_0xffb8('0x1c')](_0x54996e)['then'](function(_0x5b91bc){_0x5eeba5(null,_0x5b91bc?_0x37be0a[_0xffb8('0x1d')](_0x5b91bc[_0xffb8('0x1e')]):![]);})[_0xffb8('0x15')](function(_0x2d9cf7){_0x5eeba5(_0x2d9cf7);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x1f')]=function(_0x507bbb,_0x34e1cb){this['rpc'][_0xffb8('0x20')](_0x507bbb)[_0xffb8('0x12')](function(_0x5ce2ca){_0x34e1cb(null,_0x5ce2ca?_0x5ce2ca:![]);})[_0xffb8('0x15')](function(_0x12ef31){_0x34e1cb(_0x12ef31);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x21')]=function(_0x2097a8,_0x1c3b78,_0x49012d){this[_0xffb8('0xe')][_0xffb8('0x21')](_0x2097a8,_0x1c3b78)[_0xffb8('0x12')](function(){_0x49012d(null);})[_0xffb8('0x15')](function(_0x37d179){_0x49012d(_0x37d179);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x22')]=function(_0x359c84,_0x54b4b3){this['rpc']['getIntervalById'](_0x359c84)[_0xffb8('0x12')](function(_0x1ed7dd){if(_0x1ed7dd){if(_0x1ed7dd[_0xffb8('0x23')]){_0x54b4b3(null,[_0x1ed7dd['interval']]);}else{_0x54b4b3(null,_[_0xffb8('0x24')](_0x1ed7dd[_0xffb8('0x25')],'interval'));}}else{_0x54b4b3(null,![]);}})[_0xffb8('0x15')](function(_0x364584){_0x54b4b3(_0x364584);});};AGIVertices['prototype']['getSoundPath']=function(_0x35513f){return util[_0xffb8('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x35513f);};AGIVertices[_0xffb8('0xf')][_0xffb8('0x27')]=function(_0x4d2ed4,_0x35fbc0,_0x6b1680){odbc[_0xffb8('0x28')](_0x4d2ed4,function(_0x1b65cb){if(_0x1b65cb){logger[_0xffb8('0x29')](_0xffb8('0x2a'),_0x1b65cb);_0x6b1680(_0x1b65cb);}else{logger[_0xffb8('0x2b')]('ODBC\x20connection\x20successfully');odbc['query'](_0x35fbc0,function(_0x18eed4,_0x3b709f){if(_0x18eed4){logger['info']('Error\x20executing\x20query\x20%s',_0x35fbc0);_0x6b1680(_0x18eed4);}else{logger[_0xffb8('0x2b')](_0xffb8('0x2c'),_0x35fbc0);odbc['close'](function(_0x3a3953){if(_0x3a3953){logger[_0xffb8('0x29')](_0xffb8('0x2d'),_0x3a3953);}_0x6b1680(null,_0x3b709f);});}});}});};AGIVertices['prototype'][_0xffb8('0x2e')]=function(_0x1fde31,_0x237417){this[_0xffb8('0xd')][_0xffb8('0x2f')](_0x1fde31)['then'](function(_0x163bad){_0x237417(null,_0x163bad?_0x163bad:![]);})[_0xffb8('0x15')](function(_0x4604b1){_0x237417(_0x4604b1);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x30')]=function(_0x2dc322,_0x18e124){this[_0xffb8('0xd')][_0xffb8('0x30')](_0x2dc322)[_0xffb8('0x12')](function(_0x3f57f1){_0x18e124(null,_0x3f57f1);})[_0xffb8('0x15')](function(_0x3ba754){_0x18e124(_0x3ba754);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x31')]=function(_0x3a1ec3,_0x1184ac,_0x30eda2){this[_0xffb8('0xd')][_0xffb8('0x31')]({'uniqueid':this['channel'][_0xffb8('0x32')],'node':_0x3a1ec3[_0xffb8('0x33')],'application':_0x3a1ec3[_0xffb8('0x34')],'data':_0x1184ac||null,'project_name':this[_0xffb8('0x35')]['arg_1'],'callerid':this['channel'][_0xffb8('0x36')]})[_0xffb8('0x12')](function(_0x44759b){if(_0x30eda2){_0x30eda2(null,_0x44759b);}})[_0xffb8('0x15')](function(_0x57c907){if(_0x30eda2){_0x30eda2(_0x57c907);}});};AGIVertices[_0xffb8('0xf')]['createSquareRecording']=function(_0x27ec7a,_0x4aadc2,_0x280ebc,_0xac0618){this[_0xffb8('0xd')][_0xffb8('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this['channel'][_0xffb8('0x36')],'calleridname':this['channel'][_0xffb8('0x38')],'context':this[_0xffb8('0x35')][_0xffb8('0x39')],'extension':this['channel'][_0xffb8('0x3a')],'priority':this[_0xffb8('0x35')][_0xffb8('0x3b')],'accountcode':this[_0xffb8('0x35')]['accountcode'],'dnid':this['channel']['dnid'],'projectName':this[_0xffb8('0x35')][_0xffb8('0x3c')],'saveName':_0x4aadc2,'filename':_0x27ec7a['file']||_0x4aadc2,'savePath':_0x280ebc})[_0xffb8('0x12')](function(_0x47506a){_0xac0618(null,_0x47506a);})[_0xffb8('0x15')](function(_0x35b40b){_0xac0618(_0x35b40b);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x3d')]=function(_0x1c3e91,_0x5ebaf0,_0x203db4,_0x43420b,_0x4840d9){this[_0xffb8('0xd')][_0xffb8('0x3d')]({'uniqueid':this[_0xffb8('0x35')][_0xffb8('0x32')],'body':_0x1c3e91,'direction':_0x5ebaf0,'providerName':_0x203db4,'providerResponse':_0x43420b})['then'](function(_0x13ee53){if(_0x4840d9){_0x4840d9(null,_0x13ee53);}})[_0xffb8('0x15')](function(_0x46d7cd){if(_0x4840d9){_0x4840d9(_0x46d7cd);}});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x3e')]=function(_0x40fe7b,_0x11b950){this[_0xffb8('0xd')][_0xffb8('0x3e')]({'firstName':_['isEmpty'](_0x40fe7b['name'])||_[_0xffb8('0x3f')](_0x40fe7b[_0xffb8('0x13')])?_0xffb8('0x40')+Math[_0xffb8('0x41')]():_0x40fe7b[_0xffb8('0x13')],'lastName':_['isEmpty'](_0x40fe7b[_0xffb8('0x42')])||_[_0xffb8('0x3f')](_0x40fe7b[_0xffb8('0x42')])?null:_0x40fe7b[_0xffb8('0x42')],'phone':_0x40fe7b[_0xffb8('0x43')],'ListId':_0x40fe7b['list_id'],'scheduledat':_0x40fe7b[_0xffb8('0x44')],'callbackUniqueid':this[_0xffb8('0x35')][_0xffb8('0x32')],'tags':_0xffb8('0x45'),'description':_0xffb8('0x46')+_0x40fe7b[_0xffb8('0x44')]['toString'](),'priority':_0x40fe7b[_0xffb8('0x47')]})[_0xffb8('0x12')](function(_0x5efa2f){_0x11b950(null,_0x5efa2f);})['catch'](function(_0xe9d828){_0x11b950(_0xe9d828);});};AGIVertices['prototype'][_0xffb8('0x48')]=function(_0x27c280,_0x3c6272){this['rpc']['getPauseById'](_0x27c280)[_0xffb8('0x12')](function(_0x510733){_0x3c6272(null,_0x510733?_0x510733[_0xffb8('0x13')]:![]);})[_0xffb8('0x15')](function(_0x43ec7a){_0x3c6272(_0x43ec7a);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x49')]=function(_0x2c6f0f,_0x3c4f99,_0x3788af){var _0x474591={'role':_0xffb8('0x4a')};_0x474591[_0x2c6f0f]=this[_0xffb8('0x35')]['callerid'];this[_0xffb8('0xd')][_0xffb8('0x49')](_0x474591,_0x3c4f99,this[_0xffb8('0x35')]['uniqueid'])['then'](function(_0x1f3194){_0x3788af(null,_[_0xffb8('0x3f')](_0x1f3194)?![]:!![]);})[_0xffb8('0x15')](function(_0x181075){logger[_0xffb8('0x29')](_0x181075);_0x3788af(null,![]);});};AGIVertices[_0xffb8('0xf')]['agentUnpause']=function(_0x5e838c,_0x2c31ca){var _0x533d06={'role':'agent'};_0x533d06[_0x5e838c]=this[_0xffb8('0x35')][_0xffb8('0x36')];this[_0xffb8('0xd')]['agentUnpause'](_0x533d06)[_0xffb8('0x12')](function(_0x1be3c4){_0x2c31ca(null,_['isNil'](_0x1be3c4)?![]:!![]);})[_0xffb8('0x15')](function(_0x1db70f){logger[_0xffb8('0x29')](_0x1db70f);_0x2c31ca(null,![]);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x4b')]=function(_0x112c94,_0x169365){var _0x1c85cf={'role':_0xffb8('0x4a')};_0x1c85cf[_0x112c94]=this[_0xffb8('0x35')]['callerid'];this[_0xffb8('0xd')][_0xffb8('0x4b')](_0x1c85cf)[_0xffb8('0x12')](function(_0x4d1b3b){_0x169365(null,_[_0xffb8('0x3f')](_0x4d1b3b)?![]:!![]);})[_0xffb8('0x15')](function(_0x3872a6){logger['error'](_0x3872a6);_0x169365(null,![]);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x4c')]=function(_0x5b8606,_0x269435){var _0x5e35cb={'role':'agent'};_0x5e35cb[_0x5b8606]=this[_0xffb8('0x35')][_0xffb8('0x36')];var _0x39c74a=_0x5b8606!=_0xffb8('0x4d')?util[_0xffb8('0x26')](_0xffb8('0x4e'),_0xffb8('0x4f'),this[_0xffb8('0x35')]['callerid']):undefined;this[_0xffb8('0xd')]['agentLogin'](_0x5e35cb,_0x39c74a)[_0xffb8('0x12')](function(_0x1db2b7){_0x269435(null,_['isNil'](_0x1db2b7)?![]:!![]);})[_0xffb8('0x15')](function(_0x416b31){logger[_0xffb8('0x29')](_0x416b31);_0x269435(null,![]);});};AGIVertices['prototype'][_0xffb8('0x50')]=function(_0x35d90b,_0x261fd6){sh[_0xffb8('0x51')](_[_0xffb8('0x52')](_0x35d90b),function(_0x4110a6,_0x440b02){var _0x56c2d9=_0x440b02[_0xffb8('0x53')](/(\r\n|\n|\r)/gm,'');_0x261fd6(null,_0x56c2d9);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x54')]=function(_0x14e724,_0x2aee32){scripts[_0xffb8('0x54')](_0x14e724['apiKey'],_0x14e724[_0xffb8('0x55')]||_0xffb8('0x56'),_0x14e724['text'],_0x14e724[_0xffb8('0x57')]||'en-US',_0x14e724[_0xffb8('0x58')]||_0xffb8('0x59'),_0x14e724[_0xffb8('0x5a')]||_0xffb8('0x5b'))[_0xffb8('0x12')](function(_0x47da0a){_0x2aee32(null,_0x47da0a);})[_0xffb8('0x15')](function(_0x3092de){_0x2aee32(_0x3092de);});};AGIVertices['prototype']['googleTTS']=function(_0x4336e1,_0x3afccf){scripts['googleTTS'](_0x4336e1[_0xffb8('0x56')],_0x4336e1['google_tts_language']||'en',0x1)['then'](function(_0x407a9b){_0x3afccf(null,_0x407a9b);})[_0xffb8('0x15')](function(_0x26ad47){_0x3afccf(_0x26ad47);});};AGIVertices[_0xffb8('0xf')]['restAPI']=function(_0x589ca7,_0x12ef38){var _0x1b82bd={'uri':_0x589ca7['url'],'method':_0x589ca7['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x589ca7[_0xffb8('0x5c')])===_0xffb8('0x5d')&&parseInt(_0x589ca7[_0xffb8('0x5c')])>=0x1?parseInt(_0x589ca7['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xffb8('0x5e'),'PUT'],_0x1b82bd[_0xffb8('0x5f')][_0xffb8('0x60')]())){try{_0x1b82bd[_0xffb8('0x61')]=_0x589ca7[_0xffb8('0x62')]?JSON['parse'](_0x589ca7['rawBody']):{};}catch(_0x130622){logger[_0xffb8('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x130622);}}try{_0x1b82bd['headers']=_0x589ca7[_0xffb8('0x63')]?JSON[_0xffb8('0x64')](_0x589ca7[_0xffb8('0x63')]):{};}catch(_0x273e31){logger[_0xffb8('0x29')](_0xffb8('0x65'),_0x273e31);}if(_0x589ca7['computedVariables']){try{var _0x31700e=require(_0x589ca7['computedVariables'])['sync'](this,_0x1b82bd);_0x1b82bd[_0xffb8('0x66')]=Mustache['render'](_0x589ca7['url'],_0x31700e,{},['$$','$$']);if(_0x1b82bd[_0xffb8('0x67')]){_0x1b82bd[_0xffb8('0x67')]=JSON[_0xffb8('0x64')](Mustache[_0xffb8('0x68')](JSON[_0xffb8('0x69')](_0x1b82bd['headers']),_0x31700e,{},['$$','$$']));}if(_0x1b82bd['body']){_0x1b82bd[_0xffb8('0x61')]=JSON['parse'](Mustache['render'](JSON[_0xffb8('0x69')](_0x1b82bd[_0xffb8('0x61')]),_0x31700e,{},['$$','$$']));}}catch(_0x4e7663){logger[_0xffb8('0x29')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4e7663);}}rp(_0x1b82bd)[_0xffb8('0x12')](function(_0x1006a6){var _0x4f5a94={'statusCode':_0x1006a6[_0xffb8('0x6a')]||0xc8,'statusMessage':_0x1006a6['statusMessage']||'OK','headers':_0x1006a6[_0xffb8('0x67')]||{},'body':_0x1006a6[_0xffb8('0x61')]||{}};_0x12ef38(null,_0x4f5a94);})[_0xffb8('0x15')](function(_0x20883e){var _0x16ebe7={'statusCode':_0x20883e[_0xffb8('0x6a')]||0x1f4,'statusMessage':_0x20883e[_0xffb8('0x6b')]||_0xffb8('0x6c'),'headers':_0x20883e[_0xffb8('0x6d')][_0xffb8('0x67')]||{},'body':_0x20883e[_0xffb8('0x6d')][_0xffb8('0x61')]||{}};_0x12ef38(null,_0x16ebe7);});};AGIVertices[_0xffb8('0xf')]['googleDialogflow']=function(_0x46ed5b,_0x398907){scripts[_0xffb8('0x6e')](this['channel']['uniqueid'],_0x46ed5b[_0xffb8('0x6f')],_0x46ed5b[_0xffb8('0x56')],_0x46ed5b[_0xffb8('0x70')]||'en')[_0xffb8('0x12')](function(_0x179849){_0x398907(null,_0x179849);})['catch'](function(_0x311ff8){_0x398907(_0x311ff8);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x71')]=function(_0x36ae4e,_0x294e7b){scripts[_0xffb8('0x71')](this[_0xffb8('0x35')][_0xffb8('0x32')],_0x36ae4e['dialogflowV2_project_id'],_0x36ae4e[_0xffb8('0x72')],_0x36ae4e[_0xffb8('0x73')],_0x36ae4e[_0xffb8('0x56')],_0x36ae4e[_0xffb8('0x74')]||'en')[_0xffb8('0x12')](function(_0x1ec8dd){_0x294e7b(null,_0x1ec8dd);})[_0xffb8('0x15')](function(_0x1cefe8){_0x294e7b(_0x1cefe8);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x75')]=function(_0x37fe88,_0x52e5b8){scripts[_0xffb8('0x75')](this[_0xffb8('0x35')],_0x37fe88)[_0xffb8('0x12')](function(_0x5e1990){_0x52e5b8(null,_0x5e1990);})[_0xffb8('0x15')](function(_0x5b0ebe){_0x52e5b8(_0x5b0ebe);});};AGIVertices[_0xffb8('0xf')]['ispeechTTS']=function(_0x10df6b,_0x10cf88){scripts[_0xffb8('0x76')](_0x10df6b[_0xffb8('0x6f')],_0x10df6b[_0xffb8('0x56')],_0x10df6b[_0xffb8('0x77')]||_0xffb8('0x78'),_0x10df6b['speed'])[_0xffb8('0x12')](function(_0x58a375){_0x10cf88(null,_0x58a375);})[_0xffb8('0x15')](function(_0xf3eb63){_0x10cf88(_0xf3eb63);});};AGIVertices['prototype'][_0xffb8('0x79')]=function(_0x205162,_0x51d9bc,_0x480b32){scripts[_0xffb8('0x79')](_0x51d9bc,_0x205162['key'],_0x205162[_0xffb8('0x7a')]||_0xffb8('0x78'),this[_0xffb8('0x7b')](_0x205162[_0xffb8('0x7c')])?_0x205162['model']:undefined)[_0xffb8('0x12')](function(_0x4589b4){_0x480b32(null,_0x4589b4);})[_0xffb8('0x15')](function(_0x1445c8){_0x480b32(_0x1445c8);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x7d')]=function(_0x1ac729,_0x1b9a3e){scripts[_0xffb8('0x7d')](_0x1ac729[_0xffb8('0x7e')],_0x1ac729['aws_secret_access_key'],_0x1ac729[_0xffb8('0x7f')],_0x1ac729[_0xffb8('0x80')]||'Amy',_0x1ac729[_0xffb8('0x56')],_0x1ac729[_0xffb8('0x81')]||'text')['then'](function(_0x51ff4f){_0x1b9a3e(null,_0x51ff4f);})[_0xffb8('0x15')](function(_0x500690){_0x1b9a3e(_0x500690);});};AGIVertices['prototype'][_0xffb8('0x82')]=function(_0x23c02c,_0x129ba0){scripts[_0xffb8('0x82')](this[_0xffb8('0x35')][_0xffb8('0x32')],_0x23c02c['aws_access_key_id'],_0x23c02c[_0xffb8('0x83')],_0x23c02c['aws_lex_region'],_0x23c02c[_0xffb8('0x56')],_0x23c02c[_0xffb8('0x84')])['then'](function(_0x10885d){_0x129ba0(null,_0x10885d);})['catch'](function(_0x5bbac8){_0x129ba0(_0x5bbac8);});};AGIVertices['prototype']['googleASR']=function(_0x34509f,_0x6e0c0a,_0x5ddc31){scripts[_0xffb8('0x85')](_0x6e0c0a,_0x34509f[_0xffb8('0x6f')],_0x34509f[_0xffb8('0x86')]||'en-US')[_0xffb8('0x12')](function(_0x5b06ff){_0x5ddc31(null,_0x5b06ff);})[_0xffb8('0x15')](function(_0x113a95){_0x5ddc31(_0x113a95);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x87')]=function(_0x4a57d5,_0x1c3bba,_0x46b928){scripts[_0xffb8('0x87')](_0x1c3bba,_0x4a57d5[_0xffb8('0x88')],_0x4a57d5[_0xffb8('0x89')],_0x4a57d5[_0xffb8('0x66')])[_0xffb8('0x12')](function(_0x406541){_0x46b928(null,_0x406541);})[_0xffb8('0x15')](function(_0x493418){_0x46b928(_0x493418);});};AGIVertices[_0xffb8('0xf')][_0xffb8('0x8a')]=function(_0x2b6ccd){var _0x391392=_['includes'](verticesWithRetry,_0x2b6ccd[_0xffb8('0x34')])?_0x2b6ccd:_[_0xffb8('0x8b')](_0x2b6ccd);for(var _0x40ecba in _0x391392){if(_0x391392['hasOwnProperty'](_0x40ecba)){if(_0x391392[_0x40ecba]&&_['isString'](_0x391392[_0x40ecba])){if(_[_0xffb8('0x8c')](recursiveMapAttributes,_0x40ecba)){_0x391392[_0x40ecba]=this['replaceObjectAllVariables'](_0x391392[_0x40ecba]);}else{_0x391392[_0x40ecba]=this[_0xffb8('0x8d')](_0x391392[_0x40ecba]);}}}}return _0x391392;};AGIVertices[_0xffb8('0xf')][_0xffb8('0x8e')]=function(_0x3ba66c){for(var _0x3c8ae5 in _0x3ba66c){if(_0x3ba66c[_0xffb8('0x8f')](_0x3c8ae5)){if(_[_0xffb8('0x90')](_0x3ba66c[_0x3c8ae5])){this[_0xffb8('0x8e')](_0x3ba66c[_0x3c8ae5]);}else if(_[_0xffb8('0x91')](_0x3ba66c[_0x3c8ae5])){for(var _0x5628c2=0x0;_0x5628c2<_0x3ba66c[_0x3c8ae5][_0xffb8('0x92')];_0x5628c2++){this[_0xffb8('0x8e')](_0x3ba66c[_0x3c8ae5][_0x5628c2]);}}else if(_['isString'](_0x3ba66c[_0x3c8ae5])){_0x3ba66c[_0x3c8ae5]=this[_0xffb8('0x8d')](_0x3ba66c[_0x3c8ae5]);}}}};AGIVertices[_0xffb8('0xf')][_0xffb8('0x93')]=function(_0x296a8c,_0x47edd3){for(var _0x15a5b3 in _0x296a8c){if(_0x296a8c[_0xffb8('0x8f')](_0x15a5b3)){if(_[_0xffb8('0x90')](_0x296a8c[_0x15a5b3])){if(!_['isEmpty'](_0x296a8c[_0x15a5b3])){this[_0xffb8('0x93')](_0x296a8c[_0x15a5b3],util[_0xffb8('0x26')](_0xffb8('0x94'),_0x47edd3,_0x15a5b3));}}else if(_[_0xffb8('0x91')](_0x296a8c[_0x15a5b3])){for(var _0x81c3a3=0x0;_0x81c3a3<_0x296a8c[_0x15a5b3]['length'];_0x81c3a3++){this[_0xffb8('0x93')](_0x296a8c[_0x15a5b3][_0x81c3a3],util[_0xffb8('0x26')](_0xffb8('0x94'),_0x47edd3,_0x15a5b3+'['+_0x81c3a3+']'));}}else{if(!_['isNil'](_0x296a8c[_0x15a5b3])){this[_0xffb8('0x35')][_0xffb8('0x95')](util[_0xffb8('0x26')]('%s.%s',_0x47edd3,_0x15a5b3),_0x296a8c[_0x15a5b3]);}}}}};AGIVertices[_0xffb8('0xf')][_0xffb8('0x96')]=function(_0x482a78){try{var _0xfb56b5=JSON[_0xffb8('0x64')](_0x482a78);this[_0xffb8('0x8e')](_0xfb56b5);return JSON[_0xffb8('0x69')](_0xfb56b5);}catch(_0x1fd446){return this[_0xffb8('0x8d')](_0x482a78);}};AGIVertices[_0xffb8('0xf')]['replaceAllVariables']=function(_0x1f4d02){var _0x245020=_0x1f4d02['split']('{');for(var _0x519481=0x1;_0x519481<_0x245020[_0xffb8('0x92')];_0x519481+=0x1){var _0x5326c0=_0x245020[_0x519481]['split']('}');if(_0x5326c0[_0xffb8('0x92')]>0x1){_0x1f4d02=_0x1f4d02[_0xffb8('0x97')]('{'+_0x5326c0[0x0]+'}',this[_0xffb8('0x35')]['getVariable'](_0x5326c0[0x0])[_0xffb8('0x98')]||_0x5326c0[0x0]);}}if(_0x245020[_0xffb8('0x92')]===0x1){return _0x1f4d02[_0xffb8('0x99')]();}return this[_0xffb8('0x8d')](_0x1f4d02);};AGIVertices[_0xffb8('0xf')][_0xffb8('0x9a')]=function(_0x15ed3f,_0x108e60){var _0x4028a1=this[_0xffb8('0x35')][_0xffb8('0x10')](_0x15ed3f);if(_0x4028a1[_0xffb8('0x9b')]===-0x1){return _0x4028a1;}logger[_0xffb8('0x2b')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x108e60,_0x4028a1['extra']));return this[_0xffb8('0x35')][_0xffb8('0x95')](_0x108e60,_0x4028a1[_0xffb8('0x98')]);};AGIVertices[_0xffb8('0xf')][_0xffb8('0x7b')]=function(_0x4038e1){return _0x4038e1&&_0x4038e1!=='0'&&_0x4038e1!=='-1'&&_0x4038e1!=='';};AGIVertices[_0xffb8('0xf')][_0xffb8('0x9c')]=function(_0x1fffe1){this['createSquareDetailsReport']['sync'](this,_0x1fffe1,'-');_0x1fffe1[_0xffb8('0x9d')]=_0x1fffe1[_0xffb8('0x9c')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xffb8('0xf')][_0xffb8('0x9e')]=function(_0x55aca2){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x9f'),_0x55aca2['label']));if(!this[_0xffb8('0x7b')](_0x55aca2[_0xffb8('0x56')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa1'));}var _0x52e752='\x22'+_0x55aca2[_0xffb8('0x56')]+'\x22';if(this[_0xffb8('0x7b')](_0x55aca2['options'])){_0x52e752+=','+_0x55aca2[_0xffb8('0x6d')];}var _0x49503d=this['channel'][_0xffb8('0x51')](_0xffb8('0xa2'),_0x52e752);if(_0x49503d[_0xffb8('0x9b')]===-0x1){return _0x49503d;}return this[_0xffb8('0x35')]['noop'](util['format'](_0xffb8('0xa3'),_0x52e752));};AGIVertices[_0xffb8('0xf')][_0xffb8('0xa4')]=function(_0x35b638){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x35b638['label']));if(!this['isConfigured'](_0x35b638[_0xffb8('0xa5')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa6'));}var _0x3e361c=_0x35b638['grammar'];if(this[_0xffb8('0x7b')](_0x35b638[_0xffb8('0x6d')])){_0x3e361c+=','+_0x35b638[_0xffb8('0x6d')];}var _0x10ed6d=this['channel'][_0xffb8('0x51')](_0xffb8('0xa7'),_0x3e361c);if(_0x10ed6d[_0xffb8('0x9b')]===-0x1){return _0x10ed6d;}var _0x4ca991=this['getAndSetVariable'](_0xffb8('0xa8'),'MRCP_RECOG_CONFIDENCE');if(_0x4ca991[_0xffb8('0x9b')]===-0x1){return _0x4ca991;}var _0x3f978f=this[_0xffb8('0x9a')](_0xffb8('0xa9'),_0xffb8('0xaa'));if(_0x3f978f[_0xffb8('0x9b')]===-0x1){return _0x3f978f;}var _0x5a0c1d=this[_0xffb8('0x9a')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5a0c1d['result']===-0x1){return _0x5a0c1d;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xab'),_0x3e361c));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x6')]=function(_0x48268b){logger['info'](util[_0xffb8('0x26')](_0xffb8('0xac'),_0x48268b[_0xffb8('0x33')]));return this['channel'][_0xffb8('0x6')]([_0x48268b[_0xffb8('0xad')],_0x48268b[_0xffb8('0xae')]]);};AGIVertices[_0xffb8('0xf')][_0xffb8('0xaf')]=function(_0x1c90ab){logger[_0xffb8('0x2b')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1c90ab[_0xffb8('0x33')]));if(this['isConfigured'](_0x1c90ab[_0xffb8('0x5c')])){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0xb0'),_0x1c90ab[_0xffb8('0x5c')]));var _0x4ba98c=this[_0xffb8('0x35')][_0xffb8('0xb1')](_0x1c90ab[_0xffb8('0x5c')]);if(_0x4ba98c[_0xffb8('0x9b')]===-0x1){return _0x4ba98c;}}return this['channel'][_0xffb8('0xaf')]();};AGIVertices['prototype']['callback']=function(_0x3f4963){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0xb2'),_0x3f4963[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x3f4963[_0xffb8('0xb3')])){return this['channel']['error'](_0x3f4963,'no\x20list\x20selected');}_0x3f4963[_0xffb8('0x44')]=moment();if(this['isConfigured'](_0x3f4963['delay'])){_0x3f4963['scheduledAt']=moment()[_0xffb8('0xb4')](_0x3f4963[_0xffb8('0xb5')],_0xffb8('0xb6'));}if(!this['isConfigured'](_0x3f4963[_0xffb8('0x47')])){_0x3f4963['callback_priority']=0x2;}this[_0xffb8('0x3e')][_0xffb8('0xb7')](this,_0x3f4963);return this['channel'][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xb8'),_0x3f4963[_0xffb8('0x43')],_0x3f4963['list_id'],_0x3f4963[_0xffb8('0x44')]));};AGIVertices[_0xffb8('0xf')][_0xffb8('0xb9')]=function(_0x263973){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x263973[_0xffb8('0x33')]));var _0x1da55e=this['channel'][_0xffb8('0x51')](_0x263973[_0xffb8('0xba')],_0x263973[_0xffb8('0x6d')]);if(_0x1da55e['result']===-0x1){return _0x1da55e;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xbb'),_0x263973[_0xffb8('0xba')],_0x263973[_0xffb8('0x6d')]));};AGIVertices[_0xffb8('0xf')]['lumenvoxtts']=function(_0xc4a153){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0xbc'),_0xc4a153['label']));if(!this[_0xffb8('0x7b')](_0xc4a153[_0xffb8('0x56')])){return this[_0xffb8('0x35')]['noop'](_0xffb8('0xa1'));}var _0x4762e9='\x22'+_0xc4a153[_0xffb8('0x56')]+'\x22';if(this['isConfigured'](_0xc4a153[_0xffb8('0x6d')])){_0x4762e9+=','+_0xc4a153[_0xffb8('0x6d')];}var _0x541818=this[_0xffb8('0x35')]['exec']('MRCPSynth',_0x4762e9);if(_0x541818['result']===-0x1){return _0x541818;}return this[_0xffb8('0x35')]['noop'](util[_0xffb8('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4762e9));};AGIVertices[_0xffb8('0xf')][_0xffb8('0xbd')]=function(_0x51f58e){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0xbe'),_0x51f58e[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x51f58e['text'])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa1'));}var _0x2d6382='\x22'+_0x51f58e[_0xffb8('0x56')]+'\x22';if(this[_0xffb8('0x7b')](_0x51f58e[_0xffb8('0x6d')])){_0x2d6382+=','+_0x51f58e['options'];}var _0x5df5c3=this[_0xffb8('0x35')]['exec'](_0xffb8('0xa2'),_0x2d6382);if(_0x5df5c3[_0xffb8('0x9b')]===-0x1){return _0x5df5c3;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0xa3'),_0x2d6382));};AGIVertices[_0xffb8('0xf')]['lumenvoxasr']=function(_0x5707fa){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0xbf'),_0x5707fa['label']));if(!this['isConfigured'](_0x5707fa['grammar'])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa6'));}var _0x313587=_0x5707fa[_0xffb8('0xa5')];if(this[_0xffb8('0x7b')](_0x5707fa[_0xffb8('0x6d')])){_0x313587+=','+_0x5707fa['options'];}var _0x16199f=this['channel']['exec'](_0xffb8('0xa7'),_0x313587);if(_0x16199f[_0xffb8('0x9b')]===-0x1){return _0x16199f;}var _0x3a099f=this[_0xffb8('0x9a')]('RECOG_CONFIDENCE()',_0xffb8('0xc0'));if(_0x3a099f[_0xffb8('0x9b')]===-0x1){return _0x3a099f;}var _0x202d5d=this[_0xffb8('0x9a')](_0xffb8('0xa9'),_0xffb8('0xc1'));if(_0x202d5d[_0xffb8('0x9b')]===-0x1){return _0x202d5d;}var _0x4a3e2b=this[_0xffb8('0x9a')](_0xffb8('0xc2'),_0xffb8('0xc3'));if(_0x4a3e2b[_0xffb8('0x9b')]===-0x1){return _0x4a3e2b;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xab'),_0x313587));};AGIVertices['prototype'][_0xffb8('0xc4')]=function(_0x3542ce){logger['info'](util[_0xffb8('0x26')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x3542ce[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x3542ce[_0xffb8('0xa5')])){return this['channel'][_0xffb8('0xa0')](_0xffb8('0xa6'));}var _0x5e4c1c=_0x3542ce[_0xffb8('0xa5')];if(this[_0xffb8('0x7b')](_0x3542ce['options'])){_0x5e4c1c+=','+_0x3542ce['options'];}var _0xdae42e=this['channel'][_0xffb8('0x51')](_0xffb8('0xa7'),_0x5e4c1c);if(_0xdae42e[_0xffb8('0x9b')]===-0x1){return _0xdae42e;}var _0x2a0d97=this[_0xffb8('0x9a')](_0xffb8('0xa8'),_0xffb8('0xc5'));if(_0x2a0d97['result']===-0x1){return _0x2a0d97;}var _0x5e42f2=this['getAndSetVariable']('RECOG_INPUT()',_0xffb8('0xc6'));if(_0x5e42f2['result']===-0x1){return _0x5e42f2;}var _0x9f394d=this[_0xffb8('0x9a')](_0xffb8('0xc2'),'SESTEK_ASR_INSTANCE');if(_0x9f394d[_0xffb8('0x9b')]===-0x1){return _0x9f394d;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xab'),_0x5e4c1c));};AGIVertices[_0xffb8('0xf')][_0xffb8('0xc7')]=function(_0x3ca414){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0xc8'),_0x3ca414[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x3ca414['odbc_id'])){return this['channel'][_0xffb8('0x29')](_0x3ca414,_0xffb8('0xc9'));}var _0x8ed596=this[_0xffb8('0x17')][_0xffb8('0xb7')](this,_0x3ca414[_0xffb8('0xca')]);if(!_0x8ed596){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x3ca414,_0xffb8('0xcb'));}if(!this[_0xffb8('0x7b')](_0x3ca414[_0xffb8('0xcc')])){return this['channel'][_0xffb8('0x29')](_0x3ca414,'no\x20query\x20configured');}var _0x52feeb=_0x3ca414[_0xffb8('0xcc')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xffb8('0x26')](_0xffb8('0xcd'),_0x52feeb));var _0x126230=this[_0xffb8('0x27')][_0xffb8('0xb7')](this,_0x8ed596,_0x52feeb);this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0x3ca414,_0x52feeb);if(!this[_0xffb8('0x7b')](_0x3ca414[_0xffb8('0xce')])){return this['channel'][_0xffb8('0xa0')](_0xffb8('0xcf'));}var _0x2e84c9=this[_0xffb8('0x10')][_0xffb8('0xb7')](this,_0x3ca414['variable_id']);if(!_0x2e84c9){return this['channel']['error'](_0x3ca414,_0xffb8('0xd0'));}var _0x2696d7=this;_0x126230['forEach'](function(_0x54bd4c,_0x11efd8){Object['keys'](_0x54bd4c)[_0xffb8('0xd1')](function(_0x42e437){_0x2696d7[_0xffb8('0x35')]['setVariable'](util[_0xffb8('0x26')](_0xffb8('0xd2'),_0x2e84c9,_0x11efd8,_0x42e437),_0x54bd4c[_0x42e437]);});});this[_0xffb8('0x35')][_0xffb8('0x95')](util[_0xffb8('0x26')]('%s_ROWS_COUNT',_0x2e84c9),_0x126230[_0xffb8('0x92')]);return this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0xd3'),_0x2e84c9));};AGIVertices[_0xffb8('0xf')][_0xffb8('0xd4')]=function(_0xaa7fbe){logger['debug'](util[_0xffb8('0x26')](_0xffb8('0xd5'),_0xaa7fbe[_0xffb8('0x33')]));if(!this['isConfigured'](_0xaa7fbe[_0xffb8('0xd6')])){return this['channel'][_0xffb8('0x29')](_0xaa7fbe,_0xffb8('0xd7'));}var _0x84ad7d=this[_0xffb8('0x19')]['sync'](this,_0xaa7fbe['sip_id']);if(!_0x84ad7d){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0xaa7fbe,_0xffb8('0xd8'));}var _0x38295f=this[_0xffb8('0x35')][_0xffb8('0x51')](_0xffb8('0xd9'),[util[_0xffb8('0x26')]('SIP/%s',_0x84ad7d),_0xaa7fbe[_0xffb8('0x5c')],_0xaa7fbe['opts'],_0xaa7fbe[_0xffb8('0xda')]]);if(_0x38295f[_0xffb8('0x9b')]===-0x1){return _0x38295f;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xdb'),_0xffb8('0xd9')));};AGIVertices[_0xffb8('0xf')]['dialogflow']=function(_0x11098e){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0xdc'),_0x11098e[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x11098e[_0xffb8('0x6f')])){return this['channel'][_0xffb8('0xa0')]('no\x20key\x20configured');}if(!this[_0xffb8('0x7b')](_0x11098e[_0xffb8('0x56')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa1'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x11098e);this[_0xffb8('0x3d')](_0x11098e[_0xffb8('0x56')],'in','','');this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')]('Trying\x20Dialogflow:\x20%s',_0x11098e[_0xffb8('0x56')]));var _0x4cdcce=this[_0xffb8('0x6e')][_0xffb8('0xb7')](this,_0x11098e);if(_0x4cdcce){for(var _0x3d8340 in _0x4cdcce){if(_0x4cdcce['hasOwnProperty'](_0x3d8340)){this[_0xffb8('0x35')][_0xffb8('0x95')](util[_0xffb8('0x26')](_0xffb8('0xdd'),_0x3d8340['toUpperCase']()),_0x4cdcce[_0x3d8340]);}}this[_0xffb8('0x3d')](_0x4cdcce['speech'],_0xffb8('0xde'),_0xffb8('0xdf'),'');return this['channel'][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xe0'),_0x4cdcce[_0xffb8('0xe1')]));}return this[_0xffb8('0x35')]['error'](_0x11098e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xffb8('0xf')][_0xffb8('0xe2')]=function(_0x3984e6){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3984e6['label']));if(!this[_0xffb8('0x7b')](_0x3984e6[_0xffb8('0xe3')])){return this['channel'][_0xffb8('0xa0')](_0xffb8('0xe4'));}if(!this['isConfigured'](_0x3984e6['client_email'])){return this[_0xffb8('0x35')]['noop'](_0xffb8('0xe5'));}if(!this[_0xffb8('0x7b')](_0x3984e6[_0xffb8('0x73')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xe6'));}if(!this[_0xffb8('0x7b')](_0x3984e6[_0xffb8('0x74')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xe7'));}if(!this[_0xffb8('0x7b')](_0x3984e6[_0xffb8('0x56')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')]('no\x20text\x20configured');}this[_0xffb8('0x35')]['bot']=!![];this[_0xffb8('0x31')](_0x3984e6);this[_0xffb8('0x3d')](_0x3984e6[_0xffb8('0x56')],'in','','');this['channel'][_0xffb8('0xa0')](util['format'](_0xffb8('0xe8'),_0x3984e6['text']));var _0x437a9c=this['googleDialogflowV2'][_0xffb8('0xb7')](this,_0x3984e6);if(_0x437a9c){for(var _0x373746 in _0x437a9c){if(_0x437a9c[_0xffb8('0x8f')](_0x373746)){if(_0x373746!=='providerResponse'){this[_0xffb8('0x35')]['setVariable'](util[_0xffb8('0x26')]('DIALOGFLOW_%s',_0x373746['toUpperCase']()),_0x437a9c[_0x373746]);}}}this[_0xffb8('0x3d')](_0x437a9c[_0xffb8('0xe1')],_0xffb8('0xde'),_0xffb8('0xe2'),_0x437a9c['providerResponse']);return this[_0xffb8('0x35')]['noop'](util['format'](_0xffb8('0xe9'),_0x437a9c[_0xffb8('0xe1')]));}return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x3984e6,_0xffb8('0xea'));};AGIVertices['prototype'][_0xffb8('0xeb')]=function(_0x22e0de){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0xec'),_0x22e0de[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x22e0de[_0xffb8('0xed')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xffb8('0x7b')](_0x22e0de[_0xffb8('0xee')])){return this[_0xffb8('0x35')]['noop']('no\x20username\x20configured');}if(!this['isConfigured'](_0x22e0de[_0xffb8('0xef')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')]('no\x20password\x20configured');}if(!this[_0xffb8('0x7b')](_0x22e0de[_0xffb8('0xf0')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa1'));}this['channel']['bot']=!![];this[_0xffb8('0x31')](_0x22e0de);this[_0xffb8('0x3d')](_0x22e0de[_0xffb8('0x56')],'in','','');this['channel']['noop'](util[_0xffb8('0x26')](_0xffb8('0xf1'),_0x22e0de[_0xffb8('0x56')]));var _0x4c6247=this[_0xffb8('0x75')][_0xffb8('0xb7')](this,_0x22e0de);if(_0x4c6247){for(var _0x2f1233 in _0x4c6247){if(_0x4c6247['hasOwnProperty'](_0x2f1233)){this[_0xffb8('0x35')][_0xffb8('0x95')](util[_0xffb8('0x26')]('SESTEK_NDA_%s',_0x2f1233[_0xffb8('0x60')]()),_0x4c6247[_0x2f1233]);}}this[_0xffb8('0x3d')](_0x4c6247[_0xffb8('0xe1')],'out',_0xffb8('0xeb'),'');if(_0x4c6247[_0xffb8('0xf2')]){this[_0xffb8('0x35')]['noop'](util[_0xffb8('0x26')](_0xffb8('0xf3'),_0x4c6247[_0xffb8('0xf2')]));var _0x137b35=this[_0xffb8('0x35')][_0xffb8('0xf4')](_0x4c6247['audiofile']);try{fs['unlink'](_0x4c6247[_0xffb8('0xf2')]+_0xffb8('0xf5'));}catch(_0x5f07b1){logger['error'](_0x5f07b1);}return _0x137b35;}else{return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xf6'),_0x4c6247[_0xffb8('0xe1')]));}}return this[_0xffb8('0x35')]['error'](_0x22e0de,_0xffb8('0xf7'));};AGIVertices[_0xffb8('0xf')][_0xffb8('0xf8')]=function(_0x51297f){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0xf9'),_0x51297f[_0xffb8('0x33')]));return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xf8'));};AGIVertices['prototype']['ext_dial']=function(_0x520512){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0xfa'),_0x520512[_0xffb8('0x33')]));var _0x2755fe='';if(_0x520512[_0xffb8('0xfb')]){if(!this[_0xffb8('0x7b')](_0x520512['trunk_id'])){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x520512,_0xffb8('0xfc'));}else{var _0x41307c=parseInt(_0x520512[_0xffb8('0xfb')],0xa);if(isNaN(_0x41307c)){_0x2755fe=_0x520512[_0xffb8('0xfb')];}else{_0x2755fe=this[_0xffb8('0xfd')]['sync'](this,_0x520512[_0xffb8('0xfb')]);if(!_0x2755fe){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x520512,'no\x20trunk\x20found');}}}}else if(_0x520512[_0xffb8('0xfe')]){_0x2755fe=_0x520512[_0xffb8('0xfe')];}else{return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x520512,_0xffb8('0xfc'));}var _0x253a21=this[_0xffb8('0x35')][_0xffb8('0x51')](_0xffb8('0xd9'),[util[_0xffb8('0x26')](_0xffb8('0xff'),_0x2755fe,_0x520512['phone']),_0x520512[_0xffb8('0x5c')],_0x520512['opts'],_0x520512[_0xffb8('0xda')]]);if(_0x253a21['result']===-0x1){return _0x253a21;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xdb'),_0xffb8('0xd9')));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x100')]=function(_0x15c5a0){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x101'),_0x15c5a0[_0xffb8('0x33')]));return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x100'));};AGIVertices['prototype'][_0xffb8('0xb')]=function(_0x5a8934){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x102'),_0x5a8934['label']));if(_0x5a8934[_0xffb8('0x9d')]===0x0){return this[_0xffb8('0x9c')](_0x5a8934);}_0x5a8934[_0xffb8('0x9d')]-=0x1;if(!this[_0xffb8('0x7b')](_0x5a8934['file_id'])){return this['channel'][_0xffb8('0x29')](_0x5a8934,'no\x20file\x20audio\x20selected');}var _0x222a68=this[_0xffb8('0x1b')]['sync'](this,_0x5a8934[_0xffb8('0x103')]);if(!_0x222a68){return this[_0xffb8('0x35')]['error'](_0x5a8934,_0xffb8('0x104'));}if(!this[_0xffb8('0x7b')](_0x5a8934['variable_id'])){return this['channel'][_0xffb8('0x29')](_0xffb8('0xcf'));}var _0x5d67b2=this[_0xffb8('0x35')]['getData'](_0x222a68,_0x5a8934[_0xffb8('0x105')],_0x5a8934[_0xffb8('0x106')]);var _0x4ab5fc=_0x5d67b2[_0xffb8('0x9b')]?_0x5d67b2[_0xffb8('0x9b')][_0xffb8('0x99')]():'';logger[_0xffb8('0x2b')]('test',JSON[_0xffb8('0x69')](_0x5d67b2));if(_0x5d67b2['result']===-0x1){this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0x5a8934,_0x4ab5fc);return _0x5d67b2;}else if(_0x5d67b2[_0xffb8('0x98')]===_0xffb8('0x5c')){_0x5d67b2[_0xffb8('0x9b')]=_0x4ab5fc[_0xffb8('0x92')]>=parseInt(_0x5a8934['mindigit'])?'x':'i';}else{_0x5d67b2[_0xffb8('0x9b')]=_0x4ab5fc[_0xffb8('0x92')]>=parseInt(_0x5a8934[_0xffb8('0x107')])&&_0x4ab5fc[_0xffb8('0x92')]<=parseInt(_0x5a8934[_0xffb8('0x106')])?'x':'i';}var _0x2384cc=this[_0xffb8('0x10')][_0xffb8('0xb7')](this,_0x5a8934[_0xffb8('0xce')]);if(!_0x2384cc){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x5a8934,_0xffb8('0xd0'));}this[_0xffb8('0x35')][_0xffb8('0x95')](_0x2384cc,_0x4ab5fc);if(this[_0xffb8('0x7b')](_0x5a8934[_0xffb8('0x108')])){var _0x3b5b46=parseInt(_0x5a8934[_0xffb8('0x108')],0xa);var _0x276b3a=rs[_0xffb8('0x109')]({'charset':'*','length':_0x3b5b46});var _0x217a3a=_0x4ab5fc[_0xffb8('0x92')];if(_0x217a3a>0x0){if(_0x217a3a>_0x3b5b46){this['createSquareDetailsReport'][_0xffb8('0xb7')](this,_0x5a8934,_0x5a8934[_0xffb8('0x10a')]===_0xffb8('0x10b')?_0x276b3a+_0x4ab5fc[_0xffb8('0x10c')](_0x3b5b46):_0x4ab5fc['substr'](0x0,_0x217a3a-_0x3b5b46)+_0x276b3a);}else{this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0x5a8934,rs['generate']({'charset':'*','length':_0x217a3a}));}}else{this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0x5a8934,'');}}else{this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0x5a8934,_0x4ab5fc);}return _0x5d67b2;};AGIVertices[_0xffb8('0xf')]['getsecretdigits']=function(_0x36a2bf){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x10d'),_0x36a2bf[_0xffb8('0x33')]));return this[_0xffb8('0xb')](_0x36a2bf);};AGIVertices[_0xffb8('0xf')][_0xffb8('0x10e')]=function(_0x595391){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x10f'),_0x595391[_0xffb8('0x33')]));this[_0xffb8('0x31')]['sync'](this,_0x595391,_0x595391[_0xffb8('0x110')]);return this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0x111'),_0x595391[_0xffb8('0x110')]));};AGIVertices['prototype']['awspolly']=function(_0x12225d){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x112'),_0x12225d[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x12225d[_0xffb8('0x7e')])||!this[_0xffb8('0x7b')](_0x12225d['aws_secret_access_key'])){return this[_0xffb8('0x35')][_0xffb8('0xa0')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xffb8('0x7b')](_0x12225d[_0xffb8('0x56')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')]('no\x20text\x20configured');}this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')]('Trying\x20aws\x20Polly\x20%s',_0x12225d['text']));var _0xc8228d=this[_0xffb8('0x7d')][_0xffb8('0xb7')](this,_0x12225d);if(_0xc8228d){this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')]('aws\x20Polly\x20%s\x20file\x20created',_0xc8228d));var _0x37f293=this[_0xffb8('0x35')]['streamFile'](_0xc8228d);try{fs[_0xffb8('0x113')](_0xc8228d+'.wav');}catch(_0x5e8114){logger[_0xffb8('0x29')](_0x5e8114);}return _0x37f293;}return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x12225d,_0xffb8('0x114'));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x115')]=function(_0x13b92a){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x116'),_0x13b92a['label']));if(!this[_0xffb8('0x7b')](_0x13b92a['aws_access_key_id'])||!this[_0xffb8('0x7b')](_0x13b92a[_0xffb8('0x83')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xffb8('0x7b')](_0x13b92a[_0xffb8('0x84')])){return this['channel']['noop'](_0xffb8('0x117'));}if(!this[_0xffb8('0x7b')](_0x13b92a[_0xffb8('0x56')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa1'));}this[_0xffb8('0x35')][_0xffb8('0x118')]=!![];this['createSquareDetailsReport'](_0x13b92a);this[_0xffb8('0x3d')](_0x13b92a[_0xffb8('0x56')],'in','','');this[_0xffb8('0x35')]['noop'](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x13b92a['text']));var _0x2073e8=this[_0xffb8('0x82')]['sync'](this,_0x13b92a);if(_0x2073e8){for(var _0x32c5dc in _0x2073e8){if(_0x2073e8['hasOwnProperty'](_0x32c5dc)&&_[_0xffb8('0x119')](_0x2073e8[_0x32c5dc])){this[_0xffb8('0x35')]['setVariable'](util[_0xffb8('0x26')](_0xffb8('0x11a'),_0x32c5dc[_0xffb8('0x60')]()),_0x2073e8[_0x32c5dc]);}}if(_[_0xffb8('0x3f')](_0x2073e8['message'])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xffb8('0x3d')](_0x2073e8[_0xffb8('0x6b')],_0xffb8('0xde'),_0xffb8('0x11b'),'');return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')]('Amazon\x20Lex\x20Result\x20%s',_0x2073e8[_0xffb8('0x6b')]));}}return this[_0xffb8('0x35')]['error'](_0x13b92a,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xffb8('0xf')][_0xffb8('0x11c')]=function(_0x5ad339){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x11d'),_0x5ad339[_0xffb8('0x33')],_0x5ad339[_0xffb8('0x5c')]));if(!this[_0xffb8('0x7b')](_0x5ad339[_0xffb8('0x6f')])){return this[_0xffb8('0x35')]['noop']('no\x20key\x20configured');}var _0x33c2cb=_0xffb8('0x11e');var _0x814028=util[_0xffb8('0x26')](_0xffb8('0x11f'),FILES_PATH,rs[_0xffb8('0x109')](0x4));var _0x4f33b5=util[_0xffb8('0x26')](_0xffb8('0x94'),_0x814028,_0x33c2cb);var _0x177e53=!![];if(_0x5ad339[_0xffb8('0x120')]===_0xffb8('0x121')){_0x177e53=![];}var _0x229932=this[_0xffb8('0x35')]['recordFile'](_0x814028,_0x33c2cb,_0x5ad339[_0xffb8('0x122')],_0x5ad339[_0xffb8('0x5c')],undefined,_0x177e53);if(_0x229932['result']!==-0x1){this['channel'][_0xffb8('0xa0')](util[_0xffb8('0x26')]('google\x20%s\x20file\x20created',_0x4f33b5));var _0x50b08b=this['googleASR']['sync'](this,_0x5ad339,_0x4f33b5);if(_0x50b08b){for(var _0x3f838c in _0x50b08b){if(_0x50b08b[_0xffb8('0x8f')](_0x3f838c)){this[_0xffb8('0x35')]['setVariable'](util[_0xffb8('0x26')](_0xffb8('0x123'),_0x3f838c[_0xffb8('0x60')]()),_0x50b08b[_0x3f838c]);}}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x124'),JSON['stringify'](_0x50b08b)));}}return _0x229932;};AGIVertices[_0xffb8('0xf')]['tildeasr']=function(_0x260345){logger['info'](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x260345[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x260345[_0xffb8('0x88')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')]('no\x20appid\x20configured');}if(!this[_0xffb8('0x7b')](_0x260345[_0xffb8('0x89')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x125'));}var _0x3b56b7=_0xffb8('0x11e');var _0x2f8409=util[_0xffb8('0x26')](_0xffb8('0x11f'),FILES_PATH,rs[_0xffb8('0x109')](0x4));var _0x4f2962=util[_0xffb8('0x26')]('%s.%s',_0x2f8409,_0x3b56b7);var _0x4af2ab=!![];if(_0x260345[_0xffb8('0x120')]===_0xffb8('0x121')){_0x4af2ab=![];}var _0xbe2c60=this['channel'][_0xffb8('0x126')](_0x2f8409,_0x3b56b7,_0x260345['intKey'],_0x260345[_0xffb8('0x5c')],undefined,_0x4af2ab);if(_0xbe2c60[_0xffb8('0x9b')]!==-0x1){this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0x127'),_0x4f2962));var _0x26b668=this['tildeASR']['sync'](this,_0x260345,_0x4f2962);if(_0x26b668){for(var _0x1bdddc in _0x26b668){if(_0x26b668[_0xffb8('0x8f')](_0x1bdddc)){this['channel'][_0xffb8('0x95')](util['format'](_0xffb8('0x128'),_0x1bdddc[_0xffb8('0x60')]()),_0x26b668[_0x1bdddc]);}}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0x129'),JSON[_0xffb8('0x69')](_0x26b668)));}}return _0xbe2c60;};AGIVertices[_0xffb8('0xf')][_0xffb8('0x12a')]=function(_0x19f1bf){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x12b'),_0x19f1bf[_0xffb8('0x33')]));return this['channel']['continueAt'](_0x19f1bf['context'],_0x19f1bf[_0xffb8('0x3a')],_0x19f1bf[_0xffb8('0x3b')]);};AGIVertices[_0xffb8('0xf')]['gotoif']=function(_0x5d6184){logger[_0xffb8('0x2b')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5d6184['label']));if(!this[_0xffb8('0x7b')](_0x5d6184['condition'])){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x5d6184,_0xffb8('0x12c'));}try{var _0x3cb262=eval(_0x5d6184['condition'])?'true':_0xffb8('0x12d');this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0x12e'),_0x5d6184[_0xffb8('0x12f')],_0x3cb262));return{'code':0xc8,'result':_0x3cb262};}catch(_0x5cc75a){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xffb8('0xf')][_0xffb8('0x130')]=function(_0x3ad780){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3ad780[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x3ad780[_0xffb8('0x131')])){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x3ad780,_0xffb8('0x132'));}var _0x425ee0=this[_0xffb8('0x22')][_0xffb8('0xb7')](this,_0x3ad780['interval_id']);if(!_0x425ee0){return this['channel'][_0xffb8('0x29')](_0x3ad780,'no\x20intervals\x20found');}for(var _0x5e3fbc=0x0;_0x5e3fbc<_0x425ee0[_0xffb8('0x92')];_0x5e3fbc+=0x1){var _0x1b65c5=this[_0xffb8('0x35')][_0xffb8('0x10')](util[_0xffb8('0x26')](_0xffb8('0x133'),_0x425ee0[_0x5e3fbc]));if(_0x1b65c5['result']===-0x1){return _0x1b65c5;}logger['info'](util[_0xffb8('0x26')](_0xffb8('0x134'),_0x425ee0[_0x5e3fbc],_0x1b65c5['extra']));if(_0x1b65c5['extra']===_0xffb8('0x135')){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x134'),_0x425ee0[_0x5e3fbc],_0xffb8('0x135')));this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x134'),_0x425ee0[_0x5e3fbc],_0xffb8('0x135')));return{'code':0xc8,'result':'true'};}else{logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x134'),_0x425ee0[_0x5e3fbc],_0xffb8('0x12d')));this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0x134'),_0x425ee0[_0x5e3fbc],_0xffb8('0x12d')));}}return{'code':0xc8,'result':_0xffb8('0x12d')};};AGIVertices['prototype'][_0xffb8('0x136')]=function(_0x26484e){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x137'),_0x26484e[_0xffb8('0x33')]));return this[_0xffb8('0x35')]['hangup']();};AGIVertices['prototype'][_0xffb8('0x138')]=function(_0x57655b){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x139'),_0x57655b[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x57655b[_0xffb8('0x6f')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x13a'));}var _0x55d26=_0xffb8('0x11e');var _0x563b36=util[_0xffb8('0x26')](_0xffb8('0x11f'),FILES_PATH,rs[_0xffb8('0x109')](0x4));var _0x56e212=util[_0xffb8('0x26')](_0xffb8('0x94'),_0x563b36,_0x55d26);var _0x5395a2=!![];if(_0x57655b[_0xffb8('0x120')]===_0xffb8('0x121')){_0x5395a2=![];}var _0x2a4262=this['channel'][_0xffb8('0x126')](_0x563b36,_0x55d26,_0x57655b[_0xffb8('0x122')],_0x57655b[_0xffb8('0x5c')],undefined,_0x5395a2);if(_0x2a4262[_0xffb8('0x9b')]!==-0x1){this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x13b'),_0x56e212));var _0x438a59=this[_0xffb8('0x79')][_0xffb8('0xb7')](this,_0x57655b,_0x56e212);if(_0x438a59){for(var _0x1bcc1f in _0x438a59){if(_0x438a59[_0xffb8('0x8f')](_0x1bcc1f)){this[_0xffb8('0x35')][_0xffb8('0x95')](util[_0xffb8('0x26')]('ISPEECH_ASR_%s',_0x1bcc1f[_0xffb8('0x60')]()),_0x438a59[_0x1bcc1f]);}}return this['channel']['noop'](util[_0xffb8('0x26')](_0xffb8('0x13c'),JSON[_0xffb8('0x69')](_0x438a59)));}}return _0x2a4262;};AGIVertices[_0xffb8('0xf')]['ispeechtts']=function(_0x288e88){logger['info'](util[_0xffb8('0x26')](_0xffb8('0x13d'),_0x288e88[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x288e88[_0xffb8('0x6f')])){return this['channel']['noop'](_0xffb8('0x13a'));}if(!this['isConfigured'](_0x288e88[_0xffb8('0x56')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa1'));}this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x13e'),_0x288e88[_0xffb8('0x56')]));var _0x520229=this['ispeechTTS'][_0xffb8('0xb7')](this,_0x288e88);if(_0x520229){this['channel'][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x13b'),_0x520229));var _0x371965=this[_0xffb8('0x35')][_0xffb8('0xf4')](_0x520229,_0x288e88['intKey']);try{fs[_0xffb8('0x113')](_0x520229+'.wav');}catch(_0x5807f4){logger[_0xffb8('0x29')](_0x5807f4);}return _0x371965;}return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x288e88,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xffb8('0xf')][_0xffb8('0x13f')]=function(_0x5068a5){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x140'),_0x5068a5[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x5068a5[_0xffb8('0x141')])){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x5068a5,_0xffb8('0x142'));}logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x143'),this[_0xffb8('0x35')][_0xffb8('0x36')],_0x5068a5['findBy']));var _0x1365ad=this['agentLogin'][_0xffb8('0xb7')](this,_0x5068a5[_0xffb8('0x141')]);if(_0x1365ad){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x144'),this[_0xffb8('0x35')][_0xffb8('0x36')],_0x5068a5[_0xffb8('0x141')]));this[_0xffb8('0x35')]['noop'](util[_0xffb8('0x26')](_0xffb8('0x144'),this['channel'][_0xffb8('0x36')],_0x5068a5['findBy']));return{'code':0xc8,'result':_0xffb8('0x145')};}else{logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x146'),this[_0xffb8('0x35')][_0xffb8('0x36')],_0x5068a5[_0xffb8('0x141')]));this['channel'][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x146'),this['channel'][_0xffb8('0x36')],_0x5068a5[_0xffb8('0x141')]));return{'code':0xc8,'result':_0xffb8('0x147')};}};AGIVertices[_0xffb8('0xf')][_0xffb8('0x148')]=function(_0x31be98){logger['info'](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x31be98['label']));if(!this[_0xffb8('0x7b')](_0x31be98[_0xffb8('0x141')])){return this['channel']['error'](_0x31be98,_0xffb8('0x142'));}logger['info'](util[_0xffb8('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xffb8('0x35')]['callerid'],_0x31be98['findBy']));var _0x4ed7b3=this[_0xffb8('0x4b')]['sync'](this,_0x31be98['findBy']);if(_0x4ed7b3){logger['info'](util['format'](_0xffb8('0x144'),this['channel'][_0xffb8('0x36')],_0x31be98[_0xffb8('0x141')]));this[_0xffb8('0x35')]['noop'](util['format'](_0xffb8('0x144'),this['channel'][_0xffb8('0x36')],_0x31be98['findBy']));return{'code':0xc8,'result':_0xffb8('0x145')};}else{logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x146'),this[_0xffb8('0x35')]['callerid'],_0x31be98[_0xffb8('0x141')]));this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0x146'),this[_0xffb8('0x35')][_0xffb8('0x36')],_0x31be98[_0xffb8('0x141')]));return{'code':0xc8,'result':_0xffb8('0x147')};}};AGIVertices[_0xffb8('0xf')][_0xffb8('0x149')]=function(_0x1c0072){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x14a'),_0x1c0072[_0xffb8('0x33')]));if(!this['isConfigured'](_0x1c0072['operation'])){return this['channel'][_0xffb8('0x29')](_0x1c0072,_0xffb8('0x14b'));}this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format']('math\x20%s',_0x1c0072[_0xffb8('0x14c')]));var _0x49390f=eval(_0x1c0072[_0xffb8('0x14c')]);if(!this[_0xffb8('0x7b')](_0x1c0072[_0xffb8('0xce')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xcf'));}var _0x11dbc1=this[_0xffb8('0x10')][_0xffb8('0xb7')](this,_0x1c0072[_0xffb8('0xce')]);if(!_0x11dbc1){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x1c0072,_0xffb8('0xd0'));}if(_[_0xffb8('0x91')](_0x49390f)){var _0x121aa3=this;_0x49390f[_0xffb8('0xd1')](function(_0x1ce424,_0x53c06b){_0x121aa3['channel'][_0xffb8('0x95')](util['format']('%s[%s]',_0x11dbc1,_0x53c06b),_0x1ce424);});return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x14d'),_0x11dbc1));}else{return this['channel'][_0xffb8('0x95')](_0x11dbc1,_0x49390f);}};AGIVertices[_0xffb8('0xf')][_0xffb8('0xa')]=function(_0x73ed8c){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x14e'),_0x73ed8c[_0xffb8('0x33')]));if(_0x73ed8c[_0xffb8('0x9d')]===0x0){return this[_0xffb8('0x9c')](_0x73ed8c);}_0x73ed8c['retry']-=0x1;if(!this[_0xffb8('0x7b')](_0x73ed8c['file_id'])){return this['channel'][_0xffb8('0x29')](_0x73ed8c,_0xffb8('0x14f'));}var _0x14c9d7=this['getSound']['sync'](this,_0x73ed8c[_0xffb8('0x103')]);if(!_0x14c9d7){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x73ed8c,_0xffb8('0x104'));}var _0x5465c0=this[_0xffb8('0x35')][_0xffb8('0x150')](_0x14c9d7,_0x73ed8c[_0xffb8('0x105')],_0x73ed8c[_0xffb8('0x151')]);var _0x2eeaf6=_0x5465c0[_0xffb8('0x9b')];if(_0x5465c0[_0xffb8('0x9b')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x73ed8c,'-1');return _0x5465c0;}else if(_0x5465c0[_0xffb8('0x98')]===_0xffb8('0x5c')){_0x5465c0[_0xffb8('0x9b')]=_0x5465c0['result'][_0xffb8('0x92')]>0x0?_0x5465c0[_0xffb8('0x9b')]:'t';}else if(_['isEmpty'](_0x5465c0[_0xffb8('0x9b')])){_0x5465c0[_0xffb8('0x9b')]='#';_0x2eeaf6='#';}if(!this[_0xffb8('0x7b')](_0x73ed8c['variable_id'])){this[_0xffb8('0x35')]['noop'](_0xffb8('0xcf'));}else{var _0x57703a=this[_0xffb8('0x10')][_0xffb8('0xb7')](this,_0x73ed8c[_0xffb8('0xce')]);if(!_0x57703a){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x73ed8c,_0xffb8('0xd0'));}this[_0xffb8('0x35')]['setVariable'](_0x57703a,_0x2eeaf6);}this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0x73ed8c,_0x2eeaf6);return _0x5465c0;};AGIVertices[_0xffb8('0xf')][_0xffb8('0xa0')]=function(_0x588aac){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x152'),_0x588aac[_0xffb8('0x33')]));return this[_0xffb8('0x35')]['noop'](_0x588aac[_0xffb8('0x153')]||_0x588aac[_0xffb8('0x33')]);};AGIVertices[_0xffb8('0xf')][_0xffb8('0x154')]=function(_0x5aa5e5){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x155'),_0x5aa5e5[_0xffb8('0x33')]));if(!this['isConfigured'](_0x5aa5e5['findBy'])){return this[_0xffb8('0x35')]['error'](_0x5aa5e5,'no\x20find\x20by\x20configured');}logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x143'),this[_0xffb8('0x35')][_0xffb8('0x36')],_0x5aa5e5[_0xffb8('0x141')]));var _0x29d477=this[_0xffb8('0x48')][_0xffb8('0xb7')](this,_0x5aa5e5[_0xffb8('0x156')]);var _0x4e89ae=this[_0xffb8('0x49')][_0xffb8('0xb7')](this,_0x5aa5e5['findBy'],_0x29d477);if(_0x4e89ae){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x144'),this[_0xffb8('0x35')][_0xffb8('0x36')],_0x5aa5e5[_0xffb8('0x141')]));this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x144'),this[_0xffb8('0x35')]['callerid'],_0x5aa5e5[_0xffb8('0x141')]));return{'code':0xc8,'result':_0xffb8('0x145')};}else{logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x146'),this[_0xffb8('0x35')][_0xffb8('0x36')],_0x5aa5e5[_0xffb8('0x141')]));this['channel'][_0xffb8('0xa0')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xffb8('0x35')][_0xffb8('0x36')],_0x5aa5e5[_0xffb8('0x141')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xffb8('0xf')][_0xffb8('0x157')]=function(_0x1ed2cf){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x158'),_0x1ed2cf['label']));if(!this[_0xffb8('0x7b')](_0x1ed2cf[_0xffb8('0x103')])){return this['channel']['error'](_0x1ed2cf,_0xffb8('0x14f'));}var _0x1d6b3a=this[_0xffb8('0x1b')][_0xffb8('0xb7')](this,_0x1ed2cf[_0xffb8('0x103')]);if(!_0x1d6b3a){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x1ed2cf,'no\x20file\x20audio\x20found');}var _0x2e00f0=this[_0xffb8('0x35')][_0xffb8('0x51')](_0xffb8('0x159'),[_0x1d6b3a,_0x1ed2cf[_0xffb8('0x15a')]]);if(_0x2e00f0[_0xffb8('0x9b')]===-0x1){return _0x2e00f0;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xbb'),_0xffb8('0x159'),_0x1d6b3a));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x15b')]=function(_0x297ece){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x15c'),_0x297ece[_0xffb8('0x33')]));if(!this['isConfigured'](_0x297ece[_0xffb8('0x15d')])){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x297ece,'no\x20queue\x20selected');}var _0x687d43='';var _0x1d9bfa=parseInt(_0x297ece[_0xffb8('0x15d')],0xa);if(isNaN(_0x1d9bfa)){_0x687d43=_0x297ece[_0xffb8('0x15d')];}else{_0x687d43=this['getVoiceQueue'][_0xffb8('0xb7')](this,_0x297ece[_0xffb8('0x15d')]);if(!_0x687d43){return this[_0xffb8('0x35')]['error'](_0x297ece,'no\x20queue\x20found');}}var _0xfc84db='';if(this[_0xffb8('0x7b')](_0x297ece['file_id'])){var _0x7211aa=this['getSound'][_0xffb8('0xb7')](this,_0x297ece[_0xffb8('0x103')]);if(_0x7211aa){_0xfc84db=_0x7211aa;}}this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0x297ece,_0x687d43);if(_0x297ece[_0xffb8('0x15a')]['indexOf']('x')<0x0){_0x297ece[_0xffb8('0x15a')]+='x';}if(_0x297ece['opts']['indexOf']('X')<0x0){_0x297ece[_0xffb8('0x15a')]+='X';}this['channel'][_0xffb8('0x95')](_0xffb8('0x15e'),_0x687d43?_0x687d43[_0xffb8('0x15f')]():'');var _0x6b3827=this[_0xffb8('0x35')][_0xffb8('0x51')](_0xffb8('0x160'),[_0x687d43,_0x297ece[_0xffb8('0x15a')],_0x297ece[_0xffb8('0xda')],_0xfc84db,_0x297ece['timeout'],_0x297ece[_0xffb8('0x6')],_0x297ece[_0xffb8('0x161')],_0x297ece[_0xffb8('0x162')],'',_0x297ece[_0xffb8('0x163')]]);if(_0x6b3827['result']===-0x1){return _0x6b3827;}return this['channel']['noop'](util[_0xffb8('0x26')](_0xffb8('0xbb'),_0xffb8('0x160'),_0x687d43));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x164')]=function(_0x13e377){logger[_0xffb8('0x2b')](util['format'](_0xffb8('0x165'),_0x13e377[_0xffb8('0x33')]));var _0x2b7090=_0x13e377[_0xffb8('0x166')]||_0xffb8('0x11e');var _0x28d669=util['format'](_0xffb8('0x167'),this[_0xffb8('0x35')][_0xffb8('0x32')],rs[_0xffb8('0x109')](0x5));var _0x30ee2f=util[_0xffb8('0x26')](_0xffb8('0x168'),FILES_PATH,_0x28d669,_0x2b7090);var _0x2548ab=util['format'](_0xffb8('0x11f'),FILES_PATH,_0x28d669);this[_0xffb8('0x37')][_0xffb8('0xb7')](this,_0x13e377,_0x28d669,_0x30ee2f);this['channel'][_0xffb8('0x95')]('RECORDING_SAVENAME',_0x28d669);logger[_0xffb8('0x2b')](_0xffb8('0x169'),_0x2548ab,_0x2b7090,_0x13e377[_0xffb8('0x16a')],_0x13e377[_0xffb8('0x5c')]);return this[_0xffb8('0x35')][_0xffb8('0x126')](_0x2548ab,_0x2b7090,_0x13e377[_0xffb8('0x16a')],_0x13e377[_0xffb8('0x5c')],undefined,!![]);};AGIVertices[_0xffb8('0xf')][_0xffb8('0x16b')]=function(_0x3dbdfd){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x16c'),_0x3dbdfd[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x3dbdfd[_0xffb8('0xda')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x16d'));}var _0x436745=this['restAPI'][_0xffb8('0xb7')](this,_0x3dbdfd);logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x16e'),util[_0xffb8('0x16f')](_0x436745,{'showHidden':![],'depth':null})));if(!this[_0xffb8('0x7b')](_0x3dbdfd['variable_id'])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x170'));}var _0x2c5b29=this[_0xffb8('0x10')][_0xffb8('0xb7')](this,_0x3dbdfd[_0xffb8('0xce')]);if(!_0x2c5b29){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x3dbdfd,_0xffb8('0xd0'));}this[_0xffb8('0x35')]['setVariable'](util[_0xffb8('0x26')](_0xffb8('0x171'),_0x2c5b29),_0x436745[_0xffb8('0x6a')]?_0x436745['statusCode']:_0xffb8('0x172'));this[_0xffb8('0x35')]['setVariable'](util[_0xffb8('0x26')](_0xffb8('0x173'),_0x2c5b29),_0x436745[_0xffb8('0x174')]?_0x436745[_0xffb8('0x174')]:'OK');if(_0x436745['body']){try{this[_0xffb8('0x93')](_0x436745['body'],_0x2c5b29);}catch(_0x4ad45d){logger[_0xffb8('0x29')](util['format'](_0xffb8('0x175'),_0x2c5b29));}}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xd3'),_0x2c5b29));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x176')]=function(_0x47485f){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x177'),_0x47485f['label']));return this['channel'][_0xffb8('0x178')](_0x47485f[_0xffb8('0x179')]['replace'](/\s+/g,''),_0x47485f['escape_digits']);};AGIVertices[_0xffb8('0xf')]['saynumber']=function(_0x5d9bf5){logger['info'](util['format'](_0xffb8('0x17a'),_0x5d9bf5[_0xffb8('0x33')]));return this['channel'][_0xffb8('0x17b')](_0x5d9bf5[_0xffb8('0x5d')]['replace'](/\s+/g,''),_0x5d9bf5[_0xffb8('0x16a')]);};AGIVertices[_0xffb8('0xf')][_0xffb8('0x17c')]=function(_0x256ee0){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x256ee0[_0xffb8('0x33')]));return this[_0xffb8('0x35')][_0xffb8('0x17d')](_0x256ee0['text'],_0x256ee0['escape_digits']);};AGIVertices[_0xffb8('0xf')][_0xffb8('0x17e')]=function(_0x5a93f8){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5a93f8[_0xffb8('0x33')]));if(!this['isConfigured'](_0x5a93f8[_0xffb8('0x17f')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x180'));}var _0x291e9d=this[_0xffb8('0x1f')][_0xffb8('0xb7')](this,_0x5a93f8[_0xffb8('0x17f')]);if(!_0x291e9d||!_0x291e9d['Smtp']){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x5a93f8,_0xffb8('0x181'));}var _0x3859f8={'from':util[_0xffb8('0x26')](_0xffb8('0x182'),_0x291e9d['name'],_0x291e9d['email']||_0x291e9d[_0xffb8('0x183')][_0xffb8('0x184')]),'to':_0x5a93f8['to']||'','cc':_0x5a93f8['cc']||'','bcc':_0x5a93f8[_0xffb8('0x185')]||'','subject':_0x5a93f8[_0xffb8('0x186')],'html':_0x5a93f8[_0xffb8('0x56')],'text':_0x5a93f8[_0xffb8('0x56')]};var _0x46250e={'tls':{'rejectUnauthorized':![]}};if(_0x291e9d[_0xffb8('0x183')]['service']){_0x46250e['service']=_0x291e9d['Smtp'][_0xffb8('0x187')];}else{_0x46250e[_0xffb8('0x188')]=_0x291e9d[_0xffb8('0x183')][_0xffb8('0x188')];_0x46250e[_0xffb8('0x189')]=_0x291e9d[_0xffb8('0x183')][_0xffb8('0x189')];_0x46250e[_0xffb8('0x18a')]=_0x291e9d[_0xffb8('0x183')][_0xffb8('0x18a')];}if(_0x291e9d[_0xffb8('0x183')]['authentication']){_0x46250e[_0xffb8('0x18b')]={'user':_0x291e9d[_0xffb8('0x183')][_0xffb8('0x184')],'pass':_0x291e9d[_0xffb8('0x183')]['pass']};}if(this[_0xffb8('0x7b')](_0x5a93f8[_0xffb8('0x18c')])){}logger[_0xffb8('0x18d')](_0xffb8('0x18e'),JSON['stringify'](_0x3859f8));this['createSquareDetailsReport'][_0xffb8('0xb7')](this,_0x5a93f8,_0x5a93f8[_0xffb8('0x17f')]);this[_0xffb8('0x35')]['noop'](util[_0xffb8('0x26')](_0xffb8('0x18f'),_0x291e9d[_0xffb8('0x13')]));this[_0xffb8('0x21')]['sync'](this,_0x46250e,_0x3859f8);return this['channel'][_0xffb8('0xa0')](_0xffb8('0x190'));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x191')]=function(_0x2091f1){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x192'),_0x2091f1[_0xffb8('0x33')]));return this[_0xffb8('0x35')]['noop'](_0xffb8('0x193'));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x194')]=function(_0x57d2de){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x195'),_0x57d2de[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x57d2de[_0xffb8('0x196')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x197'));}var _0x52b12b=this['getSmsAccount'][_0xffb8('0xb7')](this,_0x57d2de[_0xffb8('0x196')]);if(!_0x52b12b){return this['channel'][_0xffb8('0x29')](_0x57d2de,_0xffb8('0x198'));}var _0x427d6e={'body':_0x57d2de[_0xffb8('0x199')],'phone':_0x57d2de['to']||'','SmsAccountId':_0x52b12b['id']};logger[_0xffb8('0x18d')](_0xffb8('0x19a'),JSON[_0xffb8('0x69')](_0x427d6e));this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0x57d2de,_0x57d2de[_0xffb8('0x196')]);this['channel'][_0xffb8('0xa0')](util[_0xffb8('0x26')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x52b12b[_0xffb8('0x13')]));this[_0xffb8('0x30')][_0xffb8('0xb7')](this,_0x427d6e);return this[_0xffb8('0x35')]['noop'](_0xffb8('0x19b'));};AGIVertices['prototype'][_0xffb8('0x19c')]=function(_0x318edf){logger[_0xffb8('0x2b')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x318edf['label']));if(!this[_0xffb8('0x7b')](_0x318edf[_0xffb8('0xce')])){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x318edf,_0xffb8('0x19d'));}var _0x2bfc13=this['getVariable'][_0xffb8('0xb7')](this,_0x318edf[_0xffb8('0xce')]);if(!_0x2bfc13){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x318edf,'no\x20variable\x20found');}return this[_0xffb8('0x35')]['setVariable'](_0x2bfc13,_0x318edf['variable_value']);};AGIVertices[_0xffb8('0xf')]['start']=function(_0x4289ae){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x19e'),_0x4289ae['label']));this['channel'][_0xffb8('0xa0')](_0xffb8('0x19f'));if(_0x4289ae[_0xffb8('0xaf')]===_0xffb8('0x1a0')){this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x1a1'));return this[_0xffb8('0x35')][_0xffb8('0xaf')]();}return this[_0xffb8('0x35')]['noop']('Skipped\x20Answer');};AGIVertices[_0xffb8('0xf')][_0xffb8('0x1a2')]=function(_0x21b5be){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x1a3'),_0x21b5be[_0xffb8('0x33')]));if(!this[_0xffb8('0x7b')](_0x21b5be[_0xffb8('0x1a4')])){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x21b5be,'no\x20subproject\x20selected');}var _0x442fde=this[_0xffb8('0x16')]['sync'](this,_0x21b5be[_0xffb8('0x1a4')]);if(!this[_0xffb8('0x7b')](_0x442fde)){return this['channel'][_0xffb8('0x29')](_0x21b5be,util[_0xffb8('0x26')](_0xffb8('0x1a5'),_0x21b5be[_0xffb8('0x1a4')]));}if(_0x442fde===this[_0xffb8('0x35')][_0xffb8('0x3c')]){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x21b5be,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xffb8('0x31')]['sync'](this,_0x21b5be,_0x442fde);var _0x46079c=this['channel']['exec']('AGI',util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xffb8('0x6')][_0xffb8('0x188')]||'127.0.0.1',_0x442fde,this['channel'][_0xffb8('0x3c')]));if(_0x46079c[_0xffb8('0x9b')]===-0x1){return _0x46079c;}return this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xbb'),_0xffb8('0x1a6'),_0x442fde));};AGIVertices['prototype'][_0xffb8('0x1a7')]=function(_0xdcce08){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x1a8'),_0xdcce08['label']));var _0x36d3f6=this[_0xffb8('0x50')][_0xffb8('0xb7')](this,_0xdcce08[_0xffb8('0xad')]);this[_0xffb8('0x31')][_0xffb8('0xb7')](this,_0xdcce08,_0xdcce08[_0xffb8('0xad')]);if(this[_0xffb8('0x7b')](_0xdcce08['variable_id'])){var _0xba558c=this[_0xffb8('0x10')][_0xffb8('0xb7')](this,_0xdcce08[_0xffb8('0xce')]);if(_0xba558c){this[_0xffb8('0x35')][_0xffb8('0x95')](_0xba558c,_0x36d3f6);return this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0x1a9'),_0xdcce08[_0xffb8('0xad')],_0xba558c));}}return this[_0xffb8('0x35')]['noop'](util[_0xffb8('0x26')](_0xffb8('0x1aa'),_0xdcce08['command']));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x1ab')]=function(_0x2aeaf7){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x1ac'),_0x2aeaf7['label']));_0x2aeaf7[_0xffb8('0x56')]=_0x2aeaf7[_0xffb8('0x56')][_0xffb8('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xffb8('0x7b')](_0x2aeaf7['apiKey'])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0x1ad'));}if(!this[_0xffb8('0x7b')](_0x2aeaf7['text'])){return this[_0xffb8('0x35')][_0xffb8('0xa0')](_0xffb8('0xa1'));}this[_0xffb8('0x35')]['noop'](util['format'](_0xffb8('0x1ae'),_0x2aeaf7[_0xffb8('0x56')]));var _0x385788=this[_0xffb8('0x54')][_0xffb8('0xb7')](this,_0x2aeaf7);if(_0x385788){this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format'](_0xffb8('0x1af'),_0x385788));var _0xf70cb1=this['channel'][_0xffb8('0xf4')](_0x385788);try{fs[_0xffb8('0x113')](_0x385788+_0xffb8('0xf5'));}catch(_0x85561e){logger[_0xffb8('0x29')](_0x85561e);}return _0xf70cb1;}return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x2aeaf7,_0xffb8('0x1b0'));};AGIVertices['prototype'][_0xffb8('0x1b1')]=function(_0x1e405e){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x1b2'),_0x1e405e['label']));_0x1e405e['text']=_0x1e405e[_0xffb8('0x56')][_0xffb8('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xffb8('0x7b')](_0x1e405e[_0xffb8('0x56')])){return this[_0xffb8('0x35')][_0xffb8('0xa0')]('no\x20text\x20configured');}this[_0xffb8('0x35')][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0x1b3'),_0x1e405e['text']));var _0x137af2=this[_0xffb8('0x1b4')][_0xffb8('0xb7')](this,_0x1e405e);if(_0x137af2){this[_0xffb8('0x35')][_0xffb8('0xa0')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x137af2));var _0x5bf08d=this['channel']['streamFile'](_0x137af2);try{fs[_0xffb8('0x113')](_0x137af2+_0xffb8('0xf5'));}catch(_0xaec866){logger[_0xffb8('0x29')](_0xaec866);}return _0x5bf08d;}return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x1e405e,_0xffb8('0x1b5'));};AGIVertices[_0xffb8('0xf')][_0xffb8('0x1b6')]=function(_0x44b6bf){logger['info'](util[_0xffb8('0x26')](_0xffb8('0x1b7'),_0x44b6bf[_0xffb8('0x33')]));if(!this['isConfigured'](_0x44b6bf['findBy'])){return this['channel'][_0xffb8('0x29')](_0x44b6bf,_0xffb8('0x142'));}logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x143'),this['channel'][_0xffb8('0x36')],_0x44b6bf[_0xffb8('0x141')]));var _0x2b636f=this[_0xffb8('0x1b8')]['sync'](this,_0x44b6bf[_0xffb8('0x141')]);if(_0x2b636f){logger['info'](util[_0xffb8('0x26')](_0xffb8('0x144'),this[_0xffb8('0x35')]['callerid'],_0x44b6bf['findBy']));this[_0xffb8('0x35')]['noop'](util[_0xffb8('0x26')](_0xffb8('0x144'),this['channel'][_0xffb8('0x36')],_0x44b6bf['findBy']));return{'code':0xc8,'result':_0xffb8('0x145')};}else{logger['info'](util['format'](_0xffb8('0x146'),this[_0xffb8('0x35')][_0xffb8('0x36')],_0x44b6bf[_0xffb8('0x141')]));this[_0xffb8('0x35')]['noop'](util[_0xffb8('0x26')](_0xffb8('0x146'),this[_0xffb8('0x35')]['callerid'],_0x44b6bf[_0xffb8('0x141')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xffb8('0xf')][_0xffb8('0x1b9')]=function(_0x289aba){logger[_0xffb8('0x2b')](util[_0xffb8('0x26')](_0xffb8('0x1ba'),_0x289aba[_0xffb8('0x33')]));var _0x55bcbb=this[_0xffb8('0x35')][_0xffb8('0x51')](_0xffb8('0x1bb'),[_0x289aba[_0xffb8('0x1bc')],_0x289aba['options']]);if(_0x55bcbb[_0xffb8('0x9b')]===-0x1){return _0x55bcbb;}return this['channel'][_0xffb8('0xa0')](util[_0xffb8('0x26')](_0xffb8('0xbb'),_0xffb8('0x1bb'),_0x289aba[_0xffb8('0x1bc')]));};AGIVertices[_0xffb8('0xf')]['vswitch']=function(_0x5e4085){logger['info'](util[_0xffb8('0x26')](_0xffb8('0x1bd'),_0x5e4085['label']));if(!this['isConfigured'](_0x5e4085[_0xffb8('0xce')])){return this[_0xffb8('0x35')]['error'](_0x5e4085,_0xffb8('0x19d'));}var _0x1113a3=this[_0xffb8('0x10')][_0xffb8('0xb7')](this,_0x5e4085[_0xffb8('0xce')]);if(!_0x1113a3){return this[_0xffb8('0x35')][_0xffb8('0x29')](_0x5e4085,_0xffb8('0xd0'));}var _0x1e9d1f=this[_0xffb8('0x35')][_0xffb8('0x10')](_0x1113a3);return{'code':0xc8,'result':_0x1e9d1f[_0xffb8('0x98')]?_0x1e9d1f[_0xffb8('0x98')]:'-'};};String['prototype'][_0xffb8('0x97')]=function(_0xe94af9,_0xb50583){return this[_0xffb8('0x1be')](_0xe94af9)[_0xffb8('0x1bf')](_0xb50583);};module[_0xffb8('0x1c0')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3044767..791f418 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 _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0x54433e,_0x32e332){var _0x3011dd=function(_0x1c409d){while(--_0x1c409d){_0x54433e['push'](_0x54433e['shift']());}};_0x3011dd(++_0x32e332);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file +var _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x5cde21,_0x3d2dab){var _0x3616d2=function(_0x9bb7ae){while(--_0x9bb7ae){_0x5cde21['push'](_0x5cde21['shift']());}};_0x3616d2(++_0x3d2dab);}(_0x7a54,0x106));var _0x47a5=function(_0x4421f3,_0x4c004f){_0x4421f3=_0x4421f3-0x0;var _0x40a5fe=_0x7a54[_0x4421f3];return _0x40a5fe;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 481a6fd..ba72635 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 _0xf89d=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','log','once','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','asterisk','username','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0xf89d,0x11a));var _0xdf89=function(_0x5678b5,_0x567052){_0x5678b5=_0x5678b5-0x0;var _0xceb841=_0xf89d[_0x5678b5];return _0xceb841;};'use strict';var Manager=require(_0xdf89('0x0'));var BPromise=require(_0xdf89('0x1'));var moment=require('moment');var util=require(_0xdf89('0x2'));var _=require(_0xdf89('0x3'));var logger=require(_0xdf89('0x4'))(_0xdf89('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0xdf89('0x6')]['port'],config['asterisk']['ip'],config['asterisk'][_0xdf89('0x7')],config['asterisk'][_0xdf89('0x8')],!![]);ami['keepConnected']();ami[_0xdf89('0x9')]=BPromise[_0xdf89('0xa')](ami[_0xdf89('0xb')]);function error(_0x7db4fa){logger[_0xdf89('0xc')](util[_0xdf89('0xd')](_0xdf89('0xe'),config[_0xdf89('0x6')][_0xdf89('0x7')],config[_0xdf89('0x6')]['ip'],config[_0xdf89('0x6')][_0xdf89('0xf')],util[_0xdf89('0x10')](_0x7db4fa,![],null)));}function close(){logger[_0xdf89('0xc')](util[_0xdf89('0xd')](_0xdf89('0x11'),config[_0xdf89('0x6')]['username'],config[_0xdf89('0x6')]['ip'],config[_0xdf89('0x6')][_0xdf89('0xf')]));}ami[_0xdf89('0x12')]=function(){return function(){return ami[_0xdf89('0x9')]({'action':'sipshowregistry'});};};ami[_0xdf89('0x13')]=function(){return function(){return ami[_0xdf89('0x9')]({'action':'devicestatelist'});};};ami[_0xdf89('0x14')]=function(){return function(){return ami[_0xdf89('0x9')]({'action':_0xdf89('0x15')});};};ami[_0xdf89('0x16')]=function(){return function(){return ami[_0xdf89('0x9')]({'action':_0xdf89('0x17')});};};ami[_0xdf89('0x18')]=function(){return function(){return ami[_0xdf89('0x9')]({'action':_0xdf89('0x19')});};};function connect(_0x501c29){logger[_0xdf89('0x1a')](util[_0xdf89('0xd')](_0xdf89('0x1b'),config[_0xdf89('0x6')][_0xdf89('0x7')],config[_0xdf89('0x6')]['ip'],config[_0xdf89('0x6')]['port']));ami['once'](_0xdf89('0xc'),error);ami['once'](_0xdf89('0x1c'),close);}ami['on']('connect',connect);ami['on'](_0xdf89('0x1d'),function(_0x3892b8){logger[_0xdf89('0x1a')](util[_0xdf89('0xd')](_0xdf89('0x1e'),config[_0xdf89('0x6')]['username'],config[_0xdf89('0x6')]['ip'],config[_0xdf89('0x6')][_0xdf89('0xf')],util[_0xdf89('0x10')](_0x3892b8,![],null)));});ami['on'](_0xdf89('0x1f'),function(_0x2efd9e){logger[_0xdf89('0x1a')](util['format'](_0xdf89('0x20'),config[_0xdf89('0x6')]['username'],config[_0xdf89('0x6')]['ip'],config['asterisk'][_0xdf89('0xf')]));return BPromise['resolve']()[_0xdf89('0x21')](ami[_0xdf89('0x12')]())[_0xdf89('0x21')](ami['actionDeviceStateList']())[_0xdf89('0x21')](ami['actionSipPeerStatus']())['then'](ami[_0xdf89('0x16')]())[_0xdf89('0x21')](ami[_0xdf89('0x18')]())[_0xdf89('0x22')](function(_0x25a739){console[_0xdf89('0x23')](_0x25a739);});});ami['once'](_0xdf89('0xc'),error);ami[_0xdf89('0x24')]('close',close);module[_0xdf89('0x25')]=ami; \ No newline at end of file +var _0xac00=['password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipPeerStatus','catch','exports','asterisk-manager','bluebird','moment','util','../../config/logger','ami','../../config/environment','asterisk','port'];(function(_0x51746b,_0x410210){var _0xdd3da8=function(_0x59397a){while(--_0x59397a){_0x51746b['push'](_0x51746b['shift']());}};_0xdd3da8(++_0x410210);}(_0xac00,0xd5));var _0x0ac0=function(_0x57e212,_0xb2da96){_0x57e212=_0x57e212-0x0;var _0x1e9cf7=_0xac00[_0x57e212];return _0x1e9cf7;};'use strict';var Manager=require(_0x0ac0('0x0'));var BPromise=require(_0x0ac0('0x1'));var moment=require(_0x0ac0('0x2'));var util=require(_0x0ac0('0x3'));var _=require('lodash');var logger=require(_0x0ac0('0x4'))(_0x0ac0('0x5'));var config=require(_0x0ac0('0x6'));var ami=new Manager(config[_0x0ac0('0x7')][_0x0ac0('0x8')],config[_0x0ac0('0x7')]['ip'],config[_0x0ac0('0x7')]['username'],config[_0x0ac0('0x7')][_0x0ac0('0x9')],!![]);ami[_0x0ac0('0xa')]();ami[_0x0ac0('0xb')]=BPromise[_0x0ac0('0xc')](ami[_0x0ac0('0xd')]);function error(_0x4ed1a6){logger[_0x0ac0('0xe')](util[_0x0ac0('0xf')](_0x0ac0('0x10'),config[_0x0ac0('0x7')]['username'],config[_0x0ac0('0x7')]['ip'],config[_0x0ac0('0x7')]['port'],util[_0x0ac0('0x11')](_0x4ed1a6,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x0ac0('0x7')][_0x0ac0('0x12')],config[_0x0ac0('0x7')]['ip'],config['asterisk'][_0x0ac0('0x8')]));}ami[_0x0ac0('0x13')]=function(){return function(){return ami[_0x0ac0('0xb')]({'action':_0x0ac0('0x14')});};};ami[_0x0ac0('0x15')]=function(){return function(){return ami['Action']({'action':_0x0ac0('0x16')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x0ac0('0xb')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x0ac0('0xb')]({'action':'queuesummary'});};};ami[_0x0ac0('0x17')]=function(){return function(){return ami[_0x0ac0('0xb')]({'action':_0x0ac0('0x18')});};};function connect(_0xd75aa4){logger['info'](util['format'](_0x0ac0('0x19'),config['asterisk'][_0x0ac0('0x12')],config[_0x0ac0('0x7')]['ip'],config['asterisk'][_0x0ac0('0x8')]));ami[_0x0ac0('0x1a')](_0x0ac0('0xe'),error);ami['once'](_0x0ac0('0x1b'),close);}ami['on'](_0x0ac0('0x1c'),connect);ami['on']('shutdown',function(_0x6882a9){logger[_0x0ac0('0x1d')](util[_0x0ac0('0xf')](_0x0ac0('0x1e'),config[_0x0ac0('0x7')][_0x0ac0('0x12')],config['asterisk']['ip'],config['asterisk'][_0x0ac0('0x8')],util['inspect'](_0x6882a9,![],null)));});ami['on'](_0x0ac0('0x1f'),function(_0x544142){logger[_0x0ac0('0x1d')](util[_0x0ac0('0xf')](_0x0ac0('0x20'),config['asterisk'][_0x0ac0('0x12')],config[_0x0ac0('0x7')]['ip'],config['asterisk'][_0x0ac0('0x8')]));return BPromise['resolve']()['then'](ami[_0x0ac0('0x13')]())[_0x0ac0('0x21')](ami[_0x0ac0('0x15')]())[_0x0ac0('0x21')](ami[_0x0ac0('0x22')]())[_0x0ac0('0x21')](ami['actionQueueSummary']())['then'](ami[_0x0ac0('0x17')]())[_0x0ac0('0x23')](function(_0x3b437f){console['log'](_0x3b437f);});});ami[_0x0ac0('0x1a')](_0x0ac0('0xe'),error);ami[_0x0ac0('0x1a')](_0x0ac0('0x1b'),close);module[_0x0ac0('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 8778fb2..9c14f52 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 _0xac5d=['client','then','debug','rpc','memberReport','error','message','exports','bluebird','../../config/logger'];(function(_0xd16c61,_0x2fa57e){var _0x2ef528=function(_0x3a967d){while(--_0x3a967d){_0xd16c61['push'](_0xd16c61['shift']());}};_0x2ef528(++_0x2fa57e);}(_0xac5d,0x1de));var _0xdac5=function(_0x41eccd,_0x2052f4){_0x41eccd=_0x41eccd-0x0;var _0x4ebf84=_0xac5d[_0x41eccd];return _0x4ebf84;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xdac5('0x0'));var logger=require(_0xdac5('0x1'))('ami');var client=jayson[_0xdac5('0x2')]['http']({'port':0x2329});client['Request']=function(_0x240d6a,_0x129d1f){return new BPromise(function(_0x1a4e1d,_0x3d57ac){return client['request'](_0x240d6a,_0x129d1f)[_0xdac5('0x3')](function(_0x275529){logger[_0xdac5('0x4')](_0xdac5('0x5'),_0xdac5('0x6'),_0x240d6a,_0x129d1f,_0x275529);if(_0x275529['error']){logger[_0xdac5('0x7')](_0xdac5('0x5'),'memberReport',_0x240d6a,_0x275529['error'][_0xdac5('0x8')],_0x129d1f);return _0x3d57ac(_0x275529[_0xdac5('0x7')]['message']);}else{return _0x1a4e1d(_0x275529['result']);}})['catch'](function(_0x435340){logger[_0xdac5('0x7')](_0xdac5('0x5'),_0xdac5('0x6'),_0x240d6a,_0x435340,_0x129d1f);return _0x3d57ac(_0x435340);});});};module[_0xdac5('0x9')]=client; \ No newline at end of file +var _0x5bae=['catch','jayson/promise','bluebird','../../config/logger','ami','client','then','debug','rpc','error','memberReport','message','result'];(function(_0x1d5d4a,_0x44102d){var _0x348926=function(_0x89c20d){while(--_0x89c20d){_0x1d5d4a['push'](_0x1d5d4a['shift']());}};_0x348926(++_0x44102d);}(_0x5bae,0x153));var _0xe5ba=function(_0x3d82a8,_0x2511fc){_0x3d82a8=_0x3d82a8-0x0;var _0x43b9a2=_0x5bae[_0x3d82a8];return _0x43b9a2;};'use strict';var jayson=require(_0xe5ba('0x0'));var BPromise=require(_0xe5ba('0x1'));var logger=require(_0xe5ba('0x2'))(_0xe5ba('0x3'));var client=jayson[_0xe5ba('0x4')]['http']({'port':0x2329});client['Request']=function(_0x4aa43b,_0x5c93f8){return new BPromise(function(_0x520939,_0x1ef81a){return client['request'](_0x4aa43b,_0x5c93f8)[_0xe5ba('0x5')](function(_0xcbdb6b){logger[_0xe5ba('0x6')](_0xe5ba('0x7'),'memberReport',_0x4aa43b,_0x5c93f8,_0xcbdb6b);if(_0xcbdb6b[_0xe5ba('0x8')]){logger[_0xe5ba('0x8')]('rpc',_0xe5ba('0x9'),_0x4aa43b,_0xcbdb6b[_0xe5ba('0x8')][_0xe5ba('0xa')],_0x5c93f8);return _0x1ef81a(_0xcbdb6b[_0xe5ba('0x8')][_0xe5ba('0xa')]);}else{return _0x520939(_0xcbdb6b[_0xe5ba('0xb')]);}})[_0xe5ba('0xc')](function(_0x2cfae4){logger['error']('rpc',_0xe5ba('0x9'),_0x4aa43b,_0x2cfae4,_0x5c93f8);return _0x1ef81a(_0x2cfae4);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 3f1c6c6..a791d4f 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 _0x240d=['callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue','substring','dialCutDigit','prototype','getQueue','exports','lodash','moment','isNil','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x240d,0x17e));var _0xd240=function(_0x334bd4,_0x2c9665){_0x334bd4=_0x334bd4-0x0;var _0x2b367f=_0x240d[_0x334bd4];return _0x2b367f;};'use strict';var util=require('util');var _=require(_0xd240('0x0'));var moment=require(_0xd240('0x1'));function checkNameSurname(_0x595f73,_0x1b24b6,_0x20ce67){var _0x3db70c='';if(!_[_0xd240('0x2')](_0x1b24b6)&&'string'===typeof _0x1b24b6){_0x3db70c+=_0x1b24b6;}if(!_[_0xd240('0x2')](_0x20ce67)&&'string'===typeof _0x20ce67){_0x3db70c+='\x20'+_0x20ce67;}if(_0x3db70c!==''){return _0x3db70c;}return _0x595f73;}function Action(_0x518cbe,_0x4c0137,_0x4b69cb){this['voiceQueue']=_0x518cbe;this[_0xd240('0x3')]=_0x4b69cb||undefined;this[_0xd240('0x4')]=checkNameSurname(_0x4c0137[_0xd240('0x5')][_0xd240('0x6')],_0x4c0137['Contact']['firstName'],_0x4c0137[_0xd240('0x5')][_0xd240('0x7')]);this[_0xd240('0x8')]=_0x4c0137[_0xd240('0x6')];this[_0xd240('0x9')]=_0x518cbe[_0xd240('0x4')];this[_0xd240('0xa')]=_0x4c0137['active']||![];this[_0xd240('0xb')]=_0x518cbe[_0xd240('0xb')];this[_0xd240('0xc')]=_0x518cbe[_0xd240('0xc')]||0x3;this[_0xd240('0xd')]=_0x4c0137[_0xd240('0xd')];this['countbusyretry']=_0x4c0137[_0xd240('0xe')];this[_0xd240('0xf')]=_0x4c0137[_0xd240('0xf')];this[_0xd240('0x10')]=_0x4c0137[_0xd240('0x10')];this[_0xd240('0x11')]=_0x4c0137[_0xd240('0x11')];this[_0xd240('0x12')]=_0x4c0137['countdropretry'];this[_0xd240('0x13')]=_0x4c0137['countabandonedretry'];this[_0xd240('0x14')]=_0x4c0137[_0xd240('0x14')];this['countagentrejectretry']=_0x4c0137['countagentrejectretry'];this[_0xd240('0x15')]=_0x4c0137[_0xd240('0x15')];this['ListId']=_0x4c0137['ListId'];this[_0xd240('0x16')]=_0x4c0137['UserId'];this[_0xd240('0x17')]=_0x4c0137[_0xd240('0x17')];this['CampaignId']=_0x4c0137[_0xd240('0x18')];this[_0xd240('0x19')]=_0x4c0137['id'];this[_0xd240('0x1a')]=_0x4c0137[_0xd240('0x5')]['firstName']||'';this['starttime']=moment()[_0xd240('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x4c0137[_0xd240('0x1c')];this[_0xd240('0x1d')]=_0x4c0137[_0xd240('0x1d')];this[_0xd240('0x1e')]=_0x4c0137[_0xd240('0x1e')];this['recallme']=_0x4c0137['recallme'];this[_0xd240('0x1f')]='';this[_0xd240('0x20')]='';}Action['prototype'][_0xd240('0x21')]=function(){return util[_0xd240('0x1b')](_0xd240('0x22'),this[_0xd240('0x4')],this[_0xd240('0x23')]['dialCutDigit']>0x0?this[_0xd240('0x8')][_0xd240('0x24')](this[_0xd240('0x23')][_0xd240('0x25')]):this[_0xd240('0x8')]);};Action[_0xd240('0x26')][_0xd240('0x27')]=function(){return this[_0xd240('0x9')];};module[_0xd240('0x28')]=Action; \ No newline at end of file +var _0xda6e=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x3fc37b,_0x41d1b7){var _0x429df5=function(_0x5dec92){while(--_0x5dec92){_0x3fc37b['push'](_0x3fc37b['shift']());}};_0x429df5(++_0x41d1b7);}(_0xda6e,0x152));var _0xeda6=function(_0x25dc3c,_0x17c816){_0x25dc3c=_0x25dc3c-0x0;var _0x1382e3=_0xda6e[_0x25dc3c];return _0x1382e3;};'use strict';var util=require(_0xeda6('0x0'));var _=require(_0xeda6('0x1'));var moment=require(_0xeda6('0x2'));function checkNameSurname(_0x51f735,_0x1370d1,_0x392a38){var _0x235740='';if(!_['isNil'](_0x1370d1)&&_0xeda6('0x3')===typeof _0x1370d1){_0x235740+=_0x1370d1;}if(!_[_0xeda6('0x4')](_0x392a38)&&_0xeda6('0x3')===typeof _0x392a38){_0x235740+='\x20'+_0x392a38;}if(_0x235740!==''){return _0x235740;}return _0x51f735;}function Action(_0x7c01aa,_0x258807,_0x161a9f){this[_0xeda6('0x5')]=_0x7c01aa;this[_0xeda6('0x6')]=_0x161a9f||undefined;this[_0xeda6('0x7')]=checkNameSurname(_0x258807[_0xeda6('0x8')][_0xeda6('0x9')],_0x258807[_0xeda6('0x8')]['firstName'],_0x258807['Contact'][_0xeda6('0xa')]);this[_0xeda6('0xb')]=_0x258807[_0xeda6('0x9')];this['queue']=_0x7c01aa[_0xeda6('0x7')];this[_0xeda6('0xc')]=_0x258807[_0xeda6('0xc')]||![];this['type']=_0x7c01aa[_0xeda6('0xd')];this[_0xeda6('0xe')]=_0x7c01aa['dialQueueTimeout']||0x3;this[_0xeda6('0xf')]=_0x258807[_0xeda6('0xf')];this['countbusyretry']=_0x258807[_0xeda6('0x10')];this['countcongestionretry']=_0x258807[_0xeda6('0x11')];this['countnoanswerretry']=_0x258807[_0xeda6('0x12')];this[_0xeda6('0x13')]=_0x258807[_0xeda6('0x13')];this['countdropretry']=_0x258807[_0xeda6('0x14')];this[_0xeda6('0x15')]=_0x258807[_0xeda6('0x15')];this['countmachineretry']=_0x258807['countmachineretry'];this[_0xeda6('0x16')]=_0x258807[_0xeda6('0x16')];this[_0xeda6('0x17')]=_0x258807[_0xeda6('0x17')];this[_0xeda6('0x18')]=_0x258807['ListId'];this[_0xeda6('0x19')]=_0x258807['UserId'];this[_0xeda6('0x1a')]=_0x258807['VoiceQueueId'];this['CampaignId']=_0x258807['CampaignId'];this[_0xeda6('0x1b')]=_0x258807['id'];this[_0xeda6('0x1c')]=_0x258807[_0xeda6('0x8')][_0xeda6('0x1d')]||'';this[_0xeda6('0x1e')]=moment()[_0xeda6('0x1f')](_0xeda6('0x20'));this[_0xeda6('0x21')]=_0x258807['callback'];this['callbackuniqueid']=_0x258807['callbackuniqueid'];this[_0xeda6('0x22')]=_0x258807[_0xeda6('0x22')];this[_0xeda6('0x23')]=_0x258807[_0xeda6('0x23')];this[_0xeda6('0x24')]='';this[_0xeda6('0x25')]='';}Action[_0xeda6('0x26')][_0xeda6('0x27')]=function(){return util[_0xeda6('0x1f')](_0xeda6('0x28'),this[_0xeda6('0x7')],this[_0xeda6('0x5')][_0xeda6('0x29')]>0x0?this[_0xeda6('0xb')][_0xeda6('0x2a')](this[_0xeda6('0x5')][_0xeda6('0x29')]):this['number']);};Action[_0xeda6('0x26')][_0xeda6('0x2b')]=function(){return this['queue'];};module[_0xeda6('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 3e7b510..8020007 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2ca=['calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','diff','uniqueid','scheduledat','campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x49b385,_0x2a4a84){var _0x317e8f=function(_0x18f811){while(--_0x18f811){_0x49b385['push'](_0x49b385['shift']());}};_0x317e8f(++_0x2a4a84);}(_0xc2ca,0xe3));var _0xac2c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc2ca[_0x3e5086];return _0xfeb102;};'use strict';var util=require('util');var _=require(_0xac2c('0x0'));var moment=require(_0xac2c('0x1'));function getSeconds(_0x286d37,_0x302422){var _0x56843b=moment(_0x286d37)['milliseconds'](0x0);var _0x53a4f5=moment(_0x302422)['milliseconds'](0x0);return _0x56843b[_0xac2c('0x2')](_0x53a4f5,'seconds');}function AdditionalPhone(_0x8a52ca){this[_0xac2c('0x3')]=_0x8a52ca[_0xac2c('0x3')];this[_0xac2c('0x4')]=_0x8a52ca['scheduledat']||undefined;this['type']=_0x8a52ca['type'];this[_0xac2c('0x5')]=_0x8a52ca['type']===_0xac2c('0x6')?_0xac2c('0x7'):_0x8a52ca[_0xac2c('0x8')];this[_0xac2c('0x9')]=_0x8a52ca['countbusyretry'];this[_0xac2c('0xa')]=_0x8a52ca[_0xac2c('0xa')];this[_0xac2c('0xb')]=_0x8a52ca['countnoanswerretry'];this[_0xac2c('0xc')]=_0x8a52ca['countbusyretry']+_0x8a52ca[_0xac2c('0xa')]+_0x8a52ca[_0xac2c('0xb')]+_0x8a52ca[_0xac2c('0xd')]+_0x8a52ca[_0xac2c('0xe')]+_0x8a52ca[_0xac2c('0xf')]+_0x8a52ca[_0xac2c('0x10')]+_0x8a52ca[_0xac2c('0x11')];this[_0xac2c('0xd')]=_0x8a52ca['countnosuchnumberretry'];this[_0xac2c('0xe')]=_0x8a52ca[_0xac2c('0xe')];this[_0xac2c('0xf')]=_0x8a52ca[_0xac2c('0xf')];this[_0xac2c('0x10')]=_0x8a52ca[_0xac2c('0x10')];this[_0xac2c('0x11')]=_0x8a52ca[_0xac2c('0x11')];this[_0xac2c('0x7')]=_0x8a52ca[_0xac2c('0x7')];this[_0xac2c('0x12')]=_0x8a52ca['name'];this[_0xac2c('0x13')]=_0x8a52ca['number'];this[_0xac2c('0x14')]=_0x8a52ca['starttime'];this[_0xac2c('0x15')]=_0x8a52ca['responsetime'];this['endtime']=_0x8a52ca['responsetime'];this[_0xac2c('0x16')]=getSeconds(_0x8a52ca[_0xac2c('0x15')],_0x8a52ca['starttime']);this[_0xac2c('0x17')]=0x0;this[_0xac2c('0x18')]=0x0;this['callback']=_0x8a52ca[_0xac2c('0x19')];this[_0xac2c('0x1a')]=_0x8a52ca['callbackuniqueid'];this[_0xac2c('0x1b')]=_0x8a52ca[_0xac2c('0x1b')];this[_0xac2c('0x1c')]=_0x8a52ca[_0xac2c('0x1c')];this[_0xac2c('0x1d')]=_0x8a52ca['ContactId'];this['ListId']=_0x8a52ca['ListId'];this[_0xac2c('0x1e')]=_0x8a52ca[_0xac2c('0x1e')];this[_0xac2c('0x1f')]=_0x8a52ca['VoiceQueueId'];this[_0xac2c('0x20')]=_0x8a52ca['CampaignId'];this[_0xac2c('0x21')]=_0x8a52ca[_0xac2c('0x21')]||'';this[_0xac2c('0x22')]=_0x8a52ca[_0xac2c('0x22')]||'';}module['exports']=History; \ No newline at end of file +var _0x4ede=['callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x4ede,0x1ab));var _0xe4ed=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4ede[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require('util');var _=require(_0xe4ed('0x0'));var moment=require(_0xe4ed('0x1'));function getSeconds(_0x5401ae,_0x518e78){var _0x4ce636=moment(_0x5401ae)[_0xe4ed('0x2')](0x0);var _0x5697bf=moment(_0x518e78)['milliseconds'](0x0);return _0x4ce636[_0xe4ed('0x3')](_0x5697bf,_0xe4ed('0x4'));}function AdditionalPhone(_0x1c0cda){this['uniqueid']=_0x1c0cda[_0xe4ed('0x5')];this['scheduledat']=_0x1c0cda[_0xe4ed('0x6')]||undefined;this[_0xe4ed('0x7')]=_0x1c0cda[_0xe4ed('0x7')];this[_0xe4ed('0x8')]=_0x1c0cda[_0xe4ed('0x7')]==='outbound'?'queue':_0x1c0cda[_0xe4ed('0x7')];this[_0xe4ed('0x9')]=_0x1c0cda[_0xe4ed('0x9')];this[_0xe4ed('0xa')]=_0x1c0cda['countcongestionretry'];this['countnoanswerretry']=_0x1c0cda[_0xe4ed('0xb')];this[_0xe4ed('0xc')]=_0x1c0cda['countbusyretry']+_0x1c0cda['countcongestionretry']+_0x1c0cda[_0xe4ed('0xb')]+_0x1c0cda[_0xe4ed('0xd')]+_0x1c0cda[_0xe4ed('0xe')]+_0x1c0cda[_0xe4ed('0xf')]+_0x1c0cda[_0xe4ed('0x10')]+_0x1c0cda['countagentrejectretry'];this[_0xe4ed('0xd')]=_0x1c0cda[_0xe4ed('0xd')];this[_0xe4ed('0xe')]=_0x1c0cda[_0xe4ed('0xe')];this[_0xe4ed('0xf')]=_0x1c0cda[_0xe4ed('0xf')];this['countmachineretry']=_0x1c0cda[_0xe4ed('0x10')];this[_0xe4ed('0x11')]=_0x1c0cda[_0xe4ed('0x11')];this[_0xe4ed('0x12')]=_0x1c0cda['queue'];this[_0xe4ed('0x13')]=_0x1c0cda[_0xe4ed('0x14')];this[_0xe4ed('0x15')]=_0x1c0cda[_0xe4ed('0x16')];this['starttime']=_0x1c0cda['starttime'];this[_0xe4ed('0x17')]=_0x1c0cda[_0xe4ed('0x17')];this[_0xe4ed('0x18')]=_0x1c0cda['responsetime'];this['ringtime']=getSeconds(_0x1c0cda['responsetime'],_0x1c0cda['starttime']);this[_0xe4ed('0x19')]=0x0;this[_0xe4ed('0x1a')]=0x0;this['callback']=_0x1c0cda[_0xe4ed('0x1b')];this[_0xe4ed('0x1c')]=_0x1c0cda[_0xe4ed('0x1c')];this[_0xe4ed('0x1d')]=_0x1c0cda[_0xe4ed('0x1d')];this['recallme']=_0x1c0cda['recallme'];this[_0xe4ed('0x1e')]=_0x1c0cda[_0xe4ed('0x1e')];this[_0xe4ed('0x1f')]=_0x1c0cda[_0xe4ed('0x1f')];this['UserId']=_0x1c0cda[_0xe4ed('0x20')];this[_0xe4ed('0x21')]=_0x1c0cda[_0xe4ed('0x21')];this[_0xe4ed('0x22')]=_0x1c0cda[_0xe4ed('0x22')];this['originatecalleridnum']=_0x1c0cda[_0xe4ed('0x23')]||'';this[_0xe4ed('0x24')]=_0x1c0cda[_0xe4ed('0x24')]||'';}module[_0xe4ed('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index cf42eab..18f2cc6 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 _0xe100=['membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime'];(function(_0x2281a0,_0x1351d6){var _0x265a56=function(_0x38b3fa){while(--_0x38b3fa){_0x2281a0['push'](_0x2281a0['shift']());}};_0x265a56(++_0x1351d6);}(_0xe100,0xdd));var _0x0e10=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe100[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x0e10('0x0'));var _=require('lodash');var moment=require(_0x0e10('0x1'));function getSeconds(_0x5397b3,_0x1d9b1a){var _0x11224c=moment(_0x5397b3)[_0x0e10('0x2')](0x0);var _0x2d6c7c=moment(_0x1d9b1a)['milliseconds'](0x0);return _0x11224c[_0x0e10('0x3')](_0x2d6c7c,_0x0e10('0x4'));}function AgentComplete(_0x23604e,_0x35fdc1){this[_0x0e10('0x5')]=0x4;this[_0x0e10('0x6')]=_0x0e10('0x7');this[_0x0e10('0x8')]=_0x23604e[_0x0e10('0x8')];this['type']=_0x23604e[_0x0e10('0x9')];this['campaigntype']=_0x23604e[_0x0e10('0x9')]==='outbound'?_0x0e10('0xa'):_0x23604e[_0x0e10('0x9')];this[_0x0e10('0xb')]=_0x23604e[_0x0e10('0xb')];this['countcongestionretry']=_0x23604e['countcongestionretry'];this[_0x0e10('0xc')]=_0x23604e[_0x0e10('0xc')];this['countglobal']=_0x23604e[_0x0e10('0xb')]+_0x23604e[_0x0e10('0xd')]+_0x23604e[_0x0e10('0xc')]+_0x23604e[_0x0e10('0xe')]+_0x23604e[_0x0e10('0xf')]+_0x23604e['countabandonedretry']+_0x23604e[_0x0e10('0x10')]+_0x23604e[_0x0e10('0x11')];this[_0x0e10('0xe')]=_0x23604e['countnosuchnumberretry'];this['countdropretry']=_0x23604e[_0x0e10('0xf')];this[_0x0e10('0x12')]=_0x23604e['countabandonedretry'];this[_0x0e10('0x10')]=_0x23604e[_0x0e10('0x10')];this[_0x0e10('0x11')]=_0x23604e[_0x0e10('0x11')];this['uniqueid']=_0x35fdc1[_0x0e10('0x13')];this[_0x0e10('0x14')]=_0x23604e[_0x0e10('0x15')];this['calleridnum']=_0x23604e[_0x0e10('0x16')];this[_0x0e10('0x17')]=_0x23604e[_0x0e10('0x17')];this[_0x0e10('0x18')]=_0x23604e[_0x0e10('0x18')];this[_0x0e10('0x19')]=_0x23604e[_0x0e10('0x19')];this['endtime']=moment()['format'](_0x0e10('0x1a'));this[_0x0e10('0x1b')]=getSeconds(_0x23604e[_0x0e10('0x18')],_0x23604e['starttime']);this[_0x0e10('0x1c')]=getSeconds(_0x23604e['answertime'],_0x23604e[_0x0e10('0x18')]);this[_0x0e10('0x1d')]=getSeconds(this[_0x0e10('0x1e')],_0x23604e[_0x0e10('0x19')]);this[_0x0e10('0xa')]=_0x35fdc1[_0x0e10('0xa')];this[_0x0e10('0x1f')]=_0x35fdc1['membername'];this['reason']=_0x35fdc1[_0x0e10('0x20')];this[_0x0e10('0x21')]=_0x23604e['callback'];this['callbackuniqueid']=_0x23604e['callbackuniqueid'];this[_0x0e10('0x22')]=_0x23604e[_0x0e10('0x22')];this[_0x0e10('0x23')]=_0x23604e[_0x0e10('0x23')];this[_0x0e10('0x24')]=_0x23604e['ContactId'];this[_0x0e10('0x25')]=_0x23604e[_0x0e10('0x25')];this['UserId']=_0x23604e[_0x0e10('0x26')];this[_0x0e10('0x27')]=_0x23604e['VoiceQueueId'];this['CampaignId']=_0x23604e['CampaignId'];this['originatecalleridnum']=_0x23604e['originatecalleridnum']||'';this[_0x0e10('0x28')]=_0x23604e['originatecalleridname']||'';}module[_0x0e10('0x29')]=AgentComplete; \ No newline at end of file +var _0x4d5b=['type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','campaigntype'];(function(_0x30f85c,_0x20d3fd){var _0x17be86=function(_0x4b4500){while(--_0x4b4500){_0x30f85c['push'](_0x30f85c['shift']());}};_0x17be86(++_0x20d3fd);}(_0x4d5b,0x1ce));var _0xb4d5=function(_0x6920a6,_0x5c48b7){_0x6920a6=_0x6920a6-0x0;var _0x37589e=_0x4d5b[_0x6920a6];return _0x37589e;};'use strict';var util=require('util');var _=require(_0xb4d5('0x0'));var moment=require(_0xb4d5('0x1'));function getSeconds(_0x18b310,_0x56055c){var _0x20bad8=moment(_0x18b310)[_0xb4d5('0x2')](0x0);var _0x2b6c62=moment(_0x56055c)['milliseconds'](0x0);return _0x20bad8[_0xb4d5('0x3')](_0x2b6c62,'seconds');}function AgentComplete(_0x1e4263,_0xe13be3){this[_0xb4d5('0x4')]=0x4;this[_0xb4d5('0x5')]='Answer';this[_0xb4d5('0x6')]=_0x1e4263[_0xb4d5('0x6')];this['type']=_0x1e4263['type'];this[_0xb4d5('0x7')]=_0x1e4263[_0xb4d5('0x8')]===_0xb4d5('0x9')?_0xb4d5('0xa'):_0x1e4263['type'];this['countbusyretry']=_0x1e4263[_0xb4d5('0xb')];this[_0xb4d5('0xc')]=_0x1e4263[_0xb4d5('0xc')];this[_0xb4d5('0xd')]=_0x1e4263[_0xb4d5('0xd')];this[_0xb4d5('0xe')]=_0x1e4263[_0xb4d5('0xb')]+_0x1e4263[_0xb4d5('0xc')]+_0x1e4263[_0xb4d5('0xd')]+_0x1e4263[_0xb4d5('0xf')]+_0x1e4263[_0xb4d5('0x10')]+_0x1e4263[_0xb4d5('0x11')]+_0x1e4263[_0xb4d5('0x12')]+_0x1e4263[_0xb4d5('0x13')];this[_0xb4d5('0xf')]=_0x1e4263['countnosuchnumberretry'];this[_0xb4d5('0x10')]=_0x1e4263[_0xb4d5('0x10')];this['countabandonedretry']=_0x1e4263[_0xb4d5('0x11')];this['countmachineretry']=_0x1e4263['countmachineretry'];this[_0xb4d5('0x13')]=_0x1e4263[_0xb4d5('0x13')];this[_0xb4d5('0x14')]=_0xe13be3[_0xb4d5('0x14')];this[_0xb4d5('0x15')]=_0x1e4263[_0xb4d5('0x16')];this[_0xb4d5('0x17')]=_0x1e4263[_0xb4d5('0x18')];this[_0xb4d5('0x19')]=_0x1e4263[_0xb4d5('0x19')];this[_0xb4d5('0x1a')]=_0x1e4263[_0xb4d5('0x1a')];this[_0xb4d5('0x1b')]=_0x1e4263[_0xb4d5('0x1b')];this[_0xb4d5('0x1c')]=moment()['format'](_0xb4d5('0x1d'));this[_0xb4d5('0x1e')]=getSeconds(_0x1e4263[_0xb4d5('0x1a')],_0x1e4263[_0xb4d5('0x19')]);this[_0xb4d5('0x1f')]=getSeconds(_0x1e4263[_0xb4d5('0x1b')],_0x1e4263[_0xb4d5('0x1a')]);this[_0xb4d5('0x20')]=getSeconds(this[_0xb4d5('0x1c')],_0x1e4263[_0xb4d5('0x1b')]);this[_0xb4d5('0xa')]=_0xe13be3[_0xb4d5('0xa')];this['membername']=_0xe13be3[_0xb4d5('0x21')];this[_0xb4d5('0x22')]=_0xe13be3[_0xb4d5('0x22')];this['callback']=_0x1e4263[_0xb4d5('0x23')];this[_0xb4d5('0x24')]=_0x1e4263[_0xb4d5('0x24')];this[_0xb4d5('0x25')]=_0x1e4263[_0xb4d5('0x25')];this[_0xb4d5('0x26')]=_0x1e4263[_0xb4d5('0x26')];this[_0xb4d5('0x27')]=_0x1e4263[_0xb4d5('0x27')];this[_0xb4d5('0x28')]=_0x1e4263['ListId'];this[_0xb4d5('0x29')]=_0x1e4263[_0xb4d5('0x29')];this['VoiceQueueId']=_0x1e4263[_0xb4d5('0x2a')];this[_0xb4d5('0x2b')]=_0x1e4263['CampaignId'];this[_0xb4d5('0x2c')]=_0x1e4263[_0xb4d5('0x2c')]||'';this[_0xb4d5('0x2d')]=_0x1e4263[_0xb4d5('0x2d')]||'';}module[_0xb4d5('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index c11d031..ef79cfd 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 _0x9750=['callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','milliseconds','diff','seconds','uniqueid','scheduledat','campaigntype','outbound','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback'];(function(_0x1fb51b,_0x40539c){var _0x173ebb=function(_0x1024bc){while(--_0x1024bc){_0x1fb51b['push'](_0x1fb51b['shift']());}};_0x173ebb(++_0x40539c);}(_0x9750,0xb2));var _0x0975=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x9750[_0x1e7b16];return _0x37fadc;};'use strict';var util=require(_0x0975('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x371053,_0x319cf0){var _0x2ad039=moment(_0x371053)[_0x0975('0x1')](0x0);var _0x6b47ec=moment(_0x319cf0)['milliseconds'](0x0);return _0x2ad039[_0x0975('0x2')](_0x6b47ec,_0x0975('0x3'));}function Final(_0x5271ca){this[_0x0975('0x4')]=_0x5271ca[_0x0975('0x4')];this['scheduledat']=_0x5271ca[_0x0975('0x5')];this['type']=_0x5271ca['type'];this[_0x0975('0x6')]=_0x5271ca['type']===_0x0975('0x7')?'queue':_0x5271ca[_0x0975('0x8')];this[_0x0975('0x9')]=_0x5271ca[_0x0975('0x9')];this[_0x0975('0xa')]=_0x5271ca[_0x0975('0xa')];this[_0x0975('0xb')]=_0x5271ca[_0x0975('0xb')];this['countglobal']=_0x5271ca[_0x0975('0x9')]+_0x5271ca[_0x0975('0xa')]+_0x5271ca['countnoanswerretry']+_0x5271ca[_0x0975('0xc')]+_0x5271ca[_0x0975('0xd')]+_0x5271ca[_0x0975('0xe')]+_0x5271ca['countmachineretry']+_0x5271ca[_0x0975('0xf')];this[_0x0975('0xc')]=_0x5271ca[_0x0975('0xc')];this[_0x0975('0xd')]=_0x5271ca[_0x0975('0xd')];this[_0x0975('0xe')]=_0x5271ca['countabandonedretry'];this[_0x0975('0x10')]=_0x5271ca[_0x0975('0x10')];this[_0x0975('0xf')]=_0x5271ca[_0x0975('0xf')];this[_0x0975('0x11')]=_0x5271ca[_0x0975('0x11')];this[_0x0975('0x12')]=_0x5271ca[_0x0975('0x12')];this[_0x0975('0x13')]=_0x5271ca[_0x0975('0x13')];this[_0x0975('0x14')]=_0x5271ca[_0x0975('0x14')];this[_0x0975('0x15')]=_0x5271ca[_0x0975('0x15')];this[_0x0975('0x16')]=_0x5271ca['responsetime'];this[_0x0975('0x17')]=_0x5271ca[_0x0975('0x17')]||0x0;this['holdtime']=_0x5271ca['holdtime']||0x0;this[_0x0975('0x18')]=_0x5271ca[_0x0975('0x18')]||0x0;this[_0x0975('0x19')]=_0x5271ca['callback'];this[_0x0975('0x1a')]=_0x5271ca[_0x0975('0x1a')];this[_0x0975('0x1b')]=_0x5271ca['callbackat'];this['recallme']=_0x5271ca['recallme'];this[_0x0975('0x1c')]=_0x5271ca[_0x0975('0x1c')];this[_0x0975('0x1d')]=_0x5271ca[_0x0975('0x1d')];this[_0x0975('0x1e')]=_0x5271ca['UserId'];this[_0x0975('0x1f')]=_0x5271ca[_0x0975('0x1f')];this[_0x0975('0x20')]=_0x5271ca[_0x0975('0x20')];this['originatecalleridnum']=_0x5271ca['originatecalleridnum']||'';this[_0x0975('0x21')]=_0x5271ca[_0x0975('0x21')]||'';}module['exports']=Final; \ No newline at end of file +var _0xdb7e=['CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0xdb7e,0x9b));var _0xedb7=function(_0x5aed9c,_0x19feb5){_0x5aed9c=_0x5aed9c-0x0;var _0x35b9c5=_0xdb7e[_0x5aed9c];return _0x35b9c5;};'use strict';var util=require(_0xedb7('0x0'));var _=require(_0xedb7('0x1'));var moment=require(_0xedb7('0x2'));function getSeconds(_0xf24d8e,_0x5f1ddc){var _0x2aab94=moment(_0xf24d8e)['milliseconds'](0x0);var _0x3a1933=moment(_0x5f1ddc)[_0xedb7('0x3')](0x0);return _0x2aab94[_0xedb7('0x4')](_0x3a1933,_0xedb7('0x5'));}function Final(_0x389d1e){this['uniqueid']=_0x389d1e['uniqueid'];this[_0xedb7('0x6')]=_0x389d1e[_0xedb7('0x6')];this['type']=_0x389d1e['type'];this['campaigntype']=_0x389d1e[_0xedb7('0x7')]===_0xedb7('0x8')?_0xedb7('0x9'):_0x389d1e[_0xedb7('0x7')];this[_0xedb7('0xa')]=_0x389d1e[_0xedb7('0xa')];this['countcongestionretry']=_0x389d1e[_0xedb7('0xb')];this[_0xedb7('0xc')]=_0x389d1e[_0xedb7('0xc')];this[_0xedb7('0xd')]=_0x389d1e[_0xedb7('0xa')]+_0x389d1e[_0xedb7('0xb')]+_0x389d1e['countnoanswerretry']+_0x389d1e[_0xedb7('0xe')]+_0x389d1e[_0xedb7('0xf')]+_0x389d1e['countabandonedretry']+_0x389d1e['countmachineretry']+_0x389d1e[_0xedb7('0x10')];this['countnosuchnumberretry']=_0x389d1e['countnosuchnumberretry'];this[_0xedb7('0xf')]=_0x389d1e[_0xedb7('0xf')];this[_0xedb7('0x11')]=_0x389d1e[_0xedb7('0x11')];this[_0xedb7('0x12')]=_0x389d1e[_0xedb7('0x12')];this['countagentrejectretry']=_0x389d1e[_0xedb7('0x10')];this[_0xedb7('0x9')]=_0x389d1e[_0xedb7('0x9')];this[_0xedb7('0x13')]=_0x389d1e[_0xedb7('0x13')];this[_0xedb7('0x14')]=_0x389d1e[_0xedb7('0x14')];this[_0xedb7('0x15')]=_0x389d1e[_0xedb7('0x15')];this['responsetime']=_0x389d1e[_0xedb7('0x16')];this[_0xedb7('0x17')]=_0x389d1e[_0xedb7('0x16')];this[_0xedb7('0x18')]=_0x389d1e[_0xedb7('0x18')]||0x0;this['holdtime']=_0x389d1e[_0xedb7('0x19')]||0x0;this['talktime']=_0x389d1e[_0xedb7('0x1a')]||0x0;this['callback']=_0x389d1e[_0xedb7('0x1b')];this['callbackuniqueid']=_0x389d1e[_0xedb7('0x1c')];this['callbackat']=_0x389d1e[_0xedb7('0x1d')];this[_0xedb7('0x1e')]=_0x389d1e[_0xedb7('0x1e')];this[_0xedb7('0x1f')]=_0x389d1e[_0xedb7('0x1f')];this[_0xedb7('0x20')]=_0x389d1e['ListId'];this[_0xedb7('0x21')]=_0x389d1e['UserId'];this['VoiceQueueId']=_0x389d1e[_0xedb7('0x22')];this[_0xedb7('0x23')]=_0x389d1e['CampaignId'];this[_0xedb7('0x24')]=_0x389d1e[_0xedb7('0x24')]||'';this['originatecalleridname']=_0x389d1e['originatecalleridname']||'';}module[_0xedb7('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a3f8f23..14751c5 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 _0x124d=['starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','endtime','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','statedesc','Answer','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number'];(function(_0x2a9b1f,_0xfb584d){var _0x3dde47=function(_0xb9a54a){while(--_0xb9a54a){_0x2a9b1f['push'](_0x2a9b1f['shift']());}};_0x3dde47(++_0xfb584d);}(_0x124d,0x91));var _0xd124=function(_0x30bb46,_0x1c722a){_0x30bb46=_0x30bb46-0x0;var _0x49b2f5=_0x124d[_0x30bb46];return _0x49b2f5;};'use strict';var util=require(_0xd124('0x0'));var _=require(_0xd124('0x1'));var moment=require(_0xd124('0x2'));function getSeconds(_0x6cf4ed,_0x27ab5c){var _0x36023d=moment(_0x6cf4ed)[_0xd124('0x3')](0x0);var _0x172205=moment(_0x27ab5c)[_0xd124('0x3')](0x0);return _0x36023d['diff'](_0x172205,'seconds');}function Hangup(_0x546d63,_0x3d101d){this['state']=0x4;this[_0xd124('0x4')]=_0xd124('0x5');this['scheduledat']=_0x546d63['scheduledat'];this['type']=_0x546d63['type'];this[_0xd124('0x6')]=_0x546d63[_0xd124('0x7')]===_0xd124('0x8')?_0xd124('0x9'):_0x546d63[_0xd124('0x7')];this[_0xd124('0xa')]=_0x546d63[_0xd124('0xa')];this[_0xd124('0xb')]=_0x546d63['countcongestionretry'];this[_0xd124('0xc')]=_0x546d63[_0xd124('0xc')];this[_0xd124('0xd')]=_0x546d63[_0xd124('0xa')]+_0x546d63['countcongestionretry']+_0x546d63[_0xd124('0xc')]+_0x546d63[_0xd124('0xe')]+_0x546d63[_0xd124('0xf')]+_0x546d63[_0xd124('0x10')]+_0x546d63['countmachineretry']+_0x546d63['countagentrejectretry'];this['countnosuchnumberretry']=_0x546d63[_0xd124('0xe')];this['countdropretry']=_0x546d63[_0xd124('0xf')];this[_0xd124('0x10')]=_0x546d63[_0xd124('0x10')];this['countmachineretry']=_0x546d63[_0xd124('0x11')];this[_0xd124('0x12')]=_0x546d63[_0xd124('0x12')];this[_0xd124('0x13')]=_0x3d101d[_0xd124('0x13')];this[_0xd124('0x14')]=_0x546d63[_0xd124('0x15')];this['calleridnum']=_0x546d63[_0xd124('0x16')];this[_0xd124('0x17')]=_0x546d63[_0xd124('0x17')];this[_0xd124('0x18')]=_0x546d63['responsetime'];this['endtime']=moment()[_0xd124('0x19')](_0xd124('0x1a'));this[_0xd124('0x1b')]=getSeconds(_0x546d63[_0xd124('0x18')],_0x546d63[_0xd124('0x17')]);this[_0xd124('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xd124('0x1d')],_0x546d63[_0xd124('0x18')]);this[_0xd124('0x9')]=_0x546d63['queue'];this[_0xd124('0x1e')]=_0xd124('0x1f');this['reason']=_0x3d101d['cause-txt'];this[_0xd124('0x20')]=_0x546d63[_0xd124('0x20')];this[_0xd124('0x21')]=_0x546d63['callbackuniqueid'];this[_0xd124('0x22')]=_0x546d63[_0xd124('0x22')];this[_0xd124('0x23')]=_0x546d63[_0xd124('0x23')];this[_0xd124('0x24')]=_0x546d63[_0xd124('0x24')];this[_0xd124('0x25')]=_0x546d63[_0xd124('0x25')];this[_0xd124('0x26')]=_0x546d63['UserId'];this[_0xd124('0x27')]=_0x546d63[_0xd124('0x27')];this[_0xd124('0x28')]=_0x546d63[_0xd124('0x28')];}module[_0xd124('0x29')]=Hangup; \ No newline at end of file +var _0x2136=['VoiceQueueId','CampaignId','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x22fd07,_0x255764){var _0x2ace55=function(_0x5dec87){while(--_0x5dec87){_0x22fd07['push'](_0x22fd07['shift']());}};_0x2ace55(++_0x255764);}(_0x2136,0x1c4));var _0x6213=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x2136[_0x378891];return _0xfbfda2;};'use strict';var util=require(_0x6213('0x0'));var _=require('lodash');var moment=require(_0x6213('0x1'));function getSeconds(_0x371408,_0x67f6ee){var _0x2d6e0e=moment(_0x371408)[_0x6213('0x2')](0x0);var _0x24f164=moment(_0x67f6ee)[_0x6213('0x2')](0x0);return _0x2d6e0e[_0x6213('0x3')](_0x24f164,_0x6213('0x4'));}function Hangup(_0x27a2e2,_0x178b5d){this[_0x6213('0x5')]=0x4;this[_0x6213('0x6')]=_0x6213('0x7');this[_0x6213('0x8')]=_0x27a2e2[_0x6213('0x8')];this[_0x6213('0x9')]=_0x27a2e2['type'];this[_0x6213('0xa')]=_0x27a2e2[_0x6213('0x9')]==='outbound'?_0x6213('0xb'):_0x27a2e2['type'];this[_0x6213('0xc')]=_0x27a2e2['countbusyretry'];this['countcongestionretry']=_0x27a2e2[_0x6213('0xd')];this[_0x6213('0xe')]=_0x27a2e2[_0x6213('0xe')];this[_0x6213('0xf')]=_0x27a2e2[_0x6213('0xc')]+_0x27a2e2[_0x6213('0xd')]+_0x27a2e2[_0x6213('0xe')]+_0x27a2e2[_0x6213('0x10')]+_0x27a2e2['countdropretry']+_0x27a2e2[_0x6213('0x11')]+_0x27a2e2[_0x6213('0x12')]+_0x27a2e2[_0x6213('0x13')];this[_0x6213('0x10')]=_0x27a2e2[_0x6213('0x10')];this[_0x6213('0x14')]=_0x27a2e2[_0x6213('0x14')];this['countabandonedretry']=_0x27a2e2[_0x6213('0x11')];this[_0x6213('0x12')]=_0x27a2e2[_0x6213('0x12')];this['countagentrejectretry']=_0x27a2e2[_0x6213('0x13')];this[_0x6213('0x15')]=_0x178b5d['uniqueid'];this[_0x6213('0x16')]=_0x27a2e2[_0x6213('0x17')];this[_0x6213('0x18')]=_0x27a2e2[_0x6213('0x19')];this[_0x6213('0x1a')]=_0x27a2e2['starttime'];this[_0x6213('0x1b')]=_0x27a2e2['responsetime'];this[_0x6213('0x1c')]=moment()[_0x6213('0x1d')](_0x6213('0x1e'));this[_0x6213('0x1f')]=getSeconds(_0x27a2e2[_0x6213('0x1b')],_0x27a2e2[_0x6213('0x1a')]);this[_0x6213('0x20')]=0x0;this[_0x6213('0x21')]=getSeconds(this[_0x6213('0x1c')],_0x27a2e2['responsetime']);this[_0x6213('0xb')]=_0x27a2e2[_0x6213('0xb')];this[_0x6213('0x22')]=_0x6213('0x23');this['reason']=_0x178b5d[_0x6213('0x24')];this['callback']=_0x27a2e2['callback'];this[_0x6213('0x25')]=_0x27a2e2[_0x6213('0x25')];this[_0x6213('0x26')]=_0x27a2e2[_0x6213('0x26')];this[_0x6213('0x27')]=_0x27a2e2[_0x6213('0x27')];this['ContactId']=_0x27a2e2[_0x6213('0x28')];this['ListId']=_0x27a2e2[_0x6213('0x29')];this[_0x6213('0x2a')]=_0x27a2e2[_0x6213('0x2a')];this[_0x6213('0x2b')]=_0x27a2e2['VoiceQueueId'];this[_0x6213('0x2c')]=_0x27a2e2[_0x6213('0x2c')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index b7762bb..8fbbc53 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 _0xf301=['callbackuniqueid','callbackat','recallme','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','starttime','endtime','ringtime','responsetime','holdtime','talktime'];(function(_0x1d9b84,_0x409ab6){var _0x254e02=function(_0x10f297){while(--_0x10f297){_0x1d9b84['push'](_0x1d9b84['shift']());}};_0x254e02(++_0x409ab6);}(_0xf301,0xe6));var _0x1f30=function(_0x456068,_0x2669c7){_0x456068=_0x456068-0x0;var _0x2b8835=_0xf301[_0x456068];return _0x2b8835;};'use strict';var util=require(_0x1f30('0x0'));var _=require(_0x1f30('0x1'));var moment=require(_0x1f30('0x2'));function getSeconds(_0x2f177d,_0x33f6b1){var _0x412361=moment(_0x2f177d)[_0x1f30('0x3')](0x0);var _0xe890c3=moment(_0x33f6b1)[_0x1f30('0x3')](0x0);return _0x412361[_0x1f30('0x4')](_0xe890c3,_0x1f30('0x5'));}function History(_0x590fae){this[_0x1f30('0x6')]=_0x590fae[_0x1f30('0x6')];this[_0x1f30('0x7')]=_0x590fae['scheduledat']||undefined;this[_0x1f30('0x8')]=_0x590fae[_0x1f30('0x8')];this[_0x1f30('0x9')]=_0x590fae[_0x1f30('0x8')]===_0x1f30('0xa')?_0x1f30('0xb'):_0x590fae[_0x1f30('0x8')];this['countbusyretry']=_0x590fae['countbusyretry'];this[_0x1f30('0xc')]=_0x590fae[_0x1f30('0xc')];this[_0x1f30('0xd')]=_0x590fae[_0x1f30('0xd')];this[_0x1f30('0xe')]=_0x590fae[_0x1f30('0xf')]+_0x590fae['countcongestionretry']+_0x590fae[_0x1f30('0xd')]+_0x590fae[_0x1f30('0x10')]+_0x590fae['countdropretry']+_0x590fae[_0x1f30('0x11')]+_0x590fae[_0x1f30('0x12')]+_0x590fae[_0x1f30('0x13')];this[_0x1f30('0x10')]=_0x590fae['countnosuchnumberretry'];this['countdropretry']=_0x590fae[_0x1f30('0x14')];this[_0x1f30('0x11')]=_0x590fae[_0x1f30('0x11')];this[_0x1f30('0x12')]=_0x590fae[_0x1f30('0x12')];this[_0x1f30('0x13')]=_0x590fae[_0x1f30('0x13')];this[_0x1f30('0xb')]=_0x590fae[_0x1f30('0xb')];this[_0x1f30('0x15')]=_0x590fae[_0x1f30('0x16')];this['calleridnum']=_0x590fae['number'];this['starttime']=_0x590fae[_0x1f30('0x17')];this['responsetime']=_0x590fae['responsetime'];this[_0x1f30('0x18')]=_0x590fae['responsetime'];this[_0x1f30('0x19')]=getSeconds(_0x590fae[_0x1f30('0x1a')],_0x590fae[_0x1f30('0x17')]);this[_0x1f30('0x1b')]=0x0;this[_0x1f30('0x1c')]=0x0;this['callback']=_0x590fae['callback'];this['callbackuniqueid']=_0x590fae[_0x1f30('0x1d')];this[_0x1f30('0x1e')]=_0x590fae['callbackat'];this[_0x1f30('0x1f')]=_0x590fae[_0x1f30('0x1f')];this['ContactId']=_0x590fae['ContactId'];this['ListId']=_0x590fae['ListId'];this[_0x1f30('0x20')]=_0x590fae[_0x1f30('0x20')];this[_0x1f30('0x21')]=_0x590fae[_0x1f30('0x21')];this[_0x1f30('0x22')]=_0x590fae[_0x1f30('0x22')];this['originatecalleridnum']=_0x590fae[_0x1f30('0x23')]||'';this[_0x1f30('0x24')]=_0x590fae[_0x1f30('0x24')]||'';}module['exports']=History; \ No newline at end of file +var _0x12ee=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','number','starttime','endtime','responsetime','ringtime','holdtime'];(function(_0x1eb590,_0x348b6a){var _0x6a5e82=function(_0x2ddd7f){while(--_0x2ddd7f){_0x1eb590['push'](_0x1eb590['shift']());}};_0x6a5e82(++_0x348b6a);}(_0x12ee,0x1a3));var _0xe12e=function(_0x1d3ce8,_0x2775e4){_0x1d3ce8=_0x1d3ce8-0x0;var _0x483045=_0x12ee[_0x1d3ce8];return _0x483045;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe12e('0x0'));function getSeconds(_0x3b81b6,_0x51f285){var _0x38e227=moment(_0x3b81b6)[_0xe12e('0x1')](0x0);var _0x3d37db=moment(_0x51f285)[_0xe12e('0x1')](0x0);return _0x38e227['diff'](_0x3d37db,'seconds');}function History(_0x315f4a){this[_0xe12e('0x2')]=_0x315f4a[_0xe12e('0x2')];this[_0xe12e('0x3')]=_0x315f4a['scheduledat']||undefined;this[_0xe12e('0x4')]=_0x315f4a[_0xe12e('0x4')];this[_0xe12e('0x5')]=_0x315f4a[_0xe12e('0x4')]===_0xe12e('0x6')?_0xe12e('0x7'):_0x315f4a['type'];this[_0xe12e('0x8')]=_0x315f4a[_0xe12e('0x8')];this[_0xe12e('0x9')]=_0x315f4a[_0xe12e('0x9')];this['countnoanswerretry']=_0x315f4a[_0xe12e('0xa')];this[_0xe12e('0xb')]=_0x315f4a[_0xe12e('0x8')]+_0x315f4a[_0xe12e('0x9')]+_0x315f4a[_0xe12e('0xa')]+_0x315f4a[_0xe12e('0xc')]+_0x315f4a[_0xe12e('0xd')]+_0x315f4a['countabandonedretry']+_0x315f4a[_0xe12e('0xe')]+_0x315f4a[_0xe12e('0xf')];this[_0xe12e('0xc')]=_0x315f4a[_0xe12e('0xc')];this['countdropretry']=_0x315f4a[_0xe12e('0xd')];this[_0xe12e('0x10')]=_0x315f4a['countabandonedretry'];this[_0xe12e('0xe')]=_0x315f4a['countmachineretry'];this[_0xe12e('0xf')]=_0x315f4a[_0xe12e('0xf')];this['queue']=_0x315f4a['queue'];this[_0xe12e('0x11')]=_0x315f4a[_0xe12e('0x12')];this['calleridnum']=_0x315f4a[_0xe12e('0x13')];this[_0xe12e('0x14')]=_0x315f4a[_0xe12e('0x14')];this['responsetime']=_0x315f4a['responsetime'];this[_0xe12e('0x15')]=_0x315f4a[_0xe12e('0x16')];this[_0xe12e('0x17')]=getSeconds(_0x315f4a['responsetime'],_0x315f4a[_0xe12e('0x14')]);this[_0xe12e('0x18')]=0x0;this[_0xe12e('0x19')]=0x0;this[_0xe12e('0x1a')]=_0x315f4a[_0xe12e('0x1a')];this['callbackuniqueid']=_0x315f4a[_0xe12e('0x1b')];this[_0xe12e('0x1c')]=_0x315f4a[_0xe12e('0x1c')];this[_0xe12e('0x1d')]=_0x315f4a[_0xe12e('0x1d')];this[_0xe12e('0x1e')]=_0x315f4a[_0xe12e('0x1e')];this[_0xe12e('0x1f')]=_0x315f4a[_0xe12e('0x1f')];this[_0xe12e('0x20')]=_0x315f4a[_0xe12e('0x20')];this[_0xe12e('0x21')]=_0x315f4a[_0xe12e('0x21')];this['CampaignId']=_0x315f4a['CampaignId'];this[_0xe12e('0x22')]=_0x315f4a[_0xe12e('0x22')]||'';this[_0xe12e('0x23')]=_0x315f4a[_0xe12e('0x23')]||'';}module[_0xe12e('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 34954dc..517b822 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 _0xdb1e=['[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','isNil','status','channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','checkIsBlackList','resolve','[checkIsBlackList]\x20','verifyAdditionalPhones','catch','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','Success','SIP/%s','reachable','unmonitored','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','Machine','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','stateGlobal','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dropreason','callAdditionalPhoneAfterMin','voiceQueue','additional','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','syncQueueMember','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','isTrunkReachable','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','countbusyretry','countnosuchnumberretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','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','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','maxNumberOriginate','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','RUNNING','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','./history','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','actions','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuestatuscomplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','Trunk','active','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined'];(function(_0x8a545f,_0x176141){var _0x1908a8=function(_0x5352cd){while(--_0x5352cd){_0x8a545f['push'](_0x8a545f['shift']());}};_0x1908a8(++_0x176141);}(_0xdb1e,0x18a));var _0xedb1=function(_0x2835fd,_0x415386){_0x2835fd=_0x2835fd-0x0;var _0x3515b1=_0xdb1e[_0x2835fd];return _0x3515b1;};'use strict';var util=require(_0xedb1('0x0'));var _=require(_0xedb1('0x1'));var BPromise=require(_0xedb1('0x2'));var uuid=require(_0xedb1('0x3'));var moment=require(_0xedb1('0x4'));var rr=require('rr');var md5=require(_0xedb1('0x5'));var Redis=require(_0xedb1('0x6'));var ut=require(_0xedb1('0x7'));var config=require(_0xedb1('0x8'));var logger=require(_0xedb1('0x9'))(_0xedb1('0xa'));var loggerBooked=require(_0xedb1('0x9'))(_0xedb1('0xb'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0xedb1('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xedb1('0xd'));var ami=require(_0xedb1('0xe'));config[_0xedb1('0xf')]=_['defaults'](config[_0xedb1('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0xedb1('0x10'))(new Redis(config[_0xedb1('0xf')]));var cmHopper=require(_0xedb1('0x11'));var cmHopperHistory=require(_0xedb1('0x12'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0xedb1('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xedb1('0x14'));var Action=require('./action');var History=require(_0xedb1('0x15'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xedb1('0x16'));var ipAgi=process[_0xedb1('0x17')][_0xedb1('0x18')]||_0xedb1('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0xedb1('0x1a')};var Sequence=function(){};Sequence[_0xedb1('0x1b')]['enqueue']=function(_0x1dd1c7){this[_0xedb1('0x1c')]=this['tail']?this['tail'][_0xedb1('0x1d')](_0x1dd1c7):_0x1dd1c7();};function Dialer(_0x1f14f3,_0x29922f){this[_0xedb1('0x1e')]=new Sequence();this['preview']=_0x29922f;this[_0xedb1('0x1f')]=_0x1f14f3['voiceQueues'];this['campaigns']=_0x1f14f3[_0xedb1('0x20')];this['agents']=_0x1f14f3[_0xedb1('0x21')];this[_0xedb1('0x22')]=_0x1f14f3[_0xedb1('0x22')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xedb1('0x23')]={};this['contactsId']={};this[_0xedb1('0x24')]={};this['optionPredictive']={};this[_0xedb1('0x25')]={};this[_0xedb1('0x26')]={};this[_0xedb1('0x27')]={};this[_0xedb1('0x28')]={};this['queueBookedRR']={};ami['on'](_0xedb1('0x29'),this[_0xedb1('0x2a')]['bind'](this));ami['on'](_0xedb1('0x2b'),this[_0xedb1('0x2c')][_0xedb1('0x2d')](this));ami['on']('originateresponse',this[_0xedb1('0x2e')][_0xedb1('0x2d')](this));ami['on'](_0xedb1('0x2f'),this[_0xedb1('0x30')][_0xedb1('0x2d')](this));ami['on'](_0xedb1('0x31'),this[_0xedb1('0xd')][_0xedb1('0x2d')](this));ami['on'](_0xedb1('0x32'),this[_0xedb1('0x33')][_0xedb1('0x2d')](this));ami['on'](_0xedb1('0x34'),this[_0xedb1('0x35')][_0xedb1('0x2d')](this));ami['on']('varset',this[_0xedb1('0x36')][_0xedb1('0x2d')](this));ami['on']('queuemember',this['syncQueueMember'][_0xedb1('0x2d')](this));ami['on'](_0xedb1('0x37'),this['syncQueueStatusComplete'][_0xedb1('0x2d')](this));this['loopCampaigns']();this[_0xedb1('0x38')]();}function isNotNull(_0x46eb1c){return _0x46eb1c!==null&&!_[_0xedb1('0x39')](_0x46eb1c);}function checkIsLoggedIn(_0xe2d961,_0x4aff9d){return function(){if(_0x4aff9d<=0x0){_0xe2d961[_0xedb1('0x3a')]=_0xedb1('0x3b');throw _0xe2d961['name']+_0xedb1('0x3c');}};}function isActive(_0x500983){return _0x500983;}function checkIsActive(_0x400cab,_0x1fd641){return function(){if(!isActive(_0x1fd641)){_0x400cab[_0xedb1('0x3a')]=_0xedb1('0x3d');throw _0x400cab[_0xedb1('0x3e')]+'\x20NOT\x20Active';}};}function checkInterval(_0x318ff4){return function(){if(!isNotNull(_0x318ff4[_0xedb1('0x3f')])){_0x318ff4[_0xedb1('0x3a')]=_0xedb1('0x40');throw _0x318ff4['name']+_0xedb1('0x41');}if(!isNotNull(_0x318ff4['Interval']['Intervals'])){_0x318ff4[_0xedb1('0x3a')]=_0xedb1('0x40');throw _0x318ff4[_0xedb1('0x3e')]+_0xedb1('0x41');}if(!isNotNull(_[_0xedb1('0x42')](_0x318ff4[_0xedb1('0x3f')][_0xedb1('0x43')]))){_0x318ff4[_0xedb1('0x3a')]='INTERVAL_IS_NULL';throw _0x318ff4[_0xedb1('0x3e')]+_0xedb1('0x41');}};}function msgResponse(_0x59de5a,_0x5d6903,_0x4cba2f){return{'action':_0x59de5a,'response':_0x5d6903,'message':_0x4cba2f,'stack':_0x4cba2f};}function myreject(_0x47813e){return function(_0x4e38d4){return _0x47813e(msgResponse(_0xedb1('0x44'),_0xedb1('0x45'),JSON[_0xedb1('0x46')](_0x4e38d4)));};}function getSeconds(_0x57d2c9,_0x5546b8){var _0x3474a8=moment(_0x57d2c9)[_0xedb1('0x47')](0x0);var _0x176c1f=moment(_0x5546b8)[_0xedb1('0x47')](0x0);return _0x3474a8[_0xedb1('0x48')](_0x176c1f,_0xedb1('0x49'));}function emit(_0x696826,_0x13e3af,_0x5392bb){io['to'](_0x696826)[_0xedb1('0x4a')](_0x13e3af,_0x5392bb);}function emitVoiceQueueSummary(_0x3d3f08){if(_0x3d3f08[_0xedb1('0x4b')]===_0xedb1('0x4c')){var _0x2691f1={'id':_0x3d3f08['id'],'name':_0x3d3f08[_0xedb1('0x3e')],'strategy':_0x3d3f08[_0xedb1('0x4d')],'answered':_0x3d3f08[_0xedb1('0x4e')],'available':_0x3d3f08[_0xedb1('0x4f')],'loggedIn':_0x3d3f08[_0xedb1('0x50')],'pTalking':_0x3d3f08[_0xedb1('0x51')],'sumBillable':_0x3d3f08[_0xedb1('0x52')],'sumDuration':_0x3d3f08[_0xedb1('0x53')],'sumHoldTime':_0x3d3f08['sumHoldTime']||0x0,'talking':_0x3d3f08[_0xedb1('0x54')],'total':_0x3d3f08[_0xedb1('0x55')],'type':_0x3d3f08[_0xedb1('0x4b')],'unmanaged':_0x3d3f08[_0xedb1('0x56')],'abandoned':_0x3d3f08['abandoned'],'waiting':_0x3d3f08[_0xedb1('0x57')],'loggedInDb':_0x3d3f08[_0xedb1('0x58')],'dialActive':_0x3d3f08[_0xedb1('0x59')],'dialMethod':_0x3d3f08[_0xedb1('0x5a')],'dialOriginateCallerIdName':_0x3d3f08[_0xedb1('0x5b')],'dialOriginateCallerIdNumber':_0x3d3f08[_0xedb1('0x5c')],'dialOriginateTimeout':_0x3d3f08[_0xedb1('0x5d')],'dialPrefix':_0x3d3f08[_0xedb1('0x5e')],'outboundAnswerAgiCallsDay':_0x3d3f08[_0xedb1('0x5f')],'outboundAnswerCallsDay':_0x3d3f08[_0xedb1('0x60')],'outboundBlacklistCallsDay':_0x3d3f08['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3d3f08[_0xedb1('0x61')],'outboundCongestionCallsDay':_0x3d3f08[_0xedb1('0x62')],'outboundDropCallsDayACS':_0x3d3f08[_0xedb1('0x63')],'outboundDropCallsDayCallersExit':_0x3d3f08['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3d3f08['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3d3f08[_0xedb1('0x64')],'outboundNoSuchCallsDay':_0x3d3f08[_0xedb1('0x65')],'outboundOriginateFailureCallsDay':_0x3d3f08[_0xedb1('0x66')],'outboundReCallsDay':_0x3d3f08[_0xedb1('0x67')],'outboundRejectCallsDay':_0x3d3f08['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3d3f08[_0xedb1('0x68')],'predictiveIntervalAnsweredCalls':_0x3d3f08['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3d3f08[_0xedb1('0x69')],'predictiveIntervalAvgTalktime':_0x3d3f08[_0xedb1('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x3d3f08[_0xedb1('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x3d3f08[_0xedb1('0x6c')],'predictiveIntervalErlangCalls':_0x3d3f08[_0xedb1('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x3d3f08[_0xedb1('0x6e')],'predictiveIntervalHitRate':_0x3d3f08[_0xedb1('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x3d3f08['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3d3f08[_0xedb1('0x70')],'predictiveIntervalAvailable':_0x3d3f08[_0xedb1('0x71')],'predictiveIntervalTotalCalls':_0x3d3f08[_0xedb1('0x72')],'message':_0x3d3f08[_0xedb1('0x3a')],'originated':_0x3d3f08[_0xedb1('0x73')],'erlangCalls':_0x3d3f08[_0xedb1('0x74')],'erlangCallToSecond':_0x3d3f08[_0xedb1('0x75')],'erlangAbandonmentRate':_0x3d3f08['erlangAbandonmentRate'],'erlangBusyFactor':_0x3d3f08['erlangBusyFactor'],'startPredictive':_0x3d3f08[_0xedb1('0x25')],'startProgressive':_0x3d3f08[_0xedb1('0x26')]};if(_0x3d3f08[_0xedb1('0x76')]){_0x2691f1[_0xedb1('0x76')]={'id':_0x3d3f08[_0xedb1('0x76')]['id'],'name':_0x3d3f08['Trunk'][_0xedb1('0x3e')],'active':_0x3d3f08['Trunk'][_0xedb1('0x77')],'callerid':_0x3d3f08['Trunk']['callerid']};}if(_0x3d3f08[_0xedb1('0x3f')]){_0x2691f1[_0xedb1('0x3f')]={'id':_0x3d3f08[_0xedb1('0x3f')]['id'],'name':_0x3d3f08[_0xedb1('0x3f')][_0xedb1('0x3e')]};}var _0x22f77b=md5(JSON[_0xedb1('0x46')](_0x2691f1));if(_0x3d3f08['md5']!==_0x22f77b){_0x3d3f08['md5']=_0x22f77b;emit(util['format'](_0xedb1('0x78'),_0x2691f1['name']),_0xedb1('0x79'),_0x2691f1);}}}function emitCampaignSummary(_0x2aebed){if(_0x2aebed[_0xedb1('0x4b')]===_0xedb1('0x7a')){emit(util[_0xedb1('0x7b')](_0xedb1('0x7c'),_0x2aebed['name']),_0xedb1('0x7d'),_0x2aebed);}}function checkGetDataPredictive(_0x3dbd8b){if(isNotNull(_0x3dbd8b)&&!_[_0xedb1('0x42')](_0x3dbd8b)){loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x7f'));loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x80'),_0x3dbd8b[_0xedb1('0x72')]);loggerPredictive['info'](_0xedb1('0x81'),_0x3dbd8b[_0xedb1('0x82')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3dbd8b[_0xedb1('0x6c')]);loggerPredictive[_0xedb1('0x7e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3dbd8b[_0xedb1('0x6b')]);loggerPredictive['info'](_0xedb1('0x83'),_0x3dbd8b[_0xedb1('0x69')]);loggerPredictive['info'](_0xedb1('0x84'),_0x3dbd8b[_0xedb1('0x6a')]);loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x85'));if(_0x3dbd8b[_0xedb1('0x72')]>0x0){if(!_[_0xedb1('0x39')](_0x3dbd8b['predictiveIntervalAvgTalktime'])&&_0x3dbd8b['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x86'));if(!_['isUndefined'](_0x3dbd8b[_0xedb1('0x69')])&&_0x3dbd8b[_0xedb1('0x69')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x87'));}}else{loggerPredictive['info'](_0xedb1('0x88'));}return![];}function mergeDataErlangB(_0x5925b9){return function(_0x176140){loggerPredictive[_0xedb1('0x7e')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x89'),_0x176140[_0xedb1('0x74')]);loggerPredictive['info'](_0xedb1('0x8a'),_0x176140['erlangCallToSecond']);loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x8b'),_0x176140[_0xedb1('0x8c')]);loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x8d'),_0x176140[_0xedb1('0x8e')]);loggerPredictive['info'](_0xedb1('0x8b'),_0x176140[_0xedb1('0x8c')]);loggerPredictive['info'](_0xedb1('0x85'));_[_0xedb1('0x8f')](_0x5925b9,_0x176140);};}function getDiff(_0x22ff6b){var _0x5b2c4b=moment()[_0xedb1('0x47')](0x0);var _0x320959=moment(_0x22ff6b)[_0xedb1('0x47')](0x0);return _0x5b2c4b['diff'](_0x320959,_0xedb1('0x49'));}function ifInterval(_0x476c09,_0x19ab31){if(_[_0xedb1('0x39')](_0x19ab31)){return![];}return getDiff(_0x19ab31)<_0x476c09*0x3c;}function freeVariablesPredictive(_0x485148){if(isNotNull(_0x485148)){if(!_['isUndefined'](_0x485148[_0xedb1('0x26')])){_0x485148[_0xedb1('0x26')]=undefined;loggerPredictive[_0xedb1('0x7e')](_0x485148[_0xedb1('0x3e')],_0xedb1('0x90'));}if(!_[_0xedb1('0x39')](_0x485148[_0xedb1('0x25')])){_0x485148[_0xedb1('0x25')]=undefined;loggerPredictive['info'](_0x485148[_0xedb1('0x3e')],_0xedb1('0x91'));}if(!_[_0xedb1('0x39')](_0x485148[_0xedb1('0x92')])){clearInterval(_0x485148[_0xedb1('0x92')]);_0x485148[_0xedb1('0x92')]=undefined;loggerPredictive[_0xedb1('0x7e')](_0x485148['name'],_0xedb1('0x93'));}}}function erlangb(_0xd1755b,_0x335fb7){if(_0x335fb7===0x0){return 0x0;}var _0x34a94b=0x1;for(var _0x35e5cd=0x1;_0x35e5cd<=_0x335fb7;_0x35e5cd+=0x1){_0x34a94b=0x1+_0x34a94b*_0x35e5cd/_0xd1755b;}return 0x1/_0x34a94b;}function isVoiceQueueOutbound(_0x188708){return _0x188708===_0xedb1('0x4c');}function isNotPreview(_0x183525){return _0x183525!==_0xedb1('0x94');}function isCampaignIvr(_0x1b1c03){return _0x1b1c03===_0xedb1('0x7a');}function getCallerId(_0x3d909e,_0x38dfdc,_0x393e30){if(!_[_0xedb1('0x39')](_0x393e30)&&typeof _0x393e30===_0xedb1('0x95')&&!_[_0xedb1('0x42')](_0x393e30)){if(!_[_0xedb1('0x39')](_0x38dfdc)&&typeof _0x38dfdc===_0xedb1('0x95')&&!_['isEmpty'](_0x38dfdc)){return util['format'](_0xedb1('0x96'),_0x38dfdc,_0x393e30);}return util[_0xedb1('0x7b')](_0xedb1('0x96'),_0x393e30,_0x393e30);}if(!_[_0xedb1('0x39')](_0x3d909e)&&typeof _0x3d909e===_0xedb1('0x95')&&!_['isEmpty'](_0x3d909e)){return _0x3d909e;}return _0xedb1('0x97');}function loggerCatchQueueSummary(_0x30bf49,_0x51ac5a){return function(_0x132640){freeVariablesPredictive(_0x51ac5a);emitVoiceQueueSummary(_0x51ac5a);emitCampaignSummary(_0x51ac5a);loggerSyncQueueSummary[_0xedb1('0x98')](_0x30bf49,util[_0xedb1('0x99')](_0x132640,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2c88fb,_0x46ffd9){return function(_0x8868a4){loggerPredictive[_0xedb1('0x98')](_0x46ffd9[_0xedb1('0x3e')],_0x2c88fb);loggerPredictive[_0xedb1('0x98')](_0x8868a4[_0xedb1('0x9a')]);freeVariablesPredictive(_0x46ffd9);};}function loggerCatch(_0x345133){return function(_0xc0743a){logger['error'](_0x345133,util['inspect'](_0xc0743a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x7cd5f){return _0x7cd5f&&!_[_0xedb1('0x39')](_0x7cd5f)&&_0x7cd5f[_0xedb1('0x9b')]>0x0;}function decremetOriginate(_0x687134){if(!_[_0xedb1('0x39')](_0x687134)&&_0x687134!==null){if(typeof _0x687134[_0xedb1('0x73')]!==_0xedb1('0x9c')){if(_0x687134['originated']>0x0){_0x687134[_0xedb1('0x73')]-=0x1;}else{logger[_0xedb1('0x98')](_0xedb1('0x9d'));}}}else{logger[_0xedb1('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x41b9d8,_0x3726cd,_0x30d800){if(_0x3726cd>_0x30d800){for(var _0x3e1f53=0x0;_0x3e1f53<_0x3726cd-_0x30d800;_0x3e1f53+=0x1){decremetOriginate(_0x41b9d8);}}}function loggerGetContactDialer(_0x28ce35,_0x3a9a63,_0x53dad0){return function(_0x2ddfb0){checkContactLowerLimitOriginate(_0x3a9a63,_0x53dad0,0x0);logger[_0xedb1('0x98')](_0x28ce35,util[_0xedb1('0x99')](_0x2ddfb0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1956fb){return function(_0x470129){if(isNotNull(_0x470129)&&isNotNull(_0x470129[0x0])){if(_0x470129[0x0][_0xedb1('0x9e')]>0x0){_0x1956fb['message']=_0xedb1('0x9f');logger['info'](_0xedb1('0xa0')+_0x1956fb[_0xedb1('0x3e')],_0x470129[0x0][_0xedb1('0x9e')],'contacts');}else{_0x1956fb[_0xedb1('0x3a')]=_0xedb1('0xa1');logger[_0xedb1('0x7e')](_0xedb1('0xa2')+_0x1956fb[_0xedb1('0x3e')]);}}};}function notSendMessagesQueue(_0x14fc56){if(_0x14fc56[_0xedb1('0xa3')]){freeVariablesPredictive(_0x14fc56);if(_0x14fc56[_0xedb1('0x73')]===0x0&&_0x14fc56[_0xedb1('0x54')]===0x0&&_0x14fc56[_0xedb1('0x57')]===0x0&&(_0x14fc56[_0xedb1('0x51')]||0x0)===0x0){_0x14fc56['sendMessageOneNotActive']=![];_0x14fc56[_0xedb1('0x4f')]=0x0;_0x14fc56['message']=_0xedb1('0x3d');loggerSyncQueueSummary[_0xedb1('0x98')](_0xedb1('0xa4'),_0x14fc56['name'],_0xedb1('0xa5'));}else{_0x14fc56[_0xedb1('0x3a')]=_0xedb1('0xa6');loggerSyncQueueSummary[_0xedb1('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x14fc56[_0xedb1('0x3e')],_0xedb1('0xa7'));}emitVoiceQueueSummary(_0x14fc56);}}function notSendMessagesCampaign(_0x557a1a){if(_0x557a1a[_0xedb1('0xa3')]){if(_0x557a1a[_0xedb1('0x73')]===0x0){_0x557a1a[_0xedb1('0xa3')]=![];_0x557a1a['message']=_0xedb1('0x3d');loggerSyncQueueSummary['error'](_0xedb1('0xa8'),_0x557a1a[_0xedb1('0x3e')],_0xedb1('0xa5'));}else{_0x557a1a[_0xedb1('0x3a')]=_0xedb1('0xa6');loggerSyncQueueSummary['error'](_0xedb1('0xa8'),_0x557a1a[_0xedb1('0x3e')],_0xedb1('0xa7'));}emitCampaignSummary(_0x557a1a);}}function createObjHistory(_0x56809f,_0x256e6c,_0x14e674,_0x4a38f9,_0x3c06c6){_0x56809f[_0xedb1('0x3a')]=_0x14e674;var _0x3c241a=new Action(_0x56809f,_0x256e6c);var _0x1e5e40=new History(_0x3c241a);_0x1e5e40[_0xedb1('0xa9')]=_0x4a38f9;_0x1e5e40[_0xedb1('0xaa')]=_0x3c06c6;_0x1e5e40[_0xedb1('0xab')]=_0x3c241a[_0xedb1('0xac')];return _0x1e5e40;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5c0084=this;setInterval(function(){_0x5c0084[_0xedb1('0xad')](_0x5c0084[_0xedb1('0x24')],_0xedb1('0xae'));_0x5c0084[_0xedb1('0xad')](_0x5c0084[_0xedb1('0x23')],_0xedb1('0xaf'));},0x32c8);};Dialer['prototype'][_0xedb1('0xad')]=function(_0x178d67,_0x131258){var _0xabc802=this;for(var _0x271e3e in _0x178d67){if(typeof _0x178d67[_0x271e3e]!=='undefined'){this[_0xedb1('0x1e')][_0xedb1('0xb0')](function(){if(!_[_0xedb1('0xb1')](_0x178d67[_0x271e3e])){return ami['Action']({'action':_0xedb1('0xb2'),'channel':_0x178d67[_0x271e3e][_0xedb1('0xb3')]})['catch'](function(_0x3809ad){if(_0x3809ad[_0xedb1('0x3a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x178d67[_0x271e3e]&&_0x178d67[_0x271e3e][_0xedb1('0x4b')]!==_0xedb1('0x7a')){_0xabc802[_0xedb1('0xb4')](_0xabc802[_0xedb1('0x1f')][_0x178d67[_0x271e3e][_0xedb1('0xb5')]]);logger['error'](_0xedb1('0xb6'),_0x131258,_0x271e3e,_0x178d67[_0x271e3e][_0xedb1('0xb5')]);delete _0x178d67[_0x271e3e];}if(_0x178d67[_0x271e3e]&&_0x178d67[_0x271e3e][_0xedb1('0x4b')]==='ivr'){_0xabc802[_0xedb1('0xb4')](_0xabc802[_0xedb1('0x20')][_0x178d67[_0x271e3e]['queue']]);logger[_0xedb1('0x98')](_0xedb1('0xb7'),_0x131258,_0x271e3e,_0x178d67[_0x271e3e]['queue']);delete _0x178d67[_0x271e3e];}},0x2328);}});}});}}};Dialer[_0xedb1('0x1b')][_0xedb1('0xb8')]=function(_0x2c7220){return BPromise['resolve']()[_0xedb1('0xb9')](cmHopper[_0xedb1('0xb8')](_0x2c7220))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xedb1('0x1b')][_0xedb1('0xba')]=function(_0x319428){return BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](cmHopperBlack[_0xedb1('0xba')](_0x319428))['catch'](loggerCatch(_0xedb1('0xbc')));};Dialer['prototype']['verifyAdditionalPhones']=function(_0x2acf97,_0x1e8d00,_0x4abcf3){return BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](cmHopperAdditionalPhone[_0xedb1('0xbd')](_0x2acf97,_0x1e8d00,_0x4abcf3))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xbf')));};Dialer[_0xedb1('0x1b')]['swapAdditionalPhones']=function(_0x4f0320,_0x27877f,_0x57e7f0){return BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x4f0320,_0x27877f,_0x57e7f0))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xc0')));};Dialer[_0xedb1('0x1b')][_0xedb1('0xc1')]=function(_0xd64b3e){return BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](cmHopperBlack[_0xedb1('0xc1')](_0xd64b3e))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xc2')));};Dialer[_0xedb1('0x1b')][_0xedb1('0xc3')]=function(_0x30906e){return BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](cmHopperHistory[_0xedb1('0xc4')](_0x30906e))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xc5')));};Dialer[_0xedb1('0x1b')][_0xedb1('0xc6')]=function(_0x5c9ffd){return BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](cmHopper[_0xedb1('0xc6')](_0x5c9ffd))['catch'](loggerCatch(_0xedb1('0xc7')));};Dialer[_0xedb1('0x1b')][_0xedb1('0xc8')]=function(_0x318b96,_0x3b8aab,_0x1dbf5e){return BPromise['resolve']()[_0xedb1('0xb9')](cmHopper['unlockContact'](_0x318b96,_0x3b8aab,_0x1dbf5e))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xc9')));};Dialer[_0xedb1('0x1b')][_0xedb1('0xca')]=function(_0x6bdf0d,_0x42bdd1,_0x229e8a,_0x1f9dd4,_0x59d518){return BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](cmHopper[_0xedb1('0xca')](_0x6bdf0d,_0x42bdd1,_0x229e8a,_0x1f9dd4))[_0xedb1('0xbe')](function(_0x27f2de){_0x59d518[_0xedb1('0xcb')]-=_0x229e8a;_0x59d518['temp']=_0x59d518[_0xedb1('0xcb')]>0x0?_0x59d518['temp']:0x0;loggerCatch(_0xedb1('0xcc'))(_0x27f2de);});};Dialer['prototype'][_0xedb1('0xcd')]=function(_0x43a47d,_0x5289bb,_0xbd8eaa,_0x5e4dc3){return BPromise[_0xedb1('0xbb')]()['then'](cmHopper['getContactDialerIvr'](_0x43a47d,_0x5289bb,_0xbd8eaa))[_0xedb1('0xbe')](function(_0x1428b3){_0x5e4dc3[_0xedb1('0xcb')]-=_0x5289bb;_0x5e4dc3[_0xedb1('0xcb')]=_0x5e4dc3['temp']>0x0?_0x5e4dc3[_0xedb1('0xcb')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x1428b3);});};Dialer[_0xedb1('0x1b')][_0xedb1('0xce')]=function(_0x541c9c){return BPromise['resolve']()[_0xedb1('0xb9')](voiceQueueRt['getVoiceQueueRtPauses'](_0x541c9c))['catch'](loggerCatch(_0xedb1('0xcf')));};Dialer[_0xedb1('0x1b')][_0xedb1('0xd0')]=function(_0x593526){return BPromise[_0xedb1('0xbb')]()['then'](cmHopper[_0xedb1('0xd0')](_0x593526))['catch'](loggerCatch(_0xedb1('0xd1')));};Dialer[_0xedb1('0x1b')][_0xedb1('0xd2')]=function(_0x1598f6){return BPromise[_0xedb1('0xbb')]()['then'](cmHopperHistory['createHistory'](_0x1598f6))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xd3')));};Dialer[_0xedb1('0x1b')][_0xedb1('0xb4')]=function(_0x1f9079){if(!_[_0xedb1('0x39')](_0x1f9079)&&_0x1f9079!==null){if(typeof _0x1f9079[_0xedb1('0x73')]!=='undefined'){if(_0x1f9079[_0xedb1('0x73')]>0x0){_0x1f9079[_0xedb1('0x73')]-=0x1;}else{logger[_0xedb1('0x98')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xedb1('0x98')](_0xedb1('0xd4'));}};Dialer[_0xedb1('0x1b')][_0xedb1('0xd5')]=function(_0x305ab6,_0x1c5796){var _0x34e48a=this;return function(_0x14d4b4){_0x34e48a['updateOriginated'](_0x1c5796);logger[_0xedb1('0x98')](_0x305ab6,util[_0xedb1('0x99')](_0x14d4b4,{'showHidden':![],'depth':null}));};};Dialer[_0xedb1('0x1b')][_0xedb1('0xd6')]=function(_0x743d96,_0x3897bf,_0x29f993){var _0x27fe30={'state':0x19,'statedesc':'notFound'};this[_0xedb1('0xb4')](_0x3897bf);this['saveInDb'](_[_0xedb1('0x8f')](_0x27fe30,_[_0xedb1('0xd7')](_0x29f993,[_0xedb1('0xd8'),_0xedb1('0xd9'),'UserId',_0xedb1('0xda'),_0xedb1('0xdb')])),_0xedb1('0xdc'),'[emptyContact]');logger[_0xedb1('0x98')](_0x743d96);};Dialer[_0xedb1('0x1b')]['isSuccess']=function(_0x4d5971){return _0x4d5971===_0xedb1('0xdd');};Dialer['prototype']['isTrunkReachable']=function(_0x12b7ea){return!_[_0xedb1('0x39')](_0x12b7ea)&&_0x12b7ea&&!_[_0xedb1('0x39')](_0x12b7ea[_0xedb1('0x3e')])&&!_[_0xedb1('0x39')](_0x12b7ea['active'])&&_0x12b7ea[_0xedb1('0x77')]&&(this[_0xedb1('0x22')][util[_0xedb1('0x7b')](_0xedb1('0xde'),_0x12b7ea[_0xedb1('0x3e')])][_0xedb1('0xb2')]===_0xedb1('0xdf')||this[_0xedb1('0x22')][util[_0xedb1('0x7b')](_0xedb1('0xde'),_0x12b7ea[_0xedb1('0x3e')])]['status']===_0xedb1('0xe0'));};Dialer['prototype']['saveInDb']=function(_0x5cd7af,_0x3fe841,_0xb96d3b){this[_0xedb1('0xd2')](_0x5cd7af)[_0xedb1('0xbe')](loggerCatch(_0x3fe841));this[_0xedb1('0xd0')](_0x5cd7af)[_0xedb1('0xbe')](loggerCatch(_0xb96d3b));};Dialer[_0xedb1('0x1b')][_0xedb1('0x36')]=function(_0x5908e6){var _0x250dbe=this['uniqueId'][_0x5908e6['uniqueid']];var _0x360758;if(!_[_0xedb1('0xb1')](_0x5908e6)&&!_[_0xedb1('0xb1')](_0x5908e6['variable'])&&!_['isNil'](_0x5908e6['variable'][_0xedb1('0xe1')])&&_0x5908e6[_0xedb1('0xe2')]===_0xedb1('0xe3')&&_0x250dbe){if(_0x250dbe[_0xedb1('0x4b')]!=='ivr'&&this['voiceQueues'][_0x250dbe[_0xedb1('0xb5')]][_0xedb1('0xe4')]&&_0x5908e6[_0xedb1('0xe5')]===_0xedb1('0xe6')){delete this[_0xedb1('0x24')][_0x5908e6[_0xedb1('0xe7')]];this['updateOriginated'](this['voiceQueues'][_0x250dbe[_0xedb1('0xb5')]]);this[_0xedb1('0x1f')][_0x250dbe[_0xedb1('0xb5')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x250dbe[_0xedb1('0xb5')]][_0xedb1('0x5f')]+=0x1;_0x360758=new Hangup(_0x250dbe,_0x5908e6);_0x360758[_0xedb1('0xa9')]=0x12;_0x360758['statedesc']=_0xedb1('0xe8');_0x360758[_0xedb1('0xe9')]=_0xedb1('0xea');ami['emit'](_0xedb1('0xeb'),ut[_0xedb1('0xec')](_0x360758,_0xedb1('0xed')));this[_0xedb1('0xee')](_0x360758,_0xedb1('0xef'),'[syncHangupInAMD]');}if(_0x250dbe[_0xedb1('0x4b')]!==_0xedb1('0x7a')&&this[_0xedb1('0x1f')][_0x250dbe[_0xedb1('0xb5')]][_0xedb1('0xe4')]&&_0x5908e6[_0xedb1('0xe5')]==='MACHINE'){var _0x350e76=this;return new BPromise(function(_0x3d6653,_0x2d1b2f){delete _0x350e76['uniqueId'][_0x5908e6['uniqueid']];_0x350e76[_0xedb1('0xb4')](_0x350e76[_0xedb1('0x1f')][_0x250dbe['queue']]);_0x350e76[_0xedb1('0x1f')][_0x250dbe[_0xedb1('0xb5')]][_0xedb1('0x60')]+=0x1;_0x350e76[_0xedb1('0x1f')][_0x250dbe[_0xedb1('0xb5')]][_0xedb1('0x5f')]+=0x1;var _0x51cc4f=_0x350e76[_0xedb1('0x1f')][_0x250dbe[_0xedb1('0xb5')]];var _0x15ab1b=new Hangup(_0x250dbe,_0x5908e6);_0x15ab1b[_0xedb1('0xa9')]=0x13;_0x15ab1b['statedesc']=_0xedb1('0xf0');_0x15ab1b[_0xedb1('0xe9')]='AMD';_0x15ab1b['countmachineretry']+=0x1;_0x15ab1b[_0xedb1('0xf1')]+=0x1;_0x15ab1b['amd']=!![];ami['emit'](_0xedb1('0xeb'),ut['buildObj'](_0x15ab1b,'amd'));_0x350e76[_0xedb1('0xd2')](_0x15ab1b)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xf2')));if(_0x15ab1b['countbusyretry']+_0x15ab1b[_0xedb1('0xf3')]+_0x15ab1b[_0xedb1('0xf4')]+_0x15ab1b['countnosuchnumberretry']+_0x15ab1b[_0xedb1('0xf5')]+_0x15ab1b[_0xedb1('0xf6')]+_0x15ab1b[_0xedb1('0xf7')]+_0x15ab1b['countagentrejectretry']>=_0x51cc4f['dialGlobalMaxRetry']){_0x350e76[_0xedb1('0xf8')](_0x15ab1b,_0x3d6653,_0x2d1b2f,'reason19\x20machine....');}else{if(_0x15ab1b[_0xedb1('0xf7')]>=_0x51cc4f['dialMachineMaxRetry']){_0x350e76[_0xedb1('0xf9')](_0x15ab1b,_0x3d6653,_0x2d1b2f,'reason\x2019\x20machine....');}else{_0x350e76['rescheduleContact']({'active':![],'countmachineretry':_0x15ab1b[_0xedb1('0xf7')],'scheduledat':moment()[_0xedb1('0xfa')](_0x51cc4f[_0xedb1('0xfb')],_0xedb1('0xfc'))['format'](_0xedb1('0xfd')),'ContactId':_0x15ab1b[_0xedb1('0xd8')],'ListId':_0x15ab1b[_0xedb1('0xd9')],'VoiceQueueId':_0x15ab1b[_0xedb1('0xda')]||undefined,'CampaignId':_0x15ab1b[_0xedb1('0xdb')]||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xfe')));_0x3d6653({'reschedule':0x1});}}});}if(_0x250dbe[_0xedb1('0x4b')]===_0xedb1('0x7a')&&this['campaigns'][_0x250dbe[_0xedb1('0xb5')]][_0xedb1('0xe4')]&&_0x5908e6['value']===_0xedb1('0xe6')){delete this[_0xedb1('0x24')][_0x5908e6[_0xedb1('0xe7')]];this[_0xedb1('0xb4')](this['campaigns'][_0x250dbe[_0xedb1('0xb5')]]);_0x360758=new Hangup(_0x250dbe,_0x5908e6);_0x360758['state']=0x12;_0x360758[_0xedb1('0xaa')]=_0xedb1('0xe8');_0x360758['membername']=_0xedb1('0xea');ami['emit'](_0xedb1('0xeb'),ut[_0xedb1('0xec')](_0x360758,'amd'));this[_0xedb1('0xee')](_0x360758,_0xedb1('0xff'),_0xedb1('0x100'));}if(_0x250dbe[_0xedb1('0x4b')]===_0xedb1('0x7a')&&this[_0xedb1('0x20')][_0x250dbe[_0xedb1('0xb5')]][_0xedb1('0xe4')]&&_0x5908e6[_0xedb1('0xe5')]===_0xedb1('0x101')){var _0x350e76=this;return new BPromise(function(_0xdc4811,_0x244534){delete _0x350e76[_0xedb1('0x24')][_0x5908e6[_0xedb1('0xe7')]];_0x350e76[_0xedb1('0xb4')](_0x350e76[_0xedb1('0x20')][_0x250dbe['queue']]);_0x350e76['campaigns'][_0x250dbe[_0xedb1('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x350e76[_0xedb1('0x20')][_0x250dbe['queue']][_0xedb1('0x5f')]+=0x1;var _0x41e2d6=_0x350e76[_0xedb1('0x20')][_0x250dbe[_0xedb1('0xb5')]];var _0x1e09af=new Hangup(_0x250dbe,_0x5908e6);_0x1e09af[_0xedb1('0xa9')]=0x13;_0x1e09af[_0xedb1('0xaa')]='Machine';_0x1e09af['membername']=_0xedb1('0xea');_0x1e09af[_0xedb1('0xf7')]+=0x1;_0x1e09af[_0xedb1('0xf1')]+=0x1;_0x1e09af[_0xedb1('0xed')]=!![];ami[_0xedb1('0x4a')]('custom:amd',ut[_0xedb1('0xec')](_0x1e09af,_0xedb1('0xed')));_0x350e76[_0xedb1('0xd2')](_0x1e09af)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xf2')));if(_0x1e09af['countbusyretry']+_0x1e09af[_0xedb1('0xf3')]+_0x1e09af[_0xedb1('0xf4')]+_0x1e09af['countnosuchnumberretry']+_0x1e09af[_0xedb1('0xf5')]+_0x1e09af[_0xedb1('0xf6')]+_0x1e09af['countmachineretry']+_0x1e09af[_0xedb1('0x102')]>=_0x41e2d6['dialGlobalMaxRetry']){_0x350e76[_0xedb1('0xf8')](_0x1e09af,_0xdc4811,_0x244534,_0xedb1('0x103'));}else{if(_0x1e09af[_0xedb1('0xf7')]>=_0x41e2d6[_0xedb1('0x104')]){_0x350e76[_0xedb1('0xf9')](_0x1e09af,_0xdc4811,_0x244534,'reason\x2019\x20machine....');}else{_0x350e76['rescheduleContact']({'active':![],'countmachineretry':_0x1e09af[_0xedb1('0xf7')],'scheduledat':moment()[_0xedb1('0xfa')](_0x41e2d6['dialMachineRetryFrequency'],_0xedb1('0xfc'))[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x1e09af[_0xedb1('0xd8')],'ListId':_0x1e09af[_0xedb1('0xd9')],'VoiceQueueId':_0x1e09af[_0xedb1('0xda')]||undefined,'CampaignId':_0x1e09af[_0xedb1('0xdb')]||undefined})['catch'](loggerCatch(_0xedb1('0xfe')));_0xdc4811({'reschedule':0x1});}}});}}};Dialer[_0xedb1('0x1b')]['syncHangup']=function(_0x528bcb){var _0x35a15b=this['uniqueId'][_0x528bcb['uniqueid']];var _0x183d80=this;var _0x4850c7;if(_0x35a15b&&_0x35a15b['type']===_0xedb1('0x7a')){delete this[_0xedb1('0x24')][_0x528bcb[_0xedb1('0xe7')]];this['updateOriginated'](this[_0xedb1('0x20')][_0x35a15b[_0xedb1('0xb5')]]);this[_0xedb1('0x20')][_0x35a15b[_0xedb1('0xb5')]]['ivrAnswerCallsDay']+=0x1;_0x4850c7=new Hangup(_0x35a15b,_0x528bcb);this[_0xedb1('0xd2')](_0x4850c7)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x105')));this['moveContactManagedDialer'](_0x4850c7)[_0xedb1('0xbe')](loggerCatch('[syncHangupIvr]'));}if(_0x35a15b&&_0x35a15b['type']!==_0xedb1('0x7a')&&isNotNull(this['voiceQueues'][_0x35a15b['queue']][_0xedb1('0x106')])){delete this['uniqueId'][_0x528bcb['uniqueid']];this[_0xedb1('0xb4')](this['voiceQueues'][_0x35a15b[_0xedb1('0xb5')]]);this['voiceQueues'][_0x35a15b['queue']][_0xedb1('0x60')]+=0x1;this[_0xedb1('0x1f')][_0x35a15b[_0xedb1('0xb5')]][_0xedb1('0x5f')]+=0x1;_0x4850c7=new Hangup(_0x35a15b,_0x528bcb);_0x4850c7[_0xedb1('0xa9')]=0x10;_0x4850c7[_0xedb1('0xaa')]=_0xedb1('0x107');_0x4850c7[_0xedb1('0xe9')]=_0xedb1('0x108');this[_0xedb1('0xd2')](_0x4850c7)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x105')));this[_0xedb1('0xd0')](_0x4850c7)['catch'](loggerCatch(_0xedb1('0x109')));}if(_0x35a15b&&_0x35a15b[_0xedb1('0x4b')]!==_0xedb1('0x7a')&&!isNotNull(this['voiceQueues'][_0x35a15b[_0xedb1('0xb5')]][_0xedb1('0x106')])){delete this[_0xedb1('0x24')][_0x528bcb[_0xedb1('0xe7')]];this[_0xedb1('0xb4')](this[_0xedb1('0x1f')][_0x35a15b[_0xedb1('0xb5')]]);this[_0xedb1('0x1f')][_0x35a15b[_0xedb1('0xb5')]]['outboundUnknownCallsDay']+=0x1;_0x4850c7=new Hangup(_0x35a15b,_0x528bcb);_0x4850c7[_0xedb1('0xa9')]=0xc;_0x4850c7[_0xedb1('0xaa')]=_0x528bcb[_0xedb1('0x10a')];_0x4850c7[_0xedb1('0xe9')]=_0xedb1('0x10b');this[_0xedb1('0xd2')](_0x4850c7)[_0xedb1('0xbe')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xedb1('0xd0')](_0x4850c7)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xedb1('0x1b')][_0xedb1('0x30')]=function(_0x58a6b4){var _0x2de0dd=this['uniqueId'][_0x58a6b4[_0xedb1('0xe7')]];var _0x5d0b57=this;if(this[_0xedb1('0x1f')][_0x58a6b4[_0xedb1('0xb5')]]){if(_0x2de0dd&&_0x2de0dd['type']!=='ivr'){delete this[_0xedb1('0x24')][_0x58a6b4[_0xedb1('0xe7')]];this[_0xedb1('0x1f')][_0x58a6b4[_0xedb1('0xb5')]][_0xedb1('0x60')]+=0x1;var _0x23cfdd=new AgentComplete(_0x2de0dd,_0x58a6b4);if(_0x58a6b4['reason']===_0xedb1('0x10c')){_0x23cfdd[_0xedb1('0x10d')]=this[_0xedb1('0x1f')][_0x58a6b4[_0xedb1('0xb5')]]['dialQueueProject2']&&this[_0xedb1('0x1f')][_0x58a6b4['queue']]['dialAgiAfterHangupAgent']?moment()[_0xedb1('0x7b')](_0xedb1('0xfd')):undefined;}this[_0xedb1('0xd2')](_0x23cfdd)['catch'](loggerCatch(_0xedb1('0x10e')));this['moveContactManagedDialer'](_0x23cfdd)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x10f')));}}};Dialer[_0xedb1('0x1b')][_0xedb1('0x2a')]=function(_0x54095d){if(this[_0xedb1('0x1f')][_0x54095d[_0xedb1('0xb5')]]){if(this[_0xedb1('0x24')][_0x54095d[_0xedb1('0xe7')]]&&this['uniqueId'][_0x54095d[_0xedb1('0xe7')]]['type']!==_0xedb1('0x7a')){this[_0xedb1('0xb4')](this[_0xedb1('0x1f')][_0x54095d[_0xedb1('0xb5')]]);this[_0xedb1('0x24')][_0x54095d[_0xedb1('0xe7')]][_0xedb1('0x110')]=moment()[_0xedb1('0x7b')](_0xedb1('0xfd'));}}};Dialer[_0xedb1('0x1b')][_0xedb1('0x111')]=function(_0x5e5638,_0x22af3f){this[_0xedb1('0xd2')](_0x5e5638)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x10e')));if(_0x22af3f==0x0){this[_0xedb1('0xd0')](_0x5e5638)['catch'](loggerCatch(_0xedb1('0x112')));}};Dialer['prototype'][_0xedb1('0x2c')]=function(_0x145891){var _0x16be8d=this[_0xedb1('0x24')][_0x145891[_0xedb1('0xe7')]];var _0x504892=this;var _0x25548b=![];var _0x5ef3f4;var _0x4c41cc;if(this[_0xedb1('0x1f')][_0x145891[_0xedb1('0xb5')]]){if(_0x16be8d&&_0x16be8d[_0xedb1('0x4b')]!==_0xedb1('0x7a')){delete this[_0xedb1('0x24')][_0x145891[_0xedb1('0xe7')]];this[_0xedb1('0xb4')](this[_0xedb1('0x1f')][_0x145891['queue']]);_0x16be8d[_0xedb1('0x113')]=moment()[_0xedb1('0x7b')](_0xedb1('0xfd'));var _0x8f687f=new QueueCallerAbandon(_0x16be8d,_0x145891);if(getSeconds(_0x16be8d[_0xedb1('0x113')],_0x16be8d[_0xedb1('0x114')])>=_0x16be8d['dialQueueTimeout']){this[_0xedb1('0x1f')][_0x145891[_0xedb1('0xb5')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x145891['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xedb1('0x1f')][_0x145891[_0xedb1('0xb5')]][_0xedb1('0x6e')]+=0x1;_0x8f687f[_0xedb1('0xa9')]=0xa;_0x8f687f[_0xedb1('0xaa')]='Drop';_0x8f687f[_0xedb1('0x115')]='TIMEOUT';_0x8f687f[_0xedb1('0x10d')]=this[_0xedb1('0x1f')][_0x145891[_0xedb1('0xb5')]]['dialQueueProject2']?moment()[_0xedb1('0x7b')](_0xedb1('0xfd')):undefined;_0x8f687f['countdropretry']+=0x1;_0x8f687f[_0xedb1('0xf1')]+=0x1;_0x5ef3f4=this[_0xedb1('0x1f')][_0x145891['queue']]['dialDropRetryFrequency'];_0x4c41cc=this[_0xedb1('0x1f')][_0x145891['queue']][_0xedb1('0x116')];_0x504892['verifyAdditionalPhones'](_0x8f687f,_0x8f687f[_0xedb1('0xa9')],_0x16be8d[_0xedb1('0x117')])['then'](function(_0x305cbb){_0x25548b=_0x305cbb[_0xedb1('0x118')]==0x1;if(_0x8f687f[_0xedb1('0xf5')]>=_0x504892[_0xedb1('0x1f')][_0x145891[_0xedb1('0xb5')]]['dialDropMaxRetry']){_0x504892[_0xedb1('0x111')](_0x8f687f,_0x305cbb[_0xedb1('0x118')]);}else{_0x504892['rescheduleContact']({'active':![],'countdropretry':_0x8f687f['countdropretry'],'scheduledat':moment()[_0xedb1('0xfa')](_0x504892[_0xedb1('0x1f')][_0x145891['queue']]['dialDropRetryFrequency'],_0xedb1('0xfc'))[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x16be8d[_0xedb1('0xd8')],'ListId':_0x16be8d[_0xedb1('0xd9')],'VoiceQueueId':_0x16be8d[_0xedb1('0xda')]||undefined,'CampaignId':_0x16be8d[_0xedb1('0xdb')]||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x119')));var _0xd07f52=new History(_0x8f687f);_0xd07f52[_0xedb1('0xa9')]=0xa;_0xd07f52[_0xedb1('0xaa')]=_0xedb1('0x11a');_0xd07f52[_0xedb1('0xac')]=moment()[_0xedb1('0x7b')](_0xedb1('0xfd'));_0xd07f52[_0xedb1('0xab')]=_0xd07f52[_0xedb1('0xac')];_0xd07f52[_0xedb1('0x11b')]=_0x8f687f['calleridname'];_0xd07f52[_0xedb1('0x11c')]=_0x8f687f[_0xedb1('0x11c')];_0x504892[_0xedb1('0xd2')](_0xd07f52)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x11d')));}})[_0xedb1('0xb9')](function(_0x5716dd){if(_0x25548b)_0x504892['swapAdditionalPhones'](_0x8f687f,_0x5ef3f4,_0x4c41cc)[_0xedb1('0xb9')](function(_0x473e7b){return 0x1;});});}else{this['voiceQueues'][_0x145891[_0xedb1('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xedb1('0x1f')][_0x145891[_0xedb1('0xb5')]][_0xedb1('0x11e')]+=0x1;_0x8f687f[_0xedb1('0xa9')]=0xb;_0x8f687f[_0xedb1('0xaa')]='Abandoned';_0x8f687f[_0xedb1('0x115')]=_0xedb1('0x11f');_0x8f687f[_0xedb1('0xf6')]+=0x1;_0x8f687f[_0xedb1('0xf1')]+=0x1;_0x5ef3f4=this[_0xedb1('0x1f')][_0x145891['queue']][_0xedb1('0x120')];_0x4c41cc=this[_0xedb1('0x1f')][_0x145891[_0xedb1('0xb5')]][_0xedb1('0x116')];_0x504892[_0xedb1('0xbd')](_0x8f687f,_0x8f687f['state'],_0x16be8d[_0xedb1('0x117')])[_0xedb1('0xb9')](function(_0x3ffe25){if(_0x8f687f[_0xedb1('0xf6')]>=_0x504892[_0xedb1('0x1f')][_0x145891[_0xedb1('0xb5')]][_0xedb1('0x121')]){_0x504892[_0xedb1('0x111')](_0x8f687f,_0x3ffe25[_0xedb1('0x118')]);}else{_0x504892[_0xedb1('0xc6')]({'active':![],'countabandonedretry':_0x8f687f[_0xedb1('0xf6')],'scheduledat':moment()[_0xedb1('0xfa')](_0x504892['voiceQueues'][_0x145891['queue']][_0xedb1('0x120')],_0xedb1('0xfc'))[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x16be8d[_0xedb1('0xd8')],'ListId':_0x16be8d[_0xedb1('0xd9')],'VoiceQueueId':_0x16be8d['VoiceQueueId']||undefined,'CampaignId':_0x16be8d[_0xedb1('0xdb')]||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x122')));var _0x21fbca=new History(_0x8f687f);_0x21fbca['state']=0xb;_0x21fbca['statedesc']=_0xedb1('0x123');_0x21fbca['starttime']=moment()[_0xedb1('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0x21fbca['endtime']=_0x21fbca[_0xedb1('0xac')];_0x21fbca[_0xedb1('0x11b')]=_0x8f687f[_0xedb1('0x11b')];_0x21fbca['calleridnum']=_0x8f687f[_0xedb1('0x11c')];_0x504892[_0xedb1('0xd2')](_0x21fbca)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x124')));}})[_0xedb1('0xb9')](function(_0x558554){if(_0x25548b)_0x504892[_0xedb1('0x125')](_0x8f687f,_0x5ef3f4,_0x4c41cc)[_0xedb1('0xb9')](function(_0x1f400a){return 0x1;});});}}}};Dialer[_0xedb1('0x1b')]['syncNewExten']=function(_0x3411cc){if(this['actions'][_0x3411cc[_0xedb1('0xe7')]]){this[_0xedb1('0x23')][_0x3411cc[_0xedb1('0xe7')]][_0xedb1('0xb3')]=_0x3411cc['channel'];}if(this['uniqueId'][_0x3411cc['uniqueid']]){this[_0xedb1('0x24')][_0x3411cc[_0xedb1('0xe7')]]['channel']=_0x3411cc[_0xedb1('0xb3')];}};Dialer[_0xedb1('0x1b')][_0xedb1('0x126')]=function(_0x378607){if(strategy[this[_0xedb1('0x1f')][this[_0xedb1('0x23')][_0x378607[_0xedb1('0x127')]][_0xedb1('0xb5')]]['strategy']]===_0xedb1('0x1a')){if(this['actions'][_0x378607[_0xedb1('0x127')]]&&_[_0xedb1('0xb1')](this[_0xedb1('0x23')][_0x378607[_0xedb1('0x127')]][_0xedb1('0x128')])&&_0x378607[_0xedb1('0xb2')]==='1'&&_0x378607[_0xedb1('0x129')]==='0'){if(this[_0xedb1('0x21')][_0x378607['stateinterface']]){if(!this[_0xedb1('0x21')][_0x378607[_0xedb1('0x12a')]][_0xedb1('0x128')]){this[_0xedb1('0x21')][_0x378607[_0xedb1('0x12a')]][_0xedb1('0x128')]=!![];this[_0xedb1('0x23')][_0x378607[_0xedb1('0x127')]][_0xedb1('0x128')]=!![];this[_0xedb1('0x23')][_0x378607['actionid']][_0xedb1('0x12a')]=_0x378607[_0xedb1('0x12a')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x378607['actionid']][_0xedb1('0xb5')]][_0xedb1('0x4d')]]||'rrmemory')===_0xedb1('0x12b')){if(this[_0xedb1('0x23')][_0x378607[_0xedb1('0x127')]]){if(this['agents'][_0x378607[_0xedb1('0x12a')]]){this[_0xedb1('0x23')][_0x378607[_0xedb1('0x127')]][_0xedb1('0x12a')]=_0x378607['stateinterface'];if(_[_0xedb1('0xb1')](this[_0xedb1('0x28')][this['actions'][_0x378607[_0xedb1('0x127')]][_0xedb1('0xb5')]])){this[_0xedb1('0x28')][this[_0xedb1('0x23')][_0x378607[_0xedb1('0x127')]][_0xedb1('0xb5')]]=[];}this[_0xedb1('0x28')][this[_0xedb1('0x23')][_0x378607[_0xedb1('0x127')]]['queue']][_0xedb1('0x12c')](_[_0xedb1('0x8f')](_[_0xedb1('0xd7')](this['actions'][_0x378607['actionid']],[_0xedb1('0x12d'),_0xedb1('0x12a')]),{'status':_0x378607['status'],'paused':_0x378607[_0xedb1('0x129')]}));}}}};function unlockQueueStatus(_0x4d8379,_0x3fb94f){setTimeout(function(){if(_[_0xedb1('0x39')](_0x4d8379[_0xedb1('0x12e')])){loggerBooked[_0xedb1('0x98')](_0xedb1('0x12f'),_0x3fb94f);}_0x4d8379['queueStatusComplete']=!![];loggerBooked[_0xedb1('0x7e')](_0xedb1('0x130'),_0x3fb94f,JSON['stringify'](_[_0xedb1('0xd7')](_0x4d8379,[_0xedb1('0x3e'),_0xedb1('0x12e')])));},0x1f3);}Dialer[_0xedb1('0x1b')]['syncQueueStatusComplete']=function(_0x3229cb){var _0x28e25d=this;var _0x218010=_0x28e25d[_0xedb1('0x1f')][_0x28e25d[_0xedb1('0x23')][_0x3229cb['actionid']][_0xedb1('0xb5')]];if(strategy[this['voiceQueues'][this['actions'][_0x3229cb['actionid']][_0xedb1('0xb5')]][_0xedb1('0x4d')]]===_0xedb1('0x1a')){if(this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]]&&this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0x12a')]){this['preview'][_0xedb1('0x131')](this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0x12d')],this[_0xedb1('0x23')][_0x3229cb['actionid']]['stateinterface'])[_0xedb1('0xbe')](function(_0x3ad95f){logger[_0xedb1('0x98')](_0xedb1('0x132'),util[_0xedb1('0x99')](_0x3ad95f,{'showHidden':![],'depth':null}));})[_0xedb1('0x1d')](function(){_0x28e25d[_0xedb1('0xb4')](_0x28e25d['voiceQueues'][_0x28e25d[_0xedb1('0x23')][_0x3229cb['actionid']]['queue']]);_0x28e25d['agents'][_0x28e25d['actions'][_0x3229cb[_0xedb1('0x127')]]['stateinterface']][_0xedb1('0x128')]=![];delete _0x28e25d[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]];unlockQueueStatus(_0x218010);});}else{this[_0xedb1('0xb4')](this[_0xedb1('0x1f')][this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xb5')]]);this[_0xedb1('0xc6')]({'active':![],'ContactId':this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xd8')],'ListId':this['actions'][_0x3229cb['actionid']][_0xedb1('0xd9')],'VoiceQueueId':this[_0xedb1('0x23')][_0x3229cb['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xdb')]||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x133')));delete this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]];unlockQueueStatus(_0x218010);}}else if((strategy[this[_0xedb1('0x1f')][this[_0xedb1('0x23')][_0x3229cb['actionid']][_0xedb1('0xb5')]][_0xedb1('0x4d')]]||_0xedb1('0x12b'))===_0xedb1('0x12b')){var _0x1fa3fe;if(this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]]&&!_[_0xedb1('0x42')](this[_0xedb1('0x28')][this['actions'][_0x3229cb['actionid']]['queue']])){if(this[_0xedb1('0x134')][_0x28e25d[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xb5')]]){this[_0xedb1('0x134')][_0x28e25d[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xb5')]]=this['queueBookedRR'][this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xb5')]]?this['queueBookedRR'][this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xb5')]]:this[_0xedb1('0x28')][this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xb5')]]?this[_0xedb1('0x28')][this['actions'][_0x3229cb[_0xedb1('0x127')]][_0xedb1('0xb5')]][_0xedb1('0x135')]||0x0:0x0;}this[_0xedb1('0x28')][this[_0xedb1('0x23')][_0x3229cb[_0xedb1('0x127')]]['queue']][_0xedb1('0x135')]=this['queueBookedRR'][this['actions'][_0x3229cb['actionid']][_0xedb1('0xb5')]];for(var _0x544088=0x0;_0x544088=0x0;})[_0xedb1('0xbe')](myreject(_0x78b999)));}}else{_0x49fe7f[_0xedb1('0x12c')](ami['Action']({'action':_0xedb1('0x14d'),'command':util[_0xedb1('0x7b')](_0xedb1('0x14e'),_0x173597,!_['isUndefined'](config[_0xedb1('0x149')][_0xe05226])?_0xe05226:'')})[_0xedb1('0xb9')](function(_0x19e80f){return _0x19e80f[_0xedb1('0x150')][_0xedb1('0x151')](_0xedb1('0x152'))>=0x0;})[_0xedb1('0xbe')](myreject(_0x78b999)));}BPromise[_0xedb1('0x153')](_0x49fe7f)[_0xedb1('0xb9')](function(_0x51fe9){var _0x4ecfd8=_['some'](_0x51fe9);if(_0x4ecfd8){return _0x58b966(_0x4ecfd8);}else{_0xc91c35[_0xedb1('0x3a')]=_0x966d57?_0xedb1('0x154'):_0xedb1('0x155');return _0x78b999(msgResponse(_0xedb1('0x156'),'Failure',_0xedb1('0x157')+_0x966d57+'\x20'+_0x2ce7c5+_0xedb1('0x158')+util[_0xedb1('0x99')](_0x173597,{'showHidden':![],'depth':null})+_0xedb1('0x159')+_0xe05226));}})[_0xedb1('0xbe')](function(_0x2bb488){return _0x78b999(msgResponse(_0xedb1('0x144'),_0xedb1('0x145'),JSON[_0xedb1('0x46')](_0x2bb488)));});});};Dialer['prototype'][_0xedb1('0x15a')]=function(_0x33c24a){var _0x1cf228=this;return function(){switch(_0x33c24a[_0xedb1('0x5a')]){case _0xedb1('0x15b'):freeVariablesPredictive(_0x33c24a);_0x1cf228[_0xedb1('0x15c')](_0x33c24a,0x1);break;case _0xedb1('0x15d'):freeVariablesPredictive(_0x33c24a);_0x1cf228['handlePower'](_0x33c24a,_0x33c24a[_0xedb1('0x15e')]);break;case _0xedb1('0x15f'):_0x1cf228['predictive'](_0x33c24a);break;case'booked':freeVariablesPredictive(_0x33c24a);_0x1cf228[_0xedb1('0x15c')](_0x33c24a,0x1);break;default:freeVariablesPredictive(_0x33c24a);logger[_0xedb1('0x98')]('Queue',_0x33c24a['name'],_0xedb1('0x160'));}};};Dialer['prototype'][_0xedb1('0x161')]=function(_0x13238b){var _0x24e653=this;return function(){_0x24e653[_0xedb1('0x162')](_0x13238b);};};Dialer[_0xedb1('0x1b')][_0xedb1('0xd')]=function(_0x5672b4){var _0x49b4b6=this;if(isNotPreview(_0x5672b4['dialMethod'])){if(isVoiceQueueOutbound(_0x5672b4[_0xedb1('0x4b')])&&isActive(_0x5672b4[_0xedb1('0x59')])){_0x5672b4[_0xedb1('0xa3')]=!![];BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](checkIsLoggedIn(_0x5672b4,_0x5672b4[_0xedb1('0x50')]))[_0xedb1('0xb9')](checkIsActive(_0x5672b4,_0x5672b4[_0xedb1('0x59')]))[_0xedb1('0xb9')](checkInterval(_0x5672b4))[_0xedb1('0xb9')](_0x49b4b6[_0xedb1('0x140')](_0x5672b4))[_0xedb1('0xb9')](_0x49b4b6['checkIfTime'](_0x5672b4[_0xedb1('0x163')],_0x5672b4[_0xedb1('0x164')],_0x5672b4[_0xedb1('0x3e')],_0x5672b4))['then'](_0x49b4b6[_0xedb1('0x165')](_0x5672b4[_0xedb1('0x3f')],_0x5672b4['dialTimezone'],_0x5672b4[_0xedb1('0x3e')],_0x5672b4))[_0xedb1('0xb9')](_0x49b4b6[_0xedb1('0x15a')](_0x5672b4))[_0xedb1('0xbe')](loggerCatchQueueSummary(_0xedb1('0x166'),_0x5672b4));}else{notSendMessagesQueue(_0x5672b4);}}else{freeVariablesPredictive(_0x5672b4);}};Dialer['prototype'][_0xedb1('0x13f')]=function(){var _0x13fcb9=this;var _0x5e9e18;for(var _0x277f75 in this['campaigns']){if(typeof this[_0xedb1('0x20')][_0x277f75]!==_0xedb1('0x9c')){_0x5e9e18=this[_0xedb1('0x20')][_0x277f75];if(isCampaignIvr(_0x5e9e18[_0xedb1('0x4b')])&&isActive(_0x5e9e18[_0xedb1('0x77')])){_0x5e9e18[_0xedb1('0xa3')]=!![];BPromise[_0xedb1('0xbb')]()[_0xedb1('0xb9')](checkIsActive(_0x5e9e18,_0x5e9e18[_0xedb1('0x77')]))['then'](checkInterval(_0x5e9e18))[_0xedb1('0xb9')](_0x13fcb9[_0xedb1('0x140')](_0x5e9e18))[_0xedb1('0xb9')](_0x13fcb9[_0xedb1('0x143')](_0x5e9e18[_0xedb1('0x163')],_0x5e9e18[_0xedb1('0x164')],_0x5e9e18[_0xedb1('0x3e')],_0x5e9e18))[_0xedb1('0xb9')](_0x13fcb9['checkIfTimeIntervals'](_0x5e9e18['Interval'],_0x5e9e18[_0xedb1('0x164')],_0x5e9e18[_0xedb1('0x3e')],_0x5e9e18))[_0xedb1('0xb9')](_0x13fcb9['launchHandleIvr'](_0x5e9e18))['catch'](loggerCatchQueueSummary(_0xedb1('0x167'),_0x5e9e18));}else{notSendMessagesCampaign(_0x5e9e18);}}}};function getCallerIdRandom(_0x2e7a22,_0x5e065d){var _0x4a166e;var _0x44335a;var _0x2655fa;if(_0x5e065d<=0x0){_0x5e065d=0x1;}_0x4a166e=new RegExp(_0xedb1('0x168')+_0x5e065d+'}$');_0x44335a=Math[_0xedb1('0x169')](0xa,_0x5e065d-0x1);_0x2655fa=Math[_0xedb1('0x169')](0xa,_0x5e065d)-0x1;return util[_0xedb1('0x7b')]('%s',_[_0xedb1('0x16a')](_0x2e7a22,_0x4a166e,_[_0xedb1('0x16b')](_0x44335a,_0x2655fa)));}function extractCalleridName(_0x576246){var _0x2ceff8=_0x576246[_0xedb1('0x16c')](/"(.*?)"/);return _0x2ceff8?_0x2ceff8[0x1]:_0x576246;}function extractCalleridNumber(_0x2b1a66){var _0x496c35=_0x2b1a66[_0xedb1('0x16c')](/<(.*?)>/);return _0x496c35?_0x496c35[0x1]:_0x2b1a66;}Dialer['prototype'][_0xedb1('0x16d')]=function(_0x3cb876,_0x546806){var _0x213fce=this;var _0x4efdaa=uuid['v4']();this[_0xedb1('0x23')][_0x4efdaa]=new Action(_0x3cb876,_0x546806,_0x4efdaa);return new BPromise(function(_0x30b713,_0x49084d){if(_[_0xedb1('0x39')](_0x3cb876)&&typeof _0x3cb876!==_0xedb1('0x16e')){return _0x49084d(msgResponse(_0xedb1('0x16f'),_0xedb1('0x145'),_0xedb1('0x170')));}if(_[_0xedb1('0x39')](_0x546806[_0xedb1('0x171')])||_0x546806[_0xedb1('0x171')]===null){return _0x49084d(msgResponse(_0xedb1('0x16f'),_0xedb1('0x145'),_0xedb1('0x172')));}var _0x4a1224={'XMD-CALLERID':_0x213fce[_0xedb1('0x23')][_0x4efdaa][_0xedb1('0x173')](),'XMD-AGI':_0x3cb876['dialQueueProject']?util[_0xedb1('0x7b')](_0xedb1('0x174'),ipAgi,_0x3cb876[_0xedb1('0x106')]):_0xedb1('0x175'),'XMD-AGIAFTER':_0x3cb876[_0xedb1('0x176')]?util[_0xedb1('0x7b')](_0xedb1('0x174'),ipAgi,_0x3cb876[_0xedb1('0x176')]):_0xedb1('0x175'),'XMD-QUEUE':_0x3cb876[_0xedb1('0x4b')]===_0xedb1('0x4c')?util[_0xedb1('0x7b')](_0xedb1('0x177'),_0x3cb876[_0xedb1('0x3e')],_0x3cb876[_0xedb1('0x178')]||'',_0x3cb876[_0xedb1('0x179')]?'c':'',_0x3cb876[_0xedb1('0x17a')]||0x3):_0xedb1('0x175'),'XMD-CONTACTID':_0x546806['ContactId'],'XMD-CDRTYPE':_0xedb1('0xa'),'CALLERID(all)':_0x213fce[_0xedb1('0x23')][_0x4efdaa][_0xedb1('0x173')](),'XMD-AMD':_0x3cb876[_0xedb1('0xe4')]?_0xedb1('0x17b'):_0xedb1('0x175'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3cb876[_0xedb1('0xe4')]){_0x4a1224[_0xedb1('0x17c')]=_0x3cb876['dialAMDInitialSilence']||0x9c4;_0x4a1224[_0xedb1('0x17d')]=_0x3cb876['dialAMDGreeting']||0x5dc;_0x4a1224[_0xedb1('0x17e')]=_0x3cb876['dialAMDAfterGreetingSilence']||0x320;_0x4a1224['XMD-AMDTOTALANALYSISTIME']=_0x3cb876['dialAMDTotalAnalysisTime']||0x1388;_0x4a1224[_0xedb1('0x17f')]=_0x3cb876[_0xedb1('0x180')]||0x64;_0x4a1224[_0xedb1('0x181')]=_0x3cb876[_0xedb1('0x182')]||0x32;_0x4a1224[_0xedb1('0x183')]=_0x3cb876[_0xedb1('0x184')]||0x3;_0x4a1224[_0xedb1('0x185')]=_0x3cb876[_0xedb1('0x186')]||0x100;_0x4a1224[_0xedb1('0x187')]=_0x3cb876[_0xedb1('0x188')]||0x1388;}if(_0x3cb876[_0xedb1('0x4b')]===_0xedb1('0x4c')){_0x4a1224[_0xedb1('0x189')]=_0x546806['VoiceQueueId'];}else{_0x4a1224[_0xedb1('0x18a')]=_0x546806['CampaignId'];}for(var _0x44ec8d in _0x546806[_0xedb1('0x18b')]){if(typeof _0x546806[_0xedb1('0x18b')][_0x44ec8d]!==_0xedb1('0x9c')){if(isNotNull(_0x546806[_0xedb1('0x18b')][_0x44ec8d])&&_0x44ec8d!=='id'&&_0x44ec8d!==_0xedb1('0x18c')&&_0x44ec8d!==_0xedb1('0x18d')&&_0x44ec8d!==_0xedb1('0x18e')){_0x4a1224[util['format'](_0xedb1('0x18f'),_0xedb1('0x190'),_[_0xedb1('0x191')](_0x44ec8d))]=_0x546806['Contact'][_0x44ec8d];}}}var _0x3a0409=_0x213fce[_0xedb1('0x192')](_0x3cb876[_0xedb1('0x76')])?getCallerId(_0x3cb876[_0xedb1('0x76')]['callerid'],_0x3cb876[_0xedb1('0x5b')],_0x3cb876[_0xedb1('0x193')]>0x0?getCallerIdRandom(_0x3cb876['dialOriginateCallerIdNumber'],_0x3cb876['dialRandomLastDigitCallerIdNumber']):_0x3cb876[_0xedb1('0x5c')]):getCallerId(_['isNil'](_0x3cb876[_0xedb1('0x141')])?_0x3cb876[_0xedb1('0x76')]['callerid']:_0x3cb876[_0xedb1('0x141')][_0xedb1('0x194')],_0x3cb876[_0xedb1('0x5b')],_0x3cb876[_0xedb1('0x193')]>0x0?getCallerIdRandom(_0x3cb876[_0xedb1('0x5c')],_0x3cb876[_0xedb1('0x193')]):_0x3cb876[_0xedb1('0x5c')]);if(_0x3a0409){_0x4a1224[_0xedb1('0x195')]=_0x213fce[_0xedb1('0x23')][_0x4efdaa][_0xedb1('0x196')]=extractCalleridName(_0x3a0409);_0x4a1224['XMD-ORIGINATECALLERIDNUM']=_0x546806[_0xedb1('0x171')];}return ami[_0xedb1('0x14c')]({'actionid':_0x4efdaa,'action':_0xedb1('0x16f'),'channel':_0x213fce[_0xedb1('0x192')](_0x3cb876[_0xedb1('0x76')])?util[_0xedb1('0x7b')]('SIP/%s/%s%s',_0x3cb876[_0xedb1('0x76')][_0xedb1('0x3e')],isNotNull(_0x3cb876[_0xedb1('0x5e')])?_0x3cb876[_0xedb1('0x5e')][_0xedb1('0x197')]()||'':'',_0x3cb876[_0xedb1('0x198')]>0x0?_0x546806[_0xedb1('0x171')][_0xedb1('0x199')](_0x3cb876['dialCutDigit']):_0x546806[_0xedb1('0x171')]):util[_0xedb1('0x7b')]('SIP/%s/%s%s',_[_0xedb1('0xb1')](_0x3cb876[_0xedb1('0x141')])?_0x3cb876['Trunk'][_0xedb1('0x3e')]:_0x3cb876['TrunkBackup']['name'],isNotNull(_0x3cb876['dialPrefix'])?_0x3cb876[_0xedb1('0x5e')][_0xedb1('0x197')]()||'':'',_0x3cb876[_0xedb1('0x198')]>0x0?_0x546806[_0xedb1('0x171')][_0xedb1('0x199')](_0x3cb876[_0xedb1('0x198')]):_0x546806[_0xedb1('0x171')]),'callerid':_0x3a0409,'Exten':_0xedb1('0xe3'),'Context':_0xedb1('0x19a'),'Priority':'1','variable':_0x4a1224,'timeout':(_0x3cb876[_0xedb1('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4efdaa})[_0xedb1('0xb9')](function(_0x578314){return _0x30b713(_0x578314);})[_0xedb1('0xbe')](function(_0x527d24){_0x3cb876[_0xedb1('0x66')]+=0x1;var _0x4789bd=new History(_0x213fce[_0xedb1('0x23')][_0x4efdaa]);logger[_0xedb1('0x98')](util[_0xedb1('0x7b')](_0xedb1('0x19b'),JSON[_0xedb1('0x46')](_0x527d24)));_0x4789bd['state']=0xe;_0x4789bd[_0xedb1('0xaa')]='OriginateError';_0x4789bd[_0xedb1('0xac')]=moment()[_0xedb1('0x7b')](_0xedb1('0xfd'));_0x4789bd[_0xedb1('0xab')]=_0x4789bd['starttime'];_0x213fce['createHistory'](_0x4789bd)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x19c')));_0x213fce[_0xedb1('0xd0')](_0x4789bd)[_0xedb1('0xbe')](loggerCatch('[originate][error]'))[_0xedb1('0x1d')](function(){delete _0x213fce['actions'][_0x4efdaa];return _0x49084d(msgResponse(_0xedb1('0x16f'),_0xedb1('0x45'),_0xedb1('0x19d')));});});});};Dialer[_0xedb1('0x1b')]['syncOriginateResponse']=function(_0x1c3c32){var _0x22407b=this[_0xedb1('0x23')][_0x1c3c32['actionid']];if(_0x22407b){delete this[_0xedb1('0x23')][_0x1c3c32[_0xedb1('0x127')]];_0x22407b[_0xedb1('0x114')]=moment()[_0xedb1('0x7b')](_0xedb1('0xfd'));var _0x3ab355=_0x22407b['type']==='ivr'?this[_0xedb1('0x20')][_0x22407b[_0xedb1('0xb5')]]:this['voiceQueues'][_0x22407b['getQueue']()];if(!this['isSuccess'](_0x1c3c32[_0xedb1('0x19e')])){this['updateOriginated'](_0x3ab355);return this[_0xedb1('0x19f')](_0x22407b,_0x3ab355,_0x1c3c32)['catch'](loggerCatch(_0xedb1('0x1a0')));}this[_0xedb1('0x24')][_0x1c3c32[_0xedb1('0xe7')]]=_0x22407b;}};Dialer['prototype']['checkRetriveMax']=function(_0x432cdc,_0x583d96,_0x401062){var _0x5602c6=new History(_0x583d96);if(_0x5602c6[_0xedb1('0x1a1')]+_0x5602c6[_0xedb1('0xf3')]+_0x5602c6[_0xedb1('0xf4')]+_0x5602c6[_0xedb1('0x1a2')]+_0x5602c6[_0xedb1('0xf5')]+_0x5602c6[_0xedb1('0xf6')]+_0x5602c6[_0xedb1('0xf7')]+_0x5602c6[_0xedb1('0x102')]>=_0x401062[_0xedb1('0x1a3')]-0x1){return!![];}switch(_0x432cdc){case 0x3:if(_0x5602c6[_0xedb1('0xf4')]>=_0x401062[_0xedb1('0x1a4')]-0x1){return!![];}this[_0xedb1('0xc6')]({'active':![],'countnoanswerretry':_0x5602c6[_0xedb1('0xf4')]+=0x1,'scheduledat':moment()[_0xedb1('0xfa')](_0x401062[_0xedb1('0x1a5')],'minutes')[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x5602c6['ContactId'],'ListId':_0x5602c6[_0xedb1('0xd9')],'VoiceQueueId':_0x5602c6[_0xedb1('0xda')]||undefined,'CampaignId':_0x5602c6['CampaignId']||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1a6')));break;case 0x5:if(_0x5602c6[_0xedb1('0x1a1')]>=_0x401062[_0xedb1('0x1a7')]-0x1){return!![];}this[_0xedb1('0xc6')]({'active':![],'countbusyretry':_0x5602c6[_0xedb1('0x1a1')]+=0x1,'scheduledat':moment()[_0xedb1('0xfa')](_0x401062['dialBusyRetryFrequency'],_0xedb1('0xfc'))[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x5602c6['ContactId'],'ListId':_0x5602c6[_0xedb1('0xd9')],'VoiceQueueId':_0x5602c6[_0xedb1('0xda')]||undefined,'CampaignId':_0x5602c6[_0xedb1('0xdb')]||undefined})[_0xedb1('0xbe')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x5602c6['countcongestionretry']>=_0x401062['dialCongestionMaxRetry']-0x1){return!![];}this[_0xedb1('0xc6')]({'active':![],'countcongestionretry':_0x5602c6[_0xedb1('0xf3')]+=0x1,'scheduledat':moment()[_0xedb1('0xfa')](_0x401062[_0xedb1('0x1a8')],_0xedb1('0xfc'))['format'](_0xedb1('0xfd')),'ContactId':_0x5602c6[_0xedb1('0xd8')],'ListId':_0x5602c6[_0xedb1('0xd9')],'VoiceQueueId':_0x5602c6[_0xedb1('0xda')]||undefined,'CampaignId':_0x5602c6[_0xedb1('0xdb')]||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1a9')));break;case 0x0:if(_0x5602c6[_0xedb1('0x1a2')]>=_0x401062[_0xedb1('0x1aa')]-0x1){return!![];}else{this[_0xedb1('0xc6')]({'active':![],'countnosuchnumberretry':_0x5602c6[_0xedb1('0x1a2')]+=0x1,'scheduledat':moment()['add'](_0x401062[_0xedb1('0x1ab')],_0xedb1('0xfc'))[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x5602c6[_0xedb1('0xd8')],'ListId':_0x5602c6['ListId'],'VoiceQueueId':_0x5602c6['VoiceQueueId']||undefined,'CampaignId':_0x5602c6[_0xedb1('0xdb')]||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1ac')));}break;case 0xa:if(_0x5602c6[_0xedb1('0xf5')]>=_0x401062[_0xedb1('0x1ad')]-0x1){return!![];}this[_0xedb1('0xc6')]({'active':![],'countdropretry':_0x5602c6[_0xedb1('0xf5')]+=0x1,'scheduledat':moment()[_0xedb1('0xfa')](_0x401062[_0xedb1('0x1ae')],_0xedb1('0xfc'))[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x5602c6['ContactId'],'ListId':_0x5602c6[_0xedb1('0xd9')],'VoiceQueueId':_0x5602c6['VoiceQueueId']||undefined,'CampaignId':_0x5602c6['CampaignId']||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x119')));break;case 0xb:if(_0x5602c6[_0xedb1('0xf6')]>=_0x401062[_0xedb1('0x121')]-0x1){return!![];}this[_0xedb1('0xc6')]({'active':![],'countabandonedretry':_0x5602c6[_0xedb1('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x401062[_0xedb1('0x120')],_0xedb1('0xfc'))[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x5602c6['ContactId'],'ListId':_0x5602c6[_0xedb1('0xd9')],'VoiceQueueId':_0x5602c6['VoiceQueueId']||undefined,'CampaignId':_0x5602c6['CampaignId']||undefined})['catch'](loggerCatch(_0xedb1('0x122')));break;case 0x13:if(_0x5602c6[_0xedb1('0xf7')]>=_0x401062['dialMachineMaxRetry']-0x1){return!![];}this[_0xedb1('0xc6')]({'active':![],'countmachineretry':_0x5602c6['countmachineretry']+=0x1,'scheduledat':moment()[_0xedb1('0xfa')](_0x401062['dialMachineRetryFrequency'],_0xedb1('0xfc'))[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x5602c6[_0xedb1('0xd8')],'ListId':_0x5602c6['ListId'],'VoiceQueueId':_0x5602c6[_0xedb1('0xda')]||undefined,'CampaignId':_0x5602c6['CampaignId']||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0xfe')));break;case 0x14:if(_0x5602c6[_0xedb1('0x102')]>=_0x401062[_0xedb1('0x1af')]-0x1){return!![];}this[_0xedb1('0xc6')]({'active':![],'countagentrejectretry':_0x5602c6[_0xedb1('0x102')]+=0x1,'scheduledat':moment()[_0xedb1('0xfa')](_0x401062[_0xedb1('0x1b0')],'minutes')[_0xedb1('0x7b')](_0xedb1('0xfd')),'ContactId':_0x5602c6[_0xedb1('0xd8')],'ListId':_0x5602c6[_0xedb1('0xd9')],'VoiceQueueId':_0x5602c6['VoiceQueueId']||undefined,'CampaignId':_0x5602c6['CampaignId']||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1b1')));break;default:return!![];}};Dialer[_0xedb1('0x1b')][_0xedb1('0x19f')]=function(_0xf626f,_0x42a4b2,_0x416a13){var _0x493d2b=this;var _0x209af0=new History(_0xf626f);var _0x5203ce=![];var _0x27cc17;var _0x5e2d23;return new BPromise(function(_0x12c13a,_0x26a77d){if(_[_0xedb1('0x39')](_0x42a4b2)&&typeof _0x42a4b2!==_0xedb1('0x16e')){return _0x26a77d(msgResponse(_0xedb1('0x1b2'),_0xedb1('0x145'),'entity\x20is\x20undefine'));}if(_[_0xedb1('0x39')](_0x416a13)&&typeof _0x416a13!==_0xedb1('0x16e')){return _0x26a77d(msgResponse(_0xedb1('0x1b2'),'Failure',_0xedb1('0x1b3')));}_0x493d2b['verifyAdditionalPhones'](_0x209af0,_0x416a13[_0xedb1('0x1b4')],_0x42a4b2)[_0xedb1('0xb9')](function(_0x68023d){if(_0x68023d[_0xedb1('0x118')]==0x1)_0x5203ce=!![];switch(_0x416a13[_0xedb1('0x1b4')]){case'0':_0x42a4b2['outboundNoSuchCallsDay']+=0x1;_0x209af0[_0xedb1('0xa9')]=0x0;_0x209af0[_0xedb1('0xaa')]=_0xedb1('0x1b5');_0x209af0[_0xedb1('0x1a2')]+=0x1;_0x209af0[_0xedb1('0xf1')]+=0x1;ami['emit'](_0xedb1('0x1b6'),ut['buildObj'](_0xf626f,_0xedb1('0x1b7')));_0x27cc17=_0x42a4b2[_0xedb1('0x1ab')];_0x5e2d23=_0x42a4b2[_0xedb1('0x116')];_0x493d2b['createHistory'](_0x209af0)['catch'](loggerCatch(_0xedb1('0xf2')));if(_0x493d2b['checkRetriveMax'](0x0,_0xf626f,_0x42a4b2)&&!_0x5203ce){if(_0x209af0[_0xedb1('0x1a2')]>=_0x42a4b2[_0xedb1('0x1aa')]){_0x493d2b['createStateFinal'](_0x209af0,_0x12c13a,_0x26a77d,_0xedb1('0x1b8'));}else{_0x493d2b[_0xedb1('0xf8')](_0x209af0,_0x12c13a,_0x26a77d,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x42a4b2[_0xedb1('0x64')]+=0x1;_0x209af0[_0xedb1('0xa9')]=0x3;_0x209af0['statedesc']=_0xedb1('0x1b9');_0x209af0[_0xedb1('0xf4')]+=0x1;_0x209af0['countglobal']+=0x1;ami[_0xedb1('0x4a')](_0xedb1('0x1ba'),ut['buildObj'](_0xf626f,'noanswer'));_0x27cc17=_0x42a4b2['dialNoAnswerRetryFrequency'];_0x5e2d23=_0x42a4b2['callAdditionalPhoneAfterMin'];_0x493d2b[_0xedb1('0xd2')](_0x209af0)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1bb')));if(_0x493d2b[_0xedb1('0x1bc')](0x3,_0xf626f,_0x42a4b2)&&!_0x5203ce){if(_0x209af0[_0xedb1('0xf4')]>=_0x42a4b2[_0xedb1('0x1a4')]){_0x493d2b['createStateFinal'](_0x209af0,_0x12c13a,_0x26a77d,_0xedb1('0x1bd'));}else{_0x493d2b[_0xedb1('0xf8')](_0x209af0,_0x12c13a,_0x26a77d,_0xedb1('0x1bd'));}}break;case'5':_0x42a4b2['outboundBusyCallsDay']+=0x1;_0x209af0[_0xedb1('0xa9')]=0x5;_0x209af0['statedesc']=_0xedb1('0x1be');_0x209af0[_0xedb1('0x1a1')]+=0x1;_0x209af0[_0xedb1('0xf1')]+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0xf626f,_0xedb1('0x1bf')));_0x27cc17=_0x42a4b2[_0xedb1('0x1c0')];_0x5e2d23=_0x42a4b2[_0xedb1('0x116')];_0x493d2b['createHistory'](_0x209af0)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1c1')));if(_0x493d2b['checkRetriveMax'](0x5,_0xf626f,_0x42a4b2)&&!_0x5203ce){if(_0x209af0[_0xedb1('0x1a1')]>=_0x42a4b2[_0xedb1('0x1a7')]){_0x493d2b[_0xedb1('0xf9')](_0x209af0,_0x12c13a,_0x26a77d,_0xedb1('0x1c2'));}else{_0x493d2b[_0xedb1('0xf8')](_0x209af0,_0x12c13a,_0x26a77d,_0xedb1('0x1c2'));}}break;case'8':_0x42a4b2['outboundCongestionCallsDay']+=0x1;_0x209af0['state']=0x8;_0x209af0[_0xedb1('0xaa')]=_0xedb1('0x1c3');_0x209af0['countcongestionretry']+=0x1;_0x209af0['countglobal']+=0x1;_0x27cc17=_0x42a4b2[_0xedb1('0x1a8')];_0x5e2d23=_0x42a4b2['callAdditionalPhoneAfterMin'];ami['emit'](_0xedb1('0x1c4'),ut[_0xedb1('0xec')](_0xf626f,'congestion'));_0x493d2b[_0xedb1('0xd2')](_0x209af0)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1c5')));if(_0x493d2b['checkRetriveMax'](0x8,_0xf626f,_0x42a4b2)&&!_0x5203ce){if(_0x209af0[_0xedb1('0xf3')]>=_0x42a4b2[_0xedb1('0x1c6')]){_0x493d2b[_0xedb1('0xf9')](_0x209af0,_0x12c13a,_0x26a77d,_0xedb1('0x1c7'));}else{_0x493d2b[_0xedb1('0xf8')](_0x209af0,_0x12c13a,_0x26a77d,'reason\x208\x20congestion');}}break;case'11':_0x42a4b2['outboundAbandonedCallsDay']+=0x1;_0x209af0[_0xedb1('0xa9')]=0xb;_0x209af0[_0xedb1('0xaa')]=_0xedb1('0x123');_0x209af0[_0xedb1('0xf6')]+=0x1;_0x209af0['countglobal']+=0x1;_0x27cc17=_0x42a4b2['dialAbandonedRetryFrequency'];_0x5e2d23=_0x42a4b2[_0xedb1('0x116')];_0x493d2b[_0xedb1('0xd2')](_0x209af0)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x124')));if(_0x493d2b[_0xedb1('0x1bc')](0xb,_0xf626f,_0x42a4b2)&&!_0x5203ce){if(_0x209af0[_0xedb1('0xf6')]>=_0x42a4b2['dialAbandonedMaxRetry']){_0x493d2b['createStateFinal'](_0x209af0,_0x12c13a,_0x26a77d,_0xedb1('0x1c8'));}else{_0x493d2b[_0xedb1('0xf8')](_0x209af0,_0x12c13a,_0x26a77d,'reason\x2011\x20abandoned');}}break;case'20':_0x42a4b2[_0xedb1('0x1c9')]+=0x1;_0x209af0[_0xedb1('0xa9')]=0x14;_0x209af0['statedesc']=_0xedb1('0x1ca');_0x209af0[_0xedb1('0x102')]+=0x1;_0x209af0['countglobal']+=0x1;_0x27cc17=_0x42a4b2[_0xedb1('0x1b0')];_0x5e2d23=_0x42a4b2[_0xedb1('0x116')];ami[_0xedb1('0x4a')](_0xedb1('0x1cb'),ut[_0xedb1('0xec')](_0xf626f,'agentreject'));_0x493d2b[_0xedb1('0xd2')](_0x209af0)['catch'](loggerCatch(_0xedb1('0x1cc')));if(_0x493d2b['checkRetriveMax'](0x14,_0xf626f,_0x42a4b2)&&!_0x5203ce){if(_0x209af0[_0xedb1('0x102')]>=_0x42a4b2[_0xedb1('0x1af')]){_0x493d2b['createStateFinal'](_0x209af0,_0x12c13a,_0x26a77d,'reason\x2020\x20agentreject');}else{_0x493d2b['stateGlobal'](_0x209af0,_0x12c13a,_0x26a77d,'reason\x2020\x20agentreject');}}break;default:_0x42a4b2['outboundUnknownCallsDay']+=0x1;_0x209af0[_0xedb1('0xa9')]=0xc;_0x209af0['statedesc']=_0x416a13[_0xedb1('0x1b4')];_0x27cc17=_0x42a4b2[_0xedb1('0x1b0')];_0x5e2d23=_0x42a4b2[_0xedb1('0x116')];_0x493d2b['createHistory'](_0x209af0)[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1cd')));if(_0x493d2b[_0xedb1('0x1bc')](_0x416a13[_0xedb1('0x1b4')],_0xf626f,_0x42a4b2)&&!_0x5203ce){if(_0x209af0[_0xedb1('0x1a1')]+_0x209af0[_0xedb1('0xf3')]+_0x209af0['countnoanswerretry']+_0x209af0[_0xedb1('0x1a2')]+_0x209af0[_0xedb1('0xf5')]+_0x209af0['countabandonedretry']+_0x209af0['countmachineretry']+_0x209af0['countagentrejectretry']>=_0x42a4b2[_0xedb1('0x1a3')]){_0x493d2b[_0xedb1('0xf8')](_0x209af0,_0x12c13a,_0x26a77d,_0x416a13[_0xedb1('0x1b4')]);}else{_0x493d2b[_0xedb1('0xf9')](_0x209af0,_0x12c13a,_0x26a77d,_0x416a13[_0xedb1('0x1b4')]);}}}})[_0xedb1('0xb9')](function(_0x318890){if(_0x5203ce){_0x493d2b['swapAdditionalPhones'](_0x209af0,_0x27cc17,_0x5e2d23)['then'](function(_0x119b7b){return _0x12c13a(0x1);});}});});};Dialer[_0xedb1('0x1b')][_0xedb1('0xf8')]=function(_0x4766da,_0x26e613,_0x19a5d2,_0x45158b){var _0x1b795a=new Final(_0x4766da);_0x1b795a['state']=0xf;_0x1b795a['statedesc']='Global';this[_0xedb1('0xf9')](_0x1b795a,_0x26e613,_0x19a5d2,_0x45158b);};Dialer[_0xedb1('0x1b')][_0xedb1('0xf9')]=function(_0x832890,_0x1f72c1,_0x41e75a,_0x81c7e9){this[_0xedb1('0xd0')](_0x832890)[_0xedb1('0xb9')](function(){return _0x1f72c1(msgResponse(_0xedb1('0x1b2'),'Success',_0x81c7e9));})[_0xedb1('0xbe')](function(){return _0x41e75a(msgResponse(_0xedb1('0x1ce'),'Failure',_0xedb1('0x1cf')));});};Dialer['prototype'][_0xedb1('0x15f')]=function(_0x50e6e6){var _0x470388=_0x50e6e6[_0xedb1('0x1d0')]/0x64;var _0x252e54=_0x50e6e6['outboundDropCallsDayTimeout']/(_0x50e6e6[_0xedb1('0x1d1')]+_0x50e6e6[_0xedb1('0x60')]);var _0x449d83=Math[_0xedb1('0x1d2')](_0x50e6e6['predictiveIntervalAvailable']*(_0x50e6e6[_0xedb1('0x1d3')]/0x64));var _0x27b898=Math[_0xedb1('0x1d2')](_0x50e6e6[_0xedb1('0x71')]*(_0x50e6e6[_0xedb1('0x1d4')]/0x64));var _0x339d8c=_0x50e6e6[_0xedb1('0x4f')]+_0x50e6e6[_0xedb1('0x54')];var _0xa0451d=Math[_0xedb1('0x1d5')](_0x50e6e6[_0xedb1('0x74')]*_0x50e6e6[_0xedb1('0x8c')]*_0x50e6e6[_0xedb1('0x6f')]*_0x50e6e6[_0xedb1('0x1d6')]);if(_[_0xedb1('0x39')](_0x50e6e6[_0xedb1('0x26')])){if(!_[_0xedb1('0x39')](_0x50e6e6[_0xedb1('0x25')])){_0x50e6e6[_0xedb1('0x25')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xedb1('0x39')](_0x50e6e6[_0xedb1('0x92')])){loggerPredictive[_0xedb1('0x98')](_0xedb1('0x1d7'),_0xedb1('0x1d8'));clearInterval(_0x50e6e6['handlePredictive']);_0x50e6e6['handlePredictive']=undefined;}_0x50e6e6[_0xedb1('0x26')]=moment()[_0xedb1('0x7b')](_0xedb1('0xfd'));loggerPredictive['info'](_0x50e6e6['name'],_0xedb1('0x1d9'),_0x50e6e6[_0xedb1('0x26')]);this['handlePower'](_0x50e6e6,0x1);}else if(ifInterval(_0x50e6e6[_0xedb1('0x1da')],_0x50e6e6[_0xedb1('0x26')])){this[_0xedb1('0x15c')](_0x50e6e6,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x50e6e6[_0xedb1('0x26')],_0x50e6e6[_0xedb1('0x3e')]);_0x50e6e6[_0xedb1('0x74')]=0x0;_0x50e6e6[_0xedb1('0x6e')]=0x0;}else if(_0x470388<_0x252e54&&_0x50e6e6[_0xedb1('0x1db')]===_0xedb1('0x1dc')){freeVariablesPredictive(_0x50e6e6);loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x1dd'),_0xedb1('0x1de'),_0x252e54,_0xedb1('0x26'),_0x50e6e6[_0xedb1('0x3e')]);}else if(_0xa0451d<_0x50e6e6[_0xedb1('0x6e')]&&_0x50e6e6[_0xedb1('0x1db')]==='dropRate'){freeVariablesPredictive(_0x50e6e6);loggerPredictive['info'](_0xedb1('0x1df'),'Max\x20Drop\x20',_0xa0451d,_0xedb1('0x1e0'),_0x50e6e6['predictiveIntervalErlangCallsDroppedCalls'],_0xedb1('0x26'),_0x50e6e6[_0xedb1('0x3e')]);}else if(!ifInterval(_0x50e6e6[_0xedb1('0x1da')],_0x50e6e6[_0xedb1('0x26')])&&_[_0xedb1('0x39')](_0x50e6e6[_0xedb1('0x25')])&&!_[_0xedb1('0x39')](_0x50e6e6[_0xedb1('0x26')])){_0x50e6e6[_0xedb1('0x25')]=moment()['format'](_0xedb1('0xfd'));loggerPredictive[_0xedb1('0x7e')](_0x50e6e6[_0xedb1('0x3e')],_0xedb1('0x1e1'),_0x50e6e6['startPredictive']);this['averageHandleTime'](_0x50e6e6[_0xedb1('0x1da')])[_0xedb1('0xb9')](this[_0xedb1('0x1e2')](_0x50e6e6))[_0xedb1('0xb9')](mergeDataErlangB(_0x50e6e6))['then'](this[_0xedb1('0x1e3')](_0x50e6e6))[_0xedb1('0xbe')](loggerCatchPredictive(_0xedb1('0x1e4'),_0x50e6e6));}else if(!ifInterval(_0x50e6e6[_0xedb1('0x1da')],_0x50e6e6[_0xedb1('0x25')])){_0x50e6e6['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x50e6e6[_0xedb1('0x25')]=moment()['format'](_0xedb1('0xfd'));loggerPredictive[_0xedb1('0x7e')](_0x50e6e6[_0xedb1('0x3e')],_0xedb1('0x1e5'),_0x50e6e6[_0xedb1('0x25')]);clearInterval(_0x50e6e6['handlePredictive']);_0x50e6e6[_0xedb1('0x92')]=undefined;this[_0xedb1('0xc3')](_0x50e6e6[_0xedb1('0x1da')])['then'](this[_0xedb1('0x1e2')](_0x50e6e6))['then'](mergeDataErlangB(_0x50e6e6))[_0xedb1('0xb9')](this[_0xedb1('0x1e3')](_0x50e6e6))['catch'](loggerCatchPredictive(_0xedb1('0x1e6'),_0x50e6e6));}else if(_0x50e6e6['predictiveIntervalAvailable']&&_0x339d8c<_0x50e6e6['predictiveIntervalAvailable']-_0x27b898){freeVariablesPredictive(_0x50e6e6);loggerPredictive[_0xedb1('0x7e')](_0x50e6e6[_0xedb1('0x3e')],_0xedb1('0x1e7'),_0x339d8c,_0xedb1('0x1e8'),_0x50e6e6[_0xedb1('0x71')],'-',_0x27b898,'=',_0x50e6e6[_0xedb1('0x71')]-_0x27b898,')');}else if(_0x50e6e6['predictiveIntervalAvailable']&&_0x339d8c>_0x50e6e6['predictiveIntervalAvailable']+_0x449d83){freeVariablesPredictive(_0x50e6e6);loggerPredictive[_0xedb1('0x7e')](_0x50e6e6[_0xedb1('0x3e')],_0xedb1('0x1e7'),_0x339d8c,_0xedb1('0x1e9'),_0x50e6e6[_0xedb1('0x71')],'+',_0x449d83,'=',_0x50e6e6['predictiveIntervalAvailable']+_0x449d83,')');}};Dialer[_0xedb1('0x1b')]['getDataPredictive']=function(_0xd4b905){var _0x48c377=this;return function(_0x222c79){return new BPromise(function(_0xe90226,_0x592497){_['merge'](_0xd4b905,_0x222c79[0x0]);if(checkGetDataPredictive(_0x222c79[0x0])){var _0x484463=_0xd4b905[_0xedb1('0x71')]=_0xd4b905[_0xedb1('0x54')]+_0xd4b905[_0xedb1('0x4f')];var _0x3c438c=_0xd4b905[_0xedb1('0x1da')]*0x3c;var _0x286529=_0x222c79[0x0]['predictiveIntervalAvgTalktime']+_0x222c79[0x0][_0xedb1('0x69')];var _0x415d8f=(_0x222c79[0x0][_0xedb1('0x82')]+_0x222c79[0x0][_0xedb1('0x6c')]+_0x222c79[0x0][_0xedb1('0x6b')])/_0x222c79[0x0]['predictiveIntervalTotalCalls'];_0xd4b905[_0xedb1('0x6f')]=_0x415d8f>0x0?_0x415d8f:0x1;switch(_0xd4b905[_0xedb1('0x1db')]){case _0xedb1('0x1dc'):var _0x4984d3=_0xd4b905[_0xedb1('0x1d0')]/0x64;return _0x48c377[_0xedb1('0x1ea')](_0x484463,_0x3c438c,_0x286529,_0x415d8f,_0x4984d3)[_0xedb1('0xb9')](function(_0x1da9f1){return _0xe90226(_0x1da9f1);});case _0xedb1('0x1eb'):var _0x154e2c=_0xd4b905[_0xedb1('0x1d0')]/0x64;return _0x48c377[_0xedb1('0x1ec')](_0x484463,_0x3c438c,_0x286529,_0x415d8f,_0x154e2c)['then'](function(_0x2cf440){return _0xe90226(_0x2cf440);});default:return _0x592497(msgResponse(_0xedb1('0x1ed'),_0xedb1('0x145'),_0xedb1('0x1ee')));}}else{return _0x592497(msgResponse(_0xedb1('0x1ed'),_0xedb1('0x145'),_0xedb1('0x1ef')));}});};};Dialer[_0xedb1('0x1b')]['getDataPredictiveOld']=function(_0x2c7207){var _0x212524=this;return function(_0x1b8f94){return new BPromise(function(_0xf27f96,_0x2d67f1){_[_0xedb1('0x8f')](_0x2c7207,_0x1b8f94[0x0]);if(checkGetDataPredictive(_0x1b8f94[0x0])){loggerPredictive['info'](JSON[_0xedb1('0x46')](_0x1b8f94[0x0]));if(_0x2c7207[_0xedb1('0x1db')]===_0xedb1('0x1dc')){return _0x212524[_0xedb1('0xce')](_0x2c7207['id'])[_0xedb1('0xb9')](function(_0x406745){var _0x38555d=_0x2c7207[_0xedb1('0x50')]-_0x406745[0x0][_0xedb1('0x1f0')];var _0x2ccc79=_0x2c7207[_0xedb1('0x1da')]*0x3c;var _0x5094c3=_0x1b8f94[0x0]['predictiveIntervalAvgTalktime']+_0x1b8f94[0x0][_0xedb1('0x69')];var _0x5e699b=(_0x1b8f94[0x0][_0xedb1('0x82')]+_0x1b8f94[0x0][_0xedb1('0x6c')]+_0x1b8f94[0x0][_0xedb1('0x6b')])/_0x1b8f94[0x0]['predictiveIntervalTotalCalls'];var _0x3a67ee=_0x2c7207['dialPredictiveOptimizationPercentage']/0x64;_0x2c7207['predictiveIntervalPauses']=_0x406745[0x0][_0xedb1('0x1f0')]||0x0;_0x2c7207[_0xedb1('0x6f')]=_0x5e699b>0x0?_0x5e699b:0x1;return _0x212524[_0xedb1('0x1ea')](_0x38555d,_0x2ccc79,_0x5094c3,_0x5e699b,_0x3a67ee);})[_0xedb1('0xb9')](function(_0x2ef303){return _0xf27f96(_0x2ef303);})[_0xedb1('0xbe')](function(_0x49bb8c){return _0x2d67f1(msgResponse(_0xedb1('0x1f1'),_0xedb1('0x145'),JSON[_0xedb1('0x46')](_0x49bb8c)));});}if(_0x2c7207[_0xedb1('0x1db')]==='agentBusyFactor'){return _0x212524[_0xedb1('0xce')](_0x2c7207['id'])[_0xedb1('0xb9')](function(_0x22de88){var _0x62096d=_0x2c7207['loggedIn']-_0x22de88[0x0][_0xedb1('0x1f0')];var _0x2f345b=_0x2c7207[_0xedb1('0x1da')]*0x3c;var _0x16678b=_0x1b8f94[0x0][_0xedb1('0x6a')]+_0x1b8f94[0x0]['predictiveIntervalAvgHoldtime'];var _0x1337f7=(_0x1b8f94[0x0][_0xedb1('0x82')]+_0x1b8f94[0x0][_0xedb1('0x6c')]+_0x1b8f94[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1b8f94[0x0][_0xedb1('0x72')];var _0x20c452=_0x2c7207[_0xedb1('0x1d0')]/0x64;_0x2c7207[_0xedb1('0x70')]=_0x22de88[0x0][_0xedb1('0x1f0')]||0x0;_0x2c7207[_0xedb1('0x6f')]=_0x1337f7>0x0?_0x1337f7:0x1;return _0x212524[_0xedb1('0x1ec')](_0x62096d,_0x2f345b,_0x16678b,_0x1337f7,_0x20c452);})[_0xedb1('0xb9')](function(_0x331a37){return _0xf27f96(_0x331a37);})[_0xedb1('0xbe')](function(_0x5b5d28){return _0x2d67f1(msgResponse(_0xedb1('0x1f1'),'Failure',JSON['stringify'](_0x5b5d28)));});}}else{return _0x2d67f1(msgResponse(_0xedb1('0x1ed'),_0xedb1('0x145'),_0xedb1('0x1ef')));}});};};Dialer[_0xedb1('0x1b')][_0xedb1('0x1e3')]=function(_0x49b75d){var _0xd7dbcc=this;return function(){var _0x5926da=0x0;var _0x238450=Math[_0xedb1('0x1d5')](_0x49b75d[_0xedb1('0x75')]*0x3e8);if(_0x238450>0x0){_0x238450=_0x238450<0x64?0x64:_0x238450;loggerPredictive[_0xedb1('0x7e')](_0x49b75d[_0xedb1('0x3e')],_0xedb1('0x1f2'),_0x238450,_0xedb1('0x47'));_0x49b75d[_0xedb1('0x92')]=setInterval(function(){_0xd7dbcc[_0xedb1('0x92')](_0x49b75d);loggerPredictiveCalls['info'](_0xedb1('0x1f3'),_0x5926da+=0x1);},_0x238450);}else{loggerPredictive['info'](_0x49b75d[_0xedb1('0x3e')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xedb1('0x1b')][_0xedb1('0x1f4')]=function(_0x1bccea,_0x4dfb73){var _0x18a7ba=this;return function(_0x96e9b6){if(_['isEmpty'](_0x96e9b6)){if(_[_0xedb1('0xb1')](_0x4dfb73[_0xedb1('0x1f5')])||!_0x4dfb73[_0xedb1('0x1f6')]){if(_0x1bccea[_0xedb1('0x5a')]===_0xedb1('0xb')){_0x1bccea[_0xedb1('0x12e')]=_[_0xedb1('0x39')](_0x1bccea['queueStatusComplete'])?!![]:_0x1bccea[_0xedb1('0x12e')];var _0x66a236=uuid['v4']();_0x18a7ba[_0xedb1('0x23')][_0x66a236]=new Action(_0x1bccea,_0x4dfb73,_0x66a236);loggerBooked[_0xedb1('0x7e')](_0xedb1('0x1f7'),_0x66a236,_0xedb1('0x1f8'),JSON[_0xedb1('0x46')](_0x1bccea[_0xedb1('0x12e')]),'Queue:\x20',_0x1bccea[_0xedb1('0x3e')]);if(_0x1bccea[_0xedb1('0x12e')]){_0x1bccea[_0xedb1('0x12e')]=![];_0x18a7ba[_0xedb1('0x28')][_0x18a7ba[_0xedb1('0x23')][_0x66a236][_0xedb1('0xb5')]]=[];ami[_0xedb1('0x14c')]({'actionid':_0x66a236,'action':_0xedb1('0x1f9'),'queue':_0x1bccea[_0xedb1('0x3e')]})['catch'](function(){_0x18a7ba[_0xedb1('0xb4')](_0x1bccea);_0x18a7ba['rescheduleContact']({'active':![],'ContactId':_0x18a7ba[_0xedb1('0x23')][_0x66a236][_0xedb1('0xd8')],'ListId':_0x18a7ba[_0xedb1('0x23')][_0x66a236][_0xedb1('0xd9')],'VoiceQueueId':_0x18a7ba['actions'][_0x66a236]['VoiceQueueId']||undefined,'CampaignId':_0x18a7ba[_0xedb1('0x23')][_0x66a236][_0xedb1('0xdb')]||undefined})['catch'](loggerCatch(_0xedb1('0x1fa')));delete _0x18a7ba[_0xedb1('0x23')][_0x66a236];});}else{loggerBooked[_0xedb1('0x7e')](_0xedb1('0x1fb'),JSON[_0xedb1('0x46')](_0x1bccea[_0xedb1('0x12e')]),'Queue:\x20',_0x1bccea[_0xedb1('0x3e')]);_0x18a7ba['updateOriginated'](_0x1bccea);_0x18a7ba['rescheduleContact']({'active':![],'ContactId':_0x18a7ba[_0xedb1('0x23')][_0x66a236][_0xedb1('0xd8')],'ListId':_0x18a7ba[_0xedb1('0x23')][_0x66a236][_0xedb1('0xd9')],'VoiceQueueId':_0x18a7ba[_0xedb1('0x23')][_0x66a236][_0xedb1('0xda')]||undefined,'CampaignId':_0x18a7ba['actions'][_0x66a236][_0xedb1('0xdb')]||undefined})[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x1fa')));delete _0x18a7ba['actions'][_0x66a236];}}else{return _0x18a7ba[_0xedb1('0x16d')](_0x1bccea,_0x4dfb73);}}else{if(getDiff(_0x4dfb73['scheduledat'])<_0x1bccea[_0xedb1('0x1fc')]*0x3c){if(_0x4dfb73[_0xedb1('0x1fd')]&&!_0x4dfb73[_0xedb1('0x1fd')][_0xedb1('0x1fe')]){_0x18a7ba[_0xedb1('0x94')][_0xedb1('0x131')](_0x4dfb73['id'])[_0xedb1('0x1d')](function(){_0x18a7ba['updateOriginated'](_0x1bccea);});}else{_0x18a7ba[_0xedb1('0xc8')]({'active':![]},_0x4dfb73['id'],0x1)['finally'](function(){_0x18a7ba['updateOriginated'](_0x1bccea);});}}else{_0x1bccea[_0xedb1('0x67')]+=0x1;_0x18a7ba['updateOriginated'](_0x1bccea);if(_0x1bccea[_0xedb1('0x1ff')]){_0x18a7ba[_0xedb1('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4dfb73[_0xedb1('0xd8')],'ListId':_0x4dfb73[_0xedb1('0xd9')],'VoiceQueueId':_0x4dfb73['VoiceQueueId']||undefined,'CampaignId':_0x4dfb73[_0xedb1('0xdb')]||undefined})['catch'](loggerCatch(_0xedb1('0x200')));_0x18a7ba[_0xedb1('0xd2')](createObjHistory(_0x1bccea,_0x4dfb73,_0xedb1('0x201'),0x17,'RecallInQueue'))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x202')));}else{_0x18a7ba['saveInDb'](createObjHistory(_0x1bccea,_0x4dfb73,_0xedb1('0x203'),0x16,_0xedb1('0x204')),'[Originate][HistoryRecallClose][historyCatch]',_0xedb1('0x205'));}}}}else{_0x1bccea[_0xedb1('0x206')]+=0x1;_0x18a7ba[_0xedb1('0xee')](createObjHistory(_0x1bccea,_0x4dfb73,'BLACKLIST',0xd,'Blacklist'),_0xedb1('0x207'),_0xedb1('0x208'));throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x2535e1){var _0x35810e=this;var _0x696125=_0x2535e1[_0xedb1('0x209')]-_0x2535e1[_0xedb1('0x73')]-_0x2535e1[_0xedb1('0xcb')];emitCampaignSummary(_0x2535e1);if(_0x696125>0x0){if(_0x696125>this[_0xedb1('0x20a')]){_0x696125=this[_0xedb1('0x20a')];}_0x2535e1[_0xedb1('0xcb')]+=_0x696125;this[_0xedb1('0xcd')](_0x2535e1['id'],_0x696125,_0x2535e1['dialOrderByScheduledAt'],_0x2535e1)['then'](function(_0x4307d4){_0x2535e1[_0xedb1('0xcb')]-=_0x696125;_0x2535e1['temp']=_0x2535e1[_0xedb1('0xcb')]>0x0?_0x2535e1[_0xedb1('0xcb')]:0x0;if(!checkContactEmpty(_0x4307d4)){_0x2535e1[_0xedb1('0x3a')]=_0xedb1('0xa1');logger['info'](_0xedb1('0x20b')+_0x2535e1[_0xedb1('0x3e')]);}else{_0x2535e1[_0xedb1('0x73')]+=_0x4307d4[_0xedb1('0x9b')];_0x2535e1[_0xedb1('0x3a')]='RUNNING';for(var _0x38e755=0x0;_0x38e755<_0x4307d4[_0xedb1('0x9b')];_0x38e755+=0x1){_0x2535e1['ivrTotalCallsDays']+=0x1;if(_[_0xedb1('0xb1')](_0x4307d4[_0x38e755])||_['isNil'](_0x4307d4[_0x38e755]['Contact'])||_['isNil'](_0x4307d4[_0x38e755][_0xedb1('0x171')])){_0x35810e['emptyContact'](_0xedb1('0x20c'),_0x2535e1,_0x4307d4[_0x38e755]);}else{_0x35810e[_0xedb1('0xc1')](_[_0xedb1('0xd7')](_0x4307d4[_0x38e755],[_0xedb1('0xdb'),_0xedb1('0x20d')]))[_0xedb1('0xb9')](_0x35810e[_0xedb1('0x1f4')](_0x2535e1,_0x4307d4[_0x38e755]))[_0xedb1('0xbe')](_0x35810e[_0xedb1('0xd5')](_0xedb1('0x20e'),_0x2535e1));}}}})['catch'](loggerGetContactDialer(_0xedb1('0x20f'),_0x2535e1,_0x696125));}};Dialer[_0xedb1('0x1b')][_0xedb1('0x15c')]=function(_0x37d53f,_0x53ab92){var _0x49855b=this;var _0x8a32f3=[];var _0x151185=_0x53ab92>=0x1?_0x53ab92:0x1;if(_0x37d53f[_0xedb1('0x5a')]===_0xedb1('0xb')){_0x151185=0x1;}var _0x7a9667=Math[_0xedb1('0x1d5')](_0x37d53f[_0xedb1('0x4f')]*_0x151185)-_0x37d53f[_0xedb1('0x73')]-_0x37d53f[_0xedb1('0xcb')];emitVoiceQueueSummary(_0x37d53f);if(_0x37d53f[_0xedb1('0x210')]>0x0){var _0x36d186=_0x37d53f[_0xedb1('0x210')]-_0x37d53f[_0xedb1('0x73')]-_0x37d53f['talking']-_0x37d53f['temp']-_0x37d53f[_0xedb1('0x51')];if(_0x7a9667>_0x36d186){_0x7a9667=_0x36d186;}}if(_0x7a9667>0x0){if(_0x37d53f[_0xedb1('0x5a')]===_0xedb1('0xb')){_0x7a9667=0x1;}if(_0x7a9667>this[_0xedb1('0x20a')]){_0x7a9667=this[_0xedb1('0x20a')];}_0x37d53f[_0xedb1('0xcb')]+=_0x7a9667;for(var _0x2ab809 in this['agents']){if(typeof this['agents'][_0x2ab809]!==_0xedb1('0x9c')){if(this[_0xedb1('0x21')][_0x2ab809]['state']===_0xedb1('0x211')&&this['agents'][_0x2ab809][_0xedb1('0xb2')]===_0xedb1('0xdf')){_0x8a32f3[_0xedb1('0x12c')](this[_0xedb1('0x21')][_0x2ab809]['id']);}}}this[_0xedb1('0xca')](_0x37d53f['id'],_0x8a32f3,_0x7a9667,_0x37d53f['dialOrderByScheduledAt'],_0x37d53f)[_0xedb1('0xb9')](function(_0x219d37){_0x37d53f[_0xedb1('0xcb')]-=_0x7a9667;_0x37d53f[_0xedb1('0xcb')]=_0x37d53f['temp']>0x0?_0x37d53f[_0xedb1('0xcb')]:0x0;if(!checkContactEmpty(_0x219d37)){_0x49855b[_0xedb1('0xb8')](_0x37d53f)[_0xedb1('0xb9')](sendMessageReschedule(_0x37d53f))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x212')));}else{_0x37d53f[_0xedb1('0x73')]+=_0x219d37['length'];_0x37d53f['message']=_0x37d53f[_0xedb1('0x5a')]===_0xedb1('0xb')?_0xedb1('0x17b'):'RUNNING';for(var _0x565d8b=0x0;_0x565d8b<_0x219d37[_0xedb1('0x9b')];_0x565d8b+=0x1){if(_[_0xedb1('0xb1')](_0x219d37[_0x565d8b])||_['isNil'](_0x219d37[_0x565d8b][_0xedb1('0x18b')])||_[_0xedb1('0xb1')](_0x219d37[_0x565d8b][_0xedb1('0x171')])){_0x49855b[_0xedb1('0xd6')](_0xedb1('0x20c'),_0x37d53f,_0x219d37[_0x565d8b]);}else{_0x49855b[_0xedb1('0xba')](_[_0xedb1('0xd7')](_0x219d37[_0x565d8b],[_0xedb1('0xda'),_0xedb1('0x20d')]))[_0xedb1('0xb9')](_0x49855b[_0xedb1('0x1f4')](_0x37d53f,_0x219d37[_0x565d8b]))['catch'](_0x49855b[_0xedb1('0xd5')]('[actionOriginate]\x20',_0x37d53f));}}}})[_0xedb1('0xbe')](loggerGetContactDialer(_0xedb1('0x213'),_0x37d53f,_0x7a9667));}};Dialer[_0xedb1('0x1b')][_0xedb1('0x92')]=function(_0x5a3fd0){if(_0x5a3fd0['dialLimitQueue']>0x0){var _0x48076d=_0x5a3fd0[_0xedb1('0x210')]-_0x5a3fd0['originated']-_0x5a3fd0[_0xedb1('0x54')];if(_0x48076d>0x0){this[_0xedb1('0x214')](_0x5a3fd0);}else{loggerPredictiveCalls[_0xedb1('0x7e')](_0xedb1('0x215'));}}else{this[_0xedb1('0x214')](_0x5a3fd0);}};Dialer[_0xedb1('0x1b')][_0xedb1('0x214')]=function(_0x42e96a){var _0x5aa668=this;var _0x352e84=[];_0x42e96a[_0xedb1('0x73')]+=0x1;for(var _0x3c9686 in this[_0xedb1('0x21')]){if(typeof this[_0xedb1('0x21')][_0x3c9686]!==_0xedb1('0x9c')){if(this['agents'][_0x3c9686][_0xedb1('0xa9')]==='not_inuse'&&this[_0xedb1('0x21')][_0x3c9686][_0xedb1('0xb2')]===_0xedb1('0xdf')){_0x352e84['push'](this[_0xedb1('0x21')][_0x3c9686]['id']);}}}this[_0xedb1('0xca')](_0x42e96a['id'],_0x352e84,0x1,_0x42e96a[_0xedb1('0x216')],_0x42e96a)[_0xedb1('0xb9')](function(_0x199162){if(!checkContactEmpty(_0x199162)){checkContactLowerLimitOriginate(_0x42e96a,0x1,0x0);_0x5aa668[_0xedb1('0xb8')](_0x42e96a)['then'](sendMessageReschedule(_0x42e96a))[_0xedb1('0xbe')](loggerCatch(_0xedb1('0x212')));}else{_0x42e96a[_0xedb1('0x3a')]=_0xedb1('0x217');if(_[_0xedb1('0xb1')](_0x199162[0x0])||_[_0xedb1('0xb1')](_0x199162[0x0][_0xedb1('0x18b')])||_[_0xedb1('0xb1')](_0x199162[0x0]['phone'])){_0x5aa668['emptyContact'](_0xedb1('0x20c'),_0x42e96a,_0x199162[0x0]);}else{_0x5aa668[_0xedb1('0xba')](_[_0xedb1('0xd7')](_0x199162[0x0],[_0xedb1('0xda'),'Contact.phone']))['then'](_0x5aa668[_0xedb1('0x1f4')](_0x42e96a,_0x199162[0x0]))[_0xedb1('0xbe')](_0x5aa668['loggerHandler'](_0xedb1('0x218'),_0x42e96a));}}})[_0xedb1('0xbe')](loggerGetContactDialer(_0xedb1('0x219'),_0x42e96a,0x1));emitVoiceQueueSummary(_0x42e96a);};Dialer[_0xedb1('0x1b')][_0xedb1('0x1ea')]=function(_0x42a4d3,_0x4b4f40,_0x50172a,_0x51e1fa,_0x229c6c,_0x30404b){loggerPredictive['info'](_0xedb1('0x21a'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42a4d3);loggerPredictive[_0xedb1('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b4f40);loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x21b'),_0x50172a);loggerPredictive[_0xedb1('0x7e')]('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',_0x51e1fa);loggerPredictive[_0xedb1('0x7e')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x229c6c);loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x85'));return new BPromise(function(_0x4173e6,_0x35717d){if(_0x42a4d3<=0x0||isNaN(_0x42a4d3)){return _0x35717d(msgResponse(_0xedb1('0x21c'),_0xedb1('0x45'),_0xedb1('0x21d')+_0x42a4d3));}if(_0x50172a<=0x0||isNaN(_0x50172a)){return _0x35717d(msgResponse(_0xedb1('0x21c'),_0xedb1('0x45'),_0xedb1('0x21e')+_0x50172a));}if(_0x51e1fa<=0x0||isNaN(_0x51e1fa)){return _0x35717d(msgResponse(_0xedb1('0x21c'),_0xedb1('0x45'),_0xedb1('0x21f')+_0x51e1fa));}if(_0x4b4f40<=0x0||isNaN(_0x4b4f40)){return _0x35717d(msgResponse(_0xedb1('0x21c'),_0xedb1('0x45'),_0xedb1('0x220')+_0x4b4f40));}if(_0x229c6c<=0x0||isNaN(_0x229c6c)){return _0x35717d(msgResponse('[abandonmentRate]',_0xedb1('0x45'),'Amax\x20=\x20'+_0x229c6c));}_0x30404b=_0x30404b||0x0;var _0x5d39fd=0x1/_0x50172a;var _0x5554d5=0x0;var _0x2499f1=0x0;var _0x28c405=0x0;var _0x10b77c=0x0;for(var _0xb8975c=0x0;_0x28c405<_0x229c6c;_0xb8975c+=0x1){_0x2499f1=_0xb8975c/_0x4b4f40;_0x5554d5=(_0x51e1fa*_0x2499f1+_0x30404b)/_0x5d39fd;_0x28c405=erlangb(_0x5554d5,_0x42a4d3);_0x10b77c=_0x5554d5/_0x42a4d3*(0x1-erlangb(_0x5554d5,_0x42a4d3));}return _0x4173e6({'erlangCalls':_0xb8975c,'erlangCallToSecond':_0x4b4f40/_0xb8975c,'erlangAbandonmentRate':_0x28c405,'erlangBusyFactor':_0x10b77c});});};Dialer[_0xedb1('0x1b')][_0xedb1('0x1ec')]=function(_0x4cc5f9,_0x448539,_0x1299b8,_0x36b9c2,_0x15414f,_0xed2cc6){loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x221'));loggerPredictive['info'](_0xedb1('0x222'),_0x4cc5f9);loggerPredictive['info'](_0xedb1('0x223'),_0x448539);loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x21b'),_0x1299b8);loggerPredictive['info'](_0xedb1('0x224'),_0x36b9c2);loggerPredictive[_0xedb1('0x7e')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x15414f);loggerPredictive[_0xedb1('0x7e')](_0xedb1('0x85'));return new BPromise(function(_0x4ec5ef,_0x1b310d){if(_0x4cc5f9<=0x0||isNaN(_0x4cc5f9)){return _0x1b310d(msgResponse(_0xedb1('0x225'),_0xedb1('0x45'),_0xedb1('0x21d')+_0x4cc5f9));}if(_0x1299b8<=0x0||isNaN(_0x1299b8)){return _0x1b310d(msgResponse(_0xedb1('0x225'),_0xedb1('0x45'),_0xedb1('0x21e')+_0x1299b8));}if(_0x36b9c2<=0x0||isNaN(_0x36b9c2)){return _0x1b310d(msgResponse(_0xedb1('0x225'),_0xedb1('0x45'),_0xedb1('0x21f')+_0x36b9c2));}if(_0x448539<=0x0||isNaN(_0x448539)){return _0x1b310d(msgResponse(_0xedb1('0x225'),'Error',_0xedb1('0x220')+_0x448539));}if(_0x15414f<=0x0||isNaN(_0x15414f)){return _0x1b310d(msgResponse('[busyFactor]',_0xedb1('0x45'),'Umin\x20=\x20'+_0x15414f));}_0xed2cc6=_0xed2cc6||0x0;var _0x418670=0x1/_0x1299b8;var _0x4866e6=0x0;var _0x1b122e=0x0;var _0x35e64c=0x0;var _0x44cf78=0x0;for(var _0x2e67df=0x0;_0x44cf78<_0x15414f;_0x2e67df+=0x1){_0x1b122e=_0x2e67df/_0x448539;_0x4866e6=(_0x36b9c2*_0x1b122e+_0xed2cc6)/_0x418670;_0x35e64c=erlangb(_0x4866e6,_0x4cc5f9);_0x44cf78=_0x4866e6/_0x4cc5f9*(0x1-erlangb(_0x4866e6,_0x4cc5f9));}return _0x4ec5ef({'erlangCalls':_0x2e67df,'erlangCallToSecond':_0x448539/_0x2e67df,'erlangAbandonmentRate':_0x35e64c,'erlangBusyFactor':_0x44cf78});});};module[_0xedb1('0x226')]=Dialer; \ No newline at end of file +var _0x3e4a=['[ifTime][Action]','stringify','diff','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','milliseconds','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','sequence','Action','channel','No\x20such\x20channel','voiceQueues','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','status','reachable','SIP/%s','unmonitored','createHistory','syncVarSet','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','value','state','HangupInAMD','membername','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','AMD','countmachineretry','countglobal','emit','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','dialAMDActive','[syncHangupInAMDIvr]','Machine','countnoanswerretry','countdropretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','agiafterat','dialDropRetryFrequency','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','additional','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','idHopper','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','replace','match','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','Contact','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','Error','getQueue','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[getDataPredictive]','check\x20failure','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','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','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','./action','./final','./agentComplete','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty'];(function(_0xb74e2c,_0x3c35fc){var _0x345b5b=function(_0x5131c9){while(--_0x5131c9){_0xb74e2c['push'](_0xb74e2c['shift']());}};_0x345b5b(++_0x3c35fc);}(_0x3e4a,0x1e4));var _0xa3e4=function(_0x31b957,_0x5ecacc){_0x31b957=_0x31b957-0x0;var _0x44223f=_0x3e4a[_0x31b957];return _0x44223f;};'use strict';var util=require(_0xa3e4('0x0'));var _=require('lodash');var BPromise=require(_0xa3e4('0x1'));var uuid=require(_0xa3e4('0x2'));var moment=require(_0xa3e4('0x3'));var rr=require('rr');var md5=require(_0xa3e4('0x4'));var Redis=require(_0xa3e4('0x5'));var ut=require(_0xa3e4('0x6'));var config=require('../../../config/environment/');var logger=require(_0xa3e4('0x7'))(_0xa3e4('0x8'));var loggerBooked=require(_0xa3e4('0x7'))(_0xa3e4('0x9'));var loggerPredictive=require(_0xa3e4('0x7'))(_0xa3e4('0xa'));var loggerPredictiveCalls=require(_0xa3e4('0x7'))(_0xa3e4('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xa3e4('0xc'));var ami=require(_0xa3e4('0xd'));config[_0xa3e4('0xe')]=_[_0xa3e4('0xf')](config[_0xa3e4('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0xa3e4('0x10'))(new Redis(config[_0xa3e4('0xe')]));var cmHopper=require(_0xa3e4('0x11'));var cmHopperHistory=require(_0xa3e4('0x12'));var cmHopperFinal=require(_0xa3e4('0x13'));var cmHopperAdditionalPhone=require(_0xa3e4('0x14'));var cmHopperBlack=require(_0xa3e4('0x15'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xa3e4('0x16'));var History=require('./history');var Final=require(_0xa3e4('0x17'));var AgentComplete=require(_0xa3e4('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xa3e4('0x19'));var ipAgi=process['env'][_0xa3e4('0x1a')]||_0xa3e4('0x1b');var strategy={'rrmemory':_0xa3e4('0x1c'),'roundrobin':_0xa3e4('0x1d')};var Sequence=function(){};Sequence[_0xa3e4('0x1e')][_0xa3e4('0x1f')]=function(_0xe03cfd){this[_0xa3e4('0x20')]=this[_0xa3e4('0x20')]?this['tail'][_0xa3e4('0x21')](_0xe03cfd):_0xe03cfd();};function Dialer(_0x511056,_0x1aec57){this['sequence']=new Sequence();this[_0xa3e4('0x22')]=_0x1aec57;this['voiceQueues']=_0x511056['voiceQueues'];this[_0xa3e4('0x23')]=_0x511056[_0xa3e4('0x23')];this['agents']=_0x511056[_0xa3e4('0x24')];this[_0xa3e4('0x25')]=_0x511056['trunks'];this[_0xa3e4('0x26')]=config[_0xa3e4('0x26')]||0x2;this[_0xa3e4('0x27')]={};this[_0xa3e4('0x28')]={};this['contactsId']={};this[_0xa3e4('0x29')]={};this[_0xa3e4('0x2a')]={};this[_0xa3e4('0x2b')]={};this[_0xa3e4('0x2c')]={};this[_0xa3e4('0x2d')]={};this[_0xa3e4('0x2e')]={};this['queueBookedRR']={};ami['on']('agentconnect',this['syncAgentConnect'][_0xa3e4('0x2f')](this));ami['on'](_0xa3e4('0x30'),this[_0xa3e4('0x31')][_0xa3e4('0x2f')](this));ami['on'](_0xa3e4('0x32'),this[_0xa3e4('0x33')][_0xa3e4('0x2f')](this));ami['on'](_0xa3e4('0x34'),this[_0xa3e4('0x35')][_0xa3e4('0x2f')](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0xa3e4('0x36'),this[_0xa3e4('0x37')][_0xa3e4('0x2f')](this));ami['on'](_0xa3e4('0x38'),this[_0xa3e4('0x39')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0xa3e4('0x2f')](this));ami['on']('queuemember',this[_0xa3e4('0x3a')][_0xa3e4('0x2f')](this));ami['on']('queuestatuscomplete',this[_0xa3e4('0x3b')][_0xa3e4('0x2f')](this));this[_0xa3e4('0x3c')]();this[_0xa3e4('0x3d')]();}function isNotNull(_0x114197){return _0x114197!==null&&!_[_0xa3e4('0x3e')](_0x114197);}function checkIsLoggedIn(_0x219737,_0x55eac0){return function(){if(_0x55eac0<=0x0){_0x219737[_0xa3e4('0x3f')]=_0xa3e4('0x40');throw _0x219737[_0xa3e4('0x41')]+_0xa3e4('0x42');}};}function isActive(_0x123ec8){return _0x123ec8;}function checkIsActive(_0x5eb7bb,_0x3234d7){return function(){if(!isActive(_0x3234d7)){_0x5eb7bb[_0xa3e4('0x3f')]=_0xa3e4('0x43');throw _0x5eb7bb[_0xa3e4('0x41')]+_0xa3e4('0x44');}};}function checkInterval(_0x3c1b45){return function(){if(!isNotNull(_0x3c1b45[_0xa3e4('0x45')])){_0x3c1b45[_0xa3e4('0x3f')]='INTERVAL_IS_NULL';throw _0x3c1b45[_0xa3e4('0x41')]+_0xa3e4('0x46');}if(!isNotNull(_0x3c1b45[_0xa3e4('0x45')][_0xa3e4('0x47')])){_0x3c1b45[_0xa3e4('0x3f')]=_0xa3e4('0x48');throw _0x3c1b45[_0xa3e4('0x41')]+_0xa3e4('0x46');}if(!isNotNull(_[_0xa3e4('0x49')](_0x3c1b45[_0xa3e4('0x45')][_0xa3e4('0x47')]))){_0x3c1b45[_0xa3e4('0x3f')]=_0xa3e4('0x48');throw _0x3c1b45[_0xa3e4('0x41')]+_0xa3e4('0x46');}};}function msgResponse(_0xd3489a,_0x16540c,_0x4fc571){return{'action':_0xd3489a,'response':_0x16540c,'message':_0x4fc571,'stack':_0x4fc571};}function myreject(_0x389843){return function(_0x4ef3a9){return _0x389843(msgResponse(_0xa3e4('0x4a'),'Error',JSON[_0xa3e4('0x4b')](_0x4ef3a9)));};}function getSeconds(_0x454ba6,_0x4b79b8){var _0x699db4=moment(_0x454ba6)['milliseconds'](0x0);var _0x4982d7=moment(_0x4b79b8)['milliseconds'](0x0);return _0x699db4[_0xa3e4('0x4c')](_0x4982d7,'seconds');}function emit(_0x4f7317,_0x582ec0,_0x24d3d2){io['to'](_0x4f7317)['emit'](_0x582ec0,_0x24d3d2);}function emitVoiceQueueSummary(_0x65928b){if(_0x65928b[_0xa3e4('0x4d')]===_0xa3e4('0x4e')){var _0x3a3aa0={'id':_0x65928b['id'],'name':_0x65928b[_0xa3e4('0x41')],'strategy':_0x65928b[_0xa3e4('0x4f')],'answered':_0x65928b['answered'],'available':_0x65928b[_0xa3e4('0x50')],'loggedIn':_0x65928b[_0xa3e4('0x51')],'pTalking':_0x65928b[_0xa3e4('0x52')],'sumBillable':_0x65928b[_0xa3e4('0x53')],'sumDuration':_0x65928b[_0xa3e4('0x54')],'sumHoldTime':_0x65928b[_0xa3e4('0x55')]||0x0,'talking':_0x65928b[_0xa3e4('0x56')],'total':_0x65928b[_0xa3e4('0x57')],'type':_0x65928b[_0xa3e4('0x4d')],'unmanaged':_0x65928b[_0xa3e4('0x58')],'abandoned':_0x65928b[_0xa3e4('0x59')],'waiting':_0x65928b[_0xa3e4('0x5a')],'loggedInDb':_0x65928b[_0xa3e4('0x5b')],'dialActive':_0x65928b[_0xa3e4('0x5c')],'dialMethod':_0x65928b[_0xa3e4('0x5d')],'dialOriginateCallerIdName':_0x65928b[_0xa3e4('0x5e')],'dialOriginateCallerIdNumber':_0x65928b[_0xa3e4('0x5f')],'dialOriginateTimeout':_0x65928b[_0xa3e4('0x60')],'dialPrefix':_0x65928b[_0xa3e4('0x61')],'outboundAnswerAgiCallsDay':_0x65928b[_0xa3e4('0x62')],'outboundAnswerCallsDay':_0x65928b[_0xa3e4('0x63')],'outboundBlacklistCallsDay':_0x65928b[_0xa3e4('0x64')],'outboundBusyCallsDay':_0x65928b[_0xa3e4('0x65')],'outboundCongestionCallsDay':_0x65928b[_0xa3e4('0x66')],'outboundDropCallsDayACS':_0x65928b[_0xa3e4('0x67')],'outboundDropCallsDayCallersExit':_0x65928b[_0xa3e4('0x68')],'outboundDropCallsDayTimeout':_0x65928b['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x65928b[_0xa3e4('0x69')],'outboundNoSuchCallsDay':_0x65928b[_0xa3e4('0x6a')],'outboundOriginateFailureCallsDay':_0x65928b[_0xa3e4('0x6b')],'outboundReCallsDay':_0x65928b['outboundReCallsDay'],'outboundRejectCallsDay':_0x65928b['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x65928b[_0xa3e4('0x6c')],'predictiveIntervalAnsweredCalls':_0x65928b[_0xa3e4('0x6d')],'predictiveIntervalAvgHoldtime':_0x65928b[_0xa3e4('0x6e')],'predictiveIntervalAvgTalktime':_0x65928b[_0xa3e4('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x65928b[_0xa3e4('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x65928b[_0xa3e4('0x71')],'predictiveIntervalErlangCalls':_0x65928b[_0xa3e4('0x72')],'predictiveIntervalErlangCallsDroppedCalls':_0x65928b['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x65928b[_0xa3e4('0x73')],'predictiveIntervalMultiplicativeFactor':_0x65928b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x65928b[_0xa3e4('0x74')],'predictiveIntervalAvailable':_0x65928b[_0xa3e4('0x75')],'predictiveIntervalTotalCalls':_0x65928b[_0xa3e4('0x76')],'message':_0x65928b[_0xa3e4('0x3f')],'originated':_0x65928b['originated'],'erlangCalls':_0x65928b[_0xa3e4('0x77')],'erlangCallToSecond':_0x65928b['erlangCallToSecond'],'erlangAbandonmentRate':_0x65928b[_0xa3e4('0x78')],'erlangBusyFactor':_0x65928b[_0xa3e4('0x79')],'startPredictive':_0x65928b['startPredictive'],'startProgressive':_0x65928b[_0xa3e4('0x2c')]};if(_0x65928b[_0xa3e4('0x7a')]){_0x3a3aa0['Trunk']={'id':_0x65928b[_0xa3e4('0x7a')]['id'],'name':_0x65928b[_0xa3e4('0x7a')][_0xa3e4('0x41')],'active':_0x65928b['Trunk'][_0xa3e4('0x7b')],'callerid':_0x65928b[_0xa3e4('0x7a')][_0xa3e4('0x7c')]};}if(_0x65928b[_0xa3e4('0x45')]){_0x3a3aa0[_0xa3e4('0x45')]={'id':_0x65928b[_0xa3e4('0x45')]['id'],'name':_0x65928b[_0xa3e4('0x45')][_0xa3e4('0x41')]};}var _0x7a2913=md5(JSON[_0xa3e4('0x4b')](_0x3a3aa0));if(_0x65928b[_0xa3e4('0x4')]!==_0x7a2913){_0x65928b[_0xa3e4('0x4')]=_0x7a2913;emit(util[_0xa3e4('0x7d')](_0xa3e4('0x7e'),_0x3a3aa0[_0xa3e4('0x41')]),_0xa3e4('0x7f'),_0x3a3aa0);}}}function emitCampaignSummary(_0x3460f8){if(_0x3460f8[_0xa3e4('0x4d')]===_0xa3e4('0x80')){emit(util[_0xa3e4('0x7d')](_0xa3e4('0x81'),_0x3460f8['name']),_0xa3e4('0x82'),_0x3460f8);}}function checkGetDataPredictive(_0x4cb910){if(isNotNull(_0x4cb910)&&!_[_0xa3e4('0x49')](_0x4cb910)){loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x84'));loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x85'),_0x4cb910[_0xa3e4('0x76')]);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x86'),_0x4cb910[_0xa3e4('0x6d')]);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x87'),_0x4cb910[_0xa3e4('0x71')]);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x88'),_0x4cb910[_0xa3e4('0x70')]);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x89'),_0x4cb910['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x8a'),_0x4cb910[_0xa3e4('0x6f')]);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x8b'));if(_0x4cb910[_0xa3e4('0x76')]>0x0){if(!_[_0xa3e4('0x3e')](_0x4cb910[_0xa3e4('0x6f')])&&_0x4cb910['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xa3e4('0x8c'));if(!_[_0xa3e4('0x3e')](_0x4cb910[_0xa3e4('0x6e')])&&_0x4cb910[_0xa3e4('0x6e')]>0x0){return!![];}loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x8d'));}else{loggerPredictive['info'](_0xa3e4('0x8e'));}}else{loggerPredictive['info'](_0xa3e4('0x8f'));}return![];}function mergeDataErlangB(_0x38cbfe){return function(_0xcb56b7){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x90'),_0xcb56b7[_0xa3e4('0x77')]);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x91'),_0xcb56b7[_0xa3e4('0x92')]);loggerPredictive['info'](_0xa3e4('0x93'),_0xcb56b7[_0xa3e4('0x78')]);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x94'),_0xcb56b7['erlangBusyFactor']);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x93'),_0xcb56b7[_0xa3e4('0x78')]);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x8b'));_[_0xa3e4('0x95')](_0x38cbfe,_0xcb56b7);};}function getDiff(_0x312b4c){var _0x8da57=moment()[_0xa3e4('0x96')](0x0);var _0x38aaee=moment(_0x312b4c)[_0xa3e4('0x96')](0x0);return _0x8da57['diff'](_0x38aaee,_0xa3e4('0x97'));}function ifInterval(_0x3d1c55,_0x5d8f42){if(_[_0xa3e4('0x3e')](_0x5d8f42)){return![];}return getDiff(_0x5d8f42)<_0x3d1c55*0x3c;}function freeVariablesPredictive(_0x5555f4){if(isNotNull(_0x5555f4)){if(!_['isUndefined'](_0x5555f4[_0xa3e4('0x2c')])){_0x5555f4['startProgressive']=undefined;loggerPredictive['info'](_0x5555f4[_0xa3e4('0x41')],_0xa3e4('0x98'));}if(!_['isUndefined'](_0x5555f4[_0xa3e4('0x2b')])){_0x5555f4[_0xa3e4('0x2b')]=undefined;loggerPredictive[_0xa3e4('0x83')](_0x5555f4['name'],_0xa3e4('0x99'));}if(!_[_0xa3e4('0x3e')](_0x5555f4[_0xa3e4('0x9a')])){clearInterval(_0x5555f4[_0xa3e4('0x9a')]);_0x5555f4[_0xa3e4('0x9a')]=undefined;loggerPredictive[_0xa3e4('0x83')](_0x5555f4[_0xa3e4('0x41')],_0xa3e4('0x9b'));}}}function erlangb(_0x4c2ddc,_0x2e7cb0){if(_0x2e7cb0===0x0){return 0x0;}var _0x36500e=0x1;for(var _0x46dc06=0x1;_0x46dc06<=_0x2e7cb0;_0x46dc06+=0x1){_0x36500e=0x1+_0x36500e*_0x46dc06/_0x4c2ddc;}return 0x1/_0x36500e;}function isVoiceQueueOutbound(_0xf3da38){return _0xf3da38===_0xa3e4('0x4e');}function isNotPreview(_0x48442e){return _0x48442e!==_0xa3e4('0x22');}function isCampaignIvr(_0x14f41d){return _0x14f41d===_0xa3e4('0x80');}function getCallerId(_0x5a3178,_0x400db7,_0x3f4549){if(!_['isUndefined'](_0x3f4549)&&typeof _0x3f4549===_0xa3e4('0x9c')&&!_[_0xa3e4('0x49')](_0x3f4549)){if(!_[_0xa3e4('0x3e')](_0x400db7)&&typeof _0x400db7===_0xa3e4('0x9c')&&!_['isEmpty'](_0x400db7)){return util['format']('\x22%s\x22\x20<%s>',_0x400db7,_0x3f4549);}return util[_0xa3e4('0x7d')](_0xa3e4('0x9d'),_0x3f4549,_0x3f4549);}if(!_[_0xa3e4('0x3e')](_0x5a3178)&&typeof _0x5a3178===_0xa3e4('0x9c')&&!_['isEmpty'](_0x5a3178)){return _0x5a3178;}return _0xa3e4('0x9e');}function loggerCatchQueueSummary(_0x351bc8,_0x1fc563){return function(_0x4ddc24){freeVariablesPredictive(_0x1fc563);emitVoiceQueueSummary(_0x1fc563);emitCampaignSummary(_0x1fc563);loggerSyncQueueSummary['error'](_0x351bc8,util[_0xa3e4('0x9f')](_0x4ddc24,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1452a1,_0x33f617){return function(_0x1630dc){loggerPredictive[_0xa3e4('0xa0')](_0x33f617['name'],_0x1452a1);loggerPredictive[_0xa3e4('0xa0')](_0x1630dc[_0xa3e4('0xa1')]);freeVariablesPredictive(_0x33f617);};}function loggerCatch(_0x40286f){return function(_0xaeb2f1){logger[_0xa3e4('0xa0')](_0x40286f,util['inspect'](_0xaeb2f1,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x416116){return _0x416116&&!_[_0xa3e4('0x3e')](_0x416116)&&_0x416116[_0xa3e4('0xa2')]>0x0;}function decremetOriginate(_0x1b1269){if(!_['isUndefined'](_0x1b1269)&&_0x1b1269!==null){if(typeof _0x1b1269[_0xa3e4('0xa3')]!==_0xa3e4('0xa4')){if(_0x1b1269[_0xa3e4('0xa3')]>0x0){_0x1b1269[_0xa3e4('0xa3')]-=0x1;}else{logger[_0xa3e4('0xa0')](_0xa3e4('0xa5'));}}}else{logger[_0xa3e4('0xa0')](_0xa3e4('0xa6'));}}function checkContactLowerLimitOriginate(_0xcf32cd,_0x4a2e7d,_0x1d3604){if(_0x4a2e7d>_0x1d3604){for(var _0x5b2e15=0x0;_0x5b2e15<_0x4a2e7d-_0x1d3604;_0x5b2e15+=0x1){decremetOriginate(_0xcf32cd);}}}function loggerGetContactDialer(_0x1a8768,_0x2ded83,_0x226e03){return function(_0x4fe626){checkContactLowerLimitOriginate(_0x2ded83,_0x226e03,0x0);logger['error'](_0x1a8768,util[_0xa3e4('0x9f')](_0x4fe626,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x320243){return function(_0x5ae9de){if(isNotNull(_0x5ae9de)&&isNotNull(_0x5ae9de[0x0])){if(_0x5ae9de[0x0][_0xa3e4('0xa7')]>0x0){_0x320243[_0xa3e4('0x3f')]=_0xa3e4('0xa8');logger[_0xa3e4('0x83')](_0xa3e4('0xa9')+_0x320243['name'],_0x5ae9de[0x0][_0xa3e4('0xa7')],_0xa3e4('0xaa'));}else{_0x320243['message']=_0xa3e4('0xab');logger[_0xa3e4('0x83')](_0xa3e4('0xac')+_0x320243[_0xa3e4('0x41')]);}}};}function notSendMessagesQueue(_0x3787a3){if(_0x3787a3[_0xa3e4('0xad')]){freeVariablesPredictive(_0x3787a3);if(_0x3787a3[_0xa3e4('0xa3')]===0x0&&_0x3787a3[_0xa3e4('0x56')]===0x0&&_0x3787a3[_0xa3e4('0x5a')]===0x0&&(_0x3787a3[_0xa3e4('0x52')]||0x0)===0x0){_0x3787a3[_0xa3e4('0xad')]=![];_0x3787a3[_0xa3e4('0x50')]=0x0;_0x3787a3[_0xa3e4('0x3f')]=_0xa3e4('0x43');loggerSyncQueueSummary['error'](_0xa3e4('0xae'),_0x3787a3[_0xa3e4('0x41')],_0xa3e4('0xaf'));}else{_0x3787a3[_0xa3e4('0x3f')]=_0xa3e4('0xb0');loggerSyncQueueSummary[_0xa3e4('0xa0')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3787a3[_0xa3e4('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0x3787a3);}}function notSendMessagesCampaign(_0x2fab2f){if(_0x2fab2f['sendMessageOneNotActive']){if(_0x2fab2f[_0xa3e4('0xa3')]===0x0){_0x2fab2f[_0xa3e4('0xad')]=![];_0x2fab2f[_0xa3e4('0x3f')]=_0xa3e4('0x43');loggerSyncQueueSummary[_0xa3e4('0xa0')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2fab2f['name'],_0xa3e4('0xaf'));}else{_0x2fab2f[_0xa3e4('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xa3e4('0xa0')](_0xa3e4('0xb1'),_0x2fab2f[_0xa3e4('0x41')],_0xa3e4('0xb2'));}emitCampaignSummary(_0x2fab2f);}}function createObjHistory(_0x2df53d,_0x236164,_0xffd9a5,_0x31e014,_0xd28f36){_0x2df53d[_0xa3e4('0x3f')]=_0xffd9a5;var _0x60adf8=new Action(_0x2df53d,_0x236164);var _0x559867=new History(_0x60adf8);_0x559867['state']=_0x31e014;_0x559867[_0xa3e4('0xb3')]=_0xd28f36;_0x559867[_0xa3e4('0xb4')]=_0x60adf8[_0xa3e4('0xb5')];return _0x559867;}Dialer[_0xa3e4('0x1e')]['loopClearZombieChannels']=function(){var _0x39c035=this;setInterval(function(){_0x39c035['clearZombieChannels'](_0x39c035['uniqueId'],_0xa3e4('0xb6'));_0x39c035[_0xa3e4('0xb7')](_0x39c035['actions'],_0xa3e4('0xb8'));},0x32c8);};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xb7')]=function(_0x59abea,_0x13feb6){var _0x289aac=this;for(var _0x461afa in _0x59abea){if(typeof _0x59abea[_0x461afa]!==_0xa3e4('0xa4')){this[_0xa3e4('0xb9')][_0xa3e4('0x1f')](function(){if(!_['isNil'](_0x59abea[_0x461afa])){return ami[_0xa3e4('0xba')]({'action':'status','channel':_0x59abea[_0x461afa][_0xa3e4('0xbb')]})['catch'](function(_0x79d642){if(_0x79d642['message']===_0xa3e4('0xbc')){setTimeout(function(){if(_0x59abea[_0x461afa]&&_0x59abea[_0x461afa][_0xa3e4('0x4d')]!==_0xa3e4('0x80')){_0x289aac['updateOriginated'](_0x289aac[_0xa3e4('0xbd')][_0x59abea[_0x461afa][_0xa3e4('0xbe')]]);logger[_0xa3e4('0xa0')](_0xa3e4('0xbf'),_0x13feb6,_0x461afa,_0x59abea[_0x461afa]['queue']);delete _0x59abea[_0x461afa];}if(_0x59abea[_0x461afa]&&_0x59abea[_0x461afa][_0xa3e4('0x4d')]===_0xa3e4('0x80')){_0x289aac[_0xa3e4('0xc0')](_0x289aac[_0xa3e4('0x23')][_0x59abea[_0x461afa][_0xa3e4('0xbe')]]);logger[_0xa3e4('0xa0')](_0xa3e4('0xc1'),_0x13feb6,_0x461afa,_0x59abea[_0x461afa]['queue']);delete _0x59abea[_0x461afa];}},0x2328);}});}});}}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xc2')]=function(_0x2509e3){return BPromise['resolve']()[_0xa3e4('0xc3')](cmHopper['countReScheduled'](_0x2509e3))[_0xa3e4('0xc4')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype']['checkIsBlackList']=function(_0x23d27f){return BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](cmHopperBlack[_0xa3e4('0xc6')](_0x23d27f))['catch'](loggerCatch(_0xa3e4('0xc7')));};Dialer['prototype'][_0xa3e4('0xc8')]=function(_0x33fee3,_0x415d9a,_0x5a8e2e){return BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x33fee3,_0x415d9a,_0x5a8e2e))['catch'](loggerCatch(_0xa3e4('0xc9')));};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xca')]=function(_0x3cb819,_0x39a379,_0x5d510e){return BPromise[_0xa3e4('0xc5')]()['then'](cmHopperAdditionalPhone[_0xa3e4('0xca')](_0x3cb819,_0x39a379,_0x5d510e))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0xcb')));};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xcc')]=function(_0x2f2370){return BPromise['resolve']()[_0xa3e4('0xc3')](cmHopperBlack[_0xa3e4('0xcc')](_0x2f2370))['catch'](loggerCatch(_0xa3e4('0xcd')));};Dialer['prototype']['averageHandleTime']=function(_0x2bd0a2){return BPromise[_0xa3e4('0xc5')]()['then'](cmHopperHistory[_0xa3e4('0xce')](_0x2bd0a2))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0xcf')));};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xd0')]=function(_0x3eba8d){return BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](cmHopper[_0xa3e4('0xd0')](_0x3eba8d))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0xd1')));};Dialer['prototype']['unlockContact']=function(_0x441b56,_0xf71da3,_0x134bc3){return BPromise['resolve']()[_0xa3e4('0xc3')](cmHopper[_0xa3e4('0xd2')](_0x441b56,_0xf71da3,_0x134bc3))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0xd3')));};Dialer['prototype'][_0xa3e4('0xd4')]=function(_0x57ea29,_0x60f1c3,_0x11f04d,_0x3f96ac,_0x100fd1){return BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](cmHopper['getContactDialer'](_0x57ea29,_0x60f1c3,_0x11f04d,_0x3f96ac))[_0xa3e4('0xc4')](function(_0x41807e){_0x100fd1[_0xa3e4('0xd5')]-=_0x11f04d;_0x100fd1[_0xa3e4('0xd5')]=_0x100fd1[_0xa3e4('0xd5')]>0x0?_0x100fd1[_0xa3e4('0xd5')]:0x0;loggerCatch(_0xa3e4('0xd6'))(_0x41807e);});};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xd7')]=function(_0x3e524e,_0x27cb67,_0x1d4910,_0x5730d5){return BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](cmHopper[_0xa3e4('0xd7')](_0x3e524e,_0x27cb67,_0x1d4910))['catch'](function(_0x26e429){_0x5730d5['temp']-=_0x27cb67;_0x5730d5['temp']=_0x5730d5[_0xa3e4('0xd5')]>0x0?_0x5730d5['temp']:0x0;loggerCatch(_0xa3e4('0xd8'))(_0x26e429);});};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xd9')]=function(_0x133b8f){return BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](voiceQueueRt[_0xa3e4('0xd9')](_0x133b8f))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0xda')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x94314d){return BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](cmHopper[_0xa3e4('0xdb')](_0x94314d))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0xdc')));};Dialer[_0xa3e4('0x1e')]['createHistory']=function(_0x570b3b){return BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](cmHopperHistory['createHistory'](_0x570b3b))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0xdd')));};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xc0')]=function(_0x4fd8bb){if(!_[_0xa3e4('0x3e')](_0x4fd8bb)&&_0x4fd8bb!==null){if(typeof _0x4fd8bb['originated']!==_0xa3e4('0xa4')){if(_0x4fd8bb[_0xa3e4('0xa3')]>0x0){_0x4fd8bb[_0xa3e4('0xa3')]-=0x1;}else{logger[_0xa3e4('0xa0')](_0xa3e4('0xde'));}}}else{logger[_0xa3e4('0xa0')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xdf')]=function(_0x2b01a4,_0x3c2af5){var _0x4da21d=this;return function(_0xee07f4){_0x4da21d[_0xa3e4('0xc0')](_0x3c2af5);logger[_0xa3e4('0xa0')](_0x2b01a4,util[_0xa3e4('0x9f')](_0xee07f4,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xa3e4('0xe0')]=function(_0x23efd1,_0x58dd5c,_0x45ae0e){var _0x5db5b8={'state':0x19,'statedesc':_0xa3e4('0xe1')};this[_0xa3e4('0xc0')](_0x58dd5c);this[_0xa3e4('0xe2')](_[_0xa3e4('0x95')](_0x5db5b8,_[_0xa3e4('0xe3')](_0x45ae0e,[_0xa3e4('0xe4'),_0xa3e4('0xe5'),'UserId',_0xa3e4('0xe6'),_0xa3e4('0xe7')])),_0xa3e4('0xe8'),_0xa3e4('0xe9'));logger['error'](_0x23efd1);};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xea')]=function(_0x55bb7f){return _0x55bb7f==='Success';};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xeb')]=function(_0x3266c0){return!_[_0xa3e4('0x3e')](_0x3266c0)&&_0x3266c0&&!_['isUndefined'](_0x3266c0[_0xa3e4('0x41')])&&!_[_0xa3e4('0x3e')](_0x3266c0[_0xa3e4('0x7b')])&&_0x3266c0['active']&&(this[_0xa3e4('0x25')][util[_0xa3e4('0x7d')]('SIP/%s',_0x3266c0[_0xa3e4('0x41')])][_0xa3e4('0xec')]===_0xa3e4('0xed')||this[_0xa3e4('0x25')][util[_0xa3e4('0x7d')](_0xa3e4('0xee'),_0x3266c0['name'])][_0xa3e4('0xec')]===_0xa3e4('0xef'));};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xe2')]=function(_0x30d0bb,_0x5c986a,_0x3b5598){this[_0xa3e4('0xf0')](_0x30d0bb)[_0xa3e4('0xc4')](loggerCatch(_0x5c986a));this[_0xa3e4('0xdb')](_0x30d0bb)[_0xa3e4('0xc4')](loggerCatch(_0x3b5598));};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xf1')]=function(_0x1ab522){var _0x3f123d=this[_0xa3e4('0x29')][_0x1ab522[_0xa3e4('0xf2')]];var _0x5da4ad;if(!_['isNil'](_0x1ab522)&&!_[_0xa3e4('0xf3')](_0x1ab522['variable'])&&!_['isNil'](_0x1ab522[_0xa3e4('0xf4')][_0xa3e4('0xf5')])&&_0x1ab522[_0xa3e4('0xf6')]===_0xa3e4('0xf7')&&_0x3f123d){if(_0x3f123d[_0xa3e4('0x4d')]!==_0xa3e4('0x80')&&this[_0xa3e4('0xbd')][_0x3f123d['queue']]['dialAMDActive']&&_0x1ab522[_0xa3e4('0xf8')]==='HANGUP'){delete this[_0xa3e4('0x29')][_0x1ab522[_0xa3e4('0xf2')]];this[_0xa3e4('0xc0')](this[_0xa3e4('0xbd')][_0x3f123d[_0xa3e4('0xbe')]]);this[_0xa3e4('0xbd')][_0x3f123d[_0xa3e4('0xbe')]][_0xa3e4('0x63')]+=0x1;this[_0xa3e4('0xbd')][_0x3f123d['queue']][_0xa3e4('0x62')]+=0x1;_0x5da4ad=new Hangup(_0x3f123d,_0x1ab522);_0x5da4ad[_0xa3e4('0xf9')]=0x12;_0x5da4ad[_0xa3e4('0xb3')]=_0xa3e4('0xfa');_0x5da4ad[_0xa3e4('0xfb')]='AMD';ami['emit'](_0xa3e4('0xfc'),ut[_0xa3e4('0xfd')](_0x5da4ad,_0xa3e4('0xfe')));this['saveInDb'](_0x5da4ad,_0xa3e4('0xff'),_0xa3e4('0x100'));}if(_0x3f123d[_0xa3e4('0x4d')]!=='ivr'&&this['voiceQueues'][_0x3f123d[_0xa3e4('0xbe')]]['dialAMDActive']&&_0x1ab522['value']===_0xa3e4('0x101')){var _0x1afd95=this;return new BPromise(function(_0x27e232,_0x53103b){delete _0x1afd95[_0xa3e4('0x29')][_0x1ab522[_0xa3e4('0xf2')]];_0x1afd95[_0xa3e4('0xc0')](_0x1afd95[_0xa3e4('0xbd')][_0x3f123d['queue']]);_0x1afd95[_0xa3e4('0xbd')][_0x3f123d['queue']][_0xa3e4('0x63')]+=0x1;_0x1afd95[_0xa3e4('0xbd')][_0x3f123d[_0xa3e4('0xbe')]][_0xa3e4('0x62')]+=0x1;var _0x5522ad=_0x1afd95[_0xa3e4('0xbd')][_0x3f123d[_0xa3e4('0xbe')]];var _0x2b6848=new Hangup(_0x3f123d,_0x1ab522);_0x2b6848['state']=0x13;_0x2b6848[_0xa3e4('0xb3')]='Machine';_0x2b6848[_0xa3e4('0xfb')]=_0xa3e4('0x102');_0x2b6848[_0xa3e4('0x103')]+=0x1;_0x2b6848[_0xa3e4('0x104')]+=0x1;_0x2b6848[_0xa3e4('0xfe')]=!![];ami[_0xa3e4('0x105')](_0xa3e4('0xfc'),ut['buildObj'](_0x2b6848,_0xa3e4('0xfe')));_0x1afd95[_0xa3e4('0xf0')](_0x2b6848)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x106')));if(_0x2b6848[_0xa3e4('0x107')]+_0x2b6848[_0xa3e4('0x108')]+_0x2b6848['countnoanswerretry']+_0x2b6848[_0xa3e4('0x109')]+_0x2b6848['countdropretry']+_0x2b6848[_0xa3e4('0x10a')]+_0x2b6848[_0xa3e4('0x103')]+_0x2b6848[_0xa3e4('0x10b')]>=_0x5522ad[_0xa3e4('0x10c')]){_0x1afd95[_0xa3e4('0x10d')](_0x2b6848,_0x27e232,_0x53103b,_0xa3e4('0x10e'));}else{if(_0x2b6848[_0xa3e4('0x103')]>=_0x5522ad[_0xa3e4('0x10f')]){_0x1afd95[_0xa3e4('0x110')](_0x2b6848,_0x27e232,_0x53103b,_0xa3e4('0x111'));}else{_0x1afd95[_0xa3e4('0xd0')]({'active':![],'countmachineretry':_0x2b6848['countmachineretry'],'scheduledat':moment()[_0xa3e4('0x112')](_0x5522ad[_0xa3e4('0x113')],_0xa3e4('0x114'))[_0xa3e4('0x7d')](_0xa3e4('0x115')),'ContactId':_0x2b6848[_0xa3e4('0xe4')],'ListId':_0x2b6848[_0xa3e4('0xe5')],'VoiceQueueId':_0x2b6848[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x2b6848[_0xa3e4('0xe7')]||undefined})['catch'](loggerCatch(_0xa3e4('0x116')));_0x27e232({'reschedule':0x1});}}});}if(_0x3f123d['type']==='ivr'&&this[_0xa3e4('0x23')][_0x3f123d[_0xa3e4('0xbe')]][_0xa3e4('0x117')]&&_0x1ab522['value']==='HANGUP'){delete this[_0xa3e4('0x29')][_0x1ab522['uniqueid']];this[_0xa3e4('0xc0')](this[_0xa3e4('0x23')][_0x3f123d[_0xa3e4('0xbe')]]);_0x5da4ad=new Hangup(_0x3f123d,_0x1ab522);_0x5da4ad[_0xa3e4('0xf9')]=0x12;_0x5da4ad[_0xa3e4('0xb3')]=_0xa3e4('0xfa');_0x5da4ad[_0xa3e4('0xfb')]=_0xa3e4('0x102');ami['emit'](_0xa3e4('0xfc'),ut['buildObj'](_0x5da4ad,_0xa3e4('0xfe')));this[_0xa3e4('0xe2')](_0x5da4ad,'[syncHangupInAMDIvr][createHistory]',_0xa3e4('0x118'));}if(_0x3f123d[_0xa3e4('0x4d')]==='ivr'&&this['campaigns'][_0x3f123d[_0xa3e4('0xbe')]]['dialAMDActive']&&_0x1ab522[_0xa3e4('0xf8')]===_0xa3e4('0x101')){var _0x1afd95=this;return new BPromise(function(_0x567666,_0x1e266f){delete _0x1afd95[_0xa3e4('0x29')][_0x1ab522[_0xa3e4('0xf2')]];_0x1afd95['updateOriginated'](_0x1afd95['campaigns'][_0x3f123d['queue']]);_0x1afd95[_0xa3e4('0x23')][_0x3f123d[_0xa3e4('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x1afd95[_0xa3e4('0x23')][_0x3f123d[_0xa3e4('0xbe')]][_0xa3e4('0x62')]+=0x1;var _0x66a5de=_0x1afd95['campaigns'][_0x3f123d[_0xa3e4('0xbe')]];var _0x2a1221=new Hangup(_0x3f123d,_0x1ab522);_0x2a1221['state']=0x13;_0x2a1221['statedesc']=_0xa3e4('0x119');_0x2a1221[_0xa3e4('0xfb')]='AMD';_0x2a1221[_0xa3e4('0x103')]+=0x1;_0x2a1221[_0xa3e4('0x104')]+=0x1;_0x2a1221[_0xa3e4('0xfe')]=!![];ami['emit']('custom:amd',ut[_0xa3e4('0xfd')](_0x2a1221,'amd'));_0x1afd95[_0xa3e4('0xf0')](_0x2a1221)['catch'](loggerCatch(_0xa3e4('0x106')));if(_0x2a1221[_0xa3e4('0x107')]+_0x2a1221[_0xa3e4('0x108')]+_0x2a1221[_0xa3e4('0x11a')]+_0x2a1221[_0xa3e4('0x109')]+_0x2a1221[_0xa3e4('0x11b')]+_0x2a1221[_0xa3e4('0x10a')]+_0x2a1221[_0xa3e4('0x103')]+_0x2a1221[_0xa3e4('0x10b')]>=_0x66a5de[_0xa3e4('0x10c')]){_0x1afd95['stateGlobal'](_0x2a1221,_0x567666,_0x1e266f,'reason19\x20machine....');}else{if(_0x2a1221[_0xa3e4('0x103')]>=_0x66a5de[_0xa3e4('0x10f')]){_0x1afd95[_0xa3e4('0x110')](_0x2a1221,_0x567666,_0x1e266f,_0xa3e4('0x111'));}else{_0x1afd95[_0xa3e4('0xd0')]({'active':![],'countmachineretry':_0x2a1221[_0xa3e4('0x103')],'scheduledat':moment()[_0xa3e4('0x112')](_0x66a5de['dialMachineRetryFrequency'],'minutes')[_0xa3e4('0x7d')](_0xa3e4('0x115')),'ContactId':_0x2a1221[_0xa3e4('0xe4')],'ListId':_0x2a1221['ListId'],'VoiceQueueId':_0x2a1221[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x2a1221['CampaignId']||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x116')));_0x567666({'reschedule':0x1});}}});}}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x37')]=function(_0x588bcc){var _0x54cdb2=this['uniqueId'][_0x588bcc[_0xa3e4('0xf2')]];var _0x43a55b=this;var _0x142965;if(_0x54cdb2&&_0x54cdb2[_0xa3e4('0x4d')]==='ivr'){delete this[_0xa3e4('0x29')][_0x588bcc[_0xa3e4('0xf2')]];this[_0xa3e4('0xc0')](this['campaigns'][_0x54cdb2[_0xa3e4('0xbe')]]);this[_0xa3e4('0x23')][_0x54cdb2[_0xa3e4('0xbe')]][_0xa3e4('0x11c')]+=0x1;_0x142965=new Hangup(_0x54cdb2,_0x588bcc);this['createHistory'](_0x142965)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x11d')));this[_0xa3e4('0xdb')](_0x142965)['catch'](loggerCatch(_0xa3e4('0x11e')));}if(_0x54cdb2&&_0x54cdb2[_0xa3e4('0x4d')]!==_0xa3e4('0x80')&&isNotNull(this[_0xa3e4('0xbd')][_0x54cdb2[_0xa3e4('0xbe')]][_0xa3e4('0x11f')])){delete this['uniqueId'][_0x588bcc[_0xa3e4('0xf2')]];this[_0xa3e4('0xc0')](this[_0xa3e4('0xbd')][_0x54cdb2[_0xa3e4('0xbe')]]);this[_0xa3e4('0xbd')][_0x54cdb2[_0xa3e4('0xbe')]][_0xa3e4('0x63')]+=0x1;this[_0xa3e4('0xbd')][_0x54cdb2[_0xa3e4('0xbe')]][_0xa3e4('0x62')]+=0x1;_0x142965=new Hangup(_0x54cdb2,_0x588bcc);_0x142965['state']=0x10;_0x142965['statedesc']='AnswerAGI';_0x142965['membername']=_0xa3e4('0x120');this[_0xa3e4('0xf0')](_0x142965)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x11d')));this[_0xa3e4('0xdb')](_0x142965)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x11e')));}if(_0x54cdb2&&_0x54cdb2[_0xa3e4('0x4d')]!==_0xa3e4('0x80')&&!isNotNull(this[_0xa3e4('0xbd')][_0x54cdb2[_0xa3e4('0xbe')]][_0xa3e4('0x11f')])){delete this[_0xa3e4('0x29')][_0x588bcc[_0xa3e4('0xf2')]];this[_0xa3e4('0xc0')](this[_0xa3e4('0xbd')][_0x54cdb2[_0xa3e4('0xbe')]]);this['voiceQueues'][_0x54cdb2[_0xa3e4('0xbe')]][_0xa3e4('0x6c')]+=0x1;_0x142965=new Hangup(_0x54cdb2,_0x588bcc);_0x142965[_0xa3e4('0xf9')]=0xc;_0x142965[_0xa3e4('0xb3')]=_0x588bcc[_0xa3e4('0x121')];_0x142965[_0xa3e4('0xfb')]=_0xa3e4('0x122');this[_0xa3e4('0xf0')](_0x142965)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x11d')));this[_0xa3e4('0xdb')](_0x142965)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0x2978c4){var _0x4dc7c8=this[_0xa3e4('0x29')][_0x2978c4['uniqueid']];var _0x8ac5e4=this;if(this[_0xa3e4('0xbd')][_0x2978c4[_0xa3e4('0xbe')]]){if(_0x4dc7c8&&_0x4dc7c8['type']!==_0xa3e4('0x80')){delete this[_0xa3e4('0x29')][_0x2978c4[_0xa3e4('0xf2')]];this[_0xa3e4('0xbd')][_0x2978c4[_0xa3e4('0xbe')]]['outboundAnswerCallsDay']+=0x1;var _0x1e62a7=new AgentComplete(_0x4dc7c8,_0x2978c4);if(_0x2978c4[_0xa3e4('0x123')]===_0xa3e4('0x124')){_0x1e62a7['agiafterat']=this['voiceQueues'][_0x2978c4['queue']][_0xa3e4('0x125')]&&this['voiceQueues'][_0x2978c4['queue']]['dialAgiAfterHangupAgent']?moment()[_0xa3e4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xa3e4('0xf0')](_0x1e62a7)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x126')));this[_0xa3e4('0xdb')](_0x1e62a7)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x127')));}}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x128')]=function(_0x2f375e){if(this[_0xa3e4('0xbd')][_0x2f375e[_0xa3e4('0xbe')]]){if(this[_0xa3e4('0x29')][_0x2f375e[_0xa3e4('0xf2')]]&&this['uniqueId'][_0x2f375e[_0xa3e4('0xf2')]]['type']!==_0xa3e4('0x80')){this[_0xa3e4('0xc0')](this[_0xa3e4('0xbd')][_0x2f375e[_0xa3e4('0xbe')]]);this[_0xa3e4('0x29')][_0x2f375e['uniqueid']][_0xa3e4('0x129')]=moment()[_0xa3e4('0x7d')](_0xa3e4('0x115'));}}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x12a')]=function(_0x321127,_0x5dd4f3){this[_0xa3e4('0xf0')](_0x321127)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x126')));if(_0x5dd4f3==0x0){this[_0xa3e4('0xdb')](_0x321127)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x12b')));}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x31')]=function(_0x47cc20){var _0x729c2b=this[_0xa3e4('0x29')][_0x47cc20[_0xa3e4('0xf2')]];var _0x8d2413=this;var _0x417422=![];var _0x4a892c;var _0x1659e9;if(this[_0xa3e4('0xbd')][_0x47cc20['queue']]){if(_0x729c2b&&_0x729c2b[_0xa3e4('0x4d')]!==_0xa3e4('0x80')){delete this['uniqueId'][_0x47cc20[_0xa3e4('0xf2')]];this[_0xa3e4('0xc0')](this['voiceQueues'][_0x47cc20[_0xa3e4('0xbe')]]);_0x729c2b[_0xa3e4('0x12c')]=moment()['format'](_0xa3e4('0x115'));var _0x1d0dba=new QueueCallerAbandon(_0x729c2b,_0x47cc20);if(getSeconds(_0x729c2b[_0xa3e4('0x12c')],_0x729c2b[_0xa3e4('0x12d')])>=_0x729c2b[_0xa3e4('0x12e')]){this[_0xa3e4('0xbd')][_0x47cc20['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xa3e4('0xbd')][_0x47cc20['queue']][_0xa3e4('0x12f')]+=0x1;this[_0xa3e4('0xbd')][_0x47cc20[_0xa3e4('0xbe')]][_0xa3e4('0x130')]+=0x1;_0x1d0dba[_0xa3e4('0xf9')]=0xa;_0x1d0dba[_0xa3e4('0xb3')]=_0xa3e4('0x131');_0x1d0dba[_0xa3e4('0x132')]='TIMEOUT';_0x1d0dba[_0xa3e4('0x133')]=this[_0xa3e4('0xbd')][_0x47cc20['queue']][_0xa3e4('0x125')]?moment()[_0xa3e4('0x7d')](_0xa3e4('0x115')):undefined;_0x1d0dba['countdropretry']+=0x1;_0x1d0dba[_0xa3e4('0x104')]+=0x1;_0x4a892c=this[_0xa3e4('0xbd')][_0x47cc20[_0xa3e4('0xbe')]][_0xa3e4('0x134')];_0x1659e9=this[_0xa3e4('0xbd')][_0x47cc20['queue']]['callAdditionalPhoneAfterMin'];_0x8d2413[_0xa3e4('0xc8')](_0x1d0dba,_0x1d0dba[_0xa3e4('0xf9')],_0x729c2b['voiceQueue'])['then'](function(_0x170787){_0x417422=_0x170787['additional']==0x1;if(_0x1d0dba[_0xa3e4('0x11b')]>=_0x8d2413[_0xa3e4('0xbd')][_0x47cc20[_0xa3e4('0xbe')]][_0xa3e4('0x135')]){_0x8d2413[_0xa3e4('0x12a')](_0x1d0dba,_0x170787['additional']);}else{_0x8d2413[_0xa3e4('0xd0')]({'active':![],'countdropretry':_0x1d0dba[_0xa3e4('0x11b')],'scheduledat':moment()['add'](_0x8d2413['voiceQueues'][_0x47cc20['queue']][_0xa3e4('0x134')],'minutes')['format'](_0xa3e4('0x115')),'ContactId':_0x729c2b[_0xa3e4('0xe4')],'ListId':_0x729c2b['ListId'],'VoiceQueueId':_0x729c2b['VoiceQueueId']||undefined,'CampaignId':_0x729c2b['CampaignId']||undefined})['catch'](loggerCatch(_0xa3e4('0x136')));var _0x42aaa0=new History(_0x1d0dba);_0x42aaa0[_0xa3e4('0xf9')]=0xa;_0x42aaa0['statedesc']=_0xa3e4('0x131');_0x42aaa0['starttime']=moment()[_0xa3e4('0x7d')](_0xa3e4('0x115'));_0x42aaa0[_0xa3e4('0xb4')]=_0x42aaa0[_0xa3e4('0xb5')];_0x42aaa0[_0xa3e4('0x137')]=_0x1d0dba[_0xa3e4('0x137')];_0x42aaa0[_0xa3e4('0x138')]=_0x1d0dba[_0xa3e4('0x138')];_0x8d2413['createHistory'](_0x42aaa0)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x139')));}})[_0xa3e4('0xc3')](function(_0x5dfa76){if(_0x417422)_0x8d2413[_0xa3e4('0xca')](_0x1d0dba,_0x4a892c,_0x1659e9)[_0xa3e4('0xc3')](function(_0x39b05e){return 0x1;});});}else{this[_0xa3e4('0xbd')][_0x47cc20[_0xa3e4('0xbe')]][_0xa3e4('0x70')]+=0x1;this[_0xa3e4('0xbd')][_0x47cc20[_0xa3e4('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0x1d0dba[_0xa3e4('0xf9')]=0xb;_0x1d0dba['statedesc']='Abandoned';_0x1d0dba['dropreason']=_0xa3e4('0x13a');_0x1d0dba[_0xa3e4('0x10a')]+=0x1;_0x1d0dba[_0xa3e4('0x104')]+=0x1;_0x4a892c=this['voiceQueues'][_0x47cc20[_0xa3e4('0xbe')]][_0xa3e4('0x13b')];_0x1659e9=this['voiceQueues'][_0x47cc20[_0xa3e4('0xbe')]]['callAdditionalPhoneAfterMin'];_0x8d2413['verifyAdditionalPhones'](_0x1d0dba,_0x1d0dba[_0xa3e4('0xf9')],_0x729c2b[_0xa3e4('0x13c')])['then'](function(_0x52d6b5){if(_0x1d0dba[_0xa3e4('0x10a')]>=_0x8d2413[_0xa3e4('0xbd')][_0x47cc20['queue']][_0xa3e4('0x13d')]){_0x8d2413[_0xa3e4('0x12a')](_0x1d0dba,_0x52d6b5[_0xa3e4('0x13e')]);}else{_0x8d2413['rescheduleContact']({'active':![],'countabandonedretry':_0x1d0dba[_0xa3e4('0x10a')],'scheduledat':moment()[_0xa3e4('0x112')](_0x8d2413[_0xa3e4('0xbd')][_0x47cc20[_0xa3e4('0xbe')]][_0xa3e4('0x13b')],_0xa3e4('0x114'))[_0xa3e4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x729c2b[_0xa3e4('0xe4')],'ListId':_0x729c2b[_0xa3e4('0xe5')],'VoiceQueueId':_0x729c2b[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x729c2b['CampaignId']||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x13f')));var _0xa93a20=new History(_0x1d0dba);_0xa93a20['state']=0xb;_0xa93a20[_0xa3e4('0xb3')]=_0xa3e4('0x140');_0xa93a20['starttime']=moment()[_0xa3e4('0x7d')](_0xa3e4('0x115'));_0xa93a20[_0xa3e4('0xb4')]=_0xa93a20[_0xa3e4('0xb5')];_0xa93a20[_0xa3e4('0x137')]=_0x1d0dba[_0xa3e4('0x137')];_0xa93a20[_0xa3e4('0x138')]=_0x1d0dba[_0xa3e4('0x138')];_0x8d2413[_0xa3e4('0xf0')](_0xa93a20)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x141')));}})['then'](function(_0x41ddcd){if(_0x417422)_0x8d2413[_0xa3e4('0xca')](_0x1d0dba,_0x4a892c,_0x1659e9)[_0xa3e4('0xc3')](function(_0x5de503){return 0x1;});});}}}};Dialer[_0xa3e4('0x1e')]['syncNewExten']=function(_0x234a73){if(this[_0xa3e4('0x28')][_0x234a73[_0xa3e4('0xf2')]]){this['actions'][_0x234a73['uniqueid']][_0xa3e4('0xbb')]=_0x234a73[_0xa3e4('0xbb')];}if(this[_0xa3e4('0x29')][_0x234a73['uniqueid']]){this[_0xa3e4('0x29')][_0x234a73[_0xa3e4('0xf2')]][_0xa3e4('0xbb')]=_0x234a73[_0xa3e4('0xbb')];}};Dialer['prototype'][_0xa3e4('0x3a')]=function(_0x304819){if(strategy[this[_0xa3e4('0xbd')][this[_0xa3e4('0x28')][_0x304819[_0xa3e4('0x142')]][_0xa3e4('0xbe')]][_0xa3e4('0x4f')]]===_0xa3e4('0x1d')){if(this[_0xa3e4('0x28')][_0x304819[_0xa3e4('0x142')]]&&_[_0xa3e4('0xf3')](this[_0xa3e4('0x28')][_0x304819[_0xa3e4('0x142')]][_0xa3e4('0x143')])&&_0x304819[_0xa3e4('0xec')]==='1'&&_0x304819[_0xa3e4('0x144')]==='0'){if(this[_0xa3e4('0x24')][_0x304819[_0xa3e4('0x145')]]){if(!this[_0xa3e4('0x24')][_0x304819[_0xa3e4('0x145')]][_0xa3e4('0x143')]){this[_0xa3e4('0x24')][_0x304819['stateinterface']]['locked']=!![];this[_0xa3e4('0x28')][_0x304819[_0xa3e4('0x142')]]['locked']=!![];this[_0xa3e4('0x28')][_0x304819['actionid']][_0xa3e4('0x145')]=_0x304819[_0xa3e4('0x145')];}}}}else if((strategy[this['voiceQueues'][this[_0xa3e4('0x28')][_0x304819[_0xa3e4('0x142')]][_0xa3e4('0xbe')]][_0xa3e4('0x4f')]]||_0xa3e4('0x1c'))===_0xa3e4('0x1c')){if(this['actions'][_0x304819[_0xa3e4('0x142')]]){if(this[_0xa3e4('0x24')][_0x304819[_0xa3e4('0x145')]]){this[_0xa3e4('0x28')][_0x304819[_0xa3e4('0x142')]][_0xa3e4('0x145')]=_0x304819[_0xa3e4('0x145')];if(_['isNil'](this[_0xa3e4('0x2e')][this['actions'][_0x304819[_0xa3e4('0x142')]][_0xa3e4('0xbe')]])){this['queueBooked'][this[_0xa3e4('0x28')][_0x304819['actionid']][_0xa3e4('0xbe')]]=[];}this['queueBooked'][this[_0xa3e4('0x28')][_0x304819[_0xa3e4('0x142')]][_0xa3e4('0xbe')]][_0xa3e4('0x146')](_[_0xa3e4('0x95')](_[_0xa3e4('0xe3')](this[_0xa3e4('0x28')][_0x304819['actionid']],['idHopper','stateinterface']),{'status':_0x304819['status'],'paused':_0x304819['paused']}));}}}};function unlockQueueStatus(_0x38a18c,_0x41acad){setTimeout(function(){if(_['isUndefined'](_0x38a18c[_0xa3e4('0x147')])){loggerBooked[_0xa3e4('0xa0')](_0xa3e4('0x148'),_0x41acad);}_0x38a18c[_0xa3e4('0x147')]=!![];loggerBooked[_0xa3e4('0x83')](_0xa3e4('0x149'),_0x41acad,JSON['stringify'](_['pick'](_0x38a18c,[_0xa3e4('0x41'),_0xa3e4('0x147')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x2aa906){var _0x477e34=this;var _0x25e265=_0x477e34[_0xa3e4('0xbd')][_0x477e34[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]];if(strategy[this['voiceQueues'][this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]]['queue']][_0xa3e4('0x4f')]]==='roundrobin'){if(this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]]&&this['actions'][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0x145')]){this[_0xa3e4('0x22')][_0xa3e4('0x14a')](this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]]['idHopper'],this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0x145')])[_0xa3e4('0xc4')](function(_0x134240){logger[_0xa3e4('0xa0')](_0xa3e4('0x14b'),util[_0xa3e4('0x9f')](_0x134240,{'showHidden':![],'depth':null}));})['finally'](function(){_0x477e34[_0xa3e4('0xc0')](_0x477e34['voiceQueues'][_0x477e34[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]]);_0x477e34['agents'][_0x477e34[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0x145')]]['locked']=![];delete _0x477e34[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]];unlockQueueStatus(_0x25e265);});}else{this[_0xa3e4('0xc0')](this['voiceQueues'][this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]]);this[_0xa3e4('0xd0')]({'active':![],'ContactId':this['actions'][_0x2aa906['actionid']]['ContactId'],'ListId':this['actions'][_0x2aa906['actionid']][_0xa3e4('0xe5')],'VoiceQueueId':this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xe6')]||undefined,'CampaignId':this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x14c')));delete this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]];unlockQueueStatus(_0x25e265);}}else if((strategy[this[_0xa3e4('0xbd')][this['actions'][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]][_0xa3e4('0x4f')]]||_0xa3e4('0x1c'))==='rrmemory'){var _0x153c18;if(this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]]&&!_[_0xa3e4('0x49')](this[_0xa3e4('0x2e')][this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]])){if(this[_0xa3e4('0x14d')][_0x477e34[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]]){this[_0xa3e4('0x14d')][_0x477e34[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]]=this[_0xa3e4('0x14d')][this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]]?this[_0xa3e4('0x14d')][this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]]:this['queueBooked'][this[_0xa3e4('0x28')][_0x2aa906['actionid']][_0xa3e4('0xbe')]]?this[_0xa3e4('0x2e')][this[_0xa3e4('0x28')][_0x2aa906['actionid']]['queue']][_0xa3e4('0x14e')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x2aa906[_0xa3e4('0x142')]]['queue']][_0xa3e4('0x14e')]=this['queueBookedRR'][this[_0xa3e4('0x28')][_0x2aa906[_0xa3e4('0x142')]][_0xa3e4('0xbe')]];for(var _0x478fd2=0x0;_0x478fd2=0x0;})[_0xa3e4('0xc4')](myreject(_0x5ab7ac)));}}else{_0x517f21[_0xa3e4('0x146')](ami[_0xa3e4('0xba')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x421e0b,!_[_0xa3e4('0x3e')](config[_0xa3e4('0x162')][_0x20899a])?_0x20899a:'')})[_0xa3e4('0xc3')](function(_0xf2b8d8){return _0xf2b8d8['content'][_0xa3e4('0x168')]('true')>=0x0;})[_0xa3e4('0xc4')](myreject(_0x5ab7ac)));}BPromise[_0xa3e4('0x16a')](_0x517f21)['then'](function(_0x45d78d){var _0x46f2c1=_['some'](_0x45d78d);if(_0x46f2c1){return _0x3a57ac(_0x46f2c1);}else{_0x416a6c[_0xa3e4('0x3f')]=_0x34bd97?_0xa3e4('0x16b'):_0xa3e4('0x16c');return _0x5ab7ac(msgResponse(_0xa3e4('0x16d'),_0xa3e4('0x15f'),_0xa3e4('0x16e')+_0x34bd97+'\x20'+_0x55103d+_0xa3e4('0x16f')+util[_0xa3e4('0x9f')](_0x421e0b,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x20899a));}})['catch'](function(_0x356fa0){return _0x5ab7ac(msgResponse(_0xa3e4('0x15e'),_0xa3e4('0x15f'),JSON['stringify'](_0x356fa0)));});});};Dialer['prototype'][_0xa3e4('0x170')]=function(_0x2b9999){var _0x9fb26=this;return function(){switch(_0x2b9999['dialMethod']){case _0xa3e4('0x171'):freeVariablesPredictive(_0x2b9999);_0x9fb26[_0xa3e4('0x172')](_0x2b9999,0x1);break;case _0xa3e4('0x173'):freeVariablesPredictive(_0x2b9999);_0x9fb26[_0xa3e4('0x172')](_0x2b9999,_0x2b9999[_0xa3e4('0x174')]);break;case _0xa3e4('0xa'):_0x9fb26['predictive'](_0x2b9999);break;case'booked':freeVariablesPredictive(_0x2b9999);_0x9fb26[_0xa3e4('0x172')](_0x2b9999,0x1);break;default:freeVariablesPredictive(_0x2b9999);logger['error'](_0xa3e4('0x175'),_0x2b9999[_0xa3e4('0x41')],_0xa3e4('0x176'));}};};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x177')]=function(_0x287b94){var _0x4a1151=this;return function(){_0x4a1151[_0xa3e4('0x178')](_0x287b94);};};Dialer['prototype'][_0xa3e4('0xc')]=function(_0x274608){var _0x173783=this;if(isNotPreview(_0x274608[_0xa3e4('0x5d')])){if(isVoiceQueueOutbound(_0x274608[_0xa3e4('0x4d')])&&isActive(_0x274608['dialActive'])){_0x274608[_0xa3e4('0xad')]=!![];BPromise[_0xa3e4('0xc5')]()[_0xa3e4('0xc3')](checkIsLoggedIn(_0x274608,_0x274608['loggedIn']))[_0xa3e4('0xc3')](checkIsActive(_0x274608,_0x274608['dialActive']))[_0xa3e4('0xc3')](checkInterval(_0x274608))[_0xa3e4('0xc3')](_0x173783['checkIsTrunkReachable'](_0x274608))[_0xa3e4('0xc3')](_0x173783[_0xa3e4('0x15d')](_0x274608[_0xa3e4('0x179')],_0x274608[_0xa3e4('0x17a')],_0x274608[_0xa3e4('0x41')],_0x274608))['then'](_0x173783[_0xa3e4('0x17b')](_0x274608[_0xa3e4('0x45')],_0x274608['dialTimezone'],_0x274608['name'],_0x274608))[_0xa3e4('0xc3')](_0x173783['checkDialMethod'](_0x274608))[_0xa3e4('0xc4')](loggerCatchQueueSummary(_0xa3e4('0x17c'),_0x274608));}else{notSendMessagesQueue(_0x274608);}}else{freeVariablesPredictive(_0x274608);}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x158')]=function(){var _0x56ad21=this;var _0x2fbbaa;for(var _0x1d01d4 in this[_0xa3e4('0x23')]){if(typeof this['campaigns'][_0x1d01d4]!==_0xa3e4('0xa4')){_0x2fbbaa=this[_0xa3e4('0x23')][_0x1d01d4];if(isCampaignIvr(_0x2fbbaa[_0xa3e4('0x4d')])&&isActive(_0x2fbbaa[_0xa3e4('0x7b')])){_0x2fbbaa['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xa3e4('0xc3')](checkIsActive(_0x2fbbaa,_0x2fbbaa['active']))['then'](checkInterval(_0x2fbbaa))[_0xa3e4('0xc3')](_0x56ad21[_0xa3e4('0x159')](_0x2fbbaa))['then'](_0x56ad21[_0xa3e4('0x15d')](_0x2fbbaa[_0xa3e4('0x179')],_0x2fbbaa[_0xa3e4('0x17a')],_0x2fbbaa[_0xa3e4('0x41')],_0x2fbbaa))[_0xa3e4('0xc3')](_0x56ad21[_0xa3e4('0x17b')](_0x2fbbaa['Interval'],_0x2fbbaa[_0xa3e4('0x17a')],_0x2fbbaa[_0xa3e4('0x41')],_0x2fbbaa))[_0xa3e4('0xc3')](_0x56ad21['launchHandleIvr'](_0x2fbbaa))[_0xa3e4('0xc4')](loggerCatchQueueSummary(_0xa3e4('0x17d'),_0x2fbbaa));}else{notSendMessagesCampaign(_0x2fbbaa);}}}};function getCallerIdRandom(_0x203a2c,_0xd3502){var _0x34a6d0;var _0x1e302b;var _0x4e6a01;if(_0xd3502<=0x0){_0xd3502=0x1;}_0x34a6d0=new RegExp(_0xa3e4('0x17e')+_0xd3502+'}$');_0x1e302b=Math['pow'](0xa,_0xd3502-0x1);_0x4e6a01=Math['pow'](0xa,_0xd3502)-0x1;return util[_0xa3e4('0x7d')]('%s',_[_0xa3e4('0x17f')](_0x203a2c,_0x34a6d0,_['random'](_0x1e302b,_0x4e6a01)));}function extractCalleridName(_0x2b346b){var _0x32054b=_0x2b346b[_0xa3e4('0x180')](/"(.*?)"/);return _0x32054b?_0x32054b[0x1]:_0x2b346b;}function extractCalleridNumber(_0x44f7cf){var _0x2d54f8=_0x44f7cf[_0xa3e4('0x180')](/<(.*?)>/);return _0x2d54f8?_0x2d54f8[0x1]:_0x44f7cf;}Dialer[_0xa3e4('0x1e')]['actionOriginate']=function(_0x3b0dd0,_0x4cdc1f){var _0x420605=this;var _0x5c5523=uuid['v4']();this[_0xa3e4('0x28')][_0x5c5523]=new Action(_0x3b0dd0,_0x4cdc1f,_0x5c5523);return new BPromise(function(_0x4d721a,_0x1fecd6){if(_['isUndefined'](_0x3b0dd0)&&typeof _0x3b0dd0!==_0xa3e4('0x181')){return _0x1fecd6(msgResponse(_0xa3e4('0x182'),_0xa3e4('0x15f'),_0xa3e4('0x183')));}if(_[_0xa3e4('0x3e')](_0x4cdc1f[_0xa3e4('0x184')])||_0x4cdc1f[_0xa3e4('0x184')]===null){return _0x1fecd6(msgResponse(_0xa3e4('0x182'),_0xa3e4('0x15f'),_0xa3e4('0x185')));}var _0x8592dd={'XMD-CALLERID':_0x420605[_0xa3e4('0x28')][_0x5c5523]['getCaller'](),'XMD-AGI':_0x3b0dd0[_0xa3e4('0x11f')]?util[_0xa3e4('0x7d')](_0xa3e4('0x186'),ipAgi,_0x3b0dd0[_0xa3e4('0x11f')]):_0xa3e4('0x187'),'XMD-AGIAFTER':_0x3b0dd0[_0xa3e4('0x125')]?util[_0xa3e4('0x7d')](_0xa3e4('0x186'),ipAgi,_0x3b0dd0['dialQueueProject2']):_0xa3e4('0x187'),'XMD-QUEUE':_0x3b0dd0['type']==='outbound'?util[_0xa3e4('0x7d')](_0xa3e4('0x188'),_0x3b0dd0[_0xa3e4('0x41')],_0x3b0dd0[_0xa3e4('0x189')]||'',_0x3b0dd0[_0xa3e4('0x18a')]?'c':'',_0x3b0dd0[_0xa3e4('0x12e')]||0x3):_0xa3e4('0x187'),'XMD-CONTACTID':_0x4cdc1f[_0xa3e4('0xe4')],'XMD-CDRTYPE':_0xa3e4('0x8'),'CALLERID(all)':_0x420605[_0xa3e4('0x28')][_0x5c5523][_0xa3e4('0x18b')](),'XMD-AMD':_0x3b0dd0[_0xa3e4('0x117')]?_0xa3e4('0x18c'):_0xa3e4('0x187'),'XMD-DESTINATION':_0xa3e4('0xf7')};if(_0x3b0dd0[_0xa3e4('0x117')]){_0x8592dd[_0xa3e4('0x18d')]=_0x3b0dd0[_0xa3e4('0x18e')]||0x9c4;_0x8592dd[_0xa3e4('0x18f')]=_0x3b0dd0[_0xa3e4('0x190')]||0x5dc;_0x8592dd[_0xa3e4('0x191')]=_0x3b0dd0['dialAMDAfterGreetingSilence']||0x320;_0x8592dd[_0xa3e4('0x192')]=_0x3b0dd0['dialAMDTotalAnalysisTime']||0x1388;_0x8592dd[_0xa3e4('0x193')]=_0x3b0dd0[_0xa3e4('0x194')]||0x64;_0x8592dd[_0xa3e4('0x195')]=_0x3b0dd0[_0xa3e4('0x196')]||0x32;_0x8592dd[_0xa3e4('0x197')]=_0x3b0dd0['dialAMDMaximumNumberOfWords']||0x3;_0x8592dd[_0xa3e4('0x198')]=_0x3b0dd0['dialAMDSilenceThreshold']||0x100;_0x8592dd[_0xa3e4('0x199')]=_0x3b0dd0['dialAMDMaximumWordLength']||0x1388;}if(_0x3b0dd0['type']==='outbound'){_0x8592dd['XMD-VOICEQUEUEID']=_0x4cdc1f['VoiceQueueId'];}else{_0x8592dd[_0xa3e4('0x19a')]=_0x4cdc1f['CampaignId'];}for(var _0x4b7a90 in _0x4cdc1f[_0xa3e4('0x19b')]){if(typeof _0x4cdc1f[_0xa3e4('0x19b')][_0x4b7a90]!=='undefined'){if(isNotNull(_0x4cdc1f['Contact'][_0x4b7a90])&&_0x4b7a90!=='id'&&_0x4b7a90!=='tags'&&_0x4b7a90!=='createdAt'&&_0x4b7a90!==_0xa3e4('0x19c')){_0x8592dd[util[_0xa3e4('0x7d')](_0xa3e4('0x19d'),_0xa3e4('0x19e'),_[_0xa3e4('0x19f')](_0x4b7a90))]=_0x4cdc1f['Contact'][_0x4b7a90];}}}var _0xc8e6e9=_0x420605[_0xa3e4('0xeb')](_0x3b0dd0[_0xa3e4('0x7a')])?getCallerId(_0x3b0dd0['Trunk']['callerid'],_0x3b0dd0['dialOriginateCallerIdName'],_0x3b0dd0[_0xa3e4('0x1a0')]>0x0?getCallerIdRandom(_0x3b0dd0[_0xa3e4('0x5f')],_0x3b0dd0[_0xa3e4('0x1a0')]):_0x3b0dd0[_0xa3e4('0x5f')]):getCallerId(_['isNil'](_0x3b0dd0['TrunkBackup'])?_0x3b0dd0[_0xa3e4('0x7a')][_0xa3e4('0x7c')]:_0x3b0dd0[_0xa3e4('0x15a')][_0xa3e4('0x7c')],_0x3b0dd0[_0xa3e4('0x5e')],_0x3b0dd0[_0xa3e4('0x1a0')]>0x0?getCallerIdRandom(_0x3b0dd0[_0xa3e4('0x5f')],_0x3b0dd0[_0xa3e4('0x1a0')]):_0x3b0dd0[_0xa3e4('0x5f')]);if(_0xc8e6e9){_0x8592dd[_0xa3e4('0x1a1')]=_0x420605[_0xa3e4('0x28')][_0x5c5523][_0xa3e4('0x1a2')]=extractCalleridName(_0xc8e6e9);_0x8592dd[_0xa3e4('0x1a3')]=_0x4cdc1f[_0xa3e4('0x184')];}return ami[_0xa3e4('0xba')]({'actionid':_0x5c5523,'action':_0xa3e4('0x182'),'channel':_0x420605[_0xa3e4('0xeb')](_0x3b0dd0[_0xa3e4('0x7a')])?util[_0xa3e4('0x7d')](_0xa3e4('0x1a4'),_0x3b0dd0[_0xa3e4('0x7a')][_0xa3e4('0x41')],isNotNull(_0x3b0dd0[_0xa3e4('0x61')])?_0x3b0dd0[_0xa3e4('0x61')][_0xa3e4('0x1a5')]()||'':'',_0x3b0dd0[_0xa3e4('0x1a6')]>0x0?_0x4cdc1f[_0xa3e4('0x184')][_0xa3e4('0x1a7')](_0x3b0dd0[_0xa3e4('0x1a6')]):_0x4cdc1f[_0xa3e4('0x184')]):util['format'](_0xa3e4('0x1a4'),_[_0xa3e4('0xf3')](_0x3b0dd0[_0xa3e4('0x15a')])?_0x3b0dd0[_0xa3e4('0x7a')][_0xa3e4('0x41')]:_0x3b0dd0['TrunkBackup'][_0xa3e4('0x41')],isNotNull(_0x3b0dd0['dialPrefix'])?_0x3b0dd0[_0xa3e4('0x61')]['trim']()||'':'',_0x3b0dd0['dialCutDigit']>0x0?_0x4cdc1f[_0xa3e4('0x184')]['substring'](_0x3b0dd0['dialCutDigit']):_0x4cdc1f[_0xa3e4('0x184')]),'callerid':_0xc8e6e9,'Exten':'xcally-motion-dialer','Context':_0xa3e4('0x1a8'),'Priority':'1','variable':_0x8592dd,'timeout':(_0x3b0dd0[_0xa3e4('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5c5523})['then'](function(_0x3133c1){return _0x4d721a(_0x3133c1);})[_0xa3e4('0xc4')](function(_0x1ef846){_0x3b0dd0[_0xa3e4('0x6b')]+=0x1;var _0x4a0049=new History(_0x420605[_0xa3e4('0x28')][_0x5c5523]);logger[_0xa3e4('0xa0')](util[_0xa3e4('0x7d')](_0xa3e4('0x1a9'),JSON[_0xa3e4('0x4b')](_0x1ef846)));_0x4a0049[_0xa3e4('0xf9')]=0xe;_0x4a0049[_0xa3e4('0xb3')]='OriginateError';_0x4a0049[_0xa3e4('0xb5')]=moment()[_0xa3e4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a0049[_0xa3e4('0xb4')]=_0x4a0049[_0xa3e4('0xb5')];_0x420605[_0xa3e4('0xf0')](_0x4a0049)[_0xa3e4('0xc4')](loggerCatch('[originate][error]'));_0x420605[_0xa3e4('0xdb')](_0x4a0049)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x1aa')))[_0xa3e4('0x21')](function(){delete _0x420605['actions'][_0x5c5523];return _0x1fecd6(msgResponse(_0xa3e4('0x182'),_0xa3e4('0x1ab'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xa3e4('0x33')]=function(_0x2353b5){var _0x2d0931=this['actions'][_0x2353b5[_0xa3e4('0x142')]];if(_0x2d0931){delete this['actions'][_0x2353b5[_0xa3e4('0x142')]];_0x2d0931['responsetime']=moment()[_0xa3e4('0x7d')](_0xa3e4('0x115'));var _0x484412=_0x2d0931[_0xa3e4('0x4d')]===_0xa3e4('0x80')?this['campaigns'][_0x2d0931[_0xa3e4('0xbe')]]:this[_0xa3e4('0xbd')][_0x2d0931[_0xa3e4('0x1ac')]()];if(!this[_0xa3e4('0xea')](_0x2353b5['response'])){this[_0xa3e4('0xc0')](_0x484412);return this['callProgressDetecting'](_0x2d0931,_0x484412,_0x2353b5)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x1ad')));}this[_0xa3e4('0x29')][_0x2353b5[_0xa3e4('0xf2')]]=_0x2d0931;}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x1ae')]=function(_0x2bec50,_0x443a18,_0x3cd9ba){var _0x1e681b=new History(_0x443a18);if(_0x1e681b[_0xa3e4('0x107')]+_0x1e681b['countcongestionretry']+_0x1e681b[_0xa3e4('0x11a')]+_0x1e681b[_0xa3e4('0x109')]+_0x1e681b['countdropretry']+_0x1e681b[_0xa3e4('0x10a')]+_0x1e681b[_0xa3e4('0x103')]+_0x1e681b[_0xa3e4('0x10b')]>=_0x3cd9ba['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2bec50){case 0x3:if(_0x1e681b[_0xa3e4('0x11a')]>=_0x3cd9ba['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xa3e4('0xd0')]({'active':![],'countnoanswerretry':_0x1e681b[_0xa3e4('0x11a')]+=0x1,'scheduledat':moment()[_0xa3e4('0x112')](_0x3cd9ba[_0xa3e4('0x1af')],_0xa3e4('0x114'))[_0xa3e4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1e681b[_0xa3e4('0xe4')],'ListId':_0x1e681b[_0xa3e4('0xe5')],'VoiceQueueId':_0x1e681b[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x1e681b[_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x1b0')));break;case 0x5:if(_0x1e681b[_0xa3e4('0x107')]>=_0x3cd9ba[_0xa3e4('0x1b1')]-0x1){return!![];}this[_0xa3e4('0xd0')]({'active':![],'countbusyretry':_0x1e681b[_0xa3e4('0x107')]+=0x1,'scheduledat':moment()['add'](_0x3cd9ba[_0xa3e4('0x1b2')],_0xa3e4('0x114'))[_0xa3e4('0x7d')](_0xa3e4('0x115')),'ContactId':_0x1e681b[_0xa3e4('0xe4')],'ListId':_0x1e681b[_0xa3e4('0xe5')],'VoiceQueueId':_0x1e681b[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x1e681b[_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x1b3')));break;case 0x8:if(_0x1e681b[_0xa3e4('0x108')]>=_0x3cd9ba['dialCongestionMaxRetry']-0x1){return!![];}this[_0xa3e4('0xd0')]({'active':![],'countcongestionretry':_0x1e681b[_0xa3e4('0x108')]+=0x1,'scheduledat':moment()[_0xa3e4('0x112')](_0x3cd9ba[_0xa3e4('0x1b4')],'minutes')[_0xa3e4('0x7d')](_0xa3e4('0x115')),'ContactId':_0x1e681b[_0xa3e4('0xe4')],'ListId':_0x1e681b['ListId'],'VoiceQueueId':_0x1e681b['VoiceQueueId']||undefined,'CampaignId':_0x1e681b[_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x1b5')));break;case 0x0:if(_0x1e681b[_0xa3e4('0x109')]>=_0x3cd9ba[_0xa3e4('0x1b6')]-0x1){return!![];}else{this[_0xa3e4('0xd0')]({'active':![],'countnosuchnumberretry':_0x1e681b[_0xa3e4('0x109')]+=0x1,'scheduledat':moment()[_0xa3e4('0x112')](_0x3cd9ba[_0xa3e4('0x1b7')],_0xa3e4('0x114'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1e681b[_0xa3e4('0xe4')],'ListId':_0x1e681b[_0xa3e4('0xe5')],'VoiceQueueId':_0x1e681b[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x1e681b[_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x1b8')));}break;case 0xa:if(_0x1e681b[_0xa3e4('0x11b')]>=_0x3cd9ba['dialDropMaxRetry']-0x1){return!![];}this[_0xa3e4('0xd0')]({'active':![],'countdropretry':_0x1e681b[_0xa3e4('0x11b')]+=0x1,'scheduledat':moment()[_0xa3e4('0x112')](_0x3cd9ba['dialDropRetryFrequency'],_0xa3e4('0x114'))[_0xa3e4('0x7d')](_0xa3e4('0x115')),'ContactId':_0x1e681b[_0xa3e4('0xe4')],'ListId':_0x1e681b[_0xa3e4('0xe5')],'VoiceQueueId':_0x1e681b[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x1e681b[_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1e681b[_0xa3e4('0x10a')]>=_0x3cd9ba['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x1e681b[_0xa3e4('0x10a')]+=0x1,'scheduledat':moment()[_0xa3e4('0x112')](_0x3cd9ba[_0xa3e4('0x13b')],_0xa3e4('0x114'))[_0xa3e4('0x7d')](_0xa3e4('0x115')),'ContactId':_0x1e681b[_0xa3e4('0xe4')],'ListId':_0x1e681b[_0xa3e4('0xe5')],'VoiceQueueId':_0x1e681b['VoiceQueueId']||undefined,'CampaignId':_0x1e681b['CampaignId']||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x13f')));break;case 0x13:if(_0x1e681b[_0xa3e4('0x103')]>=_0x3cd9ba[_0xa3e4('0x10f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x1e681b[_0xa3e4('0x103')]+=0x1,'scheduledat':moment()[_0xa3e4('0x112')](_0x3cd9ba[_0xa3e4('0x113')],_0xa3e4('0x114'))[_0xa3e4('0x7d')](_0xa3e4('0x115')),'ContactId':_0x1e681b[_0xa3e4('0xe4')],'ListId':_0x1e681b[_0xa3e4('0xe5')],'VoiceQueueId':_0x1e681b[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x1e681b[_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x116')));break;case 0x14:if(_0x1e681b[_0xa3e4('0x10b')]>=_0x3cd9ba['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xa3e4('0xd0')]({'active':![],'countagentrejectretry':_0x1e681b[_0xa3e4('0x10b')]+=0x1,'scheduledat':moment()[_0xa3e4('0x112')](_0x3cd9ba[_0xa3e4('0x1b9')],_0xa3e4('0x114'))[_0xa3e4('0x7d')](_0xa3e4('0x115')),'ContactId':_0x1e681b[_0xa3e4('0xe4')],'ListId':_0x1e681b[_0xa3e4('0xe5')],'VoiceQueueId':_0x1e681b[_0xa3e4('0xe6')]||undefined,'CampaignId':_0x1e681b[_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x1ba')));break;default:return!![];}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x1bb')]=function(_0x148893,_0x3acf1d,_0x5c3f2f){var _0xef6806=this;var _0x5791a3=new History(_0x148893);var _0x36d15d=![];var _0x50ec63;var _0x2c51e8;return new BPromise(function(_0x50782b,_0x11d622){if(_[_0xa3e4('0x3e')](_0x3acf1d)&&typeof _0x3acf1d!==_0xa3e4('0x181')){return _0x11d622(msgResponse(_0xa3e4('0x1bc'),_0xa3e4('0x15f'),_0xa3e4('0x1bd')));}if(_[_0xa3e4('0x3e')](_0x5c3f2f)&&typeof _0x5c3f2f!==_0xa3e4('0x181')){return _0x11d622(msgResponse(_0xa3e4('0x1bc'),_0xa3e4('0x15f'),_0xa3e4('0x1be')));}_0xef6806[_0xa3e4('0xc8')](_0x5791a3,_0x5c3f2f[_0xa3e4('0x123')],_0x3acf1d)[_0xa3e4('0xc3')](function(_0x2d4e5c){if(_0x2d4e5c[_0xa3e4('0x13e')]==0x1)_0x36d15d=!![];switch(_0x5c3f2f[_0xa3e4('0x123')]){case'0':_0x3acf1d[_0xa3e4('0x6a')]+=0x1;_0x5791a3[_0xa3e4('0xf9')]=0x0;_0x5791a3['statedesc']=_0xa3e4('0x1bf');_0x5791a3[_0xa3e4('0x109')]+=0x1;_0x5791a3[_0xa3e4('0x104')]+=0x1;ami[_0xa3e4('0x105')]('custom:agentnosuchnumber',ut[_0xa3e4('0xfd')](_0x148893,'nosuchnumber'));_0x50ec63=_0x3acf1d[_0xa3e4('0x1b7')];_0x2c51e8=_0x3acf1d[_0xa3e4('0x1c0')];_0xef6806[_0xa3e4('0xf0')](_0x5791a3)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x106')));if(_0xef6806[_0xa3e4('0x1ae')](0x0,_0x148893,_0x3acf1d)&&!_0x36d15d){if(_0x5791a3['countnosuchnumberretry']>=_0x3acf1d[_0xa3e4('0x1b6')]){_0xef6806[_0xa3e4('0x110')](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1c1'));}else{_0xef6806['stateGlobal'](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1c1'));}}break;case'3':_0x3acf1d['outboundNoAnswerCallsDay']+=0x1;_0x5791a3[_0xa3e4('0xf9')]=0x3;_0x5791a3[_0xa3e4('0xb3')]=_0xa3e4('0x1c2');_0x5791a3[_0xa3e4('0x11a')]+=0x1;_0x5791a3['countglobal']+=0x1;ami[_0xa3e4('0x105')](_0xa3e4('0x1c3'),ut[_0xa3e4('0xfd')](_0x148893,_0xa3e4('0x1c4')));_0x50ec63=_0x3acf1d[_0xa3e4('0x1af')];_0x2c51e8=_0x3acf1d['callAdditionalPhoneAfterMin'];_0xef6806[_0xa3e4('0xf0')](_0x5791a3)[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x1c5')));if(_0xef6806['checkRetriveMax'](0x3,_0x148893,_0x3acf1d)&&!_0x36d15d){if(_0x5791a3[_0xa3e4('0x11a')]>=_0x3acf1d[_0xa3e4('0x1c6')]){_0xef6806[_0xa3e4('0x110')](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1c7'));}else{_0xef6806[_0xa3e4('0x10d')](_0x5791a3,_0x50782b,_0x11d622,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3acf1d[_0xa3e4('0x65')]+=0x1;_0x5791a3[_0xa3e4('0xf9')]=0x5;_0x5791a3['statedesc']=_0xa3e4('0x1c8');_0x5791a3[_0xa3e4('0x107')]+=0x1;_0x5791a3['countglobal']+=0x1;ami[_0xa3e4('0x105')]('custom:agentbusy',ut['buildObj'](_0x148893,_0xa3e4('0x1c9')));_0x50ec63=_0x3acf1d[_0xa3e4('0x1b2')];_0x2c51e8=_0x3acf1d['callAdditionalPhoneAfterMin'];_0xef6806[_0xa3e4('0xf0')](_0x5791a3)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xef6806[_0xa3e4('0x1ae')](0x5,_0x148893,_0x3acf1d)&&!_0x36d15d){if(_0x5791a3[_0xa3e4('0x107')]>=_0x3acf1d[_0xa3e4('0x1b1')]){_0xef6806[_0xa3e4('0x110')](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1ca'));}else{_0xef6806[_0xa3e4('0x10d')](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1ca'));}}break;case'8':_0x3acf1d[_0xa3e4('0x66')]+=0x1;_0x5791a3['state']=0x8;_0x5791a3[_0xa3e4('0xb3')]=_0xa3e4('0x1cb');_0x5791a3[_0xa3e4('0x108')]+=0x1;_0x5791a3[_0xa3e4('0x104')]+=0x1;_0x50ec63=_0x3acf1d[_0xa3e4('0x1b4')];_0x2c51e8=_0x3acf1d[_0xa3e4('0x1c0')];ami['emit'](_0xa3e4('0x1cc'),ut[_0xa3e4('0xfd')](_0x148893,_0xa3e4('0x1cd')));_0xef6806['createHistory'](_0x5791a3)[_0xa3e4('0xc4')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xef6806[_0xa3e4('0x1ae')](0x8,_0x148893,_0x3acf1d)&&!_0x36d15d){if(_0x5791a3[_0xa3e4('0x108')]>=_0x3acf1d[_0xa3e4('0x1ce')]){_0xef6806[_0xa3e4('0x110')](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1cf'));}else{_0xef6806['stateGlobal'](_0x5791a3,_0x50782b,_0x11d622,'reason\x208\x20congestion');}}break;case'11':_0x3acf1d['outboundAbandonedCallsDay']+=0x1;_0x5791a3[_0xa3e4('0xf9')]=0xb;_0x5791a3[_0xa3e4('0xb3')]='Abandoned';_0x5791a3[_0xa3e4('0x10a')]+=0x1;_0x5791a3[_0xa3e4('0x104')]+=0x1;_0x50ec63=_0x3acf1d[_0xa3e4('0x13b')];_0x2c51e8=_0x3acf1d[_0xa3e4('0x1c0')];_0xef6806[_0xa3e4('0xf0')](_0x5791a3)['catch'](loggerCatch(_0xa3e4('0x141')));if(_0xef6806['checkRetriveMax'](0xb,_0x148893,_0x3acf1d)&&!_0x36d15d){if(_0x5791a3[_0xa3e4('0x10a')]>=_0x3acf1d[_0xa3e4('0x13d')]){_0xef6806[_0xa3e4('0x110')](_0x5791a3,_0x50782b,_0x11d622,'reason\x2011\x20abandoned');}else{_0xef6806[_0xa3e4('0x10d')](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1d0'));}}break;case'20':_0x3acf1d['outboundRejectCallsDay']+=0x1;_0x5791a3['state']=0x14;_0x5791a3[_0xa3e4('0xb3')]='AgentReject';_0x5791a3[_0xa3e4('0x10b')]+=0x1;_0x5791a3[_0xa3e4('0x104')]+=0x1;_0x50ec63=_0x3acf1d[_0xa3e4('0x1b9')];_0x2c51e8=_0x3acf1d['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0xa3e4('0xfd')](_0x148893,_0xa3e4('0x1d1')));_0xef6806[_0xa3e4('0xf0')](_0x5791a3)[_0xa3e4('0xc4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xef6806[_0xa3e4('0x1ae')](0x14,_0x148893,_0x3acf1d)&&!_0x36d15d){if(_0x5791a3[_0xa3e4('0x10b')]>=_0x3acf1d[_0xa3e4('0x1d2')]){_0xef6806['createStateFinal'](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1d3'));}else{_0xef6806[_0xa3e4('0x10d')](_0x5791a3,_0x50782b,_0x11d622,_0xa3e4('0x1d3'));}}break;default:_0x3acf1d[_0xa3e4('0x6c')]+=0x1;_0x5791a3[_0xa3e4('0xf9')]=0xc;_0x5791a3['statedesc']=_0x5c3f2f[_0xa3e4('0x123')];_0x50ec63=_0x3acf1d[_0xa3e4('0x1b9')];_0x2c51e8=_0x3acf1d[_0xa3e4('0x1c0')];_0xef6806['createHistory'](_0x5791a3)[_0xa3e4('0xc4')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0xef6806[_0xa3e4('0x1ae')](_0x5c3f2f[_0xa3e4('0x123')],_0x148893,_0x3acf1d)&&!_0x36d15d){if(_0x5791a3[_0xa3e4('0x107')]+_0x5791a3[_0xa3e4('0x108')]+_0x5791a3['countnoanswerretry']+_0x5791a3[_0xa3e4('0x109')]+_0x5791a3[_0xa3e4('0x11b')]+_0x5791a3[_0xa3e4('0x10a')]+_0x5791a3[_0xa3e4('0x103')]+_0x5791a3[_0xa3e4('0x10b')]>=_0x3acf1d[_0xa3e4('0x10c')]){_0xef6806[_0xa3e4('0x10d')](_0x5791a3,_0x50782b,_0x11d622,_0x5c3f2f[_0xa3e4('0x123')]);}else{_0xef6806[_0xa3e4('0x110')](_0x5791a3,_0x50782b,_0x11d622,_0x5c3f2f[_0xa3e4('0x123')]);}}}})[_0xa3e4('0xc3')](function(_0x1129a9){if(_0x36d15d){_0xef6806[_0xa3e4('0xca')](_0x5791a3,_0x50ec63,_0x2c51e8)['then'](function(_0x181cc9){return _0x50782b(0x1);});}});});};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x10d')]=function(_0xc75c25,_0x577ece,_0x17f40c,_0x3792b8){var _0x56b140=new Final(_0xc75c25);_0x56b140[_0xa3e4('0xf9')]=0xf;_0x56b140[_0xa3e4('0xb3')]=_0xa3e4('0x1d4');this[_0xa3e4('0x110')](_0x56b140,_0x577ece,_0x17f40c,_0x3792b8);};Dialer[_0xa3e4('0x1e')]['createStateFinal']=function(_0x4263a0,_0x5d734d,_0x30cf07,_0x59a3f8){this[_0xa3e4('0xdb')](_0x4263a0)[_0xa3e4('0xc3')](function(){return _0x5d734d(msgResponse(_0xa3e4('0x1bc'),_0xa3e4('0x1d5'),_0x59a3f8));})[_0xa3e4('0xc4')](function(){return _0x30cf07(msgResponse('[moveContactManagedDialer][0]','Failure',_0xa3e4('0x1d6')));});};Dialer[_0xa3e4('0x1e')][_0xa3e4('0xa')]=function(_0x4b0983){var _0x44410b=_0x4b0983[_0xa3e4('0x1d7')]/0x64;var _0x5aa7f0=_0x4b0983[_0xa3e4('0x12f')]/(_0x4b0983[_0xa3e4('0x12f')]+_0x4b0983[_0xa3e4('0x63')]);var _0x5b30db=Math[_0xa3e4('0x1d8')](_0x4b0983[_0xa3e4('0x75')]*(_0x4b0983['predictiveIntervalMaxThreshold']/0x64));var _0x26a91d=Math[_0xa3e4('0x1d8')](_0x4b0983[_0xa3e4('0x75')]*(_0x4b0983[_0xa3e4('0x1d9')]/0x64));var _0x44a67d=_0x4b0983['available']+_0x4b0983[_0xa3e4('0x56')];var _0x490ea0=Math['floor'](_0x4b0983[_0xa3e4('0x77')]*_0x4b0983['erlangAbandonmentRate']*_0x4b0983['predictiveIntervalHitRate']*_0x4b0983[_0xa3e4('0x1da')]);if(_['isUndefined'](_0x4b0983[_0xa3e4('0x2c')])){if(!_[_0xa3e4('0x3e')](_0x4b0983[_0xa3e4('0x2b')])){_0x4b0983[_0xa3e4('0x2b')]=undefined;loggerPredictive[_0xa3e4('0xa0')]('[startMethodPredictive][StartProgressive]',_0xa3e4('0x1db'));}if(!_['isUndefined'](_0x4b0983[_0xa3e4('0x9a')])){loggerPredictive[_0xa3e4('0xa0')](_0xa3e4('0x1dc'),_0xa3e4('0x1dd'));clearInterval(_0x4b0983['handlePredictive']);_0x4b0983[_0xa3e4('0x9a')]=undefined;}_0x4b0983[_0xa3e4('0x2c')]=moment()[_0xa3e4('0x7d')](_0xa3e4('0x115'));loggerPredictive[_0xa3e4('0x83')](_0x4b0983[_0xa3e4('0x41')],_0xa3e4('0x1de'),_0x4b0983['startProgressive']);this[_0xa3e4('0x172')](_0x4b0983,0x1);}else if(ifInterval(_0x4b0983[_0xa3e4('0x1df')],_0x4b0983[_0xa3e4('0x2c')])){this[_0xa3e4('0x172')](_0x4b0983,0x1);loggerPredictiveCalls[_0xa3e4('0x83')](_0xa3e4('0x1e0'),_0x4b0983[_0xa3e4('0x2c')],_0x4b0983['name']);_0x4b0983['erlangCalls']=0x0;_0x4b0983['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x44410b<_0x5aa7f0&&_0x4b0983[_0xa3e4('0x1e1')]===_0xa3e4('0x1e2')){freeVariablesPredictive(_0x4b0983);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xa3e4('0x1e3'),_0x5aa7f0,_0xa3e4('0x2c'),_0x4b0983['name']);}else if(_0x490ea0<_0x4b0983[_0xa3e4('0x130')]&&_0x4b0983[_0xa3e4('0x1e1')]==='dropRate'){freeVariablesPredictive(_0x4b0983);loggerPredictive['info'](_0xa3e4('0x1e4'),_0xa3e4('0x1e5'),_0x490ea0,_0xa3e4('0x1e6'),_0x4b0983['predictiveIntervalErlangCallsDroppedCalls'],_0xa3e4('0x2c'),_0x4b0983[_0xa3e4('0x41')]);}else if(!ifInterval(_0x4b0983['dialPredictiveInterval'],_0x4b0983['startProgressive'])&&_['isUndefined'](_0x4b0983['startPredictive'])&&!_[_0xa3e4('0x3e')](_0x4b0983[_0xa3e4('0x2c')])){_0x4b0983[_0xa3e4('0x2b')]=moment()[_0xa3e4('0x7d')](_0xa3e4('0x115'));loggerPredictive[_0xa3e4('0x83')](_0x4b0983['name'],_0xa3e4('0x1e7'),_0x4b0983[_0xa3e4('0x2b')]);this[_0xa3e4('0x1e8')](_0x4b0983[_0xa3e4('0x1df')])[_0xa3e4('0xc3')](this['getDataPredictive'](_0x4b0983))[_0xa3e4('0xc3')](mergeDataErlangB(_0x4b0983))[_0xa3e4('0xc3')](this['startMethodPredictive'](_0x4b0983))[_0xa3e4('0xc4')](loggerCatchPredictive(_0xa3e4('0x1e9'),_0x4b0983));}else if(!ifInterval(_0x4b0983[_0xa3e4('0x1df')],_0x4b0983[_0xa3e4('0x2b')])){_0x4b0983[_0xa3e4('0x130')]=0x0;_0x4b0983[_0xa3e4('0x2b')]=moment()[_0xa3e4('0x7d')](_0xa3e4('0x115'));loggerPredictive[_0xa3e4('0x83')](_0x4b0983['name'],_0xa3e4('0x1ea'),_0x4b0983[_0xa3e4('0x2b')]);clearInterval(_0x4b0983[_0xa3e4('0x9a')]);_0x4b0983[_0xa3e4('0x9a')]=undefined;this[_0xa3e4('0x1e8')](_0x4b0983[_0xa3e4('0x1df')])[_0xa3e4('0xc3')](this[_0xa3e4('0x1eb')](_0x4b0983))[_0xa3e4('0xc3')](mergeDataErlangB(_0x4b0983))[_0xa3e4('0xc3')](this['startMethodPredictive'](_0x4b0983))[_0xa3e4('0xc4')](loggerCatchPredictive(_0xa3e4('0x1ec'),_0x4b0983));}else if(_0x4b0983[_0xa3e4('0x75')]&&_0x44a67d<_0x4b0983[_0xa3e4('0x75')]-_0x26a91d){freeVariablesPredictive(_0x4b0983);loggerPredictive[_0xa3e4('0x83')](_0x4b0983[_0xa3e4('0x41')],_0xa3e4('0x1ed'),_0x44a67d,_0xa3e4('0x1ee'),_0x4b0983[_0xa3e4('0x75')],'-',_0x26a91d,'=',_0x4b0983[_0xa3e4('0x75')]-_0x26a91d,')');}else if(_0x4b0983[_0xa3e4('0x75')]&&_0x44a67d>_0x4b0983[_0xa3e4('0x75')]+_0x5b30db){freeVariablesPredictive(_0x4b0983);loggerPredictive['info'](_0x4b0983[_0xa3e4('0x41')],_0xa3e4('0x1ed'),_0x44a67d,_0xa3e4('0x1ef'),_0x4b0983[_0xa3e4('0x75')],'+',_0x5b30db,'=',_0x4b0983[_0xa3e4('0x75')]+_0x5b30db,')');}};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x1eb')]=function(_0x45c8fa){var _0x5c604a=this;return function(_0x4b0edc){return new BPromise(function(_0x37d94e,_0x1991b6){_['merge'](_0x45c8fa,_0x4b0edc[0x0]);if(checkGetDataPredictive(_0x4b0edc[0x0])){var _0x52c86d=_0x45c8fa['predictiveIntervalAvailable']=_0x45c8fa[_0xa3e4('0x56')]+_0x45c8fa[_0xa3e4('0x50')];var _0x46906d=_0x45c8fa[_0xa3e4('0x1df')]*0x3c;var _0xefdab5=_0x4b0edc[0x0][_0xa3e4('0x6f')]+_0x4b0edc[0x0][_0xa3e4('0x6e')];var _0x1fd685=(_0x4b0edc[0x0][_0xa3e4('0x6d')]+_0x4b0edc[0x0][_0xa3e4('0x71')]+_0x4b0edc[0x0][_0xa3e4('0x70')])/_0x4b0edc[0x0]['predictiveIntervalTotalCalls'];_0x45c8fa[_0xa3e4('0x73')]=_0x1fd685>0x0?_0x1fd685:0x1;switch(_0x45c8fa[_0xa3e4('0x1e1')]){case _0xa3e4('0x1e2'):var _0x581a25=_0x45c8fa[_0xa3e4('0x1d7')]/0x64;return _0x5c604a[_0xa3e4('0x1f0')](_0x52c86d,_0x46906d,_0xefdab5,_0x1fd685,_0x581a25)[_0xa3e4('0xc3')](function(_0x2d33a3){return _0x37d94e(_0x2d33a3);});case _0xa3e4('0x1f1'):var _0x26e2bf=_0x45c8fa[_0xa3e4('0x1d7')]/0x64;return _0x5c604a[_0xa3e4('0x1f2')](_0x52c86d,_0x46906d,_0xefdab5,_0x1fd685,_0x26e2bf)[_0xa3e4('0xc3')](function(_0x1affbb){return _0x37d94e(_0x1affbb);});default:return _0x1991b6(msgResponse('[getDataPredictive]',_0xa3e4('0x15f'),'Unknown\x20Predictive'));}}else{return _0x1991b6(msgResponse('[getDataPredictive]',_0xa3e4('0x15f'),'check\x20failure'));}});};};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x1f3')]=function(_0x4e72cb){var _0x1338f2=this;return function(_0x48b690){return new BPromise(function(_0x4225f1,_0x357e8b){_['merge'](_0x4e72cb,_0x48b690[0x0]);if(checkGetDataPredictive(_0x48b690[0x0])){loggerPredictive['info'](JSON[_0xa3e4('0x4b')](_0x48b690[0x0]));if(_0x4e72cb[_0xa3e4('0x1e1')]==='dropRate'){return _0x1338f2['getVoiceQueueRtPauses'](_0x4e72cb['id'])[_0xa3e4('0xc3')](function(_0x1a7da6){var _0x38b0c5=_0x4e72cb[_0xa3e4('0x51')]-_0x1a7da6[0x0][_0xa3e4('0x1f4')];var _0x518034=_0x4e72cb[_0xa3e4('0x1df')]*0x3c;var _0x30193a=_0x48b690[0x0][_0xa3e4('0x6f')]+_0x48b690[0x0][_0xa3e4('0x6e')];var _0x339112=(_0x48b690[0x0]['predictiveIntervalAnsweredCalls']+_0x48b690[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x48b690[0x0][_0xa3e4('0x70')])/_0x48b690[0x0][_0xa3e4('0x76')];var _0x143667=_0x4e72cb[_0xa3e4('0x1d7')]/0x64;_0x4e72cb['predictiveIntervalPauses']=_0x1a7da6[0x0][_0xa3e4('0x1f4')]||0x0;_0x4e72cb[_0xa3e4('0x73')]=_0x339112>0x0?_0x339112:0x1;return _0x1338f2[_0xa3e4('0x1f0')](_0x38b0c5,_0x518034,_0x30193a,_0x339112,_0x143667);})[_0xa3e4('0xc3')](function(_0x53fd84){return _0x4225f1(_0x53fd84);})[_0xa3e4('0xc4')](function(_0xb0b9e7){return _0x357e8b(msgResponse(_0xa3e4('0x1f5'),_0xa3e4('0x15f'),JSON[_0xa3e4('0x4b')](_0xb0b9e7)));});}if(_0x4e72cb[_0xa3e4('0x1e1')]===_0xa3e4('0x1f1')){return _0x1338f2[_0xa3e4('0xd9')](_0x4e72cb['id'])['then'](function(_0x19355d){var _0x3e53fb=_0x4e72cb[_0xa3e4('0x51')]-_0x19355d[0x0][_0xa3e4('0x1f4')];var _0x3011e1=_0x4e72cb[_0xa3e4('0x1df')]*0x3c;var _0x5a6093=_0x48b690[0x0][_0xa3e4('0x6f')]+_0x48b690[0x0][_0xa3e4('0x6e')];var _0x11ddee=(_0x48b690[0x0][_0xa3e4('0x6d')]+_0x48b690[0x0][_0xa3e4('0x71')]+_0x48b690[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x48b690[0x0][_0xa3e4('0x76')];var _0x5864da=_0x4e72cb[_0xa3e4('0x1d7')]/0x64;_0x4e72cb[_0xa3e4('0x74')]=_0x19355d[0x0][_0xa3e4('0x1f4')]||0x0;_0x4e72cb[_0xa3e4('0x73')]=_0x11ddee>0x0?_0x11ddee:0x1;return _0x1338f2[_0xa3e4('0x1f2')](_0x3e53fb,_0x3011e1,_0x5a6093,_0x11ddee,_0x5864da);})[_0xa3e4('0xc3')](function(_0x2251f9){return _0x4225f1(_0x2251f9);})[_0xa3e4('0xc4')](function(_0x111074){return _0x357e8b(msgResponse(_0xa3e4('0x1f5'),_0xa3e4('0x15f'),JSON[_0xa3e4('0x4b')](_0x111074)));});}}else{return _0x357e8b(msgResponse(_0xa3e4('0x1f6'),'Failure',_0xa3e4('0x1f7')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x5cc9b8){var _0x12d45f=this;return function(){var _0x5e5eed=0x0;var _0x380327=Math[_0xa3e4('0x1f8')](_0x5cc9b8['erlangCallToSecond']*0x3e8);if(_0x380327>0x0){_0x380327=_0x380327<0x64?0x64:_0x380327;loggerPredictive[_0xa3e4('0x83')](_0x5cc9b8[_0xa3e4('0x41')],_0xa3e4('0x1f9'),_0x380327,_0xa3e4('0x96'));_0x5cc9b8['handlePredictive']=setInterval(function(){_0x12d45f[_0xa3e4('0x9a')](_0x5cc9b8);loggerPredictiveCalls['info'](_0xa3e4('0x1fa'),_0x5e5eed+=0x1);},_0x380327);}else{loggerPredictive[_0xa3e4('0x83')](_0x5cc9b8[_0xa3e4('0x41')],_0xa3e4('0x1fb'));}};};Dialer[_0xa3e4('0x1e')]['checkContactBlack']=function(_0x405e34,_0x18dc05){var _0x4e1e65=this;return function(_0x37a032){if(_[_0xa3e4('0x49')](_0x37a032)){if(_['isNil'](_0x18dc05[_0xa3e4('0x1fc')])||!_0x18dc05['recallme']){if(_0x405e34['dialMethod']===_0xa3e4('0x9')){_0x405e34[_0xa3e4('0x147')]=_[_0xa3e4('0x3e')](_0x405e34[_0xa3e4('0x147')])?!![]:_0x405e34[_0xa3e4('0x147')];var _0x5af2ea=uuid['v4']();_0x4e1e65[_0xa3e4('0x28')][_0x5af2ea]=new Action(_0x405e34,_0x18dc05,_0x5af2ea);loggerBooked[_0xa3e4('0x83')](_0xa3e4('0x1fd'),_0x5af2ea,_0xa3e4('0x1fe'),JSON['stringify'](_0x405e34['queueStatusComplete']),_0xa3e4('0x1ff'),_0x405e34['name']);if(_0x405e34['queueStatusComplete']){_0x405e34[_0xa3e4('0x147')]=![];_0x4e1e65[_0xa3e4('0x2e')][_0x4e1e65[_0xa3e4('0x28')][_0x5af2ea]['queue']]=[];ami[_0xa3e4('0xba')]({'actionid':_0x5af2ea,'action':'queuestatus','queue':_0x405e34['name']})[_0xa3e4('0xc4')](function(){_0x4e1e65['updateOriginated'](_0x405e34);_0x4e1e65[_0xa3e4('0xd0')]({'active':![],'ContactId':_0x4e1e65['actions'][_0x5af2ea][_0xa3e4('0xe4')],'ListId':_0x4e1e65[_0xa3e4('0x28')][_0x5af2ea][_0xa3e4('0xe5')],'VoiceQueueId':_0x4e1e65[_0xa3e4('0x28')][_0x5af2ea][_0xa3e4('0xe6')]||undefined,'CampaignId':_0x4e1e65['actions'][_0x5af2ea][_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4e1e65['actions'][_0x5af2ea];});}else{loggerBooked[_0xa3e4('0x83')](_0xa3e4('0x200'),JSON['stringify'](_0x405e34[_0xa3e4('0x147')]),_0xa3e4('0x1ff'),_0x405e34[_0xa3e4('0x41')]);_0x4e1e65[_0xa3e4('0xc0')](_0x405e34);_0x4e1e65[_0xa3e4('0xd0')]({'active':![],'ContactId':_0x4e1e65[_0xa3e4('0x28')][_0x5af2ea][_0xa3e4('0xe4')],'ListId':_0x4e1e65[_0xa3e4('0x28')][_0x5af2ea][_0xa3e4('0xe5')],'VoiceQueueId':_0x4e1e65[_0xa3e4('0x28')][_0x5af2ea][_0xa3e4('0xe6')]||undefined,'CampaignId':_0x4e1e65[_0xa3e4('0x28')][_0x5af2ea]['CampaignId']||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x201')));delete _0x4e1e65[_0xa3e4('0x28')][_0x5af2ea];}}else{return _0x4e1e65['actionOriginate'](_0x405e34,_0x18dc05);}}else{if(getDiff(_0x18dc05[_0xa3e4('0x202')])<_0x405e34[_0xa3e4('0x203')]*0x3c){if(_0x18dc05[_0xa3e4('0x204')]&&!_0x18dc05[_0xa3e4('0x204')][_0xa3e4('0x205')]){_0x4e1e65['preview'][_0xa3e4('0x14a')](_0x18dc05['id'])[_0xa3e4('0x21')](function(){_0x4e1e65[_0xa3e4('0xc0')](_0x405e34);});}else{_0x4e1e65['unlockContact']({'active':![]},_0x18dc05['id'],0x1)['finally'](function(){_0x4e1e65[_0xa3e4('0xc0')](_0x405e34);});}}else{_0x405e34[_0xa3e4('0x206')]+=0x1;_0x4e1e65[_0xa3e4('0xc0')](_0x405e34);if(_0x405e34['dialRecallInQueue']){_0x4e1e65['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x18dc05[_0xa3e4('0xe4')],'ListId':_0x18dc05[_0xa3e4('0xe5')],'VoiceQueueId':_0x18dc05['VoiceQueueId']||undefined,'CampaignId':_0x18dc05[_0xa3e4('0xe7')]||undefined})[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x207')));_0x4e1e65[_0xa3e4('0xf0')](createObjHistory(_0x405e34,_0x18dc05,_0xa3e4('0x208'),0x17,_0xa3e4('0x209')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4e1e65[_0xa3e4('0xe2')](createObjHistory(_0x405e34,_0x18dc05,_0xa3e4('0x20a'),0x16,_0xa3e4('0x20b')),'[Originate][HistoryRecallClose][historyCatch]',_0xa3e4('0x20c'));}}}}else{_0x405e34[_0xa3e4('0x64')]+=0x1;_0x4e1e65['saveInDb'](createObjHistory(_0x405e34,_0x18dc05,'BLACKLIST',0xd,_0xa3e4('0x20d')),'[Originate][historyBlacklist]',_0xa3e4('0x20e'));throw _0xa3e4('0x20f');}};};Dialer['prototype'][_0xa3e4('0x178')]=function(_0x20f660){var _0x4bb3e7=this;var _0x38fa94=_0x20f660['limitCalls']-_0x20f660[_0xa3e4('0xa3')]-_0x20f660[_0xa3e4('0xd5')];emitCampaignSummary(_0x20f660);if(_0x38fa94>0x0){if(_0x38fa94>this[_0xa3e4('0x26')]){_0x38fa94=this['maxNumberOriginate'];}_0x20f660[_0xa3e4('0xd5')]+=_0x38fa94;this['getContactDialerIvr'](_0x20f660['id'],_0x38fa94,_0x20f660[_0xa3e4('0x210')],_0x20f660)[_0xa3e4('0xc3')](function(_0xd8d05d){_0x20f660[_0xa3e4('0xd5')]-=_0x38fa94;_0x20f660[_0xa3e4('0xd5')]=_0x20f660[_0xa3e4('0xd5')]>0x0?_0x20f660['temp']:0x0;if(!checkContactEmpty(_0xd8d05d)){_0x20f660[_0xa3e4('0x3f')]=_0xa3e4('0xab');logger[_0xa3e4('0x83')]('[getContactCampaign2][Empty]'+_0x20f660['name']);}else{_0x20f660[_0xa3e4('0xa3')]+=_0xd8d05d[_0xa3e4('0xa2')];_0x20f660[_0xa3e4('0x3f')]=_0xa3e4('0x211');for(var _0x1be5ba=0x0;_0x1be5ba<_0xd8d05d[_0xa3e4('0xa2')];_0x1be5ba+=0x1){_0x20f660[_0xa3e4('0x212')]+=0x1;if(_[_0xa3e4('0xf3')](_0xd8d05d[_0x1be5ba])||_['isNil'](_0xd8d05d[_0x1be5ba]['Contact'])||_[_0xa3e4('0xf3')](_0xd8d05d[_0x1be5ba][_0xa3e4('0x184')])){_0x4bb3e7[_0xa3e4('0xe0')](_0xa3e4('0x213'),_0x20f660,_0xd8d05d[_0x1be5ba]);}else{_0x4bb3e7[_0xa3e4('0xcc')](_[_0xa3e4('0xe3')](_0xd8d05d[_0x1be5ba],[_0xa3e4('0xe7'),'Contact.phone']))[_0xa3e4('0xc3')](_0x4bb3e7[_0xa3e4('0x214')](_0x20f660,_0xd8d05d[_0x1be5ba]))['catch'](_0x4bb3e7[_0xa3e4('0xdf')](_0xa3e4('0x215'),_0x20f660));}}}})['catch'](loggerGetContactDialer(_0xa3e4('0x216'),_0x20f660,_0x38fa94));}};Dialer[_0xa3e4('0x1e')]['handlePower']=function(_0x50737e,_0x8210c4){var _0x262c6d=this;var _0x525c22=[];var _0x2df162=_0x8210c4>=0x1?_0x8210c4:0x1;if(_0x50737e[_0xa3e4('0x5d')]===_0xa3e4('0x9')){_0x2df162=0x1;}var _0x4d35f0=Math[_0xa3e4('0x1f8')](_0x50737e[_0xa3e4('0x50')]*_0x2df162)-_0x50737e[_0xa3e4('0xa3')]-_0x50737e[_0xa3e4('0xd5')];emitVoiceQueueSummary(_0x50737e);if(_0x50737e[_0xa3e4('0x217')]>0x0){var _0xe80f74=_0x50737e[_0xa3e4('0x217')]-_0x50737e[_0xa3e4('0xa3')]-_0x50737e[_0xa3e4('0x56')]-_0x50737e[_0xa3e4('0xd5')]-_0x50737e[_0xa3e4('0x52')];if(_0x4d35f0>_0xe80f74){_0x4d35f0=_0xe80f74;}}if(_0x4d35f0>0x0){if(_0x50737e[_0xa3e4('0x5d')]===_0xa3e4('0x9')){_0x4d35f0=0x1;}if(_0x4d35f0>this[_0xa3e4('0x26')]){_0x4d35f0=this[_0xa3e4('0x26')];}_0x50737e[_0xa3e4('0xd5')]+=_0x4d35f0;for(var _0xf119f3 in this['agents']){if(typeof this[_0xa3e4('0x24')][_0xf119f3]!==_0xa3e4('0xa4')){if(this['agents'][_0xf119f3][_0xa3e4('0xf9')]===_0xa3e4('0x218')&&this[_0xa3e4('0x24')][_0xf119f3][_0xa3e4('0xec')]===_0xa3e4('0xed')){_0x525c22['push'](this['agents'][_0xf119f3]['id']);}}}this[_0xa3e4('0xd4')](_0x50737e['id'],_0x525c22,_0x4d35f0,_0x50737e['dialOrderByScheduledAt'],_0x50737e)['then'](function(_0x2003fc){_0x50737e['temp']-=_0x4d35f0;_0x50737e[_0xa3e4('0xd5')]=_0x50737e[_0xa3e4('0xd5')]>0x0?_0x50737e[_0xa3e4('0xd5')]:0x0;if(!checkContactEmpty(_0x2003fc)){_0x262c6d[_0xa3e4('0xc2')](_0x50737e)[_0xa3e4('0xc3')](sendMessageReschedule(_0x50737e))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x219')));}else{_0x50737e[_0xa3e4('0xa3')]+=_0x2003fc[_0xa3e4('0xa2')];_0x50737e[_0xa3e4('0x3f')]=_0x50737e['dialMethod']===_0xa3e4('0x9')?_0xa3e4('0x18c'):_0xa3e4('0x211');for(var _0x3c4165=0x0;_0x3c4165<_0x2003fc[_0xa3e4('0xa2')];_0x3c4165+=0x1){if(_[_0xa3e4('0xf3')](_0x2003fc[_0x3c4165])||_['isNil'](_0x2003fc[_0x3c4165][_0xa3e4('0x19b')])||_['isNil'](_0x2003fc[_0x3c4165][_0xa3e4('0x184')])){_0x262c6d[_0xa3e4('0xe0')](_0xa3e4('0x213'),_0x50737e,_0x2003fc[_0x3c4165]);}else{_0x262c6d['checkIsBlackList'](_[_0xa3e4('0xe3')](_0x2003fc[_0x3c4165],['VoiceQueueId',_0xa3e4('0x21a')]))['then'](_0x262c6d[_0xa3e4('0x214')](_0x50737e,_0x2003fc[_0x3c4165]))[_0xa3e4('0xc4')](_0x262c6d[_0xa3e4('0xdf')](_0xa3e4('0x213'),_0x50737e));}}}})[_0xa3e4('0xc4')](loggerGetContactDialer(_0xa3e4('0x21b'),_0x50737e,_0x4d35f0));}};Dialer['prototype'][_0xa3e4('0x9a')]=function(_0x369958){if(_0x369958[_0xa3e4('0x217')]>0x0){var _0x121a0=_0x369958['dialLimitQueue']-_0x369958['originated']-_0x369958['talking'];if(_0x121a0>0x0){this[_0xa3e4('0x21c')](_0x369958);}else{loggerPredictiveCalls[_0xa3e4('0x83')](_0xa3e4('0x21d'));}}else{this[_0xa3e4('0x21c')](_0x369958);}};Dialer[_0xa3e4('0x1e')]['tryOriginatePredictive']=function(_0x3c44e1){var _0x3b34ab=this;var _0x47116b=[];_0x3c44e1[_0xa3e4('0xa3')]+=0x1;for(var _0x18af94 in this[_0xa3e4('0x24')]){if(typeof this['agents'][_0x18af94]!==_0xa3e4('0xa4')){if(this[_0xa3e4('0x24')][_0x18af94][_0xa3e4('0xf9')]===_0xa3e4('0x218')&&this['agents'][_0x18af94][_0xa3e4('0xec')]==='reachable'){_0x47116b[_0xa3e4('0x146')](this[_0xa3e4('0x24')][_0x18af94]['id']);}}}this['getContactDialer'](_0x3c44e1['id'],_0x47116b,0x1,_0x3c44e1['dialOrderByScheduledAt'],_0x3c44e1)[_0xa3e4('0xc3')](function(_0x3fc521){if(!checkContactEmpty(_0x3fc521)){checkContactLowerLimitOriginate(_0x3c44e1,0x1,0x0);_0x3b34ab[_0xa3e4('0xc2')](_0x3c44e1)['then'](sendMessageReschedule(_0x3c44e1))[_0xa3e4('0xc4')](loggerCatch(_0xa3e4('0x219')));}else{_0x3c44e1[_0xa3e4('0x3f')]=_0xa3e4('0x211');if(_[_0xa3e4('0xf3')](_0x3fc521[0x0])||_[_0xa3e4('0xf3')](_0x3fc521[0x0][_0xa3e4('0x19b')])||_[_0xa3e4('0xf3')](_0x3fc521[0x0][_0xa3e4('0x184')])){_0x3b34ab[_0xa3e4('0xe0')](_0xa3e4('0x213'),_0x3c44e1,_0x3fc521[0x0]);}else{_0x3b34ab[_0xa3e4('0xc6')](_[_0xa3e4('0xe3')](_0x3fc521[0x0],[_0xa3e4('0xe6'),_0xa3e4('0x21a')]))[_0xa3e4('0xc3')](_0x3b34ab[_0xa3e4('0x214')](_0x3c44e1,_0x3fc521[0x0]))[_0xa3e4('0xc4')](_0x3b34ab[_0xa3e4('0xdf')]('[actionOriginatePredictive]\x20',_0x3c44e1));}}})[_0xa3e4('0xc4')](loggerGetContactDialer(_0xa3e4('0x21e'),_0x3c44e1,0x1));emitVoiceQueueSummary(_0x3c44e1);};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x1f0')]=function(_0x396cdf,_0x3fc662,_0x1f3851,_0x4ef2f7,_0x3ac9af,_0x173819){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xa3e4('0x21f'),_0x396cdf);loggerPredictive[_0xa3e4('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3fc662);loggerPredictive['info'](_0xa3e4('0x220'),_0x1f3851);loggerPredictive[_0xa3e4('0x83')]('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',_0x4ef2f7);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x221'),_0x3ac9af);loggerPredictive['info'](_0xa3e4('0x8b'));return new BPromise(function(_0x591c4a,_0x3f7f43){if(_0x396cdf<=0x0||isNaN(_0x396cdf)){return _0x3f7f43(msgResponse(_0xa3e4('0x222'),'Error',_0xa3e4('0x223')+_0x396cdf));}if(_0x1f3851<=0x0||isNaN(_0x1f3851)){return _0x3f7f43(msgResponse('[abandonmentRate]',_0xa3e4('0x1ab'),_0xa3e4('0x224')+_0x1f3851));}if(_0x4ef2f7<=0x0||isNaN(_0x4ef2f7)){return _0x3f7f43(msgResponse(_0xa3e4('0x222'),_0xa3e4('0x1ab'),_0xa3e4('0x225')+_0x4ef2f7));}if(_0x3fc662<=0x0||isNaN(_0x3fc662)){return _0x3f7f43(msgResponse(_0xa3e4('0x222'),'Error',_0xa3e4('0x226')+_0x3fc662));}if(_0x3ac9af<=0x0||isNaN(_0x3ac9af)){return _0x3f7f43(msgResponse('[abandonmentRate]',_0xa3e4('0x1ab'),_0xa3e4('0x227')+_0x3ac9af));}_0x173819=_0x173819||0x0;var _0x57bf0a=0x1/_0x1f3851;var _0x4a4277=0x0;var _0x266ef6=0x0;var _0x4a3b9e=0x0;var _0x47986a=0x0;for(var _0x593e93=0x0;_0x4a3b9e<_0x3ac9af;_0x593e93+=0x1){_0x266ef6=_0x593e93/_0x3fc662;_0x4a4277=(_0x4ef2f7*_0x266ef6+_0x173819)/_0x57bf0a;_0x4a3b9e=erlangb(_0x4a4277,_0x396cdf);_0x47986a=_0x4a4277/_0x396cdf*(0x1-erlangb(_0x4a4277,_0x396cdf));}return _0x591c4a({'erlangCalls':_0x593e93,'erlangCallToSecond':_0x3fc662/_0x593e93,'erlangAbandonmentRate':_0x4a3b9e,'erlangBusyFactor':_0x47986a});});};Dialer[_0xa3e4('0x1e')][_0xa3e4('0x1f2')]=function(_0x52adbd,_0x2e89bf,_0x40e99c,_0x9e16a8,_0xb72560,_0x2451f4){loggerPredictive['info'](_0xa3e4('0x228'));loggerPredictive['info'](_0xa3e4('0x21f'),_0x52adbd);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x229'),_0x2e89bf);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x220'),_0x40e99c);loggerPredictive['info'](_0xa3e4('0x22a'),_0x9e16a8);loggerPredictive[_0xa3e4('0x83')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb72560);loggerPredictive[_0xa3e4('0x83')](_0xa3e4('0x8b'));return new BPromise(function(_0x1b35a9,_0x24c69c){if(_0x52adbd<=0x0||isNaN(_0x52adbd)){return _0x24c69c(msgResponse(_0xa3e4('0x22b'),_0xa3e4('0x1ab'),_0xa3e4('0x223')+_0x52adbd));}if(_0x40e99c<=0x0||isNaN(_0x40e99c)){return _0x24c69c(msgResponse(_0xa3e4('0x22b'),_0xa3e4('0x1ab'),_0xa3e4('0x224')+_0x40e99c));}if(_0x9e16a8<=0x0||isNaN(_0x9e16a8)){return _0x24c69c(msgResponse('[busyFactor]',_0xa3e4('0x1ab'),_0xa3e4('0x225')+_0x9e16a8));}if(_0x2e89bf<=0x0||isNaN(_0x2e89bf)){return _0x24c69c(msgResponse('[busyFactor]',_0xa3e4('0x1ab'),_0xa3e4('0x226')+_0x2e89bf));}if(_0xb72560<=0x0||isNaN(_0xb72560)){return _0x24c69c(msgResponse(_0xa3e4('0x22b'),_0xa3e4('0x1ab'),_0xa3e4('0x22c')+_0xb72560));}_0x2451f4=_0x2451f4||0x0;var _0x228558=0x1/_0x40e99c;var _0x353122=0x0;var _0x2c3b02=0x0;var _0x135947=0x0;var _0x485f94=0x0;for(var _0x1d9840=0x0;_0x485f94<_0xb72560;_0x1d9840+=0x1){_0x2c3b02=_0x1d9840/_0x2e89bf;_0x353122=(_0x9e16a8*_0x2c3b02+_0x2451f4)/_0x228558;_0x135947=erlangb(_0x353122,_0x52adbd);_0x485f94=_0x353122/_0x52adbd*(0x1-erlangb(_0x353122,_0x52adbd));}return _0x1b35a9({'erlangCalls':_0x1d9840,'erlangCallToSecond':_0x2e89bf/_0x1d9840,'erlangAbandonmentRate':_0x135947,'erlangBusyFactor':_0x485f94});});};module[_0xa3e4('0x22d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index b491c89..b86f376 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 _0xaea8=['responsetime','droptime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x297057,_0x11e912){var _0x42f8bb=function(_0x17c117){while(--_0x17c117){_0x297057['push'](_0x297057['shift']());}};_0x42f8bb(++_0x11e912);}(_0xaea8,0x152));var _0x8aea=function(_0x71288,_0x431f06){_0x71288=_0x71288-0x0;var _0x5b38ed=_0xaea8[_0x71288];return _0x5b38ed;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8aea('0x0'));function getSeconds(_0x18dc2b,_0x340ed2){var _0x51ae0c=moment(_0x18dc2b)[_0x8aea('0x1')](0x0);var _0x203fcb=moment(_0x340ed2)[_0x8aea('0x1')](0x0);return _0x51ae0c[_0x8aea('0x2')](_0x203fcb,'seconds');}function QueueCallerAbandon(_0x329586,_0x36291a){this[_0x8aea('0x3')]=_0x329586[_0x8aea('0x3')];this['type']=_0x329586[_0x8aea('0x4')];this[_0x8aea('0x5')]=_0x329586[_0x8aea('0x4')]===_0x8aea('0x6')?'queue':_0x329586[_0x8aea('0x4')];this['countbusyretry']=_0x329586[_0x8aea('0x7')];this[_0x8aea('0x8')]=_0x329586['countcongestionretry'];this[_0x8aea('0x9')]=_0x329586[_0x8aea('0x9')];this[_0x8aea('0xa')]=_0x329586[_0x8aea('0x7')]+_0x329586[_0x8aea('0x8')]+_0x329586[_0x8aea('0x9')]+_0x329586[_0x8aea('0xb')]+_0x329586['countdropretry']+_0x329586[_0x8aea('0xc')]+_0x329586[_0x8aea('0xd')]+_0x329586[_0x8aea('0xe')];this['countnosuchnumberretry']=_0x329586[_0x8aea('0xb')];this[_0x8aea('0xf')]=_0x329586[_0x8aea('0xf')];this['countabandonedretry']=_0x329586[_0x8aea('0xc')];this[_0x8aea('0xd')]=_0x329586[_0x8aea('0xd')];this[_0x8aea('0xe')]=_0x329586[_0x8aea('0xe')];this['uniqueid']=_0x36291a[_0x8aea('0x10')];this[_0x8aea('0x11')]=_0x329586[_0x8aea('0x12')];this[_0x8aea('0x13')]=_0x329586[_0x8aea('0x14')];this[_0x8aea('0x15')]=_0x329586[_0x8aea('0x15')];this[_0x8aea('0x16')]=_0x329586[_0x8aea('0x16')];this[_0x8aea('0x17')]=_0x329586[_0x8aea('0x17')];this[_0x8aea('0x18')]=this['droptime'];this['ringtime']=getSeconds(_0x329586[_0x8aea('0x16')],_0x329586[_0x8aea('0x15')]);this['holdtime']=getSeconds(this[_0x8aea('0x17')],_0x329586[_0x8aea('0x16')]);this['talktime']=0x0;this[_0x8aea('0x19')]=_0x36291a[_0x8aea('0x19')];this[_0x8aea('0x1a')]=_0x36291a['connectedlinename'];this[_0x8aea('0x1b')]=_0x36291a[_0x8aea('0x1b')];this['callback']=_0x329586[_0x8aea('0x1c')];this[_0x8aea('0x1d')]=_0x329586[_0x8aea('0x1d')];this[_0x8aea('0x1e')]=_0x329586[_0x8aea('0x1e')];this[_0x8aea('0x1f')]=_0x329586[_0x8aea('0x1f')];this[_0x8aea('0x20')]=_0x329586[_0x8aea('0x20')];this[_0x8aea('0x21')]=_0x329586[_0x8aea('0x21')];this[_0x8aea('0x22')]=_0x329586[_0x8aea('0x22')];this['VoiceQueueId']=_0x329586[_0x8aea('0x23')];this[_0x8aea('0x24')]=_0x329586[_0x8aea('0x24')];this[_0x8aea('0x25')]=_0x329586['originatecalleridnum']||'';this[_0x8aea('0x26')]=_0x329586['originatecalleridname']||'';}module[_0x8aea('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x4166=['responsetime','droptime','ringtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','number','starttime'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4166,0xdb));var _0x6416=function(_0x4799bf,_0x145838){_0x4799bf=_0x4799bf-0x0;var _0x436ef4=_0x4166[_0x4799bf];return _0x436ef4;};'use strict';var util=require(_0x6416('0x0'));var _=require(_0x6416('0x1'));var moment=require(_0x6416('0x2'));function getSeconds(_0x578968,_0x4b1e00){var _0x34241e=moment(_0x578968)['milliseconds'](0x0);var _0x5acf33=moment(_0x4b1e00)['milliseconds'](0x0);return _0x34241e['diff'](_0x5acf33,'seconds');}function QueueCallerAbandon(_0x3023ff,_0x360e4f){this[_0x6416('0x3')]=_0x3023ff[_0x6416('0x3')];this[_0x6416('0x4')]=_0x3023ff[_0x6416('0x4')];this[_0x6416('0x5')]=_0x3023ff[_0x6416('0x4')]===_0x6416('0x6')?_0x6416('0x7'):_0x3023ff[_0x6416('0x4')];this[_0x6416('0x8')]=_0x3023ff[_0x6416('0x8')];this[_0x6416('0x9')]=_0x3023ff['countcongestionretry'];this['countnoanswerretry']=_0x3023ff['countnoanswerretry'];this['countglobal']=_0x3023ff['countbusyretry']+_0x3023ff[_0x6416('0x9')]+_0x3023ff[_0x6416('0xa')]+_0x3023ff['countnosuchnumberretry']+_0x3023ff['countdropretry']+_0x3023ff[_0x6416('0xb')]+_0x3023ff[_0x6416('0xc')]+_0x3023ff[_0x6416('0xd')];this[_0x6416('0xe')]=_0x3023ff[_0x6416('0xe')];this['countdropretry']=_0x3023ff[_0x6416('0xf')];this[_0x6416('0xb')]=_0x3023ff[_0x6416('0xb')];this['countmachineretry']=_0x3023ff[_0x6416('0xc')];this['countagentrejectretry']=_0x3023ff[_0x6416('0xd')];this[_0x6416('0x10')]=_0x360e4f['uniqueid'];this[_0x6416('0x11')]=_0x3023ff[_0x6416('0x12')];this['calleridnum']=_0x3023ff[_0x6416('0x13')];this[_0x6416('0x14')]=_0x3023ff['starttime'];this[_0x6416('0x15')]=_0x3023ff['responsetime'];this[_0x6416('0x16')]=_0x3023ff[_0x6416('0x16')];this['endtime']=this[_0x6416('0x16')];this[_0x6416('0x17')]=getSeconds(_0x3023ff[_0x6416('0x15')],_0x3023ff[_0x6416('0x14')]);this['holdtime']=getSeconds(this[_0x6416('0x16')],_0x3023ff[_0x6416('0x15')]);this[_0x6416('0x18')]=0x0;this['queue']=_0x360e4f[_0x6416('0x7')];this[_0x6416('0x19')]=_0x360e4f[_0x6416('0x1a')];this[_0x6416('0x1b')]=_0x360e4f[_0x6416('0x1b')];this[_0x6416('0x1c')]=_0x3023ff[_0x6416('0x1c')];this['callbackuniqueid']=_0x3023ff[_0x6416('0x1d')];this[_0x6416('0x1e')]=_0x3023ff[_0x6416('0x1e')];this[_0x6416('0x1f')]=_0x3023ff[_0x6416('0x1f')];this[_0x6416('0x20')]=_0x3023ff[_0x6416('0x20')];this[_0x6416('0x21')]=_0x3023ff[_0x6416('0x21')];this[_0x6416('0x22')]=_0x3023ff['UserId'];this['VoiceQueueId']=_0x3023ff[_0x6416('0x23')];this[_0x6416('0x24')]=_0x3023ff[_0x6416('0x24')];this[_0x6416('0x25')]=_0x3023ff[_0x6416('0x25')]||'';this[_0x6416('0x26')]=_0x3023ff[_0x6416('0x26')]||'';}module[_0x6416('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 25d3157..694ae99 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 _0x4c6d=['path','AttachmentId','util','moment','uniqueid','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo'];(function(_0xbb1170,_0xe8069c){var _0x1693f2=function(_0x502f08){while(--_0x502f08){_0xbb1170['push'](_0xbb1170['shift']());}};_0x1693f2(++_0xe8069c);}(_0x4c6d,0x6a));var _0xd4c6=function(_0x275fa7,_0x4085ea){_0x275fa7=_0x275fa7-0x0;var _0x30739f=_0x4c6d[_0x275fa7];return _0x30739f;};'use strict';var util=require(_0xd4c6('0x0'));var _=require('lodash');var moment=require(_0xd4c6('0x1'));function Action(_0x390353,_0x1bf5f2,_0x23e48b){this[_0xd4c6('0x2')]=_0x390353||undefined;this['channel']=util[_0xd4c6('0x3')](_0xd4c6('0x4'),_0x1bf5f2[_0xd4c6('0x5')],_0x1bf5f2[_0xd4c6('0x6')][_0xd4c6('0x7')],_0x23e48b[_0xd4c6('0x8')]);this[_0xd4c6('0x9')]=_0x1bf5f2['localstationid'];this['headerinfo']=_0x1bf5f2[_0xd4c6('0xa')];this[_0xd4c6('0xb')]=_0x23e48b['path'];this[_0xd4c6('0xc')]=_0x23e48b['AttachmentId'];}module['exports']=Action; \ No newline at end of file +var _0xf540=['Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','uniqueid','channel','format','%s/%s/%s','tech'];(function(_0x2cc900,_0x297449){var _0x5c7d75=function(_0x18131c){while(--_0x18131c){_0x2cc900['push'](_0x2cc900['shift']());}};_0x5c7d75(++_0x297449);}(_0xf540,0xad));var _0x0f54=function(_0x5cbb98,_0x161894){_0x5cbb98=_0x5cbb98-0x0;var _0x13ac82=_0xf540[_0x5cbb98];return _0x13ac82;};'use strict';var util=require(_0x0f54('0x0'));var _=require(_0x0f54('0x1'));var moment=require('moment');function Action(_0x4cbfac,_0x128670,_0x15dee2){this[_0x0f54('0x2')]=_0x4cbfac||undefined;this[_0x0f54('0x3')]=util[_0x0f54('0x4')](_0x0f54('0x5'),_0x128670[_0x0f54('0x6')],_0x128670[_0x0f54('0x7')][_0x0f54('0x8')],_0x15dee2[_0x0f54('0x9')]);this[_0x0f54('0xa')]=_0x128670[_0x0f54('0xa')];this['headerinfo']=_0x128670[_0x0f54('0xb')];this[_0x0f54('0xc')]=_0x15dee2[_0x0f54('0xc')];this[_0x0f54('0xd')]=_0x15dee2['AttachmentId'];}module[_0x0f54('0xe')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 9657db9..6ab292e 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 _0xb200=['merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','util','moment','./util/gs','../../../config/logger','fax','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','syncVarSet','bind','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','hasOwnProperty','channels','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','syncOriginateResponse'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0xb200,0x180));var _0x0b20=function(_0x291b8f,_0x3b8484){_0x291b8f=_0x291b8f-0x0;var _0x3b504b=_0xb200[_0x291b8f];return _0x3b504b;};'use strict';var util=require(_0x0b20('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x0b20('0x1'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x0b20('0x2'));var logger=require(_0x0b20('0x3'))(_0x0b20('0x4'));var ami=require('../ami');var rpcDb=require(_0x0b20('0x5'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x0b20('0x6'));var faxAccount=require(_0x0b20('0x7'));var attachment=require(_0x0b20('0x8'));var faxMessage=require(_0x0b20('0x9'));function Fax(_0x3c2296){this['channels']={};this[_0x0b20('0xa')]=_0x3c2296[_0x0b20('0xa')];this['trunks']=_0x3c2296[_0x0b20('0xb')];this['actions']={};ami['on'](_0x0b20('0xc'),this[_0x0b20('0xd')]['bind'](this));ami['on']('varset',this[_0x0b20('0xe')][_0x0b20('0xf')](this));ami['on']('newstate',this[_0x0b20('0x10')][_0x0b20('0xf')](this));ami['on']('newexten',this[_0x0b20('0x11')][_0x0b20('0xf')](this));ami['on'](_0x0b20('0x12'),this[_0x0b20('0x13')][_0x0b20('0xf')](this));ami['on'](_0x0b20('0x14'),this[_0x0b20('0x15')][_0x0b20('0xf')](this));ami['on']('hangup',this[_0x0b20('0x16')][_0x0b20('0xf')](this));ami['on'](_0x0b20('0x17'),this['syncOriginateResponse'][_0x0b20('0xf')](this));}Fax[_0x0b20('0x18')]['syncNewchannel']=function(_0x3d8be9){if(_0x3d8be9[_0x0b20('0x19')]==='from-voip-provider'){for(var _0x574f2b in this[_0x0b20('0xa')]){if(this[_0x0b20('0xa')][_0x0b20('0x1a')](_0x574f2b)){if(_0x3d8be9['exten']===this[_0x0b20('0xa')][_0x574f2b]['localstationid']){this[_0x0b20('0x1b')][_0x3d8be9[_0x0b20('0x1c')]]={};this['channels'][_0x3d8be9[_0x0b20('0x1c')]][_0x0b20('0x1d')]=_0x3d8be9[_0x0b20('0x1d')];this[_0x0b20('0x1b')][_0x3d8be9['uniqueid']]['id']=this[_0x0b20('0xa')][_0x574f2b]['id'];this[_0x0b20('0x1b')][_0x3d8be9[_0x0b20('0x1c')]][_0x0b20('0x1e')]=this[_0x0b20('0xa')][_0x574f2b]['name'];logger['info'](_0x3d8be9[_0x0b20('0x1c')],_0x0b20('0x1f'));}}}}if(this[_0x0b20('0x20')][_0x3d8be9[_0x0b20('0x1c')]]){this[_0x0b20('0x1b')][_0x3d8be9[_0x0b20('0x1c')]]={};this[_0x0b20('0x1b')][_0x3d8be9['uniqueid']][_0x0b20('0x1d')]=_0x3d8be9[_0x0b20('0x1d')];logger[_0x0b20('0x21')](_0x3d8be9[_0x0b20('0x1c')],_0x0b20('0x1f'));}};Fax['prototype'][_0x0b20('0xe')]=function(_0x3c3b9e){if(this[_0x0b20('0x1b')][_0x3c3b9e[_0x0b20('0x1c')]]){for(var _0x5ac2c1 in _0x3c3b9e[_0x0b20('0x22')]){if(_0x3c3b9e['variable'][_0x0b20('0x1a')](_0x5ac2c1)){this['channels'][_0x3c3b9e[_0x0b20('0x1c')]][_0x5ac2c1]=_0x3c3b9e[_0x0b20('0x23')];}}}};Fax['prototype'][_0x0b20('0x10')]=function(_0x179ff5){if(this[_0x0b20('0x1b')][_0x179ff5[_0x0b20('0x1c')]]){this['channels'][_0x179ff5[_0x0b20('0x1c')]]['channelstate']=_0x179ff5[_0x0b20('0x24')];this[_0x0b20('0x1b')][_0x179ff5[_0x0b20('0x1c')]][_0x0b20('0x25')]=_0x179ff5['channelstatedesc'];}};Fax['prototype'][_0x0b20('0x11')]=function(_0x19d707){if(this[_0x0b20('0x1b')][_0x19d707['uniqueid']]){for(var _0x1c5d8e in _0x19d707['variable']){if(_0x19d707[_0x0b20('0x22')][_0x0b20('0x1a')](_0x1c5d8e)){this['channels'][_0x19d707[_0x0b20('0x1c')]][_0x1c5d8e]=_0x19d707[_0x0b20('0x23')];}}}};Fax[_0x0b20('0x18')][_0x0b20('0x13')]=function(_0x269690){if(this['channels'][_0x269690[_0x0b20('0x1c')]]){this[_0x0b20('0x1b')][_0x269690['uniqueid']]['operation']=_0x269690[_0x0b20('0x26')];this[_0x0b20('0x1b')][_0x269690[_0x0b20('0x1c')]][_0x0b20('0x27')]=_0x269690[_0x0b20('0x27')];this[_0x0b20('0x1b')][_0x269690[_0x0b20('0x1c')]][_0x0b20('0x28')]=_0x269690['localstationid'];this[_0x0b20('0x1b')][_0x269690['uniqueid']][_0x0b20('0x29')]=_0x269690[_0x0b20('0x29')];logger[_0x0b20('0x21')](_0x269690[_0x0b20('0x1c')],_0x0b20('0x2a'));}};Fax['prototype'][_0x0b20('0x15')]=function(_0x4012e1){var _0x487f17=this;if(this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]]){var _0x2ddf5f=this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]]['id'];this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]][_0x0b20('0x2b')]=_0x4012e1[_0x0b20('0x2b')];this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]][_0x0b20('0x2c')]=_0x4012e1[_0x0b20('0x2c')];this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]][_0x0b20('0x28')]=_0x4012e1[_0x0b20('0x28')];this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]][_0x0b20('0x2d')]=_0x4012e1[_0x0b20('0x2d')];this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]][_0x0b20('0x2e')]=_0x4012e1['transferrate'];this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]][_0x0b20('0x29')]=_0x4012e1['filename'];this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]][_0x0b20('0x2f')]=_0x4012e1[_0x0b20('0x2f')];if(this[_0x0b20('0x1b')][_0x4012e1[_0x0b20('0x1c')]][_0x0b20('0x2c')]>0x0){tiff2pdf(_0x4012e1[_0x0b20('0x29')],'/var/opt/motion2/server/files/attachments/',function(_0x587a96){logger[_0x0b20('0x21')](_0x4012e1[_0x0b20('0x1c')],_0x0b20('0x30'),_0x587a96[_0x0b20('0x31')]);attachment[_0x0b20('0x32')]({'name':path[_0x0b20('0x33')](_0x4012e1[_0x0b20('0x29')])[_0x0b20('0x1e')],'basename':path[_0x0b20('0x33')](_0x4012e1[_0x0b20('0x29')])[_0x0b20('0x1e')]+_0x0b20('0x34'),'type':'application/pdf'})['then'](function(_0x4a500a){faxAccount[_0x0b20('0x35')](_0x2ddf5f,{'from':_0x4012e1[_0x0b20('0x2f')],'mapKey':_0x0b20('0x4'),'body':path['parse'](_0x4012e1[_0x0b20('0x29')])[_0x0b20('0x1e')]+_0x0b20('0x34'),'AttachmentId':_0x4a500a['id']})['catch'](function(_0xb5bc61){logger['error'](_0x4012e1['uniqueid'],_0x0b20('0x36'),JSON[_0x0b20('0x37')](_0xb5bc61));});})[_0x0b20('0x38')](function(_0x10bbb7){logger[_0x0b20('0x39')](_0x4012e1[_0x0b20('0x1c')],_0x0b20('0x3a'),JSON[_0x0b20('0x37')](_0x10bbb7));});});}logger[_0x0b20('0x21')](_0x4012e1[_0x0b20('0x1c')],_0x0b20('0x3a'));}};Fax['prototype'][_0x0b20('0x3b')]=function(_0x30b41e){if(this[_0x0b20('0x20')][_0x30b41e[_0x0b20('0x1c')]]){_[_0x0b20('0x3c')](this[_0x0b20('0x1b')][_0x30b41e[_0x0b20('0x1c')]],_[_0x0b20('0x3d')](_0x30b41e,[_0x0b20('0x3e'),'reason']));}};function updateStatus(_0x165f21){if(_0x165f21[_0x0b20('0x3f')]){faxMessage['update'](_0x165f21[_0x0b20('0x3f')],{'failMessage':_0x0b20('0x40')})[_0x0b20('0x41')](function(_0x20a9c9){ut[_0x0b20('0x42')]('[Fax][Message][Error][Updated]',_0x20a9c9);})['catch'](function(_0x9142f4){ut[_0x0b20('0x42')]('[Fax][Message][Error][NoUpdate1]',_0x9142f4);});}else{ut[_0x0b20('0x42')](_0x0b20('0x43'));}}Fax[_0x0b20('0x18')][_0x0b20('0x44')]=function(_0x2c5986,_0xfaa23f,_0x264a35){var _0x2ece1b=this;var _0x2a4f1e={};if(_0xfaa23f){_0x2a4f1e={'read':_0xfaa23f};}else{_0x2a4f1e={'failMessage':_0x264a35};}if(this[_0x0b20('0x20')][_0x2c5986][_0x0b20('0x3f')]){faxMessage[_0x0b20('0x45')](this['actions'][_0x2c5986][_0x0b20('0x3f')],_0x2a4f1e)[_0x0b20('0x41')](function(_0x1fadd4){ut[_0x0b20('0x42')](_0x0b20('0x46'),_0x1fadd4);})[_0x0b20('0x38')](function(_0x483b33){ut[_0x0b20('0x42')](_0x0b20('0x47'),_0x483b33);})['finally'](function(){delete _0x2ece1b[_0x0b20('0x1b')][_0x2c5986];delete _0x2ece1b[_0x0b20('0x20')][_0x2c5986];});}else{ut[_0x0b20('0x42')](_0x0b20('0x48'));delete this[_0x0b20('0x1b')][_0x2c5986];delete this[_0x0b20('0x20')][_0x2c5986];}};Fax[_0x0b20('0x18')][_0x0b20('0x16')]=function(_0x105cc9){var _0x5991cb=this;if(this[_0x0b20('0x1b')][_0x105cc9[_0x0b20('0x1c')]]){if(this[_0x0b20('0x20')][_0x105cc9[_0x0b20('0x1c')]]){this['channels'][_0x105cc9[_0x0b20('0x1c')]]['id']=this[_0x0b20('0x20')][_0x105cc9[_0x0b20('0x1c')]]['id'];this[_0x0b20('0x1b')][_0x105cc9[_0x0b20('0x1c')]][_0x0b20('0x1e')]=this[_0x0b20('0x20')][_0x105cc9['uniqueid']][_0x0b20('0x1e')];}logger[_0x0b20('0x21')](_0x105cc9[_0x0b20('0x1c')],this[_0x0b20('0x20')][_0x105cc9[_0x0b20('0x1c')]]?_0x0b20('0x49'):_0x0b20('0x4a'),JSON[_0x0b20('0x37')](this[_0x0b20('0x1b')][_0x105cc9['uniqueid']]));if(this[_0x0b20('0x20')][_0x105cc9[_0x0b20('0x1c')]]){if(this[_0x0b20('0x1b')][_0x105cc9[_0x0b20('0x1c')]][_0x0b20('0x4b')]>0x0&&this[_0x0b20('0x1b')][_0x105cc9[_0x0b20('0x1c')]][_0x0b20('0x12')]===_0x0b20('0x4c')){this[_0x0b20('0x44')](_0x105cc9['uniqueid'],!![]);}else{this[_0x0b20('0x44')](_0x105cc9[_0x0b20('0x1c')],![],this[_0x0b20('0x1b')][_0x105cc9[_0x0b20('0x1c')]][_0x0b20('0x4d')]?_0x0b20('0x4e')+this['channels'][_0x105cc9[_0x0b20('0x1c')]][_0x0b20('0x4d')]:_0x0b20('0x4f'));}}}};Fax['prototype'][_0x0b20('0x50')]=function(_0x50948b){var _0x30aa1b=this;return new BPromise(function(_0x481498,_0x476852){_0x30aa1b[_0x0b20('0x51')](_0x50948b,_0x30aa1b[_0x0b20('0xa')][_0x50948b['FaxAccountId']])[_0x0b20('0x41')](function(_0x10592d){ut['logger']('[Fax][execOriginate][success]',_0x10592d);_0x481498(ut[_0x0b20('0x31')]('Fax\x20received'));})[_0x0b20('0x38')](function(_0x153d32){ut['logger'](_0x0b20('0x52'),_0x153d32);updateStatus(_0x50948b);_0x476852(ut[_0x0b20('0x31')](_0x0b20('0x53')));});});};Fax['prototype']['checkAfterSend']=function(_0x570a59){var _0x4b0abe=this;return new BPromise(function(_0x2bf564,_0x338698){var _0x4eba58=_0x4b0abe[_0x0b20('0x54')](_0x4b0abe[_0x0b20('0xa')][_0x570a59[_0x0b20('0x55')]][_0x0b20('0x56')],_0x570a59);if(_0x4eba58['isValid']){_0x2bf564(ut[_0x0b20('0x31')](_0x0b20('0x57')));}else{_0x338698(ut['message'](_0x4eba58[_0x0b20('0x31')]));}});};function originate(_0x1d8768,_0x3adedf,_0x4187d6){return new BPromise(function(_0x338107,_0x5cecf1){if(_0x4187d6){var _0x9ef1ef=util[_0x0b20('0x58')](_0x0b20('0x59'),path[_0x0b20('0x33')](_0x1d8768[_0x0b20('0x5a')])[_0x0b20('0x1e')],_0x1d8768[_0x0b20('0x5a')]);gs[_0x0b20('0x5b')](_0x9ef1ef)[_0x0b20('0x41')](function(){_0x1d8768['path']=util[_0x0b20('0x58')]('%s/%s.tif',path[_0x0b20('0x33')](_0x1d8768[_0x0b20('0x5a')])[_0x0b20('0x5c')],path['parse'](_0x1d8768[_0x0b20('0x5a')])['name']);_0x3adedf[_0x0b20('0x5d')]=_0x1d8768['path'];ut[_0x0b20('0x42')](_0x0b20('0x5e'),'');ami[_0x0b20('0x5f')](ut[_0x0b20('0x60')](_0x1d8768,_0x3adedf))[_0x0b20('0x41')](function(_0x215684){_0x338107(_0x215684);})[_0x0b20('0x38')](function(_0x105927){_0x5cecf1(_0x105927);});})[_0x0b20('0x38')](function(_0x40fa7d){_0x5cecf1(_0x40fa7d);});}else{ami[_0x0b20('0x5f')](ut[_0x0b20('0x60')](_0x1d8768,_0x3adedf))[_0x0b20('0x41')](function(_0x418acd){_0x338107(_0x418acd);})[_0x0b20('0x38')](function(_0x1bf405){_0x5cecf1(_0x1bf405);});}});}Fax['prototype']['execOriginate']=function(_0x4d3b52,_0x17e77f){var _0x5eed1d=this;return new BPromise(function(_0x25456d,_0x5a77e2){var _0x2ce626=uuid['v4']();var _0x13a363=ut[_0x0b20('0x61')](_0x4d3b52,_0x17e77f);_0x5eed1d[_0x0b20('0x20')][_0x2ce626]=new Action(_0x2ce626,_0x17e77f,_0x4d3b52);var _0x3f536f=_0x5eed1d[_0x0b20('0x20')][_0x2ce626];if(path['parse'](_0x4d3b52[_0x0b20('0x5a')])[_0x0b20('0x62')]===_0x0b20('0x34')){originate(_0x3f536f,_0x13a363,!![])[_0x0b20('0x41')](function(_0x5d9ee2){_0x25456d(_0x5d9ee2);})[_0x0b20('0x38')](function(_0x25e9db){_0x5a77e2(_0x25e9db);});}else{originate(_0x3f536f,_0x13a363,![])['then'](function(_0x4cf150){_0x25456d(_0x4cf150);})[_0x0b20('0x38')](function(_0x26596f){_0x5a77e2(_0x26596f);});}});};Fax['prototype'][_0x0b20('0x63')]=function(_0x23f960){return!_['isNil'](_0x23f960)&&!_['isNil'](_0x23f960['name'])&&!_[_0x0b20('0x64')](_0x23f960[_0x0b20('0x65')])&&_0x23f960['active']&&!_['isNil'](this[_0x0b20('0xb')][util['format']('SIP/%s',_0x23f960['name'])])&&!_[_0x0b20('0x64')](this[_0x0b20('0xb')][util[_0x0b20('0x58')]('SIP/%s',_0x23f960[_0x0b20('0x1e')])][_0x0b20('0x27')])&&(this['trunks'][util[_0x0b20('0x58')](_0x0b20('0x66'),_0x23f960[_0x0b20('0x1e')])][_0x0b20('0x27')]===_0x0b20('0x67')||this[_0x0b20('0xb')][util[_0x0b20('0x58')](_0x0b20('0x66'),_0x23f960[_0x0b20('0x1e')])][_0x0b20('0x27')]===_0x0b20('0x68'));};Fax['prototype'][_0x0b20('0x54')]=function(_0x206314,_0x3905d6){if(!this[_0x0b20('0x63')](_0x206314)){ut[_0x0b20('0x42')](_0x0b20('0x69'),_[_0x0b20('0x64')](_0x206314)?'':_0x206314[_0x0b20('0x1e')]+_0x0b20('0x6a'));return{'isValid':![],'message':_0x0b20('0x6b')};}if(_['isNil'](_0x3905d6[_0x0b20('0x4')])){ut[_0x0b20('0x42')](_0x0b20('0x6c'),JSON['stringify'](_0x3905d6));return{'isValid':![],'message':_0x0b20('0x6d')};}if(_['isNil'](_0x3905d6[_0x0b20('0x5a')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x0b20('0x37')](_0x3905d6));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x0b20('0x6e')};};module['exports']=Fax; \ No newline at end of file +var _0x6630=['bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','name','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','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','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20path','Is\x20Valid','exports','util','lodash'];(function(_0x5d96c7,_0x12370c){var _0x49575a=function(_0x55f345){while(--_0x55f345){_0x5d96c7['push'](_0x5d96c7['shift']());}};_0x49575a(++_0x12370c);}(_0x6630,0x76));var _0x0663=function(_0x7a27fd,_0x5e55de){_0x7a27fd=_0x7a27fd-0x0;var _0x236b75=_0x6630[_0x7a27fd];return _0x236b75;};'use strict';var util=require(_0x0663('0x0'));var _=require(_0x0663('0x1'));var BPromise=require(_0x0663('0x2'));var uuid=require(_0x0663('0x3'));var moment=require('moment');var path=require(_0x0663('0x4'));var tiff2pdf=require(_0x0663('0x5'));var gs=require(_0x0663('0x6'));var logger=require(_0x0663('0x7'))(_0x0663('0x8'));var ami=require(_0x0663('0x9'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x0663('0xa'));var Action=require(_0x0663('0xb'));var faxAccount=require(_0x0663('0xc'));var attachment=require(_0x0663('0xd'));var faxMessage=require(_0x0663('0xe'));function Fax(_0x1d6a29){this[_0x0663('0xf')]={};this[_0x0663('0x10')]=_0x1d6a29[_0x0663('0x10')];this[_0x0663('0x11')]=_0x1d6a29[_0x0663('0x11')];this[_0x0663('0x12')]={};ami['on'](_0x0663('0x13'),this[_0x0663('0x14')][_0x0663('0x15')](this));ami['on'](_0x0663('0x16'),this[_0x0663('0x17')][_0x0663('0x15')](this));ami['on'](_0x0663('0x18'),this[_0x0663('0x19')]['bind'](this));ami['on'](_0x0663('0x1a'),this['syncNewExten'][_0x0663('0x15')](this));ami['on'](_0x0663('0x1b'),this[_0x0663('0x1c')][_0x0663('0x15')](this));ami['on'](_0x0663('0x1d'),this[_0x0663('0x1e')][_0x0663('0x15')](this));ami['on']('hangup',this[_0x0663('0x1f')]['bind'](this));ami['on'](_0x0663('0x20'),this[_0x0663('0x21')][_0x0663('0x15')](this));}Fax[_0x0663('0x22')][_0x0663('0x14')]=function(_0x1d26b1){if(_0x1d26b1['context']===_0x0663('0x23')){for(var _0x1baad8 in this[_0x0663('0x10')]){if(this[_0x0663('0x10')][_0x0663('0x24')](_0x1baad8)){if(_0x1d26b1[_0x0663('0x25')]===this[_0x0663('0x10')][_0x1baad8][_0x0663('0x26')]){this['channels'][_0x1d26b1['uniqueid']]={};this[_0x0663('0xf')][_0x1d26b1[_0x0663('0x27')]]['channel']=_0x1d26b1[_0x0663('0x28')];this[_0x0663('0xf')][_0x1d26b1[_0x0663('0x27')]]['id']=this[_0x0663('0x10')][_0x1baad8]['id'];this[_0x0663('0xf')][_0x1d26b1['uniqueid']]['name']=this[_0x0663('0x10')][_0x1baad8]['name'];logger[_0x0663('0x29')](_0x1d26b1['uniqueid'],_0x0663('0x2a'));}}}}if(this[_0x0663('0x12')][_0x1d26b1[_0x0663('0x27')]]){this[_0x0663('0xf')][_0x1d26b1[_0x0663('0x27')]]={};this['channels'][_0x1d26b1[_0x0663('0x27')]]['channel']=_0x1d26b1[_0x0663('0x28')];logger[_0x0663('0x29')](_0x1d26b1['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x0663('0x22')][_0x0663('0x17')]=function(_0x483993){if(this[_0x0663('0xf')][_0x483993[_0x0663('0x27')]]){for(var _0x50ba16 in _0x483993[_0x0663('0x2b')]){if(_0x483993[_0x0663('0x2b')]['hasOwnProperty'](_0x50ba16)){this[_0x0663('0xf')][_0x483993[_0x0663('0x27')]][_0x50ba16]=_0x483993[_0x0663('0x2c')];}}}};Fax[_0x0663('0x22')][_0x0663('0x19')]=function(_0x51c7e7){if(this[_0x0663('0xf')][_0x51c7e7['uniqueid']]){this[_0x0663('0xf')][_0x51c7e7['uniqueid']][_0x0663('0x2d')]=_0x51c7e7[_0x0663('0x2d')];this[_0x0663('0xf')][_0x51c7e7[_0x0663('0x27')]][_0x0663('0x2e')]=_0x51c7e7[_0x0663('0x2e')];}};Fax['prototype']['syncNewExten']=function(_0x3a9f71){if(this['channels'][_0x3a9f71['uniqueid']]){for(var _0x2dfc0a in _0x3a9f71['variable']){if(_0x3a9f71[_0x0663('0x2b')][_0x0663('0x24')](_0x2dfc0a)){this[_0x0663('0xf')][_0x3a9f71[_0x0663('0x27')]][_0x2dfc0a]=_0x3a9f71[_0x0663('0x2c')];}}}};Fax[_0x0663('0x22')][_0x0663('0x1c')]=function(_0x374e9a){if(this['channels'][_0x374e9a[_0x0663('0x27')]]){this[_0x0663('0xf')][_0x374e9a[_0x0663('0x27')]][_0x0663('0x2f')]=_0x374e9a[_0x0663('0x2f')];this[_0x0663('0xf')][_0x374e9a[_0x0663('0x27')]][_0x0663('0x30')]=_0x374e9a[_0x0663('0x30')];this['channels'][_0x374e9a[_0x0663('0x27')]][_0x0663('0x26')]=_0x374e9a[_0x0663('0x26')];this[_0x0663('0xf')][_0x374e9a[_0x0663('0x27')]][_0x0663('0x31')]=_0x374e9a[_0x0663('0x31')];logger[_0x0663('0x29')](_0x374e9a[_0x0663('0x27')],'\x20syncFaxStatus\x20');}};Fax[_0x0663('0x22')][_0x0663('0x1e')]=function(_0x527466){var _0x4059ce=this;if(this['channels'][_0x527466[_0x0663('0x27')]]){var _0x167ee0=this[_0x0663('0xf')][_0x527466[_0x0663('0x27')]]['id'];this[_0x0663('0xf')][_0x527466[_0x0663('0x27')]]['remotestationid']=_0x527466['remotestationid'];this[_0x0663('0xf')][_0x527466[_0x0663('0x27')]][_0x0663('0x32')]=_0x527466[_0x0663('0x32')];this['channels'][_0x527466['uniqueid']]['localstationid']=_0x527466['localstationid'];this[_0x0663('0xf')][_0x527466[_0x0663('0x27')]][_0x0663('0x33')]=_0x527466[_0x0663('0x33')];this[_0x0663('0xf')][_0x527466['uniqueid']][_0x0663('0x34')]=_0x527466[_0x0663('0x34')];this['channels'][_0x527466['uniqueid']][_0x0663('0x31')]=_0x527466[_0x0663('0x31')];this[_0x0663('0xf')][_0x527466[_0x0663('0x27')]][_0x0663('0x35')]=_0x527466[_0x0663('0x35')];if(this[_0x0663('0xf')][_0x527466[_0x0663('0x27')]][_0x0663('0x32')]>0x0){tiff2pdf(_0x527466['filename'],_0x0663('0x36'),function(_0x4bdb16){logger['info'](_0x527466[_0x0663('0x27')],_0x0663('0x37'),_0x4bdb16[_0x0663('0x38')]);attachment[_0x0663('0x39')]({'name':path['parse'](_0x527466[_0x0663('0x31')])[_0x0663('0x3a')],'basename':path[_0x0663('0x3b')](_0x527466[_0x0663('0x31')])['name']+_0x0663('0x3c'),'type':'application/pdf'})[_0x0663('0x3d')](function(_0x5ef19c){faxAccount[_0x0663('0x3e')](_0x167ee0,{'from':_0x527466[_0x0663('0x35')],'mapKey':_0x0663('0x8'),'body':path['parse'](_0x527466[_0x0663('0x31')])['name']+_0x0663('0x3c'),'AttachmentId':_0x5ef19c['id']})[_0x0663('0x3f')](function(_0x1a890c){logger[_0x0663('0x40')](_0x527466[_0x0663('0x27')],_0x0663('0x41'),JSON[_0x0663('0x42')](_0x1a890c));});})[_0x0663('0x3f')](function(_0x36330f){logger[_0x0663('0x40')](_0x527466['uniqueid'],_0x0663('0x43'),JSON[_0x0663('0x42')](_0x36330f));});});}logger[_0x0663('0x29')](_0x527466[_0x0663('0x27')],'\x20receiveFax\x20');}};Fax['prototype'][_0x0663('0x21')]=function(_0xa542f1){if(this[_0x0663('0x12')][_0xa542f1['uniqueid']]){_[_0x0663('0x44')](this[_0x0663('0xf')][_0xa542f1[_0x0663('0x27')]],_[_0x0663('0x45')](_0xa542f1,['response','reason']));}};function updateStatus(_0x287021){if(_0x287021['AttachmentId']){faxMessage['update'](_0x287021[_0x0663('0x46')],{'failMessage':_0x0663('0x47')})['then'](function(_0x5a05d8){ut[_0x0663('0x48')](_0x0663('0x49'),_0x5a05d8);})['catch'](function(_0xec7ae1){ut[_0x0663('0x48')](_0x0663('0x4a'),_0xec7ae1);});}else{ut[_0x0663('0x48')](_0x0663('0x4b'));}}Fax[_0x0663('0x22')][_0x0663('0x4c')]=function(_0x5a36a8,_0x42e64b,_0x28e81a){var _0x50cae8=this;var _0x1242bf={};if(_0x42e64b){_0x1242bf={'read':_0x42e64b};}else{_0x1242bf={'failMessage':_0x28e81a};}if(this[_0x0663('0x12')][_0x5a36a8]['AttachmentId']){faxMessage[_0x0663('0x4d')](this[_0x0663('0x12')][_0x5a36a8][_0x0663('0x46')],_0x1242bf)[_0x0663('0x3d')](function(_0x4101e0){ut[_0x0663('0x48')]('[Fax][Message][Updated]',_0x4101e0);})['catch'](function(_0x2eff6){ut['logger'](_0x0663('0x4e'),_0x2eff6);})[_0x0663('0x4f')](function(){delete _0x50cae8[_0x0663('0xf')][_0x5a36a8];delete _0x50cae8[_0x0663('0x12')][_0x5a36a8];});}else{ut['logger'](_0x0663('0x50'));delete this[_0x0663('0xf')][_0x5a36a8];delete this['actions'][_0x5a36a8];}};Fax[_0x0663('0x22')][_0x0663('0x1f')]=function(_0x535faf){var _0x10202e=this;if(this[_0x0663('0xf')][_0x535faf[_0x0663('0x27')]]){if(this[_0x0663('0x12')][_0x535faf[_0x0663('0x27')]]){this[_0x0663('0xf')][_0x535faf[_0x0663('0x27')]]['id']=this[_0x0663('0x12')][_0x535faf['uniqueid']]['id'];this[_0x0663('0xf')][_0x535faf[_0x0663('0x27')]][_0x0663('0x3a')]=this[_0x0663('0x12')][_0x535faf['uniqueid']][_0x0663('0x3a')];}logger['info'](_0x535faf[_0x0663('0x27')],this[_0x0663('0x12')][_0x535faf[_0x0663('0x27')]]?_0x0663('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0x0663('0x42')](this[_0x0663('0xf')][_0x535faf['uniqueid']]));if(this['actions'][_0x535faf[_0x0663('0x27')]]){if(this[_0x0663('0xf')][_0x535faf[_0x0663('0x27')]][_0x0663('0x52')]>0x0&&this[_0x0663('0xf')][_0x535faf['uniqueid']][_0x0663('0x1b')]===_0x0663('0x53')){this['updateStatus'](_0x535faf['uniqueid'],!![]);}else{this[_0x0663('0x4c')](_0x535faf['uniqueid'],![],this[_0x0663('0xf')][_0x535faf[_0x0663('0x27')]][_0x0663('0x54')]?_0x0663('0x55')+this['channels'][_0x535faf[_0x0663('0x27')]][_0x0663('0x54')]:_0x0663('0x56'));}}}};Fax[_0x0663('0x22')][_0x0663('0x57')]=function(_0x941f51){var _0x3aa4d7=this;return new BPromise(function(_0x1d45c6,_0x1a28e8){_0x3aa4d7[_0x0663('0x58')](_0x941f51,_0x3aa4d7[_0x0663('0x10')][_0x941f51['FaxAccountId']])[_0x0663('0x3d')](function(_0x285a27){ut[_0x0663('0x48')]('[Fax][execOriginate][success]',_0x285a27);_0x1d45c6(ut[_0x0663('0x38')](_0x0663('0x59')));})[_0x0663('0x3f')](function(_0x2d2d50){ut[_0x0663('0x48')](_0x0663('0x5a'),_0x2d2d50);updateStatus(_0x941f51);_0x1a28e8(ut[_0x0663('0x38')](_0x0663('0x5b')));});});};Fax[_0x0663('0x22')][_0x0663('0x5c')]=function(_0x100fe6){var _0x998cf4=this;return new BPromise(function(_0x729d5e,_0x2b22ca){var _0x4b7696=_0x998cf4[_0x0663('0x5d')](_0x998cf4[_0x0663('0x10')][_0x100fe6[_0x0663('0x5e')]][_0x0663('0x5f')],_0x100fe6);if(_0x4b7696[_0x0663('0x60')]){_0x729d5e(ut[_0x0663('0x38')](_0x0663('0x61')));}else{_0x2b22ca(ut[_0x0663('0x38')](_0x4b7696['message']));}});};function originate(_0x427962,_0x3bc961,_0x17812d){return new BPromise(function(_0x3247ce,_0x21d6d2){if(_0x17812d){var _0x130a25=util['format'](_0x0663('0x62'),path[_0x0663('0x3b')](_0x427962[_0x0663('0x4')])[_0x0663('0x3a')],_0x427962[_0x0663('0x4')]);gs[_0x0663('0x63')](_0x130a25)[_0x0663('0x3d')](function(){_0x427962[_0x0663('0x4')]=util[_0x0663('0x64')](_0x0663('0x65'),path['parse'](_0x427962[_0x0663('0x4')])['dir'],path[_0x0663('0x3b')](_0x427962['path'])[_0x0663('0x3a')]);_0x3bc961[_0x0663('0x66')]=_0x427962[_0x0663('0x4')];ut[_0x0663('0x48')](_0x0663('0x67'),'');ami[_0x0663('0x68')](ut[_0x0663('0x69')](_0x427962,_0x3bc961))[_0x0663('0x3d')](function(_0x5e29fd){_0x3247ce(_0x5e29fd);})[_0x0663('0x3f')](function(_0x217402){_0x21d6d2(_0x217402);});})[_0x0663('0x3f')](function(_0x1389aa){_0x21d6d2(_0x1389aa);});}else{ami[_0x0663('0x68')](ut[_0x0663('0x69')](_0x427962,_0x3bc961))[_0x0663('0x3d')](function(_0x5a5971){_0x3247ce(_0x5a5971);})[_0x0663('0x3f')](function(_0x119482){_0x21d6d2(_0x119482);});}});}Fax[_0x0663('0x22')][_0x0663('0x58')]=function(_0x3625cf,_0x5f4c22){var _0x4f049a=this;return new BPromise(function(_0x2ba7c6,_0x167221){var _0x4ee3ba=uuid['v4']();var _0x4aa754=ut[_0x0663('0x6a')](_0x3625cf,_0x5f4c22);_0x4f049a['actions'][_0x4ee3ba]=new Action(_0x4ee3ba,_0x5f4c22,_0x3625cf);var _0x15faf5=_0x4f049a[_0x0663('0x12')][_0x4ee3ba];if(path[_0x0663('0x3b')](_0x3625cf[_0x0663('0x4')])[_0x0663('0x6b')]===_0x0663('0x3c')){originate(_0x15faf5,_0x4aa754,!![])[_0x0663('0x3d')](function(_0x47e552){_0x2ba7c6(_0x47e552);})[_0x0663('0x3f')](function(_0x4467c1){_0x167221(_0x4467c1);});}else{originate(_0x15faf5,_0x4aa754,![])[_0x0663('0x3d')](function(_0x1ce365){_0x2ba7c6(_0x1ce365);})[_0x0663('0x3f')](function(_0x44511c){_0x167221(_0x44511c);});}});};Fax[_0x0663('0x22')][_0x0663('0x6c')]=function(_0x2e84a7){return!_['isNil'](_0x2e84a7)&&!_[_0x0663('0x6d')](_0x2e84a7[_0x0663('0x3a')])&&!_[_0x0663('0x6d')](_0x2e84a7[_0x0663('0x6e')])&&_0x2e84a7['active']&&!_['isNil'](this[_0x0663('0x11')][util[_0x0663('0x64')](_0x0663('0x6f'),_0x2e84a7['name'])])&&!_['isNil'](this[_0x0663('0x11')][util['format'](_0x0663('0x6f'),_0x2e84a7[_0x0663('0x3a')])][_0x0663('0x30')])&&(this[_0x0663('0x11')][util[_0x0663('0x64')]('SIP/%s',_0x2e84a7['name'])]['status']===_0x0663('0x70')||this[_0x0663('0x11')][util[_0x0663('0x64')](_0x0663('0x6f'),_0x2e84a7[_0x0663('0x3a')])][_0x0663('0x30')]===_0x0663('0x71'));};Fax['prototype']['checkTrunk']=function(_0x33145b,_0x56fc3b){if(!this['isTrunkReachable'](_0x33145b)){ut['logger'](_0x0663('0x72'),_['isNil'](_0x33145b)?'':_0x33145b[_0x0663('0x3a')]+_0x0663('0x73'));return{'isValid':![],'message':_0x0663('0x74')};}if(_[_0x0663('0x6d')](_0x56fc3b[_0x0663('0x8')])){ut[_0x0663('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x56fc3b));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x0663('0x6d')](_0x56fc3b[_0x0663('0x4')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x0663('0x42')](_0x56fc3b));return{'isValid':![],'message':_0x0663('0x75')};}return{'isValid':!![],'message':_0x0663('0x76')};};module[_0x0663('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 8243dfa..0f3ea22 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 _0x1290=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','resolve','then','notify','catch','[Notify]\x20','bluebird'];(function(_0x7c7a41,_0x11a170){var _0x5c09d3=function(_0x5dec92){while(--_0x5dec92){_0x7c7a41['push'](_0x7c7a41['shift']());}};_0x5c09d3(++_0x11a170);}(_0x1290,0x1c2));var _0x0129=function(_0x481cbe,_0xb51c0d){_0x481cbe=_0x481cbe-0x0;var _0x3a82bc=_0x1290[_0x481cbe];return _0x3a82bc;};'use strict';var util=require('util');var BPromise=require(_0x0129('0x0'));var logger=require(_0x0129('0x1'))(_0x0129('0x2'));var _=require(_0x0129('0x3'));var faxAccount=require(_0x0129('0x4'));function loggerCatch(_0x2cf776){return function(_0x5ceeae){logger[_0x0129('0x5')](_0x2cf776,util['inspect'](_0x5ceeae,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x5a5cb0,_0x4b7ed7){return BPromise[_0x0129('0x6')]()[_0x0129('0x7')](faxAccount[_0x0129('0x8')](_0x5a5cb0,_0x4b7ed7))[_0x0129('0x9')](loggerCatch(_0x0129('0xa')));}; \ No newline at end of file +var _0x13e9=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then','notify','catch'];(function(_0x122834,_0x43b8e0){var _0x6009cd=function(_0x59ee17){while(--_0x59ee17){_0x122834['push'](_0x122834['shift']());}};_0x6009cd(++_0x43b8e0);}(_0x13e9,0xeb));var _0x913e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x13e9[_0x422905];return _0x33dc6c;};'use strict';var util=require(_0x913e('0x0'));var BPromise=require(_0x913e('0x1'));var logger=require(_0x913e('0x2'))(_0x913e('0x3'));var _=require(_0x913e('0x4'));var faxAccount=require(_0x913e('0x5'));function loggerCatch(_0x28fe86){return function(_0x38a4b7){logger[_0x913e('0x6')](_0x28fe86,util[_0x913e('0x7')](_0x38a4b7,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0xe073b3,_0x1ac2d9){return BPromise[_0x913e('0x8')]()[_0x913e('0x9')](faxAccount[_0x913e('0xa')](_0xe073b3,_0x1ac2d9))[_0x913e('0xb')](loggerCatch(_0x913e('0xc')));}; \ 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 6eff227..e97dfcf 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 _0xb70e=['inspect','util','../../../../config/logger','fax','bluebird','exec','execute','Exec\x20gs','\x20Error\x20:'];(function(_0x1601f7,_0x4fcc88){var _0x4e3a3c=function(_0x40d002){while(--_0x40d002){_0x1601f7['push'](_0x1601f7['shift']());}};_0x4e3a3c(++_0x4fcc88);}(_0xb70e,0xc7));var _0xeb70=function(_0x7a1a71,_0x21eb82){_0x7a1a71=_0x7a1a71-0x0;var _0x515a96=_0xb70e[_0x7a1a71];return _0x515a96;};'use strict';var util=require(_0xeb70('0x0'));var logger=require(_0xeb70('0x1'))(_0xeb70('0x2'));var BPromise=require(_0xeb70('0x3'));var exec=require('child_process')[_0xeb70('0x4')];exports[_0xeb70('0x5')]=function(_0x22bae4){return new BPromise(function(_0x282e06,_0x2b22a){exec(_0x22bae4,function(_0x5432f5,_0x3daeaf,_0x314e19){logger['info']('Exec\x20gs',_0x3daeaf);if(_0x5432f5){logger['info'](_0xeb70('0x6'),_0xeb70('0x7'),util[_0xeb70('0x8')](_0x5432f5,{'showHidden':![],'depth':null}),_0x3daeaf,_0x314e19);_0x2b22a(_0x5432f5);}_0x282e06(_0x3daeaf);});});}; \ No newline at end of file +var _0xd0b8=['\x20Error\x20:','inspect','../../../../config/logger','fax','child_process','execute','info','Exec\x20gs'];(function(_0x402872,_0x200391){var _0x3929c0=function(_0x27aff1){while(--_0x27aff1){_0x402872['push'](_0x402872['shift']());}};_0x3929c0(++_0x200391);}(_0xd0b8,0x1ea));var _0x8d0b=function(_0x31e76a,_0x51bc97){_0x31e76a=_0x31e76a-0x0;var _0x5488ec=_0xd0b8[_0x31e76a];return _0x5488ec;};'use strict';var util=require('util');var logger=require(_0x8d0b('0x0'))(_0x8d0b('0x1'));var BPromise=require('bluebird');var exec=require(_0x8d0b('0x2'))['exec'];exports[_0x8d0b('0x3')]=function(_0x4dac43){return new BPromise(function(_0x458dd3,_0x3750b1){exec(_0x4dac43,function(_0x364568,_0x437128,_0x483bd4){logger[_0x8d0b('0x4')](_0x8d0b('0x5'),_0x437128);if(_0x364568){logger[_0x8d0b('0x4')](_0x8d0b('0x5'),_0x8d0b('0x6'),util[_0x8d0b('0x7')](_0x364568,{'showHidden':![],'depth':null}),_0x437128,_0x483bd4);_0x3750b1(_0x364568);}_0x458dd3(_0x437128);});});}; \ 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 95d5e3b..71d5733 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 _0xdace=['t38timeout','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','util','moment','../../../../config/logger','fax','logger','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','faxdetect'];(function(_0x180c9b,_0x13d173){var _0x3ff116=function(_0x241982){while(--_0x241982){_0x180c9b['push'](_0x180c9b['shift']());}};_0x3ff116(++_0x13d173);}(_0xdace,0xc5));var _0xedac=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xdace[_0x57b432];return _0x2edf2a;};'use strict';var util=require(_0xedac('0x0'));var _=require('lodash');var moment=require(_0xedac('0x1'));var logger=require(_0xedac('0x2'))(_0xedac('0x3'));exports['message']=function(_0x413d77){return{'message':_0x413d77};};exports[_0xedac('0x4')]=function(_0x15d3bd,_0xefb142){logger['info'](_0x15d3bd,util[_0xedac('0x5')](_0xefb142,{'showHidden':![],'depth':null}));};exports[_0xedac('0x6')]=function(_0x39328a,_0x5ecbd3){var _0x4081c6={'XMF-ECM':_0x5ecbd3[_0xedac('0x7')],'XMF-HEADERINFO':_0x5ecbd3[_0xedac('0x8')],'XMF-MINRATE':_0x5ecbd3['minrate'],'XMF-MAXRATE':_0x5ecbd3[_0xedac('0x9')],'XMF-MODEM':util[_0xedac('0xa')](_0xedac('0xb'),_0x5ecbd3['modem']),'XMF-GATEWAY':_0x5ecbd3['gateway'],'XMF-FAXDETECT':_0x5ecbd3[_0xedac('0xc')],'XMF-T38TIMEOUT':_0x5ecbd3[_0xedac('0xd')],'XMF-LOCALSTATIONID':_0x5ecbd3['localstationid'],'XMF-PATH':_0x39328a['path']};return _0x4081c6;};exports[_0xedac('0xe')]=function(_0x25395d,_0x57f637){return{'actionid':_0x25395d[_0xedac('0xf')],'action':'originate','channel':_0x25395d[_0xedac('0x10')],'Exten':_0xedac('0x11'),'Context':_0xedac('0x12'),'Priority':'1','callerid':util[_0xedac('0xa')](_0xedac('0x13'),_0x25395d[_0xedac('0x8')]?_0x25395d[_0xedac('0x8')]:'',_0x25395d[_0xedac('0x14')]),'variable':_0x57f637,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x25395d['uniqueid']};}; \ No newline at end of file +var _0x8ce3=['logger','info','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message'];(function(_0x1fdf7b,_0x51598e){var _0x423b86=function(_0x1b6260){while(--_0x1b6260){_0x1fdf7b['push'](_0x1fdf7b['shift']());}};_0x423b86(++_0x51598e);}(_0x8ce3,0xc3));var _0x38ce=function(_0x507c6e,_0x5b7703){_0x507c6e=_0x507c6e-0x0;var _0x236242=_0x8ce3[_0x507c6e];return _0x236242;};'use strict';var util=require(_0x38ce('0x0'));var _=require(_0x38ce('0x1'));var moment=require('moment');var logger=require(_0x38ce('0x2'))(_0x38ce('0x3'));exports[_0x38ce('0x4')]=function(_0x26ec48){return{'message':_0x26ec48};};exports[_0x38ce('0x5')]=function(_0x17b96d,_0x1efae3){logger[_0x38ce('0x6')](_0x17b96d,util['inspect'](_0x1efae3,{'showHidden':![],'depth':null}));};exports[_0x38ce('0x7')]=function(_0xb24f4c,_0x58074c){var _0x262b13={'XMF-ECM':_0x58074c[_0x38ce('0x8')],'XMF-HEADERINFO':_0x58074c[_0x38ce('0x9')],'XMF-MINRATE':_0x58074c['minrate'],'XMF-MAXRATE':_0x58074c[_0x38ce('0xa')],'XMF-MODEM':util['format'](_0x38ce('0xb'),_0x58074c['modem']),'XMF-GATEWAY':_0x58074c[_0x38ce('0xc')],'XMF-FAXDETECT':_0x58074c[_0x38ce('0xd')],'XMF-T38TIMEOUT':_0x58074c[_0x38ce('0xe')],'XMF-LOCALSTATIONID':_0x58074c[_0x38ce('0xf')],'XMF-PATH':_0xb24f4c[_0x38ce('0x10')]};return _0x262b13;};exports[_0x38ce('0x11')]=function(_0x2a9045,_0x171a02){return{'actionid':_0x2a9045[_0x38ce('0x12')],'action':_0x38ce('0x13'),'channel':_0x2a9045[_0x38ce('0x14')],'Exten':_0x38ce('0x15'),'Context':_0x38ce('0x16'),'Priority':'1','callerid':util[_0x38ce('0x17')](_0x38ce('0x18'),_0x2a9045[_0x38ce('0x9')]?_0x2a9045['headerinfo']:'',_0x2a9045['localstationid']),'variable':_0x171a02,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2a9045[_0x38ce('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 21d36f8..6c8c5b7 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 _0xac4a=['initVoiceCallReports','catch','log','sync','bluebird','util','moment','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xac4a,0x13f));var _0xaac4=function(_0xff4708,_0x3b672c){_0xff4708=_0xff4708-0x0;var _0xe9e28f=_0xac4a[_0xff4708];return _0xe9e28f;};'use strict';var BPromise=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var server=require(_0xaac4('0x3'));var Realtime=require(_0xaac4('0x4'));var Report=require(_0xaac4('0x5'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0xaac4('0x6'));var Preview=require(_0xaac4('0x7'));var Fax=require(_0xaac4('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xaac4('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xaac4('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xaac4('0xb'));var template=require(_0xaac4('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0xaac4('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xaac4('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xaac4('0xf'));var desk=require(_0xaac4('0x10'));var zoho=require(_0xaac4('0x11'));var vtiger=require(_0xaac4('0x12'));var freshsales=require(_0xaac4('0x13'));var servicenow=require('./rpc/integrations/servicenow');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()[_0xaac4('0x14')](_0xaac4('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xaac4('0x14')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xaac4('0x16')]()[_0xaac4('0x17')](user['getAgents']())[_0xaac4('0x17')](realtime[_0xaac4('0x18')]())[_0xaac4('0x17')](user[_0xaac4('0x19')]())[_0xaac4('0x17')](realtime[_0xaac4('0x1a')]())[_0xaac4('0x17')](trunk[_0xaac4('0x1b')]())[_0xaac4('0x17')](realtime[_0xaac4('0x1c')]())[_0xaac4('0x17')](voiceQueue[_0xaac4('0x1d')]())[_0xaac4('0x17')](realtime['initVoiceQueues']())[_0xaac4('0x17')](trigger['getTriggers']())[_0xaac4('0x17')](realtime['initTriggers']())[_0xaac4('0x17')](template[_0xaac4('0x1e')]())[_0xaac4('0x17')](realtime[_0xaac4('0x1f')]())[_0xaac4('0x17')](zendesk[_0xaac4('0x20')]())[_0xaac4('0x17')](realtime[_0xaac4('0x21')]())[_0xaac4('0x17')](salesforce['getSalesforceAccounts']())[_0xaac4('0x17')](realtime['initSalesforceAccounts']())[_0xaac4('0x17')](sugarcrm[_0xaac4('0x22')]())[_0xaac4('0x17')](realtime[_0xaac4('0x23')]())[_0xaac4('0x17')](freshdesk[_0xaac4('0x24')]())['then'](realtime[_0xaac4('0x25')]())[_0xaac4('0x17')](desk[_0xaac4('0x26')]())[_0xaac4('0x17')](realtime[_0xaac4('0x27')]())[_0xaac4('0x17')](zoho[_0xaac4('0x28')]())['then'](realtime[_0xaac4('0x29')]())['then'](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0xaac4('0x17')](freshsales[_0xaac4('0x2a')]())[_0xaac4('0x17')](realtime[_0xaac4('0x2b')]())[_0xaac4('0x17')](servicenow[_0xaac4('0x2c')]())[_0xaac4('0x17')](realtime[_0xaac4('0x2d')]())[_0xaac4('0x17')](dynamics365[_0xaac4('0x2e')]())['then'](realtime[_0xaac4('0x2f')]())[_0xaac4('0x17')](campaign[_0xaac4('0x30')]())[_0xaac4('0x17')](realtime[_0xaac4('0x31')]())[_0xaac4('0x17')](voiceExtension['getVoiceExtensions']())[_0xaac4('0x17')](realtime['initVoiceExtensions']())[_0xaac4('0x17')](faxAccount[_0xaac4('0x32')]())[_0xaac4('0x17')](realtime[_0xaac4('0x33')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0xaac4('0x34')]())[_0xaac4('0x17')](realtime[_0xaac4('0x35')]())[_0xaac4('0x17')](cmHopperHistory[_0xaac4('0x36')]())[_0xaac4('0x17')](realtime[_0xaac4('0x37')]())[_0xaac4('0x17')](cmHopperHistory[_0xaac4('0x38')]())[_0xaac4('0x17')](realtime[_0xaac4('0x39')]())[_0xaac4('0x17')](voiceCallReport[_0xaac4('0x3a')]())[_0xaac4('0x17')](realtime[_0xaac4('0x3b')]())['then'](function(_0x5bad9f){})[_0xaac4('0x3c')](function(_0x40f64b){console[_0xaac4('0x3d')](_0x40f64b);});}function main(){return server['listen'](realtime,preview,fax)[_0xaac4('0x17')](function(_0x16fae8){return initRealtime();})[_0xaac4('0x17')](function(){return initParams();})[_0xaac4('0x17')](function(){report[_0xaac4('0x3e')]();setInterval(initRealtime,0x1388);})[_0xaac4('0x3c')](function(_0x418939){console['log'](_0x418939);});}main(); \ No newline at end of file +var _0x0972=['initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','util','./server','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts'];(function(_0x4896c4,_0xf56762){var _0xf8536b=function(_0x2f6d42){while(--_0x2f6d42){_0x4896c4['push'](_0x4896c4['shift']());}};_0xf8536b(++_0xf56762);}(_0x0972,0x64));var _0x2097=function(_0x388687,_0x35583c){_0x388687=_0x388687-0x0;var _0x412de5=_0x0972[_0x388687];return _0x412de5;};'use strict';var BPromise=require('bluebird');var util=require(_0x2097('0x0'));var moment=require('moment');var server=require(_0x2097('0x1'));var Realtime=require('./realtime');var Report=require(_0x2097('0x2'));var Acw=require(_0x2097('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x2097('0x4'));var Preview=require(_0x2097('0x5'));var Fax=require(_0x2097('0x6'));var user=require(_0x2097('0x7'));var voiceQueue=require(_0x2097('0x8'));var voiceQueueReport=require(_0x2097('0x9'));var voiceCallReport=require(_0x2097('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x2097('0xb'));var template=require(_0x2097('0xc'));var cmHopperHistory=require(_0x2097('0xd'));var campaign=require(_0x2097('0xe'));var voiceExtension=require(_0x2097('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x2097('0x10'));var salesforce=require(_0x2097('0x11'));var sugarcrm=require(_0x2097('0x12'));var freshdesk=require(_0x2097('0x13'));var desk=require(_0x2097('0x14'));var zoho=require(_0x2097('0x15'));var vtiger=require(_0x2097('0x16'));var freshsales=require(_0x2097('0x17'));var servicenow=require(_0x2097('0x18'));var dynamics365=require(_0x2097('0x19'));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()[_0x2097('0x1a')](_0x2097('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2097('0x1a')](_0x2097('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2097('0x1c')]()[_0x2097('0x1d')](user[_0x2097('0x1e')]())[_0x2097('0x1d')](realtime[_0x2097('0x1f')]())[_0x2097('0x1d')](user['getTelephones']())[_0x2097('0x1d')](realtime[_0x2097('0x20')]())['then'](trunk['getTrunks']())['then'](realtime[_0x2097('0x21')]())['then'](voiceQueue[_0x2097('0x22')]())[_0x2097('0x1d')](realtime[_0x2097('0x23')]())[_0x2097('0x1d')](trigger[_0x2097('0x24')]())['then'](realtime[_0x2097('0x25')]())[_0x2097('0x1d')](template[_0x2097('0x26')]())[_0x2097('0x1d')](realtime[_0x2097('0x27')]())[_0x2097('0x1d')](zendesk[_0x2097('0x28')]())[_0x2097('0x1d')](realtime['initZendeskAccounts']())['then'](salesforce[_0x2097('0x29')]())['then'](realtime[_0x2097('0x2a')]())[_0x2097('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x2097('0x1d')](realtime['initSugarcrmAccounts']())[_0x2097('0x1d')](freshdesk[_0x2097('0x2b')]())[_0x2097('0x1d')](realtime[_0x2097('0x2c')]())[_0x2097('0x1d')](desk[_0x2097('0x2d')]())['then'](realtime[_0x2097('0x2e')]())['then'](zoho[_0x2097('0x2f')]())[_0x2097('0x1d')](realtime[_0x2097('0x30')]())[_0x2097('0x1d')](vtiger['getVtigerAccounts']())[_0x2097('0x1d')](realtime[_0x2097('0x31')]())['then'](freshsales[_0x2097('0x32')]())['then'](realtime[_0x2097('0x33')]())['then'](servicenow[_0x2097('0x34')]())[_0x2097('0x1d')](realtime[_0x2097('0x35')]())[_0x2097('0x1d')](dynamics365[_0x2097('0x36')]())[_0x2097('0x1d')](realtime[_0x2097('0x37')]())['then'](campaign[_0x2097('0x38')]())[_0x2097('0x1d')](realtime['initCampaigns']())[_0x2097('0x1d')](voiceExtension[_0x2097('0x39')]())['then'](realtime['initVoiceExtensions']())[_0x2097('0x1d')](faxAccount[_0x2097('0x3a')]())[_0x2097('0x1d')](realtime[_0x2097('0x3b')]())[_0x2097('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x2097('0x1c')]()['then'](voiceQueueReport[_0x2097('0x3c')]())['then'](realtime[_0x2097('0x3d')]())[_0x2097('0x1d')](cmHopperHistory[_0x2097('0x3e')]())[_0x2097('0x1d')](realtime[_0x2097('0x3f')]())[_0x2097('0x1d')](cmHopperHistory[_0x2097('0x40')]())[_0x2097('0x1d')](realtime[_0x2097('0x41')]())['then'](voiceCallReport[_0x2097('0x42')]())[_0x2097('0x1d')](realtime[_0x2097('0x43')]())['then'](function(_0x3d97ee){})[_0x2097('0x44')](function(_0x3c2fa6){console[_0x2097('0x45')](_0x3c2fa6);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x5689f6){return initRealtime();})[_0x2097('0x1d')](function(){return initParams();})[_0x2097('0x1d')](function(){report[_0x2097('0x46')]();setInterval(initRealtime,0x1388);})[_0x2097('0x44')](function(_0x3710e0){console[_0x2097('0x45')](_0x3710e0);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 4e1b137..5fb8bfc 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 _0xc0af=['statePause','toNumber','format','status','address','user:%s','emit','user:presence','exports','lodash','util','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','unknown','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','state','toLowerCase','idle','inuse'];(function(_0x592c14,_0x34cf86){var _0x1cc2eb=function(_0x28b4ec){while(--_0x28b4ec){_0x592c14['push'](_0x592c14['shift']());}};_0x1cc2eb(++_0x34cf86);}(_0xc0af,0x9d));var _0xfc0a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc0af[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfc0a('0x0'));var util=require(_0xfc0a('0x1'));var moment=require('moment');var md5=require(_0xfc0a('0x2'));var Redis=require(_0xfc0a('0x3'));var config=require(_0xfc0a('0x4'));config[_0xfc0a('0x5')]=_['defaults'](config['redis'],{'host':_0xfc0a('0x6'),'port':0x18eb});var io=require(_0xfc0a('0x7'))(new Redis(config['redis']));function Agent(_0x427e43){this['id']=_0x427e43['id']||0x0;this[_0xfc0a('0x8')]=_0x427e43['name']||'';this[_0xfc0a('0x9')]=_0x427e43[_0xfc0a('0x9')]||'';this[_0xfc0a('0xa')]=_0x427e43[_0xfc0a('0xa')]||'';this['fullname']=_0x427e43[_0xfc0a('0xb')]||'';this['state']='unknown';this[_0xfc0a('0xc')]=0x0;this['status']=_0xfc0a('0xd');this['address']='';this[_0xfc0a('0xe')]='';this[_0xfc0a('0xf')]='';this[_0xfc0a('0x10')]='';this[_0xfc0a('0x11')]=_0x427e43[_0xfc0a('0x11')]||![];this[_0xfc0a('0x12')]=_0xfc0a('0xd');this[_0xfc0a('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xfc0a('0x14')]='';this[_0xfc0a('0x15')]=![];this[_0xfc0a('0x16')]=![];this[_0xfc0a('0x2')]='';}Agent['prototype'][_0xfc0a('0x17')]=function(_0x1c23ee){var _0x2ed0bf;if(_0x1c23ee&&_0x1c23ee[_0xfc0a('0x18')]){_0x2ed0bf=_0x1c23ee[_0xfc0a('0x18')][_0xfc0a('0x19')]();switch(_0x2ed0bf){case'not_inuse':_0x2ed0bf=_0xfc0a('0x1a');break;case _0xfc0a('0x1b'):_0x2ed0bf='talking';break;}}if(_0x2ed0bf&&this[_0xfc0a('0x12')]!==_0x2ed0bf||_0x1c23ee[_0xfc0a('0x1c')]){this[_0xfc0a('0x13')]=_[_0xfc0a('0x1d')](moment()[_0xfc0a('0x1e')]('x'));}if(_0x2ed0bf){this[_0xfc0a('0x12')]=_0x2ed0bf;}var _0x520979={'id':this['id'],'name':this[_0xfc0a('0x8')],'email':this[_0xfc0a('0x9')],'accountcode':this[_0xfc0a('0xa')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0xfc0a('0xc')],'status':this[_0xfc0a('0x1f')],'address':this[_0xfc0a('0x20')],'online':this[_0xfc0a('0x11')],'voiceStatus':this[_0xfc0a('0x12')],'voiceStatusTime':this[_0xfc0a('0x13')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xfc0a('0x10')],'onhold':this[_0xfc0a('0x15')]};var _0x8a709a=md5(JSON['stringify'](_0x520979));if(this[_0xfc0a('0x2')]!==_0x8a709a){this[_0xfc0a('0x2')]=_0x8a709a;io['to'](util[_0xfc0a('0x1e')](_0xfc0a('0x21'),_0x520979[_0xfc0a('0x8')]))[_0xfc0a('0x22')]('user:save',_0x520979);io[_0xfc0a('0x22')](_0xfc0a('0x23'),_0x520979);}};module[_0xfc0a('0x24')]=Agent; \ No newline at end of file +var _0x6ead=['toLowerCase','not_inuse','idle','inuse','talking','voiceStatusTime','toNumber','fullname','voiceStatusQueue','stringify','format','user:save','emit','exports','lodash','moment','md5','ioredis','defaults','socket.io-emitter','name','email','accountcode','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','state'];(function(_0x5d9acc,_0x2f980e){var _0x9cedf9=function(_0x59f8b0){while(--_0x59f8b0){_0x5d9acc['push'](_0x5d9acc['shift']());}};_0x9cedf9(++_0x2f980e);}(_0x6ead,0x118));var _0xd6ea=function(_0x3c654b,_0x54101c){_0x3c654b=_0x3c654b-0x0;var _0x25e872=_0x6ead[_0x3c654b];return _0x25e872;};'use strict';var _=require(_0xd6ea('0x0'));var util=require('util');var moment=require(_0xd6ea('0x1'));var md5=require(_0xd6ea('0x2'));var Redis=require(_0xd6ea('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xd6ea('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd6ea('0x5'))(new Redis(config['redis']));function Agent(_0x36d1ce){this['id']=_0x36d1ce['id']||0x0;this[_0xd6ea('0x6')]=_0x36d1ce[_0xd6ea('0x6')]||'';this[_0xd6ea('0x7')]=_0x36d1ce[_0xd6ea('0x7')]||'';this[_0xd6ea('0x8')]=_0x36d1ce[_0xd6ea('0x8')]||'';this['fullname']=_0x36d1ce['fullname']||'';this['state']=_0xd6ea('0x9');this[_0xd6ea('0xa')]=0x0;this[_0xd6ea('0xb')]=_0xd6ea('0x9');this[_0xd6ea('0xc')]='';this[_0xd6ea('0xd')]='';this[_0xd6ea('0xe')]='';this[_0xd6ea('0xf')]='';this[_0xd6ea('0x10')]=_0x36d1ce[_0xd6ea('0x10')]||![];this[_0xd6ea('0x11')]=_0xd6ea('0x9');this['voiceStatusTime']=0x0;this[_0xd6ea('0x12')]='';this['voiceStatusQueue']='';this[_0xd6ea('0x13')]=![];this[_0xd6ea('0x14')]=![];this['md5']='';}Agent[_0xd6ea('0x15')][_0xd6ea('0x16')]=function(_0x1196d0){var _0x238785;if(_0x1196d0&&_0x1196d0[_0xd6ea('0x17')]){_0x238785=_0x1196d0[_0xd6ea('0x17')][_0xd6ea('0x18')]();switch(_0x238785){case _0xd6ea('0x19'):_0x238785=_0xd6ea('0x1a');break;case _0xd6ea('0x1b'):_0x238785=_0xd6ea('0x1c');break;}}if(_0x238785&&this[_0xd6ea('0x11')]!==_0x238785||_0x1196d0['statePause']){this[_0xd6ea('0x1d')]=_[_0xd6ea('0x1e')](moment()['format']('x'));}if(_0x238785){this[_0xd6ea('0x11')]=_0x238785;}var _0x2669c8={'id':this['id'],'name':this['name'],'email':this[_0xd6ea('0x7')],'accountcode':this[_0xd6ea('0x8')],'fullname':this[_0xd6ea('0x1f')],'state':this['state'],'stateTime':this[_0xd6ea('0xa')],'status':this['status'],'address':this[_0xd6ea('0xc')],'online':this[_0xd6ea('0x10')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd6ea('0x1d')],'voiceStatusCallerIdNumber':this[_0xd6ea('0x12')],'voiceStatusQueue':this[_0xd6ea('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x3d501f=md5(JSON[_0xd6ea('0x21')](_0x2669c8));if(this[_0xd6ea('0x2')]!==_0x3d501f){this[_0xd6ea('0x2')]=_0x3d501f;io['to'](util[_0xd6ea('0x22')]('user:%s',_0x2669c8[_0xd6ea('0x6')]))['emit'](_0xd6ea('0x23'),_0x2669c8);io[_0xd6ea('0x24')]('user:presence',_0x2669c8);}};module[_0xd6ea('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b9a46a1..d2f21c6 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 _0x8119=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x6cb323,_0x15c81d){var _0x448547=function(_0x33686c){while(--_0x33686c){_0x6cb323['push'](_0x6cb323['shift']());}};_0x448547(++_0x15c81d);}(_0x8119,0x126));var _0x9811=function(_0x119464,_0x4e9c81){_0x119464=_0x119464-0x0;var _0x12311c=_0x8119[_0x119464];return _0x12311c;};'use strict';function Campaign(_0x277dac){this['id']=_0x277dac['id']||0x0;this[_0x9811('0x0')]=_0x277dac[_0x9811('0x0')]||'';this['type']=_0x277dac['type']||_0x9811('0x1');this[_0x9811('0x2')]=0x0;this[_0x9811('0x3')]=0x0;this[_0x9811('0x4')]=0x0;this[_0x9811('0x5')]=0x0;this[_0x9811('0x6')]='';this[_0x9811('0x7')]=!![];this[_0x9811('0x8')]=_0x277dac['active'];this[_0x9811('0x9')]=_0x277dac[_0x9811('0x9')];this[_0x9811('0xa')]=_0x277dac[_0x9811('0xa')]||null;this[_0x9811('0xb')]=_0x277dac[_0x9811('0xb')]?_0x277dac['dialGlobalInterval']:null;this[_0x9811('0xc')]=_0x277dac[_0x9811('0xc')];this[_0x9811('0xd')]=_0x277dac[_0x9811('0xd')];this[_0x9811('0xe')]=_0x277dac[_0x9811('0xe')]||0x1e;this[_0x9811('0xf')]=_0x277dac[_0x9811('0xf')];this[_0x9811('0x10')]=_0x277dac[_0x9811('0x10')];this['dialBusyMaxRetry']=_0x277dac[_0x9811('0x11')];this[_0x9811('0x12')]=_0x277dac[_0x9811('0x12')];this[_0x9811('0x13')]=_0x277dac[_0x9811('0x13')];this[_0x9811('0x14')]=_0x277dac[_0x9811('0x14')];this[_0x9811('0x15')]=_0x277dac['dialGlobalMaxRetry'];this[_0x9811('0x16')]=_0x277dac['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x277dac[_0x9811('0x17')]||0x96;this[_0x9811('0x18')]=_0x277dac['dialDropMaxRetry']||0x3;this[_0x9811('0x19')]=_0x277dac[_0x9811('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x277dac[_0x9811('0x1a')]||0x3;this[_0x9811('0x1b')]=_0x277dac[_0x9811('0x1b')]||0x96;this[_0x9811('0x1c')]=_0x277dac['dialMachineMaxRetry']||0x3;this[_0x9811('0x1d')]=_0x277dac[_0x9811('0x1d')]||0x96;this[_0x9811('0x1e')]=_0x277dac[_0x9811('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x277dac[_0x9811('0x1f')]||0x96;this[_0x9811('0x20')]=_0x277dac[_0x9811('0x20')]||'DESC';this[_0x9811('0x21')]=_0x277dac[_0x9811('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x277dac[_0x9811('0x22')]||undefined;this[_0x9811('0x23')]=_0x277dac[_0x9811('0x23')]||undefined;this[_0x9811('0x24')]=_0x277dac[_0x9811('0x24')]?_0x277dac[_0x9811('0x24')]:undefined;this[_0x9811('0x25')]=_0x277dac[_0x9811('0x25')]?_0x277dac['Trunk']:undefined;this[_0x9811('0x26')]=_0x277dac[_0x9811('0x26')]?_0x277dac['Interval']:undefined;this[_0x9811('0x27')]=_0x277dac[_0x9811('0x27')]?_0x277dac[_0x9811('0x27')]:undefined;this[_0x9811('0x28')]=_0x277dac[_0x9811('0x27')]?_0x277dac[_0x9811('0x27')][_0x9811('0x0')]:undefined;this['dialAMDActive']=_0x277dac[_0x9811('0x29')]||![];this[_0x9811('0x2a')]=_0x277dac['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x277dac[_0x9811('0x2b')];this[_0x9811('0x2c')]=_0x277dac[_0x9811('0x2c')];this[_0x9811('0x2d')]=_0x277dac['dialAMDTotalAnalysisTime'];this[_0x9811('0x2e')]=_0x277dac[_0x9811('0x2e')];this[_0x9811('0x2f')]=_0x277dac['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x277dac[_0x9811('0x30')];this[_0x9811('0x31')]=_0x277dac[_0x9811('0x31')];this[_0x9811('0x32')]=_0x277dac[_0x9811('0x32')];}module[_0x9811('0x33')]=Campaign; \ No newline at end of file +var _0x5044=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x2e3966,_0x135c80){var _0x3010d5=function(_0x5b0625){while(--_0x5b0625){_0x2e3966['push'](_0x2e3966['shift']());}};_0x3010d5(++_0x135c80);}(_0x5044,0xc8));var _0x4504=function(_0x5da73b,_0x13c824){_0x5da73b=_0x5da73b-0x0;var _0x33c7ad=_0x5044[_0x5da73b];return _0x33c7ad;};'use strict';function Campaign(_0x2259d3){this['id']=_0x2259d3['id']||0x0;this[_0x4504('0x0')]=_0x2259d3['name']||'';this[_0x4504('0x1')]=_0x2259d3[_0x4504('0x1')]||_0x4504('0x2');this[_0x4504('0x3')]=0x0;this[_0x4504('0x4')]=0x0;this[_0x4504('0x5')]=0x0;this[_0x4504('0x6')]=0x0;this[_0x4504('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x4504('0x8')]=_0x2259d3[_0x4504('0x8')];this[_0x4504('0x9')]=_0x2259d3[_0x4504('0x9')];this[_0x4504('0xa')]=_0x2259d3[_0x4504('0xa')]||null;this[_0x4504('0xb')]=_0x2259d3[_0x4504('0xb')]?_0x2259d3[_0x4504('0xb')]:null;this['dialOriginateCallerIdName']=_0x2259d3[_0x4504('0xc')];this['dialOriginateCallerIdNumber']=_0x2259d3[_0x4504('0xd')];this[_0x4504('0xe')]=_0x2259d3[_0x4504('0xe')]||0x1e;this[_0x4504('0xf')]=_0x2259d3[_0x4504('0xf')];this[_0x4504('0x10')]=_0x2259d3[_0x4504('0x10')];this[_0x4504('0x11')]=_0x2259d3[_0x4504('0x11')];this[_0x4504('0x12')]=_0x2259d3[_0x4504('0x12')];this[_0x4504('0x13')]=_0x2259d3[_0x4504('0x13')];this['dialNoAnswerRetryFrequency']=_0x2259d3[_0x4504('0x14')];this[_0x4504('0x15')]=_0x2259d3['dialGlobalMaxRetry'];this[_0x4504('0x16')]=_0x2259d3[_0x4504('0x16')]||0x3;this[_0x4504('0x17')]=_0x2259d3[_0x4504('0x17')]||0x96;this['dialDropMaxRetry']=_0x2259d3['dialDropMaxRetry']||0x3;this[_0x4504('0x18')]=_0x2259d3['dialDropRetryFrequency']||0x96;this[_0x4504('0x19')]=_0x2259d3['dialAbandonedMaxRetry']||0x3;this[_0x4504('0x1a')]=_0x2259d3[_0x4504('0x1a')]||0x96;this[_0x4504('0x1b')]=_0x2259d3['dialMachineMaxRetry']||0x3;this[_0x4504('0x1c')]=_0x2259d3[_0x4504('0x1c')]||0x96;this[_0x4504('0x1d')]=_0x2259d3[_0x4504('0x1d')]||0x3;this[_0x4504('0x1e')]=_0x2259d3[_0x4504('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x2259d3['dialOrderByScheduledAt']||'DESC';this[_0x4504('0x1f')]=_0x2259d3[_0x4504('0x1f')]||undefined;this[_0x4504('0x20')]=_0x2259d3[_0x4504('0x20')]||undefined;this[_0x4504('0x21')]=_0x2259d3['dialCutDigit']||undefined;this[_0x4504('0x22')]=_0x2259d3[_0x4504('0x22')]?_0x2259d3[_0x4504('0x22')]:undefined;this[_0x4504('0x23')]=_0x2259d3[_0x4504('0x23')]?_0x2259d3[_0x4504('0x23')]:undefined;this['Interval']=_0x2259d3[_0x4504('0x24')]?_0x2259d3[_0x4504('0x24')]:undefined;this['SquareProject']=_0x2259d3[_0x4504('0x25')]?_0x2259d3[_0x4504('0x25')]:undefined;this['dialQueueProject']=_0x2259d3[_0x4504('0x25')]?_0x2259d3['SquareProject']['name']:undefined;this[_0x4504('0x26')]=_0x2259d3[_0x4504('0x26')]||![];this[_0x4504('0x27')]=_0x2259d3['dialAMDInitialSilence'];this[_0x4504('0x28')]=_0x2259d3[_0x4504('0x28')];this[_0x4504('0x29')]=_0x2259d3[_0x4504('0x29')];this[_0x4504('0x2a')]=_0x2259d3['dialAMDTotalAnalysisTime'];this[_0x4504('0x2b')]=_0x2259d3['dialAMDMinWordLength'];this[_0x4504('0x2c')]=_0x2259d3[_0x4504('0x2c')];this[_0x4504('0x2d')]=_0x2259d3[_0x4504('0x2d')];this[_0x4504('0x2e')]=_0x2259d3[_0x4504('0x2e')];this[_0x4504('0x2f')]=_0x2259d3['dialAMDMaximumWordLength'];}module[_0x4504('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 33d03aa..3fac773 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 _0xee58=['starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','monitor','monitorFilename','monitors','transferType','exports'];(function(_0x5984da,_0x374813){var _0x1fa87e=function(_0x4b0d73){while(--_0x4b0d73){_0x5984da['push'](_0x5984da['shift']());}};_0x1fa87e(++_0x374813);}(_0xee58,0x104));var _0x8ee5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xee58[_0x3947c9];return _0x2e7871;};'use strict';function Channel(){this[_0x8ee5('0x0')]=null;this[_0x8ee5('0x1')]='';this[_0x8ee5('0x2')]='';this['calleridnum']=0x0;this[_0x8ee5('0x3')]='';this[_0x8ee5('0x4')]=undefined;this[_0x8ee5('0x5')]=undefined;this['accountcode']=0x0;this[_0x8ee5('0x6')]='';this[_0x8ee5('0x7')]=0x0;this[_0x8ee5('0x8')]=0x0;this[_0x8ee5('0x9')]=0x0;this[_0x8ee5('0xa')]=![];this[_0x8ee5('0xb')]=null;this[_0x8ee5('0xc')]=null;this[_0x8ee5('0xd')]=![];this[_0x8ee5('0xe')]=![];this[_0x8ee5('0xf')]='';this[_0x8ee5('0x10')]='';this[_0x8ee5('0x11')]=0x0;this['billableseconds']=0x0;this[_0x8ee5('0x12')]=0x0;this[_0x8ee5('0x13')]=null;this[_0x8ee5('0x14')]=null;this['disposition']=null;this[_0x8ee5('0x15')]=![];this[_0x8ee5('0x16')]=null;this['queue']=null;this[_0x8ee5('0x17')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x8ee5('0x18')]=undefined;this['mohtime']=0x0;}module[_0x8ee5('0x19')]=Channel; \ No newline at end of file +var _0x1985=['linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context'];(function(_0xafd4bd,_0x7a78d4){var _0x870ad7=function(_0x5bca7b){while(--_0x5bca7b){_0xafd4bd['push'](_0xafd4bd['shift']());}};_0x870ad7(++_0x7a78d4);}(_0x1985,0x138));var _0x5198=function(_0x4074a5,_0x193270){_0x4074a5=_0x4074a5-0x0;var _0x6f8f2c=_0x1985[_0x4074a5];return _0x6f8f2c;};'use strict';function Channel(){this[_0x5198('0x0')]=null;this['channel']='';this[_0x5198('0x1')]='';this['calleridnum']=0x0;this[_0x5198('0x2')]='';this[_0x5198('0x3')]=undefined;this[_0x5198('0x4')]=undefined;this[_0x5198('0x5')]=0x0;this[_0x5198('0x6')]='';this['uniqueid']=0x0;this[_0x5198('0x7')]=0x0;this[_0x5198('0x8')]=0x0;this[_0x5198('0x9')]=![];this[_0x5198('0xa')]=null;this[_0x5198('0xb')]=null;this[_0x5198('0xc')]=![];this[_0x5198('0xd')]=![];this[_0x5198('0xe')]='';this[_0x5198('0xf')]='';this[_0x5198('0x10')]=0x0;this[_0x5198('0x11')]=0x0;this[_0x5198('0x12')]=0x0;this['type']=null;this[_0x5198('0x13')]=null;this[_0x5198('0x14')]=null;this[_0x5198('0x15')]=![];this[_0x5198('0x16')]=null;this[_0x5198('0x17')]=null;this[_0x5198('0x18')]=[];this[_0x5198('0x19')]=undefined;this[_0x5198('0x1a')]=undefined;this[_0x5198('0x1b')]=undefined;this[_0x5198('0x1c')]=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 62b2b1c..c27c78d 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 _0x383d=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x57604d,_0x3e9d7d){var _0x43e8f3=function(_0x4d4214){while(--_0x4d4214){_0x57604d['push'](_0x57604d['shift']());}};_0x43e8f3(++_0x3e9d7d);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';function DeskAccount(_0x26f5cd){this['id']=_0x26f5cd['id']||0x0;this['name']=_0x26f5cd[_0xd383('0x0')]||'';this[_0xd383('0x1')]=_0x26f5cd[_0xd383('0x1')]||'';this['remoteUri']=_0x26f5cd[_0xd383('0x2')]||'';this[_0xd383('0x3')]=_0x26f5cd[_0xd383('0x3')]||'';this[_0xd383('0x4')]=_0x26f5cd[_0xd383('0x4')]||'';this[_0xd383('0x5')]=_0x26f5cd['consumerKey']||'';this[_0xd383('0x6')]=_0x26f5cd[_0xd383('0x6')]||'';this[_0xd383('0x7')]=_0x26f5cd[_0xd383('0x7')]||'';this[_0xd383('0x8')]=_0x26f5cd['tokenSecret']||'';this['type']=_0x26f5cd[_0xd383('0x9')]||'';this[_0xd383('0xa')]=_0x26f5cd['serverUrl']||'';this[_0xd383('0xb')]=_0x26f5cd[_0xd383('0xb')]||{};}module[_0xd383('0xc')]=DeskAccount; \ No newline at end of file +var _0xe4b8=['username','remoteUri','password','consumerKey','consumerSecret','token','serverUrl','Configurations','name'];(function(_0x82868c,_0x27c921){var _0x2437bf=function(_0x2e5bd6){while(--_0x2e5bd6){_0x82868c['push'](_0x82868c['shift']());}};_0x2437bf(++_0x27c921);}(_0xe4b8,0x179));var _0x8e4b=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe4b8[_0x599f41];return _0x2e4d58;};'use strict';function DeskAccount(_0x5ed225){this['id']=_0x5ed225['id']||0x0;this[_0x8e4b('0x0')]=_0x5ed225[_0x8e4b('0x0')]||'';this[_0x8e4b('0x1')]=_0x5ed225[_0x8e4b('0x1')]||'';this[_0x8e4b('0x2')]=_0x5ed225[_0x8e4b('0x2')]||'';this['authType']=_0x5ed225['authType']||'';this[_0x8e4b('0x3')]=_0x5ed225[_0x8e4b('0x3')]||'';this[_0x8e4b('0x4')]=_0x5ed225['consumerKey']||'';this[_0x8e4b('0x5')]=_0x5ed225['consumerSecret']||'';this[_0x8e4b('0x6')]=_0x5ed225['token']||'';this['tokenSecret']=_0x5ed225['tokenSecret']||'';this['type']=_0x5ed225['type']||'';this[_0x8e4b('0x7')]=_0x5ed225['serverUrl']||'';this[_0x8e4b('0x8')]=_0x5ed225[_0x8e4b('0x8')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 57cc600..1a2e77e 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 _0x6dfb=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x6dfb,0x114));var _0xb6df=function(_0x1322d7,_0xbdf1c0){_0x1322d7=_0x1322d7-0x0;var _0x55d13b=_0x6dfb[_0x1322d7];return _0x55d13b;};'use strict';function Dynamics365Account(_0x5e2dd7){this['id']=_0x5e2dd7['id']||0x0;this[_0xb6df('0x0')]=_0x5e2dd7[_0xb6df('0x0')]||'';this[_0xb6df('0x1')]=_0x5e2dd7[_0xb6df('0x1')]||'';this['password']=_0x5e2dd7[_0xb6df('0x2')]||'';this['remoteUri']=_0x5e2dd7[_0xb6df('0x3')]||'';this[_0xb6df('0x4')]=_0x5e2dd7[_0xb6df('0x4')]||'';this[_0xb6df('0x5')]=_0x5e2dd7['clientId']||'';this[_0xb6df('0x6')]=_0x5e2dd7[_0xb6df('0x6')]||{};this[_0xb6df('0x7')]=_0x5e2dd7[_0xb6df('0x7')]||'';this['Configurations']=_0x5e2dd7[_0xb6df('0x8')]||{};}module[_0xb6df('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x2c4f=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x5aa9f5,_0x30da9a){var _0x63770e=function(_0x4772e9){while(--_0x4772e9){_0x5aa9f5['push'](_0x5aa9f5['shift']());}};_0x63770e(++_0x30da9a);}(_0x2c4f,0xc8));var _0xf2c4=function(_0x11de8b,_0x13a63d){_0x11de8b=_0x11de8b-0x0;var _0x22f2b5=_0x2c4f[_0x11de8b];return _0x22f2b5;};'use strict';function Dynamics365Account(_0x4d160e){this['id']=_0x4d160e['id']||0x0;this['name']=_0x4d160e[_0xf2c4('0x0')]||'';this[_0xf2c4('0x1')]=_0x4d160e[_0xf2c4('0x1')]||'';this[_0xf2c4('0x2')]=_0x4d160e[_0xf2c4('0x2')]||'';this[_0xf2c4('0x3')]=_0x4d160e[_0xf2c4('0x3')]||'';this['tenantId']=_0x4d160e[_0xf2c4('0x4')]||'';this[_0xf2c4('0x5')]=_0x4d160e[_0xf2c4('0x5')]||'';this[_0xf2c4('0x6')]=_0x4d160e[_0xf2c4('0x6')]||{};this[_0xf2c4('0x7')]=_0x4d160e['serverUrl']||'';this[_0xf2c4('0x8')]=_0x4d160e['Configurations']||{};}module[_0xf2c4('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 cbaa665..6775773 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 _0x4d79=['tech','Trunk','ListId','key','name','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x408c59,_0x347808){var _0x24bcd8=function(_0x3afdba){while(--_0x3afdba){_0x408c59['push'](_0x408c59['shift']());}};_0x24bcd8(++_0x347808);}(_0x4d79,0x10e));var _0x94d7=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x4d79[_0x540133];return _0x26b6e9;};'use strict';function FaxAccount(_0x394acd){this['id']=_0x394acd['id']||0x0;this[_0x94d7('0x0')]=_0x394acd[_0x94d7('0x0')]||'';this['description']=_0x394acd['description'];this[_0x94d7('0x1')]=_0x394acd['ecm'];this[_0x94d7('0x2')]=_0x394acd[_0x94d7('0x2')];this[_0x94d7('0x3')]=_0x394acd[_0x94d7('0x3')];this['minrate']=_0x394acd[_0x94d7('0x4')]||0x960;this['maxrate']=_0x394acd['maxrate']||0x3840;this[_0x94d7('0x5')]=_0x394acd[_0x94d7('0x5')]||_0x94d7('0x6');this[_0x94d7('0x7')]=_0x394acd[_0x94d7('0x7')]||'no';this[_0x94d7('0x8')]=_0x394acd['faxdetect']||'no';this[_0x94d7('0x9')]=_0x394acd[_0x94d7('0x9')]||0x1388;this['tech']=_0x394acd[_0x94d7('0xa')]||'SIP';this[_0x94d7('0xb')]=_0x394acd[_0x94d7('0xb')]?_0x394acd[_0x94d7('0xb')]:undefined;this[_0x94d7('0xc')]=_0x394acd[_0x94d7('0xc')];this[_0x94d7('0xd')]=_0x394acd[_0x94d7('0xd')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xe814=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x57c27c,_0x57993d){var _0x4b4dae=function(_0x370b6e){while(--_0x370b6e){_0x57c27c['push'](_0x57c27c['shift']());}};_0x4b4dae(++_0x57993d);}(_0xe814,0x1b5));var _0x4e81=function(_0x2d7835,_0x3a6f23){_0x2d7835=_0x2d7835-0x0;var _0x1348cb=_0xe814[_0x2d7835];return _0x1348cb;};'use strict';function FaxAccount(_0x542708){this['id']=_0x542708['id']||0x0;this[_0x4e81('0x0')]=_0x542708[_0x4e81('0x0')]||'';this[_0x4e81('0x1')]=_0x542708[_0x4e81('0x1')];this[_0x4e81('0x2')]=_0x542708[_0x4e81('0x2')];this['headerinfo']=_0x542708[_0x4e81('0x3')];this['localstationid']=_0x542708['localstationid'];this['minrate']=_0x542708[_0x4e81('0x4')]||0x960;this[_0x4e81('0x5')]=_0x542708[_0x4e81('0x5')]||0x3840;this[_0x4e81('0x6')]=_0x542708[_0x4e81('0x6')]||'v17,v27,v29';this[_0x4e81('0x7')]=_0x542708[_0x4e81('0x7')]||'no';this[_0x4e81('0x8')]=_0x542708[_0x4e81('0x8')]||'no';this[_0x4e81('0x9')]=_0x542708[_0x4e81('0x9')]||0x1388;this[_0x4e81('0xa')]=_0x542708[_0x4e81('0xa')]||_0x4e81('0xb');this[_0x4e81('0xc')]=_0x542708[_0x4e81('0xc')]?_0x542708[_0x4e81('0xc')]:undefined;this['ListId']=_0x542708[_0x4e81('0xd')];this[_0x4e81('0xe')]=_0x542708[_0x4e81('0xe')];}module[_0x4e81('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 ead35c0..a9a9100 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 _0x4479=['Configurations','name','username','apiKey','remoteUri','serverUrl'];(function(_0x2e2e88,_0x4bb6bf){var _0x52c753=function(_0x5ab9f3){while(--_0x5ab9f3){_0x2e2e88['push'](_0x2e2e88['shift']());}};_0x52c753(++_0x4bb6bf);}(_0x4479,0x18d));var _0x9447=function(_0x36b5ca,_0x4fa10f){_0x36b5ca=_0x36b5ca-0x0;var _0x4a4313=_0x4479[_0x36b5ca];return _0x4a4313;};'use strict';function FreshdeskAccount(_0x5619a8){this['id']=_0x5619a8['id']||0x0;this['name']=_0x5619a8[_0x9447('0x0')]||'';this['username']=_0x5619a8[_0x9447('0x1')]||'';this[_0x9447('0x2')]=_0x5619a8['token']||'';this[_0x9447('0x3')]=_0x5619a8[_0x9447('0x3')]||'';this['serverUrl']=_0x5619a8[_0x9447('0x4')]||'';this[_0x9447('0x5')]=_0x5619a8['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x2f6f=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xa52a08,_0x2dfc09){var _0x14b5bd=function(_0x1ae907){while(--_0x1ae907){_0xa52a08['push'](_0xa52a08['shift']());}};_0x14b5bd(++_0x2dfc09);}(_0x2f6f,0x17f));var _0xf2f6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2f6f[_0x501510];return _0x1e6ee5;};'use strict';function FreshdeskAccount(_0x3287a3){this['id']=_0x3287a3['id']||0x0;this['name']=_0x3287a3[_0xf2f6('0x0')]||'';this[_0xf2f6('0x1')]=_0x3287a3[_0xf2f6('0x1')]||'';this[_0xf2f6('0x2')]=_0x3287a3[_0xf2f6('0x3')]||'';this[_0xf2f6('0x4')]=_0x3287a3[_0xf2f6('0x4')]||'';this[_0xf2f6('0x5')]=_0x3287a3[_0xf2f6('0x5')]||'';this['Configurations']=_0x3287a3[_0xf2f6('0x6')]||{};}module[_0xf2f6('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 f11c5ad..fe3eb1a 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 _0x1d3f=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x4d5689,_0x3c3925){var _0x42ea18=function(_0x1b86d7){while(--_0x1b86d7){_0x4d5689['push'](_0x4d5689['shift']());}};_0x42ea18(++_0x3c3925);}(_0x1d3f,0x1e4));var _0xf1d3=function(_0x31ce33,_0x1a7f94){_0x31ce33=_0x31ce33-0x0;var _0x32d860=_0x1d3f[_0x31ce33];return _0x32d860;};'use strict';function FreshsalesAccount(_0x4a4ae1){this['id']=_0x4a4ae1['id']||0x0;this[_0xf1d3('0x0')]=_0x4a4ae1[_0xf1d3('0x0')]||'';this['username']=_0x4a4ae1[_0xf1d3('0x1')]||'';this[_0xf1d3('0x2')]=_0x4a4ae1['token']||'';this['remoteUri']=_0x4a4ae1[_0xf1d3('0x3')]||'';this[_0xf1d3('0x4')]=_0x4a4ae1[_0xf1d3('0x4')]||'';this[_0xf1d3('0x5')]=_0x4a4ae1[_0xf1d3('0x5')]||{};}module[_0xf1d3('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xe54c=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xe54c,0x15c));var _0xce54=function(_0x3d6135,_0x256136){_0x3d6135=_0x3d6135-0x0;var _0x16f3c1=_0xe54c[_0x3d6135];return _0x16f3c1;};'use strict';function FreshsalesAccount(_0x386d72){this['id']=_0x386d72['id']||0x0;this[_0xce54('0x0')]=_0x386d72[_0xce54('0x0')]||'';this[_0xce54('0x1')]=_0x386d72[_0xce54('0x1')]||'';this[_0xce54('0x2')]=_0x386d72[_0xce54('0x3')]||'';this['remoteUri']=_0x386d72[_0xce54('0x4')]||'';this[_0xce54('0x5')]=_0x386d72[_0xce54('0x5')]||'';this[_0xce54('0x6')]=_0x386d72['Configurations']||{};}module[_0xce54('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 e079994..ce2545e 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 _0x53e6=['variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo'];(function(_0x1eccb3,_0x3dc5d2){var _0x19b94a=function(_0x19f9a9){while(--_0x19f9a9){_0x1eccb3['push'](_0x1eccb3['shift']());}};_0x19b94a(++_0x3dc5d2);}(_0x53e6,0x178));var _0x653e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x53e6[_0x4b369d];return _0x571a98;};'use strict';function QueueReport(){this[_0x653e('0x0')]=_0x653e('0x1');this[_0x653e('0x2')]='';this[_0x653e('0x3')]='';this[_0x653e('0x4')]='';this['queue']='';this[_0x653e('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0x653e('0x6')]=![];this[_0x653e('0x7')]=null;this[_0x653e('0x8')]=![];this[_0x653e('0x9')]=null;this[_0x653e('0xa')]=![];this['queuecallerexitAt']=null;this[_0x653e('0xb')]=0x1;this[_0x653e('0xc')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x653e('0xd')]='';this[_0x653e('0xe')]='';this[_0x653e('0xf')]='';this[_0x653e('0x10')]='';this[_0x653e('0x11')]=0x0;this[_0x653e('0x12')]=![];this[_0x653e('0x13')]='';this['mohtime']=0x0;this[_0x653e('0x14')]={};}module[_0x653e('0x15')]=QueueReport; \ No newline at end of file +var _0xf190=['count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','accountcode','exten','priority','holdtime','assigned','mohtime','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf190,0xc7));var _0x0f19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf190[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0x0f19('0x0')]='inbound';this[_0x0f19('0x1')]='';this[_0x0f19('0x2')]='';this[_0x0f19('0x3')]='';this[_0x0f19('0x4')]='';this[_0x0f19('0x5')]=null;this[_0x0f19('0x6')]=null;this[_0x0f19('0x7')]=0x1;this[_0x0f19('0x8')]=0x1;this[_0x0f19('0x9')]=![];this[_0x0f19('0xa')]=null;this['queuecallercomplete']=![];this[_0x0f19('0xb')]=null;this[_0x0f19('0xc')]=![];this[_0x0f19('0xd')]=null;this['originalposition']=0x1;this[_0x0f19('0xe')]='';this[_0x0f19('0xf')]='';this['connectedlinename']='';this[_0x0f19('0x10')]='';this['context']='';this[_0x0f19('0x11')]='';this[_0x0f19('0x12')]='';this[_0x0f19('0x13')]=0x0;this[_0x0f19('0x14')]=![];this['lastAssignedTo']='';this[_0x0f19('0x15')]=0x0;this['variables']={};}module[_0x0f19('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 1038877..39e099b 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 _0x9606=['exports','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9606,0x1af));var _0x6960=function(_0x2e20f2,_0x30b124){_0x2e20f2=_0x2e20f2-0x0;var _0x53c611=_0x9606[_0x2e20f2];return _0x53c611;};'use strict';function SalesforceAccount(_0x21fdb5){this['id']=_0x21fdb5['id']||0x0;this['name']=_0x21fdb5['name']||'';this['username']=_0x21fdb5[_0x6960('0x0')]||'';this[_0x6960('0x1')]=_0x21fdb5[_0x6960('0x1')]||'';this['password']=_0x21fdb5[_0x6960('0x2')]||'';this[_0x6960('0x3')]=_0x21fdb5[_0x6960('0x3')]||'';this[_0x6960('0x4')]=_0x21fdb5[_0x6960('0x4')]||'';this[_0x6960('0x5')]=_0x21fdb5[_0x6960('0x5')]||'';this[_0x6960('0x6')]=_0x21fdb5[_0x6960('0x6')]||_0x6960('0x7');this[_0x6960('0x8')]=_0x21fdb5[_0x6960('0x8')]||'';this['Configurations']=_0x21fdb5['Configurations']||{};}module[_0x6960('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xcb3b=['Configurations','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x12bde6,_0x4649bc){var _0x5c5bf9=function(_0x49df1d){while(--_0x49df1d){_0x12bde6['push'](_0x12bde6['shift']());}};_0x5c5bf9(++_0x4649bc);}(_0xcb3b,0x1af));var _0xbcb3=function(_0x54af0f,_0x2cbfe8){_0x54af0f=_0x54af0f-0x0;var _0x1e27a8=_0xcb3b[_0x54af0f];return _0x1e27a8;};'use strict';function SalesforceAccount(_0x59016f){this['id']=_0x59016f['id']||0x0;this['name']=_0x59016f['name']||'';this[_0xbcb3('0x0')]=_0x59016f[_0xbcb3('0x0')]||'';this[_0xbcb3('0x1')]=_0x59016f[_0xbcb3('0x1')]||'';this[_0xbcb3('0x2')]=_0x59016f[_0xbcb3('0x2')]||'';this['clientId']=_0x59016f[_0xbcb3('0x3')]||'';this[_0xbcb3('0x4')]=_0x59016f[_0xbcb3('0x4')]||'';this[_0xbcb3('0x5')]=_0x59016f[_0xbcb3('0x5')]||'';this[_0xbcb3('0x6')]=_0x59016f['type']||_0xbcb3('0x7');this[_0xbcb3('0x8')]=_0x59016f[_0xbcb3('0x8')]||'';this[_0xbcb3('0x9')]=_0x59016f['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a4ef7ee..5d5a94e 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 _0x0893=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1a635e,_0x241651){var _0x5b3345=function(_0x5d94d8){while(--_0x5d94d8){_0x1a635e['push'](_0x1a635e['shift']());}};_0x5b3345(++_0x241651);}(_0x0893,0xc7));var _0x3089=function(_0x315434,_0x54ec22){_0x315434=_0x315434-0x0;var _0x32ca82=_0x0893[_0x315434];return _0x32ca82;};'use strict';function ServicenowAccount(_0x3029ec){this['id']=_0x3029ec['id']||0x0;this[_0x3089('0x0')]=_0x3029ec['name']||'';this[_0x3089('0x1')]=_0x3029ec[_0x3089('0x1')]||'';this[_0x3089('0x2')]=_0x3029ec['password']||'';this[_0x3089('0x3')]=_0x3029ec[_0x3089('0x3')]||'';this[_0x3089('0x4')]=_0x3029ec['serverUrl']||'';this[_0x3089('0x5')]=_0x3029ec['Configurations']||{};}module[_0x3089('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xc9c7=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x4d0d3c,_0x513970){var _0x4c9f4e=function(_0x3d47ce){while(--_0x3d47ce){_0x4d0d3c['push'](_0x4d0d3c['shift']());}};_0x4c9f4e(++_0x513970);}(_0xc9c7,0x150));var _0x7c9c=function(_0x53d5fa,_0x2f3698){_0x53d5fa=_0x53d5fa-0x0;var _0x4dcffc=_0xc9c7[_0x53d5fa];return _0x4dcffc;};'use strict';function ServicenowAccount(_0x57bd1d){this['id']=_0x57bd1d['id']||0x0;this[_0x7c9c('0x0')]=_0x57bd1d['name']||'';this[_0x7c9c('0x1')]=_0x57bd1d['username']||'';this['password']=_0x57bd1d[_0x7c9c('0x2')]||'';this[_0x7c9c('0x3')]=_0x57bd1d['remoteUri']||'';this[_0x7c9c('0x4')]=_0x57bd1d[_0x7c9c('0x4')]||'';this[_0x7c9c('0x5')]=_0x57bd1d[_0x7c9c('0x5')]||{};}module[_0x7c9c('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d3fc799..6a4e31b 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 _0x60d7=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x4b7ff7,_0x305f98){var _0x3b0227=function(_0xd1784c){while(--_0xd1784c){_0x4b7ff7['push'](_0x4b7ff7['shift']());}};_0x3b0227(++_0x305f98);}(_0x60d7,0x190));var _0x760d=function(_0x55f308,_0x1719e8){_0x55f308=_0x55f308-0x0;var _0x1eeb98=_0x60d7[_0x55f308];return _0x1eeb98;};'use strict';function SugarcrmAccount(_0x2f3ebf){this['id']=_0x2f3ebf['id']||0x0;this['name']=_0x2f3ebf[_0x760d('0x0')]||'';this['username']=_0x2f3ebf[_0x760d('0x1')]||'';this['password']=_0x2f3ebf[_0x760d('0x2')]||'';this[_0x760d('0x3')]=_0x2f3ebf[_0x760d('0x3')]||'';this[_0x760d('0x4')]=_0x2f3ebf[_0x760d('0x4')]||'';this[_0x760d('0x5')]=_0x2f3ebf[_0x760d('0x5')]||{};}module[_0x760d('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x0797=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x0797,0x122));var _0x7079=function(_0x441aeb,_0x40c41e){_0x441aeb=_0x441aeb-0x0;var _0x56e6fb=_0x0797[_0x441aeb];return _0x56e6fb;};'use strict';function SugarcrmAccount(_0x596a33){this['id']=_0x596a33['id']||0x0;this[_0x7079('0x0')]=_0x596a33[_0x7079('0x0')]||'';this[_0x7079('0x1')]=_0x596a33[_0x7079('0x1')]||'';this['password']=_0x596a33[_0x7079('0x2')]||'';this[_0x7079('0x3')]=_0x596a33[_0x7079('0x3')]||'';this[_0x7079('0x4')]=_0x596a33['serverUrl']||'';this[_0x7079('0x5')]=_0x596a33[_0x7079('0x5')]||{};}module[_0x7079('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 76ec295..70b45ca 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 _0x1576=['name','accountcode','stateTime','status','unknown','address','exports'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x1576,0x142));var _0x6157=function(_0x14e001,_0x569bf){_0x14e001=_0x14e001-0x0;var _0x2c09da=_0x1576[_0x14e001];return _0x2c09da;};'use strict';function Telephone(_0x172de4){this['id']=_0x172de4['id']||0x0;this[_0x6157('0x0')]=_0x172de4['name']||'';this[_0x6157('0x1')]=_0x172de4['accountcode']||'';this['state']='unknown';this[_0x6157('0x2')]=0x0;this[_0x6157('0x3')]=_0x6157('0x4');this[_0x6157('0x5')]='';}module[_0x6157('0x6')]=Telephone; \ No newline at end of file +var _0x45b8=['stateTime','exports','name','accountcode','state','unknown'];(function(_0x382b15,_0x4f251c){var _0x5b0b79=function(_0x3a9b9b){while(--_0x3a9b9b){_0x382b15['push'](_0x382b15['shift']());}};_0x5b0b79(++_0x4f251c);}(_0x45b8,0x7a));var _0x845b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x45b8[_0x20a584];return _0x4b41a8;};'use strict';function Telephone(_0x12e230){this['id']=_0x12e230['id']||0x0;this[_0x845b('0x0')]=_0x12e230['name']||'';this['accountcode']=_0x12e230[_0x845b('0x1')]||'';this[_0x845b('0x2')]=_0x845b('0x3');this[_0x845b('0x4')]=0x0;this['status']=_0x845b('0x3');this['address']='';}module[_0x845b('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 17e01e3..1b5b727 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 _0x7973=['name','html'];(function(_0x5dc4f7,_0x1967d9){var _0x530021=function(_0x27363a){while(--_0x27363a){_0x5dc4f7['push'](_0x5dc4f7['shift']());}};_0x530021(++_0x1967d9);}(_0x7973,0x17c));var _0x3797=function(_0x52516a,_0x408e5e){_0x52516a=_0x52516a-0x0;var _0x541ee2=_0x7973[_0x52516a];return _0x541ee2;};'use strict';function template(_0x49b3d7){this['id']=_0x49b3d7['id']||0x0;this[_0x3797('0x0')]=_0x49b3d7[_0x3797('0x0')]||'';this[_0x3797('0x1')]=_0x49b3d7['html']||'';}module['exports']=template; \ No newline at end of file +var _0xed27=['html','exports','name'];(function(_0x3514ea,_0xaf1e6a){var _0x38d96c=function(_0x5c4174){while(--_0x5c4174){_0x3514ea['push'](_0x3514ea['shift']());}};_0x38d96c(++_0xaf1e6a);}(_0xed27,0x65));var _0x7ed2=function(_0x218d32,_0x4f0884){_0x218d32=_0x218d32-0x0;var _0x138554=_0xed27[_0x218d32];return _0x138554;};'use strict';function template(_0x40ed70){this['id']=_0x40ed70['id']||0x0;this[_0x7ed2('0x0')]=_0x40ed70['name']||'';this[_0x7ed2('0x1')]=_0x40ed70[_0x7ed2('0x1')]||'';}module[_0x7ed2('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 0499d32..b4575c0 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 _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x476f73,_0x2a7695){var _0x150b12=function(_0x23fda9){while(--_0x23fda9){_0x476f73['push'](_0x476f73['shift']());}};_0x150b12(++_0x2a7695);}(_0xedd9,0xfc));var _0x9edd=function(_0x453ccf,_0x4ed71d){_0x453ccf=_0x453ccf-0x0;var _0x1c6582=_0xedd9[_0x453ccf];return _0x1c6582;};'use strict';function Trigger(_0x265eb8){this['id']=_0x265eb8['id']||0x0;this[_0x9edd('0x0')]=_0x265eb8[_0x9edd('0x0')]||'';this[_0x9edd('0x1')]=_0x265eb8[_0x9edd('0x1')]||_0x9edd('0x2');this[_0x9edd('0x3')]=_0x265eb8[_0x9edd('0x3')]||![];this[_0x9edd('0x4')]=_0x265eb8['AllConditions']||[];this[_0x9edd('0x5')]=_0x265eb8[_0x9edd('0x5')]||[];this[_0x9edd('0x6')]=_0x265eb8[_0x9edd('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x008c=['name','channel','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x26d9b3,_0x591f4e){var _0x15c226=function(_0x17bbdb){while(--_0x17bbdb){_0x26d9b3['push'](_0x26d9b3['shift']());}};_0x15c226(++_0x591f4e);}(_0x008c,0x188));var _0xc008=function(_0x4b7976,_0x55e10b){_0x4b7976=_0x4b7976-0x0;var _0x422298=_0x008c[_0x4b7976];return _0x422298;};'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 25afbc9..0c00368 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 _0x24ee=['host','port','domain','refresh','stateRegistry','registrationtime','address','defaultuser','exports','name','state','unknown','stateTime','status','registry','indexOf','split'];(function(_0x1a0a74,_0x29554c){var _0x571aa3=function(_0x46d3b0){while(--_0x46d3b0){_0x1a0a74['push'](_0x1a0a74['shift']());}};_0x571aa3(++_0x29554c);}(_0x24ee,0x1b2));var _0xe24e=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x24ee[_0x541ea6];return _0x3c3e84;};'use strict';function Trunk(_0x576de9){this['id']=_0x576de9['id']||0x0;this['active']=_0x576de9['active']||![];this['name']=_0x576de9[_0xe24e('0x0')]||'';this[_0xe24e('0x1')]=_0xe24e('0x2');this[_0xe24e('0x3')]=0x0;this[_0xe24e('0x4')]=_0xe24e('0x2');this[_0xe24e('0x5')]=_0x576de9[_0xe24e('0x5')]&&_0x576de9['registry'][_0xe24e('0x6')](':')?_0x576de9[_0xe24e('0x5')][_0xe24e('0x7')](':')[0x0]:'';this[_0xe24e('0x8')]='';this[_0xe24e('0x9')]='';this[_0xe24e('0xa')]='';this['domainport']='';this[_0xe24e('0xb')]='';this[_0xe24e('0xc')]='unknown';this[_0xe24e('0xd')]='';this[_0xe24e('0xe')]='';this[_0xe24e('0xf')]=_0x576de9['defaultuser']||'';}module[_0xe24e('0x10')]=Trunk; \ No newline at end of file +var _0x4afc=['split','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','state','unknown','stateTime','registry','indexOf'];(function(_0x2332dc,_0x1f1277){var _0x2acdd6=function(_0x31dab5){while(--_0x31dab5){_0x2332dc['push'](_0x2332dc['shift']());}};_0x2acdd6(++_0x1f1277);}(_0x4afc,0x199));var _0xc4af=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x4afc[_0x2c7618];return _0x5ce3f0;};'use strict';function Trunk(_0x2849c6){this['id']=_0x2849c6['id']||0x0;this[_0xc4af('0x0')]=_0x2849c6['active']||![];this['name']=_0x2849c6[_0xc4af('0x1')]||'';this[_0xc4af('0x2')]=_0xc4af('0x3');this[_0xc4af('0x4')]=0x0;this['status']=_0xc4af('0x3');this['registry']=_0x2849c6[_0xc4af('0x5')]&&_0x2849c6[_0xc4af('0x5')][_0xc4af('0x6')](':')?_0x2849c6[_0xc4af('0x5')][_0xc4af('0x7')](':')[0x0]:'';this['host']='';this[_0xc4af('0x8')]='';this[_0xc4af('0x9')]='';this[_0xc4af('0xa')]='';this[_0xc4af('0xb')]='';this[_0xc4af('0xc')]='unknown';this[_0xc4af('0xd')]='';this['address']='';this[_0xc4af('0xe')]=_0x2849c6[_0xc4af('0xe')]||'';}module[_0xc4af('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 6b6d38f..271320f 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 _0x91f8=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x265756,_0x298c09){var _0x4efaa5=function(_0x19e3b4){while(--_0x19e3b4){_0x265756['push'](_0x265756['shift']());}};_0x4efaa5(++_0x298c09);}(_0x91f8,0x95));var _0x891f=function(_0x37dbf3,_0x4ad77d){_0x37dbf3=_0x37dbf3-0x0;var _0x1cda9b=_0x91f8[_0x37dbf3];return _0x1cda9b;};'use strict';function voiceExtension(_0x1e0117){this['id']=_0x1e0117['id']||0x0;this[_0x891f('0x0')]=_0x1e0117[_0x891f('0x0')]||'';this['recordingFormat']=_0x1e0117[_0x891f('0x1')]||_0x891f('0x2');this[_0x891f('0x3')]=_0x1e0117[_0x891f('0x3')]||![];}module[_0x891f('0x4')]=voiceExtension; \ No newline at end of file +var _0x0082=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0082,0x176));var _0x2008=function(_0x13ca6d,_0x28f921){_0x13ca6d=_0x13ca6d-0x0;var _0x3e4ea8=_0x0082[_0x13ca6d];return _0x3e4ea8;};'use strict';function voiceExtension(_0x2a4940){this['id']=_0x2a4940['id']||0x0;this[_0x2008('0x0')]=_0x2a4940[_0x2008('0x0')]||'';this['recordingFormat']=_0x2a4940[_0x2008('0x1')]||_0x2008('0x2');this[_0x2008('0x3')]=_0x2a4940[_0x2008('0x3')]||![];}module[_0x2008('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 506f9a0..64f18e5 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 _0x5f2f=['wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse'];(function(_0x149bb0,_0x2cbeba){var _0x41cfb9=function(_0x176084){while(--_0x176084){_0x149bb0['push'](_0x149bb0['shift']());}};_0x41cfb9(++_0x2cbeba);}(_0x5f2f,0x73));var _0xf5f2=function(_0x374e84,_0x1260ed){_0x374e84=_0x374e84-0x0;var _0x162826=_0x5f2f[_0x374e84];return _0x162826;};'use strict';var statusDesc=[_0xf5f2('0x0'),_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0xf5f2('0x8'),'gsm':_0xf5f2('0x9')};var strategy={'rrmemory':_0xf5f2('0xa'),'roundrobin':_0xf5f2('0xb')};function VoiceQueue(_0x3133bc){this['id']=_0x3133bc['id']||0x0;this[_0xf5f2('0xc')]=_0x3133bc['name']||'';this[_0xf5f2('0xd')]=_0x3133bc[_0xf5f2('0xd')]||'';this[_0xf5f2('0xe')]=_0x3133bc['type']||_0xf5f2('0xf');this[_0xf5f2('0x10')]=0x0;this[_0xf5f2('0x11')]=0x0;this['total']=0x0;this[_0xf5f2('0x12')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xf5f2('0x13')]=0x0;this[_0xf5f2('0x14')]=0x0;this['abandoned']=0x0;this[_0xf5f2('0x15')]=0x0;this[_0xf5f2('0x16')]=0x0;this[_0xf5f2('0x17')]=_0x3133bc[_0xf5f2('0x17')]||![];this[_0xf5f2('0x18')]=_0x3133bc[_0xf5f2('0x18')]||0xa;this['autopause']=_0x3133bc[_0xf5f2('0x19')]||'no';this[_0xf5f2('0x1a')]=!![];this[_0xf5f2('0x1b')]='';this[_0xf5f2('0x1c')]=0x0;this[_0xf5f2('0x1d')]=0x0;this['dialTimezone']=_0x3133bc[_0xf5f2('0x1e')]||null;this[_0xf5f2('0x1f')]=_0x3133bc[_0xf5f2('0x1f')]?_0x3133bc[_0xf5f2('0x1f')]:null;this[_0xf5f2('0x20')]=_0x3133bc[_0xf5f2('0x20')];this[_0xf5f2('0x21')]=_0x3133bc[_0xf5f2('0x21')]||_0xf5f2('0x22');this[_0xf5f2('0x23')]=_0x3133bc[_0xf5f2('0x23')]||0x0;this[_0xf5f2('0x24')]=_0x3133bc[_0xf5f2('0x24')]||0x0;this[_0xf5f2('0x25')]=_0x3133bc[_0xf5f2('0x25')]||0x1;this[_0xf5f2('0x26')]=_0x3133bc[_0xf5f2('0x26')]||'dropRate';this[_0xf5f2('0x27')]=_0x3133bc[_0xf5f2('0x27')]||0.03;this['dialPredictiveInterval']=_0x3133bc['dialPredictiveInterval']||0x258;this[_0xf5f2('0x28')]=_0x3133bc[_0xf5f2('0x28')]||'anonymous';this[_0xf5f2('0x29')]=_0x3133bc[_0xf5f2('0x29')]||_0xf5f2('0x2a');this[_0xf5f2('0x2b')]=_0x3133bc[_0xf5f2('0x2b')]||0x1e;this['dialQueueOptions']=_0x3133bc[_0xf5f2('0x2c')]||_0xf5f2('0x2d');this[_0xf5f2('0x2e')]=_0x3133bc[_0xf5f2('0x2e')]||0x3;this[_0xf5f2('0x2f')]=_0x3133bc['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x3133bc[_0xf5f2('0x30')]||0x3;this[_0xf5f2('0x31')]=_0x3133bc[_0xf5f2('0x31')]||0x96;this[_0xf5f2('0x32')]=_0x3133bc[_0xf5f2('0x32')]||0x3;this[_0xf5f2('0x33')]=_0x3133bc[_0xf5f2('0x33')]||0x96;this[_0xf5f2('0x34')]=_0x3133bc[_0xf5f2('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3133bc[_0xf5f2('0x35')]||0x96;this[_0xf5f2('0x36')]=_0x3133bc[_0xf5f2('0x36')]||0x3;this[_0xf5f2('0x37')]=_0x3133bc[_0xf5f2('0x37')]||0x96;this[_0xf5f2('0x38')]=_0x3133bc['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x3133bc[_0xf5f2('0x39')]||0x96;this[_0xf5f2('0x3a')]=_0x3133bc[_0xf5f2('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x3133bc['dialAbandonedRetryFrequency']||0x96;this[_0xf5f2('0x3b')]=_0x3133bc[_0xf5f2('0x3b')]||0x3;this[_0xf5f2('0x3c')]=_0x3133bc[_0xf5f2('0x3c')]||0x96;this[_0xf5f2('0x3d')]=_0x3133bc['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x3133bc[_0xf5f2('0x3e')]||0x96;this['callAdditionalPhoneAfterMin']=_0x3133bc[_0xf5f2('0x3f')]||0x3;this['dialGlobalMaxRetry']=_0x3133bc[_0xf5f2('0x40')]||0x4;this[_0xf5f2('0x41')]=_0x3133bc[_0xf5f2('0x41')]?_0x3133bc[_0xf5f2('0x41')]:undefined;this[_0xf5f2('0x42')]=_0x3133bc[_0xf5f2('0x42')]?_0x3133bc[_0xf5f2('0x42')]:undefined;this[_0xf5f2('0x43')]=_0x3133bc['dialPrefix']||undefined;this[_0xf5f2('0x44')]=_0x3133bc[_0xf5f2('0x44')]?_0x3133bc[_0xf5f2('0x44')]:undefined;this[_0xf5f2('0x45')]=_0x3133bc[_0xf5f2('0x45')]||_0xf5f2('0x46');this[_0xf5f2('0x47')]=_0x3133bc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf5f2('0x48')]=_0x3133bc[_0xf5f2('0x48')]||undefined;this['strategy']=strategy[_0x3133bc[_0xf5f2('0x49')]]||'rrmemory';this[_0xf5f2('0x4a')]=!![];this[_0xf5f2('0x4b')]=_0x3133bc[_0xf5f2('0x4b')]||![];this[_0xf5f2('0x4c')]=_0x3133bc['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x3133bc[_0xf5f2('0x4d')];this[_0xf5f2('0x4e')]=_0x3133bc[_0xf5f2('0x4e')];this['dialAMDTotalAnalysisTime']=_0x3133bc[_0xf5f2('0x4f')];this['dialAMDMinWordLength']=_0x3133bc[_0xf5f2('0x50')];this['dialAMDBetweenWordsSilence']=_0x3133bc[_0xf5f2('0x51')];this[_0xf5f2('0x52')]=_0x3133bc['dialAMDMaximumNumberOfWords'];this[_0xf5f2('0x53')]=_0x3133bc[_0xf5f2('0x53')];this[_0xf5f2('0x54')]=_0x3133bc[_0xf5f2('0x54')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xf5f2('0x55')]=_0x3133bc[_0xf5f2('0x55')];this[_0xf5f2('0x56')]=0x0;this[_0xf5f2('0x57')]=0x0;this[_0xf5f2('0x58')]=0x0;this[_0xf5f2('0x59')]=0x0;this[_0xf5f2('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xf5f2('0x5b')]=0x0;this[_0xf5f2('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xf5f2('0x5d')]=0x0;this[_0xf5f2('0x5e')]=0x0;this[_0xf5f2('0x5f')]=0x0;this[_0xf5f2('0x60')]=0x0;this[_0xf5f2('0x61')]=0x0;this[_0xf5f2('0x62')]=undefined;this[_0xf5f2('0x63')]=undefined;this[_0xf5f2('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xf5f2('0x65')]=0x0;this[_0xf5f2('0x66')]=0x0;this[_0xf5f2('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xf5f2('0x68')]=0x0;this[_0xf5f2('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3133bc[_0xf5f2('0x6a')]||0x14;this[_0xf5f2('0x6b')]=_0x3133bc[_0xf5f2('0x6a')]||0xa;this[_0xf5f2('0x6c')]=0x0;this[_0xf5f2('0x6d')]=0x0;this[_0xf5f2('0x6e')]=0x1;this[_0xf5f2('0x6f')]=0x0;this[_0xf5f2('0x70')]=0x0;this[_0xf5f2('0x71')]=0x0;this[_0xf5f2('0x72')]=0x0;this[_0xf5f2('0x73')]=_0x3133bc[_0xf5f2('0x73')]||0x1e;this[_0xf5f2('0x74')]=_0x3133bc[_0xf5f2('0x74')]||![];this['dialQueueProject2']=_0x3133bc[_0xf5f2('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x3133bc[_0xf5f2('0x76')]||![];this[_0xf5f2('0x77')]=_0x3133bc[_0xf5f2('0x77')]||![];this[_0xf5f2('0xd')]=monitorFormat[_0x3133bc[_0xf5f2('0xd')]]?monitorFormat[_0x3133bc[_0xf5f2('0xd')]]:undefined;this['mandatoryDisposition']=_0x3133bc[_0xf5f2('0x78')]||![];this[_0xf5f2('0x79')]=_0x3133bc[_0xf5f2('0x79')]?_0x3133bc[_0xf5f2('0x79')]:undefined;}module[_0xf5f2('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x5f2f=['wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse'];(function(_0x2d02e7,_0x57daa3){var _0x4d42d1=function(_0x2bdba8){while(--_0x2bdba8){_0x2d02e7['push'](_0x2d02e7['shift']());}};_0x4d42d1(++_0x57daa3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4b565a,_0x5df1d8){_0x4b565a=_0x4b565a-0x0;var _0x495f66=_0x5f2f[_0x4b565a];return _0x495f66;};'use strict';var statusDesc=[_0xf5f2('0x0'),_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0xf5f2('0x8'),'gsm':_0xf5f2('0x9')};var strategy={'rrmemory':_0xf5f2('0xa'),'roundrobin':_0xf5f2('0xb')};function VoiceQueue(_0x3133bc){this['id']=_0x3133bc['id']||0x0;this[_0xf5f2('0xc')]=_0x3133bc['name']||'';this[_0xf5f2('0xd')]=_0x3133bc[_0xf5f2('0xd')]||'';this[_0xf5f2('0xe')]=_0x3133bc['type']||_0xf5f2('0xf');this[_0xf5f2('0x10')]=0x0;this[_0xf5f2('0x11')]=0x0;this['total']=0x0;this[_0xf5f2('0x12')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xf5f2('0x13')]=0x0;this[_0xf5f2('0x14')]=0x0;this['abandoned']=0x0;this[_0xf5f2('0x15')]=0x0;this[_0xf5f2('0x16')]=0x0;this[_0xf5f2('0x17')]=_0x3133bc[_0xf5f2('0x17')]||![];this[_0xf5f2('0x18')]=_0x3133bc[_0xf5f2('0x18')]||0xa;this['autopause']=_0x3133bc[_0xf5f2('0x19')]||'no';this[_0xf5f2('0x1a')]=!![];this[_0xf5f2('0x1b')]='';this[_0xf5f2('0x1c')]=0x0;this[_0xf5f2('0x1d')]=0x0;this['dialTimezone']=_0x3133bc[_0xf5f2('0x1e')]||null;this[_0xf5f2('0x1f')]=_0x3133bc[_0xf5f2('0x1f')]?_0x3133bc[_0xf5f2('0x1f')]:null;this[_0xf5f2('0x20')]=_0x3133bc[_0xf5f2('0x20')];this[_0xf5f2('0x21')]=_0x3133bc[_0xf5f2('0x21')]||_0xf5f2('0x22');this[_0xf5f2('0x23')]=_0x3133bc[_0xf5f2('0x23')]||0x0;this[_0xf5f2('0x24')]=_0x3133bc[_0xf5f2('0x24')]||0x0;this[_0xf5f2('0x25')]=_0x3133bc[_0xf5f2('0x25')]||0x1;this[_0xf5f2('0x26')]=_0x3133bc[_0xf5f2('0x26')]||'dropRate';this[_0xf5f2('0x27')]=_0x3133bc[_0xf5f2('0x27')]||0.03;this['dialPredictiveInterval']=_0x3133bc['dialPredictiveInterval']||0x258;this[_0xf5f2('0x28')]=_0x3133bc[_0xf5f2('0x28')]||'anonymous';this[_0xf5f2('0x29')]=_0x3133bc[_0xf5f2('0x29')]||_0xf5f2('0x2a');this[_0xf5f2('0x2b')]=_0x3133bc[_0xf5f2('0x2b')]||0x1e;this['dialQueueOptions']=_0x3133bc[_0xf5f2('0x2c')]||_0xf5f2('0x2d');this[_0xf5f2('0x2e')]=_0x3133bc[_0xf5f2('0x2e')]||0x3;this[_0xf5f2('0x2f')]=_0x3133bc['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x3133bc[_0xf5f2('0x30')]||0x3;this[_0xf5f2('0x31')]=_0x3133bc[_0xf5f2('0x31')]||0x96;this[_0xf5f2('0x32')]=_0x3133bc[_0xf5f2('0x32')]||0x3;this[_0xf5f2('0x33')]=_0x3133bc[_0xf5f2('0x33')]||0x96;this[_0xf5f2('0x34')]=_0x3133bc[_0xf5f2('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3133bc[_0xf5f2('0x35')]||0x96;this[_0xf5f2('0x36')]=_0x3133bc[_0xf5f2('0x36')]||0x3;this[_0xf5f2('0x37')]=_0x3133bc[_0xf5f2('0x37')]||0x96;this[_0xf5f2('0x38')]=_0x3133bc['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x3133bc[_0xf5f2('0x39')]||0x96;this[_0xf5f2('0x3a')]=_0x3133bc[_0xf5f2('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x3133bc['dialAbandonedRetryFrequency']||0x96;this[_0xf5f2('0x3b')]=_0x3133bc[_0xf5f2('0x3b')]||0x3;this[_0xf5f2('0x3c')]=_0x3133bc[_0xf5f2('0x3c')]||0x96;this[_0xf5f2('0x3d')]=_0x3133bc['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x3133bc[_0xf5f2('0x3e')]||0x96;this['callAdditionalPhoneAfterMin']=_0x3133bc[_0xf5f2('0x3f')]||0x3;this['dialGlobalMaxRetry']=_0x3133bc[_0xf5f2('0x40')]||0x4;this[_0xf5f2('0x41')]=_0x3133bc[_0xf5f2('0x41')]?_0x3133bc[_0xf5f2('0x41')]:undefined;this[_0xf5f2('0x42')]=_0x3133bc[_0xf5f2('0x42')]?_0x3133bc[_0xf5f2('0x42')]:undefined;this[_0xf5f2('0x43')]=_0x3133bc['dialPrefix']||undefined;this[_0xf5f2('0x44')]=_0x3133bc[_0xf5f2('0x44')]?_0x3133bc[_0xf5f2('0x44')]:undefined;this[_0xf5f2('0x45')]=_0x3133bc[_0xf5f2('0x45')]||_0xf5f2('0x46');this[_0xf5f2('0x47')]=_0x3133bc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf5f2('0x48')]=_0x3133bc[_0xf5f2('0x48')]||undefined;this['strategy']=strategy[_0x3133bc[_0xf5f2('0x49')]]||'rrmemory';this[_0xf5f2('0x4a')]=!![];this[_0xf5f2('0x4b')]=_0x3133bc[_0xf5f2('0x4b')]||![];this[_0xf5f2('0x4c')]=_0x3133bc['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x3133bc[_0xf5f2('0x4d')];this[_0xf5f2('0x4e')]=_0x3133bc[_0xf5f2('0x4e')];this['dialAMDTotalAnalysisTime']=_0x3133bc[_0xf5f2('0x4f')];this['dialAMDMinWordLength']=_0x3133bc[_0xf5f2('0x50')];this['dialAMDBetweenWordsSilence']=_0x3133bc[_0xf5f2('0x51')];this[_0xf5f2('0x52')]=_0x3133bc['dialAMDMaximumNumberOfWords'];this[_0xf5f2('0x53')]=_0x3133bc[_0xf5f2('0x53')];this[_0xf5f2('0x54')]=_0x3133bc[_0xf5f2('0x54')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xf5f2('0x55')]=_0x3133bc[_0xf5f2('0x55')];this[_0xf5f2('0x56')]=0x0;this[_0xf5f2('0x57')]=0x0;this[_0xf5f2('0x58')]=0x0;this[_0xf5f2('0x59')]=0x0;this[_0xf5f2('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xf5f2('0x5b')]=0x0;this[_0xf5f2('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xf5f2('0x5d')]=0x0;this[_0xf5f2('0x5e')]=0x0;this[_0xf5f2('0x5f')]=0x0;this[_0xf5f2('0x60')]=0x0;this[_0xf5f2('0x61')]=0x0;this[_0xf5f2('0x62')]=undefined;this[_0xf5f2('0x63')]=undefined;this[_0xf5f2('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xf5f2('0x65')]=0x0;this[_0xf5f2('0x66')]=0x0;this[_0xf5f2('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xf5f2('0x68')]=0x0;this[_0xf5f2('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3133bc[_0xf5f2('0x6a')]||0x14;this[_0xf5f2('0x6b')]=_0x3133bc[_0xf5f2('0x6a')]||0xa;this[_0xf5f2('0x6c')]=0x0;this[_0xf5f2('0x6d')]=0x0;this[_0xf5f2('0x6e')]=0x1;this[_0xf5f2('0x6f')]=0x0;this[_0xf5f2('0x70')]=0x0;this[_0xf5f2('0x71')]=0x0;this[_0xf5f2('0x72')]=0x0;this[_0xf5f2('0x73')]=_0x3133bc[_0xf5f2('0x73')]||0x1e;this[_0xf5f2('0x74')]=_0x3133bc[_0xf5f2('0x74')]||![];this['dialQueueProject2']=_0x3133bc[_0xf5f2('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x3133bc[_0xf5f2('0x76')]||![];this[_0xf5f2('0x77')]=_0x3133bc[_0xf5f2('0x77')]||![];this[_0xf5f2('0xd')]=monitorFormat[_0x3133bc[_0xf5f2('0xd')]]?monitorFormat[_0x3133bc[_0xf5f2('0xd')]]:undefined;this['mandatoryDisposition']=_0x3133bc[_0xf5f2('0x78')]||![];this[_0xf5f2('0x79')]=_0x3133bc[_0xf5f2('0x79')]?_0x3133bc[_0xf5f2('0x79')]:undefined;}module[_0xf5f2('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index c5995c3..6550137 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 _0xbd54=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x4bee6d,_0x3fbc90){var _0x2f2ea4=function(_0xff81b){while(--_0xff81b){_0x4bee6d['push'](_0x4bee6d['shift']());}};_0x2f2ea4(++_0x3fbc90);}(_0xbd54,0x1d6));var _0x4bd5=function(_0x22bf47,_0x5b3cfd){_0x22bf47=_0x22bf47-0x0;var _0x63e280=_0xbd54[_0x22bf47];return _0x63e280;};'use strict';function VtigerAccount(_0x5ac262){this['id']=_0x5ac262['id']||0x0;this[_0x4bd5('0x0')]=_0x5ac262[_0x4bd5('0x0')]||'';this['username']=_0x5ac262[_0x4bd5('0x1')]||'';this[_0x4bd5('0x2')]=_0x5ac262[_0x4bd5('0x2')]||'';this[_0x4bd5('0x3')]=_0x5ac262['remoteUri']||'';this[_0x4bd5('0x4')]=_0x5ac262[_0x4bd5('0x4')]||'';this[_0x4bd5('0x5')]=_0x5ac262['Configurations']||{};}module[_0x4bd5('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa89f=['accessKey','remoteUri','serverUrl','name','username'];(function(_0x39010b,_0x17e844){var _0x3d8797=function(_0x33924a){while(--_0x33924a){_0x39010b['push'](_0x39010b['shift']());}};_0x3d8797(++_0x17e844);}(_0xa89f,0x1e3));var _0xfa89=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0xa89f[_0xd2e2ab];return _0x1703a2;};'use strict';function VtigerAccount(_0x300278){this['id']=_0x300278['id']||0x0;this[_0xfa89('0x0')]=_0x300278[_0xfa89('0x0')]||'';this[_0xfa89('0x1')]=_0x300278[_0xfa89('0x1')]||'';this[_0xfa89('0x2')]=_0x300278[_0xfa89('0x2')]||'';this[_0xfa89('0x3')]=_0x300278[_0xfa89('0x3')]||'';this['serverUrl']=_0x300278[_0xfa89('0x4')]||'';this['Configurations']=_0x300278['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e7a494a..6dcf009 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x562110,_0x15656b){var _0x2f2cfa=function(_0x4b9a16){while(--_0x4b9a16){_0x562110['push'](_0x562110['shift']());}};_0x2f2cfa(++_0x15656b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x359955,_0x5089e8){_0x359955=_0x359955-0x0;var _0xe5175f=_0x5f2f[_0x359955];return _0xe5175f;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x4f4a64,_0x3b0a20){var _0x1e8351=function(_0x3ad39a){while(--_0x3ad39a){_0x4f4a64['push'](_0x4f4a64['shift']());}};_0x1e8351(++_0x3b0a20);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50189f,_0x5cbbcb){_0x50189f=_0x50189f-0x0;var _0x14410c=_0x5f2f[_0x50189f];return _0x14410c;};'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 1447ee9..2c3540d 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 _0x8286=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x4d3c40,_0x40bf62){var _0x4fd737=function(_0x4f7c6e){while(--_0x4f7c6e){_0x4d3c40['push'](_0x4d3c40['shift']());}};_0x4fd737(++_0x40bf62);}(_0x8286,0x66));var _0x6828=function(_0x34b8bc,_0x38f4f6){_0x34b8bc=_0x34b8bc-0x0;var _0x48a472=_0x8286[_0x34b8bc];return _0x48a472;};'use strict';function ZohoAccount(_0x57b687){this['id']=_0x57b687['id']||0x0;this[_0x6828('0x0')]=_0x57b687[_0x6828('0x0')]||'';this[_0x6828('0x1')]=_0x57b687[_0x6828('0x1')]||'';this[_0x6828('0x2')]=_0x57b687[_0x6828('0x2')]||'';this[_0x6828('0x3')]=_0x57b687[_0x6828('0x3')]||'';this[_0x6828('0x4')]=_0x57b687[_0x6828('0x4')]||'';this['clientSecret']=_0x57b687[_0x6828('0x5')]||'';this[_0x6828('0x6')]=_0x57b687['serverUrl']||'';this[_0x6828('0x7')]=_0x57b687[_0x6828('0x7')]||'';this[_0x6828('0x8')]=_0x57b687['refreshToken']||'';this[_0x6828('0x9')]=_0x57b687[_0x6828('0x9')]||{};}module[_0x6828('0xa')]=ZohoAccount; \ No newline at end of file +var _0xb9e7=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x41b6d7,_0x5c815d){var _0x468dcb=function(_0x4054f1){while(--_0x4054f1){_0x41b6d7['push'](_0x41b6d7['shift']());}};_0x468dcb(++_0x5c815d);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0xb9e7[_0x52a857];return _0x4e2aae;};'use strict';function ZohoAccount(_0x4d23ea){this['id']=_0x4d23ea['id']||0x0;this[_0x7b9e('0x0')]=_0x4d23ea[_0x7b9e('0x0')]||'';this[_0x7b9e('0x1')]=_0x4d23ea[_0x7b9e('0x1')]||'';this[_0x7b9e('0x2')]=_0x4d23ea[_0x7b9e('0x2')]||'';this['zone']=_0x4d23ea[_0x7b9e('0x3')]||'';this[_0x7b9e('0x4')]=_0x4d23ea['clientId']||'';this[_0x7b9e('0x5')]=_0x4d23ea['clientSecret']||'';this[_0x7b9e('0x6')]=_0x4d23ea[_0x7b9e('0x6')]||'';this[_0x7b9e('0x7')]=_0x4d23ea[_0x7b9e('0x7')]||'';this[_0x7b9e('0x8')]=_0x4d23ea['refreshToken']||'';this[_0x7b9e('0x9')]=_0x4d23ea[_0x7b9e('0x9')]||{};}module[_0x7b9e('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ee2530b..925ecb5 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 _0xb590=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry'];(function(_0x4c2fe8,_0x211425){var _0x16289d=function(_0xea8cab){while(--_0xea8cab){_0x4c2fe8['push'](_0x4c2fe8['shift']());}};_0x16289d(++_0x211425);}(_0xb590,0x1bc));var _0x0b59=function(_0xadd69d,_0x766fe3){_0xadd69d=_0xadd69d-0x0;var _0x10d2ab=_0xb590[_0xadd69d];return _0x10d2ab;};'use strict';var util=require(_0x0b59('0x0'));var _=require(_0x0b59('0x1'));var moment=require('moment');function checkNameSurname(_0xf08b14,_0x5c6dfe,_0x4bcc79){var _0x388d47='';if(!_['isNil'](_0x5c6dfe)&&_0x0b59('0x2')===typeof _0x5c6dfe){_0x388d47+=_0x5c6dfe;}if(!_[_0x0b59('0x3')](_0x4bcc79)&&'string'===typeof _0x4bcc79){_0x388d47+='\x20'+_0x4bcc79;}if(_0x388d47!==''){return _0x388d47;}return _0xf08b14;}function Action(_0x35c388,_0x48cc98,_0x58ae75,_0x452b22,_0xacf716){this[_0x0b59('0x4')]=_0x58ae75||undefined;this[_0x0b59('0x5')]=_0x35c388['id'];this[_0x0b59('0x6')]=_0x48cc98[_0x0b59('0x7')];this[_0x0b59('0x8')]=_0x48cc98[_0x0b59('0x8')];this[_0x0b59('0x9')]=_0x0b59('0x6');this[_0x0b59('0xa')]=![];this[_0x0b59('0xb')]=_['isNil'](_0x35c388[_0x0b59('0xc')])?undefined:_0x35c388['Agent'][_0x0b59('0x7')];this[_0x0b59('0xd')]=this[_0x0b59('0xb')]?util[_0x0b59('0xe')](_0x0b59('0xf'),this[_0x0b59('0xb')]):_0x452b22||undefined;this[_0x0b59('0x10')]=checkNameSurname(_0x35c388[_0x0b59('0x11')]['phone'],_0x35c388[_0x0b59('0x11')][_0x0b59('0x12')],_0x35c388[_0x0b59('0x11')][_0x0b59('0x13')]);this['active']=_0x35c388[_0x0b59('0x14')]||![];this[_0x0b59('0x15')]=_0x35c388[_0x0b59('0x16')];this[_0x0b59('0x17')]=_0x35c388['scheduledat'];this[_0x0b59('0x18')]=_0x35c388[_0x0b59('0x18')]||0x0;this[_0x0b59('0x19')]=_0x35c388[_0x0b59('0x19')]||0x0;this[_0x0b59('0x1a')]=_0x35c388[_0x0b59('0x1a')]||0x0;this[_0x0b59('0x1b')]=(_0x35c388[_0x0b59('0x18')]||0x0)+(_0x35c388['countcongestionretry']||0x0)+(_0x35c388[_0x0b59('0x1a')]||0x0)+(_0x35c388[_0x0b59('0x1c')]||0x0)+(_0x35c388[_0x0b59('0x1d')]||0x0)+(_0x35c388[_0x0b59('0x1e')]||0x0)+(_0x35c388[_0x0b59('0x1f')]||0x0)+(_0x35c388['countagentrejectretry']||0x0);this[_0x0b59('0x1c')]=_0x35c388[_0x0b59('0x1c')]||0x0;this[_0x0b59('0x1d')]=_0x35c388[_0x0b59('0x1d')]||0x0;this[_0x0b59('0x1e')]=_0x35c388['countabandonedretry']||0x0;this[_0x0b59('0x1f')]=_0x35c388[_0x0b59('0x1f')]||0x0;this['countagentrejectretry']=_0x35c388['countagentrejectretry']||0x0;this[_0x0b59('0x20')]=_0x35c388[_0x0b59('0x20')];this[_0x0b59('0x21')]=_0x35c388[_0x0b59('0x21')];this[_0x0b59('0x22')]=_0x35c388[_0x0b59('0x22')];this[_0x0b59('0x23')]=_0x35c388['recallme'];this[_0x0b59('0x24')]=_0x35c388[_0x0b59('0x24')];this['ListId']=_0x35c388[_0x0b59('0x25')];this[_0x0b59('0x26')]=_[_0x0b59('0x3')](_0x35c388['Agent'])?_0x35c388[_0x0b59('0x26')]:_0x35c388['Agent']['id'];this[_0x0b59('0x27')]=_0x35c388[_0x0b59('0x27')];this[_0x0b59('0x28')]='';this[_0x0b59('0x29')]='';}Action[_0x0b59('0x2a')][_0x0b59('0x2b')]=function(){return util['format'](_0x0b59('0x2c'),this[_0x0b59('0x10')],this[_0x0b59('0x2d')]);};module[_0x0b59('0x2e')]=Action; \ No newline at end of file +var _0x9e0e=['isNil','string','uniqueid','idContact','queue','name','type','Agent','channelAgent','format','SIP/%s','membername','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','exports','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e0e,0x166));var _0xe9e0=function(_0x175b18,_0x4cc1f3){_0x175b18=_0x175b18-0x0;var _0x1e0702=_0x9e0e[_0x175b18];return _0x1e0702;};'use strict';var util=require(_0xe9e0('0x0'));var _=require('lodash');var moment=require(_0xe9e0('0x1'));function checkNameSurname(_0x1365c3,_0x117c4f,_0x41e1e2){var _0x10a76d='';if(!_[_0xe9e0('0x2')](_0x117c4f)&&_0xe9e0('0x3')===typeof _0x117c4f){_0x10a76d+=_0x117c4f;}if(!_[_0xe9e0('0x2')](_0x41e1e2)&&_0xe9e0('0x3')===typeof _0x41e1e2){_0x10a76d+='\x20'+_0x41e1e2;}if(_0x10a76d!==''){return _0x10a76d;}return _0x1365c3;}function Action(_0x4b50ee,_0x59f795,_0x3e6180,_0x3b253a,_0xdadefd){this[_0xe9e0('0x4')]=_0x3e6180||undefined;this[_0xe9e0('0x5')]=_0x4b50ee['id'];this[_0xe9e0('0x6')]=_0x59f795[_0xe9e0('0x7')];this[_0xe9e0('0x8')]=_0x59f795[_0xe9e0('0x8')];this['campaigntype']=_0xe9e0('0x6');this['dialAnswer']=![];this['membername']=_['isNil'](_0x4b50ee[_0xe9e0('0x9')])?undefined:_0x4b50ee[_0xe9e0('0x9')]['name'];this[_0xe9e0('0xa')]=this['membername']?util[_0xe9e0('0xb')](_0xe9e0('0xc'),this[_0xe9e0('0xd')]):_0x3b253a||undefined;this[_0xe9e0('0xe')]=checkNameSurname(_0x4b50ee[_0xe9e0('0xf')][_0xe9e0('0x10')],_0x4b50ee[_0xe9e0('0xf')]['firstName'],_0x4b50ee[_0xe9e0('0xf')]['lastName']);this[_0xe9e0('0x11')]=_0x4b50ee['active']||![];this[_0xe9e0('0x12')]=_0x4b50ee['phone'];this['scheduledat']=_0x4b50ee[_0xe9e0('0x13')];this['countbusyretry']=_0x4b50ee[_0xe9e0('0x14')]||0x0;this['countcongestionretry']=_0x4b50ee[_0xe9e0('0x15')]||0x0;this[_0xe9e0('0x16')]=_0x4b50ee[_0xe9e0('0x16')]||0x0;this['countglobal']=(_0x4b50ee[_0xe9e0('0x14')]||0x0)+(_0x4b50ee[_0xe9e0('0x15')]||0x0)+(_0x4b50ee[_0xe9e0('0x16')]||0x0)+(_0x4b50ee[_0xe9e0('0x17')]||0x0)+(_0x4b50ee[_0xe9e0('0x18')]||0x0)+(_0x4b50ee['countabandonedretry']||0x0)+(_0x4b50ee[_0xe9e0('0x19')]||0x0)+(_0x4b50ee['countagentrejectretry']||0x0);this[_0xe9e0('0x17')]=_0x4b50ee['countnosuchnumberretry']||0x0;this[_0xe9e0('0x18')]=_0x4b50ee['countdropretry']||0x0;this[_0xe9e0('0x1a')]=_0x4b50ee[_0xe9e0('0x1a')]||0x0;this[_0xe9e0('0x19')]=_0x4b50ee[_0xe9e0('0x19')]||0x0;this[_0xe9e0('0x1b')]=_0x4b50ee[_0xe9e0('0x1b')]||0x0;this[_0xe9e0('0x1c')]=_0x4b50ee['callback'];this[_0xe9e0('0x1d')]=_0x4b50ee[_0xe9e0('0x1d')];this[_0xe9e0('0x1e')]=_0x4b50ee['callbackat'];this[_0xe9e0('0x1f')]=_0x4b50ee[_0xe9e0('0x1f')];this[_0xe9e0('0x20')]=_0x4b50ee['ContactId'];this['ListId']=_0x4b50ee[_0xe9e0('0x21')];this[_0xe9e0('0x22')]=_[_0xe9e0('0x2')](_0x4b50ee['Agent'])?_0x4b50ee[_0xe9e0('0x22')]:_0x4b50ee[_0xe9e0('0x9')]['id'];this[_0xe9e0('0x23')]=_0x4b50ee[_0xe9e0('0x23')];this['originatecalleridnum']='';this[_0xe9e0('0x24')]='';}Action[_0xe9e0('0x25')][_0xe9e0('0x26')]=function(){return util[_0xe9e0('0xb')]('\x22%s\x22\x20<%s>',this[_0xe9e0('0xe')],this['number']);};module[_0xe9e0('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index a8b63fc..90f066a 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 _0xb513=['predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','message','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','booked','recallMe','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','UserId','ListId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','info','size','clearZombieChannel','then','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','starttime','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','setMessage','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','createCustomerHistory','verifyAdditionalPhones','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','countbusyretry','Busy','callAdditionalPhoneAfterMin','custom:agentbusy','additional','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','activeContact','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','noanswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','[callProgressDetectingAgent][logNoAnswer]','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','originated','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','isNil','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','disableContact','validateContact','isValid','checkInBlack','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','variablesAction','OriginateError','syncNewExten','channel','actionid','lookAgent','logLookAgent','isFailure','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','unlockContact','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','bluebird','moment','md5','ioredis','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','answered','available','sumBillable','sumHoldTime','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime'];(function(_0x46d38e,_0x4b9456){var _0x2f83ad=function(_0x4f4b59){while(--_0x4f4b59){_0x46d38e['push'](_0x46d38e['shift']());}};_0x2f83ad(++_0x4b9456);}(_0xb513,0x113));var _0x3b51=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xb513[_0x4327fe];return _0x138651;};'use strict';var util=require(_0x3b51('0x0'));var _=require('lodash');var BPromise=require(_0x3b51('0x1'));var uuid=require('uuid');var moment=require(_0x3b51('0x2'));var md5=require(_0x3b51('0x3'));var Redis=require(_0x3b51('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3b51('0x5'));var loggerAction=require('../../../config/logger')(_0x3b51('0x6'));var ami=require(_0x3b51('0x7'));var rpcDb=require(_0x3b51('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x3b51('0x9'));var ut=require(_0x3b51('0xa'));config[_0x3b51('0xb')]=_['defaults'](config['redis'],{'host':_0x3b51('0xc'),'port':0x18eb});var io=require(_0x3b51('0xd'))(new Redis(config[_0x3b51('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x3b51('0xe')]=function(_0x2b2e43){this['tail']=this[_0x3b51('0xf')]?this['tail'][_0x3b51('0x10')](_0x2b2e43):_0x2b2e43();};function Preview(_0x25c5d2){this[_0x3b51('0x11')]=new Sequence();this[_0x3b51('0x12')]=_0x25c5d2[_0x3b51('0x13')];this[_0x3b51('0x14')]=_0x25c5d2[_0x3b51('0x14')];this[_0x3b51('0x15')]={};this[_0x3b51('0x16')]=_0x25c5d2[_0x3b51('0x16')];this[_0x3b51('0x17')]=0x0;ami['on'](_0x3b51('0x18'),this[_0x3b51('0x19')][_0x3b51('0x1a')](this));ami['on']('hangup',this[_0x3b51('0x1b')][_0x3b51('0x1a')](this));ami['on'](_0x3b51('0x1c'),this[_0x3b51('0x1d')]['bind'](this));ami['on']('dialend',this[_0x3b51('0x1e')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x3b51('0x1a')](this));ami['on'](_0x3b51('0x1f'),this[_0x3b51('0x20')][_0x3b51('0x1a')](this));ami['on'](_0x3b51('0x21'),this['syncAttendedTransfer'][_0x3b51('0x1a')](this));ami['on']('blindtransfer',this[_0x3b51('0x22')][_0x3b51('0x1a')](this));this[_0x3b51('0x23')](this[_0x3b51('0x12')]);}function emit(_0x4b0575,_0x1233bc,_0x4fba74){io['to'](_0x4b0575)['emit'](_0x1233bc,_0x4fba74);}function emitCampaignPreview(_0x5c34ee){if(_0x5c34ee[_0x3b51('0x24')]===_0x3b51('0x25')){var _0xcf74c5={'id':_0x5c34ee['id'],'name':_0x5c34ee[_0x3b51('0x26')],'strategy':_0x5c34ee['strategy'],'answered':_0x5c34ee[_0x3b51('0x27')],'available':_0x5c34ee[_0x3b51('0x28')],'loggedIn':_0x5c34ee['loggedIn'],'pTalking':_0x5c34ee['pTalking'],'sumBillable':_0x5c34ee[_0x3b51('0x29')],'sumDuration':_0x5c34ee['sumDuration'],'sumHoldTime':_0x5c34ee[_0x3b51('0x2a')]||0x0,'talking':_0x5c34ee['talking'],'total':_0x5c34ee['total'],'type':_0x5c34ee['type'],'unmanaged':_0x5c34ee[_0x3b51('0x2b')],'abandoned':_0x5c34ee[_0x3b51('0x2c')],'waiting':_0x5c34ee[_0x3b51('0x2d')],'loggedInDb':_0x5c34ee['loggedInDb'],'dialActive':_0x5c34ee[_0x3b51('0x2e')],'dialMethod':_0x5c34ee[_0x3b51('0x2f')],'dialOriginateCallerIdName':_0x5c34ee[_0x3b51('0x30')],'dialOriginateCallerIdNumber':_0x5c34ee['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5c34ee[_0x3b51('0x31')],'dialPrefix':_0x5c34ee['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5c34ee[_0x3b51('0x32')],'outboundAnswerCallsDay':_0x5c34ee[_0x3b51('0x33')],'outboundBlacklistCallsDay':_0x5c34ee[_0x3b51('0x34')],'outboundBusyCallsDay':_0x5c34ee[_0x3b51('0x35')],'outboundCongestionCallsDay':_0x5c34ee[_0x3b51('0x36')],'outboundDropCallsDayACS':_0x5c34ee[_0x3b51('0x37')],'outboundDropCallsDayCallersExit':_0x5c34ee[_0x3b51('0x38')],'outboundDropCallsDayTimeout':_0x5c34ee[_0x3b51('0x39')],'outboundNoAnswerCallsDay':_0x5c34ee['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5c34ee['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5c34ee[_0x3b51('0x3a')],'outboundReCallsDay':_0x5c34ee[_0x3b51('0x3b')],'outboundRejectCallsDay':_0x5c34ee[_0x3b51('0x3c')],'outboundUnknownCallsDay':_0x5c34ee[_0x3b51('0x3d')],'outboundAbandonedCallsDay':_0x5c34ee[_0x3b51('0x3e')],'predictiveIntervalAnsweredCalls':_0x5c34ee[_0x3b51('0x3f')],'predictiveIntervalAvgHoldtime':_0x5c34ee[_0x3b51('0x40')],'predictiveIntervalAvgTalktime':_0x5c34ee[_0x3b51('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x5c34ee[_0x3b51('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x5c34ee[_0x3b51('0x43')],'predictiveIntervalErlangCalls':_0x5c34ee[_0x3b51('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x5c34ee['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5c34ee[_0x3b51('0x45')],'predictiveIntervalMultiplicativeFactor':_0x5c34ee['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5c34ee[_0x3b51('0x46')],'predictiveIntervalAvailable':_0x5c34ee[_0x3b51('0x47')],'predictiveIntervalTotalCalls':_0x5c34ee[_0x3b51('0x48')],'message':_0x5c34ee['message'],'originated':_0x5c34ee['originated'],'erlangCalls':_0x5c34ee['erlangCalls'],'erlangCallToSecond':_0x5c34ee[_0x3b51('0x49')],'erlangAbandonmentRate':_0x5c34ee[_0x3b51('0x4a')],'erlangBusyFactor':_0x5c34ee[_0x3b51('0x4b')],'startPredictive':_0x5c34ee['startPredictive'],'startProgressive':_0x5c34ee[_0x3b51('0x4c')]};if(_0x5c34ee[_0x3b51('0x4d')]){_0xcf74c5[_0x3b51('0x4d')]={'id':_0x5c34ee['Trunk']['id'],'name':_0x5c34ee['Trunk'][_0x3b51('0x26')],'active':_0x5c34ee[_0x3b51('0x4d')]['active'],'callerid':_0x5c34ee[_0x3b51('0x4d')][_0x3b51('0x4e')]};}if(_0x5c34ee[_0x3b51('0x4f')]){_0xcf74c5['Interval']={'id':_0x5c34ee[_0x3b51('0x4f')]['id'],'name':_0x5c34ee['Interval'][_0x3b51('0x26')]};}var _0x4b9e0c=md5(JSON[_0x3b51('0x50')](_0xcf74c5));if(_0x5c34ee['md5']!==_0x4b9e0c){_0x5c34ee[_0x3b51('0x3')]=_0x4b9e0c;emit(util[_0x3b51('0x51')](_0x3b51('0x52'),_0xcf74c5[_0x3b51('0x26')]),_0x3b51('0x53'),_0xcf74c5);}}}function emitVoiceQueueChannelRemove(_0x56ad30){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3b51('0x50')](_0x56ad30));emit(util[_0x3b51('0x51')](_0x3b51('0x52'),_0x56ad30[_0x3b51('0x26')]),_0x3b51('0x54'),_0x56ad30);io[_0x3b51('0x55')](_0x3b51('0x56'),_0x56ad30);}function notSendMessagesQueue(_0x2b6c1f){if(_0x2b6c1f[_0x3b51('0x57')]){if(_0x2b6c1f['originated']===0x0&&_0x2b6c1f[_0x3b51('0x58')]===0x0){_0x2b6c1f[_0x3b51('0x57')]=![];_0x2b6c1f[_0x3b51('0x28')]=0x0;_0x2b6c1f[_0x3b51('0x59')]=0x0;_0x2b6c1f[_0x3b51('0x5a')]='NOT_ACTIVE';ut[_0x3b51('0x5b')](_0x3b51('0x5c'),_0x2b6c1f[_0x3b51('0x26')]+_0x3b51('0x5d'));}else{_0x2b6c1f[_0x3b51('0x5a')]=_0x3b51('0x5e');ut[_0x3b51('0x5b')](_0x3b51('0x5c'),_0x2b6c1f['name']+_0x3b51('0x5f'));}emitCampaignPreview(_0x2b6c1f);}}Preview[_0x3b51('0x60')][_0x3b51('0x23')]=function(){var _0x495ecc=this;setInterval(function(){_0x495ecc[_0x3b51('0x61')]();},0x7cf);};Preview[_0x3b51('0x60')][_0x3b51('0x61')]=function(){var _0x214d92=this[_0x3b51('0x12')];this[_0x3b51('0x17')]+=0x1;for(var _0x5bcfdc in _0x214d92){if(_0x214d92[_0x3b51('0x62')](_0x5bcfdc)&&(_0x214d92[_0x5bcfdc]['dialMethod']==='preview'||_0x214d92[_0x5bcfdc][_0x3b51('0x2f')]===_0x3b51('0x63'))&&_0x214d92[_0x5bcfdc][_0x3b51('0x24')]===_0x3b51('0x25')){if(this['clockClearZombieChannels']>0x7){this[_0x3b51('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x214d92[_0x3b51('0x62')](_0x5bcfdc)&&_0x214d92[_0x5bcfdc][_0x3b51('0x2f')]===_0x3b51('0x5')&&_0x214d92[_0x5bcfdc][_0x3b51('0x24')]===_0x3b51('0x25')){if(_0x214d92[_0x5bcfdc][_0x3b51('0x2e')]){this['setMessage'](_0x214d92[_0x5bcfdc]);this[_0x3b51('0x64')](_0x214d92[_0x5bcfdc]);}else{notSendMessagesQueue(_0x214d92[_0x5bcfdc]);}}}};Preview[_0x3b51('0x60')]['clearZombieChannel']=function(_0x4acc6a){var _0x2cac40=this;this[_0x3b51('0x11')][_0x3b51('0xe')](function(){if(!_['isNil'](_0x2cac40['actions'][_0x4acc6a])){loggerAction['info'](_0x3b51('0x65'),_0x4acc6a,'Queue',_0x2cac40[_0x3b51('0x15')][_0x4acc6a]['queue'],'originated:\x20',JSON['stringify'](_0x2cac40[_0x3b51('0x12')][_0x2cac40['actions'][_0x4acc6a][_0x3b51('0x66')]]['originated']),_0x3b51('0x67'),JSON[_0x3b51('0x50')](_0x2cac40[_0x3b51('0x12')][_0x2cac40[_0x3b51('0x15')][_0x4acc6a][_0x3b51('0x66')]][_0x3b51('0x58')]),JSON[_0x3b51('0x50')](_0x2cac40[_0x3b51('0x15')][_0x4acc6a][_0x3b51('0x68')]),JSON['stringify'](_[_0x3b51('0x69')](_0x2cac40['actions'][_0x4acc6a],['contactId',_0x3b51('0x6a'),'VoiceQueueId',_0x3b51('0x6b')])));return ami[_0x3b51('0x6c')]({'action':_0x3b51('0x6d'),'channel':_0x2cac40[_0x3b51('0x15')][_0x4acc6a]['channel']})[_0x3b51('0x6e')](function(_0x520eb6){if(_0x520eb6[_0x3b51('0x5a')]===_0x3b51('0x6f')){setTimeout(function(){if(_0x2cac40['actions'][_0x4acc6a]){ut[_0x3b51('0x70')](_0x2cac40[_0x3b51('0x12')][_0x2cac40[_0x3b51('0x15')][_0x4acc6a]['queue']],_0x3b51('0x71'));if(_0x2cac40[_0x3b51('0x15')][_0x4acc6a]['dialAnswer']===!![]){ut[_0x3b51('0x72')](_0x2cac40[_0x3b51('0x12')][_0x2cac40[_0x3b51('0x15')][_0x4acc6a][_0x3b51('0x66')]],_0x3b51('0x71'));ut['loggerError'](_0x3b51('0x73')+_0x4acc6a,_0x2cac40['actions'][_0x4acc6a][_0x3b51('0x66')]);}ut[_0x3b51('0x74')](_0x3b51('0x75')+_0x4acc6a,_0x2cac40[_0x3b51('0x15')][_0x4acc6a][_0x3b51('0x66')]);delete _0x2cac40[_0x3b51('0x15')][_0x4acc6a];}},0x2328);}});}});};Preview[_0x3b51('0x60')]['clearZombieChannels']=function(){var _0x142a5e=this;loggerAction[_0x3b51('0x76')]('[action]',_[_0x3b51('0x77')](this[_0x3b51('0x15')]));for(var _0x5a5509 in this[_0x3b51('0x15')]){if(_0x142a5e[_0x3b51('0x15')][_0x3b51('0x62')](_0x5a5509)){_0x142a5e[_0x3b51('0x78')](_0x5a5509);}}};Preview[_0x3b51('0x60')][_0x3b51('0x64')]=function(_0x108f19){var _0x55b428=this;rpcDb['getContactRecallMe'](_0x108f19['id'],ut['agentReadyId'](this[_0x3b51('0x16')]))[_0x3b51('0x79')](function(_0x2ba07a){if(!_['isNil'](_0x2ba07a)){for(var _0x3ecaa8=0x0;_0x3ecaa8<_0x2ba07a[_0x3b51('0x7a')];_0x3ecaa8+=0x1){if(ut[_0x3b51('0x7b')](_0x2ba07a[_0x3ecaa8][_0x3b51('0x7c')])<_0x108f19[_0x3b51('0x7d')]*0x3c){if(_0x2ba07a[_0x3ecaa8]['Agent']&&!_0x2ba07a[_0x3ecaa8]['Agent'][_0x3b51('0x7e')]){_0x55b428[_0x3b51('0x7f')](_0x2ba07a[_0x3ecaa8]['id'])[_0x3b51('0x79')](ut[_0x3b51('0x80')](_0x3b51('0x81')))[_0x3b51('0x6e')](ut['logger2'](_0x3b51('0x81')));}else{rpcDb['disableContact'](_0x2ba07a[_0x3ecaa8]['id']);}}else{var _0x3a8849=new Action(_0x2ba07a[_0x3ecaa8],_0x108f19);_0x3a8849[_0x3b51('0x82')]=moment()[_0x3b51('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x108f19[_0x3b51('0x3b')]+=0x1;ut['logCustomer'](_0x3a8849,0x17,'RecallInQueue');if(_0x108f19[_0x3b51('0x83')]){rpcDb[_0x3b51('0x84')](ut[_0x3b51('0x85')](_0x2ba07a[_0x3ecaa8]));rpcDb['createCustomerHistory'](_0x3a8849,_0x3b51('0x86'));}else{ut[_0x3b51('0x87')](_0x3a8849,0x16,_0x3b51('0x88'));rpcDb['createCustomerHistory'](_0x3a8849,'[HistoryRecallClose]');rpcDb[_0x3b51('0x89')](_0x3a8849,_0x3b51('0x8a'));}}}}})[_0x3b51('0x6e')](ut[_0x3b51('0x80')]('[getContactRecallMe]'));};Preview[_0x3b51('0x60')][_0x3b51('0x8b')]=function(_0x5e7c98){_0x5e7c98[_0x3b51('0x57')]=!![];if(ut[_0x3b51('0x8c')](_0x5e7c98[_0x3b51('0x8d')])){_0x5e7c98[_0x3b51('0x5a')]=_0x3b51('0x8e');}else if(!ut[_0x3b51('0x8f')](_0x5e7c98[_0x3b51('0x2e')])){_0x5e7c98[_0x3b51('0x5a')]=_0x3b51('0x90');}else if(!this[_0x3b51('0x91')](_0x5e7c98[_0x3b51('0x4d')])){if(!this[_0x3b51('0x91')](_0x5e7c98[_0x3b51('0x92')])){_0x5e7c98[_0x3b51('0x5a')]=_0x3b51('0x93');}else{_0x5e7c98[_0x3b51('0x5a')]='ACTIVE';}}else{_0x5e7c98['message']=_0x3b51('0x94');}emitCampaignPreview(_0x5e7c98);};Preview[_0x3b51('0x60')][_0x3b51('0x95')]=function(_0x2734c4,_0x3aa374,_0x4fde2d){var _0x31c893=this;var _0x12236c=this[_0x3b51('0x15')][_0x3aa374];var _0x1b0ab3=this[_0x3b51('0x12')][_0x12236c['queue']];var _0x58897b;var _0x5338dc=![];var _0x53edb6=0x2;var _0x597d92=0x3;if(_0x1b0ab3){switch(_0x4fde2d){case'1':_0x1b0ab3['outboundNoSuchCallsDay']+=0x1;_0x12236c['countnosuchnumberretry']+=0x1;_0x12236c['countglobal']=ut['totalGlobal'](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0x0,_0x3b51('0x96'));ami[_0x3b51('0x55')](_0x3b51('0x97'),ut[_0x3b51('0x98')](_0x12236c,_0x3b51('0x99')));rpcDb[_0x3b51('0x9a')](_0x12236c,'[callProgressDetectingCustomer][logNoSuch]');_0x31c893[_0x3b51('0x9b')](_0x12236c,'0',_0x1b0ab3)['then'](function(_0x42ce47){_0x5338dc=_0x42ce47['additional']==0x1;_0x53edb6=_0x1b0ab3['dialNoSuchNumberRetryFrequency'];_0x597d92=_0x1b0ab3['callAdditionalPhoneAfterMin'];if(!_0x5338dc){if(ut[_0x3b51('0x9c')](_0x12236c)>=_0x1b0ab3[_0x3b51('0x9d')]){_0x58897b=ut[_0x3b51('0x9e')](_0x12236c,0xf,_0x3b51('0x9f'));rpcDb['createCustomerFinal'](_0x58897b,_0x3b51('0xa0'));}else{if(_0x12236c[_0x3b51('0xa1')]>=_0x1b0ab3['dialNoSuchNumberMaxRetry']){rpcDb[_0x3b51('0x89')](_0x12236c,_0x3b51('0xa0'));}else{rpcDb[_0x3b51('0xa2')](ut['scheduledAt'](_0x12236c,_0x3b51('0xa1'),_0x1b0ab3[_0x3b51('0xa3')]),_0x12236c[_0x3b51('0xa4')],_0x12236c['activeContact']);}}delete this[_0x3b51('0x15')][_0x2734c4['linkedid']];}else{_0x12236c[_0x3b51('0xa1')]++;logger['info'](_0x3b51('0xa5'),_0x12236c[_0x3b51('0xa1')]);logger[_0x3b51('0x76')]('id',_0x12236c[_0x3b51('0xa6')]);_0x31c893['incrementPreviewCounters']({'id':_0x12236c[_0x3b51('0xa6')],'field':{'countnosuchnumberretry':_0x12236c[_0x3b51('0xa1')]}})[_0x3b51('0x79')](function(){_0x31c893[_0x3b51('0xa7')](_0x12236c,_0x53edb6,_0x597d92)[_0x3b51('0x79')](function(){});});}});break;case _0x3b51('0xa8'):var _0x3ec117=moment()[_0x3b51('0x51')](_0x3b51('0xa9'));_0x12236c[_0x3b51('0xaa')]=_0x3ec117;_0x12236c['answertime']=_0x3ec117;_0x12236c[_0x3b51('0x68')]=!![];_0x1b0ab3[_0x3b51('0x58')]+=0x1;logger[_0x3b51('0x76')](_0x3b51('0xab'),_0x12236c[_0x3b51('0xac')],_0x3b51('0xad'),_0x1b0ab3[_0x3b51('0x26')],_0x3b51('0x67'),_0x1b0ab3['pTalking']);ami[_0x3b51('0x55')](_0x3b51('0xae'),ut[_0x3b51('0x98')](_0x12236c,_0x3b51('0xaf'),this[_0x3b51('0x12')][_0x12236c[_0x3b51('0x66')]]));if(_0x1b0ab3[_0x3b51('0xb0')]){ami[_0x3b51('0x55')](_0x3b51('0xb1'),ut[_0x3b51('0xb2')](_0x12236c));}break;case'16':ami[_0x3b51('0x55')]('custom:agentcomplete',ut[_0x3b51('0x98')](_0x12236c,'complete',this[_0x3b51('0x12')][_0x12236c[_0x3b51('0x66')]]));emitVoiceQueueChannelRemove(ut[_0x3b51('0x98')](_0x12236c,'complete'));_0x1b0ab3[_0x3b51('0x33')]+=0x1;_0x1b0ab3['total']+=0x1;_0x1b0ab3[_0x3b51('0x27')]+=0x1;ut[_0x3b51('0x72')](_0x1b0ab3,_0x3b51('0xb3'));_0x12236c[_0x3b51('0xb4')]=ut[_0x3b51('0x9c')](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0x4,_0x3b51('0xb5'));rpcDb[_0x3b51('0x9a')](_0x12236c,_0x3b51('0xb6'));rpcDb[_0x3b51('0x89')](_0x12236c,_0x3b51('0xb7'));rpcDb[_0x3b51('0xb8')](_0x12236c);_0x1b0ab3[_0x3b51('0xb9')]+=_0x12236c[_0x3b51('0xba')];_0x1b0ab3[_0x3b51('0x29')]+=_0x12236c[_0x3b51('0xba')];logger[_0x3b51('0x76')](_0x3b51('0xbb'),_0x12236c['uniqueid'],_0x3b51('0xad'),_0x1b0ab3[_0x3b51('0x26')],_0x3b51('0x67'),_0x1b0ab3[_0x3b51('0x58')]);delete this[_0x3b51('0x15')][_0x2734c4[_0x3b51('0xbc')]];break;case'BUSY':_0x1b0ab3['outboundBusyCallsDay']+=0x1;_0x12236c[_0x3b51('0xbd')]+=0x1;_0x12236c[_0x3b51('0xb4')]=ut['totalGlobal'](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0x5,_0x3b51('0xbe'));_0x53edb6=_0x1b0ab3['dialBusyRetryFrequency'];_0x597d92=_0x1b0ab3[_0x3b51('0xbf')];ami[_0x3b51('0x55')](_0x3b51('0xc0'),ut[_0x3b51('0x98')](_0x12236c,'busy'));rpcDb[_0x3b51('0x9a')](_0x12236c,'[callProgressDetectingCustomer][logBusy]');_0x31c893[_0x3b51('0x9b')](_0x12236c,'5',_0x1b0ab3)[_0x3b51('0x79')](function(_0x4c19c8){_0x5338dc=_0x4c19c8[_0x3b51('0xc1')]==0x1;if(!_0x5338dc){if(ut[_0x3b51('0x9c')](_0x12236c)>=_0x1b0ab3[_0x3b51('0x9d')]){_0x58897b=ut[_0x3b51('0x9e')](_0x12236c,0xf,_0x3b51('0x9f'));rpcDb[_0x3b51('0x89')](_0x58897b,_0x3b51('0xc2'));}else{if(_0x12236c['countbusyretry']>=_0x1b0ab3[_0x3b51('0xc3')]){rpcDb[_0x3b51('0x89')](_0x12236c,_0x3b51('0xc4'));}else{rpcDb['rescheduleContact'](ut[_0x3b51('0xc5')](_0x12236c,_0x3b51('0xbd'),_0x1b0ab3['dialBusyRetryFrequency']),_0x12236c[_0x3b51('0xa4')],_0x12236c[_0x3b51('0xc6')]);}}}else{_0x12236c[_0x3b51('0xbd')]++;_0x31c893[_0x3b51('0xc7')]({'id':_0x12236c[_0x3b51('0xa6')],'field':{'countbusyretry':_0x12236c[_0x3b51('0xbd')]}})[_0x3b51('0x79')](function(){_0x31c893[_0x3b51('0xa7')](_0x12236c,_0x53edb6,_0x597d92)[_0x3b51('0x79')](function(){});});}});break;case _0x3b51('0xc8'):_0x1b0ab3[_0x3b51('0xc9')]+=0x1;_0x12236c['countnoanswerretry']+=0x1;_0x12236c[_0x3b51('0xb4')]=ut[_0x3b51('0x9c')](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0x3,'NoAnswer');_0x53edb6=_0x1b0ab3[_0x3b51('0xca')];_0x597d92=_0x1b0ab3[_0x3b51('0xbf')];ami[_0x3b51('0x55')]('custom:agentnoanswer',ut[_0x3b51('0x98')](_0x12236c,_0x3b51('0xcb')));rpcDb[_0x3b51('0x9a')](_0x12236c,_0x3b51('0xcc'));_0x31c893['verifyAdditionalPhones'](_0x12236c,'3',_0x1b0ab3)[_0x3b51('0x79')](function(_0x120a80){_0x5338dc=_0x120a80['additional']==0x1;if(!_0x5338dc){if(ut[_0x3b51('0x9c')](_0x12236c)>=_0x1b0ab3[_0x3b51('0x9d')]){_0x58897b=ut[_0x3b51('0x9e')](_0x12236c,0xf,_0x3b51('0x9f'));rpcDb[_0x3b51('0x89')](_0x58897b,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x12236c[_0x3b51('0xcd')]>=_0x1b0ab3[_0x3b51('0xce')]){rpcDb[_0x3b51('0x89')](_0x12236c,_0x3b51('0xcc'));}else{rpcDb[_0x3b51('0xa2')](ut['scheduledAt'](_0x12236c,_0x3b51('0xcd'),_0x1b0ab3['dialNoAnswerRetryFrequency']),_0x12236c[_0x3b51('0xa4')],_0x12236c['activeContact']);}}}else{_0x12236c[_0x3b51('0xcd')]++;_0x31c893[_0x3b51('0xc7')]({'id':_0x12236c[_0x3b51('0xa6')],'field':{'countnoanswerretry':_0x12236c['countnoanswerretry']}})[_0x3b51('0x79')](function(){_0x31c893['swapAdditionalPhones'](_0x12236c,_0x53edb6,_0x597d92)[_0x3b51('0x79')](function(){});});}});break;case _0x3b51('0xcf'):_0x1b0ab3[_0x3b51('0x36')]+=0x1;_0x12236c[_0x3b51('0xd0')]+=0x1;_0x12236c[_0x3b51('0xb4')]=ut[_0x3b51('0x9c')](_0x12236c);ut['logCustomer'](_0x12236c,0x8,'Congestion');_0x53edb6=_0x1b0ab3[_0x3b51('0xd1')];_0x597d92=_0x1b0ab3[_0x3b51('0xbf')];ami[_0x3b51('0x55')]('custom:agentcongestion',ut['buildObj'](_0x12236c,_0x3b51('0xd2')));rpcDb[_0x3b51('0x9a')](_0x12236c,_0x3b51('0xd3'));_0x31c893[_0x3b51('0x9b')](_0x12236c,'8',_0x1b0ab3)['then'](function(_0x2130a9){_0x5338dc=_0x2130a9[_0x3b51('0xc1')]==0x1;if(!_0x5338dc){if(ut[_0x3b51('0x9c')](_0x12236c)>=_0x1b0ab3[_0x3b51('0x9d')]){_0x58897b=ut[_0x3b51('0x9e')](_0x12236c,0xf,_0x3b51('0x9f'));rpcDb[_0x3b51('0x89')](_0x58897b,_0x3b51('0xd4'));}else{if(_0x12236c[_0x3b51('0xd0')]>=_0x1b0ab3[_0x3b51('0xd5')]){rpcDb['createCustomerFinal'](_0x12236c,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3b51('0xa2')](ut[_0x3b51('0xc5')](_0x12236c,_0x3b51('0xd0'),_0x1b0ab3[_0x3b51('0xd6')]),_0x12236c[_0x3b51('0xa4')],_0x12236c[_0x3b51('0xc6')]);}}}else{_0x12236c['countcongestionretry']++;_0x31c893[_0x3b51('0xc7')]({'id':_0x12236c['idContact'],'field':{'countcongestionretry':_0x12236c[_0x3b51('0xd0')]}})[_0x3b51('0x79')](function(){_0x31c893[_0x3b51('0xa7')](_0x12236c,_0x53edb6,_0x597d92)[_0x3b51('0x79')](function(){});});}});break;case _0x3b51('0xd7'):_0x1b0ab3[_0x3b51('0x3c')]+=0x1;_0x12236c[_0x3b51('0xd8')]+=0x1;_0x12236c[_0x3b51('0xb4')]=ut[_0x3b51('0x9c')](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0x14,'AgentReject');_0x53edb6=_0x1b0ab3['dialAgentRejectRetryFrequency'];_0x597d92=_0x1b0ab3[_0x3b51('0xbf')];ami[_0x3b51('0x55')](_0x3b51('0xd9'),ut[_0x3b51('0x98')](_0x12236c,_0x3b51('0xda')));rpcDb[_0x3b51('0x9a')](_0x12236c,_0x3b51('0xdb'));_0x31c893['verifyAdditionalPhones'](_0x12236c,'20',_0x1b0ab3)[_0x3b51('0x79')](function(_0x5de10f){_0x5338dc=_0x5de10f[_0x3b51('0xc1')]==0x1;if(!_0x5338dc){if(ut[_0x3b51('0x9c')](_0x12236c)>=_0x1b0ab3[_0x3b51('0x9d')]){_0x58897b=ut[_0x3b51('0x9e')](_0x12236c,0x14,_0x3b51('0xdc'));rpcDb['createCustomerFinal'](_0x58897b,_0x3b51('0xdd'));}else{if(_0x12236c[_0x3b51('0xd8')]>=_0x1b0ab3[_0x3b51('0xde')]){rpcDb[_0x3b51('0x89')](_0x12236c,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x3b51('0xa2')](ut[_0x3b51('0xc5')](_0x12236c,_0x3b51('0xd8'),_0x1b0ab3[_0x3b51('0xdf')]),_0x12236c[_0x3b51('0xa4')],_0x12236c['activeContact']);}}}else{_0x12236c[_0x3b51('0xcd')]++;_0x31c893[_0x3b51('0xc7')]({'id':_0x12236c[_0x3b51('0xa6')],'field':{'countnoanswerretry':_0x12236c[_0x3b51('0xcd')]}})['then'](function(){_0x31c893[_0x3b51('0xa7')](_0x12236c,_0x53edb6,_0x597d92)[_0x3b51('0x79')](function(){});});}});break;case _0x3b51('0xe0'):_0x1b0ab3[_0x3b51('0x3e')]+=0x1;_0x12236c[_0x3b51('0xe1')]+=0x1;_0x12236c[_0x3b51('0xb4')]=ut['totalGlobal'](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0xb,_0x3b51('0xe2'));rpcDb[_0x3b51('0x9a')](_0x12236c,_0x3b51('0xe3'));if(ut['totalGlobal'](_0x12236c)>=_0x1b0ab3['dialGlobalMaxRetry']){_0x58897b=ut[_0x3b51('0x9e')](_0x12236c,0xf,_0x3b51('0x9f'));rpcDb[_0x3b51('0x89')](_0x58897b,_0x3b51('0xe3'));}else{if(_0x12236c['countabandonedetry']>=_0x1b0ab3['dialAbandonedMaxRety']){rpcDb[_0x3b51('0x89')](_0x12236c,_0x3b51('0xe3'));}else{rpcDb['rescheduleContact'](ut[_0x3b51('0xc5')](_0x12236c,_0x3b51('0xe1'),_0x1b0ab3[_0x3b51('0xe4')]),_0x12236c['unlockAgent'],_0x12236c[_0x3b51('0xc6')]);}}break;case'18':_0x1b0ab3[_0x3b51('0x3d')]+=0x1;_0x12236c['countmachineretry']+=0x1;_0x12236c[_0x3b51('0xb4')]=ut[_0x3b51('0x9c')](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0x12,_0x2734c4['cause-txt']||_0x2734c4[_0x3b51('0xe5')]);ami[_0x3b51('0x55')]('custom:amd',ut[_0x3b51('0x98')](_0x12236c,_0x3b51('0xe6')));rpcDb['createCustomerHistory'](_0x12236c,_0x3b51('0xe7'));if(ut[_0x3b51('0x9c')](_0x12236c)>=_0x1b0ab3[_0x3b51('0x9d')]){_0x58897b=ut['cloneAction'](_0x12236c,0xf,_0x3b51('0x9f'));rpcDb[_0x3b51('0x89')](_0x58897b,_0x3b51('0xe7'));}else{rpcDb[_0x3b51('0x89')](_0x12236c,_0x3b51('0xe7'));}delete this['actions'][_0x2734c4[_0x3b51('0xbc')]];break;case'19':_0x1b0ab3['outboundUnknownCallsDay']+=0x1;_0x12236c['countglobal']=ut[_0x3b51('0x9c')](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0x13,_0x2734c4[_0x3b51('0xe8')]||_0x2734c4[_0x3b51('0xe5')]);ami[_0x3b51('0x55')](_0x3b51('0xe9'),ut[_0x3b51('0x98')](_0x12236c,_0x3b51('0xe6')));rpcDb[_0x3b51('0x9a')](_0x12236c,_0x3b51('0xea'));if(ut[_0x3b51('0x9c')](_0x12236c)>=_0x1b0ab3[_0x3b51('0x9d')]){_0x58897b=ut[_0x3b51('0x9e')](_0x12236c,0xf,_0x3b51('0x9f'));rpcDb[_0x3b51('0x89')](_0x58897b,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x3b51('0x89')](_0x12236c,_0x3b51('0xea'));}delete this['actions'][_0x2734c4['linkedid']];break;default:if(_0x12236c[_0x3b51('0x68')]){ut[_0x3b51('0x72')](_0x1b0ab3,'[default]');ut['loggerError'](_0x3b51('0xeb')+_0x1b0ab3[_0x3b51('0x26')],_0x2734c4);}_0x1b0ab3['outboundUnknownCallsDay']+=0x1;_0x12236c[_0x3b51('0xb4')]=ut[_0x3b51('0x9c')](_0x12236c);ut[_0x3b51('0x87')](_0x12236c,0xc,_0x2734c4[_0x3b51('0xe8')]||_0x2734c4[_0x3b51('0xe5')]);_0x53edb6=_0x1b0ab3['dialAgentRejectRetryFrequency'];_0x597d92=_0x1b0ab3['callAdditionalPhoneAfterMin'];rpcDb[_0x3b51('0x9a')](_0x12236c,_0x3b51('0xec'));_0x31c893[_0x3b51('0x9b')](_0x12236c,'20',_0x1b0ab3)[_0x3b51('0x79')](function(_0x1f2a94){_0x5338dc=_0x1f2a94['additional']==0x1;if(!_0x5338dc){if(ut[_0x3b51('0x9c')](_0x12236c)>=_0x1b0ab3[_0x3b51('0x9d')]){_0x58897b=ut[_0x3b51('0x9e')](_0x12236c,0xf,'Global');rpcDb[_0x3b51('0x89')](_0x58897b,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x3b51('0x89')](_0x12236c,_0x3b51('0xed'));}delete this['actions'][_0x2734c4[_0x3b51('0xbc')]];}else{_0x31c893[_0x3b51('0xa7')](_0x12236c,_0x53edb6,_0x597d92)[_0x3b51('0x79')](function(_0x49f45f){});}});}if(!(_0x12236c[_0x3b51('0x68')]&&_0x4fde2d==='16')){ut[_0x3b51('0x70')](_0x1b0ab3,_0x3b51('0xee'));logger[_0x3b51('0x76')]('[originated][decrement][callProgressDetectingCustomer]',_0x12236c['uniqueid'],_0x3b51('0xad'),_0x1b0ab3[_0x3b51('0x26')],_0x3b51('0xef'),_0x1b0ab3['originated']);}if(_0x4fde2d!==_0x3b51('0xa8')){delete this[_0x3b51('0x15')][_0x2734c4[_0x3b51('0xbc')]];delete this[_0x3b51('0x15')][_0x2734c4[_0x3b51('0xf0')]];}}};Preview[_0x3b51('0x60')][_0x3b51('0xf1')]=function(_0xdc352d,_0x399316,_0x2106ca){if(_[_0x3b51('0xf2')](_0x399316)&&_0x3b51('0xf3')!==typeof _0x399316){return;}if(_[_0x3b51('0xf2')](_0x2106ca)&&_0x3b51('0xf3')!==typeof _0x2106ca){return;}switch(_0x2106ca[_0x3b51('0xf4')]){case'0':ut['logAgent'](_0xdc352d,0x0,_0x3b51('0x96'));rpcDb['createAgentHistory'](_0xdc352d,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0xdc352d,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0xdc352d,_0x3b51('0xf5'));break;case'5':ut[_0x3b51('0xf6')](_0xdc352d,0x5,_0x3b51('0xbe'));rpcDb[_0x3b51('0xf7')](_0xdc352d,_0x3b51('0xf8'));break;case'8':ut[_0x3b51('0xf6')](_0xdc352d,0x8,'Congestion');rpcDb[_0x3b51('0xf7')](_0xdc352d,_0x3b51('0xf9'));break;case'22':ut['logAgent'](_0xdc352d,0x16,_0x3b51('0xfa'));rpcDb[_0x3b51('0xf7')](_0xdc352d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xdc352d,0xc,_0x2106ca[_0x3b51('0xf4')]);rpcDb[_0x3b51('0xf7')](_0xdc352d,_0x3b51('0xf9'));}ut['updateOriginated'](_0x399316,'[callProgressDetectingAgent]');logger[_0x3b51('0x76')](_0x3b51('0xfb'),_0xdc352d[_0x3b51('0xac')],'\x20Queue',_0x399316['name'],_0x3b51('0xef'),_0x399316[_0x3b51('0xfc')]);delete this[_0x3b51('0x15')][_0xdc352d[_0x3b51('0xac')]];};Preview[_0x3b51('0x60')][_0x3b51('0x9b')]=function(_0x4d8e18,_0xcd292e,_0x232474){return BPromise[_0x3b51('0xfd')]()['then'](cmHopperAdditionalPhone[_0x3b51('0x9b')](_0x4d8e18,_0xcd292e,_0x232474))[_0x3b51('0x6e')](logger['info'](_0x3b51('0xfe')));};Preview[_0x3b51('0x60')]['swapAdditionalPhones']=function(_0x129fdd,_0x26b566,_0x546f28){return BPromise[_0x3b51('0xfd')]()[_0x3b51('0x79')](cmHopperAdditionalPhone[_0x3b51('0xa7')](_0x129fdd,_0x26b566,_0x546f28))['catch'](logger[_0x3b51('0x76')](_0x3b51('0xff')));};Preview[_0x3b51('0x60')][_0x3b51('0xc7')]=function(_0x29b128){return BPromise[_0x3b51('0xfd')]()[_0x3b51('0x79')](cmHopperAdditionalPhone[_0x3b51('0xc7')](_0x29b128))[_0x3b51('0x6e')](logger[_0x3b51('0x76')](_0x3b51('0x100')));};Preview[_0x3b51('0x60')]['checkInBlack']=function(_0x3100e1,_0x15f30d,_0x2f2a6c,_0x436ce0,_0x37ddaa){var _0x2b682b=this;return new BPromise(function(_0x308005,_0x321c1c){if(_[_0x3b51('0x101')](_0x15f30d)||_[_0x3b51('0x101')](_0x15f30d[_0x3b51('0x102')])||_['isNil'](_0x15f30d[_0x3b51('0x103')])||_[_0x3b51('0x101')](_0x15f30d[_0x3b51('0x104')])){_0x321c1c(ut[_0x3b51('0x5a')](_0x3b51('0x105'),_0x436ce0,_0x37ddaa));return;}var _0xa95f99=uuid['v4']();var _0xe133fe=_0x2b682b['campaignsPreview'][_0x15f30d[_0x3b51('0x106')]['name']];var _0x11b1bd=_0x2f2a6c?_0x2b682b[_0x3b51('0x16')][_0x2f2a6c]['id']:undefined;_0x2b682b[_0x3b51('0x15')][_0xa95f99]=new Action(_0x15f30d,_0xe133fe,_0xa95f99,_0x2f2a6c,_0x11b1bd);var _0x490eb4=_0x2b682b[_0x3b51('0x15')][_0xa95f99];_0x490eb4[_0x3b51('0xa4')]=_0x436ce0;_0x490eb4[_0x3b51('0xc6')]=_0x37ddaa;_0x490eb4['lookAgent']=_0x2f2a6c;if(_[_0x3b51('0x107')](_0x3100e1)){_0x2b682b['execCall'](_0x490eb4,_0xe133fe,_0x15f30d,_0x2f2a6c)[_0x3b51('0x79')](function(_0x5459fb){logger['info'](_0x3b51('0x108'),_0x3b51('0x109')+_0x490eb4[_0x3b51('0x66')]+_0x3b51('0x10a')+_0x490eb4[_0x3b51('0xa6')],JSON['stringify'](_0x5459fb));ami[_0x3b51('0x55')](_0x3b51('0x10b'),ut[_0x3b51('0x98')](_0x490eb4,_0x3b51('0x10c'),_0x2b682b['campaignsPreview'][_0x490eb4['queue']]));_0x308005(ut[_0x3b51('0x5a')](_0x3b51('0x10d')));})[_0x3b51('0x6e')](function(_0x210baa){ut[_0x3b51('0x5b')](_0x3b51('0x10e'),_0x210baa);_0x321c1c(ut[_0x3b51('0x5a')]('Call\x20failed',_0x436ce0,_0x37ddaa));});}else{_0xe133fe[_0x3b51('0x34')]+=0x1;ut['logBlacklist'](_0x490eb4);rpcDb[_0x3b51('0x10f')](_0x490eb4,_0x3b51('0x110'));delete _0x2b682b[_0x3b51('0x15')][_0xa95f99];_0x321c1c(ut['message'](_0x3b51('0x111'),_0x436ce0,_0x37ddaa));}});};Preview['prototype'][_0x3b51('0x91')]=function(_0x50abbe){return!_[_0x3b51('0x101')](_0x50abbe)&&!_['isNil'](_0x50abbe[_0x3b51('0x26')])&&!_[_0x3b51('0x101')](_0x50abbe['active'])&&_0x50abbe[_0x3b51('0x112')]&&!_['isNil'](this['trunks'][util[_0x3b51('0x51')]('SIP/%s',_0x50abbe[_0x3b51('0x26')])])&&!_['isNil'](this[_0x3b51('0x14')][util[_0x3b51('0x51')]('SIP/%s',_0x50abbe['name'])][_0x3b51('0x6d')])&&(this['trunks'][util[_0x3b51('0x51')](_0x3b51('0x113'),_0x50abbe[_0x3b51('0x26')])][_0x3b51('0x6d')]===_0x3b51('0x114')||this[_0x3b51('0x14')][util[_0x3b51('0x51')]('SIP/%s',_0x50abbe[_0x3b51('0x26')])]['status']===_0x3b51('0x115'));};Preview[_0x3b51('0x60')]['run']=function(_0x11a54d,_0x1f7e92){var _0x1f6163=this;return new BPromise(function(_0x49edc8,_0x3021de){_0x1f6163[_0x3b51('0x116')](_0x11a54d,_0x1f7e92)[_0x3b51('0x79')](function(_0x1851f8){_0x49edc8(_[_0x3b51('0x69')](_0x1851f8,[_0x3b51('0x5a')]));})[_0x3b51('0x6e')](function(_0x5cf89a){if(_0x5cf89a[_0x3b51('0x117')]){rpcDb['unlockContact'](_0x11a54d);}if(_0x5cf89a[_0x3b51('0x112')]){rpcDb[_0x3b51('0x118')](_0x11a54d);}_0x3021de(_[_0x3b51('0x69')](_0x5cf89a,[_0x3b51('0x5a')]));});});};Preview[_0x3b51('0x60')][_0x3b51('0x116')]=function(_0x581b7c,_0x564505){var _0x10324f=this;return new BPromise(function(_0x3562da,_0x1c1051){var _0x358b54,_0x22a74c;rpcDb['getContactPreview'](_0x581b7c)[_0x3b51('0x79')](function(_0x14113e){if(!_['isNil'](_0x14113e[0x0])){_0x22a74c=_0x14113e[0x0]['recallme']?![]:!![];_0x358b54=_0x14113e[0x0]['recallme']?!![]:![];_0x358b54=_0x564505?!![]:_0x358b54;}var _0x3e80c3=_0x10324f[_0x3b51('0x119')](_0x14113e);if(_0x3e80c3[_0x3b51('0x11a')]){rpcDb['checkIsBlackList'](_[_0x3b51('0x69')](_0x14113e[0x0],[_0x3b51('0x104'),_0x3b51('0x103')]))[_0x3b51('0x79')](function(_0x567bb0){_0x10324f[_0x3b51('0x11b')](_0x567bb0,_0x14113e[0x0],_0x564505,_0x22a74c,_0x358b54)[_0x3b51('0x79')](function(_0x2efd94){_0x3562da(_0x2efd94);})[_0x3b51('0x6e')](function(_0x26721c){_0x1c1051(_0x26721c);});})[_0x3b51('0x6e')](function(_0xc27d8c){ut[_0x3b51('0x5b')]('[Preview][checkIsBlackList]',_0xc27d8c);_0x1c1051(ut['message']('Call\x20unsuccessful',_0x22a74c,_0x358b54));});}else{_0x1c1051(ut['message'](_0x3e80c3['message'],_0x22a74c,_0x358b54));}})['catch'](function(_0x457244){ut[_0x3b51('0x5b')](_0x3b51('0x11c'),_0x457244);_0x1c1051(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0x3b51('0x60')][_0x3b51('0x119')]=function(_0x267f19){if(_[_0x3b51('0x101')](_0x267f19)||_[_0x3b51('0x107')](_0x267f19)||!_[_0x3b51('0x101')](_0x267f19[0x0]['Agent'])&&_['isNil'](_0x267f19[0x0][_0x3b51('0x11d')]['name'])){ut[_0x3b51('0x5b')](_0x3b51('0x11e'),_0x267f19);return{'isValid':![],'message':_0x3b51('0x11f')};}var _0x46bcb8=this[_0x3b51('0x12')][_0x267f19[0x0][_0x3b51('0x106')]['name']];_0x46bcb8[_0x3b51('0x5a')]=_0x3b51('0x94');if(_['isNil'](_0x46bcb8)){ut[_0x3b51('0x5b')]('[Preview][validateContact][Empty\x20Campaign]',_0x46bcb8);return{'isValid':![],'message':_0x3b51('0x120')};}if(!this[_0x3b51('0x91')](_0x46bcb8['Trunk'])){ut['logger'](_0x3b51('0x121'),'campaign\x20Name:\x20'+_0x46bcb8[_0x3b51('0x26')]+_0x3b51('0x122'));if(!this[_0x3b51('0x91')](_0x46bcb8[_0x3b51('0x92')])){ut[_0x3b51('0x5b')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x46bcb8[_0x3b51('0x26')]+_0x3b51('0x123'));return{'isValid':![],'message':_0x3b51('0x124')};}}if(!ut[_0x3b51('0x8f')](_0x46bcb8['dialActive'])){ut['logger'](_0x3b51('0x125'),_0x46bcb8[_0x3b51('0x26')]+_0x3b51('0x126'));return{'isValid':![],'message':_0x3b51('0x127')+_0x46bcb8[_0x3b51('0x26')]+_0x3b51('0x126')};}return{'isValid':!![],'message':_0x3b51('0x128')};};Preview[_0x3b51('0x60')]['execCall']=function(_0x3ec13b,_0x2f365d,_0x46bad7,_0x1f0ecd){var _0x326b36=this;return new BPromise(function(_0x385e50,_0x5bb25e){var _0x2b8e12=_0x3ec13b['uniqueid'];var _0x2218d4=_0x326b36['isTrunkReachable'](_0x2f365d[_0x3b51('0x4d')])?util[_0x3b51('0x51')]('SIP/%s/%s%s',_0x2f365d[_0x3b51('0x4d')][_0x3b51('0x26')],_[_0x3b51('0x101')](_0x2f365d[_0x3b51('0x129')])?'':_0x2f365d[_0x3b51('0x129')]['trim']()||'',_0x2f365d[_0x3b51('0x12a')]>0x0?_0x46bad7[_0x3b51('0x103')][_0x3b51('0x12b')](_0x2f365d[_0x3b51('0x12a')]):_0x46bad7['phone']):util['format'](_0x3b51('0x12c'),_[_0x3b51('0x101')](_0x2f365d[_0x3b51('0x92')])?_0x2f365d[_0x3b51('0x4d')][_0x3b51('0x26')]:_0x2f365d[_0x3b51('0x92')][_0x3b51('0x26')],_[_0x3b51('0x101')](_0x2f365d['dialPrefix'])?'':_0x2f365d[_0x3b51('0x129')][_0x3b51('0x12d')]()||'',_0x2f365d[_0x3b51('0x12a')]>0x0?_0x46bad7[_0x3b51('0x103')]['substring'](_0x2f365d[_0x3b51('0x12a')]):_0x46bad7[_0x3b51('0x103')]);var _0x321f23=_0x326b36[_0x3b51('0x91')](_0x2f365d[_0x3b51('0x4d')])?ut[_0x3b51('0x12e')](_0x2f365d[_0x3b51('0x4d')]['callerid'],_0x2f365d[_0x3b51('0x30')],_0x2f365d[_0x3b51('0x12f')]>0x0?ut[_0x3b51('0x130')](_0x2f365d[_0x3b51('0x131')],_0x2f365d[_0x3b51('0x12f')]):_0x2f365d[_0x3b51('0x131')]):ut[_0x3b51('0x12e')](_[_0x3b51('0x101')](_0x2f365d[_0x3b51('0x92')])?_0x2f365d['Trunk'][_0x3b51('0x4e')]:_0x2f365d['TrunkBackup'][_0x3b51('0x4e')],_0x2f365d[_0x3b51('0x30')],_0x2f365d[_0x3b51('0x12f')]>0x0?ut['getCallerIdRandom'](_0x2f365d[_0x3b51('0x131')],_0x2f365d['dialRandomLastDigitCallerIdNumber']):_0x2f365d[_0x3b51('0x131')]);if(_0x321f23){_0x3ec13b[_0x3b51('0x132')]=ut['extractCalleridName'](_0x321f23);_0x3ec13b[_0x3b51('0x133')]=ut[_0x3b51('0x134')](_0x321f23);}var _0x1bb0e9=ut[_0x3b51('0x135')](_0x2f365d,_0x46bad7,_0x2218d4,_0x321f23,_0x2b8e12,_0x3ec13b);_[_0x3b51('0x136')](_0x3ec13b,ut['toLowerVariables'](_0x1bb0e9));_0x3ec13b['starttime']=moment()[_0x3b51('0x51')](_0x3b51('0xa9'));ami[_0x3b51('0x6c')](ut[_0x3b51('0x137')](_0x3ec13b,_0x2f365d,_0x1bb0e9,_0x3ec13b[_0x3b51('0xc6')],_0x1f0ecd))[_0x3b51('0x79')](function(_0x1fc0d5){_0x2f365d['originated']+=0x1;logger['info']('[originated][increment]',_0x2b8e12,_0x3b51('0xad'),_0x2f365d[_0x3b51('0x26')],'originated:\x20',_0x2f365d[_0x3b51('0xfc')]);_0x385e50(_0x1fc0d5);})[_0x3b51('0x6e')](function(_0x1f1529){ut[_0x3b51('0xf6')](_0x3ec13b,0xe,_0x3b51('0x138'));rpcDb[_0x3b51('0xf7')](_0x3ec13b,'[originateFailure][logOriginateFailure]');_0x5bb25e(_0x1f1529);});});};Preview[_0x3b51('0x60')][_0x3b51('0x139')]=function(_0x55c050){if(this['actions'][_0x55c050[_0x3b51('0xbc')]]){this[_0x3b51('0x15')][_0x55c050[_0x3b51('0xbc')]][_0x3b51('0x13a')]=_0x55c050['channel'];}};Preview['prototype'][_0x3b51('0x19')]=function(_0x10f957){var _0xe4f053=this;var _0x39bb39=this[_0x3b51('0x15')][_0x10f957[_0x3b51('0x13b')]];if(_0x39bb39){if(_0x39bb39[_0x3b51('0x13c')]&&this['agents'][_0x39bb39['lookAgent']]){ut[_0x3b51('0x13d')](_0x39bb39,this[_0x3b51('0x16')][_0x39bb39[_0x3b51('0x13c')]]['name'],this['agents'][_0x39bb39['lookAgent']]['id']);}var _0x3b6fd1=_['clone'](_0x39bb39);_0x3b6fd1[_0x3b51('0xaa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x5069ef=_0xe4f053[_0x3b51('0x12')][_0x39bb39[_0x3b51('0x66')]];if(ut[_0x3b51('0x13e')](_0x10f957['response'])){if(_0x39bb39[_0x3b51('0xa4')]){rpcDb['unlockContact'](_0x39bb39['idContact']);}if(_0x39bb39[_0x3b51('0xc6')]){rpcDb[_0x3b51('0x118')](_0x39bb39[_0x3b51('0xa6')]);}ami[_0x3b51('0x55')]('custom:agentringnoanswer',ut[_0x3b51('0x98')](_0x39bb39,'rejected',this[_0x3b51('0x12')][_0x39bb39['queue']]));this[_0x3b51('0xf1')](_0x3b6fd1,_0x5069ef,_0x10f957);}else{_0x39bb39[_0x3b51('0x82')]=moment()[_0x3b51('0x51')](_0x3b51('0xa9'));ut[_0x3b51('0xf6')](_0x3b6fd1,0x4,_0x3b51('0xb5'));rpcDb[_0x3b51('0xf7')](_0x3b6fd1,_0x3b51('0x13f'));}}};Preview[_0x3b51('0x60')][_0x3b51('0x1b')]=function(_0x190521){var _0x336468=this;var _0x225301=this['actions'][_0x190521[_0x3b51('0xbc')]];var _0x1bc85a;if(_0x225301){_0x1bc85a=this['campaignsPreview'][_0x225301['queue']];logger[_0x3b51('0x76')](_0x3b51('0x140'),_0x190521[_0x3b51('0xbc')],'\x20Queue',_0x1bc85a['name'],_0x3b51('0x67'),_0x1bc85a[_0x3b51('0x58')]);}if(this[_0x3b51('0x15')][_0x190521[_0x3b51('0xbc')]]&&_0x190521[_0x3b51('0xbc')]!==_0x190521[_0x3b51('0xac')]){if(_0x190521[_0x3b51('0x141')]==='16'&&this[_0x3b51('0x15')][_0x190521[_0x3b51('0xbc')]][_0x3b51('0x68')]){this[_0x3b51('0x95')](_0x190521,_0x190521[_0x3b51('0xbc')],_0x190521[_0x3b51('0x141')]);}else if(this[_0x3b51('0x15')][_0x190521[_0x3b51('0xbc')]][_0x3b51('0x68')]){logger[_0x3b51('0x76')](_0x3b51('0x142'),_0x190521['linkedid'],_0x190521[_0x3b51('0x141')],_0x3b51('0xad'),_0x1bc85a[_0x3b51('0x26')],'pTalking:\x20',_0x1bc85a['pTalking']);this[_0x3b51('0x95')](_0x190521,_0x190521[_0x3b51('0xbc')],_0x190521['cause']);}}else if(_0x225301&&_[_0x3b51('0x101')](_0x225301[_0x3b51('0x143')])&&_0x1bc85a[_0x3b51('0x144')]&&_0x190521['linkedid']===_0x190521[_0x3b51('0xac')]&&_[_0x3b51('0x101')](_0x190521[_0x3b51('0xf4')])&&_0x190521['cause']==='16'&&_0x190521['channelstate']==='6'&&_[_0x3b51('0xf2')](_0x225301[_0x3b51('0x145')])){if(_0x225301[_0x3b51('0xa4')]){rpcDb[_0x3b51('0x146')](_0x225301[_0x3b51('0xa6')]);}if(_0x225301[_0x3b51('0xc6')]){rpcDb[_0x3b51('0x118')](_0x225301[_0x3b51('0xa6')]);}_0x190521[_0x3b51('0xf4')]='22';this[_0x3b51('0xf1')](_0x225301,_0x1bc85a,_0x190521);}else if(_0x225301&&_0x225301[_0x3b51('0x145')]){if(_0x190521['cause']==='16'&&this[_0x3b51('0x15')][_0x190521['linkedid']][_0x3b51('0x68')]){logger[_0x3b51('0x76')](_0x3b51('0x147'),_0x190521['linkedid'],_0x190521['cause'],'\x20Queue',_0x1bc85a[_0x3b51('0x26')],'pTalking:\x20',_0x1bc85a[_0x3b51('0x58')]);this[_0x3b51('0x95')](_0x190521,_0x190521[_0x3b51('0xbc')],_0x190521[_0x3b51('0x141')]);}else if(this[_0x3b51('0x15')][_0x190521[_0x3b51('0xbc')]][_0x3b51('0x68')]){logger[_0x3b51('0x76')](_0x3b51('0x142'),_0x190521[_0x3b51('0xbc')],_0x190521[_0x3b51('0x141')],'\x20Queue',_0x1bc85a[_0x3b51('0x26')],_0x3b51('0x67'),_0x1bc85a[_0x3b51('0x58')]);this['callProgressDetectingCustomer'](_0x190521,_0x190521[_0x3b51('0xbc')],_0x190521[_0x3b51('0x141')]);}}};Preview[_0x3b51('0x60')][_0x3b51('0x1e')]=function(_0x21b6af){if(this[_0x3b51('0x15')][_0x21b6af[_0x3b51('0xf0')]]&&_0x21b6af[_0x3b51('0xf0')]!==_0x21b6af['destuniqueid']){this[_0x3b51('0x95')](_0x21b6af,_0x21b6af[_0x3b51('0xf0')],_0x21b6af[_0x3b51('0xe5')]);}};Preview[_0x3b51('0x60')][_0x3b51('0x1d')]=function(_0x48cc28){if(this[_0x3b51('0x15')][_0x48cc28[_0x3b51('0xbc')]]&&_0x48cc28[_0x3b51('0xbc')]!==_0x48cc28['uniqueid']&&!this[_0x3b51('0x15')][_0x48cc28[_0x3b51('0xbc')]][_0x3b51('0x68')]){if(_0x48cc28[_0x3b51('0x141')]==='1'){this[_0x3b51('0x95')](_0x48cc28,_0x48cc28[_0x3b51('0xbc')],_0x48cc28['cause']);}}};Preview[_0x3b51('0x60')][_0x3b51('0x148')]=function(_0xb6ac13,_0x5c23f1,_0x4cc15b){if(this['actions'][_0xb6ac13]){if(_[_0x3b51('0x101')](this[_0x3b51('0x15')][_0xb6ac13][_0x3b51('0x149')])){this[_0x3b51('0x15')][_0xb6ac13][_0x3b51('0x149')]={};}this[_0x3b51('0x15')][_0xb6ac13][_0x3b51('0x149')][_0x5c23f1]=_0x4cc15b;}};Preview[_0x3b51('0x60')]['syncVarSet']=function(_0x4df0ae){try{if(!_[_0x3b51('0x101')](_0x4df0ae)){if(ut[_0x3b51('0x14a')](_[_0x3b51('0x14b')](_0x4df0ae[_0x3b51('0x14c')])[0x0])){this['addVariable'](_0x4df0ae['uniqueid'],_[_0x3b51('0x14b')](_0x4df0ae[_0x3b51('0x14c')])[0x0],_0x4df0ae[_0x3b51('0x14d')]);}}}catch(_0x2e1d4c){logger[_0x3b51('0x14e')](_0x3b51('0x14f'),util[_0x3b51('0x150')](_0x2e1d4c,{'showHidden':![],'depth':null}));}};Preview[_0x3b51('0x60')][_0x3b51('0x151')]=function(_0x273ff2){if(_0x273ff2){if(this[_0x3b51('0x15')][_0x273ff2[_0x3b51('0x152')]]){this[_0x3b51('0x15')][_0x273ff2[_0x3b51('0x152')]]['transfer']=!![];}}};Preview[_0x3b51('0x60')][_0x3b51('0x22')]=function(_0x20d575){if(_0x20d575){if(this[_0x3b51('0x15')][_0x20d575[_0x3b51('0x153')]]){this['actions'][_0x20d575[_0x3b51('0x153')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x13c7=['outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','dialAnswer','[default]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','extractCalleridName','originatecalleridnum','addVariables','merge','Action','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destuniqueid','variables','keys','variable','addVariable','value','error','transfertargetlinkedid','transfer','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','socket.io-emitter','prototype','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','outbound','name','strategy','answered','available','loggedIn','pTalking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','VoiceQueueId','ListId','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','countnosuchnumberretry','unlockAgent','activeContact','linkedid','info','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','uniqueid','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','additional','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x13c7,0x1e6));var _0x713c=function(_0x3313e0,_0x3ef749){_0x3313e0=_0x3313e0-0x0;var _0x1e14d7=_0x13c7[_0x3313e0];return _0x1e14d7;};'use strict';var util=require('util');var _=require(_0x713c('0x0'));var BPromise=require(_0x713c('0x1'));var uuid=require(_0x713c('0x2'));var moment=require(_0x713c('0x3'));var md5=require(_0x713c('0x4'));var Redis=require(_0x713c('0x5'));var config=require(_0x713c('0x6'));var logger=require(_0x713c('0x7'))(_0x713c('0x8'));var loggerAction=require(_0x713c('0x7'))(_0x713c('0x9'));var ami=require(_0x713c('0xa'));var rpcDb=require(_0x713c('0xb'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x713c('0xc'));var ut=require('./util/util');config[_0x713c('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x713c('0xe'))(new Redis(config[_0x713c('0xd')]));var Sequence=function(){};Sequence[_0x713c('0xf')]['enqueue']=function(_0x45bc0e){this['tail']=this[_0x713c('0x10')]?this[_0x713c('0x10')][_0x713c('0x11')](_0x45bc0e):_0x45bc0e();};function Preview(_0x3ea1f8){this['sequence']=new Sequence();this[_0x713c('0x12')]=_0x3ea1f8[_0x713c('0x13')];this[_0x713c('0x14')]=_0x3ea1f8[_0x713c('0x14')];this[_0x713c('0x15')]={};this[_0x713c('0x16')]=_0x3ea1f8['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x713c('0x17'),this[_0x713c('0x18')][_0x713c('0x19')](this));ami['on'](_0x713c('0x1a'),this[_0x713c('0x1b')][_0x713c('0x19')](this));ami['on'](_0x713c('0x1c'),this[_0x713c('0x1d')][_0x713c('0x19')](this));ami['on'](_0x713c('0x1e'),this[_0x713c('0x1f')][_0x713c('0x19')](this));ami['on'](_0x713c('0x20'),this[_0x713c('0x21')][_0x713c('0x19')](this));ami['on'](_0x713c('0x22'),this[_0x713c('0x23')][_0x713c('0x19')](this));ami['on'](_0x713c('0x24'),this[_0x713c('0x25')]['bind'](this));ami['on']('blindtransfer',this[_0x713c('0x26')][_0x713c('0x19')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x4289e5,_0x5b50b1,_0x3540ab){io['to'](_0x4289e5)['emit'](_0x5b50b1,_0x3540ab);}function emitCampaignPreview(_0x5761e1){if(_0x5761e1['type']===_0x713c('0x27')){var _0x17c4d0={'id':_0x5761e1['id'],'name':_0x5761e1[_0x713c('0x28')],'strategy':_0x5761e1[_0x713c('0x29')],'answered':_0x5761e1[_0x713c('0x2a')],'available':_0x5761e1[_0x713c('0x2b')],'loggedIn':_0x5761e1[_0x713c('0x2c')],'pTalking':_0x5761e1[_0x713c('0x2d')],'sumBillable':_0x5761e1['sumBillable'],'sumDuration':_0x5761e1['sumDuration'],'sumHoldTime':_0x5761e1['sumHoldTime']||0x0,'talking':_0x5761e1['talking'],'total':_0x5761e1['total'],'type':_0x5761e1[_0x713c('0x2e')],'unmanaged':_0x5761e1[_0x713c('0x2f')],'abandoned':_0x5761e1[_0x713c('0x30')],'waiting':_0x5761e1[_0x713c('0x31')],'loggedInDb':_0x5761e1[_0x713c('0x32')],'dialActive':_0x5761e1[_0x713c('0x33')],'dialMethod':_0x5761e1[_0x713c('0x34')],'dialOriginateCallerIdName':_0x5761e1['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5761e1[_0x713c('0x35')],'dialOriginateTimeout':_0x5761e1['dialOriginateTimeout'],'dialPrefix':_0x5761e1[_0x713c('0x36')],'outboundAnswerAgiCallsDay':_0x5761e1[_0x713c('0x37')],'outboundAnswerCallsDay':_0x5761e1[_0x713c('0x38')],'outboundBlacklistCallsDay':_0x5761e1[_0x713c('0x39')],'outboundBusyCallsDay':_0x5761e1[_0x713c('0x3a')],'outboundCongestionCallsDay':_0x5761e1[_0x713c('0x3b')],'outboundDropCallsDayACS':_0x5761e1[_0x713c('0x3c')],'outboundDropCallsDayCallersExit':_0x5761e1[_0x713c('0x3d')],'outboundDropCallsDayTimeout':_0x5761e1[_0x713c('0x3e')],'outboundNoAnswerCallsDay':_0x5761e1['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5761e1[_0x713c('0x3f')],'outboundOriginateFailureCallsDay':_0x5761e1[_0x713c('0x40')],'outboundReCallsDay':_0x5761e1[_0x713c('0x41')],'outboundRejectCallsDay':_0x5761e1[_0x713c('0x42')],'outboundUnknownCallsDay':_0x5761e1['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x5761e1[_0x713c('0x43')],'predictiveIntervalAnsweredCalls':_0x5761e1['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5761e1[_0x713c('0x44')],'predictiveIntervalAvgTalktime':_0x5761e1['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5761e1[_0x713c('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x5761e1[_0x713c('0x46')],'predictiveIntervalErlangCalls':_0x5761e1[_0x713c('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x5761e1['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5761e1['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x5761e1['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5761e1['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5761e1[_0x713c('0x48')],'predictiveIntervalTotalCalls':_0x5761e1['predictiveIntervalTotalCalls'],'message':_0x5761e1[_0x713c('0x49')],'originated':_0x5761e1[_0x713c('0x4a')],'erlangCalls':_0x5761e1[_0x713c('0x4b')],'erlangCallToSecond':_0x5761e1[_0x713c('0x4c')],'erlangAbandonmentRate':_0x5761e1[_0x713c('0x4d')],'erlangBusyFactor':_0x5761e1[_0x713c('0x4e')],'startPredictive':_0x5761e1['startPredictive'],'startProgressive':_0x5761e1['startProgressive']};if(_0x5761e1[_0x713c('0x4f')]){_0x17c4d0['Trunk']={'id':_0x5761e1[_0x713c('0x4f')]['id'],'name':_0x5761e1['Trunk'][_0x713c('0x28')],'active':_0x5761e1[_0x713c('0x4f')][_0x713c('0x50')],'callerid':_0x5761e1[_0x713c('0x4f')][_0x713c('0x51')]};}if(_0x5761e1[_0x713c('0x52')]){_0x17c4d0[_0x713c('0x52')]={'id':_0x5761e1[_0x713c('0x52')]['id'],'name':_0x5761e1[_0x713c('0x52')][_0x713c('0x28')]};}var _0x22b10e=md5(JSON[_0x713c('0x53')](_0x17c4d0));if(_0x5761e1['md5']!==_0x22b10e){_0x5761e1[_0x713c('0x4')]=_0x22b10e;emit(util[_0x713c('0x54')](_0x713c('0x55'),_0x17c4d0[_0x713c('0x28')]),_0x713c('0x56'),_0x17c4d0);}}}function emitVoiceQueueChannelRemove(_0x14fca2){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x713c('0x53')](_0x14fca2));emit(util[_0x713c('0x54')]('voice:queue:%s',_0x14fca2[_0x713c('0x28')]),_0x713c('0x57'),_0x14fca2);io[_0x713c('0x58')](_0x713c('0x59'),_0x14fca2);}function notSendMessagesQueue(_0x201a3e){if(_0x201a3e[_0x713c('0x5a')]){if(_0x201a3e[_0x713c('0x4a')]===0x0&&_0x201a3e[_0x713c('0x2d')]===0x0){_0x201a3e['sendMessageOneNotActive']=![];_0x201a3e[_0x713c('0x2b')]=0x0;_0x201a3e[_0x713c('0x5b')]=0x0;_0x201a3e[_0x713c('0x49')]=_0x713c('0x5c');ut['logger'](_0x713c('0x5d'),_0x201a3e[_0x713c('0x28')]+'\x20is\x20not\x20active');}else{_0x201a3e[_0x713c('0x49')]=_0x713c('0x5e');ut[_0x713c('0x5f')](_0x713c('0x5d'),_0x201a3e[_0x713c('0x28')]+_0x713c('0x60'));}emitCampaignPreview(_0x201a3e);}}Preview[_0x713c('0xf')]['loopCampaigns']=function(){var _0x3f28ff=this;setInterval(function(){_0x3f28ff[_0x713c('0x61')]();},0x7cf);};Preview['prototype'][_0x713c('0x61')]=function(){var _0x533c34=this[_0x713c('0x12')];this[_0x713c('0x62')]+=0x1;for(var _0x15d368 in _0x533c34){if(_0x533c34[_0x713c('0x63')](_0x15d368)&&(_0x533c34[_0x15d368][_0x713c('0x34')]===_0x713c('0x8')||_0x533c34[_0x15d368][_0x713c('0x34')]===_0x713c('0x64'))&&_0x533c34[_0x15d368][_0x713c('0x2e')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x713c('0x62')]=0x0;this[_0x713c('0x65')]();}}if(_0x533c34[_0x713c('0x63')](_0x15d368)&&_0x533c34[_0x15d368][_0x713c('0x34')]==='preview'&&_0x533c34[_0x15d368]['type']==='outbound'){if(_0x533c34[_0x15d368][_0x713c('0x33')]){this['setMessage'](_0x533c34[_0x15d368]);this['recallMe'](_0x533c34[_0x15d368]);}else{notSendMessagesQueue(_0x533c34[_0x15d368]);}}}};Preview[_0x713c('0xf')][_0x713c('0x66')]=function(_0x3753ab){var _0x28098e=this;this[_0x713c('0x67')]['enqueue'](function(){if(!_[_0x713c('0x68')](_0x28098e[_0x713c('0x15')][_0x3753ab])){loggerAction['info'](_0x713c('0x69'),_0x3753ab,'Queue',_0x28098e[_0x713c('0x15')][_0x3753ab][_0x713c('0x6a')],_0x713c('0x6b'),JSON[_0x713c('0x53')](_0x28098e[_0x713c('0x12')][_0x28098e[_0x713c('0x15')][_0x3753ab][_0x713c('0x6a')]][_0x713c('0x4a')]),_0x713c('0x6c'),JSON[_0x713c('0x53')](_0x28098e[_0x713c('0x12')][_0x28098e[_0x713c('0x15')][_0x3753ab][_0x713c('0x6a')]][_0x713c('0x2d')]),JSON[_0x713c('0x53')](_0x28098e[_0x713c('0x15')][_0x3753ab]['dialAnswer']),JSON[_0x713c('0x53')](_['pick'](_0x28098e[_0x713c('0x15')][_0x3753ab],['contactId','UserId',_0x713c('0x6d'),_0x713c('0x6e')])));return ami['Action']({'action':_0x713c('0x6f'),'channel':_0x28098e[_0x713c('0x15')][_0x3753ab][_0x713c('0x70')]})['catch'](function(_0x4a042f){if(_0x4a042f[_0x713c('0x49')]===_0x713c('0x71')){setTimeout(function(){if(_0x28098e['actions'][_0x3753ab]){ut[_0x713c('0x72')](_0x28098e[_0x713c('0x12')][_0x28098e['actions'][_0x3753ab][_0x713c('0x6a')]],_0x713c('0x73'));if(_0x28098e['actions'][_0x3753ab]['dialAnswer']===!![]){ut[_0x713c('0x74')](_0x28098e[_0x713c('0x12')][_0x28098e[_0x713c('0x15')][_0x3753ab][_0x713c('0x6a')]],'[clearZombieChannel]');ut[_0x713c('0x75')](_0x713c('0x76')+_0x3753ab,_0x28098e[_0x713c('0x15')][_0x3753ab][_0x713c('0x6a')]);}ut[_0x713c('0x75')](_0x713c('0x77')+_0x3753ab,_0x28098e['actions'][_0x3753ab][_0x713c('0x6a')]);delete _0x28098e[_0x713c('0x15')][_0x3753ab];}},0x2328);}});}});};Preview[_0x713c('0xf')][_0x713c('0x65')]=function(){var _0x163fe3=this;loggerAction['info'](_0x713c('0x78'),_[_0x713c('0x79')](this['actions']));for(var _0x10bc35 in this[_0x713c('0x15')]){if(_0x163fe3[_0x713c('0x15')][_0x713c('0x63')](_0x10bc35)){_0x163fe3[_0x713c('0x66')](_0x10bc35);}}};Preview[_0x713c('0xf')][_0x713c('0x7a')]=function(_0x3b9360){var _0x671520=this;rpcDb['getContactRecallMe'](_0x3b9360['id'],ut['agentReadyId'](this[_0x713c('0x16')]))['then'](function(_0x30de2a){if(!_[_0x713c('0x68')](_0x30de2a)){for(var _0x1590e7=0x0;_0x1590e7<_0x30de2a['length'];_0x1590e7+=0x1){if(ut[_0x713c('0x7b')](_0x30de2a[_0x1590e7][_0x713c('0x7c')])<_0x3b9360['dialRecallMeTimeout']*0x3c){if(_0x30de2a[_0x1590e7][_0x713c('0x7d')]&&!_0x30de2a[_0x1590e7]['Agent'][_0x713c('0x7e')]){_0x671520[_0x713c('0x7f')](_0x30de2a[_0x1590e7]['id'])[_0x713c('0x80')](ut[_0x713c('0x81')](_0x713c('0x82')))[_0x713c('0x83')](ut[_0x713c('0x81')](_0x713c('0x82')));}else{rpcDb[_0x713c('0x84')](_0x30de2a[_0x1590e7]['id']);}}else{var _0x48f83c=new Action(_0x30de2a[_0x1590e7],_0x3b9360);_0x48f83c[_0x713c('0x85')]=moment()['format'](_0x713c('0x86'));_0x3b9360[_0x713c('0x41')]+=0x1;ut['logCustomer'](_0x48f83c,0x17,_0x713c('0x87'));if(_0x3b9360['dialRecallInQueue']){rpcDb[_0x713c('0x88')](ut['createBody'](_0x30de2a[_0x1590e7]));rpcDb[_0x713c('0x89')](_0x48f83c,_0x713c('0x8a'));}else{ut[_0x713c('0x8b')](_0x48f83c,0x16,_0x713c('0x8c'));rpcDb[_0x713c('0x89')](_0x48f83c,_0x713c('0x8d'));rpcDb[_0x713c('0x8e')](_0x48f83c,_0x713c('0x8d'));}}}}})['catch'](ut[_0x713c('0x81')](_0x713c('0x8f')));};Preview[_0x713c('0xf')]['setMessage']=function(_0x356cdd){_0x356cdd['sendMessageOneNotActive']=!![];if(ut[_0x713c('0x90')](_0x356cdd[_0x713c('0x2c')])){_0x356cdd['message']=_0x713c('0x91');}else if(!ut[_0x713c('0x92')](_0x356cdd['dialActive'])){_0x356cdd[_0x713c('0x49')]=_0x713c('0x5c');}else if(!this[_0x713c('0x93')](_0x356cdd[_0x713c('0x4f')])){if(!this[_0x713c('0x93')](_0x356cdd[_0x713c('0x94')])){_0x356cdd[_0x713c('0x49')]='TRUNK_IS_NOT_REACHABLE';}else{_0x356cdd[_0x713c('0x49')]=_0x713c('0x95');}}else{_0x356cdd[_0x713c('0x49')]=_0x713c('0x95');}emitCampaignPreview(_0x356cdd);};Preview[_0x713c('0xf')][_0x713c('0x96')]=function(_0x17d2b3,_0x3d45ab,_0xf99e1b){var _0x13b004=this;var _0x455cc6=this[_0x713c('0x15')][_0x3d45ab];var _0x2efdaf=this['campaignsPreview'][_0x455cc6[_0x713c('0x6a')]];var _0x4f3aa7;var _0x12b57b=![];var _0x1da596=0x2;var _0x120ab7=0x3;if(_0x2efdaf){switch(_0xf99e1b){case'1':_0x2efdaf[_0x713c('0x3f')]+=0x1;_0x455cc6['countnosuchnumberretry']+=0x1;_0x455cc6['countglobal']=ut[_0x713c('0x97')](_0x455cc6);ut['logCustomer'](_0x455cc6,0x0,'NoSuchNumber');ami['emit'](_0x713c('0x98'),ut[_0x713c('0x99')](_0x455cc6,_0x713c('0x9a')));rpcDb['createCustomerHistory'](_0x455cc6,_0x713c('0x9b'));_0x13b004[_0x713c('0x9c')](_0x455cc6,'0',_0x2efdaf)[_0x713c('0x80')](function(_0x31bb1b){_0x12b57b=_0x31bb1b['additional']==0x1;_0x1da596=_0x2efdaf[_0x713c('0x9d')];_0x120ab7=_0x2efdaf[_0x713c('0x9e')];if(!_0x12b57b){if(ut[_0x713c('0x97')](_0x455cc6)>=_0x2efdaf[_0x713c('0x9f')]){_0x4f3aa7=ut[_0x713c('0xa0')](_0x455cc6,0xf,_0x713c('0xa1'));rpcDb[_0x713c('0x8e')](_0x4f3aa7,_0x713c('0xa2'));}else{if(_0x455cc6['countnosuchnumberretry']>=_0x2efdaf['dialNoSuchNumberMaxRetry']){rpcDb[_0x713c('0x8e')](_0x455cc6,_0x713c('0xa2'));}else{rpcDb[_0x713c('0xa3')](ut[_0x713c('0xa4')](_0x455cc6,_0x713c('0xa5'),_0x2efdaf[_0x713c('0x9d')]),_0x455cc6[_0x713c('0xa6')],_0x455cc6[_0x713c('0xa7')]);}}delete this['actions'][_0x17d2b3[_0x713c('0xa8')]];}else{_0x455cc6[_0x713c('0xa5')]++;logger[_0x713c('0xa9')](_0x713c('0xaa'),_0x455cc6[_0x713c('0xa5')]);logger[_0x713c('0xa9')]('id',_0x455cc6[_0x713c('0xab')]);_0x13b004[_0x713c('0xac')]({'id':_0x455cc6[_0x713c('0xab')],'field':{'countnosuchnumberretry':_0x455cc6[_0x713c('0xa5')]}})[_0x713c('0x80')](function(){_0x13b004[_0x713c('0xad')](_0x455cc6,_0x1da596,_0x120ab7)['then'](function(){});});}});break;case _0x713c('0xae'):var _0xca9973=moment()[_0x713c('0x54')](_0x713c('0x86'));_0x455cc6[_0x713c('0xaf')]=_0xca9973;_0x455cc6[_0x713c('0xb0')]=_0xca9973;_0x455cc6['dialAnswer']=!![];_0x2efdaf[_0x713c('0x2d')]+=0x1;logger['info'](_0x713c('0xb1'),_0x455cc6['uniqueid'],_0x713c('0xb2'),_0x2efdaf['name'],'pTalking:\x20',_0x2efdaf[_0x713c('0x2d')]);ami['emit'](_0x713c('0xb3'),ut[_0x713c('0x99')](_0x455cc6,_0x713c('0xb4'),this[_0x713c('0x12')][_0x455cc6[_0x713c('0x6a')]]));if(_0x2efdaf[_0x713c('0xb5')]){ami[_0x713c('0x58')](_0x713c('0xb6'),ut[_0x713c('0xb7')](_0x455cc6));}break;case'16':ami[_0x713c('0x58')](_0x713c('0xb8'),ut['buildObj'](_0x455cc6,'complete',this[_0x713c('0x12')][_0x455cc6[_0x713c('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x713c('0x99')](_0x455cc6,_0x713c('0xb9')));_0x2efdaf[_0x713c('0x38')]+=0x1;_0x2efdaf[_0x713c('0xba')]+=0x1;_0x2efdaf['answered']+=0x1;ut[_0x713c('0x74')](_0x2efdaf,_0x713c('0xbb'));_0x455cc6[_0x713c('0xbc')]=ut['totalGlobal'](_0x455cc6);ut[_0x713c('0x8b')](_0x455cc6,0x4,_0x713c('0xbd'));rpcDb[_0x713c('0x89')](_0x455cc6,_0x713c('0xbe'));rpcDb[_0x713c('0x8e')](_0x455cc6,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x713c('0xbf')](_0x455cc6);_0x2efdaf[_0x713c('0xc0')]+=_0x455cc6[_0x713c('0xc1')];_0x2efdaf[_0x713c('0xc2')]+=_0x455cc6[_0x713c('0xc1')];logger[_0x713c('0xa9')]('[syncHangup][talking][decrement]',_0x455cc6[_0x713c('0xc3')],_0x713c('0xb2'),_0x2efdaf['name'],_0x713c('0x6c'),_0x2efdaf[_0x713c('0x2d')]);delete this[_0x713c('0x15')][_0x17d2b3[_0x713c('0xa8')]];break;case _0x713c('0xc4'):_0x2efdaf[_0x713c('0x3a')]+=0x1;_0x455cc6[_0x713c('0xc5')]+=0x1;_0x455cc6[_0x713c('0xbc')]=ut['totalGlobal'](_0x455cc6);ut[_0x713c('0x8b')](_0x455cc6,0x5,_0x713c('0xc6'));_0x1da596=_0x2efdaf[_0x713c('0xc7')];_0x120ab7=_0x2efdaf[_0x713c('0x9e')];ami[_0x713c('0x58')]('custom:agentbusy',ut['buildObj'](_0x455cc6,_0x713c('0xc8')));rpcDb[_0x713c('0x89')](_0x455cc6,_0x713c('0xc9'));_0x13b004[_0x713c('0x9c')](_0x455cc6,'5',_0x2efdaf)[_0x713c('0x80')](function(_0x5b340a){_0x12b57b=_0x5b340a[_0x713c('0xca')]==0x1;if(!_0x12b57b){if(ut[_0x713c('0x97')](_0x455cc6)>=_0x2efdaf['dialGlobalMaxRetry']){_0x4f3aa7=ut[_0x713c('0xa0')](_0x455cc6,0xf,_0x713c('0xa1'));rpcDb['createCustomerFinal'](_0x4f3aa7,_0x713c('0xcb'));}else{if(_0x455cc6[_0x713c('0xc5')]>=_0x2efdaf[_0x713c('0xcc')]){rpcDb['createCustomerFinal'](_0x455cc6,_0x713c('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0x713c('0xa4')](_0x455cc6,_0x713c('0xc5'),_0x2efdaf[_0x713c('0xc7')]),_0x455cc6['unlockAgent'],_0x455cc6[_0x713c('0xa7')]);}}}else{_0x455cc6[_0x713c('0xc5')]++;_0x13b004[_0x713c('0xac')]({'id':_0x455cc6['idContact'],'field':{'countbusyretry':_0x455cc6[_0x713c('0xc5')]}})[_0x713c('0x80')](function(){_0x13b004[_0x713c('0xad')](_0x455cc6,_0x1da596,_0x120ab7)[_0x713c('0x80')](function(){});});}});break;case _0x713c('0xcd'):_0x2efdaf[_0x713c('0xce')]+=0x1;_0x455cc6[_0x713c('0xcf')]+=0x1;_0x455cc6[_0x713c('0xbc')]=ut[_0x713c('0x97')](_0x455cc6);ut['logCustomer'](_0x455cc6,0x3,_0x713c('0xd0'));_0x1da596=_0x2efdaf[_0x713c('0xd1')];_0x120ab7=_0x2efdaf[_0x713c('0x9e')];ami[_0x713c('0x58')](_0x713c('0xd2'),ut[_0x713c('0x99')](_0x455cc6,_0x713c('0xd3')));rpcDb['createCustomerHistory'](_0x455cc6,_0x713c('0xd4'));_0x13b004[_0x713c('0x9c')](_0x455cc6,'3',_0x2efdaf)[_0x713c('0x80')](function(_0x5b57d2){_0x12b57b=_0x5b57d2[_0x713c('0xca')]==0x1;if(!_0x12b57b){if(ut[_0x713c('0x97')](_0x455cc6)>=_0x2efdaf[_0x713c('0x9f')]){_0x4f3aa7=ut[_0x713c('0xa0')](_0x455cc6,0xf,_0x713c('0xa1'));rpcDb[_0x713c('0x8e')](_0x4f3aa7,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x455cc6['countnoanswerretry']>=_0x2efdaf[_0x713c('0xd5')]){rpcDb[_0x713c('0x8e')](_0x455cc6,_0x713c('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0x713c('0xa4')](_0x455cc6,'countnoanswerretry',_0x2efdaf['dialNoAnswerRetryFrequency']),_0x455cc6['unlockAgent'],_0x455cc6[_0x713c('0xa7')]);}}}else{_0x455cc6[_0x713c('0xcf')]++;_0x13b004[_0x713c('0xac')]({'id':_0x455cc6[_0x713c('0xab')],'field':{'countnoanswerretry':_0x455cc6[_0x713c('0xcf')]}})[_0x713c('0x80')](function(){_0x13b004['swapAdditionalPhones'](_0x455cc6,_0x1da596,_0x120ab7)[_0x713c('0x80')](function(){});});}});break;case _0x713c('0xd6'):_0x2efdaf[_0x713c('0x3b')]+=0x1;_0x455cc6['countcongestionretry']+=0x1;_0x455cc6['countglobal']=ut['totalGlobal'](_0x455cc6);ut['logCustomer'](_0x455cc6,0x8,'Congestion');_0x1da596=_0x2efdaf[_0x713c('0xd7')];_0x120ab7=_0x2efdaf['callAdditionalPhoneAfterMin'];ami[_0x713c('0x58')](_0x713c('0xd8'),ut[_0x713c('0x99')](_0x455cc6,_0x713c('0xd9')));rpcDb[_0x713c('0x89')](_0x455cc6,_0x713c('0xda'));_0x13b004[_0x713c('0x9c')](_0x455cc6,'8',_0x2efdaf)[_0x713c('0x80')](function(_0x3d9ec1){_0x12b57b=_0x3d9ec1['additional']==0x1;if(!_0x12b57b){if(ut[_0x713c('0x97')](_0x455cc6)>=_0x2efdaf['dialGlobalMaxRetry']){_0x4f3aa7=ut[_0x713c('0xa0')](_0x455cc6,0xf,_0x713c('0xa1'));rpcDb[_0x713c('0x8e')](_0x4f3aa7,_0x713c('0xdb'));}else{if(_0x455cc6[_0x713c('0xdc')]>=_0x2efdaf[_0x713c('0xdd')]){rpcDb[_0x713c('0x8e')](_0x455cc6,_0x713c('0xda'));}else{rpcDb[_0x713c('0xa3')](ut[_0x713c('0xa4')](_0x455cc6,_0x713c('0xdc'),_0x2efdaf[_0x713c('0xc7')]),_0x455cc6[_0x713c('0xa6')],_0x455cc6[_0x713c('0xa7')]);}}}else{_0x455cc6['countcongestionretry']++;_0x13b004['incrementPreviewCounters']({'id':_0x455cc6[_0x713c('0xab')],'field':{'countcongestionretry':_0x455cc6[_0x713c('0xdc')]}})[_0x713c('0x80')](function(){_0x13b004['swapAdditionalPhones'](_0x455cc6,_0x1da596,_0x120ab7)['then'](function(){});});}});break;case _0x713c('0xde'):_0x2efdaf[_0x713c('0x42')]+=0x1;_0x455cc6[_0x713c('0xdf')]+=0x1;_0x455cc6['countglobal']=ut[_0x713c('0x97')](_0x455cc6);ut[_0x713c('0x8b')](_0x455cc6,0x14,_0x713c('0xe0'));_0x1da596=_0x2efdaf['dialAgentRejectRetryFrequency'];_0x120ab7=_0x2efdaf[_0x713c('0x9e')];ami[_0x713c('0x58')](_0x713c('0xe1'),ut['buildObj'](_0x455cc6,_0x713c('0xe2')));rpcDb[_0x713c('0x89')](_0x455cc6,_0x713c('0xe3'));_0x13b004[_0x713c('0x9c')](_0x455cc6,'20',_0x2efdaf)['then'](function(_0x42080b){_0x12b57b=_0x42080b[_0x713c('0xca')]==0x1;if(!_0x12b57b){if(ut[_0x713c('0x97')](_0x455cc6)>=_0x2efdaf[_0x713c('0x9f')]){_0x4f3aa7=ut['cloneAction'](_0x455cc6,0x14,_0x713c('0xe0'));rpcDb[_0x713c('0x8e')](_0x4f3aa7,_0x713c('0xe4'));}else{if(_0x455cc6[_0x713c('0xdf')]>=_0x2efdaf[_0x713c('0xe5')]){rpcDb[_0x713c('0x8e')](_0x455cc6,_0x713c('0xe4'));}else{rpcDb[_0x713c('0xa3')](ut[_0x713c('0xa4')](_0x455cc6,_0x713c('0xdf'),_0x2efdaf[_0x713c('0xe6')]),_0x455cc6['unlockAgent'],_0x455cc6[_0x713c('0xa7')]);}}}else{_0x455cc6[_0x713c('0xcf')]++;_0x13b004[_0x713c('0xac')]({'id':_0x455cc6[_0x713c('0xab')],'field':{'countnoanswerretry':_0x455cc6[_0x713c('0xcf')]}})['then'](function(){_0x13b004[_0x713c('0xad')](_0x455cc6,_0x1da596,_0x120ab7)[_0x713c('0x80')](function(){});});}});break;case'ABANDONED':_0x2efdaf[_0x713c('0x43')]+=0x1;_0x455cc6[_0x713c('0xe7')]+=0x1;_0x455cc6[_0x713c('0xbc')]=ut[_0x713c('0x97')](_0x455cc6);ut['logCustomer'](_0x455cc6,0xb,'Abandoned');rpcDb[_0x713c('0x89')](_0x455cc6,_0x713c('0xe8'));if(ut['totalGlobal'](_0x455cc6)>=_0x2efdaf[_0x713c('0x9f')]){_0x4f3aa7=ut[_0x713c('0xa0')](_0x455cc6,0xf,'Global');rpcDb[_0x713c('0x8e')](_0x4f3aa7,_0x713c('0xe8'));}else{if(_0x455cc6[_0x713c('0xe9')]>=_0x2efdaf['dialAbandonedMaxRety']){rpcDb[_0x713c('0x8e')](_0x455cc6,_0x713c('0xe8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x455cc6,_0x713c('0xe7'),_0x2efdaf[_0x713c('0xea')]),_0x455cc6['unlockAgent'],_0x455cc6[_0x713c('0xa7')]);}}break;case'18':_0x2efdaf[_0x713c('0xeb')]+=0x1;_0x455cc6[_0x713c('0xec')]+=0x1;_0x455cc6[_0x713c('0xbc')]=ut[_0x713c('0x97')](_0x455cc6);ut['logCustomer'](_0x455cc6,0x12,_0x17d2b3[_0x713c('0xed')]||_0x17d2b3['dialstatus']);ami[_0x713c('0x58')](_0x713c('0xee'),ut[_0x713c('0x99')](_0x455cc6,_0x713c('0xef')));rpcDb[_0x713c('0x89')](_0x455cc6,_0x713c('0xf0'));if(ut[_0x713c('0x97')](_0x455cc6)>=_0x2efdaf[_0x713c('0x9f')]){_0x4f3aa7=ut[_0x713c('0xa0')](_0x455cc6,0xf,_0x713c('0xa1'));rpcDb[_0x713c('0x8e')](_0x4f3aa7,_0x713c('0xf0'));}else{rpcDb[_0x713c('0x8e')](_0x455cc6,_0x713c('0xf0'));}delete this['actions'][_0x17d2b3[_0x713c('0xa8')]];break;case'19':_0x2efdaf[_0x713c('0xeb')]+=0x1;_0x455cc6[_0x713c('0xbc')]=ut[_0x713c('0x97')](_0x455cc6);ut[_0x713c('0x8b')](_0x455cc6,0x13,_0x17d2b3[_0x713c('0xed')]||_0x17d2b3['dialstatus']);ami['emit']('custom:amd',ut['buildObj'](_0x455cc6,_0x713c('0xef')));rpcDb[_0x713c('0x89')](_0x455cc6,_0x713c('0xf1'));if(ut[_0x713c('0x97')](_0x455cc6)>=_0x2efdaf[_0x713c('0x9f')]){_0x4f3aa7=ut['cloneAction'](_0x455cc6,0xf,_0x713c('0xa1'));rpcDb[_0x713c('0x8e')](_0x4f3aa7,_0x713c('0xf1'));}else{rpcDb[_0x713c('0x8e')](_0x455cc6,_0x713c('0xf1'));}delete this[_0x713c('0x15')][_0x17d2b3[_0x713c('0xa8')]];break;default:if(_0x455cc6[_0x713c('0xf2')]){ut[_0x713c('0x74')](_0x2efdaf,_0x713c('0xf3'));ut[_0x713c('0x75')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2efdaf['name'],_0x17d2b3);}_0x2efdaf[_0x713c('0xeb')]+=0x1;_0x455cc6[_0x713c('0xbc')]=ut[_0x713c('0x97')](_0x455cc6);ut[_0x713c('0x8b')](_0x455cc6,0xc,_0x17d2b3['cause-txt']||_0x17d2b3[_0x713c('0xf4')]);_0x1da596=_0x2efdaf['dialAgentRejectRetryFrequency'];_0x120ab7=_0x2efdaf['callAdditionalPhoneAfterMin'];rpcDb[_0x713c('0x89')](_0x455cc6,'[callProgressDetectingCustomer][logUnknown]');_0x13b004[_0x713c('0x9c')](_0x455cc6,'20',_0x2efdaf)[_0x713c('0x80')](function(_0x38621f){_0x12b57b=_0x38621f['additional']==0x1;if(!_0x12b57b){if(ut['totalGlobal'](_0x455cc6)>=_0x2efdaf[_0x713c('0x9f')]){_0x4f3aa7=ut[_0x713c('0xa0')](_0x455cc6,0xf,_0x713c('0xa1'));rpcDb[_0x713c('0x8e')](_0x4f3aa7,_0x713c('0xf5'));}else{rpcDb[_0x713c('0x8e')](_0x455cc6,_0x713c('0xf5'));}delete this[_0x713c('0x15')][_0x17d2b3[_0x713c('0xa8')]];}else{_0x13b004[_0x713c('0xad')](_0x455cc6,_0x1da596,_0x120ab7)[_0x713c('0x80')](function(_0x463232){});}});}if(!(_0x455cc6[_0x713c('0xf2')]&&_0xf99e1b==='16')){ut[_0x713c('0x72')](_0x2efdaf,_0x713c('0xf6'));logger[_0x713c('0xa9')](_0x713c('0xf7'),_0x455cc6[_0x713c('0xc3')],_0x713c('0xb2'),_0x2efdaf[_0x713c('0x28')],'originated:\x20',_0x2efdaf[_0x713c('0x4a')]);}if(_0xf99e1b!=='ANSWER'){delete this[_0x713c('0x15')][_0x17d2b3[_0x713c('0xa8')]];delete this[_0x713c('0x15')][_0x17d2b3[_0x713c('0xf8')]];}}};Preview['prototype'][_0x713c('0xf9')]=function(_0x5f0cd9,_0x51482c,_0x45f76e){if(_[_0x713c('0xfa')](_0x51482c)&&_0x713c('0xfb')!==typeof _0x51482c){return;}if(_[_0x713c('0xfa')](_0x45f76e)&&'object'!==typeof _0x45f76e){return;}switch(_0x45f76e['reason']){case'0':ut[_0x713c('0xfc')](_0x5f0cd9,0x0,_0x713c('0xfd'));rpcDb[_0x713c('0xfe')](_0x5f0cd9,_0x713c('0xff'));break;case'3':ut['logAgent'](_0x5f0cd9,0x3,_0x713c('0xd0'));rpcDb[_0x713c('0xfe')](_0x5f0cd9,_0x713c('0x100'));break;case'5':ut[_0x713c('0xfc')](_0x5f0cd9,0x5,_0x713c('0xc6'));rpcDb['createAgentHistory'](_0x5f0cd9,_0x713c('0x101'));break;case'8':ut['logAgent'](_0x5f0cd9,0x8,_0x713c('0x102'));rpcDb[_0x713c('0xfe')](_0x5f0cd9,_0x713c('0x103'));break;case'22':ut[_0x713c('0xfc')](_0x5f0cd9,0x16,'AnswerAGI');rpcDb[_0x713c('0xfe')](_0x5f0cd9,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x713c('0xfc')](_0x5f0cd9,0xc,_0x45f76e[_0x713c('0x104')]);rpcDb['createAgentHistory'](_0x5f0cd9,_0x713c('0x103'));}ut[_0x713c('0x72')](_0x51482c,_0x713c('0x105'));logger[_0x713c('0xa9')](_0x713c('0x106'),_0x5f0cd9['uniqueid'],_0x713c('0xb2'),_0x51482c[_0x713c('0x28')],_0x713c('0x6b'),_0x51482c[_0x713c('0x4a')]);delete this[_0x713c('0x15')][_0x5f0cd9[_0x713c('0xc3')]];};Preview[_0x713c('0xf')][_0x713c('0x9c')]=function(_0x1f83ab,_0x466cbc,_0x4cdfd1){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0x713c('0x9c')](_0x1f83ab,_0x466cbc,_0x4cdfd1))['catch'](logger['info'](_0x713c('0x107')));};Preview[_0x713c('0xf')][_0x713c('0xad')]=function(_0x3fd081,_0x1e2da2,_0x488690){return BPromise[_0x713c('0x108')]()[_0x713c('0x80')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x3fd081,_0x1e2da2,_0x488690))[_0x713c('0x83')](logger[_0x713c('0xa9')]('[swapAdditionalPhone]\x20'));};Preview[_0x713c('0xf')][_0x713c('0xac')]=function(_0x17d4f6){return BPromise[_0x713c('0x108')]()[_0x713c('0x80')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x17d4f6))[_0x713c('0x83')](logger['info'](_0x713c('0x109')));};Preview[_0x713c('0xf')][_0x713c('0x10a')]=function(_0x2a6cda,_0x4f8a34,_0x25d833,_0x327f8,_0x37f3f4){var _0x3f1606=this;return new BPromise(function(_0x3fce34,_0x70a6b5){if(_[_0x713c('0x68')](_0x4f8a34)||_['isNil'](_0x4f8a34[_0x713c('0x10b')])||_['isNil'](_0x4f8a34['phone'])||_[_0x713c('0x68')](_0x4f8a34[_0x713c('0x6d')])){_0x70a6b5(ut[_0x713c('0x49')](_0x713c('0x10c'),_0x327f8,_0x37f3f4));return;}var _0xd19c12=uuid['v4']();var _0x546d1a=_0x3f1606['campaignsPreview'][_0x4f8a34[_0x713c('0x10d')]['name']];var _0x37c647=_0x25d833?_0x3f1606['agents'][_0x25d833]['id']:undefined;_0x3f1606['actions'][_0xd19c12]=new Action(_0x4f8a34,_0x546d1a,_0xd19c12,_0x25d833,_0x37c647);var _0x434463=_0x3f1606['actions'][_0xd19c12];_0x434463[_0x713c('0xa6')]=_0x327f8;_0x434463[_0x713c('0xa7')]=_0x37f3f4;_0x434463[_0x713c('0x10e')]=_0x25d833;if(_['isEmpty'](_0x2a6cda)){_0x3f1606[_0x713c('0x10f')](_0x434463,_0x546d1a,_0x4f8a34,_0x25d833)[_0x713c('0x80')](function(_0x2cbc87){logger[_0x713c('0xa9')](_0x713c('0x110'),_0x713c('0x111')+_0x434463['queue']+_0x713c('0x112')+_0x434463[_0x713c('0xab')],JSON[_0x713c('0x53')](_0x2cbc87));ami['emit']('custom:agentcalled',ut[_0x713c('0x99')](_0x434463,_0x713c('0x113'),_0x3f1606[_0x713c('0x12')][_0x434463['queue']]));_0x3fce34(ut[_0x713c('0x49')](_0x713c('0x114')));})[_0x713c('0x83')](function(_0x11b7d8){ut[_0x713c('0x5f')](_0x713c('0x115'),_0x11b7d8);_0x70a6b5(ut[_0x713c('0x49')]('Call\x20failed',_0x327f8,_0x37f3f4));});}else{_0x546d1a[_0x713c('0x39')]+=0x1;ut[_0x713c('0x116')](_0x434463);rpcDb[_0x713c('0x117')](_0x434463,_0x713c('0x118'));delete _0x3f1606[_0x713c('0x15')][_0xd19c12];_0x70a6b5(ut[_0x713c('0x49')](_0x713c('0x119'),_0x327f8,_0x37f3f4));}});};Preview[_0x713c('0xf')][_0x713c('0x93')]=function(_0x1d638d){return!_['isNil'](_0x1d638d)&&!_[_0x713c('0x68')](_0x1d638d[_0x713c('0x28')])&&!_[_0x713c('0x68')](_0x1d638d[_0x713c('0x50')])&&_0x1d638d[_0x713c('0x50')]&&!_['isNil'](this['trunks'][util[_0x713c('0x54')](_0x713c('0x11a'),_0x1d638d['name'])])&&!_[_0x713c('0x68')](this[_0x713c('0x14')][util['format'](_0x713c('0x11a'),_0x1d638d['name'])][_0x713c('0x6f')])&&(this[_0x713c('0x14')][util[_0x713c('0x54')](_0x713c('0x11a'),_0x1d638d[_0x713c('0x28')])]['status']===_0x713c('0x11b')||this[_0x713c('0x14')][util[_0x713c('0x54')](_0x713c('0x11a'),_0x1d638d[_0x713c('0x28')])][_0x713c('0x6f')]===_0x713c('0x11c'));};Preview[_0x713c('0xf')][_0x713c('0x7f')]=function(_0x38a778,_0x2b2407){var _0x41c01a=this;return new BPromise(function(_0x2f46ff,_0x4c7878){_0x41c01a[_0x713c('0x11d')](_0x38a778,_0x2b2407)[_0x713c('0x80')](function(_0x3ea76c){_0x2f46ff(_[_0x713c('0x11e')](_0x3ea76c,[_0x713c('0x49')]));})[_0x713c('0x83')](function(_0x492911){if(_0x492911['unlock']){rpcDb['unlockContact'](_0x38a778);}if(_0x492911[_0x713c('0x50')]){rpcDb['disableContact'](_0x38a778);}_0x4c7878(_[_0x713c('0x11e')](_0x492911,[_0x713c('0x49')]));});});};Preview[_0x713c('0xf')][_0x713c('0x11d')]=function(_0x59d182,_0x39cf6e){var _0x4262c3=this;return new BPromise(function(_0x12b342,_0x261d5e){var _0x2ae0c5,_0x5602fa;rpcDb[_0x713c('0x11f')](_0x59d182)[_0x713c('0x80')](function(_0x428c4c){if(!_[_0x713c('0x68')](_0x428c4c[0x0])){_0x5602fa=_0x428c4c[0x0][_0x713c('0x120')]?![]:!![];_0x2ae0c5=_0x428c4c[0x0][_0x713c('0x120')]?!![]:![];_0x2ae0c5=_0x39cf6e?!![]:_0x2ae0c5;}var _0x4db9b0=_0x4262c3[_0x713c('0x121')](_0x428c4c);if(_0x4db9b0[_0x713c('0x122')]){rpcDb[_0x713c('0x123')](_[_0x713c('0x11e')](_0x428c4c[0x0],['VoiceQueueId','phone']))[_0x713c('0x80')](function(_0x4ad037){_0x4262c3[_0x713c('0x10a')](_0x4ad037,_0x428c4c[0x0],_0x39cf6e,_0x5602fa,_0x2ae0c5)[_0x713c('0x80')](function(_0x2cbabd){_0x12b342(_0x2cbabd);})[_0x713c('0x83')](function(_0x2be1b0){_0x261d5e(_0x2be1b0);});})[_0x713c('0x83')](function(_0x15180b){ut[_0x713c('0x5f')](_0x713c('0x124'),_0x15180b);_0x261d5e(ut[_0x713c('0x49')](_0x713c('0x125'),_0x5602fa,_0x2ae0c5));});}else{_0x261d5e(ut[_0x713c('0x49')](_0x4db9b0[_0x713c('0x49')],_0x5602fa,_0x2ae0c5));}})['catch'](function(_0x391270){ut[_0x713c('0x5f')](_0x713c('0x126'),_0x391270);_0x261d5e(ut[_0x713c('0x49')]('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0x713c('0x121')]=function(_0xe54715){if(_[_0x713c('0x68')](_0xe54715)||_[_0x713c('0x127')](_0xe54715)||!_[_0x713c('0x68')](_0xe54715[0x0][_0x713c('0x7d')])&&_[_0x713c('0x68')](_0xe54715[0x0][_0x713c('0x7d')][_0x713c('0x28')])){ut[_0x713c('0x5f')](_0x713c('0x128'),_0xe54715);return{'isValid':![],'message':_0x713c('0x129')};}var _0x4bee78=this[_0x713c('0x12')][_0xe54715[0x0]['Queue'][_0x713c('0x28')]];_0x4bee78[_0x713c('0x49')]=_0x713c('0x95');if(_['isNil'](_0x4bee78)){ut[_0x713c('0x5f')](_0x713c('0x12a'),_0x4bee78);return{'isValid':![],'message':_0x713c('0x12b')};}if(!this[_0x713c('0x93')](_0x4bee78['Trunk'])){ut[_0x713c('0x5f')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x713c('0x12c')+_0x4bee78['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x713c('0x93')](_0x4bee78[_0x713c('0x94')])){ut[_0x713c('0x5f')](_0x713c('0x12d'),_0x4bee78['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x713c('0x12e')};}}if(!ut['isActive'](_0x4bee78[_0x713c('0x33')])){ut['logger'](_0x713c('0x12f'),_0x4bee78[_0x713c('0x28')]+_0x713c('0x130'));return{'isValid':![],'message':_0x713c('0x12c')+_0x4bee78[_0x713c('0x28')]+_0x713c('0x130')};}return{'isValid':!![],'message':_0x713c('0x131')};};Preview[_0x713c('0xf')]['execCall']=function(_0x4eb38d,_0xedb91b,_0x5593da,_0x2fffc7){var _0x1d58ab=this;return new BPromise(function(_0xa37bf7,_0x4c97df){var _0x3c8fba=_0x4eb38d[_0x713c('0xc3')];var _0x6d9be9=_0x1d58ab[_0x713c('0x93')](_0xedb91b[_0x713c('0x4f')])?util[_0x713c('0x54')](_0x713c('0x132'),_0xedb91b[_0x713c('0x4f')][_0x713c('0x28')],_['isNil'](_0xedb91b['dialPrefix'])?'':_0xedb91b[_0x713c('0x36')][_0x713c('0x133')]()||'',_0xedb91b[_0x713c('0x134')]>0x0?_0x5593da[_0x713c('0x135')][_0x713c('0x136')](_0xedb91b[_0x713c('0x134')]):_0x5593da[_0x713c('0x135')]):util['format']('SIP/%s/%s%s',_[_0x713c('0x68')](_0xedb91b[_0x713c('0x94')])?_0xedb91b[_0x713c('0x4f')]['name']:_0xedb91b[_0x713c('0x94')][_0x713c('0x28')],_[_0x713c('0x68')](_0xedb91b[_0x713c('0x36')])?'':_0xedb91b[_0x713c('0x36')][_0x713c('0x133')]()||'',_0xedb91b[_0x713c('0x134')]>0x0?_0x5593da[_0x713c('0x135')][_0x713c('0x136')](_0xedb91b[_0x713c('0x134')]):_0x5593da[_0x713c('0x135')]);var _0x418b41=_0x1d58ab[_0x713c('0x93')](_0xedb91b[_0x713c('0x4f')])?ut['getCallerId'](_0xedb91b['Trunk'][_0x713c('0x51')],_0xedb91b[_0x713c('0x137')],_0xedb91b[_0x713c('0x138')]>0x0?ut[_0x713c('0x139')](_0xedb91b[_0x713c('0x35')],_0xedb91b[_0x713c('0x138')]):_0xedb91b[_0x713c('0x35')]):ut[_0x713c('0x13a')](_[_0x713c('0x68')](_0xedb91b[_0x713c('0x94')])?_0xedb91b[_0x713c('0x4f')][_0x713c('0x51')]:_0xedb91b[_0x713c('0x94')][_0x713c('0x51')],_0xedb91b['dialOriginateCallerIdName'],_0xedb91b['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0xedb91b[_0x713c('0x35')],_0xedb91b[_0x713c('0x138')]):_0xedb91b[_0x713c('0x35')]);if(_0x418b41){_0x4eb38d['originatecalleridname']=ut[_0x713c('0x13b')](_0x418b41);_0x4eb38d[_0x713c('0x13c')]=ut['extractCalleridNumber'](_0x418b41);}var _0x4e7910=ut[_0x713c('0x13d')](_0xedb91b,_0x5593da,_0x6d9be9,_0x418b41,_0x3c8fba,_0x4eb38d);_[_0x713c('0x13e')](_0x4eb38d,ut['toLowerVariables'](_0x4e7910));_0x4eb38d[_0x713c('0x85')]=moment()[_0x713c('0x54')](_0x713c('0x86'));ami[_0x713c('0x13f')](ut['variablesAction'](_0x4eb38d,_0xedb91b,_0x4e7910,_0x4eb38d[_0x713c('0xa7')],_0x2fffc7))[_0x713c('0x80')](function(_0x310002){_0xedb91b[_0x713c('0x4a')]+=0x1;logger['info']('[originated][increment]',_0x3c8fba,_0x713c('0xb2'),_0xedb91b[_0x713c('0x28')],'originated:\x20',_0xedb91b[_0x713c('0x4a')]);_0xa37bf7(_0x310002);})[_0x713c('0x83')](function(_0x24f5d0){ut[_0x713c('0xfc')](_0x4eb38d,0xe,_0x713c('0x140'));rpcDb['createAgentHistory'](_0x4eb38d,_0x713c('0x141'));_0x4c97df(_0x24f5d0);});});};Preview[_0x713c('0xf')][_0x713c('0x21')]=function(_0x602a30){if(this[_0x713c('0x15')][_0x602a30[_0x713c('0xa8')]]){this[_0x713c('0x15')][_0x602a30[_0x713c('0xa8')]][_0x713c('0x70')]=_0x602a30[_0x713c('0x70')];}};Preview[_0x713c('0xf')][_0x713c('0x18')]=function(_0x216397){var _0xd3f72c=this;var _0x1b9f4d=this['actions'][_0x216397[_0x713c('0x142')]];if(_0x1b9f4d){if(_0x1b9f4d[_0x713c('0x10e')]&&this['agents'][_0x1b9f4d['lookAgent']]){ut[_0x713c('0x143')](_0x1b9f4d,this[_0x713c('0x16')][_0x1b9f4d[_0x713c('0x10e')]]['name'],this['agents'][_0x1b9f4d[_0x713c('0x10e')]]['id']);}var _0x2751ab=_['clone'](_0x1b9f4d);_0x2751ab[_0x713c('0xaf')]=moment()[_0x713c('0x54')]('YYYY-MM-DD\x20HH:mm:ss');var _0x491507=_0xd3f72c[_0x713c('0x12')][_0x1b9f4d[_0x713c('0x6a')]];if(ut[_0x713c('0x144')](_0x216397['response'])){if(_0x1b9f4d[_0x713c('0xa6')]){rpcDb[_0x713c('0x145')](_0x1b9f4d[_0x713c('0xab')]);}if(_0x1b9f4d['activeContact']){rpcDb[_0x713c('0x84')](_0x1b9f4d['idContact']);}ami[_0x713c('0x58')](_0x713c('0x146'),ut[_0x713c('0x99')](_0x1b9f4d,_0x713c('0x147'),this[_0x713c('0x12')][_0x1b9f4d[_0x713c('0x6a')]]));this['callProgressDetectingAgent'](_0x2751ab,_0x491507,_0x216397);}else{_0x1b9f4d['starttime']=moment()['format'](_0x713c('0x86'));ut['logAgent'](_0x2751ab,0x4,_0x713c('0xbd'));rpcDb[_0x713c('0xfe')](_0x2751ab,_0x713c('0x148'));}}};Preview['prototype'][_0x713c('0x1b')]=function(_0x392a40){var _0x1292ca=this;var _0xccf850=this[_0x713c('0x15')][_0x392a40[_0x713c('0xa8')]];var _0x2f499b;if(_0xccf850){_0x2f499b=this[_0x713c('0x12')][_0xccf850[_0x713c('0x6a')]];logger[_0x713c('0xa9')](_0x713c('0x149'),_0x392a40[_0x713c('0xa8')],_0x713c('0xb2'),_0x2f499b['name'],_0x713c('0x6c'),_0x2f499b[_0x713c('0x2d')]);}if(this[_0x713c('0x15')][_0x392a40['linkedid']]&&_0x392a40[_0x713c('0xa8')]!==_0x392a40[_0x713c('0xc3')]){if(_0x392a40[_0x713c('0x14a')]==='16'&&this['actions'][_0x392a40[_0x713c('0xa8')]][_0x713c('0xf2')]){this[_0x713c('0x96')](_0x392a40,_0x392a40[_0x713c('0xa8')],_0x392a40[_0x713c('0x14a')]);}else if(this[_0x713c('0x15')][_0x392a40[_0x713c('0xa8')]][_0x713c('0xf2')]){logger[_0x713c('0xa9')](_0x713c('0x14b'),_0x392a40[_0x713c('0xa8')],_0x392a40[_0x713c('0x14a')],_0x713c('0xb2'),_0x2f499b[_0x713c('0x28')],'pTalking:\x20',_0x2f499b[_0x713c('0x2d')]);this[_0x713c('0x96')](_0x392a40,_0x392a40[_0x713c('0xa8')],_0x392a40[_0x713c('0x14a')]);}}else if(_0xccf850&&_[_0x713c('0x68')](_0xccf850['statedesc'])&&_0x2f499b[_0x713c('0x14c')]&&_0x392a40['linkedid']===_0x392a40['uniqueid']&&_[_0x713c('0x68')](_0x392a40[_0x713c('0x104')])&&_0x392a40['cause']==='16'&&_0x392a40[_0x713c('0x14d')]==='6'&&_[_0x713c('0xfa')](_0xccf850['transfer'])){if(_0xccf850['unlockAgent']){rpcDb['unlockContact'](_0xccf850[_0x713c('0xab')]);}if(_0xccf850[_0x713c('0xa7')]){rpcDb[_0x713c('0x84')](_0xccf850[_0x713c('0xab')]);}_0x392a40[_0x713c('0x104')]='22';this['callProgressDetectingAgent'](_0xccf850,_0x2f499b,_0x392a40);}else if(_0xccf850&&_0xccf850['transfer']){if(_0x392a40[_0x713c('0x14a')]==='16'&&this['actions'][_0x392a40[_0x713c('0xa8')]][_0x713c('0xf2')]){logger[_0x713c('0xa9')](_0x713c('0x14e'),_0x392a40['linkedid'],_0x392a40[_0x713c('0x14a')],_0x713c('0xb2'),_0x2f499b[_0x713c('0x28')],_0x713c('0x6c'),_0x2f499b[_0x713c('0x2d')]);this[_0x713c('0x96')](_0x392a40,_0x392a40[_0x713c('0xa8')],_0x392a40[_0x713c('0x14a')]);}else if(this[_0x713c('0x15')][_0x392a40[_0x713c('0xa8')]][_0x713c('0xf2')]){logger[_0x713c('0xa9')](_0x713c('0x14b'),_0x392a40[_0x713c('0xa8')],_0x392a40[_0x713c('0x14a')],'\x20Queue',_0x2f499b[_0x713c('0x28')],_0x713c('0x6c'),_0x2f499b[_0x713c('0x2d')]);this['callProgressDetectingCustomer'](_0x392a40,_0x392a40[_0x713c('0xa8')],_0x392a40['cause']);}}};Preview['prototype'][_0x713c('0x1f')]=function(_0x1e2440){if(this[_0x713c('0x15')][_0x1e2440['destlinkedid']]&&_0x1e2440[_0x713c('0xf8')]!==_0x1e2440[_0x713c('0x14f')]){this['callProgressDetectingCustomer'](_0x1e2440,_0x1e2440[_0x713c('0xf8')],_0x1e2440[_0x713c('0xf4')]);}};Preview[_0x713c('0xf')][_0x713c('0x1d')]=function(_0x51998c){if(this[_0x713c('0x15')][_0x51998c[_0x713c('0xa8')]]&&_0x51998c['linkedid']!==_0x51998c[_0x713c('0xc3')]&&!this[_0x713c('0x15')][_0x51998c[_0x713c('0xa8')]]['dialAnswer']){if(_0x51998c[_0x713c('0x14a')]==='1'){this[_0x713c('0x96')](_0x51998c,_0x51998c[_0x713c('0xa8')],_0x51998c[_0x713c('0x14a')]);}}};Preview[_0x713c('0xf')]['addVariable']=function(_0x5ffdc2,_0x10a1fd,_0x29d4db){if(this[_0x713c('0x15')][_0x5ffdc2]){if(_[_0x713c('0x68')](this[_0x713c('0x15')][_0x5ffdc2][_0x713c('0x150')])){this[_0x713c('0x15')][_0x5ffdc2][_0x713c('0x150')]={};}this[_0x713c('0x15')][_0x5ffdc2]['variables'][_0x10a1fd]=_0x29d4db;}};Preview[_0x713c('0xf')][_0x713c('0x23')]=function(_0x1d59cf){try{if(!_[_0x713c('0x68')](_0x1d59cf)){if(ut['filterKey'](_[_0x713c('0x151')](_0x1d59cf[_0x713c('0x152')])[0x0])){this[_0x713c('0x153')](_0x1d59cf['uniqueid'],_[_0x713c('0x151')](_0x1d59cf[_0x713c('0x152')])[0x0],_0x1d59cf[_0x713c('0x154')]);}}}catch(_0x575382){logger[_0x713c('0x155')]('[syncVarSet][Preview]',util['inspect'](_0x575382,{'showHidden':![],'depth':null}));}};Preview[_0x713c('0xf')][_0x713c('0x25')]=function(_0x53f048){if(_0x53f048){if(this[_0x713c('0x15')][_0x53f048[_0x713c('0x156')]]){this[_0x713c('0x15')][_0x53f048[_0x713c('0x156')]][_0x713c('0x157')]=!![];}}};Preview[_0x713c('0xf')][_0x713c('0x26')]=function(_0x399ca5){if(_0x399ca5){if(this['actions'][_0x399ca5[_0x713c('0x158')]]){this[_0x713c('0x15')][_0x399ca5['transfererlinkedid']][_0x713c('0x157')]=!![];}}};module[_0x713c('0x159')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3b35709..5274739 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 _0x5075=['exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','then','[createHistory]\x20','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip'];(function(_0x57a268,_0x12d2fe){var _0x398b94=function(_0x396f44){while(--_0x396f44){_0x57a268['push'](_0x57a268['shift']());}};_0x398b94(++_0x12d2fe);}(_0x5075,0x73));var _0x5507=function(_0x1233d2,_0x5416f4){_0x1233d2=_0x1233d2-0x0;var _0x22759e=_0x5075[_0x1233d2];return _0x22759e;};'use strict';var util=require(_0x5507('0x0'));var BPromise=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var _=require(_0x5507('0x4'));var cmHopper=require(_0x5507('0x5'));var cmHopperFinal=require(_0x5507('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x5507('0x7'));var voiceQueueRt=require(_0x5507('0x8'));var agentReportPreview=require(_0x5507('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5b6d7f){return function(_0x2cd9ee){logger[_0x5507('0xa')](_0x5b6d7f,util['inspect'](_0x2cd9ee,{'showHidden':![],'depth':null}));};}function create(_0x42c232){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopperHistory['createHistory'](_0x42c232))['catch'](loggerCatch(_0x5507('0xd')));}function createAgent(_0x441bdc){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](agentReportPreview['createHistory'](_0x441bdc))[_0x5507('0xe')](loggerCatch(_0x5507('0xd')));}function moveContact(_0x55520e){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper['moveContactManagedDialer'](_0x55520e,!![]))[_0x5507('0xe')](loggerCatch(_0x5507('0xf')));}exports[_0x5507('0x10')]=function(_0x267f27){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopperBlack['checkIsBlackList'](_0x267f27))[_0x5507('0xe')](loggerCatch(_0x5507('0x11')));};exports[_0x5507('0x12')]=function(_0x46545d){return BPromise['resolve']()[_0x5507('0xc')](cmHopper[_0x5507('0x12')](_0x46545d))[_0x5507('0xe')](loggerCatch(_0x5507('0x13')));};exports[_0x5507('0x14')]=function(_0x2ede34,_0x241932){create(_0x2ede34)[_0x5507('0xe')](loggerCatch(_0x241932));moveContact(_0x2ede34)[_0x5507('0xe')](loggerCatch(_0x241932));};exports[_0x5507('0x15')]=function(_0x233b6a,_0x2260f7){createAgent(_0x233b6a)[_0x5507('0xe')](loggerCatch(_0x2260f7));};exports['createCustomerHistory']=function(_0x14dab0,_0x276a81){create(_0x14dab0)[_0x5507('0xe')](loggerCatch(_0x276a81));};exports[_0x5507('0x16')]=function(_0x54f473,_0x1dc53e){moveContact(_0x54f473)[_0x5507('0xe')](loggerCatch(_0x1dc53e));};exports[_0x5507('0x17')]=function(_0x3ca1f7,_0x68397c,_0x1be8b1){if(_0x68397c){_0x3ca1f7['UserId']=null;}if(_0x1be8b1){_0x3ca1f7[_0x5507('0x18')]=![];}return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x17')](_0x3ca1f7))[_0x5507('0xe')](loggerCatch(_0x5507('0x19')));};exports[_0x5507('0x1a')]=function(_0x10f149){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x1a')](_0x10f149))[_0x5507('0xe')](loggerCatch(_0x5507('0x1b')));};exports[_0x5507('0x1c')]=function(_0x1a2203){return BPromise['resolve']()[_0x5507('0xc')](cmHopper['unlockContact']({'UserId':null},_0x1a2203,0x1))[_0x5507('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x5507('0x1d')]=function(_0x24668b){return BPromise['resolve']()['then'](cmHopper[_0x5507('0x1c')]({'active':![]},_0x24668b,0x1))[_0x5507('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x5507('0x1e')]=function(_0x24574b){var _0x85d383={};_0x85d383[_0x5507('0x1f')]=_0x24574b[_0x5507('0x1f')];_0x85d383[_0x5507('0x20')]=_0x24574b['uniqueid'];_0x85d383[_0x5507('0x21')]=_0x24574b[_0x5507('0x21')];_0x85d383[_0x5507('0x22')]=_0x24574b[_0x5507('0x22')];_0x85d383[_0x5507('0x23')]=_0x24574b['queue'];_0x85d383['queuecallerjoinAt']=_0x24574b[_0x5507('0x24')];_0x85d383[_0x5507('0x25')]=_0x24574b[_0x5507('0x24')];_0x85d383[_0x5507('0x26')]=0x1;_0x85d383['queuecallercompleteAt']=_0x24574b[_0x5507('0x27')];_0x85d383[_0x5507('0x28')]=_0x24574b[_0x5507('0x29')];_0x85d383[_0x5507('0x2a')]=_0x5507('0x2b');_0x85d383[_0x5507('0x2c')]=_0x5507('0x2d');_0x85d383[_0x5507('0x2e')]=0x0;_0x85d383['assigned']=0x1;_0x85d383[_0x5507('0x2f')]=_0x24574b[_0x5507('0x29')];_0x85d383[_0x5507('0x30')]='COMPLETED';return BPromise['resolve']()[_0x5507('0xc')](voiceQueueReport[_0x5507('0x31')](_0x85d383))[_0x5507('0xe')](loggerCatch(_0x5507('0x32')));};exports[_0x5507('0x33')]=function(_0x574fc6,_0x5cc72c){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x33')](_0x574fc6,_0x5cc72c))[_0x5507('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x23ea7c){return BPromise['resolve']()[_0x5507('0xc')](cmHopper[_0x5507('0x17')](_0x23ea7c,!![],!![]))[_0x5507('0xe')](loggerCatch(_0x5507('0x34')));}; \ No newline at end of file +var _0xc7a3=['endtime','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x2e8180,_0x2eae3a){var _0x53894d=function(_0x3650c7){while(--_0x3650c7){_0x2e8180['push'](_0x2e8180['shift']());}};_0x53894d(++_0x2eae3a);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x2cec32,_0x3d8434){_0x2cec32=_0x2cec32-0x0;var _0x2f50fd=_0xc7a3[_0x2cec32];return _0x2f50fd;};'use strict';var util=require('util');var BPromise=require(_0x3c7a('0x0'));var logger=require(_0x3c7a('0x1'))(_0x3c7a('0x2'));var _=require(_0x3c7a('0x3'));var cmHopper=require(_0x3c7a('0x4'));var cmHopperFinal=require(_0x3c7a('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x3c7a('0x6'));var voiceQueueRt=require(_0x3c7a('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x3c7a('0x8'));function loggerCatch(_0x2051ce){return function(_0x2736c1){logger['error'](_0x2051ce,util[_0x3c7a('0x9')](_0x2736c1,{'showHidden':![],'depth':null}));};}function create(_0x4f0608){return BPromise[_0x3c7a('0xa')]()['then'](cmHopperHistory[_0x3c7a('0xb')](_0x4f0608))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0xd')));}function createAgent(_0x5902a0){return BPromise[_0x3c7a('0xa')]()[_0x3c7a('0xe')](agentReportPreview['createHistory'](_0x5902a0))[_0x3c7a('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3bc093){return BPromise['resolve']()[_0x3c7a('0xe')](cmHopper[_0x3c7a('0xf')](_0x3bc093,!![]))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x10')));}exports[_0x3c7a('0x11')]=function(_0x53e5d7){return BPromise[_0x3c7a('0xa')]()[_0x3c7a('0xe')](cmHopperBlack[_0x3c7a('0x11')](_0x53e5d7))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x12')));};exports['getContactPreview']=function(_0x3e219a){return BPromise[_0x3c7a('0xa')]()['then'](cmHopper['getContactPreview'](_0x3e219a))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x13')));};exports[_0x3c7a('0xb')]=function(_0x4d7a8c,_0x1bae30){create(_0x4d7a8c)['catch'](loggerCatch(_0x1bae30));moveContact(_0x4d7a8c)[_0x3c7a('0xc')](loggerCatch(_0x1bae30));};exports[_0x3c7a('0x14')]=function(_0x36e8c2,_0xb8d04b){createAgent(_0x36e8c2)[_0x3c7a('0xc')](loggerCatch(_0xb8d04b));};exports[_0x3c7a('0x15')]=function(_0x5975de,_0x1a11ef){create(_0x5975de)[_0x3c7a('0xc')](loggerCatch(_0x1a11ef));};exports[_0x3c7a('0x16')]=function(_0xbe7a8f,_0x3a79e3){moveContact(_0xbe7a8f)[_0x3c7a('0xc')](loggerCatch(_0x3a79e3));};exports[_0x3c7a('0x17')]=function(_0x34f4a6,_0x4751d1,_0x544742){if(_0x4751d1){_0x34f4a6[_0x3c7a('0x18')]=null;}if(_0x544742){_0x34f4a6['active']=![];}return BPromise[_0x3c7a('0xa')]()['then'](cmHopper[_0x3c7a('0x17')](_0x34f4a6))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x19')));};exports[_0x3c7a('0x1a')]=function(_0x283568){return BPromise[_0x3c7a('0xa')]()[_0x3c7a('0xe')](cmHopper[_0x3c7a('0x1a')](_0x283568))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x1b')));};exports[_0x3c7a('0x1c')]=function(_0x317fbd){return BPromise['resolve']()[_0x3c7a('0xe')](cmHopper[_0x3c7a('0x1c')]({'UserId':null},_0x317fbd,0x1))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x1d')));};exports[_0x3c7a('0x1e')]=function(_0x1940bb){return BPromise[_0x3c7a('0xa')]()[_0x3c7a('0xe')](cmHopper['unlockContact']({'active':![]},_0x1940bb,0x1))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x1f')));};exports[_0x3c7a('0x20')]=function(_0x197012){var _0x33065b={};_0x33065b[_0x3c7a('0x21')]=_0x197012[_0x3c7a('0x21')];_0x33065b[_0x3c7a('0x22')]=_0x197012[_0x3c7a('0x22')];_0x33065b[_0x3c7a('0x23')]=_0x197012[_0x3c7a('0x23')];_0x33065b[_0x3c7a('0x24')]=_0x197012[_0x3c7a('0x24')];_0x33065b[_0x3c7a('0x25')]=_0x197012[_0x3c7a('0x25')];_0x33065b[_0x3c7a('0x26')]=_0x197012[_0x3c7a('0x27')];_0x33065b[_0x3c7a('0x28')]=_0x197012[_0x3c7a('0x27')];_0x33065b[_0x3c7a('0x29')]=0x1;_0x33065b[_0x3c7a('0x2a')]=_0x197012[_0x3c7a('0x2b')];_0x33065b['connectedlinename']=_0x197012['membername'];_0x33065b['context']='from-sip';_0x33065b[_0x3c7a('0x2c')]=_0x3c7a('0x2d');_0x33065b[_0x3c7a('0x2e')]=0x0;_0x33065b[_0x3c7a('0x2f')]=0x1;_0x33065b[_0x3c7a('0x30')]=_0x197012[_0x3c7a('0x31')];_0x33065b[_0x3c7a('0x32')]=_0x3c7a('0x33');return BPromise[_0x3c7a('0xa')]()[_0x3c7a('0xe')](voiceQueueReport[_0x3c7a('0x34')](_0x33065b))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x35')));};exports[_0x3c7a('0x36')]=function(_0x589295,_0x2d1668){return BPromise[_0x3c7a('0xa')]()['then'](cmHopper[_0x3c7a('0x36')](_0x589295,_0x2d1668))['catch'](loggerCatch(_0x3c7a('0x37')));};exports[_0x3c7a('0x38')]=function(_0x50a5f3){return BPromise[_0x3c7a('0xa')]()[_0x3c7a('0xe')](cmHopper[_0x3c7a('0x17')](_0x50a5f3,!![],!![]))[_0x3c7a('0xc')](loggerCatch(_0x3c7a('0x39')));}; \ 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 de35359..3372ef3 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 _0x5f49=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','interface','channelAgent','mandatoryDisposition','queue','agentReadyId','not_inuse','reachable','getDiff','milliseconds','createBody','ListId','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agi','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','match','extractCalleridNumber','lodash','moment','../../../../config/logger','env','127.0.0.1','diff','seconds','inspect','logger','loggerError','error','logger2','info','message','getCallerId','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','Queue','name','calleridname','calleridnum','ContactId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','statedesc','ringtime','UserId','logCustomer','answertime','Failure','RECALL','BOOKED','uniqueid','originate','from-sip','totalGlobal','countbusyretry'];(function(_0x152422,_0x153adb){var _0x4254a1=function(_0x50c9b3){while(--_0x50c9b3){_0x152422['push'](_0x152422['shift']());}};_0x4254a1(++_0x153adb);}(_0x5f49,0x13d));var _0x95f4=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x5f49[_0x381589];return _0x2a075d;};'use strict';var util=require('util');var _=require(_0x95f4('0x0'));var moment=require(_0x95f4('0x1'));var logger=require(_0x95f4('0x2'))('preview');var ipAgi=process[_0x95f4('0x3')]['XCALLY_IP_AGI']||_0x95f4('0x4');function getSeconds(_0xdbdbe0,_0xe9a4e8){var _0x37c9a1=moment(_0xdbdbe0)['milliseconds'](0x0);var _0x50c136=moment(_0xe9a4e8)['milliseconds'](0x0);return _0x37c9a1[_0x95f4('0x5')](_0x50c136,_0x95f4('0x6'));}exports['loggerCatch']=function(_0x147243){return function(_0x50fe36){logger['error'](_0x147243,util[_0x95f4('0x7')](_0x50fe36,{'showHidden':![],'depth':null}));};};exports[_0x95f4('0x8')]=function(_0x2ed573,_0x2473e4){logger['info'](_0x2ed573,util[_0x95f4('0x7')](_0x2473e4,{'showHidden':![],'depth':null}));};exports[_0x95f4('0x9')]=function(_0x4db92a,_0x4e630e){logger[_0x95f4('0xa')](_0x4db92a,util[_0x95f4('0x7')](_0x4e630e,{'showHidden':![],'depth':null}));};exports[_0x95f4('0xb')]=function(_0x475d59){return function(_0x3f50cb){logger[_0x95f4('0xc')](_0x475d59,util['inspect'](_0x3f50cb,{'showHidden':![],'depth':null}));};};exports[_0x95f4('0xd')]=function(_0x1f9aa6,_0x5a3e19,_0x23ba7d){return{'message':_0x1f9aa6,'unlock':_0x5a3e19,'active':_0x23ba7d};};exports[_0x95f4('0xe')]=function(_0x25bbf6,_0x328880,_0x5e3c32){if(!_['isUndefined'](_0x5e3c32)&&_0x95f4('0xf')===typeof _0x5e3c32&&!_['isEmpty'](_0x5e3c32)){if(!_[_0x95f4('0x10')](_0x328880)&&_0x95f4('0xf')===typeof _0x328880&&!_[_0x95f4('0x11')](_0x328880)){return util[_0x95f4('0x12')]('\x22%s\x22\x20<%s>',_0x328880,_0x5e3c32);}return util['format'](_0x95f4('0x13'),_0x5e3c32,_0x5e3c32);}if(!_['isUndefined'](_0x25bbf6)&&_0x95f4('0xf')===typeof _0x25bbf6&&!_[_0x95f4('0x11')](_0x25bbf6)){return _0x25bbf6;}return _0x95f4('0x14');};exports['isActive']=function(_0x2961eb){if(_['isNil'](_0x2961eb)){return![];}return _0x2961eb;};exports['addVariables']=function(_0x36af64,_0x293e23,_0x4d4e83,_0x18edc8,_0x2737df,_0x131e0b){var _0x3f40ce={'XMD-QUEUE':_0x293e23['Queue']?_0x293e23[_0x95f4('0x15')][_0x95f4('0x16')]:'','XMD-CALLERID':_0x18edc8,'XMD-CALLERID-PREVIEW':_0x131e0b?util['format']('\x22%s\x22\x20<%s>',_0x131e0b[_0x95f4('0x17')],_0x131e0b[_0x95f4('0x18')]):_0x18edc8,'XMD-DIALID':_0x2737df,'XMD-CONTACTID':_0x293e23[_0x95f4('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x18edc8,'XMD-VOICEQUEUEID':_0x293e23['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4d4e83,'XMD-DIALTIMEOUT':_0x36af64['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x95f4('0x12')]('\x22rtTxX%s%s\x22',_0x36af64[_0x95f4('0x1a')]?'g':'',_[_0x95f4('0x11')](_0x36af64[_0x95f4('0x1b')])?'':_0x95f4('0x1c')),'XMD-DIALURL':_0x36af64[_0x95f4('0x1d')]||'','XMD-AGI':_0x36af64['dialQueueProject']?util[_0x95f4('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x36af64[_0x95f4('0x1e')]):_0x95f4('0x1f'),'XMD-AGIAFTER':_0x36af64['dialQueueProject2']?util[_0x95f4('0x12')](_0x95f4('0x20'),ipAgi,_0x36af64[_0x95f4('0x1a')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x131e0b?_0x131e0b[_0x95f4('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x131e0b?_0x131e0b[_0x95f4('0x22')]:'','XMD-DESTINATION':_0x95f4('0x23')};if(!_[_0x95f4('0x11')](_0x36af64[_0x95f4('0x1b')])){_0x3f40ce[util['format']('%s',_0x95f4('0x24'))]=_0x36af64['monitor_format'];_0x3f40ce[util[_0x95f4('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2737df;}if(_0x293e23&&_0x293e23[_0x95f4('0x25')]){for(var _0x517ce0 in _0x293e23[_0x95f4('0x25')]){if(_0x293e23[_0x95f4('0x25')][_0x95f4('0x26')](_0x517ce0)){if(!_[_0x95f4('0x27')](_0x293e23[_0x95f4('0x25')][_0x517ce0])&&_0x517ce0!=='id'&&_0x517ce0!==_0x95f4('0x28')&&_0x517ce0!==_0x95f4('0x29')&&_0x517ce0!==_0x95f4('0x2a')){_0x3f40ce[util[_0x95f4('0x12')](_0x95f4('0x2b'),'XMD-',_[_0x95f4('0x2c')](_0x517ce0))]=_0x293e23[_0x95f4('0x25')][_0x517ce0];}}}}return _0x3f40ce;};exports[_0x95f4('0x2d')]=function(_0x246df0){var _0x3cc616={};for(var _0x35dca3 in _0x246df0){if(_0x246df0[_0x95f4('0x26')](_0x35dca3)){_0x3cc616[util[_0x95f4('0x12')]('%s',_[_0x95f4('0x2e')](_0x35dca3))]=_0x246df0[_0x35dca3];}}return{'variables':_0x3cc616};};exports[_0x95f4('0x2f')]=function(_0x4709b6,_0x15b789){if(!_[_0x95f4('0x27')](_0x4709b6)){if(_0x4709b6['hasOwnProperty'](_0x95f4('0x30'))){if(_0x4709b6[_0x95f4('0x30')]>0x0){_0x4709b6[_0x95f4('0x30')]-=0x1;}else{logger['error'](_0x95f4('0x31'),_0x15b789);}}}else{logger[_0x95f4('0xa')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x15b789);}};exports[_0x95f4('0x32')]=function(_0x39fcd8){var _0x67e629=moment()[_0x95f4('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x39fcd8[_0x95f4('0x33')]=0xd;_0x39fcd8['statedesc']='Blacklist';_0x39fcd8[_0x95f4('0x34')]=_0x67e629;_0x39fcd8[_0x95f4('0x35')]=_0x67e629;_0x39fcd8[_0x95f4('0x36')]=_0x67e629;};exports[_0x95f4('0x37')]=function(_0x5459b1,_0x25bf31,_0x23e68a){var _0x456e7d=moment()[_0x95f4('0x12')](_0x95f4('0x38'));_0x5459b1['state']=_0x25bf31;_0x5459b1[_0x95f4('0x39')]=_0x23e68a;_0x5459b1['responsetime']=_0x456e7d;_0x5459b1[_0x95f4('0x3a')]=getSeconds(_0x5459b1[_0x95f4('0x35')],_0x5459b1['starttime']);};exports['logLookAgent']=function(_0x5f209c,_0x5bc89e,_0x26bb6c){_0x5f209c['membername']=_0x5bc89e;_0x5f209c[_0x95f4('0x3b')]=_0x26bb6c;};exports[_0x95f4('0x3c')]=function(_0x1c80b0,_0x3a3fc4,_0x5d0295){var _0x25c5fb=moment()[_0x95f4('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c80b0[_0x95f4('0x33')]=_0x3a3fc4;_0x1c80b0[_0x95f4('0x39')]=_0x5d0295;_0x1c80b0[_0x95f4('0x35')]=_0x1c80b0['responsetime']?_0x1c80b0[_0x95f4('0x35')]:_0x25c5fb;_0x1c80b0[_0x95f4('0x36')]=_0x1c80b0[_0x95f4('0x36')]?_0x1c80b0[_0x95f4('0x36')]:_0x25c5fb;_0x1c80b0['ringtime']=getSeconds(_0x1c80b0[_0x95f4('0x35')]||0x0,_0x1c80b0['starttime']||0x0);_0x1c80b0['talktime']=_0x1c80b0[_0x95f4('0x3d')]?getSeconds(_0x1c80b0[_0x95f4('0x36')],_0x1c80b0[_0x95f4('0x3d')]):0x0;};exports['isFailure']=function(_0x461e7f){return _0x461e7f===_0x95f4('0x3e');};exports['variablesAction']=function(_0x70d665,_0x637cef,_0x3572e8,_0x57e0f9,_0x4fc9c8){var _0x5d61c8=_0x57e0f9?_0x95f4('0x3f'):_0x70d665[_0x95f4('0x17')];_0x5d61c8=_0x4fc9c8?_0x95f4('0x40'):_0x5d61c8;return{'actionid':_0x70d665[_0x95f4('0x41')],'action':_0x95f4('0x42'),'channel':_0x70d665['channelAgent'],'callerid':util[_0x95f4('0x12')](_0x95f4('0x13'),_0x5d61c8,_0x70d665[_0x95f4('0x18')]),'Exten':_0x95f4('0x23'),'Context':_0x95f4('0x43'),'Priority':'1','variable':_0x3572e8,'timeout':(_0x637cef['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x70d665[_0x95f4('0x41')]};};exports[_0x95f4('0x44')]=function(_0x10dfb6){return _0x10dfb6[_0x95f4('0x45')]+_0x10dfb6[_0x95f4('0x46')]+_0x10dfb6[_0x95f4('0x47')]+_0x10dfb6['countagentrejectretry']+_0x10dfb6[_0x95f4('0x48')];};exports[_0x95f4('0x49')]=function(_0x4d7a54){var _0x5995c3=_[_0x95f4('0x4a')](_0x4d7a54);_0x5995c3[_0x95f4('0x33')]=0xf;_0x5995c3[_0x95f4('0x39')]=_0x95f4('0x4b');return _0x5995c3;};exports[_0x95f4('0x4c')]=function(_0x4688da,_0x591cff,_0x3f4345){var _0x4494e2={};_0x4494e2[_0x591cff]=_0x4688da[_0x591cff];_0x4494e2[_0x95f4('0x4d')]=![];_0x4494e2[_0x95f4('0x4e')]=moment()[_0x95f4('0x4f')](_0x3f4345,_0x95f4('0x50'))[_0x95f4('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x4494e2[_0x95f4('0x19')]=_0x4688da['ContactId'];_0x4494e2['ListId']=_0x4688da['ListId'];_0x4494e2[_0x95f4('0x51')]=_0x4688da['VoiceQueueId']||undefined;return _0x4494e2;};exports[_0x95f4('0x52')]=function(_0x13dbc0,_0x16cc48){if(!_[_0x95f4('0x27')](_0x13dbc0)){if(_0x13dbc0['pTalking']>0x0){_0x13dbc0[_0x95f4('0x53')]-=0x1;}else{logger[_0x95f4('0xa')](_0x16cc48,_0x95f4('0x54'));}}else{logger[_0x95f4('0xa')](_0x16cc48,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x95f4('0x55')]=function(_0x598e53){if(_0x598e53<=0x0){return!![];}return![];};exports['buildObj']=function(_0x46d887,_0xdbb89f,_0x49baf7){_0x46d887[_0x95f4('0x56')]=_0xdbb89f;_0x46d887['name']=_0x46d887['queue'];_0x46d887[_0x95f4('0x57')]=_0x46d887[_0x95f4('0x58')];if(_0x49baf7){_0x46d887[_0x95f4('0x59')]=_0x49baf7['mandatoryDisposition'];}return _0x46d887;};exports['buildAcw']=function(_0x48a56d){var _0x283f2a={};_0x283f2a[_0x95f4('0x5a')]=_0x48a56d[_0x95f4('0x5a')];_0x283f2a[_0x95f4('0x57')]=_0x48a56d[_0x95f4('0x58')];_0x283f2a[_0x95f4('0x41')]=_0x48a56d[_0x95f4('0x41')];return _0x283f2a;};exports[_0x95f4('0x5b')]=function(_0x29d72a){var _0xe1ec3c=[];for(var _0x2892e3 in _0x29d72a){if(_0x29d72a[_0x95f4('0x26')](_0x2892e3)){if(!_[_0x95f4('0x27')](_0x29d72a[_0x2892e3])&&_0x29d72a[_0x2892e3][_0x95f4('0x33')]===_0x95f4('0x5c')&&_0x29d72a[_0x2892e3]['status']===_0x95f4('0x5d')){_0xe1ec3c['push'](_0x29d72a[_0x2892e3]['id']);}}}return _0xe1ec3c;};exports[_0x95f4('0x5e')]=function(_0x3b5bb7){var _0x4cb87e=moment()[_0x95f4('0x5f')](0x0);var _0x5dc71d=moment(_0x3b5bb7)['milliseconds'](0x0);return _0x4cb87e[_0x95f4('0x5')](_0x5dc71d,_0x95f4('0x6'));};exports[_0x95f4('0x60')]=function(_0x1f44f2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1f44f2['ContactId'],'ListId':_0x1f44f2[_0x95f4('0x61')],'VoiceQueueId':_0x1f44f2[_0x95f4('0x51')]||undefined,'CampaignId':_0x1f44f2[_0x95f4('0x62')]||undefined};};exports[_0x95f4('0x63')]=function(_0xa1b835){if(_0xa1b835===_0x95f4('0x41')||_0xa1b835===_0x95f4('0x64')||_0xa1b835==='queue'||_0xa1b835===_0x95f4('0x65')||_0xa1b835===_0x95f4('0x66')||_0xa1b835===_0x95f4('0x67')||_0xa1b835==='membername'||_0xa1b835===_0x95f4('0x58')||_0xa1b835===_0x95f4('0x17')||_0xa1b835==='active'||_0xa1b835==='calleridnum'||_0xa1b835===_0x95f4('0x4e')||_0xa1b835===_0x95f4('0x45')||_0xa1b835===_0x95f4('0x46')||_0xa1b835===_0x95f4('0x47')||_0xa1b835==='countglobal'||_0xa1b835===_0x95f4('0x68')||_0xa1b835===_0x95f4('0x69')||_0xa1b835===_0x95f4('0x6a')||_0xa1b835===_0x95f4('0x6b')||_0xa1b835===_0x95f4('0x19')||_0xa1b835===_0x95f4('0x61')||_0xa1b835===_0x95f4('0x3b')||_0xa1b835==='VoiceQueueId'||_0xa1b835===_0x95f4('0x6c')||_0xa1b835===_0x95f4('0x6d')||_0xa1b835==='xmd-queue'||_0xa1b835===_0x95f4('0x6e')||_0xa1b835==='xmd-listid'||_0xa1b835==='xmd-dialurl'||_0xa1b835===_0x95f4('0x6f')||_0xa1b835==='xmd-dialoptions'||_0xa1b835===_0x95f4('0x70')||_0xa1b835===_0x95f4('0x71')||_0xa1b835==='xmd-contactid'||_0xa1b835===_0x95f4('0x72')||_0xa1b835==='xmd-callerid'||_0xa1b835==='xmd-agiafter'||_0xa1b835===_0x95f4('0x73')||_0xa1b835==='rtpaudioqos'||_0xa1b835==='rtpaudioqosbridged'||_0xa1b835==='rtpaudioqosjitter'||_0xa1b835==='rtpaudioqosjitterbridged'||_0xa1b835===_0x95f4('0x74')||_0xa1b835===_0x95f4('0x75')||_0xa1b835===_0x95f4('0x76')||_0xa1b835===_0x95f4('0x77')||_0xa1b835===_0x95f4('0x78')||_0xa1b835===_0x95f4('0x79')||_0xa1b835==='rtpaudioqosjitter'||_0xa1b835===_0x95f4('0x7a')||_0xa1b835===_0x95f4('0x74')||_0xa1b835===_0x95f4('0x75')||_0xa1b835===_0x95f4('0x76')||_0xa1b835===_0x95f4('0x77')||_0xa1b835===_0x95f4('0x7b')||_0xa1b835===_0x95f4('0x7c')||_0xa1b835===_0x95f4('0x33')||_0xa1b835==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2be967,_0x280b3e){var _0x13d6dc,_0x202033,_0x44309a;if(_0x280b3e<=0x0){_0x280b3e=0x1;}_0x13d6dc=new RegExp(_0x95f4('0x7d')+_0x280b3e+'}$');_0x202033=Math[_0x95f4('0x7e')](0xa,_0x280b3e-0x1);_0x44309a=Math[_0x95f4('0x7e')](0xa,_0x280b3e)-0x1;return util['format']('%s',_['replace'](_0x2be967,_0x13d6dc,_['random'](_0x202033,_0x44309a)));};exports['extractCalleridName']=function(_0x245cac){var _0x212ef9=_0x245cac[_0x95f4('0x7f')](/"(.*?)"/);return _0x212ef9?_0x212ef9[0x1]:_0x245cac;};exports[_0x95f4('0x80')]=function(_0x353ddb){var _0x5d32d9=_0x353ddb[_0x95f4('0x7f')](/<(.*?)>/);return _0x5d32d9?_0x5d32d9[0x1]:_0x353ddb;}; \ No newline at end of file +var _0xcd78=['loggerCatch','inspect','logger','info','loggerError','error','logger2','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','isNil','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','updatedAt','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','scheduledAt','active','scheduledat','add','minutes','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','channelAgent','mandatoryDisposition','buildAcw','interface','status','reachable','push','getDiff','ListId','CampaignId','filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepvtcallid','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','preview','127.0.0.1','milliseconds','diff','seconds'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0xcd78,0x107));var _0x8cd7=function(_0x3ee446,_0x4c2c3d){_0x3ee446=_0x3ee446-0x0;var _0x49a7a3=_0xcd78[_0x3ee446];return _0x49a7a3;};'use strict';var util=require(_0x8cd7('0x0'));var _=require('lodash');var moment=require(_0x8cd7('0x1'));var logger=require('../../../../config/logger')(_0x8cd7('0x2'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x8cd7('0x3');function getSeconds(_0x4180c6,_0x4f5708){var _0xc07723=moment(_0x4180c6)[_0x8cd7('0x4')](0x0);var _0x5e8450=moment(_0x4f5708)[_0x8cd7('0x4')](0x0);return _0xc07723[_0x8cd7('0x5')](_0x5e8450,_0x8cd7('0x6'));}exports[_0x8cd7('0x7')]=function(_0xc1936d){return function(_0x380766){logger['error'](_0xc1936d,util[_0x8cd7('0x8')](_0x380766,{'showHidden':![],'depth':null}));};};exports[_0x8cd7('0x9')]=function(_0xc8e30,_0x38c496){logger[_0x8cd7('0xa')](_0xc8e30,util[_0x8cd7('0x8')](_0x38c496,{'showHidden':![],'depth':null}));};exports[_0x8cd7('0xb')]=function(_0x1bebc5,_0x32f895){logger[_0x8cd7('0xc')](_0x1bebc5,util['inspect'](_0x32f895,{'showHidden':![],'depth':null}));};exports[_0x8cd7('0xd')]=function(_0x1579fe){return function(_0x28ad2b){logger[_0x8cd7('0xa')](_0x1579fe,util[_0x8cd7('0x8')](_0x28ad2b,{'showHidden':![],'depth':null}));};};exports[_0x8cd7('0xe')]=function(_0x45d79a,_0xc6a285,_0x17a0af){return{'message':_0x45d79a,'unlock':_0xc6a285,'active':_0x17a0af};};exports[_0x8cd7('0xf')]=function(_0x44964d,_0x2f487d,_0x4d9f4f){if(!_[_0x8cd7('0x10')](_0x4d9f4f)&&'string'===typeof _0x4d9f4f&&!_[_0x8cd7('0x11')](_0x4d9f4f)){if(!_[_0x8cd7('0x10')](_0x2f487d)&&'string'===typeof _0x2f487d&&!_['isEmpty'](_0x2f487d)){return util[_0x8cd7('0x12')]('\x22%s\x22\x20<%s>',_0x2f487d,_0x4d9f4f);}return util[_0x8cd7('0x12')](_0x8cd7('0x13'),_0x4d9f4f,_0x4d9f4f);}if(!_[_0x8cd7('0x10')](_0x44964d)&&_0x8cd7('0x14')===typeof _0x44964d&&!_[_0x8cd7('0x11')](_0x44964d)){return _0x44964d;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x359612){if(_[_0x8cd7('0x15')](_0x359612)){return![];}return _0x359612;};exports['addVariables']=function(_0x34a1e3,_0x461002,_0x412f8a,_0xf50506,_0x160865,_0x7008cb){var _0x3c9c48={'XMD-QUEUE':_0x461002['Queue']?_0x461002[_0x8cd7('0x16')][_0x8cd7('0x17')]:'','XMD-CALLERID':_0xf50506,'XMD-CALLERID-PREVIEW':_0x7008cb?util[_0x8cd7('0x12')](_0x8cd7('0x13'),_0x7008cb['calleridname'],_0x7008cb[_0x8cd7('0x18')]):_0xf50506,'XMD-DIALID':_0x160865,'XMD-CONTACTID':_0x461002[_0x8cd7('0x19')],'XMD-CDRTYPE':_0x8cd7('0x1a'),'CALLERID(all)':_0xf50506,'XMD-VOICEQUEUEID':_0x461002[_0x8cd7('0x1b')],'XMD-DIALCHANNEL':_0x412f8a,'XMD-DIALTIMEOUT':_0x34a1e3['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x8cd7('0x12')](_0x8cd7('0x1c'),_0x34a1e3[_0x8cd7('0x1d')]?'g':'',_[_0x8cd7('0x11')](_0x34a1e3['monitor_format'])?'':_0x8cd7('0x1e')),'XMD-DIALURL':_0x34a1e3['dialPreviewUrl']||'','XMD-AGI':_0x34a1e3['dialQueueProject']?util[_0x8cd7('0x12')](_0x8cd7('0x1f'),ipAgi,_0x34a1e3[_0x8cd7('0x20')]):'NONE','XMD-AGIAFTER':_0x34a1e3[_0x8cd7('0x1d')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x34a1e3[_0x8cd7('0x1d')]):_0x8cd7('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x7008cb?_0x7008cb['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x7008cb?_0x7008cb[_0x8cd7('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x8cd7('0x11')](_0x34a1e3[_0x8cd7('0x23')])){_0x3c9c48[util[_0x8cd7('0x12')]('%s',_0x8cd7('0x24'))]=_0x34a1e3['monitor_format'];_0x3c9c48[util[_0x8cd7('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x160865;}if(_0x461002&&_0x461002[_0x8cd7('0x25')]){for(var _0x3a83ad in _0x461002[_0x8cd7('0x25')]){if(_0x461002['Contact'][_0x8cd7('0x26')](_0x3a83ad)){if(!_[_0x8cd7('0x15')](_0x461002['Contact'][_0x3a83ad])&&_0x3a83ad!=='id'&&_0x3a83ad!==_0x8cd7('0x27')&&_0x3a83ad!=='createdAt'&&_0x3a83ad!==_0x8cd7('0x28')){_0x3c9c48[util[_0x8cd7('0x12')]('%s%s','XMD-',_[_0x8cd7('0x29')](_0x3a83ad))]=_0x461002[_0x8cd7('0x25')][_0x3a83ad];}}}}return _0x3c9c48;};exports[_0x8cd7('0x2a')]=function(_0x5213d5){var _0x58acc7={};for(var _0x5d73d7 in _0x5213d5){if(_0x5213d5[_0x8cd7('0x26')](_0x5d73d7)){_0x58acc7[util['format']('%s',_[_0x8cd7('0x2b')](_0x5d73d7))]=_0x5213d5[_0x5d73d7];}}return{'variables':_0x58acc7};};exports[_0x8cd7('0x2c')]=function(_0x4007c4,_0x3e62bb){if(!_['isNil'](_0x4007c4)){if(_0x4007c4[_0x8cd7('0x26')]('originated')){if(_0x4007c4[_0x8cd7('0x2d')]>0x0){_0x4007c4[_0x8cd7('0x2d')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3e62bb);}}}else{logger[_0x8cd7('0xc')](_0x8cd7('0x2e'),_0x3e62bb);}};exports['logBlacklist']=function(_0x3b42d2){var _0x6d4d49=moment()[_0x8cd7('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b42d2[_0x8cd7('0x2f')]=0xd;_0x3b42d2[_0x8cd7('0x30')]=_0x8cd7('0x31');_0x3b42d2[_0x8cd7('0x32')]=_0x6d4d49;_0x3b42d2['responsetime']=_0x6d4d49;_0x3b42d2['endtime']=_0x6d4d49;};exports[_0x8cd7('0x33')]=function(_0x1710ed,_0x2da911,_0x18399b){var _0x64a7fa=moment()[_0x8cd7('0x12')](_0x8cd7('0x34'));_0x1710ed[_0x8cd7('0x2f')]=_0x2da911;_0x1710ed[_0x8cd7('0x30')]=_0x18399b;_0x1710ed[_0x8cd7('0x35')]=_0x64a7fa;_0x1710ed[_0x8cd7('0x36')]=getSeconds(_0x1710ed[_0x8cd7('0x35')],_0x1710ed[_0x8cd7('0x32')]);};exports['logLookAgent']=function(_0x48f815,_0x47436a,_0x279959){_0x48f815[_0x8cd7('0x37')]=_0x47436a;_0x48f815[_0x8cd7('0x38')]=_0x279959;};exports[_0x8cd7('0x39')]=function(_0x5be92e,_0x3413b1,_0x1eac87){var _0x24aaa6=moment()[_0x8cd7('0x12')](_0x8cd7('0x34'));_0x5be92e[_0x8cd7('0x2f')]=_0x3413b1;_0x5be92e['statedesc']=_0x1eac87;_0x5be92e[_0x8cd7('0x35')]=_0x5be92e[_0x8cd7('0x35')]?_0x5be92e[_0x8cd7('0x35')]:_0x24aaa6;_0x5be92e[_0x8cd7('0x3a')]=_0x5be92e[_0x8cd7('0x3a')]?_0x5be92e['endtime']:_0x24aaa6;_0x5be92e['ringtime']=getSeconds(_0x5be92e['responsetime']||0x0,_0x5be92e['starttime']||0x0);_0x5be92e[_0x8cd7('0x3b')]=_0x5be92e['answertime']?getSeconds(_0x5be92e[_0x8cd7('0x3a')],_0x5be92e[_0x8cd7('0x3c')]):0x0;};exports[_0x8cd7('0x3d')]=function(_0xd22372){return _0xd22372===_0x8cd7('0x3e');};exports[_0x8cd7('0x3f')]=function(_0x22a62c,_0x37bc44,_0x3de339,_0x5ece53,_0x5c56f8){var _0x3a2ebe=_0x5ece53?_0x8cd7('0x40'):_0x22a62c[_0x8cd7('0x41')];_0x3a2ebe=_0x5c56f8?_0x8cd7('0x42'):_0x3a2ebe;return{'actionid':_0x22a62c[_0x8cd7('0x43')],'action':_0x8cd7('0x44'),'channel':_0x22a62c['channelAgent'],'callerid':util['format'](_0x8cd7('0x13'),_0x3a2ebe,_0x22a62c['calleridnum']),'Exten':_0x8cd7('0x45'),'Context':_0x8cd7('0x46'),'Priority':'1','variable':_0x3de339,'timeout':(_0x37bc44[_0x8cd7('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22a62c[_0x8cd7('0x43')]};};exports[_0x8cd7('0x48')]=function(_0x54f412){return _0x54f412[_0x8cd7('0x49')]+_0x54f412[_0x8cd7('0x4a')]+_0x54f412[_0x8cd7('0x4b')]+_0x54f412[_0x8cd7('0x4c')]+_0x54f412['countnosuchnumberretry'];};exports['cloneAction']=function(_0x2f748a){var _0xfe015f=_[_0x8cd7('0x4d')](_0x2f748a);_0xfe015f[_0x8cd7('0x2f')]=0xf;_0xfe015f[_0x8cd7('0x30')]='Global';return _0xfe015f;};exports[_0x8cd7('0x4e')]=function(_0x2148fb,_0x528974,_0x589944){var _0x56b329={};_0x56b329[_0x528974]=_0x2148fb[_0x528974];_0x56b329[_0x8cd7('0x4f')]=![];_0x56b329[_0x8cd7('0x50')]=moment()[_0x8cd7('0x51')](_0x589944,_0x8cd7('0x52'))[_0x8cd7('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x56b329[_0x8cd7('0x19')]=_0x2148fb[_0x8cd7('0x19')];_0x56b329['ListId']=_0x2148fb['ListId'];_0x56b329[_0x8cd7('0x1b')]=_0x2148fb[_0x8cd7('0x1b')]||undefined;return _0x56b329;};exports[_0x8cd7('0x53')]=function(_0x8e2d21,_0x15b707){if(!_[_0x8cd7('0x15')](_0x8e2d21)){if(_0x8e2d21[_0x8cd7('0x54')]>0x0){_0x8e2d21['pTalking']-=0x1;}else{logger['error'](_0x15b707,_0x8cd7('0x55'));}}else{logger['error'](_0x15b707,_0x8cd7('0x56'));}};exports[_0x8cd7('0x57')]=function(_0x3b0e50){if(_0x3b0e50<=0x0){return!![];}return![];};exports[_0x8cd7('0x58')]=function(_0x229e2c,_0x2f31c2,_0x2896f5){_0x229e2c[_0x8cd7('0x59')]=_0x2f31c2;_0x229e2c[_0x8cd7('0x17')]=_0x229e2c[_0x8cd7('0x5a')];_0x229e2c['interface']=_0x229e2c[_0x8cd7('0x5b')];if(_0x2896f5){_0x229e2c[_0x8cd7('0x5c')]=_0x2896f5['mandatoryDisposition'];}return _0x229e2c;};exports[_0x8cd7('0x5d')]=function(_0x1a7aa0){var _0x28bed3={};_0x28bed3[_0x8cd7('0x5a')]=_0x1a7aa0['queue'];_0x28bed3[_0x8cd7('0x5e')]=_0x1a7aa0[_0x8cd7('0x5b')];_0x28bed3[_0x8cd7('0x43')]=_0x1a7aa0[_0x8cd7('0x43')];return _0x28bed3;};exports['agentReadyId']=function(_0x22da67){var _0x255bb5=[];for(var _0x3bba7e in _0x22da67){if(_0x22da67['hasOwnProperty'](_0x3bba7e)){if(!_[_0x8cd7('0x15')](_0x22da67[_0x3bba7e])&&_0x22da67[_0x3bba7e][_0x8cd7('0x2f')]==='not_inuse'&&_0x22da67[_0x3bba7e][_0x8cd7('0x5f')]===_0x8cd7('0x60')){_0x255bb5[_0x8cd7('0x61')](_0x22da67[_0x3bba7e]['id']);}}}return _0x255bb5;};exports[_0x8cd7('0x62')]=function(_0x4b0268){var _0x1e67d2=moment()[_0x8cd7('0x4')](0x0);var _0x3e2aeb=moment(_0x4b0268)[_0x8cd7('0x4')](0x0);return _0x1e67d2['diff'](_0x3e2aeb,_0x8cd7('0x6'));};exports['createBody']=function(_0x5be900){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5be900[_0x8cd7('0x19')],'ListId':_0x5be900[_0x8cd7('0x63')],'VoiceQueueId':_0x5be900[_0x8cd7('0x1b')]||undefined,'CampaignId':_0x5be900[_0x8cd7('0x64')]||undefined};};exports[_0x8cd7('0x65')]=function(_0x552136){if(_0x552136===_0x8cd7('0x43')||_0x552136==='idContact'||_0x552136===_0x8cd7('0x5a')||_0x552136===_0x8cd7('0x66')||_0x552136===_0x8cd7('0x67')||_0x552136===_0x8cd7('0x68')||_0x552136==='membername'||_0x552136===_0x8cd7('0x5b')||_0x552136===_0x8cd7('0x41')||_0x552136===_0x8cd7('0x4f')||_0x552136==='calleridnum'||_0x552136==='scheduledat'||_0x552136===_0x8cd7('0x49')||_0x552136==='countcongestionretry'||_0x552136===_0x8cd7('0x4b')||_0x552136===_0x8cd7('0x69')||_0x552136===_0x8cd7('0x6a')||_0x552136===_0x8cd7('0x6b')||_0x552136===_0x8cd7('0x6c')||_0x552136===_0x8cd7('0x6d')||_0x552136==='ContactId'||_0x552136===_0x8cd7('0x63')||_0x552136===_0x8cd7('0x38')||_0x552136===_0x8cd7('0x1b')||_0x552136==='sipcallid'||_0x552136===_0x8cd7('0x6e')||_0x552136===_0x8cd7('0x6f')||_0x552136==='xmd-phone'||_0x552136==='xmd-listid'||_0x552136===_0x8cd7('0x70')||_0x552136===_0x8cd7('0x71')||_0x552136===_0x8cd7('0x72')||_0x552136==='xmd-dialid'||_0x552136===_0x8cd7('0x73')||_0x552136===_0x8cd7('0x74')||_0x552136===_0x8cd7('0x75')||_0x552136==='xmd-callerid'||_0x552136===_0x8cd7('0x76')||_0x552136===_0x8cd7('0x77')||_0x552136===_0x8cd7('0x78')||_0x552136==='rtpaudioqosbridged'||_0x552136===_0x8cd7('0x79')||_0x552136===_0x8cd7('0x7a')||_0x552136===_0x8cd7('0x7b')||_0x552136===_0x8cd7('0x7c')||_0x552136===_0x8cd7('0x7d')||_0x552136===_0x8cd7('0x7e')||_0x552136===_0x8cd7('0x78')||_0x552136===_0x8cd7('0x7f')||_0x552136==='rtpaudioqosjitter'||_0x552136===_0x8cd7('0x7a')||_0x552136==='rtpaudioqosloss'||_0x552136===_0x8cd7('0x7c')||_0x552136===_0x8cd7('0x7d')||_0x552136===_0x8cd7('0x7e')||_0x552136==='bridgepeer'||_0x552136===_0x8cd7('0x80')||_0x552136===_0x8cd7('0x2f')||_0x552136===_0x8cd7('0x30')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x405df9,_0x2cbf77){var _0x4eebdd,_0x2e347a,_0x5845a3;if(_0x2cbf77<=0x0){_0x2cbf77=0x1;}_0x4eebdd=new RegExp('\x5cw{0,'+_0x2cbf77+'}$');_0x2e347a=Math[_0x8cd7('0x81')](0xa,_0x2cbf77-0x1);_0x5845a3=Math[_0x8cd7('0x81')](0xa,_0x2cbf77)-0x1;return util[_0x8cd7('0x12')]('%s',_[_0x8cd7('0x82')](_0x405df9,_0x4eebdd,_[_0x8cd7('0x83')](_0x2e347a,_0x5845a3)));};exports[_0x8cd7('0x84')]=function(_0x1a1be0){var _0x4907ab=_0x1a1be0[_0x8cd7('0x85')](/"(.*?)"/);return _0x4907ab?_0x4907ab[0x1]:_0x1a1be0;};exports[_0x8cd7('0x86')]=function(_0xc732be){var _0x59beda=_0xc732be[_0x8cd7('0x85')](/<(.*?)>/);return _0x59beda?_0x59beda[0x1]:_0xc732be;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 564629c..9c6f5e0 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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x42d0e8,_0x3da88d){var _0x35842e=function(_0x3df1ec){while(--_0x3df1ec){_0x42d0e8['push'](_0x42d0e8['shift']());}};_0x35842e(++_0x3da88d);}(_0x7a54,0x106));var _0x47a5=function(_0x5dd582,_0x2a2e99){_0x5dd582=_0x5dd582-0x0;var _0x45c36a=_0x7a54[_0x5dd582];return _0x45c36a;};'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 +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x1849e3,_0x55c691){var _0x16726c=function(_0x53641f){while(--_0x53641f){_0x1849e3['push'](_0x1849e3['shift']());}};_0x16726c(++_0x55c691);}(_0x5f2f,0x73));var _0xf5f2=function(_0x231675,_0x32db77){_0x231675=_0x231675-0x0;var _0x60abf=_0x5f2f[_0x231675];return _0x60abf;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('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 12ec702..60fa8a1 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 _0x425d=['length','isUndefined','initTrunks','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerabandon','diff','seconds','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','faxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','format','name','mapKeys','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents'];(function(_0x1d78de,_0x2dbab0){var _0x4af54e=function(_0x577a58){while(--_0x577a58){_0x1d78de['push'](_0x1d78de['shift']());}};_0x4af54e(++_0x2dbab0);}(_0x425d,0x1e0));var _0xd425=function(_0x53e2a2,_0x38f753){_0x53e2a2=_0x53e2a2-0x0;var _0x4dcf45=_0x425d[_0x53e2a2];return _0x4dcf45;};'use strict';var BPromise=require(_0xd425('0x0'));var util=require('util');var _=require(_0xd425('0x1'));var moment=require(_0xd425('0x2'));var Agent=require(_0xd425('0x3'));var Telephone=require(_0xd425('0x4'));var Trunk=require(_0xd425('0x5'));var VoiceQueue=require(_0xd425('0x6'));var Trigger=require(_0xd425('0x7'));var Template=require('../model/template');var Campaign=require(_0xd425('0x8'));var VoiceExtension=require(_0xd425('0x9'));var ZendeskAccount=require(_0xd425('0xa'));var SalesforceAccount=require(_0xd425('0xb'));var FreshdeskAccount=require(_0xd425('0xc'));var SugarcrmAccount=require(_0xd425('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xd425('0xe'));var VtigerAccount=require(_0xd425('0xf'));var ServicenowAccount=require(_0xd425('0x10'));var Dynamics365Account=require(_0xd425('0x11'));var FreshsalesAccount=require(_0xd425('0x12'));var FaxAccount=require(_0xd425('0x13'));var Realtime=function(){this[_0xd425('0x14')]={};this[_0xd425('0x15')]={};this[_0xd425('0x16')]={};this[_0xd425('0x17')]={};this[_0xd425('0x18')]={};this[_0xd425('0x19')]={};this[_0xd425('0x1a')]={};this[_0xd425('0x1b')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd425('0x1c')]={};this[_0xd425('0x1d')]={};this[_0xd425('0x1e')]={};this[_0xd425('0x1f')]={};this[_0xd425('0x20')]={};this[_0xd425('0x21')]={};this['zendeskAccounts']={};this[_0xd425('0x22')]={};this[_0xd425('0x23')]={};this[_0xd425('0x24')]={};this['zohoAccounts']={};this[_0xd425('0x25')]={};this[_0xd425('0x26')]={};this[_0xd425('0x27')]={};this[_0xd425('0x28')]={};this[_0xd425('0x29')]={};this['faxAccounts']={};};function freeIsNotKey(_0x278626,_0x471267,_0x7e267e){var _0x5dda0c=_['mapKeys'](_0x278626,function(_0x19d7d4,_0x434d97){return _0x19d7d4[_0x7e267e];});for(var _0x467a6c in _0x471267){if(_0x471267[_0xd425('0x2a')](_0x467a6c)){if(!_0x5dda0c[_0x467a6c]){delete _0x471267[_0x467a6c];}}}}function freeIsNotKeySip(_0x4e88fa,_0x58a0c1){var _0x5debc3=_['mapKeys'](_0x4e88fa,function(_0x427304,_0xb92870){return util[_0xd425('0x2b')]('SIP/%s',_0x427304[_0xd425('0x2c')]);});for(var _0x7e982e in _0x58a0c1){if(_0x58a0c1['hasOwnProperty'](_0x7e982e)){if(!_0x5debc3[_0x7e982e]){delete _0x58a0c1[_0x7e982e];}}}}function freeIsNotKeyAgent(_0x2e1ec4,_0xf2d0ce){var _0x249a2b=_[_0xd425('0x2d')](_0x2e1ec4,function(_0x3e93db,_0xb240c4){var _0x2480a0=_[_0xd425('0x2e')](_0x3e93db[_0xd425('0x2f')])?util[_0xd425('0x2b')](_0xd425('0x30'),_0x3e93db[_0xd425('0x2c')]):_0x3e93db['interface'];return _0x2480a0;});for(var _0x369b5b in _0xf2d0ce){if(_0xf2d0ce[_0xd425('0x2a')](_0x369b5b)){if(!_0x249a2b[_0x369b5b]){delete _0xf2d0ce[_0x369b5b];}}}}function clearVoiceCallReports(_0x398985){_0x398985[_0xd425('0x31')]=0x0;_0x398985[_0xd425('0x32')]=0x0;_0x398985[_0xd425('0x33')]=0x0;_0x398985[_0xd425('0x34')]=0x0;_0x398985['sumBillable']=0x0;}function clearCampaigns(_0x12f951){if(!_[_0xd425('0x35')](_0x12f951)){for(var _0x1d8861 in _0x12f951){if(_0x12f951['hasOwnProperty'](_0x1d8861)){_0x12f951[_0x1d8861][_0xd425('0x36')]=0x0;_0x12f951[_0x1d8861][_0xd425('0x37')]=0x0;}}}}function clearVoiceQueues(_0x433189){if(!_[_0xd425('0x35')](_0x433189)){for(var _0x27d29a in _0x433189){if(_0x433189[_0xd425('0x2a')](_0x27d29a)){_0x433189[_0x27d29a][_0xd425('0x31')]=0x0;_0x433189[_0x27d29a][_0xd425('0x32')]=0x0;_0x433189[_0x27d29a][_0xd425('0x38')]=0x0;_0x433189[_0x27d29a][_0xd425('0x39')]=0x0;_0x433189[_0x27d29a]['sumHoldTime']=0x0;_0x433189[_0x27d29a][_0xd425('0x34')]=0x0;_0x433189[_0x27d29a][_0xd425('0x3a')]=0x0;_0x433189[_0x27d29a][_0xd425('0x3b')]=0x0;_0x433189[_0x27d29a][_0xd425('0x3c')]=0x0;_0x433189[_0x27d29a][_0xd425('0x3d')]=0x0;_0x433189[_0x27d29a][_0xd425('0x3e')]=0x0;_0x433189[_0x27d29a][_0xd425('0x3f')]=0x0;_0x433189[_0x27d29a][_0xd425('0x40')]=0x0;_0x433189[_0x27d29a][_0xd425('0x41')]=0x0;_0x433189[_0x27d29a][_0xd425('0x42')]=0x0;_0x433189[_0x27d29a][_0xd425('0x43')]=0x0;_0x433189[_0x27d29a]['outboundOriginateFailureCallsDay']=0x0;_0x433189[_0x27d29a][_0xd425('0x44')]=0x0;_0x433189[_0x27d29a][_0xd425('0x45')]=0x0;_0x433189[_0x27d29a][_0xd425('0x3b')]=0x0;_0x433189[_0x27d29a][_0xd425('0x46')]=0x0;_0x433189[_0x27d29a][_0xd425('0x47')]=!![];}}}}Realtime['prototype'][_0xd425('0x48')]=function(_0x3badcc,_0x4cfcd1){for(var _0x574962 in _0x4cfcd1){if(_0x3badcc['hasOwnProperty'](_0x574962)){_0x3badcc[_0x574962]=_0x4cfcd1[_0x574962];}}};Realtime[_0xd425('0x49')][_0xd425('0x4a')]=function(){var _0x167179=this;return function(_0x2d586f){if(_0x2d586f){freeIsNotKeyAgent(_0x2d586f,_0x167179['agents']);for(var _0x42b974=0x0,_0x1d4414={},_0x30a9dc={};_0x42b974<_0x2d586f[_0xd425('0x4b')];_0x42b974+=0x1){_0x1d4414=_0x2d586f[_0x42b974];var _0x27b9e2=_[_0xd425('0x2e')](_0x1d4414[_0xd425('0x2f')])?util['format'](_0xd425('0x30'),_0x1d4414['name']):_0x1d4414[_0xd425('0x2f')];if(_[_0xd425('0x4c')](_0x167179[_0xd425('0x14')][_0x27b9e2])){_0x167179['agents'][_0x27b9e2]=new Agent(_0x1d4414);}else{_0x167179[_0xd425('0x48')](_0x167179[_0xd425('0x14')][_0x27b9e2],_0x1d4414);}}}return _0x167179[_0xd425('0x14')];};};Realtime[_0xd425('0x49')]['initTelephones']=function(){var _0x1d38fa=this;return function(_0x3cf540){if(_0x3cf540){freeIsNotKeySip(_0x3cf540,_0x1d38fa['telephones']);for(var _0x5d310e=0x0,_0x48fc85={},_0xb2e9d4={};_0x5d310e<_0x3cf540[_0xd425('0x4b')];_0x5d310e+=0x1){_0x48fc85=_0x3cf540[_0x5d310e];if(_[_0xd425('0x4c')](_0x1d38fa['telephones'][util['format']('SIP/%s',_0x48fc85[_0xd425('0x2c')])])){_0x1d38fa[_0xd425('0x15')][util[_0xd425('0x2b')](_0xd425('0x30'),_0x48fc85[_0xd425('0x2c')])]=new Telephone(_0x48fc85);}else{_0x1d38fa[_0xd425('0x48')](_0x1d38fa[_0xd425('0x15')][util['format'](_0xd425('0x30'),_0x48fc85[_0xd425('0x2c')])],_0x48fc85);}}}return _0x1d38fa[_0xd425('0x15')];};};Realtime['prototype'][_0xd425('0x4d')]=function(){var _0x2dffc7=this;return function(_0x336a87){if(_0x336a87){freeIsNotKeySip(_0x336a87,_0x2dffc7['trunks']);for(var _0x2361f2=0x0,_0x12b970={},_0x1c5ba6={};_0x2361f2<_0x336a87[_0xd425('0x4b')];_0x2361f2+=0x1){_0x12b970=_0x336a87[_0x2361f2];if(_['isUndefined'](_0x2dffc7[_0xd425('0x16')][util[_0xd425('0x2b')](_0xd425('0x30'),_0x12b970[_0xd425('0x2c')])])){_0x2dffc7[_0xd425('0x16')][util[_0xd425('0x2b')](_0xd425('0x30'),_0x12b970['name'])]=new Trunk(_0x12b970);}else{_0x2dffc7[_0xd425('0x48')](_0x2dffc7[_0xd425('0x16')][util['format'](_0xd425('0x30'),_0x12b970['name'])],_0x12b970);}}}return _0x2dffc7['trunks'];};};Realtime[_0xd425('0x49')]['initVoiceQueues']=function(){var _0x1be60a=this;return function(_0x5ba626){if(_0x5ba626){freeIsNotKey(_0x5ba626,_0x1be60a[_0xd425('0x17')],_0xd425('0x2c'));for(var _0x22d017=0x0,_0x3516f3={},_0x4420d2={};_0x22d017<_0x5ba626['length'];_0x22d017+=0x1){_0x3516f3=_0x5ba626[_0x22d017];if(_[_0xd425('0x4c')](_0x1be60a['voiceQueues'][_0x3516f3[_0xd425('0x2c')]])){_0x1be60a['voiceQueues'][_0x3516f3[_0xd425('0x2c')]]=new VoiceQueue(_0x3516f3);}else{_0x1be60a[_0xd425('0x48')](_0x1be60a[_0xd425('0x17')][_0x3516f3[_0xd425('0x2c')]],_0x3516f3);}}}return _0x1be60a[_0xd425('0x17')];};};Realtime['prototype'][_0xd425('0x4e')]=function(){var _0x433777=this;return function(_0x35e77b){if(_0x35e77b){freeIsNotKey(_0x35e77b,_0x433777[_0xd425('0x18')],'id');for(var _0x258ff4=0x0,_0x499796={},_0x440dc5={};_0x258ff4<_0x35e77b[_0xd425('0x4b')];_0x258ff4+=0x1){_0x499796=_0x35e77b[_0x258ff4];if(_[_0xd425('0x4c')](_0x433777[_0xd425('0x18')][_0x499796['id']])){_0x433777[_0xd425('0x18')][_0x499796['id']]=new Trigger(_0x499796);}else{_0x433777[_0xd425('0x48')](_0x433777['triggers'][_0x499796['id']],_0x499796);}}}return _0x433777[_0xd425('0x18')];};};Realtime[_0xd425('0x49')]['initTemplates']=function(){var _0x3f305=this;return function(_0x42c084){if(_0x42c084){freeIsNotKey(_0x42c084,_0x3f305[_0xd425('0x1a')],'id');for(var _0x3c6538=0x0,_0x5c0219={},_0x54f1d={};_0x3c6538<_0x42c084[_0xd425('0x4b')];_0x3c6538+=0x1){_0x5c0219=_0x42c084[_0x3c6538];if(_[_0xd425('0x4c')](_0x3f305[_0xd425('0x1a')][_0x5c0219['id']])){_0x3f305[_0xd425('0x1a')][_0x5c0219['id']]=new Template(_0x5c0219);}else{_0x3f305['mergeFromDatabase'](_0x3f305['templates'][_0x5c0219['id']],_0x5c0219);}}}return _0x3f305[_0xd425('0x1a')];};};Realtime['prototype'][_0xd425('0x4f')]=function(){var _0x1072bf=this;return function(_0x5594f9){if(_0x5594f9){freeIsNotKey(_0x5594f9,_0x1072bf[_0xd425('0x50')],'id');for(var _0x572711=0x0,_0x48d5b8={},_0x39f588={};_0x572711<_0x5594f9[_0xd425('0x4b')];_0x572711+=0x1){_0x48d5b8=_0x5594f9[_0x572711];if(_[_0xd425('0x4c')](_0x1072bf[_0xd425('0x50')][_0x48d5b8['id']])){_0x1072bf[_0xd425('0x50')][_0x48d5b8['id']]=new ZendeskAccount(_0x48d5b8);}else{_0x1072bf[_0xd425('0x48')](_0x1072bf[_0xd425('0x50')][_0x48d5b8['id']],_0x48d5b8);}}}return _0x1072bf[_0xd425('0x50')];};};Realtime['prototype'][_0xd425('0x51')]=function(){var _0x1c6141=this;return function(_0x1be9bb){if(_0x1be9bb){freeIsNotKey(_0x1be9bb,_0x1c6141[_0xd425('0x22')],'id');for(var _0x7b1080=0x0,_0x1c80c2={},_0x3b6d6a={};_0x7b1080<_0x1be9bb[_0xd425('0x4b')];_0x7b1080+=0x1){_0x1c80c2=_0x1be9bb[_0x7b1080];if(_['isUndefined'](_0x1c6141['salesforceAccounts'][_0x1c80c2['id']])){_0x1c6141['salesforceAccounts'][_0x1c80c2['id']]=new SalesforceAccount(_0x1c80c2);}else{_0x1c6141[_0xd425('0x48')](_0x1c6141[_0xd425('0x22')][_0x1c80c2['id']],_0x1c80c2);}}}return _0x1c6141[_0xd425('0x22')];};};Realtime[_0xd425('0x49')]['initFreshdeskAccounts']=function(){var _0x4fedc0=this;return function(_0x499a60){if(_0x499a60){freeIsNotKey(_0x499a60,_0x4fedc0['freshdeskAccounts'],'id');for(var _0x254b8b=0x0,_0x44c5e4={},_0x5abb99={};_0x254b8b<_0x499a60[_0xd425('0x4b')];_0x254b8b+=0x1){_0x44c5e4=_0x499a60[_0x254b8b];if(_[_0xd425('0x4c')](_0x4fedc0[_0xd425('0x24')][_0x44c5e4['id']])){_0x4fedc0['freshdeskAccounts'][_0x44c5e4['id']]=new FreshdeskAccount(_0x44c5e4);}else{_0x4fedc0['mergeFromDatabase'](_0x4fedc0[_0xd425('0x24')][_0x44c5e4['id']],_0x44c5e4);}}}return _0x4fedc0['freshdeskAccounts'];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x4458bc=this;return function(_0x259482){if(_0x259482){freeIsNotKey(_0x259482,_0x4458bc[_0xd425('0x52')],'id');for(var _0x5b2323=0x0,_0x3395d8={},_0x48bd20={};_0x5b2323<_0x259482[_0xd425('0x4b')];_0x5b2323+=0x1){_0x3395d8=_0x259482[_0x5b2323];if(_[_0xd425('0x4c')](_0x4458bc[_0xd425('0x52')][_0x3395d8['id']])){_0x4458bc[_0xd425('0x52')][_0x3395d8['id']]=new ZohoAccount(_0x3395d8);}else{_0x4458bc[_0xd425('0x48')](_0x4458bc[_0xd425('0x52')][_0x3395d8['id']],_0x3395d8);}}}return _0x4458bc[_0xd425('0x52')];};};Realtime[_0xd425('0x49')][_0xd425('0x53')]=function(){var _0x574e1f=this;return function(_0x42e483){if(_0x42e483){freeIsNotKey(_0x42e483,_0x574e1f[_0xd425('0x25')],'id');for(var _0x18dc33=0x0,_0xf22906={},_0x5c4df8={};_0x18dc33<_0x42e483['length'];_0x18dc33+=0x1){_0xf22906=_0x42e483[_0x18dc33];if(_[_0xd425('0x4c')](_0x574e1f[_0xd425('0x25')][_0xf22906['id']])){_0x574e1f[_0xd425('0x25')][_0xf22906['id']]=new DeskAccount(_0xf22906);}else{_0x574e1f[_0xd425('0x48')](_0x574e1f[_0xd425('0x25')][_0xf22906['id']],_0xf22906);}}}return _0x574e1f[_0xd425('0x25')];};};Realtime[_0xd425('0x49')][_0xd425('0x54')]=function(){var _0x1fcde4=this;return function(_0x78bb46){if(_0x78bb46){freeIsNotKey(_0x78bb46,_0x1fcde4[_0xd425('0x23')],'id');for(var _0x470e6f=0x0,_0x3e0eea={},_0x28979e={};_0x470e6f<_0x78bb46['length'];_0x470e6f+=0x1){_0x3e0eea=_0x78bb46[_0x470e6f];if(_[_0xd425('0x4c')](_0x1fcde4[_0xd425('0x23')][_0x3e0eea['id']])){_0x1fcde4[_0xd425('0x23')][_0x3e0eea['id']]=new SugarcrmAccount(_0x3e0eea);}else{_0x1fcde4['mergeFromDatabase'](_0x1fcde4['sugarcrmAccounts'][_0x3e0eea['id']],_0x3e0eea);}}}return _0x1fcde4['sugarcrmAccounts'];};};Realtime[_0xd425('0x49')][_0xd425('0x55')]=function(){var _0x27c60e=this;return function(_0x50ba6c){if(_0x50ba6c){freeIsNotKey(_0x50ba6c,_0x27c60e[_0xd425('0x26')],'id');for(var _0x4c1878=0x0,_0x2811a4={},_0xdc942c={};_0x4c1878<_0x50ba6c[_0xd425('0x4b')];_0x4c1878+=0x1){_0x2811a4=_0x50ba6c[_0x4c1878];if(_['isUndefined'](_0x27c60e[_0xd425('0x26')][_0x2811a4['id']])){_0x27c60e[_0xd425('0x26')][_0x2811a4['id']]=new VtigerAccount(_0x2811a4);}else{_0x27c60e[_0xd425('0x48')](_0x27c60e[_0xd425('0x26')][_0x2811a4['id']],_0x2811a4);}}}return _0x27c60e[_0xd425('0x26')];};};Realtime[_0xd425('0x49')][_0xd425('0x56')]=function(){var _0x44db7f=this;return function(_0xcb1a64){if(_0xcb1a64){freeIsNotKey(_0xcb1a64,_0x44db7f[_0xd425('0x27')],'id');for(var _0x2ba77b=0x0,_0x474fcf={},_0xebfc5b={};_0x2ba77b<_0xcb1a64[_0xd425('0x4b')];_0x2ba77b+=0x1){_0x474fcf=_0xcb1a64[_0x2ba77b];if(_[_0xd425('0x4c')](_0x44db7f[_0xd425('0x27')][_0x474fcf['id']])){_0x44db7f[_0xd425('0x27')][_0x474fcf['id']]=new ServicenowAccount(_0x474fcf);}else{_0x44db7f[_0xd425('0x48')](_0x44db7f['servicenowAccounts'][_0x474fcf['id']],_0x474fcf);}}}return _0x44db7f['servicenowAccounts'];};};Realtime[_0xd425('0x49')]['initDynamics365Accounts']=function(){var _0x135048=this;return function(_0x1e1a3f){if(_0x1e1a3f){freeIsNotKey(_0x1e1a3f,_0x135048[_0xd425('0x28')],'id');for(var _0x1ae1e3=0x0,_0x4c7000={},_0x3187ca={};_0x1ae1e3<_0x1e1a3f[_0xd425('0x4b')];_0x1ae1e3+=0x1){_0x4c7000=_0x1e1a3f[_0x1ae1e3];if(_[_0xd425('0x4c')](_0x135048[_0xd425('0x28')][_0x4c7000['id']])){_0x135048[_0xd425('0x28')][_0x4c7000['id']]=new Dynamics365Account(_0x4c7000);}else{_0x135048[_0xd425('0x48')](_0x135048['dynamics365Accounts'][_0x4c7000['id']],_0x4c7000);}}}return _0x135048['dynamics365Accounts'];};};Realtime[_0xd425('0x49')][_0xd425('0x57')]=function(){var _0x5e76f5=this;return function(_0x174081){if(_0x174081){freeIsNotKey(_0x174081,_0x5e76f5['freshsalesAccounts'],'id');for(var _0x20f6ec=0x0,_0x46fd93={},_0x1fc5ca={};_0x20f6ec<_0x174081[_0xd425('0x4b')];_0x20f6ec+=0x1){_0x46fd93=_0x174081[_0x20f6ec];if(_[_0xd425('0x4c')](_0x5e76f5[_0xd425('0x29')][_0x46fd93['id']])){_0x5e76f5[_0xd425('0x29')][_0x46fd93['id']]=new FreshsalesAccount(_0x46fd93);}else{_0x5e76f5['mergeFromDatabase'](_0x5e76f5[_0xd425('0x29')][_0x46fd93['id']],_0x46fd93);}}}return _0x5e76f5[_0xd425('0x29')];};};Realtime[_0xd425('0x49')][_0xd425('0x58')]=function(){var _0xfcba08=this;return function(_0x59e1e9){for(var _0x1f2834=0x0;_0x1f2834<_0x59e1e9[_0xd425('0x4b')];_0x1f2834+=0x1){_['merge'](_0xfcba08[_0xd425('0x17')][_0x59e1e9[_0x1f2834][_0xd425('0x2c')]],_0x59e1e9[_0x1f2834]);}return _0xfcba08['voiceQueues'];};};Realtime[_0xd425('0x49')][_0xd425('0x59')]=function(){var _0x74d30b=this;return function(_0xd923bb){clearVoiceQueues(_0x74d30b[_0xd425('0x17')]);if(_0xd923bb){_0xd923bb=_['groupBy'](_0xd923bb,_0xd425('0x5a'));for(var _0x4e3462 in _0xd923bb){if(_0xd923bb[_0xd425('0x2a')](_0x4e3462)){var _0x38c5b7={};for(var _0x5a1a9e=0x0;_0x5a1a9e<_0xd923bb[_0x4e3462][_0xd425('0x4b')];_0x5a1a9e+=0x1){var _0xcf7b51=_0xd923bb[_0x4e3462][_0x5a1a9e][_0xd425('0x5b')];if(_0x74d30b[_0xd425('0x17')][_0xcf7b51]){if(_0xd923bb[_0x4e3462][_0x5a1a9e]['queuecallerexit']){_0x74d30b['voiceQueues'][_0xcf7b51][_0xd425('0x38')]+=0x1;}if(_0xd923bb[_0x4e3462][_0x5a1a9e][_0xd425('0x5c')]){_0x74d30b[_0xd425('0x17')][_0xcf7b51]['abandoned']+=0x1;}_0x74d30b[_0xd425('0x17')][_0xcf7b51][_0xd425('0x33')]+=moment(_0xd923bb[_0x4e3462][_0x5a1a9e]['queuecallerleaveAt'])[_0xd425('0x5d')](moment(_0xd923bb[_0x4e3462][_0x5a1a9e]['queuecallerjoinAt']),_0xd425('0x5e'))||0x0;if(_0x5a1a9e===_0xd923bb[_0x4e3462][_0xd425('0x4b')]-0x1){_0x74d30b[_0xd425('0x17')][_0xcf7b51][_0xd425('0x34')]+=moment(_0xd923bb[_0x4e3462][_0x5a1a9e]['queuecallercompleteAt']||_0xd923bb[_0x4e3462][_0x5a1a9e]['queuecallerabandonAt']||_0xd923bb[_0x4e3462][_0x5a1a9e][_0xd425('0x5f')])[_0xd425('0x5d')](moment(_0xd923bb[_0x4e3462][_0x5a1a9e]['queuecallerjoinAt']),_0xd425('0x5e'))||0x0;_0x74d30b[_0xd425('0x17')][_0xcf7b51]['total']+=0x1;if(_0xd923bb[_0x4e3462][_0x5a1a9e][_0xd425('0x60')]){_0x74d30b[_0xd425('0x17')][_0xcf7b51][_0xd425('0x32')]+=0x1;_0x74d30b[_0xd425('0x17')][_0xcf7b51][_0xd425('0x3a')]+=moment(_0xd923bb[_0x4e3462][_0x5a1a9e][_0xd425('0x61')])[_0xd425('0x5d')](moment(_0xd923bb[_0x4e3462][_0x5a1a9e]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x74d30b[_0xd425('0x17')][_0xcf7b51]['sumDuration']+=_0x74d30b[_0xd425('0x17')][_0xcf7b51][_0xd425('0x33')]||0x0;}}}}}}return _0x74d30b['voiceQueues'];};};Realtime[_0xd425('0x49')][_0xd425('0x62')]=function(){var _0x5dac05=this;return function(_0x592c40){clearVoiceCallReports(_0x5dac05[_0xd425('0x1b')]);if(_0x592c40){for(var _0x242ed8=0x0;_0x242ed8<_0x592c40[_0xd425('0x4b')];_0x242ed8+=0x1){_0x5dac05[_0xd425('0x1b')][_0xd425('0x31')]+=0x1;_0x5dac05[_0xd425('0x1b')][_0xd425('0x34')]+=_0x592c40[_0x242ed8][_0xd425('0x63')];if(_0x592c40[_0x242ed8]['disposition']===_0xd425('0x64')){_0x5dac05[_0xd425('0x1b')]['answered']+=0x1;_0x5dac05[_0xd425('0x1b')][_0xd425('0x33')]+=_0x592c40[_0x242ed8][_0xd425('0x63')]-_0x592c40[_0x242ed8][_0xd425('0x65')]||0x0;_0x5dac05[_0xd425('0x1b')][_0xd425('0x3a')]+=_0x592c40[_0x242ed8][_0xd425('0x65')];}}}return _0x5dac05[_0xd425('0x1b')];};};Realtime[_0xd425('0x49')][_0xd425('0x66')]=function(){var _0x14cebc=this;return function(_0x572452){if(_0x572452){freeIsNotKey(_0x572452,_0x14cebc[_0xd425('0x19')],'name');for(var _0x4d3493=0x0,_0x2c8d63={};_0x4d3493<_0x572452['length'];_0x4d3493+=0x1){_0x2c8d63=_0x572452[_0x4d3493];if(_[_0xd425('0x4c')](_0x14cebc[_0xd425('0x19')][_0x2c8d63[_0xd425('0x2c')]])){_0x14cebc[_0xd425('0x19')][_0x2c8d63[_0xd425('0x2c')]]=new Campaign(_0x2c8d63);}else{_0x14cebc[_0xd425('0x48')](_0x14cebc[_0xd425('0x19')][_0x2c8d63['name']],_0x2c8d63);_0x14cebc[_0xd425('0x19')][_0x2c8d63[_0xd425('0x2c')]][_0xd425('0x67')]=_0x2c8d63[_0xd425('0x68')]?_0x2c8d63[_0xd425('0x68')]['name']:undefined;}}}return _0x14cebc[_0xd425('0x19')];};};Realtime[_0xd425('0x49')][_0xd425('0x69')]=function(){var _0x364f59=this;return function(_0x1a5f86){if(_0x1a5f86){freeIsNotKey(_0x1a5f86,_0x364f59[_0xd425('0x1c')],'id');for(var _0x409612=0x0,_0x4147eb={};_0x409612<_0x1a5f86[_0xd425('0x4b')];_0x409612+=0x1){_0x4147eb=_0x1a5f86[_0x409612];if(_[_0xd425('0x4c')](_0x364f59[_0xd425('0x1c')][_0x4147eb['id']])){_0x364f59[_0xd425('0x1c')][_0x4147eb['id']]=new VoiceExtension(_0x4147eb);}else{_0x364f59['mergeFromDatabase'](_0x364f59[_0xd425('0x1c')][_0x4147eb['id']],_0x4147eb);}}}return _0x364f59['voiceExtensions'];};};Realtime[_0xd425('0x49')][_0xd425('0x6a')]=function(){var _0x1c03d6=this;return function(_0x1e6930){clearCampaigns(_0x1c03d6[_0xd425('0x19')]);for(var _0x4a0d53=0x0;_0x4a0d53<_0x1e6930[_0xd425('0x4b')];_0x4a0d53+=0x1){_[_0xd425('0x6b')](_0x1c03d6[_0xd425('0x19')][_0x1e6930[_0x4a0d53][_0xd425('0x2c')]],_0x1e6930[_0x4a0d53]);}return _0x1c03d6[_0xd425('0x19')];};};Realtime[_0xd425('0x49')][_0xd425('0x6c')]=function(){var _0x568a83=this;return function(_0x25ed6c){if(_0x25ed6c){freeIsNotKey(_0x25ed6c,_0x568a83['faxAccounts'],'id');for(var _0x168f8b=0x0,_0x905e5d={},_0x4a43a7={};_0x168f8b<_0x25ed6c[_0xd425('0x4b')];_0x168f8b+=0x1){_0x905e5d=_0x25ed6c[_0x168f8b];if(_[_0xd425('0x4c')](_0x568a83['faxAccounts'][_0x905e5d['id']])){_0x568a83[_0xd425('0x6d')][_0x905e5d['id']]=new FaxAccount(_0x905e5d);}else{_0x568a83[_0xd425('0x48')](_0x568a83[_0xd425('0x6d')][_0x905e5d['id']],_0x905e5d);}}}return _0x568a83[_0xd425('0x6d')];};};module[_0xd425('0x6e')]=Realtime; \ No newline at end of file +var _0x9957=['initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','mergeFromDatabase','initTelephones','isUndefined','initTrunks','initVoiceQueues','triggers'];(function(_0x51c39f,_0x5bfb0b){var _0x274221=function(_0x5610d0){while(--_0x5610d0){_0x51c39f['push'](_0x51c39f['shift']());}};_0x274221(++_0x5bfb0b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var moment=require(_0x7995('0x3'));var Agent=require('../model/agent');var Telephone=require(_0x7995('0x4'));var Trunk=require(_0x7995('0x5'));var VoiceQueue=require(_0x7995('0x6'));var Trigger=require(_0x7995('0x7'));var Template=require('../model/template');var Campaign=require(_0x7995('0x8'));var VoiceExtension=require(_0x7995('0x9'));var ZendeskAccount=require(_0x7995('0xa'));var SalesforceAccount=require(_0x7995('0xb'));var FreshdeskAccount=require(_0x7995('0xc'));var SugarcrmAccount=require(_0x7995('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x7995('0xe'));var VtigerAccount=require(_0x7995('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x7995('0x10'));var FreshsalesAccount=require(_0x7995('0x11'));var FaxAccount=require(_0x7995('0x12'));var Realtime=function(){this[_0x7995('0x13')]={};this[_0x7995('0x14')]={};this[_0x7995('0x15')]={};this[_0x7995('0x16')]={};this['triggers']={};this[_0x7995('0x17')]={};this[_0x7995('0x18')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7995('0x19')]={};this[_0x7995('0x1a')]={};this[_0x7995('0x1b')]={};this[_0x7995('0x1c')]={};this[_0x7995('0x1d')]={};this[_0x7995('0x1e')]={};this[_0x7995('0x1f')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x7995('0x20')]={};this[_0x7995('0x21')]={};this[_0x7995('0x22')]={};this[_0x7995('0x23')]={};this[_0x7995('0x24')]={};this[_0x7995('0x25')]={};this[_0x7995('0x26')]={};this[_0x7995('0x27')]={};};function freeIsNotKey(_0x5377e5,_0x2eeacc,_0x565d97){var _0x2f832e=_[_0x7995('0x28')](_0x5377e5,function(_0x43d4b8,_0x291317){return _0x43d4b8[_0x565d97];});for(var _0x1e1415 in _0x2eeacc){if(_0x2eeacc[_0x7995('0x29')](_0x1e1415)){if(!_0x2f832e[_0x1e1415]){delete _0x2eeacc[_0x1e1415];}}}}function freeIsNotKeySip(_0x4faa60,_0x54c9ae){var _0x2536c8=_['mapKeys'](_0x4faa60,function(_0x555f74,_0x3ec178){return util[_0x7995('0x2a')]('SIP/%s',_0x555f74[_0x7995('0x2b')]);});for(var _0x51f276 in _0x54c9ae){if(_0x54c9ae['hasOwnProperty'](_0x51f276)){if(!_0x2536c8[_0x51f276]){delete _0x54c9ae[_0x51f276];}}}}function freeIsNotKeyAgent(_0x3e4c54,_0x327b1f){var _0x350fd9=_[_0x7995('0x28')](_0x3e4c54,function(_0x460924,_0x1c278a){var _0x5d40ae=_[_0x7995('0x2c')](_0x460924[_0x7995('0x2d')])?util[_0x7995('0x2a')](_0x7995('0x2e'),_0x460924[_0x7995('0x2b')]):_0x460924[_0x7995('0x2d')];return _0x5d40ae;});for(var _0x475351 in _0x327b1f){if(_0x327b1f[_0x7995('0x29')](_0x475351)){if(!_0x350fd9[_0x475351]){delete _0x327b1f[_0x475351];}}}}function clearVoiceCallReports(_0x59405a){_0x59405a[_0x7995('0x2f')]=0x0;_0x59405a[_0x7995('0x30')]=0x0;_0x59405a[_0x7995('0x31')]=0x0;_0x59405a[_0x7995('0x32')]=0x0;_0x59405a[_0x7995('0x33')]=0x0;}function clearCampaigns(_0x2a307e){if(!_['isEmpty'](_0x2a307e)){for(var _0x47625f in _0x2a307e){if(_0x2a307e['hasOwnProperty'](_0x47625f)){_0x2a307e[_0x47625f][_0x7995('0x34')]=0x0;_0x2a307e[_0x47625f][_0x7995('0x35')]=0x0;}}}}function clearVoiceQueues(_0xf16cc2){if(!_[_0x7995('0x36')](_0xf16cc2)){for(var _0x11c1eb in _0xf16cc2){if(_0xf16cc2['hasOwnProperty'](_0x11c1eb)){_0xf16cc2[_0x11c1eb][_0x7995('0x2f')]=0x0;_0xf16cc2[_0x11c1eb]['answered']=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x37')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x38')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x31')]=0x0;_0xf16cc2[_0x11c1eb]['sumDuration']=0x0;_0xf16cc2[_0x11c1eb]['sumBillable']=0x0;_0xf16cc2[_0x11c1eb]['outboundAnswerAgiCallsDay']=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x39')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x3a')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x3b')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x3c')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x3d')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x3e')]=0x0;_0xf16cc2[_0x11c1eb]['outboundDropCallsDayCallersExit']=0x0;_0xf16cc2[_0x11c1eb]['outboundBlacklistCallsDay']=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x3f')]=0x0;_0xf16cc2[_0x11c1eb]['outboundRejectCallsDay']=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x40')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x41')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x42')]=0x0;_0xf16cc2[_0x11c1eb][_0x7995('0x43')]=!![];}}}}Realtime[_0x7995('0x44')]['mergeFromDatabase']=function(_0x44309d,_0x33e24e){for(var _0x5dd802 in _0x33e24e){if(_0x44309d['hasOwnProperty'](_0x5dd802)){_0x44309d[_0x5dd802]=_0x33e24e[_0x5dd802];}}};Realtime['prototype'][_0x7995('0x45')]=function(){var _0x3acfc3=this;return function(_0x4a176f){if(_0x4a176f){freeIsNotKeyAgent(_0x4a176f,_0x3acfc3[_0x7995('0x13')]);for(var _0x51b95d=0x0,_0x37917b={},_0x1cb058={};_0x51b95d<_0x4a176f[_0x7995('0x46')];_0x51b95d+=0x1){_0x37917b=_0x4a176f[_0x51b95d];var _0x5014d2=_['isNil'](_0x37917b[_0x7995('0x2d')])?util['format']('SIP/%s',_0x37917b[_0x7995('0x2b')]):_0x37917b[_0x7995('0x2d')];if(_['isUndefined'](_0x3acfc3[_0x7995('0x13')][_0x5014d2])){_0x3acfc3[_0x7995('0x13')][_0x5014d2]=new Agent(_0x37917b);}else{_0x3acfc3[_0x7995('0x47')](_0x3acfc3[_0x7995('0x13')][_0x5014d2],_0x37917b);}}}return _0x3acfc3[_0x7995('0x13')];};};Realtime['prototype'][_0x7995('0x48')]=function(){var _0x242713=this;return function(_0xf612e6){if(_0xf612e6){freeIsNotKeySip(_0xf612e6,_0x242713[_0x7995('0x14')]);for(var _0x4b1541=0x0,_0x2be2c0={},_0x235df7={};_0x4b1541<_0xf612e6[_0x7995('0x46')];_0x4b1541+=0x1){_0x2be2c0=_0xf612e6[_0x4b1541];if(_[_0x7995('0x49')](_0x242713[_0x7995('0x14')][util[_0x7995('0x2a')]('SIP/%s',_0x2be2c0[_0x7995('0x2b')])])){_0x242713[_0x7995('0x14')][util[_0x7995('0x2a')](_0x7995('0x2e'),_0x2be2c0[_0x7995('0x2b')])]=new Telephone(_0x2be2c0);}else{_0x242713[_0x7995('0x47')](_0x242713[_0x7995('0x14')][util[_0x7995('0x2a')](_0x7995('0x2e'),_0x2be2c0[_0x7995('0x2b')])],_0x2be2c0);}}}return _0x242713[_0x7995('0x14')];};};Realtime[_0x7995('0x44')][_0x7995('0x4a')]=function(){var _0x53cda2=this;return function(_0x50a98e){if(_0x50a98e){freeIsNotKeySip(_0x50a98e,_0x53cda2[_0x7995('0x15')]);for(var _0x7325e8=0x0,_0x58523e={},_0x4b0855={};_0x7325e8<_0x50a98e[_0x7995('0x46')];_0x7325e8+=0x1){_0x58523e=_0x50a98e[_0x7325e8];if(_['isUndefined'](_0x53cda2['trunks'][util[_0x7995('0x2a')](_0x7995('0x2e'),_0x58523e[_0x7995('0x2b')])])){_0x53cda2['trunks'][util[_0x7995('0x2a')]('SIP/%s',_0x58523e[_0x7995('0x2b')])]=new Trunk(_0x58523e);}else{_0x53cda2['mergeFromDatabase'](_0x53cda2['trunks'][util[_0x7995('0x2a')](_0x7995('0x2e'),_0x58523e[_0x7995('0x2b')])],_0x58523e);}}}return _0x53cda2[_0x7995('0x15')];};};Realtime['prototype'][_0x7995('0x4b')]=function(){var _0x40fc68=this;return function(_0x31b347){if(_0x31b347){freeIsNotKey(_0x31b347,_0x40fc68[_0x7995('0x16')],'name');for(var _0x5f28e7=0x0,_0x1c37c6={},_0x55791b={};_0x5f28e7<_0x31b347[_0x7995('0x46')];_0x5f28e7+=0x1){_0x1c37c6=_0x31b347[_0x5f28e7];if(_['isUndefined'](_0x40fc68[_0x7995('0x16')][_0x1c37c6['name']])){_0x40fc68[_0x7995('0x16')][_0x1c37c6[_0x7995('0x2b')]]=new VoiceQueue(_0x1c37c6);}else{_0x40fc68['mergeFromDatabase'](_0x40fc68[_0x7995('0x16')][_0x1c37c6[_0x7995('0x2b')]],_0x1c37c6);}}}return _0x40fc68[_0x7995('0x16')];};};Realtime[_0x7995('0x44')]['initTriggers']=function(){var _0x2458cb=this;return function(_0x3e787d){if(_0x3e787d){freeIsNotKey(_0x3e787d,_0x2458cb[_0x7995('0x4c')],'id');for(var _0x491184=0x0,_0xe228a5={},_0x44f516={};_0x491184<_0x3e787d[_0x7995('0x46')];_0x491184+=0x1){_0xe228a5=_0x3e787d[_0x491184];if(_[_0x7995('0x49')](_0x2458cb[_0x7995('0x4c')][_0xe228a5['id']])){_0x2458cb['triggers'][_0xe228a5['id']]=new Trigger(_0xe228a5);}else{_0x2458cb[_0x7995('0x47')](_0x2458cb[_0x7995('0x4c')][_0xe228a5['id']],_0xe228a5);}}}return _0x2458cb['triggers'];};};Realtime[_0x7995('0x44')]['initTemplates']=function(){var _0x1d87f9=this;return function(_0x187735){if(_0x187735){freeIsNotKey(_0x187735,_0x1d87f9[_0x7995('0x18')],'id');for(var _0x30e220=0x0,_0xddf537={},_0x14b537={};_0x30e220<_0x187735[_0x7995('0x46')];_0x30e220+=0x1){_0xddf537=_0x187735[_0x30e220];if(_['isUndefined'](_0x1d87f9[_0x7995('0x18')][_0xddf537['id']])){_0x1d87f9[_0x7995('0x18')][_0xddf537['id']]=new Template(_0xddf537);}else{_0x1d87f9[_0x7995('0x47')](_0x1d87f9['templates'][_0xddf537['id']],_0xddf537);}}}return _0x1d87f9[_0x7995('0x18')];};};Realtime[_0x7995('0x44')][_0x7995('0x4d')]=function(){var _0x47d1d8=this;return function(_0x4ec548){if(_0x4ec548){freeIsNotKey(_0x4ec548,_0x47d1d8['zendeskAccounts'],'id');for(var _0xb70620=0x0,_0x1fd1ca={},_0x4cf5db={};_0xb70620<_0x4ec548[_0x7995('0x46')];_0xb70620+=0x1){_0x1fd1ca=_0x4ec548[_0xb70620];if(_[_0x7995('0x49')](_0x47d1d8[_0x7995('0x1f')][_0x1fd1ca['id']])){_0x47d1d8[_0x7995('0x1f')][_0x1fd1ca['id']]=new ZendeskAccount(_0x1fd1ca);}else{_0x47d1d8[_0x7995('0x47')](_0x47d1d8['zendeskAccounts'][_0x1fd1ca['id']],_0x1fd1ca);}}}return _0x47d1d8[_0x7995('0x1f')];};};Realtime['prototype'][_0x7995('0x4e')]=function(){var _0x33c801=this;return function(_0x206d2a){if(_0x206d2a){freeIsNotKey(_0x206d2a,_0x33c801['salesforceAccounts'],'id');for(var _0x5e1f34=0x0,_0x54e2b1={},_0x563f8e={};_0x5e1f34<_0x206d2a[_0x7995('0x46')];_0x5e1f34+=0x1){_0x54e2b1=_0x206d2a[_0x5e1f34];if(_[_0x7995('0x49')](_0x33c801[_0x7995('0x4f')][_0x54e2b1['id']])){_0x33c801[_0x7995('0x4f')][_0x54e2b1['id']]=new SalesforceAccount(_0x54e2b1);}else{_0x33c801[_0x7995('0x47')](_0x33c801[_0x7995('0x4f')][_0x54e2b1['id']],_0x54e2b1);}}}return _0x33c801[_0x7995('0x4f')];};};Realtime[_0x7995('0x44')][_0x7995('0x50')]=function(){var _0x17ecd3=this;return function(_0xa7af8c){if(_0xa7af8c){freeIsNotKey(_0xa7af8c,_0x17ecd3[_0x7995('0x20')],'id');for(var _0x3da72b=0x0,_0x35bea3={},_0x1ea1dc={};_0x3da72b<_0xa7af8c[_0x7995('0x46')];_0x3da72b+=0x1){_0x35bea3=_0xa7af8c[_0x3da72b];if(_[_0x7995('0x49')](_0x17ecd3[_0x7995('0x20')][_0x35bea3['id']])){_0x17ecd3[_0x7995('0x20')][_0x35bea3['id']]=new FreshdeskAccount(_0x35bea3);}else{_0x17ecd3['mergeFromDatabase'](_0x17ecd3[_0x7995('0x20')][_0x35bea3['id']],_0x35bea3);}}}return _0x17ecd3[_0x7995('0x20')];};};Realtime[_0x7995('0x44')][_0x7995('0x51')]=function(){var _0x5d160d=this;return function(_0x53125a){if(_0x53125a){freeIsNotKey(_0x53125a,_0x5d160d[_0x7995('0x21')],'id');for(var _0x197b52=0x0,_0x5b9467={},_0x332a85={};_0x197b52<_0x53125a['length'];_0x197b52+=0x1){_0x5b9467=_0x53125a[_0x197b52];if(_[_0x7995('0x49')](_0x5d160d[_0x7995('0x21')][_0x5b9467['id']])){_0x5d160d[_0x7995('0x21')][_0x5b9467['id']]=new ZohoAccount(_0x5b9467);}else{_0x5d160d[_0x7995('0x47')](_0x5d160d['zohoAccounts'][_0x5b9467['id']],_0x5b9467);}}}return _0x5d160d['zohoAccounts'];};};Realtime[_0x7995('0x44')][_0x7995('0x52')]=function(){var _0x6c0221=this;return function(_0x1d69ce){if(_0x1d69ce){freeIsNotKey(_0x1d69ce,_0x6c0221[_0x7995('0x22')],'id');for(var _0x27c5cd=0x0,_0x1d4689={},_0x1e2206={};_0x27c5cd<_0x1d69ce[_0x7995('0x46')];_0x27c5cd+=0x1){_0x1d4689=_0x1d69ce[_0x27c5cd];if(_['isUndefined'](_0x6c0221[_0x7995('0x22')][_0x1d4689['id']])){_0x6c0221[_0x7995('0x22')][_0x1d4689['id']]=new DeskAccount(_0x1d4689);}else{_0x6c0221[_0x7995('0x47')](_0x6c0221[_0x7995('0x22')][_0x1d4689['id']],_0x1d4689);}}}return _0x6c0221['deskAccounts'];};};Realtime['prototype'][_0x7995('0x53')]=function(){var _0xebb5c8=this;return function(_0x47d5d7){if(_0x47d5d7){freeIsNotKey(_0x47d5d7,_0xebb5c8[_0x7995('0x54')],'id');for(var _0x375fc9=0x0,_0x2e3421={},_0x57727e={};_0x375fc9<_0x47d5d7[_0x7995('0x46')];_0x375fc9+=0x1){_0x2e3421=_0x47d5d7[_0x375fc9];if(_['isUndefined'](_0xebb5c8[_0x7995('0x54')][_0x2e3421['id']])){_0xebb5c8['sugarcrmAccounts'][_0x2e3421['id']]=new SugarcrmAccount(_0x2e3421);}else{_0xebb5c8[_0x7995('0x47')](_0xebb5c8[_0x7995('0x54')][_0x2e3421['id']],_0x2e3421);}}}return _0xebb5c8[_0x7995('0x54')];};};Realtime[_0x7995('0x44')][_0x7995('0x55')]=function(){var _0xeb8920=this;return function(_0x2b3c1d){if(_0x2b3c1d){freeIsNotKey(_0x2b3c1d,_0xeb8920[_0x7995('0x23')],'id');for(var _0x10f012=0x0,_0x3f2bde={},_0x2618c4={};_0x10f012<_0x2b3c1d[_0x7995('0x46')];_0x10f012+=0x1){_0x3f2bde=_0x2b3c1d[_0x10f012];if(_['isUndefined'](_0xeb8920[_0x7995('0x23')][_0x3f2bde['id']])){_0xeb8920[_0x7995('0x23')][_0x3f2bde['id']]=new VtigerAccount(_0x3f2bde);}else{_0xeb8920[_0x7995('0x47')](_0xeb8920[_0x7995('0x23')][_0x3f2bde['id']],_0x3f2bde);}}}return _0xeb8920[_0x7995('0x23')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x268fde=this;return function(_0x87e38d){if(_0x87e38d){freeIsNotKey(_0x87e38d,_0x268fde[_0x7995('0x24')],'id');for(var _0xae6166=0x0,_0x5aa2ec={},_0x22d317={};_0xae6166<_0x87e38d['length'];_0xae6166+=0x1){_0x5aa2ec=_0x87e38d[_0xae6166];if(_['isUndefined'](_0x268fde[_0x7995('0x24')][_0x5aa2ec['id']])){_0x268fde[_0x7995('0x24')][_0x5aa2ec['id']]=new ServicenowAccount(_0x5aa2ec);}else{_0x268fde[_0x7995('0x47')](_0x268fde[_0x7995('0x24')][_0x5aa2ec['id']],_0x5aa2ec);}}}return _0x268fde[_0x7995('0x24')];};};Realtime[_0x7995('0x44')][_0x7995('0x56')]=function(){var _0x13dc73=this;return function(_0x3fde86){if(_0x3fde86){freeIsNotKey(_0x3fde86,_0x13dc73[_0x7995('0x25')],'id');for(var _0x560b0a=0x0,_0x2dc1f7={},_0x8908cd={};_0x560b0a<_0x3fde86[_0x7995('0x46')];_0x560b0a+=0x1){_0x2dc1f7=_0x3fde86[_0x560b0a];if(_['isUndefined'](_0x13dc73[_0x7995('0x25')][_0x2dc1f7['id']])){_0x13dc73[_0x7995('0x25')][_0x2dc1f7['id']]=new Dynamics365Account(_0x2dc1f7);}else{_0x13dc73[_0x7995('0x47')](_0x13dc73[_0x7995('0x25')][_0x2dc1f7['id']],_0x2dc1f7);}}}return _0x13dc73[_0x7995('0x25')];};};Realtime[_0x7995('0x44')][_0x7995('0x57')]=function(){var _0x3adfd2=this;return function(_0x2f94c4){if(_0x2f94c4){freeIsNotKey(_0x2f94c4,_0x3adfd2[_0x7995('0x26')],'id');for(var _0x435a1b=0x0,_0x535131={},_0x5e8b4c={};_0x435a1b<_0x2f94c4[_0x7995('0x46')];_0x435a1b+=0x1){_0x535131=_0x2f94c4[_0x435a1b];if(_[_0x7995('0x49')](_0x3adfd2[_0x7995('0x26')][_0x535131['id']])){_0x3adfd2[_0x7995('0x26')][_0x535131['id']]=new FreshsalesAccount(_0x535131);}else{_0x3adfd2['mergeFromDatabase'](_0x3adfd2[_0x7995('0x26')][_0x535131['id']],_0x535131);}}}return _0x3adfd2[_0x7995('0x26')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x3253b5=this;return function(_0x305b5a){for(var _0x555277=0x0;_0x555277<_0x305b5a[_0x7995('0x46')];_0x555277+=0x1){_['merge'](_0x3253b5[_0x7995('0x16')][_0x305b5a[_0x555277][_0x7995('0x2b')]],_0x305b5a[_0x555277]);}return _0x3253b5['voiceQueues'];};};Realtime['prototype'][_0x7995('0x58')]=function(){var _0x50c1a4=this;return function(_0x31b9e6){clearVoiceQueues(_0x50c1a4[_0x7995('0x16')]);if(_0x31b9e6){_0x31b9e6=_[_0x7995('0x59')](_0x31b9e6,_0x7995('0x5a'));for(var _0x1a1873 in _0x31b9e6){if(_0x31b9e6[_0x7995('0x29')](_0x1a1873)){var _0x8af865={};for(var _0x14cb17=0x0;_0x14cb17<_0x31b9e6[_0x1a1873][_0x7995('0x46')];_0x14cb17+=0x1){var _0x117317=_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x5b')];if(_0x50c1a4[_0x7995('0x16')][_0x117317]){if(_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x5c')]){_0x50c1a4[_0x7995('0x16')][_0x117317][_0x7995('0x37')]+=0x1;}if(_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x5d')]){_0x50c1a4[_0x7995('0x16')][_0x117317][_0x7995('0x38')]+=0x1;}_0x50c1a4[_0x7995('0x16')][_0x117317][_0x7995('0x31')]+=moment(_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x5e')])[_0x7995('0x5f')](moment(_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x60')]),_0x7995('0x61'))||0x0;if(_0x14cb17===_0x31b9e6[_0x1a1873][_0x7995('0x46')]-0x1){_0x50c1a4[_0x7995('0x16')][_0x117317][_0x7995('0x32')]+=moment(_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x62')]||_0x31b9e6[_0x1a1873][_0x14cb17]['queuecallerabandonAt']||_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x63')])[_0x7995('0x5f')](moment(_0x31b9e6[_0x1a1873][_0x14cb17]['queuecallerjoinAt']),'seconds')||0x0;_0x50c1a4[_0x7995('0x16')][_0x117317][_0x7995('0x2f')]+=0x1;if(_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x64')]){_0x50c1a4[_0x7995('0x16')][_0x117317][_0x7995('0x30')]+=0x1;_0x50c1a4[_0x7995('0x16')][_0x117317]['sumBillable']+=moment(_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x62')])[_0x7995('0x5f')](moment(_0x31b9e6[_0x1a1873][_0x14cb17][_0x7995('0x5e')]),_0x7995('0x61'))||0x0;}}else{_0x50c1a4[_0x7995('0x16')][_0x117317][_0x7995('0x32')]+=_0x50c1a4[_0x7995('0x16')][_0x117317][_0x7995('0x31')]||0x0;}}}}}}return _0x50c1a4['voiceQueues'];};};Realtime[_0x7995('0x44')][_0x7995('0x65')]=function(){var _0x5c04c9=this;return function(_0x479271){clearVoiceCallReports(_0x5c04c9[_0x7995('0x66')]);if(_0x479271){for(var _0xf8c2ed=0x0;_0xf8c2ed<_0x479271[_0x7995('0x46')];_0xf8c2ed+=0x1){_0x5c04c9[_0x7995('0x66')][_0x7995('0x2f')]+=0x1;_0x5c04c9['outbound'][_0x7995('0x32')]+=_0x479271[_0xf8c2ed][_0x7995('0x67')];if(_0x479271[_0xf8c2ed]['disposition']===_0x7995('0x68')){_0x5c04c9[_0x7995('0x66')]['answered']+=0x1;_0x5c04c9[_0x7995('0x66')]['sumHoldTime']+=_0x479271[_0xf8c2ed][_0x7995('0x67')]-_0x479271[_0xf8c2ed][_0x7995('0x69')]||0x0;_0x5c04c9[_0x7995('0x66')][_0x7995('0x33')]+=_0x479271[_0xf8c2ed][_0x7995('0x69')];}}}return _0x5c04c9['outbound'];};};Realtime[_0x7995('0x44')][_0x7995('0x6a')]=function(){var _0x38b37f=this;return function(_0x5bc4fa){if(_0x5bc4fa){freeIsNotKey(_0x5bc4fa,_0x38b37f[_0x7995('0x17')],_0x7995('0x2b'));for(var _0x350ed3=0x0,_0x308a26={};_0x350ed3<_0x5bc4fa['length'];_0x350ed3+=0x1){_0x308a26=_0x5bc4fa[_0x350ed3];if(_[_0x7995('0x49')](_0x38b37f[_0x7995('0x17')][_0x308a26[_0x7995('0x2b')]])){_0x38b37f['campaigns'][_0x308a26['name']]=new Campaign(_0x308a26);}else{_0x38b37f[_0x7995('0x47')](_0x38b37f[_0x7995('0x17')][_0x308a26['name']],_0x308a26);_0x38b37f['campaigns'][_0x308a26[_0x7995('0x2b')]][_0x7995('0x6b')]=_0x308a26[_0x7995('0x6c')]?_0x308a26[_0x7995('0x6c')][_0x7995('0x2b')]:undefined;}}}return _0x38b37f['campaigns'];};};Realtime['prototype'][_0x7995('0x6d')]=function(){var _0x54fad4=this;return function(_0x588df7){if(_0x588df7){freeIsNotKey(_0x588df7,_0x54fad4[_0x7995('0x19')],'id');for(var _0x3b731e=0x0,_0x3192b8={};_0x3b731e<_0x588df7['length'];_0x3b731e+=0x1){_0x3192b8=_0x588df7[_0x3b731e];if(_[_0x7995('0x49')](_0x54fad4[_0x7995('0x19')][_0x3192b8['id']])){_0x54fad4[_0x7995('0x19')][_0x3192b8['id']]=new VoiceExtension(_0x3192b8);}else{_0x54fad4[_0x7995('0x47')](_0x54fad4[_0x7995('0x19')][_0x3192b8['id']],_0x3192b8);}}}return _0x54fad4['voiceExtensions'];};};Realtime[_0x7995('0x44')][_0x7995('0x6e')]=function(){var _0x1a2d6a=this;return function(_0x14b942){clearCampaigns(_0x1a2d6a['campaigns']);for(var _0x6b45fd=0x0;_0x6b45fd<_0x14b942[_0x7995('0x46')];_0x6b45fd+=0x1){_['merge'](_0x1a2d6a[_0x7995('0x17')][_0x14b942[_0x6b45fd][_0x7995('0x2b')]],_0x14b942[_0x6b45fd]);}return _0x1a2d6a['campaigns'];};};Realtime[_0x7995('0x44')]['initFaxAccounts']=function(){var _0x1b4b34=this;return function(_0x51e7d7){if(_0x51e7d7){freeIsNotKey(_0x51e7d7,_0x1b4b34[_0x7995('0x27')],'id');for(var _0x4d12fd=0x0,_0xa97c08={},_0x20f48c={};_0x4d12fd<_0x51e7d7['length'];_0x4d12fd+=0x1){_0xa97c08=_0x51e7d7[_0x4d12fd];if(_[_0x7995('0x49')](_0x1b4b34['faxAccounts'][_0xa97c08['id']])){_0x1b4b34['faxAccounts'][_0xa97c08['id']]=new FaxAccount(_0xa97c08);}else{_0x1b4b34[_0x7995('0x47')](_0x1b4b34[_0x7995('0x27')][_0xa97c08['id']],_0xa97c08);}}}return _0x1b4b34[_0x7995('0x27')];};};module[_0x7995('0x6f')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 6786468..f436ace 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 _0x28c2=['interface','format','SIP/%s','length','assigned','lastAssignedTo','isNil','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','dialer','lastapplication','queue','lastdata','from-voip-provider','context','from-sip','xcally-motion-preview','calleridnum','destinationchannel','channel','callerid','originatecalleridnum','disposition','ANSWERED','connectedlinenum','calleridname','linkedid','transfereelinkedid','uniqueid','create','monitor','monitors','filename','createdAt','connectedlinename','membername','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','transfers','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedTransfer','findAgent','find','accountcode','name'];(function(_0xc36844,_0x41d978){var _0x592e3a=function(_0x4b3add){while(--_0x4b3add){_0xc36844['push'](_0xc36844['shift']());}};_0x592e3a(++_0x41d978);}(_0x28c2,0x8b));var _0x228c=function(_0x1e575c,_0x555cc1){_0x1e575c=_0x1e575c-0x0;var _0x5b26d0=_0x28c2[_0x1e575c];return _0x5b26d0;};'use strict';var _=require(_0x228c('0x0'));var moment=require(_0x228c('0x1'));var util=require(_0x228c('0x2'));var config=require(_0x228c('0x3'));var ami=require(_0x228c('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x228c('0x5'));var RpcVoiceDialReport=require(_0x228c('0x6'));var RpcMemberReport=require(_0x228c('0x7'));var RpcVoiceQueueReport=require(_0x228c('0x8'));var RpcVoiceRecording=require(_0x228c('0x9'));var RpcVoiceTransferReport=require(_0x228c('0xa'));var VoiceQueueReport=require(_0x228c('0xb'));var VoiceCallReport=require(_0x228c('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x228c('0xd'));function Report(_0x2bd71b){this[_0x228c('0xe')]=_0x2bd71b;this[_0x228c('0xf')]=_0x2bd71b[_0x228c('0xf')];this[_0x228c('0x10')]=_0x2bd71b[_0x228c('0x10')];}Report[_0x228c('0x11')][_0x228c('0x12')]=function(_0x187137){var _0x54b88d=new VoiceQueueReport(this['realtime']);var _0x3fc9b2=new VoiceAgentReport(this['realtime']);var _0x338be0=new VoiceDialReport(this[_0x228c('0xe')]);var _0x55bff7=new VoiceCallReport(this[_0x228c('0xe')]);var _0x3ee7ff=new UserReport(this['realtime']);if(config[_0x228c('0x13')]&&config[_0x228c('0x13')]['disabled']){ami['on'](_0x228c('0x14'),this[_0x228c('0x15')][_0x228c('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x228c('0x17')][_0x228c('0x16')](this));ami['on'](_0x228c('0x18'),this[_0x228c('0x19')][_0x228c('0x16')](this));ami['on']('custom:voiceDialReport',this[_0x228c('0x1a')][_0x228c('0x16')](this));ami['on'](_0x228c('0x1b'),this['blindTransfer'][_0x228c('0x16')](this));ami['on']('attendedtransfer',this[_0x228c('0x1c')]['bind'](this));}};Report['prototype'][_0x228c('0x1d')]=function(_0x2eb00c){var _0x4d0f84;_0x4d0f84=_[_0x228c('0x1e')](this[_0x228c('0xf')],function(_0x288df1){return _0x288df1[_0x228c('0x1f')]==_0x2eb00c||_0x288df1[_0x228c('0x20')]==_0x2eb00c;});if(_['isNil'](_0x4d0f84)){var _0x4806f2=_[_0x228c('0x1e')](this[_0x228c('0x10')],function(_0x288163){return _0x288163[_0x228c('0x1f')]==_0x2eb00c||_0x288163[_0x228c('0x20')]==_0x2eb00c;});if(_0x4806f2){_0x4d0f84=_[_0x228c('0x1e')](this[_0x228c('0xf')],function(_0x1a0730){return _0x1a0730[_0x228c('0x21')]==util[_0x228c('0x22')](_0x228c('0x23'),_0x4806f2['name']);});}}return _0x4d0f84;};Report[_0x228c('0x11')]['voiceQueueReport']=function(_0x1140e1){for(var _0x42608c=0x0;_0x42608c<_0x1140e1[_0x228c('0x24')];_0x42608c+=0x1){var _0x17bc21=this[_0x228c('0x1d')](_0x1140e1[_0x42608c]['connectedlinenum']);if(_0x17bc21){_0x1140e1[_0x42608c][_0x228c('0x1f')]=_0x17bc21[_0x228c('0x1f')];_0x1140e1[_0x42608c][_0x228c('0x25')]=!![];_0x1140e1[_0x42608c][_0x228c('0x26')]=_0x17bc21['name'];_0x1140e1[_0x42608c][_0x228c('0x21')]=_[_0x228c('0x27')](_0x17bc21[_0x228c('0x21')])?util[_0x228c('0x22')](_0x228c('0x23'),_0x17bc21[_0x228c('0x20')]):_0x17bc21[_0x228c('0x21')];if(_0x1140e1[_0x42608c][_0x228c('0x28')]){_0x1140e1[_0x42608c]['queuecallercompleteAt']=moment()[_0x228c('0x22')](_0x228c('0x29'));}if(_0x1140e1[_0x42608c][_0x228c('0x2a')]){_0x1140e1[_0x42608c][_0x228c('0x2b')]=moment()[_0x228c('0x22')](_0x228c('0x29'));}RpcMemberReport['voiceQueueReport'](_0x1140e1[_0x42608c]);}RpcVoiceQueueReport['create'](_0x1140e1[_0x42608c]);}};function extractCalleridNumber(_0x30f553){var _0x4eb7c5=_0x30f553[_0x228c('0x2c')](/<(.*?)>/);return _0x4eb7c5?_0x4eb7c5[0x1]:_0x30f553;}Report[_0x228c('0x11')][_0x228c('0x17')]=function(_0x24be7b){_0x24be7b[_0x228c('0x2d')]=_0x24be7b[_0x228c('0x2d')]||_0x24be7b[_0x228c('0x2e')];if(_0x24be7b[_0x228c('0x2f')]==_0x228c('0x30')){_0x24be7b[_0x228c('0x31')]=_0x228c('0x32');_0x24be7b[_0x228c('0x33')]=_0x24be7b[_0x228c('0x32')];if(_0x24be7b['context']==_0x228c('0x34')){_0x24be7b[_0x228c('0x1f')]='';_0x24be7b[_0x228c('0x2d')]=extractCalleridNumber(_0x24be7b['callerid']);}else if(_0x24be7b[_0x228c('0x35')]==_0x228c('0x36')){if(_0x24be7b[_0x228c('0x2d')]==_0x228c('0x37')){_0x24be7b[_0x228c('0x2d')]=extractCalleridNumber(_0x24be7b['calleridpreview']);_0x24be7b[_0x228c('0x38')]=_0x24be7b['originatecalleridnum'];_0x24be7b[_0x228c('0x39')]=[_0x24be7b[_0x228c('0x3a')],_0x24be7b[_0x228c('0x3a')]=_0x24be7b['destinationchannel']][0x0];_0x24be7b[_0x228c('0x3b')]=_0x24be7b['calleridpreview'];}else{_0x24be7b[_0x228c('0x2d')]=_0x24be7b['calleridnum'];_0x24be7b[_0x228c('0x38')]=_0x24be7b[_0x228c('0x3c')];if(_0x24be7b[_0x228c('0x3d')]==_0x228c('0x3e')){_0x24be7b['accountcode']=_0x24be7b[_0x228c('0x3f')];}else{_0x24be7b[_0x228c('0x1f')]='';}}}}else{_0x24be7b[_0x228c('0x3b')]=util[_0x228c('0x22')]('\x22%s\x22\x20<%s>',_0x24be7b[_0x228c('0x40')],_0x24be7b[_0x228c('0x38')]);}if(RpcVoiceTransferReport['transfers'][_0x24be7b[_0x228c('0x41')]]){var _0x140b1e=RpcVoiceTransferReport['transfers'][_0x24be7b['linkedid']];_0x140b1e[_0x228c('0x42')]=_0x24be7b[_0x228c('0x43')];RpcVoiceTransferReport['blindTransfer'](_0x140b1e);delete RpcVoiceTransferReport['transfers'][_0x24be7b[_0x228c('0x41')]];}RpcVoiceCallReport[_0x228c('0x44')](_0x24be7b);if(_0x24be7b[_0x228c('0x45')]){for(var _0x3d68ce=0x0;_0x3d68ce<_0x24be7b[_0x228c('0x46')][_0x228c('0x24')];_0x3d68ce+=0x1){_0x24be7b['monitorFilename']=_0x24be7b[_0x228c('0x46')][_0x3d68ce][_0x228c('0x47')];_0x24be7b[_0x228c('0x48')]=_0x24be7b[_0x228c('0x46')][_0x3d68ce][_0x228c('0x48')];if(_0x24be7b[_0x228c('0x2e')]=='xcally-motion-preview'){_0x24be7b[_0x228c('0x38')]=_0x24be7b['connectedlinenum'];_0x24be7b[_0x228c('0x40')]=_0x24be7b[_0x228c('0x49')];_0x24be7b[_0x228c('0x3f')]=_0x24be7b['accountcode'];_0x24be7b[_0x228c('0x49')]=_0x24be7b[_0x228c('0x4a')];_0x24be7b[_0x228c('0x2e')]=_0x24be7b[_0x228c('0x3c')];}else if(_0x24be7b[_0x228c('0x2e')]=='xcally-motion-dialer'){_0x24be7b[_0x228c('0x38')]=_0x24be7b['destination'];_0x24be7b['exten']=_0x24be7b['originatecalleridnum'];}RpcVoiceRecording['create'](_0x24be7b);}}};Report[_0x228c('0x11')]['voiceAgentReport']=function(_0x5ea0d8){if(_[_0x228c('0x4b')](_0x5ea0d8)){_0x5ea0d8[_0x228c('0x4c')](function(_0x14a654){RpcVoiceAgentReport['create'](_0x14a654);});}else{RpcVoiceAgentReport[_0x228c('0x44')](_0x5ea0d8);}};Report[_0x228c('0x11')][_0x228c('0x1a')]=function(_0x24afa7){RpcVoiceDialReport[_0x228c('0x44')](_0x24afa7);var _0xb51bc7;var _0x5a60d4;var _0x215f0c=_0x24afa7[_0x228c('0x3a')];if(_[_0x228c('0x4d')](_0x215f0c,'Local')){_0x5a60d4=_0x215f0c[_0x228c('0x4e')](_0x215f0c[_0x228c('0x4f')]('/')+0x1,_0x215f0c['indexOf']('@'));_0xb51bc7=_[_0x228c('0x1e')](this['agents'],function(_0x6b8aa2){return _0x6b8aa2[_0x228c('0x50')]==_0x5a60d4||_0x6b8aa2[_0x228c('0x51')]==_0x5a60d4||_0x6b8aa2['accountcode']==_0x5a60d4;});}else{_0x5a60d4=_0x215f0c[_0x228c('0x4e')](_0x215f0c[_0x228c('0x4f')]('/')+0x1,_0x215f0c[_0x228c('0x52')]('-'));_0xb51bc7=this[_0x228c('0x1d')](_0x5a60d4);}if(_0xb51bc7){_0x24afa7[_0x228c('0x21')]=_[_0x228c('0x27')](_0xb51bc7[_0x228c('0x21')])?util['format'](_0x228c('0x23'),_0xb51bc7[_0x228c('0x20')]):_0xb51bc7['interface'];_0x24afa7['membername']=_0xb51bc7[_0x228c('0x20')];_0x24afa7['accountcode']=_0xb51bc7['accountcode'];RpcMemberReport[_0x228c('0x1a')](_0x24afa7);}};Report['prototype'][_0x228c('0x53')]=function(_0x23cba5){RpcVoiceTransferReport[_0x228c('0x54')][_0x23cba5[_0x228c('0x55')]]=_0x23cba5;};Report[_0x228c('0x11')]['attendedTransfer']=function(_0x464f25){RpcVoiceTransferReport[_0x228c('0x1c')](_0x464f25);};module['exports']=Report; \ No newline at end of file +var _0x3542=['find','accountcode','name','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','lastapplication','queue','lastdata','from-voip-provider','context','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','forEach','startsWith','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent'];(function(_0x12cdae,_0x245ec6){var _0x5494ec=function(_0x441d9c){while(--_0x441d9c){_0x12cdae['push'](_0x12cdae['shift']());}};_0x5494ec(++_0x245ec6);}(_0x3542,0x8a));var _0x2354=function(_0x329421,_0x414a49){_0x329421=_0x329421-0x0;var _0x5b31e8=_0x3542[_0x329421];return _0x5b31e8;};'use strict';var _=require(_0x2354('0x0'));var moment=require(_0x2354('0x1'));var util=require('util');var config=require(_0x2354('0x2'));var ami=require(_0x2354('0x3'));var RpcVoiceAgentReport=require(_0x2354('0x4'));var RpcVoiceCallReport=require(_0x2354('0x5'));var RpcVoiceDialReport=require(_0x2354('0x6'));var RpcMemberReport=require(_0x2354('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x2354('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x2354('0x9'));var VoiceAgentReport=require(_0x2354('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2354('0xb'));function Report(_0x50aa21){this[_0x2354('0xc')]=_0x50aa21;this[_0x2354('0xd')]=_0x50aa21['agents'];this[_0x2354('0xe')]=_0x50aa21[_0x2354('0xe')];}Report[_0x2354('0xf')][_0x2354('0x10')]=function(_0x5ba510){var _0x2f9a21=new VoiceQueueReport(this[_0x2354('0xc')]);var _0x4701f1=new VoiceAgentReport(this[_0x2354('0xc')]);var _0x1e11f2=new VoiceDialReport(this['realtime']);var _0x2582e5=new VoiceCallReport(this[_0x2354('0xc')]);var _0x1f3d09=new UserReport(this['realtime']);if(config[_0x2354('0x11')]&&config['xdr'][_0x2354('0x12')]){ami['on'](_0x2354('0x13'),this['voiceQueueReport'][_0x2354('0x14')](this));ami['on'](_0x2354('0x15'),this[_0x2354('0x16')][_0x2354('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0x2354('0x17')][_0x2354('0x14')](this));ami['on'](_0x2354('0x18'),this[_0x2354('0x19')][_0x2354('0x14')](this));ami['on']('blindtransfer',this[_0x2354('0x1a')][_0x2354('0x14')](this));ami['on'](_0x2354('0x1b'),this[_0x2354('0x1c')][_0x2354('0x14')](this));}};Report[_0x2354('0xf')][_0x2354('0x1d')]=function(_0x51b437){var _0x56914f;_0x56914f=_[_0x2354('0x1e')](this[_0x2354('0xd')],function(_0x1a2f1c){return _0x1a2f1c[_0x2354('0x1f')]==_0x51b437||_0x1a2f1c[_0x2354('0x20')]==_0x51b437;});if(_['isNil'](_0x56914f)){var _0x90e84c=_[_0x2354('0x1e')](this[_0x2354('0xe')],function(_0x1f3486){return _0x1f3486[_0x2354('0x1f')]==_0x51b437||_0x1f3486['name']==_0x51b437;});if(_0x90e84c){_0x56914f=_[_0x2354('0x1e')](this['agents'],function(_0x5e12d5){return _0x5e12d5[_0x2354('0x21')]==util[_0x2354('0x22')](_0x2354('0x23'),_0x90e84c[_0x2354('0x20')]);});}}return _0x56914f;};Report[_0x2354('0xf')][_0x2354('0x24')]=function(_0x4746ba){for(var _0x3f0e10=0x0;_0x3f0e10<_0x4746ba[_0x2354('0x25')];_0x3f0e10+=0x1){var _0x2b36be=this[_0x2354('0x1d')](_0x4746ba[_0x3f0e10][_0x2354('0x26')]);if(_0x2b36be){_0x4746ba[_0x3f0e10][_0x2354('0x1f')]=_0x2b36be['accountcode'];_0x4746ba[_0x3f0e10][_0x2354('0x27')]=!![];_0x4746ba[_0x3f0e10][_0x2354('0x28')]=_0x2b36be[_0x2354('0x20')];_0x4746ba[_0x3f0e10]['interface']=_[_0x2354('0x29')](_0x2b36be[_0x2354('0x21')])?util[_0x2354('0x22')](_0x2354('0x23'),_0x2b36be[_0x2354('0x20')]):_0x2b36be[_0x2354('0x21')];if(_0x4746ba[_0x3f0e10]['queuecallercomplete']){_0x4746ba[_0x3f0e10][_0x2354('0x2a')]=moment()[_0x2354('0x22')](_0x2354('0x2b'));}if(_0x4746ba[_0x3f0e10][_0x2354('0x2c')]){_0x4746ba[_0x3f0e10][_0x2354('0x2d')]=moment()[_0x2354('0x22')](_0x2354('0x2b'));}RpcMemberReport[_0x2354('0x24')](_0x4746ba[_0x3f0e10]);}RpcVoiceQueueReport[_0x2354('0x2e')](_0x4746ba[_0x3f0e10]);}};function extractCalleridNumber(_0xc7752d){var _0x684382=_0xc7752d[_0x2354('0x2f')](/<(.*?)>/);return _0x684382?_0x684382[0x1]:_0xc7752d;}Report[_0x2354('0xf')][_0x2354('0x16')]=function(_0x5cab24){_0x5cab24[_0x2354('0x30')]=_0x5cab24[_0x2354('0x30')]||_0x5cab24[_0x2354('0x31')];if(_0x5cab24['type']=='dialer'){_0x5cab24[_0x2354('0x32')]=_0x2354('0x33');_0x5cab24[_0x2354('0x34')]=_0x5cab24[_0x2354('0x33')];if(_0x5cab24['context']==_0x2354('0x35')){_0x5cab24[_0x2354('0x1f')]='';_0x5cab24['destination']=extractCalleridNumber(_0x5cab24['callerid']);}else if(_0x5cab24[_0x2354('0x36')]=='from-sip'){if(_0x5cab24[_0x2354('0x30')]==_0x2354('0x37')){_0x5cab24['destination']=extractCalleridNumber(_0x5cab24[_0x2354('0x38')]);_0x5cab24[_0x2354('0x39')]=_0x5cab24[_0x2354('0x3a')];_0x5cab24[_0x2354('0x3b')]=[_0x5cab24[_0x2354('0x3c')],_0x5cab24[_0x2354('0x3c')]=_0x5cab24['destinationchannel']][0x0];_0x5cab24[_0x2354('0x3d')]=_0x5cab24[_0x2354('0x38')];}else{_0x5cab24[_0x2354('0x30')]=_0x5cab24['calleridnum'];_0x5cab24[_0x2354('0x39')]=_0x5cab24[_0x2354('0x3a')];if(_0x5cab24['disposition']=='ANSWERED'){_0x5cab24[_0x2354('0x1f')]=_0x5cab24[_0x2354('0x26')];}else{_0x5cab24[_0x2354('0x1f')]='';}}}}else{_0x5cab24[_0x2354('0x3d')]=util[_0x2354('0x22')](_0x2354('0x3e'),_0x5cab24[_0x2354('0x3f')],_0x5cab24[_0x2354('0x39')]);}if(RpcVoiceTransferReport[_0x2354('0x40')][_0x5cab24[_0x2354('0x41')]]){var _0x4dffdf=RpcVoiceTransferReport['transfers'][_0x5cab24[_0x2354('0x41')]];_0x4dffdf[_0x2354('0x42')]=_0x5cab24[_0x2354('0x43')];RpcVoiceTransferReport[_0x2354('0x1a')](_0x4dffdf);delete RpcVoiceTransferReport['transfers'][_0x5cab24[_0x2354('0x41')]];}RpcVoiceCallReport[_0x2354('0x2e')](_0x5cab24);if(_0x5cab24[_0x2354('0x44')]){for(var _0x37d77e=0x0;_0x37d77e<_0x5cab24[_0x2354('0x45')][_0x2354('0x25')];_0x37d77e+=0x1){_0x5cab24['monitorFilename']=_0x5cab24[_0x2354('0x45')][_0x37d77e][_0x2354('0x46')];_0x5cab24['createdAt']=_0x5cab24['monitors'][_0x37d77e][_0x2354('0x47')];if(_0x5cab24[_0x2354('0x31')]==_0x2354('0x37')){_0x5cab24['calleridnum']=_0x5cab24[_0x2354('0x26')];_0x5cab24[_0x2354('0x3f')]=_0x5cab24[_0x2354('0x48')];_0x5cab24['connectedlinenum']=_0x5cab24['accountcode'];_0x5cab24[_0x2354('0x48')]=_0x5cab24[_0x2354('0x49')];_0x5cab24[_0x2354('0x31')]=_0x5cab24[_0x2354('0x3a')];}else if(_0x5cab24[_0x2354('0x31')]==_0x2354('0x4a')){_0x5cab24[_0x2354('0x39')]=_0x5cab24['destination'];_0x5cab24['exten']=_0x5cab24[_0x2354('0x3a')];}RpcVoiceRecording[_0x2354('0x2e')](_0x5cab24);}}};Report[_0x2354('0xf')][_0x2354('0x17')]=function(_0x447d9f){if(_['isArray'](_0x447d9f)){_0x447d9f[_0x2354('0x4b')](function(_0x57c41d){RpcVoiceAgentReport['create'](_0x57c41d);});}else{RpcVoiceAgentReport[_0x2354('0x2e')](_0x447d9f);}};Report[_0x2354('0xf')]['voiceDialReport']=function(_0x3d7c0b){RpcVoiceDialReport[_0x2354('0x2e')](_0x3d7c0b);var _0x15d30d;var _0x1d785b;var _0x4eafab=_0x3d7c0b[_0x2354('0x3c')];if(_[_0x2354('0x4c')](_0x4eafab,'Local')){_0x1d785b=_0x4eafab['substring'](_0x4eafab['indexOf']('/')+0x1,_0x4eafab[_0x2354('0x4d')]('@'));_0x15d30d=_[_0x2354('0x1e')](this['agents'],function(_0x279679){return _0x279679[_0x2354('0x4e')]==_0x1d785b||_0x279679[_0x2354('0x4f')]==_0x1d785b||_0x279679[_0x2354('0x1f')]==_0x1d785b;});}else{_0x1d785b=_0x4eafab[_0x2354('0x50')](_0x4eafab[_0x2354('0x4d')]('/')+0x1,_0x4eafab[_0x2354('0x51')]('-'));_0x15d30d=this[_0x2354('0x1d')](_0x1d785b);}if(_0x15d30d){_0x3d7c0b[_0x2354('0x21')]=_[_0x2354('0x29')](_0x15d30d[_0x2354('0x21')])?util[_0x2354('0x22')](_0x2354('0x23'),_0x15d30d[_0x2354('0x20')]):_0x15d30d[_0x2354('0x21')];_0x3d7c0b[_0x2354('0x49')]=_0x15d30d['name'];_0x3d7c0b[_0x2354('0x1f')]=_0x15d30d[_0x2354('0x1f')];RpcMemberReport[_0x2354('0x19')](_0x3d7c0b);}};Report[_0x2354('0xf')]['blindTransfer']=function(_0x97dca8){RpcVoiceTransferReport['transfers'][_0x97dca8[_0x2354('0x52')]]=_0x97dca8;};Report[_0x2354('0xf')][_0x2354('0x1c')]=function(_0x41e8df){RpcVoiceTransferReport[_0x2354('0x1c')](_0x41e8df);};module[_0x2354('0x53')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 9931723..4e09bc2 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 _0xee71=['../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','error','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','syncDeviceState','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','ioredis','bluebird','../../../config/environment','ami'];(function(_0x196d9e,_0x50ecf3){var _0x2235e0=function(_0x1adb58){while(--_0x1adb58){_0x196d9e['push'](_0x196d9e['shift']());}};_0x2235e0(++_0x50ecf3);}(_0xee71,0x1ce));var _0x1ee7=function(_0x1034bd,_0x26ef9f){_0x1034bd=_0x1034bd-0x0;var _0x5e6214=_0xee71[_0x1034bd];return _0x5e6214;};'use strict';var _=require(_0x1ee7('0x0'));var moment=require(_0x1ee7('0x1'));var util=require('util');var Redis=require(_0x1ee7('0x2'));var BPromise=require(_0x1ee7('0x3'));var config=require(_0x1ee7('0x4'));var logger=require('../../../config/logger')(_0x1ee7('0x5'));var ami=require(_0x1ee7('0x6'));config['redis']=_[_0x1ee7('0x7')](config[_0x1ee7('0x8')],{'host':_0x1ee7('0x9'),'port':0x18eb});var io=require(_0x1ee7('0xa'))(new Redis(config[_0x1ee7('0x8')]));function UserReport(_0x42a475){this[_0x1ee7('0xb')]=_0x42a475[_0x1ee7('0xb')];this['agents']=_0x42a475[_0x1ee7('0xc')];this[_0x1ee7('0xd')]=_0x42a475[_0x1ee7('0xd')];ami['on'](_0x1ee7('0xe'),this[_0x1ee7('0xf')]['bind'](this));ami['on']('registry',this[_0x1ee7('0xf')][_0x1ee7('0x10')](this));ami['on'](_0x1ee7('0x11'),this['syncDeviceState'][_0x1ee7('0x10')](this));ami['on'](_0x1ee7('0x12'),this[_0x1ee7('0x13')][_0x1ee7('0x10')](this));return this[_0x1ee7('0x14')]();}function showSipRegistrations(){Promise[_0x1ee7('0x15')]()[_0x1ee7('0x16')](ami[_0x1ee7('0x17')]())['catch'](function(_0x58eacd){logger['error'](_0x1ee7('0x18'),util[_0x1ee7('0x19')](_0x58eacd,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1ee7('0x15')]()[_0x1ee7('0x16')](ami[_0x1ee7('0x1a')]())[_0x1ee7('0x1b')](function(_0x1418d9){logger[_0x1ee7('0x1c')](_0x1ee7('0x1d'),util[_0x1ee7('0x19')](_0x1418d9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x1ee7('0x15')]()[_0x1ee7('0x16')](ami['actionSipPeerStatus']())[_0x1ee7('0x1b')](function(_0x16a924){logger[_0x1ee7('0x1c')](_0x1ee7('0x1e'),util[_0x1ee7('0x19')](_0x16a924,{'showHidden':![],'depth':null}));});}UserReport[_0x1ee7('0x1f')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0x1ee7('0x16')](showSipRegistrations())[_0x1ee7('0x16')](listDeviceStates())[_0x1ee7('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x1ee7('0x1f')]['isNotNull']=function(_0x412da7){return _0x412da7!==null&&!_[_0x1ee7('0x20')](_0x412da7);};UserReport[_0x1ee7('0x1f')]['emit']=function(_0x4f119d,_0x2ef402,_0xaa3c9){io['to'](_0x4f119d)[_0x1ee7('0x21')](_0x2ef402,_0xaa3c9);};UserReport[_0x1ee7('0x1f')][_0x1ee7('0xf')]=function(_0x34dc1b){try{if(this[_0x1ee7('0x22')](_0x34dc1b)){logger[_0x1ee7('0x23')](_0x1ee7('0x24'),_0x34dc1b['username'],_0x34dc1b[_0x1ee7('0x25')]);logger[_0x1ee7('0x26')](_0x1ee7('0x27'),util[_0x1ee7('0x19')](_0x34dc1b,{'showHidden':![],'depth':null}));var _0x42aad4=_[_0x1ee7('0x28')](this[_0x1ee7('0xb')],{'defaultuser':_0x34dc1b[_0x1ee7('0x29')]});if(_0x42aad4){_0x34dc1b[_0x1ee7('0x2a')]=_0x34dc1b['state'];_[_0x1ee7('0x2b')](_0x42aad4,_[_0x1ee7('0x2c')](_0x34dc1b,[_0x1ee7('0x2d'),_0x1ee7('0x2e'),_0x1ee7('0x29'),_0x1ee7('0x25')]));logger[_0x1ee7('0x26')](_0x1ee7('0x2f'),util[_0x1ee7('0x19')](_0x42aad4,{'showHidden':![],'depth':null}));this[_0x1ee7('0x21')](util[_0x1ee7('0x30')](_0x1ee7('0x31'),_0x42aad4[_0x1ee7('0x32')]),'trunk:save',_0x42aad4);}}}catch(_0x2a8813){logger[_0x1ee7('0x1c')](_0x1ee7('0x27'),util[_0x1ee7('0x19')](_0x2a8813,{'showHidden':![],'depth':null}));}};UserReport[_0x1ee7('0x1f')][_0x1ee7('0x33')]=function(_0xe4f968){try{if(this[_0x1ee7('0x22')](_0xe4f968)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0xe4f968[_0x1ee7('0x34')],_0xe4f968['state']);logger[_0x1ee7('0x26')](_0x1ee7('0x35'),util['inspect'](_0xe4f968,{'showHidden':![],'depth':null}));if(this[_0x1ee7('0xc')][_0xe4f968[_0x1ee7('0x34')]]){if(!this[_0x1ee7('0xc')][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x36')]||_0xe4f968[_0x1ee7('0x25')][_0x1ee7('0x37')]()==_0x1ee7('0x38')){this[_0x1ee7('0xc')][_0xe4f968['device']][_0x1ee7('0x36')]=![];if(this[_0x1ee7('0xc')][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x25')]!==_0xe4f968[_0x1ee7('0x25')][_0x1ee7('0x37')]()){this[_0x1ee7('0xc')][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x39')]=_[_0x1ee7('0x3a')](moment()[_0x1ee7('0x30')]('x'));}this[_0x1ee7('0xc')][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x25')]=_0xe4f968[_0x1ee7('0x25')]['toLowerCase']();this['agents'][_0xe4f968['device']]['updateStatusRealtime'](_0xe4f968);}}else if(this[_0x1ee7('0xd')][_0xe4f968[_0x1ee7('0x34')]]){if(this['telephones'][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x25')]!==_0xe4f968[_0x1ee7('0x25')][_0x1ee7('0x37')]()){this[_0x1ee7('0xd')][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x39')]=_['toNumber'](moment()[_0x1ee7('0x30')]('x'));}this['telephones'][_0xe4f968[_0x1ee7('0x34')]]['state']=_0xe4f968['state'][_0x1ee7('0x37')]();logger[_0x1ee7('0x26')](_0x1ee7('0x3b'),util[_0x1ee7('0x19')](this[_0x1ee7('0xd')][_0xe4f968[_0x1ee7('0x34')]],{'showHidden':![],'depth':null}));this[_0x1ee7('0x21')](util[_0x1ee7('0x30')](_0x1ee7('0x3c'),this[_0x1ee7('0xd')][_0xe4f968['device']][_0x1ee7('0x32')]),_0x1ee7('0x3d'),this[_0x1ee7('0xd')][_0xe4f968['device']]);}else if(this[_0x1ee7('0xb')][_0xe4f968[_0x1ee7('0x34')]]){if(this[_0x1ee7('0xb')][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x25')]!==_0xe4f968[_0x1ee7('0x25')][_0x1ee7('0x37')]()){this[_0x1ee7('0xb')][_0xe4f968['device']][_0x1ee7('0x39')]=_['toNumber'](moment()[_0x1ee7('0x30')]('x'));}this[_0x1ee7('0xb')][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x25')]=_0xe4f968['state']['toLowerCase']();logger[_0x1ee7('0x26')](_0x1ee7('0x3e'),util[_0x1ee7('0x19')](this[_0x1ee7('0xb')][_0xe4f968['device']],{'showHidden':![],'depth':null}));this[_0x1ee7('0x21')](util['format'](_0x1ee7('0x31'),this[_0x1ee7('0xb')][_0xe4f968[_0x1ee7('0x34')]][_0x1ee7('0x32')]),_0x1ee7('0x3f'),this[_0x1ee7('0xb')][_0xe4f968[_0x1ee7('0x34')]]);}else if(_['startsWith'](_0xe4f968[_0x1ee7('0x34')],_0x1ee7('0x40'))){var _0x23b310=_0xe4f968[_0x1ee7('0x34')];var _0x3307eb=_0x23b310[_0x1ee7('0x41')](_0x23b310[_0x1ee7('0x42')]('/')+0x1,_0x23b310[_0x1ee7('0x42')]('@'));var _0x346267=_[_0x1ee7('0x28')](this[_0x1ee7('0xc')],function(_0x14cecb){return _0x14cecb[_0x1ee7('0x43')]==_0x3307eb||_0x14cecb[_0x1ee7('0x44')]==_0x3307eb||_0x14cecb[_0x1ee7('0x45')]==_0x3307eb;});if(_0x346267){if(_0x346267[_0x1ee7('0x25')]!==_0xe4f968[_0x1ee7('0x25')]['toLowerCase']()){_0x346267['stateTime']=_[_0x1ee7('0x3a')](moment()[_0x1ee7('0x30')]('x'));}_0x346267['state']=_0xe4f968[_0x1ee7('0x25')][_0x1ee7('0x37')]();_0x346267[_0x1ee7('0x36')]=!![];_0x346267[_0x1ee7('0x46')](_0xe4f968);}}}}catch(_0x4ef4c6){logger['error'](_0x1ee7('0x35'),util[_0x1ee7('0x19')](_0x4ef4c6,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x1ee7('0x13')]=function(_0x540227){try{if(this[_0x1ee7('0x22')](_0x540227)&&this[_0x1ee7('0x22')](_0x540227['peerstatus'])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x540227[_0x1ee7('0x47')],_0x540227[_0x1ee7('0x48')],_0x540227[_0x1ee7('0x12')]);logger[_0x1ee7('0x26')](_0x1ee7('0x49'),util[_0x1ee7('0x19')](_0x540227,{'showHidden':![],'depth':null}));if(this[_0x1ee7('0xc')][_0x540227[_0x1ee7('0x47')]]){if(!this[_0x1ee7('0xc')][_0x540227['peer']]['local']||_0x540227['peerstatus'][_0x1ee7('0x37')]()==_0x1ee7('0x4a')){this[_0x1ee7('0xc')][_0x540227[_0x1ee7('0x47')]][_0x1ee7('0x36')]=![];this[_0x1ee7('0xc')][_0x540227[_0x1ee7('0x47')]]['status']=_0x540227[_0x1ee7('0x12')]['toLowerCase']();this[_0x1ee7('0xc')][_0x540227[_0x1ee7('0x47')]][_0x1ee7('0x48')]=_0x540227[_0x1ee7('0x48')];this[_0x1ee7('0xc')][_0x540227['peer']][_0x1ee7('0x46')](_0x540227);}}else if(this[_0x1ee7('0xd')][_0x540227['peer']]){this['telephones'][_0x540227['peer']][_0x1ee7('0x4b')]=_0x540227['peerstatus'][_0x1ee7('0x37')]();this['telephones'][_0x540227[_0x1ee7('0x47')]][_0x1ee7('0x48')]=_0x540227['address'];logger[_0x1ee7('0x26')](_0x1ee7('0x4c'),util[_0x1ee7('0x19')](this[_0x1ee7('0xd')][_0x540227[_0x1ee7('0x47')]],{'showHidden':![],'depth':null}));this[_0x1ee7('0x21')](util[_0x1ee7('0x30')](_0x1ee7('0x3c'),this['telephones'][_0x540227[_0x1ee7('0x47')]][_0x1ee7('0x32')]),_0x1ee7('0x3d'),this['telephones'][_0x540227[_0x1ee7('0x47')]]);}else if(this[_0x1ee7('0xb')][_0x540227[_0x1ee7('0x47')]]){this[_0x1ee7('0xb')][_0x540227[_0x1ee7('0x47')]][_0x1ee7('0x4b')]=_0x540227[_0x1ee7('0x12')]['toLowerCase']();this[_0x1ee7('0xb')][_0x540227[_0x1ee7('0x47')]][_0x1ee7('0x48')]=_0x540227[_0x1ee7('0x48')];logger[_0x1ee7('0x26')](_0x1ee7('0x4d'),util[_0x1ee7('0x19')](this['trunks'][_0x540227[_0x1ee7('0x47')]],{'showHidden':![],'depth':null}));this[_0x1ee7('0x21')](util[_0x1ee7('0x30')]('trunk:%s',this['trunks'][_0x540227[_0x1ee7('0x47')]][_0x1ee7('0x32')]),_0x1ee7('0x3f'),this[_0x1ee7('0xb')][_0x540227['peer']]);}}}catch(_0xae4a85){logger[_0x1ee7('0x1c')](_0x1ee7('0x49'),util[_0x1ee7('0x19')](_0xae4a85,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xeb44=['telephone:%s','telephone:save','[userReport][peerstatus]','util','ioredis','../../../config/environment','ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','then','catch','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','state','debug','find','username','stateRegistry','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','peer','registered','status'];(function(_0x4f26e5,_0x4aa9b4){var _0x4827b4=function(_0x42a10a){while(--_0x42a10a){_0x4f26e5['push'](_0x4f26e5['shift']());}};_0x4827b4(++_0x4aa9b4);}(_0xeb44,0x1ad));var _0x4eb4=function(_0x5b669e,_0x59ac43){_0x5b669e=_0x5b669e-0x0;var _0x3cf592=_0xeb44[_0x5b669e];return _0x3cf592;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x4eb4('0x0'));var Redis=require(_0x4eb4('0x1'));var BPromise=require('bluebird');var config=require(_0x4eb4('0x2'));var logger=require('../../../config/logger')(_0x4eb4('0x3'));var ami=require('../ami');config[_0x4eb4('0x4')]=_[_0x4eb4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4eb4('0x6'))(new Redis(config[_0x4eb4('0x4')]));function UserReport(_0x1641f8){this[_0x4eb4('0x7')]=_0x1641f8['trunks'];this[_0x4eb4('0x8')]=_0x1641f8[_0x4eb4('0x8')];this[_0x4eb4('0x9')]=_0x1641f8[_0x4eb4('0x9')];ami['on'](_0x4eb4('0xa'),this[_0x4eb4('0xb')][_0x4eb4('0xc')](this));ami['on'](_0x4eb4('0xd'),this['syncRegistry'][_0x4eb4('0xc')](this));ami['on']('devicestatechange',this[_0x4eb4('0xe')][_0x4eb4('0xc')](this));ami['on'](_0x4eb4('0xf'),this[_0x4eb4('0x10')][_0x4eb4('0xc')](this));return this[_0x4eb4('0x11')]();}function showSipRegistrations(){Promise[_0x4eb4('0x12')]()['then'](ami[_0x4eb4('0x13')]())['catch'](function(_0xadec77){logger[_0x4eb4('0x14')](_0x4eb4('0x15'),util[_0x4eb4('0x16')](_0xadec77,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x4eb4('0x12')]()[_0x4eb4('0x17')](ami['actionDeviceStateList']())[_0x4eb4('0x18')](function(_0x2357b9){logger['error'](_0x4eb4('0x19'),util['inspect'](_0x2357b9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x4eb4('0x12')]()[_0x4eb4('0x17')](ami[_0x4eb4('0x1a')]())[_0x4eb4('0x18')](function(_0x3f8c90){logger[_0x4eb4('0x14')](_0x4eb4('0x1b'),util['inspect'](_0x3f8c90,{'showHidden':![],'depth':null}));});}UserReport[_0x4eb4('0x1c')][_0x4eb4('0x11')]=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())[_0x4eb4('0x17')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x4eb4('0x1d')]=function(_0x24c74a){return _0x24c74a!==null&&!_[_0x4eb4('0x1e')](_0x24c74a);};UserReport[_0x4eb4('0x1c')][_0x4eb4('0x1f')]=function(_0x37fcbd,_0x39643b,_0xa6262e){io['to'](_0x37fcbd)[_0x4eb4('0x1f')](_0x39643b,_0xa6262e);};UserReport[_0x4eb4('0x1c')][_0x4eb4('0xb')]=function(_0xdb681f){try{if(this['isNotNull'](_0xdb681f)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0xdb681f['username'],_0xdb681f[_0x4eb4('0x20')]);logger[_0x4eb4('0x21')]('[userReport][registry]',util[_0x4eb4('0x16')](_0xdb681f,{'showHidden':![],'depth':null}));var _0x26d4b7=_[_0x4eb4('0x22')](this['trunks'],{'defaultuser':_0xdb681f[_0x4eb4('0x23')]});if(_0x26d4b7){_0xdb681f[_0x4eb4('0x24')]=_0xdb681f[_0x4eb4('0x20')];_[_0x4eb4('0x25')](_0x26d4b7,_['omit'](_0xdb681f,[_0x4eb4('0x26'),_0x4eb4('0x27'),_0x4eb4('0x23'),_0x4eb4('0x20')]));logger[_0x4eb4('0x21')](_0x4eb4('0x28'),util[_0x4eb4('0x16')](_0x26d4b7,{'showHidden':![],'depth':null}));this[_0x4eb4('0x1f')](util[_0x4eb4('0x29')](_0x4eb4('0x2a'),_0x26d4b7[_0x4eb4('0x2b')]),_0x4eb4('0x2c'),_0x26d4b7);}}}catch(_0x5bc4f1){logger[_0x4eb4('0x14')](_0x4eb4('0x2d'),util[_0x4eb4('0x16')](_0x5bc4f1,{'showHidden':![],'depth':null}));}};UserReport[_0x4eb4('0x1c')]['syncDeviceState']=function(_0x34a766){try{if(this[_0x4eb4('0x1d')](_0x34a766)){logger[_0x4eb4('0x2e')](_0x4eb4('0x2f'),_0x34a766[_0x4eb4('0x30')],_0x34a766[_0x4eb4('0x20')]);logger[_0x4eb4('0x21')](_0x4eb4('0x31'),util[_0x4eb4('0x16')](_0x34a766,{'showHidden':![],'depth':null}));if(this[_0x4eb4('0x8')][_0x34a766[_0x4eb4('0x30')]]){if(!this['agents'][_0x34a766[_0x4eb4('0x30')]][_0x4eb4('0x32')]||_0x34a766[_0x4eb4('0x20')][_0x4eb4('0x33')]()=='inuse'){this[_0x4eb4('0x8')][_0x34a766['device']][_0x4eb4('0x32')]=![];if(this[_0x4eb4('0x8')][_0x34a766[_0x4eb4('0x30')]][_0x4eb4('0x20')]!==_0x34a766[_0x4eb4('0x20')][_0x4eb4('0x33')]()){this[_0x4eb4('0x8')][_0x34a766[_0x4eb4('0x30')]][_0x4eb4('0x34')]=_[_0x4eb4('0x35')](moment()[_0x4eb4('0x29')]('x'));}this[_0x4eb4('0x8')][_0x34a766[_0x4eb4('0x30')]][_0x4eb4('0x20')]=_0x34a766['state'][_0x4eb4('0x33')]();this[_0x4eb4('0x8')][_0x34a766[_0x4eb4('0x30')]][_0x4eb4('0x36')](_0x34a766);}}else if(this[_0x4eb4('0x9')][_0x34a766['device']]){if(this[_0x4eb4('0x9')][_0x34a766[_0x4eb4('0x30')]]['state']!==_0x34a766[_0x4eb4('0x20')][_0x4eb4('0x33')]()){this[_0x4eb4('0x9')][_0x34a766[_0x4eb4('0x30')]]['stateTime']=_[_0x4eb4('0x35')](moment()[_0x4eb4('0x29')]('x'));}this[_0x4eb4('0x9')][_0x34a766[_0x4eb4('0x30')]]['state']=_0x34a766[_0x4eb4('0x20')][_0x4eb4('0x33')]();logger['debug'](_0x4eb4('0x37'),util[_0x4eb4('0x16')](this[_0x4eb4('0x9')][_0x34a766[_0x4eb4('0x30')]],{'showHidden':![],'depth':null}));this[_0x4eb4('0x1f')](util['format']('telephone:%s',this['telephones'][_0x34a766[_0x4eb4('0x30')]][_0x4eb4('0x2b')]),'telephone:save',this[_0x4eb4('0x9')][_0x34a766[_0x4eb4('0x30')]]);}else if(this[_0x4eb4('0x7')][_0x34a766[_0x4eb4('0x30')]]){if(this[_0x4eb4('0x7')][_0x34a766['device']]['state']!==_0x34a766[_0x4eb4('0x20')][_0x4eb4('0x33')]()){this['trunks'][_0x34a766[_0x4eb4('0x30')]]['stateTime']=_[_0x4eb4('0x35')](moment()[_0x4eb4('0x29')]('x'));}this['trunks'][_0x34a766[_0x4eb4('0x30')]][_0x4eb4('0x20')]=_0x34a766['state'][_0x4eb4('0x33')]();logger[_0x4eb4('0x21')](_0x4eb4('0x38'),util[_0x4eb4('0x16')](this[_0x4eb4('0x7')][_0x34a766[_0x4eb4('0x30')]],{'showHidden':![],'depth':null}));this[_0x4eb4('0x1f')](util[_0x4eb4('0x29')](_0x4eb4('0x2a'),this[_0x4eb4('0x7')][_0x34a766[_0x4eb4('0x30')]][_0x4eb4('0x2b')]),_0x4eb4('0x2c'),this[_0x4eb4('0x7')][_0x34a766[_0x4eb4('0x30')]]);}else if(_['startsWith'](_0x34a766['device'],_0x4eb4('0x39'))){var _0x4a6b0c=_0x34a766[_0x4eb4('0x30')];var _0x4d87cd=_0x4a6b0c[_0x4eb4('0x3a')](_0x4a6b0c['indexOf']('/')+0x1,_0x4a6b0c[_0x4eb4('0x3b')]('@'));var _0x468041=_[_0x4eb4('0x22')](this[_0x4eb4('0x8')],function(_0x33562c){return _0x33562c[_0x4eb4('0x3c')]==_0x4d87cd||_0x33562c[_0x4eb4('0x3d')]==_0x4d87cd||_0x33562c[_0x4eb4('0x3e')]==_0x4d87cd;});if(_0x468041){if(_0x468041[_0x4eb4('0x20')]!==_0x34a766[_0x4eb4('0x20')][_0x4eb4('0x33')]()){_0x468041[_0x4eb4('0x34')]=_[_0x4eb4('0x35')](moment()['format']('x'));}_0x468041['state']=_0x34a766['state'][_0x4eb4('0x33')]();_0x468041[_0x4eb4('0x32')]=!![];_0x468041[_0x4eb4('0x36')](_0x34a766);}}}}catch(_0x5d7c53){logger[_0x4eb4('0x14')](_0x4eb4('0x31'),util[_0x4eb4('0x16')](_0x5d7c53,{'showHidden':![],'depth':null}));}};UserReport[_0x4eb4('0x1c')][_0x4eb4('0x10')]=function(_0x460fe7){try{if(this['isNotNull'](_0x460fe7)&&this['isNotNull'](_0x460fe7[_0x4eb4('0xf')])){logger[_0x4eb4('0x2e')](_0x4eb4('0x3f'),_0x460fe7['peer'],_0x460fe7[_0x4eb4('0x40')],_0x460fe7[_0x4eb4('0xf')]);logger['debug']('[userReport][peerstatus]',util[_0x4eb4('0x16')](_0x460fe7,{'showHidden':![],'depth':null}));if(this['agents'][_0x460fe7[_0x4eb4('0x41')]]){if(!this[_0x4eb4('0x8')][_0x460fe7[_0x4eb4('0x41')]][_0x4eb4('0x32')]||_0x460fe7[_0x4eb4('0xf')][_0x4eb4('0x33')]()==_0x4eb4('0x42')){this[_0x4eb4('0x8')][_0x460fe7[_0x4eb4('0x41')]][_0x4eb4('0x32')]=![];this[_0x4eb4('0x8')][_0x460fe7['peer']][_0x4eb4('0x43')]=_0x460fe7[_0x4eb4('0xf')][_0x4eb4('0x33')]();this[_0x4eb4('0x8')][_0x460fe7[_0x4eb4('0x41')]][_0x4eb4('0x40')]=_0x460fe7[_0x4eb4('0x40')];this['agents'][_0x460fe7[_0x4eb4('0x41')]][_0x4eb4('0x36')](_0x460fe7);}}else if(this[_0x4eb4('0x9')][_0x460fe7[_0x4eb4('0x41')]]){this[_0x4eb4('0x9')][_0x460fe7['peer']][_0x4eb4('0x43')]=_0x460fe7[_0x4eb4('0xf')]['toLowerCase']();this[_0x4eb4('0x9')][_0x460fe7[_0x4eb4('0x41')]]['address']=_0x460fe7[_0x4eb4('0x40')];logger[_0x4eb4('0x21')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x4eb4('0x16')](this[_0x4eb4('0x9')][_0x460fe7[_0x4eb4('0x41')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x4eb4('0x29')](_0x4eb4('0x44'),this[_0x4eb4('0x9')][_0x460fe7['peer']][_0x4eb4('0x2b')]),_0x4eb4('0x45'),this[_0x4eb4('0x9')][_0x460fe7[_0x4eb4('0x41')]]);}else if(this[_0x4eb4('0x7')][_0x460fe7['peer']]){this[_0x4eb4('0x7')][_0x460fe7[_0x4eb4('0x41')]][_0x4eb4('0x43')]=_0x460fe7['peerstatus'][_0x4eb4('0x33')]();this[_0x4eb4('0x7')][_0x460fe7['peer']][_0x4eb4('0x40')]=_0x460fe7['address'];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0x4eb4('0x7')][_0x460fe7[_0x4eb4('0x41')]],{'showHidden':![],'depth':null}));this[_0x4eb4('0x1f')](util[_0x4eb4('0x29')](_0x4eb4('0x2a'),this[_0x4eb4('0x7')][_0x460fe7[_0x4eb4('0x41')]]['name']),_0x4eb4('0x2c'),this[_0x4eb4('0x7')][_0x460fe7[_0x4eb4('0x41')]]);}}}catch(_0x243733){logger[_0x4eb4('0x14')](_0x4eb4('0x46'),util['inspect'](_0x243733,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 9353505..19585a9 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 _0xd6e4=['rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','diff','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','isNotNull','isUndefined','syncAgentCalled','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','queue','type','inbound','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','emit','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','lastevent','connect','merge','interface','pick','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','destconnectedlinenum','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','value','keys','variables','[%s][voiceAgentReport][varset]'];(function(_0x33c638,_0x462bff){var _0x18a079=function(_0x336610){while(--_0x336610){_0x33c638['push'](_0x33c638['shift']());}};_0x18a079(++_0x462bff);}(_0xd6e4,0x1ed));var _0x4d6e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd6e4[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x4d6e('0x0'));var moment=require(_0x4d6e('0x1'));var util=require(_0x4d6e('0x2'));var Redis=require(_0x4d6e('0x3'));var config=require(_0x4d6e('0x4'));var logger=require('../../../config/logger')(_0x4d6e('0x5'));var ami=require(_0x4d6e('0x6'));config['redis']=_[_0x4d6e('0x7')](config[_0x4d6e('0x8')],{'host':_0x4d6e('0x9'),'port':0x18eb});var io=require(_0x4d6e('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x42f6ee){this[_0x4d6e('0xb')]={};this[_0x4d6e('0xc')]=_0x42f6ee[_0x4d6e('0xc')];this[_0x4d6e('0xd')]=_0x42f6ee[_0x4d6e('0xd')];this['variables']={};ami['on']('agentcalled',this['syncAgentCalled'][_0x4d6e('0xe')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x4d6e('0xe')](this));ami['on'](_0x4d6e('0xf'),this[_0x4d6e('0x10')][_0x4d6e('0xe')](this));ami['on'](_0x4d6e('0x11'),this[_0x4d6e('0x12')][_0x4d6e('0xe')](this));ami['on'](_0x4d6e('0x13'),this[_0x4d6e('0x14')][_0x4d6e('0xe')](this));ami['on']('varset',this[_0x4d6e('0x15')][_0x4d6e('0xe')](this));ami['on']('hangup',this[_0x4d6e('0x16')][_0x4d6e('0xe')](this));ami['on'](_0x4d6e('0x17'),this[_0x4d6e('0x18')][_0x4d6e('0xe')](this));ami['on'](_0x4d6e('0x19'),this[_0x4d6e('0x1a')][_0x4d6e('0xe')](this));ami['on'](_0x4d6e('0x1b'),this[_0x4d6e('0x1c')][_0x4d6e('0xe')](this));ami['on']('blindtransfer',this[_0x4d6e('0x1d')]['bind'](this));}VoiceAgentReport[_0x4d6e('0x1e')]['emit']=function(_0x5bf428,_0x2458f2,_0x42a8d7){io['to'](_0x5bf428)['emit'](_0x2458f2,_0x42a8d7);};VoiceAgentReport[_0x4d6e('0x1e')][_0x4d6e('0x1f')]=function(_0x83bda8){return _0x83bda8!==null&&!_[_0x4d6e('0x20')](_0x83bda8);};VoiceAgentReport[_0x4d6e('0x1e')][_0x4d6e('0x21')]=function(_0x5c1fb4){try{if(this[_0x4d6e('0x1f')](_0x5c1fb4)){logger['info']('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x5c1fb4[_0x4d6e('0x22')],_0x5c1fb4[_0x4d6e('0x23')],_0x5c1fb4[_0x4d6e('0x24')]);logger[_0x4d6e('0x25')](_0x4d6e('0x26'),_0x5c1fb4['uniqueid'],util[_0x4d6e('0x27')](_0x5c1fb4,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x4d6e('0xb')][_0x5c1fb4['uniqueid']])){this[_0x4d6e('0xb')][_0x5c1fb4[_0x4d6e('0x22')]]={};}if(_[_0x4d6e('0x20')](this[_0x4d6e('0xb')][_0x5c1fb4[_0x4d6e('0x22')]][_0x5c1fb4[_0x4d6e('0x24')]])){this[_0x4d6e('0xb')][_0x5c1fb4['uniqueid']][_0x5c1fb4[_0x4d6e('0x24')]]={'agentcalledAt':moment()[_0x4d6e('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','mandatoryDisposition':this[_0x4d6e('0xc')][_0x5c1fb4[_0x4d6e('0x29')]]?this[_0x4d6e('0xc')][_0x5c1fb4['queue']]['mandatoryDisposition']||![]:![],'type':this[_0x4d6e('0xc')][_0x5c1fb4['queue']]?this[_0x4d6e('0xc')][_0x5c1fb4[_0x4d6e('0x29')]][_0x4d6e('0x2a')]||_0x4d6e('0x2b'):'inbound','variables':this['variables'][_0x5c1fb4[_0x4d6e('0x22')]]};}_['merge'](this[_0x4d6e('0xb')][_0x5c1fb4[_0x4d6e('0x22')]][_0x5c1fb4[_0x4d6e('0x24')]],_[_0x4d6e('0x2c')](_0x5c1fb4,[_0x4d6e('0x2d'),_0x4d6e('0x2e')]));logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x5c1fb4[_0x4d6e('0x22')],util[_0x4d6e('0x27')](this[_0x4d6e('0xb')][_0x5c1fb4[_0x4d6e('0x22')]][_0x5c1fb4[_0x4d6e('0x24')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',this[_0x4d6e('0xb')][_0x5c1fb4[_0x4d6e('0x22')]][_0x5c1fb4[_0x4d6e('0x24')]]);logger['debug'](_0x4d6e('0x2f'),_0x5c1fb4[_0x4d6e('0x22')],util['inspect'](this['channels'][_0x5c1fb4[_0x4d6e('0x22')]][_0x5c1fb4[_0x4d6e('0x24')]],{'showHidden':![],'depth':null}));this[_0x4d6e('0x30')](util[_0x4d6e('0x28')]('user:%s',_0x5c1fb4['membername']),_0x4d6e('0x31'),this['channels'][_0x5c1fb4[_0x4d6e('0x22')]][_0x5c1fb4['destuniqueid']]);}}catch(_0x58e5a6){logger[_0x4d6e('0x32')](_0x4d6e('0x33'),_0x5c1fb4['uniqueid'],util['inspect'](_0x58e5a6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4d6e('0x34')]=function(_0x52dfbb){try{if(this['isNotNull'](_0x52dfbb)){if(this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]]){logger['debug'](_0x4d6e('0x35'),_0x52dfbb[_0x4d6e('0x22')],util['inspect'](_0x52dfbb,{'showHidden':![],'depth':null}));for(var _0x560bae in this['channels'][_0x52dfbb[_0x4d6e('0x22')]]){if(this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x4d6e('0x36')](_0x560bae)){if(_0x52dfbb[_0x4d6e('0x24')]===_0x560bae){logger[_0x4d6e('0x37')](_0x4d6e('0x38'),_0x52dfbb[_0x4d6e('0x22')],_0x52dfbb['membername'],_0x52dfbb[_0x4d6e('0x24')]);this['channels'][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae][_0x4d6e('0x39')]=moment()[_0x4d6e('0x28')](_0x4d6e('0x3a'));this[_0x4d6e('0xb')][_0x52dfbb['uniqueid']][_0x560bae][_0x4d6e('0x3b')]=_0x52dfbb[_0x4d6e('0x3b')];this['channels'][_0x52dfbb['uniqueid']][_0x560bae]['connectedlinenum']=_0x52dfbb[_0x4d6e('0x3c')];this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae]['destchannelstate']=_0x52dfbb[_0x4d6e('0x3d')];this[_0x4d6e('0xb')][_0x52dfbb['uniqueid']][_0x560bae]['destchannelstatedesc']=_0x52dfbb[_0x4d6e('0x3e')];this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae]['holdtime']=_0x52dfbb['holdtime'];this['channels'][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae][_0x4d6e('0x3f')]=_0x4d6e('0x40');_[_0x4d6e('0x41')](this[_0x4d6e('0xd')][_0x52dfbb[_0x4d6e('0x42')]],_[_0x4d6e('0x43')](_0x52dfbb,['queue','destconnectedlinenum']));logger[_0x4d6e('0x25')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x52dfbb['uniqueid'],util[_0x4d6e('0x27')](this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x52dfbb[_0x4d6e('0x24')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4d6e('0x44'),this['channels'][_0x52dfbb[_0x4d6e('0x22')]][_0x52dfbb[_0x4d6e('0x24')]]);logger[_0x4d6e('0x25')](_0x4d6e('0x45'),_0x52dfbb[_0x4d6e('0x22')],util[_0x4d6e('0x27')](this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x52dfbb['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x4d6e('0x30')](util[_0x4d6e('0x28')]('user:%s',_0x52dfbb[_0x4d6e('0x23')]),'user:agentconnect',this['channels'][_0x52dfbb[_0x4d6e('0x22')]][_0x52dfbb['destuniqueid']]);}else if(!this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae][_0x4d6e('0xf')]&&!this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae]['agentcomplete']){logger[_0x4d6e('0x37')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x52dfbb[_0x4d6e('0x22')],this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae]['membername'],_0x560bae);this[_0x4d6e('0xb')][_0x52dfbb['uniqueid']][_0x560bae][_0x4d6e('0xf')]=!![];this['channels'][_0x52dfbb['uniqueid']][_0x560bae][_0x4d6e('0x46')]=moment()[_0x4d6e('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae][_0x4d6e('0x47')]=_0x52dfbb[_0x4d6e('0x24')];this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae][_0x4d6e('0x48')]=_0x52dfbb[_0x4d6e('0x23')];this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae][_0x4d6e('0x3f')]=_0x4d6e('0x49');this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae][_0x4d6e('0x4a')]=_0x4d6e('0x49');logger[_0x4d6e('0x25')](_0x4d6e('0x4b'),_0x52dfbb['uniqueid'],util[_0x4d6e('0x27')](this[_0x4d6e('0xb')][_0x52dfbb[_0x4d6e('0x22')]][_0x560bae],{'showHidden':![],'depth':null}));ami[_0x4d6e('0x30')](_0x4d6e('0x4c'),this[_0x4d6e('0xb')][_0x52dfbb['uniqueid']][_0x560bae]);}}}}}}catch(_0x42896d){logger['error'](_0x4d6e('0x4d'),_0x52dfbb[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x42896d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4d6e('0x10')]=function(_0x29f6b2){try{if(this[_0x4d6e('0x1f')](_0x29f6b2)){logger[_0x4d6e('0x25')](_0x4d6e('0x4e'),_0x29f6b2[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x29f6b2,{'showHidden':![],'depth':null}));if(this[_0x4d6e('0xb')][_0x29f6b2[_0x4d6e('0x22')]]&&this['channels'][_0x29f6b2[_0x4d6e('0x22')]][_0x29f6b2['destuniqueid']]){logger[_0x4d6e('0x37')](_0x4d6e('0x4f'),_0x29f6b2[_0x4d6e('0x22')],_0x29f6b2['membername'],_0x29f6b2[_0x4d6e('0x24')]);this['channels'][_0x29f6b2[_0x4d6e('0x22')]][_0x29f6b2['destuniqueid']][_0x4d6e('0xf')]=!![];this['channels'][_0x29f6b2['uniqueid']][_0x29f6b2[_0x4d6e('0x24')]][_0x4d6e('0x46')]=moment()['format'](_0x4d6e('0x3a'));this[_0x4d6e('0xb')][_0x29f6b2[_0x4d6e('0x22')]][_0x29f6b2[_0x4d6e('0x24')]]['lastevent']=_0x4d6e('0x50');this['channels'][_0x29f6b2[_0x4d6e('0x22')]][_0x29f6b2[_0x4d6e('0x24')]]['reason']='rejected';logger[_0x4d6e('0x25')](_0x4d6e('0x51'),_0x29f6b2['uniqueid'],util[_0x4d6e('0x27')](this[_0x4d6e('0xb')][_0x29f6b2['uniqueid']][_0x29f6b2[_0x4d6e('0x24')]],{'showHidden':![],'depth':null}));ami[_0x4d6e('0x30')]('custom:agentringnoanswer',this[_0x4d6e('0xb')][_0x29f6b2[_0x4d6e('0x22')]][_0x29f6b2['destuniqueid']]);}}}catch(_0x22fd0c){logger[_0x4d6e('0x32')]('[%s][voiceAgentReport][agentringnoanswer]',_0x29f6b2[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x22fd0c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4d6e('0x1e')][_0x4d6e('0x12')]=function(_0x12d8e2){try{if(this['isNotNull'](_0x12d8e2)){logger[_0x4d6e('0x25')](_0x4d6e('0x52'),_0x12d8e2[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x12d8e2,{'showHidden':![],'depth':null}));if(this['channels'][_0x12d8e2['uniqueid']]){for(var _0xc95797 in this[_0x4d6e('0xb')][_0x12d8e2['uniqueid']]){if(this[_0x4d6e('0xb')][_0x12d8e2[_0x4d6e('0x22')]]['hasOwnProperty'](_0xc95797)&&!this[_0x4d6e('0xb')][_0x12d8e2[_0x4d6e('0x22')]][_0xc95797][_0x4d6e('0xf')]&&!this[_0x4d6e('0xb')][_0x12d8e2[_0x4d6e('0x22')]][_0xc95797][_0x4d6e('0x13')]){logger[_0x4d6e('0x37')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x12d8e2[_0x4d6e('0x22')],this[_0x4d6e('0xb')][_0x12d8e2['uniqueid']][_0xc95797][_0x4d6e('0x23')],_0xc95797);this[_0x4d6e('0xb')][_0x12d8e2[_0x4d6e('0x22')]][_0xc95797][_0x4d6e('0xf')]=!![];this['channels'][_0x12d8e2[_0x4d6e('0x22')]][_0xc95797]['agentringnoanswerAt']=moment()['format'](_0x4d6e('0x3a'));this[_0x4d6e('0xb')][_0x12d8e2[_0x4d6e('0x22')]][_0xc95797][_0x4d6e('0x3f')]=_0x4d6e('0x53');this[_0x4d6e('0xb')][_0x12d8e2[_0x4d6e('0x22')]][_0xc95797]['reason']=_0x4d6e('0x53');logger[_0x4d6e('0x25')](_0x4d6e('0x54'),_0x12d8e2['uniqueid'],util[_0x4d6e('0x27')](this['channels'][_0x12d8e2[_0x4d6e('0x22')]][_0xc95797],{'showHidden':![],'depth':null}));ami[_0x4d6e('0x30')](_0x4d6e('0x55'),this[_0x4d6e('0xb')][_0x12d8e2[_0x4d6e('0x22')]][_0xc95797]);}}}}}catch(_0x2c9d0b){logger[_0x4d6e('0x32')](_0x4d6e('0x56'),_0x12d8e2[_0x4d6e('0x22')],util['inspect'](_0x2c9d0b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4d6e('0x1e')][_0x4d6e('0x14')]=function(_0x34e953){try{if(this[_0x4d6e('0x1f')](_0x34e953)){logger[_0x4d6e('0x25')](_0x4d6e('0x57'),_0x34e953[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x34e953,{'showHidden':![],'depth':null}));if(this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]]){for(var _0x51772a in this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]]){if(this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x4d6e('0x36')](_0x51772a)){if(this['channels'][_0x34e953[_0x4d6e('0x22')]][_0x51772a][_0x4d6e('0x39')]&&!this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x51772a][_0x4d6e('0x13')]){logger[_0x4d6e('0x37')](_0x4d6e('0x58'),_0x34e953['uniqueid'],this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x51772a]['membername'],_0x51772a);this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x51772a]['agentcomplete']=!![];this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x51772a][_0x4d6e('0x59')]=moment()[_0x4d6e('0x28')](_0x4d6e('0x3a'));this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x51772a][_0x4d6e('0x3f')]=_0x4d6e('0x5a');this[_0x4d6e('0xb')][_0x34e953['uniqueid']][_0x51772a]['reason']=_0x34e953[_0x4d6e('0x4a')]==_0x4d6e('0x5b')?_0x4d6e('0x5c'):_0x34e953[_0x4d6e('0x4a')];this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x51772a][_0x4d6e('0x5d')]=_0x34e953[_0x4d6e('0x5d')];if(this[_0x4d6e('0xc')][_0x34e953['queue']]&&this[_0x4d6e('0xc')][_0x34e953[_0x4d6e('0x29')]][_0x4d6e('0x5e')]){this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x51772a][_0x4d6e('0x5f')]=this['voiceQueues'][_0x34e953[_0x4d6e('0x29')]][_0x4d6e('0x60')];this['channels'][_0x34e953[_0x4d6e('0x22')]][_0x51772a][_0x4d6e('0x61')]=!![];}this['agents'][_0x34e953[_0x4d6e('0x42')]]=_[_0x4d6e('0x2c')](this[_0x4d6e('0xd')][_0x34e953[_0x4d6e('0x42')]],[_0x4d6e('0x29'),_0x4d6e('0x62')]);logger[_0x4d6e('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x34e953['uniqueid'],util[_0x4d6e('0x27')](this[_0x4d6e('0xb')][_0x34e953['uniqueid']][_0x51772a],{'showHidden':![],'depth':null}));ami[_0x4d6e('0x30')](_0x4d6e('0x63'),this['channels'][_0x34e953[_0x4d6e('0x22')]][_0x51772a]);logger['debug'](_0x4d6e('0x64'),_0x34e953[_0x4d6e('0x22')],util[_0x4d6e('0x27')](this['channels'][_0x34e953[_0x4d6e('0x22')]][_0x51772a],{'showHidden':![],'depth':null}));this[_0x4d6e('0x30')](util[_0x4d6e('0x28')](_0x4d6e('0x65'),_0x34e953[_0x4d6e('0x23')]),_0x4d6e('0x66'),this[_0x4d6e('0xb')][_0x34e953[_0x4d6e('0x22')]][_0x51772a]);}}}}}}catch(_0x1c208b){logger[_0x4d6e('0x32')](_0x4d6e('0x67'),_0x34e953['uniqueid'],util['inspect'](_0x1c208b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4d6e('0x15')]=function(_0x2e9517){try{if(this[_0x4d6e('0x1f')](_0x2e9517)){logger[_0x4d6e('0x25')](_0x4d6e('0x68'),_0x2e9517[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x2e9517,{'showHidden':![],'depth':null}));this[_0x4d6e('0x69')](_0x2e9517[_0x4d6e('0x22')],_['keys'](_0x2e9517[_0x4d6e('0x6a')])[0x0],_0x2e9517[_0x4d6e('0x6b')]);if(this[_0x4d6e('0xb')][_0x2e9517['uniqueid']]){for(var _0xf9cef0 in this['channels'][_0x2e9517['uniqueid']]){if(this['channels'][_0x2e9517['uniqueid']][_0x4d6e('0x36')](_0xf9cef0)){logger[_0x4d6e('0x37')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x2e9517['uniqueid'],_0xf9cef0,_[_0x4d6e('0x6c')](_0x2e9517[_0x4d6e('0x6a')])[0x0],_0x2e9517[_0x4d6e('0x6b')]);if(_['isUndefined'](this[_0x4d6e('0xb')][_0x2e9517['uniqueid']][_0xf9cef0]['variables'])){this[_0x4d6e('0xb')][_0x2e9517[_0x4d6e('0x22')]][_0xf9cef0][_0x4d6e('0x6d')]={};}this[_0x4d6e('0xb')][_0x2e9517[_0x4d6e('0x22')]][_0xf9cef0][_0x4d6e('0x6d')]=this['variables'][_0x2e9517[_0x4d6e('0x22')]];}}}}}catch(_0x14c16a){logger[_0x4d6e('0x32')](_0x4d6e('0x6e'),_0x2e9517[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x14c16a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0xce2e23,_0xd1ae87,_0xc77c1a){var _0x275b89=['rtpaudioqos','rtpaudioqosbridged',_0x4d6e('0x6f'),_0x4d6e('0x70'),_0x4d6e('0x71'),_0x4d6e('0x72'),_0x4d6e('0x73'),_0x4d6e('0x74'),_0x4d6e('0x75'),'sipuri',_0x4d6e('0x76'),'bridgepvtcallid',_0x4d6e('0x77'),'memberdynamic',_0x4d6e('0x78'),'memberlastcall',_0x4d6e('0x23'),_0x4d6e('0x79'),_0x4d6e('0x7a')];if(!_[_0x4d6e('0x7b')](_0xd1ae87)&&!_[_0x4d6e('0x7c')](_0x275b89,_0xd1ae87)){if(_[_0x4d6e('0x20')](this[_0x4d6e('0x6d')][_0xce2e23])){this[_0x4d6e('0x6d')][_0xce2e23]={};}this[_0x4d6e('0x6d')][_0xce2e23][_0xd1ae87]=_0xc77c1a;}};VoiceAgentReport[_0x4d6e('0x1e')][_0x4d6e('0x16')]=function(_0x47d28f){try{if(this[_0x4d6e('0x1f')](_0x47d28f)){logger[_0x4d6e('0x25')](_0x4d6e('0x7d'),_0x47d28f[_0x4d6e('0x22')],util['inspect'](_0x47d28f,{'showHidden':![],'depth':null}));if(this[_0x4d6e('0xb')][_0x47d28f[_0x4d6e('0x22')]]){for(var _0x3d763a in this[_0x4d6e('0xb')][_0x47d28f[_0x4d6e('0x22')]]){if(this[_0x4d6e('0xb')][_0x47d28f[_0x4d6e('0x22')]]['hasOwnProperty'](_0x3d763a)){if(this[_0x4d6e('0xb')][_0x47d28f[_0x4d6e('0x22')]][_0x3d763a][_0x4d6e('0x4a')]=='transfer'&&this[_0x4d6e('0xb')][_0x47d28f[_0x4d6e('0x22')]][_0x3d763a][_0x4d6e('0x13')]){logger[_0x4d6e('0x37')](_0x4d6e('0x7e'),_0x47d28f[_0x4d6e('0x22')],_0x3d763a);this[_0x4d6e('0xb')][_0x47d28f['uniqueid']][_0x3d763a]['agentcompleteAt']=moment()[_0x4d6e('0x28')](_0x4d6e('0x3a'));}}}logger[_0x4d6e('0x25')](_0x4d6e('0x7f'),_0x47d28f[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_[_0x4d6e('0x80')](this['channels'][_0x47d28f[_0x4d6e('0x22')]]),{'showHidden':![],'depth':null}));ami[_0x4d6e('0x30')](_0x4d6e('0x81'),_[_0x4d6e('0x80')](this[_0x4d6e('0xb')][_0x47d28f[_0x4d6e('0x22')]]));delete this[_0x4d6e('0xb')][_0x47d28f['uniqueid']];}if(this[_0x4d6e('0x6d')][_0x47d28f[_0x4d6e('0x22')]]){delete this[_0x4d6e('0x6d')][_0x47d28f[_0x4d6e('0x22')]];}}}catch(_0x364f0f){logger[_0x4d6e('0x32')](_0x4d6e('0x82'),_0x47d28f[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x364f0f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4d6e('0x1e')][_0x4d6e('0x1c')]=function(_0x5c2adc){try{if(this['isNotNull'](_0x5c2adc)){logger[_0x4d6e('0x25')](_0x4d6e('0x83'),_0x5c2adc[_0x4d6e('0x22')],util['inspect'](_0x5c2adc,{'showHidden':![],'depth':null}));if(this['channels'][_0x5c2adc[_0x4d6e('0x84')]]){for(var _0x1cc290 in this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x84')]]){if(this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x84')]]['hasOwnProperty'](_0x1cc290)){if(_0x5c2adc[_0x4d6e('0x85')]===_0x1cc290){logger['info'](_0x4d6e('0x86'),_0x5c2adc[_0x4d6e('0x22')],this[_0x4d6e('0xb')][_0x5c2adc['transfereeuniqueid']][_0x1cc290][_0x4d6e('0x23')],_0x1cc290);var _0x2167b9=moment();this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x84')]][_0x1cc290][_0x4d6e('0x13')]=!![];this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x84')]][_0x1cc290][_0x4d6e('0x59')]=moment()[_0x4d6e('0x28')](_0x4d6e('0x3a'));this['channels'][_0x5c2adc['transfereeuniqueid']][_0x1cc290][_0x4d6e('0x3f')]='complete';this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x84')]][_0x1cc290][_0x4d6e('0x4a')]='transfer';this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x84')]][_0x1cc290][_0x4d6e('0x5d')]=_0x2167b9['diff'](this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x84')]][_0x1cc290][_0x4d6e('0x39')],_0x4d6e('0x87'));}}}}if(this['channels'][_0x5c2adc[_0x4d6e('0x88')]]){var _0x4ba7b2=this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x88')]];this[_0x4d6e('0xb')][_0x5c2adc[_0x4d6e('0x88')]]=this['channels'][_0x5c2adc[_0x4d6e('0x84')]];this['channels'][_0x5c2adc[_0x4d6e('0x84')]]=_0x4ba7b2;}}}catch(_0x17f879){logger['error'](_0x4d6e('0x89'),_0x5c2adc[_0x4d6e('0x22')],util['inspect'](_0x17f879,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4d6e('0x1e')][_0x4d6e('0x1d')]=function(_0x3f2cf2){try{if(this[_0x4d6e('0x1f')](_0x3f2cf2)){logger[_0x4d6e('0x25')](_0x4d6e('0x8a'),_0x3f2cf2[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x3f2cf2,{'showHidden':![],'depth':null}));if(this[_0x4d6e('0xb')][_0x3f2cf2['transfereeuniqueid']]){for(var _0x409cf3 in this[_0x4d6e('0xb')][_0x3f2cf2['transfereeuniqueid']]){if(this['channels'][_0x3f2cf2[_0x4d6e('0x84')]][_0x4d6e('0x36')](_0x409cf3)){if(_0x3f2cf2[_0x4d6e('0x8b')]===_0x409cf3){logger[_0x4d6e('0x37')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3f2cf2['uniqueid'],this[_0x4d6e('0xb')][_0x3f2cf2[_0x4d6e('0x84')]][_0x409cf3][_0x4d6e('0x23')],_0x409cf3);var _0x11a213=moment();this[_0x4d6e('0xb')][_0x3f2cf2[_0x4d6e('0x84')]][_0x409cf3][_0x4d6e('0x13')]=!![];this['channels'][_0x3f2cf2[_0x4d6e('0x84')]][_0x409cf3][_0x4d6e('0x59')]=_0x11a213;this[_0x4d6e('0xb')][_0x3f2cf2[_0x4d6e('0x84')]][_0x409cf3]['lastevent']=_0x4d6e('0x5a');this[_0x4d6e('0xb')][_0x3f2cf2[_0x4d6e('0x84')]][_0x409cf3]['reason']=_0x4d6e('0x5b');this[_0x4d6e('0xb')][_0x3f2cf2['transfereeuniqueid']][_0x409cf3][_0x4d6e('0x5d')]=_0x11a213[_0x4d6e('0x8c')](this[_0x4d6e('0xb')][_0x3f2cf2[_0x4d6e('0x84')]][_0x409cf3][_0x4d6e('0x39')],_0x4d6e('0x87'));}}}}}}catch(_0x2d576f){logger[_0x4d6e('0x32')](_0x4d6e('0x8d'),_0x3f2cf2[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x2d576f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x407590){var _0x54debb='';try{if(this['isNotNull'](_0x407590)){logger[_0x4d6e('0x25')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x407590[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x407590,{'showHidden':![],'depth':null}));if(_0x407590[_0x4d6e('0x8e')]){_0x54debb=_0x407590[_0x4d6e('0x8e')][_0x4d6e('0x8f')](0x0,_0x407590[_0x4d6e('0x8e')][_0x4d6e('0x90')]('-'));if(this[_0x4d6e('0xd')][_0x54debb]){logger['info'](_0x4d6e('0x91'),_0x407590[_0x4d6e('0x22')],_0x54debb);this[_0x4d6e('0xd')][_0x54debb][_0x4d6e('0x92')]=!![];}}}}catch(_0x87c1a){logger['error'](_0x4d6e('0x93'),_0x407590[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x87c1a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4d6e('0x1e')][_0x4d6e('0x1a')]=function(_0x4dbf55){var _0x56d7be='';try{if(this['isNotNull'](_0x4dbf55)){logger[_0x4d6e('0x25')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x4dbf55[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x4dbf55,{'showHidden':![],'depth':null}));if(_0x4dbf55[_0x4d6e('0x8e')]){_0x56d7be=_0x4dbf55[_0x4d6e('0x8e')]['substring'](0x0,_0x4dbf55[_0x4d6e('0x8e')]['lastIndexOf']('-'));if(this[_0x4d6e('0xd')][_0x56d7be]){logger[_0x4d6e('0x37')](_0x4d6e('0x94'),_0x4dbf55[_0x4d6e('0x22')],_0x56d7be);this[_0x4d6e('0xd')][_0x56d7be]['onhold']=![];}}}}catch(_0x375ac4){logger[_0x4d6e('0x32')](_0x4d6e('0x95'),_0x4dbf55[_0x4d6e('0x22')],util[_0x4d6e('0x27')](_0x375ac4,{'showHidden':![],'depth':null}));}};module[_0x4d6e('0x96')]=VoiceAgentReport; \ No newline at end of file +var _0x2a32=['[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','hasOwnProperty','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','inspect','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned'];(function(_0x4d18e5,_0x3edb93){var _0x128d66=function(_0x31122c){while(--_0x31122c){_0x4d18e5['push'](_0x4d18e5['shift']());}};_0x128d66(++_0x3edb93);}(_0x2a32,0x1f2));var _0x22a3=function(_0x48cac8,_0x150d03){_0x48cac8=_0x48cac8-0x0;var _0x539232=_0x2a32[_0x48cac8];return _0x539232;};'use strict';var _=require(_0x22a3('0x0'));var moment=require(_0x22a3('0x1'));var util=require(_0x22a3('0x2'));var Redis=require(_0x22a3('0x3'));var config=require(_0x22a3('0x4'));var logger=require(_0x22a3('0x5'))('ami');var ami=require('../ami');config[_0x22a3('0x6')]=_[_0x22a3('0x7')](config[_0x22a3('0x6')],{'host':_0x22a3('0x8'),'port':0x18eb});var io=require(_0x22a3('0x9'))(new Redis(config[_0x22a3('0x6')]));function VoiceAgentReport(_0x357a49){this[_0x22a3('0xa')]={};this[_0x22a3('0xb')]=_0x357a49[_0x22a3('0xb')];this[_0x22a3('0xc')]=_0x357a49[_0x22a3('0xc')];this[_0x22a3('0xd')]={};ami['on']('agentcalled',this[_0x22a3('0xe')][_0x22a3('0xf')](this));ami['on'](_0x22a3('0x10'),this['syncAgentConnect'][_0x22a3('0xf')](this));ami['on'](_0x22a3('0x11'),this[_0x22a3('0x12')][_0x22a3('0xf')](this));ami['on']('queuecallerabandon',this[_0x22a3('0x13')][_0x22a3('0xf')](this));ami['on']('agentcomplete',this[_0x22a3('0x14')][_0x22a3('0xf')](this));ami['on'](_0x22a3('0x15'),this[_0x22a3('0x16')][_0x22a3('0xf')](this));ami['on'](_0x22a3('0x17'),this[_0x22a3('0x18')][_0x22a3('0xf')](this));ami['on']('musiconholdstart',this[_0x22a3('0x19')][_0x22a3('0xf')](this));ami['on'](_0x22a3('0x1a'),this[_0x22a3('0x1b')]['bind'](this));ami['on'](_0x22a3('0x1c'),this['syncAttendedTransfer'][_0x22a3('0xf')](this));ami['on'](_0x22a3('0x1d'),this[_0x22a3('0x1e')][_0x22a3('0xf')](this));}VoiceAgentReport[_0x22a3('0x1f')]['emit']=function(_0x1f9cee,_0x10c5fe,_0xe5afe0){io['to'](_0x1f9cee)[_0x22a3('0x20')](_0x10c5fe,_0xe5afe0);};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x21')]=function(_0x2130de){return _0x2130de!==null&&!_[_0x22a3('0x22')](_0x2130de);};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0xe')]=function(_0x3b9bdf){try{if(this[_0x22a3('0x21')](_0x3b9bdf)){logger[_0x22a3('0x23')](_0x22a3('0x24'),_0x3b9bdf[_0x22a3('0x25')],_0x3b9bdf[_0x22a3('0x26')],_0x3b9bdf['destuniqueid']);logger[_0x22a3('0x27')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x3b9bdf['uniqueid'],util[_0x22a3('0x28')](_0x3b9bdf,{'showHidden':![],'depth':null}));if(_[_0x22a3('0x22')](this['channels'][_0x3b9bdf[_0x22a3('0x25')]])){this[_0x22a3('0xa')][_0x3b9bdf['uniqueid']]={};}if(_[_0x22a3('0x22')](this[_0x22a3('0xa')][_0x3b9bdf['uniqueid']][_0x3b9bdf[_0x22a3('0x29')]])){this['channels'][_0x3b9bdf['uniqueid']][_0x3b9bdf['destuniqueid']]={'agentcalledAt':moment()[_0x22a3('0x2a')](_0x22a3('0x2b')),'lastevent':_0x22a3('0x2c'),'mandatoryDisposition':this['voiceQueues'][_0x3b9bdf[_0x22a3('0x2d')]]?this[_0x22a3('0xb')][_0x3b9bdf[_0x22a3('0x2d')]][_0x22a3('0x2e')]||![]:![],'type':this[_0x22a3('0xb')][_0x3b9bdf[_0x22a3('0x2d')]]?this[_0x22a3('0xb')][_0x3b9bdf[_0x22a3('0x2d')]]['type']||_0x22a3('0x2f'):'inbound','variables':this[_0x22a3('0xd')][_0x3b9bdf[_0x22a3('0x25')]]};}_[_0x22a3('0x30')](this[_0x22a3('0xa')][_0x3b9bdf[_0x22a3('0x25')]][_0x3b9bdf[_0x22a3('0x29')]],_[_0x22a3('0x31')](_0x3b9bdf,['event',_0x22a3('0x32')]));logger[_0x22a3('0x27')](_0x22a3('0x33'),_0x3b9bdf[_0x22a3('0x25')],util[_0x22a3('0x28')](this[_0x22a3('0xa')][_0x3b9bdf[_0x22a3('0x25')]][_0x3b9bdf[_0x22a3('0x29')]],{'showHidden':![],'depth':null}));ami[_0x22a3('0x20')](_0x22a3('0x34'),this[_0x22a3('0xa')][_0x3b9bdf[_0x22a3('0x25')]][_0x3b9bdf[_0x22a3('0x29')]]);logger[_0x22a3('0x27')](_0x22a3('0x35'),_0x3b9bdf[_0x22a3('0x25')],util[_0x22a3('0x28')](this[_0x22a3('0xa')][_0x3b9bdf[_0x22a3('0x25')]][_0x3b9bdf[_0x22a3('0x29')]],{'showHidden':![],'depth':null}));this[_0x22a3('0x20')](util['format']('user:%s',_0x3b9bdf['membername']),_0x22a3('0x36'),this[_0x22a3('0xa')][_0x3b9bdf['uniqueid']][_0x3b9bdf[_0x22a3('0x29')]]);}}catch(_0x381e1e){logger[_0x22a3('0x37')](_0x22a3('0x38'),_0x3b9bdf[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x381e1e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x39')]=function(_0xaadf3f){try{if(this[_0x22a3('0x21')](_0xaadf3f)){if(this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]]){logger[_0x22a3('0x27')](_0x22a3('0x3a'),_0xaadf3f[_0x22a3('0x25')],util[_0x22a3('0x28')](_0xaadf3f,{'showHidden':![],'depth':null}));for(var _0x4d085a in this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]]){if(this['channels'][_0xaadf3f[_0x22a3('0x25')]]['hasOwnProperty'](_0x4d085a)){if(_0xaadf3f[_0x22a3('0x29')]===_0x4d085a){logger[_0x22a3('0x23')](_0x22a3('0x3b'),_0xaadf3f[_0x22a3('0x25')],_0xaadf3f[_0x22a3('0x26')],_0xaadf3f[_0x22a3('0x29')]);this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x3c')]=moment()[_0x22a3('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x3d')]=_0xaadf3f['connectedlinename'];this[_0x22a3('0xa')][_0xaadf3f['uniqueid']][_0x4d085a][_0x22a3('0x3e')]=_0xaadf3f['connectedlinenum'];this['channels'][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x3f')]=_0xaadf3f[_0x22a3('0x3f')];this['channels'][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x40')]=_0xaadf3f[_0x22a3('0x40')];this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x41')]=_0xaadf3f[_0x22a3('0x41')];this['channels'][_0xaadf3f['uniqueid']][_0x4d085a][_0x22a3('0x42')]='connect';_['merge'](this[_0x22a3('0xc')][_0xaadf3f[_0x22a3('0x43')]],_[_0x22a3('0x44')](_0xaadf3f,[_0x22a3('0x2d'),_0x22a3('0x45')]));logger[_0x22a3('0x27')](_0x22a3('0x46'),_0xaadf3f[_0x22a3('0x25')],util[_0x22a3('0x28')](this['channels'][_0xaadf3f['uniqueid']][_0xaadf3f[_0x22a3('0x29')]],{'showHidden':![],'depth':null}));ami[_0x22a3('0x20')]('custom:agentconnect',this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0xaadf3f[_0x22a3('0x29')]]);logger[_0x22a3('0x27')](_0x22a3('0x47'),_0xaadf3f['uniqueid'],util[_0x22a3('0x28')](this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0xaadf3f[_0x22a3('0x29')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x22a3('0x48'),_0xaadf3f[_0x22a3('0x26')]),_0x22a3('0x49'),this['channels'][_0xaadf3f[_0x22a3('0x25')]][_0xaadf3f['destuniqueid']]);}else if(!this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x11')]&&!this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x4a')]){logger[_0x22a3('0x23')](_0x22a3('0x4b'),_0xaadf3f[_0x22a3('0x25')],this[_0x22a3('0xa')][_0xaadf3f['uniqueid']][_0x4d085a][_0x22a3('0x26')],_0x4d085a);this[_0x22a3('0xa')][_0xaadf3f['uniqueid']][_0x4d085a]['agentringnoanswer']=!![];this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x4c')]=moment()[_0x22a3('0x2a')](_0x22a3('0x2b'));this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a]['answeredelsewheredestinationuniqueid']=_0xaadf3f['destuniqueid'];this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x4d')]=_0xaadf3f[_0x22a3('0x26')];this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x42')]=_0x22a3('0x4e');this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a][_0x22a3('0x4f')]=_0x22a3('0x4e');logger['debug'](_0x22a3('0x50'),_0xaadf3f[_0x22a3('0x25')],util[_0x22a3('0x28')](this[_0x22a3('0xa')][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a],{'showHidden':![],'depth':null}));ami[_0x22a3('0x20')]('custom:agentansweredelsewhere',this['channels'][_0xaadf3f[_0x22a3('0x25')]][_0x4d085a]);}}}}}}catch(_0x30b228){logger[_0x22a3('0x37')](_0x22a3('0x51'),_0xaadf3f[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x30b228,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')]['syncAgentRingNoAnswer']=function(_0x56fcbd){try{if(this['isNotNull'](_0x56fcbd)){logger[_0x22a3('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x56fcbd[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x56fcbd,{'showHidden':![],'depth':null}));if(this['channels'][_0x56fcbd[_0x22a3('0x25')]]&&this[_0x22a3('0xa')][_0x56fcbd[_0x22a3('0x25')]][_0x56fcbd['destuniqueid']]){logger[_0x22a3('0x23')](_0x22a3('0x52'),_0x56fcbd[_0x22a3('0x25')],_0x56fcbd[_0x22a3('0x26')],_0x56fcbd[_0x22a3('0x29')]);this[_0x22a3('0xa')][_0x56fcbd[_0x22a3('0x25')]][_0x56fcbd[_0x22a3('0x29')]][_0x22a3('0x11')]=!![];this[_0x22a3('0xa')][_0x56fcbd[_0x22a3('0x25')]][_0x56fcbd['destuniqueid']][_0x22a3('0x4c')]=moment()[_0x22a3('0x2a')](_0x22a3('0x2b'));this[_0x22a3('0xa')][_0x56fcbd[_0x22a3('0x25')]][_0x56fcbd['destuniqueid']]['lastevent']=_0x22a3('0x53');this[_0x22a3('0xa')][_0x56fcbd[_0x22a3('0x25')]][_0x56fcbd[_0x22a3('0x29')]][_0x22a3('0x4f')]=_0x22a3('0x53');logger[_0x22a3('0x27')](_0x22a3('0x54'),_0x56fcbd[_0x22a3('0x25')],util[_0x22a3('0x28')](this['channels'][_0x56fcbd[_0x22a3('0x25')]][_0x56fcbd[_0x22a3('0x29')]],{'showHidden':![],'depth':null}));ami[_0x22a3('0x20')](_0x22a3('0x55'),this['channels'][_0x56fcbd[_0x22a3('0x25')]][_0x56fcbd['destuniqueid']]);}}}catch(_0x376a64){logger[_0x22a3('0x37')](_0x22a3('0x56'),_0x56fcbd[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x376a64,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x13')]=function(_0xa46d3){try{if(this[_0x22a3('0x21')](_0xa46d3)){logger[_0x22a3('0x27')](_0x22a3('0x57'),_0xa46d3[_0x22a3('0x25')],util['inspect'](_0xa46d3,{'showHidden':![],'depth':null}));if(this[_0x22a3('0xa')][_0xa46d3['uniqueid']]){for(var _0x1673c4 in this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]]){if(this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]]['hasOwnProperty'](_0x1673c4)&&!this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]][_0x1673c4][_0x22a3('0x11')]&&!this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]][_0x1673c4][_0x22a3('0x4a')]){logger['info'](_0x22a3('0x58'),_0xa46d3[_0x22a3('0x25')],this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]][_0x1673c4][_0x22a3('0x26')],_0x1673c4);this[_0x22a3('0xa')][_0xa46d3['uniqueid']][_0x1673c4][_0x22a3('0x11')]=!![];this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]][_0x1673c4][_0x22a3('0x4c')]=moment()[_0x22a3('0x2a')](_0x22a3('0x2b'));this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]][_0x1673c4][_0x22a3('0x42')]=_0x22a3('0x59');this[_0x22a3('0xa')][_0xa46d3['uniqueid']][_0x1673c4][_0x22a3('0x4f')]='abandoned';logger[_0x22a3('0x27')](_0x22a3('0x5a'),_0xa46d3[_0x22a3('0x25')],util['inspect'](this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]][_0x1673c4],{'showHidden':![],'depth':null}));ami[_0x22a3('0x20')](_0x22a3('0x5b'),this[_0x22a3('0xa')][_0xa46d3[_0x22a3('0x25')]][_0x1673c4]);}}}}}catch(_0x360aac){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0xa46d3[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x360aac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x14')]=function(_0x3f9b35){try{if(this['isNotNull'](_0x3f9b35)){logger[_0x22a3('0x27')](_0x22a3('0x5c'),_0x3f9b35[_0x22a3('0x25')],util['inspect'](_0x3f9b35,{'showHidden':![],'depth':null}));if(this['channels'][_0x3f9b35[_0x22a3('0x25')]]){for(var _0x4bf961 in this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]]){if(this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]]['hasOwnProperty'](_0x4bf961)){if(this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961][_0x22a3('0x3c')]&&!this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961][_0x22a3('0x4a')]){logger['info'](_0x22a3('0x5d'),_0x3f9b35[_0x22a3('0x25')],this[_0x22a3('0xa')][_0x3f9b35['uniqueid']][_0x4bf961][_0x22a3('0x26')],_0x4bf961);this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961][_0x22a3('0x4a')]=!![];this[_0x22a3('0xa')][_0x3f9b35['uniqueid']][_0x4bf961][_0x22a3('0x5e')]=moment()[_0x22a3('0x2a')](_0x22a3('0x2b'));this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961][_0x22a3('0x42')]=_0x22a3('0x5f');this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961][_0x22a3('0x4f')]=_0x3f9b35[_0x22a3('0x4f')]==_0x22a3('0x60')?'agent':_0x3f9b35[_0x22a3('0x4f')];this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961][_0x22a3('0x61')]=_0x3f9b35[_0x22a3('0x61')];if(this[_0x22a3('0xb')][_0x3f9b35[_0x22a3('0x2d')]]&&this[_0x22a3('0xb')][_0x3f9b35[_0x22a3('0x2d')]][_0x22a3('0x62')]){this[_0x22a3('0xa')][_0x3f9b35['uniqueid']][_0x4bf961][_0x22a3('0x63')]=this[_0x22a3('0xb')][_0x3f9b35[_0x22a3('0x2d')]][_0x22a3('0x64')];this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961]['agentacw']=!![];}this[_0x22a3('0xc')][_0x3f9b35[_0x22a3('0x43')]]=_[_0x22a3('0x31')](this[_0x22a3('0xc')][_0x3f9b35['interface']],[_0x22a3('0x2d'),_0x22a3('0x45')]);logger[_0x22a3('0x27')](_0x22a3('0x65'),_0x3f9b35[_0x22a3('0x25')],util[_0x22a3('0x28')](this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961],{'showHidden':![],'depth':null}));ami[_0x22a3('0x20')]('custom:agentcomplete',this[_0x22a3('0xa')][_0x3f9b35['uniqueid']][_0x4bf961]);logger[_0x22a3('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3f9b35[_0x22a3('0x25')],util[_0x22a3('0x28')](this[_0x22a3('0xa')][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961],{'showHidden':![],'depth':null}));this['emit'](util[_0x22a3('0x2a')](_0x22a3('0x48'),_0x3f9b35[_0x22a3('0x26')]),_0x22a3('0x66'),this['channels'][_0x3f9b35[_0x22a3('0x25')]][_0x4bf961]);}}}}}}catch(_0x14f26f){logger[_0x22a3('0x37')]('[%s][voiceAgentReport][agentcomplete]',_0x3f9b35[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x14f26f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x16')]=function(_0x352a99){try{if(this[_0x22a3('0x21')](_0x352a99)){logger[_0x22a3('0x27')](_0x22a3('0x67'),_0x352a99['uniqueid'],util[_0x22a3('0x28')](_0x352a99,{'showHidden':![],'depth':null}));this[_0x22a3('0x68')](_0x352a99['uniqueid'],_[_0x22a3('0x69')](_0x352a99[_0x22a3('0x6a')])[0x0],_0x352a99[_0x22a3('0x6b')]);if(this[_0x22a3('0xa')][_0x352a99[_0x22a3('0x25')]]){for(var _0x375ac0 in this['channels'][_0x352a99[_0x22a3('0x25')]]){if(this[_0x22a3('0xa')][_0x352a99[_0x22a3('0x25')]]['hasOwnProperty'](_0x375ac0)){logger[_0x22a3('0x23')](_0x22a3('0x6c'),_0x352a99[_0x22a3('0x25')],_0x375ac0,_['keys'](_0x352a99[_0x22a3('0x6a')])[0x0],_0x352a99['value']);if(_['isUndefined'](this[_0x22a3('0xa')][_0x352a99[_0x22a3('0x25')]][_0x375ac0]['variables'])){this[_0x22a3('0xa')][_0x352a99['uniqueid']][_0x375ac0]['variables']={};}this[_0x22a3('0xa')][_0x352a99['uniqueid']][_0x375ac0][_0x22a3('0xd')]=this['variables'][_0x352a99[_0x22a3('0x25')]];}}}}}catch(_0x3fc325){logger['error'](_0x22a3('0x6d'),_0x352a99[_0x22a3('0x25')],util['inspect'](_0x3fc325,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x68')]=function(_0x445331,_0x224bf3,_0x51273b){var _0x57b217=[_0x22a3('0x6e'),_0x22a3('0x6f'),'rtpaudioqosjitter',_0x22a3('0x70'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x22a3('0x71'),'rtpaudioqosrttbridged',_0x22a3('0x72'),_0x22a3('0x73'),_0x22a3('0x74'),_0x22a3('0x75'),'membercalls',_0x22a3('0x76'),_0x22a3('0x77'),_0x22a3('0x78'),_0x22a3('0x26'),'memberpenalty','memberrealtime'];if(!_[_0x22a3('0x79')](_0x224bf3)&&!_[_0x22a3('0x7a')](_0x57b217,_0x224bf3)){if(_['isUndefined'](this[_0x22a3('0xd')][_0x445331])){this['variables'][_0x445331]={};}this[_0x22a3('0xd')][_0x445331][_0x224bf3]=_0x51273b;}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x18')]=function(_0x46540b){try{if(this['isNotNull'](_0x46540b)){logger[_0x22a3('0x27')](_0x22a3('0x7b'),_0x46540b[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x46540b,{'showHidden':![],'depth':null}));if(this[_0x22a3('0xa')][_0x46540b[_0x22a3('0x25')]]){for(var _0x17c2e7 in this[_0x22a3('0xa')][_0x46540b['uniqueid']]){if(this[_0x22a3('0xa')][_0x46540b[_0x22a3('0x25')]][_0x22a3('0x7c')](_0x17c2e7)){if(this[_0x22a3('0xa')][_0x46540b[_0x22a3('0x25')]][_0x17c2e7][_0x22a3('0x4f')]==_0x22a3('0x60')&&this[_0x22a3('0xa')][_0x46540b[_0x22a3('0x25')]][_0x17c2e7][_0x22a3('0x4a')]){logger[_0x22a3('0x23')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x46540b[_0x22a3('0x25')],_0x17c2e7);this[_0x22a3('0xa')][_0x46540b['uniqueid']][_0x17c2e7]['agentcompleteAt']=moment()[_0x22a3('0x2a')](_0x22a3('0x2b'));}}}logger[_0x22a3('0x27')](_0x22a3('0x7d'),_0x46540b[_0x22a3('0x25')],util[_0x22a3('0x28')](_[_0x22a3('0x7e')](this[_0x22a3('0xa')][_0x46540b[_0x22a3('0x25')]]),{'showHidden':![],'depth':null}));ami[_0x22a3('0x20')](_0x22a3('0x7f'),_[_0x22a3('0x7e')](this['channels'][_0x46540b['uniqueid']]));delete this[_0x22a3('0xa')][_0x46540b[_0x22a3('0x25')]];}if(this[_0x22a3('0xd')][_0x46540b['uniqueid']]){delete this[_0x22a3('0xd')][_0x46540b[_0x22a3('0x25')]];}}}catch(_0x267c13){logger[_0x22a3('0x37')](_0x22a3('0x80'),_0x46540b[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x267c13,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x81')]=function(_0x33c84a){try{if(this[_0x22a3('0x21')](_0x33c84a)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x33c84a[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x33c84a,{'showHidden':![],'depth':null}));if(this['channels'][_0x33c84a['transfereeuniqueid']]){for(var _0x28fd0e in this[_0x22a3('0xa')][_0x33c84a[_0x22a3('0x82')]]){if(this[_0x22a3('0xa')][_0x33c84a['transfereeuniqueid']][_0x22a3('0x7c')](_0x28fd0e)){if(_0x33c84a[_0x22a3('0x83')]===_0x28fd0e){logger[_0x22a3('0x23')](_0x22a3('0x84'),_0x33c84a[_0x22a3('0x25')],this[_0x22a3('0xa')][_0x33c84a[_0x22a3('0x82')]][_0x28fd0e][_0x22a3('0x26')],_0x28fd0e);var _0x1d7cc2=moment();this[_0x22a3('0xa')][_0x33c84a['transfereeuniqueid']][_0x28fd0e][_0x22a3('0x4a')]=!![];this[_0x22a3('0xa')][_0x33c84a[_0x22a3('0x82')]][_0x28fd0e]['agentcompleteAt']=moment()['format'](_0x22a3('0x2b'));this['channels'][_0x33c84a[_0x22a3('0x82')]][_0x28fd0e][_0x22a3('0x42')]=_0x22a3('0x5f');this[_0x22a3('0xa')][_0x33c84a[_0x22a3('0x82')]][_0x28fd0e][_0x22a3('0x4f')]='transfer';this[_0x22a3('0xa')][_0x33c84a[_0x22a3('0x82')]][_0x28fd0e]['talktime']=_0x1d7cc2[_0x22a3('0x85')](this[_0x22a3('0xa')][_0x33c84a[_0x22a3('0x82')]][_0x28fd0e][_0x22a3('0x3c')],'seconds');}}}}if(this[_0x22a3('0xa')][_0x33c84a[_0x22a3('0x86')]]){var _0x205b00=this[_0x22a3('0xa')][_0x33c84a['secondtransfereruniqueid']];this['channels'][_0x33c84a[_0x22a3('0x86')]]=this[_0x22a3('0xa')][_0x33c84a['transfereeuniqueid']];this[_0x22a3('0xa')][_0x33c84a['transfereeuniqueid']]=_0x205b00;}}}catch(_0x587077){logger[_0x22a3('0x37')]('[%s][voiceAgentReport][attendedtransfer]',_0x33c84a[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x587077,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x1e')]=function(_0x3769f0){try{if(this[_0x22a3('0x21')](_0x3769f0)){logger['debug'](_0x22a3('0x87'),_0x3769f0[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x3769f0,{'showHidden':![],'depth':null}));if(this['channels'][_0x3769f0[_0x22a3('0x82')]]){for(var _0x22ff2b in this['channels'][_0x3769f0[_0x22a3('0x82')]]){if(this['channels'][_0x3769f0[_0x22a3('0x82')]][_0x22a3('0x7c')](_0x22ff2b)){if(_0x3769f0[_0x22a3('0x88')]===_0x22ff2b){logger[_0x22a3('0x23')](_0x22a3('0x89'),_0x3769f0[_0x22a3('0x25')],this['channels'][_0x3769f0[_0x22a3('0x82')]][_0x22ff2b][_0x22a3('0x26')],_0x22ff2b);var _0x43d1e7=moment();this[_0x22a3('0xa')][_0x3769f0[_0x22a3('0x82')]][_0x22ff2b][_0x22a3('0x4a')]=!![];this[_0x22a3('0xa')][_0x3769f0['transfereeuniqueid']][_0x22ff2b][_0x22a3('0x5e')]=_0x43d1e7;this[_0x22a3('0xa')][_0x3769f0['transfereeuniqueid']][_0x22ff2b][_0x22a3('0x42')]=_0x22a3('0x5f');this[_0x22a3('0xa')][_0x3769f0[_0x22a3('0x82')]][_0x22ff2b][_0x22a3('0x4f')]=_0x22a3('0x60');this['channels'][_0x3769f0[_0x22a3('0x82')]][_0x22ff2b][_0x22a3('0x61')]=_0x43d1e7[_0x22a3('0x85')](this[_0x22a3('0xa')][_0x3769f0[_0x22a3('0x82')]][_0x22ff2b][_0x22a3('0x3c')],'seconds');}}}}}}catch(_0x535123){logger['error'](_0x22a3('0x8a'),_0x3769f0[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x535123,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x22a3('0x19')]=function(_0x519f2e){var _0x52d2cc='';try{if(this[_0x22a3('0x21')](_0x519f2e)){logger['debug'](_0x22a3('0x8b'),_0x519f2e[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x519f2e,{'showHidden':![],'depth':null}));if(_0x519f2e[_0x22a3('0x8c')]){_0x52d2cc=_0x519f2e[_0x22a3('0x8c')][_0x22a3('0x8d')](0x0,_0x519f2e['channel'][_0x22a3('0x8e')]('-'));if(this[_0x22a3('0xc')][_0x52d2cc]){logger[_0x22a3('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x519f2e[_0x22a3('0x25')],_0x52d2cc);this[_0x22a3('0xc')][_0x52d2cc][_0x22a3('0x8f')]=!![];}}}}catch(_0x23cedc){logger[_0x22a3('0x37')]('[%s][voiceAgentReport][musiconholdstart]',_0x519f2e[_0x22a3('0x25')],util[_0x22a3('0x28')](_0x23cedc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22a3('0x1f')][_0x22a3('0x1b')]=function(_0x51aa0e){var _0x562f11='';try{if(this[_0x22a3('0x21')](_0x51aa0e)){logger[_0x22a3('0x27')](_0x22a3('0x90'),_0x51aa0e['uniqueid'],util[_0x22a3('0x28')](_0x51aa0e,{'showHidden':![],'depth':null}));if(_0x51aa0e[_0x22a3('0x8c')]){_0x562f11=_0x51aa0e['channel'][_0x22a3('0x8d')](0x0,_0x51aa0e[_0x22a3('0x8c')][_0x22a3('0x8e')]('-'));if(this['agents'][_0x562f11]){logger[_0x22a3('0x23')](_0x22a3('0x91'),_0x51aa0e['uniqueid'],_0x562f11);this[_0x22a3('0xc')][_0x562f11][_0x22a3('0x8f')]=![];}}}}catch(_0x1ff384){logger[_0x22a3('0x37')](_0x22a3('0x92'),_0x51aa0e['uniqueid'],util[_0x22a3('0x28')](_0x1ff384,{'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 cd68ee3..2b24d04 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 _0xdba8=['busy','invalid','ringing','onhold','set','agi','dial','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','[voiceCallReport][coreshowchannels]\x20started','error','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','syncNewChannel','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','disposition','toNumber','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','toLowerCase','applicationdata','application','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','match','queue','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','calleridnum','destinationchannel','channelstate','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','resolve','StopMixMonitor','catch','Action','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','milliseconds','diff','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird','lodash','moment','ioredis','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse'];(function(_0x1ac103,_0x3df308){var _0x29d25d=function(_0x2e5994){while(--_0x2e5994){_0x1ac103['push'](_0x1ac103['shift']());}};_0x29d25d(++_0x3df308);}(_0xdba8,0x179));var _0x8dba=function(_0x15af2f,_0x3c0a01){_0x15af2f=_0x15af2f-0x0;var _0x359239=_0xdba8[_0x15af2f];return _0x359239;};'use strict';var BPromise=require(_0x8dba('0x0'));var _=require(_0x8dba('0x1'));var moment=require(_0x8dba('0x2'));var util=require('util');var path=require('path');var Redis=require(_0x8dba('0x3'));var config=require('../../../config/environment');var logger=require(_0x8dba('0x4'))(_0x8dba('0x5'));var ami=require('../ami');var Channel=require(_0x8dba('0x6'));var RpcSetting=require(_0x8dba('0x7'));var statusDesc=[_0x8dba('0x8'),_0x8dba('0x9'),_0x8dba('0xa'),_0x8dba('0xb'),_0x8dba('0xc'),'unavailable',_0x8dba('0xd'),'ringinuse',_0x8dba('0xe')];var applications=[_0x8dba('0xf'),'queue',_0x8dba('0x10'),_0x8dba('0x11'),'playback',_0x8dba('0x12')];var dispositions=['NO\x20ANSWER',_0x8dba('0x13'),'FAILED','NO\x20ANSWER',_0x8dba('0x14'),_0x8dba('0x14'),'ANSWERED',_0x8dba('0x15'),'FAILED',_0x8dba('0x13'),_0x8dba('0x13')];var actions={};config[_0x8dba('0x16')]=_['defaults'](config[_0x8dba('0x16')],{'host':_0x8dba('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8dba('0x16')]));function VoiceCallReport(_0x4625f2){this[_0x8dba('0x18')]=_0x4625f2['channels'];this[_0x8dba('0x19')]=_0x4625f2[_0x8dba('0x19')];this[_0x8dba('0x1a')]={};ami['on'](_0x8dba('0x1b'),this[_0x8dba('0x1c')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x1e'),this['syncNewExten'][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x1f'),this['syncNewChannel'][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x20'),this[_0x8dba('0x21')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x22'),this[_0x8dba('0x23')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x24'),this[_0x8dba('0x25')]['bind'](this));ami['on'](_0x8dba('0x26'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x27'),this[_0x8dba('0x28')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x29'),this[_0x8dba('0x2a')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x2b'),this['syncMusicOnHoldStop'][_0x8dba('0x1d')](this));try{logger['info'](_0x8dba('0x2c'));ami['actionCoreShowChannels']();}catch(_0x1156c6){logger[_0x8dba('0x2d')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x1156c6,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x2f')]=function(_0x3f1ec4){return _0x3f1ec4!==null&&!_[_0x8dba('0x30')](_0x3f1ec4);};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x31')]=function(_0x130ee5,_0x389236,_0x357290){io['to'](_0x130ee5)[_0x8dba('0x31')](_0x389236,_0x357290);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x561dfb){try{if(this['isNotNull'](_0x561dfb)){logger[_0x8dba('0x32')](_0x8dba('0x33'),_0x561dfb[_0x8dba('0x34')],_0x561dfb[_0x8dba('0x35')],_0x561dfb['calleridnum']);logger[_0x8dba('0x36')](_0x8dba('0x37'),_0x561dfb[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x561dfb,{'showHidden':![],'depth':null}));if(_0x561dfb[_0x8dba('0x34')]===_0x561dfb[_0x8dba('0x39')]){if(!_[_0x8dba('0x30')](this[_0x8dba('0x18')][_0x561dfb[_0x8dba('0x34')]])){_[_0x8dba('0x3a')](this[_0x8dba('0x18')][_0x561dfb[_0x8dba('0x34')]],_[_0x8dba('0x3b')](_0x561dfb,_[_0x8dba('0x3c')](this[_0x8dba('0x18')][_0x561dfb[_0x8dba('0x34')]])));}}}}catch(_0xd5d805){logger[_0x8dba('0x2d')](_0x8dba('0x3d'),_0x561dfb['uniqueid'],util[_0x8dba('0x38')](_0xd5d805,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x3e')]=function(_0x4a6088){try{if(this[_0x8dba('0x2f')](_0x4a6088)){logger[_0x8dba('0x36')]('[%s][voiceCallReport][newchannel]\x20event:',_0x4a6088[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x4a6088,{'showHidden':![],'depth':null}));if(_0x4a6088[_0x8dba('0x34')]===_0x4a6088[_0x8dba('0x39')]&&_0x4a6088[_0x8dba('0x3f')]!=_0x8dba('0x40')){if(_[_0x8dba('0x30')](this['channels'][_0x4a6088['uniqueid']])){logger['info'](_0x8dba('0x41'),_0x4a6088[_0x8dba('0x34')],_0x4a6088[_0x8dba('0x42')],_0x4a6088[_0x8dba('0x43')]);this['channels'][_0x4a6088[_0x8dba('0x34')]]=new Channel();this[_0x8dba('0x18')][_0x4a6088['uniqueid']][_0x8dba('0x44')]=moment()[_0x8dba('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4a6088[_0x8dba('0x34')]][_0x8dba('0x46')]=dispositions[_[_0x8dba('0x47')](_0x4a6088['channelstate'])];_['merge'](this[_0x8dba('0x18')][_0x4a6088[_0x8dba('0x34')]],_[_0x8dba('0x3b')](_0x4a6088,_[_0x8dba('0x3c')](this['channels'][_0x4a6088['uniqueid']])));if(_0x4a6088['context']==='from-sip'){if(this[_0x8dba('0x19')][_0x4a6088['channel']['split']('-')[0x0]]){this[_0x8dba('0x19')][_0x4a6088[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]['destconnectedlinenum']=_0x4a6088[_0x8dba('0x43')];logger['debug'](_0x8dba('0x49'),_0x4a6088[_0x8dba('0x34')],util[_0x8dba('0x38')]({'destaccountcode':this['agents'][_0x4a6088[_0x8dba('0x3f')]['split']('-')[0x0]][_0x8dba('0x4a')],'destconnectedlinenum':_0x4a6088[_0x8dba('0x43')]},{'showHidden':![],'depth':null}));this[_0x8dba('0x31')](util[_0x8dba('0x45')](_0x8dba('0x4b'),this['agents'][_0x4a6088[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]][_0x8dba('0x4c')]),_0x8dba('0x4d'),{'destaccountcode':this[_0x8dba('0x19')][_0x4a6088[_0x8dba('0x3f')]['split']('-')[0x0]][_0x8dba('0x4a')],'destconnectedlinenum':_0x4a6088[_0x8dba('0x43')]});}}}}}}catch(_0x237949){logger['error'](_0x8dba('0x4e'),_0x4a6088[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x237949,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x1c')]=function(_0x243def){try{if(this[_0x8dba('0x2f')](_0x243def)){logger['debug'](_0x8dba('0x4f'),_0x243def['uniqueid'],util[_0x8dba('0x38')](_0x243def,{'showHidden':![],'depth':null}));if(_0x243def[_0x8dba('0x34')]===_0x243def['linkedid']&&_0x243def['exten']!='h'&&_0x243def[_0x8dba('0x3f')]!=_0x8dba('0x40')){_0x243def['application']=_0x243def['application'][_0x8dba('0x50')]();_0x243def[_0x8dba('0x51')]=(_0x243def['appdata']||_0x243def[_0x8dba('0x51')])[_0x8dba('0x50')]();logger[_0x8dba('0x32')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x243def[_0x8dba('0x34')],_0x243def[_0x8dba('0x52')],_0x243def['applicationdata']);if(_[_0x8dba('0x30')](this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]])){this['channels'][_0x243def[_0x8dba('0x34')]]=new Channel();this[_0x8dba('0x18')][_0x243def['uniqueid']]['starttime']=_0x243def[_0x8dba('0x53')]?moment()[_0x8dba('0x54')](moment[_0x8dba('0x53')](_0x243def[_0x8dba('0x53')])[_0x8dba('0x55')](),_0x8dba('0x55'))[_0x8dba('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x8dba('0x45')](_0x8dba('0x56'));this[_0x8dba('0x18')][_0x243def['uniqueid']]['disposition']=_0x8dba('0x14');}_[_0x8dba('0x3a')](this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]],_[_0x8dba('0x3b')](_0x243def,_[_0x8dba('0x3c')](this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]])));if(_[_0x8dba('0x57')](applications,_0x243def[_0x8dba('0x52')])){this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]][_0x8dba('0x58')]=_0x243def[_0x8dba('0x52')];this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]][_0x8dba('0x59')]=_0x243def[_0x8dba('0x51')];if(_0x243def[_0x8dba('0x52')]===_0x8dba('0xf')&&_[_0x8dba('0x5a')](_0x243def['applicationdata'],_0x8dba('0x5b'))){var _0x27094d=_0x243def['applicationdata'][_0x8dba('0x48')]('=');var _0x44b846=_0x27094d[0x0][_0x8dba('0x5c')](/cdr\((.*)\)/);if(_0x44b846){this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]][_0x44b846[0x1]]=_0x27094d[0x1];}}else if(_0x243def[_0x8dba('0x52')]===_0x8dba('0x5d')){this['channels'][_0x243def[_0x8dba('0x34')]][_0x8dba('0x5d')]=_0x243def['applicationdata'][_0x8dba('0x48')](',')[0x0];}}}}}catch(_0x589093){logger[_0x8dba('0x2d')]('[%s][voiceCallReport][newexten]',_0x243def['uniqueid'],util[_0x8dba('0x38')](_0x589093,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')]['syncNewState']=function(_0x46863c){try{if(this[_0x8dba('0x2f')](_0x46863c)){logger[_0x8dba('0x32')](_0x8dba('0x5e'),_0x46863c[_0x8dba('0x34')],_0x46863c['linkedid'],_0x46863c[_0x8dba('0x35')],_0x46863c['calleridnum']);logger[_0x8dba('0x36')](_0x8dba('0x5f'),_0x46863c[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x46863c,{'showHidden':![],'depth':null}));if(_0x46863c[_0x8dba('0x34')]!==_0x46863c[_0x8dba('0x39')]){if(this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]]){if(_0x46863c['channelstate']==='6'){if(!this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x60')]){var _0x1d6c64=moment();this['channels'][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x60')]=!![];this[_0x8dba('0x18')][_0x46863c['linkedid']][_0x8dba('0x61')]=_0x1d6c64['format'](_0x8dba('0x56'));if(this[_0x8dba('0x18')][_0x46863c['linkedid']]['starttime']){this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]]['holdtime']=_0x1d6c64['diff'](this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]]['starttime'],'seconds');}}this['channels'][_0x46863c['linkedid']][_0x8dba('0x39')]=_0x46863c[_0x8dba('0x34')];if(_0x46863c[_0x8dba('0x62')]!=='xcally-motion-preview'){this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]]['connectedlinenum']=_0x46863c[_0x8dba('0x62')];}this[_0x8dba('0x18')][_0x46863c['linkedid']]['connectedlinename']=_0x46863c[_0x8dba('0x35')];this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x63')]=_0x46863c[_0x8dba('0x3f')];this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x46')]=dispositions[_[_0x8dba('0x47')](_0x46863c[_0x8dba('0x64')])];if(this['agents'][_0x46863c[_0x8dba('0x3f')]['split']('-')[0x0]]){this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x65')]=this['agents'][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]['id'];this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x66')]=this[_0x8dba('0x19')][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]][_0x8dba('0x4c')];}}}}else{if(this['channels'][_0x46863c[_0x8dba('0x34')]]){if(_0x46863c['channelstate']==='6'){if(this['agents'][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]){this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x34')]][_0x8dba('0x65')]=this[_0x8dba('0x19')][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]['id'];this[_0x8dba('0x18')][_0x46863c['uniqueid']][_0x8dba('0x66')]=this[_0x8dba('0x19')][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]][_0x8dba('0x4c')];}}}}}}catch(_0x4eedd3){logger[_0x8dba('0x2d')](_0x8dba('0x67'),_0x46863c[_0x8dba('0x34')],util['inspect'](_0x4eedd3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x68')]=function(_0x19e7e9,_0x550c3a){try{if(this[_0x8dba('0x18')][_0x19e7e9]){logger[_0x8dba('0x32')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x19e7e9,_0x550c3a);this[_0x8dba('0x18')][_0x19e7e9][_0x8dba('0x69')]=!![];if(_[_0x8dba('0x6a')](_0x550c3a,'.wav49')){_0x550c3a=_0x550c3a[_0x8dba('0x6b')](_0x8dba('0x6c'),_0x8dba('0x6d'));}this[_0x8dba('0x18')][_0x19e7e9][_0x8dba('0x6e')]=_0x550c3a;var _0x5adb8a=_[_0x8dba('0x6f')](this['channels'][_0x19e7e9][_0x8dba('0x70')],{'filename':_0x550c3a});if(_[_0x8dba('0x71')](_0x5adb8a)){this[_0x8dba('0x18')][_0x19e7e9][_0x8dba('0x70')][_0x8dba('0x72')]({'filename':_0x550c3a,'createdAt':moment()[_0x8dba('0x45')](_0x8dba('0x56')),'mixmonitorid':'','status':'rec'});}}}catch(_0x332fb4){logger['error'](_0x8dba('0x73'),_0x19e7e9,util[_0x8dba('0x38')](_0x332fb4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x23')]=function(_0x28e313){try{if(this[_0x8dba('0x2f')](_0x28e313)){logger['debug']('[%s][voiceCallReport][varset]\x20event:',_0x28e313['uniqueid'],util[_0x8dba('0x38')](_0x28e313,{'showHidden':![],'depth':null}));if(this[_0x8dba('0x18')][_0x28e313['uniqueid']]&&_0x28e313[_0x8dba('0x3f')]!=_0x8dba('0x40')){if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')])){if(this['isNotNull'](_0x28e313[_0x8dba('0x74')][_0x8dba('0x75')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x28e313['uniqueid'],_0x28e313[_0x8dba('0x76')]);this['syncMixMonitorFilename'](_0x28e313[_0x8dba('0x34')],_0x28e313[_0x8dba('0x76')]);}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')]['xmd-phone'])){logger[_0x8dba('0x32')](_0x8dba('0x77'),_0x28e313[_0x8dba('0x34')],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313['uniqueid']][_0x8dba('0x62')]=_0x28e313[_0x8dba('0x76')];}else if(this['isNotNull'](_0x28e313['variable'][_0x8dba('0x78')])){logger['info'](_0x8dba('0x79'),_0x28e313[_0x8dba('0x34')],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313['uniqueid']]['callerid']=_0x28e313['value'];}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')][_0x8dba('0x7a')])){logger[_0x8dba('0x32')](_0x8dba('0x7b'),_0x28e313[_0x8dba('0x34')],_0x28e313['value']);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x7c')]=_0x28e313[_0x8dba('0x76')];}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')]['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x28e313['uniqueid'],_0x28e313[_0x8dba('0x76')][_0x8dba('0x48')](',')[0x0]);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x5d')]=_0x28e313[_0x8dba('0x76')][_0x8dba('0x48')](',')[0x0];}else if(this['isNotNull'](_0x28e313[_0x8dba('0x74')]['xmd-originatecalleridnum'])){logger[_0x8dba('0x32')](_0x8dba('0x7d'),_0x28e313['uniqueid'],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313['uniqueid']]['originatecalleridnum']=_0x28e313[_0x8dba('0x76')];}else if(this[_0x8dba('0x2f')](_0x28e313['variable']['xmd-destination'])){logger['info'](_0x8dba('0x7e'),_0x28e313['uniqueid'],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x7f')]=_0x28e313['value'];}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')]['xmd-callerid-preview'])){logger[_0x8dba('0x32')](_0x8dba('0x80'),_0x28e313[_0x8dba('0x34')],_0x28e313[_0x8dba('0x76')]);this['channels'][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x81')]=_0x28e313[_0x8dba('0x76')];}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')][_0x8dba('0x82')])){logger[_0x8dba('0x32')](_0x8dba('0x83'),_0x28e313[_0x8dba('0x34')],_0x28e313['value']);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x5d')]=_0x28e313['value'];}else if(this[_0x8dba('0x2f')](_0x28e313['variable']['sipcallid'])){logger[_0x8dba('0x32')](_0x8dba('0x84'),_0x28e313[_0x8dba('0x34')],_0x28e313['value']);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x85')]=_0x28e313[_0x8dba('0x76')];}}}else if(this[_0x8dba('0x2f')](_0x28e313['variable'][_0x8dba('0x75')])){if(_0x28e313[_0x8dba('0x76')]){var _0x19f440=path[_0x8dba('0x86')](_0x28e313[_0x8dba('0x76')])[_0x8dba('0x4c')];logger['info'](_0x8dba('0x87'),_0x19f440,_0x28e313['value']);this['syncMixMonitorFilename'](_0x19f440,_0x28e313[_0x8dba('0x76')]);}}else if(this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x39')]]){if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')])){if(this[_0x8dba('0x2f')](_0x28e313['variable']['sipcallid'])){logger[_0x8dba('0x32')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x28e313[_0x8dba('0x39')],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x39')]][_0x8dba('0x88')]=_0x28e313['value'];}}}}}catch(_0x1ccd7d){logger[_0x8dba('0x2d')](_0x8dba('0x89'),_0x28e313[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x1ccd7d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x25')]=function(_0x4e33ed){try{if(this[_0x8dba('0x2f')](_0x4e33ed)){logger[_0x8dba('0x36')](_0x8dba('0x8a'),_0x4e33ed[_0x8dba('0x34')],util['inspect'](_0x4e33ed,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e33ed[_0x8dba('0x34')]]){logger[_0x8dba('0x32')](_0x8dba('0x8b'),_0x4e33ed['uniqueid'],_0x4e33ed[_0x8dba('0x8c')]);var _0x1554b1=moment();this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x8d')]=_0x1554b1[_0x8dba('0x45')](_0x8dba('0x56'));this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x53')]=_0x1554b1['diff'](this['channels'][_0x4e33ed[_0x8dba('0x34')]]['starttime'],'seconds');if(this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x60')]){this['channels'][_0x4e33ed[_0x8dba('0x34')]]['billableseconds']=_0x1554b1['diff'](this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x61')],_0x8dba('0x55'));this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]]['holdtime']=this['channels'][_0x4e33ed[_0x8dba('0x34')]]['duration']-this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x8e')];}if(_0x4e33ed[_0x8dba('0x42')]===_0x8dba('0x8f')){if(this[_0x8dba('0x19')][_0x4e33ed[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]){this[_0x8dba('0x19')][_0x4e33ed['channel'][_0x8dba('0x48')]('-')[0x0]]=_[_0x8dba('0x90')](this[_0x8dba('0x19')][_0x4e33ed[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]],['destconnectedlinenum']);logger[_0x8dba('0x36')](_0x8dba('0x91'),_0x4e33ed[_0x8dba('0x34')],util[_0x8dba('0x38')]({'destaccountcode':this['agents'][_0x4e33ed[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x8dba('0x31')](util[_0x8dba('0x45')](_0x8dba('0x4b'),this[_0x8dba('0x19')][_0x4e33ed[_0x8dba('0x3f')]['split']('-')[0x0]][_0x8dba('0x4c')]),_0x8dba('0x92'),{'destaccountcode':this['agents'][_0x4e33ed[_0x8dba('0x3f')]['split']('-')[0x0]]['accountcode']});}}var _0x2d6ada=this;Promise['resolve']()[_0x8dba('0x93')](function(){var _0xb06afd=_0x2d6ada['channels'][_0x4e33ed[_0x8dba('0x34')]];if(typeof _0xb06afd[_0x8dba('0x94')]===_0x8dba('0x95'))return;if(_[_0x8dba('0x96')](_0xb06afd[_0x8dba('0x70')]))return;return RpcSetting[_0x8dba('0x97')]()['then'](function(_0x43f1b5){if(!_0x43f1b5[_0x8dba('0x98')])return;return Promise[_0x8dba('0x99')]()[_0x8dba('0x93')](function(){return ami['Action']({'action':_0x8dba('0x9a'),'channel':_0xb06afd[_0x8dba('0x3f')]})[_0x8dba('0x9b')](function(){});})[_0x8dba('0x93')](function(){return ami[_0x8dba('0x9c')]({'action':_0x8dba('0x9a'),'channel':_0xb06afd[_0x8dba('0x63')]})[_0x8dba('0x9b')](function(){})['finally'](function(){var _0x34bcdb=_0x2d6ada[_0x8dba('0x19')][_0xb06afd[_0x8dba('0x63')][_0x8dba('0x48')]('-')[0x0]];if(!_0x34bcdb)return;io[_0x8dba('0x31')](_0x8dba('0x9d'),{'agentId':_0x34bcdb['id'],'uniqueid':_0xb06afd['uniqueid']});});});});})[_0x8dba('0x93')](function(){if(_0x4e33ed[_0x8dba('0x9e')]===_0x8dba('0x9f')){_0x2d6ada[_0x8dba('0x1a')][_0x4e33ed[_0x8dba('0x34')]]=_0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]];}else{if(_0x2d6ada['channels'][_0x4e33ed['uniqueid']][_0x8dba('0x7c')]==='outbound'&&_0x2d6ada[_0x8dba('0x1a')][_0x4e33ed[_0x8dba('0x34')]]){_0x2d6ada['channels'][_0x4e33ed[_0x8dba('0x34')]]['uniqueid']=[_0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x39')],_0x2d6ada['channels'][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x39')]=_0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]]['uniqueid']][0x0];delete _0x2d6ada['blindTransfers'][_0x4e33ed[_0x8dba('0x34')]];}}logger[_0x8dba('0x36')](_0x8dba('0xa0'),_0x4e33ed[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x2d6ada['channels'][_0x4e33ed[_0x8dba('0x34')]],{'showHidden':![],'depth':null}));ami[_0x8dba('0x31')]('custom:voiceCallReport',_0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]]);delete _0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]];});}}}catch(_0x4efb42){logger['error']('[%s][voiceCallReport][hangup]',_0x4e33ed[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x4efb42,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0xa1')]=function(_0x40324f){try{if(this[_0x8dba('0x2f')](_0x40324f)){logger[_0x8dba('0x32')](_0x8dba('0xa2'),_0x40324f[_0x8dba('0x34')],_0x40324f['origtransferercalleridnum'],_0x40324f[_0x8dba('0xa3')]);logger[_0x8dba('0x36')](_0x8dba('0xa4'),_0x40324f['uniqueid'],util[_0x8dba('0x38')](_0x40324f,{'showHidden':![],'depth':null}));if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]]){this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]][_0x8dba('0xa6')]=_0x40324f[_0x8dba('0xa7')];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]]['transferconnectedlinenum']=_0x40324f['transfertargetcalleridnum'];if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa8')]]){var _0x51cf44=this['channels'][_0x40324f[_0x8dba('0xa8')]];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa8')]]=this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]]=_0x51cf44;}}else if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa9')]]){this[_0x8dba('0x18')][_0x40324f['transfertargetuniqueid']][_0x8dba('0xa6')]=_0x40324f[_0x8dba('0xa7')];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa9')]][_0x8dba('0xaa')]=_0x40324f[_0x8dba('0xa3')];if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xab')]]){var _0x51cf44=this['channels'][_0x40324f[_0x8dba('0xab')]];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xab')]]=this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa9')]];this[_0x8dba('0x18')][_0x40324f['transfertargetuniqueid']]=_0x51cf44;}}if((this['channels'][_0x40324f[_0x8dba('0xab')]]||this['channels'][_0x40324f['origtransfererlinkedid']])&&this[_0x8dba('0x18')][_0x40324f['secondtransfereruniqueid']]){var _0x4dc392=_['some']([this[_0x8dba('0x18')][_0x40324f['origtransfereruniqueid']],this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xac')]],this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa8')]]],function(_0x143e0e){return _0x143e0e&&_0x143e0e[_0x8dba('0x7c')]===_0x8dba('0xad')&&_0x143e0e[_0x8dba('0xae')];});if(_0x4dc392){if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xab')]])this['channels'][_0x40324f[_0x8dba('0xab')]]['transferType']='ATTENDED';if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xac')]])this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xac')]]['transferType']=_0x8dba('0xaf');this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa8')]][_0x8dba('0x94')]=_0x8dba('0xaf');}}}}catch(_0x3587ba){logger[_0x8dba('0x2d')](_0x8dba('0xb0'),_0x40324f[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x3587ba,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8dba('0x28')]=function(_0x31c780){try{if(this['isNotNull'](_0x31c780)){logger[_0x8dba('0x32')](_0x8dba('0xb1'),_0x31c780[_0x8dba('0x34')],_0x31c780[_0x8dba('0xb2')],_0x31c780[_0x8dba('0xb3')]);logger[_0x8dba('0x36')](_0x8dba('0xb4'),_0x31c780[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x31c780,{'showHidden':![],'depth':null}));if(this['channels'][_0x31c780[_0x8dba('0xa5')]]){this['channels'][_0x31c780[_0x8dba('0xa5')]]['transfercalleridnum']=_0x31c780[_0x8dba('0xb2')];this[_0x8dba('0x18')][_0x31c780[_0x8dba('0xa5')]]['transferconnectedlinenum']=_0x31c780['extension'];this[_0x8dba('0x18')][_0x31c780[_0x8dba('0xa5')]]['transferType']=_0x8dba('0xb5');this[_0x8dba('0x25')]({'event':_0x8dba('0x9f'),'uniqueid':_0x31c780[_0x8dba('0xa5')],'context':_0x31c780[_0x8dba('0x42')],'channel':_0x31c780[_0x8dba('0xb6')]});}else{this[_0x8dba('0x18')][_0x31c780[_0x8dba('0xb7')]][_0x8dba('0x94')]='BLIND';}}}catch(_0x3087f0){logger[_0x8dba('0x2d')]('[%s][voiceCallReport][blindtransfer]',_0x31c780[_0x8dba('0x34')],util['inspect'](_0x3087f0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8dba('0x2a')]=function(_0x1a9a7d){try{if(this[_0x8dba('0x2f')](_0x1a9a7d)){logger[_0x8dba('0x36')](_0x8dba('0xb8'),_0x1a9a7d[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x1a9a7d,{'showHidden':![],'depth':null}));if(this[_0x8dba('0x18')][_0x1a9a7d[_0x8dba('0x34')]]){if(!_[_0x8dba('0x71')](this[_0x8dba('0x18')][_0x1a9a7d[_0x8dba('0x34')]][_0x8dba('0x61')])){this[_0x8dba('0x18')][_0x1a9a7d[_0x8dba('0x34')]]['mohstarttime']=moment()[_0x8dba('0x45')](_0x8dba('0x56'));logger[_0x8dba('0x32')](_0x8dba('0xb9'),_0x1a9a7d[_0x8dba('0x34')],this[_0x8dba('0x18')][_0x1a9a7d['uniqueid']][_0x8dba('0xba')]);}}}}catch(_0x465a2c){logger[_0x8dba('0x2d')](_0x8dba('0xbb'),_0x1a9a7d[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x465a2c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0xbc')]=function(_0x548ecf){try{if(this['isNotNull'](_0x548ecf)){logger[_0x8dba('0x36')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x548ecf[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x548ecf,{'showHidden':![],'depth':null}));if(this[_0x8dba('0x18')][_0x548ecf[_0x8dba('0x34')]]){if(!_['isNil'](this[_0x8dba('0x18')][_0x548ecf[_0x8dba('0x34')]]['mohstarttime'])){this[_0x8dba('0x18')][_0x548ecf['uniqueid']][_0x8dba('0xbd')]+=moment()[_0x8dba('0xbe')](0x0)[_0x8dba('0xbf')](this['channels'][_0x548ecf['uniqueid']][_0x8dba('0xba')],_0x8dba('0x55'));logger[_0x8dba('0x32')](_0x8dba('0xc0'),_0x548ecf[_0x8dba('0x34')],this[_0x8dba('0x18')][_0x548ecf['uniqueid']][_0x8dba('0xbd')]);delete this[_0x8dba('0x18')][_0x548ecf[_0x8dba('0x34')]][_0x8dba('0xba')];}}}}catch(_0xf7a209){logger[_0x8dba('0x2d')]('[%s][voiceCallReport][musiconholdstop]',_0x548ecf[_0x8dba('0x34')],util[_0x8dba('0x38')](_0xf7a209,{'showHidden':![],'depth':null}));}};module[_0x8dba('0xc1')]=VoiceCallReport; \ No newline at end of file +var _0xf041=['info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','[%s][voiceCallReport][newcallerid]','debug','linkedid','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','from-sip','split','accountcode','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','variable','mixmonitor_filename','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','context','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','resolve','transferType','undefined','isEmpty','then','stopRecordingOnTransfer','Action','catch','StopMixMonitor','webbar:stopmonitors','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','outbound','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum','BLIND','BlindTransfer','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','moment','util','path','ioredis','../../../config/logger','../ami','unknown','inuse','busy','invalid','unavailable','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart'];(function(_0x213c69,_0x4848a1){var _0x3b893c=function(_0x37f300){while(--_0x37f300){_0x213c69['push'](_0x213c69['shift']());}};_0x3b893c(++_0x4848a1);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0x1f04('0x0'));var util=require(_0x1f04('0x1'));var path=require(_0x1f04('0x2'));var Redis=require(_0x1f04('0x3'));var config=require('../../../config/environment');var logger=require(_0x1f04('0x4'))('ami');var ami=require(_0x1f04('0x5'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var statusDesc=[_0x1f04('0x6'),'not_inuse',_0x1f04('0x7'),_0x1f04('0x8'),_0x1f04('0x9'),_0x1f04('0xa'),'ringing',_0x1f04('0xb'),_0x1f04('0xc')];var applications=[_0x1f04('0xd'),_0x1f04('0xe'),_0x1f04('0xf'),_0x1f04('0x10'),_0x1f04('0x11'),_0x1f04('0x12')];var dispositions=['NO\x20ANSWER','FAILED',_0x1f04('0x13'),_0x1f04('0x14'),_0x1f04('0x14'),_0x1f04('0x14'),_0x1f04('0x15'),_0x1f04('0x16'),_0x1f04('0x13'),_0x1f04('0x13'),_0x1f04('0x13')];var actions={};config[_0x1f04('0x17')]=_[_0x1f04('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1f04('0x19'))(new Redis(config[_0x1f04('0x17')]));function VoiceCallReport(_0x24d37c){this['channels']=_0x24d37c[_0x1f04('0x1a')];this['agents']=_0x24d37c[_0x1f04('0x1b')];this[_0x1f04('0x1c')]={};ami['on'](_0x1f04('0x1d'),this[_0x1f04('0x1e')][_0x1f04('0x1f')](this));ami['on'](_0x1f04('0x20'),this['syncNewExten']['bind'](this));ami['on'](_0x1f04('0x21'),this[_0x1f04('0x22')][_0x1f04('0x1f')](this));ami['on'](_0x1f04('0x23'),this[_0x1f04('0x24')][_0x1f04('0x1f')](this));ami['on'](_0x1f04('0x25'),this[_0x1f04('0x26')]['bind'](this));ami['on'](_0x1f04('0x27'),this[_0x1f04('0x28')][_0x1f04('0x1f')](this));ami['on']('newcallerid',this[_0x1f04('0x29')][_0x1f04('0x1f')](this));ami['on']('attendedtransfer',this[_0x1f04('0x2a')][_0x1f04('0x1f')](this));ami['on'](_0x1f04('0x2b'),this[_0x1f04('0x2c')][_0x1f04('0x1f')](this));ami['on'](_0x1f04('0x2d'),this[_0x1f04('0x2e')][_0x1f04('0x1f')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x1f04('0x1f')](this));try{logger[_0x1f04('0x2f')](_0x1f04('0x30'));ami[_0x1f04('0x31')]();}catch(_0x35ae83){logger[_0x1f04('0x32')](_0x1f04('0x33'),util[_0x1f04('0x34')](_0x35ae83,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1f04('0x35')][_0x1f04('0x36')]=function(_0x2288b3){return _0x2288b3!==null&&!_[_0x1f04('0x37')](_0x2288b3);};VoiceCallReport[_0x1f04('0x35')]['emit']=function(_0x3b84c0,_0x3c5eae,_0x1d748c){io['to'](_0x3b84c0)[_0x1f04('0x38')](_0x3c5eae,_0x1d748c);};VoiceCallReport[_0x1f04('0x35')][_0x1f04('0x29')]=function(_0x147add){try{if(this[_0x1f04('0x36')](_0x147add)){logger[_0x1f04('0x2f')](_0x1f04('0x39'),_0x147add[_0x1f04('0x3a')],_0x147add['calleridname'],_0x147add[_0x1f04('0x3b')]);logger['debug'](_0x1f04('0x3c'),_0x147add[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x147add,{'showHidden':![],'depth':null}));if(_0x147add[_0x1f04('0x3a')]===_0x147add['linkedid']){if(!_[_0x1f04('0x37')](this[_0x1f04('0x1a')][_0x147add[_0x1f04('0x3a')]])){_[_0x1f04('0x3d')](this[_0x1f04('0x1a')][_0x147add[_0x1f04('0x3a')]],_[_0x1f04('0x3e')](_0x147add,_['keys'](this[_0x1f04('0x1a')][_0x147add['uniqueid']])));}}}}catch(_0x590b59){logger[_0x1f04('0x32')](_0x1f04('0x3f'),_0x147add[_0x1f04('0x3a')],util['inspect'](_0x590b59,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1f04('0x35')][_0x1f04('0x22')]=function(_0x35c906){try{if(this['isNotNull'](_0x35c906)){logger[_0x1f04('0x40')]('[%s][voiceCallReport][newchannel]\x20event:',_0x35c906[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x35c906,{'showHidden':![],'depth':null}));if(_0x35c906[_0x1f04('0x3a')]===_0x35c906[_0x1f04('0x41')]&&_0x35c906[_0x1f04('0x42')]!=_0x1f04('0x43')){if(_[_0x1f04('0x37')](this[_0x1f04('0x1a')][_0x35c906[_0x1f04('0x3a')]])){logger[_0x1f04('0x2f')](_0x1f04('0x44'),_0x35c906[_0x1f04('0x3a')],_0x35c906['context'],_0x35c906[_0x1f04('0x45')]);this['channels'][_0x35c906[_0x1f04('0x3a')]]=new Channel();this[_0x1f04('0x1a')][_0x35c906[_0x1f04('0x3a')]][_0x1f04('0x46')]=moment()[_0x1f04('0x47')](_0x1f04('0x48'));this[_0x1f04('0x1a')][_0x35c906[_0x1f04('0x3a')]][_0x1f04('0x49')]=dispositions[_[_0x1f04('0x4a')](_0x35c906[_0x1f04('0x4b')])];_['merge'](this[_0x1f04('0x1a')][_0x35c906[_0x1f04('0x3a')]],_[_0x1f04('0x3e')](_0x35c906,_[_0x1f04('0x4c')](this[_0x1f04('0x1a')][_0x35c906['uniqueid']])));if(_0x35c906['context']===_0x1f04('0x4d')){if(this[_0x1f04('0x1b')][_0x35c906['channel'][_0x1f04('0x4e')]('-')[0x0]]){this[_0x1f04('0x1b')][_0x35c906[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]]['destconnectedlinenum']=_0x35c906[_0x1f04('0x45')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x35c906[_0x1f04('0x3a')],util[_0x1f04('0x34')]({'destaccountcode':this[_0x1f04('0x1b')][_0x35c906[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]][_0x1f04('0x4f')],'destconnectedlinenum':_0x35c906[_0x1f04('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1f04('0x47')]('user:%s',this[_0x1f04('0x1b')][_0x35c906[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]][_0x1f04('0x50')]),_0x1f04('0x51'),{'destaccountcode':this[_0x1f04('0x1b')][_0x35c906[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]][_0x1f04('0x4f')],'destconnectedlinenum':_0x35c906[_0x1f04('0x45')]});}}}}}}catch(_0x1bb12f){logger[_0x1f04('0x32')]('[%s][voiceCallReport][newchannel]',_0x35c906[_0x1f04('0x3a')],util['inspect'](_0x1bb12f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1f04('0x1e')]=function(_0x39f08a){try{if(this[_0x1f04('0x36')](_0x39f08a)){logger[_0x1f04('0x40')](_0x1f04('0x52'),_0x39f08a['uniqueid'],util[_0x1f04('0x34')](_0x39f08a,{'showHidden':![],'depth':null}));if(_0x39f08a[_0x1f04('0x3a')]===_0x39f08a[_0x1f04('0x41')]&&_0x39f08a['exten']!='h'&&_0x39f08a['channel']!='OutgoingSpoolFailed'){_0x39f08a[_0x1f04('0x53')]=_0x39f08a[_0x1f04('0x53')]['toLowerCase']();_0x39f08a['applicationdata']=(_0x39f08a['appdata']||_0x39f08a[_0x1f04('0x54')])['toLowerCase']();logger['info'](_0x1f04('0x55'),_0x39f08a[_0x1f04('0x3a')],_0x39f08a[_0x1f04('0x53')],_0x39f08a[_0x1f04('0x54')]);if(_[_0x1f04('0x37')](this[_0x1f04('0x1a')][_0x39f08a[_0x1f04('0x3a')]])){this['channels'][_0x39f08a[_0x1f04('0x3a')]]=new Channel();this[_0x1f04('0x1a')][_0x39f08a[_0x1f04('0x3a')]][_0x1f04('0x46')]=_0x39f08a[_0x1f04('0x56')]?moment()[_0x1f04('0x57')](moment['duration'](_0x39f08a[_0x1f04('0x56')])[_0x1f04('0x58')](),_0x1f04('0x58'))[_0x1f04('0x47')](_0x1f04('0x48')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1f04('0x1a')][_0x39f08a['uniqueid']][_0x1f04('0x49')]=_0x1f04('0x14');}_[_0x1f04('0x3d')](this[_0x1f04('0x1a')][_0x39f08a['uniqueid']],_[_0x1f04('0x3e')](_0x39f08a,_['keys'](this[_0x1f04('0x1a')][_0x39f08a['uniqueid']])));if(_[_0x1f04('0x59')](applications,_0x39f08a[_0x1f04('0x53')])){this[_0x1f04('0x1a')][_0x39f08a['uniqueid']][_0x1f04('0x5a')]=_0x39f08a[_0x1f04('0x53')];this['channels'][_0x39f08a[_0x1f04('0x3a')]]['lastdata']=_0x39f08a[_0x1f04('0x54')];if(_0x39f08a[_0x1f04('0x53')]==='set'&&_['startsWith'](_0x39f08a['applicationdata'],_0x1f04('0x5b'))){var _0xe54598=_0x39f08a['applicationdata']['split']('=');var _0xd2426f=_0xe54598[0x0][_0x1f04('0x5c')](/cdr\((.*)\)/);if(_0xd2426f){this['channels'][_0x39f08a[_0x1f04('0x3a')]][_0xd2426f[0x1]]=_0xe54598[0x1];}}else if(_0x39f08a[_0x1f04('0x53')]===_0x1f04('0xe')){this[_0x1f04('0x1a')][_0x39f08a[_0x1f04('0x3a')]][_0x1f04('0xe')]=_0x39f08a['applicationdata']['split'](',')[0x0];}}}}}catch(_0x2987e9){logger['error'](_0x1f04('0x5d'),_0x39f08a[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x2987e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1f04('0x35')][_0x1f04('0x24')]=function(_0x21ea41){try{if(this[_0x1f04('0x36')](_0x21ea41)){logger['info'](_0x1f04('0x5e'),_0x21ea41[_0x1f04('0x3a')],_0x21ea41[_0x1f04('0x41')],_0x21ea41[_0x1f04('0x5f')],_0x21ea41[_0x1f04('0x3b')]);logger[_0x1f04('0x40')](_0x1f04('0x60'),_0x21ea41[_0x1f04('0x3a')],util['inspect'](_0x21ea41,{'showHidden':![],'depth':null}));if(_0x21ea41['uniqueid']!==_0x21ea41['linkedid']){if(this[_0x1f04('0x1a')][_0x21ea41['linkedid']]){if(_0x21ea41[_0x1f04('0x4b')]==='6'){if(!this[_0x1f04('0x1a')][_0x21ea41['linkedid']]['answered']){var _0xa6f2b9=moment();this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]][_0x1f04('0x61')]=!![];this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]][_0x1f04('0x62')]=_0xa6f2b9[_0x1f04('0x47')](_0x1f04('0x48'));if(this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]][_0x1f04('0x46')]){this[_0x1f04('0x1a')][_0x21ea41['linkedid']][_0x1f04('0x63')]=_0xa6f2b9[_0x1f04('0x64')](this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]][_0x1f04('0x46')],_0x1f04('0x58'));}}this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]][_0x1f04('0x41')]=_0x21ea41['uniqueid'];if(_0x21ea41[_0x1f04('0x3b')]!=='xcally-motion-preview'){this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]]['connectedlinenum']=_0x21ea41[_0x1f04('0x3b')];}this[_0x1f04('0x1a')][_0x21ea41['linkedid']][_0x1f04('0x65')]=_0x21ea41['calleridname'];this['channels'][_0x21ea41['linkedid']][_0x1f04('0x66')]=_0x21ea41[_0x1f04('0x42')];this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]][_0x1f04('0x49')]=dispositions[_['toNumber'](_0x21ea41[_0x1f04('0x4b')])];if(this[_0x1f04('0x1b')][_0x21ea41['channel'][_0x1f04('0x4e')]('-')[0x0]]){this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]][_0x1f04('0x67')]=this[_0x1f04('0x1b')][_0x21ea41[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]]['id'];this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x41')]][_0x1f04('0x68')]=this['agents'][_0x21ea41['channel'][_0x1f04('0x4e')]('-')[0x0]][_0x1f04('0x50')];}}}}else{if(this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x3a')]]){if(_0x21ea41['channelstate']==='6'){if(this['agents'][_0x21ea41[_0x1f04('0x42')]['split']('-')[0x0]]){this[_0x1f04('0x1a')][_0x21ea41['uniqueid']][_0x1f04('0x67')]=this[_0x1f04('0x1b')][_0x21ea41['channel'][_0x1f04('0x4e')]('-')[0x0]]['id'];this[_0x1f04('0x1a')][_0x21ea41[_0x1f04('0x3a')]][_0x1f04('0x68')]=this[_0x1f04('0x1b')][_0x21ea41['channel'][_0x1f04('0x4e')]('-')[0x0]]['name'];}}}}}}catch(_0xda2a8f){logger[_0x1f04('0x32')](_0x1f04('0x69'),_0x21ea41[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0xda2a8f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1f04('0x35')]['syncMixMonitorFilename']=function(_0x54066c,_0x3075c6){try{if(this[_0x1f04('0x1a')][_0x54066c]){logger[_0x1f04('0x2f')](_0x1f04('0x6a'),_0x54066c,_0x3075c6);this[_0x1f04('0x1a')][_0x54066c][_0x1f04('0x6b')]=!![];if(_[_0x1f04('0x6c')](_0x3075c6,_0x1f04('0x6d'))){_0x3075c6=_0x3075c6['replace']('.wav49',_0x1f04('0x6e'));}this[_0x1f04('0x1a')][_0x54066c][_0x1f04('0x6f')]=_0x3075c6;var _0x194b43=_[_0x1f04('0x70')](this[_0x1f04('0x1a')][_0x54066c][_0x1f04('0x71')],{'filename':_0x3075c6});if(_[_0x1f04('0x72')](_0x194b43)){this[_0x1f04('0x1a')][_0x54066c][_0x1f04('0x71')][_0x1f04('0x73')]({'filename':_0x3075c6,'createdAt':moment()[_0x1f04('0x47')](_0x1f04('0x48')),'mixmonitorid':'','status':'rec'});}}}catch(_0x54a0e3){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x54066c,util[_0x1f04('0x34')](_0x54a0e3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1f04('0x35')][_0x1f04('0x26')]=function(_0x3a5267){try{if(this[_0x1f04('0x36')](_0x3a5267)){logger[_0x1f04('0x40')]('[%s][voiceCallReport][varset]\x20event:',_0x3a5267['uniqueid'],util['inspect'](_0x3a5267,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a5267[_0x1f04('0x3a')]]&&_0x3a5267['channel']!=_0x1f04('0x43')){if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')])){if(this[_0x1f04('0x36')](_0x3a5267['variable'][_0x1f04('0x75')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3a5267[_0x1f04('0x3a')],_0x3a5267[_0x1f04('0x76')]);this[_0x1f04('0x77')](_0x3a5267[_0x1f04('0x3a')],_0x3a5267[_0x1f04('0x76')]);}else if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')][_0x1f04('0x78')])){logger[_0x1f04('0x2f')](_0x1f04('0x79'),_0x3a5267['uniqueid'],_0x3a5267[_0x1f04('0x76')]);this[_0x1f04('0x1a')][_0x3a5267[_0x1f04('0x3a')]][_0x1f04('0x3b')]=_0x3a5267['value'];}else if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')][_0x1f04('0x7a')])){logger['info'](_0x1f04('0x7b'),_0x3a5267['uniqueid'],_0x3a5267[_0x1f04('0x76')]);this[_0x1f04('0x1a')][_0x3a5267[_0x1f04('0x3a')]][_0x1f04('0x7c')]=_0x3a5267[_0x1f04('0x76')];}else if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')]['xmd-cdrtype'])){logger[_0x1f04('0x2f')](_0x1f04('0x7d'),_0x3a5267['uniqueid'],_0x3a5267[_0x1f04('0x76')]);this['channels'][_0x3a5267[_0x1f04('0x3a')]][_0x1f04('0x7e')]=_0x3a5267[_0x1f04('0x76')];}else if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')][_0x1f04('0x7f')])){logger[_0x1f04('0x2f')](_0x1f04('0x80'),_0x3a5267[_0x1f04('0x3a')],_0x3a5267[_0x1f04('0x76')]['split'](',')[0x0]);this[_0x1f04('0x1a')][_0x3a5267['uniqueid']][_0x1f04('0xe')]=_0x3a5267['value'][_0x1f04('0x4e')](',')[0x0];}else if(this['isNotNull'](_0x3a5267[_0x1f04('0x74')][_0x1f04('0x81')])){logger[_0x1f04('0x2f')](_0x1f04('0x82'),_0x3a5267[_0x1f04('0x3a')],_0x3a5267[_0x1f04('0x76')]);this['channels'][_0x3a5267[_0x1f04('0x3a')]]['originatecalleridnum']=_0x3a5267[_0x1f04('0x76')];}else if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')][_0x1f04('0x83')])){logger[_0x1f04('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x3a5267['uniqueid'],_0x3a5267['value']);this[_0x1f04('0x1a')][_0x3a5267['uniqueid']][_0x1f04('0x84')]=_0x3a5267[_0x1f04('0x76')];}else if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')][_0x1f04('0x85')])){logger[_0x1f04('0x2f')](_0x1f04('0x86'),_0x3a5267[_0x1f04('0x3a')],_0x3a5267[_0x1f04('0x76')]);this[_0x1f04('0x1a')][_0x3a5267[_0x1f04('0x3a')]][_0x1f04('0x87')]=_0x3a5267[_0x1f04('0x76')];}else if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')][_0x1f04('0x88')])){logger[_0x1f04('0x2f')](_0x1f04('0x89'),_0x3a5267[_0x1f04('0x3a')],_0x3a5267[_0x1f04('0x76')]);this[_0x1f04('0x1a')][_0x3a5267['uniqueid']]['queue']=_0x3a5267[_0x1f04('0x76')];}else if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')]['sipcallid'])){logger['info'](_0x1f04('0x8a'),_0x3a5267[_0x1f04('0x3a')],_0x3a5267[_0x1f04('0x76')]);this[_0x1f04('0x1a')][_0x3a5267['uniqueid']][_0x1f04('0x8b')]=_0x3a5267[_0x1f04('0x76')];}}}else if(this[_0x1f04('0x36')](_0x3a5267['variable'][_0x1f04('0x75')])){if(_0x3a5267[_0x1f04('0x76')]){var _0xc8aaf=path['parse'](_0x3a5267[_0x1f04('0x76')])[_0x1f04('0x50')];logger[_0x1f04('0x2f')](_0x1f04('0x8c'),_0xc8aaf,_0x3a5267[_0x1f04('0x76')]);this[_0x1f04('0x77')](_0xc8aaf,_0x3a5267['value']);}}else if(this['channels'][_0x3a5267[_0x1f04('0x41')]]){if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')])){if(this[_0x1f04('0x36')](_0x3a5267[_0x1f04('0x74')]['sipcallid'])){logger[_0x1f04('0x2f')](_0x1f04('0x8a'),_0x3a5267[_0x1f04('0x41')],_0x3a5267[_0x1f04('0x76')]);this['channels'][_0x3a5267[_0x1f04('0x41')]][_0x1f04('0x8d')]=_0x3a5267[_0x1f04('0x76')];}}}}}catch(_0x21c414){logger[_0x1f04('0x32')](_0x1f04('0x8e'),_0x3a5267[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x21c414,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1f04('0x35')][_0x1f04('0x28')]=function(_0x2c09a0){try{if(this[_0x1f04('0x36')](_0x2c09a0)){logger[_0x1f04('0x40')](_0x1f04('0x8f'),_0x2c09a0[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x2c09a0,{'showHidden':![],'depth':null}));if(this[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]]){logger[_0x1f04('0x2f')](_0x1f04('0x90'),_0x2c09a0['uniqueid'],_0x2c09a0['cause-txt']);var _0x6143a5=moment();this[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]]['endtime']=_0x6143a5[_0x1f04('0x47')](_0x1f04('0x48'));this[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]][_0x1f04('0x56')]=_0x6143a5[_0x1f04('0x64')](this[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]][_0x1f04('0x46')],'seconds');if(this[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]][_0x1f04('0x61')]){this['channels'][_0x2c09a0[_0x1f04('0x3a')]][_0x1f04('0x91')]=_0x6143a5[_0x1f04('0x64')](this[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]][_0x1f04('0x62')],_0x1f04('0x58'));this[_0x1f04('0x1a')][_0x2c09a0['uniqueid']]['holdtime']=this[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]]['duration']-this['channels'][_0x2c09a0['uniqueid']][_0x1f04('0x91')];}if(_0x2c09a0[_0x1f04('0x92')]===_0x1f04('0x4d')){if(this[_0x1f04('0x1b')][_0x2c09a0[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]]){this[_0x1f04('0x1b')][_0x2c09a0[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]]=_['omit'](this['agents'][_0x2c09a0['channel']['split']('-')[0x0]],[_0x1f04('0x93')]);logger['debug'](_0x1f04('0x94'),_0x2c09a0[_0x1f04('0x3a')],util['inspect']({'destaccountcode':this[_0x1f04('0x1b')][_0x2c09a0[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]][_0x1f04('0x4f')]},{'showHidden':![],'depth':null}));this[_0x1f04('0x38')](util[_0x1f04('0x47')](_0x1f04('0x95'),this['agents'][_0x2c09a0[_0x1f04('0x42')][_0x1f04('0x4e')]('-')[0x0]][_0x1f04('0x50')]),_0x1f04('0x96'),{'destaccountcode':this['agents'][_0x2c09a0[_0x1f04('0x42')]['split']('-')[0x0]][_0x1f04('0x4f')]});}}var _0x5becb4=this;Promise[_0x1f04('0x97')]()['then'](function(){var _0x1e487a=_0x5becb4[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]];if(typeof _0x1e487a[_0x1f04('0x98')]===_0x1f04('0x99'))return;if(_[_0x1f04('0x9a')](_0x1e487a[_0x1f04('0x71')]))return;return RpcSetting['getSettings']()[_0x1f04('0x9b')](function(_0x339568){if(!_0x339568[_0x1f04('0x9c')])return;return Promise[_0x1f04('0x97')]()[_0x1f04('0x9b')](function(){return ami[_0x1f04('0x9d')]({'action':'StopMixMonitor','channel':_0x1e487a[_0x1f04('0x42')]})[_0x1f04('0x9e')](function(){});})['then'](function(){return ami[_0x1f04('0x9d')]({'action':_0x1f04('0x9f'),'channel':_0x1e487a[_0x1f04('0x66')]})[_0x1f04('0x9e')](function(){})['finally'](function(){var _0x3be970=_0x5becb4[_0x1f04('0x1b')][_0x1e487a[_0x1f04('0x66')][_0x1f04('0x4e')]('-')[0x0]];if(!_0x3be970)return;io['emit'](_0x1f04('0xa0'),{'agentId':_0x3be970['id'],'uniqueid':_0x1e487a[_0x1f04('0x3a')]});});});});})[_0x1f04('0x9b')](function(){if(_0x2c09a0['event']==='BlindTransfer'){_0x5becb4['blindTransfers'][_0x2c09a0[_0x1f04('0x3a')]]=_0x5becb4[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]];}else{if(_0x5becb4[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]][_0x1f04('0x7e')]==='outbound'&&_0x5becb4['blindTransfers'][_0x2c09a0[_0x1f04('0x3a')]]){_0x5becb4[_0x1f04('0x1a')][_0x2c09a0['uniqueid']][_0x1f04('0x3a')]=[_0x5becb4[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]][_0x1f04('0x41')],_0x5becb4[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]]['linkedid']=_0x5becb4[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]][_0x1f04('0x3a')]][0x0];delete _0x5becb4[_0x1f04('0x1c')][_0x2c09a0[_0x1f04('0x3a')]];}}logger[_0x1f04('0x40')](_0x1f04('0xa1'),_0x2c09a0['uniqueid'],util[_0x1f04('0x34')](_0x5becb4[_0x1f04('0x1a')][_0x2c09a0['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x1f04('0x38')](_0x1f04('0xa2'),_0x5becb4[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]]);delete _0x5becb4[_0x1f04('0x1a')][_0x2c09a0[_0x1f04('0x3a')]];});}}}catch(_0x348bca){logger[_0x1f04('0x32')]('[%s][voiceCallReport][hangup]',_0x2c09a0[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x348bca,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1f04('0x2a')]=function(_0x17b252){try{if(this[_0x1f04('0x36')](_0x17b252)){logger['info'](_0x1f04('0xa3'),_0x17b252[_0x1f04('0x3a')],_0x17b252['origtransferercalleridnum'],_0x17b252[_0x1f04('0xa4')]);logger[_0x1f04('0x40')](_0x1f04('0xa5'),_0x17b252[_0x1f04('0x3a')],util['inspect'](_0x17b252,{'showHidden':![],'depth':null}));if(this['channels'][_0x17b252[_0x1f04('0xa6')]]){this['channels'][_0x17b252[_0x1f04('0xa6')]][_0x1f04('0xa7')]=_0x17b252[_0x1f04('0xa8')];this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xa6')]]['transferconnectedlinenum']=_0x17b252[_0x1f04('0xa4')];if(this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xa9')]]){var _0x47eccf=this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xa9')]];this['channels'][_0x17b252[_0x1f04('0xa9')]]=this['channels'][_0x17b252[_0x1f04('0xa6')]];this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xa6')]]=_0x47eccf;}}else if(this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xaa')]]){this[_0x1f04('0x1a')][_0x17b252['transfertargetuniqueid']][_0x1f04('0xa7')]=_0x17b252[_0x1f04('0xa8')];this['channels'][_0x17b252[_0x1f04('0xaa')]]['transferconnectedlinenum']=_0x17b252['transfertargetcalleridnum'];if(this[_0x1f04('0x1a')][_0x17b252['origtransfereruniqueid']]){var _0x47eccf=this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xab')]];this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xab')]]=this[_0x1f04('0x1a')][_0x17b252['transfertargetuniqueid']];this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xaa')]]=_0x47eccf;}}if((this['channels'][_0x17b252[_0x1f04('0xab')]]||this[_0x1f04('0x1a')][_0x17b252['origtransfererlinkedid']])&&this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xa9')]]){var _0x574cc3=_[_0x1f04('0xac')]([this['channels'][_0x17b252[_0x1f04('0xab')]],this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xad')]],this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xa9')]]],function(_0x245d52){return _0x245d52&&_0x245d52[_0x1f04('0x7e')]===_0x1f04('0xae')&&_0x245d52['routeid'];});if(_0x574cc3){if(this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xab')]])this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xab')]][_0x1f04('0x98')]=_0x1f04('0xaf');if(this[_0x1f04('0x1a')][_0x17b252[_0x1f04('0xad')]])this[_0x1f04('0x1a')][_0x17b252['origtransfererlinkedid']]['transferType']=_0x1f04('0xaf');this[_0x1f04('0x1a')][_0x17b252['secondtransfereruniqueid']][_0x1f04('0x98')]=_0x1f04('0xaf');}}}}catch(_0x3b2a5a){logger[_0x1f04('0x32')](_0x1f04('0xb0'),_0x17b252['uniqueid'],util['inspect'](_0x3b2a5a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1f04('0x35')][_0x1f04('0x2c')]=function(_0x3b9416){try{if(this[_0x1f04('0x36')](_0x3b9416)){logger[_0x1f04('0x2f')](_0x1f04('0xb1'),_0x3b9416[_0x1f04('0x3a')],_0x3b9416[_0x1f04('0xb2')],_0x3b9416[_0x1f04('0xb3')]);logger['debug'](_0x1f04('0xb4'),_0x3b9416['uniqueid'],util[_0x1f04('0x34')](_0x3b9416,{'showHidden':![],'depth':null}));if(this['channels'][_0x3b9416[_0x1f04('0xa6')]]){this[_0x1f04('0x1a')][_0x3b9416[_0x1f04('0xa6')]][_0x1f04('0xa7')]=_0x3b9416[_0x1f04('0xb2')];this[_0x1f04('0x1a')][_0x3b9416['transfereeuniqueid']][_0x1f04('0xb5')]=_0x3b9416['extension'];this[_0x1f04('0x1a')][_0x3b9416['transfereeuniqueid']][_0x1f04('0x98')]=_0x1f04('0xb6');this[_0x1f04('0x28')]({'event':_0x1f04('0xb7'),'uniqueid':_0x3b9416[_0x1f04('0xa6')],'context':_0x3b9416['context'],'channel':_0x3b9416[_0x1f04('0xb8')]});}else{this['channels'][_0x3b9416[_0x1f04('0xb9')]][_0x1f04('0x98')]=_0x1f04('0xb6');}}}catch(_0xd496bd){logger['error'](_0x1f04('0xba'),_0x3b9416[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0xd496bd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1f04('0x2e')]=function(_0x11d0d4){try{if(this[_0x1f04('0x36')](_0x11d0d4)){logger[_0x1f04('0x40')](_0x1f04('0xbb'),_0x11d0d4[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x11d0d4,{'showHidden':![],'depth':null}));if(this[_0x1f04('0x1a')][_0x11d0d4['uniqueid']]){if(!_['isNil'](this[_0x1f04('0x1a')][_0x11d0d4[_0x1f04('0x3a')]][_0x1f04('0x62')])){this[_0x1f04('0x1a')][_0x11d0d4['uniqueid']][_0x1f04('0xbc')]=moment()[_0x1f04('0x47')](_0x1f04('0x48'));logger[_0x1f04('0x2f')](_0x1f04('0xbd'),_0x11d0d4['uniqueid'],this[_0x1f04('0x1a')][_0x11d0d4[_0x1f04('0x3a')]][_0x1f04('0xbc')]);}}}}catch(_0x1b2062){logger[_0x1f04('0x32')](_0x1f04('0xbe'),_0x11d0d4[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x1b2062,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1f04('0xbf')]=function(_0xf79d9e){try{if(this[_0x1f04('0x36')](_0xf79d9e)){logger[_0x1f04('0x40')](_0x1f04('0xc0'),_0xf79d9e[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0xf79d9e,{'showHidden':![],'depth':null}));if(this[_0x1f04('0x1a')][_0xf79d9e[_0x1f04('0x3a')]]){if(!_['isNil'](this['channels'][_0xf79d9e['uniqueid']][_0x1f04('0xbc')])){this[_0x1f04('0x1a')][_0xf79d9e[_0x1f04('0x3a')]][_0x1f04('0xc1')]+=moment()[_0x1f04('0xc2')](0x0)[_0x1f04('0x64')](this[_0x1f04('0x1a')][_0xf79d9e['uniqueid']][_0x1f04('0xbc')],'seconds');logger[_0x1f04('0x2f')](_0x1f04('0xc3'),_0xf79d9e[_0x1f04('0x3a')],this[_0x1f04('0x1a')][_0xf79d9e[_0x1f04('0x3a')]][_0x1f04('0xc1')]);delete this[_0x1f04('0x1a')][_0xf79d9e[_0x1f04('0x3a')]][_0x1f04('0xbc')];}}}}catch(_0x3f014e){logger[_0x1f04('0x32')](_0x1f04('0xc4'),_0xf79d9e[_0x1f04('0x3a')],util[_0x1f04('0x34')](_0x3f014e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index a14cc51..2928411 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 _0x51fb=['sumDuration','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','exports','lodash','moment','util','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','privilege','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','starttime','lastevent','complete','total','answered','diff','seconds','sumHoldTime','holdtime','sumBillable'];(function(_0x3cf302,_0x33d020){var _0x3ad0ae=function(_0x39d930){while(--_0x39d930){_0x3cf302['push'](_0x3cf302['shift']());}};_0x3ad0ae(++_0x33d020);}(_0x51fb,0xe1));var _0xb51f=function(_0x5c2bf9,_0x5cadcb){_0x5c2bf9=_0x5c2bf9-0x0;var _0x4f1285=_0x51fb[_0x5c2bf9];return _0x4f1285;};'use strict';var _=require(_0xb51f('0x0'));var moment=require(_0xb51f('0x1'));var util=require(_0xb51f('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xb51f('0x3'))(_0xb51f('0x4'));var ami=require(_0xb51f('0x5'));config[_0xb51f('0x6')]=_[_0xb51f('0x7')](config[_0xb51f('0x6')],{'host':_0xb51f('0x8'),'port':0x18eb});var io=require(_0xb51f('0x9'))(new Redis(config[_0xb51f('0x6')]));function VoiceDialReport(_0x1b74a2){this['channels']=_0x1b74a2[_0xb51f('0xa')];this[_0xb51f('0xb')]=_0x1b74a2[_0xb51f('0xb')];this[_0xb51f('0xc')]={};ami['on'](_0xb51f('0xd'),this['syncDialBegin']['bind'](this));ami['on'](_0xb51f('0xe'),this[_0xb51f('0xf')]['bind'](this));ami['on']('varset',this[_0xb51f('0x10')]['bind'](this));ami['on'](_0xb51f('0x11'),this[_0xb51f('0x12')]['bind'](this));}VoiceDialReport['prototype'][_0xb51f('0x13')]=function(_0x5d0fd0){return _0x5d0fd0!==null&&!_[_0xb51f('0x14')](_0x5d0fd0);};VoiceDialReport[_0xb51f('0x15')][_0xb51f('0x16')]=function(_0x2c3786,_0x12fabe,_0x844629){io['to'](_0x2c3786)['emit'](_0x12fabe,_0x844629);};VoiceDialReport[_0xb51f('0x15')]['syncDialBegin']=function(_0xf2a70c){try{if(this[_0xb51f('0x13')](_0xf2a70c)){logger[_0xb51f('0x17')](_0xb51f('0x18'),_0xf2a70c[_0xb51f('0x19')],util[_0xb51f('0x1a')](_0xf2a70c,{'showHidden':![],'depth':null}));if(this[_0xb51f('0x1b')][_0xf2a70c[_0xb51f('0x19')]]){_['merge'](this['channels'][_0xf2a70c[_0xb51f('0x19')]],{'starttime':moment()[_0xb51f('0x1c')](_0xb51f('0x1d')),'lastevent':_0xb51f('0x1e'),'interface':_0xf2a70c['channel'][_0xb51f('0x1f')](0x0,_0xf2a70c[_0xb51f('0x20')][_0xb51f('0x21')]('-')),'membername':_0xf2a70c['channel'][_0xb51f('0x1f')](_0xf2a70c[_0xb51f('0x20')][_0xb51f('0x21')]('/')+0x1,_0xf2a70c[_0xb51f('0x20')][_0xb51f('0x21')]('-'))},_[_0xb51f('0x22')](_0xf2a70c,['event',_0xb51f('0x23')]));logger[_0xb51f('0x24')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0xf2a70c['uniqueid'],this['channels'][_0xf2a70c[_0xb51f('0x19')]][_0xb51f('0x25')],this[_0xb51f('0x1b')][_0xf2a70c['uniqueid']][_0xb51f('0x26')]);logger[_0xb51f('0x17')](_0xb51f('0x27'),_0xf2a70c[_0xb51f('0x19')],util[_0xb51f('0x1a')](this[_0xb51f('0x1b')][_0xf2a70c['uniqueid']],{'showHidden':![],'depth':null}));this[_0xb51f('0x16')](_0xb51f('0x28'),_0xb51f('0x29'),this[_0xb51f('0x1b')][_0xf2a70c[_0xb51f('0x19')]]);logger['debug'](_0xb51f('0x2a'),_0xf2a70c['uniqueid'],util[_0xb51f('0x1a')](this[_0xb51f('0x1b')][_0xf2a70c[_0xb51f('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb51f('0x16')](_0xb51f('0x2b'),this['channels'][_0xf2a70c[_0xb51f('0x19')]]);}}}catch(_0x2176a9){logger[_0xb51f('0x2c')](_0xb51f('0x2d'),_0xf2a70c[_0xb51f('0x19')],util[_0xb51f('0x1a')](_0x2176a9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb51f('0x15')][_0xb51f('0xf')]=function(_0x18e717){try{if(this[_0xb51f('0x13')](_0x18e717)){logger[_0xb51f('0x17')](_0xb51f('0x2e'),_0x18e717[_0xb51f('0x19')],util[_0xb51f('0x1a')](_0x18e717,{'showHidden':![],'depth':null}));if(this[_0xb51f('0x1b')][_0x18e717['uniqueid']]){this[_0xb51f('0x1b')][_0x18e717[_0xb51f('0x19')]]['dialstatus']=_0x18e717[_0xb51f('0x2f')];if(_0x18e717[_0xb51f('0x2f')]===_0xb51f('0x30')){this[_0xb51f('0x1b')][_0x18e717[_0xb51f('0x19')]][_0xb51f('0x31')]=_0x18e717[_0xb51f('0x31')];this[_0xb51f('0x1b')][_0x18e717[_0xb51f('0x19')]][_0xb51f('0x32')]=_0x18e717['connectedlinename'];this[_0xb51f('0x1b')][_0x18e717['uniqueid']][_0xb51f('0x33')]=moment()['format'](_0xb51f('0x1d'));this['channels'][_0x18e717['uniqueid']]['lastevent']=_0xb51f('0x34');logger['info'](_0xb51f('0x35'),_0x18e717[_0xb51f('0x19')],_0x18e717['channel'][_0xb51f('0x1f')](_0x18e717['channel'][_0xb51f('0x21')]('/')+0x1,_0x18e717[_0xb51f('0x20')]['lastIndexOf']('-')));logger[_0xb51f('0x17')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x18e717[_0xb51f('0x19')],util['inspect'](this[_0xb51f('0x1b')][_0x18e717[_0xb51f('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb51f('0x16')](_0xb51f('0x36'),this[_0xb51f('0x1b')][_0x18e717[_0xb51f('0x19')]]);}logger[_0xb51f('0x17')](_0xb51f('0x37'),_0x18e717[_0xb51f('0x19')],util[_0xb51f('0x1a')](this['channels'][_0x18e717[_0xb51f('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0xb51f('0x28'),'voice_outbound_channel:save',this['channels'][_0x18e717['uniqueid']]);}}}catch(_0x21bbd6){logger[_0xb51f('0x2c')](_0xb51f('0x38'),_0x18e717['uniqueid'],util[_0xb51f('0x1a')](_0x21bbd6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb51f('0x15')][_0xb51f('0x10')]=function(_0xa0d61d){try{if(this[_0xb51f('0x13')](_0xa0d61d)){logger[_0xb51f('0x17')](_0xb51f('0x39'),_0xa0d61d['uniqueid'],util[_0xb51f('0x1a')](_0xa0d61d,{'showHidden':![],'depth':null}));this[_0xb51f('0x3a')](_0xa0d61d[_0xb51f('0x19')],_['keys'](_0xa0d61d['variable'])[0x0],_0xa0d61d['value']);if(this[_0xb51f('0x13')](_0xa0d61d[_0xb51f('0x3b')])&&this['isNotNull'](_0xa0d61d['variable']['outboundrouteid'])){if(_['isUndefined'](this['channels'][_0xa0d61d[_0xb51f('0x19')]])){this['channels'][_0xa0d61d['uniqueid']]={'routeId':_0xa0d61d[_0xb51f('0x3c')],'variables':this[_0xb51f('0xc')][_0xa0d61d[_0xb51f('0x19')]]};logger[_0xb51f('0x24')](_0xb51f('0x3d'),_0xa0d61d[_0xb51f('0x19')],_0xa0d61d[_0xb51f('0x3b')][_0xb51f('0x3e')],_[_0xb51f('0x3f')](_0xa0d61d[_0xb51f('0x3b')])[0x0],_0xa0d61d['value']);logger['debug'](_0xb51f('0x40'),_0xa0d61d['uniqueid'],util[_0xb51f('0x1a')](this[_0xb51f('0x1b')][_0xa0d61d[_0xb51f('0x19')]],{'showHidden':![],'depth':null}));this[_0xb51f('0x16')](_0xb51f('0x28'),'voice_outbound_channel:save',this['channels'][_0xa0d61d[_0xb51f('0x19')]]);}}}}catch(_0x4afc6d){logger[_0xb51f('0x2c')](_0xb51f('0x41'),_0xa0d61d['uniqueid'],util[_0xb51f('0x1a')](_0x4afc6d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb51f('0x15')][_0xb51f('0x3a')]=function(_0x26fec8,_0x12f076,_0x18e3c4){var _0x4f99e4=[_0xb51f('0x42'),_0xb51f('0x43'),_0xb51f('0x44'),_0xb51f('0x45'),_0xb51f('0x46'),_0xb51f('0x47'),_0xb51f('0x48'),'rtpaudioqosrttbridged',_0xb51f('0x49'),_0xb51f('0x4a'),_0xb51f('0x4b'),_0xb51f('0x4c'),_0xb51f('0x4d'),_0xb51f('0x4e'),'memberinterface','memberlastcall',_0xb51f('0x25'),_0xb51f('0x4f'),_0xb51f('0x50')];if(!_['isNil'](_0x12f076)&&!_[_0xb51f('0x51')](_0x4f99e4,_0x12f076)){if(_[_0xb51f('0x14')](this[_0xb51f('0xc')][_0x26fec8])){this[_0xb51f('0xc')][_0x26fec8]={};}this[_0xb51f('0xc')][_0x26fec8][_0x12f076]=_0x18e3c4;}};VoiceDialReport[_0xb51f('0x15')]['syncHangup']=function(_0x427351){try{if(this[_0xb51f('0x13')](_0x427351)){logger['debug'](_0xb51f('0x52'),_0x427351[_0xb51f('0x19')],util[_0xb51f('0x1a')](_0x427351,{'showHidden':![],'depth':null}));if(this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]]){logger[_0xb51f('0x24')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x427351[_0xb51f('0x19')],_0x427351[_0xb51f('0x53')]);this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x54')]=moment()[_0xb51f('0x1c')](_0xb51f('0x1d'));this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x55')]=moment(this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x54')])['diff'](this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x56')],'seconds');this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x57')]=_0xb51f('0x58');this['outbound'][_0xb51f('0x59')]+=0x1;if(this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]]['answertime']){this[_0xb51f('0xb')][_0xb51f('0x5a')]+=0x1;this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]]['holdtime']=moment(this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x33')])[_0xb51f('0x5b')](this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x56')],_0xb51f('0x5c'));this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]]['billableseconds']=moment(this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]]['endtime'])[_0xb51f('0x5b')](this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x33')],_0xb51f('0x5c'));this[_0xb51f('0xb')][_0xb51f('0x5d')]+=this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x5e')]||0x0;this[_0xb51f('0xb')][_0xb51f('0x5f')]+=this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]]['billableseconds'];}this['outbound'][_0xb51f('0x60')]+=this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]][_0xb51f('0x55')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x427351['uniqueid'],util[_0xb51f('0x1a')](this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb51f('0x16')]('custom:voiceDialReport',this[_0xb51f('0x1b')][_0x427351['uniqueid']]);logger[_0xb51f('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x427351[_0xb51f('0x19')],util[_0xb51f('0x1a')](this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb51f('0x16')](_0xb51f('0x61'),this['channels'][_0x427351[_0xb51f('0x19')]]);logger[_0xb51f('0x17')](_0xb51f('0x62'),_0x427351[_0xb51f('0x19')],util[_0xb51f('0x1a')](this[_0xb51f('0x1b')][_0x427351['uniqueid']],{'showHidden':![],'depth':null}));this[_0xb51f('0x16')](_0xb51f('0x28'),_0xb51f('0x63'),this[_0xb51f('0xb')]);logger[_0xb51f('0x24')](_0xb51f('0x64'),JSON[_0xb51f('0x65')](this[_0xb51f('0x1b')][_0x427351['uniqueid']]));logger[_0xb51f('0x17')](_0xb51f('0x66'),_0x427351[_0xb51f('0x19')],util['inspect'](this['channels'][_0x427351[_0xb51f('0x19')]],{'showHidden':![],'depth':null}));this[_0xb51f('0x16')](_0xb51f('0x28'),_0xb51f('0x67'),this['channels'][_0x427351[_0xb51f('0x19')]]);delete this['channels'][_0x427351[_0xb51f('0x19')]];}else if(this['channels'][_0x427351['linkedid']]){this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x68')]][_0xb51f('0x19')]=this[_0xb51f('0x1b')][_0x427351[_0xb51f('0x68')]][_0xb51f('0x69')];}if(this['variables'][_0x427351['uniqueid']]){delete this[_0xb51f('0xc')][_0x427351[_0xb51f('0x19')]];}}}catch(_0x36c4dd){logger[_0xb51f('0x2c')]('[%s][voiceDialReport][hangup]',_0x427351[_0xb51f('0x19')],util[_0xb51f('0x1a')](_0x36c4dd,{'showHidden':![],'depth':null}));}};module[_0xb51f('0x6a')]=VoiceDialReport; \ No newline at end of file +var _0x90d4=['lastIndexOf','substring','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','addVariable','variable','value','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','cause-txt','endtime','diff','starttime','seconds','complete','outbound','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','exports','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','prototype','emit','syncDialBegin','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel'];(function(_0x1baf44,_0x28a787){var _0x4f0588=function(_0x5cf6c0){while(--_0x5cf6c0){_0x1baf44['push'](_0x1baf44['shift']());}};_0x4f0588(++_0x28a787);}(_0x90d4,0xaf));var _0x490d=function(_0x1dd83f,_0x1d0bf3){_0x1dd83f=_0x1dd83f-0x0;var _0x4a43f4=_0x90d4[_0x1dd83f];return _0x4a43f4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x490d('0x0'));var Redis=require(_0x490d('0x1'));var config=require('../../../config/environment');var logger=require(_0x490d('0x2'))(_0x490d('0x3'));var ami=require(_0x490d('0x4'));config[_0x490d('0x5')]=_[_0x490d('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x490d('0x7'))(new Redis(config[_0x490d('0x5')]));function VoiceDialReport(_0x2593c3){this[_0x490d('0x8')]=_0x2593c3[_0x490d('0x9')];this['outbound']=_0x2593c3['outbound'];this['variables']={};ami['on'](_0x490d('0xa'),this['syncDialBegin'][_0x490d('0xb')](this));ami['on'](_0x490d('0xc'),this[_0x490d('0xd')][_0x490d('0xb')](this));ami['on'](_0x490d('0xe'),this[_0x490d('0xf')][_0x490d('0xb')](this));ami['on'](_0x490d('0x10'),this[_0x490d('0x11')][_0x490d('0xb')](this));}VoiceDialReport['prototype'][_0x490d('0x12')]=function(_0x13c27a){return _0x13c27a!==null&&!_['isUndefined'](_0x13c27a);};VoiceDialReport[_0x490d('0x13')][_0x490d('0x14')]=function(_0x5e52d8,_0x1dcb2b,_0x1a136f){io['to'](_0x5e52d8)[_0x490d('0x14')](_0x1dcb2b,_0x1a136f);};VoiceDialReport[_0x490d('0x13')][_0x490d('0x15')]=function(_0x27a54a){try{if(this['isNotNull'](_0x27a54a)){logger[_0x490d('0x16')](_0x490d('0x17'),_0x27a54a[_0x490d('0x18')],util[_0x490d('0x19')](_0x27a54a,{'showHidden':![],'depth':null}));if(this['channels'][_0x27a54a[_0x490d('0x18')]]){_[_0x490d('0x1a')](this[_0x490d('0x8')][_0x27a54a['uniqueid']],{'starttime':moment()[_0x490d('0x1b')](_0x490d('0x1c')),'lastevent':_0x490d('0x1d'),'interface':_0x27a54a['channel']['substring'](0x0,_0x27a54a[_0x490d('0x1e')][_0x490d('0x1f')]('-')),'membername':_0x27a54a['channel'][_0x490d('0x20')](_0x27a54a[_0x490d('0x1e')]['lastIndexOf']('/')+0x1,_0x27a54a['channel'][_0x490d('0x1f')]('-'))},_[_0x490d('0x21')](_0x27a54a,[_0x490d('0x22'),_0x490d('0x23')]));logger[_0x490d('0x24')](_0x490d('0x25'),_0x27a54a[_0x490d('0x18')],this[_0x490d('0x8')][_0x27a54a[_0x490d('0x18')]][_0x490d('0x26')],this[_0x490d('0x8')][_0x27a54a[_0x490d('0x18')]][_0x490d('0x27')]);logger[_0x490d('0x16')](_0x490d('0x28'),_0x27a54a['uniqueid'],util[_0x490d('0x19')](this['channels'][_0x27a54a[_0x490d('0x18')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x490d('0x8')][_0x27a54a[_0x490d('0x18')]]);logger['debug'](_0x490d('0x29'),_0x27a54a[_0x490d('0x18')],util[_0x490d('0x19')](this[_0x490d('0x8')][_0x27a54a[_0x490d('0x18')]],{'showHidden':![],'depth':null}));ami[_0x490d('0x14')](_0x490d('0x2a'),this[_0x490d('0x8')][_0x27a54a[_0x490d('0x18')]]);}}}catch(_0x205b29){logger[_0x490d('0x2b')](_0x490d('0x2c'),_0x27a54a[_0x490d('0x18')],util['inspect'](_0x205b29,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x490d('0x13')]['syncDialEnd']=function(_0x476fa5){try{if(this[_0x490d('0x12')](_0x476fa5)){logger[_0x490d('0x16')](_0x490d('0x2d'),_0x476fa5[_0x490d('0x18')],util['inspect'](_0x476fa5,{'showHidden':![],'depth':null}));if(this[_0x490d('0x8')][_0x476fa5[_0x490d('0x18')]]){this[_0x490d('0x8')][_0x476fa5['uniqueid']][_0x490d('0x2e')]=_0x476fa5[_0x490d('0x2e')];if(_0x476fa5[_0x490d('0x2e')]===_0x490d('0x2f')){this[_0x490d('0x8')][_0x476fa5[_0x490d('0x18')]]['connectedlinenum']=_0x476fa5[_0x490d('0x30')];this[_0x490d('0x8')][_0x476fa5['uniqueid']][_0x490d('0x31')]=_0x476fa5['connectedlinename'];this[_0x490d('0x8')][_0x476fa5[_0x490d('0x18')]][_0x490d('0x32')]=moment()[_0x490d('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x490d('0x8')][_0x476fa5['uniqueid']][_0x490d('0x33')]='connect';logger[_0x490d('0x24')](_0x490d('0x34'),_0x476fa5[_0x490d('0x18')],_0x476fa5[_0x490d('0x1e')][_0x490d('0x20')](_0x476fa5[_0x490d('0x1e')][_0x490d('0x1f')]('/')+0x1,_0x476fa5[_0x490d('0x1e')]['lastIndexOf']('-')));logger[_0x490d('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x476fa5[_0x490d('0x18')],util[_0x490d('0x19')](this[_0x490d('0x8')][_0x476fa5['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x490d('0x14')](_0x490d('0x35'),this[_0x490d('0x8')][_0x476fa5[_0x490d('0x18')]]);}logger[_0x490d('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x476fa5[_0x490d('0x18')],util['inspect'](this[_0x490d('0x8')][_0x476fa5['uniqueid']],{'showHidden':![],'depth':null}));this[_0x490d('0x14')](_0x490d('0x36'),_0x490d('0x37'),this[_0x490d('0x8')][_0x476fa5['uniqueid']]);}}}catch(_0x2a63dc){logger[_0x490d('0x2b')](_0x490d('0x38'),_0x476fa5[_0x490d('0x18')],util[_0x490d('0x19')](_0x2a63dc,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x4359c8){try{if(this['isNotNull'](_0x4359c8)){logger[_0x490d('0x16')]('[%s][voiceDialReport][varset]\x20event:',_0x4359c8[_0x490d('0x18')],util[_0x490d('0x19')](_0x4359c8,{'showHidden':![],'depth':null}));this[_0x490d('0x39')](_0x4359c8['uniqueid'],_['keys'](_0x4359c8[_0x490d('0x3a')])[0x0],_0x4359c8[_0x490d('0x3b')]);if(this[_0x490d('0x12')](_0x4359c8[_0x490d('0x3a')])&&this[_0x490d('0x12')](_0x4359c8[_0x490d('0x3a')][_0x490d('0x3c')])){if(_['isUndefined'](this[_0x490d('0x8')][_0x4359c8[_0x490d('0x18')]])){this[_0x490d('0x8')][_0x4359c8[_0x490d('0x18')]]={'routeId':_0x4359c8[_0x490d('0x3b')],'variables':this[_0x490d('0x3d')][_0x4359c8[_0x490d('0x18')]]};logger[_0x490d('0x24')](_0x490d('0x3e'),_0x4359c8[_0x490d('0x18')],_0x4359c8[_0x490d('0x3a')][_0x490d('0x3c')],_['keys'](_0x4359c8[_0x490d('0x3a')])[0x0],_0x4359c8['value']);logger[_0x490d('0x16')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4359c8[_0x490d('0x18')],util[_0x490d('0x19')](this[_0x490d('0x8')][_0x4359c8['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x490d('0x36'),_0x490d('0x37'),this[_0x490d('0x8')][_0x4359c8[_0x490d('0x18')]]);}}}}catch(_0x514c9a){logger[_0x490d('0x2b')]('[%s][voiceDialReport][varset]',_0x4359c8[_0x490d('0x18')],util[_0x490d('0x19')](_0x514c9a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x490d('0x13')]['addVariable']=function(_0x27e959,_0x30c1f7,_0x1b7e32){var _0x53ac3a=[_0x490d('0x3f'),_0x490d('0x40'),_0x490d('0x41'),_0x490d('0x42'),_0x490d('0x43'),_0x490d('0x44'),_0x490d('0x45'),'rtpaudioqosrttbridged',_0x490d('0x46'),_0x490d('0x47'),'bridgepeer',_0x490d('0x48'),_0x490d('0x49'),_0x490d('0x4a'),_0x490d('0x4b'),_0x490d('0x4c'),'membername','memberpenalty',_0x490d('0x4d')];if(!_['isNil'](_0x30c1f7)&&!_[_0x490d('0x4e')](_0x53ac3a,_0x30c1f7)){if(_['isUndefined'](this[_0x490d('0x3d')][_0x27e959])){this['variables'][_0x27e959]={};}this[_0x490d('0x3d')][_0x27e959][_0x30c1f7]=_0x1b7e32;}};VoiceDialReport['prototype'][_0x490d('0x11')]=function(_0xc08157){try{if(this['isNotNull'](_0xc08157)){logger[_0x490d('0x16')]('[%s][voiceDialReport][hangup]\x20event:',_0xc08157[_0x490d('0x18')],util['inspect'](_0xc08157,{'showHidden':![],'depth':null}));if(this[_0x490d('0x8')][_0xc08157['uniqueid']]){logger[_0x490d('0x24')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0xc08157[_0x490d('0x18')],_0xc08157[_0x490d('0x4f')]);this['channels'][_0xc08157[_0x490d('0x18')]][_0x490d('0x50')]=moment()['format'](_0x490d('0x1c'));this['channels'][_0xc08157[_0x490d('0x18')]]['duration']=moment(this[_0x490d('0x8')][_0xc08157['uniqueid']]['endtime'])[_0x490d('0x51')](this[_0x490d('0x8')][_0xc08157['uniqueid']][_0x490d('0x52')],_0x490d('0x53'));this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]][_0x490d('0x33')]=_0x490d('0x54');this[_0x490d('0x55')][_0x490d('0x56')]+=0x1;if(this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]]['answertime']){this[_0x490d('0x55')][_0x490d('0x57')]+=0x1;this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]][_0x490d('0x58')]=moment(this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]][_0x490d('0x32')])[_0x490d('0x51')](this['channels'][_0xc08157['uniqueid']][_0x490d('0x52')],'seconds');this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]][_0x490d('0x59')]=moment(this[_0x490d('0x8')][_0xc08157['uniqueid']][_0x490d('0x50')])[_0x490d('0x51')](this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]][_0x490d('0x32')],_0x490d('0x53'));this[_0x490d('0x55')][_0x490d('0x5a')]+=this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]][_0x490d('0x58')]||0x0;this[_0x490d('0x55')][_0x490d('0x5b')]+=this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]][_0x490d('0x59')];}this[_0x490d('0x55')][_0x490d('0x5c')]+=this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]]['duration'];logger[_0x490d('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0xc08157[_0x490d('0x18')],util['inspect'](this['channels'][_0xc08157[_0x490d('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0x490d('0x5d'),this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]]);logger[_0x490d('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0xc08157[_0x490d('0x18')],util[_0x490d('0x19')](this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]],{'showHidden':![],'depth':null}));ami[_0x490d('0x14')](_0x490d('0x5e'),this['channels'][_0xc08157[_0x490d('0x18')]]);logger[_0x490d('0x16')](_0x490d('0x5f'),_0xc08157[_0x490d('0x18')],util['inspect'](this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]],{'showHidden':![],'depth':null}));this[_0x490d('0x14')]('voice:outbound',_0x490d('0x60'),this[_0x490d('0x55')]);logger['info'](_0x490d('0x61'),JSON[_0x490d('0x62')](this['channels'][_0xc08157[_0x490d('0x18')]]));logger[_0x490d('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0xc08157[_0x490d('0x18')],util[_0x490d('0x19')](this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]],{'showHidden':![],'depth':null}));this[_0x490d('0x14')](_0x490d('0x36'),_0x490d('0x63'),this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]]);delete this[_0x490d('0x8')][_0xc08157[_0x490d('0x18')]];}else if(this[_0x490d('0x8')][_0xc08157[_0x490d('0x64')]]){this[_0x490d('0x8')][_0xc08157[_0x490d('0x64')]][_0x490d('0x18')]=this[_0x490d('0x8')][_0xc08157['linkedid']]['destuniqueid'];}if(this[_0x490d('0x3d')][_0xc08157[_0x490d('0x18')]]){delete this['variables'][_0xc08157['uniqueid']];}}}catch(_0x312d8e){logger[_0x490d('0x2b')](_0x490d('0x65'),_0xc08157[_0x490d('0x18')],util[_0x490d('0x19')](_0x312d8e,{'showHidden':![],'depth':null}));}};module[_0x490d('0x66')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index d15a081..827ff84 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 _0x39cb=['bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','sequence','isNil','Action','status','channel','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','answered','available','sumBillable','total','unmanaged','abandoned','waiting','Trunk','active','callerid','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','queues','catch','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedIn','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','local/','linkedid','queuecallerexit','add','seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','variable','value','queuestatus','CONTINUE','TIMEOUT','custom:timeout','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberlastcall','memberpenalty','includes','[%s][voiceQueueReport][hangup]','length','sumHoldTime','diff','sumDuration','milliseconds','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','moment','util','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete'];(function(_0x2b4834,_0x293d85){var _0xe63e8a=function(_0x3dee20){while(--_0x3dee20){_0x2b4834['push'](_0x2b4834['shift']());}};_0xe63e8a(++_0x293d85);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var moment=require(_0xb39c('0x0'));var util=require(_0xb39c('0x1'));var md5=require('md5');var Redis=require(_0xb39c('0x2'));var config=require(_0xb39c('0x3'));var logger=require('../../../config/logger')(_0xb39c('0x4'));var ami=require(_0xb39c('0x5'));var QueueReport=require(_0xb39c('0x6'));config[_0xb39c('0x7')]=_[_0xb39c('0x8')](config['redis'],{'host':_0xb39c('0x9'),'port':0x18eb});var io=require(_0xb39c('0xa'))(new Redis(config[_0xb39c('0x7')]));var Sequence=function(){};Sequence[_0xb39c('0xb')]['enqueue']=function(_0x5ae14a){this[_0xb39c('0xc')]=this[_0xb39c('0xc')]?this[_0xb39c('0xc')][_0xb39c('0xd')](_0x5ae14a):_0x5ae14a();};function VoiceQueueReport(_0x5402b2){this['sequence']=new Sequence();this['queueReports']={};this[_0xb39c('0xe')]=_0x5402b2[_0xb39c('0xe')];this[_0xb39c('0xf')]=_0x5402b2[_0xb39c('0x10')];this[_0xb39c('0x11')]=_0x5402b2[_0xb39c('0x11')];this[_0xb39c('0x12')]=!![];this[_0xb39c('0x13')]=_0x5402b2['campaigns'];this[_0xb39c('0x14')]={};ami['on'](_0xb39c('0x15'),this[_0xb39c('0x16')]['bind'](this));ami['on'](_0xb39c('0x17'),this[_0xb39c('0x18')][_0xb39c('0x19')](this));ami['on'](_0xb39c('0x1a'),this[_0xb39c('0x1b')][_0xb39c('0x19')](this));ami['on'](_0xb39c('0x1c'),this['syncQueueCallerAbandon'][_0xb39c('0x19')](this));ami['on'](_0xb39c('0x1d'),this[_0xb39c('0x1e')][_0xb39c('0x19')](this));ami['on'](_0xb39c('0x1f'),this[_0xb39c('0x20')][_0xb39c('0x19')](this));ami['on'](_0xb39c('0x21'),this[_0xb39c('0x22')][_0xb39c('0x19')](this));ami['on']('varset',this[_0xb39c('0x23')][_0xb39c('0x19')](this));ami['on'](_0xb39c('0x24'),this[_0xb39c('0x25')]['bind'](this));ami['on'](_0xb39c('0x26'),this[_0xb39c('0x27')]['bind'](this));ami['on'](_0xb39c('0x28'),this[_0xb39c('0x29')][_0xb39c('0x19')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xb39c('0x19')](this));ami['on'](_0xb39c('0x2a'),this[_0xb39c('0x2b')]['bind'](this));ami['on'](_0xb39c('0x2c'),this[_0xb39c('0x2d')][_0xb39c('0x19')](this));this[_0xb39c('0x2e')]();this[_0xb39c('0x2f')]();}function clearChannels(_0x4a32f6){if(!_[_0xb39c('0x30')](_0x4a32f6)){for(var _0xbeab7e in _0x4a32f6){if(_0x4a32f6['hasOwnProperty'](_0xbeab7e)){delete _0x4a32f6[_0xbeab7e];}}}}function clearCampaigns(_0x1fd145){if(!_[_0xb39c('0x30')](_0x1fd145)){for(var _0x39116b in _0x1fd145){if(_0x1fd145[_0xb39c('0x31')](_0x39116b)){_0x1fd145[_0x39116b][_0xb39c('0x32')]=0x0;}}}}function clearVoiceQueues(_0x5453a6){if(!_[_0xb39c('0x30')](_0x5453a6)){for(var _0x299c27 in _0x5453a6){if(_0x5453a6[_0xb39c('0x31')](_0x299c27)){_0x5453a6[_0x299c27]['originated']=0x0;_0x5453a6[_0x299c27][_0xb39c('0x33')]=0x0;_0x5453a6[_0x299c27][_0xb39c('0x34')]=0x0;_0x5453a6[_0x299c27]['waiting']=0x0;_0x5453a6[_0x299c27][_0xb39c('0x35')]=!![];}}}}function clearAgentBooked(_0x4b4458){if(!_[_0xb39c('0x30')](_0x4b4458)){for(var _0x4e9672 in _0x4b4458){if(_0x4b4458[_0xb39c('0x31')](_0x4e9672)){_0x4b4458[_0x4e9672][_0xb39c('0x36')]=!![];}}}}VoiceQueueReport['prototype'][_0xb39c('0x37')]=function(){var _0x501708=this;for(var _0x8e2d7 in this[_0xb39c('0xf')]){if(this[_0xb39c('0xf')][_0xb39c('0x31')](_0x8e2d7)&&!this[_0xb39c('0xf')][_0x8e2d7]['switch']){this[_0xb39c('0x38')]['enqueue'](function(){if(!_[_0xb39c('0x39')](_0x501708['channels'][_0x8e2d7])){return ami[_0xb39c('0x3a')]({'action':_0xb39c('0x3b'),'channel':_0x501708[_0xb39c('0xf')][_0x8e2d7][_0xb39c('0x3c')]})['catch'](function(_0x47f58f){if(_0x47f58f[_0xb39c('0x3d')]===_0xb39c('0x3e')){setTimeout(function(){if(_0x501708['channels'][_0x8e2d7]){delete _0x501708[_0xb39c('0xf')][_0x8e2d7];logger[_0xb39c('0x3f')](_0xb39c('0x40'),_0x8e2d7,util[_0xb39c('0x41')](_0x47f58f,{'showHidden':![],'depth':null}));}if(_0x501708[_0xb39c('0x42')][_0x8e2d7]){delete _0x501708[_0xb39c('0x42')][_0x8e2d7];logger[_0xb39c('0x3f')](_0xb39c('0x43'),_0x8e2d7,util[_0xb39c('0x41')](_0x47f58f,{'showHidden':![],'depth':null}));}if(_0x501708[_0xb39c('0x14')][_0x8e2d7]){delete _0x501708[_0xb39c('0x14')][_0x8e2d7];logger[_0xb39c('0x3f')](_0xb39c('0x44'),_0x8e2d7,util[_0xb39c('0x41')](_0x47f58f,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xb39c('0xb')][_0xb39c('0x27')]=function(){logger[_0xb39c('0x3f')](_0xb39c('0x45'));clearChannels(this[_0xb39c('0xf')]);this['clearQueueReport'](this[_0xb39c('0x42')]);clearAgentBooked(this[_0xb39c('0xe')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype'][_0xb39c('0x46')]=function(_0x33e468){var _0xe6bc2e=this;if(!_['isEmpty'](_0x33e468)){for(var _0x3071dd in _0x33e468){if(_0x33e468[_0xb39c('0x31')](_0x3071dd)){_0xe6bc2e[_0xb39c('0x47')](_0x33e468[_0x3071dd],_0xb39c('0x48'));delete _0x33e468[_0x3071dd];}}}};VoiceQueueReport[_0xb39c('0xb')]['emit']=function(_0x3cdeeb,_0x3000d7,_0x51b489){io['to'](_0x3cdeeb)[_0xb39c('0x49')](_0x3000d7,_0x51b489);};VoiceQueueReport['prototype'][_0xb39c('0x4a')]=function(_0xc6e494,_0x3eaf96){logger['debug'](_0xb39c('0x4b')+_0x3eaf96+_0xb39c('0x4c'),_0xc6e494[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0xc6e494,{'showHidden':![],'depth':null}));this[_0xb39c('0x49')](util[_0xb39c('0x4e')](_0xb39c('0x4f'),_0xc6e494[_0xb39c('0x50')]),_0xb39c('0x51'),_0xc6e494);io[_0xb39c('0x49')](_0xb39c('0x52'),_0xc6e494);};VoiceQueueReport[_0xb39c('0xb')]['emitVoiceQueueChannelRemove']=function(_0x38e8ba,_0xbeb7b3){logger[_0xb39c('0x53')](_0xb39c('0x4b')+_0xbeb7b3+_0xb39c('0x54'),_0x38e8ba[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x38e8ba,{'showHidden':![],'depth':null}));this[_0xb39c('0x49')](util[_0xb39c('0x4e')]('voice:queue:%s',_0x38e8ba['name']),_0xb39c('0x55'),_0x38e8ba);io[_0xb39c('0x49')]('voice_queue_presence:remove',_0x38e8ba);};VoiceQueueReport['prototype'][_0xb39c('0x56')]=function(_0x4dc175,_0x34c223){if(_0x4dc175[_0xb39c('0x57')]===_0xb39c('0x58')){var _0x271867={'id':_0x4dc175['id'],'name':_0x4dc175[_0xb39c('0x50')],'strategy':_0x4dc175['strategy'],'answered':_0x4dc175[_0xb39c('0x59')],'available':_0x4dc175[_0xb39c('0x5a')],'loggedIn':_0x4dc175['loggedIn'],'pTalking':_0x4dc175['pTalking'],'sumBillable':_0x4dc175[_0xb39c('0x5b')],'sumDuration':_0x4dc175['sumDuration'],'sumHoldTime':_0x4dc175['sumHoldTime']||0x0,'talking':_0x4dc175[_0xb39c('0x33')],'total':_0x4dc175[_0xb39c('0x5c')],'type':_0x4dc175[_0xb39c('0x57')],'unmanaged':_0x4dc175[_0xb39c('0x5d')],'abandoned':_0x4dc175[_0xb39c('0x5e')],'waiting':_0x4dc175[_0xb39c('0x5f')]};if(_0x4dc175[_0xb39c('0x60')]){_0x271867[_0xb39c('0x60')]={'id':_0x4dc175[_0xb39c('0x60')]['id'],'name':_0x4dc175[_0xb39c('0x60')]['name'],'active':_0x4dc175[_0xb39c('0x60')][_0xb39c('0x61')],'callerid':_0x4dc175[_0xb39c('0x60')][_0xb39c('0x62')]};}if(_0x4dc175[_0xb39c('0x63')]){_0x271867[_0xb39c('0x63')]={'id':_0x4dc175[_0xb39c('0x63')]['id'],'name':_0x4dc175[_0xb39c('0x63')][_0xb39c('0x50')]};}var _0x1ae2cb=md5(JSON[_0xb39c('0x64')](_0x271867));if(_0x4dc175[_0xb39c('0x65')]!==_0x1ae2cb){_0x4dc175[_0xb39c('0x65')]=_0x1ae2cb;logger[_0xb39c('0x53')](_0xb39c('0x66')+_0x34c223+_0xb39c('0x67'),util['inspect'](_0x271867,{'showHidden':![],'depth':null}));this[_0xb39c('0x49')](util[_0xb39c('0x4e')](_0xb39c('0x4f'),_0x271867[_0xb39c('0x50')]),_0xb39c('0x68'),_0x271867);}}};VoiceQueueReport[_0xb39c('0xb')][_0xb39c('0x69')]=function(_0xc20a16){return _0xc20a16!==null&&!_['isUndefined'](_0xc20a16);};VoiceQueueReport['prototype'][_0xb39c('0x2f')]=function(){var _0x210d2a=this;setInterval(function(){_0x210d2a['clearZombieChannels']();ami['Action']({'action':_0xb39c('0x6a')})[_0xb39c('0x6b')](function(_0x538258){logger[_0xb39c('0x3f')]('[voiceQueueReport][queues]',util['inspect'](_0x538258,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xb39c('0xb')]['loopQueueSummary']=function(){var _0x2c5434=this;setInterval(function(){if(_0x2c5434[_0xb39c('0x12')]){return ami[_0xb39c('0x3a')]({'action':_0xb39c('0x15')})[_0xb39c('0x6c')](function(_0x97f170){_0x2c5434['flagQueueSummary']=![];})[_0xb39c('0x6b')](function(_0x127b60){logger[_0xb39c('0x3f')](_0xb39c('0x6d'),util[_0xb39c('0x41')](_0x127b60,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xb39c('0x16')]=function(_0x4ab58e){try{if(this[_0xb39c('0x69')](_0x4ab58e)&&this[_0xb39c('0x69')](_0x4ab58e[_0xb39c('0x6e')])){logger[_0xb39c('0x53')](_0xb39c('0x6f'),util[_0xb39c('0x41')](_0x4ab58e,{'showHidden':![],'depth':null}));if(this[_0xb39c('0x11')][_0x4ab58e[_0xb39c('0x6e')]]){logger[_0xb39c('0x70')](_0xb39c('0x71'),_0x4ab58e[_0xb39c('0x6e')]);var _0x260fbf=_[_0xb39c('0x72')](this[_0xb39c('0xf')],_0xb39c('0x6e'))[_0x4ab58e[_0xb39c('0x6e')]]||0x0;var _0xc7238e=_0x260fbf-_0x4ab58e[_0xb39c('0x73')];if(this[_0xb39c('0x11')][_0x4ab58e['queue']]['waiting']!==_[_0xb39c('0x74')](_0x4ab58e[_0xb39c('0x73')])||this['voiceQueues'][_0x4ab58e[_0xb39c('0x6e')]][_0xb39c('0x75')]!==_['toNumber'](_0x4ab58e[_0xb39c('0x76')])||this[_0xb39c('0x11')][_0x4ab58e[_0xb39c('0x6e')]][_0xb39c('0x5a')]!==_[_0xb39c('0x74')](_0x4ab58e[_0xb39c('0x5a')])||this['voiceQueues'][_0x4ab58e[_0xb39c('0x6e')]][_0xb39c('0x33')]!==_0xc7238e){this[_0xb39c('0x11')][_0x4ab58e[_0xb39c('0x6e')]][_0xb39c('0x5f')]=_[_0xb39c('0x74')](_0x4ab58e[_0xb39c('0x73')]);this['voiceQueues'][_0x4ab58e[_0xb39c('0x6e')]][_0xb39c('0x75')]=_[_0xb39c('0x74')](_0x4ab58e[_0xb39c('0x76')]);this[_0xb39c('0x11')][_0x4ab58e['queue']]['available']=_[_0xb39c('0x74')](_0x4ab58e[_0xb39c('0x5a')]);this[_0xb39c('0x11')][_0x4ab58e['queue']][_0xb39c('0x33')]=_0xc7238e>0x0?_0xc7238e:0x0;this['voiceQueues'][_0x4ab58e[_0xb39c('0x6e')]]['talking']=this[_0xb39c('0x11')][_0x4ab58e[_0xb39c('0x6e')]][_0xb39c('0x33')]>_['toNumber'](_0x4ab58e[_0xb39c('0x76')])?_[_0xb39c('0x74')](_0x4ab58e[_0xb39c('0x76')]):this[_0xb39c('0x11')][_0x4ab58e[_0xb39c('0x6e')]][_0xb39c('0x33')];this[_0xb39c('0x56')](this[_0xb39c('0x11')][_0x4ab58e[_0xb39c('0x6e')]],_0xb39c('0x15'));}logger[_0xb39c('0x53')](_0xb39c('0x77'),util[_0xb39c('0x41')](this[_0xb39c('0x11')][_0x4ab58e[_0xb39c('0x6e')]],{'showHidden':![],'depth':null}));ami[_0xb39c('0x49')](_0xb39c('0x78'),this['voiceQueues'][_0x4ab58e[_0xb39c('0x6e')]]);}}}catch(_0x2b3f85){logger[_0xb39c('0x3f')]('[voiceQueueReport][queuesummary]',util[_0xb39c('0x41')](_0x2b3f85,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x8d8f59){logger[_0xb39c('0x53')](_0xb39c('0x79'),util[_0xb39c('0x41')](_0x8d8f59,{'showHidden':![],'depth':null}));this[_0xb39c('0x12')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x26d08c){try{if(this[_0xb39c('0x69')](_0x26d08c)){logger['debug'](_0xb39c('0x7a'),_0x26d08c[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x26d08c,{'showHidden':![],'depth':null}));if(_[_0xb39c('0x7b')](this[_0xb39c('0x42')][_0x26d08c[_0xb39c('0x4d')]])){this[_0xb39c('0x42')][_0x26d08c[_0xb39c('0x4d')]]=[];this[_0xb39c('0xf')][_0x26d08c[_0xb39c('0x4d')]]={};}var _0xb5e7fb=new QueueReport();_0xb5e7fb[_0xb39c('0x50')]=_0x26d08c[_0xb39c('0x6e')];_0xb5e7fb[_0xb39c('0x57')]=this[_0xb39c('0x11')][_0xb5e7fb['name']]&&this[_0xb39c('0x11')][_0xb5e7fb['name']][_0xb39c('0x57')]?this[_0xb39c('0x11')][_0xb5e7fb['name']][_0xb39c('0x57')]||_0xb39c('0x58'):_0xb39c('0x58');_0xb5e7fb[_0xb39c('0x6e')]=_0x26d08c[_0xb39c('0x6e')];_0xb5e7fb[_0xb39c('0x7c')]=moment()['format'](_0xb39c('0x7d'));_0xb5e7fb[_0xb39c('0x7e')]=_0x26d08c[_0xb39c('0x7e')];_0xb5e7fb[_0xb39c('0x7f')]=_0x26d08c[_0xb39c('0x7f')];_0xb5e7fb[_0xb39c('0x4d')]=_0x26d08c[_0xb39c('0x4d')];logger[_0xb39c('0x70')](_0xb39c('0x80'),_0xb5e7fb['name'],_0xb5e7fb[_0xb39c('0x57')]);_[_0xb39c('0x81')](_0xb5e7fb,_[_0xb39c('0x82')](_0x26d08c,_[_0xb39c('0x83')](_0xb5e7fb)));this[_0xb39c('0x42')][_0x26d08c[_0xb39c('0x4d')]][_0xb39c('0x84')](_0xb5e7fb);this['channels'][_0x26d08c[_0xb39c('0x4d')]]=_0xb5e7fb;this[_0xb39c('0x4a')](_0xb5e7fb,_0xb39c('0x1a'));}}catch(_0x205329){logger[_0xb39c('0x3f')](_0xb39c('0x7a'),_0x26d08c[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x205329,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb39c('0x85')]=function(_0x52cb9d){try{if(this[_0xb39c('0x69')](_0x52cb9d)){logger[_0xb39c('0x53')](_0xb39c('0x86'),_0x52cb9d[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x52cb9d,{'showHidden':![],'depth':null}));if(this[_0xb39c('0x42')][_0x52cb9d[_0xb39c('0x4d')]]){var _0x3784fe=_['last'](this[_0xb39c('0x42')][_0x52cb9d[_0xb39c('0x4d')]]);_0x3784fe[_0xb39c('0x87')]=![];_0x3784fe[_0xb39c('0x88')]=null;_0x3784fe[_0xb39c('0x89')]=_0x52cb9d[_0xb39c('0x89')];_0x3784fe[_0xb39c('0x8a')]=_0x52cb9d[_0xb39c('0x8a')];_0x3784fe[_0xb39c('0x1c')]=!![];_0x3784fe[_0xb39c('0x8b')]=moment()[_0xb39c('0x4e')](_0xb39c('0x7d'));_0x3784fe[_0xb39c('0x8c')]=_0xb39c('0x8d');_0x3784fe[_0xb39c('0x8e')]=null;logger[_0xb39c('0x70')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x3784fe['name'],_0x3784fe[_0xb39c('0x57')]);this[_0xb39c('0xf')][_0x52cb9d[_0xb39c('0x4d')]]=_0x3784fe;this['emitVoiceQueueChannelRemove'](_0x3784fe,_0xb39c('0x1c'));}}}catch(_0x74411){logger[_0xb39c('0x3f')](_0xb39c('0x86'),_0x52cb9d[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x74411,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb39c('0xb')]['syncQueueCallerLeave']=function(_0x41d28f){try{if(this[_0xb39c('0x69')](_0x41d28f)){logger['debug'](_0xb39c('0x8f'),_0x41d28f['uniqueid'],util[_0xb39c('0x41')](_0x41d28f,{'showHidden':![],'depth':null}));if(this[_0xb39c('0x42')][_0x41d28f[_0xb39c('0x4d')]]){var _0x5649af=_[_0xb39c('0x90')](this[_0xb39c('0x42')][_0x41d28f['uniqueid']]);_0x5649af[_0xb39c('0x91')]=moment()[_0xb39c('0x4e')](_0xb39c('0x7d'));_0x5649af[_0xb39c('0x92')]=_0x41d28f[_0xb39c('0x92')];_0x5649af[_0xb39c('0x93')]=_0x41d28f[_0xb39c('0x93')];logger[_0xb39c('0x70')](_0xb39c('0x94'),_0x5649af[_0xb39c('0x50')],_0x5649af[_0xb39c('0x57')],_0x41d28f[_0xb39c('0x92')],_0x41d28f[_0xb39c('0x93')]);this[_0xb39c('0xf')][_0x41d28f[_0xb39c('0x4d')]]=_0x5649af;this[_0xb39c('0x4a')](_0x5649af,_0xb39c('0x1d'));}}}catch(_0x24dcc8){logger[_0xb39c('0x3f')](_0xb39c('0x8f'),_0x41d28f[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x24dcc8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb39c('0xb')]['syncAgentConnect']=function(_0xa87e5c){try{if(this[_0xb39c('0x69')](_0xa87e5c)){logger[_0xb39c('0x53')](_0xb39c('0x95'),_0xa87e5c['uniqueid'],util[_0xb39c('0x41')](_0xa87e5c,{'showHidden':![],'depth':null}));if(this[_0xb39c('0x42')][_0xa87e5c['uniqueid']]){var _0x3ab209=_[_0xb39c('0x90')](this[_0xb39c('0x42')][_0xa87e5c[_0xb39c('0x4d')]]);_0x3ab209[_0xb39c('0x87')]=!![];_0x3ab209['queuecallerexitreason']=_0xb39c('0x96');logger[_0xb39c('0x70')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3ab209[_0xb39c('0x50')],_0x3ab209[_0xb39c('0x57')]);}}}catch(_0x80cead){logger[_0xb39c('0x3f')](_0xb39c('0x95'),_0xa87e5c[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x80cead,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb39c('0xb')][_0xb39c('0x20')]=function(_0x155972){try{if(this['isNotNull'](_0x155972)){logger[_0xb39c('0x53')](_0xb39c('0x97'),_0x155972[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x155972,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x155972[_0xb39c('0x4d')]]){var _0x49c2a2=_[_0xb39c('0x90')](this[_0xb39c('0x42')][_0x155972['uniqueid']]);_0x49c2a2[_0xb39c('0x1c')]=![];_0x49c2a2[_0xb39c('0x8b')]=null;_0x49c2a2[_0xb39c('0x98')]=!![];_0x49c2a2[_0xb39c('0x8e')]=_0x155972[_0xb39c('0x99')];_0x49c2a2[_0xb39c('0x89')]=_0x155972[_0xb39c('0x89')];_0x49c2a2[_0xb39c('0x87')]=!![];_0x49c2a2['queuecallerexit']=![];_0x49c2a2[_0xb39c('0x9a')]=null;if(!_0x49c2a2[_0xb39c('0x9b')]){if(_0x155972[_0xb39c('0x9c')]==_0xb39c('0x9b')){_0x49c2a2[_0xb39c('0x8c')]=_0xb39c('0x9d');logger[_0xb39c('0x70')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x49c2a2['name'],_0x49c2a2[_0xb39c('0x57')]);}else{if(_[_0xb39c('0x9e')](_0x155972[_0xb39c('0x3c')]['toLowerCase'](),_0xb39c('0x9f'))){if(this[_0xb39c('0x42')][_0x155972[_0xb39c('0xa0')]]){var _0x10b7e9=_[_0xb39c('0x90')](this['queueReports'][_0x155972[_0xb39c('0xa0')]]);_0x10b7e9[_0xb39c('0x87')]=![];_0x10b7e9[_0xb39c('0xa1')]=!![];_0x10b7e9[_0xb39c('0x9a')]=moment(_0x49c2a2[_0xb39c('0x7c')])[_0xb39c('0xa2')](_0x155972[_0xb39c('0x89')],_0xb39c('0xa3'))['format'](_0xb39c('0x7d'));_0x10b7e9[_0xb39c('0x8c')]=_0xb39c('0xa4');_0x10b7e9[_0xb39c('0x9b')]=!![];_0x10b7e9[_0xb39c('0xa5')]='FORWARD';_0x10b7e9[_0xb39c('0xa6')]=_0x155972[_0xb39c('0xa7')];_0x10b7e9[_0xb39c('0xa8')]=_0x155972[_0xb39c('0x4d')];logger[_0xb39c('0x70')](_0xb39c('0xa9'),_0x10b7e9[_0xb39c('0x50')],_0x10b7e9['type']);var _0x29419d=this[_0xb39c('0x42')][_0x155972['linkedid']];this['queueReports'][_0x155972[_0xb39c('0xa0')]]=this['queueReports'][_0x155972[_0xb39c('0x4d')]];this['queueReports'][_0x155972[_0xb39c('0x4d')]]=_0x29419d;}}else{_0x49c2a2['queuecallerexitreason']=_0xb39c('0xaa')+_0x155972[_0xb39c('0x9c')][_0xb39c('0xab')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x49c2a2[_0xb39c('0x50')],_0x49c2a2[_0xb39c('0x57')],_0x49c2a2['queuecallerexitreason']);}}}this[_0xb39c('0xf')][_0x155972[_0xb39c('0x4d')]]=_0x49c2a2;this['emitVoiceQueueChannelRemove'](_0x49c2a2,_0xb39c('0x1f'));}}}catch(_0x214adc){logger[_0xb39c('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0x155972[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x214adc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb39c('0xb')][_0xb39c('0x23')]=function(_0x3d84ff){try{if(this[_0xb39c('0x69')](_0x3d84ff)){logger[_0xb39c('0x53')]('[%s][voiceQueueReport][varset]',_0x3d84ff[_0xb39c('0x4d')],util['inspect'](_0x3d84ff,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d84ff[_0xb39c('0x4d')],_[_0xb39c('0x83')](_0x3d84ff[_0xb39c('0xac')])[0x0],_0x3d84ff[_0xb39c('0xad')]);if(this[_0xb39c('0x42')][_0x3d84ff[_0xb39c('0x4d')]]){var _0xac1d01=_[_0xb39c('0x90')](this[_0xb39c('0x42')][_0x3d84ff['uniqueid']]);if(_0xac1d01){if(this[_0xb39c('0x69')](_0x3d84ff['variable'])&&this[_0xb39c('0x69')](_0x3d84ff['variable'][_0xb39c('0xae')])){switch(_0x3d84ff[_0xb39c('0xad')]){case _0xb39c('0xaf'):_0xac1d01['queuecallerexit']=![];_0xac1d01['queuecallerexitAt']=null;break;case _0xb39c('0xb0'):_0xac1d01['lastevent']='timeout';_0xac1d01[_0xb39c('0xa1')]=!![];_0xac1d01[_0xb39c('0x9a')]=moment()[_0xb39c('0x4e')](_0xb39c('0x7d'));_0xac1d01[_0xb39c('0x91')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3d84ff['uniqueid'],util[_0xb39c('0x41')](_0xac1d01,{'showHidden':![],'depth':null}));ami[_0xb39c('0x49')](_0xb39c('0xb1'),_0xac1d01);break;default:_0xac1d01[_0xb39c('0xa1')]=!![];_0xac1d01['queuecallerexitAt']=moment()[_0xb39c('0x4e')](_0xb39c('0x7d'));_0xac1d01[_0xb39c('0x91')]=moment()[_0xb39c('0x4e')](_0xb39c('0x7d'));}_0xac1d01[_0xb39c('0x1c')]=![];_0xac1d01[_0xb39c('0x8b')]=null;_0xac1d01['queuecallerexitreason']=_0x3d84ff[_0xb39c('0xad')];this['channels'][_0x3d84ff[_0xb39c('0x4d')]]=_0xac1d01;this['emitVoiceQueueChannelRemove'](_0xac1d01,_0xb39c('0xb2'));}else if(this[_0xb39c('0x69')](_0x3d84ff[_0xb39c('0xac')])&&this[_0xb39c('0x69')](_0x3d84ff[_0xb39c('0xac')][_0xb39c('0xb3')])){if(!_0xac1d01[_0xb39c('0x1c')]){_0xac1d01[_0xb39c('0xa1')]=!![];_0xac1d01[_0xb39c('0x9a')]=moment()[_0xb39c('0x4e')](_0xb39c('0x7d'));_0xac1d01[_0xb39c('0x8c')]=_0xb39c('0xb4');_0xac1d01[_0xb39c('0x91')]=moment()[_0xb39c('0x4e')](_0xb39c('0x7d'));this['channels'][_0x3d84ff[_0xb39c('0x4d')]]=_0xac1d01;}}logger[_0xb39c('0x70')](_0xb39c('0xb5'),_0x3d84ff[_0xb39c('0x4d')],_0xac1d01['name'],_0xac1d01[_0xb39c('0x57')],_['keys'](_0x3d84ff['variable'])[0x0],_0x3d84ff[_0xb39c('0xad')]);_0xac1d01[_0xb39c('0x14')]=this[_0xb39c('0x14')][_0x3d84ff[_0xb39c('0x4d')]];}}}}catch(_0x4db8a9){logger[_0xb39c('0x3f')](_0xb39c('0xb6'),_0x3d84ff[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x4db8a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb39c('0xb')][_0xb39c('0xb7')]=function(_0x2af4fe,_0x1ea296,_0x55d99a){var _0x390790=[_0xb39c('0xb8'),_0xb39c('0xb9'),_0xb39c('0xba'),_0xb39c('0xbb'),_0xb39c('0xbc'),_0xb39c('0xbd'),_0xb39c('0xbe'),_0xb39c('0xbf'),_0xb39c('0xc0'),_0xb39c('0xc1'),'bridgepeer','bridgepvtcallid',_0xb39c('0xc2'),_0xb39c('0xc3'),'memberinterface',_0xb39c('0xc4'),_0xb39c('0x99'),_0xb39c('0xc5'),'memberrealtime'];if(!_[_0xb39c('0x39')](_0x1ea296)&&!_[_0xb39c('0xc6')](_0x390790,_0x1ea296)){if(_[_0xb39c('0x7b')](this[_0xb39c('0x14')][_0x2af4fe])){this[_0xb39c('0x14')][_0x2af4fe]={};}this[_0xb39c('0x14')][_0x2af4fe][_0x1ea296]=_0x55d99a;}};VoiceQueueReport[_0xb39c('0xb')][_0xb39c('0x25')]=function(_0x433384){try{if(this[_0xb39c('0x69')](_0x433384)){logger[_0xb39c('0x53')](_0xb39c('0xc7'),_0x433384[_0xb39c('0x4d')],util[_0xb39c('0x41')](_0x433384,{'showHidden':![],'depth':null}));if(this[_0xb39c('0x42')][_0x433384['uniqueid']]){for(var _0x341140=0x0,_0x1340bd={};_0x3411400x0?_0x54c675:0x0;this['voiceQueues'][_0x1505f3[_0x8c36('0x69')]][_0x8c36('0x32')]=this['voiceQueues'][_0x1505f3[_0x8c36('0x69')]][_0x8c36('0x32')]>_[_0x8c36('0x6d')](_0x1505f3['loggedin'])?_[_0x8c36('0x6d')](_0x1505f3[_0x8c36('0x6f')]):this[_0x8c36('0x11')][_0x1505f3[_0x8c36('0x69')]]['talking'];this[_0x8c36('0x52')](this[_0x8c36('0x11')][_0x1505f3['queue']],_0x8c36('0x15'));}logger[_0x8c36('0x47')](_0x8c36('0x70'),util['inspect'](this[_0x8c36('0x11')][_0x1505f3[_0x8c36('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8c36('0x71'),this[_0x8c36('0x11')][_0x1505f3[_0x8c36('0x69')]]);}}}catch(_0x1ffa82){logger['error'](_0x8c36('0x68'),util['inspect'](_0x1ffa82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')][_0x8c36('0x19')]=function(_0x5a820a){logger[_0x8c36('0x47')](_0x8c36('0x72'),util[_0x8c36('0x3f')](_0x5a820a,{'showHidden':![],'depth':null}));this[_0x8c36('0x12')]=!![];};VoiceQueueReport[_0x8c36('0x9')][_0x8c36('0x73')]=function(_0x19bd1c){try{if(this[_0x8c36('0x64')](_0x19bd1c)){logger['debug'](_0x8c36('0x74'),_0x19bd1c[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x19bd1c,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x8c36('0xd')][_0x19bd1c[_0x8c36('0x4d')]])){this[_0x8c36('0xd')][_0x19bd1c[_0x8c36('0x4d')]]=[];this[_0x8c36('0xf')][_0x19bd1c['uniqueid']]={};}var _0x291a1f=new QueueReport();_0x291a1f[_0x8c36('0x4a')]=_0x19bd1c[_0x8c36('0x69')];_0x291a1f['type']=this[_0x8c36('0x11')][_0x291a1f[_0x8c36('0x4a')]]&&this[_0x8c36('0x11')][_0x291a1f[_0x8c36('0x4a')]][_0x8c36('0x53')]?this['voiceQueues'][_0x291a1f[_0x8c36('0x4a')]][_0x8c36('0x53')]||_0x8c36('0x54'):'inbound';_0x291a1f[_0x8c36('0x69')]=_0x19bd1c[_0x8c36('0x69')];_0x291a1f[_0x8c36('0x75')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0x291a1f[_0x8c36('0x77')]=_0x19bd1c[_0x8c36('0x77')];_0x291a1f['count']=_0x19bd1c['count'];_0x291a1f['uniqueid']=_0x19bd1c[_0x8c36('0x4d')];logger[_0x8c36('0x78')](_0x8c36('0x79'),_0x291a1f[_0x8c36('0x4a')],_0x291a1f[_0x8c36('0x53')]);_[_0x8c36('0x7a')](_0x291a1f,_[_0x8c36('0x7b')](_0x19bd1c,_[_0x8c36('0x7c')](_0x291a1f)));this[_0x8c36('0xd')][_0x19bd1c[_0x8c36('0x4d')]][_0x8c36('0x7d')](_0x291a1f);this[_0x8c36('0xf')][_0x19bd1c[_0x8c36('0x4d')]]=_0x291a1f;this[_0x8c36('0x46')](_0x291a1f,_0x8c36('0x1a'));}}catch(_0xbb35c){logger[_0x8c36('0x3d')](_0x8c36('0x74'),_0x19bd1c['uniqueid'],util[_0x8c36('0x3f')](_0xbb35c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x319bfe){try{if(this['isNotNull'](_0x319bfe)){logger[_0x8c36('0x47')](_0x8c36('0x7e'),_0x319bfe[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x319bfe,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x319bfe[_0x8c36('0x4d')]]){var _0xf6760b=_['last'](this['queueReports'][_0x319bfe[_0x8c36('0x4d')]]);_0xf6760b[_0x8c36('0x7f')]=![];_0xf6760b['queuecallercompleteAt']=null;_0xf6760b[_0x8c36('0x80')]=_0x319bfe[_0x8c36('0x80')];_0xf6760b[_0x8c36('0x81')]=_0x319bfe[_0x8c36('0x81')];_0xf6760b['queuecallerabandon']=!![];_0xf6760b[_0x8c36('0x82')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0xf6760b[_0x8c36('0x83')]=_0x8c36('0x84');_0xf6760b[_0x8c36('0x85')]=null;logger['info'](_0x8c36('0x86'),_0xf6760b[_0x8c36('0x4a')],_0xf6760b[_0x8c36('0x53')]);this[_0x8c36('0xf')][_0x319bfe[_0x8c36('0x4d')]]=_0xf6760b;this[_0x8c36('0x43')](_0xf6760b,_0x8c36('0x1b'));}}}catch(_0x1dd208){logger[_0x8c36('0x3d')](_0x8c36('0x7e'),_0x319bfe['uniqueid'],util['inspect'](_0x1dd208,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')]['syncQueueCallerLeave']=function(_0x4dbf66){try{if(this[_0x8c36('0x64')](_0x4dbf66)){logger[_0x8c36('0x47')]('[%s][voiceQueueReport][queuecallerleave]',_0x4dbf66[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x4dbf66,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x4dbf66[_0x8c36('0x4d')]]){var _0x1e6059=_[_0x8c36('0x87')](this['queueReports'][_0x4dbf66['uniqueid']]);_0x1e6059[_0x8c36('0x88')]=moment()[_0x8c36('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e6059[_0x8c36('0x89')]=_0x4dbf66[_0x8c36('0x89')];_0x1e6059[_0x8c36('0x8a')]=_0x4dbf66[_0x8c36('0x8a')];logger[_0x8c36('0x78')](_0x8c36('0x8b'),_0x1e6059['name'],_0x1e6059[_0x8c36('0x53')],_0x4dbf66[_0x8c36('0x89')],_0x4dbf66[_0x8c36('0x8a')]);this[_0x8c36('0xf')][_0x4dbf66[_0x8c36('0x4d')]]=_0x1e6059;this[_0x8c36('0x46')](_0x1e6059,'queuecallerleave');}}}catch(_0x4822cb){logger[_0x8c36('0x3d')](_0x8c36('0x8c'),_0x4dbf66[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x4822cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')]['syncAgentConnect']=function(_0x53278d){try{if(this[_0x8c36('0x64')](_0x53278d)){logger[_0x8c36('0x47')](_0x8c36('0x8d'),_0x53278d['uniqueid'],util[_0x8c36('0x3f')](_0x53278d,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x53278d[_0x8c36('0x4d')]]){var _0x1a7211=_[_0x8c36('0x87')](this[_0x8c36('0xd')][_0x53278d[_0x8c36('0x4d')]]);_0x1a7211[_0x8c36('0x7f')]=!![];_0x1a7211[_0x8c36('0x83')]=_0x8c36('0x8e');logger[_0x8c36('0x78')](_0x8c36('0x8f'),_0x1a7211['name'],_0x1a7211[_0x8c36('0x53')]);}}}catch(_0x50539b){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x53278d[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x50539b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')]['syncAgentComplete']=function(_0x7d675c){try{if(this[_0x8c36('0x64')](_0x7d675c)){logger[_0x8c36('0x47')](_0x8c36('0x90'),_0x7d675c['uniqueid'],util[_0x8c36('0x3f')](_0x7d675c,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x7d675c['uniqueid']]){var _0x3e1fa3=_[_0x8c36('0x87')](this['queueReports'][_0x7d675c[_0x8c36('0x4d')]]);_0x3e1fa3[_0x8c36('0x1b')]=![];_0x3e1fa3[_0x8c36('0x82')]=null;_0x3e1fa3[_0x8c36('0x91')]=!![];_0x3e1fa3[_0x8c36('0x85')]=_0x7d675c[_0x8c36('0x92')];_0x3e1fa3[_0x8c36('0x80')]=_0x7d675c['holdtime'];_0x3e1fa3['queuecallercomplete']=!![];_0x3e1fa3['queuecallerexit']=![];_0x3e1fa3[_0x8c36('0x93')]=null;if(!_0x3e1fa3[_0x8c36('0x94')]){if(_0x7d675c[_0x8c36('0x95')]==_0x8c36('0x94')){_0x3e1fa3[_0x8c36('0x83')]=_0x8c36('0x96');logger['info'](_0x8c36('0x97'),_0x3e1fa3[_0x8c36('0x4a')],_0x3e1fa3[_0x8c36('0x53')]);}else{if(_[_0x8c36('0x98')](_0x7d675c['channel']['toLowerCase'](),_0x8c36('0x99'))){if(this[_0x8c36('0xd')][_0x7d675c[_0x8c36('0x9a')]]){var _0x4926ef=_[_0x8c36('0x87')](this[_0x8c36('0xd')][_0x7d675c[_0x8c36('0x9a')]]);_0x4926ef['queuecallercomplete']=![];_0x4926ef[_0x8c36('0x9b')]=!![];_0x4926ef['queuecallerexitAt']=moment(_0x3e1fa3[_0x8c36('0x75')])[_0x8c36('0x9c')](_0x7d675c['holdtime'],_0x8c36('0x9d'))[_0x8c36('0x4e')](_0x8c36('0x76'));_0x4926ef[_0x8c36('0x83')]=_0x8c36('0x9e');_0x4926ef[_0x8c36('0x94')]=!![];_0x4926ef[_0x8c36('0x9f')]=_0x8c36('0xa0');_0x4926ef['transferexten']=_0x7d675c['destexten'];_0x4926ef[_0x8c36('0xa1')]=_0x7d675c[_0x8c36('0x4d')];logger[_0x8c36('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4926ef[_0x8c36('0x4a')],_0x4926ef[_0x8c36('0x53')]);var _0x50c9d7=this['queueReports'][_0x7d675c[_0x8c36('0x9a')]];this[_0x8c36('0xd')][_0x7d675c['linkedid']]=this[_0x8c36('0xd')][_0x7d675c[_0x8c36('0x4d')]];this[_0x8c36('0xd')][_0x7d675c[_0x8c36('0x4d')]]=_0x50c9d7;}}else{_0x3e1fa3['queuecallerexitreason']=_0x8c36('0xa2')+_0x7d675c[_0x8c36('0x95')][_0x8c36('0xa3')]();logger[_0x8c36('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x3e1fa3[_0x8c36('0x4a')],_0x3e1fa3[_0x8c36('0x53')],_0x3e1fa3[_0x8c36('0x83')]);}}}this[_0x8c36('0xf')][_0x7d675c[_0x8c36('0x4d')]]=_0x3e1fa3;this['emitVoiceQueueChannelRemove'](_0x3e1fa3,_0x8c36('0x1f'));}}}catch(_0x44a5d4){logger[_0x8c36('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x7d675c[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x44a5d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')]['syncVarSet']=function(_0x4be6a3){try{if(this['isNotNull'](_0x4be6a3)){logger['debug'](_0x8c36('0xa4'),_0x4be6a3['uniqueid'],util['inspect'](_0x4be6a3,{'showHidden':![],'depth':null}));this[_0x8c36('0xa5')](_0x4be6a3['uniqueid'],_[_0x8c36('0x7c')](_0x4be6a3[_0x8c36('0xa6')])[0x0],_0x4be6a3[_0x8c36('0xa7')]);if(this[_0x8c36('0xd')][_0x4be6a3['uniqueid']]){var _0x36b1c9=_[_0x8c36('0x87')](this[_0x8c36('0xd')][_0x4be6a3['uniqueid']]);if(_0x36b1c9){if(this[_0x8c36('0x64')](_0x4be6a3[_0x8c36('0xa6')])&&this[_0x8c36('0x64')](_0x4be6a3[_0x8c36('0xa6')][_0x8c36('0xa8')])){switch(_0x4be6a3[_0x8c36('0xa7')]){case _0x8c36('0xa9'):_0x36b1c9['queuecallerexit']=![];_0x36b1c9[_0x8c36('0x93')]=null;break;case _0x8c36('0xaa'):_0x36b1c9[_0x8c36('0xab')]=_0x8c36('0xac');_0x36b1c9[_0x8c36('0x9b')]=!![];_0x36b1c9[_0x8c36('0x93')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0x36b1c9[_0x8c36('0x88')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));logger[_0x8c36('0x47')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x4be6a3['uniqueid'],util[_0x8c36('0x3f')](_0x36b1c9,{'showHidden':![],'depth':null}));ami[_0x8c36('0x45')](_0x8c36('0xad'),_0x36b1c9);break;default:_0x36b1c9[_0x8c36('0x9b')]=!![];_0x36b1c9[_0x8c36('0x93')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0x36b1c9['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x36b1c9[_0x8c36('0x1b')]=![];_0x36b1c9[_0x8c36('0x82')]=null;_0x36b1c9[_0x8c36('0x83')]=_0x4be6a3[_0x8c36('0xa7')];this['channels'][_0x4be6a3[_0x8c36('0x4d')]]=_0x36b1c9;this[_0x8c36('0x43')](_0x36b1c9,_0x8c36('0x23'));}else if(this[_0x8c36('0x64')](_0x4be6a3[_0x8c36('0xa6')])&&this[_0x8c36('0x64')](_0x4be6a3[_0x8c36('0xa6')]['queueposition'])){if(!_0x36b1c9[_0x8c36('0x1b')]){_0x36b1c9[_0x8c36('0x9b')]=!![];_0x36b1c9[_0x8c36('0x93')]=moment()[_0x8c36('0x4e')](_0x8c36('0x76'));_0x36b1c9[_0x8c36('0x83')]=_0x8c36('0xae');_0x36b1c9[_0x8c36('0x88')]=moment()['format'](_0x8c36('0x76'));this[_0x8c36('0xf')][_0x4be6a3[_0x8c36('0x4d')]]=_0x36b1c9;}}logger[_0x8c36('0x78')](_0x8c36('0xaf'),_0x4be6a3['uniqueid'],_0x36b1c9[_0x8c36('0x4a')],_0x36b1c9[_0x8c36('0x53')],_[_0x8c36('0x7c')](_0x4be6a3[_0x8c36('0xa6')])[0x0],_0x4be6a3[_0x8c36('0xa7')]);_0x36b1c9[_0x8c36('0x14')]=this[_0x8c36('0x14')][_0x4be6a3[_0x8c36('0x4d')]];}}}}catch(_0x56c11f){logger[_0x8c36('0x3d')]('[%s][voiceQueueReport][varset]',_0x4be6a3['uniqueid'],util['inspect'](_0x56c11f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c36('0x9')][_0x8c36('0xa5')]=function(_0x36e76b,_0x58b524,_0x101b04){var _0x1d8d2c=[_0x8c36('0xb0'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x8c36('0xb1'),'rtpaudioqosloss',_0x8c36('0xb2'),_0x8c36('0xb3'),_0x8c36('0xb4'),'sipcallid',_0x8c36('0xb5'),_0x8c36('0xb6'),_0x8c36('0xb7'),'membercalls',_0x8c36('0xb8'),_0x8c36('0xb9'),_0x8c36('0xba'),_0x8c36('0x92'),_0x8c36('0xbb'),_0x8c36('0xbc')];if(!_['isNil'](_0x58b524)&&!_[_0x8c36('0xbd')](_0x1d8d2c,_0x58b524)){if(_[_0x8c36('0x65')](this[_0x8c36('0x14')][_0x36e76b])){this[_0x8c36('0x14')][_0x36e76b]={};}this[_0x8c36('0x14')][_0x36e76b][_0x58b524]=_0x101b04;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x4f8653){try{if(this['isNotNull'](_0x4f8653)){logger[_0x8c36('0x47')]('[%s][voiceQueueReport][hangup]',_0x4f8653[_0x8c36('0x4d')],util[_0x8c36('0x3f')](_0x4f8653,{'showHidden':![],'depth':null}));if(this[_0x8c36('0xd')][_0x4f8653['uniqueid']]){for(var _0x10ed2c=0x0,_0x4d7474={};_0x10ed2c=0x0?moment(_0x568b2d[_0x272f('0x17')])[_0x272f('0xc')](_0x568b2d[_0x272f('0x16')],_0x272f('0x18')):null,'data1':_0x272f('0x19'),'data2':_0x568b2d[_0x272f('0x12')],'data3':_0x568b2d['exten'],'data4':_0x568b2d['dialstring']||null,'role':'agent','internal':_0x568b2d[_0x272f('0x12')]?_[_0x272f('0x13')](_0x568b2d[_0x272f('0x12')]):undefined,'uniqueid':_0x568b2d[_0x272f('0x14')]},'log':_0x272f('0x15')});}; \ No newline at end of file +var _0x823e=['util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','moment'];(function(_0x2f1fde,_0x53cfde){var _0x55ace1=function(_0x1875bf){while(--_0x1875bf){_0x2f1fde['push'](_0x2f1fde['shift']());}};_0x55ace1(++_0x53cfde);}(_0x823e,0x1db));var _0xe823=function(_0x26cfb7,_0x169710){_0x26cfb7=_0x26cfb7-0x0;var _0x10c163=_0x823e[_0x26cfb7];return _0x10c163;};'use strict';var moment=require(_0xe823('0x0'));var _=require('lodash');var util=require(_0xe823('0x1'));var client=require('../client');exports[_0xe823('0x2')]=function(_0x521172){var _0x476594=_0x521172[_0xe823('0x3')]||_0x521172[_0xe823('0x4')];return client[_0xe823('0x5')](_0xe823('0x6'),{'body':{'channel':_0xe823('0x7'),'membername':_0x521172[_0xe823('0x8')],'interface':_[_0xe823('0x9')](_0x521172[_0xe823('0xa')])?util['format'](_0xe823('0xb'),_0x521172[_0xe823('0x8')]):_0x521172[_0xe823('0xa')],'type':_0xe823('0xc'),'enterAt':_0x521172['queuecallerleaveAt'],'exitAt':_0x476594,'duration':moment(_0x476594)[_0xe823('0xd')](_0x521172[_0xe823('0xe')],_0xe823('0xf')),'data1':_0xe823('0x10'),'data2':_0x521172[_0xe823('0x11')],'data3':_0x521172[_0xe823('0x12')],'data4':null,'data5':_0x521172['queue'],'role':'agent','internal':_0x521172[_0xe823('0x13')]?_[_0xe823('0x14')](_0x521172[_0xe823('0x13')]):undefined,'uniqueid':_0x521172[_0xe823('0x15')]},'log':'CreateMemberReport'});};exports[_0xe823('0x16')]=function(_0x1137cc){return client[_0xe823('0x5')]('CreateMemberReport',{'body':{'channel':_0xe823('0x7'),'membername':_0x1137cc[_0xe823('0x17')],'interface':_0x1137cc[_0xe823('0xa')],'type':_0xe823('0xc'),'enterAt':_0x1137cc[_0xe823('0x18')],'exitAt':_0x1137cc[_0xe823('0x19')],'duration':moment(_0x1137cc[_0xe823('0x19')])[_0xe823('0xd')](_0x1137cc['starttime'],_0xe823('0xf'))>=0x0?moment(_0x1137cc[_0xe823('0x19')])['diff'](_0x1137cc['starttime'],_0xe823('0xf')):null,'data1':_0xe823('0x1a'),'data2':_0x1137cc[_0xe823('0x13')],'data3':_0x1137cc[_0xe823('0x12')],'data4':_0x1137cc[_0xe823('0x1b')]||null,'role':'agent','internal':_0x1137cc['accountcode']?_[_0xe823('0x14')](_0x1137cc[_0xe823('0x13')]):undefined,'uniqueid':_0x1137cc[_0xe823('0x15')]},'log':_0xe823('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 00940c1..f66f783 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9aea=['GetSettings','../client','Request','stopRecordingOnTransfer'];(function(_0x575118,_0x332ec8){var _0x40acf0=function(_0x336f43){while(--_0x336f43){_0x575118['push'](_0x575118['shift']());}};_0x40acf0(++_0x332ec8);}(_0x9aea,0xdd));var _0xa9ae=function(_0x5178ae,_0x189543){_0x5178ae=_0x5178ae-0x0;var _0x53ebda=_0x9aea[_0x5178ae];return _0x53ebda;};'use strict';var client=require(_0xa9ae('0x0'));exports['getSettings']=function(){return client[_0xa9ae('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa9ae('0x2')]},'log':_0xa9ae('0x3')});}; \ No newline at end of file +var _0xd8b0=['getSettings','GetSettings','../client'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x0d8b('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9e65a29..c6d6d9e 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 _0x4483=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x424d82,_0x594352){var _0x3451d7=function(_0x560563){while(--_0x560563){_0x424d82['push'](_0x424d82['shift']());}};_0x3451d7(++_0x594352);}(_0x4483,0x1a3));var _0x3448=function(_0x2bd202,_0x37e879){_0x2bd202=_0x2bd202-0x0;var _0x441e88=_0x4483[_0x2bd202];return _0x441e88;};'use strict';var client=require(_0x3448('0x0'));exports[_0x3448('0x1')]=function(_0x229c0c){return function(_0x481d0c){return client[_0x3448('0x2')](_0x3448('0x3'),{'options':{'raw':!![],'attributes':['id',_0x3448('0x4'),_0x3448('0x5')]},'log':_0x3448('0x3')});};}; \ No newline at end of file +var _0x422f=['getTemplates','Request','name','html','GetTemplate'];(function(_0x3b8be9,_0x5dfbfa){var _0x1511ac=function(_0x56eec5){while(--_0x56eec5){_0x3b8be9['push'](_0x3b8be9['shift']());}};_0x1511ac(++_0x5dfbfa);}(_0x422f,0x1c7));var _0xf422=function(_0x22e66a,_0x4d7c0c){_0x22e66a=_0x22e66a-0x0;var _0x2d91c5=_0x422f[_0x22e66a];return _0x2d91c5;};'use strict';var client=require('../client');exports[_0xf422('0x0')]=function(_0x4c7d20){return function(_0x4566ff){return client[_0xf422('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xf422('0x2'),_0xf422('0x3')]},'log':_0xf422('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 034d194..d9b0a13 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 _0x727e=['../client','getTriggers','name','channel','status','field','operator','value','Condition','AnyConditions','Action','Actions','action','data1','data2','data4','data6'];(function(_0x279edd,_0x4f19dc){var _0x3a4ad7=function(_0x465df4){while(--_0x465df4){_0x279edd['push'](_0x279edd['shift']());}};_0x3a4ad7(++_0x4f19dc);}(_0x727e,0x88));var _0xe727=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x727e[_0x27af45];return _0x18df21;};'use strict';var client=require(_0xe727('0x0'));exports[_0xe727('0x1')]=function(_0x4fb9c5){return function(_0x582852){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xe727('0x2'),_0xe727('0x3'),_0xe727('0x4')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xe727('0x5'),_0xe727('0x6'),_0xe727('0x7')]},{'model':_0xe727('0x8'),'as':_0xe727('0x9'),'attributes':['id',_0xe727('0x5'),'operator','value']},{'model':_0xe727('0xa'),'as':_0xe727('0xb'),'attributes':['id',_0xe727('0xc'),_0xe727('0xd'),_0xe727('0xe'),'data3',_0xe727('0xf'),'data5',_0xe727('0x10'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xf897=['field','operator','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data6','data7','GetTrigger','../client','getTriggers','name','channel','Condition','AllConditions'];(function(_0x5ce7b2,_0xcd9cf5){var _0x47454b=function(_0x2d7496){while(--_0x2d7496){_0x5ce7b2['push'](_0x5ce7b2['shift']());}};_0x47454b(++_0xcd9cf5);}(_0xf897,0x176));var _0x7f89=function(_0x51c115,_0x5cd049){_0x51c115=_0x51c115-0x0;var _0x5cb4f5=_0xf897[_0x51c115];return _0x5cb4f5;};'use strict';var client=require(_0x7f89('0x0'));exports[_0x7f89('0x1')]=function(_0x339329){return function(_0x200318){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x7f89('0x2'),_0x7f89('0x3'),'status'],'include':[{'model':_0x7f89('0x4'),'as':_0x7f89('0x5'),'attributes':['id',_0x7f89('0x6'),_0x7f89('0x7'),'value']},{'model':_0x7f89('0x4'),'as':_0x7f89('0x8'),'attributes':['id',_0x7f89('0x6'),'operator','value']},{'model':_0x7f89('0x9'),'as':_0x7f89('0xa'),'attributes':['id',_0x7f89('0xb'),_0x7f89('0xc'),_0x7f89('0xd'),_0x7f89('0xe'),_0x7f89('0xf'),'data5',_0x7f89('0x10'),_0x7f89('0x11')]}]},'log':_0x7f89('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e536341..44763f6 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 _0x58bb=['GetTrunk','defaultuser','Request'];(function(_0x16e0a6,_0x18e7f6){var _0x5e15cf=function(_0x266c66){while(--_0x266c66){_0x16e0a6['push'](_0x16e0a6['shift']());}};_0x5e15cf(++_0x18e7f6);}(_0x58bb,0x6e));var _0xb58b=function(_0x3cde30,_0x5cff11){_0x3cde30=_0x3cde30-0x0;var _0x3d975c=_0x58bb[_0x3cde30];return _0x3d975c;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x49ed3f){return function(_0x593af6){return client[_0xb58b('0x0')](_0xb58b('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xb58b('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xd99e=['Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x343118,_0x27cbdf){var _0x871336=function(_0x52858b){while(--_0x52858b){_0x343118['push'](_0x343118['shift']());}};_0x871336(++_0x27cbdf);}(_0xd99e,0x161));var _0xed99=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0xd99e[_0x1385dc];return _0x2f6469;};'use strict';var client=require(_0xed99('0x0'));exports['getTrunks']=function(_0x471adf){return function(_0x306387){return client[_0xed99('0x1')](_0xed99('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xed99('0x3'),_0xed99('0x4'),_0xed99('0x5')]},'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 ba572ff..5091dc0 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 _0xcd56=['Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','internal','PauseUser','savePause','UnpauseUser','getAgent','ShowUser','../client','getAgents'];(function(_0x245d40,_0x455ece){var _0x245534=function(_0x257f5d){while(--_0x257f5d){_0x245d40['push'](_0x245d40['shift']());}};_0x245534(++_0x455ece);}(_0xcd56,0x129));var _0x6cd5=function(_0x1adff1,_0x1bd45c){_0x1adff1=_0x1adff1-0x0;var _0x19ad22=_0xcd56[_0x1adff1];return _0x19ad22;};'use strict';var client=require(_0x6cd5('0x0'));exports[_0x6cd5('0x1')]=function(){return function(){return client[_0x6cd5('0x2')](_0x6cd5('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x6cd5('0x4'),_0x6cd5('0x5'),_0x6cd5('0x6'),_0x6cd5('0x7'),_0x6cd5('0x8'),_0x6cd5('0x9'),_0x6cd5('0xa'),_0x6cd5('0xb'),_0x6cd5('0xc'),_0x6cd5('0xd'),_0x6cd5('0xe'),_0x6cd5('0xf')]},'log':_0x6cd5('0x1')});};};exports[_0x6cd5('0x10')]=function(){return function(){return client[_0x6cd5('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x6cd5('0x4'),'accountcode',_0x6cd5('0x11')]},'log':_0x6cd5('0x10')});};};exports['savePause']=function(_0x2cd46a,_0x5b8993,_0x30d696){return client['Request'](_0x6cd5('0x12'),{'body':{'type':_0x5b8993,'uniqueid':_0x30d696},'options':{'where':{'id':_0x2cd46a['id']}},'log':_0x6cd5('0x13')});};exports['saveUnpause']=function(_0x2c4f6a){return client['Request'](_0x6cd5('0x14'),{'body':{},'options':{'where':{'id':_0x2c4f6a['id']}},'log':_0x6cd5('0x13')});};exports[_0x6cd5('0x15')]=function(_0x3da538){return client['Request'](_0x6cd5('0x16'),{'options':{'raw':![],'where':{'role':'agent','id':_0x3da538},'attributes':['id',_0x6cd5('0x4'),_0x6cd5('0x5'),'accountcode','fullname','online',_0x6cd5('0x9'),_0x6cd5('0xa'),_0x6cd5('0xb'),_0x6cd5('0xc'),_0x6cd5('0xf')]},'log':_0x6cd5('0x15')});}; \ No newline at end of file +var _0x4170=['mobile','getAgents','getTelephones','telephone','accountcode','internal','savePause','PauseUser','UnpauseUser','getAgent','ShowUser','fullname','online','interface','../client','Request','GetUser','agent','name','email','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x145fa4,_0xa7f0b8){var _0x1c4eb3=function(_0xc7c030){while(--_0xc7c030){_0x145fa4['push'](_0x145fa4['shift']());}};_0x1c4eb3(++_0xa7f0b8);}(_0x4170,0x1be));var _0x0417=function(_0x5776b1,_0x67df5c){_0x5776b1=_0x5776b1-0x0;var _0x44d1a9=_0x4170[_0x5776b1];return _0x44d1a9;};'use strict';var client=require(_0x0417('0x0'));exports['getAgents']=function(){return function(){return client[_0x0417('0x1')](_0x0417('0x2'),{'options':{'raw':![],'where':{'role':_0x0417('0x3')},'attributes':['id',_0x0417('0x4'),_0x0417('0x5'),'accountcode','fullname','online',_0x0417('0x6'),_0x0417('0x7'),_0x0417('0x8'),_0x0417('0x9'),'phone',_0x0417('0xa'),'interface']},'log':_0x0417('0xb')});};};exports[_0x0417('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0417('0xd')},'attributes':['id','name',_0x0417('0xe'),_0x0417('0xf')]},'log':_0x0417('0xc')});};};exports[_0x0417('0x10')]=function(_0x58e0a4,_0x39b2b3,_0x2a93d4){return client['Request'](_0x0417('0x11'),{'body':{'type':_0x39b2b3,'uniqueid':_0x2a93d4},'options':{'where':{'id':_0x58e0a4['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0x20447d){return client[_0x0417('0x1')](_0x0417('0x12'),{'body':{},'options':{'where':{'id':_0x20447d['id']}},'log':_0x0417('0x10')});};exports[_0x0417('0x13')]=function(_0x416f37){return client['Request'](_0x0417('0x14'),{'options':{'raw':![],'where':{'role':_0x0417('0x3'),'id':_0x416f37},'attributes':['id','name',_0x0417('0x5'),_0x0417('0xe'),_0x0417('0x15'),_0x0417('0x16'),_0x0417('0x6'),_0x0417('0x7'),_0x0417('0x8'),'voicePause',_0x0417('0x17')]},'log':_0x0417('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 3dabff6..6fc48f5 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 _0x8c34=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0x8c34,0x181));var _0x48c3=function(_0x26fed0,_0x3f4ecc){_0x26fed0=_0x26fed0-0x0;var _0x32e5d4=_0x8c34[_0x26fed0];return _0x32e5d4;};'use strict';var client=require('../client');exports[_0x48c3('0x0')]=function(_0x1b69f0){return client[_0x48c3('0x1')](_0x48c3('0x2'),{'body':_0x1b69f0,'log':_0x48c3('0x2')});};exports[_0x48c3('0x3')]=function(_0x3df265,_0x84fa9e,_0x26d19b){return client[_0x48c3('0x1')](_0x48c3('0x4'),{'body':_0x3df265,'options':{'where':{'uniqueid':_0x84fa9e,'interface':_0x26d19b,'agentcomplete':!![]}},'log':_0x48c3('0x4')});}; \ No newline at end of file +var _0xfc17=['../client','Request','update','UpdateVoiceAgentReport'];(function(_0x10f9eb,_0x5f563e){var _0x59fe72=function(_0xfc8e4b){while(--_0xfc8e4b){_0x10f9eb['push'](_0x10f9eb['shift']());}};_0x59fe72(++_0x5f563e);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x356efd,_0x1fb9bb){_0x356efd=_0x356efd-0x0;var _0x236e89=_0xfc17[_0x356efd];return _0x236e89;};'use strict';var client=require(_0x7fc1('0x0'));exports['create']=function(_0x592121){return client[_0x7fc1('0x1')]('CreateVoiceAgentReport',{'body':_0x592121,'log':'CreateVoiceAgentReport'});};exports[_0x7fc1('0x2')]=function(_0x15b79d,_0x27771b,_0x1e15cc){return client[_0x7fc1('0x1')](_0x7fc1('0x3'),{'body':_0x15b79d,'options':{'where':{'uniqueid':_0x27771b,'interface':_0x1e15cc,'agentcomplete':!![]}},'log':_0x7fc1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a6d4c4d..e8ae812 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 _0xf475=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0xf475,0xe2));var _0x5f47=function(_0x4630c9,_0x4d04b3){_0x4630c9=_0x4630c9-0x0;var _0x8e5298=_0xf475[_0x4630c9];return _0x8e5298;};'use strict';var moment=require(_0x5f47('0x0'));var util=require(_0x5f47('0x1'));var _=require(_0x5f47('0x2'));var client=require(_0x5f47('0x3'));exports[_0x5f47('0x4')]=function(_0x4b7a55){return client[_0x5f47('0x5')](_0x5f47('0x6'),{'body':_[_0x5f47('0x7')](_0x4b7a55,{'source':_0x4b7a55[_0x5f47('0x8')],'destinationcontext':_0x4b7a55['context'],'callerid':_0x4b7a55[_0x5f47('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x5f47('0x6')});};exports[_0x5f47('0xa')]=function(){return function(){return client[_0x5f47('0x5')](_0x5f47('0xb'),{'options':{'where':{'type':[_0x5f47('0xc')],'createdAt':{'$between':[moment()[_0x5f47('0xd')](_0x5f47('0xe'))[_0x5f47('0xf')](_0x5f47('0x10')),moment()[_0x5f47('0x11')]('day')[_0x5f47('0xf')](_0x5f47('0x10'))]}},'attributes':[_0x5f47('0x12'),'disposition','duration','billableseconds']},'log':_0x5f47('0x13')});};}; \ No newline at end of file +var _0x818a=['type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1ee7cf,_0x1ff01b){var _0x4316ce=function(_0x3be38b){while(--_0x3be38b){_0x1ee7cf['push'](_0x1ee7cf['shift']());}};_0x4316ce(++_0x1ff01b);}(_0x818a,0x116));var _0xa818=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x818a[_0x1c8c28];return _0x1f59b4;};'use strict';var moment=require(_0xa818('0x0'));var util=require(_0xa818('0x1'));var _=require(_0xa818('0x2'));var client=require('../client');exports[_0xa818('0x3')]=function(_0x146e8a){return client[_0xa818('0x4')](_0xa818('0x5'),{'body':_[_0xa818('0x6')](_0x146e8a,{'source':_0x146e8a[_0xa818('0x7')],'destinationcontext':_0x146e8a['context'],'callerid':_0x146e8a[_0xa818('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xa818('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xa818('0x4')](_0xa818('0x9'),{'options':{'where':{'type':[_0xa818('0xa')],'createdAt':{'$between':[moment()[_0xa818('0xb')](_0xa818('0xc'))[_0xa818('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xa818('0xe')](_0xa818('0xc'))['format'](_0xa818('0xf'))]}},'attributes':[_0xa818('0x10'),_0xa818('0x11'),_0xa818('0x12'),_0xa818('0x13')]},'log':_0xa818('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3d6b13d..813a294 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 _0x6ae2=['CreateVoiceDialReport','create','Request'];(function(_0xdeaf40,_0x33c0b4){var _0x38cb58=function(_0x54cc35){while(--_0x54cc35){_0xdeaf40['push'](_0xdeaf40['shift']());}};_0x38cb58(++_0x33c0b4);}(_0x6ae2,0xdc));var _0x26ae=function(_0x357f41,_0x55f968){_0x357f41=_0x357f41-0x0;var _0x3a0037=_0x6ae2[_0x357f41];return _0x3a0037;};'use strict';var client=require('../client');exports[_0x26ae('0x0')]=function(_0x47da83){return client[_0x26ae('0x1')](_0x26ae('0x2'),{'body':_0x47da83,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x9e0c=['create','CreateVoiceDialReport','../client'];(function(_0x2aea64,_0x32a66f){var _0x375247=function(_0x178a6a){while(--_0x178a6a){_0x2aea64['push'](_0x2aea64['shift']());}};_0x375247(++_0x32a66f);}(_0x9e0c,0x1d3));var _0xc9e0=function(_0x1b327d,_0x5a4964){_0x1b327d=_0x1b327d-0x0;var _0x15bdec=_0x9e0c[_0x1b327d];return _0x15bdec;};'use strict';var client=require(_0xc9e0('0x0'));exports[_0xc9e0('0x1')]=function(_0x512692){return client['Request'](_0xc9e0('0x2'),{'body':_0x512692,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c3140a7..4ccf36b 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 _0xade9=['exten','recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x148c93,_0x23db9a){var _0x12be39=function(_0x26f229){while(--_0x26f229){_0x148c93['push'](_0x148c93['shift']());}};_0x12be39(++_0x23db9a);}(_0xade9,0x1e7));var _0x9ade=function(_0x208bc9,_0x4f36f6){_0x208bc9=_0x208bc9-0x0;var _0x2675a8=_0xade9[_0x208bc9];return _0x2675a8;};'use strict';var client=require('../client');exports[_0x9ade('0x0')]=function(){return function(){return client[_0x9ade('0x1')](_0x9ade('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9ade('0x3'),_0x9ade('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x9ade('0x0')});};}; \ No newline at end of file +var _0xa30e=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa30e,0x117));var _0xea30=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xa30e[_0x173452];return _0xee3fd0;};'use strict';var client=require(_0xea30('0x0'));exports[_0xea30('0x1')]=function(){return function(){return client[_0xea30('0x2')](_0xea30('0x3'),{'options':{'raw':!![],'attributes':['id',_0xea30('0x4'),_0xea30('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7e48be3..d29c72e 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 _0x8459=['dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','callAdditionalPhoneAfterMin','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialAgiAfterHangupClient'];(function(_0x76cb88,_0x45af3f){var _0x367a92=function(_0x21c226){while(--_0x21c226){_0x76cb88['push'](_0x76cb88['shift']());}};_0x367a92(++_0x45af3f);}(_0x8459,0x104));var _0x9845=function(_0x31ed9b,_0x6cc822){_0x31ed9b=_0x31ed9b-0x0;var _0x5b6f1a=_0x8459[_0x31ed9b];return _0x5b6f1a;};'use strict';var client=require('../client');exports[_0x9845('0x0')]=function(){return function(){return client[_0x9845('0x1')](_0x9845('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9845('0x3'),_0x9845('0x4'),_0x9845('0x5'),'monitor_format',_0x9845('0x6'),_0x9845('0x7'),'dialMethod','dialLimitChannel',_0x9845('0x8'),_0x9845('0x9'),_0x9845('0xa'),'dialPredictiveOptimizationPercentage',_0x9845('0xb'),_0x9845('0xc'),_0x9845('0xd'),_0x9845('0xe'),'dialQueueOptions',_0x9845('0xf'),'dialQueueProject',_0x9845('0x10'),_0x9845('0x11'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x9845('0x12'),_0x9845('0x13'),_0x9845('0x14'),'dialTimezone',_0x9845('0x15'),_0x9845('0x16'),'dialCheckDuplicateType',_0x9845('0x17'),_0x9845('0x18'),_0x9845('0x19'),_0x9845('0x1a'),_0x9845('0x1b'),_0x9845('0x1c'),_0x9845('0x1d'),_0x9845('0x1e'),_0x9845('0x1f'),_0x9845('0x20'),'timeout','dialRecallMeTimeout',_0x9845('0x21'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x9845('0x22'),_0x9845('0x23'),_0x9845('0x24'),_0x9845('0x25'),_0x9845('0x26'),_0x9845('0x27'),_0x9845('0x28'),'dialNoSuchNumberRetryFrequency',_0x9845('0x29'),_0x9845('0x2a'),_0x9845('0x2b'),'dialAbandonedRetryFrequency',_0x9845('0x2c'),_0x9845('0x2d'),'dialAgentRejectMaxRetry',_0x9845('0x2e'),_0x9845('0x2f'),_0x9845('0x30'),'dialPredictiveIntervalMinThreshold',_0x9845('0x31')],'include':[{'model':_0x9845('0x32'),'as':_0x9845('0x32'),'attributes':['id',_0x9845('0x33'),_0x9845('0x34'),_0x9845('0x35')]},{'model':_0x9845('0x36'),'as':_0x9845('0x37'),'attributes':['id',_0x9845('0x33')]},{'model':'Trunk','as':_0x9845('0x38'),'attributes':['id',_0x9845('0x33'),'callerid',_0x9845('0x35')]},{'model':'Interval','as':_0x9845('0x39'),'attributes':['id',_0x9845('0x33')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name',_0x9845('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xf016=['Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','callAdditionalPhoneAfterMin','Trunk','active'];(function(_0x38f5c0,_0x57b250){var _0x54f13a=function(_0x4a322b){while(--_0x4a322b){_0x38f5c0['push'](_0x38f5c0['shift']());}};_0x54f13a(++_0x57b250);}(_0xf016,0x163));var _0x6f01=function(_0x170b49,_0x37640d){_0x170b49=_0x170b49-0x0;var _0x22803b=_0xf016[_0x170b49];return _0x22803b;};'use strict';var client=require(_0x6f01('0x0'));exports[_0x6f01('0x1')]=function(){return function(){return client[_0x6f01('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x6f01('0x3'),_0x6f01('0x4'),_0x6f01('0x5'),'autopause',_0x6f01('0x6'),'type','dialActive',_0x6f01('0x7'),_0x6f01('0x8'),_0x6f01('0x9'),'dialPowerLevel',_0x6f01('0xa'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x6f01('0xb'),'dialOriginateCallerIdNumber',_0x6f01('0xc'),_0x6f01('0xd'),_0x6f01('0xe'),'dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0x6f01('0xf'),_0x6f01('0x10'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x6f01('0x11'),_0x6f01('0x12'),_0x6f01('0x13'),'dialCheckDuplicateType',_0x6f01('0x14'),'dialAMDInitialSilence','dialAMDGreeting',_0x6f01('0x15'),_0x6f01('0x16'),'dialAMDMinWordLength',_0x6f01('0x17'),_0x6f01('0x18'),_0x6f01('0x19'),_0x6f01('0x1a'),'timeout',_0x6f01('0x1b'),'dialRecallInQueue',_0x6f01('0x1c'),_0x6f01('0x1d'),'dialAgiAfterHangupClient',_0x6f01('0x1e'),_0x6f01('0x6'),'strategy',_0x6f01('0x1f'),_0x6f01('0x20'),_0x6f01('0x21'),'dialNoSuchNumberRetryFrequency',_0x6f01('0x22'),'dialDropRetryFrequency',_0x6f01('0x23'),_0x6f01('0x24'),_0x6f01('0x25'),'dialMachineRetryFrequency',_0x6f01('0x26'),'dialAgentRejectRetryFrequency',_0x6f01('0x27'),_0x6f01('0x28'),_0x6f01('0x29'),_0x6f01('0x2a')],'include':[{'model':_0x6f01('0x2b'),'as':_0x6f01('0x2b'),'attributes':['id','name','callerid',_0x6f01('0x2c')]},{'model':_0x6f01('0x2d'),'as':_0x6f01('0x2e'),'attributes':['id',_0x6f01('0x3')]},{'model':_0x6f01('0x2b'),'as':_0x6f01('0x2f'),'attributes':['id',_0x6f01('0x3'),_0x6f01('0x30'),_0x6f01('0x2c')]},{'model':_0x6f01('0x31'),'as':_0x6f01('0x31'),'attributes':['id',_0x6f01('0x3')],'include':[{'model':_0x6f01('0x31'),'as':'Intervals','attributes':['id',_0x6f01('0x3'),'interval']}]}]},'log':_0x6f01('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 2db5d7a..ac4eb12 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 _0x02b4=['GetVoiceQueueReports','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','queuecallerabandonAt'];(function(_0x324e2c,_0x654c7c){var _0x5e2969=function(_0x5e6692){while(--_0x5e6692){_0x324e2c['push'](_0x324e2c['shift']());}};_0x5e2969(++_0x654c7c);}(_0x02b4,0x144));var _0x402b=function(_0x3f2f86,_0x30e073){_0x3f2f86=_0x3f2f86-0x0;var _0x29f4a5=_0x02b4[_0x3f2f86];return _0x29f4a5;};'use strict';var moment=require('moment');var _=require(_0x402b('0x0'));var client=require(_0x402b('0x1'));exports[_0x402b('0x2')]=function(_0x21a409){return client[_0x402b('0x3')]('CreateVoiceQueueReport',{'body':_0x21a409,'log':_0x402b('0x4')});};exports[_0x402b('0x5')]=function(){return function(){return client[_0x402b('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x402b('0x6'))[_0x402b('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x402b('0x8')](_0x402b('0x6'))['format'](_0x402b('0x9'))]}},'attributes':['uniqueid',_0x402b('0xa'),'queuecallerjoinAt','queuecallerleaveAt',_0x402b('0xb'),_0x402b('0xc'),_0x402b('0xd'),'queuecallerexitAt',_0x402b('0xe'),_0x402b('0xf')]},'log':_0x402b('0x10')});};}; \ No newline at end of file +var _0x0992=['queuecallerabandonAt','moment','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x58121b,_0x27bffa){var _0xf3aa58=function(_0x54f173){while(--_0x54f173){_0x58121b['push'](_0x58121b['shift']());}};_0xf3aa58(++_0x27bffa);}(_0x0992,0xef));var _0x2099=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x0992[_0x235f49];return _0x551139;};'use strict';var moment=require(_0x2099('0x0'));var _=require('lodash');var client=require(_0x2099('0x1'));exports[_0x2099('0x2')]=function(_0x1d0d53){return client[_0x2099('0x3')]('CreateVoiceQueueReport',{'body':_0x1d0d53,'log':_0x2099('0x4')});};exports[_0x2099('0x5')]=function(){return function(){return client[_0x2099('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x2099('0x6'))[_0x2099('0x7')](_0x2099('0x8')),moment()[_0x2099('0x9')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x2099('0xa'),'queue','queuecallerjoinAt',_0x2099('0xb'),_0x2099('0xc'),_0x2099('0xd'),_0x2099('0xe'),_0x2099('0xf'),'queuecallerabandon',_0x2099('0x10')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index b8c390e..1c65a4b 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 _0x7aa9=['getVoiceQueueRtPauses','Request','../client'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7aa9,0x7a));var _0x97aa=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x7aa9[_0x5575cd];return _0x4979a0;};'use strict';var client=require(_0x97aa('0x0'));exports[_0x97aa('0x1')]=function(_0x3f0e8e){return function(){return client[_0x97aa('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x3f0e8e,'paused':!![]},'raw':!![]},'log':_0x97aa('0x1')});};}; \ No newline at end of file +var _0xec1b=['../client','Request','getVoiceQueueRtPauses'];(function(_0x13f492,_0x2d5e9b){var _0x2f59f2=function(_0x303663){while(--_0x303663){_0x13f492['push'](_0x13f492['shift']());}};_0x2f59f2(++_0x2d5e9b);}(_0xec1b,0x15f));var _0xbec1=function(_0x2197c3,_0x310b38){_0x2197c3=_0x2197c3-0x0;var _0x120c87=_0xec1b[_0x2197c3];return _0x120c87;};'use strict';var client=require(_0xbec1('0x0'));exports['getVoiceQueueRtPauses']=function(_0x1f2fa5){return function(){return client[_0xbec1('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1f2fa5,'paused':!![]},'raw':!![]},'log':_0xbec1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f9aa883..9ab01fc 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 _0xa159=['monitorFilename','lodash','CreateVoiceRecording','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa159,0x195));var _0x9a15=function(_0xc2788,_0x5287d1){_0xc2788=_0xc2788-0x0;var _0x44087f=_0xa159[_0xc2788];return _0x44087f;};'use strict';var _=require(_0x9a15('0x0'));var client=require('../client');exports['create']=function(_0x552938){return client['Request'](_0x9a15('0x1'),{'body':_[_0x9a15('0x2')](_0x552938,{'value':_0x552938[_0x9a15('0x3')]}),'log':_0x9a15('0x1')});}; \ No newline at end of file +var _0x64f8=['lodash','../client','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0xd2a313,_0xd98999){var _0x245a66=function(_0x156683){while(--_0x156683){_0xd2a313['push'](_0xd2a313['shift']());}};_0x245a66(++_0xd98999);}(_0x64f8,0x14a));var _0x864f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x64f8[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x864f('0x0'));var client=require(_0x864f('0x1'));exports['create']=function(_0x14bce4){return client[_0x864f('0x2')](_0x864f('0x3'),{'body':_[_0x864f('0x4')](_0x14bce4,{'value':_0x14bce4[_0x864f('0x5')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 77d14d4..55aa73d 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 _0xae83=['transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename'];(function(_0x35cc24,_0x299db6){var _0x137359=function(_0x58ca43){while(--_0x58ca43){_0x35cc24['push'](_0x35cc24['shift']());}};_0x137359(++_0x299db6);}(_0xae83,0xee));var _0x3ae8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xae83[_0x199572];return _0x13cfa3;};'use strict';var client=require(_0x3ae8('0x0'));exports[_0x3ae8('0x1')]={};exports[_0x3ae8('0x2')]=function(_0x464582){return client['Request'](_0x3ae8('0x3'),{'body':{'result':_0x464582['result'],'transfererchannel':_0x464582['transfererchannel'],'transferercalleridnum':_0x464582['transferercalleridnum'],'transferercalleridname':_0x464582[_0x3ae8('0x4')],'transfererconnectedlinenum':_0x464582[_0x3ae8('0x5')],'transfererconnectedlinename':_0x464582[_0x3ae8('0x6')],'transfereraccountcode':_0x464582['transfereraccountcode'],'transferercontext':_0x464582['transferercontext'],'transfererexten':_0x464582[_0x3ae8('0x7')],'transfererlinkedid':_0x464582['transfererlinkedid'],'transfereechannel':_0x464582[_0x3ae8('0x8')],'transfereecalleridnum':_0x464582[_0x3ae8('0x9')],'transfereecalleridname':_0x464582[_0x3ae8('0xa')],'transfereeconnectedlinenum':_0x464582[_0x3ae8('0xb')],'transfereeconnectedlinename':_0x464582[_0x3ae8('0xc')],'transfereeaccountcode':_0x464582[_0x3ae8('0xd')],'transfereecontext':_0x464582['transfereecontext'],'transfereeexten':_0x464582['transfereeexten'],'transfereelinkedid':_0x464582[_0x3ae8('0xe')],'isexternal':_0x464582[_0x3ae8('0xf')],'context':_0x464582['context'],'extension':_0x464582[_0x3ae8('0x10')],'type':'blind'},'log':_0x3ae8('0x3')});};exports[_0x3ae8('0x11')]=function(_0xec5b66){return client['Request'](_0x3ae8('0x3'),{'body':{'result':_0xec5b66['result'],'transfererchannel':_0xec5b66[_0x3ae8('0x12')],'transferercalleridnum':_0xec5b66['origtransferercalleridnum'],'transferercalleridname':_0xec5b66[_0x3ae8('0x13')],'transfererconnectedlinenum':_0xec5b66[_0x3ae8('0x14')],'transfererconnectedlinename':_0xec5b66[_0x3ae8('0x15')],'transfereraccountcode':_0xec5b66[_0x3ae8('0x16')],'transferercontext':_0xec5b66[_0x3ae8('0x17')],'transfererexten':_0xec5b66['secondtransfererexten'],'transfererlinkedid':_0xec5b66[_0x3ae8('0x18')],'transfereechannel':_0xec5b66['transfertargetchannel'],'transfereecalleridnum':_0xec5b66[_0x3ae8('0x19')],'transfereecalleridname':_0xec5b66[_0x3ae8('0x1a')],'transfereeconnectedlinenum':_0xec5b66[_0x3ae8('0x1b')],'transfereeconnectedlinename':_0xec5b66[_0x3ae8('0x1c')],'transfereeaccountcode':_0xec5b66[_0x3ae8('0x1d')],'transfereecontext':_0xec5b66['transfertargetcontext'],'transfereeexten':_0xec5b66[_0x3ae8('0x1e')],'transfereelinkedid':_0xec5b66[_0x3ae8('0x1f')],'isexternal':_0xec5b66[_0x3ae8('0xf')],'context':_0xec5b66[_0x3ae8('0x20')],'extension':_0xec5b66[_0x3ae8('0x21')],'type':_0x3ae8('0x22')},'log':_0x3ae8('0x3')});}; \ No newline at end of file +var _0xa232=['transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum'];(function(_0x7096f6,_0xcc37f4){var _0x880174=function(_0x4ae0ba){while(--_0x4ae0ba){_0x7096f6['push'](_0x7096f6['shift']());}};_0x880174(++_0xcc37f4);}(_0xa232,0x165));var _0x2a23=function(_0x54536f,_0x1948c5){_0x54536f=_0x54536f-0x0;var _0x4befc1=_0xa232[_0x54536f];return _0x4befc1;};'use strict';var client=require(_0x2a23('0x0'));exports[_0x2a23('0x1')]={};exports[_0x2a23('0x2')]=function(_0x49f79b){return client['Request'](_0x2a23('0x3'),{'body':{'result':_0x49f79b['result'],'transfererchannel':_0x49f79b[_0x2a23('0x4')],'transferercalleridnum':_0x49f79b[_0x2a23('0x5')],'transferercalleridname':_0x49f79b['transferercalleridname'],'transfererconnectedlinenum':_0x49f79b[_0x2a23('0x6')],'transfererconnectedlinename':_0x49f79b['transfererconnectedlinename'],'transfereraccountcode':_0x49f79b[_0x2a23('0x7')],'transferercontext':_0x49f79b[_0x2a23('0x8')],'transfererexten':_0x49f79b[_0x2a23('0x9')],'transfererlinkedid':_0x49f79b[_0x2a23('0xa')],'transfereechannel':_0x49f79b[_0x2a23('0xb')],'transfereecalleridnum':_0x49f79b[_0x2a23('0xc')],'transfereecalleridname':_0x49f79b[_0x2a23('0xd')],'transfereeconnectedlinenum':_0x49f79b[_0x2a23('0xe')],'transfereeconnectedlinename':_0x49f79b[_0x2a23('0xf')],'transfereeaccountcode':_0x49f79b[_0x2a23('0x10')],'transfereecontext':_0x49f79b[_0x2a23('0x11')],'transfereeexten':_0x49f79b[_0x2a23('0x12')],'transfereelinkedid':_0x49f79b[_0x2a23('0x13')],'isexternal':_0x49f79b[_0x2a23('0x14')],'context':_0x49f79b[_0x2a23('0x15')],'extension':_0x49f79b['extension'],'type':_0x2a23('0x16')},'log':_0x2a23('0x3')});};exports[_0x2a23('0x17')]=function(_0x5f1775){return client[_0x2a23('0x18')](_0x2a23('0x3'),{'body':{'result':_0x5f1775['result'],'transfererchannel':_0x5f1775[_0x2a23('0x19')],'transferercalleridnum':_0x5f1775[_0x2a23('0x1a')],'transferercalleridname':_0x5f1775['origtransferercalleridname'],'transfererconnectedlinenum':_0x5f1775[_0x2a23('0x1b')],'transfererconnectedlinename':_0x5f1775['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5f1775['origtransfereraccountcode'],'transferercontext':_0x5f1775['secondtransferercontext'],'transfererexten':_0x5f1775[_0x2a23('0x1c')],'transfererlinkedid':_0x5f1775[_0x2a23('0x1d')],'transfereechannel':_0x5f1775['transfertargetchannel'],'transfereecalleridnum':_0x5f1775[_0x2a23('0x1e')],'transfereecalleridname':_0x5f1775['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5f1775['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5f1775[_0x2a23('0x1f')],'transfereeaccountcode':_0x5f1775[_0x2a23('0x20')],'transfereecontext':_0x5f1775[_0x2a23('0x21')],'transfereeexten':_0x5f1775['transfertargetexten'],'transfereelinkedid':_0x5f1775['transfertargetlinkedid'],'isexternal':_0x5f1775[_0x2a23('0x14')],'context':_0x5f1775[_0x2a23('0x22')],'extension':_0x5f1775[_0x2a23('0x23')],'type':_0x2a23('0x24')},'log':_0x2a23('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6703ab6..950659b 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 _0xe7ea=['updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','then','catch','message','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','values','channels','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','push','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','destinationchannel','stop','Hangup','voicequeuechannelredirect','queueChannels','Redirect','exten','context','outbound','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','agents'];(function(_0x168cf7,_0x5e950e){var _0x52ebcc=function(_0x10b5e5){while(--_0x10b5e5){_0x168cf7['push'](_0x168cf7['shift']());}};_0x52ebcc(++_0x5e950e);}(_0xe7ea,0x78));var _0xae7e=function(_0x1e8e81,_0x240af8){_0x1e8e81=_0x1e8e81-0x0;var _0x583bcd=_0xe7ea[_0x1e8e81];return _0x583bcd;};'use strict';var _=require(_0xae7e('0x0'));var util=require(_0xae7e('0x1'));var jayson=require(_0xae7e('0x2'));var schema=require(_0xae7e('0x3'));var BPromise=require(_0xae7e('0x4'));var moment=require(_0xae7e('0x5'));var config=require(_0xae7e('0x6'));var properties=require(_0xae7e('0x7'));var ami=require(_0xae7e('0x8'));exports[_0xae7e('0x9')]=function(_0x47c336,_0x18f66d,_0x4d17af){return new BPromise(function(_0x544e02,_0x5874f1){var _0x6f23de={'QueuePause':function(_0x5745c4){return new Promise(function(_0x1cbd74,_0x766355){var _0x48b71a=util[_0xae7e('0xa')](_0xae7e('0xb'),'SIP',_0x5745c4[_0xae7e('0xc')]);if(_0x47c336['timers']&&_0x47c336[_0xae7e('0xd')][_0x48b71a]&&_0x47c336[_0xae7e('0xd')][_0x48b71a][_0xae7e('0xe')]){_0x47c336[_0xae7e('0xd')][_0x48b71a]['updateAcw']();}if(_0x47c336['agents'][_0x48b71a]){_0x47c336[_0xae7e('0xf')][_0x48b71a][_0xae7e('0x10')]({'statePause':_0x5745c4[_0xae7e('0x11')]?!![]:![]});}_0x1cbd74({'code':0xc8,'message':_0xae7e('0x12')});});},'Reload':function(_0x2ed7ba){var _0x3702d8=this;return new Promise(function(_0x174210,_0x50fd57){if(ami[_0xae7e('0x13')]()==![]){return _0x50fd57(_0x3702d8[_0xae7e('0x14')](0x1f4,[config[_0xae7e('0x15')]['ip'],config[_0xae7e('0x15')][_0xae7e('0x16')],_0xae7e('0x17')][_0xae7e('0x18')]('\x20')));}_0x2ed7ba=_[_0xae7e('0x19')](_0x2ed7ba,_[_0xae7e('0x1a')](properties[_0xae7e('0x1b')]));_0x2ed7ba[_0xae7e('0x1c')]='Reload';return ami['Action'](_0x2ed7ba)[_0xae7e('0x1d')](function(_0x4beb2c){_0x174210({'code':0xc8,'message':_0x4beb2c['message']});})[_0xae7e('0x1e')](function(_0x5924d2){_0x50fd57(_0x3702d8[_0xae7e('0x14')](0x1f5,_0x5924d2[_0xae7e('0x1f')]));});});},'Command':function(_0x1e424f){var _0x5f187c=this;return new Promise(function(_0x26034f,_0x272324){if(ami[_0xae7e('0x13')]()==![]){return _0x272324(_0x5f187c[_0xae7e('0x14')](0x1f4,[config[_0xae7e('0x15')]['ip'],config['asterisk'][_0xae7e('0x16')],_0xae7e('0x17')][_0xae7e('0x18')]('\x20')));}_0x1e424f=_[_0xae7e('0x19')](_0x1e424f,'command');_0x1e424f[_0xae7e('0x1c')]=_0xae7e('0x20');return ami[_0xae7e('0x21')](_0x1e424f)[_0xae7e('0x1d')](function(_0x395f34){_0x26034f({'code':0xc8,'message':_0x395f34[_0xae7e('0x22')]});})[_0xae7e('0x1e')](function(_0x3469b2){_0x272324(_0x5f187c[_0xae7e('0x14')](0x1f5,_0x3469b2[_0xae7e('0x1f')]));});});},'VoiceQueues':function(_0x336f9a){return new Promise(function(_0x1c37f1,_0x5156dc){var _0x270cf8=[];for(var _0x2cc88b in _0x47c336[_0xae7e('0x23')]){if(_0x47c336[_0xae7e('0x23')][_0xae7e('0x24')](_0x2cc88b)){var _0x1370f1=_0x47c336[_0xae7e('0x23')][_0x2cc88b];var _0x3e5e44={'id':_0x1370f1['id'],'name':_0x1370f1[_0xae7e('0xc')],'strategy':_0x1370f1[_0xae7e('0x25')],'answered':_0x1370f1[_0xae7e('0x26')],'available':_0x1370f1[_0xae7e('0x27')],'loggedIn':_0x1370f1[_0xae7e('0x28')],'pTalking':_0x1370f1[_0xae7e('0x29')],'sumBillable':_0x1370f1[_0xae7e('0x2a')],'sumDuration':_0x1370f1['sumDuration'],'sumHoldTime':_0x1370f1[_0xae7e('0x2b')]||0x0,'talking':_0x1370f1['talking'],'total':_0x1370f1['total'],'type':_0x1370f1[_0xae7e('0x2c')],'unmanaged':_0x1370f1['unmanaged'],'abandoned':_0x1370f1[_0xae7e('0x2d')],'waiting':_0x1370f1[_0xae7e('0x2e')],'loggedInDb':_0x1370f1[_0xae7e('0x2f')]};if(_0x1370f1[_0xae7e('0x2c')]==='outbound'){_0x3e5e44[_0xae7e('0x30')]=_0x1370f1['dialActive'];_0x3e5e44[_0xae7e('0x31')]=_0x1370f1[_0xae7e('0x31')];_0x3e5e44[_0xae7e('0x32')]=_0x1370f1[_0xae7e('0x32')];_0x3e5e44['dialOriginateCallerIdNumber']=_0x1370f1[_0xae7e('0x33')];_0x3e5e44[_0xae7e('0x34')]=_0x1370f1[_0xae7e('0x34')];_0x3e5e44[_0xae7e('0x35')]=_0x1370f1[_0xae7e('0x35')];_0x3e5e44[_0xae7e('0x36')]=_0x1370f1['temp'];_0x3e5e44[_0xae7e('0x37')]=_0x1370f1[_0xae7e('0x37')];_0x3e5e44[_0xae7e('0x38')]=_0x1370f1[_0xae7e('0x38')];_0x3e5e44[_0xae7e('0x39')]=_0x1370f1[_0xae7e('0x39')];_0x3e5e44[_0xae7e('0x3a')]=_0x1370f1[_0xae7e('0x3a')];_0x3e5e44[_0xae7e('0x3b')]=_0x1370f1[_0xae7e('0x3b')];_0x3e5e44[_0xae7e('0x3c')]=_0x1370f1[_0xae7e('0x3c')];_0x3e5e44[_0xae7e('0x3d')]=_0x1370f1['outboundDropCallsDayCallersExit'];_0x3e5e44[_0xae7e('0x3e')]=_0x1370f1[_0xae7e('0x3e')];_0x3e5e44[_0xae7e('0x3f')]=_0x1370f1[_0xae7e('0x3f')];_0x3e5e44[_0xae7e('0x40')]=_0x1370f1['outboundNoSuchCallsDay'];_0x3e5e44[_0xae7e('0x41')]=_0x1370f1[_0xae7e('0x41')];_0x3e5e44[_0xae7e('0x42')]=_0x1370f1['outboundReCallsDay'];_0x3e5e44[_0xae7e('0x43')]=_0x1370f1[_0xae7e('0x43')];_0x3e5e44['outboundUnknownCallsDay']=_0x1370f1[_0xae7e('0x44')];_0x3e5e44['predictiveIntervalAnsweredCalls']=_0x1370f1[_0xae7e('0x45')];_0x3e5e44['predictiveIntervalAvgHoldtime']=_0x1370f1[_0xae7e('0x46')];_0x3e5e44[_0xae7e('0x47')]=_0x1370f1[_0xae7e('0x47')];_0x3e5e44['predictiveIntervalDroppedCallsCallersExit']=_0x1370f1[_0xae7e('0x48')];_0x3e5e44[_0xae7e('0x49')]=_0x1370f1[_0xae7e('0x49')];_0x3e5e44[_0xae7e('0x4a')]=_0x1370f1[_0xae7e('0x4a')];_0x3e5e44[_0xae7e('0x4b')]=_0x1370f1[_0xae7e('0x4b')];_0x3e5e44['predictiveIntervalHitRate']=_0x1370f1[_0xae7e('0x4c')];_0x3e5e44[_0xae7e('0x4d')]=_0x1370f1[_0xae7e('0x4d')];_0x3e5e44['predictiveIntervalPauses']=_0x1370f1['predictiveIntervalPauses'];_0x3e5e44[_0xae7e('0x4e')]=_0x1370f1[_0xae7e('0x4e')];_0x3e5e44[_0xae7e('0x4f')]=_0x1370f1[_0xae7e('0x4f')];_0x3e5e44[_0xae7e('0x1f')]=_0x1370f1[_0xae7e('0x1f')];_0x3e5e44[_0xae7e('0x50')]=_0x1370f1[_0xae7e('0x50')];_0x3e5e44['erlangCalls']=_0x1370f1['erlangCalls'];_0x3e5e44['erlangCallToSecond']=_0x1370f1[_0xae7e('0x51')];_0x3e5e44[_0xae7e('0x52')]=_0x1370f1[_0xae7e('0x52')];_0x3e5e44[_0xae7e('0x53')]=_0x1370f1[_0xae7e('0x53')];_0x3e5e44[_0xae7e('0x54')]=_0x1370f1['startPredictive'];_0x3e5e44[_0xae7e('0x55')]=_0x1370f1[_0xae7e('0x55')];}if(_0x1370f1['Trunk']){_0x3e5e44[_0xae7e('0x56')]={'id':_0x1370f1[_0xae7e('0x56')]['id'],'name':_0x1370f1[_0xae7e('0x56')][_0xae7e('0xc')],'active':_0x1370f1[_0xae7e('0x56')][_0xae7e('0x57')],'callerid':_0x1370f1[_0xae7e('0x56')][_0xae7e('0x58')]};}if(_0x1370f1[_0xae7e('0x59')]){_0x3e5e44[_0xae7e('0x59')]={'id':_0x1370f1[_0xae7e('0x59')]['id'],'name':_0x1370f1[_0xae7e('0x59')]['name']};}_0x270cf8['push'](_0x3e5e44);}}_0x1c37f1({'count':_0x270cf8[_0xae7e('0x5a')],'rows':_0x270cf8});});},'UpdateVoiceQueue':function(_0x272a57){return new Promise(function(_0x548f72,_0x36e987){var _0x36d859=_[_0xae7e('0x5b')](_0x47c336[_0xae7e('0x23')],{'id':parseInt(_0x272a57['id'])});var _0x25f084=_[_0xae7e('0x5c')](_0x272a57,['id']);if(_0x36d859){for(var _0x270c8d in _0x25f084){if(typeof _0x25f084[_0x270c8d]!==_0xae7e('0x5d')&&typeof _0x36d859[_0x270c8d]!==_0xae7e('0x5d')){_0x36d859[_0x270c8d]=_0x25f084[_0x270c8d];}}_0x548f72(_0x36d859);}else{_0x36e987();}});},'VoiceChannels':function(_0xdfc039){return new Promise(function(_0x3bd339,_0x40a139){var _0x482ebf=_[_0xae7e('0x5e')](_0x47c336[_0xae7e('0x5f')]);_0x3bd339({'count':_0x482ebf[_0xae7e('0x5a')],'rows':_0x482ebf});});},'VoiceChannelMixMonitor':function(_0x58869a){var _0x20e056=this;return new Promise(function(_0x48154c,_0x50f35c){if(ami[_0xae7e('0x13')]()==![]){return _0x50f35c(_0x20e056[_0xae7e('0x14')](0x1f4,[config[_0xae7e('0x15')]['ip'],config[_0xae7e('0x15')]['username'],_0xae7e('0x17')][_0xae7e('0x18')]('\x20')));}var _0x121e2e=schema(properties['voicechannel'])[_0xae7e('0x3')](_0x58869a);if(_0x121e2e[_0xae7e('0x5a')]>0x0){return _0x50f35c(_0x20e056['error'](0x1f4,_[_0xae7e('0x60')](_0x121e2e,'message')['join'](',\x20')));}var _0x3a0bef=_[_0xae7e('0x5b')](_0x47c336['channels'],{'uniqueid':_0x58869a[_0xae7e('0x61')]});if(_0x3a0bef&&_0x3a0bef[_0xae7e('0x62')]){var _0x3020ce=util['format'](_0xae7e('0x63'),_0x58869a[_0xae7e('0x64')]||_0x58869a['uniqueid'],_0x58869a[_0xae7e('0xa')]||_0xae7e('0x65'));return ami[_0xae7e('0x21')]({'action':_0xae7e('0x66'),'channel':_0x3a0bef[_0xae7e('0x62')],'file':_0x3020ce,'options':_0xae7e('0x67')})[_0xae7e('0x1d')](function(_0xb6b134){var _0x5e9405=_[_0xae7e('0x5b')](_0x3a0bef[_0xae7e('0x68')],{'filename':_0xae7e('0x69')+_0x3020ce['toLowerCase']()});if(_[_0xae7e('0x6a')](_0x5e9405)){_0x3a0bef[_0xae7e('0x68')][_0xae7e('0x6b')]({'filename':_0xae7e('0x69')+_0x3020ce[_0xae7e('0x6c')](),'createdAt':moment()[_0xae7e('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0xb6b134[_0xae7e('0x6d')],'status':_0xae7e('0x6e')});}else{_0x5e9405[_0xae7e('0x6d')]=_0xb6b134[_0xae7e('0x6d')];_0x5e9405[_0xae7e('0x6f')]=_0xae7e('0x6e');}_0x48154c({'code':0xc8,'message':[_0x58869a[_0xae7e('0x61')],_0xae7e('0x70'),_0xb6b134[_0xae7e('0x6d')]]['join']('\x20'),'mixmonitorid':_0xb6b134[_0xae7e('0x6d')]});})[_0xae7e('0x1e')](function(_0x24a974){_0x50f35c(_0x20e056['error'](0x1f5,[_0x58869a[_0xae7e('0x61')],_0x24a974[_0xae7e('0x1f')][_0xae7e('0x6c')]()][_0xae7e('0x18')]('\x20')));});}else{return _0x50f35c(_0x20e056[_0xae7e('0x14')](0x1f5,_0xae7e('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x57df56){var _0x5cef54=this;return new Promise(function(_0x4c123e,_0x4d2a88){if(ami[_0xae7e('0x13')]()==![]){return _0x4d2a88(_0x5cef54['error'](0x1f4,[config[_0xae7e('0x15')]['ip'],config[_0xae7e('0x15')][_0xae7e('0x16')],_0xae7e('0x17')][_0xae7e('0x18')]('\x20')));}var _0x5c202b=schema(properties[_0xae7e('0x72')])['validate'](_0x57df56);if(_0x5c202b[_0xae7e('0x5a')]>0x0){return _0x4d2a88(_0x5cef54[_0xae7e('0x14')](0x1f4,_[_0xae7e('0x60')](_0x5c202b,_0xae7e('0x1f'))['join'](',\x20')));}var _0x2488d7=_[_0xae7e('0x5b')](_0x47c336[_0xae7e('0x5f')],{'uniqueid':_0x57df56[_0xae7e('0x61')]});if(_0x2488d7){return BPromise[_0xae7e('0x73')]()['then'](function(){if(_0x2488d7[_0xae7e('0x62')]){return ami[_0xae7e('0x21')]({'action':'StopMixMonitor','channel':_0x2488d7[_0xae7e('0x62')],'mixmonitorid':_0x57df56['mixmonitorid']})[_0xae7e('0x1e')](function(_0x54b743){});}})['then'](function(){if(_0x2488d7[_0xae7e('0x74')]){return ami[_0xae7e('0x21')]({'action':'StopMixMonitor','channel':_0x2488d7[_0xae7e('0x74')],'mixmonitorid':_0x57df56[_0xae7e('0x6d')]})[_0xae7e('0x1e')](function(_0x545a3e){});}})[_0xae7e('0x1d')](function(_0x14c9d8){var _0x20486e=_[_0xae7e('0x5b')](_0x2488d7[_0xae7e('0x68')],{'mixmonitorid':_0x57df56[_0xae7e('0x6d')]});if(_0x20486e){_0x20486e['status']=_0xae7e('0x75');}})[_0xae7e('0x1d')](function(){var _0x384bed=util[_0xae7e('0xa')](_0xae7e('0x63'),_0x57df56[_0xae7e('0x64')]||_0x57df56[_0xae7e('0x61')],_0x57df56[_0xae7e('0xa')]||_0xae7e('0x65'));var _0x3abcff=_[_0xae7e('0x5b')](_0x2488d7['monitors'],{'filename':_0xae7e('0x69')+_0x384bed[_0xae7e('0x6c')]()});if(_0x3abcff){_0x3abcff['status']=_0xae7e('0x75');}})[_0xae7e('0x1d')](function(){_0x4c123e({'code':0xc8,'message':[_0x57df56[_0xae7e('0x61')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xae7e('0x1e')](function(_0x1a3ed3){_0x4d2a88(_0x5cef54[_0xae7e('0x14')](0x1f5,[_0x57df56['uniqueid'],_0x1a3ed3[_0xae7e('0x1f')][_0xae7e('0x6c')]()][_0xae7e('0x18')]('\x20')));});}else{return _0x4d2a88(_0x5cef54[_0xae7e('0x14')](0x1f5,_0xae7e('0x71')));}});},'VoiceQueuesChannels':function(_0x47f8ba){return new Promise(function(_0x22161d,_0xdc0c36){var _0x76cc75=_['values'](_0x47c336['queueChannels']);_0x22161d({'count':_0x76cc75[_0xae7e('0x5a')],'rows':_0x76cc75});});},'VoiceQueuesChannel':function(_0x531d4c){var _0x465530=this;return new Promise(function(_0x262f09,_0x561351){var _0x536a90=schema(properties['voicequeuechannel'])[_0xae7e('0x3')](_0x531d4c);if(_0x536a90[_0xae7e('0x5a')]>0x0){return _0x561351(_0x465530[_0xae7e('0x14')](0x1f4,_[_0xae7e('0x60')](_0x536a90,_0xae7e('0x1f'))['join'](',\x20')));}var _0x323af3=_[_0xae7e('0x5b')](_0x47c336['queueChannels'],{'uniqueid':_0x531d4c['uniqueid']});if(_0x323af3){_0x262f09(_0x323af3);}else{return _0x561351(_0x465530[_0xae7e('0x14')](0x1f5,_0xae7e('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x39ec63){var _0x21c2a6=this;return new Promise(function(_0x104c81,_0x5e0e9d){if(ami[_0xae7e('0x13')]()==![]){return _0x5e0e9d(_0x21c2a6[_0xae7e('0x14')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xae7e('0x17')]['join']('\x20')));}var _0x24f16a=schema(properties['voicequeuechannelhangup'])[_0xae7e('0x3')](_0x39ec63);if(_0x24f16a[_0xae7e('0x5a')]>0x0){return _0x5e0e9d(_0x21c2a6['error'](0x1f4,_[_0xae7e('0x60')](_0x24f16a,_0xae7e('0x1f'))[_0xae7e('0x18')](',\x20')));}var _0x489f1e=_[_0xae7e('0x5b')](_0x47c336['queueChannels'],{'uniqueid':_0x39ec63['uniqueid']});if(_0x489f1e&&_0x489f1e[_0xae7e('0x62')]){return ami[_0xae7e('0x21')]({'action':_0xae7e('0x76'),'channel':_0x489f1e['channel']})[_0xae7e('0x1d')](function(_0x2579a4){_0x104c81({'code':0xc8,'message':[_0x39ec63[_0xae7e('0x61')],_0x2579a4[_0xae7e('0x1f')][_0xae7e('0x6c')]()][_0xae7e('0x18')]('\x20')});})['catch'](function(_0x263625){_0x5e0e9d(_0x21c2a6[_0xae7e('0x14')](0x1f5,[_0x39ec63['uniqueid'],_0x263625[_0xae7e('0x1f')]['toLowerCase']()][_0xae7e('0x18')]('\x20')));});}else{return _0x5e0e9d(_0x21c2a6['error'](0x1f5,_0xae7e('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x58a7ee){var _0x54d2d6=this;return new Promise(function(_0x14736c,_0x1fd8da){if(ami[_0xae7e('0x13')]()==![]){return _0x1fd8da(_0x54d2d6[_0xae7e('0x14')](0x1f4,[config[_0xae7e('0x15')]['ip'],config[_0xae7e('0x15')][_0xae7e('0x16')],_0xae7e('0x17')]['join']('\x20')));}var _0xe5ffa4=schema(properties[_0xae7e('0x77')])[_0xae7e('0x3')](_0x58a7ee);if(_0xe5ffa4[_0xae7e('0x5a')]>0x0){return _0x1fd8da(_0x54d2d6[_0xae7e('0x14')](0x1f4,_[_0xae7e('0x60')](_0xe5ffa4,'message')[_0xae7e('0x18')](',\x20')));}var _0x31e1dc=_[_0xae7e('0x5b')](_0x47c336[_0xae7e('0x78')],{'uniqueid':_0x58a7ee[_0xae7e('0x61')]});if(_0x31e1dc&&_0x31e1dc[_0xae7e('0x62')]){return ami[_0xae7e('0x21')]({'action':_0xae7e('0x79'),'channel':_0x31e1dc['channel'],'exten':_0x58a7ee[_0xae7e('0x7a')],'context':_0x58a7ee['context']||_0x31e1dc[_0xae7e('0x7b')],'priority':0x1})[_0xae7e('0x1d')](function(_0x4a4c71){_0x14736c({'code':0xc8,'message':[_0x58a7ee[_0xae7e('0x61')],_0x4a4c71['message']['toLowerCase']()][_0xae7e('0x18')]('\x20')});})[_0xae7e('0x1e')](function(_0x140ae3){_0x1fd8da(_0x54d2d6[_0xae7e('0x14')](0x1f5,[_0x58a7ee['uniqueid'],_0x140ae3[_0xae7e('0x1f')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1fd8da(_0x54d2d6[_0xae7e('0x14')](0x1f5,_0xae7e('0x71')));}});},'Agents':function(_0x20b11a){return new Promise(function(_0x161c34,_0x1523f3){var _0xb9bcf2=_['values'](_0x47c336[_0xae7e('0xf')]);_0x161c34({'count':_0xb9bcf2[_0xae7e('0x5a')],'rows':_0xb9bcf2});});},'Telephones':function(_0x3e3f55){return new Promise(function(_0x4e930d,_0x5990e3){var _0x349161=_[_0xae7e('0x5e')](_0x47c336['telephones']);_0x4e930d({'count':_0x349161[_0xae7e('0x5a')],'rows':_0x349161});});},'Trunks':function(_0x1d4d67){return new Promise(function(_0xe916c9,_0x4fd92a){var _0x1478c2=_[_0xae7e('0x5e')](_0x47c336['trunks']);_0xe916c9({'count':_0x1478c2['length'],'rows':_0x1478c2});});},'OutboundChannels':function(_0x1d6514){return new Promise(function(_0x4949b6,_0xc8b1ee){var _0x259983=_[_0xae7e('0x5e')](_0x47c336['outboundChannels']);_0x4949b6({'count':_0x259983['length'],'rows':_0x259983});});},'Outbound':function(_0x361978){return new Promise(function(_0x29b2c9,_0x410751){_0x29b2c9(_0x47c336[_0xae7e('0x7c')]);});},'Campaigns':function(_0x5b8226){return new Promise(function(_0x321a38,_0x442615){var _0x374264=_[_0xae7e('0x5e')](_0x47c336['campaigns']);_0x321a38({'count':_0x374264[_0xae7e('0x5a')],'rows':_0x374264});});},'VoiceQueuesPreview':function(_0x19f5f5){var _0x172c97=this;return new Promise(function(_0x123832,_0x4a8dc2){_0x18f66d['run'](_0x19f5f5['id'])[_0xae7e('0x1d')](function(_0x2f35c1){_0x123832({'code':0xc8,'message':_0x2f35c1[_0xae7e('0x1f')]});})[_0xae7e('0x1e')](function(_0x533b6d){_0x4a8dc2(_0x172c97[_0xae7e('0x14')](0x1f4,_0x533b6d['message']));});});},'EventManager':function(_0x3277ea){var _0x30592b=this;return new Promise(function(_0x2ba5ef,_0x2547ce){if(!_0x3277ea[_0xae7e('0x7d')]){return _0x2547ce(_0x30592b[_0xae7e('0x14')](0x1f4,_0xae7e('0x7e')));}ami[_0xae7e('0x7f')]('custom:'+_0x3277ea[_0xae7e('0x7d')],_0x3277ea['message']);_0x2ba5ef({'code':0xc8,'message':_0x3277ea});});},'FaxAccounts':function(_0x28a2a1){return new Promise(function(_0x5d1f87,_0x405a6f){var _0x1d8433=_[_0xae7e('0x5e')](_0x47c336[_0xae7e('0x80')]);_0x5d1f87({'count':_0x1d8433[_0xae7e('0x5a')],'rows':_0x1d8433});});},'SendFax':function(_0x27d52e){var _0x38adcf=this;return new Promise(function(_0x3806db,_0x31ed61){_0x4d17af[_0xae7e('0x81')](_0x27d52e)[_0xae7e('0x1d')](function(_0x3498e5){_0x3806db({'code':0xc8,'message':_0x3498e5[_0xae7e('0x1f')]});})[_0xae7e('0x1e')](function(_0x13517c){_0x31ed61(_0x38adcf[_0xae7e('0x14')](0x1f4,_0x13517c[_0xae7e('0x1f')]));});});},'CheckAfterSend':function(_0x20293c){var _0x24f8a3=this;return new Promise(function(_0x29fa75,_0xb25059){_0x4d17af[_0xae7e('0x82')](_0x20293c)[_0xae7e('0x1d')](function(_0x12c046){_0x29fa75({'code':0xc8,'message':_0x12c046[_0xae7e('0x1f')]});})[_0xae7e('0x1e')](function(_0x15bd33){_0xb25059(_0x24f8a3[_0xae7e('0x14')](0x1f4,_0x15bd33[_0xae7e('0x1f')]));});});}};var _0x47e3f0=jayson[_0xae7e('0x83')](_0x6f23de)[_0xae7e('0x84')]();_0x47e3f0['on'](_0xae7e('0x14'),function(_0x207f5d){return _0x5874f1(_0x207f5d);});_0x47e3f0[_0xae7e('0x9')](0x232a,'127.0.0.1',function(){console[_0xae7e('0x85')](_0xae7e('0x86'),0x232a);return _0x544e02(_0xae7e('0x87')+0x232a);});});}; \ No newline at end of file +var _0xaf4e=['%s.%s','filename','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','wav','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','channel','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../properties','listen','format','SIP','name','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','keys','module','action','Action','then','message','username','pick','command','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','validate','map','uniqueid'];(function(_0x178a2b,_0x442321){var _0x5b4e72=function(_0x1a6dcd){while(--_0x1a6dcd){_0x178a2b['push'](_0x178a2b['shift']());}};_0x5b4e72(++_0x442321);}(_0xaf4e,0x14a));var _0xeaf4=function(_0x514732,_0x5e2806){_0x514732=_0x514732-0x0;var _0xbc7dda=_0xaf4e[_0x514732];return _0xbc7dda;};'use strict';var _=require(_0xeaf4('0x0'));var util=require(_0xeaf4('0x1'));var jayson=require(_0xeaf4('0x2'));var schema=require('validate');var BPromise=require(_0xeaf4('0x3'));var moment=require(_0xeaf4('0x4'));var config=require('../../../config/environment');var properties=require(_0xeaf4('0x5'));var ami=require('../ami');exports[_0xeaf4('0x6')]=function(_0x4783a4,_0x585aea,_0x1af6a0){return new BPromise(function(_0x5d08d7,_0x49ea71){var _0x8fac25={'QueuePause':function(_0x380560){return new Promise(function(_0x54eb70,_0x44aaaa){var _0x5e977f=util[_0xeaf4('0x7')]('%s/%s',_0xeaf4('0x8'),_0x380560[_0xeaf4('0x9')]);if(_0x4783a4[_0xeaf4('0xa')]&&_0x4783a4[_0xeaf4('0xa')][_0x5e977f]&&_0x4783a4[_0xeaf4('0xa')][_0x5e977f][_0xeaf4('0xb')]){_0x4783a4[_0xeaf4('0xa')][_0x5e977f]['updateAcw']();}if(_0x4783a4[_0xeaf4('0xc')][_0x5e977f]){_0x4783a4['agents'][_0x5e977f]['updateStatusRealtime']({'statePause':_0x380560[_0xeaf4('0xd')]?!![]:![]});}_0x54eb70({'code':0xc8,'message':_0xeaf4('0xe')});});},'Reload':function(_0x23e15c){var _0x4c7af2=this;return new Promise(function(_0x16fa61,_0x1c8009){if(ami[_0xeaf4('0xf')]()==![]){return _0x1c8009(_0x4c7af2[_0xeaf4('0x10')](0x1f4,[config[_0xeaf4('0x11')]['ip'],config[_0xeaf4('0x11')]['username'],_0xeaf4('0x12')][_0xeaf4('0x13')]('\x20')));}_0x23e15c=_['pick'](_0x23e15c,_[_0xeaf4('0x14')](properties[_0xeaf4('0x15')]));_0x23e15c[_0xeaf4('0x16')]='Reload';return ami[_0xeaf4('0x17')](_0x23e15c)[_0xeaf4('0x18')](function(_0x575f06){_0x16fa61({'code':0xc8,'message':_0x575f06['message']});})['catch'](function(_0x3b7624){_0x1c8009(_0x4c7af2[_0xeaf4('0x10')](0x1f5,_0x3b7624[_0xeaf4('0x19')]));});});},'Command':function(_0x16ed8e){var _0x549f45=this;return new Promise(function(_0x16e9a6,_0x1feab7){if(ami[_0xeaf4('0xf')]()==![]){return _0x1feab7(_0x549f45[_0xeaf4('0x10')](0x1f4,[config[_0xeaf4('0x11')]['ip'],config['asterisk'][_0xeaf4('0x1a')],_0xeaf4('0x12')][_0xeaf4('0x13')]('\x20')));}_0x16ed8e=_[_0xeaf4('0x1b')](_0x16ed8e,_0xeaf4('0x1c'));_0x16ed8e[_0xeaf4('0x16')]=_0xeaf4('0x1d');return ami[_0xeaf4('0x17')](_0x16ed8e)[_0xeaf4('0x18')](function(_0x120c28){_0x16e9a6({'code':0xc8,'message':_0x120c28[_0xeaf4('0x1e')]});})[_0xeaf4('0x1f')](function(_0x5f1e2b){_0x1feab7(_0x549f45[_0xeaf4('0x10')](0x1f5,_0x5f1e2b[_0xeaf4('0x19')]));});});},'VoiceQueues':function(_0x3c6996){return new Promise(function(_0x1d28cb,_0x16da4d){var _0x59ca97=[];for(var _0x353e1d in _0x4783a4[_0xeaf4('0x20')]){if(_0x4783a4['voiceQueues'][_0xeaf4('0x21')](_0x353e1d)){var _0x12961b=_0x4783a4[_0xeaf4('0x20')][_0x353e1d];var _0x22fd8f={'id':_0x12961b['id'],'name':_0x12961b[_0xeaf4('0x9')],'strategy':_0x12961b[_0xeaf4('0x22')],'answered':_0x12961b[_0xeaf4('0x23')],'available':_0x12961b[_0xeaf4('0x24')],'loggedIn':_0x12961b[_0xeaf4('0x25')],'pTalking':_0x12961b[_0xeaf4('0x26')],'sumBillable':_0x12961b[_0xeaf4('0x27')],'sumDuration':_0x12961b[_0xeaf4('0x28')],'sumHoldTime':_0x12961b['sumHoldTime']||0x0,'talking':_0x12961b[_0xeaf4('0x29')],'total':_0x12961b[_0xeaf4('0x2a')],'type':_0x12961b['type'],'unmanaged':_0x12961b[_0xeaf4('0x2b')],'abandoned':_0x12961b[_0xeaf4('0x2c')],'waiting':_0x12961b[_0xeaf4('0x2d')],'loggedInDb':_0x12961b[_0xeaf4('0x2e')]};if(_0x12961b['type']===_0xeaf4('0x2f')){_0x22fd8f[_0xeaf4('0x30')]=_0x12961b['dialActive'];_0x22fd8f[_0xeaf4('0x31')]=_0x12961b[_0xeaf4('0x31')];_0x22fd8f[_0xeaf4('0x32')]=_0x12961b[_0xeaf4('0x32')];_0x22fd8f['dialOriginateCallerIdNumber']=_0x12961b[_0xeaf4('0x33')];_0x22fd8f[_0xeaf4('0x34')]=_0x12961b[_0xeaf4('0x34')];_0x22fd8f[_0xeaf4('0x35')]=_0x12961b[_0xeaf4('0x35')];_0x22fd8f[_0xeaf4('0x36')]=_0x12961b['temp'];_0x22fd8f['outboundAnswerAgiCallsDay']=_0x12961b[_0xeaf4('0x37')];_0x22fd8f[_0xeaf4('0x38')]=_0x12961b[_0xeaf4('0x38')];_0x22fd8f[_0xeaf4('0x39')]=_0x12961b[_0xeaf4('0x39')];_0x22fd8f[_0xeaf4('0x3a')]=_0x12961b['outboundBusyCallsDay'];_0x22fd8f[_0xeaf4('0x3b')]=_0x12961b[_0xeaf4('0x3b')];_0x22fd8f[_0xeaf4('0x3c')]=_0x12961b[_0xeaf4('0x3c')];_0x22fd8f[_0xeaf4('0x3d')]=_0x12961b['outboundDropCallsDayCallersExit'];_0x22fd8f['outboundDropCallsDayTimeout']=_0x12961b[_0xeaf4('0x3e')];_0x22fd8f[_0xeaf4('0x3f')]=_0x12961b[_0xeaf4('0x3f')];_0x22fd8f[_0xeaf4('0x40')]=_0x12961b[_0xeaf4('0x40')];_0x22fd8f[_0xeaf4('0x41')]=_0x12961b[_0xeaf4('0x41')];_0x22fd8f[_0xeaf4('0x42')]=_0x12961b[_0xeaf4('0x42')];_0x22fd8f[_0xeaf4('0x43')]=_0x12961b['outboundRejectCallsDay'];_0x22fd8f[_0xeaf4('0x44')]=_0x12961b['outboundUnknownCallsDay'];_0x22fd8f[_0xeaf4('0x45')]=_0x12961b[_0xeaf4('0x45')];_0x22fd8f[_0xeaf4('0x46')]=_0x12961b[_0xeaf4('0x46')];_0x22fd8f['predictiveIntervalAvgTalktime']=_0x12961b[_0xeaf4('0x47')];_0x22fd8f[_0xeaf4('0x48')]=_0x12961b[_0xeaf4('0x48')];_0x22fd8f[_0xeaf4('0x49')]=_0x12961b[_0xeaf4('0x49')];_0x22fd8f[_0xeaf4('0x4a')]=_0x12961b[_0xeaf4('0x4a')];_0x22fd8f[_0xeaf4('0x4b')]=_0x12961b['predictiveIntervalErlangCallsDroppedCalls'];_0x22fd8f[_0xeaf4('0x4c')]=_0x12961b[_0xeaf4('0x4c')];_0x22fd8f[_0xeaf4('0x4d')]=_0x12961b[_0xeaf4('0x4d')];_0x22fd8f['predictiveIntervalPauses']=_0x12961b[_0xeaf4('0x4e')];_0x22fd8f[_0xeaf4('0x4f')]=_0x12961b[_0xeaf4('0x4f')];_0x22fd8f[_0xeaf4('0x50')]=_0x12961b[_0xeaf4('0x50')];_0x22fd8f[_0xeaf4('0x19')]=_0x12961b[_0xeaf4('0x19')];_0x22fd8f[_0xeaf4('0x51')]=_0x12961b[_0xeaf4('0x51')];_0x22fd8f['erlangCalls']=_0x12961b[_0xeaf4('0x52')];_0x22fd8f[_0xeaf4('0x53')]=_0x12961b[_0xeaf4('0x53')];_0x22fd8f[_0xeaf4('0x54')]=_0x12961b[_0xeaf4('0x54')];_0x22fd8f[_0xeaf4('0x55')]=_0x12961b[_0xeaf4('0x55')];_0x22fd8f[_0xeaf4('0x56')]=_0x12961b['startPredictive'];_0x22fd8f[_0xeaf4('0x57')]=_0x12961b['startProgressive'];}if(_0x12961b[_0xeaf4('0x58')]){_0x22fd8f[_0xeaf4('0x58')]={'id':_0x12961b[_0xeaf4('0x58')]['id'],'name':_0x12961b[_0xeaf4('0x58')][_0xeaf4('0x9')],'active':_0x12961b['Trunk']['active'],'callerid':_0x12961b[_0xeaf4('0x58')][_0xeaf4('0x59')]};}if(_0x12961b[_0xeaf4('0x5a')]){_0x22fd8f[_0xeaf4('0x5a')]={'id':_0x12961b[_0xeaf4('0x5a')]['id'],'name':_0x12961b[_0xeaf4('0x5a')]['name']};}_0x59ca97[_0xeaf4('0x5b')](_0x22fd8f);}}_0x1d28cb({'count':_0x59ca97[_0xeaf4('0x5c')],'rows':_0x59ca97});});},'UpdateVoiceQueue':function(_0x5df4f0){return new Promise(function(_0x3377aa,_0x7dfe15){var _0x247977=_[_0xeaf4('0x5d')](_0x4783a4['voiceQueues'],{'id':parseInt(_0x5df4f0['id'])});var _0x484fcc=_[_0xeaf4('0x5e')](_0x5df4f0,['id']);if(_0x247977){for(var _0xef4e6d in _0x484fcc){if(typeof _0x484fcc[_0xef4e6d]!==_0xeaf4('0x5f')&&typeof _0x247977[_0xef4e6d]!==_0xeaf4('0x5f')){_0x247977[_0xef4e6d]=_0x484fcc[_0xef4e6d];}}_0x3377aa(_0x247977);}else{_0x7dfe15();}});},'VoiceChannels':function(_0x9f0b2e){return new Promise(function(_0x369e56,_0x38cea6){var _0x3c1206=_[_0xeaf4('0x60')](_0x4783a4[_0xeaf4('0x61')]);_0x369e56({'count':_0x3c1206[_0xeaf4('0x5c')],'rows':_0x3c1206});});},'VoiceChannelMixMonitor':function(_0x337d52){var _0xa941be=this;return new Promise(function(_0x454915,_0x5a6e1e){if(ami[_0xeaf4('0xf')]()==![]){return _0x5a6e1e(_0xa941be[_0xeaf4('0x10')](0x1f4,[config[_0xeaf4('0x11')]['ip'],config['asterisk'][_0xeaf4('0x1a')],_0xeaf4('0x12')]['join']('\x20')));}var _0xcb966f=schema(properties[_0xeaf4('0x62')])[_0xeaf4('0x63')](_0x337d52);if(_0xcb966f[_0xeaf4('0x5c')]>0x0){return _0x5a6e1e(_0xa941be[_0xeaf4('0x10')](0x1f4,_[_0xeaf4('0x64')](_0xcb966f,'message')['join'](',\x20')));}var _0x118dc6=_['find'](_0x4783a4[_0xeaf4('0x61')],{'uniqueid':_0x337d52[_0xeaf4('0x65')]});if(_0x118dc6&&_0x118dc6['channel']){var _0x4ff3f3=util[_0xeaf4('0x7')](_0xeaf4('0x66'),_0x337d52[_0xeaf4('0x67')]||_0x337d52['uniqueid'],_0x337d52[_0xeaf4('0x7')]||'wav');return ami[_0xeaf4('0x17')]({'action':_0xeaf4('0x68'),'channel':_0x118dc6['channel'],'file':_0x4ff3f3,'options':'ai(mixmonitorid)'})[_0xeaf4('0x18')](function(_0x11798e){var _0x23fca2=_[_0xeaf4('0x5d')](_0x118dc6[_0xeaf4('0x69')],{'filename':_0xeaf4('0x6a')+_0x4ff3f3[_0xeaf4('0x6b')]()});if(_[_0xeaf4('0x6c')](_0x23fca2)){_0x118dc6[_0xeaf4('0x69')]['push']({'filename':_0xeaf4('0x6a')+_0x4ff3f3['toLowerCase'](),'createdAt':moment()[_0xeaf4('0x7')](_0xeaf4('0x6d')),'mixmonitorid':_0x11798e[_0xeaf4('0x6e')],'status':'rec'});}else{_0x23fca2[_0xeaf4('0x6e')]=_0x11798e[_0xeaf4('0x6e')];_0x23fca2[_0xeaf4('0x6f')]=_0xeaf4('0x70');}_0x454915({'code':0xc8,'message':[_0x337d52[_0xeaf4('0x65')],'MixMonitor\x20Success',_0x11798e[_0xeaf4('0x6e')]][_0xeaf4('0x13')]('\x20'),'mixmonitorid':_0x11798e[_0xeaf4('0x6e')]});})[_0xeaf4('0x1f')](function(_0x34c73a){_0x5a6e1e(_0xa941be[_0xeaf4('0x10')](0x1f5,[_0x337d52[_0xeaf4('0x65')],_0x34c73a[_0xeaf4('0x19')][_0xeaf4('0x6b')]()][_0xeaf4('0x13')]('\x20')));});}else{return _0x5a6e1e(_0xa941be[_0xeaf4('0x10')](0x1f5,_0xeaf4('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x4716bc){var _0x8864fd=this;return new Promise(function(_0x151c02,_0x1c11d5){if(ami[_0xeaf4('0xf')]()==![]){return _0x1c11d5(_0x8864fd[_0xeaf4('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xeaf4('0x11')][_0xeaf4('0x1a')],_0xeaf4('0x12')][_0xeaf4('0x13')]('\x20')));}var _0x1baeaf=schema(properties['voicechannel'])[_0xeaf4('0x63')](_0x4716bc);if(_0x1baeaf['length']>0x0){return _0x1c11d5(_0x8864fd['error'](0x1f4,_[_0xeaf4('0x64')](_0x1baeaf,'message')[_0xeaf4('0x13')](',\x20')));}var _0x3533e4=_[_0xeaf4('0x5d')](_0x4783a4[_0xeaf4('0x61')],{'uniqueid':_0x4716bc[_0xeaf4('0x65')]});if(_0x3533e4){return BPromise[_0xeaf4('0x72')]()['then'](function(){if(_0x3533e4['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x3533e4['channel'],'mixmonitorid':_0x4716bc['mixmonitorid']})[_0xeaf4('0x1f')](function(_0x55f269){});}})['then'](function(){if(_0x3533e4[_0xeaf4('0x73')]){return ami[_0xeaf4('0x17')]({'action':_0xeaf4('0x74'),'channel':_0x3533e4['destinationchannel'],'mixmonitorid':_0x4716bc[_0xeaf4('0x6e')]})[_0xeaf4('0x1f')](function(_0x40afa3){});}})[_0xeaf4('0x18')](function(_0x653ea6){var _0x10b6d8=_[_0xeaf4('0x5d')](_0x3533e4['monitors'],{'mixmonitorid':_0x4716bc['mixmonitorid']});if(_0x10b6d8){_0x10b6d8[_0xeaf4('0x6f')]=_0xeaf4('0x75');}})[_0xeaf4('0x18')](function(){var _0xa8b31=util[_0xeaf4('0x7')](_0xeaf4('0x66'),_0x4716bc['filename']||_0x4716bc['uniqueid'],_0x4716bc[_0xeaf4('0x7')]||_0xeaf4('0x76'));var _0x465774=_[_0xeaf4('0x5d')](_0x3533e4[_0xeaf4('0x69')],{'filename':_0xeaf4('0x6a')+_0xa8b31[_0xeaf4('0x6b')]()});if(_0x465774){_0x465774[_0xeaf4('0x6f')]=_0xeaf4('0x75');}})[_0xeaf4('0x18')](function(){_0x151c02({'code':0xc8,'message':[_0x4716bc[_0xeaf4('0x65')],_0xeaf4('0x77')][_0xeaf4('0x13')]('\x20')});})[_0xeaf4('0x1f')](function(_0xd6baf9){_0x1c11d5(_0x8864fd['error'](0x1f5,[_0x4716bc['uniqueid'],_0xd6baf9[_0xeaf4('0x19')][_0xeaf4('0x6b')]()][_0xeaf4('0x13')]('\x20')));});}else{return _0x1c11d5(_0x8864fd[_0xeaf4('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x23361d){return new Promise(function(_0x2a2293,_0x16120d){var _0x4eb6e0=_[_0xeaf4('0x60')](_0x4783a4['queueChannels']);_0x2a2293({'count':_0x4eb6e0[_0xeaf4('0x5c')],'rows':_0x4eb6e0});});},'VoiceQueuesChannel':function(_0x40ee17){var _0x5f2226=this;return new Promise(function(_0x32dfb9,_0x35a972){var _0x3550a8=schema(properties[_0xeaf4('0x78')])[_0xeaf4('0x63')](_0x40ee17);if(_0x3550a8[_0xeaf4('0x5c')]>0x0){return _0x35a972(_0x5f2226['error'](0x1f4,_[_0xeaf4('0x64')](_0x3550a8,_0xeaf4('0x19'))[_0xeaf4('0x13')](',\x20')));}var _0x20d857=_['find'](_0x4783a4[_0xeaf4('0x79')],{'uniqueid':_0x40ee17[_0xeaf4('0x65')]});if(_0x20d857){_0x32dfb9(_0x20d857);}else{return _0x35a972(_0x5f2226[_0xeaf4('0x10')](0x1f5,_0xeaf4('0x71')));}});},'VoiceQueuesChannelHangup':function(_0xc3418f){var _0x17bb69=this;return new Promise(function(_0x25d880,_0x52e8be){if(ami[_0xeaf4('0xf')]()==![]){return _0x52e8be(_0x17bb69['error'](0x1f4,[config['asterisk']['ip'],config[_0xeaf4('0x11')][_0xeaf4('0x1a')],_0xeaf4('0x12')]['join']('\x20')));}var _0x58d53c=schema(properties[_0xeaf4('0x7a')])[_0xeaf4('0x63')](_0xc3418f);if(_0x58d53c['length']>0x0){return _0x52e8be(_0x17bb69['error'](0x1f4,_['map'](_0x58d53c,_0xeaf4('0x19'))['join'](',\x20')));}var _0x2fb126=_['find'](_0x4783a4[_0xeaf4('0x79')],{'uniqueid':_0xc3418f['uniqueid']});if(_0x2fb126&&_0x2fb126['channel']){return ami[_0xeaf4('0x17')]({'action':_0xeaf4('0x7b'),'channel':_0x2fb126['channel']})[_0xeaf4('0x18')](function(_0x565ebd){_0x25d880({'code':0xc8,'message':[_0xc3418f[_0xeaf4('0x65')],_0x565ebd['message'][_0xeaf4('0x6b')]()]['join']('\x20')});})[_0xeaf4('0x1f')](function(_0x9fdab7){_0x52e8be(_0x17bb69[_0xeaf4('0x10')](0x1f5,[_0xc3418f[_0xeaf4('0x65')],_0x9fdab7['message'][_0xeaf4('0x6b')]()][_0xeaf4('0x13')]('\x20')));});}else{return _0x52e8be(_0x17bb69[_0xeaf4('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3f18ef){var _0x4f8e5e=this;return new Promise(function(_0x5e495d,_0x5f2abd){if(ami['isConnected']()==![]){return _0x5f2abd(_0x4f8e5e[_0xeaf4('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xeaf4('0x11')][_0xeaf4('0x1a')],_0xeaf4('0x12')]['join']('\x20')));}var _0x457e03=schema(properties[_0xeaf4('0x7c')])['validate'](_0x3f18ef);if(_0x457e03[_0xeaf4('0x5c')]>0x0){return _0x5f2abd(_0x4f8e5e[_0xeaf4('0x10')](0x1f4,_['map'](_0x457e03,_0xeaf4('0x19'))[_0xeaf4('0x13')](',\x20')));}var _0x5305d7=_[_0xeaf4('0x5d')](_0x4783a4['queueChannels'],{'uniqueid':_0x3f18ef[_0xeaf4('0x65')]});if(_0x5305d7&&_0x5305d7[_0xeaf4('0x7d')]){return ami[_0xeaf4('0x17')]({'action':_0xeaf4('0x7e'),'channel':_0x5305d7[_0xeaf4('0x7d')],'exten':_0x3f18ef[_0xeaf4('0x7f')],'context':_0x3f18ef[_0xeaf4('0x80')]||_0x5305d7[_0xeaf4('0x80')],'priority':0x1})['then'](function(_0xcfeec8){_0x5e495d({'code':0xc8,'message':[_0x3f18ef[_0xeaf4('0x65')],_0xcfeec8[_0xeaf4('0x19')][_0xeaf4('0x6b')]()][_0xeaf4('0x13')]('\x20')});})[_0xeaf4('0x1f')](function(_0x706b32){_0x5f2abd(_0x4f8e5e['error'](0x1f5,[_0x3f18ef['uniqueid'],_0x706b32[_0xeaf4('0x19')][_0xeaf4('0x6b')]()]['join']('\x20')));});}else{return _0x5f2abd(_0x4f8e5e[_0xeaf4('0x10')](0x1f5,_0xeaf4('0x71')));}});},'Agents':function(_0x16f7be){return new Promise(function(_0x3dcbee,_0x45fe71){var _0xa4ddbd=_[_0xeaf4('0x60')](_0x4783a4[_0xeaf4('0xc')]);_0x3dcbee({'count':_0xa4ddbd[_0xeaf4('0x5c')],'rows':_0xa4ddbd});});},'Telephones':function(_0x598888){return new Promise(function(_0x30fe65,_0x1c74af){var _0x48a4d4=_[_0xeaf4('0x60')](_0x4783a4[_0xeaf4('0x81')]);_0x30fe65({'count':_0x48a4d4[_0xeaf4('0x5c')],'rows':_0x48a4d4});});},'Trunks':function(_0x1ace17){return new Promise(function(_0x48c55d,_0x4ae1c1){var _0x309953=_[_0xeaf4('0x60')](_0x4783a4[_0xeaf4('0x82')]);_0x48c55d({'count':_0x309953[_0xeaf4('0x5c')],'rows':_0x309953});});},'OutboundChannels':function(_0x4ed6d8){return new Promise(function(_0x4a0a41,_0x51cf28){var _0xf1151f=_[_0xeaf4('0x60')](_0x4783a4[_0xeaf4('0x83')]);_0x4a0a41({'count':_0xf1151f[_0xeaf4('0x5c')],'rows':_0xf1151f});});},'Outbound':function(_0x189f03){return new Promise(function(_0x30b06b,_0x5f1c44){_0x30b06b(_0x4783a4[_0xeaf4('0x2f')]);});},'Campaigns':function(_0x10ef68){return new Promise(function(_0x16cac6,_0x522458){var _0x2cfed7=_[_0xeaf4('0x60')](_0x4783a4[_0xeaf4('0x84')]);_0x16cac6({'count':_0x2cfed7['length'],'rows':_0x2cfed7});});},'VoiceQueuesPreview':function(_0x141db0){var _0x3ed4f1=this;return new Promise(function(_0x46d671,_0x5d35c9){_0x585aea[_0xeaf4('0x85')](_0x141db0['id'])[_0xeaf4('0x18')](function(_0x29d7de){_0x46d671({'code':0xc8,'message':_0x29d7de['message']});})[_0xeaf4('0x1f')](function(_0x3db466){_0x5d35c9(_0x3ed4f1[_0xeaf4('0x10')](0x1f4,_0x3db466['message']));});});},'EventManager':function(_0x3b3b48){var _0x57cd9c=this;return new Promise(function(_0x521931,_0x2cdce8){if(!_0x3b3b48[_0xeaf4('0x86')]){return _0x2cdce8(_0x57cd9c[_0xeaf4('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xeaf4('0x87')](_0xeaf4('0x88')+_0x3b3b48[_0xeaf4('0x86')],_0x3b3b48['message']);_0x521931({'code':0xc8,'message':_0x3b3b48});});},'FaxAccounts':function(_0x245990){return new Promise(function(_0x44d096,_0x4aaac9){var _0x289258=_[_0xeaf4('0x60')](_0x4783a4[_0xeaf4('0x89')]);_0x44d096({'count':_0x289258['length'],'rows':_0x289258});});},'SendFax':function(_0xd047e8){var _0xea5c0d=this;return new Promise(function(_0x2225a6,_0x1ab0cf){_0x1af6a0['send'](_0xd047e8)[_0xeaf4('0x18')](function(_0x5f4f14){_0x2225a6({'code':0xc8,'message':_0x5f4f14['message']});})['catch'](function(_0x2ecd3b){_0x1ab0cf(_0xea5c0d[_0xeaf4('0x10')](0x1f4,_0x2ecd3b['message']));});});},'CheckAfterSend':function(_0x211ecc){var _0xf29a2=this;return new Promise(function(_0x220864,_0x23ce48){_0x1af6a0[_0xeaf4('0x8a')](_0x211ecc)[_0xeaf4('0x18')](function(_0x38c648){_0x220864({'code':0xc8,'message':_0x38c648[_0xeaf4('0x19')]});})[_0xeaf4('0x1f')](function(_0x404549){_0x23ce48(_0xf29a2[_0xeaf4('0x10')](0x1f4,_0x404549['message']));});});}};var _0x5cf9fd=jayson[_0xeaf4('0x8b')](_0x8fac25)['http']();_0x5cf9fd['on'](_0xeaf4('0x10'),function(_0x4ee2e3){return _0x49ea71(_0x4ee2e3);});_0x5cf9fd[_0xeaf4('0x6')](0x232a,_0xeaf4('0x8c'),function(){console[_0xeaf4('0x8d')](_0xeaf4('0x8e'),0x232a);return _0x5d08d7(_0xeaf4('0x8f')+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 8ca153f..2bead9e 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 _0xba18=['calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','lastName','mobile','fax','scheduledAt','updatedAt','then','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','firstName'];(function(_0xe7bbe1,_0x48a8d8){var _0x15accf=function(_0x5c390d){while(--_0x5c390d){_0xe7bbe1['push'](_0xe7bbe1['shift']());}};_0x15accf(++_0x48a8d8);}(_0xba18,0x79));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var BPromise=require(_0x8ba1('0x1'));var Redis=require(_0x8ba1('0x2'));var util=require(_0x8ba1('0x3'));var config=require(_0x8ba1('0x4'));var logger=require(_0x8ba1('0x5'))('trigger');var cmContactRpc=require(_0x8ba1('0x6'));config[_0x8ba1('0x7')]=_[_0x8ba1('0x8')](config[_0x8ba1('0x7')],{'host':_0x8ba1('0x9'),'port':0x18eb});var io=require(_0x8ba1('0xa'))(new Redis(config['redis']));function emit(_0x4d96bc,_0x594730,_0x117a04,_0x2d92f5,_0x4d1e1e){logger[_0x8ba1('0xb')](_0x8ba1('0xc'),_0x4d96bc,_0x594730['id'],_0x117a04,_0x2d92f5,JSON[_0x8ba1('0xd')](_0x4d1e1e));io['to'](_0x117a04)[_0x8ba1('0xe')](_0x2d92f5,_0x4d1e1e);}exports[_0x8ba1('0xf')]=function(_0x2851cd,_0x46682a,_0x2ddfe8,_0x1fb04e){var _0x1f1512,_0x5d1b36;var _0x44b714={};var _0x544075=Number(_0x2ddfe8['data1']);var _0x1e0d07=_0x2ddfe8[_0x8ba1('0x10')]?Boolean(Number(_0x2ddfe8[_0x8ba1('0x10')])):![];var _0x3ec35f;if(_0x1fb04e[_0x8ba1('0x11')]){_0x44b714['id']=_0x1fb04e[_0x8ba1('0x11')];}if(!_0x44b714['id']){_0x44b714[_0x8ba1('0x12')]=_0x544075;_0x3ec35f=_0x2ddfe8[_0x8ba1('0x13')]&&_0x2ddfe8[_0x8ba1('0x13')]!=='0'?_0x2ddfe8[_0x8ba1('0x13')][_0x8ba1('0x14')](','):[_0x8ba1('0x15')];_0x44b714['$or']=_[_0x8ba1('0x16')](_0x3ec35f,function(_0x2f0b69){var _0x2857ce={};_0x2857ce[_0x2f0b69]=_0x1fb04e[_0x8ba1('0x17')]?_0x1fb04e[_0x8ba1('0x18')]:_0x1fb04e['calleridnum'];return _0x2857ce;});}var _0x4eaba9=['id','firstName',_0x8ba1('0x19'),_0x8ba1('0x15'),_0x8ba1('0x1a'),_0x8ba1('0x1b'),_0x8ba1('0x12'),'createdAt',_0x8ba1('0x1c'),_0x8ba1('0x1d')];var _0x27e2cb=_['union'](_0x4eaba9,_0x3ec35f);BPromise['resolve']()[_0x8ba1('0x1e')](cmContactRpc[_0x8ba1('0x1f')]({'attributes':_0x27e2cb,'where':_0x44b714}))['then'](function(_0x273444){_0x5d1b36=_0x273444;if(!_[_0x8ba1('0x20')](_0x5d1b36)){if(_0x5d1b36[_0x8ba1('0x21')]===0x1){_0x1f1512=_0x5d1b36[0x0];logger[_0x8ba1('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1fb04e['uniqueid'],_0x46682a['id'],_0x1f1512['id']);}else{logger[_0x8ba1('0xb')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1fb04e[_0x8ba1('0x22')],_0x46682a['id'],_[_0x8ba1('0x16')](_0x5d1b36,'id')['join'](','));}return;}else{logger[_0x8ba1('0xb')](_0x8ba1('0x23'),_0x1fb04e[_0x8ba1('0x22')],_0x46682a['id']);var _0x1cd57b={'ListId':_0x544075};var _0x1e621e=_0x2ddfe8[_0x8ba1('0x24')]&&_0x2ddfe8[_0x8ba1('0x24')]!=='0'?_0x2ddfe8[_0x8ba1('0x24')]:_0x8ba1('0x15');if(_0x1e0d07){logger[_0x8ba1('0xb')](_0x8ba1('0x25'),_0x1fb04e['uniqueid'],_0x46682a['id']);_0x1cd57b[_0x1e621e]=_[_0x8ba1('0x26')](_0x1fb04e['routeId'])?_0x1fb04e[_0x8ba1('0x27')]:_0x1fb04e['destcalleridnum'];if(_['isNil'](_0x1fb04e['routeId'])){_0x1cd57b[_0x8ba1('0x28')]=_0x1fb04e[_0x8ba1('0x29')]&&_0x1fb04e[_0x8ba1('0x29')]!==_0x8ba1('0x2a')?_0x1fb04e[_0x8ba1('0x29')]:'Unknown';}else{_0x1cd57b[_0x8ba1('0x28')]=_0x1fb04e[_0x8ba1('0x2b')]&&_0x1fb04e[_0x8ba1('0x2b')]!==_0x8ba1('0x2a')?_0x1fb04e[_0x8ba1('0x2b')]:_0x8ba1('0x2c');}return BPromise['resolve']()[_0x8ba1('0x1e')](cmContactRpc[_0x8ba1('0x2d')](_0x1cd57b))['then'](function(_0x9a9a82){_0x1f1512=_0x9a9a82;_0x5d1b36[_0x8ba1('0x2e')](_0x9a9a82);if(_0x1f1512){logger[_0x8ba1('0xb')](_0x8ba1('0x2f'),_0x1fb04e[_0x8ba1('0x22')],_0x46682a['id'],_0x1f1512['id']);}return;});}else{logger[_0x8ba1('0xb')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x1fb04e[_0x8ba1('0x22')],_0x46682a['id']);_0x1cd57b[_0x1e621e]=_['isNil'](_0x1fb04e[_0x8ba1('0x17')])?_0x1fb04e[_0x8ba1('0x27')]:_0x1fb04e[_0x8ba1('0x18')];if(_[_0x8ba1('0x26')](_0x1fb04e['routeId'])){_0x1cd57b[_0x8ba1('0x28')]=_0x1fb04e[_0x8ba1('0x29')]&&_0x1fb04e[_0x8ba1('0x29')]!==_0x8ba1('0x2a')?_0x1fb04e['calleridname']:_0x8ba1('0x2c');}else{_0x1cd57b[_0x8ba1('0x28')]=_0x1fb04e['destcalleridname']&&_0x1fb04e[_0x8ba1('0x2b')]!==_0x8ba1('0x2a')?_0x1fb04e[_0x8ba1('0x2b')]:'Unknown';}_0x1f1512=_0x1cd57b;_0x5d1b36[_0x8ba1('0x2e')](_0x1cd57b);return;}}})['then'](function(){if(_0x2851cd){emit(_0x1fb04e[_0x8ba1('0x22')],_0x46682a,util[_0x8ba1('0x30')](_0x8ba1('0x31'),_0x2851cd['name']),util[_0x8ba1('0x30')](_0x8ba1('0x32'),_0x2ddfe8[_0x8ba1('0x33')][_0x8ba1('0x34')]()),{'evt':_[_0x8ba1('0x35')](_0x1fb04e,{'autoCreate':_0x1e0d07}),'contact':_0x1f1512===undefined?{}:_0x1f1512,'contacts':_0x5d1b36['length']===0x0?undefined:_0x5d1b36});}});}; \ No newline at end of file +var _0x4c0c=['trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data2','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format'];(function(_0x5b9a34,_0xbcbec0){var _0x274428=function(_0x449961){while(--_0x449961){_0x5b9a34['push'](_0x5b9a34['shift']());}};_0x274428(++_0xbcbec0);}(_0x4c0c,0x72));var _0xc4c0=function(_0x4c8232,_0x4e0dea){_0x4c8232=_0x4c8232-0x0;var _0x3cc8e5=_0x4c0c[_0x4c8232];return _0x3cc8e5;};'use strict';var _=require(_0xc4c0('0x0'));var BPromise=require('bluebird');var Redis=require(_0xc4c0('0x1'));var util=require(_0xc4c0('0x2'));var config=require(_0xc4c0('0x3'));var logger=require(_0xc4c0('0x4'))(_0xc4c0('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0xc4c0('0x6')]=_[_0xc4c0('0x7')](config['redis'],{'host':_0xc4c0('0x8'),'port':0x18eb});var io=require(_0xc4c0('0x9'))(new Redis(config['redis']));function emit(_0x5b5746,_0x1bd120,_0x34fc67,_0xdc3ca9,_0x152e9a){logger[_0xc4c0('0xa')](_0xc4c0('0xb'),_0x5b5746,_0x1bd120['id'],_0x34fc67,_0xdc3ca9,JSON[_0xc4c0('0xc')](_0x152e9a));io['to'](_0x34fc67)[_0xc4c0('0xd')](_0xdc3ca9,_0x152e9a);}exports['exec']=function(_0x4bf0bc,_0x4c4a09,_0x3f289b,_0x44eb88){var _0x44c579,_0x24a4a0;var _0x2bb4d6={};var _0x442d68=Number(_0x3f289b['data1']);var _0xa451e2=_0x3f289b[_0xc4c0('0xe')]?Boolean(Number(_0x3f289b[_0xc4c0('0xe')])):![];var _0xdb53f3;if(_0x44eb88['xmd-contactid']){_0x2bb4d6['id']=_0x44eb88['xmd-contactid'];}if(!_0x2bb4d6['id']){_0x2bb4d6[_0xc4c0('0xf')]=_0x442d68;_0xdb53f3=_0x3f289b[_0xc4c0('0x10')]&&_0x3f289b['data3']!=='0'?_0x3f289b[_0xc4c0('0x10')][_0xc4c0('0x11')](','):[_0xc4c0('0x12')];_0x2bb4d6[_0xc4c0('0x13')]=_[_0xc4c0('0x14')](_0xdb53f3,function(_0x3a5814){var _0x1f5d97={};_0x1f5d97[_0x3a5814]=_0x44eb88[_0xc4c0('0x15')]?_0x44eb88[_0xc4c0('0x16')]:_0x44eb88[_0xc4c0('0x17')];return _0x1f5d97;});}var _0x399486=['id',_0xc4c0('0x18'),'lastName',_0xc4c0('0x12'),'mobile',_0xc4c0('0x19'),_0xc4c0('0xf'),_0xc4c0('0x1a'),_0xc4c0('0x1b'),_0xc4c0('0x1c')];var _0x45a8fd=_[_0xc4c0('0x1d')](_0x399486,_0xdb53f3);BPromise[_0xc4c0('0x1e')]()[_0xc4c0('0x1f')](cmContactRpc[_0xc4c0('0x20')]({'attributes':_0x45a8fd,'where':_0x2bb4d6}))[_0xc4c0('0x1f')](function(_0x1a7ca8){_0x24a4a0=_0x1a7ca8;if(!_['isEmpty'](_0x24a4a0)){if(_0x24a4a0[_0xc4c0('0x21')]===0x1){_0x44c579=_0x24a4a0[0x0];logger[_0xc4c0('0xa')](_0xc4c0('0x22'),_0x44eb88[_0xc4c0('0x23')],_0x4c4a09['id'],_0x44c579['id']);}else{logger[_0xc4c0('0xa')](_0xc4c0('0x24'),_0x44eb88['uniqueid'],_0x4c4a09['id'],_[_0xc4c0('0x14')](_0x24a4a0,'id')[_0xc4c0('0x25')](','));}return;}else{logger[_0xc4c0('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x44eb88['uniqueid'],_0x4c4a09['id']);var _0x531ce7={'ListId':_0x442d68};var _0xbf143a=_0x3f289b[_0xc4c0('0x26')]&&_0x3f289b['data4']!=='0'?_0x3f289b[_0xc4c0('0x26')]:'phone';if(_0xa451e2){logger[_0xc4c0('0xa')](_0xc4c0('0x27'),_0x44eb88['uniqueid'],_0x4c4a09['id']);_0x531ce7[_0xbf143a]=_[_0xc4c0('0x28')](_0x44eb88[_0xc4c0('0x15')])?_0x44eb88['calleridnum']:_0x44eb88[_0xc4c0('0x16')];if(_['isNil'](_0x44eb88[_0xc4c0('0x15')])){_0x531ce7[_0xc4c0('0x18')]=_0x44eb88[_0xc4c0('0x29')]&&_0x44eb88[_0xc4c0('0x29')]!==_0xc4c0('0x2a')?_0x44eb88['calleridname']:_0xc4c0('0x2b');}else{_0x531ce7[_0xc4c0('0x18')]=_0x44eb88[_0xc4c0('0x2c')]&&_0x44eb88[_0xc4c0('0x2c')]!==_0xc4c0('0x2a')?_0x44eb88[_0xc4c0('0x2c')]:'Unknown';}return BPromise[_0xc4c0('0x1e')]()[_0xc4c0('0x1f')](cmContactRpc['createContact'](_0x531ce7))[_0xc4c0('0x1f')](function(_0x2493ff){_0x44c579=_0x2493ff;_0x24a4a0[_0xc4c0('0x2d')](_0x2493ff);if(_0x44c579){logger[_0xc4c0('0xa')](_0xc4c0('0x2e'),_0x44eb88[_0xc4c0('0x23')],_0x4c4a09['id'],_0x44c579['id']);}return;});}else{logger['info'](_0xc4c0('0x2f'),_0x44eb88[_0xc4c0('0x23')],_0x4c4a09['id']);_0x531ce7[_0xbf143a]=_['isNil'](_0x44eb88[_0xc4c0('0x15')])?_0x44eb88['calleridnum']:_0x44eb88[_0xc4c0('0x16')];if(_[_0xc4c0('0x28')](_0x44eb88['routeId'])){_0x531ce7['firstName']=_0x44eb88[_0xc4c0('0x29')]&&_0x44eb88[_0xc4c0('0x29')]!==''?_0x44eb88[_0xc4c0('0x29')]:_0xc4c0('0x2b');}else{_0x531ce7[_0xc4c0('0x18')]=_0x44eb88['destcalleridname']&&_0x44eb88[_0xc4c0('0x2c')]!==_0xc4c0('0x2a')?_0x44eb88[_0xc4c0('0x2c')]:_0xc4c0('0x2b');}_0x44c579=_0x531ce7;_0x24a4a0['push'](_0x531ce7);return;}}})[_0xc4c0('0x1f')](function(){if(_0x4bf0bc){emit(_0x44eb88[_0xc4c0('0x23')],_0x4c4a09,util['format'](_0xc4c0('0x30'),_0x4bf0bc[_0xc4c0('0x31')]),util[_0xc4c0('0x32')](_0xc4c0('0x33'),_0x3f289b[_0xc4c0('0x34')][_0xc4c0('0x35')]()),{'evt':_[_0xc4c0('0x36')](_0x44eb88,{'autoCreate':_0xa451e2}),'contact':_0x44c579===undefined?{}:_0x44c579,'contacts':_0x24a4a0[_0xc4c0('0x21')]===0x0?undefined:_0x24a4a0});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 4bff486..694bd1f 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 _0x703e=['ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','util','lodash','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/logger','trigger','../ami','redis','localhost','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','accounts','dynamics365Accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','info','stringify','emit','prototype','checkTriggers','hasOwnProperty','status','checkTrigger','merge','Actions','length','action','contactmanager','browser','popup','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','winApplication','winArguments','format','trigger:%s:%s','toLowerCase','data1','jscripty','user:%s','interface','name','trigger:%s','exec','integration','queue','routeId','urlforward','query','replace','AllConditions','every','channel','AnyConditions','checkConditions','field'];(function(_0x46d2a4,_0x57991c){var _0x4c1a03=function(_0x37ffd3){while(--_0x37ffd3){_0x46d2a4['push'](_0x46d2a4['shift']());}};_0x4c1a03(++_0x57991c);}(_0x703e,0x7b));var _0xe703=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x703e[_0x1035c1];return _0x308d67;};'use strict';var util=require(_0xe703('0x0'));var _=require(_0xe703('0x1'));var url=require('url');var Mustache=require(_0xe703('0x2'));var Redis=require(_0xe703('0x3'));var urlforward=require(_0xe703('0x4'));var integration=require('./integration');var cmContact=require(_0xe703('0x5'));var script=require(_0xe703('0x6'));var config=require('../../../config/environment');var logger=require(_0xe703('0x7'))(_0xe703('0x8'));var ami=require(_0xe703('0x9'));config[_0xe703('0xa')]=_['defaults'](config[_0xe703('0xa')],{'host':_0xe703('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe703('0xa')]));var operators={'equals':function(_0x5e3160,_0x1ecf6d){return _0x5e3160==_0x1ecf6d;},'not_equals':function(_0x57ccfb,_0x1a0e7e){return _0x57ccfb!=_0x1a0e7e;}};var barAndWebActions=['popup',_0xe703('0xc'),_0xe703('0xd')];function Trigger(_0x470d23){this[_0xe703('0xe')]=_0x470d23[_0xe703('0xe')];this[_0xe703('0xf')]=_0x470d23['agents'];this[_0xe703('0x10')]=_0x470d23[_0xe703('0x10')];this['templates']=_0x470d23[_0xe703('0x11')];this['voiceExtensions']=_0x470d23[_0xe703('0x12')];this[_0xe703('0x13')]=_0x470d23[_0xe703('0x13')];this[_0xe703('0x14')]=_0x470d23[_0xe703('0x14')];this[_0xe703('0x15')]=_0x470d23[_0xe703('0x15')];this['sugarcrmAccounts']=_0x470d23[_0xe703('0x16')];this['zohoAccounts']=_0x470d23[_0xe703('0x17')];this['deskAccounts']=_0x470d23[_0xe703('0x18')];this[_0xe703('0x19')]=_0x470d23[_0xe703('0x19')];this[_0xe703('0x1a')]=_0x470d23['servicenowAccounts'];this['dynamics365Accounts']=_0x470d23['dynamics365Accounts'];this['freshsalesAccounts']=_0x470d23['freshsalesAccounts'];this[_0xe703('0x1b')]={'zendesk':this[_0xe703('0x13')],'salesforce':this[_0xe703('0x15')],'freshdesk':this[_0xe703('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xe703('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0xe703('0x19')],'dynamics365':this[_0xe703('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xe703('0x1a')]};ami['on'](_0xe703('0x1d'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x20'),this['syncCustomEvent'][_0xe703('0x1f')](this));ami['on'](_0xe703('0x21'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x22'),this['syncCustomEvent'][_0xe703('0x1f')](this));ami['on'](_0xe703('0x23'),this['syncCustomEvent'][_0xe703('0x1f')](this));ami['on'](_0xe703('0x24'),this['syncCustomEvent'][_0xe703('0x1f')](this));ami['on'](_0xe703('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe703('0x26'),this['syncCustomEvent'][_0xe703('0x1f')](this));ami['on'](_0xe703('0x27'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on']('custom:amd',this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x28'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on']('custom:timeout',this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on']('custom:dialbegin',this['syncAgentDial'][_0xe703('0x1f')](this));ami['on']('custom:dialconnect',this[_0xe703('0x29')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x2a'),this[_0xe703('0x29')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x2b'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x2c'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x2d'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x2e'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));ami['on'](_0xe703('0x2f'),this['syncCustomEvent'][_0xe703('0x1f')](this));ami['on'](_0xe703('0x30'),this[_0xe703('0x1e')][_0xe703('0x1f')](this));}Trigger['prototype']['emit']=function(_0x21eaba,_0x39f7c9,_0x39a34b){logger[_0xe703('0x31')](_0x21eaba,_0x39f7c9,JSON[_0xe703('0x32')](_0x39a34b));io['to'](_0x21eaba)[_0xe703('0x33')](_0x39f7c9,_0x39a34b);};Trigger[_0xe703('0x34')][_0xe703('0x1e')]=function(_0x2a7a17){var _0x5ef79b=_['clone'](_0x2a7a17);this['checkTriggers'](_0x5ef79b);};Trigger[_0xe703('0x34')][_0xe703('0x29')]=function(_0x2508b3){if(this['agents'][_0x2508b3['interface']]){this[_0xe703('0x1e')](_0x2508b3);}};Trigger[_0xe703('0x34')][_0xe703('0x35')]=function(_0x2e8e08){var _0xa3ed49;for(var _0x5beda8 in this[_0xe703('0xe')]){if(this['triggers'][_0xe703('0x36')](_0x5beda8)){if(this[_0xe703('0xe')][_0x5beda8][_0xe703('0x37')]){_0xa3ed49=this[_0xe703('0x38')](this[_0xe703('0xe')][_0x5beda8],_0x2e8e08);if(_0xa3ed49){_[_0xe703('0x39')](_0x2e8e08,_0x2e8e08['variables']);for(var _0x2d6e9a=0x0,_0x550578,_0x8d4152,_0x33d621;_0x2d6e9a0x0){_0x349aa8=_[_0x10bd('0x2a')](_0xd108b8,_0x301e65);}return _0x349aa8;}function getCustomFields(_0x1fd7ed,_0xc77643){var _0xac83a2=[];var _0x19cc9a={'custom_fields':{}};if(_0x1fd7ed[_0x10bd('0x29')]>0x0){_[_0x10bd('0x2b')](_0x1fd7ed,function(_0x283188){if(_[_0x10bd('0x2c')]([_0x10bd('0x2d'),_0x10bd('0x2e')],_0x283188[_0x10bd('0x2f')])&&_0x283188[_0x10bd('0x30')]&&!_0x283188[_0x10bd('0x31')]){_0x19cc9a[_0x283188[_0x10bd('0x30')][_0x10bd('0x32')]()]=_0x283188[_0x10bd('0x33')]['toString']();}else if(_[_0x10bd('0x2c')]([_0x10bd('0x2d'),_0x10bd('0x2e')],_0x283188[_0x10bd('0x2f')])&&_0x283188[_0x10bd('0x34')]&&_0x283188[_0x10bd('0x31')]){_0x19cc9a['custom_fields'][_0x283188[_0x10bd('0x34')]]=_0x283188[_0x10bd('0x33')][_0x10bd('0x21')]();}else if(_0x283188[_0x10bd('0x2f')]===_0x10bd('0x35')&&_0x283188['variableName']&&_0x283188['idField']&&_0x283188[_0x10bd('0x31')]){_0xc77643[_0x283188[_0x10bd('0x36')]]&&(_0x19cc9a[_0x10bd('0x37')][_0x283188[_0x10bd('0x34')]]=_0xc77643[_0x283188[_0x10bd('0x36')]]['toString']());}else if(_0x283188[_0x10bd('0x2f')]===_0x10bd('0x38')&&_0x283188[_0x10bd('0x39')]&&_0x283188[_0x10bd('0x39')][_0x10bd('0x3a')]&&_0x283188[_0x10bd('0x34')]&&_0x283188[_0x10bd('0x31')]){_0xc77643[_0x283188[_0x10bd('0x39')]['name'][_0x10bd('0x32')]()]&&(_0x19cc9a[_0x10bd('0x37')][_0x283188['idField']]=_0xc77643[_0x283188[_0x10bd('0x39')][_0x10bd('0x3a')]['toLowerCase']()][_0x10bd('0x21')]());}});}if(_0x19cc9a[_0x10bd('0x3b')]){_0x19cc9a[_0x10bd('0x3b')]=Number(_0x19cc9a['priority']);}return _0x19cc9a;}function getTicket(_0x267542,_0x363329,_0xc56f55,_0x3313d8,_0x42469d){logger['info'](_0x10bd('0x3c'));var _0x49a918=_[_0x10bd('0x3d')]({'subject':intUtil[_0x10bd('0x3e')](_0x3313d8['Subjects'],_0x42469d,'\x20'),'type':'phone','status':'new','labels':[_0x10bd('0x3f'),'Motion',_0x10bd('0x40')][_0x10bd('0x41')](getTags(_0x3313d8[_0x10bd('0x42')],_0x10bd('0x3a'))),'description':intUtil['getString'](_0x3313d8[_0x10bd('0x43')],_0x42469d,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x10bd('0x44'),_0x363329['id']),'class':_0x10bd('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x3313d8[_0x10bd('0x43')],_0x42469d,'\x0a')}},getCustomFields(_0x3313d8['Fields'],_0x42469d));return request({'uri':util['format']('%s/customers/%d/cases',_0x267542['remoteUri'],_0xc56f55['id']),'method':_0x10bd('0x28'),'body':_0x49a918});}exports['queue']=function(_0x5ec129,_0x111fd9,_0x10e94b,_0x3b2cf9,_0x376985,_0x1dd8ee){var _0x455fd9,_0x30da8a;_0x1dd8ee[_0x10bd('0xc')]=intUtil[_0x10bd('0x46')](_0x1dd8ee[_0x10bd('0xc')]);_0x1dd8ee['serverUrl']=intUtil[_0x10bd('0x46')](_0x1dd8ee['serverUrl']);if(_0x376985&&_0x376985[_0x10bd('0x47')]){logger[_0x10bd('0x11')](_0x10bd('0x48'),_0x10bd('0x49'));_0x111fd9[_0x10bd('0x4a')]=util[_0x10bd('0x13')](_0x10bd('0x4b'),_0x1dd8ee[_0x10bd('0x4c')],_0x111fd9[_0x10bd('0x4d')],md5(_0x111fd9[_0x10bd('0x4d')]));}else{_0x111fd9[_0x10bd('0x4a')]='';}headers[_0x10bd('0x4e')]=getAuth(_0x1dd8ee);return getUser(_0x1dd8ee,_0x3b2cf9['email'])[_0x10bd('0xd')](function(_0x2ad370){_0x455fd9=_0x2ad370;logger[_0x10bd('0x11')](_0x10bd('0x4f'),_0x455fd9['id']);return getEndUser(_0x1dd8ee,_0x111fd9['calleridname'],_0x111fd9[_0x10bd('0x50')]);})[_0x10bd('0xd')](function(_0x2ad9a9){_0x30da8a=_0x2ad9a9;logger[_0x10bd('0x11')](_0x10bd('0x51'),_0x30da8a['id']);return getTicket(_0x1dd8ee,_0x455fd9,_0x30da8a,_0x10e94b,_0x111fd9);})[_0x10bd('0xd')](function(_0x15c428){if(_0x15c428){logger['info']('Ticket\x20created!');logger[_0x10bd('0x11')](_0x10bd('0x52'),_0x15c428['id']);switch(_0x1dd8ee[_0x10bd('0x2f')]){case'integrationTab':logger[_0x10bd('0x11')](_0x10bd('0x48'),_0x10bd('0x53'));emit(util['format'](_0x10bd('0x54'),_0x3b2cf9[_0x10bd('0x3a')]),_0x10bd('0x55'),{'recordId':_0x15c428['id']});break;case _0x10bd('0x56'):logger[_0x10bd('0x11')](_0x10bd('0x48'),_0x10bd('0x57'));emit(util[_0x10bd('0x13')](_0x10bd('0x54'),_0x3b2cf9[_0x10bd('0x3a')]),'trigger:browser:url',{'uri':util[_0x10bd('0x13')](_0x10bd('0x58'),_0x15c428['id'])});break;default:logger['error']('[QUEUE]',_0x10bd('0x59'));}}})[_0x10bd('0x5a')](function(_0x32790b){console[_0x10bd('0x5b')](_0x32790b);logger[_0x10bd('0x5b')]('[QUEUE]',JSON[_0x10bd('0x5c')](_0x32790b));});};exports[_0x10bd('0x5d')]=function(_0x26fbc9,_0x1f3d68,_0x4e7e76,_0x4712e9,_0x53a1ee,_0x49a8f1,_0x15961e){var _0x3d6533,_0x4240e1;_0x49a8f1[_0x10bd('0xc')]=intUtil[_0x10bd('0x46')](_0x49a8f1[_0x10bd('0xc')]);_0x49a8f1[_0x10bd('0x4c')]=intUtil[_0x10bd('0x46')](_0x49a8f1[_0x10bd('0x4c')]);if(_0x15961e&&_0x15961e['recordingFormat']&&_0x15961e[_0x10bd('0x5e')]!==_0x10bd('0x5f')){logger['info'](_0x10bd('0x60'),_0x10bd('0x49'));_0x1f3d68['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49a8f1[_0x10bd('0x4c')],_0x1f3d68[_0x10bd('0x4d')],md5(_0x1f3d68['uniqueid']));}headers[_0x10bd('0x4e')]=getAuth(_0x49a8f1);return getUser(_0x49a8f1,_0x4712e9['email'])[_0x10bd('0xd')](function(_0x3ade0e){_0x3d6533=_0x3ade0e;logger[_0x10bd('0x11')]('The\x20User\x20ID\x20is:',_0x3d6533['id']);return getEndUser(_0x49a8f1,_0x1f3d68[_0x10bd('0x61')],_0x1f3d68[_0x10bd('0x62')]);})[_0x10bd('0xd')](function(_0xb21161){_0x4240e1=_0xb21161;logger['info'](_0x10bd('0x51'),_0x4240e1['id']);return getTicket(_0x49a8f1,_0x3d6533,_0x4240e1,_0x4e7e76,_0x1f3d68);})[_0x10bd('0xd')](function(_0x510ae1){if(_0x510ae1){logger[_0x10bd('0x11')](_0x10bd('0x63'));logger[_0x10bd('0x11')]('The\x20Ticket\x20ID\x20is:',_0x510ae1['id']);switch(_0x49a8f1['type']){case _0x10bd('0x64'):logger[_0x10bd('0x11')](_0x10bd('0x48'),_0x10bd('0x53'));emit(util[_0x10bd('0x13')](_0x10bd('0x54'),_0x4712e9['name']),_0x10bd('0x55'),{'recordId':_0x510ae1['id']});break;case _0x10bd('0x56'):logger[_0x10bd('0x11')](_0x10bd('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x4712e9[_0x10bd('0x3a')]),_0x10bd('0x65'),{'uri':util['format'](_0x10bd('0x66'),_0x49a8f1[_0x10bd('0xc')],_0x510ae1['id'])});break;default:logger[_0x10bd('0x5b')]('[OUTBOUND]',_0x10bd('0x59'));}}})[_0x10bd('0x5a')](function(_0x398dcd){logger[_0x10bd('0x5b')](_0x10bd('0x60'),JSON[_0x10bd('0x5c')](_0x398dcd));});};exports[_0x10bd('0x67')]=function(_0x69ae5d,_0x238bc0,_0x2cd97a,_0x1045e4,_0x374927,_0x5bf581){var _0x15afc1,_0x47b331;_0x5bf581[_0x10bd('0xc')]=intUtil[_0x10bd('0x46')](_0x5bf581[_0x10bd('0xc')]);_0x5bf581[_0x10bd('0x4c')]=intUtil[_0x10bd('0x46')](_0x5bf581[_0x10bd('0x4c')]);if(_0x374927&&_0x374927[_0x10bd('0x47')]){logger['info']('['+_0x238bc0[_0x10bd('0x68')][_0x10bd('0x69')]()+']',_0x10bd('0x49'));_0x238bc0['recordingURL']=util[_0x10bd('0x13')](_0x10bd('0x4b'),_0x5bf581[_0x10bd('0x4c')],_0x238bc0[_0x10bd('0x4d')],md5(_0x238bc0[_0x10bd('0x4d')]));}else{_0x238bc0[_0x10bd('0x4a')]='';}headers['Authorization']=getAuth(_0x5bf581);return getUser(_0x5bf581)[_0x10bd('0xd')](function(_0xb604dc){_0x15afc1=_0xb604dc;logger['info'](_0x10bd('0x4f'),_0x15afc1['id']);return getEndUser(_0x5bf581,_0x238bc0['calleridname'],_0x238bc0[_0x10bd('0x50')]);})['then'](function(_0x481a44){_0x47b331=_0x481a44;logger[_0x10bd('0x11')](_0x10bd('0x51'),_0x47b331['id']);return getTicket(_0x5bf581,_0x15afc1,_0x47b331,_0x2cd97a,_0x238bc0);})[_0x10bd('0xd')](function(_0x58b5d5){if(_0x58b5d5){logger[_0x10bd('0x11')](_0x10bd('0x63'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x58b5d5['id']);}})[_0x10bd('0x5a')](function(_0x60284b){logger[_0x10bd('0x5b')]('['+_0x238bc0[_0x10bd('0x68')][_0x10bd('0x69')]()+']',JSON[_0x10bd('0x5c')](_0x60284b));});}; \ No newline at end of file +var _0xfb01=['lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/logger','desk','redis','localhost','socket.io-emitter','emit','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','total_entries','find','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','defaults','GET','authType','basic','username','token','%s/token:%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','length','includes','picklist','nameField','customField','toLowerCase','content','toString','type','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','merge','xCALLY','Motion','CTI','Tags','getString','Descriptions','/api/v2/users/%d','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','%s/agent/tickets/%s','[OUTBOUND]','Desk\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','catch'];(function(_0xef0c04,_0x4b9792){var _0x83911e=function(_0x505a45){while(--_0x505a45){_0xef0c04['push'](_0xef0c04['shift']());}};_0x83911e(++_0x4b9792);}(_0xfb01,0xd3));var _0x1fb0=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xfb01[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x1fb0('0x0'));var rp=require(_0x1fb0('0x1'));var md5=require(_0x1fb0('0x2'));var util=require(_0x1fb0('0x3'));var Redis=require(_0x1fb0('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x1fb0('0x5'))(_0x1fb0('0x6'));config[_0x1fb0('0x7')]=_['defaults'](config['redis'],{'host':_0x1fb0('0x8'),'port':0x18eb});var io=require(_0x1fb0('0x9'))(new Redis(config[_0x1fb0('0x7')]));function emit(_0x1f4386,_0x59d2e8,_0x83fccc){io['to'](_0x1f4386)[_0x1fb0('0xa')](_0x59d2e8,_0x83fccc);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0xeef2bb,_0x27836b){if(intUtil['validateEmail'](_0x27836b)===!![]){logger[_0x1fb0('0xb')](_0x1fb0('0xc'),_0x27836b);return request({'uri':util[_0x1fb0('0xd')](_0x1fb0('0xe'),_0xeef2bb[_0x1fb0('0xf')])})['then'](function(_0x3a3ed5){if(_0x3a3ed5[_0x1fb0('0x10')]){return _[_0x1fb0('0x11')](_0x3a3ed5['_embedded'][_0x1fb0('0x12')],{'email':_0x27836b});}})[_0x1fb0('0x13')](function(_0x1a4879){if(_0x1a4879){logger[_0x1fb0('0xb')](_0x1fb0('0x14'));return _0x1a4879;}else{logger[_0x1fb0('0xb')](_0x1fb0('0x15'));return request({'uri':util[_0x1fb0('0xd')](_0x1fb0('0x16'),_0xeef2bb[_0x1fb0('0xf')])});}});}else{logger[_0x1fb0('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1fb0('0xd')](_0x1fb0('0x16'),_0xeef2bb[_0x1fb0('0xf')])});}}function request(_0x482f49){logger[_0x1fb0('0x17')](_0x1fb0('0x18'),JSON[_0x1fb0('0x19')](_0x482f49));return rp(_[_0x1fb0('0x1a')](_0x482f49,{'method':_0x1fb0('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x183e2a){var _0x5e10f6;if(_0x183e2a[_0x1fb0('0x1c')]===_0x1fb0('0x1d')){_0x5e10f6=util['format']('%s:%s',_0x183e2a[_0x1fb0('0x1e')],_0x183e2a['password']);}else if(_0x183e2a[_0x1fb0('0x1c')]===_0x1fb0('0x1f')){_0x5e10f6=util['format'](_0x1fb0('0x20'),_0x183e2a[_0x1fb0('0x1e')],_0x183e2a[_0x1fb0('0x1f')]);}return util[_0x1fb0('0xd')]('Basic\x20%s',new Buffer(_0x5e10f6)['toString'](_0x1fb0('0x21')));}function getEndUser(_0x2c4eee,_0x542370,_0x5a2781){logger['info'](_0x1fb0('0x22'),_0x5a2781);return request({'uri':util[_0x1fb0('0xd')](_0x1fb0('0x23'),_0x2c4eee[_0x1fb0('0xf')]),'qs':{'phone':_0x5a2781}})[_0x1fb0('0x13')](function(_0x2ba25e){if(_0x2ba25e['total_entries']){logger[_0x1fb0('0xb')](_0x1fb0('0x24'));return _0x2ba25e[_0x1fb0('0x25')]['entries'][0x0];}else{logger[_0x1fb0('0xb')](_0x1fb0('0x26'));return request({'uri':util['format'](_0x1fb0('0x27'),_0x2c4eee[_0x1fb0('0xf')]),'method':_0x1fb0('0x28'),'body':{'first_name':_0x542370,'title':_0x542370,'phone_numbers':[{'type':_0x1fb0('0x29'),'value':_0x5a2781}]}});}});}function getTags(_0x3082b7,_0x422edf){var _0x5e2bdf=[];if(_0x3082b7&&_0x3082b7['length']>0x0){_0x5e2bdf=_['map'](_0x3082b7,_0x422edf);}return _0x5e2bdf;}function getCustomFields(_0x4ebbbc,_0x30cff5){var _0x46dc29=[];var _0xb27cb1={'custom_fields':{}};if(_0x4ebbbc[_0x1fb0('0x2a')]>0x0){_['forEach'](_0x4ebbbc,function(_0x20beca){if(_[_0x1fb0('0x2b')](['string',_0x1fb0('0x2c')],_0x20beca['type'])&&_0x20beca[_0x1fb0('0x2d')]&&!_0x20beca[_0x1fb0('0x2e')]){_0xb27cb1[_0x20beca[_0x1fb0('0x2d')][_0x1fb0('0x2f')]()]=_0x20beca[_0x1fb0('0x30')][_0x1fb0('0x31')]();}else if(_[_0x1fb0('0x2b')](['string',_0x1fb0('0x2c')],_0x20beca[_0x1fb0('0x32')])&&_0x20beca[_0x1fb0('0x33')]&&_0x20beca[_0x1fb0('0x2e')]){_0xb27cb1[_0x1fb0('0x34')][_0x20beca[_0x1fb0('0x33')]]=_0x20beca[_0x1fb0('0x30')][_0x1fb0('0x31')]();}else if(_0x20beca[_0x1fb0('0x32')]===_0x1fb0('0x35')&&_0x20beca[_0x1fb0('0x36')]&&_0x20beca[_0x1fb0('0x33')]&&_0x20beca[_0x1fb0('0x2e')]){_0x30cff5[_0x20beca['variableName']]&&(_0xb27cb1[_0x1fb0('0x34')][_0x20beca[_0x1fb0('0x33')]]=_0x30cff5[_0x20beca[_0x1fb0('0x36')]]['toString']());}else if(_0x20beca['type']===_0x1fb0('0x37')&&_0x20beca[_0x1fb0('0x38')]&&_0x20beca['Variable']['name']&&_0x20beca[_0x1fb0('0x33')]&&_0x20beca[_0x1fb0('0x2e')]){_0x30cff5[_0x20beca['Variable'][_0x1fb0('0x39')][_0x1fb0('0x2f')]()]&&(_0xb27cb1[_0x1fb0('0x34')][_0x20beca[_0x1fb0('0x33')]]=_0x30cff5[_0x20beca[_0x1fb0('0x38')]['name']['toLowerCase']()]['toString']());}});}if(_0xb27cb1[_0x1fb0('0x3a')]){_0xb27cb1[_0x1fb0('0x3a')]=Number(_0xb27cb1[_0x1fb0('0x3a')]);}return _0xb27cb1;}function getTicket(_0x2c2c7b,_0x34eac0,_0x5d875b,_0x231ccb,_0x4861ab){logger[_0x1fb0('0xb')](_0x1fb0('0x3b'));var _0x904dfe=_[_0x1fb0('0x3c')]({'subject':intUtil['getString'](_0x231ccb['Subjects'],_0x4861ab,'\x20'),'type':'phone','status':'new','labels':[_0x1fb0('0x3d'),_0x1fb0('0x3e'),_0x1fb0('0x3f')]['concat'](getTags(_0x231ccb[_0x1fb0('0x40')],'name')),'description':intUtil[_0x1fb0('0x41')](_0x231ccb[_0x1fb0('0x42')],_0x4861ab,'\x0a'),'_links':{'assigned_user':{'href':util[_0x1fb0('0xd')](_0x1fb0('0x43'),_0x34eac0['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0x1fb0('0x41')](_0x231ccb[_0x1fb0('0x42')],_0x4861ab,'\x0a')}},getCustomFields(_0x231ccb['Fields'],_0x4861ab));return request({'uri':util[_0x1fb0('0xd')](_0x1fb0('0x44'),_0x2c2c7b[_0x1fb0('0xf')],_0x5d875b['id']),'method':_0x1fb0('0x28'),'body':_0x904dfe});}exports[_0x1fb0('0x45')]=function(_0x504800,_0x46ddfd,_0x47e38c,_0x56c1dc,_0x3f6dfb,_0x1e72b8){var _0x33d7bc,_0x43cf07;_0x1e72b8[_0x1fb0('0xf')]=intUtil['stripTrailingSlash'](_0x1e72b8[_0x1fb0('0xf')]);_0x1e72b8['serverUrl']=intUtil[_0x1fb0('0x46')](_0x1e72b8[_0x1fb0('0x47')]);if(_0x3f6dfb&&_0x3f6dfb['monitor_format']){logger[_0x1fb0('0xb')](_0x1fb0('0x48'),'Recording\x20is\x20enabled!');_0x46ddfd[_0x1fb0('0x49')]=util[_0x1fb0('0xd')](_0x1fb0('0x4a'),_0x1e72b8[_0x1fb0('0x47')],_0x46ddfd[_0x1fb0('0x4b')],md5(_0x46ddfd[_0x1fb0('0x4b')]));}else{_0x46ddfd[_0x1fb0('0x49')]='';}headers[_0x1fb0('0x4c')]=getAuth(_0x1e72b8);return getUser(_0x1e72b8,_0x56c1dc[_0x1fb0('0x4d')])[_0x1fb0('0x13')](function(_0x243d52){_0x33d7bc=_0x243d52;logger['info']('The\x20User\x20ID\x20is:',_0x33d7bc['id']);return getEndUser(_0x1e72b8,_0x46ddfd[_0x1fb0('0x4e')],_0x46ddfd[_0x1fb0('0x4f')]);})[_0x1fb0('0x13')](function(_0x1c0eb0){_0x43cf07=_0x1c0eb0;logger['info'](_0x1fb0('0x50'),_0x43cf07['id']);return getTicket(_0x1e72b8,_0x33d7bc,_0x43cf07,_0x47e38c,_0x46ddfd);})['then'](function(_0x9fb3fc){if(_0x9fb3fc){logger[_0x1fb0('0xb')](_0x1fb0('0x51'));logger[_0x1fb0('0xb')](_0x1fb0('0x52'),_0x9fb3fc['id']);switch(_0x1e72b8['type']){case _0x1fb0('0x53'):logger[_0x1fb0('0xb')](_0x1fb0('0x48'),_0x1fb0('0x54'));emit(util[_0x1fb0('0xd')]('user:%s',_0x56c1dc[_0x1fb0('0x39')]),_0x1fb0('0x55'),{'recordId':_0x9fb3fc['id']});break;case'newTab':logger[_0x1fb0('0xb')](_0x1fb0('0x48'),_0x1fb0('0x56'));emit(util[_0x1fb0('0xd')](_0x1fb0('0x57'),_0x56c1dc['name']),_0x1fb0('0x58'),{'uri':util['format'](_0x1fb0('0x59'),_0x9fb3fc['id'])});break;default:logger[_0x1fb0('0x5a')](_0x1fb0('0x48'),'Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x367a6f){console[_0x1fb0('0x5a')](_0x367a6f);logger[_0x1fb0('0x5a')]('[QUEUE]',JSON[_0x1fb0('0x19')](_0x367a6f));});};exports[_0x1fb0('0x5b')]=function(_0x4ec4b9,_0x23f6ac,_0x1e7d88,_0x137907,_0x27a675,_0xe91d6b,_0x315d2f){var _0x3b3736,_0x231572;_0xe91d6b[_0x1fb0('0xf')]=intUtil[_0x1fb0('0x46')](_0xe91d6b['remoteUri']);_0xe91d6b[_0x1fb0('0x47')]=intUtil['stripTrailingSlash'](_0xe91d6b['serverUrl']);if(_0x315d2f&&_0x315d2f[_0x1fb0('0x5c')]&&_0x315d2f['recordingFormat']!==_0x1fb0('0x5d')){logger[_0x1fb0('0xb')]('[OUTBOUND]',_0x1fb0('0x5e'));_0x23f6ac['recordingURL']=util[_0x1fb0('0xd')](_0x1fb0('0x4a'),_0xe91d6b[_0x1fb0('0x47')],_0x23f6ac[_0x1fb0('0x4b')],md5(_0x23f6ac[_0x1fb0('0x4b')]));}headers[_0x1fb0('0x4c')]=getAuth(_0xe91d6b);return getUser(_0xe91d6b,_0x137907[_0x1fb0('0x4d')])['then'](function(_0x544dd1){_0x3b3736=_0x544dd1;logger[_0x1fb0('0xb')](_0x1fb0('0x5f'),_0x3b3736['id']);return getEndUser(_0xe91d6b,_0x23f6ac[_0x1fb0('0x60')],_0x23f6ac['destcalleridnum']);})[_0x1fb0('0x13')](function(_0x203cc2){_0x231572=_0x203cc2;logger[_0x1fb0('0xb')](_0x1fb0('0x50'),_0x231572['id']);return getTicket(_0xe91d6b,_0x3b3736,_0x231572,_0x1e7d88,_0x23f6ac);})[_0x1fb0('0x13')](function(_0x41d955){if(_0x41d955){logger[_0x1fb0('0xb')]('Ticket\x20created!');logger['info'](_0x1fb0('0x52'),_0x41d955['id']);switch(_0xe91d6b[_0x1fb0('0x32')]){case _0x1fb0('0x53'):logger[_0x1fb0('0xb')](_0x1fb0('0x48'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x1fb0('0xd')](_0x1fb0('0x57'),_0x137907[_0x1fb0('0x39')]),_0x1fb0('0x55'),{'recordId':_0x41d955['id']});break;case'newTab':logger[_0x1fb0('0xb')](_0x1fb0('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1fb0('0xd')](_0x1fb0('0x57'),_0x137907['name']),_0x1fb0('0x58'),{'uri':util[_0x1fb0('0xd')](_0x1fb0('0x61'),_0xe91d6b[_0x1fb0('0xf')],_0x41d955['id'])});break;default:logger['error'](_0x1fb0('0x62'),_0x1fb0('0x63'));}}})['catch'](function(_0x16292e){logger[_0x1fb0('0x5a')]('[OUTBOUND]',JSON[_0x1fb0('0x19')](_0x16292e));});};exports[_0x1fb0('0x64')]=function(_0x51224a,_0x703b14,_0x3b07d5,_0x5f8496,_0x1ba9ad,_0x3d1812){var _0x410eb4,_0x569917;_0x3d1812[_0x1fb0('0xf')]=intUtil['stripTrailingSlash'](_0x3d1812[_0x1fb0('0xf')]);_0x3d1812[_0x1fb0('0x47')]=intUtil[_0x1fb0('0x46')](_0x3d1812[_0x1fb0('0x47')]);if(_0x1ba9ad&&_0x1ba9ad[_0x1fb0('0x65')]){logger[_0x1fb0('0xb')]('['+_0x703b14['lastevent'][_0x1fb0('0x66')]()+']',_0x1fb0('0x5e'));_0x703b14[_0x1fb0('0x49')]=util[_0x1fb0('0xd')](_0x1fb0('0x4a'),_0x3d1812[_0x1fb0('0x47')],_0x703b14[_0x1fb0('0x4b')],md5(_0x703b14[_0x1fb0('0x4b')]));}else{_0x703b14['recordingURL']='';}headers[_0x1fb0('0x4c')]=getAuth(_0x3d1812);return getUser(_0x3d1812)[_0x1fb0('0x13')](function(_0x40bdac){_0x410eb4=_0x40bdac;logger[_0x1fb0('0xb')](_0x1fb0('0x5f'),_0x410eb4['id']);return getEndUser(_0x3d1812,_0x703b14[_0x1fb0('0x4e')],_0x703b14[_0x1fb0('0x4f')]);})[_0x1fb0('0x13')](function(_0x572985){_0x569917=_0x572985;logger[_0x1fb0('0xb')](_0x1fb0('0x50'),_0x569917['id']);return getTicket(_0x3d1812,_0x410eb4,_0x569917,_0x3b07d5,_0x703b14);})[_0x1fb0('0x13')](function(_0x178df8){if(_0x178df8){logger[_0x1fb0('0xb')](_0x1fb0('0x51'));logger[_0x1fb0('0xb')](_0x1fb0('0x52'),_0x178df8['id']);}})[_0x1fb0('0x67')](function(_0x2374eb){logger[_0x1fb0('0x5a')]('['+_0x703b14[_0x1fb0('0x68')][_0x1fb0('0x66')]()+']',JSON[_0x1fb0('0x19')](_0x2374eb));});}; \ 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 f88e670..b8fe611 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 _0x7412=['remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','outbound','calleridnum','POST','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','message','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','picklist','type','nameField','customField','idField','toLowerCase','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','util','md5','redis','localhost','socket.io-emitter','clientId'];(function(_0x106b42,_0x44ff5e){var _0x110207=function(_0x1c379c){while(--_0x1c379c){_0x106b42['push'](_0x106b42['shift']());}};_0x110207(++_0x44ff5e);}(_0x7412,0x161));var _0x2741=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x7412[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x2741('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x2741('0x1'));var intUtil=require('./util');var md5=require(_0x2741('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')('dynamics365');var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0x2741('0x3')],{'host':_0x2741('0x4'),'port':0x18eb});var io=require(_0x2741('0x5'))(new Redis(config['redis']));function getAuthToken(_0x1f1f0d,_0x1f1451,_0x3883ec){var _0x2f3fb1={'method':'POST','uri':_0x1f1451,'form':{'client_id':_0x1f1f0d[_0x2741('0x6')],'resource':_0x1f1f0d[_0x2741('0x7')],'username':_0x1f1f0d[_0x2741('0x8')],'password':_0x1f1f0d[_0x2741('0x9')],'grant_type':_0x2741('0x9'),'client_secret':_0x1f1f0d['clientSecret']},'json':!![]};return rp(_0x2f3fb1)[_0x2741('0xa')](function(_0x105c01){return _0x105c01[_0x2741('0xb')];})[_0x2741('0xc')](function(_0x3c83ba){logger[_0x2741('0xd')]('['+[_0x3883ec[_0x2741('0xe')]()]+_0x2741('0xf'));return _0x3c83ba['message'];});}function getUser(_0x2311f2,_0xecf933,_0xc75fb5,_0x4347d5,_0x494073,_0xc535ee){return new BPromise(function(_0x1738fa,_0x29838b){return getAuthToken(_0xecf933,_0x4347d5,_0xc535ee)[_0x2741('0xa')](function(_0x56a04c){var _0x1f7ef5={'method':_0x2741('0x10'),'uri':_0x494073+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x2741('0x11')+_0x56a04c,'OData-Version':_0x2741('0x12')},'json':!![]};return rp(_0x1f7ef5);})['then'](function(_0x482f99){var _0x2b4f91=_0x482f99[_0x2741('0x13')];var _0x14cfa8=![];var _0x27feb7=null;if(!_[_0x2741('0x14')](_0xc75fb5)){if(intUtil[_0x2741('0x15')](_0xc75fb5[_0x2741('0x16')])){_0x2311f2[_0x2741('0x17')]=_0xc75fb5['email'];for(_0x27feb7=0x0;_0x27feb7<_0x2b4f91[_0x2741('0x18')];_0x27feb7++){if(_0x2b4f91[_0x27feb7]['internalemailaddress']===_0xc75fb5[_0x2741('0x16')]&&!_0x2b4f91[_0x27feb7]['isdisabled']){_0x14cfa8=!![];logger['info']('['+[_0xc535ee[_0x2741('0xe')]()]+_0x2741('0x19')+_0x2b4f91[_0x27feb7][_0x2741('0x1a')]+'!');_0x2311f2['userId']=_0x2b4f91[_0x27feb7][_0x2741('0x1a')];}}}}if(!_0x14cfa8){logger[_0x2741('0x1b')]('['+[_0xc535ee[_0x2741('0xe')]()]+_0x2741('0x1c'));_0x2311f2['userEmail']=_0xecf933[_0x2741('0x8')];for(_0x27feb7=0x0;_0x27feb7<_0x2b4f91[_0x2741('0x18')];_0x27feb7++){if(_0x2b4f91[_0x27feb7]['internalemailaddress']===_0xecf933['username']){_0x2311f2[_0x2741('0x1d')]=_0x2b4f91[_0x27feb7]['systemuserid'];}}}_0x1738fa(_0x2311f2);})['catch'](function(_0x303d6e){_0x29838b(_0x303d6e['message']);});});}function createEndUser(_0x52f2ab,_0x23cb80,_0x3ff705,_0x1e95d8,_0x40bfd5,_0x53aab8){return new BPromise(function(_0x14a9ab,_0x41cb7b){return getAuthToken(_0x23cb80,_0x3ff705,_0x53aab8)['then'](function(_0x355327){var _0x3a11ae=_0x53aab8['toLowerCase']()===_0x2741('0x1e')?_0x40bfd5['destcalleridnum']:_0x40bfd5[_0x2741('0x1f')];var _0x57b16d={'method':_0x2741('0x20'),'uri':_0x1e95d8+'contacts','body':{'telephone1':_0x3a11ae,'fullname':_0x3a11ae,'firstname':_0x3a11ae,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2741('0x21')+_0x52f2ab[_0x2741('0x1d')]+')'},'headers':{'Authorization':_0x2741('0x11')+_0x355327,'OData-Version':_0x2741('0x12')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x57b16d);})[_0x2741('0xa')](function(_0x29e4c5){var _0x3c0283=_0x29e4c5[_0x2741('0x22')][_0x2741('0x23')];var _0x28fc1a=_0x3c0283[_0x2741('0x24')](_0x3c0283['lastIndexOf']('(')+0x1,_0x3c0283[_0x2741('0x25')](')'));_0x52f2ab[_0x2741('0x26')]=_0x28fc1a;_0x14a9ab(_0x52f2ab);})[_0x2741('0xc')](function(_0x90ec2f){_0x41cb7b(_0x90ec2f[_0x2741('0x27')]);});});}function getEndUser(_0x47512d,_0x593e57,_0x3c2559,_0x5700db,_0x4ab122,_0x652e6a){return new BPromise(function(_0x4c48e6,_0x36758b){return getAuthToken(_0x593e57,_0x3c2559,_0x652e6a)[_0x2741('0xa')](function(_0x1c4bb1){var _0x549e28={'method':_0x2741('0x10'),'uri':_0x5700db+'contacts?$select=telephone1','headers':{'Authorization':_0x2741('0x11')+_0x1c4bb1,'If-None-Match':null,'OData-Version':_0x2741('0x12')},'json':!![]};return rp(_0x549e28);})[_0x2741('0xa')](function(_0x489e11){var _0x5684b0=null;if(_0x489e11){var _0x3c9752=_0x489e11[_0x2741('0x13')];var _0x1fbd52=![];for(_0x5684b0=0x0;_0x5684b0<_0x3c9752[_0x2741('0x18')];_0x5684b0++){var _0x22c455=_0x652e6a['toLowerCase']()===_0x2741('0x1e')?_0x4ab122['destcalleridnum']:_0x4ab122[_0x2741('0x1f')];if(_0x3c9752[_0x5684b0][_0x2741('0x28')]===_0x22c455){_0x1fbd52=!![];_0x47512d[_0x2741('0x26')]=_0x3c9752[_0x5684b0][_0x2741('0x29')];}}if(_0x1fbd52){_0x4c48e6(_0x47512d);}else{return createEndUser(_0x47512d,_0x593e57,_0x3c2559,_0x5700db,_0x4ab122,_0x652e6a)['then'](function(_0x3ccc96){logger[_0x2741('0x1b')]('['+[_0x652e6a[_0x2741('0xe')]()]+_0x2741('0x2a'),_0x3ccc96[_0x2741('0x26')]);_0x4c48e6(_0x3ccc96);});}}else{return createEndUser(_0x47512d,_0x593e57,_0x3c2559,_0x5700db,_0x4ab122,_0x652e6a)['then'](function(_0x412284){logger[_0x2741('0x1b')]('['+[_0x652e6a[_0x2741('0xe')]()]+_0x2741('0x2b'),_0x412284['enduserId']);_0x4c48e6(_0x412284);});}});});}function getCustomFields(_0x1a4ab9,_0x3b6d2c,_0x2eb065){var _0x45e33b={};if(_0x1a4ab9[_0x2741('0x18')]>0x0){_['forEach'](_0x1a4ab9,function(_0x4df6ea){if(_['includes'](['string',_0x2741('0x2c')],_0x4df6ea[_0x2741('0x2d')])&&_0x4df6ea[_0x2741('0x2e')]&&!_0x4df6ea[_0x2741('0x2f')]){var _0x329ef3=_0x4df6ea[_0x2741('0x30')][_0x2741('0x31')]();var _0x5dd1b6=_0x329ef3[_0x2741('0x24')](0x0,_0x329ef3[_0x2741('0x32')]('_'));var _0x56b903=_0x329ef3[_0x2741('0x24')](_0x329ef3[_0x2741('0x32')]('_')+0x1);if(_0x5dd1b6===_0x2eb065){_0x45e33b[_0x56b903]=_0x4df6ea[_0x2741('0x33')];}}});}return _0x45e33b;}function getTicket(_0x106b26,_0x1ac4c2,_0x4dc9fa,_0x35c218,_0x29e4b3,_0x5f046a,_0x2ef85f){return new BPromise(function(_0x1a943e,_0x4fabae){var _0x37a55e;return getAuthToken(_0x1ac4c2,_0x4dc9fa,_0x2ef85f)['then'](function(_0x46f45f){if(_0x5f046a['ticketType']===_0x2741('0x34')){_0x37a55e={'method':'POST','uri':_0x35c218+_0x2741('0x35'),'body':Object[_0x2741('0x36')]({},{'title':intUtil[_0x2741('0x37')](_0x5f046a[_0x2741('0x38')],_0x29e4b3,'\x20'),'description':intUtil[_0x2741('0x37')](_0x5f046a[_0x2741('0x39')],_0x29e4b3,'\x0a'),'customerid_contact@odata.bind':_0x2741('0x3a')+_0x106b26['enduserId']+')','ownerid@odata.bind':_0x2741('0x21')+_0x106b26[_0x2741('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x5f046a[_0x2741('0x3b')],_0x29e4b3,_0x5f046a[_0x2741('0x3c')])),'headers':{'Authorization':_0x2741('0x11')+_0x46f45f,'OData-Version':_0x2741('0x12')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5f046a[_0x2741('0x3c')]===_0x2741('0x3d')){_0x37a55e={'method':_0x2741('0x20'),'uri':_0x35c218+_0x2741('0x3e'),'body':Object[_0x2741('0x36')]({},{'subject':intUtil[_0x2741('0x37')](_0x5f046a[_0x2741('0x38')],_0x29e4b3,'\x20'),'phonenumber':String(_0x29e4b3['calleridnum']),'description':intUtil[_0x2741('0x37')](_0x5f046a['Descriptions'],_0x29e4b3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2741('0x3a')+_0x106b26[_0x2741('0x26')]+')','ownerid@odata.bind':'/systemusers('+_0x106b26[_0x2741('0x1d')]+')','directioncode':_0x106b26[_0x2741('0x3f')]===_0x2741('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x106b26[_0x2741('0x1d')]+')','participationtypemask':_0x106b26[_0x2741('0x3f')]===_0x2741('0x40')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x106b26['enduserId']+')','participationtypemask':_0x106b26[_0x2741('0x3f')]===_0x2741('0x40')?0x1:0x2}]},getCustomFields(_0x5f046a['Fields'],_0x29e4b3,_0x5f046a[_0x2741('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x46f45f,'OData-Version':_0x2741('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x37a55e);})[_0x2741('0xa')](function(_0x5ba5d){var _0x38a43f=_0x5ba5d[_0x2741('0x22')][_0x2741('0x23')];var _0x9bc596=_0x38a43f[_0x2741('0x24')](_0x38a43f[_0x2741('0x25')]('(')+0x1,_0x38a43f[_0x2741('0x25')](')'));_0x106b26[_0x2741('0x41')]=_0x9bc596;_0x1a943e(_0x106b26);})[_0x2741('0xc')](function(_0x453cdc){_0x4fabae(_0x453cdc['message']);});});}function emit(_0x8b5e57,_0x403cb9,_0x19a0aa,_0x117bc5){var _0x4534bd={'uri':util['format'](_0x2741('0x42'),_0x8b5e57,_0x19a0aa,_0x117bc5)};io['to'](util['format']('user:%s',_0x403cb9))[_0x2741('0x43')](_0x2741('0x44'),_0x4534bd);}exports['cs']=function(_0x4a28d7,_0xfc9b96,_0x43e62c,_0x1fa33b,_0x188253,_0x1635e5,_0x301849,_0x35a420){var _0x2c5e2e={};_0x1635e5[_0x2741('0x7')]=intUtil[_0x2741('0x45')](_0x1635e5['remoteUri']);_0x1635e5[_0x2741('0x46')]=intUtil[_0x2741('0x45')](_0x1635e5[_0x2741('0x46')]);_0x2c5e2e[_0x2741('0x3f')]=_0x35a420===_0x2741('0x40')||_0x35a420===_0x2741('0x47')?_0x2741('0x40'):'outbound';var _0xd66ee9=util[_0x2741('0x48')](_0x2741('0x49'),_0x1635e5[_0x2741('0x7')]);var _0x55daeb=util[_0x2741('0x48')](_0x2741('0x4a'),_0x1635e5[_0x2741('0x4b')]);var _0x2093b5=util['format'](_0x2741('0x4c'),_0x1635e5[_0x2741('0x46')],_0xfc9b96[_0x2741('0x4d')],md5(_0xfc9b96[_0x2741('0x4d')]));if(_0x188253&&_0x188253['monitor_format']){logger[_0x2741('0x1b')](_0x2741('0x4e'),'Recording\x20is\x20enabled!');_0xfc9b96[_0x2741('0x4f')]=_0x2093b5;}else if(_0x301849&&_0x301849[_0x2741('0x50')]&&_0x301849[_0x2741('0x50')]!==_0x2741('0x51')){logger['info']('[OUTBOUND]',_0x2741('0x52'));_0xfc9b96[_0x2741('0x4f')]=_0x2093b5;}else{_0xfc9b96['recordingURL']='';}return getUser(_0x2c5e2e,_0x1635e5,_0x1fa33b,_0x55daeb,_0xd66ee9,_0x35a420)['then'](function(_0x3d1cc2){logger['info']('['+_0x35a420[_0x2741('0xe')]()+_0x2741('0x53'),_0x3d1cc2[_0x2741('0x1d')]);logger['info']('['+_0x35a420[_0x2741('0xe')]()+_0x2741('0x54'),_0x3d1cc2[_0x2741('0x17')]);return getEndUser(_0x3d1cc2,_0x1635e5,_0x55daeb,_0xd66ee9,_0xfc9b96,_0x35a420);})[_0x2741('0xa')](function(_0x16685a){logger[_0x2741('0x1b')]('['+_0x35a420[_0x2741('0xe')]()+_0x2741('0x55'),_0x16685a[_0x2741('0x26')]);logger[_0x2741('0x1b')]('['+_0x35a420[_0x2741('0xe')]()+']\x20The\x20Enduser\x20phone\x20is:',_0xfc9b96['calleridnum']);return getTicket(_0x16685a,_0x1635e5,_0x55daeb,_0xd66ee9,_0xfc9b96,_0x43e62c,_0x35a420);})[_0x2741('0xa')](function(_0x351568){logger[_0x2741('0x1b')](util[_0x2741('0x48')]('['+_0x35a420[_0x2741('0xe')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x43e62c[_0x2741('0x3c')],_0x351568['ticketId']));logger[_0x2741('0x1b')](util['format']('['+_0x35a420[_0x2741('0xe')]()+_0x2741('0x56'),_0x35a420));if(_0x35a420!==_0x2741('0x47')){logger['info']('['+_0x35a420['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1635e5[_0x2741('0x7')],_0x1fa33b[_0x2741('0x57')],_0x43e62c[_0x2741('0x3c')],_0x351568[_0x2741('0x41')]);}})[_0x2741('0xc')](function(_0x1bee36){logger['error']('['+_0x35a420[_0x2741('0xe')]()+_0x2741('0x58'),util[_0x2741('0x59')](_0x1bee36,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe1d3=['headers','lastIndexOf','enduserId','contacts?$select=telephone1','outbound','calleridnum','telephone1',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','substring','assign','getString','Subjects','Fields','ticketType','phonecall','/contacts(','callDirection','queue','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','message','toLowerCase','POST','contacts','/systemusers(','4.0'];(function(_0x38a02f,_0x492f28){var _0xfb2c22=function(_0x24e16b){while(--_0x24e16b){_0x38a02f['push'](_0x38a02f['shift']());}};_0xfb2c22(++_0x492f28);}(_0xe1d3,0x159));var _0x3e1d=function(_0x5066d,_0x4eca65){_0x5066d=_0x5066d-0x0;var _0x298332=_0xe1d3[_0x5066d];return _0x298332;};'use strict';var _=require(_0x3e1d('0x0'));var BPromise=require(_0x3e1d('0x1'));var rp=require(_0x3e1d('0x2'));var util=require(_0x3e1d('0x3'));var intUtil=require(_0x3e1d('0x4'));var md5=require('md5');var Redis=require(_0x3e1d('0x5'));var logger=require('../../../../config/logger')(_0x3e1d('0x6'));var config=require(_0x3e1d('0x7'));config['redis']=_['defaults'](config[_0x3e1d('0x8')],{'host':_0x3e1d('0x9'),'port':0x18eb});var io=require(_0x3e1d('0xa'))(new Redis(config[_0x3e1d('0x8')]));function getAuthToken(_0x2b5c34,_0x4bf63b,_0xf4e7ca){var _0x999b94={'method':'POST','uri':_0x4bf63b,'form':{'client_id':_0x2b5c34[_0x3e1d('0xb')],'resource':_0x2b5c34[_0x3e1d('0xc')],'username':_0x2b5c34[_0x3e1d('0xd')],'password':_0x2b5c34[_0x3e1d('0xe')],'grant_type':_0x3e1d('0xe'),'client_secret':_0x2b5c34[_0x3e1d('0xf')]},'json':!![]};return rp(_0x999b94)[_0x3e1d('0x10')](function(_0x3e689c){return _0x3e689c[_0x3e1d('0x11')];})[_0x3e1d('0x12')](function(_0x1ccdb2){logger[_0x3e1d('0x13')]('['+[_0xf4e7ca[_0x3e1d('0x14')]()]+_0x3e1d('0x15'));return _0x1ccdb2['message'];});}function getUser(_0x307c37,_0x14b88f,_0x536c9f,_0x35dec5,_0x344be5,_0x4e77a6){return new BPromise(function(_0x1b9a1f,_0xa58738){return getAuthToken(_0x14b88f,_0x35dec5,_0x4e77a6)[_0x3e1d('0x10')](function(_0x2fb109){var _0x2c8b09={'method':'GET','uri':_0x344be5+_0x3e1d('0x16'),'headers':{'Authorization':_0x3e1d('0x17')+_0x2fb109,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c8b09);})[_0x3e1d('0x10')](function(_0x368372){var _0x517b8d=_0x368372[_0x3e1d('0x18')];var _0x46062f=![];var _0x2e0007=null;if(!_[_0x3e1d('0x19')](_0x536c9f)){if(intUtil[_0x3e1d('0x1a')](_0x536c9f[_0x3e1d('0x1b')])){_0x307c37['userEmail']=_0x536c9f[_0x3e1d('0x1b')];for(_0x2e0007=0x0;_0x2e0007<_0x517b8d[_0x3e1d('0x1c')];_0x2e0007++){if(_0x517b8d[_0x2e0007]['internalemailaddress']===_0x536c9f[_0x3e1d('0x1b')]&&!_0x517b8d[_0x2e0007][_0x3e1d('0x1d')]){_0x46062f=!![];logger[_0x3e1d('0x1e')]('['+[_0x4e77a6['toUpperCase']()]+_0x3e1d('0x1f')+_0x517b8d[_0x2e0007]['systemuserid']+'!');_0x307c37[_0x3e1d('0x20')]=_0x517b8d[_0x2e0007][_0x3e1d('0x21')];}}}}if(!_0x46062f){logger[_0x3e1d('0x1e')]('['+[_0x4e77a6[_0x3e1d('0x14')]()]+_0x3e1d('0x22'));_0x307c37[_0x3e1d('0x23')]=_0x14b88f[_0x3e1d('0xd')];for(_0x2e0007=0x0;_0x2e0007<_0x517b8d[_0x3e1d('0x1c')];_0x2e0007++){if(_0x517b8d[_0x2e0007][_0x3e1d('0x24')]===_0x14b88f['username']){_0x307c37[_0x3e1d('0x20')]=_0x517b8d[_0x2e0007][_0x3e1d('0x21')];}}}_0x1b9a1f(_0x307c37);})[_0x3e1d('0x12')](function(_0x14687e){_0xa58738(_0x14687e[_0x3e1d('0x25')]);});});}function createEndUser(_0x168af6,_0x51db49,_0x59376d,_0x47fb3c,_0x313cac,_0x8d01e2){return new BPromise(function(_0x74a647,_0x438bd4){return getAuthToken(_0x51db49,_0x59376d,_0x8d01e2)['then'](function(_0x13eb37){var _0xbc14b8=_0x8d01e2[_0x3e1d('0x26')]()==='outbound'?_0x313cac['destcalleridnum']:_0x313cac['calleridnum'];var _0xf0afff={'method':_0x3e1d('0x27'),'uri':_0x47fb3c+_0x3e1d('0x28'),'body':{'telephone1':_0xbc14b8,'fullname':_0xbc14b8,'firstname':_0xbc14b8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3e1d('0x29')+_0x168af6['userId']+')'},'headers':{'Authorization':_0x3e1d('0x17')+_0x13eb37,'OData-Version':_0x3e1d('0x2a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xf0afff);})[_0x3e1d('0x10')](function(_0x2e20c9){var _0x5c425f=_0x2e20c9[_0x3e1d('0x2b')]['odata-entityid'];var _0x2adb7d=_0x5c425f['substring'](_0x5c425f['lastIndexOf']('(')+0x1,_0x5c425f[_0x3e1d('0x2c')](')'));_0x168af6[_0x3e1d('0x2d')]=_0x2adb7d;_0x74a647(_0x168af6);})[_0x3e1d('0x12')](function(_0x1dca0d){_0x438bd4(_0x1dca0d[_0x3e1d('0x25')]);});});}function getEndUser(_0x1658c1,_0x3cd2c7,_0x33d420,_0x48f64e,_0xaaa54e,_0x4c3438){return new BPromise(function(_0x22f387,_0x22ff17){return getAuthToken(_0x3cd2c7,_0x33d420,_0x4c3438)[_0x3e1d('0x10')](function(_0x33b615){var _0x7cc22={'method':'GET','uri':_0x48f64e+_0x3e1d('0x2e'),'headers':{'Authorization':_0x3e1d('0x17')+_0x33b615,'If-None-Match':null,'OData-Version':_0x3e1d('0x2a')},'json':!![]};return rp(_0x7cc22);})[_0x3e1d('0x10')](function(_0x1cc016){var _0x2f6d=null;if(_0x1cc016){var _0x5c50f1=_0x1cc016[_0x3e1d('0x18')];var _0x41ccc3=![];for(_0x2f6d=0x0;_0x2f6d<_0x5c50f1[_0x3e1d('0x1c')];_0x2f6d++){var _0xc48c69=_0x4c3438[_0x3e1d('0x26')]()===_0x3e1d('0x2f')?_0xaaa54e['destcalleridnum']:_0xaaa54e[_0x3e1d('0x30')];if(_0x5c50f1[_0x2f6d][_0x3e1d('0x31')]===_0xc48c69){_0x41ccc3=!![];_0x1658c1['enduserId']=_0x5c50f1[_0x2f6d]['contactid'];}}if(_0x41ccc3){_0x22f387(_0x1658c1);}else{return createEndUser(_0x1658c1,_0x3cd2c7,_0x33d420,_0x48f64e,_0xaaa54e,_0x4c3438)['then'](function(_0xf4a2ce){logger[_0x3e1d('0x1e')]('['+[_0x4c3438['toUpperCase']()]+']\x20Enduser\x20created!',_0xf4a2ce['enduserId']);_0x22f387(_0xf4a2ce);});}}else{return createEndUser(_0x1658c1,_0x3cd2c7,_0x33d420,_0x48f64e,_0xaaa54e,_0x4c3438)['then'](function(_0x54d625){logger[_0x3e1d('0x1e')]('['+[_0x4c3438[_0x3e1d('0x14')]()]+_0x3e1d('0x32'),_0x54d625[_0x3e1d('0x2d')]);_0x22f387(_0x54d625);});}});});}function getCustomFields(_0x157e34,_0x59af3c,_0xba270a){var _0x54a490={};if(_0x157e34[_0x3e1d('0x1c')]>0x0){_[_0x3e1d('0x33')](_0x157e34,function(_0x782185){if(_[_0x3e1d('0x34')]([_0x3e1d('0x35'),_0x3e1d('0x36')],_0x782185[_0x3e1d('0x37')])&&_0x782185[_0x3e1d('0x38')]&&!_0x782185[_0x3e1d('0x39')]){var _0x4081cc=_0x782185[_0x3e1d('0x3a')][_0x3e1d('0x26')]();var _0x19f47c=_0x4081cc['substring'](0x0,_0x4081cc[_0x3e1d('0x3b')]('_'));var _0x36f9b6=_0x4081cc[_0x3e1d('0x3c')](_0x4081cc[_0x3e1d('0x3b')]('_')+0x1);if(_0x19f47c===_0xba270a){_0x54a490[_0x36f9b6]=_0x782185['content'];}}});}return _0x54a490;}function getTicket(_0x1566d8,_0x317f6a,_0x5a44df,_0x37d189,_0x43232b,_0x152af5,_0x5d6b71){return new BPromise(function(_0x3196e5,_0x579787){var _0x450f6b;return getAuthToken(_0x317f6a,_0x5a44df,_0x5d6b71)[_0x3e1d('0x10')](function(_0x450726){if(_0x152af5['ticketType']==='incident'){_0x450f6b={'method':_0x3e1d('0x27'),'uri':_0x37d189+'incidents','body':Object[_0x3e1d('0x3d')]({},{'title':intUtil[_0x3e1d('0x3e')](_0x152af5[_0x3e1d('0x3f')],_0x43232b,'\x20'),'description':intUtil[_0x3e1d('0x3e')](_0x152af5['Descriptions'],_0x43232b,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x1566d8[_0x3e1d('0x2d')]+')','ownerid@odata.bind':_0x3e1d('0x29')+_0x1566d8[_0x3e1d('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x152af5[_0x3e1d('0x40')],_0x43232b,_0x152af5[_0x3e1d('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x450726,'OData-Version':_0x3e1d('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x152af5[_0x3e1d('0x41')]===_0x3e1d('0x42')){_0x450f6b={'method':_0x3e1d('0x27'),'uri':_0x37d189+'phonecalls','body':Object[_0x3e1d('0x3d')]({},{'subject':intUtil[_0x3e1d('0x3e')](_0x152af5['Subjects'],_0x43232b,'\x20'),'phonenumber':String(_0x43232b[_0x3e1d('0x30')]),'description':intUtil[_0x3e1d('0x3e')](_0x152af5['Descriptions'],_0x43232b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3e1d('0x43')+_0x1566d8[_0x3e1d('0x2d')]+')','ownerid@odata.bind':_0x3e1d('0x29')+_0x1566d8[_0x3e1d('0x20')]+')','directioncode':_0x1566d8[_0x3e1d('0x44')]===_0x3e1d('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3e1d('0x29')+_0x1566d8[_0x3e1d('0x20')]+')','participationtypemask':_0x1566d8[_0x3e1d('0x44')]===_0x3e1d('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x3e1d('0x43')+_0x1566d8[_0x3e1d('0x2d')]+')','participationtypemask':_0x1566d8[_0x3e1d('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x152af5['Fields'],_0x43232b,_0x152af5[_0x3e1d('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x450726,'OData-Version':_0x3e1d('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x450f6b);})[_0x3e1d('0x10')](function(_0x185d61){var _0xe437be=_0x185d61[_0x3e1d('0x2b')][_0x3e1d('0x46')];var _0x5ed2cb=_0xe437be[_0x3e1d('0x3c')](_0xe437be[_0x3e1d('0x2c')]('(')+0x1,_0xe437be[_0x3e1d('0x2c')](')'));_0x1566d8['ticketId']=_0x5ed2cb;_0x3196e5(_0x1566d8);})[_0x3e1d('0x12')](function(_0x1c90f2){_0x579787(_0x1c90f2[_0x3e1d('0x25')]);});});}function emit(_0x1d385c,_0x427ad3,_0x4b9892,_0x37599e){var _0x2b729f={'uri':util[_0x3e1d('0x47')](_0x3e1d('0x48'),_0x1d385c,_0x4b9892,_0x37599e)};io['to'](util[_0x3e1d('0x47')](_0x3e1d('0x49'),_0x427ad3))[_0x3e1d('0x4a')](_0x3e1d('0x4b'),_0x2b729f);}exports['cs']=function(_0x2e8118,_0x234c09,_0x1e9d42,_0x300e84,_0x1f16d6,_0x4f0797,_0x4641a5,_0x465411){var _0x35b857={};_0x4f0797[_0x3e1d('0xc')]=intUtil[_0x3e1d('0x4c')](_0x4f0797[_0x3e1d('0xc')]);_0x4f0797[_0x3e1d('0x4d')]=intUtil[_0x3e1d('0x4c')](_0x4f0797[_0x3e1d('0x4d')]);_0x35b857[_0x3e1d('0x44')]=_0x465411==='queue'||_0x465411==='unmanaged'?_0x3e1d('0x45'):_0x3e1d('0x2f');var _0x4e1012=util[_0x3e1d('0x47')](_0x3e1d('0x4e'),_0x4f0797[_0x3e1d('0xc')]);var _0x7e5412=util['format'](_0x3e1d('0x4f'),_0x4f0797[_0x3e1d('0x50')]);var _0x2a9d84=util[_0x3e1d('0x47')](_0x3e1d('0x51'),_0x4f0797[_0x3e1d('0x4d')],_0x234c09[_0x3e1d('0x52')],md5(_0x234c09[_0x3e1d('0x52')]));if(_0x1f16d6&&_0x1f16d6['monitor_format']){logger[_0x3e1d('0x1e')](_0x3e1d('0x53'),_0x3e1d('0x54'));_0x234c09[_0x3e1d('0x55')]=_0x2a9d84;}else if(_0x4641a5&&_0x4641a5[_0x3e1d('0x56')]&&_0x4641a5[_0x3e1d('0x56')]!==_0x3e1d('0x57')){logger[_0x3e1d('0x1e')]('[OUTBOUND]',_0x3e1d('0x54'));_0x234c09[_0x3e1d('0x55')]=_0x2a9d84;}else{_0x234c09[_0x3e1d('0x55')]='';}return getUser(_0x35b857,_0x4f0797,_0x300e84,_0x7e5412,_0x4e1012,_0x465411)[_0x3e1d('0x10')](function(_0x55c760){logger[_0x3e1d('0x1e')]('['+_0x465411['toUpperCase']()+_0x3e1d('0x58'),_0x55c760['userId']);logger['info']('['+_0x465411['toUpperCase']()+_0x3e1d('0x59'),_0x55c760['userEmail']);return getEndUser(_0x55c760,_0x4f0797,_0x7e5412,_0x4e1012,_0x234c09,_0x465411);})[_0x3e1d('0x10')](function(_0x2e6d33){logger[_0x3e1d('0x1e')]('['+_0x465411[_0x3e1d('0x14')]()+_0x3e1d('0x5a'),_0x2e6d33['enduserId']);logger[_0x3e1d('0x1e')]('['+_0x465411['toUpperCase']()+_0x3e1d('0x5b'),_0x234c09[_0x3e1d('0x30')]);return getTicket(_0x2e6d33,_0x4f0797,_0x7e5412,_0x4e1012,_0x234c09,_0x1e9d42,_0x465411);})[_0x3e1d('0x10')](function(_0x38c603){logger[_0x3e1d('0x1e')](util[_0x3e1d('0x47')]('['+_0x465411['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1e9d42[_0x3e1d('0x41')],_0x38c603[_0x3e1d('0x5c')]));logger[_0x3e1d('0x1e')](util[_0x3e1d('0x47')]('['+_0x465411['toUpperCase']()+_0x3e1d('0x5d'),_0x465411));if(_0x465411!=='unmanaged'){logger[_0x3e1d('0x1e')]('['+_0x465411[_0x3e1d('0x14')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4f0797['remoteUri'],_0x300e84[_0x3e1d('0x5e')],_0x1e9d42[_0x3e1d('0x41')],_0x38c603[_0x3e1d('0x5c')]);}})[_0x3e1d('0x12')](function(_0x5a8df4){logger[_0x3e1d('0x13')]('['+_0x465411[_0x3e1d('0x14')]()+_0x3e1d('0x5f'),util[_0x3e1d('0x60')](_0x5a8df4,{'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 9db180f..d3bf05b 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 _0x378c=['nameField','includes','idField','push','variable','variableName','customField','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','catch','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','custom_fields','keyBy','value','%s/api/v2/tickets','Ticket\x20created!','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type'];(function(_0x114b93,_0x5a4f2d){var _0x52f08a=function(_0x222167){while(--_0x222167){_0x114b93['push'](_0x114b93['shift']());}};_0x52f08a(++_0x5a4f2d);}(_0x378c,0x137));var _0xc378=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x378c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc378('0x0'));var rp=require(_0xc378('0x1'));var md5=require('md5');var util=require(_0xc378('0x2'));var Redis=require(_0xc378('0x3'));var intUtil=require(_0xc378('0x4'));var config=require(_0xc378('0x5'));var logger=require('../../../../config/logger')('freshdesk');config[_0xc378('0x6')]=_[_0xc378('0x7')](config[_0xc378('0x6')],{'host':_0xc378('0x8'),'port':0x18eb});var io=require(_0xc378('0x9'))(new Redis(config[_0xc378('0x6')]));var headers={'Content-Type':_0xc378('0xa'),'Accept':_0xc378('0xa')};function emit(_0x38a935,_0x55b9e7,_0x18ebed){io['to'](_0x38a935)[_0xc378('0xb')](_0x55b9e7,_0x18ebed);}function getTicket(_0x3334f2,_0x1ff7c2,_0x524999,_0x4c4a20,_0xf4cc3d){logger[_0xc378('0xc')](_0xc378('0xd'));var _0x2b1e0d=_['merge']({'responder_id':_0x1ff7c2['id'],'requester_id':_0x524999['id'],'name':util[_0xc378('0xe')](_0xc378('0xf'),_0xf4cc3d[_0xc378('0x10')]),'phone':_0xf4cc3d[_0xc378('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc378('0x12')](_0x4c4a20[_0xc378('0x13')],_0xf4cc3d,'\x20'),'description':intUtil[_0xc378('0x12')](_0x4c4a20[_0xc378('0x14')],_0xf4cc3d,'
'),'tags':getTags(_0x4c4a20[_0xc378('0x15')],_0xc378('0x16'))},getCustomFields(_0x4c4a20['Fields'],_0xf4cc3d));_0x2b1e0d[_0xc378('0x17')]=_['mapValues'](_[_0xc378('0x18')](_0x2b1e0d['custom_fields'],'id'),_0xc378('0x19'));return request({'uri':util[_0xc378('0xe')](_0xc378('0x1a'),_0x3334f2['remoteUri']),'method':'POST','body':_0x2b1e0d})['then'](function(_0x5ee70b){logger['info'](_0xc378('0x1b'));return _0x5ee70b;});}function getUser(_0x5778aa,_0x2338d0){if(intUtil['validateEmail'](_0x2338d0)){return request({'uri':util[_0xc378('0xe')](_0xc378('0x1c'),_0x5778aa[_0xc378('0x1d')]),'qs':{'email':_0x2338d0}})[_0xc378('0x1e')](function(_0x228907){if(_0x228907[_0xc378('0x1f')]){logger[_0xc378('0xc')](_0xc378('0x20'));return _[_0xc378('0x21')](_0x228907,function(_0xbbe24a){return _0xbbe24a['contact'][_0xc378('0x22')]===_0x2338d0;});}else{logger['info'](_0xc378('0x23'));return request({'uri':util[_0xc378('0xe')]('%s/api/v2/agents/me',_0x5778aa[_0xc378('0x1d')])})[_0xc378('0x1e')](function(_0x44a8e9){logger['info']('Admin\x20account\x20selected.');return _0x44a8e9;});}});}else{logger[_0xc378('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc378('0xe')](_0xc378('0x24'),_0x5778aa[_0xc378('0x1d')])})[_0xc378('0x1e')](function(_0x53c48a){logger[_0xc378('0xc')](_0xc378('0x25'));return _0x53c48a;});}}function getEndUser(_0x51fa04,_0x524a59,_0xac88f3){logger[_0xc378('0xc')](_0xc378('0x26'),_0xac88f3);return request({'uri':util['format'](_0xc378('0x27'),_0x51fa04['remoteUri']),'qs':{'phone':_0xac88f3}})[_0xc378('0x1e')](function(_0x5a1241){if(_0x5a1241[_0xc378('0x1f')]){logger['info'](_0xc378('0x28'));return _['find'](_0x5a1241,{'phone':_0xac88f3});}else{logger[_0xc378('0xc')](_0xc378('0x29'));return request({'uri':util[_0xc378('0xe')](_0xc378('0x27'),_0x51fa04[_0xc378('0x1d')]),'method':_0xc378('0x2a'),'body':{'name':_0x524a59,'phone':_0xac88f3}})[_0xc378('0x1e')](function(_0x42c0b8){logger[_0xc378('0xc')](_0xc378('0x2b'));return _0x42c0b8;});}});}function getAuth(_0x5b7b11){return util[_0xc378('0xe')](_0xc378('0x2c'),new Buffer(_0x5b7b11[_0xc378('0x2d')]+':X')[_0xc378('0x2e')](_0xc378('0x2f')));}function request(_0x538a27){logger[_0xc378('0x30')](_0xc378('0x31'),JSON[_0xc378('0x32')](_0x538a27));return rp(_[_0xc378('0x7')](_0x538a27,{'method':_0xc378('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x28d6a5,_0x1ee3e0){var _0x1de211=[];if(_0x28d6a5&&_0x28d6a5[_0xc378('0x1f')]>0x0){_0x1de211=_[_0xc378('0x34')](_0x28d6a5,_0x1ee3e0);}return _0x1de211;}function getCustomFields(_0x347297,_0x5ededa){var _0x2ba3d2=[];var _0x5a1f7b={'custom_fields':[]};if(_0x347297[_0xc378('0x1f')]>0x0){_[_0xc378('0x35')](_0x347297,function(_0x356606){if(_['includes']([_0xc378('0x36'),_0xc378('0x37')],_0x356606[_0xc378('0x38')])&&_0x356606[_0xc378('0x39')]&&!_0x356606['customField']){_0x5a1f7b[_0x356606[_0xc378('0x39')]['toLowerCase']()]=_0x356606['content'][_0xc378('0x2e')]();}else if(_[_0xc378('0x3a')]([_0xc378('0x36'),'picklist'],_0x356606['type'])&&_0x356606[_0xc378('0x3b')]&&_0x356606['customField']){_0x5a1f7b[_0xc378('0x17')][_0xc378('0x3c')]({'id':_0x356606[_0xc378('0x3b')],'value':_0x356606['content'][_0xc378('0x2e')]()});}else if(_0x356606[_0xc378('0x38')]===_0xc378('0x3d')&&_0x356606[_0xc378('0x3e')]&&_0x356606[_0xc378('0x3b')]&&_0x356606[_0xc378('0x3f')]){_0x5ededa[_0x356606[_0xc378('0x3e')]]&&_0x5a1f7b['custom_fields'][_0xc378('0x3c')]({'id':_0x356606[_0xc378('0x3b')],'value':_0x5ededa[_0x356606[_0xc378('0x3e')]][_0xc378('0x2e')]()});}else if(_0x356606[_0xc378('0x38')]===_0xc378('0x40')&&_0x356606[_0xc378('0x41')]&&_0x356606[_0xc378('0x41')][_0xc378('0x16')]&&_0x356606[_0xc378('0x3b')]&&_0x356606[_0xc378('0x3f')]){_0x5ededa[_0x356606[_0xc378('0x41')][_0xc378('0x16')][_0xc378('0x42')]()]&&_0x5a1f7b[_0xc378('0x17')][_0xc378('0x3c')]({'id':_0x356606['idField'],'value':_0x5ededa[_0x356606[_0xc378('0x41')][_0xc378('0x16')][_0xc378('0x42')]()]['toString']()});}});}return _0x5a1f7b;}exports['queue']=function(_0x4eac3c,_0x351c9f,_0x2a2a25,_0x4bc013,_0x15c232,_0x5b70fa){var _0x10e614,_0x34f76f;_0x5b70fa[_0xc378('0x1d')]=intUtil[_0xc378('0x43')](_0x5b70fa[_0xc378('0x1d')]);_0x5b70fa[_0xc378('0x44')]=intUtil['stripTrailingSlash'](_0x5b70fa[_0xc378('0x44')]);if(_0x15c232&&_0x15c232[_0xc378('0x45')]){logger[_0xc378('0xc')](_0xc378('0x46'),_0xc378('0x47'));_0x351c9f['recordingURL']=util[_0xc378('0xe')](_0xc378('0x48'),_0x5b70fa['serverUrl'],_0x351c9f['uniqueid'],md5(_0x351c9f[_0xc378('0x49')]));}else{_0x351c9f['recordingURL']='';}headers[_0xc378('0x4a')]=getAuth(_0x5b70fa);return getUser(_0x5b70fa,_0x4bc013['email'])[_0xc378('0x1e')](function(_0x23bb10){_0x10e614=_0x23bb10;logger[_0xc378('0xc')](_0xc378('0x4b'),_0x10e614['id']);return getEndUser(_0x5b70fa,_0x351c9f[_0xc378('0x10')],_0x351c9f[_0xc378('0x11')]);})[_0xc378('0x1e')](function(_0x2dc35b){_0x34f76f=_0x2dc35b;logger[_0xc378('0xc')](_0xc378('0x4c'),_0x34f76f['id']);return getTicket(_0x5b70fa,_0x10e614,_0x34f76f,_0x2a2a25,_0x351c9f);})[_0xc378('0x1e')](function(_0x3e5f8a){if(_0x3e5f8a&&_0x3e5f8a['id']){logger['info'](_0xc378('0x1b'));logger[_0xc378('0xc')](_0xc378('0x4d'),_0x3e5f8a['id']);logger['info']('[QUEUE]',_0xc378('0x4e'));emit(util[_0xc378('0xe')](_0xc378('0x4f'),_0x4bc013[_0xc378('0x16')]),_0xc378('0x50'),{'uri':util[_0xc378('0xe')](_0xc378('0x51'),_0x5b70fa[_0xc378('0x1d')],_0x3e5f8a['id'])});}})['catch'](function(_0x329d56){logger[_0xc378('0x52')]('[QUEUE]',JSON[_0xc378('0x32')](_0x329d56));});};exports[_0xc378('0x53')]=function(_0x2c1c9f,_0x884c14,_0xe329b4,_0x531446,_0x5aa438,_0x14c4be,_0x1f455d){var _0x9096a5,_0x172184;_0x14c4be['remoteUri']=intUtil[_0xc378('0x43')](_0x14c4be[_0xc378('0x1d')]);_0x14c4be[_0xc378('0x44')]=intUtil[_0xc378('0x43')](_0x14c4be[_0xc378('0x44')]);if(_0x1f455d&&_0x1f455d[_0xc378('0x54')]&&_0x1f455d[_0xc378('0x54')]!=='none'){logger[_0xc378('0xc')](_0xc378('0x55'),_0xc378('0x47'));_0x884c14[_0xc378('0x56')]=util[_0xc378('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14c4be['serverUrl'],_0x884c14[_0xc378('0x49')],md5(_0x884c14[_0xc378('0x49')]));}headers[_0xc378('0x4a')]=getAuth(_0x14c4be);return getUser(_0x14c4be,_0x531446[_0xc378('0x22')])[_0xc378('0x1e')](function(_0x397ed4){_0x9096a5=_0x397ed4;logger[_0xc378('0xc')]('The\x20User\x20ID\x20is:',_0x9096a5['id']);return getEndUser(_0x14c4be,_0x884c14[_0xc378('0x57')],_0x884c14['destcalleridnum']);})[_0xc378('0x1e')](function(_0x11e8c4){_0x172184=_0x11e8c4;logger[_0xc378('0xc')](_0xc378('0x4c'),_0x172184['id']);return getTicket(_0x14c4be,_0x9096a5,_0x172184,_0xe329b4,_0x884c14);})['then'](function(_0x548cbd){if(_0x548cbd&&_0x548cbd['id']){logger['info'](_0xc378('0x1b'));logger['info'](_0xc378('0x4d'),_0x548cbd['id']);logger[_0xc378('0xc')]('[OUTBOUND]',_0xc378('0x4e'));emit(util[_0xc378('0xe')](_0xc378('0x4f'),_0x531446[_0xc378('0x16')]),'trigger:browser:url',{'uri':util[_0xc378('0xe')]('%s/helpdesk/tickets/%d',_0x14c4be[_0xc378('0x1d')],_0x548cbd['id'])});}})[_0xc378('0x58')](function(_0x4722df){logger['error']('[OUTBOUND]',JSON[_0xc378('0x32')](_0x4722df));});};exports[_0xc378('0x59')]=function(_0x453b31,_0x30ba7e,_0x41d4c8,_0x47bc1d,_0x3410c1,_0x17f733){var _0x4f746f,_0x55311a;_0x17f733['remoteUri']=intUtil[_0xc378('0x43')](_0x17f733[_0xc378('0x1d')]);_0x17f733['serverUrl']=intUtil[_0xc378('0x43')](_0x17f733[_0xc378('0x44')]);if(_0x3410c1&&_0x3410c1['monitor_format']){logger['info']('['+_0x30ba7e[_0xc378('0x5a')]['toUpperCase']()+']',_0xc378('0x47'));_0x30ba7e['recordingURL']=util[_0xc378('0xe')](_0xc378('0x48'),_0x17f733['serverUrl'],_0x30ba7e['uniqueid'],md5(_0x30ba7e[_0xc378('0x49')]));}else{_0x30ba7e['recordingURL']='';}headers['Authorization']=getAuth(_0x17f733);return getUser(_0x17f733,'')[_0xc378('0x1e')](function(_0x3bc76f){_0x4f746f=_0x3bc76f;logger[_0xc378('0xc')](_0xc378('0x4b'),_0x4f746f['id']);return getEndUser(_0x17f733,_0x30ba7e[_0xc378('0x10')],_0x30ba7e[_0xc378('0x11')]);})[_0xc378('0x1e')](function(_0x58a1d5){_0x55311a=_0x58a1d5;logger[_0xc378('0xc')](_0xc378('0x4c'),_0x55311a['id']);return getTicket(_0x17f733,_0x4f746f,_0x55311a,_0x41d4c8,_0x30ba7e);})['then'](function(_0x4bdfa1){if(_0x4bdfa1){logger[_0xc378('0xc')](_0xc378('0x1b'));logger[_0xc378('0xc')](_0xc378('0x4d'),_0x4bdfa1['id']);}})[_0xc378('0x58')](function(_0x3ce65f){logger[_0xc378('0x52')]('['+_0x30ba7e[_0xc378('0x5a')][_0xc378('0x5b')]()+']',JSON['stringify'](_0x3ce65f));});}; \ No newline at end of file +var _0xa184=['request-promise','md5','util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','format','%s/api/v2/tickets','POST','info','Ticket\x20created!','validateEmail','remoteUri','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','base64','[HTTP]','stringify','map','includes','picklist','type','nameField','customField','toLowerCase','string','push','idField','content','toString','variableName','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','lastevent','toUpperCase','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa184,0x110));var _0x4a18=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xa184[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x4a18('0x0'));var rp=require(_0x4a18('0x1'));var md5=require(_0x4a18('0x2'));var util=require(_0x4a18('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4a18('0x4'));var logger=require(_0x4a18('0x5'))('freshdesk');config[_0x4a18('0x6')]=_[_0x4a18('0x7')](config['redis'],{'host':_0x4a18('0x8'),'port':0x18eb});var io=require(_0x4a18('0x9'))(new Redis(config[_0x4a18('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x4a18('0xa')};function emit(_0x372522,_0x367a24,_0x493daa){io['to'](_0x372522)[_0x4a18('0xb')](_0x367a24,_0x493daa);}function getTicket(_0x94be28,_0x222e54,_0x156832,_0x88fc5c,_0x3b7900){logger['info'](_0x4a18('0xc'));var _0x3c369f=_[_0x4a18('0xd')]({'responder_id':_0x222e54['id'],'requester_id':_0x156832['id'],'name':util['format'](_0x4a18('0xe'),_0x3b7900[_0x4a18('0xf')]),'phone':_0x3b7900[_0x4a18('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4a18('0x11')](_0x88fc5c[_0x4a18('0x12')],_0x3b7900,'\x20'),'description':intUtil[_0x4a18('0x11')](_0x88fc5c[_0x4a18('0x13')],_0x3b7900,_0x4a18('0x14')),'tags':getTags(_0x88fc5c[_0x4a18('0x15')],'name')},getCustomFields(_0x88fc5c[_0x4a18('0x16')],_0x3b7900));_0x3c369f[_0x4a18('0x17')]=_[_0x4a18('0x18')](_[_0x4a18('0x19')](_0x3c369f[_0x4a18('0x17')],'id'),'value');return request({'uri':util[_0x4a18('0x1a')](_0x4a18('0x1b'),_0x94be28['remoteUri']),'method':_0x4a18('0x1c'),'body':_0x3c369f})['then'](function(_0x3a50e0){logger[_0x4a18('0x1d')](_0x4a18('0x1e'));return _0x3a50e0;});}function getUser(_0x27995a,_0xb44456){if(intUtil[_0x4a18('0x1f')](_0xb44456)){return request({'uri':util[_0x4a18('0x1a')]('%s/api/v2/agents',_0x27995a[_0x4a18('0x20')]),'qs':{'email':_0xb44456}})[_0x4a18('0x21')](function(_0x51ca74){if(_0x51ca74[_0x4a18('0x22')]){logger[_0x4a18('0x1d')](_0x4a18('0x23'));return _[_0x4a18('0x24')](_0x51ca74,function(_0x127734){return _0x127734[_0x4a18('0x25')][_0x4a18('0x26')]===_0xb44456;});}else{logger[_0x4a18('0x1d')](_0x4a18('0x27'));return request({'uri':util[_0x4a18('0x1a')]('%s/api/v2/agents/me',_0x27995a['remoteUri'])})[_0x4a18('0x21')](function(_0xf30b89){logger[_0x4a18('0x1d')]('Admin\x20account\x20selected.');return _0xf30b89;});}});}else{logger[_0x4a18('0x1d')](_0x4a18('0x28'));return request({'uri':util['format'](_0x4a18('0x29'),_0x27995a['remoteUri'])})[_0x4a18('0x21')](function(_0x5b1c79){logger[_0x4a18('0x1d')](_0x4a18('0x2a'));return _0x5b1c79;});}}function getEndUser(_0x192c75,_0x20c9cc,_0xa360c3){logger['info'](_0x4a18('0x2b'),_0xa360c3);return request({'uri':util[_0x4a18('0x1a')](_0x4a18('0x2c'),_0x192c75[_0x4a18('0x20')]),'qs':{'phone':_0xa360c3}})[_0x4a18('0x21')](function(_0x275c1a){if(_0x275c1a['length']){logger['info'](_0x4a18('0x2d'));return _['find'](_0x275c1a,{'phone':_0xa360c3});}else{logger[_0x4a18('0x1d')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x4a18('0x1a')](_0x4a18('0x2c'),_0x192c75['remoteUri']),'method':_0x4a18('0x1c'),'body':{'name':_0x20c9cc,'phone':_0xa360c3}})[_0x4a18('0x21')](function(_0x34fb38){logger[_0x4a18('0x1d')]('Enduser\x20created.');return _0x34fb38;});}});}function getAuth(_0x50a38d){return util[_0x4a18('0x1a')](_0x4a18('0x2e'),new Buffer(_0x50a38d['apiKey']+':X')['toString'](_0x4a18('0x2f')));}function request(_0x477467){logger['debug'](_0x4a18('0x30'),JSON[_0x4a18('0x31')](_0x477467));return rp(_[_0x4a18('0x7')](_0x477467,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x57fc2e,_0x4d7e1f){var _0x14c8b6=[];if(_0x57fc2e&&_0x57fc2e[_0x4a18('0x22')]>0x0){_0x14c8b6=_[_0x4a18('0x32')](_0x57fc2e,_0x4d7e1f);}return _0x14c8b6;}function getCustomFields(_0x370cc9,_0x31dcda){var _0x46b73d=[];var _0x163878={'custom_fields':[]};if(_0x370cc9['length']>0x0){_['forEach'](_0x370cc9,function(_0xd9576a){if(_[_0x4a18('0x33')](['string',_0x4a18('0x34')],_0xd9576a[_0x4a18('0x35')])&&_0xd9576a[_0x4a18('0x36')]&&!_0xd9576a[_0x4a18('0x37')]){_0x163878[_0xd9576a[_0x4a18('0x36')][_0x4a18('0x38')]()]=_0xd9576a['content']['toString']();}else if(_[_0x4a18('0x33')]([_0x4a18('0x39'),'picklist'],_0xd9576a[_0x4a18('0x35')])&&_0xd9576a['idField']&&_0xd9576a['customField']){_0x163878[_0x4a18('0x17')][_0x4a18('0x3a')]({'id':_0xd9576a[_0x4a18('0x3b')],'value':_0xd9576a[_0x4a18('0x3c')][_0x4a18('0x3d')]()});}else if(_0xd9576a[_0x4a18('0x35')]==='variable'&&_0xd9576a['variableName']&&_0xd9576a['idField']&&_0xd9576a['customField']){_0x31dcda[_0xd9576a['variableName']]&&_0x163878[_0x4a18('0x17')][_0x4a18('0x3a')]({'id':_0xd9576a[_0x4a18('0x3b')],'value':_0x31dcda[_0xd9576a[_0x4a18('0x3e')]][_0x4a18('0x3d')]()});}else if(_0xd9576a[_0x4a18('0x35')]==='customVariable'&&_0xd9576a[_0x4a18('0x3f')]&&_0xd9576a[_0x4a18('0x3f')][_0x4a18('0x40')]&&_0xd9576a[_0x4a18('0x3b')]&&_0xd9576a[_0x4a18('0x37')]){_0x31dcda[_0xd9576a[_0x4a18('0x3f')][_0x4a18('0x40')][_0x4a18('0x38')]()]&&_0x163878[_0x4a18('0x17')]['push']({'id':_0xd9576a[_0x4a18('0x3b')],'value':_0x31dcda[_0xd9576a['Variable'][_0x4a18('0x40')][_0x4a18('0x38')]()][_0x4a18('0x3d')]()});}});}return _0x163878;}exports[_0x4a18('0x41')]=function(_0x42f4f8,_0x2a2d41,_0x5341b6,_0x12629f,_0x458e71,_0x20c192){var _0x1fee68,_0x44201e;_0x20c192[_0x4a18('0x20')]=intUtil['stripTrailingSlash'](_0x20c192[_0x4a18('0x20')]);_0x20c192[_0x4a18('0x42')]=intUtil[_0x4a18('0x43')](_0x20c192[_0x4a18('0x42')]);if(_0x458e71&&_0x458e71[_0x4a18('0x44')]){logger[_0x4a18('0x1d')](_0x4a18('0x45'),'Recording\x20is\x20enabled!');_0x2a2d41[_0x4a18('0x46')]=util[_0x4a18('0x1a')](_0x4a18('0x47'),_0x20c192['serverUrl'],_0x2a2d41['uniqueid'],md5(_0x2a2d41[_0x4a18('0x48')]));}else{_0x2a2d41[_0x4a18('0x46')]='';}headers[_0x4a18('0x49')]=getAuth(_0x20c192);return getUser(_0x20c192,_0x12629f[_0x4a18('0x26')])[_0x4a18('0x21')](function(_0x223d3a){_0x1fee68=_0x223d3a;logger[_0x4a18('0x1d')](_0x4a18('0x4a'),_0x1fee68['id']);return getEndUser(_0x20c192,_0x2a2d41['calleridname'],_0x2a2d41[_0x4a18('0x10')]);})[_0x4a18('0x21')](function(_0x54872f){_0x44201e=_0x54872f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x44201e['id']);return getTicket(_0x20c192,_0x1fee68,_0x44201e,_0x5341b6,_0x2a2d41);})['then'](function(_0xc6e7a7){if(_0xc6e7a7&&_0xc6e7a7['id']){logger[_0x4a18('0x1d')](_0x4a18('0x1e'));logger[_0x4a18('0x1d')](_0x4a18('0x4b'),_0xc6e7a7['id']);logger[_0x4a18('0x1d')]('[QUEUE]',_0x4a18('0x4c'));emit(util[_0x4a18('0x1a')](_0x4a18('0x4d'),_0x12629f['name']),_0x4a18('0x4e'),{'uri':util[_0x4a18('0x1a')](_0x4a18('0x4f'),_0x20c192[_0x4a18('0x20')],_0xc6e7a7['id'])});}})[_0x4a18('0x50')](function(_0x329391){logger[_0x4a18('0x51')](_0x4a18('0x45'),JSON[_0x4a18('0x31')](_0x329391));});};exports['outbound']=function(_0x4ee0c4,_0x4e5933,_0x5cbbe5,_0x34b24a,_0x5c2a4c,_0x20610b,_0x3950c8){var _0x46af29,_0x3738d5;_0x20610b['remoteUri']=intUtil[_0x4a18('0x43')](_0x20610b[_0x4a18('0x20')]);_0x20610b['serverUrl']=intUtil[_0x4a18('0x43')](_0x20610b['serverUrl']);if(_0x3950c8&&_0x3950c8[_0x4a18('0x52')]&&_0x3950c8[_0x4a18('0x52')]!==_0x4a18('0x53')){logger[_0x4a18('0x1d')]('[OUTBOUND]',_0x4a18('0x54'));_0x4e5933[_0x4a18('0x46')]=util[_0x4a18('0x1a')](_0x4a18('0x47'),_0x20610b[_0x4a18('0x42')],_0x4e5933[_0x4a18('0x48')],md5(_0x4e5933['uniqueid']));}headers[_0x4a18('0x49')]=getAuth(_0x20610b);return getUser(_0x20610b,_0x34b24a['email'])[_0x4a18('0x21')](function(_0x226183){_0x46af29=_0x226183;logger[_0x4a18('0x1d')](_0x4a18('0x4a'),_0x46af29['id']);return getEndUser(_0x20610b,_0x4e5933[_0x4a18('0x55')],_0x4e5933[_0x4a18('0x56')]);})[_0x4a18('0x21')](function(_0x485df5){_0x3738d5=_0x485df5;logger['info'](_0x4a18('0x57'),_0x3738d5['id']);return getTicket(_0x20610b,_0x46af29,_0x3738d5,_0x5cbbe5,_0x4e5933);})['then'](function(_0xacf83){if(_0xacf83&&_0xacf83['id']){logger[_0x4a18('0x1d')](_0x4a18('0x1e'));logger[_0x4a18('0x1d')](_0x4a18('0x4b'),_0xacf83['id']);logger[_0x4a18('0x1d')](_0x4a18('0x58'),_0x4a18('0x4c'));emit(util[_0x4a18('0x1a')](_0x4a18('0x4d'),_0x34b24a['name']),'trigger:browser:url',{'uri':util[_0x4a18('0x1a')](_0x4a18('0x4f'),_0x20610b[_0x4a18('0x20')],_0xacf83['id'])});}})[_0x4a18('0x50')](function(_0x3f0776){logger[_0x4a18('0x51')](_0x4a18('0x58'),JSON[_0x4a18('0x31')](_0x3f0776));});};exports['unmanaged']=function(_0x24982a,_0x477c9f,_0x36bce7,_0x21fe95,_0x315c38,_0x411b89){var _0x4cdde3,_0xac3f37;_0x411b89[_0x4a18('0x20')]=intUtil['stripTrailingSlash'](_0x411b89[_0x4a18('0x20')]);_0x411b89[_0x4a18('0x42')]=intUtil['stripTrailingSlash'](_0x411b89['serverUrl']);if(_0x315c38&&_0x315c38[_0x4a18('0x44')]){logger[_0x4a18('0x1d')]('['+_0x477c9f[_0x4a18('0x59')][_0x4a18('0x5a')]()+']','Recording\x20is\x20enabled!');_0x477c9f[_0x4a18('0x46')]=util[_0x4a18('0x1a')](_0x4a18('0x47'),_0x411b89[_0x4a18('0x42')],_0x477c9f[_0x4a18('0x48')],md5(_0x477c9f[_0x4a18('0x48')]));}else{_0x477c9f[_0x4a18('0x46')]='';}headers[_0x4a18('0x49')]=getAuth(_0x411b89);return getUser(_0x411b89,'')[_0x4a18('0x21')](function(_0x411670){_0x4cdde3=_0x411670;logger[_0x4a18('0x1d')](_0x4a18('0x4a'),_0x4cdde3['id']);return getEndUser(_0x411b89,_0x477c9f[_0x4a18('0xf')],_0x477c9f[_0x4a18('0x10')]);})[_0x4a18('0x21')](function(_0x586250){_0xac3f37=_0x586250;logger[_0x4a18('0x1d')]('The\x20Enduser\x20ID\x20is:',_0xac3f37['id']);return getTicket(_0x411b89,_0x4cdde3,_0xac3f37,_0x36bce7,_0x477c9f);})[_0x4a18('0x21')](function(_0x200743){if(_0x200743){logger[_0x4a18('0x1d')](_0x4a18('0x1e'));logger['info'](_0x4a18('0x4b'),_0x200743['id']);}})[_0x4a18('0x50')](function(_0x3e1264){logger[_0x4a18('0x51')]('['+_0x477c9f['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x3e1264));});}; \ 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 e2d3c1e..ef41c36 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 _0x16cc=['Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','username','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','/api/selector/owners','headers','info','users','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','userId','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number'];(function(_0x17b4a9,_0x2a440b){var _0x485859=function(_0x5ae014){while(--_0x5ae014){_0x17b4a9['push'](_0x17b4a9['shift']());}};_0x485859(++_0x2a440b);}(_0x16cc,0x120));var _0xc16c=function(_0x139851,_0x5f1fc0){_0x139851=_0x139851-0x0;var _0x115ea8=_0x16cc[_0x139851];return _0x115ea8;};'use strict';var _=require('lodash');var rp=require(_0xc16c('0x0'));var md5=require(_0xc16c('0x1'));var util=require(_0xc16c('0x2'));var moment=require(_0xc16c('0x3'));var Promise=require(_0xc16c('0x4'));var Redis=require(_0xc16c('0x5'));var intUtil=require(_0xc16c('0x6'));var config=require('../../../../config/environment');var logger=require(_0xc16c('0x7'))(_0xc16c('0x8'));config[_0xc16c('0x9')]=_[_0xc16c('0xa')](config['redis'],{'host':_0xc16c('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc16c('0x9')]));function getAdminId(_0x14d607,_0x37b245,_0x22ba35,_0x583c25){return new Promise(function(_0x27f3e6,_0x286c40){var _0x3f3ff4=![];var _0x462dcf={'method':'GET','uri':_0x583c25+_0xc16c('0xc'),'json':!![]};_0x462dcf[_0xc16c('0xd')]=_0x22ba35;logger[_0xc16c('0xe')]('Getting\x20admin\x20information');return rp(_0x462dcf)['then'](function(_0x333748){if(_0x333748){var _0x2cf236=_0x333748[_0xc16c('0xf')];var _0x5265f7=null;for(_0x5265f7=0x0;_0x5265f7<_0x2cf236['length'];_0x5265f7++){if(_0x2cf236[_0x5265f7]['email']===_0x14d607[_0xc16c('0x10')]){_0x14d607[_0xc16c('0x11')]=_0x2cf236[_0x5265f7]['id'];_0x3f3ff4=!![];}}if(_0x3f3ff4){logger[_0xc16c('0xe')](_0xc16c('0x12'),_0x14d607[_0xc16c('0x11')]);_0x27f3e6(_0x14d607);}else{_0x286c40({'statusCode':0x194,'message':_0xc16c('0x13')});}}else{_0x286c40({'statusCode':0x194,'message':_0xc16c('0x13')});}})[_0xc16c('0x14')](function(_0x200ec0){logger[_0xc16c('0x15')]('['+[_0x37b245[_0xc16c('0x16')]()]+']',_0x200ec0[_0xc16c('0x17')]);_0x286c40(_0x200ec0);});});}function getUser(_0x2818e,_0x2bf102,_0x431255){return function(_0x5535ee){return new Promise(function(_0x509e6b,_0x9017b2){var _0x201360={'method':_0xc16c('0x18'),'uri':_0x431255+_0xc16c('0xc'),'json':!![]};_0x201360[_0xc16c('0xd')]=_0x2bf102;logger[_0xc16c('0xe')](_0xc16c('0x19'));return rp(_0x201360)[_0xc16c('0x1a')](function(_0x55dc03){if(_0x55dc03){var _0x4770d2=_0x55dc03[_0xc16c('0xf')];var _0x121da2=![];var _0x290e9=null;if(_0x5535ee[_0xc16c('0x1b')]!==null){logger[_0xc16c('0xe')](_0xc16c('0x1c'),_0x5535ee[_0xc16c('0x1b')]);_0x5535ee[_0xc16c('0x1d')]=_0x5535ee[_0xc16c('0x1b')];for(_0x290e9=0x0;_0x290e9<_0x4770d2[_0xc16c('0x1e')];_0x290e9++){if(_0x4770d2[_0x290e9][_0xc16c('0x1f')]===_0x5535ee[_0xc16c('0x1b')]){_0x121da2=!![];_0x5535ee[_0xc16c('0x20')]=_0x4770d2[_0x290e9]['id'];logger[_0xc16c('0xe')]('User\x20found:',_0x5535ee['userId']);}}}if(!_0x121da2){logger[_0xc16c('0xe')]('Admin\x20selected');_0x5535ee[_0xc16c('0x1d')]=_0x5535ee[_0xc16c('0x10')];_0x5535ee['userId']=_0x5535ee[_0xc16c('0x11')];_0x121da2=!![];}if(_0x121da2){_0x509e6b(_0x5535ee);}else{_0x9017b2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x9017b2({'statusCode':0x194,'message':_0xc16c('0x13')});}})[_0xc16c('0x14')](function(_0x5c57d4){logger[_0xc16c('0x15')]('['+[_0x2818e[_0xc16c('0x16')]()]+']',_0x5c57d4[_0xc16c('0x17')]);_0x9017b2(_0x5c57d4);});});};}function searchContact(_0x536bf1,_0x403c67,_0x29c413,_0x49d11e){return new Promise(function(_0x177622,_0x1457d4){var _0x4c25c7={'method':'GET','headers':_0x403c67,'uri':_0x536bf1+_0xc16c('0x21')+_0x49d11e+'&f='+_0x29c413+_0xc16c('0x22'),'json':!![]};rp(_0x4c25c7)[_0xc16c('0x1a')](function(_0x11805c){var _0x4f1889=_[_0xc16c('0x23')](_0x11805c[_0xc16c('0x24')][_0xc16c('0x24')],[_0x29c413,_0x49d11e]);_0x177622(_0x4f1889);})[_0xc16c('0x14')](function(_0xff021a){_0x1457d4(_0xff021a);});});}function getEndUser(_0x33f931,_0x154800,_0xe62e1e){return function(_0x2f28c1){return new Promise(function(_0x2687ec,_0x2b3d6d){logger[_0xc16c('0xe')](util[_0xc16c('0x25')](_0xc16c('0x26'),_0x2f28c1['contactNumber']));searchContact(_0xe62e1e,_0x154800,_0xc16c('0x27'),_0x2f28c1[_0xc16c('0x28')])[_0xc16c('0x1a')](function(_0x5c2d5b){if(_0x5c2d5b){_0x2f28c1['endUserId']=_0x5c2d5b['id'];logger['info'](_0xc16c('0x29'),_0x2f28c1[_0xc16c('0x2a')]);return _0x2687ec(_0x2f28c1);}searchContact(_0xe62e1e,_0x154800,_0xc16c('0x2b'),_0x2f28c1[_0xc16c('0x28')])[_0xc16c('0x1a')](function(_0xfc8552){if(_0xfc8552){_0x2f28c1[_0xc16c('0x2a')]=_0xfc8552['id'];logger[_0xc16c('0xe')](_0xc16c('0x2c'),_0x2f28c1['endUserId']);return _0x2687ec(_0x2f28c1);}createEndUser(_0x2f28c1,_0x33f931,_0x154800,_0xe62e1e)['then'](function(_0x754b07){logger[_0xc16c('0xe')](_0xc16c('0x2d'),_0x754b07[_0xc16c('0x2a')]);return _0x2687ec(_0x754b07);});});})[_0xc16c('0x14')](function(_0x13885f){_0x2b3d6d(_0x13885f);});});};}function createEndUser(_0x5309d6,_0x26581e,_0x20467e,_0x46b0d4){return new Promise(function(_0x1c170f,_0x4f233e){var _0xce0c1=moment();var _0x1255f9={'method':_0xc16c('0x2e'),'uri':_0x46b0d4+_0xc16c('0x2f'),'body':{'contact':{'last_name':_0x5309d6[_0xc16c('0x28')],'work_number':_0x5309d6[_0xc16c('0x28')],'mobile_number':_0x5309d6['contactNumber'],'owner_id':_0x5309d6[_0xc16c('0x20')],'created_at':_0xce0c1[_0xc16c('0x25')](_0xc16c('0x30'))}},'json':!![]};_0x1255f9[_0xc16c('0xd')]=_0x20467e;logger[_0xc16c('0xe')](_0xc16c('0x31'));return rp(_0x1255f9)[_0xc16c('0x1a')](function(_0x93f257){_0x5309d6[_0xc16c('0x2a')]=_0x93f257[_0xc16c('0x32')]['id'];_0x1c170f(_0x5309d6);})[_0xc16c('0x14')](function(_0x390ada){logger[_0xc16c('0x15')]('['+[_0x26581e[_0xc16c('0x16')]()]+']',_0x390ada[_0xc16c('0x17')]);_0x4f233e(_0x390ada[_0xc16c('0x17')]);});});}function getTicket(_0x241618,_0x42a1de,_0x4cac46,_0x1d5147,_0x5c91ea){return function(_0x46becc){logger['info'](_0xc16c('0x33'));return new Promise(function(_0x5bbcde,_0x4589ac){var _0x54ff19=moment();var _0x269185={'method':'POST','uri':_0x4cac46+_0xc16c('0x34'),'body':{'title':intUtil[_0xc16c('0x35')](_0x1d5147[_0xc16c('0x36')],_0x5c91ea,'\x20'),'description':intUtil[_0xc16c('0x35')](_0x1d5147[_0xc16c('0x37')],_0x5c91ea,'\x0a'),'owner_id':_0x46becc[_0xc16c('0x20')],'creater_id':_0x46becc['adminId'],'targetable_id':_0x46becc[_0xc16c('0x2a')],'targetable_type':'Contact','created_at':_0x54ff19[_0xc16c('0x25')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x54ff19[_0xc16c('0x38')](0x1e,'m')['format'](_0xc16c('0x30'))},'json':!![]};_0x269185[_0xc16c('0xd')]=_0x42a1de;return rp(_0x269185)[_0xc16c('0x1a')](function(_0x5a7b45){_0x46becc[_0xc16c('0x39')]=_0x5a7b45[_0xc16c('0x3a')]['id'];logger[_0xc16c('0xe')](_0xc16c('0x3b'),_0x46becc[_0xc16c('0x39')]);_0x5bbcde(_0x46becc);})[_0xc16c('0x14')](function(_0x2b7ee5){logger['error']('['+[_0x241618['toUpperCase']()]+']',_0x2b7ee5[_0xc16c('0x17')]);_0x4589ac(_0x2b7ee5['message']);});});};}function emit(_0x959d7b,_0x221358,_0x55b1ff){var _0xbdc0c7={'uri':_0x959d7b+'/contacts/'+_0x55b1ff};io['to'](util[_0xc16c('0x25')](_0xc16c('0x3c'),_0x221358))[_0xc16c('0x3d')](_0xc16c('0x3e'),_0xbdc0c7);}exports['cs']=function(_0x378aca,_0x2b66f1,_0x4fb9a2,_0xb54b05,_0x55607f,_0x39a6df,_0x538eed,_0x4f2f2b){var _0x15ff96={};var _0xd6524a={'Authorization':'Token\x20token='+_0x39a6df['apiKey']};_0x39a6df['remoteUri']=intUtil['stripTrailingSlash'](_0x39a6df[_0xc16c('0x3f')]);_0x39a6df[_0xc16c('0x40')]=intUtil[_0xc16c('0x41')](_0x39a6df['serverUrl']);var _0x46968e=_0x39a6df[_0xc16c('0x3f')];_0x15ff96[_0xc16c('0x10')]=_0x39a6df[_0xc16c('0x42')];_0x15ff96[_0xc16c('0x28')]=_0x4f2f2b['toLowerCase']()===_0xc16c('0x43')?_0x2b66f1['destcalleridnum']:_0x2b66f1['calleridnum'];_0x15ff96[_0xc16c('0x44')]=_0x4f2f2b===_0xc16c('0x45')||_0x4f2f2b===_0xc16c('0x46')?_0xc16c('0x45'):_0xc16c('0x43');if(_0xb54b05){_0x15ff96[_0xc16c('0x1b')]=_0xb54b05['email'];}var _0x1df687=util[_0xc16c('0x25')](_0xc16c('0x47'),_0x39a6df[_0xc16c('0x40')],_0x2b66f1[_0xc16c('0x48')],md5(_0x2b66f1[_0xc16c('0x48')]));if(_0x55607f&&_0x55607f[_0xc16c('0x49')]){logger[_0xc16c('0xe')]('[QUEUE]',_0xc16c('0x4a'));_0x2b66f1[_0xc16c('0x4b')]=_0x1df687;}else if(_0x538eed&&_0x538eed[_0xc16c('0x4c')]&&_0x538eed[_0xc16c('0x4c')]!==_0xc16c('0x4d')){logger[_0xc16c('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2b66f1[_0xc16c('0x4b')]=_0x1df687;}else{_0x2b66f1[_0xc16c('0x4b')]='';}return getAdminId(_0x15ff96,_0x4f2f2b,_0xd6524a,_0x46968e)[_0xc16c('0x1a')](getUser(_0x4f2f2b,_0xd6524a,_0x46968e))[_0xc16c('0x1a')](getEndUser(_0x4f2f2b,_0xd6524a,_0x46968e))['then'](getTicket(_0x4f2f2b,_0xd6524a,_0x46968e,_0x4fb9a2,_0x2b66f1))[_0xc16c('0x1a')](function(_0x510b32){logger[_0xc16c('0xe')](util[_0xc16c('0x25')](_0xc16c('0x4e'),_0x510b32[_0xc16c('0x39')]));if(_0x4f2f2b!==_0xc16c('0x46')){logger['info']('['+[_0x4f2f2b[_0xc16c('0x16')]()]+']',_0xc16c('0x4f'));emit(_0x46968e,_0xb54b05[_0xc16c('0x50')],_0x510b32[_0xc16c('0x2a')]);}})[_0xc16c('0x14')](function(_0x3632f7){logger[_0xc16c('0x15')]('['+[_0x4f2f2b[_0xc16c('0x16')]()]+_0xc16c('0x51'),util[_0xc16c('0x52')](_0x3632f7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xacd6=['socket.io-emitter','GET','/api/selector/owners','headers','info','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','Admin\x20selected','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','endUserId','work_number','contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Subjects','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0xacd6,0xef));var _0x6acd=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xacd6[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0x6acd('0x0'));var rp=require(_0x6acd('0x1'));var md5=require(_0x6acd('0x2'));var util=require(_0x6acd('0x3'));var moment=require(_0x6acd('0x4'));var Promise=require(_0x6acd('0x5'));var Redis=require(_0x6acd('0x6'));var intUtil=require(_0x6acd('0x7'));var config=require(_0x6acd('0x8'));var logger=require(_0x6acd('0x9'))(_0x6acd('0xa'));config[_0x6acd('0xb')]=_['defaults'](config[_0x6acd('0xb')],{'host':_0x6acd('0xc'),'port':0x18eb});var io=require(_0x6acd('0xd'))(new Redis(config[_0x6acd('0xb')]));function getAdminId(_0x1b834a,_0x225a49,_0xd33e33,_0x300c2e){return new Promise(function(_0x4aff1d,_0x35c08d){var _0x20deb7=![];var _0x211c33={'method':_0x6acd('0xe'),'uri':_0x300c2e+_0x6acd('0xf'),'json':!![]};_0x211c33[_0x6acd('0x10')]=_0xd33e33;logger[_0x6acd('0x11')]('Getting\x20admin\x20information');return rp(_0x211c33)['then'](function(_0x40345e){if(_0x40345e){var _0xba49b4=_0x40345e[_0x6acd('0x12')];var _0x48bb0b=null;for(_0x48bb0b=0x0;_0x48bb0b<_0xba49b4[_0x6acd('0x13')];_0x48bb0b++){if(_0xba49b4[_0x48bb0b][_0x6acd('0x14')]===_0x1b834a[_0x6acd('0x15')]){_0x1b834a[_0x6acd('0x16')]=_0xba49b4[_0x48bb0b]['id'];_0x20deb7=!![];}}if(_0x20deb7){logger[_0x6acd('0x11')](_0x6acd('0x17'),_0x1b834a[_0x6acd('0x16')]);_0x4aff1d(_0x1b834a);}else{_0x35c08d({'statusCode':0x194,'message':_0x6acd('0x18')});}}else{_0x35c08d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6acd('0x19')](function(_0x6f0d63){logger[_0x6acd('0x1a')]('['+[_0x225a49[_0x6acd('0x1b')]()]+']',_0x6f0d63[_0x6acd('0x1c')]);_0x35c08d(_0x6f0d63);});});}function getUser(_0x5d0a63,_0x4cfa65,_0x4274e5){return function(_0x13557f){return new Promise(function(_0x55a0b9,_0xf0c6f5){var _0x581ce1={'method':_0x6acd('0xe'),'uri':_0x4274e5+_0x6acd('0xf'),'json':!![]};_0x581ce1[_0x6acd('0x10')]=_0x4cfa65;logger[_0x6acd('0x11')](_0x6acd('0x1d'));return rp(_0x581ce1)[_0x6acd('0x1e')](function(_0x2c53b8){if(_0x2c53b8){var _0x3b5ab2=_0x2c53b8['users'];var _0x3d5a6a=![];var _0x48f328=null;if(_0x13557f[_0x6acd('0x1f')]!==null){logger[_0x6acd('0x11')](_0x6acd('0x20'),_0x13557f['agentEmail']);_0x13557f['userEmail']=_0x13557f[_0x6acd('0x1f')];for(_0x48f328=0x0;_0x48f328<_0x3b5ab2[_0x6acd('0x13')];_0x48f328++){if(_0x3b5ab2[_0x48f328]['email']===_0x13557f[_0x6acd('0x1f')]){_0x3d5a6a=!![];_0x13557f['userId']=_0x3b5ab2[_0x48f328]['id'];logger['info'](_0x6acd('0x21'),_0x13557f[_0x6acd('0x22')]);}}}if(!_0x3d5a6a){logger['info'](_0x6acd('0x23'));_0x13557f['userEmail']=_0x13557f[_0x6acd('0x15')];_0x13557f[_0x6acd('0x22')]=_0x13557f[_0x6acd('0x16')];_0x3d5a6a=!![];}if(_0x3d5a6a){_0x55a0b9(_0x13557f);}else{_0xf0c6f5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xf0c6f5({'statusCode':0x194,'message':_0x6acd('0x18')});}})[_0x6acd('0x19')](function(_0x97fa14){logger[_0x6acd('0x1a')]('['+[_0x5d0a63[_0x6acd('0x1b')]()]+']',_0x97fa14[_0x6acd('0x1c')]);_0xf0c6f5(_0x97fa14);});});};}function searchContact(_0x400380,_0x4f1b6d,_0xbec1bc,_0x288027){return new Promise(function(_0x592c1a,_0x229269){var _0x5bc3cb={'method':'GET','headers':_0x4f1b6d,'uri':_0x400380+'/api/lookup?q='+_0x288027+_0x6acd('0x24')+_0xbec1bc+_0x6acd('0x25'),'json':!![]};rp(_0x5bc3cb)[_0x6acd('0x1e')](function(_0x599787){var _0x58e3ef=_[_0x6acd('0x26')](_0x599787[_0x6acd('0x27')]['contacts'],[_0xbec1bc,_0x288027]);_0x592c1a(_0x58e3ef);})[_0x6acd('0x19')](function(_0x32360e){_0x229269(_0x32360e);});});}function getEndUser(_0x5511f5,_0x6a7f28,_0x1ac924){return function(_0x9bf151){return new Promise(function(_0x4d133f,_0x3a3fa2){logger[_0x6acd('0x11')](util[_0x6acd('0x28')](_0x6acd('0x29'),_0x9bf151['contactNumber']));searchContact(_0x1ac924,_0x6a7f28,'mobile_number',_0x9bf151['contactNumber'])[_0x6acd('0x1e')](function(_0x47d89d){if(_0x47d89d){_0x9bf151[_0x6acd('0x2a')]=_0x47d89d['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x9bf151[_0x6acd('0x2a')]);return _0x4d133f(_0x9bf151);}searchContact(_0x1ac924,_0x6a7f28,_0x6acd('0x2b'),_0x9bf151[_0x6acd('0x2c')])['then'](function(_0xbbdd9f){if(_0xbbdd9f){_0x9bf151['endUserId']=_0xbbdd9f['id'];logger[_0x6acd('0x11')](_0x6acd('0x2d'),_0x9bf151[_0x6acd('0x2a')]);return _0x4d133f(_0x9bf151);}createEndUser(_0x9bf151,_0x5511f5,_0x6a7f28,_0x1ac924)[_0x6acd('0x1e')](function(_0x179550){logger[_0x6acd('0x11')](_0x6acd('0x2e'),_0x179550[_0x6acd('0x2a')]);return _0x4d133f(_0x179550);});});})[_0x6acd('0x19')](function(_0x27be63){_0x3a3fa2(_0x27be63);});});};}function createEndUser(_0x2553d2,_0x21c388,_0x13a1e1,_0x5aa8f8){return new Promise(function(_0x5d81bc,_0x222466){var _0x3582d1=moment();var _0x548a0f={'method':_0x6acd('0x2f'),'uri':_0x5aa8f8+_0x6acd('0x30'),'body':{'contact':{'last_name':_0x2553d2[_0x6acd('0x2c')],'work_number':_0x2553d2[_0x6acd('0x2c')],'mobile_number':_0x2553d2[_0x6acd('0x2c')],'owner_id':_0x2553d2[_0x6acd('0x22')],'created_at':_0x3582d1[_0x6acd('0x28')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x548a0f[_0x6acd('0x10')]=_0x13a1e1;logger[_0x6acd('0x11')](_0x6acd('0x31'));return rp(_0x548a0f)['then'](function(_0x9c2cb6){_0x2553d2[_0x6acd('0x2a')]=_0x9c2cb6[_0x6acd('0x32')]['id'];_0x5d81bc(_0x2553d2);})[_0x6acd('0x19')](function(_0x226a82){logger[_0x6acd('0x1a')]('['+[_0x21c388[_0x6acd('0x1b')]()]+']',_0x226a82[_0x6acd('0x1c')]);_0x222466(_0x226a82[_0x6acd('0x1c')]);});});}function getTicket(_0x76436b,_0x2d52af,_0x54fc9c,_0x5196f2,_0x12a762){return function(_0x1c4065){logger[_0x6acd('0x11')]('Creating\x20new\x20task');return new Promise(function(_0x19044c,_0x2c3b9c){var _0x11a72c=moment();var _0x1b53b5={'method':_0x6acd('0x2f'),'uri':_0x54fc9c+'/api/tasks','body':{'title':intUtil['getString'](_0x5196f2[_0x6acd('0x33')],_0x12a762,'\x20'),'description':intUtil[_0x6acd('0x34')](_0x5196f2[_0x6acd('0x35')],_0x12a762,'\x0a'),'owner_id':_0x1c4065[_0x6acd('0x22')],'creater_id':_0x1c4065[_0x6acd('0x16')],'targetable_id':_0x1c4065['endUserId'],'targetable_type':_0x6acd('0x36'),'created_at':_0x11a72c[_0x6acd('0x28')](_0x6acd('0x37')),'due_date':_0x11a72c[_0x6acd('0x38')](0x1e,'m')['format'](_0x6acd('0x37'))},'json':!![]};_0x1b53b5[_0x6acd('0x10')]=_0x2d52af;return rp(_0x1b53b5)[_0x6acd('0x1e')](function(_0x46774a){_0x1c4065[_0x6acd('0x39')]=_0x46774a['task']['id'];logger[_0x6acd('0x11')]('Task\x20created:',_0x1c4065[_0x6acd('0x39')]);_0x19044c(_0x1c4065);})[_0x6acd('0x19')](function(_0x38bf77){logger[_0x6acd('0x1a')]('['+[_0x76436b['toUpperCase']()]+']',_0x38bf77[_0x6acd('0x1c')]);_0x2c3b9c(_0x38bf77[_0x6acd('0x1c')]);});});};}function emit(_0x3fe020,_0x2c87e6,_0xffea26){var _0x468df3={'uri':_0x3fe020+'/contacts/'+_0xffea26};io['to'](util[_0x6acd('0x28')](_0x6acd('0x3a'),_0x2c87e6))[_0x6acd('0x3b')]('trigger:browser:url',_0x468df3);}exports['cs']=function(_0x351bd3,_0xb0100b,_0x2a427d,_0x3cf366,_0x47cc62,_0x1aa143,_0x527f1d,_0x276fb1){var _0x1bc305={};var _0x2ec55a={'Authorization':_0x6acd('0x3c')+_0x1aa143[_0x6acd('0x3d')]};_0x1aa143[_0x6acd('0x3e')]=intUtil[_0x6acd('0x3f')](_0x1aa143['remoteUri']);_0x1aa143[_0x6acd('0x40')]=intUtil[_0x6acd('0x3f')](_0x1aa143['serverUrl']);var _0x1d8aa9=_0x1aa143[_0x6acd('0x3e')];_0x1bc305[_0x6acd('0x15')]=_0x1aa143[_0x6acd('0x41')];_0x1bc305['contactNumber']=_0x276fb1[_0x6acd('0x42')]()===_0x6acd('0x43')?_0xb0100b[_0x6acd('0x44')]:_0xb0100b[_0x6acd('0x45')];_0x1bc305[_0x6acd('0x46')]=_0x276fb1===_0x6acd('0x47')||_0x276fb1===_0x6acd('0x48')?_0x6acd('0x47'):_0x6acd('0x43');if(_0x3cf366){_0x1bc305['agentEmail']=_0x3cf366['email'];}var _0x322373=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1aa143[_0x6acd('0x40')],_0xb0100b[_0x6acd('0x49')],md5(_0xb0100b[_0x6acd('0x49')]));if(_0x47cc62&&_0x47cc62[_0x6acd('0x4a')]){logger[_0x6acd('0x11')](_0x6acd('0x4b'),_0x6acd('0x4c'));_0xb0100b[_0x6acd('0x4d')]=_0x322373;}else if(_0x527f1d&&_0x527f1d[_0x6acd('0x4e')]&&_0x527f1d[_0x6acd('0x4e')]!==_0x6acd('0x4f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0xb0100b[_0x6acd('0x4d')]=_0x322373;}else{_0xb0100b[_0x6acd('0x4d')]='';}return getAdminId(_0x1bc305,_0x276fb1,_0x2ec55a,_0x1d8aa9)[_0x6acd('0x1e')](getUser(_0x276fb1,_0x2ec55a,_0x1d8aa9))['then'](getEndUser(_0x276fb1,_0x2ec55a,_0x1d8aa9))[_0x6acd('0x1e')](getTicket(_0x276fb1,_0x2ec55a,_0x1d8aa9,_0x2a427d,_0xb0100b))[_0x6acd('0x1e')](function(_0x182010){logger['info'](util['format'](_0x6acd('0x50'),_0x182010[_0x6acd('0x39')]));if(_0x276fb1!=='unmanaged'){logger[_0x6acd('0x11')]('['+[_0x276fb1[_0x6acd('0x1b')]()]+']',_0x6acd('0x51'));emit(_0x1d8aa9,_0x3cf366[_0x6acd('0x52')],_0x182010[_0x6acd('0x2a')]);}})[_0x6acd('0x19')](function(_0x1add17){logger[_0x6acd('0x1a')]('['+[_0x276fb1[_0x6acd('0x1b')]()]+_0x6acd('0x53'),util['inspect'](_0x1add17,{'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 f21a981..2517725 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 _0x9ffd=['unknown\x20integration','error','../../../../config/logger','[EXEC]','format','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','data2','Configurations','data3','queue','unmanaged','servicenow','log'];(function(_0x132889,_0x2207a8){var _0xd93752=function(_0x572faa){while(--_0x572faa){_0x132889['push'](_0x132889['shift']());}};_0xd93752(++_0x2207a8);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x45d87d,_0x2cbfa5){_0x45d87d=_0x45d87d-0x0;var _0x20c1d3=_0x9ffd[_0x45d87d];return _0x20c1d3;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var zendesk=require(_0xd9ff('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xd9ff('0x3'));var freshdesk=require(_0xd9ff('0x4'));var zoho=require(_0xd9ff('0x5'));var desk=require(_0xd9ff('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0xd9ff('0x7'));var dynamics365=require(_0xd9ff('0x8'));var freshsales=require('./freshsales');var integrations=[_0xd9ff('0x9'),_0xd9ff('0xa'),_0xd9ff('0xb'),_0xd9ff('0xc'),_0xd9ff('0xd'),_0xd9ff('0xe'),_0xd9ff('0xf'),_0xd9ff('0x10'),_0xd9ff('0x11'),'servicenow'];exports['exec']=function(_0x567f79,_0x5aa954,_0x2355ab,_0x2fd77a,_0x193537,_0x32b48f){if(_0x2355ab){if(_[_0xd9ff('0x12')](integrations,_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]())){try{var _0x1c2a16=null;var _0x47d842='';var _0x47b0d7=_0x2355ab[_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]()];if(_0x47b0d7){var _0x415c58=_0x47b0d7[_0x567f79[_0xd9ff('0x15')]];if(_0x415c58){var _0x12c39a=_['find'](_0x415c58[_0xd9ff('0x16')],{'id':parseInt(_0x567f79[_0xd9ff('0x17')],0xa)});if(_0x12c39a){if(_0x2fd77a){if(_0x193537&&_0x5aa954['queue']){_0x47d842=_0xd9ff('0x18');}else if(_0x5aa954['routeId']){_0x47d842='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x5aa954);}}else{_0x47d842=_0xd9ff('0x19');}switch(_0x567f79['data1'][_0xd9ff('0x14')]()){case _0xd9ff('0x9'):zendesk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xa'):salesforce[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xb'):sugarcrm[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xc'):freshdesk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xd'):zoho[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xe'):desk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xf'):vtiger[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0x11'):freshsales['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;case _0xd9ff('0x1a'):servicenow['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;case _0xd9ff('0x10'):dynamics365['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;default:console[_0xd9ff('0x1b')](_0xd9ff('0x1c'));}}else{_0x1c2a16=require('../../../../config/logger')(_0x567f79['data1'][_0xd9ff('0x14')]());_0x1c2a16[_0xd9ff('0x1d')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x567f79['data1'][_0xd9ff('0x14')](),_0x567f79['data3']));}}else{_0x1c2a16=require(_0xd9ff('0x1e'))(_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]());_0x1c2a16[_0xd9ff('0x1d')](_0xd9ff('0x1f'),util[_0xd9ff('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x567f79['data1'][_0xd9ff('0x14')](),_0x567f79['data2']));}}else{}}catch(_0x3ca906){console['error'](_0x3ca906);}}}}; \ No newline at end of file +var _0x7708=['./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','data1','toLowerCase','data2','find','Configurations','queue','outbound','EVENT\x20UNKNOWN','zendesk','freshsales','log','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./vtiger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7708,0x188));var _0x8770=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x7708[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x8770('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x8770('0x3'));var servicenow=require(_0x8770('0x4'));var dynamics365=require('./dynamics365');var freshsales=require(_0x8770('0x5'));var integrations=['zendesk',_0x8770('0x6'),_0x8770('0x7'),_0x8770('0x8'),_0x8770('0x9'),_0x8770('0xa'),_0x8770('0xb'),_0x8770('0xc'),'freshsales',_0x8770('0xd')];exports[_0x8770('0xe')]=function(_0x3f357a,_0x4e4551,_0x390af0,_0x10e4a3,_0x3bbee2,_0x3d81ab){if(_0x390af0){if(_['includes'](integrations,_0x3f357a[_0x8770('0xf')][_0x8770('0x10')]())){try{var _0x2adcbf=null;var _0x51efbc='';var _0xb52d60=_0x390af0[_0x3f357a[_0x8770('0xf')][_0x8770('0x10')]()];if(_0xb52d60){var _0x3ba999=_0xb52d60[_0x3f357a[_0x8770('0x11')]];if(_0x3ba999){var _0x12a06f=_[_0x8770('0x12')](_0x3ba999[_0x8770('0x13')],{'id':parseInt(_0x3f357a['data3'],0xa)});if(_0x12a06f){if(_0x10e4a3){if(_0x3bbee2&&_0x4e4551[_0x8770('0x14')]){_0x51efbc=_0x8770('0x14');}else if(_0x4e4551['routeId']){_0x51efbc=_0x8770('0x15');}else{console['log'](_0x8770('0x16'),_0x4e4551);}}else{_0x51efbc='unmanaged';}switch(_0x3f357a['data1']['toLowerCase']()){case _0x8770('0x17'):zendesk[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0x6'):salesforce[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0x7'):sugarcrm[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0x8'):freshdesk[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case'zoho':zoho[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case'desk':desk[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0xb'):vtiger[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0x18'):freshsales['cs'](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab,_0x51efbc);break;case _0x8770('0xd'):servicenow['cs'](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab,_0x51efbc);break;case _0x8770('0xc'):dynamics365['cs'](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab,_0x51efbc);break;default:console[_0x8770('0x19')]('unknown\x20integration');}}else{_0x2adcbf=require(_0x8770('0x1a'))(_0x3f357a[_0x8770('0xf')][_0x8770('0x10')]());_0x2adcbf[_0x8770('0x1b')]('[EXEC]',util['format'](_0x8770('0x1c'),_0x3f357a[_0x8770('0xf')][_0x8770('0x10')](),_0x3f357a[_0x8770('0x1d')]));}}else{_0x2adcbf=require(_0x8770('0x1a'))(_0x3f357a[_0x8770('0xf')]['toLowerCase']());_0x2adcbf[_0x8770('0x1b')](_0x8770('0x1e'),util[_0x8770('0x1f')](_0x8770('0x20'),_0x3f357a['data1'][_0x8770('0x10')](),_0x3f357a['data2']));}}else{}}catch(_0x7b4755){console[_0x8770('0x1b')](_0x7b4755);}}}}; \ 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 461ae2a..76d5a4f 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 _0x4601=['contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','create','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','account','WhatId','Case','ContactId','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4601,0x1cf));var _0x1460=function(_0x3a8809,_0x31e0c){_0x3a8809=_0x3a8809-0x0;var _0x46734f=_0x4601[_0x3a8809];return _0x46734f;};'use strict';var _=require(_0x1460('0x0'));var rp=require(_0x1460('0x1'));var moment=require(_0x1460('0x2'));var BPromise=require(_0x1460('0x3'));var md5=require(_0x1460('0x4'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x1460('0x5'));var intUtil=require(_0x1460('0x6'));var config=require(_0x1460('0x7'));var logger=require('../../../../config/logger')(_0x1460('0x8'));config[_0x1460('0x9')]=_[_0x1460('0xa')](config[_0x1460('0x9')],{'host':_0x1460('0xb'),'port':0x18eb});var io=require(_0x1460('0xc'))(new Redis(config[_0x1460('0x9')]));function emit(_0x462b63,_0x3ce025,_0x18bf23){io['to'](_0x462b63)[_0x1460('0xd')](_0x3ce025,_0x18bf23);}function getTicket(_0x49b4eb,_0x306fe6,_0x42ae31,_0x5462e5,_0x108864,_0x4c01a7,_0x47166c,_0x4fe989){var _0x57216d=Object[_0x1460('0xe')]({},{'OwnerId':_0x306fe6['id'],'Subject':intUtil[_0x1460('0xf')](_0x5462e5[_0x1460('0x10')],_0x108864,'\x20'),'Description':intUtil['getString'](_0x5462e5[_0x1460('0x11')],_0x108864,'\x0a')},getCustomFields(_0x4c01a7,_0x108864));if(_0x42ae31){if(_0x5462e5[_0x1460('0x12')]===_0x1460('0x13')){_0x57216d[_0x1460('0x14')]=moment[_0x1460('0x15')]();_0x57216d['IsReminderSet']=![];_0x57216d[_0x1460('0x16')]=![];if(_0x42ae31[_0x1460('0x17')]===_0x1460('0x18')||_0x42ae31[_0x1460('0x17')]===_0x1460('0x19')){_0x57216d['WhoId']=_0x42ae31['id'];}else if(_0x42ae31[_0x1460('0x17')]===_0x1460('0x1a')){_0x57216d[_0x1460('0x1b')]=_0x42ae31['id'];}}else if(_0x5462e5[_0x1460('0x12')]===_0x1460('0x1c')){if(_0x42ae31['endUserType']==='contact'){_0x57216d[_0x1460('0x1d')]=_0x42ae31['id'];}else if(_0x42ae31['endUserType']===_0x1460('0x1a')){_0x57216d[_0x1460('0x1e')]=_0x42ae31['id'];}else if(_0x42ae31['endUserType']===_0x1460('0x19')&&_0x5462e5['leadId']){_0x57216d[_0x5462e5['leadId']]=_0x42ae31['id'];}else{logger[_0x1460('0x1f')](_0x1460('0x20'));}}}return _0x47166c[_0x1460('0x21')](_0x5462e5[_0x1460('0x12')])['create'](_0x57216d);}function getUser(_0x5aecfd,_0xfe118,_0x47326b){if(!_[_0x1460('0x22')](_0xfe118)&&intUtil['validateEmail'](_0xfe118)){var _0x4efec1={'Email':_0xfe118};var _0x1327a2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x47326b[_0x1460('0x21')](_0x1460('0x23'))[_0x1460('0x24')](_0x4efec1,_0x1327a2)[_0x1460('0x25')]()[_0x1460('0x26')](function(_0x24fdf8){if(_0x24fdf8[_0x1460('0x27')]){var _0x32f9eb=_[_0x1460('0x24')](_0x24fdf8,function(_0x111f1b){return _0x111f1b[_0x1460('0x28')]===_0xfe118;});if(_0x32f9eb){logger[_0x1460('0x1f')](_0x1460('0x29'),_0xfe118);return BPromise[_0x1460('0x2a')]({'id':_0x32f9eb['Id'],'name':_0x32f9eb[_0x1460('0x2b')]});}}else{logger['info'](_0x1460('0x2c'),_0xfe118);return _0x47326b[_0x1460('0x2d')]()['then'](function(_0x1e8cbb){return BPromise['resolve']({'id':_0x1e8cbb['user_id'],'name':_0x1e8cbb['display_name']});});}});}else{logger['info'](_0x1460('0x2c'),_0xfe118);return _0x47326b[_0x1460('0x2d')]()[_0x1460('0x26')](function(_0xfdf6fc){return BPromise['resolve']({'id':_0xfdf6fc[_0x1460('0x2e')],'name':_0xfdf6fc['display_name']});});}}function getEndUser(_0x14ffaa,_0xcf7bc4,_0xefa8e7,_0x311197,_0x2e5f69){var _0x422016={'$or':{'Phone':_0x311197}};var _0x263fd8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1460('0x2a')]()[_0x1460('0x26')](function(){logger[_0x1460('0x1f')](_0x1460('0x2f'),_0x311197,_0xcf7bc4[_0x1460('0x30')]);switch(_0xcf7bc4['moduleSearch']){case _0x1460('0x31'):var _0x21e023=_[_0x1460('0x32')](_0x422016);if(_0xcf7bc4[_0x1460('0x33')]){var _0x2fa786={};_0x2fa786[_0xcf7bc4['additionalSearchContact']]=_0x311197;_[_0x1460('0x34')](_0x21e023[_0x1460('0x35')],_0x2fa786);}return _0x2e5f69[_0x1460('0x21')](_0x1460('0x36'))[_0x1460('0x24')](_0x21e023,_0x263fd8)['execute']()[_0x1460('0x26')](function(_0x26919e){if(_0x26919e&&_0x26919e[_0x1460('0x27')]){return _0x26919e;}else{var _0x5f3bec=_[_0x1460('0x32')](_0x422016);if(_0xcf7bc4[_0x1460('0x37')]){var _0xf9fc67={};_0xf9fc67[_0xcf7bc4['additionalSearchLead']]=_0x311197;_['merge'](_0x5f3bec[_0x1460('0x35')],_0xf9fc67);}return _0x2e5f69[_0x1460('0x21')](_0x1460('0x38'))['find'](_0x5f3bec,_0x263fd8);}});case _0x1460('0x39'):var _0x5746c9=_[_0x1460('0x32')](_0x422016);if(_0xcf7bc4[_0x1460('0x3a')]){var _0x2fa786={};_0x2fa786[_0xcf7bc4[_0x1460('0x3a')]]=_0x311197;_[_0x1460('0x34')](_0x5746c9[_0x1460('0x35')],_0x2fa786);}return _0x2e5f69[_0x1460('0x21')](_0x1460('0x3b'))[_0x1460('0x24')](_0x5746c9,_0x263fd8)[_0x1460('0x25')]()[_0x1460('0x26')](function(_0x2b3c5d){if(_0x2b3c5d&&_0x2b3c5d['length']){return _0x2b3c5d;}else{var _0x378c88=_['cloneDeep'](_0x422016);if(_0xcf7bc4[_0x1460('0x33')]){var _0x2e2055={};_0x2e2055[_0xcf7bc4[_0x1460('0x33')]]=_0x311197;_[_0x1460('0x34')](_0x378c88['$or'],_0x2e2055);}return _0x2e5f69[_0x1460('0x21')](_0x1460('0x36'))[_0x1460('0x24')](_0x378c88,_0x263fd8)[_0x1460('0x26')](function(_0x4e5795){if(_0x4e5795&&_0x4e5795[_0x1460('0x27')]){return _0x4e5795;}else{var _0xe9afff=_['cloneDeep'](_0x422016);if(_0xcf7bc4[_0x1460('0x37')]){var _0x54d50c={};_0x54d50c[_0xcf7bc4[_0x1460('0x37')]]=_0x311197;_['merge'](_0xe9afff['$or'],_0x54d50c);}return _0x2e5f69[_0x1460('0x21')](_0x1460('0x38'))[_0x1460('0x24')](_0xe9afff,_0x263fd8);}});}});case _0x1460('0x18'):var _0x21e023=_['cloneDeep'](_0x422016);if(_0xcf7bc4[_0x1460('0x33')]){var _0x2fa786={};_0x2fa786[_0xcf7bc4[_0x1460('0x33')]]=_0x311197;_[_0x1460('0x34')](_0x21e023['$or'],_0x2fa786);}return _0x2e5f69['sobject'](_0x1460('0x36'))[_0x1460('0x24')](_0x21e023,_0x263fd8)['execute']();case _0x1460('0x19'):var _0x405281=_[_0x1460('0x32')](_0x422016);if(_0xcf7bc4[_0x1460('0x37')]){var _0x2fa786={};_0x2fa786[_0xcf7bc4[_0x1460('0x37')]]=_0x311197;_[_0x1460('0x34')](_0x405281[_0x1460('0x35')],_0x2fa786);}return _0x2e5f69['sobject'](_0x1460('0x38'))[_0x1460('0x24')](_0x405281,_0x263fd8);case _0x1460('0x1a'):var _0x5746c9=_['cloneDeep'](_0x422016);if(_0xcf7bc4[_0x1460('0x3a')]){var _0x2fa786={};_0x2fa786[_0xcf7bc4['additionalSearchAccount']]=_0x311197;_[_0x1460('0x34')](_0x5746c9[_0x1460('0x35')],_0x2fa786);}return _0x2e5f69['sobject'](_0x1460('0x3b'))['find'](_0x5746c9,_0x263fd8);default:return null;}})[_0x1460('0x26')](function(_0x5c733b){if(_0x5c733b&&_0x5c733b[_0x1460('0x27')]){var _0x53d4fc=_[_0x1460('0x3c')](_0x5c733b);if(_0x53d4fc){return BPromise[_0x1460('0x2a')]({'id':_0x53d4fc['Id'],'name':_0x53d4fc[_0x1460('0x2b')],'phone':_0x53d4fc['Phone'],'endUserType':_0x53d4fc[_0x1460('0x3d')][_0x1460('0x3e')][_0x1460('0x3f')]()});}}})['then'](function(_0x3ac9fd){if(_0x3ac9fd){logger[_0x1460('0x1f')](_0x1460('0x40'),_0x3ac9fd[_0x1460('0x17')],_0x311197);return BPromise['resolve'](_0x3ac9fd);}else{logger[_0x1460('0x1f')](_0x1460('0x41'),_0x311197);var _0x25dcb8={'Phone':_0x311197};if(_0xcf7bc4[_0x1460('0x42')]){if(_0xcf7bc4[_0x1460('0x42')]===_0x1460('0x18')){logger['info'](_0x1460('0x43'),_0x311197,_0xcf7bc4[_0x1460('0x42')]);_0x25dcb8[_0x1460('0x44')]=_0xefa8e7!==_0x1460('0x45')?_0xefa8e7:util[_0x1460('0x46')](_0x1460('0x47'),_0x311197);}else if(_0xcf7bc4[_0x1460('0x42')]===_0x1460('0x19')){logger[_0x1460('0x1f')](_0x1460('0x43'),_0x311197,_0xcf7bc4[_0x1460('0x42')]);_0x25dcb8[_0x1460('0x44')]=_0xefa8e7!==_0x1460('0x45')?_0xefa8e7:util[_0x1460('0x46')]('Caller\x20-\x20%s',_0x311197);_0x25dcb8['Company']=_0x1460('0x48');}else if(_0xcf7bc4[_0x1460('0x42')]===_0x1460('0x1a')){logger[_0x1460('0x1f')](_0x1460('0x43'),_0x311197,_0xcf7bc4[_0x1460('0x42')]);_0x25dcb8[_0x1460('0x2b')]=_0xefa8e7!==''?_0xefa8e7:util['format'](_0x1460('0x47'),_0x311197);}else{return null;}}return _0x2e5f69[_0x1460('0x21')](_['upperFirst'](_0xcf7bc4['moduleCreate']))[_0x1460('0x49')](_0x25dcb8)[_0x1460('0x26')](function(_0x3fa723){return BPromise[_0x1460('0x2a')]({'id':_0x3fa723['id'],'endUserType':_0xcf7bc4['moduleCreate']});});}});}function getCustomFields(_0x3700c4,_0x71b10e){var _0x4f1572={};if(_0x3700c4[_0x1460('0x27')]>0x0){_[_0x1460('0x4a')](_0x3700c4,function(_0xf8fca0){if(_[_0x1460('0x4b')]([_0x1460('0x4c'),_0x1460('0x4d')],_0xf8fca0[_0x1460('0x3e')])&&_0xf8fca0[_0x1460('0x4e')]){_0x4f1572[_0xf8fca0['idField']]=_0xf8fca0[_0x1460('0x4f')][_0x1460('0x50')]();}else if(_0xf8fca0[_0x1460('0x3e')]===_0x1460('0x51')&&_0xf8fca0[_0x1460('0x52')]&&_0xf8fca0[_0x1460('0x4e')]){_0x71b10e[_0xf8fca0[_0x1460('0x52')]]&&(_0x4f1572[_0xf8fca0['idField']]=_0x71b10e[_0xf8fca0['variableName']]['toString']());}else if(_0xf8fca0[_0x1460('0x3e')]===_0x1460('0x53')&&_0xf8fca0[_0x1460('0x54')]&&_0xf8fca0[_0x1460('0x54')][_0x1460('0x55')]&&_0xf8fca0[_0x1460('0x4e')]){_0x71b10e[_0xf8fca0[_0x1460('0x54')][_0x1460('0x55')][_0x1460('0x3f')]()]&&(_0x4f1572[_0xf8fca0[_0x1460('0x4e')]]=_0x71b10e[_0xf8fca0['Variable'][_0x1460('0x55')][_0x1460('0x3f')]()]['toString']());}});}return _0x4f1572;}function getConnection(_0x5580f8){var _0xe72614=_0x5580f8[_0x1460('0x56')]['concat'](_0x5580f8['securityToken']);var _0x5cb01a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5580f8[_0x1460('0x57')]||_0x1460('0x58'),'clientId':_0x5580f8[_0x1460('0x59')],'clientSecret':_0x5580f8[_0x1460('0x5a')]}});return _0x5cb01a['login'](_0x5580f8[_0x1460('0x5b')],_0xe72614)[_0x1460('0x26')](function(){logger['info']('Connection\x20established.');return _0x5cb01a;});}exports['queue']=function(_0x44f457,_0x3c5d8c,_0x49bf6b,_0x155a6d,_0x441416,_0x14d585){var _0x1b34f8,_0x377d47,_0x3de780,_0x4fe4da;_0x14d585['serverUrl']=intUtil[_0x1460('0x5c')](_0x14d585[_0x1460('0x5d')]);_0x14d585['remoteUri']=intUtil[_0x1460('0x5c')](_0x14d585[_0x1460('0x57')]);if(_0x441416&&_0x441416[_0x1460('0x5e')]){logger[_0x1460('0x1f')]('[QUEUE]',_0x1460('0x5f'));_0x3c5d8c['recordingURL']=util[_0x1460('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14d585[_0x1460('0x5d')],_0x3c5d8c['uniqueid'],md5(_0x3c5d8c[_0x1460('0x60')]));}else{_0x3c5d8c['recordingURL']='';}return getConnection(_0x14d585)[_0x1460('0x26')](function(_0x3963f4){_0x4fe4da=_0x3963f4;return getUser(_0x14d585,_0x155a6d[_0x1460('0x61')],_0x4fe4da);})[_0x1460('0x26')](function(_0x23cad3){_0x1b34f8=_0x23cad3;return getEndUser(_0x14d585,_0x49bf6b,_0x3c5d8c[_0x1460('0x62')],_0x3c5d8c[_0x1460('0x63')],_0x4fe4da);})['then'](function(_0x47b32c){_0x377d47=_0x47b32c;return getTicket(_0x14d585,_0x1b34f8,_0x377d47,_0x49bf6b,_0x3c5d8c,_0x49bf6b[_0x1460('0x64')],_0x4fe4da,_0x1460('0x65'));})[_0x1460('0x26')](function(_0x556b35){_0x3de780=_0x556b35;logger[_0x1460('0x1f')](_0x1460('0x66'),_0x3de780['id']);logger[_0x1460('0x1f')](_0x1460('0x67'),_0x3de780['id'],_0x155a6d['name'],_0x14d585[_0x1460('0x3e')]);switch(_0x14d585[_0x1460('0x3e')]){case'integrationTab':emit(util['format']('user:%s',_0x155a6d[_0x1460('0x55')]),_0x1460('0x68'),{'recordId':_0x3de780['id']});break;case _0x1460('0x69'):emit(util[_0x1460('0x46')](_0x1460('0x6a'),_0x155a6d['name']),_0x1460('0x6b'),{'uri':util['format']('%s/%s/e',_0x4fe4da[_0x1460('0x6c')],_0x3de780['id'])});break;default:logger[_0x1460('0x6d')](_0x1460('0x6e'));}})[_0x1460('0x6f')](function(_0x505dd7){logger[_0x1460('0x6d')]('[QUEUE]',_0x505dd7);});};exports[_0x1460('0x70')]=function(_0x54b33a,_0x479b44,_0x5a49e7,_0x5a41e4,_0x6ea9b7,_0xd3c6ec,_0x118c98){var _0x4ce069,_0x35a657,_0x173794,_0x217939;_0xd3c6ec['serverUrl']=intUtil['stripTrailingSlash'](_0xd3c6ec[_0x1460('0x5d')]);_0xd3c6ec[_0x1460('0x57')]=intUtil[_0x1460('0x5c')](_0xd3c6ec[_0x1460('0x57')]);if(_0x118c98&&_0x118c98[_0x1460('0x71')]&&_0x118c98[_0x1460('0x71')]!==_0x1460('0x72')){logger[_0x1460('0x1f')](_0x1460('0x73'),_0x1460('0x5f'));_0x479b44[_0x1460('0x74')]=util[_0x1460('0x46')](_0x1460('0x75'),_0xd3c6ec[_0x1460('0x5d')],_0x479b44[_0x1460('0x60')],md5(_0x479b44['uniqueid']));}return getConnection(_0xd3c6ec)[_0x1460('0x26')](function(_0xc533b0){_0x217939=_0xc533b0;return getUser(_0xd3c6ec,_0x5a41e4[_0x1460('0x61')],_0x217939);})[_0x1460('0x26')](function(_0x4be5a9){_0x4ce069=_0x4be5a9;return getEndUser(_0xd3c6ec,_0x5a49e7,_0x479b44['destcalleridname'],_0x479b44[_0x1460('0x76')],_0x217939);})[_0x1460('0x26')](function(_0x2b16dc){_0x35a657=_0x2b16dc;return getTicket(_0xd3c6ec,_0x4ce069,_0x35a657,_0x5a49e7,_0x479b44,_0x5a49e7[_0x1460('0x64')],_0x217939,_0x1460('0x70'));})[_0x1460('0x26')](function(_0x20bef0){_0x173794=_0x20bef0;logger['info'](_0x1460('0x77'),_0x173794['id']);logger[_0x1460('0x1f')](_0x1460('0x78'),_0x173794['id'],_0x5a41e4[_0x1460('0x55')],_0xd3c6ec[_0x1460('0x3e')]);switch(_0xd3c6ec[_0x1460('0x3e')]){case _0x1460('0x79'):emit(util[_0x1460('0x46')](_0x1460('0x6a'),_0x5a41e4[_0x1460('0x55')]),'trigger:salesforce:display',{'recordId':_0x173794['id']});break;case'newTab':emit(util[_0x1460('0x46')](_0x1460('0x6a'),_0x5a41e4[_0x1460('0x55')]),_0x1460('0x6b'),{'uri':util[_0x1460('0x46')]('%s/%s/e',_0x217939[_0x1460('0x6c')],_0x173794['id'])});break;default:logger[_0x1460('0x6d')](_0x1460('0x73'),_0x1460('0x7a'));}})[_0x1460('0x6f')](function(_0xbe335a){logger[_0x1460('0x6d')]('[OUTBOUND]',_0xbe335a);});};exports[_0x1460('0x7b')]=function(_0x5370f2,_0x5b3cfd,_0x29e84d,_0xf7a8b,_0x5f02b9,_0x491df1){var _0x2480e9,_0x28698f,_0x4b06ae,_0x3eee94;_0x491df1[_0x1460('0x5d')]=intUtil[_0x1460('0x5c')](_0x491df1['serverUrl']);_0x491df1[_0x1460('0x57')]=intUtil[_0x1460('0x5c')](_0x491df1[_0x1460('0x57')]);if(_0x5f02b9&&_0x5f02b9[_0x1460('0x5e')]){logger[_0x1460('0x1f')]('['+_0x5b3cfd[_0x1460('0x7c')]['toUpperCase']()+']',_0x1460('0x5f'));_0x5b3cfd[_0x1460('0x74')]=util[_0x1460('0x46')](_0x1460('0x75'),_0x491df1[_0x1460('0x5d')],_0x5b3cfd[_0x1460('0x60')],md5(_0x5b3cfd[_0x1460('0x60')]));}else{_0x5b3cfd['recordingURL']='';}return getConnection(_0x491df1)[_0x1460('0x26')](function(_0x415476){_0x3eee94=_0x415476;if(!_[_0x1460('0x22')](_0xf7a8b)){return getUser(_0x491df1,_0xf7a8b[_0x1460('0x55')],_0x3eee94);}else{return getUser(_0x491df1,null,_0x3eee94);}})['then'](function(_0x213251){_0x2480e9=_0x213251;return getEndUser(_0x491df1,_0x29e84d,_0x5b3cfd[_0x1460('0x62')],_0x5b3cfd[_0x1460('0x63')],_0x3eee94);})[_0x1460('0x26')](function(_0x188d64){_0x28698f=_0x188d64;return getTicket(_0x491df1,_0x2480e9,_0x28698f,_0x29e84d,_0x5b3cfd,_0x29e84d['Fields'],_0x3eee94);})[_0x1460('0x26')](function(_0x59c1a3){_0x4b06ae=_0x59c1a3;logger[_0x1460('0x1f')]('['+_0x5b3cfd['lastevent'][_0x1460('0x7d')]()+_0x1460('0x7e'),_0x4b06ae['id']);logger[_0x1460('0x1f')]('['+_0x5b3cfd[_0x1460('0x7c')][_0x1460('0x7d')]()+_0x1460('0x7f'),_0x491df1[_0x1460('0x3e')]);})['catch'](function(_0x1f3727){logger['error']('['+_0x5b3cfd[_0x1460('0x7c')][_0x1460('0x7d')]()+']',_0x1f3727);});}; \ No newline at end of file +var _0x81a7=['salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','account','WhatId','Case','contact','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Contact','Account','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','lead','Company','forEach','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','[OUTBOUND]','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x81a7,0x174));var _0x781a=function(_0x3546a8,_0x148de7){_0x3546a8=_0x3546a8-0x0;var _0x5929a7=_0x81a7[_0x3546a8];return _0x5929a7;};'use strict';var _=require(_0x781a('0x0'));var rp=require(_0x781a('0x1'));var moment=require('moment');var BPromise=require(_0x781a('0x2'));var md5=require(_0x781a('0x3'));var jsforce=require(_0x781a('0x4'));var util=require(_0x781a('0x5'));var Redis=require(_0x781a('0x6'));var intUtil=require(_0x781a('0x7'));var config=require('../../../../config/environment');var logger=require(_0x781a('0x8'))(_0x781a('0x9'));config['redis']=_[_0x781a('0xa')](config[_0x781a('0xb')],{'host':_0x781a('0xc'),'port':0x18eb});var io=require(_0x781a('0xd'))(new Redis(config[_0x781a('0xb')]));function emit(_0x324739,_0x34f319,_0x57c011){io['to'](_0x324739)[_0x781a('0xe')](_0x34f319,_0x57c011);}function getTicket(_0x2c92b8,_0x22b53f,_0x2c3f1c,_0x62318,_0x42219d,_0x1069fe,_0x2a0056,_0x1c1c36){var _0x46676f=Object[_0x781a('0xf')]({},{'OwnerId':_0x22b53f['id'],'Subject':intUtil[_0x781a('0x10')](_0x62318[_0x781a('0x11')],_0x42219d,'\x20'),'Description':intUtil[_0x781a('0x10')](_0x62318[_0x781a('0x12')],_0x42219d,'\x0a')},getCustomFields(_0x1069fe,_0x42219d));if(_0x2c3f1c){if(_0x62318[_0x781a('0x13')]===_0x781a('0x14')){_0x46676f[_0x781a('0x15')]=moment[_0x781a('0x16')]();_0x46676f[_0x781a('0x17')]=![];_0x46676f['IsRecurrence']=![];if(_0x2c3f1c[_0x781a('0x18')]==='contact'||_0x2c3f1c[_0x781a('0x18')]==='lead'){_0x46676f['WhoId']=_0x2c3f1c['id'];}else if(_0x2c3f1c[_0x781a('0x18')]===_0x781a('0x19')){_0x46676f[_0x781a('0x1a')]=_0x2c3f1c['id'];}}else if(_0x62318[_0x781a('0x13')]===_0x781a('0x1b')){if(_0x2c3f1c['endUserType']===_0x781a('0x1c')){_0x46676f['ContactId']=_0x2c3f1c['id'];}else if(_0x2c3f1c[_0x781a('0x18')]===_0x781a('0x19')){_0x46676f[_0x781a('0x1d')]=_0x2c3f1c['id'];}else if(_0x2c3f1c['endUserType']==='lead'&&_0x62318[_0x781a('0x1e')]){_0x46676f[_0x62318[_0x781a('0x1e')]]=_0x2c3f1c['id'];}else{logger[_0x781a('0x1f')](_0x781a('0x20'));}}}return _0x2a0056[_0x781a('0x21')](_0x62318[_0x781a('0x13')])[_0x781a('0x22')](_0x46676f);}function getUser(_0x21610a,_0x3f0890,_0x9609dc){if(!_[_0x781a('0x23')](_0x3f0890)&&intUtil['validateEmail'](_0x3f0890)){var _0x37e19d={'Email':_0x3f0890};var _0x6f82ff={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x9609dc[_0x781a('0x21')](_0x781a('0x24'))[_0x781a('0x25')](_0x37e19d,_0x6f82ff)[_0x781a('0x26')]()['then'](function(_0x1b3fc5){if(_0x1b3fc5[_0x781a('0x27')]){var _0x4a0e92=_[_0x781a('0x25')](_0x1b3fc5,function(_0x2d433e){return _0x2d433e[_0x781a('0x28')]===_0x3f0890;});if(_0x4a0e92){logger['info'](_0x781a('0x29'),_0x3f0890);return BPromise[_0x781a('0x2a')]({'id':_0x4a0e92['Id'],'name':_0x4a0e92[_0x781a('0x2b')]});}}else{logger[_0x781a('0x1f')](_0x781a('0x2c'),_0x3f0890);return _0x9609dc[_0x781a('0x2d')]()[_0x781a('0x2e')](function(_0x4e0ef2){return BPromise[_0x781a('0x2a')]({'id':_0x4e0ef2[_0x781a('0x2f')],'name':_0x4e0ef2[_0x781a('0x30')]});});}});}else{logger[_0x781a('0x1f')](_0x781a('0x2c'),_0x3f0890);return _0x9609dc[_0x781a('0x2d')]()['then'](function(_0x17935a){return BPromise['resolve']({'id':_0x17935a['user_id'],'name':_0x17935a[_0x781a('0x30')]});});}}function getEndUser(_0x5a992b,_0x5d9f7c,_0x14a76c,_0x234ba6,_0x2c5d16){var _0x29f34b={'$or':{'Phone':_0x234ba6}};var _0xf9719c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x781a('0x2e')](function(){logger[_0x781a('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x234ba6,_0x5d9f7c['moduleSearch']);switch(_0x5d9f7c['moduleSearch']){case _0x781a('0x31'):var _0x2d4f7f=_[_0x781a('0x32')](_0x29f34b);if(_0x5d9f7c[_0x781a('0x33')]){var _0x4cc0b2={};_0x4cc0b2[_0x5d9f7c['additionalSearchContact']]=_0x234ba6;_[_0x781a('0x34')](_0x2d4f7f[_0x781a('0x35')],_0x4cc0b2);}return _0x2c5d16[_0x781a('0x21')]('Contact')[_0x781a('0x25')](_0x2d4f7f,_0xf9719c)[_0x781a('0x26')]()[_0x781a('0x2e')](function(_0x3f8018){if(_0x3f8018&&_0x3f8018[_0x781a('0x27')]){return _0x3f8018;}else{var _0x395ce3=_[_0x781a('0x32')](_0x29f34b);if(_0x5d9f7c['additionalSearchLead']){var _0x3b019c={};_0x3b019c[_0x5d9f7c[_0x781a('0x36')]]=_0x234ba6;_['merge'](_0x395ce3[_0x781a('0x35')],_0x3b019c);}return _0x2c5d16['sobject'](_0x781a('0x37'))[_0x781a('0x25')](_0x395ce3,_0xf9719c);}});case _0x781a('0x38'):var _0x3b22c9=_[_0x781a('0x32')](_0x29f34b);if(_0x5d9f7c[_0x781a('0x39')]){var _0x4cc0b2={};_0x4cc0b2[_0x5d9f7c[_0x781a('0x39')]]=_0x234ba6;_[_0x781a('0x34')](_0x3b22c9['$or'],_0x4cc0b2);}return _0x2c5d16[_0x781a('0x21')]('Account')[_0x781a('0x25')](_0x3b22c9,_0xf9719c)[_0x781a('0x26')]()[_0x781a('0x2e')](function(_0x3197a7){if(_0x3197a7&&_0x3197a7[_0x781a('0x27')]){return _0x3197a7;}else{var _0x477d8c=_[_0x781a('0x32')](_0x29f34b);if(_0x5d9f7c['additionalSearchContact']){var _0x3935c7={};_0x3935c7[_0x5d9f7c[_0x781a('0x33')]]=_0x234ba6;_[_0x781a('0x34')](_0x477d8c[_0x781a('0x35')],_0x3935c7);}return _0x2c5d16['sobject'](_0x781a('0x3a'))[_0x781a('0x25')](_0x477d8c,_0xf9719c)[_0x781a('0x2e')](function(_0x48b230){if(_0x48b230&&_0x48b230[_0x781a('0x27')]){return _0x48b230;}else{var _0x1c5790=_[_0x781a('0x32')](_0x29f34b);if(_0x5d9f7c['additionalSearchLead']){var _0x1799af={};_0x1799af[_0x5d9f7c[_0x781a('0x36')]]=_0x234ba6;_[_0x781a('0x34')](_0x1c5790[_0x781a('0x35')],_0x1799af);}return _0x2c5d16['sobject'](_0x781a('0x37'))['find'](_0x1c5790,_0xf9719c);}});}});case _0x781a('0x1c'):var _0x2d4f7f=_[_0x781a('0x32')](_0x29f34b);if(_0x5d9f7c['additionalSearchContact']){var _0x4cc0b2={};_0x4cc0b2[_0x5d9f7c[_0x781a('0x33')]]=_0x234ba6;_[_0x781a('0x34')](_0x2d4f7f[_0x781a('0x35')],_0x4cc0b2);}return _0x2c5d16[_0x781a('0x21')](_0x781a('0x3a'))[_0x781a('0x25')](_0x2d4f7f,_0xf9719c)['execute']();case'lead':var _0x33384e=_[_0x781a('0x32')](_0x29f34b);if(_0x5d9f7c['additionalSearchLead']){var _0x4cc0b2={};_0x4cc0b2[_0x5d9f7c[_0x781a('0x36')]]=_0x234ba6;_[_0x781a('0x34')](_0x33384e[_0x781a('0x35')],_0x4cc0b2);}return _0x2c5d16[_0x781a('0x21')](_0x781a('0x37'))['find'](_0x33384e,_0xf9719c);case'account':var _0x3b22c9=_[_0x781a('0x32')](_0x29f34b);if(_0x5d9f7c['additionalSearchAccount']){var _0x4cc0b2={};_0x4cc0b2[_0x5d9f7c['additionalSearchAccount']]=_0x234ba6;_[_0x781a('0x34')](_0x3b22c9[_0x781a('0x35')],_0x4cc0b2);}return _0x2c5d16['sobject'](_0x781a('0x3b'))[_0x781a('0x25')](_0x3b22c9,_0xf9719c);default:return null;}})[_0x781a('0x2e')](function(_0x48ed38){if(_0x48ed38&&_0x48ed38['length']){var _0x477984=_[_0x781a('0x3c')](_0x48ed38);if(_0x477984){return BPromise[_0x781a('0x2a')]({'id':_0x477984['Id'],'name':_0x477984[_0x781a('0x2b')],'phone':_0x477984['Phone'],'endUserType':_0x477984[_0x781a('0x3d')][_0x781a('0x3e')][_0x781a('0x3f')]()});}}})[_0x781a('0x2e')](function(_0x41c3f5){if(_0x41c3f5){logger['info'](_0x781a('0x40'),_0x41c3f5['endUserType'],_0x234ba6);return BPromise['resolve'](_0x41c3f5);}else{logger[_0x781a('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x234ba6);var _0x2976b1={'Phone':_0x234ba6};if(_0x5d9f7c[_0x781a('0x41')]){if(_0x5d9f7c[_0x781a('0x41')]===_0x781a('0x1c')){logger['info'](_0x781a('0x42'),_0x234ba6,_0x5d9f7c[_0x781a('0x41')]);_0x2976b1[_0x781a('0x43')]=_0x14a76c!==_0x781a('0x44')?_0x14a76c:util[_0x781a('0x45')](_0x781a('0x46'),_0x234ba6);}else if(_0x5d9f7c['moduleCreate']===_0x781a('0x47')){logger[_0x781a('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x234ba6,_0x5d9f7c['moduleCreate']);_0x2976b1[_0x781a('0x43')]=_0x14a76c!==_0x781a('0x44')?_0x14a76c:util[_0x781a('0x45')](_0x781a('0x46'),_0x234ba6);_0x2976b1[_0x781a('0x48')]='No\x20Company';}else if(_0x5d9f7c[_0x781a('0x41')]===_0x781a('0x19')){logger[_0x781a('0x1f')](_0x781a('0x42'),_0x234ba6,_0x5d9f7c[_0x781a('0x41')]);_0x2976b1[_0x781a('0x2b')]=_0x14a76c!==_0x781a('0x44')?_0x14a76c:util[_0x781a('0x45')]('Caller\x20-\x20%s',_0x234ba6);}else{return null;}}return _0x2c5d16[_0x781a('0x21')](_['upperFirst'](_0x5d9f7c['moduleCreate']))['create'](_0x2976b1)[_0x781a('0x2e')](function(_0x4116b7){return BPromise[_0x781a('0x2a')]({'id':_0x4116b7['id'],'endUserType':_0x5d9f7c[_0x781a('0x41')]});});}});}function getCustomFields(_0x955d84,_0x45037f){var _0x589896={};if(_0x955d84[_0x781a('0x27')]>0x0){_[_0x781a('0x49')](_0x955d84,function(_0x4b9072){if(_[_0x781a('0x4a')]([_0x781a('0x4b'),_0x781a('0x4c')],_0x4b9072[_0x781a('0x3e')])&&_0x4b9072[_0x781a('0x4d')]){_0x589896[_0x4b9072['idField']]=_0x4b9072['content'][_0x781a('0x4e')]();}else if(_0x4b9072[_0x781a('0x3e')]===_0x781a('0x4f')&&_0x4b9072['variableName']&&_0x4b9072[_0x781a('0x4d')]){_0x45037f[_0x4b9072[_0x781a('0x50')]]&&(_0x589896[_0x4b9072[_0x781a('0x4d')]]=_0x45037f[_0x4b9072[_0x781a('0x50')]][_0x781a('0x4e')]());}else if(_0x4b9072[_0x781a('0x3e')]===_0x781a('0x51')&&_0x4b9072[_0x781a('0x52')]&&_0x4b9072[_0x781a('0x52')][_0x781a('0x53')]&&_0x4b9072[_0x781a('0x4d')]){_0x45037f[_0x4b9072[_0x781a('0x52')][_0x781a('0x53')][_0x781a('0x3f')]()]&&(_0x589896[_0x4b9072['idField']]=_0x45037f[_0x4b9072[_0x781a('0x52')][_0x781a('0x53')][_0x781a('0x3f')]()]['toString']());}});}return _0x589896;}function getConnection(_0x2f237b){var _0xd63a0a=_0x2f237b['password'][_0x781a('0x54')](_0x2f237b['securityToken']);var _0x1341e6=new jsforce[(_0x781a('0x55'))]({'oauth2':{'loginUrl':_0x2f237b[_0x781a('0x56')]||_0x781a('0x57'),'clientId':_0x2f237b['clientId'],'clientSecret':_0x2f237b[_0x781a('0x58')]}});return _0x1341e6[_0x781a('0x59')](_0x2f237b[_0x781a('0x5a')],_0xd63a0a)[_0x781a('0x2e')](function(){logger[_0x781a('0x1f')](_0x781a('0x5b'));return _0x1341e6;});}exports[_0x781a('0x5c')]=function(_0x23a2be,_0x1e7db0,_0x56ed16,_0x401672,_0x193914,_0x27e6fd){var _0x2102fd,_0x3eca80,_0x25b58d,_0x5acb6f;_0x27e6fd[_0x781a('0x5d')]=intUtil['stripTrailingSlash'](_0x27e6fd[_0x781a('0x5d')]);_0x27e6fd[_0x781a('0x56')]=intUtil[_0x781a('0x5e')](_0x27e6fd['remoteUri']);if(_0x193914&&_0x193914['monitor_format']){logger[_0x781a('0x1f')](_0x781a('0x5f'),_0x781a('0x60'));_0x1e7db0[_0x781a('0x61')]=util[_0x781a('0x45')](_0x781a('0x62'),_0x27e6fd[_0x781a('0x5d')],_0x1e7db0[_0x781a('0x63')],md5(_0x1e7db0[_0x781a('0x63')]));}else{_0x1e7db0[_0x781a('0x61')]='';}return getConnection(_0x27e6fd)[_0x781a('0x2e')](function(_0xdad3f){_0x5acb6f=_0xdad3f;return getUser(_0x27e6fd,_0x401672[_0x781a('0x64')],_0x5acb6f);})[_0x781a('0x2e')](function(_0x3e72ad){_0x2102fd=_0x3e72ad;return getEndUser(_0x27e6fd,_0x56ed16,_0x1e7db0[_0x781a('0x65')],_0x1e7db0[_0x781a('0x66')],_0x5acb6f);})[_0x781a('0x2e')](function(_0x316d00){_0x3eca80=_0x316d00;return getTicket(_0x27e6fd,_0x2102fd,_0x3eca80,_0x56ed16,_0x1e7db0,_0x56ed16[_0x781a('0x67')],_0x5acb6f,_0x781a('0x5c'));})['then'](function(_0x469b3e){_0x25b58d=_0x469b3e;logger['info'](_0x781a('0x68'),_0x25b58d['id']);logger['info'](_0x781a('0x69'),_0x25b58d['id'],_0x401672[_0x781a('0x53')],_0x27e6fd['type']);switch(_0x27e6fd[_0x781a('0x3e')]){case'integrationTab':emit(util[_0x781a('0x45')]('user:%s',_0x401672[_0x781a('0x53')]),'trigger:salesforce:display',{'recordId':_0x25b58d['id']});break;case'newTab':emit(util[_0x781a('0x45')](_0x781a('0x6a'),_0x401672['name']),_0x781a('0x6b'),{'uri':util[_0x781a('0x45')](_0x781a('0x6c'),_0x5acb6f[_0x781a('0x6d')],_0x25b58d['id'])});break;default:logger[_0x781a('0x6e')](_0x781a('0x6f'));}})[_0x781a('0x70')](function(_0x31d61f){logger[_0x781a('0x6e')](_0x781a('0x5f'),_0x31d61f);});};exports[_0x781a('0x71')]=function(_0x20d8cb,_0x230260,_0x1f0ac4,_0x107955,_0x292635,_0x508aaa,_0x3e2f48){var _0x168c3c,_0xbaf194,_0x4d4ba4,_0x46319a;_0x508aaa['serverUrl']=intUtil[_0x781a('0x5e')](_0x508aaa[_0x781a('0x5d')]);_0x508aaa[_0x781a('0x56')]=intUtil['stripTrailingSlash'](_0x508aaa['remoteUri']);if(_0x3e2f48&&_0x3e2f48[_0x781a('0x72')]&&_0x3e2f48[_0x781a('0x72')]!==_0x781a('0x73')){logger['info']('[OUTBOUND]',_0x781a('0x60'));_0x230260['recordingURL']=util[_0x781a('0x45')](_0x781a('0x62'),_0x508aaa[_0x781a('0x5d')],_0x230260['uniqueid'],md5(_0x230260[_0x781a('0x63')]));}return getConnection(_0x508aaa)[_0x781a('0x2e')](function(_0x2d63a8){_0x46319a=_0x2d63a8;return getUser(_0x508aaa,_0x107955[_0x781a('0x64')],_0x46319a);})['then'](function(_0x3cc8c3){_0x168c3c=_0x3cc8c3;return getEndUser(_0x508aaa,_0x1f0ac4,_0x230260['destcalleridname'],_0x230260[_0x781a('0x74')],_0x46319a);})['then'](function(_0x40f4a0){_0xbaf194=_0x40f4a0;return getTicket(_0x508aaa,_0x168c3c,_0xbaf194,_0x1f0ac4,_0x230260,_0x1f0ac4[_0x781a('0x67')],_0x46319a,_0x781a('0x71'));})['then'](function(_0x46a9bd){_0x4d4ba4=_0x46a9bd;logger[_0x781a('0x1f')](_0x781a('0x75'),_0x4d4ba4['id']);logger[_0x781a('0x1f')](_0x781a('0x76'),_0x4d4ba4['id'],_0x107955[_0x781a('0x53')],_0x508aaa[_0x781a('0x3e')]);switch(_0x508aaa[_0x781a('0x3e')]){case _0x781a('0x77'):emit(util[_0x781a('0x45')](_0x781a('0x6a'),_0x107955[_0x781a('0x53')]),_0x781a('0x78'),{'recordId':_0x4d4ba4['id']});break;case _0x781a('0x79'):emit(util[_0x781a('0x45')](_0x781a('0x6a'),_0x107955['name']),_0x781a('0x6b'),{'uri':util[_0x781a('0x45')](_0x781a('0x6c'),_0x46319a[_0x781a('0x6d')],_0x4d4ba4['id'])});break;default:logger[_0x781a('0x6e')](_0x781a('0x7a'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x395fee){logger[_0x781a('0x6e')](_0x781a('0x7a'),_0x395fee);});};exports['unmanaged']=function(_0x284294,_0x413d8a,_0x1a0008,_0x46623e,_0xa5f736,_0xf50b2b){var _0x236a07,_0x4dca58,_0x3205f1,_0x172913;_0xf50b2b[_0x781a('0x5d')]=intUtil['stripTrailingSlash'](_0xf50b2b[_0x781a('0x5d')]);_0xf50b2b[_0x781a('0x56')]=intUtil[_0x781a('0x5e')](_0xf50b2b[_0x781a('0x56')]);if(_0xa5f736&&_0xa5f736[_0x781a('0x7b')]){logger[_0x781a('0x1f')]('['+_0x413d8a[_0x781a('0x7c')][_0x781a('0x7d')]()+']',_0x781a('0x60'));_0x413d8a[_0x781a('0x61')]=util[_0x781a('0x45')](_0x781a('0x62'),_0xf50b2b[_0x781a('0x5d')],_0x413d8a['uniqueid'],md5(_0x413d8a[_0x781a('0x63')]));}else{_0x413d8a[_0x781a('0x61')]='';}return getConnection(_0xf50b2b)[_0x781a('0x2e')](function(_0x35379c){_0x172913=_0x35379c;if(!_['isNil'](_0x46623e)){return getUser(_0xf50b2b,_0x46623e[_0x781a('0x53')],_0x172913);}else{return getUser(_0xf50b2b,null,_0x172913);}})['then'](function(_0x461217){_0x236a07=_0x461217;return getEndUser(_0xf50b2b,_0x1a0008,_0x413d8a[_0x781a('0x65')],_0x413d8a['calleridnum'],_0x172913);})[_0x781a('0x2e')](function(_0xdce565){_0x4dca58=_0xdce565;return getTicket(_0xf50b2b,_0x236a07,_0x4dca58,_0x1a0008,_0x413d8a,_0x1a0008[_0x781a('0x67')],_0x172913);})[_0x781a('0x2e')](function(_0x2d65d0){_0x3205f1=_0x2d65d0;logger[_0x781a('0x1f')]('['+_0x413d8a[_0x781a('0x7c')]['toUpperCase']()+_0x781a('0x7e'),_0x3205f1['id']);logger[_0x781a('0x1f')]('['+_0x413d8a[_0x781a('0x7c')][_0x781a('0x7d')]()+']\x20Integration\x20account\x20type\x20%s.',_0xf50b2b[_0x781a('0x3e')]);})[_0x781a('0x70')](function(_0x233f59){logger[_0x781a('0x6e')]('['+_0x413d8a[_0x781a('0x7c')][_0x781a('0x7d')]()+']',_0x233f59);});}; \ 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 ea81535..9fec745 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 _0xfcbb=['number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','toString','idField','type','variableName','customVariable','Variable','name','outbound','incident','assign','Subjects','Descriptions','ticketId'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x508293,_0x3ed3dd){_0x508293=_0x508293-0x0;var _0x42e494=_0xfcbb[_0x508293];return _0x42e494;};'use strict';var _=require(_0xbfcb('0x0'));var Promise=require(_0xbfcb('0x1'));var rp=require(_0xbfcb('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0xbfcb('0x3'));var intUtil=require(_0xbfcb('0x4'));var config=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));config['redis']=_['defaults'](config[_0xbfcb('0x8')],{'host':_0xbfcb('0x9'),'port':0x18eb});var io=require(_0xbfcb('0xa'))(new Redis(config[_0xbfcb('0x8')]));function getAdminUser(_0x288ee5,_0x2f875c,_0x49717b,_0x571001,_0x22cef4,_0x331173){return new Promise(function(_0x346685,_0x52b2f8){var _0x2c72f3={'method':_0xbfcb('0xb'),'uri':_0x571001+_0xbfcb('0xc')+'&'+_0x22cef4+'&'+_0x331173,'auth':_0x2f875c,'json':!![]};return rp(_0x2c72f3)[_0xbfcb('0xd')](function(_0x3df51a){if(_0x3df51a[_0xbfcb('0xe')]['length']>0x0){_0x49717b[_0xbfcb('0xf')]=_0x3df51a[_0xbfcb('0xe')][0x0][_0xbfcb('0x10')];}logger[_0xbfcb('0x11')]('['+[_0x288ee5['toUpperCase']()]+_0xbfcb('0x12'),_0x49717b);_0x346685(_0x49717b);})['catch'](function(_0x211a30){logger[_0xbfcb('0x13')]('['+[_0x288ee5[_0xbfcb('0x14')]()]+']',_0x211a30[_0xbfcb('0x15')]);_0x52b2f8(_0x211a30[_0xbfcb('0x15')]);});});}function getUser(_0xe47707,_0x71304e,_0x2d314a,_0x90ed8c,_0x339347){return function(_0x2c4a85){logger[_0xbfcb('0x11')]('['+[_0xe47707[_0xbfcb('0x14')]()]+_0xbfcb('0x16'),_0x2c4a85);return new Promise(function(_0x318d07,_0x1a4d75){if(intUtil[_0xbfcb('0x17')](_0x2c4a85[_0xbfcb('0x18')])){var _0x3404aa={'method':_0xbfcb('0xb'),'uri':_0x2d314a+_0xbfcb('0x19')+_0x2c4a85[_0xbfcb('0x18')]+'&'+_0x90ed8c+'&'+_0x339347,'auth':_0x71304e,'json':!![]};logger['info']('['+[_0xe47707[_0xbfcb('0x14')]()]+_0xbfcb('0x1a'),_0x3404aa);return rp(_0x3404aa)['then'](function(_0xa3c089){logger[_0xbfcb('0x11')]('['+[_0xe47707['toUpperCase']()]+'],\x20getUser\x20entity',_0xa3c089);if(_0xa3c089[_0xbfcb('0xe')][_0xbfcb('0x1b')]>0x0&&String(_0xa3c089[_0xbfcb('0xe')][0x0][_0xbfcb('0x1c')])===_0xbfcb('0x1d')){_0x2c4a85['userId']=_0xa3c089[_0xbfcb('0xe')][0x0][_0xbfcb('0x10')];}else{_0x2c4a85[_0xbfcb('0x1e')]=_0x2c4a85[_0xbfcb('0xf')];_0x2c4a85[_0xbfcb('0x18')]=_0x2c4a85[_0xbfcb('0x1f')];}logger[_0xbfcb('0x11')]('['+[_0xe47707[_0xbfcb('0x14')]()]+_0xbfcb('0x20'),_0x2c4a85);_0x318d07(_0x2c4a85);})[_0xbfcb('0x21')](function(_0x1ca8c3){logger[_0xbfcb('0x13')]('['+[_0xe47707[_0xbfcb('0x14')]()]+']',_0x1ca8c3[_0xbfcb('0x15')]);_0x1a4d75(_0x1ca8c3[_0xbfcb('0x15')]);});}else{logger[_0xbfcb('0x11')]('['+[_0xe47707['toUpperCase']()]+_0xbfcb('0x22'));_0x2c4a85[_0xbfcb('0x1e')]=_0x2c4a85['adminId'];_0x2c4a85[_0xbfcb('0x18')]=_0x2c4a85[_0xbfcb('0x1f')];_0x318d07(_0x2c4a85);}});};}function createEndUser(_0x781773,_0xa57d71,_0xf4b944,_0x3542e9,_0x4069a7){logger[_0xbfcb('0x11')]('['+[_0x781773[_0xbfcb('0x14')]()]+_0xbfcb('0x23'),_0xf4b944);return new Promise(function(_0x59719b,_0x17cd0e){var _0x3aa3cd={'method':_0xbfcb('0x24'),'uri':_0x3542e9+_0xbfcb('0x25')+_0x4069a7,'body':{'user_name':_0xf4b944[_0xbfcb('0x26')],'roles':_0xbfcb('0x27'),'first_name':_0xf4b944[_0xbfcb('0x26')],'active':_0xbfcb('0x1d'),'date_format':_0xbfcb('0x28'),'phone':_0xf4b944['endUserNumber']},'auth':_0xa57d71,'json':!![]};return rp(_0x3aa3cd)[_0xbfcb('0xd')](function(_0xaa6ae6){logger[_0xbfcb('0x11')]('['+[_0x781773[_0xbfcb('0x14')]()]+'],\x20EndUser\x20schema',_0xaa6ae6['result']);_0xf4b944[_0xbfcb('0x29')]=_0xaa6ae6[_0xbfcb('0xe')][_0xbfcb('0x10')];_0x59719b(_0xf4b944);})[_0xbfcb('0x21')](function(_0x32d9a2){logger[_0xbfcb('0x13')]('['+[_0x781773[_0xbfcb('0x14')]()]+']',_0x32d9a2['message']);_0x17cd0e(_0x32d9a2['message']);});});}function getEndUser(_0x5243ee,_0x1eab10,_0x552a22,_0xda9f61,_0x410948){return function(_0x505b0d){logger['info']('['+[_0x5243ee[_0xbfcb('0x14')]()]+_0xbfcb('0x2a'),_0x505b0d);return new Promise(function(_0x12deab,_0x156b1e){var _0x530208={'method':_0xbfcb('0xb'),'uri':_0x552a22+_0xbfcb('0x2b')+_0x505b0d['endUserNumber']+'&'+_0xda9f61+'&'+_0x410948,'auth':_0x1eab10,'json':!![]};return rp(_0x530208)['then'](function(_0x2cf31f){if(_0x2cf31f['result']['length']>0x0){_0x505b0d[_0xbfcb('0x29')]=_0x2cf31f[_0xbfcb('0xe')][0x0][_0xbfcb('0x10')];logger[_0xbfcb('0x11')]('['+[_0x5243ee['toUpperCase']()]+_0xbfcb('0x2c'),_0x505b0d);_0x12deab(_0x505b0d);}else{return createEndUser(_0x5243ee,_0x1eab10,_0x505b0d,_0x552a22,_0xda9f61)[_0xbfcb('0xd')](function(_0x369c96){logger[_0xbfcb('0x11')]('['+[_0x5243ee[_0xbfcb('0x14')]()]+_0xbfcb('0x2d'),_0x369c96);_0x12deab(_0x369c96);});}})['catch'](function(_0x2fc01f){logger['error']('['+[_0x5243ee[_0xbfcb('0x14')]()]+']',_0x2fc01f['message']);_0x156b1e(_0x2fc01f[_0xbfcb('0x15')]);});});};}function getCustomFields(_0x2e4406,_0xe719cd){var _0x1d083b={};if(_0x2e4406[_0xbfcb('0x1b')]>0x0){_[_0xbfcb('0x2e')](_0x2e4406,function(_0x453714){if(_[_0xbfcb('0x2f')]([_0xbfcb('0x30'),_0xbfcb('0x31')],_0x453714['type'])&&_0x453714[_0xbfcb('0x32')]&&!_0x453714[_0xbfcb('0x33')]){_0x1d083b[_0x453714['nameField'][_0xbfcb('0x34')]()]=_0x453714[_0xbfcb('0x35')][_0xbfcb('0x36')]();}else if(_[_0xbfcb('0x2f')]([_0xbfcb('0x30'),_0xbfcb('0x31')],_0x453714['type'])&&_0x453714[_0xbfcb('0x37')]&&_0x453714[_0xbfcb('0x33')]){_0x1d083b[_0x453714[_0xbfcb('0x37')]['toLowerCase']()]=_0x453714[_0xbfcb('0x35')][_0xbfcb('0x36')]();}else if(_0x453714[_0xbfcb('0x38')]==='variable'&&_0x453714[_0xbfcb('0x39')]&&_0x453714[_0xbfcb('0x37')]&&_0x453714['customField']){_0x1d083b[_0x453714['idField'][_0xbfcb('0x34')]()]=_0xe719cd[_0x453714[_0xbfcb('0x39')]]['toString']();}else if(_0x453714[_0xbfcb('0x38')]===_0xbfcb('0x3a')&&_0x453714['Variable']&&_0x453714[_0xbfcb('0x3b')][_0xbfcb('0x3c')]&&_0x453714[_0xbfcb('0x37')]&&_0x453714[_0xbfcb('0x33')]){_0x1d083b[_0x453714[_0xbfcb('0x37')][_0xbfcb('0x34')]()]=_0xe719cd[_0x453714[_0xbfcb('0x3b')][_0xbfcb('0x3c')][_0xbfcb('0x34')]()][_0xbfcb('0x36')]();}});}return _0x1d083b;}function getTicket(_0x2c0f18,_0x2e5911,_0x5f307b,_0x12889b,_0x3f7282,_0x124293){return function(_0x4c83fc){logger[_0xbfcb('0x11')]('['+[_0x2c0f18['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x4c83fc);return new Promise(function(_0x2dcfb3,_0x20918c){var _0x8948f6=_0x2c0f18['toLowerCase']()===_0xbfcb('0x3d')?_0x4c83fc['userId']:_0x4c83fc['endUserId'];var _0x33725a={'method':'POST','uri':_0x5f307b+_0xbfcb('0x3e')+'?'+_0x124293,'body':Object[_0xbfcb('0x3f')]({},{'active':'true','caller_id':_0x8948f6,'assigned_to':_0x4c83fc[_0xbfcb('0x1e')],'short_description':intUtil['getString'](_0x12889b[_0xbfcb('0x40')],_0x3f7282,'\x20'),'description':intUtil['getString'](_0x12889b[_0xbfcb('0x41')],_0x3f7282,'\x0a')},getCustomFields(_0x12889b['Fields'],_0x3f7282)),'auth':_0x2e5911,'json':!![]};return rp(_0x33725a)[_0xbfcb('0xd')](function(_0x423822){logger['info']('['+[_0x2c0f18[_0xbfcb('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x423822['result']);_0x4c83fc[_0xbfcb('0x42')]=_0x423822[_0xbfcb('0xe')][_0xbfcb('0x10')];_0x4c83fc['ticketNumber']=_0x423822['result'][_0xbfcb('0x43')];logger[_0xbfcb('0x11')]('['+[_0x2c0f18[_0xbfcb('0x14')]()]+_0xbfcb('0x44'),_0x4c83fc);_0x2dcfb3(_0x4c83fc);})[_0xbfcb('0x21')](function(_0x5aadfe){logger[_0xbfcb('0x13')]('['+[_0x2c0f18[_0xbfcb('0x14')]()]+']',_0x5aadfe[_0xbfcb('0x15')]);_0x20918c(_0x5aadfe[_0xbfcb('0x15')]);});});};}function createRemoteTag(_0x4d1264,_0x4f50be,_0xbcb336,_0x50f9f7){return new Promise(function(_0x9cc2bd,_0x5e5a76){var _0x485cbf={'method':_0xbfcb('0x24'),'uri':_0xbcb336+'label'+'?'+_0x50f9f7,'body':{'short_description':_0x4d1264,'global':!![],'active':!![],'name':_0x4d1264},'auth':_0x4f50be,'json':!![]};return rp(_0x485cbf)['then'](function(_0x27058a){var _0x53842f=_0x27058a[_0xbfcb('0xe')]['sys_id'];_0x9cc2bd(_0x53842f);});});}function getRemoteTag(_0xafb570,_0x3ce078,_0x593f4e,_0x35cd27,_0x5ac9bc){return new Promise(function(_0x33f97a,_0x578ade){var _0x3cd568={'method':_0xbfcb('0xb'),'uri':_0x593f4e+_0xbfcb('0x45')+_0xbfcb('0x46')+_0xafb570+'&'+_0x35cd27,'auth':_0x3ce078,'json':!![]};return rp(_0x3cd568)[_0xbfcb('0xd')](function(_0x4421fc){if(_0x4421fc[_0xbfcb('0xe')]['length']>0x0){var _0x9c9b13=_0x4421fc['result'][0x0][_0xbfcb('0x10')];_0x33f97a(_0x9c9b13);}else{return createRemoteTag(_0xafb570,_0x3ce078,_0x593f4e,_0x35cd27)[_0xbfcb('0xd')](function(_0x2e840e){_0x33f97a(_0x2e840e);});}});});}function assignTagToIncident(_0x112f7d,_0x5eaf39,_0x558da0,_0x3a0945,_0x48c7b4){return new Promise(function(_0x2c0cbe,_0x1802f4){var _0x29b410={'method':_0xbfcb('0x24'),'uri':_0x558da0+_0xbfcb('0x47')+'?'+_0x48c7b4,'body':{'label':_0x112f7d,'table':_0xbfcb('0x3e'),'id_type':'Incident','table_key':_0x3a0945[_0xbfcb('0x42')],'title':_0xbfcb('0x48')+_0x3a0945[_0xbfcb('0x49')],'id_display':_0x3a0945[_0xbfcb('0x49')]},'auth':_0x5eaf39,'json':!![]};return rp(_0x29b410)[_0xbfcb('0xd')](function(_0x1b5ec2){_0x2c0cbe();})[_0xbfcb('0x21')](function(){_0x2c0cbe();});});}function manageTags(_0x5d847c,_0x538200,_0x506aa8,_0x2b9a96,_0x14014d,_0x29f445,_0x548083){return new Promise(function(_0xbd3b3b,_0x3f230e){var _0x4e549=[];_0x538200['forEach'](function(_0x547d26){_0x4e549['push'](getRemoteTag(_0x547d26,_0x506aa8,_0x2b9a96,_0x29f445,_0x548083));});return Promise[_0xbfcb('0x4a')](_0x4e549)[_0xbfcb('0xd')](function(_0x13dc5e){if(_0x13dc5e[_0xbfcb('0x1b')]){logger['info']('['+[_0x5d847c[_0xbfcb('0x14')]()]+_0xbfcb('0x4b'),_0x13dc5e);var _0x39a3cf=[];_0x13dc5e['forEach'](function(_0x4bf71a){_0x39a3cf[_0xbfcb('0x4c')](assignTagToIncident(_0x4bf71a,_0x506aa8,_0x2b9a96,_0x14014d,_0x29f445));});return Promise[_0xbfcb('0x4a')](_0x39a3cf)['then'](function(){_0xbd3b3b();})['catch'](function(){_0xbd3b3b();});}else{_0xbd3b3b();}});});}function getTags(_0x4866ef,_0x526563,_0x1866f5,_0x21d070,_0x3c3ab5,_0x2d77f9){return function(_0x3f4e1f){return new Promise(function(_0x44ec09,_0x2ea974){var _0x299e63=[];var _0x55d70e=_0x21d070[_0xbfcb('0x4d')];if(_0x55d70e&&_0x55d70e[_0xbfcb('0x1b')]>0x0){_0x299e63=_[_0xbfcb('0x4e')](_0x55d70e,_0xbfcb('0x3c'));}if(_0x299e63[_0xbfcb('0x1b')]>0x0){return manageTags(_0x4866ef,_0x299e63,_0x526563,_0x1866f5,_0x3f4e1f,_0x3c3ab5,_0x2d77f9)[_0xbfcb('0xd')](function(){_0x44ec09(_0x3f4e1f);});}else{_0x44ec09(_0x3f4e1f);}});};}function emit(_0x20946e,_0x43f60b,_0x582b60){var _0xe35368='%26sysparm_record_target%3Dincident'+_0xbfcb('0x4f')+_0xbfcb('0x50')+_0xbfcb('0x51');var _0x2f0934={'uri':_0x20946e+_0xbfcb('0x52')+_0x582b60+_0xe35368};io['to'](util['format'](_0xbfcb('0x53'),_0x43f60b))[_0xbfcb('0x54')](_0xbfcb('0x55'),_0x2f0934);}exports['cs']=function(_0x1bca83,_0x8d012d,_0x4c01ff,_0x362d57,_0x2132d6,_0x1a6f5e,_0x25abf3,_0x51d6a5){var _0x503a2f={};var _0x467f17={'user':_0x1a6f5e[_0xbfcb('0x56')],'pass':_0x1a6f5e[_0xbfcb('0x57')]};var _0x404395=_0xbfcb('0x58');var _0x238f74=_0xbfcb('0x59');_0x1a6f5e[_0xbfcb('0x5a')]=intUtil[_0xbfcb('0x5b')](_0x1a6f5e[_0xbfcb('0x5a')]);_0x1a6f5e[_0xbfcb('0x5c')]=intUtil[_0xbfcb('0x5b')](_0x1a6f5e[_0xbfcb('0x5c')]);var _0x1acada=util['format'](_0xbfcb('0x5d'),_0x1a6f5e['remoteUri']);_0x503a2f[_0xbfcb('0x18')]=!_[_0xbfcb('0x5e')](_0x362d57)?_0x362d57['email']:null;_0x503a2f[_0xbfcb('0x1f')]=_0x1a6f5e[_0xbfcb('0x5f')];_0x503a2f[_0xbfcb('0x26')]=_0x51d6a5[_0xbfcb('0x34')]()==='outbound'?_0x8d012d[_0xbfcb('0x60')]:_0x8d012d['calleridnum'];_0x503a2f[_0xbfcb('0x61')]=_0x51d6a5===_0xbfcb('0x62')||_0x51d6a5==='unmanaged'?'queue':_0xbfcb('0x3d');var _0x31355a=util[_0xbfcb('0x63')](_0xbfcb('0x64'),_0x1a6f5e[_0xbfcb('0x5c')],_0x8d012d['uniqueid'],md5(_0x8d012d['uniqueid']));if(_0x2132d6&&_0x2132d6[_0xbfcb('0x65')]){logger['info']('[QUEUE]',_0xbfcb('0x66'));_0x8d012d[_0xbfcb('0x67')]=_0x31355a;}else if(_0x25abf3&&_0x25abf3['recordingFormat']&&_0x25abf3[_0xbfcb('0x68')]!==_0xbfcb('0x69')){logger['info'](_0xbfcb('0x6a'),_0xbfcb('0x66'));_0x8d012d[_0xbfcb('0x67')]=_0x31355a;}else{_0x8d012d[_0xbfcb('0x67')]='';}return getAdminUser(_0x51d6a5,_0x467f17,_0x503a2f,_0x1acada,_0x238f74,_0x404395)['then'](getUser(_0x51d6a5,_0x467f17,_0x1acada,_0x238f74,_0x404395))[_0xbfcb('0xd')](getEndUser(_0x51d6a5,_0x467f17,_0x1acada,_0x238f74,_0x404395))[_0xbfcb('0xd')](getTicket(_0x51d6a5,_0x467f17,_0x1acada,_0x4c01ff,_0x8d012d,_0x238f74))[_0xbfcb('0xd')](function(_0x4256c4){logger[_0xbfcb('0x11')](util[_0xbfcb('0x63')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4256c4[_0xbfcb('0x42')]));logger[_0xbfcb('0x11')](util[_0xbfcb('0x63')](_0xbfcb('0x6b'),_0x51d6a5));if(_0x51d6a5!==_0xbfcb('0x6c')){logger[_0xbfcb('0x11')]('['+[_0x51d6a5[_0xbfcb('0x14')]()]+']',_0xbfcb('0x6d'));emit(_0x1a6f5e[_0xbfcb('0x5a')],_0x362d57[_0xbfcb('0x3c')],_0x4256c4[_0xbfcb('0x42')]);}})[_0xbfcb('0x21')](function(_0x5c4ecb){logger['error']('['+[_0x51d6a5[_0xbfcb('0x14')]()]+_0xbfcb('0x6e'),util[_0xbfcb('0x6f')](_0x5c4ecb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8e3f=['],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','variable','variableName','Variable','toString',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','?sysparm_query=name%3D','Incident','ticketId','Incident\x20-\x20','push','all','Tags','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf8e3('0x0'));var Promise=require(_0xf8e3('0x1'));var rp=require(_0xf8e3('0x2'));var util=require('util');var md5=require(_0xf8e3('0x3'));var Redis=require(_0xf8e3('0x4'));var intUtil=require(_0xf8e3('0x5'));var config=require('../../../../config/environment');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));config['redis']=_[_0xf8e3('0x8')](config[_0xf8e3('0x9')],{'host':_0xf8e3('0xa'),'port':0x18eb});var io=require(_0xf8e3('0xb'))(new Redis(config['redis']));function getAdminUser(_0x4504dd,_0x2e39b7,_0x17f56c,_0x95ad03,_0x38f8e8,_0x4055e2){return new Promise(function(_0x299a7e,_0x2a3b59){var _0x2d914d={'method':_0xf8e3('0xc'),'uri':_0x95ad03+_0xf8e3('0xd')+'&'+_0x38f8e8+'&'+_0x4055e2,'auth':_0x2e39b7,'json':!![]};return rp(_0x2d914d)[_0xf8e3('0xe')](function(_0x5e4b87){if(_0x5e4b87[_0xf8e3('0xf')][_0xf8e3('0x10')]>0x0){_0x17f56c[_0xf8e3('0x11')]=_0x5e4b87['result'][0x0][_0xf8e3('0x12')];}logger[_0xf8e3('0x13')]('['+[_0x4504dd[_0xf8e3('0x14')]()]+_0xf8e3('0x15'),_0x17f56c);_0x299a7e(_0x17f56c);})['catch'](function(_0x164c4d){logger[_0xf8e3('0x16')]('['+[_0x4504dd[_0xf8e3('0x14')]()]+']',_0x164c4d['message']);_0x2a3b59(_0x164c4d[_0xf8e3('0x17')]);});});}function getUser(_0x5136c6,_0x1ec773,_0x40c196,_0x460629,_0x570ee3){return function(_0x529c92){logger[_0xf8e3('0x13')]('['+[_0x5136c6[_0xf8e3('0x14')]()]+_0xf8e3('0x18'),_0x529c92);return new Promise(function(_0x3b01ac,_0x110a78){if(intUtil[_0xf8e3('0x19')](_0x529c92[_0xf8e3('0x1a')])){var _0x2e27e3={'method':_0xf8e3('0xc'),'uri':_0x40c196+_0xf8e3('0x1b')+_0x529c92['userEmail']+'&'+_0x460629+'&'+_0x570ee3,'auth':_0x1ec773,'json':!![]};logger[_0xf8e3('0x13')]('['+[_0x5136c6[_0xf8e3('0x14')]()]+_0xf8e3('0x1c'),_0x2e27e3);return rp(_0x2e27e3)[_0xf8e3('0xe')](function(_0x3128ad){logger[_0xf8e3('0x13')]('['+[_0x5136c6[_0xf8e3('0x14')]()]+_0xf8e3('0x1d'),_0x3128ad);if(_0x3128ad['result'][_0xf8e3('0x10')]>0x0&&String(_0x3128ad[_0xf8e3('0xf')][0x0][_0xf8e3('0x1e')])===_0xf8e3('0x1f')){_0x529c92['userId']=_0x3128ad[_0xf8e3('0xf')][0x0]['sys_id'];}else{_0x529c92[_0xf8e3('0x20')]=_0x529c92[_0xf8e3('0x11')];_0x529c92[_0xf8e3('0x1a')]=_0x529c92[_0xf8e3('0x21')];}logger[_0xf8e3('0x13')]('['+[_0x5136c6[_0xf8e3('0x14')]()]+'],\x20getUser\x20crm',_0x529c92);_0x3b01ac(_0x529c92);})[_0xf8e3('0x22')](function(_0x2fc674){logger[_0xf8e3('0x16')]('['+[_0x5136c6[_0xf8e3('0x14')]()]+']',_0x2fc674[_0xf8e3('0x17')]);_0x110a78(_0x2fc674[_0xf8e3('0x17')]);});}else{logger[_0xf8e3('0x13')]('['+[_0x5136c6[_0xf8e3('0x14')]()]+']\x20using\x20admin\x20profile');_0x529c92[_0xf8e3('0x20')]=_0x529c92[_0xf8e3('0x11')];_0x529c92[_0xf8e3('0x1a')]=_0x529c92[_0xf8e3('0x21')];_0x3b01ac(_0x529c92);}});};}function createEndUser(_0x15b28c,_0x14cb5a,_0x16485e,_0xfaf15d,_0x4f2ae9){logger[_0xf8e3('0x13')]('['+[_0x15b28c[_0xf8e3('0x14')]()]+_0xf8e3('0x23'),_0x16485e);return new Promise(function(_0x28b2f2,_0x567153){var _0x2e507c={'method':_0xf8e3('0x24'),'uri':_0xfaf15d+_0xf8e3('0x25')+_0x4f2ae9,'body':{'user_name':_0x16485e[_0xf8e3('0x26')],'roles':_0xf8e3('0x27'),'first_name':_0x16485e[_0xf8e3('0x26')],'active':_0xf8e3('0x1f'),'date_format':_0xf8e3('0x28'),'phone':_0x16485e['endUserNumber']},'auth':_0x14cb5a,'json':!![]};return rp(_0x2e507c)[_0xf8e3('0xe')](function(_0x527337){logger['info']('['+[_0x15b28c['toUpperCase']()]+'],\x20EndUser\x20schema',_0x527337[_0xf8e3('0xf')]);_0x16485e['endUserId']=_0x527337[_0xf8e3('0xf')][_0xf8e3('0x12')];_0x28b2f2(_0x16485e);})[_0xf8e3('0x22')](function(_0x10061f){logger['error']('['+[_0x15b28c['toUpperCase']()]+']',_0x10061f[_0xf8e3('0x17')]);_0x567153(_0x10061f[_0xf8e3('0x17')]);});});}function getEndUser(_0x42ad88,_0xcd026c,_0x42b90c,_0x24a037,_0x5af57b){return function(_0x1afead){logger['info']('['+[_0x42ad88['toUpperCase']()]+_0xf8e3('0x29'),_0x1afead);return new Promise(function(_0x1e8878,_0x1fffde){var _0x1b7af2={'method':'GET','uri':_0x42b90c+'sys_user?sysparm_query=phone%3D'+_0x1afead[_0xf8e3('0x26')]+'&'+_0x24a037+'&'+_0x5af57b,'auth':_0xcd026c,'json':!![]};return rp(_0x1b7af2)[_0xf8e3('0xe')](function(_0x5d3f14){if(_0x5d3f14[_0xf8e3('0xf')][_0xf8e3('0x10')]>0x0){_0x1afead[_0xf8e3('0x2a')]=_0x5d3f14[_0xf8e3('0xf')][0x0]['sys_id'];logger['info']('['+[_0x42ad88['toUpperCase']()]+_0xf8e3('0x2b'),_0x1afead);_0x1e8878(_0x1afead);}else{return createEndUser(_0x42ad88,_0xcd026c,_0x1afead,_0x42b90c,_0x24a037)[_0xf8e3('0xe')](function(_0x2b9ce6){logger[_0xf8e3('0x13')]('['+[_0x42ad88['toUpperCase']()]+_0xf8e3('0x2c'),_0x2b9ce6);_0x1e8878(_0x2b9ce6);});}})['catch'](function(_0x20909b){logger[_0xf8e3('0x16')]('['+[_0x42ad88[_0xf8e3('0x14')]()]+']',_0x20909b[_0xf8e3('0x17')]);_0x1fffde(_0x20909b[_0xf8e3('0x17')]);});});};}function getCustomFields(_0x34a6ba,_0x82e778){var _0x2db5b5={};if(_0x34a6ba[_0xf8e3('0x10')]>0x0){_['forEach'](_0x34a6ba,function(_0x211620){if(_['includes']([_0xf8e3('0x2d'),_0xf8e3('0x2e')],_0x211620[_0xf8e3('0x2f')])&&_0x211620[_0xf8e3('0x30')]&&!_0x211620[_0xf8e3('0x31')]){_0x2db5b5[_0x211620[_0xf8e3('0x30')][_0xf8e3('0x32')]()]=_0x211620[_0xf8e3('0x33')]['toString']();}else if(_[_0xf8e3('0x34')]([_0xf8e3('0x2d'),_0xf8e3('0x2e')],_0x211620[_0xf8e3('0x2f')])&&_0x211620[_0xf8e3('0x35')]&&_0x211620[_0xf8e3('0x31')]){_0x2db5b5[_0x211620[_0xf8e3('0x35')][_0xf8e3('0x32')]()]=_0x211620['content']['toString']();}else if(_0x211620['type']===_0xf8e3('0x36')&&_0x211620[_0xf8e3('0x37')]&&_0x211620['idField']&&_0x211620[_0xf8e3('0x31')]){_0x2db5b5[_0x211620['idField'][_0xf8e3('0x32')]()]=_0x82e778[_0x211620[_0xf8e3('0x37')]]['toString']();}else if(_0x211620[_0xf8e3('0x2f')]==='customVariable'&&_0x211620[_0xf8e3('0x38')]&&_0x211620[_0xf8e3('0x38')]['name']&&_0x211620[_0xf8e3('0x35')]&&_0x211620[_0xf8e3('0x31')]){_0x2db5b5[_0x211620[_0xf8e3('0x35')][_0xf8e3('0x32')]()]=_0x82e778[_0x211620['Variable']['name']['toLowerCase']()][_0xf8e3('0x39')]();}});}return _0x2db5b5;}function getTicket(_0xc1f803,_0x351d02,_0x49e8f3,_0x3258ef,_0x4bced6,_0x173b2b){return function(_0x1c60a5){logger['info']('['+[_0xc1f803['toUpperCase']()]+_0xf8e3('0x3a'),_0x1c60a5);return new Promise(function(_0x2939e6,_0x1522ad){var _0x364f69=_0xc1f803[_0xf8e3('0x32')]()===_0xf8e3('0x3b')?_0x1c60a5[_0xf8e3('0x20')]:_0x1c60a5[_0xf8e3('0x2a')];var _0xdc2430={'method':_0xf8e3('0x24'),'uri':_0x49e8f3+_0xf8e3('0x3c')+'?'+_0x173b2b,'body':Object['assign']({},{'active':_0xf8e3('0x1f'),'caller_id':_0x364f69,'assigned_to':_0x1c60a5[_0xf8e3('0x20')],'short_description':intUtil[_0xf8e3('0x3d')](_0x3258ef[_0xf8e3('0x3e')],_0x4bced6,'\x20'),'description':intUtil[_0xf8e3('0x3d')](_0x3258ef[_0xf8e3('0x3f')],_0x4bced6,'\x0a')},getCustomFields(_0x3258ef['Fields'],_0x4bced6)),'auth':_0x351d02,'json':!![]};return rp(_0xdc2430)[_0xf8e3('0xe')](function(_0x3534f0){logger[_0xf8e3('0x13')]('['+[_0xc1f803[_0xf8e3('0x14')]()]+_0xf8e3('0x40'),_0x3534f0[_0xf8e3('0xf')]);_0x1c60a5['ticketId']=_0x3534f0[_0xf8e3('0xf')][_0xf8e3('0x12')];_0x1c60a5[_0xf8e3('0x41')]=_0x3534f0[_0xf8e3('0xf')][_0xf8e3('0x42')];logger[_0xf8e3('0x13')]('['+[_0xc1f803['toUpperCase']()]+_0xf8e3('0x43'),_0x1c60a5);_0x2939e6(_0x1c60a5);})[_0xf8e3('0x22')](function(_0x1bb0c1){logger[_0xf8e3('0x16')]('['+[_0xc1f803[_0xf8e3('0x14')]()]+']',_0x1bb0c1['message']);_0x1522ad(_0x1bb0c1[_0xf8e3('0x17')]);});});};}function createRemoteTag(_0x103a93,_0x40561e,_0x53c897,_0x5b78e6){return new Promise(function(_0x371dfe,_0x3886dc){var _0x2a0c85={'method':_0xf8e3('0x24'),'uri':_0x53c897+'label'+'?'+_0x5b78e6,'body':{'short_description':_0x103a93,'global':!![],'active':!![],'name':_0x103a93},'auth':_0x40561e,'json':!![]};return rp(_0x2a0c85)[_0xf8e3('0xe')](function(_0x16bddb){var _0x5c8111=_0x16bddb['result'][_0xf8e3('0x12')];_0x371dfe(_0x5c8111);});});}function getRemoteTag(_0x3067a2,_0x4393a5,_0x505477,_0x5579cb,_0x4892e9){return new Promise(function(_0x182e9b,_0x3b82a0){var _0x4ffecc={'method':'GET','uri':_0x505477+'label'+_0xf8e3('0x44')+_0x3067a2+'&'+_0x5579cb,'auth':_0x4393a5,'json':!![]};return rp(_0x4ffecc)[_0xf8e3('0xe')](function(_0x5368a8){if(_0x5368a8[_0xf8e3('0xf')][_0xf8e3('0x10')]>0x0){var _0x32e3cc=_0x5368a8['result'][0x0]['sys_id'];_0x182e9b(_0x32e3cc);}else{return createRemoteTag(_0x3067a2,_0x4393a5,_0x505477,_0x5579cb)['then'](function(_0x582a56){_0x182e9b(_0x582a56);});}});});}function assignTagToIncident(_0x3390a1,_0x3b120a,_0x3ef144,_0x447efe,_0x442349){return new Promise(function(_0x22e270,_0xb1b8dd){var _0x5f5ee4={'method':_0xf8e3('0x24'),'uri':_0x3ef144+'label_entry'+'?'+_0x442349,'body':{'label':_0x3390a1,'table':'incident','id_type':_0xf8e3('0x45'),'table_key':_0x447efe[_0xf8e3('0x46')],'title':_0xf8e3('0x47')+_0x447efe['ticketNumber'],'id_display':_0x447efe[_0xf8e3('0x41')]},'auth':_0x3b120a,'json':!![]};return rp(_0x5f5ee4)[_0xf8e3('0xe')](function(_0x4879c7){_0x22e270();})['catch'](function(){_0x22e270();});});}function manageTags(_0x256cd5,_0x4763eb,_0x2c2aa6,_0x1bfdb7,_0x50181b,_0x5bd7bf,_0x37751e){return new Promise(function(_0x3276f3,_0x6ac105){var _0x392d99=[];_0x4763eb['forEach'](function(_0x572c15){_0x392d99[_0xf8e3('0x48')](getRemoteTag(_0x572c15,_0x2c2aa6,_0x1bfdb7,_0x5bd7bf,_0x37751e));});return Promise[_0xf8e3('0x49')](_0x392d99)['then'](function(_0x266f16){if(_0x266f16[_0xf8e3('0x10')]){logger[_0xf8e3('0x13')]('['+[_0x256cd5[_0xf8e3('0x14')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x266f16);var _0x11ebb2=[];_0x266f16['forEach'](function(_0x217979){_0x11ebb2[_0xf8e3('0x48')](assignTagToIncident(_0x217979,_0x2c2aa6,_0x1bfdb7,_0x50181b,_0x5bd7bf));});return Promise['all'](_0x11ebb2)[_0xf8e3('0xe')](function(){_0x3276f3();})[_0xf8e3('0x22')](function(){_0x3276f3();});}else{_0x3276f3();}});});}function getTags(_0x55418c,_0x232d83,_0x307feb,_0x3b0713,_0x33a809,_0x52bda7){return function(_0xd7439a){return new Promise(function(_0xd3586e,_0x76033b){var _0x3c214f=[];var _0x43daa3=_0x3b0713[_0xf8e3('0x4a')];if(_0x43daa3&&_0x43daa3[_0xf8e3('0x10')]>0x0){_0x3c214f=_[_0xf8e3('0x4b')](_0x43daa3,_0xf8e3('0x4c'));}if(_0x3c214f[_0xf8e3('0x10')]>0x0){return manageTags(_0x55418c,_0x3c214f,_0x232d83,_0x307feb,_0xd7439a,_0x33a809,_0x52bda7)[_0xf8e3('0xe')](function(){_0xd3586e(_0xd7439a);});}else{_0xd3586e(_0xd7439a);}});};}function emit(_0x21d922,_0x520ce0,_0x52d91d){var _0x2f6cf4=_0xf8e3('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xf8e3('0x4e')+_0xf8e3('0x4f');var _0x31c16d={'uri':_0x21d922+_0xf8e3('0x50')+_0x52d91d+_0x2f6cf4};io['to'](util[_0xf8e3('0x51')]('user:%s',_0x520ce0))[_0xf8e3('0x52')](_0xf8e3('0x53'),_0x31c16d);}exports['cs']=function(_0x52e996,_0xc60f6,_0x57c216,_0x3e39a8,_0x4a0f82,_0x2b8d88,_0x39e1a3,_0x45361d){var _0x2e7098={};var _0x3ddf8d={'user':_0x2b8d88['username'],'pass':_0x2b8d88[_0xf8e3('0x54')]};var _0x2f62f6=_0xf8e3('0x55');var _0x3c351e=_0xf8e3('0x56');_0x2b8d88[_0xf8e3('0x57')]=intUtil[_0xf8e3('0x58')](_0x2b8d88[_0xf8e3('0x57')]);_0x2b8d88[_0xf8e3('0x59')]=intUtil[_0xf8e3('0x58')](_0x2b8d88[_0xf8e3('0x59')]);var _0x4adf03=util['format'](_0xf8e3('0x5a'),_0x2b8d88[_0xf8e3('0x57')]);_0x2e7098[_0xf8e3('0x1a')]=!_['isNil'](_0x3e39a8)?_0x3e39a8[_0xf8e3('0x5b')]:null;_0x2e7098[_0xf8e3('0x21')]=_0x2b8d88[_0xf8e3('0x5b')];_0x2e7098[_0xf8e3('0x26')]=_0x45361d[_0xf8e3('0x32')]()===_0xf8e3('0x3b')?_0xc60f6[_0xf8e3('0x5c')]:_0xc60f6[_0xf8e3('0x5d')];_0x2e7098[_0xf8e3('0x5e')]=_0x45361d===_0xf8e3('0x5f')||_0x45361d===_0xf8e3('0x60')?_0xf8e3('0x5f'):'outbound';var _0x118cc6=util[_0xf8e3('0x51')](_0xf8e3('0x61'),_0x2b8d88[_0xf8e3('0x59')],_0xc60f6['uniqueid'],md5(_0xc60f6['uniqueid']));if(_0x4a0f82&&_0x4a0f82[_0xf8e3('0x62')]){logger[_0xf8e3('0x13')]('[QUEUE]','Recording\x20is\x20enabled!');_0xc60f6[_0xf8e3('0x63')]=_0x118cc6;}else if(_0x39e1a3&&_0x39e1a3[_0xf8e3('0x64')]&&_0x39e1a3['recordingFormat']!==_0xf8e3('0x65')){logger[_0xf8e3('0x13')](_0xf8e3('0x66'),_0xf8e3('0x67'));_0xc60f6[_0xf8e3('0x63')]=_0x118cc6;}else{_0xc60f6['recordingURL']='';}return getAdminUser(_0x45361d,_0x3ddf8d,_0x2e7098,_0x4adf03,_0x3c351e,_0x2f62f6)[_0xf8e3('0xe')](getUser(_0x45361d,_0x3ddf8d,_0x4adf03,_0x3c351e,_0x2f62f6))[_0xf8e3('0xe')](getEndUser(_0x45361d,_0x3ddf8d,_0x4adf03,_0x3c351e,_0x2f62f6))['then'](getTicket(_0x45361d,_0x3ddf8d,_0x4adf03,_0x57c216,_0xc60f6,_0x3c351e))['then'](function(_0x1ceb1e){logger[_0xf8e3('0x13')](util[_0xf8e3('0x51')](_0xf8e3('0x68'),_0x1ceb1e[_0xf8e3('0x46')]));logger[_0xf8e3('0x13')](util[_0xf8e3('0x51')](_0xf8e3('0x69'),_0x45361d));if(_0x45361d!=='unmanaged'){logger[_0xf8e3('0x13')]('['+[_0x45361d[_0xf8e3('0x14')]()]+']',_0xf8e3('0x6a'));emit(_0x2b8d88[_0xf8e3('0x57')],_0x3e39a8[_0xf8e3('0x4c')],_0x1ceb1e[_0xf8e3('0x46')]);}})['catch'](function(_0x220bb1){logger[_0xf8e3('0x16')]('['+[_0x45361d[_0xf8e3('0x14')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x220bb1,{'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 0a067f8..8deaf40 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 _0x38e7=['Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','name','length','forEach','variableName','push','idField','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','then','Enduser\x20found!','set_entry','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','type','custom_fields','customVariable','Variable','login','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0x38e7,0x1eb));var _0x738e=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x38e7[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x738e('0x0'));var rp=require(_0x738e('0x1'));var BPromise=require(_0x738e('0x2'));var md5=require(_0x738e('0x3'));var util=require(_0x738e('0x4'));var Redis=require(_0x738e('0x5'));var intUtil=require(_0x738e('0x6'));var config=require(_0x738e('0x7'));var logger=require(_0x738e('0x8'))(_0x738e('0x9'));config[_0x738e('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x738e('0xb'))(new Redis(config[_0x738e('0xa')]));var def={'method':_0x738e('0xc'),'json':!![]};function emit(_0x287d50,_0x160926,_0x236c7b){io['to'](_0x287d50)[_0x738e('0xd')](_0x160926,_0x236c7b);}function getTicket(_0x36f796,_0x46c692,_0x1e0d5b,_0x2cc1d1,_0x5100f9,_0x585883,_0x4478f4,_0x512ba5){logger[_0x738e('0xe')](_0x738e('0xf'));var _0x4d1615=new Date();var _0xd0134=[{'name':'name','value':intUtil[_0x738e('0x10')](_0x2cc1d1[_0x738e('0x11')],_0x5100f9,'\x20')},{'name':_0x738e('0x12'),'value':_0x46c692['id']},{'name':_0x738e('0x13'),'value':_0x46c692['id']},{'name':_0x738e('0x14'),'value':intUtil[_0x738e('0x10')](_0x2cc1d1['Descriptions'],_0x5100f9,'\x0a')},{'name':_0x738e('0x15'),'value':_0x4d1615[_0x738e('0x16')]()[_0x738e('0x17')](0x0,0x13)[_0x738e('0x18')]('T','\x20')},{'name':_0x738e('0x19'),'value':'0'},{'name':_0x738e('0x1a'),'value':'15'},{'name':'parent_id','value':_0x1e0d5b['id']},{'name':_0x738e('0x1b'),'value':_0x738e('0x1c')},{'name':'parent_name','value':_0x1e0d5b[_0x738e('0x1d')]},{'name':'direction','value':_0x512ba5}];if(_0x585883[_0x738e('0x1e')]){_[_0x738e('0x1f')](_0x585883,function(_0x4618a4){if(_0x5100f9[_0x4618a4[_0x738e('0x20')]]){_0xd0134[_0x738e('0x21')]({'name':_0x4618a4[_0x738e('0x22')],'value':_0x5100f9[_0x4618a4[_0x738e('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x738e('0x23'),'response_type':'JSON','rest_data':JSON[_0x738e('0x24')]({'session':_0x4478f4['id'],'module_name':_0x738e('0x25'),'name_value_list':_0xd0134})}});}function getAuth(_0xb1d393){return util['format'](_0x738e('0x26'),new Buffer(_0xb1d393[_0x738e('0x27')]+':X')[_0x738e('0x28')](_0x738e('0x29')));}function getServerInfo(_0xca9396){return request({'form':{'method':_0x738e('0x2a'),'input_type':_0x738e('0x23'),'response_type':_0x738e('0x23'),'rest_data':JSON[_0x738e('0x24')]({'session':_0xca9396['id']})}});}function getUser(_0x500473,_0x309187,_0x609ed6){if(!_[_0x738e('0x2b')](_0x309187)){logger['info'](_0x738e('0x2c'),_0x309187);return request({'form':{'method':_0x738e('0x2d'),'input_type':'JSON','response_type':_0x738e('0x23'),'rest_data':JSON['stringify']({'session':_0x609ed6['id'],'module_name':'Employees','query':util[_0x738e('0x2e')](_0x738e('0x2f'),_0x309187),'order_by':'','offset':'0','select_fields':['id',_0x738e('0x1d'),_0x738e('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3c6efd){if(_0x3c6efd[_0x738e('0x31')][_0x738e('0x1e')]){var _0x471af6=_[_0x738e('0x32')](_0x3c6efd[_0x738e('0x31')],function(_0x2e3a94){return _0x2e3a94[_0x738e('0x33')][_0x738e('0x30')][_0x738e('0x34')]===_0x309187;});if(_0x471af6){logger[_0x738e('0xe')](_0x738e('0x35'));return BPromise[_0x738e('0x36')]({'id':_0x471af6[_0x738e('0x33')]['id'][_0x738e('0x34')],'name':_0x471af6['name_value_list'][_0x738e('0x1d')][_0x738e('0x34')]});}}logger[_0x738e('0xe')](_0x738e('0x37'));return BPromise['resolve']({'id':_0x609ed6['name_value_list'][_0x738e('0x38')][_0x738e('0x34')],'name':_0x609ed6['name_value_list'][_0x738e('0x30')][_0x738e('0x34')]});});}else{logger[_0x738e('0xe')](_0x738e('0x39'));return BPromise[_0x738e('0x36')]({'id':_0x609ed6[_0x738e('0x33')][_0x738e('0x38')]['value'],'name':_0x609ed6[_0x738e('0x33')][_0x738e('0x30')][_0x738e('0x34')]});}}function getEndUser(_0x34cfe2,_0x227522,_0x134094,_0x345ca7){logger[_0x738e('0xe')](_0x738e('0x3a'),_0x134094);return request({'form':{'method':_0x738e('0x2d'),'input_type':'JSON','response_type':_0x738e('0x23'),'rest_data':JSON[_0x738e('0x24')]({'session':_0x345ca7['id'],'module_name':_0x738e('0x1c'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x134094),'order_by':'','offset':'0','select_fields':['id',_0x738e('0x1d'),_0x738e('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x738e('0x3c')](function(_0x170c4d){if(_0x170c4d[_0x738e('0x31')][_0x738e('0x1e')]){var _0x2df6e9=_['find'](_0x170c4d['entry_list'],function(_0x1ebebd){return _0x1ebebd['name_value_list'][_0x738e('0x3b')][_0x738e('0x34')]===_0x134094;});if(_0x2df6e9){logger['info'](_0x738e('0x3d'));return BPromise[_0x738e('0x36')]({'id':_0x2df6e9['name_value_list']['id'][_0x738e('0x34')],'name':_0x2df6e9[_0x738e('0x33')][_0x738e('0x1d')][_0x738e('0x34')],'phone':_0x2df6e9[_0x738e('0x33')][_0x738e('0x3b')][_0x738e('0x34')]});}}else{logger[_0x738e('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x738e('0x3e'),'input_type':_0x738e('0x23'),'response_type':_0x738e('0x23'),'rest_data':JSON[_0x738e('0x24')]({'session':_0x345ca7['id'],'module_name':_0x738e('0x1c'),'name_value_list':[{'name':_0x738e('0x3f'),'value':_0x227522!==_0x738e('0x40')?_0x227522:util['format']('Caller\x20-\x20%s',_0x134094)},{'name':'phone_home','value':_0x134094}]})}})[_0x738e('0x3c')](function(_0x5cac25){logger['info'](_0x738e('0x41'));return BPromise[_0x738e('0x36')]({'id':_0x5cac25['id'],'name':_0x5cac25['entry_list']['first_name'][_0x738e('0x34')],'phone':_0x5cac25[_0x738e('0x31')]['phone_home'][_0x738e('0x34')]});});}});}function request(_0x5e5d37){logger[_0x738e('0x42')](_0x738e('0x43'),JSON['stringify'](_0x5e5d37));return rp(_[_0x738e('0x44')](def,_0x5e5d37));}function getTags(_0x3950b1,_0x2dd327){var _0x51f1a5=[];if(_0x3950b1&&_0x3950b1[_0x738e('0x1e')]>0x0){_0x51f1a5=_[_0x738e('0x45')](_0x3950b1,_0x2dd327);}return _0x51f1a5;}function getCustomFields(_0x3c4c3e,_0x19645e){var _0x902d46=[];var _0x448eb0={'custom_fields':[]};if(_0x3c4c3e['length']>0x0){_[_0x738e('0x1f')](_0x3c4c3e,function(_0x5cbdad){if(_0x5cbdad['type']==='string'&&_0x5cbdad[_0x738e('0x46')]&&!_0x5cbdad[_0x738e('0x47')]){_0x448eb0[_0x5cbdad[_0x738e('0x46')][_0x738e('0x48')]()]=_0x5cbdad[_0x738e('0x49')][_0x738e('0x28')]();}else if(_0x5cbdad[_0x738e('0x4a')]==='string'&&_0x5cbdad[_0x738e('0x22')]&&_0x5cbdad['customField']){_0x448eb0['custom_fields']['push']({'id':_0x5cbdad[_0x738e('0x22')],'value':_0x5cbdad['content']['toString']()});}else if(_0x5cbdad[_0x738e('0x4a')]==='variable'&&_0x5cbdad['variableName']&&_0x5cbdad[_0x738e('0x22')]&&_0x5cbdad[_0x738e('0x47')]){_0x19645e[_0x5cbdad['variableName']]&&_0x448eb0[_0x738e('0x4b')][_0x738e('0x21')]({'id':_0x5cbdad[_0x738e('0x22')],'value':_0x19645e[_0x5cbdad[_0x738e('0x20')]][_0x738e('0x28')]()});}else if(_0x5cbdad['type']===_0x738e('0x4c')&&_0x5cbdad['Variable']&&_0x5cbdad[_0x738e('0x4d')][_0x738e('0x1d')]&&_0x5cbdad['idField']&&_0x5cbdad[_0x738e('0x47')]){_0x19645e[_0x5cbdad['Variable'][_0x738e('0x1d')]['toLowerCase']()]&&_0x448eb0[_0x738e('0x4b')][_0x738e('0x21')]({'id':_0x5cbdad['idField'],'value':_0x19645e[_0x5cbdad['Variable'][_0x738e('0x1d')][_0x738e('0x48')]()][_0x738e('0x28')]()});}});}return _0x448eb0;}function getConnection(_0x15af5d){return request({'method':_0x738e('0xc'),'form':{'method':_0x738e('0x4e'),'input_type':'JSON','response_type':_0x738e('0x23'),'rest_data':JSON[_0x738e('0x24')]({'user_auth':{'user_name':_0x15af5d['username'],'password':_0x15af5d['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x846cde){var _0x47effb=_0x846cde;if(_0x47effb['id']){def[_0x738e('0x4f')]=_0x47effb['id'];return BPromise[_0x738e('0x36')](_0x47effb);}else{throw new Error(util['format'](_0x738e('0x50'),_0x15af5d['id']));}});}function setRelationship(_0x36561d,_0x17c3d5,_0x51111e,_0x2730e8){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x738e('0x24')]({'session':_0x36561d['id'],'module_name':'Calls','module_id':_0x51111e['id'],'link_field_name':_0x2730e8,'related_ids':[_0x17c3d5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x738e('0x51')]=function(_0x5df7a9,_0x4bf7d2,_0x385458,_0x7b29a1,_0x13029d,_0x2d3068){var _0x5cd068,_0x5e1481,_0x581583,_0xd211db;_0x2d3068[_0x738e('0x52')]=intUtil[_0x738e('0x53')](_0x2d3068[_0x738e('0x52')]);_0x2d3068[_0x738e('0x54')]=intUtil['stripTrailingSlash'](_0x2d3068[_0x738e('0x54')]);def[_0x738e('0x55')]=util[_0x738e('0x2e')](_0x738e('0x56'),_0x2d3068[_0x738e('0x52')]);if(_0x13029d&&_0x13029d[_0x738e('0x57')]){logger[_0x738e('0xe')](_0x738e('0x58'),_0x738e('0x59'));_0x4bf7d2[_0x738e('0x5a')]=util[_0x738e('0x2e')](_0x738e('0x5b'),_0x2d3068[_0x738e('0x54')],_0x4bf7d2[_0x738e('0x5c')],md5(_0x4bf7d2[_0x738e('0x5c')]));}else{_0x4bf7d2[_0x738e('0x5a')]='';}return getConnection(_0x2d3068)['then'](function(_0xcd9404){_0xd211db=_0xcd9404;return getUser(_0x2d3068,_0x7b29a1[_0x738e('0x1d')],_0xd211db);})[_0x738e('0x3c')](function(_0x1d4166){_0x5cd068=_0x1d4166;logger[_0x738e('0xe')](_0x738e('0x5d'),_0x5cd068['id']);return getEndUser(_0x2d3068,_0x4bf7d2['calleridname'],_0x4bf7d2[_0x738e('0x5e')],_0xd211db);})[_0x738e('0x3c')](function(_0x17951d){_0x5e1481=_0x17951d;logger[_0x738e('0xe')](_0x738e('0x5f'),_0x5e1481['id']);return getTicket(_0x2d3068,_0x5cd068,_0x5e1481,_0x385458,_0x4bf7d2,_0x385458[_0x738e('0x60')],_0xd211db,_0x738e('0x61'));})[_0x738e('0x3c')](function(_0xe18662){_0x581583=_0xe18662;logger[_0x738e('0xe')](_0x738e('0x62'));logger['info'](_0x738e('0x63'),_0x581583['id']);return setRelationship(_0xd211db,_0x5cd068,_0x581583,_0x738e('0x64'));})[_0x738e('0x3c')](function(){return setRelationship(_0xd211db,_0x5e1481,_0x581583,_0x738e('0x65'));})['then'](function(){return getServerInfo(_0xd211db);})[_0x738e('0x3c')](function(_0x44b9e0){var _0x4741bc=parseInt(_0x44b9e0[_0x738e('0x66')][_0x738e('0x67')](0x0));var _0x334346=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2d3068[_0x738e('0x52')],_0x581583['id']);if(_0x4741bc>0x6){_0x334346=util[_0x738e('0x2e')](_0x738e('0x68'),_0x2d3068[_0x738e('0x52')],_0x581583['id']);}logger[_0x738e('0xe')](_0x738e('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x738e('0x2e')](_0x738e('0x69'),_0x7b29a1[_0x738e('0x1d')]),_0x738e('0x6a'),{'uri':_0x334346});})[_0x738e('0x6b')](function(_0x17aecc){logger[_0x738e('0x6c')]('[QUEUE]',JSON[_0x738e('0x24')](_0x17aecc));});};exports[_0x738e('0x6d')]=function(_0x1c8fa4,_0x4a6a42,_0x4298e1,_0x281dd0,_0x250682,_0x3586a7,_0x499c04){var _0x3274ef,_0x32356e,_0x257eb3,_0x7f5076;_0x3586a7[_0x738e('0x52')]=intUtil['stripTrailingSlash'](_0x3586a7['remoteUri']);_0x3586a7[_0x738e('0x54')]=intUtil['stripTrailingSlash'](_0x3586a7[_0x738e('0x54')]);def[_0x738e('0x55')]=util[_0x738e('0x2e')](_0x738e('0x56'),_0x3586a7['remoteUri']);if(_0x499c04&&_0x499c04[_0x738e('0x6e')]&&_0x499c04[_0x738e('0x6e')]!=='none'){logger[_0x738e('0xe')](_0x738e('0x6f'),'Recording\x20is\x20enabled!');_0x4a6a42[_0x738e('0x5a')]=util[_0x738e('0x2e')](_0x738e('0x5b'),_0x3586a7[_0x738e('0x54')],_0x4a6a42[_0x738e('0x5c')],md5(_0x4a6a42[_0x738e('0x5c')]));}return getConnection(_0x3586a7)[_0x738e('0x3c')](function(_0x2281e5){_0x7f5076=_0x2281e5;return getUser(_0x3586a7,_0x281dd0[_0x738e('0x1d')],_0x7f5076);})[_0x738e('0x3c')](function(_0x43dba9){_0x3274ef=_0x43dba9;logger[_0x738e('0xe')](_0x738e('0x5d'),_0x3274ef['id']);return getEndUser(_0x3586a7,_0x4a6a42[_0x738e('0x70')],_0x4a6a42[_0x738e('0x71')],_0x7f5076);})[_0x738e('0x3c')](function(_0x1a8448){_0x32356e=_0x1a8448;logger[_0x738e('0xe')](_0x738e('0x5f'),_0x32356e['id']);return getTicket(_0x3586a7,_0x3274ef,_0x32356e,_0x4298e1,_0x4a6a42,_0x4298e1[_0x738e('0x60')],_0x7f5076,_0x738e('0x72'));})[_0x738e('0x3c')](function(_0x356ebc){_0x257eb3=_0x356ebc;logger[_0x738e('0xe')](_0x738e('0x62'));logger[_0x738e('0xe')](_0x738e('0x63'),_0x257eb3['id']);return setRelationship(_0x7f5076,_0x3274ef,_0x257eb3,_0x738e('0x64'));})[_0x738e('0x3c')](function(){return setRelationship(_0x7f5076,_0x32356e,_0x257eb3,_0x738e('0x65'));})[_0x738e('0x3c')](function(){return getServerInfo(_0x7f5076);})[_0x738e('0x3c')](function(_0x7a227a){var _0x5a80b5=parseInt(_0x7a227a[_0x738e('0x66')][_0x738e('0x67')](0x0));var _0x2194ad=util[_0x738e('0x2e')](_0x738e('0x73'),_0x3586a7[_0x738e('0x52')],_0x257eb3['id']);if(_0x5a80b5>0x6){_0x2194ad=util[_0x738e('0x2e')](_0x738e('0x68'),_0x3586a7[_0x738e('0x52')],_0x257eb3['id']);}logger[_0x738e('0xe')](_0x738e('0x6f'),_0x738e('0x74'));emit(util['format'](_0x738e('0x69'),_0x281dd0['name']),_0x738e('0x6a'),{'uri':_0x2194ad});})[_0x738e('0x6b')](function(_0x41883c){logger[_0x738e('0x6c')]('[OUTBOUND]',JSON['stringify'](_0x41883c));});};exports[_0x738e('0x75')]=function(_0x58161e,_0x5eda75,_0x2cff02,_0x42fa39,_0x5a986f,_0x498721){var _0x40067a,_0x3a490f,_0xd88356,_0x512492;_0x498721[_0x738e('0x52')]=intUtil['stripTrailingSlash'](_0x498721['remoteUri']);_0x498721['serverUrl']=intUtil['stripTrailingSlash'](_0x498721[_0x738e('0x54')]);def[_0x738e('0x55')]=util[_0x738e('0x2e')](_0x738e('0x56'),_0x498721[_0x738e('0x52')]);if(_0x5a986f&&_0x5a986f[_0x738e('0x57')]){logger[_0x738e('0xe')]('['+_0x5eda75['lastevent'][_0x738e('0x76')]()+']',_0x738e('0x59'));_0x5eda75[_0x738e('0x5a')]=util['format'](_0x738e('0x5b'),_0x498721[_0x738e('0x54')],_0x5eda75[_0x738e('0x5c')],md5(_0x5eda75[_0x738e('0x5c')]));}else{_0x5eda75['recordingURL']='';}return getConnection(_0x498721)[_0x738e('0x3c')](function(_0x4725c3){_0x512492=_0x4725c3;if(!_[_0x738e('0x2b')](_0x42fa39)){return getUser(_0x498721,_0x42fa39[_0x738e('0x1d')],_0x512492);}else{return getUser(_0x498721,null,_0x512492);}})[_0x738e('0x3c')](function(_0x38b5f4){_0x40067a=_0x38b5f4;logger[_0x738e('0xe')](_0x738e('0x5d'),_0x40067a['id']);return getEndUser(_0x498721,_0x5eda75[_0x738e('0x77')],_0x5eda75[_0x738e('0x5e')],_0x512492);})[_0x738e('0x3c')](function(_0x411b35){_0x3a490f=_0x411b35;logger['info'](_0x738e('0x5f'),_0x3a490f['id']);return getTicket(_0x498721,_0x40067a,_0x3a490f,_0x2cff02,_0x5eda75,_0x2cff02['Fields'],_0x512492,_0x738e('0x61'));})['then'](function(_0x2d8b09){_0xd88356=_0x2d8b09;logger[_0x738e('0xe')]('Ticket\x20created!');logger['info'](_0x738e('0x63'),_0xd88356['id']);return setRelationship(_0x512492,_0x40067a,_0xd88356,_0x738e('0x64'));})[_0x738e('0x3c')](function(){return setRelationship(_0x512492,_0x3a490f,_0xd88356,'contacts');})['then'](function(){return getServerInfo(_0x512492);})[_0x738e('0x6b')](function(_0x39586b){logger[_0x738e('0x6c')]('['+_0x5eda75[_0x738e('0x78')]['toUpperCase']()+']',JSON[_0x738e('0x24')](_0x39586b));});}; \ No newline at end of file +var _0x188f=['get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','recordingURL','destcalleridnum','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','calleridname','The\x20Ticket\x20ID\x20is:','request-promise','bluebird','md5','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','set_entry','JSON','Calls','Basic\x20%s','toString','get_server_info','stringify','isNil','info','Getting\x20agent\x20with\x20name'];(function(_0x1f1e5f,_0x376859){var _0x13b7ea=function(_0x27aa70){while(--_0x27aa70){_0x1f1e5f['push'](_0x1f1e5f['shift']());}};_0x13b7ea(++_0x376859);}(_0x188f,0xc8));var _0xf188=function(_0x3905c1,_0x2b2aaa){_0x3905c1=_0x3905c1-0x0;var _0x49a197=_0x188f[_0x3905c1];return _0x49a197;};'use strict';var _=require('lodash');var rp=require(_0xf188('0x0'));var BPromise=require(_0xf188('0x1'));var md5=require(_0xf188('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xf188('0x3'));var config=require('../../../../config/environment');var logger=require(_0xf188('0x4'))('sugarcrm');config[_0xf188('0x5')]=_[_0xf188('0x6')](config['redis'],{'host':_0xf188('0x7'),'port':0x18eb});var io=require(_0xf188('0x8'))(new Redis(config[_0xf188('0x5')]));var def={'method':_0xf188('0x9'),'json':!![]};function emit(_0x5822dc,_0x98540d,_0x18c1ed){io['to'](_0x5822dc)[_0xf188('0xa')](_0x98540d,_0x18c1ed);}function getTicket(_0x289220,_0x529d16,_0x1a3ea9,_0x2286ab,_0x1bd3fb,_0x57d4fc,_0x4ebc8f,_0x353cc0){logger['info'](_0xf188('0xb'));var _0x357349=new Date();var _0x104436=[{'name':_0xf188('0xc'),'value':intUtil[_0xf188('0xd')](_0x2286ab[_0xf188('0xe')],_0x1bd3fb,'\x20')},{'name':_0xf188('0xf'),'value':_0x529d16['id']},{'name':'created_by','value':_0x529d16['id']},{'name':_0xf188('0x10'),'value':intUtil[_0xf188('0xd')](_0x2286ab[_0xf188('0x11')],_0x1bd3fb,'\x0a')},{'name':_0xf188('0x12'),'value':_0x357349[_0xf188('0x13')]()[_0xf188('0x14')](0x0,0x13)[_0xf188('0x15')]('T','\x20')},{'name':_0xf188('0x16'),'value':'0'},{'name':_0xf188('0x17'),'value':'15'},{'name':_0xf188('0x18'),'value':_0x1a3ea9['id']},{'name':_0xf188('0x19'),'value':_0xf188('0x1a')},{'name':_0xf188('0x1b'),'value':_0x1a3ea9['name']},{'name':_0xf188('0x1c'),'value':_0x353cc0}];if(_0x57d4fc[_0xf188('0x1d')]){_[_0xf188('0x1e')](_0x57d4fc,function(_0x9446c3){if(_0x1bd3fb[_0x9446c3['variableName']]){_0x104436[_0xf188('0x1f')]({'name':_0x9446c3[_0xf188('0x20')],'value':_0x1bd3fb[_0x9446c3[_0xf188('0x21')]]});}});}return request({'form':{'method':_0xf188('0x22'),'input_type':_0xf188('0x23'),'response_type':_0xf188('0x23'),'rest_data':JSON['stringify']({'session':_0x4ebc8f['id'],'module_name':_0xf188('0x24'),'name_value_list':_0x104436})}});}function getAuth(_0x717d41){return util['format'](_0xf188('0x25'),new Buffer(_0x717d41['apiKey']+':X')[_0xf188('0x26')]('base64'));}function getServerInfo(_0x2d10a6){return request({'form':{'method':_0xf188('0x27'),'input_type':_0xf188('0x23'),'response_type':_0xf188('0x23'),'rest_data':JSON[_0xf188('0x28')]({'session':_0x2d10a6['id']})}});}function getUser(_0x3faffd,_0x5db00c,_0x22575d){if(!_[_0xf188('0x29')](_0x5db00c)){logger[_0xf188('0x2a')](_0xf188('0x2b'),_0x5db00c);return request({'form':{'method':_0xf188('0x2c'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x22575d['id'],'module_name':_0xf188('0x2d'),'query':util[_0xf188('0x2e')](_0xf188('0x2f'),_0x5db00c),'order_by':'','offset':'0','select_fields':['id','name',_0xf188('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf188('0x31')](function(_0x473767){if(_0x473767[_0xf188('0x32')][_0xf188('0x1d')]){var _0x4f635f=_[_0xf188('0x33')](_0x473767['entry_list'],function(_0x51e910){return _0x51e910[_0xf188('0x34')][_0xf188('0x30')][_0xf188('0x35')]===_0x5db00c;});if(_0x4f635f){logger[_0xf188('0x2a')](_0xf188('0x36'));return BPromise[_0xf188('0x37')]({'id':_0x4f635f[_0xf188('0x34')]['id'][_0xf188('0x35')],'name':_0x4f635f[_0xf188('0x34')]['name'][_0xf188('0x35')]});}}logger[_0xf188('0x2a')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf188('0x37')]({'id':_0x22575d['name_value_list'][_0xf188('0x38')][_0xf188('0x35')],'name':_0x22575d[_0xf188('0x34')][_0xf188('0x30')][_0xf188('0x35')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf188('0x37')]({'id':_0x22575d['name_value_list']['user_id'][_0xf188('0x35')],'name':_0x22575d['name_value_list'][_0xf188('0x30')]['value']});}}function getEndUser(_0x2798ac,_0x3f1181,_0x43bdbb,_0x39b9b8){logger['info']('Searching\x20enduser\x20with\x20phone',_0x43bdbb);return request({'form':{'method':_0xf188('0x2c'),'input_type':_0xf188('0x23'),'response_type':'JSON','rest_data':JSON[_0xf188('0x28')]({'session':_0x39b9b8['id'],'module_name':_0xf188('0x1a'),'query':util[_0xf188('0x2e')](_0xf188('0x39'),_0x43bdbb),'order_by':'','offset':'0','select_fields':['id',_0xf188('0xc'),_0xf188('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf188('0x31')](function(_0x5eef8c){if(_0x5eef8c[_0xf188('0x32')][_0xf188('0x1d')]){var _0x401771=_[_0xf188('0x33')](_0x5eef8c[_0xf188('0x32')],function(_0x4438bd){return _0x4438bd[_0xf188('0x34')][_0xf188('0x3a')][_0xf188('0x35')]===_0x43bdbb;});if(_0x401771){logger[_0xf188('0x2a')](_0xf188('0x3b'));return BPromise[_0xf188('0x37')]({'id':_0x401771[_0xf188('0x34')]['id']['value'],'name':_0x401771[_0xf188('0x34')][_0xf188('0xc')][_0xf188('0x35')],'phone':_0x401771['name_value_list'][_0xf188('0x3a')][_0xf188('0x35')]});}}else{logger[_0xf188('0x2a')](_0xf188('0x3c'));return request({'form':{'method':'set_entry','input_type':_0xf188('0x23'),'response_type':'JSON','rest_data':JSON[_0xf188('0x28')]({'session':_0x39b9b8['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x3f1181!==''?_0x3f1181:util[_0xf188('0x2e')](_0xf188('0x3d'),_0x43bdbb)},{'name':_0xf188('0x3a'),'value':_0x43bdbb}]})}})[_0xf188('0x31')](function(_0x1785c2){logger[_0xf188('0x2a')](_0xf188('0x3e'));return BPromise[_0xf188('0x37')]({'id':_0x1785c2['id'],'name':_0x1785c2[_0xf188('0x32')][_0xf188('0x3f')]['value'],'phone':_0x1785c2[_0xf188('0x32')][_0xf188('0x3a')][_0xf188('0x35')]});});}});}function request(_0x5722e9){logger[_0xf188('0x40')](_0xf188('0x41'),JSON['stringify'](_0x5722e9));return rp(_[_0xf188('0x42')](def,_0x5722e9));}function getTags(_0xede219,_0x21f088){var _0x5dcb4c=[];if(_0xede219&&_0xede219['length']>0x0){_0x5dcb4c=_[_0xf188('0x43')](_0xede219,_0x21f088);}return _0x5dcb4c;}function getCustomFields(_0x3e0702,_0x49c216){var _0x319479=[];var _0x307943={'custom_fields':[]};if(_0x3e0702['length']>0x0){_[_0xf188('0x1e')](_0x3e0702,function(_0x43b30c){if(_0x43b30c[_0xf188('0x44')]===_0xf188('0x45')&&_0x43b30c['nameField']&&!_0x43b30c[_0xf188('0x46')]){_0x307943[_0x43b30c[_0xf188('0x47')][_0xf188('0x48')]()]=_0x43b30c[_0xf188('0x49')]['toString']();}else if(_0x43b30c[_0xf188('0x44')]===_0xf188('0x45')&&_0x43b30c[_0xf188('0x20')]&&_0x43b30c[_0xf188('0x46')]){_0x307943[_0xf188('0x4a')]['push']({'id':_0x43b30c['idField'],'value':_0x43b30c[_0xf188('0x49')]['toString']()});}else if(_0x43b30c[_0xf188('0x44')]===_0xf188('0x4b')&&_0x43b30c['variableName']&&_0x43b30c['idField']&&_0x43b30c['customField']){_0x49c216[_0x43b30c['variableName']]&&_0x307943[_0xf188('0x4a')][_0xf188('0x1f')]({'id':_0x43b30c[_0xf188('0x20')],'value':_0x49c216[_0x43b30c[_0xf188('0x21')]][_0xf188('0x26')]()});}else if(_0x43b30c[_0xf188('0x44')]===_0xf188('0x4c')&&_0x43b30c[_0xf188('0x4d')]&&_0x43b30c[_0xf188('0x4d')][_0xf188('0xc')]&&_0x43b30c[_0xf188('0x20')]&&_0x43b30c[_0xf188('0x46')]){_0x49c216[_0x43b30c[_0xf188('0x4d')]['name']['toLowerCase']()]&&_0x307943[_0xf188('0x4a')]['push']({'id':_0x43b30c['idField'],'value':_0x49c216[_0x43b30c[_0xf188('0x4d')]['name']['toLowerCase']()]['toString']()});}});}return _0x307943;}function getConnection(_0x4d58c4){return request({'method':_0xf188('0x9'),'form':{'method':_0xf188('0x4e'),'input_type':_0xf188('0x23'),'response_type':_0xf188('0x23'),'rest_data':JSON[_0xf188('0x28')]({'user_auth':{'user_name':_0x4d58c4['username'],'password':_0x4d58c4[_0xf188('0x4f')],'encryption':_0xf188('0x50')},'application':_0xf188('0x51')})}})['then'](function(_0xca3155){var _0x593f7d=_0xca3155;if(_0x593f7d['id']){def[_0xf188('0x52')]=_0x593f7d['id'];return BPromise[_0xf188('0x37')](_0x593f7d);}else{throw new Error(util[_0xf188('0x2e')](_0xf188('0x53'),_0x4d58c4['id']));}});}function setRelationship(_0x756745,_0x57fd78,_0x3292e9,_0x2097b2){return request({'form':{'method':_0xf188('0x54'),'input_type':_0xf188('0x23'),'response_type':_0xf188('0x23'),'rest_data':JSON[_0xf188('0x28')]({'session':_0x756745['id'],'module_name':_0xf188('0x24'),'module_id':_0x3292e9['id'],'link_field_name':_0x2097b2,'related_ids':[_0x57fd78['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x51eba5,_0x598b8f,_0x5dc96a,_0x59ed27,_0x864e3b,_0x13369e){var _0x3360e9,_0x4d5a03,_0x321bfc,_0x22eb6f;_0x13369e[_0xf188('0x55')]=intUtil[_0xf188('0x56')](_0x13369e[_0xf188('0x55')]);_0x13369e['serverUrl']=intUtil['stripTrailingSlash'](_0x13369e[_0xf188('0x57')]);def[_0xf188('0x58')]=util[_0xf188('0x2e')](_0xf188('0x59'),_0x13369e['remoteUri']);if(_0x864e3b&&_0x864e3b['monitor_format']){logger['info'](_0xf188('0x5a'),_0xf188('0x5b'));_0x598b8f['recordingURL']=util[_0xf188('0x2e')](_0xf188('0x5c'),_0x13369e[_0xf188('0x57')],_0x598b8f[_0xf188('0x5d')],md5(_0x598b8f['uniqueid']));}else{_0x598b8f['recordingURL']='';}return getConnection(_0x13369e)[_0xf188('0x31')](function(_0x2dce16){_0x22eb6f=_0x2dce16;return getUser(_0x13369e,_0x59ed27['name'],_0x22eb6f);})[_0xf188('0x31')](function(_0x4bb448){_0x3360e9=_0x4bb448;logger['info'](_0xf188('0x5e'),_0x3360e9['id']);return getEndUser(_0x13369e,_0x598b8f['calleridname'],_0x598b8f[_0xf188('0x5f')],_0x22eb6f);})[_0xf188('0x31')](function(_0x113dba){_0x4d5a03=_0x113dba;logger[_0xf188('0x2a')](_0xf188('0x60'),_0x4d5a03['id']);return getTicket(_0x13369e,_0x3360e9,_0x4d5a03,_0x5dc96a,_0x598b8f,_0x5dc96a[_0xf188('0x61')],_0x22eb6f,_0xf188('0x62'));})[_0xf188('0x31')](function(_0x3ca466){_0x321bfc=_0x3ca466;logger[_0xf188('0x2a')](_0xf188('0x63'));logger[_0xf188('0x2a')]('The\x20Ticket\x20ID\x20is:',_0x321bfc['id']);return setRelationship(_0x22eb6f,_0x3360e9,_0x321bfc,_0xf188('0x64'));})[_0xf188('0x31')](function(){return setRelationship(_0x22eb6f,_0x4d5a03,_0x321bfc,_0xf188('0x65'));})[_0xf188('0x31')](function(){return getServerInfo(_0x22eb6f);})[_0xf188('0x31')](function(_0x405664){var _0xd44702=parseInt(_0x405664[_0xf188('0x66')][_0xf188('0x67')](0x0));var _0x3c650e=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x13369e[_0xf188('0x55')],_0x321bfc['id']);if(_0xd44702>0x6){_0x3c650e=util[_0xf188('0x2e')](_0xf188('0x68'),_0x13369e[_0xf188('0x55')],_0x321bfc['id']);}logger['info'](_0xf188('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf188('0x2e')](_0xf188('0x69'),_0x59ed27[_0xf188('0xc')]),_0xf188('0x6a'),{'uri':_0x3c650e});})[_0xf188('0x6b')](function(_0x5cc90b){logger[_0xf188('0x6c')]('[QUEUE]',JSON[_0xf188('0x28')](_0x5cc90b));});};exports[_0xf188('0x6d')]=function(_0x22c1b7,_0x4f0969,_0xc5baa3,_0x33ea0b,_0x331f6b,_0x54dd08,_0x1e9a40){var _0x40de80,_0x5064e7,_0x4117b6,_0x1c8de4;_0x54dd08['remoteUri']=intUtil[_0xf188('0x56')](_0x54dd08[_0xf188('0x55')]);_0x54dd08[_0xf188('0x57')]=intUtil[_0xf188('0x56')](_0x54dd08[_0xf188('0x57')]);def['uri']=util[_0xf188('0x2e')](_0xf188('0x59'),_0x54dd08[_0xf188('0x55')]);if(_0x1e9a40&&_0x1e9a40[_0xf188('0x6e')]&&_0x1e9a40['recordingFormat']!==_0xf188('0x6f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4f0969[_0xf188('0x70')]=util[_0xf188('0x2e')](_0xf188('0x5c'),_0x54dd08[_0xf188('0x57')],_0x4f0969['uniqueid'],md5(_0x4f0969['uniqueid']));}return getConnection(_0x54dd08)['then'](function(_0x28a8ce){_0x1c8de4=_0x28a8ce;return getUser(_0x54dd08,_0x33ea0b['name'],_0x1c8de4);})[_0xf188('0x31')](function(_0x1f3ffb){_0x40de80=_0x1f3ffb;logger[_0xf188('0x2a')](_0xf188('0x5e'),_0x40de80['id']);return getEndUser(_0x54dd08,_0x4f0969['destcalleridname'],_0x4f0969[_0xf188('0x71')],_0x1c8de4);})[_0xf188('0x31')](function(_0x14c15c){_0x5064e7=_0x14c15c;logger[_0xf188('0x2a')](_0xf188('0x60'),_0x5064e7['id']);return getTicket(_0x54dd08,_0x40de80,_0x5064e7,_0xc5baa3,_0x4f0969,_0xc5baa3[_0xf188('0x61')],_0x1c8de4,'Outbound');})[_0xf188('0x31')](function(_0x332e1d){_0x4117b6=_0x332e1d;logger['info']('Ticket\x20created!');logger[_0xf188('0x2a')]('The\x20Ticket\x20ID\x20is:',_0x4117b6['id']);return setRelationship(_0x1c8de4,_0x40de80,_0x4117b6,_0xf188('0x64'));})[_0xf188('0x31')](function(){return setRelationship(_0x1c8de4,_0x5064e7,_0x4117b6,_0xf188('0x65'));})[_0xf188('0x31')](function(){return getServerInfo(_0x1c8de4);})[_0xf188('0x31')](function(_0x592f29){var _0x3ea7a7=parseInt(_0x592f29[_0xf188('0x66')][_0xf188('0x67')](0x0));var _0x2d5bc1=util[_0xf188('0x2e')](_0xf188('0x72'),_0x54dd08[_0xf188('0x55')],_0x4117b6['id']);if(_0x3ea7a7>0x6){_0x2d5bc1=util[_0xf188('0x2e')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x54dd08[_0xf188('0x55')],_0x4117b6['id']);}logger[_0xf188('0x2a')](_0xf188('0x73'),_0xf188('0x74'));emit(util[_0xf188('0x2e')](_0xf188('0x69'),_0x33ea0b[_0xf188('0xc')]),_0xf188('0x6a'),{'uri':_0x2d5bc1});})[_0xf188('0x6b')](function(_0x2d8320){logger[_0xf188('0x6c')](_0xf188('0x73'),JSON[_0xf188('0x28')](_0x2d8320));});};exports[_0xf188('0x75')]=function(_0x51225d,_0x13c52f,_0x54eac2,_0x1219fa,_0x502cdf,_0x19d0b0){var _0x43aa0b,_0x1f1a97,_0x5c34ae,_0x147b1c;_0x19d0b0[_0xf188('0x55')]=intUtil[_0xf188('0x56')](_0x19d0b0[_0xf188('0x55')]);_0x19d0b0[_0xf188('0x57')]=intUtil[_0xf188('0x56')](_0x19d0b0[_0xf188('0x57')]);def[_0xf188('0x58')]=util['format'](_0xf188('0x59'),_0x19d0b0[_0xf188('0x55')]);if(_0x502cdf&&_0x502cdf['monitor_format']){logger[_0xf188('0x2a')]('['+_0x13c52f[_0xf188('0x76')][_0xf188('0x77')]()+']',_0xf188('0x5b'));_0x13c52f['recordingURL']=util['format'](_0xf188('0x5c'),_0x19d0b0[_0xf188('0x57')],_0x13c52f[_0xf188('0x5d')],md5(_0x13c52f[_0xf188('0x5d')]));}else{_0x13c52f[_0xf188('0x70')]='';}return getConnection(_0x19d0b0)[_0xf188('0x31')](function(_0x451dc8){_0x147b1c=_0x451dc8;if(!_[_0xf188('0x29')](_0x1219fa)){return getUser(_0x19d0b0,_0x1219fa[_0xf188('0xc')],_0x147b1c);}else{return getUser(_0x19d0b0,null,_0x147b1c);}})['then'](function(_0x28d867){_0x43aa0b=_0x28d867;logger[_0xf188('0x2a')](_0xf188('0x5e'),_0x43aa0b['id']);return getEndUser(_0x19d0b0,_0x13c52f[_0xf188('0x78')],_0x13c52f[_0xf188('0x5f')],_0x147b1c);})['then'](function(_0x18473c){_0x1f1a97=_0x18473c;logger['info'](_0xf188('0x60'),_0x1f1a97['id']);return getTicket(_0x19d0b0,_0x43aa0b,_0x1f1a97,_0x54eac2,_0x13c52f,_0x54eac2[_0xf188('0x61')],_0x147b1c,'Inbound');})[_0xf188('0x31')](function(_0x42e957){_0x5c34ae=_0x42e957;logger[_0xf188('0x2a')](_0xf188('0x63'));logger['info'](_0xf188('0x79'),_0x5c34ae['id']);return setRelationship(_0x147b1c,_0x43aa0b,_0x5c34ae,_0xf188('0x64'));})[_0xf188('0x31')](function(){return setRelationship(_0x147b1c,_0x1f1a97,_0x5c34ae,_0xf188('0x65'));})[_0xf188('0x31')](function(){return getServerInfo(_0x147b1c);})[_0xf188('0x6b')](function(_0x31b52a){logger[_0xf188('0x6c')]('['+_0x13c52f[_0xf188('0x76')][_0xf188('0x77')]()+']',JSON[_0xf188('0x28')](_0x31b52a));});}; \ 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 7272aae..5290b5b 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 _0x6136=['toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','slice','substring','isNil','lodash','getString','length','sortBy','type','push','content','variableName','customVariable','Variable','name'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x6136,0x13a));var _0x6613=function(_0x45366f,_0x563bf1){_0x45366f=_0x45366f-0x0;var _0x45f129=_0x6136[_0x45366f];return _0x45f129;};'use strict';var _=require(_0x6613('0x0'));var util=require('util');exports[_0x6613('0x1')]=function(_0x13020a,_0x505d4a,_0xd32345){var _0x3b1c99=[];if(_0x13020a[_0x6613('0x2')]>0x0){var _0x504e97=_[_0x6613('0x3')](_0x13020a,['id']);for(var _0x35d17d=0x0;_0x35d17d<_0x504e97['length'];_0x35d17d++){var _0x3d8bb5=_0x504e97[_0x35d17d];if(_0x3d8bb5[_0x6613('0x4')]==='string'){_0x3b1c99[_0x6613('0x5')](_0x3d8bb5[_0x6613('0x6')]);}else if(_0x3d8bb5[_0x6613('0x4')]==='variable'&&_0x3d8bb5[_0x6613('0x7')]){_0x505d4a[_0x3d8bb5[_0x6613('0x7')]]&&_0x3b1c99['push'](_0x505d4a[_0x3d8bb5[_0x6613('0x7')]]['toString']());}else if(_0x3d8bb5[_0x6613('0x4')]===_0x6613('0x8')&&_0x3d8bb5[_0x6613('0x9')]&&_0x3d8bb5[_0x6613('0x9')][_0x6613('0xa')]){_0x505d4a[_0x3d8bb5[_0x6613('0x9')][_0x6613('0xa')][_0x6613('0xb')]()]&&_0x3b1c99[_0x6613('0x5')](_0x505d4a[_0x3d8bb5[_0x6613('0x9')]['name'][_0x6613('0xb')]()]['toString']());}else if(_0x3d8bb5[_0x6613('0x4')]===_0x6613('0xc')){if(_0x3d8bb5[_0x6613('0xd')]===_0x6613('0xe')&&_0x3d8bb5[_0x6613('0xf')]){_0x3b1c99['push'](util[_0x6613('0x10')](_0x6613('0x11'),_0x3d8bb5[_0x6613('0xf')],_0x3d8bb5[_0x6613('0x12')]));}else if(_0x3d8bb5[_0x6613('0xd')]===_0x6613('0x13')&&_0x3d8bb5[_0x6613('0x7')]&&_0x3d8bb5[_0x6613('0xf')]){_0x505d4a[_0x3d8bb5[_0x6613('0x7')]]&&_0x3b1c99[_0x6613('0x5')](util[_0x6613('0x10')]('%s:\x20%s',_0x3d8bb5[_0x6613('0xf')],_0x505d4a[_0x3d8bb5['variableName']]));}else if(_0x3d8bb5['keyType']===_0x6613('0x8')&&_0x3d8bb5[_0x6613('0x9')]&&_0x3d8bb5[_0x6613('0x9')][_0x6613('0xa')]&&_0x3d8bb5['key']){_0x505d4a[_0x3d8bb5[_0x6613('0x9')][_0x6613('0xa')][_0x6613('0xb')]()]&&_0x3b1c99['push'](util[_0x6613('0x10')](_0x6613('0x11'),_0x3d8bb5['key'],_0x505d4a[_0x3d8bb5[_0x6613('0x9')][_0x6613('0xa')][_0x6613('0xb')]()]));}}}}return _0x3b1c99[_0x6613('0x14')](_0xd32345);};exports[_0x6613('0x15')]=function(_0x221fe0){var _0x4cd980=_0x221fe0[_0x6613('0x16')](-0x1);if(_0x4cd980==='/'){_0x221fe0=_0x221fe0[_0x6613('0x17')](0x0,_0x221fe0['lastIndexOf'](_0x4cd980));}return _0x221fe0;};exports['validateEmail']=function(_0x4d459c){if(!_[_0x6613('0x18')](_0x4d459c)&&_0x4d459c!==''){var _0x2f2db6=/^(([^<>()\[\]\\.,;:\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 _0x2f2db6['test'](String(_0x4d459c)[_0x6613('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xc7fa=['join','stripTrailingSlash','substring','lastIndexOf','isNil','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc7fa,0xb4));var _0xac7f=function(_0xd8edae,_0x424e02){_0xd8edae=_0xd8edae-0x0;var _0x715bc2=_0xc7fa[_0xd8edae];return _0x715bc2;};'use strict';var _=require(_0xac7f('0x0'));var util=require(_0xac7f('0x1'));exports[_0xac7f('0x2')]=function(_0x52d362,_0x33bae1,_0x2c7772){var _0x57deea=[];if(_0x52d362[_0xac7f('0x3')]>0x0){var _0x331833=_[_0xac7f('0x4')](_0x52d362,['id']);for(var _0x77fca4=0x0;_0x77fca4<_0x331833[_0xac7f('0x3')];_0x77fca4++){var _0x1d022d=_0x331833[_0x77fca4];if(_0x1d022d[_0xac7f('0x5')]===_0xac7f('0x6')){_0x57deea[_0xac7f('0x7')](_0x1d022d['content']);}else if(_0x1d022d[_0xac7f('0x5')]===_0xac7f('0x8')&&_0x1d022d[_0xac7f('0x9')]){_0x33bae1[_0x1d022d[_0xac7f('0x9')]]&&_0x57deea[_0xac7f('0x7')](_0x33bae1[_0x1d022d[_0xac7f('0x9')]][_0xac7f('0xa')]());}else if(_0x1d022d['type']==='customVariable'&&_0x1d022d['Variable']&&_0x1d022d[_0xac7f('0xb')][_0xac7f('0xc')]){_0x33bae1[_0x1d022d['Variable'][_0xac7f('0xc')][_0xac7f('0xd')]()]&&_0x57deea['push'](_0x33bae1[_0x1d022d['Variable'][_0xac7f('0xc')][_0xac7f('0xd')]()][_0xac7f('0xa')]());}else if(_0x1d022d[_0xac7f('0x5')]===_0xac7f('0xe')){if(_0x1d022d[_0xac7f('0xf')]===_0xac7f('0x6')&&_0x1d022d[_0xac7f('0x10')]){_0x57deea[_0xac7f('0x7')](util[_0xac7f('0x11')](_0xac7f('0x12'),_0x1d022d['key'],_0x1d022d[_0xac7f('0x13')]));}else if(_0x1d022d[_0xac7f('0xf')]===_0xac7f('0x8')&&_0x1d022d['variableName']&&_0x1d022d[_0xac7f('0x10')]){_0x33bae1[_0x1d022d[_0xac7f('0x9')]]&&_0x57deea[_0xac7f('0x7')](util[_0xac7f('0x11')](_0xac7f('0x12'),_0x1d022d[_0xac7f('0x10')],_0x33bae1[_0x1d022d['variableName']]));}else if(_0x1d022d[_0xac7f('0xf')]==='customVariable'&&_0x1d022d[_0xac7f('0xb')]&&_0x1d022d[_0xac7f('0xb')]['name']&&_0x1d022d[_0xac7f('0x10')]){_0x33bae1[_0x1d022d[_0xac7f('0xb')][_0xac7f('0xc')]['toLowerCase']()]&&_0x57deea['push'](util[_0xac7f('0x11')](_0xac7f('0x12'),_0x1d022d[_0xac7f('0x10')],_0x33bae1[_0x1d022d[_0xac7f('0xb')][_0xac7f('0xc')][_0xac7f('0xd')]()]));}}}}return _0x57deea[_0xac7f('0x14')](_0x2c7772);};exports[_0xac7f('0x15')]=function(_0x33f407){var _0x43a5fb=_0x33f407['slice'](-0x1);if(_0x43a5fb==='/'){_0x33f407=_0x33f407[_0xac7f('0x16')](0x0,_0x33f407[_0xac7f('0x17')](_0x43a5fb));}return _0x33f407;};exports['validateEmail']=function(_0x27d418){if(!_[_0xac7f('0x18')](_0x27d418)&&_0x27d418!==''){var _0x5bf6f0=/^(([^<>()\[\]\\.,;:\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 _0x5bf6f0['test'](String(_0x27d418)[_0xac7f('0xd')]());}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 acece75..2327fc0 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 _0x9767=['getString','Subjects','POST','format','%s/webservice.php','remoteUri','username','sessionName','stringify','then','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','result','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','catch','Searching\x20end\x20user\x20with\x20phone','GET','query','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!','create','Enduser\x20created.','phone','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','unmanaged','stripTrailingSlash','monitor_format','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20Ticket\x20ID\x20is:','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','forEach','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','Open'];(function(_0x48e497,_0x5ef79a){var _0x1aabc8=function(_0x147839){while(--_0x147839){_0x48e497['push'](_0x48e497['shift']());}};_0x1aabc8(++_0x5ef79a);}(_0x9767,0xb9));var _0x7976=function(_0x2216b3,_0x2892b3){_0x2216b3=_0x2216b3-0x0;var _0x514d21=_0x9767[_0x2216b3];return _0x514d21;};'use strict';var _=require(_0x7976('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x7976('0x1'));var util=require(_0x7976('0x2'));var Redis=require(_0x7976('0x3'));var intUtil=require(_0x7976('0x4'));var config=require(_0x7976('0x5'));var logger=require(_0x7976('0x6'))(_0x7976('0x7'));config[_0x7976('0x8')]=_['defaults'](config[_0x7976('0x8')],{'host':_0x7976('0x9'),'port':0x18eb});var io=require(_0x7976('0xa'))(new Redis(config[_0x7976('0x8')]));function emit(_0x1a8dc6,_0x24bb6b,_0x357e5f){io['to'](_0x1a8dc6)[_0x7976('0xb')](_0x24bb6b,_0x357e5f);}function getCustomFields(_0x5ce2be,_0xaa9292){var _0x1d1198={};if(_0x5ce2be['length']>0x0){_[_0x7976('0xc')](_0x5ce2be,function(_0x4ee13a){if(_[_0x7976('0xd')]([_0x7976('0xe'),_0x7976('0xf')],_0x4ee13a[_0x7976('0x10')])&&_0x4ee13a[_0x7976('0x11')]){_0x1d1198[_0x4ee13a[_0x7976('0x11')]]=_0x4ee13a['content'][_0x7976('0x12')]();}else if(_0x4ee13a[_0x7976('0x10')]===_0x7976('0x13')&&_0x4ee13a[_0x7976('0x14')]&&_0x4ee13a[_0x7976('0x11')]&&_0xaa9292[_0x4ee13a[_0x7976('0x14')]]){_0x1d1198[_0x4ee13a[_0x7976('0x11')]]=_0xaa9292[_0x4ee13a[_0x7976('0x14')]][_0x7976('0x12')]();}else if(_0x4ee13a[_0x7976('0x10')]===_0x7976('0x15')&&_0x4ee13a[_0x7976('0x16')]&&_0x4ee13a[_0x7976('0x16')][_0x7976('0x17')]&&_0x4ee13a[_0x7976('0x11')]&&_0xaa9292[_0x4ee13a['Variable'][_0x7976('0x17')][_0x7976('0x18')]()]){_0x1d1198[_0x4ee13a[_0x7976('0x11')]]=_0xaa9292[_0x4ee13a['Variable'][_0x7976('0x17')][_0x7976('0x18')]()][_0x7976('0x12')]();}});}return _0x1d1198;}function createTicket(_0xc8bd1e,_0x181cb8,_0x4c7f29,_0x586ebd,_0x4a2023,_0x464cc8,_0x14a86d){logger['info'](_0x7976('0x19'));var _0x6d808f=_['merge']({'parent_id':'','assigned_user_id':_0x181cb8['id'],'ticketpriorities':'Normal','ticketstatus':_0x7976('0x1a'),'ticket_title':intUtil[_0x7976('0x1b')](_0x586ebd[_0x7976('0x1c')],_0x4a2023,'\x20'),'description':intUtil[_0x7976('0x1b')](_0x586ebd['Descriptions'],_0x4a2023,'\x0a'),'contact_id':_0x4c7f29['id']},getCustomFields(_0x464cc8,_0x4a2023));var _0x24d2eb={'method':_0x7976('0x1d'),'uri':util[_0x7976('0x1e')](_0x7976('0x1f'),_0xc8bd1e[_0x7976('0x20')]),'form':{'operation':'create','username':_0xc8bd1e[_0x7976('0x21')],'sessionName':_0x14a86d[_0x7976('0x22')],'elementType':'HelpDesk','element':JSON[_0x7976('0x23')](_0x6d808f)},'json':!![]};return request(_0x24d2eb)[_0x7976('0x24')](function(_0x38cc2d){if(_0x38cc2d['success']){return BPromise[_0x7976('0x25')]({'id':_0x38cc2d['result']['id']});}else{throw new Error(util['format'](_0x7976('0x26'),JSON[_0x7976('0x23')](_0x38cc2d['error'])));}})['catch'](function(_0x41b496){var _0x2dfe1d=_0x41b496[_0x7976('0x27')]||0x1f4;logger[_0x7976('0x28')](_0x7976('0x29'),_0x7976('0x2a'),_0x2dfe1d,JSON[_0x7976('0x23')](_0x41b496));});}function getUser(_0x4fb1b5,_0x1a095f,_0x397742){if(intUtil[_0x7976('0x2b')](_0x1a095f)){logger[_0x7976('0x2c')](_0x7976('0x2d'),_0x1a095f);return request({'method':'GET','uri':util[_0x7976('0x1e')]('%s/webservice.php',_0x4fb1b5[_0x7976('0x20')]),'qs':{'operation':'query','username':_0x4fb1b5['username'],'sessionName':_0x397742[_0x7976('0x22')],'query':util['format'](_0x7976('0x2e'),_0x1a095f)},'json':!![]})[_0x7976('0x24')](function(_0x3a9821){if(_0x3a9821[_0x7976('0x2f')]&&_0x3a9821[_0x7976('0x30')][_0x7976('0x31')]){logger[_0x7976('0x2c')](_0x7976('0x32'));return BPromise[_0x7976('0x25')]({'id':_0x3a9821['result'][0x0]['id'],'email':_0x3a9821[_0x7976('0x30')][0x0][_0x7976('0x33')],'name':_0x3a9821[_0x7976('0x30')][0x0][_0x7976('0x34')]+'\x20'+_0x3a9821[_0x7976('0x30')][_0x7976('0x35')]});}else{logger[_0x7976('0x2c')](_0x7976('0x36'));return BPromise[_0x7976('0x25')]({'id':_0x397742[_0x7976('0x37')],'email':_0x4fb1b5[_0x7976('0x21')],'name':'admin'});}})['catch'](function(_0x54d884){var _0x5edff5=_0x54d884[_0x7976('0x27')]||0x1f4;logger[_0x7976('0x28')](_0x7976('0x29'),_0x7976('0x38'),_0x5edff5,JSON[_0x7976('0x23')](_0x54d884));});}else{logger[_0x7976('0x2c')](_0x7976('0x36'));return BPromise[_0x7976('0x25')]({'id':_0x397742[_0x7976('0x37')],'email':_0x4fb1b5[_0x7976('0x21')],'name':_0x7976('0x39')})[_0x7976('0x3a')](function(_0x564dd5){var _0x3f0b13=_0x564dd5['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x7976('0x38'),_0x3f0b13,JSON[_0x7976('0x23')](_0x564dd5));});}}function getEndUser(_0x29a5f1,_0x15bd30,_0xf613db,_0x4ae8ba){logger[_0x7976('0x2c')](_0x7976('0x3b'),_0xf613db);return request({'method':_0x7976('0x3c'),'uri':util[_0x7976('0x1e')]('%s/webservice.php',_0x29a5f1[_0x7976('0x20')]),'qs':{'operation':_0x7976('0x3d'),'username':_0x29a5f1[_0x7976('0x21')],'sessionName':_0x4ae8ba['sessionName'],'query':util[_0x7976('0x1e')](_0x7976('0x3e'),_0xf613db,_0xf613db,_0xf613db,_0xf613db,_0xf613db)},'json':!![]})['then'](function(_0x4078f4){if(_0x4078f4[_0x7976('0x2f')]&&_0x4078f4['result']['length']){logger['info'](_0x7976('0x3f'));return BPromise['resolve']({'id':_0x4078f4[_0x7976('0x30')][0x0]['id'],'name':_0x4078f4[_0x7976('0x30')][0x0][_0x7976('0x40')]+'\x20'+_0x4078f4['result'][0x0][_0x7976('0x41')],'phone':_0xf613db});}else{logger[_0x7976('0x2c')](_0x7976('0x42'));return request({'method':_0x7976('0x1d'),'uri':util['format'](_0x7976('0x1f'),_0x29a5f1[_0x7976('0x20')]),'form':{'operation':_0x7976('0x43'),'sessionName':_0x4ae8ba[_0x7976('0x22')],'elementType':'Contacts','element':JSON[_0x7976('0x23')]({'lastname':_0x15bd30,'phone':_0xf613db,'assigned_user_id':'\x20'})},'json':!![]})[_0x7976('0x24')](function(_0x1e23b8){logger[_0x7976('0x2c')](_0x7976('0x44'));return BPromise[_0x7976('0x25')]({'id':_0x1e23b8[_0x7976('0x30')]['id'],'name':_0x1e23b8[_0x7976('0x30')][_0x7976('0x41')],'phone':_0x1e23b8[_0x7976('0x30')][_0x7976('0x45')]});})[_0x7976('0x3a')](function(_0x2c3a97){var _0x27f848=_0x2c3a97[_0x7976('0x27')]||0x1f4;logger['error'](_0x7976('0x29'),_0x7976('0x46'),_0x27f848,JSON[_0x7976('0x23')](_0x2c3a97));});}});}function getConnection(_0x472747){var _0x362d18=_0x472747[_0x7976('0x21')];var _0x58b972=_0x472747[_0x7976('0x47')];return request({'method':'GET','uri':util['format'](_0x7976('0x1f'),_0x472747[_0x7976('0x20')]),'qs':{'operation':'getchallenge','username':_0x362d18},'json':!![]})[_0x7976('0x24')](function(_0x540d19){if(_0x540d19[_0x7976('0x2f')]){return request({'method':_0x7976('0x1d'),'uri':util[_0x7976('0x1e')](_0x7976('0x1f'),_0x472747[_0x7976('0x20')]),'form':{'operation':_0x7976('0x48'),'username':_0x362d18,'accessKey':md5(_0x540d19[_0x7976('0x30')][_0x7976('0x49')]+_0x58b972)},'json':!![]});}})[_0x7976('0x24')](function(_0x2caf93){if(_0x2caf93[_0x7976('0x2f')]){return BPromise[_0x7976('0x25')](_0x2caf93[_0x7976('0x30')]);}else{throw new Error(util[_0x7976('0x1e')](_0x7976('0x4a'),_0x472747['id']));}})[_0x7976('0x3a')](function(_0x4f6055){var _0x224d62=_0x4f6055[_0x7976('0x27')]||0x1f4;logger['error'](_0x7976('0x29'),_0x7976('0x4b'),_0x224d62,JSON[_0x7976('0x23')](_0x4f6055));});}function request(_0x459eb0){logger[_0x7976('0x2c')](_0x7976('0x4c'),JSON[_0x7976('0x23')](_0x459eb0));return rp(_0x459eb0);}exports[_0x7976('0x4d')]=function(_0x564e1f,_0x1ad1e6,_0x1cd873,_0x312f6a,_0x1e5bd9,_0x2b5809){var _0x5113cd,_0x3cbd0e,_0x3cdfc7,_0xb14f08;_0x2b5809[_0x7976('0x20')]=intUtil['stripTrailingSlash'](_0x2b5809[_0x7976('0x20')]);if(_0x1e5bd9&&_0x1e5bd9['monitor_format']){logger[_0x7976('0x2c')](_0x7976('0x4e'),_0x7976('0x4f'));_0x1ad1e6[_0x7976('0x50')]=util[_0x7976('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b5809['serverUrl'],_0x1ad1e6[_0x7976('0x51')],md5(_0x1ad1e6['uniqueid']));}else{_0x1ad1e6[_0x7976('0x50')]='';}return getConnection(_0x2b5809)['then'](function(_0x222b55){_0xb14f08=_0x222b55;return getUser(_0x2b5809,_0x312f6a[_0x7976('0x52')],_0xb14f08);})[_0x7976('0x24')](function(_0x4d1df5){_0x5113cd=_0x4d1df5;logger['info']('The\x20User\x20ID\x20is:',_0x5113cd['id']);return getEndUser(_0x2b5809,_0x1ad1e6['calleridname'],_0x1ad1e6[_0x7976('0x53')],_0xb14f08);})[_0x7976('0x24')](function(_0x5ccd4a){_0x3cbd0e=_0x5ccd4a;logger[_0x7976('0x2c')](_0x7976('0x54'),_0x3cbd0e['id']);return createTicket(_0x2b5809,_0x5113cd,_0x3cbd0e,_0x1cd873,_0x1ad1e6,_0x1cd873[_0x7976('0x55')],_0xb14f08);})[_0x7976('0x24')](function(_0x38e486){_0x3cdfc7=_0x38e486;logger[_0x7976('0x2c')](_0x7976('0x56'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3cdfc7['id']);var _0x2dc986=util['format'](_0x7976('0x57'),_0x2b5809[_0x7976('0x20')],_[_0x7976('0x58')](_0x3cdfc7['id'],'x')[0x1]);logger[_0x7976('0x2c')](_0x7976('0x4e'),_0x7976('0x59'));emit(util[_0x7976('0x1e')](_0x7976('0x5a'),_0x312f6a['name']),_0x7976('0x5b'),{'uri':_0x2dc986});})['catch'](function(_0x16c018){logger[_0x7976('0x28')](_0x7976('0x4e'),JSON['stringify'](_0x16c018));});};exports[_0x7976('0x5c')]=function(_0x2acfdb,_0x2a8f20,_0xfc7c14,_0x1666a5,_0x175654,_0x5619a3,_0x317930){var _0x37e5d6,_0x26c412,_0x322da4,_0x30dcb1;_0x5619a3['remoteUri']=intUtil['stripTrailingSlash'](_0x5619a3[_0x7976('0x20')]);_0x5619a3[_0x7976('0x5d')]=intUtil['stripTrailingSlash'](_0x5619a3[_0x7976('0x5d')]);if(_0x317930&&_0x317930[_0x7976('0x5e')]&&_0x317930[_0x7976('0x5e')]!==_0x7976('0x5f')){logger['info'](_0x7976('0x60'),'Recording\x20is\x20enabled!');_0x2a8f20[_0x7976('0x50')]=util[_0x7976('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5619a3[_0x7976('0x5d')],_0x2a8f20[_0x7976('0x51')],md5(_0x2a8f20[_0x7976('0x51')]));}return getConnection(_0x5619a3)[_0x7976('0x24')](function(_0x3cd9bd){_0x30dcb1=_0x3cd9bd;return getUser(_0x5619a3,_0x1666a5[_0x7976('0x52')],_0x30dcb1);})['then'](function(_0x394717){_0x37e5d6=_0x394717;logger['info'](_0x7976('0x61'),_0x37e5d6['id']);return getEndUser(_0x5619a3,_0x2a8f20[_0x7976('0x62')],_0x2a8f20[_0x7976('0x63')],_0x30dcb1);})['then'](function(_0x51f25b){_0x26c412=_0x51f25b;logger[_0x7976('0x2c')](_0x7976('0x54'),_0x26c412['id']);return createTicket(_0x5619a3,_0x37e5d6,_0x26c412,_0xfc7c14,_0x2a8f20,_0xfc7c14[_0x7976('0x55')],_0x30dcb1);})['then'](function(_0x12fb65){_0x322da4=_0x12fb65;logger['info'](_0x7976('0x56'));logger[_0x7976('0x2c')]('The\x20Ticket\x20ID\x20is:',_0x322da4['id']);var _0x2ab374=util[_0x7976('0x1e')](_0x7976('0x57'),_0x5619a3[_0x7976('0x20')],_[_0x7976('0x58')](_0x322da4['id'],'x')[0x1]);logger[_0x7976('0x2c')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7976('0x1e')](_0x7976('0x5a'),_0x1666a5[_0x7976('0x17')]),_0x7976('0x5b'),{'uri':_0x2ab374});})[_0x7976('0x3a')](function(_0x1c2ea4){logger[_0x7976('0x28')](_0x7976('0x60'),JSON['stringify'](_0x1c2ea4));});};exports[_0x7976('0x64')]=function(_0xe7468f,_0x3c2686,_0x2dfbf5,_0x588dcc,_0x24987b,_0x2efbe4){var _0x187040,_0x2c41d7,_0x294a80,_0xf33063;_0x2efbe4[_0x7976('0x20')]=intUtil[_0x7976('0x65')](_0x2efbe4[_0x7976('0x20')]);_0x2efbe4['serverUrl']=intUtil[_0x7976('0x65')](_0x2efbe4[_0x7976('0x5d')]);if(_0x24987b&&_0x24987b[_0x7976('0x66')]){logger[_0x7976('0x2c')]('['+_0x3c2686['lastevent'][_0x7976('0x67')]()+']','Recording\x20is\x20enabled!');_0x3c2686[_0x7976('0x50')]=util[_0x7976('0x1e')](_0x7976('0x68'),_0x2efbe4[_0x7976('0x5d')],_0x3c2686['uniqueid'],md5(_0x3c2686[_0x7976('0x51')]));}else{_0x3c2686['recordingURL']='';}return getConnection(_0x2efbe4)['then'](function(_0x207ae8){_0xf33063=_0x207ae8;return getUser(_0x2efbe4,'',_0xf33063);})['then'](function(_0x42f900){_0x187040=_0x42f900;logger[_0x7976('0x2c')](_0x7976('0x61'),_0x187040['id']);return getEndUser(_0x2efbe4,_0x3c2686['calleridname'],_0x3c2686['calleridnum'],_0xf33063);})[_0x7976('0x24')](function(_0x12c34a){_0x2c41d7=_0x12c34a;logger[_0x7976('0x2c')]('The\x20Enduser\x20ID\x20is:',_0x2c41d7['id']);return createTicket(_0x2efbe4,_0x187040,_0x2c41d7,_0x2dfbf5,_0x3c2686,_0x2dfbf5['Fields'],_0xf33063);})['then'](function(_0x354d29){_0x294a80=_0x354d29;logger[_0x7976('0x2c')](_0x7976('0x56'));logger[_0x7976('0x2c')](_0x7976('0x69'),_0x294a80['id']);})[_0x7976('0x3a')](function(_0x1c7c74){logger[_0x7976('0x28')]('['+_0x3c2686['lastevent'][_0x7976('0x67')]()+']',JSON['stringify'](_0x1c7c74));});}; \ No newline at end of file +var _0xd6f9=['catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','length','Agent\x20found!','first_name','last_name','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;','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','stripTrailingSlash','recordingFormat','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','emit','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','info','merge','Normal','Open','getString','Descriptions','POST','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','then','success','resolve','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s'];(function(_0x21c0a8,_0x4ad90b){var _0x157a71=function(_0x3e9b58){while(--_0x3e9b58){_0x21c0a8['push'](_0x21c0a8['shift']());}};_0x157a71(++_0x4ad90b);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0xd6f9[_0x36fbef];return _0x45e270;};'use strict';var _=require(_0x9d6f('0x0'));var rp=require(_0x9d6f('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x9d6f('0x2'));var Redis=require(_0x9d6f('0x3'));var intUtil=require(_0x9d6f('0x4'));var config=require(_0x9d6f('0x5'));var logger=require('../../../../config/logger')(_0x9d6f('0x6'));config[_0x9d6f('0x7')]=_[_0x9d6f('0x8')](config['redis'],{'host':_0x9d6f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x2011db,_0x523a52,_0x193661){io['to'](_0x2011db)[_0x9d6f('0xa')](_0x523a52,_0x193661);}function getCustomFields(_0x2b6e8f,_0x5f7600){var _0x1ae763={};if(_0x2b6e8f['length']>0x0){_['forEach'](_0x2b6e8f,function(_0x54d0fc){if(_[_0x9d6f('0xb')]([_0x9d6f('0xc'),_0x9d6f('0xd')],_0x54d0fc[_0x9d6f('0xe')])&&_0x54d0fc[_0x9d6f('0xf')]){_0x1ae763[_0x54d0fc['idField']]=_0x54d0fc[_0x9d6f('0x10')][_0x9d6f('0x11')]();}else if(_0x54d0fc[_0x9d6f('0xe')]===_0x9d6f('0x12')&&_0x54d0fc[_0x9d6f('0x13')]&&_0x54d0fc['idField']&&_0x5f7600[_0x54d0fc[_0x9d6f('0x13')]]){_0x1ae763[_0x54d0fc[_0x9d6f('0xf')]]=_0x5f7600[_0x54d0fc[_0x9d6f('0x13')]][_0x9d6f('0x11')]();}else if(_0x54d0fc[_0x9d6f('0xe')]==='customVariable'&&_0x54d0fc[_0x9d6f('0x14')]&&_0x54d0fc[_0x9d6f('0x14')][_0x9d6f('0x15')]&&_0x54d0fc[_0x9d6f('0xf')]&&_0x5f7600[_0x54d0fc['Variable'][_0x9d6f('0x15')][_0x9d6f('0x16')]()]){_0x1ae763[_0x54d0fc[_0x9d6f('0xf')]]=_0x5f7600[_0x54d0fc[_0x9d6f('0x14')]['name'][_0x9d6f('0x16')]()][_0x9d6f('0x11')]();}});}return _0x1ae763;}function createTicket(_0x556ac7,_0x1bf97f,_0xa107fa,_0x3954ea,_0x4e9598,_0x44c894,_0x29615d){logger[_0x9d6f('0x17')]('Creating\x20new\x20ticket...');var _0x3ce2ca=_[_0x9d6f('0x18')]({'parent_id':'','assigned_user_id':_0x1bf97f['id'],'ticketpriorities':_0x9d6f('0x19'),'ticketstatus':_0x9d6f('0x1a'),'ticket_title':intUtil[_0x9d6f('0x1b')](_0x3954ea['Subjects'],_0x4e9598,'\x20'),'description':intUtil[_0x9d6f('0x1b')](_0x3954ea[_0x9d6f('0x1c')],_0x4e9598,'\x0a'),'contact_id':_0xa107fa['id']},getCustomFields(_0x44c894,_0x4e9598));var _0x3e9ad3={'method':_0x9d6f('0x1d'),'uri':util['format'](_0x9d6f('0x1e'),_0x556ac7[_0x9d6f('0x1f')]),'form':{'operation':_0x9d6f('0x20'),'username':_0x556ac7[_0x9d6f('0x21')],'sessionName':_0x29615d[_0x9d6f('0x22')],'elementType':_0x9d6f('0x23'),'element':JSON[_0x9d6f('0x24')](_0x3ce2ca)},'json':!![]};return request(_0x3e9ad3)[_0x9d6f('0x25')](function(_0x6d51d8){if(_0x6d51d8[_0x9d6f('0x26')]){return BPromise[_0x9d6f('0x27')]({'id':_0x6d51d8['result']['id']});}else{throw new Error(util[_0x9d6f('0x28')](_0x9d6f('0x29'),JSON[_0x9d6f('0x24')](_0x6d51d8['error'])));}})[_0x9d6f('0x2a')](function(_0x5cded2){var _0x320145=_0x5cded2[_0x9d6f('0x2b')]||0x1f4;logger[_0x9d6f('0x2c')](_0x9d6f('0x2d'),'createTicket',_0x320145,JSON['stringify'](_0x5cded2));});}function getUser(_0x51ade6,_0x545b0c,_0x162126){if(intUtil[_0x9d6f('0x2e')](_0x545b0c)){logger[_0x9d6f('0x17')](_0x9d6f('0x2f'),_0x545b0c);return request({'method':_0x9d6f('0x30'),'uri':util[_0x9d6f('0x28')](_0x9d6f('0x1e'),_0x51ade6[_0x9d6f('0x1f')]),'qs':{'operation':_0x9d6f('0x31'),'username':_0x51ade6[_0x9d6f('0x21')],'sessionName':_0x162126[_0x9d6f('0x22')],'query':util[_0x9d6f('0x28')](_0x9d6f('0x32'),_0x545b0c)},'json':!![]})[_0x9d6f('0x25')](function(_0x3a4d6d){if(_0x3a4d6d[_0x9d6f('0x26')]&&_0x3a4d6d[_0x9d6f('0x33')][_0x9d6f('0x34')]){logger[_0x9d6f('0x17')](_0x9d6f('0x35'));return BPromise['resolve']({'id':_0x3a4d6d[_0x9d6f('0x33')][0x0]['id'],'email':_0x3a4d6d['result'][0x0]['email1'],'name':_0x3a4d6d[_0x9d6f('0x33')][0x0][_0x9d6f('0x36')]+'\x20'+_0x3a4d6d[_0x9d6f('0x33')][_0x9d6f('0x37')]});}else{logger[_0x9d6f('0x17')](_0x9d6f('0x38'));return BPromise[_0x9d6f('0x27')]({'id':_0x162126[_0x9d6f('0x39')],'email':_0x51ade6[_0x9d6f('0x21')],'name':_0x9d6f('0x3a')});}})[_0x9d6f('0x2a')](function(_0x3935d5){var _0x522fc0=_0x3935d5[_0x9d6f('0x2b')]||0x1f4;logger[_0x9d6f('0x2c')](_0x9d6f('0x2d'),_0x9d6f('0x3b'),_0x522fc0,JSON[_0x9d6f('0x24')](_0x3935d5));});}else{logger[_0x9d6f('0x17')](_0x9d6f('0x38'));return BPromise[_0x9d6f('0x27')]({'id':_0x162126['userId'],'email':_0x51ade6[_0x9d6f('0x21')],'name':_0x9d6f('0x3a')})['catch'](function(_0xa8d8ad){var _0x5776a7=_0xa8d8ad[_0x9d6f('0x2b')]||0x1f4;logger[_0x9d6f('0x2c')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x9d6f('0x3b'),_0x5776a7,JSON[_0x9d6f('0x24')](_0xa8d8ad));});}}function getEndUser(_0x39ad4b,_0x4d3d9f,_0x114bc1,_0x54c8dc){logger[_0x9d6f('0x17')](_0x9d6f('0x3c'),_0x114bc1);return request({'method':_0x9d6f('0x30'),'uri':util[_0x9d6f('0x28')](_0x9d6f('0x1e'),_0x39ad4b[_0x9d6f('0x1f')]),'qs':{'operation':'query','username':_0x39ad4b[_0x9d6f('0x21')],'sessionName':_0x54c8dc[_0x9d6f('0x22')],'query':util['format'](_0x9d6f('0x3d'),_0x114bc1,_0x114bc1,_0x114bc1,_0x114bc1,_0x114bc1)},'json':!![]})[_0x9d6f('0x25')](function(_0x3ead3f){if(_0x3ead3f[_0x9d6f('0x26')]&&_0x3ead3f[_0x9d6f('0x33')][_0x9d6f('0x34')]){logger[_0x9d6f('0x17')](_0x9d6f('0x3e'));return BPromise[_0x9d6f('0x27')]({'id':_0x3ead3f[_0x9d6f('0x33')][0x0]['id'],'name':_0x3ead3f[_0x9d6f('0x33')][0x0]['firstname']+'\x20'+_0x3ead3f['result'][0x0][_0x9d6f('0x3f')],'phone':_0x114bc1});}else{logger['info'](_0x9d6f('0x40'));return request({'method':'POST','uri':util[_0x9d6f('0x28')]('%s/webservice.php',_0x39ad4b[_0x9d6f('0x1f')]),'form':{'operation':'create','sessionName':_0x54c8dc[_0x9d6f('0x22')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x4d3d9f,'phone':_0x114bc1,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x13ffce){logger[_0x9d6f('0x17')]('Enduser\x20created.');return BPromise[_0x9d6f('0x27')]({'id':_0x13ffce[_0x9d6f('0x33')]['id'],'name':_0x13ffce['result'][_0x9d6f('0x3f')],'phone':_0x13ffce[_0x9d6f('0x33')][_0x9d6f('0x41')]});})[_0x9d6f('0x2a')](function(_0x2ce00c){var _0x5a1221=_0x2ce00c[_0x9d6f('0x2b')]||0x1f4;logger[_0x9d6f('0x2c')](_0x9d6f('0x2d'),_0x9d6f('0x42'),_0x5a1221,JSON[_0x9d6f('0x24')](_0x2ce00c));});}});}function getConnection(_0x3df65e){var _0x29cbce=_0x3df65e[_0x9d6f('0x21')];var _0x3779eb=_0x3df65e['accessKey'];return request({'method':_0x9d6f('0x30'),'uri':util[_0x9d6f('0x28')](_0x9d6f('0x1e'),_0x3df65e[_0x9d6f('0x1f')]),'qs':{'operation':_0x9d6f('0x43'),'username':_0x29cbce},'json':!![]})[_0x9d6f('0x25')](function(_0x5eef41){if(_0x5eef41[_0x9d6f('0x26')]){return request({'method':_0x9d6f('0x1d'),'uri':util[_0x9d6f('0x28')]('%s/webservice.php',_0x3df65e['remoteUri']),'form':{'operation':_0x9d6f('0x44'),'username':_0x29cbce,'accessKey':md5(_0x5eef41['result'][_0x9d6f('0x45')]+_0x3779eb)},'json':!![]});}})[_0x9d6f('0x25')](function(_0x2336b2){if(_0x2336b2[_0x9d6f('0x26')]){return BPromise[_0x9d6f('0x27')](_0x2336b2[_0x9d6f('0x33')]);}else{throw new Error(util[_0x9d6f('0x28')](_0x9d6f('0x46'),_0x3df65e['id']));}})[_0x9d6f('0x2a')](function(_0xc00552){var _0x25ddbf=_0xc00552[_0x9d6f('0x2b')]||0x1f4;logger[_0x9d6f('0x2c')](_0x9d6f('0x2d'),_0x9d6f('0x47'),_0x25ddbf,JSON[_0x9d6f('0x24')](_0xc00552));});}function request(_0x382008){logger[_0x9d6f('0x17')](_0x9d6f('0x48'),JSON[_0x9d6f('0x24')](_0x382008));return rp(_0x382008);}exports[_0x9d6f('0x49')]=function(_0x14793d,_0xe5c9f5,_0x5ae45f,_0x30bb92,_0x229402,_0xc4833d){var _0x3822a0,_0x114de2,_0xe06ff,_0x272479;_0xc4833d[_0x9d6f('0x1f')]=intUtil['stripTrailingSlash'](_0xc4833d[_0x9d6f('0x1f')]);if(_0x229402&&_0x229402[_0x9d6f('0x4a')]){logger['info']('[QUEUE]',_0x9d6f('0x4b'));_0xe5c9f5[_0x9d6f('0x4c')]=util[_0x9d6f('0x28')](_0x9d6f('0x4d'),_0xc4833d[_0x9d6f('0x4e')],_0xe5c9f5[_0x9d6f('0x4f')],md5(_0xe5c9f5[_0x9d6f('0x4f')]));}else{_0xe5c9f5[_0x9d6f('0x4c')]='';}return getConnection(_0xc4833d)[_0x9d6f('0x25')](function(_0x5b6cc9){_0x272479=_0x5b6cc9;return getUser(_0xc4833d,_0x30bb92[_0x9d6f('0x50')],_0x272479);})[_0x9d6f('0x25')](function(_0x250ec5){_0x3822a0=_0x250ec5;logger['info'](_0x9d6f('0x51'),_0x3822a0['id']);return getEndUser(_0xc4833d,_0xe5c9f5[_0x9d6f('0x52')],_0xe5c9f5[_0x9d6f('0x53')],_0x272479);})[_0x9d6f('0x25')](function(_0x1bee96){_0x114de2=_0x1bee96;logger['info'](_0x9d6f('0x54'),_0x114de2['id']);return createTicket(_0xc4833d,_0x3822a0,_0x114de2,_0x5ae45f,_0xe5c9f5,_0x5ae45f[_0x9d6f('0x55')],_0x272479);})[_0x9d6f('0x25')](function(_0x3106f2){_0xe06ff=_0x3106f2;logger[_0x9d6f('0x17')](_0x9d6f('0x56'));logger[_0x9d6f('0x17')](_0x9d6f('0x57'),_0xe06ff['id']);var _0xee001d=util[_0x9d6f('0x28')](_0x9d6f('0x58'),_0xc4833d[_0x9d6f('0x1f')],_[_0x9d6f('0x59')](_0xe06ff['id'],'x')[0x1]);logger[_0x9d6f('0x17')](_0x9d6f('0x5a'),_0x9d6f('0x5b'));emit(util[_0x9d6f('0x28')]('user:%s',_0x30bb92[_0x9d6f('0x15')]),_0x9d6f('0x5c'),{'uri':_0xee001d});})['catch'](function(_0x411ae6){logger[_0x9d6f('0x2c')](_0x9d6f('0x5a'),JSON[_0x9d6f('0x24')](_0x411ae6));});};exports['outbound']=function(_0x5aae77,_0x3a068e,_0x31a83e,_0x36b328,_0x595979,_0x58e9a0,_0x1213cb){var _0x522d03,_0x157439,_0x5be608,_0x376ce7;_0x58e9a0[_0x9d6f('0x1f')]=intUtil[_0x9d6f('0x5d')](_0x58e9a0['remoteUri']);_0x58e9a0['serverUrl']=intUtil[_0x9d6f('0x5d')](_0x58e9a0[_0x9d6f('0x4e')]);if(_0x1213cb&&_0x1213cb[_0x9d6f('0x5e')]&&_0x1213cb['recordingFormat']!=='none'){logger[_0x9d6f('0x17')](_0x9d6f('0x5f'),'Recording\x20is\x20enabled!');_0x3a068e['recordingURL']=util[_0x9d6f('0x28')](_0x9d6f('0x4d'),_0x58e9a0[_0x9d6f('0x4e')],_0x3a068e[_0x9d6f('0x4f')],md5(_0x3a068e[_0x9d6f('0x4f')]));}return getConnection(_0x58e9a0)[_0x9d6f('0x25')](function(_0x36dfc8){_0x376ce7=_0x36dfc8;return getUser(_0x58e9a0,_0x36b328['email'],_0x376ce7);})[_0x9d6f('0x25')](function(_0x77fbb5){_0x522d03=_0x77fbb5;logger[_0x9d6f('0x17')](_0x9d6f('0x51'),_0x522d03['id']);return getEndUser(_0x58e9a0,_0x3a068e['destcalleridname'],_0x3a068e['destcalleridnum'],_0x376ce7);})[_0x9d6f('0x25')](function(_0x4ac459){_0x157439=_0x4ac459;logger[_0x9d6f('0x17')]('The\x20Enduser\x20ID\x20is:',_0x157439['id']);return createTicket(_0x58e9a0,_0x522d03,_0x157439,_0x31a83e,_0x3a068e,_0x31a83e[_0x9d6f('0x55')],_0x376ce7);})[_0x9d6f('0x25')](function(_0x475eee){_0x5be608=_0x475eee;logger[_0x9d6f('0x17')](_0x9d6f('0x56'));logger[_0x9d6f('0x17')](_0x9d6f('0x57'),_0x5be608['id']);var _0x297279=util[_0x9d6f('0x28')](_0x9d6f('0x58'),_0x58e9a0[_0x9d6f('0x1f')],_[_0x9d6f('0x59')](_0x5be608['id'],'x')[0x1]);logger['info'](_0x9d6f('0x5f'),_0x9d6f('0x5b'));emit(util[_0x9d6f('0x28')](_0x9d6f('0x60'),_0x36b328[_0x9d6f('0x15')]),_0x9d6f('0x5c'),{'uri':_0x297279});})[_0x9d6f('0x2a')](function(_0x39409b){logger[_0x9d6f('0x2c')](_0x9d6f('0x5f'),JSON[_0x9d6f('0x24')](_0x39409b));});};exports[_0x9d6f('0x61')]=function(_0x3034d5,_0x3766e0,_0xf3cd59,_0x28735e,_0x436fa6,_0x1b38de){var _0x20bf24,_0x5a14c1,_0x973bd4,_0x3a862d;_0x1b38de[_0x9d6f('0x1f')]=intUtil['stripTrailingSlash'](_0x1b38de['remoteUri']);_0x1b38de[_0x9d6f('0x4e')]=intUtil[_0x9d6f('0x5d')](_0x1b38de[_0x9d6f('0x4e')]);if(_0x436fa6&&_0x436fa6[_0x9d6f('0x4a')]){logger[_0x9d6f('0x17')]('['+_0x3766e0[_0x9d6f('0x62')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3766e0['recordingURL']=util[_0x9d6f('0x28')](_0x9d6f('0x4d'),_0x1b38de[_0x9d6f('0x4e')],_0x3766e0['uniqueid'],md5(_0x3766e0[_0x9d6f('0x4f')]));}else{_0x3766e0[_0x9d6f('0x4c')]='';}return getConnection(_0x1b38de)[_0x9d6f('0x25')](function(_0x59166e){_0x3a862d=_0x59166e;return getUser(_0x1b38de,'',_0x3a862d);})[_0x9d6f('0x25')](function(_0x509216){_0x20bf24=_0x509216;logger[_0x9d6f('0x17')]('The\x20User\x20ID\x20is:',_0x20bf24['id']);return getEndUser(_0x1b38de,_0x3766e0['calleridname'],_0x3766e0[_0x9d6f('0x53')],_0x3a862d);})[_0x9d6f('0x25')](function(_0x243891){_0x5a14c1=_0x243891;logger['info'](_0x9d6f('0x54'),_0x5a14c1['id']);return createTicket(_0x1b38de,_0x20bf24,_0x5a14c1,_0xf3cd59,_0x3766e0,_0xf3cd59[_0x9d6f('0x55')],_0x3a862d);})[_0x9d6f('0x25')](function(_0x4cf643){_0x973bd4=_0x4cf643;logger[_0x9d6f('0x17')](_0x9d6f('0x56'));logger[_0x9d6f('0x17')]('The\x20Ticket\x20ID\x20is:',_0x973bd4['id']);})[_0x9d6f('0x2a')](function(_0x588385){logger[_0x9d6f('0x2c')]('['+_0x3766e0[_0x9d6f('0x62')][_0x9d6f('0x63')]()+']',JSON['stringify'](_0x588385));});}; \ 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 64e51fe..067f5d7 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 _0xdc08=['destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','md5','util','./util','../../../../config/logger','zendesk','localhost','socket.io-emitter','redis','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','format','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','toString','debug','stringify','map','forEach','includes','type','customField','toLowerCase','picklist','idField','push','content','variable','variableName','custom_fields','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','Authorization'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0xdc08,0x77));var _0x8dc0=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xdc08[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x8dc0('0x0'));var rp=require(_0x8dc0('0x1'));var md5=require(_0x8dc0('0x2'));var util=require(_0x8dc0('0x3'));var Redis=require('ioredis');var intUtil=require(_0x8dc0('0x4'));var config=require('../../../../config/environment');var logger=require(_0x8dc0('0x5'))(_0x8dc0('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x8dc0('0x7'),'port':0x18eb});var io=require(_0x8dc0('0x8'))(new Redis(config[_0x8dc0('0x9')]));function emit(_0x1c95a2,_0x27da51,_0x4e5760){io['to'](_0x1c95a2)[_0x8dc0('0xa')](_0x27da51,_0x4e5760);}var headers={'Content-Type':_0x8dc0('0xb'),'Accept':_0x8dc0('0xb')};function getTicket(_0x301bc1,_0x49bd04,_0x46452b,_0x1a331d,_0x8ddf1b){logger[_0x8dc0('0xc')](_0x8dc0('0xd'));return request({'uri':util['format'](_0x8dc0('0xe'),_0x301bc1[_0x8dc0('0xf')]),'method':_0x8dc0('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x46452b['id'],'submitter_id':_0x49bd04?_0x49bd04['id']:undefined,'assignee_id':_0x49bd04?_0x49bd04['id']:undefined,'tags':getTags(_0x1a331d[_0x8dc0('0x11')],_0x8dc0('0x12')),'subject':intUtil[_0x8dc0('0x13')](_0x1a331d[_0x8dc0('0x14')],_0x8ddf1b,'\x20'),'description':intUtil[_0x8dc0('0x13')](_0x1a331d[_0x8dc0('0x15')],_0x8ddf1b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8dc0('0x13')](_0x1a331d['Descriptions'],_0x8ddf1b,'\x0a')}},getCustomFields(_0x1a331d[_0x8dc0('0x16')],_0x8ddf1b))}})['then'](function(_0x37c98e){logger[_0x8dc0('0xc')](_0x8dc0('0x17'));return _0x37c98e['ticket'];});}function getUser(_0x37671c,_0x2d3c04){if(intUtil['validateEmail'](_0x2d3c04)){logger[_0x8dc0('0xc')](_0x8dc0('0x18'),_0x2d3c04);return request({'uri':util['format'](_0x8dc0('0x19'),_0x37671c[_0x8dc0('0xf')]),'qs':{'query':util[_0x8dc0('0x1a')]('type:user\x20role:agent\x20email:%s',_0x2d3c04)}})[_0x8dc0('0x1b')](function(_0x567306){if(_0x567306[_0x8dc0('0x1c')]){logger['info'](_0x8dc0('0x1d'));return _[_0x8dc0('0x1e')](_0x567306[_0x8dc0('0x1f')],{'email':_0x2d3c04,'role':_0x8dc0('0x20')});}else{logger[_0x8dc0('0xc')](_0x8dc0('0x21'));return request({'uri':util[_0x8dc0('0x1a')](_0x8dc0('0x22'),_0x37671c[_0x8dc0('0xf')])})[_0x8dc0('0x1b')](function(_0x1bb64b){logger[_0x8dc0('0xc')](_0x8dc0('0x23'));return _0x1bb64b[_0x8dc0('0x24')];});}});}else{logger[_0x8dc0('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8dc0('0x1a')](_0x8dc0('0x22'),_0x37671c[_0x8dc0('0xf')])})['then'](function(_0x52be3c){logger['info'](_0x8dc0('0x23'));return _0x52be3c[_0x8dc0('0x24')];});}}function getEndUser(_0x477060,_0x4a5173,_0x537c66){logger[_0x8dc0('0xc')](_0x8dc0('0x25'),_0x537c66);return request({'uri':util['format'](_0x8dc0('0x19'),_0x477060['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x537c66)}})[_0x8dc0('0x1b')](function(_0x2f0a57){var _0xda4f70;if(_0x2f0a57[_0x8dc0('0x1f')][_0x8dc0('0x26')]){_0x2f0a57[_0x8dc0('0x1f')]=_[_0x8dc0('0x27')](_0x2f0a57['results'],{'suspended':![],'role':_0x8dc0('0x28')});if(_0x2f0a57[_0x8dc0('0x1f')][_0x8dc0('0x26')]){_0xda4f70=_[_0x8dc0('0x29')](_0x2f0a57[_0x8dc0('0x1f')]);}}if(_0xda4f70){logger[_0x8dc0('0xc')](_0x8dc0('0x2a'));return _0xda4f70;}else{logger[_0x8dc0('0xc')](_0x8dc0('0x2b'));return request({'uri':util[_0x8dc0('0x1a')](_0x8dc0('0x2c'),_0x477060[_0x8dc0('0xf')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x8dc0('0x1a')](_0x8dc0('0x2d'),_0x4a5173||_0x537c66),'phone':_0x537c66}}})[_0x8dc0('0x1b')](function(_0x77d470){logger[_0x8dc0('0xc')](_0x8dc0('0x2e'));return _0x77d470[_0x8dc0('0x24')];});}});}function getAuth(_0x3c3372){var _0x1eeef9;if(_0x3c3372[_0x8dc0('0x2f')]===_0x8dc0('0x30')){_0x1eeef9=util[_0x8dc0('0x1a')]('%s:%s',_0x3c3372[_0x8dc0('0x31')],_0x3c3372[_0x8dc0('0x30')]);}else if(_0x3c3372[_0x8dc0('0x2f')]===_0x8dc0('0x32')){_0x1eeef9=util[_0x8dc0('0x1a')](_0x8dc0('0x33'),_0x3c3372[_0x8dc0('0x31')],_0x3c3372[_0x8dc0('0x32')]);}return util['format']('Basic\x20%s',new Buffer(_0x1eeef9)[_0x8dc0('0x34')]('base64'));}function request(_0x290589){logger[_0x8dc0('0x35')]('[HTTP]',JSON[_0x8dc0('0x36')](_0x290589));return rp(_['defaults'](_0x290589,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4d7829,_0x15a25e){var _0x184a8d=[];if(_0x4d7829&&_0x4d7829[_0x8dc0('0x26')]>0x0){_0x184a8d=_[_0x8dc0('0x37')](_0x4d7829,_0x15a25e);}return _0x184a8d;}function getCustomFields(_0x4a7a0d,_0x315412){var _0x42c126=[];var _0xe0b035={'custom_fields':[]};if(_0x4a7a0d[_0x8dc0('0x26')]>0x0){_[_0x8dc0('0x38')](_0x4a7a0d,function(_0x17308a){if(_[_0x8dc0('0x39')](['string','picklist'],_0x17308a[_0x8dc0('0x3a')])&&_0x17308a['nameField']&&!_0x17308a[_0x8dc0('0x3b')]){_0xe0b035[_0x17308a['nameField'][_0x8dc0('0x3c')]()]=_0x17308a['content']['toString']();}else if(_[_0x8dc0('0x39')](['string',_0x8dc0('0x3d')],_0x17308a['type'])&&_0x17308a[_0x8dc0('0x3e')]&&_0x17308a['customField']){_0xe0b035['custom_fields'][_0x8dc0('0x3f')]({'id':_0x17308a[_0x8dc0('0x3e')],'value':_0x17308a[_0x8dc0('0x40')][_0x8dc0('0x34')]()});}else if(_0x17308a[_0x8dc0('0x3a')]===_0x8dc0('0x41')&&_0x17308a[_0x8dc0('0x42')]&&_0x17308a[_0x8dc0('0x3e')]&&_0x17308a[_0x8dc0('0x3b')]){_0x315412[_0x17308a[_0x8dc0('0x42')]]&&_0xe0b035[_0x8dc0('0x43')]['push']({'id':_0x17308a[_0x8dc0('0x3e')],'value':_0x315412[_0x17308a[_0x8dc0('0x42')]][_0x8dc0('0x34')]()});}else if(_0x17308a[_0x8dc0('0x3a')]==='customVariable'&&_0x17308a[_0x8dc0('0x44')]&&_0x17308a['Variable'][_0x8dc0('0x12')]&&_0x17308a['idField']&&_0x17308a[_0x8dc0('0x3b')]){_0x315412[_0x17308a[_0x8dc0('0x44')][_0x8dc0('0x12')][_0x8dc0('0x3c')]()]&&_0xe0b035[_0x8dc0('0x43')][_0x8dc0('0x3f')]({'id':_0x17308a[_0x8dc0('0x3e')],'value':_0x315412[_0x17308a[_0x8dc0('0x44')][_0x8dc0('0x12')][_0x8dc0('0x3c')]()][_0x8dc0('0x34')]()});}});}return _0xe0b035;}exports[_0x8dc0('0x45')]=function(_0xa89e47,_0xe85157,_0x3e8427,_0x172402,_0x3dee6e,_0x38086c){var _0x47f2c7,_0x10f3af;_0x38086c[_0x8dc0('0xf')]=intUtil[_0x8dc0('0x46')](_0x38086c[_0x8dc0('0xf')]);_0x38086c[_0x8dc0('0x47')]=intUtil[_0x8dc0('0x46')](_0x38086c[_0x8dc0('0x47')]);if(_0x3dee6e&&_0x3dee6e[_0x8dc0('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0xe85157['recordingURL']=util[_0x8dc0('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38086c[_0x8dc0('0x47')],_0xe85157[_0x8dc0('0x49')],md5(_0xe85157[_0x8dc0('0x49')]));}else{_0xe85157[_0x8dc0('0x4a')]='';}headers['Authorization']=getAuth(_0x38086c);return getUser(_0x38086c,_0x172402[_0x8dc0('0x4b')])[_0x8dc0('0x1b')](function(_0x3197a8){_0x47f2c7=_0x3197a8;logger[_0x8dc0('0xc')](_0x8dc0('0x4c'),_0x47f2c7['id']);return getEndUser(_0x38086c,_0xe85157[_0x8dc0('0x4d')],_0xe85157[_0x8dc0('0x4e')]);})[_0x8dc0('0x1b')](function(_0x29058e){_0x10f3af=_0x29058e;logger[_0x8dc0('0xc')](_0x8dc0('0x4f'),_0x10f3af['id']);return getTicket(_0x38086c,_0x47f2c7,_0x10f3af,_0x3e8427,_0xe85157);})[_0x8dc0('0x1b')](function(_0x1c164b){if(_0x1c164b){logger[_0x8dc0('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1c164b['id']);switch(_0x38086c[_0x8dc0('0x3a')]){case _0x8dc0('0x50'):logger['info']('[QUEUE]',_0x8dc0('0x51'));return request({'uri':util[_0x8dc0('0x1a')](_0x8dc0('0x52'),_0x38086c[_0x8dc0('0xf')],_0x47f2c7['id'],_0x1c164b['id']),'method':'POST'});case _0x8dc0('0x53'):logger[_0x8dc0('0xc')](_0x8dc0('0x54'),_0x8dc0('0x55'));emit(util[_0x8dc0('0x1a')](_0x8dc0('0x56'),_0x172402[_0x8dc0('0x12')]),_0x8dc0('0x57'),{'uri':util[_0x8dc0('0x1a')](_0x8dc0('0x58'),_0x38086c[_0x8dc0('0xf')][_0x8dc0('0x59')](_0x8dc0('0x5a'),''),_0x1c164b['id'])});break;default:logger[_0x8dc0('0x5b')](_0x8dc0('0x54'),_0x8dc0('0x5c'));}}})[_0x8dc0('0x5d')](function(_0x5859f8){logger[_0x8dc0('0x5b')](_0x8dc0('0x5e'),util['inspect'](_0x5859f8,{'showHidden':!![],'depth':null}));});};exports[_0x8dc0('0x5f')]=function(_0x227402,_0x379637,_0x24dd2e,_0x4dd885,_0x1ec38f,_0x3f3da7,_0x279df0){var _0xa0b21c,_0xb117ba;_0x3f3da7[_0x8dc0('0xf')]=intUtil['stripTrailingSlash'](_0x3f3da7[_0x8dc0('0xf')]);_0x3f3da7['serverUrl']=intUtil[_0x8dc0('0x46')](_0x3f3da7[_0x8dc0('0x47')]);if(_0x279df0&&_0x279df0[_0x8dc0('0x60')]&&_0x279df0[_0x8dc0('0x60')]!==_0x8dc0('0x61')){logger[_0x8dc0('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x379637['recordingURL']=util[_0x8dc0('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f3da7[_0x8dc0('0x47')],_0x379637[_0x8dc0('0x49')],md5(_0x379637['uniqueid']));}headers[_0x8dc0('0x62')]=getAuth(_0x3f3da7);return getUser(_0x3f3da7,_0x4dd885[_0x8dc0('0x4b')])[_0x8dc0('0x1b')](function(_0x4a0c43){_0xa0b21c=_0x4a0c43;logger['info'](_0x8dc0('0x4c'),_0xa0b21c['id']);return getEndUser(_0x3f3da7,_0x379637[_0x8dc0('0x63')],_0x379637[_0x8dc0('0x64')]);})[_0x8dc0('0x1b')](function(_0x35e4ed){_0xb117ba=_0x35e4ed;logger['info'](_0x8dc0('0x4f'),_0xb117ba['id']);return getTicket(_0x3f3da7,_0xa0b21c,_0xb117ba,_0x24dd2e,_0x379637);})['then'](function(_0x300206){if(_0x300206){logger[_0x8dc0('0xc')](_0x8dc0('0x65'),_0x300206['id']);switch(_0x3f3da7[_0x8dc0('0x3a')]){case'integrationTab':logger['info'](_0x8dc0('0x66'),_0x8dc0('0x51'));return request({'uri':util[_0x8dc0('0x1a')](_0x8dc0('0x52'),_0x3f3da7[_0x8dc0('0xf')],_0xa0b21c['id'],_0x300206['id']),'method':_0x8dc0('0x10')});case _0x8dc0('0x53'):logger[_0x8dc0('0xc')]('[OUTBOUND]',_0x8dc0('0x55'));emit(util[_0x8dc0('0x1a')](_0x8dc0('0x56'),_0x4dd885[_0x8dc0('0x12')]),'trigger:browser:url',{'uri':util[_0x8dc0('0x1a')](_0x8dc0('0x58'),_0x3f3da7['remoteUri'][_0x8dc0('0x59')](_0x8dc0('0x5a'),''),_0x300206['id'])});break;default:logger[_0x8dc0('0x5b')](_0x8dc0('0x66'),_0x8dc0('0x5c'));}}})[_0x8dc0('0x5d')](function(_0x496fca){logger[_0x8dc0('0x5b')](_0x8dc0('0x67'),util[_0x8dc0('0x68')](_0x496fca,{'showHidden':!![],'depth':null}));});};exports[_0x8dc0('0x69')]=function(_0xac317d,_0x4da0cd,_0x8e79a8,_0x40cdf4,_0xd2780d,_0x19782e){var _0x49ff2e,_0x12c5bb;_0x19782e[_0x8dc0('0xf')]=intUtil[_0x8dc0('0x46')](_0x19782e[_0x8dc0('0xf')]);_0x19782e[_0x8dc0('0x47')]=intUtil[_0x8dc0('0x46')](_0x19782e[_0x8dc0('0x47')]);if(_0xd2780d&&_0xd2780d['monitor_format']){logger[_0x8dc0('0xc')]('['+_0x4da0cd[_0x8dc0('0x6a')][_0x8dc0('0x6b')]()+']','Recording\x20is\x20enabled!');_0x4da0cd[_0x8dc0('0x4a')]=util['format'](_0x8dc0('0x6c'),_0x19782e['serverUrl'],_0x4da0cd[_0x8dc0('0x49')],md5(_0x4da0cd['uniqueid']));}else{_0x4da0cd['recordingURL']='';}headers[_0x8dc0('0x62')]=getAuth(_0x19782e);return getUser(_0x19782e)[_0x8dc0('0x1b')](function(_0x56d806){_0x49ff2e=_0x56d806;logger[_0x8dc0('0xc')](_0x8dc0('0x4c'),_0x49ff2e['id']);return getEndUser(_0x19782e,_0x4da0cd['calleridname'],_0x4da0cd['calleridnum']);})[_0x8dc0('0x1b')](function(_0x3bd1d9){_0x12c5bb=_0x3bd1d9;logger[_0x8dc0('0xc')](_0x8dc0('0x4f'),_0x12c5bb['id']);return getTicket(_0x19782e,_0x49ff2e,_0x12c5bb,_0x8e79a8,_0x4da0cd);})['then'](function(_0x576833){if(_0x576833){logger[_0x8dc0('0xc')](_0x8dc0('0x65'),_0x576833['id']);}})[_0x8dc0('0x5d')](function(_0x5a1840){logger[_0x8dc0('0x5b')]('['+_0x4da0cd[_0x8dc0('0x6a')][_0x8dc0('0x6b')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x8dc0('0x68')](_0x5a1840,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6aab=['Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','forEach','includes','picklist','nameField','content','toString','string','type','idField','customField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','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','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','The\x20User\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','info'];(function(_0xee8b91,_0x50f801){var _0x21fa77=function(_0x589bc6){while(--_0x589bc6){_0xee8b91['push'](_0xee8b91['shift']());}};_0x21fa77(++_0x50f801);}(_0x6aab,0x1b8));var _0xb6aa=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x6aab[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xb6aa('0x0'));var rp=require(_0xb6aa('0x1'));var md5=require(_0xb6aa('0x2'));var util=require(_0xb6aa('0x3'));var Redis=require(_0xb6aa('0x4'));var intUtil=require(_0xb6aa('0x5'));var config=require(_0xb6aa('0x6'));var logger=require(_0xb6aa('0x7'))(_0xb6aa('0x8'));config[_0xb6aa('0x9')]=_[_0xb6aa('0xa')](config[_0xb6aa('0x9')],{'host':_0xb6aa('0xb'),'port':0x18eb});var io=require(_0xb6aa('0xc'))(new Redis(config[_0xb6aa('0x9')]));function emit(_0x27895c,_0xb6841,_0x12d43e){io['to'](_0x27895c)[_0xb6aa('0xd')](_0xb6841,_0x12d43e);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0xf72e00,_0xeb4dd3,_0x500fe9,_0x535fe4,_0x3661a1){logger['info'](_0xb6aa('0xe'));return request({'uri':util[_0xb6aa('0xf')](_0xb6aa('0x10'),_0xf72e00['remoteUri']),'method':'POST','body':{'ticket':_[_0xb6aa('0x11')]({'requester_id':_0x500fe9['id'],'submitter_id':_0xeb4dd3?_0xeb4dd3['id']:undefined,'assignee_id':_0xeb4dd3?_0xeb4dd3['id']:undefined,'tags':getTags(_0x535fe4[_0xb6aa('0x12')],_0xb6aa('0x13')),'subject':intUtil[_0xb6aa('0x14')](_0x535fe4[_0xb6aa('0x15')],_0x3661a1,'\x20'),'description':intUtil[_0xb6aa('0x14')](_0x535fe4['Descriptions'],_0x3661a1,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb6aa('0x14')](_0x535fe4[_0xb6aa('0x16')],_0x3661a1,'\x0a')}},getCustomFields(_0x535fe4['Fields'],_0x3661a1))}})[_0xb6aa('0x17')](function(_0x3f646b){logger['info'](_0xb6aa('0x18'));return _0x3f646b[_0xb6aa('0x19')];});}function getUser(_0x2c9d1e,_0x1be191){if(intUtil[_0xb6aa('0x1a')](_0x1be191)){logger[_0xb6aa('0x1b')](_0xb6aa('0x1c'),_0x1be191);return request({'uri':util[_0xb6aa('0xf')](_0xb6aa('0x1d'),_0x2c9d1e[_0xb6aa('0x1e')]),'qs':{'query':util[_0xb6aa('0xf')](_0xb6aa('0x1f'),_0x1be191)}})[_0xb6aa('0x17')](function(_0x3580df){if(_0x3580df[_0xb6aa('0x20')]){logger['info'](_0xb6aa('0x21'));return _[_0xb6aa('0x22')](_0x3580df[_0xb6aa('0x23')],{'email':_0x1be191,'role':_0xb6aa('0x24')});}else{logger[_0xb6aa('0x1b')](_0xb6aa('0x25'));return request({'uri':util['format']('%s/users/me.json',_0x2c9d1e[_0xb6aa('0x1e')])})[_0xb6aa('0x17')](function(_0x481e6f){logger[_0xb6aa('0x1b')](_0xb6aa('0x26'));return _0x481e6f[_0xb6aa('0x27')];});}});}else{logger['info'](_0xb6aa('0x25'));return request({'uri':util[_0xb6aa('0xf')]('%s/users/me.json',_0x2c9d1e[_0xb6aa('0x1e')])})['then'](function(_0x1457db){logger[_0xb6aa('0x1b')](_0xb6aa('0x26'));return _0x1457db[_0xb6aa('0x27')];});}}function getEndUser(_0xd4f2f3,_0x3f96f3,_0x4626bb){logger[_0xb6aa('0x1b')](_0xb6aa('0x28'),_0x4626bb);return request({'uri':util[_0xb6aa('0xf')](_0xb6aa('0x1d'),_0xd4f2f3[_0xb6aa('0x1e')]),'qs':{'query':util[_0xb6aa('0xf')](_0xb6aa('0x29'),_0x4626bb)}})['then'](function(_0x467a1f){var _0xace55a;if(_0x467a1f[_0xb6aa('0x23')][_0xb6aa('0x2a')]){_0x467a1f[_0xb6aa('0x23')]=_[_0xb6aa('0x2b')](_0x467a1f[_0xb6aa('0x23')],{'suspended':![],'role':_0xb6aa('0x2c')});if(_0x467a1f[_0xb6aa('0x23')]['length']){_0xace55a=_[_0xb6aa('0x2d')](_0x467a1f[_0xb6aa('0x23')]);}}if(_0xace55a){logger[_0xb6aa('0x1b')](_0xb6aa('0x2e'));return _0xace55a;}else{logger[_0xb6aa('0x1b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb6aa('0xf')](_0xb6aa('0x2f'),_0xd4f2f3[_0xb6aa('0x1e')]),'method':_0xb6aa('0x30'),'body':{'user':{'role':_0xb6aa('0x2c'),'name':util[_0xb6aa('0xf')](_0xb6aa('0x31'),_0x3f96f3||_0x4626bb),'phone':_0x4626bb}}})[_0xb6aa('0x17')](function(_0x4269a7){logger['info'](_0xb6aa('0x32'));return _0x4269a7[_0xb6aa('0x27')];});}});}function getAuth(_0x5ee3c1){var _0x412a6a;if(_0x5ee3c1[_0xb6aa('0x33')]===_0xb6aa('0x34')){_0x412a6a=util[_0xb6aa('0xf')]('%s:%s',_0x5ee3c1[_0xb6aa('0x35')],_0x5ee3c1['password']);}else if(_0x5ee3c1['authType']===_0xb6aa('0x36')){_0x412a6a=util[_0xb6aa('0xf')](_0xb6aa('0x37'),_0x5ee3c1['username'],_0x5ee3c1['token']);}return util[_0xb6aa('0xf')](_0xb6aa('0x38'),new Buffer(_0x412a6a)['toString'](_0xb6aa('0x39')));}function request(_0x3bb82e){logger[_0xb6aa('0x3a')](_0xb6aa('0x3b'),JSON[_0xb6aa('0x3c')](_0x3bb82e));return rp(_[_0xb6aa('0xa')](_0x3bb82e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5d471e,_0x4a3bb6){var _0x371d5e=[];if(_0x5d471e&&_0x5d471e[_0xb6aa('0x2a')]>0x0){_0x371d5e=_['map'](_0x5d471e,_0x4a3bb6);}return _0x371d5e;}function getCustomFields(_0x19b0b5,_0x46526f){var _0x597323=[];var _0x3c408d={'custom_fields':[]};if(_0x19b0b5[_0xb6aa('0x2a')]>0x0){_[_0xb6aa('0x3d')](_0x19b0b5,function(_0x33c360){if(_[_0xb6aa('0x3e')](['string',_0xb6aa('0x3f')],_0x33c360['type'])&&_0x33c360[_0xb6aa('0x40')]&&!_0x33c360['customField']){_0x3c408d[_0x33c360[_0xb6aa('0x40')]['toLowerCase']()]=_0x33c360[_0xb6aa('0x41')][_0xb6aa('0x42')]();}else if(_[_0xb6aa('0x3e')]([_0xb6aa('0x43'),'picklist'],_0x33c360[_0xb6aa('0x44')])&&_0x33c360[_0xb6aa('0x45')]&&_0x33c360[_0xb6aa('0x46')]){_0x3c408d[_0xb6aa('0x47')][_0xb6aa('0x48')]({'id':_0x33c360['idField'],'value':_0x33c360[_0xb6aa('0x41')][_0xb6aa('0x42')]()});}else if(_0x33c360[_0xb6aa('0x44')]===_0xb6aa('0x49')&&_0x33c360[_0xb6aa('0x4a')]&&_0x33c360[_0xb6aa('0x45')]&&_0x33c360[_0xb6aa('0x46')]){_0x46526f[_0x33c360[_0xb6aa('0x4a')]]&&_0x3c408d[_0xb6aa('0x47')]['push']({'id':_0x33c360['idField'],'value':_0x46526f[_0x33c360[_0xb6aa('0x4a')]][_0xb6aa('0x42')]()});}else if(_0x33c360['type']==='customVariable'&&_0x33c360['Variable']&&_0x33c360[_0xb6aa('0x4b')]['name']&&_0x33c360['idField']&&_0x33c360[_0xb6aa('0x46')]){_0x46526f[_0x33c360['Variable'][_0xb6aa('0x13')]['toLowerCase']()]&&_0x3c408d['custom_fields']['push']({'id':_0x33c360[_0xb6aa('0x45')],'value':_0x46526f[_0x33c360[_0xb6aa('0x4b')][_0xb6aa('0x13')]['toLowerCase']()][_0xb6aa('0x42')]()});}});}return _0x3c408d;}exports[_0xb6aa('0x4c')]=function(_0x55694f,_0x20ee80,_0x2e3eeb,_0x30f744,_0x542a64,_0x709593){var _0x501855,_0x50a05a;_0x709593[_0xb6aa('0x1e')]=intUtil[_0xb6aa('0x4d')](_0x709593[_0xb6aa('0x1e')]);_0x709593[_0xb6aa('0x4e')]=intUtil['stripTrailingSlash'](_0x709593[_0xb6aa('0x4e')]);if(_0x542a64&&_0x542a64[_0xb6aa('0x4f')]){logger[_0xb6aa('0x1b')](_0xb6aa('0x50'),_0xb6aa('0x51'));_0x20ee80[_0xb6aa('0x52')]=util[_0xb6aa('0xf')](_0xb6aa('0x53'),_0x709593[_0xb6aa('0x4e')],_0x20ee80[_0xb6aa('0x54')],md5(_0x20ee80['uniqueid']));}else{_0x20ee80[_0xb6aa('0x52')]='';}headers[_0xb6aa('0x55')]=getAuth(_0x709593);return getUser(_0x709593,_0x30f744[_0xb6aa('0x56')])[_0xb6aa('0x17')](function(_0x3c4d60){_0x501855=_0x3c4d60;logger[_0xb6aa('0x1b')]('The\x20User\x20ID\x20is:',_0x501855['id']);return getEndUser(_0x709593,_0x20ee80['calleridname'],_0x20ee80[_0xb6aa('0x57')]);})[_0xb6aa('0x17')](function(_0x24802e){_0x50a05a=_0x24802e;logger[_0xb6aa('0x1b')](_0xb6aa('0x58'),_0x50a05a['id']);return getTicket(_0x709593,_0x501855,_0x50a05a,_0x2e3eeb,_0x20ee80);})[_0xb6aa('0x17')](function(_0x1c2bf8){if(_0x1c2bf8){logger[_0xb6aa('0x1b')](_0xb6aa('0x59'),_0x1c2bf8['id']);switch(_0x709593[_0xb6aa('0x44')]){case _0xb6aa('0x5a'):logger[_0xb6aa('0x1b')](_0xb6aa('0x50'),_0xb6aa('0x5b'));return request({'uri':util[_0xb6aa('0xf')](_0xb6aa('0x5c'),_0x709593['remoteUri'],_0x501855['id'],_0x1c2bf8['id']),'method':'POST'});case _0xb6aa('0x5d'):logger['info'](_0xb6aa('0x50'),_0xb6aa('0x5e'));emit(util[_0xb6aa('0xf')](_0xb6aa('0x5f'),_0x30f744['name']),'trigger:browser:url',{'uri':util[_0xb6aa('0xf')](_0xb6aa('0x60'),_0x709593['remoteUri'][_0xb6aa('0x61')](_0xb6aa('0x62'),''),_0x1c2bf8['id'])});break;default:logger[_0xb6aa('0x63')](_0xb6aa('0x50'),_0xb6aa('0x64'));}}})[_0xb6aa('0x65')](function(_0x1925a1){logger[_0xb6aa('0x63')](_0xb6aa('0x66'),util['inspect'](_0x1925a1,{'showHidden':!![],'depth':null}));});};exports[_0xb6aa('0x67')]=function(_0xf93e37,_0x27139e,_0x380c6d,_0x35d9f7,_0x292fbc,_0x5d6fc6,_0x22eb27){var _0x2c9261,_0x4005e4;_0x5d6fc6[_0xb6aa('0x1e')]=intUtil[_0xb6aa('0x4d')](_0x5d6fc6[_0xb6aa('0x1e')]);_0x5d6fc6[_0xb6aa('0x4e')]=intUtil['stripTrailingSlash'](_0x5d6fc6[_0xb6aa('0x4e')]);if(_0x22eb27&&_0x22eb27[_0xb6aa('0x68')]&&_0x22eb27[_0xb6aa('0x68')]!==_0xb6aa('0x69')){logger['info']('[OUTBOUND]',_0xb6aa('0x51'));_0x27139e[_0xb6aa('0x52')]=util[_0xb6aa('0xf')](_0xb6aa('0x53'),_0x5d6fc6[_0xb6aa('0x4e')],_0x27139e[_0xb6aa('0x54')],md5(_0x27139e[_0xb6aa('0x54')]));}headers[_0xb6aa('0x55')]=getAuth(_0x5d6fc6);return getUser(_0x5d6fc6,_0x35d9f7['email'])[_0xb6aa('0x17')](function(_0x3aafb5){_0x2c9261=_0x3aafb5;logger[_0xb6aa('0x1b')]('The\x20User\x20ID\x20is:',_0x2c9261['id']);return getEndUser(_0x5d6fc6,_0x27139e[_0xb6aa('0x6a')],_0x27139e[_0xb6aa('0x6b')]);})[_0xb6aa('0x17')](function(_0x31bffa){_0x4005e4=_0x31bffa;logger['info'](_0xb6aa('0x58'),_0x4005e4['id']);return getTicket(_0x5d6fc6,_0x2c9261,_0x4005e4,_0x380c6d,_0x27139e);})['then'](function(_0x3bceda){if(_0x3bceda){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3bceda['id']);switch(_0x5d6fc6[_0xb6aa('0x44')]){case _0xb6aa('0x5a'):logger['info'](_0xb6aa('0x6c'),_0xb6aa('0x5b'));return request({'uri':util[_0xb6aa('0xf')](_0xb6aa('0x5c'),_0x5d6fc6['remoteUri'],_0x2c9261['id'],_0x3bceda['id']),'method':_0xb6aa('0x30')});case _0xb6aa('0x5d'):logger['info'](_0xb6aa('0x6c'),_0xb6aa('0x5e'));emit(util[_0xb6aa('0xf')]('user:%s',_0x35d9f7[_0xb6aa('0x13')]),_0xb6aa('0x6d'),{'uri':util[_0xb6aa('0xf')]('%s/agent/tickets/%s',_0x5d6fc6['remoteUri'][_0xb6aa('0x61')](_0xb6aa('0x62'),''),_0x3bceda['id'])});break;default:logger[_0xb6aa('0x63')](_0xb6aa('0x6c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xb6aa('0x65')](function(_0x4fb90c){logger['error'](_0xb6aa('0x6e'),util[_0xb6aa('0x6f')](_0x4fb90c,{'showHidden':!![],'depth':null}));});};exports[_0xb6aa('0x70')]=function(_0x2a79e0,_0x279998,_0x39902a,_0x447c10,_0x1411b3,_0x2c2b4a){var _0x5f5309,_0xc770c3;_0x2c2b4a[_0xb6aa('0x1e')]=intUtil[_0xb6aa('0x4d')](_0x2c2b4a['remoteUri']);_0x2c2b4a[_0xb6aa('0x4e')]=intUtil[_0xb6aa('0x4d')](_0x2c2b4a[_0xb6aa('0x4e')]);if(_0x1411b3&&_0x1411b3[_0xb6aa('0x4f')]){logger['info']('['+_0x279998[_0xb6aa('0x71')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x279998[_0xb6aa('0x52')]=util[_0xb6aa('0xf')](_0xb6aa('0x53'),_0x2c2b4a[_0xb6aa('0x4e')],_0x279998['uniqueid'],md5(_0x279998[_0xb6aa('0x54')]));}else{_0x279998['recordingURL']='';}headers[_0xb6aa('0x55')]=getAuth(_0x2c2b4a);return getUser(_0x2c2b4a)[_0xb6aa('0x17')](function(_0x1177f7){_0x5f5309=_0x1177f7;logger[_0xb6aa('0x1b')](_0xb6aa('0x72'),_0x5f5309['id']);return getEndUser(_0x2c2b4a,_0x279998['calleridname'],_0x279998['calleridnum']);})[_0xb6aa('0x17')](function(_0x3f443b){_0xc770c3=_0x3f443b;logger[_0xb6aa('0x1b')](_0xb6aa('0x58'),_0xc770c3['id']);return getTicket(_0x2c2b4a,_0x5f5309,_0xc770c3,_0x39902a,_0x279998);})['then'](function(_0x4a0a6b){if(_0x4a0a6b){logger[_0xb6aa('0x1b')](_0xb6aa('0x59'),_0x4a0a6b['id']);}})[_0xb6aa('0x65')](function(_0x3dc076){logger[_0xb6aa('0x63')]('['+_0x279998['lastevent'][_0xb6aa('0x73')]()+']'+_0xb6aa('0x74'),util[_0xb6aa('0x6f')](_0x3dc076,{'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 65acc98..df3b34c 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 _0xeffd=['refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','findIndex','users','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','GET','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Description','getString','Full_Name','First_Name','Last_Name','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','Call_Result','Called','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','zoho.eu','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','picklist','type','idField','variable','variableName','toString','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0x1c40b1,_0x196db1){var _0x165dc2=function(_0x53e16f){while(--_0x53e16f){_0x1c40b1['push'](_0x1c40b1['shift']());}};_0x165dc2(++_0x196db1);}(_0xeffd,0x6b));var _0xdeff=function(_0x3aab2b,_0x3f0a17){_0x3aab2b=_0x3aab2b-0x0;var _0x3a9159=_0xeffd[_0x3aab2b];return _0x3a9159;};'use strict';var _=require(_0xdeff('0x0'));var rp=require('request-promise');var md5=require(_0xdeff('0x1'));var util=require(_0xdeff('0x2'));var intUtil=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var Redis=require(_0xdeff('0x5'));var BPromise=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var logger=require(_0xdeff('0x8'))(_0xdeff('0x9'));config[_0xdeff('0xa')]=_[_0xdeff('0xb')](config[_0xdeff('0xa')],{'host':_0xdeff('0xc'),'port':0x18eb});var io=require(_0xdeff('0xd'))(new Redis(config[_0xdeff('0xa')]));function emit(_0x12e953,_0x24897a,_0x540ae6){io['to'](_0x12e953)[_0xdeff('0xe')](_0x24897a,_0x540ae6);}function request(_0x45a8a6){logger[_0xdeff('0xf')]('[HTTP]',JSON[_0xdeff('0x10')](_0x45a8a6));return rp(_0x45a8a6);}function getCustomFields(_0x4423e9,_0x3c1482){var _0x192195={};if(_0x4423e9[_0xdeff('0x11')]>0x0){_[_0xdeff('0x12')](_0x4423e9,function(_0x2e9783){if(_[_0xdeff('0x13')](['string',_0xdeff('0x14')],_0x2e9783[_0xdeff('0x15')])&&_0x2e9783['idField']){_0x192195[_0x2e9783[_0xdeff('0x16')]]=_0x2e9783['content']['toString']();}else if(_0x2e9783[_0xdeff('0x15')]===_0xdeff('0x17')&&_0x2e9783[_0xdeff('0x18')]&&_0x2e9783[_0xdeff('0x16')]&&_0x3c1482[_0x2e9783['variableName']]){_0x192195[_0x2e9783[_0xdeff('0x16')]]=_0x3c1482[_0x2e9783[_0xdeff('0x18')]][_0xdeff('0x19')]();}else if(_0x2e9783[_0xdeff('0x15')]===_0xdeff('0x1a')&&_0x2e9783[_0xdeff('0x1b')]&&_0x2e9783['Variable']['name']&&_0x2e9783[_0xdeff('0x16')]&&_0x3c1482[_0x2e9783['Variable']['name'][_0xdeff('0x1c')]()]){_0x192195[_0x2e9783[_0xdeff('0x16')]]=_0x3c1482[_0x2e9783['Variable'][_0xdeff('0x1d')][_0xdeff('0x1c')]()][_0xdeff('0x19')]();}});}return _0x192195;}function getName(_0x3a677a){if(_0x3a677a[_0xdeff('0x1e')]('\x20')>0x0){var _0x299cc5=_0x3a677a[_0xdeff('0x1f')](/ (.+)/);if(_0x299cc5[0x1]){return _0x299cc5;}}return[_0x3a677a,_0x3a677a];}var accountsTokens={};function getAccessToken(_0x919c93){return new Promise(function(_0x488faa,_0x5591fa){if(!_['isNil'](accountsTokens[_0x919c93['id']])&&!_[_0xdeff('0x20')](accountsTokens[_0x919c93['id']]['access_token'])){if(moment()[_0xdeff('0x21')](accountsTokens[_0x919c93['id']][_0xdeff('0x22')])){_0x488faa(accountsTokens[_0x919c93['id']]['access_token']);}}var _0x18338c;switch(_0x919c93[_0xdeff('0x23')]){case'US':_0x18338c='https://accounts.zoho.com';break;case'AU':_0x18338c='https://accounts.zoho.com.au';break;case'EU':_0x18338c=_0xdeff('0x24');break;case'IN':_0x18338c=_0xdeff('0x25');break;case'CN':_0x18338c=_0xdeff('0x26');break;default:_0x18338c=_0xdeff('0x24');break;}var _0x32add9={'method':'POST','uri':_0x18338c+_0xdeff('0x27'),'qs':{'refresh_token':_0x919c93[_0xdeff('0x28')],'client_id':_0x919c93[_0xdeff('0x29')],'client_secret':_0x919c93[_0xdeff('0x2a')],'grant_type':_0xdeff('0x2b')},'json':!![]};return rp(_0x32add9)[_0xdeff('0x2c')](function(_0x3d0111){accountsTokens[_0x919c93['id']]={'access_token':_0x3d0111['access_token'],'expires_in':moment()[_0xdeff('0x2d')](_0x3d0111[_0xdeff('0x22')],'seconds')};_0x488faa(_0x3d0111['access_token']);})[_0xdeff('0x2e')](function(_0x2ea8e9){logger[_0xdeff('0x2f')](_0xdeff('0x30'),_0x2ea8e9[_0xdeff('0x31')]);_0x5591fa(_0x2ea8e9);});});}function getUser(_0xf9b278,_0xbc75ee,_0x4e0ff2,_0x331ddc){logger[_0xdeff('0x32')](_0xdeff('0x33'));return request({'method':'GET','uri':util['format'](_0xdeff('0x34'),_0xbc75ee),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xdeff('0x35')+_0xf9b278},'json':!![]})[_0xdeff('0x2c')](function(_0x44a8b3){if(_0x44a8b3['users']){var _0x189a51=-0x1;if(_['isArrayLikeObject'](_0x44a8b3['users'])){if(!_[_0xdeff('0x20')](_0x331ddc)){_0x189a51=_[_0xdeff('0x36')](_0x44a8b3[_0xdeff('0x37')],function(_0x240459){return _0x240459['email']===_0x331ddc;});}if(_0x189a51>=0x0){logger[_0xdeff('0x32')](_0xdeff('0x38'));}else{logger[_0xdeff('0x32')](_0xdeff('0x39'));_0x189a51=_[_0xdeff('0x36')](_0x44a8b3[_0xdeff('0x37')],function(_0x321ef0){return _0x321ef0['profile'][_0xdeff('0x1d')]==='Administrator';});}return _0x44a8b3[_0xdeff('0x37')][_0x189a51];}else{if(_0x44a8b3[_0xdeff('0x3a')][_0xdeff('0x3b')][_0xdeff('0x1d')]===_0xdeff('0x3c')){logger[_0xdeff('0x32')]('Using\x20the\x20admin\x20account!');user=_0x44a8b3[_0xdeff('0x3a')];return user;}else{logger[_0xdeff('0x2f')]('The\x20failing\x20result\x20is',JSON[_0xdeff('0x10')](_0x44a8b3));throw new Error(_0xdeff('0x3d')+JSON[_0xdeff('0x10')](_0x44a8b3));}}}else{logger[_0xdeff('0x2f')](_0xdeff('0x3e'),JSON[_0xdeff('0x10')](_0x44a8b3));throw new Error(_0xdeff('0x3d')+JSON[_0xdeff('0x10')](_0x44a8b3));}})['catch'](function(_0x118752){console['error'](_0x118752);});}function getZohoUser(_0x231893,_0x345032){return new BPromise(function(_0x30f442,_0x5f368d){request(_0x231893)[_0xdeff('0x2c')](function(_0x280a86){var _0x31dd4a=null;if(_0x280a86){_0x31dd4a=_0x280a86[_0xdeff('0x3f')][0x0];_0x31dd4a[_0xdeff('0x40')]=_0x345032;}_0x30f442(_0x31dd4a);})['catch'](function(_0x1c87bd){_0x5f368d(_0x1c87bd);});});}function createEndUser(_0x4d9985,_0x393d75,_0x14f1d0,_0x518280,_0x30609b,_0x13e25e){var _0x14f1d0=getName(_0x14f1d0);return request({'method':_0xdeff('0x41'),'uri':_0xdeff('0x42')+_0x393d75+'/crm/v2/'+_[_0xdeff('0x43')](_0x13e25e[_0xdeff('0x44')])+'s','body':{'data':[{'Last_Name':_0x14f1d0[0x1],'First_Name':_0x14f1d0[0x0],'Phone':_0x518280,'Owner':{'name':!_[_0xdeff('0x20')](_0x30609b[_0xdeff('0x45')][_0xdeff('0x1d')])?_0x30609b['role']['name']:!_[_0xdeff('0x20')](_0x30609b[_0xdeff('0x46')])?_0x30609b[_0xdeff('0x46')]+'\x20'+_0x30609b[_0xdeff('0x47')]:_0x30609b[_0xdeff('0x47')],'id':_0x30609b['id']}}]},'headers':{'Authorization':_0xdeff('0x35')+_0x4d9985},'json':!![]})[_0xdeff('0x2c')](function(_0x4f02f5){if(_0x4f02f5&&_0x4f02f5[_0xdeff('0x3f')][0x0][_0xdeff('0x48')]===_0xdeff('0x49')){var _0x54fa5b=_0x4f02f5[_0xdeff('0x3f')][0x0][_0xdeff('0x4a')];_0x54fa5b[_0xdeff('0x40')]=_[_0xdeff('0x43')](_0x13e25e['moduleCreate'])+'s';return _0x54fa5b;}logger[_0xdeff('0x2f')](_0xdeff('0x3e'),JSON[_0xdeff('0x10')](data));throw new Error(_0xdeff('0x4b')+JSON[_0xdeff('0x10')](data));})[_0xdeff('0x2e')](function(_0x3fe2e4){console[_0xdeff('0x4c')]('CREATE\x20ERROR',_0x3fe2e4);});}function getEndUser(_0x251737,_0x259631,_0xc23310,_0x473d32,_0x21c18a,_0x4d2dd3,_0x25a84f){var _0x15642a={'method':_0xdeff('0x4d'),'uri':'','headers':{'Authorization':_0xdeff('0x35')+_0x251737},'json':!![]};switch(_0x25a84f[_0xdeff('0x4e')]){case'contact_lead':_0x15642a[_0xdeff('0x4f')]='https://www.zohoapis.'+_0x259631+_0xdeff('0x50')+_0x21c18a+'))';return getZohoUser(_0x15642a,_0xdeff('0x51'))[_0xdeff('0x2c')](function(_0x46c428){if(_0x46c428)return _0x46c428;_0x15642a[_0xdeff('0x4f')]=_0xdeff('0x42')+_0x259631+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x21c18a+'))';return getZohoUser(_0x15642a,'Leads')[_0xdeff('0x2c')](function(_0xf91a72){if(_0xf91a72)return _0xf91a72;if(_0x25a84f[_0xdeff('0x44')]!='nothing'){return createEndUser(_0x251737,_0x259631,_0x473d32,_0x21c18a,_0x4d2dd3,_0x25a84f);}else{return{};}});});break;case'contact':_0x15642a[_0xdeff('0x4f')]=_0xdeff('0x42')+_0x259631+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x21c18a+'))';return getZohoUser(_0x15642a,_0xdeff('0x51'))[_0xdeff('0x2c')](function(_0xb84cfa){if(_0xb84cfa)return _0xb84cfa;if(_0x25a84f['moduleCreate']!=_0xdeff('0x52')){return createEndUser(_0x251737,_0x259631,_0x473d32,_0x21c18a,_0x4d2dd3,_0x25a84f);}else{return{};}});break;case _0xdeff('0x53'):_0x15642a[_0xdeff('0x4f')]='https://www.zohoapis.'+_0x259631+_0xdeff('0x54')+_0x21c18a+'))';return getZohoUser(_0x15642a,_0xdeff('0x55'))[_0xdeff('0x2c')](function(_0x23cec3){if(_0x23cec3)return _0x23cec3;if(_0x25a84f[_0xdeff('0x44')]!=_0xdeff('0x52')){return createEndUser(_0x251737,_0x259631,_0x473d32,_0x21c18a,_0x4d2dd3,_0x25a84f);}else{return{};}});break;}}function getCall(_0x2c7fa4,_0x578185,_0x4517d1,_0x1b90a9,_0x5e0c60,_0xe5a773,_0x1b676b,_0x2967b4){logger[_0xdeff('0x32')](_0xdeff('0x56'));var _0xfb097c={};_0xfb097c[_0xdeff('0x57')]={'name':!_[_0xdeff('0x20')](_0x1b90a9['role'][_0xdeff('0x1d')])&&!_[_0xdeff('0x20')](_0x1b90a9[_0xdeff('0x3b')]['name'])&&_0x1b90a9['profile'][_0xdeff('0x1d')]===_0xdeff('0x58')?_0x1b90a9[_0xdeff('0x45')][_0xdeff('0x1d')]:!_[_0xdeff('0x20')](_0x1b90a9[_0xdeff('0x46')])?_0x1b90a9['first_name']+'\x20'+_0x1b90a9['last_name']:_0x1b90a9[_0xdeff('0x47')],'id':_0x1b90a9['id']};_0xfb097c[_0xdeff('0x59')]=intUtil['getString'](_0xe5a773['Subjects'],_0x1b676b,'\x20');_0xfb097c[_0xdeff('0x5a')]=intUtil[_0xdeff('0x5b')](_0xe5a773['Descriptions'],_0x1b676b,'\x0a');if(_0x5e0c60[_0xdeff('0x40')]===_0xdeff('0x51')){_0xfb097c['Who_Id']={'name':!_[_0xdeff('0x20')](_0x5e0c60[_0xdeff('0x5c')])?_0x5e0c60['Full_Name']:!_[_0xdeff('0x20')](_0x5e0c60[_0xdeff('0x5d')])?_0x5e0c60['First_Name']+'\x20'+_0x5e0c60[_0xdeff('0x5e')]:_0x5e0c60[_0xdeff('0x5e')],'id':_0x5e0c60['id']};}if(_0x5e0c60[_0xdeff('0x40')]==='Leads'){_0xfb097c['What_Id']={'name':!_[_0xdeff('0x20')](_0x5e0c60['Full_Name'])?_0x5e0c60[_0xdeff('0x5c')]:!_[_0xdeff('0x20')](_0x5e0c60[_0xdeff('0x5d')])?_0x5e0c60[_0xdeff('0x5d')]+'\x20'+_0x5e0c60[_0xdeff('0x5e')]:_0x5e0c60['Last_Name'],'id':_0x5e0c60['id']};_0xfb097c['$se_module']=_[_0xdeff('0x43')](_0x5e0c60[_0xdeff('0x40')]);}if(_0x1b676b[_0xdeff('0x5f')]){_0xfb097c[_0xdeff('0x60')]=moment[_0xdeff('0x61')](parseInt(_0x1b676b[_0xdeff('0x5f')])*0x3e8)['format'](_0xdeff('0x62'));}else if(_0x1b676b['answertime']&&_0x1b676b[_0xdeff('0x63')]){_0xfb097c[_0xdeff('0x60')]=moment[_0xdeff('0x61')](moment(_0x1b676b[_0xdeff('0x63')],_0xdeff('0x64'))[_0xdeff('0x65')](moment(_0x1b676b[_0xdeff('0x66')],_0xdeff('0x64'))))[_0xdeff('0x67')]('mm:ss');}switch(_0x1b676b[_0xdeff('0x68')]){case'called':_0xfb097c[_0xdeff('0x69')]=_0xdeff('0x6a');break;case'complete':case _0xdeff('0x6b'):_0xfb097c['Call_Result']=_0xdeff('0x6c');break;case'rejected':_0xfb097c['Call_Result']=_0xdeff('0x6d');break;case _0xdeff('0x6e'):_0xfb097c['Call_Result']=_0xdeff('0x6f');break;case _0xdeff('0x70'):_0xfb097c[_0xdeff('0x69')]=_0xdeff('0x71');default:}_0xfb097c[_0xdeff('0x72')]=(_0x2967b4===_0xdeff('0x73')?moment(_0x1b676b[_0xdeff('0x66')])[_0xdeff('0x67')](_0xdeff('0x64')):moment(_0x1b676b['agentcalledAt'])[_0xdeff('0x67')](_0xdeff('0x64')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0xfb097c[_0xdeff('0x74')]=_0x2967b4||_0xdeff('0x75');_0xfb097c=_['merge'](_0xfb097c,getCustomFields(_0xe5a773[_0xdeff('0x76')],_0x1b676b));return request({'method':_0xdeff('0x41'),'uri':_0xdeff('0x42')+_0x578185+_0xdeff('0x77'),'headers':{'Authorization':_0xdeff('0x35')+_0x2c7fa4},'body':{'data':[_0xfb097c]},'json':!![]})[_0xdeff('0x2c')](function(_0xa5f4a0){if(_0xa5f4a0&&_0xa5f4a0[_0xdeff('0x3f')][0x0][_0xdeff('0x48')]===_0xdeff('0x49')){logger['info'](_0xdeff('0x78'));return{'id':_0xa5f4a0[_0xdeff('0x3f')][0x0][_0xdeff('0x4a')]['id']};}})[_0xdeff('0x2e')](function(_0x4539c8){logger['info']('err',_0x4539c8['stack']);console[_0xdeff('0x4c')](_0xdeff('0x79'),_0x4539c8);});}exports[_0xdeff('0x7a')]=function(_0x5e85dc,_0x4ea57d,_0x5c718a,_0x19de80,_0x1a6fbe,_0x46e1d5){var _0x3b67e1,_0x118aa0,_0x19ab0f;_0x46e1d5[_0xdeff('0x7b')]=intUtil[_0xdeff('0x7c')](_0x46e1d5['host']);_0x46e1d5[_0xdeff('0x7d')]=intUtil[_0xdeff('0x7c')](_0x46e1d5[_0xdeff('0x7d')]);if(_0x1a6fbe&&_0x1a6fbe[_0xdeff('0x7e')]){logger[_0xdeff('0x32')](_0xdeff('0x7f'),_0xdeff('0x80'));_0x4ea57d[_0xdeff('0x81')]=_0x46e1d5[_0xdeff('0x7d')]+_0xdeff('0x82')+_0x4ea57d[_0xdeff('0x83')]+_0xdeff('0x84')+md5(_0x4ea57d['uniqueid']);}else{_0x4ea57d[_0xdeff('0x81')]='';}var _0xa46f6c=_0x46e1d5[_0xdeff('0x7b')]==='zoho.eu'?'eu':_0xdeff('0x85');return getAccessToken(_0x46e1d5)[_0xdeff('0x2c')](function(_0x39416){_0x19ab0f=_0x39416;return getUser(_0x19ab0f,_0xa46f6c,_0x46e1d5,_0x19de80[_0xdeff('0x86')]);})['then'](function(_0x2811e5){_0x3b67e1=_0x2811e5;logger[_0xdeff('0x32')]('The\x20User\x20ID\x20is:',_0x3b67e1['id']);return getEndUser(_0x19ab0f,_0xa46f6c,_0x46e1d5,_0x4ea57d[_0xdeff('0x87')],_0x4ea57d[_0xdeff('0x88')],_0x3b67e1,_0x5c718a);})[_0xdeff('0x2c')](function(_0x1cc1d3){_0x118aa0=_0x1cc1d3;return getCall(_0x19ab0f,_0xa46f6c,_0x46e1d5,_0x3b67e1,_0x118aa0,_0x5c718a,_0x4ea57d,_0xdeff('0x75'));})['then'](function(_0x1ee669){if(_0x1ee669){logger[_0xdeff('0x32')](_0xdeff('0x89'),_0x1ee669['id']);logger[_0xdeff('0x32')](_0xdeff('0x7f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdeff('0x67')](_0xdeff('0x8a'),_0x19de80['name']),_0xdeff('0x8b'),{'uri':_0xdeff('0x8c')+_0x46e1d5[_0xdeff('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1ee669['id']});}})[_0xdeff('0x2e')](function(_0xea0d77){logger['error'](_0xdeff('0x7f'),JSON[_0xdeff('0x10')](_0xea0d77));});};exports[_0xdeff('0x73')]=function(_0x18e96c,_0x4cacbd,_0x39e307,_0x3b8f20,_0x14a77f,_0x184cb2,_0x13bc9f){var _0x69e0f9,_0x7b5b7b,_0x3e3fd4;_0x184cb2[_0xdeff('0x7b')]=intUtil['stripTrailingSlash'](_0x184cb2[_0xdeff('0x7b')]);_0x184cb2['serverUrl']=intUtil[_0xdeff('0x7c')](_0x184cb2['serverUrl']);if(_0x13bc9f&&_0x13bc9f['recordingFormat']&&_0x13bc9f[_0xdeff('0x8d')]!==_0xdeff('0x8e')){logger['info'](_0xdeff('0x8f'),_0xdeff('0x80'));_0x4cacbd[_0xdeff('0x81')]=_0x184cb2[_0xdeff('0x7d')]+'/api/voice/recordings/'+_0x4cacbd[_0xdeff('0x83')]+_0xdeff('0x84')+md5(_0x4cacbd['uniqueid']);}var _0x3dca7f=_0x184cb2[_0xdeff('0x7b')]===_0xdeff('0x90')?'eu':_0xdeff('0x85');return getAccessToken(_0x184cb2)[_0xdeff('0x2c')](function(_0x377733){_0x3e3fd4=_0x377733;return getUser(_0x3e3fd4,_0x3dca7f,_0x184cb2,_0x3b8f20[_0xdeff('0x86')]);})[_0xdeff('0x2c')](function(_0x5ada1e){_0x69e0f9=_0x5ada1e;logger['info'](_0xdeff('0x91'),_0x69e0f9['id']);return getEndUser(_0x3e3fd4,_0x3dca7f,_0x184cb2,_0x4cacbd['destcalleridname'],_0x4cacbd[_0xdeff('0x92')],_0x69e0f9,_0x39e307);})[_0xdeff('0x2c')](function(_0x5e9c02){_0x7b5b7b=_0x5e9c02;return getCall(_0x3e3fd4,_0x3dca7f,_0x184cb2,_0x69e0f9,_0x7b5b7b,_0x39e307,_0x4cacbd,_0xdeff('0x93'));})[_0xdeff('0x2c')](function(_0x232d7e){if(_0x232d7e){logger['info'](_0xdeff('0x89'),_0x232d7e['id']);logger[_0xdeff('0x32')](_0xdeff('0x8f'),_0xdeff('0x94'));emit(util['format'](_0xdeff('0x8a'),_0x3b8f20['name']),_0xdeff('0x8b'),{'uri':'https://crm.'+_0x184cb2[_0xdeff('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x232d7e['id']});}})[_0xdeff('0x2e')](function(_0x27c2ce){logger[_0xdeff('0x2f')]('[OUTBOUND]',JSON[_0xdeff('0x10')](_0x27c2ce));});};exports[_0xdeff('0x95')]=function(_0x202682,_0x5491e2,_0x4be90d,_0x4d301d,_0x292681,_0x385903){var _0x94ad85,_0x676ac1,_0x17e961;_0x385903[_0xdeff('0x7b')]=intUtil['stripTrailingSlash'](_0x385903[_0xdeff('0x7b')]);_0x385903[_0xdeff('0x7d')]=intUtil[_0xdeff('0x7c')](_0x385903['serverUrl']);if(_0x292681&&_0x292681['monitor_format']){logger[_0xdeff('0x32')]('['+_0x5491e2[_0xdeff('0x68')]['toUpperCase']()+']',_0xdeff('0x80'));_0x5491e2[_0xdeff('0x81')]=_0x385903[_0xdeff('0x7d')]+_0xdeff('0x82')+_0x5491e2[_0xdeff('0x83')]+_0xdeff('0x84')+md5(_0x5491e2['uniqueid']);}else{_0x5491e2[_0xdeff('0x81')]='';}var _0x186139=_0x385903[_0xdeff('0x7b')]==='zoho.eu'?'eu':_0xdeff('0x85');return getAccessToken(_0x385903)['then'](function(_0x2a555f){_0x17e961=_0x2a555f;return getUser(_0x17e961,_0x186139,_0x385903);})[_0xdeff('0x2c')](function(_0x51caa7){_0x94ad85=_0x51caa7;logger[_0xdeff('0x32')](_0xdeff('0x91'),_0x94ad85['id']);return getEndUser(_0x17e961,_0x186139,_0x385903,_0x5491e2[_0xdeff('0x87')],_0x5491e2['calleridnum'],_0x94ad85,_0x4be90d);})[_0xdeff('0x2c')](function(_0x1046a6){_0x676ac1=_0x1046a6;return getCall(_0x17e961,_0x186139,_0x385903,_0x94ad85,_0x676ac1,_0x4be90d,_0x5491e2,'Inbound');})[_0xdeff('0x2c')](function(_0x14d2db){if(_0x14d2db){logger[_0xdeff('0x32')](_0xdeff('0x89'),_0x14d2db['id']);}})[_0xdeff('0x2e')](function(_0x265e1b){logger[_0xdeff('0x2f')]('['+_0x5491e2['lastevent']['toUpperCase']()+']',JSON[_0xdeff('0x10')](_0x265e1b));});}; \ No newline at end of file +var _0xb903=['uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','connect','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','stack','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','user:%s','unmanaged','monitor_format','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','forEach','string','picklist','type','content','variable','variableName','idField','toString','customVariable','name','toLowerCase','Variable','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','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','Administrator','user','profile','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','CREATE\x20ERROR'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb903,0x185));var _0x3b90=function(_0x18cff0,_0x2bef42){_0x18cff0=_0x18cff0-0x0;var _0x5bf0ff=_0xb903[_0x18cff0];return _0x5bf0ff;};'use strict';var _=require(_0x3b90('0x0'));var rp=require(_0x3b90('0x1'));var md5=require(_0x3b90('0x2'));var util=require(_0x3b90('0x3'));var intUtil=require('./util');var moment=require(_0x3b90('0x4'));var Redis=require(_0x3b90('0x5'));var BPromise=require(_0x3b90('0x6'));var config=require(_0x3b90('0x7'));var logger=require(_0x3b90('0x8'))(_0x3b90('0x9'));config[_0x3b90('0xa')]=_['defaults'](config[_0x3b90('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b90('0xa')]));function emit(_0x2e4c06,_0x42efe8,_0x1b1fbf){io['to'](_0x2e4c06)['emit'](_0x42efe8,_0x1b1fbf);}function request(_0x5cda1d){logger['debug']('[HTTP]',JSON['stringify'](_0x5cda1d));return rp(_0x5cda1d);}function getCustomFields(_0x55db3f,_0x336913){var _0x5af39c={};if(_0x55db3f['length']>0x0){_[_0x3b90('0xb')](_0x55db3f,function(_0x233509){if(_['includes']([_0x3b90('0xc'),_0x3b90('0xd')],_0x233509[_0x3b90('0xe')])&&_0x233509['idField']){_0x5af39c[_0x233509['idField']]=_0x233509[_0x3b90('0xf')]['toString']();}else if(_0x233509['type']===_0x3b90('0x10')&&_0x233509[_0x3b90('0x11')]&&_0x233509['idField']&&_0x336913[_0x233509['variableName']]){_0x5af39c[_0x233509[_0x3b90('0x12')]]=_0x336913[_0x233509[_0x3b90('0x11')]][_0x3b90('0x13')]();}else if(_0x233509[_0x3b90('0xe')]===_0x3b90('0x14')&&_0x233509['Variable']&&_0x233509['Variable'][_0x3b90('0x15')]&&_0x233509[_0x3b90('0x12')]&&_0x336913[_0x233509['Variable'][_0x3b90('0x15')][_0x3b90('0x16')]()]){_0x5af39c[_0x233509[_0x3b90('0x12')]]=_0x336913[_0x233509[_0x3b90('0x17')]['name'][_0x3b90('0x16')]()]['toString']();}});}return _0x5af39c;}function getName(_0xd8d873){if(_0xd8d873[_0x3b90('0x18')]('\x20')>0x0){var _0x535894=_0xd8d873[_0x3b90('0x19')](/ (.+)/);if(_0x535894[0x1]){return _0x535894;}}return[_0xd8d873,_0xd8d873];}var accountsTokens={};function getAccessToken(_0x12e1cf){return new Promise(function(_0x3642c0,_0x3ce411){if(!_[_0x3b90('0x1a')](accountsTokens[_0x12e1cf['id']])&&!_[_0x3b90('0x1a')](accountsTokens[_0x12e1cf['id']][_0x3b90('0x1b')])){if(moment()[_0x3b90('0x1c')](accountsTokens[_0x12e1cf['id']][_0x3b90('0x1d')])){_0x3642c0(accountsTokens[_0x12e1cf['id']][_0x3b90('0x1b')]);}}var _0x4e2175;switch(_0x12e1cf[_0x3b90('0x1e')]){case'US':_0x4e2175=_0x3b90('0x1f');break;case'AU':_0x4e2175=_0x3b90('0x20');break;case'EU':_0x4e2175=_0x3b90('0x21');break;case'IN':_0x4e2175=_0x3b90('0x22');break;case'CN':_0x4e2175=_0x3b90('0x23');break;default:_0x4e2175='https://accounts.zoho.eu';break;}var _0x4b308c={'method':_0x3b90('0x24'),'uri':_0x4e2175+_0x3b90('0x25'),'qs':{'refresh_token':_0x12e1cf[_0x3b90('0x26')],'client_id':_0x12e1cf[_0x3b90('0x27')],'client_secret':_0x12e1cf['clientSecret'],'grant_type':_0x3b90('0x28')},'json':!![]};return rp(_0x4b308c)[_0x3b90('0x29')](function(_0x1787d1){accountsTokens[_0x12e1cf['id']]={'access_token':_0x1787d1['access_token'],'expires_in':moment()[_0x3b90('0x2a')](_0x1787d1[_0x3b90('0x1d')],_0x3b90('0x2b'))};_0x3642c0(_0x1787d1[_0x3b90('0x1b')]);})[_0x3b90('0x2c')](function(_0x7adf75){logger['error'](_0x3b90('0x2d'),_0x7adf75['stack']);_0x3ce411(_0x7adf75);});});}function getUser(_0xaf453c,_0x9891e4,_0x1a193e,_0x38eed0){logger[_0x3b90('0x2e')](_0x3b90('0x2f'));return request({'method':_0x3b90('0x30'),'uri':util[_0x3b90('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x9891e4),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x3b90('0x32')+_0xaf453c},'json':!![]})[_0x3b90('0x29')](function(_0x23484a){if(_0x23484a[_0x3b90('0x33')]){var _0x522ede=-0x1;if(_['isArrayLikeObject'](_0x23484a[_0x3b90('0x33')])){if(!_[_0x3b90('0x1a')](_0x38eed0)){_0x522ede=_[_0x3b90('0x34')](_0x23484a['users'],function(_0x41bd39){return _0x41bd39['email']===_0x38eed0;});}if(_0x522ede>=0x0){logger['info'](_0x3b90('0x35'));}else{logger[_0x3b90('0x2e')]('Using\x20the\x20admin\x20account!');_0x522ede=_[_0x3b90('0x34')](_0x23484a[_0x3b90('0x33')],function(_0x3e30b8){return _0x3e30b8['profile']['name']===_0x3b90('0x36');});}return _0x23484a[_0x3b90('0x33')][_0x522ede];}else{if(_0x23484a[_0x3b90('0x37')][_0x3b90('0x38')]['name']==='Administrator'){logger[_0x3b90('0x2e')](_0x3b90('0x39'));user=_0x23484a['user'];return user;}else{logger['error'](_0x3b90('0x3a'),JSON[_0x3b90('0x3b')](_0x23484a));throw new Error(_0x3b90('0x3c')+JSON[_0x3b90('0x3b')](_0x23484a));}}}else{logger['error'](_0x3b90('0x3a'),JSON['stringify'](_0x23484a));throw new Error(_0x3b90('0x3c')+JSON[_0x3b90('0x3b')](_0x23484a));}})[_0x3b90('0x2c')](function(_0x20abf8){console[_0x3b90('0x3d')](_0x20abf8);});}function getZohoUser(_0x3bf148,_0x96f7f3){return new BPromise(function(_0x534bea,_0x17aeb8){request(_0x3bf148)[_0x3b90('0x29')](function(_0x2fd30c){var _0x303922=null;if(_0x2fd30c){_0x303922=_0x2fd30c[_0x3b90('0x3e')][0x0];_0x303922[_0x3b90('0x3f')]=_0x96f7f3;}_0x534bea(_0x303922);})[_0x3b90('0x2c')](function(_0x3b6194){_0x17aeb8(_0x3b6194);});});}function createEndUser(_0x356e14,_0x5063b9,_0x369d0d,_0x1b915d,_0x40ce3a,_0x23cf0f){var _0x369d0d=getName(_0x369d0d);return request({'method':_0x3b90('0x24'),'uri':_0x3b90('0x40')+_0x5063b9+_0x3b90('0x41')+_[_0x3b90('0x42')](_0x23cf0f[_0x3b90('0x43')])+'s','body':{'data':[{'Last_Name':_0x369d0d[0x1],'First_Name':_0x369d0d[0x0],'Phone':_0x1b915d,'Owner':{'name':!_[_0x3b90('0x1a')](_0x40ce3a[_0x3b90('0x44')][_0x3b90('0x15')])?_0x40ce3a[_0x3b90('0x44')][_0x3b90('0x15')]:!_[_0x3b90('0x1a')](_0x40ce3a[_0x3b90('0x45')])?_0x40ce3a[_0x3b90('0x45')]+'\x20'+_0x40ce3a[_0x3b90('0x46')]:_0x40ce3a[_0x3b90('0x46')],'id':_0x40ce3a['id']}}]},'headers':{'Authorization':_0x3b90('0x32')+_0x356e14},'json':!![]})['then'](function(_0x28d70b){if(_0x28d70b&&_0x28d70b[_0x3b90('0x3e')][0x0][_0x3b90('0x47')]===_0x3b90('0x48')){var _0x5a48a9=_0x28d70b[_0x3b90('0x3e')][0x0]['details'];_0x5a48a9['enduserType']=_[_0x3b90('0x42')](_0x23cf0f[_0x3b90('0x43')])+'s';return _0x5a48a9;}logger['error'](_0x3b90('0x3a'),JSON[_0x3b90('0x3b')](data));throw new Error(_0x3b90('0x49')+JSON[_0x3b90('0x3b')](data));})[_0x3b90('0x2c')](function(_0x3fd5a1){console[_0x3b90('0x4a')](_0x3b90('0x4b'),_0x3fd5a1);});}function getEndUser(_0x28882e,_0x59b693,_0x3f71b0,_0x2e8a90,_0x4df41c,_0x1e9a21,_0x12e061){var _0x335c55={'method':_0x3b90('0x30'),'uri':'','headers':{'Authorization':_0x3b90('0x32')+_0x28882e},'json':!![]};switch(_0x12e061['moduleSearch']){case'contact_lead':_0x335c55[_0x3b90('0x4c')]='https://www.zohoapis.'+_0x59b693+_0x3b90('0x4d')+_0x4df41c+'))';return getZohoUser(_0x335c55,_0x3b90('0x4e'))[_0x3b90('0x29')](function(_0x27d0a8){if(_0x27d0a8)return _0x27d0a8;_0x335c55[_0x3b90('0x4c')]='https://www.zohoapis.'+_0x59b693+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4df41c+'))';return getZohoUser(_0x335c55,_0x3b90('0x4f'))[_0x3b90('0x29')](function(_0x9e2ee5){if(_0x9e2ee5)return _0x9e2ee5;if(_0x12e061['moduleCreate']!=_0x3b90('0x50')){return createEndUser(_0x28882e,_0x59b693,_0x2e8a90,_0x4df41c,_0x1e9a21,_0x12e061);}else{return{};}});});break;case _0x3b90('0x51'):_0x335c55[_0x3b90('0x4c')]=_0x3b90('0x40')+_0x59b693+_0x3b90('0x4d')+_0x4df41c+'))';return getZohoUser(_0x335c55,_0x3b90('0x4e'))[_0x3b90('0x29')](function(_0x13b364){if(_0x13b364)return _0x13b364;if(_0x12e061[_0x3b90('0x43')]!='nothing'){return createEndUser(_0x28882e,_0x59b693,_0x2e8a90,_0x4df41c,_0x1e9a21,_0x12e061);}else{return{};}});break;case _0x3b90('0x52'):_0x335c55[_0x3b90('0x4c')]=_0x3b90('0x40')+_0x59b693+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4df41c+'))';return getZohoUser(_0x335c55,_0x3b90('0x4f'))['then'](function(_0x288fbb){if(_0x288fbb)return _0x288fbb;if(_0x12e061[_0x3b90('0x43')]!=_0x3b90('0x50')){return createEndUser(_0x28882e,_0x59b693,_0x2e8a90,_0x4df41c,_0x1e9a21,_0x12e061);}else{return{};}});break;}}function getCall(_0x56f95d,_0x2a3fe8,_0x1ec976,_0x5334b5,_0x499ec1,_0x9ff1f4,_0x24337e,_0x1eb16e){logger[_0x3b90('0x2e')]('Creating\x20new\x20call...');var _0x5ee7e2={};_0x5ee7e2[_0x3b90('0x53')]={'name':!_[_0x3b90('0x1a')](_0x5334b5[_0x3b90('0x44')][_0x3b90('0x15')])&&!_[_0x3b90('0x1a')](_0x5334b5[_0x3b90('0x38')][_0x3b90('0x15')])&&_0x5334b5[_0x3b90('0x38')][_0x3b90('0x15')]==='administrator'?_0x5334b5[_0x3b90('0x44')][_0x3b90('0x15')]:!_['isNil'](_0x5334b5[_0x3b90('0x45')])?_0x5334b5[_0x3b90('0x45')]+'\x20'+_0x5334b5['last_name']:_0x5334b5[_0x3b90('0x46')],'id':_0x5334b5['id']};_0x5ee7e2[_0x3b90('0x54')]=intUtil[_0x3b90('0x55')](_0x9ff1f4[_0x3b90('0x56')],_0x24337e,'\x20');_0x5ee7e2[_0x3b90('0x57')]=intUtil[_0x3b90('0x55')](_0x9ff1f4[_0x3b90('0x58')],_0x24337e,'\x0a');if(_0x499ec1['enduserType']===_0x3b90('0x4e')){_0x5ee7e2[_0x3b90('0x59')]={'name':!_[_0x3b90('0x1a')](_0x499ec1[_0x3b90('0x5a')])?_0x499ec1[_0x3b90('0x5a')]:!_[_0x3b90('0x1a')](_0x499ec1[_0x3b90('0x5b')])?_0x499ec1[_0x3b90('0x5b')]+'\x20'+_0x499ec1[_0x3b90('0x5c')]:_0x499ec1[_0x3b90('0x5c')],'id':_0x499ec1['id']};}if(_0x499ec1[_0x3b90('0x3f')]===_0x3b90('0x4f')){_0x5ee7e2[_0x3b90('0x5d')]={'name':!_[_0x3b90('0x1a')](_0x499ec1[_0x3b90('0x5a')])?_0x499ec1['Full_Name']:!_[_0x3b90('0x1a')](_0x499ec1['First_Name'])?_0x499ec1[_0x3b90('0x5b')]+'\x20'+_0x499ec1[_0x3b90('0x5c')]:_0x499ec1[_0x3b90('0x5c')],'id':_0x499ec1['id']};_0x5ee7e2[_0x3b90('0x5e')]=_[_0x3b90('0x42')](_0x499ec1[_0x3b90('0x3f')]);}if(_0x24337e['talktime']){_0x5ee7e2[_0x3b90('0x5f')]=moment[_0x3b90('0x60')](parseInt(_0x24337e[_0x3b90('0x61')])*0x3e8)[_0x3b90('0x31')](_0x3b90('0x62'));}else if(_0x24337e[_0x3b90('0x63')]&&_0x24337e['endtime']){_0x5ee7e2[_0x3b90('0x5f')]=moment[_0x3b90('0x60')](moment(_0x24337e[_0x3b90('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x3b90('0x65')](moment(_0x24337e[_0x3b90('0x66')],_0x3b90('0x67'))))[_0x3b90('0x31')](_0x3b90('0x62'));}switch(_0x24337e[_0x3b90('0x68')]){case _0x3b90('0x69'):_0x5ee7e2[_0x3b90('0x6a')]=_0x3b90('0x6b');break;case'complete':case _0x3b90('0x6c'):_0x5ee7e2['Call_Result']='Answered';break;case _0x3b90('0x6d'):_0x5ee7e2[_0x3b90('0x6a')]='Rejected';break;case _0x3b90('0x6e'):_0x5ee7e2[_0x3b90('0x6a')]=_0x3b90('0x6f');break;case _0x3b90('0x70'):_0x5ee7e2[_0x3b90('0x6a')]=_0x3b90('0x71');default:}_0x5ee7e2[_0x3b90('0x72')]=(_0x1eb16e==='outbound'?moment(_0x24337e['starttime'])[_0x3b90('0x31')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x24337e[_0x3b90('0x73')])['format'](_0x3b90('0x67')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x5ee7e2['Call_Type']=_0x1eb16e||_0x3b90('0x74');_0x5ee7e2=_[_0x3b90('0x75')](_0x5ee7e2,getCustomFields(_0x9ff1f4[_0x3b90('0x76')],_0x24337e));return request({'method':_0x3b90('0x24'),'uri':_0x3b90('0x40')+_0x2a3fe8+_0x3b90('0x77'),'headers':{'Authorization':_0x3b90('0x32')+_0x56f95d},'body':{'data':[_0x5ee7e2]},'json':!![]})['then'](function(_0x5acf97){if(_0x5acf97&&_0x5acf97['data'][0x0][_0x3b90('0x47')]===_0x3b90('0x48')){logger['info'](_0x3b90('0x78'));return{'id':_0x5acf97[_0x3b90('0x3e')][0x0][_0x3b90('0x79')]['id']};}})[_0x3b90('0x2c')](function(_0x468ddb){logger[_0x3b90('0x2e')](_0x3b90('0x7a'),_0x468ddb[_0x3b90('0x7b')]);console[_0x3b90('0x4a')]('err',_0x468ddb);});}exports[_0x3b90('0x7c')]=function(_0x55dddd,_0x2bbbac,_0x2ddd93,_0x4b2c0f,_0x5b34f5,_0x389989){var _0x4337f0,_0x3f0f85,_0x2318d;_0x389989[_0x3b90('0x7d')]=intUtil[_0x3b90('0x7e')](_0x389989['host']);_0x389989[_0x3b90('0x7f')]=intUtil[_0x3b90('0x7e')](_0x389989[_0x3b90('0x7f')]);if(_0x5b34f5&&_0x5b34f5['monitor_format']){logger[_0x3b90('0x2e')]('[QUEUE]',_0x3b90('0x80'));_0x2bbbac[_0x3b90('0x81')]=_0x389989[_0x3b90('0x7f')]+_0x3b90('0x82')+_0x2bbbac[_0x3b90('0x83')]+_0x3b90('0x84')+md5(_0x2bbbac['uniqueid']);}else{_0x2bbbac[_0x3b90('0x81')]='';}var _0x230567=_0x389989[_0x3b90('0x7d')]===_0x3b90('0x85')?'eu':_0x3b90('0x86');return getAccessToken(_0x389989)[_0x3b90('0x29')](function(_0x23678f){_0x2318d=_0x23678f;return getUser(_0x2318d,_0x230567,_0x389989,_0x4b2c0f[_0x3b90('0x87')]);})['then'](function(_0x5f6bf9){_0x4337f0=_0x5f6bf9;logger[_0x3b90('0x2e')](_0x3b90('0x88'),_0x4337f0['id']);return getEndUser(_0x2318d,_0x230567,_0x389989,_0x2bbbac[_0x3b90('0x89')],_0x2bbbac[_0x3b90('0x8a')],_0x4337f0,_0x2ddd93);})[_0x3b90('0x29')](function(_0x1af213){_0x3f0f85=_0x1af213;return getCall(_0x2318d,_0x230567,_0x389989,_0x4337f0,_0x3f0f85,_0x2ddd93,_0x2bbbac,_0x3b90('0x74'));})['then'](function(_0x5b2469){if(_0x5b2469){logger[_0x3b90('0x2e')](_0x3b90('0x8b'),_0x5b2469['id']);logger[_0x3b90('0x2e')]('[QUEUE]',_0x3b90('0x8c'));emit(util['format']('user:%s',_0x4b2c0f[_0x3b90('0x15')]),_0x3b90('0x8d'),{'uri':_0x3b90('0x8e')+_0x389989[_0x3b90('0x7d')]+_0x3b90('0x8f')+_0x5b2469['id']});}})[_0x3b90('0x2c')](function(_0xb6678a){logger[_0x3b90('0x3d')](_0x3b90('0x90'),JSON[_0x3b90('0x3b')](_0xb6678a));});};exports[_0x3b90('0x91')]=function(_0x3a0a51,_0x2e621a,_0x241d6e,_0x122525,_0x4e8614,_0x212aa4,_0x98d7b0){var _0x4ea0b7,_0x2fa1ed,_0x47a50b;_0x212aa4[_0x3b90('0x7d')]=intUtil[_0x3b90('0x7e')](_0x212aa4[_0x3b90('0x7d')]);_0x212aa4['serverUrl']=intUtil[_0x3b90('0x7e')](_0x212aa4[_0x3b90('0x7f')]);if(_0x98d7b0&&_0x98d7b0[_0x3b90('0x92')]&&_0x98d7b0[_0x3b90('0x92')]!==_0x3b90('0x93')){logger[_0x3b90('0x2e')](_0x3b90('0x94'),_0x3b90('0x80'));_0x2e621a[_0x3b90('0x81')]=_0x212aa4[_0x3b90('0x7f')]+_0x3b90('0x82')+_0x2e621a[_0x3b90('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x2e621a['uniqueid']);}var _0x497ea7=_0x212aa4[_0x3b90('0x7d')]===_0x3b90('0x85')?'eu':_0x3b90('0x86');return getAccessToken(_0x212aa4)[_0x3b90('0x29')](function(_0x156ffd){_0x47a50b=_0x156ffd;return getUser(_0x47a50b,_0x497ea7,_0x212aa4,_0x122525[_0x3b90('0x87')]);})[_0x3b90('0x29')](function(_0x3472c8){_0x4ea0b7=_0x3472c8;logger[_0x3b90('0x2e')](_0x3b90('0x88'),_0x4ea0b7['id']);return getEndUser(_0x47a50b,_0x497ea7,_0x212aa4,_0x2e621a[_0x3b90('0x95')],_0x2e621a['destcalleridnum'],_0x4ea0b7,_0x241d6e);})['then'](function(_0x405f12){_0x2fa1ed=_0x405f12;return getCall(_0x47a50b,_0x497ea7,_0x212aa4,_0x4ea0b7,_0x2fa1ed,_0x241d6e,_0x2e621a,_0x3b90('0x96'));})[_0x3b90('0x29')](function(_0x1dc7e8){if(_0x1dc7e8){logger[_0x3b90('0x2e')](_0x3b90('0x8b'),_0x1dc7e8['id']);logger[_0x3b90('0x2e')](_0x3b90('0x94'),_0x3b90('0x8c'));emit(util[_0x3b90('0x31')](_0x3b90('0x97'),_0x122525[_0x3b90('0x15')]),_0x3b90('0x8d'),{'uri':_0x3b90('0x8e')+_0x212aa4[_0x3b90('0x7d')]+_0x3b90('0x8f')+_0x1dc7e8['id']});}})[_0x3b90('0x2c')](function(_0x4603c9){logger['error'](_0x3b90('0x94'),JSON[_0x3b90('0x3b')](_0x4603c9));});};exports[_0x3b90('0x98')]=function(_0x34fdf0,_0x22d7cb,_0x5558f7,_0x27d58d,_0x3148c0,_0x320fc2){var _0x2f5dc0,_0x38af7a,_0x38076d;_0x320fc2['host']=intUtil[_0x3b90('0x7e')](_0x320fc2['host']);_0x320fc2['serverUrl']=intUtil[_0x3b90('0x7e')](_0x320fc2[_0x3b90('0x7f')]);if(_0x3148c0&&_0x3148c0[_0x3b90('0x99')]){logger[_0x3b90('0x2e')]('['+_0x22d7cb[_0x3b90('0x68')]['toUpperCase']()+']',_0x3b90('0x80'));_0x22d7cb[_0x3b90('0x81')]=_0x320fc2[_0x3b90('0x7f')]+_0x3b90('0x82')+_0x22d7cb[_0x3b90('0x83')]+_0x3b90('0x84')+md5(_0x22d7cb[_0x3b90('0x83')]);}else{_0x22d7cb[_0x3b90('0x81')]='';}var _0x2c2e24=_0x320fc2[_0x3b90('0x7d')]===_0x3b90('0x85')?'eu':_0x3b90('0x86');return getAccessToken(_0x320fc2)[_0x3b90('0x29')](function(_0x313b07){_0x38076d=_0x313b07;return getUser(_0x38076d,_0x2c2e24,_0x320fc2);})[_0x3b90('0x29')](function(_0x1af0ea){_0x2f5dc0=_0x1af0ea;logger['info'](_0x3b90('0x88'),_0x2f5dc0['id']);return getEndUser(_0x38076d,_0x2c2e24,_0x320fc2,_0x22d7cb[_0x3b90('0x89')],_0x22d7cb[_0x3b90('0x8a')],_0x2f5dc0,_0x5558f7);})[_0x3b90('0x29')](function(_0x23d3b6){_0x38af7a=_0x23d3b6;return getCall(_0x38076d,_0x2c2e24,_0x320fc2,_0x2f5dc0,_0x38af7a,_0x5558f7,_0x22d7cb,_0x3b90('0x74'));})['then'](function(_0x39f02f){if(_0x39f02f){logger[_0x3b90('0x2e')](_0x3b90('0x8b'),_0x39f02f['id']);}})[_0x3b90('0x2c')](function(_0x1ae34b){logger['error']('['+_0x22d7cb[_0x3b90('0x68')][_0x3b90('0x9a')]()+']',JSON[_0x3b90('0x3b')](_0x1ae34b));});}; \ 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 90a8a42..18cdbda 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(_0x5f3505,_0x37eeb5){var _0x35a2a9=function(_0x17a526){while(--_0x17a526){_0x5f3505['push'](_0x5f3505['shift']());}};_0x35a2a9(++_0x37eeb5);}(_0x7a54,0x106));var _0x47a5=function(_0x597559,_0x43ea69){_0x597559=_0x597559-0x0;var _0x3e4760=_0x7a54[_0x597559];return _0x3e4760;};'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(_0x2d85d4,_0x2741b2){var _0x4c85d6=function(_0x14ca5c){while(--_0x14ca5c){_0x2d85d4['push'](_0x2d85d4['shift']());}};_0x4c85d6(++_0x2741b2);}(_0x7a54,0x106));var _0x47a5=function(_0x441391,_0x6d788b){_0x441391=_0x441391-0x0;var _0x2a44c2=_0x7a54[_0x441391];return _0x2a44c2;};'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 d7d6c0c..5be4f7f 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 _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(_0xce06a0,_0x1f2883){var _0x1c7647=function(_0x5b977a){while(--_0x5b977a){_0xce06a0['push'](_0xce06a0['shift']());}};_0x1c7647(++_0x1f2883);}(_0x7a54,0x106));var _0x47a5=function(_0x4b7a3b,_0x4ff6ce){_0x4b7a3b=_0x4b7a3b-0x0;var _0x10188d=_0x7a54[_0x4b7a3b];return _0x10188d;};'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 +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x9ee656,_0x26a40e){var _0x3b50d3=function(_0x3d1d21){while(--_0x3d1d21){_0x9ee656['push'](_0x9ee656['shift']());}};_0x3b50d3(++_0x26a40e);}(_0xb10b,0x12a));var _0xbb10=function(_0x22789a,_0x4a1c8c){_0x22789a=_0x22789a-0x0;var _0xede88=_0xb10b[_0x22789a];return _0xede88;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index eddc096..b33a147 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 _0x4f29=['exports','bluebird','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result','catch'];(function(_0x275dc3,_0x9ab43){var _0xb57494=function(_0x160841){while(--_0x160841){_0x275dc3['push'](_0x275dc3['shift']());}};_0xb57494(++_0x9ab43);}(_0x4f29,0xfd));var _0x94f2=function(_0x537235,_0x47706b){_0x537235=_0x537235-0x0;var _0x31aa62=_0x4f29[_0x537235];return _0x31aa62;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x94f2('0x0'));var logger=require(_0x94f2('0x1'))(_0x94f2('0x2'));var client=jayson[_0x94f2('0x3')][_0x94f2('0x4')]({'port':0x2329});client[_0x94f2('0x5')]=function(_0x338fe2,_0x2a6535){return new BPromise(function(_0x106798,_0x4edf68){return client[_0x94f2('0x6')](_0x338fe2,_0x2a6535)['then'](function(_0x5e9216){logger[_0x94f2('0x7')](_0x94f2('0x8'),_0x94f2('0x2'),_0x338fe2,_0x2a6535,_0x5e9216);if(_0x5e9216[_0x94f2('0x9')]){logger[_0x94f2('0x9')]('rpc','routing',_0x338fe2,_0x5e9216['error'][_0x94f2('0xa')],_0x2a6535);return _0x4edf68(_0x5e9216['error'][_0x94f2('0xa')]);}else{return _0x106798(_0x5e9216[_0x94f2('0xb')]);}})[_0x94f2('0xc')](function(_0x117396){logger['error'](_0x94f2('0x8'),_0x94f2('0x2'),_0x338fe2,_0x117396,_0x2a6535);return _0x4edf68(_0x117396);});});};module[_0x94f2('0xd')]=client; \ No newline at end of file +var _0x544f=['then','debug','rpc','error','message','catch','exports','jayson/promise','routing','client','http','Request','request'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x544f,0x14c));var _0xf544=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x544f[_0x30bd4d];return _0x306915;};'use strict';var jayson=require(_0xf544('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xf544('0x1'));var client=jayson[_0xf544('0x2')][_0xf544('0x3')]({'port':0x2329});client[_0xf544('0x4')]=function(_0x5ef358,_0x3aedf9){return new BPromise(function(_0x42f20a,_0x599d96){return client[_0xf544('0x5')](_0x5ef358,_0x3aedf9)[_0xf544('0x6')](function(_0x48029d){logger[_0xf544('0x7')](_0xf544('0x8'),_0xf544('0x1'),_0x5ef358,_0x3aedf9,_0x48029d);if(_0x48029d['error']){logger[_0xf544('0x9')]('rpc',_0xf544('0x1'),_0x5ef358,_0x48029d['error'][_0xf544('0xa')],_0x3aedf9);return _0x599d96(_0x48029d['error'][_0xf544('0xa')]);}else{return _0x42f20a(_0x48029d['result']);}})[_0xf544('0xb')](function(_0x166f77){logger[_0xf544('0x9')](_0xf544('0x8'),_0xf544('0x1'),_0x5ef358,_0x166f77,_0x3aedf9);return _0x599d96(_0x166f77);});});};module[_0xf544('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 32dfee3..d5095cf 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 _0xe3a2=['loginMailFrequency','catch','bluebird','./server','./realtime','./lib/email','./rpc/setting','then','getMailAccounts','listen','getSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3a2,0x14c));var _0x2e3a=function(_0x137815,_0x78dd4b){_0x137815=_0x137815-0x0;var _0x29ded1=_0xe3a2[_0x137815];return _0x29ded1;};'use strict';var BPromise=require(_0x2e3a('0x0'));var server=require(_0x2e3a('0x1'));var Realtime=require(_0x2e3a('0x2'));var EmailChannel=require(_0x2e3a('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x2e3a('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x2e3a('0x5')](mailAccount[_0x2e3a('0x6')]())[_0x2e3a('0x5')](realtime['initMailAccounts']())[_0x2e3a('0x5')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2e3a('0x7')](realtime,email)[_0x2e3a('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0x2e3a('0x8')]();})['then'](function(_0x4c1bf0){return setInterval(initRealtime,_0x4c1bf0[_0x2e3a('0x9')]*0x3e8);})[_0x2e3a('0xa')](function(_0x24ae66){console['log'](_0x24ae66);});}main(); \ No newline at end of file +var _0xf0fa=['getSettings','loginMailFrequency','catch','./rpc/mailAccount','./rpc/setting','resolve','getMailAccounts','initMailAccounts','refresh','mailAccounts','then'];(function(_0x1daac8,_0x2027e8){var _0x40072e=function(_0x197761){while(--_0x197761){_0x1daac8['push'](_0x1daac8['shift']());}};_0x40072e(++_0x2027e8);}(_0xf0fa,0x1d1));var _0xaf0f=function(_0xcf20d2,_0x31dda8){_0xcf20d2=_0xcf20d2-0x0;var _0x43fabb=_0xf0fa[_0xcf20d2];return _0x43fabb;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0xaf0f('0x0'));var setting=require(_0xaf0f('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xaf0f('0x2')]()['then'](mailAccount[_0xaf0f('0x3')]())['then'](realtime[_0xaf0f('0x4')]())['then'](function(){email[_0xaf0f('0x5')](realtime[_0xaf0f('0x6')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xaf0f('0x7')](function(){return setting[_0xaf0f('0x8')]();})[_0xaf0f('0x7')](function(_0x430a32){return setInterval(initRealtime,_0x430a32[_0xaf0f('0x9')]*0x3e8);})[_0xaf0f('0xa')](function(_0x2ede46){console['log'](_0x2ede46);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1c37415..5a2e929 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 _0x4018=['then','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','ioredis','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','md5','refresh','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','handleImapError','connected','messages','handleImapEmail','firstName','from','notify'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x4018,0x186));var _0x8401=function(_0x58af75,_0x1a6a22){_0x58af75=_0x58af75-0x0;var _0x32a5ad=_0x4018[_0x58af75];return _0x32a5ad;};'use strict';var _=require(_0x8401('0x0'));var moment=require(_0x8401('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x8401('0x2'));var config=require('../../../config/environment');var logger=require(_0x8401('0x3'))(_0x8401('0x4'));config[_0x8401('0x5')]=_[_0x8401('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8401('0x7'))(new Redis(config[_0x8401('0x5')]));var EmailImap=require(_0x8401('0x8'));var EmailSmtp=require(_0x8401('0x9'));var mailAccount=require(_0x8401('0xa'));var md5Accounts={};function EmailChannel(_0x13cb5f){logger[_0x8401('0xb')](_0x8401('0xc'));this[_0x8401('0xd')]=_0x13cb5f[_0x8401('0xd')];this[_0x8401('0xe')]={};this[_0x8401('0xf')]=new EmailSmtp();}EmailChannel[_0x8401('0x10')][_0x8401('0x11')]=function(_0x4a56c4){var _0x38a73f=this['mailAccounts'][_0x4a56c4];var _0x1a993b={'id':_0x38a73f['id'],'name':_0x38a73f[_0x8401('0x12')],'key':_0x38a73f[_0x8401('0x13')],'active':_0x38a73f[_0x8401('0x14')],'Imap':{'status':_0x38a73f['Imap'][_0x8401('0x15')],'messageStatus':_0x38a73f[_0x8401('0x16')][_0x8401('0x17')],'total':_0x38a73f[_0x8401('0x16')][_0x8401('0x18')]}};if(_[_0x8401('0x19')](md5Accounts[_0x4a56c4])){md5Accounts[_0x4a56c4]={};}var _0x5e1b37=md5(JSON[_0x8401('0x1a')](_0x1a993b));if(md5Accounts[_0x4a56c4][_0x8401('0x1b')]!==_0x5e1b37){md5Accounts[_0x4a56c4][_0x8401('0x1b')]=_0x5e1b37;io[_0x8401('0x11')]('mailAccount:update',_0x1a993b);}};EmailChannel[_0x8401('0x10')][_0x8401('0x1c')]=function(_0x390279){for(var _0x2e0943 in _0x390279){if(_0x390279[_0x8401('0x1d')](_0x2e0943)){if(_0x390279[_0x2e0943][_0x8401('0x16')]&&_0x390279[_0x2e0943][_0x8401('0x14')]){var _0x2ae802=_0x390279[_0x2e0943]['Imap'];if(!this['imapAccounts']['hasOwnProperty'](_0x2ae802['id'])){this['imapAccounts'][_0x2ae802['id']]=new EmailImap(_0x2ae802,_0x390279[_0x2e0943][_0x8401('0x4')]);this[_0x8401('0xe')][_0x2ae802['id']]['on'](_0x8401('0x1e'),this[_0x8401('0x1f')][_0x8401('0x20')](this,_0x2e0943));this[_0x8401('0xe')][_0x2ae802['id']]['on'](_0x8401('0x4'),this['handleImapEmail'][_0x8401('0x20')](this,_0x2e0943));this[_0x8401('0xe')][_0x2ae802['id']]['on'](_0x8401('0x21'),this[_0x8401('0x22')][_0x8401('0x20')](this,_0x2e0943));this[_0x8401('0xe')][_0x2ae802['id']]['on']('error',this[_0x8401('0x23')][_0x8401('0x20')](this,_0x2e0943));}}else{if(_[_0x8401('0x19')](this[_0x8401('0xd')][_0x2e0943][_0x8401('0x16')])){this[_0x8401('0xd')][_0x2e0943][_0x8401('0x16')]={};}this[_0x8401('0xd')][_0x2e0943]['Imap'][_0x8401('0x15')]='disabled';this['mailAccounts'][_0x2e0943][_0x8401('0x16')][_0x8401('0x17')]='';this['emit'](_0x2e0943);}}}};EmailChannel['prototype']['handleImapBox']=function(_0xfe8a0d,_0x5b490d){if(this[_0x8401('0xd')][_0xfe8a0d]){this['mailAccounts'][_0xfe8a0d]['Imap'][_0x8401('0x15')]=_0x8401('0x24');this['mailAccounts'][_0xfe8a0d][_0x8401('0x16')][_0x8401('0x17')]=_0x5b490d['name'];if(_0x5b490d[_0x8401('0x25')]){this[_0x8401('0xd')][_0xfe8a0d][_0x8401('0x16')]['total']=_0x5b490d['messages'][_0x8401('0x18')];}return this[_0x8401('0x11')](_0xfe8a0d);}};EmailChannel['prototype'][_0x8401('0x26')]=function(_0x1adf74,_0xc2b94b){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0xc2b94b[_0x8401('0x27')],_0xc2b94b['lastName'],_0xc2b94b[_0x8401('0x28')],_0x1adf74);if(this[_0x8401('0xd')][_0x1adf74]){return mailAccount[_0x8401('0x29')](_0x1adf74,_0xc2b94b)[_0x8401('0x2a')](function(_0x43a380){if(_0x43a380){logger[_0x8401('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0x8401('0x2b')](function(_0x113d1d){logger[_0x8401('0x2c')](_0x8401('0x2d'),JSON[_0x8401('0x1a')](_0x113d1d));});}};EmailChannel[_0x8401('0x10')][_0x8401('0x22')]=function(_0x19e46c){if(this['mailAccounts'][_0x19e46c]&&this['mailAccounts'][_0x19e46c][_0x8401('0x16')]){if(this[_0x8401('0xe')][this[_0x8401('0xd')][_0x19e46c][_0x8401('0x16')]['id']]){delete this['imapAccounts'][this[_0x8401('0xd')][_0x19e46c][_0x8401('0x16')]['id']];}this[_0x8401('0xd')][_0x19e46c][_0x8401('0x16')][_0x8401('0x2e')]=moment();this[_0x8401('0x11')](_0x19e46c);}};EmailChannel['prototype'][_0x8401('0x23')]=function(_0x3588b6,_0x30dcd2){if(this[_0x8401('0xd')][_0x3588b6]){this[_0x8401('0xd')][_0x3588b6][_0x8401('0x16')][_0x8401('0x15')]=_0x8401('0x2c');this['mailAccounts'][_0x3588b6][_0x8401('0x16')]['messageStatus']=_0x30dcd2;return this[_0x8401('0x11')](_0x3588b6);}};EmailChannel[_0x8401('0x10')][_0x8401('0x2f')]=function(_0x3c5d33,_0x27f877){return this[_0x8401('0xf')][_0x8401('0x30')](_0x3c5d33,_0x27f877);};EmailChannel[_0x8401('0x10')][_0x8401('0x31')]=function(_0x56782b){var _0x312c9a=this;if(this[_0x8401('0xd')][_0x56782b['id']]){if(_[_0x8401('0x19')](this[_0x8401('0xd')][_0x56782b['id']][_0x8401('0x32')])){this['mailAccounts'][_0x56782b['id']][_0x8401('0x32')]={};}this[_0x8401('0xd')][_0x56782b['id']][_0x8401('0x32')][_0x8401('0x2e')]=moment();return new BPromise(function(_0x23bf25,_0x5667e2){return _0x312c9a[_0x8401('0xf')][_0x8401('0x33')](_0x56782b)[_0x8401('0x2a')](function(_0x3c73d6){_0x312c9a['mailAccounts'][_0x56782b['id']]['Smtp']['status']=_0x8401('0x34');_0x312c9a['mailAccounts'][_0x56782b['id']][_0x8401('0x32')][_0x8401('0x17')]='';_0x312c9a[_0x8401('0x11')](_0x56782b['id']);_0x23bf25(_0x3c73d6);})[_0x8401('0x2b')](function(_0x3b972f){_0x312c9a['mailAccounts'][_0x56782b['id']]['Smtp']['status']='error';_0x312c9a[_0x8401('0xd')][_0x56782b['id']][_0x8401('0x32')][_0x8401('0x17')]=_0x3b972f;_0x312c9a[_0x8401('0x11')](_0x56782b['id']);_0x5667e2(_0x3b972f);});});}return this[_0x8401('0xf')][_0x8401('0x33')](_0x56782b);};module[_0x8401('0x35')]=EmailChannel; \ No newline at end of file +var _0xefd2=['name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','error','sendMail','send','Smtp','verify','verified','exports','lodash','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit'];(function(_0x204239,_0x5ec272){var _0x577511=function(_0x3f305c){while(--_0x3f305c){_0x204239['push'](_0x204239['shift']());}};_0x577511(++_0x5ec272);}(_0xefd2,0x8c));var _0x2efd=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xefd2[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x2efd('0x0'));var moment=require('moment');var BPromise=require(_0x2efd('0x1'));var md5=require(_0x2efd('0x2'));var Redis=require('ioredis');var config=require(_0x2efd('0x3'));var logger=require(_0x2efd('0x4'))(_0x2efd('0x5'));config['redis']=_[_0x2efd('0x6')](config[_0x2efd('0x7')],{'host':_0x2efd('0x8'),'port':0x18eb});var io=require(_0x2efd('0x9'))(new Redis(config[_0x2efd('0x7')]));var EmailImap=require(_0x2efd('0xa'));var EmailSmtp=require(_0x2efd('0xb'));var mailAccount=require(_0x2efd('0xc'));var md5Accounts={};function EmailChannel(_0x3477d9){logger[_0x2efd('0xd')]('start\x20email\x20channel');this[_0x2efd('0xe')]=_0x3477d9[_0x2efd('0xe')];this[_0x2efd('0xf')]={};this[_0x2efd('0x10')]=new EmailSmtp();}EmailChannel[_0x2efd('0x11')][_0x2efd('0x12')]=function(_0x199f79){var _0x41e52a=this[_0x2efd('0xe')][_0x199f79];var _0x34542d={'id':_0x41e52a['id'],'name':_0x41e52a[_0x2efd('0x13')],'key':_0x41e52a[_0x2efd('0x14')],'active':_0x41e52a[_0x2efd('0x15')],'Imap':{'status':_0x41e52a['Imap'][_0x2efd('0x16')],'messageStatus':_0x41e52a[_0x2efd('0x17')][_0x2efd('0x18')],'total':_0x41e52a[_0x2efd('0x17')][_0x2efd('0x19')]}};if(_[_0x2efd('0x1a')](md5Accounts[_0x199f79])){md5Accounts[_0x199f79]={};}var _0x7bb8b5=md5(JSON[_0x2efd('0x1b')](_0x34542d));if(md5Accounts[_0x199f79][_0x2efd('0x2')]!==_0x7bb8b5){md5Accounts[_0x199f79][_0x2efd('0x2')]=_0x7bb8b5;io[_0x2efd('0x12')](_0x2efd('0x1c'),_0x34542d);}};EmailChannel[_0x2efd('0x11')][_0x2efd('0x1d')]=function(_0x12b446){for(var _0x5c0f27 in _0x12b446){if(_0x12b446['hasOwnProperty'](_0x5c0f27)){if(_0x12b446[_0x5c0f27][_0x2efd('0x17')]&&_0x12b446[_0x5c0f27][_0x2efd('0x15')]){var _0x3849b0=_0x12b446[_0x5c0f27][_0x2efd('0x17')];if(!this[_0x2efd('0xf')][_0x2efd('0x1e')](_0x3849b0['id'])){this[_0x2efd('0xf')][_0x3849b0['id']]=new EmailImap(_0x3849b0,_0x12b446[_0x5c0f27][_0x2efd('0x5')]);this[_0x2efd('0xf')][_0x3849b0['id']]['on'](_0x2efd('0x1f'),this[_0x2efd('0x20')][_0x2efd('0x21')](this,_0x5c0f27));this[_0x2efd('0xf')][_0x3849b0['id']]['on']('email',this[_0x2efd('0x22')][_0x2efd('0x21')](this,_0x5c0f27));this['imapAccounts'][_0x3849b0['id']]['on'](_0x2efd('0x23'),this['handleImapEnd']['bind'](this,_0x5c0f27));this[_0x2efd('0xf')][_0x3849b0['id']]['on']('error',this['handleImapError'][_0x2efd('0x21')](this,_0x5c0f27));}}else{if(_[_0x2efd('0x1a')](this['mailAccounts'][_0x5c0f27][_0x2efd('0x17')])){this['mailAccounts'][_0x5c0f27]['Imap']={};}this[_0x2efd('0xe')][_0x5c0f27][_0x2efd('0x17')][_0x2efd('0x16')]=_0x2efd('0x24');this[_0x2efd('0xe')][_0x5c0f27][_0x2efd('0x17')][_0x2efd('0x18')]='';this[_0x2efd('0x12')](_0x5c0f27);}}}};EmailChannel[_0x2efd('0x11')][_0x2efd('0x20')]=function(_0x384d74,_0x12e3ef){if(this[_0x2efd('0xe')][_0x384d74]){this[_0x2efd('0xe')][_0x384d74]['Imap'][_0x2efd('0x16')]=_0x2efd('0x25');this[_0x2efd('0xe')][_0x384d74][_0x2efd('0x17')]['messageStatus']=_0x12e3ef['name'];if(_0x12e3ef['messages']){this['mailAccounts'][_0x384d74]['Imap']['total']=_0x12e3ef[_0x2efd('0x26')][_0x2efd('0x19')];}return this[_0x2efd('0x12')](_0x384d74);}};EmailChannel[_0x2efd('0x11')]['handleImapEmail']=function(_0x2c542a,_0xb4482b){logger[_0x2efd('0xd')](_0x2efd('0x27'),_0xb4482b[_0x2efd('0x28')],_0xb4482b['lastName'],_0xb4482b[_0x2efd('0x29')],_0x2c542a);if(this[_0x2efd('0xe')][_0x2c542a]){return mailAccount['notify'](_0x2c542a,_0xb4482b)[_0x2efd('0x2a')](function(_0x21b659){if(_0x21b659){logger[_0x2efd('0xd')](_0x2efd('0x2b'));}})[_0x2efd('0x2c')](function(_0x1dad03){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x2efd('0x1b')](_0x1dad03));});}};EmailChannel[_0x2efd('0x11')]['handleImapEnd']=function(_0xf28728){if(this['mailAccounts'][_0xf28728]&&this[_0x2efd('0xe')][_0xf28728][_0x2efd('0x17')]){if(this['imapAccounts'][this['mailAccounts'][_0xf28728][_0x2efd('0x17')]['id']]){delete this[_0x2efd('0xf')][this[_0x2efd('0xe')][_0xf28728][_0x2efd('0x17')]['id']];}this['mailAccounts'][_0xf28728]['Imap'][_0x2efd('0x2d')]=moment();this[_0x2efd('0x12')](_0xf28728);}};EmailChannel[_0x2efd('0x11')]['handleImapError']=function(_0x1b52bd,_0x1679d4){if(this['mailAccounts'][_0x1b52bd]){this[_0x2efd('0xe')][_0x1b52bd][_0x2efd('0x17')][_0x2efd('0x16')]=_0x2efd('0x2e');this[_0x2efd('0xe')][_0x1b52bd][_0x2efd('0x17')][_0x2efd('0x18')]=_0x1679d4;return this[_0x2efd('0x12')](_0x1b52bd);}};EmailChannel[_0x2efd('0x11')][_0x2efd('0x2f')]=function(_0x12fd29,_0x59982c){return this[_0x2efd('0x10')][_0x2efd('0x30')](_0x12fd29,_0x59982c);};EmailChannel[_0x2efd('0x11')]['verifySmtp']=function(_0x4e8f4e){var _0x4a6eb7=this;if(this[_0x2efd('0xe')][_0x4e8f4e['id']]){if(_[_0x2efd('0x1a')](this[_0x2efd('0xe')][_0x4e8f4e['id']]['Smtp'])){this['mailAccounts'][_0x4e8f4e['id']][_0x2efd('0x31')]={};}this[_0x2efd('0xe')][_0x4e8f4e['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x2f3210,_0x4e6f43){return _0x4a6eb7['smtp'][_0x2efd('0x32')](_0x4e8f4e)[_0x2efd('0x2a')](function(_0x1a8121){_0x4a6eb7[_0x2efd('0xe')][_0x4e8f4e['id']][_0x2efd('0x31')]['status']=_0x2efd('0x33');_0x4a6eb7['mailAccounts'][_0x4e8f4e['id']]['Smtp'][_0x2efd('0x18')]='';_0x4a6eb7[_0x2efd('0x12')](_0x4e8f4e['id']);_0x2f3210(_0x1a8121);})[_0x2efd('0x2c')](function(_0xa5562c){_0x4a6eb7[_0x2efd('0xe')][_0x4e8f4e['id']]['Smtp'][_0x2efd('0x16')]='error';_0x4a6eb7['mailAccounts'][_0x4e8f4e['id']]['Smtp']['messageStatus']=_0xa5562c;_0x4a6eb7[_0x2efd('0x12')](_0x4e8f4e['id']);_0x4e6f43(_0xa5562c);});});}return this['smtp'][_0x2efd('0x32')](_0x4e8f4e);};module[_0x2efd('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 76b0572..95cb50c 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 _0x2e02=['EventEmitter','../../../config/logger','mailbox','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','email','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','prototype','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','error','handleFetchError','handleFetchEnd','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','util','randomstring','Iconv','events'];(function(_0x35a647,_0x23a5e5){var _0x398e27=function(_0x22bdbc){while(--_0x22bdbc){_0x35a647['push'](_0x35a647['shift']());}};_0x398e27(++_0x23a5e5);}(_0x2e02,0xd8));var _0x22e0=function(_0x5645e0,_0x212666){_0x5645e0=_0x5645e0-0x0;var _0x1faabc=_0x2e02[_0x5645e0];return _0x1faabc;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x22e0('0x0'));var Imap=require('imap');var _=require('lodash');var rs=require(_0x22e0('0x1'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')[_0x22e0('0x2')];var EventEmitter=require(_0x22e0('0x3'))[_0x22e0('0x4')];var utils=require('./utils');var logger=require(_0x22e0('0x5'))('email');function EmailImap(_0x216576,_0x1de9c6){this[_0x22e0('0x6')]='INBOX';this[_0x22e0('0x7')]=this[_0x22e0('0x8')](_0x216576,_0x1de9c6);this[_0x22e0('0x9')]=new Imap(this[_0x22e0('0x7')]);this[_0x22e0('0x9')][_0x22e0('0xa')](_0x22e0('0xb'),this[_0x22e0('0xc')][_0x22e0('0xd')](this));this[_0x22e0('0x9')][_0x22e0('0xa')](_0x22e0('0xe'),this[_0x22e0('0xf')]['bind'](this));this[_0x22e0('0x9')]['on']('error',this[_0x22e0('0x10')][_0x22e0('0xd')](this));this[_0x22e0('0x9')][_0x22e0('0x11')]();}util[_0x22e0('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0x22e0('0x8')]=function(_0x190003,_0x3c12cc){var _0x383f69={'connTimeout':_0x190003[_0x22e0('0x13')]?_0x190003[_0x22e0('0x13')]*0x3e8:0x2710,'authTimeout':_0x190003[_0x22e0('0x14')]?_0x190003[_0x22e0('0x14')]*0x3e8:0x1388};if(_[_0x22e0('0x15')](_0x190003[_0x22e0('0x16')])){if(_0x190003[_0x22e0('0x17')]){_0x383f69[_0x22e0('0x18')]=_0x190003[_0x22e0('0x18')];_0x383f69[_0x22e0('0x19')]=_0x190003[_0x22e0('0x19')];}_0x383f69['host']=_0x190003[_0x22e0('0x1a')];_0x383f69[_0x22e0('0x1b')]=_0x190003[_0x22e0('0x1b')]||0x3e1;if(_0x190003[_0x22e0('0x1c')]){_0x383f69[_0x22e0('0x1c')]=!![];}else{_0x383f69[_0x22e0('0x1c')]=![];_0x383f69['autotls']='required';}}else{_0x383f69[_0x22e0('0x18')]=_0x190003[_0x22e0('0x18')];_0x383f69[_0x22e0('0x19')]=_0x190003[_0x22e0('0x19')];_0x383f69['host']=utils['getHost'](_0x190003['service']);_0x383f69[_0x22e0('0x1b')]=0x3e1;_0x383f69[_0x22e0('0x1c')]=!![];}_0x383f69[_0x22e0('0x1d')]=_0x3c12cc||_0x190003[_0x22e0('0x18')]||_0x22e0('0x1e');return _0x383f69;};EmailImap['prototype']['handleReady']=function(){this[_0x22e0('0x9')]['openBox'](this['mailbox'],![],this[_0x22e0('0x1f')][_0x22e0('0xd')](this));};EmailImap['prototype'][_0x22e0('0x1f')]=function(_0x3846e2,_0x249ba6){if(_0x3846e2){this[_0x22e0('0x10')](_0x3846e2,!![]);}else{this[_0x22e0('0x20')](_0x22e0('0x21'),_0x249ba6);this[_0x22e0('0x22')]();}};EmailImap[_0x22e0('0x23')][_0x22e0('0x24')]=function(_0x3ff4e4){if(_0x3ff4e4){this['handleError'](_0x3ff4e4,!![]);}else{this['imap']['end']();}};EmailImap[_0x22e0('0x23')][_0x22e0('0x22')]=function(){this[_0x22e0('0x9')][_0x22e0('0x25')]([_0x22e0('0x26')],this[_0x22e0('0x27')][_0x22e0('0xd')](this));};EmailImap[_0x22e0('0x23')][_0x22e0('0x27')]=function(_0x1c2903,_0x4fb920){if(_0x1c2903){this[_0x22e0('0x10')](_0x1c2903,!![]);}else{if(_0x4fb920['length']){try{var _0x52262c=this[_0x22e0('0x9')][_0x22e0('0x28')](_0x4fb920,{'bodies':'','markSeen':!![]});_0x52262c['on']('message',this['handleFetchMessage'][_0x22e0('0xd')](this));_0x52262c[_0x22e0('0xa')](_0x22e0('0x29'),this[_0x22e0('0x2a')][_0x22e0('0xd')](this));_0x52262c[_0x22e0('0xa')]('end',this[_0x22e0('0x2b')][_0x22e0('0xd')](this));}catch(_0x2ddecc){logger[_0x22e0('0x29')](_0x2ddecc);}}else{this[_0x22e0('0x9')]['closeBox'](!![],this[_0x22e0('0x24')][_0x22e0('0xd')](this));}}};EmailImap[_0x22e0('0x23')]['handleFetchMessage']=function(_0x3cd19a,_0x48ed0b){_0x3cd19a['on']('body',this[_0x22e0('0x2c')][_0x22e0('0xd')](this));_0x3cd19a['once']('attributes',this[_0x22e0('0x2d')][_0x22e0('0xd')](this));_0x3cd19a[_0x22e0('0xa')](_0x22e0('0xe'),this[_0x22e0('0x2e')][_0x22e0('0xd')](this));};EmailImap['prototype'][_0x22e0('0x2c')]=function(_0x5dbe3b,_0x3da193){simpleParser(_0x5dbe3b,{'Iconv':Iconv},this[_0x22e0('0x2f')][_0x22e0('0xd')](this));};EmailImap[_0x22e0('0x23')]['handleMessageAttributes']=function(_0x3b2f8d){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x22e0('0x23')][_0x22e0('0x2f')]=function(_0x141e33,_0x8f576e){if(_0x141e33){logger[_0x22e0('0x29')](_0x141e33);}else{var _0x49f1ae=this;utils[_0x22e0('0x30')](this[_0x22e0('0x7')],_0x8f576e,function(_0x58c548){_0x49f1ae[_0x22e0('0x20')](_0x22e0('0x1d'),_0x58c548);});}};EmailImap[_0x22e0('0x23')][_0x22e0('0x2b')]=function(){this['imap']['closeBox'](!![],this[_0x22e0('0x24')][_0x22e0('0xd')](this));};EmailImap[_0x22e0('0x23')][_0x22e0('0x2a')]=function(_0x99b528){this[_0x22e0('0x10')](_0x99b528);this[_0x22e0('0x9')][_0x22e0('0x31')](!![],this[_0x22e0('0x24')]['bind'](this));};EmailImap[_0x22e0('0x23')][_0x22e0('0xf')]=function(){this[_0x22e0('0x20')](_0x22e0('0xe'));};EmailImap[_0x22e0('0x23')][_0x22e0('0x10')]=function(_0x353d77,_0x142066){logger['error'](_0x22e0('0x10'),this[_0x22e0('0x7')][_0x22e0('0x1d')],JSON[_0x22e0('0x32')](_0x353d77));var _0x3b46b5='';if(_0x353d77){if(_0x353d77[_0x22e0('0x33')]){_0x3b46b5=_0x353d77[_0x22e0('0x33')];}else{for(var _0x18eae9 in _0x353d77){if(_0x353d77[_0x22e0('0x34')](_0x18eae9)){_0x3b46b5+=_[_0x22e0('0x35')](_0x18eae9)+':\x20'+_0x353d77[_0x18eae9]+'\x0a';}}}}if(_0x142066){this[_0x22e0('0x9')][_0x22e0('0xe')]();}else{this[_0x22e0('0x20')](_0x22e0('0x29'),_0x3b46b5);this[_0x22e0('0x20')](_0x22e0('0xe'));}};module[_0x22e0('0x36')]=EmailImap; \ No newline at end of file +var _0x65a8=['randomstring','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','handleReady','once','end','handleEnd','bind','error','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','tls','required','getHost','port','anonymous@xcally.com','openBox','handleOpenBox','readUnseen','handleCloseBox','search','handleReadUnseen','length','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash'];(function(_0x2a4a56,_0xf7e6ed){var _0x4b0b3e=function(_0x52ef43){while(--_0x52ef43){_0x2a4a56['push'](_0x2a4a56['shift']());}};_0x4b0b3e(++_0xf7e6ed);}(_0x65a8,0x1e4));var _0x865a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x65a8[_0x59ee6f];return _0x4c0979;};'use strict';var fs=require('fs');var path=require(_0x865a('0x0'));var util=require(_0x865a('0x1'));var Imap=require(_0x865a('0x2'));var _=require(_0x865a('0x3'));var rs=require(_0x865a('0x4'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x865a('0x5'))[_0x865a('0x6')];var EventEmitter=require(_0x865a('0x7'))[_0x865a('0x8')];var utils=require(_0x865a('0x9'));var logger=require(_0x865a('0xa'))(_0x865a('0xb'));function EmailImap(_0x276e36,_0x26d47c){this[_0x865a('0xc')]='INBOX';this[_0x865a('0xd')]=this['getAccount'](_0x276e36,_0x26d47c);this[_0x865a('0x2')]=new Imap(this[_0x865a('0xd')]);this[_0x865a('0x2')]['once']('ready',this[_0x865a('0xe')]['bind'](this));this[_0x865a('0x2')][_0x865a('0xf')](_0x865a('0x10'),this[_0x865a('0x11')][_0x865a('0x12')](this));this['imap']['on'](_0x865a('0x13'),this[_0x865a('0x14')]['bind'](this));this['imap'][_0x865a('0x15')]();}util[_0x865a('0x16')](EmailImap,EventEmitter);EmailImap[_0x865a('0x17')][_0x865a('0x18')]=function(_0x384a9d,_0x27dd8f){var _0x4b9a65={'connTimeout':_0x384a9d[_0x865a('0x19')]?_0x384a9d[_0x865a('0x19')]*0x3e8:0x2710,'authTimeout':_0x384a9d[_0x865a('0x1a')]?_0x384a9d['authTimeout']*0x3e8:0x1388};if(_[_0x865a('0x1b')](_0x384a9d[_0x865a('0x1c')])){if(_0x384a9d[_0x865a('0x1d')]){_0x4b9a65[_0x865a('0x1e')]=_0x384a9d['user'];_0x4b9a65[_0x865a('0x1f')]=_0x384a9d[_0x865a('0x1f')];}_0x4b9a65['host']=_0x384a9d[_0x865a('0x20')];_0x4b9a65['port']=_0x384a9d['port']||0x3e1;if(_0x384a9d[_0x865a('0x21')]){_0x4b9a65[_0x865a('0x21')]=!![];}else{_0x4b9a65[_0x865a('0x21')]=![];_0x4b9a65['autotls']=_0x865a('0x22');}}else{_0x4b9a65[_0x865a('0x1e')]=_0x384a9d[_0x865a('0x1e')];_0x4b9a65['password']=_0x384a9d['password'];_0x4b9a65[_0x865a('0x20')]=utils[_0x865a('0x23')](_0x384a9d[_0x865a('0x1c')]);_0x4b9a65[_0x865a('0x24')]=0x3e1;_0x4b9a65[_0x865a('0x21')]=!![];}_0x4b9a65[_0x865a('0xb')]=_0x27dd8f||_0x384a9d[_0x865a('0x1e')]||_0x865a('0x25');return _0x4b9a65;};EmailImap[_0x865a('0x17')][_0x865a('0xe')]=function(){this['imap'][_0x865a('0x26')](this['mailbox'],![],this[_0x865a('0x27')][_0x865a('0x12')](this));};EmailImap['prototype'][_0x865a('0x27')]=function(_0x34186a,_0x4c367e){if(_0x34186a){this['handleError'](_0x34186a,!![]);}else{this['emit']('box',_0x4c367e);this[_0x865a('0x28')]();}};EmailImap[_0x865a('0x17')][_0x865a('0x29')]=function(_0x363142){if(_0x363142){this[_0x865a('0x14')](_0x363142,!![]);}else{this[_0x865a('0x2')][_0x865a('0x10')]();}};EmailImap[_0x865a('0x17')][_0x865a('0x28')]=function(){this[_0x865a('0x2')][_0x865a('0x2a')](['UNSEEN'],this[_0x865a('0x2b')][_0x865a('0x12')](this));};EmailImap[_0x865a('0x17')][_0x865a('0x2b')]=function(_0x35e0b6,_0x398606){if(_0x35e0b6){this['handleError'](_0x35e0b6,!![]);}else{if(_0x398606[_0x865a('0x2c')]){try{var _0x2fa24c=this[_0x865a('0x2')]['fetch'](_0x398606,{'bodies':'','markSeen':!![]});_0x2fa24c['on']('message',this[_0x865a('0x2d')][_0x865a('0x12')](this));_0x2fa24c[_0x865a('0xf')](_0x865a('0x13'),this[_0x865a('0x2e')][_0x865a('0x12')](this));_0x2fa24c[_0x865a('0xf')](_0x865a('0x10'),this[_0x865a('0x2f')][_0x865a('0x12')](this));}catch(_0x136f65){logger['error'](_0x136f65);}}else{this[_0x865a('0x2')][_0x865a('0x30')](!![],this['handleCloseBox'][_0x865a('0x12')](this));}}};EmailImap[_0x865a('0x17')][_0x865a('0x2d')]=function(_0x5390c7,_0x5ee7ab){_0x5390c7['on'](_0x865a('0x31'),this[_0x865a('0x32')][_0x865a('0x12')](this));_0x5390c7[_0x865a('0xf')]('attributes',this[_0x865a('0x33')][_0x865a('0x12')](this));_0x5390c7['once'](_0x865a('0x10'),this[_0x865a('0x34')][_0x865a('0x12')](this));};EmailImap[_0x865a('0x17')][_0x865a('0x32')]=function(_0x456667,_0x3a3100){simpleParser(_0x456667,{'Iconv':Iconv},this['handleSimpleParser'][_0x865a('0x12')](this));};EmailImap[_0x865a('0x17')]['handleMessageAttributes']=function(_0x3ba821){};EmailImap[_0x865a('0x17')][_0x865a('0x34')]=function(){};EmailImap[_0x865a('0x17')][_0x865a('0x35')]=function(_0x330e2b,_0x3dace8){if(_0x330e2b){logger['error'](_0x330e2b);}else{var _0x445446=this;utils[_0x865a('0x36')](this['account'],_0x3dace8,function(_0x804385){_0x445446['emit'](_0x865a('0xb'),_0x804385);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x865a('0x2')]['closeBox'](!![],this[_0x865a('0x29')]['bind'](this));};EmailImap['prototype'][_0x865a('0x2e')]=function(_0x5b2afc){this[_0x865a('0x14')](_0x5b2afc);this['imap'][_0x865a('0x30')](!![],this[_0x865a('0x29')]['bind'](this));};EmailImap[_0x865a('0x17')]['handleEnd']=function(){this[_0x865a('0x37')]('end');};EmailImap[_0x865a('0x17')]['handleError']=function(_0x43cbce,_0x14382b){logger[_0x865a('0x13')](_0x865a('0x14'),this['account'][_0x865a('0xb')],JSON[_0x865a('0x38')](_0x43cbce));var _0x5e4b7f='';if(_0x43cbce){if(_0x43cbce[_0x865a('0x39')]){_0x5e4b7f=_0x43cbce[_0x865a('0x39')];}else{for(var _0x2d3a44 in _0x43cbce){if(_0x43cbce[_0x865a('0x3a')](_0x2d3a44)){_0x5e4b7f+=_[_0x865a('0x3b')](_0x2d3a44)+':\x20'+_0x43cbce[_0x2d3a44]+'\x0a';}}}}if(_0x14382b){this['imap'][_0x865a('0x10')]();}else{this['emit'](_0x865a('0x13'),_0x5e4b7f);this[_0x865a('0x37')](_0x865a('0x10'));}};module[_0x865a('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 3aa2d6b..a422d21 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 _0x6feb=['createTransport','use','sendMail','prototype','verify','toString','Not\x20verifired','nodemailer','bluebird','send'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x6feb,0x1bf));var _0xb6fe=function(_0x3d2ab8,_0x388f58){_0x3d2ab8=_0x3d2ab8-0x0;var _0x3c2b53=_0x6feb[_0x3d2ab8];return _0x3c2b53;};'use strict';var nodemailer=require(_0xb6fe('0x0'));var BPromise=require(_0xb6fe('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xb6fe('0x2')]=function(_0x17831b,_0x5c0fb4){return new BPromise(function(_0x488549,_0x52e342){var _0x4cd3c3=nodemailer[_0xb6fe('0x3')](_0x17831b);_0x4cd3c3[_0xb6fe('0x4')]('compile',inlineBase64());_0x4cd3c3[_0xb6fe('0x5')](_0x5c0fb4,function(_0x1cf62d,_0xf7e78e){if(_0x1cf62d){_0x52e342(_0x1cf62d['toString']());}else{_0x488549(_0xf7e78e);}});});};EmailSmtp[_0xb6fe('0x6')][_0xb6fe('0x7')]=function(_0x3015ab){return new BPromise(function(_0x135f3a,_0x549410){var _0x9a8170=nodemailer[_0xb6fe('0x3')](_0x3015ab);_0x9a8170[_0xb6fe('0x7')](function(_0xc2b35a,_0x18f80f){if(_0xc2b35a){_0x549410(_0xc2b35a[_0xb6fe('0x8')]());}else{if(_0x18f80f){_0x135f3a(_0x18f80f);}else{_0x549410(_0xb6fe('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x079d=['compile','sendMail','toString','verify','Not\x20verifired','nodemailer','bluebird','prototype','send','createTransport','use'];(function(_0x4e2861,_0x199be0){var _0x2265e3=function(_0x469693){while(--_0x469693){_0x4e2861['push'](_0x4e2861['shift']());}};_0x2265e3(++_0x199be0);}(_0x079d,0xcb));var _0xd079=function(_0x31ff23,_0x3c8e3c){_0x31ff23=_0x31ff23-0x0;var _0x42dbaa=_0x079d[_0x31ff23];return _0x42dbaa;};'use strict';var nodemailer=require(_0xd079('0x0'));var BPromise=require(_0xd079('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xd079('0x2')][_0xd079('0x3')]=function(_0x3f1a23,_0x3e08d2){return new BPromise(function(_0x5e18b8,_0x1f802d){var _0x2064c9=nodemailer[_0xd079('0x4')](_0x3f1a23);_0x2064c9[_0xd079('0x5')](_0xd079('0x6'),inlineBase64());_0x2064c9[_0xd079('0x7')](_0x3e08d2,function(_0x4657c6,_0x112d5a){if(_0x4657c6){_0x1f802d(_0x4657c6[_0xd079('0x8')]());}else{_0x5e18b8(_0x112d5a);}});});};EmailSmtp[_0xd079('0x2')][_0xd079('0x9')]=function(_0x59cc2b){return new BPromise(function(_0x5702a4,_0x58dd7e){var _0x423933=nodemailer['createTransport'](_0x59cc2b);_0x423933['verify'](function(_0x27d3d4,_0x1e884d){if(_0x27d3d4){_0x58dd7e(_0x27d3d4[_0xd079('0x8')]());}else{if(_0x1e884d){_0x5702a4(_0x1e884d);}else{_0x58dd7e(_0xd079('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d168708..839fb40 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 _0x4864=['../../../config/logger','email','value','address','anonymous','generate','@xcally.com','head','name','length','slice','Anonymous','split','pop','html','test','replace','includes','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','randomstring','path','util','node-tnef'];(function(_0x1bdaf7,_0x49e4d3){var _0x1ca543=function(_0x39bdc5){while(--_0x39bdc5){_0x1bdaf7['push'](_0x1bdaf7['shift']());}};_0x1ca543(++_0x49e4d3);}(_0x4864,0x10c));var _0x4486=function(_0x3a7368,_0x185789){_0x3a7368=_0x3a7368-0x0;var _0x1aa883=_0x4864[_0x3a7368];return _0x1aa883;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x4486('0x0'));var fs=require('fs');var path=require(_0x4486('0x1'));var util=require(_0x4486('0x2'));var tnef=require(_0x4486('0x3'));var logger=require(_0x4486('0x4'))(_0x4486('0x5'));var config=require('../../../config/environment');function getAddress(_0x2857e4){var _0x1503c0=_['head'](_0x2857e4[_0x4486('0x6')]);return _0x1503c0&&_0x1503c0[_0x4486('0x7')]?_0x1503c0[_0x4486('0x7')]:_0x4486('0x8')+random[_0x4486('0x9')](0x6)+_0x4486('0xa');}function getFirstName(_0x27f71f){var _0x158968=_[_0x4486('0xb')](_0x27f71f[_0x4486('0x6')]);if(_0x158968&&_0x158968['name']){var _0x55ac93=_0x158968[_0x4486('0xc')]['split'](/\s+/);return _0x55ac93[_0x4486('0xd')]?_0x55ac93[_0x4486('0xe')](0x0,-0x1)['join']('\x20'):_0x158968[_0x4486('0xc')];}return _0x4486('0xf');}function getLastName(_0x6f442d){var _0x2f5e56=_[_0x4486('0xb')](_0x6f442d[_0x4486('0x6')]);if(_0x2f5e56&&_0x2f5e56['name']){var _0x4be7c4=_0x2f5e56['name'][_0x4486('0x10')](/\s+/);return _0x4be7c4['length']>0x1?_0x4be7c4[_0x4486('0x11')]():'';}return'';}function getMails(_0x26f34c,_0x2a36a6){var _0xc0a139='';for(var _0x287b22=0x0;_0x287b22<_0x2a36a6[_0x4486('0x6')][_0x4486('0xd')];_0x287b22+=0x1){if(_0x2a36a6[_0x4486('0x6')][_0x287b22]['address']!==_0x26f34c){if(!_['isEmpty'](_0xc0a139)){_0xc0a139+=',';}_0xc0a139+=_0x2a36a6[_0x4486('0x6')][_0x287b22]['name']||_0x2a36a6[_0x4486('0x6')][_0x287b22][_0x4486('0x7')]||'';_0xc0a139+='\x20<';_0xc0a139+=_0x2a36a6['value'][_0x287b22][_0x4486('0x7')]?_0x2a36a6[_0x4486('0x6')][_0x287b22][_0x4486('0x7')]:'anonymous'+random[_0x4486('0x9')](0x6)+'@xcally.com';_0xc0a139+='>';}}return _0xc0a139;}function parseEmail(_0x32d5c4,_0x294772,_0x3914a9){if(_0x294772[_0x4486('0x12')]){var _0x21f1a8=/)<[^<]*)*<\/script>/gi;while(_0x21f1a8[_0x4486('0x13')](_0x294772[_0x4486('0x12')])){_0x294772[_0x4486('0x12')]=_0x294772[_0x4486('0x12')][_0x4486('0x14')](_0x21f1a8,'');}if(_0x294772[_0x4486('0x12')][_0x4486('0x15')]('{_0x14854f[_0x4486('0x17')](_0x2ca30b['filename']);});var _0x4a11a1=/]+>/g;var _0x317aff=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5197f2=_0x294772[_0x4486('0x12')][_0x4486('0x14')](_0x317aff,_0x4486('0x18'));var _0x3543bd=_0x5197f2[_0x4486('0x14')](_0x4a11a1,_0x4486('0x19'));for(let _0x41c95c=0x0;_0x41c95c<_0x14854f[_0x4486('0xd')];_0x41c95c++){var _0x39b0c4=_0x3543bd[_0x4486('0x14')](_0x4486('0x19'),_0x4486('0x1a')+_0x14854f[_0x41c95c]+_0x4486('0x1b'));_0x3543bd=_0x39b0c4;}_0x294772[_0x4486('0x12')]=_0x3543bd;}_0x3914a9['body']=_0x294772[_0x4486('0x12')];}else{_0x3914a9[_0x4486('0x1c')]=_0x294772[_0x4486('0x1d')];}if(_0x3914a9[_0x4486('0x1c')]){_0x3914a9[_0x4486('0x1c')]=_0x3914a9[_0x4486('0x1c')][_0x4486('0x14')](/\x20[Attachment:\x20','\x20]','body','Empty\x20message

','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x8a37,0x8a));var _0x78a3=function(_0xa9bcf1,_0x4d3f01){_0xa9bcf1=_0xa9bcf1-0x0;var _0x1e1c82=_0x8a37[_0xa9bcf1];return _0x1e1c82;};'use strict';var _=require(_0x78a3('0x0'));var moment=require(_0x78a3('0x1'));var random=require(_0x78a3('0x2'));var fs=require('fs');var path=require(_0x78a3('0x3'));var util=require(_0x78a3('0x4'));var tnef=require('node-tnef');var logger=require(_0x78a3('0x5'))('email');var config=require(_0x78a3('0x6'));function getAddress(_0x25eb40){var _0x416daf=_[_0x78a3('0x7')](_0x25eb40[_0x78a3('0x8')]);return _0x416daf&&_0x416daf['address']?_0x416daf[_0x78a3('0x9')]:'anonymous'+random[_0x78a3('0xa')](0x6)+_0x78a3('0xb');}function getFirstName(_0x5477c8){var _0x380a58=_['head'](_0x5477c8[_0x78a3('0x8')]);if(_0x380a58&&_0x380a58[_0x78a3('0xc')]){var _0x1247fe=_0x380a58['name'][_0x78a3('0xd')](/\s+/);return _0x1247fe[_0x78a3('0xe')]?_0x1247fe[_0x78a3('0xf')](0x0,-0x1)['join']('\x20'):_0x380a58[_0x78a3('0xc')];}return'Anonymous';}function getLastName(_0x187870){var _0x590706=_[_0x78a3('0x7')](_0x187870[_0x78a3('0x8')]);if(_0x590706&&_0x590706[_0x78a3('0xc')]){var _0x1b72ff=_0x590706[_0x78a3('0xc')][_0x78a3('0xd')](/\s+/);return _0x1b72ff[_0x78a3('0xe')]>0x1?_0x1b72ff[_0x78a3('0x10')]():'';}return'';}function getMails(_0x233dbb,_0x51e569){var _0x12f705='';for(var _0x2525bc=0x0;_0x2525bc<_0x51e569[_0x78a3('0x8')][_0x78a3('0xe')];_0x2525bc+=0x1){if(_0x51e569[_0x78a3('0x8')][_0x2525bc][_0x78a3('0x9')]!==_0x233dbb){if(!_[_0x78a3('0x11')](_0x12f705)){_0x12f705+=',';}_0x12f705+=_0x51e569[_0x78a3('0x8')][_0x2525bc][_0x78a3('0xc')]||_0x51e569[_0x78a3('0x8')][_0x2525bc]['address']||'';_0x12f705+='\x20<';_0x12f705+=_0x51e569['value'][_0x2525bc][_0x78a3('0x9')]?_0x51e569[_0x78a3('0x8')][_0x2525bc]['address']:_0x78a3('0x12')+random[_0x78a3('0xa')](0x6)+'@xcally.com';_0x12f705+='>';}}return _0x12f705;}function parseEmail(_0x4cc8a8,_0x3419d7,_0x12cb94){if(_0x3419d7[_0x78a3('0x13')]){var _0x52ccbd=/)<[^<]*)*<\/script>/gi;while(_0x52ccbd[_0x78a3('0x14')](_0x3419d7[_0x78a3('0x13')])){_0x3419d7[_0x78a3('0x13')]=_0x3419d7['html'][_0x78a3('0x15')](_0x52ccbd,'');}if(_0x3419d7['html']['includes']('{_0x248134[_0x78a3('0x18')](_0x20b019[_0x78a3('0x19')]);});var _0x5ed0ac=/]+>/g;var _0x380063=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0xfbb5b0=_0x3419d7['html'][_0x78a3('0x15')](_0x380063,_0x78a3('0x1a'));var _0x442069=_0xfbb5b0[_0x78a3('0x15')](_0x5ed0ac,'_IMG');for(let _0x474648=0x0;_0x474648<_0x248134['length'];_0x474648++){var _0x27d5eb=_0x442069[_0x78a3('0x15')](_0x78a3('0x1b'),_0x78a3('0x1c')+_0x248134[_0x474648]+_0x78a3('0x1d'));_0x442069=_0x27d5eb;}_0x3419d7[_0x78a3('0x13')]=_0x442069;}_0x12cb94['body']=_0x3419d7[_0x78a3('0x13')];}else{_0x12cb94[_0x78a3('0x1e')]=_0x3419d7['textAsHtml'];}if(_0x12cb94[_0x78a3('0x1e')]){_0x12cb94[_0x78a3('0x1e')]=_0x12cb94[_0x78a3('0x1e')]['replace'](/Empty\x20message

';if(_0xf5e35e[_0x78a3('0x39')]){for(var _0x4e98e1=0x0;_0x4e98e1<_0xf5e35e[_0x78a3('0x39')][_0x78a3('0xe')];_0x4e98e1++){var _0x39789a=_0xf5e35e[_0x78a3('0x39')][_0x4e98e1];_0x2e1c7b[_0x78a3('0x20')][_0x78a3('0x16')][_0x78a3('0x18')]({'filename':_0x39789a[_0x78a3('0x3a')],'content':new Buffer(_0x39789a[_0x78a3('0x3b')])});}}}_0x386f6d(parseEmail(_0x3351f8,_0x24c961,_0x2e1c7b));});}else{_0x24c961[_0x78a3('0x13')]=_0x78a3('0x3c');_0x386f6d(parseEmail(_0x3351f8,_0x24c961,_0x2e1c7b));}}else{_0x386f6d(parseEmail(_0x3351f8,_0x24c961,_0x2e1c7b));}};exports[_0x78a3('0x3d')]=function(_0xa2b95d){switch(_0xa2b95d){case _0x78a3('0x3e'):return _0x78a3('0x3f');case'yahoo':return _0x78a3('0x40');case'hotmail':return _0x78a3('0x41');case _0x78a3('0x42'):return _0x78a3('0x43');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 478fa22..1718cc5 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c3c=['Service','key','SERV','active','Imap','exports','name'];(function(_0xc27eaa,_0x5a53ff){var _0x3847cc=function(_0x350d5d){while(--_0x350d5d){_0xc27eaa['push'](_0xc27eaa['shift']());}};_0x3847cc(++_0x5a53ff);}(_0x3c3c,0xdf));var _0xc3c3=function(_0x16b626,_0x490af4){_0x16b626=_0x16b626-0x0;var _0x1425b1=_0x3c3c[_0x16b626];return _0x1425b1;};'use strict';var _=require('lodash');function MailAccount(_0x40f555){this['id']=_0x40f555['id']||0x0;this[_0xc3c3('0x0')]=_0x40f555[_0xc3c3('0x0')]||_0xc3c3('0x1');this[_0xc3c3('0x2')]=_0x40f555[_0xc3c3('0x2')]||_0xc3c3('0x3');this[_0xc3c3('0x4')]=_0x40f555[_0xc3c3('0x4')]||![];this['Imap']=_0x40f555[_0xc3c3('0x5')]||[];this['Smtp']=_0x40f555['Smtp']||[];}module[_0xc3c3('0x6')]=MailAccount; \ No newline at end of file +var _0xce67=['Service','key','active','Imap','Smtp','exports','lodash','name'];(function(_0x1f3246,_0x84d645){var _0x8f58df=function(_0x21192b){while(--_0x21192b){_0x1f3246['push'](_0x1f3246['shift']());}};_0x8f58df(++_0x84d645);}(_0xce67,0x1d6));var _0x7ce6=function(_0x1af4df,_0x3ab8f5){_0x1af4df=_0x1af4df-0x0;var _0x4143c8=_0xce67[_0x1af4df];return _0x4143c8;};'use strict';var _=require(_0x7ce6('0x0'));function MailAccount(_0x5cb051){this['id']=_0x5cb051['id']||0x0;this[_0x7ce6('0x1')]=_0x5cb051[_0x7ce6('0x1')]||_0x7ce6('0x2');this['key']=_0x5cb051[_0x7ce6('0x3')]||'SERV';this[_0x7ce6('0x4')]=_0x5cb051['active']||![];this[_0x7ce6('0x5')]=_0x5cb051[_0x7ce6('0x5')]||[];this[_0x7ce6('0x6')]=_0x5cb051[_0x7ce6('0x6')]||[];}module[_0x7ce6('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3e8caa0..a5845d8 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8ce=['initMailAccounts','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd8ce,0x1cf));var _0xed8c=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xd8ce[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0xed8c('0x0'));var MailAccount=require(_0xed8c('0x1'));var Realtime=function(){this[_0xed8c('0x2')]={};};function freeIsNotKey(_0x54f4b4,_0x5a16ee,_0x10121d){var _0x391462=_[_0xed8c('0x3')](_0x54f4b4,function(_0x23de73,_0x123ed2){return _0x23de73[_0x10121d];});for(var _0x2d8dba in _0x5a16ee){if(_0x5a16ee[_0xed8c('0x4')](_0x2d8dba)){if(!_0x391462[_0x2d8dba]){delete _0x5a16ee[_0x2d8dba];}}}}Realtime['prototype'][_0xed8c('0x5')]=function(_0x30e401,_0x1d9046){for(var _0x2160a2 in _0x1d9046){if(_0x30e401[_0xed8c('0x4')](_0x2160a2)){_0x30e401[_0x2160a2]=_0x1d9046[_0x2160a2];}}};Realtime[_0xed8c('0x6')][_0xed8c('0x7')]=function(){var _0x54f4a5=this;return function(_0x4673a3){if(_0x4673a3){freeIsNotKey(_0x4673a3,_0x54f4a5[_0xed8c('0x2')],'id');for(var _0x4b6e60=0x0,_0x18b090={},_0x2560eb={};_0x4b6e60<_0x4673a3['length'];_0x4b6e60+=0x1){_0x18b090=_0x4673a3[_0x4b6e60];if(_['isUndefined'](_0x54f4a5[_0xed8c('0x2')][_0x18b090['id']])){_0x54f4a5[_0xed8c('0x2')][_0x18b090['id']]=new MailAccount(_0x18b090);}else{_[_0xed8c('0x8')](_0x54f4a5[_0xed8c('0x2')][_0x18b090['id']],_0x18b090);}}}return _0x54f4a5[_0xed8c('0x2')];};};module[_0xed8c('0x9')]=Realtime; \ No newline at end of file +var _0xac1b=['merge','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined'];(function(_0x4d6f66,_0x15ee37){var _0x2901f6=function(_0x6fe506){while(--_0x6fe506){_0x4d6f66['push'](_0x4d6f66['shift']());}};_0x2901f6(++_0x15ee37);}(_0xac1b,0x184));var _0xbac1=function(_0x2112fb,_0x14a822){_0x2112fb=_0x2112fb-0x0;var _0x4fc27e=_0xac1b[_0x2112fb];return _0x4fc27e;};'use strict';var _=require('lodash');var MailAccount=require(_0xbac1('0x0'));var Realtime=function(){this[_0xbac1('0x1')]={};};function freeIsNotKey(_0x5625b5,_0x48a2b4,_0x413d31){var _0x1f5d15=_[_0xbac1('0x2')](_0x5625b5,function(_0xbc55d3,_0x26ccea){return _0xbc55d3[_0x413d31];});for(var _0x2da4eb in _0x48a2b4){if(_0x48a2b4[_0xbac1('0x3')](_0x2da4eb)){if(!_0x1f5d15[_0x2da4eb]){delete _0x48a2b4[_0x2da4eb];}}}}Realtime[_0xbac1('0x4')]['mergeFromDatabase']=function(_0x404f56,_0x5abf4d){for(var _0x5eff01 in _0x5abf4d){if(_0x404f56[_0xbac1('0x3')](_0x5eff01)){_0x404f56[_0x5eff01]=_0x5abf4d[_0x5eff01];}}};Realtime[_0xbac1('0x4')][_0xbac1('0x5')]=function(){var _0x5f250a=this;return function(_0x4454fa){if(_0x4454fa){freeIsNotKey(_0x4454fa,_0x5f250a['mailAccounts'],'id');for(var _0x45fa80=0x0,_0x1d0bfa={},_0x3b151c={};_0x45fa80<_0x4454fa[_0xbac1('0x6')];_0x45fa80+=0x1){_0x1d0bfa=_0x4454fa[_0x45fa80];if(_[_0xbac1('0x7')](_0x5f250a['mailAccounts'][_0x1d0bfa['id']])){_0x5f250a['mailAccounts'][_0x1d0bfa['id']]=new MailAccount(_0x1d0bfa);}else{_[_0xbac1('0x8')](_0x5f250a['mailAccounts'][_0x1d0bfa['id']],_0x1d0bfa);}}}return _0x5f250a[_0xbac1('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index c6a69d8..eaa7100 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x573a=['GetMailAccount','name','service','email','active','ListId','MailServerIn','Imap','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts'];(function(_0xd2d35e,_0xd0f051){var _0xca1670=function(_0x3a95f5){while(--_0x3a95f5){_0xd2d35e['push'](_0xd2d35e['shift']());}};_0xca1670(++_0xd0f051);}(_0x573a,0x124));var _0xa573=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x573a[_0x2c7b86];return _0x256735;};'use strict';var client=require(_0xa573('0x0'));exports[_0xa573('0x1')]=function(){return function(){return client['Request'](_0xa573('0x2'),{'options':{'attributes':['id',_0xa573('0x3'),_0xa573('0x4'),_0xa573('0x5'),_0xa573('0x6'),'key',_0xa573('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xa573('0x8'),'as':_0xa573('0x9')},{'model':'MailServerOut','as':'Smtp'}]},'log':_0xa573('0xa')});};};exports[_0xa573('0xb')]=function(_0x2529f1,_0x14a0b5){return client[_0xa573('0xc')](_0xa573('0xd'),{'account':{'id':_0x2529f1},'body':_0x14a0b5,'log':_0xa573('0xd')});}; \ No newline at end of file +var _0x2d2c=['service','active','ListId','TemplateId','MailServerIn','Imap','MailServerOut','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name'];(function(_0x5661c1,_0x1d3440){var _0x15790c=function(_0x4dea41){while(--_0x4dea41){_0x5661c1['push'](_0x5661c1['shift']());}};_0x15790c(++_0x1d3440);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x57d740,_0x50be99){_0x57d740=_0x57d740-0x0;var _0x6607ef=_0x2d2c[_0x57d740];return _0x6607ef;};'use strict';var client=require(_0xc2d2('0x0'));exports[_0xc2d2('0x1')]=function(){return function(){return client[_0xc2d2('0x2')](_0xc2d2('0x3'),{'options':{'attributes':['id',_0xc2d2('0x4'),_0xc2d2('0x5'),'email',_0xc2d2('0x6'),'key',_0xc2d2('0x7'),_0xc2d2('0x8')],'raw':![],'include':[{'model':_0xc2d2('0x9'),'as':_0xc2d2('0xa')},{'model':_0xc2d2('0xb'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0xc2d2('0xc')]=function(_0x13c6c6,_0x2ebe63){return client[_0xc2d2('0x2')](_0xc2d2('0xd'),{'account':{'id':_0x13c6c6},'body':_0x2ebe63,'log':_0xc2d2('0xd')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 7e54aba..1206f3e 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1337=['Request','ShowSetting','GetSettings','../client','getSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1337,0x18e));var _0x7133=function(_0xb0bd5d,_0x156b62){_0xb0bd5d=_0xb0bd5d-0x0;var _0x417125=_0x1337[_0xb0bd5d];return _0x417125;};'use strict';var client=require(_0x7133('0x0'));exports[_0x7133('0x1')]=function(){return client[_0x7133('0x2')](_0x7133('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x7133('0x4')});}; \ No newline at end of file +var _0x0417=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x0417,0xdf));var _0x7041=function(_0x5c15d5,_0x260963){_0x5c15d5=_0x5c15d5-0x0;var _0x333968=_0x0417[_0x5c15d5];return _0x333968;};'use strict';var client=require(_0x7041('0x0'));exports[_0x7041('0x1')]=function(){return client[_0x7041('0x2')](_0x7041('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7041('0x4')]},'log':_0x7041('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index e71a2c8..a48f82d 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16dc=['error','verifySmtp','catch','values','length','Imap','password','Smtp','server','stringify','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','../../../config/logger','email','listen','sendMail','account','message','then'];(function(_0x3d2dbe,_0x57d31d){var _0x1e3d28=function(_0x4357b8){while(--_0x4357b8){_0x3d2dbe['push'](_0x3d2dbe['shift']());}};_0x1e3d28(++_0x57d31d);}(_0x16dc,0x1db));var _0xc16d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16dc[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var _=require(_0xc16d('0x0'));var logger=require(_0xc16d('0x1'))(_0xc16d('0x2'));exports[_0xc16d('0x3')]=function(_0x68106f,_0x5bda0){return new BPromise(function(_0x2061cb,_0x1524ab){var _0xa9c89d={'SendMail':function(_0x297253){var _0x4dd206=this;return new Promise(function(_0x31c5e0,_0x1971b8){_0x5bda0[_0xc16d('0x4')](_0x297253[_0xc16d('0x5')],_0x297253[_0xc16d('0x6')])[_0xc16d('0x7')](function(_0x304acf){_0x31c5e0({'code':0xc8,'message':_0x304acf});})['catch'](function(_0x5e43fa){_0x1971b8(_0x4dd206[_0xc16d('0x8')](0x1f4,_0x5e43fa));});});},'VerifySmtp':function(_0x4be04a){var _0x44452c=this;return new Promise(function(_0x30e0f6,_0x3c8cd0){_0x5bda0[_0xc16d('0x9')](_0x4be04a[_0xc16d('0x5')])['then'](function(_0x412ee2){_0x30e0f6({'code':0xc8,'message':'Verified'});})[_0xc16d('0xa')](function(_0x455484){_0x3c8cd0(_0x44452c[_0xc16d('0x8')](0x1f4,_0x455484));});});},'MailAccounts':function(_0x599b78){return new Promise(function(_0x202bbb,_0x401baa){var _0x20467f=_[_0xc16d('0xb')](_0x68106f['mailAccounts']);for(var _0x2722f7=0x0;_0x2722f7<_0x20467f[_0xc16d('0xc')];_0x2722f7+=0x1){if(_0x20467f[_0x2722f7][_0xc16d('0xd')]&&_0x20467f[_0x2722f7]['Imap'][_0xc16d('0xe')]){delete _0x20467f[_0x2722f7][_0xc16d('0xd')][_0xc16d('0xe')];}if(_0x20467f[_0x2722f7][_0xc16d('0xf')]&&_0x20467f[_0x2722f7][_0xc16d('0xf')]['pass']){delete _0x20467f[_0x2722f7]['Smtp']['pass'];}}_0x202bbb({'count':_0x20467f['length'],'rows':_0x20467f});});}};var _0x58f0b8=jayson[_0xc16d('0x10')](_0xa9c89d)['http']();_0x58f0b8['on']('error',function(_0x43f0a1){logger[_0xc16d('0x8')](JSON[_0xc16d('0x11')](_0x43f0a1));return _0x1524ab(_0x43f0a1);});_0x58f0b8[_0xc16d('0x3')](0x232b,_0xc16d('0x12'),function(){console['log'](_0xc16d('0x13'),0x232b);return _0x2061cb(_0xc16d('0x14')+0x232b);});});}; \ No newline at end of file +var _0xfe11=['log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','jayson/promise','bluebird','lodash','../../../config/logger','listen','sendMail','account','catch','error','verifySmtp','then','Verified','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1'];(function(_0x2aa503,_0x45bc03){var _0x548a5b=function(_0x1e6086){while(--_0x1e6086){_0x2aa503['push'](_0x2aa503['shift']());}};_0x548a5b(++_0x45bc03);}(_0xfe11,0x12e));var _0x1fe1=function(_0x276fae,_0x1424c1){_0x276fae=_0x276fae-0x0;var _0x132c7e=_0xfe11[_0x276fae];return _0x132c7e;};'use strict';var jayson=require(_0x1fe1('0x0'));var BPromise=require(_0x1fe1('0x1'));var _=require(_0x1fe1('0x2'));var logger=require(_0x1fe1('0x3'))('email');exports[_0x1fe1('0x4')]=function(_0xf9f340,_0x584f1b){return new BPromise(function(_0x4fd46b,_0xe50448){var _0x4e0a12={'SendMail':function(_0x224dcb){var _0x25e8af=this;return new Promise(function(_0x33878b,_0x3220e1){_0x584f1b[_0x1fe1('0x5')](_0x224dcb[_0x1fe1('0x6')],_0x224dcb['message'])['then'](function(_0x1707d0){_0x33878b({'code':0xc8,'message':_0x1707d0});})[_0x1fe1('0x7')](function(_0x1c342a){_0x3220e1(_0x25e8af[_0x1fe1('0x8')](0x1f4,_0x1c342a));});});},'VerifySmtp':function(_0x52b053){var _0x1d1b35=this;return new Promise(function(_0x558fea,_0x30cf4a){_0x584f1b[_0x1fe1('0x9')](_0x52b053[_0x1fe1('0x6')])[_0x1fe1('0xa')](function(_0x10034a){_0x558fea({'code':0xc8,'message':_0x1fe1('0xb')});})[_0x1fe1('0x7')](function(_0x3132a7){_0x30cf4a(_0x1d1b35['error'](0x1f4,_0x3132a7));});});},'MailAccounts':function(_0x2075cc){return new Promise(function(_0x9f35fa,_0x5346a3){var _0x243c43=_[_0x1fe1('0xc')](_0xf9f340[_0x1fe1('0xd')]);for(var _0x1903c2=0x0;_0x1903c2<_0x243c43[_0x1fe1('0xe')];_0x1903c2+=0x1){if(_0x243c43[_0x1903c2][_0x1fe1('0xf')]&&_0x243c43[_0x1903c2]['Imap'][_0x1fe1('0x10')]){delete _0x243c43[_0x1903c2]['Imap']['password'];}if(_0x243c43[_0x1903c2][_0x1fe1('0x11')]&&_0x243c43[_0x1903c2][_0x1fe1('0x11')][_0x1fe1('0x12')]){delete _0x243c43[_0x1903c2][_0x1fe1('0x11')][_0x1fe1('0x12')];}}_0x9f35fa({'count':_0x243c43[_0x1fe1('0xe')],'rows':_0x243c43});});}};var _0x2ef3c8=jayson[_0x1fe1('0x13')](_0x4e0a12)[_0x1fe1('0x14')]();_0x2ef3c8['on'](_0x1fe1('0x8'),function(_0x487f3a){logger[_0x1fe1('0x8')](JSON[_0x1fe1('0x15')](_0x487f3a));return _0xe50448(_0x487f3a);});_0x2ef3c8[_0x1fe1('0x4')](0x232b,_0x1fe1('0x16'),function(){console[_0x1fe1('0x17')](_0x1fe1('0x18'),0x232b);return _0x4fd46b('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 908df7c..ab949ea 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb99c=['log','http','ioredis','createServer','listen','port','socket.io','websocket','polling','redis','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x5d7bf1,_0x3571a6){var _0x309ad8=function(_0x2c0b14){while(--_0x2c0b14){_0x5d7bf1['push'](_0x5d7bf1['shift']());}};_0x309ad8(++_0x3571a6);}(_0xb99c,0x151));var _0xcb99=function(_0x53ae70,_0x14bd59){_0x53ae70=_0x53ae70-0x0;var _0x3247da=_0xb99c[_0x53ae70];return _0x3247da;};'use strict';var _=require('lodash');var http=require(_0xcb99('0x0'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xcb99('0x1'));var config=require('../../config/environment');var app=express();var server=http[_0xcb99('0x2')](app);server['timeout']=0xdbba0;if(sticky[_0xcb99('0x3')](server,config[_0xcb99('0x4')])){var socketio=require(_0xcb99('0x5'))(server,{'transports':[_0xcb99('0x6'),_0xcb99('0x7')]});config[_0xcb99('0x8')]=_['defaults'](config[_0xcb99('0x8')],{'host':'localhost','port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0xcb99('0x8')]),'subClient':new Redis(config[_0xcb99('0x8')])}));require('../../config/triggers')[_0xcb99('0x9')]();require(_0xcb99('0xa'))[_0xcb99('0x9')](socketio);require(_0xcb99('0xb'))[_0xcb99('0x9')](app);require(_0xcb99('0xc'))[_0xcb99('0x9')](app);}else{server[_0xcb99('0xd')](_0xcb99('0xe'),function(){console[_0xcb99('0xf')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xcb99('0x4')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xab0d=['listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','port','websocket','polling','redis','defaults','localhost','socket.io-redis','default','../../config/socketio','../../routes','once'];(function(_0x6cf5ec,_0x194d2e){var _0x271c4f=function(_0x206fee){while(--_0x206fee){_0x6cf5ec['push'](_0x6cf5ec['shift']());}};_0x271c4f(++_0x194d2e);}(_0xab0d,0x88));var _0xdab0=function(_0x13986e,_0x5c1415){_0x13986e=_0x13986e-0x0;var _0x421cfe=_0xab0d[_0x13986e];return _0x421cfe;};'use strict';var _=require(_0xdab0('0x0'));var http=require(_0xdab0('0x1'));var express=require(_0xdab0('0x2'));var sticky=require(_0xdab0('0x3'));var Redis=require(_0xdab0('0x4'));var config=require(_0xdab0('0x5'));var app=express();var server=http['createServer'](app);server[_0xdab0('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0xdab0('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0xdab0('0x8'),_0xdab0('0x9')]});config[_0xdab0('0xa')]=_[_0xdab0('0xb')](config['redis'],{'host':_0xdab0('0xc'),'port':0x18eb});socketio['adapter'](require(_0xdab0('0xd'))({'pubClient':new Redis(config[_0xdab0('0xa')]),'subClient':new Redis(config[_0xdab0('0xa')])}));require('../../config/triggers')[_0xdab0('0xe')]();require(_0xdab0('0xf'))[_0xdab0('0xe')](socketio);require('../../config/express')[_0xdab0('0xe')](app);require(_0xdab0('0x10'))[_0xdab0('0xe')](app);}else{server[_0xdab0('0x11')](_0xdab0('0x12'),function(){console[_0xdab0('0x13')](_0xdab0('0x14'),config[_0xdab0('0x7')]);});}exports=module[_0xdab0('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 9240284..9a4c7dc 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f42=['error','message','result','catch','jayson/promise','../../config/logger','routing','http','request','debug','rpc'];(function(_0x554134,_0x50d42c){var _0x2c8ab9=function(_0x270aad){while(--_0x270aad){_0x554134['push'](_0x554134['shift']());}};_0x2c8ab9(++_0x50d42c);}(_0x7f42,0x1dd));var _0x27f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f42[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x27f4('0x0'));var BPromise=require('bluebird');var logger=require(_0x27f4('0x1'))(_0x27f4('0x2'));var client=jayson['client'][_0x27f4('0x3')]({'port':0x2329});client['Request']=function(_0x10627e,_0x4e1ac1){return new BPromise(function(_0x2ca4b0,_0x55ed40){return client[_0x27f4('0x4')](_0x10627e,_0x4e1ac1)['then'](function(_0x256ac9){logger[_0x27f4('0x5')](_0x27f4('0x6'),_0x27f4('0x2'),_0x10627e,_0x4e1ac1,_0x256ac9);if(_0x256ac9[_0x27f4('0x7')]){logger[_0x27f4('0x7')](_0x27f4('0x6'),_0x27f4('0x2'),_0x10627e,_0x256ac9[_0x27f4('0x7')][_0x27f4('0x8')],_0x4e1ac1);return _0x55ed40(_0x256ac9[_0x27f4('0x7')][_0x27f4('0x8')]);}else{return _0x2ca4b0(_0x256ac9[_0x27f4('0x9')]);}})[_0x27f4('0xa')](function(_0x3b1d50){logger[_0x27f4('0x7')](_0x27f4('0x6'),_0x27f4('0x2'),_0x10627e,_0x3b1d50,_0x4e1ac1);return _0x55ed40(_0x3b1d50);});});};module['exports']=client; \ No newline at end of file +var _0xc23a=['exports','bluebird','../../config/logger','routing','http','request','then','rpc','error','message','catch'];(function(_0x5440d3,_0x68412d){var _0x49b20a=function(_0x328c52){while(--_0x328c52){_0x5440d3['push'](_0x5440d3['shift']());}};_0x49b20a(++_0x68412d);}(_0xc23a,0xd2));var _0xac23=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0xc23a[_0x254076];return _0x21a93e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xac23('0x0'));var logger=require(_0xac23('0x1'))(_0xac23('0x2'));var client=jayson['client'][_0xac23('0x3')]({'port':0x2329});client['Request']=function(_0x49c690,_0x35c541){return new BPromise(function(_0x4f104c,_0x3f2613){return client[_0xac23('0x4')](_0x49c690,_0x35c541)[_0xac23('0x5')](function(_0x4c1482){logger['debug'](_0xac23('0x6'),_0xac23('0x2'),_0x49c690,_0x35c541,_0x4c1482);if(_0x4c1482[_0xac23('0x7')]){logger['error'](_0xac23('0x6'),_0xac23('0x2'),_0x49c690,_0x4c1482[_0xac23('0x7')][_0xac23('0x8')],_0x35c541);return _0x3f2613(_0x4c1482['error']['message']);}else{return _0x4f104c(_0x4c1482['result']);}})[_0xac23('0x9')](function(_0x7d1836){logger['error'](_0xac23('0x6'),_0xac23('0x2'),_0x49c690,_0x7d1836,_0x35c541);return _0x3f2613(_0x7d1836);});});};module[_0xac23('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index db2bd68..af73b99 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd1c=['getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues'];(function(_0x3d439b,_0x4670bf){var _0x3a4d79=function(_0x207fb7){while(--_0x207fb7){_0x3d439b['push'](_0x3d439b['shift']());}};_0x3a4d79(++_0x4670bf);}(_0xbd1c,0xac));var _0xcbd1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbd1c[_0x4b369d];return _0x571a98;};'use strict';var BPromise=require(_0xcbd1('0x0'));var server=require(_0xcbd1('0x1'));var Realtime=require(_0xcbd1('0x2'));var user=require('./rpc/user');var interval=require(_0xcbd1('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xcbd1('0x4'));var smsQueue=require(_0xcbd1('0x5'));var mailQueue=require(_0xcbd1('0x6'));var faxQueue=require(_0xcbd1('0x7'));var whatsappQueue=require(_0xcbd1('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xcbd1('0x9')]()[_0xcbd1('0xa')](user[_0xcbd1('0xb')]())['then'](realtime[_0xcbd1('0xc')]())['then'](interval[_0xcbd1('0xd')]())[_0xcbd1('0xa')](realtime[_0xcbd1('0xe')]())[_0xcbd1('0xa')](openchannelQueue[_0xcbd1('0xf')]())[_0xcbd1('0xa')](realtime[_0xcbd1('0x10')]())[_0xcbd1('0xa')](chatQueue['getChatQueues']())['then'](realtime['initChatQueues']())[_0xcbd1('0xa')](smsQueue[_0xcbd1('0x11')]())[_0xcbd1('0xa')](realtime[_0xcbd1('0x12')]())[_0xcbd1('0xa')](mailQueue[_0xcbd1('0x13')]())[_0xcbd1('0xa')](realtime[_0xcbd1('0x14')]())[_0xcbd1('0xa')](faxQueue['getFaxQueues']())[_0xcbd1('0xa')](realtime[_0xcbd1('0x15')]())['then'](whatsappQueue[_0xcbd1('0x16')]())[_0xcbd1('0xa')](realtime[_0xcbd1('0x17')]())[_0xcbd1('0xa')](function(){return realtime;});}function main(){return server[_0xcbd1('0x18')](realtime)[_0xcbd1('0xa')](function(_0x31f59a){return initRealtime();})['then'](function(_0x234a97){return setInterval(initRealtime,0x1388);})[_0xcbd1('0x19')](function(_0x72f294){console[_0xcbd1('0x1a')](_0x72f294);});}main(); \ No newline at end of file +var _0x269b=['./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x55b569,_0x2dc805){var _0x5da38d=function(_0x244cfe){while(--_0x244cfe){_0x55b569['push'](_0x55b569['shift']());}};_0x5da38d(++_0x2dc805);}(_0x269b,0x1d5));var _0xb269=function(_0x3bf148,_0x1683ef){_0x3bf148=_0x3bf148-0x0;var _0x511781=_0x269b[_0x3bf148];return _0x511781;};'use strict';var BPromise=require(_0xb269('0x0'));var server=require(_0xb269('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xb269('0x2'));var openchannelQueue=require(_0xb269('0x3'));var chatQueue=require(_0xb269('0x4'));var smsQueue=require(_0xb269('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xb269('0x6'));var whatsappQueue=require(_0xb269('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb269('0x8')]()['then'](user['getAgents']())[_0xb269('0x9')](realtime['initAgents']())['then'](interval[_0xb269('0xa')]())[_0xb269('0x9')](realtime[_0xb269('0xb')]())[_0xb269('0x9')](openchannelQueue[_0xb269('0xc')]())[_0xb269('0x9')](realtime[_0xb269('0xd')]())[_0xb269('0x9')](chatQueue[_0xb269('0xe')]())['then'](realtime['initChatQueues']())[_0xb269('0x9')](smsQueue[_0xb269('0xf')]())[_0xb269('0x9')](realtime[_0xb269('0x10')]())[_0xb269('0x9')](mailQueue[_0xb269('0x11')]())[_0xb269('0x9')](realtime[_0xb269('0x12')]())[_0xb269('0x9')](faxQueue[_0xb269('0x13')]())[_0xb269('0x9')](realtime[_0xb269('0x14')]())[_0xb269('0x9')](whatsappQueue[_0xb269('0x15')]())[_0xb269('0x9')](realtime[_0xb269('0x16')]())[_0xb269('0x9')](function(){return realtime;});}function main(){return server[_0xb269('0x17')](realtime)[_0xb269('0x9')](function(_0x5c70d0){return initRealtime();})[_0xb269('0x9')](function(_0x36cfdd){return setInterval(initRealtime,0x1388);})['catch'](function(_0x2ce9d4){console[_0xb269('0x18')](_0x2ce9d4);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 26c5ea6..394cfd3 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb21=['orderBy','asc','clone','consequence','ruleRef','name','nextTick','call','next','isEqual','length','condition','matchPath','matches','turn','findRules','toJSON','toString','isString','parse','map','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','prototype','init','activeRules','rules','concat','push','sync','filter'];(function(_0x14e5c8,_0x3610d8){var _0x4c9ff6=function(_0x29dd06){while(--_0x29dd06){_0x14e5c8['push'](_0x14e5c8['shift']());}};_0x4c9ff6(++_0x3610d8);}(_0xcb21,0xf4));var _0x1cb2=function(_0x414cf2,_0x2136dd){_0x414cf2=_0x414cf2-0x0;var _0x27c0dc=_0xcb21[_0x414cf2];return _0x27c0dc;};'use strict';var _=require(_0x1cb2('0x0'));var util=require(_0x1cb2('0x1'));var EventEmitter=require(_0x1cb2('0x2'))[_0x1cb2('0x3')];function RuleEngine(_0xcff8b7,_0x7a97d4){this['init']();if(!_[_0x1cb2('0x4')](_0xcff8b7)){this[_0x1cb2('0x5')](_0xcff8b7);}if(_0x7a97d4){this[_0x1cb2('0x6')]=_0x7a97d4[_0x1cb2('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0x1cb2('0x7')][_0x1cb2('0x8')]=function(_0x5e5b28){this['rules']=[];this[_0x1cb2('0x9')]=[];};RuleEngine[_0x1cb2('0x7')]['register']=function(_0x8c6282){if(Array['isArray'](_0x8c6282)){this[_0x1cb2('0xa')]=this[_0x1cb2('0xa')][_0x1cb2('0xb')](_0x8c6282);}else if(_0x8c6282!==null&&_['isObject'](_0x8c6282)){this[_0x1cb2('0xa')][_0x1cb2('0xc')](_0x8c6282);}this[_0x1cb2('0xd')]();};RuleEngine[_0x1cb2('0x7')][_0x1cb2('0xd')]=function(){this[_0x1cb2('0x9')]=this['rules'][_0x1cb2('0xe')](function(_0x5d1963){if(_[_0x1cb2('0x4')](_0x5d1963['on'])){_0x5d1963['on']=!![];}if(_0x5d1963['on']===!![]){return _0x5d1963;}});this[_0x1cb2('0x9')]=_[_0x1cb2('0xf')](this['activeRules'],['p'],[_0x1cb2('0x10')]);};RuleEngine[_0x1cb2('0x7')]['execute']=function(_0x581a4e,_0x207b20){var _0x545731=![];_0x581a4e['result']=!![];var _0x528cce=_[_0x1cb2('0x11')](_0x581a4e);var _0x5206ce=_['clone'](_0x581a4e);var _0x3ae0c2=this['activeRules'];var _0x3ac289=[];var _0x36a98f=this['ignoreFactChanges'];(function FnRuleLoop(_0x2ef480){var _0x2d0b69={'rules':function(){return _0x3ae0c2;},'rule':function(){return _0x3ae0c2[_0x2ef480];},'when':function(_0x38751c){if(_0x38751c){var _0x24c213=_0x3ae0c2[_0x2ef480][_0x1cb2('0x12')];_0x24c213[_0x1cb2('0x13')]=_0x3ae0c2[_0x2ef480]['id']||_0x3ae0c2[_0x2ef480][_0x1cb2('0x14')]||'index_'+_0x2ef480;process[_0x1cb2('0x15')](function(){_0x3ac289['push'](_0x24c213['ruleRef']);_0x24c213[_0x1cb2('0x16')](_0x528cce,_0x2d0b69);});}else{process[_0x1cb2('0x15')](function(){_0x2d0b69[_0x1cb2('0x17')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x545731=!![];return FnRuleLoop(0x0);},'next':function(_0xac0858){if(!_0x36a98f&&!_[_0x1cb2('0x18')](_0x5206ce,_0x528cce)){_0x5206ce=_['clone'](_0x528cce);process[_0x1cb2('0x15')](function(){_0x2d0b69['restart']();});}else{process[_0x1cb2('0x15')](function(){if(_[_0x1cb2('0x4')](_0xac0858)){return FnRuleLoop(_0x2ef480+0x1);}else{return FnRuleLoop(_0xac0858);}});}}};if(_0x2ef480<_0x3ae0c2[_0x1cb2('0x19')]&&_0x545731===![]){var _0x474ccc=_0x3ae0c2[_0x2ef480][_0x1cb2('0x1a')];_0x474ccc[_0x1cb2('0x16')](_0x528cce,_0x2d0b69);}else{process[_0x1cb2('0x15')](function(){_0x528cce[_0x1cb2('0x1b')]=_0x3ac289;return _0x207b20?_0x207b20(_0x528cce):_['noop']();});}}(0x0));};RuleEngine[_0x1cb2('0x7')]['findRules']=function(_0x31407c){if(_[_0x1cb2('0x4')](_0x31407c)){return this[_0x1cb2('0xa')];}else{var _0x37b255=_[_0x1cb2('0x1c')](_0x31407c);return _['filter'](this[_0x1cb2('0xa')],_0x37b255);}};RuleEngine['prototype'][_0x1cb2('0x1d')]=function(_0x460149,_0x1b53e1){var _0x3f26c9=_0x460149==='on'||_0x460149==='ON'?!![]:![];var _0x16d0dc=this[_0x1cb2('0x1e')](_0x1b53e1);for(var _0x32e759=0x0,_0x587961=_0x16d0dc[_0x1cb2('0x19')];_0x32e759<_0x587961;_0x32e759+=0x1){_0x16d0dc[_0x32e759]['on']=_0x3f26c9;}this[_0x1cb2('0xd')]();};RuleEngine[_0x1cb2('0x7')]['prioritize']=function(_0x553d81,_0x15c989){_0x553d81=parseInt(_0x553d81,0xa);var _0x246d83=this['findRules'](_0x15c989);for(var _0x5afaed=0x0,_0x4610d4=_0x246d83[_0x1cb2('0x19')];_0x5afaed<_0x4610d4;_0x5afaed+=0x1){_0x246d83[_0x5afaed]['priority']=_0x553d81;}this[_0x1cb2('0xd')]();};RuleEngine[_0x1cb2('0x7')][_0x1cb2('0x1f')]=function(){var _0x42f00f=this['rules'];if(_0x42f00f instanceof Array){_0x42f00f=_0x42f00f['map'](function(_0xd9c5b8){_0xd9c5b8[_0x1cb2('0x1a')]=_0xd9c5b8[_0x1cb2('0x1a')]['toString']();_0xd9c5b8[_0x1cb2('0x12')]=_0xd9c5b8[_0x1cb2('0x12')][_0x1cb2('0x20')]();return _0xd9c5b8;});}else if(!_[_0x1cb2('0x4')](_0x42f00f)){_0x42f00f['condition']=_0x42f00f[_0x1cb2('0x1a')][_0x1cb2('0x20')]();_0x42f00f[_0x1cb2('0x12')]=_0x42f00f[_0x1cb2('0x12')][_0x1cb2('0x20')]();}return _0x42f00f;};RuleEngine['prototype']['fromJSON']=function(_0x3d507e){this[_0x1cb2('0x8')]();if(_[_0x1cb2('0x21')](_0x3d507e)){_0x3d507e=JSON[_0x1cb2('0x22')](_0x3d507e);}if(_0x3d507e instanceof Array){_0x3d507e=_0x3d507e[_0x1cb2('0x23')](function(_0x442d7b){_0x442d7b[_0x1cb2('0x1a')]=eval('('+_0x442d7b[_0x1cb2('0x1a')]+')');_0x442d7b[_0x1cb2('0x12')]=eval('('+_0x442d7b[_0x1cb2('0x12')]+')');return _0x442d7b;});}else if(_0x3d507e!==null&&typeof _0x3d507e=='object'){_0x3d507e[_0x1cb2('0x1a')]=eval('('+_0x3d507e['condition']+')');_0x3d507e[_0x1cb2('0x12')]=eval('('+_0x3d507e['consequence']+')');}this[_0x1cb2('0x5')](_0x3d507e);};module[_0x1cb2('0x24')]=RuleEngine; \ No newline at end of file +var _0x7f4d=['register','concat','isObject','sync','filter','asc','execute','clone','consequence','ruleRef','name','index_','push','nextTick','isEqual','restart','call','noop','matches','turn','findRules','length','prioritize','toJSON','map','condition','toString','fromJSON','isString','parse','object','exports','lodash','util','events','EventEmitter','init','isNil','ignoreFactChanges','prototype','rules','activeRules'];(function(_0x13c56b,_0x66e7c9){var _0xb828c6=function(_0x445614){while(--_0x445614){_0x13c56b['push'](_0x13c56b['shift']());}};_0xb828c6(++_0x66e7c9);}(_0x7f4d,0x19a));var _0xd7f4=function(_0x4ffdfb,_0x23562){_0x4ffdfb=_0x4ffdfb-0x0;var _0x9e2cf1=_0x7f4d[_0x4ffdfb];return _0x9e2cf1;};'use strict';var _=require(_0xd7f4('0x0'));var util=require(_0xd7f4('0x1'));var EventEmitter=require(_0xd7f4('0x2'))[_0xd7f4('0x3')];function RuleEngine(_0x341c3a,_0x3ddf10){this[_0xd7f4('0x4')]();if(!_[_0xd7f4('0x5')](_0x341c3a)){this['register'](_0x341c3a);}if(_0x3ddf10){this['ignoreFactChanges']=_0x3ddf10[_0xd7f4('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0xd7f4('0x7')][_0xd7f4('0x4')]=function(_0x4c859a){this[_0xd7f4('0x8')]=[];this[_0xd7f4('0x9')]=[];};RuleEngine[_0xd7f4('0x7')][_0xd7f4('0xa')]=function(_0x566fd1){if(Array['isArray'](_0x566fd1)){this[_0xd7f4('0x8')]=this[_0xd7f4('0x8')][_0xd7f4('0xb')](_0x566fd1);}else if(_0x566fd1!==null&&_[_0xd7f4('0xc')](_0x566fd1)){this[_0xd7f4('0x8')]['push'](_0x566fd1);}this[_0xd7f4('0xd')]();};RuleEngine[_0xd7f4('0x7')]['sync']=function(){this[_0xd7f4('0x9')]=this[_0xd7f4('0x8')][_0xd7f4('0xe')](function(_0x416325){if(_[_0xd7f4('0x5')](_0x416325['on'])){_0x416325['on']=!![];}if(_0x416325['on']===!![]){return _0x416325;}});this[_0xd7f4('0x9')]=_['orderBy'](this[_0xd7f4('0x9')],['p'],[_0xd7f4('0xf')]);};RuleEngine[_0xd7f4('0x7')][_0xd7f4('0x10')]=function(_0x34ce0f,_0xd5e118){var _0x1b3cd2=![];_0x34ce0f['result']=!![];var _0x933763=_['clone'](_0x34ce0f);var _0x144d47=_[_0xd7f4('0x11')](_0x34ce0f);var _0x2ceac1=this[_0xd7f4('0x9')];var _0x2d4bab=[];var _0x2f10c6=this[_0xd7f4('0x6')];(function FnRuleLoop(_0x5cdf56){var _0x10b7a2={'rules':function(){return _0x2ceac1;},'rule':function(){return _0x2ceac1[_0x5cdf56];},'when':function(_0x2d29cf){if(_0x2d29cf){var _0x39648f=_0x2ceac1[_0x5cdf56][_0xd7f4('0x12')];_0x39648f[_0xd7f4('0x13')]=_0x2ceac1[_0x5cdf56]['id']||_0x2ceac1[_0x5cdf56][_0xd7f4('0x14')]||_0xd7f4('0x15')+_0x5cdf56;process['nextTick'](function(){_0x2d4bab[_0xd7f4('0x16')](_0x39648f[_0xd7f4('0x13')]);_0x39648f['call'](_0x933763,_0x10b7a2);});}else{process[_0xd7f4('0x17')](function(){_0x10b7a2['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x1b3cd2=!![];return FnRuleLoop(0x0);},'next':function(_0x204b42){if(!_0x2f10c6&&!_[_0xd7f4('0x18')](_0x144d47,_0x933763)){_0x144d47=_[_0xd7f4('0x11')](_0x933763);process[_0xd7f4('0x17')](function(){_0x10b7a2[_0xd7f4('0x19')]();});}else{process['nextTick'](function(){if(_['isNil'](_0x204b42)){return FnRuleLoop(_0x5cdf56+0x1);}else{return FnRuleLoop(_0x204b42);}});}}};if(_0x5cdf56<_0x2ceac1['length']&&_0x1b3cd2===![]){var _0x3f5056=_0x2ceac1[_0x5cdf56]['condition'];_0x3f5056[_0xd7f4('0x1a')](_0x933763,_0x10b7a2);}else{process[_0xd7f4('0x17')](function(){_0x933763['matchPath']=_0x2d4bab;return _0xd5e118?_0xd5e118(_0x933763):_[_0xd7f4('0x1b')]();});}}(0x0));};RuleEngine[_0xd7f4('0x7')]['findRules']=function(_0x66f2b2){if(_[_0xd7f4('0x5')](_0x66f2b2)){return this[_0xd7f4('0x8')];}else{var _0x58bed7=_[_0xd7f4('0x1c')](_0x66f2b2);return _['filter'](this[_0xd7f4('0x8')],_0x58bed7);}};RuleEngine[_0xd7f4('0x7')][_0xd7f4('0x1d')]=function(_0x57d278,_0x59eda3){var _0xb38130=_0x57d278==='on'||_0x57d278==='ON'?!![]:![];var _0x5ee4b2=this[_0xd7f4('0x1e')](_0x59eda3);for(var _0x40edf9=0x0,_0x4e6414=_0x5ee4b2[_0xd7f4('0x1f')];_0x40edf9<_0x4e6414;_0x40edf9+=0x1){_0x5ee4b2[_0x40edf9]['on']=_0xb38130;}this[_0xd7f4('0xd')]();};RuleEngine[_0xd7f4('0x7')][_0xd7f4('0x20')]=function(_0x1a1e9f,_0x30cf23){_0x1a1e9f=parseInt(_0x1a1e9f,0xa);var _0x4951a9=this[_0xd7f4('0x1e')](_0x30cf23);for(var _0x2c2781=0x0,_0x2e2d5a=_0x4951a9[_0xd7f4('0x1f')];_0x2c2781<_0x2e2d5a;_0x2c2781+=0x1){_0x4951a9[_0x2c2781]['priority']=_0x1a1e9f;}this['sync']();};RuleEngine['prototype'][_0xd7f4('0x21')]=function(){var _0x5c038b=this[_0xd7f4('0x8')];if(_0x5c038b instanceof Array){_0x5c038b=_0x5c038b[_0xd7f4('0x22')](function(_0x14525c){_0x14525c['condition']=_0x14525c[_0xd7f4('0x23')][_0xd7f4('0x24')]();_0x14525c[_0xd7f4('0x12')]=_0x14525c[_0xd7f4('0x12')]['toString']();return _0x14525c;});}else if(!_[_0xd7f4('0x5')](_0x5c038b)){_0x5c038b['condition']=_0x5c038b[_0xd7f4('0x23')][_0xd7f4('0x24')]();_0x5c038b[_0xd7f4('0x12')]=_0x5c038b['consequence'][_0xd7f4('0x24')]();}return _0x5c038b;};RuleEngine['prototype'][_0xd7f4('0x25')]=function(_0x401047){this[_0xd7f4('0x4')]();if(_[_0xd7f4('0x26')](_0x401047)){_0x401047=JSON[_0xd7f4('0x27')](_0x401047);}if(_0x401047 instanceof Array){_0x401047=_0x401047[_0xd7f4('0x22')](function(_0x5005f7){_0x5005f7['condition']=eval('('+_0x5005f7[_0xd7f4('0x23')]+')');_0x5005f7[_0xd7f4('0x12')]=eval('('+_0x5005f7[_0xd7f4('0x12')]+')');return _0x5005f7;});}else if(_0x401047!==null&&typeof _0x401047==_0xd7f4('0x28')){_0x401047['condition']=eval('('+_0x401047[_0xd7f4('0x23')]+')');_0x401047[_0xd7f4('0x12')]=eval('('+_0x401047['consequence']+')');}this[_0xd7f4('0xa')](_0x401047);};module[_0xd7f4('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 6dc7db3..56c7473 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x58b705,_0x4b9456){var _0x4554bd=function(_0x274f22){while(--_0x274f22){_0x58b705['push'](_0x58b705['shift']());}};_0x4554bd(++_0x4b9456);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x490d46,_0x4ae5e4){var _0x1e3f73=function(_0x3b6fe9){while(--_0x3b6fe9){_0x490d46['push'](_0x490d46['shift']());}};_0x1e3f73(++_0x4ae5e4);}(_0x814b,0x1a2));var _0xb814=function(_0x5b2c7e,_0x3d22f0){_0x5b2c7e=_0x5b2c7e-0x0;var _0x5ec399=_0x814b[_0x5b2c7e];return _0x5ec399;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 7538e2c..bbe8e11 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66d3=['mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','chat','openchannel','fax','sms','length','StatusTime','toNumber','format','Status','chatCapacity','mailCurrentCapacity','faxStatusTime','faxCurrentCapacity','smsCurrentCapacity','openchannelStatusTime','stringify','user:save','exports','lodash','md5','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause'];(function(_0x97a2c4,_0x3de24e){var _0x2e1ddc=function(_0x3663b3){while(--_0x3663b3){_0x97a2c4['push'](_0x97a2c4['shift']());}};_0x2e1ddc(++_0x3de24e);}(_0x66d3,0x10f));var _0x366d=function(_0x1f5541,_0x28fc66){_0x1f5541=_0x1f5541-0x0;var _0x59e68d=_0x66d3[_0x1f5541];return _0x59e68d;};'use strict';var _=require(_0x366d('0x0'));var moment=require('moment');var md5=require(_0x366d('0x1'));var Redis=require('ioredis');var config=require(_0x366d('0x2'));config[_0x366d('0x3')]=_['defaults'](config[_0x366d('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x366d('0x4'))(new Redis(config['redis']));function Agent(_0x33a0c2){this['id']=_0x33a0c2['id']||0x0;this[_0x366d('0x5')]=_0x33a0c2[_0x366d('0x5')]||'';this[_0x366d('0x6')]=_0x33a0c2[_0x366d('0x6')]||!![];this[_0x366d('0x7')]=_0x33a0c2[_0x366d('0x7')]||![];this[_0x366d('0x8')]=_0x33a0c2[_0x366d('0x8')]||![];this[_0x366d('0x9')]=_0x33a0c2[_0x366d('0x9')]||![];this['faxPause']=_0x33a0c2[_0x366d('0xa')]||![];this[_0x366d('0xb')]=_0x33a0c2[_0x366d('0xb')]||![];this[_0x366d('0xc')]=_0x33a0c2[_0x366d('0xc')]||![];this[_0x366d('0xd')]=_0x366d('0xe');this[_0x366d('0xf')]=0x0;this['chatCapacity']=_0x33a0c2['chatCapacity']||0x0;this[_0x366d('0x10')]=0x0;this[_0x366d('0x11')]=_0x366d('0xe');this[_0x366d('0x12')]=0x0;this[_0x366d('0x13')]=_0x33a0c2[_0x366d('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x366d('0x14')]=_0x366d('0xe');this['faxStatusTime']=0x0;this[_0x366d('0x15')]=_0x33a0c2[_0x366d('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x366d('0x16')]=_0x366d('0xe');this[_0x366d('0x17')]=0x0;this['smsCapacity']=_0x33a0c2[_0x366d('0x18')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x366d('0x19')]=_0x366d('0xe');this['whatsappStatusTime']=0x0;this[_0x366d('0x1a')]=_0x33a0c2[_0x366d('0x1a')]||0x0;this[_0x366d('0x1b')]=0x0;this[_0x366d('0x1c')]=_0x366d('0xe');this['openchannelStatusTime']=0x0;this[_0x366d('0x1d')]=_0x33a0c2['openchannelCapacity']||0x0;this[_0x366d('0x1e')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x366d('0x1')]='';this[_0x366d('0x1f')]();}Agent['prototype'][_0x366d('0x20')]=function(_0x37ec6d){if(this[_0x37ec6d+_0x366d('0x21')]>0x0){if(this[_0x37ec6d+_0x366d('0x22')]>0x0&&this[_0x37ec6d+_0x366d('0x21')]>=this[_0x37ec6d+_0x366d('0x22')]){return'maxcapacity';}else{return _0x366d('0x23');}}else{return _0x366d('0x24');}};Agent[_0x366d('0x25')][_0x366d('0x1f')]=function(){var _0x46bf52=['mail',_0x366d('0x26'),_0x366d('0x27'),_0x366d('0x28'),_0x366d('0x29'),'whatsapp'];for(var _0x5aec17=0x0;_0x5aec17<_0x46bf52[_0x366d('0x2a')];_0x5aec17+=0x1){var _0x40f3df=this['getChannelStatus'](_0x46bf52[_0x5aec17]);if(this[_0x46bf52[_0x5aec17]+'Status']!==_0x40f3df){this[_0x46bf52[_0x5aec17]+_0x366d('0x2b')]=_[_0x366d('0x2c')](moment()[_0x366d('0x2d')]('x'));}this[_0x46bf52[_0x5aec17]+_0x366d('0x2e')]=_0x40f3df;}var _0x552c86={'id':this['id'],'name':this[_0x366d('0x5')],'online':this['online'],'voicePause':this[_0x366d('0x7')],'chatPause':this[_0x366d('0x8')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x366d('0xa')],'openchannelPause':this[_0x366d('0xc')],'chatStatus':this[_0x366d('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x366d('0x2f')],'chatCurrentCapacity':this[_0x366d('0x10')],'mailStatus':this[_0x366d('0x11')],'mailStatusTime':this[_0x366d('0x12')],'mailCapacity':this[_0x366d('0x13')],'mailCurrentCapacity':this[_0x366d('0x30')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x366d('0x31')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x366d('0x32')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x366d('0x17')],'smsCapacity':this[_0x366d('0x18')],'smsCurrentCapacity':this[_0x366d('0x33')],'whatsappStatus':this[_0x366d('0x19')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x366d('0x1a')],'whatsappCurrentCapacity':this[_0x366d('0x1b')],'openchannelStatus':this[_0x366d('0x1c')],'openchannelStatusTime':this[_0x366d('0x34')],'openchannelCapacity':this[_0x366d('0x1d')],'openchannelCurrentCapacity':this[_0x366d('0x1e')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0xb1797=md5(JSON[_0x366d('0x35')](_0x552c86));if(this[_0x366d('0x1')]!==_0xb1797){this[_0x366d('0x1')]=_0xb1797;io['emit'](_0x366d('0x36'),_0x552c86);}};module[_0x366d('0x37')]=Agent; \ No newline at end of file +var _0x49f8=['Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','chatPause','chatStatusTime','whatsappStatus','openchannelCurrentCapacity','stringify','emit','lodash','ioredis','../../../config/environment','defaults','localhost','redis','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x49f8,0xff));var _0x849f=function(_0x376f18,_0x58c69c){_0x376f18=_0x376f18-0x0;var _0x4cc104=_0x49f8[_0x376f18];return _0x4cc104;};'use strict';var _=require(_0x849f('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x849f('0x1'));var config=require(_0x849f('0x2'));config['redis']=_[_0x849f('0x3')](config['redis'],{'host':_0x849f('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x849f('0x5')]));function Agent(_0x590f53){this['id']=_0x590f53['id']||0x0;this[_0x849f('0x6')]=_0x590f53[_0x849f('0x6')]||'';this[_0x849f('0x7')]=_0x590f53[_0x849f('0x7')]||!![];this[_0x849f('0x8')]=_0x590f53[_0x849f('0x8')]||![];this['chatPause']=_0x590f53['chatPause']||![];this['mailPause']=_0x590f53[_0x849f('0x9')]||![];this[_0x849f('0xa')]=_0x590f53[_0x849f('0xa')]||![];this[_0x849f('0xb')]=_0x590f53[_0x849f('0xb')]||![];this[_0x849f('0xc')]=_0x590f53[_0x849f('0xc')]||![];this['chatStatus']=_0x849f('0xd');this['chatStatusTime']=0x0;this[_0x849f('0xe')]=_0x590f53[_0x849f('0xe')]||0x0;this[_0x849f('0xf')]=0x0;this[_0x849f('0x10')]='unknown';this[_0x849f('0x11')]=0x0;this[_0x849f('0x12')]=_0x590f53[_0x849f('0x12')]||0x0;this[_0x849f('0x13')]=0x0;this[_0x849f('0x14')]='unknown';this['faxStatusTime']=0x0;this[_0x849f('0x15')]=_0x590f53['faxCapacity']||0x0;this[_0x849f('0x16')]=0x0;this[_0x849f('0x17')]=_0x849f('0xd');this[_0x849f('0x18')]=0x0;this[_0x849f('0x19')]=_0x590f53[_0x849f('0x19')]||0x0;this[_0x849f('0x1a')]=0x0;this['whatsappStatus']=_0x849f('0xd');this[_0x849f('0x1b')]=0x0;this[_0x849f('0x1c')]=_0x590f53['whatsappCapacity']||0x0;this[_0x849f('0x1d')]=0x0;this[_0x849f('0x1e')]='unknown';this[_0x849f('0x1f')]=0x0;this[_0x849f('0x20')]=_0x590f53['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x849f('0x21')]=![];this[_0x849f('0x22')]=undefined;this[_0x849f('0x23')]='';this[_0x849f('0x24')]();}Agent[_0x849f('0x25')][_0x849f('0x26')]=function(_0x27ea23){if(this[_0x27ea23+_0x849f('0x27')]>0x0){if(this[_0x27ea23+'Capacity']>0x0&&this[_0x27ea23+_0x849f('0x27')]>=this[_0x27ea23+_0x849f('0x28')]){return _0x849f('0x29');}else{return _0x849f('0x2a');}}else{return _0x849f('0x2b');}};Agent['prototype'][_0x849f('0x24')]=function(){var _0x32be69=[_0x849f('0x2c'),_0x849f('0x2d'),_0x849f('0x2e'),_0x849f('0x2f'),_0x849f('0x30'),_0x849f('0x31')];for(var _0x28f180=0x0;_0x28f180<_0x32be69[_0x849f('0x32')];_0x28f180+=0x1){var _0x21be89=this[_0x849f('0x26')](_0x32be69[_0x28f180]);if(this[_0x32be69[_0x28f180]+_0x849f('0x33')]!==_0x21be89){this[_0x32be69[_0x28f180]+'StatusTime']=_[_0x849f('0x34')](moment()['format']('x'));}this[_0x32be69[_0x28f180]+_0x849f('0x33')]=_0x21be89;}var _0xf27d76={'id':this['id'],'name':this[_0x849f('0x6')],'online':this[_0x849f('0x7')],'voicePause':this[_0x849f('0x8')],'chatPause':this[_0x849f('0x35')],'mailPause':this['mailPause'],'smsPause':this[_0x849f('0xb')],'faxPause':this[_0x849f('0xa')],'openchannelPause':this[_0x849f('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x849f('0x36')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x849f('0xf')],'mailStatus':this[_0x849f('0x10')],'mailStatusTime':this[_0x849f('0x11')],'mailCapacity':this[_0x849f('0x12')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x849f('0x14')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x849f('0x15')],'faxCurrentCapacity':this[_0x849f('0x16')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x849f('0x1a')],'whatsappStatus':this[_0x849f('0x37')],'whatsappStatusTime':this[_0x849f('0x1b')],'whatsappCapacity':this[_0x849f('0x1c')],'whatsappCurrentCapacity':this[_0x849f('0x1d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x849f('0x1f')],'openchannelCapacity':this[_0x849f('0x20')],'openchannelCurrentCapacity':this[_0x849f('0x38')],'busy':this[_0x849f('0x21')],'busyQueue':this[_0x849f('0x22')]};var _0x37b567=md5(JSON[_0x849f('0x39')](_0xf27d76));if(this[_0x849f('0x23')]!==_0x37b567){this[_0x849f('0x23')]=_0x37b567;io[_0x849f('0x3a')]('user:save',_0xf27d76);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 72aefea..5accfe7 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 _0x08e0=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','paused','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x08e0,0x66));var _0x008e=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x08e0[_0x680821];return _0x3f132c;};'use strict';var _=require('lodash');var md5=require(_0x008e('0x0'));var util=require(_0x008e('0x1'));var Redis=require(_0x008e('0x2'));var config=require(_0x008e('0x3'));config[_0x008e('0x4')]=_[_0x008e('0x5')](config['redis'],{'host':_0x008e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x008e('0x4')]));function ChatQueue(_0x3cfec3){this['id']=_0x3cfec3['id']||0x0;this[_0x008e('0x7')]=_0x3cfec3[_0x008e('0x7')]||'';this[_0x008e('0x8')]=_0x3cfec3['timeout']||0xa;this[_0x008e('0x9')]=_0x3cfec3[_0x008e('0x9')]||_0x008e('0xa');this[_0x008e('0xb')]=_0x3cfec3[_0x008e('0xb')];this[_0x008e('0xc')]={};this[_0x008e('0xd')]=0x0;this[_0x008e('0x0')]='';this[_0x008e('0xe')]();this[_0x008e('0xf')]();}ChatQueue[_0x008e('0x10')]['updateRouting']=function(){var _0x19b72c=this[_0x008e('0xc')][_0x008e('0x11')];this[_0x008e('0xc')]=_[_0x008e('0x12')](this[_0x008e('0xb')],'id');this[_0x008e('0xc')]['_rr']=_0x19b72c;};ChatQueue[_0x008e('0x10')]['updateRealtime']=function(){this[_0x008e('0x13')]=0x0;this['paused']=0x0;for(var _0x5bd219=0x0;_0x5bd219=0x0?this['available']:0x0;var _0x31b655={'id':this['id'],'available':this['available'],'loggedIn':this[_0x008e('0x13')],'name':this['name'],'paused':this[_0x008e('0x15')],'waiting':this[_0x008e('0xd')]};var _0x1da3e5=md5(JSON[_0x008e('0x17')](_0x31b655));if(this[_0x008e('0x0')]!==_0x1da3e5){this['md5']=_0x1da3e5;io['to'](util[_0x008e('0x18')](_0x008e('0x19'),_0x31b655['name']))['emit'](_0x008e('0x1a'),_0x31b655);}};module[_0x008e('0x1b')]=ChatQueue; \ No newline at end of file +var _0x12ce=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','md5','util','../../../config/environment'];(function(_0x37d2d9,_0x331da0){var _0x3e7d98=function(_0x2bb1c5){while(--_0x2bb1c5){_0x37d2d9['push'](_0x37d2d9['shift']());}};_0x3e7d98(++_0x331da0);}(_0x12ce,0x192));var _0xe12c=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x12ce[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var md5=require(_0xe12c('0x0'));var util=require(_0xe12c('0x1'));var Redis=require('ioredis');var config=require(_0xe12c('0x2'));config[_0xe12c('0x3')]=_[_0xe12c('0x4')](config['redis'],{'host':_0xe12c('0x5'),'port':0x18eb});var io=require(_0xe12c('0x6'))(new Redis(config[_0xe12c('0x3')]));function ChatQueue(_0xf91277){this['id']=_0xf91277['id']||0x0;this['name']=_0xf91277[_0xe12c('0x7')]||'';this[_0xe12c('0x8')]=_0xf91277[_0xe12c('0x8')]||0xa;this[_0xe12c('0x9')]=_0xf91277['strategy']||'beepall';this[_0xe12c('0xa')]=_0xf91277[_0xe12c('0xa')];this[_0xe12c('0xb')]={};this[_0xe12c('0xc')]=0x0;this[_0xe12c('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xe12c('0xd')][_0xe12c('0xe')]=function(){var _0x2c8439=this[_0xe12c('0xb')]['_rr'];this[_0xe12c('0xb')]=_[_0xe12c('0xf')](this['Agents'],'id');this[_0xe12c('0xb')][_0xe12c('0x10')]=_0x2c8439;};ChatQueue[_0xe12c('0xd')]['updateRealtime']=function(){this[_0xe12c('0x11')]=0x0;this[_0xe12c('0x12')]=0x0;for(var _0x2bbf2e=0x0;_0x2bbf2e=0x0?this[_0xe12c('0x16')]:0x0;var _0x5d305f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe12c('0x11')],'name':this[_0xe12c('0x7')],'paused':this[_0xe12c('0x12')],'waiting':this[_0xe12c('0xc')]};var _0x31d183=md5(JSON[_0xe12c('0x17')](_0x5d305f));if(this['md5']!==_0x31d183){this[_0xe12c('0x0')]=_0x31d183;io['to'](util[_0xe12c('0x18')](_0xe12c('0x19'),_0x5d305f['name']))[_0xe12c('0x1a')]('chat_queue:save',_0x5d305f);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 516a67a..39678b0 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(_0xd582ac,_0x4c28f3){var _0x52d5fc=function(_0x4e32d1){while(--_0x4e32d1){_0xd582ac['push'](_0xd582ac['shift']());}};_0x52d5fc(++_0x4c28f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x207109,_0x3bbb89){var _0x197429=function(_0x8cf3a6){while(--_0x8cf3a6){_0x207109['push'](_0x207109['shift']());}};_0x197429(++_0x3bbb89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 96e79d3..f419c5a 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 _0xf9fa=['name','Intervals','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf9fa,0x1b6));var _0xaf9f=function(_0x5d395d,_0x5b35da){_0x5d395d=_0x5d395d-0x0;var _0x290fad=_0xf9fa[_0x5d395d];return _0x290fad;};'use strict';function Interval(_0x2f7a1b){this['id']=_0x2f7a1b['id']||0x0;this[_0xaf9f('0x0')]=_0x2f7a1b[_0xaf9f('0x0')]||'';this[_0xaf9f('0x1')]=_0x2f7a1b[_0xaf9f('0x1')]||{};}module[_0xaf9f('0x2')]=Interval; \ No newline at end of file +var _0x6b8f=['Intervals','exports'];(function(_0x5d8010,_0x7463b){var _0x1099c2=function(_0x5b61ce){while(--_0x5b61ce){_0x5d8010['push'](_0x5d8010['shift']());}};_0x1099c2(++_0x7463b);}(_0x6b8f,0x138));var _0xf6b8=function(_0x15f558,_0x196557){_0x15f558=_0x15f558-0x0;var _0x50a3e9=_0x6b8f[_0x15f558];return _0x50a3e9;};'use strict';function Interval(_0x4fac87){this['id']=_0x4fac87['id']||0x0;this['name']=_0x4fac87['name']||'';this[_0xf6b8('0x0')]=_0x4fac87[_0xf6b8('0x0')]||{};}module[_0xf6b8('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index a8303f8..e5cf287 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 _0x3dda=['emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','_rr','mapAgentsId','prototype','loggedIn','paused','length','online','mailPause','available','stringify','format'];(function(_0x239220,_0x3f21d2){var _0x1151cd=function(_0x4077fb){while(--_0x4077fb){_0x239220['push'](_0x239220['shift']());}};_0x1151cd(++_0x3f21d2);}(_0x3dda,0x1a7));var _0xa3dd=function(_0x6bddc3,_0x36563e){_0x6bddc3=_0x6bddc3-0x0;var _0x868581=_0x3dda[_0x6bddc3];return _0x868581;};'use strict';var _=require(_0xa3dd('0x0'));var md5=require(_0xa3dd('0x1'));var util=require(_0xa3dd('0x2'));var Redis=require(_0xa3dd('0x3'));var config=require(_0xa3dd('0x4'));config[_0xa3dd('0x5')]=_[_0xa3dd('0x6')](config['redis'],{'host':_0xa3dd('0x7'),'port':0x18eb});var io=require(_0xa3dd('0x8'))(new Redis(config[_0xa3dd('0x5')]));function MailQueue(_0x350fa2){this['id']=_0x350fa2['id']||0x0;this['name']=_0x350fa2[_0xa3dd('0x9')]||'';this[_0xa3dd('0xa')]=_0x350fa2[_0xa3dd('0xa')]||0xa;this[_0xa3dd('0xb')]=_0x350fa2[_0xa3dd('0xb')]||_0xa3dd('0xc');this['Agents']=_0x350fa2[_0xa3dd('0xd')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xa3dd('0x1')]='';this[_0xa3dd('0xe')]();this[_0xa3dd('0xf')]();}MailQueue['prototype'][_0xa3dd('0xe')]=function(){var _0x10919e=this['mapAgentsId'][_0xa3dd('0x10')];this[_0xa3dd('0x11')]=_['map'](this[_0xa3dd('0xd')],'id');this[_0xa3dd('0x11')][_0xa3dd('0x10')]=_0x10919e;};MailQueue[_0xa3dd('0x12')][_0xa3dd('0xf')]=function(){this[_0xa3dd('0x13')]=0x0;this[_0xa3dd('0x14')]=0x0;for(var _0x1791ed=0x0;_0x1791ed=0x0?this['available']:0x0;var _0x3733ec={'id':this['id'],'available':this[_0xa3dd('0x18')],'loggedIn':this[_0xa3dd('0x13')],'name':this[_0xa3dd('0x9')],'paused':this[_0xa3dd('0x14')],'waiting':this['waiting']};var _0x86eae0=md5(JSON[_0xa3dd('0x19')](_0x3733ec));if(this[_0xa3dd('0x1')]!==_0x86eae0){this['md5']=_0x86eae0;io['to'](util[_0xa3dd('0x1a')]('mail:queue:%s',_0x3733ec[_0xa3dd('0x9')]))[_0xa3dd('0x1b')](_0xa3dd('0x1c'),_0x3733ec);}};module[_0xa3dd('0x1d')]=MailQueue; \ No newline at end of file +var _0x59fd=['redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','available','stringify','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x178a60,_0x3b374b){var _0x14731e=function(_0x35aa2c){while(--_0x35aa2c){_0x178a60['push'](_0x178a60['shift']());}};_0x14731e(++_0x3b374b);}(_0x59fd,0x1f3));var _0xd59f=function(_0x4b66f1,_0x3290d5){_0x4b66f1=_0x4b66f1-0x0;var _0x4487e0=_0x59fd[_0x4b66f1];return _0x4487e0;};'use strict';var _=require(_0xd59f('0x0'));var md5=require(_0xd59f('0x1'));var util=require(_0xd59f('0x2'));var Redis=require(_0xd59f('0x3'));var config=require(_0xd59f('0x4'));config[_0xd59f('0x5')]=_[_0xd59f('0x6')](config[_0xd59f('0x5')],{'host':_0xd59f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd59f('0x5')]));function MailQueue(_0x479cc9){this['id']=_0x479cc9['id']||0x0;this[_0xd59f('0x8')]=_0x479cc9['name']||'';this['timeout']=_0x479cc9[_0xd59f('0x9')]||0xa;this[_0xd59f('0xa')]=_0x479cc9[_0xd59f('0xa')]||_0xd59f('0xb');this['Agents']=_0x479cc9[_0xd59f('0xc')];this[_0xd59f('0xd')]={};this[_0xd59f('0xe')]=0x0;this[_0xd59f('0x1')]='';this[_0xd59f('0xf')]();this[_0xd59f('0x10')]();}MailQueue['prototype'][_0xd59f('0xf')]=function(){var _0x6ca6d7=this[_0xd59f('0xd')][_0xd59f('0x11')];this[_0xd59f('0xd')]=_['map'](this[_0xd59f('0xc')],'id');this[_0xd59f('0xd')]['_rr']=_0x6ca6d7;};MailQueue[_0xd59f('0x12')][_0xd59f('0x10')]=function(){this[_0xd59f('0x13')]=0x0;this[_0xd59f('0x14')]=0x0;for(var _0x48cbdc=0x0;_0x48cbdc=0x0?this[_0xd59f('0x16')]:0x0;var _0x2c2868={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd59f('0x13')],'name':this[_0xd59f('0x8')],'paused':this[_0xd59f('0x14')],'waiting':this['waiting']};var _0x4b19f7=md5(JSON[_0xd59f('0x17')](_0x2c2868));if(this['md5']!==_0x4b19f7){this[_0xd59f('0x1')]=_0x4b19f7;io['to'](util[_0xd59f('0x18')]('mail:queue:%s',_0x2c2868[_0xd59f('0x8')]))[_0xd59f('0x19')](_0xd59f('0x1a'),_0x2c2868);}};module[_0xd59f('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 11b0c02..90a72a4 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 _0x43ea=['emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','openchannelPause','paused','available','stringify','format','openchannel:queue:%s'];(function(_0x1ccb95,_0x1b3be8){var _0x1a9725=function(_0x1a6bf7){while(--_0x1a6bf7){_0x1ccb95['push'](_0x1ccb95['shift']());}};_0x1a9725(++_0x1b3be8);}(_0x43ea,0x189));var _0xa43e=function(_0x14cbd5,_0x14f59e){_0x14cbd5=_0x14cbd5-0x0;var _0x50f998=_0x43ea[_0x14cbd5];return _0x50f998;};'use strict';var _=require(_0xa43e('0x0'));var md5=require(_0xa43e('0x1'));var util=require(_0xa43e('0x2'));var Redis=require(_0xa43e('0x3'));var config=require(_0xa43e('0x4'));config[_0xa43e('0x5')]=_[_0xa43e('0x6')](config[_0xa43e('0x5')],{'host':_0xa43e('0x7'),'port':0x18eb});var io=require(_0xa43e('0x8'))(new Redis(config[_0xa43e('0x5')]));function OpenchannelQueue(_0x33851c){this['id']=_0x33851c['id']||0x0;this[_0xa43e('0x9')]=_0x33851c[_0xa43e('0x9')]||'';this[_0xa43e('0xa')]=_0x33851c[_0xa43e('0xa')]||0xa;this[_0xa43e('0xb')]=_0x33851c['strategy']||_0xa43e('0xc');this['Agents']=_0x33851c[_0xa43e('0xd')];this['mapAgentsId']={};this[_0xa43e('0xe')]=0x0;this[_0xa43e('0x1')]='';this[_0xa43e('0xf')]();this[_0xa43e('0x10')]();}OpenchannelQueue[_0xa43e('0x11')]['updateRouting']=function(){var _0xaec412=this[_0xa43e('0x12')][_0xa43e('0x13')];this[_0xa43e('0x12')]=_['map'](this['Agents'],'id');this[_0xa43e('0x12')][_0xa43e('0x13')]=_0xaec412;};OpenchannelQueue[_0xa43e('0x11')][_0xa43e('0x10')]=function(){this[_0xa43e('0x14')]=0x0;this['paused']=0x0;for(var _0x1e969d=0x0;_0x1e969d=0x0?this[_0xa43e('0x17')]:0x0;var _0x38040b={'id':this['id'],'available':this[_0xa43e('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xa43e('0x9')],'paused':this[_0xa43e('0x16')],'waiting':this[_0xa43e('0xe')]};var _0x130a43=md5(JSON[_0xa43e('0x18')](_0x38040b));if(this[_0xa43e('0x1')]!==_0x130a43){this[_0xa43e('0x1')]=_0x130a43;io['to'](util[_0xa43e('0x19')](_0xa43e('0x1a'),_0x38040b[_0xa43e('0x9')]))[_0xa43e('0x1b')](_0xa43e('0x1c'),_0x38040b);}};module[_0xa43e('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x33b1=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','map','_rr','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','exports'];(function(_0x34d22f,_0x156cc0){var _0x448818=function(_0xda5702){while(--_0xda5702){_0x34d22f['push'](_0x34d22f['shift']());}};_0x448818(++_0x156cc0);}(_0x33b1,0x12c));var _0x133b=function(_0x54851d,_0xff2a0e){_0x54851d=_0x54851d-0x0;var _0xfa0d22=_0x33b1[_0x54851d];return _0xfa0d22;};'use strict';var _=require(_0x133b('0x0'));var md5=require(_0x133b('0x1'));var util=require(_0x133b('0x2'));var Redis=require(_0x133b('0x3'));var config=require(_0x133b('0x4'));config[_0x133b('0x5')]=_[_0x133b('0x6')](config[_0x133b('0x5')],{'host':_0x133b('0x7'),'port':0x18eb});var io=require(_0x133b('0x8'))(new Redis(config[_0x133b('0x5')]));function OpenchannelQueue(_0xe7b1d7){this['id']=_0xe7b1d7['id']||0x0;this[_0x133b('0x9')]=_0xe7b1d7[_0x133b('0x9')]||'';this['timeout']=_0xe7b1d7[_0x133b('0xa')]||0xa;this['strategy']=_0xe7b1d7[_0x133b('0xb')]||_0x133b('0xc');this[_0x133b('0xd')]=_0xe7b1d7[_0x133b('0xd')];this[_0x133b('0xe')]={};this[_0x133b('0xf')]=0x0;this[_0x133b('0x1')]='';this[_0x133b('0x10')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x133b('0x10')]=function(){var _0x1d64e5=this[_0x133b('0xe')]['_rr'];this[_0x133b('0xe')]=_[_0x133b('0x11')](this[_0x133b('0xd')],'id');this[_0x133b('0xe')][_0x133b('0x12')]=_0x1d64e5;};OpenchannelQueue[_0x133b('0x13')]['updateRealtime']=function(){this[_0x133b('0x14')]=0x0;this[_0x133b('0x15')]=0x0;for(var _0x5e6ee3=0x0;_0x5e6ee3=0x0?this[_0x133b('0x18')]:0x0;var _0x5076f0={'id':this['id'],'available':this[_0x133b('0x18')],'loggedIn':this[_0x133b('0x14')],'name':this[_0x133b('0x9')],'paused':this['paused'],'waiting':this[_0x133b('0xf')]};var _0x586caa=md5(JSON[_0x133b('0x19')](_0x5076f0));if(this[_0x133b('0x1')]!==_0x586caa){this['md5']=_0x586caa;io['to'](util[_0x133b('0x1a')](_0x133b('0x1b'),_0x5076f0[_0x133b('0x9')]))[_0x133b('0x1c')]('openchannel_queue:save',_0x5076f0);}};module[_0x133b('0x1d')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 86eff10..572012a 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 _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x355de0,_0x3e1d21){_0x355de0=_0x355de0-0x0;var _0xad0de2=_0xb10b[_0x355de0];return _0xad0de2;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e78db,_0x5ab8a1){_0x2e78db=_0x2e78db-0x0;var _0x195fb4=_0xb10b[_0x2e78db];return _0x195fb4;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};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 cacdf2e..9e4292d 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 _0x231d=['exports','lodash','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x231d,0x1b1));var _0xd231=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x231d[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd231('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xd231('0x1')]=_['defaults'](config[_0xd231('0x1')],{'host':_0xd231('0x2'),'port':0x18eb});var io=require(_0xd231('0x3'))(new Redis(config[_0xd231('0x1')]));function WhatsappQueue(_0x380543){this['id']=_0x380543['id']||0x0;this[_0xd231('0x4')]=_0x380543['name']||'';this[_0xd231('0x5')]=_0x380543['timeout']||0xa;this['strategy']=_0x380543[_0xd231('0x6')]||_0xd231('0x7');this[_0xd231('0x8')]=_0x380543[_0xd231('0x8')];this[_0xd231('0x9')]={};this[_0xd231('0xa')]=0x0;this[_0xd231('0xb')]='';this[_0xd231('0xc')]();this[_0xd231('0xd')]();}WhatsappQueue[_0xd231('0xe')][_0xd231('0xc')]=function(){var _0x106f88=this[_0xd231('0x9')][_0xd231('0xf')];this[_0xd231('0x9')]=_['map'](this[_0xd231('0x8')],'id');this[_0xd231('0x9')][_0xd231('0xf')]=_0x106f88;};WhatsappQueue['prototype'][_0xd231('0xd')]=function(){this[_0xd231('0x10')]=0x0;this[_0xd231('0x11')]=0x0;for(var _0x372f62=0x0;_0x372f62=0x0?this[_0xd231('0x15')]:0x0;var _0xfcd30c={'id':this['id'],'available':this[_0xd231('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xd231('0x11')],'waiting':this[_0xd231('0xa')]};var _0x4d1f93=md5(JSON[_0xd231('0x16')](_0xfcd30c));if(this[_0xd231('0xb')]!==_0x4d1f93){this['md5']=_0x4d1f93;io['to'](util['format'](_0xd231('0x17'),_0xfcd30c[_0xd231('0x4')]))[_0xd231('0x18')](_0xd231('0x19'),_0xfcd30c);}};module[_0xd231('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xcaa4=['loggedIn','paused','Agents','length','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x40c596,_0x723936){var _0x3ab17d=function(_0x5425fd){while(--_0x5425fd){_0x40c596['push'](_0x40c596['shift']());}};_0x3ab17d(++_0x723936);}(_0xcaa4,0x183));var _0x4caa=function(_0x616e34,_0x3a24d1){_0x616e34=_0x616e34-0x0;var _0x19c6b6=_0xcaa4[_0x616e34];return _0x19c6b6;};'use strict';var _=require(_0x4caa('0x0'));var md5=require(_0x4caa('0x1'));var util=require('util');var Redis=require(_0x4caa('0x2'));var config=require(_0x4caa('0x3'));config[_0x4caa('0x4')]=_[_0x4caa('0x5')](config[_0x4caa('0x4')],{'host':_0x4caa('0x6'),'port':0x18eb});var io=require(_0x4caa('0x7'))(new Redis(config[_0x4caa('0x4')]));function WhatsappQueue(_0x49a2e8){this['id']=_0x49a2e8['id']||0x0;this[_0x4caa('0x8')]=_0x49a2e8[_0x4caa('0x8')]||'';this['timeout']=_0x49a2e8[_0x4caa('0x9')]||0xa;this[_0x4caa('0xa')]=_0x49a2e8[_0x4caa('0xa')]||_0x4caa('0xb');this['Agents']=_0x49a2e8['Agents'];this[_0x4caa('0xc')]={};this[_0x4caa('0xd')]=0x0;this[_0x4caa('0x1')]='';this[_0x4caa('0xe')]();this[_0x4caa('0xf')]();}WhatsappQueue[_0x4caa('0x10')][_0x4caa('0xe')]=function(){var _0x37905e=this[_0x4caa('0xc')][_0x4caa('0x11')];this[_0x4caa('0xc')]=_[_0x4caa('0x12')](this['Agents'],'id');this['mapAgentsId'][_0x4caa('0x11')]=_0x37905e;};WhatsappQueue[_0x4caa('0x10')]['updateRealtime']=function(){this[_0x4caa('0x13')]=0x0;this[_0x4caa('0x14')]=0x0;for(var _0x57a387=0x0;_0x57a387=0x0?this[_0x4caa('0x17')]:0x0;var _0x136be2={'id':this['id'],'available':this[_0x4caa('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x4caa('0x8')],'paused':this[_0x4caa('0x14')],'waiting':this[_0x4caa('0xd')]};var _0x517967=md5(JSON['stringify'](_0x136be2));if(this[_0x4caa('0x1')]!==_0x517967){this[_0x4caa('0x1')]=_0x517967;io['to'](util[_0x4caa('0x18')](_0x4caa('0x19'),_0x136be2[_0x4caa('0x8')]))[_0x4caa('0x1a')](_0x4caa('0x1b'),_0x136be2);}};module[_0x4caa('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 a975e71..46404df 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 _0x55ca=['initAgents','length','isUndefined','mergeFromDatabase','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initSmsQueues','initFaxQueues','faxQueues','exports','bluebird','util','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55ca,0x126));var _0xa55c=function(_0x48b4a1,_0x3c2bf4){_0x48b4a1=_0x48b4a1-0x0;var _0x2df379=_0x55ca[_0x48b4a1];return _0x2df379;};'use strict';var BPromise=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0xa55c('0x2'));var OpenchannelQueue=require(_0xa55c('0x3'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xa55c('0x4'));var MailQueue=require(_0xa55c('0x5'));var FaxQueue=require(_0xa55c('0x6'));var WhatsappQueue=require(_0xa55c('0x7'));var Realtime=function(){this[_0xa55c('0x8')]={};this[_0xa55c('0x9')]={};this[_0xa55c('0xa')]={};this['chatQueues']={};this[_0xa55c('0xb')]={};this[_0xa55c('0xc')]={};this['faxQueues']={};this[_0xa55c('0xd')]={};this[_0xa55c('0xe')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xa55c('0xf')]={};this[_0xa55c('0x10')]={};this[_0xa55c('0x11')]={};};function freeIsNotKey(_0x5d8e5a,_0x31646d,_0xe6d826){var _0x508342=_[_0xa55c('0x12')](_0x5d8e5a,function(_0x3998f7,_0x15eec8){return _0x3998f7[_0xe6d826];});for(var _0x5d47ff in _0x31646d){if(_0x31646d['hasOwnProperty'](_0x5d47ff)){if(!_0x508342[_0x5d47ff]){delete _0x31646d[_0x5d47ff];}}}}Realtime[_0xa55c('0x13')]['mergeFromDatabase']=function(_0x5a3672,_0x59ea8d){for(var _0x18ee85 in _0x59ea8d){if(_0x5a3672[_0xa55c('0x14')](_0x18ee85)){_0x5a3672[_0x18ee85]=_0x59ea8d[_0x18ee85];}}};Realtime[_0xa55c('0x13')][_0xa55c('0x15')]=function(){var _0x458480=this;return function(_0x247e77){if(_0x247e77){freeIsNotKey(_0x247e77,_0x458480['agents'],'id');for(var _0x3ccf65=0x0,_0x3dcf4f={},_0x25934f={};_0x3ccf65<_0x247e77[_0xa55c('0x16')];_0x3ccf65+=0x1){_0x3dcf4f=_0x247e77[_0x3ccf65];if(_[_0xa55c('0x17')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']])){_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']]=new Agent(_0x3dcf4f);}else{_0x458480[_0xa55c('0x18')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']],_0x3dcf4f);}}}return _0x458480['agents'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x19')]=function(){var _0x461284=this;return function(_0x358b61){if(_0x358b61){freeIsNotKey(_0x358b61,_0x461284[_0xa55c('0x9')],'id');for(var _0x5426e5=0x0,_0x4c0daf={},_0x5f5158={};_0x5426e5<_0x358b61[_0xa55c('0x16')];_0x5426e5+=0x1){_0x4c0daf=_0x358b61[_0x5426e5];if(_[_0xa55c('0x17')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']])){_0x461284['intervals'][_0x4c0daf['id']]=new Interval(_0x4c0daf);}else{_0x461284[_0xa55c('0x18')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']],_0x4c0daf);}}}return _0x461284['intervals'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1a')]=function(){var _0x940f28=this;return function(_0x1965f1){if(_0x1965f1){freeIsNotKey(_0x1965f1,_0x940f28[_0xa55c('0xa')],'id');for(var _0x49ed04=0x0,_0x1fc828={},_0x504c24={};_0x49ed04<_0x1965f1['length'];_0x49ed04+=0x1){_0x1fc828=_0x1965f1[_0x49ed04];if(_['isUndefined'](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']])){_0x940f28['openchannelQueues'][_0x1fc828['id']]=new OpenchannelQueue(_0x1fc828);}else{_0x940f28[_0xa55c('0x18')](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']],_0x1fc828);}_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1b')]();_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1c')]();}}return _0x940f28[_0xa55c('0xa')];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1d')]=function(){var _0x3cd152=this;return function(_0x1273d7){if(_0x1273d7){freeIsNotKey(_0x1273d7,_0x3cd152['chatQueues'],'id');for(var _0x430d55=0x0,_0x28814f={},_0x1c9f6b={};_0x430d55<_0x1273d7[_0xa55c('0x16')];_0x430d55+=0x1){_0x28814f=_0x1273d7[_0x430d55];if(_['isUndefined'](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']])){_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']]=new ChatQueue(_0x28814f);}else{_0x3cd152[_0xa55c('0x18')](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']],_0x28814f);}_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']][_0xa55c('0x1b')]();_0x3cd152['chatQueues'][_0x28814f['id']][_0xa55c('0x1c')]();}}return _0x3cd152['chatQueues'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1f')]=function(){var _0x1cc53e=this;return function(_0x223813){if(_0x223813){freeIsNotKey(_0x223813,_0x1cc53e['smsQueues'],'id');for(var _0x3d28fb=0x0,_0x2096ae={},_0x331e58={};_0x3d28fb<_0x223813[_0xa55c('0x16')];_0x3d28fb+=0x1){_0x2096ae=_0x223813[_0x3d28fb];if(_[_0xa55c('0x17')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']])){_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']]=new SmsQueue(_0x2096ae);}else{_0x1cc53e[_0xa55c('0x18')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']],_0x2096ae);}_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']][_0xa55c('0x1b')]();_0x1cc53e['smsQueues'][_0x2096ae['id']]['updateRealtime']();}}return _0x1cc53e[_0xa55c('0xb')];};};Realtime[_0xa55c('0x13')]['initMailQueues']=function(){var _0x30fadd=this;return function(_0x2f0110){if(_0x2f0110){freeIsNotKey(_0x2f0110,_0x30fadd[_0xa55c('0xc')],'id');for(var _0x1839ac=0x0,_0x30d4f8={},_0x38ff96={};_0x1839ac<_0x2f0110[_0xa55c('0x16')];_0x1839ac+=0x1){_0x30d4f8=_0x2f0110[_0x1839ac];if(_[_0xa55c('0x17')](_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']])){_0x30fadd['mailQueues'][_0x30d4f8['id']]=new MailQueue(_0x30d4f8);}else{_0x30fadd['mergeFromDatabase'](_0x30fadd['mailQueues'][_0x30d4f8['id']],_0x30d4f8);}_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']][_0xa55c('0x1b')]();_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']]['updateRealtime']();}}return _0x30fadd[_0xa55c('0xc')];};};Realtime['prototype'][_0xa55c('0x20')]=function(){var _0x4ad813=this;return function(_0x18c6f1){if(_0x18c6f1){freeIsNotKey(_0x18c6f1,_0x4ad813[_0xa55c('0x21')],'id');for(var _0x3c0ec1=0x0,_0x4d3eb5={},_0x7c4a47={};_0x3c0ec1<_0x18c6f1[_0xa55c('0x16')];_0x3c0ec1+=0x1){_0x4d3eb5=_0x18c6f1[_0x3c0ec1];if(_['isUndefined'](_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']])){_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]=new FaxQueue(_0x4d3eb5);}else{_0x4ad813['mergeFromDatabase'](_0x4ad813['faxQueues'][_0x4d3eb5['id']],_0x4d3eb5);}_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]['updateRouting']();_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']][_0xa55c('0x1c')]();}}return _0x4ad813['faxQueues'];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x4de781=this;return function(_0x3b3308){if(_0x3b3308){freeIsNotKey(_0x3b3308,_0x4de781[_0xa55c('0xd')],'id');for(var _0x429336=0x0,_0x99c4f8={},_0x2d8cbf={};_0x429336<_0x3b3308['length'];_0x429336+=0x1){_0x99c4f8=_0x3b3308[_0x429336];if(_[_0xa55c('0x17')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']])){_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]=new WhatsappQueue(_0x99c4f8);}else{_0x4de781[_0xa55c('0x18')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']],_0x99c4f8);}_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRouting']();_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRealtime']();}}return _0x4de781['whatsappQueues'];};};module[_0xa55c('0x22')]=Realtime; \ No newline at end of file +var _0x4b84=['../model/agent','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','chatQueues','mailQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','agents','isUndefined','mergeFromDatabase','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','bluebird','util'];(function(_0xf78968,_0x3bbbf0){var _0x195640=function(_0x5f7c86){while(--_0x5f7c86){_0xf78968['push'](_0xf78968['shift']());}};_0x195640(++_0x3bbbf0);}(_0x4b84,0x1cc));var _0x44b8=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x4b84[_0x54d4a8];return _0x3b321b;};'use strict';var BPromise=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x44b8('0x2'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x44b8('0x3'));var SmsQueue=require(_0x44b8('0x4'));var MailQueue=require(_0x44b8('0x5'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this[_0x44b8('0x6')]={};this['openchannelQueues']={};this[_0x44b8('0x7')]={};this['smsQueues']={};this[_0x44b8('0x8')]={};this['faxQueues']={};this['whatsappQueues']={};this[_0x44b8('0x9')]={};this[_0x44b8('0xa')]={};this[_0x44b8('0xb')]={};this['smsQueuesWaitingInteractions']={};this[_0x44b8('0xc')]={};this[_0x44b8('0xd')]={};};function freeIsNotKey(_0x4315f6,_0x9b6048,_0x24dd10){var _0x37e471=_[_0x44b8('0xe')](_0x4315f6,function(_0x4ae8a1,_0x147529){return _0x4ae8a1[_0x24dd10];});for(var _0x4301a6 in _0x9b6048){if(_0x9b6048['hasOwnProperty'](_0x4301a6)){if(!_0x37e471[_0x4301a6]){delete _0x9b6048[_0x4301a6];}}}}Realtime[_0x44b8('0xf')]['mergeFromDatabase']=function(_0x833ea3,_0x18d642){for(var _0x4df670 in _0x18d642){if(_0x833ea3[_0x44b8('0x10')](_0x4df670)){_0x833ea3[_0x4df670]=_0x18d642[_0x4df670];}}};Realtime['prototype']['initAgents']=function(){var _0x2a3e4c=this;return function(_0x2af0ad){if(_0x2af0ad){freeIsNotKey(_0x2af0ad,_0x2a3e4c[_0x44b8('0x11')],'id');for(var _0x41ab46=0x0,_0x5e52f2={},_0x495c74={};_0x41ab46<_0x2af0ad['length'];_0x41ab46+=0x1){_0x5e52f2=_0x2af0ad[_0x41ab46];if(_[_0x44b8('0x12')](_0x2a3e4c['agents'][_0x5e52f2['id']])){_0x2a3e4c[_0x44b8('0x11')][_0x5e52f2['id']]=new Agent(_0x5e52f2);}else{_0x2a3e4c[_0x44b8('0x13')](_0x2a3e4c['agents'][_0x5e52f2['id']],_0x5e52f2);}}}return _0x2a3e4c[_0x44b8('0x11')];};};Realtime[_0x44b8('0xf')]['initIntervals']=function(){var _0x89bc30=this;return function(_0x3f4688){if(_0x3f4688){freeIsNotKey(_0x3f4688,_0x89bc30['intervals'],'id');for(var _0xcce202=0x0,_0x8b4301={},_0xebfe79={};_0xcce202<_0x3f4688[_0x44b8('0x14')];_0xcce202+=0x1){_0x8b4301=_0x3f4688[_0xcce202];if(_[_0x44b8('0x12')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']])){_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']]=new Interval(_0x8b4301);}else{_0x89bc30[_0x44b8('0x13')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']],_0x8b4301);}}}return _0x89bc30[_0x44b8('0x6')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x15')]=function(){var _0x48327e=this;return function(_0x56549a){if(_0x56549a){freeIsNotKey(_0x56549a,_0x48327e[_0x44b8('0x16')],'id');for(var _0x416b34=0x0,_0x1418db={},_0x305a5c={};_0x416b34<_0x56549a['length'];_0x416b34+=0x1){_0x1418db=_0x56549a[_0x416b34];if(_[_0x44b8('0x12')](_0x48327e['openchannelQueues'][_0x1418db['id']])){_0x48327e[_0x44b8('0x16')][_0x1418db['id']]=new OpenchannelQueue(_0x1418db);}else{_0x48327e[_0x44b8('0x13')](_0x48327e[_0x44b8('0x16')][_0x1418db['id']],_0x1418db);}_0x48327e[_0x44b8('0x16')][_0x1418db['id']][_0x44b8('0x17')]();_0x48327e['openchannelQueues'][_0x1418db['id']][_0x44b8('0x18')]();}}return _0x48327e['openchannelQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x19')]=function(){var _0x549a26=this;return function(_0x17ac44){if(_0x17ac44){freeIsNotKey(_0x17ac44,_0x549a26[_0x44b8('0x7')],'id');for(var _0x2656d7=0x0,_0x59c1bf={},_0xb22107={};_0x2656d7<_0x17ac44[_0x44b8('0x14')];_0x2656d7+=0x1){_0x59c1bf=_0x17ac44[_0x2656d7];if(_['isUndefined'](_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']])){_0x549a26['chatQueues'][_0x59c1bf['id']]=new ChatQueue(_0x59c1bf);}else{_0x549a26[_0x44b8('0x13')](_0x549a26['chatQueues'][_0x59c1bf['id']],_0x59c1bf);}_0x549a26['chatQueues'][_0x59c1bf['id']]['updateRouting']();_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']][_0x44b8('0x18')]();}}return _0x549a26[_0x44b8('0x7')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1a')]=function(){var _0xc3f667=this;return function(_0x2cf205){if(_0x2cf205){freeIsNotKey(_0x2cf205,_0xc3f667[_0x44b8('0x1b')],'id');for(var _0xd1d320=0x0,_0x28f918={},_0x5e1129={};_0xd1d320<_0x2cf205[_0x44b8('0x14')];_0xd1d320+=0x1){_0x28f918=_0x2cf205[_0xd1d320];if(_[_0x44b8('0x12')](_0xc3f667['smsQueues'][_0x28f918['id']])){_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']]=new SmsQueue(_0x28f918);}else{_0xc3f667['mergeFromDatabase'](_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']],_0x28f918);}_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x17')]();_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x18')]();}}return _0xc3f667['smsQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1c')]=function(){var _0x26265f=this;return function(_0x339f0f){if(_0x339f0f){freeIsNotKey(_0x339f0f,_0x26265f[_0x44b8('0x8')],'id');for(var _0x5f541d=0x0,_0x3875a5={},_0x400edc={};_0x5f541d<_0x339f0f[_0x44b8('0x14')];_0x5f541d+=0x1){_0x3875a5=_0x339f0f[_0x5f541d];if(_[_0x44b8('0x12')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']])){_0x26265f[_0x44b8('0x8')][_0x3875a5['id']]=new MailQueue(_0x3875a5);}else{_0x26265f[_0x44b8('0x13')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']],_0x3875a5);}_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x17')]();_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x18')]();}}return _0x26265f[_0x44b8('0x8')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1d')]=function(){var _0x1becb0=this;return function(_0x323c50){if(_0x323c50){freeIsNotKey(_0x323c50,_0x1becb0[_0x44b8('0x1e')],'id');for(var _0x28faa9=0x0,_0x3984f8={},_0x2c02d6={};_0x28faa9<_0x323c50[_0x44b8('0x14')];_0x28faa9+=0x1){_0x3984f8=_0x323c50[_0x28faa9];if(_['isUndefined'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']])){_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]=new FaxQueue(_0x3984f8);}else{_0x1becb0['mergeFromDatabase'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']],_0x3984f8);}_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']][_0x44b8('0x17')]();_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]['updateRealtime']();}}return _0x1becb0[_0x44b8('0x1e')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1f')]=function(){var _0x1ee3cc=this;return function(_0x9cb2a){if(_0x9cb2a){freeIsNotKey(_0x9cb2a,_0x1ee3cc[_0x44b8('0x20')],'id');for(var _0x46aadd=0x0,_0x3581b8={},_0x209039={};_0x46aadd<_0x9cb2a[_0x44b8('0x14')];_0x46aadd+=0x1){_0x3581b8=_0x9cb2a[_0x46aadd];if(_[_0x44b8('0x12')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']])){_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]=new WhatsappQueue(_0x3581b8);}else{_0x1ee3cc[_0x44b8('0x13')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']],_0x3581b8);}_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]['updateRouting']();_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']][_0x44b8('0x18')]();}}return _0x1ee3cc[_0x44b8('0x20')];};};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 811d5af..48606c1 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 _0x868d=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x868d,0xd2));var _0xd868=function(_0x334cc8,_0xeb25ff){_0x334cc8=_0x334cc8-0x0;var _0x4cf940=_0x868d[_0x334cc8];return _0x4cf940;};'use strict';var client=require(_0xd868('0x0'));exports[_0xd868('0x1')]=function(_0x425631,_0x3299f2){return client[_0xd868('0x2')](_0xd868('0x3'),{'body':_0x3299f2,'options':{'where':{'id':_0x425631}},'log':_0xd868('0x4')});};exports[_0xd868('0x5')]=function(_0x2a1da5,_0x578310){return client[_0xd868('0x2')](_0xd868('0x6'),{'body':_0x578310,'options':{'where':{'id':_0x2a1da5}},'log':_0xd868('0x7')});}; \ No newline at end of file +var _0x58d9=['addTagsToChatInteraction','../client','update','Request','addTags','AddTagsToChatInteraction'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x58d9,0x103));var _0x958d=function(_0x144849,_0x1367bf){_0x144849=_0x144849-0x0;var _0x2b644a=_0x58d9[_0x144849];return _0x2b644a;};'use strict';var client=require(_0x958d('0x0'));exports[_0x958d('0x1')]=function(_0x3814cb,_0x437b41){return client[_0x958d('0x2')]('UpdateChatInteraction',{'body':_0x437b41,'options':{'where':{'id':_0x3814cb}},'log':'updateChatInteraction'});};exports[_0x958d('0x3')]=function(_0x90fe8,_0x2caf46){return client['Request'](_0x958d('0x4'),{'body':_0x2caf46,'options':{'where':{'id':_0x90fe8}},'log':_0x958d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a6ab919..f4da746 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 _0x3bf3=['CreateChatMessage','../client','create','Request'];(function(_0x4b8817,_0x4ba882){var _0x306949=function(_0x4fd847){while(--_0x4fd847){_0x4b8817['push'](_0x4b8817['shift']());}};_0x306949(++_0x4ba882);}(_0x3bf3,0xd5));var _0x33bf=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x3bf3[_0xf26c2e];return _0x46ecb4;};'use strict';var client=require(_0x33bf('0x0'));exports[_0x33bf('0x1')]=function(_0x3c7340){return client[_0x33bf('0x2')](_0x33bf('0x3'),{'body':_0x3c7340,'log':'createChatMessage'});}; \ No newline at end of file +var _0x8ee2=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x2e927e,_0xb88eef){var _0x24586b=function(_0x43e6db){while(--_0x43e6db){_0x2e927e['push'](_0x2e927e['shift']());}};_0x24586b(++_0xb88eef);}(_0x8ee2,0x1f3));var _0x28ee=function(_0xb7bee1,_0x14be2f){_0xb7bee1=_0xb7bee1-0x0;var _0x45eff6=_0x8ee2[_0xb7bee1];return _0x45eff6;};'use strict';var client=require(_0x28ee('0x0'));exports[_0x28ee('0x1')]=function(_0x50eb12){return client[_0x28ee('0x2')](_0x28ee('0x3'),{'body':_0x50eb12,'log':_0x28ee('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 5f62b16..803614c 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 _0x2a41=['Request','GetChatQueue','timeout','User','chatPause','getChatQueues'];(function(_0x4f8457,_0x4175af){var _0x720f1d=function(_0x5d7541){while(--_0x5d7541){_0x4f8457['push'](_0x4f8457['shift']());}};_0x720f1d(++_0x4175af);}(_0x2a41,0xcb));var _0x12a4=function(_0x25b274,_0x578748){_0x25b274=_0x25b274-0x0;var _0x367046=_0x2a41[_0x25b274];return _0x367046;};'use strict';var client=require('../client');exports[_0x12a4('0x0')]=function(){return function(){return client[_0x12a4('0x1')](_0x12a4('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x12a4('0x3'),'strategy'],'include':[{'model':_0x12a4('0x4'),'as':'Agents','attributes':['id','name','online',_0x12a4('0x5')]}]},'log':_0x12a4('0x0')});};}; \ No newline at end of file +var _0x5451=['strategy','User','Agents','online','chatPause','getChatQueues','../client','GetChatQueue','name'];(function(_0x34b4d2,_0xe92e1c){var _0x449ca2=function(_0x242102){while(--_0x242102){_0x34b4d2['push'](_0x34b4d2['shift']());}};_0x449ca2(++_0xe92e1c);}(_0x5451,0x138));var _0x1545=function(_0x13ef84,_0x24442f){_0x13ef84=_0x13ef84-0x0;var _0x53e70e=_0x5451[_0x13ef84];return _0x53e70e;};'use strict';var client=require(_0x1545('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x1545('0x1'),{'options':{'raw':![],'attributes':['id',_0x1545('0x2'),'timeout',_0x1545('0x3')],'include':[{'model':_0x1545('0x4'),'as':_0x1545('0x5'),'attributes':['id',_0x1545('0x2'),_0x1545('0x6'),_0x1545('0x7')]}]},'log':_0x1545('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3940a89..999d09e 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 _0x0851=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0851,0x8a));var _0x1085=function(_0x39dae4,_0x58a305){_0x39dae4=_0x39dae4-0x0;var _0x39ab08=_0x0851[_0x39dae4];return _0x39ab08;};'use strict';var client=require(_0x1085('0x0'));exports[_0x1085('0x1')]=function(_0x219feb){return client[_0x1085('0x2')]('CreateChatQueueReport',{'body':_0x219feb,'log':_0x1085('0x3')});};exports[_0x1085('0x4')]=function(_0x2de96f,_0x3cbd88){return client[_0x1085('0x2')](_0x1085('0x5'),{'body':_0x3cbd88,'options':{'where':{'uniqueid':_0x2de96f},'order':[['id',_0x1085('0x6')]],'limit':0x1},'log':_0x1085('0x5')});}; \ No newline at end of file +var _0xfd28=['update','UpdateChatQueueReport','DESC','create','CreateChatQueueReport'];(function(_0x3f98ac,_0x4013b2){var _0x465117=function(_0x2cbc9a){while(--_0x2cbc9a){_0x3f98ac['push'](_0x3f98ac['shift']());}};_0x465117(++_0x4013b2);}(_0xfd28,0x148));var _0x8fd2=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xfd28[_0x533e4e];return _0x1f14bb;};'use strict';var client=require('../client');exports[_0x8fd2('0x0')]=function(_0x117219){return client['Request'](_0x8fd2('0x1'),{'body':_0x117219,'log':'CreateChatQueueReport'});};exports[_0x8fd2('0x2')]=function(_0xf7417d,_0x4e2108){return client['Request'](_0x8fd2('0x3'),{'body':_0x4e2108,'options':{'where':{'uniqueid':_0xf7417d},'order':[['id',_0x8fd2('0x4')]],'limit':0x1},'log':_0x8fd2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a6e726d..fb30a8e 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 _0x74d2=['Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2a12c1,_0x20dd3d){var _0xd296c4=function(_0x2e5e6e){while(--_0x2e5e6e){_0x2a12c1['push'](_0x2a12c1['shift']());}};_0xd296c4(++_0x20dd3d);}(_0x74d2,0xad));var _0x274d=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x74d2[_0x1627ae];return _0x34b38f;};'use strict';var client=require(_0x274d('0x0'));exports[_0x274d('0x1')]=function(_0x15a341,_0x6b0677){return client[_0x274d('0x2')](_0x274d('0x3'),{'body':_0x6b0677,'options':{'where':{'id':_0x15a341}},'log':_0x274d('0x4')});};exports[_0x274d('0x5')]=function(_0x471860,_0x2016af){return client['Request'](_0x274d('0x6'),{'body':_0x2016af,'options':{'where':{'id':_0x471860}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x0634=['addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update'];(function(_0x41106b,_0xf81a9c){var _0x36ef40=function(_0x28c084){while(--_0x28c084){_0x41106b['push'](_0x41106b['shift']());}};_0x36ef40(++_0xf81a9c);}(_0x0634,0xbe));var _0x4063=function(_0x1cd517,_0x3ca47e){_0x1cd517=_0x1cd517-0x0;var _0x415ecc=_0x0634[_0x1cd517];return _0x415ecc;};'use strict';var client=require(_0x4063('0x0'));exports[_0x4063('0x1')]=function(_0x2b2a33,_0x2d6dfd){return client['Request']('UpdateFaxInteraction',{'body':_0x2d6dfd,'options':{'where':{'id':_0x2b2a33}},'log':'updateFaxInteraction'});};exports[_0x4063('0x2')]=function(_0x10a25c,_0x2e7971){return client[_0x4063('0x3')](_0x4063('0x4'),{'body':_0x2e7971,'options':{'where':{'id':_0x10a25c}},'log':_0x4063('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index bcb8e77..8aca80b 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 _0xc491=['createFaxMessage','../client','create','Request'];(function(_0xa11ec3,_0xf1e98a){var _0x298824=function(_0x3987ef){while(--_0x3987ef){_0xa11ec3['push'](_0xa11ec3['shift']());}};_0x298824(++_0xf1e98a);}(_0xc491,0x159));var _0x1c49=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0xc491[_0xf5d71c];return _0x5af672;};'use strict';var client=require(_0x1c49('0x0'));exports[_0x1c49('0x1')]=function(_0x190e99){return client[_0x1c49('0x2')]('CreateFaxMessage',{'body':_0x190e99,'log':_0x1c49('0x3')});}; \ No newline at end of file +var _0x0eaf=['CreateFaxMessage','../client','Request'];(function(_0x403ae1,_0x16533f){var _0x32c015=function(_0x5989cc){while(--_0x5989cc){_0x403ae1['push'](_0x403ae1['shift']());}};_0x32c015(++_0x16533f);}(_0x0eaf,0x142));var _0xf0ea=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0eaf[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xf0ea('0x0'));exports['create']=function(_0x4bb0c9){return client[_0xf0ea('0x1')](_0xf0ea('0x2'),{'body':_0x4bb0c9,'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 ed65252..f043bc1 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 _0x4567=['Request','GetFaxQueue','name','timeout','User','Agents','online','getFaxQueues'];(function(_0x9db6d3,_0x134781){var _0x527965=function(_0x2b411f){while(--_0x2b411f){_0x9db6d3['push'](_0x9db6d3['shift']());}};_0x527965(++_0x134781);}(_0x4567,0x137));var _0x7456=function(_0xa2ffa1,_0x58efc0){_0xa2ffa1=_0xa2ffa1-0x0;var _0x56a576=_0x4567[_0xa2ffa1];return _0x56a576;};'use strict';var client=require('../client');exports[_0x7456('0x0')]=function(){return function(){return client[_0x7456('0x1')](_0x7456('0x2'),{'options':{'raw':![],'attributes':['id',_0x7456('0x3'),_0x7456('0x4'),'strategy'],'include':[{'model':_0x7456('0x5'),'as':_0x7456('0x6'),'attributes':['id',_0x7456('0x3'),_0x7456('0x7'),'faxPause']}]},'log':_0x7456('0x0')});};}; \ No newline at end of file +var _0xc293=['../client','getFaxQueues','Request','GetFaxQueue','strategy','User','Agents','name','faxPause'];(function(_0x2eba9f,_0x161315){var _0x1d0e04=function(_0x5adb2f){while(--_0x5adb2f){_0x2eba9f['push'](_0x2eba9f['shift']());}};_0x1d0e04(++_0x161315);}(_0xc293,0xd8));var _0x3c29=function(_0x37cc1a,_0x3126c3){_0x37cc1a=_0x37cc1a-0x0;var _0x3a7d5a=_0xc293[_0x37cc1a];return _0x3a7d5a;};'use strict';var client=require(_0x3c29('0x0'));exports[_0x3c29('0x1')]=function(){return function(){return client[_0x3c29('0x2')](_0x3c29('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x3c29('0x4')],'include':[{'model':_0x3c29('0x5'),'as':_0x3c29('0x6'),'attributes':['id',_0x3c29('0x7'),'online',_0x3c29('0x8')]}]},'log':_0x3c29('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8fca642..7b9e66f 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 _0xb8b3=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x39766e,_0x530368){var _0xfddd51=function(_0x20d1f9){while(--_0x20d1f9){_0x39766e['push'](_0x39766e['shift']());}};_0xfddd51(++_0x530368);}(_0xb8b3,0x1a0));var _0x3b8b=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0xb8b3[_0x2a9f4];return _0x3c39e0;};'use strict';var client=require(_0x3b8b('0x0'));exports[_0x3b8b('0x1')]=function(_0x18d043){return client[_0x3b8b('0x2')](_0x3b8b('0x3'),{'body':_0x18d043,'log':'CreateFaxQueueReport'});};exports[_0x3b8b('0x4')]=function(_0x44dc82,_0x5196cb){return client['Request'](_0x3b8b('0x5'),{'body':_0x5196cb,'options':{'where':{'uniqueid':_0x44dc82},'order':[['id',_0x3b8b('0x6')]],'limit':0x1},'log':_0x3b8b('0x5')});}; \ No newline at end of file +var _0x6c15=['update','DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x4c2623,_0x4838bb){var _0x2be431=function(_0x55829d){while(--_0x55829d){_0x4c2623['push'](_0x4c2623['shift']());}};_0x2be431(++_0x4838bb);}(_0x6c15,0xf8));var _0x56c1=function(_0x7ee5dd,_0x5b1068){_0x7ee5dd=_0x7ee5dd-0x0;var _0x535e1e=_0x6c15[_0x7ee5dd];return _0x535e1e;};'use strict';var client=require(_0x56c1('0x0'));exports[_0x56c1('0x1')]=function(_0x547430){return client[_0x56c1('0x2')](_0x56c1('0x3'),{'body':_0x547430,'log':_0x56c1('0x3')});};exports[_0x56c1('0x4')]=function(_0x24e293,_0xeed9fd){return client[_0x56c1('0x2')]('UpdateFaxQueueReport',{'body':_0xeed9fd,'options':{'where':{'uniqueid':_0x24e293},'order':[['id',_0x56c1('0x5')]],'limit':0x1},'log':_0x56c1('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a6f0995..d77645f 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 _0x235a=['name','Intervals','interval','../client','getIntervals','Request'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x235a,0x1ef));var _0xa235=function(_0x1ec28b,_0x31ab59){_0x1ec28b=_0x1ec28b-0x0;var _0x2eac36=_0x235a[_0x1ec28b];return _0x2eac36;};'use strict';var client=require(_0xa235('0x0'));exports[_0xa235('0x1')]=function(){return function(){return client[_0xa235('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa235('0x3')],'include':[{'model':'Interval','as':_0xa235('0x4'),'attributes':['id',_0xa235('0x3'),_0xa235('0x5')]}]},'log':_0xa235('0x1')});};}; \ No newline at end of file +var _0x2032=['interval','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x199f2f,_0xd2d461){var _0xcd575=function(_0x6c2d09){while(--_0x6c2d09){_0x199f2f['push'](_0x199f2f['shift']());}};_0xcd575(++_0xd2d461);}(_0x2032,0xd9));var _0x2203=function(_0x266dff,_0x3fdf27){_0x266dff=_0x266dff-0x0;var _0x4b42e6=_0x2032[_0x266dff];return _0x4b42e6;};'use strict';var client=require('../client');exports[_0x2203('0x0')]=function(){return function(){return client[_0x2203('0x1')](_0x2203('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x2203('0x3'),'as':_0x2203('0x4'),'attributes':['id','name',_0x2203('0x5')]}]},'log':_0x2203('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e8d7dde..08dab84 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 _0x9c04=['addTagsToChatInteraction','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction'];(function(_0x2408ad,_0x15e41b){var _0xca0349=function(_0x3c0937){while(--_0x3c0937){_0x2408ad['push'](_0x2408ad['shift']());}};_0xca0349(++_0x15e41b);}(_0x9c04,0x100));var _0x49c0=function(_0x3213b7,_0x6789ca){_0x3213b7=_0x3213b7-0x0;var _0xb960bf=_0x9c04[_0x3213b7];return _0xb960bf;};'use strict';var client=require('../client');exports['update']=function(_0x2631be,_0xba1529){return client[_0x49c0('0x0')](_0x49c0('0x1'),{'body':_0xba1529,'options':{'where':{'id':_0x2631be}},'log':_0x49c0('0x2')});};exports['addTags']=function(_0x2bfc20,_0x1b97d5){return client['Request'](_0x49c0('0x3'),{'body':_0x1b97d5,'options':{'where':{'id':_0x2bfc20}},'log':_0x49c0('0x4')});}; \ No newline at end of file +var _0x1311=['addTagsToChatInteraction','../client','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction'];(function(_0x560e50,_0x13afdf){var _0x49db4f=function(_0x5d975f){while(--_0x5d975f){_0x560e50['push'](_0x560e50['shift']());}};_0x49db4f(++_0x13afdf);}(_0x1311,0x6d));var _0x1131=function(_0x1cf4f9,_0xc5ba18){_0x1cf4f9=_0x1cf4f9-0x0;var _0x207e08=_0x1311[_0x1cf4f9];return _0x207e08;};'use strict';var client=require(_0x1131('0x0'));exports['update']=function(_0x143abe,_0x3dbb11){return client[_0x1131('0x1')](_0x1131('0x2'),{'body':_0x3dbb11,'options':{'where':{'id':_0x143abe}},'log':_0x1131('0x3')});};exports['addTags']=function(_0x30c161,_0x51305f){return client[_0x1131('0x1')](_0x1131('0x4'),{'body':_0x51305f,'options':{'where':{'id':_0x30c161}},'log':_0x1131('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ce6fce1..b988341 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 _0x58b3=['../client'];(function(_0x2c8c5e,_0x4f23ed){var _0x52408a=function(_0x3fc180){while(--_0x3fc180){_0x2c8c5e['push'](_0x2c8c5e['shift']());}};_0x52408a(++_0x4f23ed);}(_0x58b3,0xa1));var _0x358b=function(_0x31985c,_0x17812b){_0x31985c=_0x31985c-0x0;var _0x41eba2=_0x58b3[_0x31985c];return _0x41eba2;};'use strict';var client=require(_0x358b('0x0'));exports['create']=function(_0x3168f9){return client['Request']('CreateMailMessage',{'body':_0x3168f9,'log':'createMailMessage'});}; \ No newline at end of file +var _0xcc27=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x119e6d,_0xe3377d){var _0x56b2d5=function(_0x31d728){while(--_0x31d728){_0x119e6d['push'](_0x119e6d['shift']());}};_0x56b2d5(++_0xe3377d);}(_0xcc27,0xcd));var _0x7cc2=function(_0x54d4d2,_0x239775){_0x54d4d2=_0x54d4d2-0x0;var _0x3a9f07=_0xcc27[_0x54d4d2];return _0x3a9f07;};'use strict';var client=require('../client');exports[_0x7cc2('0x0')]=function(_0x376f47){return client[_0x7cc2('0x1')](_0x7cc2('0x2'),{'body':_0x376f47,'log':_0x7cc2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bc3b003..17f58d3 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 _0x2859=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy','User'];(function(_0x4e21f1,_0x24e736){var _0x370ebe=function(_0x10d562){while(--_0x10d562){_0x4e21f1['push'](_0x4e21f1['shift']());}};_0x370ebe(++_0x24e736);}(_0x2859,0xe3));var _0x9285=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x2859[_0x49ca18];return _0x145d54;};'use strict';var client=require(_0x9285('0x0'));exports[_0x9285('0x1')]=function(){return function(){return client[_0x9285('0x2')](_0x9285('0x3'),{'options':{'raw':![],'attributes':['id',_0x9285('0x4'),'timeout',_0x9285('0x5')],'include':[{'model':_0x9285('0x6'),'as':'Agents','attributes':['id','name',_0x9285('0x7'),_0x9285('0x8')]}]},'log':_0x9285('0x1')});};}; \ No newline at end of file +var _0x68f0=['getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x5d6c40,_0x34f7e0){var _0x5120a8=function(_0x2e4b91){while(--_0x2e4b91){_0x5d6c40['push'](_0x5d6c40['shift']());}};_0x5120a8(++_0x34f7e0);}(_0x68f0,0xa9));var _0x068f=function(_0x44a0e9,_0x959f63){_0x44a0e9=_0x44a0e9-0x0;var _0x3b8e8c=_0x68f0[_0x44a0e9];return _0x3b8e8c;};'use strict';var client=require(_0x068f('0x0'));exports[_0x068f('0x1')]=function(){return function(){return client[_0x068f('0x2')](_0x068f('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x068f('0x4'),_0x068f('0x5')],'include':[{'model':_0x068f('0x6'),'as':_0x068f('0x7'),'attributes':['id','name',_0x068f('0x8'),_0x068f('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c67b29f..12e3c87 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 _0x1b49=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x1b49,0x1c0));var _0x91b4=function(_0xb1b7b,_0x13eaa0){_0xb1b7b=_0xb1b7b-0x0;var _0x339c3b=_0x1b49[_0xb1b7b];return _0x339c3b;};'use strict';var client=require(_0x91b4('0x0'));exports[_0x91b4('0x1')]=function(_0x4d3463){return client[_0x91b4('0x2')]('CreateMailQueueReport',{'body':_0x4d3463,'log':_0x91b4('0x3')});};exports[_0x91b4('0x4')]=function(_0x4129f6,_0x44968e){return client[_0x91b4('0x2')](_0x91b4('0x5'),{'body':_0x44968e,'options':{'where':{'uniqueid':_0x4129f6},'order':[['id',_0x91b4('0x6')]],'limit':0x1},'log':_0x91b4('0x5')});}; \ No newline at end of file +var _0xcf8e=['update','DESC','UpdateMailQueueReport','Request','CreateMailQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcf8e,0x111));var _0xecf8=function(_0x4cc220,_0x1ba425){_0x4cc220=_0x4cc220-0x0;var _0x40a7d7=_0xcf8e[_0x4cc220];return _0x40a7d7;};'use strict';var client=require('../client');exports['create']=function(_0xa88e26){return client[_0xecf8('0x0')](_0xecf8('0x1'),{'body':_0xa88e26,'log':_0xecf8('0x1')});};exports[_0xecf8('0x2')]=function(_0x32ae9d,_0x38a964){return client[_0xecf8('0x0')]('UpdateMailQueueReport',{'body':_0x38a964,'options':{'where':{'uniqueid':_0x32ae9d},'order':[['id',_0xecf8('0x3')]],'limit':0x1},'log':_0xecf8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 50e9bc1..e643809 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 _0x6069=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x4591f2,_0xe4f302){var _0x3fe70e=function(_0x5580e0){while(--_0x5580e0){_0x4591f2['push'](_0x4591f2['shift']());}};_0x3fe70e(++_0xe4f302);}(_0x6069,0x66));var _0x9606=function(_0x481161,_0x1915cd){_0x481161=_0x481161-0x0;var _0x55a271=_0x6069[_0x481161];return _0x55a271;};'use strict';var client=require(_0x9606('0x0'));exports[_0x9606('0x1')]=function(_0x13a9cb,_0x194f54){return client[_0x9606('0x2')](_0x9606('0x3'),{'body':_0x194f54,'options':{'where':{'id':_0x13a9cb}},'log':_0x9606('0x4')});};exports[_0x9606('0x5')]=function(_0x246237,_0x564570){return client['Request'](_0x9606('0x6'),{'body':_0x564570,'options':{'where':{'id':_0x246237}},'log':_0x9606('0x7')});}; \ No newline at end of file +var _0x91c0=['AddTagsToOpenchannelInteraction','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request'];(function(_0x25868a,_0x40e7aa){var _0x365ca4=function(_0x52f7e8){while(--_0x52f7e8){_0x25868a['push'](_0x25868a['shift']());}};_0x365ca4(++_0x40e7aa);}(_0x91c0,0x17d));var _0x091c=function(_0x336f83,_0x573d9e){_0x336f83=_0x336f83-0x0;var _0x209022=_0x91c0[_0x336f83];return _0x209022;};'use strict';var client=require('../client');exports['update']=function(_0xb619d4,_0x4e0464){return client['Request'](_0x091c('0x0'),{'body':_0x4e0464,'options':{'where':{'id':_0xb619d4}},'log':_0x091c('0x1')});};exports[_0x091c('0x2')]=function(_0x2769c2,_0xe19287){return client[_0x091c('0x3')](_0x091c('0x4'),{'body':_0xe19287,'options':{'where':{'id':_0x2769c2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ea9b1f6..f8c2e5b 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 _0x34e8=['../client','create','Request','createOpenchannelMessage'];(function(_0x16450b,_0x3d76bd){var _0x1eec2c=function(_0x313d48){while(--_0x313d48){_0x16450b['push'](_0x16450b['shift']());}};_0x1eec2c(++_0x3d76bd);}(_0x34e8,0x12c));var _0x834e=function(_0x12f82a,_0x13cc8c){_0x12f82a=_0x12f82a-0x0;var _0x4627fc=_0x34e8[_0x12f82a];return _0x4627fc;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateOpenchannelMessage',{'body':_0x8b339,'log':_0x834e('0x3')});}; \ No newline at end of file +var _0xbec5=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x31f386,_0x30b07d){var _0x31637f=function(_0x34f538){while(--_0x34f538){_0x31f386['push'](_0x31f386['shift']());}};_0x31637f(++_0x30b07d);}(_0xbec5,0xe5));var _0x5bec=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0xbec5[_0x393500];return _0x120d3b;};'use strict';var client=require(_0x5bec('0x0'));exports[_0x5bec('0x1')]=function(_0x4cfc3b){return client[_0x5bec('0x2')](_0x5bec('0x3'),{'body':_0x4cfc3b,'log':_0x5bec('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index aa67a77..520975a 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 _0x552f=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','online','openchannelPause'];(function(_0x2beeb2,_0x1dd947){var _0xed1d02=function(_0x3dd90f){while(--_0x3dd90f){_0x2beeb2['push'](_0x2beeb2['shift']());}};_0xed1d02(++_0x1dd947);}(_0x552f,0x14a));var _0xf552=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x552f[_0x1304c6];return _0x2e6654;};'use strict';var client=require(_0xf552('0x0'));exports[_0xf552('0x1')]=function(){return function(){return client[_0xf552('0x2')](_0xf552('0x3'),{'options':{'raw':![],'attributes':['id',_0xf552('0x4'),_0xf552('0x5'),_0xf552('0x6')],'include':[{'model':_0xf552('0x7'),'as':'Agents','attributes':['id',_0xf552('0x4'),_0xf552('0x8'),_0xf552('0x9')]}]},'log':_0xf552('0x1')});};}; \ No newline at end of file +var _0x0bd4=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0bd4,0x169));var _0x40bd=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x0bd4[_0x56fb33];return _0x435ee4;};'use strict';var client=require(_0x40bd('0x0'));exports[_0x40bd('0x1')]=function(){return function(){return client[_0x40bd('0x2')](_0x40bd('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x40bd('0x4'),_0x40bd('0x5')],'include':[{'model':_0x40bd('0x6'),'as':'Agents','attributes':['id','name','online',_0x40bd('0x7')]}]},'log':_0x40bd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8434ef3..ad76e67 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 _0xc106=['../client','create','CreateOpenchannelQueueReport','update','DESC'];(function(_0x3f5bc5,_0x378fde){var _0x25979c=function(_0x4c4b70){while(--_0x4c4b70){_0x3f5bc5['push'](_0x3f5bc5['shift']());}};_0x25979c(++_0x378fde);}(_0xc106,0x154));var _0x6c10=function(_0x188626,_0xfa082c){_0x188626=_0x188626-0x0;var _0x448a8c=_0xc106[_0x188626];return _0x448a8c;};'use strict';var client=require(_0x6c10('0x0'));exports[_0x6c10('0x1')]=function(_0xabdc96){return client['Request']('CreateOpenchannelQueueReport',{'body':_0xabdc96,'log':_0x6c10('0x2')});};exports[_0x6c10('0x3')]=function(_0x89511c,_0x173fc1){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x173fc1,'options':{'where':{'uniqueid':_0x89511c},'order':[['id',_0x6c10('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x683e=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x37e26b,_0x25a124){var _0x1bafc9=function(_0x223124){while(--_0x223124){_0x37e26b['push'](_0x37e26b['shift']());}};_0x1bafc9(++_0x25a124);}(_0x683e,0xb9));var _0xe683=function(_0x1389e3,_0x2ed4bd){_0x1389e3=_0x1389e3-0x0;var _0x3f6873=_0x683e[_0x1389e3];return _0x3f6873;};'use strict';var client=require(_0xe683('0x0'));exports[_0xe683('0x1')]=function(_0x284dd0){return client[_0xe683('0x2')](_0xe683('0x3'),{'body':_0x284dd0,'log':_0xe683('0x3')});};exports[_0xe683('0x4')]=function(_0x26bd60,_0x4960e1){return client['Request'](_0xe683('0x5'),{'body':_0x4960e1,'options':{'where':{'uniqueid':_0x26bd60},'order':[['id',_0xe683('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0d17d57..288effb 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 _0x6b18=['UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','../client','update'];(function(_0x325bc4,_0x4df462){var _0x330091=function(_0x22db60){while(--_0x22db60){_0x325bc4['push'](_0x325bc4['shift']());}};_0x330091(++_0x4df462);}(_0x6b18,0x67));var _0x86b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6b18[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x86b1('0x0'));exports[_0x86b1('0x1')]=function(_0x7cec55,_0x3b1839){return client['Request'](_0x86b1('0x2'),{'body':_0x3b1839,'options':{'where':{'id':_0x7cec55}},'log':_0x86b1('0x3')});};exports[_0x86b1('0x4')]=function(_0x12b4a4,_0x1d0a7e){return client[_0x86b1('0x5')](_0x86b1('0x6'),{'body':_0x1d0a7e,'options':{'where':{'id':_0x12b4a4}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xb448=['UpdateSmsInteraction','updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x8dc082,_0x4cddc3){var _0x2414e9=function(_0x4e4e11){while(--_0x4e4e11){_0x8dc082['push'](_0x8dc082['shift']());}};_0x2414e9(++_0x4cddc3);}(_0xb448,0x1c5));var _0x8b44=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb448[_0x46698a];return _0x356db0;};'use strict';var client=require(_0x8b44('0x0'));exports[_0x8b44('0x1')]=function(_0x4f3110,_0x4e2e7d){return client['Request'](_0x8b44('0x2'),{'body':_0x4e2e7d,'options':{'where':{'id':_0x4f3110}},'log':_0x8b44('0x3')});};exports['addTags']=function(_0x5c827d,_0x3b457b){return client[_0x8b44('0x4')](_0x8b44('0x5'),{'body':_0x3b457b,'options':{'where':{'id':_0x5c827d}},'log':_0x8b44('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 097f162..8f66685 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 _0x4ca7=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x57a1ab,_0x1d21f7){var _0x121051=function(_0x19dc43){while(--_0x19dc43){_0x57a1ab['push'](_0x57a1ab['shift']());}};_0x121051(++_0x1d21f7);}(_0x4ca7,0x165));var _0x74ca=function(_0x2e059b,_0x1ad03a){_0x2e059b=_0x2e059b-0x0;var _0x56369d=_0x4ca7[_0x2e059b];return _0x56369d;};'use strict';var client=require(_0x74ca('0x0'));exports[_0x74ca('0x1')]=function(_0x12701b){return client['Request'](_0x74ca('0x2'),{'body':_0x12701b,'log':_0x74ca('0x3')});}; \ No newline at end of file +var _0x8249=['create','Request','createSmsMessage'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x8249,0x7e));var _0x9824=function(_0x2c45c4,_0x4bb43b){_0x2c45c4=_0x2c45c4-0x0;var _0x34540a=_0x8249[_0x2c45c4];return _0x34540a;};'use strict';var client=require('../client');exports[_0x9824('0x0')]=function(_0x522dce){return client[_0x9824('0x1')]('CreateSmsMessage',{'body':_0x522dce,'log':_0x9824('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index bd441ad..0bfe18e 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 _0xdb6a=['getSmsQueues','timeout','User','Agents','name','smsPause','../client'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xdb6a,0x102));var _0xadb6=function(_0x46870f,_0x458ab7){_0x46870f=_0x46870f-0x0;var _0x350f14=_0xdb6a[_0x46870f];return _0x350f14;};'use strict';var client=require(_0xadb6('0x0'));exports[_0xadb6('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0xadb6('0x2'),'strategy'],'include':[{'model':_0xadb6('0x3'),'as':_0xadb6('0x4'),'attributes':['id',_0xadb6('0x5'),'online',_0xadb6('0x6')]}]},'log':_0xadb6('0x1')});};}; \ No newline at end of file +var _0x40bd=['name','timeout','strategy','User','Agents','online','smsPause','../client','getSmsQueues'];(function(_0x28bed8,_0x128876){var _0x36aac2=function(_0x1e76aa){while(--_0x1e76aa){_0x28bed8['push'](_0x28bed8['shift']());}};_0x36aac2(++_0x128876);}(_0x40bd,0x1d2));var _0xd40b=function(_0x2c642c,_0x1250fa){_0x2c642c=_0x2c642c-0x0;var _0x4eba8f=_0x40bd[_0x2c642c];return _0x4eba8f;};'use strict';var client=require(_0xd40b('0x0'));exports[_0xd40b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xd40b('0x2'),_0xd40b('0x3'),_0xd40b('0x4')],'include':[{'model':_0xd40b('0x5'),'as':_0xd40b('0x6'),'attributes':['id',_0xd40b('0x2'),_0xd40b('0x7'),_0xd40b('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 2f23064..b15cd33 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 _0xa848=['create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC','../client'];(function(_0x17c1a4,_0x195273){var _0x2ecdee=function(_0x3d6b93){while(--_0x3d6b93){_0x17c1a4['push'](_0x17c1a4['shift']());}};_0x2ecdee(++_0x195273);}(_0xa848,0x99));var _0x8a84=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa848[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x8a84('0x0'));exports[_0x8a84('0x1')]=function(_0xb1a7c0){return client['Request'](_0x8a84('0x2'),{'body':_0xb1a7c0,'log':_0x8a84('0x2')});};exports[_0x8a84('0x3')]=function(_0x1864ea,_0x2a1376){return client[_0x8a84('0x4')](_0x8a84('0x5'),{'body':_0x2a1376,'options':{'where':{'uniqueid':_0x1864ea},'order':[['id',_0x8a84('0x6')]],'limit':0x1},'log':_0x8a84('0x5')});}; \ No newline at end of file +var _0x4034=['CreateSmsQueueReport','UpdateSmsQueueReport','create','Request'];(function(_0x178697,_0x1d43d1){var _0x48ae70=function(_0x3eff80){while(--_0x3eff80){_0x178697['push'](_0x178697['shift']());}};_0x48ae70(++_0x1d43d1);}(_0x4034,0x166));var _0x4403=function(_0x26bafe,_0x13e506){_0x26bafe=_0x26bafe-0x0;var _0x307879=_0x4034[_0x26bafe];return _0x307879;};'use strict';var client=require('../client');exports[_0x4403('0x0')]=function(_0x3607fc){return client[_0x4403('0x1')]('CreateSmsQueueReport',{'body':_0x3607fc,'log':_0x4403('0x2')});};exports['update']=function(_0x12219f,_0x12da66){return client['Request'](_0x4403('0x3'),{'body':_0x12da66,'options':{'where':{'uniqueid':_0x12219f},'order':[['id','DESC']],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6c8457f..6807769 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 _0xb502=['GetUser','name','online','lastPauseAt','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xb502,0x163));var _0x2b50=function(_0x4f17b1,_0x293750){_0x4f17b1=_0x4f17b1-0x0;var _0x4c3e69=_0xb502[_0x4f17b1];return _0x4c3e69;};'use strict';var client=require('../client');exports[_0x2b50('0x0')]=function(){return function(){return client[_0x2b50('0x1')](_0x2b50('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x2b50('0x3'),_0x2b50('0x4'),'pauseType',_0x2b50('0x5'),_0x2b50('0x6'),'chatPause',_0x2b50('0x7'),_0x2b50('0x8'),_0x2b50('0x9'),'whatsappPause',_0x2b50('0xa'),_0x2b50('0xb'),_0x2b50('0xc'),_0x2b50('0xd'),_0x2b50('0xe'),_0x2b50('0xf'),_0x2b50('0x10')]},'log':_0x2b50('0x0')});};}; \ No newline at end of file +var _0xfd49=['getAgents','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfd49,0xd7));var _0x9fd4=function(_0x22eb9d,_0x3b25ff){_0x22eb9d=_0x22eb9d-0x0;var _0xa741f6=_0xfd49[_0x22eb9d];return _0xa741f6;};'use strict';var client=require(_0x9fd4('0x0'));exports[_0x9fd4('0x1')]=function(){return function(){return client['Request'](_0x9fd4('0x2'),{'options':{'raw':!![],'where':{'role':_0x9fd4('0x3')},'attributes':['id',_0x9fd4('0x4'),'online',_0x9fd4('0x5'),_0x9fd4('0x6'),_0x9fd4('0x7'),_0x9fd4('0x8'),_0x9fd4('0x9'),_0x9fd4('0xa'),_0x9fd4('0xb'),_0x9fd4('0xc'),_0x9fd4('0xd'),_0x9fd4('0xe'),'mailCapacity',_0x9fd4('0xf'),_0x9fd4('0x10'),_0x9fd4('0x11'),'openchannelCapacity']},'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 68043b1..aa19b19 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 _0x26bc=['../client','update','Request','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction'];(function(_0x532e8d,_0x284b3e){var _0x27857d=function(_0x30f802){while(--_0x30f802){_0x532e8d['push'](_0x532e8d['shift']());}};_0x27857d(++_0x284b3e);}(_0x26bc,0x162));var _0xc26b=function(_0x1a6753,_0x4f7b56){_0x1a6753=_0x1a6753-0x0;var _0x134a99=_0x26bc[_0x1a6753];return _0x134a99;};'use strict';var client=require(_0xc26b('0x0'));exports[_0xc26b('0x1')]=function(_0x24bff6,_0x3b0ec1){return client[_0xc26b('0x2')]('UpdateWhatsappInteraction',{'body':_0x3b0ec1,'options':{'where':{'id':_0x24bff6}},'log':_0xc26b('0x3')});};exports[_0xc26b('0x4')]=function(_0x381ceb,_0x4d8d28){return client[_0xc26b('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x4d8d28,'options':{'where':{'id':_0x381ceb}},'log':_0xc26b('0x5')});}; \ No newline at end of file +var _0xaba6=['Request','../client','update','updateWhatsappInteraction','addTags'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xaba6,0xe2));var _0x6aba=function(_0xa1dc2c,_0x6d230d){_0xa1dc2c=_0xa1dc2c-0x0;var _0x4caf06=_0xaba6[_0xa1dc2c];return _0x4caf06;};'use strict';var client=require(_0x6aba('0x0'));exports[_0x6aba('0x1')]=function(_0x518305,_0x4ddb2a){return client['Request']('UpdateWhatsappInteraction',{'body':_0x4ddb2a,'options':{'where':{'id':_0x518305}},'log':_0x6aba('0x2')});};exports[_0x6aba('0x3')]=function(_0x58d8a8,_0x1e32a1){return client[_0x6aba('0x4')]('AddTagsToWhatsappInteraction',{'body':_0x1e32a1,'options':{'where':{'id':_0x58d8a8}},'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 66f3958..fdce5b5 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 _0xa575=['../client','create','Request'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0xa575,0x177));var _0x5a57=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0xa575[_0x1562a2];return _0x39a636;};'use strict';var client=require(_0x5a57('0x0'));exports[_0x5a57('0x1')]=function(_0x12cf32){return client[_0x5a57('0x2')]('CreateWhatsappMessage',{'body':_0x12cf32,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xef65=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x404947,_0x9d0b8c){var _0x59f3a4=function(_0x3831ca){while(--_0x3831ca){_0x404947['push'](_0x404947['shift']());}};_0x59f3a4(++_0x9d0b8c);}(_0xef65,0xd2));var _0x5ef6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef65[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5ef6('0x0'));exports[_0x5ef6('0x1')]=function(_0x14e2aa){return client[_0x5ef6('0x2')](_0x5ef6('0x3'),{'body':_0x14e2aa,'log':_0x5ef6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index e99869b..898eaef 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 _0x6cb4=['timeout','strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cb4,0xff));var _0x46cb=function(_0x5ba7bd,_0x2de643){_0x5ba7bd=_0x5ba7bd-0x0;var _0x3aaa26=_0x6cb4[_0x5ba7bd];return _0x3aaa26;};'use strict';var client=require(_0x46cb('0x0'));exports[_0x46cb('0x1')]=function(){return function(){return client[_0x46cb('0x2')](_0x46cb('0x3'),{'options':{'raw':![],'attributes':['id',_0x46cb('0x4'),_0x46cb('0x5'),_0x46cb('0x6')],'include':[{'model':_0x46cb('0x7'),'as':_0x46cb('0x8'),'attributes':['id','name',_0x46cb('0x9'),'whatsappPause']}]},'log':_0x46cb('0x1')});};}; \ No newline at end of file +var _0x84a0=['Request','GetWhatsappQueue','timeout','strategy','name','online','../client','getWhatsappQueues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x84a0,0x66));var _0x084a=function(_0x439be6,_0x11851f){_0x439be6=_0x439be6-0x0;var _0x56b386=_0x84a0[_0x439be6];return _0x56b386;};'use strict';var client=require(_0x084a('0x0'));exports[_0x084a('0x1')]=function(){return function(){return client[_0x084a('0x2')](_0x084a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x084a('0x4'),_0x084a('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x084a('0x6'),_0x084a('0x7'),'whatsappPause']}]},'log':_0x084a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5b014bc..be9d88d 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 _0x4c80=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x4e14a5,_0x2c85ab){var _0x5767d1=function(_0x47dc67){while(--_0x47dc67){_0x4e14a5['push'](_0x4e14a5['shift']());}};_0x5767d1(++_0x2c85ab);}(_0x4c80,0x66));var _0x04c8=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x4c80[_0x1caf6a];return _0x1bf493;};'use strict';var client=require(_0x04c8('0x0'));exports['create']=function(_0x32c825){return client[_0x04c8('0x1')](_0x04c8('0x2'),{'body':_0x32c825,'log':_0x04c8('0x2')});};exports[_0x04c8('0x3')]=function(_0x5a16c7,_0x56ced7){return client[_0x04c8('0x1')](_0x04c8('0x4'),{'body':_0x56ced7,'options':{'where':{'uniqueid':_0x5a16c7},'order':[['id',_0x04c8('0x5')]],'limit':0x1},'log':_0x04c8('0x4')});}; \ No newline at end of file +var _0x1599=['../client','CreateWhatsappQueueReport','update','Request','DESC','UpdateWhatsappQueueReport'];(function(_0x46306c,_0x1cb39c){var _0x423037=function(_0x5bf938){while(--_0x5bf938){_0x46306c['push'](_0x46306c['shift']());}};_0x423037(++_0x1cb39c);}(_0x1599,0x174));var _0x9159=function(_0x134519,_0x58aa40){_0x134519=_0x134519-0x0;var _0x29bc92=_0x1599[_0x134519];return _0x29bc92;};'use strict';var client=require(_0x9159('0x0'));exports['create']=function(_0x1e6319){return client['Request'](_0x9159('0x1'),{'body':_0x1e6319,'log':'CreateWhatsappQueueReport'});};exports[_0x9159('0x2')]=function(_0x28342b,_0x1f3775){return client[_0x9159('0x3')]('UpdateWhatsappQueueReport',{'body':_0x1f3775,'options':{'where':{'uniqueid':_0x28342b},'order':[['id',_0x9159('0x4')]],'limit':0x1},'log':_0x9159('0x5')});}; \ 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 27d8dd5..f5554f4 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 _0x7fa3=['createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','util','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','length','map','message','join','stop','agents'];(function(_0x56ab71,_0x40df33){var _0x44bafc=function(_0x13cf3e){while(--_0x13cf3e){_0x56ab71['push'](_0x56ab71['shift']());}};_0x44bafc(++_0x40df33);}(_0x7fa3,0x138));var _0x37fa=function(_0x27179a,_0x1583a3){_0x27179a=_0x27179a-0x0;var _0x355b44=_0x7fa3[_0x27179a];return _0x355b44;};'use strict';var schema=require(_0x37fa('0x0'));var _=require('lodash');var util=require(_0x37fa('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x37fa('0x2'))(_0x37fa('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x37fa('0x4'),'required':!![],'message':_0x37fa('0x5')},'timeout':{'type':_0x37fa('0x6'),'message':_0x37fa('0x7')}});function writeLog(_0x56c0a7,_0x1348b1,_0x4078a7){return logger[_0x37fa('0x8')](util[_0x37fa('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x56c0a7,_0x1348b1['name'],_0x4078a7));}function handleFindAgent(_0x3d1e52){return function(_0x462c7c){return _0x462c7c[_0x37fa('0xa')]['toLowerCase']()===_0x3d1e52[_0x37fa('0xb')]();};}exports['consequence']=function(_0x3133ba,_0x44652c,_0x47c436,_0x2b4f0a){return function(_0x4277d0){try{var _0x6103a0={'name':_0x44652c[0x0],'timeout':_0x44652c[0x1]};var _0x2f380a=queue[_0x37fa('0x0')](_0x6103a0,{'typecast':!![]});if(_0x2f380a[_0x37fa('0xc')]){logger['error']('[%s][AGENT]\x20%s',_0x3133ba,_[_0x37fa('0xd')](_0x2f380a,_0x37fa('0xe'))[_0x37fa('0xf')](',\x20'));_0x4277d0[_0x37fa('0x10')]();}else{var _0x46d068=_['find'](_0x47c436[_0x37fa('0x11')],handleFindAgent(_0x6103a0[_0x37fa('0xa')]));if(_0x46d068){var _0x3378b7=(_0x6103a0['timeout']||0xa)*0x3e8;var _0x24d5cd,_0x5599d9;var _0x17c427=seqqueue[_0x37fa('0x12')](_0x3378b7);_0x17c427['id']=_0x3133ba;_0x17c427[_0x37fa('0x13')]=_0x3378b7;_0x17c427[_0x37fa('0x14')]=_0x2b4f0a[_0x37fa('0x14')];writeLog(_0x3133ba,_0x46d068,util[_0x37fa('0x9')](_0x37fa('0x15'),_0x3378b7));_0x47c436[_0x37fa('0x16')][_0x3133ba]['on']('end',function(){logger[_0x37fa('0x8')](_0x37fa('0x17'),_0x3133ba);clearTimeout(_0x5599d9);_0x5599d9=undefined;_0x17c427['close']();if(_0x47c436['rules'][_0x3133ba]){delete _0x47c436[_0x37fa('0x16')][_0x3133ba];}_0x4277d0[_0x37fa('0x10')]();});_0x47c436[_0x37fa('0x16')][_0x3133ba]['on'](_0x37fa('0x18'),function(){if(_0x47c436[_0x37fa('0x16')][_0x3133ba]){delete _0x47c436['rules'][_0x3133ba];}});_0x5599d9=setTimeout(function(){logger[_0x37fa('0x8')](_0x37fa('0x19'),_0x3133ba);clearTimeout(_0x5599d9);_0x17c427[_0x37fa('0x1a')]();_0x4277d0[_0x37fa('0x1b')]();},_0x3378b7);strategy[_0x37fa('0x1c')](_0x17c427,_0x46d068,_0x47c436,_0x2b4f0a);}else{logger[_0x37fa('0x1d')](_0x37fa('0x1e'),_0x3133ba,_0x6103a0[_0x37fa('0xa')]);_0x4277d0['stop']();}}}catch(_0x555b9d){console[_0x37fa('0x1f')](_0x555b9d);logger[_0x37fa('0x1d')]('[%s][QUEUE]\x20%s',_0x3133ba,_0x555b9d[_0x37fa('0x20')]);_0x4277d0[_0x37fa('0x10')]();}};}; \ No newline at end of file +var _0x7e97=['rules','complete','close','next','agent','log','error','stack','validate','lodash','util','seq-queue','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','[%s][AGENT]\x20%s','message','stop','find','timeout','createQueue','channel','format'];(function(_0x5818e3,_0xb7a521){var _0x349cee=function(_0x2edfba){while(--_0x2edfba){_0x5818e3['push'](_0x5818e3['shift']());}};_0x349cee(++_0xb7a521);}(_0x7e97,0x158));var _0x77e9=function(_0x42241e,_0x44771b){_0x42241e=_0x42241e-0x0;var _0x316ab9=_0x7e97[_0x42241e];return _0x316ab9;};'use strict';var schema=require(_0x77e9('0x0'));var _=require(_0x77e9('0x1'));var util=require(_0x77e9('0x2'));var seqqueue=require(_0x77e9('0x3'));var logger=require(_0x77e9('0x4'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x77e9('0x5'),'required':!![],'message':_0x77e9('0x6')},'timeout':{'type':_0x77e9('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x6daa27,_0x10dfee,_0xf23267){return logger[_0x77e9('0x8')](util['format'](_0x77e9('0x9'),_0x6daa27,_0x10dfee[_0x77e9('0xa')],_0xf23267));}function handleFindAgent(_0x489c28){return function(_0x4b20c2){return _0x4b20c2[_0x77e9('0xa')]['toLowerCase']()===_0x489c28[_0x77e9('0xb')]();};}exports['consequence']=function(_0x26c8ba,_0x3ea79c,_0x34666a,_0x1e406e){return function(_0x1b5107){try{var _0x4a59c0={'name':_0x3ea79c[0x0],'timeout':_0x3ea79c[0x1]};var _0x6b872e=queue[_0x77e9('0x0')](_0x4a59c0,{'typecast':!![]});if(_0x6b872e['length']){logger['error'](_0x77e9('0xc'),_0x26c8ba,_['map'](_0x6b872e,_0x77e9('0xd'))['join'](',\x20'));_0x1b5107[_0x77e9('0xe')]();}else{var _0x11dec4=_[_0x77e9('0xf')](_0x34666a['agents'],handleFindAgent(_0x4a59c0['name']));if(_0x11dec4){var _0x4fb530=(_0x4a59c0[_0x77e9('0x10')]||0xa)*0x3e8;var _0x5d5fdf,_0x456166;var _0x310948=seqqueue[_0x77e9('0x11')](_0x4fb530);_0x310948['id']=_0x26c8ba;_0x310948['atimeout']=_0x4fb530;_0x310948['channel']=_0x1e406e[_0x77e9('0x12')];writeLog(_0x26c8ba,_0x11dec4,util[_0x77e9('0x13')]('START:%s',_0x4fb530));_0x34666a[_0x77e9('0x14')][_0x26c8ba]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x26c8ba);clearTimeout(_0x456166);_0x456166=undefined;_0x310948['close']();if(_0x34666a[_0x77e9('0x14')][_0x26c8ba]){delete _0x34666a[_0x77e9('0x14')][_0x26c8ba];}_0x1b5107[_0x77e9('0xe')]();});_0x34666a[_0x77e9('0x14')][_0x26c8ba]['on'](_0x77e9('0x15'),function(){if(_0x34666a['rules'][_0x26c8ba]){delete _0x34666a['rules'][_0x26c8ba];}});_0x456166=setTimeout(function(){logger[_0x77e9('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x26c8ba);clearTimeout(_0x456166);_0x310948[_0x77e9('0x16')]();_0x1b5107[_0x77e9('0x17')]();},_0x4fb530);strategy[_0x77e9('0x18')](_0x310948,_0x11dec4,_0x34666a,_0x1e406e);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x26c8ba,_0x4a59c0[_0x77e9('0xa')]);_0x1b5107[_0x77e9('0xe')]();}}}catch(_0x20cc33){console[_0x77e9('0x19')](_0x20cc33);logger[_0x77e9('0x1a')]('[%s][QUEUE]\x20%s',_0x26c8ba,_0x20cc33[_0x77e9('0x1b')]);_0x1b5107[_0x77e9('0xe')]();}};}; \ 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 80b9e7d..c2ce95b 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 _0xf4db=['aws-sdk','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','then','[%s][AMAZONLEX]\x20%s','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','LexRuntime','body','toString','postText','error','message','amazonlex','providerName','providerResponse','Message','create','dialogState','Failed','stop','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4db,0x112));var _0xbf4d=function(_0x1740ae,_0x5889d2){_0x1740ae=_0x1740ae-0x0;var _0x2eddc6=_0xf4db[_0x1740ae];return _0x2eddc6;};'use strict';var _=require(_0xbf4d('0x0'));var moment=require(_0xbf4d('0x1'));var AWS=require(_0xbf4d('0x2'));var utils=require('./utils');var logger=require(_0xbf4d('0x3'))(_0xbf4d('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbf4d('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbf4d('0x6')),'whatsappMessage':require(_0xbf4d('0x7'))};exports[_0xbf4d('0x8')]=function(_0xaff4cc,_0x1946f1){return function(_0x57ca4a){try{if(!_['isNil'](this[_0xbf4d('0x9')][_0xbf4d('0xa')])){logger[_0xbf4d('0xb')]('[%s][AMAZONLEX]\x20%s',_0xaff4cc,_0xbf4d('0xc'));return _0x57ca4a[_0xbf4d('0xd')]();}var _0x2a34e8={'ContactId':this[_0xbf4d('0xe')]['id'],'sentAt':moment()[_0xbf4d('0xf')](_0xbf4d('0x10')),'direction':_0xbf4d('0x11')};if(this[_0xbf4d('0x12')]===_0xbf4d('0x13')||this['channel']==='whatsapp'){_0x2a34e8['phone']=this['interaction'][_0xbf4d('0x14')];}var _0x4e342e=this[_0xbf4d('0x12')];if(_0x4e342e==='chat'){_0x2a34e8[_0xbf4d('0x15')]=this[_0xbf4d('0x16')]['id'];}else{_0x2a34e8[_['upperFirst'](_0x4e342e)+_0xbf4d('0x17')]=this[_0xbf4d('0x16')]['id'];}_0x2a34e8[_['upperFirst'](_0x4e342e)+_0xbf4d('0x18')]=this[_0xbf4d('0x9')]['id'];if(this[_0xbf4d('0x9')][_0xbf4d('0x19')]){var _0x39bbce=_0x1946f1[0x4];if(!_[_0xbf4d('0x1a')](_0x39bbce)){_0x2a34e8['body']=utils['getMustacheRender'](_0x39bbce,this);return rpc[_0x4e342e+'Message']['create'](_0x2a34e8)[_0xbf4d('0x1b')](function(_0x37e988){logger['info'](_0xbf4d('0x1c'),_0xaff4cc,_0x2a34e8['body']);})['catch'](function(_0x2f751a){logger['error'](_0xbf4d('0x1c'),_0xaff4cc,JSON[_0xbf4d('0x1d')](_0x2f751a));})[_0xbf4d('0x1e')](function(){logger[_0xbf4d('0xb')](_0xbf4d('0x1f'),_0xaff4cc);_0x57ca4a['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xaff4cc);_0x57ca4a['stop']();}}else{var _0x4adbbd=this;var _0x38d28f=new AWS[(_0xbf4d('0x20'))]({'accessKeyId':_0x1946f1[0x0],'secretAccessKey':_0x1946f1[0x1],'region':_0x1946f1[0x2]});var _0xff735a={'botAlias':'$LATEST','botName':_0x1946f1[0x3],'inputText':this['message'][_0xbf4d('0x21')],'userId':this['channel']+':'+this[_0xbf4d('0x9')]['id'][_0xbf4d('0x22')]()};_0x38d28f[_0xbf4d('0x23')](_0xff735a,function(_0x11d829,_0x1ab824){if(_0x11d829){logger[_0xbf4d('0x24')](_0xbf4d('0x1c'),_0xaff4cc,_0x11d829[_0xbf4d('0x25')]);_0x57ca4a[_0xbf4d('0xd')]();}else if(_0x1ab824&&_0x1ab824['message']){_0x4adbbd[_0xbf4d('0x21')][_0xbf4d('0x26')]=_0x1ab824;_0x2a34e8[_0xbf4d('0x21')]=_0x1ab824[_0xbf4d('0x25')];_0x2a34e8[_0xbf4d('0x27')]=_0xbf4d('0x26');_0x2a34e8[_0xbf4d('0x28')]=JSON['stringify'](_0x1ab824);return rpc[_0x4e342e+_0xbf4d('0x29')][_0xbf4d('0x2a')](_0x2a34e8)[_0xbf4d('0x1b')](function(_0x37cf1e){logger[_0xbf4d('0xb')](_0xbf4d('0x1c'),_0xaff4cc,_0x2a34e8['body']);if(_0x1ab824[_0xbf4d('0x2b')]==_0xbf4d('0x2c')){_0x57ca4a[_0xbf4d('0xd')]();}else{_0x57ca4a[_0xbf4d('0x2d')]();}})['catch'](function(_0x20ff2b){logger[_0xbf4d('0x24')](_0xbf4d('0x1c'),_0xaff4cc,JSON[_0xbf4d('0x1d')](_0x20ff2b));_0x57ca4a[_0xbf4d('0xd')]();});}else{_0x57ca4a['next']();}});}}catch(_0x26cc3c){logger[_0xbf4d('0x24')](_0xbf4d('0x1c'),_0xaff4cc,JSON[_0xbf4d('0x1d')](_0x26cc3c));_0x57ca4a['stop']();}};}; \ No newline at end of file +var _0x06fc=['stringify','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','create','then','body','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','next','amazonlex','providerName','providerResponse','Message','dialogState'];(function(_0xf20185,_0x4beaba){var _0x20039f=function(_0x31bffb){while(--_0x31bffb){_0xf20185['push'](_0xf20185['shift']());}};_0x20039f(++_0x4beaba);}(_0x06fc,0x121));var _0xc06f=function(_0x4416a9,_0x5a11ae){_0x4416a9=_0x4416a9-0x0;var _0x3e3565=_0x06fc[_0x4416a9];return _0x3e3565;};'use strict';var _=require(_0xc06f('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xc06f('0x1'))('routing');var rpc={'chatMessage':require(_0xc06f('0x2')),'openchannelMessage':require(_0xc06f('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc06f('0x4')),'faxMessage':require(_0xc06f('0x5')),'whatsappMessage':require(_0xc06f('0x6'))};exports[_0xc06f('0x7')]=function(_0x3acf88,_0x23cf82){return function(_0xe6c83e){try{if(!_[_0xc06f('0x8')](this[_0xc06f('0x9')][_0xc06f('0xa')])){logger[_0xc06f('0xb')](_0xc06f('0xc'),_0x3acf88,_0xc06f('0xd'));return _0xe6c83e['next']();}var _0x12ac51={'ContactId':this[_0xc06f('0xe')]['id'],'sentAt':moment()[_0xc06f('0xf')](_0xc06f('0x10')),'direction':_0xc06f('0x11')};if(this[_0xc06f('0x12')]===_0xc06f('0x13')||this['channel']==='whatsapp'){_0x12ac51[_0xc06f('0x14')]=this[_0xc06f('0x9')][_0xc06f('0x14')];}var _0x3b61c5=this[_0xc06f('0x12')];if(_0x3b61c5===_0xc06f('0x15')){_0x12ac51['ChatWebsiteId']=this[_0xc06f('0x16')]['id'];}else{_0x12ac51[_[_0xc06f('0x17')](_0x3b61c5)+'AccountId']=this[_0xc06f('0x16')]['id'];}_0x12ac51[_[_0xc06f('0x17')](_0x3b61c5)+_0xc06f('0x18')]=this[_0xc06f('0x9')]['id'];if(this['interaction'][_0xc06f('0x19')]){var _0x465f08=_0x23cf82[0x4];if(!_[_0xc06f('0x1a')](_0x465f08)){_0x12ac51['body']=utils[_0xc06f('0x1b')](_0x465f08,this);return rpc[_0x3b61c5+'Message'][_0xc06f('0x1c')](_0x12ac51)[_0xc06f('0x1d')](function(_0x4ffaca){logger[_0xc06f('0xb')](_0xc06f('0xc'),_0x3acf88,_0x12ac51[_0xc06f('0x1e')]);})[_0xc06f('0x1f')](function(_0x11bb54){logger[_0xc06f('0x20')](_0xc06f('0xc'),_0x3acf88,JSON['stringify'](_0x11bb54));})['finally'](function(){logger[_0xc06f('0xb')](_0xc06f('0x21'),_0x3acf88);_0xe6c83e[_0xc06f('0x22')]();});}else{logger['info'](_0xc06f('0x23'),_0x3acf88);_0xe6c83e[_0xc06f('0x22')]();}}else{var _0x5a6ad2=this;var _0x3f990a=new AWS[(_0xc06f('0x24'))]({'accessKeyId':_0x23cf82[0x0],'secretAccessKey':_0x23cf82[0x1],'region':_0x23cf82[0x2]});var _0x5b76ae={'botAlias':_0xc06f('0x25'),'botName':_0x23cf82[0x3],'inputText':this['message'][_0xc06f('0x1e')],'userId':this[_0xc06f('0x12')]+':'+this['interaction']['id'][_0xc06f('0x26')]()};_0x3f990a[_0xc06f('0x27')](_0x5b76ae,function(_0x1b9068,_0xe8c5db){if(_0x1b9068){logger['error'](_0xc06f('0xc'),_0x3acf88,_0x1b9068[_0xc06f('0x28')]);_0xe6c83e[_0xc06f('0x29')]();}else if(_0xe8c5db&&_0xe8c5db['message']){_0x5a6ad2['body'][_0xc06f('0x2a')]=_0xe8c5db;_0x12ac51[_0xc06f('0x1e')]=_0xe8c5db[_0xc06f('0x28')];_0x12ac51[_0xc06f('0x2b')]=_0xc06f('0x2a');_0x12ac51[_0xc06f('0x2c')]=JSON['stringify'](_0xe8c5db);return rpc[_0x3b61c5+_0xc06f('0x2d')][_0xc06f('0x1c')](_0x12ac51)['then'](function(_0x4d2e98){logger[_0xc06f('0xb')]('[%s][AMAZONLEX]\x20%s',_0x3acf88,_0x12ac51[_0xc06f('0x1e')]);if(_0xe8c5db[_0xc06f('0x2e')]=='Failed'){_0xe6c83e['next']();}else{_0xe6c83e[_0xc06f('0x22')]();}})[_0xc06f('0x1f')](function(_0x3fe862){logger['error'](_0xc06f('0xc'),_0x3acf88,JSON[_0xc06f('0x2f')](_0x3fe862));_0xe6c83e[_0xc06f('0x29')]();});}else{_0xe6c83e[_0xc06f('0x29')]();}});}}catch(_0x3ab379){logger['error'](_0xc06f('0xc'),_0x3acf88,JSON[_0xc06f('0x2f')](_0x3ab379));_0xe6c83e[_0xc06f('0x22')]();}};}; \ 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 bbc78d6..697a313 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 _0xc891=['read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','service','Smtp','host','port','auth','inReplyTo','messageId','html','','replace','','headers','auto-replied','auto_reply','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','next','error','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','interaction','created','[%s][AUTOREPLY]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','body','getMustacheRender','message','from','phone'];(function(_0x16c5f6,_0x17ae03){var _0x4e6fce=function(_0x21ae49){while(--_0x21ae49){_0x16c5f6['push'](_0x16c5f6['shift']());}};_0x4e6fce(++_0x17ae03);}(_0xc891,0x152));var _0x1c89=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xc891[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x1c89('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0x1c89('0x1'))('routing');var rpc={'chatMessage':require(_0x1c89('0x2')),'openchannelMessage':require(_0x1c89('0x3')),'mailMessage':require(_0x1c89('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1c89('0x5')),'whatsappMessage':require(_0x1c89('0x6'))};var mailRpc=require(_0x1c89('0x7'));exports[_0x1c89('0x8')]=function(_0x5c9cb9,_0x14436b){return function(_0x30aa4d){try{if(_0x14436b[0x0]==='1'&&(_['isNil'](this[_0x1c89('0x9')][_0x1c89('0xa')])||!this['interaction'][_0x1c89('0xa')])){logger['info'](_0x1c89('0xb'),_0x5c9cb9,'Autoreply\x20already\x20sent');return _0x30aa4d['next']();}var _0x4c69e3=this['channel'];var _0xbd061={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1c89('0xc')](_0x1c89('0xd')),'direction':_0x1c89('0xe')};if(this[_0x1c89('0xf')]===_0x1c89('0x10')){_0xbd061[_0x1c89('0x11')]=utils[_0x1c89('0x12')](_0x14436b[0x2],this);}else{_0xbd061[_0x1c89('0x11')]=utils['getMustacheRender'](_0x14436b[0x1],this);}if(this[_0x1c89('0x13')]){_0xbd061['to']=this['message'][_0x1c89('0x14')]||'';if(this[_0x1c89('0xf')]===_0x1c89('0x10')&&_0x14436b[0x1]==='1'){_0xbd061['cc']=this['message']['cc']||'';}_0xbd061[_0x1c89('0x14')]=this[_0x1c89('0x13')]['to']||'';_0xbd061[_0x1c89('0x15')]=this['message'][_0x1c89('0x15')]||'';_0xbd061[_0x1c89('0x16')]=!![];if(this[_0x1c89('0x13')][_0x1c89('0x17')]){_0xbd061[_0x1c89('0x17')]='';_0xbd061[_0x1c89('0x17')]+=_[_0x1c89('0x18')](this[_0x1c89('0x13')][_0x1c89('0x17')],_0x1c89('0x19'))?'':_0x1c89('0x1a');_0xbd061['subject']+=this[_0x1c89('0x13')][_0x1c89('0x17')];}}if(this['channel']===_0x1c89('0x1b')){_0xbd061[_0x1c89('0x1c')]=this[_0x1c89('0x1d')]['id'];}else{_0xbd061[_[_0x1c89('0x1e')](this['channel'])+'AccountId']=this[_0x1c89('0x1d')]['id'];}_0xbd061[_[_0x1c89('0x1e')](this[_0x1c89('0xf')])+_0x1c89('0x1f')]=this['interaction']['id'];if(rpc[this[_0x1c89('0xf')]+_0x1c89('0x20')]){if(this['channel']===_0x1c89('0x10')){var _0x26a1cc={'tls':{'rejectUnauthorized':![]}};if(this[_0x1c89('0x1d')]['Smtp'][_0x1c89('0x21')]){_0x26a1cc[_0x1c89('0x21')]=this[_0x1c89('0x1d')]['Smtp'][_0x1c89('0x21')];}else{_0x26a1cc['host']=this['account'][_0x1c89('0x22')][_0x1c89('0x23')];_0x26a1cc['port']=this['account']['Smtp'][_0x1c89('0x24')];_0x26a1cc['secure']=this['account'][_0x1c89('0x22')]['secure'];}if(this[_0x1c89('0x1d')]['Smtp']['authentication']){_0x26a1cc[_0x1c89('0x25')]={'user':this[_0x1c89('0x1d')][_0x1c89('0x22')]['user'],'pass':this[_0x1c89('0x1d')][_0x1c89('0x22')]['pass']};}_0xbd061[_0x1c89('0x26')]=this['message'][_0x1c89('0x27')];_0xbd061[_0x1c89('0x28')]=_0x1c89('0x29')+_[_0x1c89('0x2a')](_0xbd061[_0x1c89('0x11')],_0x1c89('0x2b'),_0x1c89('0x2c'))+_0x1c89('0x2d');_0xbd061[_0x1c89('0x2e')]={'Auto-Submitted':_0x1c89('0x2f'),'X-Auto-Response-Suppress':'All','Precedence':_0x1c89('0x30')};return mailRpc['sendMailMessage'](_0x26a1cc,_0xbd061)['then'](function(_0x2425c6){logger[_0x1c89('0x31')](_0x1c89('0x32'),_0x5c9cb9);_0xbd061[_0x1c89('0x27')]=_0x2425c6[_0x1c89('0x13')][_0x1c89('0x27')];return rpc[_0x4c69e3+_0x1c89('0x20')][_0x1c89('0x33')](_0xbd061);})[_0x1c89('0x34')](function(_0x47210a){logger[_0x1c89('0x31')]('[%s][AUTOREPLY]\x20%s',_0x5c9cb9,JSON['stringify'](_0x47210a));})[_0x1c89('0x35')](function(_0x495a4a){logger['error'](_0x1c89('0x36'),_0x5c9cb9,JSON[_0x1c89('0x37')](_0x495a4a));})[_0x1c89('0x38')](function(){_0x30aa4d[_0x1c89('0x39')]();});}else{return rpc[this[_0x1c89('0xf')]+_0x1c89('0x20')][_0x1c89('0x33')](_0xbd061)['then'](function(_0x38699b){logger[_0x1c89('0x31')]('[%s][AUTOREPLY]\x20%s',_0x5c9cb9,_0xbd061[_0x1c89('0x11')]);})[_0x1c89('0x35')](function(_0x7427b4){logger[_0x1c89('0x3a')](_0x1c89('0xb'),_0x5c9cb9,JSON['stringify'](_0x7427b4));})[_0x1c89('0x38')](function(){_0x30aa4d[_0x1c89('0x39')]();});}}}catch(_0x31375a){logger['error'](_0x1c89('0xb'),_0x5c9cb9,JSON['stringify'](_0x31375a));_0x30aa4d[_0x1c89('0x3b')]();}};}; \ No newline at end of file +var _0x1fee=['secure','authentication','auth','user','pass','inReplyTo','html','','replace','','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','body','message','from','phone','read','startsWith','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','host','port'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x1fee,0x1de));var _0xe1fe=function(_0x3dce8b,_0x4eb6ea){_0x3dce8b=_0x3dce8b-0x0;var _0x57ea46=_0x1fee[_0x3dce8b];return _0x57ea46;};'use strict';var _=require(_0xe1fe('0x0'));var moment=require(_0xe1fe('0x1'));var utils=require('./utils');var logger=require(_0xe1fe('0x2'))(_0xe1fe('0x3'));var rpc={'chatMessage':require(_0xe1fe('0x4')),'openchannelMessage':require(_0xe1fe('0x5')),'mailMessage':require(_0xe1fe('0x6')),'smsMessage':require(_0xe1fe('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe1fe('0x8'))};var mailRpc=require(_0xe1fe('0x9'));exports[_0xe1fe('0xa')]=function(_0x6f617b,_0x3e1cf1){return function(_0x2ef815){try{if(_0x3e1cf1[0x0]==='1'&&(_[_0xe1fe('0xb')](this[_0xe1fe('0xc')][_0xe1fe('0xd')])||!this[_0xe1fe('0xc')][_0xe1fe('0xd')])){logger[_0xe1fe('0xe')](_0xe1fe('0xf'),_0x6f617b,_0xe1fe('0x10'));return _0x2ef815[_0xe1fe('0x11')]();}var _0x37a9b6=this['channel'];var _0x276b37={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe1fe('0x12')](_0xe1fe('0x13')),'direction':_0xe1fe('0x14')};if(this[_0xe1fe('0x15')]===_0xe1fe('0x16')){_0x276b37[_0xe1fe('0x17')]=utils['getMustacheRender'](_0x3e1cf1[0x2],this);}else{_0x276b37[_0xe1fe('0x17')]=utils['getMustacheRender'](_0x3e1cf1[0x1],this);}if(this[_0xe1fe('0x18')]){_0x276b37['to']=this['message'][_0xe1fe('0x19')]||'';if(this[_0xe1fe('0x15')]==='mail'&&_0x3e1cf1[0x1]==='1'){_0x276b37['cc']=this[_0xe1fe('0x18')]['cc']||'';}_0x276b37['from']=this[_0xe1fe('0x18')]['to']||'';_0x276b37['phone']=this[_0xe1fe('0x18')][_0xe1fe('0x1a')]||'';_0x276b37[_0xe1fe('0x1b')]=!![];if(this[_0xe1fe('0x18')]['subject']){_0x276b37['subject']='';_0x276b37['subject']+=_[_0xe1fe('0x1c')](this[_0xe1fe('0x18')][_0xe1fe('0x1d')],_0xe1fe('0x1e'))?'':_0xe1fe('0x1f');_0x276b37[_0xe1fe('0x1d')]+=this[_0xe1fe('0x18')][_0xe1fe('0x1d')];}}if(this[_0xe1fe('0x15')]===_0xe1fe('0x20')){_0x276b37[_0xe1fe('0x21')]=this[_0xe1fe('0x22')]['id'];}else{_0x276b37[_[_0xe1fe('0x23')](this['channel'])+'AccountId']=this[_0xe1fe('0x22')]['id'];}_0x276b37[_['upperFirst'](this[_0xe1fe('0x15')])+_0xe1fe('0x24')]=this[_0xe1fe('0xc')]['id'];if(rpc[this[_0xe1fe('0x15')]+_0xe1fe('0x25')]){if(this[_0xe1fe('0x15')]===_0xe1fe('0x16')){var _0x519402={'tls':{'rejectUnauthorized':![]}};if(this[_0xe1fe('0x22')][_0xe1fe('0x26')]['service']){_0x519402[_0xe1fe('0x27')]=this[_0xe1fe('0x22')][_0xe1fe('0x26')][_0xe1fe('0x27')];}else{_0x519402[_0xe1fe('0x28')]=this[_0xe1fe('0x22')][_0xe1fe('0x26')][_0xe1fe('0x28')];_0x519402['port']=this[_0xe1fe('0x22')][_0xe1fe('0x26')][_0xe1fe('0x29')];_0x519402[_0xe1fe('0x2a')]=this['account']['Smtp']['secure'];}if(this[_0xe1fe('0x22')][_0xe1fe('0x26')][_0xe1fe('0x2b')]){_0x519402[_0xe1fe('0x2c')]={'user':this[_0xe1fe('0x22')]['Smtp'][_0xe1fe('0x2d')],'pass':this[_0xe1fe('0x22')][_0xe1fe('0x26')][_0xe1fe('0x2e')]};}_0x276b37[_0xe1fe('0x2f')]=this['message']['messageId'];_0x276b37[_0xe1fe('0x30')]=_0xe1fe('0x31')+_[_0xe1fe('0x32')](_0x276b37['body'],_0xe1fe('0x33'),_0xe1fe('0x34'))+_0xe1fe('0x35');_0x276b37['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xe1fe('0x36'),'Precedence':_0xe1fe('0x37')};return mailRpc['sendMailMessage'](_0x519402,_0x276b37)[_0xe1fe('0x38')](function(_0x319eb8){logger['info'](_0xe1fe('0x39'),_0x6f617b);_0x276b37['messageId']=_0x319eb8['message'][_0xe1fe('0x3a')];return rpc[_0x37a9b6+_0xe1fe('0x25')][_0xe1fe('0x3b')](_0x276b37);})[_0xe1fe('0x38')](function(_0x435024){logger[_0xe1fe('0xe')](_0xe1fe('0xf'),_0x6f617b,JSON[_0xe1fe('0x3c')](_0x435024));})['catch'](function(_0x1557bf){logger[_0xe1fe('0x3d')](_0xe1fe('0x3e'),_0x6f617b,JSON[_0xe1fe('0x3c')](_0x1557bf));})[_0xe1fe('0x3f')](function(){_0x2ef815[_0xe1fe('0x11')]();});}else{return rpc[this[_0xe1fe('0x15')]+_0xe1fe('0x25')][_0xe1fe('0x3b')](_0x276b37)[_0xe1fe('0x38')](function(_0x2e8fb9){logger[_0xe1fe('0xe')](_0xe1fe('0xf'),_0x6f617b,_0x276b37[_0xe1fe('0x17')]);})[_0xe1fe('0x40')](function(_0x17bd91){logger[_0xe1fe('0x3d')](_0xe1fe('0xf'),_0x6f617b,JSON['stringify'](_0x17bd91));})['finally'](function(){_0x2ef815[_0xe1fe('0x11')]();});}}}catch(_0x407bff){logger[_0xe1fe('0x3d')](_0xe1fe('0xf'),_0x6f617b,JSON[_0xe1fe('0x3c')](_0x407bff));_0x2ef815['stop']();}};}; \ 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 eed6fc9..ff16a53 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 _0xd819=['channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stringify','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x26fade,_0x27bddd){var _0xc649f4=function(_0xd1f861){while(--_0xd1f861){_0x26fade['push'](_0x26fade['shift']());}};_0xc649f4(++_0x27bddd);}(_0xd819,0x181));var _0x9d81=function(_0x149de2,_0x5cbeec){_0x149de2=_0x149de2-0x0;var _0x59ffeb=_0xd819[_0x149de2];return _0x59ffeb;};'use strict';var moment=require('moment');var logger=require(_0x9d81('0x0'))(_0x9d81('0x1'));var rpc={'chatInteraction':require(_0x9d81('0x2')),'openchannelInteraction':require(_0x9d81('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x9d81('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x9d81('0x5'))};exports['consequence']=function(_0x382cc1,_0x239432,_0x3a4899,_0x565411){return function(_0xfc583e){try{logger[_0x9d81('0x6')](_0x9d81('0x7'),_0x382cc1,_0x239432[0x0]);var _0x1e1329={'closed':0x1,'closedAt':moment()[_0x9d81('0x8')](_0x9d81('0x9')),'closeReason':_0x9d81('0xa'),'disposition':_0x239432[0x0]};if(rpc[_0x565411[_0x9d81('0xb')]+_0x9d81('0xc')]){rpc[_0x565411[_0x9d81('0xb')]+_0x9d81('0xc')][_0x9d81('0xd')](_0x565411[_0x9d81('0xe')]['id'],_0x1e1329)[_0x9d81('0xf')](function(_0x53951a){logger[_0x9d81('0x6')](_0x9d81('0x10'),_0x382cc1,_0x565411['interaction']['id']);})[_0x9d81('0x11')](function(_0x3fb6b5){logger[_0x9d81('0x12')](_0x9d81('0x13'),_0x382cc1,JSON['stringify'](_0x3fb6b5));})[_0x9d81('0x14')](function(){_0xfc583e['stop']();});}}catch(_0x228553){logger['error'](_0x9d81('0x13'),_0x382cc1,JSON[_0x9d81('0x15')](_0x228553));_0xfc583e['stop']();}};}; \ No newline at end of file +var _0x6cfd=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','stop','routing'];(function(_0x14936e,_0xa0b09f){var _0x3776f0=function(_0x18d482){while(--_0x18d482){_0x14936e['push'](_0x14936e['shift']());}};_0x3776f0(++_0xa0b09f);}(_0x6cfd,0x1b7));var _0xd6cf=function(_0x30210f,_0x58b53b){_0x30210f=_0x30210f-0x0;var _0x1a5dbe=_0x6cfd[_0x30210f];return _0x1a5dbe;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xd6cf('0x0'));var rpc={'chatInteraction':require(_0xd6cf('0x1')),'openchannelInteraction':require(_0xd6cf('0x2')),'smsInteraction':require(_0xd6cf('0x3')),'mailInteraction':require(_0xd6cf('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd6cf('0x5'))};exports[_0xd6cf('0x6')]=function(_0x150cf6,_0x58c50e,_0x517713,_0x1681fc){return function(_0x5af324){try{logger[_0xd6cf('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x150cf6,_0x58c50e[0x0]);var _0x362863={'closed':0x1,'closedAt':moment()[_0xd6cf('0x8')](_0xd6cf('0x9')),'closeReason':_0xd6cf('0xa'),'disposition':_0x58c50e[0x0]};if(rpc[_0x1681fc[_0xd6cf('0xb')]+_0xd6cf('0xc')]){rpc[_0x1681fc[_0xd6cf('0xb')]+_0xd6cf('0xc')][_0xd6cf('0xd')](_0x1681fc['interaction']['id'],_0x362863)[_0xd6cf('0xe')](function(_0x527f5d){logger[_0xd6cf('0x7')](_0xd6cf('0xf'),_0x150cf6,_0x1681fc[_0xd6cf('0x10')]['id']);})[_0xd6cf('0x11')](function(_0x544885){logger[_0xd6cf('0x12')](_0xd6cf('0x13'),_0x150cf6,JSON['stringify'](_0x544885));})['finally'](function(){_0x5af324['stop']();});}}catch(_0x2919b3){logger['error']('[%s][CLOSE]\x20%s',_0x150cf6,JSON[_0xd6cf('0x14')](_0x2919b3));_0x5af324[_0xd6cf('0x15')]();}};}; \ 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 f74eea7..132c84e 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 _0xbb98=['YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','dialogflow','result','fulfillment','speech','providerName','metadata','endConversation','next','message','lodash','moment','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','contact','format'];(function(_0x355f07,_0x4606eb){var _0x12b0d3=function(_0x3ad78a){while(--_0x3ad78a){_0x355f07['push'](_0x355f07['shift']());}};_0x12b0d3(++_0x4606eb);}(_0xbb98,0x140));var _0x8bb9=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0xbb98[_0x3e0b8f];return _0x22f742;};'use strict';var _=require(_0x8bb9('0x0'));var moment=require(_0x8bb9('0x1'));var apiai=require(_0x8bb9('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0x8bb9('0x3'))(_0x8bb9('0x4'));var rpc={'chatMessage':require(_0x8bb9('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8bb9('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8bb9('0x7')),'whatsappMessage':require(_0x8bb9('0x8'))};exports[_0x8bb9('0x9')]=function(_0xb341ef,_0x24e8b1){return function(_0x58967d){try{if(!_['isNil'](this[_0x8bb9('0xa')][_0x8bb9('0xb')])){logger[_0x8bb9('0xc')](_0x8bb9('0xd'),_0xb341ef,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x58967d['next']();}var _0x5bbb1e={'ContactId':this[_0x8bb9('0xe')]['id'],'sentAt':moment()[_0x8bb9('0xf')](_0x8bb9('0x10')),'direction':_0x8bb9('0x11')};if(this['channel']==='sms'||this[_0x8bb9('0x12')]==='whatsapp'){_0x5bbb1e[_0x8bb9('0x13')]=this[_0x8bb9('0xa')]['phone'];}var _0x61bf4a=this[_0x8bb9('0x12')];if(_0x61bf4a===_0x8bb9('0x14')){_0x5bbb1e[_0x8bb9('0x15')]=this[_0x8bb9('0x16')]['id'];}else{_0x5bbb1e[_[_0x8bb9('0x17')](_0x61bf4a)+_0x8bb9('0x18')]=this[_0x8bb9('0x16')]['id'];}_0x5bbb1e[_[_0x8bb9('0x17')](_0x61bf4a)+_0x8bb9('0x19')]=this['interaction']['id'];if(this[_0x8bb9('0xa')]['created']){var _0x324c73=_0x24e8b1[0x2];if(!_[_0x8bb9('0x1a')](_0x324c73)){_0x5bbb1e[_0x8bb9('0x1b')]=utils[_0x8bb9('0x1c')](_0x324c73,this);return rpc[_0x61bf4a+_0x8bb9('0x1d')][_0x8bb9('0x1e')](_0x5bbb1e)[_0x8bb9('0x1f')](function(_0x38b5fc){logger[_0x8bb9('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xb341ef,_0x5bbb1e[_0x8bb9('0x1b')]);})[_0x8bb9('0x20')](function(_0x4806be){logger[_0x8bb9('0x21')](_0x8bb9('0xd'),_0xb341ef,JSON[_0x8bb9('0x22')](_0x4806be));})[_0x8bb9('0x23')](function(){logger[_0x8bb9('0xc')](_0x8bb9('0x24'),_0xb341ef);_0x58967d[_0x8bb9('0x25')]();});}else{logger[_0x8bb9('0xc')](_0x8bb9('0x26'),_0xb341ef);_0x58967d[_0x8bb9('0x25')]();}}else{var _0x22688d=this;var _0x24d33a=apiai(_0x24e8b1[0x0],{'language':_0x24e8b1[0x1]||'en'});return _0x24d33a['textRequest'](this['message']['body'],{'sessionId':md5(this[_0x8bb9('0xa')]['id'])})[_0x8bb9('0x1f')](function(_0x361da8){_0x22688d['body'][_0x8bb9('0x27')]=_0x361da8;_0x5bbb1e['body']=_0x361da8[_0x8bb9('0x28')][_0x8bb9('0x29')][_0x8bb9('0x2a')];_0x5bbb1e[_0x8bb9('0x2b')]=_0x8bb9('0x27');_0x5bbb1e['providerResponse']=JSON[_0x8bb9('0x22')](_0x361da8);return rpc[_0x61bf4a+_0x8bb9('0x1d')][_0x8bb9('0x1e')](_0x5bbb1e)[_0x8bb9('0x1f')](function(_0x4575a7){logger[_0x8bb9('0xc')](_0x8bb9('0xd'),_0xb341ef,_0x5bbb1e[_0x8bb9('0x1b')]);if(_0x361da8[_0x8bb9('0x28')][_0x8bb9('0x2c')][_0x8bb9('0x2d')]){_0x58967d[_0x8bb9('0x2e')]();}else{_0x58967d['stop']();}})[_0x8bb9('0x20')](function(_0x5ca9bf){logger['error'](_0x8bb9('0xd'),_0xb341ef,JSON[_0x8bb9('0x22')](_0x5ca9bf));_0x58967d['next']();});})[_0x8bb9('0x20')](function(_0x5bd44f){logger[_0x8bb9('0x21')](_0x8bb9('0xd'),_0xb341ef,_0x5bd44f[_0x8bb9('0x2f')]);_0x58967d[_0x8bb9('0x2e')]();});}}catch(_0x167d94){logger[_0x8bb9('0x21')](_0x8bb9('0xd'),_0xb341ef,JSON[_0x8bb9('0x22')](_0x167d94));_0x58967d[_0x8bb9('0x25')]();}};}; \ No newline at end of file +var _0x7c17=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','providerName','providerResponse','result','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x7c17,0x104));var _0x77c1=function(_0x278bdd,_0x5f01a0){_0x278bdd=_0x278bdd-0x0;var _0xdb687a=_0x7c17[_0x278bdd];return _0xdb687a;};'use strict';var _=require(_0x77c1('0x0'));var moment=require(_0x77c1('0x1'));var apiai=require(_0x77c1('0x2'));var md5=require(_0x77c1('0x3'));var utils=require(_0x77c1('0x4'));var logger=require(_0x77c1('0x5'))(_0x77c1('0x6'));var rpc={'chatMessage':require(_0x77c1('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x77c1('0x8')),'smsMessage':require(_0x77c1('0x9')),'faxMessage':require(_0x77c1('0xa')),'whatsappMessage':require(_0x77c1('0xb'))};exports[_0x77c1('0xc')]=function(_0x4134d7,_0x38fa90){return function(_0x28680b){try{if(!_[_0x77c1('0xd')](this[_0x77c1('0xe')][_0x77c1('0xf')])){logger['info'](_0x77c1('0x10'),_0x4134d7,_0x77c1('0x11'));return _0x28680b[_0x77c1('0x12')]();}var _0xd603d3={'ContactId':this[_0x77c1('0x13')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x77c1('0x14')]===_0x77c1('0x15')||this['channel']===_0x77c1('0x16')){_0xd603d3[_0x77c1('0x17')]=this['interaction'][_0x77c1('0x17')];}var _0x29df8d=this[_0x77c1('0x14')];if(_0x29df8d===_0x77c1('0x18')){_0xd603d3[_0x77c1('0x19')]=this[_0x77c1('0x1a')]['id'];}else{_0xd603d3[_[_0x77c1('0x1b')](_0x29df8d)+_0x77c1('0x1c')]=this[_0x77c1('0x1a')]['id'];}_0xd603d3[_[_0x77c1('0x1b')](_0x29df8d)+_0x77c1('0x1d')]=this['interaction']['id'];if(this['interaction'][_0x77c1('0x1e')]){var _0x257dbf=_0x38fa90[0x2];if(!_[_0x77c1('0x1f')](_0x257dbf)){_0xd603d3[_0x77c1('0x20')]=utils[_0x77c1('0x21')](_0x257dbf,this);return rpc[_0x29df8d+_0x77c1('0x22')][_0x77c1('0x23')](_0xd603d3)[_0x77c1('0x24')](function(_0x51afff){logger[_0x77c1('0x25')](_0x77c1('0x10'),_0x4134d7,_0xd603d3[_0x77c1('0x20')]);})[_0x77c1('0x26')](function(_0x17a9cb){logger[_0x77c1('0x27')](_0x77c1('0x10'),_0x4134d7,JSON[_0x77c1('0x28')](_0x17a9cb));})[_0x77c1('0x29')](function(){logger[_0x77c1('0x25')](_0x77c1('0x2a'),_0x4134d7);_0x28680b[_0x77c1('0x2b')]();});}else{logger[_0x77c1('0x25')](_0x77c1('0x2c'),_0x4134d7);_0x28680b[_0x77c1('0x2b')]();}}else{var _0x4a81f9=this;var _0x48cfbb=apiai(_0x38fa90[0x0],{'language':_0x38fa90[0x1]||'en'});return _0x48cfbb[_0x77c1('0x2d')](this[_0x77c1('0x2e')][_0x77c1('0x20')],{'sessionId':md5(this[_0x77c1('0xe')]['id'])})[_0x77c1('0x24')](function(_0x595b72){_0x4a81f9['body'][_0x77c1('0x2f')]=_0x595b72;_0xd603d3[_0x77c1('0x20')]=_0x595b72['result'][_0x77c1('0x30')]['speech'];_0xd603d3[_0x77c1('0x31')]=_0x77c1('0x2f');_0xd603d3[_0x77c1('0x32')]=JSON[_0x77c1('0x28')](_0x595b72);return rpc[_0x29df8d+_0x77c1('0x22')][_0x77c1('0x23')](_0xd603d3)[_0x77c1('0x24')](function(_0x1ebbc7){logger[_0x77c1('0x25')](_0x77c1('0x10'),_0x4134d7,_0xd603d3[_0x77c1('0x20')]);if(_0x595b72[_0x77c1('0x33')][_0x77c1('0x34')][_0x77c1('0x35')]){_0x28680b[_0x77c1('0x12')]();}else{_0x28680b[_0x77c1('0x2b')]();}})['catch'](function(_0x4947fa){logger['error'](_0x77c1('0x10'),_0x4134d7,JSON['stringify'](_0x4947fa));_0x28680b[_0x77c1('0x12')]();});})[_0x77c1('0x26')](function(_0x17238b){logger['error'](_0x77c1('0x10'),_0x4134d7,_0x17238b['message']);_0x28680b[_0x77c1('0x12')]();});}}catch(_0xa95b2){logger[_0x77c1('0x27')](_0x77c1('0x10'),_0x4134d7,JSON[_0x77c1('0x28')](_0xa95b2));_0x28680b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index adf4608..e6eb0a0 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1e0=['dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','created','getMustacheRender','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','fulfillmentText','push','all','then','next','message','lodash'];(function(_0x436bed,_0x5d3387){var _0x5dc636=function(_0x21b5b6){while(--_0x21b5b6){_0x436bed['push'](_0x436bed['shift']());}};_0x5dc636(++_0x5d3387);}(_0xa1e0,0x1bb));var _0x0a1e=function(_0x3d0cd0,_0x48719b){_0x3d0cd0=_0x3d0cd0-0x0;var _0x205d7c=_0xa1e0[_0x3d0cd0];return _0x205d7c;};'use strict';var _=require(_0x0a1e('0x0'));var dialogflow=require(_0x0a1e('0x1'));var md5=require(_0x0a1e('0x2'));var moment=require(_0x0a1e('0x3'));var Promise=require(_0x0a1e('0x4'));var logger=require(_0x0a1e('0x5'))(_0x0a1e('0x6'));var utils=require(_0x0a1e('0x7'));var rpc={'chatMessage':require(_0x0a1e('0x8')),'openchannelMessage':require(_0x0a1e('0x9')),'mailMessage':require(_0x0a1e('0xa')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x0a1e('0xb'))};function createMessage(_0x5c10c9,_0x505afa,_0x34981e,_0x5e121d){return new Promise(function(_0x4fd1e0,_0x4342db){var _0x1c5477=_[_0x0a1e('0xc')](_0x34981e);_0x1c5477[_0x0a1e('0xd')]=_0x5e121d;return rpc[_0x505afa+_0x0a1e('0xe')]['create'](_0x1c5477)['then'](function(){logger[_0x0a1e('0xf')](_0x0a1e('0x10'),_0x5c10c9,_0x1c5477[_0x0a1e('0xd')]);_0x4fd1e0();})[_0x0a1e('0x11')](function(_0x20698e){logger[_0x0a1e('0x12')](_0x0a1e('0x10'),_0x5c10c9,JSON[_0x0a1e('0x13')](_0x20698e));_0x4342db(_0x20698e);});});}exports['consequence']=function(_0x3bd9d7,_0x295dce){return function(_0x42af83){try{if(!_[_0x0a1e('0x14')](this['interaction'][_0x0a1e('0x15')])){logger['info'](_0x0a1e('0x10'),_0x3bd9d7,_0x0a1e('0x16'));return _0x42af83['next']();}var _0xc4f08e={'ContactId':this[_0x0a1e('0x17')]['id'],'sentAt':moment()[_0x0a1e('0x18')](_0x0a1e('0x19')),'direction':_0x0a1e('0x1a')};if(this['channel']===_0x0a1e('0x1b')||this[_0x0a1e('0x1c')]==='whatsapp'){_0xc4f08e[_0x0a1e('0x1d')]=this[_0x0a1e('0x1e')][_0x0a1e('0x1d')];}var _0x30e77c=this[_0x0a1e('0x1c')];if(_0x30e77c===_0x0a1e('0x1f')){_0xc4f08e[_0x0a1e('0x20')]=this[_0x0a1e('0x21')]['id'];}else{_0xc4f08e[_[_0x0a1e('0x22')](_0x30e77c)+_0x0a1e('0x23')]=this['account']['id'];}_0xc4f08e[_[_0x0a1e('0x22')](_0x30e77c)+'InteractionId']=this['interaction']['id'];if(this[_0x0a1e('0x1e')][_0x0a1e('0x24')]){var _0x420026=_0x295dce[0x4];if(!_['isEmpty'](_0x420026)){_0xc4f08e['body']=utils[_0x0a1e('0x25')](_0x420026,this);return rpc[_0x30e77c+_0x0a1e('0xe')][_0x0a1e('0x26')](_0xc4f08e)['then'](function(_0x216b19){logger[_0x0a1e('0xf')](_0x0a1e('0x10'),_0x3bd9d7,_0xc4f08e[_0x0a1e('0xd')]);})['catch'](function(_0x438e71){logger[_0x0a1e('0x12')](_0x0a1e('0x10'),_0x3bd9d7,JSON[_0x0a1e('0x13')](_0x438e71));})[_0x0a1e('0x27')](function(){logger['info'](_0x0a1e('0x28'),_0x3bd9d7);_0x42af83[_0x0a1e('0x29')]();});}else{logger[_0x0a1e('0xf')](_0x0a1e('0x2a'),_0x3bd9d7);_0x42af83[_0x0a1e('0x29')]();}}else{var _0x55525a=this;var _0x4da163=_0x295dce[0x2][_0x0a1e('0x2b')](/\\n/g,'\x0a');var _0x279fc5={'credentials':{'private_key':_0x4da163,'client_email':_0x295dce[0x1]}};var _0x53664a=new dialogflow[(_0x0a1e('0x2c'))](_0x279fc5);var _0x556eeb=_0x53664a[_0x0a1e('0x2d')](_0x295dce[0x0],md5(_0x55525a[_0x0a1e('0x1e')]['id']));var _0x290941={'session':_0x556eeb,'queryInput':{'text':{'text':_0x55525a['message']['body'],'languageCode':_0x295dce[0x3]||'en'}}};return _0x53664a[_0x0a1e('0x2e')](_0x290941)['then'](function(_0x314578){if(_0x314578&&_0x314578[_0x0a1e('0x2f')]){_0x55525a[_0x0a1e('0xd')][_0x0a1e('0x30')]=_0x314578;var _0x3e79f7=_0x314578[0x0];var _0x35d7b5=_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x32')]&&_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x32')]['fields']?_0x3e79f7['queryResult']['diagnosticInfo'][_0x0a1e('0x33')]['end_conversation'][_0x0a1e('0x34')]:![];_0x55525a[_0x0a1e('0xd')][_0x0a1e('0x35')]=_0x3e79f7['queryResult']['action'];_0x55525a[_0x0a1e('0xd')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x36')];_0x55525a[_0x0a1e('0xd')][_0x0a1e('0x37')]=_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x32')]&&_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x32')][_0x0a1e('0x33')]?_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x32')][_0x0a1e('0x33')][_0x0a1e('0x38')][_0x0a1e('0x34')]:![];_0x55525a[_0x0a1e('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x39')][_0x0a1e('0x3a')];_0x55525a[_0x0a1e('0xd')][_0x0a1e('0x3b')]=_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x39')][_0x0a1e('0x3c')];_0x55525a[_0x0a1e('0xd')][_0x0a1e('0x3d')]=_0x3e79f7['queryResult']['intent'][_0x0a1e('0x3e')];_0x55525a['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x3f')];_0x55525a['body'][_0x0a1e('0x40')]=_0x3e79f7[_0x0a1e('0x31')][_0x0a1e('0x41')];_0x55525a[_0x0a1e('0xd')]['DIALOGFLOWV2_SCORE']=_0x3e79f7['queryResult'][_0x0a1e('0x42')];_0xc4f08e[_0x0a1e('0x43')]='dialogflowV2';_0xc4f08e['providerResponse']=JSON[_0x0a1e('0x13')](_0x314578);var _0x336a79=[];for(var _0x5edb26=0x0;_0x5edb26<_0x314578[_0x0a1e('0x2f')];_0x5edb26++){var _0x309e9d=_0x314578[_0x5edb26];if(_0x309e9d&&_0x309e9d[_0x0a1e('0x31')]&&_0x309e9d[_0x0a1e('0x31')][_0x0a1e('0x44')]){_0x336a79[_0x0a1e('0x45')](createMessage(_0x3bd9d7,_0x30e77c,_0xc4f08e,_0x309e9d[_0x0a1e('0x31')][_0x0a1e('0x44')]));}}return Promise[_0x0a1e('0x46')](_0x336a79)[_0x0a1e('0x47')](function(){if(_0x35d7b5){_0x42af83[_0x0a1e('0x48')]();}else{_0x42af83[_0x0a1e('0x29')]();}})['catch'](function(_0x42b2d7){logger[_0x0a1e('0x12')](_0x0a1e('0x10'),_0x3bd9d7,JSON['stringify'](_0x42b2d7));_0x42af83[_0x0a1e('0x48')]();});}})['catch'](function(_0x45a068){logger[_0x0a1e('0x12')](_0x0a1e('0x10'),_0x3bd9d7,_0x45a068[_0x0a1e('0x49')]);_0x42af83[_0x0a1e('0x48')]();});}}catch(_0xf04fc2){logger[_0x0a1e('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x3bd9d7,JSON['stringify'](_0xf04fc2));_0x42af83[_0x0a1e('0x29')]();}};}; \ No newline at end of file +var _0x082e=['[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','create','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','replace','SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','providerResponse','stringify','push','fulfillmentText','all','stop','lodash','dialogflow','md5','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','Message','then','info','body','catch','error'];(function(_0x84ac5b,_0x56ffaa){var _0x4550ba=function(_0x2ef142){while(--_0x2ef142){_0x84ac5b['push'](_0x84ac5b['shift']());}};_0x4550ba(++_0x56ffaa);}(_0x082e,0x17d));var _0xe082=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x082e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe082('0x0'));var dialogflow=require(_0xe082('0x1'));var md5=require(_0xe082('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xe082('0x3'))('routing');var utils=require(_0xe082('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe082('0x5')),'mailMessage':require(_0xe082('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe082('0x7'))};function createMessage(_0x44f13a,_0x559bee,_0x2085b6,_0x1c75e5){return new Promise(function(_0x4ed2f7,_0x50ab3d){var _0x42ea37=_[_0xe082('0x8')](_0x2085b6);_0x42ea37['body']=_0x1c75e5;return rpc[_0x559bee+_0xe082('0x9')]['create'](_0x42ea37)[_0xe082('0xa')](function(){logger[_0xe082('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x44f13a,_0x42ea37[_0xe082('0xc')]);_0x4ed2f7();})[_0xe082('0xd')](function(_0x29e772){logger[_0xe082('0xe')](_0xe082('0xf'),_0x44f13a,JSON['stringify'](_0x29e772));_0x50ab3d(_0x29e772);});});}exports[_0xe082('0x10')]=function(_0x1127d1,_0x588ace){return function(_0x4d7f2d){try{if(!_[_0xe082('0x11')](this[_0xe082('0x12')][_0xe082('0x13')])){logger[_0xe082('0xb')](_0xe082('0xf'),_0x1127d1,_0xe082('0x14'));return _0x4d7f2d[_0xe082('0x15')]();}var _0x3f0b86={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe082('0x16')](_0xe082('0x17')),'direction':_0xe082('0x18')};if(this[_0xe082('0x19')]===_0xe082('0x1a')||this[_0xe082('0x19')]===_0xe082('0x1b')){_0x3f0b86['phone']=this[_0xe082('0x12')][_0xe082('0x1c')];}var _0x5ae678=this[_0xe082('0x19')];if(_0x5ae678===_0xe082('0x1d')){_0x3f0b86[_0xe082('0x1e')]=this[_0xe082('0x1f')]['id'];}else{_0x3f0b86[_[_0xe082('0x20')](_0x5ae678)+_0xe082('0x21')]=this[_0xe082('0x1f')]['id'];}_0x3f0b86[_[_0xe082('0x20')](_0x5ae678)+_0xe082('0x22')]=this[_0xe082('0x12')]['id'];if(this[_0xe082('0x12')][_0xe082('0x23')]){var _0x30a29d=_0x588ace[0x4];if(!_['isEmpty'](_0x30a29d)){_0x3f0b86[_0xe082('0xc')]=utils[_0xe082('0x24')](_0x30a29d,this);return rpc[_0x5ae678+_0xe082('0x9')][_0xe082('0x25')](_0x3f0b86)['then'](function(_0x315428){logger[_0xe082('0xb')](_0xe082('0xf'),_0x1127d1,_0x3f0b86['body']);})[_0xe082('0xd')](function(_0x51dfe1){logger['error'](_0xe082('0xf'),_0x1127d1,JSON['stringify'](_0x51dfe1));})['finally'](function(){logger[_0xe082('0xb')](_0xe082('0x26'),_0x1127d1);_0x4d7f2d['stop']();});}else{logger[_0xe082('0xb')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1127d1);_0x4d7f2d['stop']();}}else{var _0x46b769=this;var _0x47f187=_0x588ace[0x2][_0xe082('0x27')](/\\n/g,'\x0a');var _0x8ff4f4={'credentials':{'private_key':_0x47f187,'client_email':_0x588ace[0x1]}};var _0x5db0fb=new dialogflow[(_0xe082('0x28'))](_0x8ff4f4);var _0x3a62d2=_0x5db0fb['sessionPath'](_0x588ace[0x0],md5(_0x46b769[_0xe082('0x12')]['id']));var _0x2cb087={'session':_0x3a62d2,'queryInput':{'text':{'text':_0x46b769[_0xe082('0x29')][_0xe082('0xc')],'languageCode':_0x588ace[0x3]||'en'}}};return _0x5db0fb[_0xe082('0x2a')](_0x2cb087)[_0xe082('0xa')](function(_0x1ab9f6){if(_0x1ab9f6&&_0x1ab9f6['length']){_0x46b769[_0xe082('0xc')][_0xe082('0x2b')]=_0x1ab9f6;var _0x1d998f=_0x1ab9f6[0x0];var _0xf5dcd7=_0x1d998f[_0xe082('0x2c')][_0xe082('0x2d')]&&_0x1d998f[_0xe082('0x2c')]['diagnosticInfo'][_0xe082('0x2e')]?_0x1d998f[_0xe082('0x2c')][_0xe082('0x2d')][_0xe082('0x2e')]['end_conversation']['boolValue']:![];_0x46b769[_0xe082('0xc')][_0xe082('0x2f')]=_0x1d998f[_0xe082('0x2c')][_0xe082('0x30')];_0x46b769[_0xe082('0xc')][_0xe082('0x31')]=_0x1d998f[_0xe082('0x2c')][_0xe082('0x32')];_0x46b769[_0xe082('0xc')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1d998f[_0xe082('0x2c')][_0xe082('0x2d')]&&_0x1d998f[_0xe082('0x2c')]['diagnosticInfo']['fields']?_0x1d998f[_0xe082('0x2c')][_0xe082('0x2d')]['fields'][_0xe082('0x33')][_0xe082('0x34')]:![];_0x46b769[_0xe082('0xc')][_0xe082('0x35')]=_0x1d998f[_0xe082('0x2c')][_0xe082('0x36')]['name'];_0x46b769['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1d998f[_0xe082('0x2c')][_0xe082('0x36')]['displayName'];_0x46b769[_0xe082('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1d998f[_0xe082('0x2c')][_0xe082('0x36')][_0xe082('0x37')];_0x46b769[_0xe082('0xc')][_0xe082('0x38')]=_0x1d998f['queryResult'][_0xe082('0x39')];_0x46b769[_0xe082('0xc')][_0xe082('0x3a')]=_0x1d998f[_0xe082('0x2c')][_0xe082('0x3b')];_0x46b769[_0xe082('0xc')]['DIALOGFLOWV2_SCORE']=_0x1d998f[_0xe082('0x2c')]['intentDetectionConfidence'];_0x3f0b86['providerName']=_0xe082('0x2b');_0x3f0b86[_0xe082('0x3c')]=JSON[_0xe082('0x3d')](_0x1ab9f6);var _0x304a0b=[];for(var _0x30b5d0=0x0;_0x30b5d0<_0x1ab9f6['length'];_0x30b5d0++){var _0x433c2c=_0x1ab9f6[_0x30b5d0];if(_0x433c2c&&_0x433c2c[_0xe082('0x2c')]&&_0x433c2c[_0xe082('0x2c')]['fulfillmentText']){_0x304a0b[_0xe082('0x3e')](createMessage(_0x1127d1,_0x5ae678,_0x3f0b86,_0x433c2c[_0xe082('0x2c')][_0xe082('0x3f')]));}}return Promise[_0xe082('0x40')](_0x304a0b)[_0xe082('0xa')](function(){if(_0xf5dcd7){_0x4d7f2d[_0xe082('0x15')]();}else{_0x4d7f2d[_0xe082('0x41')]();}})[_0xe082('0xd')](function(_0x41c6b0){logger[_0xe082('0xe')](_0xe082('0xf'),_0x1127d1,JSON['stringify'](_0x41c6b0));_0x4d7f2d[_0xe082('0x15')]();});}})[_0xe082('0xd')](function(_0x414805){logger['error'](_0xe082('0xf'),_0x1127d1,_0x414805[_0xe082('0x29')]);_0x4d7f2d['next']();});}}catch(_0x5d8a0c){logger['error'](_0xe082('0xf'),_0x1127d1,JSON[_0xe082('0x3d')](_0x5d8a0c));_0x4d7f2d[_0xe082('0x41')]();}};}; \ 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 b53590f..6bca49a 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 _0x8344=['../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','error','map','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text'];(function(_0x41b0f6,_0x5c51eb){var _0x112ce2=function(_0x127843){while(--_0x127843){_0x41b0f6['push'](_0x41b0f6['shift']());}};_0x112ce2(++_0x5c51eb);}(_0x8344,0x131));var _0x4834=function(_0x157ade,_0x22fa84){_0x157ade=_0x157ade-0x0;var _0x3b60a9=_0x8344[_0x157ade];return _0x3b60a9;};'use strict';var schema=require(_0x4834('0x0'));var _=require(_0x4834('0x1'));var htmlToText=require(_0x4834('0x2'));var utils=require('./utils');var logger=require(_0x4834('0x3'))(_0x4834('0x4'));var gotoif=schema({'condition':{'type':_0x4834('0x5'),'required':!![],'message':_0x4834('0x6')},'priorityTrue':{'type':'number','message':_0x4834('0x7')},'priorityFalse':{'type':'number','message':_0x4834('0x8')}});exports[_0x4834('0x9')]=function(_0x307663,_0x22bfd9){return function(_0x9ef5ff){try{var _0x3033be={'condition':htmlToText[_0x4834('0xa')](utils['getMustacheRender'](_0x22bfd9[0x0],this),{'wordwrap':![]})[_0x4834('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x22bfd9[0x1],'priorityFalse':_0x22bfd9[0x2]};var _0xee88e=gotoif[_0x4834('0x0')](_0x3033be,{'typecast':!![]});if(_0xee88e['length']){logger[_0x4834('0xc')]('[%s][GOTOIF]\x20%s',_0x307663,_[_0x4834('0xd')](_0xee88e,_0x4834('0xe'))[_0x4834('0xf')](',\x20'));_0x9ef5ff[_0x4834('0x10')]();}else{try{var _0x53025f=eval('('+_0x3033be['condition']+')');var _0x47d6d2=_0x53025f?_0x3033be[_0x4834('0x11')]:_0x3033be[_0x4834('0x12')];logger[_0x4834('0x13')](_0x4834('0x14'),_0x307663,_0x3033be[_0x4834('0x15')],_0x53025f,_0x47d6d2||_0x4834('0x16'));if(_0x47d6d2){var _0x2393d5=_[_0x4834('0x17')](_0x9ef5ff[_0x4834('0x18')](),{'p':_0x47d6d2});if(_0x2393d5>=0x0){logger[_0x4834('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x307663,_0x47d6d2||_0x4834('0x16'),_0x2393d5);_0x9ef5ff[_0x4834('0x16')](_0x2393d5);}else{logger[_0x4834('0x13')](_0x4834('0x19'),_0x307663,_0x47d6d2||_0x4834('0x16'));_0x9ef5ff['stop']();}}else{_0x9ef5ff[_0x4834('0x16')]();}}catch(_0x5c5596){logger[_0x4834('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x307663,_0x5c5596[_0x4834('0xe')]);_0x9ef5ff[_0x4834('0x10')]();}}}catch(_0x4df12d){logger[_0x4834('0xc')](_0x4834('0x1a'),_0x307663,JSON[_0x4834('0x1b')](_0x4df12d));_0x9ef5ff['stop']();}};}; \ No newline at end of file +var _0xfe8e=['routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','getMustacheRender','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger'];(function(_0x2d3e45,_0x16d47a){var _0x369ff5=function(_0x4dfc35){while(--_0x4dfc35){_0x2d3e45['push'](_0x2d3e45['shift']());}};_0x369ff5(++_0x16d47a);}(_0xfe8e,0xb8));var _0xefe8=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xfe8e[_0x344a3f];return _0x264712;};'use strict';var schema=require(_0xefe8('0x0'));var _=require(_0xefe8('0x1'));var htmlToText=require(_0xefe8('0x2'));var utils=require(_0xefe8('0x3'));var logger=require(_0xefe8('0x4'))(_0xefe8('0x5'));var gotoif=schema({'condition':{'type':_0xefe8('0x6'),'required':!![],'message':_0xefe8('0x7')},'priorityTrue':{'type':_0xefe8('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xefe8('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xefe8('0x9')]=function(_0x1fd70e,_0x2e9e55){return function(_0x3e1ad3){try{var _0x2a9536={'condition':htmlToText['fromString'](utils[_0xefe8('0xa')](_0x2e9e55[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2e9e55[0x1],'priorityFalse':_0x2e9e55[0x2]};var _0x4a4618=gotoif[_0xefe8('0x0')](_0x2a9536,{'typecast':!![]});if(_0x4a4618['length']){logger[_0xefe8('0xb')](_0xefe8('0xc'),_0x1fd70e,_['map'](_0x4a4618,_0xefe8('0xd'))[_0xefe8('0xe')](',\x20'));_0x3e1ad3[_0xefe8('0xf')]();}else{try{var _0x1cf67c=eval('('+_0x2a9536[_0xefe8('0x10')]+')');var _0x5e0bb8=_0x1cf67c?_0x2a9536['priorityTrue']:_0x2a9536[_0xefe8('0x11')];logger['info'](_0xefe8('0x12'),_0x1fd70e,_0x2a9536[_0xefe8('0x10')],_0x1cf67c,_0x5e0bb8||_0xefe8('0x13'));if(_0x5e0bb8){var _0x20e6f1=_[_0xefe8('0x14')](_0x3e1ad3[_0xefe8('0x15')](),{'p':_0x5e0bb8});if(_0x20e6f1>=0x0){logger[_0xefe8('0x16')](_0xefe8('0x17'),_0x1fd70e,_0x5e0bb8||'next',_0x20e6f1);_0x3e1ad3[_0xefe8('0x13')](_0x20e6f1);}else{logger['info'](_0xefe8('0x18'),_0x1fd70e,_0x5e0bb8||_0xefe8('0x13'));_0x3e1ad3[_0xefe8('0xf')]();}}else{_0x3e1ad3[_0xefe8('0x13')]();}}catch(_0x3181a5){logger[_0xefe8('0xb')](_0xefe8('0x19'),_0x1fd70e,_0x3181a5[_0xefe8('0xd')]);_0x3e1ad3['stop']();}}}catch(_0x4bff32){logger[_0xefe8('0xb')](_0xefe8('0xc'),_0x1fd70e,JSON[_0xefe8('0x1a')](_0x4bff32));_0x3e1ad3[_0xefe8('0xf')]();}};}; \ 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 ec8865a..3c80b8c 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 _0xf566=['stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf566,0x109));var _0x6f56=function(_0x337d86,_0x12d2d4){_0x337d86=_0x337d86-0x0;var _0x22fd02=_0xf566[_0x337d86];return _0x22fd02;};'use strict';var schema=require(_0x6f56('0x0'));var _=require(_0x6f56('0x1'));var logger=require(_0x6f56('0x2'))(_0x6f56('0x3'));var gotop=schema({'priority':{'type':_0x6f56('0x4'),'required':!![],'message':_0x6f56('0x5')}});exports[_0x6f56('0x6')]=function(_0x3f5c25,_0x291aa8){return function(_0x221961){try{var _0x195704={'priority':_0x291aa8[0x0]};var _0x4080ba=gotop[_0x6f56('0x0')](_0x195704,{'typecast':!![]});if(_0x4080ba['length']){logger[_0x6f56('0x7')](_0x6f56('0x8'),_0x3f5c25,_[_0x6f56('0x9')](_0x4080ba,_0x6f56('0xa'))[_0x6f56('0xb')](',\x20'));_0x221961[_0x6f56('0xc')]();}else{logger['info'](_0x6f56('0xd'),_0x3f5c25,_0x195704[_0x6f56('0xe')]);if(_0x195704[_0x6f56('0xe')]){var _0xa50079=_[_0x6f56('0xf')](_0x221961[_0x6f56('0x10')](),{'p':_0x195704[_0x6f56('0xe')]});if(_0xa50079>=0x0){logger['info'](_0x6f56('0x11'),_0x3f5c25,_0x195704['priority']||_0x6f56('0x12'),_0xa50079);_0x221961['next'](_0xa50079);}else{logger[_0x6f56('0x13')](_0x6f56('0x14'),_0x3f5c25,_0x195704['priority']||_0x6f56('0x12'));_0x221961[_0x6f56('0xc')]();}}else{_0x221961[_0x6f56('0x12')]();}}}catch(_0x308265){logger[_0x6f56('0x7')](_0x6f56('0x8'),_0x3f5c25,JSON[_0x6f56('0x15')](_0x308265));_0x221961[_0x6f56('0xc')]();}};}; \ No newline at end of file +var _0x3816=['lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate'];(function(_0x9e2ae4,_0x103979){var _0x52bd03=function(_0x43d06f){while(--_0x43d06f){_0x9e2ae4['push'](_0x9e2ae4['shift']());}};_0x52bd03(++_0x103979);}(_0x3816,0x18f));var _0x6381=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0x3816[_0x80f51a];return _0x327148;};'use strict';var schema=require(_0x6381('0x0'));var _=require(_0x6381('0x1'));var logger=require(_0x6381('0x2'))(_0x6381('0x3'));var gotop=schema({'priority':{'type':_0x6381('0x4'),'required':!![],'message':_0x6381('0x5')}});exports['consequence']=function(_0x500dae,_0x531665){return function(_0x52ad38){try{var _0x592e14={'priority':_0x531665[0x0]};var _0xcc4bcb=gotop['validate'](_0x592e14,{'typecast':!![]});if(_0xcc4bcb['length']){logger[_0x6381('0x6')](_0x6381('0x7'),_0x500dae,_[_0x6381('0x8')](_0xcc4bcb,_0x6381('0x9'))[_0x6381('0xa')](',\x20'));_0x52ad38['stop']();}else{logger[_0x6381('0xb')](_0x6381('0xc'),_0x500dae,_0x592e14['priority']);if(_0x592e14[_0x6381('0xd')]){var _0x8b7da=_[_0x6381('0xe')](_0x52ad38[_0x6381('0xf')](),{'p':_0x592e14[_0x6381('0xd')]});if(_0x8b7da>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x500dae,_0x592e14['priority']||_0x6381('0x10'),_0x8b7da);_0x52ad38[_0x6381('0x10')](_0x8b7da);}else{logger['info'](_0x6381('0x11'),_0x500dae,_0x592e14['priority']||'next');_0x52ad38[_0x6381('0x12')]();}}else{_0x52ad38[_0x6381('0x10')]();}}}catch(_0x257bf9){logger[_0x6381('0x6')](_0x6381('0x7'),_0x500dae,JSON[_0x6381('0x13')](_0x257bf9));_0x52ad38[_0x6381('0x12')]();}};}; \ 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 055de0e..5386a23 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 _0x18d6=['account','upperFirst','InteractionId','interaction','Message','create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','chat'];(function(_0x104226,_0x43da79){var _0x19584c=function(_0x31da4e){while(--_0x31da4e){_0x104226['push'](_0x104226['shift']());}};_0x19584c(++_0x43da79);}(_0x18d6,0x91));var _0x618d=function(_0x48fa1b,_0x369aa5){_0x48fa1b=_0x48fa1b-0x0;var _0x6b81a5=_0x18d6[_0x48fa1b];return _0x6b81a5;};'use strict';var _=require('lodash');var utils=require(_0x618d('0x0'));var logger=require(_0x618d('0x1'))(_0x618d('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x618d('0x3')),'mailMessage':require(_0x618d('0x4')),'smsMessage':require(_0x618d('0x5')),'faxMessage':require(_0x618d('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x618d('0x7')]=function(_0x29c7d4,_0x280f74){return function(_0xcfc2bf){try{var _0x95a1ed={'body':utils['getMustacheRender'](_0x280f74[0x0],this),'ContactId':this[_0x618d('0x8')]['id']};if(this[_0x618d('0x9')]===_0x618d('0xa')){_0x95a1ed['ChatWebsiteId']=this[_0x618d('0xb')]['id'];}else{_0x95a1ed[_['upperFirst'](this[_0x618d('0x9')])+'AccountId']=this[_0x618d('0xb')]['id'];}_0x95a1ed[_[_0x618d('0xc')](this[_0x618d('0x9')])+_0x618d('0xd')]=this[_0x618d('0xe')]['id'];if(rpc[this[_0x618d('0x9')]+_0x618d('0xf')]){return rpc[this[_0x618d('0x9')]+_0x618d('0xf')][_0x618d('0x10')](_0x95a1ed)[_0x618d('0x11')](function(_0x303d49){logger[_0x618d('0x12')]('[%s][MESSAGE]\x20%s',_0x29c7d4,_0x95a1ed[_0x618d('0x13')]);_0xcfc2bf[_0x618d('0x14')]();})[_0x618d('0x15')](function(_0x6fc1b7){logger[_0x618d('0x16')](_0x618d('0x17'),_0x29c7d4,JSON[_0x618d('0x18')](_0x6fc1b7));_0xcfc2bf[_0x618d('0x19')]();});}}catch(_0x133a1c){logger['error'](_0x618d('0x17'),_0x29c7d4,JSON['stringify'](_0x133a1c));_0xcfc2bf[_0x618d('0x19')]();}};}; \ No newline at end of file +var _0x3526=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash'];(function(_0x493028,_0x2739e9){var _0x266264=function(_0x393510){while(--_0x393510){_0x493028['push'](_0x493028['shift']());}};_0x266264(++_0x2739e9);}(_0x3526,0x86));var _0x6352=function(_0x200978,_0x1aa1bf){_0x200978=_0x200978-0x0;var _0x5deedc=_0x3526[_0x200978];return _0x5deedc;};'use strict';var _=require(_0x6352('0x0'));var utils=require(_0x6352('0x1'));var logger=require(_0x6352('0x2'))(_0x6352('0x3'));var rpc={'chatMessage':require(_0x6352('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6352('0x5')),'whatsappMessage':require(_0x6352('0x6'))};exports[_0x6352('0x7')]=function(_0x217520,_0x53038d){return function(_0x104635){try{var _0x48d5eb={'body':utils[_0x6352('0x8')](_0x53038d[0x0],this),'ContactId':this['contact']['id']};if(this[_0x6352('0x9')]===_0x6352('0xa')){_0x48d5eb[_0x6352('0xb')]=this[_0x6352('0xc')]['id'];}else{_0x48d5eb[_['upperFirst'](this[_0x6352('0x9')])+_0x6352('0xd')]=this[_0x6352('0xc')]['id'];}_0x48d5eb[_[_0x6352('0xe')](this[_0x6352('0x9')])+_0x6352('0xf')]=this[_0x6352('0x10')]['id'];if(rpc[this[_0x6352('0x9')]+'Message']){return rpc[this[_0x6352('0x9')]+_0x6352('0x11')][_0x6352('0x12')](_0x48d5eb)['then'](function(_0x237bc8){logger[_0x6352('0x13')](_0x6352('0x14'),_0x217520,_0x48d5eb[_0x6352('0x15')]);_0x104635[_0x6352('0x16')]();})[_0x6352('0x17')](function(_0x2e4c8d){logger[_0x6352('0x18')](_0x6352('0x14'),_0x217520,JSON[_0x6352('0x19')](_0x2e4c8d));_0x104635['stop']();});}}catch(_0x156527){logger[_0x6352('0x18')](_0x6352('0x14'),_0x217520,JSON['stringify'](_0x156527));_0x104635[_0x6352('0x1a')]();}};}; \ 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 d4942ea..f60c17b 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 _0xbd65=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x2519d7,_0x13c5ef){var _0x579eda=function(_0x14a8b2){while(--_0x14a8b2){_0x2519d7['push'](_0x2519d7['shift']());}};_0x579eda(++_0x13c5ef);}(_0xbd65,0x1b5));var _0x5bd6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xbd65[_0x422905];return _0x33dc6c;};'use strict';var utils=require(_0x5bd6('0x0'));var logger=require(_0x5bd6('0x1'))(_0x5bd6('0x2'));exports[_0x5bd6('0x3')]=function(_0x1dd0df,_0x3d079f){return function(_0x26b00b){try{logger[_0x5bd6('0x4')](_0x5bd6('0x5'),_0x1dd0df,utils[_0x5bd6('0x6')](_0x3d079f[0x0],this));_0x26b00b[_0x5bd6('0x7')]();}catch(_0x31bc63){logger['error'](_0x5bd6('0x5'),_0x1dd0df,JSON[_0x5bd6('0x8')](_0x31bc63));_0x26b00b[_0x5bd6('0x9')]();}};}; \ No newline at end of file +var _0x1bdd=['../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1bdd,0x129));var _0xd1bd=function(_0x4be888,_0x3ba1a3){_0x4be888=_0x4be888-0x0;var _0x58f940=_0x1bdd[_0x4be888];return _0x58f940;};'use strict';var utils=require('./utils');var logger=require(_0xd1bd('0x0'))(_0xd1bd('0x1'));exports['consequence']=function(_0xeb9b72,_0x395cb2){return function(_0x41047f){try{logger[_0xd1bd('0x2')](_0xd1bd('0x3'),_0xeb9b72,utils[_0xd1bd('0x4')](_0x395cb2[0x0],this));_0x41047f[_0xd1bd('0x5')]();}catch(_0x382bd1){logger[_0xd1bd('0x6')](_0xd1bd('0x3'),_0xeb9b72,JSON[_0xd1bd('0x7')](_0x382bd1));_0x41047f[_0xd1bd('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index b4a880f..9fdf566 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 _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(_0x576cdf,_0x303073){var _0x50d181=function(_0x573f73){while(--_0x573f73){_0x576cdf['push'](_0x576cdf['shift']());}};_0x50d181(++_0x303073);}(_0x55ca,0x126));var _0xa55c=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0x55ca[_0x2d2e85];return _0x3e9f5e;};'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 +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(_0x2733ff,_0x29ec83){var _0x2948fd=function(_0x4e52d5){while(--_0x4e52d5){_0x2733ff['push'](_0x2733ff['shift']());}};_0x2948fd(++_0x29ec83);}(_0x008c,0x188));var _0xc008=function(_0x411e5d,_0x450c00){_0x411e5d=_0x411e5d-0x0;var _0x58298=_0x008c[_0x411e5d];return _0x58298;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 7785fe0..2d02619 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 _0xd8e5=['isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleTimeout','bind','drained','handleRun','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x2fc251,_0x1eb198){var _0x2024dd=function(_0x1795c0){while(--_0x1795c0){_0x2fc251['push'](_0x2fc251['shift']());}};_0x2024dd(++_0x1eb198);}(_0xd8e5,0x6b));var _0x5d8e=function(_0x40e5f0,_0x1d4acb){_0x40e5f0=_0x40e5f0-0x0;var _0x56945d=_0xd8e5[_0x40e5f0];return _0x56945d;};'use strict';var _=require('lodash');var uuid=require(_0x5d8e('0x0'));var util=require(_0x5d8e('0x1'));var logger=require(_0x5d8e('0x2'))(_0x5d8e('0x3'));var Agent=function(_0x2bca6f,_0x2d8b4a,_0x45fdbc,_0x5d5426){this[_0x5d8e('0x4')]=uuid['v4']();this[_0x5d8e('0x5')]=_0x2bca6f;this[_0x5d8e('0x6')]=_0x2d8b4a;this[_0x5d8e('0x7')]=_0x45fdbc;this['routing']=_0x5d5426;this['squeue'][_0x5d8e('0x8')](this['handleRun']['bind'](this),this[_0x5d8e('0x9')][_0x5d8e('0xa')](this));this[_0x5d8e('0x5')]['on']('timeout',this['handleTimeout'][_0x5d8e('0xa')](this));this[_0x5d8e('0x5')]['on'](_0x5d8e('0xb'),this['handleDrained']['bind'](this));};Agent['prototype'][_0x5d8e('0x8')]=function(){this['squeue'][_0x5d8e('0x8')](this[_0x5d8e('0xc')][_0x5d8e('0xa')](this),this[_0x5d8e('0x9')][_0x5d8e('0xa')](this));};Agent[_0x5d8e('0xd')][_0x5d8e('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0x5d8e('0xd')][_0x5d8e('0xc')]=function(_0xa4dbdb){logger[_0x5d8e('0xf')](_0x5d8e('0x10'),this['squeue']['id'],this[_0x5d8e('0x6')]['id']);if(_[_0x5d8e('0x11')](this[_0x5d8e('0x7')][_0x5d8e('0x12')][this[_0x5d8e('0x6')]['id']])){logger['info'](_0x5d8e('0x13'),this[_0x5d8e('0x5')]['id'],this[_0x5d8e('0x6')]['id']);setTimeout(this['push'][_0x5d8e('0xa')](this),0x3e8);}else{if(this[_0x5d8e('0x3')][_0x5d8e('0x14')]||util[_0x5d8e('0x15')](this['squeue']['id'],this[_0x5d8e('0x7')]['agents'][this['agent']['id']],this[_0x5d8e('0x5')][_0x5d8e('0x16')],![])){this[_0x5d8e('0x7')][_0x5d8e('0x12')][this[_0x5d8e('0x6')]['id']][_0x5d8e('0x17')]=!![];this[_0x5d8e('0x7')]['agents'][this[_0x5d8e('0x6')]['id']][_0x5d8e('0x18')]=undefined;util['showNotification'](this[_0x5d8e('0x4')],this[_0x5d8e('0x5')]['id'],this[_0x5d8e('0x7')][_0x5d8e('0x12')][this[_0x5d8e('0x6')]['id']],null,this[_0x5d8e('0x3')]);util[_0x5d8e('0x19')](this[_0x5d8e('0x5')]['id'],this[_0x5d8e('0x7')][_0x5d8e('0x12')][this[_0x5d8e('0x6')]['id']],_0x5d8e('0x1a')+(this[_0x5d8e('0x3')][_0x5d8e('0x14')]?_0x5d8e('0x1b'):''));}else{logger[_0x5d8e('0xf')](_0x5d8e('0x1c'),this[_0x5d8e('0x5')]['id'],this[_0x5d8e('0x6')]['id']);setTimeout(this[_0x5d8e('0x8')][_0x5d8e('0xa')](this),0x3e8);}}};Agent[_0x5d8e('0xd')][_0x5d8e('0x9')]=function(_0x2bbab7){if(_[_0x5d8e('0x11')](this[_0x5d8e('0x7')][_0x5d8e('0x12')][this[_0x5d8e('0x6')]['id']])){return logger[_0x5d8e('0xf')](_0x5d8e('0x13'),this['squeue']['id'],this[_0x5d8e('0x6')]['id']);}else{logger[_0x5d8e('0xf')](_0x5d8e('0x1d'),this[_0x5d8e('0x5')]['id'],this['agent']['id']);util[_0x5d8e('0x1e')](this[_0x5d8e('0x4')],this[_0x5d8e('0x5')]['id'],this[_0x5d8e('0x7')]['agents'][this[_0x5d8e('0x6')]['id']],null,this[_0x5d8e('0x3')]);this[_0x5d8e('0x7')][_0x5d8e('0x12')][this[_0x5d8e('0x6')]['id']][_0x5d8e('0x17')]=![];this['realtime'][_0x5d8e('0x12')][this[_0x5d8e('0x6')]['id']][_0x5d8e('0x18')]=undefined;util['writeLog'](this['squeue']['id'],this['realtime'][_0x5d8e('0x12')][this[_0x5d8e('0x6')]['id']],_0x2bbab7?'STOP':'TIMEOUT');}if(!_0x2bbab7){setTimeout(this[_0x5d8e('0x8')][_0x5d8e('0xa')](this),0x3e8);}};function agent(_0x293c7d,_0x3d6845,_0x5a4cf7,_0x257bdd){return new Agent(_0x293c7d,_0x3d6845,_0x5a4cf7,_0x257bdd);}module['exports']=agent; \ No newline at end of file +var _0x5bb1=['[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype'];(function(_0x4e1d70,_0x393150){var _0x3cd2b3=function(_0x13fdb8){while(--_0x13fdb8){_0x4e1d70['push'](_0x4e1d70['shift']());}};_0x3cd2b3(++_0x393150);}(_0x5bb1,0x1cc));var _0x15bb=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x5bb1[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x15bb('0x0'));var uuid=require(_0x15bb('0x1'));var util=require(_0x15bb('0x2'));var logger=require(_0x15bb('0x3'))(_0x15bb('0x4'));var Agent=function(_0xe24879,_0x3aa39e,_0x4175d7,_0x17f8e7){this[_0x15bb('0x5')]=uuid['v4']();this[_0x15bb('0x6')]=_0xe24879;this[_0x15bb('0x7')]=_0x3aa39e;this[_0x15bb('0x8')]=_0x4175d7;this[_0x15bb('0x4')]=_0x17f8e7;this[_0x15bb('0x6')][_0x15bb('0x9')](this[_0x15bb('0xa')][_0x15bb('0xb')](this),this[_0x15bb('0xc')][_0x15bb('0xb')](this));this[_0x15bb('0x6')]['on']('timeout',this[_0x15bb('0xc')][_0x15bb('0xb')](this));this['squeue']['on'](_0x15bb('0xd'),this[_0x15bb('0xe')][_0x15bb('0xb')](this));};Agent['prototype'][_0x15bb('0x9')]=function(){this[_0x15bb('0x6')]['push'](this['handleRun']['bind'](this),this['handleTimeout']['bind'](this));};Agent[_0x15bb('0xf')]['handleDrained']=function(){this[_0x15bb('0xc')](!![]);};Agent['prototype'][_0x15bb('0xa')]=function(_0x4133ce){logger['info'](_0x15bb('0x10'),this[_0x15bb('0x6')]['id'],this[_0x15bb('0x7')]['id']);if(_[_0x15bb('0x11')](this['realtime'][_0x15bb('0x12')][this[_0x15bb('0x7')]['id']])){logger[_0x15bb('0x13')](_0x15bb('0x14'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x15bb('0x9')][_0x15bb('0xb')](this),0x3e8);}else{if(this[_0x15bb('0x4')]['forcedOwnership']||util[_0x15bb('0x15')](this[_0x15bb('0x6')]['id'],this[_0x15bb('0x8')]['agents'][this['agent']['id']],this[_0x15bb('0x6')][_0x15bb('0x16')],![])){this[_0x15bb('0x8')][_0x15bb('0x12')][this[_0x15bb('0x7')]['id']][_0x15bb('0x17')]=!![];this[_0x15bb('0x8')][_0x15bb('0x12')][this[_0x15bb('0x7')]['id']][_0x15bb('0x18')]=undefined;util[_0x15bb('0x19')](this['notificationId'],this[_0x15bb('0x6')]['id'],this['realtime'][_0x15bb('0x12')][this['agent']['id']],null,this[_0x15bb('0x4')]);util[_0x15bb('0x1a')](this['squeue']['id'],this[_0x15bb('0x8')]['agents'][this['agent']['id']],_0x15bb('0x1b')+(this[_0x15bb('0x4')][_0x15bb('0x1c')]?_0x15bb('0x1d'):''));}else{logger[_0x15bb('0x13')](_0x15bb('0x1e'),this[_0x15bb('0x6')]['id'],this[_0x15bb('0x7')]['id']);setTimeout(this[_0x15bb('0x9')]['bind'](this),0x3e8);}}};Agent[_0x15bb('0xf')][_0x15bb('0xc')]=function(_0x48cbc0){if(_[_0x15bb('0x11')](this['realtime'][_0x15bb('0x12')][this[_0x15bb('0x7')]['id']])){return logger[_0x15bb('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x15bb('0x7')]['id']);}else{logger[_0x15bb('0x13')](_0x15bb('0x1f'),this[_0x15bb('0x6')]['id'],this['agent']['id']);util[_0x15bb('0x20')](this[_0x15bb('0x5')],this['squeue']['id'],this[_0x15bb('0x8')]['agents'][this[_0x15bb('0x7')]['id']],null,this['routing']);this[_0x15bb('0x8')][_0x15bb('0x12')][this[_0x15bb('0x7')]['id']]['busy']=![];this[_0x15bb('0x8')][_0x15bb('0x12')][this[_0x15bb('0x7')]['id']][_0x15bb('0x18')]=undefined;util[_0x15bb('0x1a')](this['squeue']['id'],this[_0x15bb('0x8')][_0x15bb('0x12')][this[_0x15bb('0x7')]['id']],_0x48cbc0?_0x15bb('0x21'):'TIMEOUT');}if(!_0x48cbc0){setTimeout(this[_0x15bb('0x9')]['bind'](this),0x3e8);}};function agent(_0x39760d,_0x2e84ec,_0x409aa1,_0x5f1bf2){return new Agent(_0x39760d,_0x2e84ec,_0x409aa1,_0x5f1bf2);}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 205e6b0..50e5e82 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 _0xadb3=['prototype','push','handleRun','isNil','Agents','length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','busy','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','bind','handleTimeout','timeout','handleDrained'];(function(_0x4d38f5,_0x4c24f4){var _0x4837a8=function(_0x5653cb){while(--_0x5653cb){_0x4d38f5['push'](_0x4d38f5['shift']());}};_0x4837a8(++_0x4c24f4);}(_0xadb3,0xfb));var _0x3adb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xadb3[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var uuid=require(_0x3adb('0x0'));var util=require('./util');var logger=require(_0x3adb('0x1'))(_0x3adb('0x2'));var Beepall=function(_0x9436c3,_0x54c3a2,_0x11f10f,_0x5d67be){this[_0x3adb('0x3')]=uuid['v4']();this[_0x3adb('0x4')]=_0x9436c3;this[_0x3adb('0x5')]=_0x54c3a2;this['realtime']=_0x11f10f;this['routing']=_0x5d67be;this[_0x3adb('0x4')]['push'](this['handleRun'][_0x3adb('0x6')](this),this[_0x3adb('0x7')][_0x3adb('0x6')](this));this['squeue']['on'](_0x3adb('0x8'),this[_0x3adb('0x7')][_0x3adb('0x6')](this));this[_0x3adb('0x4')]['on']('drained',this[_0x3adb('0x9')][_0x3adb('0x6')](this));};Beepall[_0x3adb('0xa')][_0x3adb('0xb')]=function(){this[_0x3adb('0x4')][_0x3adb('0xb')](this[_0x3adb('0xc')]['bind'](this),this[_0x3adb('0x7')]['bind'](this));};Beepall[_0x3adb('0xa')][_0x3adb('0x9')]=function(_0xd40d8d){this[_0x3adb('0x7')](!![]);};Beepall[_0x3adb('0xa')][_0x3adb('0xc')]=function(_0x3409c3){var _0x498b32=!![];if(!_[_0x3adb('0xd')](this['queue'])&&!_[_0x3adb('0xd')](this[_0x3adb('0x5')][_0x3adb('0xe')])&&this[_0x3adb('0x5')]['Agents'][_0x3adb('0xf')]>0x0){for(var _0x4b3aee=0x0,_0x250f6d;_0x4b3aee0x0){for(var _0x21d3f2=0x0,_0x200848;_0x21d3f20x0&&_0x1db791[_0x27ee73+_0x7a73('0x24')]>=_0x1db791[_0x27ee73+_0x7a73('0x23')]){writeLog(_0x16dc41,_0x1db791,_0x27ee73[_0x7a73('0x25')]()+_0x7a73('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x17fb84,_0x2c49bf,_0x4d1f94,_0x325d23,_0x2eedd3){return sendNotification(!![],_0x17fb84,_0x2c49bf,_0x4d1f94,_0x325d23,_0x2eedd3);};exports['hideNotification']=function(_0x348c10,_0x2fe28e,_0x10a403,_0x203bd8,_0xdc6a6f){return sendNotification(![],_0x348c10,_0x2fe28e,_0x10a403,_0x203bd8,_0xdc6a6f);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xe511=['mustache','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','isAgentAvailable','busy','BUSY','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','lodash','util'];(function(_0x17b1a3,_0x2c9945){var _0xcfc383=function(_0x354d89){while(--_0x354d89){_0x17b1a3['push'](_0x17b1a3['shift']());}};_0xcfc383(++_0x2c9945);}(_0xe511,0x16f));var _0x1e51=function(_0x507ccd,_0x54afc9){_0x507ccd=_0x507ccd-0x0;var _0x36887d=_0xe511[_0x507ccd];return _0x36887d;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var utils=require('../utils');var Mustache=require(_0x1e51('0x2'));var Redis=require('ioredis');var config=require(_0x1e51('0x3'));var logger=require(_0x1e51('0x4'))('routing');config[_0x1e51('0x5')]=_[_0x1e51('0x6')](config[_0x1e51('0x5')],{'host':_0x1e51('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1e51('0x5')]));function emit(_0x21ed6b,_0x5c4590,_0x4fa2ba){io['to'](_0x21ed6b)[_0x1e51('0x8')](_0x5c4590,_0x4fa2ba);}function sendNotification(_0x133021,_0x4fa8a9,_0x49d359,_0x658941,_0x2712e0,_0x29da1f){io['to'](util[_0x1e51('0x9')](_0x1e51('0xa'),_0x658941[_0x1e51('0xb')]))['emit'](_0x1e51('0xc'),_0x658941);var _0xcdfa5d=_0x29da1f||{};var _0x3350bb=_0x49d359[_0x1e51('0xd')]('.');var _0x34ad70={'uniqueid':_0x4fa8a9,'channel':_0x3350bb[0x0],'id':_0x3350bb[0x1],'title':_0x3350bb[0x0]+_0x1e51('0xe'),'interactionId':_0x3350bb[0x2],'queue':_0x2712e0?_0x2712e0['name']:null,'sound':_0xcdfa5d[_0x1e51('0xf')][_0x1e51('0x10')],'shake':_0xcdfa5d[_0x1e51('0xf')][_0x1e51('0x11')]};try{if(!_0xcdfa5d[_0x1e51('0x12')]){_0xcdfa5d[_0x1e51('0x12')]={};}if(_0x2712e0){_0xcdfa5d[_0x1e51('0x12')][_0x1e51('0x13')]=_0x2712e0;}else if(_0xcdfa5d[_0x1e51('0x12')][_0x1e51('0x13')]){delete _0xcdfa5d['body'][_0x1e51('0x13')];}_0x34ad70[_0x1e51('0x14')]=utils[_0x1e51('0x15')](_0xcdfa5d['account'][_0x1e51('0x16')],_0xcdfa5d);}catch(_0x4f7aaf){_0x34ad70['msg']=_0x1e51('0x17');logger[_0x1e51('0x18')](util[_0x1e51('0x9')](_0x1e51('0x19'),_0x4fa8a9,_0x4f7aaf[_0x1e51('0x1a')]));}io['to'](util[_0x1e51('0x9')]('user:%s',_0x658941[_0x1e51('0xb')]))['emit'](util[_0x1e51('0x9')](_0x1e51('0x1b'),_0x133021?_0x1e51('0x1c'):_0x1e51('0x1d')),_0x34ad70);}function writeLog(_0x506f40,_0x5223c3,_0x4e6a49){return logger['info'](util[_0x1e51('0x9')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x506f40,_0x5223c3[_0x1e51('0xb')],_0x4e6a49));}exports[_0x1e51('0x1e')]=function(_0x415154,_0x13240f,_0x23c85a,_0xf9298){if(_0x13240f[_0x1e51('0x1f')]){writeLog(_0x415154,_0x13240f,_0x1e51('0x20'));return![];}if(!_0x13240f['online']){writeLog(_0x415154,_0x13240f,'OFFLINE');return![];}if(_0x13240f[_0x23c85a+_0x1e51('0x21')]){writeLog(_0x415154,_0x13240f,_0x1e51('0x22'));return![];}if(_0xf9298&&_0x13240f[_0x1e51('0x23')](_0x23c85a+_0x1e51('0x24'))&&_0x13240f['hasOwnProperty'](_0x23c85a+'CurrentCapacity')){if(_0x13240f[_0x23c85a+'Capacity']>0x0&&_0x13240f[_0x23c85a+_0x1e51('0x25')]>=_0x13240f[_0x23c85a+_0x1e51('0x24')]){writeLog(_0x415154,_0x13240f,_0x23c85a[_0x1e51('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x1e51('0x27')]=function(_0x49c507,_0x5eccee,_0x3349f0,_0x5c5bbd,_0x170ec6){return sendNotification(!![],_0x49c507,_0x5eccee,_0x3349f0,_0x5c5bbd,_0x170ec6);};exports[_0x1e51('0x28')]=function(_0x56722f,_0x3e6ef2,_0x10ee23,_0x71c7af,_0x6862d1){return sendNotification(![],_0x56722f,_0x3e6ef2,_0x10ee23,_0x71c7af,_0x6862d1);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 56a622c..8a9d05f 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 _0x46cb=['../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','lodash'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x46cb,0x167));var _0xb46c=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x46cb[_0x2166a3];return _0x260035;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xb46c('0x0'));var utils=require('./utils');var logger=require(_0xb46c('0x1'))('routing');var system=schema({'command':{'type':_0xb46c('0x2'),'required':!![],'message':_0xb46c('0x3')}});exports[_0xb46c('0x4')]=function(_0x161361,_0x4b6a88){return function(_0x5dfa8b){try{var _0x18ccf2={'command':_0x4b6a88[0x0]};var _0x257561=system[_0xb46c('0x5')](_0x18ccf2,{'typecast':!![]});if(_0x257561['length']){logger[_0xb46c('0x6')](_0xb46c('0x7'),_0x161361,_[_0xb46c('0x8')](_0x257561,_0xb46c('0x9'))[_0xb46c('0xa')](',\x20'));logger[_0xb46c('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x161361);_0x5dfa8b[_0xb46c('0xc')]();}else{var _0x50f2e4=this;var _0x2a66be=utils[_0xb46c('0xd')](_0x4b6a88[0x0],this);logger[_0xb46c('0xb')](_0xb46c('0xe'),_0x161361,_0x2a66be);sh[_0xb46c('0xf')](_[_0xb46c('0x10')](_0x2a66be),function(_0x214e7c,_0x5317f8){logger[_0xb46c('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x161361,_0x214e7c);if(_0x214e7c==0x0){var _0x23369f=_0x5317f8[_0xb46c('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xb46c('0x12')](_0x4b6a88[0x1])||_[_0xb46c('0x13')](_0x4b6a88[0x1])){logger[_0xb46c('0xb')](_0xb46c('0x14'),_0x161361);_0x50f2e4[_0xb46c('0x15')][_0x4b6a88[0x1]]=_0x23369f;}else{logger['info'](_0xb46c('0x16'),_0x161361,_0x4b6a88[0x1],_0x23369f);_0x50f2e4[_0xb46c('0x15')][_0x4b6a88[0x1]]=_0x23369f;}}_0x5dfa8b[_0xb46c('0xc')]();});}}catch(_0x37d1e3){logger[_0xb46c('0x6')](_0xb46c('0x7'),_0x161361,_[_0xb46c('0x17')](_0x37d1e3)?JSON['stringify'](_0x37d1e3):_0x37d1e3);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x161361);_0x5dfa8b[_0xb46c('0xc')]();}};}; \ No newline at end of file +var _0x5614=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','replace','isNil','isEmpty'];(function(_0x2e90fc,_0x4ae77b){var _0x1aba5b=function(_0x52c4fe){while(--_0x52c4fe){_0x2e90fc['push'](_0x2e90fc['shift']());}};_0x1aba5b(++_0x4ae77b);}(_0x5614,0x1d0));var _0x4561=function(_0x1a28d6,_0x2dcedc){_0x1a28d6=_0x1a28d6-0x0;var _0x59d944=_0x5614[_0x1a28d6];return _0x59d944;};'use strict';var schema=require(_0x4561('0x0'));var sh=require(_0x4561('0x1'));var _=require(_0x4561('0x2'));var utils=require(_0x4561('0x3'));var logger=require('../../../../config/logger')(_0x4561('0x4'));var system=schema({'command':{'type':_0x4561('0x5'),'required':!![],'message':_0x4561('0x6')}});exports[_0x4561('0x7')]=function(_0x58709f,_0x4c4f26){return function(_0x9cd12f){try{var _0x1c0703={'command':_0x4c4f26[0x0]};var _0x2b82f3=system[_0x4561('0x0')](_0x1c0703,{'typecast':!![]});if(_0x2b82f3[_0x4561('0x8')]){logger[_0x4561('0x9')](_0x4561('0xa'),_0x58709f,_[_0x4561('0xb')](_0x2b82f3,_0x4561('0xc'))[_0x4561('0xd')](',\x20'));logger[_0x4561('0xe')](_0x4561('0xf'),_0x58709f);_0x9cd12f[_0x4561('0x10')]();}else{var _0x72e757=this;var _0x1de241=utils[_0x4561('0x11')](_0x4c4f26[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x58709f,_0x1de241);sh['exec'](_[_0x4561('0x12')](_0x1de241),function(_0x21fd3f,_0x25fbd1){logger[_0x4561('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x58709f,_0x21fd3f);if(_0x21fd3f==0x0){var _0x58e909=_0x25fbd1[_0x4561('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x4561('0x14')](_0x4c4f26[0x1])||_[_0x4561('0x15')](_0x4c4f26[0x1])){logger[_0x4561('0xe')](_0x4561('0x16'),_0x58709f);_0x72e757[_0x4561('0x17')][_0x4c4f26[0x1]]=_0x58e909;}else{logger['info'](_0x4561('0x18'),_0x58709f,_0x4c4f26[0x1],_0x58e909);_0x72e757[_0x4561('0x17')][_0x4c4f26[0x1]]=_0x58e909;}}_0x9cd12f[_0x4561('0x10')]();});}}catch(_0x3d6cd9){logger[_0x4561('0x9')]('[%s][SYSTEM]\x20%s',_0x58709f,_[_0x4561('0x19')](_0x3d6cd9)?JSON[_0x4561('0x1a')](_0x3d6cd9):_0x3d6cd9);logger[_0x4561('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x58709f);_0x9cd12f[_0x4561('0x10')]();}};}; \ 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 ce283bb..0243745 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 _0x35b1=['consequence','validate','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number'];(function(_0x1762b7,_0x50b92f){var _0x3a6f8b=function(_0x3d6aab){while(--_0x3d6aab){_0x1762b7['push'](_0x1762b7['shift']());}};_0x3a6f8b(++_0x50b92f);}(_0x35b1,0x18d));var _0x135b=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x35b1[_0x172133];return _0x2460e5;};'use strict';var schema=require('validate');var _=require(_0x135b('0x0'));var rpc={'chatInteraction':require(_0x135b('0x1')),'openchannelInteraction':require(_0x135b('0x2')),'smsInteraction':require(_0x135b('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x135b('0x4'))};var logger=require(_0x135b('0x5'))(_0x135b('0x6'));var tag=schema({'tag':{'type':_0x135b('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x135b('0x8')]=function(_0x108d73,_0x2fc941,_0xe8731a,_0x5cee2d){return function(_0x5958e8){try{var _0x4f23e0={'tag':_0x2fc941[0x0]};var _0x4fea61=tag[_0x135b('0x9')](_0x4f23e0,{'typecast':!![]});if(_0x4fea61[_0x135b('0xa')]){logger[_0x135b('0xb')](_0x135b('0xc'),_0x108d73,_[_0x135b('0xd')](_0x4fea61,'message')['join'](',\x20'));logger[_0x135b('0xe')](_0x135b('0xf'),_0x108d73);_0x5958e8[_0x135b('0x10')]();}else{var _0xc84370={'ids':[_0x2fc941[0x0]]};if(rpc[_0x5cee2d[_0x135b('0x11')]+_0x135b('0x12')]){rpc[_0x5cee2d[_0x135b('0x11')]+_0x135b('0x12')][_0x135b('0x13')](_0x5cee2d[_0x135b('0x14')]['id'],_0xc84370)[_0x135b('0x15')](function(_0x42a6d3){logger[_0x135b('0xe')](_0x135b('0x16'),_0x108d73,_0x2fc941[0x1],_0x5cee2d[_0x135b('0x11')],_0x5cee2d[_0x135b('0x14')]['id']);})[_0x135b('0x17')](function(_0x15d3e9){logger[_0x135b('0xb')]('[%s][TAG]\x20%s',_0x108d73,JSON[_0x135b('0x18')](_0x15d3e9));logger[_0x135b('0xe')](_0x135b('0xf'),_0x108d73);})[_0x135b('0x19')](function(){_0x5958e8[_0x135b('0x10')]();});}}}catch(_0x2f3f16){logger['error'](_0x135b('0xc'),_0x108d73,_[_0x135b('0x1a')](_0x2f3f16)?JSON[_0x135b('0x18')](_0x2f3f16):_0x2f3f16);logger['info'](_0x135b('0xf'),_0x108d73);_0x5958e8[_0x135b('0x10')]();}};}; \ No newline at end of file +var _0x4c63=['then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','message','join','info','next','channel','Interaction','addTags','interaction'];(function(_0x2267ce,_0x4f74f2){var _0x540a41=function(_0x1b60ff){while(--_0x1b60ff){_0x2267ce['push'](_0x2267ce['shift']());}};_0x540a41(++_0x4f74f2);}(_0x4c63,0x19d));var _0x34c6=function(_0x520b21,_0x48bd97){_0x520b21=_0x520b21-0x0;var _0x4909ef=_0x4c63[_0x520b21];return _0x4909ef;};'use strict';var schema=require(_0x34c6('0x0'));var _=require(_0x34c6('0x1'));var rpc={'chatInteraction':require(_0x34c6('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x34c6('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x34c6('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x34c6('0x5'))(_0x34c6('0x6'));var tag=schema({'tag':{'type':_0x34c6('0x7'),'required':!![],'message':_0x34c6('0x8')}});exports[_0x34c6('0x9')]=function(_0x4aa7a7,_0xc51494,_0x5a0cbf,_0x4fea94){return function(_0x37985d){try{var _0x387336={'tag':_0xc51494[0x0]};var _0x496dfa=tag['validate'](_0x387336,{'typecast':!![]});if(_0x496dfa['length']){logger[_0x34c6('0xa')]('[%s][TAG]\x20%s',_0x4aa7a7,_['map'](_0x496dfa,_0x34c6('0xb'))[_0x34c6('0xc')](',\x20'));logger[_0x34c6('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4aa7a7);_0x37985d[_0x34c6('0xe')]();}else{var _0x47f6c3={'ids':[_0xc51494[0x0]]};if(rpc[_0x4fea94[_0x34c6('0xf')]+'Interaction']){rpc[_0x4fea94['channel']+_0x34c6('0x10')][_0x34c6('0x11')](_0x4fea94[_0x34c6('0x12')]['id'],_0x47f6c3)[_0x34c6('0x13')](function(_0x5db3d3){logger[_0x34c6('0xd')](_0x34c6('0x14'),_0x4aa7a7,_0xc51494[0x1],_0x4fea94['channel'],_0x4fea94[_0x34c6('0x12')]['id']);})[_0x34c6('0x15')](function(_0x344aab){logger['error'](_0x34c6('0x16'),_0x4aa7a7,JSON[_0x34c6('0x17')](_0x344aab));logger[_0x34c6('0xd')](_0x34c6('0x18'),_0x4aa7a7);})[_0x34c6('0x19')](function(){_0x37985d['next']();});}}}catch(_0x25f53b){logger[_0x34c6('0xa')]('[%s][TAG]\x20%s',_0x4aa7a7,_[_0x34c6('0x1a')](_0x25f53b)?JSON[_0x34c6('0x17')](_0x25f53b):_0x25f53b);logger['info'](_0x34c6('0x18'),_0x4aa7a7);_0x37985d[_0x34c6('0xe')]();}};}; \ 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 245c9de..e1c9f0c 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 _0xa739=['body','contact','account','interaction','list','lodash','merge'];(function(_0x918ba5,_0xa1c15b){var _0x4ed341=function(_0x590f60){while(--_0x590f60){_0x918ba5['push'](_0x918ba5['shift']());}};_0x4ed341(++_0xa1c15b);}(_0xa739,0x1e1));var _0x9a73=function(_0x4c9f71,_0x1232bc){_0x4c9f71=_0x4c9f71-0x0;var _0x8f5298=_0xa739[_0x4c9f71];return _0x8f5298;};'use strict';var Mustache=require('mustache');var _=require(_0x9a73('0x0'));module['exports']={'getMustacheRender':function(_0x147c85,_0x33c203){return Mustache['render'](_0x147c85,_[_0x9a73('0x1')](_0x33c203[_0x9a73('0x2')],{'contact':_0x33c203[_0x9a73('0x3')],'message':_0x33c203['message'],'account':_0x33c203[_0x9a73('0x4')],'interaction':_0x33c203[_0x9a73('0x5')],'list':_0x33c203[_0x9a73('0x6')]}))||'';}}; \ No newline at end of file +var _0xf041=['message','list','exports','render','body'];(function(_0x5561bf,_0xa73b45){var _0xe8c98=function(_0x50f0f1){while(--_0x50f0f1){_0x5561bf['push'](_0x5561bf['shift']());}};_0xe8c98(++_0xa73b45);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x1f04('0x0')]={'getMustacheRender':function(_0x2191e5,_0x224f9e){return Mustache[_0x1f04('0x1')](_0x2191e5,_['merge'](_0x224f9e[_0x1f04('0x2')],{'contact':_0x224f9e['contact'],'message':_0x224f9e[_0x1f04('0x3')],'account':_0x224f9e['account'],'interaction':_0x224f9e['interaction'],'list':_0x224f9e[_0x1f04('0x4')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 195d3ae..a1648e2 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 _0x99e9=['stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','split','push','slice','join','dialogflow','appdata','amazonlex','TagId','%s:%s:%s','condition','intervals','consequence','info','\x20|\x20','error','rules','execute','Applications\x20executed','matchPath','emit','stack','agent','agents','busy','busyQueue','interaction','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server'];(function(_0x3db12e,_0x24b91a){var _0x1fa7ef=function(_0x32a744){while(--_0x32a744){_0x3db12e['push'](_0x3db12e['shift']());}};_0x1fa7ef(++_0x24b91a);}(_0x99e9,0xb4));var _0x999e=function(_0x37a0ce,_0x28dc04){_0x37a0ce=_0x37a0ce-0x0;var _0x569f4e=_0x99e9[_0x37a0ce];return _0x569f4e;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var fs=require('fs');var jayson=require(_0x999e('0x2'));var BPromise=require(_0x999e('0x3'));var uuid=require('uuid');var config=require(_0x999e('0x4'));var logger=require(_0x999e('0x5'))(_0x999e('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x999e('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x999e('0x8')),'faxQueueReport':require(_0x999e('0x9')),'whatsappQueueReport':require(_0x999e('0xa'))};var RuleEngine=require(_0x999e('0xb'));function getId(_0x5c1c17,_0x46aeae,_0x38a692){return util[_0x999e('0xc')](_0x999e('0xd'),_0x5c1c17,_0x46aeae||0x0,_0x38a692||0x0);}function getIntervals(_0x2c38cf,_0x175042){var _0x3f2c24=[];if(!_[_0x999e('0xe')](_0x175042[_0x999e('0xf')])&&!_[_0x999e('0xe')](_0x2c38cf[_0x175042[_0x999e('0xf')]])&&!_[_0x999e('0xe')](_0x2c38cf[_0x175042[_0x999e('0xf')]][_0x999e('0x10')])){_0x3f2c24=_[_0x999e('0x11')](_0x2c38cf[_0x175042[_0x999e('0xf')]][_0x999e('0x10')],'interval');}else if(!_[_0x999e('0xe')](_0x175042['interval'])){_0x3f2c24=[_0x175042[_0x999e('0x12')]];}return _0x3f2c24;}exports[_0x999e('0x13')]=function(_0x2fbc3e){_0x2fbc3e['rules']={};return new BPromise(function(_0x28bdd1,_0x4d1716){var _0xa44e4c={'Start':function(_0x539598){var _0x549ad4=this;return new Promise(function(_0x1eee64,_0x22feac){if(_0x539598){try{var _0x2dd5f4=[];var _0x289e0e=getId(_0x539598[_0x999e('0x14')],_0x539598[_0x999e('0x15')]?_0x539598['message']['id']:0x0,_0x539598['interaction']?_0x539598['interaction']['id']:0x0);if(_0x539598[_0x999e('0x16')]&&_[_0x999e('0x17')](_0x539598[_0x999e('0x16')])&&_0x539598[_0x999e('0x16')][_0x999e('0x18')]){for(var _0x3ece5e=0x0;_0x3ece5e<_0x539598['applications']['length'];_0x3ece5e+=0x1){var _0xc20d3e=_0x539598[_0x999e('0x16')][_0x3ece5e];if(fs[_0x999e('0x19')](path['join'](__dirname,_0x999e('0x16'),_0xc20d3e[_0x999e('0x1a')]+_0x999e('0x1b')))){var _0x36fce4=[];switch(_0xc20d3e[_0x999e('0x1a')][_0x999e('0x1c')]()){case _0x999e('0x1d'):var _0x4d4474=_0xc20d3e['appdata'][_0x999e('0x1e')](',');if(_0x539598[_0x999e('0x14')]==='mail'){_0x36fce4[_0x999e('0x1f')](_0x4d4474[0x0]);_0x36fce4[_0x999e('0x1f')](_0x4d4474[0x1]);_0x36fce4[_0x999e('0x1f')](_0x4d4474[_0x999e('0x20')](0x2,_0x4d4474[_0x999e('0x18')])[_0x999e('0x21')](','));}else{_0x36fce4['push'](_0x4d4474[0x0]);_0x36fce4[_0x999e('0x1f')](_0x4d4474[_0x999e('0x20')](0x1,_0x4d4474[_0x999e('0x18')])[_0x999e('0x21')](','));}break;case _0x999e('0x22'):var _0x1d2dc6=_0xc20d3e[_0x999e('0x23')]['split'](',');_0x36fce4[_0x999e('0x1f')](_0x1d2dc6[0x0]);_0x36fce4['push'](_0x1d2dc6[0x1]);_0x36fce4['push'](_0x1d2dc6[_0x999e('0x20')](0x2,_0x1d2dc6[_0x999e('0x18')])[_0x999e('0x21')](','));break;case'dialogflowv2':var _0x1ea0e4=_0xc20d3e[_0x999e('0x23')][_0x999e('0x1e')](',');_0x36fce4[_0x999e('0x1f')](_0x1ea0e4[0x0]);_0x36fce4[_0x999e('0x1f')](_0x1ea0e4[0x1]);_0x36fce4[_0x999e('0x1f')](_0x1ea0e4[0x2]);_0x36fce4[_0x999e('0x1f')](_0x1ea0e4[0x3]);_0x36fce4[_0x999e('0x1f')](_0x1ea0e4[_0x999e('0x20')](0x4,_0x1ea0e4[_0x999e('0x18')])['join'](','));break;case _0x999e('0x24'):var _0x1cd206=_0xc20d3e[_0x999e('0x23')]['split'](',');_0x36fce4[_0x999e('0x1f')](_0x1cd206[0x0]);_0x36fce4['push'](_0x1cd206[0x1]);_0x36fce4['push'](_0x1cd206[0x2]);_0x36fce4[_0x999e('0x1f')](_0x1cd206[0x3]);_0x36fce4[_0x999e('0x1f')](_0x1cd206['slice'](0x4,_0x1cd206['length'])[_0x999e('0x21')](','));break;case _0x999e('0x15'):_0x36fce4[_0x999e('0x1f')](_0xc20d3e[_0x999e('0x23')]);break;case'tag':_0x36fce4[_0x999e('0x1f')](_0xc20d3e[_0x999e('0x25')]);_0x36fce4[_0x999e('0x1f')](_0xc20d3e[_0x999e('0x23')]);break;default:_0x36fce4=_['isNil'](_0xc20d3e['appdata'])?[]:_0xc20d3e[_0x999e('0x23')]['split'](',');}var _0xd7f2a9={'id':util[_0x999e('0xc')](_0x999e('0x26'),_0x289e0e,_0xc20d3e['id'],_0xc20d3e[_0x999e('0x1a')]),'condition':require('./interval')[_0x999e('0x27')](_0x289e0e,getIntervals(_0x2fbc3e[_0x999e('0x28')],_0xc20d3e),_0x2fbc3e),'consequence':require('./applications/'+_0xc20d3e['app'])[_0x999e('0x29')](_0x289e0e,_0x36fce4,_0x2fbc3e,_0x539598),'p':_0xc20d3e['priority']||0x0};logger[_0x999e('0x2a')]('Push\x20new\x20rule',_0xd7f2a9['id'],'on\x20interval',getIntervals(_0x2fbc3e['intervals'],_0xc20d3e)['join'](_0x999e('0x2b')));_0x2dd5f4['push'](_0xd7f2a9);}else{logger[_0x999e('0x2c')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0xc20d3e[_0x999e('0x1a')]+_0x999e('0x1b')));}}_0x2fbc3e[_0x999e('0x2d')][_0x289e0e]=new RuleEngine(_0x2dd5f4);_0x2fbc3e[_0x999e('0x2d')][_0x289e0e][_0x999e('0x2e')](_0x539598,function(_0x368183){logger[_0x999e('0x2a')](_0x999e('0x2f'),JSON['stringify'](_0x368183[_0x999e('0x30')]));if(_0x2fbc3e[_0x999e('0x2d')][_0x289e0e]){_0x2fbc3e[_0x999e('0x2d')][_0x289e0e][_0x999e('0x31')]('complete');}});return _0x1eee64({'code':0xc8,'message':_0x539598});}else{logger[_0x999e('0x2a')]('No\x20applications\x20to\x20execute');return _0x1eee64({'code':0xc8,'message':_0x539598});}}catch(_0x36194c){logger[_0x999e('0x2c')](_0x36194c[_0x999e('0x32')]);return _0x22feac(_0x549ad4[_0x999e('0x2c')](0x1f4,_0x36194c));}}return _0x22feac('routing\x20is\x20empty');});},'AcceptMessage':function(_0x155dae){var _0x108c96=this;return new Promise(function(_0x1bc78e,_0x494222){if(_0x155dae['agent']&&_0x155dae[_0x999e('0x33')]['id']){if(_0x2fbc3e[_0x999e('0x34')][_0x155dae[_0x999e('0x33')]['id']]){_0x2fbc3e[_0x999e('0x34')][_0x155dae[_0x999e('0x33')]['id']][_0x999e('0x35')]=![];_0x2fbc3e[_0x999e('0x34')][_0x155dae[_0x999e('0x33')]['id']][_0x999e('0x36')]=undefined;}}if(_0x155dae[_0x999e('0x15')]&&_0x155dae['message']['id']){try{var _0x4c8b36=getId(_0x155dae[_0x999e('0x14')],_0x155dae[_0x999e('0x15')]?_0x155dae[_0x999e('0x15')]['id']:0x0,_0x155dae[_0x999e('0x37')]?_0x155dae[_0x999e('0x37')]['id']:0x0);if(_0x2fbc3e[_0x999e('0x2d')][_0x4c8b36]){_0x2fbc3e['rules'][_0x4c8b36][_0x999e('0x31')]('end');if(rpc[_0x155dae['channel']+_0x999e('0x38')]){rpc[_0x155dae['channel']+'QueueReport']['update'](_0x4c8b36,{'UserId':_0x155dae['message'][_0x999e('0x39')]})[_0x999e('0x3a')](function(_0x5e50f5){logger[_0x999e('0x2c')](_0x999e('0x3b'));});}}return _0x1bc78e({'code':0xc8,'message':_0x155dae});}catch(_0x2aa9ca){logger['error'](_0x2aa9ca['stack']);return _0x494222(_0x108c96[_0x999e('0x2c')](0x1f4,_0x2aa9ca));}}logger[_0x999e('0x2c')](_0x999e('0x3c'));return _0x494222(_0x108c96['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x4d0358){var _0x5ee14d=this;return new Promise(function(_0x8f1afa,_0x56a064){if(_0x4d0358['agent']&&_0x4d0358[_0x999e('0x33')]['id']){try{if(_0x2fbc3e[_0x999e('0x34')][_0x4d0358['agent']['id']]){_0x2fbc3e[_0x999e('0x34')][_0x4d0358[_0x999e('0x33')]['id']]['busy']=![];_0x2fbc3e[_0x999e('0x34')][_0x4d0358['agent']['id']][_0x999e('0x36')]=undefined;}return _0x8f1afa({'code':0xc8,'message':_0x4d0358});}catch(_0x42dfea){logger['error'](_0x42dfea[_0x999e('0x32')]);return _0x56a064(_0x5ee14d[_0x999e('0x2c')](0x1f4,_0x42dfea));}}logger['error']('message\x20is\x20empty');return _0x56a064(_0x5ee14d[_0x999e('0x2c')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5ebc95){var _0x4de2e8=this;return new Promise(function(_0x1f85dd,_0x3b2023){if(_0x5ebc95[_0x999e('0x14')]&&_0x5ebc95[_0x999e('0x37')]&&_0x5ebc95[_0x999e('0x37')]['id']){try{var _0x14c01c=getId(_0x5ebc95['channel'],_0x5ebc95[_0x999e('0x15')]?_0x5ebc95[_0x999e('0x15')]['id']:0x0,_0x5ebc95['interaction']?_0x5ebc95[_0x999e('0x37')]['id']:0x0);if(_0x2fbc3e[_0x999e('0x2d')][_0x14c01c]){_0x2fbc3e[_0x999e('0x2d')][_0x14c01c][_0x999e('0x31')](_0x999e('0x3d'));}return _0x1f85dd({'code':0xc8,'message':_0x5ebc95});}catch(_0x334d19){logger[_0x999e('0x2c')](_0x334d19[_0x999e('0x32')]);return _0x3b2023(_0x4de2e8[_0x999e('0x2c')](0x1f4,_0x334d19));}}logger['error'](_0x999e('0x3c'));return _0x3b2023(_0x4de2e8[_0x999e('0x2c')](0x1f4,_0x999e('0x3c')));});},'AgentCapacity':function(_0x71df6c){var _0x525191=this;return new Promise(function(_0x392324,_0x24cc60){if(_0x2fbc3e[_0x999e('0x34')][_0x999e('0x3e')](_0x71df6c['id'])){for(var _0x3e475b in _0x71df6c[_0x999e('0x3f')]){if(_0x71df6c[_0x999e('0x3f')][_0x999e('0x3e')](_0x3e475b)){if(_0x2fbc3e['agents'][_0x71df6c['id']]['hasOwnProperty'](_0x3e475b+_0x999e('0x40'))){_0x2fbc3e[_0x999e('0x34')][_0x71df6c['id']][_0x3e475b+_0x999e('0x40')]=parseInt(_0x71df6c[_0x999e('0x3f')][_0x3e475b],0xa);}}}_0x2fbc3e[_0x999e('0x34')][_0x71df6c['id']][_0x999e('0x41')]();return _0x392324({'code':0xc8,'message':_0x2fbc3e[_0x999e('0x34')][_0x71df6c['id']]});}else{return _0x24cc60(_0x525191['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xb9d60b){return new Promise(function(_0x55ae5,_0x36c3dc){var _0x3e9531=_[_0x999e('0x42')](_0x2fbc3e['agents']);_0x55ae5({'count':_0x3e9531[_0x999e('0x18')],'rows':_0x3e9531});});},'ChatQueues':function(_0x1e7ad2){return new Promise(function(_0x30a49d,_0x3c8ecf){var _0x502c9=[];for(var _0x434e13 in _0x2fbc3e[_0x999e('0x43')]){if(_0x2fbc3e['chatQueues'][_0x999e('0x3e')](_0x434e13)){var _0x521b7a=_0x2fbc3e[_0x999e('0x43')][_0x434e13];var _0x43217e={'id':_0x521b7a['id'],'available':_0x521b7a[_0x999e('0x44')],'loggedIn':_0x521b7a[_0x999e('0x45')],'name':_0x521b7a[_0x999e('0x46')],'paused':_0x521b7a[_0x999e('0x47')],'waiting':_0x521b7a['waiting']};_0x502c9[_0x999e('0x1f')](_0x43217e);}}_0x30a49d({'count':_0x502c9[_0x999e('0x18')],'rows':_0x502c9});});},'MailQueues':function(_0xf3116c){return new Promise(function(_0xe39e00,_0x470e51){var _0x121110=[];for(var _0x23fd58 in _0x2fbc3e[_0x999e('0x48')]){if(_0x2fbc3e[_0x999e('0x48')][_0x999e('0x3e')](_0x23fd58)){var _0x8ac47d=_0x2fbc3e[_0x999e('0x48')][_0x23fd58];var _0x77a387={'id':_0x8ac47d['id'],'available':_0x8ac47d[_0x999e('0x44')],'loggedIn':_0x8ac47d[_0x999e('0x45')],'name':_0x8ac47d['name'],'paused':_0x8ac47d[_0x999e('0x47')],'waiting':_0x8ac47d[_0x999e('0x49')]};_0x121110[_0x999e('0x1f')](_0x77a387);}}_0xe39e00({'count':_0x121110[_0x999e('0x18')],'rows':_0x121110});});},'OpenchannelQueues':function(_0x4e5e6e){return new Promise(function(_0x4871c9,_0x21c8be){var _0x2d398f=[];for(var _0x67267d in _0x2fbc3e[_0x999e('0x4a')]){if(_0x2fbc3e[_0x999e('0x4a')][_0x999e('0x3e')](_0x67267d)){var _0x1596bb=_0x2fbc3e[_0x999e('0x4a')][_0x67267d];var _0x2bf43d={'id':_0x1596bb['id'],'available':_0x1596bb['available'],'loggedIn':_0x1596bb[_0x999e('0x45')],'name':_0x1596bb['name'],'paused':_0x1596bb[_0x999e('0x47')],'waiting':_0x1596bb[_0x999e('0x49')]};_0x2d398f['push'](_0x2bf43d);}}_0x4871c9({'count':_0x2d398f[_0x999e('0x18')],'rows':_0x2d398f});});},'SmsQueues':function(_0x175904){return new Promise(function(_0x35fbf6,_0xcbe77a){var _0x17beed=[];for(var _0x4ba9cd in _0x2fbc3e[_0x999e('0x4b')]){if(_0x2fbc3e[_0x999e('0x4b')]['hasOwnProperty'](_0x4ba9cd)){var _0x4f9218=_0x2fbc3e['smsQueues'][_0x4ba9cd];var _0x43ec04={'id':_0x4f9218['id'],'available':_0x4f9218[_0x999e('0x44')],'loggedIn':_0x4f9218[_0x999e('0x45')],'name':_0x4f9218[_0x999e('0x46')],'paused':_0x4f9218[_0x999e('0x47')],'waiting':_0x4f9218['waiting']};_0x17beed['push'](_0x43ec04);}}_0x35fbf6({'count':_0x17beed['length'],'rows':_0x17beed});});},'FaxQueues':function(_0x49293d){return new Promise(function(_0x513580,_0x53ba16){var _0x397488=[];for(var _0x59429f in _0x2fbc3e[_0x999e('0x4c')]){if(_0x2fbc3e[_0x999e('0x4c')][_0x999e('0x3e')](_0x59429f)){var _0x5b8a0d=_0x2fbc3e[_0x999e('0x4c')][_0x59429f];var _0x3c2bce={'id':_0x5b8a0d['id'],'available':_0x5b8a0d[_0x999e('0x44')],'loggedIn':_0x5b8a0d[_0x999e('0x45')],'name':_0x5b8a0d[_0x999e('0x46')],'paused':_0x5b8a0d[_0x999e('0x47')],'waiting':_0x5b8a0d[_0x999e('0x49')]};_0x397488['push'](_0x3c2bce);}}_0x513580({'count':_0x397488[_0x999e('0x18')],'rows':_0x397488});});},'WhatsappQueues':function(_0x397935){return new Promise(function(_0x193c80,_0x5781d2){var _0x2a7150=[];for(var _0x12d040 in _0x2fbc3e['whatsappQueues']){if(_0x2fbc3e[_0x999e('0x4d')][_0x999e('0x3e')](_0x12d040)){var _0x3a404d=_0x2fbc3e[_0x999e('0x4d')][_0x12d040];var _0xc02339={'id':_0x3a404d['id'],'available':_0x3a404d[_0x999e('0x44')],'loggedIn':_0x3a404d[_0x999e('0x45')],'name':_0x3a404d[_0x999e('0x46')],'paused':_0x3a404d[_0x999e('0x47')],'waiting':_0x3a404d['waiting']};_0x2a7150[_0x999e('0x1f')](_0xc02339);}}_0x193c80({'count':_0x2a7150[_0x999e('0x18')],'rows':_0x2a7150});});},'ChatQueuesWaitingInteractions':function(_0x3ec467){return new Promise(function(_0x58a51e,_0x46365a){var _0x48e0ca=_[_0x999e('0x42')](_0x2fbc3e[_0x999e('0x4e')]);_0x58a51e({'count':_0x48e0ca[_0x999e('0x18')],'rows':_0x48e0ca});});},'MailQueuesWaitingInteractions':function(_0x4e6c30){return new Promise(function(_0x43377d,_0xbde93c){var _0x1d6b40=_[_0x999e('0x42')](_0x2fbc3e[_0x999e('0x4f')]);_0x43377d({'count':_0x1d6b40[_0x999e('0x18')],'rows':_0x1d6b40});});},'OpenchannelQueuesWaitingInteractions':function(_0x5c4a50){return new Promise(function(_0x13823c,_0x498e70){var _0x34f25c=_['values'](_0x2fbc3e['openchannelQueuesWaitingInteractions']);_0x13823c({'count':_0x34f25c[_0x999e('0x18')],'rows':_0x34f25c});});},'SmsQueuesWaitingInteractions':function(_0x5d136c){return new Promise(function(_0x3c5d8d,_0x234921){var _0x5adf0c=_[_0x999e('0x42')](_0x2fbc3e[_0x999e('0x50')]);_0x3c5d8d({'count':_0x5adf0c['length'],'rows':_0x5adf0c});});},'FaxQueuesWaitingInteractions':function(_0x2a4d85){return new Promise(function(_0x6492cc,_0x17a764){var _0x224242=_[_0x999e('0x42')](_0x2fbc3e[_0x999e('0x51')]);_0x6492cc({'count':_0x224242[_0x999e('0x18')],'rows':_0x224242});});},'WhatsappQueuesWaitingInteractions':function(_0x25b243){return new Promise(function(_0x5cdf6d,_0x496aba){var _0x34541f=_[_0x999e('0x42')](_0x2fbc3e[_0x999e('0x52')]);_0x5cdf6d({'count':_0x34541f[_0x999e('0x18')],'rows':_0x34541f});});}};var _0x142843=jayson[_0x999e('0x53')](_0xa44e4c)['http']();_0x142843['on'](_0x999e('0x2c'),function(_0x19cb19){logger['error'](JSON[_0x999e('0x54')](_0x19cb19));return _0x4d1716(_0x19cb19);});_0x142843[_0x999e('0x13')](0x232c,_0x999e('0x55'),function(){console['log'](_0x999e('0x56'),0x232c);return _0x28bdd1(_0x999e('0x57')+0x232c);});});}; \ No newline at end of file +var _0xd13e=['catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','applications','isArray','length','join','.js','app','toLowerCase','autoreply','mail','push','slice','dialogflow','dialogflowv2','appdata','amazonlex','split','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','emit','complete','info','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId'];(function(_0x52711f,_0x4cf48b){var _0x736442=function(_0x1170b2){while(--_0x1170b2){_0x52711f['push'](_0x52711f['shift']());}};_0x736442(++_0x4cf48b);}(_0xd13e,0x193));var _0xed13=function(_0x3cf82d,_0x174b54){_0x3cf82d=_0x3cf82d-0x0;var _0x6fdde0=_0xd13e[_0x3cf82d];return _0x6fdde0;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var path=require(_0xed13('0x2'));var fs=require('fs');var jayson=require(_0xed13('0x3'));var BPromise=require('bluebird');var uuid=require(_0xed13('0x4'));var config=require('../../../config/environment');var logger=require(_0xed13('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0xed13('0x6')),'mailQueueReport':require(_0xed13('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xed13('0x8'))};var RuleEngine=require(_0xed13('0x9'));function getId(_0xab0fff,_0x3b3984,_0x369798){return util[_0xed13('0xa')](_0xed13('0xb'),_0xab0fff,_0x3b3984||0x0,_0x369798||0x0);}function getIntervals(_0x9bc191,_0x8543ad){var _0x4e1e07=[];if(!_[_0xed13('0xc')](_0x8543ad[_0xed13('0xd')])&&!_[_0xed13('0xc')](_0x9bc191[_0x8543ad[_0xed13('0xd')]])&&!_[_0xed13('0xc')](_0x9bc191[_0x8543ad['IntervalId']][_0xed13('0xe')])){_0x4e1e07=_[_0xed13('0xf')](_0x9bc191[_0x8543ad[_0xed13('0xd')]][_0xed13('0xe')],_0xed13('0x10'));}else if(!_[_0xed13('0xc')](_0x8543ad['interval'])){_0x4e1e07=[_0x8543ad[_0xed13('0x10')]];}return _0x4e1e07;}exports['listen']=function(_0x257074){_0x257074['rules']={};return new BPromise(function(_0x6e2978,_0x56108d){var _0x1de882={'Start':function(_0x4d5435){var _0x38901a=this;return new Promise(function(_0xf900d2,_0x1d3d67){if(_0x4d5435){try{var _0xa260ed=[];var _0x1d0ebf=getId(_0x4d5435[_0xed13('0x11')],_0x4d5435[_0xed13('0x12')]?_0x4d5435[_0xed13('0x12')]['id']:0x0,_0x4d5435[_0xed13('0x13')]?_0x4d5435[_0xed13('0x13')]['id']:0x0);if(_0x4d5435[_0xed13('0x14')]&&_[_0xed13('0x15')](_0x4d5435[_0xed13('0x14')])&&_0x4d5435[_0xed13('0x14')][_0xed13('0x16')]){for(var _0x2f38c9=0x0;_0x2f38c9<_0x4d5435['applications']['length'];_0x2f38c9+=0x1){var _0x1f3646=_0x4d5435[_0xed13('0x14')][_0x2f38c9];if(fs['existsSync'](path[_0xed13('0x17')](__dirname,'applications',_0x1f3646['app']+_0xed13('0x18')))){var _0x3a2b76=[];switch(_0x1f3646[_0xed13('0x19')][_0xed13('0x1a')]()){case _0xed13('0x1b'):var _0x2fc1e4=_0x1f3646['appdata']['split'](',');if(_0x4d5435['channel']===_0xed13('0x1c')){_0x3a2b76[_0xed13('0x1d')](_0x2fc1e4[0x0]);_0x3a2b76[_0xed13('0x1d')](_0x2fc1e4[0x1]);_0x3a2b76[_0xed13('0x1d')](_0x2fc1e4[_0xed13('0x1e')](0x2,_0x2fc1e4[_0xed13('0x16')])[_0xed13('0x17')](','));}else{_0x3a2b76[_0xed13('0x1d')](_0x2fc1e4[0x0]);_0x3a2b76[_0xed13('0x1d')](_0x2fc1e4[_0xed13('0x1e')](0x1,_0x2fc1e4[_0xed13('0x16')])[_0xed13('0x17')](','));}break;case _0xed13('0x1f'):var _0x322fc3=_0x1f3646['appdata']['split'](',');_0x3a2b76[_0xed13('0x1d')](_0x322fc3[0x0]);_0x3a2b76[_0xed13('0x1d')](_0x322fc3[0x1]);_0x3a2b76['push'](_0x322fc3[_0xed13('0x1e')](0x2,_0x322fc3[_0xed13('0x16')])['join'](','));break;case _0xed13('0x20'):var _0x2066ca=_0x1f3646[_0xed13('0x21')]['split'](',');_0x3a2b76[_0xed13('0x1d')](_0x2066ca[0x0]);_0x3a2b76[_0xed13('0x1d')](_0x2066ca[0x1]);_0x3a2b76['push'](_0x2066ca[0x2]);_0x3a2b76[_0xed13('0x1d')](_0x2066ca[0x3]);_0x3a2b76[_0xed13('0x1d')](_0x2066ca['slice'](0x4,_0x2066ca[_0xed13('0x16')])[_0xed13('0x17')](','));break;case _0xed13('0x22'):var _0x2758f0=_0x1f3646[_0xed13('0x21')][_0xed13('0x23')](',');_0x3a2b76[_0xed13('0x1d')](_0x2758f0[0x0]);_0x3a2b76['push'](_0x2758f0[0x1]);_0x3a2b76[_0xed13('0x1d')](_0x2758f0[0x2]);_0x3a2b76['push'](_0x2758f0[0x3]);_0x3a2b76['push'](_0x2758f0[_0xed13('0x1e')](0x4,_0x2758f0[_0xed13('0x16')])[_0xed13('0x17')](','));break;case'message':_0x3a2b76[_0xed13('0x1d')](_0x1f3646[_0xed13('0x21')]);break;case _0xed13('0x24'):_0x3a2b76['push'](_0x1f3646[_0xed13('0x25')]);_0x3a2b76[_0xed13('0x1d')](_0x1f3646[_0xed13('0x21')]);break;default:_0x3a2b76=_[_0xed13('0xc')](_0x1f3646['appdata'])?[]:_0x1f3646[_0xed13('0x21')][_0xed13('0x23')](',');}var _0x2508b4={'id':util[_0xed13('0xa')](_0xed13('0x26'),_0x1d0ebf,_0x1f3646['id'],_0x1f3646[_0xed13('0x19')]),'condition':require(_0xed13('0x27'))[_0xed13('0x28')](_0x1d0ebf,getIntervals(_0x257074[_0xed13('0x29')],_0x1f3646),_0x257074),'consequence':require(_0xed13('0x2a')+_0x1f3646['app'])[_0xed13('0x2b')](_0x1d0ebf,_0x3a2b76,_0x257074,_0x4d5435),'p':_0x1f3646[_0xed13('0x2c')]||0x0};logger['info']('Push\x20new\x20rule',_0x2508b4['id'],'on\x20interval',getIntervals(_0x257074[_0xed13('0x29')],_0x1f3646)[_0xed13('0x17')]('\x20|\x20'));_0xa260ed['push'](_0x2508b4);}else{logger[_0xed13('0x2d')](_0xed13('0x2e'),path[_0xed13('0x17')](__dirname,_0xed13('0x14'),_0x1f3646[_0xed13('0x19')]+'.js'));}}_0x257074['rules'][_0x1d0ebf]=new RuleEngine(_0xa260ed);_0x257074[_0xed13('0x2f')][_0x1d0ebf]['execute'](_0x4d5435,function(_0x3dfe63){logger['info'](_0xed13('0x30'),JSON['stringify'](_0x3dfe63['matchPath']));if(_0x257074['rules'][_0x1d0ebf]){_0x257074[_0xed13('0x2f')][_0x1d0ebf][_0xed13('0x31')](_0xed13('0x32'));}});return _0xf900d2({'code':0xc8,'message':_0x4d5435});}else{logger[_0xed13('0x33')](_0xed13('0x34'));return _0xf900d2({'code':0xc8,'message':_0x4d5435});}}catch(_0x56ae05){logger[_0xed13('0x2d')](_0x56ae05[_0xed13('0x35')]);return _0x1d3d67(_0x38901a[_0xed13('0x2d')](0x1f4,_0x56ae05));}}return _0x1d3d67(_0xed13('0x36'));});},'AcceptMessage':function(_0x1d802c){var _0x5a8cfb=this;return new Promise(function(_0x1623c7,_0x34df0d){if(_0x1d802c[_0xed13('0x37')]&&_0x1d802c[_0xed13('0x37')]['id']){if(_0x257074[_0xed13('0x38')][_0x1d802c[_0xed13('0x37')]['id']]){_0x257074['agents'][_0x1d802c[_0xed13('0x37')]['id']][_0xed13('0x39')]=![];_0x257074[_0xed13('0x38')][_0x1d802c[_0xed13('0x37')]['id']][_0xed13('0x3a')]=undefined;}}if(_0x1d802c[_0xed13('0x12')]&&_0x1d802c[_0xed13('0x12')]['id']){try{var _0x1d0020=getId(_0x1d802c[_0xed13('0x11')],_0x1d802c[_0xed13('0x12')]?_0x1d802c[_0xed13('0x12')]['id']:0x0,_0x1d802c[_0xed13('0x13')]?_0x1d802c[_0xed13('0x13')]['id']:0x0);if(_0x257074[_0xed13('0x2f')][_0x1d0020]){_0x257074['rules'][_0x1d0020][_0xed13('0x31')](_0xed13('0x3b'));if(rpc[_0x1d802c['channel']+_0xed13('0x3c')]){rpc[_0x1d802c[_0xed13('0x11')]+_0xed13('0x3c')]['update'](_0x1d0020,{'UserId':_0x1d802c[_0xed13('0x12')][_0xed13('0x3d')]})[_0xed13('0x3e')](function(_0x5c8c1a){logger['error'](_0xed13('0x3f'));});}}return _0x1623c7({'code':0xc8,'message':_0x1d802c});}catch(_0x4574ab){logger['error'](_0x4574ab[_0xed13('0x35')]);return _0x34df0d(_0x5a8cfb[_0xed13('0x2d')](0x1f4,_0x4574ab));}}logger[_0xed13('0x2d')](_0xed13('0x40'));return _0x34df0d(_0x5a8cfb['error'](0x1f4,_0xed13('0x40')));});},'RejectMessage':function(_0xf4ea89){var _0x1cec16=this;return new Promise(function(_0x7c4e19,_0x5e1417){if(_0xf4ea89[_0xed13('0x37')]&&_0xf4ea89['agent']['id']){try{if(_0x257074[_0xed13('0x38')][_0xf4ea89['agent']['id']]){_0x257074['agents'][_0xf4ea89[_0xed13('0x37')]['id']][_0xed13('0x39')]=![];_0x257074['agents'][_0xf4ea89[_0xed13('0x37')]['id']][_0xed13('0x3a')]=undefined;}return _0x7c4e19({'code':0xc8,'message':_0xf4ea89});}catch(_0x41df8f){logger[_0xed13('0x2d')](_0x41df8f['stack']);return _0x5e1417(_0x1cec16[_0xed13('0x2d')](0x1f4,_0x41df8f));}}logger['error'](_0xed13('0x40'));return _0x5e1417(_0x1cec16[_0xed13('0x2d')](0x1f4,_0xed13('0x40')));});},'AbandonInteraction':function(_0xa123ca){var _0x29dab5=this;return new Promise(function(_0x16c9cb,_0x414df9){if(_0xa123ca[_0xed13('0x11')]&&_0xa123ca['interaction']&&_0xa123ca[_0xed13('0x13')]['id']){try{var _0x38f66d=getId(_0xa123ca[_0xed13('0x11')],_0xa123ca[_0xed13('0x12')]?_0xa123ca['message']['id']:0x0,_0xa123ca[_0xed13('0x13')]?_0xa123ca['interaction']['id']:0x0);if(_0x257074[_0xed13('0x2f')][_0x38f66d]){_0x257074['rules'][_0x38f66d]['emit']('end');}return _0x16c9cb({'code':0xc8,'message':_0xa123ca});}catch(_0x41d871){logger[_0xed13('0x2d')](_0x41d871[_0xed13('0x35')]);return _0x414df9(_0x29dab5['error'](0x1f4,_0x41d871));}}logger[_0xed13('0x2d')](_0xed13('0x40'));return _0x414df9(_0x29dab5[_0xed13('0x2d')](0x1f4,_0xed13('0x40')));});},'AgentCapacity':function(_0x19bfae){var _0x5b155d=this;return new Promise(function(_0xe928e4,_0x160e0b){if(_0x257074[_0xed13('0x38')][_0xed13('0x41')](_0x19bfae['id'])){for(var _0x5eff1b in _0x19bfae[_0xed13('0x42')]){if(_0x19bfae[_0xed13('0x42')][_0xed13('0x41')](_0x5eff1b)){if(_0x257074[_0xed13('0x38')][_0x19bfae['id']][_0xed13('0x41')](_0x5eff1b+_0xed13('0x43'))){_0x257074[_0xed13('0x38')][_0x19bfae['id']][_0x5eff1b+'CurrentCapacity']=parseInt(_0x19bfae[_0xed13('0x42')][_0x5eff1b],0xa);}}}_0x257074['agents'][_0x19bfae['id']][_0xed13('0x44')]();return _0xe928e4({'code':0xc8,'message':_0x257074['agents'][_0x19bfae['id']]});}else{return _0x160e0b(_0x5b155d[_0xed13('0x2d')](0x1f4,_0xed13('0x45')));}});},'Agents':function(_0x6591ad){return new Promise(function(_0xcb42f9,_0x454986){var _0x50d211=_['values'](_0x257074[_0xed13('0x38')]);_0xcb42f9({'count':_0x50d211[_0xed13('0x16')],'rows':_0x50d211});});},'ChatQueues':function(_0xe2ae5d){return new Promise(function(_0x1d6de4,_0x3c9a51){var _0xb0e307=[];for(var _0xddd16a in _0x257074[_0xed13('0x46')]){if(_0x257074[_0xed13('0x46')]['hasOwnProperty'](_0xddd16a)){var _0x4bff68=_0x257074['chatQueues'][_0xddd16a];var _0x361386={'id':_0x4bff68['id'],'available':_0x4bff68[_0xed13('0x47')],'loggedIn':_0x4bff68[_0xed13('0x48')],'name':_0x4bff68['name'],'paused':_0x4bff68['paused'],'waiting':_0x4bff68[_0xed13('0x49')]};_0xb0e307[_0xed13('0x1d')](_0x361386);}}_0x1d6de4({'count':_0xb0e307[_0xed13('0x16')],'rows':_0xb0e307});});},'MailQueues':function(_0x4a2716){return new Promise(function(_0x57ae9a,_0x4ffe1f){var _0x5289bc=[];for(var _0x1c3d01 in _0x257074[_0xed13('0x4a')]){if(_0x257074[_0xed13('0x4a')]['hasOwnProperty'](_0x1c3d01)){var _0x1ad985=_0x257074[_0xed13('0x4a')][_0x1c3d01];var _0x50644e={'id':_0x1ad985['id'],'available':_0x1ad985[_0xed13('0x47')],'loggedIn':_0x1ad985[_0xed13('0x48')],'name':_0x1ad985[_0xed13('0x4b')],'paused':_0x1ad985[_0xed13('0x4c')],'waiting':_0x1ad985[_0xed13('0x49')]};_0x5289bc[_0xed13('0x1d')](_0x50644e);}}_0x57ae9a({'count':_0x5289bc[_0xed13('0x16')],'rows':_0x5289bc});});},'OpenchannelQueues':function(_0x24147b){return new Promise(function(_0x418419,_0x58b4af){var _0x1fb40d=[];for(var _0x2fb6ad in _0x257074[_0xed13('0x4d')]){if(_0x257074[_0xed13('0x4d')]['hasOwnProperty'](_0x2fb6ad)){var _0x5dd7db=_0x257074['openchannelQueues'][_0x2fb6ad];var _0x22c8df={'id':_0x5dd7db['id'],'available':_0x5dd7db[_0xed13('0x47')],'loggedIn':_0x5dd7db[_0xed13('0x48')],'name':_0x5dd7db[_0xed13('0x4b')],'paused':_0x5dd7db[_0xed13('0x4c')],'waiting':_0x5dd7db[_0xed13('0x49')]};_0x1fb40d[_0xed13('0x1d')](_0x22c8df);}}_0x418419({'count':_0x1fb40d[_0xed13('0x16')],'rows':_0x1fb40d});});},'SmsQueues':function(_0xcc8d0f){return new Promise(function(_0xa2fbf4,_0x42856b){var _0x436b3e=[];for(var _0x2a17eb in _0x257074[_0xed13('0x4e')]){if(_0x257074[_0xed13('0x4e')][_0xed13('0x41')](_0x2a17eb)){var _0x520c94=_0x257074[_0xed13('0x4e')][_0x2a17eb];var _0x1ea25a={'id':_0x520c94['id'],'available':_0x520c94[_0xed13('0x47')],'loggedIn':_0x520c94[_0xed13('0x48')],'name':_0x520c94[_0xed13('0x4b')],'paused':_0x520c94[_0xed13('0x4c')],'waiting':_0x520c94[_0xed13('0x49')]};_0x436b3e['push'](_0x1ea25a);}}_0xa2fbf4({'count':_0x436b3e['length'],'rows':_0x436b3e});});},'FaxQueues':function(_0xd714e5){return new Promise(function(_0x2b5cf3,_0x37b244){var _0xedef4d=[];for(var _0x312e03 in _0x257074['faxQueues']){if(_0x257074['faxQueues'][_0xed13('0x41')](_0x312e03)){var _0x2b1285=_0x257074[_0xed13('0x4f')][_0x312e03];var _0x3d80ec={'id':_0x2b1285['id'],'available':_0x2b1285[_0xed13('0x47')],'loggedIn':_0x2b1285['loggedIn'],'name':_0x2b1285[_0xed13('0x4b')],'paused':_0x2b1285[_0xed13('0x4c')],'waiting':_0x2b1285[_0xed13('0x49')]};_0xedef4d[_0xed13('0x1d')](_0x3d80ec);}}_0x2b5cf3({'count':_0xedef4d[_0xed13('0x16')],'rows':_0xedef4d});});},'WhatsappQueues':function(_0x3db2d5){return new Promise(function(_0x5204ca,_0x41a5c6){var _0x3d2bf3=[];for(var _0x3ad30e in _0x257074[_0xed13('0x50')]){if(_0x257074[_0xed13('0x50')][_0xed13('0x41')](_0x3ad30e)){var _0x7d2d5b=_0x257074['whatsappQueues'][_0x3ad30e];var _0x134463={'id':_0x7d2d5b['id'],'available':_0x7d2d5b[_0xed13('0x47')],'loggedIn':_0x7d2d5b[_0xed13('0x48')],'name':_0x7d2d5b[_0xed13('0x4b')],'paused':_0x7d2d5b['paused'],'waiting':_0x7d2d5b['waiting']};_0x3d2bf3[_0xed13('0x1d')](_0x134463);}}_0x5204ca({'count':_0x3d2bf3['length'],'rows':_0x3d2bf3});});},'ChatQueuesWaitingInteractions':function(_0x407d6f){return new Promise(function(_0x1fac63,_0x5e0551){var _0x521c36=_[_0xed13('0x51')](_0x257074[_0xed13('0x52')]);_0x1fac63({'count':_0x521c36[_0xed13('0x16')],'rows':_0x521c36});});},'MailQueuesWaitingInteractions':function(_0x891e75){return new Promise(function(_0xe658d6,_0x536122){var _0x30267a=_[_0xed13('0x51')](_0x257074[_0xed13('0x53')]);_0xe658d6({'count':_0x30267a[_0xed13('0x16')],'rows':_0x30267a});});},'OpenchannelQueuesWaitingInteractions':function(_0x2aef4a){return new Promise(function(_0x4a11bb,_0x1455be){var _0x3e0eac=_[_0xed13('0x51')](_0x257074['openchannelQueuesWaitingInteractions']);_0x4a11bb({'count':_0x3e0eac[_0xed13('0x16')],'rows':_0x3e0eac});});},'SmsQueuesWaitingInteractions':function(_0xf52bd5){return new Promise(function(_0x4af656,_0x13d28f){var _0x4ed596=_['values'](_0x257074[_0xed13('0x54')]);_0x4af656({'count':_0x4ed596[_0xed13('0x16')],'rows':_0x4ed596});});},'FaxQueuesWaitingInteractions':function(_0x48d513){return new Promise(function(_0x367281,_0x474771){var _0x410a12=_[_0xed13('0x51')](_0x257074[_0xed13('0x55')]);_0x367281({'count':_0x410a12['length'],'rows':_0x410a12});});},'WhatsappQueuesWaitingInteractions':function(_0x1a4e5){return new Promise(function(_0x1cd9dc,_0x332fd0){var _0x448f03=_['values'](_0x257074[_0xed13('0x56')]);_0x1cd9dc({'count':_0x448f03[_0xed13('0x16')],'rows':_0x448f03});});}};var _0x3a7c1f=jayson[_0xed13('0x57')](_0x1de882)[_0xed13('0x58')]();_0x3a7c1f['on'](_0xed13('0x2d'),function(_0x529c2f){logger[_0xed13('0x2d')](JSON[_0xed13('0x59')](_0x529c2f));return _0x56108d(_0x529c2f);});_0x3a7c1f['listen'](0x232c,'127.0.0.1',function(){console[_0xed13('0x5a')](_0xed13('0x5b'),0x232c);return _0x6e2978(_0xed13('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 5009956..fc0ed12 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 _0x14f7=['format','indexOf','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x14f7,0x119));var _0x714f=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x14f7[_0x2763f2];return _0x3ef471;};'use strict';var util=require(_0x714f('0x0'));var BPromise=require(_0x714f('0x1'));var jayson=require('jayson/promise');var _=require(_0x714f('0x2'));var logger=require(_0x714f('0x3'))(_0x714f('0x4'));var client=jayson[_0x714f('0x5')][_0x714f('0x6')]({'port':0x232a});function request(_0x10c7d6,_0x17a792){return new BPromise(function(_0x37ef7d,_0x593833){return client[_0x714f('0x7')](_0x10c7d6,_0x17a792)[_0x714f('0x8')](function(_0x2cce93){if(_0x2cce93[_0x714f('0x9')]){return _0x593833(_0x2cce93[_0x714f('0x9')][_0x714f('0xa')]);}else{return _0x37ef7d(_0x2cce93['result']);}})['catch'](function(_0x5b5734){return _0x593833(_0x5b5734);});});}exports[_0x714f('0xb')]=function(_0x59c2f5,_0x186a19,_0xb53b89){return function(_0x1422d5){if(_0xb53b89['rules']&&!_0xb53b89[_0x714f('0xc')][_0x59c2f5]){logger[_0x714f('0xd')](_0x714f('0xe'),_0x59c2f5);return _0x1422d5[_0x714f('0xf')]();}var _0x2fca56=[];for(var _0x4e4756=0x0;_0x4e4756<_0x186a19[_0x714f('0x10')];_0x4e4756+=0x1){_0x2fca56[_0x714f('0x11')](request(_0x714f('0x12'),{'command':util[_0x714f('0x13')]('iftime\x20%s',_0x186a19[_0x4e4756])})[_0x714f('0x8')](function(_0x22a24e){return _0x22a24e&&_0x22a24e['message']&&_0x22a24e['message'][_0x714f('0x14')]('true')>=0x0?!![]:![];})[_0x714f('0x15')](function(_0xb28ad7){logger[_0x714f('0x9')](_0x714f('0x16'),_0x59c2f5,_0x186a19[_0x4e4756]);}));}BPromise['all'](_0x2fca56)['then'](function(_0xd46161){var _0x3a3bb9=_[_0x714f('0x17')](_0xd46161);logger[_0x714f('0xd')](_0x714f('0x18'),_0x59c2f5,_0x186a19[_0x714f('0x19')]('\x20|\x20'),_0x3a3bb9);_0x1422d5[_0x714f('0x1a')](_0x3a3bb9);})[_0x714f('0x15')](function(_0x5ec1a7){console[_0x714f('0x1b')](_0x5ec1a7);logger[_0x714f('0x9')](_0x714f('0x18'),_0x59c2f5,_0x186a19[_0x714f('0x19')](_0x714f('0x1c')),_0x5ec1a7[_0x714f('0x1d')]);_0x1422d5['stop']();});};}; \ No newline at end of file +var _0xfd4e=['iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','bluebird','jayson/promise','routing','client','http','request','then','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format'];(function(_0xf0f151,_0x3fb19a){var _0x1186cc=function(_0x2a7780){while(--_0x2a7780){_0xf0f151['push'](_0xf0f151['shift']());}};_0x1186cc(++_0x3fb19a);}(_0xfd4e,0x174));var _0xefd4=function(_0x2afeb5,_0x52d7fb){_0x2afeb5=_0x2afeb5-0x0;var _0x10ceba=_0xfd4e[_0x2afeb5];return _0x10ceba;};'use strict';var util=require('util');var BPromise=require(_0xefd4('0x0'));var jayson=require(_0xefd4('0x1'));var _=require('lodash');var logger=require('../../../config/logger')(_0xefd4('0x2'));var client=jayson[_0xefd4('0x3')][_0xefd4('0x4')]({'port':0x232a});function request(_0x2e3263,_0xe16601){return new BPromise(function(_0x3ed315,_0x5a27f7){return client[_0xefd4('0x5')](_0x2e3263,_0xe16601)[_0xefd4('0x6')](function(_0x3c336f){if(_0x3c336f['error']){return _0x5a27f7(_0x3c336f[_0xefd4('0x7')][_0xefd4('0x8')]);}else{return _0x3ed315(_0x3c336f['result']);}})[_0xefd4('0x9')](function(_0x46525d){return _0x5a27f7(_0x46525d);});});}exports['condition']=function(_0x1ad454,_0x45f1b8,_0x49c56b){return function(_0x43f891){if(_0x49c56b['rules']&&!_0x49c56b[_0xefd4('0xa')][_0x1ad454]){logger[_0xefd4('0xb')](_0xefd4('0xc'),_0x1ad454);return _0x43f891[_0xefd4('0xd')]();}var _0x685691=[];for(var _0x23d6af=0x0;_0x23d6af<_0x45f1b8[_0xefd4('0xe')];_0x23d6af+=0x1){_0x685691[_0xefd4('0xf')](request(_0xefd4('0x10'),{'command':util[_0xefd4('0x11')](_0xefd4('0x12'),_0x45f1b8[_0x23d6af])})[_0xefd4('0x6')](function(_0x133c89){return _0x133c89&&_0x133c89[_0xefd4('0x8')]&&_0x133c89['message'][_0xefd4('0x13')](_0xefd4('0x14'))>=0x0?!![]:![];})[_0xefd4('0x9')](function(_0x29927e){logger[_0xefd4('0x7')](_0xefd4('0x15'),_0x1ad454,_0x45f1b8[_0x23d6af]);}));}BPromise[_0xefd4('0x16')](_0x685691)[_0xefd4('0x6')](function(_0x11ed96){var _0x4c091e=_[_0xefd4('0x17')](_0x11ed96);logger[_0xefd4('0xb')](_0xefd4('0x18'),_0x1ad454,_0x45f1b8[_0xefd4('0x19')](_0xefd4('0x1a')),_0x4c091e);_0x43f891[_0xefd4('0x1b')](_0x4c091e);})[_0xefd4('0x9')](function(_0x1feec2){console[_0xefd4('0x1c')](_0x1feec2);logger['error'](_0xefd4('0x18'),_0x1ad454,_0x45f1b8[_0xefd4('0x19')](_0xefd4('0x1a')),_0x1feec2[_0xefd4('0x1d')]);_0x43f891[_0xefd4('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7fb1748..4b4b7d8 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 _0xed79=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','diffTime','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','push','[%s][agents][agentringnoanswer]','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','error','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0xed79,0x17e));var _0x9ed7=function(_0x1acfdc,_0x594588){_0x1acfdc=_0x1acfdc-0x0;var _0x2dccef=_0xed79[_0x1acfdc];return _0x2dccef;};'use strict';var _=require('lodash');var util=require(_0x9ed7('0x0'));var utils=require(_0x9ed7('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x10034f,_0x372f74){utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')](_0x9ed7('0x4'),_0x10034f[_0x9ed7('0x5')],_0x10034f[_0x9ed7('0x6')],_0x10034f[_0x9ed7('0x7')],_0x10034f[_0x9ed7('0x8')],_0x10034f[_0x9ed7('0x9')],_0x10034f[_0x9ed7('0xa')],_0x10034f['connectedlinenum'],_0x10034f[_0x9ed7('0xb')]));if(_0x10034f[_0x9ed7('0x7')]){utils[_0x9ed7('0xc')](_0x10034f[_0x9ed7('0x7')])[_0x9ed7('0xd')](function(_0x2df951){if(_0x2df951){_0x10034f[_0x9ed7('0xe')]=_0x2df951['type'];_0x10034f[_0x9ed7('0xf')]=_0x10034f['agentcomplete']?_0x2df951['acw']:![];_0x10034f[_0x9ed7('0x10')]=_0x10034f[_0x9ed7('0xf')]?_0x2df951[_0x9ed7('0x11')]:0x0;}utils[_0x9ed7('0x12')]('CreateVoiceAgentReport',_0x10034f);});}else{utils['request'](_0x9ed7('0x13'),_0x10034f);}if(_0x372f74){delete transfers[_0x10034f[_0x9ed7('0x5')]];}else{delete agents[_0x10034f['destuniqueid']];}}exports[_0x9ed7('0x14')]=function(_0x12766e){try{utils[_0x9ed7('0x15')](util[_0x9ed7('0x3')](_0x9ed7('0x16'),_0x12766e[_0x9ed7('0x5')]),_0x12766e);agents[_0x12766e[_0x9ed7('0x17')]]=_0x12766e;agents[_0x12766e[_0x9ed7('0x17')]][_0x9ed7('0x18')]=utils[_0x9ed7('0x19')]();agents[_0x12766e['destuniqueid']]['lastevent']=_0x9ed7('0x1a');agents[_0x12766e[_0x9ed7('0x17')]][_0x9ed7('0x1b')]=null;agents[_0x12766e[_0x9ed7('0x17')]]['connectedlinename']=null;utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')](_0x9ed7('0x1c'),_0x12766e[_0x9ed7('0x5')],agents[_0x12766e['destuniqueid']][_0x9ed7('0x8')],_0x12766e[_0x9ed7('0x17')]));}catch(_0x32b29e){utils['error'](util[_0x9ed7('0x3')](_0x9ed7('0x16'),_0x12766e[_0x9ed7('0x5')]),_0x32b29e);}};exports[_0x9ed7('0x1d')]=function(_0x9e42d6){try{if(!_[_0x9ed7('0x1e')](agents[_0x9e42d6[_0x9ed7('0x17')]])){utils['debug'](util[_0x9ed7('0x3')]('[%s][agents][agentringnoanswer]',_0x9e42d6[_0x9ed7('0x5')]),_0x9e42d6);utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')](_0x9ed7('0x1f'),_0x9e42d6[_0x9ed7('0x5')],agents[_0x9e42d6[_0x9ed7('0x17')]][_0x9ed7('0x8')],_0x9e42d6[_0x9ed7('0x17')]));agents[_0x9e42d6[_0x9ed7('0x17')]][_0x9ed7('0x1d')]=!![];agents[_0x9e42d6[_0x9ed7('0x17')]]['agentringnoanswerAt']=utils[_0x9ed7('0x19')]();agents[_0x9e42d6[_0x9ed7('0x17')]][_0x9ed7('0xb')]=_0x9ed7('0x20');agents[_0x9e42d6[_0x9ed7('0x17')]][_0x9ed7('0x21')]='timeout';agents[_0x9e42d6[_0x9ed7('0x17')]]['holdtime']=_0x9e42d6[_0x9ed7('0x22')]?parseInt(_0x9e42d6[_0x9ed7('0x22')])/0x3e8:0x0;agents[_0x9e42d6[_0x9ed7('0x17')]][_0x9ed7('0x23')]=0x0;unanswered[_0x9ed7('0x24')](_0x9e42d6[_0x9ed7('0x17')]);}}catch(_0x2fedda){utils['error'](util[_0x9ed7('0x3')](_0x9ed7('0x25'),_0x9e42d6[_0x9ed7('0x5')]),_0x2fedda);}};exports['queuecallerabandon']=function(_0x1c738e){try{_[_0x9ed7('0x26')](agents,function(_0x6905b7,_0x368b11){if(_0x6905b7[_0x9ed7('0x5')]==_0x1c738e[_0x9ed7('0x5')]&&!_['includes'](unanswered,_0x6905b7[_0x9ed7('0x17')])){utils[_0x9ed7('0x15')](util[_0x9ed7('0x3')](_0x9ed7('0x27'),_0x1c738e[_0x9ed7('0x5')]),_0x1c738e);utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')](_0x9ed7('0x28'),_0x1c738e['uniqueid'],_0x6905b7[_0x9ed7('0x8')],_0x6905b7['destuniqueid']));_0x6905b7[_0x9ed7('0x1d')]=!![];_0x6905b7[_0x9ed7('0x29')]=utils[_0x9ed7('0x19')]();_0x6905b7[_0x9ed7('0xb')]=_0x9ed7('0x2a');_0x6905b7[_0x9ed7('0x21')]=_0x9ed7('0x2a');_0x6905b7[_0x9ed7('0x2b')]=_0x1c738e[_0x9ed7('0x2b')];_0x6905b7[_0x9ed7('0x23')]=0x0;writeDB(_0x6905b7);}});}catch(_0x26a7b3){utils[_0x9ed7('0x2c')](util[_0x9ed7('0x3')](_0x9ed7('0x27'),_0x1c738e[_0x9ed7('0x5')]),_0x26a7b3);}};exports[_0x9ed7('0x2d')]=function(_0x3c28ae){try{if(agents[_0x3c28ae['destuniqueid']]){utils['debug'](util[_0x9ed7('0x3')](_0x9ed7('0x2e'),_0x3c28ae[_0x9ed7('0x5')]),_0x3c28ae);utils[_0x9ed7('0x2')](util['format'](_0x9ed7('0x2f'),_0x3c28ae[_0x9ed7('0x5')],agents[_0x3c28ae[_0x9ed7('0x17')]][_0x9ed7('0x8')],_0x3c28ae[_0x9ed7('0x17')]));agents[_0x3c28ae[_0x9ed7('0x17')]][_0x9ed7('0x30')]=utils[_0x9ed7('0x19')]();agents[_0x3c28ae[_0x9ed7('0x17')]][_0x9ed7('0x1b')]=_0x3c28ae[_0x9ed7('0x1b')];agents[_0x3c28ae['destuniqueid']]['connectedlinename']=_0x3c28ae['connectedlinename'];agents[_0x3c28ae[_0x9ed7('0x17')]][_0x9ed7('0x2b')]=_0x3c28ae[_0x9ed7('0x22')];agents[_0x3c28ae['destuniqueid']][_0x9ed7('0xb')]=_0x9ed7('0x31');_[_0x9ed7('0x26')](agents,function(_0x5d1497,_0x32dae1){if(_0x5d1497['destuniqueid']!=_0x3c28ae[_0x9ed7('0x17')]&&_0x5d1497['uniqueid']==_0x3c28ae['uniqueid']){_0x5d1497[_0x9ed7('0x23')]=0x0;_0x5d1497[_0x9ed7('0x2b')]=_0x3c28ae[_0x9ed7('0x22')];_0x5d1497[_0x9ed7('0x1d')]=!![];_0x5d1497[_0x9ed7('0x29')]=utils[_0x9ed7('0x19')]();_0x5d1497[_0x9ed7('0xb')]=_0x9ed7('0x32');_0x5d1497[_0x9ed7('0x21')]=_0x9ed7('0x32');_0x5d1497[_0x9ed7('0x33')]=_0x3c28ae[_0x9ed7('0x17')];_0x5d1497[_0x9ed7('0x34')]=_0x3c28ae[_0x9ed7('0x8')];writeDB(_0x5d1497);}});}}catch(_0x4ec4ae){utils[_0x9ed7('0x2c')](util[_0x9ed7('0x3')]('[%s][agents][agentconnect]',_0x3c28ae['uniqueid']),_0x4ec4ae);}};exports['agentcomplete']=function(_0x80b18c){try{if(!_[_0x9ed7('0x1e')](agents[_0x80b18c['destuniqueid']])){utils[_0x9ed7('0x15')](util[_0x9ed7('0x3')](_0x9ed7('0x35'),_0x80b18c[_0x9ed7('0x5')]),_0x80b18c);utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')](_0x9ed7('0x36'),_0x80b18c[_0x9ed7('0x5')],agents[_0x80b18c[_0x9ed7('0x17')]][_0x9ed7('0x8')],_0x80b18c[_0x9ed7('0x17')]));agents[_0x80b18c['destuniqueid']][_0x9ed7('0x37')]=!![];agents[_0x80b18c[_0x9ed7('0x17')]][_0x9ed7('0x38')]=utils['now']();agents[_0x80b18c['destuniqueid']][_0x9ed7('0x23')]=utils['diffTime'](agents[_0x80b18c['destuniqueid']][_0x9ed7('0x38')],agents[_0x80b18c['destuniqueid']]['agentconnectAt']);agents[_0x80b18c['destuniqueid']]['reason']=_0x80b18c[_0x9ed7('0x21')];agents[_0x80b18c[_0x9ed7('0x17')]][_0x9ed7('0xb')]=_0x9ed7('0x39');writeDB(agents[_0x80b18c[_0x9ed7('0x17')]]);}}catch(_0x5c25ca){utils[_0x9ed7('0x2c')](util[_0x9ed7('0x3')](_0x9ed7('0x35'),_0x80b18c[_0x9ed7('0x5')]),_0x5c25ca);}};exports[_0x9ed7('0x3a')]=function(_0xb1a569){try{if(!_[_0x9ed7('0x1e')](agents[_0xb1a569[_0x9ed7('0x3b')]])){utils[_0x9ed7('0x15')](util['format']('[%s][agents][blindtransfer]',_0xb1a569[_0x9ed7('0x5')]),_0xb1a569);utils['info'](util[_0x9ed7('0x3')](_0x9ed7('0x3c'),_0xb1a569[_0x9ed7('0x5')],agents[_0xb1a569[_0x9ed7('0x3b')]]['membername'],agents[_0xb1a569[_0x9ed7('0x3b')]][_0x9ed7('0x5')]));agents[_0xb1a569[_0x9ed7('0x3b')]]['transfer']=!![];agents[_0xb1a569[_0x9ed7('0x3b')]][_0x9ed7('0x3d')]='blind';agents[_0xb1a569['transfereruniqueid']][_0x9ed7('0x3e')]=_0xb1a569['extension'];agents[_0xb1a569[_0x9ed7('0x3b')]][_0x9ed7('0x3f')]=agents[_0xb1a569['transfereruniqueid']][_0x9ed7('0x5')];}}catch(_0x581a72){utils[_0x9ed7('0x2c')](util[_0x9ed7('0x3')](_0x9ed7('0x40'),_0xb1a569[_0x9ed7('0x5')]),_0x581a72);}};exports[_0x9ed7('0x41')]=function(_0x10140a){try{utils[_0x9ed7('0x15')](util[_0x9ed7('0x3')](_0x9ed7('0x42'),_0x10140a['origtransfereruniqueid']),_0x10140a);if(_0x10140a[_0x9ed7('0x43')]==_0x10140a[_0x9ed7('0x44')]){if(!_[_0x9ed7('0x1e')](agents[_0x10140a[_0x9ed7('0x45')]])){utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')](_0x9ed7('0x46'),_0x10140a[_0x9ed7('0x43')],agents[_0x10140a[_0x9ed7('0x45')]]['membername']));agents[_0x10140a['secondtransfereruniqueid']][_0x9ed7('0x47')]=!![];agents[_0x10140a[_0x9ed7('0x45')]][_0x9ed7('0x3d')]='ATTENDED';agents[_0x10140a[_0x9ed7('0x45')]][_0x9ed7('0x3e')]=_0x10140a[_0x9ed7('0x48')];agents[_0x10140a[_0x9ed7('0x45')]][_0x9ed7('0x3f')]=_0x10140a['origtransfereruniqueid'];}if(_0x10140a[_0x9ed7('0x49')]&&agents[_0x10140a[_0x9ed7('0x49')]]){agents[_0x10140a[_0x9ed7('0x49')]][_0x9ed7('0x4a')]=0x1;transfers[_0x10140a['transfereeuniqueid']]=_['clone'](agents[_0x10140a['transfereeuniqueid']]);transfers[_0x10140a[_0x9ed7('0x49')]]['calleridnum']=agents[_0x10140a['secondtransfereruniqueid']]['calleridnum'];transfers[_0x10140a[_0x9ed7('0x49')]][_0x9ed7('0x4b')]=agents[_0x10140a[_0x9ed7('0x45')]][_0x9ed7('0x4b')];transfers[_0x10140a[_0x9ed7('0x49')]][_0x9ed7('0x18')]=utils[_0x9ed7('0x19')]();transfers[_0x10140a[_0x9ed7('0x49')]][_0x9ed7('0x30')]=utils[_0x9ed7('0x19')]();transfers[_0x10140a[_0x9ed7('0x49')]][_0x9ed7('0x2b')]=0x0;transfers[_0x10140a['transfereeuniqueid']][_0x9ed7('0x4a')]=0x2;}}else if(_0x10140a['secondtransfereruniqueid']==_0x10140a[_0x9ed7('0x4c')]){if(!_[_0x9ed7('0x1e')](agents[_0x10140a[_0x9ed7('0x43')]])){utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')](_0x9ed7('0x46'),_0x10140a[_0x9ed7('0x43')],agents[_0x10140a['origtransfereruniqueid']]['membername']));agents[_0x10140a[_0x9ed7('0x43')]][_0x9ed7('0x47')]=!![];agents[_0x10140a[_0x9ed7('0x43')]][_0x9ed7('0x3d')]=_0x9ed7('0x4d');agents[_0x10140a[_0x9ed7('0x43')]][_0x9ed7('0x3e')]=_0x10140a[_0x9ed7('0x4e')];agents[_0x10140a[_0x9ed7('0x43')]][_0x9ed7('0x3f')]=_0x10140a[_0x9ed7('0x45')];}if(_0x10140a[_0x9ed7('0x4f')]&&agents[_0x10140a[_0x9ed7('0x4f')]]){agents[_0x10140a['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x10140a['transfertargetuniqueid']]=_[_0x9ed7('0x50')](agents[_0x10140a[_0x9ed7('0x4f')]]);transfers[_0x10140a[_0x9ed7('0x4f')]][_0x9ed7('0xa')]=agents[_0x10140a[_0x9ed7('0x43')]][_0x9ed7('0xa')];transfers[_0x10140a[_0x9ed7('0x4f')]]['calleridname']=agents[_0x10140a[_0x9ed7('0x43')]]['calleridname'];transfers[_0x10140a[_0x9ed7('0x4f')]][_0x9ed7('0x18')]=utils[_0x9ed7('0x19')]();transfers[_0x10140a[_0x9ed7('0x4f')]][_0x9ed7('0x30')]=utils[_0x9ed7('0x19')]();transfers[_0x10140a['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x10140a['transfertargetuniqueid']][_0x9ed7('0x4a')]=0x2;}}}catch(_0x5e9261){utils['error'](util[_0x9ed7('0x3')](_0x9ed7('0x42'),_0x10140a[_0x9ed7('0x43')]),_0x5e9261);}};exports[_0x9ed7('0x51')]=function(_0x1bc727){try{utils[_0x9ed7('0x15')](util[_0x9ed7('0x3')](_0x9ed7('0x52'),_0x1bc727[_0x9ed7('0x5')]),_0x1bc727);if(agents[_0x1bc727[_0x9ed7('0x5')]]&&agents[_0x1bc727[_0x9ed7('0x5')]]['reason']===_0x9ed7('0x20')){if(_0x1bc727[_0x9ed7('0x53')]==='21'){agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x21')]=_0x9ed7('0x54');agents[_0x1bc727[_0x9ed7('0x5')]]['lastevent']=_0x9ed7('0x54');}utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1bc727[_0x9ed7('0x5')],agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x8')],agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x21')],agents[_0x1bc727['uniqueid']]['lastevent']));writeDB(agents[_0x1bc727[_0x9ed7('0x5')]]);var _0x43b90a=unanswered[_0x9ed7('0x55')](_0x1bc727['uniqueid']);if(_0x43b90a>-0x1){unanswered[_0x9ed7('0x56')](_0x43b90a,0x1);}}if(transfers[_0x1bc727[_0x9ed7('0x5')]]){transfers[_0x1bc727[_0x9ed7('0x5')]]['agentcomplete']=!![];transfers[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x38')]=utils[_0x9ed7('0x19')]();transfers[_0x1bc727['uniqueid']][_0x9ed7('0x23')]=utils[_0x9ed7('0x57')](transfers[_0x1bc727[_0x9ed7('0x5')]]['agentcompleteAt'],transfers[_0x1bc727['uniqueid']][_0x9ed7('0x30')]);transfers[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x21')]=_0x9ed7('0x58');transfers[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0xb')]=_0x9ed7('0x39');utils[_0x9ed7('0x2')](util[_0x9ed7('0x3')](_0x9ed7('0x59'),_0x1bc727[_0x9ed7('0x5')],transfers[_0x1bc727[_0x9ed7('0x5')]]['membername'],transfers[_0x1bc727[_0x9ed7('0x5')]]['reason'],transfers[_0x1bc727['uniqueid']]['lastevent']));writeDB(transfers[_0x1bc727[_0x9ed7('0x5')]],!![]);}if(agents[_0x1bc727[_0x9ed7('0x5')]]&&agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x30')]){agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x37')]=!![];agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x38')]=utils[_0x9ed7('0x19')]();agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x23')]=utils['diffTime'](agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x38')],agents[_0x1bc727['uniqueid']][_0x9ed7('0x30')]);agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x21')]=agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x47')]?'transfer':'agent';agents[_0x1bc727['uniqueid']][_0x9ed7('0xb')]=_0x9ed7('0x39');utils[_0x9ed7('0x2')](util['format'](_0x9ed7('0x59'),_0x1bc727[_0x9ed7('0x5')],agents[_0x1bc727['uniqueid']]['membername'],agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0x21')],agents[_0x1bc727[_0x9ed7('0x5')]][_0x9ed7('0xb')]));writeDB(agents[_0x1bc727[_0x9ed7('0x5')]]);}}catch(_0x4e0175){utils[_0x9ed7('0x2c')](util['format']('[%s][agents][hangup]',_0x1bc727[_0x9ed7('0x5')]),_0x4e0175);}}; \ No newline at end of file +var _0x400f=['holdtime','[%s][agents][agentconnect]','agentconnectAt','connect','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','[%s][agents][agentcomplete]','transfereruniqueid','transfer','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','complete','agent','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','agentringnoanswerAt','timeout','reason','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','abandoned'];(function(_0x14ea3f,_0x48114b){var _0x481258=function(_0x386a7e){while(--_0x386a7e){_0x14ea3f['push'](_0x14ea3f['shift']());}};_0x481258(++_0x48114b);}(_0x400f,0xc6));var _0xf400=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x400f[_0x3e0763];return _0x351ca2;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x3e8e6e,_0x448575){utils[_0xf400('0x0')](util['format'](_0xf400('0x1'),_0x3e8e6e['uniqueid'],_0x3e8e6e[_0xf400('0x2')],_0x3e8e6e[_0xf400('0x3')],_0x3e8e6e[_0xf400('0x4')],_0x3e8e6e[_0xf400('0x5')],_0x3e8e6e[_0xf400('0x6')],_0x3e8e6e[_0xf400('0x7')],_0x3e8e6e[_0xf400('0x8')]));if(_0x3e8e6e[_0xf400('0x3')]){utils[_0xf400('0x9')](_0x3e8e6e['queue'])[_0xf400('0xa')](function(_0x48c42c){if(_0x48c42c){_0x3e8e6e['type']=_0x48c42c[_0xf400('0xb')];_0x3e8e6e[_0xf400('0xc')]=_0x3e8e6e[_0xf400('0xd')]?_0x48c42c[_0xf400('0xe')]:![];_0x3e8e6e[_0xf400('0xf')]=_0x3e8e6e[_0xf400('0xc')]?_0x48c42c[_0xf400('0x10')]:0x0;}utils['request'](_0xf400('0x11'),_0x3e8e6e);});}else{utils['request'](_0xf400('0x11'),_0x3e8e6e);}if(_0x448575){delete transfers[_0x3e8e6e[_0xf400('0x12')]];}else{delete agents[_0x3e8e6e[_0xf400('0x13')]];}}exports[_0xf400('0x14')]=function(_0x2f37da){try{utils['debug'](util[_0xf400('0x15')](_0xf400('0x16'),_0x2f37da[_0xf400('0x12')]),_0x2f37da);agents[_0x2f37da[_0xf400('0x13')]]=_0x2f37da;agents[_0x2f37da[_0xf400('0x13')]][_0xf400('0x17')]=utils[_0xf400('0x18')]();agents[_0x2f37da[_0xf400('0x13')]][_0xf400('0x8')]=_0xf400('0x19');agents[_0x2f37da[_0xf400('0x13')]]['connectedlinenum']=null;agents[_0x2f37da[_0xf400('0x13')]][_0xf400('0x1a')]=null;utils[_0xf400('0x0')](util[_0xf400('0x15')](_0xf400('0x1b'),_0x2f37da['uniqueid'],agents[_0x2f37da['destuniqueid']]['membername'],_0x2f37da[_0xf400('0x13')]));}catch(_0x8e3b0b){utils[_0xf400('0x1c')](util['format'](_0xf400('0x16'),_0x2f37da[_0xf400('0x12')]),_0x8e3b0b);}};exports[_0xf400('0x1d')]=function(_0xdf9628){try{if(!_[_0xf400('0x1e')](agents[_0xdf9628['destuniqueid']])){utils[_0xf400('0x1f')](util[_0xf400('0x15')]('[%s][agents][agentringnoanswer]',_0xdf9628[_0xf400('0x12')]),_0xdf9628);utils[_0xf400('0x0')](util[_0xf400('0x15')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0xdf9628[_0xf400('0x12')],agents[_0xdf9628[_0xf400('0x13')]][_0xf400('0x4')],_0xdf9628[_0xf400('0x13')]));agents[_0xdf9628[_0xf400('0x13')]][_0xf400('0x1d')]=!![];agents[_0xdf9628[_0xf400('0x13')]][_0xf400('0x20')]=utils[_0xf400('0x18')]();agents[_0xdf9628['destuniqueid']][_0xf400('0x8')]=_0xf400('0x21');agents[_0xdf9628['destuniqueid']][_0xf400('0x22')]=_0xf400('0x21');agents[_0xdf9628[_0xf400('0x13')]]['holdtime']=_0xdf9628['ringtime']?parseInt(_0xdf9628['ringtime'])/0x3e8:0x0;agents[_0xdf9628[_0xf400('0x13')]][_0xf400('0x23')]=0x0;unanswered[_0xf400('0x24')](_0xdf9628['destuniqueid']);}}catch(_0x5729ed){utils[_0xf400('0x1c')](util['format'](_0xf400('0x25'),_0xdf9628[_0xf400('0x12')]),_0x5729ed);}};exports[_0xf400('0x26')]=function(_0x11ba5f){try{_[_0xf400('0x27')](agents,function(_0x1126e4,_0x4d0821){if(_0x1126e4['uniqueid']==_0x11ba5f['uniqueid']&&!_['includes'](unanswered,_0x1126e4[_0xf400('0x13')])){utils[_0xf400('0x1f')](util['format'](_0xf400('0x28'),_0x11ba5f[_0xf400('0x12')]),_0x11ba5f);utils[_0xf400('0x0')](util[_0xf400('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x11ba5f[_0xf400('0x12')],_0x1126e4['membername'],_0x1126e4[_0xf400('0x13')]));_0x1126e4['agentringnoanswer']=!![];_0x1126e4['agentringnoanswerAt']=utils[_0xf400('0x18')]();_0x1126e4[_0xf400('0x8')]=_0xf400('0x29');_0x1126e4[_0xf400('0x22')]=_0xf400('0x29');_0x1126e4[_0xf400('0x2a')]=_0x11ba5f['holdtime'];_0x1126e4[_0xf400('0x23')]=0x0;writeDB(_0x1126e4);}});}catch(_0x998686){utils[_0xf400('0x1c')](util[_0xf400('0x15')](_0xf400('0x28'),_0x11ba5f['uniqueid']),_0x998686);}};exports['agentconnect']=function(_0x224fd8){try{if(agents[_0x224fd8[_0xf400('0x13')]]){utils[_0xf400('0x1f')](util[_0xf400('0x15')](_0xf400('0x2b'),_0x224fd8[_0xf400('0x12')]),_0x224fd8);utils['info'](util[_0xf400('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x224fd8['uniqueid'],agents[_0x224fd8['destuniqueid']][_0xf400('0x4')],_0x224fd8[_0xf400('0x13')]));agents[_0x224fd8[_0xf400('0x13')]][_0xf400('0x2c')]=utils['now']();agents[_0x224fd8[_0xf400('0x13')]]['connectedlinenum']=_0x224fd8[_0xf400('0x7')];agents[_0x224fd8[_0xf400('0x13')]][_0xf400('0x1a')]=_0x224fd8[_0xf400('0x1a')];agents[_0x224fd8[_0xf400('0x13')]][_0xf400('0x2a')]=_0x224fd8['ringtime'];agents[_0x224fd8[_0xf400('0x13')]][_0xf400('0x8')]=_0xf400('0x2d');_[_0xf400('0x27')](agents,function(_0x26197b,_0x3269fb){if(_0x26197b[_0xf400('0x13')]!=_0x224fd8[_0xf400('0x13')]&&_0x26197b['uniqueid']==_0x224fd8[_0xf400('0x12')]){_0x26197b[_0xf400('0x23')]=0x0;_0x26197b[_0xf400('0x2a')]=_0x224fd8[_0xf400('0x2e')];_0x26197b[_0xf400('0x1d')]=!![];_0x26197b[_0xf400('0x20')]=utils[_0xf400('0x18')]();_0x26197b[_0xf400('0x8')]=_0xf400('0x2f');_0x26197b[_0xf400('0x22')]=_0xf400('0x2f');_0x26197b[_0xf400('0x30')]=_0x224fd8[_0xf400('0x13')];_0x26197b[_0xf400('0x31')]=_0x224fd8[_0xf400('0x4')];writeDB(_0x26197b);}});}}catch(_0x373779){utils[_0xf400('0x1c')](util[_0xf400('0x15')](_0xf400('0x2b'),_0x224fd8[_0xf400('0x12')]),_0x373779);}};exports[_0xf400('0xd')]=function(_0x3ee2f0){try{if(!_['isNil'](agents[_0x3ee2f0['destuniqueid']])){utils[_0xf400('0x1f')](util[_0xf400('0x15')]('[%s][agents][agentcomplete]',_0x3ee2f0['uniqueid']),_0x3ee2f0);utils[_0xf400('0x0')](util['format'](_0xf400('0x32'),_0x3ee2f0[_0xf400('0x12')],agents[_0x3ee2f0[_0xf400('0x13')]][_0xf400('0x4')],_0x3ee2f0[_0xf400('0x13')]));agents[_0x3ee2f0[_0xf400('0x13')]][_0xf400('0xd')]=!![];agents[_0x3ee2f0[_0xf400('0x13')]][_0xf400('0x33')]=utils[_0xf400('0x18')]();agents[_0x3ee2f0[_0xf400('0x13')]]['talktime']=utils[_0xf400('0x34')](agents[_0x3ee2f0['destuniqueid']][_0xf400('0x33')],agents[_0x3ee2f0[_0xf400('0x13')]][_0xf400('0x2c')]);agents[_0x3ee2f0[_0xf400('0x13')]][_0xf400('0x22')]=_0x3ee2f0[_0xf400('0x22')];agents[_0x3ee2f0[_0xf400('0x13')]]['lastevent']='complete';writeDB(agents[_0x3ee2f0[_0xf400('0x13')]]);}}catch(_0x2cb566){utils['error'](util[_0xf400('0x15')](_0xf400('0x35'),_0x3ee2f0[_0xf400('0x12')]),_0x2cb566);}};exports['blindtransfer']=function(_0x5b9382){try{if(!_[_0xf400('0x1e')](agents[_0x5b9382[_0xf400('0x36')]])){utils[_0xf400('0x1f')](util[_0xf400('0x15')]('[%s][agents][blindtransfer]',_0x5b9382[_0xf400('0x12')]),_0x5b9382);utils[_0xf400('0x0')](util[_0xf400('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5b9382[_0xf400('0x12')],agents[_0x5b9382[_0xf400('0x36')]][_0xf400('0x4')],agents[_0x5b9382[_0xf400('0x36')]][_0xf400('0x12')]));agents[_0x5b9382['transfereruniqueid']][_0xf400('0x37')]=!![];agents[_0x5b9382['transfereruniqueid']]['transfertype']=_0xf400('0x38');agents[_0x5b9382[_0xf400('0x36')]][_0xf400('0x39')]=_0x5b9382[_0xf400('0x3a')];agents[_0x5b9382['transfereruniqueid']][_0xf400('0x3b')]=agents[_0x5b9382['transfereruniqueid']][_0xf400('0x12')];}}catch(_0x11c04f){utils['error'](util[_0xf400('0x15')](_0xf400('0x3c'),_0x5b9382[_0xf400('0x12')]),_0x11c04f);}};exports[_0xf400('0x3d')]=function(_0x351ad0){try{utils[_0xf400('0x1f')](util[_0xf400('0x15')]('[%s][agents][attendedtransfer]',_0x351ad0['origtransfereruniqueid']),_0x351ad0);if(_0x351ad0[_0xf400('0x3e')]==_0x351ad0[_0xf400('0x3f')]){if(!_[_0xf400('0x1e')](agents[_0x351ad0[_0xf400('0x40')]])){utils[_0xf400('0x0')](util[_0xf400('0x15')](_0xf400('0x41'),_0x351ad0['origtransfereruniqueid'],agents[_0x351ad0[_0xf400('0x40')]][_0xf400('0x4')]));agents[_0x351ad0[_0xf400('0x40')]][_0xf400('0x37')]=!![];agents[_0x351ad0[_0xf400('0x40')]]['transfertype']=_0xf400('0x42');agents[_0x351ad0[_0xf400('0x40')]][_0xf400('0x39')]=_0x351ad0[_0xf400('0x43')];agents[_0x351ad0['secondtransfereruniqueid']][_0xf400('0x3b')]=_0x351ad0[_0xf400('0x3e')];}if(_0x351ad0[_0xf400('0x44')]&&agents[_0x351ad0[_0xf400('0x44')]]){agents[_0x351ad0['transfereeuniqueid']][_0xf400('0x45')]=0x1;transfers[_0x351ad0[_0xf400('0x44')]]=_[_0xf400('0x46')](agents[_0x351ad0[_0xf400('0x44')]]);transfers[_0x351ad0['transfereeuniqueid']][_0xf400('0x6')]=agents[_0x351ad0['secondtransfereruniqueid']][_0xf400('0x6')];transfers[_0x351ad0[_0xf400('0x44')]][_0xf400('0x47')]=agents[_0x351ad0[_0xf400('0x40')]][_0xf400('0x47')];transfers[_0x351ad0['transfereeuniqueid']][_0xf400('0x17')]=utils[_0xf400('0x18')]();transfers[_0x351ad0[_0xf400('0x44')]][_0xf400('0x2c')]=utils[_0xf400('0x18')]();transfers[_0x351ad0[_0xf400('0x44')]][_0xf400('0x2a')]=0x0;transfers[_0x351ad0[_0xf400('0x44')]][_0xf400('0x45')]=0x2;}}else if(_0x351ad0[_0xf400('0x40')]==_0x351ad0[_0xf400('0x48')]){if(!_[_0xf400('0x1e')](agents[_0x351ad0['origtransfereruniqueid']])){utils[_0xf400('0x0')](util[_0xf400('0x15')](_0xf400('0x41'),_0x351ad0['origtransfereruniqueid'],agents[_0x351ad0['origtransfereruniqueid']][_0xf400('0x4')]));agents[_0x351ad0['origtransfereruniqueid']][_0xf400('0x37')]=!![];agents[_0x351ad0[_0xf400('0x3e')]]['transfertype']='ATTENDED';agents[_0x351ad0[_0xf400('0x3e')]][_0xf400('0x39')]=_0x351ad0['secondtransfererexten'];agents[_0x351ad0[_0xf400('0x3e')]][_0xf400('0x3b')]=_0x351ad0[_0xf400('0x40')];}if(_0x351ad0[_0xf400('0x49')]&&agents[_0x351ad0[_0xf400('0x49')]]){agents[_0x351ad0[_0xf400('0x49')]][_0xf400('0x45')]=0x1;transfers[_0x351ad0[_0xf400('0x49')]]=_[_0xf400('0x46')](agents[_0x351ad0['transfertargetuniqueid']]);transfers[_0x351ad0[_0xf400('0x49')]][_0xf400('0x6')]=agents[_0x351ad0['origtransfereruniqueid']][_0xf400('0x6')];transfers[_0x351ad0['transfertargetuniqueid']][_0xf400('0x47')]=agents[_0x351ad0['origtransfereruniqueid']]['calleridname'];transfers[_0x351ad0['transfertargetuniqueid']][_0xf400('0x17')]=utils[_0xf400('0x18')]();transfers[_0x351ad0[_0xf400('0x49')]][_0xf400('0x2c')]=utils['now']();transfers[_0x351ad0[_0xf400('0x49')]][_0xf400('0x2a')]=0x0;transfers[_0x351ad0['transfertargetuniqueid']][_0xf400('0x45')]=0x2;}}}catch(_0x14fdf0){utils[_0xf400('0x1c')](util[_0xf400('0x15')]('[%s][agents][attendedtransfer]',_0x351ad0[_0xf400('0x3e')]),_0x14fdf0);}};exports[_0xf400('0x4a')]=function(_0x29e75a){try{utils[_0xf400('0x1f')](util['format']('[%s][agents][hangup]',_0x29e75a[_0xf400('0x12')]),_0x29e75a);if(agents[_0x29e75a[_0xf400('0x12')]]&&agents[_0x29e75a[_0xf400('0x12')]]['reason']===_0xf400('0x21')){if(_0x29e75a['cause']==='21'){agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x22')]='rejected';agents[_0x29e75a[_0xf400('0x12')]]['lastevent']='rejected';}utils[_0xf400('0x0')](util[_0xf400('0x15')](_0xf400('0x4b'),_0x29e75a[_0xf400('0x12')],agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x4')],agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x22')],agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x8')]));writeDB(agents[_0x29e75a[_0xf400('0x12')]]);var _0x33e992=unanswered[_0xf400('0x4c')](_0x29e75a[_0xf400('0x12')]);if(_0x33e992>-0x1){unanswered[_0xf400('0x4d')](_0x33e992,0x1);}}if(transfers[_0x29e75a[_0xf400('0x12')]]){transfers[_0x29e75a[_0xf400('0x12')]][_0xf400('0xd')]=!![];transfers[_0x29e75a[_0xf400('0x12')]][_0xf400('0x33')]=utils[_0xf400('0x18')]();transfers[_0x29e75a['uniqueid']][_0xf400('0x23')]=utils[_0xf400('0x34')](transfers[_0x29e75a[_0xf400('0x12')]][_0xf400('0x33')],transfers[_0x29e75a['uniqueid']][_0xf400('0x2c')]);transfers[_0x29e75a[_0xf400('0x12')]][_0xf400('0x22')]='agent';transfers[_0x29e75a['uniqueid']][_0xf400('0x8')]=_0xf400('0x4e');utils[_0xf400('0x0')](util['format'](_0xf400('0x4b'),_0x29e75a[_0xf400('0x12')],transfers[_0x29e75a['uniqueid']][_0xf400('0x4')],transfers[_0x29e75a[_0xf400('0x12')]]['reason'],transfers[_0x29e75a['uniqueid']]['lastevent']));writeDB(transfers[_0x29e75a['uniqueid']],!![]);}if(agents[_0x29e75a['uniqueid']]&&agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x2c')]){agents[_0x29e75a['uniqueid']][_0xf400('0xd')]=!![];agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x33')]=utils['now']();agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x23')]=utils[_0xf400('0x34')](agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x33')],agents[_0x29e75a[_0xf400('0x12')]]['agentconnectAt']);agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x22')]=agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x37')]?_0xf400('0x37'):_0xf400('0x4f');agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x8')]='complete';utils[_0xf400('0x0')](util[_0xf400('0x15')](_0xf400('0x4b'),_0x29e75a[_0xf400('0x12')],agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x4')],agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x22')],agents[_0x29e75a[_0xf400('0x12')]][_0xf400('0x8')]));writeDB(agents[_0x29e75a[_0xf400('0x12')]]);}}catch(_0x540dab){utils['error'](util[_0xf400('0x15')]('[%s][agents][hangup]',_0x29e75a[_0xf400('0x12')]),_0x540dab);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ec94a0c..10d49e3 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 _0x18e7=['cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfereruniqueid','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','lastevent','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','OutgoingSpoolFailed','context','accountcode','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s'];(function(_0x1354ea,_0x24c484){var _0x505693=function(_0xf0fa67){while(--_0xf0fa67){_0x1354ea['push'](_0x1354ea['shift']());}};_0x505693(++_0x24c484);}(_0x18e7,0x1ef));var _0x718e=function(_0x1c6006,_0x42b6c9){_0x1c6006=_0x1c6006-0x0;var _0x223659=_0x18e7[_0x1c6006];return _0x223659;};'use strict';var _=require(_0x718e('0x0'));var util=require(_0x718e('0x1'));var utils=require(_0x718e('0x2'));var transfers=require(_0x718e('0x3'));var dispositions=['NO\x20ANSWER',_0x718e('0x4'),_0x718e('0x4'),'NO\x20ANSWER',_0x718e('0x5'),_0x718e('0x5'),'ANSWERED',_0x718e('0x6'),_0x718e('0x4'),_0x718e('0x4'),'FAILED'];var channels={};function writeDB(_0x29b6c6){var _0x274191;if(transfers[_0x718e('0x7')][_0x29b6c6[_0x718e('0x8')]]){_0x274191=_0x29b6c6[_0x718e('0x8')];_0x29b6c6[_0x718e('0x8')]=transfers['blinds'][_0x29b6c6[_0x718e('0x8')]][_0x718e('0x9')];}utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0xc'),_0x29b6c6[_0x718e('0x8')],_0x29b6c6[_0x718e('0xd')],_0x29b6c6[_0x718e('0xe')],_0x29b6c6[_0x718e('0xf')],_0x29b6c6[_0x718e('0x10')],_0x29b6c6[_0x718e('0x11')],_0x29b6c6['connectedlinenum'],_0x29b6c6[_0x718e('0x12')]));if(_0x29b6c6['accountcode']){utils[_0x718e('0x13')](_0x29b6c6['accountcode'])[_0x718e('0x14')](function(_0x73e7d1){if(_0x73e7d1){_0x29b6c6[_0x718e('0x15')]=_0x73e7d1['id'];}utils[_0x718e('0x16')](_0x718e('0x17'),_0x29b6c6);});}else{utils['request'](_0x718e('0x17'),_0x29b6c6);}if(channels[_0x29b6c6[_0x718e('0x8')]]){delete channels[_0x29b6c6[_0x718e('0x8')]];}else if(_0x274191&&channels[_0x274191]){delete transfers['blinds'][_0x274191];delete channels[_0x274191];}}exports['newchannel']=function(_0x4601b9){try{utils[_0x718e('0x18')](util[_0x718e('0xb')]('[%s][calls][newchannel]',_0x4601b9[_0x718e('0x8')]),_0x4601b9);if(_0x4601b9[_0x718e('0x8')]==_0x4601b9['linkedid']&&_0x4601b9['channel']!=_0x718e('0x19')){utils[_0x718e('0xa')](util[_0x718e('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x4601b9['uniqueid'],_0x4601b9[_0x718e('0x1a')],_0x4601b9['exten']));channels[_0x4601b9['uniqueid']]={'uniqueid':_0x4601b9[_0x718e('0x8')],'accountcode':_0x4601b9[_0x718e('0x1b')],'source':_0x4601b9[_0x718e('0x11')],'destination':_0x4601b9[_0x718e('0x1c')],'destinationcontext':_0x4601b9[_0x718e('0x1a')],'channel':_0x4601b9[_0x718e('0xd')],'starttime':utils[_0x718e('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x718e('0x5'),'amaflags':_0x718e('0x1e')};}}catch(_0x3a6bb3){utils[_0x718e('0x1f')](util[_0x718e('0xb')](_0x718e('0x20'),_0x4601b9[_0x718e('0x8')]),_0x3a6bb3);}};exports[_0x718e('0x21')]=function(_0x10b5df){try{utils['debug'](util[_0x718e('0xb')](_0x718e('0x22'),_0x10b5df[_0x718e('0x8')]),_0x10b5df);if(!_[_0x718e('0x23')](channels[_0x10b5df[_0x718e('0x8')]])&&_0x10b5df[_0x718e('0x24')]==0x6){utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x25'),_0x10b5df[_0x718e('0x8')],_0x10b5df[_0x718e('0x1a')],_0x10b5df[_0x718e('0xd')]));if(_[_0x718e('0x23')](channels[_0x10b5df[_0x718e('0x8')]][_0x718e('0x26')])){channels[_0x10b5df[_0x718e('0x8')]][_0x718e('0x26')]=utils[_0x718e('0x1d')]();}}else if(!_[_0x718e('0x23')](channels[_0x10b5df[_0x718e('0x27')]])&&_0x10b5df[_0x718e('0x24')]==0x6&&_0x10b5df['context']!=_0x718e('0x28')){utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x29'),_0x10b5df['uniqueid'],_0x10b5df['linkedid'],_0x10b5df['context'],_0x10b5df[_0x718e('0xd')]));channels[_0x10b5df[_0x718e('0x27')]][_0x718e('0x1b')]=_0x10b5df[_0x718e('0x1b')];channels[_0x10b5df['linkedid']][_0x718e('0x2a')]=_0x10b5df[_0x718e('0xd')];if(_[_0x718e('0x23')](channels[_0x10b5df['linkedid']][_0x718e('0x2b')])){channels[_0x10b5df['linkedid']][_0x718e('0x2b')]=utils[_0x718e('0x1d')]();}channels[_0x10b5df[_0x718e('0x27')]]['disposition']=dispositions[_['toNumber'](_0x10b5df[_0x718e('0x24')])]||_0x718e('0x2c');}}catch(_0x16d0e6){utils[_0x718e('0x1f')](util[_0x718e('0xb')](_0x718e('0x22'),_0x10b5df[_0x718e('0x8')]),_0x16d0e6);}};exports[_0x718e('0x2d')]=function(_0x2fe802){try{if(!_[_0x718e('0x23')](channels[_0x2fe802[_0x718e('0x8')]])){utils[_0x718e('0x18')](util[_0x718e('0xb')](_0x718e('0x2e'),_0x2fe802['uniqueid']),_0x2fe802);if(_[_0x718e('0x23')](channels[_0x2fe802[_0x718e('0x8')]][_0x718e('0x2f')])){channels[_0x2fe802[_0x718e('0x8')]][_0x718e('0x2f')]=_0x2fe802[_0x718e('0x30')]+'\x20<'+_0x2fe802[_0x718e('0x11')]+'>';}utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x31'),_0x2fe802['uniqueid'],channels[_0x2fe802[_0x718e('0x8')]]['callerid'],_0x2fe802[_0x718e('0x32')]));channels[_0x2fe802['uniqueid']][_0x718e('0x33')]=utils[_0x718e('0x1d')]();channels[_0x2fe802['uniqueid']]['duration']=utils['diffTime'](channels[_0x2fe802[_0x718e('0x8')]][_0x718e('0x33')],channels[_0x2fe802[_0x718e('0x8')]][_0x718e('0x34')]);channels[_0x2fe802[_0x718e('0x8')]][_0x718e('0x35')]=channels[_0x2fe802[_0x718e('0x8')]][_0x718e('0x2b')]?utils[_0x718e('0x36')](channels[_0x2fe802[_0x718e('0x8')]][_0x718e('0x33')],channels[_0x2fe802[_0x718e('0x8')]][_0x718e('0x2b')]):0x0;writeDB(channels[_0x2fe802[_0x718e('0x8')]]);}}catch(_0x2340a0){utils[_0x718e('0x1f')](util[_0x718e('0xb')](_0x718e('0x2e'),_0x2fe802[_0x718e('0x8')]),_0x2340a0);}};exports[_0x718e('0x37')]=function(_0x471097){try{if(!_[_0x718e('0x23')](channels[_0x471097['localtwolinkedid']])){utils['debug'](util[_0x718e('0xb')]('[%s][calls][attendedtransfer]',_0x471097['origtransfereruniqueid']),_0x471097);if(channels[_0x471097[_0x718e('0x38')]][_0x718e('0xd')]==_0x471097[_0x718e('0x39')]){utils['info'](util[_0x718e('0xb')](_0x718e('0x3a'),_0x471097['origtransfereruniqueid'],_0x471097[_0x718e('0x38')],_0x471097[_0x718e('0x3b')]));channels[_0x471097['localtwolinkedid']][_0x718e('0x2a')]=_0x471097['secondtransfererchannel'];channels[_0x471097[_0x718e('0x38')]][_0x718e('0x3c')]=_0x718e('0x3d');}else if(channels[_0x471097['localtwolinkedid']][_0x718e('0xd')]=_0x471097['transfertargetchannel']){utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x3a'),_0x471097[_0x718e('0x3e')],_0x471097[_0x718e('0x38')],_0x471097[_0x718e('0x3f')]));channels[_0x471097['localtwolinkedid']][_0x718e('0x2a')]=_0x471097['origtransfererchannel'];channels[_0x471097[_0x718e('0x38')]][_0x718e('0x3c')]=_0x718e('0x3d');}}}catch(_0x1c1e31){utils[_0x718e('0x1f')](util[_0x718e('0xb')](_0x718e('0x40'),_0x471097['origtransfereruniqueid']),_0x1c1e31);}};exports[_0x718e('0x41')]=function(_0x3a51fe){try{if(!_[_0x718e('0x23')](channels[_0x3a51fe['uniqueid']])){utils['debug'](util[_0x718e('0xb')](_0x718e('0x42'),_0x3a51fe['uniqueid']),_0x3a51fe);channels[_0x3a51fe[_0x718e('0x8')]]['musiconholdstartAt']=utils[_0x718e('0x1d')]();utils['info'](util[_0x718e('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3a51fe[_0x718e('0x8')],channels[_0x3a51fe['uniqueid']][_0x718e('0x43')]));}}catch(_0x527b9f){utils[_0x718e('0x1f')](util[_0x718e('0xb')]('[%s][calls][musiconholdstart]',_0x3a51fe[_0x718e('0x8')]),_0x527b9f);}};exports['musiconholdstop']=function(_0x292d2c){try{if(!_[_0x718e('0x23')](channels[_0x292d2c[_0x718e('0x8')]])){utils[_0x718e('0x18')](util[_0x718e('0xb')]('[%s][calls][musiconholdstop]',_0x292d2c[_0x718e('0x8')]),_0x292d2c);if(!_[_0x718e('0x23')](channels[_0x292d2c[_0x718e('0x8')]][_0x718e('0x43')])){channels[_0x292d2c['uniqueid']][_0x718e('0x44')]+=utils['diffTime'](utils['now'](),channels[_0x292d2c[_0x718e('0x8')]][_0x718e('0x43')]);utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x45'),_0x292d2c[_0x718e('0x8')],channels[_0x292d2c['uniqueid']][_0x718e('0x44')]));delete channels[_0x292d2c[_0x718e('0x8')]][_0x718e('0x43')];}}}catch(_0x54fd65){utils[_0x718e('0x1f')](util[_0x718e('0xb')](_0x718e('0x46'),_0x292d2c[_0x718e('0x8')]),_0x54fd65);}};exports[_0x718e('0x47')]=function(_0x375c1f){try{if(!_['isNil'](channels[_0x375c1f[_0x718e('0x8')]])){utils[_0x718e('0x18')](util[_0x718e('0xb')](_0x718e('0x48'),_0x375c1f[_0x718e('0x8')]),_0x375c1f);if(!_[_0x718e('0x23')](_0x375c1f['variable'][_0x718e('0x49')])){utils[_0x718e('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x375c1f[_0x718e('0x8')],_0x375c1f[_0x718e('0x4a')]));channels[_0x375c1f[_0x718e('0x8')]][_0x718e('0x4b')]=_0x375c1f[_0x718e('0x4a')];}if(!_[_0x718e('0x23')](_0x375c1f[_0x718e('0x4c')][_0x718e('0x4d')])){utils[_0x718e('0xa')](util['format'](_0x718e('0x4e'),_0x375c1f['uniqueid'],_0x375c1f[_0x718e('0x4a')]));channels[_0x375c1f[_0x718e('0x8')]][_0x718e('0x4f')]=_0x375c1f[_0x718e('0x4a')];channels[_0x375c1f[_0x718e('0x8')]]['callerid']='\x22'+_0x375c1f[_0x718e('0x4a')]+_0x718e('0x50')+_0x375c1f[_0x718e('0x4a')]+'>';}if(!_[_0x718e('0x23')](_0x375c1f[_0x718e('0x4c')][_0x718e('0x51')])||!_['isNil'](_0x375c1f[_0x718e('0x4c')][_0x718e('0x52')])){utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x53'),_0x375c1f['uniqueid'],!_['isNil'](_0x375c1f[_0x718e('0x4c')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0x718e('0x52'),_0x375c1f[_0x718e('0x4a')]));channels[_0x375c1f[_0x718e('0x8')]][_0x718e('0x2f')]=_0x375c1f['value'];}if(!_[_0x718e('0x23')](_0x375c1f[_0x718e('0x4c')][_0x718e('0x54')])||!_[_0x718e('0x23')](_0x375c1f[_0x718e('0x4c')]['xmcs-queue'])){utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x53'),_0x375c1f['uniqueid'],!_[_0x718e('0x23')](_0x375c1f[_0x718e('0x4c')][_0x718e('0x54')])?_0x718e('0x54'):_0x718e('0x55'),_0x375c1f[_0x718e('0x4a')]));channels[_0x375c1f[_0x718e('0x8')]][_0x718e('0x56')]=_0x718e('0x57');channels[_0x375c1f['uniqueid']][_0x718e('0x58')]=_0x375c1f['value'];channels[_0x375c1f[_0x718e('0x8')]]['queue']=!![];}if(!_['isNil'](_0x375c1f[_0x718e('0x4c')][_0x718e('0x59')])){utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x5a'),_0x375c1f[_0x718e('0x8')],_0x375c1f[_0x718e('0x4a')]));channels[_0x375c1f[_0x718e('0x8')]]['ContactId']=_0x375c1f[_0x718e('0x4a')];}if(!_[_0x718e('0x23')](_0x375c1f[_0x718e('0x4c')]['xmd-cdrtype'])){utils['info'](util[_0x718e('0xb')](_0x718e('0x5b'),_0x375c1f[_0x718e('0x8')],_0x375c1f[_0x718e('0x4a')]));channels[_0x375c1f['uniqueid']][_0x718e('0x5c')]=_0x375c1f[_0x718e('0x4a')];}if(!_['isNil'](_0x375c1f['variable']['outboundrouteid'])){utils[_0x718e('0xa')](util[_0x718e('0xb')](_0x718e('0x5d'),_0x375c1f[_0x718e('0x8')],_0x375c1f[_0x718e('0x4a')]));channels[_0x375c1f[_0x718e('0x8')]][_0x718e('0x5e')]=_0x375c1f[_0x718e('0x4a')];}if(!_['isNil'](_0x375c1f[_0x718e('0x4c')][_0x718e('0x5f')])){utils[_0x718e('0xa')](util['format'](_0x718e('0x60'),_0x375c1f[_0x718e('0x8')],_0x375c1f[_0x718e('0x4a')]));channels[_0x375c1f[_0x718e('0x8')]]['sipcallid']=_0x375c1f['value'];}}}catch(_0x3d7c5e){utils[_0x718e('0x1f')](util[_0x718e('0xb')]('[%s][calls][varset]',_0x375c1f[_0x718e('0x8')]),_0x3d7c5e);}};exports['newexten']=function(_0x140dab){try{if(!_[_0x718e('0x23')](channels[_0x140dab[_0x718e('0x8')]])){utils[_0x718e('0x18')](util[_0x718e('0xb')](_0x718e('0x61'),_0x140dab[_0x718e('0x8')]),_0x140dab);utils['info'](util[_0x718e('0xb')](_0x718e('0x62'),_0x140dab['uniqueid'],_0x140dab[_0x718e('0x63')],_0x140dab[_0x718e('0x64')]));if(_0x140dab[_0x718e('0x63')][_0x718e('0x65')]()==_0x718e('0x66')&&_['startsWith'](_0x140dab[_0x718e('0x64')][_0x718e('0x65')](),_0x718e('0x67'))){var _0x480c85=_0x140dab[_0x718e('0x64')]['split']('=');var _0x46c28c=_0x480c85[0x0][_0x718e('0x68')](_0x480c85[0x0][_0x718e('0x69')]('(')+0x1,_0x480c85[0x0][_0x718e('0x69')](')'));var _0x2f2380=_0x480c85[0x1];channels[_0x140dab[_0x718e('0x8')]][_0x46c28c]=_0x2f2380;}if(!_['includes']([_0x718e('0x2d'),_0x718e('0x6a'),_0x718e('0x6b'),_0x718e('0x66'),_0x718e('0x6c')],_0x140dab[_0x718e('0x63')][_0x718e('0x65')]())){channels[_0x140dab[_0x718e('0x8')]]['lastapplication']=_0x140dab[_0x718e('0x63')];channels[_0x140dab[_0x718e('0x8')]][_0x718e('0x58')]=_0x140dab[_0x718e('0x64')];}}}catch(_0x3e052d){utils['error'](util[_0x718e('0xb')](_0x718e('0x61'),_0x140dab[_0x718e('0x8')]),_0x3e052d);}}; \ No newline at end of file +var _0x0fda=['util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','now','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x0fda,0x1c7));var _0xa0fd=function(_0x51bd82,_0x5d0144){_0x51bd82=_0x51bd82-0x0;var _0x4de192=_0x0fda[_0x51bd82];return _0x4de192;};'use strict';var _=require(_0xa0fd('0x0'));var util=require(_0xa0fd('0x1'));var utils=require(_0xa0fd('0x2'));var transfers=require(_0xa0fd('0x3'));var dispositions=[_0xa0fd('0x4'),_0xa0fd('0x5'),_0xa0fd('0x5'),_0xa0fd('0x4'),_0xa0fd('0x4'),_0xa0fd('0x4'),_0xa0fd('0x6'),_0xa0fd('0x7'),_0xa0fd('0x5'),_0xa0fd('0x5'),_0xa0fd('0x5')];var channels={};function writeDB(_0x3483cb){var _0x4d84b5;if(transfers[_0xa0fd('0x8')][_0x3483cb[_0xa0fd('0x9')]]){_0x4d84b5=_0x3483cb[_0xa0fd('0x9')];_0x3483cb[_0xa0fd('0x9')]=transfers[_0xa0fd('0x8')][_0x3483cb['uniqueid']][_0xa0fd('0xa')];}utils['info'](util[_0xa0fd('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3483cb['uniqueid'],_0x3483cb['channel'],_0x3483cb[_0xa0fd('0xc')],_0x3483cb[_0xa0fd('0xd')],_0x3483cb[_0xa0fd('0xe')],_0x3483cb[_0xa0fd('0xf')],_0x3483cb['connectedlinenum'],_0x3483cb[_0xa0fd('0x10')]));if(_0x3483cb[_0xa0fd('0x11')]){utils[_0xa0fd('0x12')](_0x3483cb[_0xa0fd('0x11')])[_0xa0fd('0x13')](function(_0x20b7db){if(_0x20b7db){_0x3483cb['UserId']=_0x20b7db['id'];}utils['request'](_0xa0fd('0x14'),_0x3483cb);});}else{utils[_0xa0fd('0x15')]('CreateVoiceCallReport',_0x3483cb);}if(channels[_0x3483cb['uniqueid']]){delete channels[_0x3483cb[_0xa0fd('0x9')]];}else if(_0x4d84b5&&channels[_0x4d84b5]){delete transfers['blinds'][_0x4d84b5];delete channels[_0x4d84b5];}}exports[_0xa0fd('0x16')]=function(_0x30b1f7){try{utils[_0xa0fd('0x17')](util[_0xa0fd('0xb')]('[%s][calls][newchannel]',_0x30b1f7[_0xa0fd('0x9')]),_0x30b1f7);if(_0x30b1f7[_0xa0fd('0x9')]==_0x30b1f7[_0xa0fd('0x18')]&&_0x30b1f7[_0xa0fd('0x19')]!=_0xa0fd('0x1a')){utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x1c'),_0x30b1f7[_0xa0fd('0x9')],_0x30b1f7[_0xa0fd('0x1d')],_0x30b1f7['exten']));channels[_0x30b1f7['uniqueid']]={'uniqueid':_0x30b1f7[_0xa0fd('0x9')],'accountcode':_0x30b1f7['accountcode'],'source':_0x30b1f7[_0xa0fd('0xf')],'destination':_0x30b1f7[_0xa0fd('0x1e')],'destinationcontext':_0x30b1f7[_0xa0fd('0x1d')],'channel':_0x30b1f7[_0xa0fd('0x19')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xa0fd('0x1f')};}}catch(_0x534393){utils['error'](util[_0xa0fd('0xb')](_0xa0fd('0x20'),_0x30b1f7[_0xa0fd('0x9')]),_0x534393);}};exports[_0xa0fd('0x21')]=function(_0x49a0f2){try{utils[_0xa0fd('0x17')](util[_0xa0fd('0xb')](_0xa0fd('0x22'),_0x49a0f2[_0xa0fd('0x9')]),_0x49a0f2);if(!_['isNil'](channels[_0x49a0f2[_0xa0fd('0x9')]])&&_0x49a0f2[_0xa0fd('0x23')]==0x6){utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x24'),_0x49a0f2[_0xa0fd('0x9')],_0x49a0f2[_0xa0fd('0x1d')],_0x49a0f2[_0xa0fd('0x19')]));if(_[_0xa0fd('0x25')](channels[_0x49a0f2[_0xa0fd('0x9')]][_0xa0fd('0x26')])){channels[_0x49a0f2['uniqueid']][_0xa0fd('0x26')]=utils['now']();}}else if(!_[_0xa0fd('0x25')](channels[_0x49a0f2[_0xa0fd('0x18')]])&&_0x49a0f2[_0xa0fd('0x23')]==0x6&&_0x49a0f2[_0xa0fd('0x1d')]!='transfer'){utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x27'),_0x49a0f2[_0xa0fd('0x9')],_0x49a0f2[_0xa0fd('0x18')],_0x49a0f2[_0xa0fd('0x1d')],_0x49a0f2[_0xa0fd('0x19')]));channels[_0x49a0f2[_0xa0fd('0x18')]][_0xa0fd('0x11')]=_0x49a0f2[_0xa0fd('0x11')];channels[_0x49a0f2[_0xa0fd('0x18')]][_0xa0fd('0x28')]=_0x49a0f2[_0xa0fd('0x19')];if(_['isNil'](channels[_0x49a0f2[_0xa0fd('0x18')]][_0xa0fd('0x29')])){channels[_0x49a0f2[_0xa0fd('0x18')]][_0xa0fd('0x29')]=utils['now']();}channels[_0x49a0f2[_0xa0fd('0x18')]][_0xa0fd('0x2a')]=dispositions[_[_0xa0fd('0x2b')](_0x49a0f2[_0xa0fd('0x23')])]||_0xa0fd('0x6');}}catch(_0x34c2f2){utils[_0xa0fd('0x2c')](util[_0xa0fd('0xb')]('[%s][calls][newstate]',_0x49a0f2['uniqueid']),_0x34c2f2);}};exports['hangup']=function(_0x4a607f){try{if(!_[_0xa0fd('0x25')](channels[_0x4a607f[_0xa0fd('0x9')]])){utils[_0xa0fd('0x17')](util[_0xa0fd('0xb')]('[%s][calls][hangup]',_0x4a607f['uniqueid']),_0x4a607f);if(_[_0xa0fd('0x25')](channels[_0x4a607f[_0xa0fd('0x9')]][_0xa0fd('0x2d')])){channels[_0x4a607f[_0xa0fd('0x9')]]['callerid']=_0x4a607f[_0xa0fd('0x2e')]+'\x20<'+_0x4a607f[_0xa0fd('0xf')]+'>';}utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x2f'),_0x4a607f['uniqueid'],channels[_0x4a607f[_0xa0fd('0x9')]][_0xa0fd('0x2d')],_0x4a607f[_0xa0fd('0x30')]));channels[_0x4a607f[_0xa0fd('0x9')]][_0xa0fd('0x31')]=utils[_0xa0fd('0x32')]();channels[_0x4a607f[_0xa0fd('0x9')]][_0xa0fd('0x33')]=utils[_0xa0fd('0x34')](channels[_0x4a607f[_0xa0fd('0x9')]]['endtime'],channels[_0x4a607f[_0xa0fd('0x9')]][_0xa0fd('0x35')]);channels[_0x4a607f[_0xa0fd('0x9')]][_0xa0fd('0x36')]=channels[_0x4a607f[_0xa0fd('0x9')]][_0xa0fd('0x29')]?utils['diffTime'](channels[_0x4a607f['uniqueid']][_0xa0fd('0x31')],channels[_0x4a607f[_0xa0fd('0x9')]]['answertime']):0x0;writeDB(channels[_0x4a607f[_0xa0fd('0x9')]]);}}catch(_0xd5080){utils['error'](util[_0xa0fd('0xb')](_0xa0fd('0x37'),_0x4a607f[_0xa0fd('0x9')]),_0xd5080);}};exports[_0xa0fd('0x38')]=function(_0x3f6485){try{if(!_[_0xa0fd('0x25')](channels[_0x3f6485[_0xa0fd('0x39')]])){utils[_0xa0fd('0x17')](util['format'](_0xa0fd('0x3a'),_0x3f6485[_0xa0fd('0x3b')]),_0x3f6485);if(channels[_0x3f6485['localtwolinkedid']]['channel']==_0x3f6485[_0xa0fd('0x3c')]){utils['info'](util[_0xa0fd('0xb')](_0xa0fd('0x3d'),_0x3f6485['origtransfereruniqueid'],_0x3f6485['localtwolinkedid'],_0x3f6485[_0xa0fd('0x3e')]));channels[_0x3f6485[_0xa0fd('0x39')]][_0xa0fd('0x28')]=_0x3f6485['secondtransfererchannel'];channels[_0x3f6485[_0xa0fd('0x39')]][_0xa0fd('0x3f')]=_0xa0fd('0x40');}else if(channels[_0x3f6485[_0xa0fd('0x39')]][_0xa0fd('0x19')]=_0x3f6485[_0xa0fd('0x41')]){utils['info'](util[_0xa0fd('0xb')](_0xa0fd('0x3d'),_0x3f6485[_0xa0fd('0x3b')],_0x3f6485[_0xa0fd('0x39')],_0x3f6485[_0xa0fd('0x42')]));channels[_0x3f6485[_0xa0fd('0x39')]][_0xa0fd('0x28')]=_0x3f6485[_0xa0fd('0x42')];channels[_0x3f6485[_0xa0fd('0x39')]][_0xa0fd('0x3f')]=_0xa0fd('0x40');}}}catch(_0x4889a3){utils['error'](util['format']('[%s][calls][attendedtransfer]',_0x3f6485[_0xa0fd('0x3b')]),_0x4889a3);}};exports[_0xa0fd('0x43')]=function(_0x26ea96){try{if(!_[_0xa0fd('0x25')](channels[_0x26ea96[_0xa0fd('0x9')]])){utils[_0xa0fd('0x17')](util[_0xa0fd('0xb')](_0xa0fd('0x44'),_0x26ea96[_0xa0fd('0x9')]),_0x26ea96);channels[_0x26ea96[_0xa0fd('0x9')]]['musiconholdstartAt']=utils['now']();utils[_0xa0fd('0x1b')](util['format'](_0xa0fd('0x45'),_0x26ea96['uniqueid'],channels[_0x26ea96[_0xa0fd('0x9')]][_0xa0fd('0x46')]));}}catch(_0x2da259){utils[_0xa0fd('0x2c')](util['format']('[%s][calls][musiconholdstart]',_0x26ea96[_0xa0fd('0x9')]),_0x2da259);}};exports[_0xa0fd('0x47')]=function(_0x1758c7){try{if(!_[_0xa0fd('0x25')](channels[_0x1758c7[_0xa0fd('0x9')]])){utils[_0xa0fd('0x17')](util[_0xa0fd('0xb')]('[%s][calls][musiconholdstop]',_0x1758c7['uniqueid']),_0x1758c7);if(!_[_0xa0fd('0x25')](channels[_0x1758c7[_0xa0fd('0x9')]][_0xa0fd('0x46')])){channels[_0x1758c7[_0xa0fd('0x9')]][_0xa0fd('0x48')]+=utils[_0xa0fd('0x34')](utils[_0xa0fd('0x32')](),channels[_0x1758c7[_0xa0fd('0x9')]][_0xa0fd('0x46')]);utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x49'),_0x1758c7['uniqueid'],channels[_0x1758c7[_0xa0fd('0x9')]]['mohtime']));delete channels[_0x1758c7['uniqueid']][_0xa0fd('0x46')];}}}catch(_0x231832){utils['error'](util['format'](_0xa0fd('0x4a'),_0x1758c7['uniqueid']),_0x231832);}};exports[_0xa0fd('0x4b')]=function(_0x33beba){try{if(!_[_0xa0fd('0x25')](channels[_0x33beba['uniqueid']])){utils['debug'](util['format'](_0xa0fd('0x4c'),_0x33beba['uniqueid']),_0x33beba);if(!_[_0xa0fd('0x25')](_0x33beba['variable'][_0xa0fd('0x4d')])){utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x4e'),_0x33beba['uniqueid'],_0x33beba['value']));channels[_0x33beba['uniqueid']][_0xa0fd('0x4f')]=_0x33beba[_0xa0fd('0x50')];}if(!_['isNil'](_0x33beba[_0xa0fd('0x51')][_0xa0fd('0x52')])){utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x33beba[_0xa0fd('0x9')],_0x33beba[_0xa0fd('0x50')]));channels[_0x33beba[_0xa0fd('0x9')]][_0xa0fd('0x53')]=_0x33beba[_0xa0fd('0x50')];channels[_0x33beba[_0xa0fd('0x9')]]['callerid']='\x22'+_0x33beba['value']+'\x22\x20<'+_0x33beba['value']+'>';}if(!_['isNil'](_0x33beba[_0xa0fd('0x51')][_0xa0fd('0x54')])||!_['isNil'](_0x33beba[_0xa0fd('0x51')][_0xa0fd('0x55')])){utils['info'](util['format'](_0xa0fd('0x56'),_0x33beba[_0xa0fd('0x9')],!_[_0xa0fd('0x25')](_0x33beba[_0xa0fd('0x51')][_0xa0fd('0x54')])?_0xa0fd('0x54'):'xmd-callerid',_0x33beba['value']));channels[_0x33beba[_0xa0fd('0x9')]][_0xa0fd('0x2d')]=_0x33beba[_0xa0fd('0x50')];}if(!_['isNil'](_0x33beba[_0xa0fd('0x51')][_0xa0fd('0x57')])||!_['isNil'](_0x33beba[_0xa0fd('0x51')][_0xa0fd('0x58')])){utils[_0xa0fd('0x1b')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x33beba[_0xa0fd('0x9')],!_[_0xa0fd('0x25')](_0x33beba[_0xa0fd('0x51')]['xmd-queue'])?'xmd-queue':_0xa0fd('0x58'),_0x33beba[_0xa0fd('0x50')]));channels[_0x33beba[_0xa0fd('0x9')]][_0xa0fd('0x59')]='Queue';channels[_0x33beba['uniqueid']]['lastdata']=_0x33beba['value'];channels[_0x33beba[_0xa0fd('0x9')]]['queue']=!![];}if(!_['isNil'](_0x33beba['variable']['xmd-contactid'])){utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x5a'),_0x33beba['uniqueid'],_0x33beba['value']));channels[_0x33beba['uniqueid']]['ContactId']=_0x33beba[_0xa0fd('0x50')];}if(!_[_0xa0fd('0x25')](_0x33beba[_0xa0fd('0x51')][_0xa0fd('0x5b')])){utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x5c'),_0x33beba[_0xa0fd('0x9')],_0x33beba[_0xa0fd('0x50')]));channels[_0x33beba[_0xa0fd('0x9')]][_0xa0fd('0x5d')]=_0x33beba[_0xa0fd('0x50')];}if(!_[_0xa0fd('0x25')](_0x33beba[_0xa0fd('0x51')][_0xa0fd('0x5e')])){utils[_0xa0fd('0x1b')](util['format'](_0xa0fd('0x5f'),_0x33beba[_0xa0fd('0x9')],_0x33beba[_0xa0fd('0x50')]));channels[_0x33beba[_0xa0fd('0x9')]][_0xa0fd('0x60')]=_0x33beba[_0xa0fd('0x50')];}if(!_[_0xa0fd('0x25')](_0x33beba[_0xa0fd('0x51')]['sipcallid'])){utils[_0xa0fd('0x1b')](util[_0xa0fd('0xb')](_0xa0fd('0x61'),_0x33beba[_0xa0fd('0x9')],_0x33beba[_0xa0fd('0x50')]));channels[_0x33beba['uniqueid']][_0xa0fd('0x62')]=_0x33beba['value'];}}}catch(_0x7f71b0){utils[_0xa0fd('0x2c')](util['format'](_0xa0fd('0x4c'),_0x33beba[_0xa0fd('0x9')]),_0x7f71b0);}};exports[_0xa0fd('0x63')]=function(_0x36cba6){try{if(!_[_0xa0fd('0x25')](channels[_0x36cba6[_0xa0fd('0x9')]])){utils['debug'](util[_0xa0fd('0xb')](_0xa0fd('0x64'),_0x36cba6['uniqueid']),_0x36cba6);utils['info'](util[_0xa0fd('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x36cba6[_0xa0fd('0x9')],_0x36cba6[_0xa0fd('0x65')],_0x36cba6['appdata']));if(_0x36cba6['application'][_0xa0fd('0x66')]()==_0xa0fd('0x67')&&_[_0xa0fd('0x68')](_0x36cba6[_0xa0fd('0x69')][_0xa0fd('0x66')](),_0xa0fd('0x6a'))){var _0x5b6ad5=_0x36cba6['appdata']['split']('=');var _0xfbed7a=_0x5b6ad5[0x0][_0xa0fd('0x6b')](_0x5b6ad5[0x0][_0xa0fd('0x6c')]('(')+0x1,_0x5b6ad5[0x0][_0xa0fd('0x6c')](')'));var _0x2723ee=_0x5b6ad5[0x1];channels[_0x36cba6[_0xa0fd('0x9')]][_0xfbed7a]=_0x2723ee;}if(!_[_0xa0fd('0x6d')](['hangup',_0xa0fd('0x6e'),_0xa0fd('0x6f'),_0xa0fd('0x67'),_0xa0fd('0x70')],_0x36cba6['application']['toLowerCase']())){channels[_0x36cba6[_0xa0fd('0x9')]]['lastapplication']=_0x36cba6[_0xa0fd('0x65')];channels[_0x36cba6[_0xa0fd('0x9')]][_0xa0fd('0x71')]=_0x36cba6[_0xa0fd('0x69')];}}}catch(_0x3ff640){utils[_0xa0fd('0x2c')](util['format'](_0xa0fd('0x64'),_0x36cba6[_0xa0fd('0x9')]),_0x3ff640);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3190a1b..fca50bf 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 _0x9dcc=['[core]\x20error','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','fullybooted'];(function(_0x51e2cb,_0x148c10){var _0x4fc6e3=function(_0x5e257e){while(--_0x5e257e){_0x51e2cb['push'](_0x51e2cb['shift']());}};_0x4fc6e3(++_0x148c10);}(_0x9dcc,0x103));var _0xc9dc=function(_0x1348e5,_0x1e9c93){_0x1348e5=_0x1348e5-0x0;var _0x3ae8af=_0x9dcc[_0x1348e5];return _0x3ae8af;};'use strict';var utils=require('./utils');exports[_0xc9dc('0x0')]=function(){utils[_0xc9dc('0x1')](_0xc9dc('0x2'));};exports[_0xc9dc('0x3')]=function(){utils[_0xc9dc('0x1')]('[core]\x20shutdown');};exports[_0xc9dc('0x4')]=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0x1a8b56){utils['error'](_0xc9dc('0x5'),_0x1a8b56);};exports['close']=function(){utils[_0xc9dc('0x1')](_0xc9dc('0x6'));};exports[_0xc9dc('0x7')]=function(_0x20b0d7){}; \ No newline at end of file +var _0x5c9d=['[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5c9d,0x192));var _0xd5c9=function(_0x40a107,_0x5acc82){_0x40a107=_0x40a107-0x0;var _0x4beb59=_0x5c9d[_0x40a107];return _0x4beb59;};'use strict';var utils=require(_0xd5c9('0x0'));exports[_0xd5c9('0x1')]=function(){utils[_0xd5c9('0x2')](_0xd5c9('0x3'));};exports['shutdown']=function(){utils[_0xd5c9('0x2')](_0xd5c9('0x4'));};exports[_0xd5c9('0x5')]=function(){utils['info'](_0xd5c9('0x6'));};exports['error']=function(_0x592049){utils[_0xd5c9('0x7')](_0xd5c9('0x8'),_0x592049);};exports[_0xd5c9('0x9')]=function(){utils['info'](_0xd5c9('0xa'));};exports[_0xd5c9('0xb')]=function(_0x3fc140){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 5b3af1e..ab0de51 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 _0x7820=['CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','request'];(function(_0x541b45,_0x3bc9de){var _0x1c1ce9=function(_0x2e5334){while(--_0x2e5334){_0x541b45['push'](_0x541b45['shift']());}};_0x1c1ce9(++_0x3bc9de);}(_0x7820,0x96));var _0x0782=function(_0x25badc,_0xf437fd){_0x25badc=_0x25badc-0x0;var _0x1eb093=_0x7820[_0x25badc];return _0x1eb093;};'use strict';var _=require(_0x0782('0x0'));var util=require(_0x0782('0x1'));var utils=require(_0x0782('0x2'));var dials={};function writeDB(_0x3fc134){utils['info'](util['format'](_0x0782('0x3'),_0x3fc134[_0x0782('0x4')],_0x3fc134[_0x0782('0x5')],_0x3fc134['dialstring'],_0x3fc134[_0x0782('0x6')],_0x3fc134[_0x0782('0x7')],_0x3fc134['dialstatus']));utils[_0x0782('0x8')](_0x0782('0x9'),_0x3fc134);delete dials[_0x3fc134['uniqueid']];}exports[_0x0782('0xa')]=function(_0x1d45ab){try{utils[_0x0782('0xb')](util[_0x0782('0xc')](_0x0782('0xd'),_0x1d45ab['uniqueid']),_0x1d45ab);utils[_0x0782('0xe')](util['format'](_0x0782('0xf'),_0x1d45ab[_0x0782('0x4')],_0x1d45ab['application'],_0x1d45ab[_0x0782('0x10')]));if(_0x1d45ab[_0x0782('0x11')][_0x0782('0x12')]()==_0x0782('0x13')&&_[_0x0782('0x14')](_0x1d45ab[_0x0782('0x10')][_0x0782('0x12')](),_0x0782('0x15'))){var _0x484763=_0x1d45ab['appdata'][_0x0782('0x16')]('=');dials[_0x1d45ab[_0x0782('0x4')]]={'routeId':_0x484763[0x1]};}}catch(_0x6f4bee){utils[_0x0782('0x17')](util[_0x0782('0xc')]('[%s][dials][newexten]',_0x1d45ab['uniqueid']),_0x6f4bee);}};exports[_0x0782('0x18')]=function(_0x4bc4b8){try{utils['debug'](util['format']('[%s][dials][varset]',_0x4bc4b8[_0x0782('0x4')]),_0x4bc4b8);if(!_[_0x0782('0x19')](_0x4bc4b8[_0x0782('0x1a')][_0x0782('0x1b')])){utils['info'](util[_0x0782('0xc')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x4bc4b8['uniqueid'],_0x4bc4b8[_0x0782('0x1c')]));dials[_0x4bc4b8[_0x0782('0x4')]]={'routeId':_0x4bc4b8['value']};}}catch(_0x1aa338){utils[_0x0782('0x17')](util[_0x0782('0xc')](_0x0782('0x1d'),_0x4bc4b8[_0x0782('0x4')]),_0x1aa338);}};exports[_0x0782('0x1e')]=function(_0x1e651e){try{if(!_[_0x0782('0x19')](dials[_0x1e651e['uniqueid']])){utils['debug'](util[_0x0782('0xc')](_0x0782('0x1f'),_0x1e651e[_0x0782('0x4')]),_0x1e651e);dials[_0x1e651e[_0x0782('0x4')]]=_[_0x0782('0x20')](dials[_0x1e651e[_0x0782('0x4')]],_0x1e651e);dials[_0x1e651e[_0x0782('0x4')]]['starttime']=utils[_0x0782('0x21')]();dials[_0x1e651e[_0x0782('0x4')]][_0x0782('0x22')]=_0x0782('0x23');utils[_0x0782('0xe')](util[_0x0782('0xc')](_0x0782('0x24'),_0x1e651e[_0x0782('0x4')],dials[_0x1e651e['uniqueid']][_0x0782('0x25')]));}}catch(_0x552734){utils['error'](util['format'](_0x0782('0x1f'),_0x1e651e['uniqueid']),_0x552734);}};exports['dialend']=function(_0x80abe7){try{if(!_[_0x0782('0x19')](dials[_0x80abe7['uniqueid']])){utils['debug'](util['format'](_0x0782('0x26'),_0x80abe7[_0x0782('0x4')]),_0x80abe7);dials[_0x80abe7[_0x0782('0x4')]][_0x0782('0x27')]=_0x80abe7[_0x0782('0x27')];if(_0x80abe7['dialstatus']=='ANSWER'){dials[_0x80abe7[_0x0782('0x4')]]=_[_0x0782('0x20')](dials[_0x80abe7['uniqueid']],_0x80abe7);dials[_0x80abe7[_0x0782('0x4')]][_0x0782('0x28')]=utils[_0x0782('0x21')]();dials[_0x80abe7[_0x0782('0x4')]][_0x0782('0x22')]=_0x0782('0x29');utils[_0x0782('0xe')](util[_0x0782('0xc')](_0x0782('0x2a'),_0x80abe7[_0x0782('0x4')],_0x80abe7[_0x0782('0x27')],dials[_0x80abe7['uniqueid']][_0x0782('0x28')]));}else{utils[_0x0782('0xe')](util[_0x0782('0xc')](_0x0782('0x2b'),_0x80abe7[_0x0782('0x4')],_0x80abe7[_0x0782('0x27')]));}}}catch(_0x496580){utils[_0x0782('0x17')](util['format']('[%s][dials][dialend]',_0x80abe7[_0x0782('0x4')]),_0x496580);}};exports[_0x0782('0x2c')]=function(_0x5c8b04){try{if(!_[_0x0782('0x19')](dials[_0x5c8b04['uniqueid']])){utils[_0x0782('0xb')](util[_0x0782('0xc')](_0x0782('0x2d'),_0x5c8b04[_0x0782('0x4')]),_0x5c8b04);utils['info'](util[_0x0782('0xc')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x5c8b04[_0x0782('0x4')],_0x5c8b04[_0x0782('0x6')],_0x5c8b04[_0x0782('0x2e')],_0x5c8b04[_0x0782('0x2f')]));dials[_0x5c8b04[_0x0782('0x4')]]=_['assign'](dials[_0x5c8b04['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x0782('0x30')});dials[_0x5c8b04['uniqueid']][_0x0782('0x31')]=utils[_0x0782('0x32')](dials[_0x5c8b04['uniqueid']]['endtime'],dials[_0x5c8b04[_0x0782('0x4')]][_0x0782('0x25')]);dials[_0x5c8b04[_0x0782('0x4')]][_0x0782('0x33')]=utils[_0x0782('0x32')](dials[_0x5c8b04[_0x0782('0x4')]][_0x0782('0x28')]||dials[_0x5c8b04[_0x0782('0x4')]]['endtime'],dials[_0x5c8b04[_0x0782('0x4')]]['starttime']);dials[_0x5c8b04[_0x0782('0x4')]]['billableseconds']=dials[_0x5c8b04[_0x0782('0x4')]][_0x0782('0x28')]?utils[_0x0782('0x32')](dials[_0x5c8b04[_0x0782('0x4')]][_0x0782('0x34')],dials[_0x5c8b04[_0x0782('0x4')]][_0x0782('0x28')]):0x0;writeDB(dials[_0x5c8b04[_0x0782('0x4')]]);}}catch(_0x29e030){utils[_0x0782('0x17')](util[_0x0782('0xc')](_0x0782('0x2d'),_0x5c8b04['uniqueid']),_0x29e030);}}; \ No newline at end of file +var _0x72fd=['startsWith','cdr(routeid)','split','error','varset','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','[%s][dials][varset]','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x72fd,0x1b0));var _0xd72f=function(_0x4a7fc0,_0x263424){_0x4a7fc0=_0x4a7fc0-0x0;var _0x40f0f6=_0x72fd[_0x4a7fc0];return _0x40f0f6;};'use strict';var _=require(_0xd72f('0x0'));var util=require(_0xd72f('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x4351ee){utils['info'](util[_0xd72f('0x2')](_0xd72f('0x3'),_0x4351ee[_0xd72f('0x4')],_0x4351ee[_0xd72f('0x5')],_0x4351ee[_0xd72f('0x6')],_0x4351ee[_0xd72f('0x7')],_0x4351ee['connectedlinenum'],_0x4351ee['dialstatus']));utils['request'](_0xd72f('0x8'),_0x4351ee);delete dials[_0x4351ee[_0xd72f('0x4')]];}exports[_0xd72f('0x9')]=function(_0xad8ccd){try{utils[_0xd72f('0xa')](util[_0xd72f('0x2')](_0xd72f('0xb'),_0xad8ccd[_0xd72f('0x4')]),_0xad8ccd);utils[_0xd72f('0xc')](util[_0xd72f('0x2')](_0xd72f('0xd'),_0xad8ccd[_0xd72f('0x4')],_0xad8ccd[_0xd72f('0xe')],_0xad8ccd[_0xd72f('0xf')]));if(_0xad8ccd[_0xd72f('0xe')][_0xd72f('0x10')]()==_0xd72f('0x11')&&_[_0xd72f('0x12')](_0xad8ccd[_0xd72f('0xf')][_0xd72f('0x10')](),_0xd72f('0x13'))){var _0x3aa7a5=_0xad8ccd[_0xd72f('0xf')][_0xd72f('0x14')]('=');dials[_0xad8ccd[_0xd72f('0x4')]]={'routeId':_0x3aa7a5[0x1]};}}catch(_0x510544){utils[_0xd72f('0x15')](util['format']('[%s][dials][newexten]',_0xad8ccd['uniqueid']),_0x510544);}};exports[_0xd72f('0x16')]=function(_0x1f94fb){try{utils[_0xd72f('0xa')](util[_0xd72f('0x2')]('[%s][dials][varset]',_0x1f94fb[_0xd72f('0x4')]),_0x1f94fb);if(!_['isNil'](_0x1f94fb[_0xd72f('0x17')][_0xd72f('0x18')])){utils['info'](util[_0xd72f('0x2')](_0xd72f('0x19'),_0x1f94fb[_0xd72f('0x4')],_0x1f94fb['value']));dials[_0x1f94fb[_0xd72f('0x4')]]={'routeId':_0x1f94fb['value']};}}catch(_0x4a1050){utils['error'](util['format'](_0xd72f('0x1a'),_0x1f94fb[_0xd72f('0x4')]),_0x4a1050);}};exports[_0xd72f('0x1b')]=function(_0x4a5d8a){try{if(!_[_0xd72f('0x1c')](dials[_0x4a5d8a[_0xd72f('0x4')]])){utils[_0xd72f('0xa')](util['format'](_0xd72f('0x1d'),_0x4a5d8a[_0xd72f('0x4')]),_0x4a5d8a);dials[_0x4a5d8a[_0xd72f('0x4')]]=_[_0xd72f('0x1e')](dials[_0x4a5d8a['uniqueid']],_0x4a5d8a);dials[_0x4a5d8a[_0xd72f('0x4')]][_0xd72f('0x1f')]=utils[_0xd72f('0x20')]();dials[_0x4a5d8a[_0xd72f('0x4')]][_0xd72f('0x21')]='called';utils[_0xd72f('0xc')](util[_0xd72f('0x2')](_0xd72f('0x22'),_0x4a5d8a[_0xd72f('0x4')],dials[_0x4a5d8a[_0xd72f('0x4')]]['starttime']));}}catch(_0x1d0512){utils['error'](util[_0xd72f('0x2')](_0xd72f('0x1d'),_0x4a5d8a[_0xd72f('0x4')]),_0x1d0512);}};exports[_0xd72f('0x23')]=function(_0x2351a0){try{if(!_['isNil'](dials[_0x2351a0[_0xd72f('0x4')]])){utils['debug'](util[_0xd72f('0x2')](_0xd72f('0x24'),_0x2351a0[_0xd72f('0x4')]),_0x2351a0);dials[_0x2351a0[_0xd72f('0x4')]]['dialstatus']=_0x2351a0[_0xd72f('0x25')];if(_0x2351a0[_0xd72f('0x25')]==_0xd72f('0x26')){dials[_0x2351a0[_0xd72f('0x4')]]=_[_0xd72f('0x1e')](dials[_0x2351a0[_0xd72f('0x4')]],_0x2351a0);dials[_0x2351a0[_0xd72f('0x4')]][_0xd72f('0x27')]=utils[_0xd72f('0x20')]();dials[_0x2351a0['uniqueid']][_0xd72f('0x21')]='connect';utils['info'](util[_0xd72f('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x2351a0[_0xd72f('0x4')],_0x2351a0['dialstatus'],dials[_0x2351a0[_0xd72f('0x4')]][_0xd72f('0x27')]));}else{utils[_0xd72f('0xc')](util[_0xd72f('0x2')](_0xd72f('0x28'),_0x2351a0[_0xd72f('0x4')],_0x2351a0[_0xd72f('0x25')]));}}}catch(_0x407011){utils['error'](util[_0xd72f('0x2')](_0xd72f('0x24'),_0x2351a0[_0xd72f('0x4')]),_0x407011);}};exports[_0xd72f('0x29')]=function(_0x2c54ee){try{if(!_[_0xd72f('0x1c')](dials[_0x2c54ee[_0xd72f('0x4')]])){utils[_0xd72f('0xa')](util['format'](_0xd72f('0x2a'),_0x2c54ee[_0xd72f('0x4')]),_0x2c54ee);utils[_0xd72f('0xc')](util[_0xd72f('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2c54ee['uniqueid'],_0x2c54ee[_0xd72f('0x7')],_0x2c54ee[_0xd72f('0x2b')],_0x2c54ee[_0xd72f('0x2c')]));dials[_0x2c54ee[_0xd72f('0x4')]]=_[_0xd72f('0x1e')](dials[_0x2c54ee[_0xd72f('0x4')]],{'endtime':utils[_0xd72f('0x20')](),'lastevent':_0xd72f('0x2d')});dials[_0x2c54ee['uniqueid']]['duration']=utils[_0xd72f('0x2e')](dials[_0x2c54ee[_0xd72f('0x4')]][_0xd72f('0x2f')],dials[_0x2c54ee[_0xd72f('0x4')]]['starttime']);dials[_0x2c54ee['uniqueid']][_0xd72f('0x30')]=utils[_0xd72f('0x2e')](dials[_0x2c54ee[_0xd72f('0x4')]][_0xd72f('0x27')]||dials[_0x2c54ee[_0xd72f('0x4')]][_0xd72f('0x2f')],dials[_0x2c54ee[_0xd72f('0x4')]][_0xd72f('0x1f')]);dials[_0x2c54ee[_0xd72f('0x4')]][_0xd72f('0x31')]=dials[_0x2c54ee[_0xd72f('0x4')]][_0xd72f('0x27')]?utils['diffTime'](dials[_0x2c54ee['uniqueid']][_0xd72f('0x2f')],dials[_0x2c54ee['uniqueid']][_0xd72f('0x27')]):0x0;writeDB(dials[_0x2c54ee['uniqueid']]);}}catch(_0x2c15ae){utils[_0xd72f('0x15')](util['format'](_0xd72f('0x2a'),_0x2c54ee[_0xd72f('0x4')]),_0x2c15ae);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 56eaace..7673d4a 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 _0xd455=['[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0xd455,0x13c));var _0x5d45=function(_0x29291e,_0x3b5334){_0x29291e=_0x29291e-0x0;var _0x95e8cf=_0xd455[_0x29291e];return _0x95e8cf;};var AsteriskManager=require(_0x5d45('0x0'));var config=require(_0x5d45('0x1'));var utils=require(_0x5d45('0x2'));var util=require(_0x5d45('0x3'));var ami=new AsteriskManager(config[_0x5d45('0x4')][_0x5d45('0x5')],config[_0x5d45('0x4')]['ip'],config[_0x5d45('0x4')][_0x5d45('0x6')],config['asterisk'][_0x5d45('0x7')],!![]);ami[_0x5d45('0x8')]();if(config[_0x5d45('0x9')]&&config[_0x5d45('0x9')][_0x5d45('0xa')]){utils['info'](_0x5d45('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0x5d45('0xc'));var queues=require(_0x5d45('0xd'));var recordings=require(_0x5d45('0xe'));var members=require(_0x5d45('0xf'));var dials=require(_0x5d45('0x10'));var transfers=require(_0x5d45('0x11'));var core=require(_0x5d45('0x12'));ami['on'](_0x5d45('0x13'),core[_0x5d45('0x13')]);ami['on'](_0x5d45('0x14'),core[_0x5d45('0x14')]);ami['on'](_0x5d45('0x15'),core[_0x5d45('0x15')]);ami['on']('error',core[_0x5d45('0x16')]);ami['on'](_0x5d45('0x17'),core[_0x5d45('0x17')]);ami['on'](_0x5d45('0x18'),core['managerevent']);ami['on'](_0x5d45('0x19'),function(_0x1ff3e4){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')](_0x5d45('0x1c'),_0x1ff3e4[_0x5d45('0x1d')]),_0x1ff3e4);members[_0x5d45('0x19')](_0x1ff3e4);}catch(_0x5de83b){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')]('[%s][index][devicestatechange]',_0x1ff3e4[_0x5d45('0x1d')]),_0x5de83b);}});ami['on'](_0x5d45('0x1e'),function(_0x16e1e0){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')]('[%s][index][agentcalled]',_0x16e1e0[_0x5d45('0x1f')]),_0x16e1e0);agents['agentcalled'](_0x16e1e0);}catch(_0x4bccc9){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')](_0x5d45('0x20'),_0x16e1e0[_0x5d45('0x1f')]),_0x4bccc9);}});ami['on'](_0x5d45('0x21'),function(_0x57381a){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')](_0x5d45('0x22'),_0x57381a['uniqueid']),_0x57381a);agents[_0x5d45('0x21')](_0x57381a);}catch(_0x5d6bcf){utils['error'](util[_0x5d45('0x1b')](_0x5d45('0x22'),_0x57381a[_0x5d45('0x1f')]),_0x5d6bcf);}});ami['on'](_0x5d45('0x23'),function(_0x18bba3){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')](_0x5d45('0x24'),_0x18bba3['uniqueid']),_0x18bba3);agents[_0x5d45('0x23')](_0x18bba3);queues[_0x5d45('0x23')](_0x18bba3);}catch(_0x2e2a73){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')](_0x5d45('0x24'),_0x18bba3[_0x5d45('0x1f')]),_0x2e2a73);}});ami['on']('agentcomplete',function(_0x10fad8){try{utils[_0x5d45('0x1a')](util['format'](_0x5d45('0x25'),_0x10fad8[_0x5d45('0x1f')]),_0x10fad8);agents[_0x5d45('0x26')](_0x10fad8);queues[_0x5d45('0x26')](_0x10fad8);members[_0x5d45('0x26')](_0x10fad8);}catch(_0x16e618){utils['error'](util[_0x5d45('0x1b')](_0x5d45('0x25'),_0x10fad8[_0x5d45('0x1f')]),_0x16e618);}});ami['on'](_0x5d45('0x27'),function(_0x1b5603){try{utils['debug'](util[_0x5d45('0x1b')]('[%s][index][queuecallerabandon]',_0x1b5603[_0x5d45('0x1f')]),_0x1b5603);agents[_0x5d45('0x27')](_0x1b5603);queues[_0x5d45('0x27')](_0x1b5603);}catch(_0x4741df){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')]('[%s][index][queuecallerabandon]',_0x1b5603[_0x5d45('0x1f')]),_0x4741df);}});ami['on'](_0x5d45('0x28'),function(_0xb9d019){try{utils['debug'](util['format'](_0x5d45('0x29'),_0xb9d019[_0x5d45('0x1f')]),_0xb9d019);queues[_0x5d45('0x28')](_0xb9d019);recordings[_0x5d45('0x28')](_0xb9d019);}catch(_0x3a985c){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')]('[%s][index][queuecallerjoin]',_0xb9d019[_0x5d45('0x1f')]),_0x3a985c);}});ami['on'](_0x5d45('0x2a'),function(_0x5c6118){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')](_0x5d45('0x2b'),_0x5c6118['uniqueid']),_0x5c6118);queues[_0x5d45('0x2a')](_0x5c6118);}catch(_0x3fccf2){utils[_0x5d45('0x16')](util['format'](_0x5d45('0x2b'),_0x5c6118[_0x5d45('0x1f')]),_0x3fccf2);}});ami['on'](_0x5d45('0x2c'),function(_0x75f2d6){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')](_0x5d45('0x2d'),_0x75f2d6['uniqueid']),_0x75f2d6);queues[_0x5d45('0x2c')](_0x75f2d6);calls[_0x5d45('0x2c')](_0x75f2d6);}catch(_0x458fe8){utils[_0x5d45('0x16')](util['format'](_0x5d45('0x2d'),_0x75f2d6['uniqueid']),_0x458fe8);}});ami['on'](_0x5d45('0x2e'),function(_0x45f545){try{utils[_0x5d45('0x1a')](util['format'](_0x5d45('0x2f'),_0x45f545[_0x5d45('0x1f')]),_0x45f545);queues[_0x5d45('0x2e')](_0x45f545);calls[_0x5d45('0x2e')](_0x45f545);}catch(_0x860d2f){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')](_0x5d45('0x2f'),_0x45f545[_0x5d45('0x1f')]),_0x860d2f);}});ami['on'](_0x5d45('0x30'),function(_0x75b584){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')](_0x5d45('0x31'),_0x75b584['uniqueid']),_0x75b584);calls[_0x5d45('0x30')](_0x75b584);recordings['newstate'](_0x75b584);}catch(_0x192532){utils[_0x5d45('0x16')](util['format']('[%s][index][newstate]',_0x75b584[_0x5d45('0x1f')]),_0x192532);}});ami['on'](_0x5d45('0x32'),function(_0x20e556){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')]('[%s][index][hangup]',_0x20e556[_0x5d45('0x1f')]),_0x20e556);calls[_0x5d45('0x32')](_0x20e556);recordings[_0x5d45('0x32')](_0x20e556);dials['hangup'](_0x20e556);agents['hangup'](_0x20e556);queues[_0x5d45('0x32')](_0x20e556);}catch(_0xe589d3){utils['error'](util[_0x5d45('0x1b')](_0x5d45('0x33'),_0x20e556['uniqueid']),_0xe589d3);}});ami['on']('cdr',function(_0x23a784){try{utils['debug'](util[_0x5d45('0x1b')](_0x5d45('0x34'),_0x23a784[_0x5d45('0x1f')]),_0x23a784);members[_0x5d45('0x35')](_0x23a784);}catch(_0x5a7475){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')](_0x5d45('0x34'),_0x23a784['uniqueid']),_0x5a7475);}});ami['on'](_0x5d45('0x36'),function(_0x225ef3){try{utils[_0x5d45('0x1a')](util['format'](_0x5d45('0x37'),_0x225ef3[_0x5d45('0x1f')]),_0x225ef3);queues[_0x5d45('0x36')](_0x225ef3);agents['blindtransfer'](_0x225ef3);transfers[_0x5d45('0x36')](_0x225ef3);}catch(_0x4c203f){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')](_0x5d45('0x37'),_0x225ef3[_0x5d45('0x1f')]),_0x4c203f);}});ami['on']('attendedtransfer',function(_0x4b0835){try{utils[_0x5d45('0x1a')](util['format'](_0x5d45('0x38'),_0x4b0835[_0x5d45('0x39')]),_0x4b0835);queues['attendedtransfer'](_0x4b0835);transfers[_0x5d45('0x3a')](_0x4b0835);agents[_0x5d45('0x3a')](_0x4b0835);calls['attendedtransfer'](_0x4b0835);}catch(_0xfcab65){utils[_0x5d45('0x16')](util[_0x5d45('0x1b')]('[%s][index][attendedtransfer]',_0x4b0835[_0x5d45('0x39')]),_0xfcab65);}});ami['on'](_0x5d45('0x3b'),function(_0x4b9d7a){try{utils['debug'](util[_0x5d45('0x1b')](_0x5d45('0x3c'),_0x4b9d7a['uniqueid']),_0x4b9d7a);queues['varset'](_0x4b9d7a);recordings['varset'](_0x4b9d7a);calls[_0x5d45('0x3b')](_0x4b9d7a);dials[_0x5d45('0x3b')](_0x4b9d7a);}catch(_0x368ce4){utils['error'](util['format'](_0x5d45('0x3c'),_0x4b9d7a[_0x5d45('0x1f')]),_0x368ce4);}});ami['on']('newexten',function(_0x253405){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')](_0x5d45('0x3d'),_0x253405['uniqueid']),_0x253405);calls[_0x5d45('0x3e')](_0x253405);recordings[_0x5d45('0x3e')](_0x253405);dials[_0x5d45('0x3e')](_0x253405);}catch(_0x1ae387){utils['error'](util[_0x5d45('0x1b')](_0x5d45('0x3d'),_0x253405[_0x5d45('0x1f')]),_0x1ae387);}});ami['on']('newchannel',function(_0x1c7d53){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')](_0x5d45('0x3f'),_0x1c7d53[_0x5d45('0x1f')]),_0x1c7d53);calls[_0x5d45('0x40')](_0x1c7d53);recordings[_0x5d45('0x40')](_0x1c7d53);}catch(_0x5d9edf){utils[_0x5d45('0x16')](util['format'](_0x5d45('0x3f'),_0x1c7d53['uniqueid']),_0x5d9edf);}});ami['on'](_0x5d45('0x41'),function(_0x74054a){try{utils[_0x5d45('0x1a')](util['format'](_0x5d45('0x42'),_0x74054a['uniqueid']),_0x74054a);dials[_0x5d45('0x41')](_0x74054a);}catch(_0x47c5e8){utils['error'](util[_0x5d45('0x1b')](_0x5d45('0x43'),_0x74054a[_0x5d45('0x1f')]),_0x47c5e8);}});ami['on'](_0x5d45('0x44'),function(_0xe587be){try{utils[_0x5d45('0x1a')](util[_0x5d45('0x1b')]('[%s][index][dialend]',_0xe587be[_0x5d45('0x1f')]),_0xe587be);dials[_0x5d45('0x44')](_0xe587be);}catch(_0x245f0b){utils['error'](util[_0x5d45('0x1b')](_0x5d45('0x45'),_0xe587be[_0x5d45('0x1f')]),_0x245f0b);}});} \ No newline at end of file +var _0x5b28=['varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5b28,0x197));var _0x85b2=function(_0x4ce18f,_0x1de43b){_0x4ce18f=_0x4ce18f-0x0;var _0x2fb770=_0x5b28[_0x4ce18f];return _0x2fb770;};var AsteriskManager=require('asterisk-manager');var config=require(_0x85b2('0x0'));var utils=require('./utils');var util=require(_0x85b2('0x1'));var ami=new AsteriskManager(config[_0x85b2('0x2')][_0x85b2('0x3')],config[_0x85b2('0x2')]['ip'],config[_0x85b2('0x2')][_0x85b2('0x4')],config[_0x85b2('0x2')][_0x85b2('0x5')],!![]);ami[_0x85b2('0x6')]();if(config[_0x85b2('0x7')]&&config[_0x85b2('0x7')][_0x85b2('0x8')]){utils[_0x85b2('0x9')](_0x85b2('0xa'));}else{var agents=require(_0x85b2('0xb'));var calls=require(_0x85b2('0xc'));var queues=require(_0x85b2('0xd'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x85b2('0xe'));var transfers=require(_0x85b2('0xf'));var core=require(_0x85b2('0x10'));ami['on'](_0x85b2('0x11'),core[_0x85b2('0x11')]);ami['on'](_0x85b2('0x12'),core[_0x85b2('0x12')]);ami['on']('fullybooted',core[_0x85b2('0x13')]);ami['on'](_0x85b2('0x14'),core[_0x85b2('0x14')]);ami['on'](_0x85b2('0x15'),core[_0x85b2('0x15')]);ami['on'](_0x85b2('0x16'),core[_0x85b2('0x16')]);ami['on']('devicestatechange',function(_0x1daf50){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x19'),_0x1daf50[_0x85b2('0x1a')]),_0x1daf50);members['devicestatechange'](_0x1daf50);}catch(_0x1f0ade){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x19'),_0x1daf50[_0x85b2('0x1a')]),_0x1f0ade);}});ami['on'](_0x85b2('0x1b'),function(_0xb87a84){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')]('[%s][index][agentcalled]',_0xb87a84[_0x85b2('0x1c')]),_0xb87a84);agents[_0x85b2('0x1b')](_0xb87a84);}catch(_0x3ed8ba){utils[_0x85b2('0x14')](util[_0x85b2('0x18')]('[%s][index][agentcalled]',_0xb87a84[_0x85b2('0x1c')]),_0x3ed8ba);}});ami['on'](_0x85b2('0x1d'),function(_0x361ffd){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x1e'),_0x361ffd[_0x85b2('0x1c')]),_0x361ffd);agents[_0x85b2('0x1d')](_0x361ffd);}catch(_0x35a17e){utils[_0x85b2('0x14')](util['format'](_0x85b2('0x1e'),_0x361ffd[_0x85b2('0x1c')]),_0x35a17e);}});ami['on'](_0x85b2('0x1f'),function(_0x48fa36){try{utils[_0x85b2('0x17')](util['format']('[%s][index][agentconnect]',_0x48fa36['uniqueid']),_0x48fa36);agents['agentconnect'](_0x48fa36);queues[_0x85b2('0x1f')](_0x48fa36);}catch(_0x390c5e){utils[_0x85b2('0x14')](util['format']('[%s][index][agentconnect]',_0x48fa36[_0x85b2('0x1c')]),_0x390c5e);}});ami['on'](_0x85b2('0x20'),function(_0x146ceb){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x21'),_0x146ceb[_0x85b2('0x1c')]),_0x146ceb);agents[_0x85b2('0x20')](_0x146ceb);queues[_0x85b2('0x20')](_0x146ceb);members['agentcomplete'](_0x146ceb);}catch(_0x1b4a4c){utils[_0x85b2('0x14')](util['format']('[%s][index][agentcomplete]',_0x146ceb[_0x85b2('0x1c')]),_0x1b4a4c);}});ami['on'](_0x85b2('0x22'),function(_0x3ca739){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x23'),_0x3ca739[_0x85b2('0x1c')]),_0x3ca739);agents['queuecallerabandon'](_0x3ca739);queues[_0x85b2('0x22')](_0x3ca739);}catch(_0x2b124a){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x23'),_0x3ca739['uniqueid']),_0x2b124a);}});ami['on'](_0x85b2('0x24'),function(_0x27bf1a){try{utils[_0x85b2('0x17')](util['format'](_0x85b2('0x25'),_0x27bf1a['uniqueid']),_0x27bf1a);queues[_0x85b2('0x24')](_0x27bf1a);recordings['queuecallerjoin'](_0x27bf1a);}catch(_0x50ca94){utils[_0x85b2('0x14')](util['format'](_0x85b2('0x25'),_0x27bf1a['uniqueid']),_0x50ca94);}});ami['on']('queuecallerleave',function(_0x59a2ce){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x26'),_0x59a2ce['uniqueid']),_0x59a2ce);queues[_0x85b2('0x27')](_0x59a2ce);}catch(_0xa422f8){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x26'),_0x59a2ce[_0x85b2('0x1c')]),_0xa422f8);}});ami['on'](_0x85b2('0x28'),function(_0x472828){try{utils[_0x85b2('0x17')](util['format']('[%s][index][musiconholdstart]',_0x472828[_0x85b2('0x1c')]),_0x472828);queues[_0x85b2('0x28')](_0x472828);calls[_0x85b2('0x28')](_0x472828);}catch(_0x505ca5){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x29'),_0x472828[_0x85b2('0x1c')]),_0x505ca5);}});ami['on']('musiconholdstop',function(_0x8357ab){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x2a'),_0x8357ab[_0x85b2('0x1c')]),_0x8357ab);queues[_0x85b2('0x2b')](_0x8357ab);calls[_0x85b2('0x2b')](_0x8357ab);}catch(_0xb7b952){utils['error'](util[_0x85b2('0x18')](_0x85b2('0x2a'),_0x8357ab[_0x85b2('0x1c')]),_0xb7b952);}});ami['on'](_0x85b2('0x2c'),function(_0x415709){try{utils['debug'](util['format'](_0x85b2('0x2d'),_0x415709['uniqueid']),_0x415709);calls[_0x85b2('0x2c')](_0x415709);recordings[_0x85b2('0x2c')](_0x415709);}catch(_0x5c083e){utils['error'](util[_0x85b2('0x18')](_0x85b2('0x2d'),_0x415709[_0x85b2('0x1c')]),_0x5c083e);}});ami['on'](_0x85b2('0x2e'),function(_0x498bdc){try{utils['debug'](util[_0x85b2('0x18')](_0x85b2('0x2f'),_0x498bdc[_0x85b2('0x1c')]),_0x498bdc);calls[_0x85b2('0x2e')](_0x498bdc);recordings[_0x85b2('0x2e')](_0x498bdc);dials[_0x85b2('0x2e')](_0x498bdc);agents[_0x85b2('0x2e')](_0x498bdc);queues[_0x85b2('0x2e')](_0x498bdc);}catch(_0x53ef3f){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x2f'),_0x498bdc[_0x85b2('0x1c')]),_0x53ef3f);}});ami['on'](_0x85b2('0x30'),function(_0x19f1cb){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x31'),_0x19f1cb[_0x85b2('0x1c')]),_0x19f1cb);members[_0x85b2('0x30')](_0x19f1cb);}catch(_0x299e42){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x31'),_0x19f1cb[_0x85b2('0x1c')]),_0x299e42);}});ami['on'](_0x85b2('0x32'),function(_0x401fa2){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')]('[%s][index][blindtransfer]',_0x401fa2[_0x85b2('0x1c')]),_0x401fa2);queues[_0x85b2('0x32')](_0x401fa2);agents[_0x85b2('0x32')](_0x401fa2);transfers[_0x85b2('0x32')](_0x401fa2);}catch(_0x3981d8){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x33'),_0x401fa2[_0x85b2('0x1c')]),_0x3981d8);}});ami['on'](_0x85b2('0x34'),function(_0x1ca2f9){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x35'),_0x1ca2f9[_0x85b2('0x36')]),_0x1ca2f9);queues['attendedtransfer'](_0x1ca2f9);transfers['attendedtransfer'](_0x1ca2f9);agents['attendedtransfer'](_0x1ca2f9);calls[_0x85b2('0x34')](_0x1ca2f9);}catch(_0x512a06){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x35'),_0x1ca2f9['origtransfereruniqueid']),_0x512a06);}});ami['on'](_0x85b2('0x37'),function(_0x8711fb){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x38'),_0x8711fb[_0x85b2('0x1c')]),_0x8711fb);queues[_0x85b2('0x37')](_0x8711fb);recordings['varset'](_0x8711fb);calls[_0x85b2('0x37')](_0x8711fb);dials[_0x85b2('0x37')](_0x8711fb);}catch(_0xbd9ffa){utils['error'](util[_0x85b2('0x18')](_0x85b2('0x38'),_0x8711fb[_0x85b2('0x1c')]),_0xbd9ffa);}});ami['on'](_0x85b2('0x39'),function(_0x2f10b2){try{utils[_0x85b2('0x17')](util['format']('[%s][index][newexten]',_0x2f10b2[_0x85b2('0x1c')]),_0x2f10b2);calls['newexten'](_0x2f10b2);recordings['newexten'](_0x2f10b2);dials[_0x85b2('0x39')](_0x2f10b2);}catch(_0x2c4dd2){utils['error'](util[_0x85b2('0x18')](_0x85b2('0x3a'),_0x2f10b2[_0x85b2('0x1c')]),_0x2c4dd2);}});ami['on'](_0x85b2('0x3b'),function(_0x4174c3){try{utils['debug'](util[_0x85b2('0x18')](_0x85b2('0x3c'),_0x4174c3['uniqueid']),_0x4174c3);calls['newchannel'](_0x4174c3);recordings[_0x85b2('0x3b')](_0x4174c3);}catch(_0x542f75){utils['error'](util[_0x85b2('0x18')](_0x85b2('0x3c'),_0x4174c3[_0x85b2('0x1c')]),_0x542f75);}});ami['on']('dialbegin',function(_0x44aa9f){try{utils[_0x85b2('0x17')](util[_0x85b2('0x18')](_0x85b2('0x3d'),_0x44aa9f[_0x85b2('0x1c')]),_0x44aa9f);dials[_0x85b2('0x3e')](_0x44aa9f);}catch(_0x2fcd93){utils[_0x85b2('0x14')](util[_0x85b2('0x18')](_0x85b2('0x3f'),_0x44aa9f[_0x85b2('0x1c')]),_0x2fcd93);}});ami['on'](_0x85b2('0x40'),function(_0x7b323d){try{utils[_0x85b2('0x17')](util['format'](_0x85b2('0x41'),_0x7b323d[_0x85b2('0x1c')]),_0x7b323d);dials[_0x85b2('0x40')](_0x7b323d);}catch(_0x540f8b){utils[_0x85b2('0x14')](util['format'](_0x85b2('0x41'),_0x7b323d[_0x85b2('0x1c')]),_0x540f8b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e4627a7..1416c4e 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 _0x1391=['diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','interface','then','name','internal','getUserByName','split','request','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','isNil','exitAt'];(function(_0x2d04a6,_0x5bbf0a){var _0x3cd00e=function(_0x38887c){while(--_0x38887c){_0x2d04a6['push'](_0x2d04a6['shift']());}};_0x3cd00e(++_0x5bbf0a);}(_0x1391,0x174));var _0x1139=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x1391[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x1139('0x0'));var util=require(_0x1139('0x1'));var utils=require(_0x1139('0x2'));var members={};var exclude=[_0x1139('0x3'),_0x1139('0x4')];function writeDB(_0x384d50){utils[_0x1139('0x5')](util[_0x1139('0x6')](_0x1139('0x7'),_0x384d50[_0x1139('0x8')],_0x384d50['interface'],_0x384d50[_0x1139('0x9')],_0x384d50[_0x1139('0xa')],_0x384d50[_0x1139('0xb')],_0x384d50['type']));if(_0x384d50[_0x1139('0xc')]){utils['getUserByInterface'](_0x384d50[_0x1139('0xc')])[_0x1139('0xd')](function(_0x23d70d){if(_0x23d70d){_0x384d50[_0x1139('0xb')]=_0x23d70d[_0x1139('0xe')];_0x384d50[_0x1139('0xf')]=_0x23d70d[_0x1139('0xf')];utils['request']('CreateMemberReport',_0x384d50);}else{utils[_0x1139('0x10')](_0x384d50[_0x1139('0xc')][_0x1139('0x11')]('/')[0x1])[_0x1139('0xd')](function(_0x1f8d78){if(_0x1f8d78){_0x384d50['membername']=_0x1f8d78[_0x1139('0xe')];_0x384d50[_0x1139('0xf')]=_0x1f8d78[_0x1139('0xf')];utils[_0x1139('0x12')]('CreateMemberReport',_0x384d50);}});}})[_0x1139('0x13')](function(_0xe8b157){utils[_0x1139('0x14')](util[_0x1139('0x6')](_0x1139('0x15'),_0x384d50[_0x1139('0x8')]),_0xe8b157);});}delete members[_0x384d50['interface']];}function startsWith(_0x30ff6b,_0x399ff2){return _[_0x1139('0x16')](_0x30ff6b,function(_0x422ca8){return _['startsWith'](_0x399ff2,_0x422ca8);});}exports['devicestatechange']=function(_0x16b4cd){try{utils[_0x1139('0x17')](util[_0x1139('0x6')](_0x1139('0x18'),members[_0x16b4cd[_0x1139('0x19')]]?members[_0x16b4cd['device']]['uniqueid']:_0x16b4cd['device']),_0x16b4cd);utils['info'](util[_0x1139('0x6')](_0x1139('0x1a'),members[_0x16b4cd[_0x1139('0x19')]]?members[_0x16b4cd['device']]['uniqueid']:_0x16b4cd[_0x1139('0x19')],_0x16b4cd[_0x1139('0x1b')],_0x16b4cd['device']));switch(_0x16b4cd[_0x1139('0x1b')]){case _0x1139('0x1c'):case _0x1139('0x1d'):if(!startsWith(exclude,_0x16b4cd['device'])){members[_0x16b4cd['device']]={'channel':_0x1139('0x1e'),'interface':_0x16b4cd[_0x1139('0x19')],'type':_0x1139('0x1f'),'enterAt':utils[_0x1139('0x20')](),'role':_0x1139('0x21')};}break;case'NOT_INUSE':if(!_[_0x1139('0x22')](members[_0x16b4cd['device']])){members[_0x16b4cd['device']][_0x1139('0x23')]=utils['now']();members[_0x16b4cd[_0x1139('0x19')]]['duration']=utils[_0x1139('0x24')](members[_0x16b4cd[_0x1139('0x19')]][_0x1139('0x23')],members[_0x16b4cd[_0x1139('0x19')]]['enterAt']);if(members[_0x16b4cd['device']][_0x1139('0x8')]){writeDB(members[_0x16b4cd[_0x1139('0x19')]]);}}break;default:break;}}catch(_0x5bdeaf){utils[_0x1139('0x14')](util[_0x1139('0x6')](_0x1139('0x18'),members[_0x16b4cd[_0x1139('0x19')]]?members[_0x16b4cd[_0x1139('0x19')]][_0x1139('0x8')]:_0x16b4cd['device']),_0x5bdeaf);}};exports[_0x1139('0x25')]=function(_0x4b5b46){try{if(!_[_0x1139('0x22')](members[_0x4b5b46[_0x1139('0xc')]])){utils[_0x1139('0x17')](util[_0x1139('0x6')]('[%s][members][agentcomplete]',_0x4b5b46[_0x1139('0x8')]),_0x4b5b46);utils[_0x1139('0x5')](util[_0x1139('0x6')](_0x1139('0x26'),_0x4b5b46[_0x1139('0x8')],_0x4b5b46[_0x1139('0xc')],_0x4b5b46[_0x1139('0x27')]));members[_0x4b5b46[_0x1139('0xc')]]=_['assign'](members[_0x4b5b46[_0x1139('0xc')]],{'data4':_0x4b5b46[_0x1139('0x27')],'uniqueid':_0x4b5b46[_0x1139('0x8')]});}}catch(_0x292c91){utils['error'](util[_0x1139('0x6')](_0x1139('0x28'),_0x4b5b46[_0x1139('0x8')]),_0x292c91);}};exports[_0x1139('0x29')]=function(_0x1b94e2){try{utils['debug'](util['format']('[%s][members][cdr]',_0x1b94e2[_0x1139('0x8')]),_0x1b94e2);if(_0x1b94e2[_0x1139('0x9')]){var _0x1afc08=_0x1b94e2[_0x1139('0x9')][_0x1139('0x11')]('-')[0x0];if(!_[_0x1139('0x22')](members[_0x1afc08])){members[_0x1afc08]=_[_0x1139('0x2a')](members[_0x1afc08],{'data1':members[_0x1afc08][_0x1139('0x2b')]||_0x1b94e2['type'],'data2':members[_0x1afc08]['data2']||_0x1b94e2[_0x1139('0x2c')],'data3':members[_0x1afc08][_0x1139('0x2d')]||_0x1b94e2[_0x1139('0x2e')],'uniqueid':members[_0x1afc08][_0x1139('0x8')]||_0x1b94e2[_0x1139('0x8')]});utils[_0x1139('0x5')](util[_0x1139('0x6')](_0x1139('0x2f'),_0x1b94e2[_0x1139('0x8')],members[_0x1afc08][_0x1139('0x2b')],members[_0x1afc08][_0x1139('0xa')],members[_0x1afc08][_0x1139('0x2d')]));if(members[_0x1afc08][_0x1139('0x23')]){writeDB(members[_0x1afc08]);}}}if(_0x1b94e2[_0x1139('0x30')]){var _0x42cabc=_0x1b94e2[_0x1139('0x30')][_0x1139('0x11')]('-')[0x0];if(!_[_0x1139('0x22')](members[_0x42cabc])){members[_0x42cabc]=_[_0x1139('0x2a')](members[_0x42cabc],{'data1':members[_0x42cabc][_0x1139('0x2b')]||_0x1b94e2[_0x1139('0x31')],'data2':members[_0x42cabc]['data2']||_0x1b94e2['source'],'data3':members[_0x42cabc][_0x1139('0x2d')]||_0x1b94e2[_0x1139('0x2e')],'uniqueid':members[_0x42cabc]['uniqueid']||_0x1b94e2['uniqueid']});utils[_0x1139('0x5')](util[_0x1139('0x6')](_0x1139('0x2f'),_0x1b94e2[_0x1139('0x8')],members[_0x42cabc][_0x1139('0x2b')],members[_0x42cabc][_0x1139('0xa')],members[_0x42cabc][_0x1139('0x2d')]));if(members[_0x42cabc]['exitAt']){writeDB(members[_0x42cabc]);}}}}catch(_0x3353ef){utils[_0x1139('0x14')](util[_0x1139('0x6')](_0x1139('0x32'),_0x1b94e2[_0x1139('0x8')]),_0x3353ef);}}; \ No newline at end of file +var _0xb6b1=['data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','[%s][members][writeDB]','startsWith','[%s][members][devicestatechange]','format','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','error','agentcomplete','isNil','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xb6b1,0x19f));var _0x1b6b=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xb6b1[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x1b6b('0x0'));var util=require(_0x1b6b('0x1'));var utils=require(_0x1b6b('0x2'));var members={};var exclude=[_0x1b6b('0x3'),_0x1b6b('0x4')];function writeDB(_0x59cf03){utils[_0x1b6b('0x5')](util['format'](_0x1b6b('0x6'),_0x59cf03[_0x1b6b('0x7')],_0x59cf03['interface'],_0x59cf03[_0x1b6b('0x8')],_0x59cf03[_0x1b6b('0x9')],_0x59cf03[_0x1b6b('0xa')],_0x59cf03[_0x1b6b('0xb')]));if(_0x59cf03[_0x1b6b('0xc')]){utils[_0x1b6b('0xd')](_0x59cf03['interface'])[_0x1b6b('0xe')](function(_0x5dd69a){if(_0x5dd69a){_0x59cf03[_0x1b6b('0xa')]=_0x5dd69a[_0x1b6b('0xf')];_0x59cf03[_0x1b6b('0x10')]=_0x5dd69a[_0x1b6b('0x10')];utils[_0x1b6b('0x11')](_0x1b6b('0x12'),_0x59cf03);}else{utils[_0x1b6b('0x13')](_0x59cf03['interface'][_0x1b6b('0x14')]('/')[0x1])[_0x1b6b('0xe')](function(_0x574c90){if(_0x574c90){_0x59cf03[_0x1b6b('0xa')]=_0x574c90[_0x1b6b('0xf')];_0x59cf03[_0x1b6b('0x10')]=_0x574c90[_0x1b6b('0x10')];utils[_0x1b6b('0x11')](_0x1b6b('0x12'),_0x59cf03);}});}})[_0x1b6b('0x15')](function(_0x4487ff){utils['error'](util['format'](_0x1b6b('0x16'),_0x59cf03[_0x1b6b('0x7')]),_0x4487ff);});}delete members[_0x59cf03[_0x1b6b('0xc')]];}function startsWith(_0x550548,_0xd66f65){return _['some'](_0x550548,function(_0xaaa9e7){return _[_0x1b6b('0x17')](_0xd66f65,_0xaaa9e7);});}exports['devicestatechange']=function(_0x529dd2){try{utils['debug'](util['format'](_0x1b6b('0x18'),members[_0x529dd2['device']]?members[_0x529dd2['device']][_0x1b6b('0x7')]:_0x529dd2['device']),_0x529dd2);utils[_0x1b6b('0x5')](util[_0x1b6b('0x19')](_0x1b6b('0x1a'),members[_0x529dd2[_0x1b6b('0x1b')]]?members[_0x529dd2['device']][_0x1b6b('0x7')]:_0x529dd2[_0x1b6b('0x1b')],_0x529dd2['state'],_0x529dd2[_0x1b6b('0x1b')]));switch(_0x529dd2[_0x1b6b('0x1c')]){case _0x1b6b('0x1d'):case'BUSY':if(!startsWith(exclude,_0x529dd2['device'])){members[_0x529dd2[_0x1b6b('0x1b')]]={'channel':_0x1b6b('0x1e'),'interface':_0x529dd2[_0x1b6b('0x1b')],'type':_0x1b6b('0x1f'),'enterAt':utils[_0x1b6b('0x20')](),'role':_0x1b6b('0x21')};}break;case _0x1b6b('0x22'):if(!_['isNil'](members[_0x529dd2[_0x1b6b('0x1b')]])){members[_0x529dd2[_0x1b6b('0x1b')]][_0x1b6b('0x23')]=utils[_0x1b6b('0x20')]();members[_0x529dd2[_0x1b6b('0x1b')]][_0x1b6b('0x24')]=utils[_0x1b6b('0x25')](members[_0x529dd2[_0x1b6b('0x1b')]]['exitAt'],members[_0x529dd2['device']]['enterAt']);if(members[_0x529dd2['device']][_0x1b6b('0x7')]){writeDB(members[_0x529dd2['device']]);}}break;default:break;}}catch(_0x1d117e){utils[_0x1b6b('0x26')](util['format']('[%s][members][devicestatechange]',members[_0x529dd2[_0x1b6b('0x1b')]]?members[_0x529dd2['device']]['uniqueid']:_0x529dd2['device']),_0x1d117e);}};exports[_0x1b6b('0x27')]=function(_0x23cbdd){try{if(!_[_0x1b6b('0x28')](members[_0x23cbdd[_0x1b6b('0xc')]])){utils[_0x1b6b('0x29')](util['format'](_0x1b6b('0x2a'),_0x23cbdd[_0x1b6b('0x7')]),_0x23cbdd);utils[_0x1b6b('0x5')](util[_0x1b6b('0x19')](_0x1b6b('0x2b'),_0x23cbdd[_0x1b6b('0x7')],_0x23cbdd[_0x1b6b('0xc')],_0x23cbdd[_0x1b6b('0x2c')]));members[_0x23cbdd[_0x1b6b('0xc')]]=_[_0x1b6b('0x2d')](members[_0x23cbdd[_0x1b6b('0xc')]],{'data4':_0x23cbdd[_0x1b6b('0x2c')],'uniqueid':_0x23cbdd['uniqueid']});}}catch(_0x387cf3){utils[_0x1b6b('0x26')](util[_0x1b6b('0x19')](_0x1b6b('0x2a'),_0x23cbdd[_0x1b6b('0x7')]),_0x387cf3);}};exports[_0x1b6b('0x2e')]=function(_0x48d7a9){try{utils[_0x1b6b('0x29')](util['format'](_0x1b6b('0x2f'),_0x48d7a9['uniqueid']),_0x48d7a9);if(_0x48d7a9[_0x1b6b('0x8')]){var _0x1d5468=_0x48d7a9[_0x1b6b('0x8')][_0x1b6b('0x14')]('-')[0x0];if(!_[_0x1b6b('0x28')](members[_0x1d5468])){members[_0x1d5468]=_[_0x1b6b('0x2d')](members[_0x1d5468],{'data1':members[_0x1d5468][_0x1b6b('0x30')]||_0x48d7a9[_0x1b6b('0xb')],'data2':members[_0x1d5468][_0x1b6b('0x9')]||_0x48d7a9[_0x1b6b('0x31')],'data3':members[_0x1d5468]['data3']||_0x48d7a9['destination'],'uniqueid':members[_0x1d5468][_0x1b6b('0x7')]||_0x48d7a9[_0x1b6b('0x7')]});utils[_0x1b6b('0x5')](util[_0x1b6b('0x19')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x48d7a9[_0x1b6b('0x7')],members[_0x1d5468][_0x1b6b('0x30')],members[_0x1d5468][_0x1b6b('0x9')],members[_0x1d5468][_0x1b6b('0x32')]));if(members[_0x1d5468][_0x1b6b('0x23')]){writeDB(members[_0x1d5468]);}}}if(_0x48d7a9[_0x1b6b('0x33')]){var _0x20e013=_0x48d7a9[_0x1b6b('0x33')][_0x1b6b('0x14')]('-')[0x0];if(!_[_0x1b6b('0x28')](members[_0x20e013])){members[_0x20e013]=_[_0x1b6b('0x2d')](members[_0x20e013],{'data1':members[_0x20e013][_0x1b6b('0x30')]||_0x48d7a9[_0x1b6b('0xb')],'data2':members[_0x20e013][_0x1b6b('0x9')]||_0x48d7a9[_0x1b6b('0x31')],'data3':members[_0x20e013][_0x1b6b('0x32')]||_0x48d7a9['destination'],'uniqueid':members[_0x20e013]['uniqueid']||_0x48d7a9['uniqueid']});utils['info'](util[_0x1b6b('0x19')](_0x1b6b('0x34'),_0x48d7a9[_0x1b6b('0x7')],members[_0x20e013][_0x1b6b('0x30')],members[_0x20e013][_0x1b6b('0x9')],members[_0x20e013]['data3']));if(members[_0x20e013][_0x1b6b('0x23')]){writeDB(members[_0x20e013]);}}}}catch(_0x1c058a){utils[_0x1b6b('0x26')](util['format'](_0x1b6b('0x2f'),_0x48d7a9[_0x1b6b('0x7')]),_0x1c058a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 96fdae1..95b3eff 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 _0xf8f2=['calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','info','assign','position','now','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','error','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x1d5fa9,_0xe54e51){_0x1d5fa9=_0x1d5fa9-0x0;var _0x30587d=_0xf8f2[_0x1d5fa9];return _0x30587d;};'use strict';var _=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var utils=require(_0x2f8f('0x2'));var queues={};function writeDB(_0xbe501e){utils['info'](util[_0x2f8f('0x3')](_0x2f8f('0x4'),_0xbe501e[_0x2f8f('0x5')],_0xbe501e[_0x2f8f('0x6')],_0xbe501e[_0x2f8f('0x7')],_0xbe501e['lastAssignedTo'],_0xbe501e[_0x2f8f('0x8')],_0xbe501e[_0x2f8f('0x9')],_0xbe501e[_0x2f8f('0xa')]));if(_0xbe501e[_0x2f8f('0x7')]){utils[_0x2f8f('0xb')](_0xbe501e[_0x2f8f('0x7')])[_0x2f8f('0xc')](function(_0x1237d5){if(_0x1237d5){_0xbe501e['type']=_0x1237d5[_0x2f8f('0xd')];}utils[_0x2f8f('0xe')](_0x2f8f('0xf'),_0xbe501e);});}else{utils[_0x2f8f('0xe')]('CreateVoiceQueueReport',_0xbe501e);}if(_0xbe501e[_0x2f8f('0x10')]){delete queues[_0xbe501e[_0x2f8f('0x10')]];}else{delete queues[_0xbe501e['uniqueid']];}}exports[_0x2f8f('0x11')]=function(_0x88dde7){try{utils[_0x2f8f('0x12')](util[_0x2f8f('0x3')]('[%s][queues][queuecallerjoin]',_0x88dde7[_0x2f8f('0x5')]),_0x88dde7);utils[_0x2f8f('0x13')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x88dde7[_0x2f8f('0x5')],_0x88dde7[_0x2f8f('0x7')],_0x88dde7['position']));queues[_0x88dde7[_0x2f8f('0x5')]]=_[_0x2f8f('0x14')](_0x88dde7,{'originalposition':_0x88dde7[_0x2f8f('0x15')],'queuecallerjoinAt':utils[_0x2f8f('0x16')](),'mohtime':0x0});}catch(_0x1e0492){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x88dde7['uniqueid']),_0x1e0492);}};exports[_0x2f8f('0x17')]=function(_0xee85bb){try{if(!_[_0x2f8f('0x18')](queues[_0xee85bb[_0x2f8f('0x5')]])){utils[_0x2f8f('0x12')](util['format']('[%s][queues][hangup]',_0xee85bb[_0x2f8f('0x5')]),_0xee85bb);if(queues[_0xee85bb['uniqueid']]['queuecallerleaveAt']){if(!queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0x19')]&&!queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0x1a')]){queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0x1b')]=!![];queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0x1c')]=utils['now']();queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0xa')]='COMPLETEDBYAGENT';}utils['info'](util[_0x2f8f('0x3')](_0x2f8f('0x1d'),_0xee85bb[_0x2f8f('0x5')],queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0x1e')],queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0xa')]));writeDB(queues[_0xee85bb[_0x2f8f('0x5')]]);}else if(queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0x10')]){utils[_0x2f8f('0x13')](util[_0x2f8f('0x3')](_0x2f8f('0x1f'),_0xee85bb['uniqueid'],queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0x1e')],queues[_0xee85bb[_0x2f8f('0x5')]][_0x2f8f('0x10')]));queues[queues[_0xee85bb[_0x2f8f('0x5')]]['transfereduniqueid']]=queues[_0xee85bb[_0x2f8f('0x5')]];queues[queues[_0xee85bb[_0x2f8f('0x5')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0xee85bb['uniqueid']];}}}catch(_0x74d4af){utils['error'](util[_0x2f8f('0x3')](_0x2f8f('0x20'),_0xee85bb[_0x2f8f('0x5')]),_0x74d4af);}};exports[_0x2f8f('0x21')]=function(_0x2ffba2){try{utils[_0x2f8f('0x12')](util[_0x2f8f('0x3')](_0x2f8f('0x22'),_0x2ffba2['uniqueid']),_0x2ffba2);if(!_[_0x2f8f('0x18')](_0x2ffba2[_0x2f8f('0x23')][_0x2f8f('0x24')])&&_0x2ffba2[_0x2f8f('0x25')][_0x2f8f('0x26')]()!==_0x2f8f('0x27')){if(!_[_0x2f8f('0x18')](queues[_0x2ffba2[_0x2f8f('0x5')]])){queues[_0x2ffba2[_0x2f8f('0x5')]]['queuecallerabandon']=![];queues[_0x2ffba2[_0x2f8f('0x5')]][_0x2f8f('0x28')]=null;queues[_0x2ffba2[_0x2f8f('0x5')]][_0x2f8f('0x1a')]=!![];queues[_0x2ffba2['uniqueid']][_0x2f8f('0x29')]=utils[_0x2f8f('0x16')]();queues[_0x2ffba2[_0x2f8f('0x5')]][_0x2f8f('0xa')]=_0x2ffba2[_0x2f8f('0x25')][_0x2f8f('0x26')]();utils['info'](util[_0x2f8f('0x3')](_0x2f8f('0x2a'),_0x2ffba2[_0x2f8f('0x5')],queues[_0x2ffba2[_0x2f8f('0x5')]][_0x2f8f('0x1e')],_0x2ffba2[_0x2f8f('0x25')],queues[_0x2ffba2['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2ffba2['uniqueid']]);}}else if(!_['isNil'](_0x2ffba2[_0x2f8f('0x23')][_0x2f8f('0x2b')])){if(!_[_0x2f8f('0x18')](queues[_0x2ffba2[_0x2f8f('0x5')]])&&!queues[_0x2ffba2[_0x2f8f('0x5')]][_0x2f8f('0x19')]){queues[_0x2ffba2[_0x2f8f('0x5')]]['queuecallerabandon']=![];queues[_0x2ffba2[_0x2f8f('0x5')]][_0x2f8f('0x28')]=null;queues[_0x2ffba2[_0x2f8f('0x5')]][_0x2f8f('0x1a')]=!![];queues[_0x2ffba2['uniqueid']][_0x2f8f('0x29')]=utils['now']();queues[_0x2ffba2['uniqueid']]['queuecallerexitreason']=_0x2f8f('0x2c');utils[_0x2f8f('0x13')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2ffba2[_0x2f8f('0x5')],queues[_0x2ffba2['uniqueid']][_0x2f8f('0x1e')],_0x2ffba2['value'],queues[_0x2ffba2['uniqueid']][_0x2f8f('0xa')]));}}}catch(_0x57654c){utils['error'](util[_0x2f8f('0x3')](_0x2f8f('0x22'),_0x2ffba2[_0x2f8f('0x5')]),_0x57654c);}};exports['queuecallerabandon']=function(_0x3ca3d3){try{if(!_[_0x2f8f('0x18')](queues[_0x3ca3d3[_0x2f8f('0x5')]])){utils[_0x2f8f('0x12')](util[_0x2f8f('0x3')](_0x2f8f('0x2d'),_0x3ca3d3[_0x2f8f('0x5')]),_0x3ca3d3);queues[_0x3ca3d3[_0x2f8f('0x5')]][_0x2f8f('0x1a')]=![];queues[_0x3ca3d3[_0x2f8f('0x5')]]['queuecallerexitAt']=null;queues[_0x3ca3d3[_0x2f8f('0x5')]]['queuecallerabandon']=!![];queues[_0x3ca3d3['uniqueid']][_0x2f8f('0x28')]=utils['now']();queues[_0x3ca3d3['uniqueid']][_0x2f8f('0xa')]='ABANDONED';utils[_0x2f8f('0x13')](util[_0x2f8f('0x3')](_0x2f8f('0x2e'),_0x3ca3d3[_0x2f8f('0x5')],queues[_0x3ca3d3[_0x2f8f('0x5')]][_0x2f8f('0x1e')],queues[_0x3ca3d3[_0x2f8f('0x5')]][_0x2f8f('0xa')]));}}catch(_0x2629eb){utils[_0x2f8f('0x2f')](util[_0x2f8f('0x3')](_0x2f8f('0x2d'),_0x3ca3d3[_0x2f8f('0x5')]),_0x2629eb);}};exports[_0x2f8f('0x30')]=function(_0x2b0b76){try{if(!_[_0x2f8f('0x18')](queues[_0x2b0b76[_0x2f8f('0x5')]])){utils[_0x2f8f('0x12')](util[_0x2f8f('0x3')](_0x2f8f('0x31'),_0x2b0b76[_0x2f8f('0x5')]),_0x2b0b76);utils[_0x2f8f('0x13')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2b0b76[_0x2f8f('0x5')],queues[_0x2b0b76['uniqueid']][_0x2f8f('0x1e')],_0x2b0b76[_0x2f8f('0x32')],_0x2b0b76['connectedlinename']));queues[_0x2b0b76['uniqueid']]['queuecallerleave']=!![];queues[_0x2b0b76[_0x2f8f('0x5')]][_0x2f8f('0x33')]=utils[_0x2f8f('0x16')]();queues[_0x2b0b76['uniqueid']][_0x2f8f('0x34')]=utils[_0x2f8f('0x35')](queues[_0x2b0b76[_0x2f8f('0x5')]][_0x2f8f('0x33')],queues[_0x2b0b76[_0x2f8f('0x5')]][_0x2f8f('0x36')]);queues[_0x2b0b76['uniqueid']]['position']=_0x2b0b76['position'];queues[_0x2b0b76[_0x2f8f('0x5')]][_0x2f8f('0x37')]=_0x2b0b76[_0x2f8f('0x37')];queues[_0x2b0b76[_0x2f8f('0x5')]][_0x2f8f('0x32')]=_0x2b0b76[_0x2f8f('0x32')];queues[_0x2b0b76[_0x2f8f('0x5')]][_0x2f8f('0x38')]=_0x2b0b76[_0x2f8f('0x38')];}}catch(_0x34bcdc){utils[_0x2f8f('0x2f')](util[_0x2f8f('0x3')](_0x2f8f('0x31'),_0x2b0b76[_0x2f8f('0x5')]),_0x34bcdc);}};exports['agentconnect']=function(_0x3e12bb){try{if(!_['isNil'](queues[_0x3e12bb['uniqueid']])){utils[_0x2f8f('0x12')](util[_0x2f8f('0x3')](_0x2f8f('0x39'),_0x3e12bb[_0x2f8f('0x5')]),_0x3e12bb);utils['info'](util[_0x2f8f('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3e12bb[_0x2f8f('0x5')],queues[_0x3e12bb['uniqueid']][_0x2f8f('0x1e')],_0x3e12bb[_0x2f8f('0x3a')],_0x3e12bb[_0x2f8f('0x3b')]));queues[_0x3e12bb[_0x2f8f('0x5')]][_0x2f8f('0x19')]=![];queues[_0x3e12bb['uniqueid']]['queuecallerabandon']=![];queues[_0x3e12bb['uniqueid']][_0x2f8f('0x28')]=null;queues[_0x3e12bb[_0x2f8f('0x5')]][_0x2f8f('0x1a')]=![];queues[_0x3e12bb[_0x2f8f('0x5')]][_0x2f8f('0xa')]=null;queues[_0x3e12bb[_0x2f8f('0x5')]]['queuecallerexitAt']=null;queues[_0x3e12bb[_0x2f8f('0x5')]]['assigned']=!![];queues[_0x3e12bb[_0x2f8f('0x5')]]['accountcode']=_0x3e12bb[_0x2f8f('0x3b')];queues[_0x3e12bb[_0x2f8f('0x5')]][_0x2f8f('0x3c')]=_0x3e12bb['membername'];}}catch(_0x1391a5){utils[_0x2f8f('0x2f')](util[_0x2f8f('0x3')]('[%s][queues][agentconnect]',_0x3e12bb[_0x2f8f('0x5')]),_0x1391a5);}};exports[_0x2f8f('0x3d')]=function(_0x41647b){try{if(!_[_0x2f8f('0x18')](queues[_0x41647b[_0x2f8f('0x5')]])){if(queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x33')]){utils[_0x2f8f('0x12')](util['format'](_0x2f8f('0x3e'),_0x41647b[_0x2f8f('0x5')]),_0x41647b);queues[_0x41647b['uniqueid']]['queuecallerabandon']=![];queues[_0x41647b[_0x2f8f('0x5')]]['queuecallerabandon']=![];queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x28')]=null;queues[_0x41647b['uniqueid']][_0x2f8f('0x1a')]=![];queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x29')]=null;queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x3f')]=!![];queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x3c')]=_0x41647b[_0x2f8f('0x3a')];queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x1b')]=!![];queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x1c')]=utils[_0x2f8f('0x16')]();if(_0x41647b[_0x2f8f('0x40')]==_0x2f8f('0x41')){if(!queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x41')]){queues[_0x41647b[_0x2f8f('0x5')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x41647b['uniqueid']]['queuecallerexitreason']=_0x2f8f('0x42')+_0x41647b[_0x2f8f('0x40')][_0x2f8f('0x26')]();}utils[_0x2f8f('0x13')](util['format'](_0x2f8f('0x43'),_0x41647b[_0x2f8f('0x5')],queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0x1e')],_0x41647b['membername'],queues[_0x41647b[_0x2f8f('0x5')]][_0x2f8f('0xa')]));writeDB(queues[_0x41647b['uniqueid']]);}}}catch(_0x5925a2){utils[_0x2f8f('0x2f')](util[_0x2f8f('0x3')](_0x2f8f('0x3e'),_0x41647b['uniqueid']),_0x5925a2);}};exports['blindtransfer']=function(_0x273bfe){try{if(!_[_0x2f8f('0x18')](queues[_0x273bfe[_0x2f8f('0x44')]])){utils[_0x2f8f('0x12')](util[_0x2f8f('0x3')]('[%s][queues][blindtransfer]',_0x273bfe[_0x2f8f('0x5')]),_0x273bfe);queues[_0x273bfe['transfereeuniqueid']][_0x2f8f('0x41')]=!![];queues[_0x273bfe[_0x2f8f('0x44')]][_0x2f8f('0x45')]='BLIND';queues[_0x273bfe[_0x2f8f('0x44')]][_0x2f8f('0x46')]=_0x273bfe[_0x2f8f('0x47')];queues[_0x273bfe['transfereeuniqueid']][_0x2f8f('0x48')]=_0x273bfe['transfereeuniqueid'];queues[_0x273bfe[_0x2f8f('0x44')]][_0x2f8f('0xa')]=_0x2f8f('0x49');utils[_0x2f8f('0x13')](util[_0x2f8f('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x273bfe[_0x2f8f('0x5')],queues[_0x273bfe[_0x2f8f('0x44')]][_0x2f8f('0x1e')],_0x273bfe[_0x2f8f('0x44')],_0x273bfe[_0x2f8f('0x47')]));}}catch(_0x232b5d){utils[_0x2f8f('0x2f')](util[_0x2f8f('0x3')]('[%s][queues][blindtransfer]',_0x273bfe['uniqueid']),_0x232b5d);}};exports[_0x2f8f('0x4a')]=function(_0x2853b7){try{utils['debug'](util[_0x2f8f('0x3')](_0x2f8f('0x4b'),_0x2853b7[_0x2f8f('0x4c')]),_0x2853b7);if(_0x2853b7[_0x2f8f('0x4c')]==_0x2853b7['origtransfererlinkedid']){if(!_[_0x2f8f('0x18')](queues[_0x2853b7[_0x2f8f('0x4d')]])){utils[_0x2f8f('0x13')](util[_0x2f8f('0x3')](_0x2f8f('0x4e'),_0x2853b7[_0x2f8f('0x4c')],queues[_0x2853b7[_0x2f8f('0x4d')]][_0x2f8f('0x1e')],_0x2853b7[_0x2f8f('0x4f')]));queues[_0x2853b7[_0x2f8f('0x4d')]]['transfer']=!![];queues[_0x2853b7['secondtransfererlinkedid']][_0x2f8f('0x45')]='ATTENDED';queues[_0x2853b7[_0x2f8f('0x4d')]]['transferexten']=_0x2853b7[_0x2f8f('0x4f')];queues[_0x2853b7['secondtransfererlinkedid']][_0x2f8f('0x48')]=_0x2853b7[_0x2f8f('0x4c')];queues[_0x2853b7[_0x2f8f('0x4d')]]['queuecallerexitreason']=_0x2f8f('0x50');}if(!_[_0x2f8f('0x18')](queues[_0x2853b7[_0x2f8f('0x51')]])){if(_0x2853b7[_0x2f8f('0x52')]&&queues[_0x2853b7['transfereelinkedid']]){queues[_0x2853b7['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x2853b7['transfereeuniqueid']]=_[_0x2f8f('0x53')](queues[_0x2853b7[_0x2f8f('0x52')]]);queues[_0x2853b7['transfereeuniqueid']][_0x2f8f('0x10')]=_0x2853b7[_0x2f8f('0x54')];queues[_0x2853b7['transfereeuniqueid']][_0x2f8f('0x55')]=0x2;queues[_0x2853b7[_0x2f8f('0x44')]][_0x2f8f('0x8')]=queues[_0x2853b7[_0x2f8f('0x4d')]]['calleridnum'];queues[_0x2853b7[_0x2f8f('0x44')]][_0x2f8f('0x56')]=queues[_0x2853b7[_0x2f8f('0x4d')]][_0x2f8f('0x56')];queues[_0x2853b7[_0x2f8f('0x44')]]['queuecallerjoinAt']=utils[_0x2f8f('0x16')]();queues[_0x2853b7['transfereeuniqueid']][_0x2f8f('0x33')]=utils[_0x2f8f('0x16')]();queues[_0x2853b7['transfereeuniqueid']][_0x2f8f('0x34')]=0x0;queues[_0x2853b7['transfereeuniqueid']]['mohtime']=0x0;utils[_0x2f8f('0x13')](util['format'](_0x2f8f('0x57'),_0x2853b7[_0x2f8f('0x4c')],queues[_0x2853b7[_0x2f8f('0x44')]][_0x2f8f('0x1e')],queues[_0x2853b7[_0x2f8f('0x44')]]['calleridnum'],queues[_0x2853b7[_0x2f8f('0x44')]][_0x2f8f('0x56')]));}else{utils[_0x2f8f('0x13')](util['format'](_0x2f8f('0x58'),_0x2853b7[_0x2f8f('0x4c')],queues[_0x2853b7[_0x2f8f('0x51')]][_0x2f8f('0x1e')],_0x2853b7[_0x2f8f('0x4d')]));queues[_0x2853b7[_0x2f8f('0x51')]][_0x2f8f('0x10')]=_0x2853b7[_0x2f8f('0x4d')];}}}else if(_0x2853b7[_0x2f8f('0x59')]==_0x2853b7[_0x2f8f('0x4d')]){if(!_[_0x2f8f('0x18')](queues[_0x2853b7[_0x2f8f('0x51')]])){utils['info'](util[_0x2f8f('0x3')](_0x2f8f('0x5a'),_0x2853b7[_0x2f8f('0x4c')],queues[_0x2853b7[_0x2f8f('0x51')]][_0x2f8f('0x1e')],_0x2853b7[_0x2f8f('0x59')],_0x2853b7['secondtransfererexten']));queues[_0x2853b7[_0x2f8f('0x51')]][_0x2f8f('0x41')]=!![];queues[_0x2853b7[_0x2f8f('0x51')]][_0x2f8f('0x45')]='ATTENDED';queues[_0x2853b7[_0x2f8f('0x51')]]['transferexten']=_0x2853b7[_0x2f8f('0x5b')];queues[_0x2853b7['origtransfererlinkedid']][_0x2f8f('0x48')]=_0x2853b7[_0x2f8f('0x59')];queues[_0x2853b7['origtransfererlinkedid']]['queuecallerexitreason']=_0x2f8f('0x50');}if(!_[_0x2f8f('0x18')](queues[_0x2853b7[_0x2f8f('0x4d')]])){if(_0x2853b7[_0x2f8f('0x5c')]&&queues[_0x2853b7[_0x2f8f('0x5c')]]){queues[_0x2853b7[_0x2f8f('0x5c')]][_0x2f8f('0x55')]=0x1;queues[_0x2853b7[_0x2f8f('0x54')]]=_['clone'](queues[_0x2853b7[_0x2f8f('0x5c')]]);queues[_0x2853b7['transfertargetuniqueid']][_0x2f8f('0x10')]=_0x2853b7[_0x2f8f('0x54')];queues[_0x2853b7['transfertargetuniqueid']][_0x2f8f('0x55')]=0x2;queues[_0x2853b7[_0x2f8f('0x54')]][_0x2f8f('0x8')]=queues[_0x2853b7[_0x2f8f('0x51')]][_0x2f8f('0x8')];queues[_0x2853b7[_0x2f8f('0x54')]]['calleridname']=queues[_0x2853b7[_0x2f8f('0x51')]]['calleridname'];queues[_0x2853b7[_0x2f8f('0x54')]][_0x2f8f('0x36')]=utils[_0x2f8f('0x16')]();queues[_0x2853b7[_0x2f8f('0x54')]][_0x2f8f('0x33')]=utils[_0x2f8f('0x16')]();queues[_0x2853b7[_0x2f8f('0x54')]][_0x2f8f('0x34')]=0x0;queues[_0x2853b7[_0x2f8f('0x54')]][_0x2f8f('0x5d')]=0x0;utils[_0x2f8f('0x13')](util[_0x2f8f('0x3')](_0x2f8f('0x5e'),_0x2853b7[_0x2f8f('0x4c')],queues[_0x2853b7['transfertargetuniqueid']][_0x2f8f('0x1e')],queues[_0x2853b7[_0x2f8f('0x54')]][_0x2f8f('0x10')],queues[_0x2853b7[_0x2f8f('0x54')]]['calleridnum'],queues[_0x2853b7[_0x2f8f('0x54')]][_0x2f8f('0x56')]));}else{utils[_0x2f8f('0x13')](util[_0x2f8f('0x3')](_0x2f8f('0x58'),_0x2853b7[_0x2f8f('0x4c')],queues[_0x2853b7['secondtransfererlinkedid']][_0x2f8f('0x1e')],_0x2853b7[_0x2f8f('0x51')]));queues[_0x2853b7['secondtransfererlinkedid']][_0x2f8f('0x10')]=_0x2853b7['origtransfererlinkedid'];}}}}catch(_0x3a39c9){utils[_0x2f8f('0x2f')](util[_0x2f8f('0x3')](_0x2f8f('0x4b'),_0x2853b7['origtransfereruniqueid']),_0x3a39c9);}};exports[_0x2f8f('0x5f')]=function(_0x53d4d2){try{if(!_[_0x2f8f('0x18')](queues[_0x53d4d2[_0x2f8f('0x5')]])){utils[_0x2f8f('0x12')](util[_0x2f8f('0x3')](_0x2f8f('0x60'),_0x53d4d2[_0x2f8f('0x5')]),_0x53d4d2);queues[_0x53d4d2[_0x2f8f('0x5')]][_0x2f8f('0x61')]=utils[_0x2f8f('0x16')]();utils['info'](util[_0x2f8f('0x3')](_0x2f8f('0x62'),_0x53d4d2[_0x2f8f('0x5')],queues[_0x53d4d2[_0x2f8f('0x5')]]['name'],queues[_0x53d4d2['uniqueid']]['musiconholdstartAt']));}}catch(_0x232d0e){utils[_0x2f8f('0x2f')](util['format']('[%s][queues][musiconholdstart]',_0x53d4d2[_0x2f8f('0x5')]),_0x232d0e);}};exports['musiconholdstop']=function(_0x1c67e4){try{if(!_['isNil'](queues[_0x1c67e4[_0x2f8f('0x5')]])){if(!_['isNil'](queues[_0x1c67e4[_0x2f8f('0x5')]][_0x2f8f('0x61')])){utils[_0x2f8f('0x12')](util[_0x2f8f('0x3')](_0x2f8f('0x63'),_0x1c67e4['uniqueid']),_0x1c67e4);queues[_0x1c67e4['uniqueid']][_0x2f8f('0x5d')]+=utils[_0x2f8f('0x35')](utils['now'](),queues[_0x1c67e4['uniqueid']][_0x2f8f('0x61')]);utils['info'](util[_0x2f8f('0x3')](_0x2f8f('0x64'),_0x1c67e4[_0x2f8f('0x5')],queues[_0x1c67e4[_0x2f8f('0x5')]][_0x2f8f('0x1e')],queues[_0x1c67e4[_0x2f8f('0x5')]]['mohtime']));delete queues[_0x1c67e4['uniqueid']]['musiconholdstartAt'];}}}catch(_0x39c939){utils[_0x2f8f('0x2f')](util[_0x2f8f('0x3')](_0x2f8f('0x63'),_0x1c67e4[_0x2f8f('0x5')]),_0x39c939);}}; \ No newline at end of file +var _0xd26f=['hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','isNil','value','queuecallerabandon','queuecallerexitAt','toUpperCase','variable','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]'];(function(_0x7ea1fb,_0x2f0b74){var _0x478241=function(_0xd06b3a){while(--_0xd06b3a){_0x7ea1fb['push'](_0x7ea1fb['shift']());}};_0x478241(++_0x2f0b74);}(_0xd26f,0x113));var _0xfd26=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xd26f[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x591cea){utils[_0xfd26('0x2')](util[_0xfd26('0x3')](_0xfd26('0x4'),_0x591cea[_0xfd26('0x5')],_0x591cea[_0xfd26('0x6')],_0x591cea[_0xfd26('0x7')],_0x591cea[_0xfd26('0x8')],_0x591cea[_0xfd26('0x9')],_0x591cea[_0xfd26('0xa')],_0x591cea['queuecallerexitreason']));if(_0x591cea[_0xfd26('0x7')]){utils[_0xfd26('0xb')](_0x591cea[_0xfd26('0x7')])[_0xfd26('0xc')](function(_0x3c9154){if(_0x3c9154){_0x591cea[_0xfd26('0xd')]=_0x3c9154['type'];}utils[_0xfd26('0xe')](_0xfd26('0xf'),_0x591cea);});}else{utils[_0xfd26('0xe')](_0xfd26('0xf'),_0x591cea);}if(_0x591cea[_0xfd26('0x10')]){delete queues[_0x591cea[_0xfd26('0x10')]];}else{delete queues[_0x591cea['uniqueid']];}}exports[_0xfd26('0x11')]=function(_0x5144d1){try{utils[_0xfd26('0x12')](util['format']('[%s][queues][queuecallerjoin]',_0x5144d1['uniqueid']),_0x5144d1);utils['info'](util['format'](_0xfd26('0x13'),_0x5144d1[_0xfd26('0x5')],_0x5144d1[_0xfd26('0x7')],_0x5144d1[_0xfd26('0x14')]));queues[_0x5144d1[_0xfd26('0x5')]]=_[_0xfd26('0x15')](_0x5144d1,{'originalposition':_0x5144d1[_0xfd26('0x14')],'queuecallerjoinAt':utils[_0xfd26('0x16')](),'mohtime':0x0});}catch(_0xbac160){utils[_0xfd26('0x17')](util[_0xfd26('0x3')](_0xfd26('0x18'),_0x5144d1[_0xfd26('0x5')]),_0xbac160);}};exports[_0xfd26('0x19')]=function(_0x2f9b37){try{if(!_['isNil'](queues[_0x2f9b37[_0xfd26('0x5')]])){utils[_0xfd26('0x12')](util[_0xfd26('0x3')](_0xfd26('0x1a'),_0x2f9b37[_0xfd26('0x5')]),_0x2f9b37);if(queues[_0x2f9b37['uniqueid']][_0xfd26('0x1b')]){if(!queues[_0x2f9b37['uniqueid']]['queuecallerabandon']&&!queues[_0x2f9b37['uniqueid']][_0xfd26('0x1c')]){queues[_0x2f9b37[_0xfd26('0x5')]]['queuecallercomplete']=!![];queues[_0x2f9b37['uniqueid']][_0xfd26('0x1d')]=utils[_0xfd26('0x16')]();queues[_0x2f9b37['uniqueid']][_0xfd26('0x1e')]='COMPLETEDBYAGENT';}utils[_0xfd26('0x2')](util['format'](_0xfd26('0x1f'),_0x2f9b37['uniqueid'],queues[_0x2f9b37[_0xfd26('0x5')]][_0xfd26('0x20')],queues[_0x2f9b37['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2f9b37[_0xfd26('0x5')]]);}else if(queues[_0x2f9b37['uniqueid']][_0xfd26('0x10')]){utils[_0xfd26('0x2')](util[_0xfd26('0x3')](_0xfd26('0x21'),_0x2f9b37[_0xfd26('0x5')],queues[_0x2f9b37['uniqueid']][_0xfd26('0x20')],queues[_0x2f9b37['uniqueid']][_0xfd26('0x10')]));queues[queues[_0x2f9b37[_0xfd26('0x5')]]['transfereduniqueid']]=queues[_0x2f9b37[_0xfd26('0x5')]];queues[queues[_0x2f9b37[_0xfd26('0x5')]][_0xfd26('0x10')]][_0xfd26('0x22')]=0x2;delete queues[_0x2f9b37[_0xfd26('0x5')]];}}}catch(_0x10368c){utils[_0xfd26('0x17')](util[_0xfd26('0x3')](_0xfd26('0x1a'),_0x2f9b37['uniqueid']),_0x10368c);}};exports['varset']=function(_0x549707){try{utils['debug'](util[_0xfd26('0x3')]('[%s][queues][varset]',_0x549707[_0xfd26('0x5')]),_0x549707);if(!_[_0xfd26('0x23')](_0x549707['variable']['queuestatus'])&&_0x549707[_0xfd26('0x24')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xfd26('0x23')](queues[_0x549707[_0xfd26('0x5')]])){queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x25')]=![];queues[_0x549707[_0xfd26('0x5')]]['queuecallerabandonAt']=null;queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x1c')]=!![];queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x26')]=utils[_0xfd26('0x16')]();queues[_0x549707['uniqueid']][_0xfd26('0x1e')]=_0x549707['value'][_0xfd26('0x27')]();utils[_0xfd26('0x2')](util[_0xfd26('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x549707[_0xfd26('0x5')],queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x20')],_0x549707[_0xfd26('0x24')],queues[_0x549707['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x549707[_0xfd26('0x5')]]);}}else if(!_['isNil'](_0x549707[_0xfd26('0x28')]['queueposition'])){if(!_[_0xfd26('0x23')](queues[_0x549707[_0xfd26('0x5')]])&&!queues[_0x549707[_0xfd26('0x5')]]['queuecallerabandon']){queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x25')]=![];queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x29')]=null;queues[_0x549707['uniqueid']][_0xfd26('0x1c')]=!![];queues[_0x549707['uniqueid']][_0xfd26('0x26')]=utils['now']();queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x1e')]=_0xfd26('0x2a');utils['info'](util[_0xfd26('0x3')](_0xfd26('0x2b'),_0x549707[_0xfd26('0x5')],queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x20')],_0x549707[_0xfd26('0x24')],queues[_0x549707[_0xfd26('0x5')]][_0xfd26('0x1e')]));}}}catch(_0x2083c7){utils[_0xfd26('0x17')](util[_0xfd26('0x3')](_0xfd26('0x2c'),_0x549707['uniqueid']),_0x2083c7);}};exports[_0xfd26('0x25')]=function(_0x524862){try{if(!_[_0xfd26('0x23')](queues[_0x524862[_0xfd26('0x5')]])){utils[_0xfd26('0x12')](util[_0xfd26('0x3')](_0xfd26('0x2d'),_0x524862[_0xfd26('0x5')]),_0x524862);queues[_0x524862['uniqueid']][_0xfd26('0x1c')]=![];queues[_0x524862['uniqueid']][_0xfd26('0x26')]=null;queues[_0x524862[_0xfd26('0x5')]][_0xfd26('0x25')]=!![];queues[_0x524862[_0xfd26('0x5')]][_0xfd26('0x29')]=utils['now']();queues[_0x524862[_0xfd26('0x5')]][_0xfd26('0x1e')]='ABANDONED';utils[_0xfd26('0x2')](util[_0xfd26('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x524862['uniqueid'],queues[_0x524862[_0xfd26('0x5')]][_0xfd26('0x20')],queues[_0x524862[_0xfd26('0x5')]][_0xfd26('0x1e')]));}}catch(_0x46ea9d){utils['error'](util['format'](_0xfd26('0x2d'),_0x524862[_0xfd26('0x5')]),_0x46ea9d);}};exports[_0xfd26('0x2e')]=function(_0x508124){try{if(!_['isNil'](queues[_0x508124[_0xfd26('0x5')]])){utils[_0xfd26('0x12')](util[_0xfd26('0x3')]('[%s][queues][queuecallerleave]',_0x508124[_0xfd26('0x5')]),_0x508124);utils['info'](util['format'](_0xfd26('0x2f'),_0x508124['uniqueid'],queues[_0x508124['uniqueid']][_0xfd26('0x20')],_0x508124['connectedlinenum'],_0x508124['connectedlinename']));queues[_0x508124[_0xfd26('0x5')]][_0xfd26('0x2e')]=!![];queues[_0x508124[_0xfd26('0x5')]][_0xfd26('0x1b')]=utils['now']();queues[_0x508124[_0xfd26('0x5')]]['holdtime']=utils[_0xfd26('0x30')](queues[_0x508124[_0xfd26('0x5')]][_0xfd26('0x1b')],queues[_0x508124[_0xfd26('0x5')]][_0xfd26('0x31')]);queues[_0x508124[_0xfd26('0x5')]]['position']=_0x508124['position'];queues[_0x508124[_0xfd26('0x5')]][_0xfd26('0x32')]=_0x508124[_0xfd26('0x32')];queues[_0x508124['uniqueid']]['connectedlinenum']=_0x508124['connectedlinenum'];queues[_0x508124[_0xfd26('0x5')]][_0xfd26('0x33')]=_0x508124['connectedlinename'];}}catch(_0x467b7c){utils[_0xfd26('0x17')](util['format']('[%s][queues][queuecallerleave]',_0x508124[_0xfd26('0x5')]),_0x467b7c);}};exports[_0xfd26('0x34')]=function(_0x3685a6){try{if(!_['isNil'](queues[_0x3685a6[_0xfd26('0x5')]])){utils[_0xfd26('0x12')](util[_0xfd26('0x3')](_0xfd26('0x35'),_0x3685a6[_0xfd26('0x5')]),_0x3685a6);utils[_0xfd26('0x2')](util[_0xfd26('0x3')](_0xfd26('0x36'),_0x3685a6[_0xfd26('0x5')],queues[_0x3685a6[_0xfd26('0x5')]][_0xfd26('0x20')],_0x3685a6[_0xfd26('0x37')],_0x3685a6[_0xfd26('0x38')]));queues[_0x3685a6['uniqueid']][_0xfd26('0x25')]=![];queues[_0x3685a6[_0xfd26('0x5')]][_0xfd26('0x25')]=![];queues[_0x3685a6[_0xfd26('0x5')]][_0xfd26('0x29')]=null;queues[_0x3685a6['uniqueid']]['queuecallerexit']=![];queues[_0x3685a6['uniqueid']][_0xfd26('0x1e')]=null;queues[_0x3685a6[_0xfd26('0x5')]][_0xfd26('0x26')]=null;queues[_0x3685a6[_0xfd26('0x5')]][_0xfd26('0x39')]=!![];queues[_0x3685a6[_0xfd26('0x5')]][_0xfd26('0xa')]=_0x3685a6[_0xfd26('0x38')];queues[_0x3685a6[_0xfd26('0x5')]][_0xfd26('0x8')]=_0x3685a6[_0xfd26('0x37')];}}catch(_0x4112f1){utils[_0xfd26('0x17')](util['format'](_0xfd26('0x35'),_0x3685a6['uniqueid']),_0x4112f1);}};exports[_0xfd26('0x3a')]=function(_0x3c0c40){try{if(!_[_0xfd26('0x23')](queues[_0x3c0c40['uniqueid']])){if(queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x1b')]){utils[_0xfd26('0x12')](util['format'](_0xfd26('0x3b'),_0x3c0c40[_0xfd26('0x5')]),_0x3c0c40);queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x25')]=![];queues[_0x3c0c40[_0xfd26('0x5')]]['queuecallerabandon']=![];queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x29')]=null;queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x1c')]=![];queues[_0x3c0c40[_0xfd26('0x5')]]['queuecallerexitAt']=null;queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x39')]=!![];queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x8')]=_0x3c0c40[_0xfd26('0x37')];queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x3c')]=!![];queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x1d')]=utils['now']();if(_0x3c0c40[_0xfd26('0x3d')]=='transfer'){if(!queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x3e')]){queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x1e')]=_0xfd26('0x3f');}}else{queues[_0x3c0c40[_0xfd26('0x5')]][_0xfd26('0x1e')]=_0xfd26('0x40')+_0x3c0c40[_0xfd26('0x3d')][_0xfd26('0x27')]();}utils['info'](util[_0xfd26('0x3')](_0xfd26('0x41'),_0x3c0c40['uniqueid'],queues[_0x3c0c40['uniqueid']][_0xfd26('0x20')],_0x3c0c40[_0xfd26('0x37')],queues[_0x3c0c40[_0xfd26('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x3c0c40['uniqueid']]);}}}catch(_0x167c51){utils['error'](util[_0xfd26('0x3')]('[%s][queues][agentcomplete]',_0x3c0c40['uniqueid']),_0x167c51);}};exports[_0xfd26('0x42')]=function(_0x5282c7){try{if(!_['isNil'](queues[_0x5282c7[_0xfd26('0x43')]])){utils[_0xfd26('0x12')](util['format'](_0xfd26('0x44'),_0x5282c7[_0xfd26('0x5')]),_0x5282c7);queues[_0x5282c7[_0xfd26('0x43')]][_0xfd26('0x3e')]=!![];queues[_0x5282c7[_0xfd26('0x43')]][_0xfd26('0x45')]=_0xfd26('0x46');queues[_0x5282c7[_0xfd26('0x43')]][_0xfd26('0x47')]=_0x5282c7[_0xfd26('0x48')];queues[_0x5282c7[_0xfd26('0x43')]][_0xfd26('0x49')]=_0x5282c7[_0xfd26('0x43')];queues[_0x5282c7[_0xfd26('0x43')]][_0xfd26('0x1e')]=_0xfd26('0x4a');utils[_0xfd26('0x2')](util['format'](_0xfd26('0x4b'),_0x5282c7[_0xfd26('0x5')],queues[_0x5282c7[_0xfd26('0x43')]][_0xfd26('0x20')],_0x5282c7[_0xfd26('0x43')],_0x5282c7[_0xfd26('0x48')]));}}catch(_0x290f48){utils[_0xfd26('0x17')](util['format'](_0xfd26('0x44'),_0x5282c7[_0xfd26('0x5')]),_0x290f48);}};exports[_0xfd26('0x4c')]=function(_0x111a0d){try{utils[_0xfd26('0x12')](util['format'](_0xfd26('0x4d'),_0x111a0d[_0xfd26('0x4e')]),_0x111a0d);if(_0x111a0d[_0xfd26('0x4e')]==_0x111a0d[_0xfd26('0x4f')]){if(!_[_0xfd26('0x23')](queues[_0x111a0d['secondtransfererlinkedid']])){utils['info'](util[_0xfd26('0x3')](_0xfd26('0x50'),_0x111a0d['origtransfereruniqueid'],queues[_0x111a0d[_0xfd26('0x51')]][_0xfd26('0x20')],_0x111a0d[_0xfd26('0x52')]));queues[_0x111a0d[_0xfd26('0x51')]][_0xfd26('0x3e')]=!![];queues[_0x111a0d[_0xfd26('0x51')]]['transfertype']='ATTENDED';queues[_0x111a0d['secondtransfererlinkedid']]['transferexten']=_0x111a0d[_0xfd26('0x52')];queues[_0x111a0d['secondtransfererlinkedid']][_0xfd26('0x49')]=_0x111a0d['origtransfereruniqueid'];queues[_0x111a0d[_0xfd26('0x51')]][_0xfd26('0x1e')]=_0xfd26('0x53');}if(!_[_0xfd26('0x23')](queues[_0x111a0d[_0xfd26('0x4f')]])){if(_0x111a0d['transfereelinkedid']&&queues[_0x111a0d[_0xfd26('0x54')]]){queues[_0x111a0d[_0xfd26('0x54')]][_0xfd26('0x22')]=0x1;queues[_0x111a0d[_0xfd26('0x43')]]=_[_0xfd26('0x55')](queues[_0x111a0d[_0xfd26('0x54')]]);queues[_0x111a0d['transfereeuniqueid']][_0xfd26('0x10')]=_0x111a0d[_0xfd26('0x56')];queues[_0x111a0d[_0xfd26('0x43')]][_0xfd26('0x22')]=0x2;queues[_0x111a0d['transfereeuniqueid']][_0xfd26('0x9')]=queues[_0x111a0d[_0xfd26('0x51')]][_0xfd26('0x9')];queues[_0x111a0d[_0xfd26('0x43')]][_0xfd26('0x57')]=queues[_0x111a0d[_0xfd26('0x51')]][_0xfd26('0x57')];queues[_0x111a0d['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xfd26('0x16')]();queues[_0x111a0d[_0xfd26('0x43')]][_0xfd26('0x1b')]=utils[_0xfd26('0x16')]();queues[_0x111a0d[_0xfd26('0x43')]][_0xfd26('0x58')]=0x0;queues[_0x111a0d[_0xfd26('0x43')]]['mohtime']=0x0;utils['info'](util[_0xfd26('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x111a0d[_0xfd26('0x4e')],queues[_0x111a0d[_0xfd26('0x43')]][_0xfd26('0x20')],queues[_0x111a0d['transfereeuniqueid']][_0xfd26('0x9')],queues[_0x111a0d['transfereeuniqueid']]['calleridname']));}else{utils[_0xfd26('0x2')](util[_0xfd26('0x3')](_0xfd26('0x59'),_0x111a0d[_0xfd26('0x4e')],queues[_0x111a0d[_0xfd26('0x4f')]]['name'],_0x111a0d[_0xfd26('0x51')]));queues[_0x111a0d[_0xfd26('0x4f')]][_0xfd26('0x10')]=_0x111a0d['secondtransfererlinkedid'];}}}else if(_0x111a0d['secondtransfereruniqueid']==_0x111a0d['secondtransfererlinkedid']){if(!_[_0xfd26('0x23')](queues[_0x111a0d['origtransfererlinkedid']])){utils[_0xfd26('0x2')](util[_0xfd26('0x3')](_0xfd26('0x5a'),_0x111a0d[_0xfd26('0x4e')],queues[_0x111a0d['origtransfererlinkedid']]['name'],_0x111a0d[_0xfd26('0x5b')],_0x111a0d[_0xfd26('0x5c')]));queues[_0x111a0d[_0xfd26('0x4f')]]['transfer']=!![];queues[_0x111a0d[_0xfd26('0x4f')]][_0xfd26('0x45')]='ATTENDED';queues[_0x111a0d[_0xfd26('0x4f')]]['transferexten']=_0x111a0d[_0xfd26('0x5c')];queues[_0x111a0d[_0xfd26('0x4f')]][_0xfd26('0x49')]=_0x111a0d[_0xfd26('0x5b')];queues[_0x111a0d[_0xfd26('0x4f')]][_0xfd26('0x1e')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x111a0d[_0xfd26('0x51')]])){if(_0x111a0d['transfertargetlinkedid']&&queues[_0x111a0d[_0xfd26('0x5d')]]){queues[_0x111a0d[_0xfd26('0x5d')]][_0xfd26('0x22')]=0x1;queues[_0x111a0d[_0xfd26('0x56')]]=_[_0xfd26('0x55')](queues[_0x111a0d[_0xfd26('0x5d')]]);queues[_0x111a0d[_0xfd26('0x56')]]['transfereduniqueid']=_0x111a0d['transfertargetuniqueid'];queues[_0x111a0d['transfertargetuniqueid']][_0xfd26('0x22')]=0x2;queues[_0x111a0d[_0xfd26('0x56')]]['calleridnum']=queues[_0x111a0d[_0xfd26('0x4f')]][_0xfd26('0x9')];queues[_0x111a0d['transfertargetuniqueid']][_0xfd26('0x57')]=queues[_0x111a0d[_0xfd26('0x4f')]][_0xfd26('0x57')];queues[_0x111a0d[_0xfd26('0x56')]][_0xfd26('0x31')]=utils[_0xfd26('0x16')]();queues[_0x111a0d[_0xfd26('0x56')]][_0xfd26('0x1b')]=utils['now']();queues[_0x111a0d[_0xfd26('0x56')]]['holdtime']=0x0;queues[_0x111a0d[_0xfd26('0x56')]][_0xfd26('0x5e')]=0x0;utils[_0xfd26('0x2')](util[_0xfd26('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x111a0d['origtransfereruniqueid'],queues[_0x111a0d[_0xfd26('0x56')]][_0xfd26('0x20')],queues[_0x111a0d[_0xfd26('0x56')]][_0xfd26('0x10')],queues[_0x111a0d[_0xfd26('0x56')]][_0xfd26('0x9')],queues[_0x111a0d[_0xfd26('0x56')]][_0xfd26('0x57')]));}else{utils[_0xfd26('0x2')](util[_0xfd26('0x3')](_0xfd26('0x59'),_0x111a0d[_0xfd26('0x4e')],queues[_0x111a0d[_0xfd26('0x51')]]['name'],_0x111a0d['origtransfererlinkedid']));queues[_0x111a0d['secondtransfererlinkedid']]['transfereduniqueid']=_0x111a0d[_0xfd26('0x4f')];}}}}catch(_0x3a059a){utils[_0xfd26('0x17')](util[_0xfd26('0x3')](_0xfd26('0x4d'),_0x111a0d[_0xfd26('0x4e')]),_0x3a059a);}};exports[_0xfd26('0x5f')]=function(_0x3a89a0){try{if(!_['isNil'](queues[_0x3a89a0[_0xfd26('0x5')]])){utils[_0xfd26('0x12')](util['format'](_0xfd26('0x60'),_0x3a89a0[_0xfd26('0x5')]),_0x3a89a0);queues[_0x3a89a0[_0xfd26('0x5')]][_0xfd26('0x61')]=utils[_0xfd26('0x16')]();utils[_0xfd26('0x2')](util[_0xfd26('0x3')](_0xfd26('0x62'),_0x3a89a0[_0xfd26('0x5')],queues[_0x3a89a0[_0xfd26('0x5')]][_0xfd26('0x20')],queues[_0x3a89a0[_0xfd26('0x5')]][_0xfd26('0x61')]));}}catch(_0xbdae70){utils[_0xfd26('0x17')](util[_0xfd26('0x3')]('[%s][queues][musiconholdstart]',_0x3a89a0[_0xfd26('0x5')]),_0xbdae70);}};exports['musiconholdstop']=function(_0x1aae35){try{if(!_['isNil'](queues[_0x1aae35[_0xfd26('0x5')]])){if(!_[_0xfd26('0x23')](queues[_0x1aae35[_0xfd26('0x5')]][_0xfd26('0x61')])){utils[_0xfd26('0x12')](util['format'](_0xfd26('0x63'),_0x1aae35[_0xfd26('0x5')]),_0x1aae35);queues[_0x1aae35[_0xfd26('0x5')]][_0xfd26('0x5e')]+=utils['diffTime'](utils[_0xfd26('0x16')](),queues[_0x1aae35['uniqueid']][_0xfd26('0x61')]);utils[_0xfd26('0x2')](util[_0xfd26('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1aae35[_0xfd26('0x5')],queues[_0x1aae35[_0xfd26('0x5')]][_0xfd26('0x20')],queues[_0x1aae35['uniqueid']][_0xfd26('0x5e')]));delete queues[_0x1aae35[_0xfd26('0x5')]][_0xfd26('0x61')];}}}catch(_0x212dde){utils['error'](util[_0xfd26('0x3')](_0xfd26('0x63'),_0x1aae35[_0xfd26('0x5')]),_0x212dde);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a31d569..635016f 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 _0xc975=['forEach','clone','newexten','application','startsWith','appdata','toLowerCase','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type'];(function(_0x26ac85,_0x33c581){var _0x3dcf9e=function(_0x1c50ac){while(--_0x1c50ac){_0x26ac85['push'](_0x26ac85['shift']());}};_0x3dcf9e(++_0x33c581);}(_0xc975,0x1ce));var _0x5c97=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc975[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5c97('0x0'));var util=require(_0x5c97('0x1'));var utils=require(_0x5c97('0x2'));var recordings={};function writeDB(_0xa1fd20){utils[_0x5c97('0x3')](util[_0x5c97('0x4')]('[%s][recordings][writeDB]',_0xa1fd20[_0x5c97('0x5')]));if(_0xa1fd20[_0x5c97('0x6')]){utils[_0x5c97('0x7')](_0xa1fd20[_0x5c97('0x6')])[_0x5c97('0x8')](function(_0xd9da2f){if(_0xd9da2f){_0xa1fd20[_0x5c97('0x9')]=_0xd9da2f[_0x5c97('0xa')];_0xa1fd20[_0x5c97('0xb')]=_0xd9da2f['id'];}utils[_0x5c97('0xc')](_0x5c97('0xd'),_0xa1fd20);});}else{utils[_0x5c97('0xc')](_0x5c97('0xd'),_0xa1fd20);}}exports[_0x5c97('0xe')]=function(_0x1f7579){try{utils['debug'](util[_0x5c97('0x4')](_0x5c97('0xf'),_0x1f7579['uniqueid']),_0x1f7579);if(_0x1f7579[_0x5c97('0x5')]==_0x1f7579[_0x5c97('0x10')]){utils['info'](util[_0x5c97('0x4')](_0x5c97('0x11'),_0x1f7579['uniqueid'],_0x1f7579['context'],_0x1f7579[_0x5c97('0x12')]));recordings[_0x1f7579[_0x5c97('0x5')]]={'uniqueid':_0x1f7579['uniqueid'],'accountcode':_0x1f7579[_0x5c97('0x6')],'exten':_0x1f7579[_0x5c97('0x12')],'context':_0x1f7579[_0x5c97('0x13')],'channel':_0x1f7579[_0x5c97('0x14')],'monitors':[]};}}catch(_0x39ae7e){utils['error'](util[_0x5c97('0x4')](_0x5c97('0xf'),_0x1f7579[_0x5c97('0x5')]),_0x39ae7e);}};exports['newstate']=function(_0x541017){try{utils['debug'](util[_0x5c97('0x4')](_0x5c97('0x15'),_0x541017[_0x5c97('0x5')]),_0x541017);if(!_['isNil'](recordings[_0x541017['uniqueid']])&&_0x541017['channelstate']==0x6){utils['info'](util['format'](_0x5c97('0x16'),_0x541017[_0x5c97('0x5')],_0x541017['context'],_0x541017['channel']));}else if(!_[_0x5c97('0x17')](recordings[_0x541017['linkedid']])&&_0x541017['channelstate']==0x6&&_0x541017[_0x5c97('0x13')]!=_0x5c97('0x18')){utils['info'](util[_0x5c97('0x4')](_0x5c97('0x19'),_0x541017[_0x5c97('0x5')],_0x541017[_0x5c97('0x10')],_0x541017[_0x5c97('0x13')],_0x541017['channel']));recordings[_0x541017[_0x5c97('0x10')]][_0x5c97('0x6')]=_0x541017[_0x5c97('0x6')];}}catch(_0x21fb3c){utils[_0x5c97('0x1a')](util[_0x5c97('0x4')](_0x5c97('0x15'),_0x541017[_0x5c97('0x5')]),_0x21fb3c);}};exports[_0x5c97('0x1b')]=function(_0x5b1de7){try{if(!_[_0x5c97('0x17')](_0x5b1de7[_0x5c97('0x1c')])&&!_[_0x5c97('0x17')](_0x5b1de7[_0x5c97('0x1c')][_0x5c97('0x1d')])){utils[_0x5c97('0x1e')](util[_0x5c97('0x4')](_0x5c97('0x1f'),_0x5b1de7[_0x5c97('0x5')]),_0x5b1de7);utils['info'](util['format'](_0x5c97('0x20'),_0x5b1de7[_0x5c97('0x5')],_0x5b1de7[_0x5c97('0x1c')],_0x5b1de7[_0x5c97('0x21')]));if(_[_0x5c97('0x22')](_0x5b1de7[_0x5c97('0x21')],'.wav49')){_0x5b1de7[_0x5c97('0x21')]=_0x5b1de7[_0x5c97('0x21')][_0x5c97('0x23')](_0x5c97('0x24'),_0x5c97('0x25'));}if(recordings[_0x5b1de7[_0x5c97('0x10')]]){var _0x2b2901=_[_0x5c97('0x26')](recordings[_0x5b1de7[_0x5c97('0x10')]][_0x5c97('0x27')],{'value':_0x5b1de7['value']});if(_['isNil'](_0x2b2901)){recordings[_0x5b1de7[_0x5c97('0x10')]]['monitors'][_0x5c97('0x28')]({'value':_0x5b1de7[_0x5c97('0x21')]});}}}}catch(_0x2bd326){utils[_0x5c97('0x1a')](util[_0x5c97('0x4')](_0x5c97('0x1f'),_0x5b1de7[_0x5c97('0x5')]),_0x2bd326);}};exports[_0x5c97('0x29')]=function(_0x4e8c10){try{if(!_['isNil'](recordings[_0x4e8c10['uniqueid']])){utils[_0x5c97('0x1e')](util[_0x5c97('0x4')](_0x5c97('0x2a'),_0x4e8c10[_0x5c97('0x5')]),_0x4e8c10);utils['info'](util[_0x5c97('0x4')](_0x5c97('0x2b'),_0x4e8c10['uniqueid'],_0x4e8c10[_0x5c97('0x2c')],_0x4e8c10['calleridname'],_0x4e8c10[_0x5c97('0x2d')]));recordings[_0x4e8c10[_0x5c97('0x5')]][_0x5c97('0x2c')]=_0x4e8c10[_0x5c97('0x2c')];recordings[_0x4e8c10[_0x5c97('0x5')]][_0x5c97('0x2e')]=_0x4e8c10[_0x5c97('0x2e')];recordings[_0x4e8c10[_0x5c97('0x5')]][_0x5c97('0x2f')]=_0x4e8c10[_0x5c97('0x2f')];recordings[_0x4e8c10[_0x5c97('0x5')]][_0x5c97('0x30')]=_0x4e8c10[_0x5c97('0x30')];if(recordings[_0x4e8c10[_0x5c97('0x5')]][_0x5c97('0x31')]=='outbound'&&recordings[_0x4e8c10[_0x5c97('0x5')]]['accountcode']){recordings[_0x4e8c10['uniqueid']][_0x5c97('0x2f')]=recordings[_0x4e8c10[_0x5c97('0x5')]]['accountcode'];recordings[_0x4e8c10['uniqueid']][_0x5c97('0x30')]='';}recordings[_0x4e8c10[_0x5c97('0x5')]][_0x5c97('0x27')][_0x5c97('0x32')](function(_0x120402){var _0x3641f1=_[_0x5c97('0x33')](recordings[_0x4e8c10[_0x5c97('0x5')]]);_0x3641f1[_0x5c97('0x21')]=_0x120402[_0x5c97('0x21')];writeDB(_0x3641f1);});delete recordings[_0x4e8c10[_0x5c97('0x5')]];}}catch(_0x25156d){utils[_0x5c97('0x1a')](util[_0x5c97('0x4')](_0x5c97('0x2a'),_0x4e8c10['uniqueid']),_0x25156d);}};exports[_0x5c97('0x34')]=function(_0x493249){try{if(!_[_0x5c97('0x17')](recordings[_0x493249[_0x5c97('0x5')]])){utils['debug'](util[_0x5c97('0x4')]('[%s][recordings][newexten]',_0x493249['uniqueid']),_0x493249);utils['info'](util[_0x5c97('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x493249[_0x5c97('0x5')],_0x493249[_0x5c97('0x35')],_0x493249['appdata']));if(_0x493249[_0x5c97('0x35')]['toLowerCase']()=='set'&&_[_0x5c97('0x36')](_0x493249[_0x5c97('0x37')][_0x5c97('0x38')](),'cdr')){var _0x259806=_0x493249[_0x5c97('0x37')][_0x5c97('0x39')]('=');var _0x27511b=_0x259806[0x0]['substring'](_0x259806[0x0][_0x5c97('0x3a')]('(')+0x1,_0x259806[0x0][_0x5c97('0x3a')](')'));var _0x52c27c=_0x259806[0x1];recordings[_0x493249[_0x5c97('0x5')]][_0x27511b]=_0x52c27c;}}}catch(_0x5b6e79){utils['error'](util[_0x5c97('0x4')](_0x5c97('0x3b'),_0x493249['uniqueid']),_0x5b6e79);}};exports[_0x5c97('0x3c')]=function(_0x2c2a66){try{if(!_[_0x5c97('0x17')](recordings[_0x2c2a66[_0x5c97('0x5')]])){utils[_0x5c97('0x1e')](util[_0x5c97('0x4')](_0x5c97('0x3d'),_0x2c2a66[_0x5c97('0x5')]),_0x2c2a66);utils[_0x5c97('0x3')](util[_0x5c97('0x4')](_0x5c97('0x3e'),_0x2c2a66[_0x5c97('0x5')],_0x2c2a66[_0x5c97('0x3f')]));recordings[_0x2c2a66[_0x5c97('0x5')]][_0x5c97('0x3f')]=_0x2c2a66[_0x5c97('0x3f')];}}catch(_0xbdc8e0){utils[_0x5c97('0x1a')](util['format'](_0x5c97('0x3d'),_0x2c2a66[_0x5c97('0x5')]),_0xbdc8e0);}}; \ No newline at end of file +var _0x0962=['[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','membername','name','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','exten','context','error','newstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','isNil','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','value','endsWith','.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','hangup'];(function(_0x49a77a,_0x43ba3b){var _0x45419a=function(_0x3bde7e){while(--_0x3bde7e){_0x49a77a['push'](_0x49a77a['shift']());}};_0x45419a(++_0x43ba3b);}(_0x0962,0x116));var _0x2096=function(_0x1b4cc2,_0x25c45e){_0x1b4cc2=_0x1b4cc2-0x0;var _0x4cfb5b=_0x0962[_0x1b4cc2];return _0x4cfb5b;};'use strict';var _=require(_0x2096('0x0'));var util=require(_0x2096('0x1'));var utils=require(_0x2096('0x2'));var recordings={};function writeDB(_0x237146){utils[_0x2096('0x3')](util[_0x2096('0x4')](_0x2096('0x5'),_0x237146[_0x2096('0x6')]));if(_0x237146['accountcode']){utils[_0x2096('0x7')](_0x237146[_0x2096('0x8')])['then'](function(_0x233148){if(_0x233148){_0x237146[_0x2096('0x9')]=_0x233148[_0x2096('0xa')];_0x237146['UserId']=_0x233148['id'];}utils['request'](_0x2096('0xb'),_0x237146);});}else{utils[_0x2096('0xc')](_0x2096('0xb'),_0x237146);}}exports[_0x2096('0xd')]=function(_0x50d65a){try{utils[_0x2096('0xe')](util[_0x2096('0x4')](_0x2096('0xf'),_0x50d65a[_0x2096('0x6')]),_0x50d65a);if(_0x50d65a['uniqueid']==_0x50d65a[_0x2096('0x10')]){utils['info'](util[_0x2096('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x50d65a['uniqueid'],_0x50d65a['context'],_0x50d65a[_0x2096('0x11')]));recordings[_0x50d65a['uniqueid']]={'uniqueid':_0x50d65a[_0x2096('0x6')],'accountcode':_0x50d65a[_0x2096('0x8')],'exten':_0x50d65a[_0x2096('0x11')],'context':_0x50d65a[_0x2096('0x12')],'channel':_0x50d65a['channel'],'monitors':[]};}}catch(_0x5684b9){utils[_0x2096('0x13')](util[_0x2096('0x4')](_0x2096('0xf'),_0x50d65a[_0x2096('0x6')]),_0x5684b9);}};exports[_0x2096('0x14')]=function(_0x222d46){try{utils[_0x2096('0xe')](util[_0x2096('0x4')]('[%s][recordings][newstate]',_0x222d46['uniqueid']),_0x222d46);if(!_['isNil'](recordings[_0x222d46[_0x2096('0x6')]])&&_0x222d46['channelstate']==0x6){utils['info'](util['format'](_0x2096('0x15'),_0x222d46[_0x2096('0x6')],_0x222d46[_0x2096('0x12')],_0x222d46[_0x2096('0x16')]));}else if(!_[_0x2096('0x17')](recordings[_0x222d46[_0x2096('0x10')]])&&_0x222d46['channelstate']==0x6&&_0x222d46['context']!='transfer'){utils['info'](util[_0x2096('0x4')](_0x2096('0x18'),_0x222d46[_0x2096('0x6')],_0x222d46['linkedid'],_0x222d46[_0x2096('0x12')],_0x222d46[_0x2096('0x16')]));recordings[_0x222d46[_0x2096('0x10')]][_0x2096('0x8')]=_0x222d46['accountcode'];}}catch(_0x16d0e8){utils['error'](util['format']('[%s][recordings][newstate]',_0x222d46['uniqueid']),_0x16d0e8);}};exports[_0x2096('0x19')]=function(_0x5b1b61){try{if(!_[_0x2096('0x17')](_0x5b1b61[_0x2096('0x1a')])&&!_['isNil'](_0x5b1b61[_0x2096('0x1a')][_0x2096('0x1b')])){utils[_0x2096('0xe')](util['format']('[%s][recordings][varset]',_0x5b1b61[_0x2096('0x6')]),_0x5b1b61);utils[_0x2096('0x3')](util[_0x2096('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5b1b61[_0x2096('0x6')],_0x5b1b61[_0x2096('0x1a')],_0x5b1b61[_0x2096('0x1c')]));if(_[_0x2096('0x1d')](_0x5b1b61[_0x2096('0x1c')],_0x2096('0x1e'))){_0x5b1b61[_0x2096('0x1c')]=_0x5b1b61['value']['replace'](_0x2096('0x1e'),_0x2096('0x1f'));}if(recordings[_0x5b1b61[_0x2096('0x10')]]){var _0x13df13=_[_0x2096('0x20')](recordings[_0x5b1b61[_0x2096('0x10')]][_0x2096('0x21')],{'value':_0x5b1b61[_0x2096('0x1c')]});if(_['isNil'](_0x13df13)){recordings[_0x5b1b61['linkedid']]['monitors'][_0x2096('0x22')]({'value':_0x5b1b61[_0x2096('0x1c')]});}}}}catch(_0x2264bc){utils[_0x2096('0x13')](util[_0x2096('0x4')](_0x2096('0x23'),_0x5b1b61[_0x2096('0x6')]),_0x2264bc);}};exports[_0x2096('0x24')]=function(_0x562e9f){try{if(!_[_0x2096('0x17')](recordings[_0x562e9f['uniqueid']])){utils[_0x2096('0xe')](util[_0x2096('0x4')](_0x2096('0x25'),_0x562e9f['uniqueid']),_0x562e9f);utils[_0x2096('0x3')](util[_0x2096('0x4')](_0x2096('0x26'),_0x562e9f[_0x2096('0x6')],_0x562e9f[_0x2096('0x27')],_0x562e9f[_0x2096('0x28')],_0x562e9f[_0x2096('0x29')]));recordings[_0x562e9f[_0x2096('0x6')]][_0x2096('0x27')]=_0x562e9f[_0x2096('0x27')];recordings[_0x562e9f[_0x2096('0x6')]]['calleridname']=_0x562e9f[_0x2096('0x28')];recordings[_0x562e9f[_0x2096('0x6')]][_0x2096('0x2a')]=_0x562e9f['connectedlinenum'];recordings[_0x562e9f[_0x2096('0x6')]][_0x2096('0x2b')]=_0x562e9f[_0x2096('0x2b')];if(recordings[_0x562e9f[_0x2096('0x6')]][_0x2096('0x2c')]==_0x2096('0x2d')&&recordings[_0x562e9f['uniqueid']]['accountcode']){recordings[_0x562e9f[_0x2096('0x6')]][_0x2096('0x2a')]=recordings[_0x562e9f[_0x2096('0x6')]][_0x2096('0x8')];recordings[_0x562e9f['uniqueid']][_0x2096('0x2b')]='';}recordings[_0x562e9f[_0x2096('0x6')]][_0x2096('0x21')][_0x2096('0x2e')](function(_0x5b5dda){var _0x75300c=_[_0x2096('0x2f')](recordings[_0x562e9f['uniqueid']]);_0x75300c[_0x2096('0x1c')]=_0x5b5dda[_0x2096('0x1c')];writeDB(_0x75300c);});delete recordings[_0x562e9f[_0x2096('0x6')]];}}catch(_0x2f4dd2){utils[_0x2096('0x13')](util[_0x2096('0x4')](_0x2096('0x25'),_0x562e9f[_0x2096('0x6')]),_0x2f4dd2);}};exports[_0x2096('0x30')]=function(_0x28dcb1){try{if(!_['isNil'](recordings[_0x28dcb1[_0x2096('0x6')]])){utils[_0x2096('0xe')](util[_0x2096('0x4')](_0x2096('0x31'),_0x28dcb1[_0x2096('0x6')]),_0x28dcb1);utils['info'](util['format'](_0x2096('0x32'),_0x28dcb1[_0x2096('0x6')],_0x28dcb1[_0x2096('0x33')],_0x28dcb1[_0x2096('0x34')]));if(_0x28dcb1[_0x2096('0x33')][_0x2096('0x35')]()=='set'&&_[_0x2096('0x36')](_0x28dcb1[_0x2096('0x34')][_0x2096('0x35')](),_0x2096('0x37'))){var _0x27452d=_0x28dcb1[_0x2096('0x34')][_0x2096('0x38')]('=');var _0x23acd9=_0x27452d[0x0][_0x2096('0x39')](_0x27452d[0x0][_0x2096('0x3a')]('(')+0x1,_0x27452d[0x0][_0x2096('0x3a')](')'));var _0x1e7ba1=_0x27452d[0x1];recordings[_0x28dcb1[_0x2096('0x6')]][_0x23acd9]=_0x1e7ba1;}}}catch(_0x28fd59){utils[_0x2096('0x13')](util['format'](_0x2096('0x31'),_0x28dcb1['uniqueid']),_0x28fd59);}};exports[_0x2096('0x3b')]=function(_0x3df307){try{if(!_[_0x2096('0x17')](recordings[_0x3df307[_0x2096('0x6')]])){utils[_0x2096('0xe')](util['format'](_0x2096('0x3c'),_0x3df307[_0x2096('0x6')]),_0x3df307);utils['info'](util[_0x2096('0x4')](_0x2096('0x3d'),_0x3df307['uniqueid'],_0x3df307['queue']));recordings[_0x3df307[_0x2096('0x6')]][_0x2096('0x3e')]=_0x3df307[_0x2096('0x3e')];}}catch(_0x1e77f5){utils[_0x2096('0x13')](util[_0x2096('0x4')](_0x2096('0x3c'),_0x3df307[_0x2096('0x6')]),_0x1e77f5);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b7f7e5e..dc5784c 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 _0x711a=['origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','assign','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','error','lodash','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x37e09b,_0x4c5ee9){var _0x26a1ed=function(_0x5c1d86){while(--_0x5c1d86){_0x37e09b['push'](_0x37e09b['shift']());}};_0x26a1ed(++_0x4c5ee9);}(_0x711a,0x8a));var _0xa711=function(_0x3bbef1,_0x25d2f0){_0x3bbef1=_0x3bbef1-0x0;var _0x50abfb=_0x711a[_0x3bbef1];return _0x50abfb;};'use strict';var _=require(_0xa711('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x153fc2){utils[_0xa711('0x1')](util[_0xa711('0x2')](_0xa711('0x3'),_0x153fc2[_0xa711('0x4')]===_0xa711('0x5')?_0x153fc2[_0xa711('0x6')]:_0x153fc2[_0xa711('0x7')],_0x153fc2[_0xa711('0x4')]));utils['request'](_0xa711('0x8'),_0x153fc2);}exports[_0xa711('0x9')]={};exports[_0xa711('0xa')]=function(_0x35a3ff){try{utils['debug'](util[_0xa711('0x2')](_0xa711('0xb'),_0x35a3ff[_0xa711('0x7')]),_0x35a3ff);utils[_0xa711('0x1')](util[_0xa711('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x35a3ff[_0xa711('0x7')],_0x35a3ff[_0xa711('0xc')],_0x35a3ff[_0xa711('0xd')],_0x35a3ff[_0xa711('0xe')],_0x35a3ff[_0xa711('0xf')]));_0x35a3ff[_0xa711('0x4')]=_0xa711('0x10');exports[_0xa711('0x9')][_0x35a3ff[_0xa711('0x11')]]=_0x35a3ff;writeDB(_0x35a3ff);}catch(_0x59ad5e){utils['error'](util[_0xa711('0x2')]('[%s][transfers][blindtransfer]',_0x35a3ff[_0xa711('0x7')]),_0x59ad5e);}};exports[_0xa711('0x12')]=function(_0x4aa53a){try{utils[_0xa711('0x13')](util['format'](_0xa711('0x14'),_0x4aa53a[_0xa711('0x6')]),_0x4aa53a);utils[_0xa711('0x1')](util[_0xa711('0x2')](_0xa711('0x15'),_0x4aa53a['origtransfereruniqueid'],_0x4aa53a[_0xa711('0x16')],_0x4aa53a[_0xa711('0x17')],_0x4aa53a[_0xa711('0x18')],_0x4aa53a[_0xa711('0x19')]));_0x4aa53a=_['assign'](_0x4aa53a,{'transfererchannel':_0x4aa53a[_0xa711('0x1a')],'transferercalleridnum':_0x4aa53a[_0xa711('0x16')],'transferercalleridname':_0x4aa53a[_0xa711('0x17')],'transfererconnectedlinenum':_0x4aa53a[_0xa711('0x1b')],'transfererconnectedlinename':_0x4aa53a[_0xa711('0x1c')],'transfereraccountcode':_0x4aa53a[_0xa711('0x1d')],'transferercontext':_0x4aa53a['secondtransferercontext'],'transfererexten':_0x4aa53a[_0xa711('0x1e')],'transfererlinkedid':_0x4aa53a[_0xa711('0x1f')],'context':_0x4aa53a[_0xa711('0x20')],'extension':_0x4aa53a[_0xa711('0x21')],'type':_0xa711('0x5')});if(_['isNil'](_0x4aa53a[_0xa711('0x22')])){_0x4aa53a=_[_0xa711('0x23')](_0x4aa53a,{'transfereechannel':_0x4aa53a['transfertargetchannel'],'transfereecalleridnum':_0x4aa53a['transfertargetcalleridnum'],'transfereecalleridname':_0x4aa53a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4aa53a[_0xa711('0x24')],'transfereeconnectedlinename':_0x4aa53a[_0xa711('0x25')],'transfereeaccountcode':_0x4aa53a['transfertargetaccountcode'],'transfereecontext':_0x4aa53a['transfertargetcontext'],'transfereeexten':_0x4aa53a[_0xa711('0x26')],'transfereelinkedid':_0x4aa53a['transfertargetlinkedid']});}writeDB(_0x4aa53a);}catch(_0xb364c8){utils[_0xa711('0x27')](util[_0xa711('0x2')](_0xa711('0x14'),_0x4aa53a['origtransfereruniqueid']),_0xb364c8);}}; \ No newline at end of file +var _0x2436=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','request','blinds','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x3a5525,_0x197475){var _0xee4947=function(_0x2f34f0){while(--_0x2f34f0){_0x3a5525['push'](_0x3a5525['shift']());}};_0xee4947(++_0x197475);}(_0x2436,0x19b));var _0x6243=function(_0x144faa,_0x3851c6){_0x144faa=_0x144faa-0x0;var _0x2e5d1c=_0x2436[_0x144faa];return _0x2e5d1c;};'use strict';var _=require('lodash');var util=require(_0x6243('0x0'));var utils=require(_0x6243('0x1'));function writeDB(_0xa59f95){utils[_0x6243('0x2')](util[_0x6243('0x3')](_0x6243('0x4'),_0xa59f95['type']==='attended'?_0xa59f95[_0x6243('0x5')]:_0xa59f95[_0x6243('0x6')],_0xa59f95[_0x6243('0x7')]));utils[_0x6243('0x8')]('CreateVoiceTransferReport',_0xa59f95);}exports[_0x6243('0x9')]={};exports['blindtransfer']=function(_0x17a70d){try{utils['debug'](util[_0x6243('0x3')](_0x6243('0xa'),_0x17a70d[_0x6243('0x6')]),_0x17a70d);utils[_0x6243('0x2')](util[_0x6243('0x3')](_0x6243('0xb'),_0x17a70d[_0x6243('0x6')],_0x17a70d['transferercalleridnum'],_0x17a70d[_0x6243('0xc')],_0x17a70d[_0x6243('0xd')],_0x17a70d[_0x6243('0xe')]));_0x17a70d[_0x6243('0x7')]='blind';exports['blinds'][_0x17a70d['transfereruniqueid']]=_0x17a70d;writeDB(_0x17a70d);}catch(_0x5f3eae){utils[_0x6243('0xf')](util[_0x6243('0x3')](_0x6243('0xa'),_0x17a70d['uniqueid']),_0x5f3eae);}};exports[_0x6243('0x10')]=function(_0x1db5d4){try{utils['debug'](util[_0x6243('0x3')](_0x6243('0x11'),_0x1db5d4[_0x6243('0x5')]),_0x1db5d4);utils[_0x6243('0x2')](util[_0x6243('0x3')](_0x6243('0x12'),_0x1db5d4[_0x6243('0x5')],_0x1db5d4[_0x6243('0x13')],_0x1db5d4[_0x6243('0x14')],_0x1db5d4[_0x6243('0x15')],_0x1db5d4['transfertargetcalleridname']));_0x1db5d4=_[_0x6243('0x16')](_0x1db5d4,{'transfererchannel':_0x1db5d4[_0x6243('0x17')],'transferercalleridnum':_0x1db5d4['origtransferercalleridnum'],'transferercalleridname':_0x1db5d4[_0x6243('0x14')],'transfererconnectedlinenum':_0x1db5d4['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1db5d4[_0x6243('0x18')],'transfereraccountcode':_0x1db5d4['origtransfereraccountcode'],'transferercontext':_0x1db5d4[_0x6243('0x19')],'transfererexten':_0x1db5d4[_0x6243('0x1a')],'transfererlinkedid':_0x1db5d4[_0x6243('0x1b')],'context':_0x1db5d4[_0x6243('0x1c')],'extension':_0x1db5d4[_0x6243('0x1d')],'type':_0x6243('0x1e')});if(_['isNil'](_0x1db5d4['transfereechannel'])){_0x1db5d4=_[_0x6243('0x16')](_0x1db5d4,{'transfereechannel':_0x1db5d4['transfertargetchannel'],'transfereecalleridnum':_0x1db5d4[_0x6243('0x15')],'transfereecalleridname':_0x1db5d4['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1db5d4[_0x6243('0x1f')],'transfereeconnectedlinename':_0x1db5d4[_0x6243('0x20')],'transfereeaccountcode':_0x1db5d4[_0x6243('0x21')],'transfereecontext':_0x1db5d4[_0x6243('0x22')],'transfereeexten':_0x1db5d4[_0x6243('0x23')],'transfereelinkedid':_0x1db5d4[_0x6243('0x24')]});}writeDB(_0x1db5d4);}catch(_0x234f81){utils[_0x6243('0xf')](util[_0x6243('0x3')](_0x6243('0x11'),_0x1db5d4[_0x6243('0x5')]),_0x234f81);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d7dbd86..224186a 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 _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x2c54db,_0x4decb4){var _0x40c4e4=function(_0x22acbc){while(--_0x22acbc){_0x2c54db['push'](_0x2c54db['shift']());}};_0x40c4e4(++_0x4decb4);}(_0x7a54,0x106));var _0x47a5=function(_0x11c167,_0x1cba6d){_0x11c167=_0x11c167-0x0;var _0x36f30b=_0x7a54[_0x11c167];return _0x36f30b;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a213a,_0x2b4a23){_0x5a213a=_0x5a213a-0x0;var _0x3577b3=_0xb10b[_0x5a213a];return _0x3577b3;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file